@cosyte/synth 0.1.7 → 0.1.8

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,5 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.8
4
+
5
+ ### Patch Changes
6
+
7
+ - 2f6dff4: `engines.node` is now `>=22.12.0`, where it was `>=22.0.0`. Since 0.1.6 a generator loads its parser on first use through `require`, and Node.js loads an ES module that way by default only from 22.12. On 22.0 to 22.11 the ES module build fell back to the parser's CommonJS entry, so a value it returned was an instance of a second copy of the parser's classes and `instanceof` against a class imported with `import` was false. The 0.1.6 entry said a returned value was an instance of the classes your code imports; that holds on 22.12 and later, and CI now runs the built package's smoke, which checks `instanceof` under `import` and `require`, on Node.js 22.12.0 itself. If you run Node.js 22.0 to 22.11, upgrade to 22.12 or later. npm warns about the engines range by default and refuses the install only with `engine-strict`.
8
+
9
+ If you bundle code that uses `@cosyte/synth`, mark `@cosyte/synth` and each `@cosyte/*` parser you use as external (esbuild `--external:@cosyte/*`, Rollup `external`, webpack `externals`) and install them beside the bundle. A bundler cannot follow the first-use load, so a bundle that inlines a parser holds a second copy of it, and one that omits a parser fails with "Cannot find module" on the first call that needs it.
10
+
11
+ No generated value, export, warning code or seed mapping changes.
12
+
13
+ - dd2b762: Every artifact now says it is test data, in the field its standard gives for that, so a generated fixture that ends up somewhere real can be told apart from production data. HL7 v2 messages declared processing ID `P` (production) in MSH-11; X12 already set ISA-15 to `T`.
14
+
15
+ Output change: HL7 v2 messages set MSH-11 to `T` where it was `P`. Every FHIR resource, every resource inside a Bundle and the Bundle itself carry `meta.security` with the `HTEST` ("test health data") code from `http://terminology.hl7.org/CodeSystem/v3-ActReason`, so a resource built with `usCore: false` and a base Patient now carry a `meta` too, and the document Bundle's Organization and Composition carry one. ASTM messages set the header's processing ID (H.12) to `T`, so the `H` record gains the empty fields H.6 to H.11 before it. C-CDA, X12 and NCPDP output is unchanged. A golden file committed from an earlier release for HL7 v2, FHIR or ASTM has to be regenerated.
16
+
17
+ The marker is always on: there is no option to turn it off. The exported `meta(profiles)` helper in `@cosyte/synth/fhir` now adds the `HTEST` label as well, and accepts an empty list, which leaves `meta.profile` out. If your code reads `meta` from a generated resource and expected only `profile`, read `meta.profile` by name.
18
+
3
19
  ## 0.1.7
4
20
 
5
21
  ### Patch Changes
package/README.md CHANGED
@@ -12,7 +12,7 @@
12
12
  [![npm version](https://img.shields.io/npm/v/@cosyte/synth.svg)](https://www.npmjs.com/package/@cosyte/synth)
13
13
  [![CI](https://img.shields.io/github/actions/workflow/status/cosyte/synth/ci.yml?branch=main&label=CI)](https://github.com/cosyte/synth/actions/workflows/ci.yml)
14
14
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/cosyte/synth/blob/main/LICENSE)
15
- [![Node](https://img.shields.io/badge/node-%3E%3D22.0.0-brightgreen.svg)](https://nodejs.org)
15
+ [![Node](https://img.shields.io/badge/node-%3E%3D22.12.0-brightgreen.svg)](https://nodejs.org)
16
16
 
17
17
  Deterministic, seedable synthetic healthcare test fixtures for Node.js and TypeScript: HL7 v2, FHIR R4 and US Core, C-CDA, X12, NCPDP, and ASTM, spec-clean by construction and never real PHI.
18
18
 
@@ -57,7 +57,13 @@ pairing (no `@cosyte/deid` adapter, or not generated); and optional **Synthea**
57
57
  npm install @cosyte/synth @cosyte/hl7 @cosyte/fhir @cosyte/ccda @cosyte/x12 @cosyte/ncpdp @cosyte/astm
58
58
  ```
59
59
 
60
- Node.js 22 or later, tested on 22, 24, and 26.
60
+ Node.js 22.12 or later, tested on 22.12, 22, 24, and 26. A generator loads its parser on first use
61
+ through `require`, and Node.js loads an ES module that way only from 22.12, so a value you get back
62
+ is an instance of the parser classes you import.
63
+
64
+ **Bundling.** A bundler cannot see that load. If you bundle code that uses `@cosyte/synth`, mark
65
+ `@cosyte/synth` and every `@cosyte/*` parser you use as external (esbuild `--external:@cosyte/*`,
66
+ Rollup and Vite `external`, webpack `externals`) and install them beside the bundle.
61
67
 
62
68
  `@cosyte/hl7`, `@cosyte/fhir`, `@cosyte/ccda`, `@cosyte/x12`, `@cosyte/ncpdp`, `@cosyte/astm`, and
63
69
  `@cosyte/deid` are **optional peer dependencies**, each needed only for its subpath (`@cosyte/synth/hl7`,
@@ -666,8 +666,10 @@ function buildResultInput(options) {
666
666
  records.push({ type: "C", source: "L", text: rng.pick(ASTM_COMMENT_TEXT), commentType: "G" });
667
667
  }
668
668
  return {
669
- // H.3 (message control id) and H.4 (access password) stay empty; H.5 is the sender name.
670
- header: { fields: ["", "", head.sender] },
669
+ // H.3 (message control id) and H.4 (access password) stay empty; H.5 is the sender name. H.6 to
670
+ // H.11 stay empty, and H.12, the processing ID, is `T` (training), never `P` (production): every
671
+ // message says it is test data in the field the standard gives for it.
672
+ header: { fields: ["", "", head.sender, "", "", "", "", "", "", "T"] },
671
673
  records,
672
674
  terminationCode: "N"
673
675
  };