technical

Parser & validator

Deep-dive into the pure-TS parser: delimiters, envelopes, structural checks, and issue codes.

parseX12(text) returns a ParseResult with the decoded interchange, per-transaction validation issues, and a top-level ok flag.

Issue codes

  • ENV.* — envelope-level: ISA/GS/IEA/GE mismatches
  • SEG.* — missing required segment for the transaction
  • ELE.* — missing/invalid required element
  • TXN.* — SE01 segment count mismatch
  • VENDOR_REQ — vendor overlay requirement not satisfied

Adding transactions

Append to X12_TEMPLATES in src/lib/edi/x12Templates.ts. Each template lists required segments and required element ids; the parser drives its structural checks from that.