mikeal / dagdb

Syncable database built on IPLD

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

feat: resolvers should take and return resolved values

carsonfarmer opened this issue · comments

commented

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.