Skip to main content
Version: v0.0.4

Interface: RawComponent

A single component inside a repetition: the most deeply nested data layer in the HL7 positional tree. A component is an ordered list of subcomponent strings (subcomponent separator & by default).

Example

import type { RawComponent } from "@cosyte/hl7";
const comp: RawComponent = { subcomponents: ["Smith", "John"] };

Properties

rawSubcomponents?

readonly optional rawSubcomponents?: readonly (string | undefined)[]

Internal

Escape-fidelity overlay, positionally aligned with subcomponents: for each index, the subcomponent's original wire bytes to emit verbatim instead of re-escaping the decoded form. An entry is present (non-undefined) only when a subcomponent carried an escape whose decoded form does not re-escape back to the exact wire bytes: i.e. a recognize- and-preserve escape (\H\, \Z.., charset/formatting) or a hex escape (\X41\, or non-canonical hex casing). Delimiter escapes (\F|) round- trip through reescape unchanged and get no overlay. The whole field is absent when no subcomponent needs it (the overwhelming common case), so a plain message's raw tree is byte-for-byte the shape it was before this overlay existed.

Consumed only by the serializer ("src/serialize/emit-field.ts"); never read by the value/coercion surface, so it changes no decoded value.


subcomponents

readonly subcomponents: readonly string[]

The component's subcomponents, HL7-decoded: the tokenizer expands escape sequences on parse so consumers read literal values (Smith|Jones, not Smith\F\Jones). This is the value surface every reader uses (Field.value, the composite parsers, dot-path, toJSON).