cron 3.1.2 → 3.1.4

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,36 @@
1
+ ## [3.1.4](https://github.com/kelektiv/node-cron/compare/v3.1.3...v3.1.4) (2023-10-24)
2
+
3
+
4
+ ### 🐛 Bug Fixes
5
+
6
+ * run once when actual date is given to setTime ([#740](https://github.com/kelektiv/node-cron/issues/740)) ([ee54dd5](https://github.com/kelektiv/node-cron/commit/ee54dd52956a9a203a72d4a38673bf0268cd6487))
7
+
8
+
9
+ ### ⚙️ Continuous Integrations
10
+
11
+ * **action:** update actions/checkout action to v4 ([#735](https://github.com/kelektiv/node-cron/issues/735)) ([144ba67](https://github.com/kelektiv/node-cron/commit/144ba677cbafc16e0c2e9d5372561589715de536))
12
+
13
+
14
+ ### ♻️ Chores
15
+
16
+ * **deps:** lock file maintenance ([#741](https://github.com/kelektiv/node-cron/issues/741)) ([6d94742](https://github.com/kelektiv/node-cron/commit/6d94742fe1c7959569e7c3b922a0cfee4143ba0f))
17
+ * **deps:** update dependency [@types](https://github.com/types)/jest to v29.5.6 ([#736](https://github.com/kelektiv/node-cron/issues/736)) ([57c0efa](https://github.com/kelektiv/node-cron/commit/57c0efafcd875fed2550d0bb7ee383ccd2fd4790))
18
+ * **deps:** update dependency [@types](https://github.com/types)/node to v20.8.7 ([#737](https://github.com/kelektiv/node-cron/issues/737)) ([21c4065](https://github.com/kelektiv/node-cron/commit/21c4065399fb8eb8aa10a4cd1c14d42f175263eb))
19
+ * **deps:** update dependency [@typescript-eslint](https://github.com/typescript-eslint)/eslint-plugin to v6.8.0 ([#734](https://github.com/kelektiv/node-cron/issues/734)) ([12e7487](https://github.com/kelektiv/node-cron/commit/12e7487496f9e76bc11ba48fcb99a40bcdd8674f))
20
+ * **deps:** update tests ([#738](https://github.com/kelektiv/node-cron/issues/738)) ([3815e2a](https://github.com/kelektiv/node-cron/commit/3815e2a56560ec105322c9dee3b45027ea069c1b))
21
+
22
+ ## [3.1.3](https://github.com/kelektiv/node-cron/compare/v3.1.2...v3.1.3) (2023-10-19)
23
+
24
+
25
+ ### 🐛 Bug Fixes
26
+
27
+ * allow callbacks to return a promise ([#733](https://github.com/kelektiv/node-cron/issues/733)) ([8dd8b75](https://github.com/kelektiv/node-cron/commit/8dd8b754b69e2cbe503f344f2346a035cf5a3ec6))
28
+
29
+
30
+ ### ⚙️ Continuous Integrations
31
+
32
+ * **renovate:** update configuration ([#732](https://github.com/kelektiv/node-cron/issues/732)) [skip ci] ([2ff9c6e](https://github.com/kelektiv/node-cron/commit/2ff9c6eb94fbc833c6a7fff30242e2b4b8367dc6))
33
+
1
34
  ## [3.1.2](https://github.com/kelektiv/node-cron/compare/v3.1.1...v3.1.2) (2023-10-19)
2
35
 
3
36
 
package/dist/job.d.ts CHANGED
@@ -5,7 +5,6 @@ export declare class CronJob<OC extends CronOnCompleteCommand | null = null, C =
5
5
  running: boolean;
6
6
  unrefTimeout: boolean;
7
7
  lastExecution: Date | null;
8
- runOnce: boolean;
9
8
  context: CronContext<C>;
10
9
  onComplete?: WithOnComplete<OC> extends true ? CronOnCompleteCallback : undefined;
11
10
  private _timeout?;
package/dist/job.js CHANGED
@@ -9,7 +9,6 @@ class CronJob {
9
9
  this.running = false;
10
10
  this.unrefTimeout = false;
11
11
  this.lastExecution = null;
12
- this.runOnce = false;
13
12
  this._callbacks = [];
14
13
  this.context = (context !== null && context !== void 0 ? context : this);
15
14
  if (timeZone != null && utcOffset != null) {
@@ -30,9 +29,6 @@ class CronJob {
30
29
  if (onComplete != null) {
31
30
  this.onComplete = this._fnWrap(onComplete);
32
31
  }
33
- if (this.cronTime.realDate) {
34
- this.runOnce = true;
35
- }
36
32
  this.addCallback(this._fnWrap(onTick));
37
33
  if (runOnInit) {
38
34
  this.lastExecution = new Date();
@@ -90,7 +86,7 @@ class CronJob {
90
86
  }
91
87
  fireOnTick() {
92
88
  for (const callback of this._callbacks) {
93
- callback.call(this.context, this.onComplete);
89
+ void callback.call(this.context, this.onComplete);
94
90
  }
95
91
  }
96
92
  nextDates(i) {
@@ -134,7 +130,7 @@ class CronJob {
134
130
  else {
135
131
  this.lastExecution = new Date();
136
132
  this.running = false;
137
- if (!this.runOnce) {
133
+ if (!this.cronTime.realDate) {
138
134
  this.start();
139
135
  }
140
136
  this.fireOnTick();
@@ -160,7 +156,7 @@ class CronJob {
160
156
  clearTimeout(this._timeout);
161
157
  this.running = false;
162
158
  if (typeof this.onComplete === 'function') {
163
- this.onComplete.call(this.context);
159
+ void this.onComplete.call(this.context);
164
160
  }
165
161
  }
166
162
  }
@@ -21,8 +21,8 @@ export type CronJobParams<OC extends CronOnCompleteCommand | null = null, C = nu
21
21
  utcOffset?: number | null;
22
22
  });
23
23
  export type CronContext<C> = C extends null ? CronJob : NonNullable<C>;
24
- export type CronCallback<C, WithOnCompleteBool extends boolean = false> = (this: CronContext<C>, onComplete: WithOnCompleteBool extends true ? CronOnCompleteCallback : never) => void;
25
- export type CronOnCompleteCallback = () => void;
24
+ export type CronCallback<C, WithOnCompleteBool extends boolean = false> = (this: CronContext<C>, onComplete: WithOnCompleteBool extends true ? CronOnCompleteCallback : never) => void | Promise<void>;
25
+ export type CronOnCompleteCallback = () => void | Promise<void>;
26
26
  export type CronSystemCommand = string | {
27
27
  command: string;
28
28
  args?: readonly string[] | null;
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.1.2",
4
+ "version": "3.1.4",
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"
@@ -36,10 +36,10 @@
36
36
  "@semantic-release/github": "9.2.1",
37
37
  "@semantic-release/npm": "11.0.0",
38
38
  "@semantic-release/release-notes-generator": "12.0.0",
39
- "@types/jest": "29.5.5",
40
- "@types/node": "20.8.6",
41
- "@types/sinon": "10.0.19",
42
- "@typescript-eslint/eslint-plugin": "6.7.5",
39
+ "@types/jest": "29.5.6",
40
+ "@types/node": "20.8.7",
41
+ "@types/sinon": "10.0.20",
42
+ "@typescript-eslint/eslint-plugin": "6.8.0",
43
43
  "chai": "4.3.10",
44
44
  "eslint": "8.51.0",
45
45
  "eslint-config-prettier": "9.0.0",
@@ -49,7 +49,7 @@
49
49
  "jest": "29.7.0",
50
50
  "prettier": "3.0.3",
51
51
  "semantic-release": "22.0.5",
52
- "sinon": "16.1.0",
52
+ "sinon": "16.1.3",
53
53
  "ts-jest": "29.1.1",
54
54
  "typescript": "5.2.2"
55
55
  },