@cosyte/synth 0.0.9 → 0.1.1
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 +83 -2
- package/README.md +40 -31
- package/dist/astm/index.cjs +18 -6
- package/dist/astm/index.cjs.map +1 -1
- package/dist/astm/index.d.cts +6 -6
- package/dist/astm/index.d.ts +6 -6
- package/dist/astm/index.mjs +18 -6
- package/dist/astm/index.mjs.map +1 -1
- package/dist/ccda/index.cjs +23 -7
- package/dist/ccda/index.cjs.map +1 -1
- package/dist/ccda/index.d.cts +2 -2
- package/dist/ccda/index.d.ts +2 -2
- package/dist/ccda/index.mjs +23 -7
- package/dist/ccda/index.mjs.map +1 -1
- package/dist/deid/index.cjs +26 -8
- package/dist/deid/index.cjs.map +1 -1
- package/dist/deid/index.d.cts +3 -3
- package/dist/deid/index.d.ts +3 -3
- package/dist/deid/index.mjs +26 -8
- package/dist/deid/index.mjs.map +1 -1
- package/dist/fhir/index.cjs +174 -7
- package/dist/fhir/index.cjs.map +1 -1
- package/dist/fhir/index.d.cts +163 -2
- package/dist/fhir/index.d.ts +163 -2
- package/dist/fhir/index.mjs +171 -9
- package/dist/fhir/index.mjs.map +1 -1
- package/dist/hl7/index.cjs +18 -6
- package/dist/hl7/index.cjs.map +1 -1
- package/dist/hl7/index.d.cts +3 -3
- package/dist/hl7/index.d.ts +3 -3
- package/dist/hl7/index.mjs +18 -6
- package/dist/hl7/index.mjs.map +1 -1
- package/dist/index.cjs +37 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +174 -40
- package/dist/index.d.ts +174 -40
- package/dist/index.mjs +36 -7
- package/dist/index.mjs.map +1 -1
- package/dist/ncpdp/index.cjs +18 -6
- package/dist/ncpdp/index.cjs.map +1 -1
- package/dist/ncpdp/index.d.cts +2 -2
- package/dist/ncpdp/index.d.ts +2 -2
- package/dist/ncpdp/index.mjs +18 -6
- package/dist/ncpdp/index.mjs.map +1 -1
- package/dist/{providers-B9uVinAe.d.cts → providers-DcPrqmp5.d.cts} +20 -6
- package/dist/{providers-B9uVinAe.d.ts → providers-DcPrqmp5.d.ts} +20 -6
- package/dist/{quirk-IaHp4z7N.d.cts → quirk-CilFUhwX.d.cts} +1 -1
- package/dist/{quirk-HZdznAkM.d.ts → quirk-DmqYw3Vk.d.ts} +1 -1
- package/dist/x12/index.cjs +18 -6
- package/dist/x12/index.cjs.map +1 -1
- package/dist/x12/index.d.cts +3 -3
- package/dist/x12/index.d.ts +3 -3
- package/dist/x12/index.mjs +18 -6
- package/dist/x12/index.mjs.map +1 -1
- package/package.json +24 -10
package/dist/x12/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { b as SyntheticAddress, S as SyntheticName, R as Rng, C as Corpus } from '../providers-
|
|
1
|
+
import { b as SyntheticAddress, S as SyntheticName, R as Rng, C as Corpus } from '../providers-DcPrqmp5.cjs';
|
|
2
2
|
import { X12Interchange, X12Decimal } from '@cosyte/x12';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -235,7 +235,7 @@ declare function money(n: number): string;
|
|
|
235
235
|
* - **NPI**: a deliberately **invalid Luhn** check digit, so it can never be a NPPES-issued NPI
|
|
236
236
|
* ({@link ../safe/reserved.isSyntheticNpi}).
|
|
237
237
|
* - **provider tax id**: emitted as an SSN (REF*SY) in the SSA **never-issued** 900-range, so it can
|
|
238
|
-
* never be a real, issuable SSN (900
|
|
238
|
+
* never be a real, issuable SSN (900 to 999 is never assigned as an SSN, the universal synthetic-safe
|
|
239
239
|
* SSN convention).
|
|
240
240
|
* - **name**: the shipped clearly-fake pool; **DOB / dates**: the seeded generator (no real event
|
|
241
241
|
* implied); **address**: synthetic street + reserved ZIP.
|
|
@@ -369,7 +369,7 @@ interface X12EnvelopeTiming {
|
|
|
369
369
|
}
|
|
370
370
|
/**
|
|
371
371
|
* Mint a seeded envelope timing + control-number bundle. The service/transaction date is drawn in a
|
|
372
|
-
* recent plausible window (2024
|
|
372
|
+
* recent plausible window (2024 to 2026) so a generated transaction reads like a current one; every value
|
|
373
373
|
* is seeded, so the interchange is byte-reproducible.
|
|
374
374
|
*
|
|
375
375
|
* @param rng - The seeded generator.
|
package/dist/x12/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { b as SyntheticAddress, S as SyntheticName, R as Rng, C as Corpus } from '../providers-
|
|
1
|
+
import { b as SyntheticAddress, S as SyntheticName, R as Rng, C as Corpus } from '../providers-DcPrqmp5.js';
|
|
2
2
|
import { X12Interchange, X12Decimal } from '@cosyte/x12';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -235,7 +235,7 @@ declare function money(n: number): string;
|
|
|
235
235
|
* - **NPI**: a deliberately **invalid Luhn** check digit, so it can never be a NPPES-issued NPI
|
|
236
236
|
* ({@link ../safe/reserved.isSyntheticNpi}).
|
|
237
237
|
* - **provider tax id**: emitted as an SSN (REF*SY) in the SSA **never-issued** 900-range, so it can
|
|
238
|
-
* never be a real, issuable SSN (900
|
|
238
|
+
* never be a real, issuable SSN (900 to 999 is never assigned as an SSN, the universal synthetic-safe
|
|
239
239
|
* SSN convention).
|
|
240
240
|
* - **name**: the shipped clearly-fake pool; **DOB / dates**: the seeded generator (no real event
|
|
241
241
|
* implied); **address**: synthetic street + reserved ZIP.
|
|
@@ -369,7 +369,7 @@ interface X12EnvelopeTiming {
|
|
|
369
369
|
}
|
|
370
370
|
/**
|
|
371
371
|
* Mint a seeded envelope timing + control-number bundle. The service/transaction date is drawn in a
|
|
372
|
-
* recent plausible window (2024
|
|
372
|
+
* recent plausible window (2024 to 2026) so a generated transaction reads like a current one; every value
|
|
373
373
|
* is seeded, so the interchange is byte-reproducible.
|
|
374
374
|
*
|
|
375
375
|
* @param rng - The seeded generator.
|
package/dist/x12/index.mjs
CHANGED
|
@@ -43,8 +43,7 @@ var SYNTH_FATAL_CODES = {
|
|
|
43
43
|
* see `resolveKind`: a selector union is erased at run time, and a selector that falls through
|
|
44
44
|
* either mislabels the fixture or hands the value to a peer builder that quotes it back.
|
|
45
45
|
*/
|
|
46
|
-
SYNTH_UNSUPPORTED_KIND: "SYNTH_UNSUPPORTED_KIND"
|
|
47
|
-
};
|
|
46
|
+
SYNTH_UNSUPPORTED_KIND: "SYNTH_UNSUPPORTED_KIND"};
|
|
48
47
|
var SYNTH_FATAL_MESSAGES = Object.freeze({
|
|
49
48
|
SYNTH_UNSUPPORTED_FORMAT: "The requested format is not generable by this build. A generator has no byte fallback: it builds through a parser's own serializer or it refuses.",
|
|
50
49
|
SYNTH_UNSUPPORTED_QUIRK: "The requested vendor quirk is not in the target format's quirk registry. Compare the request against that format's exported registry (HL7_QUIRKS, CCDA_QUIRKS, ASTM_QUIRKS).",
|
|
@@ -55,7 +54,8 @@ var SYNTH_FATAL_MESSAGES = Object.freeze({
|
|
|
55
54
|
SYNTH_INVALID_RANGE: "An integer range was requested with its maximum below its minimum.",
|
|
56
55
|
SYNTH_EMPTY_POOL: "A value was drawn from an empty pool.",
|
|
57
56
|
SYNTH_INVALID_PROFILE: "defineSynthProfile requires a non-empty string name.",
|
|
58
|
-
SYNTH_UNSUPPORTED_KIND: "The requested kind, document type, corpus mix entry, variant or profile is not one this generator supports. The supported set is the exported union for that option."
|
|
57
|
+
SYNTH_UNSUPPORTED_KIND: "The requested kind, document type, corpus mix entry, variant or profile is not one this generator supports. The supported set is the exported union for that option.",
|
|
58
|
+
SYNTH_PROFILE_NOT_GENERATED: "The requested profile is published by the adopted implementation guide, and this build does not generate it. The coverage surface reports, per adopted profile, whether it is generated."
|
|
59
59
|
});
|
|
60
60
|
var SynthError = class extends Error {
|
|
61
61
|
/** The stable fatal code. */
|
|
@@ -141,7 +141,7 @@ function money(n) {
|
|
|
141
141
|
var SYNTHETIC_ASSIGNING_AUTHORITY = Object.freeze({
|
|
142
142
|
/** The human-readable assigning-authority namespace id (HL7 HD.1). */
|
|
143
143
|
namespaceId: "COSYTE-SYNTH",
|
|
144
|
-
/** The universal id, an OID under
|
|
144
|
+
/** The universal id, an OID this package chose under the root `2.16.840.1.113883.19` (HD.2). */
|
|
145
145
|
universalId: "2.16.840.1.113883.19.999",
|
|
146
146
|
/** The universal id type (HD.3). */
|
|
147
147
|
universalIdType: "ISO"
|
|
@@ -160,6 +160,18 @@ var TEST_NET_V4_PREFIXES = Object.freeze([
|
|
|
160
160
|
// TEST-NET-3
|
|
161
161
|
]);
|
|
162
162
|
var DOC_V6_PREFIX = "2001:db8";
|
|
163
|
+
var ITIN_GROUP_RANGES = Object.freeze([
|
|
164
|
+
Object.freeze({ min: 50, max: 65 }),
|
|
165
|
+
Object.freeze({ min: 70, max: 88 }),
|
|
166
|
+
Object.freeze({ min: 90, max: 92 }),
|
|
167
|
+
Object.freeze({ min: 94, max: 99 })
|
|
168
|
+
]);
|
|
169
|
+
var ITIN_EXCLUDED_GROUPS = Object.freeze([89, 93]);
|
|
170
|
+
var SSN_SYNTHETIC_GROUPS = Object.freeze(
|
|
171
|
+
Array.from({ length: 100 }, (_unused, group) => group).filter(
|
|
172
|
+
(group) => !ITIN_GROUP_RANGES.some((range) => group >= range.min && group <= range.max) && !ITIN_EXCLUDED_GROUPS.includes(group)
|
|
173
|
+
).map((group) => String(group).padStart(2, "0"))
|
|
174
|
+
);
|
|
163
175
|
var NPI_LUHN_PREFIX = "80840";
|
|
164
176
|
function luhnMod10(digits) {
|
|
165
177
|
let sum = 0;
|
|
@@ -268,10 +280,10 @@ var SYNTHETIC_CITY_NAMES = Object.freeze([
|
|
|
268
280
|
// src/safe/providers.ts
|
|
269
281
|
function ssn(rng, block = "never-issued") {
|
|
270
282
|
if (block === "advertising") {
|
|
271
|
-
return `987-
|
|
283
|
+
return `987-00-432${String(rng.int(0, 9))}`;
|
|
272
284
|
}
|
|
273
285
|
const area = rng.int(900, 999);
|
|
274
|
-
const group = rng.
|
|
286
|
+
const group = rng.pick(SSN_SYNTHETIC_GROUPS);
|
|
275
287
|
const serial = rng.digits(4);
|
|
276
288
|
return `${String(area)}-${group}-${serial}`;
|
|
277
289
|
}
|