@kky42/pievo-server 1.0.0
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/.output/nitro.json +17 -0
- package/.output/public/assets/CodeField-dOzyFQNH.js +34 -0
- package/.output/public/assets/LoopView-B4H9QibC.js +55 -0
- package/.output/public/assets/Modal-D33gNSgx.js +1 -0
- package/.output/public/assets/SignIn-SHuRRyOv.js +1 -0
- package/.output/public/assets/actionUi-ChGGALzg.js +1 -0
- package/.output/public/assets/app-DElSo_jy.css +2 -0
- package/.output/public/assets/artifactView-DFuubXLJ.js +66 -0
- package/.output/public/assets/index-DfpTWRSz.js +12 -0
- package/.output/public/assets/invite._token-DJtd-XE2.js +1 -0
- package/.output/public/assets/invite._token-T8oo4Qtw.js +1 -0
- package/.output/public/assets/jsx-runtime-BseJUIpC.js +1 -0
- package/.output/public/assets/lifecycleUi-DKkChdnU.js +1 -0
- package/.output/public/assets/loopApi-BM2nj71x.js +3 -0
- package/.output/public/assets/loops._loopId-B19Jw7jC.js +5 -0
- package/.output/public/assets/loops._loopId_.runs._runId-_CflHV38.js +3 -0
- package/.output/public/assets/notifyFns-DCubjpRy.js +1 -0
- package/.output/public/assets/preload-helper-CKUiEq3b.js +3 -0
- package/.output/public/assets/routes-B9tgli5f.js +1 -0
- package/.output/public/assets/routes-CTtlM_qt.js +1 -0
- package/.output/public/assets/t._teamId-Bm21mngW.js +1 -0
- package/.output/public/assets/t._teamId-gR7BVKkR.js +1 -0
- package/.output/public/assets/ui-Dp88qUWh.js +1 -0
- package/.output/public/assets/useRouter-DsjH8G0p.js +1 -0
- package/.output/public/favicon.svg +12 -0
- package/.output/public/fonts/GeistPixel-Square.woff2 +0 -0
- package/.output/server/_chunks/ssr-renderer.mjs +26 -0
- package/.output/server/_libs/@aws-crypto/crc32+[...].mjs +419 -0
- package/.output/server/_libs/@aws-sdk/checksums+[...].mjs +10732 -0
- package/.output/server/_libs/@aws-sdk/client-s3+[...].mjs +9475 -0
- package/.output/server/_libs/@aws-sdk/credential-provider-http+[...].mjs +137 -0
- package/.output/server/_libs/@aws-sdk/credential-provider-ini+[...].mjs +440 -0
- package/.output/server/_libs/@aws-sdk/credential-provider-process+[...].mjs +62 -0
- package/.output/server/_libs/@aws-sdk/credential-provider-sso+[...].mjs +818 -0
- package/.output/server/_libs/@aws-sdk/credential-provider-web-identity+[...].mjs +59 -0
- package/.output/server/_libs/@base-ui/react+[...].mjs +11125 -0
- package/.output/server/_libs/@codemirror/autocomplete+[...].mjs +19713 -0
- package/.output/server/_libs/@codemirror/lang-css+[...].mjs +2636 -0
- package/.output/server/_libs/@codemirror/lang-html+[...].mjs +2247 -0
- package/.output/server/_libs/@codemirror/lang-json+[...].mjs +79 -0
- package/.output/server/_libs/@reduxjs/toolkit+[...].mjs +1736 -0
- package/.output/server/_libs/@smithy/credential-provider-imds+[...].mjs +342 -0
- package/.output/server/_libs/@tanstack/react-router+[...].mjs +14300 -0
- package/.output/server/_libs/@uiw/codemirror-extensions-basic-setup+[...].mjs +76 -0
- package/.output/server/_libs/atomic-sleep.mjs +27 -0
- package/.output/server/_libs/aws-crypto__crc32c.mjs +314 -0
- package/.output/server/_libs/aws-sdk__nested-clients.mjs +2671 -0
- package/.output/server/_libs/babel__runtime.mjs +30 -0
- package/.output/server/_libs/clsx.mjs +16 -0
- package/.output/server/_libs/codemirror__commands.mjs +1725 -0
- package/.output/server/_libs/codemirror__lint.mjs +565 -0
- package/.output/server/_libs/codemirror__search.mjs +1138 -0
- package/.output/server/_libs/codemirror__theme-one-dark.mjs +161 -0
- package/.output/server/_libs/colorette.mjs +129 -0
- package/.output/server/_libs/croner.mjs +735 -0
- package/.output/server/_libs/d3-array.mjs +231 -0
- package/.output/server/_libs/d3-color.mjs +330 -0
- package/.output/server/_libs/d3-format.mjs +252 -0
- package/.output/server/_libs/d3-interpolate.mjs +163 -0
- package/.output/server/_libs/d3-path.mjs +77 -0
- package/.output/server/_libs/d3-scale+[...].mjs +1907 -0
- package/.output/server/_libs/d3-shape.mjs +689 -0
- package/.output/server/_libs/dateformat.mjs +341 -0
- package/.output/server/_libs/decimal.js-light.mjs +884 -0
- package/.output/server/_libs/diff.mjs +732 -0
- package/.output/server/_libs/dom-serializer+[...].mjs +708 -0
- package/.output/server/_libs/domhandler.mjs +461 -0
- package/.output/server/_libs/dompurify.mjs +2111 -0
- package/.output/server/_libs/domutils.mjs +868 -0
- package/.output/server/_libs/drizzle-orm+postgres.mjs +7689 -0
- package/.output/server/_libs/electric-sql__pglite.mjs +14674 -0
- package/.output/server/_libs/end-of-stream+once+wrappy.mjs +145 -0
- package/.output/server/_libs/es-toolkit.mjs +1737 -0
- package/.output/server/_libs/eventemitter3.mjs +236 -0
- package/.output/server/_libs/fast-copy.mjs +285 -0
- package/.output/server/_libs/fast-safe-stringify.mjs +172 -0
- package/.output/server/_libs/h3+rou3+srvx.mjs +1201 -0
- package/.output/server/_libs/html-dom-parser+htmlparser2.mjs +1560 -0
- package/.output/server/_libs/html-react-parser+[...].mjs +1360 -0
- package/.output/server/_libs/initdb.wasm +0 -0
- package/.output/server/_libs/marked.mjs +1548 -0
- package/.output/server/_libs/on-exit-leak-free.mjs +80 -0
- package/.output/server/_libs/pglite.data +37667 -8
- package/.output/server/_libs/pglite.wasm +0 -0
- package/.output/server/_libs/pino+[...].mjs +3196 -0
- package/.output/server/_libs/pino-abstract-transport+split2.mjs +194 -0
- package/.output/server/_libs/pino-pretty+[...].mjs +1623 -0
- package/.output/server/_libs/pinojs__redact.mjs +280 -0
- package/.output/server/_libs/react-redux+[...].mjs +205 -0
- package/.output/server/_libs/recharts+victory-vendor.mjs +15875 -0
- package/.output/server/_libs/tanstack__history.mjs +342 -0
- package/.output/server/_libs/ufo.mjs +64 -0
- package/.output/server/_libs/uiw__codemirror-themes.mjs +32 -0
- package/.output/server/_libs/uiw__react-codemirror.mjs +354 -0
- package/.output/server/_runtime.mjs +37 -0
- package/.output/server/_ssr/CodeField-tm4rr6G3.mjs +143 -0
- package/.output/server/_ssr/DashboardView-CC7htv28.mjs +2795 -0
- package/.output/server/_ssr/LoopPlaybook-BXH8mhiX.mjs +2105 -0
- package/.output/server/_ssr/LoopView-DCugEbHx.mjs +1106 -0
- package/.output/server/_ssr/Modal-DpKZHLZK.mjs +49 -0
- package/.output/server/_ssr/SignIn-dTndU6Hw.mjs +67 -0
- package/.output/server/_ssr/actionUi-CZbEixbf.mjs +119 -0
- package/.output/server/_ssr/adapters-BS8XosjF.mjs +130 -0
- package/.output/server/_ssr/artifactFiles-Cagtj7J0.mjs +61 -0
- package/.output/server/_ssr/artifactKind-BW0isV8L.mjs +37 -0
- package/.output/server/_ssr/artifactView-DS4O22wl.mjs +304 -0
- package/.output/server/_ssr/artifacts-DngKyW2u.mjs +2 -0
- package/.output/server/_ssr/auth-DY1DuYZd.mjs +38429 -0
- package/.output/server/_ssr/boot-BbtG0ImW.mjs +9010 -0
- package/.output/server/_ssr/boot-CMHTxQpJ.mjs +2 -0
- package/.output/server/_ssr/bun-sqlite-dialect-BW9W1_Ps-CU1Spd6z.mjs +162 -0
- package/.output/server/_ssr/core-RrmWoKne.mjs +5 -0
- package/.output/server/_ssr/createServerRpc-BD8Xn_0_.mjs +12 -0
- package/.output/server/_ssr/d1-sqlite-dialect-BLC8LXE6-DfG7tB8s.mjs +112 -0
- package/.output/server/_ssr/db-DWAuZq1o.mjs +2 -0
- package/.output/server/_ssr/dist-BIxFFVZg.mjs +342 -0
- package/.output/server/_ssr/empty-plugin-adapters-DKUlnwwl.mjs +5 -0
- package/.output/server/_ssr/factory-Blq0DYfT.mjs +6903 -0
- package/.output/server/_ssr/invite._token-BRCo9LGB.mjs +36 -0
- package/.output/server/_ssr/invite._token-DJxGLILJ.mjs +28 -0
- package/.output/server/_ssr/invite._token-NewFt27g.mjs +92 -0
- package/.output/server/_ssr/kysely-adapter-D3XTe64J.mjs +2 -0
- package/.output/server/_ssr/kysely-migration-tables-JkVUjPF_-bPAX9LR_.mjs +19 -0
- package/.output/server/_ssr/lifecycleUi-C9lg1r3r.mjs +38 -0
- package/.output/server/_ssr/logger-Dw82jNjH.mjs +2 -0
- package/.output/server/_ssr/loopApi-BtfkZQYK.mjs +532 -0
- package/.output/server/_ssr/loopApi-Cxe8WyOB.mjs +105 -0
- package/.output/server/_ssr/loops._loopId-7NQJPB9W.mjs +30 -0
- package/.output/server/_ssr/loops._loopId-DhnArGdL.mjs +1635 -0
- package/.output/server/_ssr/loops._loopId_.runs._runId-Bvuo2nki.mjs +29 -0
- package/.output/server/_ssr/loops._loopId_.runs._runId-Dip5Xk-q.mjs +674 -0
- package/.output/server/_ssr/machineFns-Dvr5ICUy.mjs +266 -0
- package/.output/server/_ssr/node-sqlite-dialect-DhyOpJTX.mjs +162 -0
- package/.output/server/_ssr/notifyFns-BcMRY5kP.mjs +118 -0
- package/.output/server/_ssr/notifyFns-Q458pZmE.mjs +580 -0
- package/.output/server/_ssr/router-J8KZ30xw.mjs +678 -0
- package/.output/server/_ssr/routes-Bcs4T1ox.mjs +28 -0
- package/.output/server/_ssr/routes-BoGrcf-b.mjs +43 -0
- package/.output/server/_ssr/routes-D4am3Zff.mjs +28 -0
- package/.output/server/_ssr/runDiff-CpEFqo7G.mjs +113 -0
- package/.output/server/_ssr/ssr.mjs +5837 -0
- package/.output/server/_ssr/start-4ifArtKx.mjs +4 -0
- package/.output/server/_ssr/store-b3JcQ08F.mjs +2 -0
- package/.output/server/_ssr/t._teamId-CeUhzgzT.mjs +32 -0
- package/.output/server/_ssr/t._teamId-DR-hQK7o.mjs +47 -0
- package/.output/server/_ssr/t._teamId-Dy_McbRt.mjs +31 -0
- package/.output/server/_ssr/teamCookie-B7hLOIie.mjs +10 -0
- package/.output/server/_ssr/teamFns-BIDnsg2A.mjs +473 -0
- package/.output/server/_ssr/teamFns-DA4ovI5g.mjs +33 -0
- package/.output/server/_ssr/tokens-ytd60FUt.mjs +2 -0
- package/.output/server/_ssr/ui-Dej2qjuS.mjs +267 -0
- package/.output/server/_tanstack-start-manifest_v-CVS6c7re.mjs +95 -0
- package/.output/server/drizzle/0000_round_marauders.sql +193 -0
- package/.output/server/drizzle/0001_naive_silver_fox.sql +25 -0
- package/.output/server/drizzle/0002_funny_sage.sql +12 -0
- package/.output/server/drizzle/0003_optimal_slapstick.sql +102 -0
- package/.output/server/drizzle/0004_remove_grok_agent.sql +5 -0
- package/.output/server/drizzle/0005_heavy_gauntlet.sql +8 -0
- package/.output/server/drizzle/0006_tranquil_sharon_carter.sql +1 -0
- package/.output/server/drizzle/0007_faulty_starbolt.sql +30 -0
- package/.output/server/drizzle/0008_durable_lifecycle_evidence.sql +15 -0
- package/.output/server/drizzle/meta/0000_snapshot.json +1333 -0
- package/.output/server/drizzle/meta/0001_snapshot.json +1498 -0
- package/.output/server/drizzle/meta/0002_snapshot.json +1576 -0
- package/.output/server/drizzle/meta/0003_snapshot.json +1666 -0
- package/.output/server/drizzle/meta/0005_snapshot.json +1666 -0
- package/.output/server/drizzle/meta/0006_snapshot.json +1672 -0
- package/.output/server/drizzle/meta/0007_snapshot.json +1787 -0
- package/.output/server/drizzle/meta/_journal.json +69 -0
- package/.output/server/index.mjs +464 -0
- package/.output/server/node_modules/tslib/modules/index.js +70 -0
- package/.output/server/node_modules/tslib/modules/package.json +3 -0
- package/.output/server/node_modules/tslib/package.json +47 -0
- package/.output/server/node_modules/tslib/tslib.js +484 -0
- package/.output/server/package.json +9 -0
- package/LICENSE +21 -0
- package/drizzle/0000_round_marauders.sql +193 -0
- package/drizzle/0001_naive_silver_fox.sql +25 -0
- package/drizzle/0002_funny_sage.sql +12 -0
- package/drizzle/0003_optimal_slapstick.sql +102 -0
- package/drizzle/0004_remove_grok_agent.sql +5 -0
- package/drizzle/0005_heavy_gauntlet.sql +8 -0
- package/drizzle/0006_tranquil_sharon_carter.sql +1 -0
- package/drizzle/0007_faulty_starbolt.sql +30 -0
- package/drizzle/0008_durable_lifecycle_evidence.sql +15 -0
- package/drizzle/meta/0000_snapshot.json +1333 -0
- package/drizzle/meta/0001_snapshot.json +1498 -0
- package/drizzle/meta/0002_snapshot.json +1576 -0
- package/drizzle/meta/0003_snapshot.json +1666 -0
- package/drizzle/meta/0005_snapshot.json +1666 -0
- package/drizzle/meta/0006_snapshot.json +1672 -0
- package/drizzle/meta/0007_snapshot.json +1787 -0
- package/drizzle/meta/_journal.json +69 -0
- package/package.json +84 -0
- package/scripts/pievo-server.mjs +390 -0
- package/scripts/prestart.mjs +66 -0
- package/scripts/server-cli-lib.mjs +451 -0
|
@@ -0,0 +1,735 @@
|
|
|
1
|
+
//#region ../../node_modules/.pnpm/croner@10.0.1/node_modules/croner/dist/croner.js
|
|
2
|
+
function T(s) {
|
|
3
|
+
return Date.UTC(s.y, s.m - 1, s.d, s.h, s.i, s.s);
|
|
4
|
+
}
|
|
5
|
+
function D(s, e) {
|
|
6
|
+
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;
|
|
7
|
+
}
|
|
8
|
+
function A(s, e) {
|
|
9
|
+
let t = new Date(Date.parse(s));
|
|
10
|
+
if (isNaN(t)) throw new Error("Invalid ISO8601 passed to timezone parser.");
|
|
11
|
+
let r = s.substring(9);
|
|
12
|
+
return r.includes("Z") || r.includes("+") || r.includes("-") ? b(t.getUTCFullYear(), t.getUTCMonth() + 1, t.getUTCDate(), t.getUTCHours(), t.getUTCMinutes(), t.getUTCSeconds(), "Etc/UTC") : b(t.getFullYear(), t.getMonth() + 1, t.getDate(), t.getHours(), t.getMinutes(), t.getSeconds(), e);
|
|
13
|
+
}
|
|
14
|
+
function v(s, e, t) {
|
|
15
|
+
return k(A(s, e), t);
|
|
16
|
+
}
|
|
17
|
+
function k(s, e) {
|
|
18
|
+
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);
|
|
19
|
+
if (D(h, s)) {
|
|
20
|
+
let u = /* @__PURE__ */ new Date(o.getTime() - 36e5);
|
|
21
|
+
return D(g(u, s.tz), s) ? u : o;
|
|
22
|
+
}
|
|
23
|
+
let l = new Date(o.getTime() + T(s) - T(h));
|
|
24
|
+
if (D(g(l, s.tz), s)) return l;
|
|
25
|
+
if (e) throw new Error("Invalid date passed to fromTZ()");
|
|
26
|
+
return o.getTime() > l.getTime() ? o : l;
|
|
27
|
+
}
|
|
28
|
+
function g(s, e) {
|
|
29
|
+
let t, r;
|
|
30
|
+
try {
|
|
31
|
+
t = new Intl.DateTimeFormat("en-US", {
|
|
32
|
+
timeZone: e,
|
|
33
|
+
year: "numeric",
|
|
34
|
+
month: "numeric",
|
|
35
|
+
day: "numeric",
|
|
36
|
+
hour: "numeric",
|
|
37
|
+
minute: "numeric",
|
|
38
|
+
second: "numeric",
|
|
39
|
+
hour12: !1
|
|
40
|
+
}), r = t.formatToParts(s);
|
|
41
|
+
} catch (i) {
|
|
42
|
+
let a = i instanceof Error ? i.message : String(i);
|
|
43
|
+
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}`);
|
|
44
|
+
}
|
|
45
|
+
let n = {
|
|
46
|
+
year: 0,
|
|
47
|
+
month: 0,
|
|
48
|
+
day: 0,
|
|
49
|
+
hour: 0,
|
|
50
|
+
minute: 0,
|
|
51
|
+
second: 0
|
|
52
|
+
};
|
|
53
|
+
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));
|
|
54
|
+
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)}`);
|
|
55
|
+
return n.hour === 24 && (n.hour = 0), {
|
|
56
|
+
y: n.year,
|
|
57
|
+
m: n.month,
|
|
58
|
+
d: n.day,
|
|
59
|
+
h: n.hour,
|
|
60
|
+
i: n.minute,
|
|
61
|
+
s: n.second,
|
|
62
|
+
tz: e
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
function b(s, e, t, r, n, i, a) {
|
|
66
|
+
return {
|
|
67
|
+
y: s,
|
|
68
|
+
m: e,
|
|
69
|
+
d: t,
|
|
70
|
+
h: r,
|
|
71
|
+
i: n,
|
|
72
|
+
s: i,
|
|
73
|
+
tz: a
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
var O = [
|
|
77
|
+
1,
|
|
78
|
+
2,
|
|
79
|
+
4,
|
|
80
|
+
8,
|
|
81
|
+
16
|
|
82
|
+
], C = class {
|
|
83
|
+
pattern;
|
|
84
|
+
timezone;
|
|
85
|
+
mode;
|
|
86
|
+
alternativeWeekdays;
|
|
87
|
+
sloppyRanges;
|
|
88
|
+
second;
|
|
89
|
+
minute;
|
|
90
|
+
hour;
|
|
91
|
+
day;
|
|
92
|
+
month;
|
|
93
|
+
dayOfWeek;
|
|
94
|
+
year;
|
|
95
|
+
lastDayOfMonth;
|
|
96
|
+
lastWeekday;
|
|
97
|
+
nearestWeekdays;
|
|
98
|
+
starDOM;
|
|
99
|
+
starDOW;
|
|
100
|
+
starYear;
|
|
101
|
+
useAndLogic;
|
|
102
|
+
constructor(e, t, r) {
|
|
103
|
+
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();
|
|
104
|
+
}
|
|
105
|
+
parse() {
|
|
106
|
+
if (!(typeof this.pattern == "string" || this.pattern instanceof String)) throw new TypeError("CronPattern: Pattern has to be of type string.");
|
|
107
|
+
this.pattern.indexOf("@") >= 0 && (this.pattern = this.handleNicknames(this.pattern).trim());
|
|
108
|
+
let e = this.pattern.match(/\S+/g) || [""], t = e.length;
|
|
109
|
+
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.");
|
|
110
|
+
if (this.mode !== "auto") {
|
|
111
|
+
let n;
|
|
112
|
+
switch (this.mode) {
|
|
113
|
+
case "5-part":
|
|
114
|
+
n = 5;
|
|
115
|
+
break;
|
|
116
|
+
case "6-part":
|
|
117
|
+
n = 6;
|
|
118
|
+
break;
|
|
119
|
+
case "7-part":
|
|
120
|
+
n = 7;
|
|
121
|
+
break;
|
|
122
|
+
case "5-or-6-parts":
|
|
123
|
+
n = [5, 6];
|
|
124
|
+
break;
|
|
125
|
+
case "6-or-7-parts":
|
|
126
|
+
n = [6, 7];
|
|
127
|
+
break;
|
|
128
|
+
default: n = 0;
|
|
129
|
+
}
|
|
130
|
+
if (!(Array.isArray(n) ? n.includes(t) : t === n)) {
|
|
131
|
+
let a = Array.isArray(n) ? n.join(" or ") : n.toString();
|
|
132
|
+
throw new TypeError(`CronPattern: mode '${this.mode}' requires exactly ${a} parts, but pattern '${this.pattern}' has ${t} parts.`);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
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.");
|
|
136
|
+
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) {
|
|
137
|
+
case "5-part":
|
|
138
|
+
e[0] = "0", e[6] = "*";
|
|
139
|
+
break;
|
|
140
|
+
case "6-part":
|
|
141
|
+
e[6] = "*";
|
|
142
|
+
break;
|
|
143
|
+
case "5-or-6-parts":
|
|
144
|
+
e[6] = "*";
|
|
145
|
+
break;
|
|
146
|
+
case "6-or-7-parts": break;
|
|
147
|
+
case "7-part":
|
|
148
|
+
case "auto": break;
|
|
149
|
+
}
|
|
150
|
+
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);
|
|
151
|
+
let r = this.alternativeWeekdays ? -1 : 0;
|
|
152
|
+
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]);
|
|
153
|
+
}
|
|
154
|
+
partToArray(e, t, r, n) {
|
|
155
|
+
let i = this[e], a = e === "day" && this.lastDayOfMonth, o = e === "day" && this.lastWeekday;
|
|
156
|
+
if (t === "" && !a && !o) throw new TypeError("CronPattern: configuration entry " + e + " (" + t + ") is empty, check for trailing spaces.");
|
|
157
|
+
if (t === "*") return i.fill(n);
|
|
158
|
+
let h = t.split(",");
|
|
159
|
+
if (h.length > 1) for (let l = 0; l < h.length; l++) this.partToArray(e, h[l], r, n);
|
|
160
|
+
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);
|
|
161
|
+
}
|
|
162
|
+
throwAtIllegalCharacters(e) {
|
|
163
|
+
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.");
|
|
164
|
+
}
|
|
165
|
+
handleNumber(e, t, r, n) {
|
|
166
|
+
let i = this.extractNth(e, t), a = e.toUpperCase().includes("W");
|
|
167
|
+
if (t !== "day" && a) throw new TypeError("CronPattern: Nearest weekday modifier (W) only allowed in day-of-month.");
|
|
168
|
+
a && (t = "nearestWeekdays");
|
|
169
|
+
let o = parseInt(i[0], 10) + r;
|
|
170
|
+
if (isNaN(o)) throw new TypeError("CronPattern: " + t + " is not a number: '" + e + "'");
|
|
171
|
+
this.setPart(t, o, i[1] || n);
|
|
172
|
+
}
|
|
173
|
+
setPart(e, t, r) {
|
|
174
|
+
if (!Object.prototype.hasOwnProperty.call(this, e)) throw new TypeError("CronPattern: Invalid part specified: " + e);
|
|
175
|
+
if (e === "dayOfWeek") {
|
|
176
|
+
if (t === 7 && (t = 0), t < 0 || t > 6) throw new RangeError("CronPattern: Invalid value for dayOfWeek: " + t);
|
|
177
|
+
this.setNthWeekdayOfMonth(t, r);
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
if (e === "second" || e === "minute") {
|
|
181
|
+
if (t < 0 || t >= 60) throw new RangeError("CronPattern: Invalid value for " + e + ": " + t);
|
|
182
|
+
} else if (e === "hour") {
|
|
183
|
+
if (t < 0 || t >= 24) throw new RangeError("CronPattern: Invalid value for " + e + ": " + t);
|
|
184
|
+
} else if (e === "day" || e === "nearestWeekdays") {
|
|
185
|
+
if (t < 0 || t >= 31) throw new RangeError("CronPattern: Invalid value for " + e + ": " + t);
|
|
186
|
+
} else if (e === "month") {
|
|
187
|
+
if (t < 0 || t >= 12) throw new RangeError("CronPattern: Invalid value for " + e + ": " + t);
|
|
188
|
+
} else if (e === "year" && (t < 1 || t >= 1e4)) throw new RangeError("CronPattern: Invalid value for " + e + ": " + t + " (supported range: 1-9999)");
|
|
189
|
+
this[e][t] = r;
|
|
190
|
+
}
|
|
191
|
+
validateNotNaN(e, t) {
|
|
192
|
+
if (isNaN(e)) throw new TypeError(t);
|
|
193
|
+
}
|
|
194
|
+
validateRange(e, t, r, n, i) {
|
|
195
|
+
if (e > t) throw new TypeError("CronPattern: From value is larger than to value: '" + i + "'");
|
|
196
|
+
if (r !== void 0) {
|
|
197
|
+
if (r === 0) throw new TypeError("CronPattern: Syntax error, illegal stepping: 0");
|
|
198
|
+
if (r > this[n].length) throw new TypeError("CronPattern: Syntax error, steps cannot be greater than maximum value of part (" + this[n].length + ")");
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
handleRangeWithStepping(e, t, r, n) {
|
|
202
|
+
if (e.toUpperCase().includes("W")) throw new TypeError("CronPattern: Syntax error, W is not allowed in ranges with stepping.");
|
|
203
|
+
let i = this.extractNth(e, t), a = i[0].match(/^(\d+)-(\d+)\/(\d+)$/);
|
|
204
|
+
if (a === null) throw new TypeError("CronPattern: Syntax error, illegal range with stepping: '" + e + "'");
|
|
205
|
+
let [, o, h, l] = a, y = parseInt(o, 10) + r, u = parseInt(h, 10) + r, d = parseInt(l, 10);
|
|
206
|
+
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);
|
|
207
|
+
for (let c = y; c <= u; c += d) this.setPart(t, c, i[1] || n);
|
|
208
|
+
}
|
|
209
|
+
extractNth(e, t) {
|
|
210
|
+
let r = e, n;
|
|
211
|
+
if (r.includes("#")) {
|
|
212
|
+
if (t !== "dayOfWeek") throw new Error("CronPattern: nth (#) only allowed in day-of-week field");
|
|
213
|
+
n = r.split("#")[1], r = r.split("#")[0];
|
|
214
|
+
} else if (r.toUpperCase().endsWith("L")) {
|
|
215
|
+
if (t !== "dayOfWeek") throw new Error("CronPattern: L modifier only allowed in day-of-week field (use L alone for day-of-month)");
|
|
216
|
+
n = "L", r = r.slice(0, -1);
|
|
217
|
+
}
|
|
218
|
+
return [r, n];
|
|
219
|
+
}
|
|
220
|
+
handleRange(e, t, r, n) {
|
|
221
|
+
if (e.toUpperCase().includes("W")) throw new TypeError("CronPattern: Syntax error, W is not allowed in a range.");
|
|
222
|
+
let i = this.extractNth(e, t), a = i[0].split("-");
|
|
223
|
+
if (a.length !== 2) throw new TypeError("CronPattern: Syntax error, illegal range: '" + e + "'");
|
|
224
|
+
let o = parseInt(a[0], 10) + r, h = parseInt(a[1], 10) + r;
|
|
225
|
+
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);
|
|
226
|
+
for (let l = o; l <= h; l++) this.setPart(t, l, i[1] || n);
|
|
227
|
+
}
|
|
228
|
+
handleStepping(e, t, r, n) {
|
|
229
|
+
if (e.toUpperCase().includes("W")) throw new TypeError("CronPattern: Syntax error, W is not allowed in parts with stepping.");
|
|
230
|
+
let i = this.extractNth(e, t), a = i[0].split("/");
|
|
231
|
+
if (a.length !== 2) throw new TypeError("CronPattern: Syntax error, illegal stepping: '" + e + "'");
|
|
232
|
+
if (this.sloppyRanges) a[0] === "" && (a[0] = "*");
|
|
233
|
+
else {
|
|
234
|
+
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.");
|
|
235
|
+
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.");
|
|
236
|
+
}
|
|
237
|
+
let o = 0;
|
|
238
|
+
a[0] !== "*" && (o = parseInt(a[0], 10) + r);
|
|
239
|
+
let h = parseInt(a[1], 10);
|
|
240
|
+
this.validateNotNaN(h, "CronPattern: Syntax error, illegal stepping: (NaN)"), this.validateRange(0, this[t].length - 1, h, t, e);
|
|
241
|
+
for (let l = o; l < this[t].length; l += h) this.setPart(t, l, i[1] || n);
|
|
242
|
+
}
|
|
243
|
+
replaceAlphaDays(e) {
|
|
244
|
+
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");
|
|
245
|
+
}
|
|
246
|
+
replaceAlphaDaysQuartz(e) {
|
|
247
|
+
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");
|
|
248
|
+
}
|
|
249
|
+
replaceAlphaMonths(e) {
|
|
250
|
+
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");
|
|
251
|
+
}
|
|
252
|
+
handleNicknames(e) {
|
|
253
|
+
let t = e.trim().toLowerCase();
|
|
254
|
+
if (t === "@yearly" || t === "@annually") return "0 0 1 1 *";
|
|
255
|
+
if (t === "@monthly") return "0 0 1 * *";
|
|
256
|
+
if (t === "@weekly") return "0 0 * * 0";
|
|
257
|
+
if (t === "@daily" || t === "@midnight") return "0 0 * * *";
|
|
258
|
+
if (t === "@hourly") return "0 * * * *";
|
|
259
|
+
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.");
|
|
260
|
+
return e;
|
|
261
|
+
}
|
|
262
|
+
setNthWeekdayOfMonth(e, t) {
|
|
263
|
+
if (typeof t != "number" && t.toUpperCase() === "L") this.dayOfWeek[e] = this.dayOfWeek[e] | 32;
|
|
264
|
+
else if (t === 63) this.dayOfWeek[e] = 63;
|
|
265
|
+
else if (t < 6 && t > 0) this.dayOfWeek[e] = this.dayOfWeek[e] | O[t - 1];
|
|
266
|
+
else throw new TypeError(`CronPattern: nth weekday out of range, should be 1-5 or L. Value: ${t}, Type: ${typeof t}`);
|
|
267
|
+
}
|
|
268
|
+
};
|
|
269
|
+
var P = [
|
|
270
|
+
31,
|
|
271
|
+
28,
|
|
272
|
+
31,
|
|
273
|
+
30,
|
|
274
|
+
31,
|
|
275
|
+
30,
|
|
276
|
+
31,
|
|
277
|
+
31,
|
|
278
|
+
30,
|
|
279
|
+
31,
|
|
280
|
+
30,
|
|
281
|
+
31
|
|
282
|
+
], f = [
|
|
283
|
+
[
|
|
284
|
+
"month",
|
|
285
|
+
"year",
|
|
286
|
+
0
|
|
287
|
+
],
|
|
288
|
+
[
|
|
289
|
+
"day",
|
|
290
|
+
"month",
|
|
291
|
+
-1
|
|
292
|
+
],
|
|
293
|
+
[
|
|
294
|
+
"hour",
|
|
295
|
+
"day",
|
|
296
|
+
0
|
|
297
|
+
],
|
|
298
|
+
[
|
|
299
|
+
"minute",
|
|
300
|
+
"hour",
|
|
301
|
+
0
|
|
302
|
+
],
|
|
303
|
+
[
|
|
304
|
+
"second",
|
|
305
|
+
"minute",
|
|
306
|
+
0
|
|
307
|
+
]
|
|
308
|
+
], m = class s {
|
|
309
|
+
tz;
|
|
310
|
+
ms;
|
|
311
|
+
second;
|
|
312
|
+
minute;
|
|
313
|
+
hour;
|
|
314
|
+
day;
|
|
315
|
+
month;
|
|
316
|
+
year;
|
|
317
|
+
constructor(e, t) {
|
|
318
|
+
if (this.tz = t, e && e instanceof Date) if (!isNaN(e)) this.fromDate(e);
|
|
319
|
+
else throw new TypeError("CronDate: Invalid date passed to CronDate constructor");
|
|
320
|
+
else if (e == null) this.fromDate(/* @__PURE__ */ new Date());
|
|
321
|
+
else if (e && typeof e == "string") this.fromString(e);
|
|
322
|
+
else if (e instanceof s) this.fromCronDate(e);
|
|
323
|
+
else throw new TypeError("CronDate: Invalid type (" + typeof e + ") passed to CronDate constructor");
|
|
324
|
+
}
|
|
325
|
+
getLastDayOfMonth(e, t) {
|
|
326
|
+
return t !== 1 ? P[t] : new Date(Date.UTC(e, t + 1, 0)).getUTCDate();
|
|
327
|
+
}
|
|
328
|
+
getLastWeekday(e, t) {
|
|
329
|
+
let r = this.getLastDayOfMonth(e, t), i = new Date(Date.UTC(e, t, r)).getUTCDay();
|
|
330
|
+
return i === 0 ? r - 2 : i === 6 ? r - 1 : r;
|
|
331
|
+
}
|
|
332
|
+
getNearestWeekday(e, t, r) {
|
|
333
|
+
let n = this.getLastDayOfMonth(e, t);
|
|
334
|
+
if (r > n) return -1;
|
|
335
|
+
let a = new Date(Date.UTC(e, t, r)).getUTCDay();
|
|
336
|
+
return a === 0 ? r === n ? r - 2 : r + 1 : a === 6 ? r === 1 ? r + 2 : r - 1 : r;
|
|
337
|
+
}
|
|
338
|
+
isNthWeekdayOfMonth(e, t, r, n) {
|
|
339
|
+
let a = new Date(Date.UTC(e, t, r)).getUTCDay(), o = 0;
|
|
340
|
+
for (let h = 1; h <= r; h++) new Date(Date.UTC(e, t, h)).getUTCDay() === a && o++;
|
|
341
|
+
if (n & 63 && O[o - 1] & n) return !0;
|
|
342
|
+
if (n & 32) {
|
|
343
|
+
let h = this.getLastDayOfMonth(e, t);
|
|
344
|
+
for (let l = r + 1; l <= h; l++) if (new Date(Date.UTC(e, t, l)).getUTCDay() === a) return !1;
|
|
345
|
+
return !0;
|
|
346
|
+
}
|
|
347
|
+
return !1;
|
|
348
|
+
}
|
|
349
|
+
fromDate(e) {
|
|
350
|
+
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();
|
|
351
|
+
else try {
|
|
352
|
+
let t = g(e, this.tz);
|
|
353
|
+
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;
|
|
354
|
+
} catch (t) {
|
|
355
|
+
let r = t instanceof Error ? t.message : String(t);
|
|
356
|
+
throw new TypeError(`CronDate: Failed to convert date to timezone '${this.tz}'. This may happen with invalid timezone names or dates. Original error: ${r}`);
|
|
357
|
+
}
|
|
358
|
+
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();
|
|
359
|
+
}
|
|
360
|
+
fromCronDate(e) {
|
|
361
|
+
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;
|
|
362
|
+
}
|
|
363
|
+
apply() {
|
|
364
|
+
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) {
|
|
365
|
+
let e = new Date(Date.UTC(this.year, this.month, this.day, this.hour, this.minute, this.second, this.ms));
|
|
366
|
+
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;
|
|
367
|
+
} else return !1;
|
|
368
|
+
}
|
|
369
|
+
fromString(e) {
|
|
370
|
+
if (typeof this.tz == "number") {
|
|
371
|
+
let t = v(e);
|
|
372
|
+
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();
|
|
373
|
+
} else return this.fromDate(v(e, this.tz));
|
|
374
|
+
}
|
|
375
|
+
findNext(e, t, r, n) {
|
|
376
|
+
return this._findMatch(e, t, r, n, 1);
|
|
377
|
+
}
|
|
378
|
+
_findMatch(e, t, r, n, i) {
|
|
379
|
+
let a = this[t], o;
|
|
380
|
+
r.lastDayOfMonth && (o = this.getLastDayOfMonth(this.year, this.month));
|
|
381
|
+
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;
|
|
382
|
+
for (let u = l; y(u); u += i) {
|
|
383
|
+
let d = r[t][u];
|
|
384
|
+
if (t === "day" && !d) {
|
|
385
|
+
for (let c = 0; c < r.nearestWeekdays.length; c++) if (r.nearestWeekdays[c]) {
|
|
386
|
+
let M = this.getNearestWeekday(this.year, this.month, c - n);
|
|
387
|
+
if (M === -1) continue;
|
|
388
|
+
if (M === u - n) {
|
|
389
|
+
d = 1;
|
|
390
|
+
break;
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
if (t === "day" && r.lastWeekday) {
|
|
395
|
+
let c = this.getLastWeekday(this.year, this.month);
|
|
396
|
+
u - n === c && (d = 1);
|
|
397
|
+
}
|
|
398
|
+
if (t === "day" && r.lastDayOfMonth && u - n == o && (d = 1), t === "day" && !r.starDOW) {
|
|
399
|
+
let c = r.dayOfWeek[(h + (u - n - 1)) % 7];
|
|
400
|
+
if (c && c & 63) c = this.isNthWeekdayOfMonth(this.year, this.month, u - n, c) ? 1 : 0;
|
|
401
|
+
else if (c) throw new Error(`CronDate: Invalid value for dayOfWeek encountered. ${c}`);
|
|
402
|
+
r.useAndLogic ? d = d && c : !e.domAndDow && !r.starDOM ? d = d || c : d = d && c;
|
|
403
|
+
}
|
|
404
|
+
if (d) return this[t] = u - n, a !== this[t] ? 2 : 1;
|
|
405
|
+
}
|
|
406
|
+
return 3;
|
|
407
|
+
}
|
|
408
|
+
recurse(e, t, r) {
|
|
409
|
+
if (r === 0 && !e.starYear) {
|
|
410
|
+
if (this.year >= 0 && this.year < e.year.length && e.year[this.year] === 0) {
|
|
411
|
+
let i = -1;
|
|
412
|
+
for (let a = this.year + 1; a < e.year.length && a < 1e4; a++) if (e.year[a] === 1) {
|
|
413
|
+
i = a;
|
|
414
|
+
break;
|
|
415
|
+
}
|
|
416
|
+
if (i === -1) return null;
|
|
417
|
+
this.year = i, this.month = 0, this.day = 1, this.hour = 0, this.minute = 0, this.second = 0, this.ms = 0;
|
|
418
|
+
}
|
|
419
|
+
if (this.year >= 1e4) return null;
|
|
420
|
+
}
|
|
421
|
+
let n = this.findNext(t, f[r][0], e, f[r][2]);
|
|
422
|
+
if (n > 1) {
|
|
423
|
+
let i = r + 1;
|
|
424
|
+
for (; i < f.length;) this[f[i][0]] = -f[i][2], i++;
|
|
425
|
+
if (n === 3) {
|
|
426
|
+
if (this[f[r][1]]++, this[f[r][0]] = -f[r][2], this.apply(), r === 0 && !e.starYear) {
|
|
427
|
+
for (; this.year >= 0 && this.year < e.year.length && e.year[this.year] === 0 && this.year < 1e4;) this.year++;
|
|
428
|
+
if (this.year >= 1e4 || this.year >= e.year.length) return null;
|
|
429
|
+
}
|
|
430
|
+
return this.recurse(e, t, 0);
|
|
431
|
+
} else if (this.apply()) return this.recurse(e, t, r - 1);
|
|
432
|
+
}
|
|
433
|
+
return r += 1, r >= f.length ? this : (e.starYear ? this.year >= 3e3 : this.year >= 1e4) ? null : this.recurse(e, t, r);
|
|
434
|
+
}
|
|
435
|
+
increment(e, t, r) {
|
|
436
|
+
return this.second += t.interval !== void 0 && t.interval > 1 && r ? t.interval : 1, this.ms = 0, this.apply(), this.recurse(e, t, 0);
|
|
437
|
+
}
|
|
438
|
+
decrement(e, t) {
|
|
439
|
+
return this.second -= t.interval !== void 0 && t.interval > 1 ? t.interval : 1, this.ms = 0, this.apply(), this.recurseBackward(e, t, 0, 0);
|
|
440
|
+
}
|
|
441
|
+
recurseBackward(e, t, r, n = 0) {
|
|
442
|
+
if (n > 1e4) return null;
|
|
443
|
+
if (r === 0 && !e.starYear) {
|
|
444
|
+
if (this.year >= 0 && this.year < e.year.length && e.year[this.year] === 0) {
|
|
445
|
+
let a = -1;
|
|
446
|
+
for (let o = this.year - 1; o >= 0; o--) if (e.year[o] === 1) {
|
|
447
|
+
a = o;
|
|
448
|
+
break;
|
|
449
|
+
}
|
|
450
|
+
if (a === -1) return null;
|
|
451
|
+
this.year = a, this.month = 11, this.day = 31, this.hour = 23, this.minute = 59, this.second = 59, this.ms = 0;
|
|
452
|
+
}
|
|
453
|
+
if (this.year < 0) return null;
|
|
454
|
+
}
|
|
455
|
+
let i = this.findPrevious(t, f[r][0], e, f[r][2]);
|
|
456
|
+
if (i > 1) {
|
|
457
|
+
let a = r + 1;
|
|
458
|
+
for (; a < f.length;) {
|
|
459
|
+
let o = f[a][0], h = f[a][2], l = this.getMaxPatternValue(o, e, h);
|
|
460
|
+
this[o] = l, a++;
|
|
461
|
+
}
|
|
462
|
+
if (i === 3) {
|
|
463
|
+
if (this[f[r][1]]--, r === 0) {
|
|
464
|
+
let y = this.getLastDayOfMonth(this.year, this.month);
|
|
465
|
+
this.day > y && (this.day = y);
|
|
466
|
+
}
|
|
467
|
+
if (r === 1) if (this.day <= 0) this.day = 1;
|
|
468
|
+
else {
|
|
469
|
+
let y = this.year, u = this.month;
|
|
470
|
+
for (; u < 0;) u += 12, y--;
|
|
471
|
+
for (; u > 11;) u -= 12, y++;
|
|
472
|
+
let d = u !== 1 ? P[u] : new Date(Date.UTC(y, u + 1, 0)).getUTCDate();
|
|
473
|
+
this.day > d && (this.day = d);
|
|
474
|
+
}
|
|
475
|
+
this.apply();
|
|
476
|
+
let o = f[r][0], h = f[r][2], l = this.getMaxPatternValue(o, e, h);
|
|
477
|
+
if (o === "day") {
|
|
478
|
+
let y = this.getLastDayOfMonth(this.year, this.month);
|
|
479
|
+
this[o] = Math.min(l, y);
|
|
480
|
+
} else this[o] = l;
|
|
481
|
+
if (this.apply(), r === 0) {
|
|
482
|
+
let y = f[1][2], u = this.getMaxPatternValue("day", e, y), d = this.getLastDayOfMonth(this.year, this.month), c = Math.min(u, d);
|
|
483
|
+
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]));
|
|
484
|
+
}
|
|
485
|
+
if (r === 0 && !e.starYear) {
|
|
486
|
+
for (; this.year >= 0 && this.year < e.year.length && e.year[this.year] === 0;) this.year--;
|
|
487
|
+
if (this.year < 0) return null;
|
|
488
|
+
}
|
|
489
|
+
return this.recurseBackward(e, t, 0, n + 1);
|
|
490
|
+
} else if (this.apply()) return this.recurseBackward(e, t, r - 1, n + 1);
|
|
491
|
+
}
|
|
492
|
+
return r += 1, r >= f.length ? this : this.year < 0 ? null : this.recurseBackward(e, t, r, n + 1);
|
|
493
|
+
}
|
|
494
|
+
getMaxPatternValue(e, t, r) {
|
|
495
|
+
if (e === "day" && t.lastDayOfMonth) return this.getLastDayOfMonth(this.year, this.month);
|
|
496
|
+
if (e === "day" && !t.starDOW) return this.getLastDayOfMonth(this.year, this.month);
|
|
497
|
+
for (let n = t[e].length - 1; n >= 0; n--) if (t[e][n]) return n - r;
|
|
498
|
+
return t[e].length - 1 - r;
|
|
499
|
+
}
|
|
500
|
+
findPrevious(e, t, r, n) {
|
|
501
|
+
return this._findMatch(e, t, r, n, -1);
|
|
502
|
+
}
|
|
503
|
+
getDate(e) {
|
|
504
|
+
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(this.year, this.month + 1, this.day, this.hour, this.minute, this.second, this.tz), !1);
|
|
505
|
+
}
|
|
506
|
+
getTime() {
|
|
507
|
+
return this.getDate(!1).getTime();
|
|
508
|
+
}
|
|
509
|
+
match(e, t) {
|
|
510
|
+
if (!e.starYear && (this.year < 0 || this.year >= e.year.length || e.year[this.year] === 0)) return !1;
|
|
511
|
+
for (let r = 0; r < f.length; r++) {
|
|
512
|
+
let n = f[r][0], i = f[r][2], a = this[n];
|
|
513
|
+
if (a + i < 0 || a + i >= e[n].length) return !1;
|
|
514
|
+
let o = e[n][a + i];
|
|
515
|
+
if (n === "day") {
|
|
516
|
+
if (!o) {
|
|
517
|
+
for (let h = 0; h < e.nearestWeekdays.length; h++) if (e.nearestWeekdays[h]) {
|
|
518
|
+
let l = this.getNearestWeekday(this.year, this.month, h - i);
|
|
519
|
+
if (l !== -1 && l === a) {
|
|
520
|
+
o = 1;
|
|
521
|
+
break;
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
if (e.lastWeekday) a === this.getLastWeekday(this.year, this.month) && (o = 1);
|
|
526
|
+
if (e.lastDayOfMonth) a === this.getLastDayOfMonth(this.year, this.month) && (o = 1);
|
|
527
|
+
if (!e.starDOW) {
|
|
528
|
+
let h = new Date(Date.UTC(this.year, this.month, 1, 0, 0, 0, 0)).getUTCDay(), l = e.dayOfWeek[(h + (a - 1)) % 7];
|
|
529
|
+
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;
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
if (!o) return !1;
|
|
533
|
+
}
|
|
534
|
+
return !0;
|
|
535
|
+
}
|
|
536
|
+
};
|
|
537
|
+
function R(s) {
|
|
538
|
+
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, ![
|
|
539
|
+
"auto",
|
|
540
|
+
"5-part",
|
|
541
|
+
"6-part",
|
|
542
|
+
"7-part",
|
|
543
|
+
"5-or-6-parts",
|
|
544
|
+
"6-or-7-parts"
|
|
545
|
+
].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'.");
|
|
546
|
+
if (s.startAt && (s.startAt = new m(s.startAt, s.timezone)), s.stopAt && (s.stopAt = new m(s.stopAt, s.timezone)), s.interval !== null) {
|
|
547
|
+
if (isNaN(s.interval)) throw new Error("CronOptions: Supplied value for interval is not a number");
|
|
548
|
+
if (s.interval < 0) throw new Error("CronOptions: Supplied value for interval can not be negative");
|
|
549
|
+
}
|
|
550
|
+
if (s.utcOffset !== void 0) {
|
|
551
|
+
if (isNaN(s.utcOffset)) throw new Error("CronOptions: Invalid value passed for utcOffset, should be number representing minutes offset from UTC.");
|
|
552
|
+
if (s.utcOffset < -870 || s.utcOffset > 870) throw new Error("CronOptions: utcOffset out of bounds.");
|
|
553
|
+
if (s.utcOffset !== void 0 && s.timezone) throw new Error("CronOptions: Combining 'utcOffset' with 'timezone' is not allowed.");
|
|
554
|
+
}
|
|
555
|
+
if (s.unref !== !0 && s.unref !== !1) throw new Error("CronOptions: Unref should be either true, false or undefined(false).");
|
|
556
|
+
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.");
|
|
557
|
+
return s;
|
|
558
|
+
}
|
|
559
|
+
function p(s) {
|
|
560
|
+
return Object.prototype.toString.call(s) === "[object Function]" || typeof s == "function" || s instanceof Function;
|
|
561
|
+
}
|
|
562
|
+
function _(s) {
|
|
563
|
+
return p(s);
|
|
564
|
+
}
|
|
565
|
+
function x(s) {
|
|
566
|
+
typeof Deno < "u" && typeof Deno.unrefTimer < "u" ? Deno.unrefTimer(s) : s && typeof s.unref < "u" && s.unref();
|
|
567
|
+
}
|
|
568
|
+
var W = 30 * 1e3, w = [], E = class {
|
|
569
|
+
name;
|
|
570
|
+
options;
|
|
571
|
+
_states;
|
|
572
|
+
fn;
|
|
573
|
+
getTz() {
|
|
574
|
+
return this.options.timezone || this.options.utcOffset;
|
|
575
|
+
}
|
|
576
|
+
applyDayOffset(e) {
|
|
577
|
+
if (this.options.dayOffset !== void 0 && this.options.dayOffset !== 0) {
|
|
578
|
+
let t = this.options.dayOffset * 24 * 60 * 60 * 1e3;
|
|
579
|
+
return new Date(e.getTime() + t);
|
|
580
|
+
}
|
|
581
|
+
return e;
|
|
582
|
+
}
|
|
583
|
+
constructor(e, t, r) {
|
|
584
|
+
let n, i;
|
|
585
|
+
if (p(t)) i = t;
|
|
586
|
+
else if (typeof t == "object") n = t;
|
|
587
|
+
else if (t !== void 0) throw new Error("Cron: Invalid argument passed for optionsIn. Should be one of function, or object (options).");
|
|
588
|
+
if (p(r)) i = r;
|
|
589
|
+
else if (typeof r == "object") n = r;
|
|
590
|
+
else if (r !== void 0) throw new Error("Cron: Invalid argument passed for funcIn. Should be one of function, or object (options).");
|
|
591
|
+
if (this.name = n?.name, this.options = R(n), this._states = {
|
|
592
|
+
kill: !1,
|
|
593
|
+
blocking: !1,
|
|
594
|
+
previousRun: void 0,
|
|
595
|
+
currentRun: void 0,
|
|
596
|
+
once: void 0,
|
|
597
|
+
currentTimeout: void 0,
|
|
598
|
+
maxRuns: n ? n.maxRuns : void 0,
|
|
599
|
+
paused: n ? n.paused : !1,
|
|
600
|
+
pattern: new C("* * * * *", void 0, { mode: "auto" })
|
|
601
|
+
}, 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, {
|
|
602
|
+
mode: this.options.mode,
|
|
603
|
+
alternativeWeekdays: this.options.alternativeWeekdays,
|
|
604
|
+
sloppyRanges: this.options.sloppyRanges
|
|
605
|
+
}), this.name) {
|
|
606
|
+
if (w.find((o) => o.name === this.name)) throw new Error("Cron: Tried to initialize new named job '" + this.name + "', but name already taken.");
|
|
607
|
+
w.push(this);
|
|
608
|
+
}
|
|
609
|
+
return i !== void 0 && _(i) && (this.fn = i, this.schedule()), this;
|
|
610
|
+
}
|
|
611
|
+
nextRun(e) {
|
|
612
|
+
let t = this._next(e);
|
|
613
|
+
return t ? this.applyDayOffset(t.getDate(!1)) : null;
|
|
614
|
+
}
|
|
615
|
+
nextRuns(e, t) {
|
|
616
|
+
this._states.maxRuns !== void 0 && e > this._states.maxRuns && (e = this._states.maxRuns);
|
|
617
|
+
let r = t || this._states.currentRun || void 0;
|
|
618
|
+
return this._enumerateRuns(e, r, "next");
|
|
619
|
+
}
|
|
620
|
+
previousRuns(e, t) {
|
|
621
|
+
return this._enumerateRuns(e, t || void 0, "previous");
|
|
622
|
+
}
|
|
623
|
+
_enumerateRuns(e, t, r) {
|
|
624
|
+
let n = [], i = t ? new m(t, this.getTz()) : null, a = r === "next" ? this._next : this._previous;
|
|
625
|
+
for (; e--;) {
|
|
626
|
+
let o = a.call(this, i);
|
|
627
|
+
if (!o) break;
|
|
628
|
+
let h = o.getDate(!1);
|
|
629
|
+
n.push(this.applyDayOffset(h)), i = o;
|
|
630
|
+
}
|
|
631
|
+
return n;
|
|
632
|
+
}
|
|
633
|
+
match(e) {
|
|
634
|
+
if (this._states.once) {
|
|
635
|
+
let r = new m(e, this.getTz());
|
|
636
|
+
r.ms = 0;
|
|
637
|
+
let n = new m(this._states.once, this.getTz());
|
|
638
|
+
return n.ms = 0, r.getTime() === n.getTime();
|
|
639
|
+
}
|
|
640
|
+
let t = new m(e, this.getTz());
|
|
641
|
+
return t.ms = 0, t.match(this._states.pattern, this.options);
|
|
642
|
+
}
|
|
643
|
+
getPattern() {
|
|
644
|
+
if (!this._states.once) return this._states.pattern ? this._states.pattern.pattern : void 0;
|
|
645
|
+
}
|
|
646
|
+
getOnce() {
|
|
647
|
+
return this._states.once ? this._states.once.getDate() : null;
|
|
648
|
+
}
|
|
649
|
+
isRunning() {
|
|
650
|
+
let e = this.nextRun(this._states.currentRun), t = !this._states.paused, r = this.fn !== void 0, n = !this._states.kill;
|
|
651
|
+
return t && r && n && e !== null;
|
|
652
|
+
}
|
|
653
|
+
isStopped() {
|
|
654
|
+
return this._states.kill;
|
|
655
|
+
}
|
|
656
|
+
isBusy() {
|
|
657
|
+
return this._states.blocking;
|
|
658
|
+
}
|
|
659
|
+
currentRun() {
|
|
660
|
+
return this._states.currentRun ? this._states.currentRun.getDate() : null;
|
|
661
|
+
}
|
|
662
|
+
previousRun() {
|
|
663
|
+
return this._states.previousRun ? this._states.previousRun.getDate() : null;
|
|
664
|
+
}
|
|
665
|
+
msToNext(e) {
|
|
666
|
+
let t = this._next(e);
|
|
667
|
+
return t ? e instanceof m || e instanceof Date ? t.getTime() - e.getTime() : t.getTime() - new m(e).getTime() : null;
|
|
668
|
+
}
|
|
669
|
+
stop() {
|
|
670
|
+
this._states.kill = !0, this._states.currentTimeout && clearTimeout(this._states.currentTimeout);
|
|
671
|
+
let e = w.indexOf(this);
|
|
672
|
+
e >= 0 && w.splice(e, 1);
|
|
673
|
+
}
|
|
674
|
+
pause() {
|
|
675
|
+
return this._states.paused = !0, !this._states.kill;
|
|
676
|
+
}
|
|
677
|
+
resume() {
|
|
678
|
+
return this._states.paused = !1, !this._states.kill;
|
|
679
|
+
}
|
|
680
|
+
schedule(e) {
|
|
681
|
+
if (e && this.fn) throw new Error("Cron: It is not allowed to schedule two functions using the same Croner instance.");
|
|
682
|
+
e && (this.fn = e);
|
|
683
|
+
let t = this.msToNext(), r = this.nextRun(this._states.currentRun);
|
|
684
|
+
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);
|
|
685
|
+
}
|
|
686
|
+
async _trigger(e) {
|
|
687
|
+
this._states.blocking = !0, this._states.currentRun = new m(void 0, this.getTz());
|
|
688
|
+
try {
|
|
689
|
+
if (this.options.catch) try {
|
|
690
|
+
this.fn !== void 0 && await this.fn(this, this.options.context);
|
|
691
|
+
} catch (t) {
|
|
692
|
+
if (p(this.options.catch)) try {
|
|
693
|
+
this.options.catch(t, this);
|
|
694
|
+
} catch {}
|
|
695
|
+
}
|
|
696
|
+
else this.fn !== void 0 && await this.fn(this, this.options.context);
|
|
697
|
+
} finally {
|
|
698
|
+
this._states.previousRun = new m(e, this.getTz()), this._states.blocking = !1;
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
async trigger() {
|
|
702
|
+
await this._trigger();
|
|
703
|
+
}
|
|
704
|
+
runsLeft() {
|
|
705
|
+
return this._states.maxRuns;
|
|
706
|
+
}
|
|
707
|
+
_checkTrigger(e) {
|
|
708
|
+
let t = /* @__PURE__ */ new Date(), r = !this._states.paused && t.getTime() >= e.getTime(), n = this._states.blocking && this.options.protect;
|
|
709
|
+
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();
|
|
710
|
+
}
|
|
711
|
+
_next(e) {
|
|
712
|
+
let t = !!(e || this._states.currentRun), r = !1;
|
|
713
|
+
!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);
|
|
714
|
+
let n = this._states.once || new m(e, this.getTz());
|
|
715
|
+
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;
|
|
716
|
+
}
|
|
717
|
+
_previous(e) {
|
|
718
|
+
let t = new m(e, this.getTz());
|
|
719
|
+
this.options.stopAt && t.getTime() > this.options.stopAt.getTime() && (t = this.options.stopAt);
|
|
720
|
+
let r = new m(t, this.getTz());
|
|
721
|
+
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);
|
|
722
|
+
}
|
|
723
|
+
_calculatePreviousRun(e, t) {
|
|
724
|
+
let r = new m(void 0, this.getTz()), n = e;
|
|
725
|
+
if (this.options.startAt.getTime() <= r.getTime()) {
|
|
726
|
+
n = this.options.startAt;
|
|
727
|
+
let i = n.getTime() + this.options.interval * 1e3;
|
|
728
|
+
for (; i <= r.getTime();) n = new m(n, this.getTz()).increment(this._states.pattern, this.options, !0), i = n.getTime() + this.options.interval * 1e3;
|
|
729
|
+
t = !0;
|
|
730
|
+
}
|
|
731
|
+
return n === null && (n = void 0), [n, t];
|
|
732
|
+
}
|
|
733
|
+
};
|
|
734
|
+
//#endregion
|
|
735
|
+
export { E as t };
|