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