@push.rocks/taskbuffer 3.1.6 → 3.1.7
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_bundle/bundle.js +530 -434
- package/dist_bundle/bundle.js.map +4 -4
- package/package.json +7 -7
- package/ts/00_commitinfo_data.ts +1 -1
package/dist_bundle/bundle.js
CHANGED
|
@@ -28,9 +28,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
28
|
mod
|
|
29
29
|
));
|
|
30
30
|
|
|
31
|
-
// node_modules/.pnpm/dayjs@1.11.
|
|
31
|
+
// node_modules/.pnpm/dayjs@1.11.10/node_modules/dayjs/dayjs.min.js
|
|
32
32
|
var require_dayjs_min = __commonJS({
|
|
33
|
-
"node_modules/.pnpm/dayjs@1.11.
|
|
33
|
+
"node_modules/.pnpm/dayjs@1.11.10/node_modules/dayjs/dayjs.min.js"(exports, module) {
|
|
34
34
|
!function(t, e) {
|
|
35
35
|
"object" == typeof exports && "undefined" != typeof module ? module.exports = e() : "function" == typeof define && define.amd ? define(e) : (t = "undefined" != typeof globalThis ? globalThis : t || self).dayjs = e();
|
|
36
36
|
}(exports, function() {
|
|
@@ -57,9 +57,9 @@ var require_dayjs_min = __commonJS({
|
|
|
57
57
|
return void 0 === t2;
|
|
58
58
|
} }, g = "en", D = {};
|
|
59
59
|
D[g] = M;
|
|
60
|
-
var p = function(t2) {
|
|
61
|
-
return t2 instanceof
|
|
62
|
-
},
|
|
60
|
+
var p = "$isDayjsObject", S = function(t2) {
|
|
61
|
+
return t2 instanceof _ || !(!t2 || !t2[p]);
|
|
62
|
+
}, w = function t2(e2, n2, r2) {
|
|
63
63
|
var i2;
|
|
64
64
|
if (!e2)
|
|
65
65
|
return g;
|
|
@@ -74,18 +74,18 @@ var require_dayjs_min = __commonJS({
|
|
|
74
74
|
D[a2] = e2, i2 = a2;
|
|
75
75
|
}
|
|
76
76
|
return !r2 && i2 && (g = i2), i2 || !r2 && g;
|
|
77
|
-
},
|
|
78
|
-
if (
|
|
77
|
+
}, O = function(t2, e2) {
|
|
78
|
+
if (S(t2))
|
|
79
79
|
return t2.clone();
|
|
80
80
|
var n2 = "object" == typeof e2 ? e2 : {};
|
|
81
|
-
return n2.date = t2, n2.args = arguments, new
|
|
82
|
-
},
|
|
83
|
-
|
|
84
|
-
return
|
|
81
|
+
return n2.date = t2, n2.args = arguments, new _(n2);
|
|
82
|
+
}, b = v;
|
|
83
|
+
b.l = w, b.i = S, b.w = function(t2, e2) {
|
|
84
|
+
return O(t2, { locale: e2.$L, utc: e2.$u, x: e2.$x, $offset: e2.$offset });
|
|
85
85
|
};
|
|
86
|
-
var
|
|
86
|
+
var _ = function() {
|
|
87
87
|
function M2(t2) {
|
|
88
|
-
this.$L =
|
|
88
|
+
this.$L = w(t2.locale, null, true), this.parse(t2), this.$x = this.$x || t2.x || {}, this[p] = true;
|
|
89
89
|
}
|
|
90
90
|
var m2 = M2.prototype;
|
|
91
91
|
return m2.parse = function(t2) {
|
|
@@ -93,7 +93,7 @@ var require_dayjs_min = __commonJS({
|
|
|
93
93
|
var e2 = t3.date, n2 = t3.utc;
|
|
94
94
|
if (null === e2)
|
|
95
95
|
return /* @__PURE__ */ new Date(NaN);
|
|
96
|
-
if (
|
|
96
|
+
if (b.u(e2))
|
|
97
97
|
return /* @__PURE__ */ new Date();
|
|
98
98
|
if (e2 instanceof Date)
|
|
99
99
|
return new Date(e2);
|
|
@@ -105,33 +105,33 @@ var require_dayjs_min = __commonJS({
|
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
107
|
return new Date(e2);
|
|
108
|
-
}(t2), this
|
|
108
|
+
}(t2), this.init();
|
|
109
109
|
}, m2.init = function() {
|
|
110
110
|
var t2 = this.$d;
|
|
111
111
|
this.$y = t2.getFullYear(), this.$M = t2.getMonth(), this.$D = t2.getDate(), this.$W = t2.getDay(), this.$H = t2.getHours(), this.$m = t2.getMinutes(), this.$s = t2.getSeconds(), this.$ms = t2.getMilliseconds();
|
|
112
112
|
}, m2.$utils = function() {
|
|
113
|
-
return
|
|
113
|
+
return b;
|
|
114
114
|
}, m2.isValid = function() {
|
|
115
115
|
return !(this.$d.toString() === l);
|
|
116
116
|
}, m2.isSame = function(t2, e2) {
|
|
117
|
-
var n2 =
|
|
117
|
+
var n2 = O(t2);
|
|
118
118
|
return this.startOf(e2) <= n2 && n2 <= this.endOf(e2);
|
|
119
119
|
}, m2.isAfter = function(t2, e2) {
|
|
120
|
-
return
|
|
120
|
+
return O(t2) < this.startOf(e2);
|
|
121
121
|
}, m2.isBefore = function(t2, e2) {
|
|
122
|
-
return this.endOf(e2) <
|
|
122
|
+
return this.endOf(e2) < O(t2);
|
|
123
123
|
}, m2.$g = function(t2, e2, n2) {
|
|
124
|
-
return
|
|
124
|
+
return b.u(t2) ? this[e2] : this.set(n2, t2);
|
|
125
125
|
}, m2.unix = function() {
|
|
126
126
|
return Math.floor(this.valueOf() / 1e3);
|
|
127
127
|
}, m2.valueOf = function() {
|
|
128
128
|
return this.$d.getTime();
|
|
129
129
|
}, m2.startOf = function(t2, e2) {
|
|
130
|
-
var n2 = this, r2 = !!
|
|
131
|
-
var i2 =
|
|
130
|
+
var n2 = this, r2 = !!b.u(e2) || e2, f3 = b.p(t2), l2 = function(t3, e3) {
|
|
131
|
+
var i2 = b.w(n2.$u ? Date.UTC(n2.$y, e3, t3) : new Date(n2.$y, e3, t3), n2);
|
|
132
132
|
return r2 ? i2 : i2.endOf(a);
|
|
133
133
|
}, $2 = function(t3, e3) {
|
|
134
|
-
return
|
|
134
|
+
return b.w(n2.toDate()[t3].apply(n2.toDate("s"), (r2 ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e3)), n2);
|
|
135
135
|
}, y2 = this.$W, M3 = this.$M, m3 = this.$D, v2 = "set" + (this.$u ? "UTC" : "");
|
|
136
136
|
switch (f3) {
|
|
137
137
|
case h:
|
|
@@ -156,7 +156,7 @@ var require_dayjs_min = __commonJS({
|
|
|
156
156
|
}, m2.endOf = function(t2) {
|
|
157
157
|
return this.startOf(t2, false);
|
|
158
158
|
}, m2.$set = function(t2, e2) {
|
|
159
|
-
var n2, o2 =
|
|
159
|
+
var n2, o2 = b.p(t2), f3 = "set" + (this.$u ? "UTC" : ""), l2 = (n2 = {}, n2[a] = f3 + "Date", n2[d] = f3 + "Date", n2[c] = f3 + "Month", n2[h] = f3 + "FullYear", n2[u] = f3 + "Hours", n2[s] = f3 + "Minutes", n2[i] = f3 + "Seconds", n2[r] = f3 + "Milliseconds", n2)[o2], $2 = o2 === a ? this.$D + (e2 - this.$W) : e2;
|
|
160
160
|
if (o2 === c || o2 === h) {
|
|
161
161
|
var y2 = this.clone().set(d, 1);
|
|
162
162
|
y2.$d[l2]($2), y2.init(), this.$d = y2.set(d, Math.min(this.$D, y2.daysInMonth())).$d;
|
|
@@ -166,13 +166,13 @@ var require_dayjs_min = __commonJS({
|
|
|
166
166
|
}, m2.set = function(t2, e2) {
|
|
167
167
|
return this.clone().$set(t2, e2);
|
|
168
168
|
}, m2.get = function(t2) {
|
|
169
|
-
return this[
|
|
169
|
+
return this[b.p(t2)]();
|
|
170
170
|
}, m2.add = function(r2, f3) {
|
|
171
171
|
var d2, l2 = this;
|
|
172
172
|
r2 = Number(r2);
|
|
173
|
-
var $2 =
|
|
174
|
-
var e2 =
|
|
175
|
-
return
|
|
173
|
+
var $2 = b.p(f3), y2 = function(t2) {
|
|
174
|
+
var e2 = O(l2);
|
|
175
|
+
return b.w(e2.date(e2.date() + Math.round(t2 * r2)), l2);
|
|
176
176
|
};
|
|
177
177
|
if ($2 === c)
|
|
178
178
|
return this.set(c, this.$M + r2);
|
|
@@ -183,17 +183,17 @@ var require_dayjs_min = __commonJS({
|
|
|
183
183
|
if ($2 === o)
|
|
184
184
|
return y2(7);
|
|
185
185
|
var M3 = (d2 = {}, d2[s] = e, d2[u] = n, d2[i] = t, d2)[$2] || 1, m3 = this.$d.getTime() + r2 * M3;
|
|
186
|
-
return
|
|
186
|
+
return b.w(m3, this);
|
|
187
187
|
}, m2.subtract = function(t2, e2) {
|
|
188
188
|
return this.add(-1 * t2, e2);
|
|
189
189
|
}, m2.format = function(t2) {
|
|
190
190
|
var e2 = this, n2 = this.$locale();
|
|
191
191
|
if (!this.isValid())
|
|
192
192
|
return n2.invalidDate || l;
|
|
193
|
-
var r2 = t2 || "YYYY-MM-DDTHH:mm:ssZ", i2 =
|
|
193
|
+
var r2 = t2 || "YYYY-MM-DDTHH:mm:ssZ", i2 = b.z(this), s2 = this.$H, u2 = this.$m, a2 = this.$M, o2 = n2.weekdays, c2 = n2.months, f3 = n2.meridiem, h2 = function(t3, n3, i3, s3) {
|
|
194
194
|
return t3 && (t3[n3] || t3(e2, r2)) || i3[n3].slice(0, s3);
|
|
195
195
|
}, d2 = function(t3) {
|
|
196
|
-
return
|
|
196
|
+
return b.s(s2 % 12 || 12, t3, "0");
|
|
197
197
|
}, $2 = f3 || function(t3, e3, n3) {
|
|
198
198
|
var r3 = t3 < 12 ? "AM" : "PM";
|
|
199
199
|
return n3 ? r3.toLowerCase() : r3;
|
|
@@ -204,11 +204,11 @@ var require_dayjs_min = __commonJS({
|
|
|
204
204
|
case "YY":
|
|
205
205
|
return String(e2.$y).slice(-2);
|
|
206
206
|
case "YYYY":
|
|
207
|
-
return
|
|
207
|
+
return b.s(e2.$y, 4, "0");
|
|
208
208
|
case "M":
|
|
209
209
|
return a2 + 1;
|
|
210
210
|
case "MM":
|
|
211
|
-
return
|
|
211
|
+
return b.s(a2 + 1, 2, "0");
|
|
212
212
|
case "MMM":
|
|
213
213
|
return h2(n2.monthsShort, a2, c2, 3);
|
|
214
214
|
case "MMMM":
|
|
@@ -216,7 +216,7 @@ var require_dayjs_min = __commonJS({
|
|
|
216
216
|
case "D":
|
|
217
217
|
return e2.$D;
|
|
218
218
|
case "DD":
|
|
219
|
-
return
|
|
219
|
+
return b.s(e2.$D, 2, "0");
|
|
220
220
|
case "d":
|
|
221
221
|
return String(e2.$W);
|
|
222
222
|
case "dd":
|
|
@@ -228,7 +228,7 @@ var require_dayjs_min = __commonJS({
|
|
|
228
228
|
case "H":
|
|
229
229
|
return String(s2);
|
|
230
230
|
case "HH":
|
|
231
|
-
return
|
|
231
|
+
return b.s(s2, 2, "0");
|
|
232
232
|
case "h":
|
|
233
233
|
return d2(1);
|
|
234
234
|
case "hh":
|
|
@@ -240,13 +240,13 @@ var require_dayjs_min = __commonJS({
|
|
|
240
240
|
case "m":
|
|
241
241
|
return String(u2);
|
|
242
242
|
case "mm":
|
|
243
|
-
return
|
|
243
|
+
return b.s(u2, 2, "0");
|
|
244
244
|
case "s":
|
|
245
245
|
return String(e2.$s);
|
|
246
246
|
case "ss":
|
|
247
|
-
return
|
|
247
|
+
return b.s(e2.$s, 2, "0");
|
|
248
248
|
case "SSS":
|
|
249
|
-
return
|
|
249
|
+
return b.s(e2.$ms, 3, "0");
|
|
250
250
|
case "Z":
|
|
251
251
|
return i2;
|
|
252
252
|
}
|
|
@@ -256,8 +256,8 @@ var require_dayjs_min = __commonJS({
|
|
|
256
256
|
}, m2.utcOffset = function() {
|
|
257
257
|
return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
|
|
258
258
|
}, m2.diff = function(r2, d2, l2) {
|
|
259
|
-
var $2, y2 = this, M3 =
|
|
260
|
-
return
|
|
259
|
+
var $2, y2 = this, M3 = b.p(d2), m3 = O(r2), v2 = (m3.utcOffset() - this.utcOffset()) * e, g2 = this - m3, D2 = function() {
|
|
260
|
+
return b.m(y2, m3);
|
|
261
261
|
};
|
|
262
262
|
switch (M3) {
|
|
263
263
|
case h:
|
|
@@ -287,7 +287,7 @@ var require_dayjs_min = __commonJS({
|
|
|
287
287
|
default:
|
|
288
288
|
$2 = g2;
|
|
289
289
|
}
|
|
290
|
-
return l2 ? $2 :
|
|
290
|
+
return l2 ? $2 : b.a($2);
|
|
291
291
|
}, m2.daysInMonth = function() {
|
|
292
292
|
return this.endOf(c).$D;
|
|
293
293
|
}, m2.$locale = function() {
|
|
@@ -295,10 +295,10 @@ var require_dayjs_min = __commonJS({
|
|
|
295
295
|
}, m2.locale = function(t2, e2) {
|
|
296
296
|
if (!t2)
|
|
297
297
|
return this.$L;
|
|
298
|
-
var n2 = this.clone(), r2 =
|
|
298
|
+
var n2 = this.clone(), r2 = w(t2, e2, true);
|
|
299
299
|
return r2 && (n2.$L = r2), n2;
|
|
300
300
|
}, m2.clone = function() {
|
|
301
|
-
return
|
|
301
|
+
return b.w(this.$d, this);
|
|
302
302
|
}, m2.toDate = function() {
|
|
303
303
|
return new Date(this.valueOf());
|
|
304
304
|
}, m2.toJSON = function() {
|
|
@@ -308,23 +308,23 @@ var require_dayjs_min = __commonJS({
|
|
|
308
308
|
}, m2.toString = function() {
|
|
309
309
|
return this.$d.toUTCString();
|
|
310
310
|
}, M2;
|
|
311
|
-
}(),
|
|
312
|
-
return
|
|
313
|
-
|
|
311
|
+
}(), k = _.prototype;
|
|
312
|
+
return O.prototype = k, [["$ms", r], ["$s", i], ["$m", s], ["$H", u], ["$W", a], ["$M", c], ["$y", h], ["$D", d]].forEach(function(t2) {
|
|
313
|
+
k[t2[1]] = function(e2) {
|
|
314
314
|
return this.$g(e2, t2[0], t2[1]);
|
|
315
315
|
};
|
|
316
|
-
}),
|
|
317
|
-
return t2.$i || (t2(e2,
|
|
318
|
-
},
|
|
319
|
-
return
|
|
320
|
-
},
|
|
316
|
+
}), O.extend = function(t2, e2) {
|
|
317
|
+
return t2.$i || (t2(e2, _, O), t2.$i = true), O;
|
|
318
|
+
}, O.locale = w, O.isDayjs = S, O.unix = function(t2) {
|
|
319
|
+
return O(1e3 * t2);
|
|
320
|
+
}, O.en = D[g], O.Ls = D, O.p = {}, O;
|
|
321
321
|
});
|
|
322
322
|
}
|
|
323
323
|
});
|
|
324
324
|
|
|
325
|
-
// node_modules/.pnpm/dayjs@1.11.
|
|
325
|
+
// node_modules/.pnpm/dayjs@1.11.10/node_modules/dayjs/plugin/isToday.js
|
|
326
326
|
var require_isToday = __commonJS({
|
|
327
|
-
"node_modules/.pnpm/dayjs@1.11.
|
|
327
|
+
"node_modules/.pnpm/dayjs@1.11.10/node_modules/dayjs/plugin/isToday.js"(exports, module) {
|
|
328
328
|
!function(e, o) {
|
|
329
329
|
"object" == typeof exports && "undefined" != typeof module ? module.exports = o() : "function" == typeof define && define.amd ? define(o) : (e = "undefined" != typeof globalThis ? globalThis : e || self).dayjs_plugin_isToday = o();
|
|
330
330
|
}(exports, function() {
|
|
@@ -3699,7 +3699,7 @@ var ObservableIntake = class {
|
|
|
3699
3699
|
}
|
|
3700
3700
|
};
|
|
3701
3701
|
|
|
3702
|
-
// node_modules/.pnpm/@push.rocks+smarttime@4.0.
|
|
3702
|
+
// node_modules/.pnpm/@push.rocks+smarttime@4.0.6/node_modules/@push.rocks/smarttime/dist_ts/index.js
|
|
3703
3703
|
var dist_ts_exports6 = {};
|
|
3704
3704
|
__export(dist_ts_exports6, {
|
|
3705
3705
|
CronJob: () => CronJob,
|
|
@@ -3714,7 +3714,7 @@ __export(dist_ts_exports6, {
|
|
|
3714
3714
|
units: () => units
|
|
3715
3715
|
});
|
|
3716
3716
|
|
|
3717
|
-
// node_modules/.pnpm/croner@
|
|
3717
|
+
// node_modules/.pnpm/croner@7.0.3/node_modules/croner/dist/croner.min.js
|
|
3718
3718
|
function minitz(y, m, d, h, i, s, tz, throwOnInvalid) {
|
|
3719
3719
|
return minitz.fromTZ(minitz.tp(y, m, d, h, i, s, tz), throwOnInvalid);
|
|
3720
3720
|
}
|
|
@@ -3739,14 +3739,15 @@ minitz.fromTZ = function(tp, throwOnInvalid) {
|
|
|
3739
3739
|
}
|
|
3740
3740
|
};
|
|
3741
3741
|
minitz.toTZ = function(d, tzStr) {
|
|
3742
|
-
const
|
|
3742
|
+
const localDateString = d.toLocaleString("en-US", { timeZone: tzStr }).replace(/[\u202f]/, " ");
|
|
3743
|
+
const td = new Date(localDateString);
|
|
3743
3744
|
return { y: td.getFullYear(), m: td.getMonth() + 1, d: td.getDate(), h: td.getHours(), i: td.getMinutes(), s: td.getSeconds(), tz: tzStr };
|
|
3744
3745
|
};
|
|
3745
3746
|
minitz.tp = (y, m, d, h, i, s, tz) => {
|
|
3746
3747
|
return { y, m, d, h, i, s, tz };
|
|
3747
3748
|
};
|
|
3748
3749
|
function getTimezoneOffset(timeZone, date = /* @__PURE__ */ new Date()) {
|
|
3749
|
-
const tz = date.toLocaleString("en", { timeZone,
|
|
3750
|
+
const tz = date.toLocaleString("en-US", { timeZone, timeZoneName: "short" }).split(" ").slice(-1)[0];
|
|
3750
3751
|
const dateString = date.toLocaleString("en-US").replace(/[\u202f]/, " ");
|
|
3751
3752
|
return Date.parse(`${dateString} GMT`) - Date.parse(`${dateString} ${tz}`);
|
|
3752
3753
|
}
|
|
@@ -3775,7 +3776,6 @@ function CronOptions(options) {
|
|
|
3775
3776
|
options.interval = options.interval === void 0 ? 0 : parseInt(options.interval, 10);
|
|
3776
3777
|
options.utcOffset = options.utcOffset === void 0 ? void 0 : parseInt(options.utcOffset, 10);
|
|
3777
3778
|
options.unref = options.unref === void 0 ? false : options.unref;
|
|
3778
|
-
options.kill = false;
|
|
3779
3779
|
if (options.startAt) {
|
|
3780
3780
|
options.startAt = new CronDate(options.startAt, options.timezone);
|
|
3781
3781
|
}
|
|
@@ -3804,166 +3804,9 @@ function CronOptions(options) {
|
|
|
3804
3804
|
}
|
|
3805
3805
|
return options;
|
|
3806
3806
|
}
|
|
3807
|
-
var
|
|
3808
|
-
var
|
|
3809
|
-
|
|
3810
|
-
this.tz = tz;
|
|
3811
|
-
if (d && d instanceof Date) {
|
|
3812
|
-
if (!isNaN(d)) {
|
|
3813
|
-
this.fromDate(d);
|
|
3814
|
-
} else {
|
|
3815
|
-
throw new TypeError("CronDate: Invalid date passed to CronDate constructor");
|
|
3816
|
-
}
|
|
3817
|
-
} else if (d === void 0) {
|
|
3818
|
-
this.fromDate(/* @__PURE__ */ new Date());
|
|
3819
|
-
} else if (d && typeof d === "string") {
|
|
3820
|
-
this.fromString(d);
|
|
3821
|
-
} else if (d instanceof CronDate) {
|
|
3822
|
-
this.fromCronDate(d);
|
|
3823
|
-
} else {
|
|
3824
|
-
throw new TypeError("CronDate: Invalid type (" + typeof d + ") passed to CronDate constructor");
|
|
3825
|
-
}
|
|
3826
|
-
}
|
|
3827
|
-
CronDate.prototype.fromDate = function(inDate) {
|
|
3828
|
-
if (this.tz !== void 0) {
|
|
3829
|
-
if (typeof this.tz === "number") {
|
|
3830
|
-
this.ms = inDate.getUTCMilliseconds();
|
|
3831
|
-
this.second = inDate.getUTCSeconds();
|
|
3832
|
-
this.minute = inDate.getUTCMinutes() + this.tz;
|
|
3833
|
-
this.hour = inDate.getUTCHours();
|
|
3834
|
-
this.day = inDate.getUTCDate();
|
|
3835
|
-
this.month = inDate.getUTCMonth();
|
|
3836
|
-
this.year = inDate.getUTCFullYear();
|
|
3837
|
-
this.apply();
|
|
3838
|
-
} else {
|
|
3839
|
-
const d = minitz.toTZ(inDate, this.tz);
|
|
3840
|
-
this.ms = inDate.getMilliseconds();
|
|
3841
|
-
this.second = d.s;
|
|
3842
|
-
this.minute = d.i;
|
|
3843
|
-
this.hour = d.h;
|
|
3844
|
-
this.day = d.d;
|
|
3845
|
-
this.month = d.m - 1;
|
|
3846
|
-
this.year = d.y;
|
|
3847
|
-
}
|
|
3848
|
-
} else {
|
|
3849
|
-
this.ms = inDate.getMilliseconds();
|
|
3850
|
-
this.second = inDate.getSeconds();
|
|
3851
|
-
this.minute = inDate.getMinutes();
|
|
3852
|
-
this.hour = inDate.getHours();
|
|
3853
|
-
this.day = inDate.getDate();
|
|
3854
|
-
this.month = inDate.getMonth();
|
|
3855
|
-
this.year = inDate.getFullYear();
|
|
3856
|
-
}
|
|
3857
|
-
};
|
|
3858
|
-
CronDate.prototype.fromCronDate = function(d) {
|
|
3859
|
-
this.tz = d.tz;
|
|
3860
|
-
this.year = d.year;
|
|
3861
|
-
this.month = d.month;
|
|
3862
|
-
this.day = d.day;
|
|
3863
|
-
this.hour = d.hour;
|
|
3864
|
-
this.minute = d.minute;
|
|
3865
|
-
this.second = d.second;
|
|
3866
|
-
this.ms = d.ms;
|
|
3867
|
-
};
|
|
3868
|
-
CronDate.prototype.apply = function() {
|
|
3869
|
-
if (this.month > 11 || this.day > DaysOfMonth[this.month] || this.hour > 59 || this.minute > 59 || this.second > 59 || this.hour < 0 || this.minute < 0 || this.second < 0) {
|
|
3870
|
-
const d = new Date(Date.UTC(this.year, this.month, this.day, this.hour, this.minute, this.second, this.ms));
|
|
3871
|
-
this.ms = d.getUTCMilliseconds();
|
|
3872
|
-
this.second = d.getUTCSeconds();
|
|
3873
|
-
this.minute = d.getUTCMinutes();
|
|
3874
|
-
this.hour = d.getUTCHours();
|
|
3875
|
-
this.day = d.getUTCDate();
|
|
3876
|
-
this.month = d.getUTCMonth();
|
|
3877
|
-
this.year = d.getUTCFullYear();
|
|
3878
|
-
return true;
|
|
3879
|
-
} else {
|
|
3880
|
-
return false;
|
|
3881
|
-
}
|
|
3882
|
-
};
|
|
3883
|
-
CronDate.prototype.fromString = function(str) {
|
|
3884
|
-
return this.fromDate(minitz.fromTZISO(str, this.tz));
|
|
3885
|
-
};
|
|
3886
|
-
CronDate.prototype.findNext = function(options, target, pattern, offset) {
|
|
3887
|
-
const originalTarget = this[target];
|
|
3888
|
-
let lastDayOfMonth;
|
|
3889
|
-
if (pattern.lastDayOfMonth) {
|
|
3890
|
-
if (this.month !== 1) {
|
|
3891
|
-
lastDayOfMonth = DaysOfMonth[this.month];
|
|
3892
|
-
} else {
|
|
3893
|
-
lastDayOfMonth = new Date(Date.UTC(this.year, this.month + 1, 0, 0, 0, 0, 0)).getUTCDate();
|
|
3894
|
-
}
|
|
3895
|
-
}
|
|
3896
|
-
const fDomWeekDay = !pattern.starDOW && target == "day" ? new Date(Date.UTC(this.year, this.month, 1, 0, 0, 0, 0)).getUTCDay() : void 0;
|
|
3897
|
-
for (let i = this[target] + offset; i < pattern[target].length; i++) {
|
|
3898
|
-
let match = pattern[target][i];
|
|
3899
|
-
if (target === "day" && pattern.lastDayOfMonth && i - offset == lastDayOfMonth) {
|
|
3900
|
-
match = true;
|
|
3901
|
-
}
|
|
3902
|
-
if (target === "day" && !pattern.starDOW) {
|
|
3903
|
-
const dowMatch = pattern.dow[(fDomWeekDay + (i - offset - 1)) % 7];
|
|
3904
|
-
if (options.legacyMode && !pattern.starDOM) {
|
|
3905
|
-
match = match || dowMatch;
|
|
3906
|
-
} else {
|
|
3907
|
-
match = match && dowMatch;
|
|
3908
|
-
}
|
|
3909
|
-
}
|
|
3910
|
-
if (match) {
|
|
3911
|
-
this[target] = i - offset;
|
|
3912
|
-
return originalTarget !== this[target] ? 2 : 1;
|
|
3913
|
-
}
|
|
3914
|
-
}
|
|
3915
|
-
return 3;
|
|
3916
|
-
};
|
|
3917
|
-
CronDate.prototype.recurse = function(pattern, options, doing) {
|
|
3918
|
-
const res = this.findNext(options, RecursionSteps[doing][0], pattern, RecursionSteps[doing][2]);
|
|
3919
|
-
if (res > 1) {
|
|
3920
|
-
let resetLevel = doing + 1;
|
|
3921
|
-
while (resetLevel < RecursionSteps.length) {
|
|
3922
|
-
this[RecursionSteps[resetLevel][0]] = -RecursionSteps[resetLevel][2];
|
|
3923
|
-
resetLevel++;
|
|
3924
|
-
}
|
|
3925
|
-
if (res === 3) {
|
|
3926
|
-
this[RecursionSteps[doing][1]]++;
|
|
3927
|
-
this[RecursionSteps[doing][0]] = -RecursionSteps[doing][2];
|
|
3928
|
-
this.apply();
|
|
3929
|
-
return this.recurse(pattern, options, 0);
|
|
3930
|
-
} else if (this.apply()) {
|
|
3931
|
-
return this.recurse(pattern, options, doing - 1);
|
|
3932
|
-
}
|
|
3933
|
-
}
|
|
3934
|
-
doing += 1;
|
|
3935
|
-
if (doing >= RecursionSteps.length) {
|
|
3936
|
-
return this;
|
|
3937
|
-
} else if (this.year >= 3e3) {
|
|
3938
|
-
return null;
|
|
3939
|
-
} else {
|
|
3940
|
-
return this.recurse(pattern, options, doing);
|
|
3941
|
-
}
|
|
3942
|
-
};
|
|
3943
|
-
CronDate.prototype.increment = function(pattern, options, hasPreviousRun) {
|
|
3944
|
-
if (options.interval > 1 && hasPreviousRun) {
|
|
3945
|
-
this.second += options.interval;
|
|
3946
|
-
} else {
|
|
3947
|
-
this.second += 1;
|
|
3948
|
-
}
|
|
3949
|
-
this.ms = 0;
|
|
3950
|
-
this.apply();
|
|
3951
|
-
return this.recurse(pattern, options, 0);
|
|
3952
|
-
};
|
|
3953
|
-
CronDate.prototype.getDate = function(internal) {
|
|
3954
|
-
if (internal || this.tz === void 0 && this.utcOffset === void 0) {
|
|
3955
|
-
return new Date(this.year, this.month, this.day, this.hour, this.minute, this.second, this.ms);
|
|
3956
|
-
} else {
|
|
3957
|
-
if (typeof this.tz === "number") {
|
|
3958
|
-
return new Date(Date.UTC(this.year, this.month, this.day, this.hour, this.minute - this.tz, this.second, this.ms));
|
|
3959
|
-
} else {
|
|
3960
|
-
return minitz(this.year, this.month + 1, this.day, this.hour, this.minute, this.second, this.tz);
|
|
3961
|
-
}
|
|
3962
|
-
}
|
|
3963
|
-
};
|
|
3964
|
-
CronDate.prototype.getTime = function() {
|
|
3965
|
-
return this.getDate().getTime();
|
|
3966
|
-
};
|
|
3807
|
+
var LAST_OCCURRENCE = 32;
|
|
3808
|
+
var ANY_OCCURRENCE = 1 | 2 | 4 | 8 | 16 | LAST_OCCURRENCE;
|
|
3809
|
+
var OCCURRENCE_BITMASKS = [1, 2, 4, 16, 16];
|
|
3967
3810
|
function CronPattern(pattern, timezone) {
|
|
3968
3811
|
this.pattern = pattern;
|
|
3969
3812
|
this.timezone = timezone;
|
|
@@ -3972,7 +3815,7 @@ function CronPattern(pattern, timezone) {
|
|
|
3972
3815
|
this.hour = Array(24).fill(0);
|
|
3973
3816
|
this.day = Array(31).fill(0);
|
|
3974
3817
|
this.month = Array(12).fill(0);
|
|
3975
|
-
this.
|
|
3818
|
+
this.dayOfWeek = Array(7).fill(0);
|
|
3976
3819
|
this.lastDayOfMonth = false;
|
|
3977
3820
|
this.starDOM = false;
|
|
3978
3821
|
this.starDOW = false;
|
|
@@ -4017,55 +3860,89 @@ CronPattern.prototype.parse = function() {
|
|
|
4017
3860
|
parts[5] = parts[5].replace("?", initDate.getDay());
|
|
4018
3861
|
}
|
|
4019
3862
|
this.throwAtIllegalCharacters(parts);
|
|
4020
|
-
this.partToArray("second", parts[0], 0);
|
|
4021
|
-
this.partToArray("minute", parts[1], 0);
|
|
4022
|
-
this.partToArray("hour", parts[2], 0);
|
|
4023
|
-
this.partToArray("day", parts[3], -1);
|
|
4024
|
-
this.partToArray("month", parts[4], -1);
|
|
4025
|
-
this.partToArray("
|
|
4026
|
-
if (this.
|
|
4027
|
-
this.
|
|
3863
|
+
this.partToArray("second", parts[0], 0, 1);
|
|
3864
|
+
this.partToArray("minute", parts[1], 0, 1);
|
|
3865
|
+
this.partToArray("hour", parts[2], 0, 1);
|
|
3866
|
+
this.partToArray("day", parts[3], -1, 1);
|
|
3867
|
+
this.partToArray("month", parts[4], -1, 1);
|
|
3868
|
+
this.partToArray("dayOfWeek", parts[5], 0, ANY_OCCURRENCE);
|
|
3869
|
+
if (this.dayOfWeek[7]) {
|
|
3870
|
+
this.dayOfWeek[0] = this.dayOfWeek[7];
|
|
4028
3871
|
}
|
|
4029
3872
|
};
|
|
4030
|
-
CronPattern.prototype.partToArray = function(type, conf, valueIndexOffset) {
|
|
3873
|
+
CronPattern.prototype.partToArray = function(type, conf, valueIndexOffset, defaultValue) {
|
|
4031
3874
|
const arr = this[type];
|
|
3875
|
+
const lastDayOfMonth = type === "day" && this.lastDayOfMonth;
|
|
3876
|
+
if (conf === "" && !lastDayOfMonth)
|
|
3877
|
+
throw new TypeError("CronPattern: configuration entry " + type + " (" + conf + ") is empty, check for trailing spaces.");
|
|
4032
3878
|
if (conf === "*")
|
|
4033
|
-
return arr.fill(
|
|
3879
|
+
return arr.fill(defaultValue);
|
|
4034
3880
|
const split = conf.split(",");
|
|
4035
3881
|
if (split.length > 1) {
|
|
4036
3882
|
for (let i = 0; i < split.length; i++) {
|
|
4037
|
-
this.partToArray(type, split[i], valueIndexOffset);
|
|
3883
|
+
this.partToArray(type, split[i], valueIndexOffset, defaultValue);
|
|
4038
3884
|
}
|
|
4039
3885
|
} else if (conf.indexOf("-") !== -1 && conf.indexOf("/") !== -1) {
|
|
4040
|
-
this.handleRangeWithStepping(conf, type, valueIndexOffset);
|
|
3886
|
+
this.handleRangeWithStepping(conf, type, valueIndexOffset, defaultValue);
|
|
4041
3887
|
} else if (conf.indexOf("-") !== -1) {
|
|
4042
|
-
this.handleRange(conf, type, valueIndexOffset);
|
|
3888
|
+
this.handleRange(conf, type, valueIndexOffset, defaultValue);
|
|
4043
3889
|
} else if (conf.indexOf("/") !== -1) {
|
|
4044
|
-
this.handleStepping(conf, type, valueIndexOffset);
|
|
3890
|
+
this.handleStepping(conf, type, valueIndexOffset, defaultValue);
|
|
4045
3891
|
} else if (conf !== "") {
|
|
4046
|
-
this.handleNumber(conf, type, valueIndexOffset);
|
|
3892
|
+
this.handleNumber(conf, type, valueIndexOffset, defaultValue);
|
|
4047
3893
|
}
|
|
4048
3894
|
};
|
|
4049
3895
|
CronPattern.prototype.throwAtIllegalCharacters = function(parts) {
|
|
4050
|
-
const reValidCron = /[^/*0-9,-]+/;
|
|
4051
3896
|
for (let i = 0; i < parts.length; i++) {
|
|
3897
|
+
const reValidCron = i === 5 ? /[^/*0-9,\-#L]+/ : /[^/*0-9,-]+/;
|
|
4052
3898
|
if (reValidCron.test(parts[i])) {
|
|
4053
3899
|
throw new TypeError("CronPattern: configuration entry " + i + " (" + parts[i] + ") contains illegal characters.");
|
|
4054
3900
|
}
|
|
4055
3901
|
}
|
|
4056
3902
|
};
|
|
4057
|
-
CronPattern.prototype.handleNumber = function(conf, type, valueIndexOffset) {
|
|
4058
|
-
const
|
|
3903
|
+
CronPattern.prototype.handleNumber = function(conf, type, valueIndexOffset, defaultValue) {
|
|
3904
|
+
const result = this.extractNth(conf, type);
|
|
3905
|
+
const i = parseInt(result[0], 10) + valueIndexOffset;
|
|
4059
3906
|
if (isNaN(i)) {
|
|
4060
3907
|
throw new TypeError("CronPattern: " + type + " is not a number: '" + conf + "'");
|
|
4061
3908
|
}
|
|
4062
|
-
|
|
4063
|
-
|
|
3909
|
+
this.setPart(type, i, result[1] || defaultValue);
|
|
3910
|
+
};
|
|
3911
|
+
CronPattern.prototype.setPart = function(part, index, value) {
|
|
3912
|
+
if (!Object.prototype.hasOwnProperty.call(this, part)) {
|
|
3913
|
+
throw new TypeError("CronPattern: Invalid part specified: " + part);
|
|
4064
3914
|
}
|
|
4065
|
-
|
|
3915
|
+
if (part === "dayOfWeek") {
|
|
3916
|
+
if (index === 7)
|
|
3917
|
+
index = 0;
|
|
3918
|
+
if ((index < 0 || index > 6) && index !== "L") {
|
|
3919
|
+
throw new RangeError("CronPattern: Invalid value for dayOfWeek: " + index);
|
|
3920
|
+
}
|
|
3921
|
+
this.setNthWeekdayOfMonth(index, value);
|
|
3922
|
+
return;
|
|
3923
|
+
}
|
|
3924
|
+
if (part === "second" || part === "minute") {
|
|
3925
|
+
if (index < 0 || index >= 60) {
|
|
3926
|
+
throw new RangeError("CronPattern: Invalid value for " + part + ": " + index);
|
|
3927
|
+
}
|
|
3928
|
+
} else if (part === "hour") {
|
|
3929
|
+
if (index < 0 || index >= 24) {
|
|
3930
|
+
throw new RangeError("CronPattern: Invalid value for " + part + ": " + index);
|
|
3931
|
+
}
|
|
3932
|
+
} else if (part === "day") {
|
|
3933
|
+
if (index < 0 || index >= 31) {
|
|
3934
|
+
throw new RangeError("CronPattern: Invalid value for " + part + ": " + index);
|
|
3935
|
+
}
|
|
3936
|
+
} else if (part === "month") {
|
|
3937
|
+
if (index < 0 || index >= 12) {
|
|
3938
|
+
throw new RangeError("CronPattern: Invalid value for " + part + ": " + index);
|
|
3939
|
+
}
|
|
3940
|
+
}
|
|
3941
|
+
this[part][index] = value;
|
|
4066
3942
|
};
|
|
4067
|
-
CronPattern.prototype.handleRangeWithStepping = function(conf, type, valueIndexOffset) {
|
|
4068
|
-
const
|
|
3943
|
+
CronPattern.prototype.handleRangeWithStepping = function(conf, type, valueIndexOffset, defaultValue) {
|
|
3944
|
+
const result = this.extractNth(conf, type);
|
|
3945
|
+
const matches = result[0].match(/^(\d+)-(\d+)\/(\d+)$/);
|
|
4069
3946
|
if (matches === null)
|
|
4070
3947
|
throw new TypeError("CronPattern: Syntax error, illegal range with stepping: '" + conf + "'");
|
|
4071
3948
|
let [, lower, upper, steps] = matches;
|
|
@@ -4082,16 +3959,27 @@ CronPattern.prototype.handleRangeWithStepping = function(conf, type, valueIndexO
|
|
|
4082
3959
|
throw new TypeError("CronPattern: Syntax error, illegal stepping: 0");
|
|
4083
3960
|
if (steps > this[type].length)
|
|
4084
3961
|
throw new TypeError("CronPattern: Syntax error, steps cannot be greater than maximum value of part (" + this[type].length + ")");
|
|
4085
|
-
if (lower < 0 || upper >= this[type].length)
|
|
4086
|
-
throw new TypeError("CronPattern: Value out of range: '" + conf + "'");
|
|
4087
3962
|
if (lower > upper)
|
|
4088
3963
|
throw new TypeError("CronPattern: From value is larger than to value: '" + conf + "'");
|
|
4089
3964
|
for (let i = lower; i <= upper; i += steps) {
|
|
4090
|
-
this
|
|
3965
|
+
this.setPart(type, i, result[1] || defaultValue);
|
|
3966
|
+
}
|
|
3967
|
+
};
|
|
3968
|
+
CronPattern.prototype.extractNth = function(conf, type) {
|
|
3969
|
+
let rest = conf;
|
|
3970
|
+
let nth;
|
|
3971
|
+
if (rest.includes("#")) {
|
|
3972
|
+
if (type !== "dayOfWeek") {
|
|
3973
|
+
throw new Error("CronPattern: nth (#) only allowed in day-of-week field");
|
|
3974
|
+
}
|
|
3975
|
+
nth = rest.split("#")[1];
|
|
3976
|
+
rest = rest.split("#")[0];
|
|
4091
3977
|
}
|
|
3978
|
+
return [rest, nth];
|
|
4092
3979
|
};
|
|
4093
|
-
CronPattern.prototype.handleRange = function(conf, type, valueIndexOffset) {
|
|
4094
|
-
const
|
|
3980
|
+
CronPattern.prototype.handleRange = function(conf, type, valueIndexOffset, defaultValue) {
|
|
3981
|
+
const result = this.extractNth(conf, type);
|
|
3982
|
+
const split = result[0].split("-");
|
|
4095
3983
|
if (split.length !== 2) {
|
|
4096
3984
|
throw new TypeError("CronPattern: Syntax error, illegal range: '" + conf + "'");
|
|
4097
3985
|
}
|
|
@@ -4101,18 +3989,16 @@ CronPattern.prototype.handleRange = function(conf, type, valueIndexOffset) {
|
|
|
4101
3989
|
} else if (isNaN(upper)) {
|
|
4102
3990
|
throw new TypeError("CronPattern: Syntax error, illegal upper range (NaN)");
|
|
4103
3991
|
}
|
|
4104
|
-
if (lower < 0 || upper >= this[type].length) {
|
|
4105
|
-
throw new TypeError("CronPattern: Value out of range: '" + conf + "'");
|
|
4106
|
-
}
|
|
4107
3992
|
if (lower > upper) {
|
|
4108
3993
|
throw new TypeError("CronPattern: From value is larger than to value: '" + conf + "'");
|
|
4109
3994
|
}
|
|
4110
3995
|
for (let i = lower; i <= upper; i++) {
|
|
4111
|
-
this
|
|
3996
|
+
this.setPart(type, i, result[1] || defaultValue);
|
|
4112
3997
|
}
|
|
4113
3998
|
};
|
|
4114
|
-
CronPattern.prototype.handleStepping = function(conf, type) {
|
|
4115
|
-
const
|
|
3999
|
+
CronPattern.prototype.handleStepping = function(conf, type, _valueIndexOffset, defaultValue) {
|
|
4000
|
+
const result = this.extractNth(conf, type);
|
|
4001
|
+
const split = result[0].split("/");
|
|
4116
4002
|
if (split.length !== 2) {
|
|
4117
4003
|
throw new TypeError("CronPattern: Syntax error, illegal stepping: '" + conf + "'");
|
|
4118
4004
|
}
|
|
@@ -4128,7 +4014,7 @@ CronPattern.prototype.handleStepping = function(conf, type) {
|
|
|
4128
4014
|
if (steps > this[type].length)
|
|
4129
4015
|
throw new TypeError("CronPattern: Syntax error, max steps for part is (" + this[type].length + ")");
|
|
4130
4016
|
for (let i = start; i < this[type].length; i += steps) {
|
|
4131
|
-
this
|
|
4017
|
+
this.setPart(type, i, result[1] || defaultValue);
|
|
4132
4018
|
}
|
|
4133
4019
|
};
|
|
4134
4020
|
CronPattern.prototype.replaceAlphaDays = function(conf) {
|
|
@@ -4153,31 +4039,226 @@ CronPattern.prototype.handleNicknames = function(pattern) {
|
|
|
4153
4039
|
return pattern;
|
|
4154
4040
|
}
|
|
4155
4041
|
};
|
|
4156
|
-
|
|
4157
|
-
|
|
4158
|
-
|
|
4042
|
+
CronPattern.prototype.setNthWeekdayOfMonth = function(index, nthWeekday) {
|
|
4043
|
+
if (nthWeekday === "L") {
|
|
4044
|
+
this["dayOfWeek"][index] = this["dayOfWeek"][index] | LAST_OCCURRENCE;
|
|
4045
|
+
} else if (nthWeekday < 6 && nthWeekday > 0) {
|
|
4046
|
+
this["dayOfWeek"][index] = this["dayOfWeek"][index] | OCCURRENCE_BITMASKS[nthWeekday - 1];
|
|
4047
|
+
} else if (nthWeekday === ANY_OCCURRENCE) {
|
|
4048
|
+
this["dayOfWeek"][index] = ANY_OCCURRENCE;
|
|
4049
|
+
} else {
|
|
4050
|
+
throw new TypeError(`CronPattern: nth weekday of of range, should be 1-5 or L. Value: ${nthWeekday}`);
|
|
4051
|
+
}
|
|
4052
|
+
};
|
|
4053
|
+
var DaysOfMonth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
4054
|
+
var RecursionSteps = [["month", "year", 0], ["day", "month", -1], ["hour", "day", 0], ["minute", "hour", 0], ["second", "minute", 0]];
|
|
4055
|
+
function CronDate(d, tz) {
|
|
4056
|
+
this.tz = tz;
|
|
4057
|
+
if (d && d instanceof Date) {
|
|
4058
|
+
if (!isNaN(d)) {
|
|
4059
|
+
this.fromDate(d);
|
|
4060
|
+
} else {
|
|
4061
|
+
throw new TypeError("CronDate: Invalid date passed to CronDate constructor");
|
|
4062
|
+
}
|
|
4063
|
+
} else if (d === void 0) {
|
|
4064
|
+
this.fromDate(/* @__PURE__ */ new Date());
|
|
4065
|
+
} else if (d && typeof d === "string") {
|
|
4066
|
+
this.fromString(d);
|
|
4067
|
+
} else if (d instanceof CronDate) {
|
|
4068
|
+
this.fromCronDate(d);
|
|
4069
|
+
} else {
|
|
4070
|
+
throw new TypeError("CronDate: Invalid type (" + typeof d + ") passed to CronDate constructor");
|
|
4071
|
+
}
|
|
4072
|
+
}
|
|
4073
|
+
CronDate.prototype.isNthWeekdayOfMonth = function(year, month, day, nth) {
|
|
4074
|
+
const date = new Date(Date.UTC(year, month, day));
|
|
4075
|
+
const weekday = date.getUTCDay();
|
|
4076
|
+
let count = 0;
|
|
4077
|
+
for (let d = 1; d <= day; d++) {
|
|
4078
|
+
if (new Date(Date.UTC(year, month, d)).getUTCDay() === weekday) {
|
|
4079
|
+
count++;
|
|
4080
|
+
}
|
|
4081
|
+
}
|
|
4082
|
+
if (nth & ANY_OCCURRENCE && OCCURRENCE_BITMASKS[count - 1] & nth) {
|
|
4083
|
+
return true;
|
|
4084
|
+
}
|
|
4085
|
+
if (nth & LAST_OCCURRENCE) {
|
|
4086
|
+
const daysInMonth = new Date(Date.UTC(year, month + 1, 0)).getUTCDate();
|
|
4087
|
+
for (let d = day + 1; d <= daysInMonth; d++) {
|
|
4088
|
+
if (new Date(Date.UTC(year, month, d)).getUTCDay() === weekday) {
|
|
4089
|
+
return false;
|
|
4090
|
+
}
|
|
4091
|
+
}
|
|
4092
|
+
return true;
|
|
4093
|
+
}
|
|
4094
|
+
return false;
|
|
4095
|
+
};
|
|
4096
|
+
CronDate.prototype.fromDate = function(inDate) {
|
|
4097
|
+
if (this.tz !== void 0) {
|
|
4098
|
+
if (typeof this.tz === "number") {
|
|
4099
|
+
this.ms = inDate.getUTCMilliseconds();
|
|
4100
|
+
this.second = inDate.getUTCSeconds();
|
|
4101
|
+
this.minute = inDate.getUTCMinutes() + this.tz;
|
|
4102
|
+
this.hour = inDate.getUTCHours();
|
|
4103
|
+
this.day = inDate.getUTCDate();
|
|
4104
|
+
this.month = inDate.getUTCMonth();
|
|
4105
|
+
this.year = inDate.getUTCFullYear();
|
|
4106
|
+
this.apply();
|
|
4107
|
+
} else {
|
|
4108
|
+
const d = minitz.toTZ(inDate, this.tz);
|
|
4109
|
+
this.ms = inDate.getMilliseconds();
|
|
4110
|
+
this.second = d.s;
|
|
4111
|
+
this.minute = d.i;
|
|
4112
|
+
this.hour = d.h;
|
|
4113
|
+
this.day = d.d;
|
|
4114
|
+
this.month = d.m - 1;
|
|
4115
|
+
this.year = d.y;
|
|
4116
|
+
}
|
|
4117
|
+
} else {
|
|
4118
|
+
this.ms = inDate.getMilliseconds();
|
|
4119
|
+
this.second = inDate.getSeconds();
|
|
4120
|
+
this.minute = inDate.getMinutes();
|
|
4121
|
+
this.hour = inDate.getHours();
|
|
4122
|
+
this.day = inDate.getDate();
|
|
4123
|
+
this.month = inDate.getMonth();
|
|
4124
|
+
this.year = inDate.getFullYear();
|
|
4125
|
+
}
|
|
4126
|
+
};
|
|
4127
|
+
CronDate.prototype.fromCronDate = function(d) {
|
|
4128
|
+
this.tz = d.tz;
|
|
4129
|
+
this.year = d.year;
|
|
4130
|
+
this.month = d.month;
|
|
4131
|
+
this.day = d.day;
|
|
4132
|
+
this.hour = d.hour;
|
|
4133
|
+
this.minute = d.minute;
|
|
4134
|
+
this.second = d.second;
|
|
4135
|
+
this.ms = d.ms;
|
|
4136
|
+
};
|
|
4137
|
+
CronDate.prototype.apply = function() {
|
|
4138
|
+
if (this.month > 11 || this.day > DaysOfMonth[this.month] || this.hour > 59 || this.minute > 59 || this.second > 59 || this.hour < 0 || this.minute < 0 || this.second < 0) {
|
|
4139
|
+
const d = new Date(Date.UTC(this.year, this.month, this.day, this.hour, this.minute, this.second, this.ms));
|
|
4140
|
+
this.ms = d.getUTCMilliseconds();
|
|
4141
|
+
this.second = d.getUTCSeconds();
|
|
4142
|
+
this.minute = d.getUTCMinutes();
|
|
4143
|
+
this.hour = d.getUTCHours();
|
|
4144
|
+
this.day = d.getUTCDate();
|
|
4145
|
+
this.month = d.getUTCMonth();
|
|
4146
|
+
this.year = d.getUTCFullYear();
|
|
4147
|
+
return true;
|
|
4148
|
+
} else {
|
|
4149
|
+
return false;
|
|
4150
|
+
}
|
|
4151
|
+
};
|
|
4152
|
+
CronDate.prototype.fromString = function(str) {
|
|
4153
|
+
return this.fromDate(minitz.fromTZISO(str, this.tz));
|
|
4154
|
+
};
|
|
4155
|
+
CronDate.prototype.findNext = function(options, target, pattern, offset) {
|
|
4156
|
+
const originalTarget = this[target];
|
|
4157
|
+
let lastDayOfMonth;
|
|
4158
|
+
if (pattern.lastDayOfMonth) {
|
|
4159
|
+
if (this.month !== 1) {
|
|
4160
|
+
lastDayOfMonth = DaysOfMonth[this.month];
|
|
4161
|
+
} else {
|
|
4162
|
+
lastDayOfMonth = new Date(Date.UTC(this.year, this.month + 1, 0, 0, 0, 0, 0)).getUTCDate();
|
|
4163
|
+
}
|
|
4164
|
+
}
|
|
4165
|
+
const fDomWeekDay = !pattern.starDOW && target == "day" ? new Date(Date.UTC(this.year, this.month, 1, 0, 0, 0, 0)).getUTCDay() : void 0;
|
|
4166
|
+
for (let i = this[target] + offset; i < pattern[target].length; i++) {
|
|
4167
|
+
let match = pattern[target][i];
|
|
4168
|
+
if (target === "day" && pattern.lastDayOfMonth && i - offset == lastDayOfMonth) {
|
|
4169
|
+
match = true;
|
|
4170
|
+
}
|
|
4171
|
+
if (target === "day" && !pattern.starDOW) {
|
|
4172
|
+
let dowMatch = pattern.dayOfWeek[(fDomWeekDay + (i - offset - 1)) % 7];
|
|
4173
|
+
if (dowMatch && dowMatch & ANY_OCCURRENCE) {
|
|
4174
|
+
dowMatch = this.isNthWeekdayOfMonth(this.year, this.month, i - offset, dowMatch);
|
|
4175
|
+
} else if (dowMatch) {
|
|
4176
|
+
throw new Error(`CronDate: Invalid value for dayOfWeek encountered. ${dowMatch}`);
|
|
4177
|
+
}
|
|
4178
|
+
if (options.legacyMode && !pattern.starDOM) {
|
|
4179
|
+
match = match || dowMatch;
|
|
4180
|
+
} else {
|
|
4181
|
+
match = match && dowMatch;
|
|
4182
|
+
}
|
|
4183
|
+
}
|
|
4184
|
+
if (match) {
|
|
4185
|
+
this[target] = i - offset;
|
|
4186
|
+
return originalTarget !== this[target] ? 2 : 1;
|
|
4187
|
+
}
|
|
4188
|
+
}
|
|
4189
|
+
return 3;
|
|
4190
|
+
};
|
|
4191
|
+
CronDate.prototype.recurse = function(pattern, options, doing) {
|
|
4192
|
+
const res = this.findNext(options, RecursionSteps[doing][0], pattern, RecursionSteps[doing][2]);
|
|
4193
|
+
if (res > 1) {
|
|
4194
|
+
let resetLevel = doing + 1;
|
|
4195
|
+
while (resetLevel < RecursionSteps.length) {
|
|
4196
|
+
this[RecursionSteps[resetLevel][0]] = -RecursionSteps[resetLevel][2];
|
|
4197
|
+
resetLevel++;
|
|
4198
|
+
}
|
|
4199
|
+
if (res === 3) {
|
|
4200
|
+
this[RecursionSteps[doing][1]]++;
|
|
4201
|
+
this[RecursionSteps[doing][0]] = -RecursionSteps[doing][2];
|
|
4202
|
+
this.apply();
|
|
4203
|
+
return this.recurse(pattern, options, 0);
|
|
4204
|
+
} else if (this.apply()) {
|
|
4205
|
+
return this.recurse(pattern, options, doing - 1);
|
|
4206
|
+
}
|
|
4207
|
+
}
|
|
4208
|
+
doing += 1;
|
|
4209
|
+
if (doing >= RecursionSteps.length) {
|
|
4210
|
+
return this;
|
|
4211
|
+
} else if (this.year >= 3e3) {
|
|
4212
|
+
return null;
|
|
4213
|
+
} else {
|
|
4214
|
+
return this.recurse(pattern, options, doing);
|
|
4215
|
+
}
|
|
4216
|
+
};
|
|
4217
|
+
CronDate.prototype.increment = function(pattern, options, hasPreviousRun) {
|
|
4218
|
+
this.second += options.interval > 1 && hasPreviousRun ? options.interval : 1;
|
|
4219
|
+
this.ms = 0;
|
|
4220
|
+
this.apply();
|
|
4221
|
+
return this.recurse(pattern, options, 0);
|
|
4222
|
+
};
|
|
4223
|
+
CronDate.prototype.getDate = function(internal) {
|
|
4224
|
+
if (internal || this.tz === void 0) {
|
|
4225
|
+
return new Date(this.year, this.month, this.day, this.hour, this.minute, this.second, this.ms);
|
|
4226
|
+
} else {
|
|
4227
|
+
if (typeof this.tz === "number") {
|
|
4228
|
+
return new Date(Date.UTC(this.year, this.month, this.day, this.hour, this.minute - this.tz, this.second, this.ms));
|
|
4229
|
+
} else {
|
|
4230
|
+
return minitz(this.year, this.month + 1, this.day, this.hour, this.minute, this.second, this.tz);
|
|
4231
|
+
}
|
|
4232
|
+
}
|
|
4233
|
+
};
|
|
4234
|
+
CronDate.prototype.getTime = function() {
|
|
4235
|
+
return this.getDate().getTime();
|
|
4236
|
+
};
|
|
4237
|
+
function isFunction2(v) {
|
|
4159
4238
|
return Object.prototype.toString.call(v) === "[object Function]" || "function" === typeof v || v instanceof Function;
|
|
4160
4239
|
}
|
|
4161
|
-
function
|
|
4240
|
+
function unrefTimer(timer2) {
|
|
4162
4241
|
if (typeof Deno !== "undefined" && typeof Deno.unrefTimer !== "undefined") {
|
|
4163
4242
|
Deno.unrefTimer(timer2);
|
|
4164
4243
|
} else if (timer2 && typeof timer2.unref !== "undefined") {
|
|
4165
4244
|
timer2.unref();
|
|
4166
4245
|
}
|
|
4167
4246
|
}
|
|
4247
|
+
var maxDelay = 30 * 1e3;
|
|
4248
|
+
var scheduledJobs = [];
|
|
4168
4249
|
function Cron(pattern, fnOrOptions1, fnOrOptions2) {
|
|
4169
4250
|
if (!(this instanceof Cron)) {
|
|
4170
4251
|
return new Cron(pattern, fnOrOptions1, fnOrOptions2);
|
|
4171
4252
|
}
|
|
4172
4253
|
let options, func;
|
|
4173
|
-
if (
|
|
4254
|
+
if (isFunction2(fnOrOptions1)) {
|
|
4174
4255
|
func = fnOrOptions1;
|
|
4175
4256
|
} else if (typeof fnOrOptions1 === "object") {
|
|
4176
4257
|
options = fnOrOptions1;
|
|
4177
4258
|
} else if (fnOrOptions1 !== void 0) {
|
|
4178
4259
|
throw new Error("Cron: Invalid argument passed for optionsIn. Should be one of function, or object (options).");
|
|
4179
4260
|
}
|
|
4180
|
-
if (
|
|
4261
|
+
if (isFunction2(fnOrOptions2)) {
|
|
4181
4262
|
func = fnOrOptions2;
|
|
4182
4263
|
} else if (typeof fnOrOptions2 === "object") {
|
|
4183
4264
|
options = fnOrOptions2;
|
|
@@ -4186,19 +4267,11 @@ function Cron(pattern, fnOrOptions1, fnOrOptions2) {
|
|
|
4186
4267
|
}
|
|
4187
4268
|
this.name = options ? options.name : void 0;
|
|
4188
4269
|
this.options = CronOptions(options);
|
|
4189
|
-
this.
|
|
4190
|
-
this.pattern = void 0;
|
|
4191
|
-
this.blocking = false;
|
|
4192
|
-
this.previousrun = void 0;
|
|
4193
|
-
this.runstarted = void 0;
|
|
4270
|
+
this._states = { kill: false, blocking: false, previousRun: void 0, currentRun: void 0, once: void 0, currentTimeout: void 0, maxRuns: options ? options.maxRuns : void 0, paused: options ? options.paused : false, pattern: void 0 };
|
|
4194
4271
|
if (pattern && (pattern instanceof Date || typeof pattern === "string" && pattern.indexOf(":") > 0)) {
|
|
4195
|
-
this.once = new CronDate(pattern, this.options.timezone || this.options.utcOffset);
|
|
4272
|
+
this._states.once = new CronDate(pattern, this.options.timezone || this.options.utcOffset);
|
|
4196
4273
|
} else {
|
|
4197
|
-
this.pattern = new CronPattern(pattern, this.options.timezone);
|
|
4198
|
-
}
|
|
4199
|
-
if (func !== void 0) {
|
|
4200
|
-
this.fn = func;
|
|
4201
|
-
this.schedule();
|
|
4274
|
+
this._states.pattern = new CronPattern(pattern, this.options.timezone);
|
|
4202
4275
|
}
|
|
4203
4276
|
if (this.name) {
|
|
4204
4277
|
const existing = scheduledJobs.find((j) => j.name === this.name);
|
|
@@ -4208,36 +4281,48 @@ function Cron(pattern, fnOrOptions1, fnOrOptions2) {
|
|
|
4208
4281
|
scheduledJobs.push(this);
|
|
4209
4282
|
}
|
|
4210
4283
|
}
|
|
4284
|
+
if (func !== void 0) {
|
|
4285
|
+
this.fn = func;
|
|
4286
|
+
this.schedule();
|
|
4287
|
+
}
|
|
4211
4288
|
return this;
|
|
4212
4289
|
}
|
|
4213
|
-
Cron.prototype.
|
|
4290
|
+
Cron.prototype.nextRun = function(prev) {
|
|
4214
4291
|
const next = this._next(prev);
|
|
4215
4292
|
return next ? next.getDate() : null;
|
|
4216
4293
|
};
|
|
4217
|
-
Cron.prototype.
|
|
4218
|
-
if (n > this.
|
|
4219
|
-
n = this.
|
|
4294
|
+
Cron.prototype.nextRuns = function(n, previous) {
|
|
4295
|
+
if (n > this._states.maxRuns) {
|
|
4296
|
+
n = this._states.maxRuns;
|
|
4220
4297
|
}
|
|
4221
4298
|
const enumeration = [];
|
|
4222
|
-
let prev = previous || this.
|
|
4223
|
-
while (n-- && (prev = this.
|
|
4299
|
+
let prev = previous || this._states.currentRun;
|
|
4300
|
+
while (n-- && (prev = this.nextRun(prev))) {
|
|
4224
4301
|
enumeration.push(prev);
|
|
4225
4302
|
}
|
|
4226
4303
|
return enumeration;
|
|
4227
4304
|
};
|
|
4228
|
-
Cron.prototype.
|
|
4229
|
-
|
|
4230
|
-
|
|
4231
|
-
|
|
4305
|
+
Cron.prototype.getPattern = function() {
|
|
4306
|
+
return this._states.pattern ? this._states.pattern.pattern : void 0;
|
|
4307
|
+
};
|
|
4308
|
+
Cron.prototype.isRunning = function() {
|
|
4309
|
+
const msLeft = this.msToNext(this._states.currentRun);
|
|
4310
|
+
const isRunning = !this._states.paused;
|
|
4311
|
+
const isScheduled = this.fn !== void 0;
|
|
4312
|
+
const notIsKilled = !this._states.kill;
|
|
4313
|
+
return isRunning && isScheduled && notIsKilled && msLeft !== null;
|
|
4314
|
+
};
|
|
4315
|
+
Cron.prototype.isStopped = function() {
|
|
4316
|
+
return this._states.kill;
|
|
4232
4317
|
};
|
|
4233
|
-
Cron.prototype.
|
|
4234
|
-
return this.blocking;
|
|
4318
|
+
Cron.prototype.isBusy = function() {
|
|
4319
|
+
return this._states.blocking;
|
|
4235
4320
|
};
|
|
4236
|
-
Cron.prototype.
|
|
4237
|
-
return this.
|
|
4321
|
+
Cron.prototype.currentRun = function() {
|
|
4322
|
+
return this._states.currentRun ? this._states.currentRun.getDate() : null;
|
|
4238
4323
|
};
|
|
4239
|
-
Cron.prototype.
|
|
4240
|
-
return this.
|
|
4324
|
+
Cron.prototype.previousRun = function() {
|
|
4325
|
+
return this._states.previousRun ? this._states.previousRun.getDate() : null;
|
|
4241
4326
|
};
|
|
4242
4327
|
Cron.prototype.msToNext = function(prev) {
|
|
4243
4328
|
const next = this._next(prev);
|
|
@@ -4249,78 +4334,84 @@ Cron.prototype.msToNext = function(prev) {
|
|
|
4249
4334
|
}
|
|
4250
4335
|
};
|
|
4251
4336
|
Cron.prototype.stop = function() {
|
|
4252
|
-
this.
|
|
4253
|
-
if (this.currentTimeout) {
|
|
4254
|
-
clearTimeout(this.currentTimeout);
|
|
4337
|
+
this._states.kill = true;
|
|
4338
|
+
if (this._states.currentTimeout) {
|
|
4339
|
+
clearTimeout(this._states.currentTimeout);
|
|
4340
|
+
}
|
|
4341
|
+
const jobIndex = scheduledJobs.indexOf(this);
|
|
4342
|
+
if (jobIndex >= 0) {
|
|
4343
|
+
scheduledJobs.splice(jobIndex, 1);
|
|
4255
4344
|
}
|
|
4256
4345
|
};
|
|
4257
4346
|
Cron.prototype.pause = function() {
|
|
4258
|
-
|
|
4347
|
+
this._states.paused = true;
|
|
4348
|
+
return !this._states.kill;
|
|
4259
4349
|
};
|
|
4260
4350
|
Cron.prototype.resume = function() {
|
|
4261
|
-
|
|
4351
|
+
this._states.paused = false;
|
|
4352
|
+
return !this._states.kill;
|
|
4262
4353
|
};
|
|
4263
|
-
Cron.prototype.schedule = function(func
|
|
4354
|
+
Cron.prototype.schedule = function(func) {
|
|
4264
4355
|
if (func && this.fn) {
|
|
4265
4356
|
throw new Error("Cron: It is not allowed to schedule two functions using the same Croner instance.");
|
|
4266
4357
|
} else if (func) {
|
|
4267
4358
|
this.fn = func;
|
|
4268
4359
|
}
|
|
4269
|
-
let waitMs = this.msToNext(
|
|
4270
|
-
const target = this.
|
|
4360
|
+
let waitMs = this.msToNext(this._states.currentRun);
|
|
4361
|
+
const target = this.nextRun(this._states.currentRun);
|
|
4271
4362
|
if (waitMs === null || target === null)
|
|
4272
4363
|
return this;
|
|
4273
4364
|
if (waitMs > maxDelay) {
|
|
4274
4365
|
waitMs = maxDelay;
|
|
4275
4366
|
}
|
|
4276
|
-
this.currentTimeout = setTimeout(() => this._checkTrigger(target), waitMs);
|
|
4277
|
-
if (this.currentTimeout && this.options.unref) {
|
|
4278
|
-
|
|
4367
|
+
this._states.currentTimeout = setTimeout(() => this._checkTrigger(target), waitMs);
|
|
4368
|
+
if (this._states.currentTimeout && this.options.unref) {
|
|
4369
|
+
unrefTimer(this._states.currentTimeout);
|
|
4279
4370
|
}
|
|
4280
4371
|
return this;
|
|
4281
4372
|
};
|
|
4282
4373
|
Cron.prototype._trigger = async function(initiationDate) {
|
|
4283
|
-
this.blocking = true;
|
|
4284
|
-
this.
|
|
4374
|
+
this._states.blocking = true;
|
|
4375
|
+
this._states.currentRun = new CronDate(void 0, this.options.timezone || this.options.utcOffset);
|
|
4285
4376
|
if (this.options.catch) {
|
|
4286
4377
|
try {
|
|
4287
4378
|
await this.fn(this, this.options.context);
|
|
4288
4379
|
} catch (_e) {
|
|
4289
|
-
if (
|
|
4290
|
-
|
|
4380
|
+
if (isFunction2(this.options.catch)) {
|
|
4381
|
+
this.options.catch(_e, this);
|
|
4291
4382
|
}
|
|
4292
|
-
} finally {
|
|
4293
|
-
this.blocking = false;
|
|
4294
4383
|
}
|
|
4295
4384
|
} else {
|
|
4296
4385
|
await this.fn(this, this.options.context);
|
|
4297
|
-
this.blocking = false;
|
|
4298
4386
|
}
|
|
4387
|
+
this._states.previousRun = new CronDate(initiationDate, this.options.timezone || this.options.utcOffset);
|
|
4388
|
+
this._states.blocking = false;
|
|
4389
|
+
};
|
|
4390
|
+
Cron.prototype.trigger = async function() {
|
|
4391
|
+
await this._trigger();
|
|
4299
4392
|
};
|
|
4300
4393
|
Cron.prototype._checkTrigger = function(target) {
|
|
4301
|
-
const now = /* @__PURE__ */ new Date(), shouldRun = !this.
|
|
4394
|
+
const now = /* @__PURE__ */ new Date(), shouldRun = !this._states.paused && now.getTime() >= target, isBlocked = this._states.blocking && this.options.protect;
|
|
4302
4395
|
if (shouldRun && !isBlocked) {
|
|
4303
|
-
this.
|
|
4396
|
+
this._states.maxRuns--;
|
|
4304
4397
|
this._trigger();
|
|
4305
|
-
this.previousrun = new CronDate(void 0, this.options.timezone || this.options.utcOffset);
|
|
4306
|
-
this.schedule();
|
|
4307
4398
|
} else {
|
|
4308
|
-
if (shouldRun && isBlocked &&
|
|
4309
|
-
(
|
|
4399
|
+
if (shouldRun && isBlocked && isFunction2(this.options.protect)) {
|
|
4400
|
+
setTimeout(() => this.options.protect(this), 0);
|
|
4310
4401
|
}
|
|
4311
|
-
this.schedule(void 0, now);
|
|
4312
4402
|
}
|
|
4403
|
+
this.schedule();
|
|
4313
4404
|
};
|
|
4314
4405
|
Cron.prototype._next = function(prev) {
|
|
4315
|
-
const hasPreviousRun = prev || this.
|
|
4406
|
+
const hasPreviousRun = prev || this._states.currentRun ? true : false;
|
|
4316
4407
|
prev = new CronDate(prev, this.options.timezone || this.options.utcOffset);
|
|
4317
4408
|
if (this.options.startAt && prev && prev.getTime() < this.options.startAt.getTime()) {
|
|
4318
4409
|
prev = this.options.startAt;
|
|
4319
4410
|
}
|
|
4320
|
-
const nextRun = this.once || new CronDate(prev, this.options.timezone || this.options.utcOffset).increment(this.pattern, this.options, hasPreviousRun);
|
|
4321
|
-
if (this.once && this.once.getTime() <= prev.getTime()) {
|
|
4411
|
+
const nextRun = this._states.once || new CronDate(prev, this.options.timezone || this.options.utcOffset).increment(this._states.pattern, this.options, hasPreviousRun);
|
|
4412
|
+
if (this._states.once && this._states.once.getTime() <= prev.getTime()) {
|
|
4322
4413
|
return null;
|
|
4323
|
-
} else if (nextRun === null || this.
|
|
4414
|
+
} else if (nextRun === null || this._states.maxRuns <= 0 || this._states.kill || this.options.stopAt && nextRun.getTime() >= this.options.stopAt.getTime()) {
|
|
4324
4415
|
return null;
|
|
4325
4416
|
} else {
|
|
4326
4417
|
return nextRun;
|
|
@@ -4329,7 +4420,7 @@ Cron.prototype._next = function(prev) {
|
|
|
4329
4420
|
Cron.Cron = Cron;
|
|
4330
4421
|
Cron.scheduledJobs = scheduledJobs;
|
|
4331
4422
|
|
|
4332
|
-
// node_modules/.pnpm/@push.rocks+smarttime@4.0.
|
|
4423
|
+
// node_modules/.pnpm/@push.rocks+smarttime@4.0.6/node_modules/@push.rocks/smarttime/dist_ts/smarttime.plugins.js
|
|
4333
4424
|
var import_dayjs = __toESM(require_dayjs_min(), 1);
|
|
4334
4425
|
var import_isToday = __toESM(require_isToday(), 1);
|
|
4335
4426
|
|
|
@@ -4435,10 +4526,10 @@ function prettyMilliseconds(milliseconds, options = {}) {
|
|
|
4435
4526
|
return options.colonNotation ? result.join("") : result.join(" ");
|
|
4436
4527
|
}
|
|
4437
4528
|
|
|
4438
|
-
// node_modules/.pnpm/@push.rocks+smarttime@4.0.
|
|
4529
|
+
// node_modules/.pnpm/@push.rocks+smarttime@4.0.6/node_modules/@push.rocks/smarttime/dist_ts/smarttime.plugins.js
|
|
4439
4530
|
import_dayjs.default.extend(import_isToday.default);
|
|
4440
4531
|
|
|
4441
|
-
// node_modules/.pnpm/@push.rocks+smarttime@4.0.
|
|
4532
|
+
// node_modules/.pnpm/@push.rocks+smarttime@4.0.6/node_modules/@push.rocks/smarttime/dist_ts/smarttime.classes.cronjob.js
|
|
4442
4533
|
var CronJob = class {
|
|
4443
4534
|
constructor(cronManager, cronExpressionArg, jobFunction) {
|
|
4444
4535
|
this.status = "initial";
|
|
@@ -4480,7 +4571,7 @@ var CronJob = class {
|
|
|
4480
4571
|
}
|
|
4481
4572
|
};
|
|
4482
4573
|
|
|
4483
|
-
// node_modules/.pnpm/@push.rocks+smarttime@4.0.
|
|
4574
|
+
// node_modules/.pnpm/@push.rocks+smarttime@4.0.6/node_modules/@push.rocks/smarttime/dist_ts/smarttime.units.js
|
|
4484
4575
|
var units = {
|
|
4485
4576
|
years: (timesArg = 1) => {
|
|
4486
4577
|
return timesArg * 3154e7;
|
|
@@ -4536,7 +4627,7 @@ var getMilliSecondsAsHumanReadableString = (milliSecondsArg) => {
|
|
|
4536
4627
|
return prettyMilliseconds(milliSecondsArg);
|
|
4537
4628
|
};
|
|
4538
4629
|
|
|
4539
|
-
// node_modules/.pnpm/@push.rocks+smarttime@4.0.
|
|
4630
|
+
// node_modules/.pnpm/@push.rocks+smarttime@4.0.6/node_modules/@push.rocks/smarttime/dist_ts/smarttime.classes.cronmanager.js
|
|
4540
4631
|
var CronManager = class {
|
|
4541
4632
|
constructor() {
|
|
4542
4633
|
this.status = "stopped";
|
|
@@ -4563,29 +4654,29 @@ var CronManager = class {
|
|
|
4563
4654
|
for (const cronJob of this.cronjobs.getArray()) {
|
|
4564
4655
|
cronJob.start();
|
|
4565
4656
|
}
|
|
4566
|
-
|
|
4567
|
-
this.executionTimeout = new dist_ts_exports2.Timeout(0);
|
|
4568
|
-
do {
|
|
4569
|
-
let nextRunningCronjob;
|
|
4570
|
-
for (const cronJob of this.cronjobs.getArray()) {
|
|
4571
|
-
cronJob.checkExecution();
|
|
4572
|
-
if (!nextRunningCronjob || cronJob.getTimeToNextExecution() < nextRunningCronjob.getTimeToNextExecution()) {
|
|
4573
|
-
nextRunningCronjob = cronJob;
|
|
4574
|
-
}
|
|
4575
|
-
}
|
|
4576
|
-
if (nextRunningCronjob) {
|
|
4577
|
-
this.executionTimeout = new dist_ts_exports2.Timeout(nextRunningCronjob.getTimeToNextExecution());
|
|
4578
|
-
console.log(`Next CronJob scheduled in ${getMilliSecondsAsHumanReadableString(this.executionTimeout.getTimeLeft())}`);
|
|
4579
|
-
} else {
|
|
4580
|
-
this.executionTimeout = new dist_ts_exports2.Timeout(1e3);
|
|
4581
|
-
console.log("no cronjobs specified! Checking again in 1 second");
|
|
4582
|
-
}
|
|
4583
|
-
await this.executionTimeout.promise;
|
|
4584
|
-
} while (this.status === "started");
|
|
4585
|
-
};
|
|
4586
|
-
runCronCycle();
|
|
4657
|
+
this.runCronCycle();
|
|
4587
4658
|
}
|
|
4588
4659
|
}
|
|
4660
|
+
async runCronCycle() {
|
|
4661
|
+
this.executionTimeout = new dist_ts_exports2.Timeout(0);
|
|
4662
|
+
do {
|
|
4663
|
+
let nextRunningCronjob;
|
|
4664
|
+
for (const cronJob of this.cronjobs.getArray()) {
|
|
4665
|
+
cronJob.checkExecution();
|
|
4666
|
+
if (!nextRunningCronjob || cronJob.getTimeToNextExecution() < nextRunningCronjob.getTimeToNextExecution()) {
|
|
4667
|
+
nextRunningCronjob = cronJob;
|
|
4668
|
+
}
|
|
4669
|
+
}
|
|
4670
|
+
if (nextRunningCronjob) {
|
|
4671
|
+
this.executionTimeout = new dist_ts_exports2.Timeout(nextRunningCronjob.getTimeToNextExecution());
|
|
4672
|
+
console.log(`Next CronJob scheduled in ${getMilliSecondsAsHumanReadableString(this.executionTimeout.getTimeLeft())}`);
|
|
4673
|
+
} else {
|
|
4674
|
+
this.executionTimeout = new dist_ts_exports2.Timeout(1e3);
|
|
4675
|
+
console.log("no cronjobs specified! Checking again in 1 second");
|
|
4676
|
+
}
|
|
4677
|
+
await this.executionTimeout.promise;
|
|
4678
|
+
} while (this.status === "started");
|
|
4679
|
+
}
|
|
4589
4680
|
/**
|
|
4590
4681
|
* stops all cronjobs
|
|
4591
4682
|
*/
|
|
@@ -4602,14 +4693,14 @@ var CronManager = class {
|
|
|
4602
4693
|
}
|
|
4603
4694
|
};
|
|
4604
4695
|
|
|
4605
|
-
// node_modules/.pnpm/@push.rocks+smarttime@4.0.
|
|
4606
|
-
var ExtendedDate = class extends Date {
|
|
4696
|
+
// node_modules/.pnpm/@push.rocks+smarttime@4.0.6/node_modules/@push.rocks/smarttime/dist_ts/smarttime.classes.extendeddate.js
|
|
4697
|
+
var ExtendedDate = class _ExtendedDate extends Date {
|
|
4607
4698
|
// STATIC factories
|
|
4608
4699
|
static fromMillis(milliSeconds) {
|
|
4609
|
-
return new
|
|
4700
|
+
return new _ExtendedDate(milliSeconds);
|
|
4610
4701
|
}
|
|
4611
4702
|
static fromDate(dateArg) {
|
|
4612
|
-
return new
|
|
4703
|
+
return new _ExtendedDate(dateArg.getTime());
|
|
4613
4704
|
}
|
|
4614
4705
|
static fromEuropeanDate(europeanDate) {
|
|
4615
4706
|
const dateArray = /(.*)\.(.*)\.(.*)/.exec(europeanDate);
|
|
@@ -4622,7 +4713,7 @@ var ExtendedDate = class extends Date {
|
|
|
4622
4713
|
// day
|
|
4623
4714
|
);
|
|
4624
4715
|
const unixMilli = date.getTime();
|
|
4625
|
-
return new
|
|
4716
|
+
return new _ExtendedDate(unixMilli);
|
|
4626
4717
|
}
|
|
4627
4718
|
/**
|
|
4628
4719
|
* creates an Extended date from a hypedDate like "2018-03-28"
|
|
@@ -4630,7 +4721,7 @@ var ExtendedDate = class extends Date {
|
|
|
4630
4721
|
*/
|
|
4631
4722
|
static fromHyphedDate(dateString) {
|
|
4632
4723
|
const dateMillis = new Date(dateString).getTime();
|
|
4633
|
-
return new
|
|
4724
|
+
return new _ExtendedDate(dateMillis);
|
|
4634
4725
|
}
|
|
4635
4726
|
/**
|
|
4636
4727
|
* Same as .fromEuropeanDate(), but accepts additional timeArg and zoneArg
|
|
@@ -4643,7 +4734,7 @@ var ExtendedDate = class extends Date {
|
|
|
4643
4734
|
const dateTimeString = `${dateArray[3]}-${sliceDate(dateArray[2])}-${sliceDate(dateArray[1])}T${timeArg}`;
|
|
4644
4735
|
const date = import_dayjs.default(dateTimeString);
|
|
4645
4736
|
const unixMilli = date.toDate().getTime();
|
|
4646
|
-
return new
|
|
4737
|
+
return new _ExtendedDate(unixMilli);
|
|
4647
4738
|
}
|
|
4648
4739
|
constructor(unixMilli = Date.now()) {
|
|
4649
4740
|
super(unixMilli);
|
|
@@ -4715,7 +4806,7 @@ var ExtendedDate = class extends Date {
|
|
|
4715
4806
|
}
|
|
4716
4807
|
};
|
|
4717
4808
|
|
|
4718
|
-
// node_modules/.pnpm/@push.rocks+smarttime@4.0.
|
|
4809
|
+
// node_modules/.pnpm/@push.rocks+smarttime@4.0.6/node_modules/@push.rocks/smarttime/dist_ts/smarttime.classes.hrtmeasurement.js
|
|
4719
4810
|
var HrtMeasurement = class {
|
|
4720
4811
|
constructor() {
|
|
4721
4812
|
this.nanoSeconds = null;
|
|
@@ -4756,7 +4847,7 @@ var HrtMeasurement = class {
|
|
|
4756
4847
|
}
|
|
4757
4848
|
};
|
|
4758
4849
|
|
|
4759
|
-
// node_modules/.pnpm/@push.rocks+smarttime@4.0.
|
|
4850
|
+
// node_modules/.pnpm/@push.rocks+smarttime@4.0.6/node_modules/@push.rocks/smarttime/dist_ts/smarttime.classes.interval.js
|
|
4760
4851
|
var Interval = class {
|
|
4761
4852
|
constructor(intervalMillisencondsArg) {
|
|
4762
4853
|
this.status = "initial";
|
|
@@ -4790,20 +4881,20 @@ var Interval = class {
|
|
|
4790
4881
|
}
|
|
4791
4882
|
};
|
|
4792
4883
|
|
|
4793
|
-
// node_modules/.pnpm/@push.rocks+smarttime@4.0.
|
|
4794
|
-
var TimeStamp = class {
|
|
4884
|
+
// node_modules/.pnpm/@push.rocks+smarttime@4.0.6/node_modules/@push.rocks/smarttime/dist_ts/smarttime.classes.timestamp.js
|
|
4885
|
+
var TimeStamp = class _TimeStamp {
|
|
4795
4886
|
/**
|
|
4796
4887
|
* returns new TimeStamp from milliseconds
|
|
4797
4888
|
*/
|
|
4798
4889
|
static fromMilliSeconds(milliSecondsArg) {
|
|
4799
|
-
return new
|
|
4890
|
+
return new _TimeStamp(milliSecondsArg);
|
|
4800
4891
|
}
|
|
4801
4892
|
/**
|
|
4802
4893
|
* returns new TimeStamp for now with change set
|
|
4803
4894
|
* @param timeStampArg
|
|
4804
4895
|
*/
|
|
4805
4896
|
static fromTimeStamp(timeStampArg) {
|
|
4806
|
-
const localTimeStamp = new
|
|
4897
|
+
const localTimeStamp = new _TimeStamp();
|
|
4807
4898
|
localTimeStamp.change = localTimeStamp.milliSeconds - timeStampArg.milliSeconds;
|
|
4808
4899
|
return localTimeStamp;
|
|
4809
4900
|
}
|
|
@@ -4853,14 +4944,14 @@ var TimeStamp = class {
|
|
|
4853
4944
|
}
|
|
4854
4945
|
}
|
|
4855
4946
|
isYoungerThanMilliSeconds(millisecondArg) {
|
|
4856
|
-
const nowTimeStamp = new
|
|
4947
|
+
const nowTimeStamp = new _TimeStamp();
|
|
4857
4948
|
const compareEpochTime = nowTimeStamp.epochtime - millisecondArg;
|
|
4858
|
-
const compareTimeStamp = new
|
|
4949
|
+
const compareTimeStamp = new _TimeStamp(compareEpochTime);
|
|
4859
4950
|
return this.isYoungerThanOtherTimeStamp(compareTimeStamp);
|
|
4860
4951
|
}
|
|
4861
4952
|
};
|
|
4862
4953
|
|
|
4863
|
-
// node_modules/.pnpm/@push.rocks+smarttime@4.0.
|
|
4954
|
+
// node_modules/.pnpm/@push.rocks+smarttime@4.0.6/node_modules/@push.rocks/smarttime/dist_ts/smarttime.classes.timer.js
|
|
4864
4955
|
var Timer = class {
|
|
4865
4956
|
get timeLeft() {
|
|
4866
4957
|
return this.timeInMilliseconds - this.pausedAt.change;
|
|
@@ -5002,7 +5093,7 @@ var AsyncExecutionStack = class {
|
|
|
5002
5093
|
};
|
|
5003
5094
|
|
|
5004
5095
|
// node_modules/.pnpm/@push.rocks+lik@6.0.5/node_modules/@push.rocks/lik/dist_ts/lik.fastmap.js
|
|
5005
|
-
var FastMap = class {
|
|
5096
|
+
var FastMap = class _FastMap {
|
|
5006
5097
|
constructor() {
|
|
5007
5098
|
this.mapObject = {};
|
|
5008
5099
|
}
|
|
@@ -5041,7 +5132,7 @@ var FastMap = class {
|
|
|
5041
5132
|
* returns a new Fastmap that includes all values from this and all from the fastmap in the argument
|
|
5042
5133
|
*/
|
|
5043
5134
|
concat(fastMapArg) {
|
|
5044
|
-
const concatedFastmap = new
|
|
5135
|
+
const concatedFastmap = new _FastMap();
|
|
5045
5136
|
for (const key of this.getKeys()) {
|
|
5046
5137
|
concatedFastmap.addToMap(key, this.getByKey(key));
|
|
5047
5138
|
}
|
|
@@ -5083,7 +5174,7 @@ var uni = (prefix = "uni") => {
|
|
|
5083
5174
|
return v.toString(16);
|
|
5084
5175
|
});
|
|
5085
5176
|
};
|
|
5086
|
-
var ObjectMap = class {
|
|
5177
|
+
var ObjectMap = class _ObjectMap {
|
|
5087
5178
|
/**
|
|
5088
5179
|
* returns a new instance
|
|
5089
5180
|
*/
|
|
@@ -5259,7 +5350,7 @@ var ObjectMap = class {
|
|
|
5259
5350
|
* returns a new Objectmap that includes
|
|
5260
5351
|
*/
|
|
5261
5352
|
concat(objectMapArg) {
|
|
5262
|
-
const concattedObjectMap = new
|
|
5353
|
+
const concattedObjectMap = new _ObjectMap();
|
|
5263
5354
|
concattedObjectMap.fastMap.addAllFromOther(this.fastMap);
|
|
5264
5355
|
concattedObjectMap.fastMap.addAllFromOther(objectMapArg.fastMap);
|
|
5265
5356
|
return concattedObjectMap;
|
|
@@ -6469,7 +6560,7 @@ var CycleCounter = class {
|
|
|
6469
6560
|
var logger = new dist_ts_exports9.ConsoleLog();
|
|
6470
6561
|
|
|
6471
6562
|
// ts/taskbuffer.classes.task.ts
|
|
6472
|
-
var
|
|
6563
|
+
var Task = class _Task {
|
|
6473
6564
|
constructor(optionsArg) {
|
|
6474
6565
|
// Add a list to store the blocking tasks
|
|
6475
6566
|
this.blockingTasks = [];
|
|
@@ -6501,6 +6592,22 @@ var _Task = class {
|
|
|
6501
6592
|
return null;
|
|
6502
6593
|
}
|
|
6503
6594
|
}
|
|
6595
|
+
static {
|
|
6596
|
+
this.emptyTaskFunction = function(x) {
|
|
6597
|
+
const done = dist_ts_exports.defer();
|
|
6598
|
+
done.resolve();
|
|
6599
|
+
return done.promise;
|
|
6600
|
+
};
|
|
6601
|
+
}
|
|
6602
|
+
static {
|
|
6603
|
+
this.isTask = (taskArg) => {
|
|
6604
|
+
if (taskArg instanceof _Task && typeof taskArg.taskFunction === "function") {
|
|
6605
|
+
return true;
|
|
6606
|
+
} else {
|
|
6607
|
+
return false;
|
|
6608
|
+
}
|
|
6609
|
+
};
|
|
6610
|
+
}
|
|
6504
6611
|
static isTaskTouched(taskArg, touchedTasksArray) {
|
|
6505
6612
|
const taskToCheck = _Task.extractTask(taskArg);
|
|
6506
6613
|
let result = false;
|
|
@@ -6511,6 +6618,66 @@ var _Task = class {
|
|
|
6511
6618
|
}
|
|
6512
6619
|
return result;
|
|
6513
6620
|
}
|
|
6621
|
+
static {
|
|
6622
|
+
this.runTask = async (taskArg, optionsArg) => {
|
|
6623
|
+
const taskToRun = _Task.extractTask(taskArg);
|
|
6624
|
+
const done = dist_ts_exports.defer();
|
|
6625
|
+
for (const task of taskToRun.blockingTasks) {
|
|
6626
|
+
await task.finished;
|
|
6627
|
+
}
|
|
6628
|
+
if (!taskToRun.setupValue && taskToRun.taskSetup) {
|
|
6629
|
+
taskToRun.setupValue = await taskToRun.taskSetup();
|
|
6630
|
+
}
|
|
6631
|
+
if (taskToRun.execDelay) {
|
|
6632
|
+
await dist_ts_exports2.delayFor(taskToRun.execDelay);
|
|
6633
|
+
}
|
|
6634
|
+
taskToRun.running = true;
|
|
6635
|
+
done.promise.then(async () => {
|
|
6636
|
+
taskToRun.running = false;
|
|
6637
|
+
taskToRun.resolveFinished();
|
|
6638
|
+
taskToRun.finished = new Promise((resolve) => {
|
|
6639
|
+
taskToRun.resolveFinished = resolve;
|
|
6640
|
+
});
|
|
6641
|
+
});
|
|
6642
|
+
const options = {
|
|
6643
|
+
...{ x: void 0, touchedTasksArray: [] },
|
|
6644
|
+
...optionsArg
|
|
6645
|
+
};
|
|
6646
|
+
const x = options.x;
|
|
6647
|
+
const touchedTasksArray = options.touchedTasksArray;
|
|
6648
|
+
touchedTasksArray.push(taskToRun);
|
|
6649
|
+
const localDeferred = dist_ts_exports.defer();
|
|
6650
|
+
localDeferred.promise.then(() => {
|
|
6651
|
+
if (taskToRun.preTask && !_Task.isTaskTouched(taskToRun.preTask, touchedTasksArray)) {
|
|
6652
|
+
return _Task.runTask(taskToRun.preTask, { x, touchedTasksArray });
|
|
6653
|
+
} else {
|
|
6654
|
+
const done2 = dist_ts_exports.defer();
|
|
6655
|
+
done2.resolve(x);
|
|
6656
|
+
return done2.promise;
|
|
6657
|
+
}
|
|
6658
|
+
}).then(async (x2) => {
|
|
6659
|
+
try {
|
|
6660
|
+
return await taskToRun.taskFunction(x2, taskToRun.setupValue);
|
|
6661
|
+
} catch (e) {
|
|
6662
|
+
console.log(e);
|
|
6663
|
+
}
|
|
6664
|
+
}).then((x2) => {
|
|
6665
|
+
if (taskToRun.afterTask && !_Task.isTaskTouched(taskToRun.afterTask, touchedTasksArray)) {
|
|
6666
|
+
return _Task.runTask(taskToRun.afterTask, { x: x2, touchedTasksArray });
|
|
6667
|
+
} else {
|
|
6668
|
+
const done2 = dist_ts_exports.defer();
|
|
6669
|
+
done2.resolve(x2);
|
|
6670
|
+
return done2.promise;
|
|
6671
|
+
}
|
|
6672
|
+
}).then((x2) => {
|
|
6673
|
+
done.resolve(x2);
|
|
6674
|
+
}).catch((err) => {
|
|
6675
|
+
console.log(err);
|
|
6676
|
+
});
|
|
6677
|
+
localDeferred.resolve();
|
|
6678
|
+
return await done.promise;
|
|
6679
|
+
};
|
|
6680
|
+
}
|
|
6514
6681
|
get idle() {
|
|
6515
6682
|
return !this.running;
|
|
6516
6683
|
}
|
|
@@ -6528,77 +6695,6 @@ var _Task = class {
|
|
|
6528
6695
|
return this.bufferRunner.trigger(x);
|
|
6529
6696
|
}
|
|
6530
6697
|
};
|
|
6531
|
-
var Task = _Task;
|
|
6532
|
-
Task.emptyTaskFunction = function(x) {
|
|
6533
|
-
const done = dist_ts_exports.defer();
|
|
6534
|
-
done.resolve();
|
|
6535
|
-
return done.promise;
|
|
6536
|
-
};
|
|
6537
|
-
Task.isTask = (taskArg) => {
|
|
6538
|
-
if (taskArg instanceof _Task && typeof taskArg.taskFunction === "function") {
|
|
6539
|
-
return true;
|
|
6540
|
-
} else {
|
|
6541
|
-
return false;
|
|
6542
|
-
}
|
|
6543
|
-
};
|
|
6544
|
-
Task.runTask = async (taskArg, optionsArg) => {
|
|
6545
|
-
const taskToRun = _Task.extractTask(taskArg);
|
|
6546
|
-
const done = dist_ts_exports.defer();
|
|
6547
|
-
for (const task of taskToRun.blockingTasks) {
|
|
6548
|
-
await task.finished;
|
|
6549
|
-
}
|
|
6550
|
-
if (!taskToRun.setupValue && taskToRun.taskSetup) {
|
|
6551
|
-
taskToRun.setupValue = await taskToRun.taskSetup();
|
|
6552
|
-
}
|
|
6553
|
-
if (taskToRun.execDelay) {
|
|
6554
|
-
await dist_ts_exports2.delayFor(taskToRun.execDelay);
|
|
6555
|
-
}
|
|
6556
|
-
taskToRun.running = true;
|
|
6557
|
-
done.promise.then(async () => {
|
|
6558
|
-
taskToRun.running = false;
|
|
6559
|
-
taskToRun.resolveFinished();
|
|
6560
|
-
taskToRun.finished = new Promise((resolve) => {
|
|
6561
|
-
taskToRun.resolveFinished = resolve;
|
|
6562
|
-
});
|
|
6563
|
-
});
|
|
6564
|
-
const options = {
|
|
6565
|
-
...{ x: void 0, touchedTasksArray: [] },
|
|
6566
|
-
...optionsArg
|
|
6567
|
-
};
|
|
6568
|
-
const x = options.x;
|
|
6569
|
-
const touchedTasksArray = options.touchedTasksArray;
|
|
6570
|
-
touchedTasksArray.push(taskToRun);
|
|
6571
|
-
const localDeferred = dist_ts_exports.defer();
|
|
6572
|
-
localDeferred.promise.then(() => {
|
|
6573
|
-
if (taskToRun.preTask && !_Task.isTaskTouched(taskToRun.preTask, touchedTasksArray)) {
|
|
6574
|
-
return _Task.runTask(taskToRun.preTask, { x, touchedTasksArray });
|
|
6575
|
-
} else {
|
|
6576
|
-
const done2 = dist_ts_exports.defer();
|
|
6577
|
-
done2.resolve(x);
|
|
6578
|
-
return done2.promise;
|
|
6579
|
-
}
|
|
6580
|
-
}).then(async (x2) => {
|
|
6581
|
-
try {
|
|
6582
|
-
return await taskToRun.taskFunction(x2, taskToRun.setupValue);
|
|
6583
|
-
} catch (e) {
|
|
6584
|
-
console.log(e);
|
|
6585
|
-
}
|
|
6586
|
-
}).then((x2) => {
|
|
6587
|
-
if (taskToRun.afterTask && !_Task.isTaskTouched(taskToRun.afterTask, touchedTasksArray)) {
|
|
6588
|
-
return _Task.runTask(taskToRun.afterTask, { x: x2, touchedTasksArray });
|
|
6589
|
-
} else {
|
|
6590
|
-
const done2 = dist_ts_exports.defer();
|
|
6591
|
-
done2.resolve(x2);
|
|
6592
|
-
return done2.promise;
|
|
6593
|
-
}
|
|
6594
|
-
}).then((x2) => {
|
|
6595
|
-
done.resolve(x2);
|
|
6596
|
-
}).catch((err) => {
|
|
6597
|
-
console.log(err);
|
|
6598
|
-
});
|
|
6599
|
-
localDeferred.resolve();
|
|
6600
|
-
return await done.promise;
|
|
6601
|
-
};
|
|
6602
6698
|
|
|
6603
6699
|
// ts/taskbuffer.classes.taskchain.ts
|
|
6604
6700
|
var Taskchain = class extends Task {
|