import type { CronJobLogEntry } from "@rebasepro/types"; import type { DataDriver } from "@rebasepro/types"; /** * Persistence layer for cron job execution logs. * * Uses the DataDriver's `admin.executeSql` capability to store logs in a * `rebase.cron_logs` table. Falls back gracefully if the driver doesn't * support SQL (e.g. MongoDB) — in that case, no persistence occurs. */ export interface CronStore { /** Ensure the backing table exists. Called once on startup. */ ensureTable(): Promise; /** Persist a single log entry after execution. */ insertLog(entry: CronJobLogEntry): Promise; /** * Fetch the most recent logs for a job. * @param jobId The job identifier * @param limit Max entries to return (default 50) * @returns Logs sorted newest-first */ fetchLogs(jobId: string, limit?: number): Promise; /** * Fetch aggregate stats for all jobs (totalRuns, totalFailures, lastRunAt). * Used to seed in-memory counters on startup. */ fetchJobStats(): Promise>; } export declare function createCronStore(driver: DataDriver): CronStore | undefined;