cron 3.3.0 → 3.3.2-beta.1

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 CHANGED
@@ -1,3 +1,30 @@
1
+ ## [3.3.2-beta.1](https://github.com/kelektiv/node-cron/compare/v3.3.1...v3.3.2-beta.1) (2024-12-27)
2
+
3
+ ### 🐛 Bug Fixes
4
+
5
+ * attempt to fix [#805](https://github.com/kelektiv/node-cron/issues/805) ([187dbe5](https://github.com/kelektiv/node-cron/commit/187dbe57ada28217b810b231bf57afdfe3a3b394))
6
+
7
+ ### ⚙️ Continuous Integrations
8
+
9
+ * **action:** update marocchino/sticky-pull-request-comment action to v2.9.0 ([#930](https://github.com/kelektiv/node-cron/issues/930)) ([1e7bce9](https://github.com/kelektiv/node-cron/commit/1e7bce9d12a774104f39c1d75b37bdb134e4b270))
10
+ * **renovate:** pin GitHub action digests to semver ([#926](https://github.com/kelektiv/node-cron/issues/926)) ([6541167](https://github.com/kelektiv/node-cron/commit/654116766a299bc5ac5d21a99e2abd7ccc4f43fe))
11
+
12
+ ### ♻️ Chores
13
+
14
+ * **deps:** lock file maintenance ([afad454](https://github.com/kelektiv/node-cron/commit/afad454e5e4f52e3da54965a0e10540e035c4f58))
15
+ * **deps:** lock file maintenance ([b1dbf69](https://github.com/kelektiv/node-cron/commit/b1dbf69104a58022a638d5b68b59f85089fae7c6))
16
+ * **deps:** pin dependencies ([#915](https://github.com/kelektiv/node-cron/issues/915)) ([dfcbd3c](https://github.com/kelektiv/node-cron/commit/dfcbd3cf7d901415bda5b4929566bd4ad527af62))
17
+ * **deps:** update dependency [@commitlint](https://github.com/commitlint)/cli to v19.6.1 ([7999427](https://github.com/kelektiv/node-cron/commit/799942794b6cff0966fe4977260728c4f9721385))
18
+ * **deps:** update dependency [@semantic-release](https://github.com/semantic-release)/release-notes-generator to v14.0.2 ([93c9373](https://github.com/kelektiv/node-cron/commit/93c9373ae020e535683d6c65bff9e1eeabe20d4a))
19
+ * **deps:** update dependency [@types](https://github.com/types)/node to v20.17.10 ([9313ffd](https://github.com/kelektiv/node-cron/commit/9313ffd148e88d68251b13e3b7ec5028d372a9d2))
20
+ * **deps:** update dependency lint-staged to v15.2.11 ([100c9ff](https://github.com/kelektiv/node-cron/commit/100c9ff2f67246b73e6cf053aa581e87a31aed0a))
21
+
22
+ ## [3.3.1](https://github.com/kelektiv/node-cron/compare/v3.3.0...v3.3.1) (2024-12-12)
23
+
24
+ ### 🐛 Bug Fixes
25
+
26
+ * correct waitForCompletion behavior ([#924](https://github.com/kelektiv/node-cron/issues/924)) ([f6270f8](https://github.com/kelektiv/node-cron/commit/f6270f869d1d472c276f3e153d491f964ba6a4ec)), closes [#923](https://github.com/kelektiv/node-cron/issues/923) [#923](https://github.com/kelektiv/node-cron/issues/923) [#894](https://github.com/kelektiv/node-cron/issues/894)
27
+
1
28
  ## [3.3.0](https://github.com/kelektiv/node-cron/compare/v3.2.1...v3.3.0) (2024-12-10)
2
29
 
3
30
  ### ✨ Features
package/README.md CHANGED
@@ -6,6 +6,11 @@
6
6
  Perfect for tasks like data backups, notifications, and many more!
7
7
  </p>
8
8
 
9
+ > **⚠️ WARNING**
10
+ >
11
+ > This is a WIP released as beta for testing purposes.
12
+ > For more information, please refer to [issue #805](https://github.com/kelektiv/node-cron/issues/805).
13
+
9
14
  # Cron for Node.js
10
15
 
11
16
  [![Version](https://img.shields.io/npm/v/cron?label=version&logo=npm)](https://www.npmjs.com/package/cron)
package/dist/job.js CHANGED
@@ -107,7 +107,7 @@ class CronJob {
107
107
  }
108
108
  fireOnTick() {
109
109
  return __awaiter(this, void 0, void 0, function* () {
110
- if (!this.waitForCompletion && this._isCallbackRunning)
110
+ if (this.waitForCompletion && this._isCallbackRunning)
111
111
  return;
112
112
  this._isCallbackRunning = true;
113
113
  try {
@@ -179,7 +179,20 @@ class CronJob {
179
179
  setCronTimeout(timeout);
180
180
  }
181
181
  else {
182
- this.stop();
182
+ if (timeout <= 1000) {
183
+ console.warn(`[CRON DEBUG] Executing job with a delay: ${timeout}ms`);
184
+ this.lastExecution = new Date();
185
+ this.running = false;
186
+ if (!this.runOnce)
187
+ this.start();
188
+ void this.fireOnTick();
189
+ }
190
+ else {
191
+ console.error(`[CRON DEBUG] Stopping job due to delay being higher than 1s: ${timeout}ms`);
192
+ this.stop();
193
+ }
194
+ console.debug(`[CRON DEBUG] Current date: ${new Date().toISOString()}`);
195
+ console.debug(`[CRON DEBUG] Source: ${String(this.cronTime.source)}`);
183
196
  }
184
197
  }
185
198
  lastDate() {
package/dist/time.js CHANGED
@@ -107,7 +107,7 @@ class CronTime {
107
107
  }
108
108
  }
109
109
  getTimeout() {
110
- return Math.max(-1, this.sendAt().toMillis() - luxon_1.DateTime.local().toMillis());
110
+ return this.sendAt().toMillis() - luxon_1.DateTime.local().toMillis();
111
111
  }
112
112
  toString() {
113
113
  return this.toJSON().join(' ');
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.3.0",
4
+ "version": "3.3.2-beta.1",
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"
@@ -28,8 +28,8 @@
28
28
  "luxon": "~3.5.0"
29
29
  },
30
30
  "devDependencies": {
31
- "@commitlint/cli": "19.6.0",
32
- "@eslint/js": "^9.14.0",
31
+ "@commitlint/cli": "19.6.1",
32
+ "@eslint/js": "9.17.0",
33
33
  "@fast-check/jest": "2.0.3",
34
34
  "@insurgent/commitlint-config": "20.0.0",
35
35
  "@insurgent/conventional-changelog-preset": "10.0.0",
@@ -38,9 +38,9 @@
38
38
  "@semantic-release/git": "10.0.1",
39
39
  "@semantic-release/github": "11.0.1",
40
40
  "@semantic-release/npm": "12.0.1",
41
- "@semantic-release/release-notes-generator": "14.0.1",
41
+ "@semantic-release/release-notes-generator": "14.0.2",
42
42
  "@types/jest": "29.5.14",
43
- "@types/node": "20.17.9",
43
+ "@types/node": "20.17.10",
44
44
  "@types/sinon": "17.0.3",
45
45
  "chai": "4.5.0",
46
46
  "eslint": "8.57.1",
@@ -49,13 +49,13 @@
49
49
  "eslint-plugin-prettier": "5.2.1",
50
50
  "husky": "9.1.7",
51
51
  "jest": "29.7.0",
52
- "lint-staged": "15.2.10",
53
- "prettier": "3.3.3",
52
+ "lint-staged": "15.2.11",
53
+ "prettier": "3.4.2",
54
54
  "semantic-release": "24.2.0",
55
55
  "sinon": "17.0.2",
56
56
  "ts-jest": "29.2.5",
57
57
  "typescript": "5.7.2",
58
- "typescript-eslint": "^7.2.0"
58
+ "typescript-eslint": "7.18.0"
59
59
  },
60
60
  "keywords": [
61
61
  "cron",