@@ -145,67 +145,8 @@ export type ExecutionArgs = {|
145
145
*
146
146
* If the arguments to this function do not result in a legal execution context,
147
147
* a GraphQLError will be thrown immediately explaining the invalid input.
148
- *
149
- * Accepts either an object with named arguments, or individual arguments.
150
- */
151
- declare function execute (
152
- ExecutionArgs ,
153
- ..._ : [ ]
154
- ) : PromiseOrValue < ExecutionResult > ;
155
- /* eslint-disable no-redeclare */
156
- declare function execute(
157
- schema: GraphQLSchema,
158
- document: DocumentNode,
159
- rootValue?: mixed,
160
- contextValue?: mixed,
161
- variableValues?: ?{ + [ variable : string ] : mixed , ... } ,
162
- operationName?: ?string,
163
- fieldResolver?: ?GraphQLFieldResolver< any , any > ,
164
- typeResolver?: ?GraphQLTypeResolver< any , any > ,
165
- ): PromiseOrValue< ExecutionResult > ;
166
- export function execute(
167
- argsOrSchema,
168
- document,
169
- rootValue,
170
- contextValue,
171
- variableValues,
172
- operationName,
173
- fieldResolver,
174
- typeResolver,
175
- ) {
176
- /* eslint-enable no-redeclare */
177
- // Extract arguments from object args if provided.
178
- return arguments . length === 1
179
- ? executeImpl ( argsOrSchema )
180
- : executeImpl ( {
181
- schema : argsOrSchema ,
182
- document,
183
- rootValue,
184
- contextValue,
185
- variableValues,
186
- operationName,
187
- fieldResolver,
188
- typeResolver,
189
- } ) ;
190
- }
191
-
192
- /**
193
- * Also implements the "Evaluating requests" section of the GraphQL specification.
194
- * However, it guarantees to complete synchronously (or throw an error) assuming
195
- * that all field resolvers are also synchronous.
196
148
*/
197
- export function executeSync(args: ExecutionArgs): ExecutionResult {
198
- const result = executeImpl ( args ) ;
199
-
200
- // Assert that the execution was synchronous.
201
- if ( isPromise ( result ) ) {
202
- throw new Error ( 'GraphQL execution failed to complete synchronously.' ) ;
203
- }
204
-
205
- return result ;
206
- }
207
-
208
- function executeImpl(args: ExecutionArgs): PromiseOrValue< ExecutionResult > {
149
+ export function execute ( args : ExecutionArgs ) : PromiseOrValue < ExecutionResult > {
209
150
const {
210
151
schema,
211
152
document,
@@ -249,6 +190,22 @@ function executeImpl(args: ExecutionArgs): PromiseOrValue<ExecutionResult> {
249
190
return buildResponse(exeContext, data);
250
191
}
251
192
193
+ /**
194
+ * Also implements the "Evaluating requests" section of the GraphQL specification.
195
+ * However, it guarantees to complete synchronously (or throw an error) assuming
196
+ * that all field resolvers are also synchronous.
197
+ */
198
+ export function executeSync ( args : ExecutionArgs ) : ExecutionResult {
199
+ const result = execute ( args ) ;
200
+
201
+ // Assert that the execution was synchronous.
202
+ if ( isPromise ( result ) ) {
203
+ throw new Error ( 'GraphQL execution failed to complete synchronously.' ) ;
204
+ }
205
+
206
+ return result ;
207
+ }
208
+
252
209
/**
253
210
* Given a completed execution context and data, build the { errors , data }
254
211
* response defined by the "Response" section of the GraphQL specification.
0 commit comments