pullfrog 0.1.53 → 0.1.55
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/agents/claudePretoolGate.d.ts +4 -4
- package/dist/cli.mjs +59163 -30518
- package/dist/external.d.ts +1 -1
- package/dist/index.js +54378 -25964
- package/dist/internal/index.d.ts +3 -1
- package/dist/internal.js +132 -13
- package/dist/mcp/git.d.ts +27 -0
- package/dist/mcp/review.d.ts +6 -6
- package/dist/mcp/reviewComments.d.ts +5 -1
- package/dist/models.d.ts +21 -3
- package/dist/toolState.d.ts +7 -0
- package/dist/utils/apiKeys.d.ts +45 -0
- package/dist/utils/buildPullfrogFooter.d.ts +4 -4
- package/dist/utils/claudeSubscription.d.ts +9 -0
- package/dist/utils/codexOAuth.d.ts +11 -0
- package/dist/utils/credentialCheck.d.ts +21 -0
- package/dist/utils/credentialFallback.d.ts +42 -0
- package/dist/utils/github.d.ts +13 -0
- package/dist/utils/normalizeEnv.d.ts +2 -0
- package/dist/utils/providerErrors.d.ts +43 -0
- package/dist/utils/proxy.d.ts +1 -1
- package/dist/utils/runContext.d.ts +10 -0
- package/dist/utils/runContextData.d.ts +3 -0
- package/dist/utils/runErrorRenderer.d.ts +8 -2
- package/dist/utils/runStatusCheck.d.ts +14 -4
- package/dist/yes.js +223 -213
- package/package.json +1 -1
package/dist/yes.js
CHANGED
|
@@ -5,11 +5,11 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __require = /* @__PURE__ */ ((
|
|
8
|
+
var __require = /* @__PURE__ */ ((x2) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x2, {
|
|
9
9
|
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
10
|
-
}) :
|
|
10
|
+
}) : x2)(function(x2) {
|
|
11
11
|
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
12
|
-
throw Error('Dynamic require of "' +
|
|
12
|
+
throw Error('Dynamic require of "' + x2 + '" is not supported');
|
|
13
13
|
});
|
|
14
14
|
var __commonJS = (cb, mod) => function __require2() {
|
|
15
15
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
@@ -413,39 +413,38 @@ var require_object_hash = __commonJS({
|
|
|
413
413
|
import { performance as performance2 } from "node:perf_hooks";
|
|
414
414
|
import { setTimeout as sleep } from "node:timers/promises";
|
|
415
415
|
|
|
416
|
-
// node_modules/.pnpm/lru-cache@11.
|
|
417
|
-
import { tracingChannel as
|
|
418
|
-
var S =
|
|
419
|
-
var W =
|
|
420
|
-
var
|
|
421
|
-
var
|
|
416
|
+
// node_modules/.pnpm/lru-cache@11.5.2/node_modules/lru-cache/dist/esm/node/index.min.js
|
|
417
|
+
import { tracingChannel as G, channel as P } from "node:diagnostics_channel";
|
|
418
|
+
var S = P("lru-cache:metrics");
|
|
419
|
+
var W = G("lru-cache");
|
|
420
|
+
var L = typeof performance == "object" && performance && typeof performance.now == "function" ? performance : Date;
|
|
421
|
+
var R = () => S.hasSubscribers || W.hasSubscribers;
|
|
422
422
|
var U = /* @__PURE__ */ new Set();
|
|
423
|
-
var
|
|
424
|
-
var
|
|
425
|
-
typeof
|
|
423
|
+
var M = typeof process == "object" && process ? process : {};
|
|
424
|
+
var k = (d3, e, t, i) => {
|
|
425
|
+
typeof M.emitWarning == "function" ? M.emitWarning(d3, e, t, i) : console.error(`[${t}] ${e}: ${d3}`);
|
|
426
426
|
};
|
|
427
|
-
var H = (
|
|
428
|
-
var
|
|
429
|
-
var
|
|
430
|
-
var j = (u3) => F(u3) ? u3 <= Math.pow(2, 8) ? Uint8Array : u3 <= Math.pow(2, 16) ? Uint16Array : u3 <= Math.pow(2, 32) ? Uint32Array : u3 <= Number.MAX_SAFE_INTEGER ? O : null : null;
|
|
427
|
+
var H = (d3) => !U.has(d3);
|
|
428
|
+
var T = (d3) => !!d3 && d3 === Math.floor(d3) && d3 > 0 && isFinite(d3);
|
|
429
|
+
var j = (d3) => T(d3) ? d3 <= Math.pow(2, 8) ? Uint8Array : d3 <= Math.pow(2, 16) ? Uint16Array : d3 <= Math.pow(2, 32) ? Uint32Array : d3 <= Number.MAX_SAFE_INTEGER ? O : null : null;
|
|
431
430
|
var O = class extends Array {
|
|
432
431
|
constructor(e) {
|
|
433
432
|
super(e), this.fill(0);
|
|
434
433
|
}
|
|
435
434
|
};
|
|
436
|
-
var
|
|
435
|
+
var x = class d {
|
|
437
436
|
heap;
|
|
438
437
|
length;
|
|
439
438
|
static #o = false;
|
|
440
439
|
static create(e) {
|
|
441
440
|
let t = j(e);
|
|
442
441
|
if (!t) return [];
|
|
443
|
-
|
|
444
|
-
let i = new
|
|
445
|
-
return
|
|
442
|
+
d.#o = true;
|
|
443
|
+
let i = new d(e, t);
|
|
444
|
+
return d.#o = false, i;
|
|
446
445
|
}
|
|
447
446
|
constructor(e, t) {
|
|
448
|
-
if (!
|
|
447
|
+
if (!d.#o) throw new TypeError("instantiate Stack using Stack.create(n)");
|
|
449
448
|
this.heap = new t(e), this.length = 0;
|
|
450
449
|
}
|
|
451
450
|
push(e) {
|
|
@@ -455,14 +454,14 @@ var R = class u {
|
|
|
455
454
|
return this.heap[--this.length];
|
|
456
455
|
}
|
|
457
456
|
};
|
|
458
|
-
var
|
|
457
|
+
var I = class d2 {
|
|
459
458
|
#o;
|
|
460
|
-
#
|
|
461
|
-
#w;
|
|
462
|
-
#x;
|
|
459
|
+
#c;
|
|
463
460
|
#S;
|
|
461
|
+
#O;
|
|
462
|
+
#w;
|
|
464
463
|
#M;
|
|
465
|
-
#
|
|
464
|
+
#I;
|
|
466
465
|
#m;
|
|
467
466
|
get perf() {
|
|
468
467
|
return this.#m;
|
|
@@ -482,14 +481,15 @@ var M = class u2 {
|
|
|
482
481
|
allowStaleOnFetchAbort;
|
|
483
482
|
allowStaleOnFetchRejection;
|
|
484
483
|
ignoreFetchAbort;
|
|
484
|
+
backgroundFetchSize;
|
|
485
485
|
#n;
|
|
486
486
|
#b;
|
|
487
487
|
#s;
|
|
488
488
|
#i;
|
|
489
489
|
#t;
|
|
490
|
-
#a;
|
|
491
|
-
#c;
|
|
492
490
|
#l;
|
|
491
|
+
#u;
|
|
492
|
+
#a;
|
|
493
493
|
#h;
|
|
494
494
|
#y;
|
|
495
495
|
#r;
|
|
@@ -498,12 +498,12 @@ var M = class u2 {
|
|
|
498
498
|
#d;
|
|
499
499
|
#g;
|
|
500
500
|
#T;
|
|
501
|
-
#
|
|
501
|
+
#U;
|
|
502
502
|
#f;
|
|
503
|
-
#
|
|
503
|
+
#D;
|
|
504
504
|
static unsafeExposeInternals(e) {
|
|
505
|
-
return { starts: e.#F, ttls: e.#d, autopurgeTimers: e.#g, sizes: e.#_, keyMap: e.#s, keyList: e.#i, valList: e.#t, next: e.#
|
|
506
|
-
return e.#
|
|
505
|
+
return { starts: e.#F, ttls: e.#d, autopurgeTimers: e.#g, sizes: e.#_, keyMap: e.#s, keyList: e.#i, valList: e.#t, next: e.#l, prev: e.#u, get head() {
|
|
506
|
+
return e.#a;
|
|
507
507
|
}, get tail() {
|
|
508
508
|
return e.#h;
|
|
509
509
|
}, free: e.#y, isBackgroundFetch: (t) => e.#e(t), backgroundFetch: (t, i, s, n) => e.#P(t, i, s, n), moveToTail: (t) => e.#L(t), indexes: (t) => e.#A(t), rindexes: (t) => e.#z(t), isStale: (t) => e.#p(t) };
|
|
@@ -512,7 +512,7 @@ var M = class u2 {
|
|
|
512
512
|
return this.#o;
|
|
513
513
|
}
|
|
514
514
|
get maxSize() {
|
|
515
|
-
return this.#
|
|
515
|
+
return this.#c;
|
|
516
516
|
}
|
|
517
517
|
get calculatedSize() {
|
|
518
518
|
return this.#b;
|
|
@@ -524,134 +524,139 @@ var M = class u2 {
|
|
|
524
524
|
return this.#M;
|
|
525
525
|
}
|
|
526
526
|
get memoMethod() {
|
|
527
|
-
return this.#
|
|
527
|
+
return this.#I;
|
|
528
528
|
}
|
|
529
529
|
get dispose() {
|
|
530
|
-
return this.#
|
|
530
|
+
return this.#S;
|
|
531
531
|
}
|
|
532
532
|
get onInsert() {
|
|
533
|
-
return this.#
|
|
533
|
+
return this.#O;
|
|
534
534
|
}
|
|
535
535
|
get disposeAfter() {
|
|
536
|
-
return this.#
|
|
536
|
+
return this.#w;
|
|
537
537
|
}
|
|
538
538
|
constructor(e) {
|
|
539
|
-
let { max: t = 0, ttl: i, ttlResolution: s = 1, ttlAutopurge: n, updateAgeOnGet: o, updateAgeOnHas:
|
|
540
|
-
if (
|
|
541
|
-
if (this.#m =
|
|
539
|
+
let { max: t = 0, ttl: i, ttlResolution: s = 1, ttlAutopurge: n, updateAgeOnGet: o, updateAgeOnHas: l, allowStale: h, dispose: r, onInsert: c, disposeAfter: m, noDisposeOnSet: _, noUpdateTTL: u, maxSize: g = 0, maxEntrySize: f = 0, sizeCalculation: y, fetchMethod: a, memoMethod: w, noDeleteOnFetchRejection: F, noDeleteOnStaleGet: b, allowStaleOnFetchRejection: p, allowStaleOnFetchAbort: A, ignoreFetchAbort: z, backgroundFetchSize: C = 1, perf: E } = e;
|
|
540
|
+
if (this.backgroundFetchSize = C, E !== void 0 && typeof E?.now != "function") throw new TypeError("perf option must have a now() method if specified");
|
|
541
|
+
if (this.#m = E ?? L, t !== 0 && !T(t)) throw new TypeError("max option must be a nonnegative integer");
|
|
542
542
|
let v = t ? j(t) : Array;
|
|
543
543
|
if (!v) throw new Error("invalid max value: " + t);
|
|
544
|
-
if (this.#o = t, this.#
|
|
545
|
-
if (!this.#
|
|
544
|
+
if (this.#o = t, this.#c = g, this.maxEntrySize = f || this.#c, this.sizeCalculation = y, this.sizeCalculation) {
|
|
545
|
+
if (!this.#c && !this.maxEntrySize) throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");
|
|
546
546
|
if (typeof this.sizeCalculation != "function") throw new TypeError("sizeCalculation set to non-function");
|
|
547
547
|
}
|
|
548
|
-
if (
|
|
549
|
-
if (this.#
|
|
550
|
-
if (this.#M = a, this.#
|
|
551
|
-
if (this.#
|
|
552
|
-
if (!
|
|
548
|
+
if (w !== void 0 && typeof w != "function") throw new TypeError("memoMethod must be a function if defined");
|
|
549
|
+
if (this.#I = w, a !== void 0 && typeof a != "function") throw new TypeError("fetchMethod must be a function if specified");
|
|
550
|
+
if (this.#M = a, this.#U = !!a, this.#s = /* @__PURE__ */ new Map(), this.#i = Array.from({ length: t }).fill(void 0), this.#t = Array.from({ length: t }).fill(void 0), this.#l = new v(t), this.#u = new v(t), this.#a = 0, this.#h = 0, this.#y = x.create(t), this.#n = 0, this.#b = 0, typeof r == "function" && (this.#S = r), typeof c == "function" && (this.#O = c), typeof m == "function" ? (this.#w = m, this.#r = []) : (this.#w = void 0, this.#r = void 0), this.#T = !!this.#S, this.#D = !!this.#O, this.#f = !!this.#w, this.noDisposeOnSet = !!_, this.noUpdateTTL = !!u, this.noDeleteOnFetchRejection = !!F, this.allowStaleOnFetchRejection = !!p, this.allowStaleOnFetchAbort = !!A, this.ignoreFetchAbort = !!z, this.maxEntrySize !== 0) {
|
|
551
|
+
if (this.#c !== 0 && !T(this.#c)) throw new TypeError("maxSize must be a positive integer if specified");
|
|
552
|
+
if (!T(this.maxEntrySize)) throw new TypeError("maxEntrySize must be a positive integer if specified");
|
|
553
553
|
this.#X();
|
|
554
554
|
}
|
|
555
|
-
if (this.allowStale = !!h, this.noDeleteOnStaleGet = !!b, this.updateAgeOnGet = !!o, this.updateAgeOnHas = !!
|
|
556
|
-
if (!
|
|
557
|
-
this.#
|
|
555
|
+
if (this.allowStale = !!h, this.noDeleteOnStaleGet = !!b, this.updateAgeOnGet = !!o, this.updateAgeOnHas = !!l, this.ttlResolution = T(s) || s === 0 ? s : 1, this.ttlAutopurge = !!n, this.ttl = i || 0, this.ttl) {
|
|
556
|
+
if (!T(this.ttl)) throw new TypeError("ttl must be a positive integer if specified");
|
|
557
|
+
this.#k();
|
|
558
558
|
}
|
|
559
|
-
if (this.#o === 0 && this.ttl === 0 && this.#
|
|
560
|
-
if (!this.ttlAutopurge && !this.#o && !this.#
|
|
561
|
-
let
|
|
562
|
-
H(
|
|
559
|
+
if (this.#o === 0 && this.ttl === 0 && this.#c === 0) throw new TypeError("At least one of max, maxSize, or ttl is required");
|
|
560
|
+
if (!this.ttlAutopurge && !this.#o && !this.#c) {
|
|
561
|
+
let D = "LRU_CACHE_UNBOUNDED";
|
|
562
|
+
H(D) && (U.add(D), k("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.", "UnboundedCacheWarning", D, d2));
|
|
563
563
|
}
|
|
564
564
|
}
|
|
565
565
|
getRemainingTTL(e) {
|
|
566
566
|
return this.#s.has(e) ? 1 / 0 : 0;
|
|
567
567
|
}
|
|
568
|
-
#
|
|
568
|
+
#k() {
|
|
569
569
|
let e = new O(this.#o), t = new O(this.#o);
|
|
570
570
|
this.#d = e, this.#F = t;
|
|
571
571
|
let i = this.ttlAutopurge ? Array.from({ length: this.#o }) : void 0;
|
|
572
|
-
this.#g = i, this.#
|
|
573
|
-
t[
|
|
574
|
-
}, this.#
|
|
575
|
-
t[
|
|
572
|
+
this.#g = i, this.#H = (h, r, c = this.#m.now()) => {
|
|
573
|
+
t[h] = r !== 0 ? c : 0, e[h] = r, s(h, r);
|
|
574
|
+
}, this.#R = (h) => {
|
|
575
|
+
t[h] = e[h] !== 0 ? this.#m.now() : 0, s(h, e[h]);
|
|
576
576
|
};
|
|
577
|
-
let s = this.ttlAutopurge ? (
|
|
578
|
-
if (i?.[
|
|
579
|
-
let
|
|
580
|
-
this.#p(
|
|
581
|
-
},
|
|
582
|
-
|
|
577
|
+
let s = this.ttlAutopurge ? (h, r) => {
|
|
578
|
+
if (i?.[h] && (clearTimeout(i[h]), i[h] = void 0), r && r !== 0 && i) {
|
|
579
|
+
let c = setTimeout(() => {
|
|
580
|
+
this.#p(h) ? (this.#E(this.#i[h], "expire"), i[h] = void 0) : s(h, l(h));
|
|
581
|
+
}, r + 1);
|
|
582
|
+
c.unref && c.unref(), i[h] = c;
|
|
583
583
|
}
|
|
584
584
|
} : () => {
|
|
585
585
|
};
|
|
586
|
-
this.#
|
|
587
|
-
if (e[
|
|
588
|
-
let
|
|
589
|
-
if (!
|
|
590
|
-
|
|
591
|
-
let
|
|
592
|
-
|
|
586
|
+
this.#v = (h, r) => {
|
|
587
|
+
if (e[r]) {
|
|
588
|
+
let c = e[r], m = t[r];
|
|
589
|
+
if (!c || !m) return;
|
|
590
|
+
h.ttl = c, h.start = m, h.now = n || o();
|
|
591
|
+
let _ = h.now - m;
|
|
592
|
+
h.remainingTTL = c - _;
|
|
593
593
|
}
|
|
594
594
|
};
|
|
595
595
|
let n = 0, o = () => {
|
|
596
|
-
let
|
|
596
|
+
let h = this.#m.now();
|
|
597
597
|
if (this.ttlResolution > 0) {
|
|
598
|
-
n =
|
|
599
|
-
let
|
|
600
|
-
|
|
598
|
+
n = h;
|
|
599
|
+
let r = setTimeout(() => n = 0, this.ttlResolution);
|
|
600
|
+
r.unref && r.unref();
|
|
601
601
|
}
|
|
602
|
-
return
|
|
602
|
+
return h;
|
|
603
|
+
};
|
|
604
|
+
this.getRemainingTTL = (h) => {
|
|
605
|
+
let r = this.#s.get(h);
|
|
606
|
+
return r === void 0 ? 0 : l(r);
|
|
603
607
|
};
|
|
604
|
-
|
|
605
|
-
let h =
|
|
606
|
-
if (
|
|
607
|
-
let
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
return !!l && !!h && (n || o()) - h > l;
|
|
608
|
+
let l = (h) => {
|
|
609
|
+
let r = e[h], c = t[h];
|
|
610
|
+
if (!r || !c) return 1 / 0;
|
|
611
|
+
let m = (n || o()) - c;
|
|
612
|
+
return r - m;
|
|
613
|
+
};
|
|
614
|
+
this.#p = (h) => {
|
|
615
|
+
let r = t[h], c = e[h];
|
|
616
|
+
return !!c && !!r && (n || o()) - r > c;
|
|
614
617
|
};
|
|
615
618
|
}
|
|
616
|
-
#
|
|
619
|
+
#R = () => {
|
|
617
620
|
};
|
|
618
|
-
#
|
|
621
|
+
#v = () => {
|
|
619
622
|
};
|
|
620
|
-
#
|
|
623
|
+
#H = () => {
|
|
621
624
|
};
|
|
622
625
|
#p = () => false;
|
|
623
626
|
#X() {
|
|
624
627
|
let e = new O(this.#o);
|
|
625
|
-
this.#b = 0, this.#_ = e, this.#
|
|
628
|
+
this.#b = 0, this.#_ = e, this.#x = (t) => {
|
|
626
629
|
this.#b -= e[t], e[t] = 0;
|
|
627
|
-
}, this.#
|
|
628
|
-
if (
|
|
629
|
-
|
|
630
|
-
if (
|
|
631
|
-
|
|
632
|
-
|
|
630
|
+
}, this.#N = (t, i, s, n) => {
|
|
631
|
+
if (!T(s)) {
|
|
632
|
+
if (this.#e(i)) return this.backgroundFetchSize;
|
|
633
|
+
if (n) {
|
|
634
|
+
if (typeof n != "function") throw new TypeError("sizeCalculation must be a function");
|
|
635
|
+
if (s = n(i, t), !T(s)) throw new TypeError("sizeCalculation return invalid (expect positive integer)");
|
|
636
|
+
} else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");
|
|
637
|
+
}
|
|
633
638
|
return s;
|
|
634
|
-
}, this.#
|
|
635
|
-
if (e[t] = i, this.#
|
|
636
|
-
let n = this.#
|
|
639
|
+
}, this.#j = (t, i, s) => {
|
|
640
|
+
if (e[t] = i, this.#c) {
|
|
641
|
+
let n = this.#c - e[t];
|
|
637
642
|
for (; this.#b > n; ) this.#G(true);
|
|
638
643
|
}
|
|
639
644
|
this.#b += e[t], s && (s.entrySize = i, s.totalCalculatedSize = this.#b);
|
|
640
645
|
};
|
|
641
646
|
}
|
|
642
|
-
#
|
|
647
|
+
#x = (e) => {
|
|
643
648
|
};
|
|
644
|
-
#
|
|
649
|
+
#j = (e, t, i) => {
|
|
645
650
|
};
|
|
646
|
-
#
|
|
651
|
+
#N = (e, t, i, s) => {
|
|
647
652
|
if (i || s) throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");
|
|
648
653
|
return 0;
|
|
649
654
|
};
|
|
650
655
|
*#A({ allowStale: e = this.allowStale } = {}) {
|
|
651
|
-
if (this.#n) for (let t = this.#h; this.#V(t) && ((e || !this.#p(t)) && (yield t), t !== this.#
|
|
656
|
+
if (this.#n) for (let t = this.#h; this.#V(t) && ((e || !this.#p(t)) && (yield t), t !== this.#a); ) t = this.#u[t];
|
|
652
657
|
}
|
|
653
658
|
*#z({ allowStale: e = this.allowStale } = {}) {
|
|
654
|
-
if (this.#n) for (let t = this.#
|
|
659
|
+
if (this.#n) for (let t = this.#a; this.#V(t) && ((e || !this.#p(t)) && (yield t), t !== this.#h); ) t = this.#l[t];
|
|
655
660
|
}
|
|
656
661
|
#V(e) {
|
|
657
662
|
return e !== void 0 && this.#s.get(this.#i[e]) === e;
|
|
@@ -704,7 +709,7 @@ var M = class u2 {
|
|
|
704
709
|
}
|
|
705
710
|
purgeStale() {
|
|
706
711
|
let e = false;
|
|
707
|
-
for (let t of this.#z({ allowStale: true })) this.#p(t) && (this.#
|
|
712
|
+
for (let t of this.#z({ allowStale: true })) this.#p(t) && (this.#E(this.#i[t], "expire"), e = true);
|
|
708
713
|
return e;
|
|
709
714
|
}
|
|
710
715
|
info(e) {
|
|
@@ -714,9 +719,9 @@ var M = class u2 {
|
|
|
714
719
|
if (s === void 0) return;
|
|
715
720
|
let n = { value: s };
|
|
716
721
|
if (this.#d && this.#F) {
|
|
717
|
-
let o = this.#d[t],
|
|
718
|
-
if (o &&
|
|
719
|
-
let h = o - (this.#m.now() -
|
|
722
|
+
let o = this.#d[t], l = this.#F[t];
|
|
723
|
+
if (o && l) {
|
|
724
|
+
let h = o - (this.#m.now() - l);
|
|
720
725
|
n.ttl = h, n.start = Date.now();
|
|
721
726
|
}
|
|
722
727
|
}
|
|
@@ -730,8 +735,8 @@ var M = class u2 {
|
|
|
730
735
|
let o = { value: n };
|
|
731
736
|
if (this.#d && this.#F) {
|
|
732
737
|
o.ttl = this.#d[t];
|
|
733
|
-
let
|
|
734
|
-
o.start = Math.floor(Date.now() -
|
|
738
|
+
let l = this.#m.now() - this.#F[t];
|
|
739
|
+
o.start = Math.floor(Date.now() - l);
|
|
735
740
|
}
|
|
736
741
|
this.#_ && (o.size = this.#_[t]), e.unshift([i, o]);
|
|
737
742
|
}
|
|
@@ -744,51 +749,49 @@ var M = class u2 {
|
|
|
744
749
|
let s = Date.now() - i.start;
|
|
745
750
|
i.start = this.#m.now() - s;
|
|
746
751
|
}
|
|
747
|
-
this.#
|
|
752
|
+
this.#W(t, i.value, i);
|
|
748
753
|
}
|
|
749
754
|
}
|
|
750
755
|
set(e, t, i = {}) {
|
|
751
756
|
let { status: s = S.hasSubscribers ? {} : void 0 } = i;
|
|
752
|
-
i.status = s, s && (s.op = "set", s.key = e, t !== void 0 && (s.value = t));
|
|
753
|
-
let n = this.#
|
|
757
|
+
i.status = s, s && (s.op = "set", s.key = e, t !== void 0 && (s.value = t), s.cache = this);
|
|
758
|
+
let n = this.#W(e, t, i);
|
|
754
759
|
return s && S.hasSubscribers && S.publish(s), n;
|
|
755
760
|
}
|
|
756
|
-
#
|
|
757
|
-
let { ttl:
|
|
758
|
-
if (t === void 0) return
|
|
759
|
-
let { noUpdateTTL:
|
|
760
|
-
|
|
761
|
-
let
|
|
762
|
-
if (this.maxEntrySize &&
|
|
763
|
-
let
|
|
764
|
-
if (
|
|
761
|
+
#W(e, t, i, s) {
|
|
762
|
+
let { ttl: n = this.ttl, start: o, noDisposeOnSet: l = this.noDisposeOnSet, sizeCalculation: h = this.sizeCalculation, status: r } = i, c = this.#e(t);
|
|
763
|
+
if (t === void 0) return r && (r.set = "deleted"), this.delete(e), this;
|
|
764
|
+
let { noUpdateTTL: m = this.noUpdateTTL } = i;
|
|
765
|
+
r && !c && (r.value = t);
|
|
766
|
+
let _ = this.#N(e, t, i.size || 0, h, r);
|
|
767
|
+
if (this.maxEntrySize && _ > this.maxEntrySize) return this.#E(e, "set"), r && (r.set = "miss", r.maxEntrySizeExceeded = true), this;
|
|
768
|
+
let u = this.#n === 0 ? void 0 : this.#s.get(e);
|
|
769
|
+
if (u === void 0) u = this.#n === 0 ? this.#h : this.#y.length !== 0 ? this.#y.pop() : this.#n === this.#o ? this.#G(false) : this.#n, this.#i[u] = e, this.#t[u] = t, this.#s.set(e, u), this.#l[this.#h] = u, this.#u[u] = this.#h, this.#h = u, this.#n++, this.#j(u, _, r), r && (r.set = "add"), m = false, this.#D && !c && this.#O?.(t, e, "add");
|
|
765
770
|
else {
|
|
766
|
-
this.#L(
|
|
767
|
-
let g = this.#t[
|
|
771
|
+
this.#L(u);
|
|
772
|
+
let g = this.#t[u];
|
|
768
773
|
if (t !== g) {
|
|
769
|
-
if (
|
|
770
|
-
g.__abortController.abort(new Error("replaced"));
|
|
771
|
-
let { __staleWhileFetching:
|
|
772
|
-
|
|
773
|
-
} else
|
|
774
|
-
if (this.#
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
p !== void 0 && (h.oldValue = p);
|
|
774
|
+
if (!l) if (this.#e(g)) {
|
|
775
|
+
g !== s && g.__abortController.abort(new Error("replaced"));
|
|
776
|
+
let { __staleWhileFetching: f } = g;
|
|
777
|
+
f !== void 0 && f !== t && (this.#T && this.#S?.(f, e, "set"), this.#f && this.#r?.push([f, e, "set"]));
|
|
778
|
+
} else this.#T && this.#S?.(g, e, "set"), this.#f && this.#r?.push([g, e, "set"]);
|
|
779
|
+
if (this.#x(u), this.#j(u, _, r), this.#t[u] = t, !c) {
|
|
780
|
+
let f = g && this.#e(g) ? g.__staleWhileFetching : g, y = f === void 0 ? "add" : t !== f ? "replace" : "update";
|
|
781
|
+
r && (r.set = y, f !== void 0 && (r.oldValue = f)), this.#D && this.onInsert?.(t, e, y);
|
|
778
782
|
}
|
|
779
|
-
} else
|
|
780
|
-
this.#j && this.onInsert?.(t, e, t === g ? "update" : "replace");
|
|
783
|
+
} else c || (r && (r.set = "update"), this.#D && this.onInsert?.(t, e, "update"));
|
|
781
784
|
}
|
|
782
|
-
if (
|
|
783
|
-
let g = this.#r,
|
|
784
|
-
for (;
|
|
785
|
+
if (n !== 0 && !this.#d && this.#k(), this.#d && (m || this.#H(u, n, o), r && this.#v(r, u)), !l && this.#f && this.#r) {
|
|
786
|
+
let g = this.#r, f;
|
|
787
|
+
for (; f = g?.shift(); ) this.#w?.(...f);
|
|
785
788
|
}
|
|
786
789
|
return this;
|
|
787
790
|
}
|
|
788
791
|
pop() {
|
|
789
792
|
try {
|
|
790
793
|
for (; this.#n; ) {
|
|
791
|
-
let e = this.#t[this.#
|
|
794
|
+
let e = this.#t[this.#a];
|
|
792
795
|
if (this.#G(true), this.#e(e)) {
|
|
793
796
|
if (e.__staleWhileFetching) return e.__staleWhileFetching;
|
|
794
797
|
} else if (e !== void 0) return e;
|
|
@@ -796,17 +799,19 @@ var M = class u2 {
|
|
|
796
799
|
} finally {
|
|
797
800
|
if (this.#f && this.#r) {
|
|
798
801
|
let e = this.#r, t;
|
|
799
|
-
for (; t = e?.shift(); ) this.#
|
|
802
|
+
for (; t = e?.shift(); ) this.#w?.(...t);
|
|
800
803
|
}
|
|
801
804
|
}
|
|
802
805
|
}
|
|
803
806
|
#G(e) {
|
|
804
|
-
let t = this.#
|
|
805
|
-
|
|
807
|
+
let t = this.#a, i = this.#i[t], s = this.#t[t], n = this.#e(s);
|
|
808
|
+
n && s.__abortController.abort(new Error("evicted"));
|
|
809
|
+
let o = n ? s.__staleWhileFetching : s;
|
|
810
|
+
return (this.#T || this.#f) && o !== void 0 && (this.#T && this.#S?.(o, i, "evict"), this.#f && this.#r?.push([o, i, "evict"])), this.#x(t), this.#g?.[t] && (clearTimeout(this.#g[t]), this.#g[t] = void 0), e && (this.#i[t] = void 0, this.#t[t] = void 0, this.#y.push(t)), this.#n === 1 ? (this.#a = this.#h = 0, this.#y.length = 0) : this.#a = this.#l[t], this.#s.delete(i), this.#n--, t;
|
|
806
811
|
}
|
|
807
812
|
has(e, t = {}) {
|
|
808
813
|
let { status: i = S.hasSubscribers ? {} : void 0 } = t;
|
|
809
|
-
t.status = i, i && (i.op = "has", i.key = e);
|
|
814
|
+
t.status = i, i && (i.op = "has", i.key = e, i.cache = this);
|
|
810
815
|
let s = this.#Y(e, t);
|
|
811
816
|
return S.hasSubscribers && S.publish(i), s;
|
|
812
817
|
}
|
|
@@ -815,14 +820,14 @@ var M = class u2 {
|
|
|
815
820
|
if (n !== void 0) {
|
|
816
821
|
let o = this.#t[n];
|
|
817
822
|
if (this.#e(o) && o.__staleWhileFetching === void 0) return false;
|
|
818
|
-
if (this.#p(n)) s && (s.has = "stale", this.#
|
|
819
|
-
else return i && this.#
|
|
823
|
+
if (this.#p(n)) s && (s.has = "stale", this.#v(s, n));
|
|
824
|
+
else return i && this.#R(n), s && (s.has = "hit", this.#v(s, n)), true;
|
|
820
825
|
} else s && (s.has = "miss");
|
|
821
826
|
return false;
|
|
822
827
|
}
|
|
823
828
|
peek(e, t = {}) {
|
|
824
|
-
let { status: i =
|
|
825
|
-
i && (i.op = "peek", i.key = e), t.status = i;
|
|
829
|
+
let { status: i = R() ? {} : void 0 } = t;
|
|
830
|
+
i && (i.op = "peek", i.key = e, i.cache = this), t.status = i;
|
|
826
831
|
let s = this.#J(e, t);
|
|
827
832
|
return S.hasSubscribers && S.publish(i), s;
|
|
828
833
|
}
|
|
@@ -832,67 +837,67 @@ var M = class u2 {
|
|
|
832
837
|
i && (i.peek = n === void 0 ? "miss" : "stale");
|
|
833
838
|
return;
|
|
834
839
|
}
|
|
835
|
-
let o = this.#t[n],
|
|
836
|
-
return i && (
|
|
840
|
+
let o = this.#t[n], l = this.#e(o) ? o.__staleWhileFetching : o;
|
|
841
|
+
return i && (l !== void 0 ? (i.peek = "hit", i.value = l) : i.peek = "miss"), l;
|
|
837
842
|
}
|
|
838
843
|
#P(e, t, i, s) {
|
|
839
844
|
let n = t === void 0 ? void 0 : this.#t[t];
|
|
840
845
|
if (this.#e(n)) return n;
|
|
841
|
-
let o = new AbortController(), { signal:
|
|
842
|
-
|
|
843
|
-
let h = { signal: o.signal, options: i, context: s },
|
|
844
|
-
let { aborted: a } = o.signal,
|
|
845
|
-
if (i.status && (a && !y ? (i.status.fetchAborted = true, i.status.fetchError = o.signal.reason,
|
|
846
|
-
let b =
|
|
847
|
-
return (
|
|
848
|
-
}, c = (
|
|
849
|
-
let { aborted: a } = o.signal,
|
|
850
|
-
if (this.#t[t] ===
|
|
851
|
-
if (
|
|
852
|
-
},
|
|
846
|
+
let o = new AbortController(), { signal: l } = i;
|
|
847
|
+
l?.addEventListener("abort", () => o.abort(l.reason), { signal: o.signal });
|
|
848
|
+
let h = { signal: o.signal, options: i, context: s }, r = (f, y = false) => {
|
|
849
|
+
let { aborted: a } = o.signal, w = i.ignoreFetchAbort && f !== void 0, F = i.ignoreFetchAbort || !!(i.allowStaleOnFetchAbort && f !== void 0);
|
|
850
|
+
if (i.status && (a && !y ? (i.status.fetchAborted = true, i.status.fetchError = o.signal.reason, w && (i.status.fetchAbortIgnored = true)) : i.status.fetchResolved = true), a && !w && !y) return m(o.signal.reason, F);
|
|
851
|
+
let b = u, p = this.#t[t];
|
|
852
|
+
return (p === u || p === void 0 && w && y) && (f === void 0 ? b.__staleWhileFetching !== void 0 ? this.#t[t] = b.__staleWhileFetching : this.#E(e, "fetch") : (i.status && (i.status.fetchUpdated = true), this.#W(e, f, h.options, b))), f;
|
|
853
|
+
}, c = (f) => (i.status && (i.status.fetchRejected = true, i.status.fetchError = f), m(f, false)), m = (f, y) => {
|
|
854
|
+
let { aborted: a } = o.signal, w = a && i.allowStaleOnFetchAbort, F = w || i.allowStaleOnFetchRejection, b = F || i.noDeleteOnFetchRejection, p = u;
|
|
855
|
+
if (this.#t[t] === u && (!b || !y && p.__staleWhileFetching === void 0 ? this.#E(e, "fetch") : w || (this.#t[t] = p.__staleWhileFetching)), F) return i.status && p.__staleWhileFetching !== void 0 && (i.status.returnedStale = true), p.__staleWhileFetching;
|
|
856
|
+
if (p.__returned === p) throw f;
|
|
857
|
+
}, _ = (f, y) => {
|
|
853
858
|
let a = this.#M?.(e, n, h);
|
|
854
|
-
|
|
855
|
-
(!i.ignoreFetchAbort || i.allowStaleOnFetchAbort) && (
|
|
856
|
-
});
|
|
859
|
+
o.signal.addEventListener("abort", () => {
|
|
860
|
+
(!i.ignoreFetchAbort || i.allowStaleOnFetchAbort) && (f(void 0), i.allowStaleOnFetchAbort && (f = (w) => r(w, true)));
|
|
861
|
+
}), a && a instanceof Promise ? a.then((w) => f(w === void 0 ? void 0 : w), y) : a !== void 0 && f(a);
|
|
857
862
|
};
|
|
858
863
|
i.status && (i.status.fetchDispatched = true);
|
|
859
|
-
let
|
|
860
|
-
return t === void 0 ? (this.#
|
|
864
|
+
let u = new Promise(_).then(r, c), g = Object.assign(u, { __abortController: o, __staleWhileFetching: n, __returned: void 0 });
|
|
865
|
+
return t === void 0 ? (this.#W(e, g, { ...h.options, status: void 0 }), t = this.#s.get(e)) : this.#t[t] = g, g;
|
|
861
866
|
}
|
|
862
867
|
#e(e) {
|
|
863
|
-
if (!this.#
|
|
868
|
+
if (!this.#U) return false;
|
|
864
869
|
let t = e;
|
|
865
870
|
return !!t && t instanceof Promise && t.hasOwnProperty("__staleWhileFetching") && t.__abortController instanceof AbortController;
|
|
866
871
|
}
|
|
867
872
|
fetch(e, t = {}) {
|
|
868
|
-
let i = W.hasSubscribers, { status: s =
|
|
873
|
+
let i = W.hasSubscribers, { status: s = R() ? {} : void 0 } = t;
|
|
869
874
|
t.status = s, s && t.context && (s.context = t.context);
|
|
870
875
|
let n = this.#B(e, t);
|
|
871
876
|
return s && i && (s.trace = true, W.tracePromise(() => n, s).catch(() => {
|
|
872
877
|
})), n;
|
|
873
878
|
}
|
|
874
879
|
async #B(e, t = {}) {
|
|
875
|
-
let { allowStale: i = this.allowStale, updateAgeOnGet: s = this.updateAgeOnGet, noDeleteOnStaleGet: n = this.noDeleteOnStaleGet, ttl: o = this.ttl, noDisposeOnSet:
|
|
876
|
-
if (a && (a.op = "fetch", a.key = e, y && (a.forceRefresh = true)), !this.#
|
|
877
|
-
let
|
|
880
|
+
let { allowStale: i = this.allowStale, updateAgeOnGet: s = this.updateAgeOnGet, noDeleteOnStaleGet: n = this.noDeleteOnStaleGet, ttl: o = this.ttl, noDisposeOnSet: l = this.noDisposeOnSet, size: h = 0, sizeCalculation: r = this.sizeCalculation, noUpdateTTL: c = this.noUpdateTTL, noDeleteOnFetchRejection: m = this.noDeleteOnFetchRejection, allowStaleOnFetchRejection: _ = this.allowStaleOnFetchRejection, ignoreFetchAbort: u = this.ignoreFetchAbort, allowStaleOnFetchAbort: g = this.allowStaleOnFetchAbort, context: f, forceRefresh: y = false, status: a, signal: w } = t;
|
|
881
|
+
if (a && (a.op = "fetch", a.key = e, y && (a.forceRefresh = true), a.cache = this), !this.#U) return a && (a.fetch = "get"), this.#C(e, { allowStale: i, updateAgeOnGet: s, noDeleteOnStaleGet: n, status: a });
|
|
882
|
+
let F = { allowStale: i, updateAgeOnGet: s, noDeleteOnStaleGet: n, ttl: o, noDisposeOnSet: l, size: h, sizeCalculation: r, noUpdateTTL: c, noDeleteOnFetchRejection: m, allowStaleOnFetchRejection: _, allowStaleOnFetchAbort: g, ignoreFetchAbort: u, status: a, signal: w }, b = this.#s.get(e);
|
|
878
883
|
if (b === void 0) {
|
|
879
884
|
a && (a.fetch = "miss");
|
|
880
|
-
let
|
|
881
|
-
return
|
|
885
|
+
let p = this.#P(e, b, F, f);
|
|
886
|
+
return p.__returned = p;
|
|
882
887
|
} else {
|
|
883
|
-
let
|
|
884
|
-
if (this.#e(
|
|
885
|
-
let
|
|
886
|
-
return a && (a.fetch = "inflight",
|
|
888
|
+
let p = this.#t[b];
|
|
889
|
+
if (this.#e(p)) {
|
|
890
|
+
let v = i && p.__staleWhileFetching !== void 0;
|
|
891
|
+
return a && (a.fetch = "inflight", v && (a.returnedStale = true)), v ? p.__staleWhileFetching : p.__returned = p;
|
|
887
892
|
}
|
|
888
893
|
let A = this.#p(b);
|
|
889
|
-
if (!y && !A) return a && (a.fetch = "hit"), this.#L(b), s && this.#
|
|
890
|
-
let z = this.#P(e, b,
|
|
891
|
-
return a && (a.fetch = A ? "stale" : "refresh",
|
|
894
|
+
if (!y && !A) return a && (a.fetch = "hit"), this.#L(b), s && this.#R(b), a && this.#v(a, b), p;
|
|
895
|
+
let z = this.#P(e, b, F, f), E = z.__staleWhileFetching !== void 0 && i;
|
|
896
|
+
return a && (a.fetch = A ? "stale" : "refresh", E && A && (a.returnedStale = true)), E ? z.__staleWhileFetching : z.__returned = z;
|
|
892
897
|
}
|
|
893
898
|
}
|
|
894
899
|
forceFetch(e, t = {}) {
|
|
895
|
-
let i = W.hasSubscribers, { status: s =
|
|
900
|
+
let i = W.hasSubscribers, { status: s = R() ? {} : void 0 } = t;
|
|
896
901
|
t.status = s, s && t.context && (s.context = t.context);
|
|
897
902
|
let n = this.#K(e, t);
|
|
898
903
|
return s && i && (s.trace = true, W.tracePromise(() => n, s).catch(() => {
|
|
@@ -905,67 +910,67 @@ var M = class u2 {
|
|
|
905
910
|
}
|
|
906
911
|
memo(e, t = {}) {
|
|
907
912
|
let { status: i = S.hasSubscribers ? {} : void 0 } = t;
|
|
908
|
-
t.status = i, i && (i.op = "memo", i.key = e, t.context && (i.context = t.context));
|
|
913
|
+
t.status = i, i && (i.op = "memo", i.key = e, t.context && (i.context = t.context), i.cache = this);
|
|
909
914
|
let s = this.#Q(e, t);
|
|
910
915
|
return i && (i.value = s), S.hasSubscribers && S.publish(i), s;
|
|
911
916
|
}
|
|
912
917
|
#Q(e, t = {}) {
|
|
913
|
-
let i = this.#
|
|
918
|
+
let i = this.#I;
|
|
914
919
|
if (!i) throw new Error("no memoMethod provided to constructor");
|
|
915
|
-
let { context: s, status: n, forceRefresh: o, ...
|
|
920
|
+
let { context: s, status: n, forceRefresh: o, ...l } = t;
|
|
916
921
|
n && o && (n.forceRefresh = true);
|
|
917
|
-
let h = this.#C(e,
|
|
918
|
-
if (n && (n.memo =
|
|
919
|
-
let c = i(e, h, { options:
|
|
920
|
-
return n && (n.value = c), this.#
|
|
922
|
+
let h = this.#C(e, l), r = o || h === void 0;
|
|
923
|
+
if (n && (n.memo = r ? "miss" : "hit", r || (n.value = h)), !r) return h;
|
|
924
|
+
let c = i(e, h, { options: l, context: s });
|
|
925
|
+
return n && (n.value = c), this.#W(e, c, l), c;
|
|
921
926
|
}
|
|
922
927
|
get(e, t = {}) {
|
|
923
928
|
let { status: i = S.hasSubscribers ? {} : void 0 } = t;
|
|
924
|
-
t.status = i, i && (i.op = "get", i.key = e);
|
|
929
|
+
t.status = i, i && (i.op = "get", i.key = e, i.cache = this);
|
|
925
930
|
let s = this.#C(e, t);
|
|
926
931
|
return i && (s !== void 0 && (i.value = s), S.hasSubscribers && S.publish(i)), s;
|
|
927
932
|
}
|
|
928
933
|
#C(e, t = {}) {
|
|
929
|
-
let { allowStale: i = this.allowStale, updateAgeOnGet: s = this.updateAgeOnGet, noDeleteOnStaleGet: n = this.noDeleteOnStaleGet, status: o } = t,
|
|
930
|
-
if (
|
|
934
|
+
let { allowStale: i = this.allowStale, updateAgeOnGet: s = this.updateAgeOnGet, noDeleteOnStaleGet: n = this.noDeleteOnStaleGet, status: o } = t, l = this.#s.get(e);
|
|
935
|
+
if (l === void 0) {
|
|
931
936
|
o && (o.get = "miss");
|
|
932
937
|
return;
|
|
933
938
|
}
|
|
934
|
-
let h = this.#t[
|
|
935
|
-
return o && this.#
|
|
939
|
+
let h = this.#t[l], r = this.#e(h);
|
|
940
|
+
return o && this.#v(o, l), this.#p(l) ? r ? (o && (o.get = "stale-fetching"), i && h.__staleWhileFetching !== void 0 ? (o && (o.returnedStale = true), h.__staleWhileFetching) : void 0) : (n || this.#E(e, "expire"), o && (o.get = "stale"), i ? (o && (o.returnedStale = true), h) : void 0) : (o && (o.get = r ? "fetching" : "hit"), this.#L(l), s && this.#R(l), r ? h.__staleWhileFetching : h);
|
|
936
941
|
}
|
|
937
942
|
#$(e, t) {
|
|
938
|
-
this.#
|
|
943
|
+
this.#u[t] = e, this.#l[e] = t;
|
|
939
944
|
}
|
|
940
945
|
#L(e) {
|
|
941
|
-
e !== this.#h && (e === this.#
|
|
946
|
+
e !== this.#h && (e === this.#a ? this.#a = this.#l[e] : this.#$(this.#u[e], this.#l[e]), this.#$(this.#h, e), this.#h = e);
|
|
942
947
|
}
|
|
943
948
|
delete(e) {
|
|
944
|
-
return this.#
|
|
949
|
+
return this.#E(e, "delete");
|
|
945
950
|
}
|
|
946
|
-
#
|
|
947
|
-
S.hasSubscribers && S.publish({ op: "delete", delete: t, key: e });
|
|
951
|
+
#E(e, t) {
|
|
952
|
+
S.hasSubscribers && S.publish({ op: "delete", delete: t, key: e, cache: this });
|
|
948
953
|
let i = false;
|
|
949
954
|
if (this.#n !== 0) {
|
|
950
955
|
let s = this.#s.get(e);
|
|
951
|
-
if (s !== void 0) if (this.#g?.[s] && (clearTimeout(this.#g
|
|
956
|
+
if (s !== void 0) if (this.#g?.[s] && (clearTimeout(this.#g[s]), this.#g[s] = void 0), i = true, this.#n === 1) this.#q(t);
|
|
952
957
|
else {
|
|
953
|
-
this.#
|
|
958
|
+
this.#x(s);
|
|
954
959
|
let n = this.#t[s];
|
|
955
|
-
if (this.#e(n) ? n.__abortController.abort(new Error("deleted")) : (this.#T || this.#f) && (this.#T && this.#
|
|
956
|
-
else if (s === this.#
|
|
960
|
+
if (this.#e(n) ? n.__abortController.abort(new Error("deleted")) : (this.#T || this.#f) && (this.#T && this.#S?.(n, e, t), this.#f && this.#r?.push([n, e, t])), this.#s.delete(e), this.#i[s] = void 0, this.#t[s] = void 0, s === this.#h) this.#h = this.#u[s];
|
|
961
|
+
else if (s === this.#a) this.#a = this.#l[s];
|
|
957
962
|
else {
|
|
958
|
-
let o = this.#
|
|
959
|
-
this.#
|
|
960
|
-
let
|
|
961
|
-
this.#
|
|
963
|
+
let o = this.#u[s];
|
|
964
|
+
this.#l[o] = this.#l[s];
|
|
965
|
+
let l = this.#l[s];
|
|
966
|
+
this.#u[l] = this.#u[s];
|
|
962
967
|
}
|
|
963
968
|
this.#n--, this.#y.push(s);
|
|
964
969
|
}
|
|
965
970
|
}
|
|
966
971
|
if (this.#f && this.#r?.length) {
|
|
967
972
|
let s = this.#r, n;
|
|
968
|
-
for (; n = s?.shift(); ) this.#
|
|
973
|
+
for (; n = s?.shift(); ) this.#w?.(...n);
|
|
969
974
|
}
|
|
970
975
|
return i;
|
|
971
976
|
}
|
|
@@ -978,7 +983,7 @@ var M = class u2 {
|
|
|
978
983
|
if (this.#e(i)) i.__abortController.abort(new Error("deleted"));
|
|
979
984
|
else {
|
|
980
985
|
let s = this.#i[t];
|
|
981
|
-
this.#T && this.#
|
|
986
|
+
this.#T && this.#S?.(i, s, e), this.#f && this.#r?.push([i, s, e]);
|
|
982
987
|
}
|
|
983
988
|
}
|
|
984
989
|
if (this.#s.clear(), this.#t.fill(void 0), this.#i.fill(void 0), this.#d && this.#F) {
|
|
@@ -986,9 +991,9 @@ var M = class u2 {
|
|
|
986
991
|
for (let t of this.#g ?? []) t !== void 0 && clearTimeout(t);
|
|
987
992
|
this.#g?.fill(void 0);
|
|
988
993
|
}
|
|
989
|
-
if (this.#_ && this.#_.fill(0), this.#
|
|
994
|
+
if (this.#_ && this.#_.fill(0), this.#a = 0, this.#h = 0, this.#y.length = 0, this.#b = 0, this.#n = 0, this.#f && this.#r) {
|
|
990
995
|
let t = this.#r, i;
|
|
991
|
-
for (; i = t?.shift(); ) this.#
|
|
996
|
+
for (; i = t?.shift(); ) this.#w?.(...i);
|
|
992
997
|
}
|
|
993
998
|
}
|
|
994
999
|
};
|
|
@@ -1022,6 +1027,10 @@ function range(a, b) {
|
|
|
1022
1027
|
function schedule(fn, count) {
|
|
1023
1028
|
return Array.from({ length: count }, (_, i) => fn(i));
|
|
1024
1029
|
}
|
|
1030
|
+
function jitter(delayMs) {
|
|
1031
|
+
const half = delayMs / 2;
|
|
1032
|
+
return Math.round(half + Math.random() * half);
|
|
1033
|
+
}
|
|
1025
1034
|
var DEFAULT_RETRY_AFTER_CAP_MS = 2e4;
|
|
1026
1035
|
function getErrorResponseHeaders(error) {
|
|
1027
1036
|
if (error === null || typeof error !== "object") return void 0;
|
|
@@ -1099,11 +1108,11 @@ function op(fnOrOptions, options) {
|
|
|
1099
1108
|
}
|
|
1100
1109
|
function _op(fn, options) {
|
|
1101
1110
|
const shouldCache = options.ttl !== void 0;
|
|
1102
|
-
const lruCache = shouldCache ? new
|
|
1111
|
+
const lruCache = shouldCache ? new I({
|
|
1103
1112
|
max: options.maxItems ?? 1e3,
|
|
1104
1113
|
ttl: options.ttl
|
|
1105
1114
|
}) : null;
|
|
1106
|
-
const keyMap = shouldCache ? new
|
|
1115
|
+
const keyMap = shouldCache ? new I({
|
|
1107
1116
|
max: options.maxItems ?? 1e3,
|
|
1108
1117
|
ttl: options.ttl
|
|
1109
1118
|
}) : null;
|
|
@@ -1196,6 +1205,7 @@ function _op(fn, options) {
|
|
|
1196
1205
|
delay = Math.max(delay, Math.min(cap, hint));
|
|
1197
1206
|
}
|
|
1198
1207
|
}
|
|
1208
|
+
delay = jitter(delay);
|
|
1199
1209
|
if (namePrefix) {
|
|
1200
1210
|
log.info(
|
|
1201
1211
|
`${namePrefix}attempt ${attempt + 1}/${retries.length + 1} failed, retrying in ${delay}ms`
|