dagdb
dagdb copied to clipboard
feat: resolvers should take and return resolved values
They should operate on resolved values, rather than "raw" blocks. Any sufficiently complex resolution function will end up doing this anyway. A ideal API might essentially just expect the following interface to be satisfied:
type Getter = (cid: CID) => Block
type Resolver<T=any> = (locals: (Op<T>|T)[], remotes: (Op<T>|T)[], get: Getter) => AsyncIterable<Op<T>|T>
Where Operation
is defined in https://github.com/mikeal/dagdb/blob/master/src/schema.js, and Op<T>
is a resolved Operation
specifying a val
of type T
.