@mastra/core
Version:
35 lines • 1.85 kB
TypeScript
/**
* The `${scope.path}` mapping-template DSL used by `.map()` template sources.
*
* Definition-time syntax checks live in {@link validateTemplate}; run-time
* resolution (path lookup + value coercion) lives in {@link resolveTemplate}.
* This module has no knowledge of the step-entry union — it is a pure
* string-DSL interpreter over a step's execute context.
*/
/** Walks a dotted path on an object. `''` or `'.'` returns the root unchanged. */
export declare function traverseMappingPath(root: unknown, path: string, errorLabel: string): unknown;
/**
* Validates a `{ template }` source's syntax at workflow-definition time.
* Throws if any placeholder is empty, whitespace-padded, references an unknown
* namespace, or is a malformed `stepResults.<stepId>` / `stepResults.<stepId>.<path>` shape.
*
* Run-time concerns (does the step actually exist, does the path resolve, is
* the value a primitive) stay in {@link resolveTemplate}.
*/
export declare function validateTemplate(template: string): void;
/**
* Collects the step ids referenced by `${stepResults.<stepId>}` /
* `${stepResults.<stepId>.<path>}` placeholders in a template. Assumes the
* template already passed {@link validateTemplate}; malformed placeholders are
* skipped. Used by validation to scope-check template references against the
* preceding workflow-local steps.
*/
export declare function collectTemplateStepIds(template: string): string[];
/**
* Resolves `${<scope>.<path>}` placeholders against the implicit namespaces
* available in a step's execute context. See the `.map()` overload signature
* for the full list of accepted scopes (`inputData`, `initData`, `state`,
* `requestContext`, `stepResults.<stepId>`).
*/
export declare function resolveTemplate(template: string, ctx: any): string;
//# sourceMappingURL=mapping-template.d.ts.map