/** * Execution Recorder - Track job execution results * Uses CSV for summary (fast queries) + JSON for detailed results */ import { JobExecution, ExecutionSummary } from '../../types/scheduler.js'; export declare class ExecutionRecorder { private summaryFile; private resultsDir; private initialized; private static CSV_HEADERS; constructor(); /** * Initialize paths and directories on first use */ private ensureInitialized; /** * Start recording an execution (creates initial record) */ startExecution(execution: Omit): void; /** * Complete an execution with results */ completeExecution(executionId: string, status: 'success' | 'failure' | 'timeout', result?: any, error?: { message: string; code?: number; data?: any; }): void; /** * Append execution summary to CSV */ private appendToCSV; /** * Convert execution to CSV row */ private executionToCSVRow; /** * Escape CSV values (handle commas, quotes, newlines) */ private escapeCSV; /** * Get execution by ID */ getExecution(executionId: string): JobExecution | null; /** * Get all executions for a job */ getExecutionsForJob(jobId: string): ExecutionSummary[]; /** * Query executions from CSV summary */ queryExecutions(filters?: { jobId?: string; status?: string; startDate?: string; endDate?: string; }): ExecutionSummary[]; /** * Parse CSV line into ExecutionSummary */ private parseCSVLine; /** * Clean up old executions (retention policy) */ cleanupOldExecutions(maxAgeDays: number, maxExecutionsPerJob?: number): { deletedCount: number; errors: string[]; }; /** * Rebuild CSV from existing JSON files */ private rebuildCSV; /** * Get execution statistics */ getStatistics(jobId?: string): { total: number; success: number; failure: number; timeout: number; avgDuration: number | null; }; /** * Find and mark stale "running" executions as timed out * Executions stuck in "running" state for longer than maxAgeMinutes are marked as timeout */ cleanupStaleExecutions(maxAgeMinutes?: number): { cleaned: number; executions: string[]; errors: string[]; }; /** * Get all running executions (useful for monitoring) */ getRunningExecutions(): JobExecution[]; } //# sourceMappingURL=execution-recorder.d.ts.map