Interface: Batch
One batch within a stream: a run of messages delimited by a BHS header
and/or a BTS trailer (both optional in §2.10.3, so a BTS closes a
preceding run into a batch even with no BHS). A run of messages with
neither a header nor a trailer is not a batch: those messages live in
BatchSplitResult.messages only, so they never inflate a batch count.
declaredMessageCount is BTS-1 when the trailer declared a usable
non-negative integer (it is optional [0..1] in the spec, so it may be
absent); actualMessageCount is always the real count.
Example
import { splitBatch } from "@cosyte/hl7";
const [batch] = splitBatch(raw).batches;
batch?.header?.name; // "BHS" (or undefined for a headerless BTS-closed run)
batch?.actualMessageCount; // messages actually in the batch
Properties
actualMessageCount
readonlyactualMessageCount:number
The actual number of messages split out of this batch.
declaredMessageCount?
readonlyoptionaldeclaredMessageCount?:number
BTS-1 batch message count, when declared as a non-negative integer.
header?
readonlyoptionalheader?:BatchEnvelopeSegment
The BHS header, when this batch was opened by one.
messages
readonlymessages: readonlyBatchMessageEntry[]
The messages in this batch, in stream order.
trailer?
readonlyoptionaltrailer?:BatchEnvelopeSegment
The BTS trailer, when this batch was closed by one.