1
1
import { inspect } from '../jsutils/inspect' ;
2
2
import { isAsyncIterable } from '../jsutils/isAsyncIterable' ;
3
3
import { isPromise } from '../jsutils/isPromise' ;
4
- import type { Maybe } from '../jsutils/Maybe' ;
5
4
import { addPath , pathToArray } from '../jsutils/Path' ;
6
5
import type { PromiseOrValue } from '../jsutils/PromiseOrValue' ;
7
6
8
7
import { GraphQLError } from '../error/GraphQLError' ;
9
8
import { locatedError } from '../error/locatedError' ;
10
9
11
- import type { DocumentNode } from '../language/ast' ;
12
-
13
- import type { GraphQLFieldResolver } from '../type/definition' ;
14
- import type { GraphQLSchema } from '../type/schema' ;
15
-
16
10
import { collectFields } from './collectFields' ;
17
11
import type {
18
12
ExecutionArgs ,
@@ -89,36 +83,6 @@ function mapSourceToResponse(
89
83
) ;
90
84
}
91
85
92
- type BackwardsCompatibleArgs =
93
- | [ options : ExecutionArgs ]
94
- | [
95
- schema : ExecutionArgs [ 'schema' ] ,
96
- document : ExecutionArgs [ 'document' ] ,
97
- rootValue ?: ExecutionArgs [ 'rootValue' ] ,
98
- contextValue ?: ExecutionArgs [ 'contextValue' ] ,
99
- variableValues ?: ExecutionArgs [ 'variableValues' ] ,
100
- operationName ?: ExecutionArgs [ 'operationName' ] ,
101
- subscribeFieldResolver ?: ExecutionArgs [ 'subscribeFieldResolver' ] ,
102
- ] ;
103
-
104
- function toNormalizedArgs ( args : BackwardsCompatibleArgs ) : ExecutionArgs {
105
- const firstArg = args [ 0 ] ;
106
- if ( 'document' in firstArg ) {
107
- return firstArg ;
108
- }
109
-
110
- return {
111
- schema : firstArg ,
112
- // FIXME: when underlying TS bug fixed, see https://github.com/microsoft/TypeScript/issues/31613
113
- document : args [ 1 ] as DocumentNode ,
114
- rootValue : args [ 2 ] ,
115
- contextValue : args [ 3 ] ,
116
- variableValues : args [ 4 ] ,
117
- operationName : args [ 5 ] ,
118
- subscribeFieldResolver : args [ 6 ] ,
119
- } ;
120
- }
121
-
122
86
/**
123
87
* Implements the "CreateSourceEventStream" algorithm described in the
124
88
* GraphQL specification, resolving the subscription source event stream.
@@ -149,18 +113,7 @@ function toNormalizedArgs(args: BackwardsCompatibleArgs): ExecutionArgs {
149
113
*/
150
114
export function createSourceEventStream (
151
115
args : ExecutionArgs ,
152
- ) : PromiseOrValue < AsyncIterable < unknown > | ExecutionResult > ;
153
- /** @deprecated will be removed in next major version in favor of named arguments */
154
- export function createSourceEventStream (
155
- schema : GraphQLSchema ,
156
- document : DocumentNode ,
157
- rootValue ?: unknown ,
158
- contextValue ?: unknown ,
159
- variableValues ?: Maybe < { readonly [ variable : string ] : unknown } > ,
160
- operationName ?: Maybe < string > ,
161
- subscribeFieldResolver ?: Maybe < GraphQLFieldResolver < any , any > > ,
162
- ) : PromiseOrValue < AsyncIterable < unknown > | ExecutionResult > ;
163
- export function createSourceEventStream ( ...rawArgs : BackwardsCompatibleArgs ) {
116
+ ) : PromiseOrValue < AsyncIterable < unknown > | ExecutionResult > {
164
117
const {
165
118
schema,
166
119
document,
@@ -169,7 +122,7 @@ export function createSourceEventStream(...rawArgs: BackwardsCompatibleArgs) {
169
122
variableValues,
170
123
operationName,
171
124
subscribeFieldResolver,
172
- } = toNormalizedArgs ( rawArgs ) ;
125
+ } = args ;
173
126
174
127
// If arguments are missing or incorrectly typed, this is an internal
175
128
// developer mistake which should throw an early error.
0 commit comments