/** * The encode entry point: `pack(Capture) -> bytes`, plus the file's cleartext header, the body * section framing, and the gzip wrapper. This is the encode HALF — it imports nothing decode-only * (no `DecompressionStream`, no `unpack`), which is what lets `rumcap/encode` tree-shake to an * encode-only bundle even without a bundler. `unpack` is the mirror in `unpack.ts`. * * Wire layout: * [ magic: F5 52 55 4D ] cleartext — \xF5 is never a valid UTF-8 lead byte, so the file * [ codecVersion: varuint ] is unambiguously binary and sniffable by these bytes alone * [ formatVersion: varuint ] (the schema/model version carried by Capture.formatVersion) * [ gzip( body ) ] everything below is gzipped as one stream * body = [ tickScale: varuint ] the capture-wide µs-tick divisor (see probeScale), then * a sequence of length-prefixed, tagged sections: * [ tag: u8 ][ byteLength: varuint ][ payload ] * * `pack` is async only because gzip (`CompressionStream`) is; the structural encode itself is * synchronous and per-section — the seam a future on-page driver uses to prepare stream bytes * incrementally and flush only the (cheap) string table at pagehide, and the boundary a WASM codec * would slot into. Redaction is NOT applied here; it is a separate pre-pack pass over the Capture. */ import type { Capture } from '../capture.js'; /** * Pack a capture into the compact, gzipped `.rcap` byte stream. Lossless to 1µs on timeline values * (`RelMs`/`DurationMs` are quantized to the microsecond grid — below the browser's ≤5µs real * resolution) and exact on every other field, with two documented normalizations (see FileFormat.md): * - strings are stored as well-formed UTF-8, so a lone surrogate becomes U+FFFD (`StringTable`); * - JsonValue payloads (detail/details/metadata) are normalized with JSON.stringify semantics * (`encodeJson`) — toJSON honored, undefined/function/symbol properties dropped, non-finite * numbers → null. * `unpack(pack(c))` deep-equals `c` for any capture whose timestamps are already at ≤1µs resolution * and whose strings/JSON are already in that normal form (everything a browser produces). */ export declare function pack(capture: Capture): Promise; //# sourceMappingURL=pack.d.ts.map