@nest-boot/bullmq-mikro-orm 7.0.3 → 7.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bullmq-mikro-orm-module-options.interface.d.ts +6 -0
- package/dist/bullmq-mikro-orm.module.d.ts +17 -0
- package/dist/bullmq-mikro-orm.module.js +17 -0
- package/dist/bullmq-mikro-orm.module.js.map +1 -1
- package/dist/entities/job.entity.d.ts +20 -0
- package/dist/entities/job.entity.js +9 -0
- package/dist/entities/job.entity.js.map +1 -1
- package/dist/enums/job-status.enum.d.ts +9 -0
- package/dist/enums/job-status.enum.js +9 -0
- package/dist/enums/job-status.enum.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/utils/convert-bullmq-job-state-to-job-status.util.d.ts +3 -3
- package/dist/utils/convert-bullmq-job-state-to-job-status.util.js +3 -3
- package/dist/utils/should-include-queue.util.d.ts +10 -10
- package/dist/utils/should-include-queue.util.js +13 -13
- package/dist/utils/should-include-queue.util.js.map +1 -1
- package/dist/utils/should-include-queue.util.spec.js +17 -17
- package/dist/utils/should-include-queue.util.spec.js.map +1 -1
- package/package.json +22 -13
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import { EntityClass, EntityData } from "@mikro-orm/core";
|
|
2
2
|
import { Job } from "bullmq";
|
|
3
3
|
import { JobEntity } from "./entities/job.entity";
|
|
4
|
+
/** Configuration options for the BullMQ-MikroORM integration module. */
|
|
4
5
|
export interface BullMQMikroORMModuleOptions<T extends JobEntity = JobEntity> {
|
|
6
|
+
/** The MikroORM entity class used to persist BullMQ jobs. */
|
|
5
7
|
jobEntity: EntityClass<T>;
|
|
8
|
+
/** Time-to-live (in milliseconds) after which completed/failed jobs are deleted. */
|
|
6
9
|
jobTTL?: number;
|
|
10
|
+
/** Custom function to convert a BullMQ job into entity data for persistence. */
|
|
7
11
|
convertJobToEntityData?: (job: Job) => EntityData<T> | Promise<EntityData<T>>;
|
|
12
|
+
/** Queue names to include for persistence. If unset, all queues are included. */
|
|
8
13
|
includeQueues?: string[];
|
|
14
|
+
/** Queue names to exclude from persistence. */
|
|
9
15
|
excludeQueues?: string[];
|
|
10
16
|
}
|
|
@@ -2,7 +2,24 @@ import { ConfigurableModuleAsyncOptions } from "@nestjs/common";
|
|
|
2
2
|
import { ConfigurableModuleClass } from "./bullmq-mikro-orm.module-definition";
|
|
3
3
|
import { BullMQMikroORMModuleOptions } from "./bullmq-mikro-orm-module-options.interface";
|
|
4
4
|
import { JobEntity } from "./entities/job.entity";
|
|
5
|
+
/**
|
|
6
|
+
* Module that integrates BullMQ job events with MikroORM persistence.
|
|
7
|
+
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* Subscribes to BullMQ queue events and automatically persists job state
|
|
10
|
+
* changes to the database using the configured entity.
|
|
11
|
+
*/
|
|
5
12
|
export declare class BullMQMikroORMModule extends ConfigurableModuleClass {
|
|
13
|
+
/**
|
|
14
|
+
* Registers the module with synchronous options.
|
|
15
|
+
* @param options - Configuration including the job entity class
|
|
16
|
+
* @returns Dynamic module configuration
|
|
17
|
+
*/
|
|
6
18
|
static forRoot<T extends JobEntity = JobEntity>(options: BullMQMikroORMModuleOptions<T>): import("@nestjs/common").DynamicModule;
|
|
19
|
+
/**
|
|
20
|
+
* Registers the module with asynchronous options via factory functions.
|
|
21
|
+
* @param options - Async configuration options
|
|
22
|
+
* @returns Dynamic module configuration
|
|
23
|
+
*/
|
|
7
24
|
static forRootAsync<T extends JobEntity = JobEntity>(options: ConfigurableModuleAsyncOptions<BullMQMikroORMModuleOptions<T>>): import("@nestjs/common").DynamicModule;
|
|
8
25
|
}
|
|
@@ -11,10 +11,27 @@ const common_1 = require("@nestjs/common");
|
|
|
11
11
|
const core_1 = require("@nestjs/core");
|
|
12
12
|
const bullmq_mikro_orm_module_definition_1 = require("./bullmq-mikro-orm.module-definition");
|
|
13
13
|
const bullmq_mikro_orm_service_1 = require("./bullmq-mikro-orm.service");
|
|
14
|
+
/**
|
|
15
|
+
* Module that integrates BullMQ job events with MikroORM persistence.
|
|
16
|
+
*
|
|
17
|
+
* @remarks
|
|
18
|
+
* Subscribes to BullMQ queue events and automatically persists job state
|
|
19
|
+
* changes to the database using the configured entity.
|
|
20
|
+
*/
|
|
14
21
|
let BullMQMikroORMModule = class BullMQMikroORMModule extends bullmq_mikro_orm_module_definition_1.ConfigurableModuleClass {
|
|
22
|
+
/**
|
|
23
|
+
* Registers the module with synchronous options.
|
|
24
|
+
* @param options - Configuration including the job entity class
|
|
25
|
+
* @returns Dynamic module configuration
|
|
26
|
+
*/
|
|
15
27
|
static forRoot(options) {
|
|
16
28
|
return super.forRoot(options);
|
|
17
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* Registers the module with asynchronous options via factory functions.
|
|
32
|
+
* @param options - Async configuration options
|
|
33
|
+
* @returns Dynamic module configuration
|
|
34
|
+
*/
|
|
18
35
|
static forRootAsync(options) {
|
|
19
36
|
return super.forRootAsync(options);
|
|
20
37
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bullmq-mikro-orm.module.js","sourceRoot":"","sources":["../src/bullmq-mikro-orm.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAgF;AAChF,uCAA+C;AAE/C,6FAA+E;AAC/E,yEAAmE;
|
|
1
|
+
{"version":3,"file":"bullmq-mikro-orm.module.js","sourceRoot":"","sources":["../src/bullmq-mikro-orm.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAgF;AAChF,uCAA+C;AAE/C,6FAA+E;AAC/E,yEAAmE;AAInE;;;;;;GAMG;AAMI,IAAM,oBAAoB,GAA1B,MAAM,oBAAqB,SAAQ,4DAAuB;IAC/D;;;;OAIG;IACH,MAAM,CAAC,OAAO,CACZ,OAAuC;QAEvC,OAAO,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAChC,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,YAAY,CACjB,OAAuE;QAEvE,OAAO,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;IACrC,CAAC;CACF,CAAA;AAtBY,oDAAoB;+BAApB,oBAAoB;IALhC,IAAA,eAAM,GAAE;IACR,IAAA,eAAM,EAAC;QACN,OAAO,EAAE,CAAC,sBAAe,CAAC;QAC1B,SAAS,EAAE,CAAC,gDAAqB,CAAC;KACnC,CAAC;GACW,oBAAoB,CAsBhC"}
|
|
@@ -1,17 +1,37 @@
|
|
|
1
1
|
import { Opt } from "@mikro-orm/core";
|
|
2
2
|
import { JobProgress } from "bullmq";
|
|
3
|
+
/**
|
|
4
|
+
* Abstract base entity for persisting BullMQ job data in the database.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* Extend this entity in your application to create a concrete job table.
|
|
8
|
+
* Automatically populated by the BullMQ-MikroORM subscriber.
|
|
9
|
+
*/
|
|
3
10
|
export declare abstract class JobEntity {
|
|
11
|
+
/** BullMQ job identifier. */
|
|
4
12
|
id: string;
|
|
13
|
+
/** Name of the BullMQ queue this job belongs to. */
|
|
5
14
|
queueName: string;
|
|
15
|
+
/** Job name (type identifier). */
|
|
6
16
|
name: string;
|
|
17
|
+
/** JSON payload of the job. */
|
|
7
18
|
data: any;
|
|
19
|
+
/** Return value from the job processor, if completed. */
|
|
8
20
|
returnValue?: any;
|
|
21
|
+
/** Error message if the job failed. */
|
|
9
22
|
failedReason?: string;
|
|
23
|
+
/** Job priority (lower values = higher priority). */
|
|
10
24
|
priority: number;
|
|
25
|
+
/** Current progress of the job (number or object). */
|
|
11
26
|
progress: Opt<JobProgress>;
|
|
27
|
+
/** Current status of the job. */
|
|
12
28
|
status: string;
|
|
29
|
+
/** Timestamp when the job started processing. */
|
|
13
30
|
startedAt?: Date;
|
|
31
|
+
/** Timestamp when the job finished processing. */
|
|
14
32
|
finishedAt?: Date;
|
|
33
|
+
/** Timestamp when the job was created. */
|
|
15
34
|
createdAt: Opt<Date>;
|
|
35
|
+
/** Timestamp of the last update. */
|
|
16
36
|
updatedAt: Opt<Date>;
|
|
17
37
|
}
|
|
@@ -12,9 +12,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.JobEntity = void 0;
|
|
13
13
|
const core_1 = require("@mikro-orm/core");
|
|
14
14
|
const job_status_enum_1 = require("../enums/job-status.enum");
|
|
15
|
+
/**
|
|
16
|
+
* Abstract base entity for persisting BullMQ job data in the database.
|
|
17
|
+
*
|
|
18
|
+
* @remarks
|
|
19
|
+
* Extend this entity in your application to create a concrete job table.
|
|
20
|
+
* Automatically populated by the BullMQ-MikroORM subscriber.
|
|
21
|
+
*/
|
|
15
22
|
let JobEntity = class JobEntity {
|
|
16
23
|
constructor() {
|
|
24
|
+
/** Timestamp when the job was created. */
|
|
17
25
|
this.createdAt = new Date();
|
|
26
|
+
/** Timestamp of the last update. */
|
|
18
27
|
this.updatedAt = new Date();
|
|
19
28
|
}
|
|
20
29
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"job.entity.js","sourceRoot":"","sources":["../../src/entities/job.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,0CAQyB;AAGzB,8DAAqD;
|
|
1
|
+
{"version":3,"file":"job.entity.js","sourceRoot":"","sources":["../../src/entities/job.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,0CAQyB;AAGzB,8DAAqD;AAErD;;;;;;GAMG;AAEI,IAAe,SAAS,GAAxB,MAAe,SAAS;IAAxB;QAgDL,0CAA0C;QAG1C,cAAS,GAAc,IAAI,IAAI,EAAE,CAAC;QAElC,oCAAoC;QAOpC,cAAS,GAAc,IAAI,IAAI,EAAE,CAAC;IACpC,CAAC;CAAA,CAAA;AA7DqB,8BAAS;AAG7B;IADC,IAAA,iBAAU,EAAC,EAAE,IAAI,EAAE,QAAC,CAAC,MAAM,EAAE,CAAC;;qCACnB;AAIZ;IADC,IAAA,eAAQ,EAAC,EAAE,IAAI,EAAE,QAAC,CAAC,MAAM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AO;QACnB,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE;KAC3B,CAAC;;4CACgC;oBA5Dd,SAAS;IAD9B,IAAA,aAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;GACL,SAAS,CA6D9B"}
|
|
@@ -1,10 +1,19 @@
|
|
|
1
|
+
/** Enumeration of possible BullMQ job statuses persisted in the database. */
|
|
1
2
|
export declare enum JobStatus {
|
|
3
|
+
/** Job is actively being processed. */
|
|
2
4
|
ACTIVE = "active",
|
|
5
|
+
/** Job has completed successfully. */
|
|
3
6
|
COMPLETED = "completed",
|
|
7
|
+
/** Job is delayed and will be processed later. */
|
|
4
8
|
DELAYED = "delayed",
|
|
9
|
+
/** Job has failed after exhausting all retry attempts. */
|
|
5
10
|
FAILED = "failed",
|
|
11
|
+
/** Job is waiting in the prioritized queue. */
|
|
6
12
|
PRIORITIZED = "prioritized",
|
|
13
|
+
/** Job status is unknown. */
|
|
7
14
|
UNKNOWN = "unknown",
|
|
15
|
+
/** Job is waiting in the queue to be processed. */
|
|
8
16
|
WAITING = "waiting",
|
|
17
|
+
/** Job is waiting for its child jobs to complete. */
|
|
9
18
|
WAITING_CHILDREN = "waiting-children"
|
|
10
19
|
}
|
|
@@ -1,15 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.JobStatus = void 0;
|
|
4
|
+
/** Enumeration of possible BullMQ job statuses persisted in the database. */
|
|
4
5
|
var JobStatus;
|
|
5
6
|
(function (JobStatus) {
|
|
7
|
+
/** Job is actively being processed. */
|
|
6
8
|
JobStatus["ACTIVE"] = "active";
|
|
9
|
+
/** Job has completed successfully. */
|
|
7
10
|
JobStatus["COMPLETED"] = "completed";
|
|
11
|
+
/** Job is delayed and will be processed later. */
|
|
8
12
|
JobStatus["DELAYED"] = "delayed";
|
|
13
|
+
/** Job has failed after exhausting all retry attempts. */
|
|
9
14
|
JobStatus["FAILED"] = "failed";
|
|
15
|
+
/** Job is waiting in the prioritized queue. */
|
|
10
16
|
JobStatus["PRIORITIZED"] = "prioritized";
|
|
17
|
+
/** Job status is unknown. */
|
|
11
18
|
JobStatus["UNKNOWN"] = "unknown";
|
|
19
|
+
/** Job is waiting in the queue to be processed. */
|
|
12
20
|
JobStatus["WAITING"] = "waiting";
|
|
21
|
+
/** Job is waiting for its child jobs to complete. */
|
|
13
22
|
JobStatus["WAITING_CHILDREN"] = "waiting-children";
|
|
14
23
|
})(JobStatus || (exports.JobStatus = JobStatus = {}));
|
|
15
24
|
//# sourceMappingURL=job-status.enum.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"job-status.enum.js","sourceRoot":"","sources":["../../src/enums/job-status.enum.ts"],"names":[],"mappings":";;;AAAA,IAAY,
|
|
1
|
+
{"version":3,"file":"job-status.enum.js","sourceRoot":"","sources":["../../src/enums/job-status.enum.ts"],"names":[],"mappings":";;;AAAA,6EAA6E;AAC7E,IAAY,SAiBX;AAjBD,WAAY,SAAS;IACnB,uCAAuC;IACvC,8BAAiB,CAAA;IACjB,sCAAsC;IACtC,oCAAuB,CAAA;IACvB,kDAAkD;IAClD,gCAAmB,CAAA;IACnB,0DAA0D;IAC1D,8BAAiB,CAAA;IACjB,+CAA+C;IAC/C,wCAA2B,CAAA;IAC3B,6BAA6B;IAC7B,gCAAmB,CAAA;IACnB,mDAAmD;IACnD,gCAAmB,CAAA;IACnB,qDAAqD;IACrD,kDAAqC,CAAA;AACvC,CAAC,EAjBW,SAAS,yBAAT,SAAS,QAiBpB"}
|