@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.
- package/CHANGELOG.md +135 -17
- package/README.md +47 -45
- package/dist/astm/index.cjs +7 -7
- package/dist/astm/index.cjs.map +1 -1
- package/dist/astm/index.d.cts +47 -47
- package/dist/astm/index.d.ts +47 -47
- package/dist/astm/index.mjs +7 -7
- package/dist/astm/index.mjs.map +1 -1
- package/dist/ccda/index.cjs +15 -15
- package/dist/ccda/index.cjs.map +1 -1
- package/dist/ccda/index.d.cts +31 -31
- package/dist/ccda/index.d.ts +31 -31
- package/dist/ccda/index.mjs +15 -15
- package/dist/ccda/index.mjs.map +1 -1
- package/dist/deid/index.cjs +15 -15
- package/dist/deid/index.cjs.map +1 -1
- package/dist/deid/index.d.cts +37 -37
- package/dist/deid/index.d.ts +37 -37
- package/dist/deid/index.mjs +15 -15
- package/dist/deid/index.mjs.map +1 -1
- package/dist/{example-codes-DeXcnCSK.d.cts → example-codes-88f3_bQZ.d.cts} +8 -8
- package/dist/{example-codes-DeXcnCSK.d.ts → example-codes-88f3_bQZ.d.ts} +8 -8
- package/dist/fhir/index.cjs +12 -12
- package/dist/fhir/index.cjs.map +1 -1
- package/dist/fhir/index.d.cts +46 -46
- package/dist/fhir/index.d.ts +46 -46
- package/dist/fhir/index.mjs +12 -12
- package/dist/fhir/index.mjs.map +1 -1
- package/dist/hl7/index.cjs +6 -6
- package/dist/hl7/index.cjs.map +1 -1
- package/dist/hl7/index.d.cts +45 -45
- package/dist/hl7/index.d.ts +45 -45
- package/dist/hl7/index.mjs +6 -6
- package/dist/hl7/index.mjs.map +1 -1
- package/dist/index.cjs +9 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +49 -49
- package/dist/index.d.ts +49 -49
- package/dist/index.mjs +9 -9
- package/dist/index.mjs.map +1 -1
- package/dist/ncpdp/index.cjs +3 -3
- package/dist/ncpdp/index.cjs.map +1 -1
- package/dist/ncpdp/index.d.cts +42 -42
- package/dist/ncpdp/index.d.ts +42 -42
- package/dist/ncpdp/index.mjs +3 -3
- package/dist/ncpdp/index.mjs.map +1 -1
- package/dist/{providers-OLz3zAc-.d.cts → providers-B9uVinAe.d.cts} +24 -24
- package/dist/{providers-OLz3zAc-.d.ts → providers-B9uVinAe.d.ts} +24 -24
- package/dist/{quirk-C9t9CkPS.d.ts → quirk-HZdznAkM.d.ts} +23 -23
- package/dist/{quirk-DYMDojVw.d.cts → quirk-IaHp4z7N.d.cts} +23 -23
- package/dist/x12/index.cjs +6 -6
- package/dist/x12/index.cjs.map +1 -1
- package/dist/x12/index.d.cts +44 -44
- package/dist/x12/index.d.ts +44 -44
- package/dist/x12/index.mjs +6 -6
- package/dist/x12/index.mjs.map +1 -1
- package/package.json +3 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { s as ssn, p as phone, n as name, e as email, i as ipv4, c as ipv6, u as uuid, d as identifier, f as address, g as dateYmd, h as npi, j as dea } from './providers-
|
|
2
|
-
export { A as Artifact, C as Corpus, k as CorpusManifest, R as Rng, l as SsnBlock, m as SynthFormat, b as SyntheticAddress, a as SyntheticIdentifier, S as SyntheticName, o as createRng, q as makeCorpus } from './providers-
|
|
3
|
-
export { P as PROFILE_QUIRK_APPLIED, a as QuirkArtifact, Q as QuirkDescriptor, c as QuirkProfileDisposition, d as QuirkProfiledVerdict, b as QuirkRoundTripResult, S as SynthProfile, e as SynthProfileSpec, f as assertIntendedWarnings, g as defineSynthProfile, p as profileTolerated, r as resolveQuirk, s as sameCodeSet, v as validateProfileQuirks } from './quirk-
|
|
1
|
+
import { s as ssn, p as phone, n as name, e as email, i as ipv4, c as ipv6, u as uuid, d as identifier, f as address, g as dateYmd, h as npi, j as dea } from './providers-B9uVinAe.cjs';
|
|
2
|
+
export { A as Artifact, C as Corpus, k as CorpusManifest, R as Rng, l as SsnBlock, m as SynthFormat, b as SyntheticAddress, a as SyntheticIdentifier, S as SyntheticName, o as createRng, q as makeCorpus } from './providers-B9uVinAe.cjs';
|
|
3
|
+
export { P as PROFILE_QUIRK_APPLIED, a as QuirkArtifact, Q as QuirkDescriptor, c as QuirkProfileDisposition, d as QuirkProfiledVerdict, b as QuirkRoundTripResult, S as SynthProfile, e as SynthProfileSpec, f as assertIntendedWarnings, g as defineSynthProfile, p as profileTolerated, r as resolveQuirk, s as sameCodeSet, v as validateProfileQuirks } from './quirk-IaHp4z7N.cjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* The reserved / never-collide identifier facts that make a `@cosyte/synth` value **provably
|
|
7
|
-
* synthetic
|
|
7
|
+
* synthetic**: the ground truth behind the synthetic-safety invariant.
|
|
8
8
|
*
|
|
9
9
|
* These are **facts**, not copyrighted prose: authoritative ranges published by SSA, NANPA, and the
|
|
10
10
|
* IETF that are guaranteed never to denote a real person or a real routable resource. Every provider
|
|
11
|
-
* draws only from these; the predicates here are the executable half of the CI synthetic-safety gate
|
|
11
|
+
* draws only from these; the predicates here are the executable half of the CI synthetic-safety gate:
|
|
12
12
|
* they let a test assert that no emitted value falls **outside** a reserved source.
|
|
13
13
|
*
|
|
14
14
|
* Sources:
|
|
15
|
-
* - **SSN
|
|
15
|
+
* - **SSN**, SSA never issues area numbers `000`, `666`, or `900–999`; the `987-65-4320…4329` block
|
|
16
16
|
* is SSA's explicitly-reserved advertising range. (ssa.gov)
|
|
17
|
-
* - **Phone
|
|
18
|
-
* - **Email/domain
|
|
17
|
+
* - **Phone**, NANP reserves `555-0100…555-0199` as the fictional/non-working line range. (nanpa.com)
|
|
18
|
+
* - **Email/domain**, RFC 2606 / RFC 6761 reserved: `example.com`/`.net`/`.org` and the `.example`,
|
|
19
19
|
* `.test`, `.invalid`, `.localhost` TLDs.
|
|
20
|
-
* - **IP
|
|
20
|
+
* - **IP**, RFC 5737 IPv4 TEST-NET-1/2/3 (`192.0.2.0/24`, `198.51.100.0/24`, `203.0.113.0/24`) and
|
|
21
21
|
* RFC 3849 IPv6 documentation prefix `2001:db8::/32`.
|
|
22
|
-
* - **NPI
|
|
22
|
+
* - **NPI**, a real National Provider Identifier is a 10-digit number whose last digit is a Luhn
|
|
23
23
|
* check digit computed over the `80840` prefix + the 9-digit base (CMS NPI check-digit rule, ISO
|
|
24
24
|
* 7812). A number whose check digit is **wrong** therefore cannot be a NPPES-issued NPI. `synth`
|
|
25
25
|
* emits NPIs with a deliberately-invalid check digit, so no generated NPI can collide with a real
|
|
@@ -30,7 +30,7 @@ export { P as PROFILE_QUIRK_APPLIED, a as QuirkArtifact, Q as QuirkDescriptor, c
|
|
|
30
30
|
/**
|
|
31
31
|
* The synthetic **assigning authority** `@cosyte/synth` mints MRNs / account / member identifiers
|
|
32
32
|
* under. There is **no** reserved MRN range (an MRN is unique only within its assigning-authority /
|
|
33
|
-
* OID namespace), so
|
|
33
|
+
* OID namespace), so, as a documented design decision, every synthetic identifier
|
|
34
34
|
* is scoped to a namespace that clearly cannot be a real facility's: a `SYNTH`-labelled authority whose
|
|
35
35
|
* OID lives under HL7's designated **example** root `2.16.840.1.113883.19`. A value under this AA can
|
|
36
36
|
* never collide with a real record because the *namespace itself* is synthetic.
|
|
@@ -38,7 +38,7 @@ export { P as PROFILE_QUIRK_APPLIED, a as QuirkArtifact, Q as QuirkDescriptor, c
|
|
|
38
38
|
declare const SYNTHETIC_ASSIGNING_AUTHORITY: Readonly<{
|
|
39
39
|
/** The human-readable assigning-authority namespace id (HL7 HD.1). */
|
|
40
40
|
namespaceId: "COSYTE-SYNTH";
|
|
41
|
-
/** The universal id
|
|
41
|
+
/** The universal id, an OID under HL7's example arc `2.16.840.1.113883.19` (HD.2). */
|
|
42
42
|
universalId: "2.16.840.1.113883.19.999";
|
|
43
43
|
/** The universal id type (HD.3). */
|
|
44
44
|
universalIdType: "ISO";
|
|
@@ -51,7 +51,7 @@ declare const TEST_NET_V4_PREFIXES: readonly string[];
|
|
|
51
51
|
declare const DOC_V6_PREFIX = "2001:db8";
|
|
52
52
|
/**
|
|
53
53
|
* The `80840` prefix prepended to a 10-digit NPI before the Luhn check (the CMS NPI check-digit
|
|
54
|
-
* rule
|
|
54
|
+
* rule: `80840` is the ISO 7812 issuer identifier for the US health-application namespace). A real
|
|
55
55
|
* NPI satisfies `luhn("80840" + npi) ≡ 0 (mod 10)`.
|
|
56
56
|
*/
|
|
57
57
|
declare const NPI_LUHN_PREFIX = "80840";
|
|
@@ -65,7 +65,7 @@ declare const NPI_LUHN_PREFIX = "80840";
|
|
|
65
65
|
*/
|
|
66
66
|
declare function luhnMod10(digits: string): number;
|
|
67
67
|
/**
|
|
68
|
-
* The correct NPI check digit for a 9-digit base
|
|
68
|
+
* The correct NPI check digit for a 9-digit base: the value that makes `80840` + base + check pass
|
|
69
69
|
* the Luhn check.
|
|
70
70
|
*
|
|
71
71
|
* @param base9 - The 9-digit NPI base (positions 1–9).
|
|
@@ -73,7 +73,7 @@ declare function luhnMod10(digits: string): number;
|
|
|
73
73
|
* @example
|
|
74
74
|
* ```ts
|
|
75
75
|
* import { npiCheckDigit } from "@cosyte/synth";
|
|
76
|
-
* npiCheckDigit("123456789"); // 3
|
|
76
|
+
* npiCheckDigit("123456789"); // 3, so 1234567893 is a Luhn-valid NPI shape
|
|
77
77
|
* ```
|
|
78
78
|
*/
|
|
79
79
|
declare function npiCheckDigit(base9: string): number;
|
|
@@ -82,7 +82,7 @@ declare function npiCheckDigit(base9: string): number;
|
|
|
82
82
|
* from. A real DEA number is `<registrant-type><last-name-initial>` + 7 digits; the first letter is the
|
|
83
83
|
* registrant type (A/B/F/G/M/P/R/X are the widely-published values; the second letter is the
|
|
84
84
|
* registrant's last-name initial). These letters are a **fact** about the number's shape, not
|
|
85
|
-
* copyrighted prose
|
|
85
|
+
* copyrighted prose: they only shape the value; the synthetic guarantee is the deliberately-**invalid
|
|
86
86
|
* checksum** (see {@link dea} / {@link isSyntheticDea}).
|
|
87
87
|
*/
|
|
88
88
|
declare const DEA_REGISTRANT_TYPES: readonly string[];
|
|
@@ -101,7 +101,7 @@ declare const DEA_REGISTRANT_TYPES: readonly string[];
|
|
|
101
101
|
*/
|
|
102
102
|
declare function deaCheckDigit(base6: string): number;
|
|
103
103
|
/**
|
|
104
|
-
* Whether a DEA number (`XX` + 7 digits, case-insensitive) is **provably synthetic
|
|
104
|
+
* Whether a DEA number (`XX` + 7 digits, case-insensitive) is **provably synthetic**: its check digit
|
|
105
105
|
* (the 7th digit) does **not** match the published DEA checksum, so it cannot be a validly-issued DEA
|
|
106
106
|
* registration. A checksum-valid DEA number (which *could* denote a real prescriber) returns `false`; a
|
|
107
107
|
* value that is not the DEA shape returns `false`.
|
|
@@ -111,12 +111,12 @@ declare function deaCheckDigit(base6: string): number;
|
|
|
111
111
|
* @example
|
|
112
112
|
* ```ts
|
|
113
113
|
* import { isSyntheticDea } from "@cosyte/synth";
|
|
114
|
-
* isSyntheticDea("AF1234561"); // depends on the base
|
|
114
|
+
* isSyntheticDea("AF1234561"); // depends on the base: true when the 7th digit is wrong
|
|
115
115
|
* ```
|
|
116
116
|
*/
|
|
117
117
|
declare function isSyntheticDea(value: string): boolean;
|
|
118
118
|
/**
|
|
119
|
-
* Whether a 10-digit NPI is **provably synthetic
|
|
119
|
+
* Whether a 10-digit NPI is **provably synthetic**, i.e. its check digit is invalid, so it cannot be
|
|
120
120
|
* a NPPES-issued NPI. A Luhn-valid 10-digit NPI (which *could* denote a real registered provider)
|
|
121
121
|
* returns `false`; a non-10-digit value returns `false` (not an NPI shape).
|
|
122
122
|
*
|
|
@@ -125,14 +125,14 @@ declare function isSyntheticDea(value: string): boolean;
|
|
|
125
125
|
* @example
|
|
126
126
|
* ```ts
|
|
127
127
|
* import { isSyntheticNpi } from "@cosyte/synth";
|
|
128
|
-
* isSyntheticNpi("1234567894"); // true
|
|
129
|
-
* isSyntheticNpi("1234567893"); // false
|
|
128
|
+
* isSyntheticNpi("1234567894"); // true: invalid check digit (valid would be 1234567893)
|
|
129
|
+
* isSyntheticNpi("1234567893"); // false: Luhn-valid, could be a real NPI
|
|
130
130
|
* ```
|
|
131
131
|
*/
|
|
132
132
|
declare function isSyntheticNpi(value: string): boolean;
|
|
133
133
|
/**
|
|
134
134
|
* Whether a `ddd-dd-dddd` (or `ddddddddd`) SSN string is drawn from an SSA never-issued / reserved
|
|
135
|
-
* space
|
|
135
|
+
* space: area `000`, `666`, or `900–999`. A real, issuable SSN returns `false`.
|
|
136
136
|
*
|
|
137
137
|
* @param value - The candidate SSN (dashes optional).
|
|
138
138
|
* @returns `true` when the SSN is provably synthetic.
|
|
@@ -184,12 +184,12 @@ declare function isSyntheticEmail(value: string): boolean;
|
|
|
184
184
|
declare function isSyntheticIp(value: string): boolean;
|
|
185
185
|
|
|
186
186
|
/**
|
|
187
|
-
* The shipped **clearly-fake name pool
|
|
187
|
+
* The shipped **clearly-fake name pool**: `@cosyte/synth`'s own license-clean synthetic data.
|
|
188
188
|
*
|
|
189
189
|
* Deliberately **not** a `faker`-style realistic-name corpus (which could match a real person at a real
|
|
190
|
-
* address
|
|
190
|
+
* address: the exact hazard the synthetic-safety invariant forbids). Every token is
|
|
191
191
|
* an obviously-invented, fixture-flavoured word: a reader can tell at a glance it names no one. The pool
|
|
192
|
-
* is small on purpose
|
|
192
|
+
* is small on purpose: structural coverage, not demographic realism, is the goal.
|
|
193
193
|
*
|
|
194
194
|
* `# synthetic: true`
|
|
195
195
|
*
|
|
@@ -208,7 +208,7 @@ declare const SYNTHETIC_STREET_NAMES: readonly string[];
|
|
|
208
208
|
declare const SYNTHETIC_CITY_NAMES: readonly string[];
|
|
209
209
|
|
|
210
210
|
/**
|
|
211
|
-
* The `safe` namespace
|
|
211
|
+
* The `safe` namespace: the single entry point for every synthetic-by-construction value provider.
|
|
212
212
|
*
|
|
213
213
|
* Grouped under one object so a consumer reads `safe.ssn(rng)` / `safe.phone(rng)` and it is
|
|
214
214
|
* self-evident that the value is drawn from a guaranteed-non-colliding synthetic source.
|
|
@@ -220,7 +220,7 @@ declare const SYNTHETIC_CITY_NAMES: readonly string[];
|
|
|
220
220
|
|
|
221
221
|
/**
|
|
222
222
|
* The synthetic-safety provider namespace. Every function draws only from a reserved range or the
|
|
223
|
-
* shipped fake-name pool
|
|
223
|
+
* shipped fake-name pool, no value it returns can be real or plausibly-real PHI.
|
|
224
224
|
*
|
|
225
225
|
* @example
|
|
226
226
|
* ```ts
|
|
@@ -246,14 +246,14 @@ declare const safe: Readonly<{
|
|
|
246
246
|
}>;
|
|
247
247
|
|
|
248
248
|
/**
|
|
249
|
-
* `splitmix32
|
|
249
|
+
* `splitmix32`: a tiny, well-studied 32-bit mixing PRNG used **only** to expand a single integer
|
|
250
250
|
* seed into the four 32-bit state words that seed {@link ../rng/sfc32.sfc32}. It is not the corpus
|
|
251
251
|
* generator itself (that is `sfc32`); it exists so that a one-number seed deterministically produces a
|
|
252
252
|
* well-distributed 128-bit `sfc32` state, avoiding the poor low-bit behavior of naive
|
|
253
253
|
* `state = seed`-style initialization.
|
|
254
254
|
*
|
|
255
|
-
* Zero-dependency, `Math.random`-free (lint-enforced): the whole point of the library is that a seed
|
|
256
|
-
* and only the seed
|
|
255
|
+
* Zero-dependency, `Math.random`-free (lint-enforced): the whole point of the library is that a seed,
|
|
256
|
+
* and only the seed, determines the output, on any machine, any run.
|
|
257
257
|
*
|
|
258
258
|
* @module
|
|
259
259
|
*/
|
|
@@ -273,10 +273,10 @@ declare const safe: Readonly<{
|
|
|
273
273
|
declare function splitmix32(seed: number): () => number;
|
|
274
274
|
|
|
275
275
|
/**
|
|
276
|
-
* `sfc32` (Small Fast Counter, 32-bit, 128-bit state)
|
|
276
|
+
* `sfc32` (Small Fast Counter, 32-bit, 128-bit state): the deterministic, non-cryptographic PRNG that
|
|
277
277
|
* drives every value `@cosyte/synth` generates. Chosen over `mulberry32` (whose author flags that it
|
|
278
278
|
* skips ~1/3 of 32-bit outputs) and over a CSPRNG (`node:crypto`, which is **not seedable** and would
|
|
279
|
-
* defeat reproducibility). A synthetic-fixture generator has **no secrets
|
|
279
|
+
* defeat reproducibility). A synthetic-fixture generator has **no secrets**: statistical quality plus
|
|
280
280
|
* byte-for-byte reproducibility is exactly the right trade.
|
|
281
281
|
*
|
|
282
282
|
* The state is four 32-bit words. This module exposes the raw step function; {@link ../rng/rng.Rng}
|
|
@@ -302,7 +302,7 @@ interface Sfc32State {
|
|
|
302
302
|
*
|
|
303
303
|
* This is the canonical `sfc32` step. The state object is mutated (the counter `d` increments and the
|
|
304
304
|
* mixing words rotate); callers that need reproducible independence hold their own state and never
|
|
305
|
-
* share it
|
|
305
|
+
* share it: {@link ../rng/rng.Rng} creates a fresh state per seed so two runs from the same seed are
|
|
306
306
|
* identical.
|
|
307
307
|
*
|
|
308
308
|
* @param s - The state to advance. Mutated in place.
|
|
@@ -320,10 +320,10 @@ declare function sfc32Next(s: Sfc32State): number;
|
|
|
320
320
|
* Stable diagnostic codes for `@cosyte/synth` and the {@link SynthError} they travel on.
|
|
321
321
|
*
|
|
322
322
|
* Unlike a parser (which recovers from bad *input* into Tier-2 warnings), a **generator** has no input
|
|
323
|
-
* to tolerate
|
|
323
|
+
* to tolerate: its reflex is *synthetic-by-construction* and *fail-closed on impossibility*. So the
|
|
324
324
|
* codes here are **fatal**: a caller asked for something the library cannot honor spec-clean, and the
|
|
325
325
|
* only safe answer is to throw, never to silently fabricate a value or a byte workaround. Codes are `key ===
|
|
326
|
-
* value` and part of the public contract
|
|
326
|
+
* value` and part of the public contract:
|
|
327
327
|
* renaming one is a breaking change.
|
|
328
328
|
*
|
|
329
329
|
* @module
|
|
@@ -346,7 +346,7 @@ declare function sfc32Next(s: Sfc32State): number;
|
|
|
346
346
|
declare const SYNTH_FATAL_CODES: {
|
|
347
347
|
/**
|
|
348
348
|
* A format was requested that this build cannot generate through a real parser builder/serializer.
|
|
349
|
-
* Fatal
|
|
349
|
+
* Fatal, never a hand-written byte fallback.
|
|
350
350
|
*
|
|
351
351
|
* **No code path in this build raises it.** All six formats generate, so it is reserved for a
|
|
352
352
|
* future format that does not, and is kept because removing a published code is a breaking change.
|
|
@@ -354,51 +354,51 @@ declare const SYNTH_FATAL_CODES: {
|
|
|
354
354
|
*/
|
|
355
355
|
readonly SYNTH_UNSUPPORTED_FORMAT: "SYNTH_UNSUPPORTED_FORMAT";
|
|
356
356
|
/**
|
|
357
|
-
* A vendor quirk was requested that the target format's profile system does not support. Fatal
|
|
357
|
+
* A vendor quirk was requested that the target format's profile system does not support. Fatal,
|
|
358
358
|
* never a silent no-op and never a fabricated quirk.
|
|
359
359
|
*/
|
|
360
360
|
readonly SYNTH_UNSUPPORTED_QUIRK: "SYNTH_UNSUPPORTED_QUIRK";
|
|
361
361
|
/**
|
|
362
362
|
* A quirk transform found no structural anchor to mutate, so the fixture would not carry the
|
|
363
|
-
* deviation it is labelled with. Fatal
|
|
363
|
+
* deviation it is labelled with. Fatal: a golden file that lies about its parser verdict is worse
|
|
364
364
|
* than no golden file.
|
|
365
365
|
*/
|
|
366
366
|
readonly SYNTH_QUIRK_ANCHOR_ABSENT: "SYNTH_QUIRK_ANCHOR_ABSENT";
|
|
367
367
|
/**
|
|
368
368
|
* A bare parse of a freshly-generated quirk artifact did not produce exactly the declared intended
|
|
369
|
-
* warning code(s). Fatal
|
|
369
|
+
* warning code(s). Fatal, never emit a mislabeled fixture.
|
|
370
370
|
*/
|
|
371
371
|
readonly SYNTH_INTENDED_WARNING_MISMATCH: "SYNTH_INTENDED_WARNING_MISMATCH";
|
|
372
372
|
/** A concept's code-system URI has no OID mapping in the C-CDA example-code table. Fatal. */
|
|
373
373
|
readonly SYNTH_UNMAPPED_CODE_SYSTEM: "SYNTH_UNMAPPED_CODE_SYSTEM";
|
|
374
|
-
/** A money value could not be read as an X12 decimal. Fatal
|
|
374
|
+
/** A money value could not be read as an X12 decimal. Fatal: a generator never rounds to a float. */
|
|
375
375
|
readonly SYNTH_INVALID_DECIMAL: "SYNTH_INVALID_DECIMAL";
|
|
376
376
|
/** An integer range was requested with its maximum below its minimum. Fatal. */
|
|
377
377
|
readonly SYNTH_INVALID_RANGE: "SYNTH_INVALID_RANGE";
|
|
378
|
-
/** A value was drawn from an empty pool. Fatal
|
|
378
|
+
/** A value was drawn from an empty pool. Fatal, never a fabricated substitute. */
|
|
379
379
|
readonly SYNTH_EMPTY_POOL: "SYNTH_EMPTY_POOL";
|
|
380
380
|
/** A `defineSynthProfile` spec was not usable (a missing or blank `name`). Fatal. */
|
|
381
381
|
readonly SYNTH_INVALID_PROFILE: "SYNTH_INVALID_PROFILE";
|
|
382
382
|
/**
|
|
383
383
|
* A caller-supplied selector (a message kind, a document type, a corpus mix entry, a claim
|
|
384
|
-
* variant, a Bundle type, a resource profile) is not in the closed set that governs it. Fatal
|
|
384
|
+
* variant, a Bundle type, a resource profile) is not in the closed set that governs it. Fatal:
|
|
385
385
|
* see `resolveKind`: a selector union is erased at run time, and a selector that falls through
|
|
386
386
|
* either mislabels the fixture or hands the value to a peer builder that quotes it back.
|
|
387
387
|
*/
|
|
388
388
|
readonly SYNTH_UNSUPPORTED_KIND: "SYNTH_UNSUPPORTED_KIND";
|
|
389
389
|
};
|
|
390
390
|
/**
|
|
391
|
-
* A value from {@link SYNTH_FATAL_CODES}
|
|
391
|
+
* A value from {@link SYNTH_FATAL_CODES}: the type carried by a thrown {@link SynthError}.
|
|
392
392
|
*/
|
|
393
393
|
type SynthFatalCode = (typeof SYNTH_FATAL_CODES)[keyof typeof SYNTH_FATAL_CODES];
|
|
394
394
|
/**
|
|
395
|
-
* The **frozen message registry
|
|
395
|
+
* The **frozen message registry**: the only place a {@link SynthError} message can come from.
|
|
396
396
|
*
|
|
397
397
|
* A message here is a fixed string. It never quotes the request that produced it, and there is no
|
|
398
398
|
* parameter through which it could: {@link SynthError} takes a code and nothing else. That is the
|
|
399
399
|
* whole mechanism, and it is deliberately a mechanism rather than a habit. Every one of these
|
|
400
400
|
* messages used to be assembled by interpolating the caller's value into a template, and the reason
|
|
401
|
-
* that was safe was not the design
|
|
401
|
+
* that was safe was not the design: it was that the caller happened to be passing a quirk name.
|
|
402
402
|
*
|
|
403
403
|
* The trade is real and is accepted: a fatal no longer tells you *which* value it rejected. It tells
|
|
404
404
|
* you which rule refused, on `err.code`, and the stack frame tells you where. The caller already
|
|
@@ -416,7 +416,7 @@ declare const SYNTH_FATAL_MESSAGES: Readonly<Record<SynthFatalCode, string>>;
|
|
|
416
416
|
* {@link SynthFatalCode} so callers branch on `err.code` without matching message text.
|
|
417
417
|
*
|
|
418
418
|
* It takes **no value parameter**. The message is whatever {@link SYNTH_FATAL_MESSAGES} holds for the
|
|
419
|
-
* code, so no caller-supplied string can reach a diagnostic surface by any route
|
|
419
|
+
* code, so no caller-supplied string can reach a diagnostic surface by any route, not `message`, not
|
|
420
420
|
* `stack`, not a field on the thrown object.
|
|
421
421
|
*
|
|
422
422
|
* @example
|
|
@@ -480,7 +480,7 @@ declare function resolveKind<T extends string>(allowed: readonly T[], requested:
|
|
|
480
480
|
* It substitutes the default **only** when the caller supplied nothing, which is exactly what the
|
|
481
481
|
* `??` it replaced did. An empty array is a supplied mix and is returned as one. An earlier version
|
|
482
482
|
* of this function also treated `[]` as "nothing supplied", on the stated grounds that it matched the
|
|
483
|
-
* previous behaviour; it did not
|
|
483
|
+
* previous behaviour; it did not: `??` fires on `undefined` and never on `[]`, and it changed the
|
|
484
484
|
* result of six published entry points, turning an explicit empty selection into "generate one of
|
|
485
485
|
* everything". A convenience that fails open is not a convenience.
|
|
486
486
|
*
|
|
@@ -498,7 +498,7 @@ declare function resolveKind<T extends string>(allowed: readonly T[], requested:
|
|
|
498
498
|
declare function resolveMix<T extends string>(allowed: readonly T[], requested: readonly string[] | undefined, fallback: readonly T[]): readonly T[];
|
|
499
499
|
|
|
500
500
|
/**
|
|
501
|
-
* `@cosyte/synth
|
|
501
|
+
* `@cosyte/synth`: a deterministic, seedable **synthetic-data / test-fixture generator** for the
|
|
502
502
|
* cosyte healthcare formats. A *consumer* of the parsers, not a parser: it builds artifacts **through
|
|
503
503
|
* each parser's own builder/serializer** (so output is spec-clean by construction) and draws every
|
|
504
504
|
* value from a **guaranteed-non-colliding synthetic source** (so no output can be real or
|
|
@@ -507,7 +507,7 @@ declare function resolveMix<T extends string>(allowed: readonly T[], requested:
|
|
|
507
507
|
* This root entry point exposes the **format-agnostic core**: the seeded PRNG, the synthetic-safety
|
|
508
508
|
* providers, the `Corpus` abstraction, the profile skeleton, and the fatal codes. Per-format
|
|
509
509
|
* generation lives behind its own subpath (`@cosyte/synth/hl7`) so importing the root never pulls a
|
|
510
|
-
* parser
|
|
510
|
+
* parser: the lazy per-format boundary.
|
|
511
511
|
*
|
|
512
512
|
* @module
|
|
513
513
|
*/
|