Skip to main content
Version: v0.0.8

Interface: X12Interchange

The top-level X12 interchange returned by parseX12. isa carries the envelope header verbatim; delimiters is the four-class delimiter set detected from fixed positions inside isa.raw; groups is the ordered GS..GE list; orphanSegments holds any segment that fell outside every transaction set (empty for a well-formed interchange); warnings accumulates every Tier-2 deviation observed during the parse (lenient mode); trailingBytes (when present) is any non-empty content after IEA - preserved verbatim so a consumer can inspect or re-emit it.

Example

import { parseX12 } from "@cosyte/x12";
const ix = parseX12(raw);
for (const w of ix.warnings) console.warn(w.code, w.position);

Properties

delimiters

readonly delimiters: Delimiters


groups

readonly groups: readonly X12FunctionalGroup[]


iea

readonly iea: IeaSegment | undefined


isa

readonly isa: IsaSegment


orphanSegments

readonly orphanSegments: readonly X12OrphanSegment[]

Segments the envelope grammar could not place, in input order - almost always because they fell outside every ST..SE transaction set, plus the TA1-inside-a-group case, which is lifted out of the transaction it arrived in. Empty for a well-formed interchange. See X12OrphanSegment.


profile?

readonly optional profile?: X12Profile

The trading-partner X12Profile in effect for this parse, if any - either passed explicitly via options.profile or resolved from the process-scoped default. Present only when a profile applied; used for attribution and as the partition basis for partitionWarnings.


ta1Segments

readonly ta1Segments: readonly Ta1Segment[]


trailingBytes?

readonly optional trailingBytes?: string


warnings

readonly warnings: readonly X12ParseWarning[]