nodes

nodes.add

add(inputs: NodeInput[]): Promise<NodeData[]>

Add one or more nodes to the graph.

Each input is validated and stored; the resulting NodeData objects (with caller-supplied or locally generated ids) are returned. Recorded in history as "AddNodes". Emits "nodes:added".

inputsNodeInput[]Descriptors for each node to create.

Returns: Promise<NodeData[]>

Example

const [alice] = await api.nodes.add([{ id: "s1", category: "Person", properties: { name: "Alice" } }]);