@tachybase/module-backup 1.3.18 → 1.3.19
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/client/cron-jobs-table/AutoBackupTable.schema.d.ts +2 -3
- package/dist/client/index.js +2 -2
- package/dist/externalVersion.js +7 -7
- package/dist/node_modules/@hapi/topo/package.json +1 -1
- package/dist/node_modules/archiver/package.json +1 -1
- package/dist/node_modules/cron-parser/LICENSE +1 -1
- package/dist/node_modules/cron-parser/lib/date.js +252 -0
- package/dist/node_modules/cron-parser/lib/expression.js +1002 -0
- package/dist/node_modules/cron-parser/lib/field_compactor.js +70 -0
- package/dist/node_modules/cron-parser/lib/field_stringify.js +58 -0
- package/dist/node_modules/cron-parser/lib/parser.js +1 -0
- package/dist/node_modules/cron-parser/package.json +1 -1
- package/dist/node_modules/cron-parser/types/common.d.ts +131 -0
- package/dist/node_modules/cron-parser/types/index.d.ts +45 -0
- package/dist/node_modules/cron-parser/types/ts3/index.d.ts +28 -0
- package/dist/node_modules/mkdirp/package.json +1 -1
- package/dist/node_modules/semver/package.json +1 -1
- package/dist/node_modules/yauzl/package.json +1 -1
- package/dist/server/server.d.ts +1 -1
- package/package.json +11 -11
- package/dist/node_modules/cron-parser/dist/CronDate.js +0 -497
- package/dist/node_modules/cron-parser/dist/CronExpression.js +0 -376
- package/dist/node_modules/cron-parser/dist/CronExpressionParser.js +0 -384
- package/dist/node_modules/cron-parser/dist/CronFieldCollection.js +0 -371
- package/dist/node_modules/cron-parser/dist/CronFileParser.js +0 -109
- package/dist/node_modules/cron-parser/dist/fields/CronDayOfMonth.js +0 -44
- package/dist/node_modules/cron-parser/dist/fields/CronDayOfWeek.js +0 -51
- package/dist/node_modules/cron-parser/dist/fields/CronField.js +0 -183
- package/dist/node_modules/cron-parser/dist/fields/CronHour.js +0 -40
- package/dist/node_modules/cron-parser/dist/fields/CronMinute.js +0 -40
- package/dist/node_modules/cron-parser/dist/fields/CronMonth.js +0 -44
- package/dist/node_modules/cron-parser/dist/fields/CronSecond.js +0 -40
- package/dist/node_modules/cron-parser/dist/fields/index.js +0 -24
- package/dist/node_modules/cron-parser/dist/fields/types.js +0 -2
- package/dist/node_modules/cron-parser/dist/index.js +0 -1
- package/dist/node_modules/cron-parser/dist/types/CronDate.d.ts +0 -273
- package/dist/node_modules/cron-parser/dist/types/CronExpression.d.ts +0 -110
- package/dist/node_modules/cron-parser/dist/types/CronExpressionParser.d.ts +0 -70
- package/dist/node_modules/cron-parser/dist/types/CronFieldCollection.d.ts +0 -153
- package/dist/node_modules/cron-parser/dist/types/CronFileParser.d.ts +0 -30
- package/dist/node_modules/cron-parser/dist/types/fields/CronDayOfMonth.d.ts +0 -25
- package/dist/node_modules/cron-parser/dist/types/fields/CronDayOfWeek.d.ts +0 -30
- package/dist/node_modules/cron-parser/dist/types/fields/CronField.d.ts +0 -114
- package/dist/node_modules/cron-parser/dist/types/fields/CronHour.d.ts +0 -23
- package/dist/node_modules/cron-parser/dist/types/fields/CronMinute.d.ts +0 -23
- package/dist/node_modules/cron-parser/dist/types/fields/CronMonth.d.ts +0 -24
- package/dist/node_modules/cron-parser/dist/types/fields/CronSecond.d.ts +0 -23
- package/dist/node_modules/cron-parser/dist/types/fields/index.d.ts +0 -8
- package/dist/node_modules/cron-parser/dist/types/fields/types.d.ts +0 -18
- package/dist/node_modules/cron-parser/dist/types/index.d.ts +0 -8
- package/dist/node_modules/cron-parser/dist/types/utils/random.d.ts +0 -10
- package/dist/node_modules/cron-parser/dist/utils/random.js +0 -38
|
@@ -1,376 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CronExpression = void 0;
|
|
4
|
-
const CronDate_1 = require("./CronDate");
|
|
5
|
-
/**
|
|
6
|
-
* Cron iteration loop safety limit
|
|
7
|
-
*/
|
|
8
|
-
const LOOP_LIMIT = 10000;
|
|
9
|
-
/**
|
|
10
|
-
* Class representing a Cron expression.
|
|
11
|
-
*/
|
|
12
|
-
class CronExpression {
|
|
13
|
-
#options;
|
|
14
|
-
#tz;
|
|
15
|
-
#currentDate;
|
|
16
|
-
#startDate;
|
|
17
|
-
#endDate;
|
|
18
|
-
#fields;
|
|
19
|
-
/**
|
|
20
|
-
* Creates a new CronExpression instance.
|
|
21
|
-
*
|
|
22
|
-
* @param {CronFieldCollection} fields - Cron fields.
|
|
23
|
-
* @param {CronExpressionOptions} options - Parser options.
|
|
24
|
-
*/
|
|
25
|
-
constructor(fields, options) {
|
|
26
|
-
this.#options = options;
|
|
27
|
-
this.#tz = options.tz;
|
|
28
|
-
this.#currentDate = new CronDate_1.CronDate(options.currentDate, this.#tz);
|
|
29
|
-
this.#startDate = options.startDate ? new CronDate_1.CronDate(options.startDate, this.#tz) : null;
|
|
30
|
-
this.#endDate = options.endDate ? new CronDate_1.CronDate(options.endDate, this.#tz) : null;
|
|
31
|
-
this.#fields = fields;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Getter for the cron fields.
|
|
35
|
-
*
|
|
36
|
-
* @returns {CronFieldCollection} Cron fields.
|
|
37
|
-
*/
|
|
38
|
-
get fields() {
|
|
39
|
-
return this.#fields;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Converts cron fields back to a CronExpression instance.
|
|
43
|
-
*
|
|
44
|
-
* @public
|
|
45
|
-
* @param {Record<string, number[]>} fields - The input cron fields object.
|
|
46
|
-
* @param {CronExpressionOptions} [options] - Optional parsing options.
|
|
47
|
-
* @returns {CronExpression} - A new CronExpression instance.
|
|
48
|
-
*/
|
|
49
|
-
static fieldsToExpression(fields, options) {
|
|
50
|
-
return new CronExpression(fields, options || {});
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Checks if the given value matches any element in the sequence.
|
|
54
|
-
*
|
|
55
|
-
* @param {number} value - The value to be matched.
|
|
56
|
-
* @param {number[]} sequence - The sequence to be checked against.
|
|
57
|
-
* @returns {boolean} - True if the value matches an element in the sequence; otherwise, false.
|
|
58
|
-
* @memberof CronExpression
|
|
59
|
-
* @private
|
|
60
|
-
*/
|
|
61
|
-
static #matchSchedule(value, sequence) {
|
|
62
|
-
return sequence.some((element) => element === value);
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Determines if the current date matches the last specified weekday of the month.
|
|
66
|
-
*
|
|
67
|
-
* @param {Array<(number|string)>} expressions - An array of expressions containing weekdays and "L" for the last weekday.
|
|
68
|
-
* @param {CronDate} currentDate - The current date object.
|
|
69
|
-
* @returns {boolean} - True if the current date matches the last specified weekday of the month; otherwise, false.
|
|
70
|
-
* @memberof CronExpression
|
|
71
|
-
* @private
|
|
72
|
-
*/
|
|
73
|
-
static #isLastWeekdayOfMonthMatch(expressions, currentDate) {
|
|
74
|
-
const isLastWeekdayOfMonth = currentDate.isLastWeekdayOfMonth();
|
|
75
|
-
return expressions.some((expression) => {
|
|
76
|
-
// The first character represents the weekday
|
|
77
|
-
const weekday = parseInt(expression.toString().charAt(0), 10) % 7;
|
|
78
|
-
if (Number.isNaN(weekday)) {
|
|
79
|
-
throw new Error(`Invalid last weekday of the month expression: ${expression}`);
|
|
80
|
-
}
|
|
81
|
-
// Check if the current date matches the last specified weekday of the month
|
|
82
|
-
return currentDate.getDay() === weekday && isLastWeekdayOfMonth;
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Find the next scheduled date based on the cron expression.
|
|
87
|
-
* @returns {CronDate} - The next scheduled date or an ES6 compatible iterator object.
|
|
88
|
-
* @memberof CronExpression
|
|
89
|
-
* @public
|
|
90
|
-
*/
|
|
91
|
-
next() {
|
|
92
|
-
return this.#findSchedule();
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Find the previous scheduled date based on the cron expression.
|
|
96
|
-
* @returns {CronDate} - The previous scheduled date or an ES6 compatible iterator object.
|
|
97
|
-
* @memberof CronExpression
|
|
98
|
-
* @public
|
|
99
|
-
*/
|
|
100
|
-
prev() {
|
|
101
|
-
return this.#findSchedule(true);
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Check if there is a next scheduled date based on the current date and cron expression.
|
|
105
|
-
* @returns {boolean} - Returns true if there is a next scheduled date, false otherwise.
|
|
106
|
-
* @memberof CronExpression
|
|
107
|
-
* @public
|
|
108
|
-
*/
|
|
109
|
-
hasNext() {
|
|
110
|
-
const current = this.#currentDate;
|
|
111
|
-
try {
|
|
112
|
-
this.#findSchedule();
|
|
113
|
-
return true;
|
|
114
|
-
}
|
|
115
|
-
catch {
|
|
116
|
-
return false;
|
|
117
|
-
}
|
|
118
|
-
finally {
|
|
119
|
-
this.#currentDate = current;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Check if there is a previous scheduled date based on the current date and cron expression.
|
|
124
|
-
* @returns {boolean} - Returns true if there is a previous scheduled date, false otherwise.
|
|
125
|
-
* @memberof CronExpression
|
|
126
|
-
* @public
|
|
127
|
-
*/
|
|
128
|
-
hasPrev() {
|
|
129
|
-
const current = this.#currentDate;
|
|
130
|
-
try {
|
|
131
|
-
this.#findSchedule(true);
|
|
132
|
-
return true;
|
|
133
|
-
}
|
|
134
|
-
catch {
|
|
135
|
-
return false;
|
|
136
|
-
}
|
|
137
|
-
finally {
|
|
138
|
-
this.#currentDate = current;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
/**
|
|
142
|
-
* Iterate over a specified number of steps and optionally execute a callback function for each step.
|
|
143
|
-
* @param {number} steps - The number of steps to iterate. Positive value iterates forward, negative value iterates backward.
|
|
144
|
-
* @returns {CronDate[]} - An array of iterator fields or CronDate objects.
|
|
145
|
-
* @memberof CronExpression
|
|
146
|
-
* @public
|
|
147
|
-
*/
|
|
148
|
-
take(limit) {
|
|
149
|
-
const items = [];
|
|
150
|
-
if (limit >= 0) {
|
|
151
|
-
for (let i = 0; i < limit; i++) {
|
|
152
|
-
try {
|
|
153
|
-
items.push(this.next());
|
|
154
|
-
}
|
|
155
|
-
catch {
|
|
156
|
-
return items;
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
else {
|
|
161
|
-
for (let i = 0; i > limit; i--) {
|
|
162
|
-
try {
|
|
163
|
-
items.push(this.prev());
|
|
164
|
-
}
|
|
165
|
-
catch {
|
|
166
|
-
return items;
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
return items;
|
|
171
|
-
}
|
|
172
|
-
/**
|
|
173
|
-
* Reset the iterators current date to a new date or the initial date.
|
|
174
|
-
* @param {Date | CronDate} [newDate] - Optional new date to reset to. If not provided, it will reset to the initial date.
|
|
175
|
-
* @memberof CronExpression
|
|
176
|
-
* @public
|
|
177
|
-
*/
|
|
178
|
-
reset(newDate) {
|
|
179
|
-
this.#currentDate = new CronDate_1.CronDate(newDate || this.#options.currentDate);
|
|
180
|
-
}
|
|
181
|
-
/**
|
|
182
|
-
* Generate a string representation of the cron expression.
|
|
183
|
-
* @param {boolean} [includeSeconds=false] - Whether to include the seconds field in the string representation.
|
|
184
|
-
* @returns {string} - The string representation of the cron expression.
|
|
185
|
-
* @memberof CronExpression
|
|
186
|
-
* @public
|
|
187
|
-
*/
|
|
188
|
-
stringify(includeSeconds = false) {
|
|
189
|
-
return this.#fields.stringify(includeSeconds);
|
|
190
|
-
}
|
|
191
|
-
/**
|
|
192
|
-
* Check if the cron expression includes the given date
|
|
193
|
-
* @param {Date|CronDate} date
|
|
194
|
-
* @returns {boolean}
|
|
195
|
-
*/
|
|
196
|
-
includesDate(date) {
|
|
197
|
-
const { second, minute, hour, month } = this.#fields;
|
|
198
|
-
const dt = new CronDate_1.CronDate(date, this.#tz);
|
|
199
|
-
// Check basic time fields first
|
|
200
|
-
if (!second.values.includes(dt.getSeconds()) ||
|
|
201
|
-
!minute.values.includes(dt.getMinutes()) ||
|
|
202
|
-
!hour.values.includes(dt.getHours()) ||
|
|
203
|
-
!month.values.includes((dt.getMonth() + 1))) {
|
|
204
|
-
return false;
|
|
205
|
-
}
|
|
206
|
-
// Check day of month and day of week using the same logic as #findSchedule
|
|
207
|
-
if (!this.#matchDayOfMonth(dt)) {
|
|
208
|
-
return false;
|
|
209
|
-
}
|
|
210
|
-
// Check nth day of week if specified
|
|
211
|
-
if (this.#fields.dayOfWeek.nthDay > 0) {
|
|
212
|
-
const weekInMonth = Math.ceil(dt.getDate() / 7);
|
|
213
|
-
if (weekInMonth !== this.#fields.dayOfWeek.nthDay) {
|
|
214
|
-
return false;
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
return true;
|
|
218
|
-
}
|
|
219
|
-
/**
|
|
220
|
-
* Returns the string representation of the cron expression.
|
|
221
|
-
* @returns {CronDate} - The next schedule date.
|
|
222
|
-
*/
|
|
223
|
-
toString() {
|
|
224
|
-
/* istanbul ignore next - should be impossible under normal use to trigger the or branch */
|
|
225
|
-
return this.#options.expression || this.stringify(true);
|
|
226
|
-
}
|
|
227
|
-
/**
|
|
228
|
-
* Determines if the given date matches the cron expression's day of month and day of week fields.
|
|
229
|
-
*
|
|
230
|
-
* The function checks the following rules:
|
|
231
|
-
* Rule 1: If both "day of month" and "day of week" are restricted (not wildcard), then one or both must match the current day.
|
|
232
|
-
* Rule 2: If "day of month" is restricted and "day of week" is not restricted, then "day of month" must match the current day.
|
|
233
|
-
* Rule 3: If "day of month" is a wildcard, "day of week" is not a wildcard, and "day of week" matches the current day, then the match is accepted.
|
|
234
|
-
* If none of the rules match, the match is rejected.
|
|
235
|
-
*
|
|
236
|
-
* @param {CronDate} currentDate - The current date to be evaluated against the cron expression.
|
|
237
|
-
* @returns {boolean} Returns true if the current date matches the cron expression's day of month and day of week fields, otherwise false.
|
|
238
|
-
* @memberof CronExpression
|
|
239
|
-
* @private
|
|
240
|
-
*/
|
|
241
|
-
#matchDayOfMonth(currentDate) {
|
|
242
|
-
// Check if day of month and day of week fields are wildcards or restricted (not wildcard).
|
|
243
|
-
const isDayOfMonthWildcardMatch = this.#fields.dayOfMonth.isWildcard;
|
|
244
|
-
const isRestrictedDayOfMonth = !isDayOfMonthWildcardMatch;
|
|
245
|
-
const isDayOfWeekWildcardMatch = this.#fields.dayOfWeek.isWildcard;
|
|
246
|
-
const isRestrictedDayOfWeek = !isDayOfWeekWildcardMatch;
|
|
247
|
-
// Calculate if the current date matches the day of month and day of week fields.
|
|
248
|
-
const matchedDOM = CronExpression.#matchSchedule(currentDate.getDate(), this.#fields.dayOfMonth.values) ||
|
|
249
|
-
(this.#fields.dayOfMonth.hasLastChar && currentDate.isLastDayOfMonth());
|
|
250
|
-
const matchedDOW = CronExpression.#matchSchedule(currentDate.getDay(), this.#fields.dayOfWeek.values) ||
|
|
251
|
-
(this.#fields.dayOfWeek.hasLastChar &&
|
|
252
|
-
CronExpression.#isLastWeekdayOfMonthMatch(this.#fields.dayOfWeek.values, currentDate));
|
|
253
|
-
// Rule 1: Both "day of month" and "day of week" are restricted; one or both must match the current day.
|
|
254
|
-
if (isRestrictedDayOfMonth && isRestrictedDayOfWeek && (matchedDOM || matchedDOW)) {
|
|
255
|
-
return true;
|
|
256
|
-
}
|
|
257
|
-
// Rule 2: "day of month" restricted and "day of week" not restricted; "day of month" must match the current day.
|
|
258
|
-
if (matchedDOM && !isRestrictedDayOfWeek) {
|
|
259
|
-
return true;
|
|
260
|
-
}
|
|
261
|
-
// Rule 3: "day of month" is a wildcard, "day of week" is not a wildcard, and "day of week" matches the current day.
|
|
262
|
-
if (isDayOfMonthWildcardMatch && !isDayOfWeekWildcardMatch && matchedDOW) {
|
|
263
|
-
return true;
|
|
264
|
-
}
|
|
265
|
-
// If none of the rules match, the match is rejected.
|
|
266
|
-
return false;
|
|
267
|
-
}
|
|
268
|
-
/**
|
|
269
|
-
* Determines if the current hour matches the cron expression.
|
|
270
|
-
*
|
|
271
|
-
* @param {CronDate} currentDate - The current date object.
|
|
272
|
-
* @param {DateMathOp} dateMathVerb - The date math operation enumeration value.
|
|
273
|
-
* @param {boolean} reverse - A flag indicating whether the matching should be done in reverse order.
|
|
274
|
-
* @returns {boolean} - True if the current hour matches the cron expression; otherwise, false.
|
|
275
|
-
*/
|
|
276
|
-
#matchHour(currentDate, dateMathVerb, reverse) {
|
|
277
|
-
const currentHour = currentDate.getHours();
|
|
278
|
-
const isMatch = CronExpression.#matchSchedule(currentHour, this.#fields.hour.values);
|
|
279
|
-
const isDstStart = currentDate.dstStart === currentHour;
|
|
280
|
-
const isDstEnd = currentDate.dstEnd === currentHour;
|
|
281
|
-
if (!isMatch && !isDstStart) {
|
|
282
|
-
currentDate.dstStart = null;
|
|
283
|
-
currentDate.applyDateOperation(dateMathVerb, CronDate_1.TimeUnit.Hour, this.#fields.hour.values.length);
|
|
284
|
-
return false;
|
|
285
|
-
}
|
|
286
|
-
if (isDstStart && !CronExpression.#matchSchedule(currentHour - 1, this.#fields.hour.values)) {
|
|
287
|
-
currentDate.invokeDateOperation(dateMathVerb, CronDate_1.TimeUnit.Hour);
|
|
288
|
-
return false;
|
|
289
|
-
}
|
|
290
|
-
if (isDstEnd && !reverse) {
|
|
291
|
-
currentDate.dstEnd = null;
|
|
292
|
-
currentDate.applyDateOperation(CronDate_1.DateMathOp.Add, CronDate_1.TimeUnit.Hour, this.#fields.hour.values.length);
|
|
293
|
-
return false;
|
|
294
|
-
}
|
|
295
|
-
return true;
|
|
296
|
-
}
|
|
297
|
-
/**
|
|
298
|
-
* Finds the next or previous schedule based on the cron expression.
|
|
299
|
-
*
|
|
300
|
-
* @param {boolean} [reverse=false] - If true, finds the previous schedule; otherwise, finds the next schedule.
|
|
301
|
-
* @returns {CronDate} - The next or previous schedule date.
|
|
302
|
-
* @private
|
|
303
|
-
*/
|
|
304
|
-
#findSchedule(reverse = false) {
|
|
305
|
-
const dateMathVerb = reverse ? CronDate_1.DateMathOp.Subtract : CronDate_1.DateMathOp.Add;
|
|
306
|
-
const currentDate = new CronDate_1.CronDate(this.#currentDate);
|
|
307
|
-
const startDate = this.#startDate;
|
|
308
|
-
const endDate = this.#endDate;
|
|
309
|
-
const startTimestamp = currentDate.getTime();
|
|
310
|
-
let stepCount = 0;
|
|
311
|
-
while (stepCount++ < LOOP_LIMIT) {
|
|
312
|
-
/* istanbul ignore next - should be impossible under normal use to trigger the branch */
|
|
313
|
-
if (stepCount > LOOP_LIMIT) {
|
|
314
|
-
throw new Error('Invalid expression, loop limit exceeded');
|
|
315
|
-
}
|
|
316
|
-
if (reverse && startDate && startDate.getTime() > currentDate.getTime()) {
|
|
317
|
-
throw new Error('Out of the timespan range');
|
|
318
|
-
}
|
|
319
|
-
if (!reverse && endDate && currentDate.getTime() > endDate.getTime()) {
|
|
320
|
-
throw new Error('Out of the timespan range');
|
|
321
|
-
}
|
|
322
|
-
if (!this.#matchDayOfMonth(currentDate)) {
|
|
323
|
-
currentDate.applyDateOperation(dateMathVerb, CronDate_1.TimeUnit.Day, this.#fields.hour.values.length);
|
|
324
|
-
continue;
|
|
325
|
-
}
|
|
326
|
-
if (!(this.#fields.dayOfWeek.nthDay <= 0 || Math.ceil(currentDate.getDate() / 7) === this.#fields.dayOfWeek.nthDay)) {
|
|
327
|
-
currentDate.applyDateOperation(dateMathVerb, CronDate_1.TimeUnit.Day, this.#fields.hour.values.length);
|
|
328
|
-
continue;
|
|
329
|
-
}
|
|
330
|
-
if (!CronExpression.#matchSchedule(currentDate.getMonth() + 1, this.#fields.month.values)) {
|
|
331
|
-
currentDate.applyDateOperation(dateMathVerb, CronDate_1.TimeUnit.Month, this.#fields.hour.values.length);
|
|
332
|
-
continue;
|
|
333
|
-
}
|
|
334
|
-
if (!this.#matchHour(currentDate, dateMathVerb, reverse)) {
|
|
335
|
-
continue;
|
|
336
|
-
}
|
|
337
|
-
if (!CronExpression.#matchSchedule(currentDate.getMinutes(), this.#fields.minute.values)) {
|
|
338
|
-
currentDate.applyDateOperation(dateMathVerb, CronDate_1.TimeUnit.Minute, this.#fields.hour.values.length);
|
|
339
|
-
continue;
|
|
340
|
-
}
|
|
341
|
-
if (!CronExpression.#matchSchedule(currentDate.getSeconds(), this.#fields.second.values)) {
|
|
342
|
-
currentDate.applyDateOperation(dateMathVerb, CronDate_1.TimeUnit.Second, this.#fields.hour.values.length);
|
|
343
|
-
continue;
|
|
344
|
-
}
|
|
345
|
-
if (startTimestamp === currentDate.getTime()) {
|
|
346
|
-
if (dateMathVerb === 'Add' || currentDate.getMilliseconds() === 0) {
|
|
347
|
-
currentDate.applyDateOperation(dateMathVerb, CronDate_1.TimeUnit.Second, this.#fields.hour.values.length);
|
|
348
|
-
}
|
|
349
|
-
continue;
|
|
350
|
-
}
|
|
351
|
-
break;
|
|
352
|
-
}
|
|
353
|
-
if (currentDate.getMilliseconds() !== 0) {
|
|
354
|
-
currentDate.setMilliseconds(0);
|
|
355
|
-
}
|
|
356
|
-
this.#currentDate = currentDate;
|
|
357
|
-
return currentDate;
|
|
358
|
-
}
|
|
359
|
-
/**
|
|
360
|
-
* Returns an iterator for iterating through future CronDate instances
|
|
361
|
-
*
|
|
362
|
-
* @name Symbol.iterator
|
|
363
|
-
* @memberof CronExpression
|
|
364
|
-
* @returns {Iterator<CronDate>} An iterator object for CronExpression that returns CronDate values.
|
|
365
|
-
*/
|
|
366
|
-
[Symbol.iterator]() {
|
|
367
|
-
return {
|
|
368
|
-
next: () => {
|
|
369
|
-
const schedule = this.#findSchedule();
|
|
370
|
-
return { value: schedule, done: !this.hasNext() };
|
|
371
|
-
},
|
|
372
|
-
};
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
exports.CronExpression = CronExpression;
|
|
376
|
-
exports.default = CronExpression;
|