import type { NewMessage } from './core/types.js'; type SupabaseRealtimePayload = Record; type SupabaseRealtimeChannel = { on: (type: 'postgres_changes', filter: Record, callback: (payload: SupabaseRealtimePayload) => void) => SupabaseRealtimeChannel; subscribe: (callback?: (status: string, error?: unknown) => void) => SupabaseRealtimeChannel; unsubscribe?: () => Promise | unknown; }; type SupabaseClientLike = { channel: (name: string) => SupabaseRealtimeChannel; from?: (table: string) => SupabaseQueryBuilder; schema?: (schema: string) => { from: (table: string) => SupabaseQueryBuilder; }; removeChannel?: (channel: SupabaseRealtimeChannel) => Promise | unknown; }; type SupabaseQueryBuilder = { select: (columns: string) => SupabaseQueryBuilder; eq?: (column: string, value: unknown) => SupabaseQueryBuilder; limit: (count: number) => PromiseLike<{ data?: unknown[] | null; error?: unknown; }> | Promise<{ data?: unknown[] | null; error?: unknown; }>; }; export interface AutomationEventListenerDependencies { enqueueMessage: (chatJid: string, msg: NewMessage) => void; createSupabaseClient?: (url: string, key: string) => SupabaseClientLike; reconcileIntervalMs?: number; now?: () => string; } /** * Serialize claim/dispatch for one automation while preserving concurrency * between different automations. */ export declare function withAutomationDispatchLock(automationId: string, operation: () => Promise): Promise; type AutomationEventPayload = Record; export declare function triggerEventAutomation(automationId: string, payload: AutomationEventPayload, deps: AutomationEventListenerDependencies): Promise; export declare function triggerAutomationEventNow(automationId: string, payload?: SupabaseRealtimePayload): Promise; export declare function enqueueAutomationMessage(chatJid: string, message: NewMessage): boolean; export declare function drainPendingAutomationEvent(automationId: string): Promise; export declare function drainPendingAutomationEvents(automationId: string): Promise; export declare function startAutomationEventListener(deps: AutomationEventListenerDependencies): void; export declare function forceAutomationEventListenerCheck(): void; export declare function stopAutomationEventListener(): Promise; export declare function _resetAutomationEventListenerForTests(): Promise; export {}; //# sourceMappingURL=automation-event-listener.d.ts.map