File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
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 . toLocaleLowerCase ( )
42+ ? node . name . value
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 [ resolvedTypeName ] ?. weight ;
49+ const weightFunction = typeWeights [ parentName ] ?. fields [ node . name . value ] ?. weight ;
5050
5151 // call the function to handle selection set node with selectionSet property if it is not undefined
5252 if ( node . selectionSet ) {
@@ -117,13 +117,14 @@ 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}`);
120121 // call the function to handle selection set node with selectionSet property if it is not undefined
121122 if ( node . selectionSet ) {
122123 complexity += selectionSetNode (
123124 node . selectionSet ,
124125 typeWeights ,
125126 variables ,
126- node . operation . toLocaleLowerCase ( )
127+ node . operation
127128 ) ;
128129 }
129130 }
You can’t perform that action at this time.
0 commit comments