@cosyte/mllp 0.1.11 → 0.1.13

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/dist/index.cjs CHANGED
@@ -4,6 +4,7 @@ var tls = require('tls');
4
4
  var events = require('events');
5
5
  var crypto = require('crypto');
6
6
  var net = require('net');
7
+ var util = require('util');
7
8
 
8
9
  // src/framing/registry.ts
9
10
  function createWarning(code, byteOffset, message) {
@@ -646,13 +647,23 @@ var MLLP_BIND_ALL_INTERFACES = "MLLP_BIND_ALL_INTERFACES";
646
647
  var MLLP_TLS_CIPHER_LIST_REJECTED = "MLLP_TLS_CIPHER_LIST_REJECTED";
647
648
  var MLLP_TLS_CIPHER_OPTION_CONFLICT = "MLLP_TLS_CIPHER_OPTION_CONFLICT";
648
649
  var MLLP_TLS_DH_PARAMETERS_REJECTED = "MLLP_TLS_DH_PARAMETERS_REJECTED";
649
- var TLS_CONFIGURATION_MESSAGES = Object.freeze({
650
- [MLLP_TLS_CIPHER_LIST_REJECTED]: "the TLS library rejected the configured cipher-suite list; no connection was opened and no fallback to the runtime default list was made",
651
- [MLLP_TLS_CIPHER_OPTION_CONFLICT]: "tls.atnaTransportSecurity and tls.ciphers both declare the offered cipher-suite list; set exactly one of them",
652
- [MLLP_TLS_DH_PARAMETERS_REJECTED]: "the configured ephemeral Diffie-Hellman parameters are not usable; nothing was bound and no fallback to a server without Diffie-Hellman parameters was made"
653
- });
650
+ var MLLP_TLS_CIPHER_LIST_UNENFORCEABLE = "MLLP_TLS_CIPHER_LIST_UNENFORCEABLE";
651
+ var MLLP_TLS_DH_PARAMETERS_UNENFORCEABLE = "MLLP_TLS_DH_PARAMETERS_UNENFORCEABLE";
652
+ var MLLP_TLS_PFX_REJECTED = "MLLP_TLS_PFX_REJECTED";
653
+ var MLLP_TLS_CREDENTIAL_CONFLICT = "MLLP_TLS_CREDENTIAL_CONFLICT";
654
+ var MLLP_TLS_OPTIONS_NOT_AN_OBJECT = "MLLP_TLS_OPTIONS_NOT_AN_OBJECT";
654
655
  function tlsConfigurationMessage(code) {
655
- return TLS_CONFIGURATION_MESSAGES[code];
656
+ const messages = {
657
+ [MLLP_TLS_CIPHER_LIST_REJECTED]: "the TLS library rejected the configured cipher-suite list; no connection was opened and no fallback to the runtime default list was made",
658
+ [MLLP_TLS_CIPHER_OPTION_CONFLICT]: "tls.atnaTransportSecurity and tls.ciphers both declare the offered cipher-suite list; set exactly one of them",
659
+ [MLLP_TLS_DH_PARAMETERS_REJECTED]: "the configured ephemeral Diffie-Hellman parameters are not usable; nothing was bound and no fallback to a server without Diffie-Hellman parameters was made",
660
+ [MLLP_TLS_CIPHER_LIST_UNENFORCEABLE]: "this runtime's TLS library does not enforce a configured cipher-suite list; no connection was opened, rather than one offering a list other than the one configured",
661
+ [MLLP_TLS_DH_PARAMETERS_UNENFORCEABLE]: "this runtime's TLS library does not enforce server Diffie-Hellman parameters; nothing was bound, rather than a server running without the parameters configured",
662
+ [MLLP_TLS_PFX_REJECTED]: "tls.pfx could not be loaded with tls.passphrase: the passphrase is wrong, the file is not PKCS#12, or it uses a legacy encryption (RC2-40, as `openssl pkcs12 -export -legacy` and older exports write it) that OpenSSL 3 does not load, so re-export it with AES-256; no socket was opened",
663
+ [MLLP_TLS_CREDENTIAL_CONFLICT]: "tls.pfx was set together with tls.cert or tls.key; the PKCS#12 file carries its own certificate and key, so set either cert and key or pfx, not both",
664
+ [MLLP_TLS_OPTIONS_NOT_AN_OBJECT]: "tls must be an object of TLS options, or true for a client's defaults; it was null, an array, another kind of object or a value that is no object, and no client or server was created"
665
+ };
666
+ return messages[code];
656
667
  }
657
668
  var MllpTlsConfigurationError = class _MllpTlsConfigurationError extends Error {
658
669
  name = "MllpTlsConfigurationError";
@@ -662,7 +673,8 @@ var MllpTlsConfigurationError = class _MllpTlsConfigurationError extends Error {
662
673
  */
663
674
  code;
664
675
  /**
665
- * The TLS library's own error, when the runtime is what refused the list.
676
+ * The TLS library's own error, when the runtime is what refused the input
677
+ * (or, for an `_UNENFORCEABLE` code, refused one of the probes).
666
678
  * `undefined` when this package refused the configuration itself.
667
679
  */
668
680
  cause;
@@ -826,6 +838,47 @@ var ATNA_CIPHER_LIST = [
826
838
  ...TLS13_DEFAULT_CIPHER_SUITES,
827
839
  ...ATNA_CIPHER_SUITES
828
840
  ].join(":");
841
+ function refusalOf(options) {
842
+ try {
843
+ tls.createSecureContext(options);
844
+ } catch (err) {
845
+ return err instanceof Error ? err : new Error(String(err));
846
+ }
847
+ return null;
848
+ }
849
+ var probeResults = /* @__PURE__ */ new Map();
850
+ function probeRefusal(probe) {
851
+ const key = "ciphers" in probe ? `ciphers=${probe.ciphers}` : `dhparam=${probe.dhparam}`;
852
+ const found = probeResults.get(key);
853
+ if (found !== void 0) return found;
854
+ const refusal = refusalOf(probe);
855
+ probeResults.set(key, refusal);
856
+ return refusal;
857
+ }
858
+ function assertCipherListEnforced(atna) {
859
+ if (probeRefusal({ ciphers: "ECDHE-RSA-AES128-GCM-SHA256:!ECDHE-RSA-AES128-GCM-SHA256" }) === null) {
860
+ throw new MllpTlsConfigurationError(MLLP_TLS_CIPHER_LIST_UNENFORCEABLE);
861
+ }
862
+ if (!atna) return;
863
+ for (const suite of ATNA_CIPHER_SUITES) {
864
+ const refusal = probeRefusal({ ciphers: suite });
865
+ if (refusal !== null) {
866
+ throw new MllpTlsConfigurationError(MLLP_TLS_CIPHER_LIST_UNENFORCEABLE, { cause: refusal });
867
+ }
868
+ }
869
+ }
870
+ function assertDhParametersEnforced() {
871
+ const autoRefusal = probeRefusal({ dhparam: "auto" });
872
+ if (autoRefusal !== null) {
873
+ throw new MllpTlsConfigurationError(MLLP_TLS_DH_PARAMETERS_UNENFORCEABLE, {
874
+ cause: autoRefusal
875
+ });
876
+ }
877
+ const undersized = "-----BEGIN DH PARAMETERS-----\nMAYCARcCAQU=\n-----END DH PARAMETERS-----\n";
878
+ if (probeRefusal({ dhparam: undersized }) === null) {
879
+ throw new MllpTlsConfigurationError(MLLP_TLS_DH_PARAMETERS_UNENFORCEABLE);
880
+ }
881
+ }
829
882
  function assertUsableDhParameters(dhParameters) {
830
883
  if (!isDhParametersPem(dhParameters)) {
831
884
  throw new MllpTlsConfigurationError(MLLP_TLS_DH_PARAMETERS_REJECTED);
@@ -850,7 +903,9 @@ function resolveTlsCipherPolicy(opts, side) {
850
903
  const supplied = side === "server" ? opts.dhParameters : void 0;
851
904
  if (supplied !== void 0) assertUsableDhParameters(supplied);
852
905
  const dhparam = supplied ?? (atna && side === "server" ? "auto" : void 0);
906
+ if (dhparam !== void 0) assertDhParametersEnforced();
853
907
  if (ciphers !== void 0) {
908
+ assertCipherListEnforced(atna);
854
909
  try {
855
910
  tls.createSecureContext({ ciphers });
856
911
  } catch (err) {
@@ -874,14 +929,23 @@ function readNegotiatedTlsParameters(socket, host, port) {
874
929
  const cipher = socket.getCipher();
875
930
  const cipherSuite = cipher.standardName === "" ? cipher.name : cipher.standardName;
876
931
  if (cipherSuite === "") return null;
932
+ const keyExchangeGroup = readKeyExchangeGroup(socket);
877
933
  return Object.freeze({
878
934
  protocolVersion,
879
935
  cipherSuite,
936
+ ...keyExchangeGroup === void 0 ? {} : { keyExchangeGroup },
880
937
  host,
881
938
  port,
882
939
  timestamp: /* @__PURE__ */ new Date()
883
940
  });
884
941
  }
942
+ function readKeyExchangeGroup(socket) {
943
+ if (typeof socket.getEphemeralKeyInfo !== "function") return void 0;
944
+ const info = socket.getEphemeralKeyInfo();
945
+ if (typeof info !== "object" || info === null || !("name" in info)) return void 0;
946
+ const { name } = info;
947
+ return typeof name === "string" && name !== "" ? name : void 0;
948
+ }
885
949
 
886
950
  // src/connection/error.ts
887
951
  var MllpConnectionError = class _MllpConnectionError extends Error {
@@ -1373,6 +1437,65 @@ var Connection = class extends events.EventEmitter {
1373
1437
  });
1374
1438
  }
1375
1439
  };
1440
+ function checkCredentialMix(tls) {
1441
+ if (typeof tls !== "object" || tls.pfx === void 0) return;
1442
+ if (tls.cert !== void 0 || tls.key !== void 0) {
1443
+ throw new MllpTlsConfigurationError(MLLP_TLS_CREDENTIAL_CONFLICT);
1444
+ }
1445
+ }
1446
+ function pfxRefusal(pfx, passphrase) {
1447
+ if (pfx === void 0) return void 0;
1448
+ try {
1449
+ tls.createSecureContext({ pfx, passphrase });
1450
+ return void 0;
1451
+ } catch (err) {
1452
+ return new MllpTlsConfigurationError(MLLP_TLS_PFX_REJECTED, { cause: err });
1453
+ }
1454
+ }
1455
+ function checkPfx(pfx, passphrase) {
1456
+ const refusal = pfxRefusal(pfx, passphrase);
1457
+ if (refusal !== void 0) throw refusal;
1458
+ }
1459
+ function tlsOptionNames() {
1460
+ const names = {
1461
+ ca: "ca",
1462
+ cert: "cert",
1463
+ key: "key",
1464
+ passphrase: "passphrase",
1465
+ pfx: "pfx",
1466
+ servername: "servername",
1467
+ minVersion: "minVersion",
1468
+ maxVersion: "maxVersion",
1469
+ atnaTransportSecurity: "atnaTransportSecurity",
1470
+ ciphers: "ciphers",
1471
+ allowUnverified: "allowUnverified",
1472
+ clientAuth: "clientAuth",
1473
+ dhParameters: "dhParameters"
1474
+ };
1475
+ return Object.values(names);
1476
+ }
1477
+ function copyValue(value) {
1478
+ return ArrayBuffer.isView(value) ? Buffer.from(new Uint8Array(value.buffer, value.byteOffset, value.byteLength)) : value;
1479
+ }
1480
+ function isOptionsObject(value) {
1481
+ if (typeof value !== "object" || value === null) return false;
1482
+ return !(Array.isArray(value) || ArrayBuffer.isView(value) || util.types.isAnyArrayBuffer(value) || util.types.isMap(value) || util.types.isSet(value) || util.types.isDate(value) || util.types.isPromise(value) || util.types.isBoxedPrimitive(value));
1483
+ }
1484
+ function copyTlsOptions(tls) {
1485
+ if (tls === void 0 || tls === true) return tls;
1486
+ const given = tls;
1487
+ if (!isOptionsObject(given)) {
1488
+ throw new MllpTlsConfigurationError(MLLP_TLS_OPTIONS_NOT_AN_OBJECT);
1489
+ }
1490
+ const source = given;
1491
+ const copy = {};
1492
+ for (const name of tlsOptionNames()) {
1493
+ const value = source[name];
1494
+ if (value === void 0) continue;
1495
+ copy[name] = Array.isArray(value) ? value.map(copyValue) : copyValue(value);
1496
+ }
1497
+ return copy;
1498
+ }
1376
1499
 
1377
1500
  // src/internal/control-id.ts
1378
1501
  var ASCII_M = 77;
@@ -1611,6 +1734,9 @@ function trimSpaces(value) {
1611
1734
  while (end > start && value.charAt(end - 1) === SPACE) end--;
1612
1735
  return value.substring(start, end);
1613
1736
  }
1737
+ function readConditionField(raw, delimiters) {
1738
+ return readTableField(raw, delimiters, TABLE_0155);
1739
+ }
1614
1740
  function readTableField(raw, delimiters, table) {
1615
1741
  if (raw === void 0) return { kind: "null", byteLength: 0 };
1616
1742
  const byteLength = raw.length;
@@ -1756,6 +1882,8 @@ var MllpServer = class extends events.EventEmitter {
1756
1882
  _netServer;
1757
1883
  _connections = /* @__PURE__ */ new Set();
1758
1884
  _opts;
1885
+ /** The TLS options as they were at construction; never read `_opts.tls`, which the caller owns. */
1886
+ _tls;
1759
1887
  /** `true` when `ServerOptions.tls` is set, `_netServer` is actually a `tls.Server`. */
1760
1888
  _isTls;
1761
1889
  _listening = false;
@@ -1772,6 +1900,18 @@ var MllpServer = class extends events.EventEmitter {
1772
1900
  _host = null;
1773
1901
  _acceptedTotal = 0;
1774
1902
  _closedTotal = 0;
1903
+ /**
1904
+ * Sockets accepted and not yet closed, counted only when {@link ServerOptions.maxConnections} is
1905
+ * set: the number the cap is compared against.
1906
+ */
1907
+ _openSockets = 0;
1908
+ /** Sockets the connection cap closed at accept, so a runtime's report of them is recognised. */
1909
+ _closedAtAccept = /* @__PURE__ */ new WeakSet();
1910
+ /**
1911
+ * For each socket the connection cap counted, what gives its place back. Released once, however
1912
+ * many times it is called.
1913
+ */
1914
+ _capRelease = /* @__PURE__ */ new WeakMap();
1775
1915
  /** Count of `'tlsClientError'` events since listen(). */
1776
1916
  _tlsClientErrorsTotal = 0;
1777
1917
  /**
@@ -1798,25 +1938,38 @@ var MllpServer = class extends events.EventEmitter {
1798
1938
  "ServerOptions.maxConnections must be a positive integer, or left unset for no cap"
1799
1939
  );
1800
1940
  }
1941
+ const tlsInput = copyTlsOptions(opts.tls);
1942
+ checkCredentialMix(tlsInput);
1943
+ if (tlsInput !== void 0 && tlsInput.pfx === void 0 && (tlsInput.cert === void 0 || tlsInput.key === void 0)) {
1944
+ throw new TypeError("ServerOptions.tls needs cert and key, or pfx");
1945
+ }
1801
1946
  this._opts = opts;
1802
- this._isTls = opts.tls !== void 0;
1947
+ this._tls = tlsInput;
1948
+ this._isTls = tlsInput !== void 0;
1803
1949
  let cipherPolicy = null;
1804
- if (opts.tls !== void 0) {
1950
+ if (tlsInput !== void 0) {
1805
1951
  try {
1806
- cipherPolicy = resolveTlsCipherPolicy(opts.tls, "server");
1952
+ checkPfx(tlsInput.pfx, tlsInput.passphrase);
1953
+ cipherPolicy = resolveTlsCipherPolicy(tlsInput, "server");
1807
1954
  } catch (err) {
1808
1955
  if (!(err instanceof MllpTlsConfigurationError)) throw err;
1809
1956
  this._tlsConfigError = err;
1810
1957
  }
1811
1958
  }
1812
- if (opts.tls !== void 0 && cipherPolicy === null) {
1959
+ if (tlsInput === void 0) {
1813
1960
  this._netServer = net.createServer();
1814
- } else if (opts.tls !== void 0 && cipherPolicy !== null) {
1815
- const tlsOpts = opts.tls;
1961
+ this._netServer.on("connection", (socket) => {
1962
+ this._onSocketAccepted(socket);
1963
+ });
1964
+ } else if (cipherPolicy === null) {
1965
+ this._netServer = net.createServer();
1966
+ } else {
1967
+ const tlsOpts = tlsInput;
1816
1968
  const clientAuth = tlsOpts.clientAuth ?? "NONE";
1817
1969
  const tlsServer = tls.createServer({
1818
1970
  cert: tlsOpts.cert,
1819
1971
  key: tlsOpts.key,
1972
+ pfx: tlsOpts.pfx,
1820
1973
  ...tlsOpts.ca !== void 0 ? { ca: tlsOpts.ca } : {},
1821
1974
  ...tlsOpts.passphrase !== void 0 ? { passphrase: tlsOpts.passphrase } : {},
1822
1975
  minVersion: tlsOpts.minVersion ?? "TLSv1.2",
@@ -1830,6 +1983,7 @@ var MllpServer = class extends events.EventEmitter {
1830
1983
  this._onSocketAccepted(socket);
1831
1984
  });
1832
1985
  tlsServer.on("tlsClientError", (err, socket) => {
1986
+ if (this._closedAtAccept.has(socket)) return;
1833
1987
  this._tlsClientErrorsTotal += 1;
1834
1988
  const nodeErr = err;
1835
1989
  const event = Object.freeze({
@@ -1841,11 +1995,6 @@ var MllpServer = class extends events.EventEmitter {
1841
1995
  });
1842
1996
  this._emitContained("tlsClientError", event);
1843
1997
  });
1844
- } else {
1845
- this._netServer = net.createServer();
1846
- this._netServer.on("connection", (socket) => {
1847
- this._onSocketAccepted(socket);
1848
- });
1849
1998
  }
1850
1999
  this._netServer.on("error", (err) => {
1851
2000
  if (this.listenerCount("error") > 0) {
@@ -1854,26 +2003,67 @@ var MllpServer = class extends events.EventEmitter {
1854
2003
  this.emit("error", err);
1855
2004
  }
1856
2005
  });
1857
- if (maxConnections !== void 0) {
1858
- this._netServer.maxConnections = maxConnections;
1859
- this._netServer.on("drop", (data) => {
1860
- this._onConnectionOverCap(maxConnections, data);
1861
- });
1862
- }
2006
+ if (maxConnections !== void 0) this._gateConnections(maxConnections);
2007
+ }
2008
+ /**
2009
+ * Enforce {@link ServerOptions.maxConnections} by counting sockets here, at accept.
2010
+ *
2011
+ * WHY NOT THE LISTENER'S OWN `maxConnections`. Node's `net.Server` enforces a cap of its own and
2012
+ * reports each refusal on `'drop'`, but that report is the runtime's to make, and Deno's
2013
+ * `node:net` closes the socket without emitting `'drop'` (measured: Deno 2.9.8), so the cap held
2014
+ * and `'connectionRejected'` never fired. Counting here makes the cap and its event a property of
2015
+ * this package on every runtime.
2016
+ *
2017
+ * The gate sits IN FRONT of every `'connection'` listener the server already has, and replaces
2018
+ * them: for a plaintext server that is this class's own accept handler, and for a TLS server it
2019
+ * is the runtime's, which wraps the raw socket and starts the handshake. An over-cap socket is
2020
+ * destroyed before either runs, so it never becomes a `Connection`, costs no handshake, and is
2021
+ * not a `'tlsClientError'`. The count is of open sockets, the number that bounds file
2022
+ * descriptors: a socket counts from accept until its `'close'`, handshake in flight included.
2023
+ *
2024
+ * @param maxConnections - The validated cap.
2025
+ */
2026
+ _gateConnections(maxConnections) {
2027
+ const server = this._netServer;
2028
+ const downstream = server.listeners("connection");
2029
+ server.removeAllListeners("connection");
2030
+ server.on("connection", (socket) => {
2031
+ if (this._openSockets >= maxConnections) {
2032
+ const remoteAddress = socket.remoteAddress ?? null;
2033
+ const remotePort = socket.remotePort ?? null;
2034
+ this._closedAtAccept.add(socket);
2035
+ socket.destroy();
2036
+ this._onConnectionOverCap(maxConnections, remoteAddress, remotePort);
2037
+ return;
2038
+ }
2039
+ this._openSockets += 1;
2040
+ let released = false;
2041
+ const release = () => {
2042
+ if (released) return;
2043
+ released = true;
2044
+ this._openSockets -= 1;
2045
+ };
2046
+ this._capRelease.set(socket, release);
2047
+ try {
2048
+ for (const listener of downstream) listener.call(server, socket);
2049
+ } finally {
2050
+ socket.once("close", release);
2051
+ }
2052
+ });
1863
2053
  }
1864
2054
  /**
1865
- * Report a connection the listener closed at accept because the cap was full.
2055
+ * Report a connection closed at accept because the cap was full.
1866
2056
  *
1867
- * Contained: this runs inside the listener's own 'drop' callback, so a throwing subscriber would
1868
- * otherwise unwind into the accept path. The throw is surfaced on 'error' instead.
2057
+ * Contained: this runs inside the listener's own 'connection' callback, so a throwing subscriber
2058
+ * would otherwise unwind into the accept path. The throw is surfaced on 'error' instead.
1869
2059
  */
1870
- _onConnectionOverCap(maxConnections, data) {
2060
+ _onConnectionOverCap(maxConnections, remoteAddress, remotePort) {
1871
2061
  const event = Object.freeze({
1872
2062
  code: MLLP_CONNECTION_LIMIT_REACHED,
1873
2063
  message: CONNECTION_LIMIT_MESSAGE,
1874
2064
  maxConnections,
1875
- remoteAddress: data?.remoteAddress ?? null,
1876
- remotePort: data?.remotePort ?? null,
2065
+ remoteAddress,
2066
+ remotePort,
1877
2067
  timestamp: /* @__PURE__ */ new Date()
1878
2068
  });
1879
2069
  this._emitContained("connectionRejected", event);
@@ -2243,6 +2433,7 @@ var MllpServer = class extends events.EventEmitter {
2243
2433
  if (this._opts.keepaliveIntervalMs !== void 0) {
2244
2434
  socket.setKeepAlive(true, this._opts.keepaliveIntervalMs);
2245
2435
  }
2436
+ socket.setNoDelay(this._opts.noDelay !== false);
2246
2437
  const transport = this._isTls ? new TlsTransport(socket) : new NetTransport(socket);
2247
2438
  const mergedFraming = {
2248
2439
  ...SERVER_DEFAULT_FRAMING,
@@ -2250,6 +2441,8 @@ var MllpServer = class extends events.EventEmitter {
2250
2441
  };
2251
2442
  const connOpts = this._opts.onWarning !== void 0 ? { transport, framing: mergedFraming, onWarning: this._opts.onWarning } : { transport, framing: mergedFraming };
2252
2443
  const conn = new Connection(connOpts);
2444
+ const release = this._capRelease.get(socket);
2445
+ if (release !== void 0) socket.once("close", release);
2253
2446
  conn.beforeClose = () => Promise.resolve();
2254
2447
  conn.on("error", (errEvent) => {
2255
2448
  this._emitErrorIfListened(errEvent);
@@ -2313,7 +2506,7 @@ var MllpServer = class extends events.EventEmitter {
2313
2506
  }
2314
2507
  }
2315
2508
  );
2316
- const peerCertificate = this._isTls && (this._opts.tls?.clientAuth ?? "NONE") !== "NONE" ? this._extractPeerCertificateSummary(socket) : null;
2509
+ const peerCertificate = (this._tls?.clientAuth ?? "NONE") !== "NONE" ? this._extractPeerCertificateSummary(socket) : null;
2317
2510
  this._emitContained(
2318
2511
  "connection",
2319
2512
  Object.freeze({
@@ -2589,6 +2782,24 @@ async function createStarterServer(opts) {
2589
2782
  return server;
2590
2783
  }
2591
2784
 
2785
+ // src/server/ack-code.ts
2786
+ function selectAckCode(input) {
2787
+ const { outcome } = input;
2788
+ if (outcome !== "AA" && outcome !== "AE" && outcome !== "AR") {
2789
+ throw new RangeError("selectAckCode: outcome must be one of AA, AE or AR");
2790
+ }
2791
+ const delimiters = delimitersFrom(input.encodingCharacters ?? "^~\\&");
2792
+ const accept = readConditionField(input.msh15, delimiters);
2793
+ const application = readConditionField(input.msh16, delimiters);
2794
+ return Object.freeze({
2795
+ code: acceptAckRequested(accept, outcome) ? acceptModeCounterpart(outcome) : outcome,
2796
+ mode: accept.kind === "null" && application.kind === "null" ? "original" : "enhanced",
2797
+ applicationAckRequested: application.kind !== "code" || acceptAckRequested(application, outcome),
2798
+ acceptTypeUnrecognised: accept.kind === "unrecognised",
2799
+ applicationTypeUnrecognised: application.kind === "unrecognised"
2800
+ });
2801
+ }
2802
+
2592
2803
  // src/client/correlator.ts
2593
2804
  var Correlator = class {
2594
2805
  _opts;
@@ -2658,8 +2869,11 @@ var Correlator = class {
2658
2869
  * `twoPhase` is the enhanced-mode state for a send being correlated by control ID.
2659
2870
  * Omitting it (or passing `null`) is what every other send does, and such an entry is
2660
2871
  * settled by the first acknowledgement matched to it, exactly as before.
2872
+ *
2873
+ * `ackTimeoutMs` is this send's own bound on the wait for its acknowledgement. Omitting it
2874
+ * gives the entry the correlator-wide `ackTimeoutMs`.
2661
2875
  */
2662
- enqueue(frame, controlIdOrNull, resolve, reject, twoPhase = null) {
2876
+ enqueue(frame, controlIdOrNull, resolve, reject, twoPhase = null, ackTimeoutMs) {
2663
2877
  if (this._pending.size >= this._opts.maxInFlight) return null;
2664
2878
  const key = this._opts.mode === "controlId" ? controlIdOrNull ?? `__seq-${++this._sendSeq}` : ++this._sendSeq;
2665
2879
  const entry = {
@@ -2668,6 +2882,7 @@ var Correlator = class {
2668
2882
  controlId: controlIdOrNull,
2669
2883
  byteCount: frame.length,
2670
2884
  sentAt: null,
2885
+ ackTimeoutMs: ackTimeoutMs ?? this._opts.ackTimeoutMs,
2671
2886
  resolve,
2672
2887
  reject,
2673
2888
  twoPhase
@@ -2844,7 +3059,7 @@ var Correlator = class {
2844
3059
  return null;
2845
3060
  }
2846
3061
  /**
2847
- * Sweep live entries; expire those past `sentAt + ackTimeoutMs`.
3062
+ * Sweep live entries; expire those past `sentAt` plus their own `ackTimeoutMs`.
2848
3063
  * Fires `onTimeout(entry, elapsedMs)`; entries move to graveyard.
2849
3064
  * Driven externally by `MllpClient`'s periodic sweep tick, Correlator
2850
3065
  * itself owns no timers.
@@ -2856,7 +3071,6 @@ var Correlator = class {
2856
3071
  */
2857
3072
  expireDue(now) {
2858
3073
  const t = now ?? this._opts.now();
2859
- const ackTimeoutMs = this._opts.ackTimeoutMs;
2860
3074
  for (const [key, entry] of this._pending) {
2861
3075
  if (entry.sentAt === null) continue;
2862
3076
  const twoPhase = entry.twoPhase;
@@ -2874,7 +3088,7 @@ var Correlator = class {
2874
3088
  }
2875
3089
  continue;
2876
3090
  }
2877
- if (entry.sentAt + ackTimeoutMs <= t) {
3091
+ if (entry.sentAt + entry.ackTimeoutMs <= t) {
2878
3092
  const elapsed = t - entry.sentAt;
2879
3093
  this._removeExpired(key, entry);
2880
3094
  if (twoPhase !== null) {
@@ -3257,6 +3471,10 @@ function identityOptions(host, servername) {
3257
3471
  }
3258
3472
  var MllpClient = class extends events.EventEmitter {
3259
3473
  _opts;
3474
+ /** The TLS options as they were at construction; never read `_opts.tls`, which the caller owns. */
3475
+ _tls;
3476
+ /** Why `tls.pfx` cannot be loaded, found once at construction; `undefined` when it loads or is unset. */
3477
+ _pfxRefusal;
3260
3478
  _connection = null;
3261
3479
  _socket = null;
3262
3480
  /**
@@ -3321,6 +3539,15 @@ var MllpClient = class extends events.EventEmitter {
3321
3539
  _connectSignal;
3322
3540
  /** Set when close()/destroy()/abort fires; reconnect handler short-circuits. */
3323
3541
  _userClosed = false;
3542
+ /**
3543
+ * The reason passed to the `destroy(reason)` that closed a connection still connecting, `null`
3544
+ * otherwise. The socket hands it back on `'error'`, and `connect()` compares by identity so the
3545
+ * caller's own reason is carried as the cause and never sorted into a TLS `connectionCause`.
3546
+ * Only the call that reaches the socket records it: a later `destroy()` finds the connection
3547
+ * already CLOSED and leaves it alone. Cleared once matched and at the start of `connect()`, so
3548
+ * the client does not keep the caller's object alive.
3549
+ */
3550
+ _destroyReason = null;
3324
3551
  /**
3325
3552
  * Sends parked inside the client with nothing written for them. See {@link ParkedSend}.
3326
3553
  * Every entry removes itself the moment its own wait ends, however it ends.
@@ -3383,6 +3610,10 @@ var MllpClient = class extends events.EventEmitter {
3383
3610
  "ClientOptions.connectTimeoutMs must be an integer from 1 to 2147483647, or left unset for no bound"
3384
3611
  );
3385
3612
  }
3613
+ const tls = copyTlsOptions(opts.tls);
3614
+ checkCredentialMix(tls);
3615
+ this._pfxRefusal = typeof tls === "object" ? pfxRefusal(tls.pfx, tls.passphrase) : void 0;
3616
+ this._tls = tls;
3386
3617
  this._opts = opts;
3387
3618
  this._ackTimeoutMs = opts.ackTimeoutMs ?? 3e4;
3388
3619
  this._applicationAckTimeoutMs = opts.applicationAckTimeoutMs;
@@ -3429,10 +3660,22 @@ var MllpClient = class extends events.EventEmitter {
3429
3660
  * - `MllpConnectionError({ phase: 'connect', connectionCause: 'connect-timeout' })` if
3430
3661
  * {@link ClientOptions.connectTimeoutMs} is set and the TCP connect, or the TLS handshake
3431
3662
  * after it, did not complete in time. The socket is destroyed; nothing was written.
3663
+ * - `MllpConnectionError({ phase: 'connect' })` if {@link MllpClient.destroy} is called while
3664
+ * `connect()` is still connecting, over TCP or TLS, before or during the handshake. Its
3665
+ * `cause` is the reason passed to `destroy(reason)`, as it is, and its message is that
3666
+ * reason's; with no reason the cause is an `Error` whose message is `closed before connect`,
3667
+ * the same as for any socket that closes before connecting with no error. It carries no
3668
+ * `connectionCause` either way: a reason is the caller's own, so one whose message or `code`
3669
+ * reads like a TLS failure (`alert`, `ERR_SSL_*`, `EPROTO`, a certificate code) is never
3670
+ * sorted into `'tls-handshake'` or `'tls-verify'`. The first `destroy()` decides: a second
3671
+ * call before `connect()` settles, with a reason or without one, changes nothing.
3432
3672
  * - `MllpTlsConfigurationError` if the configured cipher-suite list cannot be
3433
- * honoured (the runtime rejects it, or `atnaTransportSecurity` and `ciphers`
3434
- * both declare one). Raised **before** a socket is opened, so nothing is left
3435
- * connected; identify it by `instanceof` plus its stable `code`.
3673
+ * honoured (the runtime rejects it, the runtime does not enforce cipher lists
3674
+ * at all, or `atnaTransportSecurity` and `ciphers` both declare one). Raised
3675
+ * **before** a socket is opened, so nothing is left connected; identify it by
3676
+ * `instanceof` plus its stable `code`.
3677
+ * - `MllpTlsConfigurationError` with `MLLP_TLS_PFX_REJECTED` if `tls.pfx` cannot be loaded
3678
+ * with `tls.passphrase` (see {@link TlsOptions.pfx}), also before a socket is opened.
3436
3679
  *
3437
3680
  * **Dual failure signal on initial connect:** the Connection's transport
3438
3681
  * error handler is attached before this promise's own error listener, so a
@@ -3473,12 +3716,14 @@ var MllpClient = class extends events.EventEmitter {
3473
3716
  if (signal !== void 0) {
3474
3717
  this._captureConnectSignal(signal);
3475
3718
  }
3719
+ this._destroyReason = null;
3476
3720
  return new Promise((resolve, reject) => {
3477
3721
  let aborted = false;
3478
3722
  const { socket, transport } = this._createSocketAndTransport();
3479
3723
  if (this._opts.keepaliveIntervalMs !== void 0) {
3480
3724
  socket.setKeepAlive(true, this._opts.keepaliveIntervalMs);
3481
3725
  }
3726
+ socket.setNoDelay(this._opts.noDelay !== false);
3482
3727
  this._socket = socket;
3483
3728
  const connOpts = this._opts.framing !== void 0 ? { transport, framing: this._opts.framing } : { transport };
3484
3729
  if (this._opts.drainTimeoutMs !== void 0) {
@@ -3486,7 +3731,7 @@ var MllpClient = class extends events.EventEmitter {
3486
3731
  }
3487
3732
  const conn = new Connection(connOpts);
3488
3733
  this._attachConnection(conn);
3489
- const connectEventName = this._opts.tls !== void 0 ? "secureConnect" : "connect";
3734
+ const connectEventName = this._tls !== void 0 ? "secureConnect" : "connect";
3490
3735
  this._armConnectTimeout(socket, connectEventName);
3491
3736
  const cleanup = () => {
3492
3737
  if (signal !== void 0) {
@@ -3494,6 +3739,7 @@ var MllpClient = class extends events.EventEmitter {
3494
3739
  }
3495
3740
  socket.removeListener(connectEventName, onSocketConnect);
3496
3741
  socket.removeListener("error", onSocketError);
3742
+ socket.removeListener("close", onSocketClose);
3497
3743
  };
3498
3744
  const abortHandler = () => {
3499
3745
  aborted = true;
@@ -3518,13 +3764,28 @@ var MllpClient = class extends events.EventEmitter {
3518
3764
  const onSocketError = (err) => {
3519
3765
  if (aborted) return;
3520
3766
  cleanup();
3767
+ if (err === this._destroyReason) {
3768
+ this._destroyReason = null;
3769
+ reject(new MllpConnectionError(err.message, { cause: err, phase: "connect" }));
3770
+ return;
3771
+ }
3521
3772
  reject(this._wrapConnectError(err, "connect"));
3522
3773
  };
3774
+ const onSocketClose = () => {
3775
+ cleanup();
3776
+ reject(
3777
+ new MllpConnectionError("connection closed before it was established", {
3778
+ cause: new Error("closed before connect"),
3779
+ phase: "connect"
3780
+ })
3781
+ );
3782
+ };
3523
3783
  if (signal !== void 0) {
3524
3784
  signal.addEventListener("abort", abortHandler, { once: true });
3525
3785
  }
3526
3786
  socket.once(connectEventName, onSocketConnect);
3527
3787
  socket.once("error", onSocketError);
3788
+ socket.once("close", onSocketClose);
3528
3789
  });
3529
3790
  }
3530
3791
  /**
@@ -3540,13 +3801,14 @@ var MllpClient = class extends events.EventEmitter {
3540
3801
  * against it.
3541
3802
  */
3542
3803
  _createSocketAndTransport() {
3543
- const tlsOpt = this._opts.tls;
3804
+ const tlsOpt = this._tls;
3544
3805
  if (tlsOpt === void 0) {
3545
3806
  const socket2 = net.createConnection({ host: this._opts.host, port: this._opts.port });
3546
3807
  return { socket: socket2, transport: new NetTransport(socket2) };
3547
3808
  }
3548
3809
  const tlsOpts = tlsOpt === true ? {} : tlsOpt;
3549
3810
  const cipherPolicy = resolveTlsCipherPolicy(tlsOpts, "client");
3811
+ if (this._pfxRefusal !== void 0) throw this._pfxRefusal;
3550
3812
  const socket = tls.connect({
3551
3813
  host: this._opts.host,
3552
3814
  port: this._opts.port,
@@ -3555,6 +3817,7 @@ var MllpClient = class extends events.EventEmitter {
3555
3817
  ...tlsOpts.cert !== void 0 ? { cert: tlsOpts.cert } : {},
3556
3818
  ...tlsOpts.key !== void 0 ? { key: tlsOpts.key } : {},
3557
3819
  ...tlsOpts.passphrase !== void 0 ? { passphrase: tlsOpts.passphrase } : {},
3820
+ pfx: tlsOpts.pfx,
3558
3821
  minVersion: tlsOpts.minVersion ?? "TLSv1.2",
3559
3822
  ...tlsOpts.maxVersion !== void 0 ? { maxVersion: tlsOpts.maxVersion } : {},
3560
3823
  ...cipherPolicy,
@@ -3606,7 +3869,7 @@ var MllpClient = class extends events.EventEmitter {
3606
3869
  connectionCause: "connect-timeout"
3607
3870
  });
3608
3871
  }
3609
- if (this._opts.tls === void 0) {
3872
+ if (this._tls === void 0) {
3610
3873
  return new MllpConnectionError(err.message, { cause: err, phase });
3611
3874
  }
3612
3875
  const code = err.code;
@@ -3715,7 +3978,7 @@ var MllpClient = class extends events.EventEmitter {
3715
3978
  * connections or when verification is on.
3716
3979
  */
3717
3980
  _emitInsecureWarningIfNeeded() {
3718
- const tlsOpt = this._opts.tls;
3981
+ const tlsOpt = this._tls;
3719
3982
  if (tlsOpt === void 0 || tlsOpt === true) return;
3720
3983
  if (tlsOpt.allowUnverified !== true) return;
3721
3984
  const message = "MLLP TLS certificate verification is DISABLED (allowUnverified: true), this connection does not authenticate the peer.";
@@ -3740,7 +4003,7 @@ var MllpClient = class extends events.EventEmitter {
3740
4003
  * built at handshake-completion time, before any HL7 byte crosses the link.
3741
4004
  */
3742
4005
  _emitNegotiatedTlsParameters(socket) {
3743
- if (this._opts.tls === void 0) return;
4006
+ if (this._tls === void 0) return;
3744
4007
  const params = readNegotiatedTlsParameters(socket, this._opts.host, this._opts.port);
3745
4008
  if (params === null) return;
3746
4009
  this._emitContained("tlsNegotiated", params);
@@ -3983,7 +4246,7 @@ var MllpClient = class extends events.EventEmitter {
3983
4246
  }
3984
4247
  }
3985
4248
  }
3986
- const tlsProtocolShaped = this._opts.tls !== void 0 && isTlsProtocolError(err);
4249
+ const tlsProtocolShaped = this._tls !== void 0 && isTlsProtocolError(err);
3987
4250
  const classifiedAs = !tlsProtocolShaped && isTransientConnectionError(err) ? "transient" : "permanent";
3988
4251
  if (classifiedAs === "permanent") {
3989
4252
  this._userClosed = true;
@@ -4086,6 +4349,7 @@ var MllpClient = class extends events.EventEmitter {
4086
4349
  if (this._opts.keepaliveIntervalMs !== void 0) {
4087
4350
  socket.setKeepAlive(true, this._opts.keepaliveIntervalMs);
4088
4351
  }
4352
+ socket.setNoDelay(this._opts.noDelay !== false);
4089
4353
  this._socket = socket;
4090
4354
  const connOpts = this._opts.framing !== void 0 ? { transport, framing: this._opts.framing } : { transport };
4091
4355
  if (this._opts.drainTimeoutMs !== void 0) {
@@ -4097,7 +4361,7 @@ var MllpClient = class extends events.EventEmitter {
4097
4361
  this._emitInsecureWarningIfNeeded();
4098
4362
  this._emitNegotiatedTlsParameters(socket);
4099
4363
  };
4100
- const connectEventName = this._opts.tls !== void 0 ? "secureConnect" : "connect";
4364
+ const connectEventName = this._tls !== void 0 ? "secureConnect" : "connect";
4101
4365
  this._armConnectTimeout(socket, connectEventName);
4102
4366
  socket.once("error", (sErr) => {
4103
4367
  if (this._lastError === null || this._lastError.message !== sErr.message) {
@@ -4274,8 +4538,8 @@ var MllpClient = class extends events.EventEmitter {
4274
4538
  *
4275
4539
  * Resolves with the ACK Buffer (framing stripped). Rejects with:
4276
4540
  * - `DOMException('Aborted', 'AbortError')` if `signal` aborts before the ACK.
4277
- * - `MllpTimeoutError` if no ACK arrives within `ackTimeoutMs`.
4278
- * The clock starts at the underlying `write()` flush callback, NOT at
4541
+ * - `MllpTimeoutError` if no ACK arrives within `ackTimeoutMs` (this send's own, else the
4542
+ * client's). The clock starts at the underlying `write()` flush callback, NOT at
4279
4543
  * the `send()` call.
4280
4544
  * - `MllpConnectionError({ phase: 'send' })` if the client is not connected.
4281
4545
  *
@@ -4304,7 +4568,10 @@ var MllpClient = class extends events.EventEmitter {
4304
4568
  *
4305
4569
  * @param payload Raw bytes; MLLP framing is added internally via `encodeFrame`.
4306
4570
  * @param opts.signal AbortSignal, aborting cancels the ACK wait.
4307
- * @param opts.ackTimeoutMs Per-send override of the backpressure wait budget.
4571
+ * @param opts.ackTimeoutMs This send's bound on the wait for its acknowledgement, from the
4572
+ * moment its bytes are flushed, in place of the client's `ackTimeoutMs`. Under
4573
+ * `onBackpressure: "wait"` it also bounds the wait for queue room, and the
4574
+ * acknowledgement wait then starts afresh once the send is written.
4308
4575
  * @param opts.applicationAckTimeoutMs Per-send override of the second wait's bound.
4309
4576
  * @param opts.onCommitAck Called with the commit disposition when the peer commits the
4310
4577
  * message ahead of its application acknowledgement. See {@link CommitAckReport}.
@@ -4359,21 +4626,34 @@ var MllpClient = class extends events.EventEmitter {
4359
4626
  opts
4360
4627
  );
4361
4628
  }
4629
+ const sendAckTimeoutMs = opts?.ackTimeoutMs;
4362
4630
  return new Promise((resolve, reject) => {
4363
4631
  let abortListener = null;
4364
- const wrappedResolve = (ack) => {
4632
+ let ackDeadline;
4633
+ let settled = false;
4634
+ const settle = () => {
4635
+ settled = true;
4365
4636
  if (signal !== void 0 && abortListener !== null) {
4366
4637
  signal.removeEventListener("abort", abortListener);
4367
4638
  }
4639
+ clearTimeout(ackDeadline);
4640
+ };
4641
+ const wrappedResolve = (ack) => {
4642
+ settle();
4368
4643
  resolve(ack);
4369
4644
  };
4370
4645
  const wrappedReject = (err) => {
4371
- if (signal !== void 0 && abortListener !== null) {
4372
- signal.removeEventListener("abort", abortListener);
4373
- }
4646
+ settle();
4374
4647
  reject(err);
4375
4648
  };
4376
- const key = correlator.enqueue(frame, controlId, wrappedResolve, wrappedReject, twoPhase);
4649
+ const key = correlator.enqueue(
4650
+ frame,
4651
+ controlId,
4652
+ wrappedResolve,
4653
+ wrappedReject,
4654
+ twoPhase,
4655
+ sendAckTimeoutMs
4656
+ );
4377
4657
  if (key === null) {
4378
4658
  const parked = { cancel: () => void 0 };
4379
4659
  const neverDelivered = () => new MllpNeverDeliveredError({
@@ -4415,6 +4695,12 @@ var MllpClient = class extends events.EventEmitter {
4415
4695
  }
4416
4696
  conn.send(frame);
4417
4697
  correlator.markFlushed(key, Date.now());
4698
+ if (sendAckTimeoutMs !== void 0 && !settled) {
4699
+ ackDeadline = setTimeout(() => {
4700
+ correlator.expireDue();
4701
+ }, sendAckTimeoutMs);
4702
+ ackDeadline.unref();
4703
+ }
4418
4704
  this._sentTotal += 1;
4419
4705
  });
4420
4706
  }
@@ -4811,6 +5097,12 @@ var MllpClient = class extends events.EventEmitter {
4811
5097
  * ever written for it; that is a statement about the bytes, not about how the client was
4812
5098
  * shut down, so it holds on this path too.
4813
5099
  *
5100
+ * A {@link MllpClient.connect} still connecting rejects with an `MllpConnectionError` whose
5101
+ * `phase` is `'connect'` and no `connectionCause`. Its `cause` is `reason` when one is given,
5102
+ * never classified as a TLS failure whatever its message or `code`, and otherwise an `Error`
5103
+ * whose message is `closed before connect`. Only the first call reaches the socket, so a
5104
+ * second `destroy()` before `connect()` settles, with or without a reason, changes nothing.
5105
+ *
4814
5106
  * @example
4815
5107
  * ```typescript
4816
5108
  * client.destroy(new Error('shutting down'));
@@ -4831,6 +5123,7 @@ var MllpClient = class extends events.EventEmitter {
4831
5123
  this._teardownCorrelator(teardownReason);
4832
5124
  const conn = this._connection;
4833
5125
  if (conn === null) return;
5126
+ if (conn.state === "CONNECTING") this._destroyReason = reason ?? null;
4834
5127
  conn.destroy(reason);
4835
5128
  }
4836
5129
  /**
@@ -4876,7 +5169,7 @@ var MllpClient = class extends events.EventEmitter {
4876
5169
  reconnectAttempts: this._reconnectAttempts,
4877
5170
  lastConnectedAt: this._lastConnectedAt,
4878
5171
  lastAckAt: this._lastAckAt,
4879
- tls: this._opts.tls !== void 0
5172
+ tls: this._tls !== void 0
4880
5173
  };
4881
5174
  }
4882
5175
  /**
@@ -4911,6 +5204,7 @@ async function createStarterClient(opts) {
4911
5204
  ...opts.retryStrategy !== void 0 ? { retryStrategy: opts.retryStrategy } : {},
4912
5205
  ...opts.keepaliveIntervalMs !== void 0 ? { keepaliveIntervalMs: opts.keepaliveIntervalMs } : {},
4913
5206
  ...opts.deadPeerTimeoutMs !== void 0 ? { deadPeerTimeoutMs: opts.deadPeerTimeoutMs } : {},
5207
+ noDelay: opts.noDelay !== false,
4914
5208
  ...opts.connectTimeoutMs !== void 0 ? { connectTimeoutMs: opts.connectTimeoutMs } : {},
4915
5209
  ...opts.tls !== void 0 ? { tls: opts.tls } : {}
4916
5210
  };
@@ -5232,7 +5526,7 @@ async function runDifferential(options = {}) {
5232
5526
  }
5233
5527
 
5234
5528
  // src/index.ts
5235
- var VERSION = "0.1.11";
5529
+ var VERSION = "0.1.13";
5236
5530
 
5237
5531
  exports.ATNA_CIPHER_LIST = ATNA_CIPHER_LIST;
5238
5532
  exports.ATNA_CIPHER_SUITES = ATNA_CIPHER_SUITES;
@@ -5242,8 +5536,13 @@ exports.MLLP_BIND_ALL_INTERFACES = MLLP_BIND_ALL_INTERFACES;
5242
5536
  exports.MLLP_CONNECTION_LIMIT_REACHED = MLLP_CONNECTION_LIMIT_REACHED;
5243
5537
  exports.MLLP_DIFF_PEER_UNPARSEABLE = MLLP_DIFF_PEER_UNPARSEABLE;
5244
5538
  exports.MLLP_TLS_CIPHER_LIST_REJECTED = MLLP_TLS_CIPHER_LIST_REJECTED;
5539
+ exports.MLLP_TLS_CIPHER_LIST_UNENFORCEABLE = MLLP_TLS_CIPHER_LIST_UNENFORCEABLE;
5245
5540
  exports.MLLP_TLS_CIPHER_OPTION_CONFLICT = MLLP_TLS_CIPHER_OPTION_CONFLICT;
5541
+ exports.MLLP_TLS_CREDENTIAL_CONFLICT = MLLP_TLS_CREDENTIAL_CONFLICT;
5246
5542
  exports.MLLP_TLS_DH_PARAMETERS_REJECTED = MLLP_TLS_DH_PARAMETERS_REJECTED;
5543
+ exports.MLLP_TLS_DH_PARAMETERS_UNENFORCEABLE = MLLP_TLS_DH_PARAMETERS_UNENFORCEABLE;
5544
+ exports.MLLP_TLS_OPTIONS_NOT_AN_OBJECT = MLLP_TLS_OPTIONS_NOT_AN_OBJECT;
5545
+ exports.MLLP_TLS_PFX_REJECTED = MLLP_TLS_PFX_REJECTED;
5247
5546
  exports.MLLP_TLS_VERIFY_DISABLED = MLLP_TLS_VERIFY_DISABLED;
5248
5547
  exports.MllpAckError = MllpAckError;
5249
5548
  exports.MllpApplicationAckError = MllpApplicationAckError;
@@ -5283,6 +5582,7 @@ exports.resolveDifferentialPeer = resolveDifferentialPeer;
5283
5582
  exports.resolveNackCode = resolveNackCode;
5284
5583
  exports.resolveTlsCipherPolicy = resolveTlsCipherPolicy;
5285
5584
  exports.runDifferential = runDifferential;
5585
+ exports.selectAckCode = selectAckCode;
5286
5586
  exports.tlsConfigurationMessage = tlsConfigurationMessage;
5287
5587
  //# sourceMappingURL=index.cjs.map
5288
5588
  //# sourceMappingURL=index.cjs.map