graphql-js-tree
Advanced tools
Comparing version 0.2.7 to 0.2.8
@@ -1,2 +0,2 @@ | ||
import { ParserField, ParserTree } from "../Models"; | ||
import { ParserField, ParserTree, Value } from "../Models"; | ||
export declare const mutate: (tree: ParserTree, allNodes: ParserField[]) => { | ||
@@ -11,1 +11,2 @@ updateFieldOnNode: (node: ParserField, i: number, updatedField: ParserField) => void; | ||
}; | ||
export declare const checkValueType: (node: ParserField, nodes: ParserField[]) => Value.Variable | Value.IntValue | Value.FloatValue | Value.StringValue | Value.BooleanValue | Value.EnumValue | Value.ListValue | Value.ObjectValue | Value.IDValue | Value.ScalarValue; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.mutate = void 0; | ||
exports.checkValueType = exports.mutate = void 0; | ||
const Models_1 = require("../Models"); | ||
const shared_1 = require("../shared"); | ||
const directive_1 = require("./directive"); | ||
const interface_1 = require("./interface"); | ||
@@ -42,2 +43,6 @@ const shared_2 = require("./shared"); | ||
(0, shared_2.regenerateId)(updatedField); | ||
if (node.data.type === Models_1.TypeSystemDefinition.DirectiveDefinition) { | ||
const oldField = JSON.parse(JSON.stringify(node.args[i])); | ||
(0, directive_1.recursivelyUpdateDirectiveArgument)(allNodes, node.name, oldField, updatedField, allNodes); | ||
} | ||
if (node.data.type === Models_1.TypeDefinition.InterfaceTypeDefinition) { | ||
@@ -65,2 +70,5 @@ const oldField = JSON.parse(JSON.stringify(node.args[i])); | ||
} | ||
if (node.data.type === Models_1.TypeSystemDefinition.DirectiveDefinition) { | ||
(0, directive_1.recursivelyRenameDirectiveNodes)(allNodes, node.name, newName); | ||
} | ||
if (node.data.type === Models_1.TypeDefinition.InterfaceTypeDefinition) { | ||
@@ -107,2 +115,5 @@ const oldName = node.name; | ||
if (parent) { | ||
if (parent.data.type === Models_1.TypeSystemDefinition.DirectiveDefinition) { | ||
(0, directive_1.recursivelyDeleteDirectiveArgument)(allNodes, parent.name, node); | ||
} | ||
const index = parent.args.indexOf(node); | ||
@@ -130,7 +141,10 @@ deleteFieldFromNode(parent, index); | ||
if (node.data.type === Models_1.Instances.Directive) { | ||
throw new Error('Directives should be removed on node directly not using this function'); | ||
throw new Error('Directive Instances should be removed on node directly not using this function'); | ||
} | ||
if (node.data.type === Models_1.Instances.Argument) { | ||
throw new Error('Directive Arguments should be removed on node directly not using this function'); | ||
throw new Error('Directive Instance Arguments should be removed on node directly not using this function'); | ||
} | ||
if (node.data.type === Models_1.TypeSystemDefinition.DirectiveDefinition) { | ||
(0, directive_1.recursivelyDeleteDirectiveNodes)(allNodes, node.name); | ||
} | ||
const deletedNode = tree.nodes.findIndex((n) => n === node); | ||
@@ -195,3 +209,3 @@ if (deletedNode === -1) | ||
value, | ||
type: checkValueType(node, allNodes), | ||
type: (0, exports.checkValueType)(node, allNodes), | ||
}; | ||
@@ -245,1 +259,2 @@ }; | ||
}; | ||
exports.checkValueType = checkValueType; |
{ | ||
"name": "graphql-js-tree", | ||
"version": "0.2.7", | ||
"version": "0.2.8", | ||
"private": false, | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
97486
64
1968