@stacksjs/queue 0.75.519 → 0.75.522

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/dist/action.d.ts CHANGED
@@ -51,4 +51,6 @@ export declare class Job<T = unknown> {
51
51
  dispatchUnless(condition: boolean, ...[payload]: JobPayloadArgs<T>): Promise<void>;
52
52
  dispatchAfter(delaySeconds: number, ...[payload]: JobPayloadArgs<T>): Promise<void>;
53
53
  dispatchNow(...[payload]: JobPayloadArgs<T>): Promise<void>;
54
+ private dispatchToDatabase;
55
+ private dispatchToRedis;
54
56
  }
package/dist/batch.d.ts CHANGED
@@ -127,6 +127,8 @@ export type PersistentBatchHandler = | { kind: 'job', name: string, payload?: un
127
127
  * PendingBatch - a batch that has been configured but not yet dispatched
128
128
  */
129
129
  export declare class PendingBatch {
130
+ private jobs;
131
+ private options;
130
132
  constructor(jobs: Array<Job | BatchableJob>);
131
133
  name(name: string): this;
132
134
  onQueue(queue: string): this;
@@ -25,3 +25,4 @@ declare interface CircuitRow {
25
25
  paused_at: string | null
26
26
  resume_at: string | null
27
27
  }
28
+ export {};
@@ -68,6 +68,8 @@ export declare interface JobConfig {
68
68
  * Job registry for managing discovered jobs
69
69
  */
70
70
  declare class JobRegistry {
71
+ private jobs;
72
+ private initialized;
71
73
  register(job: DiscoveredJob): void;
72
74
  get(name: string): DiscoveredJob | undefined;
73
75
  all(): DiscoveredJob[];
@@ -78,3 +80,4 @@ declare class JobRegistry {
78
80
  setInitialized(value: boolean): void;
79
81
  isInitialized(): boolean;
80
82
  }
83
+ export {};
@@ -29,7 +29,11 @@ declare interface QueueEvents {
29
29
  * Redis Queue Driver class
30
30
  */
31
31
  export declare class RedisQueue<T = any> {
32
+ private queue;
33
+ private config;
34
+ private isProcessing;
32
35
  constructor(name: string, config: RedisConnectionConfig);
36
+ private buildRedisUrl;
33
37
  add(data: T, options?: QueueOption): Promise<BunJob<T>>;
34
38
  process(concurrency: number, handler: (job: BunJob<T>) => Promise<any>): void;
35
39
  getJob(jobId: string): Promise<BunJob<T> | null>;
@@ -62,6 +66,9 @@ export declare class RedisQueue<T = any> {
62
66
  * Queue Manager for multiple queue connections
63
67
  */
64
68
  export declare class StacksQueueManager {
69
+ private queues;
70
+ private defaultConnection;
71
+ private config;
65
72
  constructor(config: Record<string, RedisConnectionConfig>);
66
73
  queue<T = any>(name?: string): RedisQueue<T>;
67
74
  setDefaultConnection(name: string): void;
@@ -72,6 +79,7 @@ export declare class StacksQueueManager {
72
79
  */
73
80
  export declare class RedisJob<T = any> implements Dispatchable {
74
81
  protected options: QueueOption;
82
+ private queue;
75
83
  protected data: T;
76
84
  constructor(queueName: string, config: RedisConnectionConfig, data: T);
77
85
  dispatch(): Promise<void>;
package/dist/events.d.ts CHANGED
@@ -136,6 +136,10 @@ export type QueueEventHandler = (_payload: QueueEventPayload) => void | Promise<
136
136
  * Queue events emitter
137
137
  */
138
138
  export declare class QueueEvents {
139
+ private handlers;
140
+ private wildcardHandlers;
141
+ private listenerSubscriptions;
142
+ private reclaim;
139
143
  on(event: QueueEventType, handler: QueueEventHandler): () => void;
140
144
  subscribeListener(listener: object, event: QueueEventType, method: QueueEventHandler): () => void;
141
145
  unsubscribeListener(listener: object): number;
@@ -143,6 +147,7 @@ export declare class QueueEvents {
143
147
  onAny(handler: (event: QueueEventType, payload: QueueEventPayload) => void | Promise<void>): () => void;
144
148
  once(event: QueueEventType, handler: QueueEventHandler): () => void;
145
149
  emit(event: QueueEventType, payload: Omit<QueueEventPayload, 'timestamp'>): Promise<void>;
150
+ private logEvent;
146
151
  off(event: QueueEventType): void;
147
152
  removeAllListeners(): void;
148
153
  }
@@ -150,7 +155,12 @@ export declare class QueueEvents {
150
155
  * Queue metrics based on events
151
156
  */
152
157
  export declare class QueueMetrics {
158
+ private jobCounts;
159
+ private completions;
160
+ private errors;
161
+ private unsubscribe;
153
162
  constructor();
163
+ private setupListeners;
154
164
  getThroughputPerMinute(): number;
155
165
  getAverageProcessingTime(): number;
156
166
  getMetrics(): {
@@ -163,6 +173,7 @@ export declare class QueueMetrics {
163
173
  stop(): void;
164
174
  }
165
175
  declare class WorkerTracker {
176
+ private workers;
166
177
  register(id: string, queue: string): void;
167
178
  markActive(id: string): void;
168
179
  markIdle(id: string): void;
@@ -172,3 +183,4 @@ declare class WorkerTracker {
172
183
  getAll(): TrackedWorker[];
173
184
  clear(): void;
174
185
  }
186
+ export {};
@@ -62,3 +62,4 @@ declare interface JobProgress {
62
62
  message?: string
63
63
  updatedAt: number
64
64
  }
65
+ export {};
package/dist/job.d.ts CHANGED
@@ -225,6 +225,10 @@ declare type PayloadOf<J> = J extends Job<infer P> ? P : unknown;
225
225
  * Fluent job builder for file-based jobs
226
226
  */
227
227
  declare class JobBuilder {
228
+ private options;
229
+ private txMode;
230
+ private name;
231
+ private payload;
228
232
  constructor(name: string, payload?: unknown);
229
233
  onQueue(queue: string): this;
230
234
  delay(seconds: number): this;
@@ -236,7 +240,11 @@ declare class JobBuilder {
236
240
  afterCommit(): this;
237
241
  withoutCommit(): this;
238
242
  dispatch(): Promise<void>;
243
+ private runDispatchPipeline;
239
244
  dispatchIf(condition: boolean): Promise<void>;
240
245
  dispatchUnless(condition: boolean): Promise<void>;
246
+ private dispatchToDatabase;
247
+ private dispatchToRedis;
241
248
  dispatchNow(): Promise<void>;
242
249
  }
250
+ export {};
@@ -63,8 +63,23 @@ export type NotificationChannel = 'email' | 'slack' | 'discord' | 'webhook' | 'l
63
63
  * Failed job notification manager
64
64
  */
65
65
  export declare class FailedJobNotifier {
66
+ private config;
67
+ private notificationCount;
68
+ private lastResetTime;
69
+ private pendingBatch;
70
+ private batchTimeout;
71
+ private activeFlush;
66
72
  constructor(config: FailedJobNotificationConfig);
67
73
  notify(job: FailedJobInfo): Promise<void>;
74
+ private flushBatch;
68
75
  shutdown(): Promise<void>;
76
+ private sendNotifications;
77
+ private sendEmail;
78
+ private formatEmailBody;
79
+ private sendSlack;
80
+ private sendDiscord;
81
+ private sendWebhook;
82
+ private generateSignature;
83
+ private logFailures;
69
84
  cleanup(): Promise<void>;
70
85
  }
package/dist/poison.d.ts CHANGED
@@ -49,3 +49,4 @@ export declare interface PoisonConfig {
49
49
  windowMinutes?: number
50
50
  }
51
51
  declare type QueueTransaction = Parameters<Parameters<typeof db.transaction>[0]>[0];
52
+ export {};
@@ -1,4 +1,3 @@
1
- declare function birth(pid: number): string;
2
1
  /** Unsupported hosts fail closed and continue using the ordinary lease TTL. */
3
2
  export declare function captureProcessLeaseOwner(pid?: unknown): ProcessLeaseOwner | undefined;
4
3
  /** Only a positively dead local incarnation may be reclaimed before its TTL. */
@@ -75,3 +75,4 @@ declare interface ScheduledJobState {
75
75
  isRunning: boolean
76
76
  }
77
77
  declare interface CronParts { minute: number, hour: number, day: number, month: number, dayOfWeek: number }
78
+ export {};
package/dist/testing.d.ts CHANGED
@@ -41,6 +41,10 @@ export declare interface DispatchedJob<T = any> {
41
41
  * Fake queue for testing
42
42
  */
43
43
  declare class FakeQueue {
44
+ private dispatchedJobs;
45
+ private pushedJobs;
46
+ private processedJobs;
47
+ private failedJobs;
44
48
  dispatch<T>(name: string, data: T, options?: Partial<JobOptions>): void;
45
49
  push<T>(name: string, data: T, options?: Partial<JobOptions>): void;
46
50
  dispatched(name?: string): DispatchedJob[];
@@ -61,6 +65,7 @@ declare class FakeQueue {
61
65
  * Queue testing helper class
62
66
  */
63
67
  export declare class QueueTester {
68
+ private queue;
64
69
  constructor();
65
70
  dispatch<T>(name: string, data: T, options?: Partial<JobOptions>): this;
66
71
  push<T>(name: string, data: T, options?: Partial<JobOptions>): this;
@@ -72,3 +77,4 @@ export declare class QueueTester {
72
77
  reset(): this;
73
78
  cleanup(): void;
74
79
  }
80
+ export {};
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@stacksjs/queue",
3
3
  "type": "module",
4
4
  "sideEffects": false,
5
- "version": "0.75.519",
5
+ "version": "0.75.522",
6
6
  "description": "The Stacks Queue system powered by bun-queue.",
7
7
  "author": "Chris Breuer",
8
8
  "contributors": [
@@ -63,23 +63,23 @@
63
63
  "prepublishOnly": "bun run build"
64
64
  },
65
65
  "dependencies": {
66
- "@stacksjs/action-runner": "0.75.519",
66
+ "@stacksjs/action-runner": "0.75.522",
67
67
  "@stacksjs/bun-queue": "^0.1.8",
68
- "@stacksjs/cache": "0.75.519",
69
- "@stacksjs/config": "0.75.519",
70
- "@stacksjs/cron": "0.75.519",
71
- "@stacksjs/database": "0.75.519",
72
- "@stacksjs/env": "0.75.519",
73
- "@stacksjs/error-handling": "0.75.519",
74
- "@stacksjs/logging": "0.75.519",
75
- "@stacksjs/path": "0.75.519"
68
+ "@stacksjs/cache": "0.75.522",
69
+ "@stacksjs/config": "0.75.522",
70
+ "@stacksjs/cron": "0.75.522",
71
+ "@stacksjs/database": "0.75.522",
72
+ "@stacksjs/env": "0.75.522",
73
+ "@stacksjs/error-handling": "0.75.522",
74
+ "@stacksjs/logging": "0.75.522",
75
+ "@stacksjs/path": "0.75.522"
76
76
  },
77
77
  "devDependencies": {
78
78
  "better-dx": "^0.2.24"
79
79
  },
80
80
  "peerDependencies": {
81
- "@stacksjs/email": "0.75.519",
82
- "@stacksjs/router": "0.75.519"
81
+ "@stacksjs/email": "0.75.522",
82
+ "@stacksjs/router": "0.75.522"
83
83
  },
84
84
  "peerDependenciesMeta": {
85
85
  "@stacksjs/email": {