croner 9.0.0-dev.2 → 9.0.0-dev.3
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/croner.cjs +10 -1
- package/dist/croner.d.cts +7 -3
- package/dist/croner.d.ts +7 -3
- package/dist/croner.js +10 -1
- package/dist/croner.umd.js +10 -1
- package/package.json +1 -1
package/dist/croner.cjs
CHANGED
|
@@ -145,7 +145,7 @@ var CronPattern = class {
|
|
|
145
145
|
* @private
|
|
146
146
|
*/
|
|
147
147
|
parse() {
|
|
148
|
-
if (!(typeof this.pattern === "string")) {
|
|
148
|
+
if (!(typeof this.pattern === "string" || this.pattern instanceof String)) {
|
|
149
149
|
throw new TypeError("CronPattern: Pattern has to be of type string.");
|
|
150
150
|
}
|
|
151
151
|
if (this.pattern.indexOf("@") >= 0) this.pattern = this.handleNicknames(this.pattern).trim();
|
|
@@ -371,6 +371,9 @@ var CronPattern = class {
|
|
|
371
371
|
if (split.length !== 2) {
|
|
372
372
|
throw new TypeError("CronPattern: Syntax error, illegal stepping: '" + conf + "'");
|
|
373
373
|
}
|
|
374
|
+
if (split[0] === "") {
|
|
375
|
+
split[0] = "*";
|
|
376
|
+
}
|
|
374
377
|
let start = 0;
|
|
375
378
|
if (split[0] !== "*") {
|
|
376
379
|
start = parseInt(split[0], 10) + valueIndexOffset;
|
|
@@ -1092,6 +1095,12 @@ var Cron = class {
|
|
|
1092
1095
|
async trigger() {
|
|
1093
1096
|
await this._trigger();
|
|
1094
1097
|
}
|
|
1098
|
+
/**
|
|
1099
|
+
* Returns number of runs left, undefined = unlimited
|
|
1100
|
+
*/
|
|
1101
|
+
runsLeft() {
|
|
1102
|
+
return this._states.maxRuns;
|
|
1103
|
+
}
|
|
1095
1104
|
/**
|
|
1096
1105
|
* Called when it's time to trigger.
|
|
1097
1106
|
* Checks if all conditions are currently met,
|
package/dist/croner.d.cts
CHANGED
|
@@ -240,7 +240,7 @@ declare module "date" {
|
|
|
240
240
|
* Current full year, in local time or target timezone specified by `this.tz`
|
|
241
241
|
*/
|
|
242
242
|
year: number;
|
|
243
|
-
constructor(d?: CronDate | Date | string, tz?: string | number);
|
|
243
|
+
constructor(d?: CronDate | Date | string | null, tz?: string | number);
|
|
244
244
|
/**
|
|
245
245
|
* Check if the given date is the nth occurrence of a weekday in its month.
|
|
246
246
|
*
|
|
@@ -354,7 +354,7 @@ declare module "croner" {
|
|
|
354
354
|
* @param prev - Date to start from
|
|
355
355
|
* @returns Next run time
|
|
356
356
|
*/
|
|
357
|
-
nextRun(prev?: CronDate | Date | string): Date | null;
|
|
357
|
+
nextRun(prev?: CronDate | Date | string | null): Date | null;
|
|
358
358
|
/**
|
|
359
359
|
* Find next n runs, based on supplied date. Strips milliseconds.
|
|
360
360
|
*
|
|
@@ -362,7 +362,7 @@ declare module "croner" {
|
|
|
362
362
|
* @param previous - Date to start from
|
|
363
363
|
* @returns - Next n run times
|
|
364
364
|
*/
|
|
365
|
-
nextRuns(n: number, previous
|
|
365
|
+
nextRuns(n: number, previous?: Date | string): Date[];
|
|
366
366
|
/**
|
|
367
367
|
* Return the original pattern, if there was one
|
|
368
368
|
*
|
|
@@ -438,6 +438,10 @@ declare module "croner" {
|
|
|
438
438
|
* Trigger a run manually
|
|
439
439
|
*/
|
|
440
440
|
trigger(): Promise<void>;
|
|
441
|
+
/**
|
|
442
|
+
* Returns number of runs left, undefined = unlimited
|
|
443
|
+
*/
|
|
444
|
+
runsLeft(): number | undefined;
|
|
441
445
|
/**
|
|
442
446
|
* Called when it's time to trigger.
|
|
443
447
|
* Checks if all conditions are currently met,
|
package/dist/croner.d.ts
CHANGED
|
@@ -240,7 +240,7 @@ declare module "date" {
|
|
|
240
240
|
* Current full year, in local time or target timezone specified by `this.tz`
|
|
241
241
|
*/
|
|
242
242
|
year: number;
|
|
243
|
-
constructor(d?: CronDate | Date | string, tz?: string | number);
|
|
243
|
+
constructor(d?: CronDate | Date | string | null, tz?: string | number);
|
|
244
244
|
/**
|
|
245
245
|
* Check if the given date is the nth occurrence of a weekday in its month.
|
|
246
246
|
*
|
|
@@ -354,7 +354,7 @@ declare module "croner" {
|
|
|
354
354
|
* @param prev - Date to start from
|
|
355
355
|
* @returns Next run time
|
|
356
356
|
*/
|
|
357
|
-
nextRun(prev?: CronDate | Date | string): Date | null;
|
|
357
|
+
nextRun(prev?: CronDate | Date | string | null): Date | null;
|
|
358
358
|
/**
|
|
359
359
|
* Find next n runs, based on supplied date. Strips milliseconds.
|
|
360
360
|
*
|
|
@@ -362,7 +362,7 @@ declare module "croner" {
|
|
|
362
362
|
* @param previous - Date to start from
|
|
363
363
|
* @returns - Next n run times
|
|
364
364
|
*/
|
|
365
|
-
nextRuns(n: number, previous
|
|
365
|
+
nextRuns(n: number, previous?: Date | string): Date[];
|
|
366
366
|
/**
|
|
367
367
|
* Return the original pattern, if there was one
|
|
368
368
|
*
|
|
@@ -438,6 +438,10 @@ declare module "croner" {
|
|
|
438
438
|
* Trigger a run manually
|
|
439
439
|
*/
|
|
440
440
|
trigger(): Promise<void>;
|
|
441
|
+
/**
|
|
442
|
+
* Returns number of runs left, undefined = unlimited
|
|
443
|
+
*/
|
|
444
|
+
runsLeft(): number | undefined;
|
|
441
445
|
/**
|
|
442
446
|
* Called when it's time to trigger.
|
|
443
447
|
* Checks if all conditions are currently met,
|
package/dist/croner.js
CHANGED
|
@@ -115,7 +115,7 @@ var CronPattern = class {
|
|
|
115
115
|
* @private
|
|
116
116
|
*/
|
|
117
117
|
parse() {
|
|
118
|
-
if (!(typeof this.pattern === "string")) {
|
|
118
|
+
if (!(typeof this.pattern === "string" || this.pattern instanceof String)) {
|
|
119
119
|
throw new TypeError("CronPattern: Pattern has to be of type string.");
|
|
120
120
|
}
|
|
121
121
|
if (this.pattern.indexOf("@") >= 0) this.pattern = this.handleNicknames(this.pattern).trim();
|
|
@@ -341,6 +341,9 @@ var CronPattern = class {
|
|
|
341
341
|
if (split.length !== 2) {
|
|
342
342
|
throw new TypeError("CronPattern: Syntax error, illegal stepping: '" + conf + "'");
|
|
343
343
|
}
|
|
344
|
+
if (split[0] === "") {
|
|
345
|
+
split[0] = "*";
|
|
346
|
+
}
|
|
344
347
|
let start = 0;
|
|
345
348
|
if (split[0] !== "*") {
|
|
346
349
|
start = parseInt(split[0], 10) + valueIndexOffset;
|
|
@@ -1062,6 +1065,12 @@ var Cron = class {
|
|
|
1062
1065
|
async trigger() {
|
|
1063
1066
|
await this._trigger();
|
|
1064
1067
|
}
|
|
1068
|
+
/**
|
|
1069
|
+
* Returns number of runs left, undefined = unlimited
|
|
1070
|
+
*/
|
|
1071
|
+
runsLeft() {
|
|
1072
|
+
return this._states.maxRuns;
|
|
1073
|
+
}
|
|
1065
1074
|
/**
|
|
1066
1075
|
* Called when it's time to trigger.
|
|
1067
1076
|
* Checks if all conditions are currently met,
|
package/dist/croner.umd.js
CHANGED
|
@@ -145,7 +145,7 @@ var base64 = (() => {
|
|
|
145
145
|
* @private
|
|
146
146
|
*/
|
|
147
147
|
parse() {
|
|
148
|
-
if (!(typeof this.pattern === "string")) {
|
|
148
|
+
if (!(typeof this.pattern === "string" || this.pattern instanceof String)) {
|
|
149
149
|
throw new TypeError("CronPattern: Pattern has to be of type string.");
|
|
150
150
|
}
|
|
151
151
|
if (this.pattern.indexOf("@") >= 0) this.pattern = this.handleNicknames(this.pattern).trim();
|
|
@@ -371,6 +371,9 @@ var base64 = (() => {
|
|
|
371
371
|
if (split.length !== 2) {
|
|
372
372
|
throw new TypeError("CronPattern: Syntax error, illegal stepping: '" + conf + "'");
|
|
373
373
|
}
|
|
374
|
+
if (split[0] === "") {
|
|
375
|
+
split[0] = "*";
|
|
376
|
+
}
|
|
374
377
|
let start = 0;
|
|
375
378
|
if (split[0] !== "*") {
|
|
376
379
|
start = parseInt(split[0], 10) + valueIndexOffset;
|
|
@@ -1092,6 +1095,12 @@ var base64 = (() => {
|
|
|
1092
1095
|
async trigger() {
|
|
1093
1096
|
await this._trigger();
|
|
1094
1097
|
}
|
|
1098
|
+
/**
|
|
1099
|
+
* Returns number of runs left, undefined = unlimited
|
|
1100
|
+
*/
|
|
1101
|
+
runsLeft() {
|
|
1102
|
+
return this._states.maxRuns;
|
|
1103
|
+
}
|
|
1095
1104
|
/**
|
|
1096
1105
|
* Called when it's time to trigger.
|
|
1097
1106
|
* Checks if all conditions are currently met,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "croner",
|
|
3
|
-
"version": "9.0.0-dev.
|
|
3
|
+
"version": "9.0.0-dev.3",
|
|
4
4
|
"description": "Trigger functions and/or evaluate cron expressions in JavaScript. No dependencies. Most features. All environments.",
|
|
5
5
|
"author": "Hexagon <github.com/hexagon>",
|
|
6
6
|
"homepage": "https://croner.56k.guru",
|