@nsshunt/stsfhirclient 1.0.18 → 1.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/stsfhirclient.mjs +2400 -189
- package/dist/stsfhirclient.mjs.map +1 -1
- package/dist/stsfhirclient.umd.js +2374 -163
- package/dist/stsfhirclient.umd.js.map +1 -1
- package/package.json +4 -4
- package/types/FhirClient.d.ts.map +1 -1
- package/types/stsfhircontrollertestcasesdirect.d.ts.map +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
(function(global, factory) {
|
|
2
|
-
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("
|
|
3
|
-
})(this, function(exports2,
|
|
2
|
+
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("axios"), require("@nsshunt/stsutils"), require("node:https")) : typeof define === "function" && define.amd ? define(["exports", "axios", "@nsshunt/stsutils", "node:https"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global["@nsshunt/stsfhirclient"] = {}, global.axios, global.stsutils, global.https));
|
|
3
|
+
})(this, function(exports2, axios, stsutils, https) {
|
|
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
|
|
15
|
+
var _options2, _DUMMY_USER, _invokeMethods, _maxRetries, _sleepDuration, _NoRetryStatusCodes, _stsfhirapiroot, _agentManager2, _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,6 +49,1879 @@ 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
|
+
const http = {};
|
|
1562
|
+
const fs$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1563
|
+
__proto__: null,
|
|
1564
|
+
default: http
|
|
1565
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
1566
|
+
var main$1 = { exports: {} };
|
|
1567
|
+
const require$$3 = /* @__PURE__ */ getAugmentedNamespace(fs$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$$3;
|
|
1649
|
+
const path = require$$3;
|
|
1650
|
+
const os = require$$3;
|
|
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
|
+
var config_1 = 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 __typeError2 = (msg) => {
|
|
1910
|
+
throw TypeError(msg);
|
|
1911
|
+
};
|
|
1912
|
+
var __accessCheck2 = (obj, member, msg) => member.has(obj) || __typeError2("Cannot " + msg);
|
|
1913
|
+
var __privateGet2 = (obj, member, getter) => (__accessCheck2(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
1914
|
+
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);
|
|
1915
|
+
var __privateSet2 = (obj, member, value, setter) => (__accessCheck2(obj, member, "write to private field"), member.set(obj, value), value);
|
|
1916
|
+
var __privateWrapper = (obj, member, setter, getter) => ({
|
|
1917
|
+
set _(value) {
|
|
1918
|
+
__privateSet2(obj, member, value);
|
|
1919
|
+
},
|
|
1920
|
+
get _() {
|
|
1921
|
+
return __privateGet2(obj, member, getter);
|
|
1922
|
+
}
|
|
1923
|
+
});
|
|
1924
|
+
var _options, _httpAgent, _httpsAgent, _agentResetInterval, _requestCount, _SetupResetInterval, _GetAgentOptions, _url, _method, _headers, _data, _agentManager, _timeout, _withCredentials;
|
|
52
1925
|
var ansiStyles$1 = { exports: {} };
|
|
53
1926
|
var colorName;
|
|
54
1927
|
var hasRequiredColorName;
|
|
@@ -923,15 +2796,15 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
|
|
|
923
2796
|
};
|
|
924
2797
|
}
|
|
925
2798
|
function wrapConversion(toModel, graph) {
|
|
926
|
-
const
|
|
2799
|
+
const path2 = [graph[toModel].parent, toModel];
|
|
927
2800
|
let fn = conversions2[graph[toModel].parent][toModel];
|
|
928
2801
|
let cur = graph[toModel].parent;
|
|
929
2802
|
while (graph[cur].parent) {
|
|
930
|
-
|
|
2803
|
+
path2.unshift(graph[cur].parent);
|
|
931
2804
|
fn = link(conversions2[graph[cur].parent][cur], fn);
|
|
932
2805
|
cur = graph[cur].parent;
|
|
933
2806
|
}
|
|
934
|
-
fn.conversion =
|
|
2807
|
+
fn.conversion = path2;
|
|
935
2808
|
return fn;
|
|
936
2809
|
}
|
|
937
2810
|
route = function(fromModel) {
|
|
@@ -1051,11 +2924,11 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
|
|
|
1051
2924
|
const offset = isBackground ? 10 : 0;
|
|
1052
2925
|
const styles2 = {};
|
|
1053
2926
|
for (const [sourceSpace, suite] of Object.entries(colorConvert2)) {
|
|
1054
|
-
const
|
|
2927
|
+
const name2 = sourceSpace === "ansi16" ? "ansi" : sourceSpace;
|
|
1055
2928
|
if (sourceSpace === targetSpace) {
|
|
1056
|
-
styles2[
|
|
2929
|
+
styles2[name2] = wrap(identity, offset);
|
|
1057
2930
|
} else if (typeof suite === "object") {
|
|
1058
|
-
styles2[
|
|
2931
|
+
styles2[name2] = wrap(suite[targetSpace], offset);
|
|
1059
2932
|
}
|
|
1060
2933
|
}
|
|
1061
2934
|
return styles2;
|
|
@@ -1219,7 +3092,7 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
|
|
|
1219
3092
|
}
|
|
1220
3093
|
return ESCAPES.get(c) || c;
|
|
1221
3094
|
}
|
|
1222
|
-
function parseArguments(
|
|
3095
|
+
function parseArguments(name2, arguments_) {
|
|
1223
3096
|
const results = [];
|
|
1224
3097
|
const chunks = arguments_.trim().split(/\s*,\s*/g);
|
|
1225
3098
|
let matches;
|
|
@@ -1230,7 +3103,7 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
|
|
|
1230
3103
|
} else if (matches = chunk.match(STRING_REGEX)) {
|
|
1231
3104
|
results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, character) => escape ? unescape(escape) : character));
|
|
1232
3105
|
} else {
|
|
1233
|
-
throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${
|
|
3106
|
+
throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name2}')`);
|
|
1234
3107
|
}
|
|
1235
3108
|
}
|
|
1236
3109
|
return results;
|
|
@@ -1240,12 +3113,12 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
|
|
|
1240
3113
|
const results = [];
|
|
1241
3114
|
let matches;
|
|
1242
3115
|
while ((matches = STYLE_REGEX.exec(style)) !== null) {
|
|
1243
|
-
const
|
|
3116
|
+
const name2 = matches[1];
|
|
1244
3117
|
if (matches[2]) {
|
|
1245
|
-
const args = parseArguments(
|
|
1246
|
-
results.push([
|
|
3118
|
+
const args = parseArguments(name2, matches[2]);
|
|
3119
|
+
results.push([name2].concat(args));
|
|
1247
3120
|
} else {
|
|
1248
|
-
results.push([
|
|
3121
|
+
results.push([name2]);
|
|
1249
3122
|
}
|
|
1250
3123
|
}
|
|
1251
3124
|
return results;
|
|
@@ -1471,76 +3344,438 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
|
|
|
1471
3344
|
chalk.supportsColor = stdoutColor;
|
|
1472
3345
|
chalk.stderr = Chalk({ level: stderrColor ? stderrColor.level : 0 });
|
|
1473
3346
|
chalk.stderr.supportsColor = stderrColor;
|
|
1474
|
-
|
|
1475
|
-
const
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
3347
|
+
const { accessSync, constants, readFileSync } = fs$1;
|
|
3348
|
+
const envOptions = {};
|
|
3349
|
+
function SetupConfig(envOptions2, logger) {
|
|
3350
|
+
const envfile = process.env.STSENVFILE === void 0 ? "/.env" : process.env.STSENVFILE;
|
|
3351
|
+
config_1({ path: envfile });
|
|
3352
|
+
const defconfig = {
|
|
3353
|
+
// Node runtime environment
|
|
3354
|
+
isProduction: process.env.NODE_ENV === void 0 ? false : process.env.NODE_ENV === "production" ? true : false,
|
|
3355
|
+
isTest: process.env.NODE_ENV === void 0 ? false : process.env.NODE_ENV === "test" ? true : false,
|
|
3356
|
+
dbuser: process.env.DB_USER === void 0 ? "postgres" : process.env.DB_USER,
|
|
3357
|
+
dbpassword: process.env.DB_PASSWORD === void 0 ? "postgres" : process.env.DB_PASSWORD,
|
|
3358
|
+
dbpasswordfile: process.env.DB_PASSWORD_FILE,
|
|
3359
|
+
dbhost: process.env.DB_HOST === void 0 ? "localhost:5432" : process.env.DB_HOST,
|
|
3360
|
+
database: process.env.DB_DATABASE === void 0 ? "stsrestmsdb01" : process.env.DB_DATABASE,
|
|
3361
|
+
databaseUrl: process.env.DATABASE_URL,
|
|
3362
|
+
connectionString: "",
|
|
3363
|
+
defaultDatabaseConnectionString: "",
|
|
3364
|
+
STSServerType: process.env.STS_SERVER_TYPE === void 0 ? "EXPRESS_TLS" : process.env.STS_SERVER_TYPE,
|
|
3365
|
+
logToFile: process.env.LOG_TO_FILE === void 0 ? false : process.env.LOG_TO_FILE === "true" ? true : false,
|
|
3366
|
+
logFilePath: process.env.LOG_FILE_PATH === void 0 ? "/var/lib/sts" : process.env.LOG_FILE_PATH,
|
|
3367
|
+
logFileFormat: process.env.LOG_FILE_FORMAT === void 0 ? "csv" : process.env.LOG_FILE_FORMAT,
|
|
3368
|
+
poolSize: process.env.POOL_SIZE === void 0 ? 500 : parseInt(process.env.POOL_SIZE),
|
|
3369
|
+
useCPUs: process.env.MAX_CPU === void 0 ? -1 : parseFloat(process.env.MAX_CPU),
|
|
3370
|
+
respawnOnFail: process.env.RESPAWN === void 0 ? true : process.env.RESPAWN === "true" ? true : false,
|
|
3371
|
+
defaultDatabaseEntries: process.env.DEFAULT_DB_ENTRIES === void 0 ? 1e4 : parseInt(process.env.DEFAULT_DB_ENTRIES),
|
|
3372
|
+
useRedisDatabaseCache: process.env.USE_REDIS_DATABASE_CACHE === void 0 ? false : process.env.USE_REDIS_DATABASE_CACHE === "true" ? true : false,
|
|
3373
|
+
useSocketIoRedisAdaptor: process.env.USE_SOCKET_IO_REDIS_ADAPTOR === void 0 ? false : process.env.USE_SOCKET_IO_REDIS_ADAPTOR === "true" ? true : false,
|
|
3374
|
+
socketIoRedisAdaptorUrl: process.env.SOCKET_IO_REDIS_ADAPTOR_URL === void 0 ? "redis://localhost:6379" : process.env.SOCKET_IO_REDIS_ADAPTOR_URL,
|
|
3375
|
+
useRedisInstrumentationTransport: process.env.USE_REDIS_INSTRUMENTATION_TRANSPORT === void 0 ? false : process.env.USE_REDIS_INSTRUMENTATION_TRANSPORT === "true" ? true : false,
|
|
3376
|
+
redisInstrumentationTransportUrl: process.env.REDIS_INSTRUMENTATION_TRANSPORT_URL === void 0 ? "redis://localhost:6379" : process.env.REDIS_INSTRUMENTATION_TRANSPORT_URL,
|
|
3377
|
+
redisDatabaseCacheEndFlush: process.env.REDIS_DATABASE_CACHE_END_FLUSH === void 0 ? false : process.env.REDIS_DATABASE_CACHE_END_FLUSH === "true" ? true : false,
|
|
3378
|
+
redisDatabaseCacheUrl: process.env.REDIS_DATABASE_CACHE_URL === void 0 ? "redis://localhost:6379" : process.env.REDIS_DATABASE_CACHE_URL,
|
|
3379
|
+
defaultDatabaseMinExtraDataSize: process.env.DEFAULT_DATABASE_MIN_EXTRA_DATA_SIZE === void 0 ? 0 : parseInt(process.env.DEFAULT_DATABASE_MIN_EXTRA_DATA_SIZE),
|
|
3380
|
+
defaultDatabaseMaxExtraDataSize: process.env.DEFAULT_DATABASE_MAX_EXTRA_DATA_SIZE === void 0 ? 2e3 : parseInt(process.env.DEFAULT_DATABASE_MAX_EXTRA_DATA_SIZE),
|
|
3381
|
+
rest01endpoint: process.env.REST01_ENDPOINT === void 0 ? "https://localhost" : process.env.REST01_ENDPOINT,
|
|
3382
|
+
rest01hostport: process.env.REST01_HOST_PORT === void 0 ? "3003" : process.env.REST01_HOST_PORT,
|
|
3383
|
+
rest01port: process.env.REST01_PORT === void 0 ? "3003" : process.env.REST01_PORT,
|
|
3384
|
+
rest01apiroot: process.env.REST01_APIROOT === void 0 ? "/stsrest01/v1" : process.env.REST01_APIROOT,
|
|
3385
|
+
rest01prometheussupport: process.env.REST01_PROM_SUPPORT === void 0 ? true : process.env.REST01_PROM_SUPPORT === "true" ? true : false,
|
|
3386
|
+
rest01prometheusclusterport: process.env.REST01_PROM_CLUSTER_PORT === void 0 ? "3013" : process.env.REST01_PROM_CLUSTER_PORT,
|
|
3387
|
+
rest01servicename: process.env.REST01_SERVICE_NAME === void 0 ? "STSRest01" : process.env.REST01_SERVICE_NAME,
|
|
3388
|
+
rest01serviceversion: process.env.REST01_SERVICE_VERSION === void 0 ? "1.0.0" : process.env.REST01_SERVICE_VERSION,
|
|
3389
|
+
stsfhirendpoint: process.env.STSFHIR_ENDPOINT === void 0 ? "https://localhost" : process.env.STSFHIR_ENDPOINT,
|
|
3390
|
+
stsfhirhostport: process.env.STSFHIR_HOST_PORT === void 0 ? "3005" : process.env.STSFHIR_HOST_PORT,
|
|
3391
|
+
stsfhirport: process.env.STSFHIR_PORT === void 0 ? "3005" : process.env.STSFHIR_PORT,
|
|
3392
|
+
stsfhirapiroot: process.env.STSFHIR_APIROOT === void 0 ? "/stsfhir/r5" : process.env.STSFHIR_APIROOT,
|
|
3393
|
+
stsfhirprometheussupport: process.env.STSFHIR_PROM_SUPPORT === void 0 ? true : process.env.STSFHIR_PROM_SUPPORT === "true" ? true : false,
|
|
3394
|
+
stsfhirprometheusclusterport: process.env.STSFHIR_PROM_CLUSTER_PORT === void 0 ? "3015" : process.env.STSFHIR_PROM_CLUSTER_PORT,
|
|
3395
|
+
stsfhirservicename: process.env.STSFHIR_SERVICE_NAME === void 0 ? "STSFHIR" : process.env.STSFHIR_SERVICE_NAME,
|
|
3396
|
+
stsfhirserviceversion: process.env.STSFHIR_SERVICE_VERSION === void 0 ? "1.0.0" : process.env.STSFHIR_SERVICE_VERSION,
|
|
3397
|
+
imendpoint: process.env.IM_ENDPOINT === void 0 ? "https://localhost" : process.env.IM_ENDPOINT,
|
|
3398
|
+
imhostport: process.env.IM_HOST_PORT === void 0 ? "3001" : process.env.IM_HOST_PORT,
|
|
3399
|
+
import: process.env.IM_PORT === void 0 ? "3001" : process.env.IM_PORT,
|
|
3400
|
+
imapiroot: process.env.IM_APIROOT === void 0 ? "/stsinstrumentmanager/v1" : process.env.IM_APIROOT,
|
|
3401
|
+
imprometheussupport: process.env.IM_PROM_SUPPORT === void 0 ? true : process.env.IM_PROM_SUPPORT === "true" ? true : false,
|
|
3402
|
+
imprometheusclusterport: process.env.IM_PROM_CLUSTER_PORT === void 0 ? "3011" : process.env.IM_PROM_CLUSTER_PORT,
|
|
3403
|
+
imservicename: process.env.IM_SERVICE_NAME === void 0 ? "STSInstrumentManager" : process.env.IM_SERVICE_NAME,
|
|
3404
|
+
imserviceversion: process.env.IM_SERVICE_VERSION === void 0 ? "1.0.0" : process.env.IM_SERVICE_VERSION,
|
|
3405
|
+
imRedisKeepAliveProcessorUrl: process.env.IM_REDIS_KEEP_ALIVE_PROCESSOR_URL === void 0 ? "redis://localhost:6379" : process.env.IM_REDIS_KEEP_ALIVE_PROCESSOR_URL,
|
|
3406
|
+
imRedisMessageProcessorUrl: process.env.IM_REDIS_MESSAGE_PROCESSOR_URL === void 0 ? "redis://localhost:6379" : process.env.IM_REDIS_MESSAGE_PROCESSOR_URL,
|
|
3407
|
+
asendpoint: process.env.AS_ENDPOINT === void 0 ? "https://localhost" : process.env.AS_ENDPOINT,
|
|
3408
|
+
ashostport: process.env.AS_HOST_PORT === void 0 ? "3002" : process.env.AS_HOST_PORT,
|
|
3409
|
+
asport: process.env.AS_PORT === void 0 ? "3002" : process.env.AS_PORT,
|
|
3410
|
+
asapiroot: process.env.AS_API_ROOT === void 0 ? "/stsauth/v1.0" : process.env.AS_API_ROOT,
|
|
3411
|
+
asoauthapiroot: process.env.AS_OAUTH_API_ROOT === void 0 ? "/oauth2/v2.0" : process.env.AS_OAUTH_API_ROOT,
|
|
3412
|
+
asadminapiroot: process.env.AS_ADMIN_API_ROOT === void 0 ? "/admin/v1.0" : process.env.AS_ADMIN_API_ROOT,
|
|
3413
|
+
asprometheussupport: process.env.AS_PROM_SUPPORT === void 0 ? true : process.env.AS_PROM_SUPPORT === "true" ? true : false,
|
|
3414
|
+
asprometheusclusterport: process.env.AS_PROM_CLUSTER_PORT === void 0 ? "3012" : process.env.AS_PROM_CLUSTER_PORT,
|
|
3415
|
+
asservicename: process.env.AS_SERVICE_NAME === void 0 ? "STSAuth" : process.env.AS_SERVICE_NAME,
|
|
3416
|
+
asserviceversion: process.env.AS_SERVICE_VERSION === void 0 ? "1.0.0" : process.env.AS_SERVICE_VERSION,
|
|
3417
|
+
asjwksjsonpath: process.env.AS_JWKS_JSON_PATH === void 0 ? "/.well-known/jwks.json" : process.env.AS_JWKS_JSON_PATH,
|
|
3418
|
+
asjwkskeyrotationtime: process.env.AS_JWKS_KEY_ROTATION_TIME === void 0 ? 86400 : parseInt(process.env.AS_JWKS_KEY_ROTATION_TIME),
|
|
3419
|
+
asjwkskeypurgetimeoffset: process.env.AS_JWKS_KEY_PURGE_TIME_OFFSET === void 0 ? 300 : parseInt(process.env.AS_JWKS_KEY_PURGE_TIME_OFFSET),
|
|
3420
|
+
asjwkskeycount: process.env.AS_JWKS_KEY_COUNT === void 0 ? 4 : parseInt(process.env.AS_JWKS_KEY_COUNT),
|
|
3421
|
+
asaccesstokenexpire: process.env.AS_ACCESS_TOKEN_EXPIRE === void 0 ? 43200 : parseInt(process.env.AS_ACCESS_TOKEN_EXPIRE),
|
|
3422
|
+
authorizeendpoint: process.env.AUTHORIZE_ENDPOINT === void 0 ? "https://localhost" : process.env.AUTHORIZE_ENDPOINT,
|
|
3423
|
+
authorizeport: process.env.AUTHORIZE_PORT === void 0 ? "3010" : process.env.AUTHORIZE_PORT,
|
|
3424
|
+
authorizeapiroot: process.env.AUTHORIZE_API_ROOT === void 0 ? "/stsa" : process.env.AUTHORIZE_API_ROOT,
|
|
3425
|
+
authorizeapi: process.env.AUTHORIZE_API === void 0 ? "/authorize" : process.env.AUTHORIZE_API,
|
|
3426
|
+
brokerendpoint: process.env.BROKER_ENDPOINT === void 0 ? "https://localhost" : process.env.BROKER_ENDPOINT,
|
|
3427
|
+
brokerhostport: process.env.BROKER_HOST_PORT === void 0 ? "3006" : process.env.BROKER_HOST_PORT,
|
|
3428
|
+
brokerport: process.env.BROKER_PORT === void 0 ? "3006" : process.env.BROKER_PORT,
|
|
3429
|
+
brokerapiroot: process.env.BROKER_APIROOT === void 0 ? "/stsbroker/v1.0" : process.env.BROKER_APIROOT,
|
|
3430
|
+
brokerprometheussupport: process.env.BROKER_PROM_SUPPORT === void 0 ? true : process.env.BROKER_PROM_SUPPORT === "true" ? true : false,
|
|
3431
|
+
brokerprometheusclusterport: process.env.BROKER_PROM_CLUSTER_PORT === void 0 ? "3016" : process.env.BROKER_PROM_CLUSTER_PORT,
|
|
3432
|
+
brokerservicename: process.env.BROKER_SERVICE_NAME === void 0 ? "STSBroker" : process.env.BROKER_SERVICE_NAME,
|
|
3433
|
+
brokerserviceversion: process.env.BROKER_SERVICE_VERSION === void 0 ? "1.0.0" : process.env.BROKER_SERVICE_VERSION,
|
|
3434
|
+
trnendpoint: process.env.TRN_ENDPOINT === void 0 ? "https://localhost" : process.env.TRN_ENDPOINT,
|
|
3435
|
+
trnhostport: process.env.TRN_HOST_PORT === void 0 ? "3007" : process.env.TRN_HOST_PORT,
|
|
3436
|
+
trnport: process.env.TRN_PORT === void 0 ? "3007" : process.env.TRN_PORT,
|
|
3437
|
+
trnapiroot: process.env.TRN_APIROOT === void 0 ? "/ststrn/v1.0" : process.env.TRN_APIROOT,
|
|
3438
|
+
trnprometheussupport: process.env.TRN_PROM_SUPPORT === void 0 ? true : process.env.TRN_PROM_SUPPORT === "true" ? true : false,
|
|
3439
|
+
trnprometheusclusterport: process.env.TRN_PROM_CLUSTER_PORT === void 0 ? "3017" : process.env.TRN_PROM_CLUSTER_PORT,
|
|
3440
|
+
trnservicename: process.env.TRN_SERVICE_NAME === void 0 ? "STSTestRunnerNode" : process.env.TRN_SERVICE_NAME,
|
|
3441
|
+
trnserviceversion: process.env.TRN_SERVICE_VERSION === void 0 ? "1.0.0" : process.env.TRN_SERVICE_VERSION,
|
|
3442
|
+
trnautostartdelay: process.env.TRN_AUTO_START_DELAY === void 0 ? 0 : parseInt(process.env.TRN_AUTO_START_DELAY),
|
|
3443
|
+
trnautostartconfig: process.env.TRN_AUTO_START_CONFIG === void 0 ? "" : process.env.TRN_AUTO_START_CONFIG,
|
|
3444
|
+
trnRedisMessageProcessorUrl: process.env.TRN_REDIS_MESSAGE_PROCESSOR_URL === void 0 ? "redis://localhost:6379" : process.env.TRN_REDIS_MESSAGE_PROCESSOR_URL,
|
|
3445
|
+
lambdaendpoint: process.env.LAMBDA_ENDPOINT === void 0 ? "https://localhost" : process.env.LAMBDA_ENDPOINT,
|
|
3446
|
+
lambdahostport: process.env.LAMBDA_HOST_PORT === void 0 ? "3009" : process.env.LAMBDA_HOST_PORT,
|
|
3447
|
+
lambdaport: process.env.LAMBDA_PORT === void 0 ? "3009" : process.env.LAMBDA_PORT,
|
|
3448
|
+
lambdaapiroot: process.env.LAMBDA_APIROOT === void 0 ? "/stslambda/v1.0" : process.env.LAMBDA_APIROOT,
|
|
3449
|
+
lambdaprometheussupport: process.env.LAMBDA_PROM_SUPPORT === void 0 ? true : process.env.LAMBDA_PROM_SUPPORT === "true" ? true : false,
|
|
3450
|
+
lambdaprometheusclusterport: process.env.LAMBDA_PROM_CLUSTER_PORT === void 0 ? "3019" : process.env.LAMBDA_PROM_CLUSTER_PORT,
|
|
3451
|
+
lambdaservicename: process.env.LAMBDA_SERVICE_NAME === void 0 ? "STSLambda" : process.env.LAMBDA_SERVICE_NAME,
|
|
3452
|
+
lambdaserviceversion: process.env.LAMBDA_SERVICE_VERSION === void 0 ? "1.0.0" : process.env.LAMBDA_SERVICE_VERSION,
|
|
3453
|
+
publishinterval: process.env.PUBLISH_INTERVAL === void 0 ? 1e3 : parseInt(process.env.PUBLISH_INTERVAL),
|
|
3454
|
+
publishtimeout: process.env.PUBLISH_TIMEOUT === void 0 ? 750 : parseInt(process.env.PUBLISH_TIMEOUT),
|
|
3455
|
+
transport: process.env.TRANSPORT === void 0 ? "RESTAPI" : process.env.TRANSPORT,
|
|
3456
|
+
useSecureCookies: process.env.USE_SECURE_COOKIES === void 0 ? false : process.env.USE_SECURE_COOKIES === "true" ? true : false,
|
|
3457
|
+
keepAlive: process.env.KEEP_ALIVE === void 0 ? true : process.env.KEEP_ALIVE === "true" ? true : false,
|
|
3458
|
+
maxSockets: process.env.MAX_SOCKETS === void 0 ? 10 : parseInt(process.env.MAX_SOCKETS),
|
|
3459
|
+
maxTotalSockets: process.env.MAX_TOTAL_SOCKETS === void 0 ? 20 : parseInt(process.env.MAX_TOTAL_SOCKETS),
|
|
3460
|
+
maxFreeSockets: process.env.MAX_FREE_SOCKETS === void 0 ? 256 : parseInt(process.env.MAX_FREE_SOCKETS),
|
|
3461
|
+
timeout: process.env.TIMEOUT === void 0 ? 1e4 : parseInt(process.env.TIMEOUT),
|
|
3462
|
+
maxPayloadSize: process.env.MAX_PAYLOAD_SIZE === void 0 ? "50mb" : process.env.MAX_PAYLOAD_SIZE,
|
|
3463
|
+
instrumentationObservationInterval: process.env.INSTRUMENTATION_OBSERVATION_INTERVAL === void 0 ? 1e3 : parseInt(process.env.INSTRUMENTATION_OBSERVATION_INTERVAL),
|
|
3464
|
+
instrumentationTimeWindow: process.env.INSTRUMENTATION_TIME_WINDOW === void 0 ? 600 : parseInt(process.env.INSTRUMENTATION_TIME_WINDOW),
|
|
3465
|
+
authJWTAccessTokenTimeout: process.env.AUTH_JWT_ACCESS_TOKEN_TIMEOUT === void 0 ? 600 : parseInt(process.env.AUTH_JWT_ACCESS_TOKEN_TIMEOUT),
|
|
3466
|
+
authJWTRefreshTokenTimeout: process.env.AUTH_JWT_REFRESH_TOKEN_TIMEOUT === void 0 ? 3600 * 24 : parseInt(process.env.AUTH_JWT_REFRESH_TOKEN_TIMEOUT),
|
|
3467
|
+
authCookieTimeout: process.env.AUTH_COOKIE_TIMEOUT === void 0 ? 3600 * 24 : parseInt(process.env.AUTH_COOKIE_TIMEOUT),
|
|
3468
|
+
masterProcessExitTime: process.env.MASTER_PROCESS_EXIT_TIME === void 0 ? 500 : parseInt(process.env.MASTER_PROCESS_EXIT_TIME),
|
|
3469
|
+
childProcessExitTime: process.env.CHILD_PROCESS_EXIT_TIME === void 0 ? 500 : parseInt(process.env.CHILD_PROCESS_EXIT_TIME),
|
|
3470
|
+
systemInformationInterval: process.env.SYSTEM_INFORMATION_INTERVAL === void 0 ? 1e3 : parseInt(process.env.SYSTEM_INFORMATION_INTERVAL),
|
|
3471
|
+
ignoresocketio: process.env.IGNORE_SOCKETIO === void 0 ? true : process.env.IGNORE_SOCKETIO === "true" ? true : false,
|
|
3472
|
+
httpsserverkeypath: process.env.HTTPS_SERVER_KEY_PATH === void 0 ? "/var/lib/sts/stsglobalresources/keys/server.key" : process.env.HTTPS_SERVER_KEY_PATH,
|
|
3473
|
+
httpsservercertpath: process.env.HTTPS_SERVER_CERT_PATH === void 0 ? "/var/lib/sts/stsglobalresources/keys/server.cert" : process.env.HTTPS_SERVER_CERT_PATH,
|
|
3474
|
+
tsjwkskeys: process.env.TS_JWKS_KEYS === void 0 ? 3 : parseInt(process.env.TS_JWKS_KEYS),
|
|
3475
|
+
jwksAuthConfigCache: process.env.JWKS_AUTH_CONFIG_CACHE === void 0 ? true : process.env.JWKS_AUTH_CONFIG_CACHE === "true" ? true : false,
|
|
3476
|
+
jwksAuthConfigCacheMaxEntries: process.env.JWKS_AUTH_CONFIG_CACHE_MAX_ENTRIES === void 0 ? 5 : parseInt(process.env.JWKS_AUTH_CONFIG_CACHE_MAX_ENTRIES),
|
|
3477
|
+
jwksAuthConfigCacheMaxAge: process.env.JWKS_AUTH_CONFIG_CACHE_MAX_AGE === void 0 ? 6e5 : parseInt(process.env.JWKS_AUTH_CONFIG_CACHE_MAX_AGE),
|
|
3478
|
+
jwksAuthConfigRateLimit: process.env.JWKS_AUTH_CONFIG_RATE_LIMIT === void 0 ? true : process.env.JWKS_AUTH_CONFIG_RATE_LIMIT === "true" ? true : false,
|
|
3479
|
+
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),
|
|
3480
|
+
jwksAuthConfigTimeout: process.env.JWKS_AUTH_CONFIG_TIMEOUT === void 0 ? 3e4 : parseInt(process.env.JWKS_AUTH_CONFIG_TIMEOUT),
|
|
3481
|
+
influxDB_APIToken: process.env.INFLUXDB_API_TOKEN === void 0 ? "password" : process.env.INFLUXDB_API_TOKEN,
|
|
3482
|
+
influxDB_APITokenFile: process.env.INFLUXDB_API_TOKEN_FILE,
|
|
3483
|
+
influxDB_Url: process.env.INFLUXDB_URL === void 0 ? "http://localhost:8086" : process.env.INFLUXDB_URL,
|
|
3484
|
+
influxDB_Org: process.env.INFLUXDB_ORG === void 0 ? "my-org" : process.env.INFLUXDB_ORG,
|
|
3485
|
+
influxDB_Bucket: process.env.INFLUXDB_BUCKET === void 0 ? "TestBucket01" : process.env.INFLUXDB_BUCKET,
|
|
3486
|
+
influxDB_keepAlive: process.env.INFLUXDB_KEEP_ALIVE === void 0 ? true : process.env.INFLUXDB_KEEP_ALIVE === "true" ? true : false,
|
|
3487
|
+
influxDB_maxSockets: process.env.INFLUXDB_MAX_SOCKETS === void 0 ? 10 : parseInt(process.env.INFLUXDB_MAX_SOCKETS),
|
|
3488
|
+
influxDB_maxTotalSockets: process.env.INFLUXDB_MAX_TOTAL_SOCKETS === void 0 ? 20 : parseInt(process.env.INFLUXDB_MAX_TOTAL_SOCKETS),
|
|
3489
|
+
influxDB_maxFreeSockets: process.env.INFLUXDB_MAX_FREE_SOCKETS === void 0 ? 256 : parseInt(process.env.INFLUXDB_MAX_FREE_SOCKETS),
|
|
3490
|
+
influxDB_timeout: process.env.INFLUXDB_TIMEOUT === void 0 ? 1e4 : parseInt(process.env.INFLUXDB_TIMEOUT),
|
|
3491
|
+
influxDB_rejectUnauthorized: process.env.INFLUXDB_REJECT_UNAUTHORIZED === void 0 ? true : process.env.INFLUXDB_REJECT_UNAUTHORIZED === "true" ? true : false,
|
|
3492
|
+
influxDB_writeDataPointFlushTimeout: process.env.INFLUXDB_WRITE_DATA_POINT_FLUSH_TIMEOUT === void 0 ? 1e3 : parseInt(process.env.INFLUXDB_WRITE_DATA_POINT_FLUSH_TIMEOUT),
|
|
3493
|
+
kafka_clientId: process.env.KAFKA_CLIENT_ID === void 0 ? "myclient" : process.env.KAFKA_CLIENT_ID,
|
|
3494
|
+
kafka_brokers: process.env.KAFKA_BROKERS === void 0 ? "localhost:9092" : process.env.KAFKA_BROKERS,
|
|
3495
|
+
kafka_admin_timeout: process.env.KAFKA_ADMIN_TIMEOUT === void 0 ? 5e3 : parseInt(process.env.KAFKA_ADMIN_TIMEOUT),
|
|
3496
|
+
kafka_connection_timeout: process.env.KAFKA_CONNECTION_TIMEOUT === void 0 ? 5e3 : parseInt(process.env.KAFKA_CONNECTION_TIMEOUT),
|
|
3497
|
+
kafka_request_timeout: process.env.KAFKA_REQUEST_TIMEOUT === void 0 ? 5e3 : parseInt(process.env.KAFKA_REQUEST_TIMEOUT),
|
|
3498
|
+
kafka_log_level: process.env.KAFKA_LOG_LEVEL === void 0 ? "nothing" : process.env.KAFKA_LOG_LEVEL,
|
|
3499
|
+
kafka_keep_alive: process.env.KAFKA_KEEP_ALIVE === void 0 ? 3e4 : parseInt(process.env.KAFKA_KEEP_ALIVE),
|
|
3500
|
+
kafka_use_ssl: process.env.KAFKA_USE_SSL === void 0 ? false : process.env.KAFKA_USE_SSL === "true" ? true : false,
|
|
3501
|
+
kafka_ssl_rejectUnauthorized: process.env.KAFKA_SSL_REJECT_UNAUTHORIZED === void 0 ? true : process.env.KAFKA_SSL_REJECT_UNAUTHORIZED === "true" ? true : false,
|
|
3502
|
+
kafka_ssl_cafile: process.env.KAFKA_SSL_CAFILE === void 0 ? "/my/custom/ca.crt" : process.env.KAFKA_SSL_CAFILE,
|
|
3503
|
+
kafka_ssl_keyfile: process.env.KAFKA_SSL_KEYFILE === void 0 ? "/my/custom/client-key.pem" : process.env.KAFKA_SSL_KEYFILE,
|
|
3504
|
+
kafka_ssl_certfile: process.env.KAFKA_SSL_CERTFILE === void 0 ? "/my/custom/client-cert.pem" : process.env.KAFKA_SSL_CERTFILE,
|
|
3505
|
+
kafka_consume_from_beginning: process.env.KAFKA_CONSUME_FROM_BEGINNING === void 0 ? true : process.env.KAFKA_CONSUME_FROM_BEGINNING === "true" ? true : false,
|
|
3506
|
+
observabilityPublishMode: process.env.OBSERVABILITY_PUBLISH_MODE === void 0 ? "PROXY" : process.env.OBSERVABILITY_PUBLISH_MODE,
|
|
3507
|
+
stsUiTermObservabilityConsumptionMode: process.env.STSUITERM_OBSERVABILITY_CONSUMPTION_MODE === void 0 ? "PROXY" : process.env.STSUITERM_OBSERVABILITY_CONSUMPTION_MODE
|
|
3508
|
+
};
|
|
3509
|
+
const ReadFile = (passwordFile) => {
|
|
3510
|
+
try {
|
|
3511
|
+
accessSync(passwordFile, constants.R_OK);
|
|
3512
|
+
const data = readFileSync(passwordFile, "utf8");
|
|
3513
|
+
if (logger) ;
|
|
3514
|
+
return data;
|
|
3515
|
+
} catch (err) {
|
|
3516
|
+
return "";
|
|
3517
|
+
}
|
|
3518
|
+
};
|
|
3519
|
+
const fileconfig = [
|
|
3520
|
+
{ fileprop: "dbpasswordfile", prop: "dbpassword" },
|
|
3521
|
+
// JWKS secret file processing
|
|
3522
|
+
{ fileprop: "tsjwksstorepathfile", prop: "tsjwksstorepath" },
|
|
3523
|
+
// InfluxDB file processing
|
|
3524
|
+
{ fileprop: "influxDB_APITokenFile", prop: "influxDB_APIToken" }
|
|
3525
|
+
];
|
|
3526
|
+
fileconfig.forEach((v) => {
|
|
3527
|
+
if (defconfig[v.fileprop] !== void 0) {
|
|
3528
|
+
defconfig[v.prop] = ReadFile(defconfig[v.fileprop]);
|
|
3529
|
+
}
|
|
3530
|
+
});
|
|
3531
|
+
for (const [key, val] of Object.entries(defconfig)) {
|
|
3532
|
+
envOptions2[key] = val;
|
|
3533
|
+
}
|
|
3534
|
+
}
|
|
3535
|
+
function $SetupOptions(envOptions2) {
|
|
3536
|
+
SetupConfig(envOptions2);
|
|
3537
|
+
const options = envOptions2;
|
|
3538
|
+
if (options.dbhost) {
|
|
3539
|
+
const hosts = options.dbhost.split(",");
|
|
3540
|
+
envOptions2.connectionString = hosts.map((host) => {
|
|
3541
|
+
return `postgresql://${options.dbuser}:${options.dbpassword}@${host}/${options.database}`;
|
|
3542
|
+
}).join(",");
|
|
3543
|
+
envOptions2.defaultDatabaseConnectionString = hosts.map((host) => {
|
|
3544
|
+
return `postgresql://${options.dbuser}:${options.dbpassword}@${host}/postgres`;
|
|
3545
|
+
}).join(",");
|
|
3546
|
+
}
|
|
3547
|
+
}
|
|
3548
|
+
const envOptionsHandler = {
|
|
3549
|
+
get(target, prop, receiver) {
|
|
3550
|
+
if (Object.keys(target).length === 0) {
|
|
3551
|
+
$SetupOptions(target);
|
|
3552
|
+
}
|
|
3553
|
+
return Reflect.get(target, prop, receiver);
|
|
3554
|
+
}
|
|
3555
|
+
};
|
|
3556
|
+
const goptions = new Proxy(envOptions, envOptionsHandler);
|
|
3557
|
+
class AgentManager {
|
|
3558
|
+
constructor(agentManagerOptions) {
|
|
3559
|
+
__privateAdd2(this, _options);
|
|
3560
|
+
__privateAdd2(this, _httpAgent, null);
|
|
3561
|
+
__privateAdd2(this, _httpsAgent, null);
|
|
3562
|
+
__privateAdd2(this, _agentResetInterval, null);
|
|
3563
|
+
__privateAdd2(this, _requestCount, 0);
|
|
3564
|
+
__privateAdd2(this, _SetupResetInterval, () => {
|
|
3565
|
+
if (__privateGet2(this, _options).agentResetInterval && __privateGet2(this, _options).agentResetInterval > 0) {
|
|
3566
|
+
__privateSet2(this, _agentResetInterval, setTimeout(() => {
|
|
3567
|
+
this.ResetAgent();
|
|
3568
|
+
__privateGet2(this, _SetupResetInterval).call(this);
|
|
3569
|
+
}, __privateGet2(this, _options).agentResetInterval).unref());
|
|
3570
|
+
}
|
|
3571
|
+
});
|
|
3572
|
+
__privateAdd2(this, _GetAgentOptions, (https2) => {
|
|
3573
|
+
let options;
|
|
3574
|
+
if (__privateGet2(this, _options).agentOptions) {
|
|
3575
|
+
options = {
|
|
3576
|
+
keepAlive: __privateGet2(this, _options).agentOptions.keepAlive,
|
|
3577
|
+
maxSockets: __privateGet2(this, _options).agentOptions.maxSockets,
|
|
3578
|
+
maxTotalSockets: __privateGet2(this, _options).agentOptions.maxTotalSockets,
|
|
3579
|
+
maxFreeSockets: __privateGet2(this, _options).agentOptions.maxFreeSockets,
|
|
3580
|
+
timeout: __privateGet2(this, _options).agentOptions.timeout
|
|
3581
|
+
//@@ config
|
|
3582
|
+
};
|
|
3583
|
+
if (https2 === true) {
|
|
3584
|
+
options.rejectUnauthorized = __privateGet2(this, _options).agentOptions.rejectUnauthorized;
|
|
3585
|
+
}
|
|
3586
|
+
} else {
|
|
3587
|
+
options = {
|
|
3588
|
+
keepAlive: process.env.NODE_ENV === "test" ? false : goptions.keepAlive,
|
|
3589
|
+
maxSockets: goptions.maxSockets,
|
|
3590
|
+
maxTotalSockets: goptions.maxTotalSockets,
|
|
3591
|
+
maxFreeSockets: goptions.maxFreeSockets,
|
|
3592
|
+
timeout: 3e4
|
|
3593
|
+
//@@ config
|
|
3594
|
+
};
|
|
3595
|
+
if (https2 === true) {
|
|
3596
|
+
options.rejectUnauthorized = goptions.isProduction;
|
|
3597
|
+
}
|
|
3598
|
+
}
|
|
3599
|
+
return options;
|
|
3600
|
+
});
|
|
3601
|
+
__privateSet2(this, _options, agentManagerOptions);
|
|
3602
|
+
if (__privateGet2(this, _options).agentResetInterval) {
|
|
3603
|
+
__privateGet2(this, _SetupResetInterval).call(this);
|
|
3604
|
+
}
|
|
3605
|
+
}
|
|
3606
|
+
get agentResetInterval() {
|
|
3607
|
+
return __privateGet2(this, _options).agentResetInterval;
|
|
3608
|
+
}
|
|
3609
|
+
set agentResetInterval(val) {
|
|
3610
|
+
if (__privateGet2(this, _agentResetInterval)) {
|
|
3611
|
+
clearTimeout(__privateGet2(this, _agentResetInterval));
|
|
3612
|
+
}
|
|
3613
|
+
__privateGet2(this, _options).agentResetInterval = val;
|
|
3614
|
+
__privateGet2(this, _SetupResetInterval).call(this);
|
|
3615
|
+
}
|
|
3616
|
+
get agentResetCount() {
|
|
3617
|
+
return __privateGet2(this, _options).agentResetCount;
|
|
3618
|
+
}
|
|
3619
|
+
set agentResetCount(val) {
|
|
3620
|
+
__privateGet2(this, _options).agentResetCount = val;
|
|
3621
|
+
}
|
|
3622
|
+
IncRequestCount() {
|
|
3623
|
+
__privateWrapper(this, _requestCount)._++;
|
|
3624
|
+
if (__privateGet2(this, _options).agentResetCount) {
|
|
3625
|
+
if (__privateGet2(this, _requestCount) % __privateGet2(this, _options).agentResetCount === 0) {
|
|
3626
|
+
this.ResetAgent();
|
|
3627
|
+
}
|
|
3628
|
+
}
|
|
3629
|
+
}
|
|
3630
|
+
IsHttps(protocol) {
|
|
3631
|
+
if (protocol.toLowerCase().startsWith("https:")) {
|
|
3632
|
+
return true;
|
|
3633
|
+
}
|
|
3634
|
+
return false;
|
|
3635
|
+
}
|
|
3636
|
+
GetAgent(protocol) {
|
|
3637
|
+
if (protocol.toLowerCase().startsWith("https:")) {
|
|
3638
|
+
if (__privateGet2(this, _httpsAgent) === null) {
|
|
3639
|
+
__privateSet2(this, _httpsAgent, new https.Agent(__privateGet2(this, _GetAgentOptions).call(this, true)));
|
|
3640
|
+
}
|
|
3641
|
+
return __privateGet2(this, _httpsAgent);
|
|
3642
|
+
} else if (protocol.toLowerCase().startsWith("http:")) {
|
|
3643
|
+
if (__privateGet2(this, _httpAgent) === null) {
|
|
3644
|
+
__privateSet2(this, _httpAgent, new http.Agent(__privateGet2(this, _GetAgentOptions).call(this, false)));
|
|
3645
|
+
}
|
|
3646
|
+
return __privateGet2(this, _httpAgent);
|
|
3647
|
+
} else {
|
|
3648
|
+
return null;
|
|
3649
|
+
}
|
|
3650
|
+
}
|
|
3651
|
+
ResetAgent() {
|
|
3652
|
+
__privateSet2(this, _httpAgent, null);
|
|
3653
|
+
__privateSet2(this, _httpsAgent, null);
|
|
3654
|
+
}
|
|
3655
|
+
/*
|
|
3656
|
+
url
|
|
3657
|
+
,method: 'post'
|
|
3658
|
+
,data: payload
|
|
3659
|
+
,headers: headers
|
|
3660
|
+
,httpsAgent: this.#agentManager.GetAgent(url)
|
|
3661
|
+
*/
|
|
3662
|
+
/*
|
|
3663
|
+
postgresContainer = await new GenericContainer("postgres")
|
|
3664
|
+
.withExposedPorts(5432)
|
|
3665
|
+
.withEnvironment({
|
|
3666
|
+
POSTGRES_PASSWORD: "postgres",
|
|
3667
|
+
//UV_THREADPOOL_SIZE: "64"
|
|
3668
|
+
})
|
|
3669
|
+
.withCommand(['-c', 'max_connections=20'])
|
|
3670
|
+
.start();
|
|
3671
|
+
*/
|
|
3672
|
+
Terminate() {
|
|
3673
|
+
if (__privateGet2(this, _agentResetInterval)) {
|
|
3674
|
+
clearTimeout(__privateGet2(this, _agentResetInterval));
|
|
3675
|
+
__privateSet2(this, _agentResetInterval, null);
|
|
3676
|
+
}
|
|
3677
|
+
if (__privateGet2(this, _httpAgent)) {
|
|
3678
|
+
__privateGet2(this, _httpAgent).destroy();
|
|
3679
|
+
__privateSet2(this, _httpAgent, null);
|
|
3680
|
+
}
|
|
3681
|
+
if (__privateGet2(this, _httpsAgent)) {
|
|
3682
|
+
__privateGet2(this, _httpsAgent).destroy();
|
|
3683
|
+
__privateSet2(this, _httpsAgent, null);
|
|
3684
|
+
}
|
|
3685
|
+
}
|
|
3686
|
+
}
|
|
3687
|
+
_options = /* @__PURE__ */ new WeakMap();
|
|
3688
|
+
_httpAgent = /* @__PURE__ */ new WeakMap();
|
|
3689
|
+
_httpsAgent = /* @__PURE__ */ new WeakMap();
|
|
3690
|
+
_agentResetInterval = /* @__PURE__ */ new WeakMap();
|
|
3691
|
+
_requestCount = /* @__PURE__ */ new WeakMap();
|
|
3692
|
+
_SetupResetInterval = /* @__PURE__ */ new WeakMap();
|
|
3693
|
+
_GetAgentOptions = /* @__PURE__ */ new WeakMap();
|
|
3694
|
+
class STSAxiosConfig {
|
|
3695
|
+
constructor(url, method, headers, timeout) {
|
|
3696
|
+
__privateAdd2(this, _url);
|
|
3697
|
+
__privateAdd2(this, _method);
|
|
3698
|
+
__privateAdd2(this, _headers);
|
|
3699
|
+
__privateAdd2(this, _data);
|
|
3700
|
+
__privateAdd2(this, _agentManager);
|
|
3701
|
+
__privateAdd2(this, _timeout);
|
|
3702
|
+
__privateAdd2(this, _withCredentials);
|
|
3703
|
+
__privateSet2(this, _url, url);
|
|
3704
|
+
__privateSet2(this, _method, method);
|
|
3705
|
+
if (headers !== void 0) {
|
|
3706
|
+
__privateSet2(this, _headers, headers);
|
|
3707
|
+
}
|
|
3708
|
+
if (timeout !== void 0) {
|
|
3709
|
+
__privateSet2(this, _timeout, timeout);
|
|
3710
|
+
}
|
|
3711
|
+
}
|
|
3712
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3713
|
+
withData(data) {
|
|
3714
|
+
__privateSet2(this, _data, data);
|
|
3715
|
+
return this;
|
|
3716
|
+
}
|
|
3717
|
+
// 'Content-Type': 'application/json'
|
|
3718
|
+
withHeaders(headers) {
|
|
3719
|
+
__privateSet2(this, _headers, headers);
|
|
3720
|
+
return this;
|
|
3721
|
+
}
|
|
3722
|
+
withDefaultHeaders() {
|
|
3723
|
+
__privateSet2(this, _headers, {
|
|
3724
|
+
"Content-Type": "application/json"
|
|
3725
|
+
});
|
|
3726
|
+
return this;
|
|
3727
|
+
}
|
|
3728
|
+
withCredentials() {
|
|
3729
|
+
__privateSet2(this, _withCredentials, true);
|
|
3730
|
+
return this;
|
|
3731
|
+
}
|
|
3732
|
+
withTimeout(timeout) {
|
|
3733
|
+
__privateSet2(this, _timeout, timeout);
|
|
3734
|
+
return this;
|
|
3735
|
+
}
|
|
3736
|
+
withAgentManager(agentManager) {
|
|
3737
|
+
__privateSet2(this, _agentManager, agentManager);
|
|
3738
|
+
return this;
|
|
3739
|
+
}
|
|
3740
|
+
get config() {
|
|
3741
|
+
const retVal = {
|
|
3742
|
+
url: __privateGet2(this, _url),
|
|
3743
|
+
method: __privateGet2(this, _method)
|
|
3744
|
+
};
|
|
3745
|
+
if (__privateGet2(this, _headers)) {
|
|
3746
|
+
retVal.headers = __privateGet2(this, _headers);
|
|
3747
|
+
}
|
|
3748
|
+
if (__privateGet2(this, _agentManager) !== void 0) {
|
|
3749
|
+
if (__privateGet2(this, _agentManager).IsHttps(__privateGet2(this, _url))) {
|
|
3750
|
+
retVal.httpsAgent = __privateGet2(this, _agentManager).GetAgent(__privateGet2(this, _url));
|
|
3751
|
+
} else {
|
|
3752
|
+
retVal.httpAgent = __privateGet2(this, _agentManager).GetAgent(__privateGet2(this, _url));
|
|
3753
|
+
}
|
|
3754
|
+
}
|
|
3755
|
+
if (__privateGet2(this, _data) !== void 0) {
|
|
3756
|
+
retVal.data = __privateGet2(this, _data);
|
|
3757
|
+
}
|
|
3758
|
+
if (__privateGet2(this, _timeout) !== void 0) {
|
|
3759
|
+
retVal.timeout = __privateGet2(this, _timeout);
|
|
3760
|
+
}
|
|
3761
|
+
if (__privateGet2(this, _withCredentials) !== void 0 && __privateGet2(this, _withCredentials) === true) {
|
|
3762
|
+
retVal.withCredentials = true;
|
|
3763
|
+
}
|
|
3764
|
+
return retVal;
|
|
3765
|
+
}
|
|
3766
|
+
}
|
|
3767
|
+
_url = /* @__PURE__ */ new WeakMap();
|
|
3768
|
+
_method = /* @__PURE__ */ new WeakMap();
|
|
3769
|
+
_headers = /* @__PURE__ */ new WeakMap();
|
|
3770
|
+
_data = /* @__PURE__ */ new WeakMap();
|
|
3771
|
+
_agentManager = /* @__PURE__ */ new WeakMap();
|
|
3772
|
+
_timeout = /* @__PURE__ */ new WeakMap();
|
|
3773
|
+
_withCredentials = /* @__PURE__ */ new WeakMap();
|
|
1537
3774
|
class FhirClient {
|
|
1538
|
-
// Default value
|
|
1539
3775
|
constructor(options) {
|
|
1540
|
-
__privateAdd(this,
|
|
3776
|
+
__privateAdd(this, _options2);
|
|
1541
3777
|
__privateAdd(this, _DUMMY_USER, "USR_user01@stsmda.com.au");
|
|
1542
3778
|
//@@ needs to come from headers ??
|
|
1543
|
-
__privateAdd(this, _httpsAgent, null);
|
|
1544
3779
|
__privateAdd(this, _invokeMethods, {});
|
|
1545
3780
|
__privateAdd(this, _maxRetries, 5);
|
|
1546
3781
|
__privateAdd(this, _sleepDuration, [50, 100, 200, 500, 1e3, 2e3, 5e3]);
|
|
@@ -1549,55 +3784,40 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
|
|
|
1549
3784
|
StatusCodes.CONFLICT
|
|
1550
3785
|
]);
|
|
1551
3786
|
__privateAdd(this, _stsfhirapiroot, "/stsfhir/r5");
|
|
3787
|
+
// Default value
|
|
3788
|
+
__privateAdd(this, _agentManager2, null);
|
|
1552
3789
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1553
3790
|
__privateAdd(this, _LogDebugMessage, (message) => {
|
|
1554
|
-
__privateGet(this,
|
|
3791
|
+
__privateGet(this, _options2).logger.debug(message);
|
|
1555
3792
|
});
|
|
1556
3793
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1557
3794
|
__privateAdd(this, _LogErrorMessage, (message) => {
|
|
1558
|
-
__privateGet(this,
|
|
1559
|
-
});
|
|
1560
|
-
__privateAdd(this, _GetHttpsAgent, () => {
|
|
1561
|
-
if (__privateGet(this, _httpsAgent) === null) {
|
|
1562
|
-
if (__privateGet(this, _options).agentOptions) {
|
|
1563
|
-
__privateSet(this, _httpsAgent, new https.Agent({
|
|
1564
|
-
keepAlive: __privateGet(this, _options).agentOptions.keepAlive,
|
|
1565
|
-
maxSockets: __privateGet(this, _options).agentOptions.maxSockets,
|
|
1566
|
-
maxTotalSockets: __privateGet(this, _options).agentOptions.maxTotalSockets,
|
|
1567
|
-
maxFreeSockets: __privateGet(this, _options).agentOptions.maxFreeSockets,
|
|
1568
|
-
timeout: __privateGet(this, _options).agentOptions.timeout,
|
|
1569
|
-
rejectUnauthorized: __privateGet(this, _options).agentOptions.rejectUnauthorized
|
|
1570
|
-
}));
|
|
1571
|
-
} else {
|
|
1572
|
-
__privateSet(this, _httpsAgent, new https.Agent());
|
|
1573
|
-
}
|
|
1574
|
-
}
|
|
1575
|
-
return __privateGet(this, _httpsAgent);
|
|
3795
|
+
__privateGet(this, _options2).logger.error(message);
|
|
1576
3796
|
});
|
|
1577
3797
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1578
3798
|
__privateAdd(this, _HandleError, (error) => {
|
|
1579
|
-
__privateGet(this, _LogDebugMessage).call(this, chalk$
|
|
3799
|
+
__privateGet(this, _LogDebugMessage).call(this, chalk$2.red(`HandleError(): Error: [${error}]`));
|
|
1580
3800
|
let responseCode = 500;
|
|
1581
3801
|
if (axios.isAxiosError(error)) {
|
|
1582
3802
|
const axiosError = error;
|
|
1583
3803
|
if (axiosError.response) {
|
|
1584
3804
|
responseCode = axiosError.response.status;
|
|
1585
|
-
__privateGet(this, _LogDebugMessage).call(this, chalk$
|
|
3805
|
+
__privateGet(this, _LogDebugMessage).call(this, chalk$2.red(`AXIOS Error Response.Status = [${axiosError.response.status}]`));
|
|
1586
3806
|
if (axiosError.response.headers) {
|
|
1587
|
-
__privateGet(this, _LogErrorMessage).call(this, chalk$
|
|
3807
|
+
__privateGet(this, _LogErrorMessage).call(this, chalk$2.red(` headers: [${JSON.stringify(axiosError.response.headers)}]`));
|
|
1588
3808
|
}
|
|
1589
3809
|
if (axiosError.response.data) {
|
|
1590
|
-
__privateGet(this, _LogErrorMessage).call(this, chalk$
|
|
3810
|
+
__privateGet(this, _LogErrorMessage).call(this, chalk$2.red(` data: [${JSON.stringify(axiosError.response.data)}]`));
|
|
1591
3811
|
}
|
|
1592
3812
|
try {
|
|
1593
3813
|
if (axiosError.response.config) {
|
|
1594
|
-
__privateGet(this, _LogErrorMessage).call(this, chalk$
|
|
3814
|
+
__privateGet(this, _LogErrorMessage).call(this, chalk$2.red(` config: [${JSON.stringify(axiosError.response.config)}]`));
|
|
1595
3815
|
}
|
|
1596
3816
|
} catch (innererror) {
|
|
1597
|
-
__privateGet(this, _LogErrorMessage).call(this, chalk$
|
|
3817
|
+
__privateGet(this, _LogErrorMessage).call(this, chalk$2.red(` could not get response config, error: [${innererror}]`));
|
|
1598
3818
|
}
|
|
1599
3819
|
} else {
|
|
1600
|
-
__privateGet(this, _LogDebugMessage).call(this, chalk$
|
|
3820
|
+
__privateGet(this, _LogDebugMessage).call(this, chalk$2.red(`AXIOS Error = [${axiosError}]`));
|
|
1601
3821
|
}
|
|
1602
3822
|
}
|
|
1603
3823
|
return responseCode;
|
|
@@ -1618,19 +3838,19 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
|
|
|
1618
3838
|
const metadataRecord = __privateGet(this, _invokeMethods)[id2];
|
|
1619
3839
|
let performRetry = false;
|
|
1620
3840
|
const returnData = await __privateGet(this, ___InvokeResourceAPI).call(this, metadataRecord, (statusCode, error) => {
|
|
1621
|
-
console.error(chalk$
|
|
3841
|
+
console.error(chalk$2.red(`#InvokeResourceAPI(): Error: [${error}], Attempt: [${metadataRecord.retries + 1}]`));
|
|
1622
3842
|
const noRetryIndex = __privateGet(this, _NoRetryStatusCodes).indexOf(statusCode);
|
|
1623
3843
|
if (noRetryIndex === -1) {
|
|
1624
3844
|
if (statusCode === StatusCodes.UNAUTHORIZED) {
|
|
1625
|
-
console.error(chalk$
|
|
1626
|
-
__privateGet(this,
|
|
1627
|
-
if (__privateGet(this,
|
|
1628
|
-
__privateGet(this,
|
|
3845
|
+
console.error(chalk$2.red(`#InvokeResourceAPI(): Authentication error, resetting access_token (to null).`));
|
|
3846
|
+
__privateGet(this, _options2).ResetAccessToken();
|
|
3847
|
+
if (__privateGet(this, _options2).clientTelemetryEvents) {
|
|
3848
|
+
__privateGet(this, _options2).clientTelemetryEvents.AuthenticationErrorInc();
|
|
1629
3849
|
}
|
|
1630
3850
|
}
|
|
1631
|
-
if (isNode) {
|
|
1632
|
-
console.error(chalk$
|
|
1633
|
-
|
|
3851
|
+
if (isNode && __privateGet(this, _agentManager2)) {
|
|
3852
|
+
console.error(chalk$2.red(`#InvokeResourceAPI(): Resetting https agent (to null).`));
|
|
3853
|
+
__privateGet(this, _agentManager2).ResetAgent();
|
|
1634
3854
|
}
|
|
1635
3855
|
performRetry = true;
|
|
1636
3856
|
}
|
|
@@ -1651,8 +3871,8 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
|
|
|
1651
3871
|
console.log(`Sleeping: [${__privateGet(this, _sleepDuration)[__privateGet(this, _invokeMethods)[id].retries]}]`);
|
|
1652
3872
|
await stsutils.Sleep(__privateGet(this, _sleepDuration)[__privateGet(this, _invokeMethods)[id].retries]);
|
|
1653
3873
|
__privateGet(this, _invokeMethods)[id].retries++;
|
|
1654
|
-
if (__privateGet(this,
|
|
1655
|
-
__privateGet(this,
|
|
3874
|
+
if (__privateGet(this, _options2).clientTelemetryEvents) {
|
|
3875
|
+
__privateGet(this, _options2).clientTelemetryEvents.RetryInc();
|
|
1656
3876
|
}
|
|
1657
3877
|
}
|
|
1658
3878
|
}
|
|
@@ -1683,32 +3903,21 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
|
|
|
1683
3903
|
__privateAdd(this, ___InvokeResourceAPI, async (metaData, errorCb) => {
|
|
1684
3904
|
try {
|
|
1685
3905
|
const { url, httpVerb, domainResource, filters } = metaData;
|
|
1686
|
-
if (__privateGet(this,
|
|
3906
|
+
if (__privateGet(this, _options2).testingMode) {
|
|
1687
3907
|
if (__privateGet(this, _TestMode).call(this, metaData, errorCb)) {
|
|
1688
3908
|
return null;
|
|
1689
3909
|
}
|
|
1690
3910
|
}
|
|
1691
|
-
const accessToken = await __privateGet(this,
|
|
1692
|
-
const
|
|
3911
|
+
const accessToken = await __privateGet(this, _options2).GetAccessToken();
|
|
3912
|
+
const requestConfig = new STSAxiosConfig(url, httpVerb).withHeaders({
|
|
1693
3913
|
"Content-Type": "application/json",
|
|
1694
3914
|
"Authorization": `Bearer ${accessToken}`,
|
|
1695
3915
|
"x-sts_user_id": __privateGet(this, _DUMMY_USER)
|
|
1696
|
-
};
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
method: httpVerb,
|
|
1700
|
-
headers
|
|
1701
|
-
};
|
|
1702
|
-
if (isNode) {
|
|
1703
|
-
requestConfig.httpsAgent = __privateGet(this, _GetHttpsAgent).call(this);
|
|
1704
|
-
}
|
|
1705
|
-
if (filters) {
|
|
1706
|
-
requestConfig.data = filters;
|
|
1707
|
-
} else if (domainResource) {
|
|
1708
|
-
requestConfig.data = domainResource;
|
|
3916
|
+
}).withData(filters ? filters : domainResource ? domainResource : void 0);
|
|
3917
|
+
if (isNode && __privateGet(this, _agentManager2)) {
|
|
3918
|
+
requestConfig.withAgentManager(__privateGet(this, _agentManager2));
|
|
1709
3919
|
}
|
|
1710
|
-
|
|
1711
|
-
return retVal;
|
|
3920
|
+
return await axios(requestConfig.config);
|
|
1712
3921
|
} catch (error) {
|
|
1713
3922
|
const responseCode = __privateGet(this, _HandleError).call(this, error);
|
|
1714
3923
|
errorCb(responseCode, error);
|
|
@@ -1716,7 +3925,7 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
|
|
|
1716
3925
|
}
|
|
1717
3926
|
});
|
|
1718
3927
|
__publicField(this, "GetResource", async (resource, id, filters, errorCb) => {
|
|
1719
|
-
const url = `${__privateGet(this,
|
|
3928
|
+
const url = `${__privateGet(this, _options2).fhirEndpoint}${__privateGet(this, _stsfhirapiroot)}/${resource}/${id}`;
|
|
1720
3929
|
const response = await __privateGet(this, _InvokeResourceAPI).call(this, url, "get", null, filters, errorCb);
|
|
1721
3930
|
if (response) {
|
|
1722
3931
|
return response.data;
|
|
@@ -1725,7 +3934,7 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
|
|
|
1725
3934
|
}
|
|
1726
3935
|
});
|
|
1727
3936
|
__publicField(this, "GetResources", async (resource, filters, errorCb) => {
|
|
1728
|
-
const url = `${__privateGet(this,
|
|
3937
|
+
const url = `${__privateGet(this, _options2).fhirEndpoint}${__privateGet(this, _stsfhirapiroot)}/${resource}`;
|
|
1729
3938
|
const response = await __privateGet(this, _InvokeResourceAPI).call(this, url, "get", null, filters, errorCb);
|
|
1730
3939
|
if (response) {
|
|
1731
3940
|
return response.data;
|
|
@@ -1734,7 +3943,7 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
|
|
|
1734
3943
|
}
|
|
1735
3944
|
});
|
|
1736
3945
|
__publicField(this, "CreateResource", async (resource, domainResource, errorCb) => {
|
|
1737
|
-
const url = `${__privateGet(this,
|
|
3946
|
+
const url = `${__privateGet(this, _options2).fhirEndpoint}${__privateGet(this, _stsfhirapiroot)}/${resource}`;
|
|
1738
3947
|
const response = await __privateGet(this, _InvokeResourceAPI).call(this, url, "post", domainResource, null, errorCb);
|
|
1739
3948
|
if (response) {
|
|
1740
3949
|
if (response.status === StatusCodes.CREATED) {
|
|
@@ -1748,7 +3957,7 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
|
|
|
1748
3957
|
}
|
|
1749
3958
|
});
|
|
1750
3959
|
__publicField(this, "UpdateResource", async (resource, domainResource, errorCb) => {
|
|
1751
|
-
const url = `${__privateGet(this,
|
|
3960
|
+
const url = `${__privateGet(this, _options2).fhirEndpoint}${__privateGet(this, _stsfhirapiroot)}/${resource}/${domainResource.id}`;
|
|
1752
3961
|
const response = await __privateGet(this, _InvokeResourceAPI).call(this, url, "put", domainResource, null, errorCb);
|
|
1753
3962
|
if (response) {
|
|
1754
3963
|
return response.data;
|
|
@@ -1757,7 +3966,7 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
|
|
|
1757
3966
|
}
|
|
1758
3967
|
});
|
|
1759
3968
|
__publicField(this, "UpdateResources", async (resource, domainResources, errorCb) => {
|
|
1760
|
-
const url = `${__privateGet(this,
|
|
3969
|
+
const url = `${__privateGet(this, _options2).fhirEndpoint}${__privateGet(this, _stsfhirapiroot)}/${resource}`;
|
|
1761
3970
|
const response = await __privateGet(this, _InvokeResourceAPI).call(this, url, "put", domainResources, null, errorCb);
|
|
1762
3971
|
if (response) {
|
|
1763
3972
|
return response.data;
|
|
@@ -1766,7 +3975,7 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
|
|
|
1766
3975
|
}
|
|
1767
3976
|
});
|
|
1768
3977
|
__publicField(this, "PatchResource", async (resource, domainResource, errorCb) => {
|
|
1769
|
-
const url = `${__privateGet(this,
|
|
3978
|
+
const url = `${__privateGet(this, _options2).fhirEndpoint}${__privateGet(this, _stsfhirapiroot)}/${resource}/${domainResource.id}`;
|
|
1770
3979
|
const response = await __privateGet(this, _InvokeResourceAPI).call(this, url, "patch", domainResource, null, errorCb);
|
|
1771
3980
|
if (response) {
|
|
1772
3981
|
return response.data;
|
|
@@ -1775,7 +3984,7 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
|
|
|
1775
3984
|
}
|
|
1776
3985
|
});
|
|
1777
3986
|
__publicField(this, "PatchResources", async (resource, domainResources, errorCb) => {
|
|
1778
|
-
const url = `${__privateGet(this,
|
|
3987
|
+
const url = `${__privateGet(this, _options2).fhirEndpoint}${__privateGet(this, _stsfhirapiroot)}/${resource}`;
|
|
1779
3988
|
const response = await __privateGet(this, _InvokeResourceAPI).call(this, url, "patch", domainResources, null, errorCb);
|
|
1780
3989
|
if (response) {
|
|
1781
3990
|
return response.data;
|
|
@@ -1784,7 +3993,7 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
|
|
|
1784
3993
|
}
|
|
1785
3994
|
});
|
|
1786
3995
|
__publicField(this, "DeleteResource", async (resource, id, errorCb) => {
|
|
1787
|
-
const url = `${__privateGet(this,
|
|
3996
|
+
const url = `${__privateGet(this, _options2).fhirEndpoint}${__privateGet(this, _stsfhirapiroot)}/${resource}/${id}`;
|
|
1788
3997
|
const response = await __privateGet(this, _InvokeResourceAPI).call(this, url, "delete", null, null, errorCb);
|
|
1789
3998
|
if (response) {
|
|
1790
3999
|
return response.data;
|
|
@@ -1793,7 +4002,7 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
|
|
|
1793
4002
|
}
|
|
1794
4003
|
});
|
|
1795
4004
|
__publicField(this, "DeleteResources", async (resource, domainResources, errorCb) => {
|
|
1796
|
-
const url = `${__privateGet(this,
|
|
4005
|
+
const url = `${__privateGet(this, _options2).fhirEndpoint}${__privateGet(this, _stsfhirapiroot)}/${resource}`;
|
|
1797
4006
|
const response = await __privateGet(this, _InvokeResourceAPI).call(this, url, "delete", domainResources, null, errorCb);
|
|
1798
4007
|
if (response) {
|
|
1799
4008
|
return response.data;
|
|
@@ -1802,45 +4011,47 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
|
|
|
1802
4011
|
}
|
|
1803
4012
|
});
|
|
1804
4013
|
__publicField(this, "GetLatency", async () => {
|
|
1805
|
-
const url = `${__privateGet(this,
|
|
4014
|
+
const url = `${__privateGet(this, _options2).fhirEndpoint}${__privateGet(this, _stsfhirapiroot)}/latency`;
|
|
1806
4015
|
try {
|
|
1807
|
-
const
|
|
4016
|
+
const requestConfig = new STSAxiosConfig(url, "get", {
|
|
1808
4017
|
"Content-Type": "application/json"
|
|
1809
|
-
};
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
method: "get",
|
|
1813
|
-
headers
|
|
1814
|
-
};
|
|
1815
|
-
if (isNode) {
|
|
1816
|
-
requestConfig.httpsAgent = __privateGet(this, _GetHttpsAgent).call(this);
|
|
4018
|
+
});
|
|
4019
|
+
if (isNode && __privateGet(this, _agentManager2)) {
|
|
4020
|
+
requestConfig.withAgentManager(__privateGet(this, _agentManager2));
|
|
1817
4021
|
}
|
|
1818
|
-
|
|
1819
|
-
return retVal;
|
|
4022
|
+
return await axios(requestConfig.config);
|
|
1820
4023
|
} catch (error) {
|
|
1821
4024
|
__privateGet(this, _HandleError).call(this, error);
|
|
1822
4025
|
}
|
|
1823
4026
|
});
|
|
1824
|
-
__privateSet(this,
|
|
1825
|
-
if (__privateGet(this,
|
|
1826
|
-
__privateSet(this, _stsfhirapiroot, __privateGet(this,
|
|
4027
|
+
__privateSet(this, _options2, options);
|
|
4028
|
+
if (__privateGet(this, _options2).stsfhirapiroot !== void 0) {
|
|
4029
|
+
__privateSet(this, _stsfhirapiroot, __privateGet(this, _options2).stsfhirapiroot);
|
|
4030
|
+
}
|
|
4031
|
+
if (isNode) {
|
|
4032
|
+
if (__privateGet(this, _options2).agentOptions) {
|
|
4033
|
+
__privateSet(this, _agentManager2, new AgentManager({
|
|
4034
|
+
agentOptions: __privateGet(this, _options2).agentOptions
|
|
4035
|
+
}));
|
|
4036
|
+
} else {
|
|
4037
|
+
__privateSet(this, _agentManager2, new AgentManager({}));
|
|
4038
|
+
}
|
|
1827
4039
|
}
|
|
1828
4040
|
}
|
|
1829
4041
|
get options() {
|
|
1830
|
-
return __privateGet(this,
|
|
4042
|
+
return __privateGet(this, _options2);
|
|
1831
4043
|
}
|
|
1832
4044
|
}
|
|
1833
|
-
|
|
4045
|
+
_options2 = new WeakMap();
|
|
1834
4046
|
_DUMMY_USER = new WeakMap();
|
|
1835
|
-
_httpsAgent = new WeakMap();
|
|
1836
4047
|
_invokeMethods = new WeakMap();
|
|
1837
4048
|
_maxRetries = new WeakMap();
|
|
1838
4049
|
_sleepDuration = new WeakMap();
|
|
1839
4050
|
_NoRetryStatusCodes = new WeakMap();
|
|
1840
4051
|
_stsfhirapiroot = new WeakMap();
|
|
4052
|
+
_agentManager2 = new WeakMap();
|
|
1841
4053
|
_LogDebugMessage = new WeakMap();
|
|
1842
4054
|
_LogErrorMessage = new WeakMap();
|
|
1843
|
-
_GetHttpsAgent = new WeakMap();
|
|
1844
4055
|
_HandleError = new WeakMap();
|
|
1845
4056
|
_InvokeResourceAPI = new WeakMap();
|
|
1846
4057
|
_TestMode = new WeakMap();
|