@nsshunt/stsobservability 1.0.73 → 1.0.74
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.
|
@@ -17,13 +17,13 @@ var __privateWrapper = (obj, member, setter, getter) => ({
|
|
|
17
17
|
return __privateGet(obj, member, getter);
|
|
18
18
|
}
|
|
19
19
|
});
|
|
20
|
-
var _a, _label,
|
|
20
|
+
var _a, _label, _options2, _data2, _val, _interval, _timeoutComputeVelocity, _lastVelocity, _delta, _maxVelocity, _timerInterval, _copy, _velocity, _velocityVal, _valStack, _averageValStack, _maxAverageValStack, _maxAverageIterations, _valStackMaxLength, _valStackAverage, _timeStamp, _maxTimeDiff, _vaTimeDiff, _velocityTimeDiff, _autoComputeVelocity, _autoComputeVelocityTimeout, _countDiff, _timeDiff, _deltaCountDiff, _deltaTimeDif, _minTimeForReporting, _averageVelocity, _InstrumentVelocity_instances, ComputeVelocityByTimeDiff_fn, ComputeVelocity_fn, SetupAutoComputeVelocity_fn, GetVelocityStackAverage_fn, GetVal_fn, SetVal_fn, GetVelocity_fn, GetMaxVelocity_fn, GetDelta_fn, GetTimeStamp_fn, GetCountDiff_fn, GetTimeDiff_fn, GetDeltaCountDiff_fn, GetDeltaTimeDif_fn, GetAverageVelocity_fn, _histogramData, _val2, _copy2, _InstrumentHistogram_instances, GetVal_fn2, SetVal_fn2, GetHistogramData_fn, SetHistogramData_fn, _messages, _readPos, _maxSize, _copy3, _useLatestMessages, _consoleLogging, _instrumentLogging, _winstonLogging, _stsLogger, _InstrumentLog_instances, DumpToConsole_fn, GetVal_fn3, SetVal_fn3, _start, _copy4, _pauseVal, _InstrumentTimerGauge_instances, GetVal_fn4, SetVal_fn4, _val3, _maxval, _lastObservedValue, _timeSeriesList, _maxSampleSize, _timerInterval2, _observer, _min, _max, _observations, _total, _copy5, _InstrumentGauge_instances, GetVal_fn5, SetVal_fn5, GetMin_fn, GetMax_fn, GetAverage_fn, GetAndResetMaxVal_fn, NumberCompare_fn, GetPercentileData_fn, _val4, _copy6, _InstrumentObject_instances, GetVal_fn6, SetVal_fn6, _tinyEmitter, _RequestCompleted, _agentManager2, _inPublish, _observer2, _publishState, _publisherTransport, _PublishInstruments_instances, PublishTimeoutLoop_fn, UpdateState_fn, _instruments, _publisher, _PublishInstrumentController_instances, GetInstrument_fn, ProcessTelemetryCommand_fn, CreateInstrument_fn, CreateInstruments_fn, _kafkaLog, _maxLogLength, _socketSubscribeKeepAlive, _options3, _ObservabilityRESTAPISubscriber_instances, LogDebugMessage_fn, LogErrorMessage_fn, InvokeRESTAPI_fn, _GetData, SetupTimeout_fn, AddKeepAlive_fn, RemoveKeepAlive_fn, _messageWithAckPayloadRecords, _socket, _maxReties, _timeoutValue, _options4, _SocketIoMessageSender_instances, LogDebugMessage_fn2, GetSubscribeKeepAliveAckEventName_fn, _socketSubscribeKeepAlive2, _socket2, _options5, _socketIoMessageSender, _ObservabilitySocketIOSubscriber_instances, LogDebugMessage_fn3, LogErrorMessage_fn2, AddKeepAlive_fn2, RemoveKeepAlive_fn2, _observabilitySocketIOSubscriber, _subscriptions, _kafkaHelper, _serviceModel, _agentModel, _lambdaModel, _options6, _ObservabilitySubscriptionManager_instances, LogDebugMessage_fn4, LogErrorMessage_fn3, _options7, _sockets, _httpsAgent2, _SocketIoClientHelper_instances, LogDebugMessage_fn5, LogErrorMessage_fn4, EstablishSocketConnect_fn, _socketIoServerHelperOptions, _namespace, _SetupStandardEvents, _SetupConnectionMiddleware, _SetupMessageMiddleware;
|
|
21
21
|
import _cloneDeep from "lodash.clonedeep";
|
|
22
22
|
import isNode from "detect-node";
|
|
23
23
|
import { STSOptionsBase } from "@nsshunt/stsutils";
|
|
24
24
|
import { TinyEmitter } from "tiny-emitter";
|
|
25
|
-
import https from "node:https";
|
|
26
25
|
import axios from "axios";
|
|
26
|
+
import https from "node:https";
|
|
27
27
|
import { inject } from "vue";
|
|
28
28
|
import { io } from "socket.io-client";
|
|
29
29
|
var Gauge = /* @__PURE__ */ ((Gauge2) => {
|
|
@@ -82,15 +82,15 @@ class InstrumentBase {
|
|
|
82
82
|
//protected _data: Record<string, any> = { };
|
|
83
83
|
constructor(options = {}) {
|
|
84
84
|
__privateAdd(this, _label, "");
|
|
85
|
-
__privateAdd(this,
|
|
86
|
-
__privateAdd(this,
|
|
85
|
+
__privateAdd(this, _options2, null);
|
|
86
|
+
__privateAdd(this, _data2, {});
|
|
87
87
|
__publicField(this, _a, GaugeTypes.INSTRUMENT_OBJECT);
|
|
88
88
|
// Default Gauge type
|
|
89
89
|
__publicField(this, "val");
|
|
90
90
|
if (typeof options === "string" || options instanceof String) {
|
|
91
91
|
throw new Error("Instrument parameter must be an options object.");
|
|
92
92
|
}
|
|
93
|
-
__privateSet(this,
|
|
93
|
+
__privateSet(this, _options2, options);
|
|
94
94
|
if (options.label) {
|
|
95
95
|
__privateSet(this, _label, options.label);
|
|
96
96
|
} else {
|
|
@@ -105,12 +105,12 @@ class InstrumentBase {
|
|
|
105
105
|
propertyNames.forEach((propertyName) => {
|
|
106
106
|
Object.defineProperty(this, propertyName, {
|
|
107
107
|
enumerable: true,
|
|
108
|
-
get: () => __privateGet(this,
|
|
108
|
+
get: () => __privateGet(this, _data2)[propertyName],
|
|
109
109
|
set: (value) => {
|
|
110
110
|
if (value === void 0) {
|
|
111
111
|
return;
|
|
112
112
|
}
|
|
113
|
-
__privateGet(this,
|
|
113
|
+
__privateGet(this, _data2)[propertyName] = value;
|
|
114
114
|
}
|
|
115
115
|
});
|
|
116
116
|
});
|
|
@@ -123,10 +123,10 @@ class InstrumentBase {
|
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
125
|
get options() {
|
|
126
|
-
return __privateGet(this,
|
|
126
|
+
return __privateGet(this, _options2);
|
|
127
127
|
}
|
|
128
128
|
set options(optionsValue) {
|
|
129
|
-
__privateSet(this,
|
|
129
|
+
__privateSet(this, _options2, optionsValue);
|
|
130
130
|
}
|
|
131
131
|
get label() {
|
|
132
132
|
return __privateGet(this, _label);
|
|
@@ -166,8 +166,8 @@ class InstrumentBase {
|
|
|
166
166
|
*/
|
|
167
167
|
}
|
|
168
168
|
_label = new WeakMap();
|
|
169
|
-
|
|
170
|
-
|
|
169
|
+
_options2 = new WeakMap();
|
|
170
|
+
_data2 = new WeakMap();
|
|
171
171
|
class InstrumentVelocityOptions extends InstrumentBaseOptions {
|
|
172
172
|
constructor() {
|
|
173
173
|
super(...arguments);
|
|
@@ -1203,15 +1203,39 @@ var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof win
|
|
|
1203
1203
|
function getDefaultExportFromCjs(x) {
|
|
1204
1204
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
1205
1205
|
}
|
|
1206
|
+
function getAugmentedNamespace(n) {
|
|
1207
|
+
if (n.__esModule) return n;
|
|
1208
|
+
var f = n.default;
|
|
1209
|
+
if (typeof f == "function") {
|
|
1210
|
+
var a = function a2() {
|
|
1211
|
+
if (this instanceof a2) {
|
|
1212
|
+
return Reflect.construct(f, arguments, this.constructor);
|
|
1213
|
+
}
|
|
1214
|
+
return f.apply(this, arguments);
|
|
1215
|
+
};
|
|
1216
|
+
a.prototype = f.prototype;
|
|
1217
|
+
} else a = {};
|
|
1218
|
+
Object.defineProperty(a, "__esModule", { value: true });
|
|
1219
|
+
Object.keys(n).forEach(function(k) {
|
|
1220
|
+
var d = Object.getOwnPropertyDescriptor(n, k);
|
|
1221
|
+
Object.defineProperty(a, k, d.get ? d : {
|
|
1222
|
+
enumerable: true,
|
|
1223
|
+
get: function() {
|
|
1224
|
+
return n[k];
|
|
1225
|
+
}
|
|
1226
|
+
});
|
|
1227
|
+
});
|
|
1228
|
+
return a;
|
|
1229
|
+
}
|
|
1206
1230
|
var timsort$1 = {};
|
|
1207
|
-
(function(
|
|
1231
|
+
(function(exports2) {
|
|
1208
1232
|
(function(global2, factory) {
|
|
1209
1233
|
{
|
|
1210
|
-
factory(
|
|
1234
|
+
factory(exports2);
|
|
1211
1235
|
}
|
|
1212
|
-
})(commonjsGlobal, function(
|
|
1213
|
-
|
|
1214
|
-
|
|
1236
|
+
})(commonjsGlobal, function(exports3) {
|
|
1237
|
+
exports3.__esModule = true;
|
|
1238
|
+
exports3.sort = sort;
|
|
1215
1239
|
function _classCallCheck(instance, Constructor) {
|
|
1216
1240
|
if (!(instance instanceof Constructor)) {
|
|
1217
1241
|
throw new TypeError("Cannot call a class as a function");
|
|
@@ -2474,13 +2498,13 @@ class RequestLoggerMiddleware extends STSOptionsBase {
|
|
|
2474
2498
|
}
|
|
2475
2499
|
_tinyEmitter = new WeakMap();
|
|
2476
2500
|
_RequestCompleted = new WeakMap();
|
|
2477
|
-
var ansiStyles$
|
|
2478
|
-
var colorName;
|
|
2479
|
-
var hasRequiredColorName;
|
|
2480
|
-
function requireColorName() {
|
|
2481
|
-
if (hasRequiredColorName) return colorName;
|
|
2482
|
-
hasRequiredColorName = 1;
|
|
2483
|
-
colorName = {
|
|
2501
|
+
var ansiStyles$3 = { exports: {} };
|
|
2502
|
+
var colorName$1;
|
|
2503
|
+
var hasRequiredColorName$1;
|
|
2504
|
+
function requireColorName$1() {
|
|
2505
|
+
if (hasRequiredColorName$1) return colorName$1;
|
|
2506
|
+
hasRequiredColorName$1 = 1;
|
|
2507
|
+
colorName$1 = {
|
|
2484
2508
|
"aliceblue": [240, 248, 255],
|
|
2485
2509
|
"antiquewhite": [250, 235, 215],
|
|
2486
2510
|
"aqua": [0, 255, 255],
|
|
@@ -2630,14 +2654,14 @@ function requireColorName() {
|
|
|
2630
2654
|
"yellow": [255, 255, 0],
|
|
2631
2655
|
"yellowgreen": [154, 205, 50]
|
|
2632
2656
|
};
|
|
2633
|
-
return colorName;
|
|
2657
|
+
return colorName$1;
|
|
2634
2658
|
}
|
|
2635
|
-
var conversions;
|
|
2636
|
-
var hasRequiredConversions;
|
|
2637
|
-
function requireConversions() {
|
|
2638
|
-
if (hasRequiredConversions) return conversions;
|
|
2639
|
-
hasRequiredConversions = 1;
|
|
2640
|
-
const cssKeywords = requireColorName();
|
|
2659
|
+
var conversions$1;
|
|
2660
|
+
var hasRequiredConversions$1;
|
|
2661
|
+
function requireConversions$1() {
|
|
2662
|
+
if (hasRequiredConversions$1) return conversions$1;
|
|
2663
|
+
hasRequiredConversions$1 = 1;
|
|
2664
|
+
const cssKeywords = requireColorName$1();
|
|
2641
2665
|
const reverseKeywords = {};
|
|
2642
2666
|
for (const key of Object.keys(cssKeywords)) {
|
|
2643
2667
|
reverseKeywords[cssKeywords[key]] = key;
|
|
@@ -2659,7 +2683,7 @@ function requireConversions() {
|
|
|
2659
2683
|
apple: { channels: 3, labels: ["r16", "g16", "b16"] },
|
|
2660
2684
|
gray: { channels: 1, labels: ["gray"] }
|
|
2661
2685
|
};
|
|
2662
|
-
conversions = convert;
|
|
2686
|
+
conversions$1 = convert;
|
|
2663
2687
|
for (const model of Object.keys(convert)) {
|
|
2664
2688
|
if (!("channels" in convert[model])) {
|
|
2665
2689
|
throw new Error("missing channels property: " + model);
|
|
@@ -3302,14 +3326,14 @@ function requireConversions() {
|
|
|
3302
3326
|
const val = (rgb[0] + rgb[1] + rgb[2]) / 3;
|
|
3303
3327
|
return [val / 255 * 100];
|
|
3304
3328
|
};
|
|
3305
|
-
return conversions;
|
|
3329
|
+
return conversions$1;
|
|
3306
3330
|
}
|
|
3307
|
-
var route;
|
|
3308
|
-
var hasRequiredRoute;
|
|
3309
|
-
function requireRoute() {
|
|
3310
|
-
if (hasRequiredRoute) return route;
|
|
3311
|
-
hasRequiredRoute = 1;
|
|
3312
|
-
const conversions2 = requireConversions();
|
|
3331
|
+
var route$1;
|
|
3332
|
+
var hasRequiredRoute$1;
|
|
3333
|
+
function requireRoute$1() {
|
|
3334
|
+
if (hasRequiredRoute$1) return route$1;
|
|
3335
|
+
hasRequiredRoute$1 = 1;
|
|
3336
|
+
const conversions2 = requireConversions$1();
|
|
3313
3337
|
function buildGraph() {
|
|
3314
3338
|
const graph = {};
|
|
3315
3339
|
const models = Object.keys(conversions2);
|
|
@@ -3348,18 +3372,18 @@ function requireRoute() {
|
|
|
3348
3372
|
};
|
|
3349
3373
|
}
|
|
3350
3374
|
function wrapConversion(toModel, graph) {
|
|
3351
|
-
const
|
|
3375
|
+
const path2 = [graph[toModel].parent, toModel];
|
|
3352
3376
|
let fn = conversions2[graph[toModel].parent][toModel];
|
|
3353
3377
|
let cur = graph[toModel].parent;
|
|
3354
3378
|
while (graph[cur].parent) {
|
|
3355
|
-
|
|
3379
|
+
path2.unshift(graph[cur].parent);
|
|
3356
3380
|
fn = link(conversions2[graph[cur].parent][cur], fn);
|
|
3357
3381
|
cur = graph[cur].parent;
|
|
3358
3382
|
}
|
|
3359
|
-
fn.conversion =
|
|
3383
|
+
fn.conversion = path2;
|
|
3360
3384
|
return fn;
|
|
3361
3385
|
}
|
|
3362
|
-
route = function(fromModel) {
|
|
3386
|
+
route$1 = function(fromModel) {
|
|
3363
3387
|
const graph = deriveBFS(fromModel);
|
|
3364
3388
|
const conversion = {};
|
|
3365
3389
|
const models = Object.keys(graph);
|
|
@@ -3373,15 +3397,15 @@ function requireRoute() {
|
|
|
3373
3397
|
}
|
|
3374
3398
|
return conversion;
|
|
3375
3399
|
};
|
|
3376
|
-
return route;
|
|
3400
|
+
return route$1;
|
|
3377
3401
|
}
|
|
3378
|
-
var colorConvert;
|
|
3379
|
-
var hasRequiredColorConvert;
|
|
3380
|
-
function requireColorConvert() {
|
|
3381
|
-
if (hasRequiredColorConvert) return colorConvert;
|
|
3382
|
-
hasRequiredColorConvert = 1;
|
|
3383
|
-
const conversions2 = requireConversions();
|
|
3384
|
-
const route2 = requireRoute();
|
|
3402
|
+
var colorConvert$1;
|
|
3403
|
+
var hasRequiredColorConvert$1;
|
|
3404
|
+
function requireColorConvert$1() {
|
|
3405
|
+
if (hasRequiredColorConvert$1) return colorConvert$1;
|
|
3406
|
+
hasRequiredColorConvert$1 = 1;
|
|
3407
|
+
const conversions2 = requireConversions$1();
|
|
3408
|
+
const route2 = requireRoute$1();
|
|
3385
3409
|
const convert = {};
|
|
3386
3410
|
const models = Object.keys(conversions2);
|
|
3387
3411
|
function wrapRaw(fn) {
|
|
@@ -3434,10 +3458,10 @@ function requireColorConvert() {
|
|
|
3434
3458
|
convert[fromModel][toModel].raw = wrapRaw(fn);
|
|
3435
3459
|
});
|
|
3436
3460
|
});
|
|
3437
|
-
colorConvert = convert;
|
|
3438
|
-
return colorConvert;
|
|
3461
|
+
colorConvert$1 = convert;
|
|
3462
|
+
return colorConvert$1;
|
|
3439
3463
|
}
|
|
3440
|
-
ansiStyles$
|
|
3464
|
+
ansiStyles$3.exports;
|
|
3441
3465
|
(function(module) {
|
|
3442
3466
|
const wrapAnsi16 = (fn, offset) => (...args) => {
|
|
3443
3467
|
const code = fn(...args);
|
|
@@ -3471,16 +3495,16 @@ ansiStyles$1.exports;
|
|
|
3471
3495
|
let colorConvert2;
|
|
3472
3496
|
const makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => {
|
|
3473
3497
|
if (colorConvert2 === void 0) {
|
|
3474
|
-
colorConvert2 = requireColorConvert();
|
|
3498
|
+
colorConvert2 = requireColorConvert$1();
|
|
3475
3499
|
}
|
|
3476
3500
|
const offset = isBackground ? 10 : 0;
|
|
3477
3501
|
const styles2 = {};
|
|
3478
3502
|
for (const [sourceSpace, suite] of Object.entries(colorConvert2)) {
|
|
3479
|
-
const
|
|
3503
|
+
const name2 = sourceSpace === "ansi16" ? "ansi" : sourceSpace;
|
|
3480
3504
|
if (sourceSpace === targetSpace) {
|
|
3481
|
-
styles2[
|
|
3505
|
+
styles2[name2] = wrap(identity, offset);
|
|
3482
3506
|
} else if (typeof suite === "object") {
|
|
3483
|
-
styles2[
|
|
3507
|
+
styles2[name2] = wrap(suite[targetSpace], offset);
|
|
3484
3508
|
}
|
|
3485
3509
|
}
|
|
3486
3510
|
return styles2;
|
|
@@ -3574,13 +3598,13 @@ ansiStyles$1.exports;
|
|
|
3574
3598
|
enumerable: true,
|
|
3575
3599
|
get: assembleStyles
|
|
3576
3600
|
});
|
|
3577
|
-
})(ansiStyles$
|
|
3578
|
-
var ansiStylesExports = ansiStyles$
|
|
3579
|
-
var browser = {
|
|
3601
|
+
})(ansiStyles$3);
|
|
3602
|
+
var ansiStylesExports$1 = ansiStyles$3.exports;
|
|
3603
|
+
var browser$2 = {
|
|
3580
3604
|
stdout: false,
|
|
3581
3605
|
stderr: false
|
|
3582
3606
|
};
|
|
3583
|
-
const stringReplaceAll$
|
|
3607
|
+
const stringReplaceAll$3 = (string, substring, replacer) => {
|
|
3584
3608
|
let index = string.indexOf(substring);
|
|
3585
3609
|
if (index === -1) {
|
|
3586
3610
|
return string;
|
|
@@ -3596,7 +3620,7 @@ const stringReplaceAll$1 = (string, substring, replacer) => {
|
|
|
3596
3620
|
returnValue += string.substr(endIndex);
|
|
3597
3621
|
return returnValue;
|
|
3598
3622
|
};
|
|
3599
|
-
const stringEncaseCRLFWithFirstIndex$
|
|
3623
|
+
const stringEncaseCRLFWithFirstIndex$3 = (string, prefix, postfix, index) => {
|
|
3600
3624
|
let endIndex = 0;
|
|
3601
3625
|
let returnValue = "";
|
|
3602
3626
|
do {
|
|
@@ -3608,15 +3632,15 @@ const stringEncaseCRLFWithFirstIndex$1 = (string, prefix, postfix, index) => {
|
|
|
3608
3632
|
returnValue += string.substr(endIndex);
|
|
3609
3633
|
return returnValue;
|
|
3610
3634
|
};
|
|
3611
|
-
var util = {
|
|
3612
|
-
stringReplaceAll: stringReplaceAll$
|
|
3613
|
-
stringEncaseCRLFWithFirstIndex: stringEncaseCRLFWithFirstIndex$
|
|
3635
|
+
var util$1 = {
|
|
3636
|
+
stringReplaceAll: stringReplaceAll$3,
|
|
3637
|
+
stringEncaseCRLFWithFirstIndex: stringEncaseCRLFWithFirstIndex$3
|
|
3614
3638
|
};
|
|
3615
|
-
var templates;
|
|
3616
|
-
var hasRequiredTemplates;
|
|
3617
|
-
function requireTemplates() {
|
|
3618
|
-
if (hasRequiredTemplates) return templates;
|
|
3619
|
-
hasRequiredTemplates = 1;
|
|
3639
|
+
var templates$1;
|
|
3640
|
+
var hasRequiredTemplates$1;
|
|
3641
|
+
function requireTemplates$1() {
|
|
3642
|
+
if (hasRequiredTemplates$1) return templates$1;
|
|
3643
|
+
hasRequiredTemplates$1 = 1;
|
|
3620
3644
|
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;
|
|
3621
3645
|
const STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
|
|
3622
3646
|
const STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;
|
|
@@ -3644,7 +3668,7 @@ function requireTemplates() {
|
|
|
3644
3668
|
}
|
|
3645
3669
|
return ESCAPES.get(c) || c;
|
|
3646
3670
|
}
|
|
3647
|
-
function parseArguments(
|
|
3671
|
+
function parseArguments(name2, arguments_) {
|
|
3648
3672
|
const results = [];
|
|
3649
3673
|
const chunks = arguments_.trim().split(/\s*,\s*/g);
|
|
3650
3674
|
let matches;
|
|
@@ -3655,7 +3679,7 @@ function requireTemplates() {
|
|
|
3655
3679
|
} else if (matches = chunk.match(STRING_REGEX)) {
|
|
3656
3680
|
results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, character) => escape ? unescape(escape) : character));
|
|
3657
3681
|
} else {
|
|
3658
|
-
throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${
|
|
3682
|
+
throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name2}')`);
|
|
3659
3683
|
}
|
|
3660
3684
|
}
|
|
3661
3685
|
return results;
|
|
@@ -3665,12 +3689,12 @@ function requireTemplates() {
|
|
|
3665
3689
|
const results = [];
|
|
3666
3690
|
let matches;
|
|
3667
3691
|
while ((matches = STYLE_REGEX.exec(style)) !== null) {
|
|
3668
|
-
const
|
|
3692
|
+
const name2 = matches[1];
|
|
3669
3693
|
if (matches[2]) {
|
|
3670
|
-
const args = parseArguments(
|
|
3671
|
-
results.push([
|
|
3694
|
+
const args = parseArguments(name2, matches[2]);
|
|
3695
|
+
results.push([name2].concat(args));
|
|
3672
3696
|
} else {
|
|
3673
|
-
results.push([
|
|
3697
|
+
results.push([name2]);
|
|
3674
3698
|
}
|
|
3675
3699
|
}
|
|
3676
3700
|
return results;
|
|
@@ -3694,7 +3718,7 @@ function requireTemplates() {
|
|
|
3694
3718
|
}
|
|
3695
3719
|
return current;
|
|
3696
3720
|
}
|
|
3697
|
-
templates = (chalk2, temporary) => {
|
|
3721
|
+
templates$1 = (chalk2, temporary) => {
|
|
3698
3722
|
const styles2 = [];
|
|
3699
3723
|
const chunks = [];
|
|
3700
3724
|
let chunk = [];
|
|
@@ -3724,92 +3748,92 @@ function requireTemplates() {
|
|
|
3724
3748
|
}
|
|
3725
3749
|
return chunks.join("");
|
|
3726
3750
|
};
|
|
3727
|
-
return templates;
|
|
3751
|
+
return templates$1;
|
|
3728
3752
|
}
|
|
3729
|
-
const ansiStyles = ansiStylesExports;
|
|
3730
|
-
const { stdout: stdoutColor, stderr: stderrColor } = browser;
|
|
3753
|
+
const ansiStyles$2 = ansiStylesExports$1;
|
|
3754
|
+
const { stdout: stdoutColor$1, stderr: stderrColor$1 } = browser$2;
|
|
3731
3755
|
const {
|
|
3732
|
-
stringReplaceAll,
|
|
3733
|
-
stringEncaseCRLFWithFirstIndex
|
|
3734
|
-
} = util;
|
|
3735
|
-
const { isArray } = Array;
|
|
3736
|
-
const levelMapping = [
|
|
3756
|
+
stringReplaceAll: stringReplaceAll$2,
|
|
3757
|
+
stringEncaseCRLFWithFirstIndex: stringEncaseCRLFWithFirstIndex$2
|
|
3758
|
+
} = util$1;
|
|
3759
|
+
const { isArray: isArray$1 } = Array;
|
|
3760
|
+
const levelMapping$1 = [
|
|
3737
3761
|
"ansi",
|
|
3738
3762
|
"ansi",
|
|
3739
3763
|
"ansi256",
|
|
3740
3764
|
"ansi16m"
|
|
3741
3765
|
];
|
|
3742
|
-
const styles = /* @__PURE__ */ Object.create(null);
|
|
3743
|
-
const applyOptions = (object, options = {}) => {
|
|
3766
|
+
const styles$1 = /* @__PURE__ */ Object.create(null);
|
|
3767
|
+
const applyOptions$1 = (object, options = {}) => {
|
|
3744
3768
|
if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
|
|
3745
3769
|
throw new Error("The `level` option should be an integer from 0 to 3");
|
|
3746
3770
|
}
|
|
3747
|
-
const colorLevel = stdoutColor ? stdoutColor.level : 0;
|
|
3771
|
+
const colorLevel = stdoutColor$1 ? stdoutColor$1.level : 0;
|
|
3748
3772
|
object.level = options.level === void 0 ? colorLevel : options.level;
|
|
3749
3773
|
};
|
|
3750
|
-
class ChalkClass {
|
|
3774
|
+
let ChalkClass$1 = class ChalkClass {
|
|
3751
3775
|
constructor(options) {
|
|
3752
|
-
return chalkFactory(options);
|
|
3776
|
+
return chalkFactory$1(options);
|
|
3753
3777
|
}
|
|
3754
|
-
}
|
|
3755
|
-
const chalkFactory = (options) => {
|
|
3778
|
+
};
|
|
3779
|
+
const chalkFactory$1 = (options) => {
|
|
3756
3780
|
const chalk2 = {};
|
|
3757
|
-
applyOptions(chalk2, options);
|
|
3758
|
-
chalk2.template = (...arguments_) => chalkTag(chalk2.template, ...arguments_);
|
|
3759
|
-
Object.setPrototypeOf(chalk2, Chalk.prototype);
|
|
3781
|
+
applyOptions$1(chalk2, options);
|
|
3782
|
+
chalk2.template = (...arguments_) => chalkTag$1(chalk2.template, ...arguments_);
|
|
3783
|
+
Object.setPrototypeOf(chalk2, Chalk$1.prototype);
|
|
3760
3784
|
Object.setPrototypeOf(chalk2.template, chalk2);
|
|
3761
3785
|
chalk2.template.constructor = () => {
|
|
3762
3786
|
throw new Error("`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.");
|
|
3763
3787
|
};
|
|
3764
|
-
chalk2.template.Instance = ChalkClass;
|
|
3788
|
+
chalk2.template.Instance = ChalkClass$1;
|
|
3765
3789
|
return chalk2.template;
|
|
3766
3790
|
};
|
|
3767
|
-
function Chalk(options) {
|
|
3768
|
-
return chalkFactory(options);
|
|
3791
|
+
function Chalk$1(options) {
|
|
3792
|
+
return chalkFactory$1(options);
|
|
3769
3793
|
}
|
|
3770
|
-
for (const [styleName, style] of Object.entries(ansiStyles)) {
|
|
3771
|
-
styles[styleName] = {
|
|
3794
|
+
for (const [styleName, style] of Object.entries(ansiStyles$2)) {
|
|
3795
|
+
styles$1[styleName] = {
|
|
3772
3796
|
get() {
|
|
3773
|
-
const builder = createBuilder(this, createStyler(style.open, style.close, this._styler), this._isEmpty);
|
|
3797
|
+
const builder = createBuilder$1(this, createStyler$1(style.open, style.close, this._styler), this._isEmpty);
|
|
3774
3798
|
Object.defineProperty(this, styleName, { value: builder });
|
|
3775
3799
|
return builder;
|
|
3776
3800
|
}
|
|
3777
3801
|
};
|
|
3778
3802
|
}
|
|
3779
|
-
styles.visible = {
|
|
3803
|
+
styles$1.visible = {
|
|
3780
3804
|
get() {
|
|
3781
|
-
const builder = createBuilder(this, this._styler, true);
|
|
3805
|
+
const builder = createBuilder$1(this, this._styler, true);
|
|
3782
3806
|
Object.defineProperty(this, "visible", { value: builder });
|
|
3783
3807
|
return builder;
|
|
3784
3808
|
}
|
|
3785
3809
|
};
|
|
3786
|
-
const usedModels = ["rgb", "hex", "keyword", "hsl", "hsv", "hwb", "ansi", "ansi256"];
|
|
3787
|
-
for (const model of usedModels) {
|
|
3788
|
-
styles[model] = {
|
|
3810
|
+
const usedModels$1 = ["rgb", "hex", "keyword", "hsl", "hsv", "hwb", "ansi", "ansi256"];
|
|
3811
|
+
for (const model of usedModels$1) {
|
|
3812
|
+
styles$1[model] = {
|
|
3789
3813
|
get() {
|
|
3790
3814
|
const { level } = this;
|
|
3791
3815
|
return function(...arguments_) {
|
|
3792
|
-
const styler = createStyler(ansiStyles.color[levelMapping[level]][model](...arguments_), ansiStyles.color.close, this._styler);
|
|
3793
|
-
return createBuilder(this, styler, this._isEmpty);
|
|
3816
|
+
const styler = createStyler$1(ansiStyles$2.color[levelMapping$1[level]][model](...arguments_), ansiStyles$2.color.close, this._styler);
|
|
3817
|
+
return createBuilder$1(this, styler, this._isEmpty);
|
|
3794
3818
|
};
|
|
3795
3819
|
}
|
|
3796
3820
|
};
|
|
3797
3821
|
}
|
|
3798
|
-
for (const model of usedModels) {
|
|
3822
|
+
for (const model of usedModels$1) {
|
|
3799
3823
|
const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
|
|
3800
|
-
styles[bgModel] = {
|
|
3824
|
+
styles$1[bgModel] = {
|
|
3801
3825
|
get() {
|
|
3802
3826
|
const { level } = this;
|
|
3803
3827
|
return function(...arguments_) {
|
|
3804
|
-
const styler = createStyler(ansiStyles.bgColor[levelMapping[level]][model](...arguments_), ansiStyles.bgColor.close, this._styler);
|
|
3805
|
-
return createBuilder(this, styler, this._isEmpty);
|
|
3828
|
+
const styler = createStyler$1(ansiStyles$2.bgColor[levelMapping$1[level]][model](...arguments_), ansiStyles$2.bgColor.close, this._styler);
|
|
3829
|
+
return createBuilder$1(this, styler, this._isEmpty);
|
|
3806
3830
|
};
|
|
3807
3831
|
}
|
|
3808
3832
|
};
|
|
3809
3833
|
}
|
|
3810
|
-
const proto = Object.defineProperties(() => {
|
|
3834
|
+
const proto$1 = Object.defineProperties(() => {
|
|
3811
3835
|
}, {
|
|
3812
|
-
...styles,
|
|
3836
|
+
...styles$1,
|
|
3813
3837
|
level: {
|
|
3814
3838
|
enumerable: true,
|
|
3815
3839
|
get() {
|
|
@@ -3820,7 +3844,7 @@ const proto = Object.defineProperties(() => {
|
|
|
3820
3844
|
}
|
|
3821
3845
|
}
|
|
3822
3846
|
});
|
|
3823
|
-
const createStyler = (open, close, parent) => {
|
|
3847
|
+
const createStyler$1 = (open, close, parent) => {
|
|
3824
3848
|
let openAll;
|
|
3825
3849
|
let closeAll;
|
|
3826
3850
|
if (parent === void 0) {
|
|
@@ -3838,20 +3862,20 @@ const createStyler = (open, close, parent) => {
|
|
|
3838
3862
|
parent
|
|
3839
3863
|
};
|
|
3840
3864
|
};
|
|
3841
|
-
const createBuilder = (self2, _styler, _isEmpty) => {
|
|
3865
|
+
const createBuilder$1 = (self2, _styler, _isEmpty) => {
|
|
3842
3866
|
const builder = (...arguments_) => {
|
|
3843
|
-
if (isArray(arguments_[0]) && isArray(arguments_[0].raw)) {
|
|
3844
|
-
return applyStyle(builder, chalkTag(builder, ...arguments_));
|
|
3867
|
+
if (isArray$1(arguments_[0]) && isArray$1(arguments_[0].raw)) {
|
|
3868
|
+
return applyStyle$1(builder, chalkTag$1(builder, ...arguments_));
|
|
3845
3869
|
}
|
|
3846
|
-
return applyStyle(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
|
|
3870
|
+
return applyStyle$1(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
|
|
3847
3871
|
};
|
|
3848
|
-
Object.setPrototypeOf(builder, proto);
|
|
3872
|
+
Object.setPrototypeOf(builder, proto$1);
|
|
3849
3873
|
builder._generator = self2;
|
|
3850
3874
|
builder._styler = _styler;
|
|
3851
3875
|
builder._isEmpty = _isEmpty;
|
|
3852
3876
|
return builder;
|
|
3853
3877
|
};
|
|
3854
|
-
const applyStyle = (self2, string) => {
|
|
3878
|
+
const applyStyle$1 = (self2, string) => {
|
|
3855
3879
|
if (self2.level <= 0 || !string) {
|
|
3856
3880
|
return self2._isEmpty ? "" : string;
|
|
3857
3881
|
}
|
|
@@ -3862,20 +3886,20 @@ const applyStyle = (self2, string) => {
|
|
|
3862
3886
|
const { openAll, closeAll } = styler;
|
|
3863
3887
|
if (string.indexOf("\x1B") !== -1) {
|
|
3864
3888
|
while (styler !== void 0) {
|
|
3865
|
-
string = stringReplaceAll(string, styler.close, styler.open);
|
|
3889
|
+
string = stringReplaceAll$2(string, styler.close, styler.open);
|
|
3866
3890
|
styler = styler.parent;
|
|
3867
3891
|
}
|
|
3868
3892
|
}
|
|
3869
3893
|
const lfIndex = string.indexOf("\n");
|
|
3870
3894
|
if (lfIndex !== -1) {
|
|
3871
|
-
string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
|
|
3895
|
+
string = stringEncaseCRLFWithFirstIndex$2(string, closeAll, openAll, lfIndex);
|
|
3872
3896
|
}
|
|
3873
3897
|
return openAll + string + closeAll;
|
|
3874
3898
|
};
|
|
3875
|
-
let template;
|
|
3876
|
-
const chalkTag = (chalk2, ...strings) => {
|
|
3899
|
+
let template$1;
|
|
3900
|
+
const chalkTag$1 = (chalk2, ...strings) => {
|
|
3877
3901
|
const [firstString] = strings;
|
|
3878
|
-
if (!isArray(firstString) || !isArray(firstString.raw)) {
|
|
3902
|
+
if (!isArray$1(firstString) || !isArray$1(firstString.raw)) {
|
|
3879
3903
|
return strings.join(" ");
|
|
3880
3904
|
}
|
|
3881
3905
|
const arguments_ = strings.slice(1);
|
|
@@ -3886,18 +3910,18 @@ const chalkTag = (chalk2, ...strings) => {
|
|
|
3886
3910
|
String(firstString.raw[i])
|
|
3887
3911
|
);
|
|
3888
3912
|
}
|
|
3889
|
-
if (template === void 0) {
|
|
3890
|
-
template = requireTemplates();
|
|
3913
|
+
if (template$1 === void 0) {
|
|
3914
|
+
template$1 = requireTemplates$1();
|
|
3891
3915
|
}
|
|
3892
|
-
return template(chalk2, parts.join(""));
|
|
3916
|
+
return template$1(chalk2, parts.join(""));
|
|
3893
3917
|
};
|
|
3894
|
-
Object.defineProperties(Chalk.prototype, styles);
|
|
3895
|
-
const chalk = Chalk();
|
|
3896
|
-
chalk.supportsColor = stdoutColor;
|
|
3897
|
-
chalk.stderr = Chalk({ level: stderrColor ? stderrColor.level : 0 });
|
|
3898
|
-
chalk.stderr.supportsColor = stderrColor;
|
|
3899
|
-
var source = chalk;
|
|
3900
|
-
const chalk$
|
|
3918
|
+
Object.defineProperties(Chalk$1.prototype, styles$1);
|
|
3919
|
+
const chalk$1 = Chalk$1();
|
|
3920
|
+
chalk$1.supportsColor = stdoutColor$1;
|
|
3921
|
+
chalk$1.stderr = Chalk$1({ level: stderrColor$1 ? stderrColor$1.level : 0 });
|
|
3922
|
+
chalk$1.stderr.supportsColor = stderrColor$1;
|
|
3923
|
+
var source = chalk$1;
|
|
3924
|
+
const chalk$2 = /* @__PURE__ */ getDefaultExportFromCjs(source);
|
|
3901
3925
|
function utf8Count(str) {
|
|
3902
3926
|
var strLength = str.length;
|
|
3903
3927
|
var byteLength = 0;
|
|
@@ -4536,163 +4560,2312 @@ function encode(value, options) {
|
|
|
4536
4560
|
var encoder = new Encoder(options);
|
|
4537
4561
|
return encoder.encodeSharedRef(value);
|
|
4538
4562
|
}
|
|
4539
|
-
|
|
4540
|
-
|
|
4541
|
-
|
|
4542
|
-
|
|
4543
|
-
|
|
4544
|
-
|
|
4545
|
-
|
|
4546
|
-
|
|
4547
|
-
|
|
4548
|
-
|
|
4549
|
-
|
|
4550
|
-
|
|
4551
|
-
|
|
4552
|
-
|
|
4553
|
-
|
|
4554
|
-
|
|
4555
|
-
|
|
4556
|
-
|
|
4557
|
-
|
|
4558
|
-
|
|
4559
|
-
|
|
4560
|
-
|
|
4561
|
-
|
|
4562
|
-
|
|
4563
|
-
|
|
4564
|
-
|
|
4565
|
-
|
|
4566
|
-
|
|
4567
|
-
|
|
4568
|
-
|
|
4569
|
-
|
|
4570
|
-
|
|
4571
|
-
|
|
4572
|
-
|
|
4573
|
-
|
|
4574
|
-
|
|
4575
|
-
|
|
4576
|
-
|
|
4577
|
-
|
|
4578
|
-
|
|
4579
|
-
|
|
4580
|
-
|
|
4581
|
-
|
|
4582
|
-
|
|
4583
|
-
|
|
4584
|
-
|
|
4585
|
-
|
|
4586
|
-
|
|
4587
|
-
|
|
4588
|
-
|
|
4589
|
-
|
|
4590
|
-
|
|
4591
|
-
|
|
4592
|
-
|
|
4593
|
-
|
|
4594
|
-
|
|
4595
|
-
|
|
4596
|
-
|
|
4597
|
-
|
|
4598
|
-
|
|
4599
|
-
|
|
4600
|
-
|
|
4601
|
-
|
|
4563
|
+
const http = {};
|
|
4564
|
+
const fs$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4565
|
+
__proto__: null,
|
|
4566
|
+
default: http
|
|
4567
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
4568
|
+
var main$1 = { exports: {} };
|
|
4569
|
+
const require$$3 = /* @__PURE__ */ getAugmentedNamespace(fs$1);
|
|
4570
|
+
const name = "dotenv";
|
|
4571
|
+
const version$1 = "16.4.5";
|
|
4572
|
+
const description = "Loads environment variables from .env file";
|
|
4573
|
+
const main = "lib/main.js";
|
|
4574
|
+
const types = "lib/main.d.ts";
|
|
4575
|
+
const exports = {
|
|
4576
|
+
".": {
|
|
4577
|
+
types: "./lib/main.d.ts",
|
|
4578
|
+
require: "./lib/main.js",
|
|
4579
|
+
"default": "./lib/main.js"
|
|
4580
|
+
},
|
|
4581
|
+
"./config": "./config.js",
|
|
4582
|
+
"./config.js": "./config.js",
|
|
4583
|
+
"./lib/env-options": "./lib/env-options.js",
|
|
4584
|
+
"./lib/env-options.js": "./lib/env-options.js",
|
|
4585
|
+
"./lib/cli-options": "./lib/cli-options.js",
|
|
4586
|
+
"./lib/cli-options.js": "./lib/cli-options.js",
|
|
4587
|
+
"./package.json": "./package.json"
|
|
4588
|
+
};
|
|
4589
|
+
const scripts = {
|
|
4590
|
+
"dts-check": "tsc --project tests/types/tsconfig.json",
|
|
4591
|
+
lint: "standard",
|
|
4592
|
+
"lint-readme": "standard-markdown",
|
|
4593
|
+
pretest: "npm run lint && npm run dts-check",
|
|
4594
|
+
test: "tap tests/*.js --100 -Rspec",
|
|
4595
|
+
"test:coverage": "tap --coverage-report=lcov",
|
|
4596
|
+
prerelease: "npm test",
|
|
4597
|
+
release: "standard-version"
|
|
4598
|
+
};
|
|
4599
|
+
const repository = {
|
|
4600
|
+
type: "git",
|
|
4601
|
+
url: "git://github.com/motdotla/dotenv.git"
|
|
4602
|
+
};
|
|
4603
|
+
const funding = "https://dotenvx.com";
|
|
4604
|
+
const keywords = [
|
|
4605
|
+
"dotenv",
|
|
4606
|
+
"env",
|
|
4607
|
+
".env",
|
|
4608
|
+
"environment",
|
|
4609
|
+
"variables",
|
|
4610
|
+
"config",
|
|
4611
|
+
"settings"
|
|
4612
|
+
];
|
|
4613
|
+
const readmeFilename = "README.md";
|
|
4614
|
+
const license = "BSD-2-Clause";
|
|
4615
|
+
const devDependencies = {
|
|
4616
|
+
"@definitelytyped/dtslint": "^0.0.133",
|
|
4617
|
+
"@types/node": "^18.11.3",
|
|
4618
|
+
decache: "^4.6.1",
|
|
4619
|
+
sinon: "^14.0.1",
|
|
4620
|
+
standard: "^17.0.0",
|
|
4621
|
+
"standard-markdown": "^7.1.0",
|
|
4622
|
+
"standard-version": "^9.5.0",
|
|
4623
|
+
tap: "^16.3.0",
|
|
4624
|
+
tar: "^6.1.11",
|
|
4625
|
+
typescript: "^4.8.4"
|
|
4626
|
+
};
|
|
4627
|
+
const engines = {
|
|
4628
|
+
node: ">=12"
|
|
4629
|
+
};
|
|
4630
|
+
const browser$1 = {
|
|
4631
|
+
fs: false
|
|
4632
|
+
};
|
|
4633
|
+
const require$$4 = {
|
|
4634
|
+
name,
|
|
4635
|
+
version: version$1,
|
|
4636
|
+
description,
|
|
4637
|
+
main,
|
|
4638
|
+
types,
|
|
4639
|
+
exports,
|
|
4640
|
+
scripts,
|
|
4641
|
+
repository,
|
|
4642
|
+
funding,
|
|
4643
|
+
keywords,
|
|
4644
|
+
readmeFilename,
|
|
4645
|
+
license,
|
|
4646
|
+
devDependencies,
|
|
4647
|
+
engines,
|
|
4648
|
+
browser: browser$1
|
|
4649
|
+
};
|
|
4650
|
+
const fs = require$$3;
|
|
4651
|
+
const path = require$$3;
|
|
4652
|
+
const os = require$$3;
|
|
4653
|
+
const crypto$1 = require$$3;
|
|
4654
|
+
const packageJson = require$$4;
|
|
4655
|
+
const version = packageJson.version;
|
|
4656
|
+
const LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;
|
|
4657
|
+
function parse(src) {
|
|
4658
|
+
const obj = {};
|
|
4659
|
+
let lines = src.toString();
|
|
4660
|
+
lines = lines.replace(/\r\n?/mg, "\n");
|
|
4661
|
+
let match;
|
|
4662
|
+
while ((match = LINE.exec(lines)) != null) {
|
|
4663
|
+
const key = match[1];
|
|
4664
|
+
let value = match[2] || "";
|
|
4665
|
+
value = value.trim();
|
|
4666
|
+
const maybeQuote = value[0];
|
|
4667
|
+
value = value.replace(/^(['"`])([\s\S]*)\1$/mg, "$2");
|
|
4668
|
+
if (maybeQuote === '"') {
|
|
4669
|
+
value = value.replace(/\\n/g, "\n");
|
|
4670
|
+
value = value.replace(/\\r/g, "\r");
|
|
4671
|
+
}
|
|
4672
|
+
obj[key] = value;
|
|
4673
|
+
}
|
|
4674
|
+
return obj;
|
|
4675
|
+
}
|
|
4676
|
+
function _parseVault(options) {
|
|
4677
|
+
const vaultPath = _vaultPath(options);
|
|
4678
|
+
const result = DotenvModule.configDotenv({ path: vaultPath });
|
|
4679
|
+
if (!result.parsed) {
|
|
4680
|
+
const err = new Error(`MISSING_DATA: Cannot parse ${vaultPath} for an unknown reason`);
|
|
4681
|
+
err.code = "MISSING_DATA";
|
|
4682
|
+
throw err;
|
|
4683
|
+
}
|
|
4684
|
+
const keys = _dotenvKey(options).split(",");
|
|
4685
|
+
const length = keys.length;
|
|
4686
|
+
let decrypted;
|
|
4687
|
+
for (let i = 0; i < length; i++) {
|
|
4688
|
+
try {
|
|
4689
|
+
const key = keys[i].trim();
|
|
4690
|
+
const attrs = _instructions(result, key);
|
|
4691
|
+
decrypted = DotenvModule.decrypt(attrs.ciphertext, attrs.key);
|
|
4692
|
+
break;
|
|
4693
|
+
} catch (error) {
|
|
4694
|
+
if (i + 1 >= length) {
|
|
4695
|
+
throw error;
|
|
4602
4696
|
}
|
|
4603
|
-
});
|
|
4604
|
-
if (isNode) {
|
|
4605
|
-
const agentOptions = this.options.agentOptions;
|
|
4606
|
-
__privateSet(this, _httpsAgent, new https.Agent({
|
|
4607
|
-
keepAlive: agentOptions == null ? void 0 : agentOptions.keepAlive,
|
|
4608
|
-
maxSockets: agentOptions == null ? void 0 : agentOptions.maxSockets,
|
|
4609
|
-
maxTotalSockets: agentOptions == null ? void 0 : agentOptions.maxTotalSockets,
|
|
4610
|
-
maxFreeSockets: agentOptions == null ? void 0 : agentOptions.maxFreeSockets,
|
|
4611
|
-
timeout: agentOptions == null ? void 0 : agentOptions.timeout,
|
|
4612
|
-
rejectUnauthorized: agentOptions == null ? void 0 : agentOptions.rejectUnauthorized
|
|
4613
|
-
// Allows self signed certs in non production mode(s)
|
|
4614
|
-
}));
|
|
4615
|
-
}
|
|
4616
|
-
}
|
|
4617
|
-
get options() {
|
|
4618
|
-
return super.options;
|
|
4619
|
-
}
|
|
4620
|
-
async Close() {
|
|
4621
|
-
if (__privateGet(this, _httpsAgent)) {
|
|
4622
|
-
__privateGet(this, _httpsAgent).destroy();
|
|
4623
4697
|
}
|
|
4624
|
-
return true;
|
|
4625
4698
|
}
|
|
4699
|
+
return DotenvModule.parse(decrypted);
|
|
4626
4700
|
}
|
|
4627
|
-
|
|
4628
|
-
|
|
4629
|
-
|
|
4630
|
-
|
|
4631
|
-
|
|
4632
|
-
|
|
4633
|
-
|
|
4634
|
-
|
|
4635
|
-
|
|
4636
|
-
|
|
4637
|
-
|
|
4638
|
-
|
|
4639
|
-
__privateSet(this, _publisherTransport, new PublishTransportRESTServer(options.publishTransportBaseOptions));
|
|
4640
|
-
break;
|
|
4641
|
-
}
|
|
4642
|
-
__privateMethod(this, _PublishInstruments_instances, UpdateState_fn).call(this, 0, "constructor()");
|
|
4701
|
+
function _log(message) {
|
|
4702
|
+
console.log(`[dotenv@${version}][INFO] ${message}`);
|
|
4703
|
+
}
|
|
4704
|
+
function _warn(message) {
|
|
4705
|
+
console.log(`[dotenv@${version}][WARN] ${message}`);
|
|
4706
|
+
}
|
|
4707
|
+
function _debug(message) {
|
|
4708
|
+
console.log(`[dotenv@${version}][DEBUG] ${message}`);
|
|
4709
|
+
}
|
|
4710
|
+
function _dotenvKey(options) {
|
|
4711
|
+
if (options && options.DOTENV_KEY && options.DOTENV_KEY.length > 0) {
|
|
4712
|
+
return options.DOTENV_KEY;
|
|
4643
4713
|
}
|
|
4644
|
-
|
|
4645
|
-
return
|
|
4714
|
+
if (process.env.DOTENV_KEY && process.env.DOTENV_KEY.length > 0) {
|
|
4715
|
+
return process.env.DOTENV_KEY;
|
|
4646
4716
|
}
|
|
4647
|
-
|
|
4648
|
-
|
|
4649
|
-
|
|
4650
|
-
|
|
4651
|
-
|
|
4652
|
-
|
|
4653
|
-
|
|
4654
|
-
|
|
4655
|
-
|
|
4656
|
-
|
|
4717
|
+
return "";
|
|
4718
|
+
}
|
|
4719
|
+
function _instructions(result, dotenvKey) {
|
|
4720
|
+
let uri;
|
|
4721
|
+
try {
|
|
4722
|
+
uri = new URL(dotenvKey);
|
|
4723
|
+
} catch (error) {
|
|
4724
|
+
if (error.code === "ERR_INVALID_URL") {
|
|
4725
|
+
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");
|
|
4726
|
+
err.code = "INVALID_DOTENV_KEY";
|
|
4727
|
+
throw err;
|
|
4728
|
+
}
|
|
4729
|
+
throw error;
|
|
4730
|
+
}
|
|
4731
|
+
const key = uri.password;
|
|
4732
|
+
if (!key) {
|
|
4733
|
+
const err = new Error("INVALID_DOTENV_KEY: Missing key part");
|
|
4734
|
+
err.code = "INVALID_DOTENV_KEY";
|
|
4735
|
+
throw err;
|
|
4736
|
+
}
|
|
4737
|
+
const environment = uri.searchParams.get("environment");
|
|
4738
|
+
if (!environment) {
|
|
4739
|
+
const err = new Error("INVALID_DOTENV_KEY: Missing environment part");
|
|
4740
|
+
err.code = "INVALID_DOTENV_KEY";
|
|
4741
|
+
throw err;
|
|
4742
|
+
}
|
|
4743
|
+
const environmentKey = `DOTENV_VAULT_${environment.toUpperCase()}`;
|
|
4744
|
+
const ciphertext = result.parsed[environmentKey];
|
|
4745
|
+
if (!ciphertext) {
|
|
4746
|
+
const err = new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${environmentKey} in your .env.vault file.`);
|
|
4747
|
+
err.code = "NOT_FOUND_DOTENV_ENVIRONMENT";
|
|
4748
|
+
throw err;
|
|
4749
|
+
}
|
|
4750
|
+
return { ciphertext, key };
|
|
4751
|
+
}
|
|
4752
|
+
function _vaultPath(options) {
|
|
4753
|
+
let possibleVaultPath = null;
|
|
4754
|
+
if (options && options.path && options.path.length > 0) {
|
|
4755
|
+
if (Array.isArray(options.path)) {
|
|
4756
|
+
for (const filepath of options.path) {
|
|
4757
|
+
if (fs.existsSync(filepath)) {
|
|
4758
|
+
possibleVaultPath = filepath.endsWith(".vault") ? filepath : `${filepath}.vault`;
|
|
4657
4759
|
}
|
|
4658
|
-
return false;
|
|
4659
|
-
} catch (error) {
|
|
4660
|
-
return false;
|
|
4661
|
-
} finally {
|
|
4662
|
-
__privateSet(this, _inPublish, false);
|
|
4663
4760
|
}
|
|
4664
4761
|
} else {
|
|
4665
|
-
|
|
4762
|
+
possibleVaultPath = options.path.endsWith(".vault") ? options.path : `${options.path}.vault`;
|
|
4666
4763
|
}
|
|
4764
|
+
} else {
|
|
4765
|
+
possibleVaultPath = path.resolve(process.cwd(), ".env.vault");
|
|
4667
4766
|
}
|
|
4668
|
-
|
|
4669
|
-
|
|
4670
|
-
this.options.logger.debug(chalk$1.yellow(`StartPublish:${this.options.processContext.nid}: StartPublish called when not currently in the init state. Current State: [${__privateGet(this, _publishState)}]`));
|
|
4671
|
-
return false;
|
|
4672
|
-
}
|
|
4673
|
-
__privateMethod(this, _PublishInstruments_instances, UpdateState_fn).call(this, 1, "StartPublish()");
|
|
4674
|
-
__privateMethod(this, _PublishInstruments_instances, PublishTimeoutLoop_fn).call(this, this.options.publishInterval);
|
|
4675
|
-
return true;
|
|
4767
|
+
if (fs.existsSync(possibleVaultPath)) {
|
|
4768
|
+
return possibleVaultPath;
|
|
4676
4769
|
}
|
|
4677
|
-
|
|
4678
|
-
|
|
4679
|
-
|
|
4680
|
-
|
|
4770
|
+
return null;
|
|
4771
|
+
}
|
|
4772
|
+
function _resolveHome(envPath) {
|
|
4773
|
+
return envPath[0] === "~" ? path.join(os.homedir(), envPath.slice(1)) : envPath;
|
|
4774
|
+
}
|
|
4775
|
+
function _configVault(options) {
|
|
4776
|
+
_log("Loading env from encrypted .env.vault");
|
|
4777
|
+
const parsed = DotenvModule._parseVault(options);
|
|
4778
|
+
let processEnv = process.env;
|
|
4779
|
+
if (options && options.processEnv != null) {
|
|
4780
|
+
processEnv = options.processEnv;
|
|
4781
|
+
}
|
|
4782
|
+
DotenvModule.populate(processEnv, parsed, options);
|
|
4783
|
+
return { parsed };
|
|
4784
|
+
}
|
|
4785
|
+
function configDotenv(options) {
|
|
4786
|
+
const dotenvPath = path.resolve(process.cwd(), ".env");
|
|
4787
|
+
let encoding = "utf8";
|
|
4788
|
+
const debug = Boolean(options && options.debug);
|
|
4789
|
+
if (options && options.encoding) {
|
|
4790
|
+
encoding = options.encoding;
|
|
4791
|
+
} else {
|
|
4792
|
+
if (debug) {
|
|
4793
|
+
_debug("No encoding is specified. UTF-8 is used by default");
|
|
4681
4794
|
}
|
|
4682
|
-
|
|
4683
|
-
|
|
4684
|
-
|
|
4685
|
-
|
|
4686
|
-
|
|
4795
|
+
}
|
|
4796
|
+
let optionPaths = [dotenvPath];
|
|
4797
|
+
if (options && options.path) {
|
|
4798
|
+
if (!Array.isArray(options.path)) {
|
|
4799
|
+
optionPaths = [_resolveHome(options.path)];
|
|
4800
|
+
} else {
|
|
4801
|
+
optionPaths = [];
|
|
4802
|
+
for (const filepath of options.path) {
|
|
4803
|
+
optionPaths.push(_resolveHome(filepath));
|
|
4804
|
+
}
|
|
4687
4805
|
}
|
|
4688
|
-
|
|
4689
|
-
|
|
4806
|
+
}
|
|
4807
|
+
let lastError;
|
|
4808
|
+
const parsedAll = {};
|
|
4809
|
+
for (const path2 of optionPaths) {
|
|
4810
|
+
try {
|
|
4811
|
+
const parsed = DotenvModule.parse(fs.readFileSync(path2, { encoding }));
|
|
4812
|
+
DotenvModule.populate(parsedAll, parsed, options);
|
|
4813
|
+
} catch (e) {
|
|
4814
|
+
if (debug) {
|
|
4815
|
+
_debug(`Failed to load ${path2} ${e.message}`);
|
|
4816
|
+
}
|
|
4817
|
+
lastError = e;
|
|
4690
4818
|
}
|
|
4691
|
-
__privateMethod(this, _PublishInstruments_instances, UpdateState_fn).call(this, 0, "EndPublish() (2)");
|
|
4692
|
-
return true;
|
|
4693
4819
|
}
|
|
4694
|
-
|
|
4695
|
-
|
|
4820
|
+
let processEnv = process.env;
|
|
4821
|
+
if (options && options.processEnv != null) {
|
|
4822
|
+
processEnv = options.processEnv;
|
|
4823
|
+
}
|
|
4824
|
+
DotenvModule.populate(processEnv, parsedAll, options);
|
|
4825
|
+
if (lastError) {
|
|
4826
|
+
return { parsed: parsedAll, error: lastError };
|
|
4827
|
+
} else {
|
|
4828
|
+
return { parsed: parsedAll };
|
|
4829
|
+
}
|
|
4830
|
+
}
|
|
4831
|
+
function config(options) {
|
|
4832
|
+
if (_dotenvKey(options).length === 0) {
|
|
4833
|
+
return DotenvModule.configDotenv(options);
|
|
4834
|
+
}
|
|
4835
|
+
const vaultPath = _vaultPath(options);
|
|
4836
|
+
if (!vaultPath) {
|
|
4837
|
+
_warn(`You set DOTENV_KEY but you are missing a .env.vault file at ${vaultPath}. Did you forget to build it?`);
|
|
4838
|
+
return DotenvModule.configDotenv(options);
|
|
4839
|
+
}
|
|
4840
|
+
return DotenvModule._configVault(options);
|
|
4841
|
+
}
|
|
4842
|
+
function decrypt(encrypted, keyStr) {
|
|
4843
|
+
const key = Buffer.from(keyStr.slice(-64), "hex");
|
|
4844
|
+
let ciphertext = Buffer.from(encrypted, "base64");
|
|
4845
|
+
const nonce = ciphertext.subarray(0, 12);
|
|
4846
|
+
const authTag = ciphertext.subarray(-16);
|
|
4847
|
+
ciphertext = ciphertext.subarray(12, -16);
|
|
4848
|
+
try {
|
|
4849
|
+
const aesgcm = crypto$1.createDecipheriv("aes-256-gcm", key, nonce);
|
|
4850
|
+
aesgcm.setAuthTag(authTag);
|
|
4851
|
+
return `${aesgcm.update(ciphertext)}${aesgcm.final()}`;
|
|
4852
|
+
} catch (error) {
|
|
4853
|
+
const isRange = error instanceof RangeError;
|
|
4854
|
+
const invalidKeyLength = error.message === "Invalid key length";
|
|
4855
|
+
const decryptionFailed = error.message === "Unsupported state or unable to authenticate data";
|
|
4856
|
+
if (isRange || invalidKeyLength) {
|
|
4857
|
+
const err = new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");
|
|
4858
|
+
err.code = "INVALID_DOTENV_KEY";
|
|
4859
|
+
throw err;
|
|
4860
|
+
} else if (decryptionFailed) {
|
|
4861
|
+
const err = new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");
|
|
4862
|
+
err.code = "DECRYPTION_FAILED";
|
|
4863
|
+
throw err;
|
|
4864
|
+
} else {
|
|
4865
|
+
throw error;
|
|
4866
|
+
}
|
|
4867
|
+
}
|
|
4868
|
+
}
|
|
4869
|
+
function populate(processEnv, parsed, options = {}) {
|
|
4870
|
+
const debug = Boolean(options && options.debug);
|
|
4871
|
+
const override = Boolean(options && options.override);
|
|
4872
|
+
if (typeof parsed !== "object") {
|
|
4873
|
+
const err = new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");
|
|
4874
|
+
err.code = "OBJECT_REQUIRED";
|
|
4875
|
+
throw err;
|
|
4876
|
+
}
|
|
4877
|
+
for (const key of Object.keys(parsed)) {
|
|
4878
|
+
if (Object.prototype.hasOwnProperty.call(processEnv, key)) {
|
|
4879
|
+
if (override === true) {
|
|
4880
|
+
processEnv[key] = parsed[key];
|
|
4881
|
+
}
|
|
4882
|
+
if (debug) {
|
|
4883
|
+
if (override === true) {
|
|
4884
|
+
_debug(`"${key}" is already defined and WAS overwritten`);
|
|
4885
|
+
} else {
|
|
4886
|
+
_debug(`"${key}" is already defined and was NOT overwritten`);
|
|
4887
|
+
}
|
|
4888
|
+
}
|
|
4889
|
+
} else {
|
|
4890
|
+
processEnv[key] = parsed[key];
|
|
4891
|
+
}
|
|
4892
|
+
}
|
|
4893
|
+
}
|
|
4894
|
+
const DotenvModule = {
|
|
4895
|
+
configDotenv,
|
|
4896
|
+
_configVault,
|
|
4897
|
+
_parseVault,
|
|
4898
|
+
config,
|
|
4899
|
+
decrypt,
|
|
4900
|
+
parse,
|
|
4901
|
+
populate
|
|
4902
|
+
};
|
|
4903
|
+
main$1.exports.configDotenv = DotenvModule.configDotenv;
|
|
4904
|
+
main$1.exports._configVault = DotenvModule._configVault;
|
|
4905
|
+
main$1.exports._parseVault = DotenvModule._parseVault;
|
|
4906
|
+
var config_1 = main$1.exports.config = DotenvModule.config;
|
|
4907
|
+
main$1.exports.decrypt = DotenvModule.decrypt;
|
|
4908
|
+
main$1.exports.parse = DotenvModule.parse;
|
|
4909
|
+
main$1.exports.populate = DotenvModule.populate;
|
|
4910
|
+
main$1.exports = DotenvModule;
|
|
4911
|
+
var __typeError2 = (msg) => {
|
|
4912
|
+
throw TypeError(msg);
|
|
4913
|
+
};
|
|
4914
|
+
var __accessCheck2 = (obj, member, msg) => member.has(obj) || __typeError2("Cannot " + msg);
|
|
4915
|
+
var __privateGet2 = (obj, member, getter) => (__accessCheck2(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
4916
|
+
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);
|
|
4917
|
+
var __privateSet2 = (obj, member, value, setter) => (__accessCheck2(obj, member, "write to private field"), member.set(obj, value), value);
|
|
4918
|
+
var __privateWrapper2 = (obj, member, setter, getter) => ({
|
|
4919
|
+
set _(value) {
|
|
4920
|
+
__privateSet2(obj, member, value);
|
|
4921
|
+
},
|
|
4922
|
+
get _() {
|
|
4923
|
+
return __privateGet2(obj, member, getter);
|
|
4924
|
+
}
|
|
4925
|
+
});
|
|
4926
|
+
var _options, _httpAgent, _httpsAgent, _agentResetInterval, _requestCount, _SetupResetInterval, _GetAgentOptions, _url, _method, _headers, _data, _agentManager, _timeout;
|
|
4927
|
+
var ansiStyles$1 = { exports: {} };
|
|
4928
|
+
var colorName;
|
|
4929
|
+
var hasRequiredColorName;
|
|
4930
|
+
function requireColorName() {
|
|
4931
|
+
if (hasRequiredColorName) return colorName;
|
|
4932
|
+
hasRequiredColorName = 1;
|
|
4933
|
+
colorName = {
|
|
4934
|
+
"aliceblue": [240, 248, 255],
|
|
4935
|
+
"antiquewhite": [250, 235, 215],
|
|
4936
|
+
"aqua": [0, 255, 255],
|
|
4937
|
+
"aquamarine": [127, 255, 212],
|
|
4938
|
+
"azure": [240, 255, 255],
|
|
4939
|
+
"beige": [245, 245, 220],
|
|
4940
|
+
"bisque": [255, 228, 196],
|
|
4941
|
+
"black": [0, 0, 0],
|
|
4942
|
+
"blanchedalmond": [255, 235, 205],
|
|
4943
|
+
"blue": [0, 0, 255],
|
|
4944
|
+
"blueviolet": [138, 43, 226],
|
|
4945
|
+
"brown": [165, 42, 42],
|
|
4946
|
+
"burlywood": [222, 184, 135],
|
|
4947
|
+
"cadetblue": [95, 158, 160],
|
|
4948
|
+
"chartreuse": [127, 255, 0],
|
|
4949
|
+
"chocolate": [210, 105, 30],
|
|
4950
|
+
"coral": [255, 127, 80],
|
|
4951
|
+
"cornflowerblue": [100, 149, 237],
|
|
4952
|
+
"cornsilk": [255, 248, 220],
|
|
4953
|
+
"crimson": [220, 20, 60],
|
|
4954
|
+
"cyan": [0, 255, 255],
|
|
4955
|
+
"darkblue": [0, 0, 139],
|
|
4956
|
+
"darkcyan": [0, 139, 139],
|
|
4957
|
+
"darkgoldenrod": [184, 134, 11],
|
|
4958
|
+
"darkgray": [169, 169, 169],
|
|
4959
|
+
"darkgreen": [0, 100, 0],
|
|
4960
|
+
"darkgrey": [169, 169, 169],
|
|
4961
|
+
"darkkhaki": [189, 183, 107],
|
|
4962
|
+
"darkmagenta": [139, 0, 139],
|
|
4963
|
+
"darkolivegreen": [85, 107, 47],
|
|
4964
|
+
"darkorange": [255, 140, 0],
|
|
4965
|
+
"darkorchid": [153, 50, 204],
|
|
4966
|
+
"darkred": [139, 0, 0],
|
|
4967
|
+
"darksalmon": [233, 150, 122],
|
|
4968
|
+
"darkseagreen": [143, 188, 143],
|
|
4969
|
+
"darkslateblue": [72, 61, 139],
|
|
4970
|
+
"darkslategray": [47, 79, 79],
|
|
4971
|
+
"darkslategrey": [47, 79, 79],
|
|
4972
|
+
"darkturquoise": [0, 206, 209],
|
|
4973
|
+
"darkviolet": [148, 0, 211],
|
|
4974
|
+
"deeppink": [255, 20, 147],
|
|
4975
|
+
"deepskyblue": [0, 191, 255],
|
|
4976
|
+
"dimgray": [105, 105, 105],
|
|
4977
|
+
"dimgrey": [105, 105, 105],
|
|
4978
|
+
"dodgerblue": [30, 144, 255],
|
|
4979
|
+
"firebrick": [178, 34, 34],
|
|
4980
|
+
"floralwhite": [255, 250, 240],
|
|
4981
|
+
"forestgreen": [34, 139, 34],
|
|
4982
|
+
"fuchsia": [255, 0, 255],
|
|
4983
|
+
"gainsboro": [220, 220, 220],
|
|
4984
|
+
"ghostwhite": [248, 248, 255],
|
|
4985
|
+
"gold": [255, 215, 0],
|
|
4986
|
+
"goldenrod": [218, 165, 32],
|
|
4987
|
+
"gray": [128, 128, 128],
|
|
4988
|
+
"green": [0, 128, 0],
|
|
4989
|
+
"greenyellow": [173, 255, 47],
|
|
4990
|
+
"grey": [128, 128, 128],
|
|
4991
|
+
"honeydew": [240, 255, 240],
|
|
4992
|
+
"hotpink": [255, 105, 180],
|
|
4993
|
+
"indianred": [205, 92, 92],
|
|
4994
|
+
"indigo": [75, 0, 130],
|
|
4995
|
+
"ivory": [255, 255, 240],
|
|
4996
|
+
"khaki": [240, 230, 140],
|
|
4997
|
+
"lavender": [230, 230, 250],
|
|
4998
|
+
"lavenderblush": [255, 240, 245],
|
|
4999
|
+
"lawngreen": [124, 252, 0],
|
|
5000
|
+
"lemonchiffon": [255, 250, 205],
|
|
5001
|
+
"lightblue": [173, 216, 230],
|
|
5002
|
+
"lightcoral": [240, 128, 128],
|
|
5003
|
+
"lightcyan": [224, 255, 255],
|
|
5004
|
+
"lightgoldenrodyellow": [250, 250, 210],
|
|
5005
|
+
"lightgray": [211, 211, 211],
|
|
5006
|
+
"lightgreen": [144, 238, 144],
|
|
5007
|
+
"lightgrey": [211, 211, 211],
|
|
5008
|
+
"lightpink": [255, 182, 193],
|
|
5009
|
+
"lightsalmon": [255, 160, 122],
|
|
5010
|
+
"lightseagreen": [32, 178, 170],
|
|
5011
|
+
"lightskyblue": [135, 206, 250],
|
|
5012
|
+
"lightslategray": [119, 136, 153],
|
|
5013
|
+
"lightslategrey": [119, 136, 153],
|
|
5014
|
+
"lightsteelblue": [176, 196, 222],
|
|
5015
|
+
"lightyellow": [255, 255, 224],
|
|
5016
|
+
"lime": [0, 255, 0],
|
|
5017
|
+
"limegreen": [50, 205, 50],
|
|
5018
|
+
"linen": [250, 240, 230],
|
|
5019
|
+
"magenta": [255, 0, 255],
|
|
5020
|
+
"maroon": [128, 0, 0],
|
|
5021
|
+
"mediumaquamarine": [102, 205, 170],
|
|
5022
|
+
"mediumblue": [0, 0, 205],
|
|
5023
|
+
"mediumorchid": [186, 85, 211],
|
|
5024
|
+
"mediumpurple": [147, 112, 219],
|
|
5025
|
+
"mediumseagreen": [60, 179, 113],
|
|
5026
|
+
"mediumslateblue": [123, 104, 238],
|
|
5027
|
+
"mediumspringgreen": [0, 250, 154],
|
|
5028
|
+
"mediumturquoise": [72, 209, 204],
|
|
5029
|
+
"mediumvioletred": [199, 21, 133],
|
|
5030
|
+
"midnightblue": [25, 25, 112],
|
|
5031
|
+
"mintcream": [245, 255, 250],
|
|
5032
|
+
"mistyrose": [255, 228, 225],
|
|
5033
|
+
"moccasin": [255, 228, 181],
|
|
5034
|
+
"navajowhite": [255, 222, 173],
|
|
5035
|
+
"navy": [0, 0, 128],
|
|
5036
|
+
"oldlace": [253, 245, 230],
|
|
5037
|
+
"olive": [128, 128, 0],
|
|
5038
|
+
"olivedrab": [107, 142, 35],
|
|
5039
|
+
"orange": [255, 165, 0],
|
|
5040
|
+
"orangered": [255, 69, 0],
|
|
5041
|
+
"orchid": [218, 112, 214],
|
|
5042
|
+
"palegoldenrod": [238, 232, 170],
|
|
5043
|
+
"palegreen": [152, 251, 152],
|
|
5044
|
+
"paleturquoise": [175, 238, 238],
|
|
5045
|
+
"palevioletred": [219, 112, 147],
|
|
5046
|
+
"papayawhip": [255, 239, 213],
|
|
5047
|
+
"peachpuff": [255, 218, 185],
|
|
5048
|
+
"peru": [205, 133, 63],
|
|
5049
|
+
"pink": [255, 192, 203],
|
|
5050
|
+
"plum": [221, 160, 221],
|
|
5051
|
+
"powderblue": [176, 224, 230],
|
|
5052
|
+
"purple": [128, 0, 128],
|
|
5053
|
+
"rebeccapurple": [102, 51, 153],
|
|
5054
|
+
"red": [255, 0, 0],
|
|
5055
|
+
"rosybrown": [188, 143, 143],
|
|
5056
|
+
"royalblue": [65, 105, 225],
|
|
5057
|
+
"saddlebrown": [139, 69, 19],
|
|
5058
|
+
"salmon": [250, 128, 114],
|
|
5059
|
+
"sandybrown": [244, 164, 96],
|
|
5060
|
+
"seagreen": [46, 139, 87],
|
|
5061
|
+
"seashell": [255, 245, 238],
|
|
5062
|
+
"sienna": [160, 82, 45],
|
|
5063
|
+
"silver": [192, 192, 192],
|
|
5064
|
+
"skyblue": [135, 206, 235],
|
|
5065
|
+
"slateblue": [106, 90, 205],
|
|
5066
|
+
"slategray": [112, 128, 144],
|
|
5067
|
+
"slategrey": [112, 128, 144],
|
|
5068
|
+
"snow": [255, 250, 250],
|
|
5069
|
+
"springgreen": [0, 255, 127],
|
|
5070
|
+
"steelblue": [70, 130, 180],
|
|
5071
|
+
"tan": [210, 180, 140],
|
|
5072
|
+
"teal": [0, 128, 128],
|
|
5073
|
+
"thistle": [216, 191, 216],
|
|
5074
|
+
"tomato": [255, 99, 71],
|
|
5075
|
+
"turquoise": [64, 224, 208],
|
|
5076
|
+
"violet": [238, 130, 238],
|
|
5077
|
+
"wheat": [245, 222, 179],
|
|
5078
|
+
"white": [255, 255, 255],
|
|
5079
|
+
"whitesmoke": [245, 245, 245],
|
|
5080
|
+
"yellow": [255, 255, 0],
|
|
5081
|
+
"yellowgreen": [154, 205, 50]
|
|
5082
|
+
};
|
|
5083
|
+
return colorName;
|
|
5084
|
+
}
|
|
5085
|
+
var conversions;
|
|
5086
|
+
var hasRequiredConversions;
|
|
5087
|
+
function requireConversions() {
|
|
5088
|
+
if (hasRequiredConversions) return conversions;
|
|
5089
|
+
hasRequiredConversions = 1;
|
|
5090
|
+
const cssKeywords = requireColorName();
|
|
5091
|
+
const reverseKeywords = {};
|
|
5092
|
+
for (const key of Object.keys(cssKeywords)) {
|
|
5093
|
+
reverseKeywords[cssKeywords[key]] = key;
|
|
5094
|
+
}
|
|
5095
|
+
const convert = {
|
|
5096
|
+
rgb: { channels: 3, labels: "rgb" },
|
|
5097
|
+
hsl: { channels: 3, labels: "hsl" },
|
|
5098
|
+
hsv: { channels: 3, labels: "hsv" },
|
|
5099
|
+
hwb: { channels: 3, labels: "hwb" },
|
|
5100
|
+
cmyk: { channels: 4, labels: "cmyk" },
|
|
5101
|
+
xyz: { channels: 3, labels: "xyz" },
|
|
5102
|
+
lab: { channels: 3, labels: "lab" },
|
|
5103
|
+
lch: { channels: 3, labels: "lch" },
|
|
5104
|
+
hex: { channels: 1, labels: ["hex"] },
|
|
5105
|
+
keyword: { channels: 1, labels: ["keyword"] },
|
|
5106
|
+
ansi16: { channels: 1, labels: ["ansi16"] },
|
|
5107
|
+
ansi256: { channels: 1, labels: ["ansi256"] },
|
|
5108
|
+
hcg: { channels: 3, labels: ["h", "c", "g"] },
|
|
5109
|
+
apple: { channels: 3, labels: ["r16", "g16", "b16"] },
|
|
5110
|
+
gray: { channels: 1, labels: ["gray"] }
|
|
5111
|
+
};
|
|
5112
|
+
conversions = convert;
|
|
5113
|
+
for (const model of Object.keys(convert)) {
|
|
5114
|
+
if (!("channels" in convert[model])) {
|
|
5115
|
+
throw new Error("missing channels property: " + model);
|
|
5116
|
+
}
|
|
5117
|
+
if (!("labels" in convert[model])) {
|
|
5118
|
+
throw new Error("missing channel labels property: " + model);
|
|
5119
|
+
}
|
|
5120
|
+
if (convert[model].labels.length !== convert[model].channels) {
|
|
5121
|
+
throw new Error("channel and label counts mismatch: " + model);
|
|
5122
|
+
}
|
|
5123
|
+
const { channels, labels } = convert[model];
|
|
5124
|
+
delete convert[model].channels;
|
|
5125
|
+
delete convert[model].labels;
|
|
5126
|
+
Object.defineProperty(convert[model], "channels", { value: channels });
|
|
5127
|
+
Object.defineProperty(convert[model], "labels", { value: labels });
|
|
5128
|
+
}
|
|
5129
|
+
convert.rgb.hsl = function(rgb) {
|
|
5130
|
+
const r = rgb[0] / 255;
|
|
5131
|
+
const g = rgb[1] / 255;
|
|
5132
|
+
const b = rgb[2] / 255;
|
|
5133
|
+
const min = Math.min(r, g, b);
|
|
5134
|
+
const max = Math.max(r, g, b);
|
|
5135
|
+
const delta = max - min;
|
|
5136
|
+
let h;
|
|
5137
|
+
let s;
|
|
5138
|
+
if (max === min) {
|
|
5139
|
+
h = 0;
|
|
5140
|
+
} else if (r === max) {
|
|
5141
|
+
h = (g - b) / delta;
|
|
5142
|
+
} else if (g === max) {
|
|
5143
|
+
h = 2 + (b - r) / delta;
|
|
5144
|
+
} else if (b === max) {
|
|
5145
|
+
h = 4 + (r - g) / delta;
|
|
5146
|
+
}
|
|
5147
|
+
h = Math.min(h * 60, 360);
|
|
5148
|
+
if (h < 0) {
|
|
5149
|
+
h += 360;
|
|
5150
|
+
}
|
|
5151
|
+
const l = (min + max) / 2;
|
|
5152
|
+
if (max === min) {
|
|
5153
|
+
s = 0;
|
|
5154
|
+
} else if (l <= 0.5) {
|
|
5155
|
+
s = delta / (max + min);
|
|
5156
|
+
} else {
|
|
5157
|
+
s = delta / (2 - max - min);
|
|
5158
|
+
}
|
|
5159
|
+
return [h, s * 100, l * 100];
|
|
5160
|
+
};
|
|
5161
|
+
convert.rgb.hsv = function(rgb) {
|
|
5162
|
+
let rdif;
|
|
5163
|
+
let gdif;
|
|
5164
|
+
let bdif;
|
|
5165
|
+
let h;
|
|
5166
|
+
let s;
|
|
5167
|
+
const r = rgb[0] / 255;
|
|
5168
|
+
const g = rgb[1] / 255;
|
|
5169
|
+
const b = rgb[2] / 255;
|
|
5170
|
+
const v = Math.max(r, g, b);
|
|
5171
|
+
const diff = v - Math.min(r, g, b);
|
|
5172
|
+
const diffc = function(c) {
|
|
5173
|
+
return (v - c) / 6 / diff + 1 / 2;
|
|
5174
|
+
};
|
|
5175
|
+
if (diff === 0) {
|
|
5176
|
+
h = 0;
|
|
5177
|
+
s = 0;
|
|
5178
|
+
} else {
|
|
5179
|
+
s = diff / v;
|
|
5180
|
+
rdif = diffc(r);
|
|
5181
|
+
gdif = diffc(g);
|
|
5182
|
+
bdif = diffc(b);
|
|
5183
|
+
if (r === v) {
|
|
5184
|
+
h = bdif - gdif;
|
|
5185
|
+
} else if (g === v) {
|
|
5186
|
+
h = 1 / 3 + rdif - bdif;
|
|
5187
|
+
} else if (b === v) {
|
|
5188
|
+
h = 2 / 3 + gdif - rdif;
|
|
5189
|
+
}
|
|
5190
|
+
if (h < 0) {
|
|
5191
|
+
h += 1;
|
|
5192
|
+
} else if (h > 1) {
|
|
5193
|
+
h -= 1;
|
|
5194
|
+
}
|
|
5195
|
+
}
|
|
5196
|
+
return [
|
|
5197
|
+
h * 360,
|
|
5198
|
+
s * 100,
|
|
5199
|
+
v * 100
|
|
5200
|
+
];
|
|
5201
|
+
};
|
|
5202
|
+
convert.rgb.hwb = function(rgb) {
|
|
5203
|
+
const r = rgb[0];
|
|
5204
|
+
const g = rgb[1];
|
|
5205
|
+
let b = rgb[2];
|
|
5206
|
+
const h = convert.rgb.hsl(rgb)[0];
|
|
5207
|
+
const w = 1 / 255 * Math.min(r, Math.min(g, b));
|
|
5208
|
+
b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
|
|
5209
|
+
return [h, w * 100, b * 100];
|
|
5210
|
+
};
|
|
5211
|
+
convert.rgb.cmyk = function(rgb) {
|
|
5212
|
+
const r = rgb[0] / 255;
|
|
5213
|
+
const g = rgb[1] / 255;
|
|
5214
|
+
const b = rgb[2] / 255;
|
|
5215
|
+
const k = Math.min(1 - r, 1 - g, 1 - b);
|
|
5216
|
+
const c = (1 - r - k) / (1 - k) || 0;
|
|
5217
|
+
const m = (1 - g - k) / (1 - k) || 0;
|
|
5218
|
+
const y = (1 - b - k) / (1 - k) || 0;
|
|
5219
|
+
return [c * 100, m * 100, y * 100, k * 100];
|
|
5220
|
+
};
|
|
5221
|
+
function comparativeDistance(x, y) {
|
|
5222
|
+
return (x[0] - y[0]) ** 2 + (x[1] - y[1]) ** 2 + (x[2] - y[2]) ** 2;
|
|
5223
|
+
}
|
|
5224
|
+
convert.rgb.keyword = function(rgb) {
|
|
5225
|
+
const reversed = reverseKeywords[rgb];
|
|
5226
|
+
if (reversed) {
|
|
5227
|
+
return reversed;
|
|
5228
|
+
}
|
|
5229
|
+
let currentClosestDistance = Infinity;
|
|
5230
|
+
let currentClosestKeyword;
|
|
5231
|
+
for (const keyword of Object.keys(cssKeywords)) {
|
|
5232
|
+
const value = cssKeywords[keyword];
|
|
5233
|
+
const distance = comparativeDistance(rgb, value);
|
|
5234
|
+
if (distance < currentClosestDistance) {
|
|
5235
|
+
currentClosestDistance = distance;
|
|
5236
|
+
currentClosestKeyword = keyword;
|
|
5237
|
+
}
|
|
5238
|
+
}
|
|
5239
|
+
return currentClosestKeyword;
|
|
5240
|
+
};
|
|
5241
|
+
convert.keyword.rgb = function(keyword) {
|
|
5242
|
+
return cssKeywords[keyword];
|
|
5243
|
+
};
|
|
5244
|
+
convert.rgb.xyz = function(rgb) {
|
|
5245
|
+
let r = rgb[0] / 255;
|
|
5246
|
+
let g = rgb[1] / 255;
|
|
5247
|
+
let b = rgb[2] / 255;
|
|
5248
|
+
r = r > 0.04045 ? ((r + 0.055) / 1.055) ** 2.4 : r / 12.92;
|
|
5249
|
+
g = g > 0.04045 ? ((g + 0.055) / 1.055) ** 2.4 : g / 12.92;
|
|
5250
|
+
b = b > 0.04045 ? ((b + 0.055) / 1.055) ** 2.4 : b / 12.92;
|
|
5251
|
+
const x = r * 0.4124 + g * 0.3576 + b * 0.1805;
|
|
5252
|
+
const y = r * 0.2126 + g * 0.7152 + b * 0.0722;
|
|
5253
|
+
const z = r * 0.0193 + g * 0.1192 + b * 0.9505;
|
|
5254
|
+
return [x * 100, y * 100, z * 100];
|
|
5255
|
+
};
|
|
5256
|
+
convert.rgb.lab = function(rgb) {
|
|
5257
|
+
const xyz = convert.rgb.xyz(rgb);
|
|
5258
|
+
let x = xyz[0];
|
|
5259
|
+
let y = xyz[1];
|
|
5260
|
+
let z = xyz[2];
|
|
5261
|
+
x /= 95.047;
|
|
5262
|
+
y /= 100;
|
|
5263
|
+
z /= 108.883;
|
|
5264
|
+
x = x > 8856e-6 ? x ** (1 / 3) : 7.787 * x + 16 / 116;
|
|
5265
|
+
y = y > 8856e-6 ? y ** (1 / 3) : 7.787 * y + 16 / 116;
|
|
5266
|
+
z = z > 8856e-6 ? z ** (1 / 3) : 7.787 * z + 16 / 116;
|
|
5267
|
+
const l = 116 * y - 16;
|
|
5268
|
+
const a = 500 * (x - y);
|
|
5269
|
+
const b = 200 * (y - z);
|
|
5270
|
+
return [l, a, b];
|
|
5271
|
+
};
|
|
5272
|
+
convert.hsl.rgb = function(hsl) {
|
|
5273
|
+
const h = hsl[0] / 360;
|
|
5274
|
+
const s = hsl[1] / 100;
|
|
5275
|
+
const l = hsl[2] / 100;
|
|
5276
|
+
let t2;
|
|
5277
|
+
let t3;
|
|
5278
|
+
let val;
|
|
5279
|
+
if (s === 0) {
|
|
5280
|
+
val = l * 255;
|
|
5281
|
+
return [val, val, val];
|
|
5282
|
+
}
|
|
5283
|
+
if (l < 0.5) {
|
|
5284
|
+
t2 = l * (1 + s);
|
|
5285
|
+
} else {
|
|
5286
|
+
t2 = l + s - l * s;
|
|
5287
|
+
}
|
|
5288
|
+
const t1 = 2 * l - t2;
|
|
5289
|
+
const rgb = [0, 0, 0];
|
|
5290
|
+
for (let i = 0; i < 3; i++) {
|
|
5291
|
+
t3 = h + 1 / 3 * -(i - 1);
|
|
5292
|
+
if (t3 < 0) {
|
|
5293
|
+
t3++;
|
|
5294
|
+
}
|
|
5295
|
+
if (t3 > 1) {
|
|
5296
|
+
t3--;
|
|
5297
|
+
}
|
|
5298
|
+
if (6 * t3 < 1) {
|
|
5299
|
+
val = t1 + (t2 - t1) * 6 * t3;
|
|
5300
|
+
} else if (2 * t3 < 1) {
|
|
5301
|
+
val = t2;
|
|
5302
|
+
} else if (3 * t3 < 2) {
|
|
5303
|
+
val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
|
|
5304
|
+
} else {
|
|
5305
|
+
val = t1;
|
|
5306
|
+
}
|
|
5307
|
+
rgb[i] = val * 255;
|
|
5308
|
+
}
|
|
5309
|
+
return rgb;
|
|
5310
|
+
};
|
|
5311
|
+
convert.hsl.hsv = function(hsl) {
|
|
5312
|
+
const h = hsl[0];
|
|
5313
|
+
let s = hsl[1] / 100;
|
|
5314
|
+
let l = hsl[2] / 100;
|
|
5315
|
+
let smin = s;
|
|
5316
|
+
const lmin = Math.max(l, 0.01);
|
|
5317
|
+
l *= 2;
|
|
5318
|
+
s *= l <= 1 ? l : 2 - l;
|
|
5319
|
+
smin *= lmin <= 1 ? lmin : 2 - lmin;
|
|
5320
|
+
const v = (l + s) / 2;
|
|
5321
|
+
const sv = l === 0 ? 2 * smin / (lmin + smin) : 2 * s / (l + s);
|
|
5322
|
+
return [h, sv * 100, v * 100];
|
|
5323
|
+
};
|
|
5324
|
+
convert.hsv.rgb = function(hsv) {
|
|
5325
|
+
const h = hsv[0] / 60;
|
|
5326
|
+
const s = hsv[1] / 100;
|
|
5327
|
+
let v = hsv[2] / 100;
|
|
5328
|
+
const hi = Math.floor(h) % 6;
|
|
5329
|
+
const f = h - Math.floor(h);
|
|
5330
|
+
const p = 255 * v * (1 - s);
|
|
5331
|
+
const q = 255 * v * (1 - s * f);
|
|
5332
|
+
const t = 255 * v * (1 - s * (1 - f));
|
|
5333
|
+
v *= 255;
|
|
5334
|
+
switch (hi) {
|
|
5335
|
+
case 0:
|
|
5336
|
+
return [v, t, p];
|
|
5337
|
+
case 1:
|
|
5338
|
+
return [q, v, p];
|
|
5339
|
+
case 2:
|
|
5340
|
+
return [p, v, t];
|
|
5341
|
+
case 3:
|
|
5342
|
+
return [p, q, v];
|
|
5343
|
+
case 4:
|
|
5344
|
+
return [t, p, v];
|
|
5345
|
+
case 5:
|
|
5346
|
+
return [v, p, q];
|
|
5347
|
+
}
|
|
5348
|
+
};
|
|
5349
|
+
convert.hsv.hsl = function(hsv) {
|
|
5350
|
+
const h = hsv[0];
|
|
5351
|
+
const s = hsv[1] / 100;
|
|
5352
|
+
const v = hsv[2] / 100;
|
|
5353
|
+
const vmin = Math.max(v, 0.01);
|
|
5354
|
+
let sl;
|
|
5355
|
+
let l;
|
|
5356
|
+
l = (2 - s) * v;
|
|
5357
|
+
const lmin = (2 - s) * vmin;
|
|
5358
|
+
sl = s * vmin;
|
|
5359
|
+
sl /= lmin <= 1 ? lmin : 2 - lmin;
|
|
5360
|
+
sl = sl || 0;
|
|
5361
|
+
l /= 2;
|
|
5362
|
+
return [h, sl * 100, l * 100];
|
|
5363
|
+
};
|
|
5364
|
+
convert.hwb.rgb = function(hwb) {
|
|
5365
|
+
const h = hwb[0] / 360;
|
|
5366
|
+
let wh = hwb[1] / 100;
|
|
5367
|
+
let bl = hwb[2] / 100;
|
|
5368
|
+
const ratio = wh + bl;
|
|
5369
|
+
let f;
|
|
5370
|
+
if (ratio > 1) {
|
|
5371
|
+
wh /= ratio;
|
|
5372
|
+
bl /= ratio;
|
|
5373
|
+
}
|
|
5374
|
+
const i = Math.floor(6 * h);
|
|
5375
|
+
const v = 1 - bl;
|
|
5376
|
+
f = 6 * h - i;
|
|
5377
|
+
if ((i & 1) !== 0) {
|
|
5378
|
+
f = 1 - f;
|
|
5379
|
+
}
|
|
5380
|
+
const n = wh + f * (v - wh);
|
|
5381
|
+
let r;
|
|
5382
|
+
let g;
|
|
5383
|
+
let b;
|
|
5384
|
+
switch (i) {
|
|
5385
|
+
default:
|
|
5386
|
+
case 6:
|
|
5387
|
+
case 0:
|
|
5388
|
+
r = v;
|
|
5389
|
+
g = n;
|
|
5390
|
+
b = wh;
|
|
5391
|
+
break;
|
|
5392
|
+
case 1:
|
|
5393
|
+
r = n;
|
|
5394
|
+
g = v;
|
|
5395
|
+
b = wh;
|
|
5396
|
+
break;
|
|
5397
|
+
case 2:
|
|
5398
|
+
r = wh;
|
|
5399
|
+
g = v;
|
|
5400
|
+
b = n;
|
|
5401
|
+
break;
|
|
5402
|
+
case 3:
|
|
5403
|
+
r = wh;
|
|
5404
|
+
g = n;
|
|
5405
|
+
b = v;
|
|
5406
|
+
break;
|
|
5407
|
+
case 4:
|
|
5408
|
+
r = n;
|
|
5409
|
+
g = wh;
|
|
5410
|
+
b = v;
|
|
5411
|
+
break;
|
|
5412
|
+
case 5:
|
|
5413
|
+
r = v;
|
|
5414
|
+
g = wh;
|
|
5415
|
+
b = n;
|
|
5416
|
+
break;
|
|
5417
|
+
}
|
|
5418
|
+
return [r * 255, g * 255, b * 255];
|
|
5419
|
+
};
|
|
5420
|
+
convert.cmyk.rgb = function(cmyk) {
|
|
5421
|
+
const c = cmyk[0] / 100;
|
|
5422
|
+
const m = cmyk[1] / 100;
|
|
5423
|
+
const y = cmyk[2] / 100;
|
|
5424
|
+
const k = cmyk[3] / 100;
|
|
5425
|
+
const r = 1 - Math.min(1, c * (1 - k) + k);
|
|
5426
|
+
const g = 1 - Math.min(1, m * (1 - k) + k);
|
|
5427
|
+
const b = 1 - Math.min(1, y * (1 - k) + k);
|
|
5428
|
+
return [r * 255, g * 255, b * 255];
|
|
5429
|
+
};
|
|
5430
|
+
convert.xyz.rgb = function(xyz) {
|
|
5431
|
+
const x = xyz[0] / 100;
|
|
5432
|
+
const y = xyz[1] / 100;
|
|
5433
|
+
const z = xyz[2] / 100;
|
|
5434
|
+
let r;
|
|
5435
|
+
let g;
|
|
5436
|
+
let b;
|
|
5437
|
+
r = x * 3.2406 + y * -1.5372 + z * -0.4986;
|
|
5438
|
+
g = x * -0.9689 + y * 1.8758 + z * 0.0415;
|
|
5439
|
+
b = x * 0.0557 + y * -0.204 + z * 1.057;
|
|
5440
|
+
r = r > 31308e-7 ? 1.055 * r ** (1 / 2.4) - 0.055 : r * 12.92;
|
|
5441
|
+
g = g > 31308e-7 ? 1.055 * g ** (1 / 2.4) - 0.055 : g * 12.92;
|
|
5442
|
+
b = b > 31308e-7 ? 1.055 * b ** (1 / 2.4) - 0.055 : b * 12.92;
|
|
5443
|
+
r = Math.min(Math.max(0, r), 1);
|
|
5444
|
+
g = Math.min(Math.max(0, g), 1);
|
|
5445
|
+
b = Math.min(Math.max(0, b), 1);
|
|
5446
|
+
return [r * 255, g * 255, b * 255];
|
|
5447
|
+
};
|
|
5448
|
+
convert.xyz.lab = function(xyz) {
|
|
5449
|
+
let x = xyz[0];
|
|
5450
|
+
let y = xyz[1];
|
|
5451
|
+
let z = xyz[2];
|
|
5452
|
+
x /= 95.047;
|
|
5453
|
+
y /= 100;
|
|
5454
|
+
z /= 108.883;
|
|
5455
|
+
x = x > 8856e-6 ? x ** (1 / 3) : 7.787 * x + 16 / 116;
|
|
5456
|
+
y = y > 8856e-6 ? y ** (1 / 3) : 7.787 * y + 16 / 116;
|
|
5457
|
+
z = z > 8856e-6 ? z ** (1 / 3) : 7.787 * z + 16 / 116;
|
|
5458
|
+
const l = 116 * y - 16;
|
|
5459
|
+
const a = 500 * (x - y);
|
|
5460
|
+
const b = 200 * (y - z);
|
|
5461
|
+
return [l, a, b];
|
|
5462
|
+
};
|
|
5463
|
+
convert.lab.xyz = function(lab) {
|
|
5464
|
+
const l = lab[0];
|
|
5465
|
+
const a = lab[1];
|
|
5466
|
+
const b = lab[2];
|
|
5467
|
+
let x;
|
|
5468
|
+
let y;
|
|
5469
|
+
let z;
|
|
5470
|
+
y = (l + 16) / 116;
|
|
5471
|
+
x = a / 500 + y;
|
|
5472
|
+
z = y - b / 200;
|
|
5473
|
+
const y2 = y ** 3;
|
|
5474
|
+
const x2 = x ** 3;
|
|
5475
|
+
const z2 = z ** 3;
|
|
5476
|
+
y = y2 > 8856e-6 ? y2 : (y - 16 / 116) / 7.787;
|
|
5477
|
+
x = x2 > 8856e-6 ? x2 : (x - 16 / 116) / 7.787;
|
|
5478
|
+
z = z2 > 8856e-6 ? z2 : (z - 16 / 116) / 7.787;
|
|
5479
|
+
x *= 95.047;
|
|
5480
|
+
y *= 100;
|
|
5481
|
+
z *= 108.883;
|
|
5482
|
+
return [x, y, z];
|
|
5483
|
+
};
|
|
5484
|
+
convert.lab.lch = function(lab) {
|
|
5485
|
+
const l = lab[0];
|
|
5486
|
+
const a = lab[1];
|
|
5487
|
+
const b = lab[2];
|
|
5488
|
+
let h;
|
|
5489
|
+
const hr = Math.atan2(b, a);
|
|
5490
|
+
h = hr * 360 / 2 / Math.PI;
|
|
5491
|
+
if (h < 0) {
|
|
5492
|
+
h += 360;
|
|
5493
|
+
}
|
|
5494
|
+
const c = Math.sqrt(a * a + b * b);
|
|
5495
|
+
return [l, c, h];
|
|
5496
|
+
};
|
|
5497
|
+
convert.lch.lab = function(lch) {
|
|
5498
|
+
const l = lch[0];
|
|
5499
|
+
const c = lch[1];
|
|
5500
|
+
const h = lch[2];
|
|
5501
|
+
const hr = h / 360 * 2 * Math.PI;
|
|
5502
|
+
const a = c * Math.cos(hr);
|
|
5503
|
+
const b = c * Math.sin(hr);
|
|
5504
|
+
return [l, a, b];
|
|
5505
|
+
};
|
|
5506
|
+
convert.rgb.ansi16 = function(args, saturation = null) {
|
|
5507
|
+
const [r, g, b] = args;
|
|
5508
|
+
let value = saturation === null ? convert.rgb.hsv(args)[2] : saturation;
|
|
5509
|
+
value = Math.round(value / 50);
|
|
5510
|
+
if (value === 0) {
|
|
5511
|
+
return 30;
|
|
5512
|
+
}
|
|
5513
|
+
let ansi = 30 + (Math.round(b / 255) << 2 | Math.round(g / 255) << 1 | Math.round(r / 255));
|
|
5514
|
+
if (value === 2) {
|
|
5515
|
+
ansi += 60;
|
|
5516
|
+
}
|
|
5517
|
+
return ansi;
|
|
5518
|
+
};
|
|
5519
|
+
convert.hsv.ansi16 = function(args) {
|
|
5520
|
+
return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
|
|
5521
|
+
};
|
|
5522
|
+
convert.rgb.ansi256 = function(args) {
|
|
5523
|
+
const r = args[0];
|
|
5524
|
+
const g = args[1];
|
|
5525
|
+
const b = args[2];
|
|
5526
|
+
if (r === g && g === b) {
|
|
5527
|
+
if (r < 8) {
|
|
5528
|
+
return 16;
|
|
5529
|
+
}
|
|
5530
|
+
if (r > 248) {
|
|
5531
|
+
return 231;
|
|
5532
|
+
}
|
|
5533
|
+
return Math.round((r - 8) / 247 * 24) + 232;
|
|
5534
|
+
}
|
|
5535
|
+
const ansi = 16 + 36 * Math.round(r / 255 * 5) + 6 * Math.round(g / 255 * 5) + Math.round(b / 255 * 5);
|
|
5536
|
+
return ansi;
|
|
5537
|
+
};
|
|
5538
|
+
convert.ansi16.rgb = function(args) {
|
|
5539
|
+
let color = args % 10;
|
|
5540
|
+
if (color === 0 || color === 7) {
|
|
5541
|
+
if (args > 50) {
|
|
5542
|
+
color += 3.5;
|
|
5543
|
+
}
|
|
5544
|
+
color = color / 10.5 * 255;
|
|
5545
|
+
return [color, color, color];
|
|
5546
|
+
}
|
|
5547
|
+
const mult = (~~(args > 50) + 1) * 0.5;
|
|
5548
|
+
const r = (color & 1) * mult * 255;
|
|
5549
|
+
const g = (color >> 1 & 1) * mult * 255;
|
|
5550
|
+
const b = (color >> 2 & 1) * mult * 255;
|
|
5551
|
+
return [r, g, b];
|
|
5552
|
+
};
|
|
5553
|
+
convert.ansi256.rgb = function(args) {
|
|
5554
|
+
if (args >= 232) {
|
|
5555
|
+
const c = (args - 232) * 10 + 8;
|
|
5556
|
+
return [c, c, c];
|
|
5557
|
+
}
|
|
5558
|
+
args -= 16;
|
|
5559
|
+
let rem;
|
|
5560
|
+
const r = Math.floor(args / 36) / 5 * 255;
|
|
5561
|
+
const g = Math.floor((rem = args % 36) / 6) / 5 * 255;
|
|
5562
|
+
const b = rem % 6 / 5 * 255;
|
|
5563
|
+
return [r, g, b];
|
|
5564
|
+
};
|
|
5565
|
+
convert.rgb.hex = function(args) {
|
|
5566
|
+
const integer = ((Math.round(args[0]) & 255) << 16) + ((Math.round(args[1]) & 255) << 8) + (Math.round(args[2]) & 255);
|
|
5567
|
+
const string = integer.toString(16).toUpperCase();
|
|
5568
|
+
return "000000".substring(string.length) + string;
|
|
5569
|
+
};
|
|
5570
|
+
convert.hex.rgb = function(args) {
|
|
5571
|
+
const match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
|
|
5572
|
+
if (!match) {
|
|
5573
|
+
return [0, 0, 0];
|
|
5574
|
+
}
|
|
5575
|
+
let colorString = match[0];
|
|
5576
|
+
if (match[0].length === 3) {
|
|
5577
|
+
colorString = colorString.split("").map((char) => {
|
|
5578
|
+
return char + char;
|
|
5579
|
+
}).join("");
|
|
5580
|
+
}
|
|
5581
|
+
const integer = parseInt(colorString, 16);
|
|
5582
|
+
const r = integer >> 16 & 255;
|
|
5583
|
+
const g = integer >> 8 & 255;
|
|
5584
|
+
const b = integer & 255;
|
|
5585
|
+
return [r, g, b];
|
|
5586
|
+
};
|
|
5587
|
+
convert.rgb.hcg = function(rgb) {
|
|
5588
|
+
const r = rgb[0] / 255;
|
|
5589
|
+
const g = rgb[1] / 255;
|
|
5590
|
+
const b = rgb[2] / 255;
|
|
5591
|
+
const max = Math.max(Math.max(r, g), b);
|
|
5592
|
+
const min = Math.min(Math.min(r, g), b);
|
|
5593
|
+
const chroma = max - min;
|
|
5594
|
+
let grayscale;
|
|
5595
|
+
let hue;
|
|
5596
|
+
if (chroma < 1) {
|
|
5597
|
+
grayscale = min / (1 - chroma);
|
|
5598
|
+
} else {
|
|
5599
|
+
grayscale = 0;
|
|
5600
|
+
}
|
|
5601
|
+
if (chroma <= 0) {
|
|
5602
|
+
hue = 0;
|
|
5603
|
+
} else if (max === r) {
|
|
5604
|
+
hue = (g - b) / chroma % 6;
|
|
5605
|
+
} else if (max === g) {
|
|
5606
|
+
hue = 2 + (b - r) / chroma;
|
|
5607
|
+
} else {
|
|
5608
|
+
hue = 4 + (r - g) / chroma;
|
|
5609
|
+
}
|
|
5610
|
+
hue /= 6;
|
|
5611
|
+
hue %= 1;
|
|
5612
|
+
return [hue * 360, chroma * 100, grayscale * 100];
|
|
5613
|
+
};
|
|
5614
|
+
convert.hsl.hcg = function(hsl) {
|
|
5615
|
+
const s = hsl[1] / 100;
|
|
5616
|
+
const l = hsl[2] / 100;
|
|
5617
|
+
const c = l < 0.5 ? 2 * s * l : 2 * s * (1 - l);
|
|
5618
|
+
let f = 0;
|
|
5619
|
+
if (c < 1) {
|
|
5620
|
+
f = (l - 0.5 * c) / (1 - c);
|
|
5621
|
+
}
|
|
5622
|
+
return [hsl[0], c * 100, f * 100];
|
|
5623
|
+
};
|
|
5624
|
+
convert.hsv.hcg = function(hsv) {
|
|
5625
|
+
const s = hsv[1] / 100;
|
|
5626
|
+
const v = hsv[2] / 100;
|
|
5627
|
+
const c = s * v;
|
|
5628
|
+
let f = 0;
|
|
5629
|
+
if (c < 1) {
|
|
5630
|
+
f = (v - c) / (1 - c);
|
|
5631
|
+
}
|
|
5632
|
+
return [hsv[0], c * 100, f * 100];
|
|
5633
|
+
};
|
|
5634
|
+
convert.hcg.rgb = function(hcg) {
|
|
5635
|
+
const h = hcg[0] / 360;
|
|
5636
|
+
const c = hcg[1] / 100;
|
|
5637
|
+
const g = hcg[2] / 100;
|
|
5638
|
+
if (c === 0) {
|
|
5639
|
+
return [g * 255, g * 255, g * 255];
|
|
5640
|
+
}
|
|
5641
|
+
const pure = [0, 0, 0];
|
|
5642
|
+
const hi = h % 1 * 6;
|
|
5643
|
+
const v = hi % 1;
|
|
5644
|
+
const w = 1 - v;
|
|
5645
|
+
let mg = 0;
|
|
5646
|
+
switch (Math.floor(hi)) {
|
|
5647
|
+
case 0:
|
|
5648
|
+
pure[0] = 1;
|
|
5649
|
+
pure[1] = v;
|
|
5650
|
+
pure[2] = 0;
|
|
5651
|
+
break;
|
|
5652
|
+
case 1:
|
|
5653
|
+
pure[0] = w;
|
|
5654
|
+
pure[1] = 1;
|
|
5655
|
+
pure[2] = 0;
|
|
5656
|
+
break;
|
|
5657
|
+
case 2:
|
|
5658
|
+
pure[0] = 0;
|
|
5659
|
+
pure[1] = 1;
|
|
5660
|
+
pure[2] = v;
|
|
5661
|
+
break;
|
|
5662
|
+
case 3:
|
|
5663
|
+
pure[0] = 0;
|
|
5664
|
+
pure[1] = w;
|
|
5665
|
+
pure[2] = 1;
|
|
5666
|
+
break;
|
|
5667
|
+
case 4:
|
|
5668
|
+
pure[0] = v;
|
|
5669
|
+
pure[1] = 0;
|
|
5670
|
+
pure[2] = 1;
|
|
5671
|
+
break;
|
|
5672
|
+
default:
|
|
5673
|
+
pure[0] = 1;
|
|
5674
|
+
pure[1] = 0;
|
|
5675
|
+
pure[2] = w;
|
|
5676
|
+
}
|
|
5677
|
+
mg = (1 - c) * g;
|
|
5678
|
+
return [
|
|
5679
|
+
(c * pure[0] + mg) * 255,
|
|
5680
|
+
(c * pure[1] + mg) * 255,
|
|
5681
|
+
(c * pure[2] + mg) * 255
|
|
5682
|
+
];
|
|
5683
|
+
};
|
|
5684
|
+
convert.hcg.hsv = function(hcg) {
|
|
5685
|
+
const c = hcg[1] / 100;
|
|
5686
|
+
const g = hcg[2] / 100;
|
|
5687
|
+
const v = c + g * (1 - c);
|
|
5688
|
+
let f = 0;
|
|
5689
|
+
if (v > 0) {
|
|
5690
|
+
f = c / v;
|
|
5691
|
+
}
|
|
5692
|
+
return [hcg[0], f * 100, v * 100];
|
|
5693
|
+
};
|
|
5694
|
+
convert.hcg.hsl = function(hcg) {
|
|
5695
|
+
const c = hcg[1] / 100;
|
|
5696
|
+
const g = hcg[2] / 100;
|
|
5697
|
+
const l = g * (1 - c) + 0.5 * c;
|
|
5698
|
+
let s = 0;
|
|
5699
|
+
if (l > 0 && l < 0.5) {
|
|
5700
|
+
s = c / (2 * l);
|
|
5701
|
+
} else if (l >= 0.5 && l < 1) {
|
|
5702
|
+
s = c / (2 * (1 - l));
|
|
5703
|
+
}
|
|
5704
|
+
return [hcg[0], s * 100, l * 100];
|
|
5705
|
+
};
|
|
5706
|
+
convert.hcg.hwb = function(hcg) {
|
|
5707
|
+
const c = hcg[1] / 100;
|
|
5708
|
+
const g = hcg[2] / 100;
|
|
5709
|
+
const v = c + g * (1 - c);
|
|
5710
|
+
return [hcg[0], (v - c) * 100, (1 - v) * 100];
|
|
5711
|
+
};
|
|
5712
|
+
convert.hwb.hcg = function(hwb) {
|
|
5713
|
+
const w = hwb[1] / 100;
|
|
5714
|
+
const b = hwb[2] / 100;
|
|
5715
|
+
const v = 1 - b;
|
|
5716
|
+
const c = v - w;
|
|
5717
|
+
let g = 0;
|
|
5718
|
+
if (c < 1) {
|
|
5719
|
+
g = (v - c) / (1 - c);
|
|
5720
|
+
}
|
|
5721
|
+
return [hwb[0], c * 100, g * 100];
|
|
5722
|
+
};
|
|
5723
|
+
convert.apple.rgb = function(apple) {
|
|
5724
|
+
return [apple[0] / 65535 * 255, apple[1] / 65535 * 255, apple[2] / 65535 * 255];
|
|
5725
|
+
};
|
|
5726
|
+
convert.rgb.apple = function(rgb) {
|
|
5727
|
+
return [rgb[0] / 255 * 65535, rgb[1] / 255 * 65535, rgb[2] / 255 * 65535];
|
|
5728
|
+
};
|
|
5729
|
+
convert.gray.rgb = function(args) {
|
|
5730
|
+
return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
|
|
5731
|
+
};
|
|
5732
|
+
convert.gray.hsl = function(args) {
|
|
5733
|
+
return [0, 0, args[0]];
|
|
5734
|
+
};
|
|
5735
|
+
convert.gray.hsv = convert.gray.hsl;
|
|
5736
|
+
convert.gray.hwb = function(gray) {
|
|
5737
|
+
return [0, 100, gray[0]];
|
|
5738
|
+
};
|
|
5739
|
+
convert.gray.cmyk = function(gray) {
|
|
5740
|
+
return [0, 0, 0, gray[0]];
|
|
5741
|
+
};
|
|
5742
|
+
convert.gray.lab = function(gray) {
|
|
5743
|
+
return [gray[0], 0, 0];
|
|
5744
|
+
};
|
|
5745
|
+
convert.gray.hex = function(gray) {
|
|
5746
|
+
const val = Math.round(gray[0] / 100 * 255) & 255;
|
|
5747
|
+
const integer = (val << 16) + (val << 8) + val;
|
|
5748
|
+
const string = integer.toString(16).toUpperCase();
|
|
5749
|
+
return "000000".substring(string.length) + string;
|
|
5750
|
+
};
|
|
5751
|
+
convert.rgb.gray = function(rgb) {
|
|
5752
|
+
const val = (rgb[0] + rgb[1] + rgb[2]) / 3;
|
|
5753
|
+
return [val / 255 * 100];
|
|
5754
|
+
};
|
|
5755
|
+
return conversions;
|
|
5756
|
+
}
|
|
5757
|
+
var route;
|
|
5758
|
+
var hasRequiredRoute;
|
|
5759
|
+
function requireRoute() {
|
|
5760
|
+
if (hasRequiredRoute) return route;
|
|
5761
|
+
hasRequiredRoute = 1;
|
|
5762
|
+
const conversions2 = requireConversions();
|
|
5763
|
+
function buildGraph() {
|
|
5764
|
+
const graph = {};
|
|
5765
|
+
const models = Object.keys(conversions2);
|
|
5766
|
+
for (let len = models.length, i = 0; i < len; i++) {
|
|
5767
|
+
graph[models[i]] = {
|
|
5768
|
+
// http://jsperf.com/1-vs-infinity
|
|
5769
|
+
// micro-opt, but this is simple.
|
|
5770
|
+
distance: -1,
|
|
5771
|
+
parent: null
|
|
5772
|
+
};
|
|
5773
|
+
}
|
|
5774
|
+
return graph;
|
|
5775
|
+
}
|
|
5776
|
+
function deriveBFS(fromModel) {
|
|
5777
|
+
const graph = buildGraph();
|
|
5778
|
+
const queue = [fromModel];
|
|
5779
|
+
graph[fromModel].distance = 0;
|
|
5780
|
+
while (queue.length) {
|
|
5781
|
+
const current = queue.pop();
|
|
5782
|
+
const adjacents = Object.keys(conversions2[current]);
|
|
5783
|
+
for (let len = adjacents.length, i = 0; i < len; i++) {
|
|
5784
|
+
const adjacent = adjacents[i];
|
|
5785
|
+
const node = graph[adjacent];
|
|
5786
|
+
if (node.distance === -1) {
|
|
5787
|
+
node.distance = graph[current].distance + 1;
|
|
5788
|
+
node.parent = current;
|
|
5789
|
+
queue.unshift(adjacent);
|
|
5790
|
+
}
|
|
5791
|
+
}
|
|
5792
|
+
}
|
|
5793
|
+
return graph;
|
|
5794
|
+
}
|
|
5795
|
+
function link(from, to) {
|
|
5796
|
+
return function(args) {
|
|
5797
|
+
return to(from(args));
|
|
5798
|
+
};
|
|
5799
|
+
}
|
|
5800
|
+
function wrapConversion(toModel, graph) {
|
|
5801
|
+
const path2 = [graph[toModel].parent, toModel];
|
|
5802
|
+
let fn = conversions2[graph[toModel].parent][toModel];
|
|
5803
|
+
let cur = graph[toModel].parent;
|
|
5804
|
+
while (graph[cur].parent) {
|
|
5805
|
+
path2.unshift(graph[cur].parent);
|
|
5806
|
+
fn = link(conversions2[graph[cur].parent][cur], fn);
|
|
5807
|
+
cur = graph[cur].parent;
|
|
5808
|
+
}
|
|
5809
|
+
fn.conversion = path2;
|
|
5810
|
+
return fn;
|
|
5811
|
+
}
|
|
5812
|
+
route = function(fromModel) {
|
|
5813
|
+
const graph = deriveBFS(fromModel);
|
|
5814
|
+
const conversion = {};
|
|
5815
|
+
const models = Object.keys(graph);
|
|
5816
|
+
for (let len = models.length, i = 0; i < len; i++) {
|
|
5817
|
+
const toModel = models[i];
|
|
5818
|
+
const node = graph[toModel];
|
|
5819
|
+
if (node.parent === null) {
|
|
5820
|
+
continue;
|
|
5821
|
+
}
|
|
5822
|
+
conversion[toModel] = wrapConversion(toModel, graph);
|
|
5823
|
+
}
|
|
5824
|
+
return conversion;
|
|
5825
|
+
};
|
|
5826
|
+
return route;
|
|
5827
|
+
}
|
|
5828
|
+
var colorConvert;
|
|
5829
|
+
var hasRequiredColorConvert;
|
|
5830
|
+
function requireColorConvert() {
|
|
5831
|
+
if (hasRequiredColorConvert) return colorConvert;
|
|
5832
|
+
hasRequiredColorConvert = 1;
|
|
5833
|
+
const conversions2 = requireConversions();
|
|
5834
|
+
const route2 = requireRoute();
|
|
5835
|
+
const convert = {};
|
|
5836
|
+
const models = Object.keys(conversions2);
|
|
5837
|
+
function wrapRaw(fn) {
|
|
5838
|
+
const wrappedFn = function(...args) {
|
|
5839
|
+
const arg0 = args[0];
|
|
5840
|
+
if (arg0 === void 0 || arg0 === null) {
|
|
5841
|
+
return arg0;
|
|
5842
|
+
}
|
|
5843
|
+
if (arg0.length > 1) {
|
|
5844
|
+
args = arg0;
|
|
5845
|
+
}
|
|
5846
|
+
return fn(args);
|
|
5847
|
+
};
|
|
5848
|
+
if ("conversion" in fn) {
|
|
5849
|
+
wrappedFn.conversion = fn.conversion;
|
|
5850
|
+
}
|
|
5851
|
+
return wrappedFn;
|
|
5852
|
+
}
|
|
5853
|
+
function wrapRounded(fn) {
|
|
5854
|
+
const wrappedFn = function(...args) {
|
|
5855
|
+
const arg0 = args[0];
|
|
5856
|
+
if (arg0 === void 0 || arg0 === null) {
|
|
5857
|
+
return arg0;
|
|
5858
|
+
}
|
|
5859
|
+
if (arg0.length > 1) {
|
|
5860
|
+
args = arg0;
|
|
5861
|
+
}
|
|
5862
|
+
const result = fn(args);
|
|
5863
|
+
if (typeof result === "object") {
|
|
5864
|
+
for (let len = result.length, i = 0; i < len; i++) {
|
|
5865
|
+
result[i] = Math.round(result[i]);
|
|
5866
|
+
}
|
|
5867
|
+
}
|
|
5868
|
+
return result;
|
|
5869
|
+
};
|
|
5870
|
+
if ("conversion" in fn) {
|
|
5871
|
+
wrappedFn.conversion = fn.conversion;
|
|
5872
|
+
}
|
|
5873
|
+
return wrappedFn;
|
|
5874
|
+
}
|
|
5875
|
+
models.forEach((fromModel) => {
|
|
5876
|
+
convert[fromModel] = {};
|
|
5877
|
+
Object.defineProperty(convert[fromModel], "channels", { value: conversions2[fromModel].channels });
|
|
5878
|
+
Object.defineProperty(convert[fromModel], "labels", { value: conversions2[fromModel].labels });
|
|
5879
|
+
const routes = route2(fromModel);
|
|
5880
|
+
const routeModels = Object.keys(routes);
|
|
5881
|
+
routeModels.forEach((toModel) => {
|
|
5882
|
+
const fn = routes[toModel];
|
|
5883
|
+
convert[fromModel][toModel] = wrapRounded(fn);
|
|
5884
|
+
convert[fromModel][toModel].raw = wrapRaw(fn);
|
|
5885
|
+
});
|
|
5886
|
+
});
|
|
5887
|
+
colorConvert = convert;
|
|
5888
|
+
return colorConvert;
|
|
5889
|
+
}
|
|
5890
|
+
ansiStyles$1.exports;
|
|
5891
|
+
(function(module) {
|
|
5892
|
+
const wrapAnsi16 = (fn, offset) => (...args) => {
|
|
5893
|
+
const code = fn(...args);
|
|
5894
|
+
return `\x1B[${code + offset}m`;
|
|
5895
|
+
};
|
|
5896
|
+
const wrapAnsi256 = (fn, offset) => (...args) => {
|
|
5897
|
+
const code = fn(...args);
|
|
5898
|
+
return `\x1B[${38 + offset};5;${code}m`;
|
|
5899
|
+
};
|
|
5900
|
+
const wrapAnsi16m = (fn, offset) => (...args) => {
|
|
5901
|
+
const rgb = fn(...args);
|
|
5902
|
+
return `\x1B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
|
|
5903
|
+
};
|
|
5904
|
+
const ansi2ansi = (n) => n;
|
|
5905
|
+
const rgb2rgb = (r, g, b) => [r, g, b];
|
|
5906
|
+
const setLazyProperty = (object, property, get) => {
|
|
5907
|
+
Object.defineProperty(object, property, {
|
|
5908
|
+
get: () => {
|
|
5909
|
+
const value = get();
|
|
5910
|
+
Object.defineProperty(object, property, {
|
|
5911
|
+
value,
|
|
5912
|
+
enumerable: true,
|
|
5913
|
+
configurable: true
|
|
5914
|
+
});
|
|
5915
|
+
return value;
|
|
5916
|
+
},
|
|
5917
|
+
enumerable: true,
|
|
5918
|
+
configurable: true
|
|
5919
|
+
});
|
|
5920
|
+
};
|
|
5921
|
+
let colorConvert2;
|
|
5922
|
+
const makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => {
|
|
5923
|
+
if (colorConvert2 === void 0) {
|
|
5924
|
+
colorConvert2 = requireColorConvert();
|
|
5925
|
+
}
|
|
5926
|
+
const offset = isBackground ? 10 : 0;
|
|
5927
|
+
const styles2 = {};
|
|
5928
|
+
for (const [sourceSpace, suite] of Object.entries(colorConvert2)) {
|
|
5929
|
+
const name2 = sourceSpace === "ansi16" ? "ansi" : sourceSpace;
|
|
5930
|
+
if (sourceSpace === targetSpace) {
|
|
5931
|
+
styles2[name2] = wrap(identity, offset);
|
|
5932
|
+
} else if (typeof suite === "object") {
|
|
5933
|
+
styles2[name2] = wrap(suite[targetSpace], offset);
|
|
5934
|
+
}
|
|
5935
|
+
}
|
|
5936
|
+
return styles2;
|
|
5937
|
+
};
|
|
5938
|
+
function assembleStyles() {
|
|
5939
|
+
const codes = /* @__PURE__ */ new Map();
|
|
5940
|
+
const styles2 = {
|
|
5941
|
+
modifier: {
|
|
5942
|
+
reset: [0, 0],
|
|
5943
|
+
// 21 isn't widely supported and 22 does the same thing
|
|
5944
|
+
bold: [1, 22],
|
|
5945
|
+
dim: [2, 22],
|
|
5946
|
+
italic: [3, 23],
|
|
5947
|
+
underline: [4, 24],
|
|
5948
|
+
inverse: [7, 27],
|
|
5949
|
+
hidden: [8, 28],
|
|
5950
|
+
strikethrough: [9, 29]
|
|
5951
|
+
},
|
|
5952
|
+
color: {
|
|
5953
|
+
black: [30, 39],
|
|
5954
|
+
red: [31, 39],
|
|
5955
|
+
green: [32, 39],
|
|
5956
|
+
yellow: [33, 39],
|
|
5957
|
+
blue: [34, 39],
|
|
5958
|
+
magenta: [35, 39],
|
|
5959
|
+
cyan: [36, 39],
|
|
5960
|
+
white: [37, 39],
|
|
5961
|
+
// Bright color
|
|
5962
|
+
blackBright: [90, 39],
|
|
5963
|
+
redBright: [91, 39],
|
|
5964
|
+
greenBright: [92, 39],
|
|
5965
|
+
yellowBright: [93, 39],
|
|
5966
|
+
blueBright: [94, 39],
|
|
5967
|
+
magentaBright: [95, 39],
|
|
5968
|
+
cyanBright: [96, 39],
|
|
5969
|
+
whiteBright: [97, 39]
|
|
5970
|
+
},
|
|
5971
|
+
bgColor: {
|
|
5972
|
+
bgBlack: [40, 49],
|
|
5973
|
+
bgRed: [41, 49],
|
|
5974
|
+
bgGreen: [42, 49],
|
|
5975
|
+
bgYellow: [43, 49],
|
|
5976
|
+
bgBlue: [44, 49],
|
|
5977
|
+
bgMagenta: [45, 49],
|
|
5978
|
+
bgCyan: [46, 49],
|
|
5979
|
+
bgWhite: [47, 49],
|
|
5980
|
+
// Bright color
|
|
5981
|
+
bgBlackBright: [100, 49],
|
|
5982
|
+
bgRedBright: [101, 49],
|
|
5983
|
+
bgGreenBright: [102, 49],
|
|
5984
|
+
bgYellowBright: [103, 49],
|
|
5985
|
+
bgBlueBright: [104, 49],
|
|
5986
|
+
bgMagentaBright: [105, 49],
|
|
5987
|
+
bgCyanBright: [106, 49],
|
|
5988
|
+
bgWhiteBright: [107, 49]
|
|
5989
|
+
}
|
|
5990
|
+
};
|
|
5991
|
+
styles2.color.gray = styles2.color.blackBright;
|
|
5992
|
+
styles2.bgColor.bgGray = styles2.bgColor.bgBlackBright;
|
|
5993
|
+
styles2.color.grey = styles2.color.blackBright;
|
|
5994
|
+
styles2.bgColor.bgGrey = styles2.bgColor.bgBlackBright;
|
|
5995
|
+
for (const [groupName, group] of Object.entries(styles2)) {
|
|
5996
|
+
for (const [styleName, style] of Object.entries(group)) {
|
|
5997
|
+
styles2[styleName] = {
|
|
5998
|
+
open: `\x1B[${style[0]}m`,
|
|
5999
|
+
close: `\x1B[${style[1]}m`
|
|
6000
|
+
};
|
|
6001
|
+
group[styleName] = styles2[styleName];
|
|
6002
|
+
codes.set(style[0], style[1]);
|
|
6003
|
+
}
|
|
6004
|
+
Object.defineProperty(styles2, groupName, {
|
|
6005
|
+
value: group,
|
|
6006
|
+
enumerable: false
|
|
6007
|
+
});
|
|
6008
|
+
}
|
|
6009
|
+
Object.defineProperty(styles2, "codes", {
|
|
6010
|
+
value: codes,
|
|
6011
|
+
enumerable: false
|
|
6012
|
+
});
|
|
6013
|
+
styles2.color.close = "\x1B[39m";
|
|
6014
|
+
styles2.bgColor.close = "\x1B[49m";
|
|
6015
|
+
setLazyProperty(styles2.color, "ansi", () => makeDynamicStyles(wrapAnsi16, "ansi16", ansi2ansi, false));
|
|
6016
|
+
setLazyProperty(styles2.color, "ansi256", () => makeDynamicStyles(wrapAnsi256, "ansi256", ansi2ansi, false));
|
|
6017
|
+
setLazyProperty(styles2.color, "ansi16m", () => makeDynamicStyles(wrapAnsi16m, "rgb", rgb2rgb, false));
|
|
6018
|
+
setLazyProperty(styles2.bgColor, "ansi", () => makeDynamicStyles(wrapAnsi16, "ansi16", ansi2ansi, true));
|
|
6019
|
+
setLazyProperty(styles2.bgColor, "ansi256", () => makeDynamicStyles(wrapAnsi256, "ansi256", ansi2ansi, true));
|
|
6020
|
+
setLazyProperty(styles2.bgColor, "ansi16m", () => makeDynamicStyles(wrapAnsi16m, "rgb", rgb2rgb, true));
|
|
6021
|
+
return styles2;
|
|
6022
|
+
}
|
|
6023
|
+
Object.defineProperty(module, "exports", {
|
|
6024
|
+
enumerable: true,
|
|
6025
|
+
get: assembleStyles
|
|
6026
|
+
});
|
|
6027
|
+
})(ansiStyles$1);
|
|
6028
|
+
var ansiStylesExports = ansiStyles$1.exports;
|
|
6029
|
+
var browser = {
|
|
6030
|
+
stdout: false,
|
|
6031
|
+
stderr: false
|
|
6032
|
+
};
|
|
6033
|
+
const stringReplaceAll$1 = (string, substring, replacer) => {
|
|
6034
|
+
let index = string.indexOf(substring);
|
|
6035
|
+
if (index === -1) {
|
|
6036
|
+
return string;
|
|
6037
|
+
}
|
|
6038
|
+
const substringLength = substring.length;
|
|
6039
|
+
let endIndex = 0;
|
|
6040
|
+
let returnValue = "";
|
|
6041
|
+
do {
|
|
6042
|
+
returnValue += string.substr(endIndex, index - endIndex) + substring + replacer;
|
|
6043
|
+
endIndex = index + substringLength;
|
|
6044
|
+
index = string.indexOf(substring, endIndex);
|
|
6045
|
+
} while (index !== -1);
|
|
6046
|
+
returnValue += string.substr(endIndex);
|
|
6047
|
+
return returnValue;
|
|
6048
|
+
};
|
|
6049
|
+
const stringEncaseCRLFWithFirstIndex$1 = (string, prefix, postfix, index) => {
|
|
6050
|
+
let endIndex = 0;
|
|
6051
|
+
let returnValue = "";
|
|
6052
|
+
do {
|
|
6053
|
+
const gotCR = string[index - 1] === "\r";
|
|
6054
|
+
returnValue += string.substr(endIndex, (gotCR ? index - 1 : index) - endIndex) + prefix + (gotCR ? "\r\n" : "\n") + postfix;
|
|
6055
|
+
endIndex = index + 1;
|
|
6056
|
+
index = string.indexOf("\n", endIndex);
|
|
6057
|
+
} while (index !== -1);
|
|
6058
|
+
returnValue += string.substr(endIndex);
|
|
6059
|
+
return returnValue;
|
|
6060
|
+
};
|
|
6061
|
+
var util = {
|
|
6062
|
+
stringReplaceAll: stringReplaceAll$1,
|
|
6063
|
+
stringEncaseCRLFWithFirstIndex: stringEncaseCRLFWithFirstIndex$1
|
|
6064
|
+
};
|
|
6065
|
+
var templates;
|
|
6066
|
+
var hasRequiredTemplates;
|
|
6067
|
+
function requireTemplates() {
|
|
6068
|
+
if (hasRequiredTemplates) return templates;
|
|
6069
|
+
hasRequiredTemplates = 1;
|
|
6070
|
+
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;
|
|
6071
|
+
const STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
|
|
6072
|
+
const STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;
|
|
6073
|
+
const ESCAPE_REGEX = /\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi;
|
|
6074
|
+
const ESCAPES = /* @__PURE__ */ new Map([
|
|
6075
|
+
["n", "\n"],
|
|
6076
|
+
["r", "\r"],
|
|
6077
|
+
["t", " "],
|
|
6078
|
+
["b", "\b"],
|
|
6079
|
+
["f", "\f"],
|
|
6080
|
+
["v", "\v"],
|
|
6081
|
+
["0", "\0"],
|
|
6082
|
+
["\\", "\\"],
|
|
6083
|
+
["e", "\x1B"],
|
|
6084
|
+
["a", "\x07"]
|
|
6085
|
+
]);
|
|
6086
|
+
function unescape(c) {
|
|
6087
|
+
const u = c[0] === "u";
|
|
6088
|
+
const bracket = c[1] === "{";
|
|
6089
|
+
if (u && !bracket && c.length === 5 || c[0] === "x" && c.length === 3) {
|
|
6090
|
+
return String.fromCharCode(parseInt(c.slice(1), 16));
|
|
6091
|
+
}
|
|
6092
|
+
if (u && bracket) {
|
|
6093
|
+
return String.fromCodePoint(parseInt(c.slice(2, -1), 16));
|
|
6094
|
+
}
|
|
6095
|
+
return ESCAPES.get(c) || c;
|
|
6096
|
+
}
|
|
6097
|
+
function parseArguments(name2, arguments_) {
|
|
6098
|
+
const results = [];
|
|
6099
|
+
const chunks = arguments_.trim().split(/\s*,\s*/g);
|
|
6100
|
+
let matches;
|
|
6101
|
+
for (const chunk of chunks) {
|
|
6102
|
+
const number = Number(chunk);
|
|
6103
|
+
if (!Number.isNaN(number)) {
|
|
6104
|
+
results.push(number);
|
|
6105
|
+
} else if (matches = chunk.match(STRING_REGEX)) {
|
|
6106
|
+
results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, character) => escape ? unescape(escape) : character));
|
|
6107
|
+
} else {
|
|
6108
|
+
throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name2}')`);
|
|
6109
|
+
}
|
|
6110
|
+
}
|
|
6111
|
+
return results;
|
|
6112
|
+
}
|
|
6113
|
+
function parseStyle(style) {
|
|
6114
|
+
STYLE_REGEX.lastIndex = 0;
|
|
6115
|
+
const results = [];
|
|
6116
|
+
let matches;
|
|
6117
|
+
while ((matches = STYLE_REGEX.exec(style)) !== null) {
|
|
6118
|
+
const name2 = matches[1];
|
|
6119
|
+
if (matches[2]) {
|
|
6120
|
+
const args = parseArguments(name2, matches[2]);
|
|
6121
|
+
results.push([name2].concat(args));
|
|
6122
|
+
} else {
|
|
6123
|
+
results.push([name2]);
|
|
6124
|
+
}
|
|
6125
|
+
}
|
|
6126
|
+
return results;
|
|
6127
|
+
}
|
|
6128
|
+
function buildStyle(chalk2, styles2) {
|
|
6129
|
+
const enabled = {};
|
|
6130
|
+
for (const layer of styles2) {
|
|
6131
|
+
for (const style of layer.styles) {
|
|
6132
|
+
enabled[style[0]] = layer.inverse ? null : style.slice(1);
|
|
6133
|
+
}
|
|
6134
|
+
}
|
|
6135
|
+
let current = chalk2;
|
|
6136
|
+
for (const [styleName, styles3] of Object.entries(enabled)) {
|
|
6137
|
+
if (!Array.isArray(styles3)) {
|
|
6138
|
+
continue;
|
|
6139
|
+
}
|
|
6140
|
+
if (!(styleName in current)) {
|
|
6141
|
+
throw new Error(`Unknown Chalk style: ${styleName}`);
|
|
6142
|
+
}
|
|
6143
|
+
current = styles3.length > 0 ? current[styleName](...styles3) : current[styleName];
|
|
6144
|
+
}
|
|
6145
|
+
return current;
|
|
6146
|
+
}
|
|
6147
|
+
templates = (chalk2, temporary) => {
|
|
6148
|
+
const styles2 = [];
|
|
6149
|
+
const chunks = [];
|
|
6150
|
+
let chunk = [];
|
|
6151
|
+
temporary.replace(TEMPLATE_REGEX, (m, escapeCharacter, inverse, style, close, character) => {
|
|
6152
|
+
if (escapeCharacter) {
|
|
6153
|
+
chunk.push(unescape(escapeCharacter));
|
|
6154
|
+
} else if (style) {
|
|
6155
|
+
const string = chunk.join("");
|
|
6156
|
+
chunk = [];
|
|
6157
|
+
chunks.push(styles2.length === 0 ? string : buildStyle(chalk2, styles2)(string));
|
|
6158
|
+
styles2.push({ inverse, styles: parseStyle(style) });
|
|
6159
|
+
} else if (close) {
|
|
6160
|
+
if (styles2.length === 0) {
|
|
6161
|
+
throw new Error("Found extraneous } in Chalk template literal");
|
|
6162
|
+
}
|
|
6163
|
+
chunks.push(buildStyle(chalk2, styles2)(chunk.join("")));
|
|
6164
|
+
chunk = [];
|
|
6165
|
+
styles2.pop();
|
|
6166
|
+
} else {
|
|
6167
|
+
chunk.push(character);
|
|
6168
|
+
}
|
|
6169
|
+
});
|
|
6170
|
+
chunks.push(chunk.join(""));
|
|
6171
|
+
if (styles2.length > 0) {
|
|
6172
|
+
const errMessage = `Chalk template literal is missing ${styles2.length} closing bracket${styles2.length === 1 ? "" : "s"} (\`}\`)`;
|
|
6173
|
+
throw new Error(errMessage);
|
|
6174
|
+
}
|
|
6175
|
+
return chunks.join("");
|
|
6176
|
+
};
|
|
6177
|
+
return templates;
|
|
6178
|
+
}
|
|
6179
|
+
const ansiStyles = ansiStylesExports;
|
|
6180
|
+
const { stdout: stdoutColor, stderr: stderrColor } = browser;
|
|
6181
|
+
const {
|
|
6182
|
+
stringReplaceAll,
|
|
6183
|
+
stringEncaseCRLFWithFirstIndex
|
|
6184
|
+
} = util;
|
|
6185
|
+
const { isArray } = Array;
|
|
6186
|
+
const levelMapping = [
|
|
6187
|
+
"ansi",
|
|
6188
|
+
"ansi",
|
|
6189
|
+
"ansi256",
|
|
6190
|
+
"ansi16m"
|
|
6191
|
+
];
|
|
6192
|
+
const styles = /* @__PURE__ */ Object.create(null);
|
|
6193
|
+
const applyOptions = (object, options = {}) => {
|
|
6194
|
+
if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
|
|
6195
|
+
throw new Error("The `level` option should be an integer from 0 to 3");
|
|
6196
|
+
}
|
|
6197
|
+
const colorLevel = stdoutColor ? stdoutColor.level : 0;
|
|
6198
|
+
object.level = options.level === void 0 ? colorLevel : options.level;
|
|
6199
|
+
};
|
|
6200
|
+
class ChalkClass2 {
|
|
6201
|
+
constructor(options) {
|
|
6202
|
+
return chalkFactory(options);
|
|
6203
|
+
}
|
|
6204
|
+
}
|
|
6205
|
+
const chalkFactory = (options) => {
|
|
6206
|
+
const chalk2 = {};
|
|
6207
|
+
applyOptions(chalk2, options);
|
|
6208
|
+
chalk2.template = (...arguments_) => chalkTag(chalk2.template, ...arguments_);
|
|
6209
|
+
Object.setPrototypeOf(chalk2, Chalk.prototype);
|
|
6210
|
+
Object.setPrototypeOf(chalk2.template, chalk2);
|
|
6211
|
+
chalk2.template.constructor = () => {
|
|
6212
|
+
throw new Error("`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.");
|
|
6213
|
+
};
|
|
6214
|
+
chalk2.template.Instance = ChalkClass2;
|
|
6215
|
+
return chalk2.template;
|
|
6216
|
+
};
|
|
6217
|
+
function Chalk(options) {
|
|
6218
|
+
return chalkFactory(options);
|
|
6219
|
+
}
|
|
6220
|
+
for (const [styleName, style] of Object.entries(ansiStyles)) {
|
|
6221
|
+
styles[styleName] = {
|
|
6222
|
+
get() {
|
|
6223
|
+
const builder = createBuilder(this, createStyler(style.open, style.close, this._styler), this._isEmpty);
|
|
6224
|
+
Object.defineProperty(this, styleName, { value: builder });
|
|
6225
|
+
return builder;
|
|
6226
|
+
}
|
|
6227
|
+
};
|
|
6228
|
+
}
|
|
6229
|
+
styles.visible = {
|
|
6230
|
+
get() {
|
|
6231
|
+
const builder = createBuilder(this, this._styler, true);
|
|
6232
|
+
Object.defineProperty(this, "visible", { value: builder });
|
|
6233
|
+
return builder;
|
|
6234
|
+
}
|
|
6235
|
+
};
|
|
6236
|
+
const usedModels = ["rgb", "hex", "keyword", "hsl", "hsv", "hwb", "ansi", "ansi256"];
|
|
6237
|
+
for (const model of usedModels) {
|
|
6238
|
+
styles[model] = {
|
|
6239
|
+
get() {
|
|
6240
|
+
const { level } = this;
|
|
6241
|
+
return function(...arguments_) {
|
|
6242
|
+
const styler = createStyler(ansiStyles.color[levelMapping[level]][model](...arguments_), ansiStyles.color.close, this._styler);
|
|
6243
|
+
return createBuilder(this, styler, this._isEmpty);
|
|
6244
|
+
};
|
|
6245
|
+
}
|
|
6246
|
+
};
|
|
6247
|
+
}
|
|
6248
|
+
for (const model of usedModels) {
|
|
6249
|
+
const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
|
|
6250
|
+
styles[bgModel] = {
|
|
6251
|
+
get() {
|
|
6252
|
+
const { level } = this;
|
|
6253
|
+
return function(...arguments_) {
|
|
6254
|
+
const styler = createStyler(ansiStyles.bgColor[levelMapping[level]][model](...arguments_), ansiStyles.bgColor.close, this._styler);
|
|
6255
|
+
return createBuilder(this, styler, this._isEmpty);
|
|
6256
|
+
};
|
|
6257
|
+
}
|
|
6258
|
+
};
|
|
6259
|
+
}
|
|
6260
|
+
const proto = Object.defineProperties(() => {
|
|
6261
|
+
}, {
|
|
6262
|
+
...styles,
|
|
6263
|
+
level: {
|
|
6264
|
+
enumerable: true,
|
|
6265
|
+
get() {
|
|
6266
|
+
return this._generator.level;
|
|
6267
|
+
},
|
|
6268
|
+
set(level) {
|
|
6269
|
+
this._generator.level = level;
|
|
6270
|
+
}
|
|
6271
|
+
}
|
|
6272
|
+
});
|
|
6273
|
+
const createStyler = (open, close, parent) => {
|
|
6274
|
+
let openAll;
|
|
6275
|
+
let closeAll;
|
|
6276
|
+
if (parent === void 0) {
|
|
6277
|
+
openAll = open;
|
|
6278
|
+
closeAll = close;
|
|
6279
|
+
} else {
|
|
6280
|
+
openAll = parent.openAll + open;
|
|
6281
|
+
closeAll = close + parent.closeAll;
|
|
6282
|
+
}
|
|
6283
|
+
return {
|
|
6284
|
+
open,
|
|
6285
|
+
close,
|
|
6286
|
+
openAll,
|
|
6287
|
+
closeAll,
|
|
6288
|
+
parent
|
|
6289
|
+
};
|
|
6290
|
+
};
|
|
6291
|
+
const createBuilder = (self2, _styler, _isEmpty) => {
|
|
6292
|
+
const builder = (...arguments_) => {
|
|
6293
|
+
if (isArray(arguments_[0]) && isArray(arguments_[0].raw)) {
|
|
6294
|
+
return applyStyle(builder, chalkTag(builder, ...arguments_));
|
|
6295
|
+
}
|
|
6296
|
+
return applyStyle(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
|
|
6297
|
+
};
|
|
6298
|
+
Object.setPrototypeOf(builder, proto);
|
|
6299
|
+
builder._generator = self2;
|
|
6300
|
+
builder._styler = _styler;
|
|
6301
|
+
builder._isEmpty = _isEmpty;
|
|
6302
|
+
return builder;
|
|
6303
|
+
};
|
|
6304
|
+
const applyStyle = (self2, string) => {
|
|
6305
|
+
if (self2.level <= 0 || !string) {
|
|
6306
|
+
return self2._isEmpty ? "" : string;
|
|
6307
|
+
}
|
|
6308
|
+
let styler = self2._styler;
|
|
6309
|
+
if (styler === void 0) {
|
|
6310
|
+
return string;
|
|
6311
|
+
}
|
|
6312
|
+
const { openAll, closeAll } = styler;
|
|
6313
|
+
if (string.indexOf("\x1B") !== -1) {
|
|
6314
|
+
while (styler !== void 0) {
|
|
6315
|
+
string = stringReplaceAll(string, styler.close, styler.open);
|
|
6316
|
+
styler = styler.parent;
|
|
6317
|
+
}
|
|
6318
|
+
}
|
|
6319
|
+
const lfIndex = string.indexOf("\n");
|
|
6320
|
+
if (lfIndex !== -1) {
|
|
6321
|
+
string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
|
|
6322
|
+
}
|
|
6323
|
+
return openAll + string + closeAll;
|
|
6324
|
+
};
|
|
6325
|
+
let template;
|
|
6326
|
+
const chalkTag = (chalk2, ...strings) => {
|
|
6327
|
+
const [firstString] = strings;
|
|
6328
|
+
if (!isArray(firstString) || !isArray(firstString.raw)) {
|
|
6329
|
+
return strings.join(" ");
|
|
6330
|
+
}
|
|
6331
|
+
const arguments_ = strings.slice(1);
|
|
6332
|
+
const parts = [firstString.raw[0]];
|
|
6333
|
+
for (let i = 1; i < firstString.length; i++) {
|
|
6334
|
+
parts.push(
|
|
6335
|
+
String(arguments_[i - 1]).replace(/[{}\\]/g, "\\$&"),
|
|
6336
|
+
String(firstString.raw[i])
|
|
6337
|
+
);
|
|
6338
|
+
}
|
|
6339
|
+
if (template === void 0) {
|
|
6340
|
+
template = requireTemplates();
|
|
6341
|
+
}
|
|
6342
|
+
return template(chalk2, parts.join(""));
|
|
6343
|
+
};
|
|
6344
|
+
Object.defineProperties(Chalk.prototype, styles);
|
|
6345
|
+
const chalk = Chalk();
|
|
6346
|
+
chalk.supportsColor = stdoutColor;
|
|
6347
|
+
chalk.stderr = Chalk({ level: stderrColor ? stderrColor.level : 0 });
|
|
6348
|
+
chalk.stderr.supportsColor = stderrColor;
|
|
6349
|
+
const { accessSync, constants, readFileSync } = fs$1;
|
|
6350
|
+
const envOptions = {};
|
|
6351
|
+
function SetupConfig(envOptions2, logger) {
|
|
6352
|
+
const envfile = process.env.STSENVFILE === void 0 ? "/.env" : process.env.STSENVFILE;
|
|
6353
|
+
config_1({ path: envfile });
|
|
6354
|
+
const defconfig = {
|
|
6355
|
+
// Node runtime environment
|
|
6356
|
+
isProduction: process.env.NODE_ENV === void 0 ? false : process.env.NODE_ENV === "production" ? true : false,
|
|
6357
|
+
isTest: process.env.NODE_ENV === void 0 ? false : process.env.NODE_ENV === "test" ? true : false,
|
|
6358
|
+
dbuser: process.env.DB_USER === void 0 ? "postgres" : process.env.DB_USER,
|
|
6359
|
+
dbpassword: process.env.DB_PASSWORD === void 0 ? "postgres" : process.env.DB_PASSWORD,
|
|
6360
|
+
dbpasswordfile: process.env.DB_PASSWORD_FILE,
|
|
6361
|
+
dbhost: process.env.DB_HOST === void 0 ? "localhost:5432" : process.env.DB_HOST,
|
|
6362
|
+
database: process.env.DB_DATABASE === void 0 ? "stsrestmsdb01" : process.env.DB_DATABASE,
|
|
6363
|
+
databaseUrl: process.env.DATABASE_URL,
|
|
6364
|
+
connectionString: "",
|
|
6365
|
+
defaultDatabaseConnectionString: "",
|
|
6366
|
+
STSServerType: process.env.STS_SERVER_TYPE === void 0 ? "EXPRESS_TLS" : process.env.STS_SERVER_TYPE,
|
|
6367
|
+
logToFile: process.env.LOG_TO_FILE === void 0 ? false : process.env.LOG_TO_FILE === "true" ? true : false,
|
|
6368
|
+
logFilePath: process.env.LOG_FILE_PATH === void 0 ? "/var/lib/sts" : process.env.LOG_FILE_PATH,
|
|
6369
|
+
logFileFormat: process.env.LOG_FILE_FORMAT === void 0 ? "csv" : process.env.LOG_FILE_FORMAT,
|
|
6370
|
+
poolSize: process.env.POOL_SIZE === void 0 ? 500 : parseInt(process.env.POOL_SIZE),
|
|
6371
|
+
useCPUs: process.env.MAX_CPU === void 0 ? -1 : parseFloat(process.env.MAX_CPU),
|
|
6372
|
+
respawnOnFail: process.env.RESPAWN === void 0 ? true : process.env.RESPAWN === "true" ? true : false,
|
|
6373
|
+
defaultDatabaseEntries: process.env.DEFAULT_DB_ENTRIES === void 0 ? 1e4 : parseInt(process.env.DEFAULT_DB_ENTRIES),
|
|
6374
|
+
useRedisDatabaseCache: process.env.USE_REDIS_DATABASE_CACHE === void 0 ? false : process.env.USE_REDIS_DATABASE_CACHE === "true" ? true : false,
|
|
6375
|
+
useSocketIoRedisAdaptor: process.env.USE_SOCKET_IO_REDIS_ADAPTOR === void 0 ? false : process.env.USE_SOCKET_IO_REDIS_ADAPTOR === "true" ? true : false,
|
|
6376
|
+
socketIoRedisAdaptorUrl: process.env.SOCKET_IO_REDIS_ADAPTOR_URL === void 0 ? "redis://localhost:6379" : process.env.SOCKET_IO_REDIS_ADAPTOR_URL,
|
|
6377
|
+
useRedisInstrumentationTransport: process.env.USE_REDIS_INSTRUMENTATION_TRANSPORT === void 0 ? false : process.env.USE_REDIS_INSTRUMENTATION_TRANSPORT === "true" ? true : false,
|
|
6378
|
+
redisInstrumentationTransportUrl: process.env.REDIS_INSTRUMENTATION_TRANSPORT_URL === void 0 ? "redis://localhost:6379" : process.env.REDIS_INSTRUMENTATION_TRANSPORT_URL,
|
|
6379
|
+
redisDatabaseCacheEndFlush: process.env.REDIS_DATABASE_CACHE_END_FLUSH === void 0 ? false : process.env.REDIS_DATABASE_CACHE_END_FLUSH === "true" ? true : false,
|
|
6380
|
+
redisDatabaseCacheUrl: process.env.REDIS_DATABASE_CACHE_URL === void 0 ? "redis://localhost:6379" : process.env.REDIS_DATABASE_CACHE_URL,
|
|
6381
|
+
defaultDatabaseMinExtraDataSize: process.env.DEFAULT_DATABASE_MIN_EXTRA_DATA_SIZE === void 0 ? 0 : parseInt(process.env.DEFAULT_DATABASE_MIN_EXTRA_DATA_SIZE),
|
|
6382
|
+
defaultDatabaseMaxExtraDataSize: process.env.DEFAULT_DATABASE_MAX_EXTRA_DATA_SIZE === void 0 ? 2e3 : parseInt(process.env.DEFAULT_DATABASE_MAX_EXTRA_DATA_SIZE),
|
|
6383
|
+
rest01endpoint: process.env.REST01_ENDPOINT === void 0 ? "https://localhost" : process.env.REST01_ENDPOINT,
|
|
6384
|
+
rest01hostport: process.env.REST01_HOST_PORT === void 0 ? "3003" : process.env.REST01_HOST_PORT,
|
|
6385
|
+
rest01port: process.env.REST01_PORT === void 0 ? "3003" : process.env.REST01_PORT,
|
|
6386
|
+
rest01apiroot: process.env.REST01_APIROOT === void 0 ? "/stsrest01/v1" : process.env.REST01_APIROOT,
|
|
6387
|
+
rest01prometheussupport: process.env.REST01_PROM_SUPPORT === void 0 ? true : process.env.REST01_PROM_SUPPORT === "true" ? true : false,
|
|
6388
|
+
rest01prometheusclusterport: process.env.REST01_PROM_CLUSTER_PORT === void 0 ? "3013" : process.env.REST01_PROM_CLUSTER_PORT,
|
|
6389
|
+
rest01servicename: process.env.REST01_SERVICE_NAME === void 0 ? "STSRest01" : process.env.REST01_SERVICE_NAME,
|
|
6390
|
+
rest01serviceversion: process.env.REST01_SERVICE_VERSION === void 0 ? "1.0.0" : process.env.REST01_SERVICE_VERSION,
|
|
6391
|
+
stsfhirendpoint: process.env.STSFHIR_ENDPOINT === void 0 ? "https://localhost" : process.env.STSFHIR_ENDPOINT,
|
|
6392
|
+
stsfhirhostport: process.env.STSFHIR_HOST_PORT === void 0 ? "3005" : process.env.STSFHIR_HOST_PORT,
|
|
6393
|
+
stsfhirport: process.env.STSFHIR_PORT === void 0 ? "3005" : process.env.STSFHIR_PORT,
|
|
6394
|
+
stsfhirapiroot: process.env.STSFHIR_APIROOT === void 0 ? "/stsfhir/r5" : process.env.STSFHIR_APIROOT,
|
|
6395
|
+
stsfhirprometheussupport: process.env.STSFHIR_PROM_SUPPORT === void 0 ? true : process.env.STSFHIR_PROM_SUPPORT === "true" ? true : false,
|
|
6396
|
+
stsfhirprometheusclusterport: process.env.STSFHIR_PROM_CLUSTER_PORT === void 0 ? "3015" : process.env.STSFHIR_PROM_CLUSTER_PORT,
|
|
6397
|
+
stsfhirservicename: process.env.STSFHIR_SERVICE_NAME === void 0 ? "STSFHIR" : process.env.STSFHIR_SERVICE_NAME,
|
|
6398
|
+
stsfhirserviceversion: process.env.STSFHIR_SERVICE_VERSION === void 0 ? "1.0.0" : process.env.STSFHIR_SERVICE_VERSION,
|
|
6399
|
+
imendpoint: process.env.IM_ENDPOINT === void 0 ? "https://localhost" : process.env.IM_ENDPOINT,
|
|
6400
|
+
imhostport: process.env.IM_HOST_PORT === void 0 ? "3001" : process.env.IM_HOST_PORT,
|
|
6401
|
+
import: process.env.IM_PORT === void 0 ? "3001" : process.env.IM_PORT,
|
|
6402
|
+
imapiroot: process.env.IM_APIROOT === void 0 ? "/stsinstrumentmanager/v1" : process.env.IM_APIROOT,
|
|
6403
|
+
imprometheussupport: process.env.IM_PROM_SUPPORT === void 0 ? true : process.env.IM_PROM_SUPPORT === "true" ? true : false,
|
|
6404
|
+
imprometheusclusterport: process.env.IM_PROM_CLUSTER_PORT === void 0 ? "3011" : process.env.IM_PROM_CLUSTER_PORT,
|
|
6405
|
+
imservicename: process.env.IM_SERVICE_NAME === void 0 ? "STSInstrumentManager" : process.env.IM_SERVICE_NAME,
|
|
6406
|
+
imserviceversion: process.env.IM_SERVICE_VERSION === void 0 ? "1.0.0" : process.env.IM_SERVICE_VERSION,
|
|
6407
|
+
imRedisKeepAliveProcessorUrl: process.env.IM_REDIS_KEEP_ALIVE_PROCESSOR_URL === void 0 ? "redis://localhost:6379" : process.env.IM_REDIS_KEEP_ALIVE_PROCESSOR_URL,
|
|
6408
|
+
imRedisMessageProcessorUrl: process.env.IM_REDIS_MESSAGE_PROCESSOR_URL === void 0 ? "redis://localhost:6379" : process.env.IM_REDIS_MESSAGE_PROCESSOR_URL,
|
|
6409
|
+
asendpoint: process.env.AS_ENDPOINT === void 0 ? "https://localhost" : process.env.AS_ENDPOINT,
|
|
6410
|
+
ashostport: process.env.AS_HOST_PORT === void 0 ? "3002" : process.env.AS_HOST_PORT,
|
|
6411
|
+
asport: process.env.AS_PORT === void 0 ? "3002" : process.env.AS_PORT,
|
|
6412
|
+
asapiroot: process.env.AS_API_ROOT === void 0 ? "/stsauth/v1.0" : process.env.AS_API_ROOT,
|
|
6413
|
+
asoauthapiroot: process.env.AS_OAUTH_API_ROOT === void 0 ? "/oauth2/v2.0" : process.env.AS_OAUTH_API_ROOT,
|
|
6414
|
+
asadminapiroot: process.env.AS_ADMIN_API_ROOT === void 0 ? "/admin/v1.0" : process.env.AS_ADMIN_API_ROOT,
|
|
6415
|
+
asprometheussupport: process.env.AS_PROM_SUPPORT === void 0 ? true : process.env.AS_PROM_SUPPORT === "true" ? true : false,
|
|
6416
|
+
asprometheusclusterport: process.env.AS_PROM_CLUSTER_PORT === void 0 ? "3012" : process.env.AS_PROM_CLUSTER_PORT,
|
|
6417
|
+
asservicename: process.env.AS_SERVICE_NAME === void 0 ? "STSAuth" : process.env.AS_SERVICE_NAME,
|
|
6418
|
+
asserviceversion: process.env.AS_SERVICE_VERSION === void 0 ? "1.0.0" : process.env.AS_SERVICE_VERSION,
|
|
6419
|
+
asjwksjsonpath: process.env.AS_JWKS_JSON_PATH === void 0 ? "/.well-known/jwks.json" : process.env.AS_JWKS_JSON_PATH,
|
|
6420
|
+
asjwkskeyrotationtime: process.env.AS_JWKS_KEY_ROTATION_TIME === void 0 ? 86400 : parseInt(process.env.AS_JWKS_KEY_ROTATION_TIME),
|
|
6421
|
+
asjwkskeypurgetimeoffset: process.env.AS_JWKS_KEY_PURGE_TIME_OFFSET === void 0 ? 300 : parseInt(process.env.AS_JWKS_KEY_PURGE_TIME_OFFSET),
|
|
6422
|
+
asjwkskeycount: process.env.AS_JWKS_KEY_COUNT === void 0 ? 4 : parseInt(process.env.AS_JWKS_KEY_COUNT),
|
|
6423
|
+
asaccesstokenexpire: process.env.AS_ACCESS_TOKEN_EXPIRE === void 0 ? 43200 : parseInt(process.env.AS_ACCESS_TOKEN_EXPIRE),
|
|
6424
|
+
authorizeendpoint: process.env.AUTHORIZE_ENDPOINT === void 0 ? "https://localhost" : process.env.AUTHORIZE_ENDPOINT,
|
|
6425
|
+
authorizeport: process.env.AUTHORIZE_PORT === void 0 ? "3010" : process.env.AUTHORIZE_PORT,
|
|
6426
|
+
authorizeapiroot: process.env.AUTHORIZE_API_ROOT === void 0 ? "/stsa" : process.env.AUTHORIZE_API_ROOT,
|
|
6427
|
+
authorizeapi: process.env.AUTHORIZE_API === void 0 ? "/authorize" : process.env.AUTHORIZE_API,
|
|
6428
|
+
brokerendpoint: process.env.BROKER_ENDPOINT === void 0 ? "https://localhost" : process.env.BROKER_ENDPOINT,
|
|
6429
|
+
brokerhostport: process.env.BROKER_HOST_PORT === void 0 ? "3006" : process.env.BROKER_HOST_PORT,
|
|
6430
|
+
brokerport: process.env.BROKER_PORT === void 0 ? "3006" : process.env.BROKER_PORT,
|
|
6431
|
+
brokerapiroot: process.env.BROKER_APIROOT === void 0 ? "/stsbroker/v1.0" : process.env.BROKER_APIROOT,
|
|
6432
|
+
brokerprometheussupport: process.env.BROKER_PROM_SUPPORT === void 0 ? true : process.env.BROKER_PROM_SUPPORT === "true" ? true : false,
|
|
6433
|
+
brokerprometheusclusterport: process.env.BROKER_PROM_CLUSTER_PORT === void 0 ? "3016" : process.env.BROKER_PROM_CLUSTER_PORT,
|
|
6434
|
+
brokerservicename: process.env.BROKER_SERVICE_NAME === void 0 ? "STSBroker" : process.env.BROKER_SERVICE_NAME,
|
|
6435
|
+
brokerserviceversion: process.env.BROKER_SERVICE_VERSION === void 0 ? "1.0.0" : process.env.BROKER_SERVICE_VERSION,
|
|
6436
|
+
trnendpoint: process.env.TRN_ENDPOINT === void 0 ? "https://localhost" : process.env.TRN_ENDPOINT,
|
|
6437
|
+
trnhostport: process.env.TRN_HOST_PORT === void 0 ? "3007" : process.env.TRN_HOST_PORT,
|
|
6438
|
+
trnport: process.env.TRN_PORT === void 0 ? "3007" : process.env.TRN_PORT,
|
|
6439
|
+
trnapiroot: process.env.TRN_APIROOT === void 0 ? "/ststrn/v1.0" : process.env.TRN_APIROOT,
|
|
6440
|
+
trnprometheussupport: process.env.TRN_PROM_SUPPORT === void 0 ? true : process.env.TRN_PROM_SUPPORT === "true" ? true : false,
|
|
6441
|
+
trnprometheusclusterport: process.env.TRN_PROM_CLUSTER_PORT === void 0 ? "3017" : process.env.TRN_PROM_CLUSTER_PORT,
|
|
6442
|
+
trnservicename: process.env.TRN_SERVICE_NAME === void 0 ? "STSTestRunnerNode" : process.env.TRN_SERVICE_NAME,
|
|
6443
|
+
trnserviceversion: process.env.TRN_SERVICE_VERSION === void 0 ? "1.0.0" : process.env.TRN_SERVICE_VERSION,
|
|
6444
|
+
trnautostartdelay: process.env.TRN_AUTO_START_DELAY === void 0 ? 0 : parseInt(process.env.TRN_AUTO_START_DELAY),
|
|
6445
|
+
trnautostartconfig: process.env.TRN_AUTO_START_CONFIG === void 0 ? "" : process.env.TRN_AUTO_START_CONFIG,
|
|
6446
|
+
trnRedisMessageProcessorUrl: process.env.TRN_REDIS_MESSAGE_PROCESSOR_URL === void 0 ? "redis://localhost:6379" : process.env.TRN_REDIS_MESSAGE_PROCESSOR_URL,
|
|
6447
|
+
lambdaendpoint: process.env.LAMBDA_ENDPOINT === void 0 ? "https://localhost" : process.env.LAMBDA_ENDPOINT,
|
|
6448
|
+
lambdahostport: process.env.LAMBDA_HOST_PORT === void 0 ? "3009" : process.env.LAMBDA_HOST_PORT,
|
|
6449
|
+
lambdaport: process.env.LAMBDA_PORT === void 0 ? "3009" : process.env.LAMBDA_PORT,
|
|
6450
|
+
lambdaapiroot: process.env.LAMBDA_APIROOT === void 0 ? "/stslambda/v1.0" : process.env.LAMBDA_APIROOT,
|
|
6451
|
+
lambdaprometheussupport: process.env.LAMBDA_PROM_SUPPORT === void 0 ? true : process.env.LAMBDA_PROM_SUPPORT === "true" ? true : false,
|
|
6452
|
+
lambdaprometheusclusterport: process.env.LAMBDA_PROM_CLUSTER_PORT === void 0 ? "3019" : process.env.LAMBDA_PROM_CLUSTER_PORT,
|
|
6453
|
+
lambdaservicename: process.env.LAMBDA_SERVICE_NAME === void 0 ? "STSLambda" : process.env.LAMBDA_SERVICE_NAME,
|
|
6454
|
+
lambdaserviceversion: process.env.LAMBDA_SERVICE_VERSION === void 0 ? "1.0.0" : process.env.LAMBDA_SERVICE_VERSION,
|
|
6455
|
+
publishinterval: process.env.PUBLISH_INTERVAL === void 0 ? 1e3 : parseInt(process.env.PUBLISH_INTERVAL),
|
|
6456
|
+
publishtimeout: process.env.PUBLISH_TIMEOUT === void 0 ? 750 : parseInt(process.env.PUBLISH_TIMEOUT),
|
|
6457
|
+
transport: process.env.TRANSPORT === void 0 ? "RESTAPI" : process.env.TRANSPORT,
|
|
6458
|
+
useSecureCookies: process.env.USE_SECURE_COOKIES === void 0 ? false : process.env.USE_SECURE_COOKIES === "true" ? true : false,
|
|
6459
|
+
keepAlive: process.env.KEEP_ALIVE === void 0 ? true : process.env.KEEP_ALIVE === "true" ? true : false,
|
|
6460
|
+
maxSockets: process.env.MAX_SOCKETS === void 0 ? 10 : parseInt(process.env.MAX_SOCKETS),
|
|
6461
|
+
maxTotalSockets: process.env.MAX_TOTAL_SOCKETS === void 0 ? 20 : parseInt(process.env.MAX_TOTAL_SOCKETS),
|
|
6462
|
+
maxFreeSockets: process.env.MAX_FREE_SOCKETS === void 0 ? 256 : parseInt(process.env.MAX_FREE_SOCKETS),
|
|
6463
|
+
timeout: process.env.TIMEOUT === void 0 ? 1e4 : parseInt(process.env.TIMEOUT),
|
|
6464
|
+
maxPayloadSize: process.env.MAX_PAYLOAD_SIZE === void 0 ? "50mb" : process.env.MAX_PAYLOAD_SIZE,
|
|
6465
|
+
instrumentationObservationInterval: process.env.INSTRUMENTATION_OBSERVATION_INTERVAL === void 0 ? 1e3 : parseInt(process.env.INSTRUMENTATION_OBSERVATION_INTERVAL),
|
|
6466
|
+
instrumentationTimeWindow: process.env.INSTRUMENTATION_TIME_WINDOW === void 0 ? 600 : parseInt(process.env.INSTRUMENTATION_TIME_WINDOW),
|
|
6467
|
+
authJWTAccessTokenTimeout: process.env.AUTH_JWT_ACCESS_TOKEN_TIMEOUT === void 0 ? 600 : parseInt(process.env.AUTH_JWT_ACCESS_TOKEN_TIMEOUT),
|
|
6468
|
+
authJWTRefreshTokenTimeout: process.env.AUTH_JWT_REFRESH_TOKEN_TIMEOUT === void 0 ? 3600 * 24 : parseInt(process.env.AUTH_JWT_REFRESH_TOKEN_TIMEOUT),
|
|
6469
|
+
authCookieTimeout: process.env.AUTH_COOKIE_TIMEOUT === void 0 ? 3600 * 24 : parseInt(process.env.AUTH_COOKIE_TIMEOUT),
|
|
6470
|
+
masterProcessExitTime: process.env.MASTER_PROCESS_EXIT_TIME === void 0 ? 500 : parseInt(process.env.MASTER_PROCESS_EXIT_TIME),
|
|
6471
|
+
childProcessExitTime: process.env.CHILD_PROCESS_EXIT_TIME === void 0 ? 500 : parseInt(process.env.CHILD_PROCESS_EXIT_TIME),
|
|
6472
|
+
systemInformationInterval: process.env.SYSTEM_INFORMATION_INTERVAL === void 0 ? 1e3 : parseInt(process.env.SYSTEM_INFORMATION_INTERVAL),
|
|
6473
|
+
ignoresocketio: process.env.IGNORE_SOCKETIO === void 0 ? true : process.env.IGNORE_SOCKETIO === "true" ? true : false,
|
|
6474
|
+
httpsserverkeypath: process.env.HTTPS_SERVER_KEY_PATH === void 0 ? "/var/lib/sts/stsglobalresources/keys/server.key" : process.env.HTTPS_SERVER_KEY_PATH,
|
|
6475
|
+
httpsservercertpath: process.env.HTTPS_SERVER_CERT_PATH === void 0 ? "/var/lib/sts/stsglobalresources/keys/server.cert" : process.env.HTTPS_SERVER_CERT_PATH,
|
|
6476
|
+
tsjwkskeys: process.env.TS_JWKS_KEYS === void 0 ? 3 : parseInt(process.env.TS_JWKS_KEYS),
|
|
6477
|
+
jwksAuthConfigCache: process.env.JWKS_AUTH_CONFIG_CACHE === void 0 ? true : process.env.JWKS_AUTH_CONFIG_CACHE === "true" ? true : false,
|
|
6478
|
+
jwksAuthConfigCacheMaxEntries: process.env.JWKS_AUTH_CONFIG_CACHE_MAX_ENTRIES === void 0 ? 5 : parseInt(process.env.JWKS_AUTH_CONFIG_CACHE_MAX_ENTRIES),
|
|
6479
|
+
jwksAuthConfigCacheMaxAge: process.env.JWKS_AUTH_CONFIG_CACHE_MAX_AGE === void 0 ? 6e5 : parseInt(process.env.JWKS_AUTH_CONFIG_CACHE_MAX_AGE),
|
|
6480
|
+
jwksAuthConfigRateLimit: process.env.JWKS_AUTH_CONFIG_RATE_LIMIT === void 0 ? true : process.env.JWKS_AUTH_CONFIG_RATE_LIMIT === "true" ? true : false,
|
|
6481
|
+
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),
|
|
6482
|
+
jwksAuthConfigTimeout: process.env.JWKS_AUTH_CONFIG_TIMEOUT === void 0 ? 3e4 : parseInt(process.env.JWKS_AUTH_CONFIG_TIMEOUT),
|
|
6483
|
+
influxDB_APIToken: process.env.INFLUXDB_API_TOKEN === void 0 ? "password" : process.env.INFLUXDB_API_TOKEN,
|
|
6484
|
+
influxDB_APITokenFile: process.env.INFLUXDB_API_TOKEN_FILE,
|
|
6485
|
+
influxDB_Url: process.env.INFLUXDB_URL === void 0 ? "http://localhost:8086" : process.env.INFLUXDB_URL,
|
|
6486
|
+
influxDB_Org: process.env.INFLUXDB_ORG === void 0 ? "my-org" : process.env.INFLUXDB_ORG,
|
|
6487
|
+
influxDB_Bucket: process.env.INFLUXDB_BUCKET === void 0 ? "TestBucket01" : process.env.INFLUXDB_BUCKET,
|
|
6488
|
+
influxDB_keepAlive: process.env.INFLUXDB_KEEP_ALIVE === void 0 ? true : process.env.INFLUXDB_KEEP_ALIVE === "true" ? true : false,
|
|
6489
|
+
influxDB_maxSockets: process.env.INFLUXDB_MAX_SOCKETS === void 0 ? 10 : parseInt(process.env.INFLUXDB_MAX_SOCKETS),
|
|
6490
|
+
influxDB_maxTotalSockets: process.env.INFLUXDB_MAX_TOTAL_SOCKETS === void 0 ? 20 : parseInt(process.env.INFLUXDB_MAX_TOTAL_SOCKETS),
|
|
6491
|
+
influxDB_maxFreeSockets: process.env.INFLUXDB_MAX_FREE_SOCKETS === void 0 ? 256 : parseInt(process.env.INFLUXDB_MAX_FREE_SOCKETS),
|
|
6492
|
+
influxDB_timeout: process.env.INFLUXDB_TIMEOUT === void 0 ? 1e4 : parseInt(process.env.INFLUXDB_TIMEOUT),
|
|
6493
|
+
influxDB_rejectUnauthorized: process.env.INFLUXDB_REJECT_UNAUTHORIZED === void 0 ? true : process.env.INFLUXDB_REJECT_UNAUTHORIZED === "true" ? true : false,
|
|
6494
|
+
influxDB_writeDataPointFlushTimeout: process.env.INFLUXDB_WRITE_DATA_POINT_FLUSH_TIMEOUT === void 0 ? 1e3 : parseInt(process.env.INFLUXDB_WRITE_DATA_POINT_FLUSH_TIMEOUT),
|
|
6495
|
+
kafka_clientId: process.env.KAFKA_CLIENT_ID === void 0 ? "myclient" : process.env.KAFKA_CLIENT_ID,
|
|
6496
|
+
kafka_brokers: process.env.KAFKA_BROKERS === void 0 ? "localhost:9092" : process.env.KAFKA_BROKERS,
|
|
6497
|
+
kafka_admin_timeout: process.env.KAFKA_ADMIN_TIMEOUT === void 0 ? 5e3 : parseInt(process.env.KAFKA_ADMIN_TIMEOUT),
|
|
6498
|
+
kafka_connection_timeout: process.env.KAFKA_CONNECTION_TIMEOUT === void 0 ? 5e3 : parseInt(process.env.KAFKA_CONNECTION_TIMEOUT),
|
|
6499
|
+
kafka_request_timeout: process.env.KAFKA_REQUEST_TIMEOUT === void 0 ? 5e3 : parseInt(process.env.KAFKA_REQUEST_TIMEOUT),
|
|
6500
|
+
kafka_log_level: process.env.KAFKA_LOG_LEVEL === void 0 ? "nothing" : process.env.KAFKA_LOG_LEVEL,
|
|
6501
|
+
kafka_keep_alive: process.env.KAFKA_KEEP_ALIVE === void 0 ? 3e4 : parseInt(process.env.KAFKA_KEEP_ALIVE),
|
|
6502
|
+
kafka_use_ssl: process.env.KAFKA_USE_SSL === void 0 ? false : process.env.KAFKA_USE_SSL === "true" ? true : false,
|
|
6503
|
+
kafka_ssl_rejectUnauthorized: process.env.KAFKA_SSL_REJECT_UNAUTHORIZED === void 0 ? true : process.env.KAFKA_SSL_REJECT_UNAUTHORIZED === "true" ? true : false,
|
|
6504
|
+
kafka_ssl_cafile: process.env.KAFKA_SSL_CAFILE === void 0 ? "/my/custom/ca.crt" : process.env.KAFKA_SSL_CAFILE,
|
|
6505
|
+
kafka_ssl_keyfile: process.env.KAFKA_SSL_KEYFILE === void 0 ? "/my/custom/client-key.pem" : process.env.KAFKA_SSL_KEYFILE,
|
|
6506
|
+
kafka_ssl_certfile: process.env.KAFKA_SSL_CERTFILE === void 0 ? "/my/custom/client-cert.pem" : process.env.KAFKA_SSL_CERTFILE,
|
|
6507
|
+
kafka_consume_from_beginning: process.env.KAFKA_CONSUME_FROM_BEGINNING === void 0 ? true : process.env.KAFKA_CONSUME_FROM_BEGINNING === "true" ? true : false,
|
|
6508
|
+
observabilityPublishMode: process.env.OBSERVABILITY_PUBLISH_MODE === void 0 ? "PROXY" : process.env.OBSERVABILITY_PUBLISH_MODE,
|
|
6509
|
+
stsUiTermObservabilityConsumptionMode: process.env.STSUITERM_OBSERVABILITY_CONSUMPTION_MODE === void 0 ? "PROXY" : process.env.STSUITERM_OBSERVABILITY_CONSUMPTION_MODE
|
|
6510
|
+
};
|
|
6511
|
+
const ReadFile = (passwordFile) => {
|
|
6512
|
+
try {
|
|
6513
|
+
accessSync(passwordFile, constants.R_OK);
|
|
6514
|
+
const data = readFileSync(passwordFile, "utf8");
|
|
6515
|
+
if (logger) ;
|
|
6516
|
+
return data;
|
|
6517
|
+
} catch (err) {
|
|
6518
|
+
return "";
|
|
6519
|
+
}
|
|
6520
|
+
};
|
|
6521
|
+
const fileconfig = [
|
|
6522
|
+
{ fileprop: "dbpasswordfile", prop: "dbpassword" },
|
|
6523
|
+
// JWKS secret file processing
|
|
6524
|
+
{ fileprop: "tsjwksstorepathfile", prop: "tsjwksstorepath" },
|
|
6525
|
+
// InfluxDB file processing
|
|
6526
|
+
{ fileprop: "influxDB_APITokenFile", prop: "influxDB_APIToken" }
|
|
6527
|
+
];
|
|
6528
|
+
fileconfig.forEach((v) => {
|
|
6529
|
+
if (defconfig[v.fileprop] !== void 0) {
|
|
6530
|
+
defconfig[v.prop] = ReadFile(defconfig[v.fileprop]);
|
|
6531
|
+
}
|
|
6532
|
+
});
|
|
6533
|
+
for (const [key, val] of Object.entries(defconfig)) {
|
|
6534
|
+
envOptions2[key] = val;
|
|
6535
|
+
}
|
|
6536
|
+
}
|
|
6537
|
+
function $SetupOptions(envOptions2) {
|
|
6538
|
+
SetupConfig(envOptions2);
|
|
6539
|
+
const options = envOptions2;
|
|
6540
|
+
if (options.dbhost) {
|
|
6541
|
+
const hosts = options.dbhost.split(",");
|
|
6542
|
+
envOptions2.connectionString = hosts.map((host) => {
|
|
6543
|
+
return `postgresql://${options.dbuser}:${options.dbpassword}@${host}/${options.database}`;
|
|
6544
|
+
}).join(",");
|
|
6545
|
+
envOptions2.defaultDatabaseConnectionString = hosts.map((host) => {
|
|
6546
|
+
return `postgresql://${options.dbuser}:${options.dbpassword}@${host}/postgres`;
|
|
6547
|
+
}).join(",");
|
|
6548
|
+
}
|
|
6549
|
+
}
|
|
6550
|
+
const envOptionsHandler = {
|
|
6551
|
+
get(target, prop, receiver) {
|
|
6552
|
+
if (Object.keys(target).length === 0) {
|
|
6553
|
+
$SetupOptions(target);
|
|
6554
|
+
}
|
|
6555
|
+
return Reflect.get(target, prop, receiver);
|
|
6556
|
+
}
|
|
6557
|
+
};
|
|
6558
|
+
const goptions = new Proxy(envOptions, envOptionsHandler);
|
|
6559
|
+
class AgentManager {
|
|
6560
|
+
constructor(agentManagerOptions) {
|
|
6561
|
+
__privateAdd2(this, _options);
|
|
6562
|
+
__privateAdd2(this, _httpAgent, null);
|
|
6563
|
+
__privateAdd2(this, _httpsAgent, null);
|
|
6564
|
+
__privateAdd2(this, _agentResetInterval, null);
|
|
6565
|
+
__privateAdd2(this, _requestCount, 0);
|
|
6566
|
+
__privateAdd2(this, _SetupResetInterval, () => {
|
|
6567
|
+
__privateSet2(this, _agentResetInterval, setTimeout(() => {
|
|
6568
|
+
this.ResetAgent();
|
|
6569
|
+
__privateGet2(this, _SetupResetInterval).call(this);
|
|
6570
|
+
}, __privateGet2(this, _options).agentResetInterval).unref());
|
|
6571
|
+
});
|
|
6572
|
+
__privateAdd2(this, _GetAgentOptions, (https2) => {
|
|
6573
|
+
let options;
|
|
6574
|
+
if (__privateGet2(this, _options).agentOptions) {
|
|
6575
|
+
options = {
|
|
6576
|
+
keepAlive: __privateGet2(this, _options).agentOptions.keepAlive,
|
|
6577
|
+
maxSockets: __privateGet2(this, _options).agentOptions.maxSockets,
|
|
6578
|
+
maxTotalSockets: __privateGet2(this, _options).agentOptions.maxTotalSockets,
|
|
6579
|
+
maxFreeSockets: __privateGet2(this, _options).agentOptions.maxFreeSockets,
|
|
6580
|
+
timeout: __privateGet2(this, _options).agentOptions.timeout
|
|
6581
|
+
//@@ config
|
|
6582
|
+
};
|
|
6583
|
+
if (https2 === true) {
|
|
6584
|
+
options.rejectUnauthorized = __privateGet2(this, _options).agentOptions.rejectUnauthorized;
|
|
6585
|
+
}
|
|
6586
|
+
} else {
|
|
6587
|
+
options = {
|
|
6588
|
+
keepAlive: process.env.NODE_ENV === "test" ? false : goptions.keepAlive,
|
|
6589
|
+
maxSockets: goptions.maxSockets,
|
|
6590
|
+
maxTotalSockets: goptions.maxTotalSockets,
|
|
6591
|
+
maxFreeSockets: goptions.maxFreeSockets,
|
|
6592
|
+
timeout: 3e4
|
|
6593
|
+
//@@ config
|
|
6594
|
+
};
|
|
6595
|
+
if (https2 === true) {
|
|
6596
|
+
options.rejectUnauthorized = goptions.isProduction;
|
|
6597
|
+
}
|
|
6598
|
+
}
|
|
6599
|
+
return options;
|
|
6600
|
+
});
|
|
6601
|
+
__privateSet2(this, _options, agentManagerOptions);
|
|
6602
|
+
if (__privateGet2(this, _options).agentResetInterval) {
|
|
6603
|
+
__privateGet2(this, _SetupResetInterval).call(this);
|
|
6604
|
+
}
|
|
6605
|
+
}
|
|
6606
|
+
IncRequestCount() {
|
|
6607
|
+
__privateWrapper2(this, _requestCount)._++;
|
|
6608
|
+
if (__privateGet2(this, _options).agentResetCount) {
|
|
6609
|
+
if (__privateGet2(this, _requestCount) % __privateGet2(this, _options).agentResetCount === 0) {
|
|
6610
|
+
this.ResetAgent();
|
|
6611
|
+
}
|
|
6612
|
+
}
|
|
6613
|
+
}
|
|
6614
|
+
IsHttps(protocol) {
|
|
6615
|
+
if (protocol.toLowerCase().startsWith("https:")) {
|
|
6616
|
+
return true;
|
|
6617
|
+
}
|
|
6618
|
+
return false;
|
|
6619
|
+
}
|
|
6620
|
+
GetAgent(protocol) {
|
|
6621
|
+
if (protocol.toLowerCase().startsWith("https:")) {
|
|
6622
|
+
if (__privateGet2(this, _httpsAgent) === null) {
|
|
6623
|
+
__privateSet2(this, _httpsAgent, new https.Agent(__privateGet2(this, _GetAgentOptions).call(this, true)));
|
|
6624
|
+
}
|
|
6625
|
+
return __privateGet2(this, _httpsAgent);
|
|
6626
|
+
} else if (protocol.toLowerCase().startsWith("http:")) {
|
|
6627
|
+
if (__privateGet2(this, _httpAgent) === null) {
|
|
6628
|
+
__privateSet2(this, _httpAgent, new http.Agent(__privateGet2(this, _GetAgentOptions).call(this, false)));
|
|
6629
|
+
}
|
|
6630
|
+
return __privateGet2(this, _httpAgent);
|
|
6631
|
+
} else {
|
|
6632
|
+
return null;
|
|
6633
|
+
}
|
|
6634
|
+
}
|
|
6635
|
+
ResetAgent() {
|
|
6636
|
+
__privateSet2(this, _httpAgent, null);
|
|
6637
|
+
__privateSet2(this, _httpsAgent, null);
|
|
6638
|
+
}
|
|
6639
|
+
/*
|
|
6640
|
+
url
|
|
6641
|
+
,method: 'post'
|
|
6642
|
+
,data: payload
|
|
6643
|
+
,headers: headers
|
|
6644
|
+
,httpsAgent: this.#agentManager.GetAgent(url)
|
|
6645
|
+
*/
|
|
6646
|
+
/*
|
|
6647
|
+
postgresContainer = await new GenericContainer("postgres")
|
|
6648
|
+
.withExposedPorts(5432)
|
|
6649
|
+
.withEnvironment({
|
|
6650
|
+
POSTGRES_PASSWORD: "postgres",
|
|
6651
|
+
//UV_THREADPOOL_SIZE: "64"
|
|
6652
|
+
})
|
|
6653
|
+
.withCommand(['-c', 'max_connections=20'])
|
|
6654
|
+
.start();
|
|
6655
|
+
*/
|
|
6656
|
+
Terminate() {
|
|
6657
|
+
if (__privateGet2(this, _agentResetInterval)) {
|
|
6658
|
+
clearTimeout(__privateGet2(this, _agentResetInterval));
|
|
6659
|
+
__privateSet2(this, _agentResetInterval, null);
|
|
6660
|
+
}
|
|
6661
|
+
if (__privateGet2(this, _httpAgent)) {
|
|
6662
|
+
__privateGet2(this, _httpAgent).destroy();
|
|
6663
|
+
__privateSet2(this, _httpAgent, null);
|
|
6664
|
+
}
|
|
6665
|
+
if (__privateGet2(this, _httpsAgent)) {
|
|
6666
|
+
__privateGet2(this, _httpsAgent).destroy();
|
|
6667
|
+
__privateSet2(this, _httpsAgent, null);
|
|
6668
|
+
}
|
|
6669
|
+
}
|
|
6670
|
+
}
|
|
6671
|
+
_options = /* @__PURE__ */ new WeakMap();
|
|
6672
|
+
_httpAgent = /* @__PURE__ */ new WeakMap();
|
|
6673
|
+
_httpsAgent = /* @__PURE__ */ new WeakMap();
|
|
6674
|
+
_agentResetInterval = /* @__PURE__ */ new WeakMap();
|
|
6675
|
+
_requestCount = /* @__PURE__ */ new WeakMap();
|
|
6676
|
+
_SetupResetInterval = /* @__PURE__ */ new WeakMap();
|
|
6677
|
+
_GetAgentOptions = /* @__PURE__ */ new WeakMap();
|
|
6678
|
+
class STSAxiosConfig {
|
|
6679
|
+
constructor(url, method, headers, timeout) {
|
|
6680
|
+
__privateAdd2(this, _url);
|
|
6681
|
+
__privateAdd2(this, _method);
|
|
6682
|
+
__privateAdd2(this, _headers);
|
|
6683
|
+
__privateAdd2(this, _data);
|
|
6684
|
+
__privateAdd2(this, _agentManager);
|
|
6685
|
+
__privateAdd2(this, _timeout);
|
|
6686
|
+
__privateSet2(this, _url, url);
|
|
6687
|
+
__privateSet2(this, _method, method);
|
|
6688
|
+
__privateSet2(this, _headers, headers);
|
|
6689
|
+
if (timeout !== void 0) {
|
|
6690
|
+
__privateSet2(this, _timeout, timeout);
|
|
6691
|
+
}
|
|
6692
|
+
}
|
|
6693
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6694
|
+
withData(data) {
|
|
6695
|
+
__privateSet2(this, _data, data);
|
|
6696
|
+
return this;
|
|
6697
|
+
}
|
|
6698
|
+
withTimeout(timeout) {
|
|
6699
|
+
__privateSet2(this, _timeout, timeout);
|
|
6700
|
+
return this;
|
|
6701
|
+
}
|
|
6702
|
+
withAgentManager(agentManager) {
|
|
6703
|
+
__privateSet2(this, _agentManager, agentManager);
|
|
6704
|
+
return this;
|
|
6705
|
+
}
|
|
6706
|
+
get config() {
|
|
6707
|
+
const retVal = {
|
|
6708
|
+
url: __privateGet2(this, _url),
|
|
6709
|
+
method: __privateGet2(this, _method),
|
|
6710
|
+
headers: __privateGet2(this, _headers)
|
|
6711
|
+
};
|
|
6712
|
+
if (__privateGet2(this, _agentManager) !== void 0) {
|
|
6713
|
+
if (__privateGet2(this, _agentManager).IsHttps(__privateGet2(this, _url))) {
|
|
6714
|
+
retVal.httpsAgent = __privateGet2(this, _agentManager).GetAgent(__privateGet2(this, _url));
|
|
6715
|
+
} else {
|
|
6716
|
+
retVal.httpAgent = __privateGet2(this, _agentManager).GetAgent(__privateGet2(this, _url));
|
|
6717
|
+
}
|
|
6718
|
+
}
|
|
6719
|
+
if (__privateGet2(this, _data) !== void 0) {
|
|
6720
|
+
retVal.data = __privateGet2(this, _data);
|
|
6721
|
+
}
|
|
6722
|
+
if (__privateGet2(this, _timeout) !== void 0) {
|
|
6723
|
+
retVal.timeout = __privateGet2(this, _timeout);
|
|
6724
|
+
}
|
|
6725
|
+
return retVal;
|
|
6726
|
+
}
|
|
6727
|
+
}
|
|
6728
|
+
_url = /* @__PURE__ */ new WeakMap();
|
|
6729
|
+
_method = /* @__PURE__ */ new WeakMap();
|
|
6730
|
+
_headers = /* @__PURE__ */ new WeakMap();
|
|
6731
|
+
_data = /* @__PURE__ */ new WeakMap();
|
|
6732
|
+
_agentManager = /* @__PURE__ */ new WeakMap();
|
|
6733
|
+
_timeout = /* @__PURE__ */ new WeakMap();
|
|
6734
|
+
class PublishTransportRESTServer extends STSOptionsBase {
|
|
6735
|
+
constructor(options) {
|
|
6736
|
+
super(options);
|
|
6737
|
+
__privateAdd(this, _agentManager2, null);
|
|
6738
|
+
// Returns true for success or false for failure.
|
|
6739
|
+
__publicField(this, "Publish", async (payload) => {
|
|
6740
|
+
try {
|
|
6741
|
+
if (this.options.showPublishPayload) {
|
|
6742
|
+
console.log(chalk$2.grey(`PublishTransportRESTServer::Publish() url: [${this.options.url}]`));
|
|
6743
|
+
console.log(payload);
|
|
6744
|
+
}
|
|
6745
|
+
const encodedData = encode(payload, { ignoreUndefined: true });
|
|
6746
|
+
const headers = { "Content-Type": "application/octet-stream" };
|
|
6747
|
+
let retVal = null;
|
|
6748
|
+
if (this.options.socketPath) {
|
|
6749
|
+
retVal = await axios({
|
|
6750
|
+
method: "post",
|
|
6751
|
+
//data: payload,
|
|
6752
|
+
data: Buffer.from(encodedData),
|
|
6753
|
+
headers,
|
|
6754
|
+
//httpsAgent: this.#httpsAgent,
|
|
6755
|
+
socketPath: this.options.socketPath
|
|
6756
|
+
});
|
|
6757
|
+
} else {
|
|
6758
|
+
if (isNode && __privateGet(this, _agentManager2)) {
|
|
6759
|
+
retVal = await axios(new STSAxiosConfig(this.options.url, "post", headers).withData(Buffer.from(encodedData)).withAgentManager(__privateGet(this, _agentManager2)).config);
|
|
6760
|
+
} else {
|
|
6761
|
+
const blob = new Blob([encodedData], { type: "application/octet-stream" });
|
|
6762
|
+
retVal = await axios(new STSAxiosConfig(this.options.url, "post", headers).withData(blob).config);
|
|
6763
|
+
}
|
|
6764
|
+
}
|
|
6765
|
+
if (retVal.status !== 200) {
|
|
6766
|
+
if (this.options.showPublishPayload) {
|
|
6767
|
+
console.log(chalk$2.red(`PublishTransportRESTServer::Publish() Error (_PerformPublishRESTAPI:_PerformPublish:#publishmessage): Invalid response from server: [${retVal.status}]`));
|
|
6768
|
+
}
|
|
6769
|
+
this.options.logger.debug(chalk$2.red(`Error (_PerformPublishRESTAPI:_PerformPublish:#publishmessage): Invalid response from server: [${retVal.status}]`));
|
|
6770
|
+
return false;
|
|
6771
|
+
} else {
|
|
6772
|
+
if (this.options.showPublishPayload) {
|
|
6773
|
+
console.log(chalk$2.grey(`PublishTransportRESTServer::Publish() _PerformPublishRESTAPI:_PerformPublish:#publishmessage: [${this.options.url}] - Valid response from server: [${retVal.status}]`));
|
|
6774
|
+
}
|
|
6775
|
+
}
|
|
6776
|
+
return true;
|
|
6777
|
+
} catch (error) {
|
|
6778
|
+
if (this.options.showPublishPayload) {
|
|
6779
|
+
console.log(chalk$2.red(`PublishTransportRESTServer::Publish() Error (PublishRESTServer:_PerformPublishRESTAPI:Error: [${error}]`));
|
|
6780
|
+
}
|
|
6781
|
+
return false;
|
|
6782
|
+
}
|
|
6783
|
+
});
|
|
6784
|
+
if (isNode) {
|
|
6785
|
+
__privateSet(this, _agentManager2, new AgentManager({
|
|
6786
|
+
agentOptions: this.options.agentOptions
|
|
6787
|
+
}));
|
|
6788
|
+
}
|
|
6789
|
+
}
|
|
6790
|
+
get options() {
|
|
6791
|
+
return super.options;
|
|
6792
|
+
}
|
|
6793
|
+
async Close() {
|
|
6794
|
+
if (__privateGet(this, _agentManager2)) {
|
|
6795
|
+
__privateGet(this, _agentManager2).Terminate();
|
|
6796
|
+
}
|
|
6797
|
+
return true;
|
|
6798
|
+
}
|
|
6799
|
+
}
|
|
6800
|
+
_agentManager2 = new WeakMap();
|
|
6801
|
+
class PublishInstruments extends STSOptionsBase {
|
|
6802
|
+
constructor(options) {
|
|
6803
|
+
super(options);
|
|
6804
|
+
__privateAdd(this, _PublishInstruments_instances);
|
|
6805
|
+
__privateAdd(this, _inPublish, false);
|
|
6806
|
+
__privateAdd(this, _observer2, null);
|
|
6807
|
+
__privateAdd(this, _publishState, 0);
|
|
6808
|
+
__privateAdd(this, _publisherTransport, null);
|
|
6809
|
+
__privateSet(this, _publisherTransport, null);
|
|
6810
|
+
switch (options.publishTransportBaseOptions.transportType) {
|
|
6811
|
+
case TransportType.RESTAPI:
|
|
6812
|
+
__privateSet(this, _publisherTransport, new PublishTransportRESTServer(options.publishTransportBaseOptions));
|
|
6813
|
+
break;
|
|
6814
|
+
}
|
|
6815
|
+
__privateMethod(this, _PublishInstruments_instances, UpdateState_fn).call(this, 0, "constructor()");
|
|
6816
|
+
}
|
|
6817
|
+
get options() {
|
|
6818
|
+
return super.options;
|
|
6819
|
+
}
|
|
6820
|
+
async Publish() {
|
|
6821
|
+
if (__privateGet(this, _inPublish)) {
|
|
6822
|
+
return false;
|
|
6823
|
+
}
|
|
6824
|
+
if (__privateGet(this, _publisherTransport)) {
|
|
6825
|
+
try {
|
|
6826
|
+
__privateSet(this, _inPublish, true);
|
|
6827
|
+
if (this.options.publishInstrumentController) {
|
|
6828
|
+
const instrumentPayload = this.options.publishInstrumentController.GetPayloadData();
|
|
6829
|
+
return await __privateGet(this, _publisherTransport).Publish(instrumentPayload);
|
|
6830
|
+
}
|
|
6831
|
+
return false;
|
|
6832
|
+
} catch (error) {
|
|
6833
|
+
return false;
|
|
6834
|
+
} finally {
|
|
6835
|
+
__privateSet(this, _inPublish, false);
|
|
6836
|
+
}
|
|
6837
|
+
} else {
|
|
6838
|
+
return false;
|
|
6839
|
+
}
|
|
6840
|
+
}
|
|
6841
|
+
async StartPublish() {
|
|
6842
|
+
if (__privateGet(this, _publishState) !== 0) {
|
|
6843
|
+
this.options.logger.debug(chalk$2.yellow(`StartPublish:${this.options.processContext.nid}: StartPublish called when not currently in the init state. Current State: [${__privateGet(this, _publishState)}]`));
|
|
6844
|
+
return false;
|
|
6845
|
+
}
|
|
6846
|
+
__privateMethod(this, _PublishInstruments_instances, UpdateState_fn).call(this, 1, "StartPublish()");
|
|
6847
|
+
__privateMethod(this, _PublishInstruments_instances, PublishTimeoutLoop_fn).call(this, this.options.publishInterval);
|
|
6848
|
+
return true;
|
|
6849
|
+
}
|
|
6850
|
+
async EndPublish() {
|
|
6851
|
+
if (__privateGet(this, _publishState) !== 1) {
|
|
6852
|
+
this.options.logger.debug(chalk$2.yellow(`EndPublish:${this.options.processContext.nid}: EndPublish called when not within the started state. Current State: [${__privateGet(this, _publishState)}]`));
|
|
6853
|
+
return false;
|
|
6854
|
+
}
|
|
6855
|
+
__privateMethod(this, _PublishInstruments_instances, UpdateState_fn).call(this, 2, "EndPublish() (1)");
|
|
6856
|
+
if (__privateGet(this, _observer2) !== null) {
|
|
6857
|
+
clearTimeout(__privateGet(this, _observer2));
|
|
6858
|
+
__privateSet(this, _observer2, null);
|
|
6859
|
+
await this.Publish();
|
|
6860
|
+
}
|
|
6861
|
+
if (__privateGet(this, _publisherTransport)) {
|
|
6862
|
+
await __privateGet(this, _publisherTransport).Close();
|
|
6863
|
+
}
|
|
6864
|
+
__privateMethod(this, _PublishInstruments_instances, UpdateState_fn).call(this, 0, "EndPublish() (2)");
|
|
6865
|
+
return true;
|
|
6866
|
+
}
|
|
6867
|
+
}
|
|
6868
|
+
_inPublish = new WeakMap();
|
|
4696
6869
|
_observer2 = new WeakMap();
|
|
4697
6870
|
_publishState = new WeakMap();
|
|
4698
6871
|
_publisherTransport = new WeakMap();
|
|
@@ -4716,7 +6889,7 @@ PublishTimeoutLoop_fn = function(publishInterval) {
|
|
|
4716
6889
|
UpdateState_fn = function(newState, comment) {
|
|
4717
6890
|
const previousState = __privateGet(this, _publishState);
|
|
4718
6891
|
__privateSet(this, _publishState, newState);
|
|
4719
|
-
this.options.logger.debug(chalk$
|
|
6892
|
+
this.options.logger.debug(chalk$2.yellow(`#UpdateState:${this.options.processContext.nid}: Previous State: [${previousState}]. Current State: [${__privateGet(this, _publishState)}]. Comment: [${comment}]`));
|
|
4720
6893
|
};
|
|
4721
6894
|
var ePublishState = /* @__PURE__ */ ((ePublishState2) => {
|
|
4722
6895
|
ePublishState2[ePublishState2["init"] = 0] = "init";
|
|
@@ -4779,11 +6952,11 @@ const _PublishInstrumentController = class _PublishInstrumentController extends
|
|
|
4779
6952
|
}
|
|
4780
6953
|
SetupInstrumentation() {
|
|
4781
6954
|
if (!this.options.instrumentDefinitions) {
|
|
4782
|
-
this.options.logger.debug(chalk$
|
|
6955
|
+
this.options.logger.debug(chalk$2.yellow(`SetupInstrumentation:${this.options.processContext.nid}: No instrument(s) defined within supplied options.`));
|
|
4783
6956
|
return;
|
|
4784
6957
|
}
|
|
4785
6958
|
if (!this.options.processContext) {
|
|
4786
|
-
this.options.logger.debug(chalk$
|
|
6959
|
+
this.options.logger.debug(chalk$2.yellow(`SetupInstrumentation: No context defined within supplied options.`));
|
|
4787
6960
|
return;
|
|
4788
6961
|
}
|
|
4789
6962
|
__privateMethod(this, _PublishInstrumentController_instances, CreateInstruments_fn).call(this, this.options.instrumentDefinitions);
|
|
@@ -4808,7 +6981,7 @@ const _PublishInstrumentController = class _PublishInstrumentController extends
|
|
|
4808
6981
|
if (__privateGet(this, _instruments)[instrumentName]) {
|
|
4809
6982
|
__privateMethod(this, _PublishInstrumentController_instances, ProcessTelemetryCommand_fn).call(this, instrumentName, telemetry);
|
|
4810
6983
|
} else {
|
|
4811
|
-
this.options.logger.debug(chalk$
|
|
6984
|
+
this.options.logger.debug(chalk$2.red(`UpdateInstrument:${this.options.processContext.nid}: Attempted to UpdateInstrument before initialised.`));
|
|
4812
6985
|
}
|
|
4813
6986
|
}
|
|
4814
6987
|
/**
|
|
@@ -4881,21 +7054,21 @@ const GetSTSInstrumentController = (app) => {
|
|
|
4881
7054
|
const STSInstrumentControllerPlugin = {
|
|
4882
7055
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4883
7056
|
install: (app, options) => {
|
|
4884
|
-
options.logger.debug(chalk$
|
|
7057
|
+
options.logger.debug(chalk$2.yellow(`STSInstrumentControllerPlugin:install:Start`));
|
|
4885
7058
|
const aic = new PublishInstrumentController(options);
|
|
4886
7059
|
if (!app.config.globalProperties.$sts) {
|
|
4887
|
-
options.logger.debug(chalk$
|
|
7060
|
+
options.logger.debug(chalk$2.cyan(`STSInstrumentControllerPlugin:install: [app.config.globalProperties.$sts] does not exist.`));
|
|
4888
7061
|
app.config.globalProperties.$sts = {};
|
|
4889
|
-
options.logger.debug(chalk$
|
|
7062
|
+
options.logger.debug(chalk$2.cyan(`STSInstrumentControllerPlugin:install: created empty [app.config.globalProperties.$sts].`));
|
|
4890
7063
|
} else {
|
|
4891
|
-
options.logger.debug(chalk$
|
|
7064
|
+
options.logger.debug(chalk$2.cyan(`STSInstrumentControllerPlugin:install: [app.config.globalProperties.$sts] already exists.`));
|
|
4892
7065
|
}
|
|
4893
7066
|
app.config.globalProperties.$sts.aic = aic;
|
|
4894
7067
|
app.config.globalProperties.$sts[STSInstrumentControllerPluginKey] = aic;
|
|
4895
|
-
options.logger.debug(chalk$
|
|
7068
|
+
options.logger.debug(chalk$2.cyan(`STSInstrumentControllerPlugin:install: AgentInstrumentController installed into [app.config.globalProperties.$sts] using: [${String(STSInstrumentControllerPluginKey)}].`));
|
|
4896
7069
|
app.provide(STSInstrumentControllerPluginKey, aic);
|
|
4897
|
-
options.logger.debug(chalk$
|
|
4898
|
-
options.logger.debug(chalk$
|
|
7070
|
+
options.logger.debug(chalk$2.cyan(`STSInstrumentControllerPlugin:install: AgentInstrumentController installed into 'provide' using: [${String(STSInstrumentControllerPluginKey)}].`));
|
|
7071
|
+
options.logger.debug(chalk$2.green(`STSInstrumentControllerPlugin:install:End`));
|
|
4899
7072
|
}
|
|
4900
7073
|
};
|
|
4901
7074
|
var SubscriptionTopic = /* @__PURE__ */ ((SubscriptionTopic2) => {
|
|
@@ -5490,7 +7663,7 @@ class ObservabilityRESTAPISubscriber {
|
|
|
5490
7663
|
constructor(options) {
|
|
5491
7664
|
__privateAdd(this, _ObservabilityRESTAPISubscriber_instances);
|
|
5492
7665
|
__privateAdd(this, _socketSubscribeKeepAlive, {});
|
|
5493
|
-
__privateAdd(this,
|
|
7666
|
+
__privateAdd(this, _options3);
|
|
5494
7667
|
// This is required becuase each call to .bind create a new replica bound function - so we need the same instance for on/off event bindings.
|
|
5495
7668
|
__publicField(this, "KeepAliveAckBoundFunction");
|
|
5496
7669
|
__privateAdd(this, _GetData, async (subscription) => {
|
|
@@ -5504,11 +7677,11 @@ class ObservabilityRESTAPISubscriber {
|
|
|
5504
7677
|
subscription.cb(payload);
|
|
5505
7678
|
}
|
|
5506
7679
|
} catch (error) {
|
|
5507
|
-
__privateMethod(this, _ObservabilityRESTAPISubscriber_instances, LogErrorMessage_fn).call(this, chalk$
|
|
7680
|
+
__privateMethod(this, _ObservabilityRESTAPISubscriber_instances, LogErrorMessage_fn).call(this, chalk$2.red(`ObservabilityRESTAPISubscriber:#AddKeepAlive(): Error response: [${JSON.stringify(error)}]`));
|
|
5508
7681
|
__privateMethod(this, _ObservabilityRESTAPISubscriber_instances, RemoveKeepAlive_fn).call(this, subscription);
|
|
5509
7682
|
}
|
|
5510
7683
|
});
|
|
5511
|
-
__privateSet(this,
|
|
7684
|
+
__privateSet(this, _options3, options);
|
|
5512
7685
|
}
|
|
5513
7686
|
SubscribeOne(subscription) {
|
|
5514
7687
|
this.Subscribe([subscription]);
|
|
@@ -5516,11 +7689,11 @@ class ObservabilityRESTAPISubscriber {
|
|
|
5516
7689
|
async Subscribe(subscriptions) {
|
|
5517
7690
|
subscriptions.map(async (subId) => {
|
|
5518
7691
|
__privateMethod(this, _ObservabilityRESTAPISubscriber_instances, RemoveKeepAlive_fn).call(this, subId);
|
|
5519
|
-
__privateMethod(this, _ObservabilityRESTAPISubscriber_instances, LogDebugMessage_fn).call(this, chalk$
|
|
7692
|
+
__privateMethod(this, _ObservabilityRESTAPISubscriber_instances, LogDebugMessage_fn).call(this, chalk$2.yellow(`ObservabilityRESTAPISubscriber:Subscribe(): Sending subscribe: subscriptionKey: [${subId.subscriptionKey.id}]`));
|
|
5520
7693
|
try {
|
|
5521
7694
|
__privateMethod(this, _ObservabilityRESTAPISubscriber_instances, AddKeepAlive_fn).call(this, subId);
|
|
5522
7695
|
} catch (error) {
|
|
5523
|
-
__privateMethod(this, _ObservabilityRESTAPISubscriber_instances, LogErrorMessage_fn).call(this, chalk$
|
|
7696
|
+
__privateMethod(this, _ObservabilityRESTAPISubscriber_instances, LogErrorMessage_fn).call(this, chalk$2.red(`ObservabilityRESTAPISubscriber:Subscribe(): Error: response: [${JSON.stringify(error)}]`));
|
|
5524
7697
|
__privateMethod(this, _ObservabilityRESTAPISubscriber_instances, RemoveKeepAlive_fn).call(this, subId);
|
|
5525
7698
|
}
|
|
5526
7699
|
});
|
|
@@ -5531,18 +7704,18 @@ class ObservabilityRESTAPISubscriber {
|
|
|
5531
7704
|
UnSubscribe(subscriptions) {
|
|
5532
7705
|
subscriptions.map(async (subId) => {
|
|
5533
7706
|
__privateMethod(this, _ObservabilityRESTAPISubscriber_instances, RemoveKeepAlive_fn).call(this, subId);
|
|
5534
|
-
__privateMethod(this, _ObservabilityRESTAPISubscriber_instances, LogDebugMessage_fn).call(this, chalk$
|
|
7707
|
+
__privateMethod(this, _ObservabilityRESTAPISubscriber_instances, LogDebugMessage_fn).call(this, chalk$2.yellow(`ObservabilityRESTAPISubscriber:UnSubscribe(): Sending unsubscribe: subscriptionKey: [${subId.subscriptionKey.id}]`));
|
|
5535
7708
|
});
|
|
5536
7709
|
}
|
|
5537
7710
|
}
|
|
5538
7711
|
_socketSubscribeKeepAlive = new WeakMap();
|
|
5539
|
-
|
|
7712
|
+
_options3 = new WeakMap();
|
|
5540
7713
|
_ObservabilityRESTAPISubscriber_instances = new WeakSet();
|
|
5541
7714
|
LogDebugMessage_fn = function(message) {
|
|
5542
|
-
__privateGet(this,
|
|
7715
|
+
__privateGet(this, _options3).logger.debug(message);
|
|
5543
7716
|
};
|
|
5544
7717
|
LogErrorMessage_fn = function(message) {
|
|
5545
|
-
__privateGet(this,
|
|
7718
|
+
__privateGet(this, _options3).logger.error(message);
|
|
5546
7719
|
};
|
|
5547
7720
|
InvokeRESTAPI_fn = async function(subscription) {
|
|
5548
7721
|
const { subscriptionKey } = subscription;
|
|
@@ -5612,19 +7785,19 @@ InvokeRESTAPI_fn = async function(subscription) {
|
|
|
5612
7785
|
}
|
|
5613
7786
|
}
|
|
5614
7787
|
if (url.localeCompare("") !== 0) {
|
|
5615
|
-
const endPointUrl = `${__privateGet(this,
|
|
7788
|
+
const endPointUrl = `${__privateGet(this, _options3).urlBase}${url}`;
|
|
5616
7789
|
const headers = {
|
|
5617
7790
|
"Content-Type": "application/json"
|
|
5618
7791
|
};
|
|
5619
7792
|
let retVal;
|
|
5620
7793
|
const start = performance.now();
|
|
5621
7794
|
try {
|
|
5622
|
-
if (isNode && __privateGet(this,
|
|
7795
|
+
if (isNode && __privateGet(this, _options3).agent) {
|
|
5623
7796
|
retVal = await axios({
|
|
5624
7797
|
url: endPointUrl,
|
|
5625
7798
|
method: "get",
|
|
5626
7799
|
headers,
|
|
5627
|
-
httpsAgent: __privateGet(this,
|
|
7800
|
+
httpsAgent: __privateGet(this, _options3).agent
|
|
5628
7801
|
});
|
|
5629
7802
|
} else {
|
|
5630
7803
|
retVal = await axios({
|
|
@@ -5661,16 +7834,16 @@ SetupTimeout_fn = function(socketSubscribeKeepAlive, subscription, timeout) {
|
|
|
5661
7834
|
if (socketSubscribeKeepAlive.timeout) {
|
|
5662
7835
|
const end = performance.now();
|
|
5663
7836
|
const diff = end - start;
|
|
5664
|
-
let timeoutDuration = __privateGet(this,
|
|
7837
|
+
let timeoutDuration = __privateGet(this, _options3).keepAlive - diff;
|
|
5665
7838
|
if (timeoutDuration < 500) {
|
|
5666
7839
|
timeoutDuration = 500;
|
|
5667
7840
|
}
|
|
5668
7841
|
socketSubscribeKeepAlive.timeout = __privateMethod(this, _ObservabilityRESTAPISubscriber_instances, SetupTimeout_fn).call(this, socketSubscribeKeepAlive, subscription, timeoutDuration);
|
|
5669
7842
|
} else {
|
|
5670
|
-
__privateMethod(this, _ObservabilityRESTAPISubscriber_instances, LogDebugMessage_fn).call(this, chalk$
|
|
7843
|
+
__privateMethod(this, _ObservabilityRESTAPISubscriber_instances, LogDebugMessage_fn).call(this, chalk$2.yellow(`Subscription removed: [${socketSubscribeKeepAlive.id}]. Processing terminate.`));
|
|
5671
7844
|
}
|
|
5672
7845
|
} catch (error) {
|
|
5673
|
-
__privateMethod(this, _ObservabilityRESTAPISubscriber_instances, LogErrorMessage_fn).call(this, chalk$
|
|
7846
|
+
__privateMethod(this, _ObservabilityRESTAPISubscriber_instances, LogErrorMessage_fn).call(this, chalk$2.red(`ObservabilityRESTAPISubscriber:#AddKeepAlive(): Error response: [${JSON.stringify(error)}]`));
|
|
5674
7847
|
__privateMethod(this, _ObservabilityRESTAPISubscriber_instances, RemoveKeepAlive_fn).call(this, subscription);
|
|
5675
7848
|
}
|
|
5676
7849
|
}, timeout);
|
|
@@ -5680,13 +7853,13 @@ AddKeepAlive_fn = function(subscription) {
|
|
|
5680
7853
|
const socketSubscribeKeepAlive = {
|
|
5681
7854
|
id: subscription.subscriptionKey.id
|
|
5682
7855
|
};
|
|
5683
|
-
socketSubscribeKeepAlive.timeout = __privateMethod(this, _ObservabilityRESTAPISubscriber_instances, SetupTimeout_fn).call(this, socketSubscribeKeepAlive, subscription, __privateGet(this,
|
|
7856
|
+
socketSubscribeKeepAlive.timeout = __privateMethod(this, _ObservabilityRESTAPISubscriber_instances, SetupTimeout_fn).call(this, socketSubscribeKeepAlive, subscription, __privateGet(this, _options3).keepAlive);
|
|
5684
7857
|
__privateGet(this, _socketSubscribeKeepAlive)[subscription.subscriptionKey.id] = socketSubscribeKeepAlive;
|
|
5685
7858
|
__privateGet(this, _GetData).call(this, subscription);
|
|
5686
7859
|
};
|
|
5687
7860
|
RemoveKeepAlive_fn = function(subscription) {
|
|
5688
7861
|
if (__privateGet(this, _socketSubscribeKeepAlive)[subscription.subscriptionKey.id]) {
|
|
5689
|
-
__privateMethod(this, _ObservabilityRESTAPISubscriber_instances, LogDebugMessage_fn).call(this, chalk$
|
|
7862
|
+
__privateMethod(this, _ObservabilityRESTAPISubscriber_instances, LogDebugMessage_fn).call(this, chalk$2.gray(`ObservabilityRESTAPISubscriber:#RemoveKeepAlive(): subscriptionKey: [${subscription.subscriptionKey.id}]`));
|
|
5690
7863
|
clearTimeout(__privateGet(this, _socketSubscribeKeepAlive)[subscription.subscriptionKey.id].timeout);
|
|
5691
7864
|
delete __privateGet(this, _socketSubscribeKeepAlive)[subscription.subscriptionKey.id].timeout;
|
|
5692
7865
|
delete __privateGet(this, _socketSubscribeKeepAlive)[subscription.subscriptionKey.id];
|
|
@@ -5748,15 +7921,15 @@ class SocketIoMessageSender {
|
|
|
5748
7921
|
//@@
|
|
5749
7922
|
__privateAdd(this, _timeoutValue, 5e3);
|
|
5750
7923
|
//@@
|
|
5751
|
-
__privateAdd(this,
|
|
5752
|
-
__privateSet(this,
|
|
7924
|
+
__privateAdd(this, _options4);
|
|
7925
|
+
__privateSet(this, _options4, options);
|
|
5753
7926
|
__privateSet(this, _socket, options.socket);
|
|
5754
7927
|
}
|
|
5755
7928
|
get socket() {
|
|
5756
7929
|
return __privateGet(this, _socket);
|
|
5757
7930
|
}
|
|
5758
7931
|
set socket(socket) {
|
|
5759
|
-
__privateMethod(this, _SocketIoMessageSender_instances, LogDebugMessage_fn2).call(this, chalk$
|
|
7932
|
+
__privateMethod(this, _SocketIoMessageSender_instances, LogDebugMessage_fn2).call(this, chalk$2.cyan(`SocketIoMessageSender:set socket(): new socket assigned`));
|
|
5760
7933
|
__privateSet(this, _socket, socket);
|
|
5761
7934
|
}
|
|
5762
7935
|
AckListener(message, payload) {
|
|
@@ -5769,25 +7942,25 @@ class SocketIoMessageSender {
|
|
|
5769
7942
|
message.status = "SUCCESS";
|
|
5770
7943
|
message.subscriptionKeyResponse = payload;
|
|
5771
7944
|
delete __privateGet(this, _messageWithAckPayloadRecords)[message.id];
|
|
5772
|
-
__privateMethod(this, _SocketIoMessageSender_instances, LogDebugMessage_fn2).call(this, chalk$
|
|
7945
|
+
__privateMethod(this, _SocketIoMessageSender_instances, LogDebugMessage_fn2).call(this, chalk$2.grey(`SocketIoMessageSender:AckListener(): ack received, event: [${message.eventName}], subscriptionKey: [${message.subscriptionKey.id}]`));
|
|
5773
7946
|
message.resolve(message);
|
|
5774
7947
|
}
|
|
5775
7948
|
}
|
|
5776
7949
|
ResponseTimout(message) {
|
|
5777
|
-
__privateMethod(this, _SocketIoMessageSender_instances, LogDebugMessage_fn2).call(this, chalk$
|
|
7950
|
+
__privateMethod(this, _SocketIoMessageSender_instances, LogDebugMessage_fn2).call(this, chalk$2.magenta(`SocketIoMessageSender:ResponseTimout(): timeout reached: [${__privateGet(this, _timeoutValue)}], event: [${message.eventName}], subscriptionKey: [${message.subscriptionKey.id}]`));
|
|
5778
7951
|
delete message.timeoutId;
|
|
5779
7952
|
__privateGet(this, _socket).off(__privateMethod(this, _SocketIoMessageSender_instances, GetSubscribeKeepAliveAckEventName_fn).call(this, message.eventName, message.subscriptionKey), message.BoundAckListenerCallback);
|
|
5780
7953
|
message.endTime = performance.now();
|
|
5781
7954
|
if (message.retryCount >= __privateGet(this, _maxReties)) {
|
|
5782
7955
|
message.status = "FAIL";
|
|
5783
|
-
__privateMethod(this, _SocketIoMessageSender_instances, LogDebugMessage_fn2).call(this, chalk$
|
|
7956
|
+
__privateMethod(this, _SocketIoMessageSender_instances, LogDebugMessage_fn2).call(this, chalk$2.red(`SocketIoMessageSender:ResponseTimout(): timeout reached after ${__privateGet(this, _maxReties)} retries, event: [${message.eventName}], subscriptionKey: [${message.subscriptionKey.id}]`));
|
|
5784
7957
|
delete __privateGet(this, _messageWithAckPayloadRecords)[message.id];
|
|
5785
7958
|
message.reject(message);
|
|
5786
7959
|
return;
|
|
5787
7960
|
}
|
|
5788
7961
|
message.status = "INRETRY";
|
|
5789
7962
|
message.retryCount++;
|
|
5790
|
-
__privateMethod(this, _SocketIoMessageSender_instances, LogDebugMessage_fn2).call(this, chalk$
|
|
7963
|
+
__privateMethod(this, _SocketIoMessageSender_instances, LogDebugMessage_fn2).call(this, chalk$2.magenta(`SocketIoMessageSender:ResponseTimout(): timeout reached, retrying. Retries: [${message.retryCount}], event: [${message.eventName}], subscriptionKey: [${message.subscriptionKey.id}]`));
|
|
5791
7964
|
this.SendMessage(message);
|
|
5792
7965
|
}
|
|
5793
7966
|
SendMessage(message) {
|
|
@@ -5800,7 +7973,7 @@ class SocketIoMessageSender {
|
|
|
5800
7973
|
};
|
|
5801
7974
|
message.BoundAckListenerCallback = AckListenerCallback.bind(this);
|
|
5802
7975
|
__privateGet(this, _socket).on(__privateMethod(this, _SocketIoMessageSender_instances, GetSubscribeKeepAliveAckEventName_fn).call(this, message.eventName, message.subscriptionKey), message.BoundAckListenerCallback);
|
|
5803
|
-
__privateMethod(this, _SocketIoMessageSender_instances, LogDebugMessage_fn2).call(this, chalk$
|
|
7976
|
+
__privateMethod(this, _SocketIoMessageSender_instances, LogDebugMessage_fn2).call(this, chalk$2.gray(`SocketIoMessageSender:SendMessage(): event: [${message.eventName}], subscriptionKey: [${message.subscriptionKey.id}]`));
|
|
5804
7977
|
__privateGet(this, _socket).emit(message.eventName, message.subscriptionKey);
|
|
5805
7978
|
}
|
|
5806
7979
|
SendMessageWithAck(eventName, subscriptionKey) {
|
|
@@ -5824,7 +7997,7 @@ class SocketIoMessageSender {
|
|
|
5824
7997
|
const killIds = [];
|
|
5825
7998
|
for (const [, message] of Object.entries(__privateGet(this, _messageWithAckPayloadRecords))) {
|
|
5826
7999
|
if (message.subscriptionKey.id.localeCompare(subscriptionKey.id) === 0) {
|
|
5827
|
-
__privateMethod(this, _SocketIoMessageSender_instances, LogDebugMessage_fn2).call(this, chalk$
|
|
8000
|
+
__privateMethod(this, _SocketIoMessageSender_instances, LogDebugMessage_fn2).call(this, chalk$2.blue(`SocketIoMessageSender:KillMessageInFlight(): event: [${message.eventName}], subscriptionKey: [${message.subscriptionKey.id}]`));
|
|
5828
8001
|
clearTimeout(message.timeoutId);
|
|
5829
8002
|
delete message.timeoutId;
|
|
5830
8003
|
__privateGet(this, _socket).off(__privateMethod(this, _SocketIoMessageSender_instances, GetSubscribeKeepAliveAckEventName_fn).call(this, message.eventName, message.subscriptionKey), message.BoundAckListenerCallback);
|
|
@@ -5842,10 +8015,10 @@ _messageWithAckPayloadRecords = new WeakMap();
|
|
|
5842
8015
|
_socket = new WeakMap();
|
|
5843
8016
|
_maxReties = new WeakMap();
|
|
5844
8017
|
_timeoutValue = new WeakMap();
|
|
5845
|
-
|
|
8018
|
+
_options4 = new WeakMap();
|
|
5846
8019
|
_SocketIoMessageSender_instances = new WeakSet();
|
|
5847
8020
|
LogDebugMessage_fn2 = function(message) {
|
|
5848
|
-
__privateGet(this,
|
|
8021
|
+
__privateGet(this, _options4).logger.debug(message);
|
|
5849
8022
|
};
|
|
5850
8023
|
GetSubscribeKeepAliveAckEventName_fn = function(eventName, subscriptionKey) {
|
|
5851
8024
|
return `${eventName}Ack_${subscriptionKey.id}`;
|
|
@@ -5855,22 +8028,22 @@ class ObservabilitySocketIOSubscriber {
|
|
|
5855
8028
|
__privateAdd(this, _ObservabilitySocketIOSubscriber_instances);
|
|
5856
8029
|
__privateAdd(this, _socketSubscribeKeepAlive2, {});
|
|
5857
8030
|
__privateAdd(this, _socket2);
|
|
5858
|
-
__privateAdd(this,
|
|
8031
|
+
__privateAdd(this, _options5);
|
|
5859
8032
|
__privateAdd(this, _socketIoMessageSender);
|
|
5860
8033
|
// This is required becuase each call to .bind create a new replica bound function - so we need the same instance for on/off event bindings.
|
|
5861
8034
|
__publicField(this, "KeepAliveAckBoundFunction");
|
|
5862
|
-
__privateSet(this,
|
|
8035
|
+
__privateSet(this, _options5, options);
|
|
5863
8036
|
__privateSet(this, _socket2, options.socket);
|
|
5864
8037
|
__privateSet(this, _socketIoMessageSender, new SocketIoMessageSender({
|
|
5865
8038
|
socket: __privateGet(this, _socket2),
|
|
5866
|
-
logger: __privateGet(this,
|
|
8039
|
+
logger: __privateGet(this, _options5).logger
|
|
5867
8040
|
}));
|
|
5868
8041
|
}
|
|
5869
8042
|
get socket() {
|
|
5870
8043
|
return __privateGet(this, _socket2);
|
|
5871
8044
|
}
|
|
5872
8045
|
set socket(socket) {
|
|
5873
|
-
__privateMethod(this, _ObservabilitySocketIOSubscriber_instances, LogDebugMessage_fn3).call(this, chalk$
|
|
8046
|
+
__privateMethod(this, _ObservabilitySocketIOSubscriber_instances, LogDebugMessage_fn3).call(this, chalk$2.cyan(`ObservabilitySocketIOSubscriber:set socket(): new socket assigned`));
|
|
5874
8047
|
__privateSet(this, _socket2, socket);
|
|
5875
8048
|
__privateGet(this, _socketIoMessageSender).socket = socket;
|
|
5876
8049
|
}
|
|
@@ -5881,14 +8054,14 @@ class ObservabilitySocketIOSubscriber {
|
|
|
5881
8054
|
const socket = __privateGet(this, _socket2);
|
|
5882
8055
|
subscriptions.map(async (subId) => {
|
|
5883
8056
|
__privateMethod(this, _ObservabilitySocketIOSubscriber_instances, RemoveKeepAlive_fn2).call(this, subId);
|
|
5884
|
-
__privateMethod(this, _ObservabilitySocketIOSubscriber_instances, LogDebugMessage_fn3).call(this, chalk$
|
|
8057
|
+
__privateMethod(this, _ObservabilitySocketIOSubscriber_instances, LogDebugMessage_fn3).call(this, chalk$2.yellow(`ObservabilitySocketIOSubscriber:Subscribe(): Sending subscribe: subscriptionKey: [${subId.subscriptionKey.id}]`));
|
|
5885
8058
|
try {
|
|
5886
8059
|
const retVal = await __privateGet(this, _socketIoMessageSender).SendMessageWithAck("subscribe", subId.subscriptionKey);
|
|
5887
|
-
__privateMethod(this, _ObservabilitySocketIOSubscriber_instances, LogDebugMessage_fn3).call(this, chalk$
|
|
8060
|
+
__privateMethod(this, _ObservabilitySocketIOSubscriber_instances, LogDebugMessage_fn3).call(this, chalk$2.green(`ObservabilitySocketIOSubscriber:Subscribe(): SendMessageWithAck response: [${JSON.stringify(retVal)}]`));
|
|
5888
8061
|
__privateMethod(this, _ObservabilitySocketIOSubscriber_instances, AddKeepAlive_fn2).call(this, socket, subId);
|
|
5889
8062
|
socket.on(GetSocketIOSubscriptionKey(subId.subscriptionKey), subId.cb);
|
|
5890
8063
|
} catch (error) {
|
|
5891
|
-
__privateMethod(this, _ObservabilitySocketIOSubscriber_instances, LogErrorMessage_fn2).call(this, chalk$
|
|
8064
|
+
__privateMethod(this, _ObservabilitySocketIOSubscriber_instances, LogErrorMessage_fn2).call(this, chalk$2.red(`ObservabilitySocketIOSubscriber:Subscribe(): Error: response: [${JSON.stringify(error)}]`));
|
|
5892
8065
|
socket.off(GetSocketIOSubscriptionKey(subId.subscriptionKey), subId.cb);
|
|
5893
8066
|
__privateMethod(this, _ObservabilitySocketIOSubscriber_instances, RemoveKeepAlive_fn2).call(this, subId);
|
|
5894
8067
|
}
|
|
@@ -5903,12 +8076,12 @@ class ObservabilitySocketIOSubscriber {
|
|
|
5903
8076
|
socket.off(GetSocketIOSubscriptionKey(subId.subscriptionKey), subId.cb);
|
|
5904
8077
|
__privateMethod(this, _ObservabilitySocketIOSubscriber_instances, RemoveKeepAlive_fn2).call(this, subId);
|
|
5905
8078
|
__privateGet(this, _socketIoMessageSender).KillMessageInFlight(subId.subscriptionKey);
|
|
5906
|
-
__privateMethod(this, _ObservabilitySocketIOSubscriber_instances, LogDebugMessage_fn3).call(this, chalk$
|
|
8079
|
+
__privateMethod(this, _ObservabilitySocketIOSubscriber_instances, LogDebugMessage_fn3).call(this, chalk$2.yellow(`ObservabilitySocketIOSubscriber:UnSubscribe(): Sending unsubscribe: subscriptionKey: [${subId.subscriptionKey.id}]`));
|
|
5907
8080
|
try {
|
|
5908
8081
|
const retVal = await __privateGet(this, _socketIoMessageSender).SendMessageWithAck("unsubscribe", subId.subscriptionKey);
|
|
5909
|
-
__privateMethod(this, _ObservabilitySocketIOSubscriber_instances, LogDebugMessage_fn3).call(this, chalk$
|
|
8082
|
+
__privateMethod(this, _ObservabilitySocketIOSubscriber_instances, LogDebugMessage_fn3).call(this, chalk$2.green(`ObservabilitySocketIOSubscriber:UnSubscribe(): SendMessageWithAck response: [${JSON.stringify(retVal)}]`));
|
|
5910
8083
|
} catch (error) {
|
|
5911
|
-
__privateMethod(this, _ObservabilitySocketIOSubscriber_instances, LogErrorMessage_fn2).call(this, chalk$
|
|
8084
|
+
__privateMethod(this, _ObservabilitySocketIOSubscriber_instances, LogErrorMessage_fn2).call(this, chalk$2.red(`ObservabilitySocketIOSubscriber:UnSubscribe(): Error response: [${JSON.stringify(error)}]`));
|
|
5912
8085
|
}
|
|
5913
8086
|
});
|
|
5914
8087
|
}
|
|
@@ -5928,36 +8101,36 @@ class ObservabilitySocketIOSubscriber {
|
|
|
5928
8101
|
}
|
|
5929
8102
|
_socketSubscribeKeepAlive2 = new WeakMap();
|
|
5930
8103
|
_socket2 = new WeakMap();
|
|
5931
|
-
|
|
8104
|
+
_options5 = new WeakMap();
|
|
5932
8105
|
_socketIoMessageSender = new WeakMap();
|
|
5933
8106
|
_ObservabilitySocketIOSubscriber_instances = new WeakSet();
|
|
5934
8107
|
LogDebugMessage_fn3 = function(message) {
|
|
5935
|
-
__privateGet(this,
|
|
8108
|
+
__privateGet(this, _options5).logger.debug(message);
|
|
5936
8109
|
};
|
|
5937
8110
|
LogErrorMessage_fn2 = function(message) {
|
|
5938
|
-
__privateGet(this,
|
|
8111
|
+
__privateGet(this, _options5).logger.error(message);
|
|
5939
8112
|
};
|
|
5940
8113
|
AddKeepAlive_fn2 = function(socket, subscription) {
|
|
5941
8114
|
__privateMethod(this, _ObservabilitySocketIOSubscriber_instances, RemoveKeepAlive_fn2).call(this, subscription);
|
|
5942
8115
|
__privateGet(this, _socketSubscribeKeepAlive2)[subscription.subscriptionKey.id] = {
|
|
5943
8116
|
id: subscription.subscriptionKey.id,
|
|
5944
8117
|
timeout: setTimeout(async () => {
|
|
5945
|
-
__privateMethod(this, _ObservabilitySocketIOSubscriber_instances, LogDebugMessage_fn3).call(this, chalk$
|
|
8118
|
+
__privateMethod(this, _ObservabilitySocketIOSubscriber_instances, LogDebugMessage_fn3).call(this, chalk$2.yellow(`ObservabilitySocketIOSubscriber:#AddKeepAlive:timeoutCheck(): Sending keepAlive: subscriptionKey: [${subscription.subscriptionKey.id}]`));
|
|
5946
8119
|
try {
|
|
5947
8120
|
const retVal = await __privateGet(this, _socketIoMessageSender).SendMessageWithAck("subscribeKeepAlive", subscription.subscriptionKey);
|
|
5948
|
-
__privateMethod(this, _ObservabilitySocketIOSubscriber_instances, LogDebugMessage_fn3).call(this, chalk$
|
|
8121
|
+
__privateMethod(this, _ObservabilitySocketIOSubscriber_instances, LogDebugMessage_fn3).call(this, chalk$2.green(`ObservabilitySocketIOSubscriber:#AddKeepAlive(): SendMessageWithAck response: [${JSON.stringify(retVal)}]`));
|
|
5949
8122
|
__privateMethod(this, _ObservabilitySocketIOSubscriber_instances, AddKeepAlive_fn2).call(this, socket, subscription);
|
|
5950
8123
|
} catch (error) {
|
|
5951
|
-
__privateMethod(this, _ObservabilitySocketIOSubscriber_instances, LogErrorMessage_fn2).call(this, chalk$
|
|
8124
|
+
__privateMethod(this, _ObservabilitySocketIOSubscriber_instances, LogErrorMessage_fn2).call(this, chalk$2.red(`ObservabilitySocketIOSubscriber:#AddKeepAlive(): Error response: [${JSON.stringify(error)}]`));
|
|
5952
8125
|
socket.off(GetSocketIOSubscriptionKey(subscription.subscriptionKey), subscription.cb);
|
|
5953
8126
|
__privateMethod(this, _ObservabilitySocketIOSubscriber_instances, RemoveKeepAlive_fn2).call(this, subscription);
|
|
5954
8127
|
}
|
|
5955
|
-
}, __privateGet(this,
|
|
8128
|
+
}, __privateGet(this, _options5).keepAlive)
|
|
5956
8129
|
};
|
|
5957
8130
|
};
|
|
5958
8131
|
RemoveKeepAlive_fn2 = function(subscription) {
|
|
5959
8132
|
if (__privateGet(this, _socketSubscribeKeepAlive2)[subscription.subscriptionKey.id]) {
|
|
5960
|
-
__privateMethod(this, _ObservabilitySocketIOSubscriber_instances, LogDebugMessage_fn3).call(this, chalk$
|
|
8133
|
+
__privateMethod(this, _ObservabilitySocketIOSubscriber_instances, LogDebugMessage_fn3).call(this, chalk$2.gray(`ObservabilitySocketIOSubscriber:#RemoveKeepAlive(): subscriptionKey: [${subscription.subscriptionKey.id}]`));
|
|
5961
8134
|
clearTimeout(__privateGet(this, _socketSubscribeKeepAlive2)[subscription.subscriptionKey.id].timeout);
|
|
5962
8135
|
delete __privateGet(this, _socketSubscribeKeepAlive2)[subscription.subscriptionKey.id];
|
|
5963
8136
|
}
|
|
@@ -5971,10 +8144,10 @@ class ObservabilitySubscriptionManager {
|
|
|
5971
8144
|
__privateAdd(this, _serviceModel, {});
|
|
5972
8145
|
__privateAdd(this, _agentModel, {});
|
|
5973
8146
|
__privateAdd(this, _lambdaModel, {});
|
|
5974
|
-
__privateAdd(this,
|
|
5975
|
-
__privateSet(this,
|
|
8147
|
+
__privateAdd(this, _options6);
|
|
8148
|
+
__privateSet(this, _options6, options);
|
|
5976
8149
|
__privateSet(this, _kafkaHelper, new KafkaHelper({
|
|
5977
|
-
maxLogLength: __privateGet(this,
|
|
8150
|
+
maxLogLength: __privateGet(this, _options6).maxLogLength
|
|
5978
8151
|
}));
|
|
5979
8152
|
}
|
|
5980
8153
|
get observabilitySocketIOSubscriber() {
|
|
@@ -6004,7 +8177,7 @@ class ObservabilitySubscriptionManager {
|
|
|
6004
8177
|
subscriptions.map((subscription) => {
|
|
6005
8178
|
const retVal = this.subscriptions.find((v) => v.subscriptionKey.id.localeCompare(subscription.subscriptionKey.id) === 0);
|
|
6006
8179
|
if (retVal) {
|
|
6007
|
-
__privateMethod(this, _ObservabilitySubscriptionManager_instances, LogDebugMessage_fn4).call(this, chalk$
|
|
8180
|
+
__privateMethod(this, _ObservabilitySubscriptionManager_instances, LogDebugMessage_fn4).call(this, chalk$2.magenta(`AddSubscription(): Subscription: [${retVal.subscriptionKey.id}] already exists - ignoring.`));
|
|
6008
8181
|
} else {
|
|
6009
8182
|
subscriptionsToAdd.push(subscription);
|
|
6010
8183
|
}
|
|
@@ -6013,7 +8186,7 @@ class ObservabilitySubscriptionManager {
|
|
|
6013
8186
|
subscriptionsToAdd.map((s) => this.subscriptions.push(s));
|
|
6014
8187
|
(_a2 = __privateGet(this, _observabilitySocketIOSubscriber)) == null ? void 0 : _a2.Subscribe(subscriptionsToAdd);
|
|
6015
8188
|
} else {
|
|
6016
|
-
__privateMethod(this, _ObservabilitySubscriptionManager_instances, LogDebugMessage_fn4).call(this, chalk$
|
|
8189
|
+
__privateMethod(this, _ObservabilitySubscriptionManager_instances, LogDebugMessage_fn4).call(this, chalk$2.magenta(`AddSubscription(): No valid subscriptions to subscribe.`));
|
|
6017
8190
|
}
|
|
6018
8191
|
}
|
|
6019
8192
|
RemoveSubscriptionsByKey(keyToFind) {
|
|
@@ -6106,9 +8279,9 @@ class ObservabilitySubscriptionManager {
|
|
|
6106
8279
|
try {
|
|
6107
8280
|
__privateSet(this, _serviceModel, {});
|
|
6108
8281
|
if (subscriptionPayload.subscriptionKey.topic.localeCompare(SubscriptionTopic.AllServicesCombined.toString()) === 0) {
|
|
6109
|
-
__privateGet(this, _serviceModel)["STS-Service"] = ObservabilityModelUtils.GetModelForService("STS-Service", subscriptionPayload.data, subscribeToKafka, __privateGet(this,
|
|
8282
|
+
__privateGet(this, _serviceModel)["STS-Service"] = ObservabilityModelUtils.GetModelForService("STS-Service", subscriptionPayload.data, subscribeToKafka, __privateGet(this, _options6).logger);
|
|
6110
8283
|
if (__privateGet(this, _serviceModel)["STS-Service"] === null) {
|
|
6111
|
-
__privateMethod(this, _ObservabilitySubscriptionManager_instances, LogDebugMessage_fn4).call(this, chalk$
|
|
8284
|
+
__privateMethod(this, _ObservabilitySubscriptionManager_instances, LogDebugMessage_fn4).call(this, chalk$2.red(`CreateModelAllServicesCombined():Error: GetModelForService() returned null`));
|
|
6112
8285
|
}
|
|
6113
8286
|
}
|
|
6114
8287
|
} catch (error) {
|
|
@@ -6121,9 +8294,9 @@ class ObservabilitySubscriptionManager {
|
|
|
6121
8294
|
try {
|
|
6122
8295
|
__privateSet(this, _serviceModel, {});
|
|
6123
8296
|
for (const [serviceId, serviceTelemetry] of Object.entries(subscriptionPayload.data)) {
|
|
6124
|
-
__privateGet(this, _serviceModel)[serviceId] = ObservabilityModelUtils.GetModelForService(serviceId, serviceTelemetry, subscribeToKafka, __privateGet(this,
|
|
8297
|
+
__privateGet(this, _serviceModel)[serviceId] = ObservabilityModelUtils.GetModelForService(serviceId, serviceTelemetry, subscribeToKafka, __privateGet(this, _options6).logger);
|
|
6125
8298
|
if (__privateGet(this, _serviceModel)[serviceId] === null) {
|
|
6126
|
-
__privateMethod(this, _ObservabilitySubscriptionManager_instances, LogDebugMessage_fn4).call(this, chalk$
|
|
8299
|
+
__privateMethod(this, _ObservabilitySubscriptionManager_instances, LogDebugMessage_fn4).call(this, chalk$2.red(`CreateModelServices():Error: GetModelForService() returned null`));
|
|
6127
8300
|
}
|
|
6128
8301
|
}
|
|
6129
8302
|
} catch (error) {
|
|
@@ -6138,7 +8311,7 @@ class ObservabilitySubscriptionManager {
|
|
|
6138
8311
|
for (const [serviceInstanceId, serviceInstanceTelemetry] of Object.entries(service)) {
|
|
6139
8312
|
const kafkaTopic = `${KAFKA_PREFIX}_${serviceInstanceId}`.replace(/@/g, "_").replace(/\|/g, "_");
|
|
6140
8313
|
if (serviceInstanceTelemetry.cpu && serviceInstanceTelemetry.cpu > 0) {
|
|
6141
|
-
__privateGet(this, _serviceModel)[serviceInstanceId] = ObservabilityModelUtils.GetModelForService(serviceInstanceId, serviceInstanceTelemetry, subscribeToKafka, __privateGet(this,
|
|
8314
|
+
__privateGet(this, _serviceModel)[serviceInstanceId] = ObservabilityModelUtils.GetModelForService(serviceInstanceId, serviceInstanceTelemetry, subscribeToKafka, __privateGet(this, _options6).logger);
|
|
6142
8315
|
if (__privateGet(this, _serviceModel)[serviceInstanceId] !== null) {
|
|
6143
8316
|
__privateGet(this, _serviceModel)[serviceInstanceId].options = { serviceId };
|
|
6144
8317
|
if (subscribeToKafka) {
|
|
@@ -6157,7 +8330,7 @@ class ObservabilitySubscriptionManager {
|
|
|
6157
8330
|
}
|
|
6158
8331
|
}
|
|
6159
8332
|
} else {
|
|
6160
|
-
__privateMethod(this, _ObservabilitySubscriptionManager_instances, LogDebugMessage_fn4).call(this, chalk$
|
|
8333
|
+
__privateMethod(this, _ObservabilitySubscriptionManager_instances, LogDebugMessage_fn4).call(this, chalk$2.red(`CreateModelServiceInstances():Error: GetModelForService() returned null`));
|
|
6161
8334
|
}
|
|
6162
8335
|
} else {
|
|
6163
8336
|
if (subscribeToKafka) {
|
|
@@ -6181,7 +8354,7 @@ class ObservabilitySubscriptionManager {
|
|
|
6181
8354
|
for (const [serviceInstanceProcessId, serviceInstanceProcessTelemetry] of Object.entries(serviceInstance)) {
|
|
6182
8355
|
const kafkaTopic = `${KAFKA_PREFIX}_${serviceInstanceId}_${serviceInstanceProcessId}`.replace(/@/g, "_").replace(/\|/g, "_");
|
|
6183
8356
|
if (serviceInstanceProcessTelemetry.cpu && serviceInstanceProcessTelemetry.cpu > 0) {
|
|
6184
|
-
__privateGet(this, _serviceModel)[serviceInstanceProcessId] = ObservabilityModelUtils.GetModelForService(serviceInstanceProcessId, serviceInstanceProcessTelemetry, subscribeToKafka, __privateGet(this,
|
|
8357
|
+
__privateGet(this, _serviceModel)[serviceInstanceProcessId] = ObservabilityModelUtils.GetModelForService(serviceInstanceProcessId, serviceInstanceProcessTelemetry, subscribeToKafka, __privateGet(this, _options6).logger);
|
|
6185
8358
|
if (__privateGet(this, _serviceModel)[serviceInstanceProcessId] !== null) {
|
|
6186
8359
|
__privateGet(this, _serviceModel)[serviceInstanceProcessId].options = { serviceId, serviceInstanceId };
|
|
6187
8360
|
if (subscribeToKafka) {
|
|
@@ -6200,7 +8373,7 @@ class ObservabilitySubscriptionManager {
|
|
|
6200
8373
|
}
|
|
6201
8374
|
}
|
|
6202
8375
|
} else {
|
|
6203
|
-
__privateMethod(this, _ObservabilitySubscriptionManager_instances, LogDebugMessage_fn4).call(this, chalk$
|
|
8376
|
+
__privateMethod(this, _ObservabilitySubscriptionManager_instances, LogDebugMessage_fn4).call(this, chalk$2.red(`CreateModelServiceInstance():Error: GetModelForService() returned null`));
|
|
6204
8377
|
}
|
|
6205
8378
|
} else {
|
|
6206
8379
|
if (subscribeToKafka) {
|
|
@@ -6223,9 +8396,9 @@ class ObservabilitySubscriptionManager {
|
|
|
6223
8396
|
__privateSet(this, _agentModel, {});
|
|
6224
8397
|
if (subscriptionPayload.subscriptionKey.topic.localeCompare(SubscriptionTopic.AllAgentsCombined.toString()) === 0) {
|
|
6225
8398
|
if (Object.keys(subscriptionPayload.data).length !== 0) {
|
|
6226
|
-
__privateGet(this, _agentModel)["STS-Agent"] = ObservabilityModelUtils.GetModelForAgent("STS-Agent", subscriptionPayload.data, subscribeToKafka, __privateGet(this,
|
|
8399
|
+
__privateGet(this, _agentModel)["STS-Agent"] = ObservabilityModelUtils.GetModelForAgent("STS-Agent", subscriptionPayload.data, subscribeToKafka, __privateGet(this, _options6).logger);
|
|
6227
8400
|
if (__privateGet(this, _agentModel)["STS-Agent"] === null) {
|
|
6228
|
-
__privateMethod(this, _ObservabilitySubscriptionManager_instances, LogDebugMessage_fn4).call(this, chalk$
|
|
8401
|
+
__privateMethod(this, _ObservabilitySubscriptionManager_instances, LogDebugMessage_fn4).call(this, chalk$2.red(`CreateModelAllAgentsCombined():Error: GetModelForAgent() returned null`));
|
|
6229
8402
|
}
|
|
6230
8403
|
}
|
|
6231
8404
|
}
|
|
@@ -6241,7 +8414,7 @@ class ObservabilitySubscriptionManager {
|
|
|
6241
8414
|
for (const [agentId, agentInstanceTelemetry] of Object.entries(subscriptionPayload.data)) {
|
|
6242
8415
|
const kafkaTopic = `${KAFKA_PREFIX}_${agentId}`.replace(/@/g, "_").replace(/\|/g, "_");
|
|
6243
8416
|
if (agentInstanceTelemetry.timer) {
|
|
6244
|
-
__privateGet(this, _agentModel)[agentId] = ObservabilityModelUtils.GetModelForAgent(agentId, agentInstanceTelemetry, subscribeToKafka, __privateGet(this,
|
|
8417
|
+
__privateGet(this, _agentModel)[agentId] = ObservabilityModelUtils.GetModelForAgent(agentId, agentInstanceTelemetry, subscribeToKafka, __privateGet(this, _options6).logger);
|
|
6245
8418
|
if (__privateGet(this, _agentModel)[agentId] !== null) {
|
|
6246
8419
|
if (subscribeToKafka) {
|
|
6247
8420
|
__privateGet(this, _kafkaHelper).GetKafkaLogData(kafkaTopic, __privateGet(this, _agentModel)[agentId]);
|
|
@@ -6259,7 +8432,7 @@ class ObservabilitySubscriptionManager {
|
|
|
6259
8432
|
}
|
|
6260
8433
|
}
|
|
6261
8434
|
} else {
|
|
6262
|
-
__privateMethod(this, _ObservabilitySubscriptionManager_instances, LogDebugMessage_fn4).call(this, chalk$
|
|
8435
|
+
__privateMethod(this, _ObservabilitySubscriptionManager_instances, LogDebugMessage_fn4).call(this, chalk$2.red(`CreateModelAgents():Error: GetModelForAgent() returned null`));
|
|
6263
8436
|
}
|
|
6264
8437
|
} else {
|
|
6265
8438
|
if (subscribeToKafka) {
|
|
@@ -6270,7 +8443,7 @@ class ObservabilitySubscriptionManager {
|
|
|
6270
8443
|
}
|
|
6271
8444
|
}
|
|
6272
8445
|
} catch (error) {
|
|
6273
|
-
__privateMethod(this, _ObservabilitySubscriptionManager_instances, LogErrorMessage_fn3).call(this, chalk$
|
|
8446
|
+
__privateMethod(this, _ObservabilitySubscriptionManager_instances, LogErrorMessage_fn3).call(this, chalk$2.red(`UIControllerAgent:CreateModel(): Error: [${error}]`));
|
|
6274
8447
|
}
|
|
6275
8448
|
}
|
|
6276
8449
|
// /agentId/agentWorkerId
|
|
@@ -6282,7 +8455,7 @@ class ObservabilitySubscriptionManager {
|
|
|
6282
8455
|
const kafkaTopic = `${KAFKA_PREFIX}_${agentId}_${agentWorkerId}`.replace(/@/g, "_").replace(/\|/g, "_");
|
|
6283
8456
|
if (agentInstanceTelemetry.timer) {
|
|
6284
8457
|
const threadKey = `${agentWorkerId}`;
|
|
6285
|
-
__privateGet(this, _agentModel)[threadKey] = ObservabilityModelUtils.GetModelForAgent(threadKey, agentInstanceTelemetry, subscribeToKafka, __privateGet(this,
|
|
8458
|
+
__privateGet(this, _agentModel)[threadKey] = ObservabilityModelUtils.GetModelForAgent(threadKey, agentInstanceTelemetry, subscribeToKafka, __privateGet(this, _options6).logger);
|
|
6286
8459
|
if (__privateGet(this, _agentModel)[threadKey] !== null) {
|
|
6287
8460
|
const coreCount = __privateGet(this, _agentModel)[threadKey].instruments[Gauge.CORE_COUNT_GAUGE].val;
|
|
6288
8461
|
__privateGet(this, _agentModel)[threadKey].canNavigate = coreCount > 0;
|
|
@@ -6303,7 +8476,7 @@ class ObservabilitySubscriptionManager {
|
|
|
6303
8476
|
}
|
|
6304
8477
|
}
|
|
6305
8478
|
} else {
|
|
6306
|
-
__privateMethod(this, _ObservabilitySubscriptionManager_instances, LogDebugMessage_fn4).call(this, chalk$
|
|
8479
|
+
__privateMethod(this, _ObservabilitySubscriptionManager_instances, LogDebugMessage_fn4).call(this, chalk$2.red(`CreateModelAgentWorkers():Error: GetModelForAgent() returned null`));
|
|
6307
8480
|
}
|
|
6308
8481
|
} else {
|
|
6309
8482
|
if (subscribeToKafka) {
|
|
@@ -6315,7 +8488,7 @@ class ObservabilitySubscriptionManager {
|
|
|
6315
8488
|
}
|
|
6316
8489
|
}
|
|
6317
8490
|
} catch (error) {
|
|
6318
|
-
__privateMethod(this, _ObservabilitySubscriptionManager_instances, LogErrorMessage_fn3).call(this, chalk$
|
|
8491
|
+
__privateMethod(this, _ObservabilitySubscriptionManager_instances, LogErrorMessage_fn3).call(this, chalk$2.red(`UIControllerAgentThreads:CreateModel(): Error: [${error}]`));
|
|
6319
8492
|
}
|
|
6320
8493
|
}
|
|
6321
8494
|
// /agentId/agentWorkerId/asyncRunnerId
|
|
@@ -6327,7 +8500,7 @@ class ObservabilitySubscriptionManager {
|
|
|
6327
8500
|
for (const [asyncRunnerId, agentInstanceTelemetry] of Object.entries(asyncRunnerData)) {
|
|
6328
8501
|
const kafkaTopic = `${KAFKA_PREFIX}_${agentId}_${agentWorkerId}_${asyncRunnerId}`.replace(/@/g, "_").replace(/\|/g, "_");
|
|
6329
8502
|
if (agentInstanceTelemetry.timer) {
|
|
6330
|
-
__privateGet(this, _agentModel)[asyncRunnerId] = ObservabilityModelUtils.GetModelForAgent(asyncRunnerId, agentInstanceTelemetry, subscribeToKafka, __privateGet(this,
|
|
8503
|
+
__privateGet(this, _agentModel)[asyncRunnerId] = ObservabilityModelUtils.GetModelForAgent(asyncRunnerId, agentInstanceTelemetry, subscribeToKafka, __privateGet(this, _options6).logger);
|
|
6331
8504
|
if (__privateGet(this, _agentModel)[asyncRunnerId] !== null) {
|
|
6332
8505
|
if (subscribeToKafka) {
|
|
6333
8506
|
__privateGet(this, _kafkaHelper).GetKafkaLogData(kafkaTopic, __privateGet(this, _agentModel)[asyncRunnerId]);
|
|
@@ -6345,7 +8518,7 @@ class ObservabilitySubscriptionManager {
|
|
|
6345
8518
|
}
|
|
6346
8519
|
}
|
|
6347
8520
|
} else {
|
|
6348
|
-
__privateMethod(this, _ObservabilitySubscriptionManager_instances, LogDebugMessage_fn4).call(this, chalk$
|
|
8521
|
+
__privateMethod(this, _ObservabilitySubscriptionManager_instances, LogDebugMessage_fn4).call(this, chalk$2.red(`CreateModelAgentWorker():Error: GetModelForAgent() returned null`));
|
|
6349
8522
|
}
|
|
6350
8523
|
} else {
|
|
6351
8524
|
if (subscribeToKafka) {
|
|
@@ -6358,7 +8531,7 @@ class ObservabilitySubscriptionManager {
|
|
|
6358
8531
|
}
|
|
6359
8532
|
}
|
|
6360
8533
|
} catch (error) {
|
|
6361
|
-
__privateMethod(this, _ObservabilitySubscriptionManager_instances, LogErrorMessage_fn3).call(this, chalk$
|
|
8534
|
+
__privateMethod(this, _ObservabilitySubscriptionManager_instances, LogErrorMessage_fn3).call(this, chalk$2.red(`UIControllerAgentThread:CreateModel(): Error: [${error}]`));
|
|
6362
8535
|
}
|
|
6363
8536
|
}
|
|
6364
8537
|
// --- [ Lambdas ] ------------------------------------------------------------------------------------------------------------------------------------------------
|
|
@@ -6367,9 +8540,9 @@ class ObservabilitySubscriptionManager {
|
|
|
6367
8540
|
try {
|
|
6368
8541
|
__privateSet(this, _lambdaModel, {});
|
|
6369
8542
|
if (subscriptionPayload.subscriptionKey.topic.localeCompare(SubscriptionTopic.AllLambdasCombined.toString()) === 0) {
|
|
6370
|
-
__privateGet(this, _lambdaModel)["STS-Lambda"] = ObservabilityModelUtils.GetModelForLambda("STS-Lambda", subscriptionPayload.data, subscribeToKafka, __privateGet(this,
|
|
8543
|
+
__privateGet(this, _lambdaModel)["STS-Lambda"] = ObservabilityModelUtils.GetModelForLambda("STS-Lambda", subscriptionPayload.data, subscribeToKafka, __privateGet(this, _options6).logger);
|
|
6371
8544
|
if (__privateGet(this, _lambdaModel)["STS-Lambda"] === null) {
|
|
6372
|
-
__privateMethod(this, _ObservabilitySubscriptionManager_instances, LogDebugMessage_fn4).call(this, chalk$
|
|
8545
|
+
__privateMethod(this, _ObservabilitySubscriptionManager_instances, LogDebugMessage_fn4).call(this, chalk$2.red(`CreateModelAllLambdasCombined():Error: GetModelForLambda() returned null`));
|
|
6373
8546
|
}
|
|
6374
8547
|
}
|
|
6375
8548
|
} catch (error) {
|
|
@@ -6382,9 +8555,9 @@ class ObservabilitySubscriptionManager {
|
|
|
6382
8555
|
try {
|
|
6383
8556
|
__privateSet(this, _lambdaModel, {});
|
|
6384
8557
|
for (const [technologyId, technologyTelemetry] of Object.entries(subscriptionPayload.data)) {
|
|
6385
|
-
__privateGet(this, _lambdaModel)[technologyId] = ObservabilityModelUtils.GetModelForLambda(technologyId, technologyTelemetry, subscribeToKafka, __privateGet(this,
|
|
8558
|
+
__privateGet(this, _lambdaModel)[technologyId] = ObservabilityModelUtils.GetModelForLambda(technologyId, technologyTelemetry, subscribeToKafka, __privateGet(this, _options6).logger);
|
|
6386
8559
|
if (__privateGet(this, _lambdaModel)[technologyId] === null) {
|
|
6387
|
-
__privateMethod(this, _ObservabilitySubscriptionManager_instances, LogDebugMessage_fn4).call(this, chalk$
|
|
8560
|
+
__privateMethod(this, _ObservabilitySubscriptionManager_instances, LogDebugMessage_fn4).call(this, chalk$2.red(`CreateModelLambdaTechnologies():Error: GetModelForLambda() returned null`));
|
|
6388
8561
|
}
|
|
6389
8562
|
}
|
|
6390
8563
|
} catch (error) {
|
|
@@ -6399,7 +8572,7 @@ class ObservabilitySubscriptionManager {
|
|
|
6399
8572
|
for (const [subTechnologyId, subTechnologyTelemetry] of Object.entries(technologyTelemetry)) {
|
|
6400
8573
|
const kafkaTopic = `${KAFKA_PREFIX}_${subTechnologyId}`.replace(/@/g, "_").replace(/\|/g, "_");
|
|
6401
8574
|
if (subTechnologyTelemetry.cpu && subTechnologyTelemetry.cpu > 0) {
|
|
6402
|
-
__privateGet(this, _lambdaModel)[subTechnologyId] = ObservabilityModelUtils.GetModelForLambda(subTechnologyId, subTechnologyTelemetry, subscribeToKafka, __privateGet(this,
|
|
8575
|
+
__privateGet(this, _lambdaModel)[subTechnologyId] = ObservabilityModelUtils.GetModelForLambda(subTechnologyId, subTechnologyTelemetry, subscribeToKafka, __privateGet(this, _options6).logger);
|
|
6403
8576
|
if (__privateGet(this, _lambdaModel)[subTechnologyId] !== null) {
|
|
6404
8577
|
__privateGet(this, _lambdaModel)[subTechnologyId].options = { technologyId };
|
|
6405
8578
|
if (subscribeToKafka) {
|
|
@@ -6418,7 +8591,7 @@ class ObservabilitySubscriptionManager {
|
|
|
6418
8591
|
}
|
|
6419
8592
|
}
|
|
6420
8593
|
} else {
|
|
6421
|
-
__privateMethod(this, _ObservabilitySubscriptionManager_instances, LogDebugMessage_fn4).call(this, chalk$
|
|
8594
|
+
__privateMethod(this, _ObservabilitySubscriptionManager_instances, LogDebugMessage_fn4).call(this, chalk$2.red(`CreateModelLambdaSubTechnologies():Error: GetModelForLambda() returned null`));
|
|
6422
8595
|
}
|
|
6423
8596
|
} else {
|
|
6424
8597
|
if (subscribeToKafka) {
|
|
@@ -6442,7 +8615,7 @@ class ObservabilitySubscriptionManager {
|
|
|
6442
8615
|
for (const [subTechnologyInstanceId, subTechnologyInstanceTelemetry] of Object.entries(subTechnologyTelemetry)) {
|
|
6443
8616
|
const kafkaTopic = `${KAFKA_PREFIX}_${subTechnologyId}_${subTechnologyInstanceId}`.replace(/@/g, "_").replace(/\|/g, "_");
|
|
6444
8617
|
if (subTechnologyInstanceTelemetry.cpu && subTechnologyInstanceTelemetry.cpu > 0) {
|
|
6445
|
-
__privateGet(this, _lambdaModel)[subTechnologyInstanceId] = ObservabilityModelUtils.GetModelForLambda(subTechnologyInstanceId, subTechnologyInstanceTelemetry, subscribeToKafka, __privateGet(this,
|
|
8618
|
+
__privateGet(this, _lambdaModel)[subTechnologyInstanceId] = ObservabilityModelUtils.GetModelForLambda(subTechnologyInstanceId, subTechnologyInstanceTelemetry, subscribeToKafka, __privateGet(this, _options6).logger);
|
|
6446
8619
|
if (__privateGet(this, _lambdaModel)[subTechnologyInstanceId] !== null) {
|
|
6447
8620
|
__privateGet(this, _lambdaModel)[subTechnologyInstanceId].options = { technologyId, subTechnologyId };
|
|
6448
8621
|
if (subscribeToKafka) {
|
|
@@ -6461,7 +8634,7 @@ class ObservabilitySubscriptionManager {
|
|
|
6461
8634
|
}
|
|
6462
8635
|
}
|
|
6463
8636
|
} else {
|
|
6464
|
-
__privateMethod(this, _ObservabilitySubscriptionManager_instances, LogDebugMessage_fn4).call(this, chalk$
|
|
8637
|
+
__privateMethod(this, _ObservabilitySubscriptionManager_instances, LogDebugMessage_fn4).call(this, chalk$2.red(`CreateModelLambdaSubTechnologiesInstance():Error: GetModelForLambda() returned null`));
|
|
6465
8638
|
}
|
|
6466
8639
|
} else {
|
|
6467
8640
|
if (subscribeToKafka) {
|
|
@@ -6484,23 +8657,23 @@ _kafkaHelper = new WeakMap();
|
|
|
6484
8657
|
_serviceModel = new WeakMap();
|
|
6485
8658
|
_agentModel = new WeakMap();
|
|
6486
8659
|
_lambdaModel = new WeakMap();
|
|
6487
|
-
|
|
8660
|
+
_options6 = new WeakMap();
|
|
6488
8661
|
_ObservabilitySubscriptionManager_instances = new WeakSet();
|
|
6489
8662
|
LogDebugMessage_fn4 = function(message) {
|
|
6490
|
-
__privateGet(this,
|
|
8663
|
+
__privateGet(this, _options6).logger.debug(message);
|
|
6491
8664
|
};
|
|
6492
8665
|
LogErrorMessage_fn3 = function(message) {
|
|
6493
|
-
__privateGet(this,
|
|
8666
|
+
__privateGet(this, _options6).logger.error(message);
|
|
6494
8667
|
};
|
|
6495
8668
|
class SocketIoClientHelper {
|
|
6496
8669
|
constructor(options) {
|
|
6497
8670
|
__privateAdd(this, _SocketIoClientHelper_instances);
|
|
6498
|
-
__privateAdd(this,
|
|
8671
|
+
__privateAdd(this, _options7);
|
|
6499
8672
|
__privateAdd(this, _sockets, {});
|
|
6500
8673
|
__privateAdd(this, _httpsAgent2, null);
|
|
6501
|
-
__privateSet(this,
|
|
8674
|
+
__privateSet(this, _options7, options);
|
|
6502
8675
|
if (isNode) {
|
|
6503
|
-
const agentOptions = __privateGet(this,
|
|
8676
|
+
const agentOptions = __privateGet(this, _options7).agentOptions;
|
|
6504
8677
|
__privateSet(this, _httpsAgent2, new https.Agent({
|
|
6505
8678
|
keepAlive: agentOptions == null ? void 0 : agentOptions.keepAlive,
|
|
6506
8679
|
maxSockets: agentOptions == null ? void 0 : agentOptions.maxSockets,
|
|
@@ -6515,46 +8688,46 @@ class SocketIoClientHelper {
|
|
|
6515
8688
|
get sockets() {
|
|
6516
8689
|
return __privateGet(this, _sockets);
|
|
6517
8690
|
}
|
|
6518
|
-
SetupClientSideSocket(
|
|
6519
|
-
this.sockets[
|
|
6520
|
-
name,
|
|
8691
|
+
SetupClientSideSocket(name2, address, onConnectCallBack, socketEventsCallBack, errorCallBack) {
|
|
8692
|
+
this.sockets[name2] = {
|
|
8693
|
+
name: name2,
|
|
6521
8694
|
address,
|
|
6522
8695
|
socket: null,
|
|
6523
8696
|
errorCallBack
|
|
6524
8697
|
};
|
|
6525
|
-
__privateMethod(this, _SocketIoClientHelper_instances, EstablishSocketConnect_fn).call(this,
|
|
6526
|
-
return this.sockets[
|
|
8698
|
+
__privateMethod(this, _SocketIoClientHelper_instances, EstablishSocketConnect_fn).call(this, name2, onConnectCallBack, socketEventsCallBack);
|
|
8699
|
+
return this.sockets[name2].socket;
|
|
6527
8700
|
}
|
|
6528
|
-
GetSocket(
|
|
6529
|
-
return this.sockets[
|
|
8701
|
+
GetSocket(name2) {
|
|
8702
|
+
return this.sockets[name2].socket;
|
|
6530
8703
|
}
|
|
6531
|
-
GetSocketDetail(
|
|
6532
|
-
return this.sockets[
|
|
8704
|
+
GetSocketDetail(name2) {
|
|
8705
|
+
return this.sockets[name2];
|
|
6533
8706
|
}
|
|
6534
8707
|
}
|
|
6535
|
-
|
|
8708
|
+
_options7 = new WeakMap();
|
|
6536
8709
|
_sockets = new WeakMap();
|
|
6537
8710
|
_httpsAgent2 = new WeakMap();
|
|
6538
8711
|
_SocketIoClientHelper_instances = new WeakSet();
|
|
6539
8712
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6540
8713
|
LogDebugMessage_fn5 = function(message) {
|
|
6541
|
-
if (__privateGet(this,
|
|
8714
|
+
if (__privateGet(this, _options7).logger) __privateGet(this, _options7).logger.debug(message);
|
|
6542
8715
|
};
|
|
6543
8716
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6544
8717
|
LogErrorMessage_fn4 = function(message) {
|
|
6545
|
-
if (__privateGet(this,
|
|
8718
|
+
if (__privateGet(this, _options7).logger) __privateGet(this, _options7).logger.error(message);
|
|
6546
8719
|
};
|
|
6547
|
-
EstablishSocketConnect_fn = function(
|
|
6548
|
-
const socketDetail = this.sockets[
|
|
8720
|
+
EstablishSocketConnect_fn = function(name2, onConnectCallBack, socketEventsCallBack) {
|
|
8721
|
+
const socketDetail = this.sockets[name2];
|
|
6549
8722
|
if (socketDetail.socket !== null) {
|
|
6550
8723
|
if (socketDetail.socket.connected === true) {
|
|
6551
8724
|
socketDetail.socket.disconnect();
|
|
6552
8725
|
}
|
|
6553
8726
|
socketDetail.socket = null;
|
|
6554
8727
|
if (isNode) {
|
|
6555
|
-
setTimeout(() => __privateMethod(this, _SocketIoClientHelper_instances, EstablishSocketConnect_fn).call(this,
|
|
8728
|
+
setTimeout(() => __privateMethod(this, _SocketIoClientHelper_instances, EstablishSocketConnect_fn).call(this, name2, onConnectCallBack, socketEventsCallBack), 100).unref();
|
|
6556
8729
|
} else {
|
|
6557
|
-
setTimeout(() => __privateMethod(this, _SocketIoClientHelper_instances, EstablishSocketConnect_fn).call(this,
|
|
8730
|
+
setTimeout(() => __privateMethod(this, _SocketIoClientHelper_instances, EstablishSocketConnect_fn).call(this, name2, onConnectCallBack, socketEventsCallBack), 100);
|
|
6558
8731
|
}
|
|
6559
8732
|
return;
|
|
6560
8733
|
}
|
|
@@ -6596,12 +8769,12 @@ EstablishSocketConnect_fn = function(name, onConnectCallBack, socketEventsCallBa
|
|
|
6596
8769
|
{
|
|
6597
8770
|
__privateMethod(this, _SocketIoClientHelper_instances, LogDebugMessage_fn5).call(this, "The server disconnected using disconnectSockets, i.e. normal safe shutdown from explicit disconnection by the server.");
|
|
6598
8771
|
__privateMethod(this, _SocketIoClientHelper_instances, LogDebugMessage_fn5).call(this, "The connection will be re-established when the server becomes available.");
|
|
6599
|
-
const socketDetail2 = this.sockets[
|
|
8772
|
+
const socketDetail2 = this.sockets[name2];
|
|
6600
8773
|
socketDetail2.socket = null;
|
|
6601
8774
|
if (isNode) {
|
|
6602
|
-
setTimeout(() => __privateMethod(this, _SocketIoClientHelper_instances, EstablishSocketConnect_fn).call(this,
|
|
8775
|
+
setTimeout(() => __privateMethod(this, _SocketIoClientHelper_instances, EstablishSocketConnect_fn).call(this, name2, onConnectCallBack, socketEventsCallBack), 100).unref();
|
|
6603
8776
|
} else {
|
|
6604
|
-
setTimeout(() => __privateMethod(this, _SocketIoClientHelper_instances, EstablishSocketConnect_fn).call(this,
|
|
8777
|
+
setTimeout(() => __privateMethod(this, _SocketIoClientHelper_instances, EstablishSocketConnect_fn).call(this, name2, onConnectCallBack, socketEventsCallBack), 100);
|
|
6605
8778
|
}
|
|
6606
8779
|
}
|
|
6607
8780
|
break;
|
|
@@ -6615,15 +8788,15 @@ EstablishSocketConnect_fn = function(name, onConnectCallBack, socketEventsCallBa
|
|
|
6615
8788
|
{
|
|
6616
8789
|
__privateMethod(this, _SocketIoClientHelper_instances, LogDebugMessage_fn5).call(this, `Server unexpectedly disconnected. Reason: [${reason}]`);
|
|
6617
8790
|
__privateMethod(this, _SocketIoClientHelper_instances, LogDebugMessage_fn5).call(this, "The connection will be re-established when the server becomes available.");
|
|
6618
|
-
const socketDetail2 = this.sockets[
|
|
8791
|
+
const socketDetail2 = this.sockets[name2];
|
|
6619
8792
|
if (socketDetail2.socket) {
|
|
6620
8793
|
socketDetail2.socket.disconnect();
|
|
6621
8794
|
}
|
|
6622
8795
|
socketDetail2.socket = null;
|
|
6623
8796
|
if (isNode) {
|
|
6624
|
-
setTimeout(() => __privateMethod(this, _SocketIoClientHelper_instances, EstablishSocketConnect_fn).call(this,
|
|
8797
|
+
setTimeout(() => __privateMethod(this, _SocketIoClientHelper_instances, EstablishSocketConnect_fn).call(this, name2, onConnectCallBack, socketEventsCallBack), 100).unref();
|
|
6625
8798
|
} else {
|
|
6626
|
-
setTimeout(() => __privateMethod(this, _SocketIoClientHelper_instances, EstablishSocketConnect_fn).call(this,
|
|
8799
|
+
setTimeout(() => __privateMethod(this, _SocketIoClientHelper_instances, EstablishSocketConnect_fn).call(this, name2, onConnectCallBack, socketEventsCallBack), 100);
|
|
6627
8800
|
}
|
|
6628
8801
|
}
|
|
6629
8802
|
break;
|