semantic-release-lerna 3.1.0 → 3.1.1
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.js +439 -430
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1516,6 +1516,7 @@ var require_range = __commonJS({
|
|
|
1516
1516
|
return this.range;
|
|
1517
1517
|
}
|
|
1518
1518
|
parseRange(range2) {
|
|
1519
|
+
range2 = range2.replace(BUILDSTRIPRE, "");
|
|
1519
1520
|
const memoOpts = (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | (this.options.loose && FLAG_LOOSE);
|
|
1520
1521
|
const memoKey = memoOpts + ":" + range2;
|
|
1521
1522
|
const cached = cache2.get(memoKey);
|
|
@@ -1598,12 +1599,14 @@ var require_range = __commonJS({
|
|
|
1598
1599
|
var SemVer = require_semver();
|
|
1599
1600
|
var {
|
|
1600
1601
|
safeRe: re,
|
|
1602
|
+
src,
|
|
1601
1603
|
t,
|
|
1602
1604
|
comparatorTrimReplace,
|
|
1603
1605
|
tildeTrimReplace,
|
|
1604
1606
|
caretTrimReplace
|
|
1605
1607
|
} = require_re();
|
|
1606
1608
|
var { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require_constants();
|
|
1609
|
+
var BUILDSTRIPRE = new RegExp(src[t.BUILD], "g");
|
|
1607
1610
|
var isNullSet = (c3) => c3.value === "<0.0.0-0";
|
|
1608
1611
|
var isAny = (c3) => c3.value === "";
|
|
1609
1612
|
var isSatisfiable = (comparators, options) => {
|
|
@@ -2359,7 +2362,7 @@ var require_subset = __commonJS({
|
|
|
2359
2362
|
if (higher === c3 && higher !== gt) {
|
|
2360
2363
|
return false;
|
|
2361
2364
|
}
|
|
2362
|
-
} else if (gt.operator === ">=" && !
|
|
2365
|
+
} else if (gt.operator === ">=" && !c3.test(gt.semver)) {
|
|
2363
2366
|
return false;
|
|
2364
2367
|
}
|
|
2365
2368
|
}
|
|
@@ -2374,7 +2377,7 @@ var require_subset = __commonJS({
|
|
|
2374
2377
|
if (lower === c3 && lower !== lt) {
|
|
2375
2378
|
return false;
|
|
2376
2379
|
}
|
|
2377
|
-
} else if (lt.operator === "<=" && !
|
|
2380
|
+
} else if (lt.operator === "<=" && !c3.test(lt.semver)) {
|
|
2378
2381
|
return false;
|
|
2379
2382
|
}
|
|
2380
2383
|
}
|
|
@@ -2512,34 +2515,34 @@ var require_semver2 = __commonJS({
|
|
|
2512
2515
|
var require_index_min = __commonJS({
|
|
2513
2516
|
"node_modules/npm-package-arg/node_modules/lru-cache/dist/commonjs/node/index.min.js"(exports) {
|
|
2514
2517
|
"use strict";
|
|
2515
|
-
var
|
|
2516
|
-
var
|
|
2518
|
+
var j = (c3, t) => () => (t || c3((t = { exports: {} }).exports, t), t.exports);
|
|
2519
|
+
var I = j((O) => {
|
|
2517
2520
|
"use strict";
|
|
2518
2521
|
Object.defineProperty(O, "__esModule", { value: true });
|
|
2519
2522
|
O.tracing = O.metrics = void 0;
|
|
2520
|
-
var
|
|
2521
|
-
O.metrics = (0,
|
|
2522
|
-
O.tracing = (0,
|
|
2523
|
+
var U = __require("node:diagnostics_channel");
|
|
2524
|
+
O.metrics = (0, U.channel)("lru-cache:metrics");
|
|
2525
|
+
O.tracing = (0, U.tracingChannel)("lru-cache");
|
|
2523
2526
|
});
|
|
2524
|
-
var
|
|
2527
|
+
var P = j((D) => {
|
|
2525
2528
|
"use strict";
|
|
2526
|
-
Object.defineProperty(
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
+
Object.defineProperty(D, "__esModule", { value: true });
|
|
2530
|
+
D.defaultPerf = void 0;
|
|
2531
|
+
D.defaultPerf = typeof performance == "object" && performance && typeof performance.now == "function" ? performance : Date;
|
|
2529
2532
|
});
|
|
2530
2533
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2531
2534
|
exports.LRUCache = void 0;
|
|
2532
|
-
var
|
|
2533
|
-
var N =
|
|
2534
|
-
var C = () =>
|
|
2535
|
-
var
|
|
2536
|
-
var
|
|
2537
|
-
var
|
|
2538
|
-
typeof
|
|
2539
|
-
};
|
|
2540
|
-
var q = (c3) => !
|
|
2541
|
-
var
|
|
2542
|
-
var H = (c3) =>
|
|
2535
|
+
var g = I();
|
|
2536
|
+
var N = P();
|
|
2537
|
+
var C = () => g.metrics.hasSubscribers || g.tracing.hasSubscribers;
|
|
2538
|
+
var k = /* @__PURE__ */ new Set();
|
|
2539
|
+
var G = typeof process == "object" && process ? process : {};
|
|
2540
|
+
var V = (c3, t, e, i2) => {
|
|
2541
|
+
typeof G.emitWarning == "function" ? G.emitWarning(c3, t, e, i2) : console.error(`[${e}] ${t}: ${c3}`);
|
|
2542
|
+
};
|
|
2543
|
+
var q = (c3) => !k.has(c3);
|
|
2544
|
+
var T = (c3) => !!c3 && c3 === Math.floor(c3) && c3 > 0 && isFinite(c3);
|
|
2545
|
+
var H = (c3) => T(c3) ? c3 <= Math.pow(2, 8) ? Uint8Array : c3 <= Math.pow(2, 16) ? Uint16Array : c3 <= Math.pow(2, 32) ? Uint32Array : c3 <= Number.MAX_SAFE_INTEGER ? W : null : null;
|
|
2543
2546
|
var W = class extends Array {
|
|
2544
2547
|
constructor(t) {
|
|
2545
2548
|
super(t), this.fill(0);
|
|
@@ -2571,13 +2574,13 @@ var require_index_min = __commonJS({
|
|
|
2571
2574
|
#o;
|
|
2572
2575
|
#c;
|
|
2573
2576
|
#m;
|
|
2574
|
-
#
|
|
2575
|
-
#
|
|
2577
|
+
#W;
|
|
2578
|
+
#S;
|
|
2576
2579
|
#M;
|
|
2577
2580
|
#j;
|
|
2578
|
-
#
|
|
2581
|
+
#w;
|
|
2579
2582
|
get perf() {
|
|
2580
|
-
return this.#
|
|
2583
|
+
return this.#w;
|
|
2581
2584
|
}
|
|
2582
2585
|
ttl;
|
|
2583
2586
|
ttlResolution;
|
|
@@ -2594,6 +2597,7 @@ var require_index_min = __commonJS({
|
|
|
2594
2597
|
allowStaleOnFetchAbort;
|
|
2595
2598
|
allowStaleOnFetchRejection;
|
|
2596
2599
|
ignoreFetchAbort;
|
|
2600
|
+
backgroundFetchSize;
|
|
2597
2601
|
#n;
|
|
2598
2602
|
#b;
|
|
2599
2603
|
#s;
|
|
@@ -2610,15 +2614,15 @@ var require_index_min = __commonJS({
|
|
|
2610
2614
|
#d;
|
|
2611
2615
|
#g;
|
|
2612
2616
|
#T;
|
|
2613
|
-
#O;
|
|
2614
|
-
#f;
|
|
2615
2617
|
#U;
|
|
2618
|
+
#f;
|
|
2619
|
+
#D;
|
|
2616
2620
|
static unsafeExposeInternals(t) {
|
|
2617
2621
|
return { starts: t.#F, ttls: t.#d, autopurgeTimers: t.#g, sizes: t.#y, keyMap: t.#s, keyList: t.#i, valList: t.#t, next: t.#l, prev: t.#u, get head() {
|
|
2618
2622
|
return t.#a;
|
|
2619
2623
|
}, get tail() {
|
|
2620
2624
|
return t.#h;
|
|
2621
|
-
}, free: t.#_, isBackgroundFetch: (e) => t.#e(e), backgroundFetch: (e, i2, s, n2) => t.#G(e, i2, s, n2), moveToTail: (e) => t.#L(e), indexes: (e) => t.#A(e), rindexes: (e) => t.#
|
|
2625
|
+
}, free: t.#_, isBackgroundFetch: (e) => t.#e(e), backgroundFetch: (e, i2, s, n2) => t.#G(e, i2, s, n2), moveToTail: (e) => t.#L(e), indexes: (e) => t.#A(e), rindexes: (e) => t.#z(e), isStale: (e) => t.#p(e) };
|
|
2622
2626
|
}
|
|
2623
2627
|
get max() {
|
|
2624
2628
|
return this.#o;
|
|
@@ -2642,106 +2646,108 @@ var require_index_min = __commonJS({
|
|
|
2642
2646
|
return this.#m;
|
|
2643
2647
|
}
|
|
2644
2648
|
get onInsert() {
|
|
2645
|
-
return this.#
|
|
2649
|
+
return this.#W;
|
|
2646
2650
|
}
|
|
2647
2651
|
get disposeAfter() {
|
|
2648
|
-
return this.#
|
|
2652
|
+
return this.#S;
|
|
2649
2653
|
}
|
|
2650
2654
|
constructor(t) {
|
|
2651
|
-
let { max: e = 0, ttl: i2, ttlResolution: s = 1, ttlAutopurge: n2, updateAgeOnGet:
|
|
2652
|
-
if (
|
|
2653
|
-
if (this.#
|
|
2654
|
-
let
|
|
2655
|
-
if (!
|
|
2656
|
-
if (this.#o = e, this.#c =
|
|
2655
|
+
let { max: e = 0, ttl: i2, ttlResolution: s = 1, ttlAutopurge: n2, updateAgeOnGet: r, updateAgeOnHas: h2, allowStale: a2, dispose: o2, onInsert: d, disposeAfter: _, noDisposeOnSet: y, noUpdateTTL: u2, maxSize: p = 0, maxEntrySize: f = 0, sizeCalculation: b, fetchMethod: l, memoMethod: S, noDeleteOnFetchRejection: F, noDeleteOnStaleGet: w, allowStaleOnFetchRejection: m, allowStaleOnFetchAbort: A, ignoreFetchAbort: z, backgroundFetchSize: M = 1, perf: v } = t;
|
|
2656
|
+
if (this.backgroundFetchSize = M, v !== void 0 && typeof v?.now != "function") throw new TypeError("perf option must have a now() method if specified");
|
|
2657
|
+
if (this.#w = v ?? N.defaultPerf, e !== 0 && !T(e)) throw new TypeError("max option must be a nonnegative integer");
|
|
2658
|
+
let E = e ? H(e) : Array;
|
|
2659
|
+
if (!E) throw new Error("invalid max value: " + e);
|
|
2660
|
+
if (this.#o = e, this.#c = p, this.maxEntrySize = f || this.#c, this.sizeCalculation = b, this.sizeCalculation) {
|
|
2657
2661
|
if (!this.#c && !this.maxEntrySize) throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");
|
|
2658
2662
|
if (typeof this.sizeCalculation != "function") throw new TypeError("sizeCalculation set to non-function");
|
|
2659
2663
|
}
|
|
2660
2664
|
if (S !== void 0 && typeof S != "function") throw new TypeError("memoMethod must be a function if defined");
|
|
2661
2665
|
if (this.#j = S, l !== void 0 && typeof l != "function") throw new TypeError("fetchMethod must be a function if specified");
|
|
2662
|
-
if (this.#M = l, this.#
|
|
2663
|
-
if (this.#c !== 0 && !
|
|
2664
|
-
if (!
|
|
2666
|
+
if (this.#M = l, this.#U = !!l, this.#s = /* @__PURE__ */ new Map(), this.#i = Array.from({ length: e }).fill(void 0), this.#t = Array.from({ length: e }).fill(void 0), this.#l = new E(e), this.#u = new E(e), this.#a = 0, this.#h = 0, this.#_ = x.create(e), this.#n = 0, this.#b = 0, typeof o2 == "function" && (this.#m = o2), typeof d == "function" && (this.#W = d), typeof _ == "function" ? (this.#S = _, this.#r = []) : (this.#S = void 0, this.#r = void 0), this.#T = !!this.#m, this.#D = !!this.#W, this.#f = !!this.#S, this.noDisposeOnSet = !!y, this.noUpdateTTL = !!u2, this.noDeleteOnFetchRejection = !!F, this.allowStaleOnFetchRejection = !!m, this.allowStaleOnFetchAbort = !!A, this.ignoreFetchAbort = !!z, this.maxEntrySize !== 0) {
|
|
2667
|
+
if (this.#c !== 0 && !T(this.#c)) throw new TypeError("maxSize must be a positive integer if specified");
|
|
2668
|
+
if (!T(this.maxEntrySize)) throw new TypeError("maxEntrySize must be a positive integer if specified");
|
|
2665
2669
|
this.#X();
|
|
2666
2670
|
}
|
|
2667
|
-
if (this.allowStale = !!
|
|
2668
|
-
if (!
|
|
2669
|
-
this.#
|
|
2671
|
+
if (this.allowStale = !!a2, this.noDeleteOnStaleGet = !!w, this.updateAgeOnGet = !!r, this.updateAgeOnHas = !!h2, this.ttlResolution = T(s) || s === 0 ? s : 1, this.ttlAutopurge = !!n2, this.ttl = i2 || 0, this.ttl) {
|
|
2672
|
+
if (!T(this.ttl)) throw new TypeError("ttl must be a positive integer if specified");
|
|
2673
|
+
this.#k();
|
|
2670
2674
|
}
|
|
2671
2675
|
if (this.#o === 0 && this.ttl === 0 && this.#c === 0) throw new TypeError("At least one of max, maxSize, or ttl is required");
|
|
2672
2676
|
if (!this.ttlAutopurge && !this.#o && !this.#c) {
|
|
2673
|
-
let
|
|
2674
|
-
q(
|
|
2677
|
+
let R = "LRU_CACHE_UNBOUNDED";
|
|
2678
|
+
q(R) && (k.add(R), V("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.", "UnboundedCacheWarning", R, c3));
|
|
2675
2679
|
}
|
|
2676
2680
|
}
|
|
2677
2681
|
getRemainingTTL(t) {
|
|
2678
2682
|
return this.#s.has(t) ? 1 / 0 : 0;
|
|
2679
2683
|
}
|
|
2680
|
-
#
|
|
2684
|
+
#k() {
|
|
2681
2685
|
let t = new W(this.#o), e = new W(this.#o);
|
|
2682
2686
|
this.#d = t, this.#F = e;
|
|
2683
2687
|
let i2 = this.ttlAutopurge ? Array.from({ length: this.#o }) : void 0;
|
|
2684
|
-
this.#g = i2, this.#
|
|
2685
|
-
e[
|
|
2686
|
-
}, this.#R = (
|
|
2687
|
-
e[
|
|
2688
|
+
this.#g = i2, this.#H = (h2, a2, o2 = this.#w.now()) => {
|
|
2689
|
+
e[h2] = a2 !== 0 ? o2 : 0, t[h2] = a2, s(h2, a2);
|
|
2690
|
+
}, this.#R = (h2) => {
|
|
2691
|
+
e[h2] = t[h2] !== 0 ? this.#w.now() : 0, s(h2, t[h2]);
|
|
2688
2692
|
};
|
|
2689
|
-
let s = this.ttlAutopurge ? (
|
|
2690
|
-
if (i2?.[
|
|
2691
|
-
let
|
|
2692
|
-
this.#p(
|
|
2693
|
-
},
|
|
2694
|
-
|
|
2693
|
+
let s = this.ttlAutopurge ? (h2, a2) => {
|
|
2694
|
+
if (i2?.[h2] && (clearTimeout(i2[h2]), i2[h2] = void 0), a2 && a2 !== 0 && i2) {
|
|
2695
|
+
let o2 = setTimeout(() => {
|
|
2696
|
+
this.#p(h2) && this.#v(this.#i[h2], "expire");
|
|
2697
|
+
}, a2 + 1);
|
|
2698
|
+
o2.unref && o2.unref(), i2[h2] = o2;
|
|
2695
2699
|
}
|
|
2696
2700
|
} : () => {
|
|
2697
2701
|
};
|
|
2698
|
-
this.#E = (
|
|
2699
|
-
if (t[
|
|
2700
|
-
let
|
|
2701
|
-
if (!
|
|
2702
|
-
|
|
2703
|
-
let
|
|
2704
|
-
|
|
2702
|
+
this.#E = (h2, a2) => {
|
|
2703
|
+
if (t[a2]) {
|
|
2704
|
+
let o2 = t[a2], d = e[a2];
|
|
2705
|
+
if (!o2 || !d) return;
|
|
2706
|
+
h2.ttl = o2, h2.start = d, h2.now = n2 || r();
|
|
2707
|
+
let _ = h2.now - d;
|
|
2708
|
+
h2.remainingTTL = o2 - _;
|
|
2705
2709
|
}
|
|
2706
2710
|
};
|
|
2707
|
-
let n2 = 0,
|
|
2708
|
-
let
|
|
2711
|
+
let n2 = 0, r = () => {
|
|
2712
|
+
let h2 = this.#w.now();
|
|
2709
2713
|
if (this.ttlResolution > 0) {
|
|
2710
|
-
n2 =
|
|
2711
|
-
let
|
|
2712
|
-
|
|
2714
|
+
n2 = h2;
|
|
2715
|
+
let a2 = setTimeout(() => n2 = 0, this.ttlResolution);
|
|
2716
|
+
a2.unref && a2.unref();
|
|
2713
2717
|
}
|
|
2714
|
-
return
|
|
2718
|
+
return h2;
|
|
2715
2719
|
};
|
|
2716
|
-
this.getRemainingTTL = (
|
|
2717
|
-
let
|
|
2718
|
-
if (
|
|
2719
|
-
let
|
|
2720
|
-
if (!
|
|
2721
|
-
let
|
|
2722
|
-
return
|
|
2723
|
-
}, this.#p = (
|
|
2724
|
-
let
|
|
2725
|
-
return !!
|
|
2720
|
+
this.getRemainingTTL = (h2) => {
|
|
2721
|
+
let a2 = this.#s.get(h2);
|
|
2722
|
+
if (a2 === void 0) return 0;
|
|
2723
|
+
let o2 = t[a2], d = e[a2];
|
|
2724
|
+
if (!o2 || !d) return 1 / 0;
|
|
2725
|
+
let _ = (n2 || r()) - d;
|
|
2726
|
+
return o2 - _;
|
|
2727
|
+
}, this.#p = (h2) => {
|
|
2728
|
+
let a2 = e[h2], o2 = t[h2];
|
|
2729
|
+
return !!o2 && !!a2 && (n2 || r()) - a2 > o2;
|
|
2726
2730
|
};
|
|
2727
2731
|
}
|
|
2728
2732
|
#R = () => {
|
|
2729
2733
|
};
|
|
2730
2734
|
#E = () => {
|
|
2731
2735
|
};
|
|
2732
|
-
#
|
|
2736
|
+
#H = () => {
|
|
2733
2737
|
};
|
|
2734
2738
|
#p = () => false;
|
|
2735
2739
|
#X() {
|
|
2736
2740
|
let t = new W(this.#o);
|
|
2737
2741
|
this.#b = 0, this.#y = t, this.#C = (e) => {
|
|
2738
2742
|
this.#b -= t[e], t[e] = 0;
|
|
2739
|
-
}, this.#
|
|
2740
|
-
if (
|
|
2741
|
-
|
|
2742
|
-
if (
|
|
2743
|
-
|
|
2744
|
-
|
|
2743
|
+
}, this.#N = (e, i2, s, n2) => {
|
|
2744
|
+
if (!T(s)) {
|
|
2745
|
+
if (this.#e(i2)) return this.backgroundFetchSize;
|
|
2746
|
+
if (n2) {
|
|
2747
|
+
if (typeof n2 != "function") throw new TypeError("sizeCalculation must be a function");
|
|
2748
|
+
if (s = n2(i2, e), !T(s)) throw new TypeError("sizeCalculation return invalid (expect positive integer)");
|
|
2749
|
+
} else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");
|
|
2750
|
+
}
|
|
2745
2751
|
return s;
|
|
2746
2752
|
}, this.#I = (e, i2, s) => {
|
|
2747
2753
|
if (t[e] = i2, this.#c) {
|
|
@@ -2755,24 +2761,24 @@ var require_index_min = __commonJS({
|
|
|
2755
2761
|
};
|
|
2756
2762
|
#I = (t, e, i2) => {
|
|
2757
2763
|
};
|
|
2758
|
-
#
|
|
2764
|
+
#N = (t, e, i2, s) => {
|
|
2759
2765
|
if (i2 || s) throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");
|
|
2760
2766
|
return 0;
|
|
2761
2767
|
};
|
|
2762
2768
|
*#A({ allowStale: t = this.allowStale } = {}) {
|
|
2763
|
-
if (this.#n) for (let e = this.#h; this.#
|
|
2769
|
+
if (this.#n) for (let e = this.#h; this.#V(e) && ((t || !this.#p(e)) && (yield e), e !== this.#a); ) e = this.#u[e];
|
|
2764
2770
|
}
|
|
2765
|
-
*#
|
|
2766
|
-
if (this.#n) for (let e = this.#a; this.#
|
|
2771
|
+
*#z({ allowStale: t = this.allowStale } = {}) {
|
|
2772
|
+
if (this.#n) for (let e = this.#a; this.#V(e) && ((t || !this.#p(e)) && (yield e), e !== this.#h); ) e = this.#l[e];
|
|
2767
2773
|
}
|
|
2768
|
-
#
|
|
2774
|
+
#V(t) {
|
|
2769
2775
|
return t !== void 0 && this.#s.get(this.#i[t]) === t;
|
|
2770
2776
|
}
|
|
2771
2777
|
*entries() {
|
|
2772
2778
|
for (let t of this.#A()) this.#t[t] !== void 0 && this.#i[t] !== void 0 && !this.#e(this.#t[t]) && (yield [this.#i[t], this.#t[t]]);
|
|
2773
2779
|
}
|
|
2774
2780
|
*rentries() {
|
|
2775
|
-
for (let t of this.#
|
|
2781
|
+
for (let t of this.#z()) this.#t[t] !== void 0 && this.#i[t] !== void 0 && !this.#e(this.#t[t]) && (yield [this.#i[t], this.#t[t]]);
|
|
2776
2782
|
}
|
|
2777
2783
|
*keys() {
|
|
2778
2784
|
for (let t of this.#A()) {
|
|
@@ -2781,7 +2787,7 @@ var require_index_min = __commonJS({
|
|
|
2781
2787
|
}
|
|
2782
2788
|
}
|
|
2783
2789
|
*rkeys() {
|
|
2784
|
-
for (let t of this.#
|
|
2790
|
+
for (let t of this.#z()) {
|
|
2785
2791
|
let e = this.#i[t];
|
|
2786
2792
|
e !== void 0 && !this.#e(this.#t[t]) && (yield e);
|
|
2787
2793
|
}
|
|
@@ -2790,7 +2796,7 @@ var require_index_min = __commonJS({
|
|
|
2790
2796
|
for (let t of this.#A()) this.#t[t] !== void 0 && !this.#e(this.#t[t]) && (yield this.#t[t]);
|
|
2791
2797
|
}
|
|
2792
2798
|
*rvalues() {
|
|
2793
|
-
for (let t of this.#
|
|
2799
|
+
for (let t of this.#z()) this.#t[t] !== void 0 && !this.#e(this.#t[t]) && (yield this.#t[t]);
|
|
2794
2800
|
}
|
|
2795
2801
|
[Symbol.iterator]() {
|
|
2796
2802
|
return this.entries();
|
|
@@ -2809,14 +2815,14 @@ var require_index_min = __commonJS({
|
|
|
2809
2815
|
}
|
|
2810
2816
|
}
|
|
2811
2817
|
rforEach(t, e = this) {
|
|
2812
|
-
for (let i2 of this.#
|
|
2818
|
+
for (let i2 of this.#z()) {
|
|
2813
2819
|
let s = this.#t[i2], n2 = this.#e(s) ? s.__staleWhileFetching : s;
|
|
2814
2820
|
n2 !== void 0 && t.call(e, n2, this.#i[i2], this);
|
|
2815
2821
|
}
|
|
2816
2822
|
}
|
|
2817
2823
|
purgeStale() {
|
|
2818
2824
|
let t = false;
|
|
2819
|
-
for (let e of this.#
|
|
2825
|
+
for (let e of this.#z({ allowStale: true })) this.#p(e) && (this.#v(this.#i[e], "expire"), t = true);
|
|
2820
2826
|
return t;
|
|
2821
2827
|
}
|
|
2822
2828
|
info(t) {
|
|
@@ -2826,10 +2832,10 @@ var require_index_min = __commonJS({
|
|
|
2826
2832
|
if (s === void 0) return;
|
|
2827
2833
|
let n2 = { value: s };
|
|
2828
2834
|
if (this.#d && this.#F) {
|
|
2829
|
-
let
|
|
2830
|
-
if (
|
|
2831
|
-
let
|
|
2832
|
-
n2.ttl =
|
|
2835
|
+
let r = this.#d[e], h2 = this.#F[e];
|
|
2836
|
+
if (r && h2) {
|
|
2837
|
+
let a2 = r - (this.#w.now() - h2);
|
|
2838
|
+
n2.ttl = a2, n2.start = Date.now();
|
|
2833
2839
|
}
|
|
2834
2840
|
}
|
|
2835
2841
|
return this.#y && (n2.size = this.#y[e]), n2;
|
|
@@ -2839,13 +2845,13 @@ var require_index_min = __commonJS({
|
|
|
2839
2845
|
for (let e of this.#A({ allowStale: true })) {
|
|
2840
2846
|
let i2 = this.#i[e], s = this.#t[e], n2 = this.#e(s) ? s.__staleWhileFetching : s;
|
|
2841
2847
|
if (n2 === void 0 || i2 === void 0) continue;
|
|
2842
|
-
let
|
|
2848
|
+
let r = { value: n2 };
|
|
2843
2849
|
if (this.#d && this.#F) {
|
|
2844
|
-
|
|
2845
|
-
let
|
|
2846
|
-
|
|
2850
|
+
r.ttl = this.#d[e];
|
|
2851
|
+
let h2 = this.#w.now() - this.#F[e];
|
|
2852
|
+
r.start = Math.floor(Date.now() - h2);
|
|
2847
2853
|
}
|
|
2848
|
-
this.#y && (
|
|
2854
|
+
this.#y && (r.size = this.#y[e]), t.unshift([i2, r]);
|
|
2849
2855
|
}
|
|
2850
2856
|
return t;
|
|
2851
2857
|
}
|
|
@@ -2854,46 +2860,44 @@ var require_index_min = __commonJS({
|
|
|
2854
2860
|
for (let [e, i2] of t) {
|
|
2855
2861
|
if (i2.start) {
|
|
2856
2862
|
let s = Date.now() - i2.start;
|
|
2857
|
-
i2.start = this.#
|
|
2863
|
+
i2.start = this.#w.now() - s;
|
|
2858
2864
|
}
|
|
2859
|
-
this.#
|
|
2865
|
+
this.#O(e, i2.value, i2);
|
|
2860
2866
|
}
|
|
2861
2867
|
}
|
|
2862
2868
|
set(t, e, i2 = {}) {
|
|
2863
|
-
let { status: s =
|
|
2864
|
-
i2.status = s, s && (s.op = "set", s.key = t, e !== void 0 && (s.value = e));
|
|
2865
|
-
let n2 = this.#
|
|
2866
|
-
return s &&
|
|
2867
|
-
}
|
|
2868
|
-
#
|
|
2869
|
-
let { ttl:
|
|
2870
|
-
if (e === void 0) return
|
|
2871
|
-
let { noUpdateTTL:
|
|
2872
|
-
|
|
2873
|
-
let
|
|
2874
|
-
if (this.maxEntrySize &&
|
|
2875
|
-
let
|
|
2876
|
-
if (
|
|
2869
|
+
let { status: s = g.metrics.hasSubscribers ? {} : void 0 } = i2;
|
|
2870
|
+
i2.status = s, s && (s.op = "set", s.key = t, e !== void 0 && (s.value = e), s.cache = this);
|
|
2871
|
+
let n2 = this.#O(t, e, i2);
|
|
2872
|
+
return s && g.metrics.hasSubscribers && g.metrics.publish(s), n2;
|
|
2873
|
+
}
|
|
2874
|
+
#O(t, e, i2, s) {
|
|
2875
|
+
let { ttl: n2 = this.ttl, start: r, noDisposeOnSet: h2 = this.noDisposeOnSet, sizeCalculation: a2 = this.sizeCalculation, status: o2 } = i2, d = this.#e(e);
|
|
2876
|
+
if (e === void 0) return o2 && (o2.set = "deleted"), this.delete(t), this;
|
|
2877
|
+
let { noUpdateTTL: _ = this.noUpdateTTL } = i2;
|
|
2878
|
+
o2 && !d && (o2.value = e);
|
|
2879
|
+
let y = this.#N(t, e, i2.size || 0, a2, o2);
|
|
2880
|
+
if (this.maxEntrySize && y > this.maxEntrySize) return this.#v(t, "set"), o2 && (o2.set = "miss", o2.maxEntrySizeExceeded = true), this;
|
|
2881
|
+
let u2 = this.#n === 0 ? void 0 : this.#s.get(t);
|
|
2882
|
+
if (u2 === void 0) u2 = this.#n === 0 ? this.#h : this.#_.length !== 0 ? this.#_.pop() : this.#n === this.#o ? this.#P(false) : this.#n, this.#i[u2] = t, this.#t[u2] = e, this.#s.set(t, u2), this.#l[this.#h] = u2, this.#u[u2] = this.#h, this.#h = u2, this.#n++, this.#I(u2, y, o2), o2 && (o2.set = "add"), _ = false, this.#D && !d && this.#W?.(e, t, "add");
|
|
2877
2883
|
else {
|
|
2878
|
-
this.#L(
|
|
2879
|
-
let p = this.#t[
|
|
2884
|
+
this.#L(u2);
|
|
2885
|
+
let p = this.#t[u2];
|
|
2880
2886
|
if (e !== p) {
|
|
2881
|
-
if (
|
|
2882
|
-
p.__abortController.abort(new Error("replaced"));
|
|
2883
|
-
let { __staleWhileFetching:
|
|
2884
|
-
|
|
2885
|
-
} else
|
|
2886
|
-
if (this.#C(
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
m !== void 0 && (h2.oldValue = m);
|
|
2887
|
+
if (!h2) if (this.#e(p)) {
|
|
2888
|
+
p !== s && p.__abortController.abort(new Error("replaced"));
|
|
2889
|
+
let { __staleWhileFetching: f } = p;
|
|
2890
|
+
f !== void 0 && f !== e && (this.#T && this.#m?.(f, t, "set"), this.#f && this.#r?.push([f, t, "set"]));
|
|
2891
|
+
} else this.#T && this.#m?.(p, t, "set"), this.#f && this.#r?.push([p, t, "set"]);
|
|
2892
|
+
if (this.#C(u2), this.#I(u2, y, o2), this.#t[u2] = e, !d) {
|
|
2893
|
+
let f = p && this.#e(p) ? p.__staleWhileFetching : p, b = f === void 0 ? "add" : e !== f ? "replace" : "update";
|
|
2894
|
+
o2 && (o2.set = b, f !== void 0 && (o2.oldValue = f)), this.#D && this.onInsert?.(e, t, b);
|
|
2890
2895
|
}
|
|
2891
|
-
} else
|
|
2892
|
-
this.#U && this.onInsert?.(e, t, e === p ? "update" : "replace");
|
|
2896
|
+
} else d || (o2 && (o2.set = "update"), this.#D && this.onInsert?.(e, t, "update"));
|
|
2893
2897
|
}
|
|
2894
|
-
if (
|
|
2895
|
-
let p = this.#r,
|
|
2896
|
-
for (;
|
|
2898
|
+
if (n2 !== 0 && !this.#d && this.#k(), this.#d && (_ || this.#H(u2, n2, r), o2 && this.#E(o2, u2)), !h2 && this.#f && this.#r) {
|
|
2899
|
+
let p = this.#r, f;
|
|
2900
|
+
for (; f = p?.shift(); ) this.#S?.(...f);
|
|
2897
2901
|
}
|
|
2898
2902
|
return this;
|
|
2899
2903
|
}
|
|
@@ -2908,25 +2912,27 @@ var require_index_min = __commonJS({
|
|
|
2908
2912
|
} finally {
|
|
2909
2913
|
if (this.#f && this.#r) {
|
|
2910
2914
|
let t = this.#r, e;
|
|
2911
|
-
for (; e = t?.shift(); ) this.#
|
|
2915
|
+
for (; e = t?.shift(); ) this.#S?.(...e);
|
|
2912
2916
|
}
|
|
2913
2917
|
}
|
|
2914
2918
|
}
|
|
2915
2919
|
#P(t) {
|
|
2916
|
-
let e = this.#a, i2 = this.#i[e], s = this.#t[e];
|
|
2917
|
-
|
|
2920
|
+
let e = this.#a, i2 = this.#i[e], s = this.#t[e], n2 = this.#e(s);
|
|
2921
|
+
n2 && s.__abortController.abort(new Error("evicted"));
|
|
2922
|
+
let r = n2 ? s.__staleWhileFetching : s;
|
|
2923
|
+
return (this.#T || this.#f) && r !== void 0 && (this.#T && this.#m?.(r, i2, "evict"), this.#f && this.#r?.push([r, i2, "evict"])), this.#C(e), this.#g?.[e] && (clearTimeout(this.#g[e]), this.#g[e] = void 0), t && (this.#i[e] = void 0, this.#t[e] = void 0, this.#_.push(e)), this.#n === 1 ? (this.#a = this.#h = 0, this.#_.length = 0) : this.#a = this.#l[e], this.#s.delete(i2), this.#n--, e;
|
|
2918
2924
|
}
|
|
2919
2925
|
has(t, e = {}) {
|
|
2920
|
-
let { status: i2 =
|
|
2921
|
-
e.status = i2, i2 && (i2.op = "has", i2.key = t);
|
|
2926
|
+
let { status: i2 = g.metrics.hasSubscribers ? {} : void 0 } = e;
|
|
2927
|
+
e.status = i2, i2 && (i2.op = "has", i2.key = t, i2.cache = this);
|
|
2922
2928
|
let s = this.#Y(t, e);
|
|
2923
|
-
return
|
|
2929
|
+
return g.metrics.hasSubscribers && g.metrics.publish(i2), s;
|
|
2924
2930
|
}
|
|
2925
2931
|
#Y(t, e = {}) {
|
|
2926
2932
|
let { updateAgeOnHas: i2 = this.updateAgeOnHas, status: s } = e, n2 = this.#s.get(t);
|
|
2927
2933
|
if (n2 !== void 0) {
|
|
2928
|
-
let
|
|
2929
|
-
if (this.#e(
|
|
2934
|
+
let r = this.#t[n2];
|
|
2935
|
+
if (this.#e(r) && r.__staleWhileFetching === void 0) return false;
|
|
2930
2936
|
if (this.#p(n2)) s && (s.has = "stale", this.#E(s, n2));
|
|
2931
2937
|
else return i2 && this.#R(n2), s && (s.has = "hit", this.#E(s, n2)), true;
|
|
2932
2938
|
} else s && (s.has = "miss");
|
|
@@ -2934,9 +2940,9 @@ var require_index_min = __commonJS({
|
|
|
2934
2940
|
}
|
|
2935
2941
|
peek(t, e = {}) {
|
|
2936
2942
|
let { status: i2 = C() ? {} : void 0 } = e;
|
|
2937
|
-
i2 && (i2.op = "peek", i2.key = t), e.status = i2;
|
|
2943
|
+
i2 && (i2.op = "peek", i2.key = t, i2.cache = this), e.status = i2;
|
|
2938
2944
|
let s = this.#J(t, e);
|
|
2939
|
-
return
|
|
2945
|
+
return g.metrics.hasSubscribers && g.metrics.publish(i2), s;
|
|
2940
2946
|
}
|
|
2941
2947
|
#J(t, e) {
|
|
2942
2948
|
let { status: i2, allowStale: s = this.allowStale } = e, n2 = this.#s.get(t);
|
|
@@ -2944,107 +2950,107 @@ var require_index_min = __commonJS({
|
|
|
2944
2950
|
i2 && (i2.peek = n2 === void 0 ? "miss" : "stale");
|
|
2945
2951
|
return;
|
|
2946
2952
|
}
|
|
2947
|
-
let
|
|
2948
|
-
return i2 && (
|
|
2953
|
+
let r = this.#t[n2], h2 = this.#e(r) ? r.__staleWhileFetching : r;
|
|
2954
|
+
return i2 && (h2 !== void 0 ? (i2.peek = "hit", i2.value = h2) : i2.peek = "miss"), h2;
|
|
2949
2955
|
}
|
|
2950
2956
|
#G(t, e, i2, s) {
|
|
2951
2957
|
let n2 = e === void 0 ? void 0 : this.#t[e];
|
|
2952
2958
|
if (this.#e(n2)) return n2;
|
|
2953
|
-
let
|
|
2954
|
-
|
|
2955
|
-
let
|
|
2956
|
-
let { aborted: l } =
|
|
2957
|
-
if (i2.status && (l && !
|
|
2958
|
-
let
|
|
2959
|
-
return (
|
|
2960
|
-
}, d = (
|
|
2961
|
-
let { aborted: l } =
|
|
2962
|
-
if (this.#t[e] ===
|
|
2963
|
-
if (
|
|
2964
|
-
},
|
|
2965
|
-
let l = this.#M?.(t, n2,
|
|
2966
|
-
|
|
2967
|
-
(!i2.ignoreFetchAbort || i2.allowStaleOnFetchAbort) && (
|
|
2968
|
-
});
|
|
2959
|
+
let r = new AbortController(), { signal: h2 } = i2;
|
|
2960
|
+
h2?.addEventListener("abort", () => r.abort(h2.reason), { signal: r.signal });
|
|
2961
|
+
let a2 = { signal: r.signal, options: i2, context: s }, o2 = (f, b = false) => {
|
|
2962
|
+
let { aborted: l } = r.signal, S = i2.ignoreFetchAbort && f !== void 0, F = i2.ignoreFetchAbort || !!(i2.allowStaleOnFetchAbort && f !== void 0);
|
|
2963
|
+
if (i2.status && (l && !b ? (i2.status.fetchAborted = true, i2.status.fetchError = r.signal.reason, S && (i2.status.fetchAbortIgnored = true)) : i2.status.fetchResolved = true), l && !S && !b) return _(r.signal.reason, F);
|
|
2964
|
+
let w = u2, m = this.#t[e];
|
|
2965
|
+
return (m === u2 || m === void 0 && S && b) && (f === void 0 ? w.__staleWhileFetching !== void 0 ? this.#t[e] = w.__staleWhileFetching : this.#v(t, "fetch") : (i2.status && (i2.status.fetchUpdated = true), this.#O(t, f, a2.options, w))), f;
|
|
2966
|
+
}, d = (f) => (i2.status && (i2.status.fetchRejected = true, i2.status.fetchError = f), _(f, false)), _ = (f, b) => {
|
|
2967
|
+
let { aborted: l } = r.signal, S = l && i2.allowStaleOnFetchAbort, F = S || i2.allowStaleOnFetchRejection, w = F || i2.noDeleteOnFetchRejection, m = u2;
|
|
2968
|
+
if (this.#t[e] === u2 && (!w || !b && m.__staleWhileFetching === void 0 ? this.#v(t, "fetch") : S || (this.#t[e] = m.__staleWhileFetching)), F) return i2.status && m.__staleWhileFetching !== void 0 && (i2.status.returnedStale = true), m.__staleWhileFetching;
|
|
2969
|
+
if (m.__returned === m) throw f;
|
|
2970
|
+
}, y = (f, b) => {
|
|
2971
|
+
let l = this.#M?.(t, n2, a2);
|
|
2972
|
+
r.signal.addEventListener("abort", () => {
|
|
2973
|
+
(!i2.ignoreFetchAbort || i2.allowStaleOnFetchAbort) && (f(void 0), i2.allowStaleOnFetchAbort && (f = (S) => o2(S, true)));
|
|
2974
|
+
}), l && l instanceof Promise ? l.then((S) => f(S === void 0 ? void 0 : S), b) : l !== void 0 && f(l);
|
|
2969
2975
|
};
|
|
2970
2976
|
i2.status && (i2.status.fetchDispatched = true);
|
|
2971
|
-
let
|
|
2972
|
-
return e === void 0 ? (this.#
|
|
2977
|
+
let u2 = new Promise(y).then(o2, d), p = Object.assign(u2, { __abortController: r, __staleWhileFetching: n2, __returned: void 0 });
|
|
2978
|
+
return e === void 0 ? (this.#O(t, p, { ...a2.options, status: void 0 }), e = this.#s.get(t)) : this.#t[e] = p, p;
|
|
2973
2979
|
}
|
|
2974
2980
|
#e(t) {
|
|
2975
|
-
if (!this.#
|
|
2981
|
+
if (!this.#U) return false;
|
|
2976
2982
|
let e = t;
|
|
2977
2983
|
return !!e && e instanceof Promise && e.hasOwnProperty("__staleWhileFetching") && e.__abortController instanceof AbortController;
|
|
2978
2984
|
}
|
|
2979
2985
|
fetch(t, e = {}) {
|
|
2980
|
-
let i2 =
|
|
2986
|
+
let i2 = g.tracing.hasSubscribers, { status: s = C() ? {} : void 0 } = e;
|
|
2981
2987
|
e.status = s, s && e.context && (s.context = e.context);
|
|
2982
|
-
let n2 = this.#
|
|
2983
|
-
return s && i2 && (s.trace = true,
|
|
2988
|
+
let n2 = this.#q(t, e);
|
|
2989
|
+
return s && i2 && (s.trace = true, g.tracing.tracePromise(() => n2, s).catch(() => {
|
|
2984
2990
|
})), n2;
|
|
2985
2991
|
}
|
|
2986
|
-
async #
|
|
2987
|
-
let { allowStale: i2 = this.allowStale, updateAgeOnGet: s = this.updateAgeOnGet, noDeleteOnStaleGet: n2 = this.noDeleteOnStaleGet, ttl:
|
|
2988
|
-
if (l && (l.op = "fetch", l.key = t,
|
|
2989
|
-
let
|
|
2990
|
-
if (
|
|
2992
|
+
async #q(t, e = {}) {
|
|
2993
|
+
let { allowStale: i2 = this.allowStale, updateAgeOnGet: s = this.updateAgeOnGet, noDeleteOnStaleGet: n2 = this.noDeleteOnStaleGet, ttl: r = this.ttl, noDisposeOnSet: h2 = this.noDisposeOnSet, size: a2 = 0, sizeCalculation: o2 = this.sizeCalculation, noUpdateTTL: d = this.noUpdateTTL, noDeleteOnFetchRejection: _ = this.noDeleteOnFetchRejection, allowStaleOnFetchRejection: y = this.allowStaleOnFetchRejection, ignoreFetchAbort: u2 = this.ignoreFetchAbort, allowStaleOnFetchAbort: p = this.allowStaleOnFetchAbort, context: f, forceRefresh: b = false, status: l, signal: S } = e;
|
|
2994
|
+
if (l && (l.op = "fetch", l.key = t, b && (l.forceRefresh = true), l.cache = this), !this.#U) return l && (l.fetch = "get"), this.#x(t, { allowStale: i2, updateAgeOnGet: s, noDeleteOnStaleGet: n2, status: l });
|
|
2995
|
+
let F = { allowStale: i2, updateAgeOnGet: s, noDeleteOnStaleGet: n2, ttl: r, noDisposeOnSet: h2, size: a2, sizeCalculation: o2, noUpdateTTL: d, noDeleteOnFetchRejection: _, allowStaleOnFetchRejection: y, allowStaleOnFetchAbort: p, ignoreFetchAbort: u2, status: l, signal: S }, w = this.#s.get(t);
|
|
2996
|
+
if (w === void 0) {
|
|
2991
2997
|
l && (l.fetch = "miss");
|
|
2992
|
-
let
|
|
2993
|
-
return
|
|
2998
|
+
let m = this.#G(t, w, F, f);
|
|
2999
|
+
return m.__returned = m;
|
|
2994
3000
|
} else {
|
|
2995
|
-
let
|
|
2996
|
-
if (this.#e(
|
|
2997
|
-
let E = i2 &&
|
|
2998
|
-
return l && (l.fetch = "inflight", E && (l.returnedStale = true)), E ?
|
|
3001
|
+
let m = this.#t[w];
|
|
3002
|
+
if (this.#e(m)) {
|
|
3003
|
+
let E = i2 && m.__staleWhileFetching !== void 0;
|
|
3004
|
+
return l && (l.fetch = "inflight", E && (l.returnedStale = true)), E ? m.__staleWhileFetching : m.__returned = m;
|
|
2999
3005
|
}
|
|
3000
|
-
let A = this.#p(
|
|
3001
|
-
if (!
|
|
3002
|
-
let
|
|
3003
|
-
return l && (l.fetch = A ? "stale" : "refresh",
|
|
3006
|
+
let A = this.#p(w);
|
|
3007
|
+
if (!b && !A) return l && (l.fetch = "hit"), this.#L(w), s && this.#R(w), l && this.#E(l, w), m;
|
|
3008
|
+
let z = this.#G(t, w, F, f), v = z.__staleWhileFetching !== void 0 && i2;
|
|
3009
|
+
return l && (l.fetch = A ? "stale" : "refresh", v && A && (l.returnedStale = true)), v ? z.__staleWhileFetching : z.__returned = z;
|
|
3004
3010
|
}
|
|
3005
3011
|
}
|
|
3006
3012
|
forceFetch(t, e = {}) {
|
|
3007
|
-
let i2 =
|
|
3013
|
+
let i2 = g.tracing.hasSubscribers, { status: s = C() ? {} : void 0 } = e;
|
|
3008
3014
|
e.status = s, s && e.context && (s.context = e.context);
|
|
3009
3015
|
let n2 = this.#K(t, e);
|
|
3010
|
-
return s && i2 && (s.trace = true,
|
|
3016
|
+
return s && i2 && (s.trace = true, g.tracing.tracePromise(() => n2, s).catch(() => {
|
|
3011
3017
|
})), n2;
|
|
3012
3018
|
}
|
|
3013
3019
|
async #K(t, e = {}) {
|
|
3014
|
-
let i2 = await this.#
|
|
3020
|
+
let i2 = await this.#q(t, e);
|
|
3015
3021
|
if (i2 === void 0) throw new Error("fetch() returned undefined");
|
|
3016
3022
|
return i2;
|
|
3017
3023
|
}
|
|
3018
3024
|
memo(t, e = {}) {
|
|
3019
|
-
let { status: i2 =
|
|
3020
|
-
e.status = i2, i2 && (i2.op = "memo", i2.key = t, e.context && (i2.context = e.context));
|
|
3025
|
+
let { status: i2 = g.metrics.hasSubscribers ? {} : void 0 } = e;
|
|
3026
|
+
e.status = i2, i2 && (i2.op = "memo", i2.key = t, e.context && (i2.context = e.context), i2.cache = this);
|
|
3021
3027
|
let s = this.#Q(t, e);
|
|
3022
|
-
return i2 && (i2.value = s),
|
|
3028
|
+
return i2 && (i2.value = s), g.metrics.hasSubscribers && g.metrics.publish(i2), s;
|
|
3023
3029
|
}
|
|
3024
3030
|
#Q(t, e = {}) {
|
|
3025
3031
|
let i2 = this.#j;
|
|
3026
3032
|
if (!i2) throw new Error("no memoMethod provided to constructor");
|
|
3027
|
-
let { context: s, status: n2, forceRefresh:
|
|
3028
|
-
n2 &&
|
|
3029
|
-
let
|
|
3030
|
-
if (n2 && (n2.memo =
|
|
3031
|
-
let d = i2(t,
|
|
3032
|
-
return n2 && (n2.value = d), this.#
|
|
3033
|
+
let { context: s, status: n2, forceRefresh: r, ...h2 } = e;
|
|
3034
|
+
n2 && r && (n2.forceRefresh = true);
|
|
3035
|
+
let a2 = this.#x(t, h2), o2 = r || a2 === void 0;
|
|
3036
|
+
if (n2 && (n2.memo = o2 ? "miss" : "hit", o2 || (n2.value = a2)), !o2) return a2;
|
|
3037
|
+
let d = i2(t, a2, { options: h2, context: s });
|
|
3038
|
+
return n2 && (n2.value = d), this.#O(t, d, h2), d;
|
|
3033
3039
|
}
|
|
3034
3040
|
get(t, e = {}) {
|
|
3035
|
-
let { status: i2 =
|
|
3036
|
-
e.status = i2, i2 && (i2.op = "get", i2.key = t);
|
|
3041
|
+
let { status: i2 = g.metrics.hasSubscribers ? {} : void 0 } = e;
|
|
3042
|
+
e.status = i2, i2 && (i2.op = "get", i2.key = t, i2.cache = this);
|
|
3037
3043
|
let s = this.#x(t, e);
|
|
3038
|
-
return i2 && (s !== void 0 && (i2.value = s),
|
|
3044
|
+
return i2 && (s !== void 0 && (i2.value = s), g.metrics.hasSubscribers && g.metrics.publish(i2)), s;
|
|
3039
3045
|
}
|
|
3040
3046
|
#x(t, e = {}) {
|
|
3041
|
-
let { allowStale: i2 = this.allowStale, updateAgeOnGet: s = this.updateAgeOnGet, noDeleteOnStaleGet: n2 = this.noDeleteOnStaleGet, status:
|
|
3042
|
-
if (
|
|
3043
|
-
|
|
3047
|
+
let { allowStale: i2 = this.allowStale, updateAgeOnGet: s = this.updateAgeOnGet, noDeleteOnStaleGet: n2 = this.noDeleteOnStaleGet, status: r } = e, h2 = this.#s.get(t);
|
|
3048
|
+
if (h2 === void 0) {
|
|
3049
|
+
r && (r.get = "miss");
|
|
3044
3050
|
return;
|
|
3045
3051
|
}
|
|
3046
|
-
let
|
|
3047
|
-
return
|
|
3052
|
+
let a2 = this.#t[h2], o2 = this.#e(a2);
|
|
3053
|
+
return r && this.#E(r, h2), this.#p(h2) ? o2 ? (r && (r.get = "stale-fetching"), i2 && a2.__staleWhileFetching !== void 0 ? (r && (r.returnedStale = true), a2.__staleWhileFetching) : void 0) : (n2 || this.#v(t, "expire"), r && (r.get = "stale"), i2 ? (r && (r.returnedStale = true), a2) : void 0) : (r && (r.get = o2 ? "fetching" : "hit"), this.#L(h2), s && this.#R(h2), o2 ? a2.__staleWhileFetching : a2);
|
|
3048
3054
|
}
|
|
3049
3055
|
#B(t, e) {
|
|
3050
3056
|
this.#u[e] = t, this.#l[t] = e;
|
|
@@ -3053,10 +3059,10 @@ var require_index_min = __commonJS({
|
|
|
3053
3059
|
t !== this.#h && (t === this.#a ? this.#a = this.#l[t] : this.#B(this.#u[t], this.#l[t]), this.#B(this.#h, t), this.#h = t);
|
|
3054
3060
|
}
|
|
3055
3061
|
delete(t) {
|
|
3056
|
-
return this.#
|
|
3062
|
+
return this.#v(t, "delete");
|
|
3057
3063
|
}
|
|
3058
|
-
#
|
|
3059
|
-
|
|
3064
|
+
#v(t, e) {
|
|
3065
|
+
g.metrics.hasSubscribers && g.metrics.publish({ op: "delete", delete: e, key: t, cache: this });
|
|
3060
3066
|
let i2 = false;
|
|
3061
3067
|
if (this.#n !== 0) {
|
|
3062
3068
|
let s = this.#s.get(t);
|
|
@@ -3067,17 +3073,17 @@ var require_index_min = __commonJS({
|
|
|
3067
3073
|
if (this.#e(n2) ? n2.__abortController.abort(new Error("deleted")) : (this.#T || this.#f) && (this.#T && this.#m?.(n2, t, e), this.#f && this.#r?.push([n2, t, e])), this.#s.delete(t), this.#i[s] = void 0, this.#t[s] = void 0, s === this.#h) this.#h = this.#u[s];
|
|
3068
3074
|
else if (s === this.#a) this.#a = this.#l[s];
|
|
3069
3075
|
else {
|
|
3070
|
-
let
|
|
3071
|
-
this.#l[
|
|
3072
|
-
let
|
|
3073
|
-
this.#u[
|
|
3076
|
+
let r = this.#u[s];
|
|
3077
|
+
this.#l[r] = this.#l[s];
|
|
3078
|
+
let h2 = this.#l[s];
|
|
3079
|
+
this.#u[h2] = this.#u[s];
|
|
3074
3080
|
}
|
|
3075
3081
|
this.#n--, this.#_.push(s);
|
|
3076
3082
|
}
|
|
3077
3083
|
}
|
|
3078
3084
|
if (this.#f && this.#r?.length) {
|
|
3079
3085
|
let s = this.#r, n2;
|
|
3080
|
-
for (; n2 = s?.shift(); ) this.#
|
|
3086
|
+
for (; n2 = s?.shift(); ) this.#S?.(...n2);
|
|
3081
3087
|
}
|
|
3082
3088
|
return i2;
|
|
3083
3089
|
}
|
|
@@ -3085,7 +3091,7 @@ var require_index_min = __commonJS({
|
|
|
3085
3091
|
return this.#$("delete");
|
|
3086
3092
|
}
|
|
3087
3093
|
#$(t) {
|
|
3088
|
-
for (let e of this.#
|
|
3094
|
+
for (let e of this.#z({ allowStale: true })) {
|
|
3089
3095
|
let i2 = this.#t[e];
|
|
3090
3096
|
if (this.#e(i2)) i2.__abortController.abort(new Error("deleted"));
|
|
3091
3097
|
else {
|
|
@@ -3100,7 +3106,7 @@ var require_index_min = __commonJS({
|
|
|
3100
3106
|
}
|
|
3101
3107
|
if (this.#y && this.#y.fill(0), this.#a = 0, this.#h = 0, this.#_.length = 0, this.#b = 0, this.#n = 0, this.#f && this.#r) {
|
|
3102
3108
|
let e = this.#r, i2;
|
|
3103
|
-
for (; i2 = e?.shift(); ) this.#
|
|
3109
|
+
for (; i2 = e?.shift(); ) this.#S?.(...i2);
|
|
3104
3110
|
}
|
|
3105
3111
|
}
|
|
3106
3112
|
};
|
|
@@ -14027,34 +14033,34 @@ var require_validate_npm_package_license = __commonJS({
|
|
|
14027
14033
|
var require_index_min2 = __commonJS({
|
|
14028
14034
|
"node_modules/hosted-git-info/node_modules/lru-cache/dist/commonjs/node/index.min.js"(exports) {
|
|
14029
14035
|
"use strict";
|
|
14030
|
-
var
|
|
14031
|
-
var
|
|
14036
|
+
var j = (c3, t) => () => (t || c3((t = { exports: {} }).exports, t), t.exports);
|
|
14037
|
+
var I = j((O) => {
|
|
14032
14038
|
"use strict";
|
|
14033
14039
|
Object.defineProperty(O, "__esModule", { value: true });
|
|
14034
14040
|
O.tracing = O.metrics = void 0;
|
|
14035
|
-
var
|
|
14036
|
-
O.metrics = (0,
|
|
14037
|
-
O.tracing = (0,
|
|
14041
|
+
var U = __require("node:diagnostics_channel");
|
|
14042
|
+
O.metrics = (0, U.channel)("lru-cache:metrics");
|
|
14043
|
+
O.tracing = (0, U.tracingChannel)("lru-cache");
|
|
14038
14044
|
});
|
|
14039
|
-
var
|
|
14045
|
+
var P = j((D) => {
|
|
14040
14046
|
"use strict";
|
|
14041
|
-
Object.defineProperty(
|
|
14042
|
-
|
|
14043
|
-
|
|
14047
|
+
Object.defineProperty(D, "__esModule", { value: true });
|
|
14048
|
+
D.defaultPerf = void 0;
|
|
14049
|
+
D.defaultPerf = typeof performance == "object" && performance && typeof performance.now == "function" ? performance : Date;
|
|
14044
14050
|
});
|
|
14045
14051
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14046
14052
|
exports.LRUCache = void 0;
|
|
14047
|
-
var
|
|
14048
|
-
var N =
|
|
14049
|
-
var C = () =>
|
|
14050
|
-
var
|
|
14051
|
-
var
|
|
14052
|
-
var
|
|
14053
|
-
typeof
|
|
14054
|
-
};
|
|
14055
|
-
var q = (c3) => !
|
|
14056
|
-
var
|
|
14057
|
-
var H = (c3) =>
|
|
14053
|
+
var g = I();
|
|
14054
|
+
var N = P();
|
|
14055
|
+
var C = () => g.metrics.hasSubscribers || g.tracing.hasSubscribers;
|
|
14056
|
+
var k = /* @__PURE__ */ new Set();
|
|
14057
|
+
var G = typeof process == "object" && process ? process : {};
|
|
14058
|
+
var V = (c3, t, e, i2) => {
|
|
14059
|
+
typeof G.emitWarning == "function" ? G.emitWarning(c3, t, e, i2) : console.error(`[${e}] ${t}: ${c3}`);
|
|
14060
|
+
};
|
|
14061
|
+
var q = (c3) => !k.has(c3);
|
|
14062
|
+
var T = (c3) => !!c3 && c3 === Math.floor(c3) && c3 > 0 && isFinite(c3);
|
|
14063
|
+
var H = (c3) => T(c3) ? c3 <= Math.pow(2, 8) ? Uint8Array : c3 <= Math.pow(2, 16) ? Uint16Array : c3 <= Math.pow(2, 32) ? Uint32Array : c3 <= Number.MAX_SAFE_INTEGER ? W : null : null;
|
|
14058
14064
|
var W = class extends Array {
|
|
14059
14065
|
constructor(t) {
|
|
14060
14066
|
super(t), this.fill(0);
|
|
@@ -14086,13 +14092,13 @@ var require_index_min2 = __commonJS({
|
|
|
14086
14092
|
#o;
|
|
14087
14093
|
#c;
|
|
14088
14094
|
#m;
|
|
14089
|
-
#
|
|
14090
|
-
#
|
|
14095
|
+
#W;
|
|
14096
|
+
#S;
|
|
14091
14097
|
#M;
|
|
14092
14098
|
#j;
|
|
14093
|
-
#
|
|
14099
|
+
#w;
|
|
14094
14100
|
get perf() {
|
|
14095
|
-
return this.#
|
|
14101
|
+
return this.#w;
|
|
14096
14102
|
}
|
|
14097
14103
|
ttl;
|
|
14098
14104
|
ttlResolution;
|
|
@@ -14109,6 +14115,7 @@ var require_index_min2 = __commonJS({
|
|
|
14109
14115
|
allowStaleOnFetchAbort;
|
|
14110
14116
|
allowStaleOnFetchRejection;
|
|
14111
14117
|
ignoreFetchAbort;
|
|
14118
|
+
backgroundFetchSize;
|
|
14112
14119
|
#n;
|
|
14113
14120
|
#b;
|
|
14114
14121
|
#s;
|
|
@@ -14125,15 +14132,15 @@ var require_index_min2 = __commonJS({
|
|
|
14125
14132
|
#d;
|
|
14126
14133
|
#g;
|
|
14127
14134
|
#T;
|
|
14128
|
-
#O;
|
|
14129
|
-
#f;
|
|
14130
14135
|
#U;
|
|
14136
|
+
#f;
|
|
14137
|
+
#D;
|
|
14131
14138
|
static unsafeExposeInternals(t) {
|
|
14132
14139
|
return { starts: t.#F, ttls: t.#d, autopurgeTimers: t.#g, sizes: t.#y, keyMap: t.#s, keyList: t.#i, valList: t.#t, next: t.#l, prev: t.#u, get head() {
|
|
14133
14140
|
return t.#a;
|
|
14134
14141
|
}, get tail() {
|
|
14135
14142
|
return t.#h;
|
|
14136
|
-
}, free: t.#_, isBackgroundFetch: (e) => t.#e(e), backgroundFetch: (e, i2, s, n2) => t.#G(e, i2, s, n2), moveToTail: (e) => t.#L(e), indexes: (e) => t.#A(e), rindexes: (e) => t.#
|
|
14143
|
+
}, free: t.#_, isBackgroundFetch: (e) => t.#e(e), backgroundFetch: (e, i2, s, n2) => t.#G(e, i2, s, n2), moveToTail: (e) => t.#L(e), indexes: (e) => t.#A(e), rindexes: (e) => t.#z(e), isStale: (e) => t.#p(e) };
|
|
14137
14144
|
}
|
|
14138
14145
|
get max() {
|
|
14139
14146
|
return this.#o;
|
|
@@ -14157,106 +14164,108 @@ var require_index_min2 = __commonJS({
|
|
|
14157
14164
|
return this.#m;
|
|
14158
14165
|
}
|
|
14159
14166
|
get onInsert() {
|
|
14160
|
-
return this.#
|
|
14167
|
+
return this.#W;
|
|
14161
14168
|
}
|
|
14162
14169
|
get disposeAfter() {
|
|
14163
|
-
return this.#
|
|
14170
|
+
return this.#S;
|
|
14164
14171
|
}
|
|
14165
14172
|
constructor(t) {
|
|
14166
|
-
let { max: e = 0, ttl: i2, ttlResolution: s = 1, ttlAutopurge: n2, updateAgeOnGet:
|
|
14167
|
-
if (
|
|
14168
|
-
if (this.#
|
|
14169
|
-
let
|
|
14170
|
-
if (!
|
|
14171
|
-
if (this.#o = e, this.#c =
|
|
14173
|
+
let { max: e = 0, ttl: i2, ttlResolution: s = 1, ttlAutopurge: n2, updateAgeOnGet: r, updateAgeOnHas: h2, allowStale: a2, dispose: o2, onInsert: d, disposeAfter: _, noDisposeOnSet: y, noUpdateTTL: u2, maxSize: p = 0, maxEntrySize: f = 0, sizeCalculation: b, fetchMethod: l, memoMethod: S, noDeleteOnFetchRejection: F, noDeleteOnStaleGet: w, allowStaleOnFetchRejection: m, allowStaleOnFetchAbort: A, ignoreFetchAbort: z, backgroundFetchSize: M = 1, perf: v } = t;
|
|
14174
|
+
if (this.backgroundFetchSize = M, v !== void 0 && typeof v?.now != "function") throw new TypeError("perf option must have a now() method if specified");
|
|
14175
|
+
if (this.#w = v ?? N.defaultPerf, e !== 0 && !T(e)) throw new TypeError("max option must be a nonnegative integer");
|
|
14176
|
+
let E = e ? H(e) : Array;
|
|
14177
|
+
if (!E) throw new Error("invalid max value: " + e);
|
|
14178
|
+
if (this.#o = e, this.#c = p, this.maxEntrySize = f || this.#c, this.sizeCalculation = b, this.sizeCalculation) {
|
|
14172
14179
|
if (!this.#c && !this.maxEntrySize) throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");
|
|
14173
14180
|
if (typeof this.sizeCalculation != "function") throw new TypeError("sizeCalculation set to non-function");
|
|
14174
14181
|
}
|
|
14175
14182
|
if (S !== void 0 && typeof S != "function") throw new TypeError("memoMethod must be a function if defined");
|
|
14176
14183
|
if (this.#j = S, l !== void 0 && typeof l != "function") throw new TypeError("fetchMethod must be a function if specified");
|
|
14177
|
-
if (this.#M = l, this.#
|
|
14178
|
-
if (this.#c !== 0 && !
|
|
14179
|
-
if (!
|
|
14184
|
+
if (this.#M = l, this.#U = !!l, this.#s = /* @__PURE__ */ new Map(), this.#i = Array.from({ length: e }).fill(void 0), this.#t = Array.from({ length: e }).fill(void 0), this.#l = new E(e), this.#u = new E(e), this.#a = 0, this.#h = 0, this.#_ = x.create(e), this.#n = 0, this.#b = 0, typeof o2 == "function" && (this.#m = o2), typeof d == "function" && (this.#W = d), typeof _ == "function" ? (this.#S = _, this.#r = []) : (this.#S = void 0, this.#r = void 0), this.#T = !!this.#m, this.#D = !!this.#W, this.#f = !!this.#S, this.noDisposeOnSet = !!y, this.noUpdateTTL = !!u2, this.noDeleteOnFetchRejection = !!F, this.allowStaleOnFetchRejection = !!m, this.allowStaleOnFetchAbort = !!A, this.ignoreFetchAbort = !!z, this.maxEntrySize !== 0) {
|
|
14185
|
+
if (this.#c !== 0 && !T(this.#c)) throw new TypeError("maxSize must be a positive integer if specified");
|
|
14186
|
+
if (!T(this.maxEntrySize)) throw new TypeError("maxEntrySize must be a positive integer if specified");
|
|
14180
14187
|
this.#X();
|
|
14181
14188
|
}
|
|
14182
|
-
if (this.allowStale = !!
|
|
14183
|
-
if (!
|
|
14184
|
-
this.#
|
|
14189
|
+
if (this.allowStale = !!a2, this.noDeleteOnStaleGet = !!w, this.updateAgeOnGet = !!r, this.updateAgeOnHas = !!h2, this.ttlResolution = T(s) || s === 0 ? s : 1, this.ttlAutopurge = !!n2, this.ttl = i2 || 0, this.ttl) {
|
|
14190
|
+
if (!T(this.ttl)) throw new TypeError("ttl must be a positive integer if specified");
|
|
14191
|
+
this.#k();
|
|
14185
14192
|
}
|
|
14186
14193
|
if (this.#o === 0 && this.ttl === 0 && this.#c === 0) throw new TypeError("At least one of max, maxSize, or ttl is required");
|
|
14187
14194
|
if (!this.ttlAutopurge && !this.#o && !this.#c) {
|
|
14188
|
-
let
|
|
14189
|
-
q(
|
|
14195
|
+
let R = "LRU_CACHE_UNBOUNDED";
|
|
14196
|
+
q(R) && (k.add(R), V("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.", "UnboundedCacheWarning", R, c3));
|
|
14190
14197
|
}
|
|
14191
14198
|
}
|
|
14192
14199
|
getRemainingTTL(t) {
|
|
14193
14200
|
return this.#s.has(t) ? 1 / 0 : 0;
|
|
14194
14201
|
}
|
|
14195
|
-
#
|
|
14202
|
+
#k() {
|
|
14196
14203
|
let t = new W(this.#o), e = new W(this.#o);
|
|
14197
14204
|
this.#d = t, this.#F = e;
|
|
14198
14205
|
let i2 = this.ttlAutopurge ? Array.from({ length: this.#o }) : void 0;
|
|
14199
|
-
this.#g = i2, this.#
|
|
14200
|
-
e[
|
|
14201
|
-
}, this.#R = (
|
|
14202
|
-
e[
|
|
14206
|
+
this.#g = i2, this.#H = (h2, a2, o2 = this.#w.now()) => {
|
|
14207
|
+
e[h2] = a2 !== 0 ? o2 : 0, t[h2] = a2, s(h2, a2);
|
|
14208
|
+
}, this.#R = (h2) => {
|
|
14209
|
+
e[h2] = t[h2] !== 0 ? this.#w.now() : 0, s(h2, t[h2]);
|
|
14203
14210
|
};
|
|
14204
|
-
let s = this.ttlAutopurge ? (
|
|
14205
|
-
if (i2?.[
|
|
14206
|
-
let
|
|
14207
|
-
this.#p(
|
|
14208
|
-
},
|
|
14209
|
-
|
|
14211
|
+
let s = this.ttlAutopurge ? (h2, a2) => {
|
|
14212
|
+
if (i2?.[h2] && (clearTimeout(i2[h2]), i2[h2] = void 0), a2 && a2 !== 0 && i2) {
|
|
14213
|
+
let o2 = setTimeout(() => {
|
|
14214
|
+
this.#p(h2) && this.#v(this.#i[h2], "expire");
|
|
14215
|
+
}, a2 + 1);
|
|
14216
|
+
o2.unref && o2.unref(), i2[h2] = o2;
|
|
14210
14217
|
}
|
|
14211
14218
|
} : () => {
|
|
14212
14219
|
};
|
|
14213
|
-
this.#E = (
|
|
14214
|
-
if (t[
|
|
14215
|
-
let
|
|
14216
|
-
if (!
|
|
14217
|
-
|
|
14218
|
-
let
|
|
14219
|
-
|
|
14220
|
+
this.#E = (h2, a2) => {
|
|
14221
|
+
if (t[a2]) {
|
|
14222
|
+
let o2 = t[a2], d = e[a2];
|
|
14223
|
+
if (!o2 || !d) return;
|
|
14224
|
+
h2.ttl = o2, h2.start = d, h2.now = n2 || r();
|
|
14225
|
+
let _ = h2.now - d;
|
|
14226
|
+
h2.remainingTTL = o2 - _;
|
|
14220
14227
|
}
|
|
14221
14228
|
};
|
|
14222
|
-
let n2 = 0,
|
|
14223
|
-
let
|
|
14229
|
+
let n2 = 0, r = () => {
|
|
14230
|
+
let h2 = this.#w.now();
|
|
14224
14231
|
if (this.ttlResolution > 0) {
|
|
14225
|
-
n2 =
|
|
14226
|
-
let
|
|
14227
|
-
|
|
14232
|
+
n2 = h2;
|
|
14233
|
+
let a2 = setTimeout(() => n2 = 0, this.ttlResolution);
|
|
14234
|
+
a2.unref && a2.unref();
|
|
14228
14235
|
}
|
|
14229
|
-
return
|
|
14236
|
+
return h2;
|
|
14230
14237
|
};
|
|
14231
|
-
this.getRemainingTTL = (
|
|
14232
|
-
let
|
|
14233
|
-
if (
|
|
14234
|
-
let
|
|
14235
|
-
if (!
|
|
14236
|
-
let
|
|
14237
|
-
return
|
|
14238
|
-
}, this.#p = (
|
|
14239
|
-
let
|
|
14240
|
-
return !!
|
|
14238
|
+
this.getRemainingTTL = (h2) => {
|
|
14239
|
+
let a2 = this.#s.get(h2);
|
|
14240
|
+
if (a2 === void 0) return 0;
|
|
14241
|
+
let o2 = t[a2], d = e[a2];
|
|
14242
|
+
if (!o2 || !d) return 1 / 0;
|
|
14243
|
+
let _ = (n2 || r()) - d;
|
|
14244
|
+
return o2 - _;
|
|
14245
|
+
}, this.#p = (h2) => {
|
|
14246
|
+
let a2 = e[h2], o2 = t[h2];
|
|
14247
|
+
return !!o2 && !!a2 && (n2 || r()) - a2 > o2;
|
|
14241
14248
|
};
|
|
14242
14249
|
}
|
|
14243
14250
|
#R = () => {
|
|
14244
14251
|
};
|
|
14245
14252
|
#E = () => {
|
|
14246
14253
|
};
|
|
14247
|
-
#
|
|
14254
|
+
#H = () => {
|
|
14248
14255
|
};
|
|
14249
14256
|
#p = () => false;
|
|
14250
14257
|
#X() {
|
|
14251
14258
|
let t = new W(this.#o);
|
|
14252
14259
|
this.#b = 0, this.#y = t, this.#C = (e) => {
|
|
14253
14260
|
this.#b -= t[e], t[e] = 0;
|
|
14254
|
-
}, this.#
|
|
14255
|
-
if (
|
|
14256
|
-
|
|
14257
|
-
if (
|
|
14258
|
-
|
|
14259
|
-
|
|
14261
|
+
}, this.#N = (e, i2, s, n2) => {
|
|
14262
|
+
if (!T(s)) {
|
|
14263
|
+
if (this.#e(i2)) return this.backgroundFetchSize;
|
|
14264
|
+
if (n2) {
|
|
14265
|
+
if (typeof n2 != "function") throw new TypeError("sizeCalculation must be a function");
|
|
14266
|
+
if (s = n2(i2, e), !T(s)) throw new TypeError("sizeCalculation return invalid (expect positive integer)");
|
|
14267
|
+
} else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");
|
|
14268
|
+
}
|
|
14260
14269
|
return s;
|
|
14261
14270
|
}, this.#I = (e, i2, s) => {
|
|
14262
14271
|
if (t[e] = i2, this.#c) {
|
|
@@ -14270,24 +14279,24 @@ var require_index_min2 = __commonJS({
|
|
|
14270
14279
|
};
|
|
14271
14280
|
#I = (t, e, i2) => {
|
|
14272
14281
|
};
|
|
14273
|
-
#
|
|
14282
|
+
#N = (t, e, i2, s) => {
|
|
14274
14283
|
if (i2 || s) throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");
|
|
14275
14284
|
return 0;
|
|
14276
14285
|
};
|
|
14277
14286
|
*#A({ allowStale: t = this.allowStale } = {}) {
|
|
14278
|
-
if (this.#n) for (let e = this.#h; this.#
|
|
14287
|
+
if (this.#n) for (let e = this.#h; this.#V(e) && ((t || !this.#p(e)) && (yield e), e !== this.#a); ) e = this.#u[e];
|
|
14279
14288
|
}
|
|
14280
|
-
*#
|
|
14281
|
-
if (this.#n) for (let e = this.#a; this.#
|
|
14289
|
+
*#z({ allowStale: t = this.allowStale } = {}) {
|
|
14290
|
+
if (this.#n) for (let e = this.#a; this.#V(e) && ((t || !this.#p(e)) && (yield e), e !== this.#h); ) e = this.#l[e];
|
|
14282
14291
|
}
|
|
14283
|
-
#
|
|
14292
|
+
#V(t) {
|
|
14284
14293
|
return t !== void 0 && this.#s.get(this.#i[t]) === t;
|
|
14285
14294
|
}
|
|
14286
14295
|
*entries() {
|
|
14287
14296
|
for (let t of this.#A()) this.#t[t] !== void 0 && this.#i[t] !== void 0 && !this.#e(this.#t[t]) && (yield [this.#i[t], this.#t[t]]);
|
|
14288
14297
|
}
|
|
14289
14298
|
*rentries() {
|
|
14290
|
-
for (let t of this.#
|
|
14299
|
+
for (let t of this.#z()) this.#t[t] !== void 0 && this.#i[t] !== void 0 && !this.#e(this.#t[t]) && (yield [this.#i[t], this.#t[t]]);
|
|
14291
14300
|
}
|
|
14292
14301
|
*keys() {
|
|
14293
14302
|
for (let t of this.#A()) {
|
|
@@ -14296,7 +14305,7 @@ var require_index_min2 = __commonJS({
|
|
|
14296
14305
|
}
|
|
14297
14306
|
}
|
|
14298
14307
|
*rkeys() {
|
|
14299
|
-
for (let t of this.#
|
|
14308
|
+
for (let t of this.#z()) {
|
|
14300
14309
|
let e = this.#i[t];
|
|
14301
14310
|
e !== void 0 && !this.#e(this.#t[t]) && (yield e);
|
|
14302
14311
|
}
|
|
@@ -14305,7 +14314,7 @@ var require_index_min2 = __commonJS({
|
|
|
14305
14314
|
for (let t of this.#A()) this.#t[t] !== void 0 && !this.#e(this.#t[t]) && (yield this.#t[t]);
|
|
14306
14315
|
}
|
|
14307
14316
|
*rvalues() {
|
|
14308
|
-
for (let t of this.#
|
|
14317
|
+
for (let t of this.#z()) this.#t[t] !== void 0 && !this.#e(this.#t[t]) && (yield this.#t[t]);
|
|
14309
14318
|
}
|
|
14310
14319
|
[Symbol.iterator]() {
|
|
14311
14320
|
return this.entries();
|
|
@@ -14324,14 +14333,14 @@ var require_index_min2 = __commonJS({
|
|
|
14324
14333
|
}
|
|
14325
14334
|
}
|
|
14326
14335
|
rforEach(t, e = this) {
|
|
14327
|
-
for (let i2 of this.#
|
|
14336
|
+
for (let i2 of this.#z()) {
|
|
14328
14337
|
let s = this.#t[i2], n2 = this.#e(s) ? s.__staleWhileFetching : s;
|
|
14329
14338
|
n2 !== void 0 && t.call(e, n2, this.#i[i2], this);
|
|
14330
14339
|
}
|
|
14331
14340
|
}
|
|
14332
14341
|
purgeStale() {
|
|
14333
14342
|
let t = false;
|
|
14334
|
-
for (let e of this.#
|
|
14343
|
+
for (let e of this.#z({ allowStale: true })) this.#p(e) && (this.#v(this.#i[e], "expire"), t = true);
|
|
14335
14344
|
return t;
|
|
14336
14345
|
}
|
|
14337
14346
|
info(t) {
|
|
@@ -14341,10 +14350,10 @@ var require_index_min2 = __commonJS({
|
|
|
14341
14350
|
if (s === void 0) return;
|
|
14342
14351
|
let n2 = { value: s };
|
|
14343
14352
|
if (this.#d && this.#F) {
|
|
14344
|
-
let
|
|
14345
|
-
if (
|
|
14346
|
-
let
|
|
14347
|
-
n2.ttl =
|
|
14353
|
+
let r = this.#d[e], h2 = this.#F[e];
|
|
14354
|
+
if (r && h2) {
|
|
14355
|
+
let a2 = r - (this.#w.now() - h2);
|
|
14356
|
+
n2.ttl = a2, n2.start = Date.now();
|
|
14348
14357
|
}
|
|
14349
14358
|
}
|
|
14350
14359
|
return this.#y && (n2.size = this.#y[e]), n2;
|
|
@@ -14354,13 +14363,13 @@ var require_index_min2 = __commonJS({
|
|
|
14354
14363
|
for (let e of this.#A({ allowStale: true })) {
|
|
14355
14364
|
let i2 = this.#i[e], s = this.#t[e], n2 = this.#e(s) ? s.__staleWhileFetching : s;
|
|
14356
14365
|
if (n2 === void 0 || i2 === void 0) continue;
|
|
14357
|
-
let
|
|
14366
|
+
let r = { value: n2 };
|
|
14358
14367
|
if (this.#d && this.#F) {
|
|
14359
|
-
|
|
14360
|
-
let
|
|
14361
|
-
|
|
14368
|
+
r.ttl = this.#d[e];
|
|
14369
|
+
let h2 = this.#w.now() - this.#F[e];
|
|
14370
|
+
r.start = Math.floor(Date.now() - h2);
|
|
14362
14371
|
}
|
|
14363
|
-
this.#y && (
|
|
14372
|
+
this.#y && (r.size = this.#y[e]), t.unshift([i2, r]);
|
|
14364
14373
|
}
|
|
14365
14374
|
return t;
|
|
14366
14375
|
}
|
|
@@ -14369,46 +14378,44 @@ var require_index_min2 = __commonJS({
|
|
|
14369
14378
|
for (let [e, i2] of t) {
|
|
14370
14379
|
if (i2.start) {
|
|
14371
14380
|
let s = Date.now() - i2.start;
|
|
14372
|
-
i2.start = this.#
|
|
14381
|
+
i2.start = this.#w.now() - s;
|
|
14373
14382
|
}
|
|
14374
|
-
this.#
|
|
14383
|
+
this.#O(e, i2.value, i2);
|
|
14375
14384
|
}
|
|
14376
14385
|
}
|
|
14377
14386
|
set(t, e, i2 = {}) {
|
|
14378
|
-
let { status: s =
|
|
14379
|
-
i2.status = s, s && (s.op = "set", s.key = t, e !== void 0 && (s.value = e));
|
|
14380
|
-
let n2 = this.#
|
|
14381
|
-
return s &&
|
|
14382
|
-
}
|
|
14383
|
-
#
|
|
14384
|
-
let { ttl:
|
|
14385
|
-
if (e === void 0) return
|
|
14386
|
-
let { noUpdateTTL:
|
|
14387
|
-
|
|
14388
|
-
let
|
|
14389
|
-
if (this.maxEntrySize &&
|
|
14390
|
-
let
|
|
14391
|
-
if (
|
|
14387
|
+
let { status: s = g.metrics.hasSubscribers ? {} : void 0 } = i2;
|
|
14388
|
+
i2.status = s, s && (s.op = "set", s.key = t, e !== void 0 && (s.value = e), s.cache = this);
|
|
14389
|
+
let n2 = this.#O(t, e, i2);
|
|
14390
|
+
return s && g.metrics.hasSubscribers && g.metrics.publish(s), n2;
|
|
14391
|
+
}
|
|
14392
|
+
#O(t, e, i2, s) {
|
|
14393
|
+
let { ttl: n2 = this.ttl, start: r, noDisposeOnSet: h2 = this.noDisposeOnSet, sizeCalculation: a2 = this.sizeCalculation, status: o2 } = i2, d = this.#e(e);
|
|
14394
|
+
if (e === void 0) return o2 && (o2.set = "deleted"), this.delete(t), this;
|
|
14395
|
+
let { noUpdateTTL: _ = this.noUpdateTTL } = i2;
|
|
14396
|
+
o2 && !d && (o2.value = e);
|
|
14397
|
+
let y = this.#N(t, e, i2.size || 0, a2, o2);
|
|
14398
|
+
if (this.maxEntrySize && y > this.maxEntrySize) return this.#v(t, "set"), o2 && (o2.set = "miss", o2.maxEntrySizeExceeded = true), this;
|
|
14399
|
+
let u2 = this.#n === 0 ? void 0 : this.#s.get(t);
|
|
14400
|
+
if (u2 === void 0) u2 = this.#n === 0 ? this.#h : this.#_.length !== 0 ? this.#_.pop() : this.#n === this.#o ? this.#P(false) : this.#n, this.#i[u2] = t, this.#t[u2] = e, this.#s.set(t, u2), this.#l[this.#h] = u2, this.#u[u2] = this.#h, this.#h = u2, this.#n++, this.#I(u2, y, o2), o2 && (o2.set = "add"), _ = false, this.#D && !d && this.#W?.(e, t, "add");
|
|
14392
14401
|
else {
|
|
14393
|
-
this.#L(
|
|
14394
|
-
let p = this.#t[
|
|
14402
|
+
this.#L(u2);
|
|
14403
|
+
let p = this.#t[u2];
|
|
14395
14404
|
if (e !== p) {
|
|
14396
|
-
if (
|
|
14397
|
-
p.__abortController.abort(new Error("replaced"));
|
|
14398
|
-
let { __staleWhileFetching:
|
|
14399
|
-
|
|
14400
|
-
} else
|
|
14401
|
-
if (this.#C(
|
|
14402
|
-
|
|
14403
|
-
|
|
14404
|
-
m !== void 0 && (h2.oldValue = m);
|
|
14405
|
+
if (!h2) if (this.#e(p)) {
|
|
14406
|
+
p !== s && p.__abortController.abort(new Error("replaced"));
|
|
14407
|
+
let { __staleWhileFetching: f } = p;
|
|
14408
|
+
f !== void 0 && f !== e && (this.#T && this.#m?.(f, t, "set"), this.#f && this.#r?.push([f, t, "set"]));
|
|
14409
|
+
} else this.#T && this.#m?.(p, t, "set"), this.#f && this.#r?.push([p, t, "set"]);
|
|
14410
|
+
if (this.#C(u2), this.#I(u2, y, o2), this.#t[u2] = e, !d) {
|
|
14411
|
+
let f = p && this.#e(p) ? p.__staleWhileFetching : p, b = f === void 0 ? "add" : e !== f ? "replace" : "update";
|
|
14412
|
+
o2 && (o2.set = b, f !== void 0 && (o2.oldValue = f)), this.#D && this.onInsert?.(e, t, b);
|
|
14405
14413
|
}
|
|
14406
|
-
} else
|
|
14407
|
-
this.#U && this.onInsert?.(e, t, e === p ? "update" : "replace");
|
|
14414
|
+
} else d || (o2 && (o2.set = "update"), this.#D && this.onInsert?.(e, t, "update"));
|
|
14408
14415
|
}
|
|
14409
|
-
if (
|
|
14410
|
-
let p = this.#r,
|
|
14411
|
-
for (;
|
|
14416
|
+
if (n2 !== 0 && !this.#d && this.#k(), this.#d && (_ || this.#H(u2, n2, r), o2 && this.#E(o2, u2)), !h2 && this.#f && this.#r) {
|
|
14417
|
+
let p = this.#r, f;
|
|
14418
|
+
for (; f = p?.shift(); ) this.#S?.(...f);
|
|
14412
14419
|
}
|
|
14413
14420
|
return this;
|
|
14414
14421
|
}
|
|
@@ -14423,25 +14430,27 @@ var require_index_min2 = __commonJS({
|
|
|
14423
14430
|
} finally {
|
|
14424
14431
|
if (this.#f && this.#r) {
|
|
14425
14432
|
let t = this.#r, e;
|
|
14426
|
-
for (; e = t?.shift(); ) this.#
|
|
14433
|
+
for (; e = t?.shift(); ) this.#S?.(...e);
|
|
14427
14434
|
}
|
|
14428
14435
|
}
|
|
14429
14436
|
}
|
|
14430
14437
|
#P(t) {
|
|
14431
|
-
let e = this.#a, i2 = this.#i[e], s = this.#t[e];
|
|
14432
|
-
|
|
14438
|
+
let e = this.#a, i2 = this.#i[e], s = this.#t[e], n2 = this.#e(s);
|
|
14439
|
+
n2 && s.__abortController.abort(new Error("evicted"));
|
|
14440
|
+
let r = n2 ? s.__staleWhileFetching : s;
|
|
14441
|
+
return (this.#T || this.#f) && r !== void 0 && (this.#T && this.#m?.(r, i2, "evict"), this.#f && this.#r?.push([r, i2, "evict"])), this.#C(e), this.#g?.[e] && (clearTimeout(this.#g[e]), this.#g[e] = void 0), t && (this.#i[e] = void 0, this.#t[e] = void 0, this.#_.push(e)), this.#n === 1 ? (this.#a = this.#h = 0, this.#_.length = 0) : this.#a = this.#l[e], this.#s.delete(i2), this.#n--, e;
|
|
14433
14442
|
}
|
|
14434
14443
|
has(t, e = {}) {
|
|
14435
|
-
let { status: i2 =
|
|
14436
|
-
e.status = i2, i2 && (i2.op = "has", i2.key = t);
|
|
14444
|
+
let { status: i2 = g.metrics.hasSubscribers ? {} : void 0 } = e;
|
|
14445
|
+
e.status = i2, i2 && (i2.op = "has", i2.key = t, i2.cache = this);
|
|
14437
14446
|
let s = this.#Y(t, e);
|
|
14438
|
-
return
|
|
14447
|
+
return g.metrics.hasSubscribers && g.metrics.publish(i2), s;
|
|
14439
14448
|
}
|
|
14440
14449
|
#Y(t, e = {}) {
|
|
14441
14450
|
let { updateAgeOnHas: i2 = this.updateAgeOnHas, status: s } = e, n2 = this.#s.get(t);
|
|
14442
14451
|
if (n2 !== void 0) {
|
|
14443
|
-
let
|
|
14444
|
-
if (this.#e(
|
|
14452
|
+
let r = this.#t[n2];
|
|
14453
|
+
if (this.#e(r) && r.__staleWhileFetching === void 0) return false;
|
|
14445
14454
|
if (this.#p(n2)) s && (s.has = "stale", this.#E(s, n2));
|
|
14446
14455
|
else return i2 && this.#R(n2), s && (s.has = "hit", this.#E(s, n2)), true;
|
|
14447
14456
|
} else s && (s.has = "miss");
|
|
@@ -14449,9 +14458,9 @@ var require_index_min2 = __commonJS({
|
|
|
14449
14458
|
}
|
|
14450
14459
|
peek(t, e = {}) {
|
|
14451
14460
|
let { status: i2 = C() ? {} : void 0 } = e;
|
|
14452
|
-
i2 && (i2.op = "peek", i2.key = t), e.status = i2;
|
|
14461
|
+
i2 && (i2.op = "peek", i2.key = t, i2.cache = this), e.status = i2;
|
|
14453
14462
|
let s = this.#J(t, e);
|
|
14454
|
-
return
|
|
14463
|
+
return g.metrics.hasSubscribers && g.metrics.publish(i2), s;
|
|
14455
14464
|
}
|
|
14456
14465
|
#J(t, e) {
|
|
14457
14466
|
let { status: i2, allowStale: s = this.allowStale } = e, n2 = this.#s.get(t);
|
|
@@ -14459,107 +14468,107 @@ var require_index_min2 = __commonJS({
|
|
|
14459
14468
|
i2 && (i2.peek = n2 === void 0 ? "miss" : "stale");
|
|
14460
14469
|
return;
|
|
14461
14470
|
}
|
|
14462
|
-
let
|
|
14463
|
-
return i2 && (
|
|
14471
|
+
let r = this.#t[n2], h2 = this.#e(r) ? r.__staleWhileFetching : r;
|
|
14472
|
+
return i2 && (h2 !== void 0 ? (i2.peek = "hit", i2.value = h2) : i2.peek = "miss"), h2;
|
|
14464
14473
|
}
|
|
14465
14474
|
#G(t, e, i2, s) {
|
|
14466
14475
|
let n2 = e === void 0 ? void 0 : this.#t[e];
|
|
14467
14476
|
if (this.#e(n2)) return n2;
|
|
14468
|
-
let
|
|
14469
|
-
|
|
14470
|
-
let
|
|
14471
|
-
let { aborted: l } =
|
|
14472
|
-
if (i2.status && (l && !
|
|
14473
|
-
let
|
|
14474
|
-
return (
|
|
14475
|
-
}, d = (
|
|
14476
|
-
let { aborted: l } =
|
|
14477
|
-
if (this.#t[e] ===
|
|
14478
|
-
if (
|
|
14479
|
-
},
|
|
14480
|
-
let l = this.#M?.(t, n2,
|
|
14481
|
-
|
|
14482
|
-
(!i2.ignoreFetchAbort || i2.allowStaleOnFetchAbort) && (
|
|
14483
|
-
});
|
|
14477
|
+
let r = new AbortController(), { signal: h2 } = i2;
|
|
14478
|
+
h2?.addEventListener("abort", () => r.abort(h2.reason), { signal: r.signal });
|
|
14479
|
+
let a2 = { signal: r.signal, options: i2, context: s }, o2 = (f, b = false) => {
|
|
14480
|
+
let { aborted: l } = r.signal, S = i2.ignoreFetchAbort && f !== void 0, F = i2.ignoreFetchAbort || !!(i2.allowStaleOnFetchAbort && f !== void 0);
|
|
14481
|
+
if (i2.status && (l && !b ? (i2.status.fetchAborted = true, i2.status.fetchError = r.signal.reason, S && (i2.status.fetchAbortIgnored = true)) : i2.status.fetchResolved = true), l && !S && !b) return _(r.signal.reason, F);
|
|
14482
|
+
let w = u2, m = this.#t[e];
|
|
14483
|
+
return (m === u2 || m === void 0 && S && b) && (f === void 0 ? w.__staleWhileFetching !== void 0 ? this.#t[e] = w.__staleWhileFetching : this.#v(t, "fetch") : (i2.status && (i2.status.fetchUpdated = true), this.#O(t, f, a2.options, w))), f;
|
|
14484
|
+
}, d = (f) => (i2.status && (i2.status.fetchRejected = true, i2.status.fetchError = f), _(f, false)), _ = (f, b) => {
|
|
14485
|
+
let { aborted: l } = r.signal, S = l && i2.allowStaleOnFetchAbort, F = S || i2.allowStaleOnFetchRejection, w = F || i2.noDeleteOnFetchRejection, m = u2;
|
|
14486
|
+
if (this.#t[e] === u2 && (!w || !b && m.__staleWhileFetching === void 0 ? this.#v(t, "fetch") : S || (this.#t[e] = m.__staleWhileFetching)), F) return i2.status && m.__staleWhileFetching !== void 0 && (i2.status.returnedStale = true), m.__staleWhileFetching;
|
|
14487
|
+
if (m.__returned === m) throw f;
|
|
14488
|
+
}, y = (f, b) => {
|
|
14489
|
+
let l = this.#M?.(t, n2, a2);
|
|
14490
|
+
r.signal.addEventListener("abort", () => {
|
|
14491
|
+
(!i2.ignoreFetchAbort || i2.allowStaleOnFetchAbort) && (f(void 0), i2.allowStaleOnFetchAbort && (f = (S) => o2(S, true)));
|
|
14492
|
+
}), l && l instanceof Promise ? l.then((S) => f(S === void 0 ? void 0 : S), b) : l !== void 0 && f(l);
|
|
14484
14493
|
};
|
|
14485
14494
|
i2.status && (i2.status.fetchDispatched = true);
|
|
14486
|
-
let
|
|
14487
|
-
return e === void 0 ? (this.#
|
|
14495
|
+
let u2 = new Promise(y).then(o2, d), p = Object.assign(u2, { __abortController: r, __staleWhileFetching: n2, __returned: void 0 });
|
|
14496
|
+
return e === void 0 ? (this.#O(t, p, { ...a2.options, status: void 0 }), e = this.#s.get(t)) : this.#t[e] = p, p;
|
|
14488
14497
|
}
|
|
14489
14498
|
#e(t) {
|
|
14490
|
-
if (!this.#
|
|
14499
|
+
if (!this.#U) return false;
|
|
14491
14500
|
let e = t;
|
|
14492
14501
|
return !!e && e instanceof Promise && e.hasOwnProperty("__staleWhileFetching") && e.__abortController instanceof AbortController;
|
|
14493
14502
|
}
|
|
14494
14503
|
fetch(t, e = {}) {
|
|
14495
|
-
let i2 =
|
|
14504
|
+
let i2 = g.tracing.hasSubscribers, { status: s = C() ? {} : void 0 } = e;
|
|
14496
14505
|
e.status = s, s && e.context && (s.context = e.context);
|
|
14497
|
-
let n2 = this.#
|
|
14498
|
-
return s && i2 && (s.trace = true,
|
|
14506
|
+
let n2 = this.#q(t, e);
|
|
14507
|
+
return s && i2 && (s.trace = true, g.tracing.tracePromise(() => n2, s).catch(() => {
|
|
14499
14508
|
})), n2;
|
|
14500
14509
|
}
|
|
14501
|
-
async #
|
|
14502
|
-
let { allowStale: i2 = this.allowStale, updateAgeOnGet: s = this.updateAgeOnGet, noDeleteOnStaleGet: n2 = this.noDeleteOnStaleGet, ttl:
|
|
14503
|
-
if (l && (l.op = "fetch", l.key = t,
|
|
14504
|
-
let
|
|
14505
|
-
if (
|
|
14510
|
+
async #q(t, e = {}) {
|
|
14511
|
+
let { allowStale: i2 = this.allowStale, updateAgeOnGet: s = this.updateAgeOnGet, noDeleteOnStaleGet: n2 = this.noDeleteOnStaleGet, ttl: r = this.ttl, noDisposeOnSet: h2 = this.noDisposeOnSet, size: a2 = 0, sizeCalculation: o2 = this.sizeCalculation, noUpdateTTL: d = this.noUpdateTTL, noDeleteOnFetchRejection: _ = this.noDeleteOnFetchRejection, allowStaleOnFetchRejection: y = this.allowStaleOnFetchRejection, ignoreFetchAbort: u2 = this.ignoreFetchAbort, allowStaleOnFetchAbort: p = this.allowStaleOnFetchAbort, context: f, forceRefresh: b = false, status: l, signal: S } = e;
|
|
14512
|
+
if (l && (l.op = "fetch", l.key = t, b && (l.forceRefresh = true), l.cache = this), !this.#U) return l && (l.fetch = "get"), this.#x(t, { allowStale: i2, updateAgeOnGet: s, noDeleteOnStaleGet: n2, status: l });
|
|
14513
|
+
let F = { allowStale: i2, updateAgeOnGet: s, noDeleteOnStaleGet: n2, ttl: r, noDisposeOnSet: h2, size: a2, sizeCalculation: o2, noUpdateTTL: d, noDeleteOnFetchRejection: _, allowStaleOnFetchRejection: y, allowStaleOnFetchAbort: p, ignoreFetchAbort: u2, status: l, signal: S }, w = this.#s.get(t);
|
|
14514
|
+
if (w === void 0) {
|
|
14506
14515
|
l && (l.fetch = "miss");
|
|
14507
|
-
let
|
|
14508
|
-
return
|
|
14516
|
+
let m = this.#G(t, w, F, f);
|
|
14517
|
+
return m.__returned = m;
|
|
14509
14518
|
} else {
|
|
14510
|
-
let
|
|
14511
|
-
if (this.#e(
|
|
14512
|
-
let E = i2 &&
|
|
14513
|
-
return l && (l.fetch = "inflight", E && (l.returnedStale = true)), E ?
|
|
14519
|
+
let m = this.#t[w];
|
|
14520
|
+
if (this.#e(m)) {
|
|
14521
|
+
let E = i2 && m.__staleWhileFetching !== void 0;
|
|
14522
|
+
return l && (l.fetch = "inflight", E && (l.returnedStale = true)), E ? m.__staleWhileFetching : m.__returned = m;
|
|
14514
14523
|
}
|
|
14515
|
-
let A = this.#p(
|
|
14516
|
-
if (!
|
|
14517
|
-
let
|
|
14518
|
-
return l && (l.fetch = A ? "stale" : "refresh",
|
|
14524
|
+
let A = this.#p(w);
|
|
14525
|
+
if (!b && !A) return l && (l.fetch = "hit"), this.#L(w), s && this.#R(w), l && this.#E(l, w), m;
|
|
14526
|
+
let z = this.#G(t, w, F, f), v = z.__staleWhileFetching !== void 0 && i2;
|
|
14527
|
+
return l && (l.fetch = A ? "stale" : "refresh", v && A && (l.returnedStale = true)), v ? z.__staleWhileFetching : z.__returned = z;
|
|
14519
14528
|
}
|
|
14520
14529
|
}
|
|
14521
14530
|
forceFetch(t, e = {}) {
|
|
14522
|
-
let i2 =
|
|
14531
|
+
let i2 = g.tracing.hasSubscribers, { status: s = C() ? {} : void 0 } = e;
|
|
14523
14532
|
e.status = s, s && e.context && (s.context = e.context);
|
|
14524
14533
|
let n2 = this.#K(t, e);
|
|
14525
|
-
return s && i2 && (s.trace = true,
|
|
14534
|
+
return s && i2 && (s.trace = true, g.tracing.tracePromise(() => n2, s).catch(() => {
|
|
14526
14535
|
})), n2;
|
|
14527
14536
|
}
|
|
14528
14537
|
async #K(t, e = {}) {
|
|
14529
|
-
let i2 = await this.#
|
|
14538
|
+
let i2 = await this.#q(t, e);
|
|
14530
14539
|
if (i2 === void 0) throw new Error("fetch() returned undefined");
|
|
14531
14540
|
return i2;
|
|
14532
14541
|
}
|
|
14533
14542
|
memo(t, e = {}) {
|
|
14534
|
-
let { status: i2 =
|
|
14535
|
-
e.status = i2, i2 && (i2.op = "memo", i2.key = t, e.context && (i2.context = e.context));
|
|
14543
|
+
let { status: i2 = g.metrics.hasSubscribers ? {} : void 0 } = e;
|
|
14544
|
+
e.status = i2, i2 && (i2.op = "memo", i2.key = t, e.context && (i2.context = e.context), i2.cache = this);
|
|
14536
14545
|
let s = this.#Q(t, e);
|
|
14537
|
-
return i2 && (i2.value = s),
|
|
14546
|
+
return i2 && (i2.value = s), g.metrics.hasSubscribers && g.metrics.publish(i2), s;
|
|
14538
14547
|
}
|
|
14539
14548
|
#Q(t, e = {}) {
|
|
14540
14549
|
let i2 = this.#j;
|
|
14541
14550
|
if (!i2) throw new Error("no memoMethod provided to constructor");
|
|
14542
|
-
let { context: s, status: n2, forceRefresh:
|
|
14543
|
-
n2 &&
|
|
14544
|
-
let
|
|
14545
|
-
if (n2 && (n2.memo =
|
|
14546
|
-
let d = i2(t,
|
|
14547
|
-
return n2 && (n2.value = d), this.#
|
|
14551
|
+
let { context: s, status: n2, forceRefresh: r, ...h2 } = e;
|
|
14552
|
+
n2 && r && (n2.forceRefresh = true);
|
|
14553
|
+
let a2 = this.#x(t, h2), o2 = r || a2 === void 0;
|
|
14554
|
+
if (n2 && (n2.memo = o2 ? "miss" : "hit", o2 || (n2.value = a2)), !o2) return a2;
|
|
14555
|
+
let d = i2(t, a2, { options: h2, context: s });
|
|
14556
|
+
return n2 && (n2.value = d), this.#O(t, d, h2), d;
|
|
14548
14557
|
}
|
|
14549
14558
|
get(t, e = {}) {
|
|
14550
|
-
let { status: i2 =
|
|
14551
|
-
e.status = i2, i2 && (i2.op = "get", i2.key = t);
|
|
14559
|
+
let { status: i2 = g.metrics.hasSubscribers ? {} : void 0 } = e;
|
|
14560
|
+
e.status = i2, i2 && (i2.op = "get", i2.key = t, i2.cache = this);
|
|
14552
14561
|
let s = this.#x(t, e);
|
|
14553
|
-
return i2 && (s !== void 0 && (i2.value = s),
|
|
14562
|
+
return i2 && (s !== void 0 && (i2.value = s), g.metrics.hasSubscribers && g.metrics.publish(i2)), s;
|
|
14554
14563
|
}
|
|
14555
14564
|
#x(t, e = {}) {
|
|
14556
|
-
let { allowStale: i2 = this.allowStale, updateAgeOnGet: s = this.updateAgeOnGet, noDeleteOnStaleGet: n2 = this.noDeleteOnStaleGet, status:
|
|
14557
|
-
if (
|
|
14558
|
-
|
|
14565
|
+
let { allowStale: i2 = this.allowStale, updateAgeOnGet: s = this.updateAgeOnGet, noDeleteOnStaleGet: n2 = this.noDeleteOnStaleGet, status: r } = e, h2 = this.#s.get(t);
|
|
14566
|
+
if (h2 === void 0) {
|
|
14567
|
+
r && (r.get = "miss");
|
|
14559
14568
|
return;
|
|
14560
14569
|
}
|
|
14561
|
-
let
|
|
14562
|
-
return
|
|
14570
|
+
let a2 = this.#t[h2], o2 = this.#e(a2);
|
|
14571
|
+
return r && this.#E(r, h2), this.#p(h2) ? o2 ? (r && (r.get = "stale-fetching"), i2 && a2.__staleWhileFetching !== void 0 ? (r && (r.returnedStale = true), a2.__staleWhileFetching) : void 0) : (n2 || this.#v(t, "expire"), r && (r.get = "stale"), i2 ? (r && (r.returnedStale = true), a2) : void 0) : (r && (r.get = o2 ? "fetching" : "hit"), this.#L(h2), s && this.#R(h2), o2 ? a2.__staleWhileFetching : a2);
|
|
14563
14572
|
}
|
|
14564
14573
|
#B(t, e) {
|
|
14565
14574
|
this.#u[e] = t, this.#l[t] = e;
|
|
@@ -14568,10 +14577,10 @@ var require_index_min2 = __commonJS({
|
|
|
14568
14577
|
t !== this.#h && (t === this.#a ? this.#a = this.#l[t] : this.#B(this.#u[t], this.#l[t]), this.#B(this.#h, t), this.#h = t);
|
|
14569
14578
|
}
|
|
14570
14579
|
delete(t) {
|
|
14571
|
-
return this.#
|
|
14580
|
+
return this.#v(t, "delete");
|
|
14572
14581
|
}
|
|
14573
|
-
#
|
|
14574
|
-
|
|
14582
|
+
#v(t, e) {
|
|
14583
|
+
g.metrics.hasSubscribers && g.metrics.publish({ op: "delete", delete: e, key: t, cache: this });
|
|
14575
14584
|
let i2 = false;
|
|
14576
14585
|
if (this.#n !== 0) {
|
|
14577
14586
|
let s = this.#s.get(t);
|
|
@@ -14582,17 +14591,17 @@ var require_index_min2 = __commonJS({
|
|
|
14582
14591
|
if (this.#e(n2) ? n2.__abortController.abort(new Error("deleted")) : (this.#T || this.#f) && (this.#T && this.#m?.(n2, t, e), this.#f && this.#r?.push([n2, t, e])), this.#s.delete(t), this.#i[s] = void 0, this.#t[s] = void 0, s === this.#h) this.#h = this.#u[s];
|
|
14583
14592
|
else if (s === this.#a) this.#a = this.#l[s];
|
|
14584
14593
|
else {
|
|
14585
|
-
let
|
|
14586
|
-
this.#l[
|
|
14587
|
-
let
|
|
14588
|
-
this.#u[
|
|
14594
|
+
let r = this.#u[s];
|
|
14595
|
+
this.#l[r] = this.#l[s];
|
|
14596
|
+
let h2 = this.#l[s];
|
|
14597
|
+
this.#u[h2] = this.#u[s];
|
|
14589
14598
|
}
|
|
14590
14599
|
this.#n--, this.#_.push(s);
|
|
14591
14600
|
}
|
|
14592
14601
|
}
|
|
14593
14602
|
if (this.#f && this.#r?.length) {
|
|
14594
14603
|
let s = this.#r, n2;
|
|
14595
|
-
for (; n2 = s?.shift(); ) this.#
|
|
14604
|
+
for (; n2 = s?.shift(); ) this.#S?.(...n2);
|
|
14596
14605
|
}
|
|
14597
14606
|
return i2;
|
|
14598
14607
|
}
|
|
@@ -14600,7 +14609,7 @@ var require_index_min2 = __commonJS({
|
|
|
14600
14609
|
return this.#$("delete");
|
|
14601
14610
|
}
|
|
14602
14611
|
#$(t) {
|
|
14603
|
-
for (let e of this.#
|
|
14612
|
+
for (let e of this.#z({ allowStale: true })) {
|
|
14604
14613
|
let i2 = this.#t[e];
|
|
14605
14614
|
if (this.#e(i2)) i2.__abortController.abort(new Error("deleted"));
|
|
14606
14615
|
else {
|
|
@@ -14615,7 +14624,7 @@ var require_index_min2 = __commonJS({
|
|
|
14615
14624
|
}
|
|
14616
14625
|
if (this.#y && this.#y.fill(0), this.#a = 0, this.#h = 0, this.#_.length = 0, this.#b = 0, this.#n = 0, this.#f && this.#r) {
|
|
14617
14626
|
let e = this.#r, i2;
|
|
14618
|
-
for (; i2 = e?.shift(); ) this.#
|
|
14627
|
+
for (; i2 = e?.shift(); ) this.#S?.(...i2);
|
|
14619
14628
|
}
|
|
14620
14629
|
}
|
|
14621
14630
|
};
|