diff --git a/apps/sample/src/app/app.controller.ts b/apps/sample/src/app/app.controller.ts index 108373f..8543a08 100644 --- a/apps/sample/src/app/app.controller.ts +++ b/apps/sample/src/app/app.controller.ts @@ -1,18 +1,16 @@ -import { Controller, Get, UseGuards } from '@nestjs/common'; +import { Controller, Get } from '@nestjs/common'; +import { ApiTags } from '@nestjs/swagger'; import { AppService } from './app.service'; -import { AbilitiesGuard, CheckAbilities, JwtGuard } from '@rumsan/user'; -import { ACTIONS, APP, SUBJECTS } from '../constants'; -import { ApiBearerAuth, ApiTags } from '@nestjs/swagger'; @Controller('app') @ApiTags('App') -@ApiBearerAuth(APP.JWT_BEARER) +//@ApiBearerAuth(APP.JWT_BEARER) export class AppController { constructor(private readonly appService: AppService) {} - @CheckAbilities({ action: ACTIONS.READ, subject: SUBJECTS.USER }) - @UseGuards(JwtGuard, AbilitiesGuard) + // @CheckAbilities({ action: ACTIONS.READ, subject: SUBJECTS.USER }) + // @UseGuards(JwtGuard, AbilitiesGuard) @Get() getData() { return this.appService.getData(); diff --git a/apps/sample/src/app/app.module.ts b/apps/sample/src/app/app.module.ts index 56e6f48..2151250 100644 --- a/apps/sample/src/app/app.module.ts +++ b/apps/sample/src/app/app.module.ts @@ -2,23 +2,42 @@ import { Module } from '@nestjs/common'; // import { UserModule } from '../user/user.module'; import { PrismaModule } from '@rumsan/prisma'; -import { ConfigModule } from '@nestjs/config'; +import { ConfigModule, ConfigService } from '@nestjs/config'; import { EventEmitterModule } from '@nestjs/event-emitter'; -import { RumsanUserModule } from '@rumsan/user'; +import { QueueModule } from '@rumsan/queue'; +import { RumsanUserModule, SignupModule } from '@rumsan/user'; import { ListenerModule } from '../listener/listener.module'; import { UserModule } from '../user/user.module'; import { AppController } from './app.controller'; import { AppService } from './app.service'; +// bullmq.transport.ts @Module({ imports: [ + QueueModule.forRoot({ + imports: [ConfigModule], + useFactory: async (configService: ConfigService) => ({ + connection: { + host: configService.get('REDIS_HOST'), + port: +configService.get('REDIS_PORT'), + password: configService.get('REDIS_PASSWORD'), + // retryStrategy: (times) => { + // // reconnect after + // return Math.min(times * 50, 2000); + // }, + // // might need to change on producttion + // maxRetriesPerRequest: 1000, + }, + }), + inject: [ConfigService], + }), ConfigModule.forRoot({ isGlobal: true }), EventEmitterModule.forRoot({ maxListeners: 10, ignoreErrors: false }), ListenerModule, PrismaModule, UserModule, RumsanUserModule, - //SignupModule.register({ autoApprove: false }), + SignupModule.register({ autoApprove: false }), ], controllers: [AppController], providers: [AppService], diff --git a/apps/sample/src/app/app.service.ts b/apps/sample/src/app/app.service.ts index 01a14b2..def1158 100644 --- a/apps/sample/src/app/app.service.ts +++ b/apps/sample/src/app/app.service.ts @@ -1,11 +1,12 @@ -import { PrismaService } from '@rumsan/prisma'; import { Injectable } from '@nestjs/common'; +import { PrismaService } from '@rumsan/prisma'; @Injectable() export class AppService { constructor(private prisma: PrismaService) {} async getData() { const d = await this.prisma.user.findMany(); + // this.queue.sendMessage('APP_QUEUE', { message: 'Hello Santosh', data: d }); return { message: 'Hello API', data: d }; } } diff --git a/apps/sample/src/user/user.module.ts b/apps/sample/src/user/user.module.ts index 26cc776..5462f9d 100644 --- a/apps/sample/src/user/user.module.ts +++ b/apps/sample/src/user/user.module.ts @@ -1,10 +1,21 @@ import { Module } from '@nestjs/common'; -import { RumsanUserModule } from '@rumsan/user'; +import { PrismaModule } from '@rumsan/prisma'; +import { QueueModule, QueueService } from '@rumsan/queue'; +import { AuthModule } from '@rumsan/user'; import { AppUserController } from './user.controller'; +import { UserProcessor } from './user.processor'; import { AppUserService } from './user.service'; @Module({ + imports: [ + AuthModule, + PrismaModule, + //QueueModule, + QueueModule.registerQueue({ + name: 'APP_QUEUE', + }), + ], controllers: [AppUserController], - providers: [AppUserService], + providers: [UserProcessor, AppUserService, QueueService], }) -export class UserModule extends RumsanUserModule {} +export class UserModule {} diff --git a/apps/sample/src/user/user.processor.ts b/apps/sample/src/user/user.processor.ts new file mode 100644 index 0000000..51e9013 --- /dev/null +++ b/apps/sample/src/user/user.processor.ts @@ -0,0 +1,14 @@ +import { Injectable, Logger } from '@nestjs/common'; + +@Injectable() +export class UserProcessor { + private readonly _logger = new Logger('USER_TEST'); + + // constructor(@Inject('TRANSPORT') private readonly queue: QueueService) {} + + // public async sendOTP(d): Promise { + // this.queue.receiveMessage('USER_TEST', (data) => { + // console.log('data', data); + // }); + // } +} diff --git a/apps/sample/src/user/user.service.ts b/apps/sample/src/user/user.service.ts index 3dc9735..6a38d2d 100644 --- a/apps/sample/src/user/user.service.ts +++ b/apps/sample/src/user/user.service.ts @@ -1,11 +1,33 @@ import { Injectable } from '@nestjs/common'; -import { UserService } from '@rumsan/user'; - -const USER_ROLE_ID = 3; +import { PrismaService } from '@rumsan/prisma'; +import { QueueService } from '@rumsan/queue'; +import { AuthService, UserService } from '@rumsan/user'; @Injectable() export class AppUserService extends UserService { + constructor( + protected prisma: PrismaService, + public authService: AuthService, + private queueService: QueueService, + ) { + super(prisma, authService); + } + + // @OnMessage() async Test(dto: any) { - return {}; + // console.log('queueService', { s: this.queueService }); + this.queueService.sendMessage('APP_QUEUE', { + message: 'another santosh', + data: { + name: 'test', + }, + }); + // this.queueService.receiveMessage('QUEUE_TEST', (data: Job) => { + // console.log('data', data); + // console.log(data.getState()); + // return data; + // }); + + return { message: 'success' }; } } diff --git a/libs/beneficiary/.eslintrc.json b/libs/beneficiary/.eslintrc.json new file mode 100644 index 0000000..9d9c0db --- /dev/null +++ b/libs/beneficiary/.eslintrc.json @@ -0,0 +1,18 @@ +{ + "extends": ["../../.eslintrc.json"], + "ignorePatterns": ["!**/*"], + "overrides": [ + { + "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], + "rules": {} + }, + { + "files": ["*.ts", "*.tsx"], + "rules": {} + }, + { + "files": ["*.js", "*.jsx"], + "rules": {} + } + ] +} diff --git a/libs/beneficiary/README.md b/libs/beneficiary/README.md new file mode 100644 index 0000000..c0b6200 --- /dev/null +++ b/libs/beneficiary/README.md @@ -0,0 +1,7 @@ +# beneficiary + +This library was generated with [Nx](https://nx.dev). + +## Running unit tests + +Run `nx test beneficiary` to execute the unit tests via [Jest](https://jestjs.io). diff --git a/libs/beneficiary/jest.config.ts b/libs/beneficiary/jest.config.ts new file mode 100644 index 0000000..8df00b3 --- /dev/null +++ b/libs/beneficiary/jest.config.ts @@ -0,0 +1,11 @@ +/* eslint-disable */ +export default { + displayName: 'beneficiary', + preset: '../../jest.preset.js', + testEnvironment: 'node', + transform: { + '^.+\\.[tj]s$': ['ts-jest', { tsconfig: '/tsconfig.spec.json' }], + }, + moduleFileExtensions: ['ts', 'js', 'html'], + coverageDirectory: '../../coverage/libs/beneficiary', +}; diff --git a/libs/beneficiary/project.json b/libs/beneficiary/project.json new file mode 100644 index 0000000..cc30f51 --- /dev/null +++ b/libs/beneficiary/project.json @@ -0,0 +1,20 @@ +{ + "name": "beneficiary", + "$schema": "../../node_modules/nx/schemas/project-schema.json", + "sourceRoot": "libs/beneficiary/src", + "projectType": "library", + "targets": { + "lint": { + "executor": "@nx/eslint:lint", + "outputs": ["{options.outputFile}"] + }, + "test": { + "executor": "@nx/jest:jest", + "outputs": ["{workspaceRoot}/coverage/{projectRoot}"], + "options": { + "jestConfig": "libs/beneficiary/jest.config.ts" + } + } + }, + "tags": [] +} diff --git a/libs/beneficiary/src/index.ts b/libs/beneficiary/src/index.ts new file mode 100644 index 0000000..5f4876d --- /dev/null +++ b/libs/beneficiary/src/index.ts @@ -0,0 +1 @@ +export * from './lib/beneficiary.module'; diff --git a/libs/beneficiary/src/lib/beneficiary.module.ts b/libs/beneficiary/src/lib/beneficiary.module.ts new file mode 100644 index 0000000..cf26d45 --- /dev/null +++ b/libs/beneficiary/src/lib/beneficiary.module.ts @@ -0,0 +1,10 @@ +import { Module } from '@nestjs/common'; +import { PrismaModule, PrismaService } from '@rumsan/prisma'; + +@Module({ + controllers: [], + providers: [PrismaService], + exports: [], + imports: [PrismaModule], +}) +export class BeneficiaryModule {} diff --git a/libs/beneficiary/tsconfig.json b/libs/beneficiary/tsconfig.json new file mode 100644 index 0000000..f5b8565 --- /dev/null +++ b/libs/beneficiary/tsconfig.json @@ -0,0 +1,22 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "module": "commonjs", + "forceConsistentCasingInFileNames": true, + "strict": true, + "noImplicitOverride": true, + "noPropertyAccessFromIndexSignature": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true + }, + "files": [], + "include": [], + "references": [ + { + "path": "./tsconfig.lib.json" + }, + { + "path": "./tsconfig.spec.json" + } + ] +} diff --git a/libs/beneficiary/tsconfig.lib.json b/libs/beneficiary/tsconfig.lib.json new file mode 100644 index 0000000..c297a24 --- /dev/null +++ b/libs/beneficiary/tsconfig.lib.json @@ -0,0 +1,16 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "declaration": true, + "types": ["node"], + "target": "es2021", + "strictNullChecks": true, + "noImplicitAny": true, + "strictBindCallApply": true, + "forceConsistentCasingInFileNames": true, + "noFallthroughCasesInSwitch": true + }, + "include": ["src/**/*.ts"], + "exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"] +} diff --git a/libs/beneficiary/tsconfig.spec.json b/libs/beneficiary/tsconfig.spec.json new file mode 100644 index 0000000..9b2a121 --- /dev/null +++ b/libs/beneficiary/tsconfig.spec.json @@ -0,0 +1,14 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "module": "commonjs", + "types": ["jest", "node"] + }, + "include": [ + "jest.config.ts", + "src/**/*.test.ts", + "src/**/*.spec.ts", + "src/**/*.d.ts" + ] +} diff --git a/libs/queue/.eslintrc.json b/libs/queue/.eslintrc.json new file mode 100644 index 0000000..9d9c0db --- /dev/null +++ b/libs/queue/.eslintrc.json @@ -0,0 +1,18 @@ +{ + "extends": ["../../.eslintrc.json"], + "ignorePatterns": ["!**/*"], + "overrides": [ + { + "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], + "rules": {} + }, + { + "files": ["*.ts", "*.tsx"], + "rules": {} + }, + { + "files": ["*.js", "*.jsx"], + "rules": {} + } + ] +} diff --git a/libs/queue/README.md b/libs/queue/README.md new file mode 100644 index 0000000..d766f4a --- /dev/null +++ b/libs/queue/README.md @@ -0,0 +1,64 @@ +## Queue Library Documentation + +The Queue library is a module that provides a way to handle message queues in your application. It uses the BullMQ library as the default transport layer for sending and receiving messages, but you can also implement your own transport layer. + +Setup +First, import the QueueModule in your application module: + +```ts +import { QueueModule } from 'libs/queue/src/lib/queue.module'; +``` + +# Configuration + +The QueueModule accepts a configuration object of type IQueueModuleOptions from queue-config.interfaces.ts. This configuration object includes the queue configuration and transport layer. + +Here is an example of how to use the forRoot method to configure the QueueModule: + +```ts +@Module({ + imports: [ + QueueModule.forRoot({ + config: { + queueName: 'myQueue', + // other BullMQ options... + }, + transport: new BullMQTransport(/* transport options... */), + }), + ], +}) +export class AppModule {} +``` + +In this example, myQueue is the name of the queue, and BullMQTransport is the transport layer. You can replace BullMQTransport with your own transport layer if you want. + +# Queue Library + +This library provides a way to handle message queues in your application. It uses the BullMQ library as the default transport layer for sending and receiving messages, but you can also implement your own transport layer. + +## Queue Service + +The QueueService provides methods to interact with the queue. You can inject it into your services or controllers: + +Here are the methods provided by the QueueService: + +- `connect()`: Connects to the queue. +- `disconnect()`: Disconnects from the queue. +- `sendMessage(queue: string, data: any)`: Sends a message to the specified queue. +- `receiveMessage(queue: string, callback: (data: any) => void)`: Receives a message from the specified queue and processes it with the provided callback function. + +## Queue Plugins + +You can create custom plugins to modify the behavior of the queue. A plugin must implement the QueuePlugin interface from queue-plugin.interface.ts. The DefaultQueuePluginService from default-queue-plugin.service.ts is an example of a queue plugin. + +## Transports + +The transport layer is responsible for the actual sending and receiving of messages. The default transport is BullMQTransport from bull.transport.ts, but you can create your own by implementing the TransportInterface from transport.interface.ts. + +## Testing + +To run tests for the queue library, use the test script in the project.json file: + +```sh +npm run test +``` diff --git a/libs/queue/jest.config.ts b/libs/queue/jest.config.ts new file mode 100644 index 0000000..240adf0 --- /dev/null +++ b/libs/queue/jest.config.ts @@ -0,0 +1,11 @@ +/* eslint-disable */ +export default { + displayName: 'queue', + preset: '../../jest.preset.js', + testEnvironment: 'node', + transform: { + '^.+\\.[tj]s$': ['ts-jest', { tsconfig: '/tsconfig.spec.json' }], + }, + moduleFileExtensions: ['ts', 'js', 'html'], + coverageDirectory: '../../coverage/libs/queue', +}; diff --git a/libs/queue/project.json b/libs/queue/project.json new file mode 100644 index 0000000..5c76923 --- /dev/null +++ b/libs/queue/project.json @@ -0,0 +1,38 @@ +{ + "name": "queue", + "$schema": "../../node_modules/nx/schemas/project-schema.json", + "sourceRoot": "libs/queue/src", + "projectType": "library", + "targets": { + "build": { + "executor": "@nx/js:tsc", + "outputs": ["{options.outputPath}"], + "options": { + "outputPath": "dist/libs/queue", + "tsConfig": "libs/queue/tsconfig.lib.json", + "packageJson": "libs/queue/package.json", + "main": "libs/queue/src/index.ts", + "assets": ["libs/queue/*.md"] + } + }, + "publish": { + "command": "node tools/scripts/publish.mjs queue {args.ver} {args.tag}", + "dependsOn": ["build"] + }, + "lint": { + "executor": "@nx/eslint:lint", + "outputs": ["{options.outputFile}"], + "options": { + "lintFilePatterns": ["libs/queue/**/*.ts", "libs/queue/package.json"] + } + }, + "test": { + "executor": "@nx/jest:jest", + "outputs": ["{workspaceRoot}/coverage/{projectRoot}"], + "options": { + "jestConfig": "libs/queue/jest.config.ts" + } + } + }, + "tags": [] +} diff --git a/libs/queue/src/index.ts b/libs/queue/src/index.ts new file mode 100644 index 0000000..2e4cc44 --- /dev/null +++ b/libs/queue/src/index.ts @@ -0,0 +1,3 @@ +export * from './lib/queue.module'; +export * from './lib/queue.service'; +export * from './lib/transports/bull'; diff --git a/libs/queue/src/lib/interface/queue-config.interfaces.ts b/libs/queue/src/lib/interface/queue-config.interfaces.ts new file mode 100644 index 0000000..d7a91f3 --- /dev/null +++ b/libs/queue/src/lib/interface/queue-config.interfaces.ts @@ -0,0 +1,25 @@ +import { + DynamicModule, + ForwardReference, + InjectionToken, + OptionalFactoryDependency, + Provider, + Type, +} from '@nestjs/common'; + +// export interface IQueueConfig { +// config: U; +// } + +export interface IQueueModuleOptions { + imports?: Array< + Type | DynamicModule | Promise | ForwardReference + >; + global: boolean; + providers?: Provider[]; + exports?: Provider[]; + transport?: V; + useFactory?: (...args: any[]) => U | Promise; + inject?: Array; + config?: 'useFactory' extends keyof this ? U | undefined : U; // <-- make config optional when useFactory is defined +} diff --git a/libs/queue/src/lib/interface/transport.interface.ts b/libs/queue/src/lib/interface/transport.interface.ts new file mode 100644 index 0000000..a5a642e --- /dev/null +++ b/libs/queue/src/lib/interface/transport.interface.ts @@ -0,0 +1,8 @@ +// transport.interface.ts + +export interface TransportInterface { + connect(): Promise; + sendMessage(queue: string, data: any): Promise; + receiveMessage(queue: string, callback: (data: any) => void): Promise; + disconnect(): Promise; +} diff --git a/libs/queue/src/lib/queue.module.ts b/libs/queue/src/lib/queue.module.ts new file mode 100644 index 0000000..727f670 --- /dev/null +++ b/libs/queue/src/lib/queue.module.ts @@ -0,0 +1,50 @@ +// queue.module.ts + +import { DynamicModule, Global, Module } from '@nestjs/common'; +import { QueueService } from './queue.service'; +import { BullMqService } from './transports/bull'; + +@Global() +@Module({}) +export class QueueModule { + private static transport: any = BullMqService; + + static forRoot(options: any): DynamicModule { + return { + module: QueueModule, + providers: [ + { + provide: 'QUEUE_CONFIG', + useFactory: async (...args: any[]) => { + const config = options.useFactory + ? await options?.useFactory(...args) + : options.config; + return config; + }, + inject: options.inject, + }, + ], + exports: ['QUEUE_CONFIG'], + }; + } + + static registerQueue(options: Record): DynamicModule { + return { + module: QueueModule, + providers: [ + { + provide: 'TRANSPORT', + useFactory: (config) => { + return new QueueModule.transport({ + ...options, + ...config, + }); + }, + inject: ['QUEUE_CONFIG'], + }, + QueueService, + ], + exports: ['TRANSPORT', QueueService], + }; + } +} diff --git a/libs/queue/src/lib/queue.service.ts b/libs/queue/src/lib/queue.service.ts new file mode 100644 index 0000000..0ec19a1 --- /dev/null +++ b/libs/queue/src/lib/queue.service.ts @@ -0,0 +1,37 @@ +// queue.service.ts + +import { Inject, Injectable, OnModuleInit } from '@nestjs/common'; + +@Injectable() +export class QueueService implements OnModuleInit { + constructor( + @Inject('TRANSPORT') + private readonly transport: any, + ) { + console.log('transport', this.transport); + } + + onModuleInit() { + console.log('transport', this.transport); + this.connect(); + } + + async connect() { + if (!this.transport) { + throw new Error('Transport is not defined'); + } + await this.transport.connect(); + } + + async sendMessage(queue: string, data: any) { + await this.transport.sendMessage(queue, data); + } + + async receiveMessage(queue: string, callback: (data: any) => void) { + return this.transport.receiveMessage(queue, callback); + } + + async disconnect() { + await this.transport.disconnect(); + } +} diff --git a/libs/queue/src/lib/transports/bull/bull.module.ts b/libs/queue/src/lib/transports/bull/bull.module.ts new file mode 100644 index 0000000..ed5fed5 --- /dev/null +++ b/libs/queue/src/lib/transports/bull/bull.module.ts @@ -0,0 +1,16 @@ +import { BullModuleOptions, BullModule as RootBullModule } from '@nestjs/bull'; +import { DynamicModule, Module } from '@nestjs/common'; + +@Module({ + imports: [], + controllers: [], + providers: [], +}) +export class BullModule extends RootBullModule { + static register(options: BullModuleOptions): DynamicModule { + return { + module: BullModule, + imports: [BullModule.forRoot(options)], + }; + } +} diff --git a/libs/queue/src/lib/transports/bull/bull.transport.ts b/libs/queue/src/lib/transports/bull/bull.transport.ts new file mode 100644 index 0000000..0a5e03e --- /dev/null +++ b/libs/queue/src/lib/transports/bull/bull.transport.ts @@ -0,0 +1,72 @@ +import { Injectable } from '@nestjs/common'; +import { Queue, Worker } from 'bullmq'; +import { TransportInterface } from '../../interface/transport.interface'; + +@Injectable() +export class BullMqService implements TransportInterface { + private name: string; + private queues: Record = {}; + private workers: Record = {}; + + constructor(private readonly config: any) { + console.log('config', config); + if (this.config.name) { + this.name = this.config.name; + } + } + + async connect(): Promise { + // Connect or perform any necessary setup + const queue = new Queue(this.name, { + connection: this.config.connection, + }); + this.queues[this.name] = queue; + + const worker = new Worker( + this.name, + async (job) => { + console.log('job', job); + }, + { + connection: { + host: 'localhost', + port: 6379, + password: 'raghav123', + }, + }, + ); + this.workers[this.name] = worker; + } + + async sendMessage(name: string, data: any): Promise { + if (!this.queues[name]) { + throw new Error(`Queue "${name}" not found.`); + } + + await this.queues[name].add(name, data); + } + + async receiveMessage( + name: string, + callback: (data: any) => void, + ): Promise { + if (!this.queues[name]) { + throw new Error(`Queue "${name}" not found.`); + } + + if (!this.workers[name]) { + this.workers[name] = new Worker(name, async (job) => { + callback(job.data); + }); + } + } + + async disconnect(): Promise { + // Disconnect or perform any necessary cleanup + await Promise.all( + Object.keys(this.queues).map(async (name) => { + await this.queues[name].close(); + }), + ); + } +} diff --git a/libs/queue/src/lib/transports/bull/index.ts b/libs/queue/src/lib/transports/bull/index.ts new file mode 100644 index 0000000..1207b54 --- /dev/null +++ b/libs/queue/src/lib/transports/bull/index.ts @@ -0,0 +1,2 @@ +export * from './bull.module'; +export * from './bull.transport'; diff --git a/libs/queue/tsconfig.json b/libs/queue/tsconfig.json new file mode 100644 index 0000000..f5b8565 --- /dev/null +++ b/libs/queue/tsconfig.json @@ -0,0 +1,22 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "module": "commonjs", + "forceConsistentCasingInFileNames": true, + "strict": true, + "noImplicitOverride": true, + "noPropertyAccessFromIndexSignature": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true + }, + "files": [], + "include": [], + "references": [ + { + "path": "./tsconfig.lib.json" + }, + { + "path": "./tsconfig.spec.json" + } + ] +} diff --git a/libs/queue/tsconfig.lib.json b/libs/queue/tsconfig.lib.json new file mode 100644 index 0000000..c297a24 --- /dev/null +++ b/libs/queue/tsconfig.lib.json @@ -0,0 +1,16 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "declaration": true, + "types": ["node"], + "target": "es2021", + "strictNullChecks": true, + "noImplicitAny": true, + "strictBindCallApply": true, + "forceConsistentCasingInFileNames": true, + "noFallthroughCasesInSwitch": true + }, + "include": ["src/**/*.ts"], + "exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"] +} diff --git a/libs/queue/tsconfig.spec.json b/libs/queue/tsconfig.spec.json new file mode 100644 index 0000000..9b2a121 --- /dev/null +++ b/libs/queue/tsconfig.spec.json @@ -0,0 +1,14 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "module": "commonjs", + "types": ["jest", "node"] + }, + "include": [ + "jest.config.ts", + "src/**/*.test.ts", + "src/**/*.spec.ts", + "src/**/*.d.ts" + ] +} diff --git a/libs/user/src/index.ts b/libs/user/src/index.ts index 0fea85f..bc8c668 100644 --- a/libs/user/src/index.ts +++ b/libs/user/src/index.ts @@ -1,6 +1,7 @@ export * from './lib/ability/ability.decorator'; export * from './lib/ability/ability.guard'; export * from './lib/auth/auth.module'; +export * from './lib/auth/auth.service'; export * from './lib/auth/guard'; export * as RUMSAN_USER_CONSTANTS from './lib/constants'; export * from './lib/rumsan-user.module'; diff --git a/package-lock.json b/package-lock.json index cac6ec2..4e7858c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,17 +9,21 @@ "version": "0.0.0", "license": "MIT", "dependencies": { + "@nestjs/bull": "^10.0.1", "@nestjs/common": "^10.0.2", "@nestjs/config": "^3.1.1", "@nestjs/core": "^10.0.2", "@nestjs/event-emitter": "^2.0.3", "@nestjs/jwt": "^10.2.0", + "@nestjs/mapped-types": "*", "@nestjs/passport": "^10.0.3", "@nestjs/platform-express": "^10.0.2", "@nestjs/swagger": "^7.1.17", "@nodeteam/nestjs-prisma-pagination": "^1.0.6", "@prisma/client": "^5.7.1", "axios": "^1.0.0", + "bull": "^4.12.1", + "bullmq": "^5.1.3", "class-transformer": "^0.5.1", "class-validator": "^0.14.0", "ethers": "^6.9.1", @@ -2405,6 +2409,11 @@ "integrity": "sha512-dvuCeX5fC9dXgJn9t+X5atfmgQAzUOWqS1254Gh0m6i8wKd10ebXkfNKiRK+1GWi/yTvvLDHpoxLr0xxxeslWw==", "dev": true }, + "node_modules/@ioredis/commands": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@ioredis/commands/-/commands-1.2.0.tgz", + "integrity": "sha512-Sx1pU8EM64o2BrqNpEO1CNLtKQwyhuXuqyfH7oGKCk+1a33d2r5saW8zNwm3j6BTExtjrv2BxTgzzkMwts6vGg==" + }, "node_modules/@istanbuljs/load-nyc-config": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz", @@ -2779,6 +2788,114 @@ "node": ">=8" } }, + "node_modules/@msgpackr-extract/msgpackr-extract-darwin-arm64": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@msgpackr-extract/msgpackr-extract-darwin-arm64/-/msgpackr-extract-darwin-arm64-3.0.2.tgz", + "integrity": "sha512-9bfjwDxIDWmmOKusUcqdS4Rw+SETlp9Dy39Xui9BEGEk19dDwH0jhipwFzEff/pFg95NKymc6TOTbRKcWeRqyQ==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@msgpackr-extract/msgpackr-extract-darwin-x64": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@msgpackr-extract/msgpackr-extract-darwin-x64/-/msgpackr-extract-darwin-x64-3.0.2.tgz", + "integrity": "sha512-lwriRAHm1Yg4iDf23Oxm9n/t5Zpw1lVnxYU3HnJPTi2lJRkKTrps1KVgvL6m7WvmhYVt/FIsssWay+k45QHeuw==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@msgpackr-extract/msgpackr-extract-linux-arm": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@msgpackr-extract/msgpackr-extract-linux-arm/-/msgpackr-extract-linux-arm-3.0.2.tgz", + "integrity": "sha512-MOI9Dlfrpi2Cuc7i5dXdxPbFIgbDBGgKR5F2yWEa6FVEtSWncfVNKW5AKjImAQ6CZlBK9tympdsZJ2xThBiWWA==", + "cpu": [ + "arm" + ], + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@msgpackr-extract/msgpackr-extract-linux-arm64": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@msgpackr-extract/msgpackr-extract-linux-arm64/-/msgpackr-extract-linux-arm64-3.0.2.tgz", + "integrity": "sha512-FU20Bo66/f7He9Fp9sP2zaJ1Q8L9uLPZQDub/WlUip78JlPeMbVL8546HbZfcW9LNciEXc8d+tThSJjSC+tmsg==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@msgpackr-extract/msgpackr-extract-linux-x64": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@msgpackr-extract/msgpackr-extract-linux-x64/-/msgpackr-extract-linux-x64-3.0.2.tgz", + "integrity": "sha512-gsWNDCklNy7Ajk0vBBf9jEx04RUxuDQfBse918Ww+Qb9HCPoGzS+XJTLe96iN3BVK7grnLiYghP/M4L8VsaHeA==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@msgpackr-extract/msgpackr-extract-win32-x64": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@msgpackr-extract/msgpackr-extract-win32-x64/-/msgpackr-extract-win32-x64-3.0.2.tgz", + "integrity": "sha512-O+6Gs8UeDbyFpbSh2CPEz/UOrrdWPTBYNblZK5CxxLisYt4kGX3Sc+czffFonyjiGSq3jWLwJS/CCJc7tBr4sQ==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@nestjs/bull": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/@nestjs/bull/-/bull-10.0.1.tgz", + "integrity": "sha512-1GcJ8BkHDgQdBMZ7SqAqgUHiFnISXmpGvewFeTc8wf87JLk2PweiKv9j9/KQKU+NI237pCe82XB0bXzTnsdxSw==", + "dependencies": { + "@nestjs/bull-shared": "^10.0.1", + "tslib": "2.6.0" + }, + "peerDependencies": { + "@nestjs/common": "^8.0.0 || ^9.0.0 || ^10.0.0", + "@nestjs/core": "^8.0.0 || ^9.0.0 || ^10.0.0", + "bull": "^3.3 || ^4.0.0" + } + }, + "node_modules/@nestjs/bull-shared": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/@nestjs/bull-shared/-/bull-shared-10.0.1.tgz", + "integrity": "sha512-8Td36l2i5x9+iQWjPB5Bd5+6u5Eangb5DclNcwrdwKqvd28xE92MSW97P4JV52C2kxrTjZwx8ck/wObAwtpQPw==", + "dependencies": { + "tslib": "2.6.0" + }, + "peerDependencies": { + "@nestjs/common": "^8.0.0 || ^9.0.0 || ^10.0.0", + "@nestjs/core": "^8.0.0 || ^9.0.0 || ^10.0.0" + } + }, + "node_modules/@nestjs/bull-shared/node_modules/tslib": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.0.tgz", + "integrity": "sha512-7At1WUettjcSRHXCyYtTselblcHl9PJFFVKiCAy/bY97+BPZXSQ2wbq0P9s8tK2G7dFQfNnlJnPAiArVBVBsfA==" + }, + "node_modules/@nestjs/bull/node_modules/tslib": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.0.tgz", + "integrity": "sha512-7At1WUettjcSRHXCyYtTselblcHl9PJFFVKiCAy/bY97+BPZXSQ2wbq0P9s8tK2G7dFQfNnlJnPAiArVBVBsfA==" + }, "node_modules/@nestjs/common": { "version": "10.3.0", "resolved": "https://registry.npmjs.org/@nestjs/common/-/common-10.3.0.tgz", @@ -6984,6 +7101,114 @@ "semver": "^7.0.0" } }, + "node_modules/bull": { + "version": "4.12.1", + "resolved": "https://registry.npmjs.org/bull/-/bull-4.12.1.tgz", + "integrity": "sha512-ft4hTmex7WGSHt56mydw9uRKskkvgiNwqTYiV9b6q3ubhplglQmjo9OZrHlcUVNwBqSBhnzlsJQ9N/Wd7nhENA==", + "dependencies": { + "cron-parser": "^4.2.1", + "get-port": "^5.1.1", + "ioredis": "^5.3.2", + "lodash": "^4.17.21", + "msgpackr": "^1.5.2", + "semver": "^7.5.2", + "uuid": "^8.3.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/bull/node_modules/uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "bin": { + "uuid": "dist/bin/uuid" + } + }, + "node_modules/bullmq": { + "version": "5.1.3", + "resolved": "https://registry.npmjs.org/bullmq/-/bullmq-5.1.3.tgz", + "integrity": "sha512-safpGwiwKHsNPW01Wk8FPxdWbPS2mA0HZKqIhdQB10J4wWRSDWPeQE2p+YYnAmqEsk0FwJdZnzVcwCfn7w5cVA==", + "dependencies": { + "cron-parser": "^4.6.0", + "glob": "^8.0.3", + "ioredis": "^5.3.2", + "lodash": "^4.17.21", + "msgpackr": "^1.10.1", + "node-abort-controller": "^3.1.1", + "semver": "^7.5.4", + "tslib": "^2.0.0", + "uuid": "^9.0.0" + } + }, + "node_modules/bullmq/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/bullmq/node_modules/glob": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz", + "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^5.0.1", + "once": "^1.3.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/bullmq/node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/bullmq/node_modules/minimatch": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", + "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/bullmq/node_modules/semver": { + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/bullmq/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" + }, "node_modules/busboy": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/busboy/-/busboy-1.6.0.tgz", @@ -7220,6 +7445,14 @@ "node": ">=0.8" } }, + "node_modules/cluster-key-slot": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/cluster-key-slot/-/cluster-key-slot-1.1.2.tgz", + "integrity": "sha512-RMr0FhtfXemyinomL4hrWcYJxmX6deFdCxpJzhDttxgO1+bcCnkk+9drydLVDmAMG7NE6aN/fl4F7ucU/90gAA==", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/co": { "version": "4.6.0", "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", @@ -7732,6 +7965,17 @@ "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", "devOptional": true }, + "node_modules/cron-parser": { + "version": "4.9.0", + "resolved": "https://registry.npmjs.org/cron-parser/-/cron-parser-4.9.0.tgz", + "integrity": "sha512-p0SaNjrHOnQeR8/VnfGbmg9te2kfyYSQ7Sc/j/6DtPL3JQvKxmjO9TSjNFpujqV3vEYYBvNNvXSxzyksBWAx1Q==", + "dependencies": { + "luxon": "^3.2.1" + }, + "engines": { + "node": ">=12.0.0" + } + }, "node_modules/cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", @@ -8156,6 +8400,14 @@ "node": ">=0.4.0" } }, + "node_modules/denque": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/denque/-/denque-2.1.0.tgz", + "integrity": "sha512-HVQE3AAb/pxF8fQAoiqpvg9i3evqug3hoiwakOyZAwJm+6vZehbkYXZ0l4JxS+I3QxM97v5aaRNhj8v5oBhekw==", + "engines": { + "node": ">=0.10" + } + }, "node_modules/depd": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", @@ -9522,6 +9774,17 @@ "node": ">=8.0.0" } }, + "node_modules/get-port": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/get-port/-/get-port-5.1.1.tgz", + "integrity": "sha512-g/Q1aTSDOxFpchXC4i8ZWvxA1lnPqx/JHqcpIw0/LX9T8x/GBbi6YnlN5nhaKIFkT8oFsscUKgDJYxfwfS6QsQ==", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/get-stream": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", @@ -10108,6 +10371,29 @@ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, + "node_modules/ioredis": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/ioredis/-/ioredis-5.3.2.tgz", + "integrity": "sha512-1DKMMzlIHM02eBBVOFQ1+AolGjs6+xEcM4PDL7NqOS6szq7H9jSaEkIUH6/a5Hl241LzW6JLSiAbNvTQjUupUA==", + "dependencies": { + "@ioredis/commands": "^1.1.1", + "cluster-key-slot": "^1.1.0", + "debug": "^4.3.4", + "denque": "^2.1.0", + "lodash.defaults": "^4.2.0", + "lodash.isarguments": "^3.1.0", + "redis-errors": "^1.2.0", + "redis-parser": "^3.0.0", + "standard-as-callback": "^2.1.0" + }, + "engines": { + "node": ">=12.22.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/ioredis" + } + }, "node_modules/ipaddr.js": { "version": "1.9.1", "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", @@ -11477,11 +11763,21 @@ "integrity": "sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow==", "dev": true }, + "node_modules/lodash.defaults": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/lodash.defaults/-/lodash.defaults-4.2.0.tgz", + "integrity": "sha512-qjxPLHd3r5DnsdGacqOMU6pb/avJzdh9tFX2ymgoZE27BmjXrNy/y4LoaiTeAb+O3gL8AfpJGtqfX/ae2leYYQ==" + }, "node_modules/lodash.includes": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz", "integrity": "sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w==" }, + "node_modules/lodash.isarguments": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz", + "integrity": "sha512-chi4NHZlZqZD18a0imDHnZPrDeBbTtVN7GXMwuGdRH9qotxAjYs3aVLKc7zNOG9eddR5Ksd8rvFEBc9SsggPpg==" + }, "node_modules/lodash.isboolean": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz", @@ -11587,6 +11883,14 @@ "yallist": "^3.0.2" } }, + "node_modules/luxon": { + "version": "3.4.4", + "resolved": "https://registry.npmjs.org/luxon/-/luxon-3.4.4.tgz", + "integrity": "sha512-zobTr7akeGHnv7eBOXcRgMeCP6+uyYsczwmeRCauvpvaAltgNyTbLH/+VaEAPUeWBT+1GuNmz4wC/6jtQzbbVA==", + "engines": { + "node": ">=12" + } + }, "node_modules/magic-string": { "version": "0.30.1", "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.1.tgz", @@ -11842,6 +12146,35 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" }, + "node_modules/msgpackr": { + "version": "1.10.1", + "resolved": "https://registry.npmjs.org/msgpackr/-/msgpackr-1.10.1.tgz", + "integrity": "sha512-r5VRLv9qouXuLiIBrLpl2d5ZvPt8svdQTl5/vMvE4nzDMyEX4sgW5yWhuBBj5UmgwOTWj8CIdSXn5sAfsHAWIQ==", + "optionalDependencies": { + "msgpackr-extract": "^3.0.2" + } + }, + "node_modules/msgpackr-extract": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/msgpackr-extract/-/msgpackr-extract-3.0.2.tgz", + "integrity": "sha512-SdzXp4kD/Qf8agZ9+iTu6eql0m3kWm1A2y1hkpTeVNENutaB0BwHlSvAIaMxwntmRUAUjon2V4L8Z/njd0Ct8A==", + "hasInstallScript": true, + "optional": true, + "dependencies": { + "node-gyp-build-optional-packages": "5.0.7" + }, + "bin": { + "download-msgpackr-prebuilds": "bin/download-prebuilds.js" + }, + "optionalDependencies": { + "@msgpackr-extract/msgpackr-extract-darwin-arm64": "3.0.2", + "@msgpackr-extract/msgpackr-extract-darwin-x64": "3.0.2", + "@msgpackr-extract/msgpackr-extract-linux-arm": "3.0.2", + "@msgpackr-extract/msgpackr-extract-linux-arm64": "3.0.2", + "@msgpackr-extract/msgpackr-extract-linux-x64": "3.0.2", + "@msgpackr-extract/msgpackr-extract-win32-x64": "3.0.2" + } + }, "node_modules/multer": { "version": "1.4.4-lts.1", "resolved": "https://registry.npmjs.org/multer/-/multer-1.4.4-lts.1.tgz", @@ -12009,8 +12342,7 @@ "node_modules/node-abort-controller": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/node-abort-controller/-/node-abort-controller-3.1.1.tgz", - "integrity": "sha512-AGK2yQKIjRuqnc6VkX2Xj5d+QW8xZ87pa1UK6yA6ouUyuxfHuMP6umE5QK7UmTeOAymo+Zx1Fxiuw9rVx8taHQ==", - "dev": true + "integrity": "sha512-AGK2yQKIjRuqnc6VkX2Xj5d+QW8xZ87pa1UK6yA6ouUyuxfHuMP6umE5QK7UmTeOAymo+Zx1Fxiuw9rVx8taHQ==" }, "node_modules/node-fetch": { "version": "2.7.0", @@ -12040,6 +12372,17 @@ "node": ">= 6.13.0" } }, + "node_modules/node-gyp-build-optional-packages": { + "version": "5.0.7", + "resolved": "https://registry.npmjs.org/node-gyp-build-optional-packages/-/node-gyp-build-optional-packages-5.0.7.tgz", + "integrity": "sha512-YlCCc6Wffkx0kHkmam79GKvDQ6x+QZkMjFGrIMxgFNILFvGSbCp2fCBC55pGTT9gVaz8Na5CLmxt/urtzRv36w==", + "optional": true, + "bin": { + "node-gyp-build-optional-packages": "bin.js", + "node-gyp-build-optional-packages-optional": "optional.js", + "node-gyp-build-optional-packages-test": "build-test.js" + } + }, "node_modules/node-int64": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", @@ -13781,6 +14124,25 @@ "node": ">= 12.13.0" } }, + "node_modules/redis-errors": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/redis-errors/-/redis-errors-1.2.0.tgz", + "integrity": "sha512-1qny3OExCf0UvUV/5wpYKf2YwPcOqXzkwKKSmKHiE6ZMQs5heeE/c8eXK+PNllPvmjgAbfnsbpkGZWy8cBpn9w==", + "engines": { + "node": ">=4" + } + }, + "node_modules/redis-parser": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/redis-parser/-/redis-parser-3.0.0.tgz", + "integrity": "sha512-DJnGAeenTdpMEH6uAJRK/uiyEIH9WVsUmoLwzudwGJUwZPp80PDBWPHXSAGNPwNvIXAbe7MSUB1zQFugFml66A==", + "dependencies": { + "redis-errors": "^1.0.0" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/reflect-metadata": { "version": "0.1.14", "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.1.14.tgz", @@ -14596,6 +14958,11 @@ "integrity": "sha512-oeVtt7eWQS+Na6F//S4kJ2K2VbRlS9D43mAlMyVpVWovy9o+jfgH8O9agzANzaiLjclA0oYzUXEM4PurhSUChw==", "dev": true }, + "node_modules/standard-as-callback": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/standard-as-callback/-/standard-as-callback-2.1.0.tgz", + "integrity": "sha512-qoRRSyROncaz1z0mvYqIE4lCd9p2R90i6GxW3uZv5ucSu8tU7B5HXUP1gG8pVZsYNVaXjk8ClXHPttLyxAL48A==" + }, "node_modules/statuses": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", diff --git a/package.json b/package.json index 7da1015..dacdda4 100644 --- a/package.json +++ b/package.json @@ -7,17 +7,21 @@ }, "private": true, "dependencies": { + "@nestjs/bull": "^10.0.1", "@nestjs/common": "^10.0.2", "@nestjs/config": "^3.1.1", "@nestjs/core": "^10.0.2", "@nestjs/event-emitter": "^2.0.3", "@nestjs/jwt": "^10.2.0", + "@nestjs/mapped-types": "*", "@nestjs/passport": "^10.0.3", "@nestjs/platform-express": "^10.0.2", "@nestjs/swagger": "^7.1.17", "@nodeteam/nestjs-prisma-pagination": "^1.0.6", "@prisma/client": "^5.7.1", "axios": "^1.0.0", + "bull": "^4.12.1", + "bullmq": "^5.1.3", "class-transformer": "^0.5.1", "class-validator": "^0.14.0", "ethers": "^6.9.1", diff --git a/tsconfig.base.json b/tsconfig.base.json index 93218ba..01a0550 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -16,8 +16,10 @@ "strictPropertyInitialization": false, "baseUrl": ".", "paths": { + "@rumsan/beneficiary": ["libs/beneficiary/src/index.ts"], "@rumsan/core": ["libs/core/src/index.ts"], "@rumsan/prisma": ["libs/prisma/src/index.ts"], + "@rumsan/queue": ["libs/queue/src/index.ts"], "@rumsan/settings": ["libs/settings/src/index.ts"], "@rumsan/user": ["libs/user/src/index.ts"] }