1 | import { Maybe } from '../jsutils/Maybe';
|
2 |
|
3 | import { PromiseOrValue } from '../jsutils/PromiseOrValue';
|
4 | import { Path } from '../jsutils/Path';
|
5 |
|
6 | import { GraphQLError } from '../error/GraphQLError';
|
7 | import { GraphQLFormattedError } from '../error/formatError';
|
8 |
|
9 | import {
|
10 | DocumentNode,
|
11 | OperationDefinitionNode,
|
12 | SelectionSetNode,
|
13 | FieldNode,
|
14 | FragmentDefinitionNode,
|
15 | } from '../language/ast';
|
16 | import { GraphQLSchema } from '../type/schema';
|
17 | import {
|
18 | GraphQLField,
|
19 | GraphQLFieldResolver,
|
20 | GraphQLResolveInfo,
|
21 | GraphQLTypeResolver,
|
22 | GraphQLObjectType,
|
23 | } from '../type/definition';
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 | export interface ExecutionContext {
|
32 | schema: GraphQLSchema;
|
33 | fragments: { [key: string]: FragmentDefinitionNode };
|
34 | rootValue: any;
|
35 | contextValue: any;
|
36 | operation: OperationDefinitionNode;
|
37 | variableValues: { [key: string]: any };
|
38 | fieldResolver: GraphQLFieldResolver<any, any>;
|
39 | errors: Array<GraphQLError>;
|
40 | }
|
41 |
|
42 |
|
43 |
|
44 |
|
45 |
|
46 |
|
47 |
|
48 |
|
49 | export interface ExecutionResult<
|
50 | TData = { [key: string]: any },
|
51 | TExtensions = { [key: string]: any }
|
52 | > {
|
53 | errors?: ReadonlyArray<GraphQLError>;
|
54 |
|
55 | data?: TData | null;
|
56 | extensions?: TExtensions;
|
57 | }
|
58 |
|
59 | export interface FormattedExecutionResult<
|
60 | TData = { [key: string]: any },
|
61 | TExtensions = { [key: string]: any }
|
62 | > {
|
63 | errors?: ReadonlyArray<GraphQLFormattedError>;
|
64 |
|
65 | data?: TData | null;
|
66 | extensions?: TExtensions;
|
67 | }
|
68 |
|
69 | export interface ExecutionArgs {
|
70 | schema: GraphQLSchema;
|
71 | document: DocumentNode;
|
72 | rootValue?: any;
|
73 | contextValue?: any;
|
74 | variableValues?: Maybe<{ [key: string]: any }>;
|
75 | operationName?: Maybe<string>;
|
76 | fieldResolver?: Maybe<GraphQLFieldResolver<any, any>>;
|
77 | typeResolver?: Maybe<GraphQLTypeResolver<any, any>>;
|
78 | }
|
79 |
|
80 |
|
81 |
|
82 |
|
83 |
|
84 |
|
85 |
|
86 |
|
87 |
|
88 |
|
89 |
|
90 |
|
91 |
|
92 | export function execute(args: ExecutionArgs): PromiseOrValue<ExecutionResult>;
|
93 | export function execute(
|
94 | schema: GraphQLSchema,
|
95 | document: DocumentNode,
|
96 | rootValue?: any,
|
97 | contextValue?: any,
|
98 | variableValues?: Maybe<{ [key: string]: any }>,
|
99 | operationName?: Maybe<string>,
|
100 | fieldResolver?: Maybe<GraphQLFieldResolver<any, any>>,
|
101 | typeResolver?: Maybe<GraphQLTypeResolver<any, any>>,
|
102 | ): PromiseOrValue<ExecutionResult>;
|
103 |
|
104 |
|
105 |
|
106 |
|
107 |
|
108 |
|
109 | export function executeSync(args: ExecutionArgs): ExecutionResult;
|
110 |
|
111 |
|
112 |
|
113 |
|
114 |
|
115 | export function assertValidExecutionArguments(
|
116 | schema: GraphQLSchema,
|
117 | document: DocumentNode,
|
118 | rawVariableValues: Maybe<{ [key: string]: any }>,
|
119 | ): void;
|
120 |
|
121 |
|
122 |
|
123 |
|
124 |
|
125 |
|
126 |
|
127 | export function buildExecutionContext(
|
128 | schema: GraphQLSchema,
|
129 | document: DocumentNode,
|
130 | rootValue: any,
|
131 | contextValue: any,
|
132 | rawVariableValues: Maybe<{ [key: string]: any }>,
|
133 | operationName: Maybe<string>,
|
134 | fieldResolver: Maybe<GraphQLFieldResolver<any, any>>,
|
135 | typeResolver?: Maybe<GraphQLTypeResolver<any, any>>,
|
136 | ): ReadonlyArray<GraphQLError> | ExecutionContext;
|
137 |
|
138 |
|
139 |
|
140 |
|
141 |
|
142 |
|
143 |
|
144 |
|
145 |
|
146 | export function collectFields(
|
147 | exeContext: ExecutionContext,
|
148 | runtimeType: GraphQLObjectType,
|
149 | selectionSet: SelectionSetNode,
|
150 | fields: { [key: string]: Array<FieldNode> },
|
151 | visitedFragmentNames: { [key: string]: boolean },
|
152 | ): { [key: string]: Array<FieldNode> };
|
153 |
|
154 | export function buildResolveInfo(
|
155 | exeContext: ExecutionContext,
|
156 | fieldDef: GraphQLField<any, any>,
|
157 | fieldNodes: ReadonlyArray<FieldNode>,
|
158 | parentType: GraphQLObjectType,
|
159 | path: Path,
|
160 | ): GraphQLResolveInfo;
|
161 |
|
162 |
|
163 |
|
164 |
|
165 |
|
166 |
|
167 |
|
168 |
|
169 |
|
170 |
|
171 |
|
172 | export const defaultTypeResolver: GraphQLTypeResolver<any, any>;
|
173 |
|
174 |
|
175 |
|
176 |
|
177 |
|
178 |
|
179 |
|
180 | export const defaultFieldResolver: GraphQLFieldResolver<any, any>;
|
181 |
|
182 |
|
183 |
|
184 |
|
185 |
|
186 |
|
187 |
|
188 |
|
189 |
|
190 |
|
191 | export function getFieldDef(
|
192 | schema: GraphQLSchema,
|
193 | parentType: GraphQLObjectType,
|
194 | fieldName: string,
|
195 | ): Maybe<GraphQLField<any, any>>;
|