Holds additional metadata for an Operation
used to execute it.
The OperationContext is created by the Client but may also be modified by Exchanges and is used as metadata by them.
Optional
extensionsAdditional metadata that a GraphQL API may accept for spec extensions.
https://github.com/graphql/graphql-over-http/blob/1928447/spec/GraphQLOverHTTP.md#request-parameters for the GraphQL over HTTP spec
Unique identifier for the GraphQLRequest
.
This is a key that combines the unique key of the query
and the variables
into a unique
key
for the GraphQLRequest
. Any request with the same query and variables will have a unique
key
by which results and requests can be identified as identical.
Internally, a stable, cached key
is generated for the DocumentNode
and for the variables
and
both will be combined into a combined key
which is set here, based on a DJB2 hash,
The variables
will change the key even if they contain a non-JSON reference. If you pass a custom
class instance to variables
that doesn't contain a toString
or toJSON
method, a stable but random
identifier will replace this class to generate a key.
Readonly
kindThe OperationType
describing the kind of Operation
.
This is used to describe what to do with the GraphQLRequest of an Operation and is set
to a GraphQL operation type (query
, mutation
, or subscription
) to start an Operation
; and to
teardown
to cancel an operation, which either terminates it early or lets exchanges know that no
consumer is interested in this operation any longer.
A GraphQL document to execute against a cache or API.
A GraphQLRequest
is executed against an operation in a GraphQL document.
In urql
, we expect a document to only contain a single operation that is executed rather than
multiple ones by convention.
Variables used to execute the query
document.
The variables
, based either on the AnyVariables type or the TypedDocumentNode's provided
generic, are sent to the GraphQL API to execute a request.
Generated using TypeDoc
The inputs to
urql
's Exchange pipeline to instruct them to execute a GraphQL operation.Remarks
An
Operation
, inurql
, starts a GraphQLRequest and are events. Thekind
of anOperation
can be set to any operation kind of GraphQL, namelyquery
,mutation
, orsubscription
. To terminate an operation, once it's cancelled, ateardown
kind event is sent.The ExchangeIO type describes how Exchanges receive
Operation
s and returnOperationResults
, usingteardown
Operation
s to cancel ongoing operations.See
https://urql.dev/goto/docs/architecture/#the-client-and-exchanges for more information on the flow of Exchanges.