@nodescript/core
Advanced tools
Comparing version 0.7.0 to 0.7.1
@@ -19,2 +19,3 @@ import * as t from '../types/index.js'; | ||
getRootNode(): Node | null; | ||
setRootNode(nodeId: string | null): void; | ||
/** | ||
@@ -28,4 +29,7 @@ * Uses uri to load node definition & add graph ref if none exists. | ||
* Deletes both the node & its corresponding ref if unused by any other node. | ||
* | ||
* Note: deleting root node is not allowed, it should be unassigned first | ||
* using setRootNode | ||
*/ | ||
deleteNode(nodeId: string): boolean; | ||
deleteNode(nodeId: string): boolean | undefined; | ||
/** | ||
@@ -32,0 +36,0 @@ * Returns an array of the nodes that have no outbound links. |
@@ -39,2 +39,6 @@ import { GraphSchema } from '../schema/index.js'; | ||
} | ||
setRootNode(nodeId) { | ||
const node = nodeId ? this.getNodeById(nodeId) : null; | ||
this.rootNodeId = node ? node.id : ''; | ||
} | ||
/** | ||
@@ -58,4 +62,10 @@ * Uses uri to load node definition & add graph ref if none exists. | ||
* Deletes both the node & its corresponding ref if unused by any other node. | ||
* | ||
* Note: deleting root node is not allowed, it should be unassigned first | ||
* using setRootNode | ||
*/ | ||
deleteNode(nodeId) { | ||
if (this.rootNodeId === nodeId) { | ||
return; | ||
} | ||
this.$nodeMap.delete(nodeId); | ||
@@ -62,0 +72,0 @@ const i = this.nodes.findIndex(_ => _.id === nodeId); |
{ | ||
"name": "@nodescript/core", | ||
"version": "0.7.0", | ||
"version": "0.7.1", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "description": "Visual programming language for Browser and Node", |
Sorry, the diff of this file is not supported yet
122334
367
2194
2