@cosyte/terminology 0.0.6 → 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/dist/index.d.cts CHANGED
@@ -963,8 +963,8 @@ interface LoadWarning {
963
963
  }
964
964
  /**
965
965
  * A loaded, immutable code-system release — the queryable model {@link loadCodeSystem} produces and
966
- * {@link lookup} / {@link validateCode} run over. Concepts are keyed by code for O(1) identity; the
967
- * map is exposed `readonly` and every concept is frozen.
966
+ * {@link lookup} / {@link validateCode} run over. Concepts are keyed by code for O(1) identity, and
967
+ * every concept is frozen.
968
968
  */
969
969
  interface CodeSystem {
970
970
  /** The code system's canonical URI, when supplied by the source. */
@@ -975,7 +975,14 @@ interface CodeSystem {
975
975
  readonly name?: string;
976
976
  /** The number of loaded concepts. */
977
977
  readonly count: number;
978
- /** The concepts, keyed by `code`. Read-only; every value frozen. */
978
+ /**
979
+ * The concepts, keyed by `code`. A **read-only view**, not a `Map` you were handed: reads and
980
+ * iteration behave as a `Map`'s do, adding / deleting / clearing is refused however it is
981
+ * attempted, and every value is frozen.
982
+ *
983
+ * A view is not a `Map` instance — `instanceof Map` is `false` and this model cannot be
984
+ * `structuredClone`d or posted to a worker; copy out what you need (`new Map(…)`).
985
+ */
979
986
  readonly concepts: ReadonlyMap<string, Concept>;
980
987
  /** The skipped-row warnings surfaced during load, in line order. Frozen; may be empty. */
981
988
  readonly warnings: readonly LoadWarning[];
@@ -2247,11 +2254,11 @@ declare function parseUcum(unit: string): ParseResult;
2247
2254
  * @throws {Error} If reducing `node` reaches an atom with no linear definition, or one whose
2248
2255
  * definition does not parse. **No expression {@link parseUcum} accepts reaches either**; a node
2249
2256
  * you assemble yourself can, including by defining an atom in terms of a special unit such as
2250
- * `Cel`, which lands on the table's own `Cel`. A third guard, against a definition that leads
2251
- * back to itself, is **not** reachable from a node you assemble — a definition is resolved
2252
- * against the bundled table, so your atom can name a table atom but never be one — and is
2253
- * reached only by mutating an atom of the loaded table in place. The message names the fault,
2254
- * never the atom.
2257
+ * `Cel`, which lands on the table's own `Cel`. A third guard catches a definition that leads back
2258
+ * to itself. Naming a table atom does not reach it — a definition is resolved against the loaded
2259
+ * table, so your atom can name one but never be one — and neither does the table itself, which is
2260
+ * frozen; what reaches it is a `value` accessor that re-enters `reduce` for the same atom while
2261
+ * that atom is still being reduced. The message names the fault, never the atom.
2255
2262
  * @example
2256
2263
  * ```ts
2257
2264
  * import { parseUcum, reduce } from "@cosyte/terminology";
@@ -2282,7 +2289,13 @@ declare function reduce(node: UnitNode): Reduction;
2282
2289
  /**
2283
2290
  * Load the UCUM essence table, parsing the embedded verbatim XML on first call and caching it.
2284
2291
  *
2285
- * @returns The immutable in-memory {@link UcumEssence} model (7 base units, 24 prefixes, ~305 atoms).
2292
+ * One table is shared by every caller and by the engine itself, so it is handed out **frozen**: an
2293
+ * atom's definition cannot be rewritten in place, and neither can the `atoms` array the parser
2294
+ * scans. It used to be, and doing so before that atom's first reduction poisoned the
2295
+ * reduction memo for the life of the process — a fabricated unit equivalence that survived putting
2296
+ * the table back. A write is refused, which in strict mode means a `TypeError`.
2297
+ *
2298
+ * @returns The shared, frozen in-memory {@link UcumEssence} model.
2286
2299
  * @example
2287
2300
  * ```ts
2288
2301
  * import { loadUcumEssence } from "@cosyte/terminology";
@@ -2376,6 +2389,13 @@ interface GemEntry {
2376
2389
  /**
2377
2390
  * A loaded, immutable GEM map. Entries are keyed by source code (a source may have many entries — the
2378
2391
  * maps are 1:many). Applied **only** in its {@link direction}; never inverted.
2392
+ *
2393
+ * {@link entries} is a **read-only view**, not a `Map` you were handed, and each source's candidate
2394
+ * list is frozen: nothing that holds a loaded map can delete a source's mapping, or add a target the
2395
+ * steward's file never authored, and have {@link applyGem} answer from it.
2396
+ *
2397
+ * A view is not a `Map` instance — `instanceof Map` is `false` and this model cannot be
2398
+ * `structuredClone`d or posted to a worker; copy out what you need (`new Map(…)`).
2379
2399
  */
2380
2400
  interface GemMap {
2381
2401
  /** Which direction this file maps. Applied only this way. */
@@ -2384,7 +2404,7 @@ interface GemMap {
2384
2404
  readonly version?: string;
2385
2405
  /** The number of loaded entries. */
2386
2406
  readonly count: number;
2387
- /** Entries keyed by source code, each list in file order. Read-only; frozen. */
2407
+ /** Entries keyed by source code, each list in file order. Each list frozen. */
2388
2408
  readonly entries: ReadonlyMap<string, readonly GemEntry[]>;
2389
2409
  /** The skipped-row warnings surfaced during load, in line order. Frozen; may be empty. */
2390
2410
  readonly warnings: readonly GemLoadWarning[];
@@ -2475,6 +2495,13 @@ interface ComplexMapEntry {
2475
2495
  /**
2476
2496
  * A loaded, immutable SNOMED→ICD-10-CM complex map. Entries are keyed by source concept id; within a
2477
2497
  * source they are ordered by (group, priority). Applied **only** SNOMED→ICD-10-CM; never inverted.
2498
+ *
2499
+ * {@link entries} is a **read-only view**, not a `Map` you were handed, and each source's rule list
2500
+ * is frozen: nothing that holds a loaded map can delete a source concept's rules, or add one your
2501
+ * refset never carried, and have {@link applyComplexMap} resolve from it.
2502
+ *
2503
+ * A view is not a `Map` instance — `instanceof Map` is `false` and this model cannot be
2504
+ * `structuredClone`d or posted to a worker; copy out what you need (`new Map(…)`).
2478
2505
  */
2479
2506
  interface ComplexMap {
2480
2507
  /** The map version/release, when supplied — mappings are release-scoped. */
@@ -3051,16 +3078,25 @@ interface RxNormLoadWarning {
3051
3078
  }
3052
3079
  /**
3053
3080
  * A loaded, immutable RxNorm drug graph: concepts keyed by `RXCUI`, edges indexed by subject, and the
3054
- * NDC→RXCUI attribute index — all frozen. Applied only in the authored edge direction; never inverted.
3081
+ * NDC→RXCUI attribute index. Applied only in the authored edge direction; never inverted.
3082
+ *
3083
+ * Its three indexes are **read-only views**, not `Map`s you were handed: reads and iteration behave
3084
+ * as a `Map`'s do, and adding / deleting / clearing is refused however it is attempted. What that
3085
+ * buys is the never-fabricate invariant surviving the handover — nothing that holds a loaded graph
3086
+ * can empty a medication's ingredient edges, or add an edge or concept the release never authored,
3087
+ * and leave {@link conceptCount} / {@link edgeCount} still reporting the loaded figures.
3088
+ *
3089
+ * A view is not a `Map` instance — `instanceof Map` is `false` and this model cannot be
3090
+ * `structuredClone`d or posted to a worker; copy out what you need (`new Map(…)`).
3055
3091
  */
3056
3092
  interface RxNormGraph {
3057
3093
  /** The release version (e.g. `"RXNORM_2026AA"`), when supplied — mappings are release-scoped. */
3058
3094
  readonly version?: string;
3059
- /** Concepts keyed by `RXCUI` (first `SAB=RXNORM` atom per `RXCUI` wins). Frozen. */
3095
+ /** Concepts keyed by `RXCUI` (first `SAB=RXNORM` atom per `RXCUI` wins). Each frozen. */
3060
3096
  readonly concepts: ReadonlyMap<string, RxNormConcept>;
3061
- /** Directed edges indexed by `subject` `RXCUI`, each list in file order. Frozen. */
3097
+ /** Directed edges indexed by `subject` `RXCUI`, each list in file order. Each list frozen. */
3062
3098
  readonly edges: ReadonlyMap<string, readonly RxNormEdge[]>;
3063
- /** NDC → { rxcui, status } index from `RXNSAT` `ATN=NDC` attributes. Frozen; may be empty. */
3099
+ /** NDC → { rxcui, status } index from `RXNSAT` `ATN=NDC` attributes. Each frozen; may be empty. */
3064
3100
  readonly ndcs: ReadonlyMap<string, {
3065
3101
  readonly rxcui: string;
3066
3102
  readonly status: NdcStatus;
package/dist/index.d.ts CHANGED
@@ -963,8 +963,8 @@ interface LoadWarning {
963
963
  }
964
964
  /**
965
965
  * A loaded, immutable code-system release — the queryable model {@link loadCodeSystem} produces and
966
- * {@link lookup} / {@link validateCode} run over. Concepts are keyed by code for O(1) identity; the
967
- * map is exposed `readonly` and every concept is frozen.
966
+ * {@link lookup} / {@link validateCode} run over. Concepts are keyed by code for O(1) identity, and
967
+ * every concept is frozen.
968
968
  */
969
969
  interface CodeSystem {
970
970
  /** The code system's canonical URI, when supplied by the source. */
@@ -975,7 +975,14 @@ interface CodeSystem {
975
975
  readonly name?: string;
976
976
  /** The number of loaded concepts. */
977
977
  readonly count: number;
978
- /** The concepts, keyed by `code`. Read-only; every value frozen. */
978
+ /**
979
+ * The concepts, keyed by `code`. A **read-only view**, not a `Map` you were handed: reads and
980
+ * iteration behave as a `Map`'s do, adding / deleting / clearing is refused however it is
981
+ * attempted, and every value is frozen.
982
+ *
983
+ * A view is not a `Map` instance — `instanceof Map` is `false` and this model cannot be
984
+ * `structuredClone`d or posted to a worker; copy out what you need (`new Map(…)`).
985
+ */
979
986
  readonly concepts: ReadonlyMap<string, Concept>;
980
987
  /** The skipped-row warnings surfaced during load, in line order. Frozen; may be empty. */
981
988
  readonly warnings: readonly LoadWarning[];
@@ -2247,11 +2254,11 @@ declare function parseUcum(unit: string): ParseResult;
2247
2254
  * @throws {Error} If reducing `node` reaches an atom with no linear definition, or one whose
2248
2255
  * definition does not parse. **No expression {@link parseUcum} accepts reaches either**; a node
2249
2256
  * you assemble yourself can, including by defining an atom in terms of a special unit such as
2250
- * `Cel`, which lands on the table's own `Cel`. A third guard, against a definition that leads
2251
- * back to itself, is **not** reachable from a node you assemble — a definition is resolved
2252
- * against the bundled table, so your atom can name a table atom but never be one — and is
2253
- * reached only by mutating an atom of the loaded table in place. The message names the fault,
2254
- * never the atom.
2257
+ * `Cel`, which lands on the table's own `Cel`. A third guard catches a definition that leads back
2258
+ * to itself. Naming a table atom does not reach it — a definition is resolved against the loaded
2259
+ * table, so your atom can name one but never be one — and neither does the table itself, which is
2260
+ * frozen; what reaches it is a `value` accessor that re-enters `reduce` for the same atom while
2261
+ * that atom is still being reduced. The message names the fault, never the atom.
2255
2262
  * @example
2256
2263
  * ```ts
2257
2264
  * import { parseUcum, reduce } from "@cosyte/terminology";
@@ -2282,7 +2289,13 @@ declare function reduce(node: UnitNode): Reduction;
2282
2289
  /**
2283
2290
  * Load the UCUM essence table, parsing the embedded verbatim XML on first call and caching it.
2284
2291
  *
2285
- * @returns The immutable in-memory {@link UcumEssence} model (7 base units, 24 prefixes, ~305 atoms).
2292
+ * One table is shared by every caller and by the engine itself, so it is handed out **frozen**: an
2293
+ * atom's definition cannot be rewritten in place, and neither can the `atoms` array the parser
2294
+ * scans. It used to be, and doing so before that atom's first reduction poisoned the
2295
+ * reduction memo for the life of the process — a fabricated unit equivalence that survived putting
2296
+ * the table back. A write is refused, which in strict mode means a `TypeError`.
2297
+ *
2298
+ * @returns The shared, frozen in-memory {@link UcumEssence} model.
2286
2299
  * @example
2287
2300
  * ```ts
2288
2301
  * import { loadUcumEssence } from "@cosyte/terminology";
@@ -2376,6 +2389,13 @@ interface GemEntry {
2376
2389
  /**
2377
2390
  * A loaded, immutable GEM map. Entries are keyed by source code (a source may have many entries — the
2378
2391
  * maps are 1:many). Applied **only** in its {@link direction}; never inverted.
2392
+ *
2393
+ * {@link entries} is a **read-only view**, not a `Map` you were handed, and each source's candidate
2394
+ * list is frozen: nothing that holds a loaded map can delete a source's mapping, or add a target the
2395
+ * steward's file never authored, and have {@link applyGem} answer from it.
2396
+ *
2397
+ * A view is not a `Map` instance — `instanceof Map` is `false` and this model cannot be
2398
+ * `structuredClone`d or posted to a worker; copy out what you need (`new Map(…)`).
2379
2399
  */
2380
2400
  interface GemMap {
2381
2401
  /** Which direction this file maps. Applied only this way. */
@@ -2384,7 +2404,7 @@ interface GemMap {
2384
2404
  readonly version?: string;
2385
2405
  /** The number of loaded entries. */
2386
2406
  readonly count: number;
2387
- /** Entries keyed by source code, each list in file order. Read-only; frozen. */
2407
+ /** Entries keyed by source code, each list in file order. Each list frozen. */
2388
2408
  readonly entries: ReadonlyMap<string, readonly GemEntry[]>;
2389
2409
  /** The skipped-row warnings surfaced during load, in line order. Frozen; may be empty. */
2390
2410
  readonly warnings: readonly GemLoadWarning[];
@@ -2475,6 +2495,13 @@ interface ComplexMapEntry {
2475
2495
  /**
2476
2496
  * A loaded, immutable SNOMED→ICD-10-CM complex map. Entries are keyed by source concept id; within a
2477
2497
  * source they are ordered by (group, priority). Applied **only** SNOMED→ICD-10-CM; never inverted.
2498
+ *
2499
+ * {@link entries} is a **read-only view**, not a `Map` you were handed, and each source's rule list
2500
+ * is frozen: nothing that holds a loaded map can delete a source concept's rules, or add one your
2501
+ * refset never carried, and have {@link applyComplexMap} resolve from it.
2502
+ *
2503
+ * A view is not a `Map` instance — `instanceof Map` is `false` and this model cannot be
2504
+ * `structuredClone`d or posted to a worker; copy out what you need (`new Map(…)`).
2478
2505
  */
2479
2506
  interface ComplexMap {
2480
2507
  /** The map version/release, when supplied — mappings are release-scoped. */
@@ -3051,16 +3078,25 @@ interface RxNormLoadWarning {
3051
3078
  }
3052
3079
  /**
3053
3080
  * A loaded, immutable RxNorm drug graph: concepts keyed by `RXCUI`, edges indexed by subject, and the
3054
- * NDC→RXCUI attribute index — all frozen. Applied only in the authored edge direction; never inverted.
3081
+ * NDC→RXCUI attribute index. Applied only in the authored edge direction; never inverted.
3082
+ *
3083
+ * Its three indexes are **read-only views**, not `Map`s you were handed: reads and iteration behave
3084
+ * as a `Map`'s do, and adding / deleting / clearing is refused however it is attempted. What that
3085
+ * buys is the never-fabricate invariant surviving the handover — nothing that holds a loaded graph
3086
+ * can empty a medication's ingredient edges, or add an edge or concept the release never authored,
3087
+ * and leave {@link conceptCount} / {@link edgeCount} still reporting the loaded figures.
3088
+ *
3089
+ * A view is not a `Map` instance — `instanceof Map` is `false` and this model cannot be
3090
+ * `structuredClone`d or posted to a worker; copy out what you need (`new Map(…)`).
3055
3091
  */
3056
3092
  interface RxNormGraph {
3057
3093
  /** The release version (e.g. `"RXNORM_2026AA"`), when supplied — mappings are release-scoped. */
3058
3094
  readonly version?: string;
3059
- /** Concepts keyed by `RXCUI` (first `SAB=RXNORM` atom per `RXCUI` wins). Frozen. */
3095
+ /** Concepts keyed by `RXCUI` (first `SAB=RXNORM` atom per `RXCUI` wins). Each frozen. */
3060
3096
  readonly concepts: ReadonlyMap<string, RxNormConcept>;
3061
- /** Directed edges indexed by `subject` `RXCUI`, each list in file order. Frozen. */
3097
+ /** Directed edges indexed by `subject` `RXCUI`, each list in file order. Each list frozen. */
3062
3098
  readonly edges: ReadonlyMap<string, readonly RxNormEdge[]>;
3063
- /** NDC → { rxcui, status } index from `RXNSAT` `ATN=NDC` attributes. Frozen; may be empty. */
3099
+ /** NDC → { rxcui, status } index from `RXNSAT` `ATN=NDC` attributes. Each frozen; may be empty. */
3064
3100
  readonly ndcs: ReadonlyMap<string, {
3065
3101
  readonly rxcui: string;
3066
3102
  readonly status: NdcStatus;
package/dist/index.mjs CHANGED
@@ -565,6 +565,31 @@ function translate(sourceCoding, map) {
565
565
  );
566
566
  }
567
567
 
568
+ // src/common/frozen-map.ts
569
+ function frozenMap(source, what) {
570
+ const refuse = () => {
571
+ throw new TypeError(`Cannot mutate ${what} (it is immutable)`);
572
+ };
573
+ const view = {
574
+ get size() {
575
+ return source.size;
576
+ },
577
+ get: (key) => source.get(key),
578
+ has: (key) => source.has(key),
579
+ keys: () => source.keys(),
580
+ values: () => source.values(),
581
+ entries: () => source.entries(),
582
+ forEach: (callback, thisArg) => {
583
+ for (const [key, value] of source) callback.call(thisArg, value, key, view);
584
+ },
585
+ [Symbol.iterator]: () => source[Symbol.iterator](),
586
+ set: refuse,
587
+ delete: refuse,
588
+ clear: refuse
589
+ };
590
+ return Object.freeze(view);
591
+ }
592
+
568
593
  // src/codesystem/status.ts
569
594
  var defaultStatusMapper = (raw) => {
570
595
  switch (raw.trim().toUpperCase()) {
@@ -971,15 +996,6 @@ function parseRrf(source) {
971
996
  }
972
997
 
973
998
  // src/codesystem/load.ts
974
- function sealConceptMap(map) {
975
- const guard = () => {
976
- throw new TypeError("Cannot mutate a loaded CodeSystem's concepts map (it is immutable)");
977
- };
978
- for (const method of ["set", "delete", "clear"]) {
979
- Object.defineProperty(map, method, { value: guard, writable: false, configurable: false });
980
- }
981
- return map;
982
- }
983
999
  function loadCodeSystem(source) {
984
1000
  let concepts;
985
1001
  let warnings;
@@ -1017,7 +1033,7 @@ function loadCodeSystem(source) {
1017
1033
  }
1018
1034
  }
1019
1035
  out.count = concepts.size;
1020
- out.concepts = sealConceptMap(concepts);
1036
+ out.concepts = frozenMap(concepts, "a loaded CodeSystem's concepts map");
1021
1037
  out.warnings = Object.freeze(warnings);
1022
1038
  return Object.freeze(out);
1023
1039
  }
@@ -3731,7 +3747,29 @@ function parseEssence(xml) {
3731
3747
  atoms.sort((a, b) => b.code.length - a.code.length);
3732
3748
  const atomByCode = new Map(atoms.map((a) => [a.code, a]));
3733
3749
  const prefixByCode = new Map(prefixes.map((p) => [p.code, p]));
3734
- return { prefixes, atoms, atomByCode, prefixByCode };
3750
+ return freezeEssence({ prefixes, atoms, atomByCode, prefixByCode });
3751
+ }
3752
+ function refuseTableWrite() {
3753
+ throw new TypeError("the UCUM unit table is immutable");
3754
+ }
3755
+ function sealLookup(map) {
3756
+ return Object.defineProperties(map, {
3757
+ set: { value: refuseTableWrite },
3758
+ delete: { value: refuseTableWrite },
3759
+ clear: { value: refuseTableWrite }
3760
+ });
3761
+ }
3762
+ function freezeEssence(essence) {
3763
+ for (const atom of essence.atoms) {
3764
+ if (atom.value) Object.freeze(atom.value);
3765
+ Object.freeze(atom);
3766
+ }
3767
+ for (const prefix of essence.prefixes) Object.freeze(prefix);
3768
+ Object.freeze(essence.atoms);
3769
+ Object.freeze(essence.prefixes);
3770
+ sealLookup(essence.atomByCode);
3771
+ sealLookup(essence.prefixByCode);
3772
+ return Object.freeze(essence);
3735
3773
  }
3736
3774
  var cached;
3737
3775
  function loadUcumEssence() {
@@ -4045,21 +4083,25 @@ function loadGems(source) {
4045
4083
  if (trimmed === "") continue;
4046
4084
  const fields = trimmed.split(/\s+/);
4047
4085
  if (fields.length !== 3) {
4048
- warnings.push({
4049
- code: "TERM_GEM_MALFORMED_ROW",
4050
- line: i + 1,
4051
- detail: `expected 3 whitespace-delimited fields, found ${String(fields.length)}`
4052
- });
4086
+ warnings.push(
4087
+ Object.freeze({
4088
+ code: "TERM_GEM_MALFORMED_ROW",
4089
+ line: i + 1,
4090
+ detail: `expected 3 whitespace-delimited fields, found ${String(fields.length)}`
4091
+ })
4092
+ );
4053
4093
  continue;
4054
4094
  }
4055
4095
  const [src, tgt, flagStr] = fields;
4056
4096
  const flags = decodeFlags(flagStr);
4057
4097
  if (flags === void 0) {
4058
- warnings.push({
4059
- code: "TERM_GEM_MALFORMED_ROW",
4060
- line: i + 1,
4061
- detail: "flag field is not a 5-digit code"
4062
- });
4098
+ warnings.push(
4099
+ Object.freeze({
4100
+ code: "TERM_GEM_MALFORMED_ROW",
4101
+ line: i + 1,
4102
+ detail: "flag field is not a 5-digit code"
4103
+ })
4104
+ );
4063
4105
  continue;
4064
4106
  }
4065
4107
  const entry = { source: src, flags };
@@ -4070,11 +4112,12 @@ function loadGems(source) {
4070
4112
  else entries.set(src, [frozen]);
4071
4113
  count++;
4072
4114
  }
4115
+ for (const list of entries.values()) Object.freeze(list);
4073
4116
  return Object.freeze({
4074
4117
  direction: source.direction,
4075
4118
  ...source.version !== void 0 ? { version: source.version } : {},
4076
4119
  count,
4077
- entries,
4120
+ entries: frozenMap(entries, "a loaded GEM map's entries"),
4078
4121
  warnings: Object.freeze(warnings)
4079
4122
  });
4080
4123
  }
@@ -4222,11 +4265,13 @@ function parseRf2(content) {
4222
4265
  const groupN = Number(at(f, iGroup));
4223
4266
  const priorityN = Number(at(f, iPriority));
4224
4267
  if (source === "" || !Number.isFinite(groupN) || !Number.isFinite(priorityN)) {
4225
- warnings.push({
4226
- code: "TERM_COMPLEX_MAP_MALFORMED_ROW",
4227
- line: i + 1,
4228
- detail: "row is missing referencedComponentId / mapGroup / mapPriority"
4229
- });
4268
+ warnings.push(
4269
+ Object.freeze({
4270
+ code: "TERM_COMPLEX_MAP_MALFORMED_ROW",
4271
+ line: i + 1,
4272
+ detail: "row is missing referencedComponentId / mapGroup / mapPriority"
4273
+ })
4274
+ );
4230
4275
  continue;
4231
4276
  }
4232
4277
  rows.push({
@@ -4269,7 +4314,7 @@ function loadComplexMap(input) {
4269
4314
  }
4270
4315
  const out = {
4271
4316
  count,
4272
- entries,
4317
+ entries: frozenMap(entries, "a loaded complex map's entries"),
4273
4318
  warnings
4274
4319
  };
4275
4320
  if (input.version !== void 0) out.version = input.version;
@@ -4563,9 +4608,9 @@ function loadRxNormGraph(source) {
4563
4608
  const ndcs = source.sat !== void 0 ? parseNdcs(source.sat, warnings) : /* @__PURE__ */ new Map();
4564
4609
  for (const list of edges.values()) Object.freeze(list);
4565
4610
  const out = {
4566
- concepts,
4567
- edges,
4568
- ndcs,
4611
+ concepts: frozenMap(concepts, "a loaded RxNorm graph's concepts"),
4612
+ edges: frozenMap(edges, "a loaded RxNorm graph's edges"),
4613
+ ndcs: frozenMap(ndcs, "a loaded RxNorm graph's NDC index"),
4569
4614
  conceptCount: concepts.size,
4570
4615
  edgeCount,
4571
4616
  warnings: Object.freeze(warnings)
@@ -4729,7 +4774,7 @@ function approximateMatch(graph, query, options = {}) {
4729
4774
  }
4730
4775
 
4731
4776
  // src/index.ts
4732
- var VERSION = "0.0.6";
4777
+ var VERSION = "0.0.8";
4733
4778
 
4734
4779
  export { COMPLEX_MAP_SOURCE_SYSTEM, DIAGNOSTIC_CODES, FATAL_CODES, HL7_V2_OID_ROOT, HL7_V2_URL_PREFIX, ICD10CM_ORDER_FILE_FIELDS, ICD10CM_SYSTEM, ICD9CM_SYSTEM, MAP_CATEGORIES, NO_MAP_CATEGORIES, RELA, RELA_INVERSE, RXNORM_SYSTEM, SNOMEDCT_SYSTEM, SYSTEM_IDENTITIES, TERM_TYPES, TerminologyError, VERSION, applyComplexMap, applyGem, approximateMatch, asTermType, brandsFor, buildSubsumption, codeableConcept, coding, consistsOf, defaultStatusMapper, doseFormsOf, expand, genericFor, getArray, getBoolean, getConcept, getNumber, getString, ingredientsOf, invertGem, isA, isJsonObject, isSynonymTermType, isUnknownSystem, loadCodeSystem, loadComplexMap, loadConceptMap, loadGems, loadRxNormGraph, loadUcumEssence, loadValueSet, lookup, makeStatus, matchesFilter, parseCsv, parseCsvSource, parseFhirCodeSystem, parseFixedWidth, parseRrf, parseRrfLine, parseUcum, reduce, relatedByRela, resolveNdc, resolveSystem, sliceField, translate, ucumEqual, unsupportedOps, validateCode, validateCodeInValueSet, validateUcum };
4735
4780
  //# sourceMappingURL=index.mjs.map