@nsshunt/stsfhirclient 2.0.20 → 2.0.22

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) {
@@ -5922,31 +5922,28 @@ var require_schemes = /* @__PURE__ */ __commonJSMin$1(((exports, module) => {
5922
5922
  parse: wsParse,
5923
5923
  serialize: wsSerialize
5924
5924
  };
5925
- var wss = {
5926
- scheme: "wss",
5927
- domainHost: ws.domainHost,
5928
- parse: ws.parse,
5929
- serialize: ws.serialize
5930
- };
5931
- var urn = {
5932
- scheme: "urn",
5933
- parse: urnParse,
5934
- serialize: urnSerialize,
5935
- skipNormalize: true
5936
- };
5937
- var urnuuid = {
5938
- scheme: "urn:uuid",
5939
- parse: urnuuidParse,
5940
- serialize: urnuuidSerialize,
5941
- skipNormalize: true
5942
- };
5943
5925
  var SCHEMES = {
5944
5926
  http,
5945
5927
  https,
5946
5928
  ws,
5947
- wss,
5948
- urn,
5949
- "urn:uuid": urnuuid
5929
+ wss: {
5930
+ scheme: "wss",
5931
+ domainHost: ws.domainHost,
5932
+ parse: ws.parse,
5933
+ serialize: ws.serialize
5934
+ },
5935
+ urn: {
5936
+ scheme: "urn",
5937
+ parse: urnParse,
5938
+ serialize: urnSerialize,
5939
+ skipNormalize: true
5940
+ },
5941
+ "urn:uuid": {
5942
+ scheme: "urn:uuid",
5943
+ parse: urnuuidParse,
5944
+ serialize: urnuuidSerialize,
5945
+ skipNormalize: true
5946
+ }
5950
5947
  };
5951
5948
  Object.setPrototypeOf(SCHEMES, null);
5952
5949
  /**
@@ -9812,28 +9809,8 @@ Object.defineProperties(createChalk.prototype, styles);
9812
9809
  var chalk = createChalk();
9813
9810
  createChalk({ level: stderrColor ? stderrColor.level : 0 });
9814
9811
  //#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;
9812
+ //#region node_modules/@nsshunt/stssocketioutils/dist/tiny-emitter-DB59cw42.js
9822
9813
  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
9814
  var require_tiny_emitter = /* @__PURE__ */ __commonJSMin(((exports, module) => {
9838
9815
  function E() {}
9839
9816
  E.prototype = {
@@ -11662,12 +11639,13 @@ var Encoder = class {
11662
11639
  var Decoder = class Decoder extends Emitter {
11663
11640
  /**
11664
11641
  * Decoder constructor
11665
- *
11666
- * @param {function} reviver - custom reviver to pass down to JSON.stringify
11667
11642
  */
11668
- constructor(reviver) {
11643
+ constructor(opts) {
11669
11644
  super();
11670
- this.reviver = reviver;
11645
+ this.opts = Object.assign({
11646
+ reviver: void 0,
11647
+ maxAttachments: 10
11648
+ }, typeof opts === "function" ? { reviver: opts } : opts);
11671
11649
  }
11672
11650
  /**
11673
11651
  * Decodes an encoded packet string into packet JSON.
@@ -11710,7 +11688,10 @@ var Decoder = class Decoder extends Emitter {
11710
11688
  while (str.charAt(++i) !== "-" && i != str.length);
11711
11689
  const buf = str.substring(start, i);
11712
11690
  if (buf != Number(buf) || str.charAt(i) !== "-") throw new Error("Illegal attachments");
11713
- p.attachments = Number(buf);
11691
+ const n = Number(buf);
11692
+ if (!isInteger(n) || n < 0) throw new Error("Illegal attachments");
11693
+ else if (n > this.opts.maxAttachments) throw new Error("too many attachments");
11694
+ p.attachments = n;
11714
11695
  }
11715
11696
  if ("/" === str.charAt(i + 1)) {
11716
11697
  const start = i + 1;
@@ -11742,7 +11723,7 @@ var Decoder = class Decoder extends Emitter {
11742
11723
  }
11743
11724
  tryParse(str) {
11744
11725
  try {
11745
- return JSON.parse(str, this.reviver);
11726
+ return JSON.parse(str, this.opts.reviver);
11746
11727
  } catch (e) {
11747
11728
  return false;
11748
11729
  }
@@ -13037,9 +13018,6 @@ Object.assign(lookup, {
13037
13018
  });
13038
13019
  //#endregion
13039
13020
  //#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
13021
  var import_tiny_emitter = require_tiny_emitter();
13044
13022
  var SocketIoClient = class extends import_tiny_emitter.TinyEmitter {
13045
13023
  #agentManager;
@@ -13127,12 +13105,12 @@ var SocketIoClient = class extends import_tiny_emitter.TinyEmitter {
13127
13105
  if (this.#socket !== void 0) {
13128
13106
  if (this.#socket.connected === true) this.#socket.disconnect();
13129
13107
  this.#socket = void 0;
13130
- if (import_browser.default) setTimeout(() => this.#EstablishSocketConnect(), this.#reconnectTimeout).unref();
13108
+ if (isNode) setTimeout(() => this.#EstablishSocketConnect(), this.#reconnectTimeout).unref();
13131
13109
  else setTimeout(() => this.#EstablishSocketConnect(), this.#reconnectTimeout);
13132
13110
  return;
13133
13111
  }
13134
13112
  let socketOptions;
13135
- if (import_browser.default) {
13113
+ if (isNode) {
13136
13114
  socketOptions = { transports: ["websocket"] };
13137
13115
  if (this.#agentManager) {
13138
13116
  if (!this.#address) throw new Error(`SocketIoClient:SetupSocket(): Error: [address not provided when using agentManager]`);
@@ -13181,7 +13159,7 @@ var SocketIoClient = class extends import_tiny_emitter.TinyEmitter {
13181
13159
  this.LogDebugMessage("The server disconnected using disconnectSockets, i.e. normal safe shutdown from explicit disconnection by the server.");
13182
13160
  this.LogDebugMessage("The connection will be re-established when the server becomes available.");
13183
13161
  this.#socket = void 0;
13184
- if (import_browser.default) {
13162
+ if (isNode) {
13185
13163
  if (this.#agentManager) this.#agentManager.ResetAgent();
13186
13164
  setTimeout(() => this.#EstablishSocketConnect(), this.#reconnectTimeout).unref();
13187
13165
  } else setTimeout(() => this.#EstablishSocketConnect(), this.#reconnectTimeout);
@@ -13197,7 +13175,7 @@ var SocketIoClient = class extends import_tiny_emitter.TinyEmitter {
13197
13175
  this.LogDebugMessage("The connection will be re-established when the server becomes available.");
13198
13176
  if (this.#socket) this.#socket.disconnect();
13199
13177
  this.#socket = void 0;
13200
- if (import_browser.default) {
13178
+ if (isNode) {
13201
13179
  if (this.#agentManager) this.#agentManager?.ResetAgent();
13202
13180
  setTimeout(() => this.#EstablishSocketConnect(), this.#reconnectTimeout).unref();
13203
13181
  } else setTimeout(() => this.#EstablishSocketConnect(), this.#reconnectTimeout);