declare const TransmitStatus: { readonly Initializing: "initializing"; readonly Connecting: "connecting"; readonly Connected: "connected"; readonly Disconnected: "disconnected"; readonly Reconnecting: "reconnecting"; }; type TransmitStatus = (typeof TransmitStatus)[keyof typeof TransmitStatus]; declare const HookEvent: { readonly BeforeSubscribe: "beforeSubscribe"; readonly BeforeUnsubscribe: "beforeUnsubscribe"; readonly OnReconnectAttempt: "onReconnectAttempt"; readonly OnReconnectFailed: "onReconnectFailed"; readonly OnSubscribeFailed: "onSubscribeFailed"; readonly OnSubscription: "onSubscription"; readonly OnUnsubscription: "onUnsubscription"; }; type HookEvent = (typeof HookEvent)[keyof typeof HookEvent]; declare class Hook { #private; register(event: HookEvent, handler: (...args: any[]) => void): this; beforeSubscribe(request: Request): this; beforeUnsubscribe(request: Request): this; onReconnectAttempt(attempt: number): this; onReconnectFailed(): this; onSubscribeFailed(response: Response): this; onSubscription(channel: string): this; onUnsubscription(channel: string): this; } interface HttpClientOptions { baseUrl: string; uid: string; } declare class HttpClient { #private; constructor(options: HttpClientOptions); send(request: Request): Promise; createRequest(path: string, body: Record): Request; } interface SubscriptionOptions { channel: string; httpClient: HttpClient; getEventSourceStatus: () => TransmitStatus; hooks?: Hook; onDelete?: () => void; } declare class Subscription { #private; /** * Returns if the subscription is created or not. */ get isCreated(): boolean; /** * Returns if the subscription is deleted or not. */ get isDeleted(): boolean; /** * Returns the number of registered handlers. */ get handlerCount(): number; constructor(options: SubscriptionOptions); /** * Run all registered handlers for the subscription. */ $runHandler(message: unknown): void; create(): Promise; forceCreate(): Promise; delete(): Promise; onMessage(handler: (message: T) => void): () => void; onMessageOnce(handler: (message: T) => void): void; } interface TransmitOptions { baseUrl: string; uidGenerator?: () => string; eventSourceFactory?: (url: string | URL, options: { withCredentials: boolean; }) => EventSource; eventTargetFactory?: () => EventTarget | null; httpClientFactory?: (baseUrl: string, uid: string) => HttpClient; beforeSubscribe?: (request: Request) => void; beforeUnsubscribe?: (request: Request) => void; maxReconnectAttempts?: number; onReconnectAttempt?: (attempt: number) => void; onReconnectFailed?: () => void; onSubscribeFailed?: (response: Response) => void; onSubscription?: (channel: string) => void; onUnsubscription?: (channel: string) => void; } declare class Transmit { #private; /** * Returns the unique identifier of the client. */ get uid(): string; constructor(options: TransmitOptions); subscription(channel: string): Subscription; on(event: Exclude, callback: (event: CustomEvent) => void): void; off(event: Exclude, callback: (event: CustomEvent) => void): void; close(): void; } export { Subscription, Transmit };