@cosyte/x12 0.1.2 → 0.1.3
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 +30 -4
- package/LICENSE +1 -1
- package/README.md +25 -22
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +27 -20
- package/dist/index.d.ts +27 -20
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,11 +1,37 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## 0.1.3
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
5
|
+
### Patch Changes
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
- 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.
|
|
8
|
+
|
|
9
|
+
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.
|
|
10
|
+
|
|
11
|
+
- dca2a3b: The README and documentation now use US spelling and serial commas, and write pauses without spaced hyphens.
|
|
12
|
+
|
|
13
|
+
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.
|
|
14
|
+
|
|
15
|
+
## 0.1.2
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Doc comments now write number ranges with "to" instead of an en dash.
|
|
20
|
+
|
|
21
|
+
## Released before this file was generated
|
|
22
|
+
|
|
23
|
+
Every release section above this heading is written by
|
|
24
|
+
[Changesets](https://github.com/changesets/changesets) from the changesets in `.changeset/`, newest
|
|
25
|
+
release first. The release writes its own version heading, so nothing above this line is maintained
|
|
26
|
+
by hand, and a change is recorded by adding a changeset rather than by editing this file. The 0.1.2
|
|
27
|
+
section was filled in from that release's GitHub release notes when generation was turned on, since
|
|
28
|
+
0.1.2 shipped while this file was still kept by hand and it was never written here.
|
|
29
|
+
|
|
30
|
+
Everything below this heading was maintained by hand, in the
|
|
31
|
+
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/) format, and is left as it was written. Two
|
|
32
|
+
things were dropped: the preamble above it, which said the file was kept by hand, and an empty
|
|
33
|
+
`[Unreleased]` heading. The `[0.1.0]` section holds every entry written before the first 0.1
|
|
34
|
+
release, the `0.0.x` releases included, which the file never recorded one by one.
|
|
9
35
|
|
|
10
36
|
## [0.1.1] - 2026-10-07
|
|
11
37
|
|
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -7,11 +7,11 @@
|
|
|
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
|
[](https://www.npmjs.com/package/@cosyte/x12)
|
|
13
13
|
[](https://github.com/cosyte/x12/actions/workflows/ci.yml)
|
|
14
|
-
[](
|
|
14
|
+
[](https://github.com/cosyte/x12/blob/main/LICENSE)
|
|
15
15
|
[](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.
|
|
@@ -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,12 +31,12 @@ a stable code instead of failing or guessing.
|
|
|
31
31
|
|
|
32
32
|
## Status
|
|
33
33
|
|
|
34
|
-
**
|
|
34
|
+
**The 0.1 line**, published on npm from a public repository.
|
|
35
35
|
|
|
36
|
-
|
|
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
|
|
39
|
+
its migration. On an older 0.0 release, pin an exact version rather than a range. Typed read and typed
|
|
40
40
|
emit both ship for every transaction set
|
|
41
41
|
this package covers: 270, 271, 276, 277 and 277CA, 278 request and response, 820, 834, 835, 837P,
|
|
42
42
|
837I and 837D, 999 and TA1, each with a reader and a matching domain builder, and the two claims
|
|
@@ -60,7 +60,8 @@ pnpm add @cosyte/x12
|
|
|
60
60
|
|
|
61
61
|
`npm install @cosyte/x12` and `yarn add @cosyte/x12` work the same way.
|
|
62
62
|
|
|
63
|
-
Node
|
|
63
|
+
Node.js 22 or later, tested on 22 and 24: the engine floor is `>=22.0.0`, and there are zero
|
|
64
|
+
runtime dependencies. The package ships
|
|
64
65
|
dual ESM and CJS builds with type declarations for both conditions, so `import` and `require` each
|
|
65
66
|
resolve to the artifact meant for them.
|
|
66
67
|
|
|
@@ -68,7 +69,7 @@ resolve to the artifact meant for them.
|
|
|
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";
|
|
@@ -159,11 +160,11 @@ copy of the start of the input, so on real traffic it can carry PHI, and it is n
|
|
|
159
160
|
`err.code` and `err.position` instead, or redact at your call site.
|
|
160
161
|
|
|
161
162
|
**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
|
+
`X12AttachmentData`, whose string, JSON, and `util.inspect` forms state its octet count and nothing
|
|
163
164
|
else; `readOctets()` is the one route to the octets.
|
|
164
165
|
|
|
165
166
|
**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
|
+
number, count, or code you passed in, so that you can see what was refused. The rendered fragment is
|
|
167
168
|
bounded by an exported constant, but it is bounded rather than redacted. The two attachments
|
|
168
169
|
builders are the exception and name no value at all. Log `err.code`, not `err.message`, from a
|
|
169
170
|
builder.
|
|
@@ -184,7 +185,7 @@ Everything ships from one entry point; there are no subpath imports.
|
|
|
184
185
|
(`X12_NO_ISA_HEADER`, `X12_ISA_TOO_SHORT`, `X12_INVALID_DELIMITERS`, `X12_EMPTY_INPUT`).
|
|
185
186
|
Everything else arrives on `ix.warnings` as a stable code with positional context, so a tolerated
|
|
186
187
|
deviation is visible rather than silent.
|
|
187
|
-
- **Money.** Every monetary, percent and quantity field decodes as `X12Decimal`, which is
|
|
188
|
+
- **Money.** Every monetary, percent, and quantity field decodes as `X12Decimal`, which is
|
|
188
189
|
string-backed with BigInt arithmetic, and this library never **`parseFloat`s** an EDI amount. A
|
|
189
190
|
slot the sender left empty reads `undefined` rather than zero, so "stated zero" and "stated
|
|
190
191
|
nothing" stay different readings.
|
|
@@ -201,7 +202,7 @@ Task-oriented recipes are in the [cookbook](./docs-content/cookbook.md), and
|
|
|
201
202
|
### Dates and times
|
|
202
203
|
|
|
203
204
|
Every typed reader surfaces its dates verbatim, as the qualifier the sender used plus the bytes it
|
|
204
|
-
carried. `toObject`, `toISO
|
|
205
|
+
carried. `toObject`, `toISO`, and `toDate` are the three ways to read one, and every `@cosyte/*`
|
|
205
206
|
parser exports the same three names with the same shapes and the same timezone rule.
|
|
206
207
|
|
|
207
208
|
```ts
|
|
@@ -247,10 +248,10 @@ than the JavaScript `Date` 0 to 11, so `Object.keys()` of the result tells you t
|
|
|
247
248
|
`DateTime.fromObject` with no renaming. Neither library is a dependency here; this package still has
|
|
248
249
|
zero of those.
|
|
249
250
|
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
caller who asked a validity question and could not state the day, while
|
|
253
|
-
that was already parsed leniently.
|
|
251
|
+
The date-aware code-list queries, `checkCarcValidity` and `checkRarcValidity`, keep their own
|
|
252
|
+
contract and still THROW an `X12CodeListError` on a document date they refuse. That divergence is
|
|
253
|
+
deliberate: they answer a caller who asked a validity question and could not state the day, while
|
|
254
|
+
these three read a document that was already parsed leniently.
|
|
254
255
|
|
|
255
256
|
#### Using two @cosyte parsers in one file
|
|
256
257
|
|
|
@@ -269,13 +270,13 @@ A namespace import works too: `import * as x12 from "@cosyte/x12"`, then `x12.to
|
|
|
269
270
|
## Compatibility
|
|
270
271
|
|
|
271
272
|
- **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
|
|
273
|
+
exchanges. Non-healthcare sets such as 850, 856, 810, and 204, plus EDIFACT, AS2, and SFTP
|
|
273
274
|
transport, and pre-005010 revisions, are out of scope.
|
|
274
275
|
- **Vendor deviations become warnings, not exceptions.** Built-in profiles record whose
|
|
275
276
|
companion-guide deviation they accommodate; selecting one never changes an otherwise correct
|
|
276
277
|
parse, and profiles are authored through the same public `defineProfile()` API you have.
|
|
277
278
|
- **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
|
|
279
|
+
verbatim, including element padding, composites, and `?`-release escapes, but
|
|
279
280
|
**`serialize(parse(s)) === s` is not guaranteed in general**. Line breaks between segments are the
|
|
280
281
|
common case: any run of CR or LF between segments is absorbed at parse, so a pretty-printed file
|
|
281
282
|
emits compact. Most of the constructs that break a round trip are silent, so "my file has no line
|
|
@@ -284,10 +285,12 @@ A namespace import works too: `import * as x12 from "@cosyte/x12"`, then `x12.to
|
|
|
284
285
|
|
|
285
286
|
## Contributing
|
|
286
287
|
|
|
287
|
-
Questions, bug reports and trading-partner quirks all belong in
|
|
288
|
+
Questions, bug reports, and trading-partner quirks all belong in
|
|
288
289
|
[GitHub issues](https://github.com/cosyte/x12/issues).
|
|
289
290
|
|
|
290
|
-
Pull requests are welcome.
|
|
291
|
+
Pull requests are welcome. The organization's
|
|
292
|
+
[contributing guide](https://github.com/cosyte/.github/blob/main/CONTRIBUTING.md) and
|
|
293
|
+
[code of conduct](https://github.com/cosyte/.github/blob/main/CODE_OF_CONDUCT.md) apply here. A contribution must clear `pnpm typecheck`, `pnpm lint`, and `pnpm test`,
|
|
291
294
|
hold the per-directory coverage floors, pass the PHI commit gate (`pnpm phi-scan`) and the prose
|
|
292
295
|
gates (`pnpm check:no-emdash`, `pnpm check:no-internal-refs`), and carry a changeset. Every fixture
|
|
293
296
|
must be synthetic: never open a pull request carrying a real patient's data.
|
|
@@ -297,10 +300,10 @@ must be synthetic: never open a pull request carrying a real patient's data.
|
|
|
297
300
|
Availity and Blue Cross Blue Shield are trademarks of their respective owners. Cosyte is not
|
|
298
301
|
affiliated with, endorsed by, or sponsored by any of them. The names identify the trading partners
|
|
299
302
|
whose companion-guide deviations the built-in profiles accommodate. See
|
|
300
|
-
[TRADEMARKS.md](
|
|
303
|
+
[TRADEMARKS.md](https://github.com/cosyte/x12/blob/main/TRADEMARKS.md).
|
|
301
304
|
|
|
302
305
|
## License
|
|
303
306
|
|
|
304
|
-
MIT,
|
|
307
|
+
MIT, Copyright (c) 2026 Cosyte LLC. See [LICENSE](https://github.com/cosyte/x12/blob/main/LICENSE).
|
|
305
308
|
|
|
306
309
|
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.
|
|
15398
|
+
var VERSION = "0.1.3";
|
|
15399
15399
|
|
|
15400
15400
|
exports.AAA_CONDITION_LEVELS = AAA_CONDITION_LEVELS;
|
|
15401
15401
|
exports.AAA_FOLLOW_UP_ACTION_CODES = AAA_FOLLOW_UP_ACTION_CODES;
|