dagdb icon indicating copy to clipboard operation
dagdb copied to clipboard

feat: resolvers should take and return resolved values

Open carsonfarmer opened this issue 3 years ago • 0 comments

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.

carsonfarmer avatar Nov 01 '20 23:11 carsonfarmer