@@ -25,22 +25,18 @@ import type { GraphQLSchema } from '../type/schema.js';
2525import  {  typeFromAST  }  from  '../utilities/typeFromAST.js' ; 
2626
2727import  type  {  GraphQLVariableSignature  }  from  './getVariableSignature.js' ; 
28- import  {  experimentalGetArgumentValues ,  getDirectiveValues  }  from  './values.js' ; 
28+ import  type  {  VariableValues  }  from  './values.js' ; 
29+ import  {  getDirectiveValues ,  getFragmentVariableValues  }  from  './values.js' ; 
2930
3031export  interface  DeferUsage  { 
3132  label : string  |  undefined ; 
3233  parentDeferUsage : DeferUsage  |  undefined ; 
3334} 
3435
35- export  interface  FragmentVariables  { 
36-   signatures : ObjMap < GraphQLVariableSignature > ; 
37-   values : ObjMap < unknown > ; 
38- } 
39- 
4036export  interface  FieldDetails  { 
4137  node : FieldNode ; 
4238  deferUsage ?: DeferUsage  |  undefined ; 
43-   fragmentVariables ?: FragmentVariables  |  undefined ; 
39+   fragmentVariableValues ?: VariableValues  |  undefined ; 
4440} 
4541
4642export  type  FieldGroup  =  ReadonlyArray < FieldDetails > ; 
@@ -55,7 +51,7 @@ export interface FragmentDetails {
5551interface  CollectFieldsContext  { 
5652  schema : GraphQLSchema ; 
5753  fragments : ObjMap < FragmentDetails > ; 
58-   variableValues : {   [ variable :  string ] :  unknown   } ; 
54+   variableValues : VariableValues ; 
5955  operation : OperationDefinitionNode ; 
6056  runtimeType : GraphQLObjectType ; 
6157  visitedFragmentNames : Set < string > ; 
@@ -73,7 +69,7 @@ interface CollectFieldsContext {
7369export  function  collectFields ( 
7470  schema : GraphQLSchema , 
7571  fragments : ObjMap < FragmentDetails > , 
76-   variableValues : {   [ variable :  string ] :  unknown   } , 
72+   variableValues : VariableValues , 
7773  runtimeType : GraphQLObjectType , 
7874  operation : OperationDefinitionNode , 
7975) : { 
@@ -114,7 +110,7 @@ export function collectFields(
114110export  function  collectSubfields ( 
115111  schema : GraphQLSchema , 
116112  fragments : ObjMap < FragmentDetails > , 
117-   variableValues : {   [ variable :  string ] :  unknown   } , 
113+   variableValues : VariableValues , 
118114  operation : OperationDefinitionNode , 
119115  returnType : GraphQLObjectType , 
120116  fieldGroup : FieldGroup , 
@@ -136,14 +132,14 @@ export function collectSubfields(
136132  for  ( const  fieldDetail  of  fieldGroup )  { 
137133    const  selectionSet  =  fieldDetail . node . selectionSet ; 
138134    if  ( selectionSet )  { 
139-       const  {  deferUsage,  fragmentVariables  }  =  fieldDetail ; 
135+       const  {  deferUsage,  fragmentVariableValues  }  =  fieldDetail ; 
140136      collectFieldsImpl ( 
141137        context , 
142138        selectionSet , 
143139        subGroupedFieldSet , 
144140        newDeferUsages , 
145141        deferUsage , 
146-         fragmentVariables , 
142+         fragmentVariableValues , 
147143      ) ; 
148144    } 
149145  } 
@@ -161,7 +157,7 @@ function collectFieldsImpl(
161157  groupedFieldSet : AccumulatorMap < string ,  FieldDetails > , 
162158  newDeferUsages : Array < DeferUsage > , 
163159  deferUsage ?: DeferUsage , 
164-   fragmentVariables ?: FragmentVariables , 
160+   fragmentVariableValues ?: VariableValues , 
165161) : void { 
166162  const  { 
167163    schema, 
@@ -175,19 +171,25 @@ function collectFieldsImpl(
175171  for  ( const  selection  of  selectionSet . selections )  { 
176172    switch  ( selection . kind )  { 
177173      case  Kind . FIELD : { 
178-         if  ( ! shouldIncludeNode ( selection ,  variableValues ,  fragmentVariables ) )  { 
174+         if  ( 
175+           ! shouldIncludeNode ( selection ,  variableValues ,  fragmentVariableValues ) 
176+         )  { 
179177          continue ; 
180178        } 
181179        groupedFieldSet . add ( getFieldEntryKey ( selection ) ,  { 
182180          node : selection , 
183181          deferUsage, 
184-           fragmentVariables , 
182+           fragmentVariableValues , 
185183        } ) ; 
186184        break ; 
187185      } 
188186      case  Kind . INLINE_FRAGMENT : { 
189187        if  ( 
190-           ! shouldIncludeNode ( selection ,  variableValues ,  fragmentVariables )  || 
188+           ! shouldIncludeNode ( 
189+             selection , 
190+             variableValues , 
191+             fragmentVariableValues , 
192+           )  || 
191193          ! doesFragmentConditionMatch ( schema ,  selection ,  runtimeType ) 
192194        )  { 
193195          continue ; 
@@ -196,7 +198,7 @@ function collectFieldsImpl(
196198        const  newDeferUsage  =  getDeferUsage ( 
197199          operation , 
198200          variableValues , 
199-           fragmentVariables , 
201+           fragmentVariableValues , 
200202          selection , 
201203          deferUsage , 
202204        ) ; 
@@ -208,7 +210,7 @@ function collectFieldsImpl(
208210            groupedFieldSet , 
209211            newDeferUsages , 
210212            deferUsage , 
211-             fragmentVariables , 
213+             fragmentVariableValues , 
212214          ) ; 
213215        }  else  { 
214216          newDeferUsages . push ( newDeferUsage ) ; 
@@ -218,7 +220,7 @@ function collectFieldsImpl(
218220            groupedFieldSet , 
219221            newDeferUsages , 
220222            newDeferUsage , 
221-             fragmentVariables , 
223+             fragmentVariableValues , 
222224          ) ; 
223225        } 
224226
@@ -230,15 +232,19 @@ function collectFieldsImpl(
230232        const  newDeferUsage  =  getDeferUsage ( 
231233          operation , 
232234          variableValues , 
233-           fragmentVariables , 
235+           fragmentVariableValues , 
234236          selection , 
235237          deferUsage , 
236238        ) ; 
237239
238240        if  ( 
239241          ! newDeferUsage  && 
240242          ( visitedFragmentNames . has ( fragName )  || 
241-             ! shouldIncludeNode ( selection ,  variableValues ,  fragmentVariables ) ) 
243+             ! shouldIncludeNode ( 
244+               selection , 
245+               variableValues , 
246+               fragmentVariableValues , 
247+             ) ) 
242248        )  { 
243249          continue ; 
244250        } 
@@ -252,17 +258,14 @@ function collectFieldsImpl(
252258        } 
253259
254260        const  fragmentVariableSignatures  =  fragment . variableSignatures ; 
255-         let  newFragmentVariables :  FragmentVariables  |  undefined ; 
261+         let  newFragmentVariableValues :  VariableValues  |  undefined ; 
256262        if  ( fragmentVariableSignatures )  { 
257-           newFragmentVariables  =  { 
258-             signatures : fragmentVariableSignatures , 
259-             values : experimentalGetArgumentValues ( 
260-               selection , 
261-               Object . values ( fragmentVariableSignatures ) , 
262-               variableValues , 
263-               fragmentVariables , 
264-             ) , 
265-           } ; 
263+           newFragmentVariableValues  =  getFragmentVariableValues ( 
264+             selection , 
265+             fragmentVariableSignatures , 
266+             variableValues , 
267+             fragmentVariableValues , 
268+           ) ; 
266269        } 
267270
268271        if  ( ! newDeferUsage )  { 
@@ -273,7 +276,7 @@ function collectFieldsImpl(
273276            groupedFieldSet , 
274277            newDeferUsages , 
275278            deferUsage , 
276-             newFragmentVariables , 
279+             newFragmentVariableValues , 
277280          ) ; 
278281        }  else  { 
279282          newDeferUsages . push ( newDeferUsage ) ; 
@@ -283,7 +286,7 @@ function collectFieldsImpl(
283286            groupedFieldSet , 
284287            newDeferUsages , 
285288            newDeferUsage , 
286-             newFragmentVariables , 
289+             newFragmentVariableValues , 
287290          ) ; 
288291        } 
289292        break ; 
@@ -299,16 +302,16 @@ function collectFieldsImpl(
299302 */ 
300303function  getDeferUsage ( 
301304  operation : OperationDefinitionNode , 
302-   variableValues : {   [ variable :  string ] :  unknown   } , 
303-   fragmentVariables :  FragmentVariables  |  undefined , 
305+   variableValues : VariableValues , 
306+   fragmentVariableValues :  VariableValues  |  undefined , 
304307  node : FragmentSpreadNode  |  InlineFragmentNode , 
305308  parentDeferUsage : DeferUsage  |  undefined , 
306309) : DeferUsage  |  undefined  { 
307310  const  defer  =  getDirectiveValues ( 
308311    GraphQLDeferDirective , 
309312    node , 
310313    variableValues , 
311-     fragmentVariables , 
314+     fragmentVariableValues , 
312315  ) ; 
313316
314317  if  ( ! defer )  { 
@@ -336,14 +339,14 @@ function getDeferUsage(
336339 */ 
337340function  shouldIncludeNode ( 
338341  node : FragmentSpreadNode  |  FieldNode  |  InlineFragmentNode , 
339-   variableValues : {   [ variable :  string ] :  unknown   } , 
340-   fragmentVariables :  FragmentVariables  |  undefined , 
342+   variableValues : VariableValues , 
343+   fragmentVariableValues :  VariableValues  |  undefined , 
341344) : boolean  { 
342345  const  skip  =  getDirectiveValues ( 
343346    GraphQLSkipDirective , 
344347    node , 
345348    variableValues , 
346-     fragmentVariables , 
349+     fragmentVariableValues , 
347350  ) ; 
348351  if  ( skip ?. if  ===  true )  { 
349352    return  false ; 
@@ -353,7 +356,7 @@ function shouldIncludeNode(
353356    GraphQLIncludeDirective , 
354357    node , 
355358    variableValues , 
356-     fragmentVariables , 
359+     fragmentVariableValues , 
357360  ) ; 
358361  if  ( include ?. if  ===  false )  { 
359362    return  false ; 
0 commit comments