mongo-job-scheduler 0.1.5 → 0.1.6

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/README.md CHANGED
@@ -65,16 +65,14 @@ await scheduler.start();
65
65
  ## Cron with Timezone
66
66
 
67
67
  ```typescript
68
- await scheduler.schedule(
69
- "daily-report",
70
- { type: "report" }, // payload
71
- {
72
- repeat: {
73
- cron: "0 9 * * *",
74
- timezone: "Asia/Kolkata", // default is UTC
75
- },
76
- }
77
- );
68
+ await scheduler.schedule({
69
+ name: "daily-report",
70
+ // data: { type: "report" }, // optional payload
71
+ repeat: {
72
+ cron: "0 9 * * *",
73
+ timezone: "Asia/Kolkata", // default is UTC
74
+ },
75
+ });
78
76
  ```
79
77
 
80
78
  ## Interval Scheduling
@@ -4,7 +4,7 @@ import { RepeatOptions } from "./repeat";
4
4
  export interface Job<Data = unknown> {
5
5
  _id?: unknown;
6
6
  name: string;
7
- data: Data;
7
+ data?: Data;
8
8
  status: JobStatus;
9
9
  nextRunAt: Date;
10
10
  lastRunAt?: Date;
@@ -2,7 +2,7 @@ import { RetryOptions } from "./retry";
2
2
  import { RepeatOptions } from "./repeat";
3
3
  export interface ScheduleOptions<T = unknown> {
4
4
  name: string;
5
- data: T;
5
+ data?: T;
6
6
  /**
7
7
  * When the job should first run.
8
8
  * Defaults to now.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mongo-job-scheduler",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "description": "Production-grade MongoDB-backed job scheduler with retries, cron, timezone support, and crash recovery",
5
5
  "license": "MIT",
6
6
  "author": "Darshan Bhut",