@cosyte/x12 0.0.15 → 0.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +598 -12
- package/KNOWN-LIMITATIONS.md +372 -28
- package/README.md +1 -1
- package/dist/index.cjs +351 -37
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +72 -40
- package/dist/index.d.ts +72 -40
- package/dist/index.mjs +351 -37
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -285,9 +285,7 @@ interface X12ParseWarning {
|
|
|
285
285
|
* Neither side is echoed, not truncated and not hashed. A control number is
|
|
286
286
|
* free-form trading-partner text on five of the six slots (only ISA-13 is
|
|
287
287
|
* fixed-width), routinely carries a batch or patient-account identifier in
|
|
288
|
-
* the field, and is entirely sender-controlled.
|
|
289
|
-
* `iea.elements[2]`, `gs.elements[6]`, `ge.elements[2]`, `st.elements[2]`
|
|
290
|
-
* and `se.elements[2]` off the model when you need the values.
|
|
288
|
+
* the field, and is entirely sender-controlled.
|
|
291
289
|
*
|
|
292
290
|
* @example
|
|
293
291
|
* ```ts
|
|
@@ -319,8 +317,7 @@ declare function pre005010(position: X12Position): X12ParseWarning;
|
|
|
319
317
|
* Build an `X12_GROUP_COUNT_MISMATCH` warning. Emitted when IEA-01 does not
|
|
320
318
|
* equal the actual number of GS..GE groups present in the interchange.
|
|
321
319
|
* Trading partners use this to detect transmission truncation. Both numbers
|
|
322
|
-
* stay on the model
|
|
323
|
-
* is silently corrected.
|
|
320
|
+
* stay on the model and neither is silently corrected.
|
|
324
321
|
*
|
|
325
322
|
* @example
|
|
326
323
|
* ```ts
|
|
@@ -332,8 +329,7 @@ declare function groupCountMismatch(position: X12Position): X12ParseWarning;
|
|
|
332
329
|
/**
|
|
333
330
|
* Build an `X12_TRANSACTION_COUNT_MISMATCH` warning. Emitted when GE-01
|
|
334
331
|
* does not equal the actual number of ST..SE transaction sets present in
|
|
335
|
-
* the group. Both numbers stay on the model
|
|
336
|
-
* `group.transactions.length`).
|
|
332
|
+
* the group. Both numbers stay on the model.
|
|
337
333
|
*
|
|
338
334
|
* @example
|
|
339
335
|
* ```ts
|
|
@@ -588,10 +584,15 @@ declare function missingRequiredLoop(position: X12Position, loop: X12RequiredLoo
|
|
|
588
584
|
* Build an `X12_837_UNKNOWN_VARIANT` warning. Emitted when the 837 helper
|
|
589
585
|
* cannot resolve the variant from ST-03's implementation-convention
|
|
590
586
|
* reference AND no SVx service-line segment is present to fall back on.
|
|
591
|
-
* The parsed submission still ships with `variant: "unknown"
|
|
592
|
-
* verbatim reference on `submission.implementationConventionReference`; the
|
|
587
|
+
* The parsed submission still ships with `variant: "unknown"`, and the
|
|
593
588
|
* walker does its best on shared structure (envelope, HL, claim header) and
|
|
594
|
-
* skips variant-specific service-line decoding.
|
|
589
|
+
* skips variant-specific service-line decoding. **This message deliberately
|
|
590
|
+
* points at no model field.** Recognition reads `ST-03` as FRAMED while
|
|
591
|
+
* `submission.implementationConventionReference` is decoded of any `?` release
|
|
592
|
+
* escape, so on a document that escapes a delimiter inside `ST-03` the two
|
|
593
|
+
* differ and the model field can hold an identifier this code just said was
|
|
594
|
+
* not recognised (`X12-ST03-READ-NOT-RELEASE-AWARE`). A pointer stood here and
|
|
595
|
+
* in the message text and is DELETED, not reworded.
|
|
595
596
|
*
|
|
596
597
|
* `get837Claims` anchors this at the **ST**, which is `tx.segments[0]` and
|
|
597
598
|
* carries the ST-03 the resolution reads. Through `0.0.10` it passed
|
|
@@ -1454,6 +1455,12 @@ declare const NON_SPEC_SEGMENT_ID = "(non-spec)";
|
|
|
1454
1455
|
* decodes to an empty segment (`id: ""`, `elements: [""]`); callers that
|
|
1455
1456
|
* care can guard.
|
|
1456
1457
|
*
|
|
1458
|
+
* **A degenerate delimiter set whose ELEMENT SEPARATOR is itself `?` splits
|
|
1459
|
+
* literally**, because one byte cannot both separate and escape. Only that
|
|
1460
|
+
* role is guarded here: a `?` repetition or component separator is a
|
|
1461
|
+
* different call and is deliberately unchanged (see
|
|
1462
|
+
* {@link "./release.js".splitWithRelease}).
|
|
1463
|
+
*
|
|
1457
1464
|
* @example
|
|
1458
1465
|
* ```ts
|
|
1459
1466
|
* import { decodeSegment } from "@cosyte/x12";
|
|
@@ -1916,7 +1923,9 @@ interface Ta1Segment {
|
|
|
1916
1923
|
*
|
|
1917
1924
|
* `elements` on the ST and SE segments themselves IS decoded at envelope
|
|
1918
1925
|
* time so envelope invariants can be checked (ST-02 ↔ SE-02 control-number
|
|
1919
|
-
* reconciliation, SE-01 segment count).
|
|
1926
|
+
* reconciliation, SE-01 segment count). **Read "decoded" as element-SPLIT and
|
|
1927
|
+
* nothing more: the strings are PRE-`?`-unescape**, and a reader that publishes
|
|
1928
|
+
* one to a consumer unescapes it first (`X12-ST03-READ-NOT-RELEASE-AWARE`).
|
|
1920
1929
|
*
|
|
1921
1930
|
* @example
|
|
1922
1931
|
* ```ts
|
|
@@ -12335,7 +12344,9 @@ type Ta1AckCode = (typeof TA1_ACK_CODES)[keyof typeof TA1_ACK_CODES];
|
|
|
12335
12344
|
* TA1-05 interchange note code (ASC X12 code list I18). Codes `000`–`028`
|
|
12336
12345
|
* are defined by the standard; values past `028` exist in some standard
|
|
12337
12346
|
* revisions and are accepted on parse (Postel's Law) but not enumerated
|
|
12338
|
-
* here - the parsed model carries the
|
|
12347
|
+
* here - the parsed model carries the un-narrowed string on `noteCodeRaw`,
|
|
12348
|
+
* post-`?`-unescape as of `X12-TA1-RESIDUALS`. **A clause here said "verbatim"
|
|
12349
|
+
* and is deleted rather than reworded**; `raw.elements[5]` is the byte surface.
|
|
12339
12350
|
*
|
|
12340
12351
|
* `000` is the canonical "no error" note paired with a `TA1-04 == 'A'`
|
|
12341
12352
|
* acceptance. The build-time safety guard refuses a fabricated `A` paired
|
|
@@ -12412,9 +12423,11 @@ declare const TA1_NOTE_CODES: {
|
|
|
12412
12423
|
/**
|
|
12413
12424
|
* String-literal union over {@link TA1_NOTE_CODES} - the standard-issued
|
|
12414
12425
|
* note codes `000`–`028`. Real-world inbound TA1 may carry a value past
|
|
12415
|
-
* `028` (some revisions extend the list); `parseTA1` exposes the
|
|
12416
|
-
* string in that case so the
|
|
12417
|
-
* cannot statically type it.
|
|
12426
|
+
* `028` (some revisions extend the list); `parseTA1` exposes the
|
|
12427
|
+
* un-narrowed string on `noteCodeRaw` in that case, so the value survives
|
|
12428
|
+
* even when the union cannot statically type it. **It is post-`?`-unescape
|
|
12429
|
+
* as of `X12-TA1-RESIDUALS`, and a clause here calling it VERBATIM is
|
|
12430
|
+
* deleted rather than reworded** - `raw.elements[5]` is the byte surface.
|
|
12418
12431
|
*/
|
|
12419
12432
|
type Ta1NoteCode = (typeof TA1_NOTE_CODES)[keyof typeof TA1_NOTE_CODES];
|
|
12420
12433
|
|
|
@@ -12636,13 +12649,23 @@ interface X12Ack999 {
|
|
|
12636
12649
|
* - `interchangeTime` - TA1-03: HHMM (echoes inbound ISA-10).
|
|
12637
12650
|
* - `ackCode` - TA1-04: {@link Ta1AckCode}.
|
|
12638
12651
|
* - `noteCode` - TA1-05: typed when the value is a known I18 code
|
|
12639
|
-
* ({@link Ta1NoteCode}); the
|
|
12640
|
-
* so unknown extensions
|
|
12641
|
-
*
|
|
12642
|
-
*
|
|
12652
|
+
* ({@link Ta1NoteCode}); `noteCodeRaw` carries the un-narrowed string
|
|
12653
|
+
* alongside so unknown extensions survive. **A clause here said that
|
|
12654
|
+
* string is preserved VERBATIM and is deleted, not reworded:**
|
|
12655
|
+
* `X12-TA1-RESIDUALS` made it post-unescape, and `raw.elements[5]` is
|
|
12656
|
+
* the verbatim surface.
|
|
12657
|
+
* - `noteCodeRaw` - the un-narrowed TA1-05 string. Equal to `noteCode` when
|
|
12658
|
+
* the value is a known I18 code; equal to the decoded inbound text when
|
|
12659
|
+
* not.
|
|
12643
12660
|
* - `raw` - the underlying envelope-level {@link Ta1Segment}, for
|
|
12644
12661
|
* byte-exact round-trip.
|
|
12645
12662
|
*
|
|
12663
|
+
* **The five decoded fields are POST-`?`-unescape; `raw` is the verbatim
|
|
12664
|
+
* byte surface and is not.** `X12-TA1-RESIDUALS` moved the decoded half:
|
|
12665
|
+
* before it, a released TA1-01 read back carrying its `?` and matched no
|
|
12666
|
+
* ISA-13, while every dot-path read of the same element already unescaped.
|
|
12667
|
+
* Read `raw.elements` when you want the bytes.
|
|
12668
|
+
*
|
|
12646
12669
|
* @example
|
|
12647
12670
|
* ```ts
|
|
12648
12671
|
* import type { X12AckTA1 } from "@cosyte/x12";
|
|
@@ -12956,20 +12979,17 @@ declare function build999(spec: Build999Spec): X12Interchange;
|
|
|
12956
12979
|
* number of `"0000^0001"`, truncating the reassociation key to the first
|
|
12957
12980
|
* repetition, and answers `"0000^0001"` here; the composite read `"01-1"`
|
|
12958
12981
|
* answered `"0000"` for `"0000:0001"`. **The measured pure cost is a
|
|
12959
|
-
* MID-STRING `?`, and only on the surfaces documented as raw**: `raw
|
|
12960
|
-
* `elements`
|
|
12961
|
-
*
|
|
12962
|
-
*
|
|
12963
|
-
*
|
|
12964
|
-
*
|
|
12965
|
-
*
|
|
12966
|
-
*
|
|
12967
|
-
*
|
|
12968
|
-
*
|
|
12969
|
-
*
|
|
12970
|
-
* `"00000001?*260601"`. The disposition is correct where it was
|
|
12971
|
-
* inverted; the key still needs `unescapeRelease` applied by the reader.
|
|
12972
|
-
* That is a property of the read half and is not changed here.
|
|
12982
|
+
* MID-STRING `?`, and only on the surfaces documented as raw**: `raw` and
|
|
12983
|
+
* `elements` read `"0000??0001"` where they read `"0000?0001"`, while the
|
|
12984
|
+
* dot-path read of THAT value unescapes and answered `"0000?0001"` on
|
|
12985
|
+
* both. Read the clause as scoped to the mid-string `?`, because it is
|
|
12986
|
+
* not true of `^` or `:` three sentences up. **`getSegmentValue` takes an
|
|
12987
|
+
* `X12Segment` and `Ta1Segment` carries no `id`, so add one to read a TA1
|
|
12988
|
+
* through it.** No total is published: that is what was measured, not a
|
|
12989
|
+
* closed account.
|
|
12990
|
+
* **🩺 A CLAUSE NAMING `parseTA1`'s FIELDS AS A THIRD SUCH SURFACE STOOD
|
|
12991
|
+
* HERE AND IS DELETED, NOT REWORDED.** `X12-TA1-RESIDUALS` made those
|
|
12992
|
+
* fields post-unescape, so it is measured false; do not restate it.
|
|
12973
12993
|
* - **A caller who was pre-releasing the value themselves** (the remedy
|
|
12974
12994
|
* `KNOWN-LIMITATIONS.md` named while this was open) is now escaping
|
|
12975
12995
|
* twice: `"00000001??"` in, `"00000001????"` out. The framing and the
|
|
@@ -12977,10 +12997,24 @@ declare function build999(spec: Build999Spec): X12Interchange;
|
|
|
12977
12997
|
* surface - the dot-path read answers `"00000001??"` where it answered
|
|
12978
12998
|
* `"00000001?"`. Drop the hand-rolled escape.
|
|
12979
12999
|
*
|
|
12980
|
-
* **And an EMPTY control number
|
|
12981
|
-
* early-returns on `""` and this module
|
|
12982
|
-
* `interchangeControlNumber: ""`
|
|
12983
|
-
* error,
|
|
13000
|
+
* **And an EMPTY control number USED to go out unrefused.** `escapeRelease`
|
|
13001
|
+
* early-returns on `""` and this module had no required-field guard, so
|
|
13002
|
+
* `interchangeControlNumber: ""` emitted `TA1**260601*1200*A*000` with no
|
|
13003
|
+
* error, through `0.0.15`. `X12-EMPTY-CONTROL-NUMBER-FABRICATED` closed it:
|
|
13004
|
+
* see {@link "../../builder/caller-control-number.js".requireControlNumber}.
|
|
13005
|
+
* `X12-CONTROL-NUMBER-GUARD-NOT-TYPE-CHECKED` then made the same guard
|
|
13006
|
+
* type-check, so TA1-01 draws a refusal naming TA1-01 rather than the escaper's
|
|
13007
|
+
* one naming only the builder - same class, same code, different words. The
|
|
13008
|
+
* guard is still byte-strict, so a whitespace-only TA1-01 still builds.
|
|
13009
|
+
*
|
|
13010
|
+
* **The other four slots were left open by that slice and `X12-TA1-RESIDUALS`
|
|
13011
|
+
* closes them.** TA1-01's guard was the only required-field guard this module
|
|
13012
|
+
* had, so `interchangeDate`, `interchangeTime`, `ackCode` and `noteCode` each
|
|
13013
|
+
* emitted an absent element on `""` with `warnings: []`. **TA1-05's cell has to
|
|
13014
|
+
* be read against a NON-Accept disposition, or `enforceAcceptIsClean` reaches
|
|
13015
|
+
* it first and the reading measures that guard instead** - see
|
|
13016
|
+
* {@link requireTa1Element}, which carries the grounding and the residual it
|
|
13017
|
+
* deliberately leaves.
|
|
12984
13018
|
*
|
|
12985
13019
|
* And the release is scoped to the delimiter set the caller states through
|
|
12986
13020
|
* {@link BuildTA1Options} - see that interface for why guessing one is a
|
|
@@ -13157,9 +13191,7 @@ interface BuildTA1Options {
|
|
|
13157
13191
|
* Every warning it emits is built by the same value-free factories the parser
|
|
13158
13192
|
* uses: `message` is a frozen-registry lookup and `position` locates the
|
|
13159
13193
|
* control segment, so a declared count or control number can never reach a
|
|
13160
|
-
* diagnostic.
|
|
13161
|
-
* (`se.elements[1]` against `tx.rawSegments.length`, `ge.elements[1]` against
|
|
13162
|
-
* `group.transactions.length`, `iea.elements[1]` against `ix.groups.length`).
|
|
13194
|
+
* diagnostic.
|
|
13163
13195
|
*/
|
|
13164
13196
|
|
|
13165
13197
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -285,9 +285,7 @@ interface X12ParseWarning {
|
|
|
285
285
|
* Neither side is echoed, not truncated and not hashed. A control number is
|
|
286
286
|
* free-form trading-partner text on five of the six slots (only ISA-13 is
|
|
287
287
|
* fixed-width), routinely carries a batch or patient-account identifier in
|
|
288
|
-
* the field, and is entirely sender-controlled.
|
|
289
|
-
* `iea.elements[2]`, `gs.elements[6]`, `ge.elements[2]`, `st.elements[2]`
|
|
290
|
-
* and `se.elements[2]` off the model when you need the values.
|
|
288
|
+
* the field, and is entirely sender-controlled.
|
|
291
289
|
*
|
|
292
290
|
* @example
|
|
293
291
|
* ```ts
|
|
@@ -319,8 +317,7 @@ declare function pre005010(position: X12Position): X12ParseWarning;
|
|
|
319
317
|
* Build an `X12_GROUP_COUNT_MISMATCH` warning. Emitted when IEA-01 does not
|
|
320
318
|
* equal the actual number of GS..GE groups present in the interchange.
|
|
321
319
|
* Trading partners use this to detect transmission truncation. Both numbers
|
|
322
|
-
* stay on the model
|
|
323
|
-
* is silently corrected.
|
|
320
|
+
* stay on the model and neither is silently corrected.
|
|
324
321
|
*
|
|
325
322
|
* @example
|
|
326
323
|
* ```ts
|
|
@@ -332,8 +329,7 @@ declare function groupCountMismatch(position: X12Position): X12ParseWarning;
|
|
|
332
329
|
/**
|
|
333
330
|
* Build an `X12_TRANSACTION_COUNT_MISMATCH` warning. Emitted when GE-01
|
|
334
331
|
* does not equal the actual number of ST..SE transaction sets present in
|
|
335
|
-
* the group. Both numbers stay on the model
|
|
336
|
-
* `group.transactions.length`).
|
|
332
|
+
* the group. Both numbers stay on the model.
|
|
337
333
|
*
|
|
338
334
|
* @example
|
|
339
335
|
* ```ts
|
|
@@ -588,10 +584,15 @@ declare function missingRequiredLoop(position: X12Position, loop: X12RequiredLoo
|
|
|
588
584
|
* Build an `X12_837_UNKNOWN_VARIANT` warning. Emitted when the 837 helper
|
|
589
585
|
* cannot resolve the variant from ST-03's implementation-convention
|
|
590
586
|
* reference AND no SVx service-line segment is present to fall back on.
|
|
591
|
-
* The parsed submission still ships with `variant: "unknown"
|
|
592
|
-
* verbatim reference on `submission.implementationConventionReference`; the
|
|
587
|
+
* The parsed submission still ships with `variant: "unknown"`, and the
|
|
593
588
|
* walker does its best on shared structure (envelope, HL, claim header) and
|
|
594
|
-
* skips variant-specific service-line decoding.
|
|
589
|
+
* skips variant-specific service-line decoding. **This message deliberately
|
|
590
|
+
* points at no model field.** Recognition reads `ST-03` as FRAMED while
|
|
591
|
+
* `submission.implementationConventionReference` is decoded of any `?` release
|
|
592
|
+
* escape, so on a document that escapes a delimiter inside `ST-03` the two
|
|
593
|
+
* differ and the model field can hold an identifier this code just said was
|
|
594
|
+
* not recognised (`X12-ST03-READ-NOT-RELEASE-AWARE`). A pointer stood here and
|
|
595
|
+
* in the message text and is DELETED, not reworded.
|
|
595
596
|
*
|
|
596
597
|
* `get837Claims` anchors this at the **ST**, which is `tx.segments[0]` and
|
|
597
598
|
* carries the ST-03 the resolution reads. Through `0.0.10` it passed
|
|
@@ -1454,6 +1455,12 @@ declare const NON_SPEC_SEGMENT_ID = "(non-spec)";
|
|
|
1454
1455
|
* decodes to an empty segment (`id: ""`, `elements: [""]`); callers that
|
|
1455
1456
|
* care can guard.
|
|
1456
1457
|
*
|
|
1458
|
+
* **A degenerate delimiter set whose ELEMENT SEPARATOR is itself `?` splits
|
|
1459
|
+
* literally**, because one byte cannot both separate and escape. Only that
|
|
1460
|
+
* role is guarded here: a `?` repetition or component separator is a
|
|
1461
|
+
* different call and is deliberately unchanged (see
|
|
1462
|
+
* {@link "./release.js".splitWithRelease}).
|
|
1463
|
+
*
|
|
1457
1464
|
* @example
|
|
1458
1465
|
* ```ts
|
|
1459
1466
|
* import { decodeSegment } from "@cosyte/x12";
|
|
@@ -1916,7 +1923,9 @@ interface Ta1Segment {
|
|
|
1916
1923
|
*
|
|
1917
1924
|
* `elements` on the ST and SE segments themselves IS decoded at envelope
|
|
1918
1925
|
* time so envelope invariants can be checked (ST-02 ↔ SE-02 control-number
|
|
1919
|
-
* reconciliation, SE-01 segment count).
|
|
1926
|
+
* reconciliation, SE-01 segment count). **Read "decoded" as element-SPLIT and
|
|
1927
|
+
* nothing more: the strings are PRE-`?`-unescape**, and a reader that publishes
|
|
1928
|
+
* one to a consumer unescapes it first (`X12-ST03-READ-NOT-RELEASE-AWARE`).
|
|
1920
1929
|
*
|
|
1921
1930
|
* @example
|
|
1922
1931
|
* ```ts
|
|
@@ -12335,7 +12344,9 @@ type Ta1AckCode = (typeof TA1_ACK_CODES)[keyof typeof TA1_ACK_CODES];
|
|
|
12335
12344
|
* TA1-05 interchange note code (ASC X12 code list I18). Codes `000`–`028`
|
|
12336
12345
|
* are defined by the standard; values past `028` exist in some standard
|
|
12337
12346
|
* revisions and are accepted on parse (Postel's Law) but not enumerated
|
|
12338
|
-
* here - the parsed model carries the
|
|
12347
|
+
* here - the parsed model carries the un-narrowed string on `noteCodeRaw`,
|
|
12348
|
+
* post-`?`-unescape as of `X12-TA1-RESIDUALS`. **A clause here said "verbatim"
|
|
12349
|
+
* and is deleted rather than reworded**; `raw.elements[5]` is the byte surface.
|
|
12339
12350
|
*
|
|
12340
12351
|
* `000` is the canonical "no error" note paired with a `TA1-04 == 'A'`
|
|
12341
12352
|
* acceptance. The build-time safety guard refuses a fabricated `A` paired
|
|
@@ -12412,9 +12423,11 @@ declare const TA1_NOTE_CODES: {
|
|
|
12412
12423
|
/**
|
|
12413
12424
|
* String-literal union over {@link TA1_NOTE_CODES} - the standard-issued
|
|
12414
12425
|
* note codes `000`–`028`. Real-world inbound TA1 may carry a value past
|
|
12415
|
-
* `028` (some revisions extend the list); `parseTA1` exposes the
|
|
12416
|
-
* string in that case so the
|
|
12417
|
-
* cannot statically type it.
|
|
12426
|
+
* `028` (some revisions extend the list); `parseTA1` exposes the
|
|
12427
|
+
* un-narrowed string on `noteCodeRaw` in that case, so the value survives
|
|
12428
|
+
* even when the union cannot statically type it. **It is post-`?`-unescape
|
|
12429
|
+
* as of `X12-TA1-RESIDUALS`, and a clause here calling it VERBATIM is
|
|
12430
|
+
* deleted rather than reworded** - `raw.elements[5]` is the byte surface.
|
|
12418
12431
|
*/
|
|
12419
12432
|
type Ta1NoteCode = (typeof TA1_NOTE_CODES)[keyof typeof TA1_NOTE_CODES];
|
|
12420
12433
|
|
|
@@ -12636,13 +12649,23 @@ interface X12Ack999 {
|
|
|
12636
12649
|
* - `interchangeTime` - TA1-03: HHMM (echoes inbound ISA-10).
|
|
12637
12650
|
* - `ackCode` - TA1-04: {@link Ta1AckCode}.
|
|
12638
12651
|
* - `noteCode` - TA1-05: typed when the value is a known I18 code
|
|
12639
|
-
* ({@link Ta1NoteCode}); the
|
|
12640
|
-
* so unknown extensions
|
|
12641
|
-
*
|
|
12642
|
-
*
|
|
12652
|
+
* ({@link Ta1NoteCode}); `noteCodeRaw` carries the un-narrowed string
|
|
12653
|
+
* alongside so unknown extensions survive. **A clause here said that
|
|
12654
|
+
* string is preserved VERBATIM and is deleted, not reworded:**
|
|
12655
|
+
* `X12-TA1-RESIDUALS` made it post-unescape, and `raw.elements[5]` is
|
|
12656
|
+
* the verbatim surface.
|
|
12657
|
+
* - `noteCodeRaw` - the un-narrowed TA1-05 string. Equal to `noteCode` when
|
|
12658
|
+
* the value is a known I18 code; equal to the decoded inbound text when
|
|
12659
|
+
* not.
|
|
12643
12660
|
* - `raw` - the underlying envelope-level {@link Ta1Segment}, for
|
|
12644
12661
|
* byte-exact round-trip.
|
|
12645
12662
|
*
|
|
12663
|
+
* **The five decoded fields are POST-`?`-unescape; `raw` is the verbatim
|
|
12664
|
+
* byte surface and is not.** `X12-TA1-RESIDUALS` moved the decoded half:
|
|
12665
|
+
* before it, a released TA1-01 read back carrying its `?` and matched no
|
|
12666
|
+
* ISA-13, while every dot-path read of the same element already unescaped.
|
|
12667
|
+
* Read `raw.elements` when you want the bytes.
|
|
12668
|
+
*
|
|
12646
12669
|
* @example
|
|
12647
12670
|
* ```ts
|
|
12648
12671
|
* import type { X12AckTA1 } from "@cosyte/x12";
|
|
@@ -12956,20 +12979,17 @@ declare function build999(spec: Build999Spec): X12Interchange;
|
|
|
12956
12979
|
* number of `"0000^0001"`, truncating the reassociation key to the first
|
|
12957
12980
|
* repetition, and answers `"0000^0001"` here; the composite read `"01-1"`
|
|
12958
12981
|
* answered `"0000"` for `"0000:0001"`. **The measured pure cost is a
|
|
12959
|
-
* MID-STRING `?`, and only on the surfaces documented as raw**: `raw
|
|
12960
|
-
* `elements`
|
|
12961
|
-
*
|
|
12962
|
-
*
|
|
12963
|
-
*
|
|
12964
|
-
*
|
|
12965
|
-
*
|
|
12966
|
-
*
|
|
12967
|
-
*
|
|
12968
|
-
*
|
|
12969
|
-
*
|
|
12970
|
-
* `"00000001?*260601"`. The disposition is correct where it was
|
|
12971
|
-
* inverted; the key still needs `unescapeRelease` applied by the reader.
|
|
12972
|
-
* That is a property of the read half and is not changed here.
|
|
12982
|
+
* MID-STRING `?`, and only on the surfaces documented as raw**: `raw` and
|
|
12983
|
+
* `elements` read `"0000??0001"` where they read `"0000?0001"`, while the
|
|
12984
|
+
* dot-path read of THAT value unescapes and answered `"0000?0001"` on
|
|
12985
|
+
* both. Read the clause as scoped to the mid-string `?`, because it is
|
|
12986
|
+
* not true of `^` or `:` three sentences up. **`getSegmentValue` takes an
|
|
12987
|
+
* `X12Segment` and `Ta1Segment` carries no `id`, so add one to read a TA1
|
|
12988
|
+
* through it.** No total is published: that is what was measured, not a
|
|
12989
|
+
* closed account.
|
|
12990
|
+
* **🩺 A CLAUSE NAMING `parseTA1`'s FIELDS AS A THIRD SUCH SURFACE STOOD
|
|
12991
|
+
* HERE AND IS DELETED, NOT REWORDED.** `X12-TA1-RESIDUALS` made those
|
|
12992
|
+
* fields post-unescape, so it is measured false; do not restate it.
|
|
12973
12993
|
* - **A caller who was pre-releasing the value themselves** (the remedy
|
|
12974
12994
|
* `KNOWN-LIMITATIONS.md` named while this was open) is now escaping
|
|
12975
12995
|
* twice: `"00000001??"` in, `"00000001????"` out. The framing and the
|
|
@@ -12977,10 +12997,24 @@ declare function build999(spec: Build999Spec): X12Interchange;
|
|
|
12977
12997
|
* surface - the dot-path read answers `"00000001??"` where it answered
|
|
12978
12998
|
* `"00000001?"`. Drop the hand-rolled escape.
|
|
12979
12999
|
*
|
|
12980
|
-
* **And an EMPTY control number
|
|
12981
|
-
* early-returns on `""` and this module
|
|
12982
|
-
* `interchangeControlNumber: ""`
|
|
12983
|
-
* error,
|
|
13000
|
+
* **And an EMPTY control number USED to go out unrefused.** `escapeRelease`
|
|
13001
|
+
* early-returns on `""` and this module had no required-field guard, so
|
|
13002
|
+
* `interchangeControlNumber: ""` emitted `TA1**260601*1200*A*000` with no
|
|
13003
|
+
* error, through `0.0.15`. `X12-EMPTY-CONTROL-NUMBER-FABRICATED` closed it:
|
|
13004
|
+
* see {@link "../../builder/caller-control-number.js".requireControlNumber}.
|
|
13005
|
+
* `X12-CONTROL-NUMBER-GUARD-NOT-TYPE-CHECKED` then made the same guard
|
|
13006
|
+
* type-check, so TA1-01 draws a refusal naming TA1-01 rather than the escaper's
|
|
13007
|
+
* one naming only the builder - same class, same code, different words. The
|
|
13008
|
+
* guard is still byte-strict, so a whitespace-only TA1-01 still builds.
|
|
13009
|
+
*
|
|
13010
|
+
* **The other four slots were left open by that slice and `X12-TA1-RESIDUALS`
|
|
13011
|
+
* closes them.** TA1-01's guard was the only required-field guard this module
|
|
13012
|
+
* had, so `interchangeDate`, `interchangeTime`, `ackCode` and `noteCode` each
|
|
13013
|
+
* emitted an absent element on `""` with `warnings: []`. **TA1-05's cell has to
|
|
13014
|
+
* be read against a NON-Accept disposition, or `enforceAcceptIsClean` reaches
|
|
13015
|
+
* it first and the reading measures that guard instead** - see
|
|
13016
|
+
* {@link requireTa1Element}, which carries the grounding and the residual it
|
|
13017
|
+
* deliberately leaves.
|
|
12984
13018
|
*
|
|
12985
13019
|
* And the release is scoped to the delimiter set the caller states through
|
|
12986
13020
|
* {@link BuildTA1Options} - see that interface for why guessing one is a
|
|
@@ -13157,9 +13191,7 @@ interface BuildTA1Options {
|
|
|
13157
13191
|
* Every warning it emits is built by the same value-free factories the parser
|
|
13158
13192
|
* uses: `message` is a frozen-registry lookup and `position` locates the
|
|
13159
13193
|
* control segment, so a declared count or control number can never reach a
|
|
13160
|
-
* diagnostic.
|
|
13161
|
-
* (`se.elements[1]` against `tx.rawSegments.length`, `ge.elements[1]` against
|
|
13162
|
-
* `group.transactions.length`, `iea.elements[1]` against `ix.groups.length`).
|
|
13194
|
+
* diagnostic.
|
|
13163
13195
|
*/
|
|
13164
13196
|
|
|
13165
13197
|
/**
|