/** * CheckpointManager - High-level checkpoint operations. * * Wraps CheckpointStorage with: * - Default TTL handling (7 days) * - Run ID generation * - Convenience methods for status updates */ import type { CheckpointStorage, Checkpoint, CheckpointStatus } from './types'; import type { PipelineContext } from '../context'; import type { PauseMetadata } from '../pause/types'; /** * Options for creating a CheckpointManager. */ export interface CheckpointManagerOptions { /** Underlying storage adapter (Postgres, SQLite, etc.) */ storage: CheckpointStorage; /** Default TTL in milliseconds. Default: 7 days */ defaultTtlMs?: number; } /** * Options for saving a checkpoint. */ export interface SaveCheckpointOptions { /** Unique run identifier */ runId: string; /** Pipeline identifier */ pipelineId: string; /** Step number (0-indexed) */ step: number; /** Checkpoint status */ status: CheckpointStatus; /** Full pipeline context at this step */ context: PipelineContext; /** Optional custom expiration time (overrides default TTL) */ expiresAt?: Date; /** Step name for resilient resume (optional) */ stepName?: string; /** Pause metadata (only set when status is 'paused') */ pauseMetadata?: PauseMetadata; } /** * High-level checkpoint manager. * * Provides a developer-friendly API for checkpoint operations with * sensible defaults for TTL and run ID generation. */ export declare class CheckpointManager { private storage; private defaultTtlMs; /** Default TTL: 7 days in milliseconds */ static readonly DEFAULT_TTL_MS: number; constructor(options: CheckpointManagerOptions); /** * Generate a unique run ID using crypto.randomUUID(). * @returns A UUID string suitable for run identification */ generateRunId(): string; /** * Save a checkpoint with automatic TTL handling. * * @param options - Checkpoint data including runId, pipelineId, step, status, context */ saveCheckpoint(options: SaveCheckpointOptions): Promise; /** * Get the latest checkpoint for a run (highest step number). * * @param runId - The run identifier * @returns The latest checkpoint or null if none exists */ getLatestCheckpoint(runId: string): Promise; /** * Get a specific checkpoint by run ID and step. * * @param runId - The run identifier * @param step - The step number * @returns The checkpoint or null if not found */ getCheckpoint(runId: string, step: number): Promise; /** * Update the status of a checkpoint. * * @param runId - The run identifier * @param step - The step number * @param status - The new status */ updateStatus(runId: string, step: number, status: CheckpointStatus): Promise; /** * Mark a run as completed. * Convenience method for updateStatus with 'completed' status. * * @param runId - The run identifier * @param step - The step number */ markCompleted(runId: string, step: number): Promise; /** * Mark a run as failed. * Convenience method for updateStatus with 'failed' status. * * @param runId - The run identifier * @param step - The step number */ markFailed(runId: string, step: number): Promise; /** * Delete all checkpoints for a run. * Useful for cleanup after successful completion. * * @param runId - The run identifier */ deleteRun(runId: string): Promise; /** * Delete expired checkpoints. * Call this periodically for automatic cleanup. * * @returns The number of deleted checkpoints */ deleteExpired(): Promise; /** * Close the underlying storage connection. * Call this when shutting down to release resources. */ close(): Promise; } //# sourceMappingURL=manager.d.ts.map