API View source
inspectOrderBatch()
Builds a payload-agnostic inspection snapshot for one emitted orderEventStream() batch.
Signature
function inspectOrderBatch<T>(
batch: Readonly<StreamOrderBatch<T>>,
): OrderBatchInspection<T>Use this when you want the same compact inspection layer for one emitted orderEventStream() batch, including watermark and correction metadata.
Usage
import { inspectOrderBatch, orderEventStream } from "causal-order"
for await (const batch of orderEventStream(source(), {
batchSize: 100,
maxLateArrivalMs: 30_000n,
lateArrivalPolicy: "emit_correction",
strict: false,
})) {
const inspection = inspectOrderBatch(batch)
console.log(inspection.watermark)
console.log(inspection.correction)
console.log(inspection.anomalySummary)
} Details
- Preserves emitted
watermark,isFinal, and correction metadata in the inspection output. - Summarizes emitted events by
orderBasisandconfidence. - Helps operators inspect correction-capable stream output without flattening the underlying batch contract.