Clear the process-wide APQ cache shared by all client instances.
Get APQ cache metrics for this client.
An object with size (number of cached query hashes),
hits (cache hit count), and misses (cache miss count).
Execute a GraphQL query and return the data payload. Automatically detects the operation name if one is not explicitly provided.
Shape of the expected data object in the response
Shape of the variables object
GraphQL query string
Optionalvariables: VOptional query variables
Additional options (operationName, headers, signal, extensions)
The data field from the GraphQL response
GraphQLClientError On network errors, GraphQL errors, or missing data
Execute a GraphQL mutation. Delegates to GraphQLClient.query — mutations use POST semantics automatically via the client's transport layer.
Shape of the expected data object in the response
Shape of the variables object
GraphQL mutation string
Optionalvariables: VOptional mutation variables
Additional options
The data field from the GraphQL response
Execute a GraphQL mutation with file uploads using the GraphQL multipart request spec.
The request body is sent as multipart/form-data with:
operations — the JSON-encoded GraphQL request (file variables replaced
with null)map — mapping of file indices to variable paths0, 1, … — the actual file blobsShape of the expected data object in the response
GraphQL mutation string
Mutation variables (file variables excluded —
pass them via uploads)
Array of file uploads with variable paths
Additional options
The data field from the GraphQL response
Execute multiple GraphQL requests in a single batch HTTP call. All requests are sent as a JSON array to the endpoint, and the response must be a JSON array of GraphQLResponse objects.
Expected element type in the returned array (defaults to
unknown[] for maximum flexibility)
Array of GraphQL requests
Additional options (signal)
Array of data fields, one per request in order
GraphQLClientError If the batch response is not an array, contains GraphQL errors, or is missing data for any request
Subscribe to GraphQL subscriptions using Server-Sent Events (SSE).
Shape of yielded data values
Shape of subscription variables
GraphQL subscription string
Optionalvariables: VOptional subscription variables
Options: custom url, signal, operationName
// Basic subscription
for await (const data of client.subscribe(`subscription { onMessage { text } }`)) {
console.log(data);
}
// With variables and custom endpoint
for await (const data of client.subscribe(
`subscription OnMessage($chatId: ID!) { onMessage(chatId: $chatId) { text } }`,
{ chatId: "123" },
{ url: "wss://api.example.com/graphql" }
)) {
console.log(data);
}
Use SSE (this method) when:
Use WebSocket (ws.ts) when:
Currently reconnect: false - subscriptions do NOT auto-reconnect on disconnect.
This is intentional: re-establishing a subscription requires re-subscribing
with the same operation, which may have side effects on the server.
Caller should handle reconnection logic if needed.
Introspect the GraphQL schema using the standard __schema query.
Returns the raw schema object without type-safety.
The full __schema introspection result
Execute a raw GraphQLRequest and return the full
GraphQLResponse including data, errors, and extensions.
Unlike query, this does NOT throw on GraphQL errors — the caller
inspects the response directly.
Expected type of the data field
Fully-formed GraphQL request
Optionalsignal: AbortSignalOptional abort signal
The full GraphQL response envelope
GraphQL client configuration