import type { Pool } from 'pg'; export type EventRow = { event_id: number; uuid: string; name: string; data: unknown; status: string; created_at: string; started_at: string | null; completed_at: string | null; }; /** * Wraps all PostgreSQL interactions for the event queue. * Accepts a pg Pool so it can be replaced with a mock in tests. */ export declare class EventStorage { private pool; constructor(pool: Pool); /** * Atomically claims up to `batchSize` pending events using a single CTE * query — no BEGIN/COMMIT/ROLLBACK needed, eliminating the pg multi-query * deprecation warning entirely. */ claimBatch(batchSize: number): Promise; /** * Marks an event as successfully completed and removes it from the table. * Updates status first so a failed DELETE doesn't leave the event as pending. */ markDoneAndDelete(uuid: string): Promise; /** * At startup: mark any events that were stuck as 'processing' during a * prior crash as 'failed'. At-most-once delivery — subscribers are never * called twice. Returns the number of events marked failed. */ markStuckAsFailed(): Promise; }