/** * Shared plan apply module. * * Iterates over plan jobs and their steps, executing `step.run()` for * ready/warn steps and promoting error steps to error results without * execution. Readiness errors gate the entire plan before any mutation, and * jobs fail fast unless they explicitly opt into best-effort execution. * * This module is the stable kernel home for `applyPlan` and the * `OperationHandler` type. Per-extension handlers live in their owning domain * packages and resolve this shared contract from here. * * @experimental This API is unstable and may change without notice. */ import * as Effect from "effect/Effect"; import { type AppError } from "../app-error/index.js"; import type { CompletedJobStep, ExecutedPlan, JobStepResult, Plan } from "./plan.js"; /** * Type for operation handler functions that take an operation and return * an Effect producing a JobStepResult. */ export type OperationHandler = (op: Op) => Effect.Effect; /** * Apply a plan by iterating jobs and executing step run closures. * * Any readiness error gates the complete plan before execution. At runtime, * jobs use ordered fail-fast execution by default. A job may explicitly opt * into best-effort execution for independent siblings; failures still block * all subsequent jobs. * * Never fails — catches AppError and converts to error results. */ /** Identity of a unit whose run closure is starting. */ export interface StartedJobStep { readonly key?: string; readonly label: string; } export interface ApplyPlanOptions { /** Observes each unit as its run closure starts; never controls execution. */ readonly onStepStarted?: (step: StartedJobStep) => Effect.Effect; /** Observes each unit the moment it completes; never controls execution. */ readonly onStepCompleted?: (step: CompletedJobStep) => Effect.Effect; } export declare const applyPlan: (plan: Plan, options?: ApplyPlanOptions) => Effect.Effect, never, Requirements>; //# sourceMappingURL=apply-plan.d.ts.map