@cosyte/mllp 0.1.1 → 0.1.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/CHANGELOG.md +15 -0
- package/LICENSE +1 -1
- package/README.md +125 -89
- package/dist/ack-from-hl7/index.cjs +1 -1
- package/dist/ack-from-hl7/index.cjs.map +1 -1
- package/dist/index.cjs +13 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -2
- package/dist/index.d.ts +6 -2
- package/dist/index.mjs +14 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +20 -15
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.3
|
|
4
|
+
### Patch Changes
|
|
5
|
+
|
|
6
|
+
- 43f3779: The README follows our shared layout: it adds Support and Security sections, names the Node.js versions CI tests on (22, 24, and 26), and links the full documentation on docs.cosyte.com. No code changes.
|
|
7
|
+
|
|
8
|
+
## 0.1.2
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- 543bf78: The README and documentation now use US spelling and serial commas, and no longer call the package production-grade.
|
|
12
|
+
|
|
13
|
+
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.
|
|
14
|
+
- 296a397: A TLS client whose host is an IP address now connects on Node 26.
|
|
15
|
+
|
|
16
|
+
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.
|
|
17
|
+
|
|
3
18
|
## 0.1.1
|
|
4
19
|
### Patch Changes
|
|
5
20
|
|
package/LICENSE
CHANGED
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
|
[](https://www.npmjs.com/package/@cosyte/mllp)
|
|
13
13
|
[](https://github.com/cosyte/mllp/actions/workflows/ci.yml)
|
|
14
|
-
[](
|
|
15
|
-
[](https://nodejs.org)
|
|
14
|
+
[](https://github.com/cosyte/mllp/blob/main/LICENSE)
|
|
15
|
+
[](https://nodejs.org)
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
An MLLP client and server for Node.js: the transport-only sibling to @cosyte/hl7.
|
|
18
18
|
|
|
19
19
|
## Contents
|
|
20
20
|
|
|
@@ -22,9 +22,11 @@ Production-grade MLLP client and server for Node.js, transport-only sibling to @
|
|
|
22
22
|
- [Status](#status)
|
|
23
23
|
- [Install](#install)
|
|
24
24
|
- [Usage](#usage)
|
|
25
|
-
- [PHI and safety](#phi-and-safety)
|
|
26
25
|
- [API](#api)
|
|
27
26
|
- [Compatibility](#compatibility)
|
|
27
|
+
- [Documentation](#documentation)
|
|
28
|
+
- [Support](#support)
|
|
29
|
+
- [Security](#security)
|
|
28
30
|
- [Contributing](#contributing)
|
|
29
31
|
- [Trademarks](#trademarks)
|
|
30
32
|
- [License](#license)
|
|
@@ -33,26 +35,26 @@ Production-grade MLLP client and server for Node.js, transport-only sibling to @
|
|
|
33
35
|
|
|
34
36
|
HL7 v2 interfaces still move over MLLP, and the protocol stops at the frame: `VT + payload + FS + CR`
|
|
35
37
|
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
|
|
38
|
+
integrator, so every team writes the same acknowledgment correlator, the same reconnect loop, and the
|
|
37
39
|
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
|
|
40
|
+
integration engine such as Mirth Connect, which brings a runtime, a database, and a deployment story
|
|
39
41
|
you may not want inside a Node.js service. `@cosyte/mllp` is that transport on its own: a library you
|
|
40
42
|
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
|
|
43
|
+
one guarantee it will not trade away, which is that a positive acknowledgment cannot precede a
|
|
42
44
|
durable commit.
|
|
43
45
|
|
|
44
46
|
## Status
|
|
45
47
|
|
|
46
|
-
**This README describes
|
|
47
|
-
server, the framing codec, the in-memory transport and the optional `ack-from-hl7` bridge are what
|
|
48
|
+
**This README describes the 0.1 line.** The public API is settled and safe to depend on: the client, the
|
|
49
|
+
server, the framing codec, the in-memory transport, and the optional `ack-from-hl7` bridge are what
|
|
48
50
|
this release commits to. The stable warning codes and security-warning codes are part of that
|
|
49
51
|
surface, so renaming or removing one is a breaking change.
|
|
50
52
|
|
|
51
53
|
Named rather than implied, here is what is still moving:
|
|
52
54
|
|
|
53
|
-
- **Batch
|
|
55
|
+
- **Batch acknowledgment is not built.** An HL7 batch envelope (`FHS`/`BHS`, HL7 v2.5.1 §2.10.3) or
|
|
54
56
|
a frame carrying more than one `MSH` yields a warned, non-positive `AE`. That is deliberate, since
|
|
55
|
-
a positive
|
|
57
|
+
a positive acknowledgment correlated to the first message would tell the sender a whole batch was
|
|
56
58
|
accepted while the rest went unread, but it means the surface that would carry batch support does
|
|
57
59
|
not exist yet.
|
|
58
60
|
- **Verified engine coverage is a growing list, not a complete one.** The differential harness runs
|
|
@@ -63,17 +65,19 @@ Named rather than implied, here is what is still moving:
|
|
|
63
65
|
## Install
|
|
64
66
|
|
|
65
67
|
```bash
|
|
66
|
-
# engines.node: >=22.0.0 packageManager: pnpm@10.0.0
|
|
67
|
-
# published dual: ESM (import) and CJS (require), each with its own type declarations
|
|
68
68
|
pnpm add @cosyte/mllp
|
|
69
69
|
|
|
70
70
|
# optional peer, needed only for the ack-from-hl7 subpath
|
|
71
71
|
pnpm add @cosyte/hl7
|
|
72
72
|
```
|
|
73
73
|
|
|
74
|
+
Node.js 22 or later, tested on 22, 24, and 26 (`engines.node` is `>=22.0.0`). The package ships
|
|
75
|
+
dual ESM (`import`) and CommonJS (`require`) builds, each with its own type declarations, and has
|
|
76
|
+
zero runtime dependencies.
|
|
77
|
+
|
|
74
78
|
## Usage
|
|
75
79
|
|
|
76
|
-
Start a server, send it a message, and read the
|
|
80
|
+
Start a server, send it a message, and read the acknowledgment it built. Auto-ACK is on by default,
|
|
77
81
|
and the server awaits your handler, which is the durable commit step, before it answers. The payload
|
|
78
82
|
API is **Buffer-first** everywhere: HL7 v2 messages are raw bytes with caller-managed charset decoding.
|
|
79
83
|
|
|
@@ -119,7 +123,7 @@ messages committed: 1
|
|
|
119
123
|
```
|
|
120
124
|
|
|
121
125
|
`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
|
|
126
|
+
to the message. The acknowledgment's own `MSH-7` and `MSH-10` change on every run.
|
|
123
127
|
|
|
124
128
|
### Framing on its own
|
|
125
129
|
|
|
@@ -158,15 +162,15 @@ difference between 105 and 102.
|
|
|
158
162
|
|
|
159
163
|
### The commit contract
|
|
160
164
|
|
|
161
|
-
A positive
|
|
165
|
+
A positive acknowledgment (`AA`) tells the sender _"you may forget this message. I have it."_ So a
|
|
162
166
|
receiver must never send one before the message is durably handled, or the message is silently lost.
|
|
163
167
|
`@cosyte/mllp` makes that structural: pair `autoAck: 'AA'` with an `onMessage` handler and the server
|
|
164
168
|
**awaits your handler and only then acknowledges**.
|
|
165
169
|
|
|
166
170
|
Handler resolves, you get `AA`, **unless the inbound could not carry a correlatable positive
|
|
167
|
-
|
|
168
|
-
bytes the framer discarded). In that case the commit still happened, but the
|
|
169
|
-
downgraded to `AE` and a `nack` event names the reason, because a positive
|
|
171
|
+
acknowledgment** (no readable `MSH`, an empty `MSH-10`, a batch or concatenated payload, or trailing
|
|
172
|
+
bytes the framer discarded). In that case the commit still happened, but the acknowledgment is
|
|
173
|
+
downgraded to `AE` and a `nack` event names the reason, because a positive acknowledgment the sender
|
|
170
174
|
cannot match is one it will resend. Handler throws, you get `AE`, or `AR` via `MllpAckError`.
|
|
171
175
|
`autoAck: 'AA'` _without_ a handler is documented as a transport-accept: "received and framed", not
|
|
172
176
|
"processed".
|
|
@@ -198,7 +202,87 @@ The [TLS guide](https://github.com/cosyte/mllp/blob/main/docs-content/tls.md) ha
|
|
|
198
202
|
table, the TLS 1.2 floor (IHE ATNA ITI-19), the typed failure modes (`tls-verify` against
|
|
199
203
|
`tls-handshake`), and the bind-safety details.
|
|
200
204
|
|
|
201
|
-
##
|
|
205
|
+
## API
|
|
206
|
+
|
|
207
|
+
Three code subpaths ship, plus `@cosyte/mllp/package.json`:
|
|
208
|
+
|
|
209
|
+
- **`@cosyte/mllp`** is the whole transport: `createServer` and `createStarterServer`, `createClient`
|
|
210
|
+
and `createStarterClient`, `encodeFrame` and `FrameReader`, `Connection`, `buildRawAck`, the typed
|
|
211
|
+
errors, and the differential harness (`runDifferential`).
|
|
212
|
+
- **`@cosyte/mllp/testing`** is `InMemoryTransport`, a deterministic socket-free test double. Every
|
|
213
|
+
test that can run over it should.
|
|
214
|
+
- **`@cosyte/mllp/ack-from-hl7`** builds acknowledgments from a parsed message, or from raw bytes it
|
|
215
|
+
parses through the peer, and is the one place the optional `@cosyte/hl7` peer is needed.
|
|
216
|
+
|
|
217
|
+
What comes with them:
|
|
218
|
+
|
|
219
|
+
- **Strict framing** (`VT + payload + FS + CR`), acknowledgment correlation, auto-reconnect with
|
|
220
|
+
backoff, and backpressure.
|
|
221
|
+
- **A lenient decoder and a strict encoder** (Postel's Law) with **11 stable warning codes** carrying
|
|
222
|
+
byte offsets. Tolerance is opt-in per flag; the server ships tolerant defaults.
|
|
223
|
+
- **An explicit 6-state connection machine**
|
|
224
|
+
(`CONNECTING | CONNECTED | DRAINING | RECONNECTING | DISCONNECTED | CLOSED`) with `stateChange`
|
|
225
|
+
events, never socket flags.
|
|
226
|
+
- **`AbortSignal` on every awaitable** and `Symbol.asyncDispose` on every closeable.
|
|
227
|
+
- **A drain on `close()`** that tells a message which was never written apart from one whose fate is
|
|
228
|
+
unknown, because only one of those is safe to resend.
|
|
229
|
+
- **Zero runtime dependencies.** Node stdlib only.
|
|
230
|
+
|
|
231
|
+
The full reference is on [docs.cosyte.com/mllp](https://docs.cosyte.com/mllp); see [Documentation](#documentation).
|
|
232
|
+
|
|
233
|
+
## Compatibility
|
|
234
|
+
|
|
235
|
+
- **Node.js 22 or later, tested on 22, 24, and 26.** `engines.node` is `>=22.0.0`.
|
|
236
|
+
- **HL7 v2 payloads are bytes here, and the exceptions are named.** The transport does not parse
|
|
237
|
+
HL7: it reads the `MSH` header its acknowledgment is built from, and the `MSA` of an inbound
|
|
238
|
+
acknowledgment, each bounded at that segment's own terminator. The opt-in `ack-from-hl7` subpath
|
|
239
|
+
is the one place a whole message is parsed. [PHI and safety](#phi-and-safety) sets all of that out
|
|
240
|
+
in full. For actual parsing, pair this with [`@cosyte/hl7`](https://github.com/cosyte/hl7), which
|
|
241
|
+
is exactly what that subpath does.
|
|
242
|
+
- **Differentially verified against freely available engines**: Mirth Connect from NextGen, and the
|
|
243
|
+
Google Cloud Healthcare MLLP adapter. **Epic and Cerner are not part of that harness**, and no
|
|
244
|
+
claim about either is made here. `runDifferential` ships in the published artifact, so you can aim
|
|
245
|
+
it at your own test or staging endpoint and get a per-exchange frame-parity and `MSA-2` correlation
|
|
246
|
+
report for the engine you actually integrate with.
|
|
247
|
+
- **Known gaps, stated rather than hidden.** No batch acknowledgment, no MLLP Release 2, no queue or
|
|
248
|
+
replay of unacknowledged messages, no clinical acceptance decision, and no PKI. The
|
|
249
|
+
[known limitations](https://github.com/cosyte/mllp/blob/main/docs-content/limitations.md) page is
|
|
250
|
+
the full list. Read it before you depend on this.
|
|
251
|
+
|
|
252
|
+
## Documentation
|
|
253
|
+
|
|
254
|
+
The full reference lives at [docs.cosyte.com/mllp](https://docs.cosyte.com/mllp), built from this
|
|
255
|
+
repository's [`docs-content/`](https://github.com/cosyte/mllp/tree/main/docs-content). Start with
|
|
256
|
+
these pages:
|
|
257
|
+
|
|
258
|
+
- [Framing and tolerance](https://github.com/cosyte/mllp/blob/main/docs-content/framing.md): the
|
|
259
|
+
wire format, the opt-in tolerance flags, the stable warning codes, and what throws.
|
|
260
|
+
- [ACKs and the commit contract](https://github.com/cosyte/mllp/blob/main/docs-content/acks.md):
|
|
261
|
+
the code auto-ACK selects, correlation on the client, enhanced mode, and the ack-from-hl7 builder.
|
|
262
|
+
- [Connection, reconnect, and backpressure](https://github.com/cosyte/mllp/blob/main/docs-content/reliability.md):
|
|
263
|
+
the six-state connection machine, backoff, dead-peer detection, and what `close()` does.
|
|
264
|
+
- [MLLPS / TLS](https://github.com/cosyte/mllp/blob/main/docs-content/tls.md): mutual TLS,
|
|
265
|
+
verification, bind safety, the TLS 1.2 floor, and the typed failure modes.
|
|
266
|
+
- [Testing and verification](https://github.com/cosyte/mllp/blob/main/docs-content/testing.md): the
|
|
267
|
+
in-memory transport, and the differential harness for the engine you integrate with.
|
|
268
|
+
- [Known limitations and non-goals](https://github.com/cosyte/mllp/blob/main/docs-content/limitations.md):
|
|
269
|
+
what not to trust this transport to do.
|
|
270
|
+
|
|
271
|
+
## Support
|
|
272
|
+
|
|
273
|
+
Questions, bug reports, and interoperability findings start on the
|
|
274
|
+
[issue tracker](https://github.com/cosyte/mllp/issues), and so does any change large enough to want
|
|
275
|
+
agreement on the approach before a pull request. The organization's
|
|
276
|
+
[support page](https://github.com/cosyte/.github/blob/main/SUPPORT.md) covers questions that span our
|
|
277
|
+
libraries.
|
|
278
|
+
|
|
279
|
+
## Security
|
|
280
|
+
|
|
281
|
+
Report a vulnerability privately, as the
|
|
282
|
+
[security policy](https://github.com/cosyte/.github/blob/main/SECURITY.md) describes, never in a
|
|
283
|
+
public issue.
|
|
284
|
+
|
|
285
|
+
### PHI and safety
|
|
202
286
|
|
|
203
287
|
An MLLP frame carries an HL7 v2 message, and an HL7 v2 message carries patient data. This package is
|
|
204
288
|
the transport under that traffic, so what it does with those bytes is a safety property rather than a
|
|
@@ -206,7 +290,7 @@ footnote.
|
|
|
206
290
|
|
|
207
291
|
**What it does with your payload.** It moves the buffer you hand it to the peer and hands the peer's
|
|
208
292
|
bytes back to your handler. It holds a message in memory only while that message is in flight: from
|
|
209
|
-
`send()` until its
|
|
293
|
+
`send()` until its acknowledgment is correlated, or until `close()` drains it or reports it
|
|
210
294
|
unresolved. On the receive side your handler is given a copy, and the decoder then reuses its
|
|
211
295
|
internal accumulator for the next frame rather than zeroing it, so those bytes stay in that private
|
|
212
296
|
buffer until a later frame overwrites them, for as long as that reader lives. That is buffer reuse
|
|
@@ -215,15 +299,15 @@ rather than storage, and no public API hands the buffer out, but it is not a scr
|
|
|
215
299
|
**The reads the transport performs, and where they stop.** The transport does not parse HL7, but it
|
|
216
300
|
is not blind to the payload either, and the bound is worth more to you than the slogan. To answer a
|
|
217
301
|
message it has to correlate the answer, so it locates the `MSH` segment and reads the header fields
|
|
218
|
-
an
|
|
302
|
+
an acknowledgment is built from and answered with: `MSH-10`, echoed byte for byte into `MSA-2`, the
|
|
219
303
|
sending and receiving application and facility, which swap sides in the reply, the declared
|
|
220
|
-
delimiters, processing id and version, and the
|
|
304
|
+
delimiters, processing id and version, and the acknowledgment mode in `MSH-15` and `MSH-16`.
|
|
221
305
|
**That scan is bounded at the `MSH` segment's own terminator**, so it reaches nothing past the
|
|
222
306
|
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
|
|
224
|
-
more, `MSA`, for its
|
|
307
|
+
read, never decoded, and never echoed. Reading an inbound acknowledgment adds one segment and no
|
|
308
|
+
more, `MSA`, for its acknowledgment code and the control id it echoes back, decoded under the same
|
|
225
309
|
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
|
|
310
|
+
client's correlator and both acknowledgment builders. Separately, the leading identifier of each
|
|
227
311
|
segment is checked so that a batch envelope or a second `MSH` can be refused rather than falsely
|
|
228
312
|
acknowledged; no field of those segments is read.
|
|
229
313
|
|
|
@@ -234,12 +318,12 @@ whole message, later segments included, and gives it to the optional
|
|
|
234
318
|
`PID` among them. That decode is this package's own code and it ships in this package's tarball, so
|
|
235
319
|
count it as yours rather than the peer's. Nothing reaches it by default: the client, the server and
|
|
236
320
|
`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
|
|
321
|
+
deliberately. If your data-flow boundary turns on later segments never being materialized as decoded
|
|
238
322
|
text, that is the subpath to leave out.
|
|
239
323
|
|
|
240
324
|
**What it does not do.** Outside that subpath it does not parse the message, and outside the two
|
|
241
325
|
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
|
|
326
|
+
write-ahead log, no replay store, and no cache anywhere in this package. Library code calls no logger
|
|
243
327
|
and no `console` method.
|
|
244
328
|
|
|
245
329
|
**What its diagnostics can carry.** Shape rather than content: no error, warning, event payload or
|
|
@@ -247,16 +331,16 @@ stats object ever echoes a run of message content.
|
|
|
247
331
|
|
|
248
332
|
- A **framing error** carries at most the single byte at the structural violation, plus that byte's
|
|
249
333
|
offset.
|
|
250
|
-
- A **warning message** carries structural facts: byte offsets, counts and accumulated sizes. Two
|
|
334
|
+
- A **warning message** carries structural facts: byte offsets, counts, and accumulated sizes. Two
|
|
251
335
|
framing codes are the exception worth knowing about. `MLLP_MISSING_LEADING_VT` and
|
|
252
336
|
`MLLP_FS_WITHOUT_CR` render the hex of the single byte found where a framing byte was expected,
|
|
253
337
|
and on a stream that omits its leading `VT` that byte is the first byte of the unframed content.
|
|
254
338
|
One byte, never a run, the same bound a framing error carries. If that is more than your threat
|
|
255
339
|
model allows, log `code` and `byteOffset` rather than `message`.
|
|
256
|
-
- The **
|
|
340
|
+
- The **acknowledgment-correlation diagnostics** are stricter. Their text comes from a frozen
|
|
257
341
|
registry keyed on the code alone, with no value parameter anywhere in it, so a control id cannot
|
|
258
342
|
reach one; they report byte lengths instead of bytes.
|
|
259
|
-
- `getStats()` returns plain JSON-
|
|
343
|
+
- `getStats()` returns plain JSON-serializable counters, and the two security warnings raised
|
|
260
344
|
through `process.emitWarning` carry their code and a fixed description. The wildcard-bind warning
|
|
261
345
|
names the address you bound, which is your own configuration, never message content.
|
|
262
346
|
|
|
@@ -264,70 +348,22 @@ stats object ever echoes a run of message content.
|
|
|
264
348
|
|
|
265
349
|
- **Encryption in transit.** A plain MLLP connection is cleartext on the wire. TLS is built in, but
|
|
266
350
|
you have to turn it on and supply the material.
|
|
267
|
-
- **Logging and retention.** The moment you log a payload, an
|
|
351
|
+
- **Logging and retention.** The moment you log a payload, an acknowledgment body, or a control id,
|
|
268
352
|
it is yours to protect. Nothing here stores a message, so nothing here can delete one on request
|
|
269
353
|
either.
|
|
270
|
-
- **Idempotency.** MLLP plus an
|
|
354
|
+
- **Idempotency.** MLLP plus an acknowledgment is at-least-once at best. De-duplicate on `MSH-10`
|
|
271
355
|
plus `MSH-7` in your application.
|
|
272
356
|
- **Exposure.** The `127.0.0.1` default and the wildcard-bind opt-in are guardrails, not a network
|
|
273
357
|
policy. Widening either is your decision.
|
|
274
358
|
|
|
275
359
|
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.
|
|
277
|
-
|
|
278
|
-
## API
|
|
279
|
-
|
|
280
|
-
Three code subpaths ship, plus `@cosyte/mllp/package.json`:
|
|
281
|
-
|
|
282
|
-
- **`@cosyte/mllp`** is the whole transport: `createServer` and `createStarterServer`, `createClient`
|
|
283
|
-
and `createStarterClient`, `encodeFrame` and `FrameReader`, `Connection`, `buildRawAck`, the typed
|
|
284
|
-
errors, and the differential harness (`runDifferential`).
|
|
285
|
-
- **`@cosyte/mllp/testing`** is `InMemoryTransport`, a deterministic socket-free test double. Every
|
|
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
|
|
288
|
-
parses through the peer, and is the one place the optional `@cosyte/hl7` peer is needed.
|
|
289
|
-
|
|
290
|
-
What comes with them:
|
|
291
|
-
|
|
292
|
-
- **Strict framing** (`VT + payload + FS + CR`), acknowledgement correlation, auto-reconnect with
|
|
293
|
-
backoff, and backpressure.
|
|
294
|
-
- **A lenient decoder and a strict encoder** (Postel's Law) with **11 stable warning codes** carrying
|
|
295
|
-
byte offsets. Tolerance is opt-in per flag; the server ships tolerant defaults.
|
|
296
|
-
- **An explicit 6-state connection machine**
|
|
297
|
-
(`CONNECTING | CONNECTED | DRAINING | RECONNECTING | DISCONNECTED | CLOSED`) with `stateChange`
|
|
298
|
-
events, never socket flags.
|
|
299
|
-
- **`AbortSignal` on every awaitable** and `Symbol.asyncDispose` on every closeable.
|
|
300
|
-
- **A drain on `close()`** that tells a message which was never written apart from one whose fate is
|
|
301
|
-
unknown, because only one of those is safe to resend.
|
|
302
|
-
- **Zero runtime dependencies.** Node stdlib only.
|
|
303
|
-
|
|
304
|
-
Full reference: [the documentation](https://github.com/cosyte/mllp/tree/main/docs-content).
|
|
305
|
-
|
|
306
|
-
## Compatibility
|
|
307
|
-
|
|
308
|
-
- **Node.js 22 and 24.** `engines.node` is `>=22.0.0` and CI runs both.
|
|
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
|
|
312
|
-
is the one place a whole message is parsed. [PHI and safety](#phi-and-safety) sets all of that out
|
|
313
|
-
in full. For actual parsing, pair this with [`@cosyte/hl7`](https://github.com/cosyte/hl7), which
|
|
314
|
-
is exactly what that subpath does.
|
|
315
|
-
- **Differentially verified against freely available engines**: Mirth Connect from NextGen, and the
|
|
316
|
-
Google Cloud Healthcare MLLP adapter. **Epic and Cerner are not part of that harness**, and no
|
|
317
|
-
claim about either is made here. `runDifferential` ships in the published artifact, so you can aim
|
|
318
|
-
it at your own test or staging endpoint and get a per-exchange frame-parity and `MSA-2` correlation
|
|
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
|
|
321
|
-
replay of unacknowledged messages, no clinical acceptance decision, and no PKI. The
|
|
322
|
-
[known limitations](https://github.com/cosyte/mllp/blob/main/docs-content/limitations.md) page is
|
|
323
|
-
the full list. Read it before you depend on this.
|
|
360
|
+
id. No sample here carries a name, a date of birth, an identifier, or an address, and none should.
|
|
324
361
|
|
|
325
362
|
## Contributing
|
|
326
363
|
|
|
327
|
-
|
|
328
|
-
[
|
|
329
|
-
|
|
330
|
-
change so the approach can be agreed first.
|
|
364
|
+
Pull requests are welcome. The organization's
|
|
365
|
+
[contributing guide](https://github.com/cosyte/.github/blob/main/CONTRIBUTING.md) and
|
|
366
|
+
[code of conduct](https://github.com/cosyte/.github/blob/main/CODE_OF_CONDUCT.md) apply here.
|
|
331
367
|
|
|
332
368
|
A contribution must clear every gate this repository ships, all of them scripts you can run yourself:
|
|
333
369
|
|
|
@@ -338,7 +374,7 @@ pnpm test
|
|
|
338
374
|
pnpm format:check
|
|
339
375
|
pnpm check:no-emdash
|
|
340
376
|
pnpm check:no-internal-refs
|
|
341
|
-
pnpm check:agent
|
|
377
|
+
pnpm check:documents # the README, CLAUDE.md, agent notes and catalog line
|
|
342
378
|
pnpm phi-scan
|
|
343
379
|
pnpm build
|
|
344
380
|
pnpm changeset # every meaningful change carries one
|
|
@@ -352,8 +388,8 @@ commit and is deliberately hard to bypass.
|
|
|
352
388
|
Epic, Cerner, Mirth Connect, NextGen, and Google Cloud Healthcare are trademarks of their respective
|
|
353
389
|
owners. Cosyte is not affiliated with, endorsed by, or sponsored by any of them. The names identify
|
|
354
390
|
the engines this package is tested against, and those it is not. See
|
|
355
|
-
[TRADEMARKS.md](
|
|
391
|
+
[TRADEMARKS.md](https://github.com/cosyte/mllp/blob/main/TRADEMARKS.md).
|
|
356
392
|
|
|
357
393
|
## License
|
|
358
394
|
|
|
359
|
-
MIT, Copyright (c) 2026 Cosyte. See [LICENSE](
|
|
395
|
+
MIT, Copyright (c) 2026 Cosyte LLC. See [LICENSE](https://github.com/cosyte/mllp/blob/main/LICENSE).
|
|
@@ -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.
|
|
5
|
+
// node_modules/.pnpm/tsup@8.5.1_postcss@8.5.32_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
|
|