/** * @name premium/event-store * @description In-memory event store for premium event replay and idempotency. * * Every event delivered through the stream broker or webhook engine is recorded * here. The store supports: * - append with `eventId` deduplication (idempotency) * - query by session, event type, or time window * - automatic eviction of events past their replay window * * @flow * 1. `stream-broker.ts` / `webhook-engine.ts` deliver an event → * `appendEvent()` stores it (dedup by `eventId`). * 2. `stream-broker.ts` reconnects a client → `getEvents()` replays past * events within the replay window. * 3. Pruning runs on every append/query to evict events past their * `replayWindowSeconds` per capability. * * @module premium/event-store */ import type { PremiumEventQuery, PremiumEventRecord } from './types.js'; /** * @name appendEvent * @description Append a premium event to the store with idempotency. * * If an event with the same `eventId` already exists, it is not duplicated. * The store is pruned after each append. * * @param record - The event record to append. * @returns True if the event was newly inserted, false if it was a duplicate. * * @usedBy `stream-broker.ts`, `webhook-engine.ts` */ export declare function appendEvent(record: PremiumEventRecord): boolean; /** * @name getEvents * @description Query events from the store with optional filters. * * @param query - Filter criteria (sessionId, eventType, since, limit). * @returns Array of matching event records, ordered by `deliveredAt` ascending. * * @usedBy `stream-broker.ts` (replay), `premium-tools.ts` (audit) */ export declare function getEvents(query?: PremiumEventQuery): PremiumEventRecord[]; /** * @name getEventCount * @description Return the total number of stored events. * * @usedBy `metrics.ts` */ export declare function getEventCount(): number; /** * @name clearAllEvents * @description Clear all events from the store. * * Used in tests and during graceful server shutdown. * * @internal */ export declare function clearAllEvents(): void; //# sourceMappingURL=event-store.d.ts.map