cron 3.4.0 → 3.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/dist/constants.d.ts +0 -14
- package/dist/constants.js +1 -15
- package/dist/time.d.ts +0 -1
- package/dist/time.js +0 -30
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
## [3.5.0](https://github.com/kelektiv/node-cron/compare/v3.4.0...v3.5.0) (2025-01-10)
|
|
2
|
+
|
|
3
|
+
### ✨ Features
|
|
4
|
+
|
|
5
|
+
* throw instead of silently rewriting invalid cron expressions ([#937](https://github.com/kelektiv/node-cron/issues/937)) ([dcc5b93](https://github.com/kelektiv/node-cron/commit/dcc5b939fb08a806793799019c9f256bd137c33d))
|
|
6
|
+
|
|
7
|
+
### ⚙️ Continuous Integrations
|
|
8
|
+
|
|
9
|
+
* **action:** update step-security/harden-runner action to v2.10.3 ([#943](https://github.com/kelektiv/node-cron/issues/943)) ([cd7ee9f](https://github.com/kelektiv/node-cron/commit/cd7ee9f62fbdd16ec150e9e5aa69d8852f5b3dcb))
|
|
10
|
+
|
|
11
|
+
### ♻️ Chores
|
|
12
|
+
|
|
13
|
+
* **deps:** update dependency [@types](https://github.com/types)/node to v20.17.12 ([2a867f9](https://github.com/kelektiv/node-cron/commit/2a867f9c34c216ac04ce8bce34e0e16578f7dd0c))
|
|
14
|
+
* **deps:** update dependency [@types](https://github.com/types)/node to v22 ([#900](https://github.com/kelektiv/node-cron/issues/900)) ([f7548bd](https://github.com/kelektiv/node-cron/commit/f7548bd3b6981514abd174341b39813d0d6f239a))
|
|
15
|
+
|
|
1
16
|
## [3.4.0](https://github.com/kelektiv/node-cron/compare/v3.3.2...v3.4.0) (2025-01-09)
|
|
2
17
|
|
|
3
18
|
### ✨ Features
|
package/dist/constants.d.ts
CHANGED
|
@@ -6,20 +6,6 @@ export declare const CONSTRAINTS: Readonly<{
|
|
|
6
6
|
readonly month: readonly [1, 12];
|
|
7
7
|
readonly dayOfWeek: readonly [0, 7];
|
|
8
8
|
}>;
|
|
9
|
-
export declare const MONTH_CONSTRAINTS: Readonly<{
|
|
10
|
-
readonly 1: 31;
|
|
11
|
-
readonly 2: 29;
|
|
12
|
-
readonly 3: 31;
|
|
13
|
-
readonly 4: 30;
|
|
14
|
-
readonly 5: 31;
|
|
15
|
-
readonly 6: 30;
|
|
16
|
-
readonly 7: 31;
|
|
17
|
-
readonly 8: 31;
|
|
18
|
-
readonly 9: 30;
|
|
19
|
-
readonly 10: 31;
|
|
20
|
-
readonly 11: 30;
|
|
21
|
-
readonly 12: 31;
|
|
22
|
-
}>;
|
|
23
9
|
export declare const PARSE_DEFAULTS: Readonly<{
|
|
24
10
|
readonly second: "0";
|
|
25
11
|
readonly minute: "*";
|
package/dist/constants.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RE_RANGE = exports.RE_WILDCARDS = exports.PRESETS = exports.TIME_UNITS_LEN = exports.TIME_UNITS = exports.TIME_UNITS_MAP = exports.ALIASES = exports.PARSE_DEFAULTS = exports.
|
|
3
|
+
exports.RE_RANGE = exports.RE_WILDCARDS = exports.PRESETS = exports.TIME_UNITS_LEN = exports.TIME_UNITS = exports.TIME_UNITS_MAP = exports.ALIASES = exports.PARSE_DEFAULTS = exports.CONSTRAINTS = void 0;
|
|
4
4
|
exports.CONSTRAINTS = Object.freeze({
|
|
5
5
|
second: [0, 59],
|
|
6
6
|
minute: [0, 59],
|
|
@@ -9,20 +9,6 @@ exports.CONSTRAINTS = Object.freeze({
|
|
|
9
9
|
month: [1, 12],
|
|
10
10
|
dayOfWeek: [0, 7]
|
|
11
11
|
});
|
|
12
|
-
exports.MONTH_CONSTRAINTS = Object.freeze({
|
|
13
|
-
1: 31,
|
|
14
|
-
2: 29,
|
|
15
|
-
3: 31,
|
|
16
|
-
4: 30,
|
|
17
|
-
5: 31,
|
|
18
|
-
6: 30,
|
|
19
|
-
7: 31,
|
|
20
|
-
8: 31,
|
|
21
|
-
9: 30,
|
|
22
|
-
10: 31,
|
|
23
|
-
11: 30,
|
|
24
|
-
12: 31
|
|
25
|
-
});
|
|
26
12
|
exports.PARSE_DEFAULTS = Object.freeze({
|
|
27
13
|
second: '0',
|
|
28
14
|
minute: '*',
|
package/dist/time.d.ts
CHANGED
|
@@ -14,7 +14,6 @@ export declare class CronTime {
|
|
|
14
14
|
constructor(source: CronJobParams['cronTime'], timeZone?: CronJobParams['timeZone'], utcOffset?: null);
|
|
15
15
|
constructor(source: CronJobParams['cronTime'], timeZone?: null, utcOffset?: CronJobParams['utcOffset']);
|
|
16
16
|
private _getWeekDay;
|
|
17
|
-
private _verifyParse;
|
|
18
17
|
sendAt(): DateTime;
|
|
19
18
|
sendAt(i: number): DateTime[];
|
|
20
19
|
getTimeout(): number;
|
package/dist/time.js
CHANGED
|
@@ -4,7 +4,6 @@ exports.CronTime = void 0;
|
|
|
4
4
|
const luxon_1 = require("luxon");
|
|
5
5
|
const constants_1 = require("./constants");
|
|
6
6
|
const errors_1 = require("./errors");
|
|
7
|
-
const utils_1 = require("./utils");
|
|
8
7
|
class CronTime {
|
|
9
8
|
constructor(source, timeZone, utcOffset) {
|
|
10
9
|
this.realDate = false;
|
|
@@ -35,40 +34,11 @@ class CronTime {
|
|
|
35
34
|
else {
|
|
36
35
|
this.source = source;
|
|
37
36
|
this._parse(this.source);
|
|
38
|
-
this._verifyParse();
|
|
39
37
|
}
|
|
40
38
|
}
|
|
41
39
|
_getWeekDay(date) {
|
|
42
40
|
return date.weekday === 7 ? 0 : date.weekday;
|
|
43
41
|
}
|
|
44
|
-
_verifyParse() {
|
|
45
|
-
const months = (0, utils_1.getRecordKeys)(this.month);
|
|
46
|
-
const daysOfMonth = (0, utils_1.getRecordKeys)(this.dayOfMonth);
|
|
47
|
-
let isOk = false;
|
|
48
|
-
let lastWrongMonth = null;
|
|
49
|
-
for (const m of months) {
|
|
50
|
-
const con = constants_1.MONTH_CONSTRAINTS[m];
|
|
51
|
-
for (const day of daysOfMonth) {
|
|
52
|
-
if (day <= con) {
|
|
53
|
-
isOk = true;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
if (!isOk) {
|
|
57
|
-
lastWrongMonth = m;
|
|
58
|
-
console.warn(`Month '${m}' is limited to '${con}' days.`);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
if (!isOk && lastWrongMonth !== null) {
|
|
62
|
-
const notOkCon = constants_1.MONTH_CONSTRAINTS[lastWrongMonth];
|
|
63
|
-
for (const notOkDay of daysOfMonth) {
|
|
64
|
-
if (notOkDay > notOkCon) {
|
|
65
|
-
delete this.dayOfMonth[notOkDay];
|
|
66
|
-
const fixedDay = (notOkDay % notOkCon);
|
|
67
|
-
this.dayOfMonth[fixedDay] = true;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
42
|
sendAt(i) {
|
|
73
43
|
let date = this.realDate && this.source instanceof luxon_1.DateTime
|
|
74
44
|
? this.source
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cron",
|
|
3
3
|
"description": "Cron jobs for your node",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.5.0",
|
|
5
5
|
"author": "Nick Campbell <nicholas.j.campbell@gmail.com> (https://github.com/ncb000gt)",
|
|
6
6
|
"bugs": {
|
|
7
7
|
"url": "https://github.com/kelektiv/node-cron/issues"
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"@semantic-release/npm": "12.0.1",
|
|
41
41
|
"@semantic-release/release-notes-generator": "14.0.3",
|
|
42
42
|
"@types/jest": "29.5.14",
|
|
43
|
-
"@types/node": "
|
|
43
|
+
"@types/node": "22.10.5",
|
|
44
44
|
"@types/sinon": "17.0.3",
|
|
45
45
|
"chai": "5.1.2",
|
|
46
46
|
"eslint": "8.57.1",
|