/** * Thrift Compact Protocol writer. * * Parquet stores its page headers and its whole footer (`FileMetaData`) in this * encoding, so we need exactly the write side of it: unsigned LEB128 varints, * zigzag for signed integers, field headers carrying the delta to the previous * field id, and inline list headers. Small and fully specified — but a single * wrong byte makes the file unreadable, so it lives in its own module with * byte-exact tests. * Spec: docs/specs/2026-07-19-typed-output-and-parquet-writer.md §6. */ /** Thrift Compact type ids (booleans carry their value in the field header). */ export declare const CompactType: { readonly BOOLEAN_TRUE: 1; readonly BOOLEAN_FALSE: 2; readonly BYTE: 3; readonly I16: 4; readonly I32: 5; readonly I64: 6; readonly DOUBLE: 7; readonly BINARY: 8; readonly LIST: 9; readonly SET: 10; readonly MAP: 11; readonly STRUCT: 12; }; export type CompactType = (typeof CompactType)[keyof typeof CompactType]; /** Unsigned LEB128: 7 bits per byte, high bit marks "more bytes follow". */ export declare function encodeVarint(value: number | bigint): Uint8Array; /** Map a signed 32-bit value onto an unsigned one so small magnitudes stay short. */ export declare function zigzag32(value: number): number; /** 64-bit zigzag. */ export declare function zigzag64(value: bigint): bigint; export declare class CompactWriter { private readonly out; /** Field ids are written as a delta from the previous field of this struct. */ private lastFieldId; private readonly stack; bytes(): Uint8Array; /** Current byte length — used to fill in page/footer offsets. */ get length(): number; private raw; private rawBytes; structBegin(): void; structEnd(): void; /** Write a field header. Short form when the id delta is 1..15, else long form. */ fieldBegin(id: number, type: CompactType): void; /** Booleans have no value bytes — true/false is the field header's type. */ bool(id: number, value: boolean): void; /** * Thrift `i8` — a single raw byte, NOT zigzag-encoded like i16/i32/i64. * `LogicalType.IntType.bitWidth` is declared i8, so writing it as an i32 * would shift every field after it. */ i8(id: number, value: number): void; i32(id: number, value: number): void; i64(id: number, value: number | bigint): void; binary(id: number, value: Uint8Array): void; string(id: number, value: string): void; /** * Open a list field. Elements follow with the `list*` writers (no field * headers inside a list); a list of structs uses `structBegin`/`structEnd`. */ listBegin(id: number, elementType: CompactType, size: number): void; listI32(value: number): void; listI64(value: number | bigint): void; listString(value: string): void; } //# sourceMappingURL=thrift.d.ts.map