import type { OperationOutcome } from '../types.ts'; import type { EngineInternals } from './internals.ts'; import type { CapturedRejectionReason } from './strategy-helpers.ts'; export type ConstraintCallbacks = { cancelWorkflowInStrategy: (workflowId: string) => void; dispatchEvent: (event: Event) => boolean; failWorkflow: (workflowId: string, error: Error) => Promise; feedOperationResult: (workflowId: string, outcome: OperationOutcome, originalError?: CapturedRejectionReason) => void; }; /** * Evaluate all registered constraints for a workflow at the current checkpoint. * * Returns `true` if any constraint was violated and a 'fail' or 'compensate' * reaction was triggered (meaning the operation should not proceed). Returns * `false` if all constraints passed or only 'warn' violations occurred. * * **Note**: Constraints are only evaluated when the inline execution strategy * is active. Worker execution mode cannot reach this code path with * constraints present — `register()` throws at registration time if * constraints are supplied while `inlineStrategy` is `null`, so the * `!context` guard here only fires for benign cases (e.g. the workflow has * already terminated or the context was cleared mid-evaluation). */ export declare function evaluateConstraints(internals: EngineInternals, workflowId: string, callbacks: ConstraintCallbacks): Promise;