@checkstack/queue-api 0.1.3 → 0.2.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,5 +1,36 @@
1
1
  # @checkstack/queue-api
2
2
 
3
+ ## 0.2.1
4
+
5
+ ### Patch Changes
6
+
7
+ - @checkstack/backend-api@0.5.1
8
+
9
+ ## 0.2.0
10
+
11
+ ### Minor Changes
12
+
13
+ - 2c0822d: ### Queue System
14
+
15
+ - Added cron pattern support to `scheduleRecurring()` - accepts either `intervalSeconds` or `cronPattern`
16
+ - BullMQ backend uses native cron scheduling via `pattern` option
17
+ - InMemoryQueue implements wall-clock cron scheduling with `cron-parser`
18
+
19
+ ### Maintenance Backend
20
+
21
+ - Auto status transitions now use cron pattern `* * * * *` for precise second-0 scheduling
22
+ - User notifications are now sent for auto-started and auto-completed maintenances
23
+ - Refactored to call `addUpdate` RPC for status changes, centralizing hook/signal/notification logic
24
+
25
+ ### UI
26
+
27
+ - DateTimePicker now resets seconds and milliseconds to 0 when time is changed
28
+
29
+ ### Patch Changes
30
+
31
+ - Updated dependencies [66a3963]
32
+ - @checkstack/backend-api@0.5.0
33
+
3
34
  ## 0.1.3
4
35
 
5
36
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@checkstack/queue-api",
3
- "version": "0.1.3",
3
+ "version": "0.2.1",
4
4
  "type": "module",
5
5
  "main": "src/index.ts",
6
6
  "dependencies": {
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import type { Queue, QueueStats } from "./queue";
2
+ import type { Queue, QueueStats, RecurringSchedule } from "./queue";
3
3
  import type { Migration, Logger } from "@checkstack/backend-api";
4
4
 
5
5
  export interface QueuePlugin<Config = unknown> {
@@ -37,12 +37,11 @@ export interface SwitchResult {
37
37
  /**
38
38
  * Info about a recurring job across all queues
39
39
  */
40
- export interface RecurringJobInfo {
40
+ export type RecurringJobInfo = {
41
41
  queueName: string;
42
42
  jobId: string;
43
- intervalSeconds: number;
44
43
  nextRunAt?: Date;
45
- }
44
+ } & RecurringSchedule;
46
45
 
47
46
  /**
48
47
  * QueueManager handles queue creation, backend switching, and multi-instance coordination.
package/src/queue.ts CHANGED
@@ -9,16 +9,22 @@ export interface QueueJob<T = unknown> {
9
9
  attempts?: number;
10
10
  }
11
11
 
12
+ /**
13
+ * Schedule configuration: either interval-based or cron-based
14
+ */
15
+ export type RecurringSchedule =
16
+ | { intervalSeconds: number; cronPattern?: never }
17
+ | { cronPattern: string; intervalSeconds?: never };
18
+
12
19
  /**
13
20
  * Details of a recurring job for migration purposes
14
21
  */
15
- export interface RecurringJobDetails<T = unknown> {
22
+ export type RecurringJobDetails<T = unknown> = {
16
23
  jobId: string;
17
24
  data: T;
18
- intervalSeconds: number;
19
25
  priority?: number;
20
26
  nextRunAt?: Date;
21
- }
27
+ } & RecurringSchedule;
22
28
 
23
29
  export interface QueueConsumer<T = unknown> {
24
30
  (job: QueueJob<T>): Promise<void>;
@@ -62,7 +68,7 @@ export interface Queue<T = unknown> {
62
68
  * If provided and a job with this ID already exists, behavior depends on queue implementation
63
69
  */
64
70
  jobId?: string;
65
- }
71
+ },
66
72
  ): Promise<string>;
67
73
 
68
74
  /**
@@ -73,7 +79,9 @@ export interface Queue<T = unknown> {
73
79
  consume(consumer: QueueConsumer<T>, options: ConsumeOptions): Promise<void>;
74
80
 
75
81
  /**
76
- * Schedule a recurring job that executes at regular intervals.
82
+ * Schedule a recurring job that executes at regular intervals or on a cron schedule.
83
+ *
84
+ * Accepts EITHER `intervalSeconds` (fixed interval) OR `cronPattern` (cron expression).
77
85
  *
78
86
  * UPDATE SEMANTICS: Calling this method with an existing jobId will UPDATE
79
87
  * the recurring job configuration (interval, payload, priority, etc.).
@@ -94,13 +102,11 @@ export interface Queue<T = unknown> {
94
102
  * Calling scheduleRecurring with the same jobId updates the existing job.
95
103
  */
96
104
  jobId: string;
97
- /** Interval in seconds between executions */
98
- intervalSeconds: number;
99
105
  /** Optional delay before first execution (for delta-based scheduling) */
100
106
  startDelay?: number;
101
107
  /** Optional priority */
102
108
  priority?: number;
103
- }
109
+ } & RecurringSchedule,
104
110
  ): Promise<string>;
105
111
 
106
112
  /**
@@ -122,7 +128,7 @@ export interface Queue<T = unknown> {
122
128
  * @returns Job details or undefined if not found
123
129
  */
124
130
  getRecurringJobDetails(
125
- jobId: string
131
+ jobId: string,
126
132
  ): Promise<RecurringJobDetails<T> | undefined>;
127
133
 
128
134
  /**