Proxy that allows a CA to perform GraphQL queries.
- Source:
Extends
Methods
dirtyEvalQuery(self) → {Promise.<Object>}
- Source:
Evaluates the GraphQL query.
This is a "dirty" call, i.e., it returns a promise so that the CA can block waiting for completion before processing the next message, and it may externalize internal state before checkpointing.
Parameters:
Name | Type | Description |
---|---|---|
self |
Object | The object reference for the CA, i.e., |
Returns:
A promise that we can await
to
block further message processing. It resolves to null
if the query
result has not changed since the last call. Otherwise, it returns
the query result or an error if it cannot be evaluated.
- Type
- Promise.<Object>
dirtyReset()
- Source:
Forgets the value of the previous query.
The CA always resets after a resume, i.e., the previous value is never checkpointed.
It is a "dirty" call because the reset is visible immediately.
By calling dirtyReset
before dirtyEvalQuery
the query will always returns a value.
setQuery(query)
- Source:
Sets a new GraphQL query or resets a previous one.
Parameters:
Name | Type | Description |
---|---|---|
query |
string | null | A new query or null to reset. |
setResolverMethod(methodName)
- Source:
Sets the name of the method that returns a resolver object.
When this method name is not set, a default resolver that look up
properties using this.state
as root object will be used.
The resolver method should have a signature like:
async __ca_resolver__() : [err, ResolverObject]
The returned Resolver object methods use the standard GraphQL signature:
whatever(obj, args, context, info) {...}
and context
has a key self
with value the this
reference in the
current CA. For top level objects obj
is always this.state
, as
mentioned above. See GraphGL
documentation for details.
Parameters:
Name | Type | Description |
---|---|---|
methodName |
string | null | The name of a CA method that
returns a resolver object or |