Interface: Acknowledgment
Typed view of an inbound ACK. accepted / error / rejected are derived
from MSA-1 against HL7 Table 0008 and are mutually exclusive; all three
are false when MSA-1 is absent or not a recognized code (fail-safe).
Example
import { interpretAck, parseHL7 } from "@cosyte/hl7";
const ack = interpretAck(parseHL7(rawAck));
if (ack.accepted) {
// safe to consider the message acknowledged
} else if (ack.rejected) {
for (const e of ack.errors) console.error(e.conditionCode, e.severity);
}
Properties
accepted
readonlyaccepted:boolean
True iff MSA-1 is a positive accept (AA/CA).
code?
readonlyoptionalcode?:string
MSA-1 acknowledgment code (HL7 Table 0008), verbatim. Omitted when absent.
controlId?
readonlyoptionalcontrolId?:string
MSA-2 message control id (the correlated inbound MSH-10), surfaced as the
field's canonical wire text (Field.text): the whole field,
delimiters included, never truncated to the first component. Note this is
the re-escaped form: a properly-escaped id arrives as its wire bytes
(ID\S\X), and an HL7 explicit-null MSA-2 surfaces as the literal
two-character "". Omitted when absent/empty.
error
readonlyerror:boolean
True iff MSA-1 is an error acknowledgment (AE/CE).
errors
readonlyerrors: readonlyAckErrorEntry[]
Every ERR segment in document order ( [] when none ).
rejected
readonlyrejected:boolean
True iff MSA-1 is a reject acknowledgment (AR/CR).