import { C as Connection, T as Transport, m as ClientTransportOptions, L as LeakyBucketRateLimit, n as ClientHandshakeOptions, o as ClientSession, P as ProvidedClientTransportOptions, i as SessionNoConnection, S as Session, D as DeleteSessionOptions, g as SessionConnecting, h as SessionHandshaking, f as SessionConnected, p as SessionBackingOff } from './transport-DF2T202E.js'; import { C as CustomHandshakeErrorCodeSchema, H as HandshakeErrorCode, e as ControlMessageHandshakeResponseSchema, f as ControlMessageHandshakeResponseSchemaWithCodes, T as TransportClientId, O as OpaqueTransportMessage } from './message-C2qDAau6.js'; import { TSchema } from 'typebox'; declare abstract class ClientTransport extends Transport> { /** * The options for this transport. */ protected options: ClientTransportOptions; retryBudget: LeakyBucketRateLimit; /** * A flag indicating whether the transport should automatically reconnect * when a connection is dropped. * Realistically, this should always be true for clients unless you are writing * tests or a special case where you don't want to reconnect. */ reconnectOnConnectionDrop: boolean; /** * Optional handshake options for this client. */ handshakeExtensions?: ClientHandshakeOptions; /** * Handshake response schema extended with the custom * rejection codes, when any are registered. */ protected handshakeResponseSchema: typeof ControlMessageHandshakeResponseSchema | ReturnType; /** * Handshake-metadata constructions prefetched when a connection attempt begins * (only when {@link ClientHandshakeOptions.eager} is set), so the * token fetch overlaps the dial instead of following it. Keyed by the peer being * connected to; consumed when the handshake is sent and cleared when an attempt * is abandoned. */ private pendingHandshakeMetadata; sessions: Map>; constructor(clientId: TransportClientId, providedOptions?: ProvidedClientTransportOptions); extendHandshake: (options: ClientHandshakeOptions) => void; protected handleRehandshakeMessage(message: OpaqueTransportMessage): void; /** * Re-constructs handshake metadata via the configured handshake extension and * sends it back to the server so it can replace the metadata for this session. * Triggered by a server {@link ControlMessageRehandshakeRequestSchema}. */ private sendRehandshake; /** * Abstract method that creates a new {@link Connection} object. * * @param to The client ID of the node to connect to. * @returns The new connection object. */ protected abstract createNewOutgoingConnection(to: TransportClientId): Promise; private tryReconnecting; createUnconnectedSession(to: string): SessionNoConnection; protected deleteSession(session: Session, options?: DeleteSessionOptions): void; protected onConnectingFailed(session: SessionConnecting, error?: unknown): SessionNoConnection; protected onConnClosed(session: SessionHandshaking | SessionConnected): SessionNoConnection; protected onConnectionEstablished(session: SessionConnecting, conn: ConnType): SessionHandshaking; private rejectHandshakeResponse; protected onHandshakeResponse(session: SessionHandshaking, msg: OpaqueTransportMessage): void; /** * Manually attempts to connect to a client. * @param to The client ID of the node to connect to. */ connect(to: TransportClientId): void; /** * Manually kills all sessions to the server (including all pending state). * This is useful for when you want to close all connections to a server * and don't want to wait for the grace period to elapse. */ hardDisconnect(): void; protected onBackoffFinished(session: SessionBackingOff): void; /** * Constructs handshake metadata via the configured handshake extension, capturing * a failure as a value so a prefetched result can be awaited without rejecting. */ private constructHandshakeMetadata; private sendHandshake; close(): void; } export { ClientTransport as C };