summaryrefslogtreecommitdiff
path: root/school/node_modules/graphql/execution/execute.d.ts
diff options
context:
space:
mode:
authorMinteck <contact@minteck.org>2023-01-10 14:54:04 +0100
committerMinteck <contact@minteck.org>2023-01-10 14:54:04 +0100
commit99c1d9af689e5325f3cf535c4007b3aeb8325229 (patch)
treee663b3c2ebdbd67c818ac0c5147f0ce1d2463cda /school/node_modules/graphql/execution/execute.d.ts
parent9871b03912fc28ad38b4037ebf26a78aa937baba (diff)
downloadpluralconnect-99c1d9af689e5325f3cf535c4007b3aeb8325229.tar.gz
pluralconnect-99c1d9af689e5325f3cf535c4007b3aeb8325229.tar.bz2
pluralconnect-99c1d9af689e5325f3cf535c4007b3aeb8325229.zip
Update - This is an automated commit
Diffstat (limited to 'school/node_modules/graphql/execution/execute.d.ts')
-rw-r--r--school/node_modules/graphql/execution/execute.d.ts195
1 files changed, 195 insertions, 0 deletions
diff --git a/school/node_modules/graphql/execution/execute.d.ts b/school/node_modules/graphql/execution/execute.d.ts
new file mode 100644
index 0000000..a20db8c
--- /dev/null
+++ b/school/node_modules/graphql/execution/execute.d.ts
@@ -0,0 +1,195 @@
+import { Maybe } from '../jsutils/Maybe';
+
+import { PromiseOrValue } from '../jsutils/PromiseOrValue';
+import { Path } from '../jsutils/Path';
+
+import { GraphQLError } from '../error/GraphQLError';
+import { GraphQLFormattedError } from '../error/formatError';
+
+import {
+ DocumentNode,
+ OperationDefinitionNode,
+ SelectionSetNode,
+ FieldNode,
+ FragmentDefinitionNode,
+} from '../language/ast';
+import { GraphQLSchema } from '../type/schema';
+import {
+ GraphQLField,
+ GraphQLFieldResolver,
+ GraphQLResolveInfo,
+ GraphQLTypeResolver,
+ GraphQLObjectType,
+} from '../type/definition';
+
+/**
+ * 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 {
+ schema: GraphQLSchema;
+ fragments: { [key: string]: FragmentDefinitionNode };
+ rootValue: any;
+ contextValue: any;
+ operation: OperationDefinitionNode;
+ variableValues: { [key: string]: any };
+ fieldResolver: GraphQLFieldResolver<any, any>;
+ errors: Array<GraphQLError>;
+}
+
+/**
+ * The result of GraphQL execution.
+ *
+ * - `errors` is included when any errors occurred as a non-empty array.
+ * - `data` is the result of a successful execution of the query.
+ * - `extensions` is reserved for adding non-standard properties.
+ */
+export interface ExecutionResult<
+ TData = { [key: string]: any },
+ TExtensions = { [key: string]: any }
+> {
+ errors?: ReadonlyArray<GraphQLError>;
+ // TS_SPECIFIC: TData. Motivation: https://github.com/graphql/graphql-js/pull/2490#issuecomment-639154229
+ data?: TData | null;
+ extensions?: TExtensions;
+}
+
+export interface FormattedExecutionResult<
+ TData = { [key: string]: any },
+ TExtensions = { [key: string]: any }
+> {
+ errors?: ReadonlyArray<GraphQLFormattedError>;
+ // TS_SPECIFIC: TData. Motivation: https://github.com/graphql/graphql-js/pull/2490#issuecomment-639154229
+ data?: TData | null;
+ extensions?: TExtensions;
+}
+
+export interface ExecutionArgs {
+ schema: GraphQLSchema;
+ document: DocumentNode;
+ rootValue?: any;
+ contextValue?: any;
+ variableValues?: Maybe<{ [key: string]: any }>;
+ operationName?: Maybe<string>;
+ fieldResolver?: Maybe<GraphQLFieldResolver<any, any>>;
+ typeResolver?: Maybe<GraphQLTypeResolver<any, any>>;
+}
+
+/**
+ * Implements the "Evaluating 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.
+ *
+ * Accepts either an object with named arguments, or individual arguments.
+ */
+export function execute(args: ExecutionArgs): PromiseOrValue<ExecutionResult>;
+export function execute(
+ schema: GraphQLSchema,
+ document: DocumentNode,
+ rootValue?: any,
+ contextValue?: any,
+ variableValues?: Maybe<{ [key: string]: any }>,
+ operationName?: Maybe<string>,
+ fieldResolver?: Maybe<GraphQLFieldResolver<any, any>>,
+ typeResolver?: Maybe<GraphQLTypeResolver<any, any>>,
+): PromiseOrValue<ExecutionResult>;
+
+/**
+ * Also implements the "Evaluating requests" section of the GraphQL specification.
+ * However, it guarantees to complete synchronously (or throw an error) assuming
+ * that all field resolvers are also synchronous.
+ */
+export function executeSync(args: ExecutionArgs): ExecutionResult;
+
+/**
+ * Essential assertions before executing to provide developer feedback for
+ * improper use of the GraphQL library.
+ */
+export function assertValidExecutionArguments(
+ schema: GraphQLSchema,
+ document: DocumentNode,
+ rawVariableValues: Maybe<{ [key: string]: any }>,
+): void;
+
+/**
+ * Constructs a ExecutionContext object from the arguments passed to
+ * execute, which we will pass throughout the other execution methods.
+ *
+ * Throws a GraphQLError if a valid execution context cannot be created.
+ */
+export function buildExecutionContext(
+ schema: GraphQLSchema,
+ document: DocumentNode,
+ rootValue: any,
+ contextValue: any,
+ rawVariableValues: Maybe<{ [key: string]: any }>,
+ operationName: Maybe<string>,
+ fieldResolver: Maybe<GraphQLFieldResolver<any, any>>,
+ typeResolver?: Maybe<GraphQLTypeResolver<any, any>>,
+): ReadonlyArray<GraphQLError> | ExecutionContext;
+
+/**
+ * Given a selectionSet, adds all of the fields in that selection to
+ * the passed in map of fields, and returns it at the end.
+ *
+ * CollectFields requires the "runtime type" of an object. For a field which
+ * returns an Interface or Union type, the "runtime type" will be the actual
+ * Object type returned by that field.
+ */
+export function collectFields(
+ exeContext: ExecutionContext,
+ runtimeType: GraphQLObjectType,
+ selectionSet: SelectionSetNode,
+ fields: { [key: string]: Array<FieldNode> },
+ visitedFragmentNames: { [key: string]: boolean },
+): { [key: string]: Array<FieldNode> };
+
+export function buildResolveInfo(
+ exeContext: ExecutionContext,
+ fieldDef: GraphQLField<any, any>,
+ fieldNodes: ReadonlyArray<FieldNode>,
+ parentType: GraphQLObjectType,
+ path: Path,
+): GraphQLResolveInfo;
+
+/**
+ * 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 const defaultTypeResolver: GraphQLTypeResolver<any, any>;
+
+/**
+ * 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.
+ */
+export const defaultFieldResolver: GraphQLFieldResolver<any, any>;
+
+/**
+ * This method looks up the field on the given type definition.
+ * It has special casing for the two introspection fields, __schema
+ * and __typename. __typename is special because it can always be
+ * queried as a field, even in situations where no other fields
+ * are allowed, like on a Union. __schema could get automatically
+ * added to the query type, but that would require mutating type
+ * definitions, which would cause issues.
+ */
+export function getFieldDef(
+ schema: GraphQLSchema,
+ parentType: GraphQLObjectType,
+ fieldName: string,
+): Maybe<GraphQLField<any, any>>;