diff options
author | Minteck <contact@minteck.org> | 2023-01-10 14:54:04 +0100 |
---|---|---|
committer | Minteck <contact@minteck.org> | 2023-01-10 14:54:04 +0100 |
commit | 99c1d9af689e5325f3cf535c4007b3aeb8325229 (patch) | |
tree | e663b3c2ebdbd67c818ac0c5147f0ce1d2463cda /alarm/node_modules/graphql/validation/rules | |
parent | 9871b03912fc28ad38b4037ebf26a78aa937baba (diff) | |
download | pluralconnect-99c1d9af689e5325f3cf535c4007b3aeb8325229.tar.gz pluralconnect-99c1d9af689e5325f3cf535c4007b3aeb8325229.tar.bz2 pluralconnect-99c1d9af689e5325f3cf535c4007b3aeb8325229.zip |
Update - This is an automated commit
Diffstat (limited to 'alarm/node_modules/graphql/validation/rules')
172 files changed, 0 insertions, 8975 deletions
diff --git a/alarm/node_modules/graphql/validation/rules/ExecutableDefinitions.d.ts b/alarm/node_modules/graphql/validation/rules/ExecutableDefinitions.d.ts deleted file mode 100644 index 94557ad..0000000 --- a/alarm/node_modules/graphql/validation/rules/ExecutableDefinitions.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * @deprecated and will be removed in v16 - * Please use either: - * import { ExecutableDefinitionsRule } from 'graphql' - * or - * import { ExecutableDefinitionsRule } from 'graphql/validation' - */ -export { ExecutableDefinitionsRule as ExecutableDefinitions } from './ExecutableDefinitionsRule'; diff --git a/alarm/node_modules/graphql/validation/rules/ExecutableDefinitions.js b/alarm/node_modules/graphql/validation/rules/ExecutableDefinitions.js deleted file mode 100644 index ed8c46b..0000000 --- a/alarm/node_modules/graphql/validation/rules/ExecutableDefinitions.js +++ /dev/null @@ -1,13 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -Object.defineProperty(exports, "ExecutableDefinitions", { - enumerable: true, - get: function get() { - return _ExecutableDefinitionsRule.ExecutableDefinitionsRule; - } -}); - -var _ExecutableDefinitionsRule = require("./ExecutableDefinitionsRule.js"); diff --git a/alarm/node_modules/graphql/validation/rules/ExecutableDefinitions.js.flow b/alarm/node_modules/graphql/validation/rules/ExecutableDefinitions.js.flow deleted file mode 100644 index aac4efb..0000000 --- a/alarm/node_modules/graphql/validation/rules/ExecutableDefinitions.js.flow +++ /dev/null @@ -1,9 +0,0 @@ -// @flow strict -/** - * @deprecated and will be removed in v16 - * Please use either: - * import { ExecutableDefinitionsRule } from 'graphql' - * or - * import { ExecutableDefinitionsRule } from 'graphql/validation' - */ -export { ExecutableDefinitionsRule as ExecutableDefinitions } from './ExecutableDefinitionsRule'; diff --git a/alarm/node_modules/graphql/validation/rules/ExecutableDefinitions.mjs b/alarm/node_modules/graphql/validation/rules/ExecutableDefinitions.mjs deleted file mode 100644 index 9dc914e..0000000 --- a/alarm/node_modules/graphql/validation/rules/ExecutableDefinitions.mjs +++ /dev/null @@ -1,8 +0,0 @@ -/** - * @deprecated and will be removed in v16 - * Please use either: - * import { ExecutableDefinitionsRule } from 'graphql' - * or - * import { ExecutableDefinitionsRule } from 'graphql/validation' - */ -export { ExecutableDefinitionsRule as ExecutableDefinitions } from "./ExecutableDefinitionsRule.mjs"; diff --git a/alarm/node_modules/graphql/validation/rules/ExecutableDefinitionsRule.d.ts b/alarm/node_modules/graphql/validation/rules/ExecutableDefinitionsRule.d.ts deleted file mode 100644 index 9709256..0000000 --- a/alarm/node_modules/graphql/validation/rules/ExecutableDefinitionsRule.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { ASTVisitor } from '../../language/visitor'; -import { ASTValidationContext } from '../ValidationContext'; - -/** - * Executable definitions - * - * A GraphQL document is only valid for execution if all definitions are either - * operation or fragment definitions. - */ -export function ExecutableDefinitionsRule( - context: ASTValidationContext, -): ASTVisitor; diff --git a/alarm/node_modules/graphql/validation/rules/ExecutableDefinitionsRule.js b/alarm/node_modules/graphql/validation/rules/ExecutableDefinitionsRule.js deleted file mode 100644 index 0c070a8..0000000 --- a/alarm/node_modules/graphql/validation/rules/ExecutableDefinitionsRule.js +++ /dev/null @@ -1,35 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.ExecutableDefinitionsRule = ExecutableDefinitionsRule; - -var _GraphQLError = require("../../error/GraphQLError.js"); - -var _kinds = require("../../language/kinds.js"); - -var _predicates = require("../../language/predicates.js"); - -/** - * Executable definitions - * - * A GraphQL document is only valid for execution if all definitions are either - * operation or fragment definitions. - */ -function ExecutableDefinitionsRule(context) { - return { - Document: function Document(node) { - for (var _i2 = 0, _node$definitions2 = node.definitions; _i2 < _node$definitions2.length; _i2++) { - var definition = _node$definitions2[_i2]; - - if (!(0, _predicates.isExecutableDefinitionNode)(definition)) { - var defName = definition.kind === _kinds.Kind.SCHEMA_DEFINITION || definition.kind === _kinds.Kind.SCHEMA_EXTENSION ? 'schema' : '"' + definition.name.value + '"'; - context.reportError(new _GraphQLError.GraphQLError("The ".concat(defName, " definition is not executable."), definition)); - } - } - - return false; - } - }; -} diff --git a/alarm/node_modules/graphql/validation/rules/ExecutableDefinitionsRule.js.flow b/alarm/node_modules/graphql/validation/rules/ExecutableDefinitionsRule.js.flow deleted file mode 100644 index 06c0d52..0000000 --- a/alarm/node_modules/graphql/validation/rules/ExecutableDefinitionsRule.js.flow +++ /dev/null @@ -1,39 +0,0 @@ -// @flow strict -import { GraphQLError } from '../../error/GraphQLError'; - -import type { ASTVisitor } from '../../language/visitor'; -import { Kind } from '../../language/kinds'; -import { isExecutableDefinitionNode } from '../../language/predicates'; - -import type { ASTValidationContext } from '../ValidationContext'; - -/** - * Executable definitions - * - * A GraphQL document is only valid for execution if all definitions are either - * operation or fragment definitions. - */ -export function ExecutableDefinitionsRule( - context: ASTValidationContext, -): ASTVisitor { - return { - Document(node) { - for (const definition of node.definitions) { - if (!isExecutableDefinitionNode(definition)) { - const defName = - definition.kind === Kind.SCHEMA_DEFINITION || - definition.kind === Kind.SCHEMA_EXTENSION - ? 'schema' - : '"' + definition.name.value + '"'; - context.reportError( - new GraphQLError( - `The ${defName} definition is not executable.`, - definition, - ), - ); - } - } - return false; - }, - }; -} diff --git a/alarm/node_modules/graphql/validation/rules/ExecutableDefinitionsRule.mjs b/alarm/node_modules/graphql/validation/rules/ExecutableDefinitionsRule.mjs deleted file mode 100644 index c47b996..0000000 --- a/alarm/node_modules/graphql/validation/rules/ExecutableDefinitionsRule.mjs +++ /dev/null @@ -1,26 +0,0 @@ -import { GraphQLError } from "../../error/GraphQLError.mjs"; -import { Kind } from "../../language/kinds.mjs"; -import { isExecutableDefinitionNode } from "../../language/predicates.mjs"; - -/** - * Executable definitions - * - * A GraphQL document is only valid for execution if all definitions are either - * operation or fragment definitions. - */ -export function ExecutableDefinitionsRule(context) { - return { - Document: function Document(node) { - for (var _i2 = 0, _node$definitions2 = node.definitions; _i2 < _node$definitions2.length; _i2++) { - var definition = _node$definitions2[_i2]; - - if (!isExecutableDefinitionNode(definition)) { - var defName = definition.kind === Kind.SCHEMA_DEFINITION || definition.kind === Kind.SCHEMA_EXTENSION ? 'schema' : '"' + definition.name.value + '"'; - context.reportError(new GraphQLError("The ".concat(defName, " definition is not executable."), definition)); - } - } - - return false; - } - }; -} diff --git a/alarm/node_modules/graphql/validation/rules/FieldsOnCorrectTypeRule.d.ts b/alarm/node_modules/graphql/validation/rules/FieldsOnCorrectTypeRule.d.ts deleted file mode 100644 index 6091c6c..0000000 --- a/alarm/node_modules/graphql/validation/rules/FieldsOnCorrectTypeRule.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { ASTVisitor } from '../../language/visitor'; -import { ValidationContext } from '../ValidationContext'; - -/** - * Fields on correct type - * - * A GraphQL document is only valid if all fields selected are defined by the - * parent type, or are an allowed meta field such as __typename. - */ -export function FieldsOnCorrectTypeRule(context: ValidationContext): ASTVisitor; diff --git a/alarm/node_modules/graphql/validation/rules/FieldsOnCorrectTypeRule.js b/alarm/node_modules/graphql/validation/rules/FieldsOnCorrectTypeRule.js deleted file mode 100644 index ddd25a0..0000000 --- a/alarm/node_modules/graphql/validation/rules/FieldsOnCorrectTypeRule.js +++ /dev/null @@ -1,132 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.FieldsOnCorrectTypeRule = FieldsOnCorrectTypeRule; - -var _arrayFrom = _interopRequireDefault(require("../../polyfills/arrayFrom.js")); - -var _didYouMean = _interopRequireDefault(require("../../jsutils/didYouMean.js")); - -var _suggestionList = _interopRequireDefault(require("../../jsutils/suggestionList.js")); - -var _naturalCompare = _interopRequireDefault(require("../../jsutils/naturalCompare.js")); - -var _GraphQLError = require("../../error/GraphQLError.js"); - -var _definition = require("../../type/definition.js"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Fields on correct type - * - * A GraphQL document is only valid if all fields selected are defined by the - * parent type, or are an allowed meta field such as __typename. - */ -function FieldsOnCorrectTypeRule(context) { - return { - Field: function Field(node) { - var type = context.getParentType(); - - if (type) { - var fieldDef = context.getFieldDef(); - - if (!fieldDef) { - // This field doesn't exist, lets look for suggestions. - var schema = context.getSchema(); - var fieldName = node.name.value; // First determine if there are any suggested types to condition on. - - var suggestion = (0, _didYouMean.default)('to use an inline fragment on', getSuggestedTypeNames(schema, type, fieldName)); // If there are no suggested types, then perhaps this was a typo? - - if (suggestion === '') { - suggestion = (0, _didYouMean.default)(getSuggestedFieldNames(type, fieldName)); - } // Report an error, including helpful suggestions. - - - context.reportError(new _GraphQLError.GraphQLError("Cannot query field \"".concat(fieldName, "\" on type \"").concat(type.name, "\".") + suggestion, node)); - } - } - } - }; -} -/** - * Go through all of the implementations of type, as well as the interfaces that - * they implement. If any of those types include the provided field, suggest them, - * sorted by how often the type is referenced. - */ - - -function getSuggestedTypeNames(schema, type, fieldName) { - if (!(0, _definition.isAbstractType)(type)) { - // Must be an Object type, which does not have possible fields. - return []; - } - - var suggestedTypes = new Set(); - var usageCount = Object.create(null); - - for (var _i2 = 0, _schema$getPossibleTy2 = schema.getPossibleTypes(type); _i2 < _schema$getPossibleTy2.length; _i2++) { - var possibleType = _schema$getPossibleTy2[_i2]; - - if (!possibleType.getFields()[fieldName]) { - continue; - } // This object type defines this field. - - - suggestedTypes.add(possibleType); - usageCount[possibleType.name] = 1; - - for (var _i4 = 0, _possibleType$getInte2 = possibleType.getInterfaces(); _i4 < _possibleType$getInte2.length; _i4++) { - var _usageCount$possibleI; - - var possibleInterface = _possibleType$getInte2[_i4]; - - if (!possibleInterface.getFields()[fieldName]) { - continue; - } // This interface type defines this field. - - - suggestedTypes.add(possibleInterface); - usageCount[possibleInterface.name] = ((_usageCount$possibleI = usageCount[possibleInterface.name]) !== null && _usageCount$possibleI !== void 0 ? _usageCount$possibleI : 0) + 1; - } - } - - return (0, _arrayFrom.default)(suggestedTypes).sort(function (typeA, typeB) { - // Suggest both interface and object types based on how common they are. - var usageCountDiff = usageCount[typeB.name] - usageCount[typeA.name]; - - if (usageCountDiff !== 0) { - return usageCountDiff; - } // Suggest super types first followed by subtypes - - - if ((0, _definition.isInterfaceType)(typeA) && schema.isSubType(typeA, typeB)) { - return -1; - } - - if ((0, _definition.isInterfaceType)(typeB) && schema.isSubType(typeB, typeA)) { - return 1; - } - - return (0, _naturalCompare.default)(typeA.name, typeB.name); - }).map(function (x) { - return x.name; - }); -} -/** - * For the field name provided, determine if there are any similar field names - * that may be the result of a typo. - */ - - -function getSuggestedFieldNames(type, fieldName) { - if ((0, _definition.isObjectType)(type) || (0, _definition.isInterfaceType)(type)) { - var possibleFieldNames = Object.keys(type.getFields()); - return (0, _suggestionList.default)(fieldName, possibleFieldNames); - } // Otherwise, must be a Union type, which does not define fields. - - - return []; -} diff --git a/alarm/node_modules/graphql/validation/rules/FieldsOnCorrectTypeRule.js.flow b/alarm/node_modules/graphql/validation/rules/FieldsOnCorrectTypeRule.js.flow deleted file mode 100644 index 2170606..0000000 --- a/alarm/node_modules/graphql/validation/rules/FieldsOnCorrectTypeRule.js.flow +++ /dev/null @@ -1,146 +0,0 @@ -// @flow strict -import arrayFrom from '../../polyfills/arrayFrom'; - -import didYouMean from '../../jsutils/didYouMean'; -import suggestionList from '../../jsutils/suggestionList'; -import naturalCompare from '../../jsutils/naturalCompare'; - -import { GraphQLError } from '../../error/GraphQLError'; - -import type { FieldNode } from '../../language/ast'; -import type { ASTVisitor } from '../../language/visitor'; - -import type { GraphQLSchema } from '../../type/schema'; -import type { - GraphQLOutputType, - GraphQLObjectType, - GraphQLInterfaceType, -} from '../../type/definition'; -import { - isObjectType, - isInterfaceType, - isAbstractType, -} from '../../type/definition'; - -import type { ValidationContext } from '../ValidationContext'; - -/** - * Fields on correct type - * - * A GraphQL document is only valid if all fields selected are defined by the - * parent type, or are an allowed meta field such as __typename. - */ -export function FieldsOnCorrectTypeRule( - context: ValidationContext, -): ASTVisitor { - return { - Field(node: FieldNode) { - const type = context.getParentType(); - if (type) { - const fieldDef = context.getFieldDef(); - if (!fieldDef) { - // This field doesn't exist, lets look for suggestions. - const schema = context.getSchema(); - const fieldName = node.name.value; - - // First determine if there are any suggested types to condition on. - let suggestion = didYouMean( - 'to use an inline fragment on', - getSuggestedTypeNames(schema, type, fieldName), - ); - - // If there are no suggested types, then perhaps this was a typo? - if (suggestion === '') { - suggestion = didYouMean(getSuggestedFieldNames(type, fieldName)); - } - - // Report an error, including helpful suggestions. - context.reportError( - new GraphQLError( - `Cannot query field "${fieldName}" on type "${type.name}".` + - suggestion, - node, - ), - ); - } - } - }, - }; -} - -/** - * Go through all of the implementations of type, as well as the interfaces that - * they implement. If any of those types include the provided field, suggest them, - * sorted by how often the type is referenced. - */ -function getSuggestedTypeNames( - schema: GraphQLSchema, - type: GraphQLOutputType, - fieldName: string, -): Array<string> { - if (!isAbstractType(type)) { - // Must be an Object type, which does not have possible fields. - return []; - } - - const suggestedTypes: Set< - GraphQLObjectType | GraphQLInterfaceType, - > = new Set(); - const usageCount = Object.create(null); - for (const possibleType of schema.getPossibleTypes(type)) { - if (!possibleType.getFields()[fieldName]) { - continue; - } - - // This object type defines this field. - suggestedTypes.add(possibleType); - usageCount[possibleType.name] = 1; - - for (const possibleInterface of possibleType.getInterfaces()) { - if (!possibleInterface.getFields()[fieldName]) { - continue; - } - - // This interface type defines this field. - suggestedTypes.add(possibleInterface); - usageCount[possibleInterface.name] = - (usageCount[possibleInterface.name] ?? 0) + 1; - } - } - - return arrayFrom(suggestedTypes) - .sort((typeA, typeB) => { - // Suggest both interface and object types based on how common they are. - const usageCountDiff = usageCount[typeB.name] - usageCount[typeA.name]; - if (usageCountDiff !== 0) { - return usageCountDiff; - } - - // Suggest super types first followed by subtypes - if (isInterfaceType(typeA) && schema.isSubType(typeA, typeB)) { - return -1; - } - if (isInterfaceType(typeB) && schema.isSubType(typeB, typeA)) { - return 1; - } - - return naturalCompare(typeA.name, typeB.name); - }) - .map((x) => x.name); -} - -/** - * For the field name provided, determine if there are any similar field names - * that may be the result of a typo. - */ -function getSuggestedFieldNames( - type: GraphQLOutputType, - fieldName: string, -): Array<string> { - if (isObjectType(type) || isInterfaceType(type)) { - const possibleFieldNames = Object.keys(type.getFields()); - return suggestionList(fieldName, possibleFieldNames); - } - // Otherwise, must be a Union type, which does not define fields. - return []; -} diff --git a/alarm/node_modules/graphql/validation/rules/FieldsOnCorrectTypeRule.mjs b/alarm/node_modules/graphql/validation/rules/FieldsOnCorrectTypeRule.mjs deleted file mode 100644 index f10b21d..0000000 --- a/alarm/node_modules/graphql/validation/rules/FieldsOnCorrectTypeRule.mjs +++ /dev/null @@ -1,117 +0,0 @@ -import arrayFrom from "../../polyfills/arrayFrom.mjs"; -import didYouMean from "../../jsutils/didYouMean.mjs"; -import suggestionList from "../../jsutils/suggestionList.mjs"; -import naturalCompare from "../../jsutils/naturalCompare.mjs"; -import { GraphQLError } from "../../error/GraphQLError.mjs"; -import { isObjectType, isInterfaceType, isAbstractType } from "../../type/definition.mjs"; - -/** - * Fields on correct type - * - * A GraphQL document is only valid if all fields selected are defined by the - * parent type, or are an allowed meta field such as __typename. - */ -export function FieldsOnCorrectTypeRule(context) { - return { - Field: function Field(node) { - var type = context.getParentType(); - - if (type) { - var fieldDef = context.getFieldDef(); - - if (!fieldDef) { - // This field doesn't exist, lets look for suggestions. - var schema = context.getSchema(); - var fieldName = node.name.value; // First determine if there are any suggested types to condition on. - - var suggestion = didYouMean('to use an inline fragment on', getSuggestedTypeNames(schema, type, fieldName)); // If there are no suggested types, then perhaps this was a typo? - - if (suggestion === '') { - suggestion = didYouMean(getSuggestedFieldNames(type, fieldName)); - } // Report an error, including helpful suggestions. - - - context.reportError(new GraphQLError("Cannot query field \"".concat(fieldName, "\" on type \"").concat(type.name, "\".") + suggestion, node)); - } - } - } - }; -} -/** - * Go through all of the implementations of type, as well as the interfaces that - * they implement. If any of those types include the provided field, suggest them, - * sorted by how often the type is referenced. - */ - -function getSuggestedTypeNames(schema, type, fieldName) { - if (!isAbstractType(type)) { - // Must be an Object type, which does not have possible fields. - return []; - } - - var suggestedTypes = new Set(); - var usageCount = Object.create(null); - - for (var _i2 = 0, _schema$getPossibleTy2 = schema.getPossibleTypes(type); _i2 < _schema$getPossibleTy2.length; _i2++) { - var possibleType = _schema$getPossibleTy2[_i2]; - - if (!possibleType.getFields()[fieldName]) { - continue; - } // This object type defines this field. - - - suggestedTypes.add(possibleType); - usageCount[possibleType.name] = 1; - - for (var _i4 = 0, _possibleType$getInte2 = possibleType.getInterfaces(); _i4 < _possibleType$getInte2.length; _i4++) { - var _usageCount$possibleI; - - var possibleInterface = _possibleType$getInte2[_i4]; - - if (!possibleInterface.getFields()[fieldName]) { - continue; - } // This interface type defines this field. - - - suggestedTypes.add(possibleInterface); - usageCount[possibleInterface.name] = ((_usageCount$possibleI = usageCount[possibleInterface.name]) !== null && _usageCount$possibleI !== void 0 ? _usageCount$possibleI : 0) + 1; - } - } - - return arrayFrom(suggestedTypes).sort(function (typeA, typeB) { - // Suggest both interface and object types based on how common they are. - var usageCountDiff = usageCount[typeB.name] - usageCount[typeA.name]; - - if (usageCountDiff !== 0) { - return usageCountDiff; - } // Suggest super types first followed by subtypes - - - if (isInterfaceType(typeA) && schema.isSubType(typeA, typeB)) { - return -1; - } - - if (isInterfaceType(typeB) && schema.isSubType(typeB, typeA)) { - return 1; - } - - return naturalCompare(typeA.name, typeB.name); - }).map(function (x) { - return x.name; - }); -} -/** - * For the field name provided, determine if there are any similar field names - * that may be the result of a typo. - */ - - -function getSuggestedFieldNames(type, fieldName) { - if (isObjectType(type) || isInterfaceType(type)) { - var possibleFieldNames = Object.keys(type.getFields()); - return suggestionList(fieldName, possibleFieldNames); - } // Otherwise, must be a Union type, which does not define fields. - - - return []; -} diff --git a/alarm/node_modules/graphql/validation/rules/FragmentsOnCompositeTypesRule.d.ts b/alarm/node_modules/graphql/validation/rules/FragmentsOnCompositeTypesRule.d.ts deleted file mode 100644 index 70b9b14..0000000 --- a/alarm/node_modules/graphql/validation/rules/FragmentsOnCompositeTypesRule.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { ASTVisitor } from '../../language/visitor'; -import { ValidationContext } from '../ValidationContext'; - -/** - * Fragments on composite type - * - * Fragments use a type condition to determine if they apply, since fragments - * can only be spread into a composite type (object, interface, or union), the - * type condition must also be a composite type. - */ -export function FragmentsOnCompositeTypesRule( - context: ValidationContext, -): ASTVisitor; diff --git a/alarm/node_modules/graphql/validation/rules/FragmentsOnCompositeTypesRule.js b/alarm/node_modules/graphql/validation/rules/FragmentsOnCompositeTypesRule.js deleted file mode 100644 index 423ffcc..0000000 --- a/alarm/node_modules/graphql/validation/rules/FragmentsOnCompositeTypesRule.js +++ /dev/null @@ -1,46 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.FragmentsOnCompositeTypesRule = FragmentsOnCompositeTypesRule; - -var _GraphQLError = require("../../error/GraphQLError.js"); - -var _printer = require("../../language/printer.js"); - -var _definition = require("../../type/definition.js"); - -var _typeFromAST = require("../../utilities/typeFromAST.js"); - -/** - * Fragments on composite type - * - * Fragments use a type condition to determine if they apply, since fragments - * can only be spread into a composite type (object, interface, or union), the - * type condition must also be a composite type. - */ -function FragmentsOnCompositeTypesRule(context) { - return { - InlineFragment: function InlineFragment(node) { - var typeCondition = node.typeCondition; - - if (typeCondition) { - var type = (0, _typeFromAST.typeFromAST)(context.getSchema(), typeCondition); - - if (type && !(0, _definition.isCompositeType)(type)) { - var typeStr = (0, _printer.print)(typeCondition); - context.reportError(new _GraphQLError.GraphQLError("Fragment cannot condition on non composite type \"".concat(typeStr, "\"."), typeCondition)); - } - } - }, - FragmentDefinition: function FragmentDefinition(node) { - var type = (0, _typeFromAST.typeFromAST)(context.getSchema(), node.typeCondition); - - if (type && !(0, _definition.isCompositeType)(type)) { - var typeStr = (0, _printer.print)(node.typeCondition); - context.reportError(new _GraphQLError.GraphQLError("Fragment \"".concat(node.name.value, "\" cannot condition on non composite type \"").concat(typeStr, "\"."), node.typeCondition)); - } - } - }; -} diff --git a/alarm/node_modules/graphql/validation/rules/FragmentsOnCompositeTypesRule.js.flow b/alarm/node_modules/graphql/validation/rules/FragmentsOnCompositeTypesRule.js.flow deleted file mode 100644 index 53ed6b9..0000000 --- a/alarm/node_modules/graphql/validation/rules/FragmentsOnCompositeTypesRule.js.flow +++ /dev/null @@ -1,52 +0,0 @@ -// @flow strict -import { GraphQLError } from '../../error/GraphQLError'; - -import type { ASTVisitor } from '../../language/visitor'; -import { print } from '../../language/printer'; - -import { isCompositeType } from '../../type/definition'; - -import { typeFromAST } from '../../utilities/typeFromAST'; - -import type { ValidationContext } from '../ValidationContext'; - -/** - * Fragments on composite type - * - * Fragments use a type condition to determine if they apply, since fragments - * can only be spread into a composite type (object, interface, or union), the - * type condition must also be a composite type. - */ -export function FragmentsOnCompositeTypesRule( - context: ValidationContext, -): ASTVisitor { - return { - InlineFragment(node) { - const typeCondition = node.typeCondition; - if (typeCondition) { - const type = typeFromAST(context.getSchema(), typeCondition); - if (type && !isCompositeType(type)) { - const typeStr = print(typeCondition); - context.reportError( - new GraphQLError( - `Fragment cannot condition on non composite type "${typeStr}".`, - typeCondition, - ), - ); - } - } - }, - FragmentDefinition(node) { - const type = typeFromAST(context.getSchema(), node.typeCondition); - if (type && !isCompositeType(type)) { - const typeStr = print(node.typeCondition); - context.reportError( - new GraphQLError( - `Fragment "${node.name.value}" cannot condition on non composite type "${typeStr}".`, - node.typeCondition, - ), - ); - } - }, - }; -} diff --git a/alarm/node_modules/graphql/validation/rules/FragmentsOnCompositeTypesRule.mjs b/alarm/node_modules/graphql/validation/rules/FragmentsOnCompositeTypesRule.mjs deleted file mode 100644 index 44aaac6..0000000 --- a/alarm/node_modules/graphql/validation/rules/FragmentsOnCompositeTypesRule.mjs +++ /dev/null @@ -1,36 +0,0 @@ -import { GraphQLError } from "../../error/GraphQLError.mjs"; -import { print } from "../../language/printer.mjs"; -import { isCompositeType } from "../../type/definition.mjs"; -import { typeFromAST } from "../../utilities/typeFromAST.mjs"; - -/** - * Fragments on composite type - * - * Fragments use a type condition to determine if they apply, since fragments - * can only be spread into a composite type (object, interface, or union), the - * type condition must also be a composite type. - */ -export function FragmentsOnCompositeTypesRule(context) { - return { - InlineFragment: function InlineFragment(node) { - var typeCondition = node.typeCondition; - - if (typeCondition) { - var type = typeFromAST(context.getSchema(), typeCondition); - - if (type && !isCompositeType(type)) { - var typeStr = print(typeCondition); - context.reportError(new GraphQLError("Fragment cannot condition on non composite type \"".concat(typeStr, "\"."), typeCondition)); - } - } - }, - FragmentDefinition: function FragmentDefinition(node) { - var type = typeFromAST(context.getSchema(), node.typeCondition); - - if (type && !isCompositeType(type)) { - var typeStr = print(node.typeCondition); - context.reportError(new GraphQLError("Fragment \"".concat(node.name.value, "\" cannot condition on non composite type \"").concat(typeStr, "\"."), node.typeCondition)); - } - } - }; -} diff --git a/alarm/node_modules/graphql/validation/rules/KnownArgumentNamesRule.d.ts b/alarm/node_modules/graphql/validation/rules/KnownArgumentNamesRule.d.ts deleted file mode 100644 index 8c0f828..0000000 --- a/alarm/node_modules/graphql/validation/rules/KnownArgumentNamesRule.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { ValidationContext, SDLValidationContext } from '../ValidationContext'; -import { ASTVisitor } from '../../language/visitor'; - -/** - * Known argument names - * - * A GraphQL field is only valid if all supplied arguments are defined by - * that field. - */ -export function KnownArgumentNamesRule(context: ValidationContext): ASTVisitor; - -/** - * @internal - */ -export function KnownArgumentNamesOnDirectivesRule( - context: ValidationContext | SDLValidationContext, -): ASTVisitor; diff --git a/alarm/node_modules/graphql/validation/rules/KnownArgumentNamesRule.js b/alarm/node_modules/graphql/validation/rules/KnownArgumentNamesRule.js deleted file mode 100644 index 4742b84..0000000 --- a/alarm/node_modules/graphql/validation/rules/KnownArgumentNamesRule.js +++ /dev/null @@ -1,104 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.KnownArgumentNamesRule = KnownArgumentNamesRule; -exports.KnownArgumentNamesOnDirectivesRule = KnownArgumentNamesOnDirectivesRule; - -var _didYouMean = _interopRequireDefault(require("../../jsutils/didYouMean.js")); - -var _suggestionList = _interopRequireDefault(require("../../jsutils/suggestionList.js")); - -var _GraphQLError = require("../../error/GraphQLError.js"); - -var _kinds = require("../../language/kinds.js"); - -var _directives = require("../../type/directives.js"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - -/** - * Known argument names - * - * A GraphQL field is only valid if all supplied arguments are defined by - * that field. - */ -function KnownArgumentNamesRule(context) { - return _objectSpread(_objectSpread({}, KnownArgumentNamesOnDirectivesRule(context)), {}, { - Argument: function Argument(argNode) { - var argDef = context.getArgument(); - var fieldDef = context.getFieldDef(); - var parentType = context.getParentType(); - - if (!argDef && fieldDef && parentType) { - var argName = argNode.name.value; - var knownArgsNames = fieldDef.args.map(function (arg) { - return arg.name; - }); - var suggestions = (0, _suggestionList.default)(argName, knownArgsNames); - context.reportError(new _GraphQLError.GraphQLError("Unknown argument \"".concat(argName, "\" on field \"").concat(parentType.name, ".").concat(fieldDef.name, "\".") + (0, _didYouMean.default)(suggestions), argNode)); - } - } - }); -} -/** - * @internal - */ - - -function KnownArgumentNamesOnDirectivesRule(context) { - var directiveArgs = Object.create(null); - var schema = context.getSchema(); - var definedDirectives = schema ? schema.getDirectives() : _directives.specifiedDirectives; - - for (var _i2 = 0; _i2 < definedDirectives.length; _i2++) { - var directive = definedDirectives[_i2]; - directiveArgs[directive.name] = directive.args.map(function (arg) { - return arg.name; - }); - } - - var astDefinitions = context.getDocument().definitions; - - for (var _i4 = 0; _i4 < astDefinitions.length; _i4++) { - var def = astDefinitions[_i4]; - - if (def.kind === _kinds.Kind.DIRECTIVE_DEFINITION) { - var _def$arguments; - - // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - var argsNodes = (_def$arguments = def.arguments) !== null && _def$arguments !== void 0 ? _def$arguments : []; - directiveArgs[def.name.value] = argsNodes.map(function (arg) { - return arg.name.value; - }); - } - } - - return { - Directive: function Directive(directiveNode) { - var directiveName = directiveNode.name.value; - var knownArgs = directiveArgs[directiveName]; - - if (directiveNode.arguments && knownArgs) { - for (var _i6 = 0, _directiveNode$argume2 = directiveNode.arguments; _i6 < _directiveNode$argume2.length; _i6++) { - var argNode = _directiveNode$argume2[_i6]; - var argName = argNode.name.value; - - if (knownArgs.indexOf(argName) === -1) { - var suggestions = (0, _suggestionList.default)(argName, knownArgs); - context.reportError(new _GraphQLError.GraphQLError("Unknown argument \"".concat(argName, "\" on directive \"@").concat(directiveName, "\".") + (0, _didYouMean.default)(suggestions), argNode)); - } - } - } - - return false; - } - }; -} diff --git a/alarm/node_modules/graphql/validation/rules/KnownArgumentNamesRule.js.flow b/alarm/node_modules/graphql/validation/rules/KnownArgumentNamesRule.js.flow deleted file mode 100644 index a5f420b..0000000 --- a/alarm/node_modules/graphql/validation/rules/KnownArgumentNamesRule.js.flow +++ /dev/null @@ -1,98 +0,0 @@ -// @flow strict -import didYouMean from '../../jsutils/didYouMean'; -import suggestionList from '../../jsutils/suggestionList'; - -import { GraphQLError } from '../../error/GraphQLError'; - -import type { ASTVisitor } from '../../language/visitor'; -import { Kind } from '../../language/kinds'; - -import { specifiedDirectives } from '../../type/directives'; - -import type { - ValidationContext, - SDLValidationContext, -} from '../ValidationContext'; - -/** - * Known argument names - * - * A GraphQL field is only valid if all supplied arguments are defined by - * that field. - */ -export function KnownArgumentNamesRule(context: ValidationContext): ASTVisitor { - return { - // eslint-disable-next-line new-cap - ...KnownArgumentNamesOnDirectivesRule(context), - Argument(argNode) { - const argDef = context.getArgument(); - const fieldDef = context.getFieldDef(); - const parentType = context.getParentType(); - - if (!argDef && fieldDef && parentType) { - const argName = argNode.name.value; - const knownArgsNames = fieldDef.args.map((arg) => arg.name); - const suggestions = suggestionList(argName, knownArgsNames); - context.reportError( - new GraphQLError( - `Unknown argument "${argName}" on field "${parentType.name}.${fieldDef.name}".` + - didYouMean(suggestions), - argNode, - ), - ); - } - }, - }; -} - -/** - * @internal - */ -export function KnownArgumentNamesOnDirectivesRule( - context: ValidationContext | SDLValidationContext, -): ASTVisitor { - const directiveArgs = Object.create(null); - - const schema = context.getSchema(); - const definedDirectives = schema - ? schema.getDirectives() - : specifiedDirectives; - for (const directive of definedDirectives) { - directiveArgs[directive.name] = directive.args.map((arg) => arg.name); - } - - const astDefinitions = context.getDocument().definitions; - for (const def of astDefinitions) { - if (def.kind === Kind.DIRECTIVE_DEFINITION) { - // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - const argsNodes = def.arguments ?? []; - - directiveArgs[def.name.value] = argsNodes.map((arg) => arg.name.value); - } - } - - return { - Directive(directiveNode) { - const directiveName = directiveNode.name.value; - const knownArgs = directiveArgs[directiveName]; - - if (directiveNode.arguments && knownArgs) { - for (const argNode of directiveNode.arguments) { - const argName = argNode.name.value; - if (knownArgs.indexOf(argName) === -1) { - const suggestions = suggestionList(argName, knownArgs); - context.reportError( - new GraphQLError( - `Unknown argument "${argName}" on directive "@${directiveName}".` + - didYouMean(suggestions), - argNode, - ), - ); - } - } - } - - return false; - }, - }; -} diff --git a/alarm/node_modules/graphql/validation/rules/KnownArgumentNamesRule.mjs b/alarm/node_modules/graphql/validation/rules/KnownArgumentNamesRule.mjs deleted file mode 100644 index d21057e..0000000 --- a/alarm/node_modules/graphql/validation/rules/KnownArgumentNamesRule.mjs +++ /dev/null @@ -1,89 +0,0 @@ -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - -import didYouMean from "../../jsutils/didYouMean.mjs"; -import suggestionList from "../../jsutils/suggestionList.mjs"; -import { GraphQLError } from "../../error/GraphQLError.mjs"; -import { Kind } from "../../language/kinds.mjs"; -import { specifiedDirectives } from "../../type/directives.mjs"; - -/** - * Known argument names - * - * A GraphQL field is only valid if all supplied arguments are defined by - * that field. - */ -export function KnownArgumentNamesRule(context) { - return _objectSpread(_objectSpread({}, KnownArgumentNamesOnDirectivesRule(context)), {}, { - Argument: function Argument(argNode) { - var argDef = context.getArgument(); - var fieldDef = context.getFieldDef(); - var parentType = context.getParentType(); - - if (!argDef && fieldDef && parentType) { - var argName = argNode.name.value; - var knownArgsNames = fieldDef.args.map(function (arg) { - return arg.name; - }); - var suggestions = suggestionList(argName, knownArgsNames); - context.reportError(new GraphQLError("Unknown argument \"".concat(argName, "\" on field \"").concat(parentType.name, ".").concat(fieldDef.name, "\".") + didYouMean(suggestions), argNode)); - } - } - }); -} -/** - * @internal - */ - -export function KnownArgumentNamesOnDirectivesRule(context) { - var directiveArgs = Object.create(null); - var schema = context.getSchema(); - var definedDirectives = schema ? schema.getDirectives() : specifiedDirectives; - - for (var _i2 = 0; _i2 < definedDirectives.length; _i2++) { - var directive = definedDirectives[_i2]; - directiveArgs[directive.name] = directive.args.map(function (arg) { - return arg.name; - }); - } - - var astDefinitions = context.getDocument().definitions; - - for (var _i4 = 0; _i4 < astDefinitions.length; _i4++) { - var def = astDefinitions[_i4]; - - if (def.kind === Kind.DIRECTIVE_DEFINITION) { - var _def$arguments; - - // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - var argsNodes = (_def$arguments = def.arguments) !== null && _def$arguments !== void 0 ? _def$arguments : []; - directiveArgs[def.name.value] = argsNodes.map(function (arg) { - return arg.name.value; - }); - } - } - - return { - Directive: function Directive(directiveNode) { - var directiveName = directiveNode.name.value; - var knownArgs = directiveArgs[directiveName]; - - if (directiveNode.arguments && knownArgs) { - for (var _i6 = 0, _directiveNode$argume2 = directiveNode.arguments; _i6 < _directiveNode$argume2.length; _i6++) { - var argNode = _directiveNode$argume2[_i6]; - var argName = argNode.name.value; - - if (knownArgs.indexOf(argName) === -1) { - var suggestions = suggestionList(argName, knownArgs); - context.reportError(new GraphQLError("Unknown argument \"".concat(argName, "\" on directive \"@").concat(directiveName, "\".") + didYouMean(suggestions), argNode)); - } - } - } - - return false; - } - }; -} diff --git a/alarm/node_modules/graphql/validation/rules/KnownDirectivesRule.d.ts b/alarm/node_modules/graphql/validation/rules/KnownDirectivesRule.d.ts deleted file mode 100644 index dcb6af6..0000000 --- a/alarm/node_modules/graphql/validation/rules/KnownDirectivesRule.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { ASTVisitor } from '../../language/visitor'; -import { ValidationContext, SDLValidationContext } from '../ValidationContext'; - -/** - * Known directives - * - * A GraphQL document is only valid if all `@directives` are known by the - * schema and legally positioned. - */ -export function KnownDirectivesRule( - context: ValidationContext | SDLValidationContext, -): ASTVisitor; diff --git a/alarm/node_modules/graphql/validation/rules/KnownDirectivesRule.js b/alarm/node_modules/graphql/validation/rules/KnownDirectivesRule.js deleted file mode 100644 index ef2ab61..0000000 --- a/alarm/node_modules/graphql/validation/rules/KnownDirectivesRule.js +++ /dev/null @@ -1,148 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.KnownDirectivesRule = KnownDirectivesRule; - -var _inspect = _interopRequireDefault(require("../../jsutils/inspect.js")); - -var _invariant = _interopRequireDefault(require("../../jsutils/invariant.js")); - -var _GraphQLError = require("../../error/GraphQLError.js"); - -var _kinds = require("../../language/kinds.js"); - -var _directiveLocation = require("../../language/directiveLocation.js"); - -var _directives = require("../../type/directives.js"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Known directives - * - * A GraphQL document is only valid if all `@directives` are known by the - * schema and legally positioned. - */ -function KnownDirectivesRule(context) { - var locationsMap = Object.create(null); - var schema = context.getSchema(); - var definedDirectives = schema ? schema.getDirectives() : _directives.specifiedDirectives; - - for (var _i2 = 0; _i2 < definedDirectives.length; _i2++) { - var directive = definedDirectives[_i2]; - locationsMap[directive.name] = directive.locations; - } - - var astDefinitions = context.getDocument().definitions; - - for (var _i4 = 0; _i4 < astDefinitions.length; _i4++) { - var def = astDefinitions[_i4]; - - if (def.kind === _kinds.Kind.DIRECTIVE_DEFINITION) { - locationsMap[def.name.value] = def.locations.map(function (name) { - return name.value; - }); - } - } - - return { - Directive: function Directive(node, _key, _parent, _path, ancestors) { - var name = node.name.value; - var locations = locationsMap[name]; - - if (!locations) { - context.reportError(new _GraphQLError.GraphQLError("Unknown directive \"@".concat(name, "\"."), node)); - return; - } - - var candidateLocation = getDirectiveLocationForASTPath(ancestors); - - if (candidateLocation && locations.indexOf(candidateLocation) === -1) { - context.reportError(new _GraphQLError.GraphQLError("Directive \"@".concat(name, "\" may not be used on ").concat(candidateLocation, "."), node)); - } - } - }; -} - -function getDirectiveLocationForASTPath(ancestors) { - var appliedTo = ancestors[ancestors.length - 1]; - !Array.isArray(appliedTo) || (0, _invariant.default)(0); - - switch (appliedTo.kind) { - case _kinds.Kind.OPERATION_DEFINITION: - return getDirectiveLocationForOperation(appliedTo.operation); - - case _kinds.Kind.FIELD: - return _directiveLocation.DirectiveLocation.FIELD; - - case _kinds.Kind.FRAGMENT_SPREAD: - return _directiveLocation.DirectiveLocation.FRAGMENT_SPREAD; - - case _kinds.Kind.INLINE_FRAGMENT: - return _directiveLocation.DirectiveLocation.INLINE_FRAGMENT; - - case _kinds.Kind.FRAGMENT_DEFINITION: - return _directiveLocation.DirectiveLocation.FRAGMENT_DEFINITION; - - case _kinds.Kind.VARIABLE_DEFINITION: - return _directiveLocation.DirectiveLocation.VARIABLE_DEFINITION; - - case _kinds.Kind.SCHEMA_DEFINITION: - case _kinds.Kind.SCHEMA_EXTENSION: - return _directiveLocation.DirectiveLocation.SCHEMA; - - case _kinds.Kind.SCALAR_TYPE_DEFINITION: - case _kinds.Kind.SCALAR_TYPE_EXTENSION: - return _directiveLocation.DirectiveLocation.SCALAR; - - case _kinds.Kind.OBJECT_TYPE_DEFINITION: - case _kinds.Kind.OBJECT_TYPE_EXTENSION: - return _directiveLocation.DirectiveLocation.OBJECT; - - case _kinds.Kind.FIELD_DEFINITION: - return _directiveLocation.DirectiveLocation.FIELD_DEFINITION; - - case _kinds.Kind.INTERFACE_TYPE_DEFINITION: - case _kinds.Kind.INTERFACE_TYPE_EXTENSION: - return _directiveLocation.DirectiveLocation.INTERFACE; - - case _kinds.Kind.UNION_TYPE_DEFINITION: - case _kinds.Kind.UNION_TYPE_EXTENSION: - return _directiveLocation.DirectiveLocation.UNION; - - case _kinds.Kind.ENUM_TYPE_DEFINITION: - case _kinds.Kind.ENUM_TYPE_EXTENSION: - return _directiveLocation.DirectiveLocation.ENUM; - - case _kinds.Kind.ENUM_VALUE_DEFINITION: - return _directiveLocation.DirectiveLocation.ENUM_VALUE; - - case _kinds.Kind.INPUT_OBJECT_TYPE_DEFINITION: - case _kinds.Kind.INPUT_OBJECT_TYPE_EXTENSION: - return _directiveLocation.DirectiveLocation.INPUT_OBJECT; - - case _kinds.Kind.INPUT_VALUE_DEFINITION: - { - var parentNode = ancestors[ancestors.length - 3]; - return parentNode.kind === _kinds.Kind.INPUT_OBJECT_TYPE_DEFINITION ? _directiveLocation.DirectiveLocation.INPUT_FIELD_DEFINITION : _directiveLocation.DirectiveLocation.ARGUMENT_DEFINITION; - } - } -} - -function getDirectiveLocationForOperation(operation) { - switch (operation) { - case 'query': - return _directiveLocation.DirectiveLocation.QUERY; - - case 'mutation': - return _directiveLocation.DirectiveLocation.MUTATION; - - case 'subscription': - return _directiveLocation.DirectiveLocation.SUBSCRIPTION; - } // istanbul ignore next (Not reachable. All possible types have been considered) - - - false || (0, _invariant.default)(0, 'Unexpected operation: ' + (0, _inspect.default)(operation)); -} diff --git a/alarm/node_modules/graphql/validation/rules/KnownDirectivesRule.js.flow b/alarm/node_modules/graphql/validation/rules/KnownDirectivesRule.js.flow deleted file mode 100644 index 79e047a..0000000 --- a/alarm/node_modules/graphql/validation/rules/KnownDirectivesRule.js.flow +++ /dev/null @@ -1,138 +0,0 @@ -// @flow strict -import inspect from '../../jsutils/inspect'; -import invariant from '../../jsutils/invariant'; - -import { GraphQLError } from '../../error/GraphQLError'; - -import type { ASTVisitor } from '../../language/visitor'; -import type { ASTNode, OperationTypeNode } from '../../language/ast'; -import type { DirectiveLocationEnum } from '../../language/directiveLocation'; -import { Kind } from '../../language/kinds'; -import { DirectiveLocation } from '../../language/directiveLocation'; - -import { specifiedDirectives } from '../../type/directives'; - -import type { - ValidationContext, - SDLValidationContext, -} from '../ValidationContext'; - -/** - * Known directives - * - * A GraphQL document is only valid if all `@directives` are known by the - * schema and legally positioned. - */ -export function KnownDirectivesRule( - context: ValidationContext | SDLValidationContext, -): ASTVisitor { - const locationsMap = Object.create(null); - - const schema = context.getSchema(); - const definedDirectives = schema - ? schema.getDirectives() - : specifiedDirectives; - for (const directive of definedDirectives) { - locationsMap[directive.name] = directive.locations; - } - - const astDefinitions = context.getDocument().definitions; - for (const def of astDefinitions) { - if (def.kind === Kind.DIRECTIVE_DEFINITION) { - locationsMap[def.name.value] = def.locations.map((name) => name.value); - } - } - - return { - Directive(node, _key, _parent, _path, ancestors) { - const name = node.name.value; - const locations = locationsMap[name]; - - if (!locations) { - context.reportError( - new GraphQLError(`Unknown directive "@${name}".`, node), - ); - return; - } - - const candidateLocation = getDirectiveLocationForASTPath(ancestors); - if (candidateLocation && locations.indexOf(candidateLocation) === -1) { - context.reportError( - new GraphQLError( - `Directive "@${name}" may not be used on ${candidateLocation}.`, - node, - ), - ); - } - }, - }; -} - -function getDirectiveLocationForASTPath( - ancestors: $ReadOnlyArray<ASTNode | $ReadOnlyArray<ASTNode>>, -): DirectiveLocationEnum | void { - const appliedTo = ancestors[ancestors.length - 1]; - invariant(!Array.isArray(appliedTo)); - - switch (appliedTo.kind) { - case Kind.OPERATION_DEFINITION: - return getDirectiveLocationForOperation(appliedTo.operation); - case Kind.FIELD: - return DirectiveLocation.FIELD; - case Kind.FRAGMENT_SPREAD: - return DirectiveLocation.FRAGMENT_SPREAD; - case Kind.INLINE_FRAGMENT: - return DirectiveLocation.INLINE_FRAGMENT; - case Kind.FRAGMENT_DEFINITION: - return DirectiveLocation.FRAGMENT_DEFINITION; - case Kind.VARIABLE_DEFINITION: - return DirectiveLocation.VARIABLE_DEFINITION; - case Kind.SCHEMA_DEFINITION: - case Kind.SCHEMA_EXTENSION: - return DirectiveLocation.SCHEMA; - case Kind.SCALAR_TYPE_DEFINITION: - case Kind.SCALAR_TYPE_EXTENSION: - return DirectiveLocation.SCALAR; - case Kind.OBJECT_TYPE_DEFINITION: - case Kind.OBJECT_TYPE_EXTENSION: - return DirectiveLocation.OBJECT; - case Kind.FIELD_DEFINITION: - return DirectiveLocation.FIELD_DEFINITION; - case Kind.INTERFACE_TYPE_DEFINITION: - case Kind.INTERFACE_TYPE_EXTENSION: - return DirectiveLocation.INTERFACE; - case Kind.UNION_TYPE_DEFINITION: - case Kind.UNION_TYPE_EXTENSION: - return DirectiveLocation.UNION; - case Kind.ENUM_TYPE_DEFINITION: - case Kind.ENUM_TYPE_EXTENSION: - return DirectiveLocation.ENUM; - case Kind.ENUM_VALUE_DEFINITION: - return DirectiveLocation.ENUM_VALUE; - case Kind.INPUT_OBJECT_TYPE_DEFINITION: - case Kind.INPUT_OBJECT_TYPE_EXTENSION: - return DirectiveLocation.INPUT_OBJECT; - case Kind.INPUT_VALUE_DEFINITION: { - const parentNode = ancestors[ancestors.length - 3]; - return parentNode.kind === Kind.INPUT_OBJECT_TYPE_DEFINITION - ? DirectiveLocation.INPUT_FIELD_DEFINITION - : DirectiveLocation.ARGUMENT_DEFINITION; - } - } -} - -function getDirectiveLocationForOperation( - operation: OperationTypeNode, -): DirectiveLocationEnum { - switch (operation) { - case 'query': - return DirectiveLocation.QUERY; - case 'mutation': - return DirectiveLocation.MUTATION; - case 'subscription': - return DirectiveLocation.SUBSCRIPTION; - } - - // istanbul ignore next (Not reachable. All possible types have been considered) - invariant(false, 'Unexpected operation: ' + inspect((operation: empty))); -} diff --git a/alarm/node_modules/graphql/validation/rules/KnownDirectivesRule.mjs b/alarm/node_modules/graphql/validation/rules/KnownDirectivesRule.mjs deleted file mode 100644 index 8889bbb..0000000 --- a/alarm/node_modules/graphql/validation/rules/KnownDirectivesRule.mjs +++ /dev/null @@ -1,134 +0,0 @@ -import inspect from "../../jsutils/inspect.mjs"; -import invariant from "../../jsutils/invariant.mjs"; -import { GraphQLError } from "../../error/GraphQLError.mjs"; -import { Kind } from "../../language/kinds.mjs"; -import { DirectiveLocation } from "../../language/directiveLocation.mjs"; -import { specifiedDirectives } from "../../type/directives.mjs"; - -/** - * Known directives - * - * A GraphQL document is only valid if all `@directives` are known by the - * schema and legally positioned. - */ -export function KnownDirectivesRule(context) { - var locationsMap = Object.create(null); - var schema = context.getSchema(); - var definedDirectives = schema ? schema.getDirectives() : specifiedDirectives; - - for (var _i2 = 0; _i2 < definedDirectives.length; _i2++) { - var directive = definedDirectives[_i2]; - locationsMap[directive.name] = directive.locations; - } - - var astDefinitions = context.getDocument().definitions; - - for (var _i4 = 0; _i4 < astDefinitions.length; _i4++) { - var def = astDefinitions[_i4]; - - if (def.kind === Kind.DIRECTIVE_DEFINITION) { - locationsMap[def.name.value] = def.locations.map(function (name) { - return name.value; - }); - } - } - - return { - Directive: function Directive(node, _key, _parent, _path, ancestors) { - var name = node.name.value; - var locations = locationsMap[name]; - - if (!locations) { - context.reportError(new GraphQLError("Unknown directive \"@".concat(name, "\"."), node)); - return; - } - - var candidateLocation = getDirectiveLocationForASTPath(ancestors); - - if (candidateLocation && locations.indexOf(candidateLocation) === -1) { - context.reportError(new GraphQLError("Directive \"@".concat(name, "\" may not be used on ").concat(candidateLocation, "."), node)); - } - } - }; -} - -function getDirectiveLocationForASTPath(ancestors) { - var appliedTo = ancestors[ancestors.length - 1]; - !Array.isArray(appliedTo) || invariant(0); - - switch (appliedTo.kind) { - case Kind.OPERATION_DEFINITION: - return getDirectiveLocationForOperation(appliedTo.operation); - - case Kind.FIELD: - return DirectiveLocation.FIELD; - - case Kind.FRAGMENT_SPREAD: - return DirectiveLocation.FRAGMENT_SPREAD; - - case Kind.INLINE_FRAGMENT: - return DirectiveLocation.INLINE_FRAGMENT; - - case Kind.FRAGMENT_DEFINITION: - return DirectiveLocation.FRAGMENT_DEFINITION; - - case Kind.VARIABLE_DEFINITION: - return DirectiveLocation.VARIABLE_DEFINITION; - - case Kind.SCHEMA_DEFINITION: - case Kind.SCHEMA_EXTENSION: - return DirectiveLocation.SCHEMA; - - case Kind.SCALAR_TYPE_DEFINITION: - case Kind.SCALAR_TYPE_EXTENSION: - return DirectiveLocation.SCALAR; - - case Kind.OBJECT_TYPE_DEFINITION: - case Kind.OBJECT_TYPE_EXTENSION: - return DirectiveLocation.OBJECT; - - case Kind.FIELD_DEFINITION: - return DirectiveLocation.FIELD_DEFINITION; - - case Kind.INTERFACE_TYPE_DEFINITION: - case Kind.INTERFACE_TYPE_EXTENSION: - return DirectiveLocation.INTERFACE; - - case Kind.UNION_TYPE_DEFINITION: - case Kind.UNION_TYPE_EXTENSION: - return DirectiveLocation.UNION; - - case Kind.ENUM_TYPE_DEFINITION: - case Kind.ENUM_TYPE_EXTENSION: - return DirectiveLocation.ENUM; - - case Kind.ENUM_VALUE_DEFINITION: - return DirectiveLocation.ENUM_VALUE; - - case Kind.INPUT_OBJECT_TYPE_DEFINITION: - case Kind.INPUT_OBJECT_TYPE_EXTENSION: - return DirectiveLocation.INPUT_OBJECT; - - case Kind.INPUT_VALUE_DEFINITION: - { - var parentNode = ancestors[ancestors.length - 3]; - return parentNode.kind === Kind.INPUT_OBJECT_TYPE_DEFINITION ? DirectiveLocation.INPUT_FIELD_DEFINITION : DirectiveLocation.ARGUMENT_DEFINITION; - } - } -} - -function getDirectiveLocationForOperation(operation) { - switch (operation) { - case 'query': - return DirectiveLocation.QUERY; - - case 'mutation': - return DirectiveLocation.MUTATION; - - case 'subscription': - return DirectiveLocation.SUBSCRIPTION; - } // istanbul ignore next (Not reachable. All possible types have been considered) - - - false || invariant(0, 'Unexpected operation: ' + inspect(operation)); -} diff --git a/alarm/node_modules/graphql/validation/rules/KnownFragmentNamesRule.d.ts b/alarm/node_modules/graphql/validation/rules/KnownFragmentNamesRule.d.ts deleted file mode 100644 index 7b594fd..0000000 --- a/alarm/node_modules/graphql/validation/rules/KnownFragmentNamesRule.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { ASTVisitor } from '../../language/visitor'; -import { ValidationContext } from '../ValidationContext'; - -/** - * Known fragment names - * - * A GraphQL document is only valid if all `...Fragment` fragment spreads refer - * to fragments defined in the same document. - */ -export function KnownFragmentNamesRule(context: ValidationContext): ASTVisitor; diff --git a/alarm/node_modules/graphql/validation/rules/KnownFragmentNamesRule.js b/alarm/node_modules/graphql/validation/rules/KnownFragmentNamesRule.js deleted file mode 100644 index 2902ef4..0000000 --- a/alarm/node_modules/graphql/validation/rules/KnownFragmentNamesRule.js +++ /dev/null @@ -1,27 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.KnownFragmentNamesRule = KnownFragmentNamesRule; - -var _GraphQLError = require("../../error/GraphQLError.js"); - -/** - * Known fragment names - * - * A GraphQL document is only valid if all `...Fragment` fragment spreads refer - * to fragments defined in the same document. - */ -function KnownFragmentNamesRule(context) { - return { - FragmentSpread: function FragmentSpread(node) { - var fragmentName = node.name.value; - var fragment = context.getFragment(fragmentName); - - if (!fragment) { - context.reportError(new _GraphQLError.GraphQLError("Unknown fragment \"".concat(fragmentName, "\"."), node.name)); - } - } - }; -} diff --git a/alarm/node_modules/graphql/validation/rules/KnownFragmentNamesRule.js.flow b/alarm/node_modules/graphql/validation/rules/KnownFragmentNamesRule.js.flow deleted file mode 100644 index 0c02736..0000000 --- a/alarm/node_modules/graphql/validation/rules/KnownFragmentNamesRule.js.flow +++ /dev/null @@ -1,26 +0,0 @@ -// @flow strict -import { GraphQLError } from '../../error/GraphQLError'; - -import type { ASTVisitor } from '../../language/visitor'; - -import type { ValidationContext } from '../ValidationContext'; - -/** - * Known fragment names - * - * A GraphQL document is only valid if all `...Fragment` fragment spreads refer - * to fragments defined in the same document. - */ -export function KnownFragmentNamesRule(context: ValidationContext): ASTVisitor { - return { - FragmentSpread(node) { - const fragmentName = node.name.value; - const fragment = context.getFragment(fragmentName); - if (!fragment) { - context.reportError( - new GraphQLError(`Unknown fragment "${fragmentName}".`, node.name), - ); - } - }, - }; -} diff --git a/alarm/node_modules/graphql/validation/rules/KnownFragmentNamesRule.mjs b/alarm/node_modules/graphql/validation/rules/KnownFragmentNamesRule.mjs deleted file mode 100644 index 72f935d..0000000 --- a/alarm/node_modules/graphql/validation/rules/KnownFragmentNamesRule.mjs +++ /dev/null @@ -1,20 +0,0 @@ -import { GraphQLError } from "../../error/GraphQLError.mjs"; - -/** - * Known fragment names - * - * A GraphQL document is only valid if all `...Fragment` fragment spreads refer - * to fragments defined in the same document. - */ -export function KnownFragmentNamesRule(context) { - return { - FragmentSpread: function FragmentSpread(node) { - var fragmentName = node.name.value; - var fragment = context.getFragment(fragmentName); - - if (!fragment) { - context.reportError(new GraphQLError("Unknown fragment \"".concat(fragmentName, "\"."), node.name)); - } - } - }; -} diff --git a/alarm/node_modules/graphql/validation/rules/KnownTypeNamesRule.d.ts b/alarm/node_modules/graphql/validation/rules/KnownTypeNamesRule.d.ts deleted file mode 100644 index b7cd75d..0000000 --- a/alarm/node_modules/graphql/validation/rules/KnownTypeNamesRule.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { ASTVisitor } from '../../language/visitor'; -import { ValidationContext, SDLValidationContext } from '../ValidationContext'; - -/** - * Known type names - * - * A GraphQL document is only valid if referenced types (specifically - * variable definitions and fragment conditions) are defined by the type schema. - */ -export function KnownTypeNamesRule( - context: ValidationContext | SDLValidationContext, -): ASTVisitor; diff --git a/alarm/node_modules/graphql/validation/rules/KnownTypeNamesRule.js b/alarm/node_modules/graphql/validation/rules/KnownTypeNamesRule.js deleted file mode 100644 index 249e3d6..0000000 --- a/alarm/node_modules/graphql/validation/rules/KnownTypeNamesRule.js +++ /dev/null @@ -1,73 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.KnownTypeNamesRule = KnownTypeNamesRule; - -var _didYouMean = _interopRequireDefault(require("../../jsutils/didYouMean.js")); - -var _suggestionList = _interopRequireDefault(require("../../jsutils/suggestionList.js")); - -var _GraphQLError = require("../../error/GraphQLError.js"); - -var _predicates = require("../../language/predicates.js"); - -var _scalars = require("../../type/scalars.js"); - -var _introspection = require("../../type/introspection.js"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Known type names - * - * A GraphQL document is only valid if referenced types (specifically - * variable definitions and fragment conditions) are defined by the type schema. - */ -function KnownTypeNamesRule(context) { - var schema = context.getSchema(); - var existingTypesMap = schema ? schema.getTypeMap() : Object.create(null); - var definedTypes = Object.create(null); - - for (var _i2 = 0, _context$getDocument$2 = context.getDocument().definitions; _i2 < _context$getDocument$2.length; _i2++) { - var def = _context$getDocument$2[_i2]; - - if ((0, _predicates.isTypeDefinitionNode)(def)) { - definedTypes[def.name.value] = true; - } - } - - var typeNames = Object.keys(existingTypesMap).concat(Object.keys(definedTypes)); - return { - NamedType: function NamedType(node, _1, parent, _2, ancestors) { - var typeName = node.name.value; - - if (!existingTypesMap[typeName] && !definedTypes[typeName]) { - var _ancestors$; - - var definitionNode = (_ancestors$ = ancestors[2]) !== null && _ancestors$ !== void 0 ? _ancestors$ : parent; - var isSDL = definitionNode != null && isSDLNode(definitionNode); - - if (isSDL && isStandardTypeName(typeName)) { - return; - } - - var suggestedTypes = (0, _suggestionList.default)(typeName, isSDL ? standardTypeNames.concat(typeNames) : typeNames); - context.reportError(new _GraphQLError.GraphQLError("Unknown type \"".concat(typeName, "\".") + (0, _didYouMean.default)(suggestedTypes), node)); - } - } - }; -} - -var standardTypeNames = [].concat(_scalars.specifiedScalarTypes, _introspection.introspectionTypes).map(function (type) { - return type.name; -}); - -function isStandardTypeName(typeName) { - return standardTypeNames.indexOf(typeName) !== -1; -} - -function isSDLNode(value) { - return !Array.isArray(value) && ((0, _predicates.isTypeSystemDefinitionNode)(value) || (0, _predicates.isTypeSystemExtensionNode)(value)); -} diff --git a/alarm/node_modules/graphql/validation/rules/KnownTypeNamesRule.js.flow b/alarm/node_modules/graphql/validation/rules/KnownTypeNamesRule.js.flow deleted file mode 100644 index b0120db..0000000 --- a/alarm/node_modules/graphql/validation/rules/KnownTypeNamesRule.js.flow +++ /dev/null @@ -1,84 +0,0 @@ -// @flow strict -import didYouMean from '../../jsutils/didYouMean'; -import suggestionList from '../../jsutils/suggestionList'; - -import { GraphQLError } from '../../error/GraphQLError'; - -import type { ASTNode } from '../../language/ast'; -import type { ASTVisitor } from '../../language/visitor'; -import { - isTypeDefinitionNode, - isTypeSystemDefinitionNode, - isTypeSystemExtensionNode, -} from '../../language/predicates'; - -import { specifiedScalarTypes } from '../../type/scalars'; -import { introspectionTypes } from '../../type/introspection'; - -import type { - ValidationContext, - SDLValidationContext, -} from '../ValidationContext'; - -/** - * Known type names - * - * A GraphQL document is only valid if referenced types (specifically - * variable definitions and fragment conditions) are defined by the type schema. - */ -export function KnownTypeNamesRule( - context: ValidationContext | SDLValidationContext, -): ASTVisitor { - const schema = context.getSchema(); - const existingTypesMap = schema ? schema.getTypeMap() : Object.create(null); - - const definedTypes = Object.create(null); - for (const def of context.getDocument().definitions) { - if (isTypeDefinitionNode(def)) { - definedTypes[def.name.value] = true; - } - } - - const typeNames = Object.keys(existingTypesMap).concat( - Object.keys(definedTypes), - ); - - return { - NamedType(node, _1, parent, _2, ancestors) { - const typeName = node.name.value; - if (!existingTypesMap[typeName] && !definedTypes[typeName]) { - const definitionNode = ancestors[2] ?? parent; - const isSDL = definitionNode != null && isSDLNode(definitionNode); - if (isSDL && isStandardTypeName(typeName)) { - return; - } - - const suggestedTypes = suggestionList( - typeName, - isSDL ? standardTypeNames.concat(typeNames) : typeNames, - ); - context.reportError( - new GraphQLError( - `Unknown type "${typeName}".` + didYouMean(suggestedTypes), - node, - ), - ); - } - }, - }; -} - -const standardTypeNames = [...specifiedScalarTypes, ...introspectionTypes].map( - (type) => type.name, -); - -function isStandardTypeName(typeName: string): boolean { - return standardTypeNames.indexOf(typeName) !== -1; -} - -function isSDLNode(value: ASTNode | $ReadOnlyArray<ASTNode>): boolean { - return ( - !Array.isArray(value) && - (isTypeSystemDefinitionNode(value) || isTypeSystemExtensionNode(value)) - ); -} diff --git a/alarm/node_modules/graphql/validation/rules/KnownTypeNamesRule.mjs b/alarm/node_modules/graphql/validation/rules/KnownTypeNamesRule.mjs deleted file mode 100644 index 69116f5..0000000 --- a/alarm/node_modules/graphql/validation/rules/KnownTypeNamesRule.mjs +++ /dev/null @@ -1,58 +0,0 @@ -import didYouMean from "../../jsutils/didYouMean.mjs"; -import suggestionList from "../../jsutils/suggestionList.mjs"; -import { GraphQLError } from "../../error/GraphQLError.mjs"; -import { isTypeDefinitionNode, isTypeSystemDefinitionNode, isTypeSystemExtensionNode } from "../../language/predicates.mjs"; -import { specifiedScalarTypes } from "../../type/scalars.mjs"; -import { introspectionTypes } from "../../type/introspection.mjs"; - -/** - * Known type names - * - * A GraphQL document is only valid if referenced types (specifically - * variable definitions and fragment conditions) are defined by the type schema. - */ -export function KnownTypeNamesRule(context) { - var schema = context.getSchema(); - var existingTypesMap = schema ? schema.getTypeMap() : Object.create(null); - var definedTypes = Object.create(null); - - for (var _i2 = 0, _context$getDocument$2 = context.getDocument().definitions; _i2 < _context$getDocument$2.length; _i2++) { - var def = _context$getDocument$2[_i2]; - - if (isTypeDefinitionNode(def)) { - definedTypes[def.name.value] = true; - } - } - - var typeNames = Object.keys(existingTypesMap).concat(Object.keys(definedTypes)); - return { - NamedType: function NamedType(node, _1, parent, _2, ancestors) { - var typeName = node.name.value; - - if (!existingTypesMap[typeName] && !definedTypes[typeName]) { - var _ancestors$; - - var definitionNode = (_ancestors$ = ancestors[2]) !== null && _ancestors$ !== void 0 ? _ancestors$ : parent; - var isSDL = definitionNode != null && isSDLNode(definitionNode); - - if (isSDL && isStandardTypeName(typeName)) { - return; - } - - var suggestedTypes = suggestionList(typeName, isSDL ? standardTypeNames.concat(typeNames) : typeNames); - context.reportError(new GraphQLError("Unknown type \"".concat(typeName, "\".") + didYouMean(suggestedTypes), node)); - } - } - }; -} -var standardTypeNames = [].concat(specifiedScalarTypes, introspectionTypes).map(function (type) { - return type.name; -}); - -function isStandardTypeName(typeName) { - return standardTypeNames.indexOf(typeName) !== -1; -} - -function isSDLNode(value) { - return !Array.isArray(value) && (isTypeSystemDefinitionNode(value) || isTypeSystemExtensionNode(value)); -} diff --git a/alarm/node_modules/graphql/validation/rules/LoneAnonymousOperationRule.d.ts b/alarm/node_modules/graphql/validation/rules/LoneAnonymousOperationRule.d.ts deleted file mode 100644 index 1ac19ef..0000000 --- a/alarm/node_modules/graphql/validation/rules/LoneAnonymousOperationRule.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { ASTVisitor } from '../../language/visitor'; -import { ASTValidationContext } from '../ValidationContext'; - -/** - * Lone anonymous operation - * - * A GraphQL document is only valid if when it contains an anonymous operation - * (the query short-hand) that it contains only that one operation definition. - */ -export function LoneAnonymousOperationRule( - context: ASTValidationContext, -): ASTVisitor; diff --git a/alarm/node_modules/graphql/validation/rules/LoneAnonymousOperationRule.js b/alarm/node_modules/graphql/validation/rules/LoneAnonymousOperationRule.js deleted file mode 100644 index 116a9fb..0000000 --- a/alarm/node_modules/graphql/validation/rules/LoneAnonymousOperationRule.js +++ /dev/null @@ -1,32 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.LoneAnonymousOperationRule = LoneAnonymousOperationRule; - -var _GraphQLError = require("../../error/GraphQLError.js"); - -var _kinds = require("../../language/kinds.js"); - -/** - * Lone anonymous operation - * - * A GraphQL document is only valid if when it contains an anonymous operation - * (the query short-hand) that it contains only that one operation definition. - */ -function LoneAnonymousOperationRule(context) { - var operationCount = 0; - return { - Document: function Document(node) { - operationCount = node.definitions.filter(function (definition) { - return definition.kind === _kinds.Kind.OPERATION_DEFINITION; - }).length; - }, - OperationDefinition: function OperationDefinition(node) { - if (!node.name && operationCount > 1) { - context.reportError(new _GraphQLError.GraphQLError('This anonymous operation must be the only defined operation.', node)); - } - } - }; -} diff --git a/alarm/node_modules/graphql/validation/rules/LoneAnonymousOperationRule.js.flow b/alarm/node_modules/graphql/validation/rules/LoneAnonymousOperationRule.js.flow deleted file mode 100644 index e6370aa..0000000 --- a/alarm/node_modules/graphql/validation/rules/LoneAnonymousOperationRule.js.flow +++ /dev/null @@ -1,36 +0,0 @@ -// @flow strict -import { GraphQLError } from '../../error/GraphQLError'; - -import type { ASTVisitor } from '../../language/visitor'; -import { Kind } from '../../language/kinds'; - -import type { ASTValidationContext } from '../ValidationContext'; - -/** - * Lone anonymous operation - * - * A GraphQL document is only valid if when it contains an anonymous operation - * (the query short-hand) that it contains only that one operation definition. - */ -export function LoneAnonymousOperationRule( - context: ASTValidationContext, -): ASTVisitor { - let operationCount = 0; - return { - Document(node) { - operationCount = node.definitions.filter( - (definition) => definition.kind === Kind.OPERATION_DEFINITION, - ).length; - }, - OperationDefinition(node) { - if (!node.name && operationCount > 1) { - context.reportError( - new GraphQLError( - 'This anonymous operation must be the only defined operation.', - node, - ), - ); - } - }, - }; -} diff --git a/alarm/node_modules/graphql/validation/rules/LoneAnonymousOperationRule.mjs b/alarm/node_modules/graphql/validation/rules/LoneAnonymousOperationRule.mjs deleted file mode 100644 index 134322d..0000000 --- a/alarm/node_modules/graphql/validation/rules/LoneAnonymousOperationRule.mjs +++ /dev/null @@ -1,24 +0,0 @@ -import { GraphQLError } from "../../error/GraphQLError.mjs"; -import { Kind } from "../../language/kinds.mjs"; - -/** - * Lone anonymous operation - * - * A GraphQL document is only valid if when it contains an anonymous operation - * (the query short-hand) that it contains only that one operation definition. - */ -export function LoneAnonymousOperationRule(context) { - var operationCount = 0; - return { - Document: function Document(node) { - operationCount = node.definitions.filter(function (definition) { - return definition.kind === Kind.OPERATION_DEFINITION; - }).length; - }, - OperationDefinition: function OperationDefinition(node) { - if (!node.name && operationCount > 1) { - context.reportError(new GraphQLError('This anonymous operation must be the only defined operation.', node)); - } - } - }; -} diff --git a/alarm/node_modules/graphql/validation/rules/LoneSchemaDefinition.d.ts b/alarm/node_modules/graphql/validation/rules/LoneSchemaDefinition.d.ts deleted file mode 100644 index a38ad06..0000000 --- a/alarm/node_modules/graphql/validation/rules/LoneSchemaDefinition.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * @deprecated and will be removed in v16 - * Please use either: - * import { LoneSchemaDefinitionRule } from 'graphql' - * or - * import { LoneSchemaDefinitionRule } from 'graphql/validation' - */ -export { LoneSchemaDefinitionRule as LoneSchemaDefinition } from './LoneSchemaDefinitionRule'; diff --git a/alarm/node_modules/graphql/validation/rules/LoneSchemaDefinition.js b/alarm/node_modules/graphql/validation/rules/LoneSchemaDefinition.js deleted file mode 100644 index 55d0b20..0000000 --- a/alarm/node_modules/graphql/validation/rules/LoneSchemaDefinition.js +++ /dev/null @@ -1,13 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -Object.defineProperty(exports, "LoneSchemaDefinition", { - enumerable: true, - get: function get() { - return _LoneSchemaDefinitionRule.LoneSchemaDefinitionRule; - } -}); - -var _LoneSchemaDefinitionRule = require("./LoneSchemaDefinitionRule.js"); diff --git a/alarm/node_modules/graphql/validation/rules/LoneSchemaDefinition.js.flow b/alarm/node_modules/graphql/validation/rules/LoneSchemaDefinition.js.flow deleted file mode 100644 index 6d0466a..0000000 --- a/alarm/node_modules/graphql/validation/rules/LoneSchemaDefinition.js.flow +++ /dev/null @@ -1,9 +0,0 @@ -// @flow strict -/** - * @deprecated and will be removed in v16 - * Please use either: - * import { LoneSchemaDefinitionRule } from 'graphql' - * or - * import { LoneSchemaDefinitionRule } from 'graphql/validation' - */ -export { LoneSchemaDefinitionRule as LoneSchemaDefinition } from './LoneSchemaDefinitionRule'; diff --git a/alarm/node_modules/graphql/validation/rules/LoneSchemaDefinition.mjs b/alarm/node_modules/graphql/validation/rules/LoneSchemaDefinition.mjs deleted file mode 100644 index 5485db0..0000000 --- a/alarm/node_modules/graphql/validation/rules/LoneSchemaDefinition.mjs +++ /dev/null @@ -1,8 +0,0 @@ -/** - * @deprecated and will be removed in v16 - * Please use either: - * import { LoneSchemaDefinitionRule } from 'graphql' - * or - * import { LoneSchemaDefinitionRule } from 'graphql/validation' - */ -export { LoneSchemaDefinitionRule as LoneSchemaDefinition } from "./LoneSchemaDefinitionRule.mjs"; diff --git a/alarm/node_modules/graphql/validation/rules/LoneSchemaDefinitionRule.d.ts b/alarm/node_modules/graphql/validation/rules/LoneSchemaDefinitionRule.d.ts deleted file mode 100644 index 5075e74..0000000 --- a/alarm/node_modules/graphql/validation/rules/LoneSchemaDefinitionRule.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { ASTVisitor } from '../../language/visitor'; -import { SDLValidationContext } from '../ValidationContext'; - -/** - * Lone Schema definition - * - * A GraphQL document is only valid if it contains only one schema definition. - */ -export function LoneSchemaDefinitionRule( - context: SDLValidationContext, -): ASTVisitor; diff --git a/alarm/node_modules/graphql/validation/rules/LoneSchemaDefinitionRule.js b/alarm/node_modules/graphql/validation/rules/LoneSchemaDefinitionRule.js deleted file mode 100644 index ca270c1..0000000 --- a/alarm/node_modules/graphql/validation/rules/LoneSchemaDefinitionRule.js +++ /dev/null @@ -1,35 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.LoneSchemaDefinitionRule = LoneSchemaDefinitionRule; - -var _GraphQLError = require("../../error/GraphQLError.js"); - -/** - * Lone Schema definition - * - * A GraphQL document is only valid if it contains only one schema definition. - */ -function LoneSchemaDefinitionRule(context) { - var _ref, _ref2, _oldSchema$astNode; - - var oldSchema = context.getSchema(); - var alreadyDefined = (_ref = (_ref2 = (_oldSchema$astNode = oldSchema === null || oldSchema === void 0 ? void 0 : oldSchema.astNode) !== null && _oldSchema$astNode !== void 0 ? _oldSchema$astNode : oldSchema === null || oldSchema === void 0 ? void 0 : oldSchema.getQueryType()) !== null && _ref2 !== void 0 ? _ref2 : oldSchema === null || oldSchema === void 0 ? void 0 : oldSchema.getMutationType()) !== null && _ref !== void 0 ? _ref : oldSchema === null || oldSchema === void 0 ? void 0 : oldSchema.getSubscriptionType(); - var schemaDefinitionsCount = 0; - return { - SchemaDefinition: function SchemaDefinition(node) { - if (alreadyDefined) { - context.reportError(new _GraphQLError.GraphQLError('Cannot define a new schema within a schema extension.', node)); - return; - } - - if (schemaDefinitionsCount > 0) { - context.reportError(new _GraphQLError.GraphQLError('Must provide only one schema definition.', node)); - } - - ++schemaDefinitionsCount; - } - }; -} diff --git a/alarm/node_modules/graphql/validation/rules/LoneSchemaDefinitionRule.js.flow b/alarm/node_modules/graphql/validation/rules/LoneSchemaDefinitionRule.js.flow deleted file mode 100644 index 420a2a0..0000000 --- a/alarm/node_modules/graphql/validation/rules/LoneSchemaDefinitionRule.js.flow +++ /dev/null @@ -1,43 +0,0 @@ -// @flow strict -import { GraphQLError } from '../../error/GraphQLError'; -import type { ASTVisitor } from '../../language/visitor'; - -import type { SDLValidationContext } from '../ValidationContext'; - -/** - * Lone Schema definition - * - * A GraphQL document is only valid if it contains only one schema definition. - */ -export function LoneSchemaDefinitionRule( - context: SDLValidationContext, -): ASTVisitor { - const oldSchema = context.getSchema(); - const alreadyDefined = - oldSchema?.astNode ?? - oldSchema?.getQueryType() ?? - oldSchema?.getMutationType() ?? - oldSchema?.getSubscriptionType(); - - let schemaDefinitionsCount = 0; - return { - SchemaDefinition(node) { - if (alreadyDefined) { - context.reportError( - new GraphQLError( - 'Cannot define a new schema within a schema extension.', - node, - ), - ); - return; - } - - if (schemaDefinitionsCount > 0) { - context.reportError( - new GraphQLError('Must provide only one schema definition.', node), - ); - } - ++schemaDefinitionsCount; - }, - }; -} diff --git a/alarm/node_modules/graphql/validation/rules/LoneSchemaDefinitionRule.mjs b/alarm/node_modules/graphql/validation/rules/LoneSchemaDefinitionRule.mjs deleted file mode 100644 index ccc5493..0000000 --- a/alarm/node_modules/graphql/validation/rules/LoneSchemaDefinitionRule.mjs +++ /dev/null @@ -1,28 +0,0 @@ -import { GraphQLError } from "../../error/GraphQLError.mjs"; - -/** - * Lone Schema definition - * - * A GraphQL document is only valid if it contains only one schema definition. - */ -export function LoneSchemaDefinitionRule(context) { - var _ref, _ref2, _oldSchema$astNode; - - var oldSchema = context.getSchema(); - var alreadyDefined = (_ref = (_ref2 = (_oldSchema$astNode = oldSchema === null || oldSchema === void 0 ? void 0 : oldSchema.astNode) !== null && _oldSchema$astNode !== void 0 ? _oldSchema$astNode : oldSchema === null || oldSchema === void 0 ? void 0 : oldSchema.getQueryType()) !== null && _ref2 !== void 0 ? _ref2 : oldSchema === null || oldSchema === void 0 ? void 0 : oldSchema.getMutationType()) !== null && _ref !== void 0 ? _ref : oldSchema === null || oldSchema === void 0 ? void 0 : oldSchema.getSubscriptionType(); - var schemaDefinitionsCount = 0; - return { - SchemaDefinition: function SchemaDefinition(node) { - if (alreadyDefined) { - context.reportError(new GraphQLError('Cannot define a new schema within a schema extension.', node)); - return; - } - - if (schemaDefinitionsCount > 0) { - context.reportError(new GraphQLError('Must provide only one schema definition.', node)); - } - - ++schemaDefinitionsCount; - } - }; -} diff --git a/alarm/node_modules/graphql/validation/rules/NoFragmentCyclesRule.d.ts b/alarm/node_modules/graphql/validation/rules/NoFragmentCyclesRule.d.ts deleted file mode 100644 index 85b2b10..0000000 --- a/alarm/node_modules/graphql/validation/rules/NoFragmentCyclesRule.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { ASTVisitor } from '../../language/visitor'; -import { ValidationContext } from '../ValidationContext'; - -export function NoFragmentCyclesRule(context: ValidationContext): ASTVisitor; diff --git a/alarm/node_modules/graphql/validation/rules/NoFragmentCyclesRule.js b/alarm/node_modules/graphql/validation/rules/NoFragmentCyclesRule.js deleted file mode 100644 index afabeb5..0000000 --- a/alarm/node_modules/graphql/validation/rules/NoFragmentCyclesRule.js +++ /dev/null @@ -1,70 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.NoFragmentCyclesRule = NoFragmentCyclesRule; - -var _GraphQLError = require("../../error/GraphQLError.js"); - -function NoFragmentCyclesRule(context) { - // Tracks already visited fragments to maintain O(N) and to ensure that cycles - // are not redundantly reported. - var visitedFrags = Object.create(null); // Array of AST nodes used to produce meaningful errors - - var spreadPath = []; // Position in the spread path - - var spreadPathIndexByName = Object.create(null); - return { - OperationDefinition: function OperationDefinition() { - return false; - }, - FragmentDefinition: function FragmentDefinition(node) { - detectCycleRecursive(node); - return false; - } - }; // This does a straight-forward DFS to find cycles. - // It does not terminate when a cycle was found but continues to explore - // the graph to find all possible cycles. - - function detectCycleRecursive(fragment) { - if (visitedFrags[fragment.name.value]) { - return; - } - - var fragmentName = fragment.name.value; - visitedFrags[fragmentName] = true; - var spreadNodes = context.getFragmentSpreads(fragment.selectionSet); - - if (spreadNodes.length === 0) { - return; - } - - spreadPathIndexByName[fragmentName] = spreadPath.length; - - for (var _i2 = 0; _i2 < spreadNodes.length; _i2++) { - var spreadNode = spreadNodes[_i2]; - var spreadName = spreadNode.name.value; - var cycleIndex = spreadPathIndexByName[spreadName]; - spreadPath.push(spreadNode); - - if (cycleIndex === undefined) { - var spreadFragment = context.getFragment(spreadName); - - if (spreadFragment) { - detectCycleRecursive(spreadFragment); - } - } else { - var cyclePath = spreadPath.slice(cycleIndex); - var viaPath = cyclePath.slice(0, -1).map(function (s) { - return '"' + s.name.value + '"'; - }).join(', '); - context.reportError(new _GraphQLError.GraphQLError("Cannot spread fragment \"".concat(spreadName, "\" within itself") + (viaPath !== '' ? " via ".concat(viaPath, ".") : '.'), cyclePath)); - } - - spreadPath.pop(); - } - - spreadPathIndexByName[fragmentName] = undefined; - } -} diff --git a/alarm/node_modules/graphql/validation/rules/NoFragmentCyclesRule.js.flow b/alarm/node_modules/graphql/validation/rules/NoFragmentCyclesRule.js.flow deleted file mode 100644 index 5687322..0000000 --- a/alarm/node_modules/graphql/validation/rules/NoFragmentCyclesRule.js.flow +++ /dev/null @@ -1,78 +0,0 @@ -// @flow strict -import { GraphQLError } from '../../error/GraphQLError'; - -import type { ASTVisitor } from '../../language/visitor'; -import type { FragmentDefinitionNode } from '../../language/ast'; - -import type { ASTValidationContext } from '../ValidationContext'; - -export function NoFragmentCyclesRule( - context: ASTValidationContext, -): ASTVisitor { - // Tracks already visited fragments to maintain O(N) and to ensure that cycles - // are not redundantly reported. - const visitedFrags = Object.create(null); - - // Array of AST nodes used to produce meaningful errors - const spreadPath = []; - - // Position in the spread path - const spreadPathIndexByName = Object.create(null); - - return { - OperationDefinition: () => false, - FragmentDefinition(node) { - detectCycleRecursive(node); - return false; - }, - }; - - // This does a straight-forward DFS to find cycles. - // It does not terminate when a cycle was found but continues to explore - // the graph to find all possible cycles. - function detectCycleRecursive(fragment: FragmentDefinitionNode): void { - if (visitedFrags[fragment.name.value]) { - return; - } - - const fragmentName = fragment.name.value; - visitedFrags[fragmentName] = true; - - const spreadNodes = context.getFragmentSpreads(fragment.selectionSet); - if (spreadNodes.length === 0) { - return; - } - - spreadPathIndexByName[fragmentName] = spreadPath.length; - - for (const spreadNode of spreadNodes) { - const spreadName = spreadNode.name.value; - const cycleIndex = spreadPathIndexByName[spreadName]; - - spreadPath.push(spreadNode); - if (cycleIndex === undefined) { - const spreadFragment = context.getFragment(spreadName); - if (spreadFragment) { - detectCycleRecursive(spreadFragment); - } - } else { - const cyclePath = spreadPath.slice(cycleIndex); - const viaPath = cyclePath - .slice(0, -1) - .map((s) => '"' + s.name.value + '"') - .join(', '); - - context.reportError( - new GraphQLError( - `Cannot spread fragment "${spreadName}" within itself` + - (viaPath !== '' ? ` via ${viaPath}.` : '.'), - cyclePath, - ), - ); - } - spreadPath.pop(); - } - - spreadPathIndexByName[fragmentName] = undefined; - } -} diff --git a/alarm/node_modules/graphql/validation/rules/NoFragmentCyclesRule.mjs b/alarm/node_modules/graphql/validation/rules/NoFragmentCyclesRule.mjs deleted file mode 100644 index 8d7618e..0000000 --- a/alarm/node_modules/graphql/validation/rules/NoFragmentCyclesRule.mjs +++ /dev/null @@ -1,62 +0,0 @@ -import { GraphQLError } from "../../error/GraphQLError.mjs"; -export function NoFragmentCyclesRule(context) { - // Tracks already visited fragments to maintain O(N) and to ensure that cycles - // are not redundantly reported. - var visitedFrags = Object.create(null); // Array of AST nodes used to produce meaningful errors - - var spreadPath = []; // Position in the spread path - - var spreadPathIndexByName = Object.create(null); - return { - OperationDefinition: function OperationDefinition() { - return false; - }, - FragmentDefinition: function FragmentDefinition(node) { - detectCycleRecursive(node); - return false; - } - }; // This does a straight-forward DFS to find cycles. - // It does not terminate when a cycle was found but continues to explore - // the graph to find all possible cycles. - - function detectCycleRecursive(fragment) { - if (visitedFrags[fragment.name.value]) { - return; - } - - var fragmentName = fragment.name.value; - visitedFrags[fragmentName] = true; - var spreadNodes = context.getFragmentSpreads(fragment.selectionSet); - - if (spreadNodes.length === 0) { - return; - } - - spreadPathIndexByName[fragmentName] = spreadPath.length; - - for (var _i2 = 0; _i2 < spreadNodes.length; _i2++) { - var spreadNode = spreadNodes[_i2]; - var spreadName = spreadNode.name.value; - var cycleIndex = spreadPathIndexByName[spreadName]; - spreadPath.push(spreadNode); - - if (cycleIndex === undefined) { - var spreadFragment = context.getFragment(spreadName); - - if (spreadFragment) { - detectCycleRecursive(spreadFragment); - } - } else { - var cyclePath = spreadPath.slice(cycleIndex); - var viaPath = cyclePath.slice(0, -1).map(function (s) { - return '"' + s.name.value + '"'; - }).join(', '); - context.reportError(new GraphQLError("Cannot spread fragment \"".concat(spreadName, "\" within itself") + (viaPath !== '' ? " via ".concat(viaPath, ".") : '.'), cyclePath)); - } - - spreadPath.pop(); - } - - spreadPathIndexByName[fragmentName] = undefined; - } -} diff --git a/alarm/node_modules/graphql/validation/rules/NoUndefinedVariablesRule.d.ts b/alarm/node_modules/graphql/validation/rules/NoUndefinedVariablesRule.d.ts deleted file mode 100644 index d1a0806..0000000 --- a/alarm/node_modules/graphql/validation/rules/NoUndefinedVariablesRule.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { ASTVisitor } from '../../language/visitor'; -import { ValidationContext } from '../ValidationContext'; - -/** - * No undefined variables - * - * A GraphQL operation is only valid if all variables encountered, both directly - * and via fragment spreads, are defined by that operation. - */ -export function NoUndefinedVariablesRule( - context: ValidationContext, -): ASTVisitor; diff --git a/alarm/node_modules/graphql/validation/rules/NoUndefinedVariablesRule.js b/alarm/node_modules/graphql/validation/rules/NoUndefinedVariablesRule.js deleted file mode 100644 index d3371ec..0000000 --- a/alarm/node_modules/graphql/validation/rules/NoUndefinedVariablesRule.js +++ /dev/null @@ -1,41 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.NoUndefinedVariablesRule = NoUndefinedVariablesRule; - -var _GraphQLError = require("../../error/GraphQLError.js"); - -/** - * No undefined variables - * - * A GraphQL operation is only valid if all variables encountered, both directly - * and via fragment spreads, are defined by that operation. - */ -function NoUndefinedVariablesRule(context) { - var variableNameDefined = Object.create(null); - return { - OperationDefinition: { - enter: function enter() { - variableNameDefined = Object.create(null); - }, - leave: function leave(operation) { - var usages = context.getRecursiveVariableUsages(operation); - - for (var _i2 = 0; _i2 < usages.length; _i2++) { - var _ref2 = usages[_i2]; - var node = _ref2.node; - var varName = node.name.value; - - if (variableNameDefined[varName] !== true) { - context.reportError(new _GraphQLError.GraphQLError(operation.name ? "Variable \"$".concat(varName, "\" is not defined by operation \"").concat(operation.name.value, "\".") : "Variable \"$".concat(varName, "\" is not defined."), [node, operation])); - } - } - } - }, - VariableDefinition: function VariableDefinition(node) { - variableNameDefined[node.variable.name.value] = true; - } - }; -} diff --git a/alarm/node_modules/graphql/validation/rules/NoUndefinedVariablesRule.js.flow b/alarm/node_modules/graphql/validation/rules/NoUndefinedVariablesRule.js.flow deleted file mode 100644 index 1773ada..0000000 --- a/alarm/node_modules/graphql/validation/rules/NoUndefinedVariablesRule.js.flow +++ /dev/null @@ -1,46 +0,0 @@ -// @flow strict -import { GraphQLError } from '../../error/GraphQLError'; - -import type { ASTVisitor } from '../../language/visitor'; - -import type { ValidationContext } from '../ValidationContext'; - -/** - * No undefined variables - * - * A GraphQL operation is only valid if all variables encountered, both directly - * and via fragment spreads, are defined by that operation. - */ -export function NoUndefinedVariablesRule( - context: ValidationContext, -): ASTVisitor { - let variableNameDefined = Object.create(null); - - return { - OperationDefinition: { - enter() { - variableNameDefined = Object.create(null); - }, - leave(operation) { - const usages = context.getRecursiveVariableUsages(operation); - - for (const { node } of usages) { - const varName = node.name.value; - if (variableNameDefined[varName] !== true) { - context.reportError( - new GraphQLError( - operation.name - ? `Variable "$${varName}" is not defined by operation "${operation.name.value}".` - : `Variable "$${varName}" is not defined.`, - [node, operation], - ), - ); - } - } - }, - }, - VariableDefinition(node) { - variableNameDefined[node.variable.name.value] = true; - }, - }; -} diff --git a/alarm/node_modules/graphql/validation/rules/NoUndefinedVariablesRule.mjs b/alarm/node_modules/graphql/validation/rules/NoUndefinedVariablesRule.mjs deleted file mode 100644 index 004059f..0000000 --- a/alarm/node_modules/graphql/validation/rules/NoUndefinedVariablesRule.mjs +++ /dev/null @@ -1,34 +0,0 @@ -import { GraphQLError } from "../../error/GraphQLError.mjs"; - -/** - * No undefined variables - * - * A GraphQL operation is only valid if all variables encountered, both directly - * and via fragment spreads, are defined by that operation. - */ -export function NoUndefinedVariablesRule(context) { - var variableNameDefined = Object.create(null); - return { - OperationDefinition: { - enter: function enter() { - variableNameDefined = Object.create(null); - }, - leave: function leave(operation) { - var usages = context.getRecursiveVariableUsages(operation); - - for (var _i2 = 0; _i2 < usages.length; _i2++) { - var _ref2 = usages[_i2]; - var node = _ref2.node; - var varName = node.name.value; - - if (variableNameDefined[varName] !== true) { - context.reportError(new GraphQLError(operation.name ? "Variable \"$".concat(varName, "\" is not defined by operation \"").concat(operation.name.value, "\".") : "Variable \"$".concat(varName, "\" is not defined."), [node, operation])); - } - } - } - }, - VariableDefinition: function VariableDefinition(node) { - variableNameDefined[node.variable.name.value] = true; - } - }; -} diff --git a/alarm/node_modules/graphql/validation/rules/NoUnusedFragmentsRule.d.ts b/alarm/node_modules/graphql/validation/rules/NoUnusedFragmentsRule.d.ts deleted file mode 100644 index 8435bab..0000000 --- a/alarm/node_modules/graphql/validation/rules/NoUnusedFragmentsRule.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { ASTVisitor } from '../../language/visitor'; -import { ValidationContext } from '../ValidationContext'; - -/** - * No unused fragments - * - * A GraphQL document is only valid if all fragment definitions are spread - * within operations, or spread within other fragments spread within operations. - */ -export function NoUnusedFragmentsRule(context: ValidationContext): ASTVisitor; diff --git a/alarm/node_modules/graphql/validation/rules/NoUnusedFragmentsRule.js b/alarm/node_modules/graphql/validation/rules/NoUnusedFragmentsRule.js deleted file mode 100644 index 2fa3ba2..0000000 --- a/alarm/node_modules/graphql/validation/rules/NoUnusedFragmentsRule.js +++ /dev/null @@ -1,52 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.NoUnusedFragmentsRule = NoUnusedFragmentsRule; - -var _GraphQLError = require("../../error/GraphQLError.js"); - -/** - * No unused fragments - * - * A GraphQL document is only valid if all fragment definitions are spread - * within operations, or spread within other fragments spread within operations. - */ -function NoUnusedFragmentsRule(context) { - var operationDefs = []; - var fragmentDefs = []; - return { - OperationDefinition: function OperationDefinition(node) { - operationDefs.push(node); - return false; - }, - FragmentDefinition: function FragmentDefinition(node) { - fragmentDefs.push(node); - return false; - }, - Document: { - leave: function leave() { - var fragmentNameUsed = Object.create(null); - - for (var _i2 = 0; _i2 < operationDefs.length; _i2++) { - var operation = operationDefs[_i2]; - - for (var _i4 = 0, _context$getRecursive2 = context.getRecursivelyReferencedFragments(operation); _i4 < _context$getRecursive2.length; _i4++) { - var fragment = _context$getRecursive2[_i4]; - fragmentNameUsed[fragment.name.value] = true; - } - } - - for (var _i6 = 0; _i6 < fragmentDefs.length; _i6++) { - var fragmentDef = fragmentDefs[_i6]; - var fragName = fragmentDef.name.value; - - if (fragmentNameUsed[fragName] !== true) { - context.reportError(new _GraphQLError.GraphQLError("Fragment \"".concat(fragName, "\" is never used."), fragmentDef)); - } - } - } - } - }; -} diff --git a/alarm/node_modules/graphql/validation/rules/NoUnusedFragmentsRule.js.flow b/alarm/node_modules/graphql/validation/rules/NoUnusedFragmentsRule.js.flow deleted file mode 100644 index fd5801b..0000000 --- a/alarm/node_modules/graphql/validation/rules/NoUnusedFragmentsRule.js.flow +++ /dev/null @@ -1,54 +0,0 @@ -// @flow strict -import { GraphQLError } from '../../error/GraphQLError'; - -import type { ASTVisitor } from '../../language/visitor'; - -import type { ASTValidationContext } from '../ValidationContext'; - -/** - * No unused fragments - * - * A GraphQL document is only valid if all fragment definitions are spread - * within operations, or spread within other fragments spread within operations. - */ -export function NoUnusedFragmentsRule( - context: ASTValidationContext, -): ASTVisitor { - const operationDefs = []; - const fragmentDefs = []; - - return { - OperationDefinition(node) { - operationDefs.push(node); - return false; - }, - FragmentDefinition(node) { - fragmentDefs.push(node); - return false; - }, - Document: { - leave() { - const fragmentNameUsed = Object.create(null); - for (const operation of operationDefs) { - for (const fragment of context.getRecursivelyReferencedFragments( - operation, - )) { - fragmentNameUsed[fragment.name.value] = true; - } - } - - for (const fragmentDef of fragmentDefs) { - const fragName = fragmentDef.name.value; - if (fragmentNameUsed[fragName] !== true) { - context.reportError( - new GraphQLError( - `Fragment "${fragName}" is never used.`, - fragmentDef, - ), - ); - } - } - }, - }, - }; -} diff --git a/alarm/node_modules/graphql/validation/rules/NoUnusedFragmentsRule.mjs b/alarm/node_modules/graphql/validation/rules/NoUnusedFragmentsRule.mjs deleted file mode 100644 index 1f5f816..0000000 --- a/alarm/node_modules/graphql/validation/rules/NoUnusedFragmentsRule.mjs +++ /dev/null @@ -1,45 +0,0 @@ -import { GraphQLError } from "../../error/GraphQLError.mjs"; - -/** - * No unused fragments - * - * A GraphQL document is only valid if all fragment definitions are spread - * within operations, or spread within other fragments spread within operations. - */ -export function NoUnusedFragmentsRule(context) { - var operationDefs = []; - var fragmentDefs = []; - return { - OperationDefinition: function OperationDefinition(node) { - operationDefs.push(node); - return false; - }, - FragmentDefinition: function FragmentDefinition(node) { - fragmentDefs.push(node); - return false; - }, - Document: { - leave: function leave() { - var fragmentNameUsed = Object.create(null); - - for (var _i2 = 0; _i2 < operationDefs.length; _i2++) { - var operation = operationDefs[_i2]; - - for (var _i4 = 0, _context$getRecursive2 = context.getRecursivelyReferencedFragments(operation); _i4 < _context$getRecursive2.length; _i4++) { - var fragment = _context$getRecursive2[_i4]; - fragmentNameUsed[fragment.name.value] = true; - } - } - - for (var _i6 = 0; _i6 < fragmentDefs.length; _i6++) { - var fragmentDef = fragmentDefs[_i6]; - var fragName = fragmentDef.name.value; - - if (fragmentNameUsed[fragName] !== true) { - context.reportError(new GraphQLError("Fragment \"".concat(fragName, "\" is never used."), fragmentDef)); - } - } - } - } - }; -} diff --git a/alarm/node_modules/graphql/validation/rules/NoUnusedVariablesRule.d.ts b/alarm/node_modules/graphql/validation/rules/NoUnusedVariablesRule.d.ts deleted file mode 100644 index 351449d..0000000 --- a/alarm/node_modules/graphql/validation/rules/NoUnusedVariablesRule.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { ASTVisitor } from '../../language/visitor'; -import { ValidationContext } from '../ValidationContext'; - -/** - * No unused variables - * - * A GraphQL operation is only valid if all variables defined by an operation - * are used, either directly or within a spread fragment. - */ -export function NoUnusedVariablesRule(context: ValidationContext): ASTVisitor; diff --git a/alarm/node_modules/graphql/validation/rules/NoUnusedVariablesRule.js b/alarm/node_modules/graphql/validation/rules/NoUnusedVariablesRule.js deleted file mode 100644 index 10fa8c8..0000000 --- a/alarm/node_modules/graphql/validation/rules/NoUnusedVariablesRule.js +++ /dev/null @@ -1,47 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.NoUnusedVariablesRule = NoUnusedVariablesRule; - -var _GraphQLError = require("../../error/GraphQLError.js"); - -/** - * No unused variables - * - * A GraphQL operation is only valid if all variables defined by an operation - * are used, either directly or within a spread fragment. - */ -function NoUnusedVariablesRule(context) { - var variableDefs = []; - return { - OperationDefinition: { - enter: function enter() { - variableDefs = []; - }, - leave: function leave(operation) { - var variableNameUsed = Object.create(null); - var usages = context.getRecursiveVariableUsages(operation); - - for (var _i2 = 0; _i2 < usages.length; _i2++) { - var _ref2 = usages[_i2]; - var node = _ref2.node; - variableNameUsed[node.name.value] = true; - } - - for (var _i4 = 0, _variableDefs2 = variableDefs; _i4 < _variableDefs2.length; _i4++) { - var variableDef = _variableDefs2[_i4]; - var variableName = variableDef.variable.name.value; - - if (variableNameUsed[variableName] !== true) { - context.reportError(new _GraphQLError.GraphQLError(operation.name ? "Variable \"$".concat(variableName, "\" is never used in operation \"").concat(operation.name.value, "\".") : "Variable \"$".concat(variableName, "\" is never used."), variableDef)); - } - } - } - }, - VariableDefinition: function VariableDefinition(def) { - variableDefs.push(def); - } - }; -} diff --git a/alarm/node_modules/graphql/validation/rules/NoUnusedVariablesRule.js.flow b/alarm/node_modules/graphql/validation/rules/NoUnusedVariablesRule.js.flow deleted file mode 100644 index ed284c8..0000000 --- a/alarm/node_modules/graphql/validation/rules/NoUnusedVariablesRule.js.flow +++ /dev/null @@ -1,49 +0,0 @@ -// @flow strict -import { GraphQLError } from '../../error/GraphQLError'; - -import type { ASTVisitor } from '../../language/visitor'; - -import type { ValidationContext } from '../ValidationContext'; - -/** - * No unused variables - * - * A GraphQL operation is only valid if all variables defined by an operation - * are used, either directly or within a spread fragment. - */ -export function NoUnusedVariablesRule(context: ValidationContext): ASTVisitor { - let variableDefs = []; - - return { - OperationDefinition: { - enter() { - variableDefs = []; - }, - leave(operation) { - const variableNameUsed = Object.create(null); - const usages = context.getRecursiveVariableUsages(operation); - - for (const { node } of usages) { - variableNameUsed[node.name.value] = true; - } - - for (const variableDef of variableDefs) { - const variableName = variableDef.variable.name.value; - if (variableNameUsed[variableName] !== true) { - context.reportError( - new GraphQLError( - operation.name - ? `Variable "$${variableName}" is never used in operation "${operation.name.value}".` - : `Variable "$${variableName}" is never used.`, - variableDef, - ), - ); - } - } - }, - }, - VariableDefinition(def) { - variableDefs.push(def); - }, - }; -} diff --git a/alarm/node_modules/graphql/validation/rules/NoUnusedVariablesRule.mjs b/alarm/node_modules/graphql/validation/rules/NoUnusedVariablesRule.mjs deleted file mode 100644 index df62472..0000000 --- a/alarm/node_modules/graphql/validation/rules/NoUnusedVariablesRule.mjs +++ /dev/null @@ -1,40 +0,0 @@ -import { GraphQLError } from "../../error/GraphQLError.mjs"; - -/** - * No unused variables - * - * A GraphQL operation is only valid if all variables defined by an operation - * are used, either directly or within a spread fragment. - */ -export function NoUnusedVariablesRule(context) { - var variableDefs = []; - return { - OperationDefinition: { - enter: function enter() { - variableDefs = []; - }, - leave: function leave(operation) { - var variableNameUsed = Object.create(null); - var usages = context.getRecursiveVariableUsages(operation); - - for (var _i2 = 0; _i2 < usages.length; _i2++) { - var _ref2 = usages[_i2]; - var node = _ref2.node; - variableNameUsed[node.name.value] = true; - } - - for (var _i4 = 0, _variableDefs2 = variableDefs; _i4 < _variableDefs2.length; _i4++) { - var variableDef = _variableDefs2[_i4]; - var variableName = variableDef.variable.name.value; - - if (variableNameUsed[variableName] !== true) { - context.reportError(new GraphQLError(operation.name ? "Variable \"$".concat(variableName, "\" is never used in operation \"").concat(operation.name.value, "\".") : "Variable \"$".concat(variableName, "\" is never used."), variableDef)); - } - } - } - }, - VariableDefinition: function VariableDefinition(def) { - variableDefs.push(def); - } - }; -} diff --git a/alarm/node_modules/graphql/validation/rules/OverlappingFieldsCanBeMergedRule.d.ts b/alarm/node_modules/graphql/validation/rules/OverlappingFieldsCanBeMergedRule.d.ts deleted file mode 100644 index c1671c2..0000000 --- a/alarm/node_modules/graphql/validation/rules/OverlappingFieldsCanBeMergedRule.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { ASTVisitor } from '../../language/visitor'; -import { ValidationContext } from '../ValidationContext'; - -/** - * Overlapping fields can be merged - * - * A selection set is only valid if all fields (including spreading any - * fragments) either correspond to distinct response names or can be merged - * without ambiguity. - */ -export function OverlappingFieldsCanBeMergedRule( - context: ValidationContext, -): ASTVisitor; diff --git a/alarm/node_modules/graphql/validation/rules/OverlappingFieldsCanBeMergedRule.js b/alarm/node_modules/graphql/validation/rules/OverlappingFieldsCanBeMergedRule.js deleted file mode 100644 index 3fd1813..0000000 --- a/alarm/node_modules/graphql/validation/rules/OverlappingFieldsCanBeMergedRule.js +++ /dev/null @@ -1,584 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.OverlappingFieldsCanBeMergedRule = OverlappingFieldsCanBeMergedRule; - -var _find = _interopRequireDefault(require("../../polyfills/find.js")); - -var _objectEntries3 = _interopRequireDefault(require("../../polyfills/objectEntries.js")); - -var _inspect = _interopRequireDefault(require("../../jsutils/inspect.js")); - -var _GraphQLError = require("../../error/GraphQLError.js"); - -var _kinds = require("../../language/kinds.js"); - -var _printer = require("../../language/printer.js"); - -var _definition = require("../../type/definition.js"); - -var _typeFromAST = require("../../utilities/typeFromAST.js"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function reasonMessage(reason) { - if (Array.isArray(reason)) { - return reason.map(function (_ref) { - var responseName = _ref[0], - subReason = _ref[1]; - return "subfields \"".concat(responseName, "\" conflict because ") + reasonMessage(subReason); - }).join(' and '); - } - - return reason; -} -/** - * Overlapping fields can be merged - * - * A selection set is only valid if all fields (including spreading any - * fragments) either correspond to distinct response names or can be merged - * without ambiguity. - */ - - -function OverlappingFieldsCanBeMergedRule(context) { - // A memoization for when two fragments are compared "between" each other for - // conflicts. Two fragments may be compared many times, so memoizing this can - // dramatically improve the performance of this validator. - var comparedFragmentPairs = new PairSet(); // A cache for the "field map" and list of fragment names found in any given - // selection set. Selection sets may be asked for this information multiple - // times, so this improves the performance of this validator. - - var cachedFieldsAndFragmentNames = new Map(); - return { - SelectionSet: function SelectionSet(selectionSet) { - var conflicts = findConflictsWithinSelectionSet(context, cachedFieldsAndFragmentNames, comparedFragmentPairs, context.getParentType(), selectionSet); - - for (var _i2 = 0; _i2 < conflicts.length; _i2++) { - var _ref3 = conflicts[_i2]; - var _ref2$ = _ref3[0]; - var responseName = _ref2$[0]; - var reason = _ref2$[1]; - var fields1 = _ref3[1]; - var fields2 = _ref3[2]; - var reasonMsg = reasonMessage(reason); - context.reportError(new _GraphQLError.GraphQLError("Fields \"".concat(responseName, "\" conflict because ").concat(reasonMsg, ". Use different aliases on the fields to fetch both if this was intentional."), fields1.concat(fields2))); - } - } - }; -} - -/** - * Algorithm: - * - * Conflicts occur when two fields exist in a query which will produce the same - * response name, but represent differing values, thus creating a conflict. - * The algorithm below finds all conflicts via making a series of comparisons - * between fields. In order to compare as few fields as possible, this makes - * a series of comparisons "within" sets of fields and "between" sets of fields. - * - * Given any selection set, a collection produces both a set of fields by - * also including all inline fragments, as well as a list of fragments - * referenced by fragment spreads. - * - * A) Each selection set represented in the document first compares "within" its - * collected set of fields, finding any conflicts between every pair of - * overlapping fields. - * Note: This is the *only time* that a the fields "within" a set are compared - * to each other. After this only fields "between" sets are compared. - * - * B) Also, if any fragment is referenced in a selection set, then a - * comparison is made "between" the original set of fields and the - * referenced fragment. - * - * C) Also, if multiple fragments are referenced, then comparisons - * are made "between" each referenced fragment. - * - * D) When comparing "between" a set of fields and a referenced fragment, first - * a comparison is made between each field in the original set of fields and - * each field in the the referenced set of fields. - * - * E) Also, if any fragment is referenced in the referenced selection set, - * then a comparison is made "between" the original set of fields and the - * referenced fragment (recursively referring to step D). - * - * F) When comparing "between" two fragments, first a comparison is made between - * each field in the first referenced set of fields and each field in the the - * second referenced set of fields. - * - * G) Also, any fragments referenced by the first must be compared to the - * second, and any fragments referenced by the second must be compared to the - * first (recursively referring to step F). - * - * H) When comparing two fields, if both have selection sets, then a comparison - * is made "between" both selection sets, first comparing the set of fields in - * the first selection set with the set of fields in the second. - * - * I) Also, if any fragment is referenced in either selection set, then a - * comparison is made "between" the other set of fields and the - * referenced fragment. - * - * J) Also, if two fragments are referenced in both selection sets, then a - * comparison is made "between" the two fragments. - * - */ -// Find all conflicts found "within" a selection set, including those found -// via spreading in fragments. Called when visiting each SelectionSet in the -// GraphQL Document. -function findConflictsWithinSelectionSet(context, cachedFieldsAndFragmentNames, comparedFragmentPairs, parentType, selectionSet) { - var conflicts = []; - - var _getFieldsAndFragment = getFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames, parentType, selectionSet), - fieldMap = _getFieldsAndFragment[0], - fragmentNames = _getFieldsAndFragment[1]; // (A) Find find all conflicts "within" the fields of this selection set. - // Note: this is the *only place* `collectConflictsWithin` is called. - - - collectConflictsWithin(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, fieldMap); - - if (fragmentNames.length !== 0) { - // (B) Then collect conflicts between these fields and those represented by - // each spread fragment name found. - for (var i = 0; i < fragmentNames.length; i++) { - collectConflictsBetweenFieldsAndFragment(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, false, fieldMap, fragmentNames[i]); // (C) Then compare this fragment with all other fragments found in this - // selection set to collect conflicts between fragments spread together. - // This compares each item in the list of fragment names to every other - // item in that same list (except for itself). - - for (var j = i + 1; j < fragmentNames.length; j++) { - collectConflictsBetweenFragments(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, false, fragmentNames[i], fragmentNames[j]); - } - } - } - - return conflicts; -} // Collect all conflicts found between a set of fields and a fragment reference -// including via spreading in any nested fragments. - - -function collectConflictsBetweenFieldsAndFragment(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, fieldMap, fragmentName) { - var fragment = context.getFragment(fragmentName); - - if (!fragment) { - return; - } - - var _getReferencedFieldsA = getReferencedFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames, fragment), - fieldMap2 = _getReferencedFieldsA[0], - fragmentNames2 = _getReferencedFieldsA[1]; // Do not compare a fragment's fieldMap to itself. - - - if (fieldMap === fieldMap2) { - return; - } // (D) First collect any conflicts between the provided collection of fields - // and the collection of fields represented by the given fragment. - - - collectConflictsBetween(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, fieldMap, fieldMap2); // (E) Then collect any conflicts between the provided collection of fields - // and any fragment names found in the given fragment. - - for (var i = 0; i < fragmentNames2.length; i++) { - collectConflictsBetweenFieldsAndFragment(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, fieldMap, fragmentNames2[i]); - } -} // Collect all conflicts found between two fragments, including via spreading in -// any nested fragments. - - -function collectConflictsBetweenFragments(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, fragmentName1, fragmentName2) { - // No need to compare a fragment to itself. - if (fragmentName1 === fragmentName2) { - return; - } // Memoize so two fragments are not compared for conflicts more than once. - - - if (comparedFragmentPairs.has(fragmentName1, fragmentName2, areMutuallyExclusive)) { - return; - } - - comparedFragmentPairs.add(fragmentName1, fragmentName2, areMutuallyExclusive); - var fragment1 = context.getFragment(fragmentName1); - var fragment2 = context.getFragment(fragmentName2); - - if (!fragment1 || !fragment2) { - return; - } - - var _getReferencedFieldsA2 = getReferencedFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames, fragment1), - fieldMap1 = _getReferencedFieldsA2[0], - fragmentNames1 = _getReferencedFieldsA2[1]; - - var _getReferencedFieldsA3 = getReferencedFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames, fragment2), - fieldMap2 = _getReferencedFieldsA3[0], - fragmentNames2 = _getReferencedFieldsA3[1]; // (F) First, collect all conflicts between these two collections of fields - // (not including any nested fragments). - - - collectConflictsBetween(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, fieldMap1, fieldMap2); // (G) Then collect conflicts between the first fragment and any nested - // fragments spread in the second fragment. - - for (var j = 0; j < fragmentNames2.length; j++) { - collectConflictsBetweenFragments(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, fragmentName1, fragmentNames2[j]); - } // (G) Then collect conflicts between the second fragment and any nested - // fragments spread in the first fragment. - - - for (var i = 0; i < fragmentNames1.length; i++) { - collectConflictsBetweenFragments(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, fragmentNames1[i], fragmentName2); - } -} // Find all conflicts found between two selection sets, including those found -// via spreading in fragments. Called when determining if conflicts exist -// between the sub-fields of two overlapping fields. - - -function findConflictsBetweenSubSelectionSets(context, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, parentType1, selectionSet1, parentType2, selectionSet2) { - var conflicts = []; - - var _getFieldsAndFragment2 = getFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames, parentType1, selectionSet1), - fieldMap1 = _getFieldsAndFragment2[0], - fragmentNames1 = _getFieldsAndFragment2[1]; - - var _getFieldsAndFragment3 = getFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames, parentType2, selectionSet2), - fieldMap2 = _getFieldsAndFragment3[0], - fragmentNames2 = _getFieldsAndFragment3[1]; // (H) First, collect all conflicts between these two collections of field. - - - collectConflictsBetween(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, fieldMap1, fieldMap2); // (I) Then collect conflicts between the first collection of fields and - // those referenced by each fragment name associated with the second. - - if (fragmentNames2.length !== 0) { - for (var j = 0; j < fragmentNames2.length; j++) { - collectConflictsBetweenFieldsAndFragment(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, fieldMap1, fragmentNames2[j]); - } - } // (I) Then collect conflicts between the second collection of fields and - // those referenced by each fragment name associated with the first. - - - if (fragmentNames1.length !== 0) { - for (var i = 0; i < fragmentNames1.length; i++) { - collectConflictsBetweenFieldsAndFragment(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, fieldMap2, fragmentNames1[i]); - } - } // (J) Also collect conflicts between any fragment names by the first and - // fragment names by the second. This compares each item in the first set of - // names to each item in the second set of names. - - - for (var _i3 = 0; _i3 < fragmentNames1.length; _i3++) { - for (var _j = 0; _j < fragmentNames2.length; _j++) { - collectConflictsBetweenFragments(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, fragmentNames1[_i3], fragmentNames2[_j]); - } - } - - return conflicts; -} // Collect all Conflicts "within" one collection of fields. - - -function collectConflictsWithin(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, fieldMap) { - // A field map is a keyed collection, where each key represents a response - // name and the value at that key is a list of all fields which provide that - // response name. For every response name, if there are multiple fields, they - // must be compared to find a potential conflict. - for (var _i5 = 0, _objectEntries2 = (0, _objectEntries3.default)(fieldMap); _i5 < _objectEntries2.length; _i5++) { - var _ref5 = _objectEntries2[_i5]; - var responseName = _ref5[0]; - var fields = _ref5[1]; - - // This compares every field in the list to every other field in this list - // (except to itself). If the list only has one item, nothing needs to - // be compared. - if (fields.length > 1) { - for (var i = 0; i < fields.length; i++) { - for (var j = i + 1; j < fields.length; j++) { - var conflict = findConflict(context, cachedFieldsAndFragmentNames, comparedFragmentPairs, false, // within one collection is never mutually exclusive - responseName, fields[i], fields[j]); - - if (conflict) { - conflicts.push(conflict); - } - } - } - } - } -} // Collect all Conflicts between two collections of fields. This is similar to, -// but different from the `collectConflictsWithin` function above. This check -// assumes that `collectConflictsWithin` has already been called on each -// provided collection of fields. This is true because this validator traverses -// each individual selection set. - - -function collectConflictsBetween(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, parentFieldsAreMutuallyExclusive, fieldMap1, fieldMap2) { - // A field map is a keyed collection, where each key represents a response - // name and the value at that key is a list of all fields which provide that - // response name. For any response name which appears in both provided field - // maps, each field from the first field map must be compared to every field - // in the second field map to find potential conflicts. - for (var _i7 = 0, _Object$keys2 = Object.keys(fieldMap1); _i7 < _Object$keys2.length; _i7++) { - var responseName = _Object$keys2[_i7]; - var fields2 = fieldMap2[responseName]; - - if (fields2) { - var fields1 = fieldMap1[responseName]; - - for (var i = 0; i < fields1.length; i++) { - for (var j = 0; j < fields2.length; j++) { - var conflict = findConflict(context, cachedFieldsAndFragmentNames, comparedFragmentPairs, parentFieldsAreMutuallyExclusive, responseName, fields1[i], fields2[j]); - - if (conflict) { - conflicts.push(conflict); - } - } - } - } - } -} // Determines if there is a conflict between two particular fields, including -// comparing their sub-fields. - - -function findConflict(context, cachedFieldsAndFragmentNames, comparedFragmentPairs, parentFieldsAreMutuallyExclusive, responseName, field1, field2) { - var parentType1 = field1[0], - node1 = field1[1], - def1 = field1[2]; - var parentType2 = field2[0], - node2 = field2[1], - def2 = field2[2]; // If it is known that two fields could not possibly apply at the same - // time, due to the parent types, then it is safe to permit them to diverge - // in aliased field or arguments used as they will not present any ambiguity - // by differing. - // It is known that two parent types could never overlap if they are - // different Object types. Interface or Union types might overlap - if not - // in the current state of the schema, then perhaps in some future version, - // thus may not safely diverge. - - var areMutuallyExclusive = parentFieldsAreMutuallyExclusive || parentType1 !== parentType2 && (0, _definition.isObjectType)(parentType1) && (0, _definition.isObjectType)(parentType2); - - if (!areMutuallyExclusive) { - var _node1$arguments, _node2$arguments; - - // Two aliases must refer to the same field. - var name1 = node1.name.value; - var name2 = node2.name.value; - - if (name1 !== name2) { - return [[responseName, "\"".concat(name1, "\" and \"").concat(name2, "\" are different fields")], [node1], [node2]]; - } // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - - - var args1 = (_node1$arguments = node1.arguments) !== null && _node1$arguments !== void 0 ? _node1$arguments : []; // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - - var args2 = (_node2$arguments = node2.arguments) !== null && _node2$arguments !== void 0 ? _node2$arguments : []; // Two field calls must have the same arguments. - - if (!sameArguments(args1, args2)) { - return [[responseName, 'they have differing arguments'], [node1], [node2]]; - } - } // The return type for each field. - - - var type1 = def1 === null || def1 === void 0 ? void 0 : def1.type; - var type2 = def2 === null || def2 === void 0 ? void 0 : def2.type; - - if (type1 && type2 && doTypesConflict(type1, type2)) { - return [[responseName, "they return conflicting types \"".concat((0, _inspect.default)(type1), "\" and \"").concat((0, _inspect.default)(type2), "\"")], [node1], [node2]]; - } // Collect and compare sub-fields. Use the same "visited fragment names" list - // for both collections so fields in a fragment reference are never - // compared to themselves. - - - var selectionSet1 = node1.selectionSet; - var selectionSet2 = node2.selectionSet; - - if (selectionSet1 && selectionSet2) { - var conflicts = findConflictsBetweenSubSelectionSets(context, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, (0, _definition.getNamedType)(type1), selectionSet1, (0, _definition.getNamedType)(type2), selectionSet2); - return subfieldConflicts(conflicts, responseName, node1, node2); - } -} - -function sameArguments(arguments1, arguments2) { - if (arguments1.length !== arguments2.length) { - return false; - } - - return arguments1.every(function (argument1) { - var argument2 = (0, _find.default)(arguments2, function (argument) { - return argument.name.value === argument1.name.value; - }); - - if (!argument2) { - return false; - } - - return sameValue(argument1.value, argument2.value); - }); -} - -function sameValue(value1, value2) { - return (0, _printer.print)(value1) === (0, _printer.print)(value2); -} // Two types conflict if both types could not apply to a value simultaneously. -// Composite types are ignored as their individual field types will be compared -// later recursively. However List and Non-Null types must match. - - -function doTypesConflict(type1, type2) { - if ((0, _definition.isListType)(type1)) { - return (0, _definition.isListType)(type2) ? doTypesConflict(type1.ofType, type2.ofType) : true; - } - - if ((0, _definition.isListType)(type2)) { - return true; - } - - if ((0, _definition.isNonNullType)(type1)) { - return (0, _definition.isNonNullType)(type2) ? doTypesConflict(type1.ofType, type2.ofType) : true; - } - - if ((0, _definition.isNonNullType)(type2)) { - return true; - } - - if ((0, _definition.isLeafType)(type1) || (0, _definition.isLeafType)(type2)) { - return type1 !== type2; - } - - return false; -} // Given a selection set, return the collection of fields (a mapping of response -// name to field nodes and definitions) as well as a list of fragment names -// referenced via fragment spreads. - - -function getFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames, parentType, selectionSet) { - var cached = cachedFieldsAndFragmentNames.get(selectionSet); - - if (!cached) { - var nodeAndDefs = Object.create(null); - var fragmentNames = Object.create(null); - - _collectFieldsAndFragmentNames(context, parentType, selectionSet, nodeAndDefs, fragmentNames); - - cached = [nodeAndDefs, Object.keys(fragmentNames)]; - cachedFieldsAndFragmentNames.set(selectionSet, cached); - } - - return cached; -} // Given a reference to a fragment, return the represented collection of fields -// as well as a list of nested fragment names referenced via fragment spreads. - - -function getReferencedFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames, fragment) { - // Short-circuit building a type from the node if possible. - var cached = cachedFieldsAndFragmentNames.get(fragment.selectionSet); - - if (cached) { - return cached; - } - - var fragmentType = (0, _typeFromAST.typeFromAST)(context.getSchema(), fragment.typeCondition); - return getFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames, fragmentType, fragment.selectionSet); -} - -function _collectFieldsAndFragmentNames(context, parentType, selectionSet, nodeAndDefs, fragmentNames) { - for (var _i9 = 0, _selectionSet$selecti2 = selectionSet.selections; _i9 < _selectionSet$selecti2.length; _i9++) { - var selection = _selectionSet$selecti2[_i9]; - - switch (selection.kind) { - case _kinds.Kind.FIELD: - { - var fieldName = selection.name.value; - var fieldDef = void 0; - - if ((0, _definition.isObjectType)(parentType) || (0, _definition.isInterfaceType)(parentType)) { - fieldDef = parentType.getFields()[fieldName]; - } - - var responseName = selection.alias ? selection.alias.value : fieldName; - - if (!nodeAndDefs[responseName]) { - nodeAndDefs[responseName] = []; - } - - nodeAndDefs[responseName].push([parentType, selection, fieldDef]); - break; - } - - case _kinds.Kind.FRAGMENT_SPREAD: - fragmentNames[selection.name.value] = true; - break; - - case _kinds.Kind.INLINE_FRAGMENT: - { - var typeCondition = selection.typeCondition; - var inlineFragmentType = typeCondition ? (0, _typeFromAST.typeFromAST)(context.getSchema(), typeCondition) : parentType; - - _collectFieldsAndFragmentNames(context, inlineFragmentType, selection.selectionSet, nodeAndDefs, fragmentNames); - - break; - } - } - } -} // Given a series of Conflicts which occurred between two sub-fields, generate -// a single Conflict. - - -function subfieldConflicts(conflicts, responseName, node1, node2) { - if (conflicts.length > 0) { - return [[responseName, conflicts.map(function (_ref6) { - var reason = _ref6[0]; - return reason; - })], conflicts.reduce(function (allFields, _ref7) { - var fields1 = _ref7[1]; - return allFields.concat(fields1); - }, [node1]), conflicts.reduce(function (allFields, _ref8) { - var fields2 = _ref8[2]; - return allFields.concat(fields2); - }, [node2])]; - } -} -/** - * A way to keep track of pairs of things when the ordering of the pair does - * not matter. We do this by maintaining a sort of double adjacency sets. - */ - - -var PairSet = /*#__PURE__*/function () { - function PairSet() { - this._data = Object.create(null); - } - - var _proto = PairSet.prototype; - - _proto.has = function has(a, b, areMutuallyExclusive) { - var first = this._data[a]; - var result = first && first[b]; - - if (result === undefined) { - return false; - } // areMutuallyExclusive being false is a superset of being true, - // hence if we want to know if this PairSet "has" these two with no - // exclusivity, we have to ensure it was added as such. - - - if (areMutuallyExclusive === false) { - return result === false; - } - - return true; - }; - - _proto.add = function add(a, b, areMutuallyExclusive) { - this._pairSetAdd(a, b, areMutuallyExclusive); - - this._pairSetAdd(b, a, areMutuallyExclusive); - }; - - _proto._pairSetAdd = function _pairSetAdd(a, b, areMutuallyExclusive) { - var map = this._data[a]; - - if (!map) { - map = Object.create(null); - this._data[a] = map; - } - - map[b] = areMutuallyExclusive; - }; - - return PairSet; -}(); diff --git a/alarm/node_modules/graphql/validation/rules/OverlappingFieldsCanBeMergedRule.js.flow b/alarm/node_modules/graphql/validation/rules/OverlappingFieldsCanBeMergedRule.js.flow deleted file mode 100644 index eea7e45..0000000 --- a/alarm/node_modules/graphql/validation/rules/OverlappingFieldsCanBeMergedRule.js.flow +++ /dev/null @@ -1,833 +0,0 @@ -// @flow strict -import find from '../../polyfills/find'; -import objectEntries from '../../polyfills/objectEntries'; - -import type { ObjMap } from '../../jsutils/ObjMap'; -import inspect from '../../jsutils/inspect'; - -import { GraphQLError } from '../../error/GraphQLError'; - -import type { ASTVisitor } from '../../language/visitor'; -import type { - SelectionSetNode, - ValueNode, - FieldNode, - ArgumentNode, - FragmentDefinitionNode, -} from '../../language/ast'; -import { Kind } from '../../language/kinds'; -import { print } from '../../language/printer'; - -import type { - GraphQLNamedType, - GraphQLOutputType, - GraphQLCompositeType, - GraphQLField, -} from '../../type/definition'; -import { - getNamedType, - isNonNullType, - isLeafType, - isObjectType, - isListType, - isInterfaceType, -} from '../../type/definition'; - -import { typeFromAST } from '../../utilities/typeFromAST'; - -import type { ValidationContext } from '../ValidationContext'; - -function reasonMessage(reason: ConflictReasonMessage): string { - if (Array.isArray(reason)) { - return reason - .map( - ([responseName, subReason]) => - `subfields "${responseName}" conflict because ` + - reasonMessage(subReason), - ) - .join(' and '); - } - return reason; -} - -/** - * Overlapping fields can be merged - * - * A selection set is only valid if all fields (including spreading any - * fragments) either correspond to distinct response names or can be merged - * without ambiguity. - */ -export function OverlappingFieldsCanBeMergedRule( - context: ValidationContext, -): ASTVisitor { - // A memoization for when two fragments are compared "between" each other for - // conflicts. Two fragments may be compared many times, so memoizing this can - // dramatically improve the performance of this validator. - const comparedFragmentPairs = new PairSet(); - - // A cache for the "field map" and list of fragment names found in any given - // selection set. Selection sets may be asked for this information multiple - // times, so this improves the performance of this validator. - const cachedFieldsAndFragmentNames = new Map(); - - return { - SelectionSet(selectionSet) { - const conflicts = findConflictsWithinSelectionSet( - context, - cachedFieldsAndFragmentNames, - comparedFragmentPairs, - context.getParentType(), - selectionSet, - ); - for (const [[responseName, reason], fields1, fields2] of conflicts) { - const reasonMsg = reasonMessage(reason); - context.reportError( - new GraphQLError( - `Fields "${responseName}" conflict because ${reasonMsg}. Use different aliases on the fields to fetch both if this was intentional.`, - fields1.concat(fields2), - ), - ); - } - }, - }; -} - -type Conflict = [ConflictReason, Array<FieldNode>, Array<FieldNode>]; -// Field name and reason. -type ConflictReason = [string, ConflictReasonMessage]; -// Reason is a string, or a nested list of conflicts. -type ConflictReasonMessage = string | Array<ConflictReason>; -// Tuple defining a field node in a context. -type NodeAndDef = [ - GraphQLCompositeType, - FieldNode, - ?GraphQLField<mixed, mixed>, -]; -// Map of array of those. -type NodeAndDefCollection = ObjMap<Array<NodeAndDef>>; - -/** - * Algorithm: - * - * Conflicts occur when two fields exist in a query which will produce the same - * response name, but represent differing values, thus creating a conflict. - * The algorithm below finds all conflicts via making a series of comparisons - * between fields. In order to compare as few fields as possible, this makes - * a series of comparisons "within" sets of fields and "between" sets of fields. - * - * Given any selection set, a collection produces both a set of fields by - * also including all inline fragments, as well as a list of fragments - * referenced by fragment spreads. - * - * A) Each selection set represented in the document first compares "within" its - * collected set of fields, finding any conflicts between every pair of - * overlapping fields. - * Note: This is the *only time* that a the fields "within" a set are compared - * to each other. After this only fields "between" sets are compared. - * - * B) Also, if any fragment is referenced in a selection set, then a - * comparison is made "between" the original set of fields and the - * referenced fragment. - * - * C) Also, if multiple fragments are referenced, then comparisons - * are made "between" each referenced fragment. - * - * D) When comparing "between" a set of fields and a referenced fragment, first - * a comparison is made between each field in the original set of fields and - * each field in the the referenced set of fields. - * - * E) Also, if any fragment is referenced in the referenced selection set, - * then a comparison is made "between" the original set of fields and the - * referenced fragment (recursively referring to step D). - * - * F) When comparing "between" two fragments, first a comparison is made between - * each field in the first referenced set of fields and each field in the the - * second referenced set of fields. - * - * G) Also, any fragments referenced by the first must be compared to the - * second, and any fragments referenced by the second must be compared to the - * first (recursively referring to step F). - * - * H) When comparing two fields, if both have selection sets, then a comparison - * is made "between" both selection sets, first comparing the set of fields in - * the first selection set with the set of fields in the second. - * - * I) Also, if any fragment is referenced in either selection set, then a - * comparison is made "between" the other set of fields and the - * referenced fragment. - * - * J) Also, if two fragments are referenced in both selection sets, then a - * comparison is made "between" the two fragments. - * - */ - -// Find all conflicts found "within" a selection set, including those found -// via spreading in fragments. Called when visiting each SelectionSet in the -// GraphQL Document. -function findConflictsWithinSelectionSet( - context: ValidationContext, - cachedFieldsAndFragmentNames, - comparedFragmentPairs: PairSet, - parentType: ?GraphQLNamedType, - selectionSet: SelectionSetNode, -): Array<Conflict> { - const conflicts = []; - - const [fieldMap, fragmentNames] = getFieldsAndFragmentNames( - context, - cachedFieldsAndFragmentNames, - parentType, - selectionSet, - ); - - // (A) Find find all conflicts "within" the fields of this selection set. - // Note: this is the *only place* `collectConflictsWithin` is called. - collectConflictsWithin( - context, - conflicts, - cachedFieldsAndFragmentNames, - comparedFragmentPairs, - fieldMap, - ); - - if (fragmentNames.length !== 0) { - // (B) Then collect conflicts between these fields and those represented by - // each spread fragment name found. - for (let i = 0; i < fragmentNames.length; i++) { - collectConflictsBetweenFieldsAndFragment( - context, - conflicts, - cachedFieldsAndFragmentNames, - comparedFragmentPairs, - false, - fieldMap, - fragmentNames[i], - ); - // (C) Then compare this fragment with all other fragments found in this - // selection set to collect conflicts between fragments spread together. - // This compares each item in the list of fragment names to every other - // item in that same list (except for itself). - for (let j = i + 1; j < fragmentNames.length; j++) { - collectConflictsBetweenFragments( - context, - conflicts, - cachedFieldsAndFragmentNames, - comparedFragmentPairs, - false, - fragmentNames[i], - fragmentNames[j], - ); - } - } - } - return conflicts; -} - -// Collect all conflicts found between a set of fields and a fragment reference -// including via spreading in any nested fragments. -function collectConflictsBetweenFieldsAndFragment( - context: ValidationContext, - conflicts: Array<Conflict>, - cachedFieldsAndFragmentNames, - comparedFragmentPairs: PairSet, - areMutuallyExclusive: boolean, - fieldMap: NodeAndDefCollection, - fragmentName: string, -): void { - const fragment = context.getFragment(fragmentName); - if (!fragment) { - return; - } - - const [fieldMap2, fragmentNames2] = getReferencedFieldsAndFragmentNames( - context, - cachedFieldsAndFragmentNames, - fragment, - ); - - // Do not compare a fragment's fieldMap to itself. - if (fieldMap === fieldMap2) { - return; - } - - // (D) First collect any conflicts between the provided collection of fields - // and the collection of fields represented by the given fragment. - collectConflictsBetween( - context, - conflicts, - cachedFieldsAndFragmentNames, - comparedFragmentPairs, - areMutuallyExclusive, - fieldMap, - fieldMap2, - ); - - // (E) Then collect any conflicts between the provided collection of fields - // and any fragment names found in the given fragment. - for (let i = 0; i < fragmentNames2.length; i++) { - collectConflictsBetweenFieldsAndFragment( - context, - conflicts, - cachedFieldsAndFragmentNames, - comparedFragmentPairs, - areMutuallyExclusive, - fieldMap, - fragmentNames2[i], - ); - } -} - -// Collect all conflicts found between two fragments, including via spreading in -// any nested fragments. -function collectConflictsBetweenFragments( - context: ValidationContext, - conflicts: Array<Conflict>, - cachedFieldsAndFragmentNames, - comparedFragmentPairs: PairSet, - areMutuallyExclusive: boolean, - fragmentName1: string, - fragmentName2: string, -): void { - // No need to compare a fragment to itself. - if (fragmentName1 === fragmentName2) { - return; - } - - // Memoize so two fragments are not compared for conflicts more than once. - if ( - comparedFragmentPairs.has( - fragmentName1, - fragmentName2, - areMutuallyExclusive, - ) - ) { - return; - } - comparedFragmentPairs.add(fragmentName1, fragmentName2, areMutuallyExclusive); - - const fragment1 = context.getFragment(fragmentName1); - const fragment2 = context.getFragment(fragmentName2); - if (!fragment1 || !fragment2) { - return; - } - - const [fieldMap1, fragmentNames1] = getReferencedFieldsAndFragmentNames( - context, - cachedFieldsAndFragmentNames, - fragment1, - ); - const [fieldMap2, fragmentNames2] = getReferencedFieldsAndFragmentNames( - context, - cachedFieldsAndFragmentNames, - fragment2, - ); - - // (F) First, collect all conflicts between these two collections of fields - // (not including any nested fragments). - collectConflictsBetween( - context, - conflicts, - cachedFieldsAndFragmentNames, - comparedFragmentPairs, - areMutuallyExclusive, - fieldMap1, - fieldMap2, - ); - - // (G) Then collect conflicts between the first fragment and any nested - // fragments spread in the second fragment. - for (let j = 0; j < fragmentNames2.length; j++) { - collectConflictsBetweenFragments( - context, - conflicts, - cachedFieldsAndFragmentNames, - comparedFragmentPairs, - areMutuallyExclusive, - fragmentName1, - fragmentNames2[j], - ); - } - - // (G) Then collect conflicts between the second fragment and any nested - // fragments spread in the first fragment. - for (let i = 0; i < fragmentNames1.length; i++) { - collectConflictsBetweenFragments( - context, - conflicts, - cachedFieldsAndFragmentNames, - comparedFragmentPairs, - areMutuallyExclusive, - fragmentNames1[i], - fragmentName2, - ); - } -} - -// Find all conflicts found between two selection sets, including those found -// via spreading in fragments. Called when determining if conflicts exist -// between the sub-fields of two overlapping fields. -function findConflictsBetweenSubSelectionSets( - context: ValidationContext, - cachedFieldsAndFragmentNames, - comparedFragmentPairs: PairSet, - areMutuallyExclusive: boolean, - parentType1: ?GraphQLNamedType, - selectionSet1: SelectionSetNode, - parentType2: ?GraphQLNamedType, - selectionSet2: SelectionSetNode, -): Array<Conflict> { - const conflicts = []; - - const [fieldMap1, fragmentNames1] = getFieldsAndFragmentNames( - context, - cachedFieldsAndFragmentNames, - parentType1, - selectionSet1, - ); - const [fieldMap2, fragmentNames2] = getFieldsAndFragmentNames( - context, - cachedFieldsAndFragmentNames, - parentType2, - selectionSet2, - ); - - // (H) First, collect all conflicts between these two collections of field. - collectConflictsBetween( - context, - conflicts, - cachedFieldsAndFragmentNames, - comparedFragmentPairs, - areMutuallyExclusive, - fieldMap1, - fieldMap2, - ); - - // (I) Then collect conflicts between the first collection of fields and - // those referenced by each fragment name associated with the second. - if (fragmentNames2.length !== 0) { - for (let j = 0; j < fragmentNames2.length; j++) { - collectConflictsBetweenFieldsAndFragment( - context, - conflicts, - cachedFieldsAndFragmentNames, - comparedFragmentPairs, - areMutuallyExclusive, - fieldMap1, - fragmentNames2[j], - ); - } - } - - // (I) Then collect conflicts between the second collection of fields and - // those referenced by each fragment name associated with the first. - if (fragmentNames1.length !== 0) { - for (let i = 0; i < fragmentNames1.length; i++) { - collectConflictsBetweenFieldsAndFragment( - context, - conflicts, - cachedFieldsAndFragmentNames, - comparedFragmentPairs, - areMutuallyExclusive, - fieldMap2, - fragmentNames1[i], - ); - } - } - - // (J) Also collect conflicts between any fragment names by the first and - // fragment names by the second. This compares each item in the first set of - // names to each item in the second set of names. - for (let i = 0; i < fragmentNames1.length; i++) { - for (let j = 0; j < fragmentNames2.length; j++) { - collectConflictsBetweenFragments( - context, - conflicts, - cachedFieldsAndFragmentNames, - comparedFragmentPairs, - areMutuallyExclusive, - fragmentNames1[i], - fragmentNames2[j], - ); - } - } - return conflicts; -} - -// Collect all Conflicts "within" one collection of fields. -function collectConflictsWithin( - context: ValidationContext, - conflicts: Array<Conflict>, - cachedFieldsAndFragmentNames, - comparedFragmentPairs: PairSet, - fieldMap: NodeAndDefCollection, -): void { - // A field map is a keyed collection, where each key represents a response - // name and the value at that key is a list of all fields which provide that - // response name. For every response name, if there are multiple fields, they - // must be compared to find a potential conflict. - for (const [responseName, fields] of objectEntries(fieldMap)) { - // This compares every field in the list to every other field in this list - // (except to itself). If the list only has one item, nothing needs to - // be compared. - if (fields.length > 1) { - for (let i = 0; i < fields.length; i++) { - for (let j = i + 1; j < fields.length; j++) { - const conflict = findConflict( - context, - cachedFieldsAndFragmentNames, - comparedFragmentPairs, - false, // within one collection is never mutually exclusive - responseName, - fields[i], - fields[j], - ); - if (conflict) { - conflicts.push(conflict); - } - } - } - } - } -} - -// Collect all Conflicts between two collections of fields. This is similar to, -// but different from the `collectConflictsWithin` function above. This check -// assumes that `collectConflictsWithin` has already been called on each -// provided collection of fields. This is true because this validator traverses -// each individual selection set. -function collectConflictsBetween( - context: ValidationContext, - conflicts: Array<Conflict>, - cachedFieldsAndFragmentNames, - comparedFragmentPairs: PairSet, - parentFieldsAreMutuallyExclusive: boolean, - fieldMap1: NodeAndDefCollection, - fieldMap2: NodeAndDefCollection, -): void { - // A field map is a keyed collection, where each key represents a response - // name and the value at that key is a list of all fields which provide that - // response name. For any response name which appears in both provided field - // maps, each field from the first field map must be compared to every field - // in the second field map to find potential conflicts. - for (const responseName of Object.keys(fieldMap1)) { - const fields2 = fieldMap2[responseName]; - if (fields2) { - const fields1 = fieldMap1[responseName]; - for (let i = 0; i < fields1.length; i++) { - for (let j = 0; j < fields2.length; j++) { - const conflict = findConflict( - context, - cachedFieldsAndFragmentNames, - comparedFragmentPairs, - parentFieldsAreMutuallyExclusive, - responseName, - fields1[i], - fields2[j], - ); - if (conflict) { - conflicts.push(conflict); - } - } - } - } - } -} - -// Determines if there is a conflict between two particular fields, including -// comparing their sub-fields. -function findConflict( - context: ValidationContext, - cachedFieldsAndFragmentNames, - comparedFragmentPairs: PairSet, - parentFieldsAreMutuallyExclusive: boolean, - responseName: string, - field1: NodeAndDef, - field2: NodeAndDef, -): ?Conflict { - const [parentType1, node1, def1] = field1; - const [parentType2, node2, def2] = field2; - - // If it is known that two fields could not possibly apply at the same - // time, due to the parent types, then it is safe to permit them to diverge - // in aliased field or arguments used as they will not present any ambiguity - // by differing. - // It is known that two parent types could never overlap if they are - // different Object types. Interface or Union types might overlap - if not - // in the current state of the schema, then perhaps in some future version, - // thus may not safely diverge. - const areMutuallyExclusive = - parentFieldsAreMutuallyExclusive || - (parentType1 !== parentType2 && - isObjectType(parentType1) && - isObjectType(parentType2)); - - if (!areMutuallyExclusive) { - // Two aliases must refer to the same field. - const name1 = node1.name.value; - const name2 = node2.name.value; - if (name1 !== name2) { - return [ - [responseName, `"${name1}" and "${name2}" are different fields`], - [node1], - [node2], - ]; - } - - // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - const args1 = node1.arguments ?? []; - // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - const args2 = node2.arguments ?? []; - // Two field calls must have the same arguments. - if (!sameArguments(args1, args2)) { - return [ - [responseName, 'they have differing arguments'], - [node1], - [node2], - ]; - } - } - - // The return type for each field. - const type1 = def1?.type; - const type2 = def2?.type; - - if (type1 && type2 && doTypesConflict(type1, type2)) { - return [ - [ - responseName, - `they return conflicting types "${inspect(type1)}" and "${inspect( - type2, - )}"`, - ], - [node1], - [node2], - ]; - } - - // Collect and compare sub-fields. Use the same "visited fragment names" list - // for both collections so fields in a fragment reference are never - // compared to themselves. - const selectionSet1 = node1.selectionSet; - const selectionSet2 = node2.selectionSet; - if (selectionSet1 && selectionSet2) { - const conflicts = findConflictsBetweenSubSelectionSets( - context, - cachedFieldsAndFragmentNames, - comparedFragmentPairs, - areMutuallyExclusive, - getNamedType(type1), - selectionSet1, - getNamedType(type2), - selectionSet2, - ); - return subfieldConflicts(conflicts, responseName, node1, node2); - } -} - -function sameArguments( - arguments1: $ReadOnlyArray<ArgumentNode>, - arguments2: $ReadOnlyArray<ArgumentNode>, -): boolean { - if (arguments1.length !== arguments2.length) { - return false; - } - return arguments1.every((argument1) => { - const argument2 = find( - arguments2, - (argument) => argument.name.value === argument1.name.value, - ); - if (!argument2) { - return false; - } - return sameValue(argument1.value, argument2.value); - }); -} - -function sameValue(value1: ValueNode, value2: ValueNode): boolean { - return print(value1) === print(value2); -} - -// Two types conflict if both types could not apply to a value simultaneously. -// Composite types are ignored as their individual field types will be compared -// later recursively. However List and Non-Null types must match. -function doTypesConflict( - type1: GraphQLOutputType, - type2: GraphQLOutputType, -): boolean { - if (isListType(type1)) { - return isListType(type2) - ? doTypesConflict(type1.ofType, type2.ofType) - : true; - } - if (isListType(type2)) { - return true; - } - if (isNonNullType(type1)) { - return isNonNullType(type2) - ? doTypesConflict(type1.ofType, type2.ofType) - : true; - } - if (isNonNullType(type2)) { - return true; - } - if (isLeafType(type1) || isLeafType(type2)) { - return type1 !== type2; - } - return false; -} - -// Given a selection set, return the collection of fields (a mapping of response -// name to field nodes and definitions) as well as a list of fragment names -// referenced via fragment spreads. -function getFieldsAndFragmentNames( - context: ValidationContext, - cachedFieldsAndFragmentNames, - parentType: ?GraphQLNamedType, - selectionSet: SelectionSetNode, -): [NodeAndDefCollection, Array<string>] { - let cached = cachedFieldsAndFragmentNames.get(selectionSet); - if (!cached) { - const nodeAndDefs = Object.create(null); - const fragmentNames = Object.create(null); - _collectFieldsAndFragmentNames( - context, - parentType, - selectionSet, - nodeAndDefs, - fragmentNames, - ); - cached = [nodeAndDefs, Object.keys(fragmentNames)]; - cachedFieldsAndFragmentNames.set(selectionSet, cached); - } - return cached; -} - -// Given a reference to a fragment, return the represented collection of fields -// as well as a list of nested fragment names referenced via fragment spreads. -function getReferencedFieldsAndFragmentNames( - context: ValidationContext, - cachedFieldsAndFragmentNames, - fragment: FragmentDefinitionNode, -) { - // Short-circuit building a type from the node if possible. - const cached = cachedFieldsAndFragmentNames.get(fragment.selectionSet); - if (cached) { - return cached; - } - - const fragmentType = typeFromAST(context.getSchema(), fragment.typeCondition); - return getFieldsAndFragmentNames( - context, - cachedFieldsAndFragmentNames, - fragmentType, - fragment.selectionSet, - ); -} - -function _collectFieldsAndFragmentNames( - context: ValidationContext, - parentType: ?GraphQLNamedType, - selectionSet: SelectionSetNode, - nodeAndDefs, - fragmentNames, -): void { - for (const selection of selectionSet.selections) { - switch (selection.kind) { - case Kind.FIELD: { - const fieldName = selection.name.value; - let fieldDef; - if (isObjectType(parentType) || isInterfaceType(parentType)) { - fieldDef = parentType.getFields()[fieldName]; - } - const responseName = selection.alias - ? selection.alias.value - : fieldName; - if (!nodeAndDefs[responseName]) { - nodeAndDefs[responseName] = []; - } - nodeAndDefs[responseName].push([parentType, selection, fieldDef]); - break; - } - case Kind.FRAGMENT_SPREAD: - fragmentNames[selection.name.value] = true; - break; - case Kind.INLINE_FRAGMENT: { - const typeCondition = selection.typeCondition; - const inlineFragmentType = typeCondition - ? typeFromAST(context.getSchema(), typeCondition) - : parentType; - _collectFieldsAndFragmentNames( - context, - inlineFragmentType, - selection.selectionSet, - nodeAndDefs, - fragmentNames, - ); - break; - } - } - } -} - -// Given a series of Conflicts which occurred between two sub-fields, generate -// a single Conflict. -function subfieldConflicts( - conflicts: $ReadOnlyArray<Conflict>, - responseName: string, - node1: FieldNode, - node2: FieldNode, -): ?Conflict { - if (conflicts.length > 0) { - return [ - [responseName, conflicts.map(([reason]) => reason)], - conflicts.reduce((allFields, [, fields1]) => allFields.concat(fields1), [ - node1, - ]), - conflicts.reduce( - (allFields, [, , fields2]) => allFields.concat(fields2), - [node2], - ), - ]; - } -} - -/** - * A way to keep track of pairs of things when the ordering of the pair does - * not matter. We do this by maintaining a sort of double adjacency sets. - */ -class PairSet { - _data: ObjMap<ObjMap<boolean>>; - - constructor() { - this._data = Object.create(null); - } - - has(a: string, b: string, areMutuallyExclusive: boolean): boolean { - const first = this._data[a]; - const result = first && first[b]; - if (result === undefined) { - return false; - } - // areMutuallyExclusive being false is a superset of being true, - // hence if we want to know if this PairSet "has" these two with no - // exclusivity, we have to ensure it was added as such. - if (areMutuallyExclusive === false) { - return result === false; - } - return true; - } - - add(a: string, b: string, areMutuallyExclusive: boolean): void { - this._pairSetAdd(a, b, areMutuallyExclusive); - this._pairSetAdd(b, a, areMutuallyExclusive); - } - - _pairSetAdd(a: string, b: string, areMutuallyExclusive: boolean): void { - let map = this._data[a]; - if (!map) { - map = Object.create(null); - this._data[a] = map; - } - map[b] = areMutuallyExclusive; - } -} diff --git a/alarm/node_modules/graphql/validation/rules/OverlappingFieldsCanBeMergedRule.mjs b/alarm/node_modules/graphql/validation/rules/OverlappingFieldsCanBeMergedRule.mjs deleted file mode 100644 index afc5243..0000000 --- a/alarm/node_modules/graphql/validation/rules/OverlappingFieldsCanBeMergedRule.mjs +++ /dev/null @@ -1,568 +0,0 @@ -import find from "../../polyfills/find.mjs"; -import objectEntries from "../../polyfills/objectEntries.mjs"; -import inspect from "../../jsutils/inspect.mjs"; -import { GraphQLError } from "../../error/GraphQLError.mjs"; -import { Kind } from "../../language/kinds.mjs"; -import { print } from "../../language/printer.mjs"; -import { getNamedType, isNonNullType, isLeafType, isObjectType, isListType, isInterfaceType } from "../../type/definition.mjs"; -import { typeFromAST } from "../../utilities/typeFromAST.mjs"; - -function reasonMessage(reason) { - if (Array.isArray(reason)) { - return reason.map(function (_ref) { - var responseName = _ref[0], - subReason = _ref[1]; - return "subfields \"".concat(responseName, "\" conflict because ") + reasonMessage(subReason); - }).join(' and '); - } - - return reason; -} -/** - * Overlapping fields can be merged - * - * A selection set is only valid if all fields (including spreading any - * fragments) either correspond to distinct response names or can be merged - * without ambiguity. - */ - - -export function OverlappingFieldsCanBeMergedRule(context) { - // A memoization for when two fragments are compared "between" each other for - // conflicts. Two fragments may be compared many times, so memoizing this can - // dramatically improve the performance of this validator. - var comparedFragmentPairs = new PairSet(); // A cache for the "field map" and list of fragment names found in any given - // selection set. Selection sets may be asked for this information multiple - // times, so this improves the performance of this validator. - - var cachedFieldsAndFragmentNames = new Map(); - return { - SelectionSet: function SelectionSet(selectionSet) { - var conflicts = findConflictsWithinSelectionSet(context, cachedFieldsAndFragmentNames, comparedFragmentPairs, context.getParentType(), selectionSet); - - for (var _i2 = 0; _i2 < conflicts.length; _i2++) { - var _ref3 = conflicts[_i2]; - var _ref2$ = _ref3[0]; - var responseName = _ref2$[0]; - var reason = _ref2$[1]; - var fields1 = _ref3[1]; - var fields2 = _ref3[2]; - var reasonMsg = reasonMessage(reason); - context.reportError(new GraphQLError("Fields \"".concat(responseName, "\" conflict because ").concat(reasonMsg, ". Use different aliases on the fields to fetch both if this was intentional."), fields1.concat(fields2))); - } - } - }; -} - -/** - * Algorithm: - * - * Conflicts occur when two fields exist in a query which will produce the same - * response name, but represent differing values, thus creating a conflict. - * The algorithm below finds all conflicts via making a series of comparisons - * between fields. In order to compare as few fields as possible, this makes - * a series of comparisons "within" sets of fields and "between" sets of fields. - * - * Given any selection set, a collection produces both a set of fields by - * also including all inline fragments, as well as a list of fragments - * referenced by fragment spreads. - * - * A) Each selection set represented in the document first compares "within" its - * collected set of fields, finding any conflicts between every pair of - * overlapping fields. - * Note: This is the *only time* that a the fields "within" a set are compared - * to each other. After this only fields "between" sets are compared. - * - * B) Also, if any fragment is referenced in a selection set, then a - * comparison is made "between" the original set of fields and the - * referenced fragment. - * - * C) Also, if multiple fragments are referenced, then comparisons - * are made "between" each referenced fragment. - * - * D) When comparing "between" a set of fields and a referenced fragment, first - * a comparison is made between each field in the original set of fields and - * each field in the the referenced set of fields. - * - * E) Also, if any fragment is referenced in the referenced selection set, - * then a comparison is made "between" the original set of fields and the - * referenced fragment (recursively referring to step D). - * - * F) When comparing "between" two fragments, first a comparison is made between - * each field in the first referenced set of fields and each field in the the - * second referenced set of fields. - * - * G) Also, any fragments referenced by the first must be compared to the - * second, and any fragments referenced by the second must be compared to the - * first (recursively referring to step F). - * - * H) When comparing two fields, if both have selection sets, then a comparison - * is made "between" both selection sets, first comparing the set of fields in - * the first selection set with the set of fields in the second. - * - * I) Also, if any fragment is referenced in either selection set, then a - * comparison is made "between" the other set of fields and the - * referenced fragment. - * - * J) Also, if two fragments are referenced in both selection sets, then a - * comparison is made "between" the two fragments. - * - */ -// Find all conflicts found "within" a selection set, including those found -// via spreading in fragments. Called when visiting each SelectionSet in the -// GraphQL Document. -function findConflictsWithinSelectionSet(context, cachedFieldsAndFragmentNames, comparedFragmentPairs, parentType, selectionSet) { - var conflicts = []; - - var _getFieldsAndFragment = getFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames, parentType, selectionSet), - fieldMap = _getFieldsAndFragment[0], - fragmentNames = _getFieldsAndFragment[1]; // (A) Find find all conflicts "within" the fields of this selection set. - // Note: this is the *only place* `collectConflictsWithin` is called. - - - collectConflictsWithin(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, fieldMap); - - if (fragmentNames.length !== 0) { - // (B) Then collect conflicts between these fields and those represented by - // each spread fragment name found. - for (var i = 0; i < fragmentNames.length; i++) { - collectConflictsBetweenFieldsAndFragment(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, false, fieldMap, fragmentNames[i]); // (C) Then compare this fragment with all other fragments found in this - // selection set to collect conflicts between fragments spread together. - // This compares each item in the list of fragment names to every other - // item in that same list (except for itself). - - for (var j = i + 1; j < fragmentNames.length; j++) { - collectConflictsBetweenFragments(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, false, fragmentNames[i], fragmentNames[j]); - } - } - } - - return conflicts; -} // Collect all conflicts found between a set of fields and a fragment reference -// including via spreading in any nested fragments. - - -function collectConflictsBetweenFieldsAndFragment(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, fieldMap, fragmentName) { - var fragment = context.getFragment(fragmentName); - - if (!fragment) { - return; - } - - var _getReferencedFieldsA = getReferencedFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames, fragment), - fieldMap2 = _getReferencedFieldsA[0], - fragmentNames2 = _getReferencedFieldsA[1]; // Do not compare a fragment's fieldMap to itself. - - - if (fieldMap === fieldMap2) { - return; - } // (D) First collect any conflicts between the provided collection of fields - // and the collection of fields represented by the given fragment. - - - collectConflictsBetween(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, fieldMap, fieldMap2); // (E) Then collect any conflicts between the provided collection of fields - // and any fragment names found in the given fragment. - - for (var i = 0; i < fragmentNames2.length; i++) { - collectConflictsBetweenFieldsAndFragment(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, fieldMap, fragmentNames2[i]); - } -} // Collect all conflicts found between two fragments, including via spreading in -// any nested fragments. - - -function collectConflictsBetweenFragments(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, fragmentName1, fragmentName2) { - // No need to compare a fragment to itself. - if (fragmentName1 === fragmentName2) { - return; - } // Memoize so two fragments are not compared for conflicts more than once. - - - if (comparedFragmentPairs.has(fragmentName1, fragmentName2, areMutuallyExclusive)) { - return; - } - - comparedFragmentPairs.add(fragmentName1, fragmentName2, areMutuallyExclusive); - var fragment1 = context.getFragment(fragmentName1); - var fragment2 = context.getFragment(fragmentName2); - - if (!fragment1 || !fragment2) { - return; - } - - var _getReferencedFieldsA2 = getReferencedFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames, fragment1), - fieldMap1 = _getReferencedFieldsA2[0], - fragmentNames1 = _getReferencedFieldsA2[1]; - - var _getReferencedFieldsA3 = getReferencedFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames, fragment2), - fieldMap2 = _getReferencedFieldsA3[0], - fragmentNames2 = _getReferencedFieldsA3[1]; // (F) First, collect all conflicts between these two collections of fields - // (not including any nested fragments). - - - collectConflictsBetween(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, fieldMap1, fieldMap2); // (G) Then collect conflicts between the first fragment and any nested - // fragments spread in the second fragment. - - for (var j = 0; j < fragmentNames2.length; j++) { - collectConflictsBetweenFragments(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, fragmentName1, fragmentNames2[j]); - } // (G) Then collect conflicts between the second fragment and any nested - // fragments spread in the first fragment. - - - for (var i = 0; i < fragmentNames1.length; i++) { - collectConflictsBetweenFragments(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, fragmentNames1[i], fragmentName2); - } -} // Find all conflicts found between two selection sets, including those found -// via spreading in fragments. Called when determining if conflicts exist -// between the sub-fields of two overlapping fields. - - -function findConflictsBetweenSubSelectionSets(context, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, parentType1, selectionSet1, parentType2, selectionSet2) { - var conflicts = []; - - var _getFieldsAndFragment2 = getFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames, parentType1, selectionSet1), - fieldMap1 = _getFieldsAndFragment2[0], - fragmentNames1 = _getFieldsAndFragment2[1]; - - var _getFieldsAndFragment3 = getFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames, parentType2, selectionSet2), - fieldMap2 = _getFieldsAndFragment3[0], - fragmentNames2 = _getFieldsAndFragment3[1]; // (H) First, collect all conflicts between these two collections of field. - - - collectConflictsBetween(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, fieldMap1, fieldMap2); // (I) Then collect conflicts between the first collection of fields and - // those referenced by each fragment name associated with the second. - - if (fragmentNames2.length !== 0) { - for (var j = 0; j < fragmentNames2.length; j++) { - collectConflictsBetweenFieldsAndFragment(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, fieldMap1, fragmentNames2[j]); - } - } // (I) Then collect conflicts between the second collection of fields and - // those referenced by each fragment name associated with the first. - - - if (fragmentNames1.length !== 0) { - for (var i = 0; i < fragmentNames1.length; i++) { - collectConflictsBetweenFieldsAndFragment(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, fieldMap2, fragmentNames1[i]); - } - } // (J) Also collect conflicts between any fragment names by the first and - // fragment names by the second. This compares each item in the first set of - // names to each item in the second set of names. - - - for (var _i3 = 0; _i3 < fragmentNames1.length; _i3++) { - for (var _j = 0; _j < fragmentNames2.length; _j++) { - collectConflictsBetweenFragments(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, fragmentNames1[_i3], fragmentNames2[_j]); - } - } - - return conflicts; -} // Collect all Conflicts "within" one collection of fields. - - -function collectConflictsWithin(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, fieldMap) { - // A field map is a keyed collection, where each key represents a response - // name and the value at that key is a list of all fields which provide that - // response name. For every response name, if there are multiple fields, they - // must be compared to find a potential conflict. - for (var _i5 = 0, _objectEntries2 = objectEntries(fieldMap); _i5 < _objectEntries2.length; _i5++) { - var _ref5 = _objectEntries2[_i5]; - var responseName = _ref5[0]; - var fields = _ref5[1]; - - // This compares every field in the list to every other field in this list - // (except to itself). If the list only has one item, nothing needs to - // be compared. - if (fields.length > 1) { - for (var i = 0; i < fields.length; i++) { - for (var j = i + 1; j < fields.length; j++) { - var conflict = findConflict(context, cachedFieldsAndFragmentNames, comparedFragmentPairs, false, // within one collection is never mutually exclusive - responseName, fields[i], fields[j]); - - if (conflict) { - conflicts.push(conflict); - } - } - } - } - } -} // Collect all Conflicts between two collections of fields. This is similar to, -// but different from the `collectConflictsWithin` function above. This check -// assumes that `collectConflictsWithin` has already been called on each -// provided collection of fields. This is true because this validator traverses -// each individual selection set. - - -function collectConflictsBetween(context, conflicts, cachedFieldsAndFragmentNames, comparedFragmentPairs, parentFieldsAreMutuallyExclusive, fieldMap1, fieldMap2) { - // A field map is a keyed collection, where each key represents a response - // name and the value at that key is a list of all fields which provide that - // response name. For any response name which appears in both provided field - // maps, each field from the first field map must be compared to every field - // in the second field map to find potential conflicts. - for (var _i7 = 0, _Object$keys2 = Object.keys(fieldMap1); _i7 < _Object$keys2.length; _i7++) { - var responseName = _Object$keys2[_i7]; - var fields2 = fieldMap2[responseName]; - - if (fields2) { - var fields1 = fieldMap1[responseName]; - - for (var i = 0; i < fields1.length; i++) { - for (var j = 0; j < fields2.length; j++) { - var conflict = findConflict(context, cachedFieldsAndFragmentNames, comparedFragmentPairs, parentFieldsAreMutuallyExclusive, responseName, fields1[i], fields2[j]); - - if (conflict) { - conflicts.push(conflict); - } - } - } - } - } -} // Determines if there is a conflict between two particular fields, including -// comparing their sub-fields. - - -function findConflict(context, cachedFieldsAndFragmentNames, comparedFragmentPairs, parentFieldsAreMutuallyExclusive, responseName, field1, field2) { - var parentType1 = field1[0], - node1 = field1[1], - def1 = field1[2]; - var parentType2 = field2[0], - node2 = field2[1], - def2 = field2[2]; // If it is known that two fields could not possibly apply at the same - // time, due to the parent types, then it is safe to permit them to diverge - // in aliased field or arguments used as they will not present any ambiguity - // by differing. - // It is known that two parent types could never overlap if they are - // different Object types. Interface or Union types might overlap - if not - // in the current state of the schema, then perhaps in some future version, - // thus may not safely diverge. - - var areMutuallyExclusive = parentFieldsAreMutuallyExclusive || parentType1 !== parentType2 && isObjectType(parentType1) && isObjectType(parentType2); - - if (!areMutuallyExclusive) { - var _node1$arguments, _node2$arguments; - - // Two aliases must refer to the same field. - var name1 = node1.name.value; - var name2 = node2.name.value; - - if (name1 !== name2) { - return [[responseName, "\"".concat(name1, "\" and \"").concat(name2, "\" are different fields")], [node1], [node2]]; - } // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - - - var args1 = (_node1$arguments = node1.arguments) !== null && _node1$arguments !== void 0 ? _node1$arguments : []; // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - - var args2 = (_node2$arguments = node2.arguments) !== null && _node2$arguments !== void 0 ? _node2$arguments : []; // Two field calls must have the same arguments. - - if (!sameArguments(args1, args2)) { - return [[responseName, 'they have differing arguments'], [node1], [node2]]; - } - } // The return type for each field. - - - var type1 = def1 === null || def1 === void 0 ? void 0 : def1.type; - var type2 = def2 === null || def2 === void 0 ? void 0 : def2.type; - - if (type1 && type2 && doTypesConflict(type1, type2)) { - return [[responseName, "they return conflicting types \"".concat(inspect(type1), "\" and \"").concat(inspect(type2), "\"")], [node1], [node2]]; - } // Collect and compare sub-fields. Use the same "visited fragment names" list - // for both collections so fields in a fragment reference are never - // compared to themselves. - - - var selectionSet1 = node1.selectionSet; - var selectionSet2 = node2.selectionSet; - - if (selectionSet1 && selectionSet2) { - var conflicts = findConflictsBetweenSubSelectionSets(context, cachedFieldsAndFragmentNames, comparedFragmentPairs, areMutuallyExclusive, getNamedType(type1), selectionSet1, getNamedType(type2), selectionSet2); - return subfieldConflicts(conflicts, responseName, node1, node2); - } -} - -function sameArguments(arguments1, arguments2) { - if (arguments1.length !== arguments2.length) { - return false; - } - - return arguments1.every(function (argument1) { - var argument2 = find(arguments2, function (argument) { - return argument.name.value === argument1.name.value; - }); - - if (!argument2) { - return false; - } - - return sameValue(argument1.value, argument2.value); - }); -} - -function sameValue(value1, value2) { - return print(value1) === print(value2); -} // Two types conflict if both types could not apply to a value simultaneously. -// Composite types are ignored as their individual field types will be compared -// later recursively. However List and Non-Null types must match. - - -function doTypesConflict(type1, type2) { - if (isListType(type1)) { - return isListType(type2) ? doTypesConflict(type1.ofType, type2.ofType) : true; - } - - if (isListType(type2)) { - return true; - } - - if (isNonNullType(type1)) { - return isNonNullType(type2) ? doTypesConflict(type1.ofType, type2.ofType) : true; - } - - if (isNonNullType(type2)) { - return true; - } - - if (isLeafType(type1) || isLeafType(type2)) { - return type1 !== type2; - } - - return false; -} // Given a selection set, return the collection of fields (a mapping of response -// name to field nodes and definitions) as well as a list of fragment names -// referenced via fragment spreads. - - -function getFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames, parentType, selectionSet) { - var cached = cachedFieldsAndFragmentNames.get(selectionSet); - - if (!cached) { - var nodeAndDefs = Object.create(null); - var fragmentNames = Object.create(null); - - _collectFieldsAndFragmentNames(context, parentType, selectionSet, nodeAndDefs, fragmentNames); - - cached = [nodeAndDefs, Object.keys(fragmentNames)]; - cachedFieldsAndFragmentNames.set(selectionSet, cached); - } - - return cached; -} // Given a reference to a fragment, return the represented collection of fields -// as well as a list of nested fragment names referenced via fragment spreads. - - -function getReferencedFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames, fragment) { - // Short-circuit building a type from the node if possible. - var cached = cachedFieldsAndFragmentNames.get(fragment.selectionSet); - - if (cached) { - return cached; - } - - var fragmentType = typeFromAST(context.getSchema(), fragment.typeCondition); - return getFieldsAndFragmentNames(context, cachedFieldsAndFragmentNames, fragmentType, fragment.selectionSet); -} - -function _collectFieldsAndFragmentNames(context, parentType, selectionSet, nodeAndDefs, fragmentNames) { - for (var _i9 = 0, _selectionSet$selecti2 = selectionSet.selections; _i9 < _selectionSet$selecti2.length; _i9++) { - var selection = _selectionSet$selecti2[_i9]; - - switch (selection.kind) { - case Kind.FIELD: - { - var fieldName = selection.name.value; - var fieldDef = void 0; - - if (isObjectType(parentType) || isInterfaceType(parentType)) { - fieldDef = parentType.getFields()[fieldName]; - } - - var responseName = selection.alias ? selection.alias.value : fieldName; - - if (!nodeAndDefs[responseName]) { - nodeAndDefs[responseName] = []; - } - - nodeAndDefs[responseName].push([parentType, selection, fieldDef]); - break; - } - - case Kind.FRAGMENT_SPREAD: - fragmentNames[selection.name.value] = true; - break; - - case Kind.INLINE_FRAGMENT: - { - var typeCondition = selection.typeCondition; - var inlineFragmentType = typeCondition ? typeFromAST(context.getSchema(), typeCondition) : parentType; - - _collectFieldsAndFragmentNames(context, inlineFragmentType, selection.selectionSet, nodeAndDefs, fragmentNames); - - break; - } - } - } -} // Given a series of Conflicts which occurred between two sub-fields, generate -// a single Conflict. - - -function subfieldConflicts(conflicts, responseName, node1, node2) { - if (conflicts.length > 0) { - return [[responseName, conflicts.map(function (_ref6) { - var reason = _ref6[0]; - return reason; - })], conflicts.reduce(function (allFields, _ref7) { - var fields1 = _ref7[1]; - return allFields.concat(fields1); - }, [node1]), conflicts.reduce(function (allFields, _ref8) { - var fields2 = _ref8[2]; - return allFields.concat(fields2); - }, [node2])]; - } -} -/** - * A way to keep track of pairs of things when the ordering of the pair does - * not matter. We do this by maintaining a sort of double adjacency sets. - */ - - -var PairSet = /*#__PURE__*/function () { - function PairSet() { - this._data = Object.create(null); - } - - var _proto = PairSet.prototype; - - _proto.has = function has(a, b, areMutuallyExclusive) { - var first = this._data[a]; - var result = first && first[b]; - - if (result === undefined) { - return false; - } // areMutuallyExclusive being false is a superset of being true, - // hence if we want to know if this PairSet "has" these two with no - // exclusivity, we have to ensure it was added as such. - - - if (areMutuallyExclusive === false) { - return result === false; - } - - return true; - }; - - _proto.add = function add(a, b, areMutuallyExclusive) { - this._pairSetAdd(a, b, areMutuallyExclusive); - - this._pairSetAdd(b, a, areMutuallyExclusive); - }; - - _proto._pairSetAdd = function _pairSetAdd(a, b, areMutuallyExclusive) { - var map = this._data[a]; - - if (!map) { - map = Object.create(null); - this._data[a] = map; - } - - map[b] = areMutuallyExclusive; - }; - - return PairSet; -}(); diff --git a/alarm/node_modules/graphql/validation/rules/PossibleFragmentSpreadsRule.d.ts b/alarm/node_modules/graphql/validation/rules/PossibleFragmentSpreadsRule.d.ts deleted file mode 100644 index 36f551d..0000000 --- a/alarm/node_modules/graphql/validation/rules/PossibleFragmentSpreadsRule.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { ASTVisitor } from '../../language/visitor'; -import { ValidationContext } from '../ValidationContext'; - -/** - * Possible fragment spread - * - * A fragment spread is only valid if the type condition could ever possibly - * be true: if there is a non-empty intersection of the possible parent types, - * and possible types which pass the type condition. - */ -export function PossibleFragmentSpreadsRule( - context: ValidationContext, -): ASTVisitor; diff --git a/alarm/node_modules/graphql/validation/rules/PossibleFragmentSpreadsRule.js b/alarm/node_modules/graphql/validation/rules/PossibleFragmentSpreadsRule.js deleted file mode 100644 index 427905d..0000000 --- a/alarm/node_modules/graphql/validation/rules/PossibleFragmentSpreadsRule.js +++ /dev/null @@ -1,63 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.PossibleFragmentSpreadsRule = PossibleFragmentSpreadsRule; - -var _inspect = _interopRequireDefault(require("../../jsutils/inspect.js")); - -var _GraphQLError = require("../../error/GraphQLError.js"); - -var _definition = require("../../type/definition.js"); - -var _typeFromAST = require("../../utilities/typeFromAST.js"); - -var _typeComparators = require("../../utilities/typeComparators.js"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Possible fragment spread - * - * A fragment spread is only valid if the type condition could ever possibly - * be true: if there is a non-empty intersection of the possible parent types, - * and possible types which pass the type condition. - */ -function PossibleFragmentSpreadsRule(context) { - return { - InlineFragment: function InlineFragment(node) { - var fragType = context.getType(); - var parentType = context.getParentType(); - - if ((0, _definition.isCompositeType)(fragType) && (0, _definition.isCompositeType)(parentType) && !(0, _typeComparators.doTypesOverlap)(context.getSchema(), fragType, parentType)) { - var parentTypeStr = (0, _inspect.default)(parentType); - var fragTypeStr = (0, _inspect.default)(fragType); - context.reportError(new _GraphQLError.GraphQLError("Fragment cannot be spread here as objects of type \"".concat(parentTypeStr, "\" can never be of type \"").concat(fragTypeStr, "\"."), node)); - } - }, - FragmentSpread: function FragmentSpread(node) { - var fragName = node.name.value; - var fragType = getFragmentType(context, fragName); - var parentType = context.getParentType(); - - if (fragType && parentType && !(0, _typeComparators.doTypesOverlap)(context.getSchema(), fragType, parentType)) { - var parentTypeStr = (0, _inspect.default)(parentType); - var fragTypeStr = (0, _inspect.default)(fragType); - context.reportError(new _GraphQLError.GraphQLError("Fragment \"".concat(fragName, "\" cannot be spread here as objects of type \"").concat(parentTypeStr, "\" can never be of type \"").concat(fragTypeStr, "\"."), node)); - } - } - }; -} - -function getFragmentType(context, name) { - var frag = context.getFragment(name); - - if (frag) { - var type = (0, _typeFromAST.typeFromAST)(context.getSchema(), frag.typeCondition); - - if ((0, _definition.isCompositeType)(type)) { - return type; - } - } -} diff --git a/alarm/node_modules/graphql/validation/rules/PossibleFragmentSpreadsRule.js.flow b/alarm/node_modules/graphql/validation/rules/PossibleFragmentSpreadsRule.js.flow deleted file mode 100644 index 9c275bb..0000000 --- a/alarm/node_modules/graphql/validation/rules/PossibleFragmentSpreadsRule.js.flow +++ /dev/null @@ -1,78 +0,0 @@ -// @flow strict -import inspect from '../../jsutils/inspect'; - -import { GraphQLError } from '../../error/GraphQLError'; - -import type { ASTVisitor } from '../../language/visitor'; - -import type { GraphQLCompositeType } from '../../type/definition'; -import { isCompositeType } from '../../type/definition'; - -import { typeFromAST } from '../../utilities/typeFromAST'; -import { doTypesOverlap } from '../../utilities/typeComparators'; - -import type { ValidationContext } from '../ValidationContext'; - -/** - * Possible fragment spread - * - * A fragment spread is only valid if the type condition could ever possibly - * be true: if there is a non-empty intersection of the possible parent types, - * and possible types which pass the type condition. - */ -export function PossibleFragmentSpreadsRule( - context: ValidationContext, -): ASTVisitor { - return { - InlineFragment(node) { - const fragType = context.getType(); - const parentType = context.getParentType(); - if ( - isCompositeType(fragType) && - isCompositeType(parentType) && - !doTypesOverlap(context.getSchema(), fragType, parentType) - ) { - const parentTypeStr = inspect(parentType); - const fragTypeStr = inspect(fragType); - context.reportError( - new GraphQLError( - `Fragment cannot be spread here as objects of type "${parentTypeStr}" can never be of type "${fragTypeStr}".`, - node, - ), - ); - } - }, - FragmentSpread(node) { - const fragName = node.name.value; - const fragType = getFragmentType(context, fragName); - const parentType = context.getParentType(); - if ( - fragType && - parentType && - !doTypesOverlap(context.getSchema(), fragType, parentType) - ) { - const parentTypeStr = inspect(parentType); - const fragTypeStr = inspect(fragType); - context.reportError( - new GraphQLError( - `Fragment "${fragName}" cannot be spread here as objects of type "${parentTypeStr}" can never be of type "${fragTypeStr}".`, - node, - ), - ); - } - }, - }; -} - -function getFragmentType( - context: ValidationContext, - name: string, -): ?GraphQLCompositeType { - const frag = context.getFragment(name); - if (frag) { - const type = typeFromAST(context.getSchema(), frag.typeCondition); - if (isCompositeType(type)) { - return type; - } - } -} diff --git a/alarm/node_modules/graphql/validation/rules/PossibleFragmentSpreadsRule.mjs b/alarm/node_modules/graphql/validation/rules/PossibleFragmentSpreadsRule.mjs deleted file mode 100644 index da45925..0000000 --- a/alarm/node_modules/graphql/validation/rules/PossibleFragmentSpreadsRule.mjs +++ /dev/null @@ -1,50 +0,0 @@ -import inspect from "../../jsutils/inspect.mjs"; -import { GraphQLError } from "../../error/GraphQLError.mjs"; -import { isCompositeType } from "../../type/definition.mjs"; -import { typeFromAST } from "../../utilities/typeFromAST.mjs"; -import { doTypesOverlap } from "../../utilities/typeComparators.mjs"; - -/** - * Possible fragment spread - * - * A fragment spread is only valid if the type condition could ever possibly - * be true: if there is a non-empty intersection of the possible parent types, - * and possible types which pass the type condition. - */ -export function PossibleFragmentSpreadsRule(context) { - return { - InlineFragment: function InlineFragment(node) { - var fragType = context.getType(); - var parentType = context.getParentType(); - - if (isCompositeType(fragType) && isCompositeType(parentType) && !doTypesOverlap(context.getSchema(), fragType, parentType)) { - var parentTypeStr = inspect(parentType); - var fragTypeStr = inspect(fragType); - context.reportError(new GraphQLError("Fragment cannot be spread here as objects of type \"".concat(parentTypeStr, "\" can never be of type \"").concat(fragTypeStr, "\"."), node)); - } - }, - FragmentSpread: function FragmentSpread(node) { - var fragName = node.name.value; - var fragType = getFragmentType(context, fragName); - var parentType = context.getParentType(); - - if (fragType && parentType && !doTypesOverlap(context.getSchema(), fragType, parentType)) { - var parentTypeStr = inspect(parentType); - var fragTypeStr = inspect(fragType); - context.reportError(new GraphQLError("Fragment \"".concat(fragName, "\" cannot be spread here as objects of type \"").concat(parentTypeStr, "\" can never be of type \"").concat(fragTypeStr, "\"."), node)); - } - } - }; -} - -function getFragmentType(context, name) { - var frag = context.getFragment(name); - - if (frag) { - var type = typeFromAST(context.getSchema(), frag.typeCondition); - - if (isCompositeType(type)) { - return type; - } - } -} diff --git a/alarm/node_modules/graphql/validation/rules/PossibleTypeExtensions.d.ts b/alarm/node_modules/graphql/validation/rules/PossibleTypeExtensions.d.ts deleted file mode 100644 index 7573375..0000000 --- a/alarm/node_modules/graphql/validation/rules/PossibleTypeExtensions.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * @deprecated and will be removed in v16 - * Please use either: - * import { PossibleTypeExtensionsRule } from 'graphql' - * or - * import { PossibleTypeExtensionsRule } from 'graphql/validation' - */ -export { PossibleTypeExtensionsRule as PossibleTypeExtensions } from './PossibleTypeExtensionsRule'; diff --git a/alarm/node_modules/graphql/validation/rules/PossibleTypeExtensions.js b/alarm/node_modules/graphql/validation/rules/PossibleTypeExtensions.js deleted file mode 100644 index fc15d85..0000000 --- a/alarm/node_modules/graphql/validation/rules/PossibleTypeExtensions.js +++ /dev/null @@ -1,13 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -Object.defineProperty(exports, "PossibleTypeExtensions", { - enumerable: true, - get: function get() { - return _PossibleTypeExtensionsRule.PossibleTypeExtensionsRule; - } -}); - -var _PossibleTypeExtensionsRule = require("./PossibleTypeExtensionsRule.js"); diff --git a/alarm/node_modules/graphql/validation/rules/PossibleTypeExtensions.js.flow b/alarm/node_modules/graphql/validation/rules/PossibleTypeExtensions.js.flow deleted file mode 100644 index ed223f1..0000000 --- a/alarm/node_modules/graphql/validation/rules/PossibleTypeExtensions.js.flow +++ /dev/null @@ -1,9 +0,0 @@ -// @flow strict -/** - * @deprecated and will be removed in v16 - * Please use either: - * import { PossibleTypeExtensionsRule } from 'graphql' - * or - * import { PossibleTypeExtensionsRule } from 'graphql/validation' - */ -export { PossibleTypeExtensionsRule as PossibleTypeExtensions } from './PossibleTypeExtensionsRule'; diff --git a/alarm/node_modules/graphql/validation/rules/PossibleTypeExtensions.mjs b/alarm/node_modules/graphql/validation/rules/PossibleTypeExtensions.mjs deleted file mode 100644 index 99796c8..0000000 --- a/alarm/node_modules/graphql/validation/rules/PossibleTypeExtensions.mjs +++ /dev/null @@ -1,8 +0,0 @@ -/** - * @deprecated and will be removed in v16 - * Please use either: - * import { PossibleTypeExtensionsRule } from 'graphql' - * or - * import { PossibleTypeExtensionsRule } from 'graphql/validation' - */ -export { PossibleTypeExtensionsRule as PossibleTypeExtensions } from "./PossibleTypeExtensionsRule.mjs"; diff --git a/alarm/node_modules/graphql/validation/rules/PossibleTypeExtensionsRule.d.ts b/alarm/node_modules/graphql/validation/rules/PossibleTypeExtensionsRule.d.ts deleted file mode 100644 index 8337dc5..0000000 --- a/alarm/node_modules/graphql/validation/rules/PossibleTypeExtensionsRule.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { ASTVisitor } from '../../language/visitor'; -import { SDLValidationContext } from '../ValidationContext'; - -/** - * Possible type extension - * - * A type extension is only valid if the type is defined and has the same kind. - */ -export function PossibleTypeExtensionsRule( - context: SDLValidationContext, -): ASTVisitor; diff --git a/alarm/node_modules/graphql/validation/rules/PossibleTypeExtensionsRule.js b/alarm/node_modules/graphql/validation/rules/PossibleTypeExtensionsRule.js deleted file mode 100644 index 309b12b..0000000 --- a/alarm/node_modules/graphql/validation/rules/PossibleTypeExtensionsRule.js +++ /dev/null @@ -1,141 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.PossibleTypeExtensionsRule = PossibleTypeExtensionsRule; - -var _inspect = _interopRequireDefault(require("../../jsutils/inspect.js")); - -var _invariant = _interopRequireDefault(require("../../jsutils/invariant.js")); - -var _didYouMean = _interopRequireDefault(require("../../jsutils/didYouMean.js")); - -var _suggestionList = _interopRequireDefault(require("../../jsutils/suggestionList.js")); - -var _GraphQLError = require("../../error/GraphQLError.js"); - -var _kinds = require("../../language/kinds.js"); - -var _predicates = require("../../language/predicates.js"); - -var _definition = require("../../type/definition.js"); - -var _defKindToExtKind; - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - -/** - * Possible type extension - * - * A type extension is only valid if the type is defined and has the same kind. - */ -function PossibleTypeExtensionsRule(context) { - var schema = context.getSchema(); - var definedTypes = Object.create(null); - - for (var _i2 = 0, _context$getDocument$2 = context.getDocument().definitions; _i2 < _context$getDocument$2.length; _i2++) { - var def = _context$getDocument$2[_i2]; - - if ((0, _predicates.isTypeDefinitionNode)(def)) { - definedTypes[def.name.value] = def; - } - } - - return { - ScalarTypeExtension: checkExtension, - ObjectTypeExtension: checkExtension, - InterfaceTypeExtension: checkExtension, - UnionTypeExtension: checkExtension, - EnumTypeExtension: checkExtension, - InputObjectTypeExtension: checkExtension - }; - - function checkExtension(node) { - var typeName = node.name.value; - var defNode = definedTypes[typeName]; - var existingType = schema === null || schema === void 0 ? void 0 : schema.getType(typeName); - var expectedKind; - - if (defNode) { - expectedKind = defKindToExtKind[defNode.kind]; - } else if (existingType) { - expectedKind = typeToExtKind(existingType); - } - - if (expectedKind) { - if (expectedKind !== node.kind) { - var kindStr = extensionKindToTypeName(node.kind); - context.reportError(new _GraphQLError.GraphQLError("Cannot extend non-".concat(kindStr, " type \"").concat(typeName, "\"."), defNode ? [defNode, node] : node)); - } - } else { - var allTypeNames = Object.keys(definedTypes); - - if (schema) { - allTypeNames = allTypeNames.concat(Object.keys(schema.getTypeMap())); - } - - var suggestedTypes = (0, _suggestionList.default)(typeName, allTypeNames); - context.reportError(new _GraphQLError.GraphQLError("Cannot extend type \"".concat(typeName, "\" because it is not defined.") + (0, _didYouMean.default)(suggestedTypes), node.name)); - } - } -} - -var defKindToExtKind = (_defKindToExtKind = {}, _defineProperty(_defKindToExtKind, _kinds.Kind.SCALAR_TYPE_DEFINITION, _kinds.Kind.SCALAR_TYPE_EXTENSION), _defineProperty(_defKindToExtKind, _kinds.Kind.OBJECT_TYPE_DEFINITION, _kinds.Kind.OBJECT_TYPE_EXTENSION), _defineProperty(_defKindToExtKind, _kinds.Kind.INTERFACE_TYPE_DEFINITION, _kinds.Kind.INTERFACE_TYPE_EXTENSION), _defineProperty(_defKindToExtKind, _kinds.Kind.UNION_TYPE_DEFINITION, _kinds.Kind.UNION_TYPE_EXTENSION), _defineProperty(_defKindToExtKind, _kinds.Kind.ENUM_TYPE_DEFINITION, _kinds.Kind.ENUM_TYPE_EXTENSION), _defineProperty(_defKindToExtKind, _kinds.Kind.INPUT_OBJECT_TYPE_DEFINITION, _kinds.Kind.INPUT_OBJECT_TYPE_EXTENSION), _defKindToExtKind); - -function typeToExtKind(type) { - if ((0, _definition.isScalarType)(type)) { - return _kinds.Kind.SCALAR_TYPE_EXTENSION; - } - - if ((0, _definition.isObjectType)(type)) { - return _kinds.Kind.OBJECT_TYPE_EXTENSION; - } - - if ((0, _definition.isInterfaceType)(type)) { - return _kinds.Kind.INTERFACE_TYPE_EXTENSION; - } - - if ((0, _definition.isUnionType)(type)) { - return _kinds.Kind.UNION_TYPE_EXTENSION; - } - - if ((0, _definition.isEnumType)(type)) { - return _kinds.Kind.ENUM_TYPE_EXTENSION; - } // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618') - - - if ((0, _definition.isInputObjectType)(type)) { - return _kinds.Kind.INPUT_OBJECT_TYPE_EXTENSION; - } // istanbul ignore next (Not reachable. All possible types have been considered) - - - false || (0, _invariant.default)(0, 'Unexpected type: ' + (0, _inspect.default)(type)); -} - -function extensionKindToTypeName(kind) { - switch (kind) { - case _kinds.Kind.SCALAR_TYPE_EXTENSION: - return 'scalar'; - - case _kinds.Kind.OBJECT_TYPE_EXTENSION: - return 'object'; - - case _kinds.Kind.INTERFACE_TYPE_EXTENSION: - return 'interface'; - - case _kinds.Kind.UNION_TYPE_EXTENSION: - return 'union'; - - case _kinds.Kind.ENUM_TYPE_EXTENSION: - return 'enum'; - - case _kinds.Kind.INPUT_OBJECT_TYPE_EXTENSION: - return 'input object'; - } // istanbul ignore next (Not reachable. All possible types have been considered) - - - false || (0, _invariant.default)(0, 'Unexpected kind: ' + (0, _inspect.default)(kind)); -} diff --git a/alarm/node_modules/graphql/validation/rules/PossibleTypeExtensionsRule.js.flow b/alarm/node_modules/graphql/validation/rules/PossibleTypeExtensionsRule.js.flow deleted file mode 100644 index 15ec1b4..0000000 --- a/alarm/node_modules/graphql/validation/rules/PossibleTypeExtensionsRule.js.flow +++ /dev/null @@ -1,145 +0,0 @@ -// @flow strict -import inspect from '../../jsutils/inspect'; -import invariant from '../../jsutils/invariant'; -import didYouMean from '../../jsutils/didYouMean'; -import suggestionList from '../../jsutils/suggestionList'; - -import { GraphQLError } from '../../error/GraphQLError'; - -import type { KindEnum } from '../../language/kinds'; -import type { ASTVisitor } from '../../language/visitor'; -import type { TypeExtensionNode } from '../../language/ast'; -import { Kind } from '../../language/kinds'; -import { isTypeDefinitionNode } from '../../language/predicates'; - -import type { GraphQLNamedType } from '../../type/definition'; -import { - isScalarType, - isObjectType, - isInterfaceType, - isUnionType, - isEnumType, - isInputObjectType, -} from '../../type/definition'; - -import type { SDLValidationContext } from '../ValidationContext'; - -/** - * Possible type extension - * - * A type extension is only valid if the type is defined and has the same kind. - */ -export function PossibleTypeExtensionsRule( - context: SDLValidationContext, -): ASTVisitor { - const schema = context.getSchema(); - const definedTypes = Object.create(null); - - for (const def of context.getDocument().definitions) { - if (isTypeDefinitionNode(def)) { - definedTypes[def.name.value] = def; - } - } - - return { - ScalarTypeExtension: checkExtension, - ObjectTypeExtension: checkExtension, - InterfaceTypeExtension: checkExtension, - UnionTypeExtension: checkExtension, - EnumTypeExtension: checkExtension, - InputObjectTypeExtension: checkExtension, - }; - - function checkExtension(node: TypeExtensionNode): void { - const typeName = node.name.value; - const defNode = definedTypes[typeName]; - const existingType = schema?.getType(typeName); - - let expectedKind; - if (defNode) { - expectedKind = defKindToExtKind[defNode.kind]; - } else if (existingType) { - expectedKind = typeToExtKind(existingType); - } - - if (expectedKind) { - if (expectedKind !== node.kind) { - const kindStr = extensionKindToTypeName(node.kind); - context.reportError( - new GraphQLError( - `Cannot extend non-${kindStr} type "${typeName}".`, - defNode ? [defNode, node] : node, - ), - ); - } - } else { - let allTypeNames = Object.keys(definedTypes); - if (schema) { - allTypeNames = allTypeNames.concat(Object.keys(schema.getTypeMap())); - } - - const suggestedTypes = suggestionList(typeName, allTypeNames); - context.reportError( - new GraphQLError( - `Cannot extend type "${typeName}" because it is not defined.` + - didYouMean(suggestedTypes), - node.name, - ), - ); - } - } -} - -const defKindToExtKind = { - [Kind.SCALAR_TYPE_DEFINITION]: Kind.SCALAR_TYPE_EXTENSION, - [Kind.OBJECT_TYPE_DEFINITION]: Kind.OBJECT_TYPE_EXTENSION, - [Kind.INTERFACE_TYPE_DEFINITION]: Kind.INTERFACE_TYPE_EXTENSION, - [Kind.UNION_TYPE_DEFINITION]: Kind.UNION_TYPE_EXTENSION, - [Kind.ENUM_TYPE_DEFINITION]: Kind.ENUM_TYPE_EXTENSION, - [Kind.INPUT_OBJECT_TYPE_DEFINITION]: Kind.INPUT_OBJECT_TYPE_EXTENSION, -}; - -function typeToExtKind(type: GraphQLNamedType): KindEnum { - if (isScalarType(type)) { - return Kind.SCALAR_TYPE_EXTENSION; - } - if (isObjectType(type)) { - return Kind.OBJECT_TYPE_EXTENSION; - } - if (isInterfaceType(type)) { - return Kind.INTERFACE_TYPE_EXTENSION; - } - if (isUnionType(type)) { - return Kind.UNION_TYPE_EXTENSION; - } - if (isEnumType(type)) { - return Kind.ENUM_TYPE_EXTENSION; - } - // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618') - if (isInputObjectType(type)) { - return Kind.INPUT_OBJECT_TYPE_EXTENSION; - } - - // istanbul ignore next (Not reachable. All possible types have been considered) - invariant(false, 'Unexpected type: ' + inspect((type: empty))); -} - -function extensionKindToTypeName(kind: KindEnum): string { - switch (kind) { - case Kind.SCALAR_TYPE_EXTENSION: - return 'scalar'; - case Kind.OBJECT_TYPE_EXTENSION: - return 'object'; - case Kind.INTERFACE_TYPE_EXTENSION: - return 'interface'; - case Kind.UNION_TYPE_EXTENSION: - return 'union'; - case Kind.ENUM_TYPE_EXTENSION: - return 'enum'; - case Kind.INPUT_OBJECT_TYPE_EXTENSION: - return 'input object'; - } - - // istanbul ignore next (Not reachable. All possible types have been considered) - invariant(false, 'Unexpected kind: ' + inspect(kind)); -} diff --git a/alarm/node_modules/graphql/validation/rules/PossibleTypeExtensionsRule.mjs b/alarm/node_modules/graphql/validation/rules/PossibleTypeExtensionsRule.mjs deleted file mode 100644 index b1066b5..0000000 --- a/alarm/node_modules/graphql/validation/rules/PossibleTypeExtensionsRule.mjs +++ /dev/null @@ -1,124 +0,0 @@ -var _defKindToExtKind; - -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - -import inspect from "../../jsutils/inspect.mjs"; -import invariant from "../../jsutils/invariant.mjs"; -import didYouMean from "../../jsutils/didYouMean.mjs"; -import suggestionList from "../../jsutils/suggestionList.mjs"; -import { GraphQLError } from "../../error/GraphQLError.mjs"; -import { Kind } from "../../language/kinds.mjs"; -import { isTypeDefinitionNode } from "../../language/predicates.mjs"; -import { isScalarType, isObjectType, isInterfaceType, isUnionType, isEnumType, isInputObjectType } from "../../type/definition.mjs"; - -/** - * Possible type extension - * - * A type extension is only valid if the type is defined and has the same kind. - */ -export function PossibleTypeExtensionsRule(context) { - var schema = context.getSchema(); - var definedTypes = Object.create(null); - - for (var _i2 = 0, _context$getDocument$2 = context.getDocument().definitions; _i2 < _context$getDocument$2.length; _i2++) { - var def = _context$getDocument$2[_i2]; - - if (isTypeDefinitionNode(def)) { - definedTypes[def.name.value] = def; - } - } - - return { - ScalarTypeExtension: checkExtension, - ObjectTypeExtension: checkExtension, - InterfaceTypeExtension: checkExtension, - UnionTypeExtension: checkExtension, - EnumTypeExtension: checkExtension, - InputObjectTypeExtension: checkExtension - }; - - function checkExtension(node) { - var typeName = node.name.value; - var defNode = definedTypes[typeName]; - var existingType = schema === null || schema === void 0 ? void 0 : schema.getType(typeName); - var expectedKind; - - if (defNode) { - expectedKind = defKindToExtKind[defNode.kind]; - } else if (existingType) { - expectedKind = typeToExtKind(existingType); - } - - if (expectedKind) { - if (expectedKind !== node.kind) { - var kindStr = extensionKindToTypeName(node.kind); - context.reportError(new GraphQLError("Cannot extend non-".concat(kindStr, " type \"").concat(typeName, "\"."), defNode ? [defNode, node] : node)); - } - } else { - var allTypeNames = Object.keys(definedTypes); - - if (schema) { - allTypeNames = allTypeNames.concat(Object.keys(schema.getTypeMap())); - } - - var suggestedTypes = suggestionList(typeName, allTypeNames); - context.reportError(new GraphQLError("Cannot extend type \"".concat(typeName, "\" because it is not defined.") + didYouMean(suggestedTypes), node.name)); - } - } -} -var defKindToExtKind = (_defKindToExtKind = {}, _defineProperty(_defKindToExtKind, Kind.SCALAR_TYPE_DEFINITION, Kind.SCALAR_TYPE_EXTENSION), _defineProperty(_defKindToExtKind, Kind.OBJECT_TYPE_DEFINITION, Kind.OBJECT_TYPE_EXTENSION), _defineProperty(_defKindToExtKind, Kind.INTERFACE_TYPE_DEFINITION, Kind.INTERFACE_TYPE_EXTENSION), _defineProperty(_defKindToExtKind, Kind.UNION_TYPE_DEFINITION, Kind.UNION_TYPE_EXTENSION), _defineProperty(_defKindToExtKind, Kind.ENUM_TYPE_DEFINITION, Kind.ENUM_TYPE_EXTENSION), _defineProperty(_defKindToExtKind, Kind.INPUT_OBJECT_TYPE_DEFINITION, Kind.INPUT_OBJECT_TYPE_EXTENSION), _defKindToExtKind); - -function typeToExtKind(type) { - if (isScalarType(type)) { - return Kind.SCALAR_TYPE_EXTENSION; - } - - if (isObjectType(type)) { - return Kind.OBJECT_TYPE_EXTENSION; - } - - if (isInterfaceType(type)) { - return Kind.INTERFACE_TYPE_EXTENSION; - } - - if (isUnionType(type)) { - return Kind.UNION_TYPE_EXTENSION; - } - - if (isEnumType(type)) { - return Kind.ENUM_TYPE_EXTENSION; - } // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2618') - - - if (isInputObjectType(type)) { - return Kind.INPUT_OBJECT_TYPE_EXTENSION; - } // istanbul ignore next (Not reachable. All possible types have been considered) - - - false || invariant(0, 'Unexpected type: ' + inspect(type)); -} - -function extensionKindToTypeName(kind) { - switch (kind) { - case Kind.SCALAR_TYPE_EXTENSION: - return 'scalar'; - - case Kind.OBJECT_TYPE_EXTENSION: - return 'object'; - - case Kind.INTERFACE_TYPE_EXTENSION: - return 'interface'; - - case Kind.UNION_TYPE_EXTENSION: - return 'union'; - - case Kind.ENUM_TYPE_EXTENSION: - return 'enum'; - - case Kind.INPUT_OBJECT_TYPE_EXTENSION: - return 'input object'; - } // istanbul ignore next (Not reachable. All possible types have been considered) - - - false || invariant(0, 'Unexpected kind: ' + inspect(kind)); -} diff --git a/alarm/node_modules/graphql/validation/rules/ProvidedRequiredArgumentsRule.d.ts b/alarm/node_modules/graphql/validation/rules/ProvidedRequiredArgumentsRule.d.ts deleted file mode 100644 index 116069c..0000000 --- a/alarm/node_modules/graphql/validation/rules/ProvidedRequiredArgumentsRule.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { ASTVisitor } from '../../language/visitor'; -import { ValidationContext, SDLValidationContext } from '../ValidationContext'; - -/** - * Provided required arguments - * - * A field or directive is only valid if all required (non-null without a - * default value) field arguments have been provided. - */ -export function ProvidedRequiredArgumentsRule( - context: ValidationContext, -): ASTVisitor; - -/** - * @internal - */ -export function ProvidedRequiredArgumentsOnDirectivesRule( - context: ValidationContext | SDLValidationContext, -): ASTVisitor; diff --git a/alarm/node_modules/graphql/validation/rules/ProvidedRequiredArgumentsRule.js b/alarm/node_modules/graphql/validation/rules/ProvidedRequiredArgumentsRule.js deleted file mode 100644 index b4735cf..0000000 --- a/alarm/node_modules/graphql/validation/rules/ProvidedRequiredArgumentsRule.js +++ /dev/null @@ -1,136 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.ProvidedRequiredArgumentsRule = ProvidedRequiredArgumentsRule; -exports.ProvidedRequiredArgumentsOnDirectivesRule = ProvidedRequiredArgumentsOnDirectivesRule; - -var _inspect = _interopRequireDefault(require("../../jsutils/inspect.js")); - -var _keyMap = _interopRequireDefault(require("../../jsutils/keyMap.js")); - -var _GraphQLError = require("../../error/GraphQLError.js"); - -var _kinds = require("../../language/kinds.js"); - -var _printer = require("../../language/printer.js"); - -var _directives = require("../../type/directives.js"); - -var _definition = require("../../type/definition.js"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - -/** - * Provided required arguments - * - * A field or directive is only valid if all required (non-null without a - * default value) field arguments have been provided. - */ -function ProvidedRequiredArgumentsRule(context) { - return _objectSpread(_objectSpread({}, ProvidedRequiredArgumentsOnDirectivesRule(context)), {}, { - Field: { - // Validate on leave to allow for deeper errors to appear first. - leave: function leave(fieldNode) { - var _fieldNode$arguments; - - var fieldDef = context.getFieldDef(); - - if (!fieldDef) { - return false; - } // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - - - var argNodes = (_fieldNode$arguments = fieldNode.arguments) !== null && _fieldNode$arguments !== void 0 ? _fieldNode$arguments : []; - var argNodeMap = (0, _keyMap.default)(argNodes, function (arg) { - return arg.name.value; - }); - - for (var _i2 = 0, _fieldDef$args2 = fieldDef.args; _i2 < _fieldDef$args2.length; _i2++) { - var argDef = _fieldDef$args2[_i2]; - var argNode = argNodeMap[argDef.name]; - - if (!argNode && (0, _definition.isRequiredArgument)(argDef)) { - var argTypeStr = (0, _inspect.default)(argDef.type); - context.reportError(new _GraphQLError.GraphQLError("Field \"".concat(fieldDef.name, "\" argument \"").concat(argDef.name, "\" of type \"").concat(argTypeStr, "\" is required, but it was not provided."), fieldNode)); - } - } - } - } - }); -} -/** - * @internal - */ - - -function ProvidedRequiredArgumentsOnDirectivesRule(context) { - var requiredArgsMap = Object.create(null); - var schema = context.getSchema(); - var definedDirectives = schema ? schema.getDirectives() : _directives.specifiedDirectives; - - for (var _i4 = 0; _i4 < definedDirectives.length; _i4++) { - var directive = definedDirectives[_i4]; - requiredArgsMap[directive.name] = (0, _keyMap.default)(directive.args.filter(_definition.isRequiredArgument), function (arg) { - return arg.name; - }); - } - - var astDefinitions = context.getDocument().definitions; - - for (var _i6 = 0; _i6 < astDefinitions.length; _i6++) { - var def = astDefinitions[_i6]; - - if (def.kind === _kinds.Kind.DIRECTIVE_DEFINITION) { - var _def$arguments; - - // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - var argNodes = (_def$arguments = def.arguments) !== null && _def$arguments !== void 0 ? _def$arguments : []; - requiredArgsMap[def.name.value] = (0, _keyMap.default)(argNodes.filter(isRequiredArgumentNode), function (arg) { - return arg.name.value; - }); - } - } - - return { - Directive: { - // Validate on leave to allow for deeper errors to appear first. - leave: function leave(directiveNode) { - var directiveName = directiveNode.name.value; - var requiredArgs = requiredArgsMap[directiveName]; - - if (requiredArgs) { - var _directiveNode$argume; - - // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - var _argNodes = (_directiveNode$argume = directiveNode.arguments) !== null && _directiveNode$argume !== void 0 ? _directiveNode$argume : []; - - var argNodeMap = (0, _keyMap.default)(_argNodes, function (arg) { - return arg.name.value; - }); - - for (var _i8 = 0, _Object$keys2 = Object.keys(requiredArgs); _i8 < _Object$keys2.length; _i8++) { - var argName = _Object$keys2[_i8]; - - if (!argNodeMap[argName]) { - var argType = requiredArgs[argName].type; - var argTypeStr = (0, _definition.isType)(argType) ? (0, _inspect.default)(argType) : (0, _printer.print)(argType); - context.reportError(new _GraphQLError.GraphQLError("Directive \"@".concat(directiveName, "\" argument \"").concat(argName, "\" of type \"").concat(argTypeStr, "\" is required, but it was not provided."), directiveNode)); - } - } - } - } - } - }; -} - -function isRequiredArgumentNode(arg) { - return arg.type.kind === _kinds.Kind.NON_NULL_TYPE && arg.defaultValue == null; -} diff --git a/alarm/node_modules/graphql/validation/rules/ProvidedRequiredArgumentsRule.js.flow b/alarm/node_modules/graphql/validation/rules/ProvidedRequiredArgumentsRule.js.flow deleted file mode 100644 index 11b9b3e..0000000 --- a/alarm/node_modules/graphql/validation/rules/ProvidedRequiredArgumentsRule.js.flow +++ /dev/null @@ -1,125 +0,0 @@ -// @flow strict -import inspect from '../../jsutils/inspect'; -import keyMap from '../../jsutils/keyMap'; - -import { GraphQLError } from '../../error/GraphQLError'; - -import type { ASTVisitor } from '../../language/visitor'; -import type { InputValueDefinitionNode } from '../../language/ast'; -import { Kind } from '../../language/kinds'; -import { print } from '../../language/printer'; - -import { specifiedDirectives } from '../../type/directives'; -import { isType, isRequiredArgument } from '../../type/definition'; - -import type { - ValidationContext, - SDLValidationContext, -} from '../ValidationContext'; - -/** - * Provided required arguments - * - * A field or directive is only valid if all required (non-null without a - * default value) field arguments have been provided. - */ -export function ProvidedRequiredArgumentsRule( - context: ValidationContext, -): ASTVisitor { - return { - // eslint-disable-next-line new-cap - ...ProvidedRequiredArgumentsOnDirectivesRule(context), - Field: { - // Validate on leave to allow for deeper errors to appear first. - leave(fieldNode) { - const fieldDef = context.getFieldDef(); - if (!fieldDef) { - return false; - } - - // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - const argNodes = fieldNode.arguments ?? []; - const argNodeMap = keyMap(argNodes, (arg) => arg.name.value); - for (const argDef of fieldDef.args) { - const argNode = argNodeMap[argDef.name]; - if (!argNode && isRequiredArgument(argDef)) { - const argTypeStr = inspect(argDef.type); - context.reportError( - new GraphQLError( - `Field "${fieldDef.name}" argument "${argDef.name}" of type "${argTypeStr}" is required, but it was not provided.`, - fieldNode, - ), - ); - } - } - }, - }, - }; -} - -/** - * @internal - */ -export function ProvidedRequiredArgumentsOnDirectivesRule( - context: ValidationContext | SDLValidationContext, -): ASTVisitor { - const requiredArgsMap = Object.create(null); - - const schema = context.getSchema(); - const definedDirectives = schema - ? schema.getDirectives() - : specifiedDirectives; - for (const directive of definedDirectives) { - requiredArgsMap[directive.name] = keyMap( - directive.args.filter(isRequiredArgument), - (arg) => arg.name, - ); - } - - const astDefinitions = context.getDocument().definitions; - for (const def of astDefinitions) { - if (def.kind === Kind.DIRECTIVE_DEFINITION) { - // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - const argNodes = def.arguments ?? []; - - requiredArgsMap[def.name.value] = keyMap( - argNodes.filter(isRequiredArgumentNode), - (arg) => arg.name.value, - ); - } - } - - return { - Directive: { - // Validate on leave to allow for deeper errors to appear first. - leave(directiveNode) { - const directiveName = directiveNode.name.value; - const requiredArgs = requiredArgsMap[directiveName]; - if (requiredArgs) { - // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - const argNodes = directiveNode.arguments ?? []; - const argNodeMap = keyMap(argNodes, (arg) => arg.name.value); - for (const argName of Object.keys(requiredArgs)) { - if (!argNodeMap[argName]) { - const argType = requiredArgs[argName].type; - const argTypeStr = isType(argType) - ? inspect(argType) - : print(argType); - - context.reportError( - new GraphQLError( - `Directive "@${directiveName}" argument "${argName}" of type "${argTypeStr}" is required, but it was not provided.`, - directiveNode, - ), - ); - } - } - } - }, - }, - }; -} - -function isRequiredArgumentNode(arg: InputValueDefinitionNode): boolean { - return arg.type.kind === Kind.NON_NULL_TYPE && arg.defaultValue == null; -} diff --git a/alarm/node_modules/graphql/validation/rules/ProvidedRequiredArgumentsRule.mjs b/alarm/node_modules/graphql/validation/rules/ProvidedRequiredArgumentsRule.mjs deleted file mode 100644 index dc476b4..0000000 --- a/alarm/node_modules/graphql/validation/rules/ProvidedRequiredArgumentsRule.mjs +++ /dev/null @@ -1,119 +0,0 @@ -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - -import inspect from "../../jsutils/inspect.mjs"; -import keyMap from "../../jsutils/keyMap.mjs"; -import { GraphQLError } from "../../error/GraphQLError.mjs"; -import { Kind } from "../../language/kinds.mjs"; -import { print } from "../../language/printer.mjs"; -import { specifiedDirectives } from "../../type/directives.mjs"; -import { isType, isRequiredArgument } from "../../type/definition.mjs"; - -/** - * Provided required arguments - * - * A field or directive is only valid if all required (non-null without a - * default value) field arguments have been provided. - */ -export function ProvidedRequiredArgumentsRule(context) { - return _objectSpread(_objectSpread({}, ProvidedRequiredArgumentsOnDirectivesRule(context)), {}, { - Field: { - // Validate on leave to allow for deeper errors to appear first. - leave: function leave(fieldNode) { - var _fieldNode$arguments; - - var fieldDef = context.getFieldDef(); - - if (!fieldDef) { - return false; - } // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - - - var argNodes = (_fieldNode$arguments = fieldNode.arguments) !== null && _fieldNode$arguments !== void 0 ? _fieldNode$arguments : []; - var argNodeMap = keyMap(argNodes, function (arg) { - return arg.name.value; - }); - - for (var _i2 = 0, _fieldDef$args2 = fieldDef.args; _i2 < _fieldDef$args2.length; _i2++) { - var argDef = _fieldDef$args2[_i2]; - var argNode = argNodeMap[argDef.name]; - - if (!argNode && isRequiredArgument(argDef)) { - var argTypeStr = inspect(argDef.type); - context.reportError(new GraphQLError("Field \"".concat(fieldDef.name, "\" argument \"").concat(argDef.name, "\" of type \"").concat(argTypeStr, "\" is required, but it was not provided."), fieldNode)); - } - } - } - } - }); -} -/** - * @internal - */ - -export function ProvidedRequiredArgumentsOnDirectivesRule(context) { - var requiredArgsMap = Object.create(null); - var schema = context.getSchema(); - var definedDirectives = schema ? schema.getDirectives() : specifiedDirectives; - - for (var _i4 = 0; _i4 < definedDirectives.length; _i4++) { - var directive = definedDirectives[_i4]; - requiredArgsMap[directive.name] = keyMap(directive.args.filter(isRequiredArgument), function (arg) { - return arg.name; - }); - } - - var astDefinitions = context.getDocument().definitions; - - for (var _i6 = 0; _i6 < astDefinitions.length; _i6++) { - var def = astDefinitions[_i6]; - - if (def.kind === Kind.DIRECTIVE_DEFINITION) { - var _def$arguments; - - // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - var argNodes = (_def$arguments = def.arguments) !== null && _def$arguments !== void 0 ? _def$arguments : []; - requiredArgsMap[def.name.value] = keyMap(argNodes.filter(isRequiredArgumentNode), function (arg) { - return arg.name.value; - }); - } - } - - return { - Directive: { - // Validate on leave to allow for deeper errors to appear first. - leave: function leave(directiveNode) { - var directiveName = directiveNode.name.value; - var requiredArgs = requiredArgsMap[directiveName]; - - if (requiredArgs) { - var _directiveNode$argume; - - // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - var _argNodes = (_directiveNode$argume = directiveNode.arguments) !== null && _directiveNode$argume !== void 0 ? _directiveNode$argume : []; - - var argNodeMap = keyMap(_argNodes, function (arg) { - return arg.name.value; - }); - - for (var _i8 = 0, _Object$keys2 = Object.keys(requiredArgs); _i8 < _Object$keys2.length; _i8++) { - var argName = _Object$keys2[_i8]; - - if (!argNodeMap[argName]) { - var argType = requiredArgs[argName].type; - var argTypeStr = isType(argType) ? inspect(argType) : print(argType); - context.reportError(new GraphQLError("Directive \"@".concat(directiveName, "\" argument \"").concat(argName, "\" of type \"").concat(argTypeStr, "\" is required, but it was not provided."), directiveNode)); - } - } - } - } - } - }; -} - -function isRequiredArgumentNode(arg) { - return arg.type.kind === Kind.NON_NULL_TYPE && arg.defaultValue == null; -} diff --git a/alarm/node_modules/graphql/validation/rules/ScalarLeafsRule.d.ts b/alarm/node_modules/graphql/validation/rules/ScalarLeafsRule.d.ts deleted file mode 100644 index ae956ef..0000000 --- a/alarm/node_modules/graphql/validation/rules/ScalarLeafsRule.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { ASTVisitor } from '../../language/visitor'; -import { ValidationContext } from '../ValidationContext'; - -/** - * Scalar leafs - * - * A GraphQL document is valid only if all leaf fields (fields without - * sub selections) are of scalar or enum types. - */ -export function ScalarLeafsRule(context: ValidationContext): ASTVisitor; diff --git a/alarm/node_modules/graphql/validation/rules/ScalarLeafsRule.js b/alarm/node_modules/graphql/validation/rules/ScalarLeafsRule.js deleted file mode 100644 index fc1d5de..0000000 --- a/alarm/node_modules/graphql/validation/rules/ScalarLeafsRule.js +++ /dev/null @@ -1,45 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.ScalarLeafsRule = ScalarLeafsRule; - -var _inspect = _interopRequireDefault(require("../../jsutils/inspect.js")); - -var _GraphQLError = require("../../error/GraphQLError.js"); - -var _definition = require("../../type/definition.js"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Scalar leafs - * - * A GraphQL document is valid only if all leaf fields (fields without - * sub selections) are of scalar or enum types. - */ -function ScalarLeafsRule(context) { - return { - Field: function Field(node) { - var type = context.getType(); - var selectionSet = node.selectionSet; - - if (type) { - if ((0, _definition.isLeafType)((0, _definition.getNamedType)(type))) { - if (selectionSet) { - var fieldName = node.name.value; - var typeStr = (0, _inspect.default)(type); - context.reportError(new _GraphQLError.GraphQLError("Field \"".concat(fieldName, "\" must not have a selection since type \"").concat(typeStr, "\" has no subfields."), selectionSet)); - } - } else if (!selectionSet) { - var _fieldName = node.name.value; - - var _typeStr = (0, _inspect.default)(type); - - context.reportError(new _GraphQLError.GraphQLError("Field \"".concat(_fieldName, "\" of type \"").concat(_typeStr, "\" must have a selection of subfields. Did you mean \"").concat(_fieldName, " { ... }\"?"), node)); - } - } - } - }; -} diff --git a/alarm/node_modules/graphql/validation/rules/ScalarLeafsRule.js.flow b/alarm/node_modules/graphql/validation/rules/ScalarLeafsRule.js.flow deleted file mode 100644 index cac22c5..0000000 --- a/alarm/node_modules/graphql/validation/rules/ScalarLeafsRule.js.flow +++ /dev/null @@ -1,49 +0,0 @@ -// @flow strict -import inspect from '../../jsutils/inspect'; - -import { GraphQLError } from '../../error/GraphQLError'; - -import type { FieldNode } from '../../language/ast'; -import type { ASTVisitor } from '../../language/visitor'; - -import { getNamedType, isLeafType } from '../../type/definition'; - -import type { ValidationContext } from '../ValidationContext'; - -/** - * Scalar leafs - * - * A GraphQL document is valid only if all leaf fields (fields without - * sub selections) are of scalar or enum types. - */ -export function ScalarLeafsRule(context: ValidationContext): ASTVisitor { - return { - Field(node: FieldNode) { - const type = context.getType(); - const selectionSet = node.selectionSet; - if (type) { - if (isLeafType(getNamedType(type))) { - if (selectionSet) { - const fieldName = node.name.value; - const typeStr = inspect(type); - context.reportError( - new GraphQLError( - `Field "${fieldName}" must not have a selection since type "${typeStr}" has no subfields.`, - selectionSet, - ), - ); - } - } else if (!selectionSet) { - const fieldName = node.name.value; - const typeStr = inspect(type); - context.reportError( - new GraphQLError( - `Field "${fieldName}" of type "${typeStr}" must have a selection of subfields. Did you mean "${fieldName} { ... }"?`, - node, - ), - ); - } - } - }, - }; -} diff --git a/alarm/node_modules/graphql/validation/rules/ScalarLeafsRule.mjs b/alarm/node_modules/graphql/validation/rules/ScalarLeafsRule.mjs deleted file mode 100644 index 8a5111d..0000000 --- a/alarm/node_modules/graphql/validation/rules/ScalarLeafsRule.mjs +++ /dev/null @@ -1,34 +0,0 @@ -import inspect from "../../jsutils/inspect.mjs"; -import { GraphQLError } from "../../error/GraphQLError.mjs"; -import { getNamedType, isLeafType } from "../../type/definition.mjs"; - -/** - * Scalar leafs - * - * A GraphQL document is valid only if all leaf fields (fields without - * sub selections) are of scalar or enum types. - */ -export function ScalarLeafsRule(context) { - return { - Field: function Field(node) { - var type = context.getType(); - var selectionSet = node.selectionSet; - - if (type) { - if (isLeafType(getNamedType(type))) { - if (selectionSet) { - var fieldName = node.name.value; - var typeStr = inspect(type); - context.reportError(new GraphQLError("Field \"".concat(fieldName, "\" must not have a selection since type \"").concat(typeStr, "\" has no subfields."), selectionSet)); - } - } else if (!selectionSet) { - var _fieldName = node.name.value; - - var _typeStr = inspect(type); - - context.reportError(new GraphQLError("Field \"".concat(_fieldName, "\" of type \"").concat(_typeStr, "\" must have a selection of subfields. Did you mean \"").concat(_fieldName, " { ... }\"?"), node)); - } - } - } - }; -} diff --git a/alarm/node_modules/graphql/validation/rules/SingleFieldSubscriptionsRule.d.ts b/alarm/node_modules/graphql/validation/rules/SingleFieldSubscriptionsRule.d.ts deleted file mode 100644 index d56c4fd..0000000 --- a/alarm/node_modules/graphql/validation/rules/SingleFieldSubscriptionsRule.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { ASTVisitor } from '../../language/visitor'; -import { ASTValidationContext } from '../ValidationContext'; - -/** - * Subscriptions must only include one field. - * - * A GraphQL subscription is valid only if it contains a single root field. - */ -export function SingleFieldSubscriptionsRule( - context: ASTValidationContext, -): ASTVisitor; diff --git a/alarm/node_modules/graphql/validation/rules/SingleFieldSubscriptionsRule.js b/alarm/node_modules/graphql/validation/rules/SingleFieldSubscriptionsRule.js deleted file mode 100644 index 80d199f..0000000 --- a/alarm/node_modules/graphql/validation/rules/SingleFieldSubscriptionsRule.js +++ /dev/null @@ -1,25 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.SingleFieldSubscriptionsRule = SingleFieldSubscriptionsRule; - -var _GraphQLError = require("../../error/GraphQLError.js"); - -/** - * Subscriptions must only include one field. - * - * A GraphQL subscription is valid only if it contains a single root field. - */ -function SingleFieldSubscriptionsRule(context) { - return { - OperationDefinition: function OperationDefinition(node) { - if (node.operation === 'subscription') { - if (node.selectionSet.selections.length !== 1) { - context.reportError(new _GraphQLError.GraphQLError(node.name ? "Subscription \"".concat(node.name.value, "\" must select only one top level field.") : 'Anonymous Subscription must select only one top level field.', node.selectionSet.selections.slice(1))); - } - } - } - }; -} diff --git a/alarm/node_modules/graphql/validation/rules/SingleFieldSubscriptionsRule.js.flow b/alarm/node_modules/graphql/validation/rules/SingleFieldSubscriptionsRule.js.flow deleted file mode 100644 index 290432f..0000000 --- a/alarm/node_modules/graphql/validation/rules/SingleFieldSubscriptionsRule.js.flow +++ /dev/null @@ -1,33 +0,0 @@ -// @flow strict -import { GraphQLError } from '../../error/GraphQLError'; - -import type { ASTVisitor } from '../../language/visitor'; -import type { OperationDefinitionNode } from '../../language/ast'; - -import type { ASTValidationContext } from '../ValidationContext'; - -/** - * Subscriptions must only include one field. - * - * A GraphQL subscription is valid only if it contains a single root field. - */ -export function SingleFieldSubscriptionsRule( - context: ASTValidationContext, -): ASTVisitor { - return { - OperationDefinition(node: OperationDefinitionNode) { - if (node.operation === 'subscription') { - if (node.selectionSet.selections.length !== 1) { - context.reportError( - new GraphQLError( - node.name - ? `Subscription "${node.name.value}" must select only one top level field.` - : 'Anonymous Subscription must select only one top level field.', - node.selectionSet.selections.slice(1), - ), - ); - } - } - }, - }; -} diff --git a/alarm/node_modules/graphql/validation/rules/SingleFieldSubscriptionsRule.mjs b/alarm/node_modules/graphql/validation/rules/SingleFieldSubscriptionsRule.mjs deleted file mode 100644 index 0dd5351..0000000 --- a/alarm/node_modules/graphql/validation/rules/SingleFieldSubscriptionsRule.mjs +++ /dev/null @@ -1,18 +0,0 @@ -import { GraphQLError } from "../../error/GraphQLError.mjs"; - -/** - * Subscriptions must only include one field. - * - * A GraphQL subscription is valid only if it contains a single root field. - */ -export function SingleFieldSubscriptionsRule(context) { - return { - OperationDefinition: function OperationDefinition(node) { - if (node.operation === 'subscription') { - if (node.selectionSet.selections.length !== 1) { - context.reportError(new GraphQLError(node.name ? "Subscription \"".concat(node.name.value, "\" must select only one top level field.") : 'Anonymous Subscription must select only one top level field.', node.selectionSet.selections.slice(1))); - } - } - } - }; -} diff --git a/alarm/node_modules/graphql/validation/rules/UniqueArgumentNamesRule.d.ts b/alarm/node_modules/graphql/validation/rules/UniqueArgumentNamesRule.d.ts deleted file mode 100644 index 1d0d4f4..0000000 --- a/alarm/node_modules/graphql/validation/rules/UniqueArgumentNamesRule.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { ASTVisitor } from '../../language/visitor'; -import { ASTValidationContext } from '../ValidationContext'; - -/** - * Unique argument names - * - * A GraphQL field or directive is only valid if all supplied arguments are - * uniquely named. - */ -export function UniqueArgumentNamesRule( - context: ASTValidationContext, -): ASTVisitor; diff --git a/alarm/node_modules/graphql/validation/rules/UniqueArgumentNamesRule.js b/alarm/node_modules/graphql/validation/rules/UniqueArgumentNamesRule.js deleted file mode 100644 index f3fe599..0000000 --- a/alarm/node_modules/graphql/validation/rules/UniqueArgumentNamesRule.js +++ /dev/null @@ -1,37 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.UniqueArgumentNamesRule = UniqueArgumentNamesRule; - -var _GraphQLError = require("../../error/GraphQLError.js"); - -/** - * Unique argument names - * - * A GraphQL field or directive is only valid if all supplied arguments are - * uniquely named. - */ -function UniqueArgumentNamesRule(context) { - var knownArgNames = Object.create(null); - return { - Field: function Field() { - knownArgNames = Object.create(null); - }, - Directive: function Directive() { - knownArgNames = Object.create(null); - }, - Argument: function Argument(node) { - var argName = node.name.value; - - if (knownArgNames[argName]) { - context.reportError(new _GraphQLError.GraphQLError("There can be only one argument named \"".concat(argName, "\"."), [knownArgNames[argName], node.name])); - } else { - knownArgNames[argName] = node.name; - } - - return false; - } - }; -} diff --git a/alarm/node_modules/graphql/validation/rules/UniqueArgumentNamesRule.js.flow b/alarm/node_modules/graphql/validation/rules/UniqueArgumentNamesRule.js.flow deleted file mode 100644 index 499e6ed..0000000 --- a/alarm/node_modules/graphql/validation/rules/UniqueArgumentNamesRule.js.flow +++ /dev/null @@ -1,39 +0,0 @@ -// @flow strict -import { GraphQLError } from '../../error/GraphQLError'; -import type { ASTVisitor } from '../../language/visitor'; - -import type { ASTValidationContext } from '../ValidationContext'; - -/** - * Unique argument names - * - * A GraphQL field or directive is only valid if all supplied arguments are - * uniquely named. - */ -export function UniqueArgumentNamesRule( - context: ASTValidationContext, -): ASTVisitor { - let knownArgNames = Object.create(null); - return { - Field() { - knownArgNames = Object.create(null); - }, - Directive() { - knownArgNames = Object.create(null); - }, - Argument(node) { - const argName = node.name.value; - if (knownArgNames[argName]) { - context.reportError( - new GraphQLError( - `There can be only one argument named "${argName}".`, - [knownArgNames[argName], node.name], - ), - ); - } else { - knownArgNames[argName] = node.name; - } - return false; - }, - }; -} diff --git a/alarm/node_modules/graphql/validation/rules/UniqueArgumentNamesRule.mjs b/alarm/node_modules/graphql/validation/rules/UniqueArgumentNamesRule.mjs deleted file mode 100644 index 5359d08..0000000 --- a/alarm/node_modules/graphql/validation/rules/UniqueArgumentNamesRule.mjs +++ /dev/null @@ -1,30 +0,0 @@ -import { GraphQLError } from "../../error/GraphQLError.mjs"; - -/** - * Unique argument names - * - * A GraphQL field or directive is only valid if all supplied arguments are - * uniquely named. - */ -export function UniqueArgumentNamesRule(context) { - var knownArgNames = Object.create(null); - return { - Field: function Field() { - knownArgNames = Object.create(null); - }, - Directive: function Directive() { - knownArgNames = Object.create(null); - }, - Argument: function Argument(node) { - var argName = node.name.value; - - if (knownArgNames[argName]) { - context.reportError(new GraphQLError("There can be only one argument named \"".concat(argName, "\"."), [knownArgNames[argName], node.name])); - } else { - knownArgNames[argName] = node.name; - } - - return false; - } - }; -} diff --git a/alarm/node_modules/graphql/validation/rules/UniqueDirectiveNames.d.ts b/alarm/node_modules/graphql/validation/rules/UniqueDirectiveNames.d.ts deleted file mode 100644 index c197e87..0000000 --- a/alarm/node_modules/graphql/validation/rules/UniqueDirectiveNames.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * @deprecated and will be removed in v16 - * Please use either: - * import { UniqueDirectiveNamesRule } from 'graphql' - * or - * import { UniqueDirectiveNamesRule } from 'graphql/validation' - */ -export { UniqueDirectiveNamesRule as UniqueDirectiveNames } from './UniqueDirectiveNamesRule'; diff --git a/alarm/node_modules/graphql/validation/rules/UniqueDirectiveNames.js b/alarm/node_modules/graphql/validation/rules/UniqueDirectiveNames.js deleted file mode 100644 index 0e94e14..0000000 --- a/alarm/node_modules/graphql/validation/rules/UniqueDirectiveNames.js +++ /dev/null @@ -1,13 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -Object.defineProperty(exports, "UniqueDirectiveNames", { - enumerable: true, - get: function get() { - return _UniqueDirectiveNamesRule.UniqueDirectiveNamesRule; - } -}); - -var _UniqueDirectiveNamesRule = require("./UniqueDirectiveNamesRule.js"); diff --git a/alarm/node_modules/graphql/validation/rules/UniqueDirectiveNames.js.flow b/alarm/node_modules/graphql/validation/rules/UniqueDirectiveNames.js.flow deleted file mode 100644 index 0dc4598..0000000 --- a/alarm/node_modules/graphql/validation/rules/UniqueDirectiveNames.js.flow +++ /dev/null @@ -1,9 +0,0 @@ -// @flow strict -/** - * @deprecated and will be removed in v16 - * Please use either: - * import { UniqueDirectiveNamesRule } from 'graphql' - * or - * import { UniqueDirectiveNamesRule } from 'graphql/validation' - */ -export { UniqueDirectiveNamesRule as UniqueDirectiveNames } from './UniqueDirectiveNamesRule'; diff --git a/alarm/node_modules/graphql/validation/rules/UniqueDirectiveNames.mjs b/alarm/node_modules/graphql/validation/rules/UniqueDirectiveNames.mjs deleted file mode 100644 index 24f4e39..0000000 --- a/alarm/node_modules/graphql/validation/rules/UniqueDirectiveNames.mjs +++ /dev/null @@ -1,8 +0,0 @@ -/** - * @deprecated and will be removed in v16 - * Please use either: - * import { UniqueDirectiveNamesRule } from 'graphql' - * or - * import { UniqueDirectiveNamesRule } from 'graphql/validation' - */ -export { UniqueDirectiveNamesRule as UniqueDirectiveNames } from "./UniqueDirectiveNamesRule.mjs"; diff --git a/alarm/node_modules/graphql/validation/rules/UniqueDirectiveNamesRule.d.ts b/alarm/node_modules/graphql/validation/rules/UniqueDirectiveNamesRule.d.ts deleted file mode 100644 index a4dd841..0000000 --- a/alarm/node_modules/graphql/validation/rules/UniqueDirectiveNamesRule.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { ASTVisitor } from '../../language/visitor'; -import { SDLValidationContext } from '../ValidationContext'; - -/** - * Unique directive names - * - * A GraphQL document is only valid if all defined directives have unique names. - */ -export function UniqueDirectiveNamesRule( - context: SDLValidationContext, -): ASTVisitor; diff --git a/alarm/node_modules/graphql/validation/rules/UniqueDirectiveNamesRule.js b/alarm/node_modules/graphql/validation/rules/UniqueDirectiveNamesRule.js deleted file mode 100644 index 15731e5..0000000 --- a/alarm/node_modules/graphql/validation/rules/UniqueDirectiveNamesRule.js +++ /dev/null @@ -1,36 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.UniqueDirectiveNamesRule = UniqueDirectiveNamesRule; - -var _GraphQLError = require("../../error/GraphQLError.js"); - -/** - * Unique directive names - * - * A GraphQL document is only valid if all defined directives have unique names. - */ -function UniqueDirectiveNamesRule(context) { - var knownDirectiveNames = Object.create(null); - var schema = context.getSchema(); - return { - DirectiveDefinition: function DirectiveDefinition(node) { - var directiveName = node.name.value; - - if (schema !== null && schema !== void 0 && schema.getDirective(directiveName)) { - context.reportError(new _GraphQLError.GraphQLError("Directive \"@".concat(directiveName, "\" already exists in the schema. It cannot be redefined."), node.name)); - return; - } - - if (knownDirectiveNames[directiveName]) { - context.reportError(new _GraphQLError.GraphQLError("There can be only one directive named \"@".concat(directiveName, "\"."), [knownDirectiveNames[directiveName], node.name])); - } else { - knownDirectiveNames[directiveName] = node.name; - } - - return false; - } - }; -} diff --git a/alarm/node_modules/graphql/validation/rules/UniqueDirectiveNamesRule.js.flow b/alarm/node_modules/graphql/validation/rules/UniqueDirectiveNamesRule.js.flow deleted file mode 100644 index 688a2bb..0000000 --- a/alarm/node_modules/graphql/validation/rules/UniqueDirectiveNamesRule.js.flow +++ /dev/null @@ -1,46 +0,0 @@ -// @flow strict -import { GraphQLError } from '../../error/GraphQLError'; -import type { ASTVisitor } from '../../language/visitor'; - -import type { SDLValidationContext } from '../ValidationContext'; - -/** - * Unique directive names - * - * A GraphQL document is only valid if all defined directives have unique names. - */ -export function UniqueDirectiveNamesRule( - context: SDLValidationContext, -): ASTVisitor { - const knownDirectiveNames = Object.create(null); - const schema = context.getSchema(); - - return { - DirectiveDefinition(node) { - const directiveName = node.name.value; - - if (schema?.getDirective(directiveName)) { - context.reportError( - new GraphQLError( - `Directive "@${directiveName}" already exists in the schema. It cannot be redefined.`, - node.name, - ), - ); - return; - } - - if (knownDirectiveNames[directiveName]) { - context.reportError( - new GraphQLError( - `There can be only one directive named "@${directiveName}".`, - [knownDirectiveNames[directiveName], node.name], - ), - ); - } else { - knownDirectiveNames[directiveName] = node.name; - } - - return false; - }, - }; -} diff --git a/alarm/node_modules/graphql/validation/rules/UniqueDirectiveNamesRule.mjs b/alarm/node_modules/graphql/validation/rules/UniqueDirectiveNamesRule.mjs deleted file mode 100644 index 8d0f843..0000000 --- a/alarm/node_modules/graphql/validation/rules/UniqueDirectiveNamesRule.mjs +++ /dev/null @@ -1,29 +0,0 @@ -import { GraphQLError } from "../../error/GraphQLError.mjs"; - -/** - * Unique directive names - * - * A GraphQL document is only valid if all defined directives have unique names. - */ -export function UniqueDirectiveNamesRule(context) { - var knownDirectiveNames = Object.create(null); - var schema = context.getSchema(); - return { - DirectiveDefinition: function DirectiveDefinition(node) { - var directiveName = node.name.value; - - if (schema !== null && schema !== void 0 && schema.getDirective(directiveName)) { - context.reportError(new GraphQLError("Directive \"@".concat(directiveName, "\" already exists in the schema. It cannot be redefined."), node.name)); - return; - } - - if (knownDirectiveNames[directiveName]) { - context.reportError(new GraphQLError("There can be only one directive named \"@".concat(directiveName, "\"."), [knownDirectiveNames[directiveName], node.name])); - } else { - knownDirectiveNames[directiveName] = node.name; - } - - return false; - } - }; -} diff --git a/alarm/node_modules/graphql/validation/rules/UniqueDirectivesPerLocationRule.d.ts b/alarm/node_modules/graphql/validation/rules/UniqueDirectivesPerLocationRule.d.ts deleted file mode 100644 index d059446..0000000 --- a/alarm/node_modules/graphql/validation/rules/UniqueDirectivesPerLocationRule.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { ASTVisitor } from '../../language/visitor'; -import { ASTValidationContext } from '../ValidationContext'; - -/** - * Unique directive names per location - * - * A GraphQL document is only valid if all directives at a given location - * are uniquely named. - */ -export function UniqueDirectivesPerLocationRule( - context: ASTValidationContext, -): ASTVisitor; diff --git a/alarm/node_modules/graphql/validation/rules/UniqueDirectivesPerLocationRule.js b/alarm/node_modules/graphql/validation/rules/UniqueDirectivesPerLocationRule.js deleted file mode 100644 index 9505a37..0000000 --- a/alarm/node_modules/graphql/validation/rules/UniqueDirectivesPerLocationRule.js +++ /dev/null @@ -1,82 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.UniqueDirectivesPerLocationRule = UniqueDirectivesPerLocationRule; - -var _GraphQLError = require("../../error/GraphQLError.js"); - -var _kinds = require("../../language/kinds.js"); - -var _predicates = require("../../language/predicates.js"); - -var _directives = require("../../type/directives.js"); - -/** - * Unique directive names per location - * - * A GraphQL document is only valid if all non-repeatable directives at - * a given location are uniquely named. - */ -function UniqueDirectivesPerLocationRule(context) { - var uniqueDirectiveMap = Object.create(null); - var schema = context.getSchema(); - var definedDirectives = schema ? schema.getDirectives() : _directives.specifiedDirectives; - - for (var _i2 = 0; _i2 < definedDirectives.length; _i2++) { - var directive = definedDirectives[_i2]; - uniqueDirectiveMap[directive.name] = !directive.isRepeatable; - } - - var astDefinitions = context.getDocument().definitions; - - for (var _i4 = 0; _i4 < astDefinitions.length; _i4++) { - var def = astDefinitions[_i4]; - - if (def.kind === _kinds.Kind.DIRECTIVE_DEFINITION) { - uniqueDirectiveMap[def.name.value] = !def.repeatable; - } - } - - var schemaDirectives = Object.create(null); - var typeDirectivesMap = Object.create(null); - return { - // Many different AST nodes may contain directives. Rather than listing - // them all, just listen for entering any node, and check to see if it - // defines any directives. - enter: function enter(node) { - if (node.directives == null) { - return; - } - - var seenDirectives; - - if (node.kind === _kinds.Kind.SCHEMA_DEFINITION || node.kind === _kinds.Kind.SCHEMA_EXTENSION) { - seenDirectives = schemaDirectives; - } else if ((0, _predicates.isTypeDefinitionNode)(node) || (0, _predicates.isTypeExtensionNode)(node)) { - var typeName = node.name.value; - seenDirectives = typeDirectivesMap[typeName]; - - if (seenDirectives === undefined) { - typeDirectivesMap[typeName] = seenDirectives = Object.create(null); - } - } else { - seenDirectives = Object.create(null); - } - - for (var _i6 = 0, _node$directives2 = node.directives; _i6 < _node$directives2.length; _i6++) { - var _directive = _node$directives2[_i6]; - var directiveName = _directive.name.value; - - if (uniqueDirectiveMap[directiveName]) { - if (seenDirectives[directiveName]) { - context.reportError(new _GraphQLError.GraphQLError("The directive \"@".concat(directiveName, "\" can only be used once at this location."), [seenDirectives[directiveName], _directive])); - } else { - seenDirectives[directiveName] = _directive; - } - } - } - } - }; -} diff --git a/alarm/node_modules/graphql/validation/rules/UniqueDirectivesPerLocationRule.js.flow b/alarm/node_modules/graphql/validation/rules/UniqueDirectivesPerLocationRule.js.flow deleted file mode 100644 index a753a84..0000000 --- a/alarm/node_modules/graphql/validation/rules/UniqueDirectivesPerLocationRule.js.flow +++ /dev/null @@ -1,90 +0,0 @@ -// @flow strict -import { GraphQLError } from '../../error/GraphQLError'; - -import { Kind } from '../../language/kinds'; -import type { ASTVisitor } from '../../language/visitor'; -import { - isTypeDefinitionNode, - isTypeExtensionNode, -} from '../../language/predicates'; - -import { specifiedDirectives } from '../../type/directives'; - -import type { - SDLValidationContext, - ValidationContext, -} from '../ValidationContext'; - -/** - * Unique directive names per location - * - * A GraphQL document is only valid if all non-repeatable directives at - * a given location are uniquely named. - */ -export function UniqueDirectivesPerLocationRule( - context: ValidationContext | SDLValidationContext, -): ASTVisitor { - const uniqueDirectiveMap = Object.create(null); - - const schema = context.getSchema(); - const definedDirectives = schema - ? schema.getDirectives() - : specifiedDirectives; - for (const directive of definedDirectives) { - uniqueDirectiveMap[directive.name] = !directive.isRepeatable; - } - - const astDefinitions = context.getDocument().definitions; - for (const def of astDefinitions) { - if (def.kind === Kind.DIRECTIVE_DEFINITION) { - uniqueDirectiveMap[def.name.value] = !def.repeatable; - } - } - - const schemaDirectives = Object.create(null); - const typeDirectivesMap = Object.create(null); - - return { - // Many different AST nodes may contain directives. Rather than listing - // them all, just listen for entering any node, and check to see if it - // defines any directives. - enter(node) { - if (node.directives == null) { - return; - } - - let seenDirectives; - if ( - node.kind === Kind.SCHEMA_DEFINITION || - node.kind === Kind.SCHEMA_EXTENSION - ) { - seenDirectives = schemaDirectives; - } else if (isTypeDefinitionNode(node) || isTypeExtensionNode(node)) { - const typeName = node.name.value; - seenDirectives = typeDirectivesMap[typeName]; - if (seenDirectives === undefined) { - typeDirectivesMap[typeName] = seenDirectives = Object.create(null); - } - } else { - seenDirectives = Object.create(null); - } - - for (const directive of node.directives) { - const directiveName = directive.name.value; - - if (uniqueDirectiveMap[directiveName]) { - if (seenDirectives[directiveName]) { - context.reportError( - new GraphQLError( - `The directive "@${directiveName}" can only be used once at this location.`, - [seenDirectives[directiveName], directive], - ), - ); - } else { - seenDirectives[directiveName] = directive; - } - } - } - }, - }; -} diff --git a/alarm/node_modules/graphql/validation/rules/UniqueDirectivesPerLocationRule.mjs b/alarm/node_modules/graphql/validation/rules/UniqueDirectivesPerLocationRule.mjs deleted file mode 100644 index 9a3951a..0000000 --- a/alarm/node_modules/graphql/validation/rules/UniqueDirectivesPerLocationRule.mjs +++ /dev/null @@ -1,72 +0,0 @@ -import { GraphQLError } from "../../error/GraphQLError.mjs"; -import { Kind } from "../../language/kinds.mjs"; -import { isTypeDefinitionNode, isTypeExtensionNode } from "../../language/predicates.mjs"; -import { specifiedDirectives } from "../../type/directives.mjs"; - -/** - * Unique directive names per location - * - * A GraphQL document is only valid if all non-repeatable directives at - * a given location are uniquely named. - */ -export function UniqueDirectivesPerLocationRule(context) { - var uniqueDirectiveMap = Object.create(null); - var schema = context.getSchema(); - var definedDirectives = schema ? schema.getDirectives() : specifiedDirectives; - - for (var _i2 = 0; _i2 < definedDirectives.length; _i2++) { - var directive = definedDirectives[_i2]; - uniqueDirectiveMap[directive.name] = !directive.isRepeatable; - } - - var astDefinitions = context.getDocument().definitions; - - for (var _i4 = 0; _i4 < astDefinitions.length; _i4++) { - var def = astDefinitions[_i4]; - - if (def.kind === Kind.DIRECTIVE_DEFINITION) { - uniqueDirectiveMap[def.name.value] = !def.repeatable; - } - } - - var schemaDirectives = Object.create(null); - var typeDirectivesMap = Object.create(null); - return { - // Many different AST nodes may contain directives. Rather than listing - // them all, just listen for entering any node, and check to see if it - // defines any directives. - enter: function enter(node) { - if (node.directives == null) { - return; - } - - var seenDirectives; - - if (node.kind === Kind.SCHEMA_DEFINITION || node.kind === Kind.SCHEMA_EXTENSION) { - seenDirectives = schemaDirectives; - } else if (isTypeDefinitionNode(node) || isTypeExtensionNode(node)) { - var typeName = node.name.value; - seenDirectives = typeDirectivesMap[typeName]; - - if (seenDirectives === undefined) { - typeDirectivesMap[typeName] = seenDirectives = Object.create(null); - } - } else { - seenDirectives = Object.create(null); - } - - for (var _i6 = 0, _node$directives2 = node.directives; _i6 < _node$directives2.length; _i6++) { - var _directive = _node$directives2[_i6]; - var directiveName = _directive.name.value; - - if (uniqueDirectiveMap[directiveName]) { - if (seenDirectives[directiveName]) { - context.reportError(new GraphQLError("The directive \"@".concat(directiveName, "\" can only be used once at this location."), [seenDirectives[directiveName], _directive])); - } else { - seenDirectives[directiveName] = _directive; - } - } - } - } - }; -} diff --git a/alarm/node_modules/graphql/validation/rules/UniqueEnumValueNames.d.ts b/alarm/node_modules/graphql/validation/rules/UniqueEnumValueNames.d.ts deleted file mode 100644 index 96d9b78..0000000 --- a/alarm/node_modules/graphql/validation/rules/UniqueEnumValueNames.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * @deprecated and will be removed in v16 - * Please use either: - * import { UniqueEnumValueNamesRule } from 'graphql' - * or - * import { UniqueEnumValueNamesRule } from 'graphql/validation' - */ -export { UniqueEnumValueNamesRule as UniqueEnumValueNames } from './UniqueEnumValueNamesRule'; diff --git a/alarm/node_modules/graphql/validation/rules/UniqueEnumValueNames.js b/alarm/node_modules/graphql/validation/rules/UniqueEnumValueNames.js deleted file mode 100644 index 4a9b5e5..0000000 --- a/alarm/node_modules/graphql/validation/rules/UniqueEnumValueNames.js +++ /dev/null @@ -1,13 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -Object.defineProperty(exports, "UniqueEnumValueNames", { - enumerable: true, - get: function get() { - return _UniqueEnumValueNamesRule.UniqueEnumValueNamesRule; - } -}); - -var _UniqueEnumValueNamesRule = require("./UniqueEnumValueNamesRule.js"); diff --git a/alarm/node_modules/graphql/validation/rules/UniqueEnumValueNames.js.flow b/alarm/node_modules/graphql/validation/rules/UniqueEnumValueNames.js.flow deleted file mode 100644 index 4c67b17..0000000 --- a/alarm/node_modules/graphql/validation/rules/UniqueEnumValueNames.js.flow +++ /dev/null @@ -1,9 +0,0 @@ -// @flow strict -/** - * @deprecated and will be removed in v16 - * Please use either: - * import { UniqueEnumValueNamesRule } from 'graphql' - * or - * import { UniqueEnumValueNamesRule } from 'graphql/validation' - */ -export { UniqueEnumValueNamesRule as UniqueEnumValueNames } from './UniqueEnumValueNamesRule'; diff --git a/alarm/node_modules/graphql/validation/rules/UniqueEnumValueNames.mjs b/alarm/node_modules/graphql/validation/rules/UniqueEnumValueNames.mjs deleted file mode 100644 index 05f361a..0000000 --- a/alarm/node_modules/graphql/validation/rules/UniqueEnumValueNames.mjs +++ /dev/null @@ -1,8 +0,0 @@ -/** - * @deprecated and will be removed in v16 - * Please use either: - * import { UniqueEnumValueNamesRule } from 'graphql' - * or - * import { UniqueEnumValueNamesRule } from 'graphql/validation' - */ -export { UniqueEnumValueNamesRule as UniqueEnumValueNames } from "./UniqueEnumValueNamesRule.mjs"; diff --git a/alarm/node_modules/graphql/validation/rules/UniqueEnumValueNamesRule.d.ts b/alarm/node_modules/graphql/validation/rules/UniqueEnumValueNamesRule.d.ts deleted file mode 100644 index 9c5ff50..0000000 --- a/alarm/node_modules/graphql/validation/rules/UniqueEnumValueNamesRule.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { ASTVisitor } from '../../language/visitor'; -import { SDLValidationContext } from '../ValidationContext'; - -/** - * Unique enum value names - * - * A GraphQL enum type is only valid if all its values are uniquely named. - */ -export function UniqueEnumValueNamesRule( - context: SDLValidationContext, -): ASTVisitor; diff --git a/alarm/node_modules/graphql/validation/rules/UniqueEnumValueNamesRule.js b/alarm/node_modules/graphql/validation/rules/UniqueEnumValueNamesRule.js deleted file mode 100644 index 1fed87a..0000000 --- a/alarm/node_modules/graphql/validation/rules/UniqueEnumValueNamesRule.js +++ /dev/null @@ -1,55 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.UniqueEnumValueNamesRule = UniqueEnumValueNamesRule; - -var _GraphQLError = require("../../error/GraphQLError.js"); - -var _definition = require("../../type/definition.js"); - -/** - * Unique enum value names - * - * A GraphQL enum type is only valid if all its values are uniquely named. - */ -function UniqueEnumValueNamesRule(context) { - var schema = context.getSchema(); - var existingTypeMap = schema ? schema.getTypeMap() : Object.create(null); - var knownValueNames = Object.create(null); - return { - EnumTypeDefinition: checkValueUniqueness, - EnumTypeExtension: checkValueUniqueness - }; - - function checkValueUniqueness(node) { - var _node$values; - - var typeName = node.name.value; - - if (!knownValueNames[typeName]) { - knownValueNames[typeName] = Object.create(null); - } // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - - - var valueNodes = (_node$values = node.values) !== null && _node$values !== void 0 ? _node$values : []; - var valueNames = knownValueNames[typeName]; - - for (var _i2 = 0; _i2 < valueNodes.length; _i2++) { - var valueDef = valueNodes[_i2]; - var valueName = valueDef.name.value; - var existingType = existingTypeMap[typeName]; - - if ((0, _definition.isEnumType)(existingType) && existingType.getValue(valueName)) { - context.reportError(new _GraphQLError.GraphQLError("Enum value \"".concat(typeName, ".").concat(valueName, "\" already exists in the schema. It cannot also be defined in this type extension."), valueDef.name)); - } else if (valueNames[valueName]) { - context.reportError(new _GraphQLError.GraphQLError("Enum value \"".concat(typeName, ".").concat(valueName, "\" can only be defined once."), [valueNames[valueName], valueDef.name])); - } else { - valueNames[valueName] = valueDef.name; - } - } - - return false; - } -} diff --git a/alarm/node_modules/graphql/validation/rules/UniqueEnumValueNamesRule.js.flow b/alarm/node_modules/graphql/validation/rules/UniqueEnumValueNamesRule.js.flow deleted file mode 100644 index 09515e8..0000000 --- a/alarm/node_modules/graphql/validation/rules/UniqueEnumValueNamesRule.js.flow +++ /dev/null @@ -1,69 +0,0 @@ -// @flow strict -import { GraphQLError } from '../../error/GraphQLError'; - -import type { ASTVisitor } from '../../language/visitor'; -import type { - EnumTypeDefinitionNode, - EnumTypeExtensionNode, -} from '../../language/ast'; - -import { isEnumType } from '../../type/definition'; - -import type { SDLValidationContext } from '../ValidationContext'; - -/** - * Unique enum value names - * - * A GraphQL enum type is only valid if all its values are uniquely named. - */ -export function UniqueEnumValueNamesRule( - context: SDLValidationContext, -): ASTVisitor { - const schema = context.getSchema(); - const existingTypeMap = schema ? schema.getTypeMap() : Object.create(null); - const knownValueNames = Object.create(null); - - return { - EnumTypeDefinition: checkValueUniqueness, - EnumTypeExtension: checkValueUniqueness, - }; - - function checkValueUniqueness( - node: EnumTypeDefinitionNode | EnumTypeExtensionNode, - ) { - const typeName = node.name.value; - - if (!knownValueNames[typeName]) { - knownValueNames[typeName] = Object.create(null); - } - - // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - const valueNodes = node.values ?? []; - const valueNames = knownValueNames[typeName]; - - for (const valueDef of valueNodes) { - const valueName = valueDef.name.value; - - const existingType = existingTypeMap[typeName]; - if (isEnumType(existingType) && existingType.getValue(valueName)) { - context.reportError( - new GraphQLError( - `Enum value "${typeName}.${valueName}" already exists in the schema. It cannot also be defined in this type extension.`, - valueDef.name, - ), - ); - } else if (valueNames[valueName]) { - context.reportError( - new GraphQLError( - `Enum value "${typeName}.${valueName}" can only be defined once.`, - [valueNames[valueName], valueDef.name], - ), - ); - } else { - valueNames[valueName] = valueDef.name; - } - } - - return false; - } -} diff --git a/alarm/node_modules/graphql/validation/rules/UniqueEnumValueNamesRule.mjs b/alarm/node_modules/graphql/validation/rules/UniqueEnumValueNamesRule.mjs deleted file mode 100644 index 4e821b8..0000000 --- a/alarm/node_modules/graphql/validation/rules/UniqueEnumValueNamesRule.mjs +++ /dev/null @@ -1,47 +0,0 @@ -import { GraphQLError } from "../../error/GraphQLError.mjs"; -import { isEnumType } from "../../type/definition.mjs"; - -/** - * Unique enum value names - * - * A GraphQL enum type is only valid if all its values are uniquely named. - */ -export function UniqueEnumValueNamesRule(context) { - var schema = context.getSchema(); - var existingTypeMap = schema ? schema.getTypeMap() : Object.create(null); - var knownValueNames = Object.create(null); - return { - EnumTypeDefinition: checkValueUniqueness, - EnumTypeExtension: checkValueUniqueness - }; - - function checkValueUniqueness(node) { - var _node$values; - - var typeName = node.name.value; - - if (!knownValueNames[typeName]) { - knownValueNames[typeName] = Object.create(null); - } // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - - - var valueNodes = (_node$values = node.values) !== null && _node$values !== void 0 ? _node$values : []; - var valueNames = knownValueNames[typeName]; - - for (var _i2 = 0; _i2 < valueNodes.length; _i2++) { - var valueDef = valueNodes[_i2]; - var valueName = valueDef.name.value; - var existingType = existingTypeMap[typeName]; - - if (isEnumType(existingType) && existingType.getValue(valueName)) { - context.reportError(new GraphQLError("Enum value \"".concat(typeName, ".").concat(valueName, "\" already exists in the schema. It cannot also be defined in this type extension."), valueDef.name)); - } else if (valueNames[valueName]) { - context.reportError(new GraphQLError("Enum value \"".concat(typeName, ".").concat(valueName, "\" can only be defined once."), [valueNames[valueName], valueDef.name])); - } else { - valueNames[valueName] = valueDef.name; - } - } - - return false; - } -} diff --git a/alarm/node_modules/graphql/validation/rules/UniqueFieldDefinitionNames.d.ts b/alarm/node_modules/graphql/validation/rules/UniqueFieldDefinitionNames.d.ts deleted file mode 100644 index 26ebb06..0000000 --- a/alarm/node_modules/graphql/validation/rules/UniqueFieldDefinitionNames.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * @deprecated and will be removed in v16 - * Please use either: - * import { UniqueFieldDefinitionNamesRule } from 'graphql' - * or - * import { UniqueFieldDefinitionNamesRule } from 'graphql/validation' - */ -export { UniqueFieldDefinitionNamesRule as UniqueFieldDefinitionNames } from './UniqueFieldDefinitionNamesRule'; diff --git a/alarm/node_modules/graphql/validation/rules/UniqueFieldDefinitionNames.js b/alarm/node_modules/graphql/validation/rules/UniqueFieldDefinitionNames.js deleted file mode 100644 index 7af0dca..0000000 --- a/alarm/node_modules/graphql/validation/rules/UniqueFieldDefinitionNames.js +++ /dev/null @@ -1,13 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -Object.defineProperty(exports, "UniqueFieldDefinitionNames", { - enumerable: true, - get: function get() { - return _UniqueFieldDefinitionNamesRule.UniqueFieldDefinitionNamesRule; - } -}); - -var _UniqueFieldDefinitionNamesRule = require("./UniqueFieldDefinitionNamesRule.js"); diff --git a/alarm/node_modules/graphql/validation/rules/UniqueFieldDefinitionNames.js.flow b/alarm/node_modules/graphql/validation/rules/UniqueFieldDefinitionNames.js.flow deleted file mode 100644 index dc54877..0000000 --- a/alarm/node_modules/graphql/validation/rules/UniqueFieldDefinitionNames.js.flow +++ /dev/null @@ -1,9 +0,0 @@ -// @flow strict -/** - * @deprecated and will be removed in v16 - * Please use either: - * import { UniqueFieldDefinitionNamesRule } from 'graphql' - * or - * import { UniqueFieldDefinitionNamesRule } from 'graphql/validation' - */ -export { UniqueFieldDefinitionNamesRule as UniqueFieldDefinitionNames } from './UniqueFieldDefinitionNamesRule'; diff --git a/alarm/node_modules/graphql/validation/rules/UniqueFieldDefinitionNames.mjs b/alarm/node_modules/graphql/validation/rules/UniqueFieldDefinitionNames.mjs deleted file mode 100644 index c2a3add..0000000 --- a/alarm/node_modules/graphql/validation/rules/UniqueFieldDefinitionNames.mjs +++ /dev/null @@ -1,8 +0,0 @@ -/** - * @deprecated and will be removed in v16 - * Please use either: - * import { UniqueFieldDefinitionNamesRule } from 'graphql' - * or - * import { UniqueFieldDefinitionNamesRule } from 'graphql/validation' - */ -export { UniqueFieldDefinitionNamesRule as UniqueFieldDefinitionNames } from "./UniqueFieldDefinitionNamesRule.mjs"; diff --git a/alarm/node_modules/graphql/validation/rules/UniqueFieldDefinitionNamesRule.d.ts b/alarm/node_modules/graphql/validation/rules/UniqueFieldDefinitionNamesRule.d.ts deleted file mode 100644 index 6f356ed..0000000 --- a/alarm/node_modules/graphql/validation/rules/UniqueFieldDefinitionNamesRule.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { ASTVisitor } from '../../language/visitor'; -import { SDLValidationContext } from '../ValidationContext'; - -/** - * Unique field definition names - * - * A GraphQL complex type is only valid if all its fields are uniquely named. - */ -export function UniqueFieldDefinitionNamesRule( - context: SDLValidationContext, -): ASTVisitor; diff --git a/alarm/node_modules/graphql/validation/rules/UniqueFieldDefinitionNamesRule.js b/alarm/node_modules/graphql/validation/rules/UniqueFieldDefinitionNamesRule.js deleted file mode 100644 index 3cdaa71..0000000 --- a/alarm/node_modules/graphql/validation/rules/UniqueFieldDefinitionNamesRule.js +++ /dev/null @@ -1,66 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.UniqueFieldDefinitionNamesRule = UniqueFieldDefinitionNamesRule; - -var _GraphQLError = require("../../error/GraphQLError.js"); - -var _definition = require("../../type/definition.js"); - -/** - * Unique field definition names - * - * A GraphQL complex type is only valid if all its fields are uniquely named. - */ -function UniqueFieldDefinitionNamesRule(context) { - var schema = context.getSchema(); - var existingTypeMap = schema ? schema.getTypeMap() : Object.create(null); - var knownFieldNames = Object.create(null); - return { - InputObjectTypeDefinition: checkFieldUniqueness, - InputObjectTypeExtension: checkFieldUniqueness, - InterfaceTypeDefinition: checkFieldUniqueness, - InterfaceTypeExtension: checkFieldUniqueness, - ObjectTypeDefinition: checkFieldUniqueness, - ObjectTypeExtension: checkFieldUniqueness - }; - - function checkFieldUniqueness(node) { - var _node$fields; - - var typeName = node.name.value; - - if (!knownFieldNames[typeName]) { - knownFieldNames[typeName] = Object.create(null); - } // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - - - var fieldNodes = (_node$fields = node.fields) !== null && _node$fields !== void 0 ? _node$fields : []; - var fieldNames = knownFieldNames[typeName]; - - for (var _i2 = 0; _i2 < fieldNodes.length; _i2++) { - var fieldDef = fieldNodes[_i2]; - var fieldName = fieldDef.name.value; - - if (hasField(existingTypeMap[typeName], fieldName)) { - context.reportError(new _GraphQLError.GraphQLError("Field \"".concat(typeName, ".").concat(fieldName, "\" already exists in the schema. It cannot also be defined in this type extension."), fieldDef.name)); - } else if (fieldNames[fieldName]) { - context.reportError(new _GraphQLError.GraphQLError("Field \"".concat(typeName, ".").concat(fieldName, "\" can only be defined once."), [fieldNames[fieldName], fieldDef.name])); - } else { - fieldNames[fieldName] = fieldDef.name; - } - } - - return false; - } -} - -function hasField(type, fieldName) { - if ((0, _definition.isObjectType)(type) || (0, _definition.isInterfaceType)(type) || (0, _definition.isInputObjectType)(type)) { - return type.getFields()[fieldName] != null; - } - - return false; -} diff --git a/alarm/node_modules/graphql/validation/rules/UniqueFieldDefinitionNamesRule.js.flow b/alarm/node_modules/graphql/validation/rules/UniqueFieldDefinitionNamesRule.js.flow deleted file mode 100644 index 1193111..0000000 --- a/alarm/node_modules/graphql/validation/rules/UniqueFieldDefinitionNamesRule.js.flow +++ /dev/null @@ -1,87 +0,0 @@ -// @flow strict -import { GraphQLError } from '../../error/GraphQLError'; - -import type { ASTVisitor } from '../../language/visitor'; -import type { - NameNode, - FieldDefinitionNode, - InputValueDefinitionNode, -} from '../../language/ast'; - -import type { GraphQLNamedType } from '../../type/definition'; -import { - isObjectType, - isInterfaceType, - isInputObjectType, -} from '../../type/definition'; - -import type { SDLValidationContext } from '../ValidationContext'; - -/** - * Unique field definition names - * - * A GraphQL complex type is only valid if all its fields are uniquely named. - */ -export function UniqueFieldDefinitionNamesRule( - context: SDLValidationContext, -): ASTVisitor { - const schema = context.getSchema(); - const existingTypeMap = schema ? schema.getTypeMap() : Object.create(null); - const knownFieldNames = Object.create(null); - - return { - InputObjectTypeDefinition: checkFieldUniqueness, - InputObjectTypeExtension: checkFieldUniqueness, - InterfaceTypeDefinition: checkFieldUniqueness, - InterfaceTypeExtension: checkFieldUniqueness, - ObjectTypeDefinition: checkFieldUniqueness, - ObjectTypeExtension: checkFieldUniqueness, - }; - - function checkFieldUniqueness(node: { - +name: NameNode, - +fields?: $ReadOnlyArray<InputValueDefinitionNode | FieldDefinitionNode>, - ... - }) { - const typeName = node.name.value; - - if (!knownFieldNames[typeName]) { - knownFieldNames[typeName] = Object.create(null); - } - - // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - const fieldNodes = node.fields ?? []; - const fieldNames = knownFieldNames[typeName]; - - for (const fieldDef of fieldNodes) { - const fieldName = fieldDef.name.value; - - if (hasField(existingTypeMap[typeName], fieldName)) { - context.reportError( - new GraphQLError( - `Field "${typeName}.${fieldName}" already exists in the schema. It cannot also be defined in this type extension.`, - fieldDef.name, - ), - ); - } else if (fieldNames[fieldName]) { - context.reportError( - new GraphQLError( - `Field "${typeName}.${fieldName}" can only be defined once.`, - [fieldNames[fieldName], fieldDef.name], - ), - ); - } else { - fieldNames[fieldName] = fieldDef.name; - } - } - - return false; - } -} - -function hasField(type: GraphQLNamedType, fieldName: string): boolean { - if (isObjectType(type) || isInterfaceType(type) || isInputObjectType(type)) { - return type.getFields()[fieldName] != null; - } - return false; -} diff --git a/alarm/node_modules/graphql/validation/rules/UniqueFieldDefinitionNamesRule.mjs b/alarm/node_modules/graphql/validation/rules/UniqueFieldDefinitionNamesRule.mjs deleted file mode 100644 index 176bb68..0000000 --- a/alarm/node_modules/graphql/validation/rules/UniqueFieldDefinitionNamesRule.mjs +++ /dev/null @@ -1,58 +0,0 @@ -import { GraphQLError } from "../../error/GraphQLError.mjs"; -import { isObjectType, isInterfaceType, isInputObjectType } from "../../type/definition.mjs"; - -/** - * Unique field definition names - * - * A GraphQL complex type is only valid if all its fields are uniquely named. - */ -export function UniqueFieldDefinitionNamesRule(context) { - var schema = context.getSchema(); - var existingTypeMap = schema ? schema.getTypeMap() : Object.create(null); - var knownFieldNames = Object.create(null); - return { - InputObjectTypeDefinition: checkFieldUniqueness, - InputObjectTypeExtension: checkFieldUniqueness, - InterfaceTypeDefinition: checkFieldUniqueness, - InterfaceTypeExtension: checkFieldUniqueness, - ObjectTypeDefinition: checkFieldUniqueness, - ObjectTypeExtension: checkFieldUniqueness - }; - - function checkFieldUniqueness(node) { - var _node$fields; - - var typeName = node.name.value; - - if (!knownFieldNames[typeName]) { - knownFieldNames[typeName] = Object.create(null); - } // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - - - var fieldNodes = (_node$fields = node.fields) !== null && _node$fields !== void 0 ? _node$fields : []; - var fieldNames = knownFieldNames[typeName]; - - for (var _i2 = 0; _i2 < fieldNodes.length; _i2++) { - var fieldDef = fieldNodes[_i2]; - var fieldName = fieldDef.name.value; - - if (hasField(existingTypeMap[typeName], fieldName)) { - context.reportError(new GraphQLError("Field \"".concat(typeName, ".").concat(fieldName, "\" already exists in the schema. It cannot also be defined in this type extension."), fieldDef.name)); - } else if (fieldNames[fieldName]) { - context.reportError(new GraphQLError("Field \"".concat(typeName, ".").concat(fieldName, "\" can only be defined once."), [fieldNames[fieldName], fieldDef.name])); - } else { - fieldNames[fieldName] = fieldDef.name; - } - } - - return false; - } -} - -function hasField(type, fieldName) { - if (isObjectType(type) || isInterfaceType(type) || isInputObjectType(type)) { - return type.getFields()[fieldName] != null; - } - - return false; -} diff --git a/alarm/node_modules/graphql/validation/rules/UniqueFragmentNamesRule.d.ts b/alarm/node_modules/graphql/validation/rules/UniqueFragmentNamesRule.d.ts deleted file mode 100644 index 6154158..0000000 --- a/alarm/node_modules/graphql/validation/rules/UniqueFragmentNamesRule.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { ASTVisitor } from '../../language/visitor'; -import { ASTValidationContext } from '../ValidationContext'; - -/** - * Unique fragment names - * - * A GraphQL document is only valid if all defined fragments have unique names. - */ -export function UniqueFragmentNamesRule( - context: ASTValidationContext, -): ASTVisitor; diff --git a/alarm/node_modules/graphql/validation/rules/UniqueFragmentNamesRule.js b/alarm/node_modules/graphql/validation/rules/UniqueFragmentNamesRule.js deleted file mode 100644 index d03a74e..0000000 --- a/alarm/node_modules/graphql/validation/rules/UniqueFragmentNamesRule.js +++ /dev/null @@ -1,33 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.UniqueFragmentNamesRule = UniqueFragmentNamesRule; - -var _GraphQLError = require("../../error/GraphQLError.js"); - -/** - * Unique fragment names - * - * A GraphQL document is only valid if all defined fragments have unique names. - */ -function UniqueFragmentNamesRule(context) { - var knownFragmentNames = Object.create(null); - return { - OperationDefinition: function OperationDefinition() { - return false; - }, - FragmentDefinition: function FragmentDefinition(node) { - var fragmentName = node.name.value; - - if (knownFragmentNames[fragmentName]) { - context.reportError(new _GraphQLError.GraphQLError("There can be only one fragment named \"".concat(fragmentName, "\"."), [knownFragmentNames[fragmentName], node.name])); - } else { - knownFragmentNames[fragmentName] = node.name; - } - - return false; - } - }; -} diff --git a/alarm/node_modules/graphql/validation/rules/UniqueFragmentNamesRule.js.flow b/alarm/node_modules/graphql/validation/rules/UniqueFragmentNamesRule.js.flow deleted file mode 100644 index cb1b777..0000000 --- a/alarm/node_modules/graphql/validation/rules/UniqueFragmentNamesRule.js.flow +++ /dev/null @@ -1,34 +0,0 @@ -// @flow strict -import { GraphQLError } from '../../error/GraphQLError'; - -import type { ASTVisitor } from '../../language/visitor'; - -import type { ASTValidationContext } from '../ValidationContext'; - -/** - * Unique fragment names - * - * A GraphQL document is only valid if all defined fragments have unique names. - */ -export function UniqueFragmentNamesRule( - context: ASTValidationContext, -): ASTVisitor { - const knownFragmentNames = Object.create(null); - return { - OperationDefinition: () => false, - FragmentDefinition(node) { - const fragmentName = node.name.value; - if (knownFragmentNames[fragmentName]) { - context.reportError( - new GraphQLError( - `There can be only one fragment named "${fragmentName}".`, - [knownFragmentNames[fragmentName], node.name], - ), - ); - } else { - knownFragmentNames[fragmentName] = node.name; - } - return false; - }, - }; -} diff --git a/alarm/node_modules/graphql/validation/rules/UniqueFragmentNamesRule.mjs b/alarm/node_modules/graphql/validation/rules/UniqueFragmentNamesRule.mjs deleted file mode 100644 index d9b0ef3..0000000 --- a/alarm/node_modules/graphql/validation/rules/UniqueFragmentNamesRule.mjs +++ /dev/null @@ -1,26 +0,0 @@ -import { GraphQLError } from "../../error/GraphQLError.mjs"; - -/** - * Unique fragment names - * - * A GraphQL document is only valid if all defined fragments have unique names. - */ -export function UniqueFragmentNamesRule(context) { - var knownFragmentNames = Object.create(null); - return { - OperationDefinition: function OperationDefinition() { - return false; - }, - FragmentDefinition: function FragmentDefinition(node) { - var fragmentName = node.name.value; - - if (knownFragmentNames[fragmentName]) { - context.reportError(new GraphQLError("There can be only one fragment named \"".concat(fragmentName, "\"."), [knownFragmentNames[fragmentName], node.name])); - } else { - knownFragmentNames[fragmentName] = node.name; - } - - return false; - } - }; -} diff --git a/alarm/node_modules/graphql/validation/rules/UniqueInputFieldNamesRule.d.ts b/alarm/node_modules/graphql/validation/rules/UniqueInputFieldNamesRule.d.ts deleted file mode 100644 index c66d65f..0000000 --- a/alarm/node_modules/graphql/validation/rules/UniqueInputFieldNamesRule.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { ASTVisitor } from '../../language/visitor'; -import { ASTValidationContext } from '../ValidationContext'; - -/** - * Unique input field names - * - * A GraphQL input object value is only valid if all supplied fields are - * uniquely named. - */ -export function UniqueInputFieldNamesRule( - context: ASTValidationContext, -): ASTVisitor; diff --git a/alarm/node_modules/graphql/validation/rules/UniqueInputFieldNamesRule.js b/alarm/node_modules/graphql/validation/rules/UniqueInputFieldNamesRule.js deleted file mode 100644 index 4a7dfda..0000000 --- a/alarm/node_modules/graphql/validation/rules/UniqueInputFieldNamesRule.js +++ /dev/null @@ -1,39 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.UniqueInputFieldNamesRule = UniqueInputFieldNamesRule; - -var _GraphQLError = require("../../error/GraphQLError.js"); - -/** - * Unique input field names - * - * A GraphQL input object value is only valid if all supplied fields are - * uniquely named. - */ -function UniqueInputFieldNamesRule(context) { - var knownNameStack = []; - var knownNames = Object.create(null); - return { - ObjectValue: { - enter: function enter() { - knownNameStack.push(knownNames); - knownNames = Object.create(null); - }, - leave: function leave() { - knownNames = knownNameStack.pop(); - } - }, - ObjectField: function ObjectField(node) { - var fieldName = node.name.value; - - if (knownNames[fieldName]) { - context.reportError(new _GraphQLError.GraphQLError("There can be only one input field named \"".concat(fieldName, "\"."), [knownNames[fieldName], node.name])); - } else { - knownNames[fieldName] = node.name; - } - } - }; -} diff --git a/alarm/node_modules/graphql/validation/rules/UniqueInputFieldNamesRule.js.flow b/alarm/node_modules/graphql/validation/rules/UniqueInputFieldNamesRule.js.flow deleted file mode 100644 index e79cd7a..0000000 --- a/alarm/node_modules/graphql/validation/rules/UniqueInputFieldNamesRule.js.flow +++ /dev/null @@ -1,44 +0,0 @@ -// @flow strict -import { GraphQLError } from '../../error/GraphQLError'; - -import type { ASTVisitor } from '../../language/visitor'; - -import type { ASTValidationContext } from '../ValidationContext'; - -/** - * Unique input field names - * - * A GraphQL input object value is only valid if all supplied fields are - * uniquely named. - */ -export function UniqueInputFieldNamesRule( - context: ASTValidationContext, -): ASTVisitor { - const knownNameStack = []; - let knownNames = Object.create(null); - - return { - ObjectValue: { - enter() { - knownNameStack.push(knownNames); - knownNames = Object.create(null); - }, - leave() { - knownNames = knownNameStack.pop(); - }, - }, - ObjectField(node) { - const fieldName = node.name.value; - if (knownNames[fieldName]) { - context.reportError( - new GraphQLError( - `There can be only one input field named "${fieldName}".`, - [knownNames[fieldName], node.name], - ), - ); - } else { - knownNames[fieldName] = node.name; - } - }, - }; -} diff --git a/alarm/node_modules/graphql/validation/rules/UniqueInputFieldNamesRule.mjs b/alarm/node_modules/graphql/validation/rules/UniqueInputFieldNamesRule.mjs deleted file mode 100644 index ae0c884..0000000 --- a/alarm/node_modules/graphql/validation/rules/UniqueInputFieldNamesRule.mjs +++ /dev/null @@ -1,32 +0,0 @@ -import { GraphQLError } from "../../error/GraphQLError.mjs"; - -/** - * Unique input field names - * - * A GraphQL input object value is only valid if all supplied fields are - * uniquely named. - */ -export function UniqueInputFieldNamesRule(context) { - var knownNameStack = []; - var knownNames = Object.create(null); - return { - ObjectValue: { - enter: function enter() { - knownNameStack.push(knownNames); - knownNames = Object.create(null); - }, - leave: function leave() { - knownNames = knownNameStack.pop(); - } - }, - ObjectField: function ObjectField(node) { - var fieldName = node.name.value; - - if (knownNames[fieldName]) { - context.reportError(new GraphQLError("There can be only one input field named \"".concat(fieldName, "\"."), [knownNames[fieldName], node.name])); - } else { - knownNames[fieldName] = node.name; - } - } - }; -} diff --git a/alarm/node_modules/graphql/validation/rules/UniqueOperationNamesRule.d.ts b/alarm/node_modules/graphql/validation/rules/UniqueOperationNamesRule.d.ts deleted file mode 100644 index aa2d06a..0000000 --- a/alarm/node_modules/graphql/validation/rules/UniqueOperationNamesRule.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { ASTVisitor } from '../../language/visitor'; -import { ASTValidationContext } from '../ValidationContext'; - -/** - * Unique operation names - * - * A GraphQL document is only valid if all defined operations have unique names. - */ -export function UniqueOperationNamesRule( - context: ASTValidationContext, -): ASTVisitor; diff --git a/alarm/node_modules/graphql/validation/rules/UniqueOperationNamesRule.js b/alarm/node_modules/graphql/validation/rules/UniqueOperationNamesRule.js deleted file mode 100644 index 5c31464..0000000 --- a/alarm/node_modules/graphql/validation/rules/UniqueOperationNamesRule.js +++ /dev/null @@ -1,35 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.UniqueOperationNamesRule = UniqueOperationNamesRule; - -var _GraphQLError = require("../../error/GraphQLError.js"); - -/** - * Unique operation names - * - * A GraphQL document is only valid if all defined operations have unique names. - */ -function UniqueOperationNamesRule(context) { - var knownOperationNames = Object.create(null); - return { - OperationDefinition: function OperationDefinition(node) { - var operationName = node.name; - - if (operationName) { - if (knownOperationNames[operationName.value]) { - context.reportError(new _GraphQLError.GraphQLError("There can be only one operation named \"".concat(operationName.value, "\"."), [knownOperationNames[operationName.value], operationName])); - } else { - knownOperationNames[operationName.value] = operationName; - } - } - - return false; - }, - FragmentDefinition: function FragmentDefinition() { - return false; - } - }; -} diff --git a/alarm/node_modules/graphql/validation/rules/UniqueOperationNamesRule.js.flow b/alarm/node_modules/graphql/validation/rules/UniqueOperationNamesRule.js.flow deleted file mode 100644 index 5e6afef..0000000 --- a/alarm/node_modules/graphql/validation/rules/UniqueOperationNamesRule.js.flow +++ /dev/null @@ -1,36 +0,0 @@ -// @flow strict -import { GraphQLError } from '../../error/GraphQLError'; - -import type { ASTVisitor } from '../../language/visitor'; - -import type { ASTValidationContext } from '../ValidationContext'; - -/** - * Unique operation names - * - * A GraphQL document is only valid if all defined operations have unique names. - */ -export function UniqueOperationNamesRule( - context: ASTValidationContext, -): ASTVisitor { - const knownOperationNames = Object.create(null); - return { - OperationDefinition(node) { - const operationName = node.name; - if (operationName) { - if (knownOperationNames[operationName.value]) { - context.reportError( - new GraphQLError( - `There can be only one operation named "${operationName.value}".`, - [knownOperationNames[operationName.value], operationName], - ), - ); - } else { - knownOperationNames[operationName.value] = operationName; - } - } - return false; - }, - FragmentDefinition: () => false, - }; -} diff --git a/alarm/node_modules/graphql/validation/rules/UniqueOperationNamesRule.mjs b/alarm/node_modules/graphql/validation/rules/UniqueOperationNamesRule.mjs deleted file mode 100644 index 28190c5..0000000 --- a/alarm/node_modules/graphql/validation/rules/UniqueOperationNamesRule.mjs +++ /dev/null @@ -1,28 +0,0 @@ -import { GraphQLError } from "../../error/GraphQLError.mjs"; - -/** - * Unique operation names - * - * A GraphQL document is only valid if all defined operations have unique names. - */ -export function UniqueOperationNamesRule(context) { - var knownOperationNames = Object.create(null); - return { - OperationDefinition: function OperationDefinition(node) { - var operationName = node.name; - - if (operationName) { - if (knownOperationNames[operationName.value]) { - context.reportError(new GraphQLError("There can be only one operation named \"".concat(operationName.value, "\"."), [knownOperationNames[operationName.value], operationName])); - } else { - knownOperationNames[operationName.value] = operationName; - } - } - - return false; - }, - FragmentDefinition: function FragmentDefinition() { - return false; - } - }; -} diff --git a/alarm/node_modules/graphql/validation/rules/UniqueOperationTypes.d.ts b/alarm/node_modules/graphql/validation/rules/UniqueOperationTypes.d.ts deleted file mode 100644 index 423932d..0000000 --- a/alarm/node_modules/graphql/validation/rules/UniqueOperationTypes.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * @deprecated and will be removed in v16 - * Please use either: - * import { UniqueOperationTypesRule } from 'graphql' - * or - * import { UniqueOperationTypesRule } from 'graphql/validation' - */ -export { UniqueOperationTypesRule as UniqueOperationTypes } from './UniqueOperationTypesRule'; diff --git a/alarm/node_modules/graphql/validation/rules/UniqueOperationTypes.js b/alarm/node_modules/graphql/validation/rules/UniqueOperationTypes.js deleted file mode 100644 index 814f2e2..0000000 --- a/alarm/node_modules/graphql/validation/rules/UniqueOperationTypes.js +++ /dev/null @@ -1,13 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -Object.defineProperty(exports, "UniqueOperationTypes", { - enumerable: true, - get: function get() { - return _UniqueOperationTypesRule.UniqueOperationTypesRule; - } -}); - -var _UniqueOperationTypesRule = require("./UniqueOperationTypesRule.js"); diff --git a/alarm/node_modules/graphql/validation/rules/UniqueOperationTypes.js.flow b/alarm/node_modules/graphql/validation/rules/UniqueOperationTypes.js.flow deleted file mode 100644 index 8649852..0000000 --- a/alarm/node_modules/graphql/validation/rules/UniqueOperationTypes.js.flow +++ /dev/null @@ -1,9 +0,0 @@ -// @flow strict -/** - * @deprecated and will be removed in v16 - * Please use either: - * import { UniqueOperationTypesRule } from 'graphql' - * or - * import { UniqueOperationTypesRule } from 'graphql/validation' - */ -export { UniqueOperationTypesRule as UniqueOperationTypes } from './UniqueOperationTypesRule'; diff --git a/alarm/node_modules/graphql/validation/rules/UniqueOperationTypes.mjs b/alarm/node_modules/graphql/validation/rules/UniqueOperationTypes.mjs deleted file mode 100644 index 4cd53b3..0000000 --- a/alarm/node_modules/graphql/validation/rules/UniqueOperationTypes.mjs +++ /dev/null @@ -1,8 +0,0 @@ -/** - * @deprecated and will be removed in v16 - * Please use either: - * import { UniqueOperationTypesRule } from 'graphql' - * or - * import { UniqueOperationTypesRule } from 'graphql/validation' - */ -export { UniqueOperationTypesRule as UniqueOperationTypes } from "./UniqueOperationTypesRule.mjs"; diff --git a/alarm/node_modules/graphql/validation/rules/UniqueOperationTypesRule.d.ts b/alarm/node_modules/graphql/validation/rules/UniqueOperationTypesRule.d.ts deleted file mode 100644 index a0d6441..0000000 --- a/alarm/node_modules/graphql/validation/rules/UniqueOperationTypesRule.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { ASTVisitor } from '../../language/visitor'; -import { SDLValidationContext } from '../ValidationContext'; - -/** - * Unique operation types - * - * A GraphQL document is only valid if it has only one type per operation. - */ -export function UniqueOperationTypesRule( - context: SDLValidationContext, -): ASTVisitor; diff --git a/alarm/node_modules/graphql/validation/rules/UniqueOperationTypesRule.js b/alarm/node_modules/graphql/validation/rules/UniqueOperationTypesRule.js deleted file mode 100644 index fa59189..0000000 --- a/alarm/node_modules/graphql/validation/rules/UniqueOperationTypesRule.js +++ /dev/null @@ -1,50 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.UniqueOperationTypesRule = UniqueOperationTypesRule; - -var _GraphQLError = require("../../error/GraphQLError.js"); - -/** - * Unique operation types - * - * A GraphQL document is only valid if it has only one type per operation. - */ -function UniqueOperationTypesRule(context) { - var schema = context.getSchema(); - var definedOperationTypes = Object.create(null); - var existingOperationTypes = schema ? { - query: schema.getQueryType(), - mutation: schema.getMutationType(), - subscription: schema.getSubscriptionType() - } : {}; - return { - SchemaDefinition: checkOperationTypes, - SchemaExtension: checkOperationTypes - }; - - function checkOperationTypes(node) { - var _node$operationTypes; - - // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - var operationTypesNodes = (_node$operationTypes = node.operationTypes) !== null && _node$operationTypes !== void 0 ? _node$operationTypes : []; - - for (var _i2 = 0; _i2 < operationTypesNodes.length; _i2++) { - var operationType = operationTypesNodes[_i2]; - var operation = operationType.operation; - var alreadyDefinedOperationType = definedOperationTypes[operation]; - - if (existingOperationTypes[operation]) { - context.reportError(new _GraphQLError.GraphQLError("Type for ".concat(operation, " already defined in the schema. It cannot be redefined."), operationType)); - } else if (alreadyDefinedOperationType) { - context.reportError(new _GraphQLError.GraphQLError("There can be only one ".concat(operation, " type in schema."), [alreadyDefinedOperationType, operationType])); - } else { - definedOperationTypes[operation] = operationType; - } - } - - return false; - } -} diff --git a/alarm/node_modules/graphql/validation/rules/UniqueOperationTypesRule.js.flow b/alarm/node_modules/graphql/validation/rules/UniqueOperationTypesRule.js.flow deleted file mode 100644 index 8a9d4bd..0000000 --- a/alarm/node_modules/graphql/validation/rules/UniqueOperationTypesRule.js.flow +++ /dev/null @@ -1,66 +0,0 @@ -// @flow strict -import { GraphQLError } from '../../error/GraphQLError'; - -import type { ASTVisitor } from '../../language/visitor'; -import type { - SchemaDefinitionNode, - SchemaExtensionNode, -} from '../../language/ast'; - -import type { SDLValidationContext } from '../ValidationContext'; - -/** - * Unique operation types - * - * A GraphQL document is only valid if it has only one type per operation. - */ -export function UniqueOperationTypesRule( - context: SDLValidationContext, -): ASTVisitor { - const schema = context.getSchema(); - const definedOperationTypes = Object.create(null); - const existingOperationTypes = schema - ? { - query: schema.getQueryType(), - mutation: schema.getMutationType(), - subscription: schema.getSubscriptionType(), - } - : {}; - - return { - SchemaDefinition: checkOperationTypes, - SchemaExtension: checkOperationTypes, - }; - - function checkOperationTypes( - node: SchemaDefinitionNode | SchemaExtensionNode, - ) { - // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - const operationTypesNodes = node.operationTypes ?? []; - - for (const operationType of operationTypesNodes) { - const operation = operationType.operation; - const alreadyDefinedOperationType = definedOperationTypes[operation]; - - if (existingOperationTypes[operation]) { - context.reportError( - new GraphQLError( - `Type for ${operation} already defined in the schema. It cannot be redefined.`, - operationType, - ), - ); - } else if (alreadyDefinedOperationType) { - context.reportError( - new GraphQLError( - `There can be only one ${operation} type in schema.`, - [alreadyDefinedOperationType, operationType], - ), - ); - } else { - definedOperationTypes[operation] = operationType; - } - } - - return false; - } -} diff --git a/alarm/node_modules/graphql/validation/rules/UniqueOperationTypesRule.mjs b/alarm/node_modules/graphql/validation/rules/UniqueOperationTypesRule.mjs deleted file mode 100644 index e79b684..0000000 --- a/alarm/node_modules/graphql/validation/rules/UniqueOperationTypesRule.mjs +++ /dev/null @@ -1,43 +0,0 @@ -import { GraphQLError } from "../../error/GraphQLError.mjs"; - -/** - * Unique operation types - * - * A GraphQL document is only valid if it has only one type per operation. - */ -export function UniqueOperationTypesRule(context) { - var schema = context.getSchema(); - var definedOperationTypes = Object.create(null); - var existingOperationTypes = schema ? { - query: schema.getQueryType(), - mutation: schema.getMutationType(), - subscription: schema.getSubscriptionType() - } : {}; - return { - SchemaDefinition: checkOperationTypes, - SchemaExtension: checkOperationTypes - }; - - function checkOperationTypes(node) { - var _node$operationTypes; - - // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203') - var operationTypesNodes = (_node$operationTypes = node.operationTypes) !== null && _node$operationTypes !== void 0 ? _node$operationTypes : []; - - for (var _i2 = 0; _i2 < operationTypesNodes.length; _i2++) { - var operationType = operationTypesNodes[_i2]; - var operation = operationType.operation; - var alreadyDefinedOperationType = definedOperationTypes[operation]; - - if (existingOperationTypes[operation]) { - context.reportError(new GraphQLError("Type for ".concat(operation, " already defined in the schema. It cannot be redefined."), operationType)); - } else if (alreadyDefinedOperationType) { - context.reportError(new GraphQLError("There can be only one ".concat(operation, " type in schema."), [alreadyDefinedOperationType, operationType])); - } else { - definedOperationTypes[operation] = operationType; - } - } - - return false; - } -} diff --git a/alarm/node_modules/graphql/validation/rules/UniqueTypeNames.d.ts b/alarm/node_modules/graphql/validation/rules/UniqueTypeNames.d.ts deleted file mode 100644 index 1740eef..0000000 --- a/alarm/node_modules/graphql/validation/rules/UniqueTypeNames.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * @deprecated and will be removed in v16 - * Please use either: - * import { UniqueTypeNamesRule } from 'graphql' - * or - * import { UniqueTypeNamesRule } from 'graphql/validation' - */ -export { UniqueTypeNamesRule as UniqueTypeNames } from './UniqueTypeNamesRule'; diff --git a/alarm/node_modules/graphql/validation/rules/UniqueTypeNames.js b/alarm/node_modules/graphql/validation/rules/UniqueTypeNames.js deleted file mode 100644 index 82e72ce..0000000 --- a/alarm/node_modules/graphql/validation/rules/UniqueTypeNames.js +++ /dev/null @@ -1,13 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -Object.defineProperty(exports, "UniqueTypeNames", { - enumerable: true, - get: function get() { - return _UniqueTypeNamesRule.UniqueTypeNamesRule; - } -}); - -var _UniqueTypeNamesRule = require("./UniqueTypeNamesRule.js"); diff --git a/alarm/node_modules/graphql/validation/rules/UniqueTypeNames.js.flow b/alarm/node_modules/graphql/validation/rules/UniqueTypeNames.js.flow deleted file mode 100644 index 2b43e1c..0000000 --- a/alarm/node_modules/graphql/validation/rules/UniqueTypeNames.js.flow +++ /dev/null @@ -1,9 +0,0 @@ -// @flow strict -/** - * @deprecated and will be removed in v16 - * Please use either: - * import { UniqueTypeNamesRule } from 'graphql' - * or - * import { UniqueTypeNamesRule } from 'graphql/validation' - */ -export { UniqueTypeNamesRule as UniqueTypeNames } from './UniqueTypeNamesRule'; diff --git a/alarm/node_modules/graphql/validation/rules/UniqueTypeNames.mjs b/alarm/node_modules/graphql/validation/rules/UniqueTypeNames.mjs deleted file mode 100644 index ea0c5bf..0000000 --- a/alarm/node_modules/graphql/validation/rules/UniqueTypeNames.mjs +++ /dev/null @@ -1,8 +0,0 @@ -/** - * @deprecated and will be removed in v16 - * Please use either: - * import { UniqueTypeNamesRule } from 'graphql' - * or - * import { UniqueTypeNamesRule } from 'graphql/validation' - */ -export { UniqueTypeNamesRule as UniqueTypeNames } from "./UniqueTypeNamesRule.mjs"; diff --git a/alarm/node_modules/graphql/validation/rules/UniqueTypeNamesRule.d.ts b/alarm/node_modules/graphql/validation/rules/UniqueTypeNamesRule.d.ts deleted file mode 100644 index e2b3759..0000000 --- a/alarm/node_modules/graphql/validation/rules/UniqueTypeNamesRule.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { ASTVisitor } from '../../language/visitor'; -import { SDLValidationContext } from '../ValidationContext'; - -/** - * Unique type names - * - * A GraphQL document is only valid if all defined types have unique names. - */ -export function UniqueTypeNamesRule(context: SDLValidationContext): ASTVisitor; diff --git a/alarm/node_modules/graphql/validation/rules/UniqueTypeNamesRule.js b/alarm/node_modules/graphql/validation/rules/UniqueTypeNamesRule.js deleted file mode 100644 index afae028..0000000 --- a/alarm/node_modules/graphql/validation/rules/UniqueTypeNamesRule.js +++ /dev/null @@ -1,43 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.UniqueTypeNamesRule = UniqueTypeNamesRule; - -var _GraphQLError = require("../../error/GraphQLError.js"); - -/** - * Unique type names - * - * A GraphQL document is only valid if all defined types have unique names. - */ -function UniqueTypeNamesRule(context) { - var knownTypeNames = Object.create(null); - var schema = context.getSchema(); - return { - ScalarTypeDefinition: checkTypeName, - ObjectTypeDefinition: checkTypeName, - InterfaceTypeDefinition: checkTypeName, - UnionTypeDefinition: checkTypeName, - EnumTypeDefinition: checkTypeName, - InputObjectTypeDefinition: checkTypeName - }; - - function checkTypeName(node) { - var typeName = node.name.value; - - if (schema !== null && schema !== void 0 && schema.getType(typeName)) { - context.reportError(new _GraphQLError.GraphQLError("Type \"".concat(typeName, "\" already exists in the schema. It cannot also be defined in this type definition."), node.name)); - return; - } - - if (knownTypeNames[typeName]) { - context.reportError(new _GraphQLError.GraphQLError("There can be only one type named \"".concat(typeName, "\"."), [knownTypeNames[typeName], node.name])); - } else { - knownTypeNames[typeName] = node.name; - } - - return false; - } -} diff --git a/alarm/node_modules/graphql/validation/rules/UniqueTypeNamesRule.js.flow b/alarm/node_modules/graphql/validation/rules/UniqueTypeNamesRule.js.flow deleted file mode 100644 index 3dd0e7c..0000000 --- a/alarm/node_modules/graphql/validation/rules/UniqueTypeNamesRule.js.flow +++ /dev/null @@ -1,53 +0,0 @@ -// @flow strict -import { GraphQLError } from '../../error/GraphQLError'; - -import type { ASTVisitor } from '../../language/visitor'; -import type { TypeDefinitionNode } from '../../language/ast'; - -import type { SDLValidationContext } from '../ValidationContext'; - -/** - * Unique type names - * - * A GraphQL document is only valid if all defined types have unique names. - */ -export function UniqueTypeNamesRule(context: SDLValidationContext): ASTVisitor { - const knownTypeNames = Object.create(null); - const schema = context.getSchema(); - - return { - ScalarTypeDefinition: checkTypeName, - ObjectTypeDefinition: checkTypeName, - InterfaceTypeDefinition: checkTypeName, - UnionTypeDefinition: checkTypeName, - EnumTypeDefinition: checkTypeName, - InputObjectTypeDefinition: checkTypeName, - }; - - function checkTypeName(node: TypeDefinitionNode) { - const typeName = node.name.value; - - if (schema?.getType(typeName)) { - context.reportError( - new GraphQLError( - `Type "${typeName}" already exists in the schema. It cannot also be defined in this type definition.`, - node.name, - ), - ); - return; - } - - if (knownTypeNames[typeName]) { - context.reportError( - new GraphQLError(`There can be only one type named "${typeName}".`, [ - knownTypeNames[typeName], - node.name, - ]), - ); - } else { - knownTypeNames[typeName] = node.name; - } - - return false; - } -} diff --git a/alarm/node_modules/graphql/validation/rules/UniqueTypeNamesRule.mjs b/alarm/node_modules/graphql/validation/rules/UniqueTypeNamesRule.mjs deleted file mode 100644 index 55d2f95..0000000 --- a/alarm/node_modules/graphql/validation/rules/UniqueTypeNamesRule.mjs +++ /dev/null @@ -1,36 +0,0 @@ -import { GraphQLError } from "../../error/GraphQLError.mjs"; - -/** - * Unique type names - * - * A GraphQL document is only valid if all defined types have unique names. - */ -export function UniqueTypeNamesRule(context) { - var knownTypeNames = Object.create(null); - var schema = context.getSchema(); - return { - ScalarTypeDefinition: checkTypeName, - ObjectTypeDefinition: checkTypeName, - InterfaceTypeDefinition: checkTypeName, - UnionTypeDefinition: checkTypeName, - EnumTypeDefinition: checkTypeName, - InputObjectTypeDefinition: checkTypeName - }; - - function checkTypeName(node) { - var typeName = node.name.value; - - if (schema !== null && schema !== void 0 && schema.getType(typeName)) { - context.reportError(new GraphQLError("Type \"".concat(typeName, "\" already exists in the schema. It cannot also be defined in this type definition."), node.name)); - return; - } - - if (knownTypeNames[typeName]) { - context.reportError(new GraphQLError("There can be only one type named \"".concat(typeName, "\"."), [knownTypeNames[typeName], node.name])); - } else { - knownTypeNames[typeName] = node.name; - } - - return false; - } -} diff --git a/alarm/node_modules/graphql/validation/rules/UniqueVariableNamesRule.d.ts b/alarm/node_modules/graphql/validation/rules/UniqueVariableNamesRule.d.ts deleted file mode 100644 index 6f15764..0000000 --- a/alarm/node_modules/graphql/validation/rules/UniqueVariableNamesRule.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { ASTVisitor } from '../../language/visitor'; -import { ASTValidationContext } from '../ValidationContext'; - -/** - * Unique variable names - * - * A GraphQL operation is only valid if all its variables are uniquely named. - */ -export function UniqueVariableNamesRule( - context: ASTValidationContext, -): ASTVisitor; diff --git a/alarm/node_modules/graphql/validation/rules/UniqueVariableNamesRule.js b/alarm/node_modules/graphql/validation/rules/UniqueVariableNamesRule.js deleted file mode 100644 index d6cae4a..0000000 --- a/alarm/node_modules/graphql/validation/rules/UniqueVariableNamesRule.js +++ /dev/null @@ -1,31 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.UniqueVariableNamesRule = UniqueVariableNamesRule; - -var _GraphQLError = require("../../error/GraphQLError.js"); - -/** - * Unique variable names - * - * A GraphQL operation is only valid if all its variables are uniquely named. - */ -function UniqueVariableNamesRule(context) { - var knownVariableNames = Object.create(null); - return { - OperationDefinition: function OperationDefinition() { - knownVariableNames = Object.create(null); - }, - VariableDefinition: function VariableDefinition(node) { - var variableName = node.variable.name.value; - - if (knownVariableNames[variableName]) { - context.reportError(new _GraphQLError.GraphQLError("There can be only one variable named \"$".concat(variableName, "\"."), [knownVariableNames[variableName], node.variable.name])); - } else { - knownVariableNames[variableName] = node.variable.name; - } - } - }; -} diff --git a/alarm/node_modules/graphql/validation/rules/UniqueVariableNamesRule.js.flow b/alarm/node_modules/graphql/validation/rules/UniqueVariableNamesRule.js.flow deleted file mode 100644 index 4865dc6..0000000 --- a/alarm/node_modules/graphql/validation/rules/UniqueVariableNamesRule.js.flow +++ /dev/null @@ -1,36 +0,0 @@ -// @flow strict -import { GraphQLError } from '../../error/GraphQLError'; - -import type { ASTVisitor } from '../../language/visitor'; -import type { VariableDefinitionNode } from '../../language/ast'; - -import type { ASTValidationContext } from '../ValidationContext'; - -/** - * Unique variable names - * - * A GraphQL operation is only valid if all its variables are uniquely named. - */ -export function UniqueVariableNamesRule( - context: ASTValidationContext, -): ASTVisitor { - let knownVariableNames = Object.create(null); - return { - OperationDefinition() { - knownVariableNames = Object.create(null); - }, - VariableDefinition(node: VariableDefinitionNode) { - const variableName = node.variable.name.value; - if (knownVariableNames[variableName]) { - context.reportError( - new GraphQLError( - `There can be only one variable named "$${variableName}".`, - [knownVariableNames[variableName], node.variable.name], - ), - ); - } else { - knownVariableNames[variableName] = node.variable.name; - } - }, - }; -} diff --git a/alarm/node_modules/graphql/validation/rules/UniqueVariableNamesRule.mjs b/alarm/node_modules/graphql/validation/rules/UniqueVariableNamesRule.mjs deleted file mode 100644 index 3b650a4..0000000 --- a/alarm/node_modules/graphql/validation/rules/UniqueVariableNamesRule.mjs +++ /dev/null @@ -1,24 +0,0 @@ -import { GraphQLError } from "../../error/GraphQLError.mjs"; - -/** - * Unique variable names - * - * A GraphQL operation is only valid if all its variables are uniquely named. - */ -export function UniqueVariableNamesRule(context) { - var knownVariableNames = Object.create(null); - return { - OperationDefinition: function OperationDefinition() { - knownVariableNames = Object.create(null); - }, - VariableDefinition: function VariableDefinition(node) { - var variableName = node.variable.name.value; - - if (knownVariableNames[variableName]) { - context.reportError(new GraphQLError("There can be only one variable named \"$".concat(variableName, "\"."), [knownVariableNames[variableName], node.variable.name])); - } else { - knownVariableNames[variableName] = node.variable.name; - } - } - }; -} diff --git a/alarm/node_modules/graphql/validation/rules/ValuesOfCorrectTypeRule.d.ts b/alarm/node_modules/graphql/validation/rules/ValuesOfCorrectTypeRule.d.ts deleted file mode 100644 index 98ff7a7..0000000 --- a/alarm/node_modules/graphql/validation/rules/ValuesOfCorrectTypeRule.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { ASTVisitor } from '../../language/visitor'; -import { ValidationContext } from '../ValidationContext'; - -/** - * Value literals of correct type - * - * A GraphQL document is only valid if all value literals are of the type - * expected at their position. - */ -export function ValuesOfCorrectTypeRule(context: ValidationContext): ASTVisitor; diff --git a/alarm/node_modules/graphql/validation/rules/ValuesOfCorrectTypeRule.js b/alarm/node_modules/graphql/validation/rules/ValuesOfCorrectTypeRule.js deleted file mode 100644 index d898200..0000000 --- a/alarm/node_modules/graphql/validation/rules/ValuesOfCorrectTypeRule.js +++ /dev/null @@ -1,143 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.ValuesOfCorrectTypeRule = ValuesOfCorrectTypeRule; - -var _objectValues3 = _interopRequireDefault(require("../../polyfills/objectValues.js")); - -var _keyMap = _interopRequireDefault(require("../../jsutils/keyMap.js")); - -var _inspect = _interopRequireDefault(require("../../jsutils/inspect.js")); - -var _didYouMean = _interopRequireDefault(require("../../jsutils/didYouMean.js")); - -var _suggestionList = _interopRequireDefault(require("../../jsutils/suggestionList.js")); - -var _GraphQLError = require("../../error/GraphQLError.js"); - -var _printer = require("../../language/printer.js"); - -var _definition = require("../../type/definition.js"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Value literals of correct type - * - * A GraphQL document is only valid if all value literals are of the type - * expected at their position. - */ -function ValuesOfCorrectTypeRule(context) { - return { - ListValue: function ListValue(node) { - // Note: TypeInfo will traverse into a list's item type, so look to the - // parent input type to check if it is a list. - var type = (0, _definition.getNullableType)(context.getParentInputType()); - - if (!(0, _definition.isListType)(type)) { - isValidValueNode(context, node); - return false; // Don't traverse further. - } - }, - ObjectValue: function ObjectValue(node) { - var type = (0, _definition.getNamedType)(context.getInputType()); - - if (!(0, _definition.isInputObjectType)(type)) { - isValidValueNode(context, node); - return false; // Don't traverse further. - } // Ensure every required field exists. - - - var fieldNodeMap = (0, _keyMap.default)(node.fields, function (field) { - return field.name.value; - }); - - for (var _i2 = 0, _objectValues2 = (0, _objectValues3.default)(type.getFields()); _i2 < _objectValues2.length; _i2++) { - var fieldDef = _objectValues2[_i2]; - var fieldNode = fieldNodeMap[fieldDef.name]; - - if (!fieldNode && (0, _definition.isRequiredInputField)(fieldDef)) { - var typeStr = (0, _inspect.default)(fieldDef.type); - context.reportError(new _GraphQLError.GraphQLError("Field \"".concat(type.name, ".").concat(fieldDef.name, "\" of required type \"").concat(typeStr, "\" was not provided."), node)); - } - } - }, - ObjectField: function ObjectField(node) { - var parentType = (0, _definition.getNamedType)(context.getParentInputType()); - var fieldType = context.getInputType(); - - if (!fieldType && (0, _definition.isInputObjectType)(parentType)) { - var suggestions = (0, _suggestionList.default)(node.name.value, Object.keys(parentType.getFields())); - context.reportError(new _GraphQLError.GraphQLError("Field \"".concat(node.name.value, "\" is not defined by type \"").concat(parentType.name, "\".") + (0, _didYouMean.default)(suggestions), node)); - } - }, - NullValue: function NullValue(node) { - var type = context.getInputType(); - - if ((0, _definition.isNonNullType)(type)) { - context.reportError(new _GraphQLError.GraphQLError("Expected value of type \"".concat((0, _inspect.default)(type), "\", found ").concat((0, _printer.print)(node), "."), node)); - } - }, - EnumValue: function EnumValue(node) { - return isValidValueNode(context, node); - }, - IntValue: function IntValue(node) { - return isValidValueNode(context, node); - }, - FloatValue: function FloatValue(node) { - return isValidValueNode(context, node); - }, - StringValue: function StringValue(node) { - return isValidValueNode(context, node); - }, - BooleanValue: function BooleanValue(node) { - return isValidValueNode(context, node); - } - }; -} -/** - * Any value literal may be a valid representation of a Scalar, depending on - * that scalar type. - */ - - -function isValidValueNode(context, node) { - // Report any error at the full type expected by the location. - var locationType = context.getInputType(); - - if (!locationType) { - return; - } - - var type = (0, _definition.getNamedType)(locationType); - - if (!(0, _definition.isLeafType)(type)) { - var typeStr = (0, _inspect.default)(locationType); - context.reportError(new _GraphQLError.GraphQLError("Expected value of type \"".concat(typeStr, "\", found ").concat((0, _printer.print)(node), "."), node)); - return; - } // Scalars and Enums determine if a literal value is valid via parseLiteral(), - // which may throw or return an invalid value to indicate failure. - - - try { - var parseResult = type.parseLiteral(node, undefined - /* variables */ - ); - - if (parseResult === undefined) { - var _typeStr = (0, _inspect.default)(locationType); - - context.reportError(new _GraphQLError.GraphQLError("Expected value of type \"".concat(_typeStr, "\", found ").concat((0, _printer.print)(node), "."), node)); - } - } catch (error) { - var _typeStr2 = (0, _inspect.default)(locationType); - - if (error instanceof _GraphQLError.GraphQLError) { - context.reportError(error); - } else { - context.reportError(new _GraphQLError.GraphQLError("Expected value of type \"".concat(_typeStr2, "\", found ").concat((0, _printer.print)(node), "; ") + error.message, node, undefined, undefined, undefined, error)); - } - } -} diff --git a/alarm/node_modules/graphql/validation/rules/ValuesOfCorrectTypeRule.js.flow b/alarm/node_modules/graphql/validation/rules/ValuesOfCorrectTypeRule.js.flow deleted file mode 100644 index 09a922c..0000000 --- a/alarm/node_modules/graphql/validation/rules/ValuesOfCorrectTypeRule.js.flow +++ /dev/null @@ -1,158 +0,0 @@ -// @flow strict -import objectValues from '../../polyfills/objectValues'; - -import keyMap from '../../jsutils/keyMap'; -import inspect from '../../jsutils/inspect'; -import didYouMean from '../../jsutils/didYouMean'; -import suggestionList from '../../jsutils/suggestionList'; - -import { GraphQLError } from '../../error/GraphQLError'; - -import type { ValueNode } from '../../language/ast'; -import type { ASTVisitor } from '../../language/visitor'; -import { print } from '../../language/printer'; - -import { - isLeafType, - isInputObjectType, - isListType, - isNonNullType, - isRequiredInputField, - getNullableType, - getNamedType, -} from '../../type/definition'; - -import type { ValidationContext } from '../ValidationContext'; - -/** - * Value literals of correct type - * - * A GraphQL document is only valid if all value literals are of the type - * expected at their position. - */ -export function ValuesOfCorrectTypeRule( - context: ValidationContext, -): ASTVisitor { - return { - ListValue(node) { - // Note: TypeInfo will traverse into a list's item type, so look to the - // parent input type to check if it is a list. - const type = getNullableType(context.getParentInputType()); - if (!isListType(type)) { - isValidValueNode(context, node); - return false; // Don't traverse further. - } - }, - ObjectValue(node) { - const type = getNamedType(context.getInputType()); - if (!isInputObjectType(type)) { - isValidValueNode(context, node); - return false; // Don't traverse further. - } - // Ensure every required field exists. - const fieldNodeMap = keyMap(node.fields, (field) => field.name.value); - for (const fieldDef of objectValues(type.getFields())) { - const fieldNode = fieldNodeMap[fieldDef.name]; - if (!fieldNode && isRequiredInputField(fieldDef)) { - const typeStr = inspect(fieldDef.type); - context.reportError( - new GraphQLError( - `Field "${type.name}.${fieldDef.name}" of required type "${typeStr}" was not provided.`, - node, - ), - ); - } - } - }, - ObjectField(node) { - const parentType = getNamedType(context.getParentInputType()); - const fieldType = context.getInputType(); - if (!fieldType && isInputObjectType(parentType)) { - const suggestions = suggestionList( - node.name.value, - Object.keys(parentType.getFields()), - ); - context.reportError( - new GraphQLError( - `Field "${node.name.value}" is not defined by type "${parentType.name}".` + - didYouMean(suggestions), - node, - ), - ); - } - }, - NullValue(node) { - const type = context.getInputType(); - if (isNonNullType(type)) { - context.reportError( - new GraphQLError( - `Expected value of type "${inspect(type)}", found ${print(node)}.`, - node, - ), - ); - } - }, - EnumValue: (node) => isValidValueNode(context, node), - IntValue: (node) => isValidValueNode(context, node), - FloatValue: (node) => isValidValueNode(context, node), - StringValue: (node) => isValidValueNode(context, node), - BooleanValue: (node) => isValidValueNode(context, node), - }; -} - -/** - * Any value literal may be a valid representation of a Scalar, depending on - * that scalar type. - */ -function isValidValueNode(context: ValidationContext, node: ValueNode): void { - // Report any error at the full type expected by the location. - const locationType = context.getInputType(); - if (!locationType) { - return; - } - - const type = getNamedType(locationType); - - if (!isLeafType(type)) { - const typeStr = inspect(locationType); - context.reportError( - new GraphQLError( - `Expected value of type "${typeStr}", found ${print(node)}.`, - node, - ), - ); - return; - } - - // Scalars and Enums determine if a literal value is valid via parseLiteral(), - // which may throw or return an invalid value to indicate failure. - try { - const parseResult = type.parseLiteral(node, undefined /* variables */); - if (parseResult === undefined) { - const typeStr = inspect(locationType); - context.reportError( - new GraphQLError( - `Expected value of type "${typeStr}", found ${print(node)}.`, - node, - ), - ); - } - } catch (error) { - const typeStr = inspect(locationType); - if (error instanceof GraphQLError) { - context.reportError(error); - } else { - context.reportError( - new GraphQLError( - `Expected value of type "${typeStr}", found ${print(node)}; ` + - error.message, - node, - undefined, - undefined, - undefined, - error, // Ensure a reference to the original error is maintained. - ), - ); - } - } -} diff --git a/alarm/node_modules/graphql/validation/rules/ValuesOfCorrectTypeRule.mjs b/alarm/node_modules/graphql/validation/rules/ValuesOfCorrectTypeRule.mjs deleted file mode 100644 index 01c8967..0000000 --- a/alarm/node_modules/graphql/validation/rules/ValuesOfCorrectTypeRule.mjs +++ /dev/null @@ -1,126 +0,0 @@ -import objectValues from "../../polyfills/objectValues.mjs"; -import keyMap from "../../jsutils/keyMap.mjs"; -import inspect from "../../jsutils/inspect.mjs"; -import didYouMean from "../../jsutils/didYouMean.mjs"; -import suggestionList from "../../jsutils/suggestionList.mjs"; -import { GraphQLError } from "../../error/GraphQLError.mjs"; -import { print } from "../../language/printer.mjs"; -import { isLeafType, isInputObjectType, isListType, isNonNullType, isRequiredInputField, getNullableType, getNamedType } from "../../type/definition.mjs"; - -/** - * Value literals of correct type - * - * A GraphQL document is only valid if all value literals are of the type - * expected at their position. - */ -export function ValuesOfCorrectTypeRule(context) { - return { - ListValue: function ListValue(node) { - // Note: TypeInfo will traverse into a list's item type, so look to the - // parent input type to check if it is a list. - var type = getNullableType(context.getParentInputType()); - - if (!isListType(type)) { - isValidValueNode(context, node); - return false; // Don't traverse further. - } - }, - ObjectValue: function ObjectValue(node) { - var type = getNamedType(context.getInputType()); - - if (!isInputObjectType(type)) { - isValidValueNode(context, node); - return false; // Don't traverse further. - } // Ensure every required field exists. - - - var fieldNodeMap = keyMap(node.fields, function (field) { - return field.name.value; - }); - - for (var _i2 = 0, _objectValues2 = objectValues(type.getFields()); _i2 < _objectValues2.length; _i2++) { - var fieldDef = _objectValues2[_i2]; - var fieldNode = fieldNodeMap[fieldDef.name]; - - if (!fieldNode && isRequiredInputField(fieldDef)) { - var typeStr = inspect(fieldDef.type); - context.reportError(new GraphQLError("Field \"".concat(type.name, ".").concat(fieldDef.name, "\" of required type \"").concat(typeStr, "\" was not provided."), node)); - } - } - }, - ObjectField: function ObjectField(node) { - var parentType = getNamedType(context.getParentInputType()); - var fieldType = context.getInputType(); - - if (!fieldType && isInputObjectType(parentType)) { - var suggestions = suggestionList(node.name.value, Object.keys(parentType.getFields())); - context.reportError(new GraphQLError("Field \"".concat(node.name.value, "\" is not defined by type \"").concat(parentType.name, "\".") + didYouMean(suggestions), node)); - } - }, - NullValue: function NullValue(node) { - var type = context.getInputType(); - - if (isNonNullType(type)) { - context.reportError(new GraphQLError("Expected value of type \"".concat(inspect(type), "\", found ").concat(print(node), "."), node)); - } - }, - EnumValue: function EnumValue(node) { - return isValidValueNode(context, node); - }, - IntValue: function IntValue(node) { - return isValidValueNode(context, node); - }, - FloatValue: function FloatValue(node) { - return isValidValueNode(context, node); - }, - StringValue: function StringValue(node) { - return isValidValueNode(context, node); - }, - BooleanValue: function BooleanValue(node) { - return isValidValueNode(context, node); - } - }; -} -/** - * Any value literal may be a valid representation of a Scalar, depending on - * that scalar type. - */ - -function isValidValueNode(context, node) { - // Report any error at the full type expected by the location. - var locationType = context.getInputType(); - - if (!locationType) { - return; - } - - var type = getNamedType(locationType); - - if (!isLeafType(type)) { - var typeStr = inspect(locationType); - context.reportError(new GraphQLError("Expected value of type \"".concat(typeStr, "\", found ").concat(print(node), "."), node)); - return; - } // Scalars and Enums determine if a literal value is valid via parseLiteral(), - // which may throw or return an invalid value to indicate failure. - - - try { - var parseResult = type.parseLiteral(node, undefined - /* variables */ - ); - - if (parseResult === undefined) { - var _typeStr = inspect(locationType); - - context.reportError(new GraphQLError("Expected value of type \"".concat(_typeStr, "\", found ").concat(print(node), "."), node)); - } - } catch (error) { - var _typeStr2 = inspect(locationType); - - if (error instanceof GraphQLError) { - context.reportError(error); - } else { - context.reportError(new GraphQLError("Expected value of type \"".concat(_typeStr2, "\", found ").concat(print(node), "; ") + error.message, node, undefined, undefined, undefined, error)); - } - } -} diff --git a/alarm/node_modules/graphql/validation/rules/VariablesAreInputTypesRule.d.ts b/alarm/node_modules/graphql/validation/rules/VariablesAreInputTypesRule.d.ts deleted file mode 100644 index c82229c..0000000 --- a/alarm/node_modules/graphql/validation/rules/VariablesAreInputTypesRule.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { ASTVisitor } from '../../language/visitor'; -import { ValidationContext } from '../ValidationContext'; - -/** - * Variables are input types - * - * A GraphQL operation is only valid if all the variables it defines are of - * input types (scalar, enum, or input object). - */ -export function VariablesAreInputTypesRule( - context: ValidationContext, -): ASTVisitor; diff --git a/alarm/node_modules/graphql/validation/rules/VariablesAreInputTypesRule.js b/alarm/node_modules/graphql/validation/rules/VariablesAreInputTypesRule.js deleted file mode 100644 index 885d309..0000000 --- a/alarm/node_modules/graphql/validation/rules/VariablesAreInputTypesRule.js +++ /dev/null @@ -1,34 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.VariablesAreInputTypesRule = VariablesAreInputTypesRule; - -var _GraphQLError = require("../../error/GraphQLError.js"); - -var _printer = require("../../language/printer.js"); - -var _definition = require("../../type/definition.js"); - -var _typeFromAST = require("../../utilities/typeFromAST.js"); - -/** - * Variables are input types - * - * A GraphQL operation is only valid if all the variables it defines are of - * input types (scalar, enum, or input object). - */ -function VariablesAreInputTypesRule(context) { - return { - VariableDefinition: function VariableDefinition(node) { - var type = (0, _typeFromAST.typeFromAST)(context.getSchema(), node.type); - - if (type && !(0, _definition.isInputType)(type)) { - var variableName = node.variable.name.value; - var typeName = (0, _printer.print)(node.type); - context.reportError(new _GraphQLError.GraphQLError("Variable \"$".concat(variableName, "\" cannot be non-input type \"").concat(typeName, "\"."), node.type)); - } - } - }; -} diff --git a/alarm/node_modules/graphql/validation/rules/VariablesAreInputTypesRule.js.flow b/alarm/node_modules/graphql/validation/rules/VariablesAreInputTypesRule.js.flow deleted file mode 100644 index 2de0819..0000000 --- a/alarm/node_modules/graphql/validation/rules/VariablesAreInputTypesRule.js.flow +++ /dev/null @@ -1,40 +0,0 @@ -// @flow strict -import { GraphQLError } from '../../error/GraphQLError'; - -import { print } from '../../language/printer'; -import type { ASTVisitor } from '../../language/visitor'; -import type { VariableDefinitionNode } from '../../language/ast'; - -import { isInputType } from '../../type/definition'; - -import { typeFromAST } from '../../utilities/typeFromAST'; - -import type { ValidationContext } from '../ValidationContext'; - -/** - * Variables are input types - * - * A GraphQL operation is only valid if all the variables it defines are of - * input types (scalar, enum, or input object). - */ -export function VariablesAreInputTypesRule( - context: ValidationContext, -): ASTVisitor { - return { - VariableDefinition(node: VariableDefinitionNode): ?GraphQLError { - const type = typeFromAST(context.getSchema(), node.type); - - if (type && !isInputType(type)) { - const variableName = node.variable.name.value; - const typeName = print(node.type); - - context.reportError( - new GraphQLError( - `Variable "$${variableName}" cannot be non-input type "${typeName}".`, - node.type, - ), - ); - } - }, - }; -} diff --git a/alarm/node_modules/graphql/validation/rules/VariablesAreInputTypesRule.mjs b/alarm/node_modules/graphql/validation/rules/VariablesAreInputTypesRule.mjs deleted file mode 100644 index f6e5d11..0000000 --- a/alarm/node_modules/graphql/validation/rules/VariablesAreInputTypesRule.mjs +++ /dev/null @@ -1,24 +0,0 @@ -import { GraphQLError } from "../../error/GraphQLError.mjs"; -import { print } from "../../language/printer.mjs"; -import { isInputType } from "../../type/definition.mjs"; -import { typeFromAST } from "../../utilities/typeFromAST.mjs"; - -/** - * Variables are input types - * - * A GraphQL operation is only valid if all the variables it defines are of - * input types (scalar, enum, or input object). - */ -export function VariablesAreInputTypesRule(context) { - return { - VariableDefinition: function VariableDefinition(node) { - var type = typeFromAST(context.getSchema(), node.type); - - if (type && !isInputType(type)) { - var variableName = node.variable.name.value; - var typeName = print(node.type); - context.reportError(new GraphQLError("Variable \"$".concat(variableName, "\" cannot be non-input type \"").concat(typeName, "\"."), node.type)); - } - } - }; -} diff --git a/alarm/node_modules/graphql/validation/rules/VariablesInAllowedPositionRule.d.ts b/alarm/node_modules/graphql/validation/rules/VariablesInAllowedPositionRule.d.ts deleted file mode 100644 index 6ee5737..0000000 --- a/alarm/node_modules/graphql/validation/rules/VariablesInAllowedPositionRule.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { ASTVisitor } from '../../language/visitor'; -import { ValidationContext } from '../ValidationContext'; - -/** - * Variables passed to field arguments conform to type - */ -export function VariablesInAllowedPositionRule( - context: ValidationContext, -): ASTVisitor; diff --git a/alarm/node_modules/graphql/validation/rules/VariablesInAllowedPositionRule.js b/alarm/node_modules/graphql/validation/rules/VariablesInAllowedPositionRule.js deleted file mode 100644 index ad0ce8c..0000000 --- a/alarm/node_modules/graphql/validation/rules/VariablesInAllowedPositionRule.js +++ /dev/null @@ -1,87 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.VariablesInAllowedPositionRule = VariablesInAllowedPositionRule; - -var _inspect = _interopRequireDefault(require("../../jsutils/inspect.js")); - -var _GraphQLError = require("../../error/GraphQLError.js"); - -var _kinds = require("../../language/kinds.js"); - -var _definition = require("../../type/definition.js"); - -var _typeFromAST = require("../../utilities/typeFromAST.js"); - -var _typeComparators = require("../../utilities/typeComparators.js"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * Variables passed to field arguments conform to type - */ -function VariablesInAllowedPositionRule(context) { - var varDefMap = Object.create(null); - return { - OperationDefinition: { - enter: function enter() { - varDefMap = Object.create(null); - }, - leave: function leave(operation) { - var usages = context.getRecursiveVariableUsages(operation); - - for (var _i2 = 0; _i2 < usages.length; _i2++) { - var _ref2 = usages[_i2]; - var node = _ref2.node; - var type = _ref2.type; - var defaultValue = _ref2.defaultValue; - var varName = node.name.value; - var varDef = varDefMap[varName]; - - if (varDef && type) { - // A var type is allowed if it is the same or more strict (e.g. is - // a subtype of) than the expected type. It can be more strict if - // the variable type is non-null when the expected type is nullable. - // If both are list types, the variable item type can be more strict - // than the expected item type (contravariant). - var schema = context.getSchema(); - var varType = (0, _typeFromAST.typeFromAST)(schema, varDef.type); - - if (varType && !allowedVariableUsage(schema, varType, varDef.defaultValue, type, defaultValue)) { - var varTypeStr = (0, _inspect.default)(varType); - var typeStr = (0, _inspect.default)(type); - context.reportError(new _GraphQLError.GraphQLError("Variable \"$".concat(varName, "\" of type \"").concat(varTypeStr, "\" used in position expecting type \"").concat(typeStr, "\"."), [varDef, node])); - } - } - } - } - }, - VariableDefinition: function VariableDefinition(node) { - varDefMap[node.variable.name.value] = node; - } - }; -} -/** - * Returns true if the variable is allowed in the location it was found, - * which includes considering if default values exist for either the variable - * or the location at which it is located. - */ - - -function allowedVariableUsage(schema, varType, varDefaultValue, locationType, locationDefaultValue) { - if ((0, _definition.isNonNullType)(locationType) && !(0, _definition.isNonNullType)(varType)) { - var hasNonNullVariableDefaultValue = varDefaultValue != null && varDefaultValue.kind !== _kinds.Kind.NULL; - var hasLocationDefaultValue = locationDefaultValue !== undefined; - - if (!hasNonNullVariableDefaultValue && !hasLocationDefaultValue) { - return false; - } - - var nullableLocationType = locationType.ofType; - return (0, _typeComparators.isTypeSubTypeOf)(schema, varType, nullableLocationType); - } - - return (0, _typeComparators.isTypeSubTypeOf)(schema, varType, locationType); -} diff --git a/alarm/node_modules/graphql/validation/rules/VariablesInAllowedPositionRule.js.flow b/alarm/node_modules/graphql/validation/rules/VariablesInAllowedPositionRule.js.flow deleted file mode 100644 index 722ee99..0000000 --- a/alarm/node_modules/graphql/validation/rules/VariablesInAllowedPositionRule.js.flow +++ /dev/null @@ -1,98 +0,0 @@ -// @flow strict -import inspect from '../../jsutils/inspect'; - -import { GraphQLError } from '../../error/GraphQLError'; - -import { Kind } from '../../language/kinds'; -import type { ValueNode } from '../../language/ast'; -import type { ASTVisitor } from '../../language/visitor'; - -import type { GraphQLSchema } from '../../type/schema'; -import type { GraphQLType } from '../../type/definition'; -import { isNonNullType } from '../../type/definition'; - -import { typeFromAST } from '../../utilities/typeFromAST'; -import { isTypeSubTypeOf } from '../../utilities/typeComparators'; - -import type { ValidationContext } from '../ValidationContext'; - -/** - * Variables passed to field arguments conform to type - */ -export function VariablesInAllowedPositionRule( - context: ValidationContext, -): ASTVisitor { - let varDefMap = Object.create(null); - - return { - OperationDefinition: { - enter() { - varDefMap = Object.create(null); - }, - leave(operation) { - const usages = context.getRecursiveVariableUsages(operation); - - for (const { node, type, defaultValue } of usages) { - const varName = node.name.value; - const varDef = varDefMap[varName]; - if (varDef && type) { - // A var type is allowed if it is the same or more strict (e.g. is - // a subtype of) than the expected type. It can be more strict if - // the variable type is non-null when the expected type is nullable. - // If both are list types, the variable item type can be more strict - // than the expected item type (contravariant). - const schema = context.getSchema(); - const varType = typeFromAST(schema, varDef.type); - if ( - varType && - !allowedVariableUsage( - schema, - varType, - varDef.defaultValue, - type, - defaultValue, - ) - ) { - const varTypeStr = inspect(varType); - const typeStr = inspect(type); - context.reportError( - new GraphQLError( - `Variable "$${varName}" of type "${varTypeStr}" used in position expecting type "${typeStr}".`, - [varDef, node], - ), - ); - } - } - } - }, - }, - VariableDefinition(node) { - varDefMap[node.variable.name.value] = node; - }, - }; -} - -/** - * Returns true if the variable is allowed in the location it was found, - * which includes considering if default values exist for either the variable - * or the location at which it is located. - */ -function allowedVariableUsage( - schema: GraphQLSchema, - varType: GraphQLType, - varDefaultValue: ?ValueNode, - locationType: GraphQLType, - locationDefaultValue: ?mixed, -): boolean { - if (isNonNullType(locationType) && !isNonNullType(varType)) { - const hasNonNullVariableDefaultValue = - varDefaultValue != null && varDefaultValue.kind !== Kind.NULL; - const hasLocationDefaultValue = locationDefaultValue !== undefined; - if (!hasNonNullVariableDefaultValue && !hasLocationDefaultValue) { - return false; - } - const nullableLocationType = locationType.ofType; - return isTypeSubTypeOf(schema, varType, nullableLocationType); - } - return isTypeSubTypeOf(schema, varType, locationType); -} diff --git a/alarm/node_modules/graphql/validation/rules/VariablesInAllowedPositionRule.mjs b/alarm/node_modules/graphql/validation/rules/VariablesInAllowedPositionRule.mjs deleted file mode 100644 index bdddb2f..0000000 --- a/alarm/node_modules/graphql/validation/rules/VariablesInAllowedPositionRule.mjs +++ /dev/null @@ -1,72 +0,0 @@ -import inspect from "../../jsutils/inspect.mjs"; -import { GraphQLError } from "../../error/GraphQLError.mjs"; -import { Kind } from "../../language/kinds.mjs"; -import { isNonNullType } from "../../type/definition.mjs"; -import { typeFromAST } from "../../utilities/typeFromAST.mjs"; -import { isTypeSubTypeOf } from "../../utilities/typeComparators.mjs"; - -/** - * Variables passed to field arguments conform to type - */ -export function VariablesInAllowedPositionRule(context) { - var varDefMap = Object.create(null); - return { - OperationDefinition: { - enter: function enter() { - varDefMap = Object.create(null); - }, - leave: function leave(operation) { - var usages = context.getRecursiveVariableUsages(operation); - - for (var _i2 = 0; _i2 < usages.length; _i2++) { - var _ref2 = usages[_i2]; - var node = _ref2.node; - var type = _ref2.type; - var defaultValue = _ref2.defaultValue; - var varName = node.name.value; - var varDef = varDefMap[varName]; - - if (varDef && type) { - // A var type is allowed if it is the same or more strict (e.g. is - // a subtype of) than the expected type. It can be more strict if - // the variable type is non-null when the expected type is nullable. - // If both are list types, the variable item type can be more strict - // than the expected item type (contravariant). - var schema = context.getSchema(); - var varType = typeFromAST(schema, varDef.type); - - if (varType && !allowedVariableUsage(schema, varType, varDef.defaultValue, type, defaultValue)) { - var varTypeStr = inspect(varType); - var typeStr = inspect(type); - context.reportError(new GraphQLError("Variable \"$".concat(varName, "\" of type \"").concat(varTypeStr, "\" used in position expecting type \"").concat(typeStr, "\"."), [varDef, node])); - } - } - } - } - }, - VariableDefinition: function VariableDefinition(node) { - varDefMap[node.variable.name.value] = node; - } - }; -} -/** - * Returns true if the variable is allowed in the location it was found, - * which includes considering if default values exist for either the variable - * or the location at which it is located. - */ - -function allowedVariableUsage(schema, varType, varDefaultValue, locationType, locationDefaultValue) { - if (isNonNullType(locationType) && !isNonNullType(varType)) { - var hasNonNullVariableDefaultValue = varDefaultValue != null && varDefaultValue.kind !== Kind.NULL; - var hasLocationDefaultValue = locationDefaultValue !== undefined; - - if (!hasNonNullVariableDefaultValue && !hasLocationDefaultValue) { - return false; - } - - var nullableLocationType = locationType.ofType; - return isTypeSubTypeOf(schema, varType, nullableLocationType); - } - - return isTypeSubTypeOf(schema, varType, locationType); -} diff --git a/alarm/node_modules/graphql/validation/rules/custom/NoDeprecatedCustomRule.d.ts b/alarm/node_modules/graphql/validation/rules/custom/NoDeprecatedCustomRule.d.ts deleted file mode 100644 index d376cf8..0000000 --- a/alarm/node_modules/graphql/validation/rules/custom/NoDeprecatedCustomRule.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { ASTVisitor } from '../../../language/visitor'; -import { ValidationContext } from '../../ValidationContext'; - -/** - * No deprecated - * - * A GraphQL document is only valid if all selected fields and all used enum values have not been - * deprecated. - * - * Note: This rule is optional and is not part of the Validation section of the GraphQL - * Specification. The main purpose of this rule is detection of deprecated usages and not - * necessarily to forbid their use when querying a service. - */ -export function NoDeprecatedCustomRule(context: ValidationContext): ASTVisitor; diff --git a/alarm/node_modules/graphql/validation/rules/custom/NoDeprecatedCustomRule.js b/alarm/node_modules/graphql/validation/rules/custom/NoDeprecatedCustomRule.js deleted file mode 100644 index 63ad4dc..0000000 --- a/alarm/node_modules/graphql/validation/rules/custom/NoDeprecatedCustomRule.js +++ /dev/null @@ -1,79 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.NoDeprecatedCustomRule = NoDeprecatedCustomRule; - -var _invariant = _interopRequireDefault(require("../../../jsutils/invariant.js")); - -var _GraphQLError = require("../../../error/GraphQLError.js"); - -var _definition = require("../../../type/definition.js"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/** - * No deprecated - * - * A GraphQL document is only valid if all selected fields and all used enum values have not been - * deprecated. - * - * Note: This rule is optional and is not part of the Validation section of the GraphQL - * Specification. The main purpose of this rule is detection of deprecated usages and not - * necessarily to forbid their use when querying a service. - */ -function NoDeprecatedCustomRule(context) { - return { - Field: function Field(node) { - var fieldDef = context.getFieldDef(); - var deprecationReason = fieldDef === null || fieldDef === void 0 ? void 0 : fieldDef.deprecationReason; - - if (fieldDef && deprecationReason != null) { - var parentType = context.getParentType(); - parentType != null || (0, _invariant.default)(0); - context.reportError(new _GraphQLError.GraphQLError("The field ".concat(parentType.name, ".").concat(fieldDef.name, " is deprecated. ").concat(deprecationReason), node)); - } - }, - Argument: function Argument(node) { - var argDef = context.getArgument(); - var deprecationReason = argDef === null || argDef === void 0 ? void 0 : argDef.deprecationReason; - - if (argDef && deprecationReason != null) { - var directiveDef = context.getDirective(); - - if (directiveDef != null) { - context.reportError(new _GraphQLError.GraphQLError("Directive \"@".concat(directiveDef.name, "\" argument \"").concat(argDef.name, "\" is deprecated. ").concat(deprecationReason), node)); - } else { - var parentType = context.getParentType(); - var fieldDef = context.getFieldDef(); - parentType != null && fieldDef != null || (0, _invariant.default)(0); - context.reportError(new _GraphQLError.GraphQLError("Field \"".concat(parentType.name, ".").concat(fieldDef.name, "\" argument \"").concat(argDef.name, "\" is deprecated. ").concat(deprecationReason), node)); - } - } - }, - ObjectField: function ObjectField(node) { - var inputObjectDef = (0, _definition.getNamedType)(context.getParentInputType()); - - if ((0, _definition.isInputObjectType)(inputObjectDef)) { - var inputFieldDef = inputObjectDef.getFields()[node.name.value]; // flowlint-next-line unnecessary-optional-chain:off - - var deprecationReason = inputFieldDef === null || inputFieldDef === void 0 ? void 0 : inputFieldDef.deprecationReason; - - if (deprecationReason != null) { - context.reportError(new _GraphQLError.GraphQLError("The input field ".concat(inputObjectDef.name, ".").concat(inputFieldDef.name, " is deprecated. ").concat(deprecationReason), node)); - } - } - }, - EnumValue: function EnumValue(node) { - var enumValueDef = context.getEnumValue(); - var deprecationReason = enumValueDef === null || enumValueDef === void 0 ? void 0 : enumValueDef.deprecationReason; - - if (enumValueDef && deprecationReason != null) { - var enumTypeDef = (0, _definition.getNamedType)(context.getInputType()); - enumTypeDef != null || (0, _invariant.default)(0); - context.reportError(new _GraphQLError.GraphQLError("The enum value \"".concat(enumTypeDef.name, ".").concat(enumValueDef.name, "\" is deprecated. ").concat(deprecationReason), node)); - } - } - }; -} diff --git a/alarm/node_modules/graphql/validation/rules/custom/NoDeprecatedCustomRule.js.flow b/alarm/node_modules/graphql/validation/rules/custom/NoDeprecatedCustomRule.js.flow deleted file mode 100644 index 6b61065..0000000 --- a/alarm/node_modules/graphql/validation/rules/custom/NoDeprecatedCustomRule.js.flow +++ /dev/null @@ -1,94 +0,0 @@ -// @flow strict -import invariant from '../../../jsutils/invariant'; - -import { GraphQLError } from '../../../error/GraphQLError'; - -import type { ASTVisitor } from '../../../language/visitor'; - -import { getNamedType, isInputObjectType } from '../../../type/definition'; - -import type { ValidationContext } from '../../ValidationContext'; - -/** - * No deprecated - * - * A GraphQL document is only valid if all selected fields and all used enum values have not been - * deprecated. - * - * Note: This rule is optional and is not part of the Validation section of the GraphQL - * Specification. The main purpose of this rule is detection of deprecated usages and not - * necessarily to forbid their use when querying a service. - */ -export function NoDeprecatedCustomRule(context: ValidationContext): ASTVisitor { - return { - Field(node) { - const fieldDef = context.getFieldDef(); - const deprecationReason = fieldDef?.deprecationReason; - if (fieldDef && deprecationReason != null) { - const parentType = context.getParentType(); - invariant(parentType != null); - context.reportError( - new GraphQLError( - `The field ${parentType.name}.${fieldDef.name} is deprecated. ${deprecationReason}`, - node, - ), - ); - } - }, - Argument(node) { - const argDef = context.getArgument(); - const deprecationReason = argDef?.deprecationReason; - if (argDef && deprecationReason != null) { - const directiveDef = context.getDirective(); - if (directiveDef != null) { - context.reportError( - new GraphQLError( - `Directive "@${directiveDef.name}" argument "${argDef.name}" is deprecated. ${deprecationReason}`, - node, - ), - ); - } else { - const parentType = context.getParentType(); - const fieldDef = context.getFieldDef(); - invariant(parentType != null && fieldDef != null); - context.reportError( - new GraphQLError( - `Field "${parentType.name}.${fieldDef.name}" argument "${argDef.name}" is deprecated. ${deprecationReason}`, - node, - ), - ); - } - } - }, - ObjectField(node) { - const inputObjectDef = getNamedType(context.getParentInputType()); - if (isInputObjectType(inputObjectDef)) { - const inputFieldDef = inputObjectDef.getFields()[node.name.value]; - // flowlint-next-line unnecessary-optional-chain:off - const deprecationReason = inputFieldDef?.deprecationReason; - if (deprecationReason != null) { - context.reportError( - new GraphQLError( - `The input field ${inputObjectDef.name}.${inputFieldDef.name} is deprecated. ${deprecationReason}`, - node, - ), - ); - } - } - }, - EnumValue(node) { - const enumValueDef = context.getEnumValue(); - const deprecationReason = enumValueDef?.deprecationReason; - if (enumValueDef && deprecationReason != null) { - const enumTypeDef = getNamedType(context.getInputType()); - invariant(enumTypeDef != null); - context.reportError( - new GraphQLError( - `The enum value "${enumTypeDef.name}.${enumValueDef.name}" is deprecated. ${deprecationReason}`, - node, - ), - ); - } - }, - }; -} diff --git a/alarm/node_modules/graphql/validation/rules/custom/NoDeprecatedCustomRule.mjs b/alarm/node_modules/graphql/validation/rules/custom/NoDeprecatedCustomRule.mjs deleted file mode 100644 index f0e0b36..0000000 --- a/alarm/node_modules/graphql/validation/rules/custom/NoDeprecatedCustomRule.mjs +++ /dev/null @@ -1,68 +0,0 @@ -import invariant from "../../../jsutils/invariant.mjs"; -import { GraphQLError } from "../../../error/GraphQLError.mjs"; -import { getNamedType, isInputObjectType } from "../../../type/definition.mjs"; - -/** - * No deprecated - * - * A GraphQL document is only valid if all selected fields and all used enum values have not been - * deprecated. - * - * Note: This rule is optional and is not part of the Validation section of the GraphQL - * Specification. The main purpose of this rule is detection of deprecated usages and not - * necessarily to forbid their use when querying a service. - */ -export function NoDeprecatedCustomRule(context) { - return { - Field: function Field(node) { - var fieldDef = context.getFieldDef(); - var deprecationReason = fieldDef === null || fieldDef === void 0 ? void 0 : fieldDef.deprecationReason; - - if (fieldDef && deprecationReason != null) { - var parentType = context.getParentType(); - parentType != null || invariant(0); - context.reportError(new GraphQLError("The field ".concat(parentType.name, ".").concat(fieldDef.name, " is deprecated. ").concat(deprecationReason), node)); - } - }, - Argument: function Argument(node) { - var argDef = context.getArgument(); - var deprecationReason = argDef === null || argDef === void 0 ? void 0 : argDef.deprecationReason; - - if (argDef && deprecationReason != null) { - var directiveDef = context.getDirective(); - - if (directiveDef != null) { - context.reportError(new GraphQLError("Directive \"@".concat(directiveDef.name, "\" argument \"").concat(argDef.name, "\" is deprecated. ").concat(deprecationReason), node)); - } else { - var parentType = context.getParentType(); - var fieldDef = context.getFieldDef(); - parentType != null && fieldDef != null || invariant(0); - context.reportError(new GraphQLError("Field \"".concat(parentType.name, ".").concat(fieldDef.name, "\" argument \"").concat(argDef.name, "\" is deprecated. ").concat(deprecationReason), node)); - } - } - }, - ObjectField: function ObjectField(node) { - var inputObjectDef = getNamedType(context.getParentInputType()); - - if (isInputObjectType(inputObjectDef)) { - var inputFieldDef = inputObjectDef.getFields()[node.name.value]; // flowlint-next-line unnecessary-optional-chain:off - - var deprecationReason = inputFieldDef === null || inputFieldDef === void 0 ? void 0 : inputFieldDef.deprecationReason; - - if (deprecationReason != null) { - context.reportError(new GraphQLError("The input field ".concat(inputObjectDef.name, ".").concat(inputFieldDef.name, " is deprecated. ").concat(deprecationReason), node)); - } - } - }, - EnumValue: function EnumValue(node) { - var enumValueDef = context.getEnumValue(); - var deprecationReason = enumValueDef === null || enumValueDef === void 0 ? void 0 : enumValueDef.deprecationReason; - - if (enumValueDef && deprecationReason != null) { - var enumTypeDef = getNamedType(context.getInputType()); - enumTypeDef != null || invariant(0); - context.reportError(new GraphQLError("The enum value \"".concat(enumTypeDef.name, ".").concat(enumValueDef.name, "\" is deprecated. ").concat(deprecationReason), node)); - } - } - }; -} diff --git a/alarm/node_modules/graphql/validation/rules/custom/NoSchemaIntrospectionCustomRule.d.ts b/alarm/node_modules/graphql/validation/rules/custom/NoSchemaIntrospectionCustomRule.d.ts deleted file mode 100644 index 3677fa1..0000000 --- a/alarm/node_modules/graphql/validation/rules/custom/NoSchemaIntrospectionCustomRule.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { ASTVisitor } from '../../../language/visitor'; -import { ValidationContext } from '../../ValidationContext'; - -/** - * Prohibit introspection queries - * - * A GraphQL document is only valid if all fields selected are not fields that - * return an introspection type. - * - * Note: This rule is optional and is not part of the Validation section of the - * GraphQL Specification. This rule effectively disables introspection, which - * does not reflect best practices and should only be done if absolutely necessary. - */ -export function NoSchemaIntrospectionCustomRule( - context: ValidationContext, -): ASTVisitor; diff --git a/alarm/node_modules/graphql/validation/rules/custom/NoSchemaIntrospectionCustomRule.js b/alarm/node_modules/graphql/validation/rules/custom/NoSchemaIntrospectionCustomRule.js deleted file mode 100644 index 6861bd4..0000000 --- a/alarm/node_modules/graphql/validation/rules/custom/NoSchemaIntrospectionCustomRule.js +++ /dev/null @@ -1,34 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.NoSchemaIntrospectionCustomRule = NoSchemaIntrospectionCustomRule; - -var _GraphQLError = require("../../../error/GraphQLError.js"); - -var _definition = require("../../../type/definition.js"); - -var _introspection = require("../../../type/introspection.js"); - -/** - * Prohibit introspection queries - * - * A GraphQL document is only valid if all fields selected are not fields that - * return an introspection type. - * - * Note: This rule is optional and is not part of the Validation section of the - * GraphQL Specification. This rule effectively disables introspection, which - * does not reflect best practices and should only be done if absolutely necessary. - */ -function NoSchemaIntrospectionCustomRule(context) { - return { - Field: function Field(node) { - var type = (0, _definition.getNamedType)(context.getType()); - - if (type && (0, _introspection.isIntrospectionType)(type)) { - context.reportError(new _GraphQLError.GraphQLError("GraphQL introspection has been disabled, but the requested query contained the field \"".concat(node.name.value, "\"."), node)); - } - } - }; -} diff --git a/alarm/node_modules/graphql/validation/rules/custom/NoSchemaIntrospectionCustomRule.js.flow b/alarm/node_modules/graphql/validation/rules/custom/NoSchemaIntrospectionCustomRule.js.flow deleted file mode 100644 index 333ba41..0000000 --- a/alarm/node_modules/graphql/validation/rules/custom/NoSchemaIntrospectionCustomRule.js.flow +++ /dev/null @@ -1,38 +0,0 @@ -// @flow strict -import { GraphQLError } from '../../../error/GraphQLError'; - -import type { FieldNode } from '../../../language/ast'; -import type { ASTVisitor } from '../../../language/visitor'; - -import { getNamedType } from '../../../type/definition'; -import { isIntrospectionType } from '../../../type/introspection'; - -import type { ValidationContext } from '../../ValidationContext'; - -/** - * Prohibit introspection queries - * - * A GraphQL document is only valid if all fields selected are not fields that - * return an introspection type. - * - * Note: This rule is optional and is not part of the Validation section of the - * GraphQL Specification. This rule effectively disables introspection, which - * does not reflect best practices and should only be done if absolutely necessary. - */ -export function NoSchemaIntrospectionCustomRule( - context: ValidationContext, -): ASTVisitor { - return { - Field(node: FieldNode) { - const type = getNamedType(context.getType()); - if (type && isIntrospectionType(type)) { - context.reportError( - new GraphQLError( - `GraphQL introspection has been disabled, but the requested query contained the field "${node.name.value}".`, - node, - ), - ); - } - }, - }; -} diff --git a/alarm/node_modules/graphql/validation/rules/custom/NoSchemaIntrospectionCustomRule.mjs b/alarm/node_modules/graphql/validation/rules/custom/NoSchemaIntrospectionCustomRule.mjs deleted file mode 100644 index 26f7d74..0000000 --- a/alarm/node_modules/graphql/validation/rules/custom/NoSchemaIntrospectionCustomRule.mjs +++ /dev/null @@ -1,25 +0,0 @@ -import { GraphQLError } from "../../../error/GraphQLError.mjs"; -import { getNamedType } from "../../../type/definition.mjs"; -import { isIntrospectionType } from "../../../type/introspection.mjs"; - -/** - * Prohibit introspection queries - * - * A GraphQL document is only valid if all fields selected are not fields that - * return an introspection type. - * - * Note: This rule is optional and is not part of the Validation section of the - * GraphQL Specification. This rule effectively disables introspection, which - * does not reflect best practices and should only be done if absolutely necessary. - */ -export function NoSchemaIntrospectionCustomRule(context) { - return { - Field: function Field(node) { - var type = getNamedType(context.getType()); - - if (type && isIntrospectionType(type)) { - context.reportError(new GraphQLError("GraphQL introspection has been disabled, but the requested query contained the field \"".concat(node.name.value, "\"."), node)); - } - } - }; -} |