MCPcopy Create free account
hub / github.com/ForestHubAI/edge-agents / canAddNode

Function canAddNode

ts/workflow-builder/src/utils/graphOperations.ts:93–100  ·  view source on GitHub ↗
(store: CanvasStore, nodeDef: NodeDefinition)

Source from the content-addressed store, hash-verified

91
92/** Check if a node definition can be added to the store (respects isUnremovable and isSingleton). */
93export function canAddNode(store: CanvasStore, nodeDef: NodeDefinition): boolean {
94 if (nodeDef.isUnremovable) return false;
95 if (nodeDef.isSingleton) {
96 const { nodes } = store.getState();
97 if (nodes.some((n) => n.data.type === nodeDef.type)) return false;
98 }
99 return true;
100}
101
102/** Add a node to the store given a node definition and optional position. Returns the new node ID, or null if the node cannot be added. */
103export function addNodeToStore(store: CanvasStore, nodeDef: NodeDefinition, position?: { x: number; y: number }): string | null {

Callers 2

addNodeToStoreFunction · 0.85
pasteToStoreFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected