@payloadcms/graphql 3.0.0-beta.127 → 3.0.0-beta.128
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/packages/graphql-query-complexity/QueryComplexity.js +3 -3
- package/dist/packages/graphql-query-complexity/QueryComplexity.js.map +1 -1
- package/dist/packages/graphql-type-json/index.js +4 -4
- package/dist/packages/graphql-type-json/index.js.map +1 -1
- package/license.md +22 -0
- package/package.json +12 -3
|
@@ -226,12 +226,12 @@ export class QueryComplexity {
|
|
|
226
226
|
}
|
|
227
227
|
this.variableValues = coerced;
|
|
228
228
|
switch(operation.operation){
|
|
229
|
-
case 'query':
|
|
230
|
-
this.complexity += this.nodeComplexity(operation, this.context.getSchema().getQueryType());
|
|
231
|
-
break;
|
|
232
229
|
case 'mutation':
|
|
233
230
|
this.complexity += this.nodeComplexity(operation, this.context.getSchema().getMutationType());
|
|
234
231
|
break;
|
|
232
|
+
case 'query':
|
|
233
|
+
this.complexity += this.nodeComplexity(operation, this.context.getSchema().getQueryType());
|
|
234
|
+
break;
|
|
235
235
|
case 'subscription':
|
|
236
236
|
this.complexity += this.nodeComplexity(operation, this.context.getSchema().getSubscriptionType());
|
|
237
237
|
break;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/packages/graphql-query-complexity/QueryComplexity.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n\n/* eslint-disable @typescript-eslint/no-unsafe-enum-comparison */\n/**\n * Created by Ivo Meißner on 28.07.17.\n */\n\nimport type {\n DocumentNode,\n FieldNode,\n FragmentDefinitionNode,\n FragmentSpreadNode,\n GraphQLCompositeType,\n GraphQLDirective,\n GraphQLField,\n GraphQLFieldMap,\n GraphQLNamedType,\n GraphQLSchema,\n GraphQLUnionType,\n InlineFragmentNode,\n OperationDefinitionNode,\n} from 'graphql'\n\nimport {\n getNamedType,\n GraphQLError,\n GraphQLInterfaceType,\n GraphQLObjectType,\n isAbstractType,\n isCompositeType,\n Kind,\n TypeInfo,\n ValidationContext,\n visit,\n visitWithTypeInfo,\n} from 'graphql'\nimport {\n getArgumentValues,\n getDirectiveValues,\n getVariableValues,\n} from 'graphql/execution/values.js'\n\nexport type ComplexityEstimatorArgs = {\n args: { [key: string]: any }\n childComplexity: number\n context?: Record<string, any>\n field: GraphQLField<any, any>\n node: FieldNode\n type: GraphQLCompositeType\n}\n\nexport type ComplexityEstimator = (options: ComplexityEstimatorArgs) => number | void\n\n// Complexity can be anything that is supported by the configured estimators\nexport type Complexity = any\n\n// Map of complexities for possible types (of Union, Interface types)\ntype ComplexityMap = {\n [typeName: string]: number\n}\n\nexport interface QueryComplexityOptions {\n // Pass request context to the estimators via estimationContext\n context?: Record<string, any>\n\n // The query variables. This is needed because the variables are not available\n // Optional function to create a custom error\n createError?: (max: number, actual: number) => GraphQLError\n\n // An array of complexity estimators to use for estimating the complexity\n estimators: Array<ComplexityEstimator>\n\n // Optional callback function to retrieve the determined query complexity\n // Will be invoked whether the query is rejected or not\n // The maximum allowed query complexity, queries above this threshold will be rejected\n maximumComplexity: number\n\n // This can be used for logging or to implement rate limiting\n onComplete?: (complexity: number) => void\n\n // specify operation name only when pass multi-operation documents\n operationName?: string\n\n // in the visitor of the graphql-js library\n variables?: Record<string, any>\n}\n\nfunction queryComplexityMessage(max: number, actual: number): string {\n return `The query exceeds the maximum complexity of ${max}. ` + `Actual complexity is ${actual}`\n}\n\nexport function getComplexity(options: {\n context?: Record<string, any>\n estimators: ComplexityEstimator[]\n operationName?: string\n query: DocumentNode\n schema: GraphQLSchema\n variables?: Record<string, any>\n}): number {\n const typeInfo = new TypeInfo(options.schema)\n\n const errors: GraphQLError[] = []\n const context = new ValidationContext(options.schema, options.query, typeInfo, (error) =>\n errors.push(error),\n )\n const visitor = new QueryComplexity(context, {\n // Maximum complexity does not matter since we're only interested in the calculated complexity.\n context: options.context,\n estimators: options.estimators,\n maximumComplexity: Infinity,\n operationName: options.operationName,\n variables: options.variables,\n })\n\n visit(options.query, visitWithTypeInfo(typeInfo, visitor))\n\n // Throw first error if any\n if (errors.length) {\n throw errors.pop()\n }\n\n return visitor.complexity\n}\n\nexport class QueryComplexity {\n complexity: number\n context: ValidationContext\n estimators: Array<ComplexityEstimator>\n includeDirectiveDef: GraphQLDirective\n OperationDefinition: Record<string, any>\n options: QueryComplexityOptions\n requestContext?: Record<string, any>\n skipDirectiveDef: GraphQLDirective\n variableValues: Record<string, any>\n\n constructor(context: ValidationContext, options: QueryComplexityOptions) {\n if (!(typeof options.maximumComplexity === 'number' && options.maximumComplexity > 0)) {\n throw new Error('Maximum query complexity must be a positive number')\n }\n\n this.context = context\n this.complexity = 0\n this.options = options\n\n this.includeDirectiveDef = this.context.getSchema().getDirective('include')\n this.skipDirectiveDef = this.context.getSchema().getDirective('skip')\n this.estimators = options.estimators\n this.variableValues = {}\n this.requestContext = options.context\n\n this.OperationDefinition = {\n enter: this.onOperationDefinitionEnter,\n leave: this.onOperationDefinitionLeave,\n }\n }\n\n createError(): GraphQLError {\n if (typeof this.options.createError === 'function') {\n return this.options.createError(this.options.maximumComplexity, this.complexity)\n }\n return new GraphQLError(queryComplexityMessage(this.options.maximumComplexity, this.complexity))\n }\n\n nodeComplexity(\n node: FieldNode | FragmentDefinitionNode | InlineFragmentNode | OperationDefinitionNode,\n typeDef: GraphQLInterfaceType | GraphQLObjectType | GraphQLUnionType,\n ): number {\n if (node.selectionSet) {\n let fields: GraphQLFieldMap<any, any> = {}\n if (typeDef instanceof GraphQLObjectType || typeDef instanceof GraphQLInterfaceType) {\n fields = typeDef.getFields()\n }\n\n // Determine all possible types of the current node\n let possibleTypeNames: string[]\n if (isAbstractType(typeDef)) {\n possibleTypeNames = this.context\n .getSchema()\n .getPossibleTypes(typeDef)\n .map((t) => t.name)\n } else {\n possibleTypeNames = [typeDef.name]\n }\n\n // Collect complexities for all possible types individually\n const selectionSetComplexities: ComplexityMap = node.selectionSet.selections.reduce(\n (\n complexities: ComplexityMap,\n childNode: FieldNode | FragmentSpreadNode | InlineFragmentNode,\n ): ComplexityMap => {\n // let nodeComplexity = 0;\n let innerComplexities = complexities\n\n let includeNode = true\n let skipNode = false\n\n for (const directive of childNode.directives ?? []) {\n const directiveName = directive.name.value\n switch (directiveName) {\n case 'include': {\n const values = getDirectiveValues(\n this.includeDirectiveDef,\n childNode,\n this.variableValues || {},\n )\n if (typeof values.if === 'boolean') {\n includeNode = values.if\n }\n break\n }\n case 'skip': {\n const values = getDirectiveValues(\n this.skipDirectiveDef,\n childNode,\n this.variableValues || {},\n )\n if (typeof values.if === 'boolean') {\n skipNode = values.if\n }\n break\n }\n }\n }\n\n if (!includeNode || skipNode) {\n return complexities\n }\n\n switch (childNode.kind) {\n case Kind.FIELD: {\n const field = fields[childNode.name.value]\n // Invalid field, should be caught by other validation rules\n if (!field) {\n break\n }\n const fieldType = getNamedType(field.type)\n\n // Get arguments\n let args: { [key: string]: any }\n try {\n args = getArgumentValues(field, childNode, this.variableValues || {})\n } catch (e) {\n this.context.reportError(e)\n return complexities\n }\n\n // Check if we have child complexity\n let childComplexity = 0\n if (isCompositeType(fieldType)) {\n childComplexity = this.nodeComplexity(childNode, fieldType)\n }\n\n // Run estimators one after another and return first valid complexity\n // score\n const estimatorArgs: ComplexityEstimatorArgs = {\n type: typeDef,\n args,\n childComplexity,\n context: this.requestContext,\n field,\n node: childNode,\n }\n const validScore = this.estimators.find((estimator) => {\n const tmpComplexity = estimator(estimatorArgs)\n\n if (typeof tmpComplexity === 'number' && !isNaN(tmpComplexity)) {\n innerComplexities = addComplexities(\n tmpComplexity,\n complexities,\n possibleTypeNames,\n )\n return true\n }\n\n return false\n })\n if (!validScore) {\n this.context.reportError(\n new GraphQLError(\n `No complexity could be calculated for field ${typeDef.name}.${field.name}. ` +\n 'At least one complexity estimator has to return a complexity score.',\n ),\n )\n return complexities\n }\n break\n }\n case Kind.FRAGMENT_SPREAD: {\n const fragment = this.context.getFragment(childNode.name.value)\n // Unknown fragment, should be caught by other validation rules\n if (!fragment) {\n break\n }\n const fragmentType = this.context\n .getSchema()\n .getType(fragment.typeCondition.name.value)\n // Invalid fragment type, ignore. Should be caught by other validation rules\n if (!isCompositeType(fragmentType)) {\n break\n }\n const nodeComplexity = this.nodeComplexity(fragment, fragmentType)\n if (isAbstractType(fragmentType)) {\n // Add fragment complexity for all possible types\n innerComplexities = addComplexities(\n nodeComplexity,\n complexities,\n this.context\n .getSchema()\n .getPossibleTypes(fragmentType)\n .map((t) => t.name),\n )\n } else {\n // Add complexity for object type\n innerComplexities = addComplexities(nodeComplexity, complexities, [\n fragmentType.name,\n ])\n }\n break\n }\n case Kind.INLINE_FRAGMENT: {\n let inlineFragmentType: GraphQLNamedType = typeDef\n if (childNode.typeCondition && childNode.typeCondition.name) {\n inlineFragmentType = this.context\n .getSchema()\n .getType(childNode.typeCondition.name.value)\n if (!isCompositeType(inlineFragmentType)) {\n break\n }\n }\n\n const nodeComplexity = this.nodeComplexity(childNode, inlineFragmentType)\n if (isAbstractType(inlineFragmentType)) {\n // Add fragment complexity for all possible types\n innerComplexities = addComplexities(\n nodeComplexity,\n complexities,\n this.context\n .getSchema()\n .getPossibleTypes(inlineFragmentType)\n .map((t) => t.name),\n )\n } else {\n // Add complexity for object type\n innerComplexities = addComplexities(nodeComplexity, complexities, [\n inlineFragmentType.name,\n ])\n }\n break\n }\n default: {\n innerComplexities = addComplexities(\n this.nodeComplexity(childNode, typeDef),\n complexities,\n possibleTypeNames,\n )\n break\n }\n }\n\n return innerComplexities\n },\n {},\n )\n // Only return max complexity of all possible types\n if (!selectionSetComplexities) {\n return NaN\n }\n return Math.max(...Object.values(selectionSetComplexities), 0)\n }\n return 0\n }\n\n onOperationDefinitionEnter(operation: OperationDefinitionNode): void {\n if (\n typeof this.options.operationName === 'string' &&\n this.options.operationName !== operation.name.value\n ) {\n return\n }\n\n // Get variable values from variables that are passed from options, merged\n // with default values defined in the operation\n const { coerced, errors } = getVariableValues(\n this.context.getSchema(),\n // We have to create a new array here because input argument is not readonly in graphql ~14.6.0\n operation.variableDefinitions ? [...operation.variableDefinitions] : [],\n this.options.variables ?? {},\n )\n if (errors && errors.length) {\n // We have input validation errors, report errors and abort\n errors.forEach((error) => this.context.reportError(error))\n return\n }\n this.variableValues = coerced\n\n switch (operation.operation) {\n case 'query':\n this.complexity += this.nodeComplexity(operation, this.context.getSchema().getQueryType())\n break\n case 'mutation':\n this.complexity += this.nodeComplexity(\n operation,\n this.context.getSchema().getMutationType(),\n )\n break\n case 'subscription':\n this.complexity += this.nodeComplexity(\n operation,\n this.context.getSchema().getSubscriptionType(),\n )\n break\n default:\n throw new Error(\n `Query complexity could not be calculated for operation of type ${operation.operation}`,\n )\n }\n }\n\n onOperationDefinitionLeave(operation: OperationDefinitionNode): GraphQLError | void {\n if (\n typeof this.options.operationName === 'string' &&\n this.options.operationName !== operation.name.value\n ) {\n return\n }\n\n if (this.options.onComplete) {\n this.options.onComplete(this.complexity)\n }\n\n if (this.complexity > this.options.maximumComplexity) {\n return this.context.reportError(this.createError())\n }\n }\n}\n\n/**\n * Adds a complexity to the complexity map for all possible types\n * @param complexity\n * @param complexityMap\n * @param possibleTypes\n */\nfunction addComplexities(\n complexity: number,\n complexityMap: ComplexityMap,\n possibleTypes: string[],\n): ComplexityMap {\n for (const type of possibleTypes) {\n if (Object.prototype.hasOwnProperty.call(complexityMap, type)) {\n complexityMap[type] += complexity\n } else {\n complexityMap[type] = complexity\n }\n }\n return complexityMap\n}\n"],"names":["getNamedType","GraphQLError","GraphQLInterfaceType","GraphQLObjectType","isAbstractType","isCompositeType","Kind","TypeInfo","ValidationContext","visit","visitWithTypeInfo","getArgumentValues","getDirectiveValues","getVariableValues","queryComplexityMessage","max","actual","getComplexity","options","typeInfo","schema","errors","context","query","error","push","visitor","QueryComplexity","estimators","maximumComplexity","Infinity","operationName","variables","length","pop","complexity","includeDirectiveDef","OperationDefinition","requestContext","skipDirectiveDef","variableValues","constructor","Error","getSchema","getDirective","enter","onOperationDefinitionEnter","leave","onOperationDefinitionLeave","createError","nodeComplexity","node","typeDef","selectionSet","fields","getFields","possibleTypeNames","getPossibleTypes","map","t","name","selectionSetComplexities","selections","reduce","complexities","childNode","innerComplexities","includeNode","skipNode","directive","directives","directiveName","value","values","if","kind","FIELD","field","fieldType","type","args","e","reportError","childComplexity","estimatorArgs","validScore","find","estimator","tmpComplexity","isNaN","addComplexities","FRAGMENT_SPREAD","fragment","getFragment","fragmentType","getType","typeCondition","INLINE_FRAGMENT","inlineFragmentType","NaN","Math","Object","operation","coerced","variableDefinitions","forEach","getQueryType","getMutationType","getSubscriptionType","onComplete","complexityMap","possibleTypes","prototype","hasOwnProperty","call"],"mappings":"AAAA,qDAAqD,GAErD,+DAA+D,GAC/D;;CAEC,GAkBD,SACEA,YAAY,EACZC,YAAY,EACZC,oBAAoB,EACpBC,iBAAiB,EACjBC,cAAc,EACdC,eAAe,EACfC,IAAI,EACJC,QAAQ,EACRC,iBAAiB,EACjBC,KAAK,EACLC,iBAAiB,QACZ,UAAS;AAChB,SACEC,iBAAiB,EACjBC,kBAAkB,EAClBC,iBAAiB,QACZ,8BAA6B;AA+CpC,SAASC,uBAAuBC,GAAW,EAAEC,MAAc;IACzD,OAAO,CAAC,4CAA4C,EAAED,IAAI,EAAE,CAAC,GAAG,CAAC,qBAAqB,EAAEC,OAAO,CAAC;AAClG;AAEA,OAAO,SAASC,cAAcC,OAO7B;IACC,MAAMC,WAAW,IAAIZ,SAASW,QAAQE,MAAM;IAE5C,MAAMC,SAAyB,EAAE;IACjC,MAAMC,UAAU,IAAId,kBAAkBU,QAAQE,MAAM,EAAEF,QAAQK,KAAK,EAAEJ,UAAU,CAACK,QAC9EH,OAAOI,IAAI,CAACD;IAEd,MAAME,UAAU,IAAIC,gBAAgBL,SAAS;QAC3C,+FAA+F;QAC/FA,SAASJ,QAAQI,OAAO;QACxBM,YAAYV,QAAQU,UAAU;QAC9BC,mBAAmBC;QACnBC,eAAeb,QAAQa,aAAa;QACpCC,WA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AG+D,YAAY;gBACvF;YACF,KAAK;gBACH,IAAI,CAACvE,UAAU,IAAI,IAAI,CAACe,cAAc,CACpCoD,WACA,IAAI,CAAChF,OAAO,CAACqB,SAAS,GAAGgE,eAAe;gBAE1C;YACF,KAAK;gBACH,IAAI,CAACxE,UAAU,IAAI,IAAI,CAACe,cAAc,CACpCoD,WACA,IAAI,CAAChF,OAAO,CAACqB,SAAS,GAAGiE,mBAAmB;gBAE9C;YACF;gBACE,MAAM,IAAIlE,MACR,CAAC,+DAA+D,EAAE4D,UAAUA,SAAS,CAAC,CAAC;QAE7F;IACF;IAEAtD,2BAA2BsD,SAAkC,EAAuB;QAClF,IACE,OAAO,IAAI,CAACpF,OAAO,CAACa,aAAa,KAAK,YACtC,IAAI,CAACb,OAAO,CAACa,aAAa,KAAKuE,UAAU1C,IAAI,CAACY,KAAK,EACnD;YACA;QACF;QAEA,IAAI,IAAI,CAACtD,OAAO,CAAC2F,UAAU,EAAE;YAC3B,IAAI,CAAC3F,OAAO,CAAC2F,UAAU,CAAC,IAAI,CAAC1E,UAAU;QACzC;QAEA,IAAI,IAAI,CAACA,UAAU,GAAG,IAAI,CAACjB,OAAO,CAACW,iBAAiB,EAAE;YACpD,OAAO,IAAI,CAACP,OAAO,CAAC4D,WAAW,CAAC,IAAI,CAACjC,WAAW;QAClD;IACF;AACF;AAEA;;;;;CAKC,GACD,SAASyC,gBACPvD,UAAkB,EAClB2E,aAA4B,EAC5BC,aAAuB;IAEvB,KAAK,MAAMhC,QAAQgC,cAAe;QAChC,IAAIV,OAAOW,SAAS,CAACC,cAAc,CAACC,IAAI,CAACJ,eAAe/B,OAAO;YAC7D+B,aAAa,CAAC/B,KAAK,IAAI5C;QACzB,OAAO;YACL2E,aAAa,CAAC/B,KAAK,GAAG5C;QACxB;IACF;IACA,OAAO2E;AACT"}
|
|
1
|
+
{"version":3,"sources":["../../../src/packages/graphql-query-complexity/QueryComplexity.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n\n/* eslint-disable @typescript-eslint/no-unsafe-enum-comparison */\n/**\n * Created by Ivo Meißner on 28.07.17.\n */\n\nimport type {\n DocumentNode,\n FieldNode,\n FragmentDefinitionNode,\n FragmentSpreadNode,\n GraphQLCompositeType,\n GraphQLDirective,\n GraphQLField,\n GraphQLFieldMap,\n GraphQLNamedType,\n GraphQLSchema,\n GraphQLUnionType,\n InlineFragmentNode,\n OperationDefinitionNode,\n} from 'graphql'\n\nimport {\n getNamedType,\n GraphQLError,\n GraphQLInterfaceType,\n GraphQLObjectType,\n isAbstractType,\n isCompositeType,\n Kind,\n TypeInfo,\n ValidationContext,\n visit,\n visitWithTypeInfo,\n} from 'graphql'\nimport {\n getArgumentValues,\n getDirectiveValues,\n getVariableValues,\n} from 'graphql/execution/values.js'\n\nexport type ComplexityEstimatorArgs = {\n args: { [key: string]: any }\n childComplexity: number\n context?: Record<string, any>\n field: GraphQLField<any, any>\n node: FieldNode\n type: GraphQLCompositeType\n}\n\nexport type ComplexityEstimator = (options: ComplexityEstimatorArgs) => number | void\n\n// Complexity can be anything that is supported by the configured estimators\nexport type Complexity = any\n\n// Map of complexities for possible types (of Union, Interface types)\ntype ComplexityMap = {\n [typeName: string]: number\n}\n\nexport interface QueryComplexityOptions {\n // Pass request context to the estimators via estimationContext\n context?: Record<string, any>\n\n // The query variables. This is needed because the variables are not available\n // Optional function to create a custom error\n createError?: (max: number, actual: number) => GraphQLError\n\n // An array of complexity estimators to use for estimating the complexity\n estimators: Array<ComplexityEstimator>\n\n // Optional callback function to retrieve the determined query complexity\n // Will be invoked whether the query is rejected or not\n // The maximum allowed query complexity, queries above this threshold will be rejected\n maximumComplexity: number\n\n // This can be used for logging or to implement rate limiting\n onComplete?: (complexity: number) => void\n\n // specify operation name only when pass multi-operation documents\n operationName?: string\n\n // in the visitor of the graphql-js library\n variables?: Record<string, any>\n}\n\nfunction queryComplexityMessage(max: number, actual: number): string {\n return `The query exceeds the maximum complexity of ${max}. ` + `Actual complexity is ${actual}`\n}\n\nexport function getComplexity(options: {\n context?: Record<string, any>\n estimators: ComplexityEstimator[]\n operationName?: string\n query: DocumentNode\n schema: GraphQLSchema\n variables?: Record<string, any>\n}): number {\n const typeInfo = new TypeInfo(options.schema)\n\n const errors: GraphQLError[] = []\n const context = new ValidationContext(options.schema, options.query, typeInfo, (error) =>\n errors.push(error),\n )\n const visitor = new QueryComplexity(context, {\n // Maximum complexity does not matter since we're only interested in the calculated complexity.\n context: options.context,\n estimators: options.estimators,\n maximumComplexity: Infinity,\n operationName: options.operationName,\n variables: options.variables,\n })\n\n visit(options.query, visitWithTypeInfo(typeInfo, visitor))\n\n // Throw first error if any\n if (errors.length) {\n throw errors.pop()\n }\n\n return visitor.complexity\n}\n\nexport class QueryComplexity {\n complexity: number\n context: ValidationContext\n estimators: Array<ComplexityEstimator>\n includeDirectiveDef: GraphQLDirective\n OperationDefinition: Record<string, any>\n options: QueryComplexityOptions\n requestContext?: Record<string, any>\n skipDirectiveDef: GraphQLDirective\n variableValues: Record<string, any>\n\n constructor(context: ValidationContext, options: QueryComplexityOptions) {\n if (!(typeof options.maximumComplexity === 'number' && options.maximumComplexity > 0)) {\n throw new Error('Maximum query complexity must be a positive number')\n }\n\n this.context = context\n this.complexity = 0\n this.options = options\n\n this.includeDirectiveDef = this.context.getSchema().getDirective('include')\n this.skipDirectiveDef = this.context.getSchema().getDirective('skip')\n this.estimators = options.estimators\n this.variableValues = {}\n this.requestContext = options.context\n\n this.OperationDefinition = {\n enter: this.onOperationDefinitionEnter,\n leave: this.onOperationDefinitionLeave,\n }\n }\n\n createError(): GraphQLError {\n if (typeof this.options.createError === 'function') {\n return this.options.createError(this.options.maximumComplexity, this.complexity)\n }\n return new GraphQLError(queryComplexityMessage(this.options.maximumComplexity, this.complexity))\n }\n\n nodeComplexity(\n node: FieldNode | FragmentDefinitionNode | InlineFragmentNode | OperationDefinitionNode,\n typeDef: GraphQLInterfaceType | GraphQLObjectType | GraphQLUnionType,\n ): number {\n if (node.selectionSet) {\n let fields: GraphQLFieldMap<any, any> = {}\n if (typeDef instanceof GraphQLObjectType || typeDef instanceof GraphQLInterfaceType) {\n fields = typeDef.getFields()\n }\n\n // Determine all possible types of the current node\n let possibleTypeNames: string[]\n if (isAbstractType(typeDef)) {\n possibleTypeNames = this.context\n .getSchema()\n .getPossibleTypes(typeDef)\n .map((t) => t.name)\n } else {\n possibleTypeNames = [typeDef.name]\n }\n\n // Collect complexities for all possible types individually\n const selectionSetComplexities: ComplexityMap = node.selectionSet.selections.reduce(\n (\n complexities: ComplexityMap,\n childNode: FieldNode | FragmentSpreadNode | InlineFragmentNode,\n ): ComplexityMap => {\n // let nodeComplexity = 0;\n let innerComplexities = complexities\n\n let includeNode = true\n let skipNode = false\n\n for (const directive of childNode.directives ?? []) {\n const directiveName = directive.name.value\n switch (directiveName) {\n case 'include': {\n const values = getDirectiveValues(\n this.includeDirectiveDef,\n childNode,\n this.variableValues || {},\n )\n if (typeof values.if === 'boolean') {\n includeNode = values.if\n }\n break\n }\n case 'skip': {\n const values = getDirectiveValues(\n this.skipDirectiveDef,\n childNode,\n this.variableValues || {},\n )\n if (typeof values.if === 'boolean') {\n skipNode = values.if\n }\n break\n }\n }\n }\n\n if (!includeNode || skipNode) {\n return complexities\n }\n\n switch (childNode.kind) {\n case Kind.FIELD: {\n const field = fields[childNode.name.value]\n // Invalid field, should be caught by other validation rules\n if (!field) {\n break\n }\n const fieldType = getNamedType(field.type)\n\n // Get arguments\n let args: { [key: string]: any }\n try {\n args = getArgumentValues(field, childNode, this.variableValues || {})\n } catch (e) {\n this.context.reportError(e)\n return complexities\n }\n\n // Check if we have child complexity\n let childComplexity = 0\n if (isCompositeType(fieldType)) {\n childComplexity = this.nodeComplexity(childNode, fieldType)\n }\n\n // Run estimators one after another and return first valid complexity\n // score\n const estimatorArgs: ComplexityEstimatorArgs = {\n type: typeDef,\n args,\n childComplexity,\n context: this.requestContext,\n field,\n node: childNode,\n }\n const validScore = this.estimators.find((estimator) => {\n const tmpComplexity = estimator(estimatorArgs)\n\n if (typeof tmpComplexity === 'number' && !isNaN(tmpComplexity)) {\n innerComplexities = addComplexities(\n tmpComplexity,\n complexities,\n possibleTypeNames,\n )\n return true\n }\n\n return false\n })\n if (!validScore) {\n this.context.reportError(\n new GraphQLError(\n `No complexity could be calculated for field ${typeDef.name}.${field.name}. ` +\n 'At least one complexity estimator has to return a complexity score.',\n ),\n )\n return complexities\n }\n break\n }\n case Kind.FRAGMENT_SPREAD: {\n const fragment = this.context.getFragment(childNode.name.value)\n // Unknown fragment, should be caught by other validation rules\n if (!fragment) {\n break\n }\n const fragmentType = this.context\n .getSchema()\n .getType(fragment.typeCondition.name.value)\n // Invalid fragment type, ignore. Should be caught by other validation rules\n if (!isCompositeType(fragmentType)) {\n break\n }\n const nodeComplexity = this.nodeComplexity(fragment, fragmentType)\n if (isAbstractType(fragmentType)) {\n // Add fragment complexity for all possible types\n innerComplexities = addComplexities(\n nodeComplexity,\n complexities,\n this.context\n .getSchema()\n .getPossibleTypes(fragmentType)\n .map((t) => t.name),\n )\n } else {\n // Add complexity for object type\n innerComplexities = addComplexities(nodeComplexity, complexities, [\n fragmentType.name,\n ])\n }\n break\n }\n case Kind.INLINE_FRAGMENT: {\n let inlineFragmentType: GraphQLNamedType = typeDef\n if (childNode.typeCondition && childNode.typeCondition.name) {\n inlineFragmentType = this.context\n .getSchema()\n .getType(childNode.typeCondition.name.value)\n if (!isCompositeType(inlineFragmentType)) {\n break\n }\n }\n\n const nodeComplexity = this.nodeComplexity(childNode, inlineFragmentType)\n if (isAbstractType(inlineFragmentType)) {\n // Add fragment complexity for all possible types\n innerComplexities = addComplexities(\n nodeComplexity,\n complexities,\n this.context\n .getSchema()\n .getPossibleTypes(inlineFragmentType)\n .map((t) => t.name),\n )\n } else {\n // Add complexity for object type\n innerComplexities = addComplexities(nodeComplexity, complexities, [\n inlineFragmentType.name,\n ])\n }\n break\n }\n default: {\n innerComplexities = addComplexities(\n this.nodeComplexity(childNode, typeDef),\n complexities,\n possibleTypeNames,\n )\n break\n }\n }\n\n return innerComplexities\n },\n {},\n )\n // Only return max complexity of all possible types\n if (!selectionSetComplexities) {\n return NaN\n }\n return Math.max(...Object.values(selectionSetComplexities), 0)\n }\n return 0\n }\n\n onOperationDefinitionEnter(operation: OperationDefinitionNode): void {\n if (\n typeof this.options.operationName === 'string' &&\n this.options.operationName !== operation.name.value\n ) {\n return\n }\n\n // Get variable values from variables that are passed from options, merged\n // with default values defined in the operation\n const { coerced, errors } = getVariableValues(\n this.context.getSchema(),\n // We have to create a new array here because input argument is not readonly in graphql ~14.6.0\n operation.variableDefinitions ? [...operation.variableDefinitions] : [],\n this.options.variables ?? {},\n )\n if (errors && errors.length) {\n // We have input validation errors, report errors and abort\n errors.forEach((error) => this.context.reportError(error))\n return\n }\n this.variableValues = coerced\n\n switch (operation.operation) {\n case 'mutation':\n this.complexity += this.nodeComplexity(\n operation,\n this.context.getSchema().getMutationType(),\n )\n break\n case 'query':\n this.complexity += this.nodeComplexity(operation, this.context.getSchema().getQueryType())\n break\n case 'subscription':\n this.complexity += this.nodeComplexity(\n operation,\n this.context.getSchema().getSubscriptionType(),\n )\n break\n default:\n throw new Error(\n `Query complexity could not be calculated for operation of type ${operation.operation}`,\n )\n }\n }\n\n onOperationDefinitionLeave(operation: OperationDefinitionNode): GraphQLError | void {\n if (\n typeof this.options.operationName === 'string' &&\n this.options.operationName !== operation.name.value\n ) {\n return\n }\n\n if (this.options.onComplete) {\n this.options.onComplete(this.complexity)\n }\n\n if (this.complexity > this.options.maximumComplexity) {\n return this.context.reportError(this.createError())\n }\n }\n}\n\n/**\n * Adds a complexity to the complexity map for all possible types\n * @param complexity\n * @param complexityMap\n * @param possibleTypes\n */\nfunction addComplexities(\n complexity: number,\n complexityMap: ComplexityMap,\n possibleTypes: string[],\n): ComplexityMap {\n for (const type of possibleTypes) {\n if (Object.prototype.hasOwnProperty.call(complexityMap, type)) {\n complexityMap[type] += complexity\n } else {\n complexityMap[type] = complexity\n }\n }\n return complexityMap\n}\n"],"names":["getNamedType","GraphQLError","GraphQLInterfaceType","GraphQLObjectType","isAbstractType","isCompositeType","Kind","TypeInfo","ValidationContext","visit","visitWithTypeInfo","getArgumentValues","getDirectiveValues","getVariableValues","queryComplexityMessage","max","actual","getComplexity","options","typeInfo","schema","errors","context","query","error","push","visitor","QueryComplexity","estimators","maximumComplexity","Infinity","operationName","variables","length","pop","complexity","includeDirectiveDef","OperationDefinition","requestContext","skipDirectiveDef","variableValues","constructor","Error","getSchema","getDirective","enter","onOperationDefinitionEnter","leave","onOperationDefinitionLeave","createError","nodeComplexity","node","typeDef","selectionSet","fields","getFields","possibleTypeNames","getPossibleTypes","map","t","name","selectionSetComplexities","selections","reduce","complexities","childNode","innerComplexities","includeNode","skipNode","directive","directives","directiveName","value","values","if","kind","FIELD","field","fieldType","type","args","e","reportError","childComplexity","estimatorArgs","validScore","find","estimator","tmpComplexity","isNaN","addComplexities","FRAGMENT_SPREAD","fragment","getFragment","fragmentType","getType","typeCondition","INLINE_FRAGMENT","inlineFragmentType","NaN","Math","Object","operation","coerced","variableDefinitions","forEach","getMutationType","getQueryType","getSubscriptionType","onComplete","complexityMap","possibleTypes","prototype","hasOwnProperty","call"],"mappings":"AAAA,qDAAqD,GAErD,+DAA+D,GAC/D;;CAEC,GAkBD,SACEA,YAAY,EACZC,YAAY,EACZC,oBAAoB,EACpBC,iBAAiB,EACjBC,cAAc,EACdC,eAAe,EACfC,IAAI,EACJC,QAAQ,EACRC,iBAAiB,EACjBC,KAAK,EACLC,iBAAiB,QACZ,UAAS;AAChB,SACEC,iBAAiB,EACjBC,kBAAkB,EAClBC,iBAAiB,QACZ,8BAA6B;AA+CpC,SAASC,uBAAuBC,GAAW,EAAEC,MAAc;IACzD,OAAO,CAAC,4CAA4C,EAAED,IAAI,EAAE,CAAC,GAAG,CAAC,qBAAqB,EAAEC,OAAO,CAAC;AAClG;AAEA,OAAO,SAASC,cAAcC,OAO7B;IACC,MAAMC,WAAW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,EAC5BC,aAAuB;IAEvB,KAAK,MAAMhC,QAAQgC,cAAe;QAChC,IAAIV,OAAOW,SAAS,CAACC,cAAc,CAACC,IAAI,CAACJ,eAAe/B,OAAO;YAC7D+B,aAAa,CAAC/B,KAAK,IAAI5C;QACzB,OAAO;YACL2E,aAAa,CAAC/B,KAAK,GAAG5C;QACxB;IACF;IACA,OAAO2E;AACT"}
|
|
@@ -18,18 +18,18 @@ function parseObject(typeName, ast, variables) {
|
|
|
18
18
|
}
|
|
19
19
|
function parseLiteral(typeName, ast, variables) {
|
|
20
20
|
switch(ast.kind){
|
|
21
|
-
case Kind.STRING:
|
|
22
21
|
case Kind.BOOLEAN:
|
|
22
|
+
case Kind.STRING:
|
|
23
23
|
return ast.value;
|
|
24
|
-
case Kind.INT:
|
|
25
24
|
case Kind.FLOAT:
|
|
25
|
+
case Kind.INT:
|
|
26
26
|
return parseFloat(ast.value);
|
|
27
|
-
case Kind.OBJECT:
|
|
28
|
-
return parseObject(typeName, ast, variables);
|
|
29
27
|
case Kind.LIST:
|
|
30
28
|
return ast.values.map((n)=>parseLiteral(typeName, n, variables));
|
|
31
29
|
case Kind.NULL:
|
|
32
30
|
return null;
|
|
31
|
+
case Kind.OBJECT:
|
|
32
|
+
return parseObject(typeName, ast, variables);
|
|
33
33
|
case Kind.VARIABLE:
|
|
34
34
|
return variables ? variables[ast.name.value] : undefined;
|
|
35
35
|
default:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/packages/graphql-type-json/index.ts"],"sourcesContent":["import { GraphQLScalarType } from 'graphql'\nimport { Kind, print } from 'graphql/language/index.js'\n\nfunction identity(value) {\n return value\n}\n\nfunction ensureObject(value) {\n if (typeof value !== 'object' || value === null || Array.isArray(value)) {\n throw new TypeError(`JSONObject cannot represent non-object value: ${value}`)\n }\n\n return value\n}\n\nfunction parseObject(typeName, ast, variables) {\n const value = Object.create(null)\n ast.fields.forEach((field) => {\n value[field.name.value] = parseLiteral(typeName, field.value, variables)\n })\n\n return value\n}\n\nfunction parseLiteral(typeName, ast, variables) {\n switch (ast.kind) {\n case Kind.
|
|
1
|
+
{"version":3,"sources":["../../../src/packages/graphql-type-json/index.ts"],"sourcesContent":["import { GraphQLScalarType } from 'graphql'\nimport { Kind, print } from 'graphql/language/index.js'\n\nfunction identity(value) {\n return value\n}\n\nfunction ensureObject(value) {\n if (typeof value !== 'object' || value === null || Array.isArray(value)) {\n throw new TypeError(`JSONObject cannot represent non-object value: ${value}`)\n }\n\n return value\n}\n\nfunction parseObject(typeName, ast, variables) {\n const value = Object.create(null)\n ast.fields.forEach((field) => {\n value[field.name.value] = parseLiteral(typeName, field.value, variables)\n })\n\n return value\n}\n\nfunction parseLiteral(typeName, ast, variables) {\n switch (ast.kind) {\n case Kind.BOOLEAN:\n case Kind.STRING:\n return ast.value\n case Kind.FLOAT:\n case Kind.INT:\n return parseFloat(ast.value)\n case Kind.LIST:\n return ast.values.map((n) => parseLiteral(typeName, n, variables))\n case Kind.NULL:\n return null\n case Kind.OBJECT:\n return parseObject(typeName, ast, variables)\n case Kind.VARIABLE:\n return variables ? variables[ast.name.value] : undefined\n default:\n throw new TypeError(`${typeName} cannot represent value: ${print(ast)}`)\n }\n}\n\n// This named export is intended for users of CommonJS. Users of ES modules\n// should instead use the default export.\nexport const GraphQLJSON = new GraphQLScalarType({\n name: 'JSON',\n description:\n 'The `JSON` scalar type represents JSON values as specified by [ECMA-404](http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf).',\n parseLiteral: (ast, variables) => parseLiteral('JSON', ast, variables),\n parseValue: identity,\n serialize: identity,\n specifiedByURL: 'http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf',\n})\n\nexport const GraphQLJSONObject = new GraphQLScalarType({\n name: 'JSONObject',\n description:\n 'The `JSONObject` scalar type represents JSON objects as specified by [ECMA-404](http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf).',\n parseLiteral: (ast, variables) => {\n if (ast.kind !== Kind.OBJECT) {\n throw new TypeError(`JSONObject cannot represent non-object value: ${print(ast)}`)\n }\n\n return parseObject('JSONObject', ast, variables)\n },\n parseValue: ensureObject,\n serialize: ensureObject,\n specifiedByURL: 'http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf',\n})\n"],"names":["GraphQLScalarType","Kind","print","identity","value","ensureObject","Array","isArray","TypeError","parseObject","typeName","ast","variables","Object","create","fields","forEach","field","name","parseLiteral","kind","BOOLEAN","STRING","FLOAT","INT","parseFloat","LIST","values","map","n","NULL","OBJECT","VARIABLE","undefined","GraphQLJSON","description","parseValue","serialize","specifiedByURL","GraphQLJSONObject"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,UAAS;AAC3C,SAASC,IAAI,EAAEC,KAAK,QAAQ,4BAA2B;AAEvD,SAASC,SAASC,KAAK;IACrB,OAAOA;AACT;AAEA,SAASC,aAAaD,KAAK;IACzB,IAAI,OAAOA,UAAU,YAAYA,UAAU,QAAQE,MAAMC,OAAO,CAACH,QAAQ;QACvE,MAAM,IAAII,UAAU,CAAC,8CAA8C,EAAEJ,MAAM,CAAC;IAC9E;IAEA,OAAOA;AACT;AAEA,SAASK,YAAYC,QAAQ,EAAEC,GAAG,EAAEC,SAAS;IAC3C,MAAMR,QAAQS,OAAOC,MAAM,CAAC;IAC5BH,IAAII,MAAM,CAACC,OAAO,CAAC,CAACC;QAClBb,KAAK,CAACa,MAAMC,IAAI,CAACd,KAAK,CAAC,GAAGe,aAAaT,UAAUO,MAAMb,KAAK,EAAEQ;IAChE;IAEA,OAAOR;AACT;AAEA,SAASe,aAAaT,QAAQ,EAAEC,GAAG,EAAEC,SAAS;IAC5C,OAAQD,IAAIS,IAAI;QACd,KAAKnB,KAAKoB,OAAO;QACjB,KAAKpB,KAAKqB,MAAM;YACd,OAAOX,IAAIP,KAAK;QAClB,KAAKH,KAAKsB,KAAK;QACf,KAAKtB,KAAKuB,GAAG;YACX,OAAOC,WAAWd,IAAIP,KAAK;QAC7B,KAAKH,KAAKyB,IAAI;YACZ,OAAOf,IAAIgB,MAAM,CAACC,GAAG,CAAC,CAACC,IAAMV,aAAaT,UAAUmB,GAAGjB;QACzD,KAAKX,KAAK6B,IAAI;YACZ,OAAO;QACT,KAAK7B,KAAK8B,MAAM;YACd,OAAOtB,YAAYC,UAAUC,KAAKC;QACpC,KAAKX,KAAK+B,QAAQ;YAChB,OAAOpB,YAAYA,SAAS,CAACD,IAAIO,IAAI,CAACd,KAAK,CAAC,GAAG6B;QACjD;YACE,MAAM,IAAIzB,UAAU,CAAC,EAAEE,SAAS,yBAAyB,EAAER,MAAMS,KAAK,CAAC;IAC3E;AACF;AAEA,2EAA2E;AAC3E,0CAA0C;AAC1C,OAAO,MAAMuB,cAAc,IAAIlC,kBAAkB;IAC/CkB,MAAM;IACNiB,aACE;IACFhB,cAAc,CAACR,KAAKC,YAAcO,aAAa,QAAQR,KAAKC;IAC5DwB,YAAYjC;IACZkC,WAAWlC;IACXmC,gBAAgB;AAClB,GAAE;AAEF,OAAO,MAAMC,oBAAoB,IAAIvC,kBAAkB;IACrDkB,MAAM;IACNiB,aACE;IACFhB,cAAc,CAACR,KAAKC;QAClB,IAAID,IAAIS,IAAI,KAAKnB,KAAK8B,MAAM,EAAE;YAC5B,MAAM,IAAIvB,UAAU,CAAC,8CAA8C,EAAEN,MAAMS,KAAK,CAAC;QACnF;QAEA,OAAOF,YAAY,cAAcE,KAAKC;IACxC;IACAwB,YAAY/B;IACZgC,WAAWhC;IACXiC,gBAAgB;AAClB,GAAE"}
|
package/license.md
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2018-2024 Payload CMS, Inc. <info@payloadcms.com>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
a copy of this software and associated documentation files (the
|
|
7
|
+
'Software'), to deal in the Software without restriction, including
|
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
+
the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be
|
|
14
|
+
included in all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
19
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
20
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
21
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
22
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/package.json
CHANGED
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payloadcms/graphql",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.128",
|
|
4
4
|
"homepage": "https://payloadcms.com",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/payloadcms/payload.git",
|
|
8
8
|
"directory": "packages/graphql"
|
|
9
9
|
},
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"author": "Payload <dev@payloadcms.com> (https://payloadcms.com)",
|
|
12
|
+
"maintainers": [
|
|
13
|
+
{
|
|
14
|
+
"name": "Payload",
|
|
15
|
+
"email": "info@payloadcms.com",
|
|
16
|
+
"url": "https://payloadcms.com"
|
|
17
|
+
}
|
|
18
|
+
],
|
|
10
19
|
"type": "module",
|
|
11
20
|
"exports": {
|
|
12
21
|
".": {
|
|
@@ -43,11 +52,11 @@
|
|
|
43
52
|
"@types/pluralize": "^0.0.33",
|
|
44
53
|
"graphql-http": "^1.22.0",
|
|
45
54
|
"@payloadcms/eslint-config": "3.0.0-beta.112",
|
|
46
|
-
"payload": "3.0.0-beta.
|
|
55
|
+
"payload": "3.0.0-beta.128"
|
|
47
56
|
},
|
|
48
57
|
"peerDependencies": {
|
|
49
58
|
"graphql": "^16.8.1",
|
|
50
|
-
"payload": "3.0.0-beta.
|
|
59
|
+
"payload": "3.0.0-beta.128"
|
|
51
60
|
},
|
|
52
61
|
"scripts": {
|
|
53
62
|
"build": "pnpm build:types && pnpm build:swc",
|