@nsshunt/stsfhirclient 1.0.28 → 1.0.29

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,6 +1,6 @@
1
1
  (function(global, factory) {
2
- typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("axios"), require("@nsshunt/stsutils"), require("node:fs"), require("path"), require("os"), require("crypto"), require("node:http"), require("node:https")) : typeof define === "function" && define.amd ? define(["exports", "axios", "@nsshunt/stsutils", "node:fs", "path", "os", "crypto", "node:http", "node:https"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global["@nsshunt/stsfhirclient"] = {}, global.axios, global.stsutils, global.https, global.path, global.os, global.crypto, global.http, global.https));
3
- })(this, function(exports2, axios, stsutils, node_fs, require$$1, require$$2, require$$3, http, https) {
2
+ typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("axios"), require("@nsshunt/stsutils")) : typeof define === "function" && define.amd ? define(["exports", "axios", "@nsshunt/stsutils"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global["@nsshunt/stsfhirclient"] = {}, global.axios, global.stsutils));
3
+ })(this, function(exports2, axios, stsutils) {
4
4
  "use strict";var __defProp = Object.defineProperty;
5
5
  var __typeError = (msg) => {
6
6
  throw TypeError(msg);
@@ -12,7 +12,7 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
12
12
  var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
13
13
  var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
14
14
 
15
- var _options2, _DUMMY_USER, _invokeMethods, _maxRetries, _sleepDuration, _NoRetryStatusCodes, _stsfhirapiroot, _agentManager2, _LogDebugMessage, _LogErrorMessage, _HandleError, _InvokeResourceAPI, _TestMode, ___InvokeResourceAPI;
15
+ var _options, _DUMMY_USER, _invokeMethods, _maxRetries, _sleepDuration, _NoRetryStatusCodes, _stsfhirapiroot, _LogDebugMessage, _LogErrorMessage, _HandleError, _InvokeResourceAPI, _TestMode, ___InvokeResourceAPI;
16
16
  var byteToHex = [];
17
17
  for (var i = 0; i < 256; ++i) {
18
18
  byteToHex.push((i + 256).toString(16).slice(1));
@@ -49,1881 +49,6 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
49
49
  function getDefaultExportFromCjs(x) {
50
50
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
51
51
  }
52
- function getAugmentedNamespace(n) {
53
- if (n.__esModule) return n;
54
- var f = n.default;
55
- if (typeof f == "function") {
56
- var a = function a2() {
57
- if (this instanceof a2) {
58
- return Reflect.construct(f, arguments, this.constructor);
59
- }
60
- return f.apply(this, arguments);
61
- };
62
- a.prototype = f.prototype;
63
- } else a = {};
64
- Object.defineProperty(a, "__esModule", { value: true });
65
- Object.keys(n).forEach(function(k) {
66
- var d = Object.getOwnPropertyDescriptor(n, k);
67
- Object.defineProperty(a, k, d.get ? d : {
68
- enumerable: true,
69
- get: function() {
70
- return n[k];
71
- }
72
- });
73
- });
74
- return a;
75
- }
76
- var ansiStyles$3 = { exports: {} };
77
- var colorName$1;
78
- var hasRequiredColorName$1;
79
- function requireColorName$1() {
80
- if (hasRequiredColorName$1) return colorName$1;
81
- hasRequiredColorName$1 = 1;
82
- colorName$1 = {
83
- "aliceblue": [240, 248, 255],
84
- "antiquewhite": [250, 235, 215],
85
- "aqua": [0, 255, 255],
86
- "aquamarine": [127, 255, 212],
87
- "azure": [240, 255, 255],
88
- "beige": [245, 245, 220],
89
- "bisque": [255, 228, 196],
90
- "black": [0, 0, 0],
91
- "blanchedalmond": [255, 235, 205],
92
- "blue": [0, 0, 255],
93
- "blueviolet": [138, 43, 226],
94
- "brown": [165, 42, 42],
95
- "burlywood": [222, 184, 135],
96
- "cadetblue": [95, 158, 160],
97
- "chartreuse": [127, 255, 0],
98
- "chocolate": [210, 105, 30],
99
- "coral": [255, 127, 80],
100
- "cornflowerblue": [100, 149, 237],
101
- "cornsilk": [255, 248, 220],
102
- "crimson": [220, 20, 60],
103
- "cyan": [0, 255, 255],
104
- "darkblue": [0, 0, 139],
105
- "darkcyan": [0, 139, 139],
106
- "darkgoldenrod": [184, 134, 11],
107
- "darkgray": [169, 169, 169],
108
- "darkgreen": [0, 100, 0],
109
- "darkgrey": [169, 169, 169],
110
- "darkkhaki": [189, 183, 107],
111
- "darkmagenta": [139, 0, 139],
112
- "darkolivegreen": [85, 107, 47],
113
- "darkorange": [255, 140, 0],
114
- "darkorchid": [153, 50, 204],
115
- "darkred": [139, 0, 0],
116
- "darksalmon": [233, 150, 122],
117
- "darkseagreen": [143, 188, 143],
118
- "darkslateblue": [72, 61, 139],
119
- "darkslategray": [47, 79, 79],
120
- "darkslategrey": [47, 79, 79],
121
- "darkturquoise": [0, 206, 209],
122
- "darkviolet": [148, 0, 211],
123
- "deeppink": [255, 20, 147],
124
- "deepskyblue": [0, 191, 255],
125
- "dimgray": [105, 105, 105],
126
- "dimgrey": [105, 105, 105],
127
- "dodgerblue": [30, 144, 255],
128
- "firebrick": [178, 34, 34],
129
- "floralwhite": [255, 250, 240],
130
- "forestgreen": [34, 139, 34],
131
- "fuchsia": [255, 0, 255],
132
- "gainsboro": [220, 220, 220],
133
- "ghostwhite": [248, 248, 255],
134
- "gold": [255, 215, 0],
135
- "goldenrod": [218, 165, 32],
136
- "gray": [128, 128, 128],
137
- "green": [0, 128, 0],
138
- "greenyellow": [173, 255, 47],
139
- "grey": [128, 128, 128],
140
- "honeydew": [240, 255, 240],
141
- "hotpink": [255, 105, 180],
142
- "indianred": [205, 92, 92],
143
- "indigo": [75, 0, 130],
144
- "ivory": [255, 255, 240],
145
- "khaki": [240, 230, 140],
146
- "lavender": [230, 230, 250],
147
- "lavenderblush": [255, 240, 245],
148
- "lawngreen": [124, 252, 0],
149
- "lemonchiffon": [255, 250, 205],
150
- "lightblue": [173, 216, 230],
151
- "lightcoral": [240, 128, 128],
152
- "lightcyan": [224, 255, 255],
153
- "lightgoldenrodyellow": [250, 250, 210],
154
- "lightgray": [211, 211, 211],
155
- "lightgreen": [144, 238, 144],
156
- "lightgrey": [211, 211, 211],
157
- "lightpink": [255, 182, 193],
158
- "lightsalmon": [255, 160, 122],
159
- "lightseagreen": [32, 178, 170],
160
- "lightskyblue": [135, 206, 250],
161
- "lightslategray": [119, 136, 153],
162
- "lightslategrey": [119, 136, 153],
163
- "lightsteelblue": [176, 196, 222],
164
- "lightyellow": [255, 255, 224],
165
- "lime": [0, 255, 0],
166
- "limegreen": [50, 205, 50],
167
- "linen": [250, 240, 230],
168
- "magenta": [255, 0, 255],
169
- "maroon": [128, 0, 0],
170
- "mediumaquamarine": [102, 205, 170],
171
- "mediumblue": [0, 0, 205],
172
- "mediumorchid": [186, 85, 211],
173
- "mediumpurple": [147, 112, 219],
174
- "mediumseagreen": [60, 179, 113],
175
- "mediumslateblue": [123, 104, 238],
176
- "mediumspringgreen": [0, 250, 154],
177
- "mediumturquoise": [72, 209, 204],
178
- "mediumvioletred": [199, 21, 133],
179
- "midnightblue": [25, 25, 112],
180
- "mintcream": [245, 255, 250],
181
- "mistyrose": [255, 228, 225],
182
- "moccasin": [255, 228, 181],
183
- "navajowhite": [255, 222, 173],
184
- "navy": [0, 0, 128],
185
- "oldlace": [253, 245, 230],
186
- "olive": [128, 128, 0],
187
- "olivedrab": [107, 142, 35],
188
- "orange": [255, 165, 0],
189
- "orangered": [255, 69, 0],
190
- "orchid": [218, 112, 214],
191
- "palegoldenrod": [238, 232, 170],
192
- "palegreen": [152, 251, 152],
193
- "paleturquoise": [175, 238, 238],
194
- "palevioletred": [219, 112, 147],
195
- "papayawhip": [255, 239, 213],
196
- "peachpuff": [255, 218, 185],
197
- "peru": [205, 133, 63],
198
- "pink": [255, 192, 203],
199
- "plum": [221, 160, 221],
200
- "powderblue": [176, 224, 230],
201
- "purple": [128, 0, 128],
202
- "rebeccapurple": [102, 51, 153],
203
- "red": [255, 0, 0],
204
- "rosybrown": [188, 143, 143],
205
- "royalblue": [65, 105, 225],
206
- "saddlebrown": [139, 69, 19],
207
- "salmon": [250, 128, 114],
208
- "sandybrown": [244, 164, 96],
209
- "seagreen": [46, 139, 87],
210
- "seashell": [255, 245, 238],
211
- "sienna": [160, 82, 45],
212
- "silver": [192, 192, 192],
213
- "skyblue": [135, 206, 235],
214
- "slateblue": [106, 90, 205],
215
- "slategray": [112, 128, 144],
216
- "slategrey": [112, 128, 144],
217
- "snow": [255, 250, 250],
218
- "springgreen": [0, 255, 127],
219
- "steelblue": [70, 130, 180],
220
- "tan": [210, 180, 140],
221
- "teal": [0, 128, 128],
222
- "thistle": [216, 191, 216],
223
- "tomato": [255, 99, 71],
224
- "turquoise": [64, 224, 208],
225
- "violet": [238, 130, 238],
226
- "wheat": [245, 222, 179],
227
- "white": [255, 255, 255],
228
- "whitesmoke": [245, 245, 245],
229
- "yellow": [255, 255, 0],
230
- "yellowgreen": [154, 205, 50]
231
- };
232
- return colorName$1;
233
- }
234
- var conversions$1;
235
- var hasRequiredConversions$1;
236
- function requireConversions$1() {
237
- if (hasRequiredConversions$1) return conversions$1;
238
- hasRequiredConversions$1 = 1;
239
- const cssKeywords = requireColorName$1();
240
- const reverseKeywords = {};
241
- for (const key of Object.keys(cssKeywords)) {
242
- reverseKeywords[cssKeywords[key]] = key;
243
- }
244
- const convert = {
245
- rgb: { channels: 3, labels: "rgb" },
246
- hsl: { channels: 3, labels: "hsl" },
247
- hsv: { channels: 3, labels: "hsv" },
248
- hwb: { channels: 3, labels: "hwb" },
249
- cmyk: { channels: 4, labels: "cmyk" },
250
- xyz: { channels: 3, labels: "xyz" },
251
- lab: { channels: 3, labels: "lab" },
252
- lch: { channels: 3, labels: "lch" },
253
- hex: { channels: 1, labels: ["hex"] },
254
- keyword: { channels: 1, labels: ["keyword"] },
255
- ansi16: { channels: 1, labels: ["ansi16"] },
256
- ansi256: { channels: 1, labels: ["ansi256"] },
257
- hcg: { channels: 3, labels: ["h", "c", "g"] },
258
- apple: { channels: 3, labels: ["r16", "g16", "b16"] },
259
- gray: { channels: 1, labels: ["gray"] }
260
- };
261
- conversions$1 = convert;
262
- for (const model of Object.keys(convert)) {
263
- if (!("channels" in convert[model])) {
264
- throw new Error("missing channels property: " + model);
265
- }
266
- if (!("labels" in convert[model])) {
267
- throw new Error("missing channel labels property: " + model);
268
- }
269
- if (convert[model].labels.length !== convert[model].channels) {
270
- throw new Error("channel and label counts mismatch: " + model);
271
- }
272
- const { channels, labels } = convert[model];
273
- delete convert[model].channels;
274
- delete convert[model].labels;
275
- Object.defineProperty(convert[model], "channels", { value: channels });
276
- Object.defineProperty(convert[model], "labels", { value: labels });
277
- }
278
- convert.rgb.hsl = function(rgb) {
279
- const r = rgb[0] / 255;
280
- const g = rgb[1] / 255;
281
- const b = rgb[2] / 255;
282
- const min = Math.min(r, g, b);
283
- const max = Math.max(r, g, b);
284
- const delta = max - min;
285
- let h;
286
- let s;
287
- if (max === min) {
288
- h = 0;
289
- } else if (r === max) {
290
- h = (g - b) / delta;
291
- } else if (g === max) {
292
- h = 2 + (b - r) / delta;
293
- } else if (b === max) {
294
- h = 4 + (r - g) / delta;
295
- }
296
- h = Math.min(h * 60, 360);
297
- if (h < 0) {
298
- h += 360;
299
- }
300
- const l = (min + max) / 2;
301
- if (max === min) {
302
- s = 0;
303
- } else if (l <= 0.5) {
304
- s = delta / (max + min);
305
- } else {
306
- s = delta / (2 - max - min);
307
- }
308
- return [h, s * 100, l * 100];
309
- };
310
- convert.rgb.hsv = function(rgb) {
311
- let rdif;
312
- let gdif;
313
- let bdif;
314
- let h;
315
- let s;
316
- const r = rgb[0] / 255;
317
- const g = rgb[1] / 255;
318
- const b = rgb[2] / 255;
319
- const v = Math.max(r, g, b);
320
- const diff = v - Math.min(r, g, b);
321
- const diffc = function(c) {
322
- return (v - c) / 6 / diff + 1 / 2;
323
- };
324
- if (diff === 0) {
325
- h = 0;
326
- s = 0;
327
- } else {
328
- s = diff / v;
329
- rdif = diffc(r);
330
- gdif = diffc(g);
331
- bdif = diffc(b);
332
- if (r === v) {
333
- h = bdif - gdif;
334
- } else if (g === v) {
335
- h = 1 / 3 + rdif - bdif;
336
- } else if (b === v) {
337
- h = 2 / 3 + gdif - rdif;
338
- }
339
- if (h < 0) {
340
- h += 1;
341
- } else if (h > 1) {
342
- h -= 1;
343
- }
344
- }
345
- return [
346
- h * 360,
347
- s * 100,
348
- v * 100
349
- ];
350
- };
351
- convert.rgb.hwb = function(rgb) {
352
- const r = rgb[0];
353
- const g = rgb[1];
354
- let b = rgb[2];
355
- const h = convert.rgb.hsl(rgb)[0];
356
- const w = 1 / 255 * Math.min(r, Math.min(g, b));
357
- b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
358
- return [h, w * 100, b * 100];
359
- };
360
- convert.rgb.cmyk = function(rgb) {
361
- const r = rgb[0] / 255;
362
- const g = rgb[1] / 255;
363
- const b = rgb[2] / 255;
364
- const k = Math.min(1 - r, 1 - g, 1 - b);
365
- const c = (1 - r - k) / (1 - k) || 0;
366
- const m = (1 - g - k) / (1 - k) || 0;
367
- const y = (1 - b - k) / (1 - k) || 0;
368
- return [c * 100, m * 100, y * 100, k * 100];
369
- };
370
- function comparativeDistance(x, y) {
371
- return (x[0] - y[0]) ** 2 + (x[1] - y[1]) ** 2 + (x[2] - y[2]) ** 2;
372
- }
373
- convert.rgb.keyword = function(rgb) {
374
- const reversed = reverseKeywords[rgb];
375
- if (reversed) {
376
- return reversed;
377
- }
378
- let currentClosestDistance = Infinity;
379
- let currentClosestKeyword;
380
- for (const keyword of Object.keys(cssKeywords)) {
381
- const value = cssKeywords[keyword];
382
- const distance = comparativeDistance(rgb, value);
383
- if (distance < currentClosestDistance) {
384
- currentClosestDistance = distance;
385
- currentClosestKeyword = keyword;
386
- }
387
- }
388
- return currentClosestKeyword;
389
- };
390
- convert.keyword.rgb = function(keyword) {
391
- return cssKeywords[keyword];
392
- };
393
- convert.rgb.xyz = function(rgb) {
394
- let r = rgb[0] / 255;
395
- let g = rgb[1] / 255;
396
- let b = rgb[2] / 255;
397
- r = r > 0.04045 ? ((r + 0.055) / 1.055) ** 2.4 : r / 12.92;
398
- g = g > 0.04045 ? ((g + 0.055) / 1.055) ** 2.4 : g / 12.92;
399
- b = b > 0.04045 ? ((b + 0.055) / 1.055) ** 2.4 : b / 12.92;
400
- const x = r * 0.4124 + g * 0.3576 + b * 0.1805;
401
- const y = r * 0.2126 + g * 0.7152 + b * 0.0722;
402
- const z = r * 0.0193 + g * 0.1192 + b * 0.9505;
403
- return [x * 100, y * 100, z * 100];
404
- };
405
- convert.rgb.lab = function(rgb) {
406
- const xyz = convert.rgb.xyz(rgb);
407
- let x = xyz[0];
408
- let y = xyz[1];
409
- let z = xyz[2];
410
- x /= 95.047;
411
- y /= 100;
412
- z /= 108.883;
413
- x = x > 8856e-6 ? x ** (1 / 3) : 7.787 * x + 16 / 116;
414
- y = y > 8856e-6 ? y ** (1 / 3) : 7.787 * y + 16 / 116;
415
- z = z > 8856e-6 ? z ** (1 / 3) : 7.787 * z + 16 / 116;
416
- const l = 116 * y - 16;
417
- const a = 500 * (x - y);
418
- const b = 200 * (y - z);
419
- return [l, a, b];
420
- };
421
- convert.hsl.rgb = function(hsl) {
422
- const h = hsl[0] / 360;
423
- const s = hsl[1] / 100;
424
- const l = hsl[2] / 100;
425
- let t2;
426
- let t3;
427
- let val;
428
- if (s === 0) {
429
- val = l * 255;
430
- return [val, val, val];
431
- }
432
- if (l < 0.5) {
433
- t2 = l * (1 + s);
434
- } else {
435
- t2 = l + s - l * s;
436
- }
437
- const t1 = 2 * l - t2;
438
- const rgb = [0, 0, 0];
439
- for (let i2 = 0; i2 < 3; i2++) {
440
- t3 = h + 1 / 3 * -(i2 - 1);
441
- if (t3 < 0) {
442
- t3++;
443
- }
444
- if (t3 > 1) {
445
- t3--;
446
- }
447
- if (6 * t3 < 1) {
448
- val = t1 + (t2 - t1) * 6 * t3;
449
- } else if (2 * t3 < 1) {
450
- val = t2;
451
- } else if (3 * t3 < 2) {
452
- val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
453
- } else {
454
- val = t1;
455
- }
456
- rgb[i2] = val * 255;
457
- }
458
- return rgb;
459
- };
460
- convert.hsl.hsv = function(hsl) {
461
- const h = hsl[0];
462
- let s = hsl[1] / 100;
463
- let l = hsl[2] / 100;
464
- let smin = s;
465
- const lmin = Math.max(l, 0.01);
466
- l *= 2;
467
- s *= l <= 1 ? l : 2 - l;
468
- smin *= lmin <= 1 ? lmin : 2 - lmin;
469
- const v = (l + s) / 2;
470
- const sv = l === 0 ? 2 * smin / (lmin + smin) : 2 * s / (l + s);
471
- return [h, sv * 100, v * 100];
472
- };
473
- convert.hsv.rgb = function(hsv) {
474
- const h = hsv[0] / 60;
475
- const s = hsv[1] / 100;
476
- let v = hsv[2] / 100;
477
- const hi = Math.floor(h) % 6;
478
- const f = h - Math.floor(h);
479
- const p = 255 * v * (1 - s);
480
- const q = 255 * v * (1 - s * f);
481
- const t = 255 * v * (1 - s * (1 - f));
482
- v *= 255;
483
- switch (hi) {
484
- case 0:
485
- return [v, t, p];
486
- case 1:
487
- return [q, v, p];
488
- case 2:
489
- return [p, v, t];
490
- case 3:
491
- return [p, q, v];
492
- case 4:
493
- return [t, p, v];
494
- case 5:
495
- return [v, p, q];
496
- }
497
- };
498
- convert.hsv.hsl = function(hsv) {
499
- const h = hsv[0];
500
- const s = hsv[1] / 100;
501
- const v = hsv[2] / 100;
502
- const vmin = Math.max(v, 0.01);
503
- let sl;
504
- let l;
505
- l = (2 - s) * v;
506
- const lmin = (2 - s) * vmin;
507
- sl = s * vmin;
508
- sl /= lmin <= 1 ? lmin : 2 - lmin;
509
- sl = sl || 0;
510
- l /= 2;
511
- return [h, sl * 100, l * 100];
512
- };
513
- convert.hwb.rgb = function(hwb) {
514
- const h = hwb[0] / 360;
515
- let wh = hwb[1] / 100;
516
- let bl = hwb[2] / 100;
517
- const ratio = wh + bl;
518
- let f;
519
- if (ratio > 1) {
520
- wh /= ratio;
521
- bl /= ratio;
522
- }
523
- const i2 = Math.floor(6 * h);
524
- const v = 1 - bl;
525
- f = 6 * h - i2;
526
- if ((i2 & 1) !== 0) {
527
- f = 1 - f;
528
- }
529
- const n = wh + f * (v - wh);
530
- let r;
531
- let g;
532
- let b;
533
- switch (i2) {
534
- default:
535
- case 6:
536
- case 0:
537
- r = v;
538
- g = n;
539
- b = wh;
540
- break;
541
- case 1:
542
- r = n;
543
- g = v;
544
- b = wh;
545
- break;
546
- case 2:
547
- r = wh;
548
- g = v;
549
- b = n;
550
- break;
551
- case 3:
552
- r = wh;
553
- g = n;
554
- b = v;
555
- break;
556
- case 4:
557
- r = n;
558
- g = wh;
559
- b = v;
560
- break;
561
- case 5:
562
- r = v;
563
- g = wh;
564
- b = n;
565
- break;
566
- }
567
- return [r * 255, g * 255, b * 255];
568
- };
569
- convert.cmyk.rgb = function(cmyk) {
570
- const c = cmyk[0] / 100;
571
- const m = cmyk[1] / 100;
572
- const y = cmyk[2] / 100;
573
- const k = cmyk[3] / 100;
574
- const r = 1 - Math.min(1, c * (1 - k) + k);
575
- const g = 1 - Math.min(1, m * (1 - k) + k);
576
- const b = 1 - Math.min(1, y * (1 - k) + k);
577
- return [r * 255, g * 255, b * 255];
578
- };
579
- convert.xyz.rgb = function(xyz) {
580
- const x = xyz[0] / 100;
581
- const y = xyz[1] / 100;
582
- const z = xyz[2] / 100;
583
- let r;
584
- let g;
585
- let b;
586
- r = x * 3.2406 + y * -1.5372 + z * -0.4986;
587
- g = x * -0.9689 + y * 1.8758 + z * 0.0415;
588
- b = x * 0.0557 + y * -0.204 + z * 1.057;
589
- r = r > 31308e-7 ? 1.055 * r ** (1 / 2.4) - 0.055 : r * 12.92;
590
- g = g > 31308e-7 ? 1.055 * g ** (1 / 2.4) - 0.055 : g * 12.92;
591
- b = b > 31308e-7 ? 1.055 * b ** (1 / 2.4) - 0.055 : b * 12.92;
592
- r = Math.min(Math.max(0, r), 1);
593
- g = Math.min(Math.max(0, g), 1);
594
- b = Math.min(Math.max(0, b), 1);
595
- return [r * 255, g * 255, b * 255];
596
- };
597
- convert.xyz.lab = function(xyz) {
598
- let x = xyz[0];
599
- let y = xyz[1];
600
- let z = xyz[2];
601
- x /= 95.047;
602
- y /= 100;
603
- z /= 108.883;
604
- x = x > 8856e-6 ? x ** (1 / 3) : 7.787 * x + 16 / 116;
605
- y = y > 8856e-6 ? y ** (1 / 3) : 7.787 * y + 16 / 116;
606
- z = z > 8856e-6 ? z ** (1 / 3) : 7.787 * z + 16 / 116;
607
- const l = 116 * y - 16;
608
- const a = 500 * (x - y);
609
- const b = 200 * (y - z);
610
- return [l, a, b];
611
- };
612
- convert.lab.xyz = function(lab) {
613
- const l = lab[0];
614
- const a = lab[1];
615
- const b = lab[2];
616
- let x;
617
- let y;
618
- let z;
619
- y = (l + 16) / 116;
620
- x = a / 500 + y;
621
- z = y - b / 200;
622
- const y2 = y ** 3;
623
- const x2 = x ** 3;
624
- const z2 = z ** 3;
625
- y = y2 > 8856e-6 ? y2 : (y - 16 / 116) / 7.787;
626
- x = x2 > 8856e-6 ? x2 : (x - 16 / 116) / 7.787;
627
- z = z2 > 8856e-6 ? z2 : (z - 16 / 116) / 7.787;
628
- x *= 95.047;
629
- y *= 100;
630
- z *= 108.883;
631
- return [x, y, z];
632
- };
633
- convert.lab.lch = function(lab) {
634
- const l = lab[0];
635
- const a = lab[1];
636
- const b = lab[2];
637
- let h;
638
- const hr = Math.atan2(b, a);
639
- h = hr * 360 / 2 / Math.PI;
640
- if (h < 0) {
641
- h += 360;
642
- }
643
- const c = Math.sqrt(a * a + b * b);
644
- return [l, c, h];
645
- };
646
- convert.lch.lab = function(lch) {
647
- const l = lch[0];
648
- const c = lch[1];
649
- const h = lch[2];
650
- const hr = h / 360 * 2 * Math.PI;
651
- const a = c * Math.cos(hr);
652
- const b = c * Math.sin(hr);
653
- return [l, a, b];
654
- };
655
- convert.rgb.ansi16 = function(args, saturation = null) {
656
- const [r, g, b] = args;
657
- let value = saturation === null ? convert.rgb.hsv(args)[2] : saturation;
658
- value = Math.round(value / 50);
659
- if (value === 0) {
660
- return 30;
661
- }
662
- let ansi = 30 + (Math.round(b / 255) << 2 | Math.round(g / 255) << 1 | Math.round(r / 255));
663
- if (value === 2) {
664
- ansi += 60;
665
- }
666
- return ansi;
667
- };
668
- convert.hsv.ansi16 = function(args) {
669
- return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
670
- };
671
- convert.rgb.ansi256 = function(args) {
672
- const r = args[0];
673
- const g = args[1];
674
- const b = args[2];
675
- if (r === g && g === b) {
676
- if (r < 8) {
677
- return 16;
678
- }
679
- if (r > 248) {
680
- return 231;
681
- }
682
- return Math.round((r - 8) / 247 * 24) + 232;
683
- }
684
- const ansi = 16 + 36 * Math.round(r / 255 * 5) + 6 * Math.round(g / 255 * 5) + Math.round(b / 255 * 5);
685
- return ansi;
686
- };
687
- convert.ansi16.rgb = function(args) {
688
- let color = args % 10;
689
- if (color === 0 || color === 7) {
690
- if (args > 50) {
691
- color += 3.5;
692
- }
693
- color = color / 10.5 * 255;
694
- return [color, color, color];
695
- }
696
- const mult = (~~(args > 50) + 1) * 0.5;
697
- const r = (color & 1) * mult * 255;
698
- const g = (color >> 1 & 1) * mult * 255;
699
- const b = (color >> 2 & 1) * mult * 255;
700
- return [r, g, b];
701
- };
702
- convert.ansi256.rgb = function(args) {
703
- if (args >= 232) {
704
- const c = (args - 232) * 10 + 8;
705
- return [c, c, c];
706
- }
707
- args -= 16;
708
- let rem;
709
- const r = Math.floor(args / 36) / 5 * 255;
710
- const g = Math.floor((rem = args % 36) / 6) / 5 * 255;
711
- const b = rem % 6 / 5 * 255;
712
- return [r, g, b];
713
- };
714
- convert.rgb.hex = function(args) {
715
- const integer = ((Math.round(args[0]) & 255) << 16) + ((Math.round(args[1]) & 255) << 8) + (Math.round(args[2]) & 255);
716
- const string = integer.toString(16).toUpperCase();
717
- return "000000".substring(string.length) + string;
718
- };
719
- convert.hex.rgb = function(args) {
720
- const match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
721
- if (!match) {
722
- return [0, 0, 0];
723
- }
724
- let colorString = match[0];
725
- if (match[0].length === 3) {
726
- colorString = colorString.split("").map((char) => {
727
- return char + char;
728
- }).join("");
729
- }
730
- const integer = parseInt(colorString, 16);
731
- const r = integer >> 16 & 255;
732
- const g = integer >> 8 & 255;
733
- const b = integer & 255;
734
- return [r, g, b];
735
- };
736
- convert.rgb.hcg = function(rgb) {
737
- const r = rgb[0] / 255;
738
- const g = rgb[1] / 255;
739
- const b = rgb[2] / 255;
740
- const max = Math.max(Math.max(r, g), b);
741
- const min = Math.min(Math.min(r, g), b);
742
- const chroma = max - min;
743
- let grayscale;
744
- let hue;
745
- if (chroma < 1) {
746
- grayscale = min / (1 - chroma);
747
- } else {
748
- grayscale = 0;
749
- }
750
- if (chroma <= 0) {
751
- hue = 0;
752
- } else if (max === r) {
753
- hue = (g - b) / chroma % 6;
754
- } else if (max === g) {
755
- hue = 2 + (b - r) / chroma;
756
- } else {
757
- hue = 4 + (r - g) / chroma;
758
- }
759
- hue /= 6;
760
- hue %= 1;
761
- return [hue * 360, chroma * 100, grayscale * 100];
762
- };
763
- convert.hsl.hcg = function(hsl) {
764
- const s = hsl[1] / 100;
765
- const l = hsl[2] / 100;
766
- const c = l < 0.5 ? 2 * s * l : 2 * s * (1 - l);
767
- let f = 0;
768
- if (c < 1) {
769
- f = (l - 0.5 * c) / (1 - c);
770
- }
771
- return [hsl[0], c * 100, f * 100];
772
- };
773
- convert.hsv.hcg = function(hsv) {
774
- const s = hsv[1] / 100;
775
- const v = hsv[2] / 100;
776
- const c = s * v;
777
- let f = 0;
778
- if (c < 1) {
779
- f = (v - c) / (1 - c);
780
- }
781
- return [hsv[0], c * 100, f * 100];
782
- };
783
- convert.hcg.rgb = function(hcg) {
784
- const h = hcg[0] / 360;
785
- const c = hcg[1] / 100;
786
- const g = hcg[2] / 100;
787
- if (c === 0) {
788
- return [g * 255, g * 255, g * 255];
789
- }
790
- const pure = [0, 0, 0];
791
- const hi = h % 1 * 6;
792
- const v = hi % 1;
793
- const w = 1 - v;
794
- let mg = 0;
795
- switch (Math.floor(hi)) {
796
- case 0:
797
- pure[0] = 1;
798
- pure[1] = v;
799
- pure[2] = 0;
800
- break;
801
- case 1:
802
- pure[0] = w;
803
- pure[1] = 1;
804
- pure[2] = 0;
805
- break;
806
- case 2:
807
- pure[0] = 0;
808
- pure[1] = 1;
809
- pure[2] = v;
810
- break;
811
- case 3:
812
- pure[0] = 0;
813
- pure[1] = w;
814
- pure[2] = 1;
815
- break;
816
- case 4:
817
- pure[0] = v;
818
- pure[1] = 0;
819
- pure[2] = 1;
820
- break;
821
- default:
822
- pure[0] = 1;
823
- pure[1] = 0;
824
- pure[2] = w;
825
- }
826
- mg = (1 - c) * g;
827
- return [
828
- (c * pure[0] + mg) * 255,
829
- (c * pure[1] + mg) * 255,
830
- (c * pure[2] + mg) * 255
831
- ];
832
- };
833
- convert.hcg.hsv = function(hcg) {
834
- const c = hcg[1] / 100;
835
- const g = hcg[2] / 100;
836
- const v = c + g * (1 - c);
837
- let f = 0;
838
- if (v > 0) {
839
- f = c / v;
840
- }
841
- return [hcg[0], f * 100, v * 100];
842
- };
843
- convert.hcg.hsl = function(hcg) {
844
- const c = hcg[1] / 100;
845
- const g = hcg[2] / 100;
846
- const l = g * (1 - c) + 0.5 * c;
847
- let s = 0;
848
- if (l > 0 && l < 0.5) {
849
- s = c / (2 * l);
850
- } else if (l >= 0.5 && l < 1) {
851
- s = c / (2 * (1 - l));
852
- }
853
- return [hcg[0], s * 100, l * 100];
854
- };
855
- convert.hcg.hwb = function(hcg) {
856
- const c = hcg[1] / 100;
857
- const g = hcg[2] / 100;
858
- const v = c + g * (1 - c);
859
- return [hcg[0], (v - c) * 100, (1 - v) * 100];
860
- };
861
- convert.hwb.hcg = function(hwb) {
862
- const w = hwb[1] / 100;
863
- const b = hwb[2] / 100;
864
- const v = 1 - b;
865
- const c = v - w;
866
- let g = 0;
867
- if (c < 1) {
868
- g = (v - c) / (1 - c);
869
- }
870
- return [hwb[0], c * 100, g * 100];
871
- };
872
- convert.apple.rgb = function(apple) {
873
- return [apple[0] / 65535 * 255, apple[1] / 65535 * 255, apple[2] / 65535 * 255];
874
- };
875
- convert.rgb.apple = function(rgb) {
876
- return [rgb[0] / 255 * 65535, rgb[1] / 255 * 65535, rgb[2] / 255 * 65535];
877
- };
878
- convert.gray.rgb = function(args) {
879
- return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
880
- };
881
- convert.gray.hsl = function(args) {
882
- return [0, 0, args[0]];
883
- };
884
- convert.gray.hsv = convert.gray.hsl;
885
- convert.gray.hwb = function(gray) {
886
- return [0, 100, gray[0]];
887
- };
888
- convert.gray.cmyk = function(gray) {
889
- return [0, 0, 0, gray[0]];
890
- };
891
- convert.gray.lab = function(gray) {
892
- return [gray[0], 0, 0];
893
- };
894
- convert.gray.hex = function(gray) {
895
- const val = Math.round(gray[0] / 100 * 255) & 255;
896
- const integer = (val << 16) + (val << 8) + val;
897
- const string = integer.toString(16).toUpperCase();
898
- return "000000".substring(string.length) + string;
899
- };
900
- convert.rgb.gray = function(rgb) {
901
- const val = (rgb[0] + rgb[1] + rgb[2]) / 3;
902
- return [val / 255 * 100];
903
- };
904
- return conversions$1;
905
- }
906
- var route$1;
907
- var hasRequiredRoute$1;
908
- function requireRoute$1() {
909
- if (hasRequiredRoute$1) return route$1;
910
- hasRequiredRoute$1 = 1;
911
- const conversions2 = requireConversions$1();
912
- function buildGraph() {
913
- const graph = {};
914
- const models = Object.keys(conversions2);
915
- for (let len = models.length, i2 = 0; i2 < len; i2++) {
916
- graph[models[i2]] = {
917
- // http://jsperf.com/1-vs-infinity
918
- // micro-opt, but this is simple.
919
- distance: -1,
920
- parent: null
921
- };
922
- }
923
- return graph;
924
- }
925
- function deriveBFS(fromModel) {
926
- const graph = buildGraph();
927
- const queue = [fromModel];
928
- graph[fromModel].distance = 0;
929
- while (queue.length) {
930
- const current = queue.pop();
931
- const adjacents = Object.keys(conversions2[current]);
932
- for (let len = adjacents.length, i2 = 0; i2 < len; i2++) {
933
- const adjacent = adjacents[i2];
934
- const node = graph[adjacent];
935
- if (node.distance === -1) {
936
- node.distance = graph[current].distance + 1;
937
- node.parent = current;
938
- queue.unshift(adjacent);
939
- }
940
- }
941
- }
942
- return graph;
943
- }
944
- function link(from, to) {
945
- return function(args) {
946
- return to(from(args));
947
- };
948
- }
949
- function wrapConversion(toModel, graph) {
950
- const path2 = [graph[toModel].parent, toModel];
951
- let fn = conversions2[graph[toModel].parent][toModel];
952
- let cur = graph[toModel].parent;
953
- while (graph[cur].parent) {
954
- path2.unshift(graph[cur].parent);
955
- fn = link(conversions2[graph[cur].parent][cur], fn);
956
- cur = graph[cur].parent;
957
- }
958
- fn.conversion = path2;
959
- return fn;
960
- }
961
- route$1 = function(fromModel) {
962
- const graph = deriveBFS(fromModel);
963
- const conversion = {};
964
- const models = Object.keys(graph);
965
- for (let len = models.length, i2 = 0; i2 < len; i2++) {
966
- const toModel = models[i2];
967
- const node = graph[toModel];
968
- if (node.parent === null) {
969
- continue;
970
- }
971
- conversion[toModel] = wrapConversion(toModel, graph);
972
- }
973
- return conversion;
974
- };
975
- return route$1;
976
- }
977
- var colorConvert$1;
978
- var hasRequiredColorConvert$1;
979
- function requireColorConvert$1() {
980
- if (hasRequiredColorConvert$1) return colorConvert$1;
981
- hasRequiredColorConvert$1 = 1;
982
- const conversions2 = requireConversions$1();
983
- const route2 = requireRoute$1();
984
- const convert = {};
985
- const models = Object.keys(conversions2);
986
- function wrapRaw(fn) {
987
- const wrappedFn = function(...args) {
988
- const arg0 = args[0];
989
- if (arg0 === void 0 || arg0 === null) {
990
- return arg0;
991
- }
992
- if (arg0.length > 1) {
993
- args = arg0;
994
- }
995
- return fn(args);
996
- };
997
- if ("conversion" in fn) {
998
- wrappedFn.conversion = fn.conversion;
999
- }
1000
- return wrappedFn;
1001
- }
1002
- function wrapRounded(fn) {
1003
- const wrappedFn = function(...args) {
1004
- const arg0 = args[0];
1005
- if (arg0 === void 0 || arg0 === null) {
1006
- return arg0;
1007
- }
1008
- if (arg0.length > 1) {
1009
- args = arg0;
1010
- }
1011
- const result = fn(args);
1012
- if (typeof result === "object") {
1013
- for (let len = result.length, i2 = 0; i2 < len; i2++) {
1014
- result[i2] = Math.round(result[i2]);
1015
- }
1016
- }
1017
- return result;
1018
- };
1019
- if ("conversion" in fn) {
1020
- wrappedFn.conversion = fn.conversion;
1021
- }
1022
- return wrappedFn;
1023
- }
1024
- models.forEach((fromModel) => {
1025
- convert[fromModel] = {};
1026
- Object.defineProperty(convert[fromModel], "channels", { value: conversions2[fromModel].channels });
1027
- Object.defineProperty(convert[fromModel], "labels", { value: conversions2[fromModel].labels });
1028
- const routes = route2(fromModel);
1029
- const routeModels = Object.keys(routes);
1030
- routeModels.forEach((toModel) => {
1031
- const fn = routes[toModel];
1032
- convert[fromModel][toModel] = wrapRounded(fn);
1033
- convert[fromModel][toModel].raw = wrapRaw(fn);
1034
- });
1035
- });
1036
- colorConvert$1 = convert;
1037
- return colorConvert$1;
1038
- }
1039
- ansiStyles$3.exports;
1040
- (function(module2) {
1041
- const wrapAnsi16 = (fn, offset) => (...args) => {
1042
- const code = fn(...args);
1043
- return `\x1B[${code + offset}m`;
1044
- };
1045
- const wrapAnsi256 = (fn, offset) => (...args) => {
1046
- const code = fn(...args);
1047
- return `\x1B[${38 + offset};5;${code}m`;
1048
- };
1049
- const wrapAnsi16m = (fn, offset) => (...args) => {
1050
- const rgb = fn(...args);
1051
- return `\x1B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
1052
- };
1053
- const ansi2ansi = (n) => n;
1054
- const rgb2rgb = (r, g, b) => [r, g, b];
1055
- const setLazyProperty = (object, property, get) => {
1056
- Object.defineProperty(object, property, {
1057
- get: () => {
1058
- const value = get();
1059
- Object.defineProperty(object, property, {
1060
- value,
1061
- enumerable: true,
1062
- configurable: true
1063
- });
1064
- return value;
1065
- },
1066
- enumerable: true,
1067
- configurable: true
1068
- });
1069
- };
1070
- let colorConvert2;
1071
- const makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => {
1072
- if (colorConvert2 === void 0) {
1073
- colorConvert2 = requireColorConvert$1();
1074
- }
1075
- const offset = isBackground ? 10 : 0;
1076
- const styles2 = {};
1077
- for (const [sourceSpace, suite] of Object.entries(colorConvert2)) {
1078
- const name2 = sourceSpace === "ansi16" ? "ansi" : sourceSpace;
1079
- if (sourceSpace === targetSpace) {
1080
- styles2[name2] = wrap(identity, offset);
1081
- } else if (typeof suite === "object") {
1082
- styles2[name2] = wrap(suite[targetSpace], offset);
1083
- }
1084
- }
1085
- return styles2;
1086
- };
1087
- function assembleStyles() {
1088
- const codes = /* @__PURE__ */ new Map();
1089
- const styles2 = {
1090
- modifier: {
1091
- reset: [0, 0],
1092
- // 21 isn't widely supported and 22 does the same thing
1093
- bold: [1, 22],
1094
- dim: [2, 22],
1095
- italic: [3, 23],
1096
- underline: [4, 24],
1097
- inverse: [7, 27],
1098
- hidden: [8, 28],
1099
- strikethrough: [9, 29]
1100
- },
1101
- color: {
1102
- black: [30, 39],
1103
- red: [31, 39],
1104
- green: [32, 39],
1105
- yellow: [33, 39],
1106
- blue: [34, 39],
1107
- magenta: [35, 39],
1108
- cyan: [36, 39],
1109
- white: [37, 39],
1110
- // Bright color
1111
- blackBright: [90, 39],
1112
- redBright: [91, 39],
1113
- greenBright: [92, 39],
1114
- yellowBright: [93, 39],
1115
- blueBright: [94, 39],
1116
- magentaBright: [95, 39],
1117
- cyanBright: [96, 39],
1118
- whiteBright: [97, 39]
1119
- },
1120
- bgColor: {
1121
- bgBlack: [40, 49],
1122
- bgRed: [41, 49],
1123
- bgGreen: [42, 49],
1124
- bgYellow: [43, 49],
1125
- bgBlue: [44, 49],
1126
- bgMagenta: [45, 49],
1127
- bgCyan: [46, 49],
1128
- bgWhite: [47, 49],
1129
- // Bright color
1130
- bgBlackBright: [100, 49],
1131
- bgRedBright: [101, 49],
1132
- bgGreenBright: [102, 49],
1133
- bgYellowBright: [103, 49],
1134
- bgBlueBright: [104, 49],
1135
- bgMagentaBright: [105, 49],
1136
- bgCyanBright: [106, 49],
1137
- bgWhiteBright: [107, 49]
1138
- }
1139
- };
1140
- styles2.color.gray = styles2.color.blackBright;
1141
- styles2.bgColor.bgGray = styles2.bgColor.bgBlackBright;
1142
- styles2.color.grey = styles2.color.blackBright;
1143
- styles2.bgColor.bgGrey = styles2.bgColor.bgBlackBright;
1144
- for (const [groupName, group] of Object.entries(styles2)) {
1145
- for (const [styleName, style] of Object.entries(group)) {
1146
- styles2[styleName] = {
1147
- open: `\x1B[${style[0]}m`,
1148
- close: `\x1B[${style[1]}m`
1149
- };
1150
- group[styleName] = styles2[styleName];
1151
- codes.set(style[0], style[1]);
1152
- }
1153
- Object.defineProperty(styles2, groupName, {
1154
- value: group,
1155
- enumerable: false
1156
- });
1157
- }
1158
- Object.defineProperty(styles2, "codes", {
1159
- value: codes,
1160
- enumerable: false
1161
- });
1162
- styles2.color.close = "\x1B[39m";
1163
- styles2.bgColor.close = "\x1B[49m";
1164
- setLazyProperty(styles2.color, "ansi", () => makeDynamicStyles(wrapAnsi16, "ansi16", ansi2ansi, false));
1165
- setLazyProperty(styles2.color, "ansi256", () => makeDynamicStyles(wrapAnsi256, "ansi256", ansi2ansi, false));
1166
- setLazyProperty(styles2.color, "ansi16m", () => makeDynamicStyles(wrapAnsi16m, "rgb", rgb2rgb, false));
1167
- setLazyProperty(styles2.bgColor, "ansi", () => makeDynamicStyles(wrapAnsi16, "ansi16", ansi2ansi, true));
1168
- setLazyProperty(styles2.bgColor, "ansi256", () => makeDynamicStyles(wrapAnsi256, "ansi256", ansi2ansi, true));
1169
- setLazyProperty(styles2.bgColor, "ansi16m", () => makeDynamicStyles(wrapAnsi16m, "rgb", rgb2rgb, true));
1170
- return styles2;
1171
- }
1172
- Object.defineProperty(module2, "exports", {
1173
- enumerable: true,
1174
- get: assembleStyles
1175
- });
1176
- })(ansiStyles$3);
1177
- var ansiStylesExports$1 = ansiStyles$3.exports;
1178
- var browser$2 = {
1179
- stdout: false,
1180
- stderr: false
1181
- };
1182
- const stringReplaceAll$3 = (string, substring, replacer) => {
1183
- let index = string.indexOf(substring);
1184
- if (index === -1) {
1185
- return string;
1186
- }
1187
- const substringLength = substring.length;
1188
- let endIndex = 0;
1189
- let returnValue = "";
1190
- do {
1191
- returnValue += string.substr(endIndex, index - endIndex) + substring + replacer;
1192
- endIndex = index + substringLength;
1193
- index = string.indexOf(substring, endIndex);
1194
- } while (index !== -1);
1195
- returnValue += string.substr(endIndex);
1196
- return returnValue;
1197
- };
1198
- const stringEncaseCRLFWithFirstIndex$3 = (string, prefix, postfix, index) => {
1199
- let endIndex = 0;
1200
- let returnValue = "";
1201
- do {
1202
- const gotCR = string[index - 1] === "\r";
1203
- returnValue += string.substr(endIndex, (gotCR ? index - 1 : index) - endIndex) + prefix + (gotCR ? "\r\n" : "\n") + postfix;
1204
- endIndex = index + 1;
1205
- index = string.indexOf("\n", endIndex);
1206
- } while (index !== -1);
1207
- returnValue += string.substr(endIndex);
1208
- return returnValue;
1209
- };
1210
- var util$1 = {
1211
- stringReplaceAll: stringReplaceAll$3,
1212
- stringEncaseCRLFWithFirstIndex: stringEncaseCRLFWithFirstIndex$3
1213
- };
1214
- var templates$1;
1215
- var hasRequiredTemplates$1;
1216
- function requireTemplates$1() {
1217
- if (hasRequiredTemplates$1) return templates$1;
1218
- hasRequiredTemplates$1 = 1;
1219
- const TEMPLATE_REGEX = /(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;
1220
- const STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
1221
- const STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;
1222
- const ESCAPE_REGEX = /\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi;
1223
- const ESCAPES = /* @__PURE__ */ new Map([
1224
- ["n", "\n"],
1225
- ["r", "\r"],
1226
- ["t", " "],
1227
- ["b", "\b"],
1228
- ["f", "\f"],
1229
- ["v", "\v"],
1230
- ["0", "\0"],
1231
- ["\\", "\\"],
1232
- ["e", "\x1B"],
1233
- ["a", "\x07"]
1234
- ]);
1235
- function unescape(c) {
1236
- const u = c[0] === "u";
1237
- const bracket = c[1] === "{";
1238
- if (u && !bracket && c.length === 5 || c[0] === "x" && c.length === 3) {
1239
- return String.fromCharCode(parseInt(c.slice(1), 16));
1240
- }
1241
- if (u && bracket) {
1242
- return String.fromCodePoint(parseInt(c.slice(2, -1), 16));
1243
- }
1244
- return ESCAPES.get(c) || c;
1245
- }
1246
- function parseArguments(name2, arguments_) {
1247
- const results = [];
1248
- const chunks = arguments_.trim().split(/\s*,\s*/g);
1249
- let matches;
1250
- for (const chunk of chunks) {
1251
- const number = Number(chunk);
1252
- if (!Number.isNaN(number)) {
1253
- results.push(number);
1254
- } else if (matches = chunk.match(STRING_REGEX)) {
1255
- results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, character) => escape ? unescape(escape) : character));
1256
- } else {
1257
- throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name2}')`);
1258
- }
1259
- }
1260
- return results;
1261
- }
1262
- function parseStyle(style) {
1263
- STYLE_REGEX.lastIndex = 0;
1264
- const results = [];
1265
- let matches;
1266
- while ((matches = STYLE_REGEX.exec(style)) !== null) {
1267
- const name2 = matches[1];
1268
- if (matches[2]) {
1269
- const args = parseArguments(name2, matches[2]);
1270
- results.push([name2].concat(args));
1271
- } else {
1272
- results.push([name2]);
1273
- }
1274
- }
1275
- return results;
1276
- }
1277
- function buildStyle(chalk2, styles2) {
1278
- const enabled = {};
1279
- for (const layer of styles2) {
1280
- for (const style of layer.styles) {
1281
- enabled[style[0]] = layer.inverse ? null : style.slice(1);
1282
- }
1283
- }
1284
- let current = chalk2;
1285
- for (const [styleName, styles3] of Object.entries(enabled)) {
1286
- if (!Array.isArray(styles3)) {
1287
- continue;
1288
- }
1289
- if (!(styleName in current)) {
1290
- throw new Error(`Unknown Chalk style: ${styleName}`);
1291
- }
1292
- current = styles3.length > 0 ? current[styleName](...styles3) : current[styleName];
1293
- }
1294
- return current;
1295
- }
1296
- templates$1 = (chalk2, temporary) => {
1297
- const styles2 = [];
1298
- const chunks = [];
1299
- let chunk = [];
1300
- temporary.replace(TEMPLATE_REGEX, (m, escapeCharacter, inverse, style, close, character) => {
1301
- if (escapeCharacter) {
1302
- chunk.push(unescape(escapeCharacter));
1303
- } else if (style) {
1304
- const string = chunk.join("");
1305
- chunk = [];
1306
- chunks.push(styles2.length === 0 ? string : buildStyle(chalk2, styles2)(string));
1307
- styles2.push({ inverse, styles: parseStyle(style) });
1308
- } else if (close) {
1309
- if (styles2.length === 0) {
1310
- throw new Error("Found extraneous } in Chalk template literal");
1311
- }
1312
- chunks.push(buildStyle(chalk2, styles2)(chunk.join("")));
1313
- chunk = [];
1314
- styles2.pop();
1315
- } else {
1316
- chunk.push(character);
1317
- }
1318
- });
1319
- chunks.push(chunk.join(""));
1320
- if (styles2.length > 0) {
1321
- const errMessage = `Chalk template literal is missing ${styles2.length} closing bracket${styles2.length === 1 ? "" : "s"} (\`}\`)`;
1322
- throw new Error(errMessage);
1323
- }
1324
- return chunks.join("");
1325
- };
1326
- return templates$1;
1327
- }
1328
- const ansiStyles$2 = ansiStylesExports$1;
1329
- const { stdout: stdoutColor$1, stderr: stderrColor$1 } = browser$2;
1330
- const {
1331
- stringReplaceAll: stringReplaceAll$2,
1332
- stringEncaseCRLFWithFirstIndex: stringEncaseCRLFWithFirstIndex$2
1333
- } = util$1;
1334
- const { isArray: isArray$1 } = Array;
1335
- const levelMapping$1 = [
1336
- "ansi",
1337
- "ansi",
1338
- "ansi256",
1339
- "ansi16m"
1340
- ];
1341
- const styles$1 = /* @__PURE__ */ Object.create(null);
1342
- const applyOptions$1 = (object, options = {}) => {
1343
- if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
1344
- throw new Error("The `level` option should be an integer from 0 to 3");
1345
- }
1346
- const colorLevel = stdoutColor$1 ? stdoutColor$1.level : 0;
1347
- object.level = options.level === void 0 ? colorLevel : options.level;
1348
- };
1349
- let ChalkClass$1 = class ChalkClass {
1350
- constructor(options) {
1351
- return chalkFactory$1(options);
1352
- }
1353
- };
1354
- const chalkFactory$1 = (options) => {
1355
- const chalk2 = {};
1356
- applyOptions$1(chalk2, options);
1357
- chalk2.template = (...arguments_) => chalkTag$1(chalk2.template, ...arguments_);
1358
- Object.setPrototypeOf(chalk2, Chalk$1.prototype);
1359
- Object.setPrototypeOf(chalk2.template, chalk2);
1360
- chalk2.template.constructor = () => {
1361
- throw new Error("`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.");
1362
- };
1363
- chalk2.template.Instance = ChalkClass$1;
1364
- return chalk2.template;
1365
- };
1366
- function Chalk$1(options) {
1367
- return chalkFactory$1(options);
1368
- }
1369
- for (const [styleName, style] of Object.entries(ansiStyles$2)) {
1370
- styles$1[styleName] = {
1371
- get() {
1372
- const builder = createBuilder$1(this, createStyler$1(style.open, style.close, this._styler), this._isEmpty);
1373
- Object.defineProperty(this, styleName, { value: builder });
1374
- return builder;
1375
- }
1376
- };
1377
- }
1378
- styles$1.visible = {
1379
- get() {
1380
- const builder = createBuilder$1(this, this._styler, true);
1381
- Object.defineProperty(this, "visible", { value: builder });
1382
- return builder;
1383
- }
1384
- };
1385
- const usedModels$1 = ["rgb", "hex", "keyword", "hsl", "hsv", "hwb", "ansi", "ansi256"];
1386
- for (const model of usedModels$1) {
1387
- styles$1[model] = {
1388
- get() {
1389
- const { level } = this;
1390
- return function(...arguments_) {
1391
- const styler = createStyler$1(ansiStyles$2.color[levelMapping$1[level]][model](...arguments_), ansiStyles$2.color.close, this._styler);
1392
- return createBuilder$1(this, styler, this._isEmpty);
1393
- };
1394
- }
1395
- };
1396
- }
1397
- for (const model of usedModels$1) {
1398
- const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
1399
- styles$1[bgModel] = {
1400
- get() {
1401
- const { level } = this;
1402
- return function(...arguments_) {
1403
- const styler = createStyler$1(ansiStyles$2.bgColor[levelMapping$1[level]][model](...arguments_), ansiStyles$2.bgColor.close, this._styler);
1404
- return createBuilder$1(this, styler, this._isEmpty);
1405
- };
1406
- }
1407
- };
1408
- }
1409
- const proto$1 = Object.defineProperties(() => {
1410
- }, {
1411
- ...styles$1,
1412
- level: {
1413
- enumerable: true,
1414
- get() {
1415
- return this._generator.level;
1416
- },
1417
- set(level) {
1418
- this._generator.level = level;
1419
- }
1420
- }
1421
- });
1422
- const createStyler$1 = (open, close, parent) => {
1423
- let openAll;
1424
- let closeAll;
1425
- if (parent === void 0) {
1426
- openAll = open;
1427
- closeAll = close;
1428
- } else {
1429
- openAll = parent.openAll + open;
1430
- closeAll = close + parent.closeAll;
1431
- }
1432
- return {
1433
- open,
1434
- close,
1435
- openAll,
1436
- closeAll,
1437
- parent
1438
- };
1439
- };
1440
- const createBuilder$1 = (self2, _styler, _isEmpty) => {
1441
- const builder = (...arguments_) => {
1442
- if (isArray$1(arguments_[0]) && isArray$1(arguments_[0].raw)) {
1443
- return applyStyle$1(builder, chalkTag$1(builder, ...arguments_));
1444
- }
1445
- return applyStyle$1(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
1446
- };
1447
- Object.setPrototypeOf(builder, proto$1);
1448
- builder._generator = self2;
1449
- builder._styler = _styler;
1450
- builder._isEmpty = _isEmpty;
1451
- return builder;
1452
- };
1453
- const applyStyle$1 = (self2, string) => {
1454
- if (self2.level <= 0 || !string) {
1455
- return self2._isEmpty ? "" : string;
1456
- }
1457
- let styler = self2._styler;
1458
- if (styler === void 0) {
1459
- return string;
1460
- }
1461
- const { openAll, closeAll } = styler;
1462
- if (string.indexOf("\x1B") !== -1) {
1463
- while (styler !== void 0) {
1464
- string = stringReplaceAll$2(string, styler.close, styler.open);
1465
- styler = styler.parent;
1466
- }
1467
- }
1468
- const lfIndex = string.indexOf("\n");
1469
- if (lfIndex !== -1) {
1470
- string = stringEncaseCRLFWithFirstIndex$2(string, closeAll, openAll, lfIndex);
1471
- }
1472
- return openAll + string + closeAll;
1473
- };
1474
- let template$1;
1475
- const chalkTag$1 = (chalk2, ...strings) => {
1476
- const [firstString] = strings;
1477
- if (!isArray$1(firstString) || !isArray$1(firstString.raw)) {
1478
- return strings.join(" ");
1479
- }
1480
- const arguments_ = strings.slice(1);
1481
- const parts = [firstString.raw[0]];
1482
- for (let i2 = 1; i2 < firstString.length; i2++) {
1483
- parts.push(
1484
- String(arguments_[i2 - 1]).replace(/[{}\\]/g, "\\$&"),
1485
- String(firstString.raw[i2])
1486
- );
1487
- }
1488
- if (template$1 === void 0) {
1489
- template$1 = requireTemplates$1();
1490
- }
1491
- return template$1(chalk2, parts.join(""));
1492
- };
1493
- Object.defineProperties(Chalk$1.prototype, styles$1);
1494
- const chalk$1 = Chalk$1();
1495
- chalk$1.supportsColor = stdoutColor$1;
1496
- chalk$1.stderr = Chalk$1({ level: stderrColor$1 ? stderrColor$1.level : 0 });
1497
- chalk$1.stderr.supportsColor = stderrColor$1;
1498
- var source = chalk$1;
1499
- const chalk$2 = /* @__PURE__ */ getDefaultExportFromCjs(source);
1500
- var StatusCodes;
1501
- (function(StatusCodes2) {
1502
- StatusCodes2[StatusCodes2["CONTINUE"] = 100] = "CONTINUE";
1503
- StatusCodes2[StatusCodes2["SWITCHING_PROTOCOLS"] = 101] = "SWITCHING_PROTOCOLS";
1504
- StatusCodes2[StatusCodes2["PROCESSING"] = 102] = "PROCESSING";
1505
- StatusCodes2[StatusCodes2["EARLY_HINTS"] = 103] = "EARLY_HINTS";
1506
- StatusCodes2[StatusCodes2["OK"] = 200] = "OK";
1507
- StatusCodes2[StatusCodes2["CREATED"] = 201] = "CREATED";
1508
- StatusCodes2[StatusCodes2["ACCEPTED"] = 202] = "ACCEPTED";
1509
- StatusCodes2[StatusCodes2["NON_AUTHORITATIVE_INFORMATION"] = 203] = "NON_AUTHORITATIVE_INFORMATION";
1510
- StatusCodes2[StatusCodes2["NO_CONTENT"] = 204] = "NO_CONTENT";
1511
- StatusCodes2[StatusCodes2["RESET_CONTENT"] = 205] = "RESET_CONTENT";
1512
- StatusCodes2[StatusCodes2["PARTIAL_CONTENT"] = 206] = "PARTIAL_CONTENT";
1513
- StatusCodes2[StatusCodes2["MULTI_STATUS"] = 207] = "MULTI_STATUS";
1514
- StatusCodes2[StatusCodes2["MULTIPLE_CHOICES"] = 300] = "MULTIPLE_CHOICES";
1515
- StatusCodes2[StatusCodes2["MOVED_PERMANENTLY"] = 301] = "MOVED_PERMANENTLY";
1516
- StatusCodes2[StatusCodes2["MOVED_TEMPORARILY"] = 302] = "MOVED_TEMPORARILY";
1517
- StatusCodes2[StatusCodes2["SEE_OTHER"] = 303] = "SEE_OTHER";
1518
- StatusCodes2[StatusCodes2["NOT_MODIFIED"] = 304] = "NOT_MODIFIED";
1519
- StatusCodes2[StatusCodes2["USE_PROXY"] = 305] = "USE_PROXY";
1520
- StatusCodes2[StatusCodes2["TEMPORARY_REDIRECT"] = 307] = "TEMPORARY_REDIRECT";
1521
- StatusCodes2[StatusCodes2["PERMANENT_REDIRECT"] = 308] = "PERMANENT_REDIRECT";
1522
- StatusCodes2[StatusCodes2["BAD_REQUEST"] = 400] = "BAD_REQUEST";
1523
- StatusCodes2[StatusCodes2["UNAUTHORIZED"] = 401] = "UNAUTHORIZED";
1524
- StatusCodes2[StatusCodes2["PAYMENT_REQUIRED"] = 402] = "PAYMENT_REQUIRED";
1525
- StatusCodes2[StatusCodes2["FORBIDDEN"] = 403] = "FORBIDDEN";
1526
- StatusCodes2[StatusCodes2["NOT_FOUND"] = 404] = "NOT_FOUND";
1527
- StatusCodes2[StatusCodes2["METHOD_NOT_ALLOWED"] = 405] = "METHOD_NOT_ALLOWED";
1528
- StatusCodes2[StatusCodes2["NOT_ACCEPTABLE"] = 406] = "NOT_ACCEPTABLE";
1529
- StatusCodes2[StatusCodes2["PROXY_AUTHENTICATION_REQUIRED"] = 407] = "PROXY_AUTHENTICATION_REQUIRED";
1530
- StatusCodes2[StatusCodes2["REQUEST_TIMEOUT"] = 408] = "REQUEST_TIMEOUT";
1531
- StatusCodes2[StatusCodes2["CONFLICT"] = 409] = "CONFLICT";
1532
- StatusCodes2[StatusCodes2["GONE"] = 410] = "GONE";
1533
- StatusCodes2[StatusCodes2["LENGTH_REQUIRED"] = 411] = "LENGTH_REQUIRED";
1534
- StatusCodes2[StatusCodes2["PRECONDITION_FAILED"] = 412] = "PRECONDITION_FAILED";
1535
- StatusCodes2[StatusCodes2["REQUEST_TOO_LONG"] = 413] = "REQUEST_TOO_LONG";
1536
- StatusCodes2[StatusCodes2["REQUEST_URI_TOO_LONG"] = 414] = "REQUEST_URI_TOO_LONG";
1537
- StatusCodes2[StatusCodes2["UNSUPPORTED_MEDIA_TYPE"] = 415] = "UNSUPPORTED_MEDIA_TYPE";
1538
- StatusCodes2[StatusCodes2["REQUESTED_RANGE_NOT_SATISFIABLE"] = 416] = "REQUESTED_RANGE_NOT_SATISFIABLE";
1539
- StatusCodes2[StatusCodes2["EXPECTATION_FAILED"] = 417] = "EXPECTATION_FAILED";
1540
- StatusCodes2[StatusCodes2["IM_A_TEAPOT"] = 418] = "IM_A_TEAPOT";
1541
- StatusCodes2[StatusCodes2["INSUFFICIENT_SPACE_ON_RESOURCE"] = 419] = "INSUFFICIENT_SPACE_ON_RESOURCE";
1542
- StatusCodes2[StatusCodes2["METHOD_FAILURE"] = 420] = "METHOD_FAILURE";
1543
- StatusCodes2[StatusCodes2["MISDIRECTED_REQUEST"] = 421] = "MISDIRECTED_REQUEST";
1544
- StatusCodes2[StatusCodes2["UNPROCESSABLE_ENTITY"] = 422] = "UNPROCESSABLE_ENTITY";
1545
- StatusCodes2[StatusCodes2["LOCKED"] = 423] = "LOCKED";
1546
- StatusCodes2[StatusCodes2["FAILED_DEPENDENCY"] = 424] = "FAILED_DEPENDENCY";
1547
- StatusCodes2[StatusCodes2["UPGRADE_REQUIRED"] = 426] = "UPGRADE_REQUIRED";
1548
- StatusCodes2[StatusCodes2["PRECONDITION_REQUIRED"] = 428] = "PRECONDITION_REQUIRED";
1549
- StatusCodes2[StatusCodes2["TOO_MANY_REQUESTS"] = 429] = "TOO_MANY_REQUESTS";
1550
- StatusCodes2[StatusCodes2["REQUEST_HEADER_FIELDS_TOO_LARGE"] = 431] = "REQUEST_HEADER_FIELDS_TOO_LARGE";
1551
- StatusCodes2[StatusCodes2["UNAVAILABLE_FOR_LEGAL_REASONS"] = 451] = "UNAVAILABLE_FOR_LEGAL_REASONS";
1552
- StatusCodes2[StatusCodes2["INTERNAL_SERVER_ERROR"] = 500] = "INTERNAL_SERVER_ERROR";
1553
- StatusCodes2[StatusCodes2["NOT_IMPLEMENTED"] = 501] = "NOT_IMPLEMENTED";
1554
- StatusCodes2[StatusCodes2["BAD_GATEWAY"] = 502] = "BAD_GATEWAY";
1555
- StatusCodes2[StatusCodes2["SERVICE_UNAVAILABLE"] = 503] = "SERVICE_UNAVAILABLE";
1556
- StatusCodes2[StatusCodes2["GATEWAY_TIMEOUT"] = 504] = "GATEWAY_TIMEOUT";
1557
- StatusCodes2[StatusCodes2["HTTP_VERSION_NOT_SUPPORTED"] = 505] = "HTTP_VERSION_NOT_SUPPORTED";
1558
- StatusCodes2[StatusCodes2["INSUFFICIENT_STORAGE"] = 507] = "INSUFFICIENT_STORAGE";
1559
- StatusCodes2[StatusCodes2["NETWORK_AUTHENTICATION_REQUIRED"] = 511] = "NETWORK_AUTHENTICATION_REQUIRED";
1560
- })(StatusCodes || (StatusCodes = {}));
1561
- var main$1 = { exports: {} };
1562
- const __viteBrowserExternal = {};
1563
- const __viteBrowserExternal$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1564
- __proto__: null,
1565
- default: __viteBrowserExternal
1566
- }, Symbol.toStringTag, { value: "Module" }));
1567
- const require$$0 = /* @__PURE__ */ getAugmentedNamespace(__viteBrowserExternal$1);
1568
- const name = "dotenv";
1569
- const version$1 = "16.4.5";
1570
- const description = "Loads environment variables from .env file";
1571
- const main = "lib/main.js";
1572
- const types = "lib/main.d.ts";
1573
- const exports$1 = {
1574
- ".": {
1575
- types: "./lib/main.d.ts",
1576
- require: "./lib/main.js",
1577
- "default": "./lib/main.js"
1578
- },
1579
- "./config": "./config.js",
1580
- "./config.js": "./config.js",
1581
- "./lib/env-options": "./lib/env-options.js",
1582
- "./lib/env-options.js": "./lib/env-options.js",
1583
- "./lib/cli-options": "./lib/cli-options.js",
1584
- "./lib/cli-options.js": "./lib/cli-options.js",
1585
- "./package.json": "./package.json"
1586
- };
1587
- const scripts = {
1588
- "dts-check": "tsc --project tests/types/tsconfig.json",
1589
- lint: "standard",
1590
- "lint-readme": "standard-markdown",
1591
- pretest: "npm run lint && npm run dts-check",
1592
- test: "tap tests/*.js --100 -Rspec",
1593
- "test:coverage": "tap --coverage-report=lcov",
1594
- prerelease: "npm test",
1595
- release: "standard-version"
1596
- };
1597
- const repository = {
1598
- type: "git",
1599
- url: "git://github.com/motdotla/dotenv.git"
1600
- };
1601
- const funding = "https://dotenvx.com";
1602
- const keywords = [
1603
- "dotenv",
1604
- "env",
1605
- ".env",
1606
- "environment",
1607
- "variables",
1608
- "config",
1609
- "settings"
1610
- ];
1611
- const readmeFilename = "README.md";
1612
- const license = "BSD-2-Clause";
1613
- const devDependencies = {
1614
- "@definitelytyped/dtslint": "^0.0.133",
1615
- "@types/node": "^18.11.3",
1616
- decache: "^4.6.1",
1617
- sinon: "^14.0.1",
1618
- standard: "^17.0.0",
1619
- "standard-markdown": "^7.1.0",
1620
- "standard-version": "^9.5.0",
1621
- tap: "^16.3.0",
1622
- tar: "^6.1.11",
1623
- typescript: "^4.8.4"
1624
- };
1625
- const engines = {
1626
- node: ">=12"
1627
- };
1628
- const browser$1 = {
1629
- fs: false
1630
- };
1631
- const require$$4 = {
1632
- name,
1633
- version: version$1,
1634
- description,
1635
- main,
1636
- types,
1637
- exports: exports$1,
1638
- scripts,
1639
- repository,
1640
- funding,
1641
- keywords,
1642
- readmeFilename,
1643
- license,
1644
- devDependencies,
1645
- engines,
1646
- browser: browser$1
1647
- };
1648
- const fs = require$$0;
1649
- const path = require$$1;
1650
- const os = require$$2;
1651
- const crypto$1 = require$$3;
1652
- const packageJson = require$$4;
1653
- const version = packageJson.version;
1654
- const LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;
1655
- function parse(src) {
1656
- const obj = {};
1657
- let lines = src.toString();
1658
- lines = lines.replace(/\r\n?/mg, "\n");
1659
- let match;
1660
- while ((match = LINE.exec(lines)) != null) {
1661
- const key = match[1];
1662
- let value = match[2] || "";
1663
- value = value.trim();
1664
- const maybeQuote = value[0];
1665
- value = value.replace(/^(['"`])([\s\S]*)\1$/mg, "$2");
1666
- if (maybeQuote === '"') {
1667
- value = value.replace(/\\n/g, "\n");
1668
- value = value.replace(/\\r/g, "\r");
1669
- }
1670
- obj[key] = value;
1671
- }
1672
- return obj;
1673
- }
1674
- function _parseVault(options) {
1675
- const vaultPath = _vaultPath(options);
1676
- const result = DotenvModule.configDotenv({ path: vaultPath });
1677
- if (!result.parsed) {
1678
- const err = new Error(`MISSING_DATA: Cannot parse ${vaultPath} for an unknown reason`);
1679
- err.code = "MISSING_DATA";
1680
- throw err;
1681
- }
1682
- const keys = _dotenvKey(options).split(",");
1683
- const length = keys.length;
1684
- let decrypted;
1685
- for (let i2 = 0; i2 < length; i2++) {
1686
- try {
1687
- const key = keys[i2].trim();
1688
- const attrs = _instructions(result, key);
1689
- decrypted = DotenvModule.decrypt(attrs.ciphertext, attrs.key);
1690
- break;
1691
- } catch (error) {
1692
- if (i2 + 1 >= length) {
1693
- throw error;
1694
- }
1695
- }
1696
- }
1697
- return DotenvModule.parse(decrypted);
1698
- }
1699
- function _log(message) {
1700
- console.log(`[dotenv@${version}][INFO] ${message}`);
1701
- }
1702
- function _warn(message) {
1703
- console.log(`[dotenv@${version}][WARN] ${message}`);
1704
- }
1705
- function _debug(message) {
1706
- console.log(`[dotenv@${version}][DEBUG] ${message}`);
1707
- }
1708
- function _dotenvKey(options) {
1709
- if (options && options.DOTENV_KEY && options.DOTENV_KEY.length > 0) {
1710
- return options.DOTENV_KEY;
1711
- }
1712
- if (process.env.DOTENV_KEY && process.env.DOTENV_KEY.length > 0) {
1713
- return process.env.DOTENV_KEY;
1714
- }
1715
- return "";
1716
- }
1717
- function _instructions(result, dotenvKey) {
1718
- let uri;
1719
- try {
1720
- uri = new URL(dotenvKey);
1721
- } catch (error) {
1722
- if (error.code === "ERR_INVALID_URL") {
1723
- const err = new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");
1724
- err.code = "INVALID_DOTENV_KEY";
1725
- throw err;
1726
- }
1727
- throw error;
1728
- }
1729
- const key = uri.password;
1730
- if (!key) {
1731
- const err = new Error("INVALID_DOTENV_KEY: Missing key part");
1732
- err.code = "INVALID_DOTENV_KEY";
1733
- throw err;
1734
- }
1735
- const environment = uri.searchParams.get("environment");
1736
- if (!environment) {
1737
- const err = new Error("INVALID_DOTENV_KEY: Missing environment part");
1738
- err.code = "INVALID_DOTENV_KEY";
1739
- throw err;
1740
- }
1741
- const environmentKey = `DOTENV_VAULT_${environment.toUpperCase()}`;
1742
- const ciphertext = result.parsed[environmentKey];
1743
- if (!ciphertext) {
1744
- const err = new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${environmentKey} in your .env.vault file.`);
1745
- err.code = "NOT_FOUND_DOTENV_ENVIRONMENT";
1746
- throw err;
1747
- }
1748
- return { ciphertext, key };
1749
- }
1750
- function _vaultPath(options) {
1751
- let possibleVaultPath = null;
1752
- if (options && options.path && options.path.length > 0) {
1753
- if (Array.isArray(options.path)) {
1754
- for (const filepath of options.path) {
1755
- if (fs.existsSync(filepath)) {
1756
- possibleVaultPath = filepath.endsWith(".vault") ? filepath : `${filepath}.vault`;
1757
- }
1758
- }
1759
- } else {
1760
- possibleVaultPath = options.path.endsWith(".vault") ? options.path : `${options.path}.vault`;
1761
- }
1762
- } else {
1763
- possibleVaultPath = path.resolve(process.cwd(), ".env.vault");
1764
- }
1765
- if (fs.existsSync(possibleVaultPath)) {
1766
- return possibleVaultPath;
1767
- }
1768
- return null;
1769
- }
1770
- function _resolveHome(envPath) {
1771
- return envPath[0] === "~" ? path.join(os.homedir(), envPath.slice(1)) : envPath;
1772
- }
1773
- function _configVault(options) {
1774
- _log("Loading env from encrypted .env.vault");
1775
- const parsed = DotenvModule._parseVault(options);
1776
- let processEnv = process.env;
1777
- if (options && options.processEnv != null) {
1778
- processEnv = options.processEnv;
1779
- }
1780
- DotenvModule.populate(processEnv, parsed, options);
1781
- return { parsed };
1782
- }
1783
- function configDotenv(options) {
1784
- const dotenvPath = path.resolve(process.cwd(), ".env");
1785
- let encoding = "utf8";
1786
- const debug = Boolean(options && options.debug);
1787
- if (options && options.encoding) {
1788
- encoding = options.encoding;
1789
- } else {
1790
- if (debug) {
1791
- _debug("No encoding is specified. UTF-8 is used by default");
1792
- }
1793
- }
1794
- let optionPaths = [dotenvPath];
1795
- if (options && options.path) {
1796
- if (!Array.isArray(options.path)) {
1797
- optionPaths = [_resolveHome(options.path)];
1798
- } else {
1799
- optionPaths = [];
1800
- for (const filepath of options.path) {
1801
- optionPaths.push(_resolveHome(filepath));
1802
- }
1803
- }
1804
- }
1805
- let lastError;
1806
- const parsedAll = {};
1807
- for (const path2 of optionPaths) {
1808
- try {
1809
- const parsed = DotenvModule.parse(fs.readFileSync(path2, { encoding }));
1810
- DotenvModule.populate(parsedAll, parsed, options);
1811
- } catch (e) {
1812
- if (debug) {
1813
- _debug(`Failed to load ${path2} ${e.message}`);
1814
- }
1815
- lastError = e;
1816
- }
1817
- }
1818
- let processEnv = process.env;
1819
- if (options && options.processEnv != null) {
1820
- processEnv = options.processEnv;
1821
- }
1822
- DotenvModule.populate(processEnv, parsedAll, options);
1823
- if (lastError) {
1824
- return { parsed: parsedAll, error: lastError };
1825
- } else {
1826
- return { parsed: parsedAll };
1827
- }
1828
- }
1829
- function config(options) {
1830
- if (_dotenvKey(options).length === 0) {
1831
- return DotenvModule.configDotenv(options);
1832
- }
1833
- const vaultPath = _vaultPath(options);
1834
- if (!vaultPath) {
1835
- _warn(`You set DOTENV_KEY but you are missing a .env.vault file at ${vaultPath}. Did you forget to build it?`);
1836
- return DotenvModule.configDotenv(options);
1837
- }
1838
- return DotenvModule._configVault(options);
1839
- }
1840
- function decrypt(encrypted, keyStr) {
1841
- const key = Buffer.from(keyStr.slice(-64), "hex");
1842
- let ciphertext = Buffer.from(encrypted, "base64");
1843
- const nonce = ciphertext.subarray(0, 12);
1844
- const authTag = ciphertext.subarray(-16);
1845
- ciphertext = ciphertext.subarray(12, -16);
1846
- try {
1847
- const aesgcm = crypto$1.createDecipheriv("aes-256-gcm", key, nonce);
1848
- aesgcm.setAuthTag(authTag);
1849
- return `${aesgcm.update(ciphertext)}${aesgcm.final()}`;
1850
- } catch (error) {
1851
- const isRange = error instanceof RangeError;
1852
- const invalidKeyLength = error.message === "Invalid key length";
1853
- const decryptionFailed = error.message === "Unsupported state or unable to authenticate data";
1854
- if (isRange || invalidKeyLength) {
1855
- const err = new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");
1856
- err.code = "INVALID_DOTENV_KEY";
1857
- throw err;
1858
- } else if (decryptionFailed) {
1859
- const err = new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");
1860
- err.code = "DECRYPTION_FAILED";
1861
- throw err;
1862
- } else {
1863
- throw error;
1864
- }
1865
- }
1866
- }
1867
- function populate(processEnv, parsed, options = {}) {
1868
- const debug = Boolean(options && options.debug);
1869
- const override = Boolean(options && options.override);
1870
- if (typeof parsed !== "object") {
1871
- const err = new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");
1872
- err.code = "OBJECT_REQUIRED";
1873
- throw err;
1874
- }
1875
- for (const key of Object.keys(parsed)) {
1876
- if (Object.prototype.hasOwnProperty.call(processEnv, key)) {
1877
- if (override === true) {
1878
- processEnv[key] = parsed[key];
1879
- }
1880
- if (debug) {
1881
- if (override === true) {
1882
- _debug(`"${key}" is already defined and WAS overwritten`);
1883
- } else {
1884
- _debug(`"${key}" is already defined and was NOT overwritten`);
1885
- }
1886
- }
1887
- } else {
1888
- processEnv[key] = parsed[key];
1889
- }
1890
- }
1891
- }
1892
- const DotenvModule = {
1893
- configDotenv,
1894
- _configVault,
1895
- _parseVault,
1896
- config,
1897
- decrypt,
1898
- parse,
1899
- populate
1900
- };
1901
- main$1.exports.configDotenv = DotenvModule.configDotenv;
1902
- main$1.exports._configVault = DotenvModule._configVault;
1903
- main$1.exports._parseVault = DotenvModule._parseVault;
1904
- main$1.exports.config = DotenvModule.config;
1905
- main$1.exports.decrypt = DotenvModule.decrypt;
1906
- main$1.exports.parse = DotenvModule.parse;
1907
- main$1.exports.populate = DotenvModule.populate;
1908
- main$1.exports = DotenvModule;
1909
- var mainExports = main$1.exports;
1910
- const dotenv = /* @__PURE__ */ getDefaultExportFromCjs(mainExports);
1911
- var __typeError2 = (msg) => {
1912
- throw TypeError(msg);
1913
- };
1914
- var __accessCheck2 = (obj, member, msg) => member.has(obj) || __typeError2("Cannot " + msg);
1915
- var __privateGet2 = (obj, member, getter) => (__accessCheck2(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
1916
- var __privateAdd2 = (obj, member, value) => member.has(obj) ? __typeError2("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
1917
- var __privateSet2 = (obj, member, value, setter) => (__accessCheck2(obj, member, "write to private field"), member.set(obj, value), value);
1918
- var __privateWrapper = (obj, member, setter, getter) => ({
1919
- set _(value) {
1920
- __privateSet2(obj, member, value);
1921
- },
1922
- get _() {
1923
- return __privateGet2(obj, member, getter);
1924
- }
1925
- });
1926
- var _options, _httpAgent, _httpsAgent, _agentResetInterval, _requestCount, _SetupResetInterval, _GetAgentOptions, _url, _method, _headers, _data, _agentManager, _timeout, _withCredentials;
1927
52
  var ansiStyles$1 = { exports: {} };
1928
53
  var colorName;
1929
54
  var hasRequiredColorName;
@@ -2798,15 +923,15 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
2798
923
  };
2799
924
  }
2800
925
  function wrapConversion(toModel, graph) {
2801
- const path2 = [graph[toModel].parent, toModel];
926
+ const path = [graph[toModel].parent, toModel];
2802
927
  let fn = conversions2[graph[toModel].parent][toModel];
2803
928
  let cur = graph[toModel].parent;
2804
929
  while (graph[cur].parent) {
2805
- path2.unshift(graph[cur].parent);
930
+ path.unshift(graph[cur].parent);
2806
931
  fn = link(conversions2[graph[cur].parent][cur], fn);
2807
932
  cur = graph[cur].parent;
2808
933
  }
2809
- fn.conversion = path2;
934
+ fn.conversion = path;
2810
935
  return fn;
2811
936
  }
2812
937
  route = function(fromModel) {
@@ -2926,11 +1051,11 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
2926
1051
  const offset = isBackground ? 10 : 0;
2927
1052
  const styles2 = {};
2928
1053
  for (const [sourceSpace, suite] of Object.entries(colorConvert2)) {
2929
- const name2 = sourceSpace === "ansi16" ? "ansi" : sourceSpace;
1054
+ const name = sourceSpace === "ansi16" ? "ansi" : sourceSpace;
2930
1055
  if (sourceSpace === targetSpace) {
2931
- styles2[name2] = wrap(identity, offset);
1056
+ styles2[name] = wrap(identity, offset);
2932
1057
  } else if (typeof suite === "object") {
2933
- styles2[name2] = wrap(suite[targetSpace], offset);
1058
+ styles2[name] = wrap(suite[targetSpace], offset);
2934
1059
  }
2935
1060
  }
2936
1061
  return styles2;
@@ -3094,7 +1219,7 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
3094
1219
  }
3095
1220
  return ESCAPES.get(c) || c;
3096
1221
  }
3097
- function parseArguments(name2, arguments_) {
1222
+ function parseArguments(name, arguments_) {
3098
1223
  const results = [];
3099
1224
  const chunks = arguments_.trim().split(/\s*,\s*/g);
3100
1225
  let matches;
@@ -3105,7 +1230,7 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
3105
1230
  } else if (matches = chunk.match(STRING_REGEX)) {
3106
1231
  results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, character) => escape ? unescape(escape) : character));
3107
1232
  } else {
3108
- throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name2}')`);
1233
+ throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`);
3109
1234
  }
3110
1235
  }
3111
1236
  return results;
@@ -3115,12 +1240,12 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
3115
1240
  const results = [];
3116
1241
  let matches;
3117
1242
  while ((matches = STYLE_REGEX.exec(style)) !== null) {
3118
- const name2 = matches[1];
1243
+ const name = matches[1];
3119
1244
  if (matches[2]) {
3120
- const args = parseArguments(name2, matches[2]);
3121
- results.push([name2].concat(args));
1245
+ const args = parseArguments(name, matches[2]);
1246
+ results.push([name].concat(args));
3122
1247
  } else {
3123
- results.push([name2]);
1248
+ results.push([name]);
3124
1249
  }
3125
1250
  }
3126
1251
  return results;
@@ -3194,7 +1319,7 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
3194
1319
  if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
3195
1320
  throw new Error("The `level` option should be an integer from 0 to 3");
3196
1321
  }
3197
- const colorLevel = 0;
1322
+ const colorLevel = stdoutColor ? stdoutColor.level : 0;
3198
1323
  object.level = options.level === void 0 ? colorLevel : options.level;
3199
1324
  };
3200
1325
  class ChalkClass {
@@ -3344,456 +1469,75 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
3344
1469
  Object.defineProperties(Chalk.prototype, styles);
3345
1470
  const chalk = Chalk();
3346
1471
  chalk.supportsColor = stdoutColor;
3347
- chalk.stderr = Chalk({ level: 0 });
1472
+ chalk.stderr = Chalk({ level: stderrColor ? stderrColor.level : 0 });
3348
1473
  chalk.stderr.supportsColor = stderrColor;
3349
- const envOptions = {};
3350
- function SetupConfig(envOptions2, logger) {
3351
- const envfile = process.env.STSENVFILE === void 0 ? "/.env" : process.env.STSENVFILE;
3352
- dotenv.config({ path: envfile });
3353
- const defconfig = {
3354
- // Node runtime environment
3355
- isProduction: process.env.NODE_ENV === void 0 ? false : process.env.NODE_ENV === "production" ? true : false,
3356
- isTest: process.env.NODE_ENV === void 0 ? false : process.env.NODE_ENV === "test" ? true : false,
3357
- dbuser: process.env.DB_USER === void 0 ? "postgres" : process.env.DB_USER,
3358
- dbpassword: process.env.DB_PASSWORD === void 0 ? "postgres" : process.env.DB_PASSWORD,
3359
- dbpasswordfile: process.env.DB_PASSWORD_FILE,
3360
- dbhost: process.env.DB_HOST === void 0 ? "localhost:5432" : process.env.DB_HOST,
3361
- database: process.env.DB_DATABASE === void 0 ? "stsrestmsdb01" : process.env.DB_DATABASE,
3362
- databaseUrl: process.env.DATABASE_URL,
3363
- connectionString: "",
3364
- defaultDatabaseConnectionString: "",
3365
- STSServerType: process.env.STS_SERVER_TYPE === void 0 ? "EXPRESS_TLS" : process.env.STS_SERVER_TYPE,
3366
- logToFile: process.env.LOG_TO_FILE === void 0 ? false : process.env.LOG_TO_FILE === "true" ? true : false,
3367
- logFilePath: process.env.LOG_FILE_PATH === void 0 ? "/var/lib/sts" : process.env.LOG_FILE_PATH,
3368
- logFileFormat: process.env.LOG_FILE_FORMAT === void 0 ? "csv" : process.env.LOG_FILE_FORMAT,
3369
- poolSize: process.env.POOL_SIZE === void 0 ? 500 : parseInt(process.env.POOL_SIZE),
3370
- useCPUs: process.env.MAX_CPU === void 0 ? -1 : parseFloat(process.env.MAX_CPU),
3371
- respawnOnFail: process.env.RESPAWN === void 0 ? true : process.env.RESPAWN === "true" ? true : false,
3372
- defaultDatabaseEntries: process.env.DEFAULT_DB_ENTRIES === void 0 ? 1e4 : parseInt(process.env.DEFAULT_DB_ENTRIES),
3373
- useRedisDatabaseCache: process.env.USE_REDIS_DATABASE_CACHE === void 0 ? false : process.env.USE_REDIS_DATABASE_CACHE === "true" ? true : false,
3374
- useSocketIoRedisAdaptor: process.env.USE_SOCKET_IO_REDIS_ADAPTOR === void 0 ? false : process.env.USE_SOCKET_IO_REDIS_ADAPTOR === "true" ? true : false,
3375
- socketIoRedisAdaptorUrl: process.env.SOCKET_IO_REDIS_ADAPTOR_URL === void 0 ? "redis://localhost:6379" : process.env.SOCKET_IO_REDIS_ADAPTOR_URL,
3376
- useRedisInstrumentationTransport: process.env.USE_REDIS_INSTRUMENTATION_TRANSPORT === void 0 ? false : process.env.USE_REDIS_INSTRUMENTATION_TRANSPORT === "true" ? true : false,
3377
- redisInstrumentationTransportUrl: process.env.REDIS_INSTRUMENTATION_TRANSPORT_URL === void 0 ? "redis://localhost:6379" : process.env.REDIS_INSTRUMENTATION_TRANSPORT_URL,
3378
- redisDatabaseCacheEndFlush: process.env.REDIS_DATABASE_CACHE_END_FLUSH === void 0 ? false : process.env.REDIS_DATABASE_CACHE_END_FLUSH === "true" ? true : false,
3379
- redisDatabaseCacheUrl: process.env.REDIS_DATABASE_CACHE_URL === void 0 ? "redis://localhost:6379" : process.env.REDIS_DATABASE_CACHE_URL,
3380
- defaultDatabaseMinExtraDataSize: process.env.DEFAULT_DATABASE_MIN_EXTRA_DATA_SIZE === void 0 ? 0 : parseInt(process.env.DEFAULT_DATABASE_MIN_EXTRA_DATA_SIZE),
3381
- defaultDatabaseMaxExtraDataSize: process.env.DEFAULT_DATABASE_MAX_EXTRA_DATA_SIZE === void 0 ? 2e3 : parseInt(process.env.DEFAULT_DATABASE_MAX_EXTRA_DATA_SIZE),
3382
- rest01endpoint: process.env.REST01_ENDPOINT === void 0 ? "https://localhost" : process.env.REST01_ENDPOINT,
3383
- rest01hostport: process.env.REST01_HOST_PORT === void 0 ? "3003" : process.env.REST01_HOST_PORT,
3384
- rest01port: process.env.REST01_PORT === void 0 ? "3003" : process.env.REST01_PORT,
3385
- rest01apiroot: process.env.REST01_APIROOT === void 0 ? "/stsrest01/v1" : process.env.REST01_APIROOT,
3386
- rest01prometheussupport: process.env.REST01_PROM_SUPPORT === void 0 ? true : process.env.REST01_PROM_SUPPORT === "true" ? true : false,
3387
- rest01prometheusclusterport: process.env.REST01_PROM_CLUSTER_PORT === void 0 ? "3013" : process.env.REST01_PROM_CLUSTER_PORT,
3388
- rest01servicename: process.env.REST01_SERVICE_NAME === void 0 ? "STSRest01" : process.env.REST01_SERVICE_NAME,
3389
- rest01serviceversion: process.env.REST01_SERVICE_VERSION === void 0 ? "1.0.0" : process.env.REST01_SERVICE_VERSION,
3390
- stsfhirendpoint: process.env.STSFHIR_ENDPOINT === void 0 ? "https://localhost" : process.env.STSFHIR_ENDPOINT,
3391
- stsfhirhostport: process.env.STSFHIR_HOST_PORT === void 0 ? "3005" : process.env.STSFHIR_HOST_PORT,
3392
- stsfhirport: process.env.STSFHIR_PORT === void 0 ? "3005" : process.env.STSFHIR_PORT,
3393
- stsfhirapiroot: process.env.STSFHIR_APIROOT === void 0 ? "/stsfhir/r5" : process.env.STSFHIR_APIROOT,
3394
- stsfhirprometheussupport: process.env.STSFHIR_PROM_SUPPORT === void 0 ? true : process.env.STSFHIR_PROM_SUPPORT === "true" ? true : false,
3395
- stsfhirprometheusclusterport: process.env.STSFHIR_PROM_CLUSTER_PORT === void 0 ? "3015" : process.env.STSFHIR_PROM_CLUSTER_PORT,
3396
- stsfhirservicename: process.env.STSFHIR_SERVICE_NAME === void 0 ? "STSFHIR" : process.env.STSFHIR_SERVICE_NAME,
3397
- stsfhirserviceversion: process.env.STSFHIR_SERVICE_VERSION === void 0 ? "1.0.0" : process.env.STSFHIR_SERVICE_VERSION,
3398
- imendpoint: process.env.IM_ENDPOINT === void 0 ? "https://localhost" : process.env.IM_ENDPOINT,
3399
- imhostport: process.env.IM_HOST_PORT === void 0 ? "3001" : process.env.IM_HOST_PORT,
3400
- import: process.env.IM_PORT === void 0 ? "3001" : process.env.IM_PORT,
3401
- imapiroot: process.env.IM_APIROOT === void 0 ? "/stsinstrumentmanager/v1" : process.env.IM_APIROOT,
3402
- imprometheussupport: process.env.IM_PROM_SUPPORT === void 0 ? true : process.env.IM_PROM_SUPPORT === "true" ? true : false,
3403
- imprometheusclusterport: process.env.IM_PROM_CLUSTER_PORT === void 0 ? "3011" : process.env.IM_PROM_CLUSTER_PORT,
3404
- imservicename: process.env.IM_SERVICE_NAME === void 0 ? "STSInstrumentManager" : process.env.IM_SERVICE_NAME,
3405
- imserviceversion: process.env.IM_SERVICE_VERSION === void 0 ? "1.0.0" : process.env.IM_SERVICE_VERSION,
3406
- imRedisKeepAliveProcessorUrl: process.env.IM_REDIS_KEEP_ALIVE_PROCESSOR_URL === void 0 ? "redis://localhost:6379" : process.env.IM_REDIS_KEEP_ALIVE_PROCESSOR_URL,
3407
- imRedisMessageProcessorUrl: process.env.IM_REDIS_MESSAGE_PROCESSOR_URL === void 0 ? "redis://localhost:6379" : process.env.IM_REDIS_MESSAGE_PROCESSOR_URL,
3408
- asendpoint: process.env.AS_ENDPOINT === void 0 ? "https://localhost" : process.env.AS_ENDPOINT,
3409
- ashostport: process.env.AS_HOST_PORT === void 0 ? "3002" : process.env.AS_HOST_PORT,
3410
- asport: process.env.AS_PORT === void 0 ? "3002" : process.env.AS_PORT,
3411
- asapiroot: process.env.AS_API_ROOT === void 0 ? "/stsauth/v1.0" : process.env.AS_API_ROOT,
3412
- asoauthapiroot: process.env.AS_OAUTH_API_ROOT === void 0 ? "/oauth2/v2.0" : process.env.AS_OAUTH_API_ROOT,
3413
- asadminapiroot: process.env.AS_ADMIN_API_ROOT === void 0 ? "/admin/v1.0" : process.env.AS_ADMIN_API_ROOT,
3414
- asprometheussupport: process.env.AS_PROM_SUPPORT === void 0 ? true : process.env.AS_PROM_SUPPORT === "true" ? true : false,
3415
- asprometheusclusterport: process.env.AS_PROM_CLUSTER_PORT === void 0 ? "3012" : process.env.AS_PROM_CLUSTER_PORT,
3416
- asservicename: process.env.AS_SERVICE_NAME === void 0 ? "STSAuth" : process.env.AS_SERVICE_NAME,
3417
- asserviceversion: process.env.AS_SERVICE_VERSION === void 0 ? "1.0.0" : process.env.AS_SERVICE_VERSION,
3418
- asjwksjsonpath: process.env.AS_JWKS_JSON_PATH === void 0 ? "/.well-known/jwks.json" : process.env.AS_JWKS_JSON_PATH,
3419
- asjwkskeyrotationtime: process.env.AS_JWKS_KEY_ROTATION_TIME === void 0 ? 86400 : parseInt(process.env.AS_JWKS_KEY_ROTATION_TIME),
3420
- asjwkskeypurgetimeoffset: process.env.AS_JWKS_KEY_PURGE_TIME_OFFSET === void 0 ? 300 : parseInt(process.env.AS_JWKS_KEY_PURGE_TIME_OFFSET),
3421
- asjwkskeycount: process.env.AS_JWKS_KEY_COUNT === void 0 ? 4 : parseInt(process.env.AS_JWKS_KEY_COUNT),
3422
- asaccesstokenexpire: process.env.AS_ACCESS_TOKEN_EXPIRE === void 0 ? 43200 : parseInt(process.env.AS_ACCESS_TOKEN_EXPIRE),
3423
- authorizeendpoint: process.env.AUTHORIZE_ENDPOINT === void 0 ? "https://localhost" : process.env.AUTHORIZE_ENDPOINT,
3424
- authorizeport: process.env.AUTHORIZE_PORT === void 0 ? "3010" : process.env.AUTHORIZE_PORT,
3425
- authorizeapiroot: process.env.AUTHORIZE_API_ROOT === void 0 ? "/stsa" : process.env.AUTHORIZE_API_ROOT,
3426
- authorizeapi: process.env.AUTHORIZE_API === void 0 ? "/authorize" : process.env.AUTHORIZE_API,
3427
- brokerendpoint: process.env.BROKER_ENDPOINT === void 0 ? "https://localhost" : process.env.BROKER_ENDPOINT,
3428
- brokerhostport: process.env.BROKER_HOST_PORT === void 0 ? "3006" : process.env.BROKER_HOST_PORT,
3429
- brokerport: process.env.BROKER_PORT === void 0 ? "3006" : process.env.BROKER_PORT,
3430
- brokerapiroot: process.env.BROKER_APIROOT === void 0 ? "/stsbroker/v1.0" : process.env.BROKER_APIROOT,
3431
- brokerprometheussupport: process.env.BROKER_PROM_SUPPORT === void 0 ? true : process.env.BROKER_PROM_SUPPORT === "true" ? true : false,
3432
- brokerprometheusclusterport: process.env.BROKER_PROM_CLUSTER_PORT === void 0 ? "3016" : process.env.BROKER_PROM_CLUSTER_PORT,
3433
- brokerservicename: process.env.BROKER_SERVICE_NAME === void 0 ? "STSBroker" : process.env.BROKER_SERVICE_NAME,
3434
- brokerserviceversion: process.env.BROKER_SERVICE_VERSION === void 0 ? "1.0.0" : process.env.BROKER_SERVICE_VERSION,
3435
- trnendpoint: process.env.TRN_ENDPOINT === void 0 ? "https://localhost" : process.env.TRN_ENDPOINT,
3436
- trnhostport: process.env.TRN_HOST_PORT === void 0 ? "3007" : process.env.TRN_HOST_PORT,
3437
- trnport: process.env.TRN_PORT === void 0 ? "3007" : process.env.TRN_PORT,
3438
- trnapiroot: process.env.TRN_APIROOT === void 0 ? "/ststrn/v1.0" : process.env.TRN_APIROOT,
3439
- trnprometheussupport: process.env.TRN_PROM_SUPPORT === void 0 ? true : process.env.TRN_PROM_SUPPORT === "true" ? true : false,
3440
- trnprometheusclusterport: process.env.TRN_PROM_CLUSTER_PORT === void 0 ? "3017" : process.env.TRN_PROM_CLUSTER_PORT,
3441
- trnservicename: process.env.TRN_SERVICE_NAME === void 0 ? "STSTestRunnerNode" : process.env.TRN_SERVICE_NAME,
3442
- trnserviceversion: process.env.TRN_SERVICE_VERSION === void 0 ? "1.0.0" : process.env.TRN_SERVICE_VERSION,
3443
- trnautostartdelay: process.env.TRN_AUTO_START_DELAY === void 0 ? 0 : parseInt(process.env.TRN_AUTO_START_DELAY),
3444
- trnautostartconfig: process.env.TRN_AUTO_START_CONFIG === void 0 ? "" : process.env.TRN_AUTO_START_CONFIG,
3445
- trnRedisMessageProcessorUrl: process.env.TRN_REDIS_MESSAGE_PROCESSOR_URL === void 0 ? "redis://localhost:6379" : process.env.TRN_REDIS_MESSAGE_PROCESSOR_URL,
3446
- lambdaendpoint: process.env.LAMBDA_ENDPOINT === void 0 ? "https://localhost" : process.env.LAMBDA_ENDPOINT,
3447
- lambdahostport: process.env.LAMBDA_HOST_PORT === void 0 ? "3009" : process.env.LAMBDA_HOST_PORT,
3448
- lambdaport: process.env.LAMBDA_PORT === void 0 ? "3009" : process.env.LAMBDA_PORT,
3449
- lambdaapiroot: process.env.LAMBDA_APIROOT === void 0 ? "/stslambda/v1.0" : process.env.LAMBDA_APIROOT,
3450
- lambdaprometheussupport: process.env.LAMBDA_PROM_SUPPORT === void 0 ? true : process.env.LAMBDA_PROM_SUPPORT === "true" ? true : false,
3451
- lambdaprometheusclusterport: process.env.LAMBDA_PROM_CLUSTER_PORT === void 0 ? "3019" : process.env.LAMBDA_PROM_CLUSTER_PORT,
3452
- lambdaservicename: process.env.LAMBDA_SERVICE_NAME === void 0 ? "STSLambda" : process.env.LAMBDA_SERVICE_NAME,
3453
- lambdaserviceversion: process.env.LAMBDA_SERVICE_VERSION === void 0 ? "1.0.0" : process.env.LAMBDA_SERVICE_VERSION,
3454
- publishinterval: process.env.PUBLISH_INTERVAL === void 0 ? 1e3 : parseInt(process.env.PUBLISH_INTERVAL),
3455
- publishtimeout: process.env.PUBLISH_TIMEOUT === void 0 ? 750 : parseInt(process.env.PUBLISH_TIMEOUT),
3456
- transport: process.env.TRANSPORT === void 0 ? "RESTAPI" : process.env.TRANSPORT,
3457
- useSecureCookies: process.env.USE_SECURE_COOKIES === void 0 ? false : process.env.USE_SECURE_COOKIES === "true" ? true : false,
3458
- keepAlive: process.env.KEEP_ALIVE === void 0 ? true : process.env.KEEP_ALIVE === "true" ? true : false,
3459
- maxSockets: process.env.MAX_SOCKETS === void 0 ? 10 : parseInt(process.env.MAX_SOCKETS),
3460
- maxTotalSockets: process.env.MAX_TOTAL_SOCKETS === void 0 ? 20 : parseInt(process.env.MAX_TOTAL_SOCKETS),
3461
- maxFreeSockets: process.env.MAX_FREE_SOCKETS === void 0 ? 256 : parseInt(process.env.MAX_FREE_SOCKETS),
3462
- timeout: process.env.TIMEOUT === void 0 ? 1e4 : parseInt(process.env.TIMEOUT),
3463
- maxPayloadSize: process.env.MAX_PAYLOAD_SIZE === void 0 ? "50mb" : process.env.MAX_PAYLOAD_SIZE,
3464
- instrumentationObservationInterval: process.env.INSTRUMENTATION_OBSERVATION_INTERVAL === void 0 ? 1e3 : parseInt(process.env.INSTRUMENTATION_OBSERVATION_INTERVAL),
3465
- instrumentationTimeWindow: process.env.INSTRUMENTATION_TIME_WINDOW === void 0 ? 600 : parseInt(process.env.INSTRUMENTATION_TIME_WINDOW),
3466
- authJWTAccessTokenTimeout: process.env.AUTH_JWT_ACCESS_TOKEN_TIMEOUT === void 0 ? 600 : parseInt(process.env.AUTH_JWT_ACCESS_TOKEN_TIMEOUT),
3467
- authJWTRefreshTokenTimeout: process.env.AUTH_JWT_REFRESH_TOKEN_TIMEOUT === void 0 ? 3600 * 24 : parseInt(process.env.AUTH_JWT_REFRESH_TOKEN_TIMEOUT),
3468
- authCookieTimeout: process.env.AUTH_COOKIE_TIMEOUT === void 0 ? 3600 * 24 : parseInt(process.env.AUTH_COOKIE_TIMEOUT),
3469
- masterProcessExitTime: process.env.MASTER_PROCESS_EXIT_TIME === void 0 ? 500 : parseInt(process.env.MASTER_PROCESS_EXIT_TIME),
3470
- childProcessExitTime: process.env.CHILD_PROCESS_EXIT_TIME === void 0 ? 500 : parseInt(process.env.CHILD_PROCESS_EXIT_TIME),
3471
- systemInformationInterval: process.env.SYSTEM_INFORMATION_INTERVAL === void 0 ? 1e3 : parseInt(process.env.SYSTEM_INFORMATION_INTERVAL),
3472
- ignoresocketio: process.env.IGNORE_SOCKETIO === void 0 ? true : process.env.IGNORE_SOCKETIO === "true" ? true : false,
3473
- httpsserverkeypath: process.env.HTTPS_SERVER_KEY_PATH === void 0 ? "/var/lib/sts/stsglobalresources/keys/server.key" : process.env.HTTPS_SERVER_KEY_PATH,
3474
- httpsservercertpath: process.env.HTTPS_SERVER_CERT_PATH === void 0 ? "/var/lib/sts/stsglobalresources/keys/server.cert" : process.env.HTTPS_SERVER_CERT_PATH,
3475
- tsjwkskeys: process.env.TS_JWKS_KEYS === void 0 ? 3 : parseInt(process.env.TS_JWKS_KEYS),
3476
- jwksAuthConfigCache: process.env.JWKS_AUTH_CONFIG_CACHE === void 0 ? true : process.env.JWKS_AUTH_CONFIG_CACHE === "true" ? true : false,
3477
- jwksAuthConfigCacheMaxEntries: process.env.JWKS_AUTH_CONFIG_CACHE_MAX_ENTRIES === void 0 ? 5 : parseInt(process.env.JWKS_AUTH_CONFIG_CACHE_MAX_ENTRIES),
3478
- jwksAuthConfigCacheMaxAge: process.env.JWKS_AUTH_CONFIG_CACHE_MAX_AGE === void 0 ? 6e5 : parseInt(process.env.JWKS_AUTH_CONFIG_CACHE_MAX_AGE),
3479
- jwksAuthConfigRateLimit: process.env.JWKS_AUTH_CONFIG_RATE_LIMIT === void 0 ? true : process.env.JWKS_AUTH_CONFIG_RATE_LIMIT === "true" ? true : false,
3480
- jwksAuthConfigRateLimitRequestsPerMinute: process.env.JWKS_AUTH_CONFIG_RATE_LIMIT_REQUESTS_PER_MINUTE === void 0 ? 10 : parseInt(process.env.JWKS_AUTH_CONFIG_RATE_LIMIT_REQUESTS_PER_MINUTE),
3481
- jwksAuthConfigTimeout: process.env.JWKS_AUTH_CONFIG_TIMEOUT === void 0 ? 3e4 : parseInt(process.env.JWKS_AUTH_CONFIG_TIMEOUT),
3482
- influxDB_APIToken: process.env.INFLUXDB_API_TOKEN === void 0 ? "password" : process.env.INFLUXDB_API_TOKEN,
3483
- influxDB_APITokenFile: process.env.INFLUXDB_API_TOKEN_FILE,
3484
- influxDB_Url: process.env.INFLUXDB_URL === void 0 ? "http://localhost:8086" : process.env.INFLUXDB_URL,
3485
- influxDB_Org: process.env.INFLUXDB_ORG === void 0 ? "my-org" : process.env.INFLUXDB_ORG,
3486
- influxDB_Bucket: process.env.INFLUXDB_BUCKET === void 0 ? "TestBucket01" : process.env.INFLUXDB_BUCKET,
3487
- influxDB_keepAlive: process.env.INFLUXDB_KEEP_ALIVE === void 0 ? true : process.env.INFLUXDB_KEEP_ALIVE === "true" ? true : false,
3488
- influxDB_maxSockets: process.env.INFLUXDB_MAX_SOCKETS === void 0 ? 10 : parseInt(process.env.INFLUXDB_MAX_SOCKETS),
3489
- influxDB_maxTotalSockets: process.env.INFLUXDB_MAX_TOTAL_SOCKETS === void 0 ? 20 : parseInt(process.env.INFLUXDB_MAX_TOTAL_SOCKETS),
3490
- influxDB_maxFreeSockets: process.env.INFLUXDB_MAX_FREE_SOCKETS === void 0 ? 256 : parseInt(process.env.INFLUXDB_MAX_FREE_SOCKETS),
3491
- influxDB_timeout: process.env.INFLUXDB_TIMEOUT === void 0 ? 1e4 : parseInt(process.env.INFLUXDB_TIMEOUT),
3492
- influxDB_rejectUnauthorized: process.env.INFLUXDB_REJECT_UNAUTHORIZED === void 0 ? true : process.env.INFLUXDB_REJECT_UNAUTHORIZED === "true" ? true : false,
3493
- influxDB_writeDataPointFlushTimeout: process.env.INFLUXDB_WRITE_DATA_POINT_FLUSH_TIMEOUT === void 0 ? 1e3 : parseInt(process.env.INFLUXDB_WRITE_DATA_POINT_FLUSH_TIMEOUT),
3494
- kafka_clientId: process.env.KAFKA_CLIENT_ID === void 0 ? "myclient" : process.env.KAFKA_CLIENT_ID,
3495
- kafka_brokers: process.env.KAFKA_BROKERS === void 0 ? "localhost:9092" : process.env.KAFKA_BROKERS,
3496
- kafka_admin_timeout: process.env.KAFKA_ADMIN_TIMEOUT === void 0 ? 5e3 : parseInt(process.env.KAFKA_ADMIN_TIMEOUT),
3497
- kafka_connection_timeout: process.env.KAFKA_CONNECTION_TIMEOUT === void 0 ? 5e3 : parseInt(process.env.KAFKA_CONNECTION_TIMEOUT),
3498
- kafka_request_timeout: process.env.KAFKA_REQUEST_TIMEOUT === void 0 ? 5e3 : parseInt(process.env.KAFKA_REQUEST_TIMEOUT),
3499
- kafka_log_level: process.env.KAFKA_LOG_LEVEL === void 0 ? "nothing" : process.env.KAFKA_LOG_LEVEL,
3500
- kafka_keep_alive: process.env.KAFKA_KEEP_ALIVE === void 0 ? 3e4 : parseInt(process.env.KAFKA_KEEP_ALIVE),
3501
- kafka_use_ssl: process.env.KAFKA_USE_SSL === void 0 ? false : process.env.KAFKA_USE_SSL === "true" ? true : false,
3502
- kafka_ssl_rejectUnauthorized: process.env.KAFKA_SSL_REJECT_UNAUTHORIZED === void 0 ? true : process.env.KAFKA_SSL_REJECT_UNAUTHORIZED === "true" ? true : false,
3503
- kafka_ssl_cafile: process.env.KAFKA_SSL_CAFILE === void 0 ? "/my/custom/ca.crt" : process.env.KAFKA_SSL_CAFILE,
3504
- kafka_ssl_keyfile: process.env.KAFKA_SSL_KEYFILE === void 0 ? "/my/custom/client-key.pem" : process.env.KAFKA_SSL_KEYFILE,
3505
- kafka_ssl_certfile: process.env.KAFKA_SSL_CERTFILE === void 0 ? "/my/custom/client-cert.pem" : process.env.KAFKA_SSL_CERTFILE,
3506
- kafka_consume_from_beginning: process.env.KAFKA_CONSUME_FROM_BEGINNING === void 0 ? true : process.env.KAFKA_CONSUME_FROM_BEGINNING === "true" ? true : false,
3507
- observabilityPublishMode: process.env.OBSERVABILITY_PUBLISH_MODE === void 0 ? "PROXY" : process.env.OBSERVABILITY_PUBLISH_MODE,
3508
- stsUiTermObservabilityConsumptionMode: process.env.STSUITERM_OBSERVABILITY_CONSUMPTION_MODE === void 0 ? "PROXY" : process.env.STSUITERM_OBSERVABILITY_CONSUMPTION_MODE
3509
- };
3510
- const ReadFile = (passwordFile) => {
3511
- try {
3512
- node_fs.accessSync(passwordFile, node_fs.constants.R_OK);
3513
- const data = node_fs.readFileSync(passwordFile, "utf8");
3514
- if (logger) ;
3515
- return data;
3516
- } catch (err) {
3517
- return "";
3518
- }
3519
- };
3520
- const fileconfig = [
3521
- { fileprop: "dbpasswordfile", prop: "dbpassword" },
3522
- // JWKS secret file processing
3523
- { fileprop: "tsjwksstorepathfile", prop: "tsjwksstorepath" },
3524
- // InfluxDB file processing
3525
- { fileprop: "influxDB_APITokenFile", prop: "influxDB_APIToken" }
3526
- ];
3527
- fileconfig.forEach((v) => {
3528
- if (defconfig[v.fileprop] !== void 0) {
3529
- defconfig[v.prop] = ReadFile(defconfig[v.fileprop]);
3530
- }
3531
- });
3532
- for (const [key, val] of Object.entries(defconfig)) {
3533
- envOptions2[key] = val;
3534
- }
3535
- }
3536
- function $SetupOptions(envOptions2) {
3537
- SetupConfig(envOptions2);
3538
- const options = envOptions2;
3539
- if (options.dbhost) {
3540
- const hosts = options.dbhost.split(",");
3541
- envOptions2.connectionString = hosts.map((host) => {
3542
- return `postgresql://${options.dbuser}:${options.dbpassword}@${host}/${options.database}`;
3543
- }).join(",");
3544
- envOptions2.defaultDatabaseConnectionString = hosts.map((host) => {
3545
- return `postgresql://${options.dbuser}:${options.dbpassword}@${host}/postgres`;
3546
- }).join(",");
3547
- }
3548
- }
3549
- const envOptionsHandler = {
3550
- get(target, prop, receiver) {
3551
- if (Object.keys(target).length === 0) {
3552
- $SetupOptions(target);
3553
- }
3554
- return Reflect.get(target, prop, receiver);
3555
- }
3556
- };
3557
- const goptions = new Proxy(envOptions, envOptionsHandler);
3558
- class AgentManager {
3559
- constructor(agentManagerOptions) {
3560
- __privateAdd2(this, _options);
3561
- __privateAdd2(this, _httpAgent, null);
3562
- __privateAdd2(this, _httpsAgent, null);
3563
- __privateAdd2(this, _agentResetInterval, null);
3564
- __privateAdd2(this, _requestCount, 0);
3565
- __privateAdd2(this, _SetupResetInterval, () => {
3566
- if (__privateGet2(this, _options).agentResetInterval && __privateGet2(this, _options).agentResetInterval > 0) {
3567
- __privateSet2(this, _agentResetInterval, setTimeout(() => {
3568
- this.ResetAgent();
3569
- __privateGet2(this, _SetupResetInterval).call(this);
3570
- }, __privateGet2(this, _options).agentResetInterval).unref());
3571
- }
3572
- });
3573
- __privateAdd2(this, _GetAgentOptions, (https2) => {
3574
- let options;
3575
- if (__privateGet2(this, _options).agentOptions) {
3576
- options = {
3577
- keepAlive: __privateGet2(this, _options).agentOptions.keepAlive,
3578
- maxSockets: __privateGet2(this, _options).agentOptions.maxSockets,
3579
- maxTotalSockets: __privateGet2(this, _options).agentOptions.maxTotalSockets,
3580
- maxFreeSockets: __privateGet2(this, _options).agentOptions.maxFreeSockets,
3581
- timeout: __privateGet2(this, _options).agentOptions.timeout
3582
- //@@ config
3583
- };
3584
- if (https2 === true) {
3585
- options.rejectUnauthorized = __privateGet2(this, _options).agentOptions.rejectUnauthorized;
3586
- }
3587
- } else {
3588
- options = {
3589
- keepAlive: process.env.NODE_ENV === "test" ? false : goptions.keepAlive,
3590
- maxSockets: goptions.maxSockets,
3591
- maxTotalSockets: goptions.maxTotalSockets,
3592
- maxFreeSockets: goptions.maxFreeSockets,
3593
- timeout: 3e4
3594
- //@@ config
3595
- };
3596
- if (https2 === true) {
3597
- options.rejectUnauthorized = goptions.isProduction;
3598
- }
3599
- }
3600
- return options;
3601
- });
3602
- __privateSet2(this, _options, agentManagerOptions);
3603
- if (__privateGet2(this, _options).agentResetInterval) {
3604
- __privateGet2(this, _SetupResetInterval).call(this);
3605
- }
3606
- }
3607
- get agentResetInterval() {
3608
- return __privateGet2(this, _options).agentResetInterval;
3609
- }
3610
- set agentResetInterval(val) {
3611
- if (__privateGet2(this, _agentResetInterval)) {
3612
- clearTimeout(__privateGet2(this, _agentResetInterval));
3613
- }
3614
- __privateGet2(this, _options).agentResetInterval = val;
3615
- __privateGet2(this, _SetupResetInterval).call(this);
3616
- }
3617
- get agentResetCount() {
3618
- return __privateGet2(this, _options).agentResetCount;
3619
- }
3620
- set agentResetCount(val) {
3621
- __privateGet2(this, _options).agentResetCount = val;
3622
- }
3623
- IncRequestCount() {
3624
- __privateWrapper(this, _requestCount)._++;
3625
- if (__privateGet2(this, _options).agentResetCount) {
3626
- if (__privateGet2(this, _requestCount) % __privateGet2(this, _options).agentResetCount === 0) {
3627
- this.ResetAgent();
3628
- }
3629
- }
3630
- }
3631
- IsHttps(protocol) {
3632
- if (protocol.toLowerCase().startsWith("https:")) {
3633
- return true;
3634
- }
3635
- return false;
3636
- }
3637
- GetAgent(protocol) {
3638
- if (protocol.toLowerCase().startsWith("https:")) {
3639
- if (__privateGet2(this, _httpsAgent) === null) {
3640
- __privateSet2(this, _httpsAgent, new https.Agent(__privateGet2(this, _GetAgentOptions).call(this, true)));
3641
- }
3642
- return __privateGet2(this, _httpsAgent);
3643
- } else if (protocol.toLowerCase().startsWith("http:")) {
3644
- if (__privateGet2(this, _httpAgent) === null) {
3645
- __privateSet2(this, _httpAgent, new http.Agent(__privateGet2(this, _GetAgentOptions).call(this, false)));
3646
- }
3647
- return __privateGet2(this, _httpAgent);
3648
- } else {
3649
- return null;
3650
- }
3651
- }
3652
- ResetAgent() {
3653
- __privateSet2(this, _httpAgent, null);
3654
- __privateSet2(this, _httpsAgent, null);
3655
- }
3656
- /*
3657
- url
3658
- ,method: 'post'
3659
- ,data: payload
3660
- ,headers: headers
3661
- ,httpsAgent: this.#agentManager.GetAgent(url)
3662
- */
3663
- /*
3664
- postgresContainer = await new GenericContainer("postgres")
3665
- .withExposedPorts(5432)
3666
- .withEnvironment({
3667
- POSTGRES_PASSWORD: "postgres",
3668
- //UV_THREADPOOL_SIZE: "64"
3669
- })
3670
- .withCommand(['-c', 'max_connections=20'])
3671
- .start();
3672
- */
3673
- Terminate() {
3674
- if (__privateGet2(this, _agentResetInterval)) {
3675
- clearTimeout(__privateGet2(this, _agentResetInterval));
3676
- __privateSet2(this, _agentResetInterval, null);
3677
- }
3678
- if (__privateGet2(this, _httpAgent)) {
3679
- __privateGet2(this, _httpAgent).destroy();
3680
- __privateSet2(this, _httpAgent, null);
3681
- }
3682
- if (__privateGet2(this, _httpsAgent)) {
3683
- __privateGet2(this, _httpsAgent).destroy();
3684
- __privateSet2(this, _httpsAgent, null);
3685
- }
3686
- }
3687
- }
3688
- _options = /* @__PURE__ */ new WeakMap();
3689
- _httpAgent = /* @__PURE__ */ new WeakMap();
3690
- _httpsAgent = /* @__PURE__ */ new WeakMap();
3691
- _agentResetInterval = /* @__PURE__ */ new WeakMap();
3692
- _requestCount = /* @__PURE__ */ new WeakMap();
3693
- _SetupResetInterval = /* @__PURE__ */ new WeakMap();
3694
- _GetAgentOptions = /* @__PURE__ */ new WeakMap();
3695
- class STSAxiosConfig {
3696
- constructor(url, method, headers, timeout) {
3697
- __privateAdd2(this, _url);
3698
- __privateAdd2(this, _method);
3699
- __privateAdd2(this, _headers);
3700
- __privateAdd2(this, _data);
3701
- __privateAdd2(this, _agentManager);
3702
- __privateAdd2(this, _timeout);
3703
- __privateAdd2(this, _withCredentials);
3704
- __privateSet2(this, _url, url);
3705
- __privateSet2(this, _method, method);
3706
- if (headers !== void 0) {
3707
- __privateSet2(this, _headers, headers);
3708
- }
3709
- if (timeout !== void 0) {
3710
- __privateSet2(this, _timeout, timeout);
3711
- }
3712
- }
3713
- withCookies(cookies) {
3714
- if (!__privateGet2(this, _headers)) {
3715
- __privateSet2(this, _headers, {});
3716
- }
3717
- __privateGet2(this, _headers)["Cookie"] = cookies.join("; ");
3718
- return this;
3719
- }
3720
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
3721
- withData(data) {
3722
- __privateSet2(this, _data, data);
3723
- return this;
3724
- }
3725
- // 'Content-Type': 'application/json'
3726
- withAuthHeaders(accesssToken, stsUserId) {
3727
- if (!__privateGet2(this, _headers)) {
3728
- __privateSet2(this, _headers, {});
3729
- }
3730
- __privateGet2(this, _headers)["Content-Type"] = "application/json";
3731
- __privateGet2(this, _headers)["Authorization"] = "Bearer " + accesssToken;
3732
- if (stsUserId) {
3733
- __privateGet2(this, _headers)["x-sts_user_id"] = stsUserId;
3734
- }
3735
- return this;
3736
- }
3737
- withHeaders(headers) {
3738
- __privateSet2(this, _headers, headers);
3739
- return this;
3740
- }
3741
- withDefaultHeaders() {
3742
- if (!__privateGet2(this, _headers)) {
3743
- __privateSet2(this, _headers, {});
3744
- }
3745
- __privateGet2(this, _headers)["Content-Type"] = "application/json";
3746
- return this;
3747
- }
3748
- withCredentials() {
3749
- __privateSet2(this, _withCredentials, true);
3750
- return this;
3751
- }
3752
- withTimeout(timeout) {
3753
- __privateSet2(this, _timeout, timeout);
3754
- return this;
3755
- }
3756
- withAgentManager(agentManager) {
3757
- __privateSet2(this, _agentManager, agentManager);
3758
- return this;
3759
- }
3760
- get config() {
3761
- const retVal = {
3762
- url: __privateGet2(this, _url),
3763
- method: __privateGet2(this, _method)
3764
- };
3765
- if (__privateGet2(this, _headers)) {
3766
- retVal.headers = __privateGet2(this, _headers);
3767
- }
3768
- if (__privateGet2(this, _agentManager) !== void 0) {
3769
- if (__privateGet2(this, _agentManager).IsHttps(__privateGet2(this, _url))) {
3770
- retVal.httpsAgent = __privateGet2(this, _agentManager).GetAgent(__privateGet2(this, _url));
3771
- } else {
3772
- retVal.httpAgent = __privateGet2(this, _agentManager).GetAgent(__privateGet2(this, _url));
3773
- }
3774
- }
3775
- if (__privateGet2(this, _data) !== void 0) {
3776
- retVal.data = __privateGet2(this, _data);
3777
- }
3778
- if (__privateGet2(this, _timeout) !== void 0) {
3779
- retVal.timeout = __privateGet2(this, _timeout);
3780
- }
3781
- if (__privateGet2(this, _withCredentials) !== void 0 && __privateGet2(this, _withCredentials) === true) {
3782
- retVal.withCredentials = true;
3783
- }
3784
- return retVal;
3785
- }
3786
- }
3787
- _url = /* @__PURE__ */ new WeakMap();
3788
- _method = /* @__PURE__ */ new WeakMap();
3789
- _headers = /* @__PURE__ */ new WeakMap();
3790
- _data = /* @__PURE__ */ new WeakMap();
3791
- _agentManager = /* @__PURE__ */ new WeakMap();
3792
- _timeout = /* @__PURE__ */ new WeakMap();
3793
- _withCredentials = /* @__PURE__ */ new WeakMap();
1474
+ var source = chalk;
1475
+ const chalk$1 = /* @__PURE__ */ getDefaultExportFromCjs(source);
1476
+ var StatusCodes;
1477
+ (function(StatusCodes2) {
1478
+ StatusCodes2[StatusCodes2["CONTINUE"] = 100] = "CONTINUE";
1479
+ StatusCodes2[StatusCodes2["SWITCHING_PROTOCOLS"] = 101] = "SWITCHING_PROTOCOLS";
1480
+ StatusCodes2[StatusCodes2["PROCESSING"] = 102] = "PROCESSING";
1481
+ StatusCodes2[StatusCodes2["EARLY_HINTS"] = 103] = "EARLY_HINTS";
1482
+ StatusCodes2[StatusCodes2["OK"] = 200] = "OK";
1483
+ StatusCodes2[StatusCodes2["CREATED"] = 201] = "CREATED";
1484
+ StatusCodes2[StatusCodes2["ACCEPTED"] = 202] = "ACCEPTED";
1485
+ StatusCodes2[StatusCodes2["NON_AUTHORITATIVE_INFORMATION"] = 203] = "NON_AUTHORITATIVE_INFORMATION";
1486
+ StatusCodes2[StatusCodes2["NO_CONTENT"] = 204] = "NO_CONTENT";
1487
+ StatusCodes2[StatusCodes2["RESET_CONTENT"] = 205] = "RESET_CONTENT";
1488
+ StatusCodes2[StatusCodes2["PARTIAL_CONTENT"] = 206] = "PARTIAL_CONTENT";
1489
+ StatusCodes2[StatusCodes2["MULTI_STATUS"] = 207] = "MULTI_STATUS";
1490
+ StatusCodes2[StatusCodes2["MULTIPLE_CHOICES"] = 300] = "MULTIPLE_CHOICES";
1491
+ StatusCodes2[StatusCodes2["MOVED_PERMANENTLY"] = 301] = "MOVED_PERMANENTLY";
1492
+ StatusCodes2[StatusCodes2["MOVED_TEMPORARILY"] = 302] = "MOVED_TEMPORARILY";
1493
+ StatusCodes2[StatusCodes2["SEE_OTHER"] = 303] = "SEE_OTHER";
1494
+ StatusCodes2[StatusCodes2["NOT_MODIFIED"] = 304] = "NOT_MODIFIED";
1495
+ StatusCodes2[StatusCodes2["USE_PROXY"] = 305] = "USE_PROXY";
1496
+ StatusCodes2[StatusCodes2["TEMPORARY_REDIRECT"] = 307] = "TEMPORARY_REDIRECT";
1497
+ StatusCodes2[StatusCodes2["PERMANENT_REDIRECT"] = 308] = "PERMANENT_REDIRECT";
1498
+ StatusCodes2[StatusCodes2["BAD_REQUEST"] = 400] = "BAD_REQUEST";
1499
+ StatusCodes2[StatusCodes2["UNAUTHORIZED"] = 401] = "UNAUTHORIZED";
1500
+ StatusCodes2[StatusCodes2["PAYMENT_REQUIRED"] = 402] = "PAYMENT_REQUIRED";
1501
+ StatusCodes2[StatusCodes2["FORBIDDEN"] = 403] = "FORBIDDEN";
1502
+ StatusCodes2[StatusCodes2["NOT_FOUND"] = 404] = "NOT_FOUND";
1503
+ StatusCodes2[StatusCodes2["METHOD_NOT_ALLOWED"] = 405] = "METHOD_NOT_ALLOWED";
1504
+ StatusCodes2[StatusCodes2["NOT_ACCEPTABLE"] = 406] = "NOT_ACCEPTABLE";
1505
+ StatusCodes2[StatusCodes2["PROXY_AUTHENTICATION_REQUIRED"] = 407] = "PROXY_AUTHENTICATION_REQUIRED";
1506
+ StatusCodes2[StatusCodes2["REQUEST_TIMEOUT"] = 408] = "REQUEST_TIMEOUT";
1507
+ StatusCodes2[StatusCodes2["CONFLICT"] = 409] = "CONFLICT";
1508
+ StatusCodes2[StatusCodes2["GONE"] = 410] = "GONE";
1509
+ StatusCodes2[StatusCodes2["LENGTH_REQUIRED"] = 411] = "LENGTH_REQUIRED";
1510
+ StatusCodes2[StatusCodes2["PRECONDITION_FAILED"] = 412] = "PRECONDITION_FAILED";
1511
+ StatusCodes2[StatusCodes2["REQUEST_TOO_LONG"] = 413] = "REQUEST_TOO_LONG";
1512
+ StatusCodes2[StatusCodes2["REQUEST_URI_TOO_LONG"] = 414] = "REQUEST_URI_TOO_LONG";
1513
+ StatusCodes2[StatusCodes2["UNSUPPORTED_MEDIA_TYPE"] = 415] = "UNSUPPORTED_MEDIA_TYPE";
1514
+ StatusCodes2[StatusCodes2["REQUESTED_RANGE_NOT_SATISFIABLE"] = 416] = "REQUESTED_RANGE_NOT_SATISFIABLE";
1515
+ StatusCodes2[StatusCodes2["EXPECTATION_FAILED"] = 417] = "EXPECTATION_FAILED";
1516
+ StatusCodes2[StatusCodes2["IM_A_TEAPOT"] = 418] = "IM_A_TEAPOT";
1517
+ StatusCodes2[StatusCodes2["INSUFFICIENT_SPACE_ON_RESOURCE"] = 419] = "INSUFFICIENT_SPACE_ON_RESOURCE";
1518
+ StatusCodes2[StatusCodes2["METHOD_FAILURE"] = 420] = "METHOD_FAILURE";
1519
+ StatusCodes2[StatusCodes2["MISDIRECTED_REQUEST"] = 421] = "MISDIRECTED_REQUEST";
1520
+ StatusCodes2[StatusCodes2["UNPROCESSABLE_ENTITY"] = 422] = "UNPROCESSABLE_ENTITY";
1521
+ StatusCodes2[StatusCodes2["LOCKED"] = 423] = "LOCKED";
1522
+ StatusCodes2[StatusCodes2["FAILED_DEPENDENCY"] = 424] = "FAILED_DEPENDENCY";
1523
+ StatusCodes2[StatusCodes2["UPGRADE_REQUIRED"] = 426] = "UPGRADE_REQUIRED";
1524
+ StatusCodes2[StatusCodes2["PRECONDITION_REQUIRED"] = 428] = "PRECONDITION_REQUIRED";
1525
+ StatusCodes2[StatusCodes2["TOO_MANY_REQUESTS"] = 429] = "TOO_MANY_REQUESTS";
1526
+ StatusCodes2[StatusCodes2["REQUEST_HEADER_FIELDS_TOO_LARGE"] = 431] = "REQUEST_HEADER_FIELDS_TOO_LARGE";
1527
+ StatusCodes2[StatusCodes2["UNAVAILABLE_FOR_LEGAL_REASONS"] = 451] = "UNAVAILABLE_FOR_LEGAL_REASONS";
1528
+ StatusCodes2[StatusCodes2["INTERNAL_SERVER_ERROR"] = 500] = "INTERNAL_SERVER_ERROR";
1529
+ StatusCodes2[StatusCodes2["NOT_IMPLEMENTED"] = 501] = "NOT_IMPLEMENTED";
1530
+ StatusCodes2[StatusCodes2["BAD_GATEWAY"] = 502] = "BAD_GATEWAY";
1531
+ StatusCodes2[StatusCodes2["SERVICE_UNAVAILABLE"] = 503] = "SERVICE_UNAVAILABLE";
1532
+ StatusCodes2[StatusCodes2["GATEWAY_TIMEOUT"] = 504] = "GATEWAY_TIMEOUT";
1533
+ StatusCodes2[StatusCodes2["HTTP_VERSION_NOT_SUPPORTED"] = 505] = "HTTP_VERSION_NOT_SUPPORTED";
1534
+ StatusCodes2[StatusCodes2["INSUFFICIENT_STORAGE"] = 507] = "INSUFFICIENT_STORAGE";
1535
+ StatusCodes2[StatusCodes2["NETWORK_AUTHENTICATION_REQUIRED"] = 511] = "NETWORK_AUTHENTICATION_REQUIRED";
1536
+ })(StatusCodes || (StatusCodes = {}));
3794
1537
  class FhirClient {
1538
+ // Default value
3795
1539
  constructor(options) {
3796
- __privateAdd(this, _options2);
1540
+ __privateAdd(this, _options);
3797
1541
  __privateAdd(this, _DUMMY_USER, "USR_user01@stsmda.com.au");
3798
1542
  //@@ needs to come from headers ??
3799
1543
  __privateAdd(this, _invokeMethods, {});
@@ -3804,40 +1548,38 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
3804
1548
  StatusCodes.CONFLICT
3805
1549
  ]);
3806
1550
  __privateAdd(this, _stsfhirapiroot, "/stsfhir/r5");
3807
- // Default value
3808
- __privateAdd(this, _agentManager2, null);
3809
1551
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
3810
1552
  __privateAdd(this, _LogDebugMessage, (message) => {
3811
- __privateGet(this, _options2).logger.debug(message);
1553
+ __privateGet(this, _options).logger.debug(message);
3812
1554
  });
3813
1555
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
3814
1556
  __privateAdd(this, _LogErrorMessage, (message) => {
3815
- __privateGet(this, _options2).logger.error(message);
1557
+ __privateGet(this, _options).logger.error(message);
3816
1558
  });
3817
1559
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
3818
1560
  __privateAdd(this, _HandleError, (error) => {
3819
- __privateGet(this, _LogDebugMessage).call(this, chalk$2.red(`HandleError(): Error: [${error}]`));
1561
+ __privateGet(this, _LogDebugMessage).call(this, chalk$1.red(`HandleError(): Error: [${error}]`));
3820
1562
  let responseCode = 500;
3821
1563
  if (axios.isAxiosError(error)) {
3822
1564
  const axiosError = error;
3823
1565
  if (axiosError.response) {
3824
1566
  responseCode = axiosError.response.status;
3825
- __privateGet(this, _LogDebugMessage).call(this, chalk$2.red(`AXIOS Error Response.Status = [${axiosError.response.status}]`));
1567
+ __privateGet(this, _LogDebugMessage).call(this, chalk$1.red(`AXIOS Error Response.Status = [${axiosError.response.status}]`));
3826
1568
  if (axiosError.response.headers) {
3827
- __privateGet(this, _LogErrorMessage).call(this, chalk$2.red(` headers: [${JSON.stringify(axiosError.response.headers)}]`));
1569
+ __privateGet(this, _LogErrorMessage).call(this, chalk$1.red(` headers: [${JSON.stringify(axiosError.response.headers)}]`));
3828
1570
  }
3829
1571
  if (axiosError.response.data) {
3830
- __privateGet(this, _LogErrorMessage).call(this, chalk$2.red(` data: [${JSON.stringify(axiosError.response.data)}]`));
1572
+ __privateGet(this, _LogErrorMessage).call(this, chalk$1.red(` data: [${JSON.stringify(axiosError.response.data)}]`));
3831
1573
  }
3832
1574
  try {
3833
1575
  if (axiosError.response.config) {
3834
- __privateGet(this, _LogErrorMessage).call(this, chalk$2.red(` config: [${JSON.stringify(axiosError.response.config)}]`));
1576
+ __privateGet(this, _LogErrorMessage).call(this, chalk$1.red(` config: [${JSON.stringify(axiosError.response.config)}]`));
3835
1577
  }
3836
1578
  } catch (innererror) {
3837
- __privateGet(this, _LogErrorMessage).call(this, chalk$2.red(` could not get response config, error: [${innererror}]`));
1579
+ __privateGet(this, _LogErrorMessage).call(this, chalk$1.red(` could not get response config, error: [${innererror}]`));
3838
1580
  }
3839
1581
  } else {
3840
- __privateGet(this, _LogDebugMessage).call(this, chalk$2.red(`AXIOS Error = [${axiosError}]`));
1582
+ __privateGet(this, _LogDebugMessage).call(this, chalk$1.red(`AXIOS Error = [${axiosError}]`));
3841
1583
  }
3842
1584
  }
3843
1585
  return responseCode;
@@ -3858,19 +1600,19 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
3858
1600
  const metadataRecord = __privateGet(this, _invokeMethods)[id2];
3859
1601
  let performRetry = false;
3860
1602
  const returnData = await __privateGet(this, ___InvokeResourceAPI).call(this, metadataRecord, (statusCode, error) => {
3861
- console.error(chalk$2.red(`#InvokeResourceAPI(): Error: [${error}], Attempt: [${metadataRecord.retries + 1}]`));
1603
+ console.error(chalk$1.red(`#InvokeResourceAPI(): Error: [${error}], Attempt: [${metadataRecord.retries + 1}]`));
3862
1604
  const noRetryIndex = __privateGet(this, _NoRetryStatusCodes).indexOf(statusCode);
3863
1605
  if (noRetryIndex === -1) {
3864
1606
  if (statusCode === StatusCodes.UNAUTHORIZED) {
3865
- console.error(chalk$2.red(`#InvokeResourceAPI(): Authentication error, resetting access_token (to null).`));
3866
- __privateGet(this, _options2).ResetAccessToken();
3867
- if (__privateGet(this, _options2).clientTelemetryEvents) {
3868
- __privateGet(this, _options2).clientTelemetryEvents.AuthenticationErrorInc();
1607
+ console.error(chalk$1.red(`#InvokeResourceAPI(): Authentication error, resetting access_token (to null).`));
1608
+ __privateGet(this, _options).ResetAccessToken();
1609
+ if (__privateGet(this, _options).clientTelemetryEvents) {
1610
+ __privateGet(this, _options).clientTelemetryEvents.AuthenticationErrorInc();
3869
1611
  }
3870
1612
  }
3871
- if (isNode && __privateGet(this, _agentManager2)) {
3872
- console.error(chalk$2.red(`#InvokeResourceAPI(): Resetting https agent (to null).`));
3873
- __privateGet(this, _agentManager2).ResetAgent();
1613
+ if (isNode && __privateGet(this, _options).agentManager) {
1614
+ console.error(chalk$1.red(`#InvokeResourceAPI(): Resetting https agent (to null).`));
1615
+ __privateGet(this, _options).agentManager.ResetAgent();
3874
1616
  }
3875
1617
  performRetry = true;
3876
1618
  }
@@ -3891,8 +1633,8 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
3891
1633
  console.log(`Sleeping: [${__privateGet(this, _sleepDuration)[__privateGet(this, _invokeMethods)[id].retries]}]`);
3892
1634
  await stsutils.Sleep(__privateGet(this, _sleepDuration)[__privateGet(this, _invokeMethods)[id].retries]);
3893
1635
  __privateGet(this, _invokeMethods)[id].retries++;
3894
- if (__privateGet(this, _options2).clientTelemetryEvents) {
3895
- __privateGet(this, _options2).clientTelemetryEvents.RetryInc();
1636
+ if (__privateGet(this, _options).clientTelemetryEvents) {
1637
+ __privateGet(this, _options).clientTelemetryEvents.RetryInc();
3896
1638
  }
3897
1639
  }
3898
1640
  }
@@ -3923,15 +1665,15 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
3923
1665
  __privateAdd(this, ___InvokeResourceAPI, async (metaData, errorCb) => {
3924
1666
  try {
3925
1667
  const { url, httpVerb, domainResource, filters } = metaData;
3926
- if (__privateGet(this, _options2).testingMode) {
1668
+ if (__privateGet(this, _options).testingMode) {
3927
1669
  if (__privateGet(this, _TestMode).call(this, metaData, errorCb)) {
3928
1670
  return null;
3929
1671
  }
3930
1672
  }
3931
- const accessToken = await __privateGet(this, _options2).GetAccessToken();
3932
- const requestConfig = new STSAxiosConfig(url, httpVerb).withAuthHeaders(accessToken, __privateGet(this, _DUMMY_USER)).withData(filters ? filters : domainResource ? domainResource : void 0);
3933
- if (isNode && __privateGet(this, _agentManager2)) {
3934
- requestConfig.withAgentManager(__privateGet(this, _agentManager2));
1673
+ const accessToken = await __privateGet(this, _options).GetAccessToken();
1674
+ const requestConfig = new stsutils.STSAxiosConfig(url, httpVerb).withAuthHeaders(accessToken, __privateGet(this, _DUMMY_USER)).withData(filters ? filters : domainResource ? domainResource : void 0);
1675
+ if (isNode && __privateGet(this, _options).agentManager) {
1676
+ requestConfig.withAgentManager(__privateGet(this, _options).agentManager);
3935
1677
  }
3936
1678
  return await axios(requestConfig.config);
3937
1679
  } catch (error) {
@@ -3941,7 +1683,7 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
3941
1683
  }
3942
1684
  });
3943
1685
  __publicField(this, "GetResource", async (resource, id, filters, errorCb) => {
3944
- const url = `${__privateGet(this, _options2).fhirEndpoint}${__privateGet(this, _stsfhirapiroot)}/${resource}/${id}`;
1686
+ const url = `${__privateGet(this, _options).fhirEndpoint}${__privateGet(this, _stsfhirapiroot)}/${resource}/${id}`;
3945
1687
  const response = await __privateGet(this, _InvokeResourceAPI).call(this, url, "get", null, filters, errorCb);
3946
1688
  if (response) {
3947
1689
  return response.data;
@@ -3950,7 +1692,7 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
3950
1692
  }
3951
1693
  });
3952
1694
  __publicField(this, "GetResources", async (resource, filters, errorCb) => {
3953
- const url = `${__privateGet(this, _options2).fhirEndpoint}${__privateGet(this, _stsfhirapiroot)}/${resource}`;
1695
+ const url = `${__privateGet(this, _options).fhirEndpoint}${__privateGet(this, _stsfhirapiroot)}/${resource}`;
3954
1696
  const response = await __privateGet(this, _InvokeResourceAPI).call(this, url, "get", null, filters, errorCb);
3955
1697
  if (response) {
3956
1698
  return response.data;
@@ -3959,7 +1701,7 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
3959
1701
  }
3960
1702
  });
3961
1703
  __publicField(this, "CreateResource", async (resource, domainResource, errorCb) => {
3962
- const url = `${__privateGet(this, _options2).fhirEndpoint}${__privateGet(this, _stsfhirapiroot)}/${resource}`;
1704
+ const url = `${__privateGet(this, _options).fhirEndpoint}${__privateGet(this, _stsfhirapiroot)}/${resource}`;
3963
1705
  const response = await __privateGet(this, _InvokeResourceAPI).call(this, url, "post", domainResource, null, errorCb);
3964
1706
  if (response) {
3965
1707
  if (response.status === StatusCodes.CREATED) {
@@ -3973,7 +1715,7 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
3973
1715
  }
3974
1716
  });
3975
1717
  __publicField(this, "UpdateResource", async (resource, domainResource, errorCb) => {
3976
- const url = `${__privateGet(this, _options2).fhirEndpoint}${__privateGet(this, _stsfhirapiroot)}/${resource}/${domainResource.id}`;
1718
+ const url = `${__privateGet(this, _options).fhirEndpoint}${__privateGet(this, _stsfhirapiroot)}/${resource}/${domainResource.id}`;
3977
1719
  const response = await __privateGet(this, _InvokeResourceAPI).call(this, url, "put", domainResource, null, errorCb);
3978
1720
  if (response) {
3979
1721
  return response.data;
@@ -3982,7 +1724,7 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
3982
1724
  }
3983
1725
  });
3984
1726
  __publicField(this, "UpdateResources", async (resource, domainResources, errorCb) => {
3985
- const url = `${__privateGet(this, _options2).fhirEndpoint}${__privateGet(this, _stsfhirapiroot)}/${resource}`;
1727
+ const url = `${__privateGet(this, _options).fhirEndpoint}${__privateGet(this, _stsfhirapiroot)}/${resource}`;
3986
1728
  const response = await __privateGet(this, _InvokeResourceAPI).call(this, url, "put", domainResources, null, errorCb);
3987
1729
  if (response) {
3988
1730
  return response.data;
@@ -3991,7 +1733,7 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
3991
1733
  }
3992
1734
  });
3993
1735
  __publicField(this, "PatchResource", async (resource, domainResource, errorCb) => {
3994
- const url = `${__privateGet(this, _options2).fhirEndpoint}${__privateGet(this, _stsfhirapiroot)}/${resource}/${domainResource.id}`;
1736
+ const url = `${__privateGet(this, _options).fhirEndpoint}${__privateGet(this, _stsfhirapiroot)}/${resource}/${domainResource.id}`;
3995
1737
  const response = await __privateGet(this, _InvokeResourceAPI).call(this, url, "patch", domainResource, null, errorCb);
3996
1738
  if (response) {
3997
1739
  return response.data;
@@ -4000,7 +1742,7 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
4000
1742
  }
4001
1743
  });
4002
1744
  __publicField(this, "PatchResources", async (resource, domainResources, errorCb) => {
4003
- const url = `${__privateGet(this, _options2).fhirEndpoint}${__privateGet(this, _stsfhirapiroot)}/${resource}`;
1745
+ const url = `${__privateGet(this, _options).fhirEndpoint}${__privateGet(this, _stsfhirapiroot)}/${resource}`;
4004
1746
  const response = await __privateGet(this, _InvokeResourceAPI).call(this, url, "patch", domainResources, null, errorCb);
4005
1747
  if (response) {
4006
1748
  return response.data;
@@ -4009,7 +1751,7 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
4009
1751
  }
4010
1752
  });
4011
1753
  __publicField(this, "DeleteResource", async (resource, id, errorCb) => {
4012
- const url = `${__privateGet(this, _options2).fhirEndpoint}${__privateGet(this, _stsfhirapiroot)}/${resource}/${id}`;
1754
+ const url = `${__privateGet(this, _options).fhirEndpoint}${__privateGet(this, _stsfhirapiroot)}/${resource}/${id}`;
4013
1755
  const response = await __privateGet(this, _InvokeResourceAPI).call(this, url, "delete", null, null, errorCb);
4014
1756
  if (response) {
4015
1757
  return response.data;
@@ -4018,7 +1760,7 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
4018
1760
  }
4019
1761
  });
4020
1762
  __publicField(this, "DeleteResources", async (resource, domainResources, errorCb) => {
4021
- const url = `${__privateGet(this, _options2).fhirEndpoint}${__privateGet(this, _stsfhirapiroot)}/${resource}`;
1763
+ const url = `${__privateGet(this, _options).fhirEndpoint}${__privateGet(this, _stsfhirapiroot)}/${resource}`;
4022
1764
  const response = await __privateGet(this, _InvokeResourceAPI).call(this, url, "delete", domainResources, null, errorCb);
4023
1765
  if (response) {
4024
1766
  return response.data;
@@ -4027,43 +1769,33 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
4027
1769
  }
4028
1770
  });
4029
1771
  __publicField(this, "GetLatency", async () => {
4030
- const url = `${__privateGet(this, _options2).fhirEndpoint}${__privateGet(this, _stsfhirapiroot)}/latency`;
1772
+ const url = `${__privateGet(this, _options).fhirEndpoint}${__privateGet(this, _stsfhirapiroot)}/latency`;
4031
1773
  try {
4032
- const requestConfig = new STSAxiosConfig(url, "get").withDefaultHeaders();
4033
- if (isNode && __privateGet(this, _agentManager2)) {
4034
- requestConfig.withAgentManager(__privateGet(this, _agentManager2));
1774
+ const requestConfig = new stsutils.STSAxiosConfig(url, "get").withDefaultHeaders();
1775
+ if (isNode && __privateGet(this, _options).agentManager) {
1776
+ requestConfig.withAgentManager(__privateGet(this, _options).agentManager);
4035
1777
  }
4036
1778
  return await axios(requestConfig.config);
4037
1779
  } catch (error) {
4038
1780
  __privateGet(this, _HandleError).call(this, error);
4039
1781
  }
4040
1782
  });
4041
- __privateSet(this, _options2, options);
4042
- if (__privateGet(this, _options2).stsfhirapiroot !== void 0) {
4043
- __privateSet(this, _stsfhirapiroot, __privateGet(this, _options2).stsfhirapiroot);
4044
- }
4045
- if (isNode) {
4046
- if (__privateGet(this, _options2).agentOptions) {
4047
- __privateSet(this, _agentManager2, new AgentManager({
4048
- agentOptions: __privateGet(this, _options2).agentOptions
4049
- }));
4050
- } else {
4051
- __privateSet(this, _agentManager2, new AgentManager({}));
4052
- }
1783
+ __privateSet(this, _options, options);
1784
+ if (__privateGet(this, _options).stsfhirapiroot !== void 0) {
1785
+ __privateSet(this, _stsfhirapiroot, __privateGet(this, _options).stsfhirapiroot);
4053
1786
  }
4054
1787
  }
4055
1788
  get options() {
4056
- return __privateGet(this, _options2);
1789
+ return __privateGet(this, _options);
4057
1790
  }
4058
1791
  }
4059
- _options2 = new WeakMap();
1792
+ _options = new WeakMap();
4060
1793
  _DUMMY_USER = new WeakMap();
4061
1794
  _invokeMethods = new WeakMap();
4062
1795
  _maxRetries = new WeakMap();
4063
1796
  _sleepDuration = new WeakMap();
4064
1797
  _NoRetryStatusCodes = new WeakMap();
4065
1798
  _stsfhirapiroot = new WeakMap();
4066
- _agentManager2 = new WeakMap();
4067
1799
  _LogDebugMessage = new WeakMap();
4068
1800
  _LogErrorMessage = new WeakMap();
4069
1801
  _HandleError = new WeakMap();