/** * Schedule recovery module * * Recovers enabled schedules from the database on server startup * and registers them with the scheduler. */ import { CronScheduler } from './cron-scheduler.js'; import { ScheduleStore } from './schedule-store.js'; /** * Recovery result information */ export interface RecoveryResult { /** Number of schedules recovered */ recovered: number; /** Number of schedules that failed to recover */ failed: number; /** Details of recovered schedules */ schedules: Array<{ id: string; name: string; cronExpr: string; success: boolean; error?: string; }>; } /** * Recovery options */ export interface RecoveryOptions { /** Whether to log recovery progress */ verbose?: boolean; /** Logger function (defaults to console.log) */ logger?: (message: string) => void; } /** * Recover enabled schedules from the database and register with scheduler * * @param scheduler - The CronScheduler instance * @param store - The ScheduleStore instance * @param options - Recovery options * @returns Recovery result with details */ export declare function recoverSchedules(scheduler: CronScheduler, store: ScheduleStore, options?: RecoveryOptions): RecoveryResult; /** * Sync scheduler state with database * * Updates next_run times in the database based on scheduler state. * Call this after recovery to ensure database reflects current scheduler state. * * @param scheduler - The CronScheduler instance * @param store - The ScheduleStore instance */ export declare function syncSchedulerState(scheduler: CronScheduler, store: ScheduleStore): void; /** * Create a schedule store event handler that persists changes to database * * @param store - The ScheduleStore instance * @returns Event handler function for scheduler events */ export declare function createPersistenceHandler(store: ScheduleStore): { /** * Handle job started event */ onJobStarted(jobId: string): string; /** * Handle job completed event */ onJobCompleted(logId: string, success: boolean, output?: string, error?: string): void; /** * Handle job state change (enabled/disabled) */ onJobStateChanged(jobId: string, enabled: boolean): void; /** * Handle next run time update */ onNextRunUpdated(jobId: string, nextRun: Date | undefined): void; }; //# sourceMappingURL=recovery.d.ts.map