@spinajs/queue 2.0.481 → 2.0.484
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 +10 -6
package/lib/cjs/interfaces.js
CHANGED
|
@@ -12,7 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.QueueClient = exports.QueueJob = exports.QueueEvent = exports.QueueMessage = exports.QueueService = exports.QueueMessageType = void 0;
|
|
15
|
+
exports.JobRetentionService = exports.QueueClient = exports.QueueJob = exports.QueueEvent = exports.QueueMessage = exports.QueueService = exports.QueueMessageType = void 0;
|
|
16
16
|
exports.isJob = isJob;
|
|
17
17
|
const di_1 = require("@spinajs/di");
|
|
18
18
|
const luxon_1 = require("luxon");
|
|
@@ -27,7 +27,7 @@ var QueueMessageType;
|
|
|
27
27
|
class QueueService extends di_1.AsyncService {
|
|
28
28
|
getConnectionsForMessage(event) {
|
|
29
29
|
const eventName = (event.Name ?? event.name);
|
|
30
|
-
const option = this.Configuration.routing[eventName] ?? this.Configuration.default;
|
|
30
|
+
const option = (this.Configuration.routing ?? {})[eventName] ?? this.Configuration.default;
|
|
31
31
|
if (lodash_1.default.isString(option)) {
|
|
32
32
|
return [this.Configuration.default];
|
|
33
33
|
}
|
|
@@ -40,7 +40,7 @@ class QueueService extends di_1.AsyncService {
|
|
|
40
40
|
}));
|
|
41
41
|
}
|
|
42
42
|
else {
|
|
43
|
-
return [option.connection];
|
|
43
|
+
return [option.connection ?? this.Configuration.default];
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
}
|
|
@@ -95,20 +95,27 @@ class QueueEvent extends QueueMessage {
|
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
exports.QueueEvent = QueueEvent;
|
|
98
|
-
/**
|
|
99
|
-
* Jobs are executed only once even if multiple listeners waiting for it. usually used for single method call
|
|
100
|
-
* or time consuming tasks, that need to checked for result and tracked
|
|
101
|
-
*
|
|
102
|
-
* Job results are preserved
|
|
103
|
-
*/
|
|
104
98
|
class QueueJob extends QueueMessage {
|
|
105
99
|
constructor() {
|
|
106
100
|
super();
|
|
107
101
|
this.Type = QueueMessageType.Job;
|
|
108
102
|
}
|
|
103
|
+
/**
|
|
104
|
+
* Called by the consumer after a failed execute(); isFinal=true when the job was marked dead.
|
|
105
|
+
* Must not throw - errors are logged and swallowed. Override to react to failures ( e.g. send an
|
|
106
|
+
* alert on the final attempt ). No-op by default.
|
|
107
|
+
*/
|
|
108
|
+
async onFailed(_err, _ctx) { }
|
|
109
|
+
/**
|
|
110
|
+
* Emit (enqueue) this job. Returns the generated JobId so the caller can track
|
|
111
|
+
* the job's progress / status (e.g. via queue-http-progress `:jobId/status`).
|
|
112
|
+
*/
|
|
109
113
|
static async emit(val, options) {
|
|
110
114
|
const queue = await di_1.DI.resolve(QueueService);
|
|
111
115
|
const message = {
|
|
116
|
+
// jobs must not be lost by default - persist unless the caller opts out.
|
|
117
|
+
// ( val / options below can still override this )
|
|
118
|
+
Persistent: true,
|
|
112
119
|
...val,
|
|
113
120
|
Type: QueueMessageType.Job,
|
|
114
121
|
CreatedAt: val.CreatedAt ?? luxon_1.DateTime.now(),
|
|
@@ -116,7 +123,7 @@ class QueueJob extends QueueMessage {
|
|
|
116
123
|
...options,
|
|
117
124
|
};
|
|
118
125
|
// partial of queue job always is queue message
|
|
119
|
-
|
|
126
|
+
return queue.emit(message);
|
|
120
127
|
}
|
|
121
128
|
}
|
|
122
129
|
exports.QueueJob = QueueJob;
|
|
@@ -134,6 +141,30 @@ class QueueClient extends di_1.AsyncService {
|
|
|
134
141
|
__checkInstance__(creationOptions) {
|
|
135
142
|
return this.Options.name === creationOptions[0].name;
|
|
136
143
|
}
|
|
144
|
+
/**
|
|
145
|
+
*
|
|
146
|
+
* Gets dead-letter channel for message from routing table or connection default if non is set.
|
|
147
|
+
* Used by transports to redirect messages that failed processing so they don't block the queue.
|
|
148
|
+
*
|
|
149
|
+
* @param event - event/job to check
|
|
150
|
+
* @returns the dead-letter channel, or undefined if none is configured
|
|
151
|
+
*/
|
|
152
|
+
getDeadLetterChannelForMessage(event) {
|
|
153
|
+
const eName = event.Name ?? event.name ?? event.constructor.name;
|
|
154
|
+
const rOption = this.Routing?.[eName];
|
|
155
|
+
// a single route option may carry its own dead-letter channel
|
|
156
|
+
if (rOption && !lodash_1.default.isString(rOption) && !lodash_1.default.isArray(rOption) && rOption.deadLetterChannel) {
|
|
157
|
+
return rOption.deadLetterChannel;
|
|
158
|
+
}
|
|
159
|
+
// multiple routes - use the first one that declares a dead-letter channel
|
|
160
|
+
if (lodash_1.default.isArray(rOption)) {
|
|
161
|
+
const withDlq = rOption.find((x) => !lodash_1.default.isString(x) && x.deadLetterChannel);
|
|
162
|
+
if (withDlq) {
|
|
163
|
+
return withDlq.deadLetterChannel;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
return this.Options.defaultQueueDeadLetterChannel;
|
|
167
|
+
}
|
|
137
168
|
/**
|
|
138
169
|
*
|
|
139
170
|
* Gets event channel from routing table or default if non is set
|
|
@@ -144,7 +175,7 @@ class QueueClient extends di_1.AsyncService {
|
|
|
144
175
|
const options = Reflect.getMetadata('queue:options', event);
|
|
145
176
|
const eName = event.Name ?? event.name ?? event.constructor.name;
|
|
146
177
|
const isJob = event.Type ? event.Type === QueueMessageType.Job : options ? options.type === 'job' : false;
|
|
147
|
-
const rOption = this.Routing[eName];
|
|
178
|
+
const rOption = this.Routing?.[eName];
|
|
148
179
|
if (!rOption) {
|
|
149
180
|
this.Log.warn(`No routing for event ${eName} found, using default channel`);
|
|
150
181
|
return [isJob ? this.Options.defaultQueueChannel : this.Options.defaultTopicChannel];
|
|
@@ -172,4 +203,21 @@ __decorate([
|
|
|
172
203
|
(0, configuration_1.Config)('queue.routing'),
|
|
173
204
|
__metadata("design:type", Object)
|
|
174
205
|
], QueueClient.prototype, "Routing", void 0);
|
|
206
|
+
/**
|
|
207
|
+
* Runs the periodic cleanup of tracked jobs ( {@link JobModel} rows ) so the table doesn't grow
|
|
208
|
+
* unbounded. The concrete implementation is selected by config ( `queue.retention.service` ) and
|
|
209
|
+
* injected into the {@link QueueService} via {@link AutoinjectService}. Because it is an
|
|
210
|
+
* {@link AsyncService}, DI runs `resolve()` on injection ( where the periodic purge is started )
|
|
211
|
+
* and `dispose()` on teardown ( where it is stopped ).
|
|
212
|
+
*/
|
|
213
|
+
class JobRetentionService extends di_1.AsyncService {
|
|
214
|
+
constructor(Options) {
|
|
215
|
+
super();
|
|
216
|
+
this.Options = Options;
|
|
217
|
+
}
|
|
218
|
+
get ServiceName() {
|
|
219
|
+
return this.Options.service;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
exports.JobRetentionService = JobRetentionService;
|
|
175
223
|
//# sourceMappingURL=interfaces.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../src/interfaces.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../src/interfaces.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAoFA,sBAEC;AAtFD,oCAA8F;AAC9F,iCAAiC;AACjC,oDAAuB;AACvB,sCAA2C;AAC3C,0DAAgD;AAEhD,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IAC1B,+BAAW,CAAA;IACX,mCAAe,CAAA;AACjB,CAAC,EAHW,gBAAgB,gCAAhB,gBAAgB,QAG3B;AAqCD,MAAsB,YAAa,SAAQ,iBAAY;IAc3C,wBAAwB,CAAC,KAAgD;QACjF,MAAM,SAAS,GAAG,CAAE,KAAuB,CAAC,IAAI,IAAK,KAAmC,CAAC,IAAI,CAAW,CAAC;QACzG,MAAM,MAAM,GAAyE,CAAC,IAAI,CAAC,aAAa,CAAC,OAAO,IAAI,EAAE,CAAS,CAAC,SAAS,CAAC,IAAI,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC;QAEzK,IAAI,gBAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;YACvB,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;QACtC,CAAC;QAED,IAAI,gBAAC,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;YACtB,OAAO,gBAAC,CAAC,IAAI,CACX,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAU,EAAE;gBACvB,IAAI,gBAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;oBAClB,OAAO,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC;gBACpC,CAAC;gBAED,OAAO,CAAC,CAAC,UAAU,IAAI,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC;YACpD,CAAC,CAAC,CACH,CAAC;QACJ,CAAC;aAAM,CAA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EAAC,eAAe,CAAC;;4CACuB;AAoMjD;;;;;;GAMG;AACH,MAAsB,mBAAoB,SAAQ,iBAAY;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;AAlBD,kDAkBC"}
|
|
@@ -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,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
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;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.Queue_2026_06_30_00_00_00 = void 0;
|
|
10
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
11
|
+
const orm_1 = require("@spinajs/orm");
|
|
12
|
+
/**
|
|
13
|
+
* Adds the `Attempt` column to `queue_jobs` so failed job runs can be counted
|
|
14
|
+
* and jobs can be marked `retrying` / `dead` once they exceed their RetryCount.
|
|
15
|
+
*/
|
|
16
|
+
let Queue_2026_06_30_00_00_00 = class Queue_2026_06_30_00_00_00 extends orm_1.OrmMigration {
|
|
17
|
+
async up(connection) {
|
|
18
|
+
await connection.schema().alterTable('queue_jobs', (table) => {
|
|
19
|
+
table.int('Attempt').notNull().default().value(0);
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
23
|
+
async down(_connection) { }
|
|
24
|
+
};
|
|
25
|
+
exports.Queue_2026_06_30_00_00_00 = Queue_2026_06_30_00_00_00;
|
|
26
|
+
exports.Queue_2026_06_30_00_00_00 = Queue_2026_06_30_00_00_00 = __decorate([
|
|
27
|
+
(0, orm_1.Migration)('queue')
|
|
28
|
+
], Queue_2026_06_30_00_00_00);
|
|
29
|
+
//# 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,sCAAkE;AAElE;;;GAGG;AAEI,IAAM,yBAAyB,GAA/B,MAAM,yBAA0B,SAAQ,kBAAY;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,8DAAyB;oCAAzB,yBAAyB;IADrC,IAAA,eAAS,EAAC,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,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
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;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.Queue_2026_07_02_00_00_00 = void 0;
|
|
10
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
11
|
+
const orm_1 = require("@spinajs/orm");
|
|
12
|
+
/**
|
|
13
|
+
* Hardens the `queue_jobs` schema:
|
|
14
|
+
* - adds LastError ( errors no longer stuffed into Result ), MaxAttempts and UpdatedAt
|
|
15
|
+
* - converts Status from a fixed ENUM to a plain string so `retrying` / `dead` ( and future
|
|
16
|
+
* statuses ) are valid on all dialects ( the ENUM previously rejected them on MySQL/MSSQL )
|
|
17
|
+
* - widens the too-small Name and Result columns
|
|
18
|
+
* - indexes (Status, CreatedAt) to support retention purge and monitoring queries
|
|
19
|
+
*/
|
|
20
|
+
let Queue_2026_07_02_00_00_00 = class Queue_2026_07_02_00_00_00 extends orm_1.OrmMigration {
|
|
21
|
+
async up(connection) {
|
|
22
|
+
// additive columns work on every dialect
|
|
23
|
+
await connection.schema().alterTable('queue_jobs', (table) => {
|
|
24
|
+
table.string('LastError', 1024);
|
|
25
|
+
table.int('MaxAttempts').notNull().default().value(0);
|
|
26
|
+
table.timestamp('UpdatedAt');
|
|
27
|
+
});
|
|
28
|
+
// sqlite stores TEXT regardless of declared type/length and has no MODIFY COLUMN, so the
|
|
29
|
+
// conversions below are only needed ( and only valid ) on dialects that enforce column types.
|
|
30
|
+
const isSqlite = connection.Options.Driver.toLowerCase().includes('sqlite');
|
|
31
|
+
if (!isSqlite) {
|
|
32
|
+
await connection.schema().alterTable('queue_jobs', (table) => {
|
|
33
|
+
// MySQL's MODIFY COLUMN replaces the whole definition and silently drops anything
|
|
34
|
+
// omitted, so the 'created' default must be restated or it is lost. `.default().value()`
|
|
35
|
+
// returns the ColumnQueryBuilder (no `.modify()`), so `.modify()` is called separately
|
|
36
|
+
// on the column builder itself ( mirrors the pattern in Queue_2026_07_17 ).
|
|
37
|
+
const status = table.string('Status', 32).notNull();
|
|
38
|
+
status.default().value('created');
|
|
39
|
+
status.modify();
|
|
40
|
+
table.string('Name', 256).notNull().modify();
|
|
41
|
+
table.text('Result').modify();
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
await connection.index().table('queue_jobs').name('queue_jobs_status_created').columns(['Status', 'CreatedAt']);
|
|
45
|
+
}
|
|
46
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
47
|
+
async down(_connection) { }
|
|
48
|
+
};
|
|
49
|
+
exports.Queue_2026_07_02_00_00_00 = Queue_2026_07_02_00_00_00;
|
|
50
|
+
exports.Queue_2026_07_02_00_00_00 = Queue_2026_07_02_00_00_00 = __decorate([
|
|
51
|
+
(0, orm_1.Migration)('queue')
|
|
52
|
+
], Queue_2026_07_02_00_00_00);
|
|
53
|
+
//# sourceMappingURL=Queue_2026_07_02_00_00_00.js.map
|
|
@@ -0,0 +1 @@
|
|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,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,8DAAyB;oCAAzB,yBAAyB;IADrC,IAAA,eAAS,EAAC,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,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
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;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.Queue_2026_07_10_00_00_00 = void 0;
|
|
10
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
11
|
+
const orm_1 = require("@spinajs/orm");
|
|
12
|
+
/**
|
|
13
|
+
* Adds nullable `Phase` and `Message` columns to `queue_jobs` so jobs can report
|
|
14
|
+
* richer progress (a phase label and message) alongside the numeric percentage.
|
|
15
|
+
*/
|
|
16
|
+
let Queue_2026_07_10_00_00_00 = class Queue_2026_07_10_00_00_00 extends orm_1.OrmMigration {
|
|
17
|
+
async up(connection) {
|
|
18
|
+
await connection.schema().alterTable('queue_jobs', (table) => {
|
|
19
|
+
// nullable by default (no notNull) - only set by jobs that report richer progress
|
|
20
|
+
table.string('Phase', 32);
|
|
21
|
+
table.string('Message', 512);
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
25
|
+
async down(_connection) { }
|
|
26
|
+
};
|
|
27
|
+
exports.Queue_2026_07_10_00_00_00 = Queue_2026_07_10_00_00_00;
|
|
28
|
+
exports.Queue_2026_07_10_00_00_00 = Queue_2026_07_10_00_00_00 = __decorate([
|
|
29
|
+
(0, orm_1.Migration)('queue')
|
|
30
|
+
], Queue_2026_07_10_00_00_00);
|
|
31
|
+
//# 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,sCAAkE;AAElE;;;GAGG;AAEI,IAAM,yBAAyB,GAA/B,MAAM,yBAA0B,SAAQ,kBAAY;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,8DAAyB;oCAAzB,yBAAyB;IADrC,IAAA,eAAS,EAAC,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"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
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;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.Queue_2026_07_17_00_00_00 = void 0;
|
|
10
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
11
|
+
const orm_1 = require("@spinajs/orm");
|
|
12
|
+
/**
|
|
13
|
+
* Widens `queue_jobs.Status` to the six states the code actually writes.
|
|
14
|
+
* `retrying` / `dead` arrived with retry support (see index.ts) but the enum
|
|
15
|
+
* was never widened, so strict-enum drivers reject or coerce them.
|
|
16
|
+
*
|
|
17
|
+
* NOT NULL and the 'created' default are restated deliberately: MySQL's MODIFY
|
|
18
|
+
* COLUMN replaces the whole definition and silently drops anything omitted.
|
|
19
|
+
* On sqlite this alteration is a logged no-op - it renders enum as
|
|
20
|
+
* unconstrained TEXT, so there is nothing to widen there.
|
|
21
|
+
*/
|
|
22
|
+
let Queue_2026_07_17_00_00_00 = class Queue_2026_07_17_00_00_00 extends orm_1.OrmMigration {
|
|
23
|
+
async up(connection) {
|
|
24
|
+
// sqlite renders enum as unconstrained TEXT and has no MODIFY COLUMN, so there is
|
|
25
|
+
// nothing to widen there. Emitting the MODIFY anyway produces a MySQL-flavoured
|
|
26
|
+
// `ALTER TABLE ... MODIFY ... ENUM(...)` that sqlite rejects, so skip it explicitly
|
|
27
|
+
// ( mirrors the guard in Queue_2026_07_02, and matches this migration's documented
|
|
28
|
+
// "no-op on sqlite" contract above ).
|
|
29
|
+
const isSqlite = connection.Options.Driver.toLowerCase().includes('sqlite');
|
|
30
|
+
if (isSqlite) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
await connection.schema().alterTable('queue_jobs', (table) => {
|
|
34
|
+
// `.default().value('created')` returns the ColumnQueryBuilder, which has no
|
|
35
|
+
// `.modify()` - that lives on AlterColumnQueryBuilder. So `.modify()` must be
|
|
36
|
+
// called on the column builder itself, separately from the default.
|
|
37
|
+
const status = table.enum('Status', ['error', 'success', 'created', 'executing', 'retrying', 'dead']).notNull();
|
|
38
|
+
status.default().value('created');
|
|
39
|
+
status.modify();
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
43
|
+
async down(_connection) { }
|
|
44
|
+
};
|
|
45
|
+
exports.Queue_2026_07_17_00_00_00 = Queue_2026_07_17_00_00_00;
|
|
46
|
+
exports.Queue_2026_07_17_00_00_00 = Queue_2026_07_17_00_00_00 = __decorate([
|
|
47
|
+
(0, orm_1.Migration)('queue')
|
|
48
|
+
], Queue_2026_07_17_00_00_00);
|
|
49
|
+
//# sourceMappingURL=Queue_2026_07_17_00_00_00.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Queue_2026_07_17_00_00_00.js","sourceRoot":"","sources":["../../../src/migrations/Queue_2026_07_17_00_00_00.ts"],"names":[],"mappings":";;;;;;;;;AAAA,sDAAsD;AACtD,sCAAkE;AAElE;;;;;;;;;GASG;AAEI,IAAM,yBAAyB,GAA/B,MAAM,yBAA0B,SAAQ,kBAAY;IAClD,KAAK,CAAC,EAAE,CAAC,UAAqB;QACnC,kFAAkF;QAClF,gFAAgF;QAChF,oFAAoF;QACpF,mFAAmF;QACnF,sCAAsC;QACtC,MAAM,QAAQ,GAAG,UAAU,CAAC,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QAC5E,IAAI,QAAQ,EAAE,CAAC;YACb,OAAO;QACT,CAAC;QAED,MAAM,UAAU,CAAC,MAAM,EAAE,CAAC,UAAU,CAAC,YAAY,EAAE,CAAC,KAAK,EAAE,EAAE;YAC3D,6EAA6E;YAC7E,8EAA8E;YAC9E,oEAAoE;YACpE,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;YAChH,MAAM,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;YAClC,MAAM,CAAC,MAAM,EAAE,CAAC;QAClB,CAAC,CAAC,CAAC;IACL,CAAC;IAED,gEAAgE;IACzD,KAAK,CAAC,IAAI,CAAC,WAAsB,IAAkB,CAAC;CAC5D,CAAA;AAxBY,8DAAyB;oCAAzB,yBAAyB;IADrC,IAAA,eAAS,EAAC,OAAO,CAAC;GACN,yBAAyB,CAwBrC"}
|
|
@@ -1,18 +1,80 @@
|
|
|
1
1
|
import { DateTime } from 'luxon';
|
|
2
|
-
import { ModelBase } from '@spinajs/orm';
|
|
2
|
+
import { ModelBase, QueryScope, ISelectQueryBuilder } from '@spinajs/orm';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Possible job lifecycle statuses.
|
|
5
|
+
* - created: dispatched, not yet picked up
|
|
6
|
+
* - executing: currently running
|
|
7
|
+
* - retrying: failed, will be retried
|
|
8
|
+
* - success: finished ok ( terminal )
|
|
9
|
+
* - error: legacy generic failure ( terminal )
|
|
10
|
+
* - dead: failed and retries exhausted / dead-lettered ( terminal )
|
|
11
|
+
*/
|
|
12
|
+
export type JobStatus = 'created' | 'executing' | 'retrying' | 'success' | 'error' | 'dead';
|
|
13
|
+
/** Statuses a job can no longer leave - safe to report as done / purge. */
|
|
14
|
+
export declare const JOB_TERMINAL_STATUSES: JobStatus[];
|
|
15
|
+
/** Statuses of jobs still in flight. */
|
|
16
|
+
export declare const JOB_ACTIVE_STATUSES: JobStatus[];
|
|
17
|
+
/**
|
|
18
|
+
* Reusable query scopes for {@link JobModel}. Available on any JobModel query
|
|
19
|
+
* ( select / update / destroy ), so callers compose readable, safe queries eg.
|
|
5
20
|
*
|
|
21
|
+
* await JobModel.destroy().terminal().olderThan(cutoff);
|
|
22
|
+
* await JobModel.query().byJobId(id).first();
|
|
23
|
+
*/
|
|
24
|
+
export declare class JobQueryScopes implements QueryScope {
|
|
25
|
+
byJobId(this: ISelectQueryBuilder<JobModel[]> & JobQueryScopes, jobId: string): ISelectQueryBuilder<JobModel<unknown>[]> & JobQueryScopes;
|
|
26
|
+
withStatus(this: ISelectQueryBuilder<JobModel[]> & JobQueryScopes, status: JobStatus | JobStatus[]): ISelectQueryBuilder<JobModel<unknown>[]> & JobQueryScopes;
|
|
27
|
+
/** Jobs in a terminal state ( success / error / dead ). */
|
|
28
|
+
terminal(this: ISelectQueryBuilder<JobModel[]> & JobQueryScopes): ISelectQueryBuilder<JobModel<unknown>[]> & JobQueryScopes;
|
|
29
|
+
/** Jobs still in flight ( created / executing / retrying ). */
|
|
30
|
+
active(this: ISelectQueryBuilder<JobModel[]> & JobQueryScopes): ISelectQueryBuilder<JobModel<unknown>[]> & JobQueryScopes;
|
|
31
|
+
/** Jobs created before the given moment ( row age ). */
|
|
32
|
+
olderThan(this: ISelectQueryBuilder<JobModel[]> & JobQueryScopes, date: DateTime): ISelectQueryBuilder<JobModel<unknown>[]> & JobQueryScopes;
|
|
33
|
+
/** Jobs finished before the given moment. */
|
|
34
|
+
finishedBefore(this: ISelectQueryBuilder<JobModel[]> & JobQueryScopes, date: DateTime): ISelectQueryBuilder<JobModel<unknown>[]> & JobQueryScopes;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Tracks a dispatched job: its status, progress, result / error and timing.
|
|
38
|
+
* One row per emitted job, keyed by the unique {@link JobModel.JobId}.
|
|
6
39
|
*/
|
|
7
|
-
export declare class JobModel<T> extends ModelBase {
|
|
40
|
+
export declare class JobModel<T = unknown> extends ModelBase {
|
|
41
|
+
static readonly _queryScopes: JobQueryScopes;
|
|
8
42
|
Id: number;
|
|
9
43
|
JobId: string;
|
|
10
44
|
Name: string;
|
|
45
|
+
/**
|
|
46
|
+
* The job's successful result. Failures are recorded in {@link JobModel.LastError},
|
|
47
|
+
* so this holds only the actual output.
|
|
48
|
+
*/
|
|
11
49
|
Result: T;
|
|
12
|
-
Status:
|
|
50
|
+
Status: JobStatus;
|
|
13
51
|
Progress: number;
|
|
52
|
+
/**
|
|
53
|
+
* Optional human-facing progress phase (e.g. `loading`, `rendering`), set by
|
|
54
|
+
* jobs that report richer progress than a bare percentage. Nullable.
|
|
55
|
+
*/
|
|
56
|
+
Phase: string;
|
|
57
|
+
/**
|
|
58
|
+
* Optional human-facing progress message accompanying {@link Phase}. Nullable.
|
|
59
|
+
*/
|
|
60
|
+
Message: string;
|
|
61
|
+
/**
|
|
62
|
+
* Number of times job execution has been attempted. Incremented on every failed run.
|
|
63
|
+
* Once it reaches {@link JobModel.MaxAttempts} the job is marked as `dead`.
|
|
64
|
+
*/
|
|
65
|
+
Attempt: number;
|
|
66
|
+
/**
|
|
67
|
+
* Total allowed executions for the job ( RetryCount + 1 ) captured at first receipt.
|
|
68
|
+
* Lets consumers render `Attempt / MaxAttempts` ( e.g. "attempt 2 of 2" ).
|
|
69
|
+
*/
|
|
70
|
+
MaxAttempts: number;
|
|
71
|
+
/**
|
|
72
|
+
* Last error message when the job failed or was retried. Kept separate from Result.
|
|
73
|
+
*/
|
|
74
|
+
LastError: string;
|
|
14
75
|
Connection: string;
|
|
15
76
|
CreatedAt: DateTime;
|
|
77
|
+
UpdatedAt: DateTime;
|
|
16
78
|
ExecutedAt: DateTime;
|
|
17
79
|
FinishedAt: DateTime;
|
|
18
80
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JobModel.d.ts","sourceRoot":"","sources":["../../../src/models/JobModel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"JobModel.d.ts","sourceRoot":"","sources":["../../../src/models/JobModel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,SAAS,EAA0E,UAAU,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAElJ;;;;;;;;GAQG;AACH,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,WAAW,GAAG,UAAU,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,CAAC;AAE5F,2EAA2E;AAC3E,eAAO,MAAM,qBAAqB,EAAE,SAAS,EAAiC,CAAC;AAE/E,wCAAwC;AACxC,eAAO,MAAM,mBAAmB,EAAE,SAAS,EAAyC,CAAC;AAErF;;;;;;GAMG;AACH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AGnB,SAAS,EAAE,QAAQ,CAAC;IAGpB,SAAS,EAAE,QAAQ,CAAC;IAGpB,UAAU,EAAE,QAAQ,CAAC;IAGrB,UAAU,EAAE,QAAQ,CAAC;CAC7B"}
|
|
@@ -9,16 +9,53 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.JobModel = void 0;
|
|
12
|
+
exports.JobModel = exports.JobQueryScopes = exports.JOB_ACTIVE_STATUSES = exports.JOB_TERMINAL_STATUSES = void 0;
|
|
13
13
|
const luxon_1 = require("luxon");
|
|
14
14
|
const orm_1 = require("@spinajs/orm");
|
|
15
|
+
/** Statuses a job can no longer leave - safe to report as done / purge. */
|
|
16
|
+
exports.JOB_TERMINAL_STATUSES = ['success', 'error', 'dead'];
|
|
17
|
+
/** Statuses of jobs still in flight. */
|
|
18
|
+
exports.JOB_ACTIVE_STATUSES = ['created', 'executing', 'retrying'];
|
|
15
19
|
/**
|
|
16
|
-
*
|
|
20
|
+
* Reusable query scopes for {@link JobModel}. Available on any JobModel query
|
|
21
|
+
* ( select / update / destroy ), so callers compose readable, safe queries eg.
|
|
17
22
|
*
|
|
23
|
+
* await JobModel.destroy().terminal().olderThan(cutoff);
|
|
24
|
+
* await JobModel.query().byJobId(id).first();
|
|
25
|
+
*/
|
|
26
|
+
class JobQueryScopes {
|
|
27
|
+
byJobId(jobId) {
|
|
28
|
+
return this.where('JobId', jobId);
|
|
29
|
+
}
|
|
30
|
+
withStatus(status) {
|
|
31
|
+
return Array.isArray(status) ? this.whereIn('Status', status) : this.where('Status', status);
|
|
32
|
+
}
|
|
33
|
+
/** Jobs in a terminal state ( success / error / dead ). */
|
|
34
|
+
terminal() {
|
|
35
|
+
return this.whereIn('Status', exports.JOB_TERMINAL_STATUSES);
|
|
36
|
+
}
|
|
37
|
+
/** Jobs still in flight ( created / executing / retrying ). */
|
|
38
|
+
active() {
|
|
39
|
+
return this.whereIn('Status', exports.JOB_ACTIVE_STATUSES);
|
|
40
|
+
}
|
|
41
|
+
/** Jobs created before the given moment ( row age ). */
|
|
42
|
+
olderThan(date) {
|
|
43
|
+
return this.where('CreatedAt', '<', date);
|
|
44
|
+
}
|
|
45
|
+
/** Jobs finished before the given moment. */
|
|
46
|
+
finishedBefore(date) {
|
|
47
|
+
return this.where('FinishedAt', '<', date);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
exports.JobQueryScopes = JobQueryScopes;
|
|
51
|
+
/**
|
|
52
|
+
* Tracks a dispatched job: its status, progress, result / error and timing.
|
|
53
|
+
* One row per emitted job, keyed by the unique {@link JobModel.JobId}.
|
|
18
54
|
*/
|
|
19
55
|
let JobModel = class JobModel extends orm_1.ModelBase {
|
|
20
56
|
};
|
|
21
57
|
exports.JobModel = JobModel;
|
|
58
|
+
JobModel._queryScopes = new JobQueryScopes();
|
|
22
59
|
__decorate([
|
|
23
60
|
(0, orm_1.Primary)(),
|
|
24
61
|
__metadata("design:type", Number)
|
|
@@ -31,6 +68,10 @@ __decorate([
|
|
|
31
68
|
(0, orm_1.CreatedAt)(),
|
|
32
69
|
__metadata("design:type", luxon_1.DateTime)
|
|
33
70
|
], JobModel.prototype, "CreatedAt", void 0);
|
|
71
|
+
__decorate([
|
|
72
|
+
(0, orm_1.UpdatedAt)(),
|
|
73
|
+
__metadata("design:type", luxon_1.DateTime)
|
|
74
|
+
], JobModel.prototype, "UpdatedAt", void 0);
|
|
34
75
|
__decorate([
|
|
35
76
|
(0, orm_1.DateTime)(),
|
|
36
77
|
__metadata("design:type", luxon_1.DateTime)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JobModel.js","sourceRoot":"","sources":["../../../src/models/JobModel.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iCAAiC;AACjC,
|
|
1
|
+
{"version":3,"file":"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,qBAAY,GAAmB,IAAI,cAAc,EAAE,AAAvC,CAAwC;AAGpE;IADN,IAAA,aAAO,GAAE;;oCACQ;AAWX;IADN,IAAA,UAAI,GAAE;;wCACU;AAqCV;IADN,IAAA,eAAS,GAAE;8BACM,gBAAQ;2CAAC;AAGpB;IADN,IAAA,eAAS,GAAE;8BACM,gBAAQ;2CAAC;AAGpB;IADN,IAAA,cAAE,GAAE;8BACc,gBAAQ;4CAAC;AAGrB;IADN,IAAA,cAAE,GAAE;8BACc,gBAAQ;4CAAC;mBA7DjB,QAAQ;IAFpB,IAAA,gBAAU,EAAC,OAAO,CAAC;IACnB,IAAA,WAAK,EAAC,YAAY,CAAC;GACP,QAAQ,CA8DpB"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Log } from '@spinajs/log';
|
|
2
|
+
import { DateTime } from 'luxon';
|
|
3
|
+
import { JobRetentionService } from '../interfaces.js';
|
|
4
|
+
/**
|
|
5
|
+
* Built-in {@link JobRetentionService}. Periodically deletes terminal jobs older than the
|
|
6
|
+
* configured `maxAge` so the `queue_jobs` table doesn't grow unbounded. All timings / statuses
|
|
7
|
+
* come from the injected `queue.retention` config block - nothing is hardcoded except the
|
|
8
|
+
* fallback interval used when none is configured.
|
|
9
|
+
*/
|
|
10
|
+
export declare class DefaultJobRetentionService extends JobRetentionService {
|
|
11
|
+
protected Log: Log;
|
|
12
|
+
protected RetentionTimer?: ReturnType<typeof setInterval>;
|
|
13
|
+
resolve(): Promise<void>;
|
|
14
|
+
dispose(): Promise<void>;
|
|
15
|
+
/**
|
|
16
|
+
* Starts the periodic job-retention purge when configured. No-op if retention is disabled
|
|
17
|
+
* or no `maxAge` is set.
|
|
18
|
+
*/
|
|
19
|
+
protected startRetention(): void;
|
|
20
|
+
/**
|
|
21
|
+
* Deletes terminal ( or given ) jobs created before `olderThan`. The set is selected with the
|
|
22
|
+
* JobModel query scopes ( status + date ), then removed by id.
|
|
23
|
+
*/
|
|
24
|
+
purgeJobs(olderThan: DateTime, statuses?: string[]): Promise<number>;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=JobRetentionService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JobRetentionService.d.ts","sourceRoot":"","sources":["../../../src/services/JobRetentionService.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAU,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAQvD;;;;;GAKG;AACH,qBACa,0BAA2B,SAAQ,mBAAmB;IAEjE,SAAS,CAAC,GAAG,EAAE,GAAG,CAAC;IAEnB,SAAS,CAAC,cAAc,CAAC,EAAE,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC;IAE7C,OAAO;IAIP,OAAO;IAOpB;;;OAGG;IACH,SAAS,CAAC,cAAc;IAyBxB;;;OAGG;IACU,SAAS,CAAC,SAAS,EAAE,QAAQ,EAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC;CAclF"}
|