@nsshunt/stsobservability 1.0.1 → 1.0.3
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 +2484 -493
- package/dist/stsobservability.mjs.map +1 -1
- package/dist/stsobservability.umd.js +2481 -489
- package/dist/stsobservability.umd.js.map +1 -1
- package/package.json +2 -1
- package/types/globalServiceDefinitions.d.ts +7 -2
- package/types/globalServiceDefinitions.d.ts.map +1 -1
- package/types/subscribe/observabilityrestapisubscriber.d.ts.map +1 -1
|
@@ -34,7 +34,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
34
34
|
__accessCheck(obj, member, "access private method");
|
|
35
35
|
return method;
|
|
36
36
|
};
|
|
37
|
-
var _label, _options, _data, _a, _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, _ComputeVelocityByTimeDiff, ComputeVelocityByTimeDiff_fn, _ComputeVelocity, ComputeVelocity_fn, _SetupAutoComputeVelocity, SetupAutoComputeVelocity_fn, _GetVelocityStackAverage, GetVelocityStackAverage_fn, _GetVal, GetVal_fn, _SetVal, SetVal_fn, _GetVelocity, GetVelocity_fn, _GetMaxVelocity, GetMaxVelocity_fn, _GetDelta, GetDelta_fn, _GetTimeStamp, GetTimeStamp_fn, _GetCountDiff, GetCountDiff_fn, _GetTimeDiff, GetTimeDiff_fn, _GetDeltaCountDiff, GetDeltaCountDiff_fn, _GetDeltaTimeDif, GetDeltaTimeDif_fn, _GetAverageVelocity, GetAverageVelocity_fn, _histogramData, _val, _copy2, _GetVal2, GetVal_fn2, _SetVal2, SetVal_fn2, _GetHistogramData, GetHistogramData_fn, _SetHistogramData, SetHistogramData_fn, _messages, _readPos, _maxSize, _copy3, _useLatestMessages, _consoleLogging, _instrumentLogging, _winstonLogging, _stsLogger, _DumpToConsole, DumpToConsole_fn, _GetVal3, GetVal_fn3, _SetVal3, SetVal_fn3, _start, _copy4, _pauseVal, _GetVal4, GetVal_fn4, _SetVal4, SetVal_fn4, _convertMS, convertMS_fn, _val2, _maxval, _lastObservedValue, _timeSeriesList, _maxSampleSize, _timerInterval2, _observer, _min, _max, _observations, _total, _copy5, _GetVal5, GetVal_fn5, _SetVal5, SetVal_fn5, _GetMin, GetMin_fn, _GetMax, GetMax_fn, _GetAverage, GetAverage_fn, _GetAndResetMaxVal, GetAndResetMaxVal_fn, _NumberCompare, NumberCompare_fn, _GetPercentileData, GetPercentileData_fn, _val3, _copy6, _GetVal6, GetVal_fn6, _SetVal6, SetVal_fn6, _tinyEmitter, _RequestCompleted, _instruments, _inPublish, _observer2, _publishState, _GetInstrument, GetInstrument_fn, _ProcessTelemetryCommand, ProcessTelemetryCommand_fn, _CreateInstrument, CreateInstrument_fn, _CreateInstruments, CreateInstruments_fn, _GetPayloadData, GetPayloadData_fn, _PublishTimeoutLoop, PublishTimeoutLoop_fn, _httpsAgent, _kafkaLog, _maxLogLength, _socketSubscribeKeepAlive, _options2,
|
|
37
|
+
var _label, _options, _data, _a, _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, _ComputeVelocityByTimeDiff, ComputeVelocityByTimeDiff_fn, _ComputeVelocity, ComputeVelocity_fn, _SetupAutoComputeVelocity, SetupAutoComputeVelocity_fn, _GetVelocityStackAverage, GetVelocityStackAverage_fn, _GetVal, GetVal_fn, _SetVal, SetVal_fn, _GetVelocity, GetVelocity_fn, _GetMaxVelocity, GetMaxVelocity_fn, _GetDelta, GetDelta_fn, _GetTimeStamp, GetTimeStamp_fn, _GetCountDiff, GetCountDiff_fn, _GetTimeDiff, GetTimeDiff_fn, _GetDeltaCountDiff, GetDeltaCountDiff_fn, _GetDeltaTimeDif, GetDeltaTimeDif_fn, _GetAverageVelocity, GetAverageVelocity_fn, _histogramData, _val, _copy2, _GetVal2, GetVal_fn2, _SetVal2, SetVal_fn2, _GetHistogramData, GetHistogramData_fn, _SetHistogramData, SetHistogramData_fn, _messages, _readPos, _maxSize, _copy3, _useLatestMessages, _consoleLogging, _instrumentLogging, _winstonLogging, _stsLogger, _DumpToConsole, DumpToConsole_fn, _GetVal3, GetVal_fn3, _SetVal3, SetVal_fn3, _start, _copy4, _pauseVal, _GetVal4, GetVal_fn4, _SetVal4, SetVal_fn4, _convertMS, convertMS_fn, _val2, _maxval, _lastObservedValue, _timeSeriesList, _maxSampleSize, _timerInterval2, _observer, _min, _max, _observations, _total, _copy5, _GetVal5, GetVal_fn5, _SetVal5, SetVal_fn5, _GetMin, GetMin_fn, _GetMax, GetMax_fn, _GetAverage, GetAverage_fn, _GetAndResetMaxVal, GetAndResetMaxVal_fn, _NumberCompare, NumberCompare_fn, _GetPercentileData, GetPercentileData_fn, _val3, _copy6, _GetVal6, GetVal_fn6, _SetVal6, SetVal_fn6, _tinyEmitter, _RequestCompleted, _instruments, _inPublish, _observer2, _publishState, _GetInstrument, GetInstrument_fn, _ProcessTelemetryCommand, ProcessTelemetryCommand_fn, _CreateInstrument, CreateInstrument_fn, _CreateInstruments, CreateInstruments_fn, _GetPayloadData, GetPayloadData_fn, _PublishTimeoutLoop, PublishTimeoutLoop_fn, _httpsAgent, _kafkaLog, _maxLogLength, _socketSubscribeKeepAlive, _options2, _LogDebugMessage, LogDebugMessage_fn, _LogErrorMessage, LogErrorMessage_fn, _InvokeRESTAPI, InvokeRESTAPI_fn, _GetData, _SetupTimeout, SetupTimeout_fn, _AddKeepAlive, AddKeepAlive_fn, _RemoveKeepAlive, RemoveKeepAlive_fn, _messageWithAckPayloadRecords, _socket, _maxReties, _timeoutValue, _options3, _LogDebugMessage2, LogDebugMessage_fn2, _GetSubscribeKeepAliveAckEventName, GetSubscribeKeepAliveAckEventName_fn, _socketSubscribeKeepAlive2, _socket2, _options4, _socketIoMessageSender, _LogDebugMessage3, LogDebugMessage_fn3, _LogErrorMessage2, LogErrorMessage_fn2, _AddKeepAlive2, AddKeepAlive_fn2, _RemoveKeepAlive2, RemoveKeepAlive_fn2, _observabilitySocketIOSubscriber, _subscriptions, _kafkaHelper, _serviceModel, _agentModel, _lambdaModel, _options5, _LogDebugMessage4, LogDebugMessage_fn4, _LogErrorMessage3, LogErrorMessage_fn3, _options6, _sockets, _httpsAgent2, _LogDebugMessage5, LogDebugMessage_fn5, _LogErrorMessage4, LogErrorMessage_fn4, _EstablishSocketConnect, EstablishSocketConnect_fn;
|
|
38
38
|
import _cloneDeep from "lodash.clonedeep";
|
|
39
39
|
import isNode from "detect-node";
|
|
40
40
|
import { STSOptionsBase } from "@nsshunt/stsutils";
|
|
@@ -42,7 +42,6 @@ import { TinyEmitter } from "tiny-emitter";
|
|
|
42
42
|
import { inject } from "vue";
|
|
43
43
|
import https from "node:https";
|
|
44
44
|
import axios from "axios";
|
|
45
|
-
import debugModule from "debug";
|
|
46
45
|
import { io } from "socket.io-client";
|
|
47
46
|
var Gauge = /* @__PURE__ */ ((Gauge2) => {
|
|
48
47
|
Gauge2["ACTIVE_REQUEST_GAUGE"] = "a";
|
|
@@ -1260,18 +1259,44 @@ convertMS_fn = function(ms) {
|
|
|
1260
1259
|
return (d + "." + pad(h) + ":" + pad(m) + ":" + pad(s)).padStart(12);
|
|
1261
1260
|
};
|
|
1262
1261
|
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
1263
|
-
function getDefaultExportFromCjs(x) {
|
|
1262
|
+
function getDefaultExportFromCjs$1(x) {
|
|
1264
1263
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
1265
1264
|
}
|
|
1265
|
+
function getAugmentedNamespace(n) {
|
|
1266
|
+
if (n.__esModule)
|
|
1267
|
+
return n;
|
|
1268
|
+
var f = n.default;
|
|
1269
|
+
if (typeof f == "function") {
|
|
1270
|
+
var a = function a2() {
|
|
1271
|
+
if (this instanceof a2) {
|
|
1272
|
+
return Reflect.construct(f, arguments, this.constructor);
|
|
1273
|
+
}
|
|
1274
|
+
return f.apply(this, arguments);
|
|
1275
|
+
};
|
|
1276
|
+
a.prototype = f.prototype;
|
|
1277
|
+
} else
|
|
1278
|
+
a = {};
|
|
1279
|
+
Object.defineProperty(a, "__esModule", { value: true });
|
|
1280
|
+
Object.keys(n).forEach(function(k) {
|
|
1281
|
+
var d = Object.getOwnPropertyDescriptor(n, k);
|
|
1282
|
+
Object.defineProperty(a, k, d.get ? d : {
|
|
1283
|
+
enumerable: true,
|
|
1284
|
+
get: function() {
|
|
1285
|
+
return n[k];
|
|
1286
|
+
}
|
|
1287
|
+
});
|
|
1288
|
+
});
|
|
1289
|
+
return a;
|
|
1290
|
+
}
|
|
1266
1291
|
var timsort$1 = {};
|
|
1267
|
-
(function(
|
|
1292
|
+
(function(exports2) {
|
|
1268
1293
|
(function(global2, factory) {
|
|
1269
1294
|
{
|
|
1270
|
-
factory(
|
|
1295
|
+
factory(exports2);
|
|
1271
1296
|
}
|
|
1272
|
-
})(commonjsGlobal, function(
|
|
1273
|
-
|
|
1274
|
-
|
|
1297
|
+
})(commonjsGlobal, function(exports3) {
|
|
1298
|
+
exports3.__esModule = true;
|
|
1299
|
+
exports3.sort = sort;
|
|
1275
1300
|
function _classCallCheck(instance, Constructor) {
|
|
1276
1301
|
if (!(instance instanceof Constructor)) {
|
|
1277
1302
|
throw new TypeError("Cannot call a class as a function");
|
|
@@ -1930,7 +1955,7 @@ function percentile(pOrPs, list, fn) {
|
|
|
1930
1955
|
});
|
|
1931
1956
|
}
|
|
1932
1957
|
var lib = percentile;
|
|
1933
|
-
const percentile$1 = /* @__PURE__ */ getDefaultExportFromCjs(lib);
|
|
1958
|
+
const percentile$1 = /* @__PURE__ */ getDefaultExportFromCjs$1(lib);
|
|
1934
1959
|
class InstrumentGaugeOptions extends InstrumentBaseOptions {
|
|
1935
1960
|
constructor() {
|
|
1936
1961
|
super(...arguments);
|
|
@@ -2554,14 +2579,14 @@ class RequestLoggerMiddleware extends STSOptionsBase {
|
|
|
2554
2579
|
}
|
|
2555
2580
|
_tinyEmitter = new WeakMap();
|
|
2556
2581
|
_RequestCompleted = new WeakMap();
|
|
2557
|
-
var ansiStyles$
|
|
2558
|
-
var colorName;
|
|
2559
|
-
var hasRequiredColorName;
|
|
2560
|
-
function requireColorName() {
|
|
2561
|
-
if (hasRequiredColorName)
|
|
2562
|
-
return colorName;
|
|
2563
|
-
hasRequiredColorName = 1;
|
|
2564
|
-
colorName = {
|
|
2582
|
+
var ansiStyles$3 = { exports: {} };
|
|
2583
|
+
var colorName$1;
|
|
2584
|
+
var hasRequiredColorName$1;
|
|
2585
|
+
function requireColorName$1() {
|
|
2586
|
+
if (hasRequiredColorName$1)
|
|
2587
|
+
return colorName$1;
|
|
2588
|
+
hasRequiredColorName$1 = 1;
|
|
2589
|
+
colorName$1 = {
|
|
2565
2590
|
"aliceblue": [240, 248, 255],
|
|
2566
2591
|
"antiquewhite": [250, 235, 215],
|
|
2567
2592
|
"aqua": [0, 255, 255],
|
|
@@ -2711,15 +2736,15 @@ function requireColorName() {
|
|
|
2711
2736
|
"yellow": [255, 255, 0],
|
|
2712
2737
|
"yellowgreen": [154, 205, 50]
|
|
2713
2738
|
};
|
|
2714
|
-
return colorName;
|
|
2739
|
+
return colorName$1;
|
|
2715
2740
|
}
|
|
2716
|
-
var conversions;
|
|
2717
|
-
var hasRequiredConversions;
|
|
2718
|
-
function requireConversions() {
|
|
2719
|
-
if (hasRequiredConversions)
|
|
2720
|
-
return conversions;
|
|
2721
|
-
hasRequiredConversions = 1;
|
|
2722
|
-
const cssKeywords = requireColorName();
|
|
2741
|
+
var conversions$1;
|
|
2742
|
+
var hasRequiredConversions$1;
|
|
2743
|
+
function requireConversions$1() {
|
|
2744
|
+
if (hasRequiredConversions$1)
|
|
2745
|
+
return conversions$1;
|
|
2746
|
+
hasRequiredConversions$1 = 1;
|
|
2747
|
+
const cssKeywords = requireColorName$1();
|
|
2723
2748
|
const reverseKeywords = {};
|
|
2724
2749
|
for (const key of Object.keys(cssKeywords)) {
|
|
2725
2750
|
reverseKeywords[cssKeywords[key]] = key;
|
|
@@ -2741,7 +2766,7 @@ function requireConversions() {
|
|
|
2741
2766
|
apple: { channels: 3, labels: ["r16", "g16", "b16"] },
|
|
2742
2767
|
gray: { channels: 1, labels: ["gray"] }
|
|
2743
2768
|
};
|
|
2744
|
-
conversions = convert;
|
|
2769
|
+
conversions$1 = convert;
|
|
2745
2770
|
for (const model of Object.keys(convert)) {
|
|
2746
2771
|
if (!("channels" in convert[model])) {
|
|
2747
2772
|
throw new Error("missing channels property: " + model);
|
|
@@ -3384,15 +3409,15 @@ function requireConversions() {
|
|
|
3384
3409
|
const val = (rgb[0] + rgb[1] + rgb[2]) / 3;
|
|
3385
3410
|
return [val / 255 * 100];
|
|
3386
3411
|
};
|
|
3387
|
-
return conversions;
|
|
3412
|
+
return conversions$1;
|
|
3388
3413
|
}
|
|
3389
|
-
var route;
|
|
3390
|
-
var hasRequiredRoute;
|
|
3391
|
-
function requireRoute() {
|
|
3392
|
-
if (hasRequiredRoute)
|
|
3393
|
-
return route;
|
|
3394
|
-
hasRequiredRoute = 1;
|
|
3395
|
-
const conversions2 = requireConversions();
|
|
3414
|
+
var route$1;
|
|
3415
|
+
var hasRequiredRoute$1;
|
|
3416
|
+
function requireRoute$1() {
|
|
3417
|
+
if (hasRequiredRoute$1)
|
|
3418
|
+
return route$1;
|
|
3419
|
+
hasRequiredRoute$1 = 1;
|
|
3420
|
+
const conversions2 = requireConversions$1();
|
|
3396
3421
|
function buildGraph() {
|
|
3397
3422
|
const graph = {};
|
|
3398
3423
|
const models = Object.keys(conversions2);
|
|
@@ -3431,18 +3456,18 @@ function requireRoute() {
|
|
|
3431
3456
|
};
|
|
3432
3457
|
}
|
|
3433
3458
|
function wrapConversion(toModel, graph) {
|
|
3434
|
-
const
|
|
3459
|
+
const path2 = [graph[toModel].parent, toModel];
|
|
3435
3460
|
let fn = conversions2[graph[toModel].parent][toModel];
|
|
3436
3461
|
let cur = graph[toModel].parent;
|
|
3437
3462
|
while (graph[cur].parent) {
|
|
3438
|
-
|
|
3463
|
+
path2.unshift(graph[cur].parent);
|
|
3439
3464
|
fn = link(conversions2[graph[cur].parent][cur], fn);
|
|
3440
3465
|
cur = graph[cur].parent;
|
|
3441
3466
|
}
|
|
3442
|
-
fn.conversion =
|
|
3467
|
+
fn.conversion = path2;
|
|
3443
3468
|
return fn;
|
|
3444
3469
|
}
|
|
3445
|
-
route = function(fromModel) {
|
|
3470
|
+
route$1 = function(fromModel) {
|
|
3446
3471
|
const graph = deriveBFS(fromModel);
|
|
3447
3472
|
const conversion = {};
|
|
3448
3473
|
const models = Object.keys(graph);
|
|
@@ -3456,16 +3481,16 @@ function requireRoute() {
|
|
|
3456
3481
|
}
|
|
3457
3482
|
return conversion;
|
|
3458
3483
|
};
|
|
3459
|
-
return route;
|
|
3484
|
+
return route$1;
|
|
3460
3485
|
}
|
|
3461
|
-
var colorConvert;
|
|
3462
|
-
var hasRequiredColorConvert;
|
|
3463
|
-
function requireColorConvert() {
|
|
3464
|
-
if (hasRequiredColorConvert)
|
|
3465
|
-
return colorConvert;
|
|
3466
|
-
hasRequiredColorConvert = 1;
|
|
3467
|
-
const conversions2 = requireConversions();
|
|
3468
|
-
const route2 = requireRoute();
|
|
3486
|
+
var colorConvert$1;
|
|
3487
|
+
var hasRequiredColorConvert$1;
|
|
3488
|
+
function requireColorConvert$1() {
|
|
3489
|
+
if (hasRequiredColorConvert$1)
|
|
3490
|
+
return colorConvert$1;
|
|
3491
|
+
hasRequiredColorConvert$1 = 1;
|
|
3492
|
+
const conversions2 = requireConversions$1();
|
|
3493
|
+
const route2 = requireRoute$1();
|
|
3469
3494
|
const convert = {};
|
|
3470
3495
|
const models = Object.keys(conversions2);
|
|
3471
3496
|
function wrapRaw(fn) {
|
|
@@ -3518,10 +3543,10 @@ function requireColorConvert() {
|
|
|
3518
3543
|
convert[fromModel][toModel].raw = wrapRaw(fn);
|
|
3519
3544
|
});
|
|
3520
3545
|
});
|
|
3521
|
-
colorConvert = convert;
|
|
3522
|
-
return colorConvert;
|
|
3546
|
+
colorConvert$1 = convert;
|
|
3547
|
+
return colorConvert$1;
|
|
3523
3548
|
}
|
|
3524
|
-
ansiStyles$
|
|
3549
|
+
ansiStyles$3.exports;
|
|
3525
3550
|
(function(module) {
|
|
3526
3551
|
const wrapAnsi16 = (fn, offset) => (...args) => {
|
|
3527
3552
|
const code = fn(...args);
|
|
@@ -3555,16 +3580,16 @@ ansiStyles$1.exports;
|
|
|
3555
3580
|
let colorConvert2;
|
|
3556
3581
|
const makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => {
|
|
3557
3582
|
if (colorConvert2 === void 0) {
|
|
3558
|
-
colorConvert2 = requireColorConvert();
|
|
3583
|
+
colorConvert2 = requireColorConvert$1();
|
|
3559
3584
|
}
|
|
3560
3585
|
const offset = isBackground ? 10 : 0;
|
|
3561
3586
|
const styles2 = {};
|
|
3562
3587
|
for (const [sourceSpace, suite] of Object.entries(colorConvert2)) {
|
|
3563
|
-
const
|
|
3588
|
+
const name2 = sourceSpace === "ansi16" ? "ansi" : sourceSpace;
|
|
3564
3589
|
if (sourceSpace === targetSpace) {
|
|
3565
|
-
styles2[
|
|
3590
|
+
styles2[name2] = wrap(identity, offset);
|
|
3566
3591
|
} else if (typeof suite === "object") {
|
|
3567
|
-
styles2[
|
|
3592
|
+
styles2[name2] = wrap(suite[targetSpace], offset);
|
|
3568
3593
|
}
|
|
3569
3594
|
}
|
|
3570
3595
|
return styles2;
|
|
@@ -3658,13 +3683,13 @@ ansiStyles$1.exports;
|
|
|
3658
3683
|
enumerable: true,
|
|
3659
3684
|
get: assembleStyles
|
|
3660
3685
|
});
|
|
3661
|
-
})(ansiStyles$
|
|
3662
|
-
var ansiStylesExports = ansiStyles$
|
|
3663
|
-
var browser = {
|
|
3686
|
+
})(ansiStyles$3);
|
|
3687
|
+
var ansiStylesExports$1 = ansiStyles$3.exports;
|
|
3688
|
+
var browser$2 = {
|
|
3664
3689
|
stdout: false,
|
|
3665
3690
|
stderr: false
|
|
3666
3691
|
};
|
|
3667
|
-
const stringReplaceAll$
|
|
3692
|
+
const stringReplaceAll$3 = (string, substring, replacer) => {
|
|
3668
3693
|
let index = string.indexOf(substring);
|
|
3669
3694
|
if (index === -1) {
|
|
3670
3695
|
return string;
|
|
@@ -3680,7 +3705,7 @@ const stringReplaceAll$1 = (string, substring, replacer) => {
|
|
|
3680
3705
|
returnValue += string.substr(endIndex);
|
|
3681
3706
|
return returnValue;
|
|
3682
3707
|
};
|
|
3683
|
-
const stringEncaseCRLFWithFirstIndex$
|
|
3708
|
+
const stringEncaseCRLFWithFirstIndex$3 = (string, prefix, postfix, index) => {
|
|
3684
3709
|
let endIndex = 0;
|
|
3685
3710
|
let returnValue = "";
|
|
3686
3711
|
do {
|
|
@@ -3692,16 +3717,16 @@ const stringEncaseCRLFWithFirstIndex$1 = (string, prefix, postfix, index) => {
|
|
|
3692
3717
|
returnValue += string.substr(endIndex);
|
|
3693
3718
|
return returnValue;
|
|
3694
3719
|
};
|
|
3695
|
-
var util = {
|
|
3696
|
-
stringReplaceAll: stringReplaceAll$
|
|
3697
|
-
stringEncaseCRLFWithFirstIndex: stringEncaseCRLFWithFirstIndex$
|
|
3720
|
+
var util$1 = {
|
|
3721
|
+
stringReplaceAll: stringReplaceAll$3,
|
|
3722
|
+
stringEncaseCRLFWithFirstIndex: stringEncaseCRLFWithFirstIndex$3
|
|
3698
3723
|
};
|
|
3699
|
-
var templates;
|
|
3700
|
-
var hasRequiredTemplates;
|
|
3701
|
-
function requireTemplates() {
|
|
3702
|
-
if (hasRequiredTemplates)
|
|
3703
|
-
return templates;
|
|
3704
|
-
hasRequiredTemplates = 1;
|
|
3724
|
+
var templates$1;
|
|
3725
|
+
var hasRequiredTemplates$1;
|
|
3726
|
+
function requireTemplates$1() {
|
|
3727
|
+
if (hasRequiredTemplates$1)
|
|
3728
|
+
return templates$1;
|
|
3729
|
+
hasRequiredTemplates$1 = 1;
|
|
3705
3730
|
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;
|
|
3706
3731
|
const STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
|
|
3707
3732
|
const STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;
|
|
@@ -3729,7 +3754,7 @@ function requireTemplates() {
|
|
|
3729
3754
|
}
|
|
3730
3755
|
return ESCAPES.get(c) || c;
|
|
3731
3756
|
}
|
|
3732
|
-
function parseArguments(
|
|
3757
|
+
function parseArguments(name2, arguments_) {
|
|
3733
3758
|
const results = [];
|
|
3734
3759
|
const chunks = arguments_.trim().split(/\s*,\s*/g);
|
|
3735
3760
|
let matches;
|
|
@@ -3740,7 +3765,7 @@ function requireTemplates() {
|
|
|
3740
3765
|
} else if (matches = chunk.match(STRING_REGEX)) {
|
|
3741
3766
|
results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, character) => escape ? unescape(escape) : character));
|
|
3742
3767
|
} else {
|
|
3743
|
-
throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${
|
|
3768
|
+
throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name2}')`);
|
|
3744
3769
|
}
|
|
3745
3770
|
}
|
|
3746
3771
|
return results;
|
|
@@ -3750,12 +3775,12 @@ function requireTemplates() {
|
|
|
3750
3775
|
const results = [];
|
|
3751
3776
|
let matches;
|
|
3752
3777
|
while ((matches = STYLE_REGEX.exec(style)) !== null) {
|
|
3753
|
-
const
|
|
3778
|
+
const name2 = matches[1];
|
|
3754
3779
|
if (matches[2]) {
|
|
3755
|
-
const args = parseArguments(
|
|
3756
|
-
results.push([
|
|
3780
|
+
const args = parseArguments(name2, matches[2]);
|
|
3781
|
+
results.push([name2].concat(args));
|
|
3757
3782
|
} else {
|
|
3758
|
-
results.push([
|
|
3783
|
+
results.push([name2]);
|
|
3759
3784
|
}
|
|
3760
3785
|
}
|
|
3761
3786
|
return results;
|
|
@@ -3779,7 +3804,7 @@ function requireTemplates() {
|
|
|
3779
3804
|
}
|
|
3780
3805
|
return current;
|
|
3781
3806
|
}
|
|
3782
|
-
templates = (chalk2, temporary) => {
|
|
3807
|
+
templates$1 = (chalk2, temporary) => {
|
|
3783
3808
|
const styles2 = [];
|
|
3784
3809
|
const chunks = [];
|
|
3785
3810
|
let chunk = [];
|
|
@@ -3809,92 +3834,92 @@ function requireTemplates() {
|
|
|
3809
3834
|
}
|
|
3810
3835
|
return chunks.join("");
|
|
3811
3836
|
};
|
|
3812
|
-
return templates;
|
|
3837
|
+
return templates$1;
|
|
3813
3838
|
}
|
|
3814
|
-
const ansiStyles = ansiStylesExports;
|
|
3815
|
-
const { stdout: stdoutColor, stderr: stderrColor } = browser;
|
|
3839
|
+
const ansiStyles$2 = ansiStylesExports$1;
|
|
3840
|
+
const { stdout: stdoutColor$1, stderr: stderrColor$1 } = browser$2;
|
|
3816
3841
|
const {
|
|
3817
|
-
stringReplaceAll,
|
|
3818
|
-
stringEncaseCRLFWithFirstIndex
|
|
3819
|
-
} = util;
|
|
3820
|
-
const { isArray } = Array;
|
|
3821
|
-
const levelMapping = [
|
|
3842
|
+
stringReplaceAll: stringReplaceAll$2,
|
|
3843
|
+
stringEncaseCRLFWithFirstIndex: stringEncaseCRLFWithFirstIndex$2
|
|
3844
|
+
} = util$1;
|
|
3845
|
+
const { isArray: isArray$1 } = Array;
|
|
3846
|
+
const levelMapping$1 = [
|
|
3822
3847
|
"ansi",
|
|
3823
3848
|
"ansi",
|
|
3824
3849
|
"ansi256",
|
|
3825
3850
|
"ansi16m"
|
|
3826
3851
|
];
|
|
3827
|
-
const styles = /* @__PURE__ */ Object.create(null);
|
|
3828
|
-
const applyOptions = (object, options = {}) => {
|
|
3852
|
+
const styles$1 = /* @__PURE__ */ Object.create(null);
|
|
3853
|
+
const applyOptions$1 = (object, options = {}) => {
|
|
3829
3854
|
if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
|
|
3830
3855
|
throw new Error("The `level` option should be an integer from 0 to 3");
|
|
3831
3856
|
}
|
|
3832
|
-
const colorLevel = stdoutColor ? stdoutColor.level : 0;
|
|
3857
|
+
const colorLevel = stdoutColor$1 ? stdoutColor$1.level : 0;
|
|
3833
3858
|
object.level = options.level === void 0 ? colorLevel : options.level;
|
|
3834
3859
|
};
|
|
3835
|
-
class ChalkClass {
|
|
3860
|
+
let ChalkClass$1 = class ChalkClass {
|
|
3836
3861
|
constructor(options) {
|
|
3837
|
-
return chalkFactory(options);
|
|
3862
|
+
return chalkFactory$1(options);
|
|
3838
3863
|
}
|
|
3839
|
-
}
|
|
3840
|
-
const chalkFactory = (options) => {
|
|
3864
|
+
};
|
|
3865
|
+
const chalkFactory$1 = (options) => {
|
|
3841
3866
|
const chalk2 = {};
|
|
3842
|
-
applyOptions(chalk2, options);
|
|
3843
|
-
chalk2.template = (...arguments_) => chalkTag(chalk2.template, ...arguments_);
|
|
3844
|
-
Object.setPrototypeOf(chalk2, Chalk.prototype);
|
|
3867
|
+
applyOptions$1(chalk2, options);
|
|
3868
|
+
chalk2.template = (...arguments_) => chalkTag$1(chalk2.template, ...arguments_);
|
|
3869
|
+
Object.setPrototypeOf(chalk2, Chalk$1.prototype);
|
|
3845
3870
|
Object.setPrototypeOf(chalk2.template, chalk2);
|
|
3846
3871
|
chalk2.template.constructor = () => {
|
|
3847
3872
|
throw new Error("`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.");
|
|
3848
3873
|
};
|
|
3849
|
-
chalk2.template.Instance = ChalkClass;
|
|
3874
|
+
chalk2.template.Instance = ChalkClass$1;
|
|
3850
3875
|
return chalk2.template;
|
|
3851
3876
|
};
|
|
3852
|
-
function Chalk(options) {
|
|
3853
|
-
return chalkFactory(options);
|
|
3877
|
+
function Chalk$1(options) {
|
|
3878
|
+
return chalkFactory$1(options);
|
|
3854
3879
|
}
|
|
3855
|
-
for (const [styleName, style] of Object.entries(ansiStyles)) {
|
|
3856
|
-
styles[styleName] = {
|
|
3880
|
+
for (const [styleName, style] of Object.entries(ansiStyles$2)) {
|
|
3881
|
+
styles$1[styleName] = {
|
|
3857
3882
|
get() {
|
|
3858
|
-
const builder = createBuilder(this, createStyler(style.open, style.close, this._styler), this._isEmpty);
|
|
3883
|
+
const builder = createBuilder$1(this, createStyler$1(style.open, style.close, this._styler), this._isEmpty);
|
|
3859
3884
|
Object.defineProperty(this, styleName, { value: builder });
|
|
3860
3885
|
return builder;
|
|
3861
3886
|
}
|
|
3862
3887
|
};
|
|
3863
3888
|
}
|
|
3864
|
-
styles.visible = {
|
|
3889
|
+
styles$1.visible = {
|
|
3865
3890
|
get() {
|
|
3866
|
-
const builder = createBuilder(this, this._styler, true);
|
|
3891
|
+
const builder = createBuilder$1(this, this._styler, true);
|
|
3867
3892
|
Object.defineProperty(this, "visible", { value: builder });
|
|
3868
3893
|
return builder;
|
|
3869
3894
|
}
|
|
3870
3895
|
};
|
|
3871
|
-
const usedModels = ["rgb", "hex", "keyword", "hsl", "hsv", "hwb", "ansi", "ansi256"];
|
|
3872
|
-
for (const model of usedModels) {
|
|
3873
|
-
styles[model] = {
|
|
3896
|
+
const usedModels$1 = ["rgb", "hex", "keyword", "hsl", "hsv", "hwb", "ansi", "ansi256"];
|
|
3897
|
+
for (const model of usedModels$1) {
|
|
3898
|
+
styles$1[model] = {
|
|
3874
3899
|
get() {
|
|
3875
3900
|
const { level } = this;
|
|
3876
3901
|
return function(...arguments_) {
|
|
3877
|
-
const styler = createStyler(ansiStyles.color[levelMapping[level]][model](...arguments_), ansiStyles.color.close, this._styler);
|
|
3878
|
-
return createBuilder(this, styler, this._isEmpty);
|
|
3902
|
+
const styler = createStyler$1(ansiStyles$2.color[levelMapping$1[level]][model](...arguments_), ansiStyles$2.color.close, this._styler);
|
|
3903
|
+
return createBuilder$1(this, styler, this._isEmpty);
|
|
3879
3904
|
};
|
|
3880
3905
|
}
|
|
3881
3906
|
};
|
|
3882
3907
|
}
|
|
3883
|
-
for (const model of usedModels) {
|
|
3908
|
+
for (const model of usedModels$1) {
|
|
3884
3909
|
const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
|
|
3885
|
-
styles[bgModel] = {
|
|
3910
|
+
styles$1[bgModel] = {
|
|
3886
3911
|
get() {
|
|
3887
3912
|
const { level } = this;
|
|
3888
3913
|
return function(...arguments_) {
|
|
3889
|
-
const styler = createStyler(ansiStyles.bgColor[levelMapping[level]][model](...arguments_), ansiStyles.bgColor.close, this._styler);
|
|
3890
|
-
return createBuilder(this, styler, this._isEmpty);
|
|
3914
|
+
const styler = createStyler$1(ansiStyles$2.bgColor[levelMapping$1[level]][model](...arguments_), ansiStyles$2.bgColor.close, this._styler);
|
|
3915
|
+
return createBuilder$1(this, styler, this._isEmpty);
|
|
3891
3916
|
};
|
|
3892
3917
|
}
|
|
3893
3918
|
};
|
|
3894
3919
|
}
|
|
3895
|
-
const proto = Object.defineProperties(() => {
|
|
3920
|
+
const proto$1 = Object.defineProperties(() => {
|
|
3896
3921
|
}, {
|
|
3897
|
-
...styles,
|
|
3922
|
+
...styles$1,
|
|
3898
3923
|
level: {
|
|
3899
3924
|
enumerable: true,
|
|
3900
3925
|
get() {
|
|
@@ -3905,7 +3930,7 @@ const proto = Object.defineProperties(() => {
|
|
|
3905
3930
|
}
|
|
3906
3931
|
}
|
|
3907
3932
|
});
|
|
3908
|
-
const createStyler = (open, close, parent) => {
|
|
3933
|
+
const createStyler$1 = (open, close, parent) => {
|
|
3909
3934
|
let openAll;
|
|
3910
3935
|
let closeAll;
|
|
3911
3936
|
if (parent === void 0) {
|
|
@@ -3923,20 +3948,20 @@ const createStyler = (open, close, parent) => {
|
|
|
3923
3948
|
parent
|
|
3924
3949
|
};
|
|
3925
3950
|
};
|
|
3926
|
-
const createBuilder = (self2, _styler, _isEmpty) => {
|
|
3951
|
+
const createBuilder$1 = (self2, _styler, _isEmpty) => {
|
|
3927
3952
|
const builder = (...arguments_) => {
|
|
3928
|
-
if (isArray(arguments_[0]) && isArray(arguments_[0].raw)) {
|
|
3929
|
-
return applyStyle(builder, chalkTag(builder, ...arguments_));
|
|
3953
|
+
if (isArray$1(arguments_[0]) && isArray$1(arguments_[0].raw)) {
|
|
3954
|
+
return applyStyle$1(builder, chalkTag$1(builder, ...arguments_));
|
|
3930
3955
|
}
|
|
3931
|
-
return applyStyle(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
|
|
3956
|
+
return applyStyle$1(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
|
|
3932
3957
|
};
|
|
3933
|
-
Object.setPrototypeOf(builder, proto);
|
|
3958
|
+
Object.setPrototypeOf(builder, proto$1);
|
|
3934
3959
|
builder._generator = self2;
|
|
3935
3960
|
builder._styler = _styler;
|
|
3936
3961
|
builder._isEmpty = _isEmpty;
|
|
3937
3962
|
return builder;
|
|
3938
3963
|
};
|
|
3939
|
-
const applyStyle = (self2, string) => {
|
|
3964
|
+
const applyStyle$1 = (self2, string) => {
|
|
3940
3965
|
if (self2.level <= 0 || !string) {
|
|
3941
3966
|
return self2._isEmpty ? "" : string;
|
|
3942
3967
|
}
|
|
@@ -3947,20 +3972,20 @@ const applyStyle = (self2, string) => {
|
|
|
3947
3972
|
const { openAll, closeAll } = styler;
|
|
3948
3973
|
if (string.indexOf("\x1B") !== -1) {
|
|
3949
3974
|
while (styler !== void 0) {
|
|
3950
|
-
string = stringReplaceAll(string, styler.close, styler.open);
|
|
3975
|
+
string = stringReplaceAll$2(string, styler.close, styler.open);
|
|
3951
3976
|
styler = styler.parent;
|
|
3952
3977
|
}
|
|
3953
3978
|
}
|
|
3954
3979
|
const lfIndex = string.indexOf("\n");
|
|
3955
3980
|
if (lfIndex !== -1) {
|
|
3956
|
-
string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
|
|
3981
|
+
string = stringEncaseCRLFWithFirstIndex$2(string, closeAll, openAll, lfIndex);
|
|
3957
3982
|
}
|
|
3958
3983
|
return openAll + string + closeAll;
|
|
3959
3984
|
};
|
|
3960
|
-
let template;
|
|
3961
|
-
const chalkTag = (chalk2, ...strings) => {
|
|
3985
|
+
let template$1;
|
|
3986
|
+
const chalkTag$1 = (chalk2, ...strings) => {
|
|
3962
3987
|
const [firstString] = strings;
|
|
3963
|
-
if (!isArray(firstString) || !isArray(firstString.raw)) {
|
|
3988
|
+
if (!isArray$1(firstString) || !isArray$1(firstString.raw)) {
|
|
3964
3989
|
return strings.join(" ");
|
|
3965
3990
|
}
|
|
3966
3991
|
const arguments_ = strings.slice(1);
|
|
@@ -3971,18 +3996,18 @@ const chalkTag = (chalk2, ...strings) => {
|
|
|
3971
3996
|
String(firstString.raw[i])
|
|
3972
3997
|
);
|
|
3973
3998
|
}
|
|
3974
|
-
if (template === void 0) {
|
|
3975
|
-
template = requireTemplates();
|
|
3999
|
+
if (template$1 === void 0) {
|
|
4000
|
+
template$1 = requireTemplates$1();
|
|
3976
4001
|
}
|
|
3977
|
-
return template(chalk2, parts.join(""));
|
|
4002
|
+
return template$1(chalk2, parts.join(""));
|
|
3978
4003
|
};
|
|
3979
|
-
Object.defineProperties(Chalk.prototype, styles);
|
|
3980
|
-
const chalk = Chalk();
|
|
3981
|
-
chalk.supportsColor = stdoutColor;
|
|
3982
|
-
chalk.stderr = Chalk({ level: stderrColor ? stderrColor.level : 0 });
|
|
3983
|
-
chalk.stderr.supportsColor = stderrColor;
|
|
3984
|
-
var source = chalk;
|
|
3985
|
-
const chalk$
|
|
4004
|
+
Object.defineProperties(Chalk$1.prototype, styles$1);
|
|
4005
|
+
const chalk$2 = Chalk$1();
|
|
4006
|
+
chalk$2.supportsColor = stdoutColor$1;
|
|
4007
|
+
chalk$2.stderr = Chalk$1({ level: stderrColor$1 ? stderrColor$1.level : 0 });
|
|
4008
|
+
chalk$2.stderr.supportsColor = stderrColor$1;
|
|
4009
|
+
var source$1 = chalk$2;
|
|
4010
|
+
const chalk$3 = /* @__PURE__ */ getDefaultExportFromCjs$1(source$1);
|
|
3986
4011
|
var ePublishState = /* @__PURE__ */ ((ePublishState2) => {
|
|
3987
4012
|
ePublishState2[ePublishState2["init"] = 0] = "init";
|
|
3988
4013
|
ePublishState2[ePublishState2["started"] = 1] = "started";
|
|
@@ -4034,7 +4059,7 @@ class PublishInstrumentController extends STSOptionsBase {
|
|
|
4034
4059
|
}
|
|
4035
4060
|
async StartPublish() {
|
|
4036
4061
|
if (__privateGet(this, _publishState) !== 0) {
|
|
4037
|
-
this.options.logger.debug(chalk$
|
|
4062
|
+
this.options.logger.debug(chalk$3.yellow(`StartPublish:${this.options.processContext.nid}: StartPublish called when not currently in the init state.`));
|
|
4038
4063
|
return false;
|
|
4039
4064
|
}
|
|
4040
4065
|
__privateSet(this, _publishState, 1);
|
|
@@ -4043,7 +4068,7 @@ class PublishInstrumentController extends STSOptionsBase {
|
|
|
4043
4068
|
}
|
|
4044
4069
|
async EndPublish() {
|
|
4045
4070
|
if (__privateGet(this, _publishState) !== 1) {
|
|
4046
|
-
this.options.logger.debug(chalk$
|
|
4071
|
+
this.options.logger.debug(chalk$3.yellow(`EndPublish:${this.options.processContext.nid}: EndPublish called when not within the started state.`));
|
|
4047
4072
|
return false;
|
|
4048
4073
|
}
|
|
4049
4074
|
__privateSet(this, _publishState, 2);
|
|
@@ -4058,11 +4083,11 @@ class PublishInstrumentController extends STSOptionsBase {
|
|
|
4058
4083
|
}
|
|
4059
4084
|
SetupInstrumentation() {
|
|
4060
4085
|
if (!this.options.instrumentDefinitions) {
|
|
4061
|
-
this.options.logger.debug(chalk$
|
|
4086
|
+
this.options.logger.debug(chalk$3.yellow(`SetupInstrumentation:${this.options.processContext.nid}: No instrument(s) defined within supplied options.`));
|
|
4062
4087
|
return;
|
|
4063
4088
|
}
|
|
4064
4089
|
if (!this.options.processContext) {
|
|
4065
|
-
this.options.logger.debug(chalk$
|
|
4090
|
+
this.options.logger.debug(chalk$3.yellow(`SetupInstrumentation: No context defined within supplied options.`));
|
|
4066
4091
|
return;
|
|
4067
4092
|
}
|
|
4068
4093
|
__privateMethod(this, _CreateInstruments, CreateInstruments_fn).call(this, this.options.instrumentDefinitions);
|
|
@@ -4087,7 +4112,7 @@ class PublishInstrumentController extends STSOptionsBase {
|
|
|
4087
4112
|
if (__privateGet(this, _instruments)[instrumentName]) {
|
|
4088
4113
|
__privateMethod(this, _ProcessTelemetryCommand, ProcessTelemetryCommand_fn).call(this, instrumentName, telemetry);
|
|
4089
4114
|
} else {
|
|
4090
|
-
this.options.logger.debug(chalk$
|
|
4115
|
+
this.options.logger.debug(chalk$3.red(`UpdateInstrument:${this.options.processContext.nid}: Attempted to UpdateInstrument before initialised.`));
|
|
4091
4116
|
}
|
|
4092
4117
|
}
|
|
4093
4118
|
/*
|
|
@@ -4316,21 +4341,21 @@ const GetSTSInstrumentController = (app) => {
|
|
|
4316
4341
|
const STSInstrumentControllerPlugin = {
|
|
4317
4342
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4318
4343
|
install: (app, options) => {
|
|
4319
|
-
options.logger.debug(chalk$
|
|
4344
|
+
options.logger.debug(chalk$3.yellow(`STSInstrumentControllerPlugin:install:Start`));
|
|
4320
4345
|
const aic = new AgentInstrumentController(options);
|
|
4321
4346
|
if (!app.config.globalProperties.$sts) {
|
|
4322
|
-
options.logger.debug(chalk$
|
|
4347
|
+
options.logger.debug(chalk$3.cyan(`STSInstrumentControllerPlugin:install: [app.config.globalProperties.$sts] does not exist.`));
|
|
4323
4348
|
app.config.globalProperties.$sts = {};
|
|
4324
|
-
options.logger.debug(chalk$
|
|
4349
|
+
options.logger.debug(chalk$3.cyan(`STSInstrumentControllerPlugin:install: created empty [app.config.globalProperties.$sts].`));
|
|
4325
4350
|
} else {
|
|
4326
|
-
options.logger.debug(chalk$
|
|
4351
|
+
options.logger.debug(chalk$3.cyan(`STSInstrumentControllerPlugin:install: [app.config.globalProperties.$sts] already exists.`));
|
|
4327
4352
|
}
|
|
4328
4353
|
app.config.globalProperties.$sts.aic = aic;
|
|
4329
4354
|
app.config.globalProperties.$sts[STSInstrumentControllerPluginKey] = aic;
|
|
4330
|
-
options.logger.debug(chalk$
|
|
4355
|
+
options.logger.debug(chalk$3.cyan(`STSInstrumentControllerPlugin:install: AgentInstrumentController installed into [app.config.globalProperties.$sts] using: [${String(STSInstrumentControllerPluginKey)}].`));
|
|
4331
4356
|
app.provide(STSInstrumentControllerPluginKey, aic);
|
|
4332
|
-
options.logger.debug(chalk$
|
|
4333
|
-
options.logger.debug(chalk$
|
|
4357
|
+
options.logger.debug(chalk$3.cyan(`STSInstrumentControllerPlugin:install: AgentInstrumentController installed into 'provide' using: [${String(STSInstrumentControllerPluginKey)}].`));
|
|
4358
|
+
options.logger.debug(chalk$3.green(`STSInstrumentControllerPlugin:install:End`));
|
|
4334
4359
|
}
|
|
4335
4360
|
};
|
|
4336
4361
|
function utf8Count(str) {
|
|
@@ -5016,14 +5041,14 @@ class PublishTransportRESTServer extends STSOptionsBase {
|
|
|
5016
5041
|
}
|
|
5017
5042
|
}
|
|
5018
5043
|
if (retVal.status !== 200) {
|
|
5019
|
-
this.options.logger.debug(chalk$
|
|
5044
|
+
this.options.logger.debug(chalk$3.red(`Error (_PerformPublishRESTAPI:_PerformPublish:#publishmessage): Invalid response from server: [${retVal.status}]`));
|
|
5020
5045
|
return false;
|
|
5021
5046
|
} else {
|
|
5022
|
-
this.options.logger.debug(chalk$
|
|
5047
|
+
this.options.logger.debug(chalk$3.green(`_PerformPublishRESTAPI:_PerformPublish:#publishmessage: [${this.options.url}] - Valid response from server: [${retVal.status}]`));
|
|
5023
5048
|
}
|
|
5024
5049
|
return true;
|
|
5025
5050
|
} catch (error) {
|
|
5026
|
-
this.options.logger.error(chalk$
|
|
5051
|
+
this.options.logger.error(chalk$3.red(`Error (PublishRESTServer:_PerformPublishRESTAPI:Error: [${error}]`));
|
|
5027
5052
|
return false;
|
|
5028
5053
|
}
|
|
5029
5054
|
});
|
|
@@ -5359,10 +5384,8 @@ class KafkaHelper {
|
|
|
5359
5384
|
}
|
|
5360
5385
|
_kafkaLog = new WeakMap();
|
|
5361
5386
|
_maxLogLength = new WeakMap();
|
|
5362
|
-
const debug = debugModule(`proc:${process.pid}`);
|
|
5363
5387
|
class ObservabilityRESTAPISubscriber {
|
|
5364
5388
|
constructor(options) {
|
|
5365
|
-
__privateAdd(this, _LogMessage);
|
|
5366
5389
|
__privateAdd(this, _LogDebugMessage);
|
|
5367
5390
|
__privateAdd(this, _LogErrorMessage);
|
|
5368
5391
|
__privateAdd(this, _InvokeRESTAPI);
|
|
@@ -5384,7 +5407,7 @@ class ObservabilityRESTAPISubscriber {
|
|
|
5384
5407
|
subscription.cb(payload);
|
|
5385
5408
|
}
|
|
5386
5409
|
} catch (error) {
|
|
5387
|
-
__privateMethod(this, _LogErrorMessage, LogErrorMessage_fn).call(this, chalk$
|
|
5410
|
+
__privateMethod(this, _LogErrorMessage, LogErrorMessage_fn).call(this, chalk$3.red(`ObservabilityRESTAPISubscriber:#AddKeepAlive(): Error response: [${JSON.stringify(error)}]`));
|
|
5388
5411
|
__privateMethod(this, _RemoveKeepAlive, RemoveKeepAlive_fn).call(this, subscription);
|
|
5389
5412
|
}
|
|
5390
5413
|
});
|
|
@@ -5396,11 +5419,11 @@ class ObservabilityRESTAPISubscriber {
|
|
|
5396
5419
|
async Subscribe(subscriptions) {
|
|
5397
5420
|
subscriptions.map(async (subId) => {
|
|
5398
5421
|
__privateMethod(this, _RemoveKeepAlive, RemoveKeepAlive_fn).call(this, subId);
|
|
5399
|
-
__privateMethod(this, _LogDebugMessage, LogDebugMessage_fn).call(this, chalk$
|
|
5422
|
+
__privateMethod(this, _LogDebugMessage, LogDebugMessage_fn).call(this, chalk$3.yellow(`ObservabilityRESTAPISubscriber:Subscribe(): Sending subscribe: subscriptionKey: [${subId.subscriptionKey.id}]`));
|
|
5400
5423
|
try {
|
|
5401
5424
|
__privateMethod(this, _AddKeepAlive, AddKeepAlive_fn).call(this, subId);
|
|
5402
5425
|
} catch (error) {
|
|
5403
|
-
__privateMethod(this, _LogErrorMessage, LogErrorMessage_fn).call(this, chalk$
|
|
5426
|
+
__privateMethod(this, _LogErrorMessage, LogErrorMessage_fn).call(this, chalk$3.red(`ObservabilityRESTAPISubscriber:Subscribe(): Error: response: [${JSON.stringify(error)}]`));
|
|
5404
5427
|
__privateMethod(this, _RemoveKeepAlive, RemoveKeepAlive_fn).call(this, subId);
|
|
5405
5428
|
}
|
|
5406
5429
|
});
|
|
@@ -5411,16 +5434,12 @@ class ObservabilityRESTAPISubscriber {
|
|
|
5411
5434
|
UnSubscribe(subscriptions) {
|
|
5412
5435
|
subscriptions.map(async (subId) => {
|
|
5413
5436
|
__privateMethod(this, _RemoveKeepAlive, RemoveKeepAlive_fn).call(this, subId);
|
|
5414
|
-
__privateMethod(this, _LogDebugMessage, LogDebugMessage_fn).call(this, chalk$
|
|
5437
|
+
__privateMethod(this, _LogDebugMessage, LogDebugMessage_fn).call(this, chalk$3.yellow(`ObservabilityRESTAPISubscriber:UnSubscribe(): Sending unsubscribe: subscriptionKey: [${subId.subscriptionKey.id}]`));
|
|
5415
5438
|
});
|
|
5416
5439
|
}
|
|
5417
5440
|
}
|
|
5418
5441
|
_socketSubscribeKeepAlive = new WeakMap();
|
|
5419
5442
|
_options2 = new WeakMap();
|
|
5420
|
-
_LogMessage = new WeakSet();
|
|
5421
|
-
LogMessage_fn = function(message) {
|
|
5422
|
-
debug(message);
|
|
5423
|
-
};
|
|
5424
5443
|
_LogDebugMessage = new WeakSet();
|
|
5425
5444
|
LogDebugMessage_fn = function(message) {
|
|
5426
5445
|
__privateGet(this, _options2).logger.debug(message);
|
|
@@ -5552,13 +5571,13 @@ SetupTimeout_fn = function(socketSubscribeKeepAlive, subscription, timeout) {
|
|
|
5552
5571
|
if (timeoutDuration < 500) {
|
|
5553
5572
|
timeoutDuration = 500;
|
|
5554
5573
|
}
|
|
5555
|
-
__privateMethod(this, _LogDebugMessage, LogDebugMessage_fn).call(this, chalk$
|
|
5574
|
+
__privateMethod(this, _LogDebugMessage, LogDebugMessage_fn).call(this, chalk$3.yellow(`Total duration for subscription: [${diff}], waiting: [${timeoutDuration}]`));
|
|
5556
5575
|
socketSubscribeKeepAlive.timeout = __privateMethod(this, _SetupTimeout, SetupTimeout_fn).call(this, socketSubscribeKeepAlive, subscription, timeoutDuration);
|
|
5557
5576
|
} else {
|
|
5558
|
-
__privateMethod(this, _LogDebugMessage, LogDebugMessage_fn).call(this, chalk$
|
|
5577
|
+
__privateMethod(this, _LogDebugMessage, LogDebugMessage_fn).call(this, chalk$3.yellow(`Subscription removed: [${socketSubscribeKeepAlive.id}]. Processing terminate.`));
|
|
5559
5578
|
}
|
|
5560
5579
|
} catch (error) {
|
|
5561
|
-
__privateMethod(this, _LogErrorMessage, LogErrorMessage_fn).call(this, chalk$
|
|
5580
|
+
__privateMethod(this, _LogErrorMessage, LogErrorMessage_fn).call(this, chalk$3.red(`ObservabilityRESTAPISubscriber:#AddKeepAlive(): Error response: [${JSON.stringify(error)}]`));
|
|
5562
5581
|
__privateMethod(this, _RemoveKeepAlive, RemoveKeepAlive_fn).call(this, subscription);
|
|
5563
5582
|
}
|
|
5564
5583
|
}, timeout);
|
|
@@ -5576,7 +5595,7 @@ AddKeepAlive_fn = function(subscription) {
|
|
|
5576
5595
|
_RemoveKeepAlive = new WeakSet();
|
|
5577
5596
|
RemoveKeepAlive_fn = function(subscription) {
|
|
5578
5597
|
if (__privateGet(this, _socketSubscribeKeepAlive)[subscription.subscriptionKey.id]) {
|
|
5579
|
-
__privateMethod(this, _LogDebugMessage, LogDebugMessage_fn).call(this, chalk$
|
|
5598
|
+
__privateMethod(this, _LogDebugMessage, LogDebugMessage_fn).call(this, chalk$3.gray(`ObservabilityRESTAPISubscriber:#RemoveKeepAlive(): subscriptionKey: [${subscription.subscriptionKey.id}]`));
|
|
5580
5599
|
clearTimeout(__privateGet(this, _socketSubscribeKeepAlive)[subscription.subscriptionKey.id].timeout);
|
|
5581
5600
|
delete __privateGet(this, _socketSubscribeKeepAlive)[subscription.subscriptionKey.id].timeout;
|
|
5582
5601
|
delete __privateGet(this, _socketSubscribeKeepAlive)[subscription.subscriptionKey.id];
|
|
@@ -5654,7 +5673,7 @@ class SocketIoMessageSender {
|
|
|
5654
5673
|
return __privateGet(this, _socket);
|
|
5655
5674
|
}
|
|
5656
5675
|
set socket(socket) {
|
|
5657
|
-
__privateMethod(this, _LogDebugMessage2, LogDebugMessage_fn2).call(this, chalk$
|
|
5676
|
+
__privateMethod(this, _LogDebugMessage2, LogDebugMessage_fn2).call(this, chalk$3.cyan(`SocketIoMessageSender:set socket(): new socket assigned`));
|
|
5658
5677
|
__privateSet(this, _socket, socket);
|
|
5659
5678
|
}
|
|
5660
5679
|
AckListener(message, payload) {
|
|
@@ -5667,25 +5686,25 @@ class SocketIoMessageSender {
|
|
|
5667
5686
|
message.status = "SUCCESS";
|
|
5668
5687
|
message.subscriptionKeyResponse = payload;
|
|
5669
5688
|
delete __privateGet(this, _messageWithAckPayloadRecords)[message.id];
|
|
5670
|
-
__privateMethod(this, _LogDebugMessage2, LogDebugMessage_fn2).call(this, chalk$
|
|
5689
|
+
__privateMethod(this, _LogDebugMessage2, LogDebugMessage_fn2).call(this, chalk$3.grey(`SocketIoMessageSender:AckListener(): ack received, event: [${message.eventName}], subscriptionKey: [${message.subscriptionKey.id}]`));
|
|
5671
5690
|
message.resolve(message);
|
|
5672
5691
|
}
|
|
5673
5692
|
}
|
|
5674
5693
|
ResponseTimout(message) {
|
|
5675
|
-
__privateMethod(this, _LogDebugMessage2, LogDebugMessage_fn2).call(this, chalk$
|
|
5694
|
+
__privateMethod(this, _LogDebugMessage2, LogDebugMessage_fn2).call(this, chalk$3.magenta(`SocketIoMessageSender:ResponseTimout(): timeout reached: [${__privateGet(this, _timeoutValue)}], event: [${message.eventName}], subscriptionKey: [${message.subscriptionKey.id}]`));
|
|
5676
5695
|
delete message.timeoutId;
|
|
5677
5696
|
__privateGet(this, _socket).off(__privateMethod(this, _GetSubscribeKeepAliveAckEventName, GetSubscribeKeepAliveAckEventName_fn).call(this, message.eventName, message.subscriptionKey), message.BoundAckListenerCallback);
|
|
5678
5697
|
message.endTime = performance.now();
|
|
5679
5698
|
if (message.retryCount >= __privateGet(this, _maxReties)) {
|
|
5680
5699
|
message.status = "FAIL";
|
|
5681
|
-
__privateMethod(this, _LogDebugMessage2, LogDebugMessage_fn2).call(this, chalk$
|
|
5700
|
+
__privateMethod(this, _LogDebugMessage2, LogDebugMessage_fn2).call(this, chalk$3.red(`SocketIoMessageSender:ResponseTimout(): timeout reached after ${__privateGet(this, _maxReties)} retries, event: [${message.eventName}], subscriptionKey: [${message.subscriptionKey.id}]`));
|
|
5682
5701
|
delete __privateGet(this, _messageWithAckPayloadRecords)[message.id];
|
|
5683
5702
|
message.reject(message);
|
|
5684
5703
|
return;
|
|
5685
5704
|
}
|
|
5686
5705
|
message.status = "INRETRY";
|
|
5687
5706
|
message.retryCount++;
|
|
5688
|
-
__privateMethod(this, _LogDebugMessage2, LogDebugMessage_fn2).call(this, chalk$
|
|
5707
|
+
__privateMethod(this, _LogDebugMessage2, LogDebugMessage_fn2).call(this, chalk$3.magenta(`SocketIoMessageSender:ResponseTimout(): timeout reached, retrying. Retries: [${message.retryCount}], event: [${message.eventName}], subscriptionKey: [${message.subscriptionKey.id}]`));
|
|
5689
5708
|
this.SendMessage(message);
|
|
5690
5709
|
}
|
|
5691
5710
|
SendMessage(message) {
|
|
@@ -5698,7 +5717,7 @@ class SocketIoMessageSender {
|
|
|
5698
5717
|
};
|
|
5699
5718
|
message.BoundAckListenerCallback = AckListenerCallback.bind(this);
|
|
5700
5719
|
__privateGet(this, _socket).on(__privateMethod(this, _GetSubscribeKeepAliveAckEventName, GetSubscribeKeepAliveAckEventName_fn).call(this, message.eventName, message.subscriptionKey), message.BoundAckListenerCallback);
|
|
5701
|
-
__privateMethod(this, _LogDebugMessage2, LogDebugMessage_fn2).call(this, chalk$
|
|
5720
|
+
__privateMethod(this, _LogDebugMessage2, LogDebugMessage_fn2).call(this, chalk$3.gray(`SocketIoMessageSender:SendMessage(): event: [${message.eventName}], subscriptionKey: [${message.subscriptionKey.id}]`));
|
|
5702
5721
|
__privateGet(this, _socket).emit(message.eventName, message.subscriptionKey);
|
|
5703
5722
|
}
|
|
5704
5723
|
SendMessageWithAck(eventName, subscriptionKey) {
|
|
@@ -5722,7 +5741,7 @@ class SocketIoMessageSender {
|
|
|
5722
5741
|
const killIds = [];
|
|
5723
5742
|
for (const [, message] of Object.entries(__privateGet(this, _messageWithAckPayloadRecords))) {
|
|
5724
5743
|
if (message.subscriptionKey.id.localeCompare(subscriptionKey.id) === 0) {
|
|
5725
|
-
__privateMethod(this, _LogDebugMessage2, LogDebugMessage_fn2).call(this, chalk$
|
|
5744
|
+
__privateMethod(this, _LogDebugMessage2, LogDebugMessage_fn2).call(this, chalk$3.blue(`SocketIoMessageSender:KillMessageInFlight(): event: [${message.eventName}], subscriptionKey: [${message.subscriptionKey.id}]`));
|
|
5726
5745
|
clearTimeout(message.timeoutId);
|
|
5727
5746
|
delete message.timeoutId;
|
|
5728
5747
|
__privateGet(this, _socket).off(__privateMethod(this, _GetSubscribeKeepAliveAckEventName, GetSubscribeKeepAliveAckEventName_fn).call(this, message.eventName, message.subscriptionKey), message.BoundAckListenerCallback);
|
|
@@ -5772,7 +5791,7 @@ class ObservabilitySocketIOSubscriber {
|
|
|
5772
5791
|
return __privateGet(this, _socket2);
|
|
5773
5792
|
}
|
|
5774
5793
|
set socket(socket) {
|
|
5775
|
-
__privateMethod(this, _LogDebugMessage3, LogDebugMessage_fn3).call(this, chalk$
|
|
5794
|
+
__privateMethod(this, _LogDebugMessage3, LogDebugMessage_fn3).call(this, chalk$3.cyan(`ObservabilitySocketIOSubscriber:set socket(): new socket assigned`));
|
|
5776
5795
|
__privateSet(this, _socket2, socket);
|
|
5777
5796
|
__privateGet(this, _socketIoMessageSender).socket = socket;
|
|
5778
5797
|
}
|
|
@@ -5783,14 +5802,14 @@ class ObservabilitySocketIOSubscriber {
|
|
|
5783
5802
|
const socket = __privateGet(this, _socket2);
|
|
5784
5803
|
subscriptions.map(async (subId) => {
|
|
5785
5804
|
__privateMethod(this, _RemoveKeepAlive2, RemoveKeepAlive_fn2).call(this, subId);
|
|
5786
|
-
__privateMethod(this, _LogDebugMessage3, LogDebugMessage_fn3).call(this, chalk$
|
|
5805
|
+
__privateMethod(this, _LogDebugMessage3, LogDebugMessage_fn3).call(this, chalk$3.yellow(`ObservabilitySocketIOSubscriber:Subscribe(): Sending subscribe: subscriptionKey: [${subId.subscriptionKey.id}]`));
|
|
5787
5806
|
try {
|
|
5788
5807
|
const retVal = await __privateGet(this, _socketIoMessageSender).SendMessageWithAck("subscribe", subId.subscriptionKey);
|
|
5789
|
-
__privateMethod(this, _LogDebugMessage3, LogDebugMessage_fn3).call(this, chalk$
|
|
5808
|
+
__privateMethod(this, _LogDebugMessage3, LogDebugMessage_fn3).call(this, chalk$3.green(`ObservabilitySocketIOSubscriber:Subscribe(): SendMessageWithAck response: [${JSON.stringify(retVal)}]`));
|
|
5790
5809
|
__privateMethod(this, _AddKeepAlive2, AddKeepAlive_fn2).call(this, socket, subId);
|
|
5791
5810
|
socket.on(GetSocketIOSubscriptionKey(subId.subscriptionKey), subId.cb);
|
|
5792
5811
|
} catch (error) {
|
|
5793
|
-
__privateMethod(this, _LogErrorMessage2, LogErrorMessage_fn2).call(this, chalk$
|
|
5812
|
+
__privateMethod(this, _LogErrorMessage2, LogErrorMessage_fn2).call(this, chalk$3.red(`ObservabilitySocketIOSubscriber:Subscribe(): Error: response: [${JSON.stringify(error)}]`));
|
|
5794
5813
|
socket.off(GetSocketIOSubscriptionKey(subId.subscriptionKey), subId.cb);
|
|
5795
5814
|
__privateMethod(this, _RemoveKeepAlive2, RemoveKeepAlive_fn2).call(this, subId);
|
|
5796
5815
|
}
|
|
@@ -5805,12 +5824,12 @@ class ObservabilitySocketIOSubscriber {
|
|
|
5805
5824
|
socket.off(GetSocketIOSubscriptionKey(subId.subscriptionKey), subId.cb);
|
|
5806
5825
|
__privateMethod(this, _RemoveKeepAlive2, RemoveKeepAlive_fn2).call(this, subId);
|
|
5807
5826
|
__privateGet(this, _socketIoMessageSender).KillMessageInFlight(subId.subscriptionKey);
|
|
5808
|
-
__privateMethod(this, _LogDebugMessage3, LogDebugMessage_fn3).call(this, chalk$
|
|
5827
|
+
__privateMethod(this, _LogDebugMessage3, LogDebugMessage_fn3).call(this, chalk$3.yellow(`ObservabilitySocketIOSubscriber:UnSubscribe(): Sending unsubscribe: subscriptionKey: [${subId.subscriptionKey.id}]`));
|
|
5809
5828
|
try {
|
|
5810
5829
|
const retVal = await __privateGet(this, _socketIoMessageSender).SendMessageWithAck("unsubscribe", subId.subscriptionKey);
|
|
5811
|
-
__privateMethod(this, _LogDebugMessage3, LogDebugMessage_fn3).call(this, chalk$
|
|
5830
|
+
__privateMethod(this, _LogDebugMessage3, LogDebugMessage_fn3).call(this, chalk$3.green(`ObservabilitySocketIOSubscriber:UnSubscribe(): SendMessageWithAck response: [${JSON.stringify(retVal)}]`));
|
|
5812
5831
|
} catch (error) {
|
|
5813
|
-
__privateMethod(this, _LogErrorMessage2, LogErrorMessage_fn2).call(this, chalk$
|
|
5832
|
+
__privateMethod(this, _LogErrorMessage2, LogErrorMessage_fn2).call(this, chalk$3.red(`ObservabilitySocketIOSubscriber:UnSubscribe(): Error response: [${JSON.stringify(error)}]`));
|
|
5814
5833
|
}
|
|
5815
5834
|
});
|
|
5816
5835
|
}
|
|
@@ -5846,13 +5865,13 @@ AddKeepAlive_fn2 = function(socket, subscription) {
|
|
|
5846
5865
|
__privateGet(this, _socketSubscribeKeepAlive2)[subscription.subscriptionKey.id] = {
|
|
5847
5866
|
id: subscription.subscriptionKey.id,
|
|
5848
5867
|
timeout: setTimeout(async () => {
|
|
5849
|
-
__privateMethod(this, _LogDebugMessage3, LogDebugMessage_fn3).call(this, chalk$
|
|
5868
|
+
__privateMethod(this, _LogDebugMessage3, LogDebugMessage_fn3).call(this, chalk$3.yellow(`ObservabilitySocketIOSubscriber:#AddKeepAlive:timeoutCheck(): Sending keepAlive: subscriptionKey: [${subscription.subscriptionKey.id}]`));
|
|
5850
5869
|
try {
|
|
5851
5870
|
const retVal = await __privateGet(this, _socketIoMessageSender).SendMessageWithAck("subscribeKeepAlive", subscription.subscriptionKey);
|
|
5852
|
-
__privateMethod(this, _LogDebugMessage3, LogDebugMessage_fn3).call(this, chalk$
|
|
5871
|
+
__privateMethod(this, _LogDebugMessage3, LogDebugMessage_fn3).call(this, chalk$3.green(`ObservabilitySocketIOSubscriber:#AddKeepAlive(): SendMessageWithAck response: [${JSON.stringify(retVal)}]`));
|
|
5853
5872
|
__privateMethod(this, _AddKeepAlive2, AddKeepAlive_fn2).call(this, socket, subscription);
|
|
5854
5873
|
} catch (error) {
|
|
5855
|
-
__privateMethod(this, _LogErrorMessage2, LogErrorMessage_fn2).call(this, chalk$
|
|
5874
|
+
__privateMethod(this, _LogErrorMessage2, LogErrorMessage_fn2).call(this, chalk$3.red(`ObservabilitySocketIOSubscriber:#AddKeepAlive(): Error response: [${JSON.stringify(error)}]`));
|
|
5856
5875
|
socket.off(GetSocketIOSubscriptionKey(subscription.subscriptionKey), subscription.cb);
|
|
5857
5876
|
__privateMethod(this, _RemoveKeepAlive2, RemoveKeepAlive_fn2).call(this, subscription);
|
|
5858
5877
|
}
|
|
@@ -5862,7 +5881,7 @@ AddKeepAlive_fn2 = function(socket, subscription) {
|
|
|
5862
5881
|
_RemoveKeepAlive2 = new WeakSet();
|
|
5863
5882
|
RemoveKeepAlive_fn2 = function(subscription) {
|
|
5864
5883
|
if (__privateGet(this, _socketSubscribeKeepAlive2)[subscription.subscriptionKey.id]) {
|
|
5865
|
-
__privateMethod(this, _LogDebugMessage3, LogDebugMessage_fn3).call(this, chalk$
|
|
5884
|
+
__privateMethod(this, _LogDebugMessage3, LogDebugMessage_fn3).call(this, chalk$3.gray(`ObservabilitySocketIOSubscriber:#RemoveKeepAlive(): subscriptionKey: [${subscription.subscriptionKey.id}]`));
|
|
5866
5885
|
clearTimeout(__privateGet(this, _socketSubscribeKeepAlive2)[subscription.subscriptionKey.id].timeout);
|
|
5867
5886
|
delete __privateGet(this, _socketSubscribeKeepAlive2)[subscription.subscriptionKey.id];
|
|
5868
5887
|
}
|
|
@@ -5910,7 +5929,7 @@ class ObservabilitySubscriptionManager {
|
|
|
5910
5929
|
subscriptions.map((subscription) => {
|
|
5911
5930
|
const retVal = this.subscriptions.find((v) => v.subscriptionKey.id.localeCompare(subscription.subscriptionKey.id) === 0);
|
|
5912
5931
|
if (retVal) {
|
|
5913
|
-
__privateMethod(this, _LogDebugMessage4, LogDebugMessage_fn4).call(this, chalk$
|
|
5932
|
+
__privateMethod(this, _LogDebugMessage4, LogDebugMessage_fn4).call(this, chalk$3.magenta(`AddSubscription(): Subscription: [${retVal.subscriptionKey.id}] already exists - ignoring.`));
|
|
5914
5933
|
} else {
|
|
5915
5934
|
subscriptionsToAdd.push(subscription);
|
|
5916
5935
|
}
|
|
@@ -5919,7 +5938,7 @@ class ObservabilitySubscriptionManager {
|
|
|
5919
5938
|
subscriptionsToAdd.map((s) => this.subscriptions.push(s));
|
|
5920
5939
|
(_a2 = __privateGet(this, _observabilitySocketIOSubscriber)) == null ? void 0 : _a2.Subscribe(subscriptionsToAdd);
|
|
5921
5940
|
} else {
|
|
5922
|
-
__privateMethod(this, _LogDebugMessage4, LogDebugMessage_fn4).call(this, chalk$
|
|
5941
|
+
__privateMethod(this, _LogDebugMessage4, LogDebugMessage_fn4).call(this, chalk$3.magenta(`AddSubscription(): No valid subscriptions to subscribe.`));
|
|
5923
5942
|
}
|
|
5924
5943
|
}
|
|
5925
5944
|
RemoveSubscriptionsByKey(keyToFind) {
|
|
@@ -6014,7 +6033,7 @@ class ObservabilitySubscriptionManager {
|
|
|
6014
6033
|
if (subscriptionPayload.subscriptionKey.topic.localeCompare(SubscriptionTopic.AllServicesCombined.toString()) === 0) {
|
|
6015
6034
|
__privateGet(this, _serviceModel)["STS-Service"] = ObservabilityModelUtils.GetModelForService("STS-Service", subscriptionPayload.data, subscribeToKafka, __privateGet(this, _options5).logger);
|
|
6016
6035
|
if (__privateGet(this, _serviceModel)["STS-Service"] === null) {
|
|
6017
|
-
__privateMethod(this, _LogDebugMessage4, LogDebugMessage_fn4).call(this, chalk$
|
|
6036
|
+
__privateMethod(this, _LogDebugMessage4, LogDebugMessage_fn4).call(this, chalk$3.red(`CreateModelAllServicesCombined():Error: GetModelForService() returned null`));
|
|
6018
6037
|
}
|
|
6019
6038
|
}
|
|
6020
6039
|
} catch (error) {
|
|
@@ -6029,7 +6048,7 @@ class ObservabilitySubscriptionManager {
|
|
|
6029
6048
|
for (const [serviceId, serviceTelemetry] of Object.entries(subscriptionPayload.data)) {
|
|
6030
6049
|
__privateGet(this, _serviceModel)[serviceId] = ObservabilityModelUtils.GetModelForService(serviceId, serviceTelemetry, subscribeToKafka, __privateGet(this, _options5).logger);
|
|
6031
6050
|
if (__privateGet(this, _serviceModel)[serviceId] === null) {
|
|
6032
|
-
__privateMethod(this, _LogDebugMessage4, LogDebugMessage_fn4).call(this, chalk$
|
|
6051
|
+
__privateMethod(this, _LogDebugMessage4, LogDebugMessage_fn4).call(this, chalk$3.red(`CreateModelServices():Error: GetModelForService() returned null`));
|
|
6033
6052
|
}
|
|
6034
6053
|
}
|
|
6035
6054
|
} catch (error) {
|
|
@@ -6063,7 +6082,7 @@ class ObservabilitySubscriptionManager {
|
|
|
6063
6082
|
}
|
|
6064
6083
|
}
|
|
6065
6084
|
} else {
|
|
6066
|
-
__privateMethod(this, _LogDebugMessage4, LogDebugMessage_fn4).call(this, chalk$
|
|
6085
|
+
__privateMethod(this, _LogDebugMessage4, LogDebugMessage_fn4).call(this, chalk$3.red(`CreateModelServiceInstances():Error: GetModelForService() returned null`));
|
|
6067
6086
|
}
|
|
6068
6087
|
} else {
|
|
6069
6088
|
if (subscribeToKafka) {
|
|
@@ -6106,7 +6125,7 @@ class ObservabilitySubscriptionManager {
|
|
|
6106
6125
|
}
|
|
6107
6126
|
}
|
|
6108
6127
|
} else {
|
|
6109
|
-
__privateMethod(this, _LogDebugMessage4, LogDebugMessage_fn4).call(this, chalk$
|
|
6128
|
+
__privateMethod(this, _LogDebugMessage4, LogDebugMessage_fn4).call(this, chalk$3.red(`CreateModelServiceInstance():Error: GetModelForService() returned null`));
|
|
6110
6129
|
}
|
|
6111
6130
|
} else {
|
|
6112
6131
|
if (subscribeToKafka) {
|
|
@@ -6131,7 +6150,7 @@ class ObservabilitySubscriptionManager {
|
|
|
6131
6150
|
if (Object.keys(subscriptionPayload.data).length !== 0) {
|
|
6132
6151
|
__privateGet(this, _agentModel)["STS-Agent"] = ObservabilityModelUtils.GetModelForAgent("STS-Agent", subscriptionPayload.data, subscribeToKafka, __privateGet(this, _options5).logger);
|
|
6133
6152
|
if (__privateGet(this, _agentModel)["STS-Agent"] === null) {
|
|
6134
|
-
__privateMethod(this, _LogDebugMessage4, LogDebugMessage_fn4).call(this, chalk$
|
|
6153
|
+
__privateMethod(this, _LogDebugMessage4, LogDebugMessage_fn4).call(this, chalk$3.red(`CreateModelAllAgentsCombined():Error: GetModelForAgent() returned null`));
|
|
6135
6154
|
}
|
|
6136
6155
|
}
|
|
6137
6156
|
}
|
|
@@ -6165,7 +6184,7 @@ class ObservabilitySubscriptionManager {
|
|
|
6165
6184
|
}
|
|
6166
6185
|
}
|
|
6167
6186
|
} else {
|
|
6168
|
-
__privateMethod(this, _LogDebugMessage4, LogDebugMessage_fn4).call(this, chalk$
|
|
6187
|
+
__privateMethod(this, _LogDebugMessage4, LogDebugMessage_fn4).call(this, chalk$3.red(`CreateModelAgents():Error: GetModelForAgent() returned null`));
|
|
6169
6188
|
}
|
|
6170
6189
|
} else {
|
|
6171
6190
|
if (subscribeToKafka) {
|
|
@@ -6176,7 +6195,7 @@ class ObservabilitySubscriptionManager {
|
|
|
6176
6195
|
}
|
|
6177
6196
|
}
|
|
6178
6197
|
} catch (error) {
|
|
6179
|
-
__privateMethod(this, _LogErrorMessage3, LogErrorMessage_fn3).call(this, chalk$
|
|
6198
|
+
__privateMethod(this, _LogErrorMessage3, LogErrorMessage_fn3).call(this, chalk$3.red(`UIControllerAgent:CreateModel(): Error: [${error}]`));
|
|
6180
6199
|
}
|
|
6181
6200
|
}
|
|
6182
6201
|
// /agentId/agentWorkerId
|
|
@@ -6209,7 +6228,7 @@ class ObservabilitySubscriptionManager {
|
|
|
6209
6228
|
}
|
|
6210
6229
|
}
|
|
6211
6230
|
} else {
|
|
6212
|
-
__privateMethod(this, _LogDebugMessage4, LogDebugMessage_fn4).call(this, chalk$
|
|
6231
|
+
__privateMethod(this, _LogDebugMessage4, LogDebugMessage_fn4).call(this, chalk$3.red(`CreateModelAgentWorkers():Error: GetModelForAgent() returned null`));
|
|
6213
6232
|
}
|
|
6214
6233
|
} else {
|
|
6215
6234
|
if (subscribeToKafka) {
|
|
@@ -6221,7 +6240,7 @@ class ObservabilitySubscriptionManager {
|
|
|
6221
6240
|
}
|
|
6222
6241
|
}
|
|
6223
6242
|
} catch (error) {
|
|
6224
|
-
__privateMethod(this, _LogErrorMessage3, LogErrorMessage_fn3).call(this, chalk$
|
|
6243
|
+
__privateMethod(this, _LogErrorMessage3, LogErrorMessage_fn3).call(this, chalk$3.red(`UIControllerAgentThreads:CreateModel(): Error: [${error}]`));
|
|
6225
6244
|
}
|
|
6226
6245
|
}
|
|
6227
6246
|
// /agentId/agentWorkerId/asyncRunnerId
|
|
@@ -6251,7 +6270,7 @@ class ObservabilitySubscriptionManager {
|
|
|
6251
6270
|
}
|
|
6252
6271
|
}
|
|
6253
6272
|
} else {
|
|
6254
|
-
__privateMethod(this, _LogDebugMessage4, LogDebugMessage_fn4).call(this, chalk$
|
|
6273
|
+
__privateMethod(this, _LogDebugMessage4, LogDebugMessage_fn4).call(this, chalk$3.red(`CreateModelAgentWorker():Error: GetModelForAgent() returned null`));
|
|
6255
6274
|
}
|
|
6256
6275
|
} else {
|
|
6257
6276
|
if (subscribeToKafka) {
|
|
@@ -6264,7 +6283,7 @@ class ObservabilitySubscriptionManager {
|
|
|
6264
6283
|
}
|
|
6265
6284
|
}
|
|
6266
6285
|
} catch (error) {
|
|
6267
|
-
__privateMethod(this, _LogErrorMessage3, LogErrorMessage_fn3).call(this, chalk$
|
|
6286
|
+
__privateMethod(this, _LogErrorMessage3, LogErrorMessage_fn3).call(this, chalk$3.red(`UIControllerAgentThread:CreateModel(): Error: [${error}]`));
|
|
6268
6287
|
}
|
|
6269
6288
|
}
|
|
6270
6289
|
// --- [ Lambdas ] ------------------------------------------------------------------------------------------------------------------------------------------------
|
|
@@ -6275,7 +6294,7 @@ class ObservabilitySubscriptionManager {
|
|
|
6275
6294
|
if (subscriptionPayload.subscriptionKey.topic.localeCompare(SubscriptionTopic.AllLambdasCombined.toString()) === 0) {
|
|
6276
6295
|
__privateGet(this, _lambdaModel)["STS-Lambda"] = ObservabilityModelUtils.GetModelForLambda("STS-Lambda", subscriptionPayload.data, subscribeToKafka, __privateGet(this, _options5).logger);
|
|
6277
6296
|
if (__privateGet(this, _lambdaModel)["STS-Lambda"] === null) {
|
|
6278
|
-
__privateMethod(this, _LogDebugMessage4, LogDebugMessage_fn4).call(this, chalk$
|
|
6297
|
+
__privateMethod(this, _LogDebugMessage4, LogDebugMessage_fn4).call(this, chalk$3.red(`CreateModelAllLambdasCombined():Error: GetModelForLambda() returned null`));
|
|
6279
6298
|
}
|
|
6280
6299
|
}
|
|
6281
6300
|
} catch (error) {
|
|
@@ -6290,7 +6309,7 @@ class ObservabilitySubscriptionManager {
|
|
|
6290
6309
|
for (const [technologyId, technologyTelemetry] of Object.entries(subscriptionPayload.data)) {
|
|
6291
6310
|
__privateGet(this, _lambdaModel)[technologyId] = ObservabilityModelUtils.GetModelForLambda(technologyId, technologyTelemetry, subscribeToKafka, __privateGet(this, _options5).logger);
|
|
6292
6311
|
if (__privateGet(this, _lambdaModel)[technologyId] === null) {
|
|
6293
|
-
__privateMethod(this, _LogDebugMessage4, LogDebugMessage_fn4).call(this, chalk$
|
|
6312
|
+
__privateMethod(this, _LogDebugMessage4, LogDebugMessage_fn4).call(this, chalk$3.red(`CreateModelLambdaTechnologies():Error: GetModelForLambda() returned null`));
|
|
6294
6313
|
}
|
|
6295
6314
|
}
|
|
6296
6315
|
} catch (error) {
|
|
@@ -6324,7 +6343,7 @@ class ObservabilitySubscriptionManager {
|
|
|
6324
6343
|
}
|
|
6325
6344
|
}
|
|
6326
6345
|
} else {
|
|
6327
|
-
__privateMethod(this, _LogDebugMessage4, LogDebugMessage_fn4).call(this, chalk$
|
|
6346
|
+
__privateMethod(this, _LogDebugMessage4, LogDebugMessage_fn4).call(this, chalk$3.red(`CreateModelLambdaSubTechnologies():Error: GetModelForLambda() returned null`));
|
|
6328
6347
|
}
|
|
6329
6348
|
} else {
|
|
6330
6349
|
if (subscribeToKafka) {
|
|
@@ -6367,7 +6386,7 @@ class ObservabilitySubscriptionManager {
|
|
|
6367
6386
|
}
|
|
6368
6387
|
}
|
|
6369
6388
|
} else {
|
|
6370
|
-
__privateMethod(this, _LogDebugMessage4, LogDebugMessage_fn4).call(this, chalk$
|
|
6389
|
+
__privateMethod(this, _LogDebugMessage4, LogDebugMessage_fn4).call(this, chalk$3.red(`CreateModelLambdaSubTechnologiesInstance():Error: GetModelForLambda() returned null`));
|
|
6371
6390
|
}
|
|
6372
6391
|
} else {
|
|
6373
6392
|
if (subscribeToKafka) {
|
|
@@ -6426,21 +6445,21 @@ class SocketIoClientHelper {
|
|
|
6426
6445
|
get sockets() {
|
|
6427
6446
|
return __privateGet(this, _sockets);
|
|
6428
6447
|
}
|
|
6429
|
-
SetupClientSideSocket(
|
|
6430
|
-
this.sockets[
|
|
6431
|
-
name,
|
|
6448
|
+
SetupClientSideSocket(name2, address, onConnectCallBack, socketEventsCallBack, errorCallBack) {
|
|
6449
|
+
this.sockets[name2] = {
|
|
6450
|
+
name: name2,
|
|
6432
6451
|
address,
|
|
6433
6452
|
socket: null,
|
|
6434
6453
|
errorCallBack
|
|
6435
6454
|
};
|
|
6436
|
-
__privateMethod(this, _EstablishSocketConnect, EstablishSocketConnect_fn).call(this,
|
|
6437
|
-
return this.sockets[
|
|
6455
|
+
__privateMethod(this, _EstablishSocketConnect, EstablishSocketConnect_fn).call(this, name2, onConnectCallBack, socketEventsCallBack);
|
|
6456
|
+
return this.sockets[name2].socket;
|
|
6438
6457
|
}
|
|
6439
|
-
GetSocket(
|
|
6440
|
-
return this.sockets[
|
|
6458
|
+
GetSocket(name2) {
|
|
6459
|
+
return this.sockets[name2].socket;
|
|
6441
6460
|
}
|
|
6442
|
-
GetSocketDetail(
|
|
6443
|
-
return this.sockets[
|
|
6461
|
+
GetSocketDetail(name2) {
|
|
6462
|
+
return this.sockets[name2];
|
|
6444
6463
|
}
|
|
6445
6464
|
}
|
|
6446
6465
|
_options6 = new WeakMap();
|
|
@@ -6457,17 +6476,17 @@ LogErrorMessage_fn4 = function(message) {
|
|
|
6457
6476
|
__privateGet(this, _options6).logger.error(message);
|
|
6458
6477
|
};
|
|
6459
6478
|
_EstablishSocketConnect = new WeakSet();
|
|
6460
|
-
EstablishSocketConnect_fn = function(
|
|
6461
|
-
const socketDetail = this.sockets[
|
|
6479
|
+
EstablishSocketConnect_fn = function(name2, onConnectCallBack, socketEventsCallBack) {
|
|
6480
|
+
const socketDetail = this.sockets[name2];
|
|
6462
6481
|
if (socketDetail.socket !== null) {
|
|
6463
6482
|
if (socketDetail.socket.connected === true) {
|
|
6464
6483
|
socketDetail.socket.disconnect();
|
|
6465
6484
|
}
|
|
6466
6485
|
socketDetail.socket = null;
|
|
6467
6486
|
if (isNode) {
|
|
6468
|
-
setTimeout(() => __privateMethod(this, _EstablishSocketConnect, EstablishSocketConnect_fn).call(this,
|
|
6487
|
+
setTimeout(() => __privateMethod(this, _EstablishSocketConnect, EstablishSocketConnect_fn).call(this, name2, onConnectCallBack, socketEventsCallBack), 100).unref();
|
|
6469
6488
|
} else {
|
|
6470
|
-
setTimeout(() => __privateMethod(this, _EstablishSocketConnect, EstablishSocketConnect_fn).call(this,
|
|
6489
|
+
setTimeout(() => __privateMethod(this, _EstablishSocketConnect, EstablishSocketConnect_fn).call(this, name2, onConnectCallBack, socketEventsCallBack), 100);
|
|
6471
6490
|
}
|
|
6472
6491
|
return;
|
|
6473
6492
|
}
|
|
@@ -6509,12 +6528,12 @@ EstablishSocketConnect_fn = function(name, onConnectCallBack, socketEventsCallBa
|
|
|
6509
6528
|
{
|
|
6510
6529
|
__privateMethod(this, _LogDebugMessage5, LogDebugMessage_fn5).call(this, "The server disconnected using disconnectSockets, i.e. normal safe shutdown from explicit disconnection by the server.");
|
|
6511
6530
|
__privateMethod(this, _LogDebugMessage5, LogDebugMessage_fn5).call(this, "The connection will be re-established when the server becomes available.");
|
|
6512
|
-
const socketDetail2 = this.sockets[
|
|
6531
|
+
const socketDetail2 = this.sockets[name2];
|
|
6513
6532
|
socketDetail2.socket = null;
|
|
6514
6533
|
if (isNode) {
|
|
6515
|
-
setTimeout(() => __privateMethod(this, _EstablishSocketConnect, EstablishSocketConnect_fn).call(this,
|
|
6534
|
+
setTimeout(() => __privateMethod(this, _EstablishSocketConnect, EstablishSocketConnect_fn).call(this, name2, onConnectCallBack, socketEventsCallBack), 100).unref();
|
|
6516
6535
|
} else {
|
|
6517
|
-
setTimeout(() => __privateMethod(this, _EstablishSocketConnect, EstablishSocketConnect_fn).call(this,
|
|
6536
|
+
setTimeout(() => __privateMethod(this, _EstablishSocketConnect, EstablishSocketConnect_fn).call(this, name2, onConnectCallBack, socketEventsCallBack), 100);
|
|
6518
6537
|
}
|
|
6519
6538
|
}
|
|
6520
6539
|
break;
|
|
@@ -6528,244 +6547,2261 @@ EstablishSocketConnect_fn = function(name, onConnectCallBack, socketEventsCallBa
|
|
|
6528
6547
|
{
|
|
6529
6548
|
__privateMethod(this, _LogDebugMessage5, LogDebugMessage_fn5).call(this, `Server unexpectedly disconnected. Reason: [${reason}]`);
|
|
6530
6549
|
__privateMethod(this, _LogDebugMessage5, LogDebugMessage_fn5).call(this, "The connection will be re-established when the server becomes available.");
|
|
6531
|
-
const socketDetail2 = this.sockets[
|
|
6550
|
+
const socketDetail2 = this.sockets[name2];
|
|
6532
6551
|
if (socketDetail2.socket) {
|
|
6533
6552
|
socketDetail2.socket.disconnect();
|
|
6534
6553
|
}
|
|
6535
6554
|
socketDetail2.socket = null;
|
|
6536
6555
|
if (isNode) {
|
|
6537
|
-
setTimeout(() => __privateMethod(this, _EstablishSocketConnect, EstablishSocketConnect_fn).call(this,
|
|
6556
|
+
setTimeout(() => __privateMethod(this, _EstablishSocketConnect, EstablishSocketConnect_fn).call(this, name2, onConnectCallBack, socketEventsCallBack), 100).unref();
|
|
6538
6557
|
} else {
|
|
6539
|
-
setTimeout(() => __privateMethod(this, _EstablishSocketConnect, EstablishSocketConnect_fn).call(this,
|
|
6558
|
+
setTimeout(() => __privateMethod(this, _EstablishSocketConnect, EstablishSocketConnect_fn).call(this, name2, onConnectCallBack, socketEventsCallBack), 100);
|
|
6540
6559
|
}
|
|
6541
6560
|
}
|
|
6542
6561
|
break;
|
|
6543
6562
|
}
|
|
6544
6563
|
});
|
|
6545
6564
|
};
|
|
6546
|
-
var
|
|
6547
|
-
|
|
6548
|
-
|
|
6549
|
-
|
|
6550
|
-
|
|
6551
|
-
}
|
|
6552
|
-
const
|
|
6553
|
-
|
|
6554
|
-
|
|
6555
|
-
|
|
6556
|
-
|
|
6557
|
-
|
|
6558
|
-
|
|
6559
|
-
|
|
6560
|
-
|
|
6561
|
-
|
|
6562
|
-
|
|
6563
|
-
|
|
6564
|
-
|
|
6565
|
-
|
|
6566
|
-
|
|
6567
|
-
|
|
6568
|
-
|
|
6569
|
-
|
|
6570
|
-
|
|
6571
|
-
|
|
6572
|
-
|
|
6573
|
-
|
|
6574
|
-
|
|
6575
|
-
|
|
6576
|
-
|
|
6577
|
-
|
|
6578
|
-
|
|
6579
|
-
|
|
6580
|
-
|
|
6581
|
-
|
|
6582
|
-
|
|
6583
|
-
|
|
6584
|
-
|
|
6585
|
-
|
|
6586
|
-
|
|
6587
|
-
|
|
6588
|
-
|
|
6589
|
-
|
|
6590
|
-
|
|
6591
|
-
|
|
6592
|
-
|
|
6593
|
-
|
|
6594
|
-
|
|
6595
|
-
|
|
6596
|
-
|
|
6597
|
-
|
|
6598
|
-
|
|
6599
|
-
|
|
6600
|
-
|
|
6601
|
-
|
|
6602
|
-
|
|
6603
|
-
|
|
6604
|
-
|
|
6605
|
-
|
|
6606
|
-
|
|
6607
|
-
|
|
6608
|
-
|
|
6609
|
-
|
|
6610
|
-
|
|
6611
|
-
|
|
6612
|
-
|
|
6613
|
-
|
|
6614
|
-
|
|
6615
|
-
|
|
6616
|
-
|
|
6617
|
-
|
|
6618
|
-
|
|
6619
|
-
|
|
6620
|
-
|
|
6621
|
-
|
|
6622
|
-
|
|
6623
|
-
|
|
6624
|
-
|
|
6625
|
-
|
|
6626
|
-
|
|
6627
|
-
|
|
6628
|
-
|
|
6629
|
-
|
|
6630
|
-
|
|
6631
|
-
|
|
6632
|
-
|
|
6633
|
-
|
|
6634
|
-
|
|
6635
|
-
|
|
6636
|
-
|
|
6637
|
-
|
|
6638
|
-
|
|
6639
|
-
|
|
6640
|
-
|
|
6641
|
-
|
|
6642
|
-
|
|
6643
|
-
|
|
6644
|
-
|
|
6645
|
-
|
|
6646
|
-
|
|
6647
|
-
|
|
6648
|
-
|
|
6649
|
-
|
|
6650
|
-
|
|
6651
|
-
|
|
6652
|
-
|
|
6653
|
-
|
|
6654
|
-
|
|
6655
|
-
|
|
6656
|
-
|
|
6657
|
-
|
|
6658
|
-
|
|
6659
|
-
|
|
6660
|
-
|
|
6661
|
-
|
|
6662
|
-
|
|
6663
|
-
|
|
6664
|
-
|
|
6665
|
-
|
|
6666
|
-
|
|
6667
|
-
|
|
6668
|
-
|
|
6669
|
-
|
|
6670
|
-
|
|
6671
|
-
|
|
6672
|
-
|
|
6673
|
-
|
|
6674
|
-
|
|
6675
|
-
|
|
6676
|
-
|
|
6677
|
-
|
|
6678
|
-
|
|
6679
|
-
|
|
6680
|
-
{ label: "B20", bucketLimit: 20 },
|
|
6681
|
-
{ label: "B50", bucketLimit: 50 },
|
|
6682
|
-
{ label: "B100", bucketLimit: 100 },
|
|
6683
|
-
{ label: "B1000", bucketLimit: 1e3 },
|
|
6684
|
-
{ label: "B50000", bucketLimit: 5e4 },
|
|
6685
|
-
{ label: "BInfinity", bucketLimit: -1 }
|
|
6686
|
-
]
|
|
6565
|
+
var main$1 = { exports: {} };
|
|
6566
|
+
const __viteBrowserExternal$1 = {};
|
|
6567
|
+
const __viteBrowserExternal$2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
6568
|
+
__proto__: null,
|
|
6569
|
+
default: __viteBrowserExternal$1
|
|
6570
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
6571
|
+
const require$$3 = /* @__PURE__ */ getAugmentedNamespace(__viteBrowserExternal$2);
|
|
6572
|
+
const name = "dotenv";
|
|
6573
|
+
const version$1 = "16.4.5";
|
|
6574
|
+
const description = "Loads environment variables from .env file";
|
|
6575
|
+
const main = "lib/main.js";
|
|
6576
|
+
const types = "lib/main.d.ts";
|
|
6577
|
+
const exports = {
|
|
6578
|
+
".": {
|
|
6579
|
+
types: "./lib/main.d.ts",
|
|
6580
|
+
require: "./lib/main.js",
|
|
6581
|
+
"default": "./lib/main.js"
|
|
6582
|
+
},
|
|
6583
|
+
"./config": "./config.js",
|
|
6584
|
+
"./config.js": "./config.js",
|
|
6585
|
+
"./lib/env-options": "./lib/env-options.js",
|
|
6586
|
+
"./lib/env-options.js": "./lib/env-options.js",
|
|
6587
|
+
"./lib/cli-options": "./lib/cli-options.js",
|
|
6588
|
+
"./lib/cli-options.js": "./lib/cli-options.js",
|
|
6589
|
+
"./package.json": "./package.json"
|
|
6590
|
+
};
|
|
6591
|
+
const scripts = {
|
|
6592
|
+
"dts-check": "tsc --project tests/types/tsconfig.json",
|
|
6593
|
+
lint: "standard",
|
|
6594
|
+
"lint-readme": "standard-markdown",
|
|
6595
|
+
pretest: "npm run lint && npm run dts-check",
|
|
6596
|
+
test: "tap tests/*.js --100 -Rspec",
|
|
6597
|
+
"test:coverage": "tap --coverage-report=lcov",
|
|
6598
|
+
prerelease: "npm test",
|
|
6599
|
+
release: "standard-version"
|
|
6600
|
+
};
|
|
6601
|
+
const repository = {
|
|
6602
|
+
type: "git",
|
|
6603
|
+
url: "git://github.com/motdotla/dotenv.git"
|
|
6604
|
+
};
|
|
6605
|
+
const funding = "https://dotenvx.com";
|
|
6606
|
+
const keywords = [
|
|
6607
|
+
"dotenv",
|
|
6608
|
+
"env",
|
|
6609
|
+
".env",
|
|
6610
|
+
"environment",
|
|
6611
|
+
"variables",
|
|
6612
|
+
"config",
|
|
6613
|
+
"settings"
|
|
6614
|
+
];
|
|
6615
|
+
const readmeFilename = "README.md";
|
|
6616
|
+
const license = "BSD-2-Clause";
|
|
6617
|
+
const devDependencies = {
|
|
6618
|
+
"@definitelytyped/dtslint": "^0.0.133",
|
|
6619
|
+
"@types/node": "^18.11.3",
|
|
6620
|
+
decache: "^4.6.1",
|
|
6621
|
+
sinon: "^14.0.1",
|
|
6622
|
+
standard: "^17.0.0",
|
|
6623
|
+
"standard-markdown": "^7.1.0",
|
|
6624
|
+
"standard-version": "^9.5.0",
|
|
6625
|
+
tap: "^16.3.0",
|
|
6626
|
+
tar: "^6.1.11",
|
|
6627
|
+
typescript: "^4.8.4"
|
|
6628
|
+
};
|
|
6629
|
+
const engines = {
|
|
6630
|
+
node: ">=12"
|
|
6631
|
+
};
|
|
6632
|
+
const browser$1 = {
|
|
6633
|
+
fs: false
|
|
6634
|
+
};
|
|
6635
|
+
const require$$4 = {
|
|
6636
|
+
name,
|
|
6637
|
+
version: version$1,
|
|
6638
|
+
description,
|
|
6639
|
+
main,
|
|
6640
|
+
types,
|
|
6641
|
+
exports,
|
|
6642
|
+
scripts,
|
|
6643
|
+
repository,
|
|
6644
|
+
funding,
|
|
6645
|
+
keywords,
|
|
6646
|
+
readmeFilename,
|
|
6647
|
+
license,
|
|
6648
|
+
devDependencies,
|
|
6649
|
+
engines,
|
|
6650
|
+
browser: browser$1
|
|
6651
|
+
};
|
|
6652
|
+
const fs$1 = require$$3;
|
|
6653
|
+
const path = require$$3;
|
|
6654
|
+
const os = require$$3;
|
|
6655
|
+
const crypto$1 = require$$3;
|
|
6656
|
+
const packageJson = require$$4;
|
|
6657
|
+
const version = packageJson.version;
|
|
6658
|
+
const LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;
|
|
6659
|
+
function parse(src) {
|
|
6660
|
+
const obj = {};
|
|
6661
|
+
let lines = src.toString();
|
|
6662
|
+
lines = lines.replace(/\r\n?/mg, "\n");
|
|
6663
|
+
let match;
|
|
6664
|
+
while ((match = LINE.exec(lines)) != null) {
|
|
6665
|
+
const key = match[1];
|
|
6666
|
+
let value = match[2] || "";
|
|
6667
|
+
value = value.trim();
|
|
6668
|
+
const maybeQuote = value[0];
|
|
6669
|
+
value = value.replace(/^(['"`])([\s\S]*)\1$/mg, "$2");
|
|
6670
|
+
if (maybeQuote === '"') {
|
|
6671
|
+
value = value.replace(/\\n/g, "\n");
|
|
6672
|
+
value = value.replace(/\\r/g, "\r");
|
|
6673
|
+
}
|
|
6674
|
+
obj[key] = value;
|
|
6675
|
+
}
|
|
6676
|
+
return obj;
|
|
6677
|
+
}
|
|
6678
|
+
function _parseVault(options) {
|
|
6679
|
+
const vaultPath = _vaultPath(options);
|
|
6680
|
+
const result = DotenvModule.configDotenv({ path: vaultPath });
|
|
6681
|
+
if (!result.parsed) {
|
|
6682
|
+
const err = new Error(`MISSING_DATA: Cannot parse ${vaultPath} for an unknown reason`);
|
|
6683
|
+
err.code = "MISSING_DATA";
|
|
6684
|
+
throw err;
|
|
6685
|
+
}
|
|
6686
|
+
const keys = _dotenvKey(options).split(",");
|
|
6687
|
+
const length = keys.length;
|
|
6688
|
+
let decrypted;
|
|
6689
|
+
for (let i = 0; i < length; i++) {
|
|
6690
|
+
try {
|
|
6691
|
+
const key = keys[i].trim();
|
|
6692
|
+
const attrs = _instructions(result, key);
|
|
6693
|
+
decrypted = DotenvModule.decrypt(attrs.ciphertext, attrs.key);
|
|
6694
|
+
break;
|
|
6695
|
+
} catch (error) {
|
|
6696
|
+
if (i + 1 >= length) {
|
|
6697
|
+
throw error;
|
|
6698
|
+
}
|
|
6687
6699
|
}
|
|
6688
|
-
|
|
6689
|
-
|
|
6690
|
-
|
|
6691
|
-
|
|
6692
|
-
|
|
6693
|
-
|
|
6694
|
-
|
|
6695
|
-
|
|
6696
|
-
|
|
6697
|
-
|
|
6698
|
-
|
|
6699
|
-
|
|
6700
|
-
|
|
6701
|
-
|
|
6702
|
-
|
|
6703
|
-
|
|
6704
|
-
|
|
6705
|
-
|
|
6706
|
-
|
|
6707
|
-
|
|
6708
|
-
|
|
6709
|
-
|
|
6710
|
-
|
|
6711
|
-
|
|
6712
|
-
|
|
6713
|
-
|
|
6714
|
-
|
|
6715
|
-
|
|
6716
|
-
|
|
6717
|
-
|
|
6718
|
-
|
|
6719
|
-
|
|
6720
|
-
|
|
6700
|
+
}
|
|
6701
|
+
return DotenvModule.parse(decrypted);
|
|
6702
|
+
}
|
|
6703
|
+
function _log(message) {
|
|
6704
|
+
console.log(`[dotenv@${version}][INFO] ${message}`);
|
|
6705
|
+
}
|
|
6706
|
+
function _warn(message) {
|
|
6707
|
+
console.log(`[dotenv@${version}][WARN] ${message}`);
|
|
6708
|
+
}
|
|
6709
|
+
function _debug(message) {
|
|
6710
|
+
console.log(`[dotenv@${version}][DEBUG] ${message}`);
|
|
6711
|
+
}
|
|
6712
|
+
function _dotenvKey(options) {
|
|
6713
|
+
if (options && options.DOTENV_KEY && options.DOTENV_KEY.length > 0) {
|
|
6714
|
+
return options.DOTENV_KEY;
|
|
6715
|
+
}
|
|
6716
|
+
if (process.env.DOTENV_KEY && process.env.DOTENV_KEY.length > 0) {
|
|
6717
|
+
return process.env.DOTENV_KEY;
|
|
6718
|
+
}
|
|
6719
|
+
return "";
|
|
6720
|
+
}
|
|
6721
|
+
function _instructions(result, dotenvKey) {
|
|
6722
|
+
let uri;
|
|
6723
|
+
try {
|
|
6724
|
+
uri = new URL(dotenvKey);
|
|
6725
|
+
} catch (error) {
|
|
6726
|
+
if (error.code === "ERR_INVALID_URL") {
|
|
6727
|
+
const err = new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");
|
|
6728
|
+
err.code = "INVALID_DOTENV_KEY";
|
|
6729
|
+
throw err;
|
|
6730
|
+
}
|
|
6731
|
+
throw error;
|
|
6732
|
+
}
|
|
6733
|
+
const key = uri.password;
|
|
6734
|
+
if (!key) {
|
|
6735
|
+
const err = new Error("INVALID_DOTENV_KEY: Missing key part");
|
|
6736
|
+
err.code = "INVALID_DOTENV_KEY";
|
|
6737
|
+
throw err;
|
|
6738
|
+
}
|
|
6739
|
+
const environment = uri.searchParams.get("environment");
|
|
6740
|
+
if (!environment) {
|
|
6741
|
+
const err = new Error("INVALID_DOTENV_KEY: Missing environment part");
|
|
6742
|
+
err.code = "INVALID_DOTENV_KEY";
|
|
6743
|
+
throw err;
|
|
6744
|
+
}
|
|
6745
|
+
const environmentKey = `DOTENV_VAULT_${environment.toUpperCase()}`;
|
|
6746
|
+
const ciphertext = result.parsed[environmentKey];
|
|
6747
|
+
if (!ciphertext) {
|
|
6748
|
+
const err = new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${environmentKey} in your .env.vault file.`);
|
|
6749
|
+
err.code = "NOT_FOUND_DOTENV_ENVIRONMENT";
|
|
6750
|
+
throw err;
|
|
6751
|
+
}
|
|
6752
|
+
return { ciphertext, key };
|
|
6753
|
+
}
|
|
6754
|
+
function _vaultPath(options) {
|
|
6755
|
+
let possibleVaultPath = null;
|
|
6756
|
+
if (options && options.path && options.path.length > 0) {
|
|
6757
|
+
if (Array.isArray(options.path)) {
|
|
6758
|
+
for (const filepath of options.path) {
|
|
6759
|
+
if (fs$1.existsSync(filepath)) {
|
|
6760
|
+
possibleVaultPath = filepath.endsWith(".vault") ? filepath : `${filepath}.vault`;
|
|
6761
|
+
}
|
|
6762
|
+
}
|
|
6763
|
+
} else {
|
|
6764
|
+
possibleVaultPath = options.path.endsWith(".vault") ? options.path : `${options.path}.vault`;
|
|
6765
|
+
}
|
|
6766
|
+
} else {
|
|
6767
|
+
possibleVaultPath = path.resolve(process.cwd(), ".env.vault");
|
|
6768
|
+
}
|
|
6769
|
+
if (fs$1.existsSync(possibleVaultPath)) {
|
|
6770
|
+
return possibleVaultPath;
|
|
6771
|
+
}
|
|
6772
|
+
return null;
|
|
6773
|
+
}
|
|
6774
|
+
function _resolveHome(envPath) {
|
|
6775
|
+
return envPath[0] === "~" ? path.join(os.homedir(), envPath.slice(1)) : envPath;
|
|
6776
|
+
}
|
|
6777
|
+
function _configVault(options) {
|
|
6778
|
+
_log("Loading env from encrypted .env.vault");
|
|
6779
|
+
const parsed = DotenvModule._parseVault(options);
|
|
6780
|
+
let processEnv = process.env;
|
|
6781
|
+
if (options && options.processEnv != null) {
|
|
6782
|
+
processEnv = options.processEnv;
|
|
6783
|
+
}
|
|
6784
|
+
DotenvModule.populate(processEnv, parsed, options);
|
|
6785
|
+
return { parsed };
|
|
6786
|
+
}
|
|
6787
|
+
function configDotenv(options) {
|
|
6788
|
+
const dotenvPath = path.resolve(process.cwd(), ".env");
|
|
6789
|
+
let encoding = "utf8";
|
|
6790
|
+
const debug = Boolean(options && options.debug);
|
|
6791
|
+
if (options && options.encoding) {
|
|
6792
|
+
encoding = options.encoding;
|
|
6793
|
+
} else {
|
|
6794
|
+
if (debug) {
|
|
6795
|
+
_debug("No encoding is specified. UTF-8 is used by default");
|
|
6796
|
+
}
|
|
6797
|
+
}
|
|
6798
|
+
let optionPaths = [dotenvPath];
|
|
6799
|
+
if (options && options.path) {
|
|
6800
|
+
if (!Array.isArray(options.path)) {
|
|
6801
|
+
optionPaths = [_resolveHome(options.path)];
|
|
6802
|
+
} else {
|
|
6803
|
+
optionPaths = [];
|
|
6804
|
+
for (const filepath of options.path) {
|
|
6805
|
+
optionPaths.push(_resolveHome(filepath));
|
|
6806
|
+
}
|
|
6807
|
+
}
|
|
6808
|
+
}
|
|
6809
|
+
let lastError;
|
|
6810
|
+
const parsedAll = {};
|
|
6811
|
+
for (const path2 of optionPaths) {
|
|
6812
|
+
try {
|
|
6813
|
+
const parsed = DotenvModule.parse(fs$1.readFileSync(path2, { encoding }));
|
|
6814
|
+
DotenvModule.populate(parsedAll, parsed, options);
|
|
6815
|
+
} catch (e) {
|
|
6816
|
+
if (debug) {
|
|
6817
|
+
_debug(`Failed to load ${path2} ${e.message}`);
|
|
6818
|
+
}
|
|
6819
|
+
lastError = e;
|
|
6820
|
+
}
|
|
6821
|
+
}
|
|
6822
|
+
let processEnv = process.env;
|
|
6823
|
+
if (options && options.processEnv != null) {
|
|
6824
|
+
processEnv = options.processEnv;
|
|
6825
|
+
}
|
|
6826
|
+
DotenvModule.populate(processEnv, parsedAll, options);
|
|
6827
|
+
if (lastError) {
|
|
6828
|
+
return { parsed: parsedAll, error: lastError };
|
|
6829
|
+
} else {
|
|
6830
|
+
return { parsed: parsedAll };
|
|
6831
|
+
}
|
|
6832
|
+
}
|
|
6833
|
+
function config(options) {
|
|
6834
|
+
if (_dotenvKey(options).length === 0) {
|
|
6835
|
+
return DotenvModule.configDotenv(options);
|
|
6836
|
+
}
|
|
6837
|
+
const vaultPath = _vaultPath(options);
|
|
6838
|
+
if (!vaultPath) {
|
|
6839
|
+
_warn(`You set DOTENV_KEY but you are missing a .env.vault file at ${vaultPath}. Did you forget to build it?`);
|
|
6840
|
+
return DotenvModule.configDotenv(options);
|
|
6841
|
+
}
|
|
6842
|
+
return DotenvModule._configVault(options);
|
|
6843
|
+
}
|
|
6844
|
+
function decrypt(encrypted, keyStr) {
|
|
6845
|
+
const key = Buffer.from(keyStr.slice(-64), "hex");
|
|
6846
|
+
let ciphertext = Buffer.from(encrypted, "base64");
|
|
6847
|
+
const nonce = ciphertext.subarray(0, 12);
|
|
6848
|
+
const authTag = ciphertext.subarray(-16);
|
|
6849
|
+
ciphertext = ciphertext.subarray(12, -16);
|
|
6850
|
+
try {
|
|
6851
|
+
const aesgcm = crypto$1.createDecipheriv("aes-256-gcm", key, nonce);
|
|
6852
|
+
aesgcm.setAuthTag(authTag);
|
|
6853
|
+
return `${aesgcm.update(ciphertext)}${aesgcm.final()}`;
|
|
6854
|
+
} catch (error) {
|
|
6855
|
+
const isRange = error instanceof RangeError;
|
|
6856
|
+
const invalidKeyLength = error.message === "Invalid key length";
|
|
6857
|
+
const decryptionFailed = error.message === "Unsupported state or unable to authenticate data";
|
|
6858
|
+
if (isRange || invalidKeyLength) {
|
|
6859
|
+
const err = new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");
|
|
6860
|
+
err.code = "INVALID_DOTENV_KEY";
|
|
6861
|
+
throw err;
|
|
6862
|
+
} else if (decryptionFailed) {
|
|
6863
|
+
const err = new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");
|
|
6864
|
+
err.code = "DECRYPTION_FAILED";
|
|
6865
|
+
throw err;
|
|
6866
|
+
} else {
|
|
6867
|
+
throw error;
|
|
6868
|
+
}
|
|
6869
|
+
}
|
|
6870
|
+
}
|
|
6871
|
+
function populate(processEnv, parsed, options = {}) {
|
|
6872
|
+
const debug = Boolean(options && options.debug);
|
|
6873
|
+
const override = Boolean(options && options.override);
|
|
6874
|
+
if (typeof parsed !== "object") {
|
|
6875
|
+
const err = new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");
|
|
6876
|
+
err.code = "OBJECT_REQUIRED";
|
|
6877
|
+
throw err;
|
|
6878
|
+
}
|
|
6879
|
+
for (const key of Object.keys(parsed)) {
|
|
6880
|
+
if (Object.prototype.hasOwnProperty.call(processEnv, key)) {
|
|
6881
|
+
if (override === true) {
|
|
6882
|
+
processEnv[key] = parsed[key];
|
|
6883
|
+
}
|
|
6884
|
+
if (debug) {
|
|
6885
|
+
if (override === true) {
|
|
6886
|
+
_debug(`"${key}" is already defined and WAS overwritten`);
|
|
6887
|
+
} else {
|
|
6888
|
+
_debug(`"${key}" is already defined and was NOT overwritten`);
|
|
6889
|
+
}
|
|
6890
|
+
}
|
|
6891
|
+
} else {
|
|
6892
|
+
processEnv[key] = parsed[key];
|
|
6893
|
+
}
|
|
6894
|
+
}
|
|
6895
|
+
}
|
|
6896
|
+
const DotenvModule = {
|
|
6897
|
+
configDotenv,
|
|
6898
|
+
_configVault,
|
|
6899
|
+
_parseVault,
|
|
6900
|
+
config,
|
|
6901
|
+
decrypt,
|
|
6902
|
+
parse,
|
|
6903
|
+
populate
|
|
6904
|
+
};
|
|
6905
|
+
main$1.exports.configDotenv = DotenvModule.configDotenv;
|
|
6906
|
+
main$1.exports._configVault = DotenvModule._configVault;
|
|
6907
|
+
main$1.exports._parseVault = DotenvModule._parseVault;
|
|
6908
|
+
var config_1 = main$1.exports.config = DotenvModule.config;
|
|
6909
|
+
main$1.exports.decrypt = DotenvModule.decrypt;
|
|
6910
|
+
main$1.exports.parse = DotenvModule.parse;
|
|
6911
|
+
main$1.exports.populate = DotenvModule.populate;
|
|
6912
|
+
main$1.exports = DotenvModule;
|
|
6913
|
+
const __viteBrowserExternal = {};
|
|
6914
|
+
const fs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
6915
|
+
__proto__: null,
|
|
6916
|
+
default: __viteBrowserExternal
|
|
6917
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
6918
|
+
function getDefaultExportFromCjs(x) {
|
|
6919
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
6920
|
+
}
|
|
6921
|
+
var ansiStyles$1 = { exports: {} };
|
|
6922
|
+
var colorName;
|
|
6923
|
+
var hasRequiredColorName;
|
|
6924
|
+
function requireColorName() {
|
|
6925
|
+
if (hasRequiredColorName)
|
|
6926
|
+
return colorName;
|
|
6927
|
+
hasRequiredColorName = 1;
|
|
6928
|
+
colorName = {
|
|
6929
|
+
"aliceblue": [240, 248, 255],
|
|
6930
|
+
"antiquewhite": [250, 235, 215],
|
|
6931
|
+
"aqua": [0, 255, 255],
|
|
6932
|
+
"aquamarine": [127, 255, 212],
|
|
6933
|
+
"azure": [240, 255, 255],
|
|
6934
|
+
"beige": [245, 245, 220],
|
|
6935
|
+
"bisque": [255, 228, 196],
|
|
6936
|
+
"black": [0, 0, 0],
|
|
6937
|
+
"blanchedalmond": [255, 235, 205],
|
|
6938
|
+
"blue": [0, 0, 255],
|
|
6939
|
+
"blueviolet": [138, 43, 226],
|
|
6940
|
+
"brown": [165, 42, 42],
|
|
6941
|
+
"burlywood": [222, 184, 135],
|
|
6942
|
+
"cadetblue": [95, 158, 160],
|
|
6943
|
+
"chartreuse": [127, 255, 0],
|
|
6944
|
+
"chocolate": [210, 105, 30],
|
|
6945
|
+
"coral": [255, 127, 80],
|
|
6946
|
+
"cornflowerblue": [100, 149, 237],
|
|
6947
|
+
"cornsilk": [255, 248, 220],
|
|
6948
|
+
"crimson": [220, 20, 60],
|
|
6949
|
+
"cyan": [0, 255, 255],
|
|
6950
|
+
"darkblue": [0, 0, 139],
|
|
6951
|
+
"darkcyan": [0, 139, 139],
|
|
6952
|
+
"darkgoldenrod": [184, 134, 11],
|
|
6953
|
+
"darkgray": [169, 169, 169],
|
|
6954
|
+
"darkgreen": [0, 100, 0],
|
|
6955
|
+
"darkgrey": [169, 169, 169],
|
|
6956
|
+
"darkkhaki": [189, 183, 107],
|
|
6957
|
+
"darkmagenta": [139, 0, 139],
|
|
6958
|
+
"darkolivegreen": [85, 107, 47],
|
|
6959
|
+
"darkorange": [255, 140, 0],
|
|
6960
|
+
"darkorchid": [153, 50, 204],
|
|
6961
|
+
"darkred": [139, 0, 0],
|
|
6962
|
+
"darksalmon": [233, 150, 122],
|
|
6963
|
+
"darkseagreen": [143, 188, 143],
|
|
6964
|
+
"darkslateblue": [72, 61, 139],
|
|
6965
|
+
"darkslategray": [47, 79, 79],
|
|
6966
|
+
"darkslategrey": [47, 79, 79],
|
|
6967
|
+
"darkturquoise": [0, 206, 209],
|
|
6968
|
+
"darkviolet": [148, 0, 211],
|
|
6969
|
+
"deeppink": [255, 20, 147],
|
|
6970
|
+
"deepskyblue": [0, 191, 255],
|
|
6971
|
+
"dimgray": [105, 105, 105],
|
|
6972
|
+
"dimgrey": [105, 105, 105],
|
|
6973
|
+
"dodgerblue": [30, 144, 255],
|
|
6974
|
+
"firebrick": [178, 34, 34],
|
|
6975
|
+
"floralwhite": [255, 250, 240],
|
|
6976
|
+
"forestgreen": [34, 139, 34],
|
|
6977
|
+
"fuchsia": [255, 0, 255],
|
|
6978
|
+
"gainsboro": [220, 220, 220],
|
|
6979
|
+
"ghostwhite": [248, 248, 255],
|
|
6980
|
+
"gold": [255, 215, 0],
|
|
6981
|
+
"goldenrod": [218, 165, 32],
|
|
6982
|
+
"gray": [128, 128, 128],
|
|
6983
|
+
"green": [0, 128, 0],
|
|
6984
|
+
"greenyellow": [173, 255, 47],
|
|
6985
|
+
"grey": [128, 128, 128],
|
|
6986
|
+
"honeydew": [240, 255, 240],
|
|
6987
|
+
"hotpink": [255, 105, 180],
|
|
6988
|
+
"indianred": [205, 92, 92],
|
|
6989
|
+
"indigo": [75, 0, 130],
|
|
6990
|
+
"ivory": [255, 255, 240],
|
|
6991
|
+
"khaki": [240, 230, 140],
|
|
6992
|
+
"lavender": [230, 230, 250],
|
|
6993
|
+
"lavenderblush": [255, 240, 245],
|
|
6994
|
+
"lawngreen": [124, 252, 0],
|
|
6995
|
+
"lemonchiffon": [255, 250, 205],
|
|
6996
|
+
"lightblue": [173, 216, 230],
|
|
6997
|
+
"lightcoral": [240, 128, 128],
|
|
6998
|
+
"lightcyan": [224, 255, 255],
|
|
6999
|
+
"lightgoldenrodyellow": [250, 250, 210],
|
|
7000
|
+
"lightgray": [211, 211, 211],
|
|
7001
|
+
"lightgreen": [144, 238, 144],
|
|
7002
|
+
"lightgrey": [211, 211, 211],
|
|
7003
|
+
"lightpink": [255, 182, 193],
|
|
7004
|
+
"lightsalmon": [255, 160, 122],
|
|
7005
|
+
"lightseagreen": [32, 178, 170],
|
|
7006
|
+
"lightskyblue": [135, 206, 250],
|
|
7007
|
+
"lightslategray": [119, 136, 153],
|
|
7008
|
+
"lightslategrey": [119, 136, 153],
|
|
7009
|
+
"lightsteelblue": [176, 196, 222],
|
|
7010
|
+
"lightyellow": [255, 255, 224],
|
|
7011
|
+
"lime": [0, 255, 0],
|
|
7012
|
+
"limegreen": [50, 205, 50],
|
|
7013
|
+
"linen": [250, 240, 230],
|
|
7014
|
+
"magenta": [255, 0, 255],
|
|
7015
|
+
"maroon": [128, 0, 0],
|
|
7016
|
+
"mediumaquamarine": [102, 205, 170],
|
|
7017
|
+
"mediumblue": [0, 0, 205],
|
|
7018
|
+
"mediumorchid": [186, 85, 211],
|
|
7019
|
+
"mediumpurple": [147, 112, 219],
|
|
7020
|
+
"mediumseagreen": [60, 179, 113],
|
|
7021
|
+
"mediumslateblue": [123, 104, 238],
|
|
7022
|
+
"mediumspringgreen": [0, 250, 154],
|
|
7023
|
+
"mediumturquoise": [72, 209, 204],
|
|
7024
|
+
"mediumvioletred": [199, 21, 133],
|
|
7025
|
+
"midnightblue": [25, 25, 112],
|
|
7026
|
+
"mintcream": [245, 255, 250],
|
|
7027
|
+
"mistyrose": [255, 228, 225],
|
|
7028
|
+
"moccasin": [255, 228, 181],
|
|
7029
|
+
"navajowhite": [255, 222, 173],
|
|
7030
|
+
"navy": [0, 0, 128],
|
|
7031
|
+
"oldlace": [253, 245, 230],
|
|
7032
|
+
"olive": [128, 128, 0],
|
|
7033
|
+
"olivedrab": [107, 142, 35],
|
|
7034
|
+
"orange": [255, 165, 0],
|
|
7035
|
+
"orangered": [255, 69, 0],
|
|
7036
|
+
"orchid": [218, 112, 214],
|
|
7037
|
+
"palegoldenrod": [238, 232, 170],
|
|
7038
|
+
"palegreen": [152, 251, 152],
|
|
7039
|
+
"paleturquoise": [175, 238, 238],
|
|
7040
|
+
"palevioletred": [219, 112, 147],
|
|
7041
|
+
"papayawhip": [255, 239, 213],
|
|
7042
|
+
"peachpuff": [255, 218, 185],
|
|
7043
|
+
"peru": [205, 133, 63],
|
|
7044
|
+
"pink": [255, 192, 203],
|
|
7045
|
+
"plum": [221, 160, 221],
|
|
7046
|
+
"powderblue": [176, 224, 230],
|
|
7047
|
+
"purple": [128, 0, 128],
|
|
7048
|
+
"rebeccapurple": [102, 51, 153],
|
|
7049
|
+
"red": [255, 0, 0],
|
|
7050
|
+
"rosybrown": [188, 143, 143],
|
|
7051
|
+
"royalblue": [65, 105, 225],
|
|
7052
|
+
"saddlebrown": [139, 69, 19],
|
|
7053
|
+
"salmon": [250, 128, 114],
|
|
7054
|
+
"sandybrown": [244, 164, 96],
|
|
7055
|
+
"seagreen": [46, 139, 87],
|
|
7056
|
+
"seashell": [255, 245, 238],
|
|
7057
|
+
"sienna": [160, 82, 45],
|
|
7058
|
+
"silver": [192, 192, 192],
|
|
7059
|
+
"skyblue": [135, 206, 235],
|
|
7060
|
+
"slateblue": [106, 90, 205],
|
|
7061
|
+
"slategray": [112, 128, 144],
|
|
7062
|
+
"slategrey": [112, 128, 144],
|
|
7063
|
+
"snow": [255, 250, 250],
|
|
7064
|
+
"springgreen": [0, 255, 127],
|
|
7065
|
+
"steelblue": [70, 130, 180],
|
|
7066
|
+
"tan": [210, 180, 140],
|
|
7067
|
+
"teal": [0, 128, 128],
|
|
7068
|
+
"thistle": [216, 191, 216],
|
|
7069
|
+
"tomato": [255, 99, 71],
|
|
7070
|
+
"turquoise": [64, 224, 208],
|
|
7071
|
+
"violet": [238, 130, 238],
|
|
7072
|
+
"wheat": [245, 222, 179],
|
|
7073
|
+
"white": [255, 255, 255],
|
|
7074
|
+
"whitesmoke": [245, 245, 245],
|
|
7075
|
+
"yellow": [255, 255, 0],
|
|
7076
|
+
"yellowgreen": [154, 205, 50]
|
|
7077
|
+
};
|
|
7078
|
+
return colorName;
|
|
7079
|
+
}
|
|
7080
|
+
var conversions;
|
|
7081
|
+
var hasRequiredConversions;
|
|
7082
|
+
function requireConversions() {
|
|
7083
|
+
if (hasRequiredConversions)
|
|
7084
|
+
return conversions;
|
|
7085
|
+
hasRequiredConversions = 1;
|
|
7086
|
+
const cssKeywords = requireColorName();
|
|
7087
|
+
const reverseKeywords = {};
|
|
7088
|
+
for (const key of Object.keys(cssKeywords)) {
|
|
7089
|
+
reverseKeywords[cssKeywords[key]] = key;
|
|
7090
|
+
}
|
|
7091
|
+
const convert = {
|
|
7092
|
+
rgb: { channels: 3, labels: "rgb" },
|
|
7093
|
+
hsl: { channels: 3, labels: "hsl" },
|
|
7094
|
+
hsv: { channels: 3, labels: "hsv" },
|
|
7095
|
+
hwb: { channels: 3, labels: "hwb" },
|
|
7096
|
+
cmyk: { channels: 4, labels: "cmyk" },
|
|
7097
|
+
xyz: { channels: 3, labels: "xyz" },
|
|
7098
|
+
lab: { channels: 3, labels: "lab" },
|
|
7099
|
+
lch: { channels: 3, labels: "lch" },
|
|
7100
|
+
hex: { channels: 1, labels: ["hex"] },
|
|
7101
|
+
keyword: { channels: 1, labels: ["keyword"] },
|
|
7102
|
+
ansi16: { channels: 1, labels: ["ansi16"] },
|
|
7103
|
+
ansi256: { channels: 1, labels: ["ansi256"] },
|
|
7104
|
+
hcg: { channels: 3, labels: ["h", "c", "g"] },
|
|
7105
|
+
apple: { channels: 3, labels: ["r16", "g16", "b16"] },
|
|
7106
|
+
gray: { channels: 1, labels: ["gray"] }
|
|
7107
|
+
};
|
|
7108
|
+
conversions = convert;
|
|
7109
|
+
for (const model of Object.keys(convert)) {
|
|
7110
|
+
if (!("channels" in convert[model])) {
|
|
7111
|
+
throw new Error("missing channels property: " + model);
|
|
7112
|
+
}
|
|
7113
|
+
if (!("labels" in convert[model])) {
|
|
7114
|
+
throw new Error("missing channel labels property: " + model);
|
|
7115
|
+
}
|
|
7116
|
+
if (convert[model].labels.length !== convert[model].channels) {
|
|
7117
|
+
throw new Error("channel and label counts mismatch: " + model);
|
|
7118
|
+
}
|
|
7119
|
+
const { channels, labels } = convert[model];
|
|
7120
|
+
delete convert[model].channels;
|
|
7121
|
+
delete convert[model].labels;
|
|
7122
|
+
Object.defineProperty(convert[model], "channels", { value: channels });
|
|
7123
|
+
Object.defineProperty(convert[model], "labels", { value: labels });
|
|
7124
|
+
}
|
|
7125
|
+
convert.rgb.hsl = function(rgb) {
|
|
7126
|
+
const r = rgb[0] / 255;
|
|
7127
|
+
const g = rgb[1] / 255;
|
|
7128
|
+
const b = rgb[2] / 255;
|
|
7129
|
+
const min = Math.min(r, g, b);
|
|
7130
|
+
const max = Math.max(r, g, b);
|
|
7131
|
+
const delta = max - min;
|
|
7132
|
+
let h;
|
|
7133
|
+
let s;
|
|
7134
|
+
if (max === min) {
|
|
7135
|
+
h = 0;
|
|
7136
|
+
} else if (r === max) {
|
|
7137
|
+
h = (g - b) / delta;
|
|
7138
|
+
} else if (g === max) {
|
|
7139
|
+
h = 2 + (b - r) / delta;
|
|
7140
|
+
} else if (b === max) {
|
|
7141
|
+
h = 4 + (r - g) / delta;
|
|
7142
|
+
}
|
|
7143
|
+
h = Math.min(h * 60, 360);
|
|
7144
|
+
if (h < 0) {
|
|
7145
|
+
h += 360;
|
|
7146
|
+
}
|
|
7147
|
+
const l = (min + max) / 2;
|
|
7148
|
+
if (max === min) {
|
|
7149
|
+
s = 0;
|
|
7150
|
+
} else if (l <= 0.5) {
|
|
7151
|
+
s = delta / (max + min);
|
|
7152
|
+
} else {
|
|
7153
|
+
s = delta / (2 - max - min);
|
|
7154
|
+
}
|
|
7155
|
+
return [h, s * 100, l * 100];
|
|
7156
|
+
};
|
|
7157
|
+
convert.rgb.hsv = function(rgb) {
|
|
7158
|
+
let rdif;
|
|
7159
|
+
let gdif;
|
|
7160
|
+
let bdif;
|
|
7161
|
+
let h;
|
|
7162
|
+
let s;
|
|
7163
|
+
const r = rgb[0] / 255;
|
|
7164
|
+
const g = rgb[1] / 255;
|
|
7165
|
+
const b = rgb[2] / 255;
|
|
7166
|
+
const v = Math.max(r, g, b);
|
|
7167
|
+
const diff = v - Math.min(r, g, b);
|
|
7168
|
+
const diffc = function(c) {
|
|
7169
|
+
return (v - c) / 6 / diff + 1 / 2;
|
|
7170
|
+
};
|
|
7171
|
+
if (diff === 0) {
|
|
7172
|
+
h = 0;
|
|
7173
|
+
s = 0;
|
|
7174
|
+
} else {
|
|
7175
|
+
s = diff / v;
|
|
7176
|
+
rdif = diffc(r);
|
|
7177
|
+
gdif = diffc(g);
|
|
7178
|
+
bdif = diffc(b);
|
|
7179
|
+
if (r === v) {
|
|
7180
|
+
h = bdif - gdif;
|
|
7181
|
+
} else if (g === v) {
|
|
7182
|
+
h = 1 / 3 + rdif - bdif;
|
|
7183
|
+
} else if (b === v) {
|
|
7184
|
+
h = 2 / 3 + gdif - rdif;
|
|
7185
|
+
}
|
|
7186
|
+
if (h < 0) {
|
|
7187
|
+
h += 1;
|
|
7188
|
+
} else if (h > 1) {
|
|
7189
|
+
h -= 1;
|
|
7190
|
+
}
|
|
7191
|
+
}
|
|
7192
|
+
return [
|
|
7193
|
+
h * 360,
|
|
7194
|
+
s * 100,
|
|
7195
|
+
v * 100
|
|
7196
|
+
];
|
|
7197
|
+
};
|
|
7198
|
+
convert.rgb.hwb = function(rgb) {
|
|
7199
|
+
const r = rgb[0];
|
|
7200
|
+
const g = rgb[1];
|
|
7201
|
+
let b = rgb[2];
|
|
7202
|
+
const h = convert.rgb.hsl(rgb)[0];
|
|
7203
|
+
const w = 1 / 255 * Math.min(r, Math.min(g, b));
|
|
7204
|
+
b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
|
|
7205
|
+
return [h, w * 100, b * 100];
|
|
7206
|
+
};
|
|
7207
|
+
convert.rgb.cmyk = function(rgb) {
|
|
7208
|
+
const r = rgb[0] / 255;
|
|
7209
|
+
const g = rgb[1] / 255;
|
|
7210
|
+
const b = rgb[2] / 255;
|
|
7211
|
+
const k = Math.min(1 - r, 1 - g, 1 - b);
|
|
7212
|
+
const c = (1 - r - k) / (1 - k) || 0;
|
|
7213
|
+
const m = (1 - g - k) / (1 - k) || 0;
|
|
7214
|
+
const y = (1 - b - k) / (1 - k) || 0;
|
|
7215
|
+
return [c * 100, m * 100, y * 100, k * 100];
|
|
7216
|
+
};
|
|
7217
|
+
function comparativeDistance(x, y) {
|
|
7218
|
+
return (x[0] - y[0]) ** 2 + (x[1] - y[1]) ** 2 + (x[2] - y[2]) ** 2;
|
|
7219
|
+
}
|
|
7220
|
+
convert.rgb.keyword = function(rgb) {
|
|
7221
|
+
const reversed = reverseKeywords[rgb];
|
|
7222
|
+
if (reversed) {
|
|
7223
|
+
return reversed;
|
|
7224
|
+
}
|
|
7225
|
+
let currentClosestDistance = Infinity;
|
|
7226
|
+
let currentClosestKeyword;
|
|
7227
|
+
for (const keyword of Object.keys(cssKeywords)) {
|
|
7228
|
+
const value = cssKeywords[keyword];
|
|
7229
|
+
const distance = comparativeDistance(rgb, value);
|
|
7230
|
+
if (distance < currentClosestDistance) {
|
|
7231
|
+
currentClosestDistance = distance;
|
|
7232
|
+
currentClosestKeyword = keyword;
|
|
7233
|
+
}
|
|
7234
|
+
}
|
|
7235
|
+
return currentClosestKeyword;
|
|
7236
|
+
};
|
|
7237
|
+
convert.keyword.rgb = function(keyword) {
|
|
7238
|
+
return cssKeywords[keyword];
|
|
7239
|
+
};
|
|
7240
|
+
convert.rgb.xyz = function(rgb) {
|
|
7241
|
+
let r = rgb[0] / 255;
|
|
7242
|
+
let g = rgb[1] / 255;
|
|
7243
|
+
let b = rgb[2] / 255;
|
|
7244
|
+
r = r > 0.04045 ? ((r + 0.055) / 1.055) ** 2.4 : r / 12.92;
|
|
7245
|
+
g = g > 0.04045 ? ((g + 0.055) / 1.055) ** 2.4 : g / 12.92;
|
|
7246
|
+
b = b > 0.04045 ? ((b + 0.055) / 1.055) ** 2.4 : b / 12.92;
|
|
7247
|
+
const x = r * 0.4124 + g * 0.3576 + b * 0.1805;
|
|
7248
|
+
const y = r * 0.2126 + g * 0.7152 + b * 0.0722;
|
|
7249
|
+
const z = r * 0.0193 + g * 0.1192 + b * 0.9505;
|
|
7250
|
+
return [x * 100, y * 100, z * 100];
|
|
7251
|
+
};
|
|
7252
|
+
convert.rgb.lab = function(rgb) {
|
|
7253
|
+
const xyz = convert.rgb.xyz(rgb);
|
|
7254
|
+
let x = xyz[0];
|
|
7255
|
+
let y = xyz[1];
|
|
7256
|
+
let z = xyz[2];
|
|
7257
|
+
x /= 95.047;
|
|
7258
|
+
y /= 100;
|
|
7259
|
+
z /= 108.883;
|
|
7260
|
+
x = x > 8856e-6 ? x ** (1 / 3) : 7.787 * x + 16 / 116;
|
|
7261
|
+
y = y > 8856e-6 ? y ** (1 / 3) : 7.787 * y + 16 / 116;
|
|
7262
|
+
z = z > 8856e-6 ? z ** (1 / 3) : 7.787 * z + 16 / 116;
|
|
7263
|
+
const l = 116 * y - 16;
|
|
7264
|
+
const a = 500 * (x - y);
|
|
7265
|
+
const b = 200 * (y - z);
|
|
7266
|
+
return [l, a, b];
|
|
7267
|
+
};
|
|
7268
|
+
convert.hsl.rgb = function(hsl) {
|
|
7269
|
+
const h = hsl[0] / 360;
|
|
7270
|
+
const s = hsl[1] / 100;
|
|
7271
|
+
const l = hsl[2] / 100;
|
|
7272
|
+
let t2;
|
|
7273
|
+
let t3;
|
|
7274
|
+
let val;
|
|
7275
|
+
if (s === 0) {
|
|
7276
|
+
val = l * 255;
|
|
7277
|
+
return [val, val, val];
|
|
7278
|
+
}
|
|
7279
|
+
if (l < 0.5) {
|
|
7280
|
+
t2 = l * (1 + s);
|
|
7281
|
+
} else {
|
|
7282
|
+
t2 = l + s - l * s;
|
|
7283
|
+
}
|
|
7284
|
+
const t1 = 2 * l - t2;
|
|
7285
|
+
const rgb = [0, 0, 0];
|
|
7286
|
+
for (let i = 0; i < 3; i++) {
|
|
7287
|
+
t3 = h + 1 / 3 * -(i - 1);
|
|
7288
|
+
if (t3 < 0) {
|
|
7289
|
+
t3++;
|
|
7290
|
+
}
|
|
7291
|
+
if (t3 > 1) {
|
|
7292
|
+
t3--;
|
|
7293
|
+
}
|
|
7294
|
+
if (6 * t3 < 1) {
|
|
7295
|
+
val = t1 + (t2 - t1) * 6 * t3;
|
|
7296
|
+
} else if (2 * t3 < 1) {
|
|
7297
|
+
val = t2;
|
|
7298
|
+
} else if (3 * t3 < 2) {
|
|
7299
|
+
val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
|
|
7300
|
+
} else {
|
|
7301
|
+
val = t1;
|
|
7302
|
+
}
|
|
7303
|
+
rgb[i] = val * 255;
|
|
7304
|
+
}
|
|
7305
|
+
return rgb;
|
|
7306
|
+
};
|
|
7307
|
+
convert.hsl.hsv = function(hsl) {
|
|
7308
|
+
const h = hsl[0];
|
|
7309
|
+
let s = hsl[1] / 100;
|
|
7310
|
+
let l = hsl[2] / 100;
|
|
7311
|
+
let smin = s;
|
|
7312
|
+
const lmin = Math.max(l, 0.01);
|
|
7313
|
+
l *= 2;
|
|
7314
|
+
s *= l <= 1 ? l : 2 - l;
|
|
7315
|
+
smin *= lmin <= 1 ? lmin : 2 - lmin;
|
|
7316
|
+
const v = (l + s) / 2;
|
|
7317
|
+
const sv = l === 0 ? 2 * smin / (lmin + smin) : 2 * s / (l + s);
|
|
7318
|
+
return [h, sv * 100, v * 100];
|
|
7319
|
+
};
|
|
7320
|
+
convert.hsv.rgb = function(hsv) {
|
|
7321
|
+
const h = hsv[0] / 60;
|
|
7322
|
+
const s = hsv[1] / 100;
|
|
7323
|
+
let v = hsv[2] / 100;
|
|
7324
|
+
const hi = Math.floor(h) % 6;
|
|
7325
|
+
const f = h - Math.floor(h);
|
|
7326
|
+
const p = 255 * v * (1 - s);
|
|
7327
|
+
const q = 255 * v * (1 - s * f);
|
|
7328
|
+
const t = 255 * v * (1 - s * (1 - f));
|
|
7329
|
+
v *= 255;
|
|
7330
|
+
switch (hi) {
|
|
7331
|
+
case 0:
|
|
7332
|
+
return [v, t, p];
|
|
7333
|
+
case 1:
|
|
7334
|
+
return [q, v, p];
|
|
7335
|
+
case 2:
|
|
7336
|
+
return [p, v, t];
|
|
7337
|
+
case 3:
|
|
7338
|
+
return [p, q, v];
|
|
7339
|
+
case 4:
|
|
7340
|
+
return [t, p, v];
|
|
7341
|
+
case 5:
|
|
7342
|
+
return [v, p, q];
|
|
7343
|
+
}
|
|
7344
|
+
};
|
|
7345
|
+
convert.hsv.hsl = function(hsv) {
|
|
7346
|
+
const h = hsv[0];
|
|
7347
|
+
const s = hsv[1] / 100;
|
|
7348
|
+
const v = hsv[2] / 100;
|
|
7349
|
+
const vmin = Math.max(v, 0.01);
|
|
7350
|
+
let sl;
|
|
7351
|
+
let l;
|
|
7352
|
+
l = (2 - s) * v;
|
|
7353
|
+
const lmin = (2 - s) * vmin;
|
|
7354
|
+
sl = s * vmin;
|
|
7355
|
+
sl /= lmin <= 1 ? lmin : 2 - lmin;
|
|
7356
|
+
sl = sl || 0;
|
|
7357
|
+
l /= 2;
|
|
7358
|
+
return [h, sl * 100, l * 100];
|
|
7359
|
+
};
|
|
7360
|
+
convert.hwb.rgb = function(hwb) {
|
|
7361
|
+
const h = hwb[0] / 360;
|
|
7362
|
+
let wh = hwb[1] / 100;
|
|
7363
|
+
let bl = hwb[2] / 100;
|
|
7364
|
+
const ratio = wh + bl;
|
|
7365
|
+
let f;
|
|
7366
|
+
if (ratio > 1) {
|
|
7367
|
+
wh /= ratio;
|
|
7368
|
+
bl /= ratio;
|
|
7369
|
+
}
|
|
7370
|
+
const i = Math.floor(6 * h);
|
|
7371
|
+
const v = 1 - bl;
|
|
7372
|
+
f = 6 * h - i;
|
|
7373
|
+
if ((i & 1) !== 0) {
|
|
7374
|
+
f = 1 - f;
|
|
7375
|
+
}
|
|
7376
|
+
const n = wh + f * (v - wh);
|
|
7377
|
+
let r;
|
|
7378
|
+
let g;
|
|
7379
|
+
let b;
|
|
7380
|
+
switch (i) {
|
|
7381
|
+
default:
|
|
7382
|
+
case 6:
|
|
7383
|
+
case 0:
|
|
7384
|
+
r = v;
|
|
7385
|
+
g = n;
|
|
7386
|
+
b = wh;
|
|
7387
|
+
break;
|
|
7388
|
+
case 1:
|
|
7389
|
+
r = n;
|
|
7390
|
+
g = v;
|
|
7391
|
+
b = wh;
|
|
7392
|
+
break;
|
|
7393
|
+
case 2:
|
|
7394
|
+
r = wh;
|
|
7395
|
+
g = v;
|
|
7396
|
+
b = n;
|
|
7397
|
+
break;
|
|
7398
|
+
case 3:
|
|
7399
|
+
r = wh;
|
|
7400
|
+
g = n;
|
|
7401
|
+
b = v;
|
|
7402
|
+
break;
|
|
7403
|
+
case 4:
|
|
7404
|
+
r = n;
|
|
7405
|
+
g = wh;
|
|
7406
|
+
b = v;
|
|
7407
|
+
break;
|
|
7408
|
+
case 5:
|
|
7409
|
+
r = v;
|
|
7410
|
+
g = wh;
|
|
7411
|
+
b = n;
|
|
7412
|
+
break;
|
|
7413
|
+
}
|
|
7414
|
+
return [r * 255, g * 255, b * 255];
|
|
7415
|
+
};
|
|
7416
|
+
convert.cmyk.rgb = function(cmyk) {
|
|
7417
|
+
const c = cmyk[0] / 100;
|
|
7418
|
+
const m = cmyk[1] / 100;
|
|
7419
|
+
const y = cmyk[2] / 100;
|
|
7420
|
+
const k = cmyk[3] / 100;
|
|
7421
|
+
const r = 1 - Math.min(1, c * (1 - k) + k);
|
|
7422
|
+
const g = 1 - Math.min(1, m * (1 - k) + k);
|
|
7423
|
+
const b = 1 - Math.min(1, y * (1 - k) + k);
|
|
7424
|
+
return [r * 255, g * 255, b * 255];
|
|
7425
|
+
};
|
|
7426
|
+
convert.xyz.rgb = function(xyz) {
|
|
7427
|
+
const x = xyz[0] / 100;
|
|
7428
|
+
const y = xyz[1] / 100;
|
|
7429
|
+
const z = xyz[2] / 100;
|
|
7430
|
+
let r;
|
|
7431
|
+
let g;
|
|
7432
|
+
let b;
|
|
7433
|
+
r = x * 3.2406 + y * -1.5372 + z * -0.4986;
|
|
7434
|
+
g = x * -0.9689 + y * 1.8758 + z * 0.0415;
|
|
7435
|
+
b = x * 0.0557 + y * -0.204 + z * 1.057;
|
|
7436
|
+
r = r > 31308e-7 ? 1.055 * r ** (1 / 2.4) - 0.055 : r * 12.92;
|
|
7437
|
+
g = g > 31308e-7 ? 1.055 * g ** (1 / 2.4) - 0.055 : g * 12.92;
|
|
7438
|
+
b = b > 31308e-7 ? 1.055 * b ** (1 / 2.4) - 0.055 : b * 12.92;
|
|
7439
|
+
r = Math.min(Math.max(0, r), 1);
|
|
7440
|
+
g = Math.min(Math.max(0, g), 1);
|
|
7441
|
+
b = Math.min(Math.max(0, b), 1);
|
|
7442
|
+
return [r * 255, g * 255, b * 255];
|
|
7443
|
+
};
|
|
7444
|
+
convert.xyz.lab = function(xyz) {
|
|
7445
|
+
let x = xyz[0];
|
|
7446
|
+
let y = xyz[1];
|
|
7447
|
+
let z = xyz[2];
|
|
7448
|
+
x /= 95.047;
|
|
7449
|
+
y /= 100;
|
|
7450
|
+
z /= 108.883;
|
|
7451
|
+
x = x > 8856e-6 ? x ** (1 / 3) : 7.787 * x + 16 / 116;
|
|
7452
|
+
y = y > 8856e-6 ? y ** (1 / 3) : 7.787 * y + 16 / 116;
|
|
7453
|
+
z = z > 8856e-6 ? z ** (1 / 3) : 7.787 * z + 16 / 116;
|
|
7454
|
+
const l = 116 * y - 16;
|
|
7455
|
+
const a = 500 * (x - y);
|
|
7456
|
+
const b = 200 * (y - z);
|
|
7457
|
+
return [l, a, b];
|
|
7458
|
+
};
|
|
7459
|
+
convert.lab.xyz = function(lab) {
|
|
7460
|
+
const l = lab[0];
|
|
7461
|
+
const a = lab[1];
|
|
7462
|
+
const b = lab[2];
|
|
7463
|
+
let x;
|
|
7464
|
+
let y;
|
|
7465
|
+
let z;
|
|
7466
|
+
y = (l + 16) / 116;
|
|
7467
|
+
x = a / 500 + y;
|
|
7468
|
+
z = y - b / 200;
|
|
7469
|
+
const y2 = y ** 3;
|
|
7470
|
+
const x2 = x ** 3;
|
|
7471
|
+
const z2 = z ** 3;
|
|
7472
|
+
y = y2 > 8856e-6 ? y2 : (y - 16 / 116) / 7.787;
|
|
7473
|
+
x = x2 > 8856e-6 ? x2 : (x - 16 / 116) / 7.787;
|
|
7474
|
+
z = z2 > 8856e-6 ? z2 : (z - 16 / 116) / 7.787;
|
|
7475
|
+
x *= 95.047;
|
|
7476
|
+
y *= 100;
|
|
7477
|
+
z *= 108.883;
|
|
7478
|
+
return [x, y, z];
|
|
7479
|
+
};
|
|
7480
|
+
convert.lab.lch = function(lab) {
|
|
7481
|
+
const l = lab[0];
|
|
7482
|
+
const a = lab[1];
|
|
7483
|
+
const b = lab[2];
|
|
7484
|
+
let h;
|
|
7485
|
+
const hr = Math.atan2(b, a);
|
|
7486
|
+
h = hr * 360 / 2 / Math.PI;
|
|
7487
|
+
if (h < 0) {
|
|
7488
|
+
h += 360;
|
|
7489
|
+
}
|
|
7490
|
+
const c = Math.sqrt(a * a + b * b);
|
|
7491
|
+
return [l, c, h];
|
|
7492
|
+
};
|
|
7493
|
+
convert.lch.lab = function(lch) {
|
|
7494
|
+
const l = lch[0];
|
|
7495
|
+
const c = lch[1];
|
|
7496
|
+
const h = lch[2];
|
|
7497
|
+
const hr = h / 360 * 2 * Math.PI;
|
|
7498
|
+
const a = c * Math.cos(hr);
|
|
7499
|
+
const b = c * Math.sin(hr);
|
|
7500
|
+
return [l, a, b];
|
|
7501
|
+
};
|
|
7502
|
+
convert.rgb.ansi16 = function(args, saturation = null) {
|
|
7503
|
+
const [r, g, b] = args;
|
|
7504
|
+
let value = saturation === null ? convert.rgb.hsv(args)[2] : saturation;
|
|
7505
|
+
value = Math.round(value / 50);
|
|
7506
|
+
if (value === 0) {
|
|
7507
|
+
return 30;
|
|
7508
|
+
}
|
|
7509
|
+
let ansi = 30 + (Math.round(b / 255) << 2 | Math.round(g / 255) << 1 | Math.round(r / 255));
|
|
7510
|
+
if (value === 2) {
|
|
7511
|
+
ansi += 60;
|
|
7512
|
+
}
|
|
7513
|
+
return ansi;
|
|
7514
|
+
};
|
|
7515
|
+
convert.hsv.ansi16 = function(args) {
|
|
7516
|
+
return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
|
|
7517
|
+
};
|
|
7518
|
+
convert.rgb.ansi256 = function(args) {
|
|
7519
|
+
const r = args[0];
|
|
7520
|
+
const g = args[1];
|
|
7521
|
+
const b = args[2];
|
|
7522
|
+
if (r === g && g === b) {
|
|
7523
|
+
if (r < 8) {
|
|
7524
|
+
return 16;
|
|
7525
|
+
}
|
|
7526
|
+
if (r > 248) {
|
|
7527
|
+
return 231;
|
|
7528
|
+
}
|
|
7529
|
+
return Math.round((r - 8) / 247 * 24) + 232;
|
|
7530
|
+
}
|
|
7531
|
+
const ansi = 16 + 36 * Math.round(r / 255 * 5) + 6 * Math.round(g / 255 * 5) + Math.round(b / 255 * 5);
|
|
7532
|
+
return ansi;
|
|
7533
|
+
};
|
|
7534
|
+
convert.ansi16.rgb = function(args) {
|
|
7535
|
+
let color = args % 10;
|
|
7536
|
+
if (color === 0 || color === 7) {
|
|
7537
|
+
if (args > 50) {
|
|
7538
|
+
color += 3.5;
|
|
7539
|
+
}
|
|
7540
|
+
color = color / 10.5 * 255;
|
|
7541
|
+
return [color, color, color];
|
|
7542
|
+
}
|
|
7543
|
+
const mult = (~~(args > 50) + 1) * 0.5;
|
|
7544
|
+
const r = (color & 1) * mult * 255;
|
|
7545
|
+
const g = (color >> 1 & 1) * mult * 255;
|
|
7546
|
+
const b = (color >> 2 & 1) * mult * 255;
|
|
7547
|
+
return [r, g, b];
|
|
7548
|
+
};
|
|
7549
|
+
convert.ansi256.rgb = function(args) {
|
|
7550
|
+
if (args >= 232) {
|
|
7551
|
+
const c = (args - 232) * 10 + 8;
|
|
7552
|
+
return [c, c, c];
|
|
7553
|
+
}
|
|
7554
|
+
args -= 16;
|
|
7555
|
+
let rem;
|
|
7556
|
+
const r = Math.floor(args / 36) / 5 * 255;
|
|
7557
|
+
const g = Math.floor((rem = args % 36) / 6) / 5 * 255;
|
|
7558
|
+
const b = rem % 6 / 5 * 255;
|
|
7559
|
+
return [r, g, b];
|
|
7560
|
+
};
|
|
7561
|
+
convert.rgb.hex = function(args) {
|
|
7562
|
+
const integer = ((Math.round(args[0]) & 255) << 16) + ((Math.round(args[1]) & 255) << 8) + (Math.round(args[2]) & 255);
|
|
7563
|
+
const string = integer.toString(16).toUpperCase();
|
|
7564
|
+
return "000000".substring(string.length) + string;
|
|
7565
|
+
};
|
|
7566
|
+
convert.hex.rgb = function(args) {
|
|
7567
|
+
const match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
|
|
7568
|
+
if (!match) {
|
|
7569
|
+
return [0, 0, 0];
|
|
7570
|
+
}
|
|
7571
|
+
let colorString = match[0];
|
|
7572
|
+
if (match[0].length === 3) {
|
|
7573
|
+
colorString = colorString.split("").map((char) => {
|
|
7574
|
+
return char + char;
|
|
7575
|
+
}).join("");
|
|
7576
|
+
}
|
|
7577
|
+
const integer = parseInt(colorString, 16);
|
|
7578
|
+
const r = integer >> 16 & 255;
|
|
7579
|
+
const g = integer >> 8 & 255;
|
|
7580
|
+
const b = integer & 255;
|
|
7581
|
+
return [r, g, b];
|
|
7582
|
+
};
|
|
7583
|
+
convert.rgb.hcg = function(rgb) {
|
|
7584
|
+
const r = rgb[0] / 255;
|
|
7585
|
+
const g = rgb[1] / 255;
|
|
7586
|
+
const b = rgb[2] / 255;
|
|
7587
|
+
const max = Math.max(Math.max(r, g), b);
|
|
7588
|
+
const min = Math.min(Math.min(r, g), b);
|
|
7589
|
+
const chroma = max - min;
|
|
7590
|
+
let grayscale;
|
|
7591
|
+
let hue;
|
|
7592
|
+
if (chroma < 1) {
|
|
7593
|
+
grayscale = min / (1 - chroma);
|
|
7594
|
+
} else {
|
|
7595
|
+
grayscale = 0;
|
|
7596
|
+
}
|
|
7597
|
+
if (chroma <= 0) {
|
|
7598
|
+
hue = 0;
|
|
7599
|
+
} else if (max === r) {
|
|
7600
|
+
hue = (g - b) / chroma % 6;
|
|
7601
|
+
} else if (max === g) {
|
|
7602
|
+
hue = 2 + (b - r) / chroma;
|
|
7603
|
+
} else {
|
|
7604
|
+
hue = 4 + (r - g) / chroma;
|
|
7605
|
+
}
|
|
7606
|
+
hue /= 6;
|
|
7607
|
+
hue %= 1;
|
|
7608
|
+
return [hue * 360, chroma * 100, grayscale * 100];
|
|
7609
|
+
};
|
|
7610
|
+
convert.hsl.hcg = function(hsl) {
|
|
7611
|
+
const s = hsl[1] / 100;
|
|
7612
|
+
const l = hsl[2] / 100;
|
|
7613
|
+
const c = l < 0.5 ? 2 * s * l : 2 * s * (1 - l);
|
|
7614
|
+
let f = 0;
|
|
7615
|
+
if (c < 1) {
|
|
7616
|
+
f = (l - 0.5 * c) / (1 - c);
|
|
7617
|
+
}
|
|
7618
|
+
return [hsl[0], c * 100, f * 100];
|
|
7619
|
+
};
|
|
7620
|
+
convert.hsv.hcg = function(hsv) {
|
|
7621
|
+
const s = hsv[1] / 100;
|
|
7622
|
+
const v = hsv[2] / 100;
|
|
7623
|
+
const c = s * v;
|
|
7624
|
+
let f = 0;
|
|
7625
|
+
if (c < 1) {
|
|
7626
|
+
f = (v - c) / (1 - c);
|
|
7627
|
+
}
|
|
7628
|
+
return [hsv[0], c * 100, f * 100];
|
|
7629
|
+
};
|
|
7630
|
+
convert.hcg.rgb = function(hcg) {
|
|
7631
|
+
const h = hcg[0] / 360;
|
|
7632
|
+
const c = hcg[1] / 100;
|
|
7633
|
+
const g = hcg[2] / 100;
|
|
7634
|
+
if (c === 0) {
|
|
7635
|
+
return [g * 255, g * 255, g * 255];
|
|
7636
|
+
}
|
|
7637
|
+
const pure = [0, 0, 0];
|
|
7638
|
+
const hi = h % 1 * 6;
|
|
7639
|
+
const v = hi % 1;
|
|
7640
|
+
const w = 1 - v;
|
|
7641
|
+
let mg = 0;
|
|
7642
|
+
switch (Math.floor(hi)) {
|
|
7643
|
+
case 0:
|
|
7644
|
+
pure[0] = 1;
|
|
7645
|
+
pure[1] = v;
|
|
7646
|
+
pure[2] = 0;
|
|
7647
|
+
break;
|
|
7648
|
+
case 1:
|
|
7649
|
+
pure[0] = w;
|
|
7650
|
+
pure[1] = 1;
|
|
7651
|
+
pure[2] = 0;
|
|
7652
|
+
break;
|
|
7653
|
+
case 2:
|
|
7654
|
+
pure[0] = 0;
|
|
7655
|
+
pure[1] = 1;
|
|
7656
|
+
pure[2] = v;
|
|
7657
|
+
break;
|
|
7658
|
+
case 3:
|
|
7659
|
+
pure[0] = 0;
|
|
7660
|
+
pure[1] = w;
|
|
7661
|
+
pure[2] = 1;
|
|
7662
|
+
break;
|
|
7663
|
+
case 4:
|
|
7664
|
+
pure[0] = v;
|
|
7665
|
+
pure[1] = 0;
|
|
7666
|
+
pure[2] = 1;
|
|
7667
|
+
break;
|
|
7668
|
+
default:
|
|
7669
|
+
pure[0] = 1;
|
|
7670
|
+
pure[1] = 0;
|
|
7671
|
+
pure[2] = w;
|
|
7672
|
+
}
|
|
7673
|
+
mg = (1 - c) * g;
|
|
7674
|
+
return [
|
|
7675
|
+
(c * pure[0] + mg) * 255,
|
|
7676
|
+
(c * pure[1] + mg) * 255,
|
|
7677
|
+
(c * pure[2] + mg) * 255
|
|
7678
|
+
];
|
|
7679
|
+
};
|
|
7680
|
+
convert.hcg.hsv = function(hcg) {
|
|
7681
|
+
const c = hcg[1] / 100;
|
|
7682
|
+
const g = hcg[2] / 100;
|
|
7683
|
+
const v = c + g * (1 - c);
|
|
7684
|
+
let f = 0;
|
|
7685
|
+
if (v > 0) {
|
|
7686
|
+
f = c / v;
|
|
7687
|
+
}
|
|
7688
|
+
return [hcg[0], f * 100, v * 100];
|
|
7689
|
+
};
|
|
7690
|
+
convert.hcg.hsl = function(hcg) {
|
|
7691
|
+
const c = hcg[1] / 100;
|
|
7692
|
+
const g = hcg[2] / 100;
|
|
7693
|
+
const l = g * (1 - c) + 0.5 * c;
|
|
7694
|
+
let s = 0;
|
|
7695
|
+
if (l > 0 && l < 0.5) {
|
|
7696
|
+
s = c / (2 * l);
|
|
7697
|
+
} else if (l >= 0.5 && l < 1) {
|
|
7698
|
+
s = c / (2 * (1 - l));
|
|
7699
|
+
}
|
|
7700
|
+
return [hcg[0], s * 100, l * 100];
|
|
7701
|
+
};
|
|
7702
|
+
convert.hcg.hwb = function(hcg) {
|
|
7703
|
+
const c = hcg[1] / 100;
|
|
7704
|
+
const g = hcg[2] / 100;
|
|
7705
|
+
const v = c + g * (1 - c);
|
|
7706
|
+
return [hcg[0], (v - c) * 100, (1 - v) * 100];
|
|
7707
|
+
};
|
|
7708
|
+
convert.hwb.hcg = function(hwb) {
|
|
7709
|
+
const w = hwb[1] / 100;
|
|
7710
|
+
const b = hwb[2] / 100;
|
|
7711
|
+
const v = 1 - b;
|
|
7712
|
+
const c = v - w;
|
|
7713
|
+
let g = 0;
|
|
7714
|
+
if (c < 1) {
|
|
7715
|
+
g = (v - c) / (1 - c);
|
|
7716
|
+
}
|
|
7717
|
+
return [hwb[0], c * 100, g * 100];
|
|
7718
|
+
};
|
|
7719
|
+
convert.apple.rgb = function(apple) {
|
|
7720
|
+
return [apple[0] / 65535 * 255, apple[1] / 65535 * 255, apple[2] / 65535 * 255];
|
|
7721
|
+
};
|
|
7722
|
+
convert.rgb.apple = function(rgb) {
|
|
7723
|
+
return [rgb[0] / 255 * 65535, rgb[1] / 255 * 65535, rgb[2] / 255 * 65535];
|
|
7724
|
+
};
|
|
7725
|
+
convert.gray.rgb = function(args) {
|
|
7726
|
+
return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
|
|
7727
|
+
};
|
|
7728
|
+
convert.gray.hsl = function(args) {
|
|
7729
|
+
return [0, 0, args[0]];
|
|
7730
|
+
};
|
|
7731
|
+
convert.gray.hsv = convert.gray.hsl;
|
|
7732
|
+
convert.gray.hwb = function(gray) {
|
|
7733
|
+
return [0, 100, gray[0]];
|
|
7734
|
+
};
|
|
7735
|
+
convert.gray.cmyk = function(gray) {
|
|
7736
|
+
return [0, 0, 0, gray[0]];
|
|
7737
|
+
};
|
|
7738
|
+
convert.gray.lab = function(gray) {
|
|
7739
|
+
return [gray[0], 0, 0];
|
|
7740
|
+
};
|
|
7741
|
+
convert.gray.hex = function(gray) {
|
|
7742
|
+
const val = Math.round(gray[0] / 100 * 255) & 255;
|
|
7743
|
+
const integer = (val << 16) + (val << 8) + val;
|
|
7744
|
+
const string = integer.toString(16).toUpperCase();
|
|
7745
|
+
return "000000".substring(string.length) + string;
|
|
7746
|
+
};
|
|
7747
|
+
convert.rgb.gray = function(rgb) {
|
|
7748
|
+
const val = (rgb[0] + rgb[1] + rgb[2]) / 3;
|
|
7749
|
+
return [val / 255 * 100];
|
|
7750
|
+
};
|
|
7751
|
+
return conversions;
|
|
7752
|
+
}
|
|
7753
|
+
var route;
|
|
7754
|
+
var hasRequiredRoute;
|
|
7755
|
+
function requireRoute() {
|
|
7756
|
+
if (hasRequiredRoute)
|
|
7757
|
+
return route;
|
|
7758
|
+
hasRequiredRoute = 1;
|
|
7759
|
+
const conversions2 = requireConversions();
|
|
7760
|
+
function buildGraph() {
|
|
7761
|
+
const graph = {};
|
|
7762
|
+
const models = Object.keys(conversions2);
|
|
7763
|
+
for (let len = models.length, i = 0; i < len; i++) {
|
|
7764
|
+
graph[models[i]] = {
|
|
7765
|
+
// http://jsperf.com/1-vs-infinity
|
|
7766
|
+
// micro-opt, but this is simple.
|
|
7767
|
+
distance: -1,
|
|
7768
|
+
parent: null
|
|
7769
|
+
};
|
|
7770
|
+
}
|
|
7771
|
+
return graph;
|
|
7772
|
+
}
|
|
7773
|
+
function deriveBFS(fromModel) {
|
|
7774
|
+
const graph = buildGraph();
|
|
7775
|
+
const queue = [fromModel];
|
|
7776
|
+
graph[fromModel].distance = 0;
|
|
7777
|
+
while (queue.length) {
|
|
7778
|
+
const current = queue.pop();
|
|
7779
|
+
const adjacents = Object.keys(conversions2[current]);
|
|
7780
|
+
for (let len = adjacents.length, i = 0; i < len; i++) {
|
|
7781
|
+
const adjacent = adjacents[i];
|
|
7782
|
+
const node = graph[adjacent];
|
|
7783
|
+
if (node.distance === -1) {
|
|
7784
|
+
node.distance = graph[current].distance + 1;
|
|
7785
|
+
node.parent = current;
|
|
7786
|
+
queue.unshift(adjacent);
|
|
7787
|
+
}
|
|
7788
|
+
}
|
|
7789
|
+
}
|
|
7790
|
+
return graph;
|
|
7791
|
+
}
|
|
7792
|
+
function link(from, to) {
|
|
7793
|
+
return function(args) {
|
|
7794
|
+
return to(from(args));
|
|
7795
|
+
};
|
|
7796
|
+
}
|
|
7797
|
+
function wrapConversion(toModel, graph) {
|
|
7798
|
+
const path2 = [graph[toModel].parent, toModel];
|
|
7799
|
+
let fn = conversions2[graph[toModel].parent][toModel];
|
|
7800
|
+
let cur = graph[toModel].parent;
|
|
7801
|
+
while (graph[cur].parent) {
|
|
7802
|
+
path2.unshift(graph[cur].parent);
|
|
7803
|
+
fn = link(conversions2[graph[cur].parent][cur], fn);
|
|
7804
|
+
cur = graph[cur].parent;
|
|
7805
|
+
}
|
|
7806
|
+
fn.conversion = path2;
|
|
7807
|
+
return fn;
|
|
7808
|
+
}
|
|
7809
|
+
route = function(fromModel) {
|
|
7810
|
+
const graph = deriveBFS(fromModel);
|
|
7811
|
+
const conversion = {};
|
|
7812
|
+
const models = Object.keys(graph);
|
|
7813
|
+
for (let len = models.length, i = 0; i < len; i++) {
|
|
7814
|
+
const toModel = models[i];
|
|
7815
|
+
const node = graph[toModel];
|
|
7816
|
+
if (node.parent === null) {
|
|
7817
|
+
continue;
|
|
7818
|
+
}
|
|
7819
|
+
conversion[toModel] = wrapConversion(toModel, graph);
|
|
7820
|
+
}
|
|
7821
|
+
return conversion;
|
|
7822
|
+
};
|
|
7823
|
+
return route;
|
|
7824
|
+
}
|
|
7825
|
+
var colorConvert;
|
|
7826
|
+
var hasRequiredColorConvert;
|
|
7827
|
+
function requireColorConvert() {
|
|
7828
|
+
if (hasRequiredColorConvert)
|
|
7829
|
+
return colorConvert;
|
|
7830
|
+
hasRequiredColorConvert = 1;
|
|
7831
|
+
const conversions2 = requireConversions();
|
|
7832
|
+
const route2 = requireRoute();
|
|
7833
|
+
const convert = {};
|
|
7834
|
+
const models = Object.keys(conversions2);
|
|
7835
|
+
function wrapRaw(fn) {
|
|
7836
|
+
const wrappedFn = function(...args) {
|
|
7837
|
+
const arg0 = args[0];
|
|
7838
|
+
if (arg0 === void 0 || arg0 === null) {
|
|
7839
|
+
return arg0;
|
|
7840
|
+
}
|
|
7841
|
+
if (arg0.length > 1) {
|
|
7842
|
+
args = arg0;
|
|
7843
|
+
}
|
|
7844
|
+
return fn(args);
|
|
7845
|
+
};
|
|
7846
|
+
if ("conversion" in fn) {
|
|
7847
|
+
wrappedFn.conversion = fn.conversion;
|
|
7848
|
+
}
|
|
7849
|
+
return wrappedFn;
|
|
7850
|
+
}
|
|
7851
|
+
function wrapRounded(fn) {
|
|
7852
|
+
const wrappedFn = function(...args) {
|
|
7853
|
+
const arg0 = args[0];
|
|
7854
|
+
if (arg0 === void 0 || arg0 === null) {
|
|
7855
|
+
return arg0;
|
|
7856
|
+
}
|
|
7857
|
+
if (arg0.length > 1) {
|
|
7858
|
+
args = arg0;
|
|
7859
|
+
}
|
|
7860
|
+
const result = fn(args);
|
|
7861
|
+
if (typeof result === "object") {
|
|
7862
|
+
for (let len = result.length, i = 0; i < len; i++) {
|
|
7863
|
+
result[i] = Math.round(result[i]);
|
|
7864
|
+
}
|
|
7865
|
+
}
|
|
7866
|
+
return result;
|
|
7867
|
+
};
|
|
7868
|
+
if ("conversion" in fn) {
|
|
7869
|
+
wrappedFn.conversion = fn.conversion;
|
|
7870
|
+
}
|
|
7871
|
+
return wrappedFn;
|
|
7872
|
+
}
|
|
7873
|
+
models.forEach((fromModel) => {
|
|
7874
|
+
convert[fromModel] = {};
|
|
7875
|
+
Object.defineProperty(convert[fromModel], "channels", { value: conversions2[fromModel].channels });
|
|
7876
|
+
Object.defineProperty(convert[fromModel], "labels", { value: conversions2[fromModel].labels });
|
|
7877
|
+
const routes = route2(fromModel);
|
|
7878
|
+
const routeModels = Object.keys(routes);
|
|
7879
|
+
routeModels.forEach((toModel) => {
|
|
7880
|
+
const fn = routes[toModel];
|
|
7881
|
+
convert[fromModel][toModel] = wrapRounded(fn);
|
|
7882
|
+
convert[fromModel][toModel].raw = wrapRaw(fn);
|
|
7883
|
+
});
|
|
7884
|
+
});
|
|
7885
|
+
colorConvert = convert;
|
|
7886
|
+
return colorConvert;
|
|
7887
|
+
}
|
|
7888
|
+
ansiStyles$1.exports;
|
|
7889
|
+
(function(module) {
|
|
7890
|
+
const wrapAnsi16 = (fn, offset) => (...args) => {
|
|
7891
|
+
const code = fn(...args);
|
|
7892
|
+
return `\x1B[${code + offset}m`;
|
|
7893
|
+
};
|
|
7894
|
+
const wrapAnsi256 = (fn, offset) => (...args) => {
|
|
7895
|
+
const code = fn(...args);
|
|
7896
|
+
return `\x1B[${38 + offset};5;${code}m`;
|
|
7897
|
+
};
|
|
7898
|
+
const wrapAnsi16m = (fn, offset) => (...args) => {
|
|
7899
|
+
const rgb = fn(...args);
|
|
7900
|
+
return `\x1B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
|
|
7901
|
+
};
|
|
7902
|
+
const ansi2ansi = (n) => n;
|
|
7903
|
+
const rgb2rgb = (r, g, b) => [r, g, b];
|
|
7904
|
+
const setLazyProperty = (object, property, get) => {
|
|
7905
|
+
Object.defineProperty(object, property, {
|
|
7906
|
+
get: () => {
|
|
7907
|
+
const value = get();
|
|
7908
|
+
Object.defineProperty(object, property, {
|
|
7909
|
+
value,
|
|
7910
|
+
enumerable: true,
|
|
7911
|
+
configurable: true
|
|
7912
|
+
});
|
|
7913
|
+
return value;
|
|
7914
|
+
},
|
|
7915
|
+
enumerable: true,
|
|
7916
|
+
configurable: true
|
|
7917
|
+
});
|
|
7918
|
+
};
|
|
7919
|
+
let colorConvert2;
|
|
7920
|
+
const makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => {
|
|
7921
|
+
if (colorConvert2 === void 0) {
|
|
7922
|
+
colorConvert2 = requireColorConvert();
|
|
7923
|
+
}
|
|
7924
|
+
const offset = isBackground ? 10 : 0;
|
|
7925
|
+
const styles2 = {};
|
|
7926
|
+
for (const [sourceSpace, suite] of Object.entries(colorConvert2)) {
|
|
7927
|
+
const name2 = sourceSpace === "ansi16" ? "ansi" : sourceSpace;
|
|
7928
|
+
if (sourceSpace === targetSpace) {
|
|
7929
|
+
styles2[name2] = wrap(identity, offset);
|
|
7930
|
+
} else if (typeof suite === "object") {
|
|
7931
|
+
styles2[name2] = wrap(suite[targetSpace], offset);
|
|
7932
|
+
}
|
|
7933
|
+
}
|
|
7934
|
+
return styles2;
|
|
7935
|
+
};
|
|
7936
|
+
function assembleStyles() {
|
|
7937
|
+
const codes = /* @__PURE__ */ new Map();
|
|
7938
|
+
const styles2 = {
|
|
7939
|
+
modifier: {
|
|
7940
|
+
reset: [0, 0],
|
|
7941
|
+
// 21 isn't widely supported and 22 does the same thing
|
|
7942
|
+
bold: [1, 22],
|
|
7943
|
+
dim: [2, 22],
|
|
7944
|
+
italic: [3, 23],
|
|
7945
|
+
underline: [4, 24],
|
|
7946
|
+
inverse: [7, 27],
|
|
7947
|
+
hidden: [8, 28],
|
|
7948
|
+
strikethrough: [9, 29]
|
|
7949
|
+
},
|
|
7950
|
+
color: {
|
|
7951
|
+
black: [30, 39],
|
|
7952
|
+
red: [31, 39],
|
|
7953
|
+
green: [32, 39],
|
|
7954
|
+
yellow: [33, 39],
|
|
7955
|
+
blue: [34, 39],
|
|
7956
|
+
magenta: [35, 39],
|
|
7957
|
+
cyan: [36, 39],
|
|
7958
|
+
white: [37, 39],
|
|
7959
|
+
// Bright color
|
|
7960
|
+
blackBright: [90, 39],
|
|
7961
|
+
redBright: [91, 39],
|
|
7962
|
+
greenBright: [92, 39],
|
|
7963
|
+
yellowBright: [93, 39],
|
|
7964
|
+
blueBright: [94, 39],
|
|
7965
|
+
magentaBright: [95, 39],
|
|
7966
|
+
cyanBright: [96, 39],
|
|
7967
|
+
whiteBright: [97, 39]
|
|
7968
|
+
},
|
|
7969
|
+
bgColor: {
|
|
7970
|
+
bgBlack: [40, 49],
|
|
7971
|
+
bgRed: [41, 49],
|
|
7972
|
+
bgGreen: [42, 49],
|
|
7973
|
+
bgYellow: [43, 49],
|
|
7974
|
+
bgBlue: [44, 49],
|
|
7975
|
+
bgMagenta: [45, 49],
|
|
7976
|
+
bgCyan: [46, 49],
|
|
7977
|
+
bgWhite: [47, 49],
|
|
7978
|
+
// Bright color
|
|
7979
|
+
bgBlackBright: [100, 49],
|
|
7980
|
+
bgRedBright: [101, 49],
|
|
7981
|
+
bgGreenBright: [102, 49],
|
|
7982
|
+
bgYellowBright: [103, 49],
|
|
7983
|
+
bgBlueBright: [104, 49],
|
|
7984
|
+
bgMagentaBright: [105, 49],
|
|
7985
|
+
bgCyanBright: [106, 49],
|
|
7986
|
+
bgWhiteBright: [107, 49]
|
|
7987
|
+
}
|
|
7988
|
+
};
|
|
7989
|
+
styles2.color.gray = styles2.color.blackBright;
|
|
7990
|
+
styles2.bgColor.bgGray = styles2.bgColor.bgBlackBright;
|
|
7991
|
+
styles2.color.grey = styles2.color.blackBright;
|
|
7992
|
+
styles2.bgColor.bgGrey = styles2.bgColor.bgBlackBright;
|
|
7993
|
+
for (const [groupName, group] of Object.entries(styles2)) {
|
|
7994
|
+
for (const [styleName, style] of Object.entries(group)) {
|
|
7995
|
+
styles2[styleName] = {
|
|
7996
|
+
open: `\x1B[${style[0]}m`,
|
|
7997
|
+
close: `\x1B[${style[1]}m`
|
|
7998
|
+
};
|
|
7999
|
+
group[styleName] = styles2[styleName];
|
|
8000
|
+
codes.set(style[0], style[1]);
|
|
8001
|
+
}
|
|
8002
|
+
Object.defineProperty(styles2, groupName, {
|
|
8003
|
+
value: group,
|
|
8004
|
+
enumerable: false
|
|
8005
|
+
});
|
|
8006
|
+
}
|
|
8007
|
+
Object.defineProperty(styles2, "codes", {
|
|
8008
|
+
value: codes,
|
|
8009
|
+
enumerable: false
|
|
8010
|
+
});
|
|
8011
|
+
styles2.color.close = "\x1B[39m";
|
|
8012
|
+
styles2.bgColor.close = "\x1B[49m";
|
|
8013
|
+
setLazyProperty(styles2.color, "ansi", () => makeDynamicStyles(wrapAnsi16, "ansi16", ansi2ansi, false));
|
|
8014
|
+
setLazyProperty(styles2.color, "ansi256", () => makeDynamicStyles(wrapAnsi256, "ansi256", ansi2ansi, false));
|
|
8015
|
+
setLazyProperty(styles2.color, "ansi16m", () => makeDynamicStyles(wrapAnsi16m, "rgb", rgb2rgb, false));
|
|
8016
|
+
setLazyProperty(styles2.bgColor, "ansi", () => makeDynamicStyles(wrapAnsi16, "ansi16", ansi2ansi, true));
|
|
8017
|
+
setLazyProperty(styles2.bgColor, "ansi256", () => makeDynamicStyles(wrapAnsi256, "ansi256", ansi2ansi, true));
|
|
8018
|
+
setLazyProperty(styles2.bgColor, "ansi16m", () => makeDynamicStyles(wrapAnsi16m, "rgb", rgb2rgb, true));
|
|
8019
|
+
return styles2;
|
|
8020
|
+
}
|
|
8021
|
+
Object.defineProperty(module, "exports", {
|
|
8022
|
+
enumerable: true,
|
|
8023
|
+
get: assembleStyles
|
|
8024
|
+
});
|
|
8025
|
+
})(ansiStyles$1);
|
|
8026
|
+
var ansiStylesExports = ansiStyles$1.exports;
|
|
8027
|
+
var browser = {
|
|
8028
|
+
stdout: false,
|
|
8029
|
+
stderr: false
|
|
8030
|
+
};
|
|
8031
|
+
const stringReplaceAll$1 = (string, substring, replacer) => {
|
|
8032
|
+
let index = string.indexOf(substring);
|
|
8033
|
+
if (index === -1) {
|
|
8034
|
+
return string;
|
|
8035
|
+
}
|
|
8036
|
+
const substringLength = substring.length;
|
|
8037
|
+
let endIndex = 0;
|
|
8038
|
+
let returnValue = "";
|
|
8039
|
+
do {
|
|
8040
|
+
returnValue += string.substr(endIndex, index - endIndex) + substring + replacer;
|
|
8041
|
+
endIndex = index + substringLength;
|
|
8042
|
+
index = string.indexOf(substring, endIndex);
|
|
8043
|
+
} while (index !== -1);
|
|
8044
|
+
returnValue += string.substr(endIndex);
|
|
8045
|
+
return returnValue;
|
|
8046
|
+
};
|
|
8047
|
+
const stringEncaseCRLFWithFirstIndex$1 = (string, prefix, postfix, index) => {
|
|
8048
|
+
let endIndex = 0;
|
|
8049
|
+
let returnValue = "";
|
|
8050
|
+
do {
|
|
8051
|
+
const gotCR = string[index - 1] === "\r";
|
|
8052
|
+
returnValue += string.substr(endIndex, (gotCR ? index - 1 : index) - endIndex) + prefix + (gotCR ? "\r\n" : "\n") + postfix;
|
|
8053
|
+
endIndex = index + 1;
|
|
8054
|
+
index = string.indexOf("\n", endIndex);
|
|
8055
|
+
} while (index !== -1);
|
|
8056
|
+
returnValue += string.substr(endIndex);
|
|
8057
|
+
return returnValue;
|
|
8058
|
+
};
|
|
8059
|
+
var util = {
|
|
8060
|
+
stringReplaceAll: stringReplaceAll$1,
|
|
8061
|
+
stringEncaseCRLFWithFirstIndex: stringEncaseCRLFWithFirstIndex$1
|
|
8062
|
+
};
|
|
8063
|
+
var templates;
|
|
8064
|
+
var hasRequiredTemplates;
|
|
8065
|
+
function requireTemplates() {
|
|
8066
|
+
if (hasRequiredTemplates)
|
|
8067
|
+
return templates;
|
|
8068
|
+
hasRequiredTemplates = 1;
|
|
8069
|
+
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;
|
|
8070
|
+
const STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
|
|
8071
|
+
const STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;
|
|
8072
|
+
const ESCAPE_REGEX = /\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi;
|
|
8073
|
+
const ESCAPES = /* @__PURE__ */ new Map([
|
|
8074
|
+
["n", "\n"],
|
|
8075
|
+
["r", "\r"],
|
|
8076
|
+
["t", " "],
|
|
8077
|
+
["b", "\b"],
|
|
8078
|
+
["f", "\f"],
|
|
8079
|
+
["v", "\v"],
|
|
8080
|
+
["0", "\0"],
|
|
8081
|
+
["\\", "\\"],
|
|
8082
|
+
["e", "\x1B"],
|
|
8083
|
+
["a", "\x07"]
|
|
8084
|
+
]);
|
|
8085
|
+
function unescape(c) {
|
|
8086
|
+
const u = c[0] === "u";
|
|
8087
|
+
const bracket = c[1] === "{";
|
|
8088
|
+
if (u && !bracket && c.length === 5 || c[0] === "x" && c.length === 3) {
|
|
8089
|
+
return String.fromCharCode(parseInt(c.slice(1), 16));
|
|
8090
|
+
}
|
|
8091
|
+
if (u && bracket) {
|
|
8092
|
+
return String.fromCodePoint(parseInt(c.slice(2, -1), 16));
|
|
8093
|
+
}
|
|
8094
|
+
return ESCAPES.get(c) || c;
|
|
8095
|
+
}
|
|
8096
|
+
function parseArguments(name2, arguments_) {
|
|
8097
|
+
const results = [];
|
|
8098
|
+
const chunks = arguments_.trim().split(/\s*,\s*/g);
|
|
8099
|
+
let matches;
|
|
8100
|
+
for (const chunk of chunks) {
|
|
8101
|
+
const number = Number(chunk);
|
|
8102
|
+
if (!Number.isNaN(number)) {
|
|
8103
|
+
results.push(number);
|
|
8104
|
+
} else if (matches = chunk.match(STRING_REGEX)) {
|
|
8105
|
+
results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, character) => escape ? unescape(escape) : character));
|
|
8106
|
+
} else {
|
|
8107
|
+
throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name2}')`);
|
|
8108
|
+
}
|
|
8109
|
+
}
|
|
8110
|
+
return results;
|
|
8111
|
+
}
|
|
8112
|
+
function parseStyle(style) {
|
|
8113
|
+
STYLE_REGEX.lastIndex = 0;
|
|
8114
|
+
const results = [];
|
|
8115
|
+
let matches;
|
|
8116
|
+
while ((matches = STYLE_REGEX.exec(style)) !== null) {
|
|
8117
|
+
const name2 = matches[1];
|
|
8118
|
+
if (matches[2]) {
|
|
8119
|
+
const args = parseArguments(name2, matches[2]);
|
|
8120
|
+
results.push([name2].concat(args));
|
|
8121
|
+
} else {
|
|
8122
|
+
results.push([name2]);
|
|
8123
|
+
}
|
|
8124
|
+
}
|
|
8125
|
+
return results;
|
|
8126
|
+
}
|
|
8127
|
+
function buildStyle(chalk2, styles2) {
|
|
8128
|
+
const enabled = {};
|
|
8129
|
+
for (const layer of styles2) {
|
|
8130
|
+
for (const style of layer.styles) {
|
|
8131
|
+
enabled[style[0]] = layer.inverse ? null : style.slice(1);
|
|
8132
|
+
}
|
|
8133
|
+
}
|
|
8134
|
+
let current = chalk2;
|
|
8135
|
+
for (const [styleName, styles3] of Object.entries(enabled)) {
|
|
8136
|
+
if (!Array.isArray(styles3)) {
|
|
8137
|
+
continue;
|
|
8138
|
+
}
|
|
8139
|
+
if (!(styleName in current)) {
|
|
8140
|
+
throw new Error(`Unknown Chalk style: ${styleName}`);
|
|
8141
|
+
}
|
|
8142
|
+
current = styles3.length > 0 ? current[styleName](...styles3) : current[styleName];
|
|
8143
|
+
}
|
|
8144
|
+
return current;
|
|
8145
|
+
}
|
|
8146
|
+
templates = (chalk2, temporary) => {
|
|
8147
|
+
const styles2 = [];
|
|
8148
|
+
const chunks = [];
|
|
8149
|
+
let chunk = [];
|
|
8150
|
+
temporary.replace(TEMPLATE_REGEX, (m, escapeCharacter, inverse, style, close, character) => {
|
|
8151
|
+
if (escapeCharacter) {
|
|
8152
|
+
chunk.push(unescape(escapeCharacter));
|
|
8153
|
+
} else if (style) {
|
|
8154
|
+
const string = chunk.join("");
|
|
8155
|
+
chunk = [];
|
|
8156
|
+
chunks.push(styles2.length === 0 ? string : buildStyle(chalk2, styles2)(string));
|
|
8157
|
+
styles2.push({ inverse, styles: parseStyle(style) });
|
|
8158
|
+
} else if (close) {
|
|
8159
|
+
if (styles2.length === 0) {
|
|
8160
|
+
throw new Error("Found extraneous } in Chalk template literal");
|
|
8161
|
+
}
|
|
8162
|
+
chunks.push(buildStyle(chalk2, styles2)(chunk.join("")));
|
|
8163
|
+
chunk = [];
|
|
8164
|
+
styles2.pop();
|
|
8165
|
+
} else {
|
|
8166
|
+
chunk.push(character);
|
|
8167
|
+
}
|
|
8168
|
+
});
|
|
8169
|
+
chunks.push(chunk.join(""));
|
|
8170
|
+
if (styles2.length > 0) {
|
|
8171
|
+
const errMessage = `Chalk template literal is missing ${styles2.length} closing bracket${styles2.length === 1 ? "" : "s"} (\`}\`)`;
|
|
8172
|
+
throw new Error(errMessage);
|
|
8173
|
+
}
|
|
8174
|
+
return chunks.join("");
|
|
8175
|
+
};
|
|
8176
|
+
return templates;
|
|
8177
|
+
}
|
|
8178
|
+
const ansiStyles = ansiStylesExports;
|
|
8179
|
+
const { stdout: stdoutColor, stderr: stderrColor } = browser;
|
|
8180
|
+
const {
|
|
8181
|
+
stringReplaceAll,
|
|
8182
|
+
stringEncaseCRLFWithFirstIndex
|
|
8183
|
+
} = util;
|
|
8184
|
+
const { isArray } = Array;
|
|
8185
|
+
const levelMapping = [
|
|
8186
|
+
"ansi",
|
|
8187
|
+
"ansi",
|
|
8188
|
+
"ansi256",
|
|
8189
|
+
"ansi16m"
|
|
8190
|
+
];
|
|
8191
|
+
const styles = /* @__PURE__ */ Object.create(null);
|
|
8192
|
+
const applyOptions = (object, options = {}) => {
|
|
8193
|
+
if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
|
|
8194
|
+
throw new Error("The `level` option should be an integer from 0 to 3");
|
|
8195
|
+
}
|
|
8196
|
+
const colorLevel = stdoutColor ? stdoutColor.level : 0;
|
|
8197
|
+
object.level = options.level === void 0 ? colorLevel : options.level;
|
|
8198
|
+
};
|
|
8199
|
+
class ChalkClass2 {
|
|
8200
|
+
constructor(options) {
|
|
8201
|
+
return chalkFactory(options);
|
|
8202
|
+
}
|
|
8203
|
+
}
|
|
8204
|
+
const chalkFactory = (options) => {
|
|
8205
|
+
const chalk2 = {};
|
|
8206
|
+
applyOptions(chalk2, options);
|
|
8207
|
+
chalk2.template = (...arguments_) => chalkTag(chalk2.template, ...arguments_);
|
|
8208
|
+
Object.setPrototypeOf(chalk2, Chalk.prototype);
|
|
8209
|
+
Object.setPrototypeOf(chalk2.template, chalk2);
|
|
8210
|
+
chalk2.template.constructor = () => {
|
|
8211
|
+
throw new Error("`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.");
|
|
8212
|
+
};
|
|
8213
|
+
chalk2.template.Instance = ChalkClass2;
|
|
8214
|
+
return chalk2.template;
|
|
8215
|
+
};
|
|
8216
|
+
function Chalk(options) {
|
|
8217
|
+
return chalkFactory(options);
|
|
8218
|
+
}
|
|
8219
|
+
for (const [styleName, style] of Object.entries(ansiStyles)) {
|
|
8220
|
+
styles[styleName] = {
|
|
8221
|
+
get() {
|
|
8222
|
+
const builder = createBuilder(this, createStyler(style.open, style.close, this._styler), this._isEmpty);
|
|
8223
|
+
Object.defineProperty(this, styleName, { value: builder });
|
|
8224
|
+
return builder;
|
|
8225
|
+
}
|
|
8226
|
+
};
|
|
8227
|
+
}
|
|
8228
|
+
styles.visible = {
|
|
8229
|
+
get() {
|
|
8230
|
+
const builder = createBuilder(this, this._styler, true);
|
|
8231
|
+
Object.defineProperty(this, "visible", { value: builder });
|
|
8232
|
+
return builder;
|
|
8233
|
+
}
|
|
8234
|
+
};
|
|
8235
|
+
const usedModels = ["rgb", "hex", "keyword", "hsl", "hsv", "hwb", "ansi", "ansi256"];
|
|
8236
|
+
for (const model of usedModels) {
|
|
8237
|
+
styles[model] = {
|
|
8238
|
+
get() {
|
|
8239
|
+
const { level } = this;
|
|
8240
|
+
return function(...arguments_) {
|
|
8241
|
+
const styler = createStyler(ansiStyles.color[levelMapping[level]][model](...arguments_), ansiStyles.color.close, this._styler);
|
|
8242
|
+
return createBuilder(this, styler, this._isEmpty);
|
|
8243
|
+
};
|
|
8244
|
+
}
|
|
8245
|
+
};
|
|
8246
|
+
}
|
|
8247
|
+
for (const model of usedModels) {
|
|
8248
|
+
const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
|
|
8249
|
+
styles[bgModel] = {
|
|
8250
|
+
get() {
|
|
8251
|
+
const { level } = this;
|
|
8252
|
+
return function(...arguments_) {
|
|
8253
|
+
const styler = createStyler(ansiStyles.bgColor[levelMapping[level]][model](...arguments_), ansiStyles.bgColor.close, this._styler);
|
|
8254
|
+
return createBuilder(this, styler, this._isEmpty);
|
|
8255
|
+
};
|
|
8256
|
+
}
|
|
8257
|
+
};
|
|
8258
|
+
}
|
|
8259
|
+
const proto = Object.defineProperties(() => {
|
|
8260
|
+
}, {
|
|
8261
|
+
...styles,
|
|
8262
|
+
level: {
|
|
8263
|
+
enumerable: true,
|
|
8264
|
+
get() {
|
|
8265
|
+
return this._generator.level;
|
|
8266
|
+
},
|
|
8267
|
+
set(level) {
|
|
8268
|
+
this._generator.level = level;
|
|
8269
|
+
}
|
|
8270
|
+
}
|
|
8271
|
+
});
|
|
8272
|
+
const createStyler = (open, close, parent) => {
|
|
8273
|
+
let openAll;
|
|
8274
|
+
let closeAll;
|
|
8275
|
+
if (parent === void 0) {
|
|
8276
|
+
openAll = open;
|
|
8277
|
+
closeAll = close;
|
|
8278
|
+
} else {
|
|
8279
|
+
openAll = parent.openAll + open;
|
|
8280
|
+
closeAll = close + parent.closeAll;
|
|
8281
|
+
}
|
|
8282
|
+
return {
|
|
8283
|
+
open,
|
|
8284
|
+
close,
|
|
8285
|
+
openAll,
|
|
8286
|
+
closeAll,
|
|
8287
|
+
parent
|
|
8288
|
+
};
|
|
8289
|
+
};
|
|
8290
|
+
const createBuilder = (self2, _styler, _isEmpty) => {
|
|
8291
|
+
const builder = (...arguments_) => {
|
|
8292
|
+
if (isArray(arguments_[0]) && isArray(arguments_[0].raw)) {
|
|
8293
|
+
return applyStyle(builder, chalkTag(builder, ...arguments_));
|
|
8294
|
+
}
|
|
8295
|
+
return applyStyle(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
|
|
8296
|
+
};
|
|
8297
|
+
Object.setPrototypeOf(builder, proto);
|
|
8298
|
+
builder._generator = self2;
|
|
8299
|
+
builder._styler = _styler;
|
|
8300
|
+
builder._isEmpty = _isEmpty;
|
|
8301
|
+
return builder;
|
|
8302
|
+
};
|
|
8303
|
+
const applyStyle = (self2, string) => {
|
|
8304
|
+
if (self2.level <= 0 || !string) {
|
|
8305
|
+
return self2._isEmpty ? "" : string;
|
|
8306
|
+
}
|
|
8307
|
+
let styler = self2._styler;
|
|
8308
|
+
if (styler === void 0) {
|
|
8309
|
+
return string;
|
|
8310
|
+
}
|
|
8311
|
+
const { openAll, closeAll } = styler;
|
|
8312
|
+
if (string.indexOf("\x1B") !== -1) {
|
|
8313
|
+
while (styler !== void 0) {
|
|
8314
|
+
string = stringReplaceAll(string, styler.close, styler.open);
|
|
8315
|
+
styler = styler.parent;
|
|
8316
|
+
}
|
|
8317
|
+
}
|
|
8318
|
+
const lfIndex = string.indexOf("\n");
|
|
8319
|
+
if (lfIndex !== -1) {
|
|
8320
|
+
string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
|
|
8321
|
+
}
|
|
8322
|
+
return openAll + string + closeAll;
|
|
8323
|
+
};
|
|
8324
|
+
let template;
|
|
8325
|
+
const chalkTag = (chalk2, ...strings) => {
|
|
8326
|
+
const [firstString] = strings;
|
|
8327
|
+
if (!isArray(firstString) || !isArray(firstString.raw)) {
|
|
8328
|
+
return strings.join(" ");
|
|
8329
|
+
}
|
|
8330
|
+
const arguments_ = strings.slice(1);
|
|
8331
|
+
const parts = [firstString.raw[0]];
|
|
8332
|
+
for (let i = 1; i < firstString.length; i++) {
|
|
8333
|
+
parts.push(
|
|
8334
|
+
String(arguments_[i - 1]).replace(/[{}\\]/g, "\\$&"),
|
|
8335
|
+
String(firstString.raw[i])
|
|
8336
|
+
);
|
|
8337
|
+
}
|
|
8338
|
+
if (template === void 0) {
|
|
8339
|
+
template = requireTemplates();
|
|
8340
|
+
}
|
|
8341
|
+
return template(chalk2, parts.join(""));
|
|
8342
|
+
};
|
|
8343
|
+
Object.defineProperties(Chalk.prototype, styles);
|
|
8344
|
+
const chalk = Chalk();
|
|
8345
|
+
chalk.supportsColor = stdoutColor;
|
|
8346
|
+
chalk.stderr = Chalk({ level: stderrColor ? stderrColor.level : 0 });
|
|
8347
|
+
chalk.stderr.supportsColor = stderrColor;
|
|
8348
|
+
var source = chalk;
|
|
8349
|
+
const chalk$1 = /* @__PURE__ */ getDefaultExportFromCjs(source);
|
|
8350
|
+
const { accessSync, constants, readFileSync } = fs;
|
|
8351
|
+
let envOptions = null;
|
|
8352
|
+
function SetupConfig(envOptions2, logger) {
|
|
8353
|
+
const envfile = process.env.STSENVFILE === void 0 ? "/.env" : process.env.STSENVFILE;
|
|
8354
|
+
config_1({ path: envfile });
|
|
8355
|
+
const defconfig = {
|
|
8356
|
+
// Node runtime environment
|
|
8357
|
+
isProduction: process.env.NODE_ENV === void 0 ? false : process.env.NODE_ENV === "production" ? true : false,
|
|
8358
|
+
isTest: process.env.NODE_ENV === void 0 ? false : process.env.NODE_ENV === "test" ? true : false,
|
|
8359
|
+
consoleLogErrors: process.env.CONSOLE_LOG_ERRORS === void 0 ? false : process.env.CONSOLE_LOG_ERRORS === "true" ? true : false,
|
|
8360
|
+
dbuser: process.env.DB_USER === void 0 ? "postgres" : process.env.DB_USER,
|
|
8361
|
+
dbpassword: process.env.DB_PASSWORD === void 0 ? "postgres" : process.env.DB_PASSWORD,
|
|
8362
|
+
dbpasswordfile: process.env.DB_PASSWORD_FILE,
|
|
8363
|
+
dbhost: process.env.DB_HOST === void 0 ? "localhost:5432" : process.env.DB_HOST,
|
|
8364
|
+
database: process.env.DB_DATABASE === void 0 ? "stsrestmsdb01" : process.env.DB_DATABASE,
|
|
8365
|
+
databaseUrl: process.env.DATABASE_URL,
|
|
8366
|
+
databasescriptfolder: process.env.DB_SCRIPT_FOLDER === void 0 ? "/var/lib/sts/stsglobalresources/db-scripts" : process.env.DB_SCRIPT_FOLDER,
|
|
8367
|
+
connectionString: "",
|
|
8368
|
+
defaultDatabaseConnectionString: "",
|
|
8369
|
+
logToFile: process.env.LOG_TO_FILE === void 0 ? false : process.env.LOG_TO_FILE === "true" ? true : false,
|
|
8370
|
+
logFilePath: process.env.LOG_FILE_PATH === void 0 ? "/var/lib/sts" : process.env.LOG_FILE_PATH,
|
|
8371
|
+
logFileFormat: process.env.LOG_FILE_FORMAT === void 0 ? "csv" : process.env.LOG_FILE_FORMAT,
|
|
8372
|
+
poolSize: process.env.POOL_SIZE === void 0 ? 500 : parseInt(process.env.POOL_SIZE),
|
|
8373
|
+
useCPUs: process.env.MAX_CPU === void 0 ? -1 : parseFloat(process.env.MAX_CPU),
|
|
8374
|
+
respawnOnFail: process.env.RESPAWN === void 0 ? false : process.env.RESPAWN === "true" ? true : false,
|
|
8375
|
+
defaultDatabaseEntries: process.env.DEFAULT_DB_ENTRIES === void 0 ? 1e4 : parseInt(process.env.DEFAULT_DB_ENTRIES),
|
|
8376
|
+
useRedis: process.env.USE_REDIS === void 0 ? false : process.env.USE_REDIS === "true" ? true : false,
|
|
8377
|
+
useL1Redis: process.env.USE_L1_REDIS === void 0 ? false : process.env.USE_L1_REDIS === "true" ? true : false,
|
|
8378
|
+
useRedisAdaptor: process.env.USE_REDIS_ADAPTOR === void 0 ? false : process.env.USE_REDIS_ADAPTOR === "true" ? true : false,
|
|
8379
|
+
redisAdaptorUrl: process.env.REDIS_ADAPTOR_URL === void 0 ? "redis://localhost:6379" : process.env.REDIS_ADAPTOR_URL,
|
|
8380
|
+
useRedisInstrumentationTransport: process.env.USE_REDIS_INSTRUMENTATION_TRANSPORT === void 0 ? false : process.env.USE_REDIS_INSTRUMENTATION_TRANSPORT === "true" ? true : false,
|
|
8381
|
+
redisInstrumentationTransportUrl: process.env.REDIS_INSTRUMENTATION_TRANSPORT_URL === void 0 ? "redis://localhost:6379" : process.env.REDIS_INSTRUMENTATION_TRANSPORT_URL,
|
|
8382
|
+
endFlush: process.env.REDIS_END_FLUSH === void 0 ? false : process.env.REDIS_END_FLUSH === "true" ? true : false,
|
|
8383
|
+
redisPort: process.env.REDIS_PORT === void 0 ? "6379" : process.env.REDIS_PORT,
|
|
8384
|
+
redisServer: process.env.REDIS_SERVER === void 0 ? "localhost" : process.env.REDIS_SERVER,
|
|
8385
|
+
k6ScriptPath: process.env.K6SCRIPTPATH === void 0 ? "." : process.env.K6SCRIPTPATH,
|
|
8386
|
+
defaultDatabaseMinExtraDataSize: process.env.DEFAULT_DATABASE_MIN_EXTRA_DATA_SIZE === void 0 ? 0 : parseInt(process.env.DEFAULT_DATABASE_MIN_EXTRA_DATA_SIZE),
|
|
8387
|
+
defaultDatabaseMaxExtraDataSize: process.env.DEFAULT_DATABASE_MAX_EXTRA_DATA_SIZE === void 0 ? 2e3 : parseInt(process.env.DEFAULT_DATABASE_MAX_EXTRA_DATA_SIZE),
|
|
8388
|
+
rest01endpoint: process.env.REST01_ENDPOINT === void 0 ? "https://localhost" : process.env.REST01_ENDPOINT,
|
|
8389
|
+
rest01hostport: process.env.REST01_HOST_PORT === void 0 ? "3003" : process.env.REST01_HOST_PORT,
|
|
8390
|
+
rest01port: process.env.REST01_PORT === void 0 ? "3003" : process.env.REST01_PORT,
|
|
8391
|
+
rest01apiroot: process.env.REST01_APIROOT === void 0 ? "/stsrest01/v1" : process.env.REST01_APIROOT,
|
|
8392
|
+
rest01apiidentifier: process.env.REST01_API_IDENTIFIER,
|
|
8393
|
+
rest01apiidentifierfile: process.env.REST01_API_IDENTIFIER_FILE,
|
|
8394
|
+
rest01prometheussupport: process.env.REST01_PROM_SUPPORT === void 0 ? true : process.env.REST01_PROM_SUPPORT === "true" ? true : false,
|
|
8395
|
+
rest01prometheusclusterport: process.env.REST01_PROM_CLUSTER_PORT === void 0 ? "3013" : process.env.REST01_PROM_CLUSTER_PORT,
|
|
8396
|
+
rest01servicename: process.env.REST01_SERVICE_NAME === void 0 ? "STSRest01" : process.env.REST01_SERVICE_NAME,
|
|
8397
|
+
rest01serviceversion: process.env.REST01_SERVICE_VERSION === void 0 ? "1.0.0" : process.env.REST01_SERVICE_VERSION,
|
|
8398
|
+
rest01clientid: process.env.REST01_CLIENT_ID,
|
|
8399
|
+
rest01clientidfile: process.env.REST01_CLIENT_ID_FILE,
|
|
8400
|
+
rest01clientsecret: process.env.REST01_CLIENT_SECRET,
|
|
8401
|
+
rest01clientsecretfile: process.env.REST01_CLIENT_SECRET_FILE,
|
|
8402
|
+
imendpoint: process.env.IM_ENDPOINT === void 0 ? "https://localhost" : process.env.IM_ENDPOINT,
|
|
8403
|
+
imhostport: process.env.IM_HOST_PORT === void 0 ? "3001" : process.env.IM_HOST_PORT,
|
|
8404
|
+
import: process.env.IM_PORT === void 0 ? "3001" : process.env.IM_PORT,
|
|
8405
|
+
imapiroot: process.env.IM_APIROOT === void 0 ? "/stsinstrumentmanager/v1" : process.env.IM_APIROOT,
|
|
8406
|
+
imapiidentifier: process.env.IM_API_IDENTIFIER,
|
|
8407
|
+
imapiidentifierfile: process.env.IM_API_IDENTIFIER_FILE,
|
|
8408
|
+
imprometheussupport: process.env.IM_PROM_SUPPORT === void 0 ? true : process.env.IM_PROM_SUPPORT === "true" ? true : false,
|
|
8409
|
+
imprometheusclusterport: process.env.IM_PROM_CLUSTER_PORT === void 0 ? "3011" : process.env.IM_PROM_CLUSTER_PORT,
|
|
8410
|
+
imservicename: process.env.IM_SERVICE_NAME === void 0 ? "STSInstrumentManager" : process.env.IM_SERVICE_NAME,
|
|
8411
|
+
imserviceversion: process.env.IM_SERVICE_VERSION === void 0 ? "1.0.0" : process.env.IM_SERVICE_VERSION,
|
|
8412
|
+
imclientid: process.env.IM_CLIENT_ID,
|
|
8413
|
+
imclientidfile: process.env.IM_CLIENT_ID_FILE,
|
|
8414
|
+
imclientsecret: process.env.IM_CLIENT_SECRET,
|
|
8415
|
+
imclientsecretfile: process.env.IM_CLIENT_SECRET_FILE,
|
|
8416
|
+
toendpoint: process.env.TO_ENDPOINT === void 0 ? "https://localhost" : process.env.TO_ENDPOINT,
|
|
8417
|
+
tohostport: process.env.TO_HOST_PORT === void 0 ? "3004" : process.env.TO_HOST_PORT,
|
|
8418
|
+
toport: process.env.TO_PORT === void 0 ? "3004" : process.env.TO_PORT,
|
|
8419
|
+
toapiroot: process.env.TO_APIROOT === void 0 ? "/ststestorchestrator/v1" : process.env.TO_APIROOT,
|
|
8420
|
+
toapiidentifier: process.env.TO_API_IDENTIFIER,
|
|
8421
|
+
toapiidentifierfile: process.env.TO_API_IDENTIFIER_FILE,
|
|
8422
|
+
toprometheussupport: process.env.TO_PROM_SUPPORT === void 0 ? true : process.env.TO_PROM_SUPPORT === "true" ? true : false,
|
|
8423
|
+
toprometheusclusterport: process.env.TO_PROM_CLUSTER_PORT === void 0 ? "3014" : process.env.TO_PROM_CLUSTER_PORT,
|
|
8424
|
+
toservicename: process.env.TO_SERVICE_NAME === void 0 ? "STSTestOrchestrator" : process.env.TO_SERVICE_NAME,
|
|
8425
|
+
toserviceversion: process.env.TO_SERVICE_VERSION === void 0 ? "1.0.0" : process.env.TO_SERVICE_VERSION,
|
|
8426
|
+
toclientid: process.env.TO_CLIENT_ID,
|
|
8427
|
+
toclientidfile: process.env.TO_CLIENT_ID_FILE,
|
|
8428
|
+
toclientsecret: process.env.TO_CLIENT_SECRET,
|
|
8429
|
+
toclientsecretfile: process.env.TO_CLIENT_SECRET_FILE,
|
|
8430
|
+
asendpoint: process.env.AS_ENDPOINT === void 0 ? "https://localhost" : process.env.AS_ENDPOINT,
|
|
8431
|
+
ashostport: process.env.AS_HOST_PORT === void 0 ? "3002" : process.env.AS_HOST_PORT,
|
|
8432
|
+
asport: process.env.AS_PORT === void 0 ? "3002" : process.env.AS_PORT,
|
|
8433
|
+
asapiroot: process.env.AS_API_ROOT === void 0 ? "/stsauth/v1.0" : process.env.AS_API_ROOT,
|
|
8434
|
+
asoauthapiroot: process.env.AS_OAUTH_API_ROOT === void 0 ? "/oauth2/v2.0" : process.env.AS_OAUTH_API_ROOT,
|
|
8435
|
+
asadminapiroot: process.env.AS_ADMIN_API_ROOT === void 0 ? "/admin/v1.0" : process.env.AS_ADMIN_API_ROOT,
|
|
8436
|
+
asapiidentifier: process.env.AS_API_IDENTIFIER === void 0 ? "https://stsmda.com.au/stsauthapi/v1.0/" : process.env.AS_API_IDENTIFIER,
|
|
8437
|
+
asapiidentifierfile: process.env.AS_API_IDENTIFIER_FILE,
|
|
8438
|
+
asoauthapiidentifier: process.env.AS_OAUTH_API_IDENTIFIER === void 0 ? "https://stsmda.com.au/stsauthoauthapi/v2.0/" : process.env.AS_OAUTH_API_IDENTIFIER,
|
|
8439
|
+
asoauthapiidentifierfile: process.env.AS_OAUTH_API_IDENTIFIER_FILE,
|
|
8440
|
+
asadminapiidentifier: process.env.AS_ADMIN_API_IDENTIFIER === void 0 ? "https://stsmda.com.au/stsauthadminapi/v1.0/" : process.env.AS_ADMIN_API_IDENTIFIER,
|
|
8441
|
+
asadminapiidentifierfile: process.env.AS_ADMIN_API_IDENTIFIER_FILE,
|
|
8442
|
+
asprometheussupport: process.env.AS_PROM_SUPPORT === void 0 ? true : process.env.AS_PROM_SUPPORT === "true" ? true : false,
|
|
8443
|
+
asprometheusclusterport: process.env.AS_PROM_CLUSTER_PORT === void 0 ? "3012" : process.env.AS_PROM_CLUSTER_PORT,
|
|
8444
|
+
asservicename: process.env.AS_SERVICE_NAME === void 0 ? "STSAuth" : process.env.AS_SERVICE_NAME,
|
|
8445
|
+
asserviceversion: process.env.AS_SERVICE_VERSION === void 0 ? "1.0.0" : process.env.AS_SERVICE_VERSION,
|
|
8446
|
+
asclientid: process.env.AS_CLIENT_ID,
|
|
8447
|
+
asclientidfile: process.env.AS_CLIENT_ID_FILE,
|
|
8448
|
+
asclientsecret: process.env.AS_CLIENT_SECRET,
|
|
8449
|
+
asclientsecretfile: process.env.AS_CLIENT_SECRET_FILE,
|
|
8450
|
+
asjwksjsonpath: process.env.AS_JWKS_JSON_PATH === void 0 ? "/.well-known/jwks.json" : process.env.AS_JWKS_JSON_PATH,
|
|
8451
|
+
asjwkskeyrotationtime: process.env.AS_JWKS_KEY_ROTATION_TIME === void 0 ? 86400 : parseInt(process.env.AS_JWKS_KEY_ROTATION_TIME),
|
|
8452
|
+
asjwkskeypurgetimeoffset: process.env.AS_JWKS_KEY_PURGE_TIME_OFFSET === void 0 ? 300 : parseInt(process.env.AS_JWKS_KEY_PURGE_TIME_OFFSET),
|
|
8453
|
+
asjwkskeycount: process.env.AS_JWKS_KEY_COUNT === void 0 ? 4 : parseInt(process.env.AS_JWKS_KEY_COUNT),
|
|
8454
|
+
asaccesstokenexpire: process.env.AS_ACCESS_TOKEN_EXPIRE === void 0 ? 43200 : parseInt(process.env.AS_ACCESS_TOKEN_EXPIRE),
|
|
8455
|
+
authorizeendpoint: process.env.AUTHORIZE_ENDPOINT === void 0 ? "https://localhost" : process.env.AUTHORIZE_ENDPOINT,
|
|
8456
|
+
authorizeport: process.env.AUTHORIZE_PORT === void 0 ? "3010" : process.env.AUTHORIZE_PORT,
|
|
8457
|
+
authorizeapiroot: process.env.AUTHORIZE_API_ROOT === void 0 ? "/stsa" : process.env.AUTHORIZE_API_ROOT,
|
|
8458
|
+
authorizeapi: process.env.AUTHORIZE_API === void 0 ? "/authorize" : process.env.AUTHORIZE_API,
|
|
8459
|
+
brokerendpoint: process.env.BROKER_ENDPOINT === void 0 ? "https://localhost" : process.env.BROKER_ENDPOINT,
|
|
8460
|
+
brokerhostport: process.env.BROKER_HOST_PORT === void 0 ? "3006" : process.env.BROKER_HOST_PORT,
|
|
8461
|
+
brokerport: process.env.BROKER_PORT === void 0 ? "3006" : process.env.BROKER_PORT,
|
|
8462
|
+
brokerapiroot: process.env.BROKER_APIROOT === void 0 ? "/stsbroker/v1.0" : process.env.BROKER_APIROOT,
|
|
8463
|
+
brokerapiidentifier: process.env.BROKER_API_IDENTIFIER,
|
|
8464
|
+
brokerapiidentifierfile: process.env.BROKER_API_IDENTIFIER_FILE,
|
|
8465
|
+
brokerprometheussupport: process.env.BROKER_PROM_SUPPORT === void 0 ? true : process.env.BROKER_PROM_SUPPORT === "true" ? true : false,
|
|
8466
|
+
brokerprometheusclusterport: process.env.BROKER_PROM_CLUSTER_PORT === void 0 ? "3016" : process.env.BROKER_PROM_CLUSTER_PORT,
|
|
8467
|
+
brokerservicename: process.env.BROKER_SERVICE_NAME === void 0 ? "STSBroker" : process.env.BROKER_SERVICE_NAME,
|
|
8468
|
+
brokerserviceversion: process.env.BROKER_SERVICE_VERSION === void 0 ? "1.0.0" : process.env.BROKER_SERVICE_VERSION,
|
|
8469
|
+
brokerclientid: process.env.BROKER_CLIENT_ID,
|
|
8470
|
+
brokerclientidfile: process.env.BROKER_CLIENT_ID_FILE,
|
|
8471
|
+
brokerclientsecret: process.env.BROKER_CLIENT_SECRET,
|
|
8472
|
+
brokerclientsecretfile: process.env.BROKER_CLIENT_SECRET_FILE,
|
|
8473
|
+
trnendpoint: process.env.TRN_ENDPOINT === void 0 ? "https://localhost" : process.env.TRN_ENDPOINT,
|
|
8474
|
+
trnhostport: process.env.TRN_HOST_PORT === void 0 ? "3007" : process.env.TRN_HOST_PORT,
|
|
8475
|
+
trnport: process.env.TRN_PORT === void 0 ? "3007" : process.env.TRN_PORT,
|
|
8476
|
+
trnapiroot: process.env.TRN_APIROOT === void 0 ? "/ststrn/v1.0" : process.env.TRN_APIROOT,
|
|
8477
|
+
trnapiidentifier: process.env.TRN_API_IDENTIFIER,
|
|
8478
|
+
trnapiidentifierfile: process.env.TRN_API_IDENTIFIER_FILE,
|
|
8479
|
+
trnprometheussupport: process.env.TRN_PROM_SUPPORT === void 0 ? true : process.env.TRN_PROM_SUPPORT === "true" ? true : false,
|
|
8480
|
+
trnprometheusclusterport: process.env.TRN_PROM_CLUSTER_PORT === void 0 ? "3017" : process.env.TRN_PROM_CLUSTER_PORT,
|
|
8481
|
+
trnservicename: process.env.TRN_SERVICE_NAME === void 0 ? "STSTestRunnerNode" : process.env.TRN_SERVICE_NAME,
|
|
8482
|
+
trnserviceversion: process.env.TRN_SERVICE_VERSION === void 0 ? "1.0.0" : process.env.TRN_SERVICE_VERSION,
|
|
8483
|
+
trnclientid: process.env.TRN_CLIENT_ID,
|
|
8484
|
+
trnclientidfile: process.env.TRN_CLIENT_ID_FILE,
|
|
8485
|
+
trnclientsecret: process.env.TRN_CLIENT_SECRET,
|
|
8486
|
+
trnclientsecretfile: process.env.TRN_CLIENT_SECRET_FILE,
|
|
8487
|
+
trncallbackuri: process.env.TRN_CALLBACK_URI === void 0 ? "https://localhost:3007/ststrn/v1.0/" : process.env.TRN_CALLBACK_URI,
|
|
8488
|
+
trnautostartdelay: process.env.TRN_AUTO_START_DELAY === void 0 ? 0 : parseInt(process.env.TRN_AUTO_START_DELAY),
|
|
8489
|
+
trnautostartconfig: process.env.TRN_AUTO_START_CONFIG === void 0 ? "" : process.env.TRN_AUTO_START_CONFIG,
|
|
8490
|
+
trprometheussupport: process.env.TR_PROM_SUPPORT === void 0 ? true : process.env.TR_PROM_SUPPORT === "true" ? true : false,
|
|
8491
|
+
trprometheusclusterport: process.env.TR_PROM_CLUSTER_PORT === void 0 ? "3015" : process.env.TR_PROM_CLUSTER_PORT,
|
|
8492
|
+
trservicename: process.env.TR_SERVICE_NAME === void 0 ? "STSRestRunner" : process.env.TR_SERVICE_NAME,
|
|
8493
|
+
trserviceversion: process.env.TR_SERVICE_VERSION === void 0 ? "1.0.0" : process.env.TR_SERVICE_VERSION,
|
|
8494
|
+
trclientid: process.env.TR_CLIENT_ID,
|
|
8495
|
+
trclientidfile: process.env.TR_CLIENT_ID_FILE,
|
|
8496
|
+
trclientsecret: process.env.TR_CLIENT_SECRET,
|
|
8497
|
+
trclientsecretfile: process.env.TR_CLIENT_SECRET_FILE,
|
|
8498
|
+
lambdaendpoint: process.env.LAMBDA_ENDPOINT === void 0 ? "https://localhost" : process.env.LAMBDA_ENDPOINT,
|
|
8499
|
+
lambdahostport: process.env.LAMBDA_HOST_PORT === void 0 ? "3009" : process.env.LAMBDA_HOST_PORT,
|
|
8500
|
+
lambdaport: process.env.LAMBDA_PORT === void 0 ? "3009" : process.env.LAMBDA_PORT,
|
|
8501
|
+
lambdaapiroot: process.env.LAMBDA_APIROOT === void 0 ? "/stslambda/v1.0" : process.env.LAMBDA_APIROOT,
|
|
8502
|
+
lambdaapiidentifier: process.env.LAMBDA_API_IDENTIFIER,
|
|
8503
|
+
lambdaapiidentifierfile: process.env.LAMBDA_API_IDENTIFIER_FILE,
|
|
8504
|
+
lambdaprometheussupport: process.env.LAMBDA_PROM_SUPPORT === void 0 ? true : process.env.LAMBDA_PROM_SUPPORT === "true" ? true : false,
|
|
8505
|
+
lambdaprometheusclusterport: process.env.LAMBDA_PROM_CLUSTER_PORT === void 0 ? "3019" : process.env.LAMBDA_PROM_CLUSTER_PORT,
|
|
8506
|
+
lambdaservicename: process.env.LAMBDA_SERVICE_NAME === void 0 ? "STSLambda" : process.env.LAMBDA_SERVICE_NAME,
|
|
8507
|
+
lambdaserviceversion: process.env.LAMBDA_SERVICE_VERSION === void 0 ? "1.0.0" : process.env.LAMBDA_SERVICE_VERSION,
|
|
8508
|
+
lambdaclientid: process.env.LAMBDA_CLIENT_ID,
|
|
8509
|
+
lambdaclientidfile: process.env.LAMBDA_CLIENT_ID_FILE,
|
|
8510
|
+
lambdaclientsecret: process.env.LAMBDA_CLIENT_SECRET,
|
|
8511
|
+
lambdaclientsecretfile: process.env.LAMBDA_CLIENT_SECRET_FILE,
|
|
8512
|
+
publishinterval: process.env.PUBLISH_INTERVAL === void 0 ? 1e3 : parseInt(process.env.PUBLISH_INTERVAL),
|
|
8513
|
+
publishtimeout: process.env.PUBLISH_TIMEOUT === void 0 ? 750 : parseInt(process.env.PUBLISH_TIMEOUT),
|
|
8514
|
+
publishdebug: process.env.PUBLISH_DEBUG === void 0 ? false : process.env.PUBLISH_DEBUG === "true" ? true : false,
|
|
8515
|
+
transport: process.env.TRANSPORT === void 0 ? "RESTAPI" : process.env.TRANSPORT,
|
|
8516
|
+
useSecureCookies: process.env.USE_SECURE_COOKIES === void 0 ? false : process.env.USE_SECURE_COOKIES === "true" ? true : false,
|
|
8517
|
+
keepAlive: process.env.KEEP_ALIVE === void 0 ? true : process.env.KEEP_ALIVE === "true" ? true : false,
|
|
8518
|
+
maxSockets: process.env.MAX_SOCKETS === void 0 ? 10 : parseInt(process.env.MAX_SOCKETS),
|
|
8519
|
+
maxTotalSockets: process.env.MAX_TOTAL_SOCKETS === void 0 ? 20 : parseInt(process.env.MAX_TOTAL_SOCKETS),
|
|
8520
|
+
maxFreeSockets: process.env.MAX_FREE_SOCKETS === void 0 ? 256 : parseInt(process.env.MAX_FREE_SOCKETS),
|
|
8521
|
+
timeout: process.env.TIMEOUT === void 0 ? 1e4 : parseInt(process.env.TIMEOUT),
|
|
8522
|
+
maxPayloadSize: process.env.MAX_PAYLOAD_SIZE === void 0 ? "50mb" : process.env.MAX_PAYLOAD_SIZE,
|
|
8523
|
+
instrumentationObservationInterval: process.env.INSTRUMENTATION_OBSERVATION_INTERVAL === void 0 ? 1e3 : parseInt(process.env.INSTRUMENTATION_OBSERVATION_INTERVAL),
|
|
8524
|
+
instrumentationTimeWindow: process.env.INSTRUMENTATION_TIME_WINDOW === void 0 ? 600 : parseInt(process.env.INSTRUMENTATION_TIME_WINDOW),
|
|
8525
|
+
authJWTAccessTokenTimeout: process.env.AUTH_JWT_ACCESS_TOKEN_TIMEOUT === void 0 ? 600 : parseInt(process.env.AUTH_JWT_ACCESS_TOKEN_TIMEOUT),
|
|
8526
|
+
authJWTRefreshTokenTimeout: process.env.AUTH_JWT_REFRESH_TOKEN_TIMEOUT === void 0 ? 3600 * 24 : parseInt(process.env.AUTH_JWT_REFRESH_TOKEN_TIMEOUT),
|
|
8527
|
+
authCookieTimeout: process.env.AUTH_COOKIE_TIMEOUT === void 0 ? 3600 * 24 : parseInt(process.env.AUTH_COOKIE_TIMEOUT),
|
|
8528
|
+
masterProcessExitTime: process.env.MASTER_PROCESS_EXIT_TIME === void 0 ? 500 : parseInt(process.env.MASTER_PROCESS_EXIT_TIME),
|
|
8529
|
+
childProcessExitTime: process.env.CHILD_PROCESS_EXIT_TIME === void 0 ? 500 : parseInt(process.env.CHILD_PROCESS_EXIT_TIME),
|
|
8530
|
+
systemInformationInterval: process.env.SYSTEM_INFORMATION_INTERVAL === void 0 ? 1e3 : parseInt(process.env.SYSTEM_INFORMATION_INTERVAL),
|
|
8531
|
+
ignoresocketio: process.env.IGNORE_SOCKETIO === void 0 ? true : process.env.IGNORE_SOCKETIO === "true" ? true : false,
|
|
8532
|
+
httpsserverkeypath: process.env.HTTPS_SERVER_KEY_PATH === void 0 ? "/var/lib/sts/stsglobalresources/keys/server.key" : process.env.HTTPS_SERVER_KEY_PATH,
|
|
8533
|
+
httpsservercertpath: process.env.HTTPS_SERVER_CERT_PATH === void 0 ? "/var/lib/sts/stsglobalresources/keys/server.cert" : process.env.HTTPS_SERVER_CERT_PATH,
|
|
8534
|
+
tsjwkskeys: process.env.TS_JWKS_KEYS === void 0 ? 3 : parseInt(process.env.TS_JWKS_KEYS),
|
|
8535
|
+
tsjwksstorepath: process.env.TS_JWKS_STORE_PATH === void 0 ? "/var/lib/sts/stsglobalresources/.stsauthprivate/jwks-private.json" : process.env.TS_JWKS_STORE_PATH,
|
|
8536
|
+
tsjwksstorepathfile: process.env.TS_JWKS_STORE_PATH_FILE,
|
|
8537
|
+
tsjwksstorepublicpath: process.env.TS_JWKS_STORE_PUBLIC_PATH === void 0 ? "/var/lib/sts/stsglobalresources/.well-known/jwks.json" : process.env.TS_JWKS_STORE_PUBLIC_PATH,
|
|
8538
|
+
jwksAuthConfigCache: process.env.JWKS_AUTH_CONFIG_CACHE === void 0 ? true : process.env.JWKS_AUTH_CONFIG_CACHE === "true" ? true : false,
|
|
8539
|
+
jwksAuthConfigCacheMaxEntries: process.env.JWKS_AUTH_CONFIG_CACHE_MAX_ENTRIES === void 0 ? 5 : parseInt(process.env.JWKS_AUTH_CONFIG_CACHE_MAX_ENTRIES),
|
|
8540
|
+
jwksAuthConfigCacheMaxAge: process.env.JWKS_AUTH_CONFIG_CACHE_MAX_AGE === void 0 ? 6e5 : parseInt(process.env.JWKS_AUTH_CONFIG_CACHE_MAX_AGE),
|
|
8541
|
+
jwksAuthConfigRateLimit: process.env.JWKS_AUTH_CONFIG_RATE_LIMIT === void 0 ? true : process.env.JWKS_AUTH_CONFIG_RATE_LIMIT === "true" ? true : false,
|
|
8542
|
+
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),
|
|
8543
|
+
jwksAuthConfigTimeout: process.env.JWKS_AUTH_CONFIG_TIMEOUT === void 0 ? 3e4 : parseInt(process.env.JWKS_AUTH_CONFIG_TIMEOUT),
|
|
8544
|
+
influxDB_APIToken: process.env.INFLUXDB_API_TOKEN === void 0 ? "password" : process.env.INFLUXDB_API_TOKEN,
|
|
8545
|
+
influxDB_APITokenFile: process.env.INFLUXDB_API_TOKEN_FILE,
|
|
8546
|
+
influxDB_Url: process.env.INFLUXDB_URL === void 0 ? "http://localhost:8086" : process.env.INFLUXDB_URL,
|
|
8547
|
+
influxDB_Org: process.env.INFLUXDB_ORG === void 0 ? "my-org" : process.env.INFLUXDB_ORG,
|
|
8548
|
+
influxDB_Bucket: process.env.INFLUXDB_BUCKET === void 0 ? "TestBucket01" : process.env.INFLUXDB_BUCKET,
|
|
8549
|
+
influxDB_keepAlive: process.env.INFLUXDB_KEEP_ALIVE === void 0 ? true : process.env.INFLUXDB_KEEP_ALIVE === "true" ? true : false,
|
|
8550
|
+
influxDB_maxSockets: process.env.INFLUXDB_MAX_SOCKETS === void 0 ? 10 : parseInt(process.env.INFLUXDB_MAX_SOCKETS),
|
|
8551
|
+
influxDB_maxTotalSockets: process.env.INFLUXDB_MAX_TOTAL_SOCKETS === void 0 ? 20 : parseInt(process.env.INFLUXDB_MAX_TOTAL_SOCKETS),
|
|
8552
|
+
influxDB_maxFreeSockets: process.env.INFLUXDB_MAX_FREE_SOCKETS === void 0 ? 256 : parseInt(process.env.INFLUXDB_MAX_FREE_SOCKETS),
|
|
8553
|
+
influxDB_timeout: process.env.INFLUXDB_TIMEOUT === void 0 ? 1e4 : parseInt(process.env.INFLUXDB_TIMEOUT),
|
|
8554
|
+
influxDB_rejectUnauthorized: process.env.INFLUXDB_REJECT_UNAUTHORIZED === void 0 ? true : process.env.INFLUXDB_REJECT_UNAUTHORIZED === "true" ? true : false,
|
|
8555
|
+
influxDB_writeDataPointFlushTimeout: process.env.INFLUXDB_WRITE_DATA_POINT_FLUSH_TIMEOUT === void 0 ? 1e3 : parseInt(process.env.INFLUXDB_WRITE_DATA_POINT_FLUSH_TIMEOUT),
|
|
8556
|
+
kafka_clientId: process.env.KAFKA_CLIENT_ID === void 0 ? "myclient" : process.env.KAFKA_CLIENT_ID,
|
|
8557
|
+
kafka_brokers: process.env.KAFKA_BROKERS === void 0 ? "localhost:9092" : process.env.KAFKA_BROKERS,
|
|
8558
|
+
kafka_admin_timeout: process.env.KAFKA_ADMIN_TIMEOUT === void 0 ? 5e3 : parseInt(process.env.KAFKA_ADMIN_TIMEOUT),
|
|
8559
|
+
kafka_connection_timeout: process.env.KAFKA_CONNECTION_TIMEOUT === void 0 ? 5e3 : parseInt(process.env.KAFKA_CONNECTION_TIMEOUT),
|
|
8560
|
+
kafka_request_timeout: process.env.KAFKA_REQUEST_TIMEOUT === void 0 ? 5e3 : parseInt(process.env.KAFKA_REQUEST_TIMEOUT),
|
|
8561
|
+
kafka_log_level: process.env.KAFKA_LOG_LEVEL === void 0 ? "nothing" : process.env.KAFKA_LOG_LEVEL,
|
|
8562
|
+
kafka_keep_alive: process.env.KAFKA_KEEP_ALIVE === void 0 ? 3e4 : parseInt(process.env.KAFKA_KEEP_ALIVE),
|
|
8563
|
+
kafka_use_ssl: process.env.KAFKA_USE_SSL === void 0 ? false : process.env.KAFKA_USE_SSL === "true" ? true : false,
|
|
8564
|
+
kafka_ssl_rejectUnauthorized: process.env.KAFKA_SSL_REJECT_UNAUTHORIZED === void 0 ? true : process.env.KAFKA_SSL_REJECT_UNAUTHORIZED === "true" ? true : false,
|
|
8565
|
+
kafka_ssl_cafile: process.env.KAFKA_SSL_CAFILE === void 0 ? "/my/custom/ca.crt" : process.env.KAFKA_SSL_CAFILE,
|
|
8566
|
+
kafka_ssl_keyfile: process.env.KAFKA_SSL_KEYFILE === void 0 ? "/my/custom/client-key.pem" : process.env.KAFKA_SSL_KEYFILE,
|
|
8567
|
+
kafka_ssl_certfile: process.env.KAFKA_SSL_CERTFILE === void 0 ? "/my/custom/client-cert.pem" : process.env.KAFKA_SSL_CERTFILE,
|
|
8568
|
+
kafka_consume_from_beginning: process.env.KAFKA_CONSUME_FROM_BEGINNING === void 0 ? true : process.env.KAFKA_CONSUME_FROM_BEGINNING === "true" ? true : false,
|
|
8569
|
+
observabilityPublishMode: process.env.OBSERVABILITY_PUBLISH_MODE === void 0 ? "PROXY" : process.env.OBSERVABILITY_PUBLISH_MODE,
|
|
8570
|
+
stsUiTermObservabilityConsumptionMode: process.env.STSUITERM_OBSERVABILITY_CONSUMPTION_MODE === void 0 ? "PROXY" : process.env.STSUITERM_OBSERVABILITY_CONSUMPTION_MODE
|
|
8571
|
+
};
|
|
8572
|
+
const ReadFile = (passwordFile) => {
|
|
8573
|
+
try {
|
|
8574
|
+
accessSync(passwordFile, constants.R_OK);
|
|
8575
|
+
const data = readFileSync(passwordFile, "utf8");
|
|
8576
|
+
if (logger)
|
|
8577
|
+
logger.debug(chalk$1.green(`Successfully loaded password file: [${passwordFile}]`));
|
|
8578
|
+
return data;
|
|
8579
|
+
} catch (err) {
|
|
8580
|
+
if (logger)
|
|
8581
|
+
logger.debug(chalk$1.red(`Problem loading password file: [${passwordFile}], Error: [${err}]`));
|
|
8582
|
+
return "";
|
|
8583
|
+
}
|
|
8584
|
+
};
|
|
8585
|
+
const fileconfig = [
|
|
8586
|
+
{ fileprop: "dbpasswordfile", prop: "dbpassword" },
|
|
8587
|
+
// API identifier file processing
|
|
8588
|
+
{ fileprop: "asapiidentifierfile", prop: "asapiidentifier" },
|
|
8589
|
+
{ fileprop: "asoauthapiidentifierfile", prop: "asoauthapiidentifier" },
|
|
8590
|
+
{ fileprop: "asadminapiidentifierfile", prop: "asadminapiidentifier" },
|
|
8591
|
+
{ fileprop: "rest01apiidentifierfile", prop: "rest01apiidentifier" },
|
|
8592
|
+
{ fileprop: "brokerapiidentifierfile", prop: "brokerapiidentifier" },
|
|
8593
|
+
{ fileprop: "toapiidentifierfile", prop: "toapiidentifier" },
|
|
8594
|
+
{ fileprop: "imapiidentifierfile", prop: "imapiidentifier" },
|
|
8595
|
+
{ fileprop: "trnapiidentifierfile", prop: "trnapiidentifier" },
|
|
8596
|
+
{ fileprop: "lambdaapiidentifierfile", prop: "lambdaapiidentifier" },
|
|
8597
|
+
// Client ID file processing
|
|
8598
|
+
{ fileprop: "asclientidfile", prop: "asclientid" },
|
|
8599
|
+
{ fileprop: "rest01clientidfile", prop: "rest01clientid" },
|
|
8600
|
+
{ fileprop: "brokerclientidfile", prop: "brokerclientid" },
|
|
8601
|
+
{ fileprop: "toclientidfile", prop: "toclientid" },
|
|
8602
|
+
{ fileprop: "imclientidfile", prop: "imclientid" },
|
|
8603
|
+
{ fileprop: "trclientidfile", prop: "trclientid" },
|
|
8604
|
+
{ fileprop: "trnclientidfile", prop: "trnclientid" },
|
|
8605
|
+
{ fileprop: "lambdaclientidfile", prop: "lambdaclientid" },
|
|
8606
|
+
// Client secret file processing
|
|
8607
|
+
{ fileprop: "asclientsecretfile", prop: "asclientsecret" },
|
|
8608
|
+
{ fileprop: "rest01clientsecretfile", prop: "rest01clientsecret" },
|
|
8609
|
+
{ fileprop: "brokerclientsecretfile", prop: "brokerclientsecret" },
|
|
8610
|
+
{ fileprop: "toclientsecretfile", prop: "toclientsecret" },
|
|
8611
|
+
{ fileprop: "imclientsecretfile", prop: "imclientsecret" },
|
|
8612
|
+
{ fileprop: "trclientsecretfile", prop: "trclientsecret" },
|
|
8613
|
+
{ fileprop: "trnclientsecretfile", prop: "trnclientsecret" },
|
|
8614
|
+
{ fileprop: "lambdaclientsecretfile", prop: "lambdaclientsecret" },
|
|
8615
|
+
// JWKS secret file processing
|
|
8616
|
+
{ fileprop: "tsjwksstorepathfile", prop: "tsjwksstorepath" },
|
|
8617
|
+
// InfluxDB file processing
|
|
8618
|
+
{ fileprop: "influxDB_APITokenFile", prop: "influxDB_APIToken" }
|
|
8619
|
+
];
|
|
8620
|
+
fileconfig.forEach((v) => {
|
|
8621
|
+
if (defconfig[v.fileprop] !== void 0) {
|
|
8622
|
+
defconfig[v.prop] = ReadFile(defconfig[v.fileprop]);
|
|
8623
|
+
}
|
|
8624
|
+
});
|
|
8625
|
+
for (const [key, val] of Object.entries(defconfig)) {
|
|
8626
|
+
envOptions2[key] = val;
|
|
8627
|
+
}
|
|
8628
|
+
}
|
|
8629
|
+
function $SetupOptions(envOptions2) {
|
|
8630
|
+
SetupConfig(envOptions2);
|
|
8631
|
+
const options = envOptions2;
|
|
8632
|
+
const hosts = options.dbhost.split(",");
|
|
8633
|
+
envOptions2.connectionString = hosts.map((host) => {
|
|
8634
|
+
return `postgresql://${options.dbuser}:${options.dbpassword}@${host}/${options.database}`;
|
|
8635
|
+
}).join(",");
|
|
8636
|
+
envOptions2.defaultDatabaseConnectionString = hosts.map((host) => {
|
|
8637
|
+
return `postgresql://${options.dbuser}:${options.dbpassword}@${host}/postgres`;
|
|
8638
|
+
}).join(",");
|
|
8639
|
+
}
|
|
8640
|
+
function $Options() {
|
|
8641
|
+
if (envOptions === null) {
|
|
8642
|
+
envOptions = {};
|
|
8643
|
+
$SetupOptions(envOptions);
|
|
8644
|
+
}
|
|
8645
|
+
return envOptions;
|
|
8646
|
+
}
|
|
8647
|
+
const goptions = $Options();
|
|
8648
|
+
var influxDBDataType = /* @__PURE__ */ ((influxDBDataType2) => {
|
|
8649
|
+
influxDBDataType2["intField"] = "intField";
|
|
8650
|
+
influxDBDataType2["floatField"] = "floatField";
|
|
8651
|
+
influxDBDataType2["stringField"] = "stringField";
|
|
8652
|
+
return influxDBDataType2;
|
|
8653
|
+
})(influxDBDataType || {});
|
|
8654
|
+
const globalServiceDefinitions = {
|
|
8655
|
+
coreFieldList: [
|
|
8656
|
+
{ fieldName: "requestCount", gauge: Gauge.REQUEST_COUNT_GAUGE, instrumentProperty: "val", dataType: "number", influxdbDataType: "intField", gaugeType: GaugeTypes.INSTRUMENT_GAUGE },
|
|
8657
|
+
{ fieldName: "errorCount", gauge: Gauge.ERROR_COUNT_GAUGE, instrumentProperty: "val", dataType: "number", influxdbDataType: "intField", gaugeType: GaugeTypes.INSTRUMENT_GAUGE },
|
|
8658
|
+
{ fieldName: "retryCount", gauge: Gauge.RETRY_COUNT_GAUGE, instrumentProperty: "val", dataType: "number", influxdbDataType: "intField", gaugeType: GaugeTypes.INSTRUMENT_GAUGE },
|
|
8659
|
+
{ fieldName: "authenticationCount", gauge: Gauge.AUTHENTICATION_COUNT_GAUGE, instrumentProperty: "val", dataType: "number", influxdbDataType: "intField", gaugeType: GaugeTypes.INSTRUMENT_GAUGE },
|
|
8660
|
+
{ fieldName: "authenticationErrorCount", gauge: Gauge.AUTHENTICATION_ERROR_COUNT_GAUGE, instrumentProperty: "val", dataType: "number", influxdbDataType: "intField", gaugeType: GaugeTypes.INSTRUMENT_GAUGE },
|
|
8661
|
+
{ fieldName: "authenticationRetryCount", gauge: Gauge.AUTHENTICATION_RETRY_COUNT_GAUGE, instrumentProperty: "val", dataType: "number", influxdbDataType: "intField", gaugeType: GaugeTypes.INSTRUMENT_GAUGE },
|
|
8662
|
+
{ fieldName: "velocity", gauge: Gauge.VELOCITY_GAUGE, instrumentProperty: "va", dataType: "number", influxdbDataType: "floatField", gaugeType: GaugeTypes.INSTRUMENT_VELOCITY },
|
|
8663
|
+
{
|
|
8664
|
+
fieldName: "activeRequestCount",
|
|
8665
|
+
gauge: Gauge.ACTIVE_REQUEST_GAUGE,
|
|
8666
|
+
instrumentProperty: "val",
|
|
8667
|
+
dataType: "number",
|
|
8668
|
+
timeSeriesIndex: true,
|
|
8669
|
+
quantile: true,
|
|
8670
|
+
influxdbDataType: "intField",
|
|
8671
|
+
gaugeType: GaugeTypes.INSTRUMENT_GAUGE,
|
|
8672
|
+
instrumentOptions: {
|
|
8673
|
+
interval: goptions.instrumentationObservationInterval,
|
|
8674
|
+
sampleSize: goptions.instrumentationTimeWindow
|
|
8675
|
+
}
|
|
8676
|
+
},
|
|
8677
|
+
{ fieldName: "coreCount", gauge: Gauge.CORE_COUNT_GAUGE, instrumentProperty: "val", dataType: "number", influxdbDataType: "intField", gaugeType: GaugeTypes.INSTRUMENT_GAUGE },
|
|
8678
|
+
{ fieldName: "rx", gauge: Gauge.NETWORK_RX_GAUGE, instrumentProperty: "va", dataType: "number", influxdbDataType: "floatField", gaugeType: GaugeTypes.INSTRUMENT_VELOCITY },
|
|
8679
|
+
{ fieldName: "tx", gauge: Gauge.NETWORK_TX_GAUGE, instrumentProperty: "va", dataType: "number", influxdbDataType: "floatField", gaugeType: GaugeTypes.INSTRUMENT_VELOCITY },
|
|
8680
|
+
{ fieldName: "timer", gauge: Gauge.TIMER_GAUGE, instrumentProperty: "val", dataType: "number", influxdbDataType: "floatField", gaugeType: GaugeTypes.INSTRUMENT_TIMER },
|
|
8681
|
+
{
|
|
8682
|
+
fieldName: "duration",
|
|
8683
|
+
gauge: Gauge.DURATION_GAUGE,
|
|
8684
|
+
instrumentProperty: "val",
|
|
8685
|
+
dataType: "number",
|
|
8686
|
+
timeSeriesIndex: true,
|
|
8687
|
+
quantile: true,
|
|
8688
|
+
influxdbDataType: "floatField",
|
|
8689
|
+
gaugeType: GaugeTypes.INSTRUMENT_HISTOGRAM,
|
|
8690
|
+
instrumentOptions: {
|
|
8691
|
+
interval: goptions.instrumentationObservationInterval,
|
|
8692
|
+
sampleSize: goptions.instrumentationTimeWindow
|
|
8693
|
+
},
|
|
8694
|
+
histo: [
|
|
8695
|
+
{ label: "B10", bucketLimit: 10 },
|
|
8696
|
+
{ label: "B20", bucketLimit: 20 },
|
|
8697
|
+
{ label: "B50", bucketLimit: 50 },
|
|
8698
|
+
{ label: "B100", bucketLimit: 100 },
|
|
8699
|
+
{ label: "B1000", bucketLimit: 1e3 },
|
|
8700
|
+
{ label: "B50000", bucketLimit: 5e4 },
|
|
8701
|
+
{ label: "BInfinity", bucketLimit: -1 }
|
|
8702
|
+
]
|
|
8703
|
+
},
|
|
8704
|
+
{
|
|
8705
|
+
fieldName: "latency",
|
|
8706
|
+
gauge: Gauge.LATENCY_GAUGE,
|
|
8707
|
+
instrumentProperty: "val",
|
|
8708
|
+
dataType: "number",
|
|
8709
|
+
timeSeriesIndex: true,
|
|
8710
|
+
quantile: true,
|
|
8711
|
+
influxdbDataType: "floatField",
|
|
8712
|
+
gaugeType: GaugeTypes.INSTRUMENT_HISTOGRAM,
|
|
8713
|
+
instrumentOptions: {
|
|
8714
|
+
interval: goptions.instrumentationObservationInterval,
|
|
8715
|
+
sampleSize: goptions.instrumentationTimeWindow
|
|
8716
|
+
},
|
|
8717
|
+
histo: [
|
|
8718
|
+
{ label: "B10", bucketLimit: 10 },
|
|
8719
|
+
{ label: "B20", bucketLimit: 20 },
|
|
8720
|
+
{ label: "B50", bucketLimit: 50 },
|
|
8721
|
+
{ label: "B100", bucketLimit: 100 },
|
|
8722
|
+
{ label: "B1000", bucketLimit: 1e3 },
|
|
8723
|
+
{ label: "B50000", bucketLimit: 5e4 },
|
|
8724
|
+
{ label: "BInfinity", bucketLimit: -1 }
|
|
8725
|
+
]
|
|
8726
|
+
}
|
|
8727
|
+
],
|
|
8728
|
+
logFieldList: [
|
|
8729
|
+
{
|
|
8730
|
+
fieldName: "log",
|
|
8731
|
+
gauge: Gauge.LOGGER,
|
|
8732
|
+
instrumentProperty: "val",
|
|
8733
|
+
dataType: "string",
|
|
8734
|
+
timeSeriesIndex: false,
|
|
8735
|
+
quantile: false,
|
|
8736
|
+
influxdbDataType: "stringField",
|
|
8737
|
+
gaugeType: GaugeTypes.INSTRUMENT_LOG,
|
|
8738
|
+
instrumentOptions: {
|
|
8739
|
+
consoleLogging: goptions.consoleLogging,
|
|
8740
|
+
instrumentLogging: goptions.instrumentLogging
|
|
8741
|
+
}
|
|
8742
|
+
}
|
|
8743
|
+
],
|
|
8744
|
+
services: {
|
|
8745
|
+
["service"]: {
|
|
8746
|
+
influxDBContextTags: [
|
|
8747
|
+
"serviceId",
|
|
8748
|
+
"serviceName",
|
|
8749
|
+
"serviceVersion",
|
|
8750
|
+
"serviceInstanceId",
|
|
8751
|
+
"serviceInstanceProcessId",
|
|
8752
|
+
"hostName",
|
|
8753
|
+
"pid",
|
|
8754
|
+
"ppid"
|
|
8755
|
+
],
|
|
8756
|
+
redisIndexPrefixDefinitions: {
|
|
8757
|
+
timeSeriesIndex: "idx:serviceIndexTimeSeries",
|
|
8758
|
+
timeSeriesPrefix: "/serviceTimeSeries:",
|
|
8759
|
+
instantIndex: "idx:serviceIndexInstant",
|
|
8760
|
+
instantPrefix: "/serviceInstant:"
|
|
8761
|
+
},
|
|
8762
|
+
fieldList: [
|
|
8763
|
+
{
|
|
8764
|
+
fieldName: "cpu",
|
|
8765
|
+
gauge: Gauge.CPU_LOAD_GAUGE,
|
|
6721
8766
|
instrumentProperty: "val",
|
|
6722
8767
|
dataType: "number",
|
|
6723
8768
|
timeSeriesIndex: true,
|
|
6724
8769
|
quantile: true,
|
|
6725
|
-
influxdbDataType: "
|
|
6726
|
-
|
|
6727
|
-
|
|
6728
|
-
|
|
6729
|
-
|
|
6730
|
-
|
|
6731
|
-
instrumentProperty: "val",
|
|
6732
|
-
dataType: "number",
|
|
6733
|
-
influxdbDataType: "intField"
|
|
6734
|
-
/* intField */
|
|
6735
|
-
},
|
|
6736
|
-
{
|
|
6737
|
-
fieldName: "connectionIdleCount",
|
|
6738
|
-
gauge: Gauge.CONNECTION_POOL_IDLE_GAUGE,
|
|
6739
|
-
instrumentProperty: "val",
|
|
6740
|
-
dataType: "number",
|
|
6741
|
-
influxdbDataType: "intField"
|
|
6742
|
-
/* intField */
|
|
6743
|
-
},
|
|
6744
|
-
{
|
|
6745
|
-
fieldName: "connectionWaitingCount",
|
|
6746
|
-
gauge: Gauge.CONNECTION_POOL_WAITING_GAUGE,
|
|
6747
|
-
instrumentProperty: "val",
|
|
6748
|
-
dataType: "number",
|
|
6749
|
-
influxdbDataType: "intField"
|
|
6750
|
-
/* intField */
|
|
8770
|
+
influxdbDataType: "floatField",
|
|
8771
|
+
gaugeType: GaugeTypes.INSTRUMENT_GAUGE,
|
|
8772
|
+
instrumentOptions: {
|
|
8773
|
+
interval: goptions.instrumentationObservationInterval,
|
|
8774
|
+
sampleSize: goptions.instrumentationTimeWindow
|
|
8775
|
+
}
|
|
6751
8776
|
},
|
|
6752
8777
|
{
|
|
6753
|
-
fieldName: "
|
|
6754
|
-
gauge: Gauge.
|
|
8778
|
+
fieldName: "connectionCount",
|
|
8779
|
+
gauge: Gauge.CONNECTION_COUNT_GAUGE,
|
|
6755
8780
|
instrumentProperty: "val",
|
|
6756
8781
|
dataType: "number",
|
|
6757
8782
|
timeSeriesIndex: true,
|
|
6758
8783
|
quantile: true,
|
|
6759
|
-
influxdbDataType: "
|
|
6760
|
-
|
|
8784
|
+
influxdbDataType: "intField",
|
|
8785
|
+
gaugeType: GaugeTypes.INSTRUMENT_GAUGE,
|
|
8786
|
+
instrumentOptions: {
|
|
8787
|
+
interval: goptions.instrumentationObservationInterval,
|
|
8788
|
+
sampleSize: goptions.instrumentationTimeWindow
|
|
8789
|
+
}
|
|
6761
8790
|
},
|
|
8791
|
+
{ fieldName: "connectionPoolCount", gauge: Gauge.CONNECTION_POOL_TOTAL_GAUGE, instrumentProperty: "val", dataType: "number", influxdbDataType: "intField", gaugeType: GaugeTypes.INSTRUMENT_GAUGE },
|
|
8792
|
+
{ fieldName: "connectionIdleCount", gauge: Gauge.CONNECTION_POOL_IDLE_GAUGE, instrumentProperty: "val", dataType: "number", influxdbDataType: "intField", gaugeType: GaugeTypes.INSTRUMENT_GAUGE },
|
|
8793
|
+
{ fieldName: "connectionWaitingCount", gauge: Gauge.CONNECTION_POOL_WAITING_GAUGE, instrumentProperty: "val", dataType: "number", influxdbDataType: "intField", gaugeType: GaugeTypes.INSTRUMENT_GAUGE },
|
|
8794
|
+
{ fieldName: "systemcpu", gauge: Gauge.CPU_SYSTEM_LOAD_GAUGE, instrumentProperty: "val", dataType: "number", timeSeriesIndex: true, quantile: true, influxdbDataType: "floatField", gaugeType: GaugeTypes.INSTRUMENT_GAUGE },
|
|
6762
8795
|
{
|
|
6763
8796
|
fieldName: "memory",
|
|
6764
8797
|
gauge: Gauge.OBJECT_GAUGE,
|
|
6765
8798
|
instrumentProperty: "val",
|
|
6766
8799
|
dataType: "JSON",
|
|
6767
|
-
influxdbDataType: "stringField"
|
|
6768
|
-
|
|
8800
|
+
influxdbDataType: "stringField",
|
|
8801
|
+
gaugeType: GaugeTypes.INSTRUMENT_OBJECT,
|
|
8802
|
+
instrumentOptions: {
|
|
8803
|
+
label: "InstrumentObjectMaster"
|
|
8804
|
+
}
|
|
6769
8805
|
}
|
|
6770
8806
|
],
|
|
6771
8807
|
GetPathFromContext(context) {
|
|
@@ -6811,14 +8847,7 @@ const globalServiceDefinitions = {
|
|
|
6811
8847
|
instantPrefix: "/agentInstant:"
|
|
6812
8848
|
},
|
|
6813
8849
|
fieldList: [
|
|
6814
|
-
{
|
|
6815
|
-
fieldName: "childCount",
|
|
6816
|
-
gauge: Gauge.CHILD_COUNT,
|
|
6817
|
-
instrumentProperty: "val",
|
|
6818
|
-
dataType: "number",
|
|
6819
|
-
influxdbDataType: "intField"
|
|
6820
|
-
/* intField */
|
|
6821
|
-
}
|
|
8850
|
+
{ fieldName: "childCount", gauge: Gauge.CHILD_COUNT, instrumentProperty: "val", dataType: "number", influxdbDataType: "intField", gaugeType: GaugeTypes.INSTRUMENT_GAUGE }
|
|
6822
8851
|
],
|
|
6823
8852
|
//@@ need type declare in appframework ?? agent does not use appframework ... perhaps stspublisher
|
|
6824
8853
|
GetPathFromContext(context) {
|
|
@@ -6870,68 +8899,13 @@ const globalServiceDefinitions = {
|
|
|
6870
8899
|
instantPrefix: "/lambdaInstant:"
|
|
6871
8900
|
},
|
|
6872
8901
|
fieldList: [
|
|
6873
|
-
{
|
|
6874
|
-
|
|
6875
|
-
|
|
6876
|
-
|
|
6877
|
-
|
|
6878
|
-
|
|
6879
|
-
|
|
6880
|
-
influxdbDataType: "floatField"
|
|
6881
|
-
/* floatField */
|
|
6882
|
-
},
|
|
6883
|
-
{
|
|
6884
|
-
fieldName: "connectionCount",
|
|
6885
|
-
gauge: Gauge.CONNECTION_COUNT_GAUGE,
|
|
6886
|
-
instrumentProperty: "val",
|
|
6887
|
-
dataType: "number",
|
|
6888
|
-
timeSeriesIndex: true,
|
|
6889
|
-
quantile: true,
|
|
6890
|
-
influxdbDataType: "intField"
|
|
6891
|
-
/* intField */
|
|
6892
|
-
},
|
|
6893
|
-
{
|
|
6894
|
-
fieldName: "connectionPoolCount",
|
|
6895
|
-
gauge: Gauge.CONNECTION_POOL_TOTAL_GAUGE,
|
|
6896
|
-
instrumentProperty: "val",
|
|
6897
|
-
dataType: "number",
|
|
6898
|
-
influxdbDataType: "intField"
|
|
6899
|
-
/* intField */
|
|
6900
|
-
},
|
|
6901
|
-
{
|
|
6902
|
-
fieldName: "connectionIdleCount",
|
|
6903
|
-
gauge: Gauge.CONNECTION_POOL_IDLE_GAUGE,
|
|
6904
|
-
instrumentProperty: "val",
|
|
6905
|
-
dataType: "number",
|
|
6906
|
-
influxdbDataType: "intField"
|
|
6907
|
-
/* intField */
|
|
6908
|
-
},
|
|
6909
|
-
{
|
|
6910
|
-
fieldName: "connectionWaitingCount",
|
|
6911
|
-
gauge: Gauge.CONNECTION_POOL_WAITING_GAUGE,
|
|
6912
|
-
instrumentProperty: "val",
|
|
6913
|
-
dataType: "number",
|
|
6914
|
-
influxdbDataType: "intField"
|
|
6915
|
-
/* intField */
|
|
6916
|
-
},
|
|
6917
|
-
{
|
|
6918
|
-
fieldName: "systemcpu",
|
|
6919
|
-
gauge: Gauge.CPU_SYSTEM_LOAD_GAUGE,
|
|
6920
|
-
instrumentProperty: "val",
|
|
6921
|
-
dataType: "number",
|
|
6922
|
-
timeSeriesIndex: true,
|
|
6923
|
-
quantile: true,
|
|
6924
|
-
influxdbDataType: "floatField"
|
|
6925
|
-
/* floatField */
|
|
6926
|
-
},
|
|
6927
|
-
{
|
|
6928
|
-
fieldName: "memory",
|
|
6929
|
-
gauge: Gauge.OBJECT_GAUGE,
|
|
6930
|
-
instrumentProperty: "val",
|
|
6931
|
-
dataType: "JSON",
|
|
6932
|
-
influxdbDataType: "stringField"
|
|
6933
|
-
/* stringField */
|
|
6934
|
-
}
|
|
8902
|
+
{ fieldName: "cpu", gauge: Gauge.CPU_LOAD_GAUGE, instrumentProperty: "val", dataType: "number", timeSeriesIndex: true, quantile: true, influxdbDataType: "floatField", gaugeType: GaugeTypes.INSTRUMENT_GAUGE },
|
|
8903
|
+
{ fieldName: "connectionCount", gauge: Gauge.CONNECTION_COUNT_GAUGE, instrumentProperty: "val", dataType: "number", timeSeriesIndex: true, quantile: true, influxdbDataType: "intField", gaugeType: GaugeTypes.INSTRUMENT_GAUGE },
|
|
8904
|
+
{ fieldName: "connectionPoolCount", gauge: Gauge.CONNECTION_POOL_TOTAL_GAUGE, instrumentProperty: "val", dataType: "number", influxdbDataType: "intField", gaugeType: GaugeTypes.INSTRUMENT_GAUGE },
|
|
8905
|
+
{ fieldName: "connectionIdleCount", gauge: Gauge.CONNECTION_POOL_IDLE_GAUGE, instrumentProperty: "val", dataType: "number", influxdbDataType: "intField", gaugeType: GaugeTypes.INSTRUMENT_GAUGE },
|
|
8906
|
+
{ fieldName: "connectionWaitingCount", gauge: Gauge.CONNECTION_POOL_WAITING_GAUGE, instrumentProperty: "val", dataType: "number", influxdbDataType: "intField", gaugeType: GaugeTypes.INSTRUMENT_GAUGE },
|
|
8907
|
+
{ fieldName: "systemcpu", gauge: Gauge.CPU_SYSTEM_LOAD_GAUGE, instrumentProperty: "val", dataType: "number", timeSeriesIndex: true, quantile: true, influxdbDataType: "floatField", gaugeType: GaugeTypes.INSTRUMENT_GAUGE },
|
|
8908
|
+
{ fieldName: "memory", gauge: Gauge.OBJECT_GAUGE, instrumentProperty: "val", dataType: "JSON", influxdbDataType: "stringField", gaugeType: GaugeTypes.INSTRUMENT_OBJECT }
|
|
6935
8909
|
],
|
|
6936
8910
|
//@@ need type declare in appframework
|
|
6937
8911
|
GetPathFromContext(context) {
|
|
@@ -6968,6 +8942,22 @@ const globalServiceDefinitions = {
|
|
|
6968
8942
|
}
|
|
6969
8943
|
}
|
|
6970
8944
|
};
|
|
8945
|
+
const GetInstruments = (service) => {
|
|
8946
|
+
const fieldList = [
|
|
8947
|
+
...globalServiceDefinitions.coreFieldList,
|
|
8948
|
+
...globalServiceDefinitions.logFieldList,
|
|
8949
|
+
...globalServiceDefinitions.services[service].fieldList
|
|
8950
|
+
];
|
|
8951
|
+
const retVal = [];
|
|
8952
|
+
fieldList.forEach((v) => {
|
|
8953
|
+
if (v.instrumentOptions) {
|
|
8954
|
+
retVal.push([v.gauge, v.gaugeType, v.instrumentOptions]);
|
|
8955
|
+
} else {
|
|
8956
|
+
retVal.push([v.gauge, v.gaugeType]);
|
|
8957
|
+
}
|
|
8958
|
+
});
|
|
8959
|
+
return retVal;
|
|
8960
|
+
};
|
|
6971
8961
|
export {
|
|
6972
8962
|
AgentInstrumentController,
|
|
6973
8963
|
CompareSTSInstrumentControllerPluginKey,
|
|
@@ -6975,6 +8965,7 @@ export {
|
|
|
6975
8965
|
Gauge,
|
|
6976
8966
|
GaugeTypes,
|
|
6977
8967
|
GetInstrumentName,
|
|
8968
|
+
GetInstruments,
|
|
6978
8969
|
GetSTSInstrumentController,
|
|
6979
8970
|
GetSTSInstrumentControllerPluginKey,
|
|
6980
8971
|
GetSocketIOSubscriptionKey,
|