Interface: SerializeOptions
Options accepted by serializeX12. Every field is optional;
serializeX12(ix) produces the byte-faithful reconstruction with no
reconciliation.
Remarks
With exactOptionalPropertyTypes: true, do not pass specClean: undefined
explicitly - omit the key instead.
Example
import { serializeX12, parseX12 } from "@cosyte/x12";
const ix = parseX12(raw);
// Spec-clean emit that fixes any stale envelope counts:
const out = serializeX12(ix, {
specClean: true,
recomputeCounts: true,
onWarning: (w) => console.warn(w.code, w.message),
});
Properties
onWarning?
readonlyoptionalonWarning?:OnWarningCallback
Invoked once per reconciliation warning (spec-clean mode only).
recomputeCounts?
readonlyoptionalrecomputeCounts?:boolean
Substitute the recomputed SE-01 / GE-01 / IEA-01 counts into the emitted
control segments (only meaningful with specClean: true). Default
false - the serializer warns on a count mismatch but emits the model's
verbatim value. Control NUMBERS are never rewritten regardless.
specClean?
readonlyoptionalspecClean?:boolean
Reconcile envelope counts + control-number pairs and surface any
mismatch via onWarning. Default false (pure byte-faithful
reconstruction, no reconciliation, no warnings).