/** * SyncHistoryRepository - Tracks sync operation history * * Records each sync run with timing, counts, and status for monitoring. */ import type { Database as DatabaseType } from '../db/database-interface.js'; /** * Sync run status */ export type SyncStatus = 'running' | 'success' | 'failed' | 'partial'; /** * Sync history entry */ export interface SyncHistoryEntry { id: string; startedAt: string; completedAt: string | null; status: SyncStatus; skillsAdded: number; skillsUpdated: number; skillsUnchanged: number; errorMessage: string | null; durationMs: number | null; createdAt: string; } /** * Sync result for completing a run */ export interface SyncRunResult { skillsAdded: number; skillsUpdated: number; skillsUnchanged: number; } /** * Repository for sync history tracking */ export declare class SyncHistoryRepository { private db; private stmts; constructor(db: DatabaseType); /** * Ensure sync_history table exists */ private ensureTable; private prepareStatements; private rowToEntry; /** * Start a new sync run * @returns The sync run ID */ startRun(): string; /** * Complete a sync run successfully */ completeRun(id: string, result: SyncRunResult): void; /** * Mark a sync run as partially complete (some errors) */ completeRunPartial(id: string, result: SyncRunResult, errorMessage: string): void; /** * Mark a sync run as failed */ failRun(id: string, error: string): void; /** * Get a specific sync run by ID */ getById(id: string): SyncHistoryEntry | null; /** * Get sync history (most recent first) */ getHistory(limit?: number): SyncHistoryEntry[]; /** * Get the last successful sync run */ getLastSuccessful(): SyncHistoryEntry | null; /** * Get any currently running sync operations */ getRunning(): SyncHistoryEntry[]; /** * Check if a sync is currently running */ isRunning(): boolean; /** * Clean up old history entries * @param daysToKeep Number of days of history to retain */ cleanup(daysToKeep?: number): number; /** * Get total count of history entries */ count(): number; /** * Get sync statistics */ getStats(): { totalRuns: number; successfulRuns: number; failedRuns: number; lastSuccessAt: string | null; averageDurationMs: number | null; }; } //# sourceMappingURL=SyncHistoryRepository.d.ts.map