@lyrolab/nest-shared 0.0.0-semantically-released

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.
Files changed (90) hide show
  1. package/.releaserc.json +25 -0
  2. package/CHANGELOG.md +17 -0
  3. package/README.md +45 -0
  4. package/dist/ai/index.d.ts +2 -0
  5. package/dist/ai/index.js +19 -0
  6. package/dist/ai/index.js.map +1 -0
  7. package/dist/ai/services/ai.service.d.ts +14 -0
  8. package/dist/ai/services/ai.service.js +58 -0
  9. package/dist/ai/services/ai.service.js.map +1 -0
  10. package/dist/ai/shared-ai.module.d.ts +2 -0
  11. package/dist/ai/shared-ai.module.js +21 -0
  12. package/dist/ai/shared-ai.module.js.map +1 -0
  13. package/dist/app.module.d.ts +2 -0
  14. package/dist/app.module.js +21 -0
  15. package/dist/app.module.js.map +1 -0
  16. package/dist/bull/index.d.ts +1 -0
  17. package/dist/bull/index.js +18 -0
  18. package/dist/bull/index.js.map +1 -0
  19. package/dist/bull/shared-bull.module.d.ts +4 -0
  20. package/dist/bull/shared-bull.module.js +40 -0
  21. package/dist/bull/shared-bull.module.js.map +1 -0
  22. package/dist/cache/index.d.ts +1 -0
  23. package/dist/cache/index.js +18 -0
  24. package/dist/cache/index.js.map +1 -0
  25. package/dist/cache/shared-cache.module.d.ts +4 -0
  26. package/dist/cache/shared-cache.module.js +42 -0
  27. package/dist/cache/shared-cache.module.js.map +1 -0
  28. package/dist/database/filters/typeorm-exception.filter.d.ts +7 -0
  29. package/dist/database/filters/typeorm-exception.filter.js +35 -0
  30. package/dist/database/filters/typeorm-exception.filter.js.map +1 -0
  31. package/dist/database/helpers/find-main-path.d.ts +1 -0
  32. package/dist/database/helpers/find-main-path.js +23 -0
  33. package/dist/database/helpers/find-main-path.js.map +1 -0
  34. package/dist/database/index.d.ts +2 -0
  35. package/dist/database/index.js +19 -0
  36. package/dist/database/index.js.map +1 -0
  37. package/dist/database/shared-database.module.d.ts +18 -0
  38. package/dist/database/shared-database.module.js +120 -0
  39. package/dist/database/shared-database.module.js.map +1 -0
  40. package/dist/health/health.controller.d.ts +7 -0
  41. package/dist/health/health.controller.js +39 -0
  42. package/dist/health/health.controller.js.map +1 -0
  43. package/dist/health/index.d.ts +1 -0
  44. package/dist/health/index.js +18 -0
  45. package/dist/health/index.js.map +1 -0
  46. package/dist/health/shared-health.module.d.ts +2 -0
  47. package/dist/health/shared-health.module.js +22 -0
  48. package/dist/health/shared-health.module.js.map +1 -0
  49. package/dist/queue/controllers/queue.controller.d.ts +7 -0
  50. package/dist/queue/controllers/queue.controller.js +40 -0
  51. package/dist/queue/controllers/queue.controller.js.map +1 -0
  52. package/dist/queue/decorators/queue.decorator.d.ts +5 -0
  53. package/dist/queue/decorators/queue.decorator.js +6 -0
  54. package/dist/queue/decorators/queue.decorator.js.map +1 -0
  55. package/dist/queue/index.d.ts +5 -0
  56. package/dist/queue/index.js +22 -0
  57. package/dist/queue/index.js.map +1 -0
  58. package/dist/queue/interfaces/queue-options.interface.d.ts +13 -0
  59. package/dist/queue/interfaces/queue-options.interface.js +3 -0
  60. package/dist/queue/interfaces/queue-options.interface.js.map +1 -0
  61. package/dist/queue/models/dto/queue-add.dto.d.ts +4 -0
  62. package/dist/queue/models/dto/queue-add.dto.js +28 -0
  63. package/dist/queue/models/dto/queue-add.dto.js.map +1 -0
  64. package/dist/queue/models/job-processor-interface.d.ts +4 -0
  65. package/dist/queue/models/job-processor-interface.js +3 -0
  66. package/dist/queue/models/job-processor-interface.js.map +1 -0
  67. package/dist/queue/processors/queue.processor.d.ts +17 -0
  68. package/dist/queue/processors/queue.processor.js +109 -0
  69. package/dist/queue/processors/queue.processor.js.map +1 -0
  70. package/dist/queue/queue.constants.d.ts +2 -0
  71. package/dist/queue/queue.constants.js +6 -0
  72. package/dist/queue/queue.constants.js.map +1 -0
  73. package/dist/queue/services/queue.service.d.ts +6 -0
  74. package/dist/queue/services/queue.service.js +35 -0
  75. package/dist/queue/services/queue.service.js.map +1 -0
  76. package/dist/queue/shared-queue.module.d.ts +8 -0
  77. package/dist/queue/shared-queue.module.js +90 -0
  78. package/dist/queue/shared-queue.module.js.map +1 -0
  79. package/dist/redis/index.d.ts +2 -0
  80. package/dist/redis/index.js +19 -0
  81. package/dist/redis/index.js.map +1 -0
  82. package/dist/redis/redis.config.d.ts +4 -0
  83. package/dist/redis/redis.config.js +11 -0
  84. package/dist/redis/redis.config.js.map +1 -0
  85. package/dist/redis/shared-redis.module.d.ts +9 -0
  86. package/dist/redis/shared-redis.module.js +68 -0
  87. package/dist/redis/shared-redis.module.js.map +1 -0
  88. package/dist/tsconfig.tsbuildinfo +1 -0
  89. package/eslint.config.mjs +35 -0
  90. package/package.json +165 -0
@@ -0,0 +1,120 @@
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 SharedDatabaseModule_1;
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.SharedDatabaseModule = void 0;
11
+ const common_1 = require("@nestjs/common");
12
+ const config_1 = require("@nestjs/config");
13
+ const typeorm_1 = require("@nestjs/typeorm");
14
+ const path_1 = require("path");
15
+ const find_main_path_1 = require("./helpers/find-main-path");
16
+ const testcontainers_1 = require("testcontainers");
17
+ const typeorm_2 = require("typeorm");
18
+ let SharedDatabaseModule = class SharedDatabaseModule {
19
+ static { SharedDatabaseModule_1 = this; }
20
+ static testContainer;
21
+ static testDataSource;
22
+ static forRoot(options = {}) {
23
+ return {
24
+ module: SharedDatabaseModule_1,
25
+ imports: [
26
+ typeorm_1.TypeOrmModule.forRootAsync({
27
+ imports: [config_1.ConfigModule],
28
+ inject: [config_1.ConfigService],
29
+ useFactory: async (configService) => {
30
+ const isTestEnvironment = process.env.NODE_ENV === "test";
31
+ if (isTestEnvironment) {
32
+ return await this.createTestConfiguration(options);
33
+ }
34
+ return this.createProductionConfiguration(configService, options);
35
+ },
36
+ }),
37
+ ],
38
+ exports: [typeorm_1.TypeOrmModule],
39
+ };
40
+ }
41
+ static async createTestConfiguration(options) {
42
+ if (!this.testContainer) {
43
+ this.testContainer = await new testcontainers_1.GenericContainer("postgres")
44
+ .withExposedPorts(5432)
45
+ .withEnvironment({
46
+ POSTGRES_PASSWORD: "secret",
47
+ POSTGRES_DB: "test",
48
+ })
49
+ .withWaitStrategy(testcontainers_1.Wait.forAll([
50
+ testcontainers_1.Wait.forListeningPorts(),
51
+ testcontainers_1.Wait.forLogMessage("database system is ready to accept connections"),
52
+ ]))
53
+ .start();
54
+ }
55
+ const connectionUri = `postgres://postgres:secret@localhost:${this.testContainer.getMappedPort(5432)}/test`;
56
+ const entities = options.entities || [
57
+ (0, path_1.join)((0, find_main_path_1.findMainPath)(), "**/*.entity{.ts,.js}"),
58
+ ];
59
+ const migrations = options.migrations || [
60
+ (0, path_1.join)((0, find_main_path_1.findMainPath)(), "src/migrations/**/*.{ts,js}"),
61
+ ];
62
+ if (!this.testDataSource) {
63
+ this.testDataSource = new typeorm_2.DataSource({
64
+ type: "postgres",
65
+ url: connectionUri,
66
+ entities,
67
+ synchronize: true,
68
+ migrations,
69
+ });
70
+ await this.testDataSource.initialize();
71
+ }
72
+ return {
73
+ type: "postgres",
74
+ url: connectionUri,
75
+ entities,
76
+ synchronize: true,
77
+ autoLoadEntities: true,
78
+ };
79
+ }
80
+ static createProductionConfiguration(configService, options) {
81
+ return {
82
+ type: "postgres",
83
+ url: configService.get("DATABASE_URL"),
84
+ entities: options.entities || [
85
+ (0, path_1.join)((0, find_main_path_1.findMainPath)(), "**/*.entity{.ts,.js}"),
86
+ ],
87
+ migrations: options.migrations || [
88
+ (0, path_1.join)((0, find_main_path_1.findMainPath)(), "src/migrations/**/*.{ts,js}"),
89
+ ],
90
+ synchronize: false,
91
+ autoLoadEntities: true,
92
+ };
93
+ }
94
+ static getTestDataSource() {
95
+ return this.testDataSource;
96
+ }
97
+ static async closeTestConnection() {
98
+ if (this.testDataSource) {
99
+ await this.testDataSource.destroy();
100
+ }
101
+ if (this.testContainer) {
102
+ await this.testContainer.stop();
103
+ }
104
+ }
105
+ static async clearTestDatabase() {
106
+ if (this.testDataSource) {
107
+ await this.testDataSource.synchronize(true);
108
+ }
109
+ }
110
+ async onModuleDestroy() {
111
+ if (SharedDatabaseModule_1.testDataSource) {
112
+ await SharedDatabaseModule_1.testDataSource.destroy();
113
+ }
114
+ }
115
+ };
116
+ exports.SharedDatabaseModule = SharedDatabaseModule;
117
+ exports.SharedDatabaseModule = SharedDatabaseModule = SharedDatabaseModule_1 = __decorate([
118
+ (0, common_1.Module)({})
119
+ ], SharedDatabaseModule);
120
+ //# sourceMappingURL=shared-database.module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared-database.module.js","sourceRoot":"","sources":["../../src/database/shared-database.module.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,2CAAuE;AACvE,2CAA4D;AAC5D,6CAAqE;AACrE,+BAA2B;AAC3B,6DAAuD;AACvD,mDAA6E;AAC7E,qCAAoC;AAQ7B,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;;IACvB,MAAM,CAAC,aAAa,CAAsB;IAC1C,MAAM,CAAC,cAAc,CAAY;IAEzC,MAAM,CAAC,OAAO,CAAC,UAAuC,EAAE;QACtD,OAAO;YACL,MAAM,EAAE,sBAAoB;YAC5B,OAAO,EAAE;gBACP,uBAAa,CAAC,YAAY,CAAC;oBACzB,OAAO,EAAE,CAAC,qBAAY,CAAC;oBACvB,MAAM,EAAE,CAAC,sBAAa,CAAC;oBACvB,UAAU,EAAE,KAAK,EAAE,aAA4B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,MAAM,IAAI,CAAC,cAAc,CAAC,WAAW,CAAC,IAAI,CAAC,CAAA;QAC7C,CAAC;IACH,CAAC;IAED,KAAK,CAAC,eAAe;QACnB,IAAI,sBAAoB,CAAC,cAAc,EAAE,CAAC;YACxC,MAAM,sBAAoB,CAAC,cAAc,CAAC,OAAO,EAAE,CAAA;QACrD,CAAC;IACH,CAAC;CACF,CAAA;AA1HY,oDAAoB;+BAApB,oBAAoB;IADhC,IAAA,eAAM,EAAC,EAAE,CAAC;GACE,oBAAoB,CA0HhC"}
@@ -0,0 +1,7 @@
1
+ import { HealthCheckService, TypeOrmHealthIndicator } from "@nestjs/terminus";
2
+ export declare class HealthController {
3
+ private health;
4
+ private db;
5
+ constructor(health: HealthCheckService, db: TypeOrmHealthIndicator);
6
+ check(): Promise<import("@nestjs/terminus").HealthCheckResult>;
7
+ }
@@ -0,0 +1,39 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.HealthController = void 0;
13
+ const common_1 = require("@nestjs/common");
14
+ const terminus_1 = require("@nestjs/terminus");
15
+ let HealthController = class HealthController {
16
+ health;
17
+ db;
18
+ constructor(health, db) {
19
+ this.health = health;
20
+ this.db = db;
21
+ }
22
+ check() {
23
+ return this.health.check([() => this.db.pingCheck("database")]);
24
+ }
25
+ };
26
+ exports.HealthController = HealthController;
27
+ __decorate([
28
+ (0, common_1.Get)(),
29
+ (0, terminus_1.HealthCheck)(),
30
+ __metadata("design:type", Function),
31
+ __metadata("design:paramtypes", []),
32
+ __metadata("design:returntype", void 0)
33
+ ], HealthController.prototype, "check", null);
34
+ exports.HealthController = HealthController = __decorate([
35
+ (0, common_1.Controller)("health"),
36
+ __metadata("design:paramtypes", [terminus_1.HealthCheckService,
37
+ terminus_1.TypeOrmHealthIndicator])
38
+ ], HealthController);
39
+ //# sourceMappingURL=health.controller.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"health.controller.js","sourceRoot":"","sources":["../../src/health/health.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAgD;AAChD,+CAIyB;AAGlB,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAEjB;IACA;IAFV,YACU,MAA0B,EAC1B,EAA0B;QAD1B,WAAM,GAAN,MAAM,CAAoB;QAC1B,OAAE,GAAF,EAAE,CAAwB;IACjC,CAAC;IAIJ,KAAK;QACH,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC,CAAA;IACjE,CAAC;CACF,CAAA;AAXY,4CAAgB;AAQ3B;IAFC,IAAA,YAAG,GAAE;IACL,IAAA,sBAAW,GAAE;;;;6CAGb;2BAVU,gBAAgB;IAD5B,IAAA,mBAAU,EAAC,QAAQ,CAAC;qCAGD,6BAAkB;QACtB,iCAAsB;GAHzB,gBAAgB,CAW5B"}
@@ -0,0 +1 @@
1
+ export * from "./shared-health.module";
@@ -0,0 +1,18 @@
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
+ __exportStar(require("./shared-health.module"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/health/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yDAAsC"}
@@ -0,0 +1,2 @@
1
+ export declare class SharedHealthModule {
2
+ }
@@ -0,0 +1,22 @@
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.SharedHealthModule = void 0;
10
+ const common_1 = require("@nestjs/common");
11
+ const terminus_1 = require("@nestjs/terminus");
12
+ const health_controller_1 = require("./health.controller");
13
+ let SharedHealthModule = class SharedHealthModule {
14
+ };
15
+ exports.SharedHealthModule = SharedHealthModule;
16
+ exports.SharedHealthModule = SharedHealthModule = __decorate([
17
+ (0, common_1.Module)({
18
+ imports: [terminus_1.TerminusModule.forRoot({ gracefulShutdownTimeoutMs: 1000 })],
19
+ controllers: [health_controller_1.HealthController],
20
+ })
21
+ ], SharedHealthModule);
22
+ //# sourceMappingURL=shared-health.module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared-health.module.js","sourceRoot":"","sources":["../../src/health/shared-health.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAuC;AACvC,+CAAiD;AACjD,2DAAsD;AAM/C,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;CAAG,CAAA;AAArB,gDAAkB;6BAAlB,kBAAkB;IAJ9B,IAAA,eAAM,EAAC;QACN,OAAO,EAAE,CAAC,yBAAc,CAAC,OAAO,CAAC,EAAE,yBAAyB,EAAE,IAAI,EAAE,CAAC,CAAC;QACtE,WAAW,EAAE,CAAC,oCAAgB,CAAC;KAChC,CAAC;GACW,kBAAkB,CAAG"}
@@ -0,0 +1,7 @@
1
+ import { QueueService } from "../services/queue.service";
2
+ import { QueueAddDto } from "../models/dto/queue-add.dto";
3
+ export declare class QueueController {
4
+ private readonly queueService;
5
+ constructor(queueService: QueueService);
6
+ add(body: QueueAddDto): Promise<import("bullmq").Job<any, any, string>>;
7
+ }
@@ -0,0 +1,40 @@
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.QueueController = void 0;
16
+ const common_1 = require("@nestjs/common");
17
+ const queue_service_1 = require("../services/queue.service");
18
+ const queue_add_dto_1 = require("../models/dto/queue-add.dto");
19
+ let QueueController = class QueueController {
20
+ queueService;
21
+ constructor(queueService) {
22
+ this.queueService = queueService;
23
+ }
24
+ async add(body) {
25
+ return this.queueService.add(body.name, body.data);
26
+ }
27
+ };
28
+ exports.QueueController = QueueController;
29
+ __decorate([
30
+ (0, common_1.Post)("add"),
31
+ __param(0, (0, common_1.Body)()),
32
+ __metadata("design:type", Function),
33
+ __metadata("design:paramtypes", [queue_add_dto_1.QueueAddDto]),
34
+ __metadata("design:returntype", Promise)
35
+ ], QueueController.prototype, "add", null);
36
+ exports.QueueController = QueueController = __decorate([
37
+ (0, common_1.Controller)("queue"),
38
+ __metadata("design:paramtypes", [queue_service_1.QueueService])
39
+ ], QueueController);
40
+ //# sourceMappingURL=queue.controller.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queue.controller.js","sourceRoot":"","sources":["../../../src/queue/controllers/queue.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAuD;AACvD,6DAAwD;AACxD,+DAAyD;AAGlD,IAAM,eAAe,GAArB,MAAM,eAAe;IACG;IAA7B,YAA6B,YAA0B;QAA1B,iBAAY,GAAZ,YAAY,CAAc;IAAG,CAAC;IAGrD,AAAN,KAAK,CAAC,GAAG,CAAS,IAAiB;QACjC,OAAO,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAA;IACpD,CAAC;CACF,CAAA;AAPY,0CAAe;AAIpB;IADL,IAAA,aAAI,EAAC,KAAK,CAAC;IACD,WAAA,IAAA,aAAI,GAAE,CAAA;;qCAAO,2BAAW;;0CAElC;0BANU,eAAe;IAD3B,IAAA,mBAAU,EAAC,OAAO,CAAC;qCAEyB,4BAAY;GAD5C,eAAe,CAO3B"}
@@ -0,0 +1,5 @@
1
+ export type JobProcessorMetadata = {
2
+ name: string;
3
+ cron?: string;
4
+ };
5
+ export declare const JobProcessor: import("@nestjs/core").DiscoverableDecorator<string | JobProcessorMetadata>;
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.JobProcessor = void 0;
4
+ const core_1 = require("@nestjs/core");
5
+ exports.JobProcessor = core_1.DiscoveryService.createDecorator();
6
+ //# sourceMappingURL=queue.decorator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queue.decorator.js","sourceRoot":"","sources":["../../../src/queue/decorators/queue.decorator.ts"],"names":[],"mappings":";;;AAAA,uCAA+C;AAelC,QAAA,YAAY,GAAG,uBAAgB,CAAC,eAAe,EAEzD,CAAA"}
@@ -0,0 +1,5 @@
1
+ export * from "./shared-queue.module";
2
+ export * from "./services/queue.service";
3
+ export * from "./models/job-processor-interface";
4
+ export * from "./decorators/queue.decorator";
5
+ export * from "./interfaces/queue-options.interface";
@@ -0,0 +1,22 @@
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
+ __exportStar(require("./shared-queue.module"), exports);
18
+ __exportStar(require("./services/queue.service"), exports);
19
+ __exportStar(require("./models/job-processor-interface"), exports);
20
+ __exportStar(require("./decorators/queue.decorator"), exports);
21
+ __exportStar(require("./interfaces/queue-options.interface"), exports);
22
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/queue/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wDAAqC;AACrC,2DAAwC;AACxC,mEAAgD;AAChD,+DAA4C;AAC5C,uEAAoD"}
@@ -0,0 +1,13 @@
1
+ import { ModuleMetadata, Type } from "@nestjs/common";
2
+ export interface QueueModuleOptions {
3
+ concurrency?: number;
4
+ }
5
+ export interface QueueModuleAsyncOptions extends Pick<ModuleMetadata, "imports"> {
6
+ useFactory?: (...args: any[]) => Promise<QueueModuleOptions> | QueueModuleOptions;
7
+ inject?: any[];
8
+ useClass?: Type<QueueOptionsFactory>;
9
+ useExisting?: Type<QueueOptionsFactory>;
10
+ }
11
+ export interface QueueOptionsFactory {
12
+ createQueueOptions(): Promise<QueueModuleOptions> | QueueModuleOptions;
13
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=queue-options.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queue-options.interface.js","sourceRoot":"","sources":["../../../src/queue/interfaces/queue-options.interface.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ export declare class QueueAddDto {
2
+ name: string;
3
+ data?: Record<string, any>;
4
+ }
@@ -0,0 +1,28 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.QueueAddDto = void 0;
13
+ const class_validator_1 = require("class-validator");
14
+ class QueueAddDto {
15
+ name;
16
+ data;
17
+ }
18
+ exports.QueueAddDto = QueueAddDto;
19
+ __decorate([
20
+ (0, class_validator_1.IsString)(),
21
+ __metadata("design:type", String)
22
+ ], QueueAddDto.prototype, "name", void 0);
23
+ __decorate([
24
+ (0, class_validator_1.IsObject)(),
25
+ (0, class_validator_1.IsOptional)(),
26
+ __metadata("design:type", Object)
27
+ ], QueueAddDto.prototype, "data", void 0);
28
+ //# sourceMappingURL=queue-add.dto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queue-add.dto.js","sourceRoot":"","sources":["../../../../src/queue/models/dto/queue-add.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAgE;AAEhE,MAAa,WAAW;IAEtB,IAAI,CAAQ;IAIZ,IAAI,CAAsB;CAC3B;AAPD,kCAOC;AALC;IADC,IAAA,0BAAQ,GAAE;;yCACC;AAIZ;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;yCACa"}
@@ -0,0 +1,4 @@
1
+ import { Job } from "bullmq";
2
+ export type JobProcessorInterface = {
3
+ process: (job: Job) => Promise<void>;
4
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=job-processor-interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"job-processor-interface.js","sourceRoot":"","sources":["../../../src/queue/models/job-processor-interface.ts"],"names":[],"mappings":""}
@@ -0,0 +1,17 @@
1
+ import { WorkerHost } from "@nestjs/bullmq";
2
+ import { DiscoveryService } from "@nestjs/core";
3
+ import { Job, Queue } from "bullmq";
4
+ import { OnModuleInit } from "@nestjs/common";
5
+ import { QueueModuleOptions } from "../interfaces/queue-options.interface";
6
+ export declare class QueueProcessor extends WorkerHost implements OnModuleInit {
7
+ private readonly discoveryService;
8
+ private readonly queue;
9
+ private readonly options?;
10
+ constructor(discoveryService: DiscoveryService, queue: Queue, options?: QueueModuleOptions | undefined);
11
+ onModuleInit(): Promise<void>;
12
+ process(job: Job): Promise<void>;
13
+ private getJobConfigurations;
14
+ private scheduleJobs;
15
+ private shouldProcessJob;
16
+ private getJobProcessorByName;
17
+ }
@@ -0,0 +1,109 @@
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
+ var QueueProcessor_1;
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.QueueProcessor = void 0;
17
+ const bullmq_1 = require("@nestjs/bullmq");
18
+ const core_1 = require("@nestjs/core");
19
+ const bullmq_2 = require("bullmq");
20
+ const queue_decorator_1 = require("../decorators/queue.decorator");
21
+ const queue_constants_1 = require("../queue.constants");
22
+ const common_1 = require("@nestjs/common");
23
+ let QueueProcessor = QueueProcessor_1 = class QueueProcessor extends bullmq_1.WorkerHost {
24
+ discoveryService;
25
+ queue;
26
+ options;
27
+ constructor(discoveryService, queue, options) {
28
+ super();
29
+ this.discoveryService = discoveryService;
30
+ this.queue = queue;
31
+ this.options = options;
32
+ if (this.options?.concurrency) {
33
+ (0, common_1.SetMetadata)("bullmq:worker_metadata", this.options)(QueueProcessor_1);
34
+ }
35
+ }
36
+ async onModuleInit() {
37
+ const jobConfigs = this.getJobConfigurations();
38
+ await this.scheduleJobs(jobConfigs);
39
+ }
40
+ async process(job) {
41
+ const jobProcessor = this.getJobProcessorByName(job.name);
42
+ if (!jobProcessor)
43
+ return;
44
+ const shouldProcess = await this.shouldProcessJob(job);
45
+ if (!shouldProcess)
46
+ return;
47
+ try {
48
+ await jobProcessor.process(job);
49
+ }
50
+ catch (error) {
51
+ console.error(error);
52
+ }
53
+ }
54
+ getJobConfigurations() {
55
+ return this.discoveryService
56
+ .getProviders({ metadataKey: queue_decorator_1.JobProcessor.KEY })
57
+ .map((provider) => {
58
+ const metadata = this.discoveryService.getMetadataByDecorator(queue_decorator_1.JobProcessor, provider);
59
+ if (!metadata)
60
+ return null;
61
+ if (typeof metadata === "string") {
62
+ return { name: metadata };
63
+ }
64
+ return { name: metadata.name, cron: metadata.cron };
65
+ })
66
+ .filter((job) => job !== null);
67
+ }
68
+ async scheduleJobs(jobConfigs) {
69
+ const schedulingPromises = jobConfigs
70
+ .filter((job) => job.cron)
71
+ .map(async ({ name, cron }) => {
72
+ const existingSchedulers = await this.queue.getJobSchedulers();
73
+ const outdatedSchedulers = existingSchedulers.filter((scheduler) => scheduler.name === name && scheduler.pattern !== cron);
74
+ await Promise.allSettled(outdatedSchedulers.map((scheduler) => this.queue.removeJobScheduler(scheduler.key)));
75
+ await this.queue.upsertJobScheduler(name, { pattern: cron }, { name });
76
+ });
77
+ await Promise.all(schedulingPromises);
78
+ }
79
+ async shouldProcessJob(job) {
80
+ if (!job.repeatJobKey)
81
+ return true;
82
+ const activeJobs = await this.queue.getActive();
83
+ const activeJobsOfSameType = activeJobs.filter((activeJob) => activeJob.name === job.name && activeJob.id !== job.id);
84
+ return activeJobsOfSameType.length === 0;
85
+ }
86
+ getJobProcessorByName(jobName) {
87
+ const providerWithProcessor = this.discoveryService
88
+ .getProviders({ metadataKey: queue_decorator_1.JobProcessor.KEY })
89
+ .find((provider) => {
90
+ const metadata = this.discoveryService.getMetadataByDecorator(queue_decorator_1.JobProcessor, provider);
91
+ if (!metadata)
92
+ return false;
93
+ const name = typeof metadata === "string" ? metadata : metadata.name;
94
+ return name === jobName;
95
+ });
96
+ return providerWithProcessor?.instance ?? null;
97
+ }
98
+ };
99
+ exports.QueueProcessor = QueueProcessor;
100
+ exports.QueueProcessor = QueueProcessor = QueueProcessor_1 = __decorate([
101
+ (0, common_1.Injectable)(),
102
+ (0, bullmq_1.Processor)(queue_constants_1.DEFAULT_QUEUE),
103
+ __param(1, (0, bullmq_1.InjectQueue)(queue_constants_1.DEFAULT_QUEUE)),
104
+ __param(2, (0, common_1.Optional)()),
105
+ __param(2, (0, common_1.Inject)(queue_constants_1.QUEUE_MODULE_OPTIONS)),
106
+ __metadata("design:paramtypes", [core_1.DiscoveryService,
107
+ bullmq_2.Queue, Object])
108
+ ], QueueProcessor);
109
+ //# sourceMappingURL=queue.processor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queue.processor.js","sourceRoot":"","sources":["../../../src/queue/processors/queue.processor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAmE;AACnE,uCAA+C;AAC/C,mCAAmC;AAEnC,mEAA4D;AAC5D,wDAAwE;AACxE,2CAMuB;AAKhB,IAAM,cAAc,sBAApB,MAAM,cAAe,SAAQ,mBAAU;IAEzB;IAC4B;IAG5B;IALnB,YACmB,gBAAkC,EACN,KAAY,EAGxC,OAA4B;QAE7C,KAAK,EAAE,CAAA;QANU,qBAAgB,GAAhB,gBAAgB,CAAkB;QACN,UAAK,GAAL,KAAK,CAAO;QAGxC,YAAO,GAAP,OAAO,CAAqB;QAI7C,IAAI,IAAI,CAAC,OAAO,EAAE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AS,CAAC,IAAI,KAAK,GAAG,CAAC,IAAI,IAAI,SAAS,CAAC,EAAE,KAAK,GAAG,CAAC,EAAE,CACzD,CAAA;QAED,OAAO,oBAAoB,CAAC,MAAM,KAAK,CAAC,CAAA;IAC1C,CAAC;IAEO,qBAAqB,CAAC,OAAe;QAC3C,MAAM,qBAAqB,GAAG,IAAI,CAAC,gBAAgB;aAChD,YAAY,CAAC,EAAE,WAAW,EAAE,8BAAY,CAAC,GAAG,EAAE,CAAC;aAC/C,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE;YACjB,MAAM,QAAQ,GAAG,IAAI,CAAC,gBAAgB,CAAC,sBAAsB,CAC3D,8BAAY,EACZ,QAAQ,CACT,CAAA;YAED,IAAI,CAAC,QAAQ;gBAAE,OAAO,KAAK,CAAA;YAE3B,MAAM,IAAI,GAAG,OAAO,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAA;YAEpE,OAAO,IAAI,KAAK,OAAO,CAAA;QACzB,CAAC,CAAC,CAAA;QAEJ,OAAQ,qBAAqB,EAAE,QAAkC,IAAI,IAAI,CAAA;IAC3E,CAAC;CACF,CAAA;AA3GY,wCAAc;yBAAd,cAAc;IAF1B,IAAA,mBAAU,GAAE;IACZ,IAAA,kBAAS,EAAC,+BAAa,CAAC;IAIpB,WAAA,IAAA,oBAAW,EAAC,+BAAa,CAAC,CAAA;IAC1B,WAAA,IAAA,iBAAQ,GAAE,CAAA;IACV,WAAA,IAAA,eAAM,EAAC,sCAAoB,CAAC,CAAA;qCAHM,uBAAgB;QACC,cAAK;GAHhD,cAAc,CA2G1B"}
@@ -0,0 +1,2 @@
1
+ export declare const DEFAULT_QUEUE = "default";
2
+ export declare const QUEUE_MODULE_OPTIONS = "QUEUE_MODULE_OPTIONS";
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.QUEUE_MODULE_OPTIONS = exports.DEFAULT_QUEUE = void 0;
4
+ exports.DEFAULT_QUEUE = "default";
5
+ exports.QUEUE_MODULE_OPTIONS = "QUEUE_MODULE_OPTIONS";
6
+ //# sourceMappingURL=queue.constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queue.constants.js","sourceRoot":"","sources":["../../src/queue/queue.constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,aAAa,GAAG,SAAS,CAAA;AACzB,QAAA,oBAAoB,GAAG,sBAAsB,CAAA"}
@@ -0,0 +1,6 @@
1
+ import { Job, JobsOptions, Queue } from "bullmq";
2
+ export declare class QueueService {
3
+ private readonly queue;
4
+ constructor(queue: Queue);
5
+ add(name: string, data: any, opts?: JobsOptions): Promise<Job<any, any, string>>;
6
+ }
@@ -0,0 +1,35 @@
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.QueueService = void 0;
16
+ const bullmq_1 = require("@nestjs/bullmq");
17
+ const common_1 = require("@nestjs/common");
18
+ const bullmq_2 = require("bullmq");
19
+ const queue_constants_1 = require("../queue.constants");
20
+ let QueueService = class QueueService {
21
+ queue;
22
+ constructor(queue) {
23
+ this.queue = queue;
24
+ }
25
+ add(name, data, opts) {
26
+ return this.queue.add(name, data, opts);
27
+ }
28
+ };
29
+ exports.QueueService = QueueService;
30
+ exports.QueueService = QueueService = __decorate([
31
+ (0, common_1.Injectable)(),
32
+ __param(0, (0, bullmq_1.InjectQueue)(queue_constants_1.DEFAULT_QUEUE)),
33
+ __metadata("design:paramtypes", [bullmq_2.Queue])
34
+ ], QueueService);
35
+ //# sourceMappingURL=queue.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queue.service.js","sourceRoot":"","sources":["../../../src/queue/services/queue.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA4C;AAC5C,2CAA2C;AAC3C,mCAAgD;AAChD,wDAAkD;AAG3C,IAAM,YAAY,GAAlB,MAAM,YAAY;IACkC;IAAzD,YAAyD,KAAY;QAAZ,UAAK,GAAL,KAAK,CAAO;IAAG,CAAC;IAEzE,GAAG,CACD,IAAY,EACZ,IAAS,EACT,IAAkB;QAElB,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;IACzC,CAAC;CACF,CAAA;AAVY,oCAAY;uBAAZ,YAAY;IADxB,IAAA,mBAAU,GAAE;IAEE,WAAA,IAAA,oBAAW,EAAC,+BAAa,CAAC,CAAA;qCAAyB,cAAK;GAD1D,YAAY,CAUxB"}
@@ -0,0 +1,8 @@
1
+ import { DynamicModule } from "@nestjs/common";
2
+ import { QueueModuleAsyncOptions, QueueModuleOptions } from "./interfaces/queue-options.interface";
3
+ export declare class SharedQueueModule {
4
+ static forRoot(options?: QueueModuleOptions): DynamicModule;
5
+ static forRootAsync(options: QueueModuleAsyncOptions): DynamicModule;
6
+ private static createAsyncProviders;
7
+ private static createAsyncOptionsProvider;
8
+ }