summaryrefslogtreecommitdiff
path: root/alarm/node_modules/graphql/validation/rules/custom/NoDeprecatedCustomRule.js
diff options
context:
space:
mode:
authorMinteck <contact@minteck.org>2023-01-10 14:54:04 +0100
committerMinteck <contact@minteck.org>2023-01-10 14:54:04 +0100
commit99c1d9af689e5325f3cf535c4007b3aeb8325229 (patch)
treee663b3c2ebdbd67c818ac0c5147f0ce1d2463cda /alarm/node_modules/graphql/validation/rules/custom/NoDeprecatedCustomRule.js
parent9871b03912fc28ad38b4037ebf26a78aa937baba (diff)
downloadpluralconnect-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/custom/NoDeprecatedCustomRule.js')
-rw-r--r--alarm/node_modules/graphql/validation/rules/custom/NoDeprecatedCustomRule.js79
1 files changed, 0 insertions, 79 deletions
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));
- }
- }
- };
-}