@trigger.dev/redis-worker 4.5.0-rc.4 → 4.5.0-rc.6
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/index.cjs +1352 -1007
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +18 -6
- package/dist/index.d.ts +18 -6
- package/dist/index.js +1351 -1006
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -3450,9 +3450,9 @@ var require_lodash2 = __commonJS({
|
|
|
3450
3450
|
}
|
|
3451
3451
|
});
|
|
3452
3452
|
|
|
3453
|
-
// ../../node_modules/.pnpm/ioredis@5.
|
|
3453
|
+
// ../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/utils/lodash.js
|
|
3454
3454
|
var require_lodash3 = __commonJS({
|
|
3455
|
-
"../../node_modules/.pnpm/ioredis@5.
|
|
3455
|
+
"../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/utils/lodash.js"(exports$1) {
|
|
3456
3456
|
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
3457
3457
|
exports$1.isArguments = exports$1.defaults = exports$1.noop = void 0;
|
|
3458
3458
|
var defaults = require_lodash();
|
|
@@ -3581,9 +3581,9 @@ var require_ms = __commonJS({
|
|
|
3581
3581
|
}
|
|
3582
3582
|
});
|
|
3583
3583
|
|
|
3584
|
-
// ../../node_modules/.pnpm/debug@4.
|
|
3584
|
+
// ../../node_modules/.pnpm/debug@4.4.3_supports-color@10.0.0/node_modules/debug/src/common.js
|
|
3585
3585
|
var require_common = __commonJS({
|
|
3586
|
-
"../../node_modules/.pnpm/debug@4.
|
|
3586
|
+
"../../node_modules/.pnpm/debug@4.4.3_supports-color@10.0.0/node_modules/debug/src/common.js"(exports$1, module) {
|
|
3587
3587
|
function setup(env2) {
|
|
3588
3588
|
createDebug.debug = createDebug;
|
|
3589
3589
|
createDebug.default = createDebug;
|
|
@@ -3617,12 +3617,12 @@ var require_common = __commonJS({
|
|
|
3617
3617
|
if (!debug.enabled) {
|
|
3618
3618
|
return;
|
|
3619
3619
|
}
|
|
3620
|
-
const
|
|
3620
|
+
const self2 = debug;
|
|
3621
3621
|
const curr = Number(/* @__PURE__ */ new Date());
|
|
3622
3622
|
const ms = curr - (prevTime || curr);
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
|
|
3623
|
+
self2.diff = ms;
|
|
3624
|
+
self2.prev = prevTime;
|
|
3625
|
+
self2.curr = curr;
|
|
3626
3626
|
prevTime = curr;
|
|
3627
3627
|
args[0] = createDebug.coerce(args[0]);
|
|
3628
3628
|
if (typeof args[0] !== "string") {
|
|
@@ -3637,15 +3637,15 @@ var require_common = __commonJS({
|
|
|
3637
3637
|
const formatter = createDebug.formatters[format];
|
|
3638
3638
|
if (typeof formatter === "function") {
|
|
3639
3639
|
const val = args[index];
|
|
3640
|
-
match = formatter.call(
|
|
3640
|
+
match = formatter.call(self2, val);
|
|
3641
3641
|
args.splice(index, 1);
|
|
3642
3642
|
index--;
|
|
3643
3643
|
}
|
|
3644
3644
|
return match;
|
|
3645
3645
|
});
|
|
3646
|
-
createDebug.formatArgs.call(
|
|
3647
|
-
const logFn =
|
|
3648
|
-
logFn.apply(
|
|
3646
|
+
createDebug.formatArgs.call(self2, args);
|
|
3647
|
+
const logFn = self2.log || createDebug.log;
|
|
3648
|
+
logFn.apply(self2, args);
|
|
3649
3649
|
}
|
|
3650
3650
|
debug.namespace = namespace;
|
|
3651
3651
|
debug.useColors = createDebug.useColors();
|
|
@@ -3684,50 +3684,64 @@ var require_common = __commonJS({
|
|
|
3684
3684
|
createDebug.namespaces = namespaces;
|
|
3685
3685
|
createDebug.names = [];
|
|
3686
3686
|
createDebug.skips = [];
|
|
3687
|
-
|
|
3688
|
-
|
|
3689
|
-
|
|
3690
|
-
|
|
3691
|
-
|
|
3692
|
-
|
|
3687
|
+
const split = (typeof namespaces === "string" ? namespaces : "").trim().replace(/\s+/g, ",").split(",").filter(Boolean);
|
|
3688
|
+
for (const ns of split) {
|
|
3689
|
+
if (ns[0] === "-") {
|
|
3690
|
+
createDebug.skips.push(ns.slice(1));
|
|
3691
|
+
} else {
|
|
3692
|
+
createDebug.names.push(ns);
|
|
3693
3693
|
}
|
|
3694
|
-
|
|
3695
|
-
|
|
3696
|
-
|
|
3694
|
+
}
|
|
3695
|
+
}
|
|
3696
|
+
function matchesTemplate(search, template) {
|
|
3697
|
+
let searchIndex = 0;
|
|
3698
|
+
let templateIndex = 0;
|
|
3699
|
+
let starIndex = -1;
|
|
3700
|
+
let matchIndex = 0;
|
|
3701
|
+
while (searchIndex < search.length) {
|
|
3702
|
+
if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === "*")) {
|
|
3703
|
+
if (template[templateIndex] === "*") {
|
|
3704
|
+
starIndex = templateIndex;
|
|
3705
|
+
matchIndex = searchIndex;
|
|
3706
|
+
templateIndex++;
|
|
3707
|
+
} else {
|
|
3708
|
+
searchIndex++;
|
|
3709
|
+
templateIndex++;
|
|
3710
|
+
}
|
|
3711
|
+
} else if (starIndex !== -1) {
|
|
3712
|
+
templateIndex = starIndex + 1;
|
|
3713
|
+
matchIndex++;
|
|
3714
|
+
searchIndex = matchIndex;
|
|
3697
3715
|
} else {
|
|
3698
|
-
|
|
3716
|
+
return false;
|
|
3699
3717
|
}
|
|
3700
3718
|
}
|
|
3719
|
+
while (templateIndex < template.length && template[templateIndex] === "*") {
|
|
3720
|
+
templateIndex++;
|
|
3721
|
+
}
|
|
3722
|
+
return templateIndex === template.length;
|
|
3701
3723
|
}
|
|
3702
3724
|
function disable() {
|
|
3703
3725
|
const namespaces = [
|
|
3704
|
-
...createDebug.names
|
|
3705
|
-
...createDebug.skips.map(
|
|
3726
|
+
...createDebug.names,
|
|
3727
|
+
...createDebug.skips.map((namespace) => "-" + namespace)
|
|
3706
3728
|
].join(",");
|
|
3707
3729
|
createDebug.enable("");
|
|
3708
3730
|
return namespaces;
|
|
3709
3731
|
}
|
|
3710
3732
|
function enabled(name) {
|
|
3711
|
-
|
|
3712
|
-
|
|
3713
|
-
}
|
|
3714
|
-
let i;
|
|
3715
|
-
let len;
|
|
3716
|
-
for (i = 0, len = createDebug.skips.length; i < len; i++) {
|
|
3717
|
-
if (createDebug.skips[i].test(name)) {
|
|
3733
|
+
for (const skip of createDebug.skips) {
|
|
3734
|
+
if (matchesTemplate(name, skip)) {
|
|
3718
3735
|
return false;
|
|
3719
3736
|
}
|
|
3720
3737
|
}
|
|
3721
|
-
for (
|
|
3722
|
-
if (
|
|
3738
|
+
for (const ns of createDebug.names) {
|
|
3739
|
+
if (matchesTemplate(name, ns)) {
|
|
3723
3740
|
return true;
|
|
3724
3741
|
}
|
|
3725
3742
|
}
|
|
3726
3743
|
return false;
|
|
3727
3744
|
}
|
|
3728
|
-
function toNamespace(regexp) {
|
|
3729
|
-
return regexp.toString().substring(2, regexp.toString().length - 2).replace(/\.\*\?$/, "*");
|
|
3730
|
-
}
|
|
3731
3745
|
function coerce(val) {
|
|
3732
3746
|
if (val instanceof Error) {
|
|
3733
3747
|
return val.stack || val.message;
|
|
@@ -3744,9 +3758,9 @@ var require_common = __commonJS({
|
|
|
3744
3758
|
}
|
|
3745
3759
|
});
|
|
3746
3760
|
|
|
3747
|
-
// ../../node_modules/.pnpm/debug@4.
|
|
3761
|
+
// ../../node_modules/.pnpm/debug@4.4.3_supports-color@10.0.0/node_modules/debug/src/browser.js
|
|
3748
3762
|
var require_browser = __commonJS({
|
|
3749
|
-
"../../node_modules/.pnpm/debug@4.
|
|
3763
|
+
"../../node_modules/.pnpm/debug@4.4.3_supports-color@10.0.0/node_modules/debug/src/browser.js"(exports$1, module) {
|
|
3750
3764
|
exports$1.formatArgs = formatArgs;
|
|
3751
3765
|
exports$1.save = save;
|
|
3752
3766
|
exports$1.load = load;
|
|
@@ -3888,7 +3902,7 @@ var require_browser = __commonJS({
|
|
|
3888
3902
|
function load() {
|
|
3889
3903
|
let r;
|
|
3890
3904
|
try {
|
|
3891
|
-
r = exports$1.storage.getItem("debug");
|
|
3905
|
+
r = exports$1.storage.getItem("debug") || exports$1.storage.getItem("DEBUG");
|
|
3892
3906
|
} catch (error) {
|
|
3893
3907
|
}
|
|
3894
3908
|
if (!r && typeof process !== "undefined" && "env" in process) {
|
|
@@ -4054,9 +4068,9 @@ var init_supports_color = __esm({
|
|
|
4054
4068
|
}
|
|
4055
4069
|
});
|
|
4056
4070
|
|
|
4057
|
-
// ../../node_modules/.pnpm/debug@4.
|
|
4071
|
+
// ../../node_modules/.pnpm/debug@4.4.3_supports-color@10.0.0/node_modules/debug/src/node.js
|
|
4058
4072
|
var require_node = __commonJS({
|
|
4059
|
-
"../../node_modules/.pnpm/debug@4.
|
|
4073
|
+
"../../node_modules/.pnpm/debug@4.4.3_supports-color@10.0.0/node_modules/debug/src/node.js"(exports$1, module) {
|
|
4060
4074
|
var tty2 = __require("tty");
|
|
4061
4075
|
var util = __require("util");
|
|
4062
4076
|
exports$1.init = init;
|
|
@@ -4228,9 +4242,9 @@ var require_node = __commonJS({
|
|
|
4228
4242
|
}
|
|
4229
4243
|
});
|
|
4230
4244
|
|
|
4231
|
-
// ../../node_modules/.pnpm/debug@4.
|
|
4245
|
+
// ../../node_modules/.pnpm/debug@4.4.3_supports-color@10.0.0/node_modules/debug/src/index.js
|
|
4232
4246
|
var require_src = __commonJS({
|
|
4233
|
-
"../../node_modules/.pnpm/debug@4.
|
|
4247
|
+
"../../node_modules/.pnpm/debug@4.4.3_supports-color@10.0.0/node_modules/debug/src/index.js"(exports$1, module) {
|
|
4234
4248
|
if (typeof process === "undefined" || process.type === "renderer" || process.browser === true || process.__nwjs) {
|
|
4235
4249
|
module.exports = require_browser();
|
|
4236
4250
|
} else {
|
|
@@ -4239,9 +4253,9 @@ var require_src = __commonJS({
|
|
|
4239
4253
|
}
|
|
4240
4254
|
});
|
|
4241
4255
|
|
|
4242
|
-
// ../../node_modules/.pnpm/ioredis@5.
|
|
4256
|
+
// ../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/utils/debug.js
|
|
4243
4257
|
var require_debug = __commonJS({
|
|
4244
|
-
"../../node_modules/.pnpm/ioredis@5.
|
|
4258
|
+
"../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/utils/debug.js"(exports$1) {
|
|
4245
4259
|
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
4246
4260
|
exports$1.genRedactedString = exports$1.getStringValue = exports$1.MAX_ARGUMENT_LENGTH = void 0;
|
|
4247
4261
|
var debug_1 = require_src();
|
|
@@ -4324,9 +4338,9 @@ var require_debug = __commonJS({
|
|
|
4324
4338
|
}
|
|
4325
4339
|
});
|
|
4326
4340
|
|
|
4327
|
-
// ../../node_modules/.pnpm/ioredis@5.
|
|
4341
|
+
// ../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/constants/TLSProfiles.js
|
|
4328
4342
|
var require_TLSProfiles = __commonJS({
|
|
4329
|
-
"../../node_modules/.pnpm/ioredis@5.
|
|
4343
|
+
"../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/constants/TLSProfiles.js"(exports$1) {
|
|
4330
4344
|
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
4331
4345
|
var RedisCloudCA = `-----BEGIN CERTIFICATE-----
|
|
4332
4346
|
MIIDTzCCAjegAwIBAgIJAKSVpiDswLcwMA0GCSqGSIb3DQEBBQUAMD4xFjAUBgNV
|
|
@@ -4475,9 +4489,9 @@ WD9f
|
|
|
4475
4489
|
}
|
|
4476
4490
|
});
|
|
4477
4491
|
|
|
4478
|
-
// ../../node_modules/.pnpm/ioredis@5.
|
|
4492
|
+
// ../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/utils/index.js
|
|
4479
4493
|
var require_utils2 = __commonJS({
|
|
4480
|
-
"../../node_modules/.pnpm/ioredis@5.
|
|
4494
|
+
"../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/utils/index.js"(exports$1) {
|
|
4481
4495
|
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
4482
4496
|
exports$1.noop = exports$1.defaults = exports$1.Debug = exports$1.zipMap = exports$1.CONNECTION_CLOSED_ERROR_MSG = exports$1.shuffle = exports$1.sample = exports$1.resolveTLSProfile = exports$1.parseURL = exports$1.optimizeErrorStack = exports$1.toArg = exports$1.convertMapToArray = exports$1.convertObjectToArray = exports$1.timeout = exports$1.packObject = exports$1.isInt = exports$1.wrapMultiResult = exports$1.convertBufferToString = void 0;
|
|
4483
4497
|
var url_1 = __require("url");
|
|
@@ -4680,9 +4694,9 @@ var require_utils2 = __commonJS({
|
|
|
4680
4694
|
}
|
|
4681
4695
|
});
|
|
4682
4696
|
|
|
4683
|
-
// ../../node_modules/.pnpm/ioredis@5.
|
|
4697
|
+
// ../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/Command.js
|
|
4684
4698
|
var require_Command = __commonJS({
|
|
4685
|
-
"../../node_modules/.pnpm/ioredis@5.
|
|
4699
|
+
"../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/Command.js"(exports$1) {
|
|
4686
4700
|
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
4687
4701
|
var commands_1 = require_built();
|
|
4688
4702
|
var calculateSlot = require_lib();
|
|
@@ -4978,9 +4992,9 @@ var require_Command = __commonJS({
|
|
|
4978
4992
|
}
|
|
4979
4993
|
});
|
|
4980
4994
|
|
|
4981
|
-
// ../../node_modules/.pnpm/ioredis@5.
|
|
4995
|
+
// ../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/errors/ClusterAllFailedError.js
|
|
4982
4996
|
var require_ClusterAllFailedError = __commonJS({
|
|
4983
|
-
"../../node_modules/.pnpm/ioredis@5.
|
|
4997
|
+
"../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/errors/ClusterAllFailedError.js"(exports$1) {
|
|
4984
4998
|
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
4985
4999
|
var redis_errors_1 = require_redis_errors();
|
|
4986
5000
|
var ClusterAllFailedError = class extends redis_errors_1.RedisError {
|
|
@@ -4998,9 +5012,9 @@ var require_ClusterAllFailedError = __commonJS({
|
|
|
4998
5012
|
}
|
|
4999
5013
|
});
|
|
5000
5014
|
|
|
5001
|
-
// ../../node_modules/.pnpm/ioredis@5.
|
|
5015
|
+
// ../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/ScanStream.js
|
|
5002
5016
|
var require_ScanStream = __commonJS({
|
|
5003
|
-
"../../node_modules/.pnpm/ioredis@5.
|
|
5017
|
+
"../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/ScanStream.js"(exports$1) {
|
|
5004
5018
|
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
5005
5019
|
var stream_1 = __require("stream");
|
|
5006
5020
|
var ScanStream = class extends stream_1.Readable {
|
|
@@ -5028,6 +5042,9 @@ var require_ScanStream = __commonJS({
|
|
|
5028
5042
|
if (this.opt.count) {
|
|
5029
5043
|
args.push("COUNT", String(this.opt.count));
|
|
5030
5044
|
}
|
|
5045
|
+
if (this.opt.noValues) {
|
|
5046
|
+
args.push("NOVALUES");
|
|
5047
|
+
}
|
|
5031
5048
|
this.opt.redis[this.opt.command](args, (err, res) => {
|
|
5032
5049
|
if (err) {
|
|
5033
5050
|
this.emit("error", err);
|
|
@@ -5048,9 +5065,9 @@ var require_ScanStream = __commonJS({
|
|
|
5048
5065
|
}
|
|
5049
5066
|
});
|
|
5050
5067
|
|
|
5051
|
-
// ../../node_modules/.pnpm/ioredis@5.
|
|
5068
|
+
// ../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/autoPipelining.js
|
|
5052
5069
|
var require_autoPipelining = __commonJS({
|
|
5053
|
-
"../../node_modules/.pnpm/ioredis@5.
|
|
5070
|
+
"../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/autoPipelining.js"(exports$1) {
|
|
5054
5071
|
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
5055
5072
|
exports$1.executeWithAutoPipelining = exports$1.getFirstValueInFlattenedArray = exports$1.shouldUseAutoPipelining = exports$1.notAllowedAutoPipelineCommands = exports$1.kCallbacks = exports$1.kExec = void 0;
|
|
5056
5073
|
var lodash_1 = require_lodash3();
|
|
@@ -5169,9 +5186,9 @@ var require_autoPipelining = __commonJS({
|
|
|
5169
5186
|
}
|
|
5170
5187
|
});
|
|
5171
5188
|
|
|
5172
|
-
// ../../node_modules/.pnpm/ioredis@5.
|
|
5189
|
+
// ../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/Script.js
|
|
5173
5190
|
var require_Script = __commonJS({
|
|
5174
|
-
"../../node_modules/.pnpm/ioredis@5.
|
|
5191
|
+
"../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/Script.js"(exports$1) {
|
|
5175
5192
|
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
5176
5193
|
var crypto_1 = __require("crypto");
|
|
5177
5194
|
var Command_1 = require_Command();
|
|
@@ -5233,9 +5250,9 @@ var require_Script = __commonJS({
|
|
|
5233
5250
|
}
|
|
5234
5251
|
});
|
|
5235
5252
|
|
|
5236
|
-
// ../../node_modules/.pnpm/ioredis@5.
|
|
5253
|
+
// ../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/utils/Commander.js
|
|
5237
5254
|
var require_Commander = __commonJS({
|
|
5238
|
-
"../../node_modules/.pnpm/ioredis@5.
|
|
5255
|
+
"../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/utils/Commander.js"(exports$1) {
|
|
5239
5256
|
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
5240
5257
|
var commands_1 = require_built();
|
|
5241
5258
|
var autoPipelining_1 = require_autoPipelining();
|
|
@@ -5348,9 +5365,9 @@ var require_Commander = __commonJS({
|
|
|
5348
5365
|
}
|
|
5349
5366
|
});
|
|
5350
5367
|
|
|
5351
|
-
// ../../node_modules/.pnpm/ioredis@5.
|
|
5368
|
+
// ../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/Pipeline.js
|
|
5352
5369
|
var require_Pipeline = __commonJS({
|
|
5353
|
-
"../../node_modules/.pnpm/ioredis@5.
|
|
5370
|
+
"../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/Pipeline.js"(exports$1) {
|
|
5354
5371
|
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
5355
5372
|
var calculateSlot = require_lib();
|
|
5356
5373
|
var commands_1 = require_built();
|
|
@@ -5651,9 +5668,9 @@ var require_Pipeline = __commonJS({
|
|
|
5651
5668
|
}
|
|
5652
5669
|
});
|
|
5653
5670
|
|
|
5654
|
-
// ../../node_modules/.pnpm/ioredis@5.
|
|
5671
|
+
// ../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/transaction.js
|
|
5655
5672
|
var require_transaction = __commonJS({
|
|
5656
|
-
"../../node_modules/.pnpm/ioredis@5.
|
|
5673
|
+
"../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/transaction.js"(exports$1) {
|
|
5657
5674
|
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
5658
5675
|
exports$1.addTransactionSupport = void 0;
|
|
5659
5676
|
var utils_1 = require_utils2();
|
|
@@ -5743,9 +5760,9 @@ var require_transaction = __commonJS({
|
|
|
5743
5760
|
}
|
|
5744
5761
|
});
|
|
5745
5762
|
|
|
5746
|
-
// ../../node_modules/.pnpm/ioredis@5.
|
|
5763
|
+
// ../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/utils/applyMixin.js
|
|
5747
5764
|
var require_applyMixin = __commonJS({
|
|
5748
|
-
"../../node_modules/.pnpm/ioredis@5.
|
|
5765
|
+
"../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/utils/applyMixin.js"(exports$1) {
|
|
5749
5766
|
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
5750
5767
|
function applyMixin(derivedConstructor, mixinConstructor) {
|
|
5751
5768
|
Object.getOwnPropertyNames(mixinConstructor.prototype).forEach((name) => {
|
|
@@ -5756,9 +5773,9 @@ var require_applyMixin = __commonJS({
|
|
|
5756
5773
|
}
|
|
5757
5774
|
});
|
|
5758
5775
|
|
|
5759
|
-
// ../../node_modules/.pnpm/ioredis@5.
|
|
5776
|
+
// ../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/cluster/ClusterOptions.js
|
|
5760
5777
|
var require_ClusterOptions = __commonJS({
|
|
5761
|
-
"../../node_modules/.pnpm/ioredis@5.
|
|
5778
|
+
"../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/cluster/ClusterOptions.js"(exports$1) {
|
|
5762
5779
|
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
5763
5780
|
exports$1.DEFAULT_CLUSTER_OPTIONS = void 0;
|
|
5764
5781
|
var dns_1 = __require("dns");
|
|
@@ -5777,14 +5794,15 @@ var require_ClusterOptions = __commonJS({
|
|
|
5777
5794
|
resolveSrv: dns_1.resolveSrv,
|
|
5778
5795
|
dnsLookup: dns_1.lookup,
|
|
5779
5796
|
enableAutoPipelining: false,
|
|
5780
|
-
autoPipeliningIgnoredCommands: []
|
|
5797
|
+
autoPipeliningIgnoredCommands: [],
|
|
5798
|
+
shardedSubscribers: false
|
|
5781
5799
|
};
|
|
5782
5800
|
}
|
|
5783
5801
|
});
|
|
5784
5802
|
|
|
5785
|
-
// ../../node_modules/.pnpm/ioredis@5.
|
|
5803
|
+
// ../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/cluster/util.js
|
|
5786
5804
|
var require_util = __commonJS({
|
|
5787
|
-
"../../node_modules/.pnpm/ioredis@5.
|
|
5805
|
+
"../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/cluster/util.js"(exports$1) {
|
|
5788
5806
|
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
5789
5807
|
exports$1.getConnectionName = exports$1.weightSrvRecords = exports$1.groupSrvRecords = exports$1.getUniqueHostnamesFromOptions = exports$1.normalizeNodeOptions = exports$1.nodeKeyToRedisOptions = exports$1.getNodeKey = void 0;
|
|
5790
5808
|
var utils_1 = require_utils2();
|
|
@@ -5881,20 +5899,22 @@ var require_util = __commonJS({
|
|
|
5881
5899
|
}
|
|
5882
5900
|
});
|
|
5883
5901
|
|
|
5884
|
-
// ../../node_modules/.pnpm/ioredis@5.
|
|
5902
|
+
// ../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/cluster/ClusterSubscriber.js
|
|
5885
5903
|
var require_ClusterSubscriber = __commonJS({
|
|
5886
|
-
"../../node_modules/.pnpm/ioredis@5.
|
|
5904
|
+
"../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/cluster/ClusterSubscriber.js"(exports$1) {
|
|
5887
5905
|
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
5888
5906
|
var util_1 = require_util();
|
|
5889
5907
|
var utils_1 = require_utils2();
|
|
5890
5908
|
var Redis_1 = require_Redis();
|
|
5891
5909
|
var debug = (0, utils_1.Debug)("cluster:subscriber");
|
|
5892
5910
|
var ClusterSubscriber = class {
|
|
5893
|
-
constructor(connectionPool, emitter) {
|
|
5911
|
+
constructor(connectionPool, emitter, isSharded = false) {
|
|
5894
5912
|
this.connectionPool = connectionPool;
|
|
5895
5913
|
this.emitter = emitter;
|
|
5914
|
+
this.isSharded = isSharded;
|
|
5896
5915
|
this.started = false;
|
|
5897
5916
|
this.subscriber = null;
|
|
5917
|
+
this.slotRange = [];
|
|
5898
5918
|
this.onSubscriberEnd = () => {
|
|
5899
5919
|
if (!this.started) {
|
|
5900
5920
|
debug("subscriber has disconnected, but ClusterSubscriber is not started, so not reconnecting.");
|
|
@@ -5923,6 +5943,21 @@ var require_ClusterSubscriber = __commonJS({
|
|
|
5923
5943
|
getInstance() {
|
|
5924
5944
|
return this.subscriber;
|
|
5925
5945
|
}
|
|
5946
|
+
/**
|
|
5947
|
+
* Associate this subscriber to a specific slot range.
|
|
5948
|
+
*
|
|
5949
|
+
* Returns the range or an empty array if the slot range couldn't be associated.
|
|
5950
|
+
*
|
|
5951
|
+
* BTW: This is more for debugging and testing purposes.
|
|
5952
|
+
*
|
|
5953
|
+
* @param range
|
|
5954
|
+
*/
|
|
5955
|
+
associateSlotRange(range) {
|
|
5956
|
+
if (this.isSharded) {
|
|
5957
|
+
this.slotRange = range;
|
|
5958
|
+
}
|
|
5959
|
+
return this.slotRange;
|
|
5960
|
+
}
|
|
5926
5961
|
start() {
|
|
5927
5962
|
this.started = true;
|
|
5928
5963
|
this.selectSubscriber();
|
|
@@ -5934,7 +5969,9 @@ var require_ClusterSubscriber = __commonJS({
|
|
|
5934
5969
|
this.subscriber.disconnect();
|
|
5935
5970
|
this.subscriber = null;
|
|
5936
5971
|
}
|
|
5937
|
-
|
|
5972
|
+
}
|
|
5973
|
+
isStarted() {
|
|
5974
|
+
return this.started;
|
|
5938
5975
|
}
|
|
5939
5976
|
selectSubscriber() {
|
|
5940
5977
|
const lastActiveSubscriber = this.lastActiveSubscriber;
|
|
@@ -5954,13 +5991,16 @@ var require_ClusterSubscriber = __commonJS({
|
|
|
5954
5991
|
}
|
|
5955
5992
|
const { options } = sampleNode;
|
|
5956
5993
|
debug("selected a subscriber %s:%s", options.host, options.port);
|
|
5994
|
+
let connectionPrefix = "subscriber";
|
|
5995
|
+
if (this.isSharded)
|
|
5996
|
+
connectionPrefix = "ssubscriber";
|
|
5957
5997
|
this.subscriber = new Redis_1.default({
|
|
5958
5998
|
port: options.port,
|
|
5959
5999
|
host: options.host,
|
|
5960
6000
|
username: options.username,
|
|
5961
6001
|
password: options.password,
|
|
5962
6002
|
enableReadyCheck: true,
|
|
5963
|
-
connectionName: (0, util_1.getConnectionName)(
|
|
6003
|
+
connectionName: (0, util_1.getConnectionName)(connectionPrefix, options.connectionName),
|
|
5964
6004
|
lazyConnect: true,
|
|
5965
6005
|
tls: options.tls,
|
|
5966
6006
|
// Don't try to reconnect the subscriber connection. If the connection fails
|
|
@@ -6000,9 +6040,7 @@ var require_ClusterSubscriber = __commonJS({
|
|
|
6000
6040
|
}
|
|
6001
6041
|
for (const event of [
|
|
6002
6042
|
"message",
|
|
6003
|
-
"messageBuffer"
|
|
6004
|
-
"smessage",
|
|
6005
|
-
"smessageBuffer"
|
|
6043
|
+
"messageBuffer"
|
|
6006
6044
|
]) {
|
|
6007
6045
|
this.subscriber.on(event, (arg1, arg2) => {
|
|
6008
6046
|
this.emitter.emit(event, arg1, arg2);
|
|
@@ -6013,15 +6051,25 @@ var require_ClusterSubscriber = __commonJS({
|
|
|
6013
6051
|
this.emitter.emit(event, arg1, arg2, arg3);
|
|
6014
6052
|
});
|
|
6015
6053
|
}
|
|
6054
|
+
if (this.isSharded == true) {
|
|
6055
|
+
for (const event of [
|
|
6056
|
+
"smessage",
|
|
6057
|
+
"smessageBuffer"
|
|
6058
|
+
]) {
|
|
6059
|
+
this.subscriber.on(event, (arg1, arg2) => {
|
|
6060
|
+
this.emitter.emit(event, arg1, arg2);
|
|
6061
|
+
});
|
|
6062
|
+
}
|
|
6063
|
+
}
|
|
6016
6064
|
}
|
|
6017
6065
|
};
|
|
6018
6066
|
exports$1.default = ClusterSubscriber;
|
|
6019
6067
|
}
|
|
6020
6068
|
});
|
|
6021
6069
|
|
|
6022
|
-
// ../../node_modules/.pnpm/ioredis@5.
|
|
6070
|
+
// ../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/cluster/ConnectionPool.js
|
|
6023
6071
|
var require_ConnectionPool = __commonJS({
|
|
6024
|
-
"../../node_modules/.pnpm/ioredis@5.
|
|
6072
|
+
"../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/cluster/ConnectionPool.js"(exports$1) {
|
|
6025
6073
|
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
6026
6074
|
var events_1 = __require("events");
|
|
6027
6075
|
var utils_1 = require_utils2();
|
|
@@ -6051,6 +6099,39 @@ var require_ConnectionPool = __commonJS({
|
|
|
6051
6099
|
const sampleKey = (0, utils_1.sample)(keys);
|
|
6052
6100
|
return this.nodes[role][sampleKey];
|
|
6053
6101
|
}
|
|
6102
|
+
/**
|
|
6103
|
+
* Add a master node to the pool
|
|
6104
|
+
* @param node
|
|
6105
|
+
*/
|
|
6106
|
+
addMasterNode(node) {
|
|
6107
|
+
const key = (0, util_1.getNodeKey)(node.options);
|
|
6108
|
+
const redis = this.createRedisFromOptions(node, node.options.readOnly);
|
|
6109
|
+
if (!node.options.readOnly) {
|
|
6110
|
+
this.nodes.all[key] = redis;
|
|
6111
|
+
this.nodes.master[key] = redis;
|
|
6112
|
+
return true;
|
|
6113
|
+
}
|
|
6114
|
+
return false;
|
|
6115
|
+
}
|
|
6116
|
+
/**
|
|
6117
|
+
* Creates a Redis connection instance from the node options
|
|
6118
|
+
* @param node
|
|
6119
|
+
* @param readOnly
|
|
6120
|
+
*/
|
|
6121
|
+
createRedisFromOptions(node, readOnly) {
|
|
6122
|
+
const redis = new Redis_1.default((0, utils_1.defaults)({
|
|
6123
|
+
// Never try to reconnect when a node is lose,
|
|
6124
|
+
// instead, waiting for a `MOVED` error and
|
|
6125
|
+
// fetch the slots again.
|
|
6126
|
+
retryStrategy: null,
|
|
6127
|
+
// Offline queue should be enabled so that
|
|
6128
|
+
// we don't need to wait for the `ready` event
|
|
6129
|
+
// before sending commands to the node.
|
|
6130
|
+
enableOfflineQueue: true,
|
|
6131
|
+
readOnly
|
|
6132
|
+
}, node, this.redisOptions, { lazyConnect: true }));
|
|
6133
|
+
return redis;
|
|
6134
|
+
}
|
|
6054
6135
|
/**
|
|
6055
6136
|
* Find or create a connection to the node
|
|
6056
6137
|
*/
|
|
@@ -6079,17 +6160,7 @@ var require_ConnectionPool = __commonJS({
|
|
|
6079
6160
|
}
|
|
6080
6161
|
} else {
|
|
6081
6162
|
debug("Connecting to %s as %s", key, readOnly ? "slave" : "master");
|
|
6082
|
-
redis =
|
|
6083
|
-
// Never try to reconnect when a node is lose,
|
|
6084
|
-
// instead, waiting for a `MOVED` error and
|
|
6085
|
-
// fetch the slots again.
|
|
6086
|
-
retryStrategy: null,
|
|
6087
|
-
// Offline queue should be enabled so that
|
|
6088
|
-
// we don't need to wait for the `ready` event
|
|
6089
|
-
// before sending commands to the node.
|
|
6090
|
-
enableOfflineQueue: true,
|
|
6091
|
-
readOnly
|
|
6092
|
-
}, node, this.redisOptions, { lazyConnect: true }));
|
|
6163
|
+
redis = this.createRedisFromOptions(node, readOnly);
|
|
6093
6164
|
this.nodes.all[key] = redis;
|
|
6094
6165
|
this.nodes[readOnly ? "slave" : "master"][key] = redis;
|
|
6095
6166
|
redis.once("end", () => {
|
|
@@ -6462,9 +6533,9 @@ var require_denque = __commonJS({
|
|
|
6462
6533
|
}
|
|
6463
6534
|
});
|
|
6464
6535
|
|
|
6465
|
-
// ../../node_modules/.pnpm/ioredis@5.
|
|
6536
|
+
// ../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/cluster/DelayQueue.js
|
|
6466
6537
|
var require_DelayQueue = __commonJS({
|
|
6467
|
-
"../../node_modules/.pnpm/ioredis@5.
|
|
6538
|
+
"../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/cluster/DelayQueue.js"(exports$1) {
|
|
6468
6539
|
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
6469
6540
|
var utils_1 = require_utils2();
|
|
6470
6541
|
var Deque = require_denque();
|
|
@@ -6517,9 +6588,210 @@ var require_DelayQueue = __commonJS({
|
|
|
6517
6588
|
}
|
|
6518
6589
|
});
|
|
6519
6590
|
|
|
6520
|
-
// ../../node_modules/.pnpm/ioredis@5.
|
|
6591
|
+
// ../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/cluster/ClusterSubscriberGroup.js
|
|
6592
|
+
var require_ClusterSubscriberGroup = __commonJS({
|
|
6593
|
+
"../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/cluster/ClusterSubscriberGroup.js"(exports$1) {
|
|
6594
|
+
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
6595
|
+
var utils_1 = require_utils2();
|
|
6596
|
+
var ClusterSubscriber_1 = require_ClusterSubscriber();
|
|
6597
|
+
var ConnectionPool_1 = require_ConnectionPool();
|
|
6598
|
+
var util_1 = require_util();
|
|
6599
|
+
var calculateSlot = require_lib();
|
|
6600
|
+
var debug = (0, utils_1.Debug)("cluster:subscriberGroup");
|
|
6601
|
+
var ClusterSubscriberGroup = class {
|
|
6602
|
+
/**
|
|
6603
|
+
* Register callbacks
|
|
6604
|
+
*
|
|
6605
|
+
* @param cluster
|
|
6606
|
+
*/
|
|
6607
|
+
constructor(cluster) {
|
|
6608
|
+
this.cluster = cluster;
|
|
6609
|
+
this.shardedSubscribers = /* @__PURE__ */ new Map();
|
|
6610
|
+
this.clusterSlots = [];
|
|
6611
|
+
this.subscriberToSlotsIndex = /* @__PURE__ */ new Map();
|
|
6612
|
+
this.channels = /* @__PURE__ */ new Map();
|
|
6613
|
+
cluster.on("+node", (redis) => {
|
|
6614
|
+
this._addSubscriber(redis);
|
|
6615
|
+
});
|
|
6616
|
+
cluster.on("-node", (redis) => {
|
|
6617
|
+
this._removeSubscriber(redis);
|
|
6618
|
+
});
|
|
6619
|
+
cluster.on("refresh", () => {
|
|
6620
|
+
this._refreshSlots(cluster);
|
|
6621
|
+
});
|
|
6622
|
+
}
|
|
6623
|
+
/**
|
|
6624
|
+
* Get the responsible subscriber.
|
|
6625
|
+
*
|
|
6626
|
+
* Returns null if no subscriber was found
|
|
6627
|
+
*
|
|
6628
|
+
* @param slot
|
|
6629
|
+
*/
|
|
6630
|
+
getResponsibleSubscriber(slot) {
|
|
6631
|
+
const nodeKey = this.clusterSlots[slot][0];
|
|
6632
|
+
return this.shardedSubscribers.get(nodeKey);
|
|
6633
|
+
}
|
|
6634
|
+
/**
|
|
6635
|
+
* Adds a channel for which this subscriber group is responsible
|
|
6636
|
+
*
|
|
6637
|
+
* @param channels
|
|
6638
|
+
*/
|
|
6639
|
+
addChannels(channels) {
|
|
6640
|
+
const slot = calculateSlot(channels[0]);
|
|
6641
|
+
channels.forEach((c) => {
|
|
6642
|
+
if (calculateSlot(c) != slot)
|
|
6643
|
+
return -1;
|
|
6644
|
+
});
|
|
6645
|
+
const currChannels = this.channels.get(slot);
|
|
6646
|
+
if (!currChannels) {
|
|
6647
|
+
this.channels.set(slot, channels);
|
|
6648
|
+
} else {
|
|
6649
|
+
this.channels.set(slot, currChannels.concat(channels));
|
|
6650
|
+
}
|
|
6651
|
+
return [...this.channels.values()].flatMap((v) => v).length;
|
|
6652
|
+
}
|
|
6653
|
+
/**
|
|
6654
|
+
* Removes channels for which the subscriber group is responsible by optionally unsubscribing
|
|
6655
|
+
* @param channels
|
|
6656
|
+
*/
|
|
6657
|
+
removeChannels(channels) {
|
|
6658
|
+
const slot = calculateSlot(channels[0]);
|
|
6659
|
+
channels.forEach((c) => {
|
|
6660
|
+
if (calculateSlot(c) != slot)
|
|
6661
|
+
return -1;
|
|
6662
|
+
});
|
|
6663
|
+
const slotChannels = this.channels.get(slot);
|
|
6664
|
+
if (slotChannels) {
|
|
6665
|
+
const updatedChannels = slotChannels.filter((c) => !channels.includes(c));
|
|
6666
|
+
this.channels.set(slot, updatedChannels);
|
|
6667
|
+
}
|
|
6668
|
+
return [...this.channels.values()].flatMap((v) => v).length;
|
|
6669
|
+
}
|
|
6670
|
+
/**
|
|
6671
|
+
* Disconnect all subscribers
|
|
6672
|
+
*/
|
|
6673
|
+
stop() {
|
|
6674
|
+
for (const s of this.shardedSubscribers.values()) {
|
|
6675
|
+
s.stop();
|
|
6676
|
+
}
|
|
6677
|
+
}
|
|
6678
|
+
/**
|
|
6679
|
+
* Start all not yet started subscribers
|
|
6680
|
+
*/
|
|
6681
|
+
start() {
|
|
6682
|
+
for (const s of this.shardedSubscribers.values()) {
|
|
6683
|
+
if (!s.isStarted()) {
|
|
6684
|
+
s.start();
|
|
6685
|
+
}
|
|
6686
|
+
}
|
|
6687
|
+
}
|
|
6688
|
+
/**
|
|
6689
|
+
* Add a subscriber to the group of subscribers
|
|
6690
|
+
*
|
|
6691
|
+
* @param redis
|
|
6692
|
+
*/
|
|
6693
|
+
_addSubscriber(redis) {
|
|
6694
|
+
const pool2 = new ConnectionPool_1.default(redis.options);
|
|
6695
|
+
if (pool2.addMasterNode(redis)) {
|
|
6696
|
+
const sub = new ClusterSubscriber_1.default(pool2, this.cluster, true);
|
|
6697
|
+
const nodeKey = (0, util_1.getNodeKey)(redis.options);
|
|
6698
|
+
this.shardedSubscribers.set(nodeKey, sub);
|
|
6699
|
+
sub.start();
|
|
6700
|
+
this._resubscribe();
|
|
6701
|
+
this.cluster.emit("+subscriber");
|
|
6702
|
+
return sub;
|
|
6703
|
+
}
|
|
6704
|
+
return null;
|
|
6705
|
+
}
|
|
6706
|
+
/**
|
|
6707
|
+
* Removes a subscriber from the group
|
|
6708
|
+
* @param redis
|
|
6709
|
+
*/
|
|
6710
|
+
_removeSubscriber(redis) {
|
|
6711
|
+
const nodeKey = (0, util_1.getNodeKey)(redis.options);
|
|
6712
|
+
const sub = this.shardedSubscribers.get(nodeKey);
|
|
6713
|
+
if (sub) {
|
|
6714
|
+
sub.stop();
|
|
6715
|
+
this.shardedSubscribers.delete(nodeKey);
|
|
6716
|
+
this._resubscribe();
|
|
6717
|
+
this.cluster.emit("-subscriber");
|
|
6718
|
+
}
|
|
6719
|
+
return this.shardedSubscribers;
|
|
6720
|
+
}
|
|
6721
|
+
/**
|
|
6722
|
+
* Refreshes the subscriber-related slot ranges
|
|
6723
|
+
*
|
|
6724
|
+
* Returns false if no refresh was needed
|
|
6725
|
+
*
|
|
6726
|
+
* @param cluster
|
|
6727
|
+
*/
|
|
6728
|
+
_refreshSlots(cluster) {
|
|
6729
|
+
if (this._slotsAreEqual(cluster.slots)) {
|
|
6730
|
+
debug("Nothing to refresh because the new cluster map is equal to the previous one.");
|
|
6731
|
+
} else {
|
|
6732
|
+
debug("Refreshing the slots of the subscriber group.");
|
|
6733
|
+
this.subscriberToSlotsIndex = /* @__PURE__ */ new Map();
|
|
6734
|
+
for (let slot = 0; slot < cluster.slots.length; slot++) {
|
|
6735
|
+
const node = cluster.slots[slot][0];
|
|
6736
|
+
if (!this.subscriberToSlotsIndex.has(node)) {
|
|
6737
|
+
this.subscriberToSlotsIndex.set(node, []);
|
|
6738
|
+
}
|
|
6739
|
+
this.subscriberToSlotsIndex.get(node).push(Number(slot));
|
|
6740
|
+
}
|
|
6741
|
+
this._resubscribe();
|
|
6742
|
+
this.clusterSlots = JSON.parse(JSON.stringify(cluster.slots));
|
|
6743
|
+
this.cluster.emit("subscribersReady");
|
|
6744
|
+
return true;
|
|
6745
|
+
}
|
|
6746
|
+
return false;
|
|
6747
|
+
}
|
|
6748
|
+
/**
|
|
6749
|
+
* Resubscribes to the previous channels
|
|
6750
|
+
*
|
|
6751
|
+
* @private
|
|
6752
|
+
*/
|
|
6753
|
+
_resubscribe() {
|
|
6754
|
+
if (this.shardedSubscribers) {
|
|
6755
|
+
this.shardedSubscribers.forEach((s, nodeKey) => {
|
|
6756
|
+
const subscriberSlots = this.subscriberToSlotsIndex.get(nodeKey);
|
|
6757
|
+
if (subscriberSlots) {
|
|
6758
|
+
s.associateSlotRange(subscriberSlots);
|
|
6759
|
+
subscriberSlots.forEach((ss) => {
|
|
6760
|
+
const redis = s.getInstance();
|
|
6761
|
+
const channels = this.channels.get(ss);
|
|
6762
|
+
if (channels && channels.length > 0) {
|
|
6763
|
+
if (redis) {
|
|
6764
|
+
redis.ssubscribe(channels);
|
|
6765
|
+
redis.on("ready", () => {
|
|
6766
|
+
redis.ssubscribe(channels);
|
|
6767
|
+
});
|
|
6768
|
+
}
|
|
6769
|
+
}
|
|
6770
|
+
});
|
|
6771
|
+
}
|
|
6772
|
+
});
|
|
6773
|
+
}
|
|
6774
|
+
}
|
|
6775
|
+
/**
|
|
6776
|
+
* Deep equality of the cluster slots objects
|
|
6777
|
+
*
|
|
6778
|
+
* @param other
|
|
6779
|
+
* @private
|
|
6780
|
+
*/
|
|
6781
|
+
_slotsAreEqual(other) {
|
|
6782
|
+
if (this.clusterSlots === void 0)
|
|
6783
|
+
return false;
|
|
6784
|
+
else
|
|
6785
|
+
return JSON.stringify(this.clusterSlots) === JSON.stringify(other);
|
|
6786
|
+
}
|
|
6787
|
+
};
|
|
6788
|
+
exports$1.default = ClusterSubscriberGroup;
|
|
6789
|
+
}
|
|
6790
|
+
});
|
|
6791
|
+
|
|
6792
|
+
// ../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/cluster/index.js
|
|
6521
6793
|
var require_cluster = __commonJS({
|
|
6522
|
-
"../../node_modules/.pnpm/ioredis@5.
|
|
6794
|
+
"../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/cluster/index.js"(exports$1) {
|
|
6523
6795
|
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
6524
6796
|
var commands_1 = require_built();
|
|
6525
6797
|
var events_1 = __require("events");
|
|
@@ -6539,12 +6811,14 @@ var require_cluster = __commonJS({
|
|
|
6539
6811
|
var DelayQueue_1 = require_DelayQueue();
|
|
6540
6812
|
var util_1 = require_util();
|
|
6541
6813
|
var Deque = require_denque();
|
|
6814
|
+
var ClusterSubscriberGroup_1 = require_ClusterSubscriberGroup();
|
|
6542
6815
|
var debug = (0, utils_1.Debug)("cluster");
|
|
6543
6816
|
var REJECT_OVERWRITTEN_COMMANDS = /* @__PURE__ */ new WeakSet();
|
|
6544
6817
|
var Cluster = class _Cluster extends Commander_1.default {
|
|
6545
6818
|
/**
|
|
6546
6819
|
* Creates an instance of Cluster.
|
|
6547
6820
|
*/
|
|
6821
|
+
//TODO: Add an option that enables or disables sharded PubSub
|
|
6548
6822
|
constructor(startupNodes, options = {}) {
|
|
6549
6823
|
super();
|
|
6550
6824
|
this.slots = [];
|
|
@@ -6555,6 +6829,7 @@ var require_cluster = __commonJS({
|
|
|
6555
6829
|
this.delayQueue = new DelayQueue_1.default();
|
|
6556
6830
|
this.offlineQueue = new Deque();
|
|
6557
6831
|
this.isRefreshing = false;
|
|
6832
|
+
this._refreshSlotsCacheCallbacks = [];
|
|
6558
6833
|
this._autoPipelines = /* @__PURE__ */ new Map();
|
|
6559
6834
|
this._runningAutoPipelines = /* @__PURE__ */ new Set();
|
|
6560
6835
|
this._readyDelayedCallbacks = [];
|
|
@@ -6562,6 +6837,8 @@ var require_cluster = __commonJS({
|
|
|
6562
6837
|
events_1.EventEmitter.call(this);
|
|
6563
6838
|
this.startupNodes = startupNodes;
|
|
6564
6839
|
this.options = (0, utils_1.defaults)({}, options, ClusterOptions_1.DEFAULT_CLUSTER_OPTIONS, this.options);
|
|
6840
|
+
if (this.options.shardedSubscribers == true)
|
|
6841
|
+
this.shardedSubscribers = new ClusterSubscriberGroup_1.default(this);
|
|
6565
6842
|
if (this.options.redisOptions && this.options.redisOptions.keyPrefix && !this.options.keyPrefix) {
|
|
6566
6843
|
this.options.keyPrefix = this.options.redisOptions.keyPrefix;
|
|
6567
6844
|
}
|
|
@@ -6662,6 +6939,9 @@ var require_cluster = __commonJS({
|
|
|
6662
6939
|
}
|
|
6663
6940
|
});
|
|
6664
6941
|
this.subscriber.start();
|
|
6942
|
+
if (this.options.shardedSubscribers) {
|
|
6943
|
+
this.shardedSubscribers.start();
|
|
6944
|
+
}
|
|
6665
6945
|
}).catch((err) => {
|
|
6666
6946
|
this.setStatus("close");
|
|
6667
6947
|
this.handleCloseEvent(err);
|
|
@@ -6686,6 +6966,9 @@ var require_cluster = __commonJS({
|
|
|
6686
6966
|
}
|
|
6687
6967
|
this.clearNodesRefreshInterval();
|
|
6688
6968
|
this.subscriber.stop();
|
|
6969
|
+
if (this.options.shardedSubscribers) {
|
|
6970
|
+
this.shardedSubscribers.stop();
|
|
6971
|
+
}
|
|
6689
6972
|
if (status === "wait") {
|
|
6690
6973
|
this.setStatus("close");
|
|
6691
6974
|
this.handleCloseEvent();
|
|
@@ -6706,6 +6989,9 @@ var require_cluster = __commonJS({
|
|
|
6706
6989
|
}
|
|
6707
6990
|
this.clearNodesRefreshInterval();
|
|
6708
6991
|
this.subscriber.stop();
|
|
6992
|
+
if (this.options.shardedSubscribers) {
|
|
6993
|
+
this.shardedSubscribers.stop();
|
|
6994
|
+
}
|
|
6709
6995
|
if (status === "wait") {
|
|
6710
6996
|
const ret = (0, standard_as_callback_1.default)(Promise.resolve("OK"), callback);
|
|
6711
6997
|
setImmediate(function() {
|
|
@@ -6770,19 +7056,20 @@ var require_cluster = __commonJS({
|
|
|
6770
7056
|
* @ignore
|
|
6771
7057
|
*/
|
|
6772
7058
|
refreshSlotsCache(callback) {
|
|
7059
|
+
if (callback) {
|
|
7060
|
+
this._refreshSlotsCacheCallbacks.push(callback);
|
|
7061
|
+
}
|
|
6773
7062
|
if (this.isRefreshing) {
|
|
6774
|
-
if (callback) {
|
|
6775
|
-
process.nextTick(callback);
|
|
6776
|
-
}
|
|
6777
7063
|
return;
|
|
6778
7064
|
}
|
|
6779
7065
|
this.isRefreshing = true;
|
|
6780
7066
|
const _this = this;
|
|
6781
7067
|
const wrapper = (error) => {
|
|
6782
7068
|
this.isRefreshing = false;
|
|
6783
|
-
|
|
6784
|
-
|
|
7069
|
+
for (const callback2 of this._refreshSlotsCacheCallbacks) {
|
|
7070
|
+
callback2(error);
|
|
6785
7071
|
}
|
|
7072
|
+
this._refreshSlotsCacheCallbacks = [];
|
|
6786
7073
|
};
|
|
6787
7074
|
const nodes = (0, utils_1.shuffle)(this.connectionPool.getNodes());
|
|
6788
7075
|
let lastNodeError = null;
|
|
@@ -6884,7 +7171,21 @@ var require_cluster = __commonJS({
|
|
|
6884
7171
|
if (node && node.redis) {
|
|
6885
7172
|
redis = node.redis;
|
|
6886
7173
|
} else if (Command_1.default.checkFlag("ENTER_SUBSCRIBER_MODE", command.name) || Command_1.default.checkFlag("EXIT_SUBSCRIBER_MODE", command.name)) {
|
|
6887
|
-
|
|
7174
|
+
if (_this.options.shardedSubscribers == true && (command.name == "ssubscribe" || command.name == "sunsubscribe")) {
|
|
7175
|
+
const sub = _this.shardedSubscribers.getResponsibleSubscriber(targetSlot);
|
|
7176
|
+
let status = -1;
|
|
7177
|
+
if (command.name == "ssubscribe")
|
|
7178
|
+
status = _this.shardedSubscribers.addChannels(command.getKeys());
|
|
7179
|
+
if (command.name == "sunsubscribe")
|
|
7180
|
+
status = _this.shardedSubscribers.removeChannels(command.getKeys());
|
|
7181
|
+
if (status !== -1) {
|
|
7182
|
+
redis = sub.getInstance();
|
|
7183
|
+
} else {
|
|
7184
|
+
command.reject(new redis_errors_1.AbortError("Can't add or remove the given channels. Are they in the same slot?"));
|
|
7185
|
+
}
|
|
7186
|
+
} else {
|
|
7187
|
+
redis = _this.subscriber.getInstance();
|
|
7188
|
+
}
|
|
6888
7189
|
if (!redis) {
|
|
6889
7190
|
command.reject(new redis_errors_1.AbortError("No subscriber for the cluster"));
|
|
6890
7191
|
return;
|
|
@@ -7081,13 +7382,16 @@ var require_cluster = __commonJS({
|
|
|
7081
7382
|
}
|
|
7082
7383
|
}
|
|
7083
7384
|
natMapper(nodeKey) {
|
|
7084
|
-
|
|
7085
|
-
|
|
7086
|
-
|
|
7087
|
-
|
|
7088
|
-
|
|
7089
|
-
|
|
7090
|
-
|
|
7385
|
+
const key = typeof nodeKey === "string" ? nodeKey : `${nodeKey.host}:${nodeKey.port}`;
|
|
7386
|
+
let mapped = null;
|
|
7387
|
+
if (this.options.natMap && typeof this.options.natMap === "function") {
|
|
7388
|
+
mapped = this.options.natMap(key);
|
|
7389
|
+
} else if (this.options.natMap && typeof this.options.natMap === "object") {
|
|
7390
|
+
mapped = this.options.natMap[key];
|
|
7391
|
+
}
|
|
7392
|
+
if (mapped) {
|
|
7393
|
+
debug("NAT mapping %s -> %O", key, mapped);
|
|
7394
|
+
return Object.assign({}, mapped);
|
|
7091
7395
|
}
|
|
7092
7396
|
return typeof nodeKey === "string" ? (0, util_1.nodeKeyToRedisOptions)(nodeKey) : nodeKey;
|
|
7093
7397
|
}
|
|
@@ -7105,6 +7409,7 @@ var require_cluster = __commonJS({
|
|
|
7105
7409
|
duplicatedConnection.cluster("SLOTS", (0, utils_1.timeout)((err, result) => {
|
|
7106
7410
|
duplicatedConnection.disconnect();
|
|
7107
7411
|
if (err) {
|
|
7412
|
+
debug("error encountered running CLUSTER.SLOTS: %s", err);
|
|
7108
7413
|
return callback(err);
|
|
7109
7414
|
}
|
|
7110
7415
|
if (this.status === "disconnecting" || this.status === "close" || this.status === "end") {
|
|
@@ -7193,7 +7498,7 @@ var require_cluster = __commonJS({
|
|
|
7193
7498
|
if (err) {
|
|
7194
7499
|
return reject(err);
|
|
7195
7500
|
}
|
|
7196
|
-
const
|
|
7501
|
+
const self2 = this, groupedRecords = (0, util_1.groupSrvRecords)(records), sortedKeys = Object.keys(groupedRecords).sort((a, b) => parseInt(a) - parseInt(b));
|
|
7197
7502
|
function tryFirstOne(err2) {
|
|
7198
7503
|
if (!sortedKeys.length) {
|
|
7199
7504
|
return reject(err2);
|
|
@@ -7202,7 +7507,7 @@ var require_cluster = __commonJS({
|
|
|
7202
7507
|
if (!group.records.length) {
|
|
7203
7508
|
sortedKeys.shift();
|
|
7204
7509
|
}
|
|
7205
|
-
|
|
7510
|
+
self2.dnsLookup(record.name).then((host) => resolve({
|
|
7206
7511
|
host,
|
|
7207
7512
|
port: record.port
|
|
7208
7513
|
}), tryFirstOne);
|
|
@@ -7268,9 +7573,9 @@ var require_cluster = __commonJS({
|
|
|
7268
7573
|
}
|
|
7269
7574
|
});
|
|
7270
7575
|
|
|
7271
|
-
// ../../node_modules/.pnpm/ioredis@5.
|
|
7576
|
+
// ../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/connectors/AbstractConnector.js
|
|
7272
7577
|
var require_AbstractConnector = __commonJS({
|
|
7273
|
-
"../../node_modules/.pnpm/ioredis@5.
|
|
7578
|
+
"../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/connectors/AbstractConnector.js"(exports$1) {
|
|
7274
7579
|
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
7275
7580
|
var utils_1 = require_utils2();
|
|
7276
7581
|
var debug = (0, utils_1.Debug)("AbstractConnector");
|
|
@@ -7299,9 +7604,9 @@ var require_AbstractConnector = __commonJS({
|
|
|
7299
7604
|
}
|
|
7300
7605
|
});
|
|
7301
7606
|
|
|
7302
|
-
// ../../node_modules/.pnpm/ioredis@5.
|
|
7607
|
+
// ../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/connectors/StandaloneConnector.js
|
|
7303
7608
|
var require_StandaloneConnector = __commonJS({
|
|
7304
|
-
"../../node_modules/.pnpm/ioredis@5.
|
|
7609
|
+
"../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/connectors/StandaloneConnector.js"(exports$1) {
|
|
7305
7610
|
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
7306
7611
|
var net_1 = __require("net");
|
|
7307
7612
|
var tls_1 = __require("tls");
|
|
@@ -7363,9 +7668,9 @@ var require_StandaloneConnector = __commonJS({
|
|
|
7363
7668
|
}
|
|
7364
7669
|
});
|
|
7365
7670
|
|
|
7366
|
-
// ../../node_modules/.pnpm/ioredis@5.
|
|
7671
|
+
// ../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/connectors/SentinelConnector/SentinelIterator.js
|
|
7367
7672
|
var require_SentinelIterator = __commonJS({
|
|
7368
|
-
"../../node_modules/.pnpm/ioredis@5.
|
|
7673
|
+
"../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/connectors/SentinelConnector/SentinelIterator.js"(exports$1) {
|
|
7369
7674
|
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
7370
7675
|
function isSentinelEql(a, b) {
|
|
7371
7676
|
return (a.host || "127.0.0.1") === (b.host || "127.0.0.1") && (a.port || 26379) === (b.port || 26379);
|
|
@@ -7402,9 +7707,9 @@ var require_SentinelIterator = __commonJS({
|
|
|
7402
7707
|
}
|
|
7403
7708
|
});
|
|
7404
7709
|
|
|
7405
|
-
// ../../node_modules/.pnpm/ioredis@5.
|
|
7710
|
+
// ../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/connectors/SentinelConnector/FailoverDetector.js
|
|
7406
7711
|
var require_FailoverDetector = __commonJS({
|
|
7407
|
-
"../../node_modules/.pnpm/ioredis@5.
|
|
7712
|
+
"../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/connectors/SentinelConnector/FailoverDetector.js"(exports$1) {
|
|
7408
7713
|
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
7409
7714
|
exports$1.FailoverDetector = void 0;
|
|
7410
7715
|
var utils_1 = require_utils2();
|
|
@@ -7449,9 +7754,9 @@ var require_FailoverDetector = __commonJS({
|
|
|
7449
7754
|
}
|
|
7450
7755
|
});
|
|
7451
7756
|
|
|
7452
|
-
// ../../node_modules/.pnpm/ioredis@5.
|
|
7757
|
+
// ../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/connectors/SentinelConnector/index.js
|
|
7453
7758
|
var require_SentinelConnector = __commonJS({
|
|
7454
|
-
"../../node_modules/.pnpm/ioredis@5.
|
|
7759
|
+
"../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/connectors/SentinelConnector/index.js"(exports$1) {
|
|
7455
7760
|
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
7456
7761
|
exports$1.SentinelIterator = void 0;
|
|
7457
7762
|
var net_1 = __require("net");
|
|
@@ -7588,7 +7893,14 @@ var require_SentinelConnector = __commonJS({
|
|
|
7588
7893
|
sentinelNatResolve(item) {
|
|
7589
7894
|
if (!item || !this.options.natMap)
|
|
7590
7895
|
return item;
|
|
7591
|
-
|
|
7896
|
+
const key = `${item.host}:${item.port}`;
|
|
7897
|
+
let result = item;
|
|
7898
|
+
if (typeof this.options.natMap === "function") {
|
|
7899
|
+
result = this.options.natMap(key) || item;
|
|
7900
|
+
} else if (typeof this.options.natMap === "object") {
|
|
7901
|
+
result = this.options.natMap[key] || item;
|
|
7902
|
+
}
|
|
7903
|
+
return result;
|
|
7592
7904
|
}
|
|
7593
7905
|
connectToSentinel(endpoint, options) {
|
|
7594
7906
|
const redis = new Redis_1.default({
|
|
@@ -7707,9 +8019,9 @@ var require_SentinelConnector = __commonJS({
|
|
|
7707
8019
|
}
|
|
7708
8020
|
});
|
|
7709
8021
|
|
|
7710
|
-
// ../../node_modules/.pnpm/ioredis@5.
|
|
8022
|
+
// ../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/connectors/index.js
|
|
7711
8023
|
var require_connectors = __commonJS({
|
|
7712
|
-
"../../node_modules/.pnpm/ioredis@5.
|
|
8024
|
+
"../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/connectors/index.js"(exports$1) {
|
|
7713
8025
|
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
7714
8026
|
exports$1.SentinelConnector = exports$1.StandaloneConnector = void 0;
|
|
7715
8027
|
var StandaloneConnector_1 = require_StandaloneConnector();
|
|
@@ -7719,9 +8031,9 @@ var require_connectors = __commonJS({
|
|
|
7719
8031
|
}
|
|
7720
8032
|
});
|
|
7721
8033
|
|
|
7722
|
-
// ../../node_modules/.pnpm/ioredis@5.
|
|
8034
|
+
// ../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/errors/MaxRetriesPerRequestError.js
|
|
7723
8035
|
var require_MaxRetriesPerRequestError = __commonJS({
|
|
7724
|
-
"../../node_modules/.pnpm/ioredis@5.
|
|
8036
|
+
"../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/errors/MaxRetriesPerRequestError.js"(exports$1) {
|
|
7725
8037
|
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
7726
8038
|
var redis_errors_1 = require_redis_errors();
|
|
7727
8039
|
var MaxRetriesPerRequestError = class extends redis_errors_1.AbortError {
|
|
@@ -7738,9 +8050,9 @@ var require_MaxRetriesPerRequestError = __commonJS({
|
|
|
7738
8050
|
}
|
|
7739
8051
|
});
|
|
7740
8052
|
|
|
7741
|
-
// ../../node_modules/.pnpm/ioredis@5.
|
|
8053
|
+
// ../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/errors/index.js
|
|
7742
8054
|
var require_errors = __commonJS({
|
|
7743
|
-
"../../node_modules/.pnpm/ioredis@5.
|
|
8055
|
+
"../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/errors/index.js"(exports$1) {
|
|
7744
8056
|
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
7745
8057
|
exports$1.MaxRetriesPerRequestError = void 0;
|
|
7746
8058
|
var MaxRetriesPerRequestError_1 = require_MaxRetriesPerRequestError();
|
|
@@ -8155,9 +8467,9 @@ var require_redis_parser = __commonJS({
|
|
|
8155
8467
|
}
|
|
8156
8468
|
});
|
|
8157
8469
|
|
|
8158
|
-
// ../../node_modules/.pnpm/ioredis@5.
|
|
8470
|
+
// ../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/SubscriptionSet.js
|
|
8159
8471
|
var require_SubscriptionSet = __commonJS({
|
|
8160
|
-
"../../node_modules/.pnpm/ioredis@5.
|
|
8472
|
+
"../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/SubscriptionSet.js"(exports$1) {
|
|
8161
8473
|
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
8162
8474
|
var SubscriptionSet = class {
|
|
8163
8475
|
constructor() {
|
|
@@ -8196,9 +8508,9 @@ var require_SubscriptionSet = __commonJS({
|
|
|
8196
8508
|
}
|
|
8197
8509
|
});
|
|
8198
8510
|
|
|
8199
|
-
// ../../node_modules/.pnpm/ioredis@5.
|
|
8511
|
+
// ../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/DataHandler.js
|
|
8200
8512
|
var require_DataHandler = __commonJS({
|
|
8201
|
-
"../../node_modules/.pnpm/ioredis@5.
|
|
8513
|
+
"../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/DataHandler.js"(exports$1) {
|
|
8202
8514
|
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
8203
8515
|
var Command_1 = require_Command();
|
|
8204
8516
|
var utils_1 = require_utils2();
|
|
@@ -8221,9 +8533,10 @@ var require_DataHandler = __commonJS({
|
|
|
8221
8533
|
this.returnReply(reply);
|
|
8222
8534
|
}
|
|
8223
8535
|
});
|
|
8224
|
-
redis.stream.
|
|
8536
|
+
redis.stream.prependListener("data", (data) => {
|
|
8225
8537
|
parser.execute(data);
|
|
8226
8538
|
});
|
|
8539
|
+
redis.stream.resume();
|
|
8227
8540
|
}
|
|
8228
8541
|
returnFatalError(err) {
|
|
8229
8542
|
err.message += ". Please report this.";
|
|
@@ -8398,9 +8711,9 @@ var require_DataHandler = __commonJS({
|
|
|
8398
8711
|
}
|
|
8399
8712
|
});
|
|
8400
8713
|
|
|
8401
|
-
// ../../node_modules/.pnpm/ioredis@5.
|
|
8714
|
+
// ../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/redis/event_handler.js
|
|
8402
8715
|
var require_event_handler = __commonJS({
|
|
8403
|
-
"../../node_modules/.pnpm/ioredis@5.
|
|
8716
|
+
"../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/redis/event_handler.js"(exports$1) {
|
|
8404
8717
|
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
8405
8718
|
exports$1.readyHandler = exports$1.errorHandler = exports$1.closeHandler = exports$1.connectHandler = void 0;
|
|
8406
8719
|
var redis_errors_1 = require_redis_errors();
|
|
@@ -8409,15 +8722,15 @@ var require_event_handler = __commonJS({
|
|
|
8409
8722
|
var utils_1 = require_utils2();
|
|
8410
8723
|
var DataHandler_1 = require_DataHandler();
|
|
8411
8724
|
var debug = (0, utils_1.Debug)("connection");
|
|
8412
|
-
function connectHandler(
|
|
8725
|
+
function connectHandler(self2) {
|
|
8413
8726
|
return function() {
|
|
8414
|
-
|
|
8415
|
-
|
|
8727
|
+
self2.setStatus("connect");
|
|
8728
|
+
self2.resetCommandQueue();
|
|
8416
8729
|
let flushed = false;
|
|
8417
|
-
const { connectionEpoch } =
|
|
8418
|
-
if (
|
|
8419
|
-
|
|
8420
|
-
if (connectionEpoch !==
|
|
8730
|
+
const { connectionEpoch } = self2;
|
|
8731
|
+
if (self2.condition.auth) {
|
|
8732
|
+
self2.auth(self2.condition.auth, function(err) {
|
|
8733
|
+
if (connectionEpoch !== self2.connectionEpoch) {
|
|
8421
8734
|
return;
|
|
8422
8735
|
}
|
|
8423
8736
|
if (err) {
|
|
@@ -8429,36 +8742,36 @@ var require_event_handler = __commonJS({
|
|
|
8429
8742
|
console.warn(`[ERROR] The server returned "wrong number of arguments for 'auth' command". You are probably passing both username and password to Redis version 5 or below. You should only pass the 'password' option for Redis version 5 and under.`);
|
|
8430
8743
|
} else {
|
|
8431
8744
|
flushed = true;
|
|
8432
|
-
|
|
8745
|
+
self2.recoverFromFatalError(err, err);
|
|
8433
8746
|
}
|
|
8434
8747
|
}
|
|
8435
8748
|
});
|
|
8436
8749
|
}
|
|
8437
|
-
if (
|
|
8438
|
-
|
|
8439
|
-
|
|
8750
|
+
if (self2.condition.select) {
|
|
8751
|
+
self2.select(self2.condition.select).catch((err) => {
|
|
8752
|
+
self2.silentEmit("error", err);
|
|
8440
8753
|
});
|
|
8441
8754
|
}
|
|
8442
|
-
if (!
|
|
8443
|
-
exports$1.readyHandler(
|
|
8755
|
+
if (!self2.options.enableReadyCheck) {
|
|
8756
|
+
exports$1.readyHandler(self2)();
|
|
8444
8757
|
}
|
|
8445
|
-
new DataHandler_1.default(
|
|
8446
|
-
stringNumbers:
|
|
8758
|
+
new DataHandler_1.default(self2, {
|
|
8759
|
+
stringNumbers: self2.options.stringNumbers
|
|
8447
8760
|
});
|
|
8448
|
-
if (
|
|
8449
|
-
|
|
8450
|
-
if (connectionEpoch !==
|
|
8761
|
+
if (self2.options.enableReadyCheck) {
|
|
8762
|
+
self2._readyCheck(function(err, info) {
|
|
8763
|
+
if (connectionEpoch !== self2.connectionEpoch) {
|
|
8451
8764
|
return;
|
|
8452
8765
|
}
|
|
8453
8766
|
if (err) {
|
|
8454
8767
|
if (!flushed) {
|
|
8455
|
-
|
|
8768
|
+
self2.recoverFromFatalError(new Error("Ready check failed: " + err.message), err);
|
|
8456
8769
|
}
|
|
8457
8770
|
} else {
|
|
8458
|
-
if (
|
|
8459
|
-
exports$1.readyHandler(
|
|
8771
|
+
if (self2.connector.check(info)) {
|
|
8772
|
+
exports$1.readyHandler(self2)();
|
|
8460
8773
|
} else {
|
|
8461
|
-
|
|
8774
|
+
self2.disconnect(true);
|
|
8462
8775
|
}
|
|
8463
8776
|
}
|
|
8464
8777
|
});
|
|
@@ -8511,152 +8824,152 @@ var require_event_handler = __commonJS({
|
|
|
8511
8824
|
}
|
|
8512
8825
|
}
|
|
8513
8826
|
}
|
|
8514
|
-
function closeHandler(
|
|
8827
|
+
function closeHandler(self2) {
|
|
8515
8828
|
return function() {
|
|
8516
|
-
const prevStatus =
|
|
8517
|
-
|
|
8518
|
-
if (
|
|
8519
|
-
abortIncompletePipelines(
|
|
8829
|
+
const prevStatus = self2.status;
|
|
8830
|
+
self2.setStatus("close");
|
|
8831
|
+
if (self2.commandQueue.length) {
|
|
8832
|
+
abortIncompletePipelines(self2.commandQueue);
|
|
8520
8833
|
}
|
|
8521
|
-
if (
|
|
8522
|
-
abortTransactionFragments(
|
|
8834
|
+
if (self2.offlineQueue.length) {
|
|
8835
|
+
abortTransactionFragments(self2.offlineQueue);
|
|
8523
8836
|
}
|
|
8524
8837
|
if (prevStatus === "ready") {
|
|
8525
|
-
if (!
|
|
8526
|
-
|
|
8838
|
+
if (!self2.prevCondition) {
|
|
8839
|
+
self2.prevCondition = self2.condition;
|
|
8527
8840
|
}
|
|
8528
|
-
if (
|
|
8529
|
-
|
|
8841
|
+
if (self2.commandQueue.length) {
|
|
8842
|
+
self2.prevCommandQueue = self2.commandQueue;
|
|
8530
8843
|
}
|
|
8531
8844
|
}
|
|
8532
|
-
if (
|
|
8533
|
-
|
|
8845
|
+
if (self2.manuallyClosing) {
|
|
8846
|
+
self2.manuallyClosing = false;
|
|
8534
8847
|
debug("skip reconnecting since the connection is manually closed.");
|
|
8535
8848
|
return close();
|
|
8536
8849
|
}
|
|
8537
|
-
if (typeof
|
|
8850
|
+
if (typeof self2.options.retryStrategy !== "function") {
|
|
8538
8851
|
debug("skip reconnecting because `retryStrategy` is not a function");
|
|
8539
8852
|
return close();
|
|
8540
8853
|
}
|
|
8541
|
-
const retryDelay =
|
|
8854
|
+
const retryDelay = self2.options.retryStrategy(++self2.retryAttempts);
|
|
8542
8855
|
if (typeof retryDelay !== "number") {
|
|
8543
8856
|
debug("skip reconnecting because `retryStrategy` doesn't return a number");
|
|
8544
8857
|
return close();
|
|
8545
8858
|
}
|
|
8546
8859
|
debug("reconnect in %sms", retryDelay);
|
|
8547
|
-
|
|
8548
|
-
|
|
8549
|
-
|
|
8550
|
-
|
|
8860
|
+
self2.setStatus("reconnecting", retryDelay);
|
|
8861
|
+
self2.reconnectTimeout = setTimeout(function() {
|
|
8862
|
+
self2.reconnectTimeout = null;
|
|
8863
|
+
self2.connect().catch(utils_1.noop);
|
|
8551
8864
|
}, retryDelay);
|
|
8552
|
-
const { maxRetriesPerRequest } =
|
|
8865
|
+
const { maxRetriesPerRequest } = self2.options;
|
|
8553
8866
|
if (typeof maxRetriesPerRequest === "number") {
|
|
8554
8867
|
if (maxRetriesPerRequest < 0) {
|
|
8555
8868
|
debug("maxRetriesPerRequest is negative, ignoring...");
|
|
8556
8869
|
} else {
|
|
8557
|
-
const remainder =
|
|
8870
|
+
const remainder = self2.retryAttempts % (maxRetriesPerRequest + 1);
|
|
8558
8871
|
if (remainder === 0) {
|
|
8559
8872
|
debug("reach maxRetriesPerRequest limitation, flushing command queue...");
|
|
8560
|
-
|
|
8873
|
+
self2.flushQueue(new errors_1.MaxRetriesPerRequestError(maxRetriesPerRequest));
|
|
8561
8874
|
}
|
|
8562
8875
|
}
|
|
8563
8876
|
}
|
|
8564
8877
|
};
|
|
8565
8878
|
function close() {
|
|
8566
|
-
|
|
8567
|
-
|
|
8879
|
+
self2.setStatus("end");
|
|
8880
|
+
self2.flushQueue(new Error(utils_1.CONNECTION_CLOSED_ERROR_MSG));
|
|
8568
8881
|
}
|
|
8569
8882
|
}
|
|
8570
8883
|
exports$1.closeHandler = closeHandler;
|
|
8571
|
-
function errorHandler(
|
|
8884
|
+
function errorHandler(self2) {
|
|
8572
8885
|
return function(error) {
|
|
8573
8886
|
debug("error: %s", error);
|
|
8574
|
-
|
|
8887
|
+
self2.silentEmit("error", error);
|
|
8575
8888
|
};
|
|
8576
8889
|
}
|
|
8577
8890
|
exports$1.errorHandler = errorHandler;
|
|
8578
|
-
function readyHandler(
|
|
8891
|
+
function readyHandler(self2) {
|
|
8579
8892
|
return function() {
|
|
8580
|
-
|
|
8581
|
-
|
|
8582
|
-
if (
|
|
8583
|
-
|
|
8584
|
-
const { sendCommand } =
|
|
8585
|
-
|
|
8893
|
+
self2.setStatus("ready");
|
|
8894
|
+
self2.retryAttempts = 0;
|
|
8895
|
+
if (self2.options.monitor) {
|
|
8896
|
+
self2.call("monitor").then(() => self2.setStatus("monitoring"), (error) => self2.emit("error", error));
|
|
8897
|
+
const { sendCommand } = self2;
|
|
8898
|
+
self2.sendCommand = function(command) {
|
|
8586
8899
|
if (Command_1.default.checkFlag("VALID_IN_MONITOR_MODE", command.name)) {
|
|
8587
|
-
return sendCommand.call(
|
|
8900
|
+
return sendCommand.call(self2, command);
|
|
8588
8901
|
}
|
|
8589
8902
|
command.reject(new Error("Connection is in monitoring mode, can't process commands."));
|
|
8590
8903
|
return command.promise;
|
|
8591
8904
|
};
|
|
8592
|
-
|
|
8593
|
-
delete
|
|
8905
|
+
self2.once("close", function() {
|
|
8906
|
+
delete self2.sendCommand;
|
|
8594
8907
|
});
|
|
8595
8908
|
return;
|
|
8596
8909
|
}
|
|
8597
|
-
const finalSelect =
|
|
8598
|
-
if (
|
|
8599
|
-
debug("set the connection name [%s]",
|
|
8600
|
-
|
|
8910
|
+
const finalSelect = self2.prevCondition ? self2.prevCondition.select : self2.condition.select;
|
|
8911
|
+
if (self2.options.connectionName) {
|
|
8912
|
+
debug("set the connection name [%s]", self2.options.connectionName);
|
|
8913
|
+
self2.client("setname", self2.options.connectionName).catch(utils_1.noop);
|
|
8601
8914
|
}
|
|
8602
|
-
if (
|
|
8915
|
+
if (self2.options.readOnly) {
|
|
8603
8916
|
debug("set the connection to readonly mode");
|
|
8604
|
-
|
|
8917
|
+
self2.readonly().catch(utils_1.noop);
|
|
8605
8918
|
}
|
|
8606
|
-
if (
|
|
8607
|
-
const condition =
|
|
8608
|
-
|
|
8609
|
-
if (condition.subscriber &&
|
|
8610
|
-
if (
|
|
8919
|
+
if (self2.prevCondition) {
|
|
8920
|
+
const condition = self2.prevCondition;
|
|
8921
|
+
self2.prevCondition = null;
|
|
8922
|
+
if (condition.subscriber && self2.options.autoResubscribe) {
|
|
8923
|
+
if (self2.condition.select !== finalSelect) {
|
|
8611
8924
|
debug("connect to db [%d]", finalSelect);
|
|
8612
|
-
|
|
8925
|
+
self2.select(finalSelect);
|
|
8613
8926
|
}
|
|
8614
8927
|
const subscribeChannels = condition.subscriber.channels("subscribe");
|
|
8615
8928
|
if (subscribeChannels.length) {
|
|
8616
8929
|
debug("subscribe %d channels", subscribeChannels.length);
|
|
8617
|
-
|
|
8930
|
+
self2.subscribe(subscribeChannels);
|
|
8618
8931
|
}
|
|
8619
8932
|
const psubscribeChannels = condition.subscriber.channels("psubscribe");
|
|
8620
8933
|
if (psubscribeChannels.length) {
|
|
8621
8934
|
debug("psubscribe %d channels", psubscribeChannels.length);
|
|
8622
|
-
|
|
8935
|
+
self2.psubscribe(psubscribeChannels);
|
|
8623
8936
|
}
|
|
8624
8937
|
const ssubscribeChannels = condition.subscriber.channels("ssubscribe");
|
|
8625
8938
|
if (ssubscribeChannels.length) {
|
|
8626
8939
|
debug("ssubscribe %d channels", ssubscribeChannels.length);
|
|
8627
|
-
|
|
8940
|
+
self2.ssubscribe(ssubscribeChannels);
|
|
8628
8941
|
}
|
|
8629
8942
|
}
|
|
8630
8943
|
}
|
|
8631
|
-
if (
|
|
8632
|
-
if (
|
|
8633
|
-
debug("resend %d unfulfilled commands",
|
|
8634
|
-
while (
|
|
8635
|
-
const item =
|
|
8636
|
-
if (item.select !==
|
|
8637
|
-
|
|
8944
|
+
if (self2.prevCommandQueue) {
|
|
8945
|
+
if (self2.options.autoResendUnfulfilledCommands) {
|
|
8946
|
+
debug("resend %d unfulfilled commands", self2.prevCommandQueue.length);
|
|
8947
|
+
while (self2.prevCommandQueue.length > 0) {
|
|
8948
|
+
const item = self2.prevCommandQueue.shift();
|
|
8949
|
+
if (item.select !== self2.condition.select && item.command.name !== "select") {
|
|
8950
|
+
self2.select(item.select);
|
|
8638
8951
|
}
|
|
8639
|
-
|
|
8952
|
+
self2.sendCommand(item.command, item.stream);
|
|
8640
8953
|
}
|
|
8641
8954
|
} else {
|
|
8642
|
-
|
|
8955
|
+
self2.prevCommandQueue = null;
|
|
8643
8956
|
}
|
|
8644
8957
|
}
|
|
8645
|
-
if (
|
|
8646
|
-
debug("send %d commands in offline queue",
|
|
8647
|
-
const offlineQueue =
|
|
8648
|
-
|
|
8958
|
+
if (self2.offlineQueue.length) {
|
|
8959
|
+
debug("send %d commands in offline queue", self2.offlineQueue.length);
|
|
8960
|
+
const offlineQueue = self2.offlineQueue;
|
|
8961
|
+
self2.resetOfflineQueue();
|
|
8649
8962
|
while (offlineQueue.length > 0) {
|
|
8650
8963
|
const item = offlineQueue.shift();
|
|
8651
|
-
if (item.select !==
|
|
8652
|
-
|
|
8964
|
+
if (item.select !== self2.condition.select && item.command.name !== "select") {
|
|
8965
|
+
self2.select(item.select);
|
|
8653
8966
|
}
|
|
8654
|
-
|
|
8967
|
+
self2.sendCommand(item.command, item.stream);
|
|
8655
8968
|
}
|
|
8656
8969
|
}
|
|
8657
|
-
if (
|
|
8970
|
+
if (self2.condition.select !== finalSelect) {
|
|
8658
8971
|
debug("connect to db [%d]", finalSelect);
|
|
8659
|
-
|
|
8972
|
+
self2.select(finalSelect);
|
|
8660
8973
|
}
|
|
8661
8974
|
};
|
|
8662
8975
|
}
|
|
@@ -8664,9 +8977,9 @@ var require_event_handler = __commonJS({
|
|
|
8664
8977
|
}
|
|
8665
8978
|
});
|
|
8666
8979
|
|
|
8667
|
-
// ../../node_modules/.pnpm/ioredis@5.
|
|
8980
|
+
// ../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/redis/RedisOptions.js
|
|
8668
8981
|
var require_RedisOptions = __commonJS({
|
|
8669
|
-
"../../node_modules/.pnpm/ioredis@5.
|
|
8982
|
+
"../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/redis/RedisOptions.js"(exports$1) {
|
|
8670
8983
|
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
8671
8984
|
exports$1.DEFAULT_REDIS_OPTIONS = void 0;
|
|
8672
8985
|
exports$1.DEFAULT_REDIS_OPTIONS = {
|
|
@@ -8719,9 +9032,9 @@ var require_RedisOptions = __commonJS({
|
|
|
8719
9032
|
}
|
|
8720
9033
|
});
|
|
8721
9034
|
|
|
8722
|
-
// ../../node_modules/.pnpm/ioredis@5.
|
|
9035
|
+
// ../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/Redis.js
|
|
8723
9036
|
var require_Redis = __commonJS({
|
|
8724
|
-
"../../node_modules/.pnpm/ioredis@5.
|
|
9037
|
+
"../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/Redis.js"(exports$1) {
|
|
8725
9038
|
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
8726
9039
|
var commands_1 = require_built();
|
|
8727
9040
|
var events_1 = __require("events");
|
|
@@ -9058,6 +9371,9 @@ var require_Redis = __commonJS({
|
|
|
9058
9371
|
if (Command_1.default.checkFlag("WILL_DISCONNECT", command.name)) {
|
|
9059
9372
|
this.manuallyClosing = true;
|
|
9060
9373
|
}
|
|
9374
|
+
if (this.options.socketTimeout !== void 0 && this.socketTimeoutTimer === void 0) {
|
|
9375
|
+
this.setSocketTimeout();
|
|
9376
|
+
}
|
|
9061
9377
|
}
|
|
9062
9378
|
if (command.name === "select" && (0, utils_1.isInt)(command.args[0])) {
|
|
9063
9379
|
const db = parseInt(command.args[0], 10);
|
|
@@ -9069,6 +9385,19 @@ var require_Redis = __commonJS({
|
|
|
9069
9385
|
}
|
|
9070
9386
|
return command.promise;
|
|
9071
9387
|
}
|
|
9388
|
+
setSocketTimeout() {
|
|
9389
|
+
this.socketTimeoutTimer = setTimeout(() => {
|
|
9390
|
+
this.stream.destroy(new Error(`Socket timeout. Expecting data, but didn't receive any in ${this.options.socketTimeout}ms.`));
|
|
9391
|
+
this.socketTimeoutTimer = void 0;
|
|
9392
|
+
}, this.options.socketTimeout);
|
|
9393
|
+
this.stream.once("data", () => {
|
|
9394
|
+
clearTimeout(this.socketTimeoutTimer);
|
|
9395
|
+
this.socketTimeoutTimer = void 0;
|
|
9396
|
+
if (this.commandQueue.length === 0)
|
|
9397
|
+
return;
|
|
9398
|
+
this.setSocketTimeout();
|
|
9399
|
+
});
|
|
9400
|
+
}
|
|
9072
9401
|
scanStream(options) {
|
|
9073
9402
|
return this.createScanStream("scan", { options });
|
|
9074
9403
|
}
|
|
@@ -9312,9 +9641,9 @@ var require_Redis = __commonJS({
|
|
|
9312
9641
|
}
|
|
9313
9642
|
});
|
|
9314
9643
|
|
|
9315
|
-
// ../../node_modules/.pnpm/ioredis@5.
|
|
9644
|
+
// ../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/index.js
|
|
9316
9645
|
var require_built3 = __commonJS({
|
|
9317
|
-
"../../node_modules/.pnpm/ioredis@5.
|
|
9646
|
+
"../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/index.js"(exports$1, module) {
|
|
9318
9647
|
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
9319
9648
|
exports$1.print = exports$1.ReplyError = exports$1.SentinelIterator = exports$1.SentinelConnector = exports$1.AbstractConnector = exports$1.Pipeline = exports$1.ScanStream = exports$1.Command = exports$1.Cluster = exports$1.Redis = exports$1.default = void 0;
|
|
9320
9649
|
exports$1 = module.exports = require_Redis().default;
|
|
@@ -9952,24 +10281,19 @@ var SimpleQueue = class {
|
|
|
9952
10281
|
}
|
|
9953
10282
|
};
|
|
9954
10283
|
|
|
9955
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.
|
|
9956
|
-
var
|
|
10284
|
+
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/version.js
|
|
10285
|
+
var VERSION = "1.9.1";
|
|
9957
10286
|
|
|
9958
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.
|
|
9959
|
-
var VERSION = "1.9.0";
|
|
9960
|
-
|
|
9961
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/internal/semver.js
|
|
10287
|
+
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/internal/semver.js
|
|
9962
10288
|
var re = /^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;
|
|
9963
10289
|
function _makeCompatibilityCheck(ownVersion) {
|
|
9964
|
-
|
|
9965
|
-
|
|
9966
|
-
|
|
10290
|
+
const acceptedVersions = /* @__PURE__ */ new Set([ownVersion]);
|
|
10291
|
+
const rejectedVersions = /* @__PURE__ */ new Set();
|
|
10292
|
+
const myVersionMatch = ownVersion.match(re);
|
|
9967
10293
|
if (!myVersionMatch) {
|
|
9968
|
-
return
|
|
9969
|
-
return false;
|
|
9970
|
-
};
|
|
10294
|
+
return () => false;
|
|
9971
10295
|
}
|
|
9972
|
-
|
|
10296
|
+
const ownVersionParsed = {
|
|
9973
10297
|
major: +myVersionMatch[1],
|
|
9974
10298
|
minor: +myVersionMatch[2],
|
|
9975
10299
|
patch: +myVersionMatch[3],
|
|
@@ -9995,11 +10319,11 @@ function _makeCompatibilityCheck(ownVersion) {
|
|
|
9995
10319
|
if (rejectedVersions.has(globalVersion)) {
|
|
9996
10320
|
return false;
|
|
9997
10321
|
}
|
|
9998
|
-
|
|
10322
|
+
const globalVersionMatch = globalVersion.match(re);
|
|
9999
10323
|
if (!globalVersionMatch) {
|
|
10000
10324
|
return _reject(globalVersion);
|
|
10001
10325
|
}
|
|
10002
|
-
|
|
10326
|
+
const globalVersionParsed = {
|
|
10003
10327
|
major: +globalVersionMatch[1],
|
|
10004
10328
|
minor: +globalVersionMatch[2],
|
|
10005
10329
|
patch: +globalVersionMatch[3],
|
|
@@ -10025,129 +10349,75 @@ function _makeCompatibilityCheck(ownVersion) {
|
|
|
10025
10349
|
}
|
|
10026
10350
|
var isCompatible = _makeCompatibilityCheck(VERSION);
|
|
10027
10351
|
|
|
10028
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.
|
|
10352
|
+
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/internal/global-utils.js
|
|
10029
10353
|
var major = VERSION.split(".")[0];
|
|
10030
|
-
var GLOBAL_OPENTELEMETRY_API_KEY = Symbol.for(
|
|
10031
|
-
var _global =
|
|
10032
|
-
function registerGlobal(type, instance, diag, allowOverride) {
|
|
10354
|
+
var GLOBAL_OPENTELEMETRY_API_KEY = Symbol.for(`opentelemetry.js.api.${major}`);
|
|
10355
|
+
var _global = typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : typeof window === "object" ? window : typeof global === "object" ? global : {};
|
|
10356
|
+
function registerGlobal(type, instance, diag, allowOverride = false) {
|
|
10033
10357
|
var _a;
|
|
10034
|
-
|
|
10035
|
-
allowOverride = false;
|
|
10036
|
-
}
|
|
10037
|
-
var api = _global[GLOBAL_OPENTELEMETRY_API_KEY] = (_a = _global[GLOBAL_OPENTELEMETRY_API_KEY]) !== null && _a !== void 0 ? _a : {
|
|
10358
|
+
const api = _global[GLOBAL_OPENTELEMETRY_API_KEY] = (_a = _global[GLOBAL_OPENTELEMETRY_API_KEY]) !== null && _a !== void 0 ? _a : {
|
|
10038
10359
|
version: VERSION
|
|
10039
10360
|
};
|
|
10040
10361
|
if (!allowOverride && api[type]) {
|
|
10041
|
-
|
|
10362
|
+
const err = new Error(`@opentelemetry/api: Attempted duplicate registration of API: ${type}`);
|
|
10042
10363
|
diag.error(err.stack || err.message);
|
|
10043
10364
|
return false;
|
|
10044
10365
|
}
|
|
10045
10366
|
if (api.version !== VERSION) {
|
|
10046
|
-
|
|
10367
|
+
const err = new Error(`@opentelemetry/api: Registration of version v${api.version} for ${type} does not match previously registered API v${VERSION}`);
|
|
10047
10368
|
diag.error(err.stack || err.message);
|
|
10048
10369
|
return false;
|
|
10049
10370
|
}
|
|
10050
10371
|
api[type] = instance;
|
|
10051
|
-
diag.debug(
|
|
10372
|
+
diag.debug(`@opentelemetry/api: Registered a global for ${type} v${VERSION}.`);
|
|
10052
10373
|
return true;
|
|
10053
10374
|
}
|
|
10054
10375
|
function getGlobal(type) {
|
|
10055
10376
|
var _a, _b;
|
|
10056
|
-
|
|
10377
|
+
const globalVersion = (_a = _global[GLOBAL_OPENTELEMETRY_API_KEY]) === null || _a === void 0 ? void 0 : _a.version;
|
|
10057
10378
|
if (!globalVersion || !isCompatible(globalVersion)) {
|
|
10058
10379
|
return;
|
|
10059
10380
|
}
|
|
10060
10381
|
return (_b = _global[GLOBAL_OPENTELEMETRY_API_KEY]) === null || _b === void 0 ? void 0 : _b[type];
|
|
10061
10382
|
}
|
|
10062
10383
|
function unregisterGlobal(type, diag) {
|
|
10063
|
-
diag.debug(
|
|
10064
|
-
|
|
10384
|
+
diag.debug(`@opentelemetry/api: Unregistering a global for ${type} v${VERSION}.`);
|
|
10385
|
+
const api = _global[GLOBAL_OPENTELEMETRY_API_KEY];
|
|
10065
10386
|
if (api) {
|
|
10066
10387
|
delete api[type];
|
|
10067
10388
|
}
|
|
10068
10389
|
}
|
|
10069
10390
|
|
|
10070
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.
|
|
10071
|
-
var
|
|
10072
|
-
|
|
10073
|
-
|
|
10074
|
-
var i = m.call(o), r, ar = [], e;
|
|
10075
|
-
try {
|
|
10076
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
10077
|
-
} catch (error) {
|
|
10078
|
-
e = { error };
|
|
10079
|
-
} finally {
|
|
10080
|
-
try {
|
|
10081
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
10082
|
-
} finally {
|
|
10083
|
-
if (e) throw e.error;
|
|
10084
|
-
}
|
|
10391
|
+
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/diag/ComponentLogger.js
|
|
10392
|
+
var DiagComponentLogger = class {
|
|
10393
|
+
constructor(props) {
|
|
10394
|
+
this._namespace = props.namespace || "DiagComponentLogger";
|
|
10085
10395
|
}
|
|
10086
|
-
|
|
10087
|
-
|
|
10088
|
-
|
|
10089
|
-
|
|
10090
|
-
|
|
10091
|
-
|
|
10092
|
-
|
|
10093
|
-
|
|
10396
|
+
debug(...args) {
|
|
10397
|
+
return logProxy("debug", this._namespace, args);
|
|
10398
|
+
}
|
|
10399
|
+
error(...args) {
|
|
10400
|
+
return logProxy("error", this._namespace, args);
|
|
10401
|
+
}
|
|
10402
|
+
info(...args) {
|
|
10403
|
+
return logProxy("info", this._namespace, args);
|
|
10404
|
+
}
|
|
10405
|
+
warn(...args) {
|
|
10406
|
+
return logProxy("warn", this._namespace, args);
|
|
10407
|
+
}
|
|
10408
|
+
verbose(...args) {
|
|
10409
|
+
return logProxy("verbose", this._namespace, args);
|
|
10094
10410
|
}
|
|
10095
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
10096
10411
|
};
|
|
10097
|
-
var DiagComponentLogger = (
|
|
10098
|
-
/** @class */
|
|
10099
|
-
function() {
|
|
10100
|
-
function DiagComponentLogger2(props) {
|
|
10101
|
-
this._namespace = props.namespace || "DiagComponentLogger";
|
|
10102
|
-
}
|
|
10103
|
-
DiagComponentLogger2.prototype.debug = function() {
|
|
10104
|
-
var args = [];
|
|
10105
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
10106
|
-
args[_i] = arguments[_i];
|
|
10107
|
-
}
|
|
10108
|
-
return logProxy("debug", this._namespace, args);
|
|
10109
|
-
};
|
|
10110
|
-
DiagComponentLogger2.prototype.error = function() {
|
|
10111
|
-
var args = [];
|
|
10112
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
10113
|
-
args[_i] = arguments[_i];
|
|
10114
|
-
}
|
|
10115
|
-
return logProxy("error", this._namespace, args);
|
|
10116
|
-
};
|
|
10117
|
-
DiagComponentLogger2.prototype.info = function() {
|
|
10118
|
-
var args = [];
|
|
10119
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
10120
|
-
args[_i] = arguments[_i];
|
|
10121
|
-
}
|
|
10122
|
-
return logProxy("info", this._namespace, args);
|
|
10123
|
-
};
|
|
10124
|
-
DiagComponentLogger2.prototype.warn = function() {
|
|
10125
|
-
var args = [];
|
|
10126
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
10127
|
-
args[_i] = arguments[_i];
|
|
10128
|
-
}
|
|
10129
|
-
return logProxy("warn", this._namespace, args);
|
|
10130
|
-
};
|
|
10131
|
-
DiagComponentLogger2.prototype.verbose = function() {
|
|
10132
|
-
var args = [];
|
|
10133
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
10134
|
-
args[_i] = arguments[_i];
|
|
10135
|
-
}
|
|
10136
|
-
return logProxy("verbose", this._namespace, args);
|
|
10137
|
-
};
|
|
10138
|
-
return DiagComponentLogger2;
|
|
10139
|
-
}()
|
|
10140
|
-
);
|
|
10141
10412
|
function logProxy(funcName, namespace, args) {
|
|
10142
|
-
|
|
10413
|
+
const logger2 = getGlobal("diag");
|
|
10143
10414
|
if (!logger2) {
|
|
10144
10415
|
return;
|
|
10145
10416
|
}
|
|
10146
|
-
|
|
10147
|
-
return logger2[funcName].apply(logger2, __spreadArray([], __read(args), false));
|
|
10417
|
+
return logger2[funcName](namespace, ...args);
|
|
10148
10418
|
}
|
|
10149
10419
|
|
|
10150
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.
|
|
10420
|
+
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/diag/types.js
|
|
10151
10421
|
var DiagLogLevel;
|
|
10152
10422
|
(function(DiagLogLevel2) {
|
|
10153
10423
|
DiagLogLevel2[DiagLogLevel2["NONE"] = 0] = "NONE";
|
|
@@ -10159,7 +10429,7 @@ var DiagLogLevel;
|
|
|
10159
10429
|
DiagLogLevel2[DiagLogLevel2["ALL"] = 9999] = "ALL";
|
|
10160
10430
|
})(DiagLogLevel || (DiagLogLevel = {}));
|
|
10161
10431
|
|
|
10162
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.
|
|
10432
|
+
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/diag/internal/logLevelLogger.js
|
|
10163
10433
|
function createLogLevelDiagLogger(maxLevel, logger2) {
|
|
10164
10434
|
if (maxLevel < DiagLogLevel.NONE) {
|
|
10165
10435
|
maxLevel = DiagLogLevel.NONE;
|
|
@@ -10168,7 +10438,7 @@ function createLogLevelDiagLogger(maxLevel, logger2) {
|
|
|
10168
10438
|
}
|
|
10169
10439
|
logger2 = logger2 || {};
|
|
10170
10440
|
function _filterFunc(funcName, theLevel) {
|
|
10171
|
-
|
|
10441
|
+
const theFunc = logger2[funcName];
|
|
10172
10442
|
if (typeof theFunc === "function" && maxLevel >= theLevel) {
|
|
10173
10443
|
return theFunc.bind(logger2);
|
|
10174
10444
|
}
|
|
@@ -10184,278 +10454,181 @@ function createLogLevelDiagLogger(maxLevel, logger2) {
|
|
|
10184
10454
|
};
|
|
10185
10455
|
}
|
|
10186
10456
|
|
|
10187
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.
|
|
10188
|
-
var
|
|
10189
|
-
|
|
10190
|
-
|
|
10191
|
-
|
|
10192
|
-
|
|
10193
|
-
|
|
10194
|
-
} catch (error) {
|
|
10195
|
-
e = { error };
|
|
10196
|
-
} finally {
|
|
10197
|
-
try {
|
|
10198
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
10199
|
-
} finally {
|
|
10200
|
-
if (e) throw e.error;
|
|
10457
|
+
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/api/diag.js
|
|
10458
|
+
var API_NAME = "diag";
|
|
10459
|
+
var DiagAPI = class _DiagAPI {
|
|
10460
|
+
/** Get the singleton instance of the DiagAPI API */
|
|
10461
|
+
static instance() {
|
|
10462
|
+
if (!this._instance) {
|
|
10463
|
+
this._instance = new _DiagAPI();
|
|
10201
10464
|
}
|
|
10465
|
+
return this._instance;
|
|
10202
10466
|
}
|
|
10203
|
-
|
|
10204
|
-
|
|
10205
|
-
|
|
10206
|
-
|
|
10207
|
-
|
|
10208
|
-
|
|
10209
|
-
|
|
10467
|
+
/**
|
|
10468
|
+
* Private internal constructor
|
|
10469
|
+
* @private
|
|
10470
|
+
*/
|
|
10471
|
+
constructor() {
|
|
10472
|
+
function _logProxy(funcName) {
|
|
10473
|
+
return function(...args) {
|
|
10474
|
+
const logger2 = getGlobal("diag");
|
|
10475
|
+
if (!logger2)
|
|
10476
|
+
return;
|
|
10477
|
+
return logger2[funcName](...args);
|
|
10478
|
+
};
|
|
10210
10479
|
}
|
|
10211
|
-
|
|
10212
|
-
|
|
10213
|
-
|
|
10214
|
-
|
|
10215
|
-
|
|
10216
|
-
|
|
10217
|
-
|
|
10218
|
-
|
|
10219
|
-
|
|
10220
|
-
|
|
10221
|
-
|
|
10222
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
10223
|
-
args[_i] = arguments[_i];
|
|
10224
|
-
}
|
|
10225
|
-
var logger2 = getGlobal("diag");
|
|
10226
|
-
if (!logger2)
|
|
10227
|
-
return;
|
|
10228
|
-
return logger2[funcName].apply(logger2, __spreadArray2([], __read2(args), false));
|
|
10480
|
+
const self2 = this;
|
|
10481
|
+
const setLogger = (logger2, optionsOrLogLevel = { logLevel: DiagLogLevel.INFO }) => {
|
|
10482
|
+
var _a, _b, _c;
|
|
10483
|
+
if (logger2 === self2) {
|
|
10484
|
+
const err = new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");
|
|
10485
|
+
self2.error((_a = err.stack) !== null && _a !== void 0 ? _a : err.message);
|
|
10486
|
+
return false;
|
|
10487
|
+
}
|
|
10488
|
+
if (typeof optionsOrLogLevel === "number") {
|
|
10489
|
+
optionsOrLogLevel = {
|
|
10490
|
+
logLevel: optionsOrLogLevel
|
|
10229
10491
|
};
|
|
10230
10492
|
}
|
|
10231
|
-
|
|
10232
|
-
|
|
10233
|
-
|
|
10234
|
-
|
|
10235
|
-
|
|
10236
|
-
}
|
|
10237
|
-
if (logger2 === self) {
|
|
10238
|
-
var err = new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");
|
|
10239
|
-
self.error((_a = err.stack) !== null && _a !== void 0 ? _a : err.message);
|
|
10240
|
-
return false;
|
|
10241
|
-
}
|
|
10242
|
-
if (typeof optionsOrLogLevel === "number") {
|
|
10243
|
-
optionsOrLogLevel = {
|
|
10244
|
-
logLevel: optionsOrLogLevel
|
|
10245
|
-
};
|
|
10246
|
-
}
|
|
10247
|
-
var oldLogger = getGlobal("diag");
|
|
10248
|
-
var newLogger = createLogLevelDiagLogger((_b = optionsOrLogLevel.logLevel) !== null && _b !== void 0 ? _b : DiagLogLevel.INFO, logger2);
|
|
10249
|
-
if (oldLogger && !optionsOrLogLevel.suppressOverrideMessage) {
|
|
10250
|
-
var stack = (_c = new Error().stack) !== null && _c !== void 0 ? _c : "<failed to generate stacktrace>";
|
|
10251
|
-
oldLogger.warn("Current logger will be overwritten from " + stack);
|
|
10252
|
-
newLogger.warn("Current logger will overwrite one already registered from " + stack);
|
|
10253
|
-
}
|
|
10254
|
-
return registerGlobal("diag", newLogger, self, true);
|
|
10255
|
-
};
|
|
10256
|
-
self.setLogger = setLogger;
|
|
10257
|
-
self.disable = function() {
|
|
10258
|
-
unregisterGlobal(API_NAME, self);
|
|
10259
|
-
};
|
|
10260
|
-
self.createComponentLogger = function(options) {
|
|
10261
|
-
return new DiagComponentLogger(options);
|
|
10262
|
-
};
|
|
10263
|
-
self.verbose = _logProxy("verbose");
|
|
10264
|
-
self.debug = _logProxy("debug");
|
|
10265
|
-
self.info = _logProxy("info");
|
|
10266
|
-
self.warn = _logProxy("warn");
|
|
10267
|
-
self.error = _logProxy("error");
|
|
10268
|
-
}
|
|
10269
|
-
DiagAPI2.instance = function() {
|
|
10270
|
-
if (!this._instance) {
|
|
10271
|
-
this._instance = new DiagAPI2();
|
|
10493
|
+
const oldLogger = getGlobal("diag");
|
|
10494
|
+
const newLogger = createLogLevelDiagLogger((_b = optionsOrLogLevel.logLevel) !== null && _b !== void 0 ? _b : DiagLogLevel.INFO, logger2);
|
|
10495
|
+
if (oldLogger && !optionsOrLogLevel.suppressOverrideMessage) {
|
|
10496
|
+
const stack = (_c = new Error().stack) !== null && _c !== void 0 ? _c : "<failed to generate stacktrace>";
|
|
10497
|
+
oldLogger.warn(`Current logger will be overwritten from ${stack}`);
|
|
10498
|
+
newLogger.warn(`Current logger will overwrite one already registered from ${stack}`);
|
|
10272
10499
|
}
|
|
10273
|
-
return
|
|
10500
|
+
return registerGlobal("diag", newLogger, self2, true);
|
|
10274
10501
|
};
|
|
10275
|
-
|
|
10276
|
-
|
|
10277
|
-
);
|
|
10502
|
+
self2.setLogger = setLogger;
|
|
10503
|
+
self2.disable = () => {
|
|
10504
|
+
unregisterGlobal(API_NAME, self2);
|
|
10505
|
+
};
|
|
10506
|
+
self2.createComponentLogger = (options) => {
|
|
10507
|
+
return new DiagComponentLogger(options);
|
|
10508
|
+
};
|
|
10509
|
+
self2.verbose = _logProxy("verbose");
|
|
10510
|
+
self2.debug = _logProxy("debug");
|
|
10511
|
+
self2.info = _logProxy("info");
|
|
10512
|
+
self2.warn = _logProxy("warn");
|
|
10513
|
+
self2.error = _logProxy("error");
|
|
10514
|
+
}
|
|
10515
|
+
};
|
|
10278
10516
|
|
|
10279
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.
|
|
10517
|
+
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/context/context.js
|
|
10280
10518
|
function createContextKey(description) {
|
|
10281
10519
|
return Symbol.for(description);
|
|
10282
10520
|
}
|
|
10283
|
-
var BaseContext =
|
|
10284
|
-
/**
|
|
10285
|
-
|
|
10286
|
-
|
|
10287
|
-
|
|
10288
|
-
|
|
10289
|
-
|
|
10290
|
-
|
|
10291
|
-
|
|
10292
|
-
|
|
10293
|
-
|
|
10294
|
-
|
|
10295
|
-
|
|
10296
|
-
|
|
10297
|
-
self.deleteValue = function(key) {
|
|
10298
|
-
var context2 = new BaseContext2(self._currentContext);
|
|
10299
|
-
context2._currentContext.delete(key);
|
|
10300
|
-
return context2;
|
|
10301
|
-
};
|
|
10302
|
-
}
|
|
10303
|
-
return BaseContext2;
|
|
10304
|
-
}()
|
|
10305
|
-
);
|
|
10306
|
-
var ROOT_CONTEXT = new BaseContext();
|
|
10307
|
-
|
|
10308
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/metrics/NoopMeter.js
|
|
10309
|
-
var __extends = /* @__PURE__ */ function() {
|
|
10310
|
-
var extendStatics = function(d, b) {
|
|
10311
|
-
extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
|
|
10312
|
-
d2.__proto__ = b2;
|
|
10313
|
-
} || function(d2, b2) {
|
|
10314
|
-
for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p];
|
|
10315
|
-
};
|
|
10316
|
-
return extendStatics(d, b);
|
|
10317
|
-
};
|
|
10318
|
-
return function(d, b) {
|
|
10319
|
-
if (typeof b !== "function" && b !== null)
|
|
10320
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
10321
|
-
extendStatics(d, b);
|
|
10322
|
-
function __() {
|
|
10323
|
-
this.constructor = d;
|
|
10324
|
-
}
|
|
10325
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
10326
|
-
};
|
|
10327
|
-
}();
|
|
10328
|
-
var NoopMeter = (
|
|
10329
|
-
/** @class */
|
|
10330
|
-
function() {
|
|
10331
|
-
function NoopMeter2() {
|
|
10332
|
-
}
|
|
10333
|
-
NoopMeter2.prototype.createGauge = function(_name, _options) {
|
|
10334
|
-
return NOOP_GAUGE_METRIC;
|
|
10335
|
-
};
|
|
10336
|
-
NoopMeter2.prototype.createHistogram = function(_name, _options) {
|
|
10337
|
-
return NOOP_HISTOGRAM_METRIC;
|
|
10338
|
-
};
|
|
10339
|
-
NoopMeter2.prototype.createCounter = function(_name, _options) {
|
|
10340
|
-
return NOOP_COUNTER_METRIC;
|
|
10341
|
-
};
|
|
10342
|
-
NoopMeter2.prototype.createUpDownCounter = function(_name, _options) {
|
|
10343
|
-
return NOOP_UP_DOWN_COUNTER_METRIC;
|
|
10344
|
-
};
|
|
10345
|
-
NoopMeter2.prototype.createObservableGauge = function(_name, _options) {
|
|
10346
|
-
return NOOP_OBSERVABLE_GAUGE_METRIC;
|
|
10347
|
-
};
|
|
10348
|
-
NoopMeter2.prototype.createObservableCounter = function(_name, _options) {
|
|
10349
|
-
return NOOP_OBSERVABLE_COUNTER_METRIC;
|
|
10350
|
-
};
|
|
10351
|
-
NoopMeter2.prototype.createObservableUpDownCounter = function(_name, _options) {
|
|
10352
|
-
return NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC;
|
|
10353
|
-
};
|
|
10354
|
-
NoopMeter2.prototype.addBatchObservableCallback = function(_callback, _observables) {
|
|
10355
|
-
};
|
|
10356
|
-
NoopMeter2.prototype.removeBatchObservableCallback = function(_callback) {
|
|
10357
|
-
};
|
|
10358
|
-
return NoopMeter2;
|
|
10359
|
-
}()
|
|
10360
|
-
);
|
|
10361
|
-
var NoopMetric = (
|
|
10362
|
-
/** @class */
|
|
10363
|
-
/* @__PURE__ */ function() {
|
|
10364
|
-
function NoopMetric2() {
|
|
10365
|
-
}
|
|
10366
|
-
return NoopMetric2;
|
|
10367
|
-
}()
|
|
10368
|
-
);
|
|
10369
|
-
var NoopCounterMetric = (
|
|
10370
|
-
/** @class */
|
|
10371
|
-
function(_super) {
|
|
10372
|
-
__extends(NoopCounterMetric2, _super);
|
|
10373
|
-
function NoopCounterMetric2() {
|
|
10374
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
10375
|
-
}
|
|
10376
|
-
NoopCounterMetric2.prototype.add = function(_value, _attributes) {
|
|
10377
|
-
};
|
|
10378
|
-
return NoopCounterMetric2;
|
|
10379
|
-
}(NoopMetric)
|
|
10380
|
-
);
|
|
10381
|
-
var NoopUpDownCounterMetric = (
|
|
10382
|
-
/** @class */
|
|
10383
|
-
function(_super) {
|
|
10384
|
-
__extends(NoopUpDownCounterMetric2, _super);
|
|
10385
|
-
function NoopUpDownCounterMetric2() {
|
|
10386
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
10387
|
-
}
|
|
10388
|
-
NoopUpDownCounterMetric2.prototype.add = function(_value, _attributes) {
|
|
10389
|
-
};
|
|
10390
|
-
return NoopUpDownCounterMetric2;
|
|
10391
|
-
}(NoopMetric)
|
|
10392
|
-
);
|
|
10393
|
-
var NoopGaugeMetric = (
|
|
10394
|
-
/** @class */
|
|
10395
|
-
function(_super) {
|
|
10396
|
-
__extends(NoopGaugeMetric2, _super);
|
|
10397
|
-
function NoopGaugeMetric2() {
|
|
10398
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
10399
|
-
}
|
|
10400
|
-
NoopGaugeMetric2.prototype.record = function(_value, _attributes) {
|
|
10401
|
-
};
|
|
10402
|
-
return NoopGaugeMetric2;
|
|
10403
|
-
}(NoopMetric)
|
|
10404
|
-
);
|
|
10405
|
-
var NoopHistogramMetric = (
|
|
10406
|
-
/** @class */
|
|
10407
|
-
function(_super) {
|
|
10408
|
-
__extends(NoopHistogramMetric2, _super);
|
|
10409
|
-
function NoopHistogramMetric2() {
|
|
10410
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
10411
|
-
}
|
|
10412
|
-
NoopHistogramMetric2.prototype.record = function(_value, _attributes) {
|
|
10413
|
-
};
|
|
10414
|
-
return NoopHistogramMetric2;
|
|
10415
|
-
}(NoopMetric)
|
|
10416
|
-
);
|
|
10417
|
-
var NoopObservableMetric = (
|
|
10418
|
-
/** @class */
|
|
10419
|
-
function() {
|
|
10420
|
-
function NoopObservableMetric2() {
|
|
10421
|
-
}
|
|
10422
|
-
NoopObservableMetric2.prototype.addCallback = function(_callback) {
|
|
10521
|
+
var BaseContext = class _BaseContext {
|
|
10522
|
+
/**
|
|
10523
|
+
* Construct a new context which inherits values from an optional parent context.
|
|
10524
|
+
*
|
|
10525
|
+
* @param parentContext a context from which to inherit values
|
|
10526
|
+
*/
|
|
10527
|
+
constructor(parentContext) {
|
|
10528
|
+
const self2 = this;
|
|
10529
|
+
self2._currentContext = parentContext ? new Map(parentContext) : /* @__PURE__ */ new Map();
|
|
10530
|
+
self2.getValue = (key) => self2._currentContext.get(key);
|
|
10531
|
+
self2.setValue = (key, value) => {
|
|
10532
|
+
const context2 = new _BaseContext(self2._currentContext);
|
|
10533
|
+
context2._currentContext.set(key, value);
|
|
10534
|
+
return context2;
|
|
10423
10535
|
};
|
|
10424
|
-
|
|
10536
|
+
self2.deleteValue = (key) => {
|
|
10537
|
+
const context2 = new _BaseContext(self2._currentContext);
|
|
10538
|
+
context2._currentContext.delete(key);
|
|
10539
|
+
return context2;
|
|
10425
10540
|
};
|
|
10426
|
-
|
|
10427
|
-
|
|
10428
|
-
);
|
|
10429
|
-
|
|
10430
|
-
|
|
10431
|
-
|
|
10432
|
-
|
|
10433
|
-
|
|
10434
|
-
|
|
10435
|
-
|
|
10436
|
-
|
|
10437
|
-
|
|
10438
|
-
|
|
10439
|
-
|
|
10440
|
-
/**
|
|
10441
|
-
|
|
10442
|
-
|
|
10443
|
-
|
|
10444
|
-
|
|
10445
|
-
|
|
10446
|
-
|
|
10447
|
-
|
|
10448
|
-
|
|
10449
|
-
|
|
10450
|
-
|
|
10451
|
-
|
|
10452
|
-
|
|
10453
|
-
|
|
10454
|
-
|
|
10455
|
-
|
|
10456
|
-
return
|
|
10457
|
-
}
|
|
10458
|
-
|
|
10541
|
+
}
|
|
10542
|
+
};
|
|
10543
|
+
var ROOT_CONTEXT = new BaseContext();
|
|
10544
|
+
|
|
10545
|
+
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/metrics/NoopMeter.js
|
|
10546
|
+
var NoopMeter = class {
|
|
10547
|
+
constructor() {
|
|
10548
|
+
}
|
|
10549
|
+
/**
|
|
10550
|
+
* @see {@link Meter.createGauge}
|
|
10551
|
+
*/
|
|
10552
|
+
createGauge(_name, _options) {
|
|
10553
|
+
return NOOP_GAUGE_METRIC;
|
|
10554
|
+
}
|
|
10555
|
+
/**
|
|
10556
|
+
* @see {@link Meter.createHistogram}
|
|
10557
|
+
*/
|
|
10558
|
+
createHistogram(_name, _options) {
|
|
10559
|
+
return NOOP_HISTOGRAM_METRIC;
|
|
10560
|
+
}
|
|
10561
|
+
/**
|
|
10562
|
+
* @see {@link Meter.createCounter}
|
|
10563
|
+
*/
|
|
10564
|
+
createCounter(_name, _options) {
|
|
10565
|
+
return NOOP_COUNTER_METRIC;
|
|
10566
|
+
}
|
|
10567
|
+
/**
|
|
10568
|
+
* @see {@link Meter.createUpDownCounter}
|
|
10569
|
+
*/
|
|
10570
|
+
createUpDownCounter(_name, _options) {
|
|
10571
|
+
return NOOP_UP_DOWN_COUNTER_METRIC;
|
|
10572
|
+
}
|
|
10573
|
+
/**
|
|
10574
|
+
* @see {@link Meter.createObservableGauge}
|
|
10575
|
+
*/
|
|
10576
|
+
createObservableGauge(_name, _options) {
|
|
10577
|
+
return NOOP_OBSERVABLE_GAUGE_METRIC;
|
|
10578
|
+
}
|
|
10579
|
+
/**
|
|
10580
|
+
* @see {@link Meter.createObservableCounter}
|
|
10581
|
+
*/
|
|
10582
|
+
createObservableCounter(_name, _options) {
|
|
10583
|
+
return NOOP_OBSERVABLE_COUNTER_METRIC;
|
|
10584
|
+
}
|
|
10585
|
+
/**
|
|
10586
|
+
* @see {@link Meter.createObservableUpDownCounter}
|
|
10587
|
+
*/
|
|
10588
|
+
createObservableUpDownCounter(_name, _options) {
|
|
10589
|
+
return NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC;
|
|
10590
|
+
}
|
|
10591
|
+
/**
|
|
10592
|
+
* @see {@link Meter.addBatchObservableCallback}
|
|
10593
|
+
*/
|
|
10594
|
+
addBatchObservableCallback(_callback, _observables) {
|
|
10595
|
+
}
|
|
10596
|
+
/**
|
|
10597
|
+
* @see {@link Meter.removeBatchObservableCallback}
|
|
10598
|
+
*/
|
|
10599
|
+
removeBatchObservableCallback(_callback) {
|
|
10600
|
+
}
|
|
10601
|
+
};
|
|
10602
|
+
var NoopMetric = class {
|
|
10603
|
+
};
|
|
10604
|
+
var NoopCounterMetric = class extends NoopMetric {
|
|
10605
|
+
add(_value, _attributes) {
|
|
10606
|
+
}
|
|
10607
|
+
};
|
|
10608
|
+
var NoopUpDownCounterMetric = class extends NoopMetric {
|
|
10609
|
+
add(_value, _attributes) {
|
|
10610
|
+
}
|
|
10611
|
+
};
|
|
10612
|
+
var NoopGaugeMetric = class extends NoopMetric {
|
|
10613
|
+
record(_value, _attributes) {
|
|
10614
|
+
}
|
|
10615
|
+
};
|
|
10616
|
+
var NoopHistogramMetric = class extends NoopMetric {
|
|
10617
|
+
record(_value, _attributes) {
|
|
10618
|
+
}
|
|
10619
|
+
};
|
|
10620
|
+
var NoopObservableMetric = class {
|
|
10621
|
+
addCallback(_callback) {
|
|
10622
|
+
}
|
|
10623
|
+
removeCallback(_callback) {
|
|
10624
|
+
}
|
|
10625
|
+
};
|
|
10626
|
+
var NoopObservableCounterMetric = class extends NoopObservableMetric {
|
|
10627
|
+
};
|
|
10628
|
+
var NoopObservableGaugeMetric = class extends NoopObservableMetric {
|
|
10629
|
+
};
|
|
10630
|
+
var NoopObservableUpDownCounterMetric = class extends NoopObservableMetric {
|
|
10631
|
+
};
|
|
10459
10632
|
var NOOP_METER = new NoopMeter();
|
|
10460
10633
|
var NOOP_COUNTER_METRIC = new NoopCounterMetric();
|
|
10461
10634
|
var NOOP_GAUGE_METRIC = new NoopGaugeMetric();
|
|
@@ -10465,144 +10638,98 @@ var NOOP_OBSERVABLE_COUNTER_METRIC = new NoopObservableCounterMetric();
|
|
|
10465
10638
|
var NOOP_OBSERVABLE_GAUGE_METRIC = new NoopObservableGaugeMetric();
|
|
10466
10639
|
var NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC = new NoopObservableUpDownCounterMetric();
|
|
10467
10640
|
|
|
10468
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.
|
|
10641
|
+
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/metrics/Metric.js
|
|
10469
10642
|
var ValueType;
|
|
10470
10643
|
(function(ValueType2) {
|
|
10471
10644
|
ValueType2[ValueType2["INT"] = 0] = "INT";
|
|
10472
10645
|
ValueType2[ValueType2["DOUBLE"] = 1] = "DOUBLE";
|
|
10473
10646
|
})(ValueType || (ValueType = {}));
|
|
10474
10647
|
|
|
10475
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.
|
|
10476
|
-
var
|
|
10477
|
-
|
|
10478
|
-
|
|
10479
|
-
var i = m.call(o), r, ar = [], e;
|
|
10480
|
-
try {
|
|
10481
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
10482
|
-
} catch (error) {
|
|
10483
|
-
e = { error };
|
|
10484
|
-
} finally {
|
|
10485
|
-
try {
|
|
10486
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
10487
|
-
} finally {
|
|
10488
|
-
if (e) throw e.error;
|
|
10489
|
-
}
|
|
10648
|
+
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/context/NoopContextManager.js
|
|
10649
|
+
var NoopContextManager = class {
|
|
10650
|
+
active() {
|
|
10651
|
+
return ROOT_CONTEXT;
|
|
10490
10652
|
}
|
|
10491
|
-
|
|
10492
|
-
|
|
10493
|
-
var __spreadArray3 = function(to, from, pack) {
|
|
10494
|
-
if (arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
10495
|
-
if (ar || !(i in from)) {
|
|
10496
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
10497
|
-
ar[i] = from[i];
|
|
10498
|
-
}
|
|
10653
|
+
with(_context, fn, thisArg, ...args) {
|
|
10654
|
+
return fn.call(thisArg, ...args);
|
|
10499
10655
|
}
|
|
10500
|
-
|
|
10501
|
-
|
|
10502
|
-
var NoopContextManager = (
|
|
10503
|
-
/** @class */
|
|
10504
|
-
function() {
|
|
10505
|
-
function NoopContextManager2() {
|
|
10506
|
-
}
|
|
10507
|
-
NoopContextManager2.prototype.active = function() {
|
|
10508
|
-
return ROOT_CONTEXT;
|
|
10509
|
-
};
|
|
10510
|
-
NoopContextManager2.prototype.with = function(_context, fn, thisArg) {
|
|
10511
|
-
var args = [];
|
|
10512
|
-
for (var _i = 3; _i < arguments.length; _i++) {
|
|
10513
|
-
args[_i - 3] = arguments[_i];
|
|
10514
|
-
}
|
|
10515
|
-
return fn.call.apply(fn, __spreadArray3([thisArg], __read3(args), false));
|
|
10516
|
-
};
|
|
10517
|
-
NoopContextManager2.prototype.bind = function(_context, target) {
|
|
10518
|
-
return target;
|
|
10519
|
-
};
|
|
10520
|
-
NoopContextManager2.prototype.enable = function() {
|
|
10521
|
-
return this;
|
|
10522
|
-
};
|
|
10523
|
-
NoopContextManager2.prototype.disable = function() {
|
|
10524
|
-
return this;
|
|
10525
|
-
};
|
|
10526
|
-
return NoopContextManager2;
|
|
10527
|
-
}()
|
|
10528
|
-
);
|
|
10529
|
-
|
|
10530
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/api/context.js
|
|
10531
|
-
var __read4 = function(o, n) {
|
|
10532
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
10533
|
-
if (!m) return o;
|
|
10534
|
-
var i = m.call(o), r, ar = [], e;
|
|
10535
|
-
try {
|
|
10536
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
10537
|
-
} catch (error) {
|
|
10538
|
-
e = { error };
|
|
10539
|
-
} finally {
|
|
10540
|
-
try {
|
|
10541
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
10542
|
-
} finally {
|
|
10543
|
-
if (e) throw e.error;
|
|
10544
|
-
}
|
|
10656
|
+
bind(_context, target) {
|
|
10657
|
+
return target;
|
|
10545
10658
|
}
|
|
10546
|
-
|
|
10547
|
-
|
|
10548
|
-
|
|
10549
|
-
|
|
10550
|
-
|
|
10551
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
10552
|
-
ar[i] = from[i];
|
|
10553
|
-
}
|
|
10659
|
+
enable() {
|
|
10660
|
+
return this;
|
|
10661
|
+
}
|
|
10662
|
+
disable() {
|
|
10663
|
+
return this;
|
|
10554
10664
|
}
|
|
10555
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
10556
10665
|
};
|
|
10666
|
+
|
|
10667
|
+
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/api/context.js
|
|
10557
10668
|
var API_NAME2 = "context";
|
|
10558
10669
|
var NOOP_CONTEXT_MANAGER = new NoopContextManager();
|
|
10559
|
-
var ContextAPI =
|
|
10560
|
-
/**
|
|
10561
|
-
|
|
10562
|
-
|
|
10670
|
+
var ContextAPI = class _ContextAPI {
|
|
10671
|
+
/** Empty private constructor prevents end users from constructing a new instance of the API */
|
|
10672
|
+
constructor() {
|
|
10673
|
+
}
|
|
10674
|
+
/** Get the singleton instance of the Context API */
|
|
10675
|
+
static getInstance() {
|
|
10676
|
+
if (!this._instance) {
|
|
10677
|
+
this._instance = new _ContextAPI();
|
|
10563
10678
|
}
|
|
10564
|
-
|
|
10565
|
-
|
|
10566
|
-
|
|
10567
|
-
|
|
10568
|
-
|
|
10569
|
-
|
|
10570
|
-
|
|
10571
|
-
|
|
10572
|
-
|
|
10573
|
-
|
|
10574
|
-
|
|
10575
|
-
|
|
10576
|
-
|
|
10577
|
-
|
|
10578
|
-
|
|
10579
|
-
|
|
10580
|
-
|
|
10581
|
-
|
|
10582
|
-
|
|
10583
|
-
|
|
10584
|
-
|
|
10585
|
-
|
|
10586
|
-
|
|
10587
|
-
|
|
10588
|
-
|
|
10589
|
-
|
|
10590
|
-
|
|
10591
|
-
|
|
10592
|
-
|
|
10593
|
-
|
|
10594
|
-
|
|
10595
|
-
|
|
10596
|
-
|
|
10679
|
+
return this._instance;
|
|
10680
|
+
}
|
|
10681
|
+
/**
|
|
10682
|
+
* Set the current context manager.
|
|
10683
|
+
*
|
|
10684
|
+
* @returns true if the context manager was successfully registered, else false
|
|
10685
|
+
*/
|
|
10686
|
+
setGlobalContextManager(contextManager) {
|
|
10687
|
+
return registerGlobal(API_NAME2, contextManager, DiagAPI.instance());
|
|
10688
|
+
}
|
|
10689
|
+
/**
|
|
10690
|
+
* Get the currently active context
|
|
10691
|
+
*/
|
|
10692
|
+
active() {
|
|
10693
|
+
return this._getContextManager().active();
|
|
10694
|
+
}
|
|
10695
|
+
/**
|
|
10696
|
+
* Execute a function with an active context
|
|
10697
|
+
*
|
|
10698
|
+
* @param context context to be active during function execution
|
|
10699
|
+
* @param fn function to execute in a context
|
|
10700
|
+
* @param thisArg optional receiver to be used for calling fn
|
|
10701
|
+
* @param args optional arguments forwarded to fn
|
|
10702
|
+
*/
|
|
10703
|
+
with(context2, fn, thisArg, ...args) {
|
|
10704
|
+
return this._getContextManager().with(context2, fn, thisArg, ...args);
|
|
10705
|
+
}
|
|
10706
|
+
/**
|
|
10707
|
+
* Bind a context to a target function or event emitter
|
|
10708
|
+
*
|
|
10709
|
+
* @param context context to bind to the event emitter or function. Defaults to the currently active context
|
|
10710
|
+
* @param target function or event emitter to bind
|
|
10711
|
+
*/
|
|
10712
|
+
bind(context2, target) {
|
|
10713
|
+
return this._getContextManager().bind(context2, target);
|
|
10714
|
+
}
|
|
10715
|
+
_getContextManager() {
|
|
10716
|
+
return getGlobal(API_NAME2) || NOOP_CONTEXT_MANAGER;
|
|
10717
|
+
}
|
|
10718
|
+
/** Disable and remove the global context manager */
|
|
10719
|
+
disable() {
|
|
10720
|
+
this._getContextManager().disable();
|
|
10721
|
+
unregisterGlobal(API_NAME2, DiagAPI.instance());
|
|
10722
|
+
}
|
|
10723
|
+
};
|
|
10597
10724
|
|
|
10598
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.
|
|
10725
|
+
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/trace_flags.js
|
|
10599
10726
|
var TraceFlags;
|
|
10600
10727
|
(function(TraceFlags2) {
|
|
10601
10728
|
TraceFlags2[TraceFlags2["NONE"] = 0] = "NONE";
|
|
10602
10729
|
TraceFlags2[TraceFlags2["SAMPLED"] = 1] = "SAMPLED";
|
|
10603
10730
|
})(TraceFlags || (TraceFlags = {}));
|
|
10604
10731
|
|
|
10605
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.
|
|
10732
|
+
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/invalid-span-constants.js
|
|
10606
10733
|
var INVALID_SPANID = "0000000000000000";
|
|
10607
10734
|
var INVALID_TRACEID = "00000000000000000000000000000000";
|
|
10608
10735
|
var INVALID_SPAN_CONTEXT = {
|
|
@@ -10611,52 +10738,54 @@ var INVALID_SPAN_CONTEXT = {
|
|
|
10611
10738
|
traceFlags: TraceFlags.NONE
|
|
10612
10739
|
};
|
|
10613
10740
|
|
|
10614
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.
|
|
10615
|
-
var NonRecordingSpan =
|
|
10616
|
-
|
|
10617
|
-
|
|
10618
|
-
|
|
10619
|
-
|
|
10620
|
-
|
|
10621
|
-
|
|
10622
|
-
|
|
10623
|
-
|
|
10624
|
-
|
|
10625
|
-
|
|
10626
|
-
|
|
10627
|
-
|
|
10628
|
-
|
|
10629
|
-
|
|
10630
|
-
|
|
10631
|
-
|
|
10632
|
-
|
|
10633
|
-
|
|
10634
|
-
|
|
10635
|
-
|
|
10636
|
-
|
|
10637
|
-
|
|
10638
|
-
|
|
10639
|
-
|
|
10640
|
-
|
|
10641
|
-
|
|
10642
|
-
|
|
10643
|
-
|
|
10644
|
-
|
|
10645
|
-
|
|
10646
|
-
|
|
10647
|
-
|
|
10648
|
-
|
|
10649
|
-
|
|
10650
|
-
|
|
10651
|
-
|
|
10652
|
-
|
|
10653
|
-
|
|
10654
|
-
|
|
10655
|
-
|
|
10656
|
-
|
|
10657
|
-
)
|
|
10741
|
+
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/NonRecordingSpan.js
|
|
10742
|
+
var NonRecordingSpan = class {
|
|
10743
|
+
constructor(spanContext = INVALID_SPAN_CONTEXT) {
|
|
10744
|
+
this._spanContext = spanContext;
|
|
10745
|
+
}
|
|
10746
|
+
// Returns a SpanContext.
|
|
10747
|
+
spanContext() {
|
|
10748
|
+
return this._spanContext;
|
|
10749
|
+
}
|
|
10750
|
+
// By default does nothing
|
|
10751
|
+
setAttribute(_key, _value) {
|
|
10752
|
+
return this;
|
|
10753
|
+
}
|
|
10754
|
+
// By default does nothing
|
|
10755
|
+
setAttributes(_attributes) {
|
|
10756
|
+
return this;
|
|
10757
|
+
}
|
|
10758
|
+
// By default does nothing
|
|
10759
|
+
addEvent(_name, _attributes) {
|
|
10760
|
+
return this;
|
|
10761
|
+
}
|
|
10762
|
+
addLink(_link) {
|
|
10763
|
+
return this;
|
|
10764
|
+
}
|
|
10765
|
+
addLinks(_links) {
|
|
10766
|
+
return this;
|
|
10767
|
+
}
|
|
10768
|
+
// By default does nothing
|
|
10769
|
+
setStatus(_status) {
|
|
10770
|
+
return this;
|
|
10771
|
+
}
|
|
10772
|
+
// By default does nothing
|
|
10773
|
+
updateName(_name) {
|
|
10774
|
+
return this;
|
|
10775
|
+
}
|
|
10776
|
+
// By default does nothing
|
|
10777
|
+
end(_endTime) {
|
|
10778
|
+
}
|
|
10779
|
+
// isRecording always returns false for NonRecordingSpan.
|
|
10780
|
+
isRecording() {
|
|
10781
|
+
return false;
|
|
10782
|
+
}
|
|
10783
|
+
// By default does nothing
|
|
10784
|
+
recordException(_exception, _time) {
|
|
10785
|
+
}
|
|
10786
|
+
};
|
|
10658
10787
|
|
|
10659
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.
|
|
10788
|
+
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/context-utils.js
|
|
10660
10789
|
var SPAN_KEY = createContextKey("OpenTelemetry Context Key SPAN");
|
|
10661
10790
|
function getSpan(context2) {
|
|
10662
10791
|
return context2.getValue(SPAN_KEY) || void 0;
|
|
@@ -10678,14 +10807,126 @@ function getSpanContext(context2) {
|
|
|
10678
10807
|
return (_a = getSpan(context2)) === null || _a === void 0 ? void 0 : _a.spanContext();
|
|
10679
10808
|
}
|
|
10680
10809
|
|
|
10681
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.
|
|
10682
|
-
var
|
|
10683
|
-
|
|
10810
|
+
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/spancontext-utils.js
|
|
10811
|
+
var isHex = new Uint8Array([
|
|
10812
|
+
0,
|
|
10813
|
+
0,
|
|
10814
|
+
0,
|
|
10815
|
+
0,
|
|
10816
|
+
0,
|
|
10817
|
+
0,
|
|
10818
|
+
0,
|
|
10819
|
+
0,
|
|
10820
|
+
0,
|
|
10821
|
+
0,
|
|
10822
|
+
0,
|
|
10823
|
+
0,
|
|
10824
|
+
0,
|
|
10825
|
+
0,
|
|
10826
|
+
0,
|
|
10827
|
+
0,
|
|
10828
|
+
0,
|
|
10829
|
+
0,
|
|
10830
|
+
0,
|
|
10831
|
+
0,
|
|
10832
|
+
0,
|
|
10833
|
+
0,
|
|
10834
|
+
0,
|
|
10835
|
+
0,
|
|
10836
|
+
0,
|
|
10837
|
+
0,
|
|
10838
|
+
0,
|
|
10839
|
+
0,
|
|
10840
|
+
0,
|
|
10841
|
+
0,
|
|
10842
|
+
0,
|
|
10843
|
+
0,
|
|
10844
|
+
0,
|
|
10845
|
+
0,
|
|
10846
|
+
0,
|
|
10847
|
+
0,
|
|
10848
|
+
0,
|
|
10849
|
+
0,
|
|
10850
|
+
0,
|
|
10851
|
+
0,
|
|
10852
|
+
0,
|
|
10853
|
+
0,
|
|
10854
|
+
0,
|
|
10855
|
+
0,
|
|
10856
|
+
0,
|
|
10857
|
+
0,
|
|
10858
|
+
0,
|
|
10859
|
+
0,
|
|
10860
|
+
1,
|
|
10861
|
+
1,
|
|
10862
|
+
1,
|
|
10863
|
+
1,
|
|
10864
|
+
1,
|
|
10865
|
+
1,
|
|
10866
|
+
1,
|
|
10867
|
+
1,
|
|
10868
|
+
1,
|
|
10869
|
+
1,
|
|
10870
|
+
0,
|
|
10871
|
+
0,
|
|
10872
|
+
0,
|
|
10873
|
+
0,
|
|
10874
|
+
0,
|
|
10875
|
+
0,
|
|
10876
|
+
0,
|
|
10877
|
+
1,
|
|
10878
|
+
1,
|
|
10879
|
+
1,
|
|
10880
|
+
1,
|
|
10881
|
+
1,
|
|
10882
|
+
1,
|
|
10883
|
+
0,
|
|
10884
|
+
0,
|
|
10885
|
+
0,
|
|
10886
|
+
0,
|
|
10887
|
+
0,
|
|
10888
|
+
0,
|
|
10889
|
+
0,
|
|
10890
|
+
0,
|
|
10891
|
+
0,
|
|
10892
|
+
0,
|
|
10893
|
+
0,
|
|
10894
|
+
0,
|
|
10895
|
+
0,
|
|
10896
|
+
0,
|
|
10897
|
+
0,
|
|
10898
|
+
0,
|
|
10899
|
+
0,
|
|
10900
|
+
0,
|
|
10901
|
+
0,
|
|
10902
|
+
0,
|
|
10903
|
+
0,
|
|
10904
|
+
0,
|
|
10905
|
+
0,
|
|
10906
|
+
0,
|
|
10907
|
+
0,
|
|
10908
|
+
0,
|
|
10909
|
+
1,
|
|
10910
|
+
1,
|
|
10911
|
+
1,
|
|
10912
|
+
1,
|
|
10913
|
+
1,
|
|
10914
|
+
1
|
|
10915
|
+
]);
|
|
10916
|
+
function isValidHex(id, length) {
|
|
10917
|
+
if (typeof id !== "string" || id.length !== length)
|
|
10918
|
+
return false;
|
|
10919
|
+
let r = 0;
|
|
10920
|
+
for (let i = 0; i < id.length; i += 4) {
|
|
10921
|
+
r += (isHex[id.charCodeAt(i)] | 0) + (isHex[id.charCodeAt(i + 1)] | 0) + (isHex[id.charCodeAt(i + 2)] | 0) + (isHex[id.charCodeAt(i + 3)] | 0);
|
|
10922
|
+
}
|
|
10923
|
+
return r === length;
|
|
10924
|
+
}
|
|
10684
10925
|
function isValidTraceId(traceId) {
|
|
10685
|
-
return
|
|
10926
|
+
return isValidHex(traceId, 32) && traceId !== INVALID_TRACEID;
|
|
10686
10927
|
}
|
|
10687
10928
|
function isValidSpanId(spanId) {
|
|
10688
|
-
return
|
|
10929
|
+
return isValidHex(spanId, 16) && spanId !== INVALID_SPANID;
|
|
10689
10930
|
}
|
|
10690
10931
|
function isSpanContextValid(spanContext) {
|
|
10691
10932
|
return isValidTraceId(spanContext.traceId) && isValidSpanId(spanContext.spanId);
|
|
@@ -10694,129 +10935,115 @@ function wrapSpanContext(spanContext) {
|
|
|
10694
10935
|
return new NonRecordingSpan(spanContext);
|
|
10695
10936
|
}
|
|
10696
10937
|
|
|
10697
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.
|
|
10938
|
+
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/NoopTracer.js
|
|
10698
10939
|
var contextApi = ContextAPI.getInstance();
|
|
10699
|
-
var NoopTracer =
|
|
10700
|
-
|
|
10701
|
-
|
|
10702
|
-
|
|
10703
|
-
|
|
10704
|
-
|
|
10705
|
-
|
|
10706
|
-
|
|
10707
|
-
|
|
10708
|
-
|
|
10709
|
-
|
|
10710
|
-
|
|
10711
|
-
|
|
10712
|
-
|
|
10713
|
-
|
|
10714
|
-
|
|
10715
|
-
|
|
10716
|
-
|
|
10717
|
-
|
|
10718
|
-
|
|
10719
|
-
|
|
10720
|
-
|
|
10721
|
-
|
|
10722
|
-
|
|
10723
|
-
|
|
10724
|
-
|
|
10725
|
-
|
|
10726
|
-
|
|
10727
|
-
|
|
10728
|
-
|
|
10729
|
-
|
|
10730
|
-
|
|
10731
|
-
|
|
10732
|
-
|
|
10733
|
-
|
|
10734
|
-
|
|
10735
|
-
var parentContext = ctx !== null && ctx !== void 0 ? ctx : contextApi.active();
|
|
10736
|
-
var span = this.startSpan(name, opts, parentContext);
|
|
10737
|
-
var contextWithSpanSet = setSpan(parentContext, span);
|
|
10738
|
-
return contextApi.with(contextWithSpanSet, fn, void 0, span);
|
|
10739
|
-
};
|
|
10740
|
-
return NoopTracer2;
|
|
10741
|
-
}()
|
|
10742
|
-
);
|
|
10940
|
+
var NoopTracer = class {
|
|
10941
|
+
// startSpan starts a noop span.
|
|
10942
|
+
startSpan(name, options, context2 = contextApi.active()) {
|
|
10943
|
+
const root = Boolean(options === null || options === void 0 ? void 0 : options.root);
|
|
10944
|
+
if (root) {
|
|
10945
|
+
return new NonRecordingSpan();
|
|
10946
|
+
}
|
|
10947
|
+
const parentFromContext = context2 && getSpanContext(context2);
|
|
10948
|
+
if (isSpanContext(parentFromContext) && isSpanContextValid(parentFromContext)) {
|
|
10949
|
+
return new NonRecordingSpan(parentFromContext);
|
|
10950
|
+
} else {
|
|
10951
|
+
return new NonRecordingSpan();
|
|
10952
|
+
}
|
|
10953
|
+
}
|
|
10954
|
+
startActiveSpan(name, arg2, arg3, arg4) {
|
|
10955
|
+
let opts;
|
|
10956
|
+
let ctx;
|
|
10957
|
+
let fn;
|
|
10958
|
+
if (arguments.length < 2) {
|
|
10959
|
+
return;
|
|
10960
|
+
} else if (arguments.length === 2) {
|
|
10961
|
+
fn = arg2;
|
|
10962
|
+
} else if (arguments.length === 3) {
|
|
10963
|
+
opts = arg2;
|
|
10964
|
+
fn = arg3;
|
|
10965
|
+
} else {
|
|
10966
|
+
opts = arg2;
|
|
10967
|
+
ctx = arg3;
|
|
10968
|
+
fn = arg4;
|
|
10969
|
+
}
|
|
10970
|
+
const parentContext = ctx !== null && ctx !== void 0 ? ctx : contextApi.active();
|
|
10971
|
+
const span = this.startSpan(name, opts, parentContext);
|
|
10972
|
+
const contextWithSpanSet = setSpan(parentContext, span);
|
|
10973
|
+
return contextApi.with(contextWithSpanSet, fn, void 0, span);
|
|
10974
|
+
}
|
|
10975
|
+
};
|
|
10743
10976
|
function isSpanContext(spanContext) {
|
|
10744
|
-
return typeof spanContext === "object" && typeof spanContext["spanId"] === "string" && typeof spanContext["traceId"] === "string" && typeof spanContext["traceFlags"] === "number";
|
|
10977
|
+
return spanContext !== null && typeof spanContext === "object" && "spanId" in spanContext && typeof spanContext["spanId"] === "string" && "traceId" in spanContext && typeof spanContext["traceId"] === "string" && "traceFlags" in spanContext && typeof spanContext["traceFlags"] === "number";
|
|
10745
10978
|
}
|
|
10746
10979
|
|
|
10747
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.
|
|
10980
|
+
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/ProxyTracer.js
|
|
10748
10981
|
var NOOP_TRACER = new NoopTracer();
|
|
10749
|
-
var ProxyTracer =
|
|
10750
|
-
|
|
10751
|
-
|
|
10752
|
-
|
|
10753
|
-
|
|
10754
|
-
|
|
10755
|
-
|
|
10756
|
-
|
|
10757
|
-
|
|
10758
|
-
|
|
10759
|
-
|
|
10760
|
-
|
|
10761
|
-
|
|
10762
|
-
|
|
10763
|
-
|
|
10764
|
-
|
|
10765
|
-
|
|
10766
|
-
|
|
10767
|
-
|
|
10768
|
-
|
|
10769
|
-
var tracer = this._provider.getDelegateTracer(this.name, this.version, this.options);
|
|
10770
|
-
if (!tracer) {
|
|
10771
|
-
return NOOP_TRACER;
|
|
10772
|
-
}
|
|
10773
|
-
this._delegate = tracer;
|
|
10982
|
+
var ProxyTracer = class {
|
|
10983
|
+
constructor(provider, name, version, options) {
|
|
10984
|
+
this._provider = provider;
|
|
10985
|
+
this.name = name;
|
|
10986
|
+
this.version = version;
|
|
10987
|
+
this.options = options;
|
|
10988
|
+
}
|
|
10989
|
+
startSpan(name, options, context2) {
|
|
10990
|
+
return this._getTracer().startSpan(name, options, context2);
|
|
10991
|
+
}
|
|
10992
|
+
startActiveSpan(_name, _options, _context, _fn) {
|
|
10993
|
+
const tracer = this._getTracer();
|
|
10994
|
+
return Reflect.apply(tracer.startActiveSpan, tracer, arguments);
|
|
10995
|
+
}
|
|
10996
|
+
/**
|
|
10997
|
+
* Try to get a tracer from the proxy tracer provider.
|
|
10998
|
+
* If the proxy tracer provider has no delegate, return a noop tracer.
|
|
10999
|
+
*/
|
|
11000
|
+
_getTracer() {
|
|
11001
|
+
if (this._delegate) {
|
|
10774
11002
|
return this._delegate;
|
|
10775
|
-
}
|
|
10776
|
-
|
|
10777
|
-
|
|
10778
|
-
|
|
11003
|
+
}
|
|
11004
|
+
const tracer = this._provider.getDelegateTracer(this.name, this.version, this.options);
|
|
11005
|
+
if (!tracer) {
|
|
11006
|
+
return NOOP_TRACER;
|
|
11007
|
+
}
|
|
11008
|
+
this._delegate = tracer;
|
|
11009
|
+
return this._delegate;
|
|
11010
|
+
}
|
|
11011
|
+
};
|
|
10779
11012
|
|
|
10780
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.
|
|
10781
|
-
var NoopTracerProvider =
|
|
10782
|
-
|
|
10783
|
-
|
|
10784
|
-
|
|
10785
|
-
|
|
10786
|
-
NoopTracerProvider2.prototype.getTracer = function(_name, _version, _options) {
|
|
10787
|
-
return new NoopTracer();
|
|
10788
|
-
};
|
|
10789
|
-
return NoopTracerProvider2;
|
|
10790
|
-
}()
|
|
10791
|
-
);
|
|
11013
|
+
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/NoopTracerProvider.js
|
|
11014
|
+
var NoopTracerProvider = class {
|
|
11015
|
+
getTracer(_name, _version, _options) {
|
|
11016
|
+
return new NoopTracer();
|
|
11017
|
+
}
|
|
11018
|
+
};
|
|
10792
11019
|
|
|
10793
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.
|
|
11020
|
+
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/ProxyTracerProvider.js
|
|
10794
11021
|
var NOOP_TRACER_PROVIDER = new NoopTracerProvider();
|
|
10795
|
-
var ProxyTracerProvider =
|
|
10796
|
-
/**
|
|
10797
|
-
|
|
10798
|
-
|
|
10799
|
-
|
|
10800
|
-
|
|
10801
|
-
|
|
10802
|
-
|
|
10803
|
-
|
|
10804
|
-
|
|
10805
|
-
|
|
10806
|
-
|
|
10807
|
-
|
|
10808
|
-
|
|
10809
|
-
|
|
10810
|
-
|
|
10811
|
-
|
|
10812
|
-
|
|
10813
|
-
|
|
10814
|
-
|
|
10815
|
-
return
|
|
10816
|
-
}
|
|
10817
|
-
|
|
11022
|
+
var ProxyTracerProvider = class {
|
|
11023
|
+
/**
|
|
11024
|
+
* Get a {@link ProxyTracer}
|
|
11025
|
+
*/
|
|
11026
|
+
getTracer(name, version, options) {
|
|
11027
|
+
var _a;
|
|
11028
|
+
return (_a = this.getDelegateTracer(name, version, options)) !== null && _a !== void 0 ? _a : new ProxyTracer(this, name, version, options);
|
|
11029
|
+
}
|
|
11030
|
+
getDelegate() {
|
|
11031
|
+
var _a;
|
|
11032
|
+
return (_a = this._delegate) !== null && _a !== void 0 ? _a : NOOP_TRACER_PROVIDER;
|
|
11033
|
+
}
|
|
11034
|
+
/**
|
|
11035
|
+
* Set the delegate tracer provider
|
|
11036
|
+
*/
|
|
11037
|
+
setDelegate(delegate) {
|
|
11038
|
+
this._delegate = delegate;
|
|
11039
|
+
}
|
|
11040
|
+
getDelegateTracer(name, version, options) {
|
|
11041
|
+
var _a;
|
|
11042
|
+
return (_a = this._delegate) === null || _a === void 0 ? void 0 : _a.getTracer(name, version, options);
|
|
11043
|
+
}
|
|
11044
|
+
};
|
|
10818
11045
|
|
|
10819
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.
|
|
11046
|
+
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/span_kind.js
|
|
10820
11047
|
var SpanKind;
|
|
10821
11048
|
(function(SpanKind2) {
|
|
10822
11049
|
SpanKind2[SpanKind2["INTERNAL"] = 0] = "INTERNAL";
|
|
@@ -10826,7 +11053,7 @@ var SpanKind;
|
|
|
10826
11053
|
SpanKind2[SpanKind2["CONSUMER"] = 4] = "CONSUMER";
|
|
10827
11054
|
})(SpanKind || (SpanKind = {}));
|
|
10828
11055
|
|
|
10829
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.
|
|
11056
|
+
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/status.js
|
|
10830
11057
|
var SpanStatusCode;
|
|
10831
11058
|
(function(SpanStatusCode2) {
|
|
10832
11059
|
SpanStatusCode2[SpanStatusCode2["UNSET"] = 0] = "UNSET";
|
|
@@ -10834,99 +11061,112 @@ var SpanStatusCode;
|
|
|
10834
11061
|
SpanStatusCode2[SpanStatusCode2["ERROR"] = 2] = "ERROR";
|
|
10835
11062
|
})(SpanStatusCode || (SpanStatusCode = {}));
|
|
10836
11063
|
|
|
10837
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.
|
|
11064
|
+
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/context-api.js
|
|
10838
11065
|
var context = ContextAPI.getInstance();
|
|
10839
11066
|
|
|
10840
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.
|
|
10841
|
-
var NoopMeterProvider =
|
|
10842
|
-
|
|
10843
|
-
|
|
10844
|
-
|
|
10845
|
-
|
|
10846
|
-
NoopMeterProvider2.prototype.getMeter = function(_name, _version, _options) {
|
|
10847
|
-
return NOOP_METER;
|
|
10848
|
-
};
|
|
10849
|
-
return NoopMeterProvider2;
|
|
10850
|
-
}()
|
|
10851
|
-
);
|
|
11067
|
+
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/metrics/NoopMeterProvider.js
|
|
11068
|
+
var NoopMeterProvider = class {
|
|
11069
|
+
getMeter(_name, _version, _options) {
|
|
11070
|
+
return NOOP_METER;
|
|
11071
|
+
}
|
|
11072
|
+
};
|
|
10852
11073
|
var NOOP_METER_PROVIDER = new NoopMeterProvider();
|
|
10853
11074
|
|
|
10854
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.
|
|
11075
|
+
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/api/metrics.js
|
|
10855
11076
|
var API_NAME3 = "metrics";
|
|
10856
|
-
var MetricsAPI =
|
|
10857
|
-
/**
|
|
10858
|
-
|
|
10859
|
-
|
|
11077
|
+
var MetricsAPI = class _MetricsAPI {
|
|
11078
|
+
/** Empty private constructor prevents end users from constructing a new instance of the API */
|
|
11079
|
+
constructor() {
|
|
11080
|
+
}
|
|
11081
|
+
/** Get the singleton instance of the Metrics API */
|
|
11082
|
+
static getInstance() {
|
|
11083
|
+
if (!this._instance) {
|
|
11084
|
+
this._instance = new _MetricsAPI();
|
|
10860
11085
|
}
|
|
10861
|
-
|
|
10862
|
-
|
|
10863
|
-
|
|
10864
|
-
|
|
10865
|
-
|
|
10866
|
-
|
|
10867
|
-
|
|
10868
|
-
|
|
10869
|
-
|
|
10870
|
-
|
|
10871
|
-
|
|
10872
|
-
|
|
10873
|
-
|
|
10874
|
-
|
|
10875
|
-
|
|
10876
|
-
|
|
10877
|
-
|
|
10878
|
-
|
|
10879
|
-
|
|
10880
|
-
|
|
10881
|
-
|
|
11086
|
+
return this._instance;
|
|
11087
|
+
}
|
|
11088
|
+
/**
|
|
11089
|
+
* Set the current global meter provider.
|
|
11090
|
+
* Returns true if the meter provider was successfully registered, else false.
|
|
11091
|
+
*/
|
|
11092
|
+
setGlobalMeterProvider(provider) {
|
|
11093
|
+
return registerGlobal(API_NAME3, provider, DiagAPI.instance());
|
|
11094
|
+
}
|
|
11095
|
+
/**
|
|
11096
|
+
* Returns the global meter provider.
|
|
11097
|
+
*/
|
|
11098
|
+
getMeterProvider() {
|
|
11099
|
+
return getGlobal(API_NAME3) || NOOP_METER_PROVIDER;
|
|
11100
|
+
}
|
|
11101
|
+
/**
|
|
11102
|
+
* Returns a meter from the global meter provider.
|
|
11103
|
+
*/
|
|
11104
|
+
getMeter(name, version, options) {
|
|
11105
|
+
return this.getMeterProvider().getMeter(name, version, options);
|
|
11106
|
+
}
|
|
11107
|
+
/** Remove the global meter provider */
|
|
11108
|
+
disable() {
|
|
11109
|
+
unregisterGlobal(API_NAME3, DiagAPI.instance());
|
|
11110
|
+
}
|
|
11111
|
+
};
|
|
10882
11112
|
|
|
10883
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.
|
|
11113
|
+
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/metrics-api.js
|
|
10884
11114
|
var metrics = MetricsAPI.getInstance();
|
|
10885
11115
|
|
|
10886
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.
|
|
11116
|
+
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/api/trace.js
|
|
10887
11117
|
var API_NAME4 = "trace";
|
|
10888
|
-
var TraceAPI =
|
|
10889
|
-
/**
|
|
10890
|
-
|
|
10891
|
-
|
|
10892
|
-
|
|
10893
|
-
|
|
10894
|
-
|
|
10895
|
-
|
|
10896
|
-
|
|
10897
|
-
|
|
10898
|
-
|
|
10899
|
-
|
|
10900
|
-
|
|
10901
|
-
|
|
10902
|
-
|
|
10903
|
-
|
|
10904
|
-
|
|
10905
|
-
|
|
10906
|
-
|
|
10907
|
-
|
|
10908
|
-
|
|
10909
|
-
|
|
10910
|
-
|
|
10911
|
-
|
|
10912
|
-
|
|
10913
|
-
|
|
10914
|
-
|
|
10915
|
-
|
|
10916
|
-
|
|
10917
|
-
}
|
|
10918
|
-
|
|
10919
|
-
|
|
10920
|
-
|
|
10921
|
-
|
|
10922
|
-
|
|
10923
|
-
|
|
10924
|
-
|
|
10925
|
-
|
|
10926
|
-
|
|
10927
|
-
|
|
11118
|
+
var TraceAPI = class _TraceAPI {
|
|
11119
|
+
/** Empty private constructor prevents end users from constructing a new instance of the API */
|
|
11120
|
+
constructor() {
|
|
11121
|
+
this._proxyTracerProvider = new ProxyTracerProvider();
|
|
11122
|
+
this.wrapSpanContext = wrapSpanContext;
|
|
11123
|
+
this.isSpanContextValid = isSpanContextValid;
|
|
11124
|
+
this.deleteSpan = deleteSpan;
|
|
11125
|
+
this.getSpan = getSpan;
|
|
11126
|
+
this.getActiveSpan = getActiveSpan;
|
|
11127
|
+
this.getSpanContext = getSpanContext;
|
|
11128
|
+
this.setSpan = setSpan;
|
|
11129
|
+
this.setSpanContext = setSpanContext;
|
|
11130
|
+
}
|
|
11131
|
+
/** Get the singleton instance of the Trace API */
|
|
11132
|
+
static getInstance() {
|
|
11133
|
+
if (!this._instance) {
|
|
11134
|
+
this._instance = new _TraceAPI();
|
|
11135
|
+
}
|
|
11136
|
+
return this._instance;
|
|
11137
|
+
}
|
|
11138
|
+
/**
|
|
11139
|
+
* Set the current global tracer.
|
|
11140
|
+
*
|
|
11141
|
+
* @returns true if the tracer provider was successfully registered, else false
|
|
11142
|
+
*/
|
|
11143
|
+
setGlobalTracerProvider(provider) {
|
|
11144
|
+
const success = registerGlobal(API_NAME4, this._proxyTracerProvider, DiagAPI.instance());
|
|
11145
|
+
if (success) {
|
|
11146
|
+
this._proxyTracerProvider.setDelegate(provider);
|
|
11147
|
+
}
|
|
11148
|
+
return success;
|
|
11149
|
+
}
|
|
11150
|
+
/**
|
|
11151
|
+
* Returns the global tracer provider.
|
|
11152
|
+
*/
|
|
11153
|
+
getTracerProvider() {
|
|
11154
|
+
return getGlobal(API_NAME4) || this._proxyTracerProvider;
|
|
11155
|
+
}
|
|
11156
|
+
/**
|
|
11157
|
+
* Returns a tracer from the global tracer provider.
|
|
11158
|
+
*/
|
|
11159
|
+
getTracer(name, version) {
|
|
11160
|
+
return this.getTracerProvider().getTracer(name, version);
|
|
11161
|
+
}
|
|
11162
|
+
/** Remove the global tracer provider */
|
|
11163
|
+
disable() {
|
|
11164
|
+
unregisterGlobal(API_NAME4, DiagAPI.instance());
|
|
11165
|
+
this._proxyTracerProvider = new ProxyTracerProvider();
|
|
11166
|
+
}
|
|
11167
|
+
};
|
|
10928
11168
|
|
|
10929
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.
|
|
11169
|
+
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace-api.js
|
|
10930
11170
|
var trace = TraceAPI.getInstance();
|
|
10931
11171
|
function getTracer(name) {
|
|
10932
11172
|
return trace.getTracer(name);
|
|
@@ -16423,9 +16663,13 @@ function deserialiseSnapshot(serialised) {
|
|
|
16423
16663
|
}
|
|
16424
16664
|
|
|
16425
16665
|
// src/mollifier/buffer.ts
|
|
16426
|
-
var
|
|
16427
|
-
|
|
16428
|
-
|
|
16666
|
+
var DEFAULT_ACK_GRACE_TTL_SECONDS = 30;
|
|
16667
|
+
var DEFAULT_RECONNECT_STEP_MS = 50;
|
|
16668
|
+
var DEFAULT_RECONNECT_MAX_MS = 1e3;
|
|
16669
|
+
var DEFAULT_MAX_RETRIES_PER_REQUEST = 20;
|
|
16670
|
+
var DRAINING_SET_KEY = "mollifier:draining";
|
|
16671
|
+
function mollifierReconnectDelayMs(times, random = Math.random, stepMs = DEFAULT_RECONNECT_STEP_MS, maxMs = DEFAULT_RECONNECT_MAX_MS) {
|
|
16672
|
+
const base = Math.min(times * stepMs, maxMs);
|
|
16429
16673
|
const half = Math.floor(base / 2);
|
|
16430
16674
|
return half + Math.round(random() * (base - half));
|
|
16431
16675
|
}
|
|
@@ -16442,15 +16686,19 @@ function makeIdempotencyClaimKey(input) {
|
|
|
16442
16686
|
var MollifierBuffer = class {
|
|
16443
16687
|
redis;
|
|
16444
16688
|
logger;
|
|
16689
|
+
ackGraceTtlSeconds;
|
|
16445
16690
|
constructor(options) {
|
|
16446
16691
|
this.logger = options.logger ?? new Logger("MollifierBuffer", "debug");
|
|
16692
|
+
this.ackGraceTtlSeconds = options.ackGraceTtlSeconds ?? DEFAULT_ACK_GRACE_TTL_SECONDS;
|
|
16693
|
+
const reconnectStepMs = options.reconnectStepMs ?? DEFAULT_RECONNECT_STEP_MS;
|
|
16694
|
+
const reconnectMaxMs = options.reconnectMaxMs ?? DEFAULT_RECONNECT_MAX_MS;
|
|
16447
16695
|
this.redis = createRedisClient(
|
|
16448
16696
|
{
|
|
16449
16697
|
...options.redisOptions,
|
|
16450
16698
|
retryStrategy(times) {
|
|
16451
|
-
return mollifierReconnectDelayMs(times);
|
|
16699
|
+
return mollifierReconnectDelayMs(times, Math.random, reconnectStepMs, reconnectMaxMs);
|
|
16452
16700
|
},
|
|
16453
|
-
maxRetriesPerRequest:
|
|
16701
|
+
maxRetriesPerRequest: options.maxRetriesPerRequest ?? DEFAULT_MAX_RETRIES_PER_REQUEST
|
|
16454
16702
|
},
|
|
16455
16703
|
{
|
|
16456
16704
|
onError: (error) => {
|
|
@@ -16507,6 +16755,7 @@ var MollifierBuffer = class {
|
|
|
16507
16755
|
const encoded = await this.redis.popAndMarkDraining(
|
|
16508
16756
|
queueKey,
|
|
16509
16757
|
orgsKey,
|
|
16758
|
+
DRAINING_SET_KEY,
|
|
16510
16759
|
entryPrefix,
|
|
16511
16760
|
envId,
|
|
16512
16761
|
"mollifier:org-envs:"
|
|
@@ -16764,13 +17013,16 @@ var MollifierBuffer = class {
|
|
|
16764
17013
|
async ack(runId) {
|
|
16765
17014
|
await this.redis.ackMollifierEntry(
|
|
16766
17015
|
`mollifier:entries:${runId}`,
|
|
16767
|
-
|
|
17016
|
+
DRAINING_SET_KEY,
|
|
17017
|
+
String(this.ackGraceTtlSeconds),
|
|
17018
|
+
runId
|
|
16768
17019
|
);
|
|
16769
17020
|
}
|
|
16770
17021
|
async requeue(runId) {
|
|
16771
17022
|
await this.redis.requeueMollifierEntry(
|
|
16772
17023
|
`mollifier:entries:${runId}`,
|
|
16773
17024
|
"mollifier:orgs",
|
|
17025
|
+
DRAINING_SET_KEY,
|
|
16774
17026
|
"mollifier:queue:",
|
|
16775
17027
|
runId,
|
|
16776
17028
|
"mollifier:org-envs:"
|
|
@@ -16785,10 +17037,36 @@ var MollifierBuffer = class {
|
|
|
16785
17037
|
async fail(runId, error) {
|
|
16786
17038
|
const result = await this.redis.failMollifierEntry(
|
|
16787
17039
|
`mollifier:entries:${runId}`,
|
|
16788
|
-
|
|
17040
|
+
DRAINING_SET_KEY,
|
|
17041
|
+
JSON.stringify(error),
|
|
17042
|
+
runId
|
|
16789
17043
|
);
|
|
16790
17044
|
return result === 1;
|
|
16791
17045
|
}
|
|
17046
|
+
// Observability-only: number of entries currently in DRAINING state
|
|
17047
|
+
// (popped, not yet acked/failed/requeued). The gauge in the webapp
|
|
17048
|
+
// drainer worker polls this on a short interval and emits it as
|
|
17049
|
+
// `mollifier.draining.current` for ops dashboards and post-crash
|
|
17050
|
+
// forensics. Cheap (single ZCARD).
|
|
17051
|
+
async getDrainingCount() {
|
|
17052
|
+
return this.redis.zcard(DRAINING_SET_KEY);
|
|
17053
|
+
}
|
|
17054
|
+
// Observability-only: list runIds that have been DRAINING longer than
|
|
17055
|
+
// `olderThanMs` (i.e. popped before `now - olderThanMs`). Bounded by
|
|
17056
|
+
// `limit` to keep the result set tractable when something has gone
|
|
17057
|
+
// very wrong. ZRANGEBYSCORE is O(log N + K). Score is the pop wall-clock
|
|
17058
|
+
// in milliseconds as written by the popAndMarkDraining Lua.
|
|
17059
|
+
async listStaleDraining(olderThanMs, limit) {
|
|
17060
|
+
const maxScore = Date.now() - Math.max(0, olderThanMs);
|
|
17061
|
+
return this.redis.zrangebyscore(
|
|
17062
|
+
DRAINING_SET_KEY,
|
|
17063
|
+
"-inf",
|
|
17064
|
+
String(maxScore),
|
|
17065
|
+
"LIMIT",
|
|
17066
|
+
0,
|
|
17067
|
+
Math.max(0, limit)
|
|
17068
|
+
);
|
|
17069
|
+
}
|
|
16792
17070
|
// Returns Redis-side TTL on the entry hash. Returns -1 for entries
|
|
16793
17071
|
// with no TTL — the steady state under the current design, where
|
|
16794
17072
|
// entries persist until drainer ack/fail. The ack grace TTL (30s
|
|
@@ -16889,10 +17167,11 @@ var MollifierBuffer = class {
|
|
|
16889
17167
|
`
|
|
16890
17168
|
});
|
|
16891
17169
|
this.redis.defineCommand("requeueMollifierEntry", {
|
|
16892
|
-
numberOfKeys:
|
|
17170
|
+
numberOfKeys: 3,
|
|
16893
17171
|
lua: `
|
|
16894
17172
|
local entryKey = KEYS[1]
|
|
16895
17173
|
local orgsKey = KEYS[2]
|
|
17174
|
+
local drainingSetKey = KEYS[3]
|
|
16896
17175
|
local queuePrefix = ARGV[1]
|
|
16897
17176
|
local runId = ARGV[2]
|
|
16898
17177
|
local orgEnvsPrefix = ARGV[3]
|
|
@@ -16920,18 +17199,31 @@ var MollifierBuffer = class {
|
|
|
16920
17199
|
redis.call('SADD', orgsKey, orgId)
|
|
16921
17200
|
redis.call('SADD', orgEnvsPrefix .. orgId, envId)
|
|
16922
17201
|
end
|
|
17202
|
+
-- Observability-only: leaving DRAINING state, so drop the
|
|
17203
|
+
-- entry from the draining-tracker set. ZREM on absent member
|
|
17204
|
+
-- is a no-op.
|
|
17205
|
+
redis.call('ZREM', drainingSetKey, runId)
|
|
16923
17206
|
return 1
|
|
16924
17207
|
`
|
|
16925
17208
|
});
|
|
16926
17209
|
this.redis.defineCommand("popAndMarkDraining", {
|
|
16927
|
-
numberOfKeys:
|
|
17210
|
+
numberOfKeys: 3,
|
|
16928
17211
|
lua: `
|
|
16929
17212
|
local queueKey = KEYS[1]
|
|
16930
17213
|
local orgsKey = KEYS[2]
|
|
17214
|
+
local drainingSetKey = KEYS[3]
|
|
16931
17215
|
local entryPrefix = ARGV[1]
|
|
16932
17216
|
local envId = ARGV[2]
|
|
16933
17217
|
local orgEnvsPrefix = ARGV[3]
|
|
16934
17218
|
|
|
17219
|
+
-- Wall-clock millis used as the ZADD score on the draining-tracker
|
|
17220
|
+
-- set. Computed once per script invocation so all observers see
|
|
17221
|
+
-- the same pop instant. redis.call('TIME') is deterministic per
|
|
17222
|
+
-- script execution (Lua sees it as a single read), satisfying the
|
|
17223
|
+
-- write-determinism contract on replicas/AOF replay.
|
|
17224
|
+
local timeArr = redis.call('TIME')
|
|
17225
|
+
local nowMs = tonumber(timeArr[1]) * 1000 + math.floor(tonumber(timeArr[2]) / 1000)
|
|
17226
|
+
|
|
16935
17227
|
-- Helper: prune org-level membership when an env's queue empties.
|
|
16936
17228
|
-- Called only from the success branch where we know orgId from the
|
|
16937
17229
|
-- popped entry. The no-runId branch below can't reach this because
|
|
@@ -16964,6 +17256,14 @@ var MollifierBuffer = class {
|
|
|
16964
17256
|
local entryKey = entryPrefix .. runId
|
|
16965
17257
|
if redis.call('EXISTS', entryKey) == 1 then
|
|
16966
17258
|
redis.call('HSET', entryKey, 'status', 'DRAINING')
|
|
17259
|
+
-- Observability-only: track the runId in the draining set
|
|
17260
|
+
-- with the pop wall-clock as score. Acked/failed/requeued
|
|
17261
|
+
-- in the corresponding Lua scripts. The set is NOT
|
|
17262
|
+
-- load-bearing for correctness \u2014 the per-entry hash carries
|
|
17263
|
+
-- status \u2014 so a missed ZREM on a partial Lua execution is
|
|
17264
|
+
-- recoverable via the stale-sweep + entry hash, not a
|
|
17265
|
+
-- correctness bug.
|
|
17266
|
+
redis.call('ZADD', drainingSetKey, nowMs, runId)
|
|
16967
17267
|
local raw = redis.call('HGETALL', entryKey)
|
|
16968
17268
|
local result = {}
|
|
16969
17269
|
for i = 1, #raw, 2 do
|
|
@@ -17201,10 +17501,18 @@ var MollifierBuffer = class {
|
|
|
17201
17501
|
`
|
|
17202
17502
|
});
|
|
17203
17503
|
this.redis.defineCommand("ackMollifierEntry", {
|
|
17204
|
-
numberOfKeys:
|
|
17504
|
+
numberOfKeys: 2,
|
|
17205
17505
|
lua: `
|
|
17206
17506
|
local entryKey = KEYS[1]
|
|
17507
|
+
local drainingSetKey = KEYS[2]
|
|
17207
17508
|
local graceTtlSeconds = tonumber(ARGV[1])
|
|
17509
|
+
local runId = ARGV[2]
|
|
17510
|
+
|
|
17511
|
+
-- Always ZREM from the draining-tracker \u2014 even if the entry hash
|
|
17512
|
+
-- has been concurrently torn down, the runId might still be in
|
|
17513
|
+
-- the set (e.g. fail() ran first and cleared the hash but a
|
|
17514
|
+
-- delayed ack races in). Idempotent: ZREM on absent is a no-op.
|
|
17515
|
+
redis.call('ZREM', drainingSetKey, runId)
|
|
17208
17516
|
|
|
17209
17517
|
-- Guard: never create a partial entry. If the hash is gone between
|
|
17210
17518
|
-- pop and ack (concurrent fail or eviction \u2014 QUEUED entries carry
|
|
@@ -17227,10 +17535,17 @@ var MollifierBuffer = class {
|
|
|
17227
17535
|
`
|
|
17228
17536
|
});
|
|
17229
17537
|
this.redis.defineCommand("failMollifierEntry", {
|
|
17230
|
-
numberOfKeys:
|
|
17538
|
+
numberOfKeys: 2,
|
|
17231
17539
|
lua: `
|
|
17232
17540
|
local entryKey = KEYS[1]
|
|
17541
|
+
local drainingSetKey = KEYS[2]
|
|
17233
17542
|
local errorPayload = ARGV[1]
|
|
17543
|
+
local runId = ARGV[2]
|
|
17544
|
+
|
|
17545
|
+
-- Always ZREM from the draining-tracker (idempotent on absent).
|
|
17546
|
+
-- Mirrors ack: the runId may be in the set even if the entry hash
|
|
17547
|
+
-- has been raced away.
|
|
17548
|
+
redis.call('ZREM', drainingSetKey, runId)
|
|
17234
17549
|
|
|
17235
17550
|
-- Guard: nothing to mark FAILED if the hash is gone (concurrent
|
|
17236
17551
|
-- ack/manual cleanup). Returning 0 lets the caller distinguish
|
|
@@ -17301,8 +17616,11 @@ var MollifierDrainer = class {
|
|
|
17301
17616
|
isRetryable;
|
|
17302
17617
|
pollIntervalMs;
|
|
17303
17618
|
maxOrgsPerTick;
|
|
17619
|
+
drainBatchSize;
|
|
17620
|
+
concurrency;
|
|
17621
|
+
maxBackoffMs;
|
|
17622
|
+
backoffFloorMs;
|
|
17304
17623
|
logger;
|
|
17305
|
-
limit;
|
|
17306
17624
|
// Rotation state. `orgCursor` advances through the active-orgs list.
|
|
17307
17625
|
// Each org has its own internal cursor in `perOrgEnvCursors` for
|
|
17308
17626
|
// cycling through that org's envs. Both reset on `start()`.
|
|
@@ -17319,8 +17637,11 @@ var MollifierDrainer = class {
|
|
|
17319
17637
|
this.isRetryable = options.isRetryable;
|
|
17320
17638
|
this.pollIntervalMs = options.pollIntervalMs ?? 100;
|
|
17321
17639
|
this.maxOrgsPerTick = options.maxOrgsPerTick ?? 500;
|
|
17640
|
+
this.drainBatchSize = Math.max(1, options.drainBatchSize ?? 1);
|
|
17641
|
+
this.concurrency = Math.max(1, options.concurrency);
|
|
17642
|
+
this.maxBackoffMs = options.maxBackoffMs ?? 5e3;
|
|
17643
|
+
this.backoffFloorMs = Math.max(1, options.backoffFloorMs ?? 100);
|
|
17322
17644
|
this.logger = options.logger ?? new Logger("MollifierDrainer", "debug");
|
|
17323
|
-
this.limit = pLimit(options.concurrency);
|
|
17324
17645
|
}
|
|
17325
17646
|
async runOnce() {
|
|
17326
17647
|
const orgs = await this.buffer.listOrgs();
|
|
@@ -17337,15 +17658,64 @@ var MollifierDrainer = class {
|
|
|
17337
17658
|
const envId = this.pickEnvForOrg(orgId, envsForOrg);
|
|
17338
17659
|
targets.push(envId);
|
|
17339
17660
|
}
|
|
17340
|
-
|
|
17341
|
-
|
|
17342
|
-
|
|
17343
|
-
|
|
17344
|
-
|
|
17345
|
-
|
|
17346
|
-
|
|
17347
|
-
|
|
17661
|
+
if (targets.length === 0) return { drained: 0, failed: 0 };
|
|
17662
|
+
const remaining = /* @__PURE__ */ new Map();
|
|
17663
|
+
const skip = /* @__PURE__ */ new Set();
|
|
17664
|
+
for (const envId of targets) remaining.set(envId, this.drainBatchSize);
|
|
17665
|
+
let cursor = 0;
|
|
17666
|
+
const pickNextEnv = () => {
|
|
17667
|
+
for (let i = 0; i < targets.length; i++) {
|
|
17668
|
+
const idx = (cursor + i) % targets.length;
|
|
17669
|
+
const envId = targets[idx];
|
|
17670
|
+
if (skip.has(envId)) continue;
|
|
17671
|
+
const r = remaining.get(envId) ?? 0;
|
|
17672
|
+
if (r > 0) {
|
|
17673
|
+
remaining.set(envId, r - 1);
|
|
17674
|
+
cursor = (idx + 1) % targets.length;
|
|
17675
|
+
return envId;
|
|
17676
|
+
}
|
|
17677
|
+
}
|
|
17678
|
+
return null;
|
|
17348
17679
|
};
|
|
17680
|
+
let drained = 0;
|
|
17681
|
+
let failed = 0;
|
|
17682
|
+
const worker = async () => {
|
|
17683
|
+
while (true) {
|
|
17684
|
+
const envId = pickNextEnv();
|
|
17685
|
+
if (envId === null) return;
|
|
17686
|
+
let entry;
|
|
17687
|
+
try {
|
|
17688
|
+
entry = await this.buffer.pop(envId);
|
|
17689
|
+
} catch (err) {
|
|
17690
|
+
this.logger.error("MollifierDrainer.pop failed", { envId, err });
|
|
17691
|
+
if (!skip.has(envId)) {
|
|
17692
|
+
skip.add(envId);
|
|
17693
|
+
failed += 1;
|
|
17694
|
+
}
|
|
17695
|
+
continue;
|
|
17696
|
+
}
|
|
17697
|
+
if (!entry) {
|
|
17698
|
+
skip.add(envId);
|
|
17699
|
+
continue;
|
|
17700
|
+
}
|
|
17701
|
+
try {
|
|
17702
|
+
const outcome = await this.processEntry(entry);
|
|
17703
|
+
if (outcome === "drained") drained += 1;
|
|
17704
|
+
else failed += 1;
|
|
17705
|
+
} catch (err) {
|
|
17706
|
+
this.logger.error("MollifierDrainer.processEntry failed", {
|
|
17707
|
+
envId,
|
|
17708
|
+
runId: entry.runId,
|
|
17709
|
+
err
|
|
17710
|
+
});
|
|
17711
|
+
failed += 1;
|
|
17712
|
+
}
|
|
17713
|
+
}
|
|
17714
|
+
};
|
|
17715
|
+
const totalBudget = targets.length * this.drainBatchSize;
|
|
17716
|
+
const workerCount = Math.min(this.concurrency, totalBudget);
|
|
17717
|
+
await Promise.all(Array.from({ length: workerCount }, () => worker()));
|
|
17718
|
+
return { drained, failed };
|
|
17349
17719
|
}
|
|
17350
17720
|
start() {
|
|
17351
17721
|
if (this.isRunning) return;
|
|
@@ -17419,8 +17789,8 @@ var MollifierDrainer = class {
|
|
|
17419
17789
|
// brief blip while preventing a tight retry loop during a long Redis
|
|
17420
17790
|
// outage. 1 → 200ms, 2 → 400ms, 3 → 800ms, 4 → 1.6s, 5 → 3.2s, 6+ → 5s.
|
|
17421
17791
|
backoffMs(consecutiveErrors) {
|
|
17422
|
-
const base = Math.max(this.pollIntervalMs,
|
|
17423
|
-
const capped = Math.min(base * 2 ** (consecutiveErrors - 1),
|
|
17792
|
+
const base = Math.max(this.pollIntervalMs, this.backoffFloorMs);
|
|
17793
|
+
const capped = Math.min(base * 2 ** (consecutiveErrors - 1), this.maxBackoffMs);
|
|
17424
17794
|
return capped;
|
|
17425
17795
|
}
|
|
17426
17796
|
delay(ms) {
|
|
@@ -17451,31 +17821,6 @@ var MollifierDrainer = class {
|
|
|
17451
17821
|
this.perOrgEnvCursors.set(orgId, (cursor + 1) % sorted.length);
|
|
17452
17822
|
return sorted[idx];
|
|
17453
17823
|
}
|
|
17454
|
-
// A failure for one env (e.g. a Redis hiccup mid-batch in `pop`, or in
|
|
17455
|
-
// `requeue`/`fail` during error recovery inside `processEntry`) must not
|
|
17456
|
-
// poison the rest of the batch — `Promise.all` would otherwise reject and
|
|
17457
|
-
// bubble all the way to `loop()`. Catch both stages here so the failed env
|
|
17458
|
-
// is just counted as "failed" for this tick and we move on.
|
|
17459
|
-
async processOneFromEnv(envId) {
|
|
17460
|
-
let entry;
|
|
17461
|
-
try {
|
|
17462
|
-
entry = await this.buffer.pop(envId);
|
|
17463
|
-
} catch (err) {
|
|
17464
|
-
this.logger.error("MollifierDrainer.pop failed", { envId, err });
|
|
17465
|
-
return "failed";
|
|
17466
|
-
}
|
|
17467
|
-
if (!entry) return "empty";
|
|
17468
|
-
try {
|
|
17469
|
-
return await this.processEntry(entry);
|
|
17470
|
-
} catch (err) {
|
|
17471
|
-
this.logger.error("MollifierDrainer.processEntry failed", {
|
|
17472
|
-
envId,
|
|
17473
|
-
runId: entry.runId,
|
|
17474
|
-
err
|
|
17475
|
-
});
|
|
17476
|
-
return "failed";
|
|
17477
|
-
}
|
|
17478
|
-
}
|
|
17479
17824
|
async processEntry(entry) {
|
|
17480
17825
|
try {
|
|
17481
17826
|
const payload = deserialiseSnapshot(entry.payload);
|