@@ -6,21 +6,20 @@ import NIO
6
6
/**
7
7
* Implements the "Subscribe" algorithm described in the GraphQL specification.
8
8
*
9
- * Returns a Promise which resolves to either an AsyncIterator (if successful)
10
- * or an ExecutionResult (error). The promise will be rejected if the schema or
11
- * other arguments to this function are invalid, or if the resolved event stream
12
- * is not an async iterable.
9
+ * Returns a future which resolves to a SubscriptionResult containing either
10
+ * a SubscriptionObservable (if successful), or GraphQLErrors (error).
13
11
*
14
12
* If the client-provided arguments to this function do not result in a
15
- * compliant subscription, a GraphQL Response (ExecutionResult) with
16
- * descriptive errors and no data will be returned .
13
+ * compliant subscription, the future will resolve to a
14
+ * SubscriptionResult containing ` errors` and no `observable` .
17
15
*
18
16
* If the source stream could not be created due to faulty subscription
19
- * resolver logic or underlying systems, the promise will resolve to a single
20
- * ExecutionResult containing `errors` and no `data `.
17
+ * resolver logic or underlying systems, the future will resolve to a
18
+ * SubscriptionResult containing `errors` and no `observable `.
21
19
*
22
- * If the operation succeeded, the promise resolves to an AsyncIterator, which
23
- * yields a stream of ExecutionResults representing the response stream.
20
+ * If the operation succeeded, the future will resolve to a SubscriptionResult,
21
+ * containing an `observable` which yields a stream of GraphQLResults
22
+ * representing the response stream.
24
23
*
25
24
* Accepts either an object with named arguments, or individual arguments.
26
25
*/
@@ -77,7 +76,7 @@ func subscribe(
77
76
operationName: operationName
78
77
)
79
78
}
80
- return SubscriptionResult ( observable: subscriptionObservable)
79
+ return SubscriptionResult ( observable: subscriptionObservable, errors : sourceResult . errors )
81
80
} else {
82
81
return SubscriptionResult ( errors: sourceResult. errors)
83
82
}
@@ -88,21 +87,20 @@ func subscribe(
88
87
* Implements the "CreateSourceEventStream" algorithm described in the
89
88
* GraphQL specification, resolving the subscription source event stream.
90
89
*
91
- * Returns a Promise which resolves to either an AsyncIterable (if successful)
92
- * or an ExecutionResult (error). The promise will be rejected if the schema or
93
- * other arguments to this function are invalid, or if the resolved event stream
94
- * is not an async iterable.
90
+ * Returns a Future which resolves to a SourceEventStreamResult, containing
91
+ * either an Observable (if successful) or GraphQLErrors (error).
95
92
*
96
93
* If the client-provided arguments to this function do not result in a
97
- * compliant subscription, a GraphQL Response (ExecutionResult) with
98
- * descriptive errors and no data will be returned .
94
+ * compliant subscription, the future will resolve to a
95
+ * SourceEventStreamResult containing ` errors` and no `observable` .
99
96
*
100
- * If the the source stream could not be created due to faulty subscription
101
- * resolver logic or underlying systems, the promise will resolve to a single
102
- * ExecutionResult containing `errors` and no `data `.
97
+ * If the source stream could not be created due to faulty subscription
98
+ * resolver logic or underlying systems, the future will resolve to a
99
+ * SourceEventStreamResult containing `errors` and no `observable `.
103
100
*
104
- * If the operation succeeded, the promise resolves to the AsyncIterable for the
105
- * event stream returned by the resolver.
101
+ * If the operation succeeded, the future will resolve to a SubscriptionResult,
102
+ * containing an `observable` which yields a stream of event objects
103
+ * returned by the subscription resolver.
106
104
*
107
105
* A Source Event Stream represents a sequence of events, each of which triggers
108
106
* a GraphQL execution for that event.
0 commit comments