@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.mjs
CHANGED
|
@@ -650,7 +650,7 @@ const capitalize = (word) => {
|
|
|
650
650
|
const loadModuleFromString = async (script) => {
|
|
651
651
|
let patchedScript = script;
|
|
652
652
|
try {
|
|
653
|
-
await import('./immer-
|
|
653
|
+
await import('./immer-CjiV9AMA.mjs').then(({ produce }) => {
|
|
654
654
|
if (produce) {
|
|
655
655
|
patchedScript = script.replace(
|
|
656
656
|
/import\s+produce\s+from\s+['"]immer['"]/,
|
|
@@ -659,7 +659,7 @@ const loadModuleFromString = async (script) => {
|
|
|
659
659
|
);
|
|
660
660
|
}
|
|
661
661
|
});
|
|
662
|
-
} catch
|
|
662
|
+
} catch {
|
|
663
663
|
}
|
|
664
664
|
return (await importFromString(patchedScript))?.default ?? null;
|
|
665
665
|
};
|
|
@@ -734,6 +734,7 @@ const openPattern = /\\{/g;
|
|
|
734
734
|
const closePattern = /\\}/g;
|
|
735
735
|
const commaPattern = /\\,/g;
|
|
736
736
|
const periodPattern = /\\./g;
|
|
737
|
+
const EXPANSION_MAX = 1e5;
|
|
737
738
|
function numeric(str) {
|
|
738
739
|
return !isNaN(str) ? parseInt(str, 10) : str.charCodeAt(0);
|
|
739
740
|
}
|
|
@@ -763,14 +764,15 @@ function parseCommaParts(str) {
|
|
|
763
764
|
parts.push.apply(parts, p);
|
|
764
765
|
return parts;
|
|
765
766
|
}
|
|
766
|
-
function expand(str) {
|
|
767
|
+
function expand(str, options = {}) {
|
|
767
768
|
if (!str) {
|
|
768
769
|
return [];
|
|
769
770
|
}
|
|
771
|
+
const { max = EXPANSION_MAX } = options;
|
|
770
772
|
if (str.slice(0, 2) === "{}") {
|
|
771
773
|
str = "\\{\\}" + str.slice(2);
|
|
772
774
|
}
|
|
773
|
-
return expand_(escapeBraces(str), true).map(unescapeBraces);
|
|
775
|
+
return expand_(escapeBraces(str), max, true).map(unescapeBraces);
|
|
774
776
|
}
|
|
775
777
|
function embrace(str) {
|
|
776
778
|
return "{" + str + "}";
|
|
@@ -784,15 +786,15 @@ function lte(i, y) {
|
|
|
784
786
|
function gte(i, y) {
|
|
785
787
|
return i >= y;
|
|
786
788
|
}
|
|
787
|
-
function expand_(str, isTop) {
|
|
789
|
+
function expand_(str, max, isTop) {
|
|
788
790
|
const expansions = [];
|
|
789
791
|
const m = balanced("{", "}", str);
|
|
790
792
|
if (!m)
|
|
791
793
|
return [str];
|
|
792
794
|
const pre = m.pre;
|
|
793
|
-
const post = m.post.length ? expand_(m.post, false) : [""];
|
|
795
|
+
const post = m.post.length ? expand_(m.post, max, false) : [""];
|
|
794
796
|
if (/\$$/.test(m.pre)) {
|
|
795
|
-
for (let k = 0; k < post.length; k++) {
|
|
797
|
+
for (let k = 0; k < post.length && k < max; k++) {
|
|
796
798
|
const expansion = pre + "{" + m.body + "}" + post[k];
|
|
797
799
|
expansions.push(expansion);
|
|
798
800
|
}
|
|
@@ -804,7 +806,7 @@ function expand_(str, isTop) {
|
|
|
804
806
|
if (!isSequence && !isOptions) {
|
|
805
807
|
if (m.post.match(/,(?!,).*\}/)) {
|
|
806
808
|
str = m.pre + "{" + m.body + escClose + m.post;
|
|
807
|
-
return expand_(str);
|
|
809
|
+
return expand_(str, max, true);
|
|
808
810
|
}
|
|
809
811
|
return [str];
|
|
810
812
|
}
|
|
@@ -814,7 +816,7 @@ function expand_(str, isTop) {
|
|
|
814
816
|
} else {
|
|
815
817
|
n = parseCommaParts(m.body);
|
|
816
818
|
if (n.length === 1 && n[0] !== void 0) {
|
|
817
|
-
n = expand_(n[0], false).map(embrace);
|
|
819
|
+
n = expand_(n[0], max, false).map(embrace);
|
|
818
820
|
if (n.length === 1) {
|
|
819
821
|
return post.map((p) => m.pre + n[0] + p);
|
|
820
822
|
}
|
|
@@ -860,11 +862,11 @@ function expand_(str, isTop) {
|
|
|
860
862
|
} else {
|
|
861
863
|
N = [];
|
|
862
864
|
for (let j = 0; j < n.length; j++) {
|
|
863
|
-
N.push.apply(N, expand_(n[j], false));
|
|
865
|
+
N.push.apply(N, expand_(n[j], max, false));
|
|
864
866
|
}
|
|
865
867
|
}
|
|
866
868
|
for (let j = 0; j < N.length; j++) {
|
|
867
|
-
for (let k = 0; k < post.length; k++) {
|
|
869
|
+
for (let k = 0; k < post.length && expansions.length < max; k++) {
|
|
868
870
|
const expansion = pre + N[j] + post[k];
|
|
869
871
|
if (!isTop || isSequence || expansion) {
|
|
870
872
|
expansions.push(expansion);
|
|
@@ -993,8 +995,11 @@ const parseClass = (glob, position) => {
|
|
|
993
995
|
return [comb, uflag, endPos - pos, true];
|
|
994
996
|
};
|
|
995
997
|
|
|
996
|
-
const unescape = (s, { windowsPathsNoEscape = false } = {}) => {
|
|
997
|
-
|
|
998
|
+
const unescape = (s, { windowsPathsNoEscape = false, magicalBraces = true } = {}) => {
|
|
999
|
+
if (magicalBraces) {
|
|
1000
|
+
return windowsPathsNoEscape ? s.replace(/\[([^\/\\])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^\/\\])\]/g, "$1$2").replace(/\\([^\/])/g, "$1");
|
|
1001
|
+
}
|
|
1002
|
+
return windowsPathsNoEscape ? s.replace(/\[([^\/\\{}])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^\/\\{}])\]/g, "$1$2").replace(/\\([^\/{}])/g, "$1");
|
|
998
1003
|
};
|
|
999
1004
|
|
|
1000
1005
|
const types = /* @__PURE__ */ new Set(["!", "?", "+", "*", "@"]);
|
|
@@ -1347,7 +1352,7 @@ class AST {
|
|
|
1347
1352
|
if (this.#root === this)
|
|
1348
1353
|
this.#fillNegs();
|
|
1349
1354
|
if (!this.type) {
|
|
1350
|
-
const noEmpty = this.isStart() && this.isEnd();
|
|
1355
|
+
const noEmpty = this.isStart() && this.isEnd() && !this.#parts.some((s) => typeof s !== "string");
|
|
1351
1356
|
const src = this.#parts.map((p) => {
|
|
1352
1357
|
const [re, _, hasMagic, uflag] = typeof p === "string" ? AST.#parseGlob(p, this.#hasMagic, noEmpty) : p.toRegExpSource(allowDot);
|
|
1353
1358
|
this.#hasMagic = this.#hasMagic || hasMagic;
|
|
@@ -1457,10 +1462,7 @@ class AST {
|
|
|
1457
1462
|
}
|
|
1458
1463
|
}
|
|
1459
1464
|
if (c === "*") {
|
|
1460
|
-
|
|
1461
|
-
re += starNoEmpty;
|
|
1462
|
-
else
|
|
1463
|
-
re += star$1;
|
|
1465
|
+
re += noEmpty && glob === "*" ? starNoEmpty : star$1;
|
|
1464
1466
|
hasMagic = true;
|
|
1465
1467
|
continue;
|
|
1466
1468
|
}
|
|
@@ -1475,7 +1477,10 @@ class AST {
|
|
|
1475
1477
|
}
|
|
1476
1478
|
}
|
|
1477
1479
|
|
|
1478
|
-
const escape = (s, { windowsPathsNoEscape = false } = {}) => {
|
|
1480
|
+
const escape = (s, { windowsPathsNoEscape = false, magicalBraces = false } = {}) => {
|
|
1481
|
+
if (magicalBraces) {
|
|
1482
|
+
return windowsPathsNoEscape ? s.replace(/[?*()[\]{}]/g, "[$&]") : s.replace(/[?*()[\]\\{}]/g, "\\$&");
|
|
1483
|
+
}
|
|
1479
1484
|
return windowsPathsNoEscape ? s.replace(/[?*()[\]]/g, "[$&]") : s.replace(/[?*()[\]\\]/g, "\\$&");
|
|
1480
1485
|
};
|
|
1481
1486
|
|
|
@@ -2115,16 +2120,27 @@ class Minimatch {
|
|
|
2115
2120
|
pp[i] = twoStar;
|
|
2116
2121
|
}
|
|
2117
2122
|
} else if (next === void 0) {
|
|
2118
|
-
pp[i - 1] = prev + "(
|
|
2123
|
+
pp[i - 1] = prev + "(?:\\/|\\/" + twoStar + ")?";
|
|
2119
2124
|
} else if (next !== GLOBSTAR) {
|
|
2120
2125
|
pp[i - 1] = prev + "(?:\\/|\\/" + twoStar + "\\/)" + next;
|
|
2121
2126
|
pp[i + 1] = GLOBSTAR;
|
|
2122
2127
|
}
|
|
2123
2128
|
});
|
|
2124
|
-
|
|
2129
|
+
const filtered = pp.filter((p) => p !== GLOBSTAR);
|
|
2130
|
+
if (this.partial && filtered.length >= 1) {
|
|
2131
|
+
const prefixes = [];
|
|
2132
|
+
for (let i = 1; i <= filtered.length; i++) {
|
|
2133
|
+
prefixes.push(filtered.slice(0, i).join("/"));
|
|
2134
|
+
}
|
|
2135
|
+
return "(?:" + prefixes.join("|") + ")";
|
|
2136
|
+
}
|
|
2137
|
+
return filtered.join("/");
|
|
2125
2138
|
}).join("|");
|
|
2126
2139
|
const [open, close] = set.length > 1 ? ["(?:", ")"] : ["", ""];
|
|
2127
2140
|
re = "^" + open + re + close + "$";
|
|
2141
|
+
if (this.partial) {
|
|
2142
|
+
re = "^(?:\\/|" + open + re.slice(1, -1) + close + ")$";
|
|
2143
|
+
}
|
|
2128
2144
|
if (this.negate)
|
|
2129
2145
|
re = "^(?!" + re + ").+$";
|
|
2130
2146
|
try {
|
|
@@ -2196,7 +2212,7 @@ minimatch.Minimatch = Minimatch;
|
|
|
2196
2212
|
minimatch.escape = escape;
|
|
2197
2213
|
minimatch.unescape = unescape;
|
|
2198
2214
|
|
|
2199
|
-
const
|
|
2215
|
+
const defaultPerf = typeof performance === "object" && performance && typeof performance.now === "function" ? performance : Date;
|
|
2200
2216
|
const warned = /* @__PURE__ */ new Set();
|
|
2201
2217
|
const PROCESS = typeof process === "object" && !!process ? process : {};
|
|
2202
2218
|
const emitWarning = (msg, type, code, fn) => {
|
|
@@ -2280,9 +2296,17 @@ class LRUCache {
|
|
|
2280
2296
|
#max;
|
|
2281
2297
|
#maxSize;
|
|
2282
2298
|
#dispose;
|
|
2299
|
+
#onInsert;
|
|
2283
2300
|
#disposeAfter;
|
|
2284
2301
|
#fetchMethod;
|
|
2285
2302
|
#memoMethod;
|
|
2303
|
+
#perf;
|
|
2304
|
+
/**
|
|
2305
|
+
* {@link LRUCache.OptionsBase.perf}
|
|
2306
|
+
*/
|
|
2307
|
+
get perf() {
|
|
2308
|
+
return this.#perf;
|
|
2309
|
+
}
|
|
2286
2310
|
/**
|
|
2287
2311
|
* {@link LRUCache.OptionsBase.ttl}
|
|
2288
2312
|
*/
|
|
@@ -2358,9 +2382,11 @@ class LRUCache {
|
|
|
2358
2382
|
#sizes;
|
|
2359
2383
|
#starts;
|
|
2360
2384
|
#ttls;
|
|
2385
|
+
#autopurgeTimers;
|
|
2361
2386
|
#hasDispose;
|
|
2362
2387
|
#hasFetchMethod;
|
|
2363
2388
|
#hasDisposeAfter;
|
|
2389
|
+
#hasOnInsert;
|
|
2364
2390
|
/**
|
|
2365
2391
|
* Do not call this method unless you need to inspect the
|
|
2366
2392
|
* inner workings of the cache. If anything returned by this
|
|
@@ -2375,6 +2401,7 @@ class LRUCache {
|
|
|
2375
2401
|
// properties
|
|
2376
2402
|
starts: c.#starts,
|
|
2377
2403
|
ttls: c.#ttls,
|
|
2404
|
+
autopurgeTimers: c.#autopurgeTimers,
|
|
2378
2405
|
sizes: c.#sizes,
|
|
2379
2406
|
keyMap: c.#keyMap,
|
|
2380
2407
|
keyList: c.#keyList,
|
|
@@ -2437,6 +2464,12 @@ class LRUCache {
|
|
|
2437
2464
|
get dispose() {
|
|
2438
2465
|
return this.#dispose;
|
|
2439
2466
|
}
|
|
2467
|
+
/**
|
|
2468
|
+
* {@link LRUCache.OptionsBase.onInsert} (read-only)
|
|
2469
|
+
*/
|
|
2470
|
+
get onInsert() {
|
|
2471
|
+
return this.#onInsert;
|
|
2472
|
+
}
|
|
2440
2473
|
/**
|
|
2441
2474
|
* {@link LRUCache.OptionsBase.disposeAfter} (read-only)
|
|
2442
2475
|
*/
|
|
@@ -2444,7 +2477,13 @@ class LRUCache {
|
|
|
2444
2477
|
return this.#disposeAfter;
|
|
2445
2478
|
}
|
|
2446
2479
|
constructor(options) {
|
|
2447
|
-
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;
|
|
2480
|
+
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;
|
|
2481
|
+
if (perf !== void 0) {
|
|
2482
|
+
if (typeof perf?.now !== "function") {
|
|
2483
|
+
throw new TypeError("perf option must have a now() method if specified");
|
|
2484
|
+
}
|
|
2485
|
+
}
|
|
2486
|
+
this.#perf = perf ?? defaultPerf;
|
|
2448
2487
|
if (max !== 0 && !isPosInt(max)) {
|
|
2449
2488
|
throw new TypeError("max option must be a nonnegative integer");
|
|
2450
2489
|
}
|
|
@@ -2486,6 +2525,9 @@ class LRUCache {
|
|
|
2486
2525
|
if (typeof dispose === "function") {
|
|
2487
2526
|
this.#dispose = dispose;
|
|
2488
2527
|
}
|
|
2528
|
+
if (typeof onInsert === "function") {
|
|
2529
|
+
this.#onInsert = onInsert;
|
|
2530
|
+
}
|
|
2489
2531
|
if (typeof disposeAfter === "function") {
|
|
2490
2532
|
this.#disposeAfter = disposeAfter;
|
|
2491
2533
|
this.#disposed = [];
|
|
@@ -2494,6 +2536,7 @@ class LRUCache {
|
|
|
2494
2536
|
this.#disposed = void 0;
|
|
2495
2537
|
}
|
|
2496
2538
|
this.#hasDispose = !!this.#dispose;
|
|
2539
|
+
this.#hasOnInsert = !!this.#onInsert;
|
|
2497
2540
|
this.#hasDisposeAfter = !!this.#disposeAfter;
|
|
2498
2541
|
this.noDisposeOnSet = !!noDisposeOnSet;
|
|
2499
2542
|
this.noUpdateTTL = !!noUpdateTTL;
|
|
@@ -2549,10 +2592,16 @@ class LRUCache {
|
|
|
2549
2592
|
const starts = new ZeroArray(this.#max);
|
|
2550
2593
|
this.#ttls = ttls;
|
|
2551
2594
|
this.#starts = starts;
|
|
2552
|
-
|
|
2595
|
+
const purgeTimers = this.ttlAutopurge ? new Array(this.#max) : void 0;
|
|
2596
|
+
this.#autopurgeTimers = purgeTimers;
|
|
2597
|
+
this.#setItemTTL = (index, ttl, start = this.#perf.now()) => {
|
|
2553
2598
|
starts[index] = ttl !== 0 ? start : 0;
|
|
2554
2599
|
ttls[index] = ttl;
|
|
2555
|
-
if (
|
|
2600
|
+
if (purgeTimers?.[index]) {
|
|
2601
|
+
clearTimeout(purgeTimers[index]);
|
|
2602
|
+
purgeTimers[index] = void 0;
|
|
2603
|
+
}
|
|
2604
|
+
if (ttl !== 0 && purgeTimers) {
|
|
2556
2605
|
const t = setTimeout(() => {
|
|
2557
2606
|
if (this.#isStale(index)) {
|
|
2558
2607
|
this.#delete(this.#keyList[index], "expire");
|
|
@@ -2561,10 +2610,11 @@ class LRUCache {
|
|
|
2561
2610
|
if (t.unref) {
|
|
2562
2611
|
t.unref();
|
|
2563
2612
|
}
|
|
2613
|
+
purgeTimers[index] = t;
|
|
2564
2614
|
}
|
|
2565
2615
|
};
|
|
2566
2616
|
this.#updateItemAge = (index) => {
|
|
2567
|
-
starts[index] = ttls[index] !== 0 ? perf.now() : 0;
|
|
2617
|
+
starts[index] = ttls[index] !== 0 ? this.#perf.now() : 0;
|
|
2568
2618
|
};
|
|
2569
2619
|
this.#statusTTL = (status, index) => {
|
|
2570
2620
|
if (ttls[index]) {
|
|
@@ -2581,7 +2631,7 @@ class LRUCache {
|
|
|
2581
2631
|
};
|
|
2582
2632
|
let cachedNow = 0;
|
|
2583
2633
|
const getNow = () => {
|
|
2584
|
-
const n = perf.now();
|
|
2634
|
+
const n = this.#perf.now();
|
|
2585
2635
|
if (this.ttlResolution > 0) {
|
|
2586
2636
|
cachedNow = n;
|
|
2587
2637
|
const t = setTimeout(() => cachedNow = 0, this.ttlResolution);
|
|
@@ -2884,7 +2934,7 @@ class LRUCache {
|
|
|
2884
2934
|
const ttl = this.#ttls[i];
|
|
2885
2935
|
const start = this.#starts[i];
|
|
2886
2936
|
if (ttl && start) {
|
|
2887
|
-
const remain = ttl - (perf.now() - start);
|
|
2937
|
+
const remain = ttl - (this.#perf.now() - start);
|
|
2888
2938
|
entry.ttl = remain;
|
|
2889
2939
|
entry.start = Date.now();
|
|
2890
2940
|
}
|
|
@@ -2918,7 +2968,7 @@ class LRUCache {
|
|
|
2918
2968
|
const entry = { value };
|
|
2919
2969
|
if (this.#ttls && this.#starts) {
|
|
2920
2970
|
entry.ttl = this.#ttls[i];
|
|
2921
|
-
const age = perf.now() - this.#starts[i];
|
|
2971
|
+
const age = this.#perf.now() - this.#starts[i];
|
|
2922
2972
|
entry.start = Math.floor(Date.now() - age);
|
|
2923
2973
|
}
|
|
2924
2974
|
if (this.#sizes) {
|
|
@@ -2942,7 +2992,7 @@ class LRUCache {
|
|
|
2942
2992
|
for (const [key, entry] of arr) {
|
|
2943
2993
|
if (entry.start) {
|
|
2944
2994
|
const age = Date.now() - entry.start;
|
|
2945
|
-
entry.start = perf.now() - age;
|
|
2995
|
+
entry.start = this.#perf.now() - age;
|
|
2946
2996
|
}
|
|
2947
2997
|
this.set(key, entry.value, entry);
|
|
2948
2998
|
}
|
|
@@ -3007,6 +3057,9 @@ class LRUCache {
|
|
|
3007
3057
|
if (status)
|
|
3008
3058
|
status.set = "add";
|
|
3009
3059
|
noUpdateTTL = false;
|
|
3060
|
+
if (this.#hasOnInsert) {
|
|
3061
|
+
this.#onInsert?.(v, k, "add");
|
|
3062
|
+
}
|
|
3010
3063
|
} else {
|
|
3011
3064
|
this.#moveToTail(index);
|
|
3012
3065
|
const oldVal = this.#valList[index];
|
|
@@ -3042,6 +3095,9 @@ class LRUCache {
|
|
|
3042
3095
|
} else if (status) {
|
|
3043
3096
|
status.set = "update";
|
|
3044
3097
|
}
|
|
3098
|
+
if (this.#hasOnInsert) {
|
|
3099
|
+
this.onInsert?.(v, k, v === oldVal ? "update" : "replace");
|
|
3100
|
+
}
|
|
3045
3101
|
}
|
|
3046
3102
|
if (ttl !== 0 && !this.#ttls) {
|
|
3047
3103
|
this.#initializeTTLTracking();
|
|
@@ -3104,6 +3160,10 @@ class LRUCache {
|
|
|
3104
3160
|
}
|
|
3105
3161
|
}
|
|
3106
3162
|
this.#removeItemSize(head);
|
|
3163
|
+
if (this.#autopurgeTimers?.[head]) {
|
|
3164
|
+
clearTimeout(this.#autopurgeTimers[head]);
|
|
3165
|
+
this.#autopurgeTimers[head] = void 0;
|
|
3166
|
+
}
|
|
3107
3167
|
if (free) {
|
|
3108
3168
|
this.#keyList[head] = void 0;
|
|
3109
3169
|
this.#valList[head] = void 0;
|
|
@@ -3195,6 +3255,7 @@ class LRUCache {
|
|
|
3195
3255
|
const cb = (v2, updateCache = false) => {
|
|
3196
3256
|
const { aborted } = ac.signal;
|
|
3197
3257
|
const ignoreAbort = options.ignoreFetchAbort && v2 !== void 0;
|
|
3258
|
+
const proceed = options.ignoreFetchAbort || !!(options.allowStaleOnFetchAbort && v2 !== void 0);
|
|
3198
3259
|
if (options.status) {
|
|
3199
3260
|
if (aborted && !updateCache) {
|
|
3200
3261
|
options.status.fetchAborted = true;
|
|
@@ -3206,12 +3267,13 @@ class LRUCache {
|
|
|
3206
3267
|
}
|
|
3207
3268
|
}
|
|
3208
3269
|
if (aborted && !ignoreAbort && !updateCache) {
|
|
3209
|
-
return fetchFail(ac.signal.reason);
|
|
3270
|
+
return fetchFail(ac.signal.reason, proceed);
|
|
3210
3271
|
}
|
|
3211
3272
|
const bf2 = p;
|
|
3212
|
-
|
|
3273
|
+
const vl = this.#valList[index];
|
|
3274
|
+
if (vl === p || ignoreAbort && updateCache && vl === void 0) {
|
|
3213
3275
|
if (v2 === void 0) {
|
|
3214
|
-
if (bf2.__staleWhileFetching) {
|
|
3276
|
+
if (bf2.__staleWhileFetching !== void 0) {
|
|
3215
3277
|
this.#valList[index] = bf2.__staleWhileFetching;
|
|
3216
3278
|
} else {
|
|
3217
3279
|
this.#delete(k, "fetch");
|
|
@@ -3229,16 +3291,16 @@ class LRUCache {
|
|
|
3229
3291
|
options.status.fetchRejected = true;
|
|
3230
3292
|
options.status.fetchError = er;
|
|
3231
3293
|
}
|
|
3232
|
-
return fetchFail(er);
|
|
3294
|
+
return fetchFail(er, false);
|
|
3233
3295
|
};
|
|
3234
|
-
const fetchFail = (er) => {
|
|
3296
|
+
const fetchFail = (er, proceed) => {
|
|
3235
3297
|
const { aborted } = ac.signal;
|
|
3236
3298
|
const allowStaleAborted = aborted && options.allowStaleOnFetchAbort;
|
|
3237
3299
|
const allowStale = allowStaleAborted || options.allowStaleOnFetchRejection;
|
|
3238
3300
|
const noDelete = allowStale || options.noDeleteOnFetchRejection;
|
|
3239
3301
|
const bf2 = p;
|
|
3240
3302
|
if (this.#valList[index] === p) {
|
|
3241
|
-
const del = !noDelete || bf2.__staleWhileFetching === void 0;
|
|
3303
|
+
const del = !noDelete || !proceed && bf2.__staleWhileFetching === void 0;
|
|
3242
3304
|
if (del) {
|
|
3243
3305
|
this.#delete(k, "fetch");
|
|
3244
3306
|
} else if (!allowStaleAborted) {
|
|
@@ -3474,6 +3536,10 @@ class LRUCache {
|
|
|
3474
3536
|
if (this.#size !== 0) {
|
|
3475
3537
|
const index = this.#keyMap.get(k);
|
|
3476
3538
|
if (index !== void 0) {
|
|
3539
|
+
if (this.#autopurgeTimers?.[index]) {
|
|
3540
|
+
clearTimeout(this.#autopurgeTimers?.[index]);
|
|
3541
|
+
this.#autopurgeTimers[index] = void 0;
|
|
3542
|
+
}
|
|
3477
3543
|
deleted = true;
|
|
3478
3544
|
if (this.#size === 1) {
|
|
3479
3545
|
this.#clear(reason);
|
|
@@ -3544,6 +3610,11 @@ class LRUCache {
|
|
|
3544
3610
|
if (this.#ttls && this.#starts) {
|
|
3545
3611
|
this.#ttls.fill(0);
|
|
3546
3612
|
this.#starts.fill(0);
|
|
3613
|
+
for (const t of this.#autopurgeTimers ?? []) {
|
|
3614
|
+
if (t !== void 0)
|
|
3615
|
+
clearTimeout(t);
|
|
3616
|
+
}
|
|
3617
|
+
this.#autopurgeTimers?.fill(void 0);
|
|
3547
3618
|
}
|
|
3548
3619
|
if (this.#sizes) {
|
|
3549
3620
|
this.#sizes.fill(0);
|
|
@@ -4481,7 +4552,7 @@ const ENOREALPATH = 512;
|
|
|
4481
4552
|
const ENOCHILD = ENOTDIR | ENOENT | ENOREALPATH;
|
|
4482
4553
|
const TYPEMASK = 1023;
|
|
4483
4554
|
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;
|
|
4484
|
-
const normalizeCache =
|
|
4555
|
+
const normalizeCache = new LRUCache({ max: 2 ** 12 });
|
|
4485
4556
|
const normalize = (s) => {
|
|
4486
4557
|
const c = normalizeCache.get(s);
|
|
4487
4558
|
if (c)
|
|
@@ -4490,7 +4561,7 @@ const normalize = (s) => {
|
|
|
4490
4561
|
normalizeCache.set(s, n);
|
|
4491
4562
|
return n;
|
|
4492
4563
|
};
|
|
4493
|
-
const normalizeNocaseCache =
|
|
4564
|
+
const normalizeNocaseCache = new LRUCache({ max: 2 ** 12 });
|
|
4494
4565
|
const normalizeNocase = (s) => {
|
|
4495
4566
|
const c = normalizeNocaseCache.get(s);
|
|
4496
4567
|
if (c)
|
|
@@ -4647,6 +4718,7 @@ class PathBase {
|
|
|
4647
4718
|
get parentPath() {
|
|
4648
4719
|
return (this.parent || this).fullpath();
|
|
4649
4720
|
}
|
|
4721
|
+
/* c8 ignore start */
|
|
4650
4722
|
/**
|
|
4651
4723
|
* Deprecated alias for Dirent['parentPath'] Somewhat counterintuitively,
|
|
4652
4724
|
* this property refers to the *parent* path, not the path object itself.
|
|
@@ -4656,6 +4728,7 @@ class PathBase {
|
|
|
4656
4728
|
get path() {
|
|
4657
4729
|
return this.parentPath;
|
|
4658
4730
|
}
|
|
4731
|
+
/* c8 ignore stop */
|
|
4659
4732
|
/**
|
|
4660
4733
|
* Do not create new Path objects directly. They should always be accessed
|
|
4661
4734
|
* via the PathScurry class or other methods on the Path class.
|
|
@@ -7693,12 +7766,12 @@ export default (${entity}) => produce(${entity}, (draft) => {
|
|
|
7693
7766
|
const getTemplateMigrationFile = async (entity, enableMetaData) => {
|
|
7694
7767
|
let template = enableMetaData ? templateMigrationFileWithMetaDataLegacy(entity) : templateMigrationFileLegacy(entity);
|
|
7695
7768
|
try {
|
|
7696
|
-
await import('./immer-
|
|
7769
|
+
await import('./immer-CjiV9AMA.mjs').then(({ produce }) => {
|
|
7697
7770
|
if (produce) {
|
|
7698
7771
|
template = enableMetaData ? templateMigrationFileWithMetaData(entity) : templateMigrationFile(entity);
|
|
7699
7772
|
}
|
|
7700
7773
|
});
|
|
7701
|
-
} catch
|
|
7774
|
+
} catch {
|
|
7702
7775
|
}
|
|
7703
7776
|
return template;
|
|
7704
7777
|
};
|
|
@@ -7809,7 +7882,7 @@ const commandAvailable = (command) => {
|
|
|
7809
7882
|
const exists = isWindows ? "where" : "which";
|
|
7810
7883
|
execSync(`${exists} ${command}`);
|
|
7811
7884
|
return true;
|
|
7812
|
-
} catch
|
|
7885
|
+
} catch {
|
|
7813
7886
|
return false;
|
|
7814
7887
|
}
|
|
7815
7888
|
};
|
|
@@ -7820,7 +7893,7 @@ const bashAvailable = () => {
|
|
|
7820
7893
|
try {
|
|
7821
7894
|
const response = execSync("bash --version").toString();
|
|
7822
7895
|
return response.includes("version");
|
|
7823
|
-
} catch
|
|
7896
|
+
} catch {
|
|
7824
7897
|
return false;
|
|
7825
7898
|
}
|
|
7826
7899
|
}
|
|
@@ -8191,7 +8264,7 @@ const parsePlan = (plan) => {
|
|
|
8191
8264
|
return (() => {
|
|
8192
8265
|
try {
|
|
8193
8266
|
return JSON.parse(plan);
|
|
8194
|
-
} catch
|
|
8267
|
+
} catch {
|
|
8195
8268
|
console.error("Unable to parse plan.json");
|
|
8196
8269
|
return null;
|
|
8197
8270
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oliasoft-open-source/node-json-migrator",
|
|
3
|
-
"version": "4.4.
|
|
3
|
+
"version": "4.4.1-beta-2",
|
|
4
4
|
"description": "A library for JSON migrations",
|
|
5
5
|
"homepage": "https://oliasoft-open-source.gitlab.io/node-postgresql-migrator",
|
|
6
6
|
"bugs": {
|
|
@@ -29,53 +29,51 @@
|
|
|
29
29
|
"files": [
|
|
30
30
|
"dist"
|
|
31
31
|
],
|
|
32
|
-
"scripts": {
|
|
33
|
-
"build": "pkgroll --clean-dist",
|
|
34
|
-
"compile:validators": "tsx scripts/compile-validators.ts",
|
|
35
|
-
"lint:check": "npx eslint '**/*.{js,ts,json}'",
|
|
36
|
-
"lint:fix": "npx eslint --fix '**/*.{js,ts,json}'",
|
|
37
|
-
"prepare": "husky",
|
|
38
|
-
"prettier:check": "prettier --check \"**/*.{js,ts,json}\"",
|
|
39
|
-
"prettier:fix": "prettier --write \"**/*.{js,ts,json}\"",
|
|
40
|
-
"test": "yarn run prettier:check && yarn run lint:check && yarn run test:unit",
|
|
41
|
-
"test:integration": "tsx --test \"test/integration.test.ts\"",
|
|
42
|
-
"test:unit": "tsx --test --experimental-test-coverage \"src/**/*.test.ts\"",
|
|
43
|
-
"types:check": "tsc"
|
|
44
|
-
},
|
|
45
32
|
"lint-staged": {
|
|
46
|
-
"
|
|
47
|
-
|
|
33
|
+
"**/*.{ts,js,json}": [
|
|
34
|
+
"oxlint --fix",
|
|
48
35
|
"prettier --write"
|
|
49
36
|
]
|
|
50
37
|
},
|
|
51
38
|
"dependencies": {
|
|
52
39
|
"ajv": "^8.17.1",
|
|
53
40
|
"ajv-errors": "^3.0.0",
|
|
54
|
-
"es-toolkit": "^1.
|
|
41
|
+
"es-toolkit": "^1.44.0",
|
|
55
42
|
"module-from-string": "^3.3.1",
|
|
56
43
|
"pg-promise": "^11"
|
|
57
44
|
},
|
|
58
45
|
"devDependencies": {
|
|
46
|
+
"@prettier/plugin-oxc": "^0.1.3",
|
|
59
47
|
"@types/mock-fs": "^4.13.4",
|
|
60
|
-
"@types/node": "^
|
|
61
|
-
"chalk": "^5.
|
|
62
|
-
"esbuild": "^0.
|
|
63
|
-
"
|
|
64
|
-
"eslint-config-prettier": "^10.1.8",
|
|
65
|
-
"glob": "^11.0.3",
|
|
48
|
+
"@types/node": "^25.2.1",
|
|
49
|
+
"chalk": "^5.6.2",
|
|
50
|
+
"esbuild": "^0.27.3",
|
|
51
|
+
"glob": "^13.0.1",
|
|
66
52
|
"husky": "^9.1.7",
|
|
67
|
-
"immer": "^
|
|
68
|
-
"lint-staged": "^16.
|
|
53
|
+
"immer": "^11.1.3",
|
|
54
|
+
"lint-staged": "^16.2.7",
|
|
69
55
|
"mock-fs": "^5.5.0",
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
"
|
|
74
|
-
"
|
|
75
|
-
"
|
|
56
|
+
"oxlint": "^1.43.0",
|
|
57
|
+
"pg-mem": "^3.0.10",
|
|
58
|
+
"pkgroll": "^2.23.0",
|
|
59
|
+
"prettier": "3.8.1",
|
|
60
|
+
"strip-ansi": "^7.1.2",
|
|
61
|
+
"tsx": "^4.21.0",
|
|
62
|
+
"typescript": "^5.9.3"
|
|
76
63
|
},
|
|
77
64
|
"peerDependencies": {
|
|
78
65
|
"pg-promise": "^11"
|
|
79
66
|
},
|
|
80
|
-
"
|
|
81
|
-
|
|
67
|
+
"scripts": {
|
|
68
|
+
"build": "pkgroll --clean-dist",
|
|
69
|
+
"compile:validators": "tsx scripts/compile-validators.ts",
|
|
70
|
+
"lint:check": "oxlint",
|
|
71
|
+
"lint:fix": "oxlint --fix",
|
|
72
|
+
"prettier:check": "prettier --check \"**/*.{js,ts,json}\"",
|
|
73
|
+
"prettier:fix": "prettier --write \"**/*.{js,ts,json}\"",
|
|
74
|
+
"test": "pnpm run prettier:check && pnpm run lint:check && pnpm run test:unit",
|
|
75
|
+
"test:integration": "tsx --test \"test/integration.test.ts\"",
|
|
76
|
+
"test:unit": "tsx --test --experimental-test-coverage \"src/**/*.test.ts\"",
|
|
77
|
+
"types:check": "tsc"
|
|
78
|
+
}
|
|
79
|
+
}
|