1
1
import { AccumulatorMap } from '../jsutils/AccumulatorMap.js' ;
2
- import { invariant } from '../jsutils/invariant.js' ;
3
2
import type { ObjMap } from '../jsutils/ObjMap.js' ;
4
3
5
4
import type {
@@ -10,7 +9,6 @@ import type {
10
9
OperationDefinitionNode ,
11
10
SelectionSetNode ,
12
11
} from '../language/ast.js' ;
13
- import { OperationTypeNode } from '../language/ast.js' ;
14
12
import { Kind } from '../language/kinds.js' ;
15
13
16
14
import type { GraphQLObjectType } from '../type/definition.js' ;
@@ -52,7 +50,6 @@ interface CollectFieldsContext {
52
50
schema : GraphQLSchema ;
53
51
fragments : ObjMap < FragmentDetails > ;
54
52
variableValues : VariableValues ;
55
- operation : OperationDefinitionNode ;
56
53
runtimeType : GraphQLObjectType ;
57
54
visitedFragmentNames : Set < string > ;
58
55
hideSuggestions : boolean ;
@@ -86,7 +83,6 @@ export function collectFields(
86
83
fragments,
87
84
variableValues,
88
85
runtimeType,
89
- operation,
90
86
visitedFragmentNames : new Set ( ) ,
91
87
hideSuggestions,
92
88
} ;
@@ -115,7 +111,6 @@ export function collectSubfields(
115
111
schema : GraphQLSchema ,
116
112
fragments : ObjMap < FragmentDetails > ,
117
113
variableValues : VariableValues ,
118
- operation : OperationDefinitionNode ,
119
114
returnType : GraphQLObjectType ,
120
115
fieldDetailsList : FieldDetailsList ,
121
116
hideSuggestions : boolean ,
@@ -128,7 +123,6 @@ export function collectSubfields(
128
123
fragments,
129
124
variableValues,
130
125
runtimeType : returnType ,
131
- operation,
132
126
visitedFragmentNames : new Set ( ) ,
133
127
hideSuggestions,
134
128
} ;
@@ -170,7 +164,6 @@ function collectFieldsImpl(
170
164
fragments,
171
165
variableValues,
172
166
runtimeType,
173
- operation,
174
167
visitedFragmentNames,
175
168
hideSuggestions,
176
169
} = context ;
@@ -203,7 +196,6 @@ function collectFieldsImpl(
203
196
}
204
197
205
198
const newDeferUsage = getDeferUsage (
206
- operation ,
207
199
variableValues ,
208
200
fragmentVariableValues ,
209
201
selection ,
@@ -237,7 +229,6 @@ function collectFieldsImpl(
237
229
const fragName = selection . name . value ;
238
230
239
231
const newDeferUsage = getDeferUsage (
240
- operation ,
241
232
variableValues ,
242
233
fragmentVariableValues ,
243
234
selection ,
@@ -309,7 +300,6 @@ function collectFieldsImpl(
309
300
* not disabled by the "if" argument.
310
301
*/
311
302
function getDeferUsage (
312
- operation : OperationDefinitionNode ,
313
303
variableValues : VariableValues ,
314
304
fragmentVariableValues : VariableValues | undefined ,
315
305
node : FragmentSpreadNode | InlineFragmentNode ,
@@ -330,11 +320,6 @@ function getDeferUsage(
330
320
return ;
331
321
}
332
322
333
- invariant (
334
- operation . operation !== OperationTypeNode . SUBSCRIPTION ,
335
- '`@defer` directive not supported on subscription operations. Disable `@defer` by setting the `if` argument to `false`.' ,
336
- ) ;
337
-
338
323
return {
339
324
label : typeof defer . label === 'string' ? defer . label : undefined ,
340
325
parentDeferUsage,
0 commit comments