Documentation Index
Fetch the complete documentation index at: https://docs.spreadjam.com/llms.txt
Use this file to discover all available pages before exploring further.
Overview
NodeRegistry manages all node definitions. Itβs generic over node type strings for type-safe lookups.
import { NodeRegistry } from '@jam-nodes/core';
const registry = new NodeRegistry();
You can optionally constrain type strings:
const registry = new NodeRegistry<'conditional' | 'end' | 'custom'>();
Methods
register
Register a single node definition. Throws if the type is already registered.
register<TInput, TOutput>(definition: NodeDefinition<TInput, TOutput>): this
registerAll
Register multiple nodes at once.
registerAll(definitions: NodeDefinition[]): this
import { builtInNodes } from '@jam-nodes/nodes';
registry.registerAll(builtInNodes);
unregister
Remove a registered node type. Returns true if it existed.
unregister(type: string): boolean
Check if a type is registered.
has(type: string): boolean
getDefinition
Get the full definition including executor.
getDefinition(type: string): NodeDefinition | undefined
Get client-safe metadata (no executor). Safe to send to the browser.
getMetadata(type: string): NodeMetadata | undefined
getExecutor
Get just the executor function.
getExecutor(type: string): NodeExecutor | undefined
getNodeTypes
Get all registered type identifiers.
getAllDefinitions(): NodeDefinition[]
getAllMetadata(): NodeMetadata[]
Filter definitions or metadata by category.
getByCategory(category: NodeCategory): NodeDefinition[]
getMetadataByCategory(category: NodeCategory): NodeMetadata[]
Validate data against a nodeβs Zod schema. Throws ZodError on failure.
validateInput<TInput>(type: string, input: unknown): TInput
validateOutput<TOutput>(type: string, output: unknown): TOutput
Example
const registry = new NodeRegistry();
registry.registerAll(builtInNodes);
const def = registry.getDefinition('conditional');
const executor = registry.getExecutor('filter');
const logicNodes = registry.getByCategory('logic');
const validated = registry.validateInput('delay', { durationMs: 5000 });
console.log(registry.size); // 16
Factory Function
createRegistry<TNodeType>() creates a new empty NodeRegistry.
import { createRegistry } from '@jam-nodes/core';
const registry = createRegistry();