import { GraphQLError, FragmentDefinitionNode, OperationDefinitionNode, OperationTypeDefinitionNode } from "graphql"; import { FieldGroup } from "./collectFields"; import type { ObjMap } from "./jsutils/ObjMap"; import type { Path } from "./jsutils/Path"; import type { PromiseOrValue } from "./jsutils/PromiseOrValue"; import type { ExecutionWithoutSchemaArgs, FunctionFieldResolver, ResolveInfo, TypeResolver, ExecutionResult, TotalExecutionResult, IncrementalExecutionResult, SchemaFragment, SchemaFragmentLoader, SchemaFragmentRequest } from "./types"; import type { ExecutionHooks } from "./hooks/types"; /** * Terminology * * "Definitions" are the generic name for top-level statements in the document. * Examples of this include: * 1) Operations (such as a query) * 2) Fragments * * "Operations" are a generic name for requests in the document. * Examples of this include: * 1) query, * 2) mutation * * "Selections" are the definitions that can appear legally and at * single level of the query. These include: * 1) field references e.g "a" * 2) fragment "spreads" e.g. "...c" * 3) inline fragment "spreads" e.g. "...on Type { a }" */ /** * Data that must be available at all points during query execution. * * Namely, schema of the type system that is currently executing, * and the fragments defined in the query document */ export interface ExecutionContext { schemaFragment: SchemaFragment; schemaFragmentLoader?: SchemaFragmentLoader; fragments: ObjMap; rootValue: unknown; contextValue: unknown; buildContextValue?: (contextValue?: unknown) => unknown; operation: OperationDefinitionNode; variableValues: VariableValues; fieldResolver: FunctionFieldResolver; typeResolver: TypeResolver; subscribeFieldResolver: FunctionFieldResolver; errors: Array; fieldExecutionHooks?: ExecutionHooks; subsequentPayloads: Set; enablePerEventContext: boolean; enableEarlyExecution: boolean; } type VariableValues = { [variable: string]: unknown; }; /** * 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. */ export declare function executeWithoutSchema(args: ExecutionWithoutSchemaArgs): PromiseOrValue; export interface SchemaFragmentLoaderContext { contextValue: unknown; schemaFragment: SchemaFragment; schemaFragmentLoader?: SchemaFragmentLoader; } export declare function requestSchemaFragment(exeContext: SchemaFragmentLoaderContext, request: SchemaFragmentRequest): PromiseOrValue; /** * @internal */ export declare function buildResolveInfo(exeContext: ExecutionContext, fieldName: string, fieldGroup: FieldGroup, parentTypeName: string, returnTypeName: string, path: Path, incrementalDataRecord?: IncrementalDataRecord): ResolveInfo; /** * If a resolveType function is not given, then a default resolve behavior is * used which attempts two strategies: * * First, See if the provided value has a `__typename` field defined, if so, use * that value as name of the resolved type. * * Otherwise, test each possible type for the abstract type by calling * isTypeOf for the object being coerced, returning the first type that matches. */ export declare const defaultTypeResolver: TypeResolver; /** * If a resolve function is not given, then a default resolve behavior is used * which takes the property of the source object of the same name as the field * and returns it as the result, or if it's a function, returns the result * of calling that function while passing along args and context value. */ export declare const defaultFieldResolver: FunctionFieldResolver; export declare function getOperationRootTypeName(operation: OperationDefinitionNode | OperationTypeDefinitionNode): string; export type IncrementalDataRecord = DeferredFragmentRecord | StreamItemsRecord; declare class DeferredFragmentRecord { type: "defer"; errors: Array; label: string | undefined; path: Array; promise: Promise; data: ObjMap | null; parentContext: IncrementalDataRecord | undefined; isCompleted: boolean; _exeContext: ExecutionContext; _resolve?: (arg: PromiseOrValue | null>) => void; constructor(opts: { label: string | undefined; path: Path | undefined; parentContext: IncrementalDataRecord | undefined; exeContext: ExecutionContext; }); private complete; addData(data: PromiseOrValue | null>): void; } declare class StreamItemsRecord { type: "stream"; errors: Array; label: string | undefined; path: Array; items: Array | null; promise: Promise; parentContext: IncrementalDataRecord | undefined; asyncIterator: AsyncIterator | undefined; isCompletedAsyncIterator?: boolean; isCompleted: boolean; _exeContext: ExecutionContext; _resolve?: (arg: PromiseOrValue | null>) => void; constructor(opts: { label: string | undefined; path: Path | undefined; asyncIterator?: AsyncIterator; parentContext: IncrementalDataRecord | undefined; exeContext: ExecutionContext; }); addItems(items: PromiseOrValue | null>): void; setIsCompletedAsyncIterator(): void; } export declare function isIncrementalExecutionResult, TExtensions = ObjMap>(result: ExecutionResult): result is IncrementalExecutionResult; export declare function isTotalExecutionResult, TExtensions = ObjMap>(result: ExecutionResult): result is TotalExecutionResult; export {}; //# sourceMappingURL=executeWithoutSchema.d.ts.map