@@ -13,7 +13,10 @@ import type {
1313import  {  OperationTypeNode  }  from  '../language/ast.js' ; 
1414import  {  Kind  }  from  '../language/kinds.js' ; 
1515
16- import  type  {  GraphQLObjectType  }  from  '../type/definition.js' ; 
16+ import  type  { 
17+   GraphQLInputType , 
18+   GraphQLObjectType , 
19+ }  from  '../type/definition.js' ; 
1720import  {  isAbstractType  }  from  '../type/definition.js' ; 
1821import  { 
1922  GraphQLDeferDirective , 
@@ -24,7 +27,7 @@ import type { GraphQLSchema } from '../type/schema.js';
2427
2528import  {  typeFromAST  }  from  '../utilities/typeFromAST.js' ; 
2629
27- import  {  getArgumentValuesFromSpread ,  getDirectiveValues  }  from  './values.js' ; 
30+ import  {  getArgumentValues ,  getDirectiveValues  }  from  './values.js' ; 
2831
2932export  interface  DeferUsage  { 
3033  label : string  |  undefined ; 
@@ -41,9 +44,18 @@ export type FieldGroup = ReadonlyArray<FieldDetails>;
4144
4245export  type  GroupedFieldSet  =  ReadonlyMap < string ,  FieldGroup > ; 
4346
47+ export  interface  GraphQLFragmentSignature  { 
48+   name : string ; 
49+   type : GraphQLInputType ; 
50+   defaultValue : unknown ; 
51+ } 
52+ 
4453interface  CollectFieldsContext  { 
4554  schema : GraphQLSchema ; 
46-   fragments : ObjMap < FragmentDefinitionNode > ; 
55+   fragments : ObjMap < { 
56+     definition : FragmentDefinitionNode ; 
57+     signatures : ReadonlyArray < GraphQLFragmentSignature > ; 
58+   } > ; 
4759  operation : OperationDefinitionNode ; 
4860  runtimeType : GraphQLObjectType ; 
4961  visitedFragmentNames : Set < string > ; 
@@ -62,7 +74,10 @@ interface CollectFieldsContext {
6274 */ 
6375export  function  collectFields ( 
6476  schema : GraphQLSchema , 
65-   fragments : ObjMap < FragmentDefinitionNode > , 
77+   fragments : ObjMap < { 
78+     definition : FragmentDefinitionNode ; 
79+     signatures : ReadonlyArray < GraphQLFragmentSignature > ; 
80+   } > , 
6681  variableValues : {  [ variable : string ] : unknown  } , 
6782  runtimeType : GraphQLObjectType , 
6883  operation : OperationDefinitionNode , 
@@ -104,7 +119,10 @@ export function collectFields(
104119// eslint-disable-next-line max-params 
105120export  function  collectSubfields ( 
106121  schema : GraphQLSchema , 
107-   fragments : ObjMap < FragmentDefinitionNode > , 
122+   fragments : ObjMap < { 
123+     definition : FragmentDefinitionNode ; 
124+     signatures : ReadonlyArray < GraphQLFragmentSignature > ; 
125+   } > , 
108126  variableValues : {  [ variable : string ] : unknown  } , 
109127  operation : OperationDefinitionNode , 
110128  returnType : GraphQLObjectType , 
@@ -232,7 +250,7 @@ function collectFieldsImpl(
232250        const  fragment  =  fragments [ fragmentName ] ; 
233251        if  ( 
234252          fragment  ==  null  || 
235-           ! doesFragmentConditionMatch ( schema ,  fragment ,  runtimeType ) 
253+           ! doesFragmentConditionMatch ( schema ,  fragment . definition ,  runtimeType ) 
236254        )  { 
237255          continue ; 
238256        } 
@@ -246,11 +264,10 @@ function collectFieldsImpl(
246264        //   scope as that variable can still get used in spreads later on in the selectionSet. 
247265        // - when a value is passed in through the fragment-spread we need to copy over the key-value 
248266        //   into our variable-values. 
249-         context . localVariableValues  =  fragment . variableDefinitions 
250-           ? getArgumentValuesFromSpread ( 
267+         context . localVariableValues  =  fragment . definition . variableDefinitions 
268+           ? getArgumentValues ( 
251269              selection , 
252-               schema , 
253-               fragment . variableDefinitions , 
270+               fragment . signatures , 
254271              variableValues , 
255272              context . localVariableValues , 
256273            ) 
@@ -260,7 +277,7 @@ function collectFieldsImpl(
260277          visitedFragmentNames . add ( fragmentName ) ; 
261278          collectFieldsImpl ( 
262279            context , 
263-             fragment . selectionSet , 
280+             fragment . definition . selectionSet , 
264281            groupedFieldSet , 
265282            newDeferUsages , 
266283            deferUsage , 
@@ -269,7 +286,7 @@ function collectFieldsImpl(
269286          newDeferUsages . push ( newDeferUsage ) ; 
270287          collectFieldsImpl ( 
271288            context , 
272-             fragment . selectionSet , 
289+             fragment . definition . selectionSet , 
273290            groupedFieldSet , 
274291            newDeferUsages , 
275292            newDeferUsage , 
0 commit comments