Function: serializeTelecom()
serializeTelecom(
transaction):string
Serialize a TelecomTransaction back to its canonical NCPDP Telecommunication vD.0 wire form. The conservative (emit) half of Postel's Law: it walks the model faithfully and never warns: a model produced by "./parse".parseTelecom or "./builder".buildTelecomRequest is trusted as valid by construction.
The output is canonical, not byte-identical to a quirky input: header
fields are re-padded to their fixed widths and segments are re-joined with
single FS/GS/RS control characters. Serializing is idempotent:
serialize(parse(serialize(t))) equals serialize(t), which is the
round-trip contract this library guarantees (a normalizing serializer cannot
reproduce arbitrary whitespace or duplicate separators).
A request emits the 56-byte fixed header immediately followed by the framed body; a response emits the fixed response header, a Group Separator, then the RS-framed segment body.
Parameters
transaction
A transaction from parseTelecom or buildTelecomRequest.
Returns
string
The canonical wire string.
Example
import { parseTelecom, serializeTelecom } from "@cosyte/ncpdp/telecom";
const wire = serializeTelecom(parseTelecom(raw));
parseTelecom(wire); // re-parses cleanly