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