Reference
Operation options
This page lists every option a GraphQL operation takes. Look here when you write a new Operation and need an option’s exact type or default.
new Operation<TVariables, TData>(config) takes an OperationConfig. TVariables is the variables type and TData is the type of the response’s data (GraphQL).
| Option | Type | Default | What it does |
|---|---|---|---|
operation | string | required | The GraphQL document, sent as query in the body. |
middleware | Middleware[] | — | Runs on every call to this operation, after client middleware and before call middleware. |
headers | HeadersInit | — | Sent with every call to this operation. Replaces the client’s value for the same header. |
fetchOptions | FetchOptions | — | Options passed through to fetch on every call to this operation. Each field replaces the client’s. |
dedupe | boolean | false | A new call cancels the one still running (Drop stale calls with dedupe). |
share | boolean | false | Calls that would send the identical request share one network request (Sharing identical requests). Variables must match exactly, key order included. Can’t be combined with dedupe: createGraphQL throws if both are set. |
schema | StandardSchemaV1 | — | Checks the response’s data. The response type stays explicit (Validating responses). |
timeout | number (ms) | the client’s timeout | One deadline for the whole call, retries included. Replaces the client’s, and 0 turns it off. Under share, it is also the shared request’s deadline. |
An operation has no method, path, responseType or bodyAs. Every operation is a POST of { query, variables }, and the response is always read as JSON (Same as REST, and different).
Next: CallOptions lists what you can pass to one call.