Interface: BatchSplitResult
The result of splitBatch: the flattened messages (every message
across every batch, in stream order: the primary surface), the nested
batches, the raw file envelope segments, and the batch-level warnings
(count-mismatch / missing-trailer). hadEnvelope is false for a bare
passthrough (no FHS/BHS/BTS/FTS seen).
Example
import { splitBatch } from "@cosyte/hl7";
const result = splitBatch(rawBatchFile);
result.messages.length; // every message, batched or not
result.batches.length; // === result.actualBatchCount
result.warnings; // BATCH_COUNT_MISMATCH / BATCH_MISSING_TRAILER (counts only)
Properties
actualBatchCount
readonlyactualBatchCount:number
The number of explicit batches split out of the stream.
batches
readonlybatches: readonlyBatch[]
The explicit (BHS-delimited) batches, in stream order.
declaredBatchCount?
readonlyoptionaldeclaredBatchCount?:number
The last FTS-1 file batch count, when declared as a non-negative integer.
fileHeader?
readonlyoptionalfileHeader?:BatchEnvelopeSegment
The first FHS file header, when present.
fileTrailer?
readonlyoptionalfileTrailer?:BatchEnvelopeSegment
The last FTS file trailer, when present.
hadEnvelope
readonlyhadEnvelope:boolean
false when no envelope segment was seen (bare passthrough).
messages
readonlymessages: readonlyBatchMessageEntry[]
Every message split out of the stream, in order: the primary surface. This
includes messages that belong to no explicit batch (a bare stream, or
content outside any BHS/BTS), so it is a superset of the messages
reachable via batches.
warnings
readonlywarnings: readonlyHl7ParseWarning[]
Batch-level warnings (count mismatch, missing trailer); counts/positions only, never PHI.