@cosyte/mllp 0.1.2 → 0.1.4
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 +10 -0
- package/README.md +92 -57
- package/dist/ack-from-hl7/index.cjs +1 -1
- package/dist/ack-from-hl7/index.cjs.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +13 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.4
|
|
4
|
+
### Patch Changes
|
|
5
|
+
|
|
6
|
+
- c9dd905: The README's contributing section now says what `pnpm check:documents` checks: the README, `CLAUDE.md` and the catalog line. No code changes.
|
|
7
|
+
|
|
8
|
+
## 0.1.3
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- 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.
|
|
12
|
+
|
|
3
13
|
## 0.1.2
|
|
4
14
|
### Patch Changes
|
|
5
15
|
|
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
[](https://www.npmjs.com/package/@cosyte/mllp)
|
|
13
13
|
[](https://github.com/cosyte/mllp/actions/workflows/ci.yml)
|
|
14
14
|
[](https://github.com/cosyte/mllp/blob/main/LICENSE)
|
|
15
|
-
[](https://nodejs.org)
|
|
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
|
|
|
@@ -22,9 +22,11 @@ An MLLP client and server for Node.js: the transport-only sibling to @cosyte/hl7
|
|
|
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)
|
|
@@ -63,14 +65,16 @@ Named rather than implied, here is what is still moving:
|
|
|
63
65
|
## Install
|
|
64
66
|
|
|
65
67
|
```bash
|
|
66
|
-
# Node.js 22 or later, tested on 22 and 24
|
|
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
80
|
Start a server, send it a message, and read the acknowledgment it built. Auto-ACK is on by default,
|
|
@@ -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
|
|
@@ -275,60 +359,11 @@ stats object ever echoes a run of message content.
|
|
|
275
359
|
Every example on this page uses placeholder application and facility names and a synthetic control
|
|
276
360
|
id. No sample here carries a name, a date of birth, an identifier, or an address, and none should.
|
|
277
361
|
|
|
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 acknowledgments 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`), acknowledgment 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 or later, tested on 22 and 24.** `engines.node` is `>=22.0.0`.
|
|
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 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
|
-
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 acknowledgment, 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.
|
|
324
|
-
|
|
325
362
|
## Contributing
|
|
326
363
|
|
|
327
|
-
|
|
328
|
-
[GitHub issues](https://github.com/cosyte/mllp/issues). Pull requests are welcome. The organization's
|
|
364
|
+
Pull requests are welcome. The organization's
|
|
329
365
|
[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.
|
|
331
|
-
issue before a large change so the approach can be agreed first.
|
|
366
|
+
[code of conduct](https://github.com/cosyte/.github/blob/main/CODE_OF_CONDUCT.md) apply here.
|
|
332
367
|
|
|
333
368
|
A contribution must clear every gate this repository ships, all of them scripts you can run yourself:
|
|
334
369
|
|
|
@@ -339,7 +374,7 @@ pnpm test
|
|
|
339
374
|
pnpm format:check
|
|
340
375
|
pnpm check:no-emdash
|
|
341
376
|
pnpm check:no-internal-refs
|
|
342
|
-
pnpm check:
|
|
377
|
+
pnpm check:documents # the README, CLAUDE.md and catalog line
|
|
343
378
|
pnpm phi-scan
|
|
344
379
|
pnpm build
|
|
345
380
|
pnpm changeset # every meaningful change carries one
|
|
@@ -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
|
|