@nest-native/jobs 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +115 -0
- package/dist/dialects/mysql/index.d.ts +2 -0
- package/dist/dialects/mysql/index.js +21 -0
- package/dist/dialects/mysql/index.js.map +1 -0
- package/dist/dialects/mysql/job-store.d.ts +35 -0
- package/dist/dialects/mysql/job-store.js +150 -0
- package/dist/dialects/mysql/job-store.js.map +1 -0
- package/dist/dialects/mysql/schema.d.ts +255 -0
- package/dist/dialects/mysql/schema.js +47 -0
- package/dist/dialects/mysql/schema.js.map +1 -0
- package/dist/dialects/postgres/index.d.ts +2 -0
- package/dist/dialects/postgres/index.js +21 -0
- package/dist/dialects/postgres/index.js.map +1 -0
- package/dist/dialects/postgres/job-store.d.ts +32 -0
- package/dist/dialects/postgres/job-store.js +145 -0
- package/dist/dialects/postgres/job-store.js.map +1 -0
- package/dist/dialects/postgres/schema.d.ts +262 -0
- package/dist/dialects/postgres/schema.js +37 -0
- package/dist/dialects/postgres/schema.js.map +1 -0
- package/dist/dialects/sqlite/index.d.ts +2 -0
- package/dist/dialects/sqlite/index.js +21 -0
- package/dist/dialects/sqlite/index.js.map +1 -0
- package/dist/dialects/sqlite/job-store.d.ts +32 -0
- package/dist/dialects/sqlite/job-store.js +155 -0
- package/dist/dialects/sqlite/job-store.js.map +1 -0
- package/dist/dialects/sqlite/schema.d.ts +279 -0
- package/dist/dialects/sqlite/schema.js +37 -0
- package/dist/dialects/sqlite/schema.js.map +1 -0
- package/dist/enqueue-input.d.ts +12 -0
- package/dist/enqueue-input.js +26 -0
- package/dist/enqueue-input.js.map +1 -0
- package/dist/errors.d.ts +18 -0
- package/dist/errors.js +33 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +30 -0
- package/dist/index.js.map +1 -0
- package/dist/interfaces.d.ts +125 -0
- package/dist/interfaces.js +10 -0
- package/dist/interfaces.js.map +1 -0
- package/dist/job-handler.decorator.d.ts +31 -0
- package/dist/job-handler.decorator.js +18 -0
- package/dist/job-handler.decorator.js.map +1 -0
- package/dist/jobs-claimer.service.d.ts +37 -0
- package/dist/jobs-claimer.service.js +121 -0
- package/dist/jobs-claimer.service.js.map +1 -0
- package/dist/jobs-handler.explorer.d.ts +24 -0
- package/dist/jobs-handler.explorer.js +67 -0
- package/dist/jobs-handler.explorer.js.map +1 -0
- package/dist/jobs-worker.d.ts +21 -0
- package/dist/jobs-worker.js +40 -0
- package/dist/jobs-worker.js.map +1 -0
- package/dist/jobs.module.d.ts +19 -0
- package/dist/jobs.module.js +49 -0
- package/dist/jobs.module.js.map +1 -0
- package/dist/jobs.service.d.ts +25 -0
- package/dist/jobs.service.js +55 -0
- package/dist/jobs.service.js.map +1 -0
- package/dist/testing/harness.d.ts +61 -0
- package/dist/testing/harness.js +86 -0
- package/dist/testing/harness.js.map +1 -0
- package/dist/testing/index.d.ts +1 -0
- package/dist/testing/index.js +19 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/tokens.d.ts +10 -0
- package/dist/tokens.js +15 -0
- package/dist/tokens.js.map +1 -0
- package/package.json +107 -0
|
@@ -0,0 +1,55 @@
|
|
|
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
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.JobsService = void 0;
|
|
16
|
+
const common_1 = require("@nestjs/common");
|
|
17
|
+
const transactional_1 = require("@nestjs-cls/transactional");
|
|
18
|
+
const tokens_1 = require("./tokens");
|
|
19
|
+
/**
|
|
20
|
+
* Enqueues jobs **inside the caller's business transaction** — the job row
|
|
21
|
+
* commits atomically with your writes. Inject it into a `@Transactional()`
|
|
22
|
+
* service and call `enqueue` alongside your business writes; if the
|
|
23
|
+
* transaction rolls back, the job was never enqueued.
|
|
24
|
+
*
|
|
25
|
+
* `enqueue` returns the store's native shape: the **sqlite** store returns a
|
|
26
|
+
* synchronous `JobRow` (call it without `await` inside a synchronous
|
|
27
|
+
* `@Transactional` body); the **postgres** and **mysql** stores return a
|
|
28
|
+
* `Promise` (await it). Type the service as `JobsService<typeof yourStore>` to get the
|
|
29
|
+
* exact shape. On a `(name, uniqueKey)` collision with an ACTIVE job it
|
|
30
|
+
* returns that existing row — a dedup no-op.
|
|
31
|
+
*
|
|
32
|
+
* Requires the host app to configure `@nestjs-cls/transactional` with the
|
|
33
|
+
* Drizzle adapter (`enableTransactionProxy: true`) — `@InjectTransaction()`
|
|
34
|
+
* resolves the transaction-scoped Drizzle instance from it (and falls back to
|
|
35
|
+
* the base instance outside any transaction).
|
|
36
|
+
*/
|
|
37
|
+
let JobsService = class JobsService {
|
|
38
|
+
constructor(db, store) {
|
|
39
|
+
this.db = db;
|
|
40
|
+
this.store = store;
|
|
41
|
+
}
|
|
42
|
+
// TPayload keeps the input structural: a payload typed as a plain interface
|
|
43
|
+
// compiles without casting (see EnqueueJobInput). The store widens it internally.
|
|
44
|
+
enqueue(input) {
|
|
45
|
+
return this.store.enqueue(this.db, input);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
exports.JobsService = JobsService;
|
|
49
|
+
exports.JobsService = JobsService = __decorate([
|
|
50
|
+
(0, common_1.Injectable)(),
|
|
51
|
+
__param(0, (0, transactional_1.InjectTransaction)()),
|
|
52
|
+
__param(1, (0, common_1.Inject)(tokens_1.JOBS_STORE)),
|
|
53
|
+
__metadata("design:paramtypes", [Object, Object])
|
|
54
|
+
], JobsService);
|
|
55
|
+
//# sourceMappingURL=jobs.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jobs.service.js","sourceRoot":"","sources":["../jobs.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAoD;AACpD,6DAA8D;AAE9D,qCAAsC;AAEtC;;;;;;;;;;;;;;;;;GAiBG;AAEI,IAAM,WAAW,GAAjB,MAAM,WAAW;IACtB,YACwC,EAAW,EACZ,KAAa;QADZ,OAAE,GAAF,EAAE,CAAS;QACZ,UAAK,GAAL,KAAK,CAAQ;IACjD,CAAC;IAEJ,4EAA4E;IAC5E,kFAAkF;IAClF,OAAO,CACL,KAAgC;QAEhC,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK,CAAkC,CAAC;IAC7E,CAAC;CACF,CAAA;AAbY,kCAAW;sBAAX,WAAW;IADvB,IAAA,mBAAU,GAAE;IAGR,WAAA,IAAA,iCAAiB,GAAE,CAAA;IACnB,WAAA,IAAA,eAAM,EAAC,mBAAU,CAAC,CAAA;;GAHV,WAAW,CAavB"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { JobContext } from '../interfaces';
|
|
2
|
+
import type { JobHandler } from '../job-handler.decorator';
|
|
3
|
+
import type { JobsClaimer, TickReport } from '../jobs-claimer.service';
|
|
4
|
+
import type { RunnerConfig } from '../interfaces';
|
|
5
|
+
export interface DrainJobsOptions {
|
|
6
|
+
/** Runner overrides applied to every tick. */
|
|
7
|
+
runner?: RunnerConfig;
|
|
8
|
+
/**
|
|
9
|
+
* Safety valve: maximum ticks before giving up (default 100). Prevents a
|
|
10
|
+
* test from spinning forever when a job keeps retrying with no delay.
|
|
11
|
+
*/
|
|
12
|
+
maxTicks?: number;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Ticks the claimer until a tick claims nothing, aggregating the reports —
|
|
16
|
+
* "run everything that is currently due" in one await:
|
|
17
|
+
*
|
|
18
|
+
* ```ts
|
|
19
|
+
* const report = await drainJobs(app.get(JobsClaimer));
|
|
20
|
+
* assert.equal(report.completed, 3);
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* Note: jobs a tick reschedules into the future (retry backoff, delayMs) are
|
|
24
|
+
* not due, so a drain settles even while retries are pending — advance time
|
|
25
|
+
* (or wait) and drain again to run them.
|
|
26
|
+
*/
|
|
27
|
+
export declare function drainJobs(claimer: JobsClaimer, options?: DrainJobsOptions): Promise<TickReport>;
|
|
28
|
+
/** One recorded handler execution. */
|
|
29
|
+
export interface RecordedJobExecution {
|
|
30
|
+
payload: Record<string, unknown>;
|
|
31
|
+
ctx: JobContext;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* A {@link JobHandler} implementation that records every execution and can be
|
|
35
|
+
* armed to fail — once (`failNextWith`, ideal for throw-then-succeed retry
|
|
36
|
+
* tests) or persistently (`failWith`). Executions are recorded BEFORE the
|
|
37
|
+
* failure is thrown, so `executions()` reflects every attempt the claimer made.
|
|
38
|
+
*
|
|
39
|
+
* Subclass it to attach the decorator:
|
|
40
|
+
*
|
|
41
|
+
* ```ts
|
|
42
|
+
* @JobHandler('email.welcome')
|
|
43
|
+
* class WelcomeHandler extends RecordingJobHandler {}
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
export declare class RecordingJobHandler implements JobHandler {
|
|
47
|
+
private readonly records;
|
|
48
|
+
private readonly oneShotFailures;
|
|
49
|
+
private failure;
|
|
50
|
+
handle(payload: Record<string, unknown>, ctx: JobContext): void;
|
|
51
|
+
/** Queue `error` to be thrown by the NEXT execution only. */
|
|
52
|
+
failNextWith(error: Error): void;
|
|
53
|
+
/** Make every subsequent execution throw `error` until cleared. */
|
|
54
|
+
failWith(error: Error): void;
|
|
55
|
+
/** Stop failing; subsequent executions succeed again. */
|
|
56
|
+
clearFailure(): void;
|
|
57
|
+
/** Every execution so far, in order. */
|
|
58
|
+
executions(): readonly RecordedJobExecution[];
|
|
59
|
+
/** Clear recorded executions and any armed failures. */
|
|
60
|
+
reset(): void;
|
|
61
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RecordingJobHandler = void 0;
|
|
4
|
+
exports.drainJobs = drainJobs;
|
|
5
|
+
/**
|
|
6
|
+
* Ticks the claimer until a tick claims nothing, aggregating the reports —
|
|
7
|
+
* "run everything that is currently due" in one await:
|
|
8
|
+
*
|
|
9
|
+
* ```ts
|
|
10
|
+
* const report = await drainJobs(app.get(JobsClaimer));
|
|
11
|
+
* assert.equal(report.completed, 3);
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* Note: jobs a tick reschedules into the future (retry backoff, delayMs) are
|
|
15
|
+
* not due, so a drain settles even while retries are pending — advance time
|
|
16
|
+
* (or wait) and drain again to run them.
|
|
17
|
+
*/
|
|
18
|
+
async function drainJobs(claimer, options = {}) {
|
|
19
|
+
const maxTicks = options.maxTicks ?? 100;
|
|
20
|
+
const total = { claimed: 0, completed: 0, retried: 0, failed: 0 };
|
|
21
|
+
for (let tick = 0; tick < maxTicks; tick += 1) {
|
|
22
|
+
const report = await claimer.tick(options.runner);
|
|
23
|
+
total.claimed += report.claimed;
|
|
24
|
+
total.completed += report.completed;
|
|
25
|
+
total.retried += report.retried;
|
|
26
|
+
total.failed += report.failed;
|
|
27
|
+
if (report.claimed === 0) {
|
|
28
|
+
return total;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
throw new Error(`drainJobs did not settle after ${maxTicks} ticks — a job is likely being ` +
|
|
32
|
+
'retried with no delay. Raise maxTicks or fix the handler.');
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* A {@link JobHandler} implementation that records every execution and can be
|
|
36
|
+
* armed to fail — once (`failNextWith`, ideal for throw-then-succeed retry
|
|
37
|
+
* tests) or persistently (`failWith`). Executions are recorded BEFORE the
|
|
38
|
+
* failure is thrown, so `executions()` reflects every attempt the claimer made.
|
|
39
|
+
*
|
|
40
|
+
* Subclass it to attach the decorator:
|
|
41
|
+
*
|
|
42
|
+
* ```ts
|
|
43
|
+
* @JobHandler('email.welcome')
|
|
44
|
+
* class WelcomeHandler extends RecordingJobHandler {}
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
class RecordingJobHandler {
|
|
48
|
+
constructor() {
|
|
49
|
+
this.records = [];
|
|
50
|
+
this.oneShotFailures = [];
|
|
51
|
+
}
|
|
52
|
+
handle(payload, ctx) {
|
|
53
|
+
this.records.push({ payload, ctx });
|
|
54
|
+
const oneShot = this.oneShotFailures.shift();
|
|
55
|
+
if (oneShot) {
|
|
56
|
+
throw oneShot;
|
|
57
|
+
}
|
|
58
|
+
if (this.failure) {
|
|
59
|
+
throw this.failure;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
/** Queue `error` to be thrown by the NEXT execution only. */
|
|
63
|
+
failNextWith(error) {
|
|
64
|
+
this.oneShotFailures.push(error);
|
|
65
|
+
}
|
|
66
|
+
/** Make every subsequent execution throw `error` until cleared. */
|
|
67
|
+
failWith(error) {
|
|
68
|
+
this.failure = error;
|
|
69
|
+
}
|
|
70
|
+
/** Stop failing; subsequent executions succeed again. */
|
|
71
|
+
clearFailure() {
|
|
72
|
+
this.failure = undefined;
|
|
73
|
+
this.oneShotFailures.length = 0;
|
|
74
|
+
}
|
|
75
|
+
/** Every execution so far, in order. */
|
|
76
|
+
executions() {
|
|
77
|
+
return this.records;
|
|
78
|
+
}
|
|
79
|
+
/** Clear recorded executions and any armed failures. */
|
|
80
|
+
reset() {
|
|
81
|
+
this.records.length = 0;
|
|
82
|
+
this.clearFailure();
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
exports.RecordingJobHandler = RecordingJobHandler;
|
|
86
|
+
//# sourceMappingURL=harness.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"harness.js","sourceRoot":"","sources":["../../testing/harness.ts"],"names":[],"mappings":";;;AA+BA,8BAoBC;AAjCD;;;;;;;;;;;;GAYG;AACI,KAAK,UAAU,SAAS,CAC7B,OAAoB,EACpB,UAA4B,EAAE;IAE9B,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,GAAG,CAAC;IACzC,MAAM,KAAK,GAAe,EAAE,OAAO,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;IAC9E,KAAK,IAAI,IAAI,GAAG,CAAC,EAAE,IAAI,GAAG,QAAQ,EAAE,IAAI,IAAI,CAAC,EAAE,CAAC;QAC9C,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAClD,KAAK,CAAC,OAAO,IAAI,MAAM,CAAC,OAAO,CAAC;QAChC,KAAK,CAAC,SAAS,IAAI,MAAM,CAAC,SAAS,CAAC;QACpC,KAAK,CAAC,OAAO,IAAI,MAAM,CAAC,OAAO,CAAC;QAChC,KAAK,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,CAAC;QAC9B,IAAI,MAAM,CAAC,OAAO,KAAK,CAAC,EAAE,CAAC;YACzB,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IACD,MAAM,IAAI,KAAK,CACb,kCAAkC,QAAQ,iCAAiC;QACzE,2DAA2D,CAC9D,CAAC;AACJ,CAAC;AAQD;;;;;;;;;;;;GAYG;AACH,MAAa,mBAAmB;IAAhC;QACmB,YAAO,GAA2B,EAAE,CAAC;QACrC,oBAAe,GAAY,EAAE,CAAC;IAwCjD,CAAC;IArCC,MAAM,CAAC,OAAgC,EAAE,GAAe;QACtD,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC;QACpC,MAAM,OAAO,GAAG,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,CAAC;QAC7C,IAAI,OAAO,EAAE,CAAC;YACZ,MAAM,OAAO,CAAC;QAChB,CAAC;QACD,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACjB,MAAM,IAAI,CAAC,OAAO,CAAC;QACrB,CAAC;IACH,CAAC;IAED,6DAA6D;IAC7D,YAAY,CAAC,KAAY;QACvB,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACnC,CAAC;IAED,mEAAmE;IACnE,QAAQ,CAAC,KAAY;QACnB,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;IACvB,CAAC;IAED,yDAAyD;IACzD,YAAY;QACV,IAAI,CAAC,OAAO,GAAG,SAAS,CAAC;QACzB,IAAI,CAAC,eAAe,CAAC,MAAM,GAAG,CAAC,CAAC;IAClC,CAAC;IAED,wCAAwC;IACxC,UAAU;QACR,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED,wDAAwD;IACxD,KAAK;QACH,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC;QACxB,IAAI,CAAC,YAAY,EAAE,CAAC;IACtB,CAAC;CACF;AA1CD,kDA0CC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './harness';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
// @nest-native/jobs/testing — hermetic helpers for testing job flows.
|
|
18
|
+
__exportStar(require("./harness"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../testing/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sEAAsE;AACtE,4CAA0B"}
|
package/dist/tokens.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** The dialect-specific {@link JobStore} provided to `JobsModule`. */
|
|
2
|
+
export declare const JOBS_STORE: unique symbol;
|
|
3
|
+
/**
|
|
4
|
+
* The base (non-transactional) Drizzle instance the claimer opens its own
|
|
5
|
+
* transaction on. `JobsModule` aliases this to the user-supplied
|
|
6
|
+
* `drizzleInstanceToken`.
|
|
7
|
+
*/
|
|
8
|
+
export declare const JOBS_DRIZZLE: unique symbol;
|
|
9
|
+
/** The resolved {@link JobsModuleOptions}. */
|
|
10
|
+
export declare const JOBS_OPTIONS: unique symbol;
|
package/dist/tokens.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// DI tokens for the jobs engine.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.JOBS_OPTIONS = exports.JOBS_DRIZZLE = exports.JOBS_STORE = void 0;
|
|
5
|
+
/** The dialect-specific {@link JobStore} provided to `JobsModule`. */
|
|
6
|
+
exports.JOBS_STORE = Symbol.for('@nest-native/jobs:store');
|
|
7
|
+
/**
|
|
8
|
+
* The base (non-transactional) Drizzle instance the claimer opens its own
|
|
9
|
+
* transaction on. `JobsModule` aliases this to the user-supplied
|
|
10
|
+
* `drizzleInstanceToken`.
|
|
11
|
+
*/
|
|
12
|
+
exports.JOBS_DRIZZLE = Symbol.for('@nest-native/jobs:drizzle');
|
|
13
|
+
/** The resolved {@link JobsModuleOptions}. */
|
|
14
|
+
exports.JOBS_OPTIONS = Symbol.for('@nest-native/jobs:options');
|
|
15
|
+
//# sourceMappingURL=tokens.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokens.js","sourceRoot":"","sources":["../tokens.ts"],"names":[],"mappings":";AAAA,iCAAiC;;;AAEjC,sEAAsE;AACzD,QAAA,UAAU,GAAG,MAAM,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC;AAEhE;;;;GAIG;AACU,QAAA,YAAY,GAAG,MAAM,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAC;AAEpE,8CAA8C;AACjC,QAAA,YAAY,GAAG,MAAM,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@nest-native/jobs",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Background jobs for NestJS without Redis — a Drizzle-backed job queue (SQLite, Postgres + MySQL) with transactional enqueue, retries, delayed and unique jobs",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"nestjs",
|
|
7
|
+
"jobs",
|
|
8
|
+
"background-jobs",
|
|
9
|
+
"job-queue",
|
|
10
|
+
"queue",
|
|
11
|
+
"worker",
|
|
12
|
+
"task-queue",
|
|
13
|
+
"delayed-jobs",
|
|
14
|
+
"drizzle",
|
|
15
|
+
"sqlite",
|
|
16
|
+
"postgres",
|
|
17
|
+
"mysql",
|
|
18
|
+
"typescript"
|
|
19
|
+
],
|
|
20
|
+
"author": "Rodrigo Nogueira",
|
|
21
|
+
"license": "MIT",
|
|
22
|
+
"homepage": "https://github.com/nest-native/jobs#readme",
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "git+https://github.com/nest-native/jobs.git",
|
|
26
|
+
"directory": "packages/jobs"
|
|
27
|
+
},
|
|
28
|
+
"bugs": {
|
|
29
|
+
"url": "https://github.com/nest-native/jobs/issues"
|
|
30
|
+
},
|
|
31
|
+
"main": "./dist/index.js",
|
|
32
|
+
"types": "./dist/index.d.ts",
|
|
33
|
+
"exports": {
|
|
34
|
+
".": {
|
|
35
|
+
"types": "./dist/index.d.ts",
|
|
36
|
+
"require": "./dist/index.js",
|
|
37
|
+
"default": "./dist/index.js"
|
|
38
|
+
},
|
|
39
|
+
"./sqlite": {
|
|
40
|
+
"types": "./dist/dialects/sqlite/index.d.ts",
|
|
41
|
+
"require": "./dist/dialects/sqlite/index.js",
|
|
42
|
+
"default": "./dist/dialects/sqlite/index.js"
|
|
43
|
+
},
|
|
44
|
+
"./postgres": {
|
|
45
|
+
"types": "./dist/dialects/postgres/index.d.ts",
|
|
46
|
+
"require": "./dist/dialects/postgres/index.js",
|
|
47
|
+
"default": "./dist/dialects/postgres/index.js"
|
|
48
|
+
},
|
|
49
|
+
"./mysql": {
|
|
50
|
+
"types": "./dist/dialects/mysql/index.d.ts",
|
|
51
|
+
"require": "./dist/dialects/mysql/index.js",
|
|
52
|
+
"default": "./dist/dialects/mysql/index.js"
|
|
53
|
+
},
|
|
54
|
+
"./testing": {
|
|
55
|
+
"types": "./dist/testing/index.d.ts",
|
|
56
|
+
"require": "./dist/testing/index.js",
|
|
57
|
+
"default": "./dist/testing/index.js"
|
|
58
|
+
},
|
|
59
|
+
"./package.json": "./package.json"
|
|
60
|
+
},
|
|
61
|
+
"files": [
|
|
62
|
+
"dist/**/*.d.ts",
|
|
63
|
+
"dist/**/*.js",
|
|
64
|
+
"dist/**/*.js.map"
|
|
65
|
+
],
|
|
66
|
+
"publishConfig": {
|
|
67
|
+
"access": "public"
|
|
68
|
+
},
|
|
69
|
+
"engines": {
|
|
70
|
+
"node": ">=20"
|
|
71
|
+
},
|
|
72
|
+
"scripts": {
|
|
73
|
+
"clean": "rimraf dist tsconfig.tsbuildinfo",
|
|
74
|
+
"build": "npm run clean && tsc -p tsconfig.build.json",
|
|
75
|
+
"typecheck": "tsc --noEmit -p tsconfig.json"
|
|
76
|
+
},
|
|
77
|
+
"dependencies": {},
|
|
78
|
+
"peerDependencies": {
|
|
79
|
+
"@nestjs-cls/transactional": "^3.0.0",
|
|
80
|
+
"@nestjs/common": "^11.0.0",
|
|
81
|
+
"@nestjs/core": "^11.0.0",
|
|
82
|
+
"better-sqlite3": "^11.0.0 || ^12.0.0",
|
|
83
|
+
"drizzle-orm": "^0.44.0 || ^0.45.0",
|
|
84
|
+
"mysql2": "^3.0.0",
|
|
85
|
+
"pg": "^8.0.0",
|
|
86
|
+
"reflect-metadata": "^0.1.12 || ^0.2.0",
|
|
87
|
+
"rxjs": "^7.0.0"
|
|
88
|
+
},
|
|
89
|
+
"peerDependenciesMeta": {
|
|
90
|
+
"better-sqlite3": {
|
|
91
|
+
"optional": true
|
|
92
|
+
},
|
|
93
|
+
"mysql2": {
|
|
94
|
+
"optional": true
|
|
95
|
+
},
|
|
96
|
+
"pg": {
|
|
97
|
+
"optional": true
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
"devDependencies": {
|
|
101
|
+
"@nestjs/common": "^11.1.27",
|
|
102
|
+
"@nestjs/core": "^11.1.27",
|
|
103
|
+
"reflect-metadata": "^0.2.2",
|
|
104
|
+
"rxjs": "^7.8.1",
|
|
105
|
+
"typescript": "^6.0.3"
|
|
106
|
+
}
|
|
107
|
+
}
|