graphql
Version:
A Query Language and Runtime which can target any service.
1 lines • 5.34 kB
Source Map (JSON)
{"version":3,"file":"ExecutionArgs.js","sourceRoot":"","sources":["../../src/execution/ExecutionArgs.ts"],"names":[],"mappings":"","sourcesContent":["/** @category Execution */\n\nimport type { Maybe } from '../jsutils/Maybe.ts';\nimport type { ObjMap } from '../jsutils/ObjMap.ts';\n\nimport type {\n DocumentNode,\n FragmentDefinitionNode,\n OperationDefinitionNode,\n SubscriptionOperationDefinitionNode,\n} from '../language/ast.ts';\n\nimport type {\n GraphQLFieldResolver,\n GraphQLTypeResolver,\n} from '../type/definition.ts';\nimport type { GraphQLSchema } from '../type/schema.ts';\n\nimport type { FragmentDetails } from './collectFields.ts';\nimport type { VariableValues } from './values.ts';\n\n/** Arguments accepted by execute and executeSync. */\nexport interface ExecutionArgs {\n /** The schema used for validation or execution. */\n schema: GraphQLSchema;\n /** The parsed GraphQL document to execute. */\n document: DocumentNode;\n /** Initial root value passed to the operation. */\n rootValue?: unknown;\n /** Application context value passed to every resolver. */\n contextValue?: unknown;\n /** Runtime variable values keyed by variable name. */\n variableValues?: Maybe<{ readonly [variable: string]: unknown }>;\n /** Name of the operation to execute when the document contains multiple operations. */\n operationName?: Maybe<string>;\n /** Resolver used when a field does not define its own resolver. */\n fieldResolver?: Maybe<GraphQLFieldResolver<any, any>>;\n /** Resolver used when an abstract type does not define its own resolver. */\n typeResolver?: Maybe<GraphQLTypeResolver<any, any>>;\n /** Resolver used for the root subscription field. */\n subscribeFieldResolver?: Maybe<GraphQLFieldResolver<any, any>>;\n /** Whether suggestion text should be omitted from request errors. */\n hideSuggestions?: Maybe<boolean>;\n /** AbortSignal used to cancel execution. */\n abortSignal?: Maybe<AbortSignal>;\n /** Whether incremental execution may begin eligible work early. */\n enableEarlyExecution?: Maybe<boolean>;\n /** Execution hooks invoked during this operation. */\n hooks?: Maybe<ExecutionHooks>;\n /** Additional execution options. */\n options?: {\n /**\n * Set the maximum number of errors allowed for coercing (defaults to 50).\n *\n * @internal\n */\n maxCoercionErrors?: number;\n };\n}\n\n/**\n * Data that must be available at all points during query execution.\n *\n * Namely, schema of the type system that is currently executing,\n * and the fragments defined in the query document\n */\nexport interface ValidatedExecutionArgs {\n /** Schema used for execution. */\n schema: GraphQLSchema;\n /** Parsed GraphQL document being executed. */\n document: DocumentNode;\n // TODO: consider deprecating/removing fragmentDefinitions if/when fragment\n // arguments are officially supported and/or the full fragment details are\n // exposed within GraphQLResolveInfo.\n /** Fragment definitions keyed by fragment name. */\n fragmentDefinitions: ObjMap<FragmentDefinitionNode>;\n /** Fragment details keyed by fragment name. */\n fragments: ObjMap<FragmentDetails>;\n /** Root value passed to the operation. */\n rootValue: unknown;\n /** Application context value passed to every resolver. */\n contextValue: unknown;\n /** Operation definition selected for execution. */\n operation: OperationDefinitionNode;\n /** Operation variable values with source metadata and coerced runtime values. */\n variableValues: VariableValues;\n /** Raw variable values provided by the caller before coercion. */\n rawVariableValues: Maybe<{ readonly [variable: string]: unknown }>;\n /** Resolver used for fields without an explicit resolver. */\n fieldResolver: GraphQLFieldResolver<any, any>;\n /** Resolver used for abstract types without an explicit type resolver. */\n typeResolver: GraphQLTypeResolver<any, any>;\n /** Resolver used for subscription fields without an explicit subscribe resolver. */\n subscribeFieldResolver: GraphQLFieldResolver<any, any>;\n /** Whether suggestion text should be omitted from execution errors. */\n hideSuggestions: boolean;\n /** Whether execution should use error propagation. */\n errorPropagation: boolean;\n /** External signal that may abort execution. */\n externalAbortSignal: AbortSignal | undefined;\n /** Whether incremental execution may begin eligible work early. */\n enableEarlyExecution: boolean;\n /** Execution hooks supplied by the caller. */\n hooks: ExecutionHooks | undefined;\n}\n\n/** Validated execution arguments for a subscription operation. */\nexport interface ValidatedSubscriptionArgs extends ValidatedExecutionArgs {\n /** Subscription operation definition selected for execution. */\n operation: SubscriptionOperationDefinitionNode;\n}\n\n/** Information passed to hooks after asynchronous execution work has finished. */\nexport interface AsyncWorkFinishedInfo {\n /** Validated execution arguments for the operation that finished async work. */\n validatedExecutionArgs: ValidatedExecutionArgs;\n}\n\n/** Optional hooks invoked during GraphQL execution. */\nexport interface ExecutionHooks {\n /** Called after all tracked asynchronous execution work has settled. */\n asyncWorkFinished?: (info: AsyncWorkFinishedInfo) => void;\n}\n"]}