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