1
1
import type { Maybe } from '../jsutils/Maybe' ;
2
2
import type { ObjMap } from '../jsutils/ObjMap' ;
3
-
4
3
import type { PromiseOrValue } from '../jsutils/PromiseOrValue' ;
5
4
import type { Path } from '../jsutils/Path' ;
6
-
7
5
import type { GraphQLError } from '../error/GraphQLError' ;
8
6
import type { GraphQLFormattedError } from '../error/formatError' ;
9
-
10
7
import type {
11
8
DocumentNode ,
12
9
OperationDefinitionNode ,
@@ -22,7 +19,6 @@ import type {
22
19
GraphQLTypeResolver ,
23
20
GraphQLObjectType ,
24
21
} from '../type/definition' ;
25
-
26
22
/**
27
23
* Terminology
28
24
*
@@ -42,7 +38,6 @@ import type {
42
38
* 2) fragment "spreads" e.g. "...c"
43
39
* 3) inline fragment "spreads" e.g. "...on Type { a }"
44
40
*/
45
-
46
41
/**
47
42
* Data that must be available at all points during query execution.
48
43
*
@@ -60,7 +55,6 @@ export interface ExecutionContext {
60
55
typeResolver : GraphQLTypeResolver < any , any > ;
61
56
errors : Array < GraphQLError > ;
62
57
}
63
-
64
58
/**
65
59
* The result of GraphQL execution.
66
60
*
@@ -77,7 +71,6 @@ export interface ExecutionResult<
77
71
data ?: TData | null ;
78
72
extensions ?: TExtensions ;
79
73
}
80
-
81
74
export interface FormattedExecutionResult <
82
75
TData = { [ key : string ] : any } ,
83
76
TExtensions = { [ key : string ] : any } ,
@@ -87,7 +80,6 @@ export interface FormattedExecutionResult<
87
80
data ?: TData | null ;
88
81
extensions ?: TExtensions ;
89
82
}
90
-
91
83
export interface ExecutionArgs {
92
84
schema : GraphQLSchema ;
93
85
document : DocumentNode ;
@@ -98,7 +90,6 @@ export interface ExecutionArgs {
98
90
fieldResolver ?: Maybe < GraphQLFieldResolver < any , any > > ;
99
91
typeResolver ?: Maybe < GraphQLTypeResolver < any , any > > ;
100
92
}
101
-
102
93
/**
103
94
* Implements the "Evaluating requests" section of the GraphQL specification.
104
95
*
@@ -110,14 +101,12 @@ export interface ExecutionArgs {
110
101
* a GraphQLError will be thrown immediately explaining the invalid input.
111
102
*/
112
103
export function execute ( args : ExecutionArgs ) : PromiseOrValue < ExecutionResult > ;
113
-
114
104
/**
115
105
* Also implements the "Evaluating requests" section of the GraphQL specification.
116
106
* However, it guarantees to complete synchronously (or throw an error) assuming
117
107
* that all field resolvers are also synchronous.
118
108
*/
119
109
export function executeSync ( args : ExecutionArgs ) : ExecutionResult ;
120
-
121
110
/**
122
111
* Essential assertions before executing to provide developer feedback for
123
112
* improper use of the GraphQL library.
@@ -129,7 +118,6 @@ export function assertValidExecutionArguments(
129
118
document : DocumentNode ,
130
119
rawVariableValues : Maybe < { [ key : string ] : unknown } > ,
131
120
) : void ;
132
-
133
121
/**
134
122
* Constructs a ExecutionContext object from the arguments passed to
135
123
* execute, which we will pass throughout the other execution methods.
@@ -148,7 +136,6 @@ export function buildExecutionContext(
148
136
fieldResolver : Maybe < GraphQLFieldResolver < unknown , unknown > > ,
149
137
typeResolver ?: Maybe < GraphQLTypeResolver < unknown , unknown > > ,
150
138
) : ReadonlyArray < GraphQLError > | ExecutionContext ;
151
-
152
139
/**
153
140
* Given a selectionSet, adds all of the fields in that selection to
154
141
* the passed in map of fields, and returns it at the end.
@@ -166,7 +153,6 @@ export function collectFields(
166
153
fields : ObjMap < Array < FieldNode > > ,
167
154
visitedFragmentNames : ObjMap < boolean > ,
168
155
) : ObjMap < Array < FieldNode > > ;
169
-
170
156
/**
171
157
* @internal
172
158
*/
@@ -177,7 +163,6 @@ export function buildResolveInfo(
177
163
parentType : GraphQLObjectType ,
178
164
path : Path ,
179
165
) : GraphQLResolveInfo ;
180
-
181
166
/**
182
167
* If a resolveType function is not given, then a default resolve behavior is
183
168
* used which attempts two strategies:
@@ -189,15 +174,13 @@ export function buildResolveInfo(
189
174
* isTypeOf for the object being coerced, returning the first type that matches.
190
175
*/
191
176
export const defaultTypeResolver : GraphQLTypeResolver < unknown , unknown > ;
192
-
193
177
/**
194
178
* If a resolve function is not given, then a default resolve behavior is used
195
179
* which takes the property of the source object of the same name as the field
196
180
* and returns it as the result, or if it's a function, returns the result
197
181
* of calling that function while passing along args and context value.
198
182
*/
199
183
export const defaultFieldResolver : GraphQLFieldResolver < unknown , unknown > ;
200
-
201
184
/**
202
185
* This method looks up the field on the given type definition.
203
186
* It has special casing for the three introspection fields,
0 commit comments