import type { OperationId } from "@awp/contracts";
import type { Clock } from "./ports/runtime.js";
import { type ApplicationTransaction, type UnitOfWork } from "./ports/repositories.js";
export interface WorkflowStepIdentity {
    readonly operationId: OperationId;
    readonly stepName: string;
    readonly stepKey: string;
}
export interface WorkflowStepExecution<T> {
    readonly outcome: T;
    readonly replayed: boolean;
}
export interface WorkflowStepCommit {
    readonly identity: WorkflowStepIdentity;
    readonly outcome: unknown;
    readonly recordedAt: string;
}
export type WorkflowStepAfterCommit = (commit: WorkflowStepCommit) => Promise<void> | void;
export declare class WorkflowStepTransactionRunner {
    private readonly uow;
    private readonly clock;
    private readonly afterCommit?;
    constructor(uow: UnitOfWork, clock: Clock, afterCommit?: WorkflowStepAfterCommit | undefined);
    run<T>(identity: WorkflowStepIdentity, work: (tx: ApplicationTransaction) => Promise<T>): Promise<WorkflowStepExecution<T>>;
}
export interface DurableWorkflowStepRunner {
    run<T>(stepName: string, stepKey: string, work: () => Promise<T>): Promise<T>;
    afterDomainCommit?(identity: WorkflowStepIdentity): Promise<void> | void;
}
export declare const immediateWorkflowStepRunner: DurableWorkflowStepRunner;
export declare function runMarkedWorkflowTransaction<T>(workflowSteps: DurableWorkflowStepRunner, transactions: WorkflowStepTransactionRunner, identity: WorkflowStepIdentity, work: (tx: ApplicationTransaction) => Promise<T>): Promise<T>;
//# sourceMappingURL=durable-step.d.ts.map