resolveHelper
@twine-protocol/twine-core v0.1.0 • Docs
twine-js / @twine-protocol/twine-core / resolveHelper
Function: resolveHelper()
A helper function for implementing the Resolver.resolve method
Param
The fetchers to use
Param
The query to resolve
Param
Options for the resolution
See
MemoryStore.resolve for an example of how to use this
Example
class MemoryStore {
async resolve(query: IntoResolveChainQuery, options?: ResolveOptions): Promise<ChainResolution>
async resolve(query: IntoResolvePulseQuery, options?: ResolveOptions): Promise<PulseResolution>
async resolve(query: any, options?: ResolveOptions) {
return resolveHelper({
fetchChain: ({ chainCID }) => this.fetch(chainCID) as Chain | null,
fetchPulse: ({ pulseCID }) => this.fetch(pulseCID) as Pulse | null
}, query, options)
}
//...
}
resolveHelper(callers, thing, options)
resolveHelper(
callers
,thing
,options
?):Promise
<ChainResolution
>
A helper function for implementing the Resolver.resolve method
Parameters
Returns
Promise
<ChainResolution
>
Param
The fetchers to use
Param
The query to resolve
Param
Options for the resolution
See
MemoryStore.resolve for an example of how to use this
Example
class MemoryStore {
async resolve(query: IntoResolveChainQuery, options?: ResolveOptions): Promise<ChainResolution>
async resolve(query: IntoResolvePulseQuery, options?: ResolveOptions): Promise<PulseResolution>
async resolve(query: any, options?: ResolveOptions) {
return resolveHelper({
fetchChain: ({ chainCID }) => this.fetch(chainCID) as Chain | null,
fetchPulse: ({ pulseCID }) => this.fetch(pulseCID) as Pulse | null
}, query, options)
}
//...
}
Defined in
packages/twine-core/src/resolver/helpers.ts:183
resolveHelper(callers, thing, options)
resolveHelper(
callers
,thing
,options
?):Promise
<PulseResolution
>
A helper function for implementing the Resolver.resolve method
Parameters
Returns
Promise
<PulseResolution
>
Param
The fetchers to use
Param
The query to resolve
Param
Options for the resolution
See
MemoryStore.resolve for an example of how to use this
Example
class MemoryStore {
async resolve(query: IntoResolveChainQuery, options?: ResolveOptions): Promise<ChainResolution>
async resolve(query: IntoResolvePulseQuery, options?: ResolveOptions): Promise<PulseResolution>
async resolve(query: any, options?: ResolveOptions) {
return resolveHelper({
fetchChain: ({ chainCID }) => this.fetch(chainCID) as Chain | null,
fetchPulse: ({ pulseCID }) => this.fetch(pulseCID) as Pulse | null
}, query, options)
}
//...
}
Defined in
Last updated