@glion/mllp-client 0.16.0 → 0.20.0
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/README.md +466 -193
- package/dist/assertions.d.ts +17 -0
- package/dist/assertions.d.ts.map +1 -0
- package/dist/chunks/mllp-invalid-option-error.js +32 -0
- package/dist/chunks/mllp-invalid-option-error.js.map +1 -0
- package/dist/client.d.ts +127 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/constants.d.ts +23 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/errors/base.d.ts +30 -0
- package/dist/errors/base.d.ts.map +1 -0
- package/dist/errors/index.d.ts +14 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/mllp-client-closed-error.d.ts +12 -0
- package/dist/errors/mllp-client-closed-error.d.ts.map +1 -0
- package/dist/errors/mllp-connection-error.d.ts +9 -0
- package/dist/errors/mllp-connection-error.d.ts.map +1 -0
- package/dist/errors/mllp-connection-failed-error.d.ts +12 -0
- package/dist/errors/mllp-connection-failed-error.d.ts.map +1 -0
- package/dist/errors/mllp-connection-lost-error.d.ts +13 -0
- package/dist/errors/mllp-connection-lost-error.d.ts.map +1 -0
- package/dist/errors/mllp-connection-timeout-error.d.ts +13 -0
- package/dist/errors/mllp-connection-timeout-error.d.ts.map +1 -0
- package/dist/errors/mllp-invalid-message-error.d.ts +13 -0
- package/dist/errors/mllp-invalid-message-error.d.ts.map +1 -0
- package/dist/errors/mllp-invalid-option-error.d.ts +8 -0
- package/dist/errors/mllp-invalid-option-error.d.ts.map +1 -0
- package/dist/errors/mllp-invalid-response-error.d.ts +16 -0
- package/dist/errors/mllp-invalid-response-error.d.ts.map +1 -0
- package/dist/errors/mllp-send-aborted-error.d.ts +12 -0
- package/dist/errors/mllp-send-aborted-error.d.ts.map +1 -0
- package/dist/errors/mllp-send-timeout-error.d.ts +13 -0
- package/dist/errors/mllp-send-timeout-error.d.ts.map +1 -0
- package/dist/errors/nak-exception.d.ts +17 -0
- package/dist/errors/nak-exception.d.ts.map +1 -0
- package/dist/events.d.ts +35 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/index.d.ts +13 -20
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +843 -3
- package/dist/index.js.map +1 -0
- package/dist/messages.d.ts +37 -0
- package/dist/messages.d.ts.map +1 -0
- package/dist/queue.d.ts +25 -0
- package/dist/queue.d.ts.map +1 -0
- package/dist/reconnect.d.ts +18 -0
- package/dist/reconnect.d.ts.map +1 -0
- package/dist/runtime/node.d.ts +61 -0
- package/dist/runtime/node.d.ts.map +1 -0
- package/dist/runtime/node.js +121 -0
- package/dist/runtime/node.js.map +1 -0
- package/dist/runtime/workers.d.ts +33 -0
- package/dist/runtime/workers.d.ts.map +1 -0
- package/dist/runtime/workers.js +70 -0
- package/dist/runtime/workers.js.map +1 -0
- package/dist/session.d.ts +63 -0
- package/dist/session.d.ts.map +1 -0
- package/dist/state.d.ts +42 -0
- package/dist/state.d.ts.map +1 -0
- package/dist/types.d.ts +109 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/utils.d.ts +9 -0
- package/dist/utils.d.ts.map +1 -0
- package/package.json +37 -46
- package/dist/client.js +0 -549
- package/dist/client.js.map +0 -1
- package/dist/core/acknowledgment.d.ts +0 -103
- package/dist/core/acknowledgment.d.ts.map +0 -1
- package/dist/core/client.d.ts +0 -256
- package/dist/core/client.d.ts.map +0 -1
- package/dist/core/connect.d.ts +0 -101
- package/dist/core/connect.d.ts.map +0 -1
- package/dist/core/errors.d.ts +0 -81
- package/dist/core/errors.d.ts.map +0 -1
- package/dist/core/index.d.ts +0 -23
- package/dist/core/index.d.ts.map +0 -1
- package/dist/core/index.js +0 -2
- package/dist/core/internal/ack-parser-stream.d.ts +0 -22
- package/dist/core/internal/ack-parser-stream.d.ts.map +0 -1
- package/dist/core/internal/subscribe-abort.d.ts +0 -30
- package/dist/core/internal/subscribe-abort.d.ts.map +0 -1
- package/dist/node.js +0 -214
- package/dist/node.js.map +0 -1
- package/dist/runtimes/internal/node-error-mapping.d.ts +0 -68
- package/dist/runtimes/internal/node-error-mapping.d.ts.map +0 -1
- package/dist/runtimes/node.d.ts +0 -47
- package/dist/runtimes/node.d.ts.map +0 -1
- package/dist/runtimes/node.js +0 -3
- package/dist/runtimes/workers.d.ts +0 -64
- package/dist/runtimes/workers.d.ts.map +0 -1
- package/dist/runtimes/workers.js +0 -143
- package/dist/runtimes/workers.js.map +0 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Option validation, and the client's invariants. Each option `assert*`
|
|
3
|
+
* throws {@link MllpInvalidOptionError} for an option a caller passed out of
|
|
4
|
+
* range, before anything happens. {@link assertPhase} throws for a phase the
|
|
5
|
+
* client cannot be in where it is asserted: a bug.
|
|
6
|
+
*
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
9
|
+
import type { State } from "./state";
|
|
10
|
+
export declare function assertTimeoutMs(option: string, ms: number): void;
|
|
11
|
+
export declare function assertByteCap(bytes: number): void;
|
|
12
|
+
/** `state` is in `phase`; `where` names the site for the report. */
|
|
13
|
+
export declare function assertPhase<P extends State["phase"]>(state: State, phase: P, where: string): asserts state is Extract<State, {
|
|
14
|
+
phase: P;
|
|
15
|
+
}>;
|
|
16
|
+
export declare function assertReconnectAttempts(attempts: number): void;
|
|
17
|
+
//# sourceMappingURL=assertions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assertions.d.ts","sourceRoot":"","sources":["../src/assertions.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAErC,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,IAAI,CAMhE;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAMjD;AAED,oEAAoE;AACpE,wBAAgB,WAAW,CAAC,CAAC,SAAS,KAAK,CAAC,OAAO,CAAC,EAClD,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,CAAC,EACR,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,KAAK,EAAE;IAAE,KAAK,EAAE,CAAC,CAAA;CAAE,CAAC,CAM/C;AAED,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAO9D"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
//#region src/errors/base.ts
|
|
2
|
+
/**
|
|
3
|
+
* The base every client error extends, and what each one carries: a fixed
|
|
4
|
+
* `code`, a fixed message, what became of the message, and the lower layer's
|
|
5
|
+
* failure on `cause`.
|
|
6
|
+
*
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
9
|
+
const MllpErrorCode = {
|
|
10
|
+
CLOSED: "CLOSED",
|
|
11
|
+
CONNECTION_FAILED: "CONNECTION_FAILED",
|
|
12
|
+
CONNECTION_LOST: "CONNECTION_LOST",
|
|
13
|
+
CONNECTION_TIMEOUT: "CONNECTION_TIMEOUT",
|
|
14
|
+
INVALID_MESSAGE: "INVALID_MESSAGE",
|
|
15
|
+
INVALID_OPTION: "INVALID_OPTION",
|
|
16
|
+
INVALID_RESPONSE: "INVALID_RESPONSE",
|
|
17
|
+
SEND_ABORTED: "SEND_ABORTED",
|
|
18
|
+
SEND_TIMEOUT: "SEND_TIMEOUT"
|
|
19
|
+
};
|
|
20
|
+
var MllpClientError = class extends Error {};
|
|
21
|
+
//#endregion
|
|
22
|
+
//#region src/errors/mllp-invalid-option-error.ts
|
|
23
|
+
/** An option is out of range. Raised before anything happens. */
|
|
24
|
+
var MllpInvalidOptionError = class extends MllpClientError {
|
|
25
|
+
name = "MllpInvalidOptionError";
|
|
26
|
+
code = MllpErrorCode.INVALID_OPTION;
|
|
27
|
+
delivery = "not-sent";
|
|
28
|
+
};
|
|
29
|
+
//#endregion
|
|
30
|
+
export { MllpClientError as n, MllpErrorCode as r, MllpInvalidOptionError as t };
|
|
31
|
+
|
|
32
|
+
//# sourceMappingURL=mllp-invalid-option-error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mllp-invalid-option-error.js","names":[],"sources":["../../src/errors/base.ts","../../src/errors/mllp-invalid-option-error.ts"],"sourcesContent":["/**\n * The base every client error extends, and what each one carries: a fixed\n * `code`, a fixed message, what became of the message, and the lower layer's\n * failure on `cause`.\n *\n * @module\n */\n\nexport const MllpErrorCode = {\n CLOSED: \"CLOSED\",\n CONNECTION_FAILED: \"CONNECTION_FAILED\",\n CONNECTION_LOST: \"CONNECTION_LOST\",\n CONNECTION_TIMEOUT: \"CONNECTION_TIMEOUT\",\n INVALID_MESSAGE: \"INVALID_MESSAGE\",\n INVALID_OPTION: \"INVALID_OPTION\",\n INVALID_RESPONSE: \"INVALID_RESPONSE\",\n SEND_ABORTED: \"SEND_ABORTED\",\n SEND_TIMEOUT: \"SEND_TIMEOUT\",\n} as const;\n\nexport type MllpErrorCode = (typeof MllpErrorCode)[keyof typeof MllpErrorCode];\n\n/**\n * What became of the message. `not-sent`: nothing reached the wire, and the\n * message may be sent again as it is. `unknown`: it may have reached the\n * remote system, and sending it again may deliver it twice.\n */\nexport type MllpDelivery = \"not-sent\" | \"unknown\";\n\nexport abstract class MllpClientError extends Error {\n abstract readonly code: MllpErrorCode;\n abstract readonly delivery: MllpDelivery;\n}\n","import { MllpClientError, MllpErrorCode } from \"./base\";\n\n/** An option is out of range. Raised before anything happens. */\nexport class MllpInvalidOptionError extends MllpClientError {\n override readonly name = \"MllpInvalidOptionError\";\n readonly code = MllpErrorCode.INVALID_OPTION;\n readonly delivery = \"not-sent\";\n}\n"],"mappings":";;;;;;;;AAQA,MAAa,gBAAgB;CAC3B,QAAQ;CACR,mBAAmB;CACnB,iBAAiB;CACjB,oBAAoB;CACpB,iBAAiB;CACjB,gBAAgB;CAChB,kBAAkB;CAClB,cAAc;CACd,cAAc;CACf;AAWD,IAAsB,kBAAtB,cAA8C,MAAM;;;;AC1BpD,IAAa,yBAAb,cAA4C,gBAAgB;CAC1D,OAAyB;CACzB,OAAgB,cAAc;CAC9B,WAAoB"}
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import type { Root } from "@glion/ast";
|
|
2
|
+
import { MllpClientError } from "./errors";
|
|
3
|
+
import { MllpClientEmitter } from "./events";
|
|
4
|
+
import type { MllpClientOptions, MllpClientResponse, MllpClientState, MllpSendOptions } from "./types";
|
|
5
|
+
/**
|
|
6
|
+
* Sends HL7v2 messages to one remote system over MLLP and returns each
|
|
7
|
+
* message's acknowledgment.
|
|
8
|
+
*
|
|
9
|
+
* One client owns one socket and puts one message on the wire at a time.
|
|
10
|
+
* `send()` writes the message, waits for the acknowledgment, checks that it
|
|
11
|
+
* answers this message, and resolves with it. A send arriving while another
|
|
12
|
+
* is in flight waits its turn; sends go out in the order they were called.
|
|
13
|
+
*
|
|
14
|
+
* ```ts
|
|
15
|
+
* import { MllpClient } from "@glion/mllp-client";
|
|
16
|
+
* import { nodeSocket } from "@glion/mllp-client/node";
|
|
17
|
+
*
|
|
18
|
+
* await using client = new MllpClient({
|
|
19
|
+
* socket: nodeSocket({ host: "hl7.example.org", port: 2575 }),
|
|
20
|
+
* });
|
|
21
|
+
*
|
|
22
|
+
* const ack = await client.send(adtMessage);
|
|
23
|
+
* ack.code; // "AA" or "CA"
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* ## Lifecycle
|
|
27
|
+
*
|
|
28
|
+
* `send()` connects on first use; `connect()` opens the connection ahead of
|
|
29
|
+
* time. `state` reports the phase. A connection that fails to open is dialed
|
|
30
|
+
* again under the `reconnect` policy. A connection that is lost closes the
|
|
31
|
+
* client: the message in flight rejects and is not sent again. After
|
|
32
|
+
* `close()`, or once the client has closed on a failure, every call rejects
|
|
33
|
+
* with {@link MllpClientClosedError}.
|
|
34
|
+
*
|
|
35
|
+
* ## Errors
|
|
36
|
+
*
|
|
37
|
+
* When the remote system answers `AE`, `AR`, `CE`, or `CR`, `send()` rejects
|
|
38
|
+
* with the matching `@glion/ack` exception and the connection stays open.
|
|
39
|
+
*/
|
|
40
|
+
export declare class MllpClient extends MllpClientEmitter {
|
|
41
|
+
#private;
|
|
42
|
+
/**
|
|
43
|
+
* @throws {MllpInvalidOptionError} A timeout, byte cap, or attempt count is
|
|
44
|
+
* out of range.
|
|
45
|
+
*/
|
|
46
|
+
constructor(opts: MllpClientOptions);
|
|
47
|
+
/**
|
|
48
|
+
* The current phase: `idle`, `connecting`, `connected`, `sending`,
|
|
49
|
+
* `closing`, or `closed`.
|
|
50
|
+
*/
|
|
51
|
+
get state(): MllpClientState;
|
|
52
|
+
/** How many sends wait their turn, the one in flight excluded. */
|
|
53
|
+
get pending(): number;
|
|
54
|
+
/** Whether the connection is open. True in both `connected` and `sending`. */
|
|
55
|
+
get connected(): boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Opens the connection ahead of the first `send()`, dialing again under the
|
|
58
|
+
* `reconnect` policy when an attempt fails.
|
|
59
|
+
*
|
|
60
|
+
* Idempotent: a connected client resolves at once, and a call arriving while
|
|
61
|
+
* an attempt is in flight waits for that attempt and shares its outcome.
|
|
62
|
+
*
|
|
63
|
+
* @throws {MllpConnectionFailedError} The last attempt could not open the
|
|
64
|
+
* socket.
|
|
65
|
+
* @throws {MllpConnectionTimeoutError} The last attempt did not open in time.
|
|
66
|
+
* @throws {MllpClientClosedError} The client is closed, or `close()` or
|
|
67
|
+
* `destroy()` arrived while the connection was still being established.
|
|
68
|
+
*/
|
|
69
|
+
connect(): Promise<void>;
|
|
70
|
+
/**
|
|
71
|
+
* Sends one message and returns its acknowledgment. Connects first when the
|
|
72
|
+
* client is not connected yet, and waits for the send in flight, if any,
|
|
73
|
+
* before writing.
|
|
74
|
+
*
|
|
75
|
+
* Sends go out in the order `send()` was called. The queue has no bound.
|
|
76
|
+
* `timeoutMs` runs from the moment the write starts, not from the call. A
|
|
77
|
+
* send still waiting when the client closes rejects with
|
|
78
|
+
* {@link MllpClientClosedError}; one waiting behind a dial that fails
|
|
79
|
+
* rejects with the dial's error, as `connect()` does.
|
|
80
|
+
*
|
|
81
|
+
* Nothing is written when an option, phase, or message error is thrown.
|
|
82
|
+
* Every wire failure also closes the client; a NAK does not.
|
|
83
|
+
*
|
|
84
|
+
* @throws {AckException} The remote system answered with a NAK. The
|
|
85
|
+
* connection stays open.
|
|
86
|
+
* @throws {MllpInvalidOptionError} `timeoutMs` is out of range.
|
|
87
|
+
* @throws {MllpInvalidMessageError} The message cannot be sent as-is.
|
|
88
|
+
* @throws {MllpClientClosedError} The client is closed, or closed while
|
|
89
|
+
* this send was waiting its turn.
|
|
90
|
+
* @throws {MllpConnectionFailedError} The connection could not be opened.
|
|
91
|
+
* @throws {MllpConnectionTimeoutError} The connection did not open in time.
|
|
92
|
+
* @throws {MllpSendTimeoutError} No acknowledgment arrived in time.
|
|
93
|
+
* @throws {MllpConnectionLostError} The connection was lost.
|
|
94
|
+
* @throws {MllpSendAbortedError} `destroy()` cut the send off.
|
|
95
|
+
* @throws {MllpInvalidResponseError} The reply is not a usable
|
|
96
|
+
* acknowledgment of this message.
|
|
97
|
+
*/
|
|
98
|
+
send(message: Root, opts?: MllpSendOptions): Promise<MllpClientResponse>;
|
|
99
|
+
/**
|
|
100
|
+
* Ends the connection once the message in flight is acknowledged, and
|
|
101
|
+
* resolves when it is down. New sends, and sends waiting their turn, are
|
|
102
|
+
* refused from the moment this is called. An attempt to connect stops at
|
|
103
|
+
* once.
|
|
104
|
+
*
|
|
105
|
+
* Resolves from any phase. Never rejects. Idempotent. The wait is bounded by
|
|
106
|
+
* the in-flight send's own deadline; {@link destroy} does not wait at all.
|
|
107
|
+
* If the message it waits for fails, the client closes with that failure;
|
|
108
|
+
* otherwise with `null`.
|
|
109
|
+
*/
|
|
110
|
+
close(): Promise<void>;
|
|
111
|
+
/**
|
|
112
|
+
* Ends the connection now, and resolves when it is down. A message in flight
|
|
113
|
+
* rejects with {@link MllpSendAbortedError}. An attempt to connect stops at
|
|
114
|
+
* once. The client closes with `reason`: the failure it reports on `close`
|
|
115
|
+
* and on every later call, or `null` for the owner's own decision.
|
|
116
|
+
*
|
|
117
|
+
* Resolves from any phase. Never rejects. Idempotent. Sends waiting their
|
|
118
|
+
* turn are rejected with `reason` when its delivery is `not-sent`, and with
|
|
119
|
+
* {@link MllpClientClosedError} carrying `reason` otherwise. Arriving while
|
|
120
|
+
* the client is already closing, it cuts the message in flight and joins
|
|
121
|
+
* the ending under way; `reason` is recorded when no failure is known yet.
|
|
122
|
+
*/
|
|
123
|
+
destroy(reason?: MllpClientError | null): Promise<void>;
|
|
124
|
+
/** Calls {@link close}. Enables `await using`. */
|
|
125
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
126
|
+
}
|
|
127
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAevC,OAAO,EAEL,eAAe,EAIhB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAQ7C,OAAO,KAAK,EACV,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EACf,eAAe,EAEhB,MAAM,SAAS,CAAC;AAEjB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,qBAAa,UAAW,SAAQ,iBAAiB;;IAQ/C;;;OAGG;gBACS,IAAI,EAAE,iBAAiB;IA0BnC;;;OAGG;IACH,IAAI,KAAK,IAAI,eAAe,CAE3B;IAED,kEAAkE;IAClE,IAAI,OAAO,IAAI,MAAM,CAEpB;IAED,8EAA8E;IAC9E,IAAI,SAAS,IAAI,OAAO,CAGvB;IAED;;;;;;;;;;;;OAYG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAiC9B;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACG,IAAI,CACR,OAAO,EAAE,IAAI,EACb,IAAI,GAAE,eAAoB,GACzB,OAAO,CAAC,kBAAkB,CAAC;IA0B9B;;;;;;;;;;OAUG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IA+B5B;;;;;;;;;;;OAWG;IACG,OAAO,CAAC,MAAM,GAAE,eAAe,GAAG,IAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IA0CnE,kDAAkD;IAC5C,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC;CAkJ7C"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The bounds and defaults the client is configured by. Constants only.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
/** Default time to wait for a connection to open, in milliseconds. */
|
|
7
|
+
export declare const DEFAULT_CONNECT_TIMEOUT_MS = 10000;
|
|
8
|
+
/** Default time to wait for an acknowledgment after sending, in milliseconds. */
|
|
9
|
+
export declare const DEFAULT_SEND_TIMEOUT_MS = 30000;
|
|
10
|
+
/** Default maximum bytes buffered while receiving one message (16 MiB). */
|
|
11
|
+
export declare const DEFAULT_MAX_BUFFERED_BYTES: number;
|
|
12
|
+
/**
|
|
13
|
+
* Default number of reconnect attempts after a failed one. With the default
|
|
14
|
+
* delay, the last one starts about 30 seconds after the first failure.
|
|
15
|
+
*/
|
|
16
|
+
export declare const DEFAULT_RECONNECT_ATTEMPTS = 5;
|
|
17
|
+
/**
|
|
18
|
+
* Maximum timeout `setTimeout` supports, in milliseconds (2^31 − 1). Larger
|
|
19
|
+
* values, including `Infinity`, are rejected: the platform would clamp them
|
|
20
|
+
* to about 1 ms.
|
|
21
|
+
*/
|
|
22
|
+
export declare const MAX_TIMEOUT_MS: number;
|
|
23
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,sEAAsE;AACtE,eAAO,MAAM,0BAA0B,QAAS,CAAC;AAEjD,iFAAiF;AACjF,eAAO,MAAM,uBAAuB,QAAS,CAAC;AAE9C,2EAA2E;AAC3E,eAAO,MAAM,0BAA0B,QAAmB,CAAC;AAE3D;;;GAGG;AACH,eAAO,MAAM,0BAA0B,IAAI,CAAC;AAE5C;;;;GAIG;AACH,eAAO,MAAM,cAAc,QAAc,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The base every client error extends, and what each one carries: a fixed
|
|
3
|
+
* `code`, a fixed message, what became of the message, and the lower layer's
|
|
4
|
+
* failure on `cause`.
|
|
5
|
+
*
|
|
6
|
+
* @module
|
|
7
|
+
*/
|
|
8
|
+
export declare const MllpErrorCode: {
|
|
9
|
+
readonly CLOSED: "CLOSED";
|
|
10
|
+
readonly CONNECTION_FAILED: "CONNECTION_FAILED";
|
|
11
|
+
readonly CONNECTION_LOST: "CONNECTION_LOST";
|
|
12
|
+
readonly CONNECTION_TIMEOUT: "CONNECTION_TIMEOUT";
|
|
13
|
+
readonly INVALID_MESSAGE: "INVALID_MESSAGE";
|
|
14
|
+
readonly INVALID_OPTION: "INVALID_OPTION";
|
|
15
|
+
readonly INVALID_RESPONSE: "INVALID_RESPONSE";
|
|
16
|
+
readonly SEND_ABORTED: "SEND_ABORTED";
|
|
17
|
+
readonly SEND_TIMEOUT: "SEND_TIMEOUT";
|
|
18
|
+
};
|
|
19
|
+
export type MllpErrorCode = (typeof MllpErrorCode)[keyof typeof MllpErrorCode];
|
|
20
|
+
/**
|
|
21
|
+
* What became of the message. `not-sent`: nothing reached the wire, and the
|
|
22
|
+
* message may be sent again as it is. `unknown`: it may have reached the
|
|
23
|
+
* remote system, and sending it again may deliver it twice.
|
|
24
|
+
*/
|
|
25
|
+
export type MllpDelivery = "not-sent" | "unknown";
|
|
26
|
+
export declare abstract class MllpClientError extends Error {
|
|
27
|
+
abstract readonly code: MllpErrorCode;
|
|
28
|
+
abstract readonly delivery: MllpDelivery;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=base.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/errors/base.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,eAAO,MAAM,aAAa;;;;;;;;;;CAUhB,CAAC;AAEX,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,OAAO,aAAa,CAAC,CAAC;AAE/E;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG,UAAU,GAAG,SAAS,CAAC;AAElD,8BAAsB,eAAgB,SAAQ,KAAK;IACjD,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IACtC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,EAAE,YAAY,CAAC;CAC1C"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export { MllpClientError, MllpErrorCode } from "./base";
|
|
2
|
+
export type { MllpDelivery } from "./base";
|
|
3
|
+
export { MllpClientClosedError } from "./mllp-client-closed-error";
|
|
4
|
+
export { MllpConnectionFailedError } from "./mllp-connection-failed-error";
|
|
5
|
+
export { MllpConnectionTimeoutError } from "./mllp-connection-timeout-error";
|
|
6
|
+
export { MllpConnectionError } from "./mllp-connection-error";
|
|
7
|
+
export { MllpConnectionLostError } from "./mllp-connection-lost-error";
|
|
8
|
+
export { MllpInvalidMessageError } from "./mllp-invalid-message-error";
|
|
9
|
+
export { MllpInvalidOptionError } from "./mllp-invalid-option-error";
|
|
10
|
+
export { MllpInvalidResponseError } from "./mllp-invalid-response-error";
|
|
11
|
+
export { nakException } from "./nak-exception";
|
|
12
|
+
export { MllpSendAbortedError } from "./mllp-send-aborted-error";
|
|
13
|
+
export { MllpSendTimeoutError } from "./mllp-send-timeout-error";
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACxD,YAAY,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAC3C,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAC7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { MllpClientError } from "./base";
|
|
2
|
+
/**
|
|
3
|
+
* The call cannot be served: the client is closed, by `close()`, by
|
|
4
|
+
* `destroy()`, or by a failure. The failure is on `cause`.
|
|
5
|
+
*/
|
|
6
|
+
export declare class MllpClientClosedError extends MllpClientError {
|
|
7
|
+
readonly name = "MllpClientClosedError";
|
|
8
|
+
readonly code: "CLOSED";
|
|
9
|
+
readonly delivery = "not-sent";
|
|
10
|
+
constructor(cause?: MllpClientError | null);
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=mllp-client-closed-error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mllp-client-closed-error.d.ts","sourceRoot":"","sources":["../../src/errors/mllp-client-closed-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAiB,MAAM,QAAQ,CAAC;AAExD;;;GAGG;AACH,qBAAa,qBAAsB,SAAQ,eAAe;IACxD,SAAkB,IAAI,2BAA2B;IACjD,QAAQ,CAAC,IAAI,WAAwB;IACrC,QAAQ,CAAC,QAAQ,cAAc;gBAEnB,KAAK,GAAE,eAAe,GAAG,IAAW;CAQjD"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { MllpClientError } from "./base";
|
|
2
|
+
/**
|
|
3
|
+
* A failure of the wire: the connection could not be opened, gave no reply in
|
|
4
|
+
* time, or was lost. Raised by the layer that holds the socket; the client
|
|
5
|
+
* relays it unchanged.
|
|
6
|
+
*/
|
|
7
|
+
export declare abstract class MllpConnectionError extends MllpClientError {
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=mllp-connection-error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mllp-connection-error.d.ts","sourceRoot":"","sources":["../../src/errors/mllp-connection-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAEzC;;;;GAIG;AACH,8BAAsB,mBAAoB,SAAQ,eAAe;CAAG"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { MllpConnectionError } from "./mllp-connection-error";
|
|
2
|
+
/**
|
|
3
|
+
* The connection could not be opened: the host was unreachable, refused the
|
|
4
|
+
* connection, or failed DNS or TLS. The socket's error is on `cause`.
|
|
5
|
+
*/
|
|
6
|
+
export declare class MllpConnectionFailedError extends MllpConnectionError {
|
|
7
|
+
readonly name = "MllpConnectionFailedError";
|
|
8
|
+
readonly code: "CONNECTION_FAILED";
|
|
9
|
+
readonly delivery = "not-sent";
|
|
10
|
+
constructor(cause: unknown);
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=mllp-connection-failed-error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mllp-connection-failed-error.d.ts","sourceRoot":"","sources":["../../src/errors/mllp-connection-failed-error.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE9D;;;GAGG;AACH,qBAAa,yBAA0B,SAAQ,mBAAmB;IAChE,SAAkB,IAAI,+BAA+B;IACrD,QAAQ,CAAC,IAAI,sBAAmC;IAChD,QAAQ,CAAC,QAAQ,cAAc;gBAEnB,KAAK,EAAE,OAAO;CAM3B"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { MllpConnectionError } from "./mllp-connection-error";
|
|
2
|
+
/**
|
|
3
|
+
* The connection was lost during a send: the remote system hung up, or the
|
|
4
|
+
* network broke. The remote system may or may not have received the message.
|
|
5
|
+
* A stream error, when there was one, is on `cause`.
|
|
6
|
+
*/
|
|
7
|
+
export declare class MllpConnectionLostError extends MllpConnectionError {
|
|
8
|
+
readonly name = "MllpConnectionLostError";
|
|
9
|
+
readonly code: "CONNECTION_LOST";
|
|
10
|
+
readonly delivery = "unknown";
|
|
11
|
+
constructor(cause?: unknown);
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=mllp-connection-lost-error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mllp-connection-lost-error.d.ts","sourceRoot":"","sources":["../../src/errors/mllp-connection-lost-error.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE9D;;;;GAIG;AACH,qBAAa,uBAAwB,SAAQ,mBAAmB;IAC9D,SAAkB,IAAI,6BAA6B;IACnD,QAAQ,CAAC,IAAI,oBAAiC;IAC9C,QAAQ,CAAC,QAAQ,aAAa;gBAElB,KAAK,CAAC,EAAE,OAAO;CAM5B"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { MllpConnectionError } from "./mllp-connection-error";
|
|
2
|
+
/**
|
|
3
|
+
* The remote system did not accept the connection within `connectTimeoutMs`.
|
|
4
|
+
* The host may be down, overloaded, or silently dropping packets.
|
|
5
|
+
*/
|
|
6
|
+
export declare class MllpConnectionTimeoutError extends MllpConnectionError {
|
|
7
|
+
readonly name = "MllpConnectionTimeoutError";
|
|
8
|
+
readonly code: "CONNECTION_TIMEOUT";
|
|
9
|
+
readonly delivery = "not-sent";
|
|
10
|
+
readonly timeoutMs: number;
|
|
11
|
+
constructor(timeoutMs: number);
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=mllp-connection-timeout-error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mllp-connection-timeout-error.d.ts","sourceRoot":"","sources":["../../src/errors/mllp-connection-timeout-error.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE9D;;;GAGG;AACH,qBAAa,0BAA2B,SAAQ,mBAAmB;IACjE,SAAkB,IAAI,gCAAgC;IACtD,QAAQ,CAAC,IAAI,uBAAoC;IACjD,QAAQ,CAAC,QAAQ,cAAc;IAC/B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;gBAEf,SAAS,EAAE,MAAM;CAM9B"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { MllpClientError } from "./base";
|
|
2
|
+
/**
|
|
3
|
+
* The message cannot be sent as-is: it has no MSH-10 control ID, it could not
|
|
4
|
+
* be serialized, or it contains a byte MLLP reserves. Nothing was written; the
|
|
5
|
+
* reason is on `cause`. Fix the message and send again.
|
|
6
|
+
*/
|
|
7
|
+
export declare class MllpInvalidMessageError extends MllpClientError {
|
|
8
|
+
readonly name = "MllpInvalidMessageError";
|
|
9
|
+
readonly code: "INVALID_MESSAGE";
|
|
10
|
+
readonly delivery = "not-sent";
|
|
11
|
+
constructor(cause: unknown);
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=mllp-invalid-message-error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mllp-invalid-message-error.d.ts","sourceRoot":"","sources":["../../src/errors/mllp-invalid-message-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAiB,MAAM,QAAQ,CAAC;AAExD;;;;GAIG;AACH,qBAAa,uBAAwB,SAAQ,eAAe;IAC1D,SAAkB,IAAI,6BAA6B;IACnD,QAAQ,CAAC,IAAI,oBAAiC;IAC9C,QAAQ,CAAC,QAAQ,cAAc;gBAEnB,KAAK,EAAE,OAAO;CAM3B"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { MllpClientError } from "./base";
|
|
2
|
+
/** An option is out of range. Raised before anything happens. */
|
|
3
|
+
export declare class MllpInvalidOptionError extends MllpClientError {
|
|
4
|
+
readonly name = "MllpInvalidOptionError";
|
|
5
|
+
readonly code: "INVALID_OPTION";
|
|
6
|
+
readonly delivery = "not-sent";
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=mllp-invalid-option-error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mllp-invalid-option-error.d.ts","sourceRoot":"","sources":["../../src/errors/mllp-invalid-option-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAiB,MAAM,QAAQ,CAAC;AAExD,iEAAiE;AACjE,qBAAa,sBAAuB,SAAQ,eAAe;IACzD,SAAkB,IAAI,4BAA4B;IAClD,QAAQ,CAAC,IAAI,mBAAgC;IAC7C,QAAQ,CAAC,QAAQ,cAAc;CAChC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { MllpClientError } from "./base";
|
|
2
|
+
/**
|
|
3
|
+
* The reply was not a usable acknowledgment of the message that was waiting:
|
|
4
|
+
* it could not be decoded, its acknowledgment code was missing or unknown, or
|
|
5
|
+
* it answered a different message. The connection is ended. The reason is on
|
|
6
|
+
* `cause`.
|
|
7
|
+
*/
|
|
8
|
+
export declare class MllpInvalidResponseError extends MllpClientError {
|
|
9
|
+
readonly name = "MllpInvalidResponseError";
|
|
10
|
+
readonly code: "INVALID_RESPONSE";
|
|
11
|
+
readonly delivery = "unknown";
|
|
12
|
+
/** MSH-10 of the message that was waiting, when the thrower knew it. */
|
|
13
|
+
readonly controlId?: string;
|
|
14
|
+
constructor(cause: unknown, controlId?: string);
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=mllp-invalid-response-error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mllp-invalid-response-error.d.ts","sourceRoot":"","sources":["../../src/errors/mllp-invalid-response-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAiB,MAAM,QAAQ,CAAC;AAExD;;;;;GAKG;AACH,qBAAa,wBAAyB,SAAQ,eAAe;IAC3D,SAAkB,IAAI,8BAA8B;IACpD,QAAQ,CAAC,IAAI,qBAAkC;IAC/C,QAAQ,CAAC,QAAQ,aAAa;IAC9B,wEAAwE;IACxE,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;gBAEhB,KAAK,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,MAAM;CAO/C"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { MllpClientError } from "./base";
|
|
2
|
+
/**
|
|
3
|
+
* `destroy()` cut off the message in flight. The remote system may or may not
|
|
4
|
+
* have received it.
|
|
5
|
+
*/
|
|
6
|
+
export declare class MllpSendAbortedError extends MllpClientError {
|
|
7
|
+
readonly name = "MllpSendAbortedError";
|
|
8
|
+
readonly code: "SEND_ABORTED";
|
|
9
|
+
readonly delivery = "unknown";
|
|
10
|
+
constructor();
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=mllp-send-aborted-error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mllp-send-aborted-error.d.ts","sourceRoot":"","sources":["../../src/errors/mllp-send-aborted-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAiB,MAAM,QAAQ,CAAC;AAExD;;;GAGG;AACH,qBAAa,oBAAqB,SAAQ,eAAe;IACvD,SAAkB,IAAI,0BAA0B;IAChD,QAAQ,CAAC,IAAI,iBAA8B;IAC3C,QAAQ,CAAC,QAAQ,aAAa;;CAO/B"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { MllpConnectionError } from "./mllp-connection-error";
|
|
2
|
+
/**
|
|
3
|
+
* No acknowledgment arrived within the send timeout. The connection is ended.
|
|
4
|
+
* Whether the remote system received the message is unknown.
|
|
5
|
+
*/
|
|
6
|
+
export declare class MllpSendTimeoutError extends MllpConnectionError {
|
|
7
|
+
readonly name = "MllpSendTimeoutError";
|
|
8
|
+
readonly code: "SEND_TIMEOUT";
|
|
9
|
+
readonly delivery = "unknown";
|
|
10
|
+
readonly timeoutMs: number;
|
|
11
|
+
constructor(timeoutMs: number);
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=mllp-send-timeout-error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mllp-send-timeout-error.d.ts","sourceRoot":"","sources":["../../src/errors/mllp-send-timeout-error.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE9D;;;GAGG;AACH,qBAAa,oBAAqB,SAAQ,mBAAmB;IAC3D,SAAkB,IAAI,0BAA0B;IAChD,QAAQ,CAAC,IAAI,iBAA8B;IAC3C,QAAQ,CAAC,QAAQ,aAAa;IAC9B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;gBAEf,SAAS,EAAE,MAAM;CAM9B"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The exception a NAK carries. Not an {@link MllpClientError}: the remote
|
|
3
|
+
* system understood the message and refused it, and the class is the one
|
|
4
|
+
* `@glion/ack` defines for that MSA-1 code.
|
|
5
|
+
*
|
|
6
|
+
* @module
|
|
7
|
+
*/
|
|
8
|
+
import type { AckException, AckNakCode } from "@glion/ack";
|
|
9
|
+
import type { Root } from "@glion/ast";
|
|
10
|
+
/**
|
|
11
|
+
* The exception a NAK of `code` carries, read from `tree`.
|
|
12
|
+
*
|
|
13
|
+
* `code` picks the class; MSA-2 gives `controlId`, ERR-3 `errorCode`, ERR-4
|
|
14
|
+
* `severity`, and MSA-3 (or ERR-8) `text`.
|
|
15
|
+
*/
|
|
16
|
+
export declare function nakException(tree: Root, code: AckNakCode): AckException;
|
|
17
|
+
//# sourceMappingURL=nak-exception.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nak-exception.d.ts","sourceRoot":"","sources":["../../src/errors/nak-exception.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AASH,OAAO,KAAK,EAAE,YAAY,EAAuB,UAAU,EAAE,MAAM,YAAY,CAAC;AAChF,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AA8BvC;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,GAAG,YAAY,CASvE"}
|
package/dist/events.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a client reports as it runs, and the listeners that receive it.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import type { MllpClientError } from "./errors";
|
|
7
|
+
export interface MllpClientEvents {
|
|
8
|
+
/** The connection is open and ready for messages. */
|
|
9
|
+
connect(): void;
|
|
10
|
+
/**
|
|
11
|
+
* The connection is down and the client will not connect again. `error` is
|
|
12
|
+
* the failure that closed it, or `null` when the owner did.
|
|
13
|
+
*/
|
|
14
|
+
close(error: MllpClientError | null): void;
|
|
15
|
+
}
|
|
16
|
+
/** The name of one thing a client reports. */
|
|
17
|
+
export type MllpClientEvent = keyof MllpClientEvents;
|
|
18
|
+
/** A listener for `event`. */
|
|
19
|
+
export type MllpClientListener<E extends MllpClientEvent> = MllpClientEvents[E];
|
|
20
|
+
/**
|
|
21
|
+
* The listeners of a client.
|
|
22
|
+
*
|
|
23
|
+
* A listener that throws propagates to whoever triggered the event, the same
|
|
24
|
+
* as Node's `EventEmitter`.
|
|
25
|
+
*/
|
|
26
|
+
export declare abstract class MllpClientEmitter {
|
|
27
|
+
#private;
|
|
28
|
+
/** Adds a listener for `event`, and returns the client so calls chain. */
|
|
29
|
+
on<E extends MllpClientEvent>(event: E, listener: MllpClientListener<E>): this;
|
|
30
|
+
/** Removes a listener added with {@link on}. */
|
|
31
|
+
off<E extends MllpClientEvent>(event: E, listener: MllpClientListener<E>): this;
|
|
32
|
+
/** Calls every listener for `event`, in the order they were added. */
|
|
33
|
+
protected emit<E extends MllpClientEvent>(event: E, ...args: Parameters<MllpClientEvents[E]>): void;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAEhD,MAAM,WAAW,gBAAgB;IAC/B,qDAAqD;IACrD,OAAO,IAAI,IAAI,CAAC;IAChB;;;OAGG;IACH,KAAK,CAAC,KAAK,EAAE,eAAe,GAAG,IAAI,GAAG,IAAI,CAAC;CAC5C;AAED,8CAA8C;AAC9C,MAAM,MAAM,eAAe,GAAG,MAAM,gBAAgB,CAAC;AAErD,8BAA8B;AAC9B,MAAM,MAAM,kBAAkB,CAAC,CAAC,SAAS,eAAe,IAAI,gBAAgB,CAAC,CAAC,CAAC,CAAC;AAEhF;;;;;GAKG;AACH,8BAAsB,iBAAiB;;IAMrC,0EAA0E;IAC1E,EAAE,CAAC,CAAC,SAAS,eAAe,EAC1B,KAAK,EAAE,CAAC,EACR,QAAQ,EAAE,kBAAkB,CAAC,CAAC,CAAC,GAC9B,IAAI;IAOP,gDAAgD;IAChD,GAAG,CAAC,CAAC,SAAS,eAAe,EAC3B,KAAK,EAAE,CAAC,EACR,QAAQ,EAAE,kBAAkB,CAAC,CAAC,CAAC,GAC9B,IAAI;IAKP,sEAAsE;IACtE,SAAS,CAAC,IAAI,CAAC,CAAC,SAAS,eAAe,EACtC,KAAK,EAAE,CAAC,EACR,GAAG,IAAI,EAAE,UAAU,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,GACvC,IAAI;CAKR"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,27 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* `@glion/mllp-client` — persistent MLLP client for HL7v2.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* One socket to one remote system, one message on the wire at a time.
|
|
5
|
+
* `send()` takes a parsed `Root`, writes it, and resolves with the
|
|
6
|
+
* acknowledgment that answers it. A NAK (`AE`, `AR`, `CE`, `CR`) rejects with
|
|
7
|
+
* the matching `@glion/ack` exception — the same type the server raises.
|
|
8
8
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* - Deno: `@glion/mllp-client/deno`
|
|
12
|
-
* - Cloudflare Workers: `@glion/mllp-client/workers`
|
|
13
|
-
* - Custom transport / browser via a bridge: `@glion/mllp-client/core`
|
|
14
|
-
*
|
|
15
|
-
* Bundlers that honour the `workerd` and `deno` keys in this
|
|
16
|
-
* package's `exports` map will automatically pick the right entry
|
|
17
|
-
* for the target runtime — the per-runtime subpaths are also
|
|
18
|
-
* available as explicit imports for clarity.
|
|
9
|
+
* Runtime adapters implement {@link MllpSocket}; the Node adapter is in
|
|
10
|
+
* `@glion/mllp-client/node`.
|
|
19
11
|
*
|
|
20
12
|
* @module
|
|
21
13
|
*/
|
|
22
|
-
export
|
|
23
|
-
export
|
|
24
|
-
export {
|
|
25
|
-
export {
|
|
26
|
-
export
|
|
14
|
+
export { MllpClient } from "./client";
|
|
15
|
+
export { MllpClientEmitter } from "./events";
|
|
16
|
+
export type { MllpClientEvent, MllpClientEvents, MllpClientListener, } from "./events";
|
|
17
|
+
export type { MllpClientOptions, MllpClientResponse, MllpClientState, MllpReconnectOptions, MllpSendOptions, MllpSocket, MllpStreams, } from "./types";
|
|
18
|
+
export { MllpClientClosedError, MllpClientError, MllpConnectionError, MllpConnectionFailedError, MllpConnectionLostError, MllpConnectionTimeoutError, MllpErrorCode, MllpInvalidMessageError, MllpInvalidOptionError, MllpInvalidResponseError, MllpSendAbortedError, MllpSendTimeoutError, } from "./errors";
|
|
19
|
+
export type { MllpDelivery } from "./errors";
|
|
27
20
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC7C,YAAY,EACV,eAAe,EACf,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,UAAU,CAAC;AAClB,YAAY,EACV,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EACf,oBAAoB,EACpB,eAAe,EACf,UAAU,EACV,WAAW,GACZ,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,qBAAqB,EACrB,eAAe,EACf,mBAAmB,EACnB,yBAAyB,EACzB,uBAAuB,EACvB,0BAA0B,EAC1B,aAAa,EACb,uBAAuB,EACvB,sBAAsB,EACtB,wBAAwB,EACxB,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,UAAU,CAAC;AAClB,YAAY,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC"}
|