/** * @file Incremental newline-delimited JSON line splitting. One line-boundary * implementation shared by every NDJSON reader in the SDK — the buffered * batch-PURL generator and the pull-driven patch stream both drive the same * splitter, so the boundary rules cannot drift between them. */ /** * Stateful newline splitter. `push` returns the complete lines a chunk * finished, holding any trailing partial line until the next chunk completes * it; `flush` releases that partial line once the source ends. Blank lines are * dropped — an NDJSON record is one JSON value per line. */ export interface NdjsonLineSplitter { flush(): string[]; push(chunk: string): string[]; } /** * Build a splitter that turns arbitrary chunk boundaries into whole NDJSON * lines. */ export declare function createNdjsonLineSplitter(): NdjsonLineSplitter; /** * Yield NDJSON lines from a chunk source, one line at a time. The generator * suspends between lines, so a slow consumer pauses the underlying stream * instead of letting the whole body accumulate. UTF-8 sequences split across a * chunk boundary are stitched back together by the streaming decoder. * * @param source - Async or sync chunk source, e.g. an `IncomingMessage`. */ export declare function iterateNdjsonLines(source: AsyncIterable | Iterable): AsyncGenerator; /** * Yield NDJSON lines from a resident string. Use this only when the whole body * is already in memory; prefer `iterateNdjsonLines` over a response stream. */ export declare function readNdjsonLines(text: string): Generator;