@cosyte/mllp 0.1.15 → 0.1.16
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 +21 -0
- package/README.md +3 -0
- package/TRADEMARKS.md +5 -5
- package/dist/ack-from-hl7/index.cjs +13 -14
- package/dist/ack-from-hl7/index.cjs.map +1 -1
- package/dist/ack-from-hl7/index.d.cts +1 -0
- package/dist/ack-from-hl7/index.d.ts +1 -0
- package/dist/ack-from-hl7/index.mjs +6 -5
- package/dist/ack-from-hl7/index.mjs.map +1 -1
- package/dist/arbitraries/index.cjs +17 -16
- package/dist/arbitraries/index.cjs.map +1 -1
- package/dist/arbitraries/index.d.cts +1 -0
- package/dist/arbitraries/index.d.ts +1 -0
- package/dist/arbitraries/index.mjs +1 -0
- package/dist/arbitraries/index.mjs.map +1 -1
- package/dist/index.cjs +73 -80
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +61 -56
- package/dist/index.d.ts +61 -56
- package/dist/index.mjs +42 -49
- package/dist/index.mjs.map +1 -1
- package/dist/{registry-CyGU_l8N.d.cts → registry-BPOSRmcX.d.cts} +2 -2
- package/dist/{registry-CyGU_l8N.d.ts → registry-BPOSRmcX.d.ts} +2 -2
- package/dist/testing/index.cjs +3 -1
- package/dist/testing/index.cjs.map +1 -1
- package/dist/testing/index.d.cts +1 -0
- package/dist/testing/index.d.ts +1 -0
- package/dist/testing/index.mjs +2 -0
- package/dist/testing/index.mjs.map +1 -1
- package/dist/{index-CD8V2Mtk.d.cts → transport-2Zo_VBmG.d.cts} +3 -16
- package/dist/{index-CD8V2Mtk.d.ts → transport-2Zo_VBmG.d.ts} +3 -16
- package/package.json +18 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.16
|
|
4
|
+
### Patch Changes
|
|
5
|
+
|
|
6
|
+
- b61fc13: The doc comments in the published type declarations no longer cite our internal tracking ids or a file outside the package; each says in words what the code does.
|
|
7
|
+
|
|
8
|
+
The comment on `getStats().warningsByCode` now also says that the code set may grow in any release, so a caller keeps a default branch, and that removing or renaming a code is a change a caller must act on. No behavior changes.
|
|
9
|
+
- 2d5d616: The optional peer range on `@cosyte/hl7`, which only `@cosyte/mllp/ack-from-hl7` uses, is now `^0.1.5`, the release our tests run against; it was `>=0.0.0`, which admitted versions nothing had tested.
|
|
10
|
+
|
|
11
|
+
What a caller must change: if you use `@cosyte/mllp/ack-from-hl7` with a `@cosyte/hl7` older than 0.1.5, upgrade `@cosyte/hl7` to 0.1.5 or later on the 0.1 line.
|
|
12
|
+
- df61625: The README now tells you to pin an exact version of `@cosyte/mllp` (`pnpm add --save-exact @cosyte/mllp`) and read the changelog before upgrading, since every release is a patch and a patch may carry a change you must act on.
|
|
13
|
+
|
|
14
|
+
The doc comment on the warning code registry no longer says new codes arrive only in minor versions: the set is open, a code may be added in any release, and renaming or removing one is a change a caller must act on.
|
|
15
|
+
- edfb070: The properties of `ServerOptions`, `StarterServerOptions`, `ConnectionOptions`, `FrameReaderOptions`, and `EncoderOptions` are now `readonly` in the type declarations, and the optional last parameter of `encodeFrame`, `Connection.close`, `MllpServer.close`, `MllpClient.connect`, `MllpClient.send`, and `MllpClient.close` is named `options` and defaults to `{}`; calls behave as before.
|
|
16
|
+
|
|
17
|
+
The source now imports `Buffer` from `node:buffer` everywhere it uses it, instead of reading the global, so the declarations name it the same way.
|
|
18
|
+
|
|
19
|
+
What a caller must change: TypeScript code that assigns to a property of one of those options objects after creating it must build the object with every property in place instead, for example with a spread.
|
|
20
|
+
- ad0d8ac: The names table in `TRADEMARKS.md` is now aligned by the formatter; its words are unchanged.
|
|
21
|
+
- 30f5796: The subpaths `@cosyte/mllp/testing`, `@cosyte/mllp/ack-from-hl7`, and `@cosyte/mllp/arbitraries` now resolve their types for a TypeScript project that uses the older `node` (node10) module resolution, through a `typesVersions` map in `package.json`; before, such a project found no types for them.
|
|
22
|
+
- fe4980b: The doc comment on `VERSION` now names `cosyte-process sync-version` as the step that keeps it equal to the package version; the value and its type are unchanged.
|
|
23
|
+
|
|
3
24
|
## 0.1.15
|
|
4
25
|
### Patch Changes
|
|
5
26
|
|
package/README.md
CHANGED
|
@@ -71,6 +71,9 @@ pnpm add @cosyte/mllp
|
|
|
71
71
|
pnpm add @cosyte/hl7
|
|
72
72
|
```
|
|
73
73
|
|
|
74
|
+
Every release is a patch, and a patch may carry a change you must act on, so pin an exact version
|
|
75
|
+
(`pnpm add --save-exact @cosyte/mllp`) and read the changelog before you move to a newer one.
|
|
76
|
+
|
|
74
77
|
Node.js 22 or later, tested on 22, 24, and 26 (`engines.node` is `>=22.0.0`). The package ships
|
|
75
78
|
dual ESM (`import`) and CommonJS (`require`) builds, each with its own type declarations, and has
|
|
76
79
|
zero runtime dependencies. The optional `@cosyte/mllp/arbitraries` entry point, fast-check
|
package/TRADEMARKS.md
CHANGED
|
@@ -21,11 +21,11 @@ including an explicit statement that Epic and Cerner are **not** part of the har
|
|
|
21
21
|
|
|
22
22
|
## Names referenced
|
|
23
23
|
|
|
24
|
-
| Name
|
|
25
|
-
|
|
|
26
|
-
| Mirth Connect, NextGen
|
|
27
|
-
| Google Cloud Healthcare
|
|
28
|
-
| Epic, Cerner
|
|
24
|
+
| Name | Where it appears |
|
|
25
|
+
| ---------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
|
|
26
|
+
| Mirth Connect, NextGen | Named as an engine in the differential test harness. |
|
|
27
|
+
| Google Cloud Healthcare | Named as an engine in the differential test harness (the MLLP adapter). |
|
|
28
|
+
| Epic, Cerner | Named in `docs-content/limitations.md` to record that this package is **not** differentially verified against them. |
|
|
29
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. |
|
|
30
30
|
|
|
31
31
|
All product names, logos, and brands are the property of their respective owners. Use of a name here
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var buffer = require('buffer');
|
|
3
4
|
var module$1 = require('module');
|
|
4
5
|
|
|
5
6
|
// 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
|
|
@@ -10,8 +11,6 @@ var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
|
|
|
10
11
|
var VT = 11;
|
|
11
12
|
var FS = 28;
|
|
12
13
|
var CR = 13;
|
|
13
|
-
|
|
14
|
-
// src/framing/error.ts
|
|
15
14
|
var MAX_SNIPPET_BYTES = 64;
|
|
16
15
|
var MllpFramingError = class _MllpFramingError extends Error {
|
|
17
16
|
name = "MllpFramingError";
|
|
@@ -46,7 +45,7 @@ var MllpFramingError = class _MllpFramingError extends Error {
|
|
|
46
45
|
super(message ?? `MLLP framing error: ${code} at byte offset ${byteOffset}`);
|
|
47
46
|
this.code = code;
|
|
48
47
|
this.byteOffset = byteOffset;
|
|
49
|
-
this.snippet = Buffer.from(snippet.subarray(0, MAX_SNIPPET_BYTES));
|
|
48
|
+
this.snippet = buffer.Buffer.from(snippet.subarray(0, MAX_SNIPPET_BYTES));
|
|
50
49
|
if (Error.captureStackTrace) {
|
|
51
50
|
Error.captureStackTrace(this, _MllpFramingError);
|
|
52
51
|
}
|
|
@@ -65,9 +64,9 @@ function createWarning(code, byteOffset, message) {
|
|
|
65
64
|
}
|
|
66
65
|
|
|
67
66
|
// src/framing/encoder.ts
|
|
68
|
-
function encodeFrame(payload,
|
|
69
|
-
const allow =
|
|
70
|
-
const onWarning =
|
|
67
|
+
function encodeFrame(payload, options = {}) {
|
|
68
|
+
const allow = options.allowDelimiterBytesInPayload === true;
|
|
69
|
+
const onWarning = options.onWarning;
|
|
71
70
|
if (!(payload instanceof Uint8Array)) {
|
|
72
71
|
scanEachByte(payload, allow, onWarning);
|
|
73
72
|
} else if (!allow || onWarning !== void 0) {
|
|
@@ -81,7 +80,7 @@ function encodeFrame(payload, opts) {
|
|
|
81
80
|
else fs = payload.indexOf(FS, i + 1);
|
|
82
81
|
}
|
|
83
82
|
}
|
|
84
|
-
const frame = Buffer.allocUnsafe(payload.length + 3);
|
|
83
|
+
const frame = buffer.Buffer.allocUnsafe(payload.length + 3);
|
|
85
84
|
frame[0] = VT;
|
|
86
85
|
payload.copy(frame, 1);
|
|
87
86
|
frame[payload.length + 1] = FS;
|
|
@@ -98,7 +97,7 @@ function scanEachByte(payload, allow, onWarning) {
|
|
|
98
97
|
function delimiterAt(byte, i, allow, onWarning) {
|
|
99
98
|
const code = byte === VT ? "MLLP_PAYLOAD_CONTAINS_VT" : "MLLP_PAYLOAD_CONTAINS_FS";
|
|
100
99
|
if (!allow) {
|
|
101
|
-
throw new MllpFramingError(code, i, Buffer.from([byte]));
|
|
100
|
+
throw new MllpFramingError(code, i, buffer.Buffer.from([byte]));
|
|
102
101
|
}
|
|
103
102
|
if (onWarning !== void 0) {
|
|
104
103
|
const byteHex = byte === VT ? "0x0B" : "0x1C";
|
|
@@ -291,7 +290,7 @@ function assertKnownAckCode(peer, code) {
|
|
|
291
290
|
}
|
|
292
291
|
function resolveEncoding(inbound, options) {
|
|
293
292
|
if (options.encoding !== void 0) return options.encoding;
|
|
294
|
-
return Buffer.isBuffer(inbound) ? BYTES_INBOUND_ENCODING : TEXT_INBOUND_ENCODING;
|
|
293
|
+
return buffer.Buffer.isBuffer(inbound) ? BYTES_INBOUND_ENCODING : TEXT_INBOUND_ENCODING;
|
|
295
294
|
}
|
|
296
295
|
function assertSerializableAckEncoding(encoding) {
|
|
297
296
|
if (SERIALIZABLE_ACK_ENCODINGS.has(encoding.toLowerCase())) return;
|
|
@@ -300,8 +299,8 @@ function assertSerializableAckEncoding(encoding) {
|
|
|
300
299
|
);
|
|
301
300
|
}
|
|
302
301
|
function inboundBytes(inbound, encoding) {
|
|
303
|
-
if (Buffer.isBuffer(inbound)) return inbound;
|
|
304
|
-
if (typeof inbound === "string") return Buffer.from(inbound, encoding);
|
|
302
|
+
if (buffer.Buffer.isBuffer(inbound)) return inbound;
|
|
303
|
+
if (typeof inbound === "string") return buffer.Buffer.from(inbound, encoding);
|
|
305
304
|
return void 0;
|
|
306
305
|
}
|
|
307
306
|
function verifyVerbatimEcho(ackPayload, inboundRaw) {
|
|
@@ -318,7 +317,7 @@ function verifyVerbatimEcho(ackPayload, inboundRaw) {
|
|
|
318
317
|
};
|
|
319
318
|
}
|
|
320
319
|
function verifyTextInboundEcho(controlId, inbound) {
|
|
321
|
-
if (Buffer.isBuffer(inbound)) return null;
|
|
320
|
+
if (buffer.Buffer.isBuffer(inbound)) return null;
|
|
322
321
|
if (controlId === "") return null;
|
|
323
322
|
let hasNonAscii = false;
|
|
324
323
|
for (let i = 0; i < controlId.length; i++) {
|
|
@@ -335,7 +334,7 @@ function verifyTextInboundEcho(controlId, inbound) {
|
|
|
335
334
|
}
|
|
336
335
|
function toMllpAck(params) {
|
|
337
336
|
const { ack, requestedCode, code, correlationId, mode, warnings, options, encoding } = params;
|
|
338
|
-
const payload = Buffer.from(ack.toString(), encoding);
|
|
337
|
+
const payload = buffer.Buffer.from(ack.toString(), encoding);
|
|
339
338
|
const frame = encodeFrame(payload, {
|
|
340
339
|
allowDelimiterBytesInPayload: options.allowDelimiterBytesInPayload ?? false
|
|
341
340
|
});
|
|
@@ -386,7 +385,7 @@ function buildUnparseableFallback(peer, requestedCode, fatalCode, options, encod
|
|
|
386
385
|
});
|
|
387
386
|
}
|
|
388
387
|
function resolveInbound(peer, inbound, encoding) {
|
|
389
|
-
if (Buffer.isBuffer(inbound)) {
|
|
388
|
+
if (buffer.Buffer.isBuffer(inbound)) {
|
|
390
389
|
return peer.parseHL7(stripLeadingSegmentTerminators(inbound).toString(encoding));
|
|
391
390
|
}
|
|
392
391
|
if (typeof inbound === "string") {
|