@oliasoft-open-source/node-json-migrator 4.4.0 → 4.4.1-beta-2
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/immer-CjiV9AMA.mjs +1576 -0
- package/dist/immer-ZZLkDBss.cjs +1598 -0
- package/dist/index.cjs +116 -43
- package/dist/index.d.cts +3 -2
- package/dist/index.d.mts +3 -2
- package/dist/index.mjs +116 -43
- package/package.json +31 -33
- package/dist/immer-BsT8CIGL.cjs +0 -678
- package/dist/immer-C8oEWD0M.mjs +0 -669
package/dist/index.cjs
CHANGED
|
@@ -671,7 +671,7 @@ const capitalize = (word) => {
|
|
|
671
671
|
const loadModuleFromString = async (script) => {
|
|
672
672
|
let patchedScript = script;
|
|
673
673
|
try {
|
|
674
|
-
await Promise.resolve().then(function () { return require('./immer-
|
|
674
|
+
await Promise.resolve().then(function () { return require('./immer-ZZLkDBss.cjs'); }).then(({ produce }) => {
|
|
675
675
|
if (produce) {
|
|
676
676
|
patchedScript = script.replace(
|
|
677
677
|
/import\s+produce\s+from\s+['"]immer['"]/,
|
|
@@ -680,7 +680,7 @@ const loadModuleFromString = async (script) => {
|
|
|
680
680
|
);
|
|
681
681
|
}
|
|
682
682
|
});
|
|
683
|
-
} catch
|
|
683
|
+
} catch {
|
|
684
684
|
}
|
|
685
685
|
return (await moduleFromString.importFromString(patchedScript))?.default ?? null;
|
|
686
686
|
};
|
|
@@ -755,6 +755,7 @@ const openPattern = /\\{/g;
|
|
|
755
755
|
const closePattern = /\\}/g;
|
|
756
756
|
const commaPattern = /\\,/g;
|
|
757
757
|
const periodPattern = /\\./g;
|
|
758
|
+
const EXPANSION_MAX = 1e5;
|
|
758
759
|
function numeric(str) {
|
|
759
760
|
return !isNaN(str) ? parseInt(str, 10) : str.charCodeAt(0);
|
|
760
761
|
}
|
|
@@ -784,14 +785,15 @@ function parseCommaParts(str) {
|
|
|
784
785
|
parts.push.apply(parts, p);
|
|
785
786
|
return parts;
|
|
786
787
|
}
|
|
787
|
-
function expand(str) {
|
|
788
|
+
function expand(str, options = {}) {
|
|
788
789
|
if (!str) {
|
|
789
790
|
return [];
|
|
790
791
|
}
|
|
792
|
+
const { max = EXPANSION_MAX } = options;
|
|
791
793
|
if (str.slice(0, 2) === "{}") {
|
|
792
794
|
str = "\\{\\}" + str.slice(2);
|
|
793
795
|
}
|
|
794
|
-
return expand_(escapeBraces(str), true).map(unescapeBraces);
|
|
796
|
+
return expand_(escapeBraces(str), max, true).map(unescapeBraces);
|
|
795
797
|
}
|
|
796
798
|
function embrace(str) {
|
|
797
799
|
return "{" + str + "}";
|
|
@@ -805,15 +807,15 @@ function lte(i, y) {
|
|
|
805
807
|
function gte(i, y) {
|
|
806
808
|
return i >= y;
|
|
807
809
|
}
|
|
808
|
-
function expand_(str, isTop) {
|
|
810
|
+
function expand_(str, max, isTop) {
|
|
809
811
|
const expansions = [];
|
|
810
812
|
const m = balanced("{", "}", str);
|
|
811
813
|
if (!m)
|
|
812
814
|
return [str];
|
|
813
815
|
const pre = m.pre;
|
|
814
|
-
const post = m.post.length ? expand_(m.post, false) : [""];
|
|
816
|
+
const post = m.post.length ? expand_(m.post, max, false) : [""];
|
|
815
817
|
if (/\$$/.test(m.pre)) {
|
|
816
|
-
for (let k = 0; k < post.length; k++) {
|
|
818
|
+
for (let k = 0; k < post.length && k < max; k++) {
|
|
817
819
|
const expansion = pre + "{" + m.body + "}" + post[k];
|
|
818
820
|
expansions.push(expansion);
|
|
819
821
|
}
|
|
@@ -825,7 +827,7 @@ function expand_(str, isTop) {
|
|
|
825
827
|
if (!isSequence && !isOptions) {
|
|
826
828
|
if (m.post.match(/,(?!,).*\}/)) {
|
|
827
829
|
str = m.pre + "{" + m.body + escClose + m.post;
|
|
828
|
-
return expand_(str);
|
|
830
|
+
return expand_(str, max, true);
|
|
829
831
|
}
|
|
830
832
|
return [str];
|
|
831
833
|
}
|
|
@@ -835,7 +837,7 @@ function expand_(str, isTop) {
|
|
|
835
837
|
} else {
|
|
836
838
|
n = parseCommaParts(m.body);
|
|
837
839
|
if (n.length === 1 && n[0] !== void 0) {
|
|
838
|
-
n = expand_(n[0], false).map(embrace);
|
|
840
|
+
n = expand_(n[0], max, false).map(embrace);
|
|
839
841
|
if (n.length === 1) {
|
|
840
842
|
return post.map((p) => m.pre + n[0] + p);
|
|
841
843
|
}
|
|
@@ -881,11 +883,11 @@ function expand_(str, isTop) {
|
|
|
881
883
|
} else {
|
|
882
884
|
N = [];
|
|
883
885
|
for (let j = 0; j < n.length; j++) {
|
|
884
|
-
N.push.apply(N, expand_(n[j], false));
|
|
886
|
+
N.push.apply(N, expand_(n[j], max, false));
|
|
885
887
|
}
|
|
886
888
|
}
|
|
887
889
|
for (let j = 0; j < N.length; j++) {
|
|
888
|
-
for (let k = 0; k < post.length; k++) {
|
|
890
|
+
for (let k = 0; k < post.length && expansions.length < max; k++) {
|
|
889
891
|
const expansion = pre + N[j] + post[k];
|
|
890
892
|
if (!isTop || isSequence || expansion) {
|
|
891
893
|
expansions.push(expansion);
|
|
@@ -1014,8 +1016,11 @@ const parseClass = (glob, position) => {
|
|
|
1014
1016
|
return [comb, uflag, endPos - pos, true];
|
|
1015
1017
|
};
|
|
1016
1018
|
|
|
1017
|
-
const unescape = (s, { windowsPathsNoEscape = false } = {}) => {
|
|
1018
|
-
|
|
1019
|
+
const unescape = (s, { windowsPathsNoEscape = false, magicalBraces = true } = {}) => {
|
|
1020
|
+
if (magicalBraces) {
|
|
1021
|
+
return windowsPathsNoEscape ? s.replace(/\[([^\/\\])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^\/\\])\]/g, "$1$2").replace(/\\([^\/])/g, "$1");
|
|
1022
|
+
}
|
|
1023
|
+
return windowsPathsNoEscape ? s.replace(/\[([^\/\\{}])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^\/\\{}])\]/g, "$1$2").replace(/\\([^\/{}])/g, "$1");
|
|
1019
1024
|
};
|
|
1020
1025
|
|
|
1021
1026
|
const types = /* @__PURE__ */ new Set(["!", "?", "+", "*", "@"]);
|
|
@@ -1368,7 +1373,7 @@ class AST {
|
|
|
1368
1373
|
if (this.#root === this)
|
|
1369
1374
|
this.#fillNegs();
|
|
1370
1375
|
if (!this.type) {
|
|
1371
|
-
const noEmpty = this.isStart() && this.isEnd();
|
|
1376
|
+
const noEmpty = this.isStart() && this.isEnd() && !this.#parts.some((s) => typeof s !== "string");
|
|
1372
1377
|
const src = this.#parts.map((p) => {
|
|
1373
1378
|
const [re, _, hasMagic, uflag] = typeof p === "string" ? AST.#parseGlob(p, this.#hasMagic, noEmpty) : p.toRegExpSource(allowDot);
|
|
1374
1379
|
this.#hasMagic = this.#hasMagic || hasMagic;
|
|
@@ -1478,10 +1483,7 @@ class AST {
|
|
|
1478
1483
|
}
|
|
1479
1484
|
}
|
|
1480
1485
|
if (c === "*") {
|
|
1481
|
-
|
|
1482
|
-
re += starNoEmpty;
|
|
1483
|
-
else
|
|
1484
|
-
re += star$1;
|
|
1486
|
+
re += noEmpty && glob === "*" ? starNoEmpty : star$1;
|
|
1485
1487
|
hasMagic = true;
|
|
1486
1488
|
continue;
|
|
1487
1489
|
}
|
|
@@ -1496,7 +1498,10 @@ class AST {
|
|
|
1496
1498
|
}
|
|
1497
1499
|
}
|
|
1498
1500
|
|
|
1499
|
-
const escape = (s, { windowsPathsNoEscape = false } = {}) => {
|
|
1501
|
+
const escape = (s, { windowsPathsNoEscape = false, magicalBraces = false } = {}) => {
|
|
1502
|
+
if (magicalBraces) {
|
|
1503
|
+
return windowsPathsNoEscape ? s.replace(/[?*()[\]{}]/g, "[$&]") : s.replace(/[?*()[\]\\{}]/g, "\\$&");
|
|
1504
|
+
}
|
|
1500
1505
|
return windowsPathsNoEscape ? s.replace(/[?*()[\]]/g, "[$&]") : s.replace(/[?*()[\]\\]/g, "\\$&");
|
|
1501
1506
|
};
|
|
1502
1507
|
|
|
@@ -2136,16 +2141,27 @@ class Minimatch {
|
|
|
2136
2141
|
pp[i] = twoStar;
|
|
2137
2142
|
}
|
|
2138
2143
|
} else if (next === void 0) {
|
|
2139
|
-
pp[i - 1] = prev + "(
|
|
2144
|
+
pp[i - 1] = prev + "(?:\\/|\\/" + twoStar + ")?";
|
|
2140
2145
|
} else if (next !== GLOBSTAR) {
|
|
2141
2146
|
pp[i - 1] = prev + "(?:\\/|\\/" + twoStar + "\\/)" + next;
|
|
2142
2147
|
pp[i + 1] = GLOBSTAR;
|
|
2143
2148
|
}
|
|
2144
2149
|
});
|
|
2145
|
-
|
|
2150
|
+
const filtered = pp.filter((p) => p !== GLOBSTAR);
|
|
2151
|
+
if (this.partial && filtered.length >= 1) {
|
|
2152
|
+
const prefixes = [];
|
|
2153
|
+
for (let i = 1; i <= filtered.length; i++) {
|
|
2154
|
+
prefixes.push(filtered.slice(0, i).join("/"));
|
|
2155
|
+
}
|
|
2156
|
+
return "(?:" + prefixes.join("|") + ")";
|
|
2157
|
+
}
|
|
2158
|
+
return filtered.join("/");
|
|
2146
2159
|
}).join("|");
|
|
2147
2160
|
const [open, close] = set.length > 1 ? ["(?:", ")"] : ["", ""];
|
|
2148
2161
|
re = "^" + open + re + close + "$";
|
|
2162
|
+
if (this.partial) {
|
|
2163
|
+
re = "^(?:\\/|" + open + re.slice(1, -1) + close + ")$";
|
|
2164
|
+
}
|
|
2149
2165
|
if (this.negate)
|
|
2150
2166
|
re = "^(?!" + re + ").+$";
|
|
2151
2167
|
try {
|
|
@@ -2217,7 +2233,7 @@ minimatch.Minimatch = Minimatch;
|
|
|
2217
2233
|
minimatch.escape = escape;
|
|
2218
2234
|
minimatch.unescape = unescape;
|
|
2219
2235
|
|
|
2220
|
-
const
|
|
2236
|
+
const defaultPerf = typeof performance === "object" && performance && typeof performance.now === "function" ? performance : Date;
|
|
2221
2237
|
const warned = /* @__PURE__ */ new Set();
|
|
2222
2238
|
const PROCESS = typeof process === "object" && !!process ? process : {};
|
|
2223
2239
|
const emitWarning = (msg, type, code, fn) => {
|
|
@@ -2301,9 +2317,17 @@ class LRUCache {
|
|
|
2301
2317
|
#max;
|
|
2302
2318
|
#maxSize;
|
|
2303
2319
|
#dispose;
|
|
2320
|
+
#onInsert;
|
|
2304
2321
|
#disposeAfter;
|
|
2305
2322
|
#fetchMethod;
|
|
2306
2323
|
#memoMethod;
|
|
2324
|
+
#perf;
|
|
2325
|
+
/**
|
|
2326
|
+
* {@link LRUCache.OptionsBase.perf}
|
|
2327
|
+
*/
|
|
2328
|
+
get perf() {
|
|
2329
|
+
return this.#perf;
|
|
2330
|
+
}
|
|
2307
2331
|
/**
|
|
2308
2332
|
* {@link LRUCache.OptionsBase.ttl}
|
|
2309
2333
|
*/
|
|
@@ -2379,9 +2403,11 @@ class LRUCache {
|
|
|
2379
2403
|
#sizes;
|
|
2380
2404
|
#starts;
|
|
2381
2405
|
#ttls;
|
|
2406
|
+
#autopurgeTimers;
|
|
2382
2407
|
#hasDispose;
|
|
2383
2408
|
#hasFetchMethod;
|
|
2384
2409
|
#hasDisposeAfter;
|
|
2410
|
+
#hasOnInsert;
|
|
2385
2411
|
/**
|
|
2386
2412
|
* Do not call this method unless you need to inspect the
|
|
2387
2413
|
* inner workings of the cache. If anything returned by this
|
|
@@ -2396,6 +2422,7 @@ class LRUCache {
|
|
|
2396
2422
|
// properties
|
|
2397
2423
|
starts: c.#starts,
|
|
2398
2424
|
ttls: c.#ttls,
|
|
2425
|
+
autopurgeTimers: c.#autopurgeTimers,
|
|
2399
2426
|
sizes: c.#sizes,
|
|
2400
2427
|
keyMap: c.#keyMap,
|
|
2401
2428
|
keyList: c.#keyList,
|
|
@@ -2458,6 +2485,12 @@ class LRUCache {
|
|
|
2458
2485
|
get dispose() {
|
|
2459
2486
|
return this.#dispose;
|
|
2460
2487
|
}
|
|
2488
|
+
/**
|
|
2489
|
+
* {@link LRUCache.OptionsBase.onInsert} (read-only)
|
|
2490
|
+
*/
|
|
2491
|
+
get onInsert() {
|
|
2492
|
+
return this.#onInsert;
|
|
2493
|
+
}
|
|
2461
2494
|
/**
|
|
2462
2495
|
* {@link LRUCache.OptionsBase.disposeAfter} (read-only)
|
|
2463
2496
|
*/
|
|
@@ -2465,7 +2498,13 @@ class LRUCache {
|
|
|
2465
2498
|
return this.#disposeAfter;
|
|
2466
2499
|
}
|
|
2467
2500
|
constructor(options) {
|
|
2468
|
-
const { max = 0, ttl, ttlResolution = 1, ttlAutopurge, updateAgeOnGet, updateAgeOnHas, allowStale, dispose, disposeAfter, noDisposeOnSet, noUpdateTTL, maxSize = 0, maxEntrySize = 0, sizeCalculation, fetchMethod, memoMethod, noDeleteOnFetchRejection, noDeleteOnStaleGet, allowStaleOnFetchRejection, allowStaleOnFetchAbort, ignoreFetchAbort } = options;
|
|
2501
|
+
const { max = 0, ttl, ttlResolution = 1, ttlAutopurge, updateAgeOnGet, updateAgeOnHas, allowStale, dispose, onInsert, disposeAfter, noDisposeOnSet, noUpdateTTL, maxSize = 0, maxEntrySize = 0, sizeCalculation, fetchMethod, memoMethod, noDeleteOnFetchRejection, noDeleteOnStaleGet, allowStaleOnFetchRejection, allowStaleOnFetchAbort, ignoreFetchAbort, perf } = options;
|
|
2502
|
+
if (perf !== void 0) {
|
|
2503
|
+
if (typeof perf?.now !== "function") {
|
|
2504
|
+
throw new TypeError("perf option must have a now() method if specified");
|
|
2505
|
+
}
|
|
2506
|
+
}
|
|
2507
|
+
this.#perf = perf ?? defaultPerf;
|
|
2469
2508
|
if (max !== 0 && !isPosInt(max)) {
|
|
2470
2509
|
throw new TypeError("max option must be a nonnegative integer");
|
|
2471
2510
|
}
|
|
@@ -2507,6 +2546,9 @@ class LRUCache {
|
|
|
2507
2546
|
if (typeof dispose === "function") {
|
|
2508
2547
|
this.#dispose = dispose;
|
|
2509
2548
|
}
|
|
2549
|
+
if (typeof onInsert === "function") {
|
|
2550
|
+
this.#onInsert = onInsert;
|
|
2551
|
+
}
|
|
2510
2552
|
if (typeof disposeAfter === "function") {
|
|
2511
2553
|
this.#disposeAfter = disposeAfter;
|
|
2512
2554
|
this.#disposed = [];
|
|
@@ -2515,6 +2557,7 @@ class LRUCache {
|
|
|
2515
2557
|
this.#disposed = void 0;
|
|
2516
2558
|
}
|
|
2517
2559
|
this.#hasDispose = !!this.#dispose;
|
|
2560
|
+
this.#hasOnInsert = !!this.#onInsert;
|
|
2518
2561
|
this.#hasDisposeAfter = !!this.#disposeAfter;
|
|
2519
2562
|
this.noDisposeOnSet = !!noDisposeOnSet;
|
|
2520
2563
|
this.noUpdateTTL = !!noUpdateTTL;
|
|
@@ -2570,10 +2613,16 @@ class LRUCache {
|
|
|
2570
2613
|
const starts = new ZeroArray(this.#max);
|
|
2571
2614
|
this.#ttls = ttls;
|
|
2572
2615
|
this.#starts = starts;
|
|
2573
|
-
|
|
2616
|
+
const purgeTimers = this.ttlAutopurge ? new Array(this.#max) : void 0;
|
|
2617
|
+
this.#autopurgeTimers = purgeTimers;
|
|
2618
|
+
this.#setItemTTL = (index, ttl, start = this.#perf.now()) => {
|
|
2574
2619
|
starts[index] = ttl !== 0 ? start : 0;
|
|
2575
2620
|
ttls[index] = ttl;
|
|
2576
|
-
if (
|
|
2621
|
+
if (purgeTimers?.[index]) {
|
|
2622
|
+
clearTimeout(purgeTimers[index]);
|
|
2623
|
+
purgeTimers[index] = void 0;
|
|
2624
|
+
}
|
|
2625
|
+
if (ttl !== 0 && purgeTimers) {
|
|
2577
2626
|
const t = setTimeout(() => {
|
|
2578
2627
|
if (this.#isStale(index)) {
|
|
2579
2628
|
this.#delete(this.#keyList[index], "expire");
|
|
@@ -2582,10 +2631,11 @@ class LRUCache {
|
|
|
2582
2631
|
if (t.unref) {
|
|
2583
2632
|
t.unref();
|
|
2584
2633
|
}
|
|
2634
|
+
purgeTimers[index] = t;
|
|
2585
2635
|
}
|
|
2586
2636
|
};
|
|
2587
2637
|
this.#updateItemAge = (index) => {
|
|
2588
|
-
starts[index] = ttls[index] !== 0 ? perf.now() : 0;
|
|
2638
|
+
starts[index] = ttls[index] !== 0 ? this.#perf.now() : 0;
|
|
2589
2639
|
};
|
|
2590
2640
|
this.#statusTTL = (status, index) => {
|
|
2591
2641
|
if (ttls[index]) {
|
|
@@ -2602,7 +2652,7 @@ class LRUCache {
|
|
|
2602
2652
|
};
|
|
2603
2653
|
let cachedNow = 0;
|
|
2604
2654
|
const getNow = () => {
|
|
2605
|
-
const n = perf.now();
|
|
2655
|
+
const n = this.#perf.now();
|
|
2606
2656
|
if (this.ttlResolution > 0) {
|
|
2607
2657
|
cachedNow = n;
|
|
2608
2658
|
const t = setTimeout(() => cachedNow = 0, this.ttlResolution);
|
|
@@ -2905,7 +2955,7 @@ class LRUCache {
|
|
|
2905
2955
|
const ttl = this.#ttls[i];
|
|
2906
2956
|
const start = this.#starts[i];
|
|
2907
2957
|
if (ttl && start) {
|
|
2908
|
-
const remain = ttl - (perf.now() - start);
|
|
2958
|
+
const remain = ttl - (this.#perf.now() - start);
|
|
2909
2959
|
entry.ttl = remain;
|
|
2910
2960
|
entry.start = Date.now();
|
|
2911
2961
|
}
|
|
@@ -2939,7 +2989,7 @@ class LRUCache {
|
|
|
2939
2989
|
const entry = { value };
|
|
2940
2990
|
if (this.#ttls && this.#starts) {
|
|
2941
2991
|
entry.ttl = this.#ttls[i];
|
|
2942
|
-
const age = perf.now() - this.#starts[i];
|
|
2992
|
+
const age = this.#perf.now() - this.#starts[i];
|
|
2943
2993
|
entry.start = Math.floor(Date.now() - age);
|
|
2944
2994
|
}
|
|
2945
2995
|
if (this.#sizes) {
|
|
@@ -2963,7 +3013,7 @@ class LRUCache {
|
|
|
2963
3013
|
for (const [key, entry] of arr) {
|
|
2964
3014
|
if (entry.start) {
|
|
2965
3015
|
const age = Date.now() - entry.start;
|
|
2966
|
-
entry.start = perf.now() - age;
|
|
3016
|
+
entry.start = this.#perf.now() - age;
|
|
2967
3017
|
}
|
|
2968
3018
|
this.set(key, entry.value, entry);
|
|
2969
3019
|
}
|
|
@@ -3028,6 +3078,9 @@ class LRUCache {
|
|
|
3028
3078
|
if (status)
|
|
3029
3079
|
status.set = "add";
|
|
3030
3080
|
noUpdateTTL = false;
|
|
3081
|
+
if (this.#hasOnInsert) {
|
|
3082
|
+
this.#onInsert?.(v, k, "add");
|
|
3083
|
+
}
|
|
3031
3084
|
} else {
|
|
3032
3085
|
this.#moveToTail(index);
|
|
3033
3086
|
const oldVal = this.#valList[index];
|
|
@@ -3063,6 +3116,9 @@ class LRUCache {
|
|
|
3063
3116
|
} else if (status) {
|
|
3064
3117
|
status.set = "update";
|
|
3065
3118
|
}
|
|
3119
|
+
if (this.#hasOnInsert) {
|
|
3120
|
+
this.onInsert?.(v, k, v === oldVal ? "update" : "replace");
|
|
3121
|
+
}
|
|
3066
3122
|
}
|
|
3067
3123
|
if (ttl !== 0 && !this.#ttls) {
|
|
3068
3124
|
this.#initializeTTLTracking();
|
|
@@ -3125,6 +3181,10 @@ class LRUCache {
|
|
|
3125
3181
|
}
|
|
3126
3182
|
}
|
|
3127
3183
|
this.#removeItemSize(head);
|
|
3184
|
+
if (this.#autopurgeTimers?.[head]) {
|
|
3185
|
+
clearTimeout(this.#autopurgeTimers[head]);
|
|
3186
|
+
this.#autopurgeTimers[head] = void 0;
|
|
3187
|
+
}
|
|
3128
3188
|
if (free) {
|
|
3129
3189
|
this.#keyList[head] = void 0;
|
|
3130
3190
|
this.#valList[head] = void 0;
|
|
@@ -3216,6 +3276,7 @@ class LRUCache {
|
|
|
3216
3276
|
const cb = (v2, updateCache = false) => {
|
|
3217
3277
|
const { aborted } = ac.signal;
|
|
3218
3278
|
const ignoreAbort = options.ignoreFetchAbort && v2 !== void 0;
|
|
3279
|
+
const proceed = options.ignoreFetchAbort || !!(options.allowStaleOnFetchAbort && v2 !== void 0);
|
|
3219
3280
|
if (options.status) {
|
|
3220
3281
|
if (aborted && !updateCache) {
|
|
3221
3282
|
options.status.fetchAborted = true;
|
|
@@ -3227,12 +3288,13 @@ class LRUCache {
|
|
|
3227
3288
|
}
|
|
3228
3289
|
}
|
|
3229
3290
|
if (aborted && !ignoreAbort && !updateCache) {
|
|
3230
|
-
return fetchFail(ac.signal.reason);
|
|
3291
|
+
return fetchFail(ac.signal.reason, proceed);
|
|
3231
3292
|
}
|
|
3232
3293
|
const bf2 = p;
|
|
3233
|
-
|
|
3294
|
+
const vl = this.#valList[index];
|
|
3295
|
+
if (vl === p || ignoreAbort && updateCache && vl === void 0) {
|
|
3234
3296
|
if (v2 === void 0) {
|
|
3235
|
-
if (bf2.__staleWhileFetching) {
|
|
3297
|
+
if (bf2.__staleWhileFetching !== void 0) {
|
|
3236
3298
|
this.#valList[index] = bf2.__staleWhileFetching;
|
|
3237
3299
|
} else {
|
|
3238
3300
|
this.#delete(k, "fetch");
|
|
@@ -3250,16 +3312,16 @@ class LRUCache {
|
|
|
3250
3312
|
options.status.fetchRejected = true;
|
|
3251
3313
|
options.status.fetchError = er;
|
|
3252
3314
|
}
|
|
3253
|
-
return fetchFail(er);
|
|
3315
|
+
return fetchFail(er, false);
|
|
3254
3316
|
};
|
|
3255
|
-
const fetchFail = (er) => {
|
|
3317
|
+
const fetchFail = (er, proceed) => {
|
|
3256
3318
|
const { aborted } = ac.signal;
|
|
3257
3319
|
const allowStaleAborted = aborted && options.allowStaleOnFetchAbort;
|
|
3258
3320
|
const allowStale = allowStaleAborted || options.allowStaleOnFetchRejection;
|
|
3259
3321
|
const noDelete = allowStale || options.noDeleteOnFetchRejection;
|
|
3260
3322
|
const bf2 = p;
|
|
3261
3323
|
if (this.#valList[index] === p) {
|
|
3262
|
-
const del = !noDelete || bf2.__staleWhileFetching === void 0;
|
|
3324
|
+
const del = !noDelete || !proceed && bf2.__staleWhileFetching === void 0;
|
|
3263
3325
|
if (del) {
|
|
3264
3326
|
this.#delete(k, "fetch");
|
|
3265
3327
|
} else if (!allowStaleAborted) {
|
|
@@ -3495,6 +3557,10 @@ class LRUCache {
|
|
|
3495
3557
|
if (this.#size !== 0) {
|
|
3496
3558
|
const index = this.#keyMap.get(k);
|
|
3497
3559
|
if (index !== void 0) {
|
|
3560
|
+
if (this.#autopurgeTimers?.[index]) {
|
|
3561
|
+
clearTimeout(this.#autopurgeTimers?.[index]);
|
|
3562
|
+
this.#autopurgeTimers[index] = void 0;
|
|
3563
|
+
}
|
|
3498
3564
|
deleted = true;
|
|
3499
3565
|
if (this.#size === 1) {
|
|
3500
3566
|
this.#clear(reason);
|
|
@@ -3565,6 +3631,11 @@ class LRUCache {
|
|
|
3565
3631
|
if (this.#ttls && this.#starts) {
|
|
3566
3632
|
this.#ttls.fill(0);
|
|
3567
3633
|
this.#starts.fill(0);
|
|
3634
|
+
for (const t of this.#autopurgeTimers ?? []) {
|
|
3635
|
+
if (t !== void 0)
|
|
3636
|
+
clearTimeout(t);
|
|
3637
|
+
}
|
|
3638
|
+
this.#autopurgeTimers?.fill(void 0);
|
|
3568
3639
|
}
|
|
3569
3640
|
if (this.#sizes) {
|
|
3570
3641
|
this.#sizes.fill(0);
|
|
@@ -4502,7 +4573,7 @@ const ENOREALPATH = 512;
|
|
|
4502
4573
|
const ENOCHILD = ENOTDIR | ENOENT | ENOREALPATH;
|
|
4503
4574
|
const TYPEMASK = 1023;
|
|
4504
4575
|
const entToType = (s) => s.isFile() ? IFREG : s.isDirectory() ? IFDIR : s.isSymbolicLink() ? IFLNK : s.isCharacterDevice() ? IFCHR : s.isBlockDevice() ? IFBLK : s.isSocket() ? IFSOCK : s.isFIFO() ? IFIFO : UNKNOWN;
|
|
4505
|
-
const normalizeCache =
|
|
4576
|
+
const normalizeCache = new LRUCache({ max: 2 ** 12 });
|
|
4506
4577
|
const normalize = (s) => {
|
|
4507
4578
|
const c = normalizeCache.get(s);
|
|
4508
4579
|
if (c)
|
|
@@ -4511,7 +4582,7 @@ const normalize = (s) => {
|
|
|
4511
4582
|
normalizeCache.set(s, n);
|
|
4512
4583
|
return n;
|
|
4513
4584
|
};
|
|
4514
|
-
const normalizeNocaseCache =
|
|
4585
|
+
const normalizeNocaseCache = new LRUCache({ max: 2 ** 12 });
|
|
4515
4586
|
const normalizeNocase = (s) => {
|
|
4516
4587
|
const c = normalizeNocaseCache.get(s);
|
|
4517
4588
|
if (c)
|
|
@@ -4668,6 +4739,7 @@ class PathBase {
|
|
|
4668
4739
|
get parentPath() {
|
|
4669
4740
|
return (this.parent || this).fullpath();
|
|
4670
4741
|
}
|
|
4742
|
+
/* c8 ignore start */
|
|
4671
4743
|
/**
|
|
4672
4744
|
* Deprecated alias for Dirent['parentPath'] Somewhat counterintuitively,
|
|
4673
4745
|
* this property refers to the *parent* path, not the path object itself.
|
|
@@ -4677,6 +4749,7 @@ class PathBase {
|
|
|
4677
4749
|
get path() {
|
|
4678
4750
|
return this.parentPath;
|
|
4679
4751
|
}
|
|
4752
|
+
/* c8 ignore stop */
|
|
4680
4753
|
/**
|
|
4681
4754
|
* Do not create new Path objects directly. They should always be accessed
|
|
4682
4755
|
* via the PathScurry class or other methods on the Path class.
|
|
@@ -7714,12 +7787,12 @@ export default (${entity}) => produce(${entity}, (draft) => {
|
|
|
7714
7787
|
const getTemplateMigrationFile = async (entity, enableMetaData) => {
|
|
7715
7788
|
let template = enableMetaData ? templateMigrationFileWithMetaDataLegacy(entity) : templateMigrationFileLegacy(entity);
|
|
7716
7789
|
try {
|
|
7717
|
-
await Promise.resolve().then(function () { return require('./immer-
|
|
7790
|
+
await Promise.resolve().then(function () { return require('./immer-ZZLkDBss.cjs'); }).then(({ produce }) => {
|
|
7718
7791
|
if (produce) {
|
|
7719
7792
|
template = enableMetaData ? templateMigrationFileWithMetaData(entity) : templateMigrationFile(entity);
|
|
7720
7793
|
}
|
|
7721
7794
|
});
|
|
7722
|
-
} catch
|
|
7795
|
+
} catch {
|
|
7723
7796
|
}
|
|
7724
7797
|
return template;
|
|
7725
7798
|
};
|
|
@@ -7830,7 +7903,7 @@ const commandAvailable = (command) => {
|
|
|
7830
7903
|
const exists = isWindows ? "where" : "which";
|
|
7831
7904
|
child_process.execSync(`${exists} ${command}`);
|
|
7832
7905
|
return true;
|
|
7833
|
-
} catch
|
|
7906
|
+
} catch {
|
|
7834
7907
|
return false;
|
|
7835
7908
|
}
|
|
7836
7909
|
};
|
|
@@ -7841,7 +7914,7 @@ const bashAvailable = () => {
|
|
|
7841
7914
|
try {
|
|
7842
7915
|
const response = child_process.execSync("bash --version").toString();
|
|
7843
7916
|
return response.includes("version");
|
|
7844
|
-
} catch
|
|
7917
|
+
} catch {
|
|
7845
7918
|
return false;
|
|
7846
7919
|
}
|
|
7847
7920
|
}
|
|
@@ -8212,7 +8285,7 @@ const parsePlan = (plan) => {
|
|
|
8212
8285
|
return (() => {
|
|
8213
8286
|
try {
|
|
8214
8287
|
return JSON.parse(plan);
|
|
8215
|
-
} catch
|
|
8288
|
+
} catch {
|
|
8216
8289
|
console.error("Unable to parse plan.json");
|
|
8217
8290
|
return null;
|
|
8218
8291
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IDatabase, IHelpers
|
|
1
|
+
import { ITask, IDatabase, IHelpers } from 'pg-promise';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Generate a new entity migration
|
|
@@ -158,4 +158,5 @@ declare const printVersionHistory: ({ config }: {
|
|
|
158
158
|
config: TConfig;
|
|
159
159
|
}) => Promise<void>;
|
|
160
160
|
|
|
161
|
-
export {
|
|
161
|
+
export { createMigration, getPlannedMigrations, getPlannedVersion, getVersions, migrate, migrateAll, pipe, printVersionHistory };
|
|
162
|
+
export type { TAfterMigrateRecord, TAfterMigrateRecordPayload, TBeforeMigrateRecord, TBeforeMigrateRecordPayload, TConfig, TEntityColumnNames, TMetaData, TMigration, TMigrationErrorPayload, TOnMigrationErrors, TOnMigrationErrorsPayload, TPayload, TPlan, TPlanEntry, TRecord, TRecordDetails, TRecordDetailsList };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IDatabase, IHelpers
|
|
1
|
+
import { ITask, IDatabase, IHelpers } from 'pg-promise';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Generate a new entity migration
|
|
@@ -158,4 +158,5 @@ declare const printVersionHistory: ({ config }: {
|
|
|
158
158
|
config: TConfig;
|
|
159
159
|
}) => Promise<void>;
|
|
160
160
|
|
|
161
|
-
export {
|
|
161
|
+
export { createMigration, getPlannedMigrations, getPlannedVersion, getVersions, migrate, migrateAll, pipe, printVersionHistory };
|
|
162
|
+
export type { TAfterMigrateRecord, TAfterMigrateRecordPayload, TBeforeMigrateRecord, TBeforeMigrateRecordPayload, TConfig, TEntityColumnNames, TMetaData, TMigration, TMigrationErrorPayload, TOnMigrationErrors, TOnMigrationErrorsPayload, TPayload, TPlan, TPlanEntry, TRecord, TRecordDetails, TRecordDetailsList };
|