/** * Timer Store implementations for workflow timers * * Features: * - In-memory and file-based storage * - Timer persistence across restarts * - Efficient lookup by due time * - Cancellation support * - Fire event callbacks */ import type { TimerEntry, TimerStore } from '@cogitator-ai/types'; /** * Timer query options */ export interface TimerQueryOptions { workflowId?: string; runId?: string; nodeId?: string; status?: 'pending' | 'fired' | 'cancelled'; firesBefore?: number; firesAfter?: number; limit?: number; offset?: number; } type FireCallback = (entry: TimerEntry) => void; /** * In-memory timer store */ export declare class InMemoryTimerStore implements TimerStore { private timers; private fireCallbacks; schedule(entry: Omit): Promise; get(id: string): Promise; cancel(id: string): Promise; getByWorkflow(workflowId: string): Promise; getByRun(runId: string): Promise; getPending(): Promise; getOverdue(): Promise; markFired(id: string): Promise; cleanup(olderThan: number): Promise; onFire(callback: FireCallback): () => void; /** * List timers with filtering */ update(id: string, patch: Partial): Promise; list(filter?: { enabled?: boolean; type?: string; }): Promise; query(options?: TimerQueryOptions): Promise; count(options?: TimerQueryOptions): Promise; clear(): Promise; } /** * File-based timer store for persistence */ export declare class FileTimerStore implements TimerStore { private directory; private indexFile; private initialized; private cache; private fireCallbacks; constructor(directory: string); private ensureInitialized; private persist; schedule(entry: Omit): Promise; get(id: string): Promise; cancel(id: string): Promise; getByWorkflow(workflowId: string): Promise; getByRun(runId: string): Promise; getPending(): Promise; getOverdue(): Promise; markFired(id: string): Promise; cleanup(olderThan: number): Promise; onFire(callback: FireCallback): () => void; update(id: string, patch: Partial): Promise; list(filter?: { enabled?: boolean; type?: string; }): Promise; query(options?: TimerQueryOptions): Promise; count(options?: TimerQueryOptions): Promise; clear(): Promise; } /** * Create an in-memory timer store */ export declare function createInMemoryTimerStore(): InMemoryTimerStore; /** * Create a file-based timer store */ export declare function createFileTimerStore(directory: string): FileTimerStore; export {}; //# sourceMappingURL=timer-store.d.ts.map