@cosyte/mllp 0.1.10 → 0.1.12
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 +22 -0
- package/README.md +31 -20
- package/TRADEMARKS.md +5 -2
- package/dist/ack-from-hl7/index.cjs +1 -1
- package/dist/ack-from-hl7/index.cjs.map +1 -1
- package/dist/index.cjs +317 -35
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +471 -34
- package/dist/index.d.ts +471 -34
- package/dist/index.mjs +313 -36
- package/dist/index.mjs.map +1 -1
- package/package.json +18 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.12
|
|
4
|
+
### Patch Changes
|
|
5
|
+
|
|
6
|
+
- 254176b: **`TlsOptions.pfx`**: a client now takes its mutual-TLS certificate and key as one PKCS#12 file's bytes, unlocked with `passphrase`, the same as a server's `ServerTlsOptions.pfx`. A file the TLS library cannot load (a wrong passphrase, not PKCS#12, or a legacy RC2-40 file that Node.js on OpenSSL 3 refuses) rejects `connect()` with `MllpTlsConfigurationError` and the code `MLLP_TLS_PFX_REJECTED` before a socket is opened, and the client does not retry it; the message names `tls.pfx` and never the file or the passphrase. A caller passing `cert` and `key` changes nothing.
|
|
7
|
+
- bdc3013: The reference now says what `connect()` rejects with when `destroy()` runs while it is still connecting, and how long a TLS server waits for a handshake. Over TCP or TLS, before or during the handshake, `connect()` rejects with an `MllpConnectionError` whose `phase` is `connect`; its `cause` is the reason passed to `destroy(reason)`, or with no reason an `Error` whose message is `closed before connect`, and it carries no `connectionCause`. A reason is the caller's own, so one whose message or `code` reads like a TLS failure (the word `alert`, an `ERR_SSL_` code, `EPROTO`, a certificate verification code) is no longer sorted into `tls-handshake` or `tls-verify`: it is carried as the cause as it is. The first `destroy()` decides: a second call before `connect()` settles, with or without a reason, no longer changes how a TLS `connect()` is classified. A TLS server sets no handshake time limit of its own: on Node.js the runtime's 120 second default applies, after which the socket is closed and `'tlsClientError'` fires with code `ERR_TLS_HANDSHAKE_TIMEOUT`. Until then such a connection holds a `maxConnections` place, and `deadPeerTimeoutMs` does not cover it. On Bun and Deno we have not measured what bounds a handshake. The one change in behaviour: a caller who read a `tls-handshake` or `tls-verify` cause off a `connect()` they ended with their own `destroy(reason)` now sees no `connectionCause`, and tells that case apart by `err.cause === reason`.
|
|
8
|
+
- b7fc91b: The client and the server now turn Nagle's algorithm off (TCP_NODELAY) on every socket they open or accept, plain and TLS, reconnects included. With it on, an ACK or a message written while an earlier one was still unacknowledged at the TCP level waited for the peer's delayed TCP acknowledgment, 40 ms on Linux, so on a link with irregular traffic some acknowledgments took up to about 40 ms longer than they needed to. A new `noDelay` option on `ClientOptions`, `StarterClientOptions` and `ServerOptions`, default `true`, sets it; pass `noDelay: false` to keep the operating system's default. Nothing else changes for a caller.
|
|
9
|
+
- 48a7fff: `send(payload, { ackTimeoutMs })` now bounds that send's wait for its acknowledgment, as its name says. It used to bound only the wait for queue room under `onBackpressure: "wait"`, and the acknowledgment wait always ran on the client's `ackTimeoutMs`, so a send asking for 5 s waited the client's 30 s. A caller who passes a per-send `ackTimeoutMs` gets that bound now, shorter or longer than the client's; one who wanted the old behavior, the client-wide bound on the acknowledgment, drops the per-send option or passes the client's value. Under `onBackpressure: "wait"` it still bounds the wait for room too, and the acknowledgment wait starts afresh once the send is written. A send without the option behaves exactly as before.
|
|
10
|
+
- ae156dc: Two additions an engine in front of this package needs to pass through.
|
|
11
|
+
|
|
12
|
+
- **`ServerTlsOptions.pfx`** takes a PKCS#12 file's bytes in place of `cert` and `key`, unlocked with `passphrase`. A file the TLS library cannot load (a wrong passphrase, not PKCS#12, or a legacy RC2-40 file that Node.js on OpenSSL 3 refuses) rejects `listen()` with `MllpTlsConfigurationError` and the new code `MLLP_TLS_PFX_REJECTED`, before anything is bound; the message names `tls.pfx` and never the file or the passphrase. `ServerTlsOptions.cert` and `key` are now optional in the type, since `pfx` can stand in for them; a server given neither pair nor file now throws a `TypeError` when it is created, where before it was refused by the type and failed every handshake if the type was bypassed. A caller passing `cert` and `key` changes nothing.
|
|
13
|
+
- **`selectAckCode({ msh15, msh16, outcome })`** returns the acknowledgement code to send, by the same table the server's auto-ACK uses: the accept-mode `CA`/`CE`/`CR` where MSH-15 asks for an accept acknowledgement on that outcome, the outcome itself otherwise. It also reports the mode, whether MSH-16 asks for an application acknowledgement, and whether either field held a value outside Table 0155. New types `AckCodeSelection` and `AckCodeSelectionInput`.
|
|
14
|
+
- 1357fe3: The README now matches what ships. Its API section names all four code subpaths, `@cosyte/mllp/arbitraries` among them, where it said three, and its Documentation list links every page of the documentation site in the sidebar's order, where it linked 10 of the 19. Nothing changes for a caller.
|
|
15
|
+
- d1abef3: **`pfx` together with `cert` or `key` is now refused.** A client or server given a PKCS#12 file in `tls.pfx` and also `tls.cert` or `tls.key` used to be accepted, and Node.js loaded the file last, so the file's certificate was presented and the `cert` passed went unused with nothing to say so. Now `createClient`, `createServer` and both constructors throw `MllpTlsConfigurationError` with the new stable code `MLLP_TLS_CREDENTIAL_CONFLICT`; the message names the options and never their values. A caller passing all three must drop either `pfx` or the `cert` and `key` pair. The `MLLP_TLS_PFX_REJECTED` message now ends with "no socket was opened" rather than "nothing was bound", so it reads right when a client raises it.
|
|
16
|
+
- b065e1e: The cipher and Diffie-Hellman options now fail loudly on a runtime that would not enforce them, `maxConnections` holds with its event on every runtime, and `destroy()` during `connect()` settles the promise. Before a cipher list or Diffie-Hellman parameters reach the runtime, probes that carry none of your configuration check that its TLS library enforces that kind of option. Where it does not, `connect()` or `listen()` rejects with an `MllpTlsConfigurationError` carrying one of two new codes, both exported: `MLLP_TLS_CIPHER_LIST_UNENFORCEABLE` (for `ciphers` and a client's `atnaTransportSecurity`) and `MLLP_TLS_DH_PARAMETERS_UNENFORCEABLE` (for `dhParameters` and a server's `atnaTransportSecurity`). Under Deno, whose `node:tls` took these options and applied none of them with no error, all three options are now refused. Under Bun, `atnaTransportSecurity` and `dhParameters` are refused with Bun's own refusal as the `cause`, where before a server with either threw a plain `Error` from `createServer`; `ciphers` still works on Bun. Node.js passes every probe, so nothing changes there. `TlsConfigurationErrorCode` gains the two members, so a caller that switches over every member of that union needs a case for each; both are classified permanent, so a client never retries them. `ServerOptions.maxConnections` is now counted by the server itself instead of by the runtime's listener, so `connectionRejected` fires under Deno too, where before the connection was closed and nothing reported it. `MllpClient.destroy()` called while `connect()` is still connecting now rejects that `connect()` with an `MllpConnectionError` (`phase: 'connect'`); with no reason given it used to leave the promise pending for good.
|
|
17
|
+
- 419c12d: Under Bun, a TLS server with `maxConnections` now gives a connection's place back when that connection closes. Bun hands the server's accept and secure-connection events the same socket object, and the transport that took the socket over removed the listener that counted its close, so every TLS connection that completed a handshake held its place for good: once `maxConnections` had been reached, the server closed every new connection at accept. Node.js and Deno were not affected, and plaintext servers were not affected on any runtime. Nothing changes for a caller.
|
|
18
|
+
- 419c12d: The TLS enforcement probes now run once per process instead of on every connect. A client with `atnaTransportSecurity` built five throwaway TLS contexts on each connect and each reconnect, and one with `ciphers` built one; now only the first connect in a process builds them, and every later connect, reconnect and server reads the result it found. A probe's input is a fixed value and the runtime does not change under a running process, so what is refused and what is accepted is unchanged. Nothing changes for a caller.
|
|
19
|
+
|
|
20
|
+
## 0.1.11
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- 6808571: A client can now bound how long it waits to establish a connection. New option `ClientOptions.connectTimeoutMs` (also on `createStarterClient`): an integer number of milliseconds from 1 to 2147483647 that covers the TCP connect and, with TLS on, the handshake after it. Unset means no bound, the behaviour so far, in which a connect to an address that drops packets waits on the operating system and a TLS handshake against a peer that accepts the TCP connection and never answers waits indefinitely. On expiry the socket is destroyed and `connect()` rejects with an `MllpConnectionError` whose `phase` is `connect` and whose `connectionCause` is the new `connect-timeout`; nothing was written, so no message can have reached the peer. On an auto-reconnect attempt the expiry feeds the reconnect policy like any other connect failure: `RetryContext.lastError` carries `code: "ETIMEDOUT"` and it is classified transient, so the client backs off and tries again. `ConnectionErrorCause` gains the member `connect-timeout`, so a caller that switches over every member of that union needs a case for it. A `connectTimeoutMs` that is not an integer in range throws a `RangeError` when the client is created.
|
|
24
|
+
|
|
3
25
|
## 0.1.10
|
|
4
26
|
### Patch Changes
|
|
5
27
|
|
package/README.md
CHANGED
|
@@ -207,7 +207,7 @@ table, the TLS 1.2 floor (IHE ATNA ITI-19), the typed failure modes (`tls-verify
|
|
|
207
207
|
|
|
208
208
|
## API
|
|
209
209
|
|
|
210
|
-
|
|
210
|
+
Four code subpaths ship, plus `@cosyte/mllp/package.json`:
|
|
211
211
|
|
|
212
212
|
- **`@cosyte/mllp`** is the whole transport: `createServer` and `createStarterServer`, `createClient`
|
|
213
213
|
and `createStarterClient`, `encodeFrame` and `FrameReader`, `Connection`, `buildRawAck`, the typed
|
|
@@ -216,6 +216,11 @@ Three code subpaths ship, plus `@cosyte/mllp/package.json`:
|
|
|
216
216
|
test that can run over it should.
|
|
217
217
|
- **`@cosyte/mllp/ack-from-hl7`** builds acknowledgments from a parsed message, or from raw bytes it
|
|
218
218
|
parses through the peer, and is the one place the optional `@cosyte/hl7` peer is needed.
|
|
219
|
+
- **`@cosyte/mllp/arbitraries`** is fast-check generators for property-testing code you build on
|
|
220
|
+
the transport: `payload`, `frame`, `chunked` and `stream` for canonical bytes, `messyStream` for
|
|
221
|
+
the framing quirks a lenient reader accepts, and `hostileInput` for streams a reader may refuse
|
|
222
|
+
but must never hang or crash on. It needs the optional `fast-check` peer, and imports nothing
|
|
223
|
+
from the library at run time.
|
|
219
224
|
|
|
220
225
|
What comes with them:
|
|
221
226
|
|
|
@@ -256,25 +261,31 @@ The full reference is on [docs.cosyte.com/mllp](https://docs.cosyte.com/mllp); s
|
|
|
256
261
|
## Documentation
|
|
257
262
|
|
|
258
263
|
The full reference lives at [docs.cosyte.com/mllp](https://docs.cosyte.com/mllp), built from this
|
|
259
|
-
repository's [`docs-content/`](https://github.com/cosyte/mllp/tree/main/docs-content).
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
- [
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
- [
|
|
267
|
-
|
|
268
|
-
- [
|
|
269
|
-
|
|
270
|
-
- [
|
|
271
|
-
|
|
272
|
-
- [
|
|
273
|
-
|
|
274
|
-
- [
|
|
275
|
-
and
|
|
276
|
-
- [
|
|
277
|
-
what not to trust this transport to do.
|
|
264
|
+
repository's [`docs-content/`](https://github.com/cosyte/mllp/tree/main/docs-content). Every page
|
|
265
|
+
is listed here, in the order and the groups of the site's sidebar:
|
|
266
|
+
|
|
267
|
+
- [Overview](https://github.com/cosyte/mllp/blob/main/docs-content/intro.md): what the package is and what it leaves to you.
|
|
268
|
+
- [Installation](https://github.com/cosyte/mllp/blob/main/docs-content/installation.md) and [Quickstart](https://github.com/cosyte/mllp/blob/main/docs-content/quickstart.md): install it, then
|
|
269
|
+
start a server, send it a message and read the acknowledgment.
|
|
270
|
+
- How-to guides:
|
|
271
|
+
- [Send messages](https://github.com/cosyte/mllp/blob/main/docs-content/send-messages.md)
|
|
272
|
+
- [Receive and acknowledge messages](https://github.com/cosyte/mllp/blob/main/docs-content/receive-messages.md)
|
|
273
|
+
- [Tolerate a sender's framing quirks](https://github.com/cosyte/mllp/blob/main/docs-content/tolerate-sender-quirks.md)
|
|
274
|
+
- [Secure a link with TLS](https://github.com/cosyte/mllp/blob/main/docs-content/tls.md)
|
|
275
|
+
- [Build ACKs with @cosyte/hl7](https://github.com/cosyte/mllp/blob/main/docs-content/build-acks-from-hl7.md)
|
|
276
|
+
- [Test your code and verify an engine](https://github.com/cosyte/mllp/blob/main/docs-content/testing.md)
|
|
277
|
+
- [Property-test your own code with generated MLLP streams](https://github.com/cosyte/mllp/blob/main/docs-content/property-test-your-code.md)
|
|
278
|
+
- Explanation:
|
|
279
|
+
- [ACKs and the commit contract](https://github.com/cosyte/mllp/blob/main/docs-content/acks.md)
|
|
280
|
+
- [Framing and tolerance](https://github.com/cosyte/mllp/blob/main/docs-content/framing.md)
|
|
281
|
+
- [Connection, reconnect and backpressure](https://github.com/cosyte/mllp/blob/main/docs-content/reliability.md)
|
|
282
|
+
- [Known limitations and non-goals](https://github.com/cosyte/mllp/blob/main/docs-content/limitations.md): what not to trust this transport to do.
|
|
283
|
+
- Reference:
|
|
284
|
+
- [Warning and error codes](https://github.com/cosyte/mllp/blob/main/docs-content/warning-and-error-codes.md)
|
|
285
|
+
- [Conformance statement](https://github.com/cosyte/mllp/blob/main/docs-content/conformance.md)
|
|
286
|
+
- [Troubleshooting](https://github.com/cosyte/mllp/blob/main/docs-content/troubleshooting.md): what to do when a link fails, symptom by symptom.
|
|
287
|
+
- [Testing and quality](https://github.com/cosyte/mllp/blob/main/docs-content/testing-and-quality.md) and [Performance](https://github.com/cosyte/mllp/blob/main/docs-content/performance.md): how we
|
|
288
|
+
test the package, and what we measure.
|
|
278
289
|
|
|
279
290
|
## Support
|
|
280
291
|
|
package/TRADEMARKS.md
CHANGED
|
@@ -5,8 +5,10 @@ or sponsored by** any company named in this repository or its documentation.
|
|
|
5
5
|
|
|
6
6
|
## Why these names appear
|
|
7
7
|
|
|
8
|
-
This package names other systems in
|
|
9
|
-
harness runs against,
|
|
8
|
+
This package names other systems in three places: to identify the engines its differential test
|
|
9
|
+
harness runs against, to state plainly which engines it has **not** been verified against, and to
|
|
10
|
+
point a reader moving an interface from another product or library to the setting that does the same
|
|
11
|
+
job here.
|
|
10
12
|
|
|
11
13
|
Every reference is **descriptive**: it identifies whose engine was tested against, or whose behaviour is explicitly not covered. Naming a system is the only way to say
|
|
12
14
|
whether a library works with it.
|
|
@@ -24,6 +26,7 @@ including an explicit statement that Epic and Cerner are **not** part of the har
|
|
|
24
26
|
| Mirth Connect, NextGen | Named as an engine in the differential test harness. |
|
|
25
27
|
| Google Cloud Healthcare | Named as an engine in the differential test harness (the MLLP adapter). |
|
|
26
28
|
| Epic, Cerner | Named in `docs-content/limitations.md` to record that this package is **not** differentially verified against them. |
|
|
29
|
+
| HAPI, python-hl7, simple-hl7 | Named in `docs-content/coming-from-an-engine.md`, in the table that maps their listener and acknowledgment settings to ours. |
|
|
27
30
|
|
|
28
31
|
All product names, logos, and brands are the property of their respective owners. Use of a name here
|
|
29
32
|
does not imply any affiliation with, or endorsement by, its owner. If you own one of these marks and
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var module$1 = require('module');
|
|
4
4
|
|
|
5
|
-
// node_modules/.pnpm/tsup@9.0.0_postcss@8.5.32_tsx@4.23.15_typescript@5.9.
|
|
5
|
+
// node_modules/.pnpm/tsup@9.0.0_postcss@8.5.32_tsx@4.23.15_typescript@5.9.3_yaml@2.9.1/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
|
|