//#region src/events/buffer.d.ts /** * Event Buffer * * Buffers events during disconnections for replay on reconnect. * Implements overflow handling with configurable strategies. */ interface EventBufferConfig { /** Maximum number of events to buffer (default: 1000) */ maxSize: number; /** Time-to-live in milliseconds for buffered events (default: 300000 = 5min) */ ttlMs: number; /** Strategy when buffer is full: "drop-oldest" or "drop-newest" */ overflowStrategy: "drop-oldest" | "drop-newest"; } interface BufferedEvent { id: string; data: T; timestamp: number; eventType?: string; } declare class EventBuffer { private readonly config; private events; private seenIds; private cleanupTimer?; constructor(config?: Partial); /** Add an event to the buffer (deduplicates by ID) */ push(id: string, data: T, eventType?: string): void; /** Get all buffered events */ getAll(): BufferedEvent[]; /** Get events since a specific event ID */ getSince(lastEventId: string): BufferedEvent[]; /** Get events after a timestamp */ getSinceTimestamp(timestamp: number): BufferedEvent[]; /** Clear all buffered events */ clear(): void; /** Get current buffer size */ size(): number; /** Check if buffer is empty */ isEmpty(): boolean; /** Check if buffer is full */ isFull(): boolean; /** Dispose of the buffer and cleanup resources */ dispose(): void; private pruneExpired; private startCleanup; } //#endregion //#region src/events/channel.d.ts /** * Channel Pub/Sub * * Topic-based event distribution with wildcard pattern matching. * Supports patterns like "message.*", "**", and exact matches. */ type ChannelHandler = (message: T, topic: string) => void; interface ChannelConfig { /** Maximum number of subscribers per topic (default: 100) */ maxSubscribersPerTopic: number; /** Enable wildcard patterns (default: true) */ enableWildcards: boolean; } declare class EventChannel { private readonly config; private readonly subscribers; constructor(config?: Partial); /** * Subscribe to a topic or pattern. * * Patterns: * - "exact.topic" - matches only "exact.topic" * - "prefix.*" - matches "prefix.foo", "prefix.bar", etc. * - "prefix.**" - matches "prefix.foo", "prefix.foo.bar", etc. * - "**" - matches all topics * * Returns an unsubscribe function. */ subscribe(pattern: string, handler: ChannelHandler): () => void; /** * Publish a message to a topic. * Delivers to all matching subscribers. */ publish(topic: string, message: T): number; /** * Check if any subscribers are listening to a topic. */ hasSubscribers(topic: string): boolean; /** * Get the number of subscribers for a topic. */ subscriberCount(topic: string): number; /** * Get all unique patterns being subscribed to. */ getPatterns(): string[]; /** * Clear all subscribers. */ clear(): void; /** * Get total subscriber count. */ size(): number; private matches; private patternToRegex; } //#endregion //#region src/events/deduplication.d.ts /** * Event Deduplication * * LRU-bounded set for tracking seen event IDs. * Prevents duplicate event processing during reconnections. */ interface DeduplicatorConfig { /** Maximum number of event IDs to track (default: 10000) */ maxSize: number; /** Time window in milliseconds for deduplication (default: 60000 = 1min) */ windowMs: number; } declare class EventDeduplicator { private readonly config; private readonly seen; private cleanupTimer?; constructor(config?: Partial); /** * Check if an event has been seen and mark it as seen. * Returns true if this is a duplicate, false if it's new. */ isDuplicate(eventId: string): boolean; /** * Mark an event as seen without checking for duplicates. */ markSeen(eventId: string): void; /** * Check if an event has been seen (without marking). */ hasSeen(eventId: string): boolean; /** * Clear all tracked events. */ clear(): void; /** * Get the number of tracked events. */ size(): number; /** * Dispose of the deduplicator and cleanup resources. */ dispose(): void; private evictOldest; private pruneExpired; private startCleanup; } //#endregion export { EventChannel as a, EventBufferConfig as c, ChannelHandler as i, EventDeduplicator as n, BufferedEvent as o, ChannelConfig as r, EventBuffer as s, DeduplicatorConfig as t }; //# sourceMappingURL=index-CuBvSsBf.d.ts.map