@cosyte/x12 0.1.2 → 0.1.4

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 CHANGED
@@ -1,11 +1,43 @@
1
1
  # Changelog
2
2
 
3
- All notable changes to `@cosyte/x12` will be documented in this file.
3
+ ## 0.1.4
4
4
 
5
- The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
- and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
5
+ ### Patch Changes
7
6
 
8
- ## [Unreleased]
7
+ - ab10959: The README now has Documentation, Support, and Security sections, says CI tests Node.js 22, 24, and 26, and links the full documentation on docs.cosyte.com. No code changes.
8
+
9
+ ## 0.1.3
10
+
11
+ ### Patch Changes
12
+
13
+ - 17bdb42: Fixed three doc errors: three type comments gave the 835 remit balance with the PLB amounts added, where the parser and `build835` subtract them, the PLB adjustment type said its reason code held the whole composite, and the README named `parseDocumentDate`, which the package does not export.
14
+
15
+ The remit balance now reads BPR-02 equals the sum of the claim payments (CLP-04) minus the sum of the PLB amounts, each in its raw sign, on `X12Decimal`, `X12RemitPaymentHeader`, and `X12RemitProviderAdjustment`. The claim and service-line balances on `X12Decimal` and `X12RemitServiceLine` now match the checks too. `X12RemitProviderAdjustment` now says `reasonCode` is the first component of the PLB reason composite (`WO`) and `subCode` the second (`123456`), as the parser stores them. The README, the cookbook, and the date conversion comments now name `checkCarcValidity` and `checkRarcValidity`, the exported date-aware queries that throw an `X12CodeListError` on a document date they refuse. No code, type, or behavior changes.
16
+
17
+ - dca2a3b: The README and documentation now use US spelling and serial commas, and write pauses without spaced hyphens.
18
+
19
+ The README's Status section names the 0.1 release line instead of an exact version, and the version script keeps that line current when a new minor line opens. The README states the Node.js support as 22 or later and tested on 22 and 24, links the license and trademarks files by absolute URL, and points at the organization's contributing guide and code of conduct. Every documentation page now carries a description, page titles say "and" instead of "&", and the sidebar category reads "Core concepts". No code, type, or behavior changes.
20
+
21
+ ## 0.1.2
22
+
23
+ ### Patch Changes
24
+
25
+ - Doc comments now write number ranges with "to" instead of an en dash.
26
+
27
+ ## Released before this file was generated
28
+
29
+ Every release section above this heading is written by
30
+ [Changesets](https://github.com/changesets/changesets) from the changesets in `.changeset/`, newest
31
+ release first. The release writes its own version heading, so nothing above this line is maintained
32
+ by hand, and a change is recorded by adding a changeset rather than by editing this file. The 0.1.2
33
+ section was filled in from that release's GitHub release notes when generation was turned on, since
34
+ 0.1.2 shipped while this file was still kept by hand and it was never written here.
35
+
36
+ Everything below this heading was maintained by hand, in the
37
+ [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) format, and is left as it was written. Two
38
+ things were dropped: the preamble above it, which said the file was kept by hand, and an empty
39
+ `[Unreleased]` heading. The `[0.1.0]` section holds every entry written before the first 0.1
40
+ release, the `0.0.x` releases included, which the file never recorded one by one.
9
41
 
10
42
  ## [0.1.1] - 2026-10-07
11
43
 
@@ -276,7 +276,7 @@ model.
276
276
  `X12_837_UNKNOWN_VARIANT` accused a document that was not non-conformant. The reader now recognises
277
277
  each base guide and each of its published errata. Sources for every key are named beside the table
278
278
  in `src/transactions/claim/get-837.ts` and in
279
- `documentation/agent-notes/x12-variant-icr-ungrounded.md`.
279
+ `documentation/agent-notes.md#x12---grounding-variant_by_icr-x12-variant-icr-ungrounded-2026-08-08`.
280
280
  - **🛑 What this changes for a consumer, and it is a behaviour change on already-published
281
281
  decoding.** On a file whose `ST-03` is now recognised: `submission.variant` can differ from what
282
282
  `0.0.13` read, where the first `SVx` in the body disagreed with the declaration; and
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2026 Cosyte
3
+ Copyright (c) 2026 Cosyte LLC
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -7,12 +7,12 @@
7
7
 
8
8
  # @cosyte/x12
9
9
 
10
- > Read the money out of an 835, an 837 or a 271 without a TR3 open on your desk.
10
+ > Read the money out of an 835, an 837, or a 271 without a TR3 open on your desk.
11
11
 
12
12
  [![npm version](https://img.shields.io/npm/v/@cosyte/x12.svg)](https://www.npmjs.com/package/@cosyte/x12)
13
13
  [![CI](https://img.shields.io/github/actions/workflow/status/cosyte/x12/ci.yml?branch=main&label=CI)](https://github.com/cosyte/x12/actions/workflows/ci.yml)
14
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](./LICENSE)
15
- [![Node](https://img.shields.io/badge/node-%3E%3D22-brightgreen.svg)](https://nodejs.org)
14
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/cosyte/x12/blob/main/LICENSE)
15
+ [![Node](https://img.shields.io/badge/node-%3E%3D22.0.0-brightgreen.svg)](https://nodejs.org)
16
16
 
17
17
  Developer-focused ASC X12 healthcare EDI parser, serializer, and builder for Node.js and TypeScript: lenient on parse, spec-clean on emit.
18
18
 
@@ -20,7 +20,7 @@ Developer-focused ASC X12 healthcare EDI parser, serializer, and builder for Nod
20
20
 
21
21
  Reading an X12 healthcare transaction correctly normally means buying the TR3 implementation guide
22
22
  for it and then hand-mapping element positions that no compiler will ever check. This library
23
- removes that step for the engineer who has one 835 to post, one 271 to answer or one 837 to send,
23
+ removes that step for the engineer who has one 835 to post, one 271 to answer, or one 837 to send,
24
24
  and who needs the amounts to be exactly right rather than approximately right. The nearest
25
25
  alternatives are a general-purpose EDI translator, which frames segments correctly but knows nothing
26
26
  about what CLP-04 means, and a hand-rolled split on the segment terminator, which works until the
@@ -31,17 +31,18 @@ a stable code instead of failing or guessing.
31
31
 
32
32
  ## Status
33
33
 
34
- **Version 0.1.2**, published on npm from a public repository.
34
+ **The 0.1 line**, published on npm from a public repository.
35
35
 
36
- From `0.1.0` the public API is settled and safe to depend on: the exported readers, builders,
36
+ On the 0.1 line the public API is settled and safe to depend on: the exported readers, builders,
37
37
  types and warning codes are the surface we keep stable, and the warning registry only ever gains
38
38
  codes. Below 1.0 a breaking change bumps the minor version and is called out in the changelog with
39
- its migration. On a `0.0.x` version, pin an exact version rather than a range. Typed read and typed
40
- emit both ship for every transaction set
41
- this package covers: 270, 271, 276, 277 and 277CA, 278 request and response, 820, 834, 835, 837P,
42
- 837I and 837D, 999 and TA1, each with a reader and a matching domain builder, and the two claims
43
- attachments guides 45 CFR 162.2002 adopts for the period on and after 26 May 2028: the 277 request
44
- for additional information (`006020X313`) and the 275 that answers it (`006020X314`). For those two the base X12 006020
39
+ its migration. On an older 0.0 release, pin an exact version rather than a range.
40
+
41
+ Typed read and typed emit both ship for every transaction set this package covers: 270, 271, 276,
42
+ 277 and 277CA, 278 request and response, 820, 834, 835, 837P, 837I and 837D, 999 and TA1, each
43
+ with a reader and a matching domain builder, and the two claims attachments guides 45 CFR 162.2002
44
+ adopts for the period on and after May 26, 2028: the 277 request for additional information
45
+ (`006020X313`) and the 275 that answers it (`006020X314`). For those two the base X12 006020
45
46
  structure is typed and no implementation-guide usage is checked, so a qualifier or segment the
46
47
  guide requires is carried as sent and never validated; `KNOWN-LIMITATIONS.md` lists what else
47
48
  they leave open. `X12_TR3_CONFORMANCE` is the machine-readable answer to which implementation
@@ -60,15 +61,15 @@ pnpm add @cosyte/x12
60
61
 
61
62
  `npm install @cosyte/x12` and `yarn add @cosyte/x12` work the same way.
62
63
 
63
- Node `>=22.0.0` is the engine floor, and there are zero runtime dependencies. The package ships
64
- dual ESM and CJS builds with type declarations for both conditions, so `import` and `require` each
65
- resolve to the artifact meant for them.
64
+ Node.js 22 or later, tested on 22, 24, and 26: the engine floor is `>=22.0.0`, and there are zero
65
+ runtime dependencies. The package ships dual ESM and CJS builds with type declarations for both
66
+ conditions, so `import` and `require` each resolve to the artifact meant for them.
66
67
 
67
68
  ## Usage
68
69
 
69
70
  Parse an 835 remittance advice and read the money: the payment total, the claim's
70
71
  charge/paid/patient-responsibility split, and the adjustment reason behind the difference. The
71
- interchange below is synthetic, with a fabricated payer, provider, patient and amounts.
72
+ interchange below is synthetic, with a fabricated payer, provider, patient, and amounts.
72
73
 
73
74
  ```ts runnable
74
75
  import { parseX12, get835 } from "@cosyte/x12";
@@ -139,38 +140,6 @@ warnings 0
139
140
  The `groupCode` is what tells you who owes the money (`PR` patient responsibility, `CO` contractual
140
141
  obligation, and so on). Read it; never infer it.
141
142
 
142
- ## PHI and safety
143
-
144
- X12 healthcare transactions carry protected health information, so treat every interchange you hand
145
- this library as PHI.
146
-
147
- **What it does with your document.** It decodes it in memory and nothing else. No socket is opened,
148
- nothing is written to disk, and nothing is fetched at run time: the bundled code lists are versioned
149
- data snapshots, so updating one is a release rather than a network call. The acknowledgment builders
150
- are pure functions and never auto-send.
151
-
152
- **What it keeps out of diagnostics.** A warning `message` is a lookup into a frozen registry rather
153
- than something built from your document, and no warning factory in this library takes a value
154
- parameter, so no element of yours can reach a diagnostic. The code and the `position` say what and
155
- where; the bytes stay on the model. `ALL_WARNING_MESSAGES` is exported so you can assert that.
156
-
157
- **The one deliberate exception.** `X12ParseError.snippet` on the four structural fatals is a bounded
158
- copy of the start of the input, so on real traffic it can carry PHI, and it is not redacted. Log
159
- `err.code` and `err.position` instead, or redact at your call site.
160
-
161
- **An attachment refuses to print.** The data of each BDS a 275 carries is read into
162
- `X12AttachmentData`, whose string, JSON and `util.inspect` forms state its octet count and nothing
163
- else; `readOctets()` is the one route to the octets.
164
-
165
- **Builder refusals are a weaker surface, deliberately.** A `build*` refusal names the control
166
- number, count or code you passed in, so that you can see what was refused. The rendered fragment is
167
- bounded by an exported constant, but it is bounded rather than redacted. The two attachments
168
- builders are the exception and name no value at all. Log `err.code`, not `err.message`, from a
169
- builder.
170
-
171
- **What you still own.** Transport, storage, retention, access control, audit logging, and every log
172
- line your own code writes. This library makes no HIPAA compliance claim on your behalf.
173
-
174
143
  ## API
175
144
 
176
145
  Everything ships from one entry point; there are no subpath imports.
@@ -184,7 +153,7 @@ Everything ships from one entry point; there are no subpath imports.
184
153
  (`X12_NO_ISA_HEADER`, `X12_ISA_TOO_SHORT`, `X12_INVALID_DELIMITERS`, `X12_EMPTY_INPUT`).
185
154
  Everything else arrives on `ix.warnings` as a stable code with positional context, so a tolerated
186
155
  deviation is visible rather than silent.
187
- - **Money.** Every monetary, percent and quantity field decodes as `X12Decimal`, which is
156
+ - **Money.** Every monetary, percent, and quantity field decodes as `X12Decimal`, which is
188
157
  string-backed with BigInt arithmetic, and this library never **`parseFloat`s** an EDI amount. A
189
158
  slot the sender left empty reads `undefined` rather than zero, so "stated zero" and "stated
190
159
  nothing" stay different readings.
@@ -201,7 +170,7 @@ Task-oriented recipes are in the [cookbook](./docs-content/cookbook.md), and
201
170
  ### Dates and times
202
171
 
203
172
  Every typed reader surfaces its dates verbatim, as the qualifier the sender used plus the bytes it
204
- carried. `toObject`, `toISO` and `toDate` are the three ways to read one, and every `@cosyte/*`
173
+ carried. `toObject`, `toISO`, and `toDate` are the three ways to read one, and every `@cosyte/*`
205
174
  parser exports the same three names with the same shapes and the same timezone rule.
206
175
 
207
176
  ```ts
@@ -247,10 +216,10 @@ than the JavaScript `Date` 0 to 11, so `Object.keys()` of the result tells you t
247
216
  `DateTime.fromObject` with no renaming. Neither library is a dependency here; this package still has
248
217
  zero of those.
249
218
 
250
- `parseDocumentDate`, which reads the document date for the date-aware code-list queries, keeps its
251
- own contract and still THROWS on input it refuses. That divergence is deliberate: it answers a
252
- caller who asked a validity question and could not state the day, while these three read a document
253
- that was already parsed leniently.
219
+ The date-aware code-list queries, `checkCarcValidity` and `checkRarcValidity`, keep their own
220
+ contract and still THROW an `X12CodeListError` on a document date they refuse. That divergence is
221
+ deliberate: they answer a caller who asked a validity question and could not state the day, while
222
+ these three read a document that was already parsed leniently.
254
223
 
255
224
  #### Using two @cosyte parsers in one file
256
225
 
@@ -269,38 +238,106 @@ A namespace import works too: `import * as x12 from "@cosyte/x12"`, then `x12.to
269
238
  ## Compatibility
270
239
 
271
240
  - **005010 HIPAA transaction sets**, with hooks for the errata revisions the industry actually
272
- exchanges. Non-healthcare sets such as 850, 856, 810 and 204, plus EDIFACT, AS2 and SFTP
241
+ exchanges. Non-healthcare sets such as 850, 856, 810, and 204, plus EDIFACT, AS2, and SFTP
273
242
  transport, and pre-005010 revisions, are out of scope.
274
243
  - **Vendor deviations become warnings, not exceptions.** Built-in profiles record whose
275
244
  companion-guide deviation they accommodate; selecting one never changes an otherwise correct
276
245
  parse, and profiles are authored through the same public `defineProfile()` API you have.
277
246
  - **Round trips are not byte-exact in general.** `serializeX12` reproduces the segments on the model
278
- verbatim, including element padding, composites and `?`-release escapes, but
247
+ verbatim, including element padding, composites, and `?`-release escapes, but
279
248
  **`serialize(parse(s)) === s` is not guaranteed in general**. Line breaks between segments are the
280
249
  common case: any run of CR or LF between segments is absorbed at parse, so a pretty-printed file
281
250
  emits compact. Most of the constructs that break a round trip are silent, so "my file has no line
282
251
  breaks" is not sufficient either. [KNOWN-LIMITATIONS.md](./KNOWN-LIMITATIONS.md) is the canonical
283
252
  list.
284
253
 
254
+ ## Documentation
255
+
256
+ The full documentation lives at [docs.cosyte.com/x12](https://docs.cosyte.com/x12), built from this
257
+ repository's [`docs-content/`](https://github.com/cosyte/x12/tree/main/docs-content). Start with
258
+ these pages:
259
+
260
+ - [Quickstart](https://github.com/cosyte/x12/blob/main/docs-content/quickstart.md): read an 835
261
+ and pull out the payment, each claim's money, and the adjustment reasons.
262
+ - [The 80/20 transaction sets](https://github.com/cosyte/x12/blob/main/docs-content/spec-notes-transaction-sets.md):
263
+ every transaction set this package covers, with its reader and its builder.
264
+ - [Decimal-exact money](https://github.com/cosyte/x12/blob/main/docs-content/spec-notes-money.md):
265
+ why every amount is an `X12Decimal` and never a JavaScript number.
266
+ - [Building and serializing X12](https://github.com/cosyte/x12/blob/main/docs-content/emit-and-serialize.md):
267
+ the emit side, from `serializeX12` to the domain builders.
268
+ - [Cookbook](https://github.com/cosyte/x12/blob/main/docs-content/cookbook.md): recipes for the
269
+ transactions you get handed, each with the code and what comes back.
270
+ - [Troubleshooting](https://github.com/cosyte/x12/blob/main/docs-content/troubleshooting.md): the
271
+ error model, the common symptoms, and the boundaries this package states on purpose.
272
+
273
+ ## Support
274
+
275
+ Questions and ideas go to [Discussions](https://github.com/cosyte/.github/discussions), which
276
+ covers every Cosyte repository. Bug reports and trading-partner quirks go to the
277
+ [issue tracker](https://github.com/cosyte/x12/issues), with a synthetic reproduction and never a
278
+ real interchange. The organization's
279
+ [support guide](https://github.com/cosyte/.github/blob/main/SUPPORT.md) has the rest.
280
+
281
+ ## Security
282
+
283
+ Report a vulnerability privately, as the
284
+ [security policy](https://github.com/cosyte/.github/blob/main/SECURITY.md) describes, never in a
285
+ public issue.
286
+
287
+ ## PHI and safety
288
+
289
+ X12 healthcare transactions carry protected health information, so treat every interchange you hand
290
+ this library as PHI.
291
+
292
+ **What it does with your document.** It decodes it in memory and nothing else. No socket is opened,
293
+ nothing is written to disk, and nothing is fetched at run time: the bundled code lists are versioned
294
+ data snapshots, so updating one is a release rather than a network call. The acknowledgment builders
295
+ are pure functions and never auto-send.
296
+
297
+ **What it keeps out of diagnostics.** A warning `message` is a lookup into a frozen registry rather
298
+ than something built from your document, and no warning factory in this library takes a value
299
+ parameter, so no element of yours can reach a diagnostic. The code and the `position` say what and
300
+ where; the bytes stay on the model. `ALL_WARNING_MESSAGES` is exported so you can assert that.
301
+
302
+ **The one deliberate exception.** `X12ParseError.snippet` on the four structural fatals is a bounded
303
+ copy of the start of the input, so on real traffic it can carry PHI, and it is not redacted. Log
304
+ `err.code` and `err.position` instead, or redact at your call site.
305
+
306
+ **An attachment refuses to print.** The data of each BDS a 275 carries is read into
307
+ `X12AttachmentData`, whose string, JSON, and `util.inspect` forms state its octet count and nothing
308
+ else; `readOctets()` is the one route to the octets.
309
+
310
+ **Builder refusals are a weaker surface, deliberately.** A `build*` refusal names the control
311
+ number, count, or code you passed in, so that you can see what was refused. The rendered fragment is
312
+ bounded by an exported constant, but it is bounded rather than redacted. The two attachments
313
+ builders are the exception and name no value at all. Log `err.code`, not `err.message`, from a
314
+ builder.
315
+
316
+ **What you still own.** Transport, storage, retention, access control, audit logging, and every log
317
+ line your own code writes. This library makes no HIPAA compliance claim on your behalf.
318
+
285
319
  ## Contributing
286
320
 
287
- Questions, bug reports and trading-partner quirks all belong in
288
- [GitHub issues](https://github.com/cosyte/x12/issues).
321
+ Bug reports and trading-partner quirks belong in
322
+ [GitHub issues](https://github.com/cosyte/x12/issues), as Support says above.
289
323
 
290
- Pull requests are welcome. A contribution must clear `pnpm typecheck`, `pnpm lint` and `pnpm test`,
291
- hold the per-directory coverage floors, pass the PHI commit gate (`pnpm phi-scan`) and the prose
292
- gates (`pnpm check:no-emdash`, `pnpm check:no-internal-refs`), and carry a changeset. Every fixture
293
- must be synthetic: never open a pull request carrying a real patient's data.
324
+ Pull requests are welcome. The organization's
325
+ [contributing guide](https://github.com/cosyte/.github/blob/main/CONTRIBUTING.md) and
326
+ [code of conduct](https://github.com/cosyte/.github/blob/main/CODE_OF_CONDUCT.md) apply here. A
327
+ contribution must clear `pnpm typecheck`, `pnpm lint`, and `pnpm test`, hold the per-directory
328
+ coverage floors, pass the PHI commit gate (`pnpm phi-scan`) and the prose gates
329
+ (`pnpm check:no-emdash`, `pnpm check:no-internal-refs`), and carry a changeset. Every fixture must
330
+ be synthetic: never open a pull request carrying a real patient's data.
294
331
 
295
332
  ## Trademarks
296
333
 
297
334
  Availity and Blue Cross Blue Shield are trademarks of their respective owners. Cosyte is not
298
335
  affiliated with, endorsed by, or sponsored by any of them. The names identify the trading partners
299
336
  whose companion-guide deviations the built-in profiles accommodate. See
300
- [TRADEMARKS.md](./TRADEMARKS.md).
337
+ [TRADEMARKS.md](https://github.com/cosyte/x12/blob/main/TRADEMARKS.md).
301
338
 
302
339
  ## License
303
340
 
304
- MIT, copyright Cosyte. See [LICENSE](./LICENSE).
341
+ MIT, Copyright (c) 2026 Cosyte LLC. See [LICENSE](https://github.com/cosyte/x12/blob/main/LICENSE).
305
342
 
306
343
  Built by [Cosyte](https://cosyte.com).
package/dist/index.cjs CHANGED
@@ -15395,7 +15395,7 @@ var profiles = Object.freeze({
15395
15395
  });
15396
15396
 
15397
15397
  // src/index.ts
15398
- var VERSION = "0.1.2";
15398
+ var VERSION = "0.1.4";
15399
15399
 
15400
15400
  exports.AAA_CONDITION_LEVELS = AAA_CONDITION_LEVELS;
15401
15401
  exports.AAA_FOLLOW_UP_ACTION_CODES = AAA_FOLLOW_UP_ACTION_CODES;