Function: downgradePositiveAck()
downgradePositiveAck(
code):AckCode
Downgrade a positive acknowledgment code to its matching error code,
AA → AE (original mode), CA → CE (enhanced mode). Every other code
passes through unchanged.
This is the single upstream source of truth for the fail-safe downgrade
pair: buildAck applies it when the inbound carries no MSH-10 correlation
id, and @cosyte/mllp's ack-from-hl7 adapter applies it when the inbound
cannot be parsed at all: neither ever fabricates an unverifiable positive
acknowledgment, and neither carries its own copy of the mapping.
Parameters
code
Returns
Example
import { downgradePositiveAck } from "@cosyte/hl7";
downgradePositiveAck("AA"); // "AE"
downgradePositiveAck("CA"); // "CE"
downgradePositiveAck("AR"); // "AR" (unchanged)