Skip to main content

execute

Callable

  • execute<TEnableIncremental>(args: ExecutionArgs): PromiseOrValue<MaybeIncrementalMap<TEnableIncremental>>

  • Implements the “Executing requests” section of the GraphQL specification.

    Returns either a synchronous ExecutionResult (if all encountered resolvers are synchronous), or a Promise of an ExecutionResult that will eventually be resolved and never rejected.

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

    This function also supports experimental incremental delivery directives (@defer and @stream). To use these directives, they should be added to the schema and TS generic parameter TMaybeIncremental should be set to true (default: false).

    Note: At runtime, the schema is not checked as to whether these directives are actually present; all operations passed to execute are assumed to be valid.

    If the incremental delivery directives are used the return type of this function may also be an ExperimentalIncrementalExecutionResults object (or a Promise thereof), This object either consists of a an initialResult and a stream of subsequentResults.


    Type parameters

    • TEnableIncremental: boolean = false

    Parameters

    Returns PromiseOrValue<MaybeIncrementalMap<TEnableIncremental>>