@ztimson/utils 0.20.0 → 0.20.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/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +75 -71
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -97,13 +97,13 @@ function Lt(n) {
|
|
|
97
97
|
return typeof r != "string" || typeof s != "string" ? 1 : r.toLowerCase().localeCompare(s.toLowerCase());
|
|
98
98
|
};
|
|
99
99
|
}
|
|
100
|
-
function
|
|
100
|
+
function Nt(n, t) {
|
|
101
101
|
return (e) => O(B(e, n), t);
|
|
102
102
|
}
|
|
103
103
|
function ut(n, t = []) {
|
|
104
104
|
return n.forEach((e) => Array.isArray(e) ? ut(e, t) : t.push(e)), t;
|
|
105
105
|
}
|
|
106
|
-
function
|
|
106
|
+
function jt(n, t = !1) {
|
|
107
107
|
return function(e, r) {
|
|
108
108
|
const s = B(e, n), i = B(r, n);
|
|
109
109
|
return typeof s == "number" && typeof i == "number" ? (t ? -1 : 1) * (s - i) : s > i ? t ? -1 : 1 : s < i ? t ? 1 : -1 : 0;
|
|
@@ -280,7 +280,7 @@ class Tt {
|
|
|
280
280
|
* @param {K} key Item's primary key
|
|
281
281
|
*/
|
|
282
282
|
delete(t) {
|
|
283
|
-
delete this.store[t], this.options.storageKey && this.options.storage && this.options.storage.setItem(this.options.storageKey, JSON.stringify(this.
|
|
283
|
+
delete this.store[t], this.options.storageKey && this.options.storage && this.options.storage.setItem(this.options.storageKey, JSON.stringify(this.store));
|
|
284
284
|
}
|
|
285
285
|
/**
|
|
286
286
|
* Return cache as an array of key-value pairs
|
|
@@ -322,7 +322,7 @@ class Tt {
|
|
|
322
322
|
* @return {this}
|
|
323
323
|
*/
|
|
324
324
|
set(t, e, r = this.options.ttl) {
|
|
325
|
-
return this.store[t] = e, this.options.storageKey && this.options.storage && this.options.storage.setItem(this.options.storageKey, JSON.stringify(this.
|
|
325
|
+
return this.store[t] = e, this.options.storageKey && this.options.storage && this.options.storage.setItem(this.options.storageKey, JSON.stringify(this.store)), r && setTimeout(() => {
|
|
326
326
|
this.complete = !1, this.delete(t);
|
|
327
327
|
}, r * 1e3), this;
|
|
328
328
|
}
|
|
@@ -447,7 +447,7 @@ class K {
|
|
|
447
447
|
}
|
|
448
448
|
}
|
|
449
449
|
c(K, "listeners", {});
|
|
450
|
-
class
|
|
450
|
+
class g extends Error {
|
|
451
451
|
constructor(e, r) {
|
|
452
452
|
super(e);
|
|
453
453
|
c(this, "_code");
|
|
@@ -474,8 +474,8 @@ class y extends Error {
|
|
|
474
474
|
return this.message || super.toString();
|
|
475
475
|
}
|
|
476
476
|
}
|
|
477
|
-
c(
|
|
478
|
-
class W extends
|
|
477
|
+
c(g, "code", 500);
|
|
478
|
+
class W extends g {
|
|
479
479
|
constructor(t = "Bad Request") {
|
|
480
480
|
super(t);
|
|
481
481
|
}
|
|
@@ -484,7 +484,7 @@ class W extends y {
|
|
|
484
484
|
}
|
|
485
485
|
}
|
|
486
486
|
c(W, "code", 400);
|
|
487
|
-
class v extends
|
|
487
|
+
class v extends g {
|
|
488
488
|
constructor(t = "Unauthorized") {
|
|
489
489
|
super(t);
|
|
490
490
|
}
|
|
@@ -493,7 +493,7 @@ class v extends y {
|
|
|
493
493
|
}
|
|
494
494
|
}
|
|
495
495
|
c(v, "code", 401);
|
|
496
|
-
class J extends
|
|
496
|
+
class J extends g {
|
|
497
497
|
constructor(t = "Payment Required") {
|
|
498
498
|
super(t);
|
|
499
499
|
}
|
|
@@ -502,7 +502,7 @@ class J extends y {
|
|
|
502
502
|
}
|
|
503
503
|
}
|
|
504
504
|
c(J, "code", 402);
|
|
505
|
-
class z extends
|
|
505
|
+
class z extends g {
|
|
506
506
|
constructor(t = "Forbidden") {
|
|
507
507
|
super(t);
|
|
508
508
|
}
|
|
@@ -511,7 +511,7 @@ class z extends y {
|
|
|
511
511
|
}
|
|
512
512
|
}
|
|
513
513
|
c(z, "code", 403);
|
|
514
|
-
class Z extends
|
|
514
|
+
class Z extends g {
|
|
515
515
|
constructor(t = "Not Found") {
|
|
516
516
|
super(t);
|
|
517
517
|
}
|
|
@@ -520,7 +520,7 @@ class Z extends y {
|
|
|
520
520
|
}
|
|
521
521
|
}
|
|
522
522
|
c(Z, "code", 404);
|
|
523
|
-
class V extends
|
|
523
|
+
class V extends g {
|
|
524
524
|
constructor(t = "Method Not Allowed") {
|
|
525
525
|
super(t);
|
|
526
526
|
}
|
|
@@ -529,7 +529,7 @@ class V extends y {
|
|
|
529
529
|
}
|
|
530
530
|
}
|
|
531
531
|
c(V, "code", 405);
|
|
532
|
-
class X extends
|
|
532
|
+
class X extends g {
|
|
533
533
|
constructor(t = "Not Acceptable") {
|
|
534
534
|
super(t);
|
|
535
535
|
}
|
|
@@ -538,7 +538,7 @@ class X extends y {
|
|
|
538
538
|
}
|
|
539
539
|
}
|
|
540
540
|
c(X, "code", 406);
|
|
541
|
-
class Q extends
|
|
541
|
+
class Q extends g {
|
|
542
542
|
constructor(t = "Internal Server Error") {
|
|
543
543
|
super(t);
|
|
544
544
|
}
|
|
@@ -547,7 +547,7 @@ class Q extends y {
|
|
|
547
547
|
}
|
|
548
548
|
}
|
|
549
549
|
c(Q, "code", 500);
|
|
550
|
-
class _ extends
|
|
550
|
+
class _ extends g {
|
|
551
551
|
constructor(t = "Not Implemented") {
|
|
552
552
|
super(t);
|
|
553
553
|
}
|
|
@@ -556,7 +556,7 @@ class _ extends y {
|
|
|
556
556
|
}
|
|
557
557
|
}
|
|
558
558
|
c(_, "code", 501);
|
|
559
|
-
class tt extends
|
|
559
|
+
class tt extends g {
|
|
560
560
|
constructor(t = "Bad Gateway") {
|
|
561
561
|
super(t);
|
|
562
562
|
}
|
|
@@ -565,7 +565,7 @@ class tt extends y {
|
|
|
565
565
|
}
|
|
566
566
|
}
|
|
567
567
|
c(tt, "code", 502);
|
|
568
|
-
class et extends
|
|
568
|
+
class et extends g {
|
|
569
569
|
constructor(t = "Service Unavailable") {
|
|
570
570
|
super(t);
|
|
571
571
|
}
|
|
@@ -574,7 +574,7 @@ class et extends y {
|
|
|
574
574
|
}
|
|
575
575
|
}
|
|
576
576
|
c(et, "code", 503);
|
|
577
|
-
class nt extends
|
|
577
|
+
class nt extends g {
|
|
578
578
|
constructor(t = "Gateway Timeout") {
|
|
579
579
|
super(t);
|
|
580
580
|
}
|
|
@@ -611,7 +611,7 @@ function Gt(n, t) {
|
|
|
611
611
|
case 504:
|
|
612
612
|
return new nt(t);
|
|
613
613
|
default:
|
|
614
|
-
return new
|
|
614
|
+
return new g(t, n);
|
|
615
615
|
}
|
|
616
616
|
}
|
|
617
617
|
const E = class E {
|
|
@@ -648,33 +648,37 @@ const E = class E {
|
|
|
648
648
|
...t.headers
|
|
649
649
|
});
|
|
650
650
|
return typeof t.body == "object" && t.body != null && r["Content-Type"] == "application/json" && (t.body = JSON.stringify(t.body)), new x((i, o, a) => {
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
651
|
+
try {
|
|
652
|
+
fetch(e, {
|
|
653
|
+
headers: r,
|
|
654
|
+
method: t.method || (t.body ? "POST" : "GET"),
|
|
655
|
+
body: t.body
|
|
656
|
+
}).then(async (u) => {
|
|
657
|
+
var G, U;
|
|
658
|
+
for (let l of [...Object.values(E.interceptors), ...Object.values(this.interceptors)])
|
|
659
|
+
await new Promise((C) => l(u, () => C()));
|
|
660
|
+
const $ = u.headers.get("Content-Length"), j = $ ? parseInt($, 10) : 0;
|
|
661
|
+
let P = 0;
|
|
662
|
+
const T = (G = u.body) == null ? void 0 : G.getReader(), rt = new ReadableStream({
|
|
663
|
+
start(l) {
|
|
664
|
+
function C() {
|
|
665
|
+
T == null || T.read().then((A) => {
|
|
666
|
+
if (A.done) return l.close();
|
|
667
|
+
P += A.value.byteLength, a(P / j), l.enqueue(A.value), C();
|
|
668
|
+
}).catch((A) => l.error(A));
|
|
669
|
+
}
|
|
670
|
+
C();
|
|
668
671
|
}
|
|
669
|
-
|
|
672
|
+
});
|
|
673
|
+
if (u.data = new Response(rt), t.decode == null || t.decode) {
|
|
674
|
+
const l = (U = u.headers.get("Content-Type")) == null ? void 0 : U.toLowerCase();
|
|
675
|
+
l != null && l.includes("form") ? u.data = await u.data.formData() : l != null && l.includes("json") ? u.data = await u.data.json() : l != null && l.includes("text") ? u.data = await u.data.text() : l != null && l.includes("application") && (u.data = await u.data.blob());
|
|
670
676
|
}
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
u.ok ? i(u) : o(u);
|
|
677
|
-
});
|
|
677
|
+
u.ok ? i(u) : o(u);
|
|
678
|
+
}).catch((u) => o(u));
|
|
679
|
+
} catch (u) {
|
|
680
|
+
o(u);
|
|
681
|
+
}
|
|
678
682
|
});
|
|
679
683
|
}
|
|
680
684
|
};
|
|
@@ -838,44 +842,44 @@ function Xt(n) {
|
|
|
838
842
|
return e;
|
|
839
843
|
}
|
|
840
844
|
function dt(n) {
|
|
841
|
-
var t = pt(
|
|
845
|
+
var t = pt(gt(wt(yt(n), 8 * n.length)));
|
|
842
846
|
return t.toLowerCase();
|
|
843
847
|
}
|
|
844
848
|
function pt(n) {
|
|
845
849
|
for (var t, e = "0123456789ABCDEF", r = "", s = 0; s < n.length; s++) t = n.charCodeAt(s), r += e.charAt(t >>> 4 & 15) + e.charAt(15 & t);
|
|
846
850
|
return r;
|
|
847
851
|
}
|
|
848
|
-
function
|
|
852
|
+
function yt(n) {
|
|
849
853
|
for (var t = Array(n.length >> 2), e = 0; e < t.length; e++) t[e] = 0;
|
|
850
854
|
for (e = 0; e < 8 * n.length; e += 8) t[e >> 5] |= (255 & n.charCodeAt(e / 8)) << e % 32;
|
|
851
855
|
return t;
|
|
852
856
|
}
|
|
853
|
-
function
|
|
857
|
+
function gt(n) {
|
|
854
858
|
for (var t = "", e = 0; e < 32 * n.length; e += 8) t += String.fromCharCode(n[e >> 5] >>> e % 32 & 255);
|
|
855
859
|
return t;
|
|
856
860
|
}
|
|
857
861
|
function wt(n, t) {
|
|
858
862
|
n[t >> 5] |= 128 << t % 32, n[14 + (t + 64 >>> 9 << 4)] = t;
|
|
859
863
|
for (var e = 1732584193, r = -271733879, s = -1732584194, i = 271733878, o = 0; o < n.length; o += 16) {
|
|
860
|
-
var a = e, u = r, $ = s,
|
|
861
|
-
r = p(r = p(r = p(r = p(r = d(r = d(r = d(r = d(r = h(r = h(r = h(r = h(r = f(r = f(r = f(r = f(r, s = f(s, i = f(i, e = f(e, r, s, i, n[o + 0], 7, -680876936), r, s, n[o + 1], 12, -389564586), e, r, n[o + 2], 17, 606105819), i, e, n[o + 3], 22, -1044525330), s = f(s, i = f(i, e = f(e, r, s, i, n[o + 4], 7, -176418897), r, s, n[o + 5], 12, 1200080426), e, r, n[o + 6], 17, -1473231341), i, e, n[o + 7], 22, -45705983), s = f(s, i = f(i, e = f(e, r, s, i, n[o + 8], 7, 1770035416), r, s, n[o + 9], 12, -1958414417), e, r, n[o + 10], 17, -42063), i, e, n[o + 11], 22, -1990404162), s = f(s, i = f(i, e = f(e, r, s, i, n[o + 12], 7, 1804603682), r, s, n[o + 13], 12, -40341101), e, r, n[o + 14], 17, -1502002290), i, e, n[o + 15], 22, 1236535329), s = h(s, i = h(i, e = h(e, r, s, i, n[o + 1], 5, -165796510), r, s, n[o + 6], 9, -1069501632), e, r, n[o + 11], 14, 643717713), i, e, n[o + 0], 20, -373897302), s = h(s, i = h(i, e = h(e, r, s, i, n[o + 5], 5, -701558691), r, s, n[o + 10], 9, 38016083), e, r, n[o + 15], 14, -660478335), i, e, n[o + 4], 20, -405537848), s = h(s, i = h(i, e = h(e, r, s, i, n[o + 9], 5, 568446438), r, s, n[o + 14], 9, -1019803690), e, r, n[o + 3], 14, -187363961), i, e, n[o + 8], 20, 1163531501), s = h(s, i = h(i, e = h(e, r, s, i, n[o + 13], 5, -1444681467), r, s, n[o + 2], 9, -51403784), e, r, n[o + 7], 14, 1735328473), i, e, n[o + 12], 20, -1926607734), s = d(s, i = d(i, e = d(e, r, s, i, n[o + 5], 4, -378558), r, s, n[o + 8], 11, -2022574463), e, r, n[o + 11], 16, 1839030562), i, e, n[o + 14], 23, -35309556), s = d(s, i = d(i, e = d(e, r, s, i, n[o + 1], 4, -1530992060), r, s, n[o + 4], 11, 1272893353), e, r, n[o + 7], 16, -155497632), i, e, n[o + 10], 23, -1094730640), s = d(s, i = d(i, e = d(e, r, s, i, n[o + 13], 4, 681279174), r, s, n[o + 0], 11, -358537222), e, r, n[o + 3], 16, -722521979), i, e, n[o + 6], 23, 76029189), s = d(s, i = d(i, e = d(e, r, s, i, n[o + 9], 4, -640364487), r, s, n[o + 12], 11, -421815835), e, r, n[o + 15], 16, 530742520), i, e, n[o + 2], 23, -995338651), s = p(s, i = p(i, e = p(e, r, s, i, n[o + 0], 6, -198630844), r, s, n[o + 7], 10, 1126891415), e, r, n[o + 14], 15, -1416354905), i, e, n[o + 5], 21, -57434055), s = p(s, i = p(i, e = p(e, r, s, i, n[o + 12], 6, 1700485571), r, s, n[o + 3], 10, -1894986606), e, r, n[o + 10], 15, -1051523), i, e, n[o + 1], 21, -2054922799), s = p(s, i = p(i, e = p(e, r, s, i, n[o + 8], 6, 1873313359), r, s, n[o + 15], 10, -30611744), e, r, n[o + 6], 15, -1560198380), i, e, n[o + 13], 21, 1309151649), s = p(s, i = p(i, e = p(e, r, s, i, n[o + 4], 6, -145523070), r, s, n[o + 11], 10, -1120210379), e, r, n[o + 2], 15, 718787259), i, e, n[o + 9], 21, -343485551), e = b(e, a), r = b(r, u), s = b(s, $), i = b(i,
|
|
864
|
+
var a = e, u = r, $ = s, j = i;
|
|
865
|
+
r = p(r = p(r = p(r = p(r = d(r = d(r = d(r = d(r = h(r = h(r = h(r = h(r = f(r = f(r = f(r = f(r, s = f(s, i = f(i, e = f(e, r, s, i, n[o + 0], 7, -680876936), r, s, n[o + 1], 12, -389564586), e, r, n[o + 2], 17, 606105819), i, e, n[o + 3], 22, -1044525330), s = f(s, i = f(i, e = f(e, r, s, i, n[o + 4], 7, -176418897), r, s, n[o + 5], 12, 1200080426), e, r, n[o + 6], 17, -1473231341), i, e, n[o + 7], 22, -45705983), s = f(s, i = f(i, e = f(e, r, s, i, n[o + 8], 7, 1770035416), r, s, n[o + 9], 12, -1958414417), e, r, n[o + 10], 17, -42063), i, e, n[o + 11], 22, -1990404162), s = f(s, i = f(i, e = f(e, r, s, i, n[o + 12], 7, 1804603682), r, s, n[o + 13], 12, -40341101), e, r, n[o + 14], 17, -1502002290), i, e, n[o + 15], 22, 1236535329), s = h(s, i = h(i, e = h(e, r, s, i, n[o + 1], 5, -165796510), r, s, n[o + 6], 9, -1069501632), e, r, n[o + 11], 14, 643717713), i, e, n[o + 0], 20, -373897302), s = h(s, i = h(i, e = h(e, r, s, i, n[o + 5], 5, -701558691), r, s, n[o + 10], 9, 38016083), e, r, n[o + 15], 14, -660478335), i, e, n[o + 4], 20, -405537848), s = h(s, i = h(i, e = h(e, r, s, i, n[o + 9], 5, 568446438), r, s, n[o + 14], 9, -1019803690), e, r, n[o + 3], 14, -187363961), i, e, n[o + 8], 20, 1163531501), s = h(s, i = h(i, e = h(e, r, s, i, n[o + 13], 5, -1444681467), r, s, n[o + 2], 9, -51403784), e, r, n[o + 7], 14, 1735328473), i, e, n[o + 12], 20, -1926607734), s = d(s, i = d(i, e = d(e, r, s, i, n[o + 5], 4, -378558), r, s, n[o + 8], 11, -2022574463), e, r, n[o + 11], 16, 1839030562), i, e, n[o + 14], 23, -35309556), s = d(s, i = d(i, e = d(e, r, s, i, n[o + 1], 4, -1530992060), r, s, n[o + 4], 11, 1272893353), e, r, n[o + 7], 16, -155497632), i, e, n[o + 10], 23, -1094730640), s = d(s, i = d(i, e = d(e, r, s, i, n[o + 13], 4, 681279174), r, s, n[o + 0], 11, -358537222), e, r, n[o + 3], 16, -722521979), i, e, n[o + 6], 23, 76029189), s = d(s, i = d(i, e = d(e, r, s, i, n[o + 9], 4, -640364487), r, s, n[o + 12], 11, -421815835), e, r, n[o + 15], 16, 530742520), i, e, n[o + 2], 23, -995338651), s = p(s, i = p(i, e = p(e, r, s, i, n[o + 0], 6, -198630844), r, s, n[o + 7], 10, 1126891415), e, r, n[o + 14], 15, -1416354905), i, e, n[o + 5], 21, -57434055), s = p(s, i = p(i, e = p(e, r, s, i, n[o + 12], 6, 1700485571), r, s, n[o + 3], 10, -1894986606), e, r, n[o + 10], 15, -1051523), i, e, n[o + 1], 21, -2054922799), s = p(s, i = p(i, e = p(e, r, s, i, n[o + 8], 6, 1873313359), r, s, n[o + 15], 10, -30611744), e, r, n[o + 6], 15, -1560198380), i, e, n[o + 13], 21, 1309151649), s = p(s, i = p(i, e = p(e, r, s, i, n[o + 4], 6, -145523070), r, s, n[o + 11], 10, -1120210379), e, r, n[o + 2], 15, 718787259), i, e, n[o + 9], 21, -343485551), e = b(e, a), r = b(r, u), s = b(s, $), i = b(i, j);
|
|
862
866
|
}
|
|
863
867
|
return Array(e, r, s, i);
|
|
864
868
|
}
|
|
865
|
-
function
|
|
869
|
+
function N(n, t, e, r, s, i) {
|
|
866
870
|
return b(Et(b(b(t, n), b(r, i)), s), e);
|
|
867
871
|
}
|
|
868
872
|
function f(n, t, e, r, s, i, o) {
|
|
869
|
-
return
|
|
873
|
+
return N(t & e | ~t & r, n, t, s, i, o);
|
|
870
874
|
}
|
|
871
875
|
function h(n, t, e, r, s, i, o) {
|
|
872
|
-
return
|
|
876
|
+
return N(t & r | e & ~r, n, t, s, i, o);
|
|
873
877
|
}
|
|
874
878
|
function d(n, t, e, r, s, i, o) {
|
|
875
|
-
return
|
|
879
|
+
return N(t ^ e ^ r, n, t, s, i, o);
|
|
876
880
|
}
|
|
877
881
|
function p(n, t, e, r, s, i, o) {
|
|
878
|
-
return
|
|
882
|
+
return N(e ^ (t | ~r), n, t, s, i, o);
|
|
879
883
|
}
|
|
880
884
|
function b(n, t) {
|
|
881
885
|
var e = (65535 & n) + (65535 & t);
|
|
@@ -897,16 +901,16 @@ function ee(n, ...t) {
|
|
|
897
901
|
const e = [];
|
|
898
902
|
for (let r = 0; r < n.length || r < t.length; r++)
|
|
899
903
|
n[r] && e.push(n[r]), t[r] && e.push(t[r]);
|
|
900
|
-
return new
|
|
904
|
+
return new y(e.join(""));
|
|
901
905
|
}
|
|
902
906
|
function mt(n, ...t) {
|
|
903
907
|
let e = [];
|
|
904
908
|
for (let i = 0; i < n.length || i < t.length; i++)
|
|
905
909
|
n[i] && e.push(n[i]), t[i] && e.push(t[i]);
|
|
906
910
|
const [r, s] = e.join("").split(":");
|
|
907
|
-
return
|
|
911
|
+
return y.toString(r, s == null ? void 0 : s.split(""));
|
|
908
912
|
}
|
|
909
|
-
class
|
|
913
|
+
class y {
|
|
910
914
|
constructor(t) {
|
|
911
915
|
/** First directory in path */
|
|
912
916
|
c(this, "module");
|
|
@@ -946,7 +950,7 @@ class g {
|
|
|
946
950
|
*/
|
|
947
951
|
static combine(t) {
|
|
948
952
|
let e = !1;
|
|
949
|
-
const r = t.map((s) => new
|
|
953
|
+
const r = t.map((s) => new y(s)).toSorted((s, i) => {
|
|
950
954
|
const o = s.fullPath.length, a = i.fullPath.length;
|
|
951
955
|
return o < a ? 1 : o > a ? -1 : 0;
|
|
952
956
|
}).reduce((s, i) => (i.none && (e = !0), s ? (e || (i.all && (s.all = !0), (i.all || i.create) && (s.create = !0), (i.all || i.read) && (s.read = !0), (i.all || i.update) && (s.update = !0), (i.all || i.delete) && (s.delete = !0), s.methods = [...s.methods, ...i.methods]), s) : i), null);
|
|
@@ -960,12 +964,12 @@ class g {
|
|
|
960
964
|
* @return {boolean} Whether there is any overlap
|
|
961
965
|
*/
|
|
962
966
|
static has(t, ...e) {
|
|
963
|
-
const r = m(e).map((i) => new
|
|
967
|
+
const r = m(e).map((i) => new y(i)), s = m(t).map((i) => new y(i));
|
|
964
968
|
return !!r.find((i) => {
|
|
965
969
|
if (!i.fullPath && i.all) return !0;
|
|
966
970
|
const o = s.filter((u) => i.fullPath.startsWith(u.fullPath));
|
|
967
971
|
if (!o.length) return !1;
|
|
968
|
-
const a =
|
|
972
|
+
const a = y.combine(o);
|
|
969
973
|
return !a.none && (a.all || new S(a.methods).intersection(new S(i.methods)).length);
|
|
970
974
|
});
|
|
971
975
|
}
|
|
@@ -977,7 +981,7 @@ class g {
|
|
|
977
981
|
* @return {boolean} Whether there is any overlap
|
|
978
982
|
*/
|
|
979
983
|
static hasAll(t, ...e) {
|
|
980
|
-
return e.filter((r) =>
|
|
984
|
+
return e.filter((r) => y.has(t, r)).length == e.length;
|
|
981
985
|
}
|
|
982
986
|
/**
|
|
983
987
|
* Same as `has` but raises an error if there is no overlap
|
|
@@ -986,7 +990,7 @@ class g {
|
|
|
986
990
|
* @param has Target must have at least one of these path
|
|
987
991
|
*/
|
|
988
992
|
static hasFatal(t, ...e) {
|
|
989
|
-
if (!
|
|
993
|
+
if (!y.has(t, ...e)) throw new Error(`Requires one of: ${m(e).join(", ")}`);
|
|
990
994
|
}
|
|
991
995
|
/**
|
|
992
996
|
* Same as `hasAll` but raises an error if the target is missing any paths
|
|
@@ -995,7 +999,7 @@ class g {
|
|
|
995
999
|
* @param has Target must have all these paths
|
|
996
1000
|
*/
|
|
997
1001
|
static hasAllFatal(t, ...e) {
|
|
998
|
-
if (!
|
|
1002
|
+
if (!y.hasAll(t, ...e)) throw new Error(`Requires all: ${m(e).join(", ")}`);
|
|
999
1003
|
}
|
|
1000
1004
|
/**
|
|
1001
1005
|
* Create event string from its components
|
|
@@ -1014,7 +1018,7 @@ class g {
|
|
|
1014
1018
|
* @return {string} String representation of Event
|
|
1015
1019
|
*/
|
|
1016
1020
|
toString() {
|
|
1017
|
-
return
|
|
1021
|
+
return y.toString(this.fullPath, this.methods);
|
|
1018
1022
|
}
|
|
1019
1023
|
}
|
|
1020
1024
|
class ne {
|
|
@@ -1022,14 +1026,14 @@ class ne {
|
|
|
1022
1026
|
c(this, "listeners", []);
|
|
1023
1027
|
}
|
|
1024
1028
|
emit(t, ...e) {
|
|
1025
|
-
const r = new
|
|
1026
|
-
this.listeners.filter((s) =>
|
|
1029
|
+
const r = new y(t);
|
|
1030
|
+
this.listeners.filter((s) => y.has(s[0], t)).forEach(async (s) => s[1](r, ...e));
|
|
1027
1031
|
}
|
|
1028
1032
|
off(t) {
|
|
1029
1033
|
this.listeners = this.listeners.filter((e) => e[1] != t);
|
|
1030
1034
|
}
|
|
1031
1035
|
on(t, e) {
|
|
1032
|
-
return m(t).forEach((r) => this.listeners.push([new
|
|
1036
|
+
return m(t).forEach((r) => this.listeners.push([new y(r), e])), () => this.off(e);
|
|
1033
1037
|
}
|
|
1034
1038
|
once(t, e) {
|
|
1035
1039
|
return new Promise((r) => {
|
|
@@ -1067,7 +1071,7 @@ export {
|
|
|
1067
1071
|
qt as CliBackground,
|
|
1068
1072
|
R as CliEffects,
|
|
1069
1073
|
L as CliForeground,
|
|
1070
|
-
|
|
1074
|
+
g as CustomError,
|
|
1071
1075
|
z as ForbiddenError,
|
|
1072
1076
|
nt as GatewayTimeoutError,
|
|
1073
1077
|
F as Http,
|
|
@@ -1082,7 +1086,7 @@ export {
|
|
|
1082
1086
|
_ as NotImplementedError,
|
|
1083
1087
|
ee as PE,
|
|
1084
1088
|
mt as PES,
|
|
1085
|
-
|
|
1089
|
+
y as PathEvent,
|
|
1086
1090
|
ne as PathEventEmitter,
|
|
1087
1091
|
J as PaymentRequiredError,
|
|
1088
1092
|
x as PromiseProgress,
|
|
@@ -1104,7 +1108,7 @@ export {
|
|
|
1104
1108
|
Gt as errorFromCode,
|
|
1105
1109
|
te as escapeRegex,
|
|
1106
1110
|
Mt as fileBrowser,
|
|
1107
|
-
|
|
1111
|
+
Nt as findByProp,
|
|
1108
1112
|
ut as flattenArr,
|
|
1109
1113
|
H as flattenObj,
|
|
1110
1114
|
At as formData,
|
|
@@ -1129,7 +1133,7 @@ export {
|
|
|
1129
1133
|
Zt as randomStringBuilder,
|
|
1130
1134
|
St as sleep,
|
|
1131
1135
|
se as sleepWhile,
|
|
1132
|
-
|
|
1136
|
+
jt as sortByProp,
|
|
1133
1137
|
ie as timeUntil,
|
|
1134
1138
|
kt as timestampFilename,
|
|
1135
1139
|
oe as tyoeKeys,
|