/** * Transport-agnostic publish/subscribe contract backing GraphQL subscriptions. * Payloads flow from `publish(topic, payload)` to every active * `subscribe(topic)` async iterator. */ export interface PubSub { publish(topic: string, payload: T): Promise; subscribe(topic: string): AsyncIterableIterator; /** Optional teardown (e.g. closing Redis connections). */ close?(): Promise; } /** Minimal logger surface so the pub/sub does not hard-depend on the logger package. */ export interface PubSubLogger { warn(message: string, ...meta: unknown[]): void; } /** * A bounded async-iterator queue. Producers `push`; consumers `for await`. When * the queue exceeds `maxSize`, the oldest value is dropped (and a warning is * emitted) so a slow consumer cannot grow memory without bound. */ export declare class BoundedAsyncQueue implements AsyncIterableIterator { private readonly maxSize; private readonly onDrop?; private readonly values; private readonly pending; private done; private onReturn?; constructor(maxSize: number, onDrop?: (() => void) | undefined); push(value: T): void; /** Register a callback to run when the consumer stops iterating. */ setOnReturn(fn: () => void): void; finish(): void; next(): Promise>; return(): Promise>; throw(error?: unknown): Promise>; [Symbol.asyncIterator](): AsyncIterableIterator; } export interface InMemoryPubSubOptions { /** Max buffered messages per subscriber before drop-oldest kicks in. Default 1000. */ maxQueueSize?: number; logger?: PubSubLogger; } /** * Default in-process pub/sub. Fans a published payload out to every local * subscriber's bounded queue. */ export declare class InMemoryPubSub implements PubSub { private readonly topics; private readonly maxQueueSize; private readonly logger?; constructor(options?: InMemoryPubSubOptions); publish(topic: string, payload: T): Promise; subscribe(topic: string): AsyncIterableIterator; } //# sourceMappingURL=pubsub.d.ts.map