UNPKG

@flowlab/event

Version:

FlowLab event-driven system

35 lines (34 loc) 1.28 kB
import { NodeFunction, NodeMetadata, NodeRegistryEntry } from '../types'; /** * 节点注册中心(全局单例) * 负责注册与查找系统中所有可用的节点函数 */ export declare class NodeRegistry { /** 已注册节点的内部映射表(节点名称 → 节点实现与元信息) */ private static _nodes; /** * 注册一个新的节点函数 */ static register<Input = any, Output = any, Context = any>(name: string, fn: NodeFunction<Input, Output, Context>, description?: string): NodeRegistryEntry<Input, Output, Context>; static register<Input = any, Output = any, Context = any>(metadata: NodeMetadata, fn: NodeFunction<Input, Output, Context>): NodeRegistryEntry<Input, Output, Context>; /** * 获取指定名称的节点函数 */ static getNodeFunction(name: string): NodeFunction | undefined; /** * 获取指定名称的节点元数据 */ static getNodeMetadata(name: string): NodeMetadata | undefined; /** * 获取所有已注册的节点条目 */ static getAllNodes(): NodeRegistryEntry<any, any, any>[]; /** * 检查节点是否已存在 */ static exists(name: string): boolean; /** * 内部验证 */ private static _validate; }