From 2e913903bfb0d110e851b4d374e90e5219f2f3b9 Mon Sep 17 00:00:00 2001 From: Rubin Bhandari Date: Wed, 18 Oct 2023 19:00:53 +0545 Subject: [PATCH] fix: barrel files --- .vscode/settings.json | 1 + package.json | 50 +++++------ pnpm-lock.yaml | 84 +++++++++---------- src/common/database/index.ts | 2 +- src/common/database/mikro-orm-cli.config.ts | 2 +- .../database/{config.ts => orm.config.ts} | 0 src/lib/index.ts | 4 + src/lib/orm.module.ts | 2 +- src/modules/category/category.module.ts | 15 ---- src/modules/shared/shared.module.ts | 12 +-- 10 files changed, 81 insertions(+), 91 deletions(-) rename src/common/database/{config.ts => orm.config.ts} (100%) diff --git a/.vscode/settings.json b/.vscode/settings.json index fe893c6f..6e9282fa 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -42,6 +42,7 @@ "rubiin", "sonarjs", "SSSZ", + "travelerdev", "UNAUTHORISED" ] } diff --git a/package.json b/package.json index 2bafe7df..2594840e 100644 --- a/package.json +++ b/package.json @@ -54,8 +54,8 @@ "test:e2e": "jest --config ./test/jest-e2e.json --runInBand --forceExit" }, "dependencies": { - "@aws-sdk/client-s3": "^3.428.0", - "@aws-sdk/client-ses": "^3.428.0", + "@aws-sdk/client-s3": "^3.430.0", + "@aws-sdk/client-ses": "^3.430.0", "@casl/ability": "^6.5.0", "@golevelup/nestjs-rabbitmq": "^4.0.0", "@golevelup/nestjs-stripe": "^0.6.3", @@ -83,8 +83,8 @@ "@nestjs/throttler": "^5.0.0", "@nestjs/websockets": "^10.2.7", "@paralleldrive/cuid2": "^2.2.2", - "@sentry/hub": "^7.74.0", - "@sentry/node": "^7.74.0", + "@sentry/hub": "^7.74.1", + "@sentry/node": "^7.74.1", "@socket.io/redis-adapter": "^8.2.1", "@supercharge/request-ip": "^1.2.0", "@travelerdev/nestjs-sentry": "^4.2.1", @@ -100,7 +100,7 @@ "firebase-admin": "^11.11.0", "handlebars": "^4.7.8", "helmet": "^7.0.0", - "helper-fns": "^2.6.30", + "helper-fns": "^2.6.33", "ioredis": "^5.3.2", "isomorphic-dompurify": "^1.9.0", "joi": "^17.11.0", @@ -121,7 +121,7 @@ "passport-magic-login": "^1.2.2", "pino-http": "^8.5.0", "pino-pretty": "^10.2.3", - "poolifier": "^3.0.1", + "poolifier": "^3.0.2", "preview-email": "^3.0.19", "prom-client": "^15.0.0", "pug": "^3.0.2", @@ -132,7 +132,7 @@ "rxjs": "^7.8.1", "sharp": "^0.32.6", "socket.io": "^4.7.2", - "stripe": "^13.10.0", + "stripe": "^14.1.0", "swagger-stats": "^0.99.7", "twilio": "4.18.1", "unprofane": "^1.0.6", @@ -147,29 +147,29 @@ "@nestjs/cli": "10.1.18", "@nestjs/schematics": "10.0.2", "@nestjs/testing": "10.2.7", - "@rubiin/eslint-config": "^1.8.26", + "@rubiin/eslint-config": "^1.8.27", "@rubiin/tsconfig": "^1.1.2", - "@sentry/types": "^7.74.0", + "@sentry/types": "^7.74.1", "@side/jest-runtime": "^1.1.0", "@swc/core": "^1.3.93", "@swc/jest": "^0.2.29", "@total-typescript/ts-reset": "^0.5.1", - "@types/cache-manager": "^4.0.3", - "@types/cache-manager-redis-store": "^2.0.2", - "@types/compression": "^1.7.3", - "@types/jest": "^29.5.5", - "@types/mime-types": "^2.1.2", - "@types/multer": "^1.4.8", - "@types/node": "^20.8.6", - "@types/nodemailer": "^6.4.11", - "@types/passport": "^1.0.13", - "@types/passport-facebook": "^3.0.1", - "@types/passport-google-oauth20": "^2.0.12", - "@types/passport-jwt": "^3.0.10", - "@types/preview-email": "^3.0.2", - "@types/pug": "^2.0.7", - "@types/qrcode": "^1.5.2", - "@types/qs": "6.9.8", + "@types/cache-manager": "^4.0.4", + "@types/cache-manager-redis-store": "^2.0.3", + "@types/compression": "^1.7.4", + "@types/jest": "^29.5.6", + "@types/mime-types": "^2.1.3", + "@types/multer": "^1.4.9", + "@types/node": "^20.8.7", + "@types/nodemailer": "^6.4.12", + "@types/passport": "^1.0.14", + "@types/passport-facebook": "^3.0.2", + "@types/passport-google-oauth20": "^2.0.13", + "@types/passport-jwt": "^3.0.11", + "@types/preview-email": "^3.0.3", + "@types/pug": "^2.0.8", + "@types/qrcode": "^1.5.3", + "@types/qs": "6.9.9", "@types/supertest": "2.0.14", "@types/swagger-stats": "^0.95.9", "@types/swagger-ui-express": "^4.1.4", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index fdfb6d0f..b0b841f5 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -6,10 +6,10 @@ settings: dependencies: '@aws-sdk/client-s3': - specifier: ^3.428.0 + specifier: ^3.430.0 version: 3.430.0 '@aws-sdk/client-ses': - specifier: ^3.428.0 + specifier: ^3.430.0 version: 3.430.0 '@casl/ability': specifier: ^6.5.0 @@ -19,7 +19,7 @@ dependencies: version: 4.0.0(@nestjs/common@10.2.7)(@nestjs/core@10.2.7)(reflect-metadata@0.1.13)(rxjs@7.8.1) '@golevelup/nestjs-stripe': specifier: ^0.6.3 - version: 0.6.3(@nestjs/common@10.2.7)(@nestjs/core@10.2.7)(rxjs@7.8.1)(stripe@13.11.0) + version: 0.6.3(@nestjs/common@10.2.7)(@nestjs/core@10.2.7)(rxjs@7.8.1)(stripe@14.1.0) '@golevelup/nestjs-webhooks': specifier: ^0.2.16 version: 0.2.16(@nestjs/common@10.2.7)(body-parser@1.20.2)(rxjs@7.8.1) @@ -93,10 +93,10 @@ dependencies: specifier: ^2.2.2 version: 2.2.2 '@sentry/hub': - specifier: ^7.74.0 + specifier: ^7.74.1 version: 7.74.1 '@sentry/node': - specifier: ^7.74.0 + specifier: ^7.74.1 version: 7.74.1 '@socket.io/redis-adapter': specifier: ^8.2.1 @@ -144,7 +144,7 @@ dependencies: specifier: ^7.0.0 version: 7.0.0 helper-fns: - specifier: ^2.6.30 + specifier: ^2.6.33 version: 2.6.33 ioredis: specifier: ^5.3.2 @@ -207,7 +207,7 @@ dependencies: specifier: ^10.2.3 version: 10.2.3 poolifier: - specifier: ^3.0.1 + specifier: ^3.0.2 version: 3.0.2 preview-email: specifier: ^3.0.19 @@ -240,8 +240,8 @@ dependencies: specifier: ^4.7.2 version: 4.7.2 stripe: - specifier: ^13.10.0 - version: 13.11.0 + specifier: ^14.1.0 + version: 14.1.0 swagger-stats: specifier: ^0.99.7 version: 0.99.7(prom-client@15.0.0) @@ -281,13 +281,13 @@ devDependencies: specifier: 10.2.7 version: 10.2.7(@nestjs/common@10.2.7)(@nestjs/core@10.2.7)(@nestjs/platform-express@10.2.7) '@rubiin/eslint-config': - specifier: ^1.8.26 + specifier: ^1.8.27 version: 1.8.27(eslint@8.51.0)(typescript@5.2.2)(vitest@0.34.6) '@rubiin/tsconfig': specifier: ^1.1.2 version: 1.1.2 '@sentry/types': - specifier: ^7.74.0 + specifier: ^7.74.1 version: 7.74.1 '@side/jest-runtime': specifier: ^1.1.0 @@ -302,53 +302,53 @@ devDependencies: specifier: ^0.5.1 version: 0.5.1 '@types/cache-manager': - specifier: ^4.0.3 + specifier: ^4.0.4 version: 4.0.4 '@types/cache-manager-redis-store': - specifier: ^2.0.2 + specifier: ^2.0.3 version: 2.0.3 '@types/compression': - specifier: ^1.7.3 + specifier: ^1.7.4 version: 1.7.4 '@types/jest': - specifier: ^29.5.5 + specifier: ^29.5.6 version: 29.5.6 '@types/mime-types': - specifier: ^2.1.2 + specifier: ^2.1.3 version: 2.1.3 '@types/multer': - specifier: ^1.4.8 + specifier: ^1.4.9 version: 1.4.9 '@types/node': - specifier: ^20.8.6 + specifier: ^20.8.7 version: 20.8.7 '@types/nodemailer': - specifier: ^6.4.11 + specifier: ^6.4.12 version: 6.4.12 '@types/passport': - specifier: ^1.0.13 + specifier: ^1.0.14 version: 1.0.14 '@types/passport-facebook': - specifier: ^3.0.1 + specifier: ^3.0.2 version: 3.0.2 '@types/passport-google-oauth20': - specifier: ^2.0.12 + specifier: ^2.0.13 version: 2.0.13 '@types/passport-jwt': - specifier: ^3.0.10 + specifier: ^3.0.11 version: 3.0.11 '@types/preview-email': - specifier: ^3.0.2 + specifier: ^3.0.3 version: 3.0.3 '@types/pug': - specifier: ^2.0.7 - version: 2.0.7 + specifier: ^2.0.8 + version: 2.0.8 '@types/qrcode': - specifier: ^1.5.2 - version: 1.5.2 + specifier: ^1.5.3 + version: 1.5.3 '@types/qs': - specifier: 6.9.8 - version: 6.9.8 + specifier: 6.9.9 + version: 6.9.9 '@types/supertest': specifier: 2.0.14 version: 2.0.14 @@ -1922,7 +1922,7 @@ packages: - supports-color dev: false - /@golevelup/nestjs-stripe@0.6.3(@nestjs/common@10.2.7)(@nestjs/core@10.2.7)(rxjs@7.8.1)(stripe@13.11.0): + /@golevelup/nestjs-stripe@0.6.3(@nestjs/common@10.2.7)(@nestjs/core@10.2.7)(rxjs@7.8.1)(stripe@14.1.0): resolution: {integrity: sha512-1h9VBwZIpw/xN5iuzpA1YtQq2ezOP7dVEUnB4xtGTWX3/3KjUm2DlBawQ5YN8aTK+FJMCHTg839rq4FryEj12w==} peerDependencies: stripe: ^11.12.0 @@ -1930,7 +1930,7 @@ packages: '@golevelup/nestjs-common': 2.0.0(@nestjs/common@10.2.7) '@golevelup/nestjs-discovery': 4.0.0(@nestjs/common@10.2.7)(@nestjs/core@10.2.7) '@golevelup/nestjs-modules': 0.7.0(@nestjs/common@10.2.7)(rxjs@7.8.1) - stripe: 13.11.0 + stripe: 14.1.0 transitivePeerDependencies: - '@nestjs/common' - '@nestjs/core' @@ -4438,7 +4438,7 @@ packages: resolution: {integrity: sha512-hXOtc0tuDHZPFwwhuBJXPbjemWtXnJjbvuuyNH2Y5Z6in+iXc63c4eXYDc7GGGqHy+iwYqAJMdaItqdnbcBKmg==} dependencies: '@types/node': 20.8.7 - '@types/qs': 6.9.8 + '@types/qs': 6.9.9 '@types/range-parser': 1.2.5 '@types/send': 0.17.2 @@ -4447,7 +4447,7 @@ packages: dependencies: '@types/body-parser': 1.19.4 '@types/express-serve-static-core': 4.17.38 - '@types/qs': 6.9.8 + '@types/qs': 6.9.9 '@types/serve-static': 1.15.3 /@types/glob@8.1.0: @@ -4659,18 +4659,18 @@ packages: '@types/nodemailer': 6.4.12 dev: true - /@types/pug@2.0.7: - resolution: {integrity: sha512-I469DU0UXNC1aHepwirWhu9YKg5fkxohZD95Ey/5A7lovC+Siu+MCLffva87lnfThaOrw9Vb1DUN5t55oULAAw==} + /@types/pug@2.0.8: + resolution: {integrity: sha512-QzhsZ1dMGyJbn/D9V80zp4GIA4J4rfAjCCxc3MP+new0E8dyVdSkR735Lx+n3LIaHNFcjHL5+TbziccuT+fdoQ==} dev: true - /@types/qrcode@1.5.2: - resolution: {integrity: sha512-W4KDz75m7rJjFbyCctzCtRzZUj+PrUHV+YjqDp50sSRezTbrtEAIq2iTzC6lISARl3qw+8IlcCyljdcVJE0Wug==} + /@types/qrcode@1.5.3: + resolution: {integrity: sha512-TgVHRrlG9b3CHrVCS7slp57H+KhazcDFJbxz2Q5FXYd7RmA4OVdPKrzXcVnW6B19ywrp3YPmqYcfohGfc9te9g==} dependencies: '@types/node': 20.8.7 dev: true - /@types/qs@6.9.8: - resolution: {integrity: sha512-u95svzDlTysU5xecFNTgfFG5RUWu1A9P0VzgpcIiGZA9iraHOdSzcxMxQ55DyeRaGCSxQi7LxXDI4rzq/MYfdg==} + /@types/qs@6.9.9: + resolution: {integrity: sha512-wYLxw35euwqGvTDx6zfY1vokBFnsK0HNrzc6xNHchxfO2hpuRg74GbkEW7e3sSmPvj0TjCDT1VCa6OtHXnubsg==} /@types/raf@3.4.1: resolution: {integrity: sha512-1jJ3OO8FXHCcuVXCuO1EMC/MjDuT6/cxgsMw/UebkO9afnL99Y5QTpUjk7+flK4G5FzBVJEgDKL5eFtoxJs9MQ==} @@ -12900,8 +12900,8 @@ packages: acorn: 8.10.0 dev: true - /stripe@13.11.0: - resolution: {integrity: sha512-yPxVJxUzP1QHhHeFnYjJl48QwDS1+5befcL7ju7+t+i88D5r0rbsL+GkCCS6zgcU+TiV5bF9eMGcKyJfLf8BZQ==} + /stripe@14.1.0: + resolution: {integrity: sha512-hpI8OT7jbaVTGOm9bqeCbdVGwM/55Hetn+WpPGFSq7FmlnqLPB7CSZy2eNYU6ko+4tdur6ZMrDKS6wh1CCx8bw==} engines: {node: '>=12.*'} dependencies: '@types/node': 20.8.7 diff --git a/src/common/database/index.ts b/src/common/database/index.ts index d8188a5b..0cbf5705 100644 --- a/src/common/database/index.ts +++ b/src/common/database/index.ts @@ -2,4 +2,4 @@ export * from "./base.entity"; export * from "./base.repository"; export * from "./mikro-orm.encrypted"; export * from "./user.subscriber"; -export * from "./config"; +export * from "./orm.config"; diff --git a/src/common/database/mikro-orm-cli.config.ts b/src/common/database/mikro-orm-cli.config.ts index 277e9ee8..535604b8 100644 --- a/src/common/database/mikro-orm-cli.config.ts +++ b/src/common/database/mikro-orm-cli.config.ts @@ -3,7 +3,7 @@ import { defineConfig } from "@mikro-orm/postgresql"; import { Logger } from "@nestjs/common"; import { config as environmentConfig } from "dotenv"; import dotEnvExpand from "dotenv-expand"; -import { baseOptions } from "./config"; +import { baseOptions } from "./orm.config"; /** * diff --git a/src/common/database/config.ts b/src/common/database/orm.config.ts similarity index 100% rename from src/common/database/config.ts rename to src/common/database/orm.config.ts diff --git a/src/lib/index.ts b/src/lib/index.ts index 5a83f27e..df40ba51 100644 --- a/src/lib/index.ts +++ b/src/lib/index.ts @@ -14,3 +14,7 @@ export * from "./sentry.module"; export * from "./serve-static.module"; export * from "./throttle.module"; export * from "./twilio"; +export * from "./config/config.module"; +export * from "./pino/pino.module"; +export * from "./rabbit.module"; +export * from "./cache/cache.module"; diff --git a/src/lib/orm.module.ts b/src/lib/orm.module.ts index 3f7fe0f6..fa1b4d95 100644 --- a/src/lib/orm.module.ts +++ b/src/lib/orm.module.ts @@ -3,7 +3,7 @@ import { defineConfig } from "@mikro-orm/postgresql"; import { Global, Module } from "@nestjs/common"; import { ConfigModule, ConfigService } from "@nestjs/config"; import * as Entities from "@entities"; -import { baseOptions } from "@common/database/config"; +import { baseOptions } from "@common/database/orm.config"; @Global() @Module({ diff --git a/src/modules/category/category.module.ts b/src/modules/category/category.module.ts index 6662c092..59d303dd 100644 --- a/src/modules/category/category.module.ts +++ b/src/modules/category/category.module.ts @@ -1,23 +1,8 @@ import { Module } from "@nestjs/common"; -import { ConfigModule, ConfigService } from "@nestjs/config"; -import { FastJwtModule } from "nestjs-fastjwt"; import { CategoryController } from "./category.controller"; import { CategoryService } from "./category.service"; @Module({ - imports: [ - FastJwtModule.registerAsync({ - imports: [ConfigModule], - inject: [ConfigService], - useFactory: async (configService: ConfigService) => ({ - isGlobal: true, - secret: configService.get("jwt.secret", { infer: true }), - signOptions: { - expiresIn: configService.get("jwt.accessExpiry", { infer: true }), - }, - }), - }), - ], controllers: [CategoryController], providers: [CategoryService], }) diff --git a/src/modules/shared/shared.module.ts b/src/modules/shared/shared.module.ts index a64e658d..3260972d 100644 --- a/src/modules/shared/shared.module.ts +++ b/src/modules/shared/shared.module.ts @@ -1,22 +1,22 @@ import { IsUniqueConstraint } from "@common/decorators/validation"; import { CustomThrottlerGuard } from "@common/guards"; import { ClearCacheInterceptor, HttpCacheInterceptor } from "@common/interceptors"; -import { NestCacheModule } from "@lib/cache"; -import { NestConfigModule } from "@lib/config/config.module"; import { NestCaslModule, NestCloudinaryModule, + NestConfigModule, NestHttpModule, NestI18nModule, NestJwtModule, NestMailModule, + NestPinoModule, + NestRabbitModule, NestSentryModule, NestServeStaticModule, NestThrottlerModule, OrmModule, + NestCacheModule } from "@lib/index"; -import { NestPinoModule } from "@lib/pino/pino.module"; -import { NestRabbitModule } from "@lib/rabbit/rabbit.module"; import { AuthModule } from "@modules/auth/auth.module"; import { CategoryModule } from "@modules/category/category.module"; import { ChatModule } from "@modules/chat/chat.module"; @@ -61,7 +61,7 @@ import { SentryInterceptor } from "@travelerdev/nestjs-sentry"; providers: [ IsUniqueConstraint, { - provide: APP_INTERCEPTOR, // TODO: fix sentry + provide: APP_INTERCEPTOR, useFactory: () => new SentryInterceptor(), }, { @@ -78,4 +78,4 @@ import { SentryInterceptor } from "@travelerdev/nestjs-sentry"; }, ], }) -export class SharedModule {} +export class SharedModule { }