@usecontextlayer/ctxe 0.3.4 → 0.3.5
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/cli.mjs +353 -1171
- package/package.json +3 -3
package/dist/cli.mjs
CHANGED
|
@@ -256,7 +256,7 @@ var Ss = {
|
|
|
256
256
|
!0
|
|
257
257
|
];
|
|
258
258
|
};
|
|
259
|
-
var W
|
|
259
|
+
var W = (n, { windowsPathsNoEscape: t = !1, magicalBraces: e = !0 } = {}) => e ? t ? n.replace(/\[([^\/\\])\]/g, "$1") : n.replace(/((?!\\).|^)\[([^\/\\])\]/g, "$1$2").replace(/\\([^\/])/g, "$1") : t ? n.replace(/\[([^\/\\{}])\]/g, "$1") : n.replace(/((?!\\).|^)\[([^\/\\{}])\]/g, "$1$2").replace(/\\([^\/{}])/g, "$1");
|
|
260
260
|
var xs = new Set([
|
|
261
261
|
"!",
|
|
262
262
|
"?",
|
|
@@ -428,7 +428,7 @@ var xs = new Set([
|
|
|
428
428
|
let c = "";
|
|
429
429
|
return this.isEnd() && this.#t.#c && this.#o?.type === "!" && (c = "(?:$|\\/)"), [
|
|
430
430
|
u + l + c,
|
|
431
|
-
W
|
|
431
|
+
W(l),
|
|
432
432
|
this.#s = !!this.#s,
|
|
433
433
|
this.#n
|
|
434
434
|
];
|
|
@@ -438,7 +438,7 @@ var xs = new Set([
|
|
|
438
438
|
let a = this.toString();
|
|
439
439
|
return this.#r = [a], this.type = null, this.#s = void 0, [
|
|
440
440
|
a,
|
|
441
|
-
W
|
|
441
|
+
W(this.toString()),
|
|
442
442
|
!1,
|
|
443
443
|
!1
|
|
444
444
|
];
|
|
@@ -453,7 +453,7 @@ var xs = new Set([
|
|
|
453
453
|
}
|
|
454
454
|
return [
|
|
455
455
|
h,
|
|
456
|
-
W
|
|
456
|
+
W(r),
|
|
457
457
|
this.#s = !!this.#s,
|
|
458
458
|
this.#n
|
|
459
459
|
];
|
|
@@ -497,14 +497,14 @@ var xs = new Set([
|
|
|
497
497
|
}
|
|
498
498
|
return [
|
|
499
499
|
r,
|
|
500
|
-
W
|
|
500
|
+
W(t),
|
|
501
501
|
!!e,
|
|
502
502
|
o
|
|
503
503
|
];
|
|
504
504
|
}
|
|
505
505
|
};
|
|
506
506
|
var tt = (n, { windowsPathsNoEscape: t = !1, magicalBraces: e = !1 } = {}) => e ? t ? n.replace(/[?*()[\]{}]/g, "[$&]") : n.replace(/[?*()[\]\\{}]/g, "\\$&") : t ? n.replace(/[?*()[\]]/g, "[$&]") : n.replace(/[?*()[\]\\]/g, "\\$&");
|
|
507
|
-
var O$
|
|
507
|
+
var O$1 = (n, t, e = {}) => (at(t), !e.nocomment && t.charAt(0) === "#" ? !1 : new D$1(t, e).match(n)), Rs = /^\*+([^+@!?\*\[\(]*)$/, Os = (n) => (t) => !t.startsWith(".") && t.endsWith(n), Fs = (n) => (t) => t.endsWith(n), Ds = (n) => (n = n.toLowerCase(), (t) => !t.startsWith(".") && t.toLowerCase().endsWith(n)), Ms = (n) => (n = n.toLowerCase(), (t) => t.toLowerCase().endsWith(n)), Ns = /^\*+\.\*+$/, _s = (n) => !n.startsWith(".") && n.includes("."), Ls = (n) => n !== "." && n !== ".." && n.includes("."), Ws = /^\.\*+$/, Ps = (n) => n !== "." && n !== ".." && n.startsWith("."), js = /^\*+$/, Is = (n) => n.length !== 0 && !n.startsWith("."), zs = (n) => n.length !== 0 && n !== "." && n !== "..", Bs = /^\?+([^+@!?\*\[\(]*)?$/, Us = ([n, t = ""]) => {
|
|
508
508
|
let e = Ce([n]);
|
|
509
509
|
return t ? (t = t.toLowerCase(), (s) => e(s) && s.toLowerCase().endsWith(t)) : e;
|
|
510
510
|
}, $s = ([n, t = ""]) => {
|
|
@@ -526,14 +526,14 @@ var O$2 = (n, t, e = {}) => (at(t), !e.nocomment && t.charAt(0) === "#" ? !1 : n
|
|
|
526
526
|
win32: { sep: "\\" },
|
|
527
527
|
posix: { sep: "/" }
|
|
528
528
|
};
|
|
529
|
-
O$
|
|
530
|
-
var A$
|
|
531
|
-
O$
|
|
532
|
-
var Vs = "[^/]*?", Ys = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?", Xs = "(?:(?!(?:\\/|^)\\.).)*?", Js = (n, t = {}) => (e) => O$
|
|
533
|
-
O$
|
|
529
|
+
O$1.sep = Ae === "win32" ? xe.win32.sep : xe.posix.sep;
|
|
530
|
+
var A$1 = Symbol("globstar **");
|
|
531
|
+
O$1.GLOBSTAR = A$1;
|
|
532
|
+
var Vs = "[^/]*?", Ys = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?", Xs = "(?:(?!(?:\\/|^)\\.).)*?", Js = (n, t = {}) => (e) => O$1(e, n, t);
|
|
533
|
+
O$1.filter = Js;
|
|
534
534
|
var N$1 = (n, t = {}) => Object.assign({}, n, t), Zs = (n) => {
|
|
535
|
-
if (!n || typeof n != "object" || !Object.keys(n).length) return O$
|
|
536
|
-
let t = O$
|
|
535
|
+
if (!n || typeof n != "object" || !Object.keys(n).length) return O$1;
|
|
536
|
+
let t = O$1;
|
|
537
537
|
return Object.assign((s, i, r = {}) => t(s, i, N$1(n, r)), {
|
|
538
538
|
Minimatch: class extends t.Minimatch {
|
|
539
539
|
constructor(i, r = {}) {
|
|
@@ -559,20 +559,20 @@ var N$1 = (n, t = {}) => Object.assign({}, n, t), Zs = (n) => {
|
|
|
559
559
|
braceExpand: (s, i = {}) => t.braceExpand(s, N$1(n, i)),
|
|
560
560
|
match: (s, i, r = {}) => t.match(s, i, N$1(n, r)),
|
|
561
561
|
sep: t.sep,
|
|
562
|
-
GLOBSTAR: A$
|
|
562
|
+
GLOBSTAR: A$1
|
|
563
563
|
});
|
|
564
564
|
};
|
|
565
|
-
O$
|
|
565
|
+
O$1.defaults = Zs;
|
|
566
566
|
var ke = (n, t = {}) => (at(n), t.nobrace || !/\{(?:(?!\{).)*\}/.test(n) ? [n] : ge(n, { max: t.braceExpandMax }));
|
|
567
|
-
O$
|
|
568
|
-
var Qs = (n, t = {}) => new D$
|
|
569
|
-
O$
|
|
567
|
+
O$1.braceExpand = ke;
|
|
568
|
+
var Qs = (n, t = {}) => new D$1(n, t).makeRe();
|
|
569
|
+
O$1.makeRe = Qs;
|
|
570
570
|
var ti = (n, t, e = {}) => {
|
|
571
|
-
let s = new D$
|
|
571
|
+
let s = new D$1(t, e);
|
|
572
572
|
return n = n.filter((i) => s.match(i)), s.options.nonull && !n.length && n.push(t), n;
|
|
573
573
|
};
|
|
574
|
-
O$
|
|
575
|
-
var ve = /[?*]|[+@!]\(.*?\)|\[|\]/, ei = (n) => n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), D$
|
|
574
|
+
O$1.match = ti;
|
|
575
|
+
var ve = /[?*]|[+@!]\(.*?\)|\[|\]/, ei = (n) => n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), D$1 = class {
|
|
576
576
|
options;
|
|
577
577
|
set;
|
|
578
578
|
pattern;
|
|
@@ -753,7 +753,7 @@ var ve = /[?*]|[+@!]\(.*?\)|\[|\]/, ei = (n) => n.replace(/[-[\]{}()*+?.,\\^$|#\
|
|
|
753
753
|
this.debug("matchOne loop");
|
|
754
754
|
var u = e[h], c = t[o];
|
|
755
755
|
if (this.debug(e, u, c), u === !1) return !1;
|
|
756
|
-
if (u === A$
|
|
756
|
+
if (u === A$1) {
|
|
757
757
|
this.debug("GLOBSTAR", [
|
|
758
758
|
e,
|
|
759
759
|
u,
|
|
@@ -791,7 +791,7 @@ globstar while`, t, d, e, f, m), this.matchOne(t.slice(d), e.slice(f), s)) retur
|
|
|
791
791
|
parse(t) {
|
|
792
792
|
at(t);
|
|
793
793
|
let e = this.options;
|
|
794
|
-
if (t === "**") return A$
|
|
794
|
+
if (t === "**") return A$1;
|
|
795
795
|
if (t === "") return "";
|
|
796
796
|
let s, i = null;
|
|
797
797
|
(s = t.match(js)) ? i = e.dot ? zs : Is : (s = t.match(Rs)) ? i = (e.nocase ? e.dot ? Ms : Ds : e.dot ? Fs : Os)(s[1]) : (s = t.match(Bs)) ? i = (e.nocase ? e.dot ? $s : Us : e.dot ? Gs : Hs)(s) : (s = t.match(Ns)) ? i = e.dot ? Ls : _s : (s = t.match(Ws)) && (i = Ps);
|
|
@@ -805,13 +805,13 @@ globstar while`, t, d, e, f, m), this.matchOne(t.slice(d), e.slice(f), s)) retur
|
|
|
805
805
|
let e = this.options, s = e.noglobstar ? Vs : e.dot ? Ys : Xs, i = new Set(e.nocase ? ["i"] : []), r = t.map((a) => {
|
|
806
806
|
let l = a.map((c) => {
|
|
807
807
|
if (c instanceof RegExp) for (let d of c.flags.split("")) i.add(d);
|
|
808
|
-
return typeof c == "string" ? ei(c) : c === A$
|
|
808
|
+
return typeof c == "string" ? ei(c) : c === A$1 ? A$1 : c._src;
|
|
809
809
|
});
|
|
810
810
|
l.forEach((c, d) => {
|
|
811
811
|
let f = l[d + 1], m = l[d - 1];
|
|
812
|
-
c !== A$
|
|
812
|
+
c !== A$1 || m === A$1 || (m === void 0 ? f !== void 0 && f !== A$1 ? l[d + 1] = "(?:\\/|" + s + "\\/)?" + f : l[d] = s : f === void 0 ? l[d - 1] = m + "(?:\\/|\\/" + s + ")?" : f !== A$1 && (l[d - 1] = m + "(?:\\/|\\/" + s + "\\/)" + f, l[d + 1] = A$1));
|
|
813
813
|
});
|
|
814
|
-
let u = l.filter((c) => c !== A$
|
|
814
|
+
let u = l.filter((c) => c !== A$1);
|
|
815
815
|
if (this.partial && u.length >= 1) {
|
|
816
816
|
let c = [];
|
|
817
817
|
for (let d = 1; d <= u.length; d++) c.push(u.slice(0, d).join("/"));
|
|
@@ -849,13 +849,13 @@ globstar while`, t, d, e, f, m), this.matchOne(t.slice(d), e.slice(f), s)) retur
|
|
|
849
849
|
return s.flipNegate ? !1 : this.negate;
|
|
850
850
|
}
|
|
851
851
|
static defaults(t) {
|
|
852
|
-
return O$
|
|
852
|
+
return O$1.defaults(t).Minimatch;
|
|
853
853
|
}
|
|
854
854
|
};
|
|
855
|
-
O$
|
|
856
|
-
O$
|
|
857
|
-
O$
|
|
858
|
-
O$
|
|
855
|
+
O$1.AST = Q;
|
|
856
|
+
O$1.Minimatch = D$1;
|
|
857
|
+
O$1.escape = tt;
|
|
858
|
+
O$1.unescape = W;
|
|
859
859
|
var si = typeof performance == "object" && performance && typeof performance.now == "function" ? performance : Date, Oe = /* @__PURE__ */ new Set(), Vt = typeof process == "object" && process ? process : {}, Fe = (n, t, e, s) => {
|
|
860
860
|
typeof Vt.emitWarning == "function" ? Vt.emitWarning(n, t, e, s) : console.error(`[${e}] ${t}: ${n}`);
|
|
861
861
|
}, At = globalThis.AbortController, Re = globalThis.AbortSignal;
|
|
@@ -1454,7 +1454,7 @@ var q = (n) => n && n === Math.floor(n) && n > 0 && isFinite(n), De = (n) => q(n
|
|
|
1454
1454
|
var Ne = typeof process == "object" && process ? process : {
|
|
1455
1455
|
stdout: null,
|
|
1456
1456
|
stderr: null
|
|
1457
|
-
}, oi = (n) => !!n && typeof n == "object" && (n instanceof V || n instanceof Pe || hi(n) || ai(n)), hi = (n) => !!n && typeof n == "object" && n instanceof EventEmitter && typeof n.pipe == "function" && n.pipe !== Pe.Writable.prototype.pipe, ai = (n) => !!n && typeof n == "object" && n instanceof EventEmitter && typeof n.write == "function" && typeof n.end == "function", G$1 = Symbol("EOF"), H = Symbol("maybeEmitEnd"), K = Symbol("emittedEnd"), kt = Symbol("emittingEnd"), ut = Symbol("emittedError"), Rt = Symbol("closed"), _e = Symbol("read"), Ot = Symbol("flush"), Le = Symbol("flushChunk"), P
|
|
1457
|
+
}, oi = (n) => !!n && typeof n == "object" && (n instanceof V || n instanceof Pe || hi(n) || ai(n)), hi = (n) => !!n && typeof n == "object" && n instanceof EventEmitter && typeof n.pipe == "function" && n.pipe !== Pe.Writable.prototype.pipe, ai = (n) => !!n && typeof n == "object" && n instanceof EventEmitter && typeof n.write == "function" && typeof n.end == "function", G$1 = Symbol("EOF"), H = Symbol("maybeEmitEnd"), K = Symbol("emittedEnd"), kt = Symbol("emittingEnd"), ut = Symbol("emittedError"), Rt = Symbol("closed"), _e = Symbol("read"), Ot = Symbol("flush"), Le = Symbol("flushChunk"), P = Symbol("encoding"), et = Symbol("decoder"), v = Symbol("flowing"), dt = Symbol("paused"), st = Symbol("resume"), C$1 = Symbol("buffer"), F$1 = Symbol("pipes"), T$1 = Symbol("bufferLength"), Yt = Symbol("bufferPush"), Ft = Symbol("bufferShift"), k = Symbol("objectMode"), x = Symbol("destroyed"), Xt = Symbol("error"), Jt = Symbol("emitData"), We = Symbol("emitEnd"), Zt = Symbol("emitEnd2"), B = Symbol("async"), Qt = Symbol("abort"), Dt = Symbol("aborted"), pt = Symbol("signal"), Y = Symbol("dataListeners"), M = Symbol("discarded"), mt = (n) => Promise.resolve().then(n), li = (n) => n(), ci = (n) => n === "end" || n === "finish" || n === "prefinish", fi = (n) => n instanceof ArrayBuffer || !!n && typeof n == "object" && n.constructor && n.constructor.name === "ArrayBuffer" && n.byteLength >= 0, ui = (n) => !Buffer.isBuffer(n) && ArrayBuffer.isView(n), Mt = class {
|
|
1458
1458
|
src;
|
|
1459
1459
|
dest;
|
|
1460
1460
|
opts;
|
|
@@ -1477,12 +1477,12 @@ var Ne = typeof process == "object" && process ? process : {
|
|
|
1477
1477
|
super(t, e, s), this.proxyErrors = (i) => this.dest.emit("error", i), t.on("error", this.proxyErrors);
|
|
1478
1478
|
}
|
|
1479
1479
|
}, di = (n) => !!n.objectMode, pi = (n) => !n.objectMode && !!n.encoding && n.encoding !== "buffer", V = class extends EventEmitter {
|
|
1480
|
-
[v
|
|
1480
|
+
[v] = !1;
|
|
1481
1481
|
[dt] = !1;
|
|
1482
1482
|
[F$1] = [];
|
|
1483
|
-
[C$
|
|
1484
|
-
[k
|
|
1485
|
-
[P
|
|
1483
|
+
[C$1] = [];
|
|
1484
|
+
[k];
|
|
1485
|
+
[P];
|
|
1486
1486
|
[B];
|
|
1487
1487
|
[et];
|
|
1488
1488
|
[G$1] = !1;
|
|
@@ -1490,8 +1490,8 @@ var Ne = typeof process == "object" && process ? process : {
|
|
|
1490
1490
|
[kt] = !1;
|
|
1491
1491
|
[Rt] = !1;
|
|
1492
1492
|
[ut] = null;
|
|
1493
|
-
[T$
|
|
1494
|
-
[x
|
|
1493
|
+
[T$1] = 0;
|
|
1494
|
+
[x] = !1;
|
|
1495
1495
|
[pt];
|
|
1496
1496
|
[Dt] = !1;
|
|
1497
1497
|
[Y] = 0;
|
|
@@ -1501,15 +1501,15 @@ var Ne = typeof process == "object" && process ? process : {
|
|
|
1501
1501
|
constructor(...t) {
|
|
1502
1502
|
let e = t[0] || {};
|
|
1503
1503
|
if (super(), e.objectMode && typeof e.encoding == "string") throw new TypeError("Encoding and objectMode may not be used together");
|
|
1504
|
-
di(e) ? (this[k
|
|
1504
|
+
di(e) ? (this[k] = !0, this[P] = null) : pi(e) ? (this[P] = e.encoding, this[k] = !1) : (this[k] = !1, this[P] = null), this[B] = !!e.async, this[et] = this[P] ? new StringDecoder(this[P]) : null, e && e.debugExposeBuffer === !0 && Object.defineProperty(this, "buffer", { get: () => this[C$1] }), e && e.debugExposePipes === !0 && Object.defineProperty(this, "pipes", { get: () => this[F$1] });
|
|
1505
1505
|
let { signal: s } = e;
|
|
1506
1506
|
s && (this[pt] = s, s.aborted ? this[Qt]() : s.addEventListener("abort", () => this[Qt]()));
|
|
1507
1507
|
}
|
|
1508
1508
|
get bufferLength() {
|
|
1509
|
-
return this[T$
|
|
1509
|
+
return this[T$1];
|
|
1510
1510
|
}
|
|
1511
1511
|
get encoding() {
|
|
1512
|
-
return this[P
|
|
1512
|
+
return this[P];
|
|
1513
1513
|
}
|
|
1514
1514
|
set encoding(t) {
|
|
1515
1515
|
throw new Error("Encoding must be set at instantiation time");
|
|
@@ -1518,7 +1518,7 @@ var Ne = typeof process == "object" && process ? process : {
|
|
|
1518
1518
|
throw new Error("Encoding must be set at instantiation time");
|
|
1519
1519
|
}
|
|
1520
1520
|
get objectMode() {
|
|
1521
|
-
return this[k
|
|
1521
|
+
return this[k];
|
|
1522
1522
|
}
|
|
1523
1523
|
set objectMode(t) {
|
|
1524
1524
|
throw new Error("objectMode must be set at instantiation time");
|
|
@@ -1539,83 +1539,83 @@ var Ne = typeof process == "object" && process ? process : {
|
|
|
1539
1539
|
write(t, e, s) {
|
|
1540
1540
|
if (this[Dt]) return !1;
|
|
1541
1541
|
if (this[G$1]) throw new Error("write after end");
|
|
1542
|
-
if (this[x
|
|
1542
|
+
if (this[x]) return this.emit("error", Object.assign(/* @__PURE__ */ new Error("Cannot call write after a stream was destroyed"), { code: "ERR_STREAM_DESTROYED" })), !0;
|
|
1543
1543
|
typeof e == "function" && (s = e, e = "utf8"), e || (e = "utf8");
|
|
1544
1544
|
let i = this[B] ? mt : li;
|
|
1545
|
-
if (!this[k
|
|
1545
|
+
if (!this[k] && !Buffer.isBuffer(t)) {
|
|
1546
1546
|
if (ui(t)) t = Buffer.from(t.buffer, t.byteOffset, t.byteLength);
|
|
1547
1547
|
else if (fi(t)) t = Buffer.from(t);
|
|
1548
1548
|
else if (typeof t != "string") throw new Error("Non-contiguous data written to non-objectMode stream");
|
|
1549
1549
|
}
|
|
1550
|
-
return this[k
|
|
1550
|
+
return this[k] ? (this[v] && this[T$1] !== 0 && this[Ot](!0), this[v] ? this.emit("data", t) : this[Yt](t), this[T$1] !== 0 && this.emit("readable"), s && i(s), this[v]) : t.length ? (typeof t == "string" && !(e === this[P] && !this[et]?.lastNeed) && (t = Buffer.from(t, e)), Buffer.isBuffer(t) && this[P] && (t = this[et].write(t)), this[v] && this[T$1] !== 0 && this[Ot](!0), this[v] ? this.emit("data", t) : this[Yt](t), this[T$1] !== 0 && this.emit("readable"), s && i(s), this[v]) : (this[T$1] !== 0 && this.emit("readable"), s && i(s), this[v]);
|
|
1551
1551
|
}
|
|
1552
1552
|
read(t) {
|
|
1553
|
-
if (this[x
|
|
1554
|
-
if (this[M] = !1, this[T$
|
|
1555
|
-
this[k
|
|
1556
|
-
let e = this[_e](t || null, this[C$
|
|
1553
|
+
if (this[x]) return null;
|
|
1554
|
+
if (this[M] = !1, this[T$1] === 0 || t === 0 || t && t > this[T$1]) return this[H](), null;
|
|
1555
|
+
this[k] && (t = null), this[C$1].length > 1 && !this[k] && (this[C$1] = [this[P] ? this[C$1].join("") : Buffer.concat(this[C$1], this[T$1])]);
|
|
1556
|
+
let e = this[_e](t || null, this[C$1][0]);
|
|
1557
1557
|
return this[H](), e;
|
|
1558
1558
|
}
|
|
1559
1559
|
[_e](t, e) {
|
|
1560
|
-
if (this[k
|
|
1560
|
+
if (this[k]) this[Ft]();
|
|
1561
1561
|
else {
|
|
1562
1562
|
let s = e;
|
|
1563
|
-
t === s.length || t === null ? this[Ft]() : typeof s == "string" ? (this[C$
|
|
1563
|
+
t === s.length || t === null ? this[Ft]() : typeof s == "string" ? (this[C$1][0] = s.slice(t), e = s.slice(0, t), this[T$1] -= t) : (this[C$1][0] = s.subarray(t), e = s.subarray(0, t), this[T$1] -= t);
|
|
1564
1564
|
}
|
|
1565
|
-
return this.emit("data", e), !this[C$
|
|
1565
|
+
return this.emit("data", e), !this[C$1].length && !this[G$1] && this.emit("drain"), e;
|
|
1566
1566
|
}
|
|
1567
1567
|
end(t, e, s) {
|
|
1568
|
-
return typeof t == "function" && (s = t, t = void 0), typeof e == "function" && (s = e, e = "utf8"), t !== void 0 && this.write(t, e), s && this.once("end", s), this[G$1] = !0, this.writable = !1, (this[v
|
|
1568
|
+
return typeof t == "function" && (s = t, t = void 0), typeof e == "function" && (s = e, e = "utf8"), t !== void 0 && this.write(t, e), s && this.once("end", s), this[G$1] = !0, this.writable = !1, (this[v] || !this[dt]) && this[H](), this;
|
|
1569
1569
|
}
|
|
1570
1570
|
[st]() {
|
|
1571
|
-
this[x
|
|
1571
|
+
this[x] || (!this[Y] && !this[F$1].length && (this[M] = !0), this[dt] = !1, this[v] = !0, this.emit("resume"), this[C$1].length ? this[Ot]() : this[G$1] ? this[H]() : this.emit("drain"));
|
|
1572
1572
|
}
|
|
1573
1573
|
resume() {
|
|
1574
1574
|
return this[st]();
|
|
1575
1575
|
}
|
|
1576
1576
|
pause() {
|
|
1577
|
-
this[v
|
|
1577
|
+
this[v] = !1, this[dt] = !0, this[M] = !1;
|
|
1578
1578
|
}
|
|
1579
1579
|
get destroyed() {
|
|
1580
|
-
return this[x
|
|
1580
|
+
return this[x];
|
|
1581
1581
|
}
|
|
1582
1582
|
get flowing() {
|
|
1583
|
-
return this[v
|
|
1583
|
+
return this[v];
|
|
1584
1584
|
}
|
|
1585
1585
|
get paused() {
|
|
1586
1586
|
return this[dt];
|
|
1587
1587
|
}
|
|
1588
1588
|
[Yt](t) {
|
|
1589
|
-
this[k
|
|
1589
|
+
this[k] ? this[T$1] += 1 : this[T$1] += t.length, this[C$1].push(t);
|
|
1590
1590
|
}
|
|
1591
1591
|
[Ft]() {
|
|
1592
|
-
return this[k
|
|
1592
|
+
return this[k] ? this[T$1] -= 1 : this[T$1] -= this[C$1][0].length, this[C$1].shift();
|
|
1593
1593
|
}
|
|
1594
1594
|
[Ot](t = !1) {
|
|
1595
1595
|
do ;
|
|
1596
|
-
while (this[Le](this[Ft]()) && this[C$
|
|
1597
|
-
!t && !this[C$
|
|
1596
|
+
while (this[Le](this[Ft]()) && this[C$1].length);
|
|
1597
|
+
!t && !this[C$1].length && !this[G$1] && this.emit("drain");
|
|
1598
1598
|
}
|
|
1599
1599
|
[Le](t) {
|
|
1600
|
-
return this.emit("data", t), this[v
|
|
1600
|
+
return this.emit("data", t), this[v];
|
|
1601
1601
|
}
|
|
1602
1602
|
pipe(t, e) {
|
|
1603
|
-
if (this[x
|
|
1603
|
+
if (this[x]) return t;
|
|
1604
1604
|
this[M] = !1;
|
|
1605
1605
|
let s = this[K];
|
|
1606
1606
|
return e = e || {}, t === Ne.stdout || t === Ne.stderr ? e.end = !1 : e.end = e.end !== !1, e.proxyErrors = !!e.proxyErrors, s ? e.end && t.end() : (this[F$1].push(e.proxyErrors ? new te(this, t, e) : new Mt(this, t, e)), this[B] ? mt(() => this[st]()) : this[st]()), t;
|
|
1607
1607
|
}
|
|
1608
1608
|
unpipe(t) {
|
|
1609
1609
|
let e = this[F$1].find((s) => s.dest === t);
|
|
1610
|
-
e && (this[F$1].length === 1 ? (this[v
|
|
1610
|
+
e && (this[F$1].length === 1 ? (this[v] && this[Y] === 0 && (this[v] = !1), this[F$1] = []) : this[F$1].splice(this[F$1].indexOf(e), 1), e.unpipe());
|
|
1611
1611
|
}
|
|
1612
1612
|
addListener(t, e) {
|
|
1613
1613
|
return this.on(t, e);
|
|
1614
1614
|
}
|
|
1615
1615
|
on(t, e) {
|
|
1616
1616
|
let s = super.on(t, e);
|
|
1617
|
-
if (t === "data") this[M] = !1, this[Y]++, !this[F$1].length && !this[v
|
|
1618
|
-
else if (t === "readable" && this[T$
|
|
1617
|
+
if (t === "data") this[M] = !1, this[Y]++, !this[F$1].length && !this[v] && this[st]();
|
|
1618
|
+
else if (t === "readable" && this[T$1] !== 0) super.emit("readable");
|
|
1619
1619
|
else if (ci(t) && this[K]) super.emit(t), this.removeAllListeners(t);
|
|
1620
1620
|
else if (t === "error" && this[ut]) {
|
|
1621
1621
|
let i = e;
|
|
@@ -1628,25 +1628,25 @@ while (this[Le](this[Ft]()) && this[C$2].length);
|
|
|
1628
1628
|
}
|
|
1629
1629
|
off(t, e) {
|
|
1630
1630
|
let s = super.off(t, e);
|
|
1631
|
-
return t === "data" && (this[Y] = this.listeners("data").length, this[Y] === 0 && !this[M] && !this[F$1].length && (this[v
|
|
1631
|
+
return t === "data" && (this[Y] = this.listeners("data").length, this[Y] === 0 && !this[M] && !this[F$1].length && (this[v] = !1)), s;
|
|
1632
1632
|
}
|
|
1633
1633
|
removeAllListeners(t) {
|
|
1634
1634
|
let e = super.removeAllListeners(t);
|
|
1635
|
-
return (t === "data" || t === void 0) && (this[Y] = 0, !this[M] && !this[F$1].length && (this[v
|
|
1635
|
+
return (t === "data" || t === void 0) && (this[Y] = 0, !this[M] && !this[F$1].length && (this[v] = !1)), e;
|
|
1636
1636
|
}
|
|
1637
1637
|
get emittedEnd() {
|
|
1638
1638
|
return this[K];
|
|
1639
1639
|
}
|
|
1640
1640
|
[H]() {
|
|
1641
|
-
!this[kt] && !this[K] && !this[x
|
|
1641
|
+
!this[kt] && !this[K] && !this[x] && this[C$1].length === 0 && this[G$1] && (this[kt] = !0, this.emit("end"), this.emit("prefinish"), this.emit("finish"), this[Rt] && this.emit("close"), this[kt] = !1);
|
|
1642
1642
|
}
|
|
1643
1643
|
emit(t, ...e) {
|
|
1644
1644
|
let s = e[0];
|
|
1645
|
-
if (t !== "error" && t !== "close" && t !== x
|
|
1646
|
-
if (t === "data") return !this[k
|
|
1645
|
+
if (t !== "error" && t !== "close" && t !== x && this[x]) return !1;
|
|
1646
|
+
if (t === "data") return !this[k] && !s ? !1 : this[B] ? (mt(() => this[Jt](s)), !0) : this[Jt](s);
|
|
1647
1647
|
if (t === "end") return this[We]();
|
|
1648
1648
|
if (t === "close") {
|
|
1649
|
-
if (this[Rt] = !0, !this[K] && !this[x
|
|
1649
|
+
if (this[Rt] = !0, !this[K] && !this[x]) return !1;
|
|
1650
1650
|
let r = super.emit("close");
|
|
1651
1651
|
return this.removeAllListeners("close"), r;
|
|
1652
1652
|
} else if (t === "error") {
|
|
@@ -1685,20 +1685,20 @@ while (this[Le](this[Ft]()) && this[C$2].length);
|
|
|
1685
1685
|
}
|
|
1686
1686
|
async collect() {
|
|
1687
1687
|
let t = Object.assign([], { dataLength: 0 });
|
|
1688
|
-
this[k
|
|
1688
|
+
this[k] || (t.dataLength = 0);
|
|
1689
1689
|
let e = this.promise();
|
|
1690
1690
|
return this.on("data", (s) => {
|
|
1691
|
-
t.push(s), this[k
|
|
1691
|
+
t.push(s), this[k] || (t.dataLength += s.length);
|
|
1692
1692
|
}), await e, t;
|
|
1693
1693
|
}
|
|
1694
1694
|
async concat() {
|
|
1695
|
-
if (this[k
|
|
1695
|
+
if (this[k]) throw new Error("cannot concat in objectMode");
|
|
1696
1696
|
let t = await this.collect();
|
|
1697
|
-
return this[P
|
|
1697
|
+
return this[P] ? t.join("") : Buffer.concat(t, t.dataLength);
|
|
1698
1698
|
}
|
|
1699
1699
|
async promise() {
|
|
1700
1700
|
return new Promise((t, e) => {
|
|
1701
|
-
this.on(x
|
|
1701
|
+
this.on(x, () => e(/* @__PURE__ */ new Error("stream destroyed"))), this.on("error", (s) => e(s)), this.on("end", () => t());
|
|
1702
1702
|
});
|
|
1703
1703
|
}
|
|
1704
1704
|
[Symbol.asyncIterator]() {
|
|
@@ -1717,20 +1717,20 @@ while (this[Le](this[Ft]()) && this[C$2].length);
|
|
|
1717
1717
|
});
|
|
1718
1718
|
if (this[G$1]) return e();
|
|
1719
1719
|
let r, o, h = (c) => {
|
|
1720
|
-
this.off("data", a), this.off("end", l), this.off(x
|
|
1720
|
+
this.off("data", a), this.off("end", l), this.off(x, u), e(), o(c);
|
|
1721
1721
|
}, a = (c) => {
|
|
1722
|
-
this.off("error", h), this.off("end", l), this.off(x
|
|
1722
|
+
this.off("error", h), this.off("end", l), this.off(x, u), this.pause(), r({
|
|
1723
1723
|
value: c,
|
|
1724
1724
|
done: !!this[G$1]
|
|
1725
1725
|
});
|
|
1726
1726
|
}, l = () => {
|
|
1727
|
-
this.off("error", h), this.off("data", a), this.off(x
|
|
1727
|
+
this.off("error", h), this.off("data", a), this.off(x, u), e(), r({
|
|
1728
1728
|
done: !0,
|
|
1729
1729
|
value: void 0
|
|
1730
1730
|
});
|
|
1731
1731
|
}, u = () => h(/* @__PURE__ */ new Error("stream destroyed"));
|
|
1732
1732
|
return new Promise((c, d) => {
|
|
1733
|
-
o = d, r = c, this.once(x
|
|
1733
|
+
o = d, r = c, this.once(x, u), this.once("error", h), this.once("end", l), this.once("data", a);
|
|
1734
1734
|
});
|
|
1735
1735
|
},
|
|
1736
1736
|
throw: e,
|
|
@@ -1743,7 +1743,7 @@ while (this[Le](this[Ft]()) && this[C$2].length);
|
|
|
1743
1743
|
}
|
|
1744
1744
|
[Symbol.iterator]() {
|
|
1745
1745
|
this[M] = !1;
|
|
1746
|
-
let t = !1, e = () => (this.pause(), this.off(Xt, e), this.off(x
|
|
1746
|
+
let t = !1, e = () => (this.pause(), this.off(Xt, e), this.off(x, e), this.off("end", e), t = !0, {
|
|
1747
1747
|
done: !0,
|
|
1748
1748
|
value: void 0
|
|
1749
1749
|
}), s = () => {
|
|
@@ -1754,7 +1754,7 @@ while (this[Le](this[Ft]()) && this[C$2].length);
|
|
|
1754
1754
|
value: i
|
|
1755
1755
|
};
|
|
1756
1756
|
};
|
|
1757
|
-
return this.once("end", e), this.once(Xt, e), this.once(x
|
|
1757
|
+
return this.once("end", e), this.once(Xt, e), this.once(x, e), {
|
|
1758
1758
|
next: s,
|
|
1759
1759
|
throw: e,
|
|
1760
1760
|
return: e,
|
|
@@ -1765,10 +1765,10 @@ while (this[Le](this[Ft]()) && this[C$2].length);
|
|
|
1765
1765
|
};
|
|
1766
1766
|
}
|
|
1767
1767
|
destroy(t) {
|
|
1768
|
-
if (this[x
|
|
1769
|
-
this[x
|
|
1768
|
+
if (this[x]) return t ? this.emit("error", t) : this.emit(x), this;
|
|
1769
|
+
this[x] = !0, this[M] = !0, this[C$1].length = 0, this[T$1] = 0;
|
|
1770
1770
|
let e = this;
|
|
1771
|
-
return typeof e.close == "function" && !this[Rt] && e.close(), t ? this.emit("error", t) : this.emit(x
|
|
1771
|
+
return typeof e.close == "function" && !this[Rt] && e.close(), t ? this.emit("error", t) : this.emit(x), this;
|
|
1772
1772
|
}
|
|
1773
1773
|
static get isStream() {
|
|
1774
1774
|
return oi;
|
|
@@ -1792,7 +1792,7 @@ while (this[Le](this[Ft]()) && this[C$2].length);
|
|
|
1792
1792
|
...wt.promises,
|
|
1793
1793
|
...n.promises || {}
|
|
1794
1794
|
}
|
|
1795
|
-
}, $e = /^\\\\\?\\([a-z]:)\\?$/i, Ri = (n) => n.replace(/\//g, "\\").replace($e, "$1\\"), Oi = /[\\\/]/, L$1 = 0, Ge = 1, He = 2, U = 4, qe = 6, Ke = 8, X = 10, Ve = 12, _$
|
|
1795
|
+
}, $e = /^\\\\\?\\([a-z]:)\\?$/i, Ri = (n) => n.replace(/\//g, "\\").replace($e, "$1\\"), Oi = /[\\\/]/, L$1 = 0, Ge = 1, He = 2, U = 4, qe = 6, Ke = 8, X = 10, Ve = 12, _$1 = 15, gt = ~_$1, se = 16, je = 32, yt = 64, j = 128, Nt = 256, Lt = 512, Ie = yt | j | Lt, Fi = 1023, ie = (n) => n.isFile() ? Ke : n.isDirectory() ? U : n.isSymbolicLink() ? X : n.isCharacterDevice() ? He : n.isBlockDevice() ? qe : n.isSocket() ? Ve : n.isFIFO() ? Ge : L$1, ze = new ft({ max: 2 ** 12 }), bt = (n) => {
|
|
1796
1796
|
let t = ze.get(n);
|
|
1797
1797
|
if (t) return t;
|
|
1798
1798
|
let e = n.normalize("NFKD");
|
|
@@ -1813,7 +1813,7 @@ while (this[Le](this[Ft]()) && this[C$2].length);
|
|
|
1813
1813
|
sizeCalculation: (e) => e.length + 1
|
|
1814
1814
|
});
|
|
1815
1815
|
}
|
|
1816
|
-
}, Ye = Symbol("PathScurry setAsCwd"), R$
|
|
1816
|
+
}, Ye = Symbol("PathScurry setAsCwd"), R$1 = class {
|
|
1817
1817
|
name;
|
|
1818
1818
|
root;
|
|
1819
1819
|
roots;
|
|
@@ -1981,7 +1981,7 @@ while (this[Le](this[Ft]()) && this[C$2].length);
|
|
|
1981
1981
|
return this.#y = s;
|
|
1982
1982
|
}
|
|
1983
1983
|
isUnknown() {
|
|
1984
|
-
return (this.#e & _$
|
|
1984
|
+
return (this.#e & _$1) === L$1;
|
|
1985
1985
|
}
|
|
1986
1986
|
isType(t) {
|
|
1987
1987
|
return this[`is${t}`]();
|
|
@@ -1990,22 +1990,22 @@ while (this[Le](this[Ft]()) && this[C$2].length);
|
|
|
1990
1990
|
return this.isUnknown() ? "Unknown" : this.isDirectory() ? "Directory" : this.isFile() ? "File" : this.isSymbolicLink() ? "SymbolicLink" : this.isFIFO() ? "FIFO" : this.isCharacterDevice() ? "CharacterDevice" : this.isBlockDevice() ? "BlockDevice" : this.isSocket() ? "Socket" : "Unknown";
|
|
1991
1991
|
}
|
|
1992
1992
|
isFile() {
|
|
1993
|
-
return (this.#e & _$
|
|
1993
|
+
return (this.#e & _$1) === Ke;
|
|
1994
1994
|
}
|
|
1995
1995
|
isDirectory() {
|
|
1996
|
-
return (this.#e & _$
|
|
1996
|
+
return (this.#e & _$1) === U;
|
|
1997
1997
|
}
|
|
1998
1998
|
isCharacterDevice() {
|
|
1999
|
-
return (this.#e & _$
|
|
1999
|
+
return (this.#e & _$1) === He;
|
|
2000
2000
|
}
|
|
2001
2001
|
isBlockDevice() {
|
|
2002
|
-
return (this.#e & _$
|
|
2002
|
+
return (this.#e & _$1) === qe;
|
|
2003
2003
|
}
|
|
2004
2004
|
isFIFO() {
|
|
2005
|
-
return (this.#e & _$
|
|
2005
|
+
return (this.#e & _$1) === Ge;
|
|
2006
2006
|
}
|
|
2007
2007
|
isSocket() {
|
|
2008
|
-
return (this.#e & _$
|
|
2008
|
+
return (this.#e & _$1) === Ve;
|
|
2009
2009
|
}
|
|
2010
2010
|
isSymbolicLink() {
|
|
2011
2011
|
return (this.#e & X) === X;
|
|
@@ -2026,7 +2026,7 @@ while (this[Le](this[Ft]()) && this[C$2].length);
|
|
|
2026
2026
|
canReadlink() {
|
|
2027
2027
|
if (this.#M) return !0;
|
|
2028
2028
|
if (!this.parent) return !1;
|
|
2029
|
-
let t = this.#e & _$
|
|
2029
|
+
let t = this.#e & _$1;
|
|
2030
2030
|
return !(t !== L$1 && t !== X || this.#e & Nt || this.#e & j);
|
|
2031
2031
|
}
|
|
2032
2032
|
calledReaddir() {
|
|
@@ -2081,7 +2081,7 @@ while (this[Le](this[Ft]()) && this[C$2].length);
|
|
|
2081
2081
|
#L() {
|
|
2082
2082
|
if (this.#e & yt) return;
|
|
2083
2083
|
let t = this.#e;
|
|
2084
|
-
(t & _$
|
|
2084
|
+
(t & _$1) === U && (t &= gt), this.#e = t | yt, this.#G();
|
|
2085
2085
|
}
|
|
2086
2086
|
#I(t = "") {
|
|
2087
2087
|
t === "ENOTDIR" || t === "EPERM" ? this.#L() : t === "ENOENT" ? this.#v() : this.children().provisional = 0;
|
|
@@ -2097,7 +2097,7 @@ while (this[Le](this[Ft]()) && this[C$2].length);
|
|
|
2097
2097
|
return this.#U(t, e) || this.#B(t, e);
|
|
2098
2098
|
}
|
|
2099
2099
|
#B(t, e) {
|
|
2100
|
-
let s = ie(t), i = this.newChild(t.name, s, { parent: this }), r = i.#e & _$
|
|
2100
|
+
let s = ie(t), i = this.newChild(t.name, s, { parent: this }), r = i.#e & _$1;
|
|
2101
2101
|
return r !== U && r !== X && r !== L$1 && (i.#e |= yt), e.unshift(i), e.provisional++, i;
|
|
2102
2102
|
}
|
|
2103
2103
|
#U(t, e) {
|
|
@@ -2195,7 +2195,7 @@ while (this[Le](this[Ft]()) && this[C$2].length);
|
|
|
2195
2195
|
}
|
|
2196
2196
|
canReaddir() {
|
|
2197
2197
|
if (this.#e & Ie) return !1;
|
|
2198
|
-
let t = _$
|
|
2198
|
+
let t = _$1 & this.#e;
|
|
2199
2199
|
return t === L$1 || t === U || t === X;
|
|
2200
2200
|
}
|
|
2201
2201
|
shouldWalk(t, e) {
|
|
@@ -2226,7 +2226,7 @@ while (this[Le](this[Ft]()) && this[C$2].length);
|
|
|
2226
2226
|
for (; i && i.parent;) e.add(i), i.#x = s.join(this.sep), i.#A = s.join("/"), i = i.parent, s.push("..");
|
|
2227
2227
|
for (i = t; i && i.parent && !e.has(i);) i.#x = void 0, i.#A = void 0, i = i.parent;
|
|
2228
2228
|
}
|
|
2229
|
-
}, Pt = class n extends R$
|
|
2229
|
+
}, Pt = class n extends R$1 {
|
|
2230
2230
|
sep = "\\";
|
|
2231
2231
|
splitSep = Oi;
|
|
2232
2232
|
constructor(t, e = L$1, s, i, r, o, h) {
|
|
@@ -2246,7 +2246,7 @@ while (this[Le](this[Ft]()) && this[C$2].length);
|
|
|
2246
2246
|
sameRoot(t, e = this.root.name) {
|
|
2247
2247
|
return t = t.toUpperCase().replace(/\//g, "\\").replace($e, "$1\\"), t === e;
|
|
2248
2248
|
}
|
|
2249
|
-
}, jt = class n extends R$
|
|
2249
|
+
}, jt = class n extends R$1 {
|
|
2250
2250
|
splitSep = "/";
|
|
2251
2251
|
sep = "/";
|
|
2252
2252
|
constructor(t, e = L$1, s, i, r, o, h) {
|
|
@@ -2330,7 +2330,7 @@ while (this[Le](this[Ft]()) && this[C$2].length);
|
|
|
2330
2330
|
return typeof t == "string" && (t = this.cwd.resolve(t)), (t.parent || t).fullpath();
|
|
2331
2331
|
}
|
|
2332
2332
|
async readdir(t = this.cwd, e = { withFileTypes: !0 }) {
|
|
2333
|
-
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R$
|
|
2333
|
+
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R$1 || (e = t, t = this.cwd);
|
|
2334
2334
|
let { withFileTypes: s } = e;
|
|
2335
2335
|
if (t.canReaddir()) {
|
|
2336
2336
|
let i = await t.readdir();
|
|
@@ -2338,7 +2338,7 @@ while (this[Le](this[Ft]()) && this[C$2].length);
|
|
|
2338
2338
|
} else return [];
|
|
2339
2339
|
}
|
|
2340
2340
|
readdirSync(t = this.cwd, e = { withFileTypes: !0 }) {
|
|
2341
|
-
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R$
|
|
2341
|
+
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R$1 || (e = t, t = this.cwd);
|
|
2342
2342
|
let { withFileTypes: s = !0 } = e;
|
|
2343
2343
|
return t.canReaddir() ? s ? t.readdirSync() : t.readdirSync().map((i) => i.name) : [];
|
|
2344
2344
|
}
|
|
@@ -2349,27 +2349,27 @@ while (this[Le](this[Ft]()) && this[C$2].length);
|
|
|
2349
2349
|
return typeof t == "string" && (t = this.cwd.resolve(t)), t.lstatSync();
|
|
2350
2350
|
}
|
|
2351
2351
|
async readlink(t = this.cwd, { withFileTypes: e } = { withFileTypes: !1 }) {
|
|
2352
|
-
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R$
|
|
2352
|
+
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R$1 || (e = t.withFileTypes, t = this.cwd);
|
|
2353
2353
|
let s = await t.readlink();
|
|
2354
2354
|
return e ? s : s?.fullpath();
|
|
2355
2355
|
}
|
|
2356
2356
|
readlinkSync(t = this.cwd, { withFileTypes: e } = { withFileTypes: !1 }) {
|
|
2357
|
-
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R$
|
|
2357
|
+
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R$1 || (e = t.withFileTypes, t = this.cwd);
|
|
2358
2358
|
let s = t.readlinkSync();
|
|
2359
2359
|
return e ? s : s?.fullpath();
|
|
2360
2360
|
}
|
|
2361
2361
|
async realpath(t = this.cwd, { withFileTypes: e } = { withFileTypes: !1 }) {
|
|
2362
|
-
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R$
|
|
2362
|
+
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R$1 || (e = t.withFileTypes, t = this.cwd);
|
|
2363
2363
|
let s = await t.realpath();
|
|
2364
2364
|
return e ? s : s?.fullpath();
|
|
2365
2365
|
}
|
|
2366
2366
|
realpathSync(t = this.cwd, { withFileTypes: e } = { withFileTypes: !1 }) {
|
|
2367
|
-
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R$
|
|
2367
|
+
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R$1 || (e = t.withFileTypes, t = this.cwd);
|
|
2368
2368
|
let s = t.realpathSync();
|
|
2369
2369
|
return e ? s : s?.fullpath();
|
|
2370
2370
|
}
|
|
2371
2371
|
async walk(t = this.cwd, e = {}) {
|
|
2372
|
-
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R$
|
|
2372
|
+
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R$1 || (e = t, t = this.cwd);
|
|
2373
2373
|
let { withFileTypes: s = !0, follow: i = !1, filter: r, walkFilter: o } = e, h = [];
|
|
2374
2374
|
(!r || r(t)) && h.push(s ? t : t.fullpath());
|
|
2375
2375
|
let a = /* @__PURE__ */ new Set(), l = (c, d) => {
|
|
@@ -2391,7 +2391,7 @@ while (this[Le](this[Ft]()) && this[C$2].length);
|
|
|
2391
2391
|
});
|
|
2392
2392
|
}
|
|
2393
2393
|
walkSync(t = this.cwd, e = {}) {
|
|
2394
|
-
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R$
|
|
2394
|
+
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R$1 || (e = t, t = this.cwd);
|
|
2395
2395
|
let { withFileTypes: s = !0, follow: i = !1, filter: r, walkFilter: o } = e, h = [];
|
|
2396
2396
|
(!r || r(t)) && h.push(s ? t : t.fullpath());
|
|
2397
2397
|
let a = new Set([t]);
|
|
@@ -2413,13 +2413,13 @@ while (this[Le](this[Ft]()) && this[C$2].length);
|
|
|
2413
2413
|
return this.iterate();
|
|
2414
2414
|
}
|
|
2415
2415
|
iterate(t = this.cwd, e = {}) {
|
|
2416
|
-
return typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R$
|
|
2416
|
+
return typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R$1 || (e = t, t = this.cwd), this.stream(t, e)[Symbol.asyncIterator]();
|
|
2417
2417
|
}
|
|
2418
2418
|
[Symbol.iterator]() {
|
|
2419
2419
|
return this.iterateSync();
|
|
2420
2420
|
}
|
|
2421
2421
|
*iterateSync(t = this.cwd, e = {}) {
|
|
2422
|
-
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R$
|
|
2422
|
+
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R$1 || (e = t, t = this.cwd);
|
|
2423
2423
|
let { withFileTypes: s = !0, follow: i = !1, filter: r, walkFilter: o } = e;
|
|
2424
2424
|
(!r || r(t)) && (yield s ? t : t.fullpath());
|
|
2425
2425
|
let h = new Set([t]);
|
|
@@ -2437,7 +2437,7 @@ while (this[Le](this[Ft]()) && this[C$2].length);
|
|
|
2437
2437
|
}
|
|
2438
2438
|
}
|
|
2439
2439
|
stream(t = this.cwd, e = {}) {
|
|
2440
|
-
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R$
|
|
2440
|
+
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R$1 || (e = t, t = this.cwd);
|
|
2441
2441
|
let { withFileTypes: s = !0, follow: i = !1, filter: r, walkFilter: o } = e, h = new V({ objectMode: !0 });
|
|
2442
2442
|
(!r || r(t)) && h.write(s ? t : t.fullpath());
|
|
2443
2443
|
let a = /* @__PURE__ */ new Set(), l = [t], u = 0, c = () => {
|
|
@@ -2473,7 +2473,7 @@ while (this[Le](this[Ft]()) && this[C$2].length);
|
|
|
2473
2473
|
return c(), h;
|
|
2474
2474
|
}
|
|
2475
2475
|
streamSync(t = this.cwd, e = {}) {
|
|
2476
|
-
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R$
|
|
2476
|
+
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R$1 || (e = t, t = this.cwd);
|
|
2477
2477
|
let { withFileTypes: s = !0, follow: i = !1, filter: r, walkFilter: o } = e, h = new V({ objectMode: !0 }), a = /* @__PURE__ */ new Set();
|
|
2478
2478
|
(!r || r(t)) && h.write(s ? t : t.fullpath());
|
|
2479
2479
|
let l = [t], u = 0, c = () => {
|
|
@@ -2606,7 +2606,7 @@ var Di = (n) => n.length >= 1, Mi = (n) => n.length >= 1, Ni = Symbol.for("nodej
|
|
|
2606
2606
|
return typeof this.#t[this.#n] == "string";
|
|
2607
2607
|
}
|
|
2608
2608
|
isGlobstar() {
|
|
2609
|
-
return this.#t[this.#n] === A$
|
|
2609
|
+
return this.#t[this.#n] === A$1;
|
|
2610
2610
|
}
|
|
2611
2611
|
isRegExp() {
|
|
2612
2612
|
return this.#t[this.#n] instanceof RegExp;
|
|
@@ -2665,12 +2665,12 @@ var _i = typeof process == "object" && process && typeof process.platform == "st
|
|
|
2665
2665
|
for (let h of t) this.add(h);
|
|
2666
2666
|
}
|
|
2667
2667
|
add(t) {
|
|
2668
|
-
let e = new D$
|
|
2668
|
+
let e = new D$1(t, this.mmopts);
|
|
2669
2669
|
for (let s = 0; s < e.set.length; s++) {
|
|
2670
2670
|
let i = e.set[s], r = e.globParts[s];
|
|
2671
2671
|
if (!i || !r) throw new Error("invalid pattern object");
|
|
2672
2672
|
for (; i[0] === "." && r[0] === ".";) i.shift(), r.shift();
|
|
2673
|
-
let o = new nt(i, r, 0, this.platform), h = new D$
|
|
2673
|
+
let o = new nt(i, r, 0, this.platform), h = new D$1(o.globString(), this.mmopts), a = r[r.length - 1] === "**", l = o.isAbsolute();
|
|
2674
2674
|
l ? this.absolute.push(h) : this.relative.push(h), a && (l ? this.absoluteChildren.push(h) : this.relativeChildren.push(h));
|
|
2675
2675
|
}
|
|
2676
2676
|
}
|
|
@@ -2770,7 +2770,7 @@ var oe = class n {
|
|
|
2770
2770
|
let c = a === ".." || a === "" || a === ".";
|
|
2771
2771
|
this.matches.add(i.resolve(a), h, c);
|
|
2772
2772
|
continue;
|
|
2773
|
-
} else if (a === A$
|
|
2773
|
+
} else if (a === A$1) {
|
|
2774
2774
|
(!i.isSymbolicLink() || this.follow || r.checkFollowGlobstar()) && this.subwalks.add(i, r);
|
|
2775
2775
|
let c = l?.pattern(), d = l?.rest();
|
|
2776
2776
|
if (!l || (c === "" || c === ".") && !d) this.matches.add(i, h, c === "" || c === ".");
|
|
@@ -2792,7 +2792,7 @@ var oe = class n {
|
|
|
2792
2792
|
let s = this.subwalks.get(t), i = this.child();
|
|
2793
2793
|
for (let r of e) for (let o of s) {
|
|
2794
2794
|
let h = o.isAbsolute(), a = o.pattern(), l = o.rest();
|
|
2795
|
-
a === A$
|
|
2795
|
+
a === A$1 ? i.testGlobstar(r, o, l, h) : a instanceof RegExp ? i.testRegExp(r, a, l, h) : i.testString(r, a, l, h);
|
|
2796
2796
|
}
|
|
2797
2797
|
return i;
|
|
2798
2798
|
}
|
|
@@ -3075,7 +3075,7 @@ var Pi = typeof process == "object" && process && typeof process.platform == "st
|
|
|
3075
3075
|
platform: this.platform,
|
|
3076
3076
|
windowsPathsNoEscape: this.windowsPathsNoEscape,
|
|
3077
3077
|
debug: !!this.opts.debug
|
|
3078
|
-
}, [o, h] = this.pattern.map((a) => new D$
|
|
3078
|
+
}, [o, h] = this.pattern.map((a) => new D$1(a, i)).reduce((a, l) => (a[0].push(...l.set), a[1].push(...l.globParts), a), [[], []]);
|
|
3079
3079
|
this.patterns = o.map((a, l) => {
|
|
3080
3080
|
let u = h[l];
|
|
3081
3081
|
if (!u) throw new Error("invalid pattern object");
|
|
@@ -3133,7 +3133,7 @@ var Pi = typeof process == "object" && process && typeof process.platform == "st
|
|
|
3133
3133
|
};
|
|
3134
3134
|
var le = (n, t = {}) => {
|
|
3135
3135
|
Array.isArray(n) || (n = [n]);
|
|
3136
|
-
for (let e of n) if (new D$
|
|
3136
|
+
for (let e of n) if (new D$1(e, t).hasMagic()) return !0;
|
|
3137
3137
|
return !1;
|
|
3138
3138
|
};
|
|
3139
3139
|
function Bt(n, t = {}) {
|
|
@@ -3172,7 +3172,7 @@ var ji = Bt, Ii = Object.assign(Qe, { sync: Bt }), zi = Ut, Bi = Object.assign(e
|
|
|
3172
3172
|
Glob: I$1,
|
|
3173
3173
|
hasMagic: le,
|
|
3174
3174
|
escape: tt,
|
|
3175
|
-
unescape: W
|
|
3175
|
+
unescape: W
|
|
3176
3176
|
});
|
|
3177
3177
|
Ze.glob = Ze;
|
|
3178
3178
|
|
|
@@ -3833,7 +3833,7 @@ const r = Object.create(null), i$1 = (e) => globalThis.process?.env || import.me
|
|
|
3833
3833
|
const e = i$1(true);
|
|
3834
3834
|
return Object.keys(e);
|
|
3835
3835
|
}
|
|
3836
|
-
}), t = typeof process < "u" && process.env && process.env.NODE_ENV || "", f
|
|
3836
|
+
}), t = typeof process < "u" && process.env && process.env.NODE_ENV || "", f = [
|
|
3837
3837
|
["APPVEYOR"],
|
|
3838
3838
|
[
|
|
3839
3839
|
"AWS_AMPLIFY",
|
|
@@ -3924,8 +3924,8 @@ const r = Object.create(null), i$1 = (e) => globalThis.process?.env || import.me
|
|
|
3924
3924
|
{ ci: true }
|
|
3925
3925
|
]
|
|
3926
3926
|
];
|
|
3927
|
-
function b$
|
|
3928
|
-
if (globalThis.process?.env) for (const e of f
|
|
3927
|
+
function b$1() {
|
|
3928
|
+
if (globalThis.process?.env) for (const e of f) {
|
|
3929
3929
|
const s = e[1] || e[0];
|
|
3930
3930
|
if (globalThis.process?.env[s]) return {
|
|
3931
3931
|
name: e[0].toLowerCase(),
|
|
@@ -3940,30 +3940,30 @@ function b$2() {
|
|
|
3940
3940
|
ci: false
|
|
3941
3941
|
};
|
|
3942
3942
|
}
|
|
3943
|
-
const l = b$
|
|
3943
|
+
const l = b$1();
|
|
3944
3944
|
l.name;
|
|
3945
3945
|
function n$1(e) {
|
|
3946
3946
|
return e ? e !== "false" : false;
|
|
3947
3947
|
}
|
|
3948
|
-
const I = globalThis.process?.platform || "", T
|
|
3948
|
+
const I = globalThis.process?.platform || "", T = n$1(o$1.CI) || l.ci !== false, a$1 = n$1(globalThis.process?.stdout && globalThis.process?.stdout.isTTY), g = n$1(o$1.DEBUG), R = t === "test" || n$1(o$1.TEST);
|
|
3949
3949
|
o$1.MINIMAL;
|
|
3950
|
-
const A
|
|
3951
|
-
!n$1(o$1.NO_COLOR) && (n$1(o$1.FORCE_COLOR) || (a$1 || A
|
|
3952
|
-
const C
|
|
3953
|
-
Number(C
|
|
3954
|
-
const y = globalThis.process || Object.create(null), _
|
|
3950
|
+
const A = /^win/i.test(I);
|
|
3951
|
+
!n$1(o$1.NO_COLOR) && (n$1(o$1.FORCE_COLOR) || (a$1 || A) && o$1.TERM);
|
|
3952
|
+
const C = (globalThis.process?.versions?.node || "").replace(/^v/, "") || null;
|
|
3953
|
+
Number(C?.split(".")[0]);
|
|
3954
|
+
const y = globalThis.process || Object.create(null), _ = { versions: {} };
|
|
3955
3955
|
new Proxy(y, { get(e, s) {
|
|
3956
3956
|
if (s === "env") return o$1;
|
|
3957
3957
|
if (s in e) return e[s];
|
|
3958
|
-
if (s in _
|
|
3958
|
+
if (s in _) return _[s];
|
|
3959
3959
|
} });
|
|
3960
|
-
const c$1 = globalThis.process?.release?.name === "node", O
|
|
3960
|
+
const c$1 = globalThis.process?.release?.name === "node", O = !!globalThis.Bun || !!globalThis.process?.versions?.bun, D = !!globalThis.Deno, L = !!globalThis.fastly, S = !!globalThis.Netlify, u$1 = !!globalThis.EdgeRuntime, N = globalThis.navigator?.userAgent === "Cloudflare-Workers", F = [
|
|
3961
3961
|
[S, "netlify"],
|
|
3962
3962
|
[u$1, "edge-light"],
|
|
3963
3963
|
[N, "workerd"],
|
|
3964
3964
|
[L, "fastly"],
|
|
3965
|
-
[D
|
|
3966
|
-
[O
|
|
3965
|
+
[D, "deno"],
|
|
3966
|
+
[O, "bun"],
|
|
3967
3967
|
[c$1, "node"]
|
|
3968
3968
|
];
|
|
3969
3969
|
function G() {
|
|
@@ -4116,13 +4116,13 @@ function createConsola(options = {}) {
|
|
|
4116
4116
|
stdout: process.stdout,
|
|
4117
4117
|
stderr: process.stderr,
|
|
4118
4118
|
prompt: (...args) => import("./prompt-CHIvwqcZ.mjs").then((m) => m.prompt(...args)),
|
|
4119
|
-
reporters: options.reporters || [options.fancy ?? !(T
|
|
4119
|
+
reporters: options.reporters || [options.fancy ?? !(T || R) ? new FancyReporter() : new BasicReporter()],
|
|
4120
4120
|
...options
|
|
4121
4121
|
});
|
|
4122
4122
|
}
|
|
4123
4123
|
function _getDefaultLogLevel() {
|
|
4124
|
-
if (g
|
|
4125
|
-
if (R
|
|
4124
|
+
if (g) return LogLevels.debug;
|
|
4125
|
+
if (R) return LogLevels.warn;
|
|
4126
4126
|
return LogLevels.info;
|
|
4127
4127
|
}
|
|
4128
4128
|
const consola = createConsola();
|
|
@@ -13716,741 +13716,6 @@ var require_commander = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
13716
13716
|
var import_commander = /* @__PURE__ */ __toESM(require_commander(), 1);
|
|
13717
13717
|
const { program, createCommand, createArgument, createOption, CommanderError, InvalidArgumentError, InvalidOptionArgumentError, Command, Argument, Option, Help } = import_commander.default;
|
|
13718
13718
|
|
|
13719
|
-
//#endregion
|
|
13720
|
-
//#region ../../node_modules/.pnpm/croner@10.0.1/node_modules/croner/dist/croner.js
|
|
13721
|
-
function T(s) {
|
|
13722
|
-
return Date.UTC(s.y, s.m - 1, s.d, s.h, s.i, s.s);
|
|
13723
|
-
}
|
|
13724
|
-
function D(s, e) {
|
|
13725
|
-
return s.y === e.y && s.m === e.m && s.d === e.d && s.h === e.h && s.i === e.i && s.s === e.s;
|
|
13726
|
-
}
|
|
13727
|
-
function A(s, e) {
|
|
13728
|
-
let t = new Date(Date.parse(s));
|
|
13729
|
-
if (isNaN(t)) throw new Error("Invalid ISO8601 passed to timezone parser.");
|
|
13730
|
-
let r = s.substring(9);
|
|
13731
|
-
return r.includes("Z") || r.includes("+") || r.includes("-") ? b$1(t.getUTCFullYear(), t.getUTCMonth() + 1, t.getUTCDate(), t.getUTCHours(), t.getUTCMinutes(), t.getUTCSeconds(), "Etc/UTC") : b$1(t.getFullYear(), t.getMonth() + 1, t.getDate(), t.getHours(), t.getMinutes(), t.getSeconds(), e);
|
|
13732
|
-
}
|
|
13733
|
-
function v(s, e, t) {
|
|
13734
|
-
return k(A(s, e), t);
|
|
13735
|
-
}
|
|
13736
|
-
function k(s, e) {
|
|
13737
|
-
let t = new Date(T(s)), r = g(t, s.tz), a = T(s) - T(r), o = new Date(t.getTime() + a), h = g(o, s.tz);
|
|
13738
|
-
if (D(h, s)) {
|
|
13739
|
-
let u = /* @__PURE__ */ new Date(o.getTime() - 36e5);
|
|
13740
|
-
return D(g(u, s.tz), s) ? u : o;
|
|
13741
|
-
}
|
|
13742
|
-
let l = new Date(o.getTime() + T(s) - T(h));
|
|
13743
|
-
if (D(g(l, s.tz), s)) return l;
|
|
13744
|
-
if (e) throw new Error("Invalid date passed to fromTZ()");
|
|
13745
|
-
return o.getTime() > l.getTime() ? o : l;
|
|
13746
|
-
}
|
|
13747
|
-
function g(s, e) {
|
|
13748
|
-
let t, r;
|
|
13749
|
-
try {
|
|
13750
|
-
t = new Intl.DateTimeFormat("en-US", {
|
|
13751
|
-
timeZone: e,
|
|
13752
|
-
year: "numeric",
|
|
13753
|
-
month: "numeric",
|
|
13754
|
-
day: "numeric",
|
|
13755
|
-
hour: "numeric",
|
|
13756
|
-
minute: "numeric",
|
|
13757
|
-
second: "numeric",
|
|
13758
|
-
hour12: !1
|
|
13759
|
-
}), r = t.formatToParts(s);
|
|
13760
|
-
} catch (i) {
|
|
13761
|
-
let a = i instanceof Error ? i.message : String(i);
|
|
13762
|
-
throw new RangeError(`toTZ: Invalid timezone '${e}' or date. Please provide a valid IANA timezone (e.g., 'America/New_York', 'Europe/Stockholm'). Original error: ${a}`);
|
|
13763
|
-
}
|
|
13764
|
-
let n = {
|
|
13765
|
-
year: 0,
|
|
13766
|
-
month: 0,
|
|
13767
|
-
day: 0,
|
|
13768
|
-
hour: 0,
|
|
13769
|
-
minute: 0,
|
|
13770
|
-
second: 0
|
|
13771
|
-
};
|
|
13772
|
-
for (let i of r) (i.type === "year" || i.type === "month" || i.type === "day" || i.type === "hour" || i.type === "minute" || i.type === "second") && (n[i.type] = parseInt(i.value, 10));
|
|
13773
|
-
if (isNaN(n.year) || isNaN(n.month) || isNaN(n.day) || isNaN(n.hour) || isNaN(n.minute) || isNaN(n.second)) throw new Error(`toTZ: Failed to parse all date components from timezone '${e}'. This may indicate an invalid date or timezone configuration. Parsed components: ${JSON.stringify(n)}`);
|
|
13774
|
-
return n.hour === 24 && (n.hour = 0), {
|
|
13775
|
-
y: n.year,
|
|
13776
|
-
m: n.month,
|
|
13777
|
-
d: n.day,
|
|
13778
|
-
h: n.hour,
|
|
13779
|
-
i: n.minute,
|
|
13780
|
-
s: n.second,
|
|
13781
|
-
tz: e
|
|
13782
|
-
};
|
|
13783
|
-
}
|
|
13784
|
-
function b$1(s, e, t, r, n, i, a) {
|
|
13785
|
-
return {
|
|
13786
|
-
y: s,
|
|
13787
|
-
m: e,
|
|
13788
|
-
d: t,
|
|
13789
|
-
h: r,
|
|
13790
|
-
i: n,
|
|
13791
|
-
s: i,
|
|
13792
|
-
tz: a
|
|
13793
|
-
};
|
|
13794
|
-
}
|
|
13795
|
-
var O = [
|
|
13796
|
-
1,
|
|
13797
|
-
2,
|
|
13798
|
-
4,
|
|
13799
|
-
8,
|
|
13800
|
-
16
|
|
13801
|
-
], C = class {
|
|
13802
|
-
pattern;
|
|
13803
|
-
timezone;
|
|
13804
|
-
mode;
|
|
13805
|
-
alternativeWeekdays;
|
|
13806
|
-
sloppyRanges;
|
|
13807
|
-
second;
|
|
13808
|
-
minute;
|
|
13809
|
-
hour;
|
|
13810
|
-
day;
|
|
13811
|
-
month;
|
|
13812
|
-
dayOfWeek;
|
|
13813
|
-
year;
|
|
13814
|
-
lastDayOfMonth;
|
|
13815
|
-
lastWeekday;
|
|
13816
|
-
nearestWeekdays;
|
|
13817
|
-
starDOM;
|
|
13818
|
-
starDOW;
|
|
13819
|
-
starYear;
|
|
13820
|
-
useAndLogic;
|
|
13821
|
-
constructor(e, t, r) {
|
|
13822
|
-
this.pattern = e, this.timezone = t, this.mode = r?.mode ?? "auto", this.alternativeWeekdays = r?.alternativeWeekdays ?? !1, this.sloppyRanges = r?.sloppyRanges ?? !1, this.second = Array(60).fill(0), this.minute = Array(60).fill(0), this.hour = Array(24).fill(0), this.day = Array(31).fill(0), this.month = Array(12).fill(0), this.dayOfWeek = Array(7).fill(0), this.year = Array(1e4).fill(0), this.lastDayOfMonth = !1, this.lastWeekday = !1, this.nearestWeekdays = Array(31).fill(0), this.starDOM = !1, this.starDOW = !1, this.starYear = !1, this.useAndLogic = !1, this.parse();
|
|
13823
|
-
}
|
|
13824
|
-
parse() {
|
|
13825
|
-
if (!(typeof this.pattern == "string" || this.pattern instanceof String)) throw new TypeError("CronPattern: Pattern has to be of type string.");
|
|
13826
|
-
this.pattern.indexOf("@") >= 0 && (this.pattern = this.handleNicknames(this.pattern).trim());
|
|
13827
|
-
let e = this.pattern.match(/\S+/g) || [""], t = e.length;
|
|
13828
|
-
if (e.length < 5 || e.length > 7) throw new TypeError("CronPattern: invalid configuration format ('" + this.pattern + "'), exactly five, six, or seven space separated parts are required.");
|
|
13829
|
-
if (this.mode !== "auto") {
|
|
13830
|
-
let n;
|
|
13831
|
-
switch (this.mode) {
|
|
13832
|
-
case "5-part":
|
|
13833
|
-
n = 5;
|
|
13834
|
-
break;
|
|
13835
|
-
case "6-part":
|
|
13836
|
-
n = 6;
|
|
13837
|
-
break;
|
|
13838
|
-
case "7-part":
|
|
13839
|
-
n = 7;
|
|
13840
|
-
break;
|
|
13841
|
-
case "5-or-6-parts":
|
|
13842
|
-
n = [5, 6];
|
|
13843
|
-
break;
|
|
13844
|
-
case "6-or-7-parts":
|
|
13845
|
-
n = [6, 7];
|
|
13846
|
-
break;
|
|
13847
|
-
default: n = 0;
|
|
13848
|
-
}
|
|
13849
|
-
if (!(Array.isArray(n) ? n.includes(t) : t === n)) {
|
|
13850
|
-
let a = Array.isArray(n) ? n.join(" or ") : n.toString();
|
|
13851
|
-
throw new TypeError(`CronPattern: mode '${this.mode}' requires exactly ${a} parts, but pattern '${this.pattern}' has ${t} parts.`);
|
|
13852
|
-
}
|
|
13853
|
-
}
|
|
13854
|
-
if (e.length === 5 && e.unshift("0"), e.length === 6 && e.push("*"), e[3].toUpperCase() === "LW" ? (this.lastWeekday = !0, e[3] = "") : e[3].toUpperCase().indexOf("L") >= 0 && (e[3] = e[3].replace(/L/gi, ""), this.lastDayOfMonth = !0), e[3] == "*" && (this.starDOM = !0), e[6] == "*" && (this.starYear = !0), e[4].length >= 3 && (e[4] = this.replaceAlphaMonths(e[4])), e[5].length >= 3 && (e[5] = this.alternativeWeekdays ? this.replaceAlphaDaysQuartz(e[5]) : this.replaceAlphaDays(e[5])), e[5].startsWith("+") && (this.useAndLogic = !0, e[5] = e[5].substring(1), e[5] === "")) throw new TypeError("CronPattern: Day-of-week field cannot be empty after '+' modifier.");
|
|
13855
|
-
switch (e[5] == "*" && (this.starDOW = !0), this.pattern.indexOf("?") >= 0 && (e[0] = e[0].replace(/\?/g, "*"), e[1] = e[1].replace(/\?/g, "*"), e[2] = e[2].replace(/\?/g, "*"), e[3] = e[3].replace(/\?/g, "*"), e[4] = e[4].replace(/\?/g, "*"), e[5] = e[5].replace(/\?/g, "*"), e[6] && (e[6] = e[6].replace(/\?/g, "*"))), this.mode) {
|
|
13856
|
-
case "5-part":
|
|
13857
|
-
e[0] = "0", e[6] = "*";
|
|
13858
|
-
break;
|
|
13859
|
-
case "6-part":
|
|
13860
|
-
e[6] = "*";
|
|
13861
|
-
break;
|
|
13862
|
-
case "5-or-6-parts":
|
|
13863
|
-
e[6] = "*";
|
|
13864
|
-
break;
|
|
13865
|
-
case "6-or-7-parts": break;
|
|
13866
|
-
case "7-part":
|
|
13867
|
-
case "auto": break;
|
|
13868
|
-
}
|
|
13869
|
-
this.throwAtIllegalCharacters(e), this.partToArray("second", e[0], 0, 1), this.partToArray("minute", e[1], 0, 1), this.partToArray("hour", e[2], 0, 1), this.partToArray("day", e[3], -1, 1), this.partToArray("month", e[4], -1, 1);
|
|
13870
|
-
let r = this.alternativeWeekdays ? -1 : 0;
|
|
13871
|
-
this.partToArray("dayOfWeek", e[5], r, 63), this.partToArray("year", e[6], 0, 1), !this.alternativeWeekdays && this.dayOfWeek[7] && (this.dayOfWeek[0] = this.dayOfWeek[7]);
|
|
13872
|
-
}
|
|
13873
|
-
partToArray(e, t, r, n) {
|
|
13874
|
-
let i = this[e], a = e === "day" && this.lastDayOfMonth, o = e === "day" && this.lastWeekday;
|
|
13875
|
-
if (t === "" && !a && !o) throw new TypeError("CronPattern: configuration entry " + e + " (" + t + ") is empty, check for trailing spaces.");
|
|
13876
|
-
if (t === "*") return i.fill(n);
|
|
13877
|
-
let h = t.split(",");
|
|
13878
|
-
if (h.length > 1) for (let l = 0; l < h.length; l++) this.partToArray(e, h[l], r, n);
|
|
13879
|
-
else t.indexOf("-") !== -1 && t.indexOf("/") !== -1 ? this.handleRangeWithStepping(t, e, r, n) : t.indexOf("-") !== -1 ? this.handleRange(t, e, r, n) : t.indexOf("/") !== -1 ? this.handleStepping(t, e, r, n) : t !== "" && this.handleNumber(t, e, r, n);
|
|
13880
|
-
}
|
|
13881
|
-
throwAtIllegalCharacters(e) {
|
|
13882
|
-
for (let t = 0; t < e.length; t++) if ((t === 3 ? /[^/*0-9,\-WwLl]+/ : t === 5 ? /[^/*0-9,\-#Ll]+/ : /[^/*0-9,\-]+/).test(e[t])) throw new TypeError("CronPattern: configuration entry " + t + " (" + e[t] + ") contains illegal characters.");
|
|
13883
|
-
}
|
|
13884
|
-
handleNumber(e, t, r, n) {
|
|
13885
|
-
let i = this.extractNth(e, t), a = e.toUpperCase().includes("W");
|
|
13886
|
-
if (t !== "day" && a) throw new TypeError("CronPattern: Nearest weekday modifier (W) only allowed in day-of-month.");
|
|
13887
|
-
a && (t = "nearestWeekdays");
|
|
13888
|
-
let o = parseInt(i[0], 10) + r;
|
|
13889
|
-
if (isNaN(o)) throw new TypeError("CronPattern: " + t + " is not a number: '" + e + "'");
|
|
13890
|
-
this.setPart(t, o, i[1] || n);
|
|
13891
|
-
}
|
|
13892
|
-
setPart(e, t, r) {
|
|
13893
|
-
if (!Object.prototype.hasOwnProperty.call(this, e)) throw new TypeError("CronPattern: Invalid part specified: " + e);
|
|
13894
|
-
if (e === "dayOfWeek") {
|
|
13895
|
-
if (t === 7 && (t = 0), t < 0 || t > 6) throw new RangeError("CronPattern: Invalid value for dayOfWeek: " + t);
|
|
13896
|
-
this.setNthWeekdayOfMonth(t, r);
|
|
13897
|
-
return;
|
|
13898
|
-
}
|
|
13899
|
-
if (e === "second" || e === "minute") {
|
|
13900
|
-
if (t < 0 || t >= 60) throw new RangeError("CronPattern: Invalid value for " + e + ": " + t);
|
|
13901
|
-
} else if (e === "hour") {
|
|
13902
|
-
if (t < 0 || t >= 24) throw new RangeError("CronPattern: Invalid value for " + e + ": " + t);
|
|
13903
|
-
} else if (e === "day" || e === "nearestWeekdays") {
|
|
13904
|
-
if (t < 0 || t >= 31) throw new RangeError("CronPattern: Invalid value for " + e + ": " + t);
|
|
13905
|
-
} else if (e === "month") {
|
|
13906
|
-
if (t < 0 || t >= 12) throw new RangeError("CronPattern: Invalid value for " + e + ": " + t);
|
|
13907
|
-
} else if (e === "year" && (t < 1 || t >= 1e4)) throw new RangeError("CronPattern: Invalid value for " + e + ": " + t + " (supported range: 1-9999)");
|
|
13908
|
-
this[e][t] = r;
|
|
13909
|
-
}
|
|
13910
|
-
validateNotNaN(e, t) {
|
|
13911
|
-
if (isNaN(e)) throw new TypeError(t);
|
|
13912
|
-
}
|
|
13913
|
-
validateRange(e, t, r, n, i) {
|
|
13914
|
-
if (e > t) throw new TypeError("CronPattern: From value is larger than to value: '" + i + "'");
|
|
13915
|
-
if (r !== void 0) {
|
|
13916
|
-
if (r === 0) throw new TypeError("CronPattern: Syntax error, illegal stepping: 0");
|
|
13917
|
-
if (r > this[n].length) throw new TypeError("CronPattern: Syntax error, steps cannot be greater than maximum value of part (" + this[n].length + ")");
|
|
13918
|
-
}
|
|
13919
|
-
}
|
|
13920
|
-
handleRangeWithStepping(e, t, r, n) {
|
|
13921
|
-
if (e.toUpperCase().includes("W")) throw new TypeError("CronPattern: Syntax error, W is not allowed in ranges with stepping.");
|
|
13922
|
-
let i = this.extractNth(e, t), a = i[0].match(/^(\d+)-(\d+)\/(\d+)$/);
|
|
13923
|
-
if (a === null) throw new TypeError("CronPattern: Syntax error, illegal range with stepping: '" + e + "'");
|
|
13924
|
-
let [, o, h, l] = a, y = parseInt(o, 10) + r, u = parseInt(h, 10) + r, d = parseInt(l, 10);
|
|
13925
|
-
this.validateNotNaN(y, "CronPattern: Syntax error, illegal lower range (NaN)"), this.validateNotNaN(u, "CronPattern: Syntax error, illegal upper range (NaN)"), this.validateNotNaN(d, "CronPattern: Syntax error, illegal stepping: (NaN)"), this.validateRange(y, u, d, t, e);
|
|
13926
|
-
for (let c = y; c <= u; c += d) this.setPart(t, c, i[1] || n);
|
|
13927
|
-
}
|
|
13928
|
-
extractNth(e, t) {
|
|
13929
|
-
let r = e, n;
|
|
13930
|
-
if (r.includes("#")) {
|
|
13931
|
-
if (t !== "dayOfWeek") throw new Error("CronPattern: nth (#) only allowed in day-of-week field");
|
|
13932
|
-
n = r.split("#")[1], r = r.split("#")[0];
|
|
13933
|
-
} else if (r.toUpperCase().endsWith("L")) {
|
|
13934
|
-
if (t !== "dayOfWeek") throw new Error("CronPattern: L modifier only allowed in day-of-week field (use L alone for day-of-month)");
|
|
13935
|
-
n = "L", r = r.slice(0, -1);
|
|
13936
|
-
}
|
|
13937
|
-
return [r, n];
|
|
13938
|
-
}
|
|
13939
|
-
handleRange(e, t, r, n) {
|
|
13940
|
-
if (e.toUpperCase().includes("W")) throw new TypeError("CronPattern: Syntax error, W is not allowed in a range.");
|
|
13941
|
-
let i = this.extractNth(e, t), a = i[0].split("-");
|
|
13942
|
-
if (a.length !== 2) throw new TypeError("CronPattern: Syntax error, illegal range: '" + e + "'");
|
|
13943
|
-
let o = parseInt(a[0], 10) + r, h = parseInt(a[1], 10) + r;
|
|
13944
|
-
this.validateNotNaN(o, "CronPattern: Syntax error, illegal lower range (NaN)"), this.validateNotNaN(h, "CronPattern: Syntax error, illegal upper range (NaN)"), this.validateRange(o, h, void 0, t, e);
|
|
13945
|
-
for (let l = o; l <= h; l++) this.setPart(t, l, i[1] || n);
|
|
13946
|
-
}
|
|
13947
|
-
handleStepping(e, t, r, n) {
|
|
13948
|
-
if (e.toUpperCase().includes("W")) throw new TypeError("CronPattern: Syntax error, W is not allowed in parts with stepping.");
|
|
13949
|
-
let i = this.extractNth(e, t), a = i[0].split("/");
|
|
13950
|
-
if (a.length !== 2) throw new TypeError("CronPattern: Syntax error, illegal stepping: '" + e + "'");
|
|
13951
|
-
if (this.sloppyRanges) a[0] === "" && (a[0] = "*");
|
|
13952
|
-
else {
|
|
13953
|
-
if (a[0] === "") throw new TypeError("CronPattern: Syntax error, stepping with missing prefix ('" + e + "') is not allowed. Use wildcard (*/step) or range (min-max/step) instead.");
|
|
13954
|
-
if (a[0] !== "*") throw new TypeError("CronPattern: Syntax error, stepping with numeric prefix ('" + e + "') is not allowed. Use wildcard (*/step) or range (min-max/step) instead.");
|
|
13955
|
-
}
|
|
13956
|
-
let o = 0;
|
|
13957
|
-
a[0] !== "*" && (o = parseInt(a[0], 10) + r);
|
|
13958
|
-
let h = parseInt(a[1], 10);
|
|
13959
|
-
this.validateNotNaN(h, "CronPattern: Syntax error, illegal stepping: (NaN)"), this.validateRange(0, this[t].length - 1, h, t, e);
|
|
13960
|
-
for (let l = o; l < this[t].length; l += h) this.setPart(t, l, i[1] || n);
|
|
13961
|
-
}
|
|
13962
|
-
replaceAlphaDays(e) {
|
|
13963
|
-
return e.replace(/-sun/gi, "-7").replace(/sun/gi, "0").replace(/mon/gi, "1").replace(/tue/gi, "2").replace(/wed/gi, "3").replace(/thu/gi, "4").replace(/fri/gi, "5").replace(/sat/gi, "6");
|
|
13964
|
-
}
|
|
13965
|
-
replaceAlphaDaysQuartz(e) {
|
|
13966
|
-
return e.replace(/sun/gi, "1").replace(/mon/gi, "2").replace(/tue/gi, "3").replace(/wed/gi, "4").replace(/thu/gi, "5").replace(/fri/gi, "6").replace(/sat/gi, "7");
|
|
13967
|
-
}
|
|
13968
|
-
replaceAlphaMonths(e) {
|
|
13969
|
-
return e.replace(/jan/gi, "1").replace(/feb/gi, "2").replace(/mar/gi, "3").replace(/apr/gi, "4").replace(/may/gi, "5").replace(/jun/gi, "6").replace(/jul/gi, "7").replace(/aug/gi, "8").replace(/sep/gi, "9").replace(/oct/gi, "10").replace(/nov/gi, "11").replace(/dec/gi, "12");
|
|
13970
|
-
}
|
|
13971
|
-
handleNicknames(e) {
|
|
13972
|
-
let t = e.trim().toLowerCase();
|
|
13973
|
-
if (t === "@yearly" || t === "@annually") return "0 0 1 1 *";
|
|
13974
|
-
if (t === "@monthly") return "0 0 1 * *";
|
|
13975
|
-
if (t === "@weekly") return "0 0 * * 0";
|
|
13976
|
-
if (t === "@daily" || t === "@midnight") return "0 0 * * *";
|
|
13977
|
-
if (t === "@hourly") return "0 * * * *";
|
|
13978
|
-
if (t === "@reboot") throw new TypeError("CronPattern: @reboot is not supported in this environment. This is an event-based trigger that requires system startup detection.");
|
|
13979
|
-
return e;
|
|
13980
|
-
}
|
|
13981
|
-
setNthWeekdayOfMonth(e, t) {
|
|
13982
|
-
if (typeof t != "number" && t.toUpperCase() === "L") this.dayOfWeek[e] = this.dayOfWeek[e] | 32;
|
|
13983
|
-
else if (t === 63) this.dayOfWeek[e] = 63;
|
|
13984
|
-
else if (t < 6 && t > 0) this.dayOfWeek[e] = this.dayOfWeek[e] | O[t - 1];
|
|
13985
|
-
else throw new TypeError(`CronPattern: nth weekday out of range, should be 1-5 or L. Value: ${t}, Type: ${typeof t}`);
|
|
13986
|
-
}
|
|
13987
|
-
};
|
|
13988
|
-
var P = [
|
|
13989
|
-
31,
|
|
13990
|
-
28,
|
|
13991
|
-
31,
|
|
13992
|
-
30,
|
|
13993
|
-
31,
|
|
13994
|
-
30,
|
|
13995
|
-
31,
|
|
13996
|
-
31,
|
|
13997
|
-
30,
|
|
13998
|
-
31,
|
|
13999
|
-
30,
|
|
14000
|
-
31
|
|
14001
|
-
], f = [
|
|
14002
|
-
[
|
|
14003
|
-
"month",
|
|
14004
|
-
"year",
|
|
14005
|
-
0
|
|
14006
|
-
],
|
|
14007
|
-
[
|
|
14008
|
-
"day",
|
|
14009
|
-
"month",
|
|
14010
|
-
-1
|
|
14011
|
-
],
|
|
14012
|
-
[
|
|
14013
|
-
"hour",
|
|
14014
|
-
"day",
|
|
14015
|
-
0
|
|
14016
|
-
],
|
|
14017
|
-
[
|
|
14018
|
-
"minute",
|
|
14019
|
-
"hour",
|
|
14020
|
-
0
|
|
14021
|
-
],
|
|
14022
|
-
[
|
|
14023
|
-
"second",
|
|
14024
|
-
"minute",
|
|
14025
|
-
0
|
|
14026
|
-
]
|
|
14027
|
-
], m = class s {
|
|
14028
|
-
tz;
|
|
14029
|
-
ms;
|
|
14030
|
-
second;
|
|
14031
|
-
minute;
|
|
14032
|
-
hour;
|
|
14033
|
-
day;
|
|
14034
|
-
month;
|
|
14035
|
-
year;
|
|
14036
|
-
constructor(e, t) {
|
|
14037
|
-
if (this.tz = t, e && e instanceof Date) if (!isNaN(e)) this.fromDate(e);
|
|
14038
|
-
else throw new TypeError("CronDate: Invalid date passed to CronDate constructor");
|
|
14039
|
-
else if (e == null) this.fromDate(/* @__PURE__ */ new Date());
|
|
14040
|
-
else if (e && typeof e == "string") this.fromString(e);
|
|
14041
|
-
else if (e instanceof s) this.fromCronDate(e);
|
|
14042
|
-
else throw new TypeError("CronDate: Invalid type (" + typeof e + ") passed to CronDate constructor");
|
|
14043
|
-
}
|
|
14044
|
-
getLastDayOfMonth(e, t) {
|
|
14045
|
-
return t !== 1 ? P[t] : new Date(Date.UTC(e, t + 1, 0)).getUTCDate();
|
|
14046
|
-
}
|
|
14047
|
-
getLastWeekday(e, t) {
|
|
14048
|
-
let r = this.getLastDayOfMonth(e, t), i = new Date(Date.UTC(e, t, r)).getUTCDay();
|
|
14049
|
-
return i === 0 ? r - 2 : i === 6 ? r - 1 : r;
|
|
14050
|
-
}
|
|
14051
|
-
getNearestWeekday(e, t, r) {
|
|
14052
|
-
let n = this.getLastDayOfMonth(e, t);
|
|
14053
|
-
if (r > n) return -1;
|
|
14054
|
-
let a = new Date(Date.UTC(e, t, r)).getUTCDay();
|
|
14055
|
-
return a === 0 ? r === n ? r - 2 : r + 1 : a === 6 ? r === 1 ? r + 2 : r - 1 : r;
|
|
14056
|
-
}
|
|
14057
|
-
isNthWeekdayOfMonth(e, t, r, n) {
|
|
14058
|
-
let a = new Date(Date.UTC(e, t, r)).getUTCDay(), o = 0;
|
|
14059
|
-
for (let h = 1; h <= r; h++) new Date(Date.UTC(e, t, h)).getUTCDay() === a && o++;
|
|
14060
|
-
if (n & 63 && O[o - 1] & n) return !0;
|
|
14061
|
-
if (n & 32) {
|
|
14062
|
-
let h = this.getLastDayOfMonth(e, t);
|
|
14063
|
-
for (let l = r + 1; l <= h; l++) if (new Date(Date.UTC(e, t, l)).getUTCDay() === a) return !1;
|
|
14064
|
-
return !0;
|
|
14065
|
-
}
|
|
14066
|
-
return !1;
|
|
14067
|
-
}
|
|
14068
|
-
fromDate(e) {
|
|
14069
|
-
if (this.tz !== void 0) if (typeof this.tz == "number") this.ms = e.getUTCMilliseconds(), this.second = e.getUTCSeconds(), this.minute = e.getUTCMinutes() + this.tz, this.hour = e.getUTCHours(), this.day = e.getUTCDate(), this.month = e.getUTCMonth(), this.year = e.getUTCFullYear(), this.apply();
|
|
14070
|
-
else try {
|
|
14071
|
-
let t = g(e, this.tz);
|
|
14072
|
-
this.ms = e.getMilliseconds(), this.second = t.s, this.minute = t.i, this.hour = t.h, this.day = t.d, this.month = t.m - 1, this.year = t.y;
|
|
14073
|
-
} catch (t) {
|
|
14074
|
-
let r = t instanceof Error ? t.message : String(t);
|
|
14075
|
-
throw new TypeError(`CronDate: Failed to convert date to timezone '${this.tz}'. This may happen with invalid timezone names or dates. Original error: ${r}`);
|
|
14076
|
-
}
|
|
14077
|
-
else this.ms = e.getMilliseconds(), this.second = e.getSeconds(), this.minute = e.getMinutes(), this.hour = e.getHours(), this.day = e.getDate(), this.month = e.getMonth(), this.year = e.getFullYear();
|
|
14078
|
-
}
|
|
14079
|
-
fromCronDate(e) {
|
|
14080
|
-
this.tz = e.tz, this.year = e.year, this.month = e.month, this.day = e.day, this.hour = e.hour, this.minute = e.minute, this.second = e.second, this.ms = e.ms;
|
|
14081
|
-
}
|
|
14082
|
-
apply() {
|
|
14083
|
-
if (this.month > 11 || this.month < 0 || this.day > P[this.month] || this.day < 1 || this.hour > 59 || this.minute > 59 || this.second > 59 || this.hour < 0 || this.minute < 0 || this.second < 0) {
|
|
14084
|
-
let e = new Date(Date.UTC(this.year, this.month, this.day, this.hour, this.minute, this.second, this.ms));
|
|
14085
|
-
return this.ms = e.getUTCMilliseconds(), this.second = e.getUTCSeconds(), this.minute = e.getUTCMinutes(), this.hour = e.getUTCHours(), this.day = e.getUTCDate(), this.month = e.getUTCMonth(), this.year = e.getUTCFullYear(), !0;
|
|
14086
|
-
} else return !1;
|
|
14087
|
-
}
|
|
14088
|
-
fromString(e) {
|
|
14089
|
-
if (typeof this.tz == "number") {
|
|
14090
|
-
let t = v(e);
|
|
14091
|
-
this.ms = t.getUTCMilliseconds(), this.second = t.getUTCSeconds(), this.minute = t.getUTCMinutes(), this.hour = t.getUTCHours(), this.day = t.getUTCDate(), this.month = t.getUTCMonth(), this.year = t.getUTCFullYear(), this.apply();
|
|
14092
|
-
} else return this.fromDate(v(e, this.tz));
|
|
14093
|
-
}
|
|
14094
|
-
findNext(e, t, r, n) {
|
|
14095
|
-
return this._findMatch(e, t, r, n, 1);
|
|
14096
|
-
}
|
|
14097
|
-
_findMatch(e, t, r, n, i) {
|
|
14098
|
-
let a = this[t], o;
|
|
14099
|
-
r.lastDayOfMonth && (o = this.getLastDayOfMonth(this.year, this.month));
|
|
14100
|
-
let h = !r.starDOW && t == "day" ? new Date(Date.UTC(this.year, this.month, 1, 0, 0, 0, 0)).getUTCDay() : void 0, l = this[t] + n, y = i === 1 ? (u) => u < r[t].length : (u) => u >= 0;
|
|
14101
|
-
for (let u = l; y(u); u += i) {
|
|
14102
|
-
let d = r[t][u];
|
|
14103
|
-
if (t === "day" && !d) {
|
|
14104
|
-
for (let c = 0; c < r.nearestWeekdays.length; c++) if (r.nearestWeekdays[c]) {
|
|
14105
|
-
let M = this.getNearestWeekday(this.year, this.month, c - n);
|
|
14106
|
-
if (M === -1) continue;
|
|
14107
|
-
if (M === u - n) {
|
|
14108
|
-
d = 1;
|
|
14109
|
-
break;
|
|
14110
|
-
}
|
|
14111
|
-
}
|
|
14112
|
-
}
|
|
14113
|
-
if (t === "day" && r.lastWeekday) {
|
|
14114
|
-
let c = this.getLastWeekday(this.year, this.month);
|
|
14115
|
-
u - n === c && (d = 1);
|
|
14116
|
-
}
|
|
14117
|
-
if (t === "day" && r.lastDayOfMonth && u - n == o && (d = 1), t === "day" && !r.starDOW) {
|
|
14118
|
-
let c = r.dayOfWeek[(h + (u - n - 1)) % 7];
|
|
14119
|
-
if (c && c & 63) c = this.isNthWeekdayOfMonth(this.year, this.month, u - n, c) ? 1 : 0;
|
|
14120
|
-
else if (c) throw new Error(`CronDate: Invalid value for dayOfWeek encountered. ${c}`);
|
|
14121
|
-
r.useAndLogic ? d = d && c : !e.domAndDow && !r.starDOM ? d = d || c : d = d && c;
|
|
14122
|
-
}
|
|
14123
|
-
if (d) return this[t] = u - n, a !== this[t] ? 2 : 1;
|
|
14124
|
-
}
|
|
14125
|
-
return 3;
|
|
14126
|
-
}
|
|
14127
|
-
recurse(e, t, r) {
|
|
14128
|
-
if (r === 0 && !e.starYear) {
|
|
14129
|
-
if (this.year >= 0 && this.year < e.year.length && e.year[this.year] === 0) {
|
|
14130
|
-
let i = -1;
|
|
14131
|
-
for (let a = this.year + 1; a < e.year.length && a < 1e4; a++) if (e.year[a] === 1) {
|
|
14132
|
-
i = a;
|
|
14133
|
-
break;
|
|
14134
|
-
}
|
|
14135
|
-
if (i === -1) return null;
|
|
14136
|
-
this.year = i, this.month = 0, this.day = 1, this.hour = 0, this.minute = 0, this.second = 0, this.ms = 0;
|
|
14137
|
-
}
|
|
14138
|
-
if (this.year >= 1e4) return null;
|
|
14139
|
-
}
|
|
14140
|
-
let n = this.findNext(t, f[r][0], e, f[r][2]);
|
|
14141
|
-
if (n > 1) {
|
|
14142
|
-
let i = r + 1;
|
|
14143
|
-
for (; i < f.length;) this[f[i][0]] = -f[i][2], i++;
|
|
14144
|
-
if (n === 3) {
|
|
14145
|
-
if (this[f[r][1]]++, this[f[r][0]] = -f[r][2], this.apply(), r === 0 && !e.starYear) {
|
|
14146
|
-
for (; this.year >= 0 && this.year < e.year.length && e.year[this.year] === 0 && this.year < 1e4;) this.year++;
|
|
14147
|
-
if (this.year >= 1e4 || this.year >= e.year.length) return null;
|
|
14148
|
-
}
|
|
14149
|
-
return this.recurse(e, t, 0);
|
|
14150
|
-
} else if (this.apply()) return this.recurse(e, t, r - 1);
|
|
14151
|
-
}
|
|
14152
|
-
return r += 1, r >= f.length ? this : (e.starYear ? this.year >= 3e3 : this.year >= 1e4) ? null : this.recurse(e, t, r);
|
|
14153
|
-
}
|
|
14154
|
-
increment(e, t, r) {
|
|
14155
|
-
return this.second += t.interval !== void 0 && t.interval > 1 && r ? t.interval : 1, this.ms = 0, this.apply(), this.recurse(e, t, 0);
|
|
14156
|
-
}
|
|
14157
|
-
decrement(e, t) {
|
|
14158
|
-
return this.second -= t.interval !== void 0 && t.interval > 1 ? t.interval : 1, this.ms = 0, this.apply(), this.recurseBackward(e, t, 0, 0);
|
|
14159
|
-
}
|
|
14160
|
-
recurseBackward(e, t, r, n = 0) {
|
|
14161
|
-
if (n > 1e4) return null;
|
|
14162
|
-
if (r === 0 && !e.starYear) {
|
|
14163
|
-
if (this.year >= 0 && this.year < e.year.length && e.year[this.year] === 0) {
|
|
14164
|
-
let a = -1;
|
|
14165
|
-
for (let o = this.year - 1; o >= 0; o--) if (e.year[o] === 1) {
|
|
14166
|
-
a = o;
|
|
14167
|
-
break;
|
|
14168
|
-
}
|
|
14169
|
-
if (a === -1) return null;
|
|
14170
|
-
this.year = a, this.month = 11, this.day = 31, this.hour = 23, this.minute = 59, this.second = 59, this.ms = 0;
|
|
14171
|
-
}
|
|
14172
|
-
if (this.year < 0) return null;
|
|
14173
|
-
}
|
|
14174
|
-
let i = this.findPrevious(t, f[r][0], e, f[r][2]);
|
|
14175
|
-
if (i > 1) {
|
|
14176
|
-
let a = r + 1;
|
|
14177
|
-
for (; a < f.length;) {
|
|
14178
|
-
let o = f[a][0], h = f[a][2], l = this.getMaxPatternValue(o, e, h);
|
|
14179
|
-
this[o] = l, a++;
|
|
14180
|
-
}
|
|
14181
|
-
if (i === 3) {
|
|
14182
|
-
if (this[f[r][1]]--, r === 0) {
|
|
14183
|
-
let y = this.getLastDayOfMonth(this.year, this.month);
|
|
14184
|
-
this.day > y && (this.day = y);
|
|
14185
|
-
}
|
|
14186
|
-
if (r === 1) if (this.day <= 0) this.day = 1;
|
|
14187
|
-
else {
|
|
14188
|
-
let y = this.year, u = this.month;
|
|
14189
|
-
for (; u < 0;) u += 12, y--;
|
|
14190
|
-
for (; u > 11;) u -= 12, y++;
|
|
14191
|
-
let d = u !== 1 ? P[u] : new Date(Date.UTC(y, u + 1, 0)).getUTCDate();
|
|
14192
|
-
this.day > d && (this.day = d);
|
|
14193
|
-
}
|
|
14194
|
-
this.apply();
|
|
14195
|
-
let o = f[r][0], h = f[r][2], l = this.getMaxPatternValue(o, e, h);
|
|
14196
|
-
if (o === "day") {
|
|
14197
|
-
let y = this.getLastDayOfMonth(this.year, this.month);
|
|
14198
|
-
this[o] = Math.min(l, y);
|
|
14199
|
-
} else this[o] = l;
|
|
14200
|
-
if (this.apply(), r === 0) {
|
|
14201
|
-
let y = f[1][2], u = this.getMaxPatternValue("day", e, y), d = this.getLastDayOfMonth(this.year, this.month), c = Math.min(u, d);
|
|
14202
|
-
c !== this.day && (this.day = c, this.hour = this.getMaxPatternValue("hour", e, f[2][2]), this.minute = this.getMaxPatternValue("minute", e, f[3][2]), this.second = this.getMaxPatternValue("second", e, f[4][2]));
|
|
14203
|
-
}
|
|
14204
|
-
if (r === 0 && !e.starYear) {
|
|
14205
|
-
for (; this.year >= 0 && this.year < e.year.length && e.year[this.year] === 0;) this.year--;
|
|
14206
|
-
if (this.year < 0) return null;
|
|
14207
|
-
}
|
|
14208
|
-
return this.recurseBackward(e, t, 0, n + 1);
|
|
14209
|
-
} else if (this.apply()) return this.recurseBackward(e, t, r - 1, n + 1);
|
|
14210
|
-
}
|
|
14211
|
-
return r += 1, r >= f.length ? this : this.year < 0 ? null : this.recurseBackward(e, t, r, n + 1);
|
|
14212
|
-
}
|
|
14213
|
-
getMaxPatternValue(e, t, r) {
|
|
14214
|
-
if (e === "day" && t.lastDayOfMonth) return this.getLastDayOfMonth(this.year, this.month);
|
|
14215
|
-
if (e === "day" && !t.starDOW) return this.getLastDayOfMonth(this.year, this.month);
|
|
14216
|
-
for (let n = t[e].length - 1; n >= 0; n--) if (t[e][n]) return n - r;
|
|
14217
|
-
return t[e].length - 1 - r;
|
|
14218
|
-
}
|
|
14219
|
-
findPrevious(e, t, r, n) {
|
|
14220
|
-
return this._findMatch(e, t, r, n, -1);
|
|
14221
|
-
}
|
|
14222
|
-
getDate(e) {
|
|
14223
|
-
return e || this.tz === void 0 ? new Date(this.year, this.month, this.day, this.hour, this.minute, this.second, this.ms) : typeof this.tz == "number" ? new Date(Date.UTC(this.year, this.month, this.day, this.hour, this.minute - this.tz, this.second, this.ms)) : k(b$1(this.year, this.month + 1, this.day, this.hour, this.minute, this.second, this.tz), !1);
|
|
14224
|
-
}
|
|
14225
|
-
getTime() {
|
|
14226
|
-
return this.getDate(!1).getTime();
|
|
14227
|
-
}
|
|
14228
|
-
match(e, t) {
|
|
14229
|
-
if (!e.starYear && (this.year < 0 || this.year >= e.year.length || e.year[this.year] === 0)) return !1;
|
|
14230
|
-
for (let r = 0; r < f.length; r++) {
|
|
14231
|
-
let n = f[r][0], i = f[r][2], a = this[n];
|
|
14232
|
-
if (a + i < 0 || a + i >= e[n].length) return !1;
|
|
14233
|
-
let o = e[n][a + i];
|
|
14234
|
-
if (n === "day") {
|
|
14235
|
-
if (!o) {
|
|
14236
|
-
for (let h = 0; h < e.nearestWeekdays.length; h++) if (e.nearestWeekdays[h]) {
|
|
14237
|
-
let l = this.getNearestWeekday(this.year, this.month, h - i);
|
|
14238
|
-
if (l !== -1 && l === a) {
|
|
14239
|
-
o = 1;
|
|
14240
|
-
break;
|
|
14241
|
-
}
|
|
14242
|
-
}
|
|
14243
|
-
}
|
|
14244
|
-
if (e.lastWeekday) a === this.getLastWeekday(this.year, this.month) && (o = 1);
|
|
14245
|
-
if (e.lastDayOfMonth) a === this.getLastDayOfMonth(this.year, this.month) && (o = 1);
|
|
14246
|
-
if (!e.starDOW) {
|
|
14247
|
-
let h = new Date(Date.UTC(this.year, this.month, 1, 0, 0, 0, 0)).getUTCDay(), l = e.dayOfWeek[(h + (a - 1)) % 7];
|
|
14248
|
-
l && l & 63 && (l = this.isNthWeekdayOfMonth(this.year, this.month, a, l) ? 1 : 0), e.useAndLogic ? o = o && l : !t.domAndDow && !e.starDOM ? o = o || l : o = o && l;
|
|
14249
|
-
}
|
|
14250
|
-
}
|
|
14251
|
-
if (!o) return !1;
|
|
14252
|
-
}
|
|
14253
|
-
return !0;
|
|
14254
|
-
}
|
|
14255
|
-
};
|
|
14256
|
-
function R(s) {
|
|
14257
|
-
if (s === void 0 && (s = {}), delete s.name, s.legacyMode !== void 0 && s.domAndDow === void 0 ? s.domAndDow = !s.legacyMode : s.domAndDow === void 0 && (s.domAndDow = !1), s.legacyMode = !s.domAndDow, s.paused = s.paused === void 0 ? !1 : s.paused, s.maxRuns = s.maxRuns === void 0 ? Infinity : s.maxRuns, s.catch = s.catch === void 0 ? !1 : s.catch, s.interval = s.interval === void 0 ? 0 : parseInt(s.interval.toString(), 10), s.utcOffset = s.utcOffset === void 0 ? void 0 : parseInt(s.utcOffset.toString(), 10), s.dayOffset = s.dayOffset === void 0 ? 0 : parseInt(s.dayOffset.toString(), 10), s.unref = s.unref === void 0 ? !1 : s.unref, s.mode = s.mode === void 0 ? "auto" : s.mode, s.alternativeWeekdays = s.alternativeWeekdays === void 0 ? !1 : s.alternativeWeekdays, s.sloppyRanges = s.sloppyRanges === void 0 ? !1 : s.sloppyRanges, ![
|
|
14258
|
-
"auto",
|
|
14259
|
-
"5-part",
|
|
14260
|
-
"6-part",
|
|
14261
|
-
"7-part",
|
|
14262
|
-
"5-or-6-parts",
|
|
14263
|
-
"6-or-7-parts"
|
|
14264
|
-
].includes(s.mode)) throw new Error("CronOptions: mode must be one of 'auto', '5-part', '6-part', '7-part', '5-or-6-parts', or '6-or-7-parts'.");
|
|
14265
|
-
if (s.startAt && (s.startAt = new m(s.startAt, s.timezone)), s.stopAt && (s.stopAt = new m(s.stopAt, s.timezone)), s.interval !== null) {
|
|
14266
|
-
if (isNaN(s.interval)) throw new Error("CronOptions: Supplied value for interval is not a number");
|
|
14267
|
-
if (s.interval < 0) throw new Error("CronOptions: Supplied value for interval can not be negative");
|
|
14268
|
-
}
|
|
14269
|
-
if (s.utcOffset !== void 0) {
|
|
14270
|
-
if (isNaN(s.utcOffset)) throw new Error("CronOptions: Invalid value passed for utcOffset, should be number representing minutes offset from UTC.");
|
|
14271
|
-
if (s.utcOffset < -870 || s.utcOffset > 870) throw new Error("CronOptions: utcOffset out of bounds.");
|
|
14272
|
-
if (s.utcOffset !== void 0 && s.timezone) throw new Error("CronOptions: Combining 'utcOffset' with 'timezone' is not allowed.");
|
|
14273
|
-
}
|
|
14274
|
-
if (s.unref !== !0 && s.unref !== !1) throw new Error("CronOptions: Unref should be either true, false or undefined(false).");
|
|
14275
|
-
if (s.dayOffset !== void 0 && s.dayOffset !== 0 && isNaN(s.dayOffset)) throw new Error("CronOptions: Invalid value passed for dayOffset, should be a number representing days to offset.");
|
|
14276
|
-
return s;
|
|
14277
|
-
}
|
|
14278
|
-
function p(s) {
|
|
14279
|
-
return Object.prototype.toString.call(s) === "[object Function]" || typeof s == "function" || s instanceof Function;
|
|
14280
|
-
}
|
|
14281
|
-
function _(s) {
|
|
14282
|
-
return p(s);
|
|
14283
|
-
}
|
|
14284
|
-
function x(s) {
|
|
14285
|
-
typeof Deno < "u" && typeof Deno.unrefTimer < "u" ? Deno.unrefTimer(s) : s && typeof s.unref < "u" && s.unref();
|
|
14286
|
-
}
|
|
14287
|
-
var W = 30 * 1e3, w = [], E = class {
|
|
14288
|
-
name;
|
|
14289
|
-
options;
|
|
14290
|
-
_states;
|
|
14291
|
-
fn;
|
|
14292
|
-
getTz() {
|
|
14293
|
-
return this.options.timezone || this.options.utcOffset;
|
|
14294
|
-
}
|
|
14295
|
-
applyDayOffset(e) {
|
|
14296
|
-
if (this.options.dayOffset !== void 0 && this.options.dayOffset !== 0) {
|
|
14297
|
-
let t = this.options.dayOffset * 24 * 60 * 60 * 1e3;
|
|
14298
|
-
return new Date(e.getTime() + t);
|
|
14299
|
-
}
|
|
14300
|
-
return e;
|
|
14301
|
-
}
|
|
14302
|
-
constructor(e, t, r) {
|
|
14303
|
-
let n, i;
|
|
14304
|
-
if (p(t)) i = t;
|
|
14305
|
-
else if (typeof t == "object") n = t;
|
|
14306
|
-
else if (t !== void 0) throw new Error("Cron: Invalid argument passed for optionsIn. Should be one of function, or object (options).");
|
|
14307
|
-
if (p(r)) i = r;
|
|
14308
|
-
else if (typeof r == "object") n = r;
|
|
14309
|
-
else if (r !== void 0) throw new Error("Cron: Invalid argument passed for funcIn. Should be one of function, or object (options).");
|
|
14310
|
-
if (this.name = n?.name, this.options = R(n), this._states = {
|
|
14311
|
-
kill: !1,
|
|
14312
|
-
blocking: !1,
|
|
14313
|
-
previousRun: void 0,
|
|
14314
|
-
currentRun: void 0,
|
|
14315
|
-
once: void 0,
|
|
14316
|
-
currentTimeout: void 0,
|
|
14317
|
-
maxRuns: n ? n.maxRuns : void 0,
|
|
14318
|
-
paused: n ? n.paused : !1,
|
|
14319
|
-
pattern: new C("* * * * *", void 0, { mode: "auto" })
|
|
14320
|
-
}, e && (e instanceof Date || typeof e == "string" && e.indexOf(":") > 0) ? this._states.once = new m(e, this.getTz()) : this._states.pattern = new C(e, this.options.timezone, {
|
|
14321
|
-
mode: this.options.mode,
|
|
14322
|
-
alternativeWeekdays: this.options.alternativeWeekdays,
|
|
14323
|
-
sloppyRanges: this.options.sloppyRanges
|
|
14324
|
-
}), this.name) {
|
|
14325
|
-
if (w.find((o) => o.name === this.name)) throw new Error("Cron: Tried to initialize new named job '" + this.name + "', but name already taken.");
|
|
14326
|
-
w.push(this);
|
|
14327
|
-
}
|
|
14328
|
-
return i !== void 0 && _(i) && (this.fn = i, this.schedule()), this;
|
|
14329
|
-
}
|
|
14330
|
-
nextRun(e) {
|
|
14331
|
-
let t = this._next(e);
|
|
14332
|
-
return t ? this.applyDayOffset(t.getDate(!1)) : null;
|
|
14333
|
-
}
|
|
14334
|
-
nextRuns(e, t) {
|
|
14335
|
-
this._states.maxRuns !== void 0 && e > this._states.maxRuns && (e = this._states.maxRuns);
|
|
14336
|
-
let r = t || this._states.currentRun || void 0;
|
|
14337
|
-
return this._enumerateRuns(e, r, "next");
|
|
14338
|
-
}
|
|
14339
|
-
previousRuns(e, t) {
|
|
14340
|
-
return this._enumerateRuns(e, t || void 0, "previous");
|
|
14341
|
-
}
|
|
14342
|
-
_enumerateRuns(e, t, r) {
|
|
14343
|
-
let n = [], i = t ? new m(t, this.getTz()) : null, a = r === "next" ? this._next : this._previous;
|
|
14344
|
-
for (; e--;) {
|
|
14345
|
-
let o = a.call(this, i);
|
|
14346
|
-
if (!o) break;
|
|
14347
|
-
let h = o.getDate(!1);
|
|
14348
|
-
n.push(this.applyDayOffset(h)), i = o;
|
|
14349
|
-
}
|
|
14350
|
-
return n;
|
|
14351
|
-
}
|
|
14352
|
-
match(e) {
|
|
14353
|
-
if (this._states.once) {
|
|
14354
|
-
let r = new m(e, this.getTz());
|
|
14355
|
-
r.ms = 0;
|
|
14356
|
-
let n = new m(this._states.once, this.getTz());
|
|
14357
|
-
return n.ms = 0, r.getTime() === n.getTime();
|
|
14358
|
-
}
|
|
14359
|
-
let t = new m(e, this.getTz());
|
|
14360
|
-
return t.ms = 0, t.match(this._states.pattern, this.options);
|
|
14361
|
-
}
|
|
14362
|
-
getPattern() {
|
|
14363
|
-
if (!this._states.once) return this._states.pattern ? this._states.pattern.pattern : void 0;
|
|
14364
|
-
}
|
|
14365
|
-
getOnce() {
|
|
14366
|
-
return this._states.once ? this._states.once.getDate() : null;
|
|
14367
|
-
}
|
|
14368
|
-
isRunning() {
|
|
14369
|
-
let e = this.nextRun(this._states.currentRun), t = !this._states.paused, r = this.fn !== void 0, n = !this._states.kill;
|
|
14370
|
-
return t && r && n && e !== null;
|
|
14371
|
-
}
|
|
14372
|
-
isStopped() {
|
|
14373
|
-
return this._states.kill;
|
|
14374
|
-
}
|
|
14375
|
-
isBusy() {
|
|
14376
|
-
return this._states.blocking;
|
|
14377
|
-
}
|
|
14378
|
-
currentRun() {
|
|
14379
|
-
return this._states.currentRun ? this._states.currentRun.getDate() : null;
|
|
14380
|
-
}
|
|
14381
|
-
previousRun() {
|
|
14382
|
-
return this._states.previousRun ? this._states.previousRun.getDate() : null;
|
|
14383
|
-
}
|
|
14384
|
-
msToNext(e) {
|
|
14385
|
-
let t = this._next(e);
|
|
14386
|
-
return t ? e instanceof m || e instanceof Date ? t.getTime() - e.getTime() : t.getTime() - new m(e).getTime() : null;
|
|
14387
|
-
}
|
|
14388
|
-
stop() {
|
|
14389
|
-
this._states.kill = !0, this._states.currentTimeout && clearTimeout(this._states.currentTimeout);
|
|
14390
|
-
let e = w.indexOf(this);
|
|
14391
|
-
e >= 0 && w.splice(e, 1);
|
|
14392
|
-
}
|
|
14393
|
-
pause() {
|
|
14394
|
-
return this._states.paused = !0, !this._states.kill;
|
|
14395
|
-
}
|
|
14396
|
-
resume() {
|
|
14397
|
-
return this._states.paused = !1, !this._states.kill;
|
|
14398
|
-
}
|
|
14399
|
-
schedule(e) {
|
|
14400
|
-
if (e && this.fn) throw new Error("Cron: It is not allowed to schedule two functions using the same Croner instance.");
|
|
14401
|
-
e && (this.fn = e);
|
|
14402
|
-
let t = this.msToNext(), r = this.nextRun(this._states.currentRun);
|
|
14403
|
-
return t == null || isNaN(t) || r === null ? this : (t > W && (t = W), this._states.currentTimeout = setTimeout(() => this._checkTrigger(r), t), this._states.currentTimeout && this.options.unref && x(this._states.currentTimeout), this);
|
|
14404
|
-
}
|
|
14405
|
-
async _trigger(e) {
|
|
14406
|
-
this._states.blocking = !0, this._states.currentRun = new m(void 0, this.getTz());
|
|
14407
|
-
try {
|
|
14408
|
-
if (this.options.catch) try {
|
|
14409
|
-
this.fn !== void 0 && await this.fn(this, this.options.context);
|
|
14410
|
-
} catch (t) {
|
|
14411
|
-
if (p(this.options.catch)) try {
|
|
14412
|
-
this.options.catch(t, this);
|
|
14413
|
-
} catch {}
|
|
14414
|
-
}
|
|
14415
|
-
else this.fn !== void 0 && await this.fn(this, this.options.context);
|
|
14416
|
-
} finally {
|
|
14417
|
-
this._states.previousRun = new m(e, this.getTz()), this._states.blocking = !1;
|
|
14418
|
-
}
|
|
14419
|
-
}
|
|
14420
|
-
async trigger() {
|
|
14421
|
-
await this._trigger();
|
|
14422
|
-
}
|
|
14423
|
-
runsLeft() {
|
|
14424
|
-
return this._states.maxRuns;
|
|
14425
|
-
}
|
|
14426
|
-
_checkTrigger(e) {
|
|
14427
|
-
let t = /* @__PURE__ */ new Date(), r = !this._states.paused && t.getTime() >= e.getTime(), n = this._states.blocking && this.options.protect;
|
|
14428
|
-
r && !n ? (this._states.maxRuns !== void 0 && this._states.maxRuns--, this._trigger()) : r && n && p(this.options.protect) && setTimeout(() => this.options.protect(this), 0), this.schedule();
|
|
14429
|
-
}
|
|
14430
|
-
_next(e) {
|
|
14431
|
-
let t = !!(e || this._states.currentRun), r = !1;
|
|
14432
|
-
!e && this.options.startAt && this.options.interval && ([e, t] = this._calculatePreviousRun(e, t), r = !e), e = new m(e, this.getTz()), this.options.startAt && e && e.getTime() < this.options.startAt.getTime() && (e = this.options.startAt);
|
|
14433
|
-
let n = this._states.once || new m(e, this.getTz());
|
|
14434
|
-
return !r && n !== this._states.once && (n = n.increment(this._states.pattern, this.options, t)), this._states.once && this._states.once.getTime() <= e.getTime() || n === null || this._states.maxRuns !== void 0 && this._states.maxRuns <= 0 || this._states.kill || this.options.stopAt && n.getTime() >= this.options.stopAt.getTime() ? null : n;
|
|
14435
|
-
}
|
|
14436
|
-
_previous(e) {
|
|
14437
|
-
let t = new m(e, this.getTz());
|
|
14438
|
-
this.options.stopAt && t.getTime() > this.options.stopAt.getTime() && (t = this.options.stopAt);
|
|
14439
|
-
let r = new m(t, this.getTz());
|
|
14440
|
-
return this._states.once ? this._states.once.getTime() < t.getTime() ? this._states.once : null : (r = r.decrement(this._states.pattern, this.options), r === null || this.options.startAt && r.getTime() < this.options.startAt.getTime() ? null : r);
|
|
14441
|
-
}
|
|
14442
|
-
_calculatePreviousRun(e, t) {
|
|
14443
|
-
let r = new m(void 0, this.getTz()), n = e;
|
|
14444
|
-
if (this.options.startAt.getTime() <= r.getTime()) {
|
|
14445
|
-
n = this.options.startAt;
|
|
14446
|
-
let i = n.getTime() + this.options.interval * 1e3;
|
|
14447
|
-
for (; i <= r.getTime();) n = new m(n, this.getTz()).increment(this._states.pattern, this.options, !0), i = n.getTime() + this.options.interval * 1e3;
|
|
14448
|
-
t = !0;
|
|
14449
|
-
}
|
|
14450
|
-
return n === null && (n = void 0), [n, t];
|
|
14451
|
-
}
|
|
14452
|
-
};
|
|
14453
|
-
|
|
14454
13719
|
//#endregion
|
|
14455
13720
|
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/core.js
|
|
14456
13721
|
var _a$1;
|
|
@@ -15062,7 +14327,7 @@ const string$1 = (params) => {
|
|
|
15062
14327
|
return new RegExp(`^${regex}$`);
|
|
15063
14328
|
};
|
|
15064
14329
|
const integer = /^-?\d+$/;
|
|
15065
|
-
const number$
|
|
14330
|
+
const number$1 = /^-?\d+(?:\.\d+)?$/;
|
|
15066
14331
|
const lowercase = /^[^A-Z]*$/;
|
|
15067
14332
|
const uppercase = /^[^a-z]*$/;
|
|
15068
14333
|
|
|
@@ -15839,7 +15104,7 @@ const $ZodJWT = /*@__PURE__*/ $constructor("$ZodJWT", (inst, def) => {
|
|
|
15839
15104
|
});
|
|
15840
15105
|
const $ZodNumber = /*@__PURE__*/ $constructor("$ZodNumber", (inst, def) => {
|
|
15841
15106
|
$ZodType.init(inst, def);
|
|
15842
|
-
inst._zod.pattern = inst._zod.bag.pattern ?? number$
|
|
15107
|
+
inst._zod.pattern = inst._zod.bag.pattern ?? number$1;
|
|
15843
15108
|
inst._zod.parse = (payload, _ctx) => {
|
|
15844
15109
|
if (def.coerce) try {
|
|
15845
15110
|
payload.value = Number(payload.value);
|
|
@@ -16376,7 +15641,7 @@ const $ZodRecord = /*@__PURE__*/ $constructor("$ZodRecord", (inst, def) => {
|
|
|
16376
15641
|
issues: []
|
|
16377
15642
|
}, ctx);
|
|
16378
15643
|
if (keyResult instanceof Promise) throw new Error("Async schemas not supported in object keys currently");
|
|
16379
|
-
if (typeof key === "string" && number$
|
|
15644
|
+
if (typeof key === "string" && number$1.test(key) && keyResult.issues.length) {
|
|
16380
15645
|
const retryResult = def.keyType._zod.run({
|
|
16381
15646
|
value: Number(key),
|
|
16382
15647
|
issues: []
|
|
@@ -16995,15 +16260,6 @@ function _number(Class, params) {
|
|
|
16995
16260
|
});
|
|
16996
16261
|
}
|
|
16997
16262
|
// @__NO_SIDE_EFFECTS__
|
|
16998
|
-
function _coercedNumber(Class, params) {
|
|
16999
|
-
return new Class({
|
|
17000
|
-
type: "number",
|
|
17001
|
-
coerce: true,
|
|
17002
|
-
checks: [],
|
|
17003
|
-
...normalizeParams(params)
|
|
17004
|
-
});
|
|
17005
|
-
}
|
|
17006
|
-
// @__NO_SIDE_EFFECTS__
|
|
17007
16263
|
function _int(Class, params) {
|
|
17008
16264
|
return new Class({
|
|
17009
16265
|
type: "number",
|
|
@@ -18217,7 +17473,7 @@ const ZodNumber = /*@__PURE__*/ $constructor("ZodNumber", (inst, def) => {
|
|
|
18217
17473
|
inst.isFinite = true;
|
|
18218
17474
|
inst.format = bag.format ?? null;
|
|
18219
17475
|
});
|
|
18220
|
-
function number
|
|
17476
|
+
function number(params) {
|
|
18221
17477
|
return _number(ZodNumber, params);
|
|
18222
17478
|
}
|
|
18223
17479
|
const ZodNumberFormat = /*@__PURE__*/ $constructor("ZodNumberFormat", (inst, def) => {
|
|
@@ -18597,12 +17853,6 @@ function superRefine(fn, params) {
|
|
|
18597
17853
|
return _superRefine(fn, params);
|
|
18598
17854
|
}
|
|
18599
17855
|
|
|
18600
|
-
//#endregion
|
|
18601
|
-
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/coerce.js
|
|
18602
|
-
function number(params) {
|
|
18603
|
-
return _coercedNumber(ZodNumber, params);
|
|
18604
|
-
}
|
|
18605
|
-
|
|
18606
17856
|
//#endregion
|
|
18607
17857
|
//#region ../../node_modules/.pnpm/kind-of@6.0.3/node_modules/kind-of/index.js
|
|
18608
17858
|
var require_kind_of = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
@@ -30202,61 +29452,6 @@ function osUsername() {
|
|
|
30202
29452
|
|
|
30203
29453
|
//#endregion
|
|
30204
29454
|
//#region ../engine/dist/index.mjs
|
|
30205
|
-
const TZ_PREFIX_PATTERN = /^TZ=([^\s]+)\s+(.+)$/u;
|
|
30206
|
-
function parseSchedule(schedule) {
|
|
30207
|
-
const trimmed = schedule.trim();
|
|
30208
|
-
if (!trimmed) throw new Error("schedule cannot be blank.");
|
|
30209
|
-
const match = TZ_PREFIX_PATTERN.exec(trimmed);
|
|
30210
|
-
if (!match) return { expression: trimmed };
|
|
30211
|
-
const timezone = match[1];
|
|
30212
|
-
const expression = match[2]?.trim();
|
|
30213
|
-
if (!timezone || !expression) throw new Error(`Invalid TZ-prefixed schedule: ${schedule}`);
|
|
30214
|
-
return {
|
|
30215
|
-
expression,
|
|
30216
|
-
timezone
|
|
30217
|
-
};
|
|
30218
|
-
}
|
|
30219
|
-
function validateSchedule(schedule) {
|
|
30220
|
-
const parsed = parseSchedule(schedule);
|
|
30221
|
-
new E(parsed.expression, {
|
|
30222
|
-
paused: true,
|
|
30223
|
-
timezone: parsed.timezone
|
|
30224
|
-
}, () => {}).stop();
|
|
30225
|
-
}
|
|
30226
|
-
var CronScheduler = class {
|
|
30227
|
-
jobs = /* @__PURE__ */ new Map();
|
|
30228
|
-
setSchedules(synthesizers, onTrigger) {
|
|
30229
|
-
const nextNames = new Set(synthesizers.map((synthesizer) => synthesizer.name));
|
|
30230
|
-
for (const [name, job] of this.jobs) if (!nextNames.has(name)) {
|
|
30231
|
-
job.stop();
|
|
30232
|
-
this.jobs.delete(name);
|
|
30233
|
-
}
|
|
30234
|
-
for (const synthesizer of synthesizers) {
|
|
30235
|
-
if (!synthesizer.schedule) {
|
|
30236
|
-
const existing = this.jobs.get(synthesizer.name);
|
|
30237
|
-
if (existing) {
|
|
30238
|
-
existing.stop();
|
|
30239
|
-
this.jobs.delete(synthesizer.name);
|
|
30240
|
-
}
|
|
30241
|
-
continue;
|
|
30242
|
-
}
|
|
30243
|
-
const parsed = parseSchedule(synthesizer.schedule);
|
|
30244
|
-
const existing = this.jobs.get(synthesizer.name);
|
|
30245
|
-
if (existing) existing.stop();
|
|
30246
|
-
this.jobs.set(synthesizer.name, new E(parsed.expression, {
|
|
30247
|
-
catch: true,
|
|
30248
|
-
timezone: parsed.timezone
|
|
30249
|
-
}, () => onTrigger({
|
|
30250
|
-
synthesizerName: synthesizer.name,
|
|
30251
|
-
trigger: "cron"
|
|
30252
|
-
})));
|
|
30253
|
-
}
|
|
30254
|
-
}
|
|
30255
|
-
stop() {
|
|
30256
|
-
for (const job of this.jobs.values()) job.stop();
|
|
30257
|
-
this.jobs.clear();
|
|
30258
|
-
}
|
|
30259
|
-
};
|
|
30260
29455
|
const SYNTHESIZERS_DIR_RELATIVE = ".agents/synthesizers";
|
|
30261
29456
|
const SAFE_ENGINE_NAME_PATTERN = /^[A-Za-z0-9._-]+$/u;
|
|
30262
29457
|
function assertSafeEngineName(name) {
|
|
@@ -30371,10 +29566,11 @@ const microsandboxConfigSchema = record(string(), unknown()).superRefine((config
|
|
|
30371
29566
|
});
|
|
30372
29567
|
}).optional();
|
|
30373
29568
|
const engineConfigSchema = strictObject({
|
|
29569
|
+
maxSliceSize: durationMsSchema.optional(),
|
|
30374
29570
|
microsandbox: microsandboxConfigSchema,
|
|
30375
29571
|
oldestConsideredPoint: isoMsSchema.optional(),
|
|
30376
|
-
|
|
30377
|
-
|
|
29572
|
+
synthesizerImage: nonEmptyStringSchema$1.optional(),
|
|
29573
|
+
tick: durationMsSchema.optional()
|
|
30378
29574
|
});
|
|
30379
29575
|
function mergeEngineConfig(...inputs) {
|
|
30380
29576
|
return applyDefaults(Object.assign({}, ...inputs.map((input) => stripUndefined(input))));
|
|
@@ -30405,10 +29601,11 @@ function validate(raw, sourcePath) {
|
|
|
30405
29601
|
}
|
|
30406
29602
|
function applyDefaults(input) {
|
|
30407
29603
|
return {
|
|
30408
|
-
synthesizerImage: input.synthesizerImage ?? "ghcr.io/usecontextlayer/ctx-sandbox:0.3.
|
|
29604
|
+
synthesizerImage: input.synthesizerImage ?? "ghcr.io/usecontextlayer/ctx-sandbox:0.3.5",
|
|
30409
29605
|
...input.microsandbox !== void 0 ? { microsandbox: input.microsandbox } : {},
|
|
30410
29606
|
...input.oldestConsideredPoint !== void 0 ? { oldestConsideredPoint: input.oldestConsideredPoint } : {},
|
|
30411
|
-
|
|
29607
|
+
maxSliceSize: input.maxSliceSize ?? 864e5,
|
|
29608
|
+
tick: input.tick ?? 12e5
|
|
30412
29609
|
};
|
|
30413
29610
|
}
|
|
30414
29611
|
function stripUndefined(value) {
|
|
@@ -30420,6 +29617,42 @@ function formatZodError$1(error) {
|
|
|
30420
29617
|
return `${issue.path.length > 0 ? issue.path.join(".") : "root"}: ${issue.message}`;
|
|
30421
29618
|
}).join("; ");
|
|
30422
29619
|
}
|
|
29620
|
+
function planLoopPass(input) {
|
|
29621
|
+
const due = input.synthesizers.filter((synthesizer) => input.now - synthesizer.frontier >= input.tick);
|
|
29622
|
+
if (due.length > 0) return {
|
|
29623
|
+
kind: "run",
|
|
29624
|
+
order: due.map((synthesizer) => synthesizer.name).sort()
|
|
29625
|
+
};
|
|
29626
|
+
return {
|
|
29627
|
+
kind: "idle",
|
|
29628
|
+
wakeAt: input.synthesizers.length === 0 ? input.now + input.tick : Math.min(...input.synthesizers.map((synthesizer) => synthesizer.frontier + input.tick))
|
|
29629
|
+
};
|
|
29630
|
+
}
|
|
29631
|
+
async function runEngineLoop(deps, options) {
|
|
29632
|
+
for (;;) {
|
|
29633
|
+
if (options.signal?.aborted) return { stopReason: "aborted" };
|
|
29634
|
+
const synthesizers = await deps.listSynthesizers();
|
|
29635
|
+
const pass = planLoopPass({
|
|
29636
|
+
now: deps.now(),
|
|
29637
|
+
synthesizers,
|
|
29638
|
+
tick: options.tick
|
|
29639
|
+
});
|
|
29640
|
+
if (pass.kind === "idle") {
|
|
29641
|
+
if (options.mode === "backfill") return { stopReason: "caught_up" };
|
|
29642
|
+
await deps.sleep(Math.max(0, pass.wakeAt - deps.now()));
|
|
29643
|
+
continue;
|
|
29644
|
+
}
|
|
29645
|
+
let advancedAny = false;
|
|
29646
|
+
for (const name of pass.order) {
|
|
29647
|
+
if (options.signal?.aborted) return { stopReason: "aborted" };
|
|
29648
|
+
if ((await deps.runSlice(name)).advanced) advancedAny = true;
|
|
29649
|
+
}
|
|
29650
|
+
if (!advancedAny) {
|
|
29651
|
+
if (options.mode === "backfill") return { stopReason: "stalled" };
|
|
29652
|
+
await deps.sleep(options.tick);
|
|
29653
|
+
}
|
|
29654
|
+
}
|
|
29655
|
+
}
|
|
30423
29656
|
function formatWorkingTreePaths(paths) {
|
|
30424
29657
|
return paths.map((entry) => ` ${entry.status} ${entry.path}`).join("\n");
|
|
30425
29658
|
}
|
|
@@ -30701,9 +29934,33 @@ function formatDirtyTreeError(repo, paths) {
|
|
|
30701
29934
|
const list = formatWorkingTreePaths(paths);
|
|
30702
29935
|
return `Engine root '${repo.rootDir}' has uncommitted or untracked changes:\n${list}`;
|
|
30703
29936
|
}
|
|
30704
|
-
const stderrLogger = {
|
|
30705
|
-
|
|
30706
|
-
}
|
|
29937
|
+
const stderrLogger = {
|
|
29938
|
+
info(message) {
|
|
29939
|
+
process.stderr.write(`${message}\n`);
|
|
29940
|
+
},
|
|
29941
|
+
warn(message) {
|
|
29942
|
+
process.stderr.write(`${message}\n`);
|
|
29943
|
+
}
|
|
29944
|
+
};
|
|
29945
|
+
const rtf = new Intl.RelativeTimeFormat("en", { numeric: "always" });
|
|
29946
|
+
const DIVISIONS = [
|
|
29947
|
+
["second", 60],
|
|
29948
|
+
["minute", 60],
|
|
29949
|
+
["hour", 24],
|
|
29950
|
+
["day", 7],
|
|
29951
|
+
["week", 4.34524],
|
|
29952
|
+
["month", 12],
|
|
29953
|
+
["year", Number.POSITIVE_INFINITY]
|
|
29954
|
+
];
|
|
29955
|
+
function formatRelativeAge(ms) {
|
|
29956
|
+
let value = Math.trunc(ms) / 1e3;
|
|
29957
|
+
if (value < 1) return "now";
|
|
29958
|
+
for (const [unit, perNext] of DIVISIONS) {
|
|
29959
|
+
if (value < perNext) return rtf.format(-Math.round(value), unit);
|
|
29960
|
+
value /= perNext;
|
|
29961
|
+
}
|
|
29962
|
+
return rtf.format(-Math.round(value), "year");
|
|
29963
|
+
}
|
|
30707
29964
|
async function runRootPreflight(repo) {
|
|
30708
29965
|
await assertGitCheckout(repo);
|
|
30709
29966
|
const branch = await inspectBranchReadiness(repo);
|
|
@@ -30749,8 +30006,7 @@ function dirtyWorkingTreeIssue(paths) {
|
|
|
30749
30006
|
}
|
|
30750
30007
|
const synthesizerSpecFrontmatterSchema = strictObject({
|
|
30751
30008
|
description: string().optional(),
|
|
30752
|
-
name: string().trim().min(1)
|
|
30753
|
-
schedule: string().trim().min(1).optional()
|
|
30009
|
+
name: string().trim().min(1)
|
|
30754
30010
|
});
|
|
30755
30011
|
function parseSynthesizerSpecMarkdown(content, sourcePath) {
|
|
30756
30012
|
if (!hasYamlFrontmatter(content)) return {
|
|
@@ -30797,7 +30053,6 @@ function parseSynthesizerSpecMarkdown(content, sourcePath) {
|
|
|
30797
30053
|
body: parsed.content,
|
|
30798
30054
|
...frontmatter.description !== void 0 ? { description: frontmatter.description } : {},
|
|
30799
30055
|
name: frontmatter.name,
|
|
30800
|
-
...frontmatter.schedule !== void 0 ? { schedule: frontmatter.schedule } : {},
|
|
30801
30056
|
sourcePath
|
|
30802
30057
|
}
|
|
30803
30058
|
};
|
|
@@ -30837,16 +30092,6 @@ async function discoverSynthesizers(synthesizersFolder) {
|
|
|
30837
30092
|
});
|
|
30838
30093
|
continue;
|
|
30839
30094
|
}
|
|
30840
|
-
if (result.spec.schedule) try {
|
|
30841
|
-
validateSchedule(result.spec.schedule);
|
|
30842
|
-
} catch (error) {
|
|
30843
|
-
errors.push({
|
|
30844
|
-
code: "invalid_schedule",
|
|
30845
|
-
message: `Invalid schedule in ${sourcePath}: ${formatError(error)}`,
|
|
30846
|
-
sourcePath
|
|
30847
|
-
});
|
|
30848
|
-
continue;
|
|
30849
|
-
}
|
|
30850
30095
|
synthesizers.push(result.spec);
|
|
30851
30096
|
}
|
|
30852
30097
|
const seen = /* @__PURE__ */ new Map();
|
|
@@ -30869,18 +30114,6 @@ async function discoverSynthesizers(synthesizersFolder) {
|
|
|
30869
30114
|
synthesizers: uniqueSynthesizers.sort((left, right) => left.name.localeCompare(right.name))
|
|
30870
30115
|
};
|
|
30871
30116
|
}
|
|
30872
|
-
async function watchSynthesizerFolder(input) {
|
|
30873
|
-
const subscription = await (await import("@parcel/watcher")).subscribe(input.synthesizersFolder, (error) => {
|
|
30874
|
-
if (error) {
|
|
30875
|
-
input.onError(error);
|
|
30876
|
-
return;
|
|
30877
|
-
}
|
|
30878
|
-
input.onChange();
|
|
30879
|
-
});
|
|
30880
|
-
return { unsubscribe: async () => {
|
|
30881
|
-
await subscription.unsubscribe();
|
|
30882
|
-
} };
|
|
30883
|
-
}
|
|
30884
30117
|
async function listMarkdownFiles(root) {
|
|
30885
30118
|
const entries = await readDirents(root);
|
|
30886
30119
|
const files = [];
|
|
@@ -31379,7 +30612,7 @@ function buildSandboxName(synthesizerName, runId) {
|
|
|
31379
30612
|
return `ctxe-${synthesizerName.slice(0, 24).toLowerCase()}-${runId.slice(-8).toLowerCase()}`;
|
|
31380
30613
|
}
|
|
31381
30614
|
function planCeiling(input) {
|
|
31382
|
-
return Math.min(input.prevCursor.frontier + input.config.
|
|
30615
|
+
return Math.min(input.prevCursor.frontier + input.config.maxSliceSize, input.wallclock);
|
|
31383
30616
|
}
|
|
31384
30617
|
function buildSlice(input) {
|
|
31385
30618
|
const slice = {};
|
|
@@ -31445,7 +30678,7 @@ function reconcileCursor(input) {
|
|
|
31445
30678
|
}
|
|
31446
30679
|
const runTriggerSchema = _enum([
|
|
31447
30680
|
"backfill",
|
|
31448
|
-
"
|
|
30681
|
+
"daemon",
|
|
31449
30682
|
"manual"
|
|
31450
30683
|
]);
|
|
31451
30684
|
_enum([
|
|
@@ -31463,8 +30696,8 @@ const runStatusSchema = _enum([
|
|
|
31463
30696
|
]);
|
|
31464
30697
|
const runRecordSchema = strictObject({
|
|
31465
30698
|
completed_at: string().min(1).optional(),
|
|
31466
|
-
duration_ms: number
|
|
31467
|
-
exit_code: number
|
|
30699
|
+
duration_ms: number().int().nonnegative().optional(),
|
|
30700
|
+
exit_code: number().int().optional(),
|
|
31468
30701
|
run_id: string().min(1),
|
|
31469
30702
|
started_at: string().min(1),
|
|
31470
30703
|
status: runStatusSchema,
|
|
@@ -31647,8 +30880,8 @@ async function openSynthesizerTransaction(input) {
|
|
|
31647
30880
|
});
|
|
31648
30881
|
const wallclock = isoToMs(startedAt, "transaction startedAt");
|
|
31649
30882
|
const planConfig = {
|
|
31650
|
-
|
|
31651
|
-
|
|
30883
|
+
maxSliceSize: input.config.maxSliceSize,
|
|
30884
|
+
oldestConsideredPoint: input.config.oldestConsideredPoint ?? wallclock - DEFAULT_OLDEST_LOOKBACK_MS
|
|
31652
30885
|
};
|
|
31653
30886
|
const { next, slice } = plan({
|
|
31654
30887
|
config: planConfig,
|
|
@@ -31759,6 +30992,7 @@ async function acquireTransactionLock(rootDir) {
|
|
|
31759
30992
|
}
|
|
31760
30993
|
const DEFAULT_BRANCH$1 = "main";
|
|
31761
30994
|
const DEFAULT_GIT_MODE = "local";
|
|
30995
|
+
const LAG_BEHIND_TICKS = 3;
|
|
31762
30996
|
var Engine = class {
|
|
31763
30997
|
configOverrides;
|
|
31764
30998
|
databaseUrl;
|
|
@@ -31766,17 +31000,12 @@ var Engine = class {
|
|
|
31766
31000
|
logger;
|
|
31767
31001
|
now;
|
|
31768
31002
|
runIdFactory;
|
|
31769
|
-
cronScheduler = new CronScheduler();
|
|
31770
31003
|
repo;
|
|
31771
31004
|
watermarkCapture;
|
|
31772
31005
|
synthesizers = /* @__PURE__ */ new Map();
|
|
31773
31006
|
config = null;
|
|
31774
31007
|
discoveryErrors = [];
|
|
31775
|
-
|
|
31776
|
-
synthesizerWatchInFlight = null;
|
|
31777
|
-
synthesizerWatchPending = false;
|
|
31778
|
-
daemonState = null;
|
|
31779
|
-
daemonStarted = false;
|
|
31008
|
+
daemonRunning = false;
|
|
31780
31009
|
constructor(options) {
|
|
31781
31010
|
this.configOverrides = options.config;
|
|
31782
31011
|
this.databaseUrl = options.databaseUrl;
|
|
@@ -31792,27 +31021,22 @@ var Engine = class {
|
|
|
31792
31021
|
this.watermarkCapture = options.watermarkCapture;
|
|
31793
31022
|
}
|
|
31794
31023
|
async runDaemon(options = {}) {
|
|
31795
|
-
if (this.
|
|
31796
|
-
this.
|
|
31024
|
+
if (this.daemonRunning) throw new Error("Engine.runDaemon is already running.");
|
|
31025
|
+
this.daemonRunning = true;
|
|
31797
31026
|
try {
|
|
31798
31027
|
const report = await runRootPreflight(this.repo);
|
|
31799
31028
|
if (!report.ready) throw new Error(formatPreflightFailure(this.repo.rootDir, report.issues));
|
|
31800
31029
|
await this.ensureLoaded();
|
|
31801
|
-
|
|
31802
|
-
|
|
31803
|
-
|
|
31804
|
-
|
|
31805
|
-
|
|
31806
|
-
|
|
31807
|
-
|
|
31808
|
-
|
|
31809
|
-
if (!this.daemonState) await this.stopDaemonRuntime();
|
|
31810
|
-
} catch (error) {
|
|
31811
|
-
await this.completeDaemon({ error });
|
|
31812
|
-
}
|
|
31813
|
-
return await daemonCompletion;
|
|
31030
|
+
await runEngineLoop(this.buildLoopDeps({
|
|
31031
|
+
signal: options.signal,
|
|
31032
|
+
trigger: "daemon"
|
|
31033
|
+
}), {
|
|
31034
|
+
mode: "daemon",
|
|
31035
|
+
signal: options.signal,
|
|
31036
|
+
tick: this.requireConfig().tick
|
|
31037
|
+
});
|
|
31814
31038
|
} finally {
|
|
31815
|
-
this.
|
|
31039
|
+
this.daemonRunning = false;
|
|
31816
31040
|
}
|
|
31817
31041
|
}
|
|
31818
31042
|
async runOnce(synthesizerName) {
|
|
@@ -31824,40 +31048,22 @@ var Engine = class {
|
|
|
31824
31048
|
}
|
|
31825
31049
|
async backfill(synthesizerName, options = {}) {
|
|
31826
31050
|
await this.prepareSynthesizerRun(synthesizerName);
|
|
31827
|
-
const startedFrontier = (await readCursor(this.repo.rootDir, synthesizerName))?.frontier ?? null;
|
|
31828
|
-
let finalFrontier = startedFrontier;
|
|
31829
31051
|
let slicesRun = 0;
|
|
31830
|
-
|
|
31831
|
-
|
|
31832
|
-
|
|
31833
|
-
|
|
31834
|
-
|
|
31835
|
-
|
|
31836
|
-
|
|
31837
|
-
|
|
31838
|
-
|
|
31839
|
-
|
|
31840
|
-
|
|
31841
|
-
options.onSlice?.(outcome);
|
|
31842
|
-
if (outcome.record.status !== "success") {
|
|
31843
|
-
stopReason = "run_failed";
|
|
31844
|
-
break;
|
|
31845
|
-
}
|
|
31846
|
-
finalFrontier = outcome.frontier;
|
|
31847
|
-
if (outcome.reachedWallclock) {
|
|
31848
|
-
stopReason = "caught_up";
|
|
31849
|
-
break;
|
|
31850
|
-
}
|
|
31851
|
-
if (options.until !== void 0 && outcome.frontier >= options.until) {
|
|
31852
|
-
stopReason = "until_reached";
|
|
31853
|
-
break;
|
|
31854
|
-
}
|
|
31855
|
-
}
|
|
31052
|
+
const result = await runEngineLoop(this.buildLoopDeps({
|
|
31053
|
+
onSlice: (outcome) => {
|
|
31054
|
+
slicesRun++;
|
|
31055
|
+
options.onSlice?.(outcome);
|
|
31056
|
+
},
|
|
31057
|
+
scopeTo: synthesizerName,
|
|
31058
|
+
trigger: "backfill"
|
|
31059
|
+
}), {
|
|
31060
|
+
mode: "backfill",
|
|
31061
|
+
tick: this.requireConfig().tick
|
|
31062
|
+
});
|
|
31856
31063
|
return {
|
|
31857
|
-
finalFrontier,
|
|
31064
|
+
finalFrontier: (await readCursor(this.repo.rootDir, synthesizerName))?.frontier ?? null,
|
|
31858
31065
|
slicesRun,
|
|
31859
|
-
|
|
31860
|
-
stopReason,
|
|
31066
|
+
stopReason: result.stopReason,
|
|
31861
31067
|
synthesizer: synthesizerName
|
|
31862
31068
|
};
|
|
31863
31069
|
}
|
|
@@ -31872,6 +31078,50 @@ var Engine = class {
|
|
|
31872
31078
|
getDiscoveryErrors() {
|
|
31873
31079
|
return [...this.discoveryErrors];
|
|
31874
31080
|
}
|
|
31081
|
+
buildLoopDeps(options) {
|
|
31082
|
+
const rootDir = this.repo.rootDir;
|
|
31083
|
+
const clock = this.now ?? (() => /* @__PURE__ */ new Date());
|
|
31084
|
+
return {
|
|
31085
|
+
listSynthesizers: async () => {
|
|
31086
|
+
await this.refreshSynthesizers();
|
|
31087
|
+
const specs = this.listSynthesizers().filter((spec) => options.scopeTo === void 0 || spec.name === options.scopeTo);
|
|
31088
|
+
return Promise.all(specs.map(async (spec) => ({
|
|
31089
|
+
frontier: (await readCursor(rootDir, spec.name))?.frontier ?? 0,
|
|
31090
|
+
name: spec.name
|
|
31091
|
+
})));
|
|
31092
|
+
},
|
|
31093
|
+
now: () => clock().getTime(),
|
|
31094
|
+
runSlice: async (name) => {
|
|
31095
|
+
try {
|
|
31096
|
+
const outcome = await this.runSynthesizerTransaction({
|
|
31097
|
+
synthesizerName: name,
|
|
31098
|
+
trigger: options.trigger
|
|
31099
|
+
});
|
|
31100
|
+
options.onSlice?.(outcome);
|
|
31101
|
+
this.logSliceLag(name, outcome);
|
|
31102
|
+
return { advanced: outcome.record.status === "success" };
|
|
31103
|
+
} catch (error) {
|
|
31104
|
+
if (error instanceof TransactionLockHeldError) {
|
|
31105
|
+
this.logger.warn(`[engine] skipping '${name}': ${error.message}`);
|
|
31106
|
+
return { advanced: false };
|
|
31107
|
+
}
|
|
31108
|
+
throw error;
|
|
31109
|
+
}
|
|
31110
|
+
},
|
|
31111
|
+
sleep: (ms) => sleepAbortable(ms, options.signal)
|
|
31112
|
+
};
|
|
31113
|
+
}
|
|
31114
|
+
logSliceLag(name, outcome) {
|
|
31115
|
+
if (outcome.record.status !== "success") {
|
|
31116
|
+
this.logger.warn(`[engine] '${name}' slice did not advance (status=${outcome.record.status})`);
|
|
31117
|
+
return;
|
|
31118
|
+
}
|
|
31119
|
+
const clock = this.now ?? (() => /* @__PURE__ */ new Date());
|
|
31120
|
+
const lagMs = Math.max(0, clock().getTime() - outcome.frontier);
|
|
31121
|
+
const note = `[engine] '${name}' frontier ${formatRelativeAge(lagMs)}`;
|
|
31122
|
+
if (lagMs > LAG_BEHIND_TICKS * this.requireConfig().tick) this.logger.warn(`${note} — behind`);
|
|
31123
|
+
else this.logger.info(note);
|
|
31124
|
+
}
|
|
31875
31125
|
async prepareSynthesizerRun(synthesizerName) {
|
|
31876
31126
|
const report = await runRootPreflight(this.repo);
|
|
31877
31127
|
if (!report.ready) throw new Error(formatPreflightFailure(this.repo.rootDir, report.issues));
|
|
@@ -31937,93 +31187,6 @@ var Engine = class {
|
|
|
31937
31187
|
this.synthesizers = catalog.synthesizersByName;
|
|
31938
31188
|
this.discoveryErrors = catalog.errors;
|
|
31939
31189
|
}
|
|
31940
|
-
applySynthesizerCatalogToCron(catalog) {
|
|
31941
|
-
this.cronScheduler.setSchedules(listSynthesizerCatalog(catalog), (cronTrigger) => {
|
|
31942
|
-
this.runSynthesizerTransaction({
|
|
31943
|
-
synthesizerName: cronTrigger.synthesizerName,
|
|
31944
|
-
trigger: "cron"
|
|
31945
|
-
}).catch((error) => {
|
|
31946
|
-
if (error instanceof TransactionLockHeldError) {
|
|
31947
|
-
this.logger.warn(`[engine] skipping cron '${cronTrigger.synthesizerName}': ${error.message}`);
|
|
31948
|
-
return;
|
|
31949
|
-
}
|
|
31950
|
-
this.handleFatalDaemonError(error);
|
|
31951
|
-
});
|
|
31952
|
-
});
|
|
31953
|
-
}
|
|
31954
|
-
async startWatcher() {
|
|
31955
|
-
const synthesizerFolder = path.resolve(this.repo.rootDir, SYNTHESIZERS_DIR_RELATIVE);
|
|
31956
|
-
try {
|
|
31957
|
-
this.watcher = await watchSynthesizerFolder({
|
|
31958
|
-
onChange: () => {
|
|
31959
|
-
this.scheduleSynthesizerWatchRefresh();
|
|
31960
|
-
},
|
|
31961
|
-
onError: (error) => {
|
|
31962
|
-
this.discoveryErrors = [...this.discoveryErrors, {
|
|
31963
|
-
code: "parse_error",
|
|
31964
|
-
message: error.message,
|
|
31965
|
-
sourcePath: synthesizerFolder
|
|
31966
|
-
}];
|
|
31967
|
-
},
|
|
31968
|
-
synthesizersFolder: synthesizerFolder
|
|
31969
|
-
});
|
|
31970
|
-
} catch (error) {
|
|
31971
|
-
if (!isMissingPathError(error)) throw error;
|
|
31972
|
-
}
|
|
31973
|
-
}
|
|
31974
|
-
scheduleSynthesizerWatchRefresh() {
|
|
31975
|
-
if (this.synthesizerWatchInFlight) {
|
|
31976
|
-
this.synthesizerWatchPending = true;
|
|
31977
|
-
return;
|
|
31978
|
-
}
|
|
31979
|
-
const work = this.discoverSynthesizerCatalog().then((catalog) => {
|
|
31980
|
-
if (!this.daemonState) return;
|
|
31981
|
-
this.replaceSynthesizerCatalog(catalog);
|
|
31982
|
-
this.applySynthesizerCatalogToCron(catalog);
|
|
31983
|
-
}).catch(() => void 0);
|
|
31984
|
-
this.synthesizerWatchInFlight = work;
|
|
31985
|
-
work.finally(() => {
|
|
31986
|
-
this.synthesizerWatchInFlight = null;
|
|
31987
|
-
if (this.synthesizerWatchPending && this.daemonState) {
|
|
31988
|
-
this.synthesizerWatchPending = false;
|
|
31989
|
-
this.scheduleSynthesizerWatchRefresh();
|
|
31990
|
-
} else this.synthesizerWatchPending = false;
|
|
31991
|
-
});
|
|
31992
|
-
}
|
|
31993
|
-
handleFatalDaemonError(error) {
|
|
31994
|
-
this.completeDaemon({ error });
|
|
31995
|
-
}
|
|
31996
|
-
openDaemonCompletion(signal) {
|
|
31997
|
-
return new Promise((resolve, reject) => {
|
|
31998
|
-
this.daemonState = {
|
|
31999
|
-
reject,
|
|
32000
|
-
resolve
|
|
32001
|
-
};
|
|
32002
|
-
if (!signal) return;
|
|
32003
|
-
if (signal.aborted) {
|
|
32004
|
-
this.completeDaemon("abort");
|
|
32005
|
-
return;
|
|
32006
|
-
}
|
|
32007
|
-
signal.addEventListener("abort", () => {
|
|
32008
|
-
this.completeDaemon("abort");
|
|
32009
|
-
}, { once: true });
|
|
32010
|
-
});
|
|
32011
|
-
}
|
|
32012
|
-
async completeDaemon(reason) {
|
|
32013
|
-
const state = this.daemonState;
|
|
32014
|
-
if (!state) return;
|
|
32015
|
-
this.daemonState = null;
|
|
32016
|
-
await this.stopDaemonRuntime();
|
|
32017
|
-
if (reason === "abort") state.resolve();
|
|
32018
|
-
else state.reject(reason.error);
|
|
32019
|
-
}
|
|
32020
|
-
async stopDaemonRuntime() {
|
|
32021
|
-
this.cronScheduler.stop();
|
|
32022
|
-
if (this.watcher) {
|
|
32023
|
-
await this.watcher.unsubscribe();
|
|
32024
|
-
this.watcher = null;
|
|
32025
|
-
}
|
|
32026
|
-
}
|
|
32027
31190
|
async ensureLoaded() {
|
|
32028
31191
|
if (!this.config) this.config = await loadEngineConfig(this.repo.rootDir, this.configOverrides);
|
|
32029
31192
|
return this.config;
|
|
@@ -32034,16 +31197,60 @@ var Engine = class {
|
|
|
32034
31197
|
return this.config;
|
|
32035
31198
|
}
|
|
32036
31199
|
};
|
|
31200
|
+
function sleepAbortable(ms, signal) {
|
|
31201
|
+
return new Promise((resolve) => {
|
|
31202
|
+
if (signal?.aborted) {
|
|
31203
|
+
resolve();
|
|
31204
|
+
return;
|
|
31205
|
+
}
|
|
31206
|
+
const timer = setTimeout(() => {
|
|
31207
|
+
signal?.removeEventListener("abort", onAbort);
|
|
31208
|
+
resolve();
|
|
31209
|
+
}, ms);
|
|
31210
|
+
const onAbort = () => {
|
|
31211
|
+
clearTimeout(timer);
|
|
31212
|
+
resolve();
|
|
31213
|
+
};
|
|
31214
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
31215
|
+
});
|
|
31216
|
+
}
|
|
32037
31217
|
function formatPreflightFailure(rootDir, issues) {
|
|
32038
31218
|
return `Engine root '${rootDir}' is not ready:\n${issues.map((issue) => ` [${issue.code}] ${issue.message}`).join("\n")}`;
|
|
32039
31219
|
}
|
|
32040
|
-
function
|
|
32041
|
-
|
|
31220
|
+
function assembleEngineStatus(input) {
|
|
31221
|
+
const synthesizers = input.synthesizers.map((synthesizer) => {
|
|
31222
|
+
const lagMs = synthesizer.frontier === null ? null : Math.max(0, input.now - synthesizer.frontier);
|
|
31223
|
+
return {
|
|
31224
|
+
frontier: synthesizer.frontier === null ? null : msToIso(synthesizer.frontier),
|
|
31225
|
+
lagMs,
|
|
31226
|
+
lagText: lagMs === null ? "never run" : formatRelativeAge(lagMs),
|
|
31227
|
+
latestRun: synthesizer.latestRun,
|
|
31228
|
+
name: synthesizer.name
|
|
31229
|
+
};
|
|
31230
|
+
}).sort((left, right) => left.name.localeCompare(right.name));
|
|
31231
|
+
return {
|
|
31232
|
+
now: msToIso(input.now),
|
|
31233
|
+
synthesizers
|
|
31234
|
+
};
|
|
32042
31235
|
}
|
|
32043
|
-
function
|
|
32044
|
-
|
|
32045
|
-
|
|
32046
|
-
|
|
31236
|
+
async function loadEngineStatus(input) {
|
|
31237
|
+
const now = input.now ?? Date.now();
|
|
31238
|
+
const discovery = await discoverSynthesizers(path.resolve(input.rootDir, SYNTHESIZERS_DIR_RELATIVE));
|
|
31239
|
+
const latestByName = latestRunByName(await listRunRecords({ rootDir: input.rootDir }));
|
|
31240
|
+
const names = discovery.synthesizers.map((synthesizer) => synthesizer.name).filter((name) => input.synthesizerName === void 0 || name === input.synthesizerName);
|
|
31241
|
+
return assembleEngineStatus({
|
|
31242
|
+
now,
|
|
31243
|
+
synthesizers: await Promise.all(names.map(async (name) => ({
|
|
31244
|
+
frontier: (await readCursor(input.rootDir, name))?.frontier ?? null,
|
|
31245
|
+
latestRun: latestByName.get(name) ?? null,
|
|
31246
|
+
name
|
|
31247
|
+
})))
|
|
31248
|
+
});
|
|
31249
|
+
}
|
|
31250
|
+
function latestRunByName(entries) {
|
|
31251
|
+
const latest = /* @__PURE__ */ new Map();
|
|
31252
|
+
for (const { record } of entries) if (!latest.has(record.synthesizer)) latest.set(record.synthesizer, record);
|
|
31253
|
+
return latest;
|
|
32047
31254
|
}
|
|
32048
31255
|
var MicrosandboxClaudeExecutor = class {
|
|
32049
31256
|
async run(input) {
|
|
@@ -32336,11 +31543,6 @@ function resolveDatabaseUrl(input) {
|
|
|
32336
31543
|
function formatJsonOutput(value) {
|
|
32337
31544
|
return JSON.stringify(value, null, " ");
|
|
32338
31545
|
}
|
|
32339
|
-
function latestRunsBySynthesizer(records) {
|
|
32340
|
-
const latest = /* @__PURE__ */ new Map();
|
|
32341
|
-
for (const record of records) if (!latest.has(record.synthesizer)) latest.set(record.synthesizer, record);
|
|
32342
|
-
return [...latest.values()].sort((left, right) => left.synthesizer.localeCompare(right.synthesizer));
|
|
32343
|
-
}
|
|
32344
31546
|
function formatRunLogs(input) {
|
|
32345
31547
|
return `${[
|
|
32346
31548
|
`synthesizer: ${input.record.synthesizer}`,
|
|
@@ -32358,7 +31560,6 @@ async function loadEngineList(paths) {
|
|
|
32358
31560
|
synthesizers: discovery.synthesizers.map((synthesizer) => ({
|
|
32359
31561
|
...synthesizer.description !== void 0 ? { description: synthesizer.description } : {},
|
|
32360
31562
|
name: synthesizer.name,
|
|
32361
|
-
schedule: synthesizer.schedule ?? null,
|
|
32362
31563
|
sourcePath: synthesizer.sourcePath
|
|
32363
31564
|
}))
|
|
32364
31565
|
};
|
|
@@ -32369,11 +31570,11 @@ async function runEngineListCommand(paths) {
|
|
|
32369
31570
|
if (output.errors.length > 0) process.exitCode = 1;
|
|
32370
31571
|
}
|
|
32371
31572
|
async function runEngineStatusCommand(synthesizerName, paths) {
|
|
32372
|
-
const
|
|
32373
|
-
|
|
32374
|
-
|
|
32375
|
-
})
|
|
32376
|
-
process.stdout.write(`${formatJsonOutput(
|
|
31573
|
+
const status = await loadEngineStatus({
|
|
31574
|
+
rootDir: paths.rootDir,
|
|
31575
|
+
...synthesizerName ? { synthesizerName } : {}
|
|
31576
|
+
});
|
|
31577
|
+
process.stdout.write(`${formatJsonOutput(status)}\n`);
|
|
32377
31578
|
}
|
|
32378
31579
|
async function runEngineLogsCommand(synthesizerName, options, paths) {
|
|
32379
31580
|
const records = await listRunRecords({
|
|
@@ -32391,35 +31592,18 @@ async function runEngineLogsCommand(synthesizerName, options, paths) {
|
|
|
32391
31592
|
|
|
32392
31593
|
//#endregion
|
|
32393
31594
|
//#region commands/backfill.ts
|
|
32394
|
-
const backfillOptionsSchema = object({
|
|
32395
|
-
maxRuns: number().int().positive().optional(),
|
|
32396
|
-
until: isoMsSchema.optional()
|
|
32397
|
-
});
|
|
32398
31595
|
async function runBackfillCommand(input) {
|
|
32399
|
-
const parsed = backfillOptionsSchema.safeParse({
|
|
32400
|
-
maxRuns: input.maxRuns,
|
|
32401
|
-
until: input.until
|
|
32402
|
-
});
|
|
32403
|
-
if (!parsed.success) {
|
|
32404
|
-
const detail = parsed.error.issues.map((issue) => `${issue.path.join(".") || "option"}: ${issue.message}`).join("; ");
|
|
32405
|
-
throw new Error(`Invalid backfill options: ${detail}`);
|
|
32406
|
-
}
|
|
32407
31596
|
const summary = await buildEngine({
|
|
32408
31597
|
databaseUrl: resolveDatabaseUrl({ cliValue: input.databaseUrl }),
|
|
32409
31598
|
paths: input.paths
|
|
32410
|
-
}).backfill(input.synthesizerName, {
|
|
32411
|
-
|
|
32412
|
-
|
|
32413
|
-
process.stdout.write(`${formatJsonOutput(outcome.record)}\n`);
|
|
32414
|
-
},
|
|
32415
|
-
until: parsed.data.until
|
|
32416
|
-
});
|
|
31599
|
+
}).backfill(input.synthesizerName, { onSlice: (outcome) => {
|
|
31600
|
+
process.stdout.write(`${formatJsonOutput(outcome.record)}\n`);
|
|
31601
|
+
} });
|
|
32417
31602
|
process.stdout.write(`${formatJsonOutput({
|
|
32418
31603
|
...summary,
|
|
32419
|
-
finalFrontier: summary.finalFrontier === null ? null : msToIso(summary.finalFrontier)
|
|
32420
|
-
startedFrontier: summary.startedFrontier === null ? null : msToIso(summary.startedFrontier)
|
|
31604
|
+
finalFrontier: summary.finalFrontier === null ? null : msToIso(summary.finalFrontier)
|
|
32421
31605
|
})}\n`);
|
|
32422
|
-
if (summary.stopReason === "
|
|
31606
|
+
if (summary.stopReason === "stalled") process.exitCode = 1;
|
|
32423
31607
|
}
|
|
32424
31608
|
|
|
32425
31609
|
//#endregion
|
|
@@ -32520,7 +31704,7 @@ function deriveContextEnginePaths(rootDir) {
|
|
|
32520
31704
|
|
|
32521
31705
|
//#endregion
|
|
32522
31706
|
//#region package.json
|
|
32523
|
-
var version = "0.3.
|
|
31707
|
+
var version = "0.3.5";
|
|
32524
31708
|
|
|
32525
31709
|
//#endregion
|
|
32526
31710
|
//#region cli.ts
|
|
@@ -32546,7 +31730,7 @@ function createProgram() {
|
|
|
32546
31730
|
program.command("list").description("List synthesizers").action(async function() {
|
|
32547
31731
|
await runEngineListCommand(resolveRuntimePaths(this));
|
|
32548
31732
|
});
|
|
32549
|
-
program.command("status").argument("[synthesizer]", "Only show
|
|
31733
|
+
program.command("status").argument("[synthesizer]", "Only show this synthesizer").description("Print each synthesizer's freshness as JSON: its frontier (the source-time its cursor has reached), how far that lags behind now, and its latest run.").action(async function(synthesizerName) {
|
|
32550
31734
|
await runEngineStatusCommand(synthesizerName, resolveRuntimePaths(this));
|
|
32551
31735
|
});
|
|
32552
31736
|
program.command("logs").argument("<synthesizer>", "Synthesizer name").option("--run-id <id>", "Print stderr for a specific run id").description("Print the engine's per-run stderr for a synthesizer run. The Claude session transcript is a separate file at <rootDir>/.claude/projects/<claude-encoded-rootDir>/<runId>.jsonl, where <claude-encoded-rootDir> is Claude Code's own cwd-derived project key (the guest workdir mirrors the host rootDir, so the key matches what host Claude produces in the same directory). The run id and the Claude --session-id are the same UUIDv7 value.").action(async function(synthesizerName, options) {
|
|
@@ -32565,17 +31749,15 @@ function createProgram() {
|
|
|
32565
31749
|
synthesizerName
|
|
32566
31750
|
});
|
|
32567
31751
|
});
|
|
32568
|
-
program.command("backfill").argument("<synthesizer>", "Synthesizer name").option("--
|
|
31752
|
+
program.command("backfill").argument("<synthesizer>", "Synthesizer name").option("--database-url <url>", "Postgres URL of the ContextBase database the synthesizer reads from. Falls back to CTXB_DATABASE_URL.").description("Walk a synthesizer's cursor forward slice-by-slice until it catches up to now. The same loop the daemon runs, without the sleep. Streams each slice's run record; prints a summary; exits non-zero only if a slice fails.").action(async function(synthesizerName, options) {
|
|
32569
31753
|
await runBackfillCommand({
|
|
32570
31754
|
databaseUrl: options.databaseUrl,
|
|
32571
|
-
maxRuns: options.maxRuns,
|
|
32572
31755
|
paths: resolveRuntimePaths(this),
|
|
32573
|
-
synthesizerName
|
|
32574
|
-
until: options.until
|
|
31756
|
+
synthesizerName
|
|
32575
31757
|
});
|
|
32576
31758
|
});
|
|
32577
31759
|
const daemonCommand = program.command("daemon").description("Engine daemon commands");
|
|
32578
|
-
daemonCommand.command("start").option("--database-url <url>", "Postgres URL of the ContextBase database the daemon's synthesizers read from. Falls back to CTXB_DATABASE_URL.").description("Start the engine daemon: root preflight,
|
|
31760
|
+
daemonCommand.command("start").option("--database-url <url>", "Postgres URL of the ContextBase database the daemon's synthesizers read from. Falls back to CTXB_DATABASE_URL.").description("Start the engine daemon: root preflight, then run every due synthesizer one slice per pass (re-discovering each pass), sleeping until the next is due. Blocks until SIGINT/SIGTERM or fatal error.").action(async function(options) {
|
|
32579
31761
|
await runStartCommand({
|
|
32580
31762
|
databaseUrl: options.databaseUrl,
|
|
32581
31763
|
paths: resolveRuntimePaths(this)
|