graphql-js-tree
Advanced tools
Comparing version 3.0.0 to 3.0.1
import { ParserField, ParserTree, Value } from "../Models"; | ||
export declare const mutate: (tree: ParserTree, allNodes: ParserField[]) => { | ||
updateFieldOnNode: (node: ParserField, i: number, updatedField: ParserField, parentNode?: string) => void; | ||
addFieldToNode: (node: ParserField, f: ParserField) => void; | ||
addFieldToNode: (node: ParserField, f: ParserField, parentNode?: string) => void; | ||
renameRootNode: (node: ParserField, newName: string) => void; | ||
removeNode: (node: ParserField) => void; | ||
removeNode: (node: ParserField, parentNode?: string) => void; | ||
implementInterface: (node: ParserField, interfaceNode: ParserField) => void; | ||
@@ -8,0 +8,0 @@ deImplementInterface: (node: ParserField, interfaceName: string) => void; |
@@ -22,3 +22,3 @@ "use strict"; | ||
}; | ||
const deleteFieldFromNode = (n, i) => { | ||
const deleteFieldFromNode = (n, i, parentNode) => { | ||
if (n.data.type === Models_1.TypeDefinition.InterfaceTypeDefinition) { | ||
@@ -42,3 +42,3 @@ const argName = n.args[i].name; | ||
(0, shared_2.regenerateId)(n); | ||
mutateParentIfField(n); | ||
mutateParentIfField(n, parentNode); | ||
}; | ||
@@ -59,3 +59,3 @@ const updateFieldOnNode = (node, i, updatedField, parentNode) => { | ||
}; | ||
const addFieldToNode = (node, f) => { | ||
const addFieldToNode = (node, f, parentNode) => { | ||
var _a; | ||
@@ -67,3 +67,3 @@ (_a = node.args) === null || _a === void 0 ? void 0 : _a.push(Object.assign({}, f)); | ||
(0, shared_2.regenerateId)(node); | ||
mutateParentIfField(node); | ||
mutateParentIfField(node, parentNode); | ||
}; | ||
@@ -99,3 +99,3 @@ const renameRootNode = (node, newName) => { | ||
}; | ||
const removeNode = (node) => { | ||
const removeNode = (node, parentNode) => { | ||
if (node.data.type === Models_1.TypeSystemDefinition.FieldDefinition) { | ||
@@ -105,3 +105,3 @@ const parent = allNodes.find((parentNode) => parentNode.args.includes(node)); | ||
const index = parent.args.indexOf(node); | ||
deleteFieldFromNode(parent, index); | ||
deleteFieldFromNode(parent, index, parentNode); | ||
} | ||
@@ -114,3 +114,3 @@ return; | ||
const index = parent.args.indexOf(node); | ||
deleteFieldFromNode(parent, index); | ||
deleteFieldFromNode(parent, index, parentNode); | ||
} | ||
@@ -126,3 +126,3 @@ return; | ||
const index = parent.args.indexOf(node); | ||
deleteFieldFromNode(parent, index); | ||
deleteFieldFromNode(parent, index, parentNode); | ||
} | ||
@@ -134,3 +134,3 @@ else { | ||
const fieldIndex = field.args.findIndex((f) => f === node); | ||
deleteFieldFromNode(field, fieldIndex); | ||
deleteFieldFromNode(field, fieldIndex, parentNode); | ||
} | ||
@@ -144,3 +144,3 @@ } | ||
const index = parent.args.indexOf(node); | ||
deleteFieldFromNode(parent, index); | ||
deleteFieldFromNode(parent, index, parentNode); | ||
} | ||
@@ -147,0 +147,0 @@ return; |
{ | ||
"name": "graphql-js-tree", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"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
131743