@nsshunt/stsfhirclient 2.0.19 → 2.0.21

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.
@@ -1,33 +1,33 @@
1
1
  import axios from "axios";
2
- import { STSAxiosConfig, Sleep } from "@nsshunt/stsutils";
2
+ import { STSAxiosConfig, Sleep, isNode } from "@nsshunt/stsutils";
3
3
  import { Emitter } from "@socket.io/component-emitter";
4
4
  //#region \0rolldown/runtime.js
5
- var __defProp$1 = Object.defineProperty;
6
- var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
7
- var __getOwnPropNames$1 = Object.getOwnPropertyNames;
8
- var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
5
+ var __defProp = Object.defineProperty;
6
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
+ var __getOwnPropNames = Object.getOwnPropertyNames;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
9
  var __esmMin = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
10
10
  var __commonJSMin$1 = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
11
11
  var __exportAll = (all, no_symbols) => {
12
12
  let target = {};
13
- for (var name in all) __defProp$1(target, name, {
13
+ for (var name in all) __defProp(target, name, {
14
14
  get: all[name],
15
15
  enumerable: true
16
16
  });
17
- if (!no_symbols) __defProp$1(target, Symbol.toStringTag, { value: "Module" });
17
+ if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
18
18
  return target;
19
19
  };
20
- var __copyProps$1 = (to, from, except, desc) => {
21
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames$1(from), i = 0, n = keys.length, key; i < n; i++) {
20
+ var __copyProps = (to, from, except, desc) => {
21
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
22
22
  key = keys[i];
23
- if (!__hasOwnProp$1.call(to, key) && key !== except) __defProp$1(to, key, {
23
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
24
24
  get: ((k) => from[k]).bind(null, key),
25
- enumerable: !(desc = __getOwnPropDesc$1(from, key)) || desc.enumerable
25
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
26
26
  });
27
27
  }
28
28
  return to;
29
29
  };
30
- var __toCommonJS = (mod) => __hasOwnProp$1.call(mod, "module.exports") ? mod["module.exports"] : __copyProps$1(__defProp$1({}, "__esModule", { value: true }), mod);
30
+ var __toCommonJS = (mod) => __hasOwnProp.call(mod, "module.exports") ? mod["module.exports"] : __copyProps(__defProp({}, "__esModule", { value: true }), mod);
31
31
  //#endregion
32
32
  //#region src/fhir-searchTypes/fhirSearchTypes.ts
33
33
  var fhirRT = /* @__PURE__ */ function(fhirRT) {
@@ -9812,28 +9812,8 @@ Object.defineProperties(createChalk.prototype, styles);
9812
9812
  var chalk = createChalk();
9813
9813
  createChalk({ level: stderrColor ? stderrColor.level : 0 });
9814
9814
  //#endregion
9815
- //#region node_modules/@nsshunt/stssocketioutils/dist/tiny-emitter-D1Sgcrvm.js
9816
- var __create = Object.create;
9817
- var __defProp = Object.defineProperty;
9818
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
9819
- var __getOwnPropNames = Object.getOwnPropertyNames;
9820
- var __getProtoOf = Object.getPrototypeOf;
9821
- var __hasOwnProp = Object.prototype.hasOwnProperty;
9815
+ //#region node_modules/@nsshunt/stssocketioutils/dist/tiny-emitter-DB59cw42.js
9822
9816
  var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
9823
- var __copyProps = (to, from, except, desc) => {
9824
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
9825
- key = keys[i];
9826
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
9827
- get: ((k) => from[k]).bind(null, key),
9828
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
9829
- });
9830
- }
9831
- return to;
9832
- };
9833
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
9834
- value: mod,
9835
- enumerable: true
9836
- }) : target, mod));
9837
9817
  var require_tiny_emitter = /* @__PURE__ */ __commonJSMin(((exports, module) => {
9838
9818
  function E() {}
9839
9819
  E.prototype = {
@@ -11662,12 +11642,13 @@ var Encoder = class {
11662
11642
  var Decoder = class Decoder extends Emitter {
11663
11643
  /**
11664
11644
  * Decoder constructor
11665
- *
11666
- * @param {function} reviver - custom reviver to pass down to JSON.stringify
11667
11645
  */
11668
- constructor(reviver) {
11646
+ constructor(opts) {
11669
11647
  super();
11670
- this.reviver = reviver;
11648
+ this.opts = Object.assign({
11649
+ reviver: void 0,
11650
+ maxAttachments: 10
11651
+ }, typeof opts === "function" ? { reviver: opts } : opts);
11671
11652
  }
11672
11653
  /**
11673
11654
  * Decodes an encoded packet string into packet JSON.
@@ -11710,7 +11691,10 @@ var Decoder = class Decoder extends Emitter {
11710
11691
  while (str.charAt(++i) !== "-" && i != str.length);
11711
11692
  const buf = str.substring(start, i);
11712
11693
  if (buf != Number(buf) || str.charAt(i) !== "-") throw new Error("Illegal attachments");
11713
- p.attachments = Number(buf);
11694
+ const n = Number(buf);
11695
+ if (!isInteger(n) || n < 0) throw new Error("Illegal attachments");
11696
+ else if (n > this.opts.maxAttachments) throw new Error("too many attachments");
11697
+ p.attachments = n;
11714
11698
  }
11715
11699
  if ("/" === str.charAt(i + 1)) {
11716
11700
  const start = i + 1;
@@ -11742,7 +11726,7 @@ var Decoder = class Decoder extends Emitter {
11742
11726
  }
11743
11727
  tryParse(str) {
11744
11728
  try {
11745
- return JSON.parse(str, this.reviver);
11729
+ return JSON.parse(str, this.opts.reviver);
11746
11730
  } catch (e) {
11747
11731
  return false;
11748
11732
  }
@@ -13037,9 +13021,6 @@ Object.assign(lookup, {
13037
13021
  });
13038
13022
  //#endregion
13039
13023
  //#region node_modules/@nsshunt/stssocketioutils/dist/index.mjs
13040
- var import_browser = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
13041
- module.exports = false;
13042
- })))(), 1);
13043
13024
  var import_tiny_emitter = require_tiny_emitter();
13044
13025
  var SocketIoClient = class extends import_tiny_emitter.TinyEmitter {
13045
13026
  #agentManager;
@@ -13127,12 +13108,12 @@ var SocketIoClient = class extends import_tiny_emitter.TinyEmitter {
13127
13108
  if (this.#socket !== void 0) {
13128
13109
  if (this.#socket.connected === true) this.#socket.disconnect();
13129
13110
  this.#socket = void 0;
13130
- if (import_browser.default) setTimeout(() => this.#EstablishSocketConnect(), this.#reconnectTimeout).unref();
13111
+ if (isNode) setTimeout(() => this.#EstablishSocketConnect(), this.#reconnectTimeout).unref();
13131
13112
  else setTimeout(() => this.#EstablishSocketConnect(), this.#reconnectTimeout);
13132
13113
  return;
13133
13114
  }
13134
13115
  let socketOptions;
13135
- if (import_browser.default) {
13116
+ if (isNode) {
13136
13117
  socketOptions = { transports: ["websocket"] };
13137
13118
  if (this.#agentManager) {
13138
13119
  if (!this.#address) throw new Error(`SocketIoClient:SetupSocket(): Error: [address not provided when using agentManager]`);
@@ -13181,7 +13162,7 @@ var SocketIoClient = class extends import_tiny_emitter.TinyEmitter {
13181
13162
  this.LogDebugMessage("The server disconnected using disconnectSockets, i.e. normal safe shutdown from explicit disconnection by the server.");
13182
13163
  this.LogDebugMessage("The connection will be re-established when the server becomes available.");
13183
13164
  this.#socket = void 0;
13184
- if (import_browser.default) {
13165
+ if (isNode) {
13185
13166
  if (this.#agentManager) this.#agentManager.ResetAgent();
13186
13167
  setTimeout(() => this.#EstablishSocketConnect(), this.#reconnectTimeout).unref();
13187
13168
  } else setTimeout(() => this.#EstablishSocketConnect(), this.#reconnectTimeout);
@@ -13197,7 +13178,7 @@ var SocketIoClient = class extends import_tiny_emitter.TinyEmitter {
13197
13178
  this.LogDebugMessage("The connection will be re-established when the server becomes available.");
13198
13179
  if (this.#socket) this.#socket.disconnect();
13199
13180
  this.#socket = void 0;
13200
- if (import_browser.default) {
13181
+ if (isNode) {
13201
13182
  if (this.#agentManager) this.#agentManager?.ResetAgent();
13202
13183
  setTimeout(() => this.#EstablishSocketConnect(), this.#reconnectTimeout).unref();
13203
13184
  } else setTimeout(() => this.#EstablishSocketConnect(), this.#reconnectTimeout);