@cosyte/mllp 0.1.0 → 0.1.2

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 CHANGED
@@ -1,5 +1,20 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.2
4
+ ### Patch Changes
5
+
6
+ - 543bf78: The README and documentation now use US spelling and serial commas, and no longer call the package production-grade.
7
+
8
+ The README names the 0.1 release line instead of an exact version, states the Node.js support as 22 or later and tested on 22 and 24, links the license by absolute URL, and points at the organization's contributing guide and code of conduct. The documentation's page titles say "and" instead of "&", and the sidebar category reads "Core concepts". No code, type, or behavior changes.
9
+ - 296a397: A TLS client whose host is an IP address now connects on Node 26.
10
+
11
+ The client passed its host to `tls.connect` as the SNI server name, and Node 26 throws `ERR_INVALID_ARG_VALUE` for an IP address there (RFC 6066 allows only host names). An IP address, whether it is the host or a configured `servername`, is no longer sent as SNI, and the server certificate is still checked against it. A host name is sent as SNI as before.
12
+
13
+ ## 0.1.1
14
+ ### Patch Changes
15
+
16
+ - b8a4c59: The published type documentation now writes a byte range with "to" instead of an en dash, for example "0x00 to 0x7F". Nothing a consumer calls changes.
17
+
3
18
  ## 0.1.0
4
19
  ### Minor Changes
5
20
 
@@ -421,7 +436,7 @@ paragraphs. No entry was reworded.
421
436
 
422
437
  The entries below follow [Keep a Changelog](https://keepachangelog.com/en/1.1.0/); the generated
423
438
  sections above use the format Changesets writes, which is a version heading and a list of the
424
- changes that release consumed. Versions follow the cosyte pre-alpha ladder, `0.0.x` until first
439
+ changes that release consumed. Versions follow the Cosyte pre-alpha ladder, `0.0.x` until first
425
440
  alpha, rather than [Semantic Versioning](https://semver.org/spec/v2.0.0.html) alone, so the API can
426
441
  change with no deprecation cycle. **No version literal is written in this preamble, on purpose**:
427
442
  what is published is a fact about the registry (`npm view @cosyte/mllp version`) and about
@@ -793,7 +808,7 @@ what is published is a fact about the registry (`npm view @cosyte/mllp version`)
793
808
  - **`docs-content/installation.md` publish-status note corrected (README-ORG-SWEEP).** The Status
794
809
  callout said the package was "not yet published to npm" and that the install command was "the shape
795
810
  it will take at first publish": stale now that `@cosyte/mllp` is published on npm at `0.0.1` and
796
- public. Rewritten to state it is published and public, still pre-alpha on the cosyte
811
+ public. Rewritten to state it is published and public, still pre-alpha on the Cosyte
797
812
  `0.0.x`-until-first-alpha ladder (no API-stability promise), and that `npm install @cosyte/mllp` is
798
813
  live. Docs only: no runtime or public-API change.
799
814
 
@@ -1212,8 +1227,8 @@ what is published is a fact about the registry (`npm view @cosyte/mllp version`)
1212
1227
  *bounds*. Fixed: the scan is now `readMshSegment`, which bounds the MSH at its terminator before
1213
1228
  reading any field out of it. A field that does not exist reads as **absent**, never as the next
1214
1229
  segment's contents.
1215
- - **`ack-from-hl7` could not echo a control ID verbatim, so a cosyte client could not correlate a
1216
- cosyte server's ACK (MLLP-ACK-UTF8).** `buildMllpAck` decoded the inbound through the peer
1230
+ - **`ack-from-hl7` could not echo a control ID verbatim, so a Cosyte client could not correlate a
1231
+ Cosyte server's ACK (MLLP-ACK-UTF8).** `buildMllpAck` decoded the inbound through the peer
1217
1232
  parser's charset machinery and re-encoded the ACK through a hardcoded **`utf8`**. The two are not
1218
1233
  inverses. A control-ID byte `0x8B` (legal under an `MSH-18` of `8859/1`, and the exact case
1219
1234
  `MLLP-CORRELATOR-ASCII` had just fixed on the client) came back out of MSA-2 as the **two** bytes
@@ -1420,7 +1435,7 @@ what is published is a fact about the registry (`npm view @cosyte/mllp version`)
1420
1435
  ### Added
1421
1436
 
1422
1437
  - **Trademark notice (`TRADEMARKS.md`).** This package names third-party systems to describe what it
1423
- interoperates with; the notice records that cosyte is not affiliated with, endorsed by, or
1438
+ interoperates with; the notice records that Cosyte is not affiliated with, endorsed by, or
1424
1439
  sponsored by any of them, that every reference is descriptive, and that the built-in profiles are
1425
1440
  authored from public sources only. Added to `files` so it ships inside the published tarball, not
1426
1441
  just on GitHub. Documentation only: no runtime or API change.
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2026 Cosyte
3
+ Copyright (c) 2026 Cosyte LLC
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -7,14 +7,14 @@
7
7
 
8
8
  # @cosyte/mllp
9
9
 
10
- > HL7 v2 over MLLP for Node.js, with framing, ACK correlation and reconnects handled for you.
10
+ > HL7 v2 over MLLP for Node.js, with framing, ACK correlation, and reconnects handled for you.
11
11
 
12
12
  [![npm version](https://img.shields.io/npm/v/@cosyte/mllp.svg)](https://www.npmjs.com/package/@cosyte/mllp)
13
13
  [![CI](https://img.shields.io/github/actions/workflow/status/cosyte/mllp/ci.yml?branch=main&label=CI)](https://github.com/cosyte/mllp/actions/workflows/ci.yml)
14
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](./LICENSE)
14
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/cosyte/mllp/blob/main/LICENSE)
15
15
  [![Node](https://img.shields.io/badge/node-%3E%3D22-brightgreen.svg)](https://nodejs.org)
16
16
 
17
- Production-grade MLLP client and server for Node.js, transport-only sibling to @cosyte/hl7
17
+ An MLLP client and server for Node.js: the transport-only sibling to @cosyte/hl7.
18
18
 
19
19
  ## Contents
20
20
 
@@ -33,26 +33,26 @@ Production-grade MLLP client and server for Node.js, transport-only sibling to @
33
33
 
34
34
  HL7 v2 interfaces still move over MLLP, and the protocol stops at the frame: `VT + payload + FS + CR`
35
35
  and nothing else. Everything that decides whether an interface survives a bad night is left to the
36
- integrator, so every team writes the same acknowledgement correlator, the same reconnect loop and the
36
+ integrator, so every team writes the same acknowledgment correlator, the same reconnect loop, and the
37
37
  same backpressure guard, and one of them is subtly wrong. The nearest alternative is a full
38
- integration engine such as Mirth Connect, which brings a runtime, a database and a deployment story
38
+ integration engine such as Mirth Connect, which brings a runtime, a database, and a deployment story
39
39
  you may not want inside a Node.js service. `@cosyte/mllp` is that transport on its own: a library you
40
40
  import, with zero runtime dependencies, an in-memory transport so your tests never open a socket, and
41
- one guarantee it will not trade away, which is that a positive acknowledgement cannot precede a
41
+ one guarantee it will not trade away, which is that a positive acknowledgment cannot precede a
42
42
  durable commit.
43
43
 
44
44
  ## Status
45
45
 
46
- **This README describes `0.1.0`.** The public API is settled and safe to depend on: the client, the
47
- server, the framing codec, the in-memory transport and the optional `ack-from-hl7` bridge are what
46
+ **This README describes the 0.1 line.** The public API is settled and safe to depend on: the client, the
47
+ server, the framing codec, the in-memory transport, and the optional `ack-from-hl7` bridge are what
48
48
  this release commits to. The stable warning codes and security-warning codes are part of that
49
49
  surface, so renaming or removing one is a breaking change.
50
50
 
51
51
  Named rather than implied, here is what is still moving:
52
52
 
53
- - **Batch acknowledgement is not built.** An HL7 batch envelope (`FHS`/`BHS`, HL7 v2.5.1 §2.10.3) or
53
+ - **Batch acknowledgment is not built.** An HL7 batch envelope (`FHS`/`BHS`, HL7 v2.5.1 §2.10.3) or
54
54
  a frame carrying more than one `MSH` yields a warned, non-positive `AE`. That is deliberate, since
55
- a positive acknowledgement correlated to the first message would tell the sender a whole batch was
55
+ a positive acknowledgment correlated to the first message would tell the sender a whole batch was
56
56
  accepted while the rest went unread, but it means the surface that would carry batch support does
57
57
  not exist yet.
58
58
  - **Verified engine coverage is a growing list, not a complete one.** The differential harness runs
@@ -63,7 +63,7 @@ Named rather than implied, here is what is still moving:
63
63
  ## Install
64
64
 
65
65
  ```bash
66
- # engines.node: >=22.0.0 packageManager: pnpm@10.0.0
66
+ # Node.js 22 or later, tested on 22 and 24
67
67
  # published dual: ESM (import) and CJS (require), each with its own type declarations
68
68
  pnpm add @cosyte/mllp
69
69
 
@@ -73,7 +73,7 @@ pnpm add @cosyte/hl7
73
73
 
74
74
  ## Usage
75
75
 
76
- Start a server, send it a message, and read the acknowledgement it built. Auto-ACK is on by default,
76
+ Start a server, send it a message, and read the acknowledgment it built. Auto-ACK is on by default,
77
77
  and the server awaits your handler, which is the durable commit step, before it answers. The payload
78
78
  API is **Buffer-first** everywhere: HL7 v2 messages are raw bytes with caller-managed charset decoding.
79
79
 
@@ -119,7 +119,7 @@ messages committed: 1
119
119
  ```
120
120
 
121
121
  `MSA-2` echoes the control id you sent, byte for byte, which is what lets the client match the answer
122
- to the message. The acknowledgement's own `MSH-7` and `MSH-10` change on every run.
122
+ to the message. The acknowledgment's own `MSH-7` and `MSH-10` change on every run.
123
123
 
124
124
  ### Framing on its own
125
125
 
@@ -158,15 +158,15 @@ difference between 105 and 102.
158
158
 
159
159
  ### The commit contract
160
160
 
161
- A positive acknowledgement (`AA`) tells the sender _"you may forget this message. I have it."_ So a
161
+ A positive acknowledgment (`AA`) tells the sender _"you may forget this message. I have it."_ So a
162
162
  receiver must never send one before the message is durably handled, or the message is silently lost.
163
163
  `@cosyte/mllp` makes that structural: pair `autoAck: 'AA'` with an `onMessage` handler and the server
164
164
  **awaits your handler and only then acknowledges**.
165
165
 
166
166
  Handler resolves, you get `AA`, **unless the inbound could not carry a correlatable positive
167
- acknowledgement** (no readable `MSH`, an empty `MSH-10`, a batch or concatenated payload, or trailing
168
- bytes the framer discarded). In that case the commit still happened, but the acknowledgement is
169
- downgraded to `AE` and a `nack` event names the reason, because a positive acknowledgement the sender
167
+ acknowledgment** (no readable `MSH`, an empty `MSH-10`, a batch or concatenated payload, or trailing
168
+ bytes the framer discarded). In that case the commit still happened, but the acknowledgment is
169
+ downgraded to `AE` and a `nack` event names the reason, because a positive acknowledgment the sender
170
170
  cannot match is one it will resend. Handler throws, you get `AE`, or `AR` via `MllpAckError`.
171
171
  `autoAck: 'AA'` _without_ a handler is documented as a transport-accept: "received and framed", not
172
172
  "processed".
@@ -206,7 +206,7 @@ footnote.
206
206
 
207
207
  **What it does with your payload.** It moves the buffer you hand it to the peer and hands the peer's
208
208
  bytes back to your handler. It holds a message in memory only while that message is in flight: from
209
- `send()` until its acknowledgement is correlated, or until `close()` drains it or reports it
209
+ `send()` until its acknowledgment is correlated, or until `close()` drains it or reports it
210
210
  unresolved. On the receive side your handler is given a copy, and the decoder then reuses its
211
211
  internal accumulator for the next frame rather than zeroing it, so those bytes stay in that private
212
212
  buffer until a later frame overwrites them, for as long as that reader lives. That is buffer reuse
@@ -215,15 +215,15 @@ rather than storage, and no public API hands the buffer out, but it is not a scr
215
215
  **The reads the transport performs, and where they stop.** The transport does not parse HL7, but it
216
216
  is not blind to the payload either, and the bound is worth more to you than the slogan. To answer a
217
217
  message it has to correlate the answer, so it locates the `MSH` segment and reads the header fields
218
- an acknowledgement is built from and answered with: `MSH-10`, echoed byte for byte into `MSA-2`, the
218
+ an acknowledgment is built from and answered with: `MSH-10`, echoed byte for byte into `MSA-2`, the
219
219
  sending and receiving application and facility, which swap sides in the reply, the declared
220
- delimiters, processing id and version, and the acknowledgement mode in `MSH-15` and `MSH-16`.
220
+ delimiters, processing id and version, and the acknowledgment mode in `MSH-15` and `MSH-16`.
221
221
  **That scan is bounded at the `MSH` segment's own terminator**, so it reaches nothing past the
222
222
  header: on the transport path `PID`, and every other segment carrying clinical content, is never
223
- read, never decoded and never echoed. Reading an inbound acknowledgement adds one segment and no
224
- more, `MSA`, for its acknowledgement code and the control id it echoes back, decoded under the same
223
+ read, never decoded, and never echoed. Reading an inbound acknowledgment adds one segment and no
224
+ more, `MSA`, for its acknowledgment code and the control id it echoes back, decoded under the same
225
225
  bound at that segment's own terminator. Those two are the whole of it, in one place, shared by the
226
- client's correlator and both acknowledgement builders. Separately, the leading identifier of each
226
+ client's correlator and both acknowledgment builders. Separately, the leading identifier of each
227
227
  segment is checked so that a batch envelope or a second `MSH` can be refused rather than falsely
228
228
  acknowledged; no field of those segments is read.
229
229
 
@@ -234,12 +234,12 @@ whole message, later segments included, and gives it to the optional
234
234
  `PID` among them. That decode is this package's own code and it ships in this package's tarball, so
235
235
  count it as yours rather than the peer's. Nothing reaches it by default: the client, the server and
236
236
  `buildRawAck` never import that subpath, and the peer is an optional dependency you install
237
- deliberately. If your data-flow boundary turns on later segments never being materialised as decoded
237
+ deliberately. If your data-flow boundary turns on later segments never being materialized as decoded
238
238
  text, that is the subpath to leave out.
239
239
 
240
240
  **What it does not do.** Outside that subpath it does not parse the message, and outside the two
241
241
  bounded segment reads above it does not inspect it. It writes nothing to disk: there is no queue, no
242
- write-ahead log, no replay store and no cache anywhere in this package. Library code calls no logger
242
+ write-ahead log, no replay store, and no cache anywhere in this package. Library code calls no logger
243
243
  and no `console` method.
244
244
 
245
245
  **What its diagnostics can carry.** Shape rather than content: no error, warning, event payload or
@@ -247,16 +247,16 @@ stats object ever echoes a run of message content.
247
247
 
248
248
  - A **framing error** carries at most the single byte at the structural violation, plus that byte's
249
249
  offset.
250
- - A **warning message** carries structural facts: byte offsets, counts and accumulated sizes. Two
250
+ - A **warning message** carries structural facts: byte offsets, counts, and accumulated sizes. Two
251
251
  framing codes are the exception worth knowing about. `MLLP_MISSING_LEADING_VT` and
252
252
  `MLLP_FS_WITHOUT_CR` render the hex of the single byte found where a framing byte was expected,
253
253
  and on a stream that omits its leading `VT` that byte is the first byte of the unframed content.
254
254
  One byte, never a run, the same bound a framing error carries. If that is more than your threat
255
255
  model allows, log `code` and `byteOffset` rather than `message`.
256
- - The **acknowledgement-correlation diagnostics** are stricter. Their text comes from a frozen
256
+ - The **acknowledgment-correlation diagnostics** are stricter. Their text comes from a frozen
257
257
  registry keyed on the code alone, with no value parameter anywhere in it, so a control id cannot
258
258
  reach one; they report byte lengths instead of bytes.
259
- - `getStats()` returns plain JSON-serialisable counters, and the two security warnings raised
259
+ - `getStats()` returns plain JSON-serializable counters, and the two security warnings raised
260
260
  through `process.emitWarning` carry their code and a fixed description. The wildcard-bind warning
261
261
  names the address you bound, which is your own configuration, never message content.
262
262
 
@@ -264,16 +264,16 @@ stats object ever echoes a run of message content.
264
264
 
265
265
  - **Encryption in transit.** A plain MLLP connection is cleartext on the wire. TLS is built in, but
266
266
  you have to turn it on and supply the material.
267
- - **Logging and retention.** The moment you log a payload, an acknowledgement body or a control id,
267
+ - **Logging and retention.** The moment you log a payload, an acknowledgment body, or a control id,
268
268
  it is yours to protect. Nothing here stores a message, so nothing here can delete one on request
269
269
  either.
270
- - **Idempotency.** MLLP plus an acknowledgement is at-least-once at best. De-duplicate on `MSH-10`
270
+ - **Idempotency.** MLLP plus an acknowledgment is at-least-once at best. De-duplicate on `MSH-10`
271
271
  plus `MSH-7` in your application.
272
272
  - **Exposure.** The `127.0.0.1` default and the wildcard-bind opt-in are guardrails, not a network
273
273
  policy. Widening either is your decision.
274
274
 
275
275
  Every example on this page uses placeholder application and facility names and a synthetic control
276
- id. No sample here carries a name, a date of birth, an identifier or an address, and none should.
276
+ id. No sample here carries a name, a date of birth, an identifier, or an address, and none should.
277
277
 
278
278
  ## API
279
279
 
@@ -284,12 +284,12 @@ Three code subpaths ship, plus `@cosyte/mllp/package.json`:
284
284
  errors, and the differential harness (`runDifferential`).
285
285
  - **`@cosyte/mllp/testing`** is `InMemoryTransport`, a deterministic socket-free test double. Every
286
286
  test that can run over it should.
287
- - **`@cosyte/mllp/ack-from-hl7`** builds acknowledgements from a parsed message, or from raw bytes it
287
+ - **`@cosyte/mllp/ack-from-hl7`** builds acknowledgments from a parsed message, or from raw bytes it
288
288
  parses through the peer, and is the one place the optional `@cosyte/hl7` peer is needed.
289
289
 
290
290
  What comes with them:
291
291
 
292
- - **Strict framing** (`VT + payload + FS + CR`), acknowledgement correlation, auto-reconnect with
292
+ - **Strict framing** (`VT + payload + FS + CR`), acknowledgment correlation, auto-reconnect with
293
293
  backoff, and backpressure.
294
294
  - **A lenient decoder and a strict encoder** (Postel's Law) with **11 stable warning codes** carrying
295
295
  byte offsets. Tolerance is opt-in per flag; the server ships tolerant defaults.
@@ -305,10 +305,10 @@ Full reference: [the documentation](https://github.com/cosyte/mllp/tree/main/doc
305
305
 
306
306
  ## Compatibility
307
307
 
308
- - **Node.js 22 and 24.** `engines.node` is `>=22.0.0` and CI runs both.
308
+ - **Node.js 22 or later, tested on 22 and 24.** `engines.node` is `>=22.0.0`.
309
309
  - **HL7 v2 payloads are bytes here, and the exceptions are named.** The transport does not parse
310
- HL7: it reads the `MSH` header its acknowledgement is built from, and the `MSA` of an inbound
311
- acknowledgement, each bounded at that segment's own terminator. The opt-in `ack-from-hl7` subpath
310
+ HL7: it reads the `MSH` header its acknowledgment is built from, and the `MSA` of an inbound
311
+ acknowledgment, each bounded at that segment's own terminator. The opt-in `ack-from-hl7` subpath
312
312
  is the one place a whole message is parsed. [PHI and safety](#phi-and-safety) sets all of that out
313
313
  in full. For actual parsing, pair this with [`@cosyte/hl7`](https://github.com/cosyte/hl7), which
314
314
  is exactly what that subpath does.
@@ -317,17 +317,18 @@ Full reference: [the documentation](https://github.com/cosyte/mllp/tree/main/doc
317
317
  claim about either is made here. `runDifferential` ships in the published artifact, so you can aim
318
318
  it at your own test or staging endpoint and get a per-exchange frame-parity and `MSA-2` correlation
319
319
  report for the engine you actually integrate with.
320
- - **Known gaps, stated rather than hidden.** No batch acknowledgement, no MLLP Release 2, no queue or
320
+ - **Known gaps, stated rather than hidden.** No batch acknowledgment, no MLLP Release 2, no queue or
321
321
  replay of unacknowledged messages, no clinical acceptance decision, and no PKI. The
322
322
  [known limitations](https://github.com/cosyte/mllp/blob/main/docs-content/limitations.md) page is
323
323
  the full list. Read it before you depend on this.
324
324
 
325
325
  ## Contributing
326
326
 
327
- Questions, bug reports and interoperability findings belong in
328
- [GitHub issues](https://github.com/cosyte/mllp/issues). Pull requests are welcome, and there is a gap
329
- worth naming: this repository carries no contributor guide yet, so open an issue before a large
330
- change so the approach can be agreed first.
327
+ Questions, bug reports, and interoperability findings belong in
328
+ [GitHub issues](https://github.com/cosyte/mllp/issues). Pull requests are welcome. The organization's
329
+ [contributing guide](https://github.com/cosyte/.github/blob/main/CONTRIBUTING.md) and
330
+ [code of conduct](https://github.com/cosyte/.github/blob/main/CODE_OF_CONDUCT.md) apply here. Open an
331
+ issue before a large change so the approach can be agreed first.
331
332
 
332
333
  A contribution must clear every gate this repository ships, all of them scripts you can run yourself:
333
334
 
@@ -350,10 +351,10 @@ commit and is deliberately hard to bypass.
350
351
  ## Trademarks
351
352
 
352
353
  Epic, Cerner, Mirth Connect, NextGen, and Google Cloud Healthcare are trademarks of their respective
353
- owners. cosyte is not affiliated with, endorsed by, or sponsored by any of them. The names identify
354
+ owners. Cosyte is not affiliated with, endorsed by, or sponsored by any of them. The names identify
354
355
  the engines this package is tested against, and those it is not. See
355
- [TRADEMARKS.md](./TRADEMARKS.md).
356
+ [TRADEMARKS.md](https://github.com/cosyte/mllp/blob/main/TRADEMARKS.md).
356
357
 
357
358
  ## License
358
359
 
359
- MIT, Copyright (c) 2026 Cosyte. See [LICENSE](./LICENSE).
360
+ MIT, Copyright (c) 2026 Cosyte LLC. See [LICENSE](https://github.com/cosyte/mllp/blob/main/LICENSE).
package/TRADEMARKS.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Trademarks
2
2
 
3
- `@cosyte/mllp` is an independent open-source project. cosyte is **not affiliated with, endorsed by,
3
+ `@cosyte/mllp` is an independent open-source project. Cosyte is **not affiliated with, endorsed by,
4
4
  or sponsored by** any company named in this repository or its documentation.
5
5
 
6
6
  ## Why these names appear
@@ -2,7 +2,7 @@
2
2
 
3
3
  var module$1 = require('module');
4
4
 
5
- // node_modules/.pnpm/tsup@8.5.1_postcss@8.5.10_tsx@4.21.0_typescript@5.9.3/node_modules/tsup/assets/cjs_shims.js
5
+ // node_modules/.pnpm/tsup@8.5.1_postcss@8.5.10_tsx@4.23.15_typescript@5.9.3/node_modules/tsup/assets/cjs_shims.js
6
6
  var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.tagName.toUpperCase() === "SCRIPT" ? document.currentScript.src : new URL("main.js", document.baseURI).href;
7
7
  var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
8
8