@@ -279,137 +279,133 @@ public func graphqlSubscribe(
279
279
280
280
// MARK: Async/Await
281
281
282
- #if compiler(>=5.5) && canImport(_Concurrency)
283
-
284
- @available ( macOS 10 . 15 , iOS 15 , watchOS 8 , tvOS 15 , * )
285
- /// This is the primary entry point function for fulfilling GraphQL operations
286
- /// by parsing, validating, and executing a GraphQL document along side a
287
- /// GraphQL schema.
288
- ///
289
- /// More sophisticated GraphQL servers, such as those which persist queries,
290
- /// may wish to separate the validation and execution phases to a static time
291
- /// tooling step, and a server runtime step.
292
- ///
293
- /// - parameter queryStrategy: The field execution strategy to use for query requests
294
- /// - parameter mutationStrategy: The field execution strategy to use for mutation requests
295
- /// - parameter subscriptionStrategy: The field execution strategy to use for subscription
296
- /// requests
297
- /// - parameter instrumentation: The instrumentation implementation to call during the
298
- /// parsing, validating, execution, and field resolution stages.
299
- /// - parameter schema: The GraphQL type system to use when validating and
300
- /// executing a query.
301
- /// - parameter request: A GraphQL language formatted string representing the
302
- /// requested operation.
303
- /// - parameter rootValue: The value provided as the first argument to resolver
304
- /// functions on the top level type (e.g. the query object type).
305
- /// - parameter contextValue: A context value provided to all resolver functions
306
- /// functions
307
- /// - parameter variableValues: A mapping of variable name to runtime value to use for all
308
- /// variables defined in the `request`.
309
- /// - parameter operationName: The name of the operation to use if `request` contains
310
- /// multiple possible operations. Can be omitted if `request` contains only one operation.
311
- ///
312
- /// - throws: throws GraphQLError if an error occurs while parsing the `request`.
313
- ///
314
- /// - returns: returns a `Map` dictionary containing the result of the query inside the key
315
- /// `data` and any validation or execution errors inside the key `errors`. The value of `data`
316
- /// might be `null` if, for example, the query is invalid. It's possible to have both `data` and
317
- /// `errors` if an error occurs only in a specific field. If that happens the value of that
318
- /// field will be `null` and there will be an error inside `errors` specifying the reason for
319
- /// the failure and the path of the failed field.
320
- public func graphql(
321
- queryStrategy: QueryFieldExecutionStrategy = SerialFieldExecutionStrategy ( ) ,
322
- mutationStrategy: MutationFieldExecutionStrategy = SerialFieldExecutionStrategy ( ) ,
323
- subscriptionStrategy: SubscriptionFieldExecutionStrategy = SerialFieldExecutionStrategy ( ) ,
324
- instrumentation: Instrumentation = NoOpInstrumentation,
325
- schema: GraphQLSchema ,
326
- request: String ,
327
- rootValue: Any = ( ) ,
328
- context: Any = ( ) ,
329
- eventLoopGroup: EventLoopGroup ,
330
- variableValues: [ String : Map ] = [ : ] ,
331
- operationName: String ? = nil
332
- ) async throws -> GraphQLResult {
333
- return try await graphql (
334
- queryStrategy: queryStrategy,
335
- mutationStrategy: mutationStrategy,
336
- subscriptionStrategy: subscriptionStrategy,
337
- instrumentation: instrumentation,
338
- schema: schema,
339
- request: request,
340
- rootValue: rootValue,
341
- context: context,
342
- eventLoopGroup: eventLoopGroup,
343
- variableValues: variableValues,
344
- operationName: operationName
345
- ) . get ( )
346
- }
347
-
348
- @available ( macOS 10 . 15 , iOS 15 , watchOS 8 , tvOS 15 , * )
349
- /// This is the primary entry point function for fulfilling GraphQL subscription
350
- /// operations by parsing, validating, and executing a GraphQL subscription
351
- /// document along side a GraphQL schema.
352
- ///
353
- /// More sophisticated GraphQL servers, such as those which persist queries,
354
- /// may wish to separate the validation and execution phases to a static time
355
- /// tooling step, and a server runtime step.
356
- ///
357
- /// - parameter queryStrategy: The field execution strategy to use for query requests
358
- /// - parameter mutationStrategy: The field execution strategy to use for mutation requests
359
- /// - parameter subscriptionStrategy: The field execution strategy to use for subscription
360
- /// requests
361
- /// - parameter instrumentation: The instrumentation implementation to call during the
362
- /// parsing, validating, execution, and field resolution stages.
363
- /// - parameter schema: The GraphQL type system to use when validating and
364
- /// executing a query.
365
- /// - parameter request: A GraphQL language formatted string representing the
366
- /// requested operation.
367
- /// - parameter rootValue: The value provided as the first argument to resolver
368
- /// functions on the top level type (e.g. the query object type).
369
- /// - parameter contextValue: A context value provided to all resolver functions
370
- /// - parameter variableValues: A mapping of variable name to runtime value to use for all
371
- /// variables defined in the `request`.
372
- /// - parameter operationName: The name of the operation to use if `request` contains
373
- /// multiple possible operations. Can be omitted if `request` contains only one operation.
374
- ///
375
- /// - throws: throws GraphQLError if an error occurs while parsing the `request`.
376
- ///
377
- /// - returns: returns a SubscriptionResult containing the subscription observable inside the
378
- /// key `observable` and any validation or execution errors inside the key `errors`. The
379
- /// value of `observable` might be `null` if, for example, the query is invalid. It's not
380
- /// possible to have both `observable` and `errors`. The observable payloads are
381
- /// GraphQLResults which contain the result of the query inside the key `data` and any
382
- /// validation or execution errors inside the key `errors`. The value of `data` might be `null`.
383
- /// It's possible to have both `data` and `errors` if an error occurs only in a specific field.
384
- /// If that happens the value of that field will be `null` and there
385
- /// will be an error inside `errors` specifying the reason for the failure and the path of the
386
- /// failed field.
387
- public func graphqlSubscribe(
388
- queryStrategy: QueryFieldExecutionStrategy = SerialFieldExecutionStrategy ( ) ,
389
- mutationStrategy: MutationFieldExecutionStrategy = SerialFieldExecutionStrategy ( ) ,
390
- subscriptionStrategy: SubscriptionFieldExecutionStrategy = SerialFieldExecutionStrategy ( ) ,
391
- instrumentation: Instrumentation = NoOpInstrumentation,
392
- schema: GraphQLSchema ,
393
- request: String ,
394
- rootValue: Any = ( ) ,
395
- context: Any = ( ) ,
396
- eventLoopGroup: EventLoopGroup ,
397
- variableValues: [ String : Map ] = [ : ] ,
398
- operationName: String ? = nil
399
- ) async throws -> SubscriptionResult {
400
- return try await graphqlSubscribe (
401
- queryStrategy: queryStrategy,
402
- mutationStrategy: mutationStrategy,
403
- subscriptionStrategy: subscriptionStrategy,
404
- instrumentation: instrumentation,
405
- schema: schema,
406
- request: request,
407
- rootValue: rootValue,
408
- context: context,
409
- eventLoopGroup: eventLoopGroup,
410
- variableValues: variableValues,
411
- operationName: operationName
412
- ) . get ( )
413
- }
282
+ @available ( macOS 10 . 15 , iOS 15 , watchOS 8 , tvOS 15 , * )
283
+ /// This is the primary entry point function for fulfilling GraphQL operations
284
+ /// by parsing, validating, and executing a GraphQL document along side a
285
+ /// GraphQL schema.
286
+ ///
287
+ /// More sophisticated GraphQL servers, such as those which persist queries,
288
+ /// may wish to separate the validation and execution phases to a static time
289
+ /// tooling step, and a server runtime step.
290
+ ///
291
+ /// - parameter queryStrategy: The field execution strategy to use for query requests
292
+ /// - parameter mutationStrategy: The field execution strategy to use for mutation requests
293
+ /// - parameter subscriptionStrategy: The field execution strategy to use for subscription
294
+ /// requests
295
+ /// - parameter instrumentation: The instrumentation implementation to call during the
296
+ /// parsing, validating, execution, and field resolution stages.
297
+ /// - parameter schema: The GraphQL type system to use when validating and
298
+ /// executing a query.
299
+ /// - parameter request: A GraphQL language formatted string representing the
300
+ /// requested operation.
301
+ /// - parameter rootValue: The value provided as the first argument to resolver
302
+ /// functions on the top level type (e.g. the query object type).
303
+ /// - parameter contextValue: A context value provided to all resolver functions
304
+ /// functions
305
+ /// - parameter variableValues: A mapping of variable name to runtime value to use for all
306
+ /// variables defined in the `request`.
307
+ /// - parameter operationName: The name of the operation to use if `request` contains
308
+ /// multiple possible operations. Can be omitted if `request` contains only one operation.
309
+ ///
310
+ /// - throws: throws GraphQLError if an error occurs while parsing the `request`.
311
+ ///
312
+ /// - returns: returns a `Map` dictionary containing the result of the query inside the key
313
+ /// `data` and any validation or execution errors inside the key `errors`. The value of `data`
314
+ /// might be `null` if, for example, the query is invalid. It's possible to have both `data` and
315
+ /// `errors` if an error occurs only in a specific field. If that happens the value of that
316
+ /// field will be `null` and there will be an error inside `errors` specifying the reason for
317
+ /// the failure and the path of the failed field.
318
+ public func graphql(
319
+ queryStrategy: QueryFieldExecutionStrategy = SerialFieldExecutionStrategy ( ) ,
320
+ mutationStrategy: MutationFieldExecutionStrategy = SerialFieldExecutionStrategy ( ) ,
321
+ subscriptionStrategy: SubscriptionFieldExecutionStrategy = SerialFieldExecutionStrategy ( ) ,
322
+ instrumentation: Instrumentation = NoOpInstrumentation,
323
+ schema: GraphQLSchema ,
324
+ request: String ,
325
+ rootValue: Any = ( ) ,
326
+ context: Any = ( ) ,
327
+ eventLoopGroup: EventLoopGroup ,
328
+ variableValues: [ String : Map ] = [ : ] ,
329
+ operationName: String ? = nil
330
+ ) async throws -> GraphQLResult {
331
+ return try await graphql (
332
+ queryStrategy: queryStrategy,
333
+ mutationStrategy: mutationStrategy,
334
+ subscriptionStrategy: subscriptionStrategy,
335
+ instrumentation: instrumentation,
336
+ schema: schema,
337
+ request: request,
338
+ rootValue: rootValue,
339
+ context: context,
340
+ eventLoopGroup: eventLoopGroup,
341
+ variableValues: variableValues,
342
+ operationName: operationName
343
+ ) . get ( )
344
+ }
414
345
415
- #endif
346
+ @available ( macOS 10 . 15 , iOS 15 , watchOS 8 , tvOS 15 , * )
347
+ /// This is the primary entry point function for fulfilling GraphQL subscription
348
+ /// operations by parsing, validating, and executing a GraphQL subscription
349
+ /// document along side a GraphQL schema.
350
+ ///
351
+ /// More sophisticated GraphQL servers, such as those which persist queries,
352
+ /// may wish to separate the validation and execution phases to a static time
353
+ /// tooling step, and a server runtime step.
354
+ ///
355
+ /// - parameter queryStrategy: The field execution strategy to use for query requests
356
+ /// - parameter mutationStrategy: The field execution strategy to use for mutation requests
357
+ /// - parameter subscriptionStrategy: The field execution strategy to use for subscription
358
+ /// requests
359
+ /// - parameter instrumentation: The instrumentation implementation to call during the
360
+ /// parsing, validating, execution, and field resolution stages.
361
+ /// - parameter schema: The GraphQL type system to use when validating and
362
+ /// executing a query.
363
+ /// - parameter request: A GraphQL language formatted string representing the
364
+ /// requested operation.
365
+ /// - parameter rootValue: The value provided as the first argument to resolver
366
+ /// functions on the top level type (e.g. the query object type).
367
+ /// - parameter contextValue: A context value provided to all resolver functions
368
+ /// - parameter variableValues: A mapping of variable name to runtime value to use for all
369
+ /// variables defined in the `request`.
370
+ /// - parameter operationName: The name of the operation to use if `request` contains
371
+ /// multiple possible operations. Can be omitted if `request` contains only one operation.
372
+ ///
373
+ /// - throws: throws GraphQLError if an error occurs while parsing the `request`.
374
+ ///
375
+ /// - returns: returns a SubscriptionResult containing the subscription observable inside the
376
+ /// key `observable` and any validation or execution errors inside the key `errors`. The
377
+ /// value of `observable` might be `null` if, for example, the query is invalid. It's not
378
+ /// possible to have both `observable` and `errors`. The observable payloads are
379
+ /// GraphQLResults which contain the result of the query inside the key `data` and any
380
+ /// validation or execution errors inside the key `errors`. The value of `data` might be `null`.
381
+ /// It's possible to have both `data` and `errors` if an error occurs only in a specific field.
382
+ /// If that happens the value of that field will be `null` and there
383
+ /// will be an error inside `errors` specifying the reason for the failure and the path of the
384
+ /// failed field.
385
+ public func graphqlSubscribe(
386
+ queryStrategy: QueryFieldExecutionStrategy = SerialFieldExecutionStrategy ( ) ,
387
+ mutationStrategy: MutationFieldExecutionStrategy = SerialFieldExecutionStrategy ( ) ,
388
+ subscriptionStrategy: SubscriptionFieldExecutionStrategy = SerialFieldExecutionStrategy ( ) ,
389
+ instrumentation: Instrumentation = NoOpInstrumentation,
390
+ schema: GraphQLSchema ,
391
+ request: String ,
392
+ rootValue: Any = ( ) ,
393
+ context: Any = ( ) ,
394
+ eventLoopGroup: EventLoopGroup ,
395
+ variableValues: [ String : Map ] = [ : ] ,
396
+ operationName: String ? = nil
397
+ ) async throws -> SubscriptionResult {
398
+ return try await graphqlSubscribe (
399
+ queryStrategy: queryStrategy,
400
+ mutationStrategy: mutationStrategy,
401
+ subscriptionStrategy: subscriptionStrategy,
402
+ instrumentation: instrumentation,
403
+ schema: schema,
404
+ request: request,
405
+ rootValue: rootValue,
406
+ context: context,
407
+ eventLoopGroup: eventLoopGroup,
408
+ variableValues: variableValues,
409
+ operationName: operationName
410
+ ) . get ( )
411
+ }
0 commit comments