@spinajs/queue 2.0.480 → 2.0.482
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/lib/cjs/config/queue.d.ts +10 -0
- package/lib/cjs/config/queue.d.ts.map +1 -1
- package/lib/cjs/config/queue.js +21 -0
- package/lib/cjs/config/queue.js.map +1 -1
- package/lib/cjs/decorators.d.ts.map +1 -1
- package/lib/cjs/decorators.js.map +1 -1
- package/lib/cjs/fp.d.ts.map +1 -1
- package/lib/cjs/fp.js.map +1 -1
- package/lib/cjs/index.d.ts +13 -2
- package/lib/cjs/index.d.ts.map +1 -1
- package/lib/cjs/index.js +103 -14
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/interfaces.d.ts +178 -7
- package/lib/cjs/interfaces.d.ts.map +1 -1
- package/lib/cjs/interfaces.js +59 -11
- package/lib/cjs/interfaces.js.map +1 -1
- package/lib/cjs/migrations/Queue_2026_06_30_00_00_00.d.ts +10 -0
- package/lib/cjs/migrations/Queue_2026_06_30_00_00_00.d.ts.map +1 -0
- package/lib/cjs/migrations/Queue_2026_06_30_00_00_00.js +29 -0
- package/lib/cjs/migrations/Queue_2026_06_30_00_00_00.js.map +1 -0
- package/lib/cjs/migrations/Queue_2026_07_02_00_00_00.d.ts +14 -0
- package/lib/cjs/migrations/Queue_2026_07_02_00_00_00.d.ts.map +1 -0
- package/lib/cjs/migrations/Queue_2026_07_02_00_00_00.js +53 -0
- package/lib/cjs/migrations/Queue_2026_07_02_00_00_00.js.map +1 -0
- package/lib/cjs/migrations/Queue_2026_07_10_00_00_00.d.ts +10 -0
- package/lib/cjs/migrations/Queue_2026_07_10_00_00_00.d.ts.map +1 -0
- package/lib/cjs/migrations/Queue_2026_07_10_00_00_00.js +31 -0
- package/lib/cjs/migrations/Queue_2026_07_10_00_00_00.js.map +1 -0
- package/lib/cjs/migrations/Queue_2026_07_17_00_00_00.d.ts +16 -0
- package/lib/cjs/migrations/Queue_2026_07_17_00_00_00.d.ts.map +1 -0
- package/lib/cjs/migrations/Queue_2026_07_17_00_00_00.js +49 -0
- package/lib/cjs/migrations/Queue_2026_07_17_00_00_00.js.map +1 -0
- package/lib/cjs/models/JobModel.d.ts +66 -4
- package/lib/cjs/models/JobModel.d.ts.map +1 -1
- package/lib/cjs/models/JobModel.js +43 -2
- package/lib/cjs/models/JobModel.js.map +1 -1
- package/lib/cjs/services/JobRetentionService.d.ts +26 -0
- package/lib/cjs/services/JobRetentionService.d.ts.map +1 -0
- package/lib/cjs/services/JobRetentionService.js +87 -0
- package/lib/cjs/services/JobRetentionService.js.map +1 -0
- package/lib/mjs/config/queue.d.ts +10 -0
- package/lib/mjs/config/queue.d.ts.map +1 -1
- package/lib/mjs/config/queue.js +21 -0
- package/lib/mjs/config/queue.js.map +1 -1
- package/lib/mjs/decorators.d.ts.map +1 -1
- package/lib/mjs/decorators.js.map +1 -1
- package/lib/mjs/fp.d.ts.map +1 -1
- package/lib/mjs/fp.js.map +1 -1
- package/lib/mjs/index.d.ts +13 -2
- package/lib/mjs/index.d.ts.map +1 -1
- package/lib/mjs/index.js +105 -16
- package/lib/mjs/index.js.map +1 -1
- package/lib/mjs/interfaces.d.ts +178 -7
- package/lib/mjs/interfaces.d.ts.map +1 -1
- package/lib/mjs/interfaces.js +57 -10
- package/lib/mjs/interfaces.js.map +1 -1
- package/lib/mjs/migrations/Queue_2026_06_30_00_00_00.d.ts +10 -0
- package/lib/mjs/migrations/Queue_2026_06_30_00_00_00.d.ts.map +1 -0
- package/lib/mjs/migrations/Queue_2026_06_30_00_00_00.js +26 -0
- package/lib/mjs/migrations/Queue_2026_06_30_00_00_00.js.map +1 -0
- package/lib/mjs/migrations/Queue_2026_07_02_00_00_00.d.ts +14 -0
- package/lib/mjs/migrations/Queue_2026_07_02_00_00_00.d.ts.map +1 -0
- package/lib/mjs/migrations/Queue_2026_07_02_00_00_00.js +50 -0
- package/lib/mjs/migrations/Queue_2026_07_02_00_00_00.js.map +1 -0
- package/lib/mjs/migrations/Queue_2026_07_10_00_00_00.d.ts +10 -0
- package/lib/mjs/migrations/Queue_2026_07_10_00_00_00.d.ts.map +1 -0
- package/lib/mjs/migrations/Queue_2026_07_10_00_00_00.js +28 -0
- package/lib/mjs/migrations/Queue_2026_07_10_00_00_00.js.map +1 -0
- package/lib/mjs/migrations/Queue_2026_07_17_00_00_00.d.ts +16 -0
- package/lib/mjs/migrations/Queue_2026_07_17_00_00_00.d.ts.map +1 -0
- package/lib/mjs/migrations/Queue_2026_07_17_00_00_00.js +46 -0
- package/lib/mjs/migrations/Queue_2026_07_17_00_00_00.js.map +1 -0
- package/lib/mjs/models/JobModel.d.ts +66 -4
- package/lib/mjs/models/JobModel.d.ts.map +1 -1
- package/lib/mjs/models/JobModel.js +42 -2
- package/lib/mjs/models/JobModel.js.map +1 -1
- package/lib/mjs/services/JobRetentionService.d.ts +26 -0
- package/lib/mjs/services/JobRetentionService.d.ts.map +1 -0
- package/lib/mjs/services/JobRetentionService.js +84 -0
- package/lib/mjs/services/JobRetentionService.js.map +1 -0
- package/lib/tsconfig.cjs.tsbuildinfo +1 -1
- package/lib/tsconfig.mjs.tsbuildinfo +1 -1
- package/package.json +9 -6
package/lib/mjs/interfaces.d.ts
CHANGED
|
@@ -34,7 +34,12 @@ export interface IQueueJob extends IQueueMessage {
|
|
|
34
34
|
}
|
|
35
35
|
export declare abstract class QueueService extends AsyncService {
|
|
36
36
|
protected Configuration: IQueueConfiguration;
|
|
37
|
-
|
|
37
|
+
/**
|
|
38
|
+
* Emit a message. For jobs the generated JobId is returned so the caller can
|
|
39
|
+
* correlate the job with its progress/status (e.g. via queue-http-progress).
|
|
40
|
+
* Returns undefined for non-job messages.
|
|
41
|
+
*/
|
|
42
|
+
abstract emit(event: IQueueMessage | QueueEvent | QueueJob): Promise<string | undefined>;
|
|
38
43
|
abstract consume<T extends QueueMessage>(event: Constructor<QueueMessage>, callback?: (message: T) => Promise<void>, subscriptionId?: string, durable?: boolean): Promise<void>;
|
|
39
44
|
abstract stopConsuming(event: Constructor<QueueMessage>): Promise<void>;
|
|
40
45
|
abstract get(connection?: string): QueueClient;
|
|
@@ -88,6 +93,35 @@ export declare abstract class QueueEvent extends QueueMessage {
|
|
|
88
93
|
*
|
|
89
94
|
* Job results are preserved
|
|
90
95
|
*/
|
|
96
|
+
/**
|
|
97
|
+
* Optional richer progress metadata a job may report alongside the numeric
|
|
98
|
+
* percentage - persisted to the job model and exposed by queue-http-progress.
|
|
99
|
+
*/
|
|
100
|
+
export interface IJobProgressMeta {
|
|
101
|
+
/** Short phase label, e.g. `loading`, `rendering`. */
|
|
102
|
+
phase?: string;
|
|
103
|
+
/** Human-facing status message. */
|
|
104
|
+
message?: string;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Progress reporter passed to {@link QueueJob.execute}. Call with a 0-100
|
|
108
|
+
* percentage; the optional `meta` carries a phase label / message. Jobs that
|
|
109
|
+
* only report a percentage can ignore `meta`.
|
|
110
|
+
*/
|
|
111
|
+
export type JobProgressCallback = (p: number, meta?: IJobProgressMeta) => Promise<void>;
|
|
112
|
+
/**
|
|
113
|
+
* Context passed to {@link QueueJob.onFailed} describing the failed attempt.
|
|
114
|
+
*/
|
|
115
|
+
export interface IJobFailureContext {
|
|
116
|
+
/** The attempt number that just failed ( 1-based ). */
|
|
117
|
+
attempt: number;
|
|
118
|
+
/** The total allowed executions ( retries + 1 ). */
|
|
119
|
+
maxAttempts: number;
|
|
120
|
+
/** True when this failure exhausted the retries and the job was marked dead. */
|
|
121
|
+
isFinal: boolean;
|
|
122
|
+
/** The failed job's JobId. */
|
|
123
|
+
jobId: string;
|
|
124
|
+
}
|
|
91
125
|
export declare abstract class QueueJob extends QueueMessage implements IQueueJob {
|
|
92
126
|
JobId: string;
|
|
93
127
|
/**
|
|
@@ -95,8 +129,18 @@ export declare abstract class QueueJob extends QueueMessage implements IQueueJob
|
|
|
95
129
|
*/
|
|
96
130
|
RetryCount: number;
|
|
97
131
|
constructor();
|
|
98
|
-
abstract execute(progress:
|
|
99
|
-
|
|
132
|
+
abstract execute(progress: JobProgressCallback): Promise<unknown>;
|
|
133
|
+
/**
|
|
134
|
+
* Called by the consumer after a failed execute(); isFinal=true when the job was marked dead.
|
|
135
|
+
* Must not throw - errors are logged and swallowed. Override to react to failures ( e.g. send an
|
|
136
|
+
* alert on the final attempt ). No-op by default.
|
|
137
|
+
*/
|
|
138
|
+
onFailed(_err: unknown, _ctx: IJobFailureContext): Promise<void>;
|
|
139
|
+
/**
|
|
140
|
+
* Emit (enqueue) this job. Returns the generated JobId so the caller can track
|
|
141
|
+
* the job's progress / status (e.g. via queue-http-progress `:jobId/status`).
|
|
142
|
+
*/
|
|
143
|
+
static emit<T extends typeof QueueMessage>(this: T, val: Partial<InstanceType<T>>, options?: IMessageOptions): Promise<string | undefined>;
|
|
100
144
|
}
|
|
101
145
|
export declare abstract class QueueClient extends AsyncService implements IInstanceCheck, IMappableService {
|
|
102
146
|
Options: IQueueConnectionOptions;
|
|
@@ -108,9 +152,14 @@ export declare abstract class QueueClient extends AsyncService implements IInsta
|
|
|
108
152
|
__checkInstance__(creationOptions: any): boolean;
|
|
109
153
|
/**
|
|
110
154
|
*
|
|
111
|
-
* Dispatches
|
|
155
|
+
* Dispatches a message to the broker.
|
|
112
156
|
*
|
|
113
|
-
*
|
|
157
|
+
* Delivery-guarantee contract: the returned promise MUST resolve only once the broker has
|
|
158
|
+
* taken custody of the message ( AMQP publisher confirm / STOMP RECEIPT frame ), so callers
|
|
159
|
+
* emitting persistent Jobs get an at-least-once guarantee. Fire-and-forget publishing is only
|
|
160
|
+
* acceptable for non-persistent Events.
|
|
161
|
+
*
|
|
162
|
+
* @param event - message to dispatch
|
|
114
163
|
*/
|
|
115
164
|
abstract emit(event: IQueueMessage): Promise<void>;
|
|
116
165
|
/**
|
|
@@ -128,8 +177,17 @@ export declare abstract class QueueClient extends AsyncService implements IInsta
|
|
|
128
177
|
* @param durable - is durable event ?
|
|
129
178
|
*/
|
|
130
179
|
abstract subscribe(channel: string, callback: (e: IQueueMessage) => Promise<void>, subscriptionId?: string, durable?: boolean): Promise<void>;
|
|
131
|
-
abstract unsubscribe(event: Constructor<QueueMessage
|
|
132
|
-
abstract unsubscribe(channel: string): void;
|
|
180
|
+
abstract unsubscribe(event: Constructor<QueueMessage>, removeDurable?: boolean): void;
|
|
181
|
+
abstract unsubscribe(channel: string, removeDurable?: boolean): void;
|
|
182
|
+
/**
|
|
183
|
+
*
|
|
184
|
+
* Gets dead-letter channel for message from routing table or connection default if non is set.
|
|
185
|
+
* Used by transports to redirect messages that failed processing so they don't block the queue.
|
|
186
|
+
*
|
|
187
|
+
* @param event - event/job to check
|
|
188
|
+
* @returns the dead-letter channel, or undefined if none is configured
|
|
189
|
+
*/
|
|
190
|
+
getDeadLetterChannelForMessage(event: IQueueMessage | Constructor<QueueMessage>): string | undefined;
|
|
133
191
|
/**
|
|
134
192
|
*
|
|
135
193
|
* Gets event channel from routing table or default if non is set
|
|
@@ -154,6 +212,78 @@ export interface IQueueConfiguration {
|
|
|
154
212
|
*/
|
|
155
213
|
routing?: IQueueMessageRoutingOptions;
|
|
156
214
|
connections: IQueueConnectionOptions[];
|
|
215
|
+
/**
|
|
216
|
+
* Skip re-executing a job whose {@link JobModel} is already in a terminal state
|
|
217
|
+
* ( `success` or `dead` ). Messaging is at-least-once, so duplicates happen on
|
|
218
|
+
* consumer crash and on broker failover - dedup keeps jobs idempotent.
|
|
219
|
+
*
|
|
220
|
+
* Defaults to `true`.
|
|
221
|
+
*/
|
|
222
|
+
deduplicate?: boolean;
|
|
223
|
+
/**
|
|
224
|
+
* Automatic cleanup of old tracked jobs ( {@link JobModel} rows ) so the table doesn't
|
|
225
|
+
* grow unbounded. Disabled by default - opt in to avoid silently deleting data.
|
|
226
|
+
*/
|
|
227
|
+
retention?: IQueueRetentionOptions;
|
|
228
|
+
/**
|
|
229
|
+
* Throttling of job progress persistence, so a chatty job that reports progress
|
|
230
|
+
* frequently doesn't hammer the DB with a write per callback.
|
|
231
|
+
*/
|
|
232
|
+
progress?: IQueueProgressOptions;
|
|
233
|
+
}
|
|
234
|
+
export interface IQueueProgressOptions {
|
|
235
|
+
/**
|
|
236
|
+
* Minimum progress delta ( % ) between throttled DB writes. Default `5`.
|
|
237
|
+
*/
|
|
238
|
+
minDelta?: number;
|
|
239
|
+
/**
|
|
240
|
+
* Minimum time ( ms ) between throttled DB writes. Default `1000`.
|
|
241
|
+
*/
|
|
242
|
+
minInterval?: number;
|
|
243
|
+
}
|
|
244
|
+
export interface IQueueRetentionOptions {
|
|
245
|
+
/**
|
|
246
|
+
* DI service name of the {@link JobRetentionService} implementation that runs the purge.
|
|
247
|
+
* Selected via {@link AutoinjectService}; defaults to `DefaultJobRetentionService`.
|
|
248
|
+
*/
|
|
249
|
+
service: string;
|
|
250
|
+
/**
|
|
251
|
+
* Turn the periodic purge on. Default `false`.
|
|
252
|
+
*/
|
|
253
|
+
enabled?: boolean;
|
|
254
|
+
/**
|
|
255
|
+
* Age in milliseconds after which a purged job is deleted ( based on CreatedAt ).
|
|
256
|
+
*/
|
|
257
|
+
maxAge?: number;
|
|
258
|
+
/**
|
|
259
|
+
* Which statuses to purge. Defaults to terminal statuses ( success / error / dead ).
|
|
260
|
+
*/
|
|
261
|
+
statuses?: string[];
|
|
262
|
+
/**
|
|
263
|
+
* How often ( ms ) to run the purge. Default 1 hour.
|
|
264
|
+
*/
|
|
265
|
+
interval?: number;
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Runs the periodic cleanup of tracked jobs ( {@link JobModel} rows ) so the table doesn't grow
|
|
269
|
+
* unbounded. The concrete implementation is selected by config ( `queue.retention.service` ) and
|
|
270
|
+
* injected into the {@link QueueService} via {@link AutoinjectService}. Because it is an
|
|
271
|
+
* {@link AsyncService}, DI runs `resolve()` on injection ( where the periodic purge is started )
|
|
272
|
+
* and `dispose()` on teardown ( where it is stopped ).
|
|
273
|
+
*/
|
|
274
|
+
export declare abstract class JobRetentionService extends AsyncService implements IMappableService {
|
|
275
|
+
Options: IQueueRetentionOptions;
|
|
276
|
+
constructor(Options: IQueueRetentionOptions);
|
|
277
|
+
get ServiceName(): string;
|
|
278
|
+
/**
|
|
279
|
+
* Deletes tracked jobs ( {@link JobModel} rows ) created before `olderThan` in one of `statuses`.
|
|
280
|
+
* Used by the periodic purge and available for manual cleanup.
|
|
281
|
+
*
|
|
282
|
+
* @param olderThan - delete jobs created before this moment
|
|
283
|
+
* @param statuses - which statuses to purge ( defaults to terminal: success / error / dead )
|
|
284
|
+
* @returns number of deleted rows
|
|
285
|
+
*/
|
|
286
|
+
abstract purgeJobs(olderThan: DateTime, statuses?: string[]): Promise<number>;
|
|
157
287
|
}
|
|
158
288
|
export interface IMessageRoutingOption {
|
|
159
289
|
channel?: string;
|
|
@@ -190,6 +320,47 @@ export interface IQueueConnectionOptions {
|
|
|
190
320
|
* and for unblocking source queue
|
|
191
321
|
*/
|
|
192
322
|
defaultQueueDeadLetterChannel?: string;
|
|
323
|
+
/**
|
|
324
|
+
* Delay in milliseconds before the transport tries to reconnect after a dropped connection.
|
|
325
|
+
*/
|
|
326
|
+
reconnectDelay?: number;
|
|
327
|
+
/**
|
|
328
|
+
* Incoming heartbeat interval in milliseconds ( 0 to disable ).
|
|
329
|
+
*/
|
|
330
|
+
heartbeatIncoming?: number;
|
|
331
|
+
/**
|
|
332
|
+
* Outgoing heartbeat interval in milliseconds ( 0 to disable ).
|
|
333
|
+
*/
|
|
334
|
+
heartbeatOutgoing?: number;
|
|
335
|
+
/**
|
|
336
|
+
* How long ( ms ) to wait for the initial connection before giving up.
|
|
337
|
+
*/
|
|
338
|
+
connectionTimeout?: number;
|
|
339
|
+
/**
|
|
340
|
+
* How long ( ms ) to wait for a broker delivery receipt when emitting a message.
|
|
341
|
+
*/
|
|
342
|
+
receiptTimeout?: number;
|
|
343
|
+
/**
|
|
344
|
+
* Base delay ( ms ) for retry backoff when a job fails and is rescheduled.
|
|
345
|
+
* Transports may apply exponential backoff based on this value. 0 means retry immediately.
|
|
346
|
+
*/
|
|
347
|
+
retryDelay?: number;
|
|
348
|
+
/**
|
|
349
|
+
* Optional DI service name resolving to an {@link IQueueCredentialsProvider}.
|
|
350
|
+
* When set, the transport asks it for credentials right before each ( re )connect,
|
|
351
|
+
* allowing rotating secrets / token based authentication.
|
|
352
|
+
*/
|
|
353
|
+
credentialProvider?: string;
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
* Provides connection credentials on demand ( e.g. rotating secrets, short lived tokens ).
|
|
357
|
+
* Resolved from DI by the name set in {@link IQueueConnectionOptions.credentialProvider}.
|
|
358
|
+
*/
|
|
359
|
+
export interface IQueueCredentialsProvider {
|
|
360
|
+
getCredentials(options: IQueueConnectionOptions): Promise<{
|
|
361
|
+
login?: string;
|
|
362
|
+
passcode?: string;
|
|
363
|
+
}>;
|
|
193
364
|
}
|
|
194
365
|
export interface IMessageOptions {
|
|
195
366
|
Persistent: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../src/interfaces.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAM,cAAc,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC9F,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,OAAO,EAAE,GAAG,EAAU,MAAM,cAAc,CAAC;AAG3C,oBAAY,gBAAgB;IAC1B,GAAG,QAAQ;IACX,KAAK,UAAU;CAChB;AAED,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,QAAQ,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,gBAAgB,CAAC;IAEvB,UAAU,EAAE,OAAO,CAAC;IAEpB,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;I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,MAAM,WAAW,eAAe;IAC9B,UAAU,EAAE,OAAO,CAAC;IAEpB,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;CACtB"}
|
package/lib/mjs/interfaces.js
CHANGED
|
@@ -20,7 +20,7 @@ export var QueueMessageType;
|
|
|
20
20
|
export class QueueService extends AsyncService {
|
|
21
21
|
getConnectionsForMessage(event) {
|
|
22
22
|
const eventName = (event.Name ?? event.name);
|
|
23
|
-
const option = this.Configuration.routing[eventName] ?? this.Configuration.default;
|
|
23
|
+
const option = (this.Configuration.routing ?? {})[eventName] ?? this.Configuration.default;
|
|
24
24
|
if (_.isString(option)) {
|
|
25
25
|
return [this.Configuration.default];
|
|
26
26
|
}
|
|
@@ -33,7 +33,7 @@ export class QueueService extends AsyncService {
|
|
|
33
33
|
}));
|
|
34
34
|
}
|
|
35
35
|
else {
|
|
36
|
-
return [option.connection];
|
|
36
|
+
return [option.connection ?? this.Configuration.default];
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
}
|
|
@@ -85,20 +85,27 @@ export class QueueEvent extends QueueMessage {
|
|
|
85
85
|
await queue.emit(message);
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
|
-
/**
|
|
89
|
-
* Jobs are executed only once even if multiple listeners waiting for it. usually used for single method call
|
|
90
|
-
* or time consuming tasks, that need to checked for result and tracked
|
|
91
|
-
*
|
|
92
|
-
* Job results are preserved
|
|
93
|
-
*/
|
|
94
88
|
export class QueueJob extends QueueMessage {
|
|
95
89
|
constructor() {
|
|
96
90
|
super();
|
|
97
91
|
this.Type = QueueMessageType.Job;
|
|
98
92
|
}
|
|
93
|
+
/**
|
|
94
|
+
* Called by the consumer after a failed execute(); isFinal=true when the job was marked dead.
|
|
95
|
+
* Must not throw - errors are logged and swallowed. Override to react to failures ( e.g. send an
|
|
96
|
+
* alert on the final attempt ). No-op by default.
|
|
97
|
+
*/
|
|
98
|
+
async onFailed(_err, _ctx) { }
|
|
99
|
+
/**
|
|
100
|
+
* Emit (enqueue) this job. Returns the generated JobId so the caller can track
|
|
101
|
+
* the job's progress / status (e.g. via queue-http-progress `:jobId/status`).
|
|
102
|
+
*/
|
|
99
103
|
static async emit(val, options) {
|
|
100
104
|
const queue = await DI.resolve(QueueService);
|
|
101
105
|
const message = {
|
|
106
|
+
// jobs must not be lost by default - persist unless the caller opts out.
|
|
107
|
+
// ( val / options below can still override this )
|
|
108
|
+
Persistent: true,
|
|
102
109
|
...val,
|
|
103
110
|
Type: QueueMessageType.Job,
|
|
104
111
|
CreatedAt: val.CreatedAt ?? DateTime.now(),
|
|
@@ -106,7 +113,7 @@ export class QueueJob extends QueueMessage {
|
|
|
106
113
|
...options,
|
|
107
114
|
};
|
|
108
115
|
// partial of queue job always is queue message
|
|
109
|
-
|
|
116
|
+
return queue.emit(message);
|
|
110
117
|
}
|
|
111
118
|
}
|
|
112
119
|
export class QueueClient extends AsyncService {
|
|
@@ -123,6 +130,30 @@ export class QueueClient extends AsyncService {
|
|
|
123
130
|
__checkInstance__(creationOptions) {
|
|
124
131
|
return this.Options.name === creationOptions[0].name;
|
|
125
132
|
}
|
|
133
|
+
/**
|
|
134
|
+
*
|
|
135
|
+
* Gets dead-letter channel for message from routing table or connection default if non is set.
|
|
136
|
+
* Used by transports to redirect messages that failed processing so they don't block the queue.
|
|
137
|
+
*
|
|
138
|
+
* @param event - event/job to check
|
|
139
|
+
* @returns the dead-letter channel, or undefined if none is configured
|
|
140
|
+
*/
|
|
141
|
+
getDeadLetterChannelForMessage(event) {
|
|
142
|
+
const eName = event.Name ?? event.name ?? event.constructor.name;
|
|
143
|
+
const rOption = this.Routing?.[eName];
|
|
144
|
+
// a single route option may carry its own dead-letter channel
|
|
145
|
+
if (rOption && !_.isString(rOption) && !_.isArray(rOption) && rOption.deadLetterChannel) {
|
|
146
|
+
return rOption.deadLetterChannel;
|
|
147
|
+
}
|
|
148
|
+
// multiple routes - use the first one that declares a dead-letter channel
|
|
149
|
+
if (_.isArray(rOption)) {
|
|
150
|
+
const withDlq = rOption.find((x) => !_.isString(x) && x.deadLetterChannel);
|
|
151
|
+
if (withDlq) {
|
|
152
|
+
return withDlq.deadLetterChannel;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
return this.Options.defaultQueueDeadLetterChannel;
|
|
156
|
+
}
|
|
126
157
|
/**
|
|
127
158
|
*
|
|
128
159
|
* Gets event channel from routing table or default if non is set
|
|
@@ -133,7 +164,7 @@ export class QueueClient extends AsyncService {
|
|
|
133
164
|
const options = Reflect.getMetadata('queue:options', event);
|
|
134
165
|
const eName = event.Name ?? event.name ?? event.constructor.name;
|
|
135
166
|
const isJob = event.Type ? event.Type === QueueMessageType.Job : options ? options.type === 'job' : false;
|
|
136
|
-
const rOption = this.Routing[eName];
|
|
167
|
+
const rOption = this.Routing?.[eName];
|
|
137
168
|
if (!rOption) {
|
|
138
169
|
this.Log.warn(`No routing for event ${eName} found, using default channel`);
|
|
139
170
|
return [isJob ? this.Options.defaultQueueChannel : this.Options.defaultTopicChannel];
|
|
@@ -160,4 +191,20 @@ __decorate([
|
|
|
160
191
|
Config('queue.routing'),
|
|
161
192
|
__metadata("design:type", Object)
|
|
162
193
|
], QueueClient.prototype, "Routing", void 0);
|
|
194
|
+
/**
|
|
195
|
+
* Runs the periodic cleanup of tracked jobs ( {@link JobModel} rows ) so the table doesn't grow
|
|
196
|
+
* unbounded. The concrete implementation is selected by config ( `queue.retention.service` ) and
|
|
197
|
+
* injected into the {@link QueueService} via {@link AutoinjectService}. Because it is an
|
|
198
|
+
* {@link AsyncService}, DI runs `resolve()` on injection ( where the periodic purge is started )
|
|
199
|
+
* and `dispose()` on teardown ( where it is stopped ).
|
|
200
|
+
*/
|
|
201
|
+
export class JobRetentionService extends AsyncService {
|
|
202
|
+
constructor(Options) {
|
|
203
|
+
super();
|
|
204
|
+
this.Options = Options;
|
|
205
|
+
}
|
|
206
|
+
get ServiceName() {
|
|
207
|
+
return this.Options.service;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
163
210
|
//# sourceMappingURL=interfaces.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../src/interfaces.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,YAAY,EAAe,EAAE,EAAoC,MAAM,aAAa,CAAC;AAC9F,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,CAAC,MAAM,QAAQ,CAAC;AACvB,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAEhD,MAAM,CAAN,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IAC1B,+BAAW,CAAA;IACX,mCAAe,CAAA;AACjB,CAAC,EAHW,gBAAgB,KAAhB,gBAAgB,QAG3B;AAqCD,MAAM,OAAgB,YAAa,SAAQ,YAAY;
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../src/interfaces.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,YAAY,EAAe,EAAE,EAAoC,MAAM,aAAa,CAAC;AAC9F,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,CAAC,MAAM,QAAQ,CAAC;AACvB,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAEhD,MAAM,CAAN,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IAC1B,+BAAW,CAAA;IACX,mCAAe,CAAA;AACjB,CAAC,EAHW,gBAAgB,KAAhB,gBAAgB,QAG3B;AAq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AAO,CAAC,CAAC;QACnB,CAAC;QAED,IAAI,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;YACvB,OAAO,CAAC,CAAC,IAAI,CACX,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAU,EAAE;gBACxB,IAAI,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;oBAClB,OAAO,CAAC,CAAC;gBACX,CAAC;gBAED,OAAO,CAAC,CAAC,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,mBAAoB,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,mBAAoB,CAAC,CAAC;YACtG,CAAC,CAAC,CACH,CAAC;QACJ,CAAC;QAED,OAAO,CAAC,OAAO,CAAC,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,mBAAoB,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,mBAAoB,CAAC,CAAC,CAAC;IAC9G,CAAC;CACF;AArHW;IADT,MAAM,CAAC,OAAO,CAAC;8BACD,GAAG;wCAAC;AAGT;IADT,MAAM,CAAC,eAAe,CAAC;;4CACuB;AAoMjD;;;;;;GAMG;AACH,MAAM,OAAgB,mBAAoB,SAAQ,YAAY;IAC5D,YAAmB,OAA+B;QAChD,KAAK,EAAE,CAAC;QADS,YAAO,GAAP,OAAO,CAAwB;IAElD,CAAC;IAED,IAAW,WAAW;QACpB,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC;IAC9B,CAAC;CAWF"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { OrmMigration, OrmDriver } from '@spinajs/orm';
|
|
2
|
+
/**
|
|
3
|
+
* Adds the `Attempt` column to `queue_jobs` so failed job runs can be counted
|
|
4
|
+
* and jobs can be marked `retrying` / `dead` once they exceed their RetryCount.
|
|
5
|
+
*/
|
|
6
|
+
export declare class Queue_2026_06_30_00_00_00 extends OrmMigration {
|
|
7
|
+
up(connection: OrmDriver): Promise<void>;
|
|
8
|
+
down(_connection: OrmDriver): Promise<void>;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=Queue_2026_06_30_00_00_00.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Queue_2026_06_30_00_00_00.d.ts","sourceRoot":"","sources":["../../../src/migrations/Queue_2026_06_30_00_00_00.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAa,MAAM,cAAc,CAAC;AAElE;;;GAGG;AACH,qBACa,yBAA0B,SAAQ,YAAY;IAC5C,EAAE,CAAC,UAAU,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;IAOxC,IAAI,CAAC,WAAW,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;CACzD"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
8
|
+
import { OrmMigration, Migration } from '@spinajs/orm';
|
|
9
|
+
/**
|
|
10
|
+
* Adds the `Attempt` column to `queue_jobs` so failed job runs can be counted
|
|
11
|
+
* and jobs can be marked `retrying` / `dead` once they exceed their RetryCount.
|
|
12
|
+
*/
|
|
13
|
+
let Queue_2026_06_30_00_00_00 = class Queue_2026_06_30_00_00_00 extends OrmMigration {
|
|
14
|
+
async up(connection) {
|
|
15
|
+
await connection.schema().alterTable('queue_jobs', (table) => {
|
|
16
|
+
table.int('Attempt').notNull().default().value(0);
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
20
|
+
async down(_connection) { }
|
|
21
|
+
};
|
|
22
|
+
Queue_2026_06_30_00_00_00 = __decorate([
|
|
23
|
+
Migration('queue')
|
|
24
|
+
], Queue_2026_06_30_00_00_00);
|
|
25
|
+
export { Queue_2026_06_30_00_00_00 };
|
|
26
|
+
//# sourceMappingURL=Queue_2026_06_30_00_00_00.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Queue_2026_06_30_00_00_00.js","sourceRoot":"","sources":["../../../src/migrations/Queue_2026_06_30_00_00_00.ts"],"names":[],"mappings":";;;;;;AAAA,sDAAsD;AACtD,OAAO,EAAE,YAAY,EAAa,SAAS,EAAE,MAAM,cAAc,CAAC;AAElE;;;GAGG;AAEI,IAAM,yBAAyB,GAA/B,MAAM,yBAA0B,SAAQ,YAAY;IAClD,KAAK,CAAC,EAAE,CAAC,UAAqB;QACnC,MAAM,UAAU,CAAC,MAAM,EAAE,CAAC,UAAU,CAAC,YAAY,EAAE,CAAC,KAAK,EAAE,EAAE;YAC3D,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACpD,CAAC,CAAC,CAAC;IACL,CAAC;IAED,gEAAgE;IACzD,KAAK,CAAC,IAAI,CAAC,WAAsB,IAAkB,CAAC;CAC5D,CAAA;AATY,yBAAyB;IADrC,SAAS,CAAC,OAAO,CAAC;GACN,yBAAyB,CASrC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { OrmMigration, OrmDriver } from '@spinajs/orm';
|
|
2
|
+
/**
|
|
3
|
+
* Hardens the `queue_jobs` schema:
|
|
4
|
+
* - adds LastError ( errors no longer stuffed into Result ), MaxAttempts and UpdatedAt
|
|
5
|
+
* - converts Status from a fixed ENUM to a plain string so `retrying` / `dead` ( and future
|
|
6
|
+
* statuses ) are valid on all dialects ( the ENUM previously rejected them on MySQL/MSSQL )
|
|
7
|
+
* - widens the too-small Name and Result columns
|
|
8
|
+
* - indexes (Status, CreatedAt) to support retention purge and monitoring queries
|
|
9
|
+
*/
|
|
10
|
+
export declare class Queue_2026_07_02_00_00_00 extends OrmMigration {
|
|
11
|
+
up(connection: OrmDriver): Promise<void>;
|
|
12
|
+
down(_connection: OrmDriver): Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=Queue_2026_07_02_00_00_00.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Queue_2026_07_02_00_00_00.d.ts","sourceRoot":"","sources":["../../../src/migrations/Queue_2026_07_02_00_00_00.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAa,MAAM,cAAc,CAAC;AAElE;;;;;;;GAOG;AACH,qBACa,yBAA0B,SAAQ,YAAY;IAC5C,EAAE,CAAC,UAAU,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;IA6BxC,IAAI,CAAC,WAAW,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;CACzD"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
8
|
+
import { OrmMigration, Migration } from '@spinajs/orm';
|
|
9
|
+
/**
|
|
10
|
+
* Hardens the `queue_jobs` schema:
|
|
11
|
+
* - adds LastError ( errors no longer stuffed into Result ), MaxAttempts and UpdatedAt
|
|
12
|
+
* - converts Status from a fixed ENUM to a plain string so `retrying` / `dead` ( and future
|
|
13
|
+
* statuses ) are valid on all dialects ( the ENUM previously rejected them on MySQL/MSSQL )
|
|
14
|
+
* - widens the too-small Name and Result columns
|
|
15
|
+
* - indexes (Status, CreatedAt) to support retention purge and monitoring queries
|
|
16
|
+
*/
|
|
17
|
+
let Queue_2026_07_02_00_00_00 = class Queue_2026_07_02_00_00_00 extends OrmMigration {
|
|
18
|
+
async up(connection) {
|
|
19
|
+
// additive columns work on every dialect
|
|
20
|
+
await connection.schema().alterTable('queue_jobs', (table) => {
|
|
21
|
+
table.string('LastError', 1024);
|
|
22
|
+
table.int('MaxAttempts').notNull().default().value(0);
|
|
23
|
+
table.timestamp('UpdatedAt');
|
|
24
|
+
});
|
|
25
|
+
// sqlite stores TEXT regardless of declared type/length and has no MODIFY COLUMN, so the
|
|
26
|
+
// conversions below are only needed ( and only valid ) on dialects that enforce column types.
|
|
27
|
+
const isSqlite = connection.Options.Driver.toLowerCase().includes('sqlite');
|
|
28
|
+
if (!isSqlite) {
|
|
29
|
+
await connection.schema().alterTable('queue_jobs', (table) => {
|
|
30
|
+
// MySQL's MODIFY COLUMN replaces the whole definition and silently drops anything
|
|
31
|
+
// omitted, so the 'created' default must be restated or it is lost. `.default().value()`
|
|
32
|
+
// returns the ColumnQueryBuilder (no `.modify()`), so `.modify()` is called separately
|
|
33
|
+
// on the column builder itself ( mirrors the pattern in Queue_2026_07_17 ).
|
|
34
|
+
const status = table.string('Status', 32).notNull();
|
|
35
|
+
status.default().value('created');
|
|
36
|
+
status.modify();
|
|
37
|
+
table.string('Name', 256).notNull().modify();
|
|
38
|
+
table.text('Result').modify();
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
await connection.index().table('queue_jobs').name('queue_jobs_status_created').columns(['Status', 'CreatedAt']);
|
|
42
|
+
}
|
|
43
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
44
|
+
async down(_connection) { }
|
|
45
|
+
};
|
|
46
|
+
Queue_2026_07_02_00_00_00 = __decorate([
|
|
47
|
+
Migration('queue')
|
|
48
|
+
], Queue_2026_07_02_00_00_00);
|
|
49
|
+
export { Queue_2026_07_02_00_00_00 };
|
|
50
|
+
//# sourceMappingURL=Queue_2026_07_02_00_00_00.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Queue_2026_07_02_00_00_00.js","sourceRoot":"","sources":["../../../src/migrations/Queue_2026_07_02_00_00_00.ts"],"names":[],"mappings":";;;;;;AAAA,sDAAsD;AACtD,OAAO,EAAE,YAAY,EAAa,SAAS,EAAE,MAAM,cAAc,CAAC;AAElE;;;;;;;GAOG;AAEI,IAAM,yBAAyB,GAA/B,MAAM,yBAA0B,SAAQ,YAAY;IAClD,KAAK,CAAC,EAAE,CAAC,UAAqB;QACnC,yCAAyC;QACzC,MAAM,UAAU,CAAC,MAAM,EAAE,CAAC,UAAU,CAAC,YAAY,EAAE,CAAC,KAAK,EAAE,EAAE;YAC3D,KAAK,CAAC,MAAM,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;YAChC,KAAK,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YACtD,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;QAC/B,CAAC,CAAC,CAAC;QAEH,yFAAyF;QACzF,8FAA8F;QAC9F,MAAM,QAAQ,GAAG,UAAU,CAAC,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QAC5E,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,MAAM,UAAU,CAAC,MAAM,EAAE,CAAC,UAAU,CAAC,YAAY,EAAE,CAAC,KAAK,EAAE,EAAE;gBAC3D,kFAAkF;gBAClF,yFAAyF;gBACzF,uFAAuF;gBACvF,4EAA4E;gBAC5E,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC;gBACpD,MAAM,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;gBAClC,MAAM,CAAC,MAAM,EAAE,CAAC;gBAChB,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,OAAO,EAAE,CAAC,MAAM,EAAE,CAAC;gBAC7C,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,MAAM,EAAE,CAAC;YAChC,CAAC,CAAC,CAAC;QACL,CAAC;QAED,MAAM,UAAU,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAC;IAClH,CAAC;IAED,gEAAgE;IACzD,KAAK,CAAC,IAAI,CAAC,WAAsB,IAAkB,CAAC;CAC5D,CAAA;AA/BY,yBAAyB;IADrC,SAAS,CAAC,OAAO,CAAC;GACN,yBAAyB,CA+BrC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { OrmMigration, OrmDriver } from '@spinajs/orm';
|
|
2
|
+
/**
|
|
3
|
+
* Adds nullable `Phase` and `Message` columns to `queue_jobs` so jobs can report
|
|
4
|
+
* richer progress (a phase label and message) alongside the numeric percentage.
|
|
5
|
+
*/
|
|
6
|
+
export declare class Queue_2026_07_10_00_00_00 extends OrmMigration {
|
|
7
|
+
up(connection: OrmDriver): Promise<void>;
|
|
8
|
+
down(_connection: OrmDriver): Promise<void>;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=Queue_2026_07_10_00_00_00.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Queue_2026_07_10_00_00_00.d.ts","sourceRoot":"","sources":["../../../src/migrations/Queue_2026_07_10_00_00_00.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAa,MAAM,cAAc,CAAC;AAElE;;;GAGG;AACH,qBACa,yBAA0B,SAAQ,YAAY;IAC5C,EAAE,CAAC,UAAU,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;IASxC,IAAI,CAAC,WAAW,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;CACzD"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
8
|
+
import { OrmMigration, Migration } from '@spinajs/orm';
|
|
9
|
+
/**
|
|
10
|
+
* Adds nullable `Phase` and `Message` columns to `queue_jobs` so jobs can report
|
|
11
|
+
* richer progress (a phase label and message) alongside the numeric percentage.
|
|
12
|
+
*/
|
|
13
|
+
let Queue_2026_07_10_00_00_00 = class Queue_2026_07_10_00_00_00 extends OrmMigration {
|
|
14
|
+
async up(connection) {
|
|
15
|
+
await connection.schema().alterTable('queue_jobs', (table) => {
|
|
16
|
+
// nullable by default (no notNull) - only set by jobs that report richer progress
|
|
17
|
+
table.string('Phase', 32);
|
|
18
|
+
table.string('Message', 512);
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
22
|
+
async down(_connection) { }
|
|
23
|
+
};
|
|
24
|
+
Queue_2026_07_10_00_00_00 = __decorate([
|
|
25
|
+
Migration('queue')
|
|
26
|
+
], Queue_2026_07_10_00_00_00);
|
|
27
|
+
export { Queue_2026_07_10_00_00_00 };
|
|
28
|
+
//# sourceMappingURL=Queue_2026_07_10_00_00_00.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Queue_2026_07_10_00_00_00.js","sourceRoot":"","sources":["../../../src/migrations/Queue_2026_07_10_00_00_00.ts"],"names":[],"mappings":";;;;;;AAAA,sDAAsD;AACtD,OAAO,EAAE,YAAY,EAAa,SAAS,EAAE,MAAM,cAAc,CAAC;AAElE;;;GAGG;AAEI,IAAM,yBAAyB,GAA/B,MAAM,yBAA0B,SAAQ,YAAY;IAClD,KAAK,CAAC,EAAE,CAAC,UAAqB;QACnC,MAAM,UAAU,CAAC,MAAM,EAAE,CAAC,UAAU,CAAC,YAAY,EAAE,CAAC,KAAK,EAAE,EAAE;YAC3D,kFAAkF;YAClF,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;YAC1B,KAAK,CAAC,MAAM,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;QAC/B,CAAC,CAAC,CAAC;IACL,CAAC;IAED,gEAAgE;IACzD,KAAK,CAAC,IAAI,CAAC,WAAsB,IAAkB,CAAC;CAC5D,CAAA;AAXY,yBAAyB;IADrC,SAAS,CAAC,OAAO,CAAC;GACN,yBAAyB,CAWrC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { OrmMigration, OrmDriver } from '@spinajs/orm';
|
|
2
|
+
/**
|
|
3
|
+
* Widens `queue_jobs.Status` to the six states the code actually writes.
|
|
4
|
+
* `retrying` / `dead` arrived with retry support (see index.ts) but the enum
|
|
5
|
+
* was never widened, so strict-enum drivers reject or coerce them.
|
|
6
|
+
*
|
|
7
|
+
* NOT NULL and the 'created' default are restated deliberately: MySQL's MODIFY
|
|
8
|
+
* COLUMN replaces the whole definition and silently drops anything omitted.
|
|
9
|
+
* On sqlite this alteration is a logged no-op - it renders enum as
|
|
10
|
+
* unconstrained TEXT, so there is nothing to widen there.
|
|
11
|
+
*/
|
|
12
|
+
export declare class Queue_2026_07_17_00_00_00 extends OrmMigration {
|
|
13
|
+
up(connection: OrmDriver): Promise<void>;
|
|
14
|
+
down(_connection: OrmDriver): Promise<void>;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=Queue_2026_07_17_00_00_00.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Queue_2026_07_17_00_00_00.d.ts","sourceRoot":"","sources":["../../../src/migrations/Queue_2026_07_17_00_00_00.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAa,MAAM,cAAc,CAAC;AAElE;;;;;;;;;GASG;AACH,qBACa,yBAA0B,SAAQ,YAAY;IAC5C,EAAE,CAAC,UAAU,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;IAsBxC,IAAI,CAAC,WAAW,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;CACzD"}
|