import { type HeaderValueRaw, type HeaderValueString, type HeaderValueBool, type HeaderValueInt8, type HeaderValueInt16, type HeaderValueInt32, type HeaderValueInt64, type HeaderValueInt128, type HeaderValueUint8, type HeaderValueUint16, type HeaderValueUint32, type HeaderValueUint64, type HeaderValueUint128, type HeaderValueFloat, type HeaderValueDouble, type HeaderKindId, type HeaderKey, type HeaderKeyRaw, type HeaderKeyString, type HeaderKeyInt32 } from "./header.type.js"; /** * Union type of all possible header value types. */ export type HeaderValue = HeaderValueRaw | HeaderValueString | HeaderValueBool | HeaderValueInt8 | HeaderValueInt16 | HeaderValueInt32 | HeaderValueInt64 | HeaderValueInt128 | HeaderValueUint8 | HeaderValueUint16 | HeaderValueUint32 | HeaderValueUint64 | HeaderValueUint128 | HeaderValueFloat | HeaderValueDouble; /** Header entry with key and value */ export type HeaderEntry = { key: HeaderKey; value: HeaderValue; }; /** Array of header entries */ export type Headers = HeaderEntry[]; /** * Internal representation of a header value in binary format. */ type BinaryHeaderValue = { /** Header kind identifier */ kind: number; /** Serialized value as Buffer */ value: Buffer; }; /** * Serializes a header value to a Buffer based on its kind. * * @param header - Header value to serialize * @returns Serialized value as Buffer */ export declare const serializeHeaderValue: (header: HeaderValue) => Buffer; /** * Serializes a header key to a Buffer based on its kind. * * @param key - Header key to serialize * @returns Serialized key as Buffer */ export declare const serializeHeaderKey: (key: HeaderKey) => Buffer; /** * Serializes a single header key-value pair to wire format. * Format: [key_kind][key_length][key][value_kind][value_length][value] * * @param key - Header key * @param v - Binary header value * @returns Serialized header as Buffer */ export declare const serializeHeader: (key: HeaderKey, v: BinaryHeaderValue) => Buffer; /** Empty headers buffer constant */ export declare const EMPTY_HEADERS: Buffer; /** * Serializes all headers to a single buffer. * * @param headers - Optional headers array * @returns Serialized headers buffer (empty if no headers) */ export declare const serializeHeaders: (headers?: Headers) => Buffer; /** Possible JavaScript types for deserialized header values */ export type ParsedHeaderValue = boolean | string | number | bigint | Buffer; /** Deserialized header key with kind and value */ export type ParsedHeaderKey = { kind: number; value: ParsedHeaderValue; }; /** Deserialized header value with kind and value */ export type ParsedHeaderVal = { kind: number; value: ParsedHeaderValue; }; /** Deserialized header entry */ export type ParsedHeaderEntry = { key: ParsedHeaderKey; value: ParsedHeaderVal; }; /** * Result of deserializing a single header. */ type ParsedHeaderDeserialized = { /** Number of bytes consumed */ bytesRead: number; /** Deserialized header entry */ data: ParsedHeaderEntry; }; /** * Maps a numeric header kind to its string identifier. * * @param k - Numeric header kind value * @returns Header kind identifier string * @throws Error if the header kind is unknown */ export declare const mapHeaderKind: (k: number) => HeaderKindId; /** * Deserializes a header value buffer based on its kind. * * @param kind - Numeric header kind * @param value - Raw value buffer * @returns Deserialized value * @throws Error if the header kind is invalid */ export declare const deserializeHeaderValue: (kind: number, value: Buffer) => ParsedHeaderValue; /** * Deserializes a single header from a buffer. * Format: [key_kind][key_length][key][value_kind][value_length][value] * * @param p - Buffer containing serialized headers * @param pos - Starting position in the buffer * @returns Object with bytes read and deserialized header data * @throws Error if header key or value length is invalid (must be 1-255) */ export declare const deserializeHeader: (p: Buffer, pos?: number) => ParsedHeaderDeserialized; /** * Deserializes all headers from a buffer. * * @param p - Buffer containing serialized headers * @param pos - Starting position in the buffer * @returns Array of parsed header entries */ export declare const deserializeHeaders: (p: Buffer, pos?: number) => ParsedHeaderEntry[]; /** * HeaderValue factory object with constructors for all header types. */ export declare const HeaderValue: { Raw: (value: Buffer) => HeaderValueRaw; String: (value: string) => HeaderValueString; Bool: (value: boolean) => HeaderValueBool; Int8: (value: number) => HeaderValueInt8; Int16: (value: number) => HeaderValueInt16; Int32: (value: number) => HeaderValueInt32; Int64: (value: bigint) => HeaderValueInt64; Int128: (value: Buffer) => HeaderValueInt128; Uint8: (value: number) => HeaderValueUint8; Uint16: (value: number) => HeaderValueUint16; Uint32: (value: number) => HeaderValueUint32; Uint64: (value: bigint) => HeaderValueUint64; Uint128: (value: Buffer) => HeaderValueUint128; Float: (value: number) => HeaderValueFloat; Double: (value: number) => HeaderValueDouble; getKind: (h: HeaderValue) => "Raw" | "String" | "Bool" | "Int8" | "Int16" | "Int32" | "Int64" | "Int128" | "Uint8" | "Uint16" | "Uint32" | "Uint64" | "Uint128" | "Float" | "Double"; getValue: (h: HeaderValue) => string | number | bigint | boolean | Buffer; }; export declare const HeaderKeyFactory: { Raw: (value: Buffer) => HeaderKeyRaw; String: (value: string) => HeaderKeyString; Int32: (value: number) => HeaderKeyInt32; }; export {}; //# sourceMappingURL=header.utils.d.ts.map