@mastra/core
Version:
33 lines • 1.94 kB
TypeScript
/**
* Shared typed walker over a serialized workflow graph. Every consumer that
* needs "all the leaf entries in this graph" (schema validation, reference
* validation, nested-workflow dependency collection) goes through this one
* function, so recursion into container entries lives in exactly one place
* and is exhaustiveness-checked against `SerializedStepFlowEntry`.
*/
import type { SerializedSingleStepEntry, SerializedStepFlowEntry } from '../types.js';
import type { ValidatableStepFlowEntry } from './validate/types.js';
/**
* Invoke `visit` for every single-step (leaf) entry in the graph, recursing
* into `parallel`/`conditional` children and `loop`/`foreach` bodies.
*
* Does NOT recurse into a nested workflow's inlined `serializedStepFlow` —
* a nested workflow's own graph is validated when that workflow is added.
* `sleep`/`sleepUntil` entries carry no references or schemas and are skipped.
*/
export declare function forEachSingleStepEntry(entries: readonly SerializedStepFlowEntry[], visit: (entry: SerializedSingleStepEntry) => void): void;
/**
* Collect the ids of every nested workflow referenced by a stored graph.
* Used by boot-time loading to hydrate stored definitions in dependency order.
*/
export declare function collectNestedWorkflowIds(graph: readonly SerializedStepFlowEntry[]): Set<string>;
/**
* Same traversal as {@link forEachSingleStepEntry} but reports each leaf's
* position as a dotted path (`graph.2`, `graph.2.steps.0`, `graph.2.step`) —
* the path contract shared by validation issues and the Studio draft UI.
*
* Accepts the wider {@link ValidatableStepFlowEntry} union so both persisted
* graphs and wire-shaped authoring submissions can be walked.
*/
export declare function forEachSingleStepEntryWithPath(entries: readonly ValidatableStepFlowEntry[], visit: (entry: SerializedSingleStepEntry, path: string) => void): void;
//# sourceMappingURL=graph.d.ts.map