@cosyte/hl7 0.0.2 → 0.0.3

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.mjs CHANGED
@@ -36,7 +36,7 @@ var ProfileDefinitionError = class extends Error {
36
36
  profileName;
37
37
  /**
38
38
  * Construct a new `ProfileDefinitionError`. `profileName` is optional so
39
- * Phase 6 callers may omit it when the offending profile cannot be named
39
+ * callers may omit it when the offending profile cannot be named
40
40
  * (e.g. during initial validation before a name is parsed).
41
41
  *
42
42
  * @internal
@@ -1861,11 +1861,11 @@ var Field = class {
1861
1861
  isNull;
1862
1862
  /** Reference to the underlying `RawField.repetitions` (no defensive copy). */
1863
1863
  repetitions;
1864
- /** The 5 encoding characters for this message. Exposed for composite parsers (Plan 04). @internal */
1864
+ /** The 5 encoding characters for this message. Exposed for composite parsers. @internal */
1865
1865
  enc;
1866
1866
  /** Position of this field in the parent message: used for position-aware error messages. @internal */
1867
1867
  position;
1868
- /** The full `RawField` this wrapper wraps. Exposed for composite parsers (Plan 02/03/04). @internal */
1868
+ /** The full `RawField` this wrapper wraps. Exposed for composite parsers. @internal */
1869
1869
  raw;
1870
1870
  /**
1871
1871
  * Construct a new `Field`. Called internally by `Segment.field(n)`; user
@@ -1882,7 +1882,7 @@ var Field = class {
1882
1882
  /**
1883
1883
  * First-repetition, first-component, first-subcomponent value as a decoded
1884
1884
  * string: unescaped ONCE by the tokenizer on parse, returned verbatim here
1885
- * (never re-unescaped, HL7-VALUE-REDECODE). Returns `""` when the field is
1885
+ * (never re-unescaped). Returns `""` when the field is
1886
1886
  * empty or HL7 null. Equivalent to `msg.get('SEG.N')` for a top-level access.
1887
1887
  *
1888
1888
  * @example
@@ -1913,7 +1913,7 @@ var Field = class {
1913
1913
  * vendor-quirk control id containing an unescaped delimiter (`ID^X`) must
1914
1914
  * not be truncated to its first component.
1915
1915
  *
1916
- * **Byte-verbatim for parsed content (HL7-ESC).** The parse pipeline stores
1916
+ * **Byte-verbatim for parsed content.** The parse pipeline stores
1917
1917
  * *decoded* content, but also records the original wire bytes of any escape
1918
1918
  * whose decode is not byte-faithful (`RawComponent.rawSubcomponents`), so
1919
1919
  * re-serialization preserves the sender's exact escape bytes: hex escapes
@@ -2167,7 +2167,7 @@ var Segment = class {
2167
2167
  enc;
2168
2168
  /** Absolute index of this segment in `Hl7Message.rawSegments[]`. Used for position tracking. @internal */
2169
2169
  absoluteIndex;
2170
- /** The full `RawSegment` this wrapper wraps. Exposed for mutation methods (Plan 04). @internal */
2170
+ /** The full `RawSegment` this wrapper wraps. Exposed for mutation methods. @internal */
2171
2171
  raw;
2172
2172
  /**
2173
2173
  * Lookup map from profile-declared field name → 1-indexed HL7 position.
@@ -2184,7 +2184,7 @@ var Segment = class {
2184
2184
  * should obtain `Segment` instances via `msg.segments(type)` or
2185
2185
  * `msg.allSegments()`.
2186
2186
  *
2187
- * The optional `customFields` parameter is the per-segment slice of the
2187
+ * The optional `customFields` parameter is the per-segment portion of the
2188
2188
  * applied profile's merged `customSegments` map (PROF-07 / D-16). When
2189
2189
  * supplied, `get(name)` resolves names against it; otherwise `get(name)`
2190
2190
  * always returns `undefined`.
@@ -3879,8 +3879,7 @@ var Hl7Message = class {
3879
3879
  * Raw positional tree produced by the parser. 1-indexed per HL7 convention
3880
3880
  * (`fields[0]` is the segment-name / MSH separator placeholder slot). Use
3881
3881
  * `segments(type)` / `allSegments()` for typed wrapper access: this field
3882
- * is exposed for advanced callers that need the raw tree directly (e.g.
3883
- * future serialization phase 5).
3882
+ * is exposed for advanced callers that need the raw tree directly.
3884
3883
  */
3885
3884
  rawSegments;
3886
3885
  encodingCharacters;
@@ -3896,7 +3895,7 @@ var Hl7Message = class {
3896
3895
  dateFormats;
3897
3896
  /**
3898
3897
  * Merged `customSegments` map from the applied profile, stored so
3899
- * `allSegments()` can hand per-segment slices to `Segment` constructors
3898
+ * `allSegments()` can hand per-segment portions to `Segment` constructors
3900
3899
  * (D-16). Undefined when no profile was applied.
3901
3900
  * @internal
3902
3901
  */
@@ -3905,40 +3904,40 @@ var Hl7Message = class {
3905
3904
  * Lazily built cache of Segment wrappers keyed by segment type. Built on
3906
3905
  * first `segments(type)` call and filtered from `_allSegments` so
3907
3906
  * individual Segment instances are identical across both caches (D-11).
3908
- * Plan 04 mutation methods drop this cache wholesale.
3907
+ * The mutation methods drop this cache wholesale.
3909
3908
  * @internal
3910
3909
  */
3911
3910
  _segmentsByType;
3912
3911
  /**
3913
3912
  * Lazily built cache of every Segment wrapper in document order. Built on
3914
- * first `segments(type)` / `allSegments()` call. Plan 04 mutation methods
3913
+ * first `segments(type)` / `allSegments()` call. The mutation methods
3915
3914
  * drop this cache wholesale.
3916
3915
  * @internal
3917
3916
  */
3918
3917
  _allSegments;
3919
3918
  /**
3920
- * Lazily built `Meta` view (Phase 4 D-02 memoization). Dropped wholesale
3919
+ * Lazily built `Meta` view (memoized). Dropped wholesale
3921
3920
  * by `invalidateCaches`. `Meta` is always defined (D-03: MSH absence
3922
3921
  * throws `NO_MSH_SEGMENT` at parse time) so no null-sentinel is needed.
3923
3922
  * @internal
3924
3923
  */
3925
3924
  _meta;
3926
3925
  /**
3927
- * Lazily built `MessageStructure` view (Phase G). Dropped wholesale by
3926
+ * Lazily built `MessageStructure` view. Dropped wholesale by
3928
3927
  * `invalidateCaches`. Always defined: `analyzeMessageStructure` returns an
3929
3928
  * `recognized: false` summary for unmodelled types rather than absence.
3930
3929
  * @internal
3931
3930
  */
3932
3931
  _structure;
3933
3932
  /**
3934
- * Lazily built `Patient | undefined` view (Phase 4 D-02 memoization). Uses
3933
+ * Lazily built `Patient | undefined` view (memoized). Uses
3935
3934
  * a null-sentinel cache because `undefined` means "not yet computed" while
3936
3935
  * `null` means "computed, absent". D-04: no PID → public value `undefined`.
3937
3936
  * @internal
3938
3937
  */
3939
3938
  _patient;
3940
3939
  /**
3941
- * Lazily built `Visit | undefined` view (Phase 4 D-02 memoization). Same
3940
+ * Lazily built `Visit | undefined` view (memoized). Same
3942
3941
  * null-sentinel convention as `_patient`. HELPERS-03: no PV1 → public
3943
3942
  * value `undefined`.
3944
3943
  * @internal
@@ -3962,8 +3961,8 @@ var Hl7Message = class {
3962
3961
  }
3963
3962
  /**
3964
3963
  * Resolve a dot-path (e.g. `PID.5.1`, `OBX[2].5`, `PID.3[0].1`) to its
3965
- * decoded leaf string (unescaped once at parse: never re-unescaped on read,
3966
- * HL7-VALUE-REDECODE). Returns `undefined` when the path doesn't
3964
+ * decoded leaf string (unescaped once at parse: never re-unescaped on
3965
+ * read). Returns `undefined` when the path doesn't
3967
3966
  * resolve: never throws on missing path (MODEL-05). Throws `TypeError`
3968
3967
  * on malformed path syntax (e.g. `"pid.5"`, empty string).
3969
3968
  *
@@ -3998,7 +3997,7 @@ var Hl7Message = class {
3998
3997
  * Return the cached array of `Segment` wrappers for `segmentType` in
3999
3998
  * document order. The returned array identity and the individual Segment
4000
3999
  * instances are both stable across calls (D-11). Invalidated wholesale
4001
- * by Plan 04 mutation methods.
4000
+ * by the mutation methods.
4002
4001
  *
4003
4002
  * @example
4004
4003
  * ```ts
@@ -4021,7 +4020,7 @@ var Hl7Message = class {
4021
4020
  * Iterate every `Segment` in document order (MSH first, then every
4022
4021
  * subsequent segment). Cached per-message; same array reference and same
4023
4022
  * Segment instances on repeat calls (D-11). Invalidated wholesale by
4024
- * Plan 04 mutation methods.
4023
+ * the mutation methods.
4025
4024
  *
4026
4025
  * @example
4027
4026
  * ```ts
@@ -4055,7 +4054,7 @@ var Hl7Message = class {
4055
4054
  * @example
4056
4055
  * ```ts
4057
4056
  * console.log(msg.meta.type); // "ADT^A01"
4058
- * console.log(msg.meta.timestamp?.raw); // fidelity TS (Phase N)
4057
+ * console.log(msg.meta.timestamp?.raw); // fidelity TS
4059
4058
  * console.log(msg.meta.controlId); // "MSG001"
4060
4059
  * ```
4061
4060
  */
@@ -4063,8 +4062,8 @@ var Hl7Message = class {
4063
4062
  return this._meta ??= buildMeta(this);
4064
4063
  }
4065
4064
  /**
4066
- * Structural-conformance summary for the common message types (roadmap
4067
- * Phase G): a misroute/truncation safety net, NOT a conformance validator.
4065
+ * Structural-conformance summary for the common message types: a
4066
+ * misroute/truncation safety net, NOT a conformance validator.
4068
4067
  * Reports, per the message's recognized (MSH-9.1, MSH-9.2) type, which
4069
4068
  * Required segment groups are present and which are entirely absent
4070
4069
  * (`missingGroups`: the same set the parser flags as
@@ -4132,7 +4131,7 @@ var Hl7Message = class {
4132
4131
  }
4133
4132
  /**
4134
4133
  * Every OBR as an Order with its OBX children grouped positionally (D-12) and
4135
- * its TQ1 / legacy embedded-TQ (ORC-7) `timings` (Phase M: the repeat pattern
4134
+ * its TQ1 / legacy embedded-TQ (ORC-7) `timings` (the repeat pattern is
4136
4135
  * surfaced verbatim, never resolved to a schedule). D-05: returns `[]` when no
4137
4136
  * OBR present. D-06: not memoized.
4138
4137
  *
@@ -4148,7 +4147,7 @@ var Hl7Message = class {
4148
4147
  return orders(this);
4149
4148
  }
4150
4149
  /**
4151
- * Message-level NTE notes (Phase P): every NTE segment with no recognized
4150
+ * Message-level NTE notes: every NTE segment with no recognized
4152
4151
  * preceding parent (not immediately following a `PID`, `ORC`, `OBR`, or
4153
4152
  * `OBX`), surfaced verbatim in document order so nothing is dropped. Notes
4154
4153
  * that DO attach to a specific patient / order / result are exposed on those
@@ -4165,7 +4164,7 @@ var Hl7Message = class {
4165
4164
  }
4166
4165
  /**
4167
4166
  * Every recognized ADT patient-identity event (merge / move / link /
4168
- * unlink / person add/update: roadmap Phase K), with the MRG-sourced
4167
+ * unlink / person add/update), with the MRG-sourced
4169
4168
  * `prior` and PID/PV1-sourced `surviving` parties labelled by role and the
4170
4169
  * spec-constant `direction: "MRG_TO_PID"` on merge/move events. Returns
4171
4170
  * `[]` when the trigger event is not in the identity family. D-06: not
@@ -4186,13 +4185,13 @@ var Hl7Message = class {
4186
4185
  }
4187
4186
  /**
4188
4187
  * Every RXO/RXE/RXD/RXA as a typed `Medication`, with RXR (route) and RXC
4189
- * (component) segments grouped positionally under their parent (Phase D,
4190
- * P0 safety). D-05: returns `[]` when no RX* parent present. D-06: not
4191
- * memoized. The give *amount* and give *strength* are surfaced separately
4192
- * and never reconciled (Phase D §4).
4188
+ * (component) segments grouped positionally under their parent. D-05:
4189
+ * returns `[]` when no RX* parent present. D-06: not memoized. The give
4190
+ * *amount* and give *strength* are surfaced separately and never
4191
+ * reconciled.
4193
4192
  *
4194
4193
  * Each medication also carries its TQ1 / legacy embedded-TQ (RXE-1) `timings`
4195
- * (Phase M: repeat pattern verbatim, never resolved to a schedule).
4194
+ * (repeat pattern verbatim, never resolved to a schedule).
4196
4195
  *
4197
4196
  * @example
4198
4197
  * ```ts
@@ -4209,7 +4208,7 @@ var Hl7Message = class {
4209
4208
  /**
4210
4209
  * Every RXA of a VXU^V04 as a typed `Immunization`, with RXR (route/site)
4211
4210
  * and OBX children grouped positionally under the RXA and `orderControl`
4212
- * from the preceding ORC of the VXU order group (Phase E, P0 safety). D-05:
4211
+ * from the preceding ORC of the VXU order group. D-05:
4213
4212
  * returns `[]` when no RXA present. D-06: not memoized. The vaccine code
4214
4213
  * carries its own provenance; the action code (RXA-21) is surfaced verbatim
4215
4214
  * and `recordOrigin` (administered vs historical) is derived only from the
@@ -4277,7 +4276,7 @@ var Hl7Message = class {
4277
4276
  return insurance(this);
4278
4277
  }
4279
4278
  /**
4280
- * Every SCH of an SIU message as a typed `Appointment` (roadmap Phase Q), with
4279
+ * Every SCH of an SIU message as a typed `Appointment`, with
4281
4280
  * the AIS/AIG/AIL/AIP resource segments that follow it grouped positionally
4282
4281
  * under that SCH. Surfaces the placer/filler appointment ids, SCH-25 filler
4283
4282
  * status (Table 0278), SCH-11 start/end timing, and the resource groups
@@ -4297,7 +4296,7 @@ var Hl7Message = class {
4297
4296
  return appointments(this);
4298
4297
  }
4299
4298
  /**
4300
- * Every TXA of an MDM message as a typed `ClinicalDocument` (roadmap Phase Q),
4299
+ * Every TXA of an MDM message as a typed `ClinicalDocument`,
4301
4300
  * with the OBX narrative body grouped positionally under that TXA. The
4302
4301
  * completion status (TXA-17) and availability status (TXA-19) are surfaced as
4303
4302
  * **distinct** fields and never conflated: a document can be available before
@@ -4317,7 +4316,7 @@ var Hl7Message = class {
4317
4316
  return documents(this);
4318
4317
  }
4319
4318
  /**
4320
- * Every FT1 of a DFT message as a typed `Charge` (roadmap Phase Q), one per
4319
+ * Every FT1 of a DFT message as a typed `Charge`, one per
4321
4320
  * FT1 in document order. Surfaces billing-critical fields (FT1-6 transaction
4322
4321
  * type, FT1-7 code, FT1-11/12 extended/unit amount, FT1-19 diagnosis linkage)
4323
4322
  * with **no billing logic and no money-as-float**: amounts are the verbatim
@@ -4411,7 +4410,7 @@ var Hl7Message = class {
4411
4410
  * `TypeError` with an actionable message otherwise).
4412
4411
  *
4413
4412
  * The value is accepted verbatim: unescaped delimiter characters are NOT
4414
- * rejected on input (D-18). Re-escaping on serialize is Phase 5's concern.
4413
+ * rejected on input (D-18). Re-escaping is the serializer's concern.
4415
4414
  *
4416
4415
  * MSH-1 / MSH-2 follow the user-facing HL7 convention: `setField("MSH.3", ...)`
4417
4416
  * targets MSH-3 (sending application), matching `msg.get("MSH.3")`.
@@ -4497,11 +4496,11 @@ var Hl7Message = class {
4497
4496
  return this;
4498
4497
  }
4499
4498
  /**
4500
- * Set a **typed composite** at a field (or field-repetition) dot-path,
4501
- * roadmap Phase T, the conservative-emit mirror of the typed read accessors
4499
+ * Set a **typed composite** at a field (or field-repetition) dot-path:
4500
+ * the conservative-emit mirror of the typed read accessors
4502
4501
  * (`asXpn`/`asCx`/…). The caller passes a structured value (an XPN name, a CX
4503
4502
  * identifier, a TS timestamp, …) by its {@link CompositeKind}, and the setter
4504
- * encodes it into a spec-clean field using the HL7-R encode-safe path: any
4503
+ * encodes it into a spec-clean field using the encode-safe path: any
4505
4504
  * delimiter embedded in a component value is **escaped, never injected**, so
4506
4505
  * a `familyName` of `"Smith^Jr"` re-parses to exactly that string rather than
4507
4506
  * forging a component boundary. No hand-assembly of `^`/`&`/`~`.
@@ -4692,8 +4691,8 @@ var Hl7Message = class {
4692
4691
  return this;
4693
4692
  }
4694
4693
  /**
4695
- * Drop every wrapper AND helper cache wholesale (Phase 3 D-17 + Phase 4
4696
- * D-02). Called by every mutation method so subsequent `segments(type)` /
4694
+ * Drop every wrapper AND helper cache wholesale (D-17 + D-02). Called by
4695
+ * every mutation method so subsequent `segments(type)` /
4697
4696
  * `allSegments()` / `meta` / `patient` / `visit` reads rebuild from the
4698
4697
  * mutated `rawSegments` tree.
4699
4698
  * @internal
@@ -6807,7 +6806,7 @@ async function* parseStream(source, optionsOrProfile) {
6807
6806
  }
6808
6807
 
6809
6808
  // src/index.ts
6810
- var VERSION = "0.0.2";
6809
+ var VERSION = "0.0.3";
6811
6810
 
6812
6811
  export { ACK_CODES, ACK_CONDITIONS, BUILTIN_DATE_FALLBACKS, DEFAULT_ENCODING_CHARACTERS, ERR_CONDITION_CODES, ERR_CONDITION_CODE_SYSTEM, ERR_SEVERITIES, FATAL_CODES, FINDING_CODES, Field, namespace_exports as HL7, Hl7Message, Hl7ParseError, KNOWN_CODING_SYSTEMS, KNOWN_SEGMENTS, MESSAGE_STRUCTURE_DEFINITIONS, ProfileDefinitionError, SUPPORTED_DATE_TOKENS, Segment, USAGE_CODES, VERSION, WARNING_CODES, ackNoCorrelationId, alternateCodingSystemOf, analyzeMessageStructure, batchCountMismatch, batchMissingTrailer, buildAck, buildAdt, buildMessage, buildOru, canonicalCharset, codingSystem, codingSystemOf, conformance_exports as conformance, decodeText, defineConformanceProfile, defineProfile, detectAckMode, downgradePositiveAck, dtmToDate, duplicateRequiredSegment, encodeCe, encodeComposite, encodeCompositeReps, encodeCwe, encodeCx, encodeHd, encodeNm, encodePl, encodeText, encodeTs, encodeXad, encodeXcn, encodeXpn, encodeXtn, encodingMismatch, extraFields, fieldWhitespaceTrimmed, formatDtm, getDefaultProfile, interpretAck, isPositiveAck, mergeMissingPriorOrSurvivor, missingExpectedGroup, missingRequiredField, mllpFramingStripped, outOfOrderSegment, parseCe, parseCwe, parseCx, parseDtm, parseHL7, parseHd, parseNm, parsePath, parsePl, parseSn, parseStream, parseTs, parseXad, parseXcn, parseXpn, parseXtn, pickMrn, profiles, reescape, renderText, resolveCharset, resolvePath, segmentCase, setDefaultProfile, splitBatch, text_exports as text, timestampFallbackFormat, unescape, unknownCharset, unknownEscapeSequence, unknownSegment, unsupportedCharset, unterminatedEscapeSequence, unterminatedStreamMessage, validateAgainstProfile, versionMismatch };
6813
6812
  //# sourceMappingURL=index.mjs.map