import { SdkSubscriptionErrorContext } from "../shared/subscription-errors.js"; import { DescMessage, MessageShape } from "@bufbuild/protobuf"; //#region src/realtime/types.d.ts interface SubscribeHandlers { onPublication: (data: T) => void; onSubscribed?: () => void; onUnsubscribed?: () => void; /** Observes subscription failures. Missing authentication throws when omitted. */ onError?: (ctx: SdkSubscriptionErrorContext) => void; } interface ConnectChannelParams { channel: string; schema: T; onPublication: (data: MessageShape) => void; onConnected?: () => void; onDisconnected?: () => void; /** Observes subscription failures. Missing authentication throws when omitted. */ onError?: (ctx: SdkSubscriptionErrorContext) => void; } /** * Structural realtime contract consumed by SDK services. The default * implementation is the Centrifuge-backed {@link ../realtime/client.js RealtimeClient}; * alternative implementations (in-memory mocks, custom stacks) can be injected * via the client config's `realtimeClient` field. */ interface PolyesterRealtime { /** Subscribes to a realtime channel and returns an unsubscribe function. */ subscribe(channel: string, handlers: SubscribeHandlers): () => void; /** Connects to a realtime channel with a custom message decoder. */ connectChannel(params: ConnectChannelParams): () => void; /** Connects to a realtime channel that emits protobuf messages. */ connectProtoChannel(params: ConnectChannelParams): () => void; /** Disconnects from all active channels. */ disconnect(): void; /** Disconnects authenticated realtime state without touching public channels. */ disconnectPrivate(): void; readonly isConnected: boolean; readonly activeChannels: number; readonly totalConsumers: number; } //#endregion export { ConnectChannelParams, PolyesterRealtime, SubscribeHandlers }; //# sourceMappingURL=types.d.ts.map