File tree Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -39,14 +39,14 @@ export function fieldNode(
3939 // 'resolvedTypeName' is the name of the Schema Type that this field resolves to
4040 const resolvedTypeName =
4141 node . name . value in typeWeights
42- ? node . name . value
42+ ? node . name . value . toLocaleLowerCase ( )
4343 : typeWeights [ parentName ] . fields [ node . name . value ] ?. resolveTo || null ;
4444
4545 if ( resolvedTypeName ) {
4646 // field resolves to an object or a list with possible selections
4747 let selectionsCost = 0 ;
4848 let calculatedWeight = 0 ;
49- const weightFunction = typeWeights [ parentName ] ?. fields [ node . name . value ] ?. weight ;
49+ const weightFunction = typeWeights [ parentName ] ?. fields [ resolvedTypeName ] ?. weight ;
5050
5151 // call the function to handle selection set node with selectionSet property if it is not undefined
5252 if ( node . selectionSet ) {
@@ -117,14 +117,13 @@ export function definitionNode(
117117 if ( node . operation . toLocaleLowerCase ( ) in typeWeights ) {
118118 // if it is, it is an object type, add it's type weight to the total
119119 complexity += typeWeights [ node . operation ] . weight ;
120- // console.log(`the weight of ${node.operation} is ${complexity}`);
121120 // call the function to handle selection set node with selectionSet property if it is not undefined
122121 if ( node . selectionSet ) {
123122 complexity += selectionSetNode (
124123 node . selectionSet ,
125124 typeWeights ,
126125 variables ,
127- node . operation
126+ node . operation . toLocaleLowerCase ( )
128127 ) ;
129128 }
130129 }
You can’t perform that action at this time.
0 commit comments