import type { FlowNode } from "../types.js"; import type { BuildApi, BuilderMethod, Edge, EmitApi, LoopCtx } from "../declarative.js"; /** Recurse the tree walker into a node's nested bodies (see `walkNodes`). */ export type WalkRecurse = (body: FlowNode[]) => void; /** The three handlers a flow-node kind contributes. `N` is the kind's own * `FlowNode` variant (narrowed from the union by the registry key). */ export interface NodeKindHandlers { /** Factory for the `FlowBuilder` method that appends this kind's node. Given * the per-body {@link BuildApi}, returns the method installed on the builder * as `w.`. Omit for a kind with no authoring method. */ build?: (api: BuildApi) => BuilderMethod; /** The builder method name, when it differs from the kind (defaults to the * kind). */ builderMethod?: string; /** Depth-first recursion into the node's nested bodies. Omit for a leaf. */ walk?: (node: N, recurse: WalkRecurse) => void; /** Emit this node into the BPMN graph, returning the outgoing (dangling) * edges its continuation attaches to. */ emit: (node: N, incoming: Edge[], loop: LoopCtx | null, api: EmitApi) => Edge[]; } /** Register the handlers for one flow-node kind. Called once, at module import * time, from `src/nodes/.ts`. */ export declare function registerNodeKind(kind: K, handlers: NodeKindHandlers>): void; /** The handlers registered for a kind, or `undefined` if none. */ export declare function nodeKind(kind: string): NodeKindHandlers | undefined; /** The registered kind, or a thrown error naming the unknown kind — used by the * emitter, which cannot proceed without a handler. */ export declare function requireNodeKind(kind: string): NodeKindHandlers; /** Every registered kind + its handlers, in registration order. Used by * `makeBuilder` to install each kind's builder method. */ export declare function eachNodeKind(): Iterable<[string, NodeKindHandlers]>;