@mastra/core
Version:
34 lines • 1.5 kB
TypeScript
import type { Predicate } from '../../predicate/index.js';
/**
* Workflow target for the shared predicate DSL (`core/src/predicate`).
*
* Predicates for `conditional` / `loop` steps evaluate against the same three
* roots that mapping templates see — `initData`, `inputData`, and
* `stepResults` — plus an optional `state` root for workflows that expose one.
*/
export { predicateSchema, derivePredicateLabel } from '../../predicate/index.js';
export type { Predicate, PathOrLiteral } from '../../predicate/index.js';
/**
* Runtime context a workflow predicate can reference. Exposes the same roots
* that mapping templates and `${...}` placeholders see.
*/
export interface PredicateContext {
initData?: unknown;
inputData?: unknown;
state?: unknown;
/**
* Pre-materialized step-results map. Predicates prefer this when present.
* If absent, `getStepResult` is used to look values up on demand — that
* form matches the shape a workflow condition callback exposes at runtime.
*/
stepResults?: Record<string, unknown>;
getStepResult?: (stepId: string) => unknown;
}
/**
* Evaluate a predicate against a workflow context. Never throws for path
* resolution failures — missing paths propagate to `false` on
* comparison/membership ops, and to `false` / `true` on `exists` /
* `notExists` respectively.
*/
export declare const evaluatePredicate: (pred: Predicate, ctx: PredicateContext) => boolean;
//# sourceMappingURL=index.d.ts.map