@rethinkhealth/hl7v2-ast 0.2.19 → 0.2.21

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.
Files changed (2) hide show
  1. package/index.d.ts +20 -8
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -139,6 +139,7 @@ export type RootContent = RootContentMap[keyof RootContentMap];
139
139
  * For a union of all {@link Root} children, see {@link RootContent}.
140
140
  */
141
141
  export type RootContentMap = {
142
+ segmentHeader: SegmentHeader;
142
143
  segment: Segment;
143
144
  group: Group;
144
145
  field: Field;
@@ -181,16 +182,13 @@ export interface Segment extends Parent {
181
182
  */
182
183
  type: "segment";
183
184
  /**
184
- * Name identifier for the segment (e.g., "MSH", "PID", "OBX").
185
- * Used for querying specific segments without traversing the field hierarchy.
185
+ * Children of segment.
186
+ *
187
+ * `children[0]` is always a {@link SegmentHeader}.
186
188
  */
187
- name?: string | undefined;
188
- /**
189
- * Children of block quote.
190
- */
191
- children: Field[];
189
+ children: [SegmentHeader, ...Field[]];
192
190
  /**
193
- * Data associated with the mdast block quote.
191
+ * Data associated with the segment.
194
192
  */
195
193
  data?: SegmentData | undefined;
196
194
  }
@@ -200,6 +198,20 @@ export interface Segment extends Parent {
200
198
  */
201
199
  export interface SegmentData extends Data {}
202
200
 
201
+ /**
202
+ * HL7v2 segment header literal.
203
+ *
204
+ * This node always appears as the first child of a {@link Segment}. Consumers
205
+ * should treat `segment.children[0]` as the canonical location of the
206
+ * three-character HL7 identifier (for example, "MSH" or "PID").
207
+ */
208
+ export interface SegmentHeader extends Literal {
209
+ /**
210
+ * Node type of HL7v2 segment header.
211
+ */
212
+ type: "segment-header";
213
+ }
214
+
203
215
  /**
204
216
  * HL7v2 group.
205
217
  *
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@rethinkhealth/hl7v2-ast",
3
3
  "description": "HL7v2 is a specification for representing HL7v2 messages as an abstract syntax tree. It implements the unist spec.",
4
- "version": "0.2.19",
4
+ "version": "0.2.21",
5
5
  "license": "MIT",
6
6
  "author": {
7
7
  "name": "Melek Somai",