@@ -22,6 +22,26 @@ import {
22
22
GraphQLObjectType ,
23
23
} from '../type/definition' ;
24
24
25
+ /**
26
+ * Terminology
27
+ *
28
+ * "Definitions" are the generic name for top-level statements in the document.
29
+ * Examples of this include:
30
+ * 1) Operations (such as a query)
31
+ * 2) Fragments
32
+ *
33
+ * "Operations" are a generic name for requests in the document.
34
+ * Examples of this include:
35
+ * 1) query,
36
+ * 2) mutation
37
+ *
38
+ * "Selections" are the definitions that can appear legally and at
39
+ * single level of the query. These include:
40
+ * 1) field references e.g "a"
41
+ * 2) fragment "spreads" e.g. "...c"
42
+ * 3) inline fragment "spreads" e.g. "...on Type { a }"
43
+ */
44
+
25
45
/**
26
46
* Data that must be available at all points during query execution.
27
47
*
@@ -36,6 +56,7 @@ export interface ExecutionContext {
36
56
operation : OperationDefinitionNode ;
37
57
variableValues : { [ key : string ] : any } ;
38
58
fieldResolver : GraphQLFieldResolver < any , any > ;
59
+ typeResolver : GraphQLTypeResolver < any , any > ;
39
60
errors : Array < GraphQLError > ;
40
61
}
41
62
@@ -86,20 +107,8 @@ export interface ExecutionArgs {
86
107
*
87
108
* If the arguments to this function do not result in a legal execution context,
88
109
* a GraphQLError will be thrown immediately explaining the invalid input.
89
- *
90
- * Accepts either an object with named arguments, or individual arguments.
91
110
*/
92
111
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
112
104
113
/**
105
114
* Also implements the "Evaluating requests" section of the GraphQL specification.
@@ -111,6 +120,8 @@ export function executeSync(args: ExecutionArgs): ExecutionResult;
111
120
/**
112
121
* Essential assertions before executing to provide developer feedback for
113
122
* improper use of the GraphQL library.
123
+ *
124
+ * @internal
114
125
*/
115
126
export function assertValidExecutionArguments (
116
127
schema : GraphQLSchema ,
@@ -123,6 +134,8 @@ export function assertValidExecutionArguments(
123
134
* execute, which we will pass throughout the other execution methods.
124
135
*
125
136
* Throws a GraphQLError if a valid execution context cannot be created.
137
+ *
138
+ * @internal
126
139
*/
127
140
export function buildExecutionContext (
128
141
schema : GraphQLSchema ,
@@ -142,6 +155,8 @@ export function buildExecutionContext(
142
155
* CollectFields requires the "runtime type" of an object. For a field which
143
156
* returns an Interface or Union type, the "runtime type" will be the actual
144
157
* Object type returned by that field.
158
+ *
159
+ * @internal
145
160
*/
146
161
export function collectFields (
147
162
exeContext : ExecutionContext ,
@@ -151,6 +166,9 @@ export function collectFields(
151
166
visitedFragmentNames : { [ key : string ] : boolean } ,
152
167
) : { [ key : string ] : Array < FieldNode > } ;
153
168
169
+ /**
170
+ * @internal
171
+ */
154
172
export function buildResolveInfo (
155
173
exeContext : ExecutionContext ,
156
174
fieldDef : GraphQLField < any , any > ,
@@ -175,18 +193,20 @@ export const defaultTypeResolver: GraphQLTypeResolver<any, any>;
175
193
* If a resolve function is not given, then a default resolve behavior is used
176
194
* which takes the property of the source object of the same name as the field
177
195
* and returns it as the result, or if it's a function, returns the result
178
- * of calling that function while passing along args and context.
196
+ * of calling that function while passing along args and context value .
179
197
*/
180
198
export const defaultFieldResolver : GraphQLFieldResolver < any , any > ;
181
199
182
200
/**
183
201
* This method looks up the field on the given type definition.
184
- * It has special casing for the two introspection fields, __schema
185
- * and __typename. __typename is special because it can always be
186
- * queried as a field, even in situations where no other fields
187
- * are allowed, like on a Union. __schema could get automatically
188
- * added to the query type, but that would require mutating type
189
- * definitions, which would cause issues.
202
+ * It has special casing for the three introspection fields,
203
+ * __schema, __type and __typename. __typename is special because
204
+ * it can always be queried as a field, even in situations where no
205
+ * other fields are allowed, like on a Union. __schema and __type
206
+ * could get automatically added to the query type, but that would
207
+ * require mutating type definitions, which would cause issues.
208
+ *
209
+ * @internal
190
210
*/
191
211
export function getFieldDef (
192
212
schema : GraphQLSchema ,
0 commit comments