import { Observable } from 'rxjs'; type RSocketConnectionStatus = "CONNECTED" | "CONNECTING" | "CLOSED"; type RSocketBuffer = Uint8Array; interface RSocketJsonCodec { encode(data?: unknown): RSocketBuffer; decode(raw: unknown): unknown; } interface RSocketConnectOptions { url: string; jwt?: string; keepAlive?: number; lifetime?: number; dataMimeType?: string; } interface RSocketReconnectOptions extends RSocketConnectOptions { maxRetry?: number; baseDelay?: number; maxDelay?: number; jitter?: number; } interface RSocketPayload { data: Data; metadata?: RSocketBuffer; } interface RSocketSubscription { request(n: number): void; cancel(): void; } interface ReactiveSocketLike { requestStream(payload: RSocketPayload): { subscribe(observer: { onComplete?: () => void; onError?: (err: unknown) => void; onNext?: (payload: RSocketPayload) => void; onSubscribe?: (subscription: RSocketSubscription) => void; }): void; }; requestResponse(payload: RSocketPayload): { subscribe(observer: { onComplete?: (payload: RSocketPayload) => void; onError?: (err: unknown) => void; onSubscribe?: () => void; }): void; }; connectionStatus(): { subscribe(observer: { onNext?: (status: { kind?: string; }) => void; onError?: (err: unknown) => void; onSubscribe?: () => void; onComplete?: () => void; }): void; }; close?: () => void; } interface RSocketApiOptions { connector: RSocketReconnect; jwt?: string; codec?: RSocketJsonCodec; maxRequest?: number; } interface RSocketOperationLike { route?: string; interaction?: string; fireAndForget?: boolean; request?: unknown; response?: unknown; } type RSocketOperationsLike = object; type RSocketRoute = [ Extract ] extends [never] ? string : Extract; type RSocketOperationProperty, TProperty extends string> = TRoute extends keyof Operations ? TProperty extends keyof Operations[TRoute] ? Operations[TRoute][TProperty] : unknown : unknown; type RSocketOperationRequest> = RSocketOperationProperty; type RSocketOperationResponse> = RSocketOperationProperty; type RSocketOperationInteraction> = RSocketOperationProperty extends string ? RSocketOperationProperty : string; type RSocketRoutesByInteraction = string extends RSocketRoute ? string : { [TRoute in RSocketRoute]: RSocketOperationInteraction extends TInteraction ? TRoute : never; }[RSocketRoute]; type RSocketStreamRoute = RSocketRoutesByInteraction; type RSocketMonoRoute = RSocketRoutesByInteraction; type IsUnknown = unknown extends T ? [T] extends [unknown] ? true : false : false; type RSocketRequestArgs> = IsUnknown> extends true ? [data?: unknown] : [RSocketOperationRequest] extends [void | undefined] ? [data?: RSocketOperationRequest] : {} extends RSocketOperationRequest ? [data?: RSocketOperationRequest] : [data: RSocketOperationRequest]; declare const defaultRSocketJsonCodec: RSocketJsonCodec; declare const connectRSocket: (options: RSocketConnectOptions) => Promise>; declare class RSocketReconnect { private readonly options; private rsocket; private status; private retry; private manuallyClosed; private reconnectTimer; private connectingPromise; private readonly maxRetry; private readonly baseDelay; private readonly maxDelay; private readonly jitter; constructor(options: RSocketReconnectOptions); getStatus(): RSocketConnectionStatus; get(): Promise>; private nextDelay; private connect; private handleClose; private scheduleReconnect; close(): void; } declare class RSocketApi { private readonly connector; private readonly jwt?; private readonly codec; private readonly maxRequest; constructor(options: RSocketApiOptions); private meta; private withSocket; stream & RSocketRoute>(route: TRoute, data?: RSocketOperationRequest): Observable>; stream(route: string, data?: unknown): Observable; mono & RSocketRoute>(route: TRoute, data?: RSocketOperationRequest): Observable>; mono(route: string, data?: unknown): Observable; close(): void; } declare function createRSocketApi(url: string, jwt?: string, options?: Omit & Pick): RSocketApi; export { RSocketApi, type RSocketApiOptions, type RSocketBuffer, type RSocketConnectOptions, type RSocketConnectionStatus, type RSocketJsonCodec, type RSocketMonoRoute, type RSocketOperationInteraction, type RSocketOperationLike, type RSocketOperationRequest, type RSocketOperationResponse, type RSocketOperationsLike, type RSocketPayload, RSocketReconnect, type RSocketReconnectOptions, type RSocketRequestArgs, type RSocketRoute, type RSocketRoutesByInteraction, type RSocketStreamRoute, type RSocketSubscription, type ReactiveSocketLike, connectRSocket, createRSocketApi, defaultRSocketJsonCodec };