UNPKG

theater-client

Version:

TypeScript client library for Theater actor system TCP protocol

44 lines 1.42 kB
/** * Serialization utilities for Theater protocol */ import type { FrameMessage } from '../types/protocol.js'; /** * Convert Uint8Array to number array for protocol compatibility */ export declare function uint8ArrayToNumbers(data: Uint8Array): number[]; /** * Convert number array from protocol to Uint8Array */ export declare function numbersToUint8Array(data: number[]): Uint8Array; /** * Encode string to Uint8Array */ export declare function encodeString(text: string): Uint8Array; /** * Decode Uint8Array to string */ export declare function decodeString(data: Uint8Array): string; /** * Encode object to JSON bytes */ export declare function encodeJson(obj: any): Uint8Array; /** * Decode JSON bytes to object */ export declare function decodeJson<T = any>(data: Uint8Array): T; /** * Create a FragmentingCodec frame for sending data * Always creates Complete frames for outgoing messages (server handles fragmentation) */ export declare function createFrame(data: Uint8Array): FrameMessage; /** * Parse a FragmentingCodec frame * Note: Fragment handling is now done in TheaterConnection.handleFragment() */ export declare function parseFrame(frame: FrameMessage): Uint8Array; /** * Serialize a message for sending over TCP * Includes length prefix as required by Theater protocol */ export declare function serializeMessage(data: any): Buffer; //# sourceMappingURL=serialization.d.ts.map