Skip to Content
GraphQL Tools
DocumentationAPI@graphql-tools/executorsrcfunctionsexecute

Function: execute()

execute<TData, TVariables, TContext>(args): MaybePromise<SingularExecutionResult<TData, any> | IncrementalExecutionResults<TData, Record<string, unknown>>>

Defined in: packages/executor/src/execution/execute.ts:266

Implements the “Executing requests” section of the GraphQL specification, including @defer and @stream as proposed in https://github.com/graphql/graphql-spec/pull/742

This function returns a Promise of an IncrementalExecutionResults object. This object either consists of a single ExecutionResult, or an object containing an initialResult and a stream of subsequentResults.

If the arguments to this function do not result in a legal execution context, a GraphQLError will be thrown immediately explaining the invalid input.

Type Parameters

TData

TData = any

TVariables

TVariables = any

TContext

TContext = any

Parameters

args

ExecutionArgs<TData, TVariables, TContext>

Returns

MaybePromise<SingularExecutionResult<TData, any> | IncrementalExecutionResults<TData, Record<string, unknown>>>