@cosyte/synth 0.0.7 → 0.0.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.
Files changed (57) hide show
  1. package/CHANGELOG.md +135 -17
  2. package/README.md +47 -45
  3. package/dist/astm/index.cjs +7 -7
  4. package/dist/astm/index.cjs.map +1 -1
  5. package/dist/astm/index.d.cts +47 -47
  6. package/dist/astm/index.d.ts +47 -47
  7. package/dist/astm/index.mjs +7 -7
  8. package/dist/astm/index.mjs.map +1 -1
  9. package/dist/ccda/index.cjs +15 -15
  10. package/dist/ccda/index.cjs.map +1 -1
  11. package/dist/ccda/index.d.cts +31 -31
  12. package/dist/ccda/index.d.ts +31 -31
  13. package/dist/ccda/index.mjs +15 -15
  14. package/dist/ccda/index.mjs.map +1 -1
  15. package/dist/deid/index.cjs +15 -15
  16. package/dist/deid/index.cjs.map +1 -1
  17. package/dist/deid/index.d.cts +37 -37
  18. package/dist/deid/index.d.ts +37 -37
  19. package/dist/deid/index.mjs +15 -15
  20. package/dist/deid/index.mjs.map +1 -1
  21. package/dist/{example-codes-DeXcnCSK.d.cts → example-codes-88f3_bQZ.d.cts} +8 -8
  22. package/dist/{example-codes-DeXcnCSK.d.ts → example-codes-88f3_bQZ.d.ts} +8 -8
  23. package/dist/fhir/index.cjs +12 -12
  24. package/dist/fhir/index.cjs.map +1 -1
  25. package/dist/fhir/index.d.cts +46 -46
  26. package/dist/fhir/index.d.ts +46 -46
  27. package/dist/fhir/index.mjs +12 -12
  28. package/dist/fhir/index.mjs.map +1 -1
  29. package/dist/hl7/index.cjs +6 -6
  30. package/dist/hl7/index.cjs.map +1 -1
  31. package/dist/hl7/index.d.cts +45 -45
  32. package/dist/hl7/index.d.ts +45 -45
  33. package/dist/hl7/index.mjs +6 -6
  34. package/dist/hl7/index.mjs.map +1 -1
  35. package/dist/index.cjs +9 -9
  36. package/dist/index.cjs.map +1 -1
  37. package/dist/index.d.cts +49 -49
  38. package/dist/index.d.ts +49 -49
  39. package/dist/index.mjs +9 -9
  40. package/dist/index.mjs.map +1 -1
  41. package/dist/ncpdp/index.cjs +3 -3
  42. package/dist/ncpdp/index.cjs.map +1 -1
  43. package/dist/ncpdp/index.d.cts +42 -42
  44. package/dist/ncpdp/index.d.ts +42 -42
  45. package/dist/ncpdp/index.mjs +3 -3
  46. package/dist/ncpdp/index.mjs.map +1 -1
  47. package/dist/{providers-OLz3zAc-.d.cts → providers-B9uVinAe.d.cts} +24 -24
  48. package/dist/{providers-OLz3zAc-.d.ts → providers-B9uVinAe.d.ts} +24 -24
  49. package/dist/{quirk-C9t9CkPS.d.ts → quirk-HZdznAkM.d.ts} +23 -23
  50. package/dist/{quirk-DYMDojVw.d.cts → quirk-IaHp4z7N.d.cts} +23 -23
  51. package/dist/x12/index.cjs +6 -6
  52. package/dist/x12/index.cjs.map +1 -1
  53. package/dist/x12/index.d.cts +44 -44
  54. package/dist/x12/index.d.ts +44 -44
  55. package/dist/x12/index.mjs +6 -6
  56. package/dist/x12/index.mjs.map +1 -1
  57. package/package.json +3 -2
@@ -1,7 +1,7 @@
1
- import { m as SynthFormat } from './providers-OLz3zAc-.cjs';
1
+ import { m as SynthFormat } from './providers-B9uVinAe.cjs';
2
2
 
3
3
  /**
4
- * `defineSynthProfile` — the growth-loop hook for site/vendor fixture recipes. A profile bundles the
4
+ * `defineSynthProfile`: the growth-loop hook for site/vendor fixture recipes. A profile bundles the
5
5
  * value pools and the quirk recipe a fixture set should use, authored through the same public API as
6
6
  * the built-ins: a validated, frozen `SynthProfile` carrying a name, optional value overrides, and the
7
7
  * quirk names a format's quirk corpus should apply.
@@ -12,7 +12,7 @@ import { m as SynthFormat } from './providers-OLz3zAc-.cjs';
12
12
  interface SynthProfileSpec {
13
13
  /** A stable, human-readable profile name (e.g. `"acme-hospital"`). Required, non-empty. */
14
14
  readonly name: string;
15
- /** Optional given-name pool override (clearly-synthetic names only — see the safety invariant). */
15
+ /** Optional given-name pool override (clearly-synthetic names only, see the safety invariant). */
16
16
  readonly givenNames?: readonly string[];
17
17
  /** Optional family-name pool override (clearly-synthetic names only). */
18
18
  readonly familyNames?: readonly string[];
@@ -52,9 +52,9 @@ declare function defineSynthProfile(spec: SynthProfileSpec): SynthProfile;
52
52
  * The **quirk core**. Where the spec-clean generators prove
53
53
  * *synthetic-by-construction* through each parser's own builder, the quirk layer proves the mirror
54
54
  * property: a **deliberately off-spec** fixture round-trips to **exactly the intended parser warning
55
- * code(s)** — no more, no fewer. The quirk vocabulary **is the parsers' own profile systems**
55
+ * code(s)**, no more, no fewer. The quirk vocabulary **is the parsers' own profile systems**
56
56
  * (`hl7.defineProfile`, `ccda.defineCcdaProfile`, `astm.defineAstmProfile`): a quirk exercises exactly
57
- * the tolerance the corresponding parser profile encodes, so a quirk fixture is never a fiction — it
57
+ * the tolerance the corresponding parser profile encodes, so a quirk fixture is never a fiction, it
58
58
  * targets a documented, coded leniency (the **intended-warning contract**).
59
59
  *
60
60
  * This module is the **format-agnostic** part: the descriptor a quirk carries, the artifact a quirk
@@ -65,25 +65,25 @@ declare function defineSynthProfile(spec: SynthProfileSpec): SynthProfile;
65
65
  */
66
66
 
67
67
  /**
68
- * How the parser's matching profile treats a quirk once it is active — the three shapes the parsers'
68
+ * How the parser's matching profile treats a quirk once it is active: the three shapes the parsers'
69
69
  * profile systems actually exhibit (verified firsthand against each parser):
70
70
  *
71
- * - `"suppressed"` — the profile makes the warning **disappear** (HL7 v2: a `defineProfile`
71
+ * - `"suppressed"`, the profile makes the warning **disappear** (HL7 v2: a `defineProfile`
72
72
  * `customSegments` claim suppresses `UNKNOWN_SEGMENT` for a declared Z-segment).
73
- * - `"rebadged"` — the profile **downgrades** the warning to the value-free `PROFILE_QUIRK_APPLIED`
73
+ * - `"rebadged"`, the profile **downgrades** the warning to the value-free `PROFILE_QUIRK_APPLIED`
74
74
  * marker with `expected: true` (C-CDA `defineCcdaProfile` / ASTM `defineAstmProfile`
75
75
  * `profileQuirkApplied`).
76
- * - `"bare"` — no shipped profile tolerates it; the quirk targets a real coded leniency a consumer can
76
+ * - `"bare"`, no shipped profile tolerates it; the quirk targets a real coded leniency a consumer can
77
77
  * tolerate via their own `defineProfile`/`defineAstmProfile`, but no built-in re-badges it.
78
78
  */
79
79
  type QuirkProfileDisposition = "suppressed" | "rebadged" | "bare";
80
80
  /**
81
81
  * The stable, value-free re-badge code the C-CDA and ASTM parsers emit when a profile tolerates a
82
- * quirk. HL7 v2 has no equivalent (it suppresses instead — see {@link QuirkProfileDisposition}).
82
+ * quirk. HL7 v2 has no equivalent (it suppresses instead: see {@link QuirkProfileDisposition}).
83
83
  */
84
84
  declare const PROFILE_QUIRK_APPLIED = "PROFILE_QUIRK_APPLIED";
85
85
  /**
86
- * A public, grounded description of one vendor quirk — the metadata that binds a quirk recipe to a real
86
+ * A public, grounded description of one vendor quirk: the metadata that binds a quirk recipe to a real
87
87
  * parser warning code and a **publicly-groundable** deviation (cited-public, never a private
88
88
  * vendor corpus).
89
89
  */
@@ -93,12 +93,12 @@ interface QuirkDescriptor {
93
93
  /** The format this quirk applies to. */
94
94
  readonly format: SynthFormat;
95
95
  /**
96
- * The **exact** parser warning code(s) a bare parse (no profile) surfaces for this quirk — the
96
+ * The **exact** parser warning code(s) a bare parse (no profile) surfaces for this quirk, the
97
97
  * intended-warning contract. A quirk that produces any other code, or none, is a generation bug.
98
98
  */
99
99
  readonly intendedWarnings: readonly string[];
100
100
  /**
101
- * The **public** grounding for this quirk — the spec clause or the parser's public profile that
101
+ * The **public** grounding for this quirk, the spec clause or the parser's public profile that
102
102
  * documents the tolerance. Never a private vendor-attributed corpus.
103
103
  */
104
104
  readonly grounding: string;
@@ -107,7 +107,7 @@ interface QuirkDescriptor {
107
107
  /** How {@link toleratingProfile} treats the quirk. */
108
108
  readonly disposition: QuirkProfileDisposition;
109
109
  }
110
- /** One generated quirk artifact — the off-spec wire text plus the contract it is meant to satisfy. */
110
+ /** One generated quirk artifact: the off-spec wire text plus the contract it is meant to satisfy. */
111
111
  interface QuirkArtifact {
112
112
  /** The format this artifact belongs to. */
113
113
  readonly format: SynthFormat;
@@ -143,14 +143,14 @@ interface QuirkRoundTripResult {
143
143
  /** The exact code(s) the quirk is meant to produce. */
144
144
  readonly intendedWarnings: readonly string[];
145
145
  /**
146
- * `true` iff the bare parse produced **exactly** the intended code(s) — the intended-warning contract.
146
+ * `true` iff the bare parse produced **exactly** the intended code(s), the intended-warning contract.
147
147
  */
148
148
  readonly intendedWarningHeld: boolean;
149
149
  /** The verdict under the tolerating profile, when a built-in public one exists. */
150
150
  readonly withProfile?: QuirkProfiledVerdict;
151
151
  }
152
152
  /**
153
- * Exact multiset (order-independent) equality of two code lists — the intended-warning comparison.
153
+ * Exact multiset (order-independent) equality of two code lists: the intended-warning comparison.
154
154
  *
155
155
  * @param a - The first code list.
156
156
  * @param b - The second code list.
@@ -164,12 +164,12 @@ interface QuirkRoundTripResult {
164
164
  declare function sameCodeSet(a: readonly string[], b: readonly string[]): boolean;
165
165
  /**
166
166
  * Resolve a requested quirk name against a format's registry, or **fail closed**. A quirk the format's
167
- * profile system does not support is a fatal `SYNTH_UNSUPPORTED_QUIRK` — never a silent no-op and never
167
+ * profile system does not support is a fatal `SYNTH_UNSUPPORTED_QUIRK`, never a silent no-op and never
168
168
  * a fabricated quirk with a made-up warning.
169
169
  *
170
170
  * The refusal names neither the request nor the registry. `registry`, `format` and `name` are all
171
171
  * caller-supplied, and a diagnostic that quotes its input is a diagnostic that can be made to carry
172
- * anything the caller was holding — which for a fixture generator wired into someone else's pipeline
172
+ * anything the caller was holding, which for a fixture generator wired into someone else's pipeline
173
173
  * is not a hypothetical. Branch on `err.code`; the supported set is the registry you passed
174
174
  * (`HL7_QUIRKS`, `CCDA_QUIRKS`, `ASTM_QUIRKS`), which you can enumerate directly.
175
175
  *
@@ -197,22 +197,22 @@ declare function resolveQuirk(registry: Readonly<Record<string, QuirkDescriptor>
197
197
  * @example
198
198
  * ```ts
199
199
  * import { profileTolerated } from "@cosyte/synth";
200
- * profileTolerated("suppressed", ["UNKNOWN_SEGMENT"], []); // true — the profile suppressed it
200
+ * profileTolerated("suppressed", ["UNKNOWN_SEGMENT"], []); // true: the profile suppressed it
201
201
  * ```
202
202
  */
203
203
  declare function profileTolerated(disposition: QuirkProfileDisposition, intendedWarnings: readonly string[], warningsUnderProfile: readonly string[]): boolean;
204
204
  /**
205
205
  * Assert a freshly-generated quirk artifact **actually** round-trips to its intended warning(s), or
206
206
  * **fail closed**. This is the generator's self-check on the intended-warning contract: a
207
- * fixture whose bare parse does not produce exactly the declared code(s) is a *mislabeled* fixture — a
208
- * golden file that lies about the parser verdict it anchors — and must never be emitted. It is a
207
+ * fixture whose bare parse does not produce exactly the declared code(s) is a *mislabeled* fixture, a
208
+ * golden file that lies about the parser verdict it anchors, and must never be emitted. It is a
209
209
  * stronger guard than "the transform changed some bytes": a transform can mutate the wrong element (a
210
210
  * template a given document type does not key its warning on) and still change bytes while producing no
211
211
  * warning. Every format's `generate*Quirk` calls this after transforming, so the contract is enforced at
212
212
  * generation time, not merely at round-trip time.
213
213
  *
214
- * It no longer takes the quirk name. That parameter existed for one reason — to be interpolated into
215
- * the refusal — and a parameter whose only job is to reach a message is the exact shape this package
214
+ * It no longer takes the quirk name. That parameter existed for one reason, to be interpolated into
215
+ * the refusal, and a parameter whose only job is to reach a message is the exact shape this package
216
216
  * is removing, so it is gone rather than merely unused. The refusal names neither code list either;
217
217
  * both are caller-supplied, and the caller reads the comparison back off the arguments it holds.
218
218
  *
@@ -33,15 +33,15 @@ function sfc32Next(s) {
33
33
 
34
34
  // src/codes.ts
35
35
  var SYNTH_FATAL_CODES = {
36
- /** A money value could not be read as an X12 decimal. Fatal — a generator never rounds to a float. */
36
+ /** A money value could not be read as an X12 decimal. Fatal: a generator never rounds to a float. */
37
37
  SYNTH_INVALID_DECIMAL: "SYNTH_INVALID_DECIMAL",
38
38
  /** An integer range was requested with its maximum below its minimum. Fatal. */
39
39
  SYNTH_INVALID_RANGE: "SYNTH_INVALID_RANGE",
40
- /** A value was drawn from an empty pool. Fatal — never a fabricated substitute. */
40
+ /** A value was drawn from an empty pool. Fatal, never a fabricated substitute. */
41
41
  SYNTH_EMPTY_POOL: "SYNTH_EMPTY_POOL",
42
42
  /**
43
43
  * A caller-supplied selector (a message kind, a document type, a corpus mix entry, a claim
44
- * variant, a Bundle type, a resource profile) is not in the closed set that governs it. Fatal —
44
+ * variant, a Bundle type, a resource profile) is not in the closed set that governs it. Fatal:
45
45
  * see `resolveKind`: a selector union is erased at run time, and a selector that falls through
46
46
  * either mislabels the fixture or hands the value to a peer builder that quotes it back.
47
47
  */
@@ -143,7 +143,7 @@ function money(n) {
143
143
  var SYNTHETIC_ASSIGNING_AUTHORITY = Object.freeze({
144
144
  /** The human-readable assigning-authority namespace id (HL7 HD.1). */
145
145
  namespaceId: "COSYTE-SYNTH",
146
- /** The universal id — an OID under HL7's example arc `2.16.840.1.113883.19` (HD.2). */
146
+ /** The universal id, an OID under HL7's example arc `2.16.840.1.113883.19` (HD.2). */
147
147
  universalId: "2.16.840.1.113883.19.999",
148
148
  /** The universal id type (HD.3). */
149
149
  universalIdType: "ISO"
@@ -653,7 +653,7 @@ function specOf(rng, variant) {
653
653
  claims: [
654
654
  {
655
655
  ...claim,
656
- // Rendering provider (Loop 2310B, NM1 fields round-trip) — a person with an invalid-Luhn NPI.
656
+ // Rendering provider (Loop 2310B, NM1 fields round-trip), a person with an invalid-Luhn NPI.
657
657
  providers: [
658
658
  {
659
659
  entityIdentifierCode: "82",
@@ -680,7 +680,7 @@ function specOf(rng, variant) {
680
680
  state: org.address.state,
681
681
  postalCode: org.address.zip
682
682
  },
683
- // Provider tax id as a never-issued (900-range) SSN at REF*SY — provably synthetic (roadmap §4.1).
683
+ // Provider tax id as a never-issued (900-range) SSN at REF*SY, provably synthetic (roadmap §4.1).
684
684
  references: [{ qualifier: "SY", value: org.taxIdSsn }]
685
685
  },
686
686
  subscribers: [subscriber]