Right now Node.resolve() is coupled to the network because it always calls com.atproto.repo.getRecord on the PDS. This should be customisable to allow for resolving from a local fs-based cache, database, or in memory (useful for testing).
This is kinda possible by injecting your own fetch implementation but it's annoying to work with, a better interface would be ideal here. Something like (did, nsid, cid?) => Promise<doc>.
There's an open question about what you do with authority resolution. We want the ability to swap this out in a similar way, at least for testing and caching. But sometimes we probably want to ensure that the authority has been fetched, maybe even on a lexicon-by-lexicon basis (not globally for the whole program). So maybe the above signature becomes (authority, nsid, cid?) => Promise<doc>
Right now
Node.resolve()is coupled to the network because it always callscom.atproto.repo.getRecordon the PDS. This should be customisable to allow for resolving from a local fs-based cache, database, or in memory (useful for testing).This is kinda possible by injecting your own
fetchimplementation but it's annoying to work with, a better interface would be ideal here. Something like(did, nsid, cid?) => Promise<doc>.There's an open question about what you do with authority resolution. We want the ability to swap this out in a similar way, at least for testing and caching. But sometimes we probably want to ensure that the authority has been fetched, maybe even on a lexicon-by-lexicon basis (not globally for the whole program). So maybe the above signature becomes
(authority, nsid, cid?) => Promise<doc>