import { O as OpaqueTransportMessage, E as EncodedTransportMessage } from './message-C2qDAau6.js'; import { C as Codec } from './types-BGGvYIJM.js'; type SessionApiResult = { ok: true; value: T; } | { ok: false; reason: string; }; type SendResult = SessionApiResult; type SendBufferResult = SessionApiResult; type EncodeResult = SessionApiResult; type SerializeResult = SessionApiResult; type DeserializeResult = SessionApiResult; interface CodecMessageAdapterOptions { /** * Validate inbound messages with a compiled schema validator rather than * walking the schema on every message. Roughly three orders of magnitude * faster, and since validation runs per inbound message it otherwise * dominates the receive path. * * Off by default because compiling generates code at runtime, which a strict * Content-Security-Policy blocks. Servers turn it on; clients (which may be * browsers) don't. If compiling fails anyway, this silently falls back. */ precompileValidator?: boolean; } /** * Adapts a {@link Codec} to the {@link OpaqueTransportMessage} format, * accounting for fallibility of toBuffer and fromBuffer and wrapping * it with a Result type. */ declare class CodecMessageAdapter { private readonly codec; private readonly check; constructor(codec: Codec, options?: CodecMessageAdapterOptions); toBuffer(msg: OpaqueTransportMessage): SerializeResult; fromBuffer(buf: Uint8Array): DeserializeResult; } export { CodecMessageAdapter as C, type EncodeResult as E, type SendResult as S, type SendBufferResult as a };