@@ -34,7 +34,16 @@ import type {
34
34
OperationDefinitionNode ,
35
35
} from '../language/ast' ;
36
36
37
- export function createSubscriptionSourceEventStream (
37
+ /**
38
+ * Implements the "CreateSourceEventStream" algorithm described in the
39
+ * GraphQL specification, resolving the subscription source event stream.
40
+ *
41
+ * Returns an AsyncIterable
42
+ *
43
+ * A Source Stream represents the sequence of events, each of which is
44
+ * expected to be used to trigger a GraphQL execution for that event.
45
+ */
46
+ export function createSourceEventStream (
38
47
schema : GraphQLSchema ,
39
48
document : DocumentNode ,
40
49
rootValue ?: mixed ,
@@ -63,7 +72,7 @@ export function createSubscriptionSourceEventStream(
63
72
}
64
73
65
74
/**
66
- * Implements the "Subscribing to request" section of the GraphQL specification.
75
+ * Implements the "Subscribe" algorithm described in the GraphQL specification.
67
76
*
68
77
* Returns an AsyncIterator
69
78
*
@@ -78,7 +87,7 @@ export function subscribe(
78
87
variableValues ?: ?{ [ key : string ] : mixed } ,
79
88
operationName ?: ?string ,
80
89
) : AsyncIterator < ExecutionResult > {
81
- const subscription = createSubscriptionSourceEventStream (
90
+ const subscription = createSourceEventStream (
82
91
schema ,
83
92
document ,
84
93
rootValue ,
@@ -138,6 +147,9 @@ function resolveSubscription(
138
147
addPath ( undefined , responseName )
139
148
) ;
140
149
150
+ // resolveFieldValueOrError implements the "ResolveFieldEventStream"
151
+ // algorithm from GraphQL specification. It differs from
152
+ // "ResolveFieldValue" due to providing a different `resolveFn`.
141
153
const subscription = resolveFieldValueOrError (
142
154
exeContext ,
143
155
fieldDef ,
0 commit comments