@lyrolab/nest-shared 0.0.1 → 1.0.1
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/.releaserc.json +26 -0
- package/CHANGELOG.md +17 -0
- package/README.md +30 -83
- package/commitlint.config.ts +4 -0
- package/dist/ai/index.d.ts +2 -0
- package/dist/ai/index.js +19 -0
- package/dist/ai/index.js.map +1 -0
- package/dist/bull/index.d.ts +1 -0
- package/dist/bull/index.js +18 -0
- package/dist/bull/index.js.map +1 -0
- package/dist/cache/index.d.ts +1 -0
- package/dist/cache/index.js +18 -0
- package/dist/cache/index.js.map +1 -0
- package/dist/cache/shared-cache.module.js +3 -1
- package/dist/cache/shared-cache.module.js.map +1 -1
- package/dist/database/helpers/find-main-path.d.ts +1 -0
- package/dist/database/helpers/find-main-path.js +23 -0
- package/dist/database/helpers/find-main-path.js.map +1 -0
- package/dist/database/index.d.ts +2 -0
- package/dist/database/index.js +19 -0
- package/dist/database/index.js.map +1 -0
- package/dist/database/shared-database.module.js +5 -4
- package/dist/database/shared-database.module.js.map +1 -1
- package/dist/queue/index.d.ts +4 -0
- package/dist/queue/index.js +21 -0
- package/dist/queue/index.js.map +1 -0
- package/dist/queue/shared-queue.module.d.ts +2 -0
- package/dist/queue/{queue.module.js → shared-queue.module.js} +6 -6
- package/dist/queue/shared-queue.module.js.map +1 -0
- package/dist/redis/index.d.ts +2 -0
- package/dist/redis/index.js +19 -0
- package/dist/redis/index.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +51 -24
- package/.husky/commit-msg +0 -1
- package/.husky/pre-commit +0 -1
- package/.nvmrc +0 -1
- package/.prettierrc +0 -5
- package/dist/index.d.ts +0 -12
- package/dist/index.js +0 -29
- package/dist/index.js.map +0 -1
- package/dist/queue/queue.module.d.ts +0 -2
- package/dist/queue/queue.module.js.map +0 -1
- package/dist/tsconfig.build.tsbuildinfo +0 -1
- package/nest-cli.json +0 -9
- package/src/ai/ai.module.ts +0 -8
- package/src/ai/services/ai.service.ts +0 -51
- package/src/app.module.ts +0 -8
- package/src/bull/shared-bull.module.ts +0 -27
- package/src/cache/shared-cache.module.ts +0 -30
- package/src/database/filters/typeorm-exception.filter.ts +0 -35
- package/src/database/shared-database.module.ts +0 -136
- package/src/index.ts +0 -12
- package/src/queue/controllers/queue.controller.ts +0 -13
- package/src/queue/decorators/queue.decorator.ts +0 -3
- package/src/queue/models/dto/queue-add.dto.ts +0 -10
- package/src/queue/models/job-processor-interface.ts +0 -5
- package/src/queue/processors/queue.processor.ts +0 -53
- package/src/queue/queue.constants.ts +0 -1
- package/src/queue/queue.module.ts +0 -14
- package/src/queue/services/queue.service.ts +0 -17
- package/src/redis/redis.config.ts +0 -3
- package/src/redis/shared-redis.module.ts +0 -66
- package/tsconfig.build.json +0 -4
- package/tsconfig.json +0 -25
package/.releaserc.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"branches": ["main"],
|
|
3
|
+
"plugins": [
|
|
4
|
+
"@semantic-release/commit-analyzer",
|
|
5
|
+
"@semantic-release/release-notes-generator",
|
|
6
|
+
"@semantic-release/changelog",
|
|
7
|
+
"@semantic-release/npm",
|
|
8
|
+
"@semantic-release/git"
|
|
9
|
+
],
|
|
10
|
+
"preset": "angular",
|
|
11
|
+
"releaseRules": [
|
|
12
|
+
{ "type": "feat", "release": "minor" },
|
|
13
|
+
{ "type": "fix", "release": "patch" },
|
|
14
|
+
{ "type": "perf", "release": "patch" },
|
|
15
|
+
{ "type": "docs", "release": "patch" },
|
|
16
|
+
{ "type": "style", "release": "patch" },
|
|
17
|
+
{ "type": "refactor", "release": "patch" },
|
|
18
|
+
{ "type": "test", "release": "patch" },
|
|
19
|
+
{ "type": "build", "release": "patch" },
|
|
20
|
+
{ "type": "ci", "release": "patch" },
|
|
21
|
+
{ "type": "chore", "release": "patch" }
|
|
22
|
+
],
|
|
23
|
+
"npmPublish": true,
|
|
24
|
+
"pkgRoot": ".",
|
|
25
|
+
"tarballDir": "dist"
|
|
26
|
+
}
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
## [1.0.1](https://github.com/lyrolab/nest-shared/compare/v1.0.0...v1.0.1) (2025-04-10)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
- tsconfig ([f6fe7e2](https://github.com/lyrolab/nest-shared/commit/f6fe7e20ec31a4ec0fdf1ea2521db2c5e5a5925c))
|
|
6
|
+
|
|
7
|
+
# 1.0.0 (2025-04-10)
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
- setup app token ([901a88b](https://github.com/lyrolab/nest-shared/commit/901a88b530976e37b1d73bcbd85764d19faa2864))
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
- add semantic release ([8945d0e](https://github.com/lyrolab/nest-shared/commit/8945d0e1830e57c829174c7165594daff2228a61))
|
|
16
|
+
- common modules ([e732d32](https://github.com/lyrolab/nest-shared/commit/e732d32b71aa55cf3c3499fdafcaa3f44efaf1f3))
|
|
17
|
+
- export per module ([fe7f053](https://github.com/lyrolab/nest-shared/commit/fe7f053939d3f72cbe4a80f52878885e8ece2e3c))
|
package/README.md
CHANGED
|
@@ -1,98 +1,45 @@
|
|
|
1
|
-
|
|
2
|
-
<a href="http://nestjs.com/" target="blank"><img src="https://nestjs.com/img/logo-small.svg" width="120" alt="Nest Logo" /></a>
|
|
3
|
-
</p>
|
|
1
|
+
# Nest Shared
|
|
4
2
|
|
|
5
|
-
|
|
6
|
-
[circleci-url]: https://circleci.com/gh/nestjs/nest
|
|
3
|
+
A collection of shared modules for NestJS applications used across our company's projects. This package provides reusable components for common functionality including AI, Redis/Cache/Bull/Queue, and Database operations.
|
|
7
4
|
|
|
8
|
-
|
|
9
|
-
<p align="center">
|
|
10
|
-
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/v/@nestjs/core.svg" alt="NPM Version" /></a>
|
|
11
|
-
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/l/@nestjs/core.svg" alt="Package License" /></a>
|
|
12
|
-
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/dm/@nestjs/common.svg" alt="NPM Downloads" /></a>
|
|
13
|
-
<a href="https://circleci.com/gh/nestjs/nest" target="_blank"><img src="https://img.shields.io/circleci/build/github/nestjs/nest/master" alt="CircleCI" /></a>
|
|
14
|
-
<a href="https://discord.gg/G7Qnnhy" target="_blank"><img src="https://img.shields.io/badge/discord-online-brightgreen.svg" alt="Discord"/></a>
|
|
15
|
-
<a href="https://opencollective.com/nest#backer" target="_blank"><img src="https://opencollective.com/nest/backers/badge.svg" alt="Backers on Open Collective" /></a>
|
|
16
|
-
<a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://opencollective.com/nest/sponsors/badge.svg" alt="Sponsors on Open Collective" /></a>
|
|
17
|
-
<a href="https://paypal.me/kamilmysliwiec" target="_blank"><img src="https://img.shields.io/badge/Donate-PayPal-ff3f59.svg" alt="Donate us"/></a>
|
|
18
|
-
<a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://img.shields.io/badge/Support%20us-Open%20Collective-41B883.svg" alt="Support us"></a>
|
|
19
|
-
<a href="https://twitter.com/nestframework" target="_blank"><img src="https://img.shields.io/twitter/follow/nestframework.svg?style=social&label=Follow" alt="Follow us on Twitter"></a>
|
|
20
|
-
</p>
|
|
21
|
-
<!--[](https://opencollective.com/nest#backer)
|
|
22
|
-
[](https://opencollective.com/nest#sponsor)-->
|
|
23
|
-
|
|
24
|
-
## Description
|
|
25
|
-
|
|
26
|
-
[Nest](https://github.com/nestjs/nest) framework TypeScript starter repository.
|
|
27
|
-
|
|
28
|
-
## Project setup
|
|
5
|
+
## Installation
|
|
29
6
|
|
|
30
7
|
```bash
|
|
31
|
-
|
|
8
|
+
npm install @lyrolab/nest-shared
|
|
32
9
|
```
|
|
33
10
|
|
|
34
|
-
##
|
|
11
|
+
## Features
|
|
35
12
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
# watch mode
|
|
41
|
-
$ npm run start:dev
|
|
13
|
+
- [Database Module](./src/database/README.md): Shared database configurations and utilities
|
|
14
|
+
- [AI Module](./src/ai/README.md): Common AI-related functionality
|
|
15
|
+
- [Job Processing Module](./src/queue/README.md): Shared queue management
|
|
16
|
+
- [Caching Module](./src/cache/README.md): Shared caching functionality
|
|
42
17
|
|
|
43
|
-
|
|
44
|
-
$ npm run start:prod
|
|
45
|
-
```
|
|
18
|
+
## Quick Start
|
|
46
19
|
|
|
47
|
-
|
|
20
|
+
1. Install the package:
|
|
48
21
|
|
|
49
22
|
```bash
|
|
50
|
-
|
|
51
|
-
$ npm run test
|
|
52
|
-
|
|
53
|
-
# e2e tests
|
|
54
|
-
$ npm run test:e2e
|
|
55
|
-
|
|
56
|
-
# test coverage
|
|
57
|
-
$ npm run test:cov
|
|
23
|
+
npm install @lyrolab/nest-shared
|
|
58
24
|
```
|
|
59
25
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
26
|
+
2. Import the modules you need in your `app.module.ts`:
|
|
27
|
+
|
|
28
|
+
```typescript
|
|
29
|
+
import { SharedDatabaseModule } from "@lyrolab/nest-shared/database"
|
|
30
|
+
import { AiModule } from "@lyrolab/nest-shared/ai"
|
|
31
|
+
import { SharedQueueModule } from "@lyrolab/nest-shared/queue"
|
|
32
|
+
import { SharedCacheModule } from "@lyrolab/nest-shared/cache"
|
|
33
|
+
|
|
34
|
+
@Module({
|
|
35
|
+
imports: [
|
|
36
|
+
SharedDatabaseModule.forRoot(),
|
|
37
|
+
AiModule,
|
|
38
|
+
SharedQueueModule,
|
|
39
|
+
SharedCacheModule.forRoot(),
|
|
40
|
+
],
|
|
41
|
+
})
|
|
42
|
+
export class AppModule {}
|
|
69
43
|
```
|
|
70
44
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
## Resources
|
|
74
|
-
|
|
75
|
-
Check out a few resources that may come in handy when working with NestJS:
|
|
76
|
-
|
|
77
|
-
- Visit the [NestJS Documentation](https://docs.nestjs.com) to learn more about the framework.
|
|
78
|
-
- For questions and support, please visit our [Discord channel](https://discord.gg/G7Qnnhy).
|
|
79
|
-
- To dive deeper and get more hands-on experience, check out our official video [courses](https://courses.nestjs.com/).
|
|
80
|
-
- Deploy your application to AWS with the help of [NestJS Mau](https://mau.nestjs.com) in just a few clicks.
|
|
81
|
-
- Visualize your application graph and interact with the NestJS application in real-time using [NestJS Devtools](https://devtools.nestjs.com).
|
|
82
|
-
- Need help with your project (part-time to full-time)? Check out our official [enterprise support](https://enterprise.nestjs.com).
|
|
83
|
-
- To stay in the loop and get updates, follow us on [X](https://x.com/nestframework) and [LinkedIn](https://linkedin.com/company/nestjs).
|
|
84
|
-
- Looking for a job, or have a job to offer? Check out our official [Jobs board](https://jobs.nestjs.com).
|
|
85
|
-
|
|
86
|
-
## Support
|
|
87
|
-
|
|
88
|
-
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support).
|
|
89
|
-
|
|
90
|
-
## Stay in touch
|
|
91
|
-
|
|
92
|
-
- Author - [Kamil Myśliwiec](https://twitter.com/kammysliwiec)
|
|
93
|
-
- Website - [https://nestjs.com](https://nestjs.com/)
|
|
94
|
-
- Twitter - [@nestframework](https://twitter.com/nestframework)
|
|
95
|
-
|
|
96
|
-
## License
|
|
97
|
-
|
|
98
|
-
Nest is [MIT licensed](https://github.com/nestjs/nest/blob/master/LICENSE).
|
|
45
|
+
For detailed documentation and configuration options for each module, please refer to their respective README files.
|
package/dist/ai/index.js
ADDED
|
@@ -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
|
+
__exportStar(require("./ai.module"), exports);
|
|
18
|
+
__exportStar(require("./services/ai.service"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ai/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA2B;AAC3B,wDAAqC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./shared-bull.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-bull.module"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/bull/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAoC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./shared-cache.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-cache.module"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cache/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wDAAqC"}
|
|
@@ -23,7 +23,9 @@ let SharedCacheModule = SharedCacheModule_1 = class SharedCacheModule {
|
|
|
23
23
|
cache_manager_1.CacheModule.registerAsync({
|
|
24
24
|
isGlobal: true,
|
|
25
25
|
useFactory: (configService, redisConfig) => ({
|
|
26
|
-
ttl:
|
|
26
|
+
ttl: configService.get("CACHE_TTL")
|
|
27
|
+
? +configService.get("CACHE_TTL") * 1000
|
|
28
|
+
: undefined,
|
|
27
29
|
stores: [new redis_1.default(redisConfig.url)],
|
|
28
30
|
}),
|
|
29
31
|
inject: [config_1.ConfigService, redis_config_1.RedisConfig],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared-cache.module.js","sourceRoot":"","sources":["../../src/cache/shared-cache.module.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,uCAAmC;AACnC,yDAAmD;AACnD,2CAAsD;AACtD,2CAA8C;AAC9C,wDAAmD;AACnD,sEAAgE;AAGzD,IAAM,iBAAiB,yBAAvB,MAAM,iBAAiB;IAC5B,MAAM,CAAC,OAAO;QACZ,OAAO;YACL,MAAM,EAAE,mBAAiB;YACzB,OAAO,EAAE;gBACP,uCAAiB;gBACjB,2BAAW,CAAC,aAAa,CAAC;oBACxB,QAAQ,EAAE,IAAI;oBACd,UAAU,EAAE,CACV,aAA4B,EAC5B,WAAwB,EACxB,EAAE,CAAC,CAAC;wBACJ,GAAG,EAAE,CAAC,aAAa,CAAC,GAAG,CAAC,WAAW,CAAC,GAAG,IAAI;
|
|
1
|
+
{"version":3,"file":"shared-cache.module.js","sourceRoot":"","sources":["../../src/cache/shared-cache.module.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,uCAAmC;AACnC,yDAAmD;AACnD,2CAAsD;AACtD,2CAA8C;AAC9C,wDAAmD;AACnD,sEAAgE;AAGzD,IAAM,iBAAiB,yBAAvB,MAAM,iBAAiB;IAC5B,MAAM,CAAC,OAAO;QACZ,OAAO;YACL,MAAM,EAAE,mBAAiB;YACzB,OAAO,EAAE;gBACP,uCAAiB;gBACjB,2BAAW,CAAC,aAAa,CAAC;oBACxB,QAAQ,EAAE,IAAI;oBACd,UAAU,EAAE,CACV,aAA4B,EAC5B,WAAwB,EACxB,EAAE,CAAC,CAAC;wBACJ,GAAG,EAAE,aAAa,CAAC,GAAG,CAAC,WAAW,CAAC;4BACjC,CAAC,CAAC,CAAC,aAAa,CAAC,GAAG,CAAC,WAAW,CAAC,GAAG,IAAI;4BACxC,CAAC,CAAC,SAAS;wBACb,MAAM,EAAE,CAAC,IAAI,eAAS,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;qBACzC,CAAC;oBACF,MAAM,EAAE,CAAC,sBAAa,EAAE,0BAAW,CAAC;iBACrC,CAAC;aACH;YACD,OAAO,EAAE,CAAC,2BAAW,CAAC;SACvB,CAAA;IACH,CAAC;CACF,CAAA;AAvBY,8CAAiB;4BAAjB,iBAAiB;IAD7B,IAAA,eAAM,EAAC,EAAE,CAAC;GACE,iBAAiB,CAuB7B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function findMainPath(): string;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.findMainPath = findMainPath;
|
|
4
|
+
const fs_1 = require("fs");
|
|
5
|
+
const path_1 = require("path");
|
|
6
|
+
function findMainPath() {
|
|
7
|
+
const rootPath = findUp("package.json", process.cwd());
|
|
8
|
+
if (!rootPath)
|
|
9
|
+
throw new Error("package.json not found");
|
|
10
|
+
return rootPath;
|
|
11
|
+
}
|
|
12
|
+
function findUp(path, cwd) {
|
|
13
|
+
const currentPath = cwd;
|
|
14
|
+
const parentPath = (0, path_1.dirname)(currentPath);
|
|
15
|
+
if (parentPath === currentPath) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
if ((0, fs_1.existsSync)((0, path_1.join)(currentPath, path))) {
|
|
19
|
+
return currentPath;
|
|
20
|
+
}
|
|
21
|
+
return findUp(path, parentPath);
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=find-main-path.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find-main-path.js","sourceRoot":"","sources":["../../../src/database/helpers/find-main-path.ts"],"names":[],"mappings":";;AAGA,oCAIC;AAPD,2BAA+B;AAC/B,+BAAoC;AAEpC,SAAgB,YAAY;IAC1B,MAAM,QAAQ,GAAG,MAAM,CAAC,cAAc,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC,CAAA;IACtD,IAAI,CAAC,QAAQ;QAAE,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAA;IACxD,OAAO,QAAQ,CAAA;AACjB,CAAC;AAED,SAAS,MAAM,CAAC,IAAY,EAAE,GAAW;IACvC,MAAM,WAAW,GAAG,GAAG,CAAA;IACvB,MAAM,UAAU,GAAG,IAAA,cAAO,EAAC,WAAW,CAAC,CAAA;IACvC,IAAI,UAAU,KAAK,WAAW,EAAE,CAAC;QAC/B,OAAO,IAAI,CAAA;IACb,CAAC;IAED,IAAI,IAAA,eAAU,EAAC,IAAA,WAAI,EAAC,WAAW,EAAE,IAAI,CAAC,CAAC,EAAE,CAAC;QACxC,OAAO,WAAW,CAAA;IACpB,CAAC;IAED,OAAO,MAAM,CAAC,IAAI,EAAE,UAAU,CAAC,CAAA;AACjC,CAAC"}
|
|
@@ -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
|
+
__exportStar(require("./shared-database.module"), exports);
|
|
18
|
+
__exportStar(require("./filters/typeorm-exception.filter"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/database/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2DAAwC;AACxC,qEAAkD"}
|
|
@@ -12,6 +12,7 @@ const common_1 = require("@nestjs/common");
|
|
|
12
12
|
const config_1 = require("@nestjs/config");
|
|
13
13
|
const typeorm_1 = require("@nestjs/typeorm");
|
|
14
14
|
const path_1 = require("path");
|
|
15
|
+
const find_main_path_1 = require("./helpers/find-main-path");
|
|
15
16
|
const testcontainers_1 = require("testcontainers");
|
|
16
17
|
const typeorm_2 = require("typeorm");
|
|
17
18
|
let SharedDatabaseModule = class SharedDatabaseModule {
|
|
@@ -53,10 +54,10 @@ let SharedDatabaseModule = class SharedDatabaseModule {
|
|
|
53
54
|
}
|
|
54
55
|
const connectionUri = `postgres://postgres:secret@localhost:${this.testContainer.getMappedPort(5432)}/test`;
|
|
55
56
|
const entities = options.entities || [
|
|
56
|
-
(0, path_1.join)(
|
|
57
|
+
(0, path_1.join)((0, find_main_path_1.findMainPath)(), "**/*.entity{.ts,.js}"),
|
|
57
58
|
];
|
|
58
59
|
const migrations = options.migrations || [
|
|
59
|
-
(0, path_1.join)(
|
|
60
|
+
(0, path_1.join)((0, find_main_path_1.findMainPath)(), "src/migrations/**/*.{ts,js}"),
|
|
60
61
|
];
|
|
61
62
|
if (!this.testDataSource) {
|
|
62
63
|
this.testDataSource = new typeorm_2.DataSource({
|
|
@@ -81,10 +82,10 @@ let SharedDatabaseModule = class SharedDatabaseModule {
|
|
|
81
82
|
type: "postgres",
|
|
82
83
|
url: configService.get("DATABASE_URL"),
|
|
83
84
|
entities: options.entities || [
|
|
84
|
-
(0, path_1.join)(
|
|
85
|
+
(0, path_1.join)((0, find_main_path_1.findMainPath)(), "**/*.entity{.ts,.js}"),
|
|
85
86
|
],
|
|
86
87
|
migrations: options.migrations || [
|
|
87
|
-
(0, path_1.join)(
|
|
88
|
+
(0, path_1.join)((0, find_main_path_1.findMainPath)(), "src/migrations/**/*.{ts,js}"),
|
|
88
89
|
],
|
|
89
90
|
synchronize: false,
|
|
90
91
|
autoLoadEntities: true,
|
|
@@ -1 +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,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,EAAE,EAAE;wBACjD,MAAM,iBAAiB,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,MAAM,CAAA;wBAEzD,IAAI,iBAAiB,EAAE,CAAC;4BACtB,OAAO,MAAM,IAAI,CAAC,uBAAuB,CAAC,OAAO,CAAC,CAAA;wBACpD,CAAC;wBAED,OAAO,IAAI,CAAC,6BAA6B,CAAC,aAAa,EAAE,OAAO,CAAC,CAAA;oBACnE,CAAC;iBACF,CAAC;aACH;YACD,OAAO,EAAE,CAAC,uBAAa,CAAC;SACzB,CAAA;IACH,CAAC;IAEO,MAAM,CAAC,KAAK,CAAC,uBAAuB,CAC1C,OAAoC;QAEpC,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC;YACxB,IAAI,CAAC,aAAa,GAAG,MAAM,IAAI,iCAAgB,CAAC,UAAU,CAAC;iBACxD,gBAAgB,CAAC,IAAI,CAAC;iBACtB,eAAe,CAAC;gBACf,iBAAiB,EAAE,QAAQ;gBAC3B,WAAW,EAAE,MAAM;aACpB,CAAC;iBACD,gBAAgB,CACf,qBAAI,CAAC,MAAM,CAAC;gBACV,qBAAI,CAAC,iBAAiB,EAAE;gBACxB,qBAAI,CAAC,aAAa,CAChB,gDAAgD,CACjD;aACF,CAAC,CACH;iBACA,KAAK,EAAE,CAAA;QACZ,CAAC;QAED,MAAM,aAAa,GAAG,wCAAwC,IAAI,CAAC,aAAa,CAAC,aAAa,CAC5F,IAAI,CACL,OAAO,CAAA;QAER,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI;YACnC,IAAA,WAAI,EAAC,
|
|
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,UA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rC,CAAC;QACD,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;YACvB,MAAM,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,CAAA;QACjC,CAAC;IACH,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,iBAAiB;QAC5B,IAAI,IAAI,CAAC,cAAc,EAAE,CAAC;YACxB,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,21 @@
|
|
|
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
|
+
//# 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"}
|
|
@@ -6,7 +6,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
6
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
7
|
};
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.
|
|
9
|
+
exports.SharedQueueModule = void 0;
|
|
10
10
|
const bullmq_1 = require("@nestjs/bullmq");
|
|
11
11
|
const common_1 = require("@nestjs/common");
|
|
12
12
|
const core_1 = require("@nestjs/core");
|
|
@@ -14,15 +14,15 @@ const queue_processor_1 = require("./processors/queue.processor");
|
|
|
14
14
|
const queue_constants_1 = require("./queue.constants");
|
|
15
15
|
const queue_service_1 = require("./services/queue.service");
|
|
16
16
|
const queue_controller_1 = require("./controllers/queue.controller");
|
|
17
|
-
let
|
|
17
|
+
let SharedQueueModule = class SharedQueueModule {
|
|
18
18
|
};
|
|
19
|
-
exports.
|
|
20
|
-
exports.
|
|
19
|
+
exports.SharedQueueModule = SharedQueueModule;
|
|
20
|
+
exports.SharedQueueModule = SharedQueueModule = __decorate([
|
|
21
21
|
(0, common_1.Module)({
|
|
22
22
|
imports: [bullmq_1.BullModule.registerQueue({ name: queue_constants_1.DEFAULT_QUEUE }), core_1.DiscoveryModule],
|
|
23
23
|
providers: [queue_service_1.QueueService, queue_processor_1.QueueProcessor],
|
|
24
24
|
exports: [queue_service_1.QueueService],
|
|
25
25
|
controllers: [queue_controller_1.QueueController],
|
|
26
26
|
})
|
|
27
|
-
],
|
|
28
|
-
//# sourceMappingURL=queue.module.js.map
|
|
27
|
+
], SharedQueueModule);
|
|
28
|
+
//# sourceMappingURL=shared-queue.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared-queue.module.js","sourceRoot":"","sources":["../../src/queue/shared-queue.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAA2C;AAC3C,2CAAuC;AACvC,uCAA8C;AAC9C,kEAA6D;AAC7D,uDAAiD;AACjD,4DAAuD;AACvD,qEAAgE;AAOzD,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;CAAG,CAAA;AAApB,8CAAiB;4BAAjB,iBAAiB;IAN7B,IAAA,eAAM,EAAC;QACN,OAAO,EAAE,CAAC,mBAAU,CAAC,aAAa,CAAC,EAAE,IAAI,EAAE,+BAAa,EAAE,CAAC,EAAE,sBAAe,CAAC;QAC7E,SAAS,EAAE,CAAC,4BAAY,EAAE,gCAAc,CAAC;QACzC,OAAO,EAAE,CAAC,4BAAY,CAAC;QACvB,WAAW,EAAE,CAAC,kCAAe,CAAC;KAC/B,CAAC;GACW,iBAAiB,CAAG"}
|
|
@@ -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
|
+
__exportStar(require("./shared-redis.module"), exports);
|
|
18
|
+
__exportStar(require("./redis.config"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/redis/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wDAAqC;AACrC,iDAA8B"}
|