@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.cjs
CHANGED
|
@@ -3457,9 +3457,9 @@ var require_lodash2 = __commonJS({
|
|
|
3457
3457
|
}
|
|
3458
3458
|
});
|
|
3459
3459
|
|
|
3460
|
-
// ../../node_modules/.pnpm/ioredis@5.
|
|
3460
|
+
// ../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/utils/lodash.js
|
|
3461
3461
|
var require_lodash3 = __commonJS({
|
|
3462
|
-
"../../node_modules/.pnpm/ioredis@5.
|
|
3462
|
+
"../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/utils/lodash.js"(exports$1) {
|
|
3463
3463
|
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
3464
3464
|
exports$1.isArguments = exports$1.defaults = exports$1.noop = void 0;
|
|
3465
3465
|
var defaults = require_lodash();
|
|
@@ -3588,9 +3588,9 @@ var require_ms = __commonJS({
|
|
|
3588
3588
|
}
|
|
3589
3589
|
});
|
|
3590
3590
|
|
|
3591
|
-
// ../../node_modules/.pnpm/debug@4.
|
|
3591
|
+
// ../../node_modules/.pnpm/debug@4.4.3_supports-color@10.0.0/node_modules/debug/src/common.js
|
|
3592
3592
|
var require_common = __commonJS({
|
|
3593
|
-
"../../node_modules/.pnpm/debug@4.
|
|
3593
|
+
"../../node_modules/.pnpm/debug@4.4.3_supports-color@10.0.0/node_modules/debug/src/common.js"(exports$1, module) {
|
|
3594
3594
|
function setup(env2) {
|
|
3595
3595
|
createDebug.debug = createDebug;
|
|
3596
3596
|
createDebug.default = createDebug;
|
|
@@ -3624,12 +3624,12 @@ var require_common = __commonJS({
|
|
|
3624
3624
|
if (!debug.enabled) {
|
|
3625
3625
|
return;
|
|
3626
3626
|
}
|
|
3627
|
-
const
|
|
3627
|
+
const self2 = debug;
|
|
3628
3628
|
const curr = Number(/* @__PURE__ */ new Date());
|
|
3629
3629
|
const ms = curr - (prevTime || curr);
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
|
|
3630
|
+
self2.diff = ms;
|
|
3631
|
+
self2.prev = prevTime;
|
|
3632
|
+
self2.curr = curr;
|
|
3633
3633
|
prevTime = curr;
|
|
3634
3634
|
args[0] = createDebug.coerce(args[0]);
|
|
3635
3635
|
if (typeof args[0] !== "string") {
|
|
@@ -3644,15 +3644,15 @@ var require_common = __commonJS({
|
|
|
3644
3644
|
const formatter = createDebug.formatters[format];
|
|
3645
3645
|
if (typeof formatter === "function") {
|
|
3646
3646
|
const val = args[index];
|
|
3647
|
-
match = formatter.call(
|
|
3647
|
+
match = formatter.call(self2, val);
|
|
3648
3648
|
args.splice(index, 1);
|
|
3649
3649
|
index--;
|
|
3650
3650
|
}
|
|
3651
3651
|
return match;
|
|
3652
3652
|
});
|
|
3653
|
-
createDebug.formatArgs.call(
|
|
3654
|
-
const logFn =
|
|
3655
|
-
logFn.apply(
|
|
3653
|
+
createDebug.formatArgs.call(self2, args);
|
|
3654
|
+
const logFn = self2.log || createDebug.log;
|
|
3655
|
+
logFn.apply(self2, args);
|
|
3656
3656
|
}
|
|
3657
3657
|
debug.namespace = namespace;
|
|
3658
3658
|
debug.useColors = createDebug.useColors();
|
|
@@ -3691,50 +3691,64 @@ var require_common = __commonJS({
|
|
|
3691
3691
|
createDebug.namespaces = namespaces;
|
|
3692
3692
|
createDebug.names = [];
|
|
3693
3693
|
createDebug.skips = [];
|
|
3694
|
-
|
|
3695
|
-
|
|
3696
|
-
|
|
3697
|
-
|
|
3698
|
-
|
|
3699
|
-
|
|
3694
|
+
const split = (typeof namespaces === "string" ? namespaces : "").trim().replace(/\s+/g, ",").split(",").filter(Boolean);
|
|
3695
|
+
for (const ns of split) {
|
|
3696
|
+
if (ns[0] === "-") {
|
|
3697
|
+
createDebug.skips.push(ns.slice(1));
|
|
3698
|
+
} else {
|
|
3699
|
+
createDebug.names.push(ns);
|
|
3700
3700
|
}
|
|
3701
|
-
|
|
3702
|
-
|
|
3703
|
-
|
|
3701
|
+
}
|
|
3702
|
+
}
|
|
3703
|
+
function matchesTemplate(search, template) {
|
|
3704
|
+
let searchIndex = 0;
|
|
3705
|
+
let templateIndex = 0;
|
|
3706
|
+
let starIndex = -1;
|
|
3707
|
+
let matchIndex = 0;
|
|
3708
|
+
while (searchIndex < search.length) {
|
|
3709
|
+
if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === "*")) {
|
|
3710
|
+
if (template[templateIndex] === "*") {
|
|
3711
|
+
starIndex = templateIndex;
|
|
3712
|
+
matchIndex = searchIndex;
|
|
3713
|
+
templateIndex++;
|
|
3714
|
+
} else {
|
|
3715
|
+
searchIndex++;
|
|
3716
|
+
templateIndex++;
|
|
3717
|
+
}
|
|
3718
|
+
} else if (starIndex !== -1) {
|
|
3719
|
+
templateIndex = starIndex + 1;
|
|
3720
|
+
matchIndex++;
|
|
3721
|
+
searchIndex = matchIndex;
|
|
3704
3722
|
} else {
|
|
3705
|
-
|
|
3723
|
+
return false;
|
|
3706
3724
|
}
|
|
3707
3725
|
}
|
|
3726
|
+
while (templateIndex < template.length && template[templateIndex] === "*") {
|
|
3727
|
+
templateIndex++;
|
|
3728
|
+
}
|
|
3729
|
+
return templateIndex === template.length;
|
|
3708
3730
|
}
|
|
3709
3731
|
function disable() {
|
|
3710
3732
|
const namespaces = [
|
|
3711
|
-
...createDebug.names
|
|
3712
|
-
...createDebug.skips.map(
|
|
3733
|
+
...createDebug.names,
|
|
3734
|
+
...createDebug.skips.map((namespace) => "-" + namespace)
|
|
3713
3735
|
].join(",");
|
|
3714
3736
|
createDebug.enable("");
|
|
3715
3737
|
return namespaces;
|
|
3716
3738
|
}
|
|
3717
3739
|
function enabled(name) {
|
|
3718
|
-
|
|
3719
|
-
|
|
3720
|
-
}
|
|
3721
|
-
let i;
|
|
3722
|
-
let len;
|
|
3723
|
-
for (i = 0, len = createDebug.skips.length; i < len; i++) {
|
|
3724
|
-
if (createDebug.skips[i].test(name)) {
|
|
3740
|
+
for (const skip of createDebug.skips) {
|
|
3741
|
+
if (matchesTemplate(name, skip)) {
|
|
3725
3742
|
return false;
|
|
3726
3743
|
}
|
|
3727
3744
|
}
|
|
3728
|
-
for (
|
|
3729
|
-
if (
|
|
3745
|
+
for (const ns of createDebug.names) {
|
|
3746
|
+
if (matchesTemplate(name, ns)) {
|
|
3730
3747
|
return true;
|
|
3731
3748
|
}
|
|
3732
3749
|
}
|
|
3733
3750
|
return false;
|
|
3734
3751
|
}
|
|
3735
|
-
function toNamespace(regexp) {
|
|
3736
|
-
return regexp.toString().substring(2, regexp.toString().length - 2).replace(/\.\*\?$/, "*");
|
|
3737
|
-
}
|
|
3738
3752
|
function coerce(val) {
|
|
3739
3753
|
if (val instanceof Error) {
|
|
3740
3754
|
return val.stack || val.message;
|
|
@@ -3751,9 +3765,9 @@ var require_common = __commonJS({
|
|
|
3751
3765
|
}
|
|
3752
3766
|
});
|
|
3753
3767
|
|
|
3754
|
-
// ../../node_modules/.pnpm/debug@4.
|
|
3768
|
+
// ../../node_modules/.pnpm/debug@4.4.3_supports-color@10.0.0/node_modules/debug/src/browser.js
|
|
3755
3769
|
var require_browser = __commonJS({
|
|
3756
|
-
"../../node_modules/.pnpm/debug@4.
|
|
3770
|
+
"../../node_modules/.pnpm/debug@4.4.3_supports-color@10.0.0/node_modules/debug/src/browser.js"(exports$1, module) {
|
|
3757
3771
|
exports$1.formatArgs = formatArgs;
|
|
3758
3772
|
exports$1.save = save;
|
|
3759
3773
|
exports$1.load = load;
|
|
@@ -3895,7 +3909,7 @@ var require_browser = __commonJS({
|
|
|
3895
3909
|
function load() {
|
|
3896
3910
|
let r;
|
|
3897
3911
|
try {
|
|
3898
|
-
r = exports$1.storage.getItem("debug");
|
|
3912
|
+
r = exports$1.storage.getItem("debug") || exports$1.storage.getItem("DEBUG");
|
|
3899
3913
|
} catch (error) {
|
|
3900
3914
|
}
|
|
3901
3915
|
if (!r && typeof process !== "undefined" && "env" in process) {
|
|
@@ -4061,9 +4075,9 @@ var init_supports_color = __esm({
|
|
|
4061
4075
|
}
|
|
4062
4076
|
});
|
|
4063
4077
|
|
|
4064
|
-
// ../../node_modules/.pnpm/debug@4.
|
|
4078
|
+
// ../../node_modules/.pnpm/debug@4.4.3_supports-color@10.0.0/node_modules/debug/src/node.js
|
|
4065
4079
|
var require_node = __commonJS({
|
|
4066
|
-
"../../node_modules/.pnpm/debug@4.
|
|
4080
|
+
"../../node_modules/.pnpm/debug@4.4.3_supports-color@10.0.0/node_modules/debug/src/node.js"(exports$1, module) {
|
|
4067
4081
|
var tty2 = __require("tty");
|
|
4068
4082
|
var util = __require("util");
|
|
4069
4083
|
exports$1.init = init;
|
|
@@ -4235,9 +4249,9 @@ var require_node = __commonJS({
|
|
|
4235
4249
|
}
|
|
4236
4250
|
});
|
|
4237
4251
|
|
|
4238
|
-
// ../../node_modules/.pnpm/debug@4.
|
|
4252
|
+
// ../../node_modules/.pnpm/debug@4.4.3_supports-color@10.0.0/node_modules/debug/src/index.js
|
|
4239
4253
|
var require_src = __commonJS({
|
|
4240
|
-
"../../node_modules/.pnpm/debug@4.
|
|
4254
|
+
"../../node_modules/.pnpm/debug@4.4.3_supports-color@10.0.0/node_modules/debug/src/index.js"(exports$1, module) {
|
|
4241
4255
|
if (typeof process === "undefined" || process.type === "renderer" || process.browser === true || process.__nwjs) {
|
|
4242
4256
|
module.exports = require_browser();
|
|
4243
4257
|
} else {
|
|
@@ -4246,9 +4260,9 @@ var require_src = __commonJS({
|
|
|
4246
4260
|
}
|
|
4247
4261
|
});
|
|
4248
4262
|
|
|
4249
|
-
// ../../node_modules/.pnpm/ioredis@5.
|
|
4263
|
+
// ../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/utils/debug.js
|
|
4250
4264
|
var require_debug = __commonJS({
|
|
4251
|
-
"../../node_modules/.pnpm/ioredis@5.
|
|
4265
|
+
"../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/utils/debug.js"(exports$1) {
|
|
4252
4266
|
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
4253
4267
|
exports$1.genRedactedString = exports$1.getStringValue = exports$1.MAX_ARGUMENT_LENGTH = void 0;
|
|
4254
4268
|
var debug_1 = require_src();
|
|
@@ -4331,9 +4345,9 @@ var require_debug = __commonJS({
|
|
|
4331
4345
|
}
|
|
4332
4346
|
});
|
|
4333
4347
|
|
|
4334
|
-
// ../../node_modules/.pnpm/ioredis@5.
|
|
4348
|
+
// ../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/constants/TLSProfiles.js
|
|
4335
4349
|
var require_TLSProfiles = __commonJS({
|
|
4336
|
-
"../../node_modules/.pnpm/ioredis@5.
|
|
4350
|
+
"../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/constants/TLSProfiles.js"(exports$1) {
|
|
4337
4351
|
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
4338
4352
|
var RedisCloudCA = `-----BEGIN CERTIFICATE-----
|
|
4339
4353
|
MIIDTzCCAjegAwIBAgIJAKSVpiDswLcwMA0GCSqGSIb3DQEBBQUAMD4xFjAUBgNV
|
|
@@ -4482,9 +4496,9 @@ WD9f
|
|
|
4482
4496
|
}
|
|
4483
4497
|
});
|
|
4484
4498
|
|
|
4485
|
-
// ../../node_modules/.pnpm/ioredis@5.
|
|
4499
|
+
// ../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/utils/index.js
|
|
4486
4500
|
var require_utils2 = __commonJS({
|
|
4487
|
-
"../../node_modules/.pnpm/ioredis@5.
|
|
4501
|
+
"../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/utils/index.js"(exports$1) {
|
|
4488
4502
|
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
4489
4503
|
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;
|
|
4490
4504
|
var url_1 = __require("url");
|
|
@@ -4687,9 +4701,9 @@ var require_utils2 = __commonJS({
|
|
|
4687
4701
|
}
|
|
4688
4702
|
});
|
|
4689
4703
|
|
|
4690
|
-
// ../../node_modules/.pnpm/ioredis@5.
|
|
4704
|
+
// ../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/Command.js
|
|
4691
4705
|
var require_Command = __commonJS({
|
|
4692
|
-
"../../node_modules/.pnpm/ioredis@5.
|
|
4706
|
+
"../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/Command.js"(exports$1) {
|
|
4693
4707
|
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
4694
4708
|
var commands_1 = require_built();
|
|
4695
4709
|
var calculateSlot = require_lib();
|
|
@@ -4985,9 +4999,9 @@ var require_Command = __commonJS({
|
|
|
4985
4999
|
}
|
|
4986
5000
|
});
|
|
4987
5001
|
|
|
4988
|
-
// ../../node_modules/.pnpm/ioredis@5.
|
|
5002
|
+
// ../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/errors/ClusterAllFailedError.js
|
|
4989
5003
|
var require_ClusterAllFailedError = __commonJS({
|
|
4990
|
-
"../../node_modules/.pnpm/ioredis@5.
|
|
5004
|
+
"../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/errors/ClusterAllFailedError.js"(exports$1) {
|
|
4991
5005
|
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
4992
5006
|
var redis_errors_1 = require_redis_errors();
|
|
4993
5007
|
var ClusterAllFailedError = class extends redis_errors_1.RedisError {
|
|
@@ -5005,9 +5019,9 @@ var require_ClusterAllFailedError = __commonJS({
|
|
|
5005
5019
|
}
|
|
5006
5020
|
});
|
|
5007
5021
|
|
|
5008
|
-
// ../../node_modules/.pnpm/ioredis@5.
|
|
5022
|
+
// ../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/ScanStream.js
|
|
5009
5023
|
var require_ScanStream = __commonJS({
|
|
5010
|
-
"../../node_modules/.pnpm/ioredis@5.
|
|
5024
|
+
"../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/ScanStream.js"(exports$1) {
|
|
5011
5025
|
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
5012
5026
|
var stream_1 = __require("stream");
|
|
5013
5027
|
var ScanStream = class extends stream_1.Readable {
|
|
@@ -5035,6 +5049,9 @@ var require_ScanStream = __commonJS({
|
|
|
5035
5049
|
if (this.opt.count) {
|
|
5036
5050
|
args.push("COUNT", String(this.opt.count));
|
|
5037
5051
|
}
|
|
5052
|
+
if (this.opt.noValues) {
|
|
5053
|
+
args.push("NOVALUES");
|
|
5054
|
+
}
|
|
5038
5055
|
this.opt.redis[this.opt.command](args, (err, res) => {
|
|
5039
5056
|
if (err) {
|
|
5040
5057
|
this.emit("error", err);
|
|
@@ -5055,9 +5072,9 @@ var require_ScanStream = __commonJS({
|
|
|
5055
5072
|
}
|
|
5056
5073
|
});
|
|
5057
5074
|
|
|
5058
|
-
// ../../node_modules/.pnpm/ioredis@5.
|
|
5075
|
+
// ../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/autoPipelining.js
|
|
5059
5076
|
var require_autoPipelining = __commonJS({
|
|
5060
|
-
"../../node_modules/.pnpm/ioredis@5.
|
|
5077
|
+
"../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/autoPipelining.js"(exports$1) {
|
|
5061
5078
|
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
5062
5079
|
exports$1.executeWithAutoPipelining = exports$1.getFirstValueInFlattenedArray = exports$1.shouldUseAutoPipelining = exports$1.notAllowedAutoPipelineCommands = exports$1.kCallbacks = exports$1.kExec = void 0;
|
|
5063
5080
|
var lodash_1 = require_lodash3();
|
|
@@ -5176,9 +5193,9 @@ var require_autoPipelining = __commonJS({
|
|
|
5176
5193
|
}
|
|
5177
5194
|
});
|
|
5178
5195
|
|
|
5179
|
-
// ../../node_modules/.pnpm/ioredis@5.
|
|
5196
|
+
// ../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/Script.js
|
|
5180
5197
|
var require_Script = __commonJS({
|
|
5181
|
-
"../../node_modules/.pnpm/ioredis@5.
|
|
5198
|
+
"../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/Script.js"(exports$1) {
|
|
5182
5199
|
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
5183
5200
|
var crypto_1 = __require("crypto");
|
|
5184
5201
|
var Command_1 = require_Command();
|
|
@@ -5240,9 +5257,9 @@ var require_Script = __commonJS({
|
|
|
5240
5257
|
}
|
|
5241
5258
|
});
|
|
5242
5259
|
|
|
5243
|
-
// ../../node_modules/.pnpm/ioredis@5.
|
|
5260
|
+
// ../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/utils/Commander.js
|
|
5244
5261
|
var require_Commander = __commonJS({
|
|
5245
|
-
"../../node_modules/.pnpm/ioredis@5.
|
|
5262
|
+
"../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/utils/Commander.js"(exports$1) {
|
|
5246
5263
|
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
5247
5264
|
var commands_1 = require_built();
|
|
5248
5265
|
var autoPipelining_1 = require_autoPipelining();
|
|
@@ -5355,9 +5372,9 @@ var require_Commander = __commonJS({
|
|
|
5355
5372
|
}
|
|
5356
5373
|
});
|
|
5357
5374
|
|
|
5358
|
-
// ../../node_modules/.pnpm/ioredis@5.
|
|
5375
|
+
// ../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/Pipeline.js
|
|
5359
5376
|
var require_Pipeline = __commonJS({
|
|
5360
|
-
"../../node_modules/.pnpm/ioredis@5.
|
|
5377
|
+
"../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/Pipeline.js"(exports$1) {
|
|
5361
5378
|
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
5362
5379
|
var calculateSlot = require_lib();
|
|
5363
5380
|
var commands_1 = require_built();
|
|
@@ -5658,9 +5675,9 @@ var require_Pipeline = __commonJS({
|
|
|
5658
5675
|
}
|
|
5659
5676
|
});
|
|
5660
5677
|
|
|
5661
|
-
// ../../node_modules/.pnpm/ioredis@5.
|
|
5678
|
+
// ../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/transaction.js
|
|
5662
5679
|
var require_transaction = __commonJS({
|
|
5663
|
-
"../../node_modules/.pnpm/ioredis@5.
|
|
5680
|
+
"../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/transaction.js"(exports$1) {
|
|
5664
5681
|
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
5665
5682
|
exports$1.addTransactionSupport = void 0;
|
|
5666
5683
|
var utils_1 = require_utils2();
|
|
@@ -5750,9 +5767,9 @@ var require_transaction = __commonJS({
|
|
|
5750
5767
|
}
|
|
5751
5768
|
});
|
|
5752
5769
|
|
|
5753
|
-
// ../../node_modules/.pnpm/ioredis@5.
|
|
5770
|
+
// ../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/utils/applyMixin.js
|
|
5754
5771
|
var require_applyMixin = __commonJS({
|
|
5755
|
-
"../../node_modules/.pnpm/ioredis@5.
|
|
5772
|
+
"../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/utils/applyMixin.js"(exports$1) {
|
|
5756
5773
|
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
5757
5774
|
function applyMixin(derivedConstructor, mixinConstructor) {
|
|
5758
5775
|
Object.getOwnPropertyNames(mixinConstructor.prototype).forEach((name) => {
|
|
@@ -5763,9 +5780,9 @@ var require_applyMixin = __commonJS({
|
|
|
5763
5780
|
}
|
|
5764
5781
|
});
|
|
5765
5782
|
|
|
5766
|
-
// ../../node_modules/.pnpm/ioredis@5.
|
|
5783
|
+
// ../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/cluster/ClusterOptions.js
|
|
5767
5784
|
var require_ClusterOptions = __commonJS({
|
|
5768
|
-
"../../node_modules/.pnpm/ioredis@5.
|
|
5785
|
+
"../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/cluster/ClusterOptions.js"(exports$1) {
|
|
5769
5786
|
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
5770
5787
|
exports$1.DEFAULT_CLUSTER_OPTIONS = void 0;
|
|
5771
5788
|
var dns_1 = __require("dns");
|
|
@@ -5784,14 +5801,15 @@ var require_ClusterOptions = __commonJS({
|
|
|
5784
5801
|
resolveSrv: dns_1.resolveSrv,
|
|
5785
5802
|
dnsLookup: dns_1.lookup,
|
|
5786
5803
|
enableAutoPipelining: false,
|
|
5787
|
-
autoPipeliningIgnoredCommands: []
|
|
5804
|
+
autoPipeliningIgnoredCommands: [],
|
|
5805
|
+
shardedSubscribers: false
|
|
5788
5806
|
};
|
|
5789
5807
|
}
|
|
5790
5808
|
});
|
|
5791
5809
|
|
|
5792
|
-
// ../../node_modules/.pnpm/ioredis@5.
|
|
5810
|
+
// ../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/cluster/util.js
|
|
5793
5811
|
var require_util = __commonJS({
|
|
5794
|
-
"../../node_modules/.pnpm/ioredis@5.
|
|
5812
|
+
"../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/cluster/util.js"(exports$1) {
|
|
5795
5813
|
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
5796
5814
|
exports$1.getConnectionName = exports$1.weightSrvRecords = exports$1.groupSrvRecords = exports$1.getUniqueHostnamesFromOptions = exports$1.normalizeNodeOptions = exports$1.nodeKeyToRedisOptions = exports$1.getNodeKey = void 0;
|
|
5797
5815
|
var utils_1 = require_utils2();
|
|
@@ -5888,20 +5906,22 @@ var require_util = __commonJS({
|
|
|
5888
5906
|
}
|
|
5889
5907
|
});
|
|
5890
5908
|
|
|
5891
|
-
// ../../node_modules/.pnpm/ioredis@5.
|
|
5909
|
+
// ../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/cluster/ClusterSubscriber.js
|
|
5892
5910
|
var require_ClusterSubscriber = __commonJS({
|
|
5893
|
-
"../../node_modules/.pnpm/ioredis@5.
|
|
5911
|
+
"../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/cluster/ClusterSubscriber.js"(exports$1) {
|
|
5894
5912
|
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
5895
5913
|
var util_1 = require_util();
|
|
5896
5914
|
var utils_1 = require_utils2();
|
|
5897
5915
|
var Redis_1 = require_Redis();
|
|
5898
5916
|
var debug = (0, utils_1.Debug)("cluster:subscriber");
|
|
5899
5917
|
var ClusterSubscriber = class {
|
|
5900
|
-
constructor(connectionPool, emitter) {
|
|
5918
|
+
constructor(connectionPool, emitter, isSharded = false) {
|
|
5901
5919
|
this.connectionPool = connectionPool;
|
|
5902
5920
|
this.emitter = emitter;
|
|
5921
|
+
this.isSharded = isSharded;
|
|
5903
5922
|
this.started = false;
|
|
5904
5923
|
this.subscriber = null;
|
|
5924
|
+
this.slotRange = [];
|
|
5905
5925
|
this.onSubscriberEnd = () => {
|
|
5906
5926
|
if (!this.started) {
|
|
5907
5927
|
debug("subscriber has disconnected, but ClusterSubscriber is not started, so not reconnecting.");
|
|
@@ -5930,6 +5950,21 @@ var require_ClusterSubscriber = __commonJS({
|
|
|
5930
5950
|
getInstance() {
|
|
5931
5951
|
return this.subscriber;
|
|
5932
5952
|
}
|
|
5953
|
+
/**
|
|
5954
|
+
* Associate this subscriber to a specific slot range.
|
|
5955
|
+
*
|
|
5956
|
+
* Returns the range or an empty array if the slot range couldn't be associated.
|
|
5957
|
+
*
|
|
5958
|
+
* BTW: This is more for debugging and testing purposes.
|
|
5959
|
+
*
|
|
5960
|
+
* @param range
|
|
5961
|
+
*/
|
|
5962
|
+
associateSlotRange(range) {
|
|
5963
|
+
if (this.isSharded) {
|
|
5964
|
+
this.slotRange = range;
|
|
5965
|
+
}
|
|
5966
|
+
return this.slotRange;
|
|
5967
|
+
}
|
|
5933
5968
|
start() {
|
|
5934
5969
|
this.started = true;
|
|
5935
5970
|
this.selectSubscriber();
|
|
@@ -5941,7 +5976,9 @@ var require_ClusterSubscriber = __commonJS({
|
|
|
5941
5976
|
this.subscriber.disconnect();
|
|
5942
5977
|
this.subscriber = null;
|
|
5943
5978
|
}
|
|
5944
|
-
|
|
5979
|
+
}
|
|
5980
|
+
isStarted() {
|
|
5981
|
+
return this.started;
|
|
5945
5982
|
}
|
|
5946
5983
|
selectSubscriber() {
|
|
5947
5984
|
const lastActiveSubscriber = this.lastActiveSubscriber;
|
|
@@ -5961,13 +5998,16 @@ var require_ClusterSubscriber = __commonJS({
|
|
|
5961
5998
|
}
|
|
5962
5999
|
const { options } = sampleNode;
|
|
5963
6000
|
debug("selected a subscriber %s:%s", options.host, options.port);
|
|
6001
|
+
let connectionPrefix = "subscriber";
|
|
6002
|
+
if (this.isSharded)
|
|
6003
|
+
connectionPrefix = "ssubscriber";
|
|
5964
6004
|
this.subscriber = new Redis_1.default({
|
|
5965
6005
|
port: options.port,
|
|
5966
6006
|
host: options.host,
|
|
5967
6007
|
username: options.username,
|
|
5968
6008
|
password: options.password,
|
|
5969
6009
|
enableReadyCheck: true,
|
|
5970
|
-
connectionName: (0, util_1.getConnectionName)(
|
|
6010
|
+
connectionName: (0, util_1.getConnectionName)(connectionPrefix, options.connectionName),
|
|
5971
6011
|
lazyConnect: true,
|
|
5972
6012
|
tls: options.tls,
|
|
5973
6013
|
// Don't try to reconnect the subscriber connection. If the connection fails
|
|
@@ -6007,9 +6047,7 @@ var require_ClusterSubscriber = __commonJS({
|
|
|
6007
6047
|
}
|
|
6008
6048
|
for (const event of [
|
|
6009
6049
|
"message",
|
|
6010
|
-
"messageBuffer"
|
|
6011
|
-
"smessage",
|
|
6012
|
-
"smessageBuffer"
|
|
6050
|
+
"messageBuffer"
|
|
6013
6051
|
]) {
|
|
6014
6052
|
this.subscriber.on(event, (arg1, arg2) => {
|
|
6015
6053
|
this.emitter.emit(event, arg1, arg2);
|
|
@@ -6020,15 +6058,25 @@ var require_ClusterSubscriber = __commonJS({
|
|
|
6020
6058
|
this.emitter.emit(event, arg1, arg2, arg3);
|
|
6021
6059
|
});
|
|
6022
6060
|
}
|
|
6061
|
+
if (this.isSharded == true) {
|
|
6062
|
+
for (const event of [
|
|
6063
|
+
"smessage",
|
|
6064
|
+
"smessageBuffer"
|
|
6065
|
+
]) {
|
|
6066
|
+
this.subscriber.on(event, (arg1, arg2) => {
|
|
6067
|
+
this.emitter.emit(event, arg1, arg2);
|
|
6068
|
+
});
|
|
6069
|
+
}
|
|
6070
|
+
}
|
|
6023
6071
|
}
|
|
6024
6072
|
};
|
|
6025
6073
|
exports$1.default = ClusterSubscriber;
|
|
6026
6074
|
}
|
|
6027
6075
|
});
|
|
6028
6076
|
|
|
6029
|
-
// ../../node_modules/.pnpm/ioredis@5.
|
|
6077
|
+
// ../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/cluster/ConnectionPool.js
|
|
6030
6078
|
var require_ConnectionPool = __commonJS({
|
|
6031
|
-
"../../node_modules/.pnpm/ioredis@5.
|
|
6079
|
+
"../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/cluster/ConnectionPool.js"(exports$1) {
|
|
6032
6080
|
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
6033
6081
|
var events_1 = __require("events");
|
|
6034
6082
|
var utils_1 = require_utils2();
|
|
@@ -6058,6 +6106,39 @@ var require_ConnectionPool = __commonJS({
|
|
|
6058
6106
|
const sampleKey = (0, utils_1.sample)(keys);
|
|
6059
6107
|
return this.nodes[role][sampleKey];
|
|
6060
6108
|
}
|
|
6109
|
+
/**
|
|
6110
|
+
* Add a master node to the pool
|
|
6111
|
+
* @param node
|
|
6112
|
+
*/
|
|
6113
|
+
addMasterNode(node) {
|
|
6114
|
+
const key = (0, util_1.getNodeKey)(node.options);
|
|
6115
|
+
const redis = this.createRedisFromOptions(node, node.options.readOnly);
|
|
6116
|
+
if (!node.options.readOnly) {
|
|
6117
|
+
this.nodes.all[key] = redis;
|
|
6118
|
+
this.nodes.master[key] = redis;
|
|
6119
|
+
return true;
|
|
6120
|
+
}
|
|
6121
|
+
return false;
|
|
6122
|
+
}
|
|
6123
|
+
/**
|
|
6124
|
+
* Creates a Redis connection instance from the node options
|
|
6125
|
+
* @param node
|
|
6126
|
+
* @param readOnly
|
|
6127
|
+
*/
|
|
6128
|
+
createRedisFromOptions(node, readOnly) {
|
|
6129
|
+
const redis = new Redis_1.default((0, utils_1.defaults)({
|
|
6130
|
+
// Never try to reconnect when a node is lose,
|
|
6131
|
+
// instead, waiting for a `MOVED` error and
|
|
6132
|
+
// fetch the slots again.
|
|
6133
|
+
retryStrategy: null,
|
|
6134
|
+
// Offline queue should be enabled so that
|
|
6135
|
+
// we don't need to wait for the `ready` event
|
|
6136
|
+
// before sending commands to the node.
|
|
6137
|
+
enableOfflineQueue: true,
|
|
6138
|
+
readOnly
|
|
6139
|
+
}, node, this.redisOptions, { lazyConnect: true }));
|
|
6140
|
+
return redis;
|
|
6141
|
+
}
|
|
6061
6142
|
/**
|
|
6062
6143
|
* Find or create a connection to the node
|
|
6063
6144
|
*/
|
|
@@ -6086,17 +6167,7 @@ var require_ConnectionPool = __commonJS({
|
|
|
6086
6167
|
}
|
|
6087
6168
|
} else {
|
|
6088
6169
|
debug("Connecting to %s as %s", key, readOnly ? "slave" : "master");
|
|
6089
|
-
redis =
|
|
6090
|
-
// Never try to reconnect when a node is lose,
|
|
6091
|
-
// instead, waiting for a `MOVED` error and
|
|
6092
|
-
// fetch the slots again.
|
|
6093
|
-
retryStrategy: null,
|
|
6094
|
-
// Offline queue should be enabled so that
|
|
6095
|
-
// we don't need to wait for the `ready` event
|
|
6096
|
-
// before sending commands to the node.
|
|
6097
|
-
enableOfflineQueue: true,
|
|
6098
|
-
readOnly
|
|
6099
|
-
}, node, this.redisOptions, { lazyConnect: true }));
|
|
6170
|
+
redis = this.createRedisFromOptions(node, readOnly);
|
|
6100
6171
|
this.nodes.all[key] = redis;
|
|
6101
6172
|
this.nodes[readOnly ? "slave" : "master"][key] = redis;
|
|
6102
6173
|
redis.once("end", () => {
|
|
@@ -6469,9 +6540,9 @@ var require_denque = __commonJS({
|
|
|
6469
6540
|
}
|
|
6470
6541
|
});
|
|
6471
6542
|
|
|
6472
|
-
// ../../node_modules/.pnpm/ioredis@5.
|
|
6543
|
+
// ../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/cluster/DelayQueue.js
|
|
6473
6544
|
var require_DelayQueue = __commonJS({
|
|
6474
|
-
"../../node_modules/.pnpm/ioredis@5.
|
|
6545
|
+
"../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/cluster/DelayQueue.js"(exports$1) {
|
|
6475
6546
|
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
6476
6547
|
var utils_1 = require_utils2();
|
|
6477
6548
|
var Deque = require_denque();
|
|
@@ -6524,9 +6595,210 @@ var require_DelayQueue = __commonJS({
|
|
|
6524
6595
|
}
|
|
6525
6596
|
});
|
|
6526
6597
|
|
|
6527
|
-
// ../../node_modules/.pnpm/ioredis@5.
|
|
6598
|
+
// ../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/cluster/ClusterSubscriberGroup.js
|
|
6599
|
+
var require_ClusterSubscriberGroup = __commonJS({
|
|
6600
|
+
"../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/cluster/ClusterSubscriberGroup.js"(exports$1) {
|
|
6601
|
+
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
6602
|
+
var utils_1 = require_utils2();
|
|
6603
|
+
var ClusterSubscriber_1 = require_ClusterSubscriber();
|
|
6604
|
+
var ConnectionPool_1 = require_ConnectionPool();
|
|
6605
|
+
var util_1 = require_util();
|
|
6606
|
+
var calculateSlot = require_lib();
|
|
6607
|
+
var debug = (0, utils_1.Debug)("cluster:subscriberGroup");
|
|
6608
|
+
var ClusterSubscriberGroup = class {
|
|
6609
|
+
/**
|
|
6610
|
+
* Register callbacks
|
|
6611
|
+
*
|
|
6612
|
+
* @param cluster
|
|
6613
|
+
*/
|
|
6614
|
+
constructor(cluster) {
|
|
6615
|
+
this.cluster = cluster;
|
|
6616
|
+
this.shardedSubscribers = /* @__PURE__ */ new Map();
|
|
6617
|
+
this.clusterSlots = [];
|
|
6618
|
+
this.subscriberToSlotsIndex = /* @__PURE__ */ new Map();
|
|
6619
|
+
this.channels = /* @__PURE__ */ new Map();
|
|
6620
|
+
cluster.on("+node", (redis) => {
|
|
6621
|
+
this._addSubscriber(redis);
|
|
6622
|
+
});
|
|
6623
|
+
cluster.on("-node", (redis) => {
|
|
6624
|
+
this._removeSubscriber(redis);
|
|
6625
|
+
});
|
|
6626
|
+
cluster.on("refresh", () => {
|
|
6627
|
+
this._refreshSlots(cluster);
|
|
6628
|
+
});
|
|
6629
|
+
}
|
|
6630
|
+
/**
|
|
6631
|
+
* Get the responsible subscriber.
|
|
6632
|
+
*
|
|
6633
|
+
* Returns null if no subscriber was found
|
|
6634
|
+
*
|
|
6635
|
+
* @param slot
|
|
6636
|
+
*/
|
|
6637
|
+
getResponsibleSubscriber(slot) {
|
|
6638
|
+
const nodeKey = this.clusterSlots[slot][0];
|
|
6639
|
+
return this.shardedSubscribers.get(nodeKey);
|
|
6640
|
+
}
|
|
6641
|
+
/**
|
|
6642
|
+
* Adds a channel for which this subscriber group is responsible
|
|
6643
|
+
*
|
|
6644
|
+
* @param channels
|
|
6645
|
+
*/
|
|
6646
|
+
addChannels(channels) {
|
|
6647
|
+
const slot = calculateSlot(channels[0]);
|
|
6648
|
+
channels.forEach((c) => {
|
|
6649
|
+
if (calculateSlot(c) != slot)
|
|
6650
|
+
return -1;
|
|
6651
|
+
});
|
|
6652
|
+
const currChannels = this.channels.get(slot);
|
|
6653
|
+
if (!currChannels) {
|
|
6654
|
+
this.channels.set(slot, channels);
|
|
6655
|
+
} else {
|
|
6656
|
+
this.channels.set(slot, currChannels.concat(channels));
|
|
6657
|
+
}
|
|
6658
|
+
return [...this.channels.values()].flatMap((v) => v).length;
|
|
6659
|
+
}
|
|
6660
|
+
/**
|
|
6661
|
+
* Removes channels for which the subscriber group is responsible by optionally unsubscribing
|
|
6662
|
+
* @param channels
|
|
6663
|
+
*/
|
|
6664
|
+
removeChannels(channels) {
|
|
6665
|
+
const slot = calculateSlot(channels[0]);
|
|
6666
|
+
channels.forEach((c) => {
|
|
6667
|
+
if (calculateSlot(c) != slot)
|
|
6668
|
+
return -1;
|
|
6669
|
+
});
|
|
6670
|
+
const slotChannels = this.channels.get(slot);
|
|
6671
|
+
if (slotChannels) {
|
|
6672
|
+
const updatedChannels = slotChannels.filter((c) => !channels.includes(c));
|
|
6673
|
+
this.channels.set(slot, updatedChannels);
|
|
6674
|
+
}
|
|
6675
|
+
return [...this.channels.values()].flatMap((v) => v).length;
|
|
6676
|
+
}
|
|
6677
|
+
/**
|
|
6678
|
+
* Disconnect all subscribers
|
|
6679
|
+
*/
|
|
6680
|
+
stop() {
|
|
6681
|
+
for (const s of this.shardedSubscribers.values()) {
|
|
6682
|
+
s.stop();
|
|
6683
|
+
}
|
|
6684
|
+
}
|
|
6685
|
+
/**
|
|
6686
|
+
* Start all not yet started subscribers
|
|
6687
|
+
*/
|
|
6688
|
+
start() {
|
|
6689
|
+
for (const s of this.shardedSubscribers.values()) {
|
|
6690
|
+
if (!s.isStarted()) {
|
|
6691
|
+
s.start();
|
|
6692
|
+
}
|
|
6693
|
+
}
|
|
6694
|
+
}
|
|
6695
|
+
/**
|
|
6696
|
+
* Add a subscriber to the group of subscribers
|
|
6697
|
+
*
|
|
6698
|
+
* @param redis
|
|
6699
|
+
*/
|
|
6700
|
+
_addSubscriber(redis) {
|
|
6701
|
+
const pool2 = new ConnectionPool_1.default(redis.options);
|
|
6702
|
+
if (pool2.addMasterNode(redis)) {
|
|
6703
|
+
const sub = new ClusterSubscriber_1.default(pool2, this.cluster, true);
|
|
6704
|
+
const nodeKey = (0, util_1.getNodeKey)(redis.options);
|
|
6705
|
+
this.shardedSubscribers.set(nodeKey, sub);
|
|
6706
|
+
sub.start();
|
|
6707
|
+
this._resubscribe();
|
|
6708
|
+
this.cluster.emit("+subscriber");
|
|
6709
|
+
return sub;
|
|
6710
|
+
}
|
|
6711
|
+
return null;
|
|
6712
|
+
}
|
|
6713
|
+
/**
|
|
6714
|
+
* Removes a subscriber from the group
|
|
6715
|
+
* @param redis
|
|
6716
|
+
*/
|
|
6717
|
+
_removeSubscriber(redis) {
|
|
6718
|
+
const nodeKey = (0, util_1.getNodeKey)(redis.options);
|
|
6719
|
+
const sub = this.shardedSubscribers.get(nodeKey);
|
|
6720
|
+
if (sub) {
|
|
6721
|
+
sub.stop();
|
|
6722
|
+
this.shardedSubscribers.delete(nodeKey);
|
|
6723
|
+
this._resubscribe();
|
|
6724
|
+
this.cluster.emit("-subscriber");
|
|
6725
|
+
}
|
|
6726
|
+
return this.shardedSubscribers;
|
|
6727
|
+
}
|
|
6728
|
+
/**
|
|
6729
|
+
* Refreshes the subscriber-related slot ranges
|
|
6730
|
+
*
|
|
6731
|
+
* Returns false if no refresh was needed
|
|
6732
|
+
*
|
|
6733
|
+
* @param cluster
|
|
6734
|
+
*/
|
|
6735
|
+
_refreshSlots(cluster) {
|
|
6736
|
+
if (this._slotsAreEqual(cluster.slots)) {
|
|
6737
|
+
debug("Nothing to refresh because the new cluster map is equal to the previous one.");
|
|
6738
|
+
} else {
|
|
6739
|
+
debug("Refreshing the slots of the subscriber group.");
|
|
6740
|
+
this.subscriberToSlotsIndex = /* @__PURE__ */ new Map();
|
|
6741
|
+
for (let slot = 0; slot < cluster.slots.length; slot++) {
|
|
6742
|
+
const node = cluster.slots[slot][0];
|
|
6743
|
+
if (!this.subscriberToSlotsIndex.has(node)) {
|
|
6744
|
+
this.subscriberToSlotsIndex.set(node, []);
|
|
6745
|
+
}
|
|
6746
|
+
this.subscriberToSlotsIndex.get(node).push(Number(slot));
|
|
6747
|
+
}
|
|
6748
|
+
this._resubscribe();
|
|
6749
|
+
this.clusterSlots = JSON.parse(JSON.stringify(cluster.slots));
|
|
6750
|
+
this.cluster.emit("subscribersReady");
|
|
6751
|
+
return true;
|
|
6752
|
+
}
|
|
6753
|
+
return false;
|
|
6754
|
+
}
|
|
6755
|
+
/**
|
|
6756
|
+
* Resubscribes to the previous channels
|
|
6757
|
+
*
|
|
6758
|
+
* @private
|
|
6759
|
+
*/
|
|
6760
|
+
_resubscribe() {
|
|
6761
|
+
if (this.shardedSubscribers) {
|
|
6762
|
+
this.shardedSubscribers.forEach((s, nodeKey) => {
|
|
6763
|
+
const subscriberSlots = this.subscriberToSlotsIndex.get(nodeKey);
|
|
6764
|
+
if (subscriberSlots) {
|
|
6765
|
+
s.associateSlotRange(subscriberSlots);
|
|
6766
|
+
subscriberSlots.forEach((ss) => {
|
|
6767
|
+
const redis = s.getInstance();
|
|
6768
|
+
const channels = this.channels.get(ss);
|
|
6769
|
+
if (channels && channels.length > 0) {
|
|
6770
|
+
if (redis) {
|
|
6771
|
+
redis.ssubscribe(channels);
|
|
6772
|
+
redis.on("ready", () => {
|
|
6773
|
+
redis.ssubscribe(channels);
|
|
6774
|
+
});
|
|
6775
|
+
}
|
|
6776
|
+
}
|
|
6777
|
+
});
|
|
6778
|
+
}
|
|
6779
|
+
});
|
|
6780
|
+
}
|
|
6781
|
+
}
|
|
6782
|
+
/**
|
|
6783
|
+
* Deep equality of the cluster slots objects
|
|
6784
|
+
*
|
|
6785
|
+
* @param other
|
|
6786
|
+
* @private
|
|
6787
|
+
*/
|
|
6788
|
+
_slotsAreEqual(other) {
|
|
6789
|
+
if (this.clusterSlots === void 0)
|
|
6790
|
+
return false;
|
|
6791
|
+
else
|
|
6792
|
+
return JSON.stringify(this.clusterSlots) === JSON.stringify(other);
|
|
6793
|
+
}
|
|
6794
|
+
};
|
|
6795
|
+
exports$1.default = ClusterSubscriberGroup;
|
|
6796
|
+
}
|
|
6797
|
+
});
|
|
6798
|
+
|
|
6799
|
+
// ../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/cluster/index.js
|
|
6528
6800
|
var require_cluster = __commonJS({
|
|
6529
|
-
"../../node_modules/.pnpm/ioredis@5.
|
|
6801
|
+
"../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/cluster/index.js"(exports$1) {
|
|
6530
6802
|
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
6531
6803
|
var commands_1 = require_built();
|
|
6532
6804
|
var events_1 = __require("events");
|
|
@@ -6546,12 +6818,14 @@ var require_cluster = __commonJS({
|
|
|
6546
6818
|
var DelayQueue_1 = require_DelayQueue();
|
|
6547
6819
|
var util_1 = require_util();
|
|
6548
6820
|
var Deque = require_denque();
|
|
6821
|
+
var ClusterSubscriberGroup_1 = require_ClusterSubscriberGroup();
|
|
6549
6822
|
var debug = (0, utils_1.Debug)("cluster");
|
|
6550
6823
|
var REJECT_OVERWRITTEN_COMMANDS = /* @__PURE__ */ new WeakSet();
|
|
6551
6824
|
var Cluster = class _Cluster extends Commander_1.default {
|
|
6552
6825
|
/**
|
|
6553
6826
|
* Creates an instance of Cluster.
|
|
6554
6827
|
*/
|
|
6828
|
+
//TODO: Add an option that enables or disables sharded PubSub
|
|
6555
6829
|
constructor(startupNodes, options = {}) {
|
|
6556
6830
|
super();
|
|
6557
6831
|
this.slots = [];
|
|
@@ -6562,6 +6836,7 @@ var require_cluster = __commonJS({
|
|
|
6562
6836
|
this.delayQueue = new DelayQueue_1.default();
|
|
6563
6837
|
this.offlineQueue = new Deque();
|
|
6564
6838
|
this.isRefreshing = false;
|
|
6839
|
+
this._refreshSlotsCacheCallbacks = [];
|
|
6565
6840
|
this._autoPipelines = /* @__PURE__ */ new Map();
|
|
6566
6841
|
this._runningAutoPipelines = /* @__PURE__ */ new Set();
|
|
6567
6842
|
this._readyDelayedCallbacks = [];
|
|
@@ -6569,6 +6844,8 @@ var require_cluster = __commonJS({
|
|
|
6569
6844
|
events_1.EventEmitter.call(this);
|
|
6570
6845
|
this.startupNodes = startupNodes;
|
|
6571
6846
|
this.options = (0, utils_1.defaults)({}, options, ClusterOptions_1.DEFAULT_CLUSTER_OPTIONS, this.options);
|
|
6847
|
+
if (this.options.shardedSubscribers == true)
|
|
6848
|
+
this.shardedSubscribers = new ClusterSubscriberGroup_1.default(this);
|
|
6572
6849
|
if (this.options.redisOptions && this.options.redisOptions.keyPrefix && !this.options.keyPrefix) {
|
|
6573
6850
|
this.options.keyPrefix = this.options.redisOptions.keyPrefix;
|
|
6574
6851
|
}
|
|
@@ -6669,6 +6946,9 @@ var require_cluster = __commonJS({
|
|
|
6669
6946
|
}
|
|
6670
6947
|
});
|
|
6671
6948
|
this.subscriber.start();
|
|
6949
|
+
if (this.options.shardedSubscribers) {
|
|
6950
|
+
this.shardedSubscribers.start();
|
|
6951
|
+
}
|
|
6672
6952
|
}).catch((err) => {
|
|
6673
6953
|
this.setStatus("close");
|
|
6674
6954
|
this.handleCloseEvent(err);
|
|
@@ -6693,6 +6973,9 @@ var require_cluster = __commonJS({
|
|
|
6693
6973
|
}
|
|
6694
6974
|
this.clearNodesRefreshInterval();
|
|
6695
6975
|
this.subscriber.stop();
|
|
6976
|
+
if (this.options.shardedSubscribers) {
|
|
6977
|
+
this.shardedSubscribers.stop();
|
|
6978
|
+
}
|
|
6696
6979
|
if (status === "wait") {
|
|
6697
6980
|
this.setStatus("close");
|
|
6698
6981
|
this.handleCloseEvent();
|
|
@@ -6713,6 +6996,9 @@ var require_cluster = __commonJS({
|
|
|
6713
6996
|
}
|
|
6714
6997
|
this.clearNodesRefreshInterval();
|
|
6715
6998
|
this.subscriber.stop();
|
|
6999
|
+
if (this.options.shardedSubscribers) {
|
|
7000
|
+
this.shardedSubscribers.stop();
|
|
7001
|
+
}
|
|
6716
7002
|
if (status === "wait") {
|
|
6717
7003
|
const ret = (0, standard_as_callback_1.default)(Promise.resolve("OK"), callback);
|
|
6718
7004
|
setImmediate(function() {
|
|
@@ -6777,19 +7063,20 @@ var require_cluster = __commonJS({
|
|
|
6777
7063
|
* @ignore
|
|
6778
7064
|
*/
|
|
6779
7065
|
refreshSlotsCache(callback) {
|
|
7066
|
+
if (callback) {
|
|
7067
|
+
this._refreshSlotsCacheCallbacks.push(callback);
|
|
7068
|
+
}
|
|
6780
7069
|
if (this.isRefreshing) {
|
|
6781
|
-
if (callback) {
|
|
6782
|
-
process.nextTick(callback);
|
|
6783
|
-
}
|
|
6784
7070
|
return;
|
|
6785
7071
|
}
|
|
6786
7072
|
this.isRefreshing = true;
|
|
6787
7073
|
const _this = this;
|
|
6788
7074
|
const wrapper = (error) => {
|
|
6789
7075
|
this.isRefreshing = false;
|
|
6790
|
-
|
|
6791
|
-
|
|
7076
|
+
for (const callback2 of this._refreshSlotsCacheCallbacks) {
|
|
7077
|
+
callback2(error);
|
|
6792
7078
|
}
|
|
7079
|
+
this._refreshSlotsCacheCallbacks = [];
|
|
6793
7080
|
};
|
|
6794
7081
|
const nodes = (0, utils_1.shuffle)(this.connectionPool.getNodes());
|
|
6795
7082
|
let lastNodeError = null;
|
|
@@ -6891,7 +7178,21 @@ var require_cluster = __commonJS({
|
|
|
6891
7178
|
if (node && node.redis) {
|
|
6892
7179
|
redis = node.redis;
|
|
6893
7180
|
} else if (Command_1.default.checkFlag("ENTER_SUBSCRIBER_MODE", command.name) || Command_1.default.checkFlag("EXIT_SUBSCRIBER_MODE", command.name)) {
|
|
6894
|
-
|
|
7181
|
+
if (_this.options.shardedSubscribers == true && (command.name == "ssubscribe" || command.name == "sunsubscribe")) {
|
|
7182
|
+
const sub = _this.shardedSubscribers.getResponsibleSubscriber(targetSlot);
|
|
7183
|
+
let status = -1;
|
|
7184
|
+
if (command.name == "ssubscribe")
|
|
7185
|
+
status = _this.shardedSubscribers.addChannels(command.getKeys());
|
|
7186
|
+
if (command.name == "sunsubscribe")
|
|
7187
|
+
status = _this.shardedSubscribers.removeChannels(command.getKeys());
|
|
7188
|
+
if (status !== -1) {
|
|
7189
|
+
redis = sub.getInstance();
|
|
7190
|
+
} else {
|
|
7191
|
+
command.reject(new redis_errors_1.AbortError("Can't add or remove the given channels. Are they in the same slot?"));
|
|
7192
|
+
}
|
|
7193
|
+
} else {
|
|
7194
|
+
redis = _this.subscriber.getInstance();
|
|
7195
|
+
}
|
|
6895
7196
|
if (!redis) {
|
|
6896
7197
|
command.reject(new redis_errors_1.AbortError("No subscriber for the cluster"));
|
|
6897
7198
|
return;
|
|
@@ -7088,13 +7389,16 @@ var require_cluster = __commonJS({
|
|
|
7088
7389
|
}
|
|
7089
7390
|
}
|
|
7090
7391
|
natMapper(nodeKey) {
|
|
7091
|
-
|
|
7092
|
-
|
|
7093
|
-
|
|
7094
|
-
|
|
7095
|
-
|
|
7096
|
-
|
|
7097
|
-
|
|
7392
|
+
const key = typeof nodeKey === "string" ? nodeKey : `${nodeKey.host}:${nodeKey.port}`;
|
|
7393
|
+
let mapped = null;
|
|
7394
|
+
if (this.options.natMap && typeof this.options.natMap === "function") {
|
|
7395
|
+
mapped = this.options.natMap(key);
|
|
7396
|
+
} else if (this.options.natMap && typeof this.options.natMap === "object") {
|
|
7397
|
+
mapped = this.options.natMap[key];
|
|
7398
|
+
}
|
|
7399
|
+
if (mapped) {
|
|
7400
|
+
debug("NAT mapping %s -> %O", key, mapped);
|
|
7401
|
+
return Object.assign({}, mapped);
|
|
7098
7402
|
}
|
|
7099
7403
|
return typeof nodeKey === "string" ? (0, util_1.nodeKeyToRedisOptions)(nodeKey) : nodeKey;
|
|
7100
7404
|
}
|
|
@@ -7112,6 +7416,7 @@ var require_cluster = __commonJS({
|
|
|
7112
7416
|
duplicatedConnection.cluster("SLOTS", (0, utils_1.timeout)((err, result) => {
|
|
7113
7417
|
duplicatedConnection.disconnect();
|
|
7114
7418
|
if (err) {
|
|
7419
|
+
debug("error encountered running CLUSTER.SLOTS: %s", err);
|
|
7115
7420
|
return callback(err);
|
|
7116
7421
|
}
|
|
7117
7422
|
if (this.status === "disconnecting" || this.status === "close" || this.status === "end") {
|
|
@@ -7200,7 +7505,7 @@ var require_cluster = __commonJS({
|
|
|
7200
7505
|
if (err) {
|
|
7201
7506
|
return reject(err);
|
|
7202
7507
|
}
|
|
7203
|
-
const
|
|
7508
|
+
const self2 = this, groupedRecords = (0, util_1.groupSrvRecords)(records), sortedKeys = Object.keys(groupedRecords).sort((a, b) => parseInt(a) - parseInt(b));
|
|
7204
7509
|
function tryFirstOne(err2) {
|
|
7205
7510
|
if (!sortedKeys.length) {
|
|
7206
7511
|
return reject(err2);
|
|
@@ -7209,7 +7514,7 @@ var require_cluster = __commonJS({
|
|
|
7209
7514
|
if (!group.records.length) {
|
|
7210
7515
|
sortedKeys.shift();
|
|
7211
7516
|
}
|
|
7212
|
-
|
|
7517
|
+
self2.dnsLookup(record.name).then((host) => resolve({
|
|
7213
7518
|
host,
|
|
7214
7519
|
port: record.port
|
|
7215
7520
|
}), tryFirstOne);
|
|
@@ -7275,9 +7580,9 @@ var require_cluster = __commonJS({
|
|
|
7275
7580
|
}
|
|
7276
7581
|
});
|
|
7277
7582
|
|
|
7278
|
-
// ../../node_modules/.pnpm/ioredis@5.
|
|
7583
|
+
// ../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/connectors/AbstractConnector.js
|
|
7279
7584
|
var require_AbstractConnector = __commonJS({
|
|
7280
|
-
"../../node_modules/.pnpm/ioredis@5.
|
|
7585
|
+
"../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/connectors/AbstractConnector.js"(exports$1) {
|
|
7281
7586
|
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
7282
7587
|
var utils_1 = require_utils2();
|
|
7283
7588
|
var debug = (0, utils_1.Debug)("AbstractConnector");
|
|
@@ -7306,9 +7611,9 @@ var require_AbstractConnector = __commonJS({
|
|
|
7306
7611
|
}
|
|
7307
7612
|
});
|
|
7308
7613
|
|
|
7309
|
-
// ../../node_modules/.pnpm/ioredis@5.
|
|
7614
|
+
// ../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/connectors/StandaloneConnector.js
|
|
7310
7615
|
var require_StandaloneConnector = __commonJS({
|
|
7311
|
-
"../../node_modules/.pnpm/ioredis@5.
|
|
7616
|
+
"../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/connectors/StandaloneConnector.js"(exports$1) {
|
|
7312
7617
|
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
7313
7618
|
var net_1 = __require("net");
|
|
7314
7619
|
var tls_1 = __require("tls");
|
|
@@ -7370,9 +7675,9 @@ var require_StandaloneConnector = __commonJS({
|
|
|
7370
7675
|
}
|
|
7371
7676
|
});
|
|
7372
7677
|
|
|
7373
|
-
// ../../node_modules/.pnpm/ioredis@5.
|
|
7678
|
+
// ../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/connectors/SentinelConnector/SentinelIterator.js
|
|
7374
7679
|
var require_SentinelIterator = __commonJS({
|
|
7375
|
-
"../../node_modules/.pnpm/ioredis@5.
|
|
7680
|
+
"../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/connectors/SentinelConnector/SentinelIterator.js"(exports$1) {
|
|
7376
7681
|
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
7377
7682
|
function isSentinelEql(a, b) {
|
|
7378
7683
|
return (a.host || "127.0.0.1") === (b.host || "127.0.0.1") && (a.port || 26379) === (b.port || 26379);
|
|
@@ -7409,9 +7714,9 @@ var require_SentinelIterator = __commonJS({
|
|
|
7409
7714
|
}
|
|
7410
7715
|
});
|
|
7411
7716
|
|
|
7412
|
-
// ../../node_modules/.pnpm/ioredis@5.
|
|
7717
|
+
// ../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/connectors/SentinelConnector/FailoverDetector.js
|
|
7413
7718
|
var require_FailoverDetector = __commonJS({
|
|
7414
|
-
"../../node_modules/.pnpm/ioredis@5.
|
|
7719
|
+
"../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/connectors/SentinelConnector/FailoverDetector.js"(exports$1) {
|
|
7415
7720
|
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
7416
7721
|
exports$1.FailoverDetector = void 0;
|
|
7417
7722
|
var utils_1 = require_utils2();
|
|
@@ -7456,9 +7761,9 @@ var require_FailoverDetector = __commonJS({
|
|
|
7456
7761
|
}
|
|
7457
7762
|
});
|
|
7458
7763
|
|
|
7459
|
-
// ../../node_modules/.pnpm/ioredis@5.
|
|
7764
|
+
// ../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/connectors/SentinelConnector/index.js
|
|
7460
7765
|
var require_SentinelConnector = __commonJS({
|
|
7461
|
-
"../../node_modules/.pnpm/ioredis@5.
|
|
7766
|
+
"../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/connectors/SentinelConnector/index.js"(exports$1) {
|
|
7462
7767
|
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
7463
7768
|
exports$1.SentinelIterator = void 0;
|
|
7464
7769
|
var net_1 = __require("net");
|
|
@@ -7595,7 +7900,14 @@ var require_SentinelConnector = __commonJS({
|
|
|
7595
7900
|
sentinelNatResolve(item) {
|
|
7596
7901
|
if (!item || !this.options.natMap)
|
|
7597
7902
|
return item;
|
|
7598
|
-
|
|
7903
|
+
const key = `${item.host}:${item.port}`;
|
|
7904
|
+
let result = item;
|
|
7905
|
+
if (typeof this.options.natMap === "function") {
|
|
7906
|
+
result = this.options.natMap(key) || item;
|
|
7907
|
+
} else if (typeof this.options.natMap === "object") {
|
|
7908
|
+
result = this.options.natMap[key] || item;
|
|
7909
|
+
}
|
|
7910
|
+
return result;
|
|
7599
7911
|
}
|
|
7600
7912
|
connectToSentinel(endpoint, options) {
|
|
7601
7913
|
const redis = new Redis_1.default({
|
|
@@ -7714,9 +8026,9 @@ var require_SentinelConnector = __commonJS({
|
|
|
7714
8026
|
}
|
|
7715
8027
|
});
|
|
7716
8028
|
|
|
7717
|
-
// ../../node_modules/.pnpm/ioredis@5.
|
|
8029
|
+
// ../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/connectors/index.js
|
|
7718
8030
|
var require_connectors = __commonJS({
|
|
7719
|
-
"../../node_modules/.pnpm/ioredis@5.
|
|
8031
|
+
"../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/connectors/index.js"(exports$1) {
|
|
7720
8032
|
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
7721
8033
|
exports$1.SentinelConnector = exports$1.StandaloneConnector = void 0;
|
|
7722
8034
|
var StandaloneConnector_1 = require_StandaloneConnector();
|
|
@@ -7726,9 +8038,9 @@ var require_connectors = __commonJS({
|
|
|
7726
8038
|
}
|
|
7727
8039
|
});
|
|
7728
8040
|
|
|
7729
|
-
// ../../node_modules/.pnpm/ioredis@5.
|
|
8041
|
+
// ../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/errors/MaxRetriesPerRequestError.js
|
|
7730
8042
|
var require_MaxRetriesPerRequestError = __commonJS({
|
|
7731
|
-
"../../node_modules/.pnpm/ioredis@5.
|
|
8043
|
+
"../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/errors/MaxRetriesPerRequestError.js"(exports$1) {
|
|
7732
8044
|
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
7733
8045
|
var redis_errors_1 = require_redis_errors();
|
|
7734
8046
|
var MaxRetriesPerRequestError = class extends redis_errors_1.AbortError {
|
|
@@ -7745,9 +8057,9 @@ var require_MaxRetriesPerRequestError = __commonJS({
|
|
|
7745
8057
|
}
|
|
7746
8058
|
});
|
|
7747
8059
|
|
|
7748
|
-
// ../../node_modules/.pnpm/ioredis@5.
|
|
8060
|
+
// ../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/errors/index.js
|
|
7749
8061
|
var require_errors = __commonJS({
|
|
7750
|
-
"../../node_modules/.pnpm/ioredis@5.
|
|
8062
|
+
"../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/errors/index.js"(exports$1) {
|
|
7751
8063
|
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
7752
8064
|
exports$1.MaxRetriesPerRequestError = void 0;
|
|
7753
8065
|
var MaxRetriesPerRequestError_1 = require_MaxRetriesPerRequestError();
|
|
@@ -8162,9 +8474,9 @@ var require_redis_parser = __commonJS({
|
|
|
8162
8474
|
}
|
|
8163
8475
|
});
|
|
8164
8476
|
|
|
8165
|
-
// ../../node_modules/.pnpm/ioredis@5.
|
|
8477
|
+
// ../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/SubscriptionSet.js
|
|
8166
8478
|
var require_SubscriptionSet = __commonJS({
|
|
8167
|
-
"../../node_modules/.pnpm/ioredis@5.
|
|
8479
|
+
"../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/SubscriptionSet.js"(exports$1) {
|
|
8168
8480
|
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
8169
8481
|
var SubscriptionSet = class {
|
|
8170
8482
|
constructor() {
|
|
@@ -8203,9 +8515,9 @@ var require_SubscriptionSet = __commonJS({
|
|
|
8203
8515
|
}
|
|
8204
8516
|
});
|
|
8205
8517
|
|
|
8206
|
-
// ../../node_modules/.pnpm/ioredis@5.
|
|
8518
|
+
// ../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/DataHandler.js
|
|
8207
8519
|
var require_DataHandler = __commonJS({
|
|
8208
|
-
"../../node_modules/.pnpm/ioredis@5.
|
|
8520
|
+
"../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/DataHandler.js"(exports$1) {
|
|
8209
8521
|
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
8210
8522
|
var Command_1 = require_Command();
|
|
8211
8523
|
var utils_1 = require_utils2();
|
|
@@ -8228,9 +8540,10 @@ var require_DataHandler = __commonJS({
|
|
|
8228
8540
|
this.returnReply(reply);
|
|
8229
8541
|
}
|
|
8230
8542
|
});
|
|
8231
|
-
redis.stream.
|
|
8543
|
+
redis.stream.prependListener("data", (data) => {
|
|
8232
8544
|
parser.execute(data);
|
|
8233
8545
|
});
|
|
8546
|
+
redis.stream.resume();
|
|
8234
8547
|
}
|
|
8235
8548
|
returnFatalError(err) {
|
|
8236
8549
|
err.message += ". Please report this.";
|
|
@@ -8405,9 +8718,9 @@ var require_DataHandler = __commonJS({
|
|
|
8405
8718
|
}
|
|
8406
8719
|
});
|
|
8407
8720
|
|
|
8408
|
-
// ../../node_modules/.pnpm/ioredis@5.
|
|
8721
|
+
// ../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/redis/event_handler.js
|
|
8409
8722
|
var require_event_handler = __commonJS({
|
|
8410
|
-
"../../node_modules/.pnpm/ioredis@5.
|
|
8723
|
+
"../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/redis/event_handler.js"(exports$1) {
|
|
8411
8724
|
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
8412
8725
|
exports$1.readyHandler = exports$1.errorHandler = exports$1.closeHandler = exports$1.connectHandler = void 0;
|
|
8413
8726
|
var redis_errors_1 = require_redis_errors();
|
|
@@ -8416,15 +8729,15 @@ var require_event_handler = __commonJS({
|
|
|
8416
8729
|
var utils_1 = require_utils2();
|
|
8417
8730
|
var DataHandler_1 = require_DataHandler();
|
|
8418
8731
|
var debug = (0, utils_1.Debug)("connection");
|
|
8419
|
-
function connectHandler(
|
|
8732
|
+
function connectHandler(self2) {
|
|
8420
8733
|
return function() {
|
|
8421
|
-
|
|
8422
|
-
|
|
8734
|
+
self2.setStatus("connect");
|
|
8735
|
+
self2.resetCommandQueue();
|
|
8423
8736
|
let flushed = false;
|
|
8424
|
-
const { connectionEpoch } =
|
|
8425
|
-
if (
|
|
8426
|
-
|
|
8427
|
-
if (connectionEpoch !==
|
|
8737
|
+
const { connectionEpoch } = self2;
|
|
8738
|
+
if (self2.condition.auth) {
|
|
8739
|
+
self2.auth(self2.condition.auth, function(err) {
|
|
8740
|
+
if (connectionEpoch !== self2.connectionEpoch) {
|
|
8428
8741
|
return;
|
|
8429
8742
|
}
|
|
8430
8743
|
if (err) {
|
|
@@ -8436,36 +8749,36 @@ var require_event_handler = __commonJS({
|
|
|
8436
8749
|
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.`);
|
|
8437
8750
|
} else {
|
|
8438
8751
|
flushed = true;
|
|
8439
|
-
|
|
8752
|
+
self2.recoverFromFatalError(err, err);
|
|
8440
8753
|
}
|
|
8441
8754
|
}
|
|
8442
8755
|
});
|
|
8443
8756
|
}
|
|
8444
|
-
if (
|
|
8445
|
-
|
|
8446
|
-
|
|
8757
|
+
if (self2.condition.select) {
|
|
8758
|
+
self2.select(self2.condition.select).catch((err) => {
|
|
8759
|
+
self2.silentEmit("error", err);
|
|
8447
8760
|
});
|
|
8448
8761
|
}
|
|
8449
|
-
if (!
|
|
8450
|
-
exports$1.readyHandler(
|
|
8762
|
+
if (!self2.options.enableReadyCheck) {
|
|
8763
|
+
exports$1.readyHandler(self2)();
|
|
8451
8764
|
}
|
|
8452
|
-
new DataHandler_1.default(
|
|
8453
|
-
stringNumbers:
|
|
8765
|
+
new DataHandler_1.default(self2, {
|
|
8766
|
+
stringNumbers: self2.options.stringNumbers
|
|
8454
8767
|
});
|
|
8455
|
-
if (
|
|
8456
|
-
|
|
8457
|
-
if (connectionEpoch !==
|
|
8768
|
+
if (self2.options.enableReadyCheck) {
|
|
8769
|
+
self2._readyCheck(function(err, info) {
|
|
8770
|
+
if (connectionEpoch !== self2.connectionEpoch) {
|
|
8458
8771
|
return;
|
|
8459
8772
|
}
|
|
8460
8773
|
if (err) {
|
|
8461
8774
|
if (!flushed) {
|
|
8462
|
-
|
|
8775
|
+
self2.recoverFromFatalError(new Error("Ready check failed: " + err.message), err);
|
|
8463
8776
|
}
|
|
8464
8777
|
} else {
|
|
8465
|
-
if (
|
|
8466
|
-
exports$1.readyHandler(
|
|
8778
|
+
if (self2.connector.check(info)) {
|
|
8779
|
+
exports$1.readyHandler(self2)();
|
|
8467
8780
|
} else {
|
|
8468
|
-
|
|
8781
|
+
self2.disconnect(true);
|
|
8469
8782
|
}
|
|
8470
8783
|
}
|
|
8471
8784
|
});
|
|
@@ -8518,152 +8831,152 @@ var require_event_handler = __commonJS({
|
|
|
8518
8831
|
}
|
|
8519
8832
|
}
|
|
8520
8833
|
}
|
|
8521
|
-
function closeHandler(
|
|
8834
|
+
function closeHandler(self2) {
|
|
8522
8835
|
return function() {
|
|
8523
|
-
const prevStatus =
|
|
8524
|
-
|
|
8525
|
-
if (
|
|
8526
|
-
abortIncompletePipelines(
|
|
8836
|
+
const prevStatus = self2.status;
|
|
8837
|
+
self2.setStatus("close");
|
|
8838
|
+
if (self2.commandQueue.length) {
|
|
8839
|
+
abortIncompletePipelines(self2.commandQueue);
|
|
8527
8840
|
}
|
|
8528
|
-
if (
|
|
8529
|
-
abortTransactionFragments(
|
|
8841
|
+
if (self2.offlineQueue.length) {
|
|
8842
|
+
abortTransactionFragments(self2.offlineQueue);
|
|
8530
8843
|
}
|
|
8531
8844
|
if (prevStatus === "ready") {
|
|
8532
|
-
if (!
|
|
8533
|
-
|
|
8845
|
+
if (!self2.prevCondition) {
|
|
8846
|
+
self2.prevCondition = self2.condition;
|
|
8534
8847
|
}
|
|
8535
|
-
if (
|
|
8536
|
-
|
|
8848
|
+
if (self2.commandQueue.length) {
|
|
8849
|
+
self2.prevCommandQueue = self2.commandQueue;
|
|
8537
8850
|
}
|
|
8538
8851
|
}
|
|
8539
|
-
if (
|
|
8540
|
-
|
|
8852
|
+
if (self2.manuallyClosing) {
|
|
8853
|
+
self2.manuallyClosing = false;
|
|
8541
8854
|
debug("skip reconnecting since the connection is manually closed.");
|
|
8542
8855
|
return close();
|
|
8543
8856
|
}
|
|
8544
|
-
if (typeof
|
|
8857
|
+
if (typeof self2.options.retryStrategy !== "function") {
|
|
8545
8858
|
debug("skip reconnecting because `retryStrategy` is not a function");
|
|
8546
8859
|
return close();
|
|
8547
8860
|
}
|
|
8548
|
-
const retryDelay =
|
|
8861
|
+
const retryDelay = self2.options.retryStrategy(++self2.retryAttempts);
|
|
8549
8862
|
if (typeof retryDelay !== "number") {
|
|
8550
8863
|
debug("skip reconnecting because `retryStrategy` doesn't return a number");
|
|
8551
8864
|
return close();
|
|
8552
8865
|
}
|
|
8553
8866
|
debug("reconnect in %sms", retryDelay);
|
|
8554
|
-
|
|
8555
|
-
|
|
8556
|
-
|
|
8557
|
-
|
|
8867
|
+
self2.setStatus("reconnecting", retryDelay);
|
|
8868
|
+
self2.reconnectTimeout = setTimeout(function() {
|
|
8869
|
+
self2.reconnectTimeout = null;
|
|
8870
|
+
self2.connect().catch(utils_1.noop);
|
|
8558
8871
|
}, retryDelay);
|
|
8559
|
-
const { maxRetriesPerRequest } =
|
|
8872
|
+
const { maxRetriesPerRequest } = self2.options;
|
|
8560
8873
|
if (typeof maxRetriesPerRequest === "number") {
|
|
8561
8874
|
if (maxRetriesPerRequest < 0) {
|
|
8562
8875
|
debug("maxRetriesPerRequest is negative, ignoring...");
|
|
8563
8876
|
} else {
|
|
8564
|
-
const remainder =
|
|
8877
|
+
const remainder = self2.retryAttempts % (maxRetriesPerRequest + 1);
|
|
8565
8878
|
if (remainder === 0) {
|
|
8566
8879
|
debug("reach maxRetriesPerRequest limitation, flushing command queue...");
|
|
8567
|
-
|
|
8880
|
+
self2.flushQueue(new errors_1.MaxRetriesPerRequestError(maxRetriesPerRequest));
|
|
8568
8881
|
}
|
|
8569
8882
|
}
|
|
8570
8883
|
}
|
|
8571
8884
|
};
|
|
8572
8885
|
function close() {
|
|
8573
|
-
|
|
8574
|
-
|
|
8886
|
+
self2.setStatus("end");
|
|
8887
|
+
self2.flushQueue(new Error(utils_1.CONNECTION_CLOSED_ERROR_MSG));
|
|
8575
8888
|
}
|
|
8576
8889
|
}
|
|
8577
8890
|
exports$1.closeHandler = closeHandler;
|
|
8578
|
-
function errorHandler(
|
|
8891
|
+
function errorHandler(self2) {
|
|
8579
8892
|
return function(error) {
|
|
8580
8893
|
debug("error: %s", error);
|
|
8581
|
-
|
|
8894
|
+
self2.silentEmit("error", error);
|
|
8582
8895
|
};
|
|
8583
8896
|
}
|
|
8584
8897
|
exports$1.errorHandler = errorHandler;
|
|
8585
|
-
function readyHandler(
|
|
8898
|
+
function readyHandler(self2) {
|
|
8586
8899
|
return function() {
|
|
8587
|
-
|
|
8588
|
-
|
|
8589
|
-
if (
|
|
8590
|
-
|
|
8591
|
-
const { sendCommand } =
|
|
8592
|
-
|
|
8900
|
+
self2.setStatus("ready");
|
|
8901
|
+
self2.retryAttempts = 0;
|
|
8902
|
+
if (self2.options.monitor) {
|
|
8903
|
+
self2.call("monitor").then(() => self2.setStatus("monitoring"), (error) => self2.emit("error", error));
|
|
8904
|
+
const { sendCommand } = self2;
|
|
8905
|
+
self2.sendCommand = function(command) {
|
|
8593
8906
|
if (Command_1.default.checkFlag("VALID_IN_MONITOR_MODE", command.name)) {
|
|
8594
|
-
return sendCommand.call(
|
|
8907
|
+
return sendCommand.call(self2, command);
|
|
8595
8908
|
}
|
|
8596
8909
|
command.reject(new Error("Connection is in monitoring mode, can't process commands."));
|
|
8597
8910
|
return command.promise;
|
|
8598
8911
|
};
|
|
8599
|
-
|
|
8600
|
-
delete
|
|
8912
|
+
self2.once("close", function() {
|
|
8913
|
+
delete self2.sendCommand;
|
|
8601
8914
|
});
|
|
8602
8915
|
return;
|
|
8603
8916
|
}
|
|
8604
|
-
const finalSelect =
|
|
8605
|
-
if (
|
|
8606
|
-
debug("set the connection name [%s]",
|
|
8607
|
-
|
|
8917
|
+
const finalSelect = self2.prevCondition ? self2.prevCondition.select : self2.condition.select;
|
|
8918
|
+
if (self2.options.connectionName) {
|
|
8919
|
+
debug("set the connection name [%s]", self2.options.connectionName);
|
|
8920
|
+
self2.client("setname", self2.options.connectionName).catch(utils_1.noop);
|
|
8608
8921
|
}
|
|
8609
|
-
if (
|
|
8922
|
+
if (self2.options.readOnly) {
|
|
8610
8923
|
debug("set the connection to readonly mode");
|
|
8611
|
-
|
|
8924
|
+
self2.readonly().catch(utils_1.noop);
|
|
8612
8925
|
}
|
|
8613
|
-
if (
|
|
8614
|
-
const condition =
|
|
8615
|
-
|
|
8616
|
-
if (condition.subscriber &&
|
|
8617
|
-
if (
|
|
8926
|
+
if (self2.prevCondition) {
|
|
8927
|
+
const condition = self2.prevCondition;
|
|
8928
|
+
self2.prevCondition = null;
|
|
8929
|
+
if (condition.subscriber && self2.options.autoResubscribe) {
|
|
8930
|
+
if (self2.condition.select !== finalSelect) {
|
|
8618
8931
|
debug("connect to db [%d]", finalSelect);
|
|
8619
|
-
|
|
8932
|
+
self2.select(finalSelect);
|
|
8620
8933
|
}
|
|
8621
8934
|
const subscribeChannels = condition.subscriber.channels("subscribe");
|
|
8622
8935
|
if (subscribeChannels.length) {
|
|
8623
8936
|
debug("subscribe %d channels", subscribeChannels.length);
|
|
8624
|
-
|
|
8937
|
+
self2.subscribe(subscribeChannels);
|
|
8625
8938
|
}
|
|
8626
8939
|
const psubscribeChannels = condition.subscriber.channels("psubscribe");
|
|
8627
8940
|
if (psubscribeChannels.length) {
|
|
8628
8941
|
debug("psubscribe %d channels", psubscribeChannels.length);
|
|
8629
|
-
|
|
8942
|
+
self2.psubscribe(psubscribeChannels);
|
|
8630
8943
|
}
|
|
8631
8944
|
const ssubscribeChannels = condition.subscriber.channels("ssubscribe");
|
|
8632
8945
|
if (ssubscribeChannels.length) {
|
|
8633
8946
|
debug("ssubscribe %d channels", ssubscribeChannels.length);
|
|
8634
|
-
|
|
8947
|
+
self2.ssubscribe(ssubscribeChannels);
|
|
8635
8948
|
}
|
|
8636
8949
|
}
|
|
8637
8950
|
}
|
|
8638
|
-
if (
|
|
8639
|
-
if (
|
|
8640
|
-
debug("resend %d unfulfilled commands",
|
|
8641
|
-
while (
|
|
8642
|
-
const item =
|
|
8643
|
-
if (item.select !==
|
|
8644
|
-
|
|
8951
|
+
if (self2.prevCommandQueue) {
|
|
8952
|
+
if (self2.options.autoResendUnfulfilledCommands) {
|
|
8953
|
+
debug("resend %d unfulfilled commands", self2.prevCommandQueue.length);
|
|
8954
|
+
while (self2.prevCommandQueue.length > 0) {
|
|
8955
|
+
const item = self2.prevCommandQueue.shift();
|
|
8956
|
+
if (item.select !== self2.condition.select && item.command.name !== "select") {
|
|
8957
|
+
self2.select(item.select);
|
|
8645
8958
|
}
|
|
8646
|
-
|
|
8959
|
+
self2.sendCommand(item.command, item.stream);
|
|
8647
8960
|
}
|
|
8648
8961
|
} else {
|
|
8649
|
-
|
|
8962
|
+
self2.prevCommandQueue = null;
|
|
8650
8963
|
}
|
|
8651
8964
|
}
|
|
8652
|
-
if (
|
|
8653
|
-
debug("send %d commands in offline queue",
|
|
8654
|
-
const offlineQueue =
|
|
8655
|
-
|
|
8965
|
+
if (self2.offlineQueue.length) {
|
|
8966
|
+
debug("send %d commands in offline queue", self2.offlineQueue.length);
|
|
8967
|
+
const offlineQueue = self2.offlineQueue;
|
|
8968
|
+
self2.resetOfflineQueue();
|
|
8656
8969
|
while (offlineQueue.length > 0) {
|
|
8657
8970
|
const item = offlineQueue.shift();
|
|
8658
|
-
if (item.select !==
|
|
8659
|
-
|
|
8971
|
+
if (item.select !== self2.condition.select && item.command.name !== "select") {
|
|
8972
|
+
self2.select(item.select);
|
|
8660
8973
|
}
|
|
8661
|
-
|
|
8974
|
+
self2.sendCommand(item.command, item.stream);
|
|
8662
8975
|
}
|
|
8663
8976
|
}
|
|
8664
|
-
if (
|
|
8977
|
+
if (self2.condition.select !== finalSelect) {
|
|
8665
8978
|
debug("connect to db [%d]", finalSelect);
|
|
8666
|
-
|
|
8979
|
+
self2.select(finalSelect);
|
|
8667
8980
|
}
|
|
8668
8981
|
};
|
|
8669
8982
|
}
|
|
@@ -8671,9 +8984,9 @@ var require_event_handler = __commonJS({
|
|
|
8671
8984
|
}
|
|
8672
8985
|
});
|
|
8673
8986
|
|
|
8674
|
-
// ../../node_modules/.pnpm/ioredis@5.
|
|
8987
|
+
// ../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/redis/RedisOptions.js
|
|
8675
8988
|
var require_RedisOptions = __commonJS({
|
|
8676
|
-
"../../node_modules/.pnpm/ioredis@5.
|
|
8989
|
+
"../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/redis/RedisOptions.js"(exports$1) {
|
|
8677
8990
|
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
8678
8991
|
exports$1.DEFAULT_REDIS_OPTIONS = void 0;
|
|
8679
8992
|
exports$1.DEFAULT_REDIS_OPTIONS = {
|
|
@@ -8726,9 +9039,9 @@ var require_RedisOptions = __commonJS({
|
|
|
8726
9039
|
}
|
|
8727
9040
|
});
|
|
8728
9041
|
|
|
8729
|
-
// ../../node_modules/.pnpm/ioredis@5.
|
|
9042
|
+
// ../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/Redis.js
|
|
8730
9043
|
var require_Redis = __commonJS({
|
|
8731
|
-
"../../node_modules/.pnpm/ioredis@5.
|
|
9044
|
+
"../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/Redis.js"(exports$1) {
|
|
8732
9045
|
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
8733
9046
|
var commands_1 = require_built();
|
|
8734
9047
|
var events_1 = __require("events");
|
|
@@ -9065,6 +9378,9 @@ var require_Redis = __commonJS({
|
|
|
9065
9378
|
if (Command_1.default.checkFlag("WILL_DISCONNECT", command.name)) {
|
|
9066
9379
|
this.manuallyClosing = true;
|
|
9067
9380
|
}
|
|
9381
|
+
if (this.options.socketTimeout !== void 0 && this.socketTimeoutTimer === void 0) {
|
|
9382
|
+
this.setSocketTimeout();
|
|
9383
|
+
}
|
|
9068
9384
|
}
|
|
9069
9385
|
if (command.name === "select" && (0, utils_1.isInt)(command.args[0])) {
|
|
9070
9386
|
const db = parseInt(command.args[0], 10);
|
|
@@ -9076,6 +9392,19 @@ var require_Redis = __commonJS({
|
|
|
9076
9392
|
}
|
|
9077
9393
|
return command.promise;
|
|
9078
9394
|
}
|
|
9395
|
+
setSocketTimeout() {
|
|
9396
|
+
this.socketTimeoutTimer = setTimeout(() => {
|
|
9397
|
+
this.stream.destroy(new Error(`Socket timeout. Expecting data, but didn't receive any in ${this.options.socketTimeout}ms.`));
|
|
9398
|
+
this.socketTimeoutTimer = void 0;
|
|
9399
|
+
}, this.options.socketTimeout);
|
|
9400
|
+
this.stream.once("data", () => {
|
|
9401
|
+
clearTimeout(this.socketTimeoutTimer);
|
|
9402
|
+
this.socketTimeoutTimer = void 0;
|
|
9403
|
+
if (this.commandQueue.length === 0)
|
|
9404
|
+
return;
|
|
9405
|
+
this.setSocketTimeout();
|
|
9406
|
+
});
|
|
9407
|
+
}
|
|
9079
9408
|
scanStream(options) {
|
|
9080
9409
|
return this.createScanStream("scan", { options });
|
|
9081
9410
|
}
|
|
@@ -9319,9 +9648,9 @@ var require_Redis = __commonJS({
|
|
|
9319
9648
|
}
|
|
9320
9649
|
});
|
|
9321
9650
|
|
|
9322
|
-
// ../../node_modules/.pnpm/ioredis@5.
|
|
9651
|
+
// ../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/index.js
|
|
9323
9652
|
var require_built3 = __commonJS({
|
|
9324
|
-
"../../node_modules/.pnpm/ioredis@5.
|
|
9653
|
+
"../../node_modules/.pnpm/ioredis@5.6.1/node_modules/ioredis/built/index.js"(exports$1, module) {
|
|
9325
9654
|
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
9326
9655
|
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;
|
|
9327
9656
|
exports$1 = module.exports = require_Redis().default;
|
|
@@ -9959,24 +10288,19 @@ var SimpleQueue = class {
|
|
|
9959
10288
|
}
|
|
9960
10289
|
};
|
|
9961
10290
|
|
|
9962
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.
|
|
9963
|
-
var
|
|
9964
|
-
|
|
9965
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/version.js
|
|
9966
|
-
var VERSION = "1.9.0";
|
|
10291
|
+
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/version.js
|
|
10292
|
+
var VERSION = "1.9.1";
|
|
9967
10293
|
|
|
9968
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.
|
|
10294
|
+
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/internal/semver.js
|
|
9969
10295
|
var re = /^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;
|
|
9970
10296
|
function _makeCompatibilityCheck(ownVersion) {
|
|
9971
|
-
|
|
9972
|
-
|
|
9973
|
-
|
|
10297
|
+
const acceptedVersions = /* @__PURE__ */ new Set([ownVersion]);
|
|
10298
|
+
const rejectedVersions = /* @__PURE__ */ new Set();
|
|
10299
|
+
const myVersionMatch = ownVersion.match(re);
|
|
9974
10300
|
if (!myVersionMatch) {
|
|
9975
|
-
return
|
|
9976
|
-
return false;
|
|
9977
|
-
};
|
|
10301
|
+
return () => false;
|
|
9978
10302
|
}
|
|
9979
|
-
|
|
10303
|
+
const ownVersionParsed = {
|
|
9980
10304
|
major: +myVersionMatch[1],
|
|
9981
10305
|
minor: +myVersionMatch[2],
|
|
9982
10306
|
patch: +myVersionMatch[3],
|
|
@@ -10002,11 +10326,11 @@ function _makeCompatibilityCheck(ownVersion) {
|
|
|
10002
10326
|
if (rejectedVersions.has(globalVersion)) {
|
|
10003
10327
|
return false;
|
|
10004
10328
|
}
|
|
10005
|
-
|
|
10329
|
+
const globalVersionMatch = globalVersion.match(re);
|
|
10006
10330
|
if (!globalVersionMatch) {
|
|
10007
10331
|
return _reject(globalVersion);
|
|
10008
10332
|
}
|
|
10009
|
-
|
|
10333
|
+
const globalVersionParsed = {
|
|
10010
10334
|
major: +globalVersionMatch[1],
|
|
10011
10335
|
minor: +globalVersionMatch[2],
|
|
10012
10336
|
patch: +globalVersionMatch[3],
|
|
@@ -10032,129 +10356,75 @@ function _makeCompatibilityCheck(ownVersion) {
|
|
|
10032
10356
|
}
|
|
10033
10357
|
var isCompatible = _makeCompatibilityCheck(VERSION);
|
|
10034
10358
|
|
|
10035
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.
|
|
10359
|
+
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/internal/global-utils.js
|
|
10036
10360
|
var major = VERSION.split(".")[0];
|
|
10037
|
-
var GLOBAL_OPENTELEMETRY_API_KEY = Symbol.for(
|
|
10038
|
-
var _global =
|
|
10039
|
-
function registerGlobal(type, instance, diag, allowOverride) {
|
|
10361
|
+
var GLOBAL_OPENTELEMETRY_API_KEY = Symbol.for(`opentelemetry.js.api.${major}`);
|
|
10362
|
+
var _global = typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : typeof window === "object" ? window : typeof global === "object" ? global : {};
|
|
10363
|
+
function registerGlobal(type, instance, diag, allowOverride = false) {
|
|
10040
10364
|
var _a;
|
|
10041
|
-
|
|
10042
|
-
allowOverride = false;
|
|
10043
|
-
}
|
|
10044
|
-
var api = _global[GLOBAL_OPENTELEMETRY_API_KEY] = (_a = _global[GLOBAL_OPENTELEMETRY_API_KEY]) !== null && _a !== void 0 ? _a : {
|
|
10365
|
+
const api = _global[GLOBAL_OPENTELEMETRY_API_KEY] = (_a = _global[GLOBAL_OPENTELEMETRY_API_KEY]) !== null && _a !== void 0 ? _a : {
|
|
10045
10366
|
version: VERSION
|
|
10046
10367
|
};
|
|
10047
10368
|
if (!allowOverride && api[type]) {
|
|
10048
|
-
|
|
10369
|
+
const err = new Error(`@opentelemetry/api: Attempted duplicate registration of API: ${type}`);
|
|
10049
10370
|
diag.error(err.stack || err.message);
|
|
10050
10371
|
return false;
|
|
10051
10372
|
}
|
|
10052
10373
|
if (api.version !== VERSION) {
|
|
10053
|
-
|
|
10374
|
+
const err = new Error(`@opentelemetry/api: Registration of version v${api.version} for ${type} does not match previously registered API v${VERSION}`);
|
|
10054
10375
|
diag.error(err.stack || err.message);
|
|
10055
10376
|
return false;
|
|
10056
10377
|
}
|
|
10057
10378
|
api[type] = instance;
|
|
10058
|
-
diag.debug(
|
|
10379
|
+
diag.debug(`@opentelemetry/api: Registered a global for ${type} v${VERSION}.`);
|
|
10059
10380
|
return true;
|
|
10060
10381
|
}
|
|
10061
10382
|
function getGlobal(type) {
|
|
10062
10383
|
var _a, _b;
|
|
10063
|
-
|
|
10384
|
+
const globalVersion = (_a = _global[GLOBAL_OPENTELEMETRY_API_KEY]) === null || _a === void 0 ? void 0 : _a.version;
|
|
10064
10385
|
if (!globalVersion || !isCompatible(globalVersion)) {
|
|
10065
10386
|
return;
|
|
10066
10387
|
}
|
|
10067
10388
|
return (_b = _global[GLOBAL_OPENTELEMETRY_API_KEY]) === null || _b === void 0 ? void 0 : _b[type];
|
|
10068
10389
|
}
|
|
10069
10390
|
function unregisterGlobal(type, diag) {
|
|
10070
|
-
diag.debug(
|
|
10071
|
-
|
|
10391
|
+
diag.debug(`@opentelemetry/api: Unregistering a global for ${type} v${VERSION}.`);
|
|
10392
|
+
const api = _global[GLOBAL_OPENTELEMETRY_API_KEY];
|
|
10072
10393
|
if (api) {
|
|
10073
10394
|
delete api[type];
|
|
10074
10395
|
}
|
|
10075
10396
|
}
|
|
10076
10397
|
|
|
10077
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.
|
|
10078
|
-
var
|
|
10079
|
-
|
|
10080
|
-
|
|
10081
|
-
var i = m.call(o), r, ar = [], e;
|
|
10082
|
-
try {
|
|
10083
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
10084
|
-
} catch (error) {
|
|
10085
|
-
e = { error };
|
|
10086
|
-
} finally {
|
|
10087
|
-
try {
|
|
10088
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
10089
|
-
} finally {
|
|
10090
|
-
if (e) throw e.error;
|
|
10091
|
-
}
|
|
10398
|
+
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/diag/ComponentLogger.js
|
|
10399
|
+
var DiagComponentLogger = class {
|
|
10400
|
+
constructor(props) {
|
|
10401
|
+
this._namespace = props.namespace || "DiagComponentLogger";
|
|
10092
10402
|
}
|
|
10093
|
-
|
|
10094
|
-
|
|
10095
|
-
|
|
10096
|
-
|
|
10097
|
-
|
|
10098
|
-
|
|
10099
|
-
|
|
10100
|
-
|
|
10403
|
+
debug(...args) {
|
|
10404
|
+
return logProxy("debug", this._namespace, args);
|
|
10405
|
+
}
|
|
10406
|
+
error(...args) {
|
|
10407
|
+
return logProxy("error", this._namespace, args);
|
|
10408
|
+
}
|
|
10409
|
+
info(...args) {
|
|
10410
|
+
return logProxy("info", this._namespace, args);
|
|
10411
|
+
}
|
|
10412
|
+
warn(...args) {
|
|
10413
|
+
return logProxy("warn", this._namespace, args);
|
|
10414
|
+
}
|
|
10415
|
+
verbose(...args) {
|
|
10416
|
+
return logProxy("verbose", this._namespace, args);
|
|
10101
10417
|
}
|
|
10102
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
10103
10418
|
};
|
|
10104
|
-
var DiagComponentLogger = (
|
|
10105
|
-
/** @class */
|
|
10106
|
-
function() {
|
|
10107
|
-
function DiagComponentLogger2(props) {
|
|
10108
|
-
this._namespace = props.namespace || "DiagComponentLogger";
|
|
10109
|
-
}
|
|
10110
|
-
DiagComponentLogger2.prototype.debug = function() {
|
|
10111
|
-
var args = [];
|
|
10112
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
10113
|
-
args[_i] = arguments[_i];
|
|
10114
|
-
}
|
|
10115
|
-
return logProxy("debug", this._namespace, args);
|
|
10116
|
-
};
|
|
10117
|
-
DiagComponentLogger2.prototype.error = function() {
|
|
10118
|
-
var args = [];
|
|
10119
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
10120
|
-
args[_i] = arguments[_i];
|
|
10121
|
-
}
|
|
10122
|
-
return logProxy("error", this._namespace, args);
|
|
10123
|
-
};
|
|
10124
|
-
DiagComponentLogger2.prototype.info = function() {
|
|
10125
|
-
var args = [];
|
|
10126
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
10127
|
-
args[_i] = arguments[_i];
|
|
10128
|
-
}
|
|
10129
|
-
return logProxy("info", this._namespace, args);
|
|
10130
|
-
};
|
|
10131
|
-
DiagComponentLogger2.prototype.warn = function() {
|
|
10132
|
-
var args = [];
|
|
10133
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
10134
|
-
args[_i] = arguments[_i];
|
|
10135
|
-
}
|
|
10136
|
-
return logProxy("warn", this._namespace, args);
|
|
10137
|
-
};
|
|
10138
|
-
DiagComponentLogger2.prototype.verbose = function() {
|
|
10139
|
-
var args = [];
|
|
10140
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
10141
|
-
args[_i] = arguments[_i];
|
|
10142
|
-
}
|
|
10143
|
-
return logProxy("verbose", this._namespace, args);
|
|
10144
|
-
};
|
|
10145
|
-
return DiagComponentLogger2;
|
|
10146
|
-
}()
|
|
10147
|
-
);
|
|
10148
10419
|
function logProxy(funcName, namespace, args) {
|
|
10149
|
-
|
|
10420
|
+
const logger2 = getGlobal("diag");
|
|
10150
10421
|
if (!logger2) {
|
|
10151
10422
|
return;
|
|
10152
10423
|
}
|
|
10153
|
-
|
|
10154
|
-
return logger2[funcName].apply(logger2, __spreadArray([], __read(args), false));
|
|
10424
|
+
return logger2[funcName](namespace, ...args);
|
|
10155
10425
|
}
|
|
10156
10426
|
|
|
10157
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.
|
|
10427
|
+
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/diag/types.js
|
|
10158
10428
|
var DiagLogLevel;
|
|
10159
10429
|
(function(DiagLogLevel2) {
|
|
10160
10430
|
DiagLogLevel2[DiagLogLevel2["NONE"] = 0] = "NONE";
|
|
@@ -10166,7 +10436,7 @@ var DiagLogLevel;
|
|
|
10166
10436
|
DiagLogLevel2[DiagLogLevel2["ALL"] = 9999] = "ALL";
|
|
10167
10437
|
})(DiagLogLevel || (DiagLogLevel = {}));
|
|
10168
10438
|
|
|
10169
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.
|
|
10439
|
+
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/diag/internal/logLevelLogger.js
|
|
10170
10440
|
function createLogLevelDiagLogger(maxLevel, logger2) {
|
|
10171
10441
|
if (maxLevel < DiagLogLevel.NONE) {
|
|
10172
10442
|
maxLevel = DiagLogLevel.NONE;
|
|
@@ -10175,7 +10445,7 @@ function createLogLevelDiagLogger(maxLevel, logger2) {
|
|
|
10175
10445
|
}
|
|
10176
10446
|
logger2 = logger2 || {};
|
|
10177
10447
|
function _filterFunc(funcName, theLevel) {
|
|
10178
|
-
|
|
10448
|
+
const theFunc = logger2[funcName];
|
|
10179
10449
|
if (typeof theFunc === "function" && maxLevel >= theLevel) {
|
|
10180
10450
|
return theFunc.bind(logger2);
|
|
10181
10451
|
}
|
|
@@ -10191,278 +10461,181 @@ function createLogLevelDiagLogger(maxLevel, logger2) {
|
|
|
10191
10461
|
};
|
|
10192
10462
|
}
|
|
10193
10463
|
|
|
10194
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.
|
|
10195
|
-
var
|
|
10196
|
-
|
|
10197
|
-
|
|
10198
|
-
|
|
10199
|
-
|
|
10200
|
-
|
|
10201
|
-
} catch (error) {
|
|
10202
|
-
e = { error };
|
|
10203
|
-
} finally {
|
|
10204
|
-
try {
|
|
10205
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
10206
|
-
} finally {
|
|
10207
|
-
if (e) throw e.error;
|
|
10464
|
+
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/api/diag.js
|
|
10465
|
+
var API_NAME = "diag";
|
|
10466
|
+
var DiagAPI = class _DiagAPI {
|
|
10467
|
+
/** Get the singleton instance of the DiagAPI API */
|
|
10468
|
+
static instance() {
|
|
10469
|
+
if (!this._instance) {
|
|
10470
|
+
this._instance = new _DiagAPI();
|
|
10208
10471
|
}
|
|
10472
|
+
return this._instance;
|
|
10209
10473
|
}
|
|
10210
|
-
|
|
10211
|
-
|
|
10212
|
-
|
|
10213
|
-
|
|
10214
|
-
|
|
10215
|
-
|
|
10216
|
-
|
|
10474
|
+
/**
|
|
10475
|
+
* Private internal constructor
|
|
10476
|
+
* @private
|
|
10477
|
+
*/
|
|
10478
|
+
constructor() {
|
|
10479
|
+
function _logProxy(funcName) {
|
|
10480
|
+
return function(...args) {
|
|
10481
|
+
const logger2 = getGlobal("diag");
|
|
10482
|
+
if (!logger2)
|
|
10483
|
+
return;
|
|
10484
|
+
return logger2[funcName](...args);
|
|
10485
|
+
};
|
|
10217
10486
|
}
|
|
10218
|
-
|
|
10219
|
-
|
|
10220
|
-
|
|
10221
|
-
|
|
10222
|
-
|
|
10223
|
-
|
|
10224
|
-
|
|
10225
|
-
|
|
10226
|
-
|
|
10227
|
-
|
|
10228
|
-
|
|
10229
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
10230
|
-
args[_i] = arguments[_i];
|
|
10231
|
-
}
|
|
10232
|
-
var logger2 = getGlobal("diag");
|
|
10233
|
-
if (!logger2)
|
|
10234
|
-
return;
|
|
10235
|
-
return logger2[funcName].apply(logger2, __spreadArray2([], __read2(args), false));
|
|
10487
|
+
const self2 = this;
|
|
10488
|
+
const setLogger = (logger2, optionsOrLogLevel = { logLevel: DiagLogLevel.INFO }) => {
|
|
10489
|
+
var _a, _b, _c;
|
|
10490
|
+
if (logger2 === self2) {
|
|
10491
|
+
const err = new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");
|
|
10492
|
+
self2.error((_a = err.stack) !== null && _a !== void 0 ? _a : err.message);
|
|
10493
|
+
return false;
|
|
10494
|
+
}
|
|
10495
|
+
if (typeof optionsOrLogLevel === "number") {
|
|
10496
|
+
optionsOrLogLevel = {
|
|
10497
|
+
logLevel: optionsOrLogLevel
|
|
10236
10498
|
};
|
|
10237
10499
|
}
|
|
10238
|
-
|
|
10239
|
-
|
|
10240
|
-
|
|
10241
|
-
|
|
10242
|
-
|
|
10243
|
-
}
|
|
10244
|
-
if (logger2 === self) {
|
|
10245
|
-
var err = new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");
|
|
10246
|
-
self.error((_a = err.stack) !== null && _a !== void 0 ? _a : err.message);
|
|
10247
|
-
return false;
|
|
10248
|
-
}
|
|
10249
|
-
if (typeof optionsOrLogLevel === "number") {
|
|
10250
|
-
optionsOrLogLevel = {
|
|
10251
|
-
logLevel: optionsOrLogLevel
|
|
10252
|
-
};
|
|
10253
|
-
}
|
|
10254
|
-
var oldLogger = getGlobal("diag");
|
|
10255
|
-
var newLogger = createLogLevelDiagLogger((_b = optionsOrLogLevel.logLevel) !== null && _b !== void 0 ? _b : DiagLogLevel.INFO, logger2);
|
|
10256
|
-
if (oldLogger && !optionsOrLogLevel.suppressOverrideMessage) {
|
|
10257
|
-
var stack = (_c = new Error().stack) !== null && _c !== void 0 ? _c : "<failed to generate stacktrace>";
|
|
10258
|
-
oldLogger.warn("Current logger will be overwritten from " + stack);
|
|
10259
|
-
newLogger.warn("Current logger will overwrite one already registered from " + stack);
|
|
10260
|
-
}
|
|
10261
|
-
return registerGlobal("diag", newLogger, self, true);
|
|
10262
|
-
};
|
|
10263
|
-
self.setLogger = setLogger;
|
|
10264
|
-
self.disable = function() {
|
|
10265
|
-
unregisterGlobal(API_NAME, self);
|
|
10266
|
-
};
|
|
10267
|
-
self.createComponentLogger = function(options) {
|
|
10268
|
-
return new DiagComponentLogger(options);
|
|
10269
|
-
};
|
|
10270
|
-
self.verbose = _logProxy("verbose");
|
|
10271
|
-
self.debug = _logProxy("debug");
|
|
10272
|
-
self.info = _logProxy("info");
|
|
10273
|
-
self.warn = _logProxy("warn");
|
|
10274
|
-
self.error = _logProxy("error");
|
|
10275
|
-
}
|
|
10276
|
-
DiagAPI2.instance = function() {
|
|
10277
|
-
if (!this._instance) {
|
|
10278
|
-
this._instance = new DiagAPI2();
|
|
10500
|
+
const oldLogger = getGlobal("diag");
|
|
10501
|
+
const newLogger = createLogLevelDiagLogger((_b = optionsOrLogLevel.logLevel) !== null && _b !== void 0 ? _b : DiagLogLevel.INFO, logger2);
|
|
10502
|
+
if (oldLogger && !optionsOrLogLevel.suppressOverrideMessage) {
|
|
10503
|
+
const stack = (_c = new Error().stack) !== null && _c !== void 0 ? _c : "<failed to generate stacktrace>";
|
|
10504
|
+
oldLogger.warn(`Current logger will be overwritten from ${stack}`);
|
|
10505
|
+
newLogger.warn(`Current logger will overwrite one already registered from ${stack}`);
|
|
10279
10506
|
}
|
|
10280
|
-
return
|
|
10507
|
+
return registerGlobal("diag", newLogger, self2, true);
|
|
10508
|
+
};
|
|
10509
|
+
self2.setLogger = setLogger;
|
|
10510
|
+
self2.disable = () => {
|
|
10511
|
+
unregisterGlobal(API_NAME, self2);
|
|
10281
10512
|
};
|
|
10282
|
-
|
|
10283
|
-
|
|
10284
|
-
|
|
10513
|
+
self2.createComponentLogger = (options) => {
|
|
10514
|
+
return new DiagComponentLogger(options);
|
|
10515
|
+
};
|
|
10516
|
+
self2.verbose = _logProxy("verbose");
|
|
10517
|
+
self2.debug = _logProxy("debug");
|
|
10518
|
+
self2.info = _logProxy("info");
|
|
10519
|
+
self2.warn = _logProxy("warn");
|
|
10520
|
+
self2.error = _logProxy("error");
|
|
10521
|
+
}
|
|
10522
|
+
};
|
|
10285
10523
|
|
|
10286
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.
|
|
10524
|
+
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/context/context.js
|
|
10287
10525
|
function createContextKey(description) {
|
|
10288
10526
|
return Symbol.for(description);
|
|
10289
10527
|
}
|
|
10290
|
-
var BaseContext =
|
|
10291
|
-
/**
|
|
10292
|
-
|
|
10293
|
-
|
|
10294
|
-
|
|
10295
|
-
|
|
10296
|
-
|
|
10297
|
-
|
|
10298
|
-
|
|
10299
|
-
|
|
10300
|
-
|
|
10301
|
-
|
|
10302
|
-
|
|
10303
|
-
|
|
10304
|
-
self.deleteValue = function(key) {
|
|
10305
|
-
var context2 = new BaseContext2(self._currentContext);
|
|
10306
|
-
context2._currentContext.delete(key);
|
|
10307
|
-
return context2;
|
|
10308
|
-
};
|
|
10309
|
-
}
|
|
10310
|
-
return BaseContext2;
|
|
10311
|
-
}()
|
|
10312
|
-
);
|
|
10313
|
-
var ROOT_CONTEXT = new BaseContext();
|
|
10314
|
-
|
|
10315
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/metrics/NoopMeter.js
|
|
10316
|
-
var __extends = /* @__PURE__ */ function() {
|
|
10317
|
-
var extendStatics = function(d, b) {
|
|
10318
|
-
extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
|
|
10319
|
-
d2.__proto__ = b2;
|
|
10320
|
-
} || function(d2, b2) {
|
|
10321
|
-
for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p];
|
|
10322
|
-
};
|
|
10323
|
-
return extendStatics(d, b);
|
|
10324
|
-
};
|
|
10325
|
-
return function(d, b) {
|
|
10326
|
-
if (typeof b !== "function" && b !== null)
|
|
10327
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
10328
|
-
extendStatics(d, b);
|
|
10329
|
-
function __() {
|
|
10330
|
-
this.constructor = d;
|
|
10331
|
-
}
|
|
10332
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
10333
|
-
};
|
|
10334
|
-
}();
|
|
10335
|
-
var NoopMeter = (
|
|
10336
|
-
/** @class */
|
|
10337
|
-
function() {
|
|
10338
|
-
function NoopMeter2() {
|
|
10339
|
-
}
|
|
10340
|
-
NoopMeter2.prototype.createGauge = function(_name, _options) {
|
|
10341
|
-
return NOOP_GAUGE_METRIC;
|
|
10342
|
-
};
|
|
10343
|
-
NoopMeter2.prototype.createHistogram = function(_name, _options) {
|
|
10344
|
-
return NOOP_HISTOGRAM_METRIC;
|
|
10345
|
-
};
|
|
10346
|
-
NoopMeter2.prototype.createCounter = function(_name, _options) {
|
|
10347
|
-
return NOOP_COUNTER_METRIC;
|
|
10348
|
-
};
|
|
10349
|
-
NoopMeter2.prototype.createUpDownCounter = function(_name, _options) {
|
|
10350
|
-
return NOOP_UP_DOWN_COUNTER_METRIC;
|
|
10351
|
-
};
|
|
10352
|
-
NoopMeter2.prototype.createObservableGauge = function(_name, _options) {
|
|
10353
|
-
return NOOP_OBSERVABLE_GAUGE_METRIC;
|
|
10354
|
-
};
|
|
10355
|
-
NoopMeter2.prototype.createObservableCounter = function(_name, _options) {
|
|
10356
|
-
return NOOP_OBSERVABLE_COUNTER_METRIC;
|
|
10357
|
-
};
|
|
10358
|
-
NoopMeter2.prototype.createObservableUpDownCounter = function(_name, _options) {
|
|
10359
|
-
return NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC;
|
|
10360
|
-
};
|
|
10361
|
-
NoopMeter2.prototype.addBatchObservableCallback = function(_callback, _observables) {
|
|
10362
|
-
};
|
|
10363
|
-
NoopMeter2.prototype.removeBatchObservableCallback = function(_callback) {
|
|
10364
|
-
};
|
|
10365
|
-
return NoopMeter2;
|
|
10366
|
-
}()
|
|
10367
|
-
);
|
|
10368
|
-
var NoopMetric = (
|
|
10369
|
-
/** @class */
|
|
10370
|
-
/* @__PURE__ */ function() {
|
|
10371
|
-
function NoopMetric2() {
|
|
10372
|
-
}
|
|
10373
|
-
return NoopMetric2;
|
|
10374
|
-
}()
|
|
10375
|
-
);
|
|
10376
|
-
var NoopCounterMetric = (
|
|
10377
|
-
/** @class */
|
|
10378
|
-
function(_super) {
|
|
10379
|
-
__extends(NoopCounterMetric2, _super);
|
|
10380
|
-
function NoopCounterMetric2() {
|
|
10381
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
10382
|
-
}
|
|
10383
|
-
NoopCounterMetric2.prototype.add = function(_value, _attributes) {
|
|
10384
|
-
};
|
|
10385
|
-
return NoopCounterMetric2;
|
|
10386
|
-
}(NoopMetric)
|
|
10387
|
-
);
|
|
10388
|
-
var NoopUpDownCounterMetric = (
|
|
10389
|
-
/** @class */
|
|
10390
|
-
function(_super) {
|
|
10391
|
-
__extends(NoopUpDownCounterMetric2, _super);
|
|
10392
|
-
function NoopUpDownCounterMetric2() {
|
|
10393
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
10394
|
-
}
|
|
10395
|
-
NoopUpDownCounterMetric2.prototype.add = function(_value, _attributes) {
|
|
10396
|
-
};
|
|
10397
|
-
return NoopUpDownCounterMetric2;
|
|
10398
|
-
}(NoopMetric)
|
|
10399
|
-
);
|
|
10400
|
-
var NoopGaugeMetric = (
|
|
10401
|
-
/** @class */
|
|
10402
|
-
function(_super) {
|
|
10403
|
-
__extends(NoopGaugeMetric2, _super);
|
|
10404
|
-
function NoopGaugeMetric2() {
|
|
10405
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
10406
|
-
}
|
|
10407
|
-
NoopGaugeMetric2.prototype.record = function(_value, _attributes) {
|
|
10408
|
-
};
|
|
10409
|
-
return NoopGaugeMetric2;
|
|
10410
|
-
}(NoopMetric)
|
|
10411
|
-
);
|
|
10412
|
-
var NoopHistogramMetric = (
|
|
10413
|
-
/** @class */
|
|
10414
|
-
function(_super) {
|
|
10415
|
-
__extends(NoopHistogramMetric2, _super);
|
|
10416
|
-
function NoopHistogramMetric2() {
|
|
10417
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
10418
|
-
}
|
|
10419
|
-
NoopHistogramMetric2.prototype.record = function(_value, _attributes) {
|
|
10420
|
-
};
|
|
10421
|
-
return NoopHistogramMetric2;
|
|
10422
|
-
}(NoopMetric)
|
|
10423
|
-
);
|
|
10424
|
-
var NoopObservableMetric = (
|
|
10425
|
-
/** @class */
|
|
10426
|
-
function() {
|
|
10427
|
-
function NoopObservableMetric2() {
|
|
10428
|
-
}
|
|
10429
|
-
NoopObservableMetric2.prototype.addCallback = function(_callback) {
|
|
10528
|
+
var BaseContext = class _BaseContext {
|
|
10529
|
+
/**
|
|
10530
|
+
* Construct a new context which inherits values from an optional parent context.
|
|
10531
|
+
*
|
|
10532
|
+
* @param parentContext a context from which to inherit values
|
|
10533
|
+
*/
|
|
10534
|
+
constructor(parentContext) {
|
|
10535
|
+
const self2 = this;
|
|
10536
|
+
self2._currentContext = parentContext ? new Map(parentContext) : /* @__PURE__ */ new Map();
|
|
10537
|
+
self2.getValue = (key) => self2._currentContext.get(key);
|
|
10538
|
+
self2.setValue = (key, value) => {
|
|
10539
|
+
const context2 = new _BaseContext(self2._currentContext);
|
|
10540
|
+
context2._currentContext.set(key, value);
|
|
10541
|
+
return context2;
|
|
10430
10542
|
};
|
|
10431
|
-
|
|
10543
|
+
self2.deleteValue = (key) => {
|
|
10544
|
+
const context2 = new _BaseContext(self2._currentContext);
|
|
10545
|
+
context2._currentContext.delete(key);
|
|
10546
|
+
return context2;
|
|
10432
10547
|
};
|
|
10433
|
-
|
|
10434
|
-
|
|
10435
|
-
);
|
|
10436
|
-
|
|
10437
|
-
|
|
10438
|
-
|
|
10439
|
-
|
|
10440
|
-
|
|
10441
|
-
|
|
10442
|
-
|
|
10443
|
-
|
|
10444
|
-
|
|
10445
|
-
|
|
10446
|
-
|
|
10447
|
-
/**
|
|
10448
|
-
|
|
10449
|
-
|
|
10450
|
-
|
|
10451
|
-
|
|
10452
|
-
|
|
10453
|
-
|
|
10454
|
-
|
|
10455
|
-
|
|
10456
|
-
|
|
10457
|
-
|
|
10458
|
-
|
|
10459
|
-
|
|
10460
|
-
|
|
10461
|
-
|
|
10462
|
-
|
|
10463
|
-
return
|
|
10464
|
-
}
|
|
10465
|
-
|
|
10548
|
+
}
|
|
10549
|
+
};
|
|
10550
|
+
var ROOT_CONTEXT = new BaseContext();
|
|
10551
|
+
|
|
10552
|
+
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/metrics/NoopMeter.js
|
|
10553
|
+
var NoopMeter = class {
|
|
10554
|
+
constructor() {
|
|
10555
|
+
}
|
|
10556
|
+
/**
|
|
10557
|
+
* @see {@link Meter.createGauge}
|
|
10558
|
+
*/
|
|
10559
|
+
createGauge(_name, _options) {
|
|
10560
|
+
return NOOP_GAUGE_METRIC;
|
|
10561
|
+
}
|
|
10562
|
+
/**
|
|
10563
|
+
* @see {@link Meter.createHistogram}
|
|
10564
|
+
*/
|
|
10565
|
+
createHistogram(_name, _options) {
|
|
10566
|
+
return NOOP_HISTOGRAM_METRIC;
|
|
10567
|
+
}
|
|
10568
|
+
/**
|
|
10569
|
+
* @see {@link Meter.createCounter}
|
|
10570
|
+
*/
|
|
10571
|
+
createCounter(_name, _options) {
|
|
10572
|
+
return NOOP_COUNTER_METRIC;
|
|
10573
|
+
}
|
|
10574
|
+
/**
|
|
10575
|
+
* @see {@link Meter.createUpDownCounter}
|
|
10576
|
+
*/
|
|
10577
|
+
createUpDownCounter(_name, _options) {
|
|
10578
|
+
return NOOP_UP_DOWN_COUNTER_METRIC;
|
|
10579
|
+
}
|
|
10580
|
+
/**
|
|
10581
|
+
* @see {@link Meter.createObservableGauge}
|
|
10582
|
+
*/
|
|
10583
|
+
createObservableGauge(_name, _options) {
|
|
10584
|
+
return NOOP_OBSERVABLE_GAUGE_METRIC;
|
|
10585
|
+
}
|
|
10586
|
+
/**
|
|
10587
|
+
* @see {@link Meter.createObservableCounter}
|
|
10588
|
+
*/
|
|
10589
|
+
createObservableCounter(_name, _options) {
|
|
10590
|
+
return NOOP_OBSERVABLE_COUNTER_METRIC;
|
|
10591
|
+
}
|
|
10592
|
+
/**
|
|
10593
|
+
* @see {@link Meter.createObservableUpDownCounter}
|
|
10594
|
+
*/
|
|
10595
|
+
createObservableUpDownCounter(_name, _options) {
|
|
10596
|
+
return NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC;
|
|
10597
|
+
}
|
|
10598
|
+
/**
|
|
10599
|
+
* @see {@link Meter.addBatchObservableCallback}
|
|
10600
|
+
*/
|
|
10601
|
+
addBatchObservableCallback(_callback, _observables) {
|
|
10602
|
+
}
|
|
10603
|
+
/**
|
|
10604
|
+
* @see {@link Meter.removeBatchObservableCallback}
|
|
10605
|
+
*/
|
|
10606
|
+
removeBatchObservableCallback(_callback) {
|
|
10607
|
+
}
|
|
10608
|
+
};
|
|
10609
|
+
var NoopMetric = class {
|
|
10610
|
+
};
|
|
10611
|
+
var NoopCounterMetric = class extends NoopMetric {
|
|
10612
|
+
add(_value, _attributes) {
|
|
10613
|
+
}
|
|
10614
|
+
};
|
|
10615
|
+
var NoopUpDownCounterMetric = class extends NoopMetric {
|
|
10616
|
+
add(_value, _attributes) {
|
|
10617
|
+
}
|
|
10618
|
+
};
|
|
10619
|
+
var NoopGaugeMetric = class extends NoopMetric {
|
|
10620
|
+
record(_value, _attributes) {
|
|
10621
|
+
}
|
|
10622
|
+
};
|
|
10623
|
+
var NoopHistogramMetric = class extends NoopMetric {
|
|
10624
|
+
record(_value, _attributes) {
|
|
10625
|
+
}
|
|
10626
|
+
};
|
|
10627
|
+
var NoopObservableMetric = class {
|
|
10628
|
+
addCallback(_callback) {
|
|
10629
|
+
}
|
|
10630
|
+
removeCallback(_callback) {
|
|
10631
|
+
}
|
|
10632
|
+
};
|
|
10633
|
+
var NoopObservableCounterMetric = class extends NoopObservableMetric {
|
|
10634
|
+
};
|
|
10635
|
+
var NoopObservableGaugeMetric = class extends NoopObservableMetric {
|
|
10636
|
+
};
|
|
10637
|
+
var NoopObservableUpDownCounterMetric = class extends NoopObservableMetric {
|
|
10638
|
+
};
|
|
10466
10639
|
var NOOP_METER = new NoopMeter();
|
|
10467
10640
|
var NOOP_COUNTER_METRIC = new NoopCounterMetric();
|
|
10468
10641
|
var NOOP_GAUGE_METRIC = new NoopGaugeMetric();
|
|
@@ -10472,144 +10645,98 @@ var NOOP_OBSERVABLE_COUNTER_METRIC = new NoopObservableCounterMetric();
|
|
|
10472
10645
|
var NOOP_OBSERVABLE_GAUGE_METRIC = new NoopObservableGaugeMetric();
|
|
10473
10646
|
var NOOP_OBSERVABLE_UP_DOWN_COUNTER_METRIC = new NoopObservableUpDownCounterMetric();
|
|
10474
10647
|
|
|
10475
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.
|
|
10648
|
+
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/metrics/Metric.js
|
|
10476
10649
|
var ValueType;
|
|
10477
10650
|
(function(ValueType2) {
|
|
10478
10651
|
ValueType2[ValueType2["INT"] = 0] = "INT";
|
|
10479
10652
|
ValueType2[ValueType2["DOUBLE"] = 1] = "DOUBLE";
|
|
10480
10653
|
})(ValueType || (ValueType = {}));
|
|
10481
10654
|
|
|
10482
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.
|
|
10483
|
-
var
|
|
10484
|
-
|
|
10485
|
-
|
|
10486
|
-
var i = m.call(o), r, ar = [], e;
|
|
10487
|
-
try {
|
|
10488
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
10489
|
-
} catch (error) {
|
|
10490
|
-
e = { error };
|
|
10491
|
-
} finally {
|
|
10492
|
-
try {
|
|
10493
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
10494
|
-
} finally {
|
|
10495
|
-
if (e) throw e.error;
|
|
10496
|
-
}
|
|
10655
|
+
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/context/NoopContextManager.js
|
|
10656
|
+
var NoopContextManager = class {
|
|
10657
|
+
active() {
|
|
10658
|
+
return ROOT_CONTEXT;
|
|
10497
10659
|
}
|
|
10498
|
-
|
|
10499
|
-
|
|
10500
|
-
var __spreadArray3 = function(to, from, pack) {
|
|
10501
|
-
if (arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
10502
|
-
if (ar || !(i in from)) {
|
|
10503
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
10504
|
-
ar[i] = from[i];
|
|
10505
|
-
}
|
|
10660
|
+
with(_context, fn, thisArg, ...args) {
|
|
10661
|
+
return fn.call(thisArg, ...args);
|
|
10506
10662
|
}
|
|
10507
|
-
|
|
10508
|
-
|
|
10509
|
-
var NoopContextManager = (
|
|
10510
|
-
/** @class */
|
|
10511
|
-
function() {
|
|
10512
|
-
function NoopContextManager2() {
|
|
10513
|
-
}
|
|
10514
|
-
NoopContextManager2.prototype.active = function() {
|
|
10515
|
-
return ROOT_CONTEXT;
|
|
10516
|
-
};
|
|
10517
|
-
NoopContextManager2.prototype.with = function(_context, fn, thisArg) {
|
|
10518
|
-
var args = [];
|
|
10519
|
-
for (var _i = 3; _i < arguments.length; _i++) {
|
|
10520
|
-
args[_i - 3] = arguments[_i];
|
|
10521
|
-
}
|
|
10522
|
-
return fn.call.apply(fn, __spreadArray3([thisArg], __read3(args), false));
|
|
10523
|
-
};
|
|
10524
|
-
NoopContextManager2.prototype.bind = function(_context, target) {
|
|
10525
|
-
return target;
|
|
10526
|
-
};
|
|
10527
|
-
NoopContextManager2.prototype.enable = function() {
|
|
10528
|
-
return this;
|
|
10529
|
-
};
|
|
10530
|
-
NoopContextManager2.prototype.disable = function() {
|
|
10531
|
-
return this;
|
|
10532
|
-
};
|
|
10533
|
-
return NoopContextManager2;
|
|
10534
|
-
}()
|
|
10535
|
-
);
|
|
10536
|
-
|
|
10537
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/api/context.js
|
|
10538
|
-
var __read4 = function(o, n) {
|
|
10539
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
10540
|
-
if (!m) return o;
|
|
10541
|
-
var i = m.call(o), r, ar = [], e;
|
|
10542
|
-
try {
|
|
10543
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
10544
|
-
} catch (error) {
|
|
10545
|
-
e = { error };
|
|
10546
|
-
} finally {
|
|
10547
|
-
try {
|
|
10548
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
10549
|
-
} finally {
|
|
10550
|
-
if (e) throw e.error;
|
|
10551
|
-
}
|
|
10663
|
+
bind(_context, target) {
|
|
10664
|
+
return target;
|
|
10552
10665
|
}
|
|
10553
|
-
|
|
10554
|
-
|
|
10555
|
-
|
|
10556
|
-
|
|
10557
|
-
|
|
10558
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
10559
|
-
ar[i] = from[i];
|
|
10560
|
-
}
|
|
10666
|
+
enable() {
|
|
10667
|
+
return this;
|
|
10668
|
+
}
|
|
10669
|
+
disable() {
|
|
10670
|
+
return this;
|
|
10561
10671
|
}
|
|
10562
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
10563
10672
|
};
|
|
10673
|
+
|
|
10674
|
+
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/api/context.js
|
|
10564
10675
|
var API_NAME2 = "context";
|
|
10565
10676
|
var NOOP_CONTEXT_MANAGER = new NoopContextManager();
|
|
10566
|
-
var ContextAPI =
|
|
10567
|
-
/**
|
|
10568
|
-
|
|
10569
|
-
|
|
10677
|
+
var ContextAPI = class _ContextAPI {
|
|
10678
|
+
/** Empty private constructor prevents end users from constructing a new instance of the API */
|
|
10679
|
+
constructor() {
|
|
10680
|
+
}
|
|
10681
|
+
/** Get the singleton instance of the Context API */
|
|
10682
|
+
static getInstance() {
|
|
10683
|
+
if (!this._instance) {
|
|
10684
|
+
this._instance = new _ContextAPI();
|
|
10570
10685
|
}
|
|
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
|
-
|
|
10597
|
-
|
|
10598
|
-
|
|
10599
|
-
|
|
10600
|
-
|
|
10601
|
-
|
|
10602
|
-
|
|
10603
|
-
|
|
10686
|
+
return this._instance;
|
|
10687
|
+
}
|
|
10688
|
+
/**
|
|
10689
|
+
* Set the current context manager.
|
|
10690
|
+
*
|
|
10691
|
+
* @returns true if the context manager was successfully registered, else false
|
|
10692
|
+
*/
|
|
10693
|
+
setGlobalContextManager(contextManager) {
|
|
10694
|
+
return registerGlobal(API_NAME2, contextManager, DiagAPI.instance());
|
|
10695
|
+
}
|
|
10696
|
+
/**
|
|
10697
|
+
* Get the currently active context
|
|
10698
|
+
*/
|
|
10699
|
+
active() {
|
|
10700
|
+
return this._getContextManager().active();
|
|
10701
|
+
}
|
|
10702
|
+
/**
|
|
10703
|
+
* Execute a function with an active context
|
|
10704
|
+
*
|
|
10705
|
+
* @param context context to be active during function execution
|
|
10706
|
+
* @param fn function to execute in a context
|
|
10707
|
+
* @param thisArg optional receiver to be used for calling fn
|
|
10708
|
+
* @param args optional arguments forwarded to fn
|
|
10709
|
+
*/
|
|
10710
|
+
with(context2, fn, thisArg, ...args) {
|
|
10711
|
+
return this._getContextManager().with(context2, fn, thisArg, ...args);
|
|
10712
|
+
}
|
|
10713
|
+
/**
|
|
10714
|
+
* Bind a context to a target function or event emitter
|
|
10715
|
+
*
|
|
10716
|
+
* @param context context to bind to the event emitter or function. Defaults to the currently active context
|
|
10717
|
+
* @param target function or event emitter to bind
|
|
10718
|
+
*/
|
|
10719
|
+
bind(context2, target) {
|
|
10720
|
+
return this._getContextManager().bind(context2, target);
|
|
10721
|
+
}
|
|
10722
|
+
_getContextManager() {
|
|
10723
|
+
return getGlobal(API_NAME2) || NOOP_CONTEXT_MANAGER;
|
|
10724
|
+
}
|
|
10725
|
+
/** Disable and remove the global context manager */
|
|
10726
|
+
disable() {
|
|
10727
|
+
this._getContextManager().disable();
|
|
10728
|
+
unregisterGlobal(API_NAME2, DiagAPI.instance());
|
|
10729
|
+
}
|
|
10730
|
+
};
|
|
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/trace_flags.js
|
|
10606
10733
|
var TraceFlags;
|
|
10607
10734
|
(function(TraceFlags2) {
|
|
10608
10735
|
TraceFlags2[TraceFlags2["NONE"] = 0] = "NONE";
|
|
10609
10736
|
TraceFlags2[TraceFlags2["SAMPLED"] = 1] = "SAMPLED";
|
|
10610
10737
|
})(TraceFlags || (TraceFlags = {}));
|
|
10611
10738
|
|
|
10612
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.
|
|
10739
|
+
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/invalid-span-constants.js
|
|
10613
10740
|
var INVALID_SPANID = "0000000000000000";
|
|
10614
10741
|
var INVALID_TRACEID = "00000000000000000000000000000000";
|
|
10615
10742
|
var INVALID_SPAN_CONTEXT = {
|
|
@@ -10618,52 +10745,54 @@ var INVALID_SPAN_CONTEXT = {
|
|
|
10618
10745
|
traceFlags: TraceFlags.NONE
|
|
10619
10746
|
};
|
|
10620
10747
|
|
|
10621
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.
|
|
10622
|
-
var NonRecordingSpan =
|
|
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
|
-
|
|
10658
|
-
|
|
10659
|
-
|
|
10660
|
-
|
|
10661
|
-
|
|
10662
|
-
|
|
10663
|
-
|
|
10664
|
-
)
|
|
10748
|
+
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/NonRecordingSpan.js
|
|
10749
|
+
var NonRecordingSpan = class {
|
|
10750
|
+
constructor(spanContext = INVALID_SPAN_CONTEXT) {
|
|
10751
|
+
this._spanContext = spanContext;
|
|
10752
|
+
}
|
|
10753
|
+
// Returns a SpanContext.
|
|
10754
|
+
spanContext() {
|
|
10755
|
+
return this._spanContext;
|
|
10756
|
+
}
|
|
10757
|
+
// By default does nothing
|
|
10758
|
+
setAttribute(_key, _value) {
|
|
10759
|
+
return this;
|
|
10760
|
+
}
|
|
10761
|
+
// By default does nothing
|
|
10762
|
+
setAttributes(_attributes) {
|
|
10763
|
+
return this;
|
|
10764
|
+
}
|
|
10765
|
+
// By default does nothing
|
|
10766
|
+
addEvent(_name, _attributes) {
|
|
10767
|
+
return this;
|
|
10768
|
+
}
|
|
10769
|
+
addLink(_link) {
|
|
10770
|
+
return this;
|
|
10771
|
+
}
|
|
10772
|
+
addLinks(_links) {
|
|
10773
|
+
return this;
|
|
10774
|
+
}
|
|
10775
|
+
// By default does nothing
|
|
10776
|
+
setStatus(_status) {
|
|
10777
|
+
return this;
|
|
10778
|
+
}
|
|
10779
|
+
// By default does nothing
|
|
10780
|
+
updateName(_name) {
|
|
10781
|
+
return this;
|
|
10782
|
+
}
|
|
10783
|
+
// By default does nothing
|
|
10784
|
+
end(_endTime) {
|
|
10785
|
+
}
|
|
10786
|
+
// isRecording always returns false for NonRecordingSpan.
|
|
10787
|
+
isRecording() {
|
|
10788
|
+
return false;
|
|
10789
|
+
}
|
|
10790
|
+
// By default does nothing
|
|
10791
|
+
recordException(_exception, _time) {
|
|
10792
|
+
}
|
|
10793
|
+
};
|
|
10665
10794
|
|
|
10666
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.
|
|
10795
|
+
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/context-utils.js
|
|
10667
10796
|
var SPAN_KEY = createContextKey("OpenTelemetry Context Key SPAN");
|
|
10668
10797
|
function getSpan(context2) {
|
|
10669
10798
|
return context2.getValue(SPAN_KEY) || void 0;
|
|
@@ -10685,14 +10814,126 @@ function getSpanContext(context2) {
|
|
|
10685
10814
|
return (_a = getSpan(context2)) === null || _a === void 0 ? void 0 : _a.spanContext();
|
|
10686
10815
|
}
|
|
10687
10816
|
|
|
10688
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.
|
|
10689
|
-
var
|
|
10690
|
-
|
|
10817
|
+
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/spancontext-utils.js
|
|
10818
|
+
var isHex = new Uint8Array([
|
|
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
|
+
0,
|
|
10861
|
+
0,
|
|
10862
|
+
0,
|
|
10863
|
+
0,
|
|
10864
|
+
0,
|
|
10865
|
+
0,
|
|
10866
|
+
0,
|
|
10867
|
+
1,
|
|
10868
|
+
1,
|
|
10869
|
+
1,
|
|
10870
|
+
1,
|
|
10871
|
+
1,
|
|
10872
|
+
1,
|
|
10873
|
+
1,
|
|
10874
|
+
1,
|
|
10875
|
+
1,
|
|
10876
|
+
1,
|
|
10877
|
+
0,
|
|
10878
|
+
0,
|
|
10879
|
+
0,
|
|
10880
|
+
0,
|
|
10881
|
+
0,
|
|
10882
|
+
0,
|
|
10883
|
+
0,
|
|
10884
|
+
1,
|
|
10885
|
+
1,
|
|
10886
|
+
1,
|
|
10887
|
+
1,
|
|
10888
|
+
1,
|
|
10889
|
+
1,
|
|
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
|
+
0,
|
|
10910
|
+
0,
|
|
10911
|
+
0,
|
|
10912
|
+
0,
|
|
10913
|
+
0,
|
|
10914
|
+
0,
|
|
10915
|
+
0,
|
|
10916
|
+
1,
|
|
10917
|
+
1,
|
|
10918
|
+
1,
|
|
10919
|
+
1,
|
|
10920
|
+
1,
|
|
10921
|
+
1
|
|
10922
|
+
]);
|
|
10923
|
+
function isValidHex(id, length) {
|
|
10924
|
+
if (typeof id !== "string" || id.length !== length)
|
|
10925
|
+
return false;
|
|
10926
|
+
let r = 0;
|
|
10927
|
+
for (let i = 0; i < id.length; i += 4) {
|
|
10928
|
+
r += (isHex[id.charCodeAt(i)] | 0) + (isHex[id.charCodeAt(i + 1)] | 0) + (isHex[id.charCodeAt(i + 2)] | 0) + (isHex[id.charCodeAt(i + 3)] | 0);
|
|
10929
|
+
}
|
|
10930
|
+
return r === length;
|
|
10931
|
+
}
|
|
10691
10932
|
function isValidTraceId(traceId) {
|
|
10692
|
-
return
|
|
10933
|
+
return isValidHex(traceId, 32) && traceId !== INVALID_TRACEID;
|
|
10693
10934
|
}
|
|
10694
10935
|
function isValidSpanId(spanId) {
|
|
10695
|
-
return
|
|
10936
|
+
return isValidHex(spanId, 16) && spanId !== INVALID_SPANID;
|
|
10696
10937
|
}
|
|
10697
10938
|
function isSpanContextValid(spanContext) {
|
|
10698
10939
|
return isValidTraceId(spanContext.traceId) && isValidSpanId(spanContext.spanId);
|
|
@@ -10701,129 +10942,115 @@ function wrapSpanContext(spanContext) {
|
|
|
10701
10942
|
return new NonRecordingSpan(spanContext);
|
|
10702
10943
|
}
|
|
10703
10944
|
|
|
10704
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.
|
|
10945
|
+
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/NoopTracer.js
|
|
10705
10946
|
var contextApi = ContextAPI.getInstance();
|
|
10706
|
-
var NoopTracer =
|
|
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
|
-
|
|
10736
|
-
|
|
10737
|
-
|
|
10738
|
-
|
|
10739
|
-
|
|
10740
|
-
|
|
10741
|
-
|
|
10742
|
-
var parentContext = ctx !== null && ctx !== void 0 ? ctx : contextApi.active();
|
|
10743
|
-
var span = this.startSpan(name, opts, parentContext);
|
|
10744
|
-
var contextWithSpanSet = setSpan(parentContext, span);
|
|
10745
|
-
return contextApi.with(contextWithSpanSet, fn, void 0, span);
|
|
10746
|
-
};
|
|
10747
|
-
return NoopTracer2;
|
|
10748
|
-
}()
|
|
10749
|
-
);
|
|
10947
|
+
var NoopTracer = class {
|
|
10948
|
+
// startSpan starts a noop span.
|
|
10949
|
+
startSpan(name, options, context2 = contextApi.active()) {
|
|
10950
|
+
const root = Boolean(options === null || options === void 0 ? void 0 : options.root);
|
|
10951
|
+
if (root) {
|
|
10952
|
+
return new NonRecordingSpan();
|
|
10953
|
+
}
|
|
10954
|
+
const parentFromContext = context2 && getSpanContext(context2);
|
|
10955
|
+
if (isSpanContext(parentFromContext) && isSpanContextValid(parentFromContext)) {
|
|
10956
|
+
return new NonRecordingSpan(parentFromContext);
|
|
10957
|
+
} else {
|
|
10958
|
+
return new NonRecordingSpan();
|
|
10959
|
+
}
|
|
10960
|
+
}
|
|
10961
|
+
startActiveSpan(name, arg2, arg3, arg4) {
|
|
10962
|
+
let opts;
|
|
10963
|
+
let ctx;
|
|
10964
|
+
let fn;
|
|
10965
|
+
if (arguments.length < 2) {
|
|
10966
|
+
return;
|
|
10967
|
+
} else if (arguments.length === 2) {
|
|
10968
|
+
fn = arg2;
|
|
10969
|
+
} else if (arguments.length === 3) {
|
|
10970
|
+
opts = arg2;
|
|
10971
|
+
fn = arg3;
|
|
10972
|
+
} else {
|
|
10973
|
+
opts = arg2;
|
|
10974
|
+
ctx = arg3;
|
|
10975
|
+
fn = arg4;
|
|
10976
|
+
}
|
|
10977
|
+
const parentContext = ctx !== null && ctx !== void 0 ? ctx : contextApi.active();
|
|
10978
|
+
const span = this.startSpan(name, opts, parentContext);
|
|
10979
|
+
const contextWithSpanSet = setSpan(parentContext, span);
|
|
10980
|
+
return contextApi.with(contextWithSpanSet, fn, void 0, span);
|
|
10981
|
+
}
|
|
10982
|
+
};
|
|
10750
10983
|
function isSpanContext(spanContext) {
|
|
10751
|
-
return typeof spanContext === "object" && typeof spanContext["spanId"] === "string" && typeof spanContext["traceId"] === "string" && typeof spanContext["traceFlags"] === "number";
|
|
10984
|
+
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";
|
|
10752
10985
|
}
|
|
10753
10986
|
|
|
10754
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.
|
|
10987
|
+
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/ProxyTracer.js
|
|
10755
10988
|
var NOOP_TRACER = new NoopTracer();
|
|
10756
|
-
var ProxyTracer =
|
|
10757
|
-
|
|
10758
|
-
|
|
10759
|
-
|
|
10760
|
-
|
|
10761
|
-
|
|
10762
|
-
|
|
10763
|
-
|
|
10764
|
-
|
|
10765
|
-
|
|
10766
|
-
|
|
10767
|
-
|
|
10768
|
-
|
|
10769
|
-
|
|
10770
|
-
|
|
10771
|
-
|
|
10772
|
-
|
|
10773
|
-
|
|
10774
|
-
|
|
10775
|
-
|
|
10776
|
-
var tracer = this._provider.getDelegateTracer(this.name, this.version, this.options);
|
|
10777
|
-
if (!tracer) {
|
|
10778
|
-
return NOOP_TRACER;
|
|
10779
|
-
}
|
|
10780
|
-
this._delegate = tracer;
|
|
10989
|
+
var ProxyTracer = class {
|
|
10990
|
+
constructor(provider, name, version, options) {
|
|
10991
|
+
this._provider = provider;
|
|
10992
|
+
this.name = name;
|
|
10993
|
+
this.version = version;
|
|
10994
|
+
this.options = options;
|
|
10995
|
+
}
|
|
10996
|
+
startSpan(name, options, context2) {
|
|
10997
|
+
return this._getTracer().startSpan(name, options, context2);
|
|
10998
|
+
}
|
|
10999
|
+
startActiveSpan(_name, _options, _context, _fn) {
|
|
11000
|
+
const tracer = this._getTracer();
|
|
11001
|
+
return Reflect.apply(tracer.startActiveSpan, tracer, arguments);
|
|
11002
|
+
}
|
|
11003
|
+
/**
|
|
11004
|
+
* Try to get a tracer from the proxy tracer provider.
|
|
11005
|
+
* If the proxy tracer provider has no delegate, return a noop tracer.
|
|
11006
|
+
*/
|
|
11007
|
+
_getTracer() {
|
|
11008
|
+
if (this._delegate) {
|
|
10781
11009
|
return this._delegate;
|
|
10782
|
-
}
|
|
10783
|
-
|
|
10784
|
-
|
|
10785
|
-
|
|
10786
|
-
|
|
10787
|
-
|
|
10788
|
-
|
|
10789
|
-
|
|
10790
|
-
|
|
10791
|
-
|
|
10792
|
-
|
|
10793
|
-
|
|
10794
|
-
|
|
10795
|
-
|
|
10796
|
-
|
|
10797
|
-
|
|
10798
|
-
);
|
|
11010
|
+
}
|
|
11011
|
+
const tracer = this._provider.getDelegateTracer(this.name, this.version, this.options);
|
|
11012
|
+
if (!tracer) {
|
|
11013
|
+
return NOOP_TRACER;
|
|
11014
|
+
}
|
|
11015
|
+
this._delegate = tracer;
|
|
11016
|
+
return this._delegate;
|
|
11017
|
+
}
|
|
11018
|
+
};
|
|
11019
|
+
|
|
11020
|
+
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/NoopTracerProvider.js
|
|
11021
|
+
var NoopTracerProvider = class {
|
|
11022
|
+
getTracer(_name, _version, _options) {
|
|
11023
|
+
return new NoopTracer();
|
|
11024
|
+
}
|
|
11025
|
+
};
|
|
10799
11026
|
|
|
10800
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.
|
|
11027
|
+
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/ProxyTracerProvider.js
|
|
10801
11028
|
var NOOP_TRACER_PROVIDER = new NoopTracerProvider();
|
|
10802
|
-
var ProxyTracerProvider =
|
|
10803
|
-
/**
|
|
10804
|
-
|
|
10805
|
-
|
|
10806
|
-
|
|
10807
|
-
|
|
10808
|
-
|
|
10809
|
-
|
|
10810
|
-
|
|
10811
|
-
|
|
10812
|
-
|
|
10813
|
-
|
|
10814
|
-
|
|
10815
|
-
|
|
10816
|
-
|
|
10817
|
-
|
|
10818
|
-
|
|
10819
|
-
|
|
10820
|
-
|
|
10821
|
-
|
|
10822
|
-
return
|
|
10823
|
-
}
|
|
10824
|
-
|
|
11029
|
+
var ProxyTracerProvider = class {
|
|
11030
|
+
/**
|
|
11031
|
+
* Get a {@link ProxyTracer}
|
|
11032
|
+
*/
|
|
11033
|
+
getTracer(name, version, options) {
|
|
11034
|
+
var _a;
|
|
11035
|
+
return (_a = this.getDelegateTracer(name, version, options)) !== null && _a !== void 0 ? _a : new ProxyTracer(this, name, version, options);
|
|
11036
|
+
}
|
|
11037
|
+
getDelegate() {
|
|
11038
|
+
var _a;
|
|
11039
|
+
return (_a = this._delegate) !== null && _a !== void 0 ? _a : NOOP_TRACER_PROVIDER;
|
|
11040
|
+
}
|
|
11041
|
+
/**
|
|
11042
|
+
* Set the delegate tracer provider
|
|
11043
|
+
*/
|
|
11044
|
+
setDelegate(delegate) {
|
|
11045
|
+
this._delegate = delegate;
|
|
11046
|
+
}
|
|
11047
|
+
getDelegateTracer(name, version, options) {
|
|
11048
|
+
var _a;
|
|
11049
|
+
return (_a = this._delegate) === null || _a === void 0 ? void 0 : _a.getTracer(name, version, options);
|
|
11050
|
+
}
|
|
11051
|
+
};
|
|
10825
11052
|
|
|
10826
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.
|
|
11053
|
+
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/span_kind.js
|
|
10827
11054
|
var SpanKind;
|
|
10828
11055
|
(function(SpanKind2) {
|
|
10829
11056
|
SpanKind2[SpanKind2["INTERNAL"] = 0] = "INTERNAL";
|
|
@@ -10833,7 +11060,7 @@ var SpanKind;
|
|
|
10833
11060
|
SpanKind2[SpanKind2["CONSUMER"] = 4] = "CONSUMER";
|
|
10834
11061
|
})(SpanKind || (SpanKind = {}));
|
|
10835
11062
|
|
|
10836
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.
|
|
11063
|
+
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace/status.js
|
|
10837
11064
|
var SpanStatusCode;
|
|
10838
11065
|
(function(SpanStatusCode2) {
|
|
10839
11066
|
SpanStatusCode2[SpanStatusCode2["UNSET"] = 0] = "UNSET";
|
|
@@ -10841,99 +11068,112 @@ var SpanStatusCode;
|
|
|
10841
11068
|
SpanStatusCode2[SpanStatusCode2["ERROR"] = 2] = "ERROR";
|
|
10842
11069
|
})(SpanStatusCode || (SpanStatusCode = {}));
|
|
10843
11070
|
|
|
10844
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.
|
|
11071
|
+
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/context-api.js
|
|
10845
11072
|
var context = ContextAPI.getInstance();
|
|
10846
11073
|
|
|
10847
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.
|
|
10848
|
-
var NoopMeterProvider =
|
|
10849
|
-
|
|
10850
|
-
|
|
10851
|
-
|
|
10852
|
-
|
|
10853
|
-
NoopMeterProvider2.prototype.getMeter = function(_name, _version, _options) {
|
|
10854
|
-
return NOOP_METER;
|
|
10855
|
-
};
|
|
10856
|
-
return NoopMeterProvider2;
|
|
10857
|
-
}()
|
|
10858
|
-
);
|
|
11074
|
+
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/metrics/NoopMeterProvider.js
|
|
11075
|
+
var NoopMeterProvider = class {
|
|
11076
|
+
getMeter(_name, _version, _options) {
|
|
11077
|
+
return NOOP_METER;
|
|
11078
|
+
}
|
|
11079
|
+
};
|
|
10859
11080
|
var NOOP_METER_PROVIDER = new NoopMeterProvider();
|
|
10860
11081
|
|
|
10861
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.
|
|
11082
|
+
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/api/metrics.js
|
|
10862
11083
|
var API_NAME3 = "metrics";
|
|
10863
|
-
var MetricsAPI =
|
|
10864
|
-
/**
|
|
10865
|
-
|
|
10866
|
-
|
|
11084
|
+
var MetricsAPI = class _MetricsAPI {
|
|
11085
|
+
/** Empty private constructor prevents end users from constructing a new instance of the API */
|
|
11086
|
+
constructor() {
|
|
11087
|
+
}
|
|
11088
|
+
/** Get the singleton instance of the Metrics API */
|
|
11089
|
+
static getInstance() {
|
|
11090
|
+
if (!this._instance) {
|
|
11091
|
+
this._instance = new _MetricsAPI();
|
|
10867
11092
|
}
|
|
10868
|
-
|
|
10869
|
-
|
|
10870
|
-
|
|
10871
|
-
|
|
10872
|
-
|
|
10873
|
-
|
|
10874
|
-
|
|
10875
|
-
|
|
10876
|
-
|
|
10877
|
-
|
|
10878
|
-
|
|
10879
|
-
|
|
10880
|
-
|
|
10881
|
-
|
|
10882
|
-
|
|
10883
|
-
|
|
10884
|
-
|
|
10885
|
-
|
|
10886
|
-
|
|
10887
|
-
|
|
10888
|
-
|
|
11093
|
+
return this._instance;
|
|
11094
|
+
}
|
|
11095
|
+
/**
|
|
11096
|
+
* Set the current global meter provider.
|
|
11097
|
+
* Returns true if the meter provider was successfully registered, else false.
|
|
11098
|
+
*/
|
|
11099
|
+
setGlobalMeterProvider(provider) {
|
|
11100
|
+
return registerGlobal(API_NAME3, provider, DiagAPI.instance());
|
|
11101
|
+
}
|
|
11102
|
+
/**
|
|
11103
|
+
* Returns the global meter provider.
|
|
11104
|
+
*/
|
|
11105
|
+
getMeterProvider() {
|
|
11106
|
+
return getGlobal(API_NAME3) || NOOP_METER_PROVIDER;
|
|
11107
|
+
}
|
|
11108
|
+
/**
|
|
11109
|
+
* Returns a meter from the global meter provider.
|
|
11110
|
+
*/
|
|
11111
|
+
getMeter(name, version, options) {
|
|
11112
|
+
return this.getMeterProvider().getMeter(name, version, options);
|
|
11113
|
+
}
|
|
11114
|
+
/** Remove the global meter provider */
|
|
11115
|
+
disable() {
|
|
11116
|
+
unregisterGlobal(API_NAME3, DiagAPI.instance());
|
|
11117
|
+
}
|
|
11118
|
+
};
|
|
10889
11119
|
|
|
10890
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.
|
|
11120
|
+
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/metrics-api.js
|
|
10891
11121
|
var metrics = MetricsAPI.getInstance();
|
|
10892
11122
|
|
|
10893
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.
|
|
11123
|
+
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/api/trace.js
|
|
10894
11124
|
var API_NAME4 = "trace";
|
|
10895
|
-
var TraceAPI =
|
|
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
|
-
|
|
10928
|
-
|
|
10929
|
-
|
|
10930
|
-
|
|
10931
|
-
|
|
10932
|
-
|
|
10933
|
-
|
|
10934
|
-
|
|
11125
|
+
var TraceAPI = class _TraceAPI {
|
|
11126
|
+
/** Empty private constructor prevents end users from constructing a new instance of the API */
|
|
11127
|
+
constructor() {
|
|
11128
|
+
this._proxyTracerProvider = new ProxyTracerProvider();
|
|
11129
|
+
this.wrapSpanContext = wrapSpanContext;
|
|
11130
|
+
this.isSpanContextValid = isSpanContextValid;
|
|
11131
|
+
this.deleteSpan = deleteSpan;
|
|
11132
|
+
this.getSpan = getSpan;
|
|
11133
|
+
this.getActiveSpan = getActiveSpan;
|
|
11134
|
+
this.getSpanContext = getSpanContext;
|
|
11135
|
+
this.setSpan = setSpan;
|
|
11136
|
+
this.setSpanContext = setSpanContext;
|
|
11137
|
+
}
|
|
11138
|
+
/** Get the singleton instance of the Trace API */
|
|
11139
|
+
static getInstance() {
|
|
11140
|
+
if (!this._instance) {
|
|
11141
|
+
this._instance = new _TraceAPI();
|
|
11142
|
+
}
|
|
11143
|
+
return this._instance;
|
|
11144
|
+
}
|
|
11145
|
+
/**
|
|
11146
|
+
* Set the current global tracer.
|
|
11147
|
+
*
|
|
11148
|
+
* @returns true if the tracer provider was successfully registered, else false
|
|
11149
|
+
*/
|
|
11150
|
+
setGlobalTracerProvider(provider) {
|
|
11151
|
+
const success = registerGlobal(API_NAME4, this._proxyTracerProvider, DiagAPI.instance());
|
|
11152
|
+
if (success) {
|
|
11153
|
+
this._proxyTracerProvider.setDelegate(provider);
|
|
11154
|
+
}
|
|
11155
|
+
return success;
|
|
11156
|
+
}
|
|
11157
|
+
/**
|
|
11158
|
+
* Returns the global tracer provider.
|
|
11159
|
+
*/
|
|
11160
|
+
getTracerProvider() {
|
|
11161
|
+
return getGlobal(API_NAME4) || this._proxyTracerProvider;
|
|
11162
|
+
}
|
|
11163
|
+
/**
|
|
11164
|
+
* Returns a tracer from the global tracer provider.
|
|
11165
|
+
*/
|
|
11166
|
+
getTracer(name, version) {
|
|
11167
|
+
return this.getTracerProvider().getTracer(name, version);
|
|
11168
|
+
}
|
|
11169
|
+
/** Remove the global tracer provider */
|
|
11170
|
+
disable() {
|
|
11171
|
+
unregisterGlobal(API_NAME4, DiagAPI.instance());
|
|
11172
|
+
this._proxyTracerProvider = new ProxyTracerProvider();
|
|
11173
|
+
}
|
|
11174
|
+
};
|
|
10935
11175
|
|
|
10936
|
-
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.
|
|
11176
|
+
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/trace-api.js
|
|
10937
11177
|
var trace = TraceAPI.getInstance();
|
|
10938
11178
|
function getTracer(name) {
|
|
10939
11179
|
return trace.getTracer(name);
|
|
@@ -16430,9 +16670,13 @@ function deserialiseSnapshot(serialised) {
|
|
|
16430
16670
|
}
|
|
16431
16671
|
|
|
16432
16672
|
// src/mollifier/buffer.ts
|
|
16433
|
-
var
|
|
16434
|
-
|
|
16435
|
-
|
|
16673
|
+
var DEFAULT_ACK_GRACE_TTL_SECONDS = 30;
|
|
16674
|
+
var DEFAULT_RECONNECT_STEP_MS = 50;
|
|
16675
|
+
var DEFAULT_RECONNECT_MAX_MS = 1e3;
|
|
16676
|
+
var DEFAULT_MAX_RETRIES_PER_REQUEST = 20;
|
|
16677
|
+
var DRAINING_SET_KEY = "mollifier:draining";
|
|
16678
|
+
function mollifierReconnectDelayMs(times, random = Math.random, stepMs = DEFAULT_RECONNECT_STEP_MS, maxMs = DEFAULT_RECONNECT_MAX_MS) {
|
|
16679
|
+
const base = Math.min(times * stepMs, maxMs);
|
|
16436
16680
|
const half = Math.floor(base / 2);
|
|
16437
16681
|
return half + Math.round(random() * (base - half));
|
|
16438
16682
|
}
|
|
@@ -16449,15 +16693,19 @@ function makeIdempotencyClaimKey(input) {
|
|
|
16449
16693
|
var MollifierBuffer = class {
|
|
16450
16694
|
redis;
|
|
16451
16695
|
logger;
|
|
16696
|
+
ackGraceTtlSeconds;
|
|
16452
16697
|
constructor(options) {
|
|
16453
16698
|
this.logger = options.logger ?? new logger$1.Logger("MollifierBuffer", "debug");
|
|
16699
|
+
this.ackGraceTtlSeconds = options.ackGraceTtlSeconds ?? DEFAULT_ACK_GRACE_TTL_SECONDS;
|
|
16700
|
+
const reconnectStepMs = options.reconnectStepMs ?? DEFAULT_RECONNECT_STEP_MS;
|
|
16701
|
+
const reconnectMaxMs = options.reconnectMaxMs ?? DEFAULT_RECONNECT_MAX_MS;
|
|
16454
16702
|
this.redis = createRedisClient(
|
|
16455
16703
|
{
|
|
16456
16704
|
...options.redisOptions,
|
|
16457
16705
|
retryStrategy(times) {
|
|
16458
|
-
return mollifierReconnectDelayMs(times);
|
|
16706
|
+
return mollifierReconnectDelayMs(times, Math.random, reconnectStepMs, reconnectMaxMs);
|
|
16459
16707
|
},
|
|
16460
|
-
maxRetriesPerRequest:
|
|
16708
|
+
maxRetriesPerRequest: options.maxRetriesPerRequest ?? DEFAULT_MAX_RETRIES_PER_REQUEST
|
|
16461
16709
|
},
|
|
16462
16710
|
{
|
|
16463
16711
|
onError: (error) => {
|
|
@@ -16514,6 +16762,7 @@ var MollifierBuffer = class {
|
|
|
16514
16762
|
const encoded = await this.redis.popAndMarkDraining(
|
|
16515
16763
|
queueKey,
|
|
16516
16764
|
orgsKey,
|
|
16765
|
+
DRAINING_SET_KEY,
|
|
16517
16766
|
entryPrefix,
|
|
16518
16767
|
envId,
|
|
16519
16768
|
"mollifier:org-envs:"
|
|
@@ -16771,13 +17020,16 @@ var MollifierBuffer = class {
|
|
|
16771
17020
|
async ack(runId) {
|
|
16772
17021
|
await this.redis.ackMollifierEntry(
|
|
16773
17022
|
`mollifier:entries:${runId}`,
|
|
16774
|
-
|
|
17023
|
+
DRAINING_SET_KEY,
|
|
17024
|
+
String(this.ackGraceTtlSeconds),
|
|
17025
|
+
runId
|
|
16775
17026
|
);
|
|
16776
17027
|
}
|
|
16777
17028
|
async requeue(runId) {
|
|
16778
17029
|
await this.redis.requeueMollifierEntry(
|
|
16779
17030
|
`mollifier:entries:${runId}`,
|
|
16780
17031
|
"mollifier:orgs",
|
|
17032
|
+
DRAINING_SET_KEY,
|
|
16781
17033
|
"mollifier:queue:",
|
|
16782
17034
|
runId,
|
|
16783
17035
|
"mollifier:org-envs:"
|
|
@@ -16792,10 +17044,36 @@ var MollifierBuffer = class {
|
|
|
16792
17044
|
async fail(runId, error) {
|
|
16793
17045
|
const result = await this.redis.failMollifierEntry(
|
|
16794
17046
|
`mollifier:entries:${runId}`,
|
|
16795
|
-
|
|
17047
|
+
DRAINING_SET_KEY,
|
|
17048
|
+
JSON.stringify(error),
|
|
17049
|
+
runId
|
|
16796
17050
|
);
|
|
16797
17051
|
return result === 1;
|
|
16798
17052
|
}
|
|
17053
|
+
// Observability-only: number of entries currently in DRAINING state
|
|
17054
|
+
// (popped, not yet acked/failed/requeued). The gauge in the webapp
|
|
17055
|
+
// drainer worker polls this on a short interval and emits it as
|
|
17056
|
+
// `mollifier.draining.current` for ops dashboards and post-crash
|
|
17057
|
+
// forensics. Cheap (single ZCARD).
|
|
17058
|
+
async getDrainingCount() {
|
|
17059
|
+
return this.redis.zcard(DRAINING_SET_KEY);
|
|
17060
|
+
}
|
|
17061
|
+
// Observability-only: list runIds that have been DRAINING longer than
|
|
17062
|
+
// `olderThanMs` (i.e. popped before `now - olderThanMs`). Bounded by
|
|
17063
|
+
// `limit` to keep the result set tractable when something has gone
|
|
17064
|
+
// very wrong. ZRANGEBYSCORE is O(log N + K). Score is the pop wall-clock
|
|
17065
|
+
// in milliseconds as written by the popAndMarkDraining Lua.
|
|
17066
|
+
async listStaleDraining(olderThanMs, limit) {
|
|
17067
|
+
const maxScore = Date.now() - Math.max(0, olderThanMs);
|
|
17068
|
+
return this.redis.zrangebyscore(
|
|
17069
|
+
DRAINING_SET_KEY,
|
|
17070
|
+
"-inf",
|
|
17071
|
+
String(maxScore),
|
|
17072
|
+
"LIMIT",
|
|
17073
|
+
0,
|
|
17074
|
+
Math.max(0, limit)
|
|
17075
|
+
);
|
|
17076
|
+
}
|
|
16799
17077
|
// Returns Redis-side TTL on the entry hash. Returns -1 for entries
|
|
16800
17078
|
// with no TTL — the steady state under the current design, where
|
|
16801
17079
|
// entries persist until drainer ack/fail. The ack grace TTL (30s
|
|
@@ -16896,10 +17174,11 @@ var MollifierBuffer = class {
|
|
|
16896
17174
|
`
|
|
16897
17175
|
});
|
|
16898
17176
|
this.redis.defineCommand("requeueMollifierEntry", {
|
|
16899
|
-
numberOfKeys:
|
|
17177
|
+
numberOfKeys: 3,
|
|
16900
17178
|
lua: `
|
|
16901
17179
|
local entryKey = KEYS[1]
|
|
16902
17180
|
local orgsKey = KEYS[2]
|
|
17181
|
+
local drainingSetKey = KEYS[3]
|
|
16903
17182
|
local queuePrefix = ARGV[1]
|
|
16904
17183
|
local runId = ARGV[2]
|
|
16905
17184
|
local orgEnvsPrefix = ARGV[3]
|
|
@@ -16927,18 +17206,31 @@ var MollifierBuffer = class {
|
|
|
16927
17206
|
redis.call('SADD', orgsKey, orgId)
|
|
16928
17207
|
redis.call('SADD', orgEnvsPrefix .. orgId, envId)
|
|
16929
17208
|
end
|
|
17209
|
+
-- Observability-only: leaving DRAINING state, so drop the
|
|
17210
|
+
-- entry from the draining-tracker set. ZREM on absent member
|
|
17211
|
+
-- is a no-op.
|
|
17212
|
+
redis.call('ZREM', drainingSetKey, runId)
|
|
16930
17213
|
return 1
|
|
16931
17214
|
`
|
|
16932
17215
|
});
|
|
16933
17216
|
this.redis.defineCommand("popAndMarkDraining", {
|
|
16934
|
-
numberOfKeys:
|
|
17217
|
+
numberOfKeys: 3,
|
|
16935
17218
|
lua: `
|
|
16936
17219
|
local queueKey = KEYS[1]
|
|
16937
17220
|
local orgsKey = KEYS[2]
|
|
17221
|
+
local drainingSetKey = KEYS[3]
|
|
16938
17222
|
local entryPrefix = ARGV[1]
|
|
16939
17223
|
local envId = ARGV[2]
|
|
16940
17224
|
local orgEnvsPrefix = ARGV[3]
|
|
16941
17225
|
|
|
17226
|
+
-- Wall-clock millis used as the ZADD score on the draining-tracker
|
|
17227
|
+
-- set. Computed once per script invocation so all observers see
|
|
17228
|
+
-- the same pop instant. redis.call('TIME') is deterministic per
|
|
17229
|
+
-- script execution (Lua sees it as a single read), satisfying the
|
|
17230
|
+
-- write-determinism contract on replicas/AOF replay.
|
|
17231
|
+
local timeArr = redis.call('TIME')
|
|
17232
|
+
local nowMs = tonumber(timeArr[1]) * 1000 + math.floor(tonumber(timeArr[2]) / 1000)
|
|
17233
|
+
|
|
16942
17234
|
-- Helper: prune org-level membership when an env's queue empties.
|
|
16943
17235
|
-- Called only from the success branch where we know orgId from the
|
|
16944
17236
|
-- popped entry. The no-runId branch below can't reach this because
|
|
@@ -16971,6 +17263,14 @@ var MollifierBuffer = class {
|
|
|
16971
17263
|
local entryKey = entryPrefix .. runId
|
|
16972
17264
|
if redis.call('EXISTS', entryKey) == 1 then
|
|
16973
17265
|
redis.call('HSET', entryKey, 'status', 'DRAINING')
|
|
17266
|
+
-- Observability-only: track the runId in the draining set
|
|
17267
|
+
-- with the pop wall-clock as score. Acked/failed/requeued
|
|
17268
|
+
-- in the corresponding Lua scripts. The set is NOT
|
|
17269
|
+
-- load-bearing for correctness \u2014 the per-entry hash carries
|
|
17270
|
+
-- status \u2014 so a missed ZREM on a partial Lua execution is
|
|
17271
|
+
-- recoverable via the stale-sweep + entry hash, not a
|
|
17272
|
+
-- correctness bug.
|
|
17273
|
+
redis.call('ZADD', drainingSetKey, nowMs, runId)
|
|
16974
17274
|
local raw = redis.call('HGETALL', entryKey)
|
|
16975
17275
|
local result = {}
|
|
16976
17276
|
for i = 1, #raw, 2 do
|
|
@@ -17208,10 +17508,18 @@ var MollifierBuffer = class {
|
|
|
17208
17508
|
`
|
|
17209
17509
|
});
|
|
17210
17510
|
this.redis.defineCommand("ackMollifierEntry", {
|
|
17211
|
-
numberOfKeys:
|
|
17511
|
+
numberOfKeys: 2,
|
|
17212
17512
|
lua: `
|
|
17213
17513
|
local entryKey = KEYS[1]
|
|
17514
|
+
local drainingSetKey = KEYS[2]
|
|
17214
17515
|
local graceTtlSeconds = tonumber(ARGV[1])
|
|
17516
|
+
local runId = ARGV[2]
|
|
17517
|
+
|
|
17518
|
+
-- Always ZREM from the draining-tracker \u2014 even if the entry hash
|
|
17519
|
+
-- has been concurrently torn down, the runId might still be in
|
|
17520
|
+
-- the set (e.g. fail() ran first and cleared the hash but a
|
|
17521
|
+
-- delayed ack races in). Idempotent: ZREM on absent is a no-op.
|
|
17522
|
+
redis.call('ZREM', drainingSetKey, runId)
|
|
17215
17523
|
|
|
17216
17524
|
-- Guard: never create a partial entry. If the hash is gone between
|
|
17217
17525
|
-- pop and ack (concurrent fail or eviction \u2014 QUEUED entries carry
|
|
@@ -17234,10 +17542,17 @@ var MollifierBuffer = class {
|
|
|
17234
17542
|
`
|
|
17235
17543
|
});
|
|
17236
17544
|
this.redis.defineCommand("failMollifierEntry", {
|
|
17237
|
-
numberOfKeys:
|
|
17545
|
+
numberOfKeys: 2,
|
|
17238
17546
|
lua: `
|
|
17239
17547
|
local entryKey = KEYS[1]
|
|
17548
|
+
local drainingSetKey = KEYS[2]
|
|
17240
17549
|
local errorPayload = ARGV[1]
|
|
17550
|
+
local runId = ARGV[2]
|
|
17551
|
+
|
|
17552
|
+
-- Always ZREM from the draining-tracker (idempotent on absent).
|
|
17553
|
+
-- Mirrors ack: the runId may be in the set even if the entry hash
|
|
17554
|
+
-- has been raced away.
|
|
17555
|
+
redis.call('ZREM', drainingSetKey, runId)
|
|
17241
17556
|
|
|
17242
17557
|
-- Guard: nothing to mark FAILED if the hash is gone (concurrent
|
|
17243
17558
|
-- ack/manual cleanup). Returning 0 lets the caller distinguish
|
|
@@ -17308,8 +17623,11 @@ var MollifierDrainer = class {
|
|
|
17308
17623
|
isRetryable;
|
|
17309
17624
|
pollIntervalMs;
|
|
17310
17625
|
maxOrgsPerTick;
|
|
17626
|
+
drainBatchSize;
|
|
17627
|
+
concurrency;
|
|
17628
|
+
maxBackoffMs;
|
|
17629
|
+
backoffFloorMs;
|
|
17311
17630
|
logger;
|
|
17312
|
-
limit;
|
|
17313
17631
|
// Rotation state. `orgCursor` advances through the active-orgs list.
|
|
17314
17632
|
// Each org has its own internal cursor in `perOrgEnvCursors` for
|
|
17315
17633
|
// cycling through that org's envs. Both reset on `start()`.
|
|
@@ -17326,8 +17644,11 @@ var MollifierDrainer = class {
|
|
|
17326
17644
|
this.isRetryable = options.isRetryable;
|
|
17327
17645
|
this.pollIntervalMs = options.pollIntervalMs ?? 100;
|
|
17328
17646
|
this.maxOrgsPerTick = options.maxOrgsPerTick ?? 500;
|
|
17647
|
+
this.drainBatchSize = Math.max(1, options.drainBatchSize ?? 1);
|
|
17648
|
+
this.concurrency = Math.max(1, options.concurrency);
|
|
17649
|
+
this.maxBackoffMs = options.maxBackoffMs ?? 5e3;
|
|
17650
|
+
this.backoffFloorMs = Math.max(1, options.backoffFloorMs ?? 100);
|
|
17329
17651
|
this.logger = options.logger ?? new logger$1.Logger("MollifierDrainer", "debug");
|
|
17330
|
-
this.limit = pLimit(options.concurrency);
|
|
17331
17652
|
}
|
|
17332
17653
|
async runOnce() {
|
|
17333
17654
|
const orgs = await this.buffer.listOrgs();
|
|
@@ -17344,15 +17665,64 @@ var MollifierDrainer = class {
|
|
|
17344
17665
|
const envId = this.pickEnvForOrg(orgId, envsForOrg);
|
|
17345
17666
|
targets.push(envId);
|
|
17346
17667
|
}
|
|
17347
|
-
|
|
17348
|
-
|
|
17349
|
-
|
|
17350
|
-
|
|
17351
|
-
|
|
17352
|
-
|
|
17353
|
-
|
|
17354
|
-
|
|
17668
|
+
if (targets.length === 0) return { drained: 0, failed: 0 };
|
|
17669
|
+
const remaining = /* @__PURE__ */ new Map();
|
|
17670
|
+
const skip = /* @__PURE__ */ new Set();
|
|
17671
|
+
for (const envId of targets) remaining.set(envId, this.drainBatchSize);
|
|
17672
|
+
let cursor = 0;
|
|
17673
|
+
const pickNextEnv = () => {
|
|
17674
|
+
for (let i = 0; i < targets.length; i++) {
|
|
17675
|
+
const idx = (cursor + i) % targets.length;
|
|
17676
|
+
const envId = targets[idx];
|
|
17677
|
+
if (skip.has(envId)) continue;
|
|
17678
|
+
const r = remaining.get(envId) ?? 0;
|
|
17679
|
+
if (r > 0) {
|
|
17680
|
+
remaining.set(envId, r - 1);
|
|
17681
|
+
cursor = (idx + 1) % targets.length;
|
|
17682
|
+
return envId;
|
|
17683
|
+
}
|
|
17684
|
+
}
|
|
17685
|
+
return null;
|
|
17355
17686
|
};
|
|
17687
|
+
let drained = 0;
|
|
17688
|
+
let failed = 0;
|
|
17689
|
+
const worker = async () => {
|
|
17690
|
+
while (true) {
|
|
17691
|
+
const envId = pickNextEnv();
|
|
17692
|
+
if (envId === null) return;
|
|
17693
|
+
let entry;
|
|
17694
|
+
try {
|
|
17695
|
+
entry = await this.buffer.pop(envId);
|
|
17696
|
+
} catch (err) {
|
|
17697
|
+
this.logger.error("MollifierDrainer.pop failed", { envId, err });
|
|
17698
|
+
if (!skip.has(envId)) {
|
|
17699
|
+
skip.add(envId);
|
|
17700
|
+
failed += 1;
|
|
17701
|
+
}
|
|
17702
|
+
continue;
|
|
17703
|
+
}
|
|
17704
|
+
if (!entry) {
|
|
17705
|
+
skip.add(envId);
|
|
17706
|
+
continue;
|
|
17707
|
+
}
|
|
17708
|
+
try {
|
|
17709
|
+
const outcome = await this.processEntry(entry);
|
|
17710
|
+
if (outcome === "drained") drained += 1;
|
|
17711
|
+
else failed += 1;
|
|
17712
|
+
} catch (err) {
|
|
17713
|
+
this.logger.error("MollifierDrainer.processEntry failed", {
|
|
17714
|
+
envId,
|
|
17715
|
+
runId: entry.runId,
|
|
17716
|
+
err
|
|
17717
|
+
});
|
|
17718
|
+
failed += 1;
|
|
17719
|
+
}
|
|
17720
|
+
}
|
|
17721
|
+
};
|
|
17722
|
+
const totalBudget = targets.length * this.drainBatchSize;
|
|
17723
|
+
const workerCount = Math.min(this.concurrency, totalBudget);
|
|
17724
|
+
await Promise.all(Array.from({ length: workerCount }, () => worker()));
|
|
17725
|
+
return { drained, failed };
|
|
17356
17726
|
}
|
|
17357
17727
|
start() {
|
|
17358
17728
|
if (this.isRunning) return;
|
|
@@ -17426,8 +17796,8 @@ var MollifierDrainer = class {
|
|
|
17426
17796
|
// brief blip while preventing a tight retry loop during a long Redis
|
|
17427
17797
|
// outage. 1 → 200ms, 2 → 400ms, 3 → 800ms, 4 → 1.6s, 5 → 3.2s, 6+ → 5s.
|
|
17428
17798
|
backoffMs(consecutiveErrors) {
|
|
17429
|
-
const base = Math.max(this.pollIntervalMs,
|
|
17430
|
-
const capped = Math.min(base * 2 ** (consecutiveErrors - 1),
|
|
17799
|
+
const base = Math.max(this.pollIntervalMs, this.backoffFloorMs);
|
|
17800
|
+
const capped = Math.min(base * 2 ** (consecutiveErrors - 1), this.maxBackoffMs);
|
|
17431
17801
|
return capped;
|
|
17432
17802
|
}
|
|
17433
17803
|
delay(ms) {
|
|
@@ -17458,31 +17828,6 @@ var MollifierDrainer = class {
|
|
|
17458
17828
|
this.perOrgEnvCursors.set(orgId, (cursor + 1) % sorted.length);
|
|
17459
17829
|
return sorted[idx];
|
|
17460
17830
|
}
|
|
17461
|
-
// A failure for one env (e.g. a Redis hiccup mid-batch in `pop`, or in
|
|
17462
|
-
// `requeue`/`fail` during error recovery inside `processEntry`) must not
|
|
17463
|
-
// poison the rest of the batch — `Promise.all` would otherwise reject and
|
|
17464
|
-
// bubble all the way to `loop()`. Catch both stages here so the failed env
|
|
17465
|
-
// is just counted as "failed" for this tick and we move on.
|
|
17466
|
-
async processOneFromEnv(envId) {
|
|
17467
|
-
let entry;
|
|
17468
|
-
try {
|
|
17469
|
-
entry = await this.buffer.pop(envId);
|
|
17470
|
-
} catch (err) {
|
|
17471
|
-
this.logger.error("MollifierDrainer.pop failed", { envId, err });
|
|
17472
|
-
return "failed";
|
|
17473
|
-
}
|
|
17474
|
-
if (!entry) return "empty";
|
|
17475
|
-
try {
|
|
17476
|
-
return await this.processEntry(entry);
|
|
17477
|
-
} catch (err) {
|
|
17478
|
-
this.logger.error("MollifierDrainer.processEntry failed", {
|
|
17479
|
-
envId,
|
|
17480
|
-
runId: entry.runId,
|
|
17481
|
-
err
|
|
17482
|
-
});
|
|
17483
|
-
return "failed";
|
|
17484
|
-
}
|
|
17485
|
-
}
|
|
17486
17831
|
async processEntry(entry) {
|
|
17487
17832
|
try {
|
|
17488
17833
|
const payload = deserialiseSnapshot(entry.payload);
|