Skip to content

v3.0.0

Latest

Choose a tag to compare

@BrahimAbdelli BrahimAbdelli released this 29 Nov 12:55
· 1 commit to master since this release

[3.0.0] - 2026-11-28

Changed (dependencies — major)

  • NestJS 11 → 12 (common/core/platform-express/testing 12.6.3, cli 12.0.15, swagger 12.1.3, typeorm 12.0.3, config 12.1.1, axios 12.0.2, cache-manager 12.0.5)
  • TypeORM 0.3.31 → 1.1.3, AutoMapper 8 → 9.0.2, @nestjs-modules/mailer 2 → 4, nodemailer 8 → 10, dotenv 17 → 18, puppeteer 24 → 25, sonarqube-scanner 4 → 5
  • Minor/patch refresh: eslint 10.16, typescript-eslint 8.74, prettier 3.10.1, axios 1.21.1, ts-jest 29.4.15, @types/node 26
  • Node.js >= 22.12 is now required (engines); CI workflows and Dockerfile moved from Node 20/18 to Node 22
  • Kept on hold: TypeScript 7 (ts-jest supports <7, @nestjs/swagger 12 peers ^5.5 || ^6), mongodb pinned to 7.5.0 (see 2.0.4)

Fixed (migration)

  • Replace deep imports removed by the NestJS 12 exports maps: HttpArgumentsHost and TypeOrmModuleOptions from package roots; EntityClassOrSchema now defined in @shared/common/types
  • TypeORM 1: find({ select }) uses the object form ({ id: true })
  • Jest: NestJS 12 / AutoMapper 9 / uuid / nodemailer are ESM-only — transpiled to CommonJS via jest.esm-packages.js + jest.esm-transformer.js (rewrites import.meta.url); not needed once Jest runs on Node >= 24.9
  • Middleware wildcard routes use the path-to-regexp 8 syntax (users/{*path}), removing LegacyRouteConverter warnings
  • @AutoMap(() => [String]) on roles so AutoMapper maps the array instead of skipping it

Security

  • PUT /users/user/:id and PATCH /users/archive/:id: users can only modify their own account (403 USER_NOT_ACCOUNT_OWNER otherwise)
  • PATCH /users/archive/:id and PATCH /users/unarchive/:id now require authentication (were reachable without a token)

Changed (typing)

  • noImplicitAny and strictNullChecks enabled (strictPropertyInitialization stays off: DTOs/entities are filled by class-transformer, TypeORM and AutoMapper)
  • No explicit any left (ESLint 109 warnings → 0); @types/jsonwebtoken, @types/compression, @types/serve-favicon added
  • JWT payloads typed and checked at runtime (isAuthTokenPayload / isResetPasswordTokenPayload); req.user._id is now a real ObjectId (was the JWT string), req.user is optional
  • Durations (TOKEN_EXPIRATION, RESET_PASSWORD_EXPIRATION) and MAILJET_VERSION typed and format-validated at startup
  • Config loaders use requiredEnv() (clear error naming the missing variable); services use configService.getOrThrow()
  • Repository lookups return D | null; array mappers return [] instead of undefined; base mapper placeholders throw instead of returning null
  • TestAppModule registers the production ValidationPipe so E2E tests exercise the same validation as the running app

Fixed (pre-existing)

  • Global ValidationPipe turned { id } route params into ObjectId → PUT /users/user/:id, PATCH /users/archive/:id (and every typed :id route) answered 500 in production; pipes now only validate classes that carry class-validator rules
  • Search returned 400 when orders was empty or absent, and rejected the 1/-1 directions its type allows
  • Unescaped user input in RegExp (isFieldUnique, findByField, search LIKE): ( caused a 500, . matched any character (e.g. john.doe@… reported as a duplicate of johnxdoe@…)
  • GET /products/search required a token: the middleware exclusion still carried the api/ prefix, which NestJS 12 now applies itself
  • NoSQL injection in search: key could be a Mongo operator ($where ran server-side JavaScript) and an EQUALS value could be an operator object ({ "$ne": null }, { "$regex": … }); key must now be a field path and value a string, number, boolean or null
  • Negative skip/take reached Mongo and answered 500: search rejects them with 400, /paginate falls back to the defaults
  • TOKEN_EXPIRATION / RESET_PASSWORD_EXPIRATION are checked at startup with the same grammar as ms (used by jsonwebtoken)
  • Optional take/skip query params were rejected with 400 "No data submitted" (empty-value check now limited to the body)
  • npm run build emitted nothing after prebuild wiped dist/ (stale root tsconfig.build.tsbuildinfo); build info now lives in dist/ and *.tsbuildinfo is git-ignored
  • node dist/main crashed with compression is not a function: default imports for compression and serve-favicon

Verified

  • Unit tests: 131/131
  • E2E tests: 102/102
  • npm run build emits the full dist/; node dist/main boots on Node 22.14 (Swagger /docs 200, routes + auth middleware OK)
  • ESLint: 0 errors, 0 warnings; Prettier check clean; tsc clean with noImplicitAny + strictNullChecks
  • Live scenario against node dist/main: 42/42 requests (auth, ownership, users, categories, products, search, pagination)