@nathapp/nestjs-auth-2fa 3.3.0 → 4.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.
@@ -1,4 +1,4 @@
1
1
 
2
- > @nathapp/nestjs-auth-2fa@3.3.0 build
2
+ > @nathapp/nestjs-auth-2fa@4.0.1 build
3
3
  > rimraf dist && tsc -p tsconfig.json
4
4
 
@@ -1,4 +1,9 @@
1
+ import { Reflector } from '@nestjs/core';
2
+ import { TwoFactorAuthModuleOptionsWithoutProvider } from '../module';
3
+ import { TwoFactorAuthProvider, TwoFactorSettingProvider } from '../provider';
4
+ import { TwoFactorType } from '../enum/two-factor-type.enum';
1
5
  import { BaseTwoFactorGuard } from './base-two-factor.guard';
2
6
  export declare class TwoFactorForceGuard extends BaseTwoFactorGuard {
7
+ constructor(options: TwoFactorAuthModuleOptionsWithoutProvider, providersMap: Map<TwoFactorType, TwoFactorAuthProvider>, twoFactorProvider: TwoFactorAuthProvider, twoFactorSettingProvider: TwoFactorSettingProvider, reflector?: Reflector);
3
8
  protected handleNoEnabledMethods(): never;
4
9
  }
@@ -5,18 +5,39 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
5
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
6
  return c > 3 && r && Object.defineProperty(target, key, r), r;
7
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
+ };
8
14
  Object.defineProperty(exports, "__esModule", { value: true });
9
15
  exports.TwoFactorForceGuard = void 0;
10
16
  const common_1 = require("@nestjs/common");
17
+ const core_1 = require("@nestjs/core");
18
+ const module_1 = require("../module");
19
+ const provider_1 = require("../provider");
11
20
  const nestjs_common_1 = require("@nathapp/nestjs-common");
12
21
  const base_two_factor_guard_1 = require("./base-two-factor.guard");
13
22
  let TwoFactorForceGuard = class TwoFactorForceGuard extends base_two_factor_guard_1.BaseTwoFactorGuard {
23
+ constructor(options, providersMap, twoFactorProvider, twoFactorSettingProvider, reflector) {
24
+ super(options, providersMap, twoFactorProvider, twoFactorSettingProvider, reflector);
25
+ }
14
26
  handleNoEnabledMethods() {
15
27
  throw new nestjs_common_1.TwoFactorRequiredException();
16
28
  }
17
29
  };
18
30
  exports.TwoFactorForceGuard = TwoFactorForceGuard;
19
31
  exports.TwoFactorForceGuard = TwoFactorForceGuard = __decorate([
20
- (0, common_1.Injectable)()
32
+ (0, common_1.Injectable)(),
33
+ __param(0, (0, common_1.Inject)(module_1.TWO_FACTOR_AUTH_MODULE_OPTIONS)),
34
+ __param(1, (0, common_1.Optional)()),
35
+ __param(1, (0, common_1.Inject)(module_1.TWO_FACTOR_PROVIDERS_MAP)),
36
+ __param(2, (0, common_1.Optional)()),
37
+ __param(4, (0, common_1.Optional)()),
38
+ __metadata("design:paramtypes", [Object, Map,
39
+ provider_1.TwoFactorAuthProvider,
40
+ provider_1.TwoFactorSettingProvider,
41
+ core_1.Reflector])
21
42
  ], TwoFactorForceGuard);
22
43
  //# sourceMappingURL=two-factor-force.guard.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"two-factor-force.guard.js","sourceRoot":"","sources":["../../lib/guard/two-factor-force.guard.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAA4C;AAC5C,0DAAoE;AACpE,mEAA6D;AAiCtD,IAAM,mBAAmB,GAAzB,MAAM,mBAAoB,SAAQ,0CAAkB;IAS/C,sBAAsB;QAE9B,MAAM,IAAI,0CAA0B,EAAE,CAAC;IACzC,CAAC;CAEF,CAAA;AAdY,kDAAmB;8BAAnB,mBAAmB;IAD/B,IAAA,mBAAU,GAAE;GACA,mBAAmB,CAc/B"}
1
+ {"version":3,"file":"two-factor-force.guard.js","sourceRoot":"","sources":["../../lib/guard/two-factor-force.guard.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA8D;AAC9D,uCAAyC;AACzC,sCAAgI;AAChI,0CAA8E;AAE9E,0DAAoE;AACpE,mEAA6D;AAiCtD,IAAM,mBAAmB,GAAzB,MAAM,mBAAoB,SAAQ,0CAAkB;IAIzD,YAEE,OAAkD,EAElD,YAAuD,EAEvD,iBAAwC,EACxC,wBAAkD,EAElD,SAAqB;QAErB,KAAK,CAAC,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,SAAS,CAAC,CAAC;IACvF,CAAC;IASS,sBAAsB;QAE9B,MAAM,IAAI,0CAA0B,EAAE,CAAC;IACzC,CAAC;CAEF,CAAA;AA9BY,kDAAmB;8BAAnB,mBAAmB;IAD/B,IAAA,mBAAU,GAAE;IAMR,WAAA,IAAA,eAAM,EAAC,uCAA8B,CAAC,CAAA;IAEtC,WAAA,IAAA,iBAAQ,GAAE,CAAA;IAAE,WAAA,IAAA,eAAM,EAAC,iCAAwB,CAAC,CAAA;IAE5C,WAAA,IAAA,iBAAQ,GAAE,CAAA;IAGV,WAAA,IAAA,iBAAQ,GAAE,CAAA;6CAJG,GAAG;QAEE,gCAAqB;QACd,mCAAwB;QAEtC,gBAAS;GAbZ,mBAAmB,CA8B/B"}
@@ -1,5 +1,10 @@
1
+ import { Reflector } from '@nestjs/core';
2
+ import { TwoFactorAuthModuleOptionsWithoutProvider } from '../module';
3
+ import { TwoFactorAuthProvider, TwoFactorSettingProvider } from '../provider';
4
+ import { TwoFactorType } from '../enum/two-factor-type.enum';
1
5
  import { BaseTwoFactorGuard } from './base-two-factor.guard';
2
6
  export { TWO_FACTOR_PROVIDERS_MAP } from '../module/two-factor-auth.interface';
3
7
  export declare class TwoFactorGuard extends BaseTwoFactorGuard {
8
+ constructor(options: TwoFactorAuthModuleOptionsWithoutProvider, providersMap: Map<TwoFactorType, TwoFactorAuthProvider>, twoFactorProvider: TwoFactorAuthProvider, twoFactorSettingProvider: TwoFactorSettingProvider, reflector?: Reflector);
4
9
  protected handleNoEnabledMethods(): boolean;
5
10
  }
@@ -5,19 +5,40 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
5
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
6
  return c > 3 && r && Object.defineProperty(target, key, r), r;
7
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
+ };
8
14
  Object.defineProperty(exports, "__esModule", { value: true });
9
15
  exports.TwoFactorGuard = exports.TWO_FACTOR_PROVIDERS_MAP = void 0;
10
16
  const common_1 = require("@nestjs/common");
17
+ const core_1 = require("@nestjs/core");
18
+ const module_1 = require("../module");
19
+ const provider_1 = require("../provider");
11
20
  const base_two_factor_guard_1 = require("./base-two-factor.guard");
12
21
  var two_factor_auth_interface_1 = require("../module/two-factor-auth.interface");
13
22
  Object.defineProperty(exports, "TWO_FACTOR_PROVIDERS_MAP", { enumerable: true, get: function () { return two_factor_auth_interface_1.TWO_FACTOR_PROVIDERS_MAP; } });
14
23
  let TwoFactorGuard = class TwoFactorGuard extends base_two_factor_guard_1.BaseTwoFactorGuard {
24
+ constructor(options, providersMap, twoFactorProvider, twoFactorSettingProvider, reflector) {
25
+ super(options, providersMap, twoFactorProvider, twoFactorSettingProvider, reflector);
26
+ }
15
27
  handleNoEnabledMethods() {
16
28
  return true;
17
29
  }
18
30
  };
19
31
  exports.TwoFactorGuard = TwoFactorGuard;
20
32
  exports.TwoFactorGuard = TwoFactorGuard = __decorate([
21
- (0, common_1.Injectable)()
33
+ (0, common_1.Injectable)(),
34
+ __param(0, (0, common_1.Inject)(module_1.TWO_FACTOR_AUTH_MODULE_OPTIONS)),
35
+ __param(1, (0, common_1.Optional)()),
36
+ __param(1, (0, common_1.Inject)(module_1.TWO_FACTOR_PROVIDERS_MAP)),
37
+ __param(2, (0, common_1.Optional)()),
38
+ __param(4, (0, common_1.Optional)()),
39
+ __metadata("design:paramtypes", [Object, Map,
40
+ provider_1.TwoFactorAuthProvider,
41
+ provider_1.TwoFactorSettingProvider,
42
+ core_1.Reflector])
22
43
  ], TwoFactorGuard);
23
44
  //# sourceMappingURL=two-factor.guard.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"two-factor.guard.js","sourceRoot":"","sources":["../../lib/guard/two-factor.guard.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAA4C;AAC5C,mEAA6D;AAG7D,iFAA+E;AAAtE,qIAAA,wBAAwB,OAAA;AA4B1B,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,0CAAkB;IAQ1C,sBAAsB;QAE9B,OAAO,IAAI,CAAC;IACd,CAAC;CAEF,CAAA;AAbY,wCAAc;yBAAd,cAAc;IAD1B,IAAA,mBAAU,GAAE;GACA,cAAc,CAa1B"}
1
+ {"version":3,"file":"two-factor.guard.js","sourceRoot":"","sources":["../../lib/guard/two-factor.guard.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA8D;AAC9D,uCAAyC;AACzC,sCAAgI;AAChI,0CAA8E;AAE9E,mEAA6D;AAG7D,iFAA+E;AAAtE,qIAAA,wBAAwB,OAAA;AA4B1B,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,0CAAkB;IAIpD,YAEE,OAAkD,EAElD,YAAuD,EAEvD,iBAAwC,EACxC,wBAAkD,EAElD,SAAqB;QAErB,KAAK,CAAC,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,SAAS,CAAC,CAAC;IACvF,CAAC;IAQS,sBAAsB;QAE9B,OAAO,IAAI,CAAC;IACd,CAAC;CAEF,CAAA;AA7BY,wCAAc;yBAAd,cAAc;IAD1B,IAAA,mBAAU,GAAE;IAMR,WAAA,IAAA,eAAM,EAAC,uCAA8B,CAAC,CAAA;IAEtC,WAAA,IAAA,iBAAQ,GAAE,CAAA;IAAE,WAAA,IAAA,eAAM,EAAC,iCAAwB,CAAC,CAAA;IAE5C,WAAA,IAAA,iBAAQ,GAAE,CAAA;IAGV,WAAA,IAAA,iBAAQ,GAAE,CAAA;6CAJG,GAAG;QAEE,gCAAqB;QACd,mCAAwB;QAEtC,gBAAS;GAbZ,cAAc,CA6B1B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nathapp/nestjs-auth-2fa",
3
- "version": "3.3.0",
3
+ "version": "4.0.1",
4
4
  "description": "nestjs-auth-2fa",
5
5
  "scripts": {
6
6
  "clean": "rimraf dist/ .turbo/",
@@ -16,7 +16,7 @@
16
16
  "author": "William Khoo",
17
17
  "license": "ISC",
18
18
  "engines": {
19
- "node": ">=16"
19
+ "node": "^20.19.0 || >=22.12.0"
20
20
  },
21
21
  "devDependencies": {
22
22
  "@nathapp/eslint-config": "1.0.1",
@@ -32,12 +32,14 @@
32
32
  "lib": "lib"
33
33
  },
34
34
  "dependencies": {
35
- "@nathapp/nestjs-auth": "^3.3.0",
36
- "@nathapp/nestjs-common": "^3.3.0"
35
+ "@nathapp/nestjs-auth": "^4.0.1",
36
+ "@nathapp/nestjs-common": "^4.0.1"
37
37
  },
38
38
  "peerDependencies": {
39
- "@nathapp/nestjs-auth": "^3.0.0",
40
- "@nathapp/nestjs-common": "^3.0.0",
39
+ "@nathapp/nestjs-auth": "^4.0.0-rc.0",
40
+ "@nathapp/nestjs-common": "^4.0.0-rc.0",
41
+ "@nestjs/common": "^10.0.0 || ^11.0.0 || ^12.0.0",
42
+ "@nestjs/core": "^10.0.0 || ^11.0.0 || ^12.0.0",
41
43
  "otplib": "^12.0.1",
42
44
  "qrcode": "^1.5.4"
43
45
  },
package/.eslintrc.js DELETED
@@ -1,24 +0,0 @@
1
- module.exports = {
2
- parser: '@typescript-eslint/parser',
3
- parserOptions: {
4
- project: 'tsconfig.json',
5
- sourceType: 'module',
6
- },
7
- plugins: ['@typescript-eslint/eslint-plugin'],
8
- extends: [
9
- 'plugin:@typescript-eslint/recommended',
10
- 'plugin:prettier/recommended',
11
- ],
12
- root: true,
13
- env: {
14
- node: true,
15
- jest: true,
16
- },
17
- ignorePatterns: ['.eslintrc.js'],
18
- rules: {
19
- '@typescript-eslint/interface-name-prefix': 'off',
20
- '@typescript-eslint/explicit-function-return-type': 'off',
21
- '@typescript-eslint/explicit-module-boundary-types': 'off',
22
- '@typescript-eslint/no-explicit-any': 'off',
23
- },
24
- };
package/CHANGELOG.md DELETED
@@ -1,412 +0,0 @@
1
- # @nathapp/nestjs-auth-2fa
2
-
3
- ## 3.3.0
4
-
5
- ### Patch Changes
6
-
7
- - @nathapp/nestjs-auth@3.3.0
8
- - @nathapp/nestjs-common@3.3.0
9
-
10
- ## 3.2.1
11
-
12
- ### Patch Changes
13
-
14
- - 0610b83: Fix Exception Bug on nestjs-common
15
- - Updated dependencies [0610b83]
16
- - @nathapp/nestjs-auth@3.2.1
17
- - @nathapp/nestjs-common@3.2.1
18
-
19
- ## 3.2.0
20
-
21
- ### Minor Changes
22
-
23
- - 1876b9a: ### nestjs-auth
24
-
25
- - Add JWKS support via `JwksJwtStrategyProvider` and `createJwksStrategyProvider` factory — enables remote key resolution through `jwks-rsa` (optional peer dep)
26
- - Add `validateJwksOptions` security guard and `JwksOptions` interface
27
- - Export `JwksJwtStrategyProvider` and `JwksOptions` from the public API
28
- - Fix permission guard and JWT module immutability issues from code review
29
-
30
- ### nestjs-typeorm
31
-
32
- - Add `AbstractTypeOrmRepository<TDomain, TEntity, TId>` — portable `IRepository` implementation decoupled from TypeORM internals
33
- - Add `TYPEORM_TRANSACTION_ALS` DI token and publish it from `forRoot`/`forRootAsync`
34
- - `forCustomRepository` now instantiates `AbstractTypeOrmRepository` subclasses with the correct per-DataSource tx manager token
35
- - Add `getTypeOrmTransactionManagerToken(name?)` helper for multi-DataSource wiring
36
- - Named DataSource tx tokens no longer collide; default DataSource still aliases the global `TRANSACTION_MANAGER` symbol
37
-
38
- ### nestjs-prisma
39
-
40
- - Add `getPrismaTransactionManagerToken(name?)` helper for multi-DataSource wiring
41
- - `forRoot` / `forRootAsync` register named tx manager token + default-only guard to prevent collision
42
-
43
- ### nestjs-data
44
-
45
- - Add `IRepository<TDomain, TId>` portable repository contract
46
- - Fix missing `@nathapp/nestjs-common` peer dep for turborepo build resolution
47
-
48
- ### nestjs-common
49
-
50
- - Add `request-ip` utility for extracting client IP across Express and Fastify adapters
51
-
52
- ### nestjs-cache
53
-
54
- - Fix cache interceptor, cache manager, and cache tag registry immutability and type issues
55
-
56
- ### nestjs-app
57
-
58
- - Fix `nathapp.ts` and `app-factory.ts` code review findings (immutability, error handling)
59
-
60
- ### nestjs-queue
61
-
62
- - Upgrade `uuid` dependency from `^9.0.0` to `^11.1.1` (security)
63
- - Fix BullMQ health check to use `IRedisClient.info()` (aligned with BullMQ interface)
64
-
65
- ### nestjs-notification
66
-
67
- - Upgrade `nodemailer` dev dep from `^7` to `^8` — resolves SMTP command injection CVEs (GHSA-c7w3-x93f-qmm8, GHSA-vvjj-xcjg-gr5g)
68
-
69
- ### nestjs-storage
70
-
71
- - Fix code review findings (immutability, validation)
72
-
73
- ### nestjs-throttler
74
-
75
- - Fix code review findings
76
-
77
- ### All packages
78
-
79
- - Upgrade AJV to v8 (removes root override that broke `@fastify/ajv-compiler`)
80
- - Align all package versions to 3.1.3 as baseline for this minor release
81
-
82
- ### Patch Changes
83
-
84
- - Updated dependencies [1876b9a]
85
- - @nathapp/nestjs-auth@3.2.0
86
- - @nathapp/nestjs-common@3.2.0
87
-
88
- ## 3.0.0
89
-
90
- ### Major Changes
91
-
92
- - 86a36b8: # 🚀 v3.0.0 Monorepo Enterprise Upgrade
93
-
94
- This release brings significant security hardening, strict typing, improved observability, and comprehensive documentation across the entire Nathapp NestJS ecosystem.
95
-
96
- ## ⚠️ Breaking Changes
97
-
98
- ### nestjs-common
99
-
100
- - **Trust Proxy (Fail-Closed)**: Trust proxy is now disabled by default. Production deployments behind a reverse proxy MUST configure `trustedProxies` or use a preset (`cloudflare`, `aws-alb`, `nginx-local`, etc.). See `docs/trust-proxy-security.md`.
101
- - **SerializableInterceptor**: Now uses pure transformation — original response objects are no longer mutated. Primitives in arrays are preserved correctly.
102
- - **AppException**: Now generic `AppException<T>` for strict argument typing.
103
-
104
- ### nestjs-logging
105
-
106
- - **Redaction**: Default redact paths are now constrained to 3 levels deep (`*.*.key`).
107
- - **Structured Logs**: Standardized field names for ELK/Loki/Datadog compatibility.
108
- - **Graceful Drain**: Logger now implements `OnModuleDestroy` to flush pending writes on shutdown.
109
-
110
- ### nestjs-typeorm
111
-
112
- - **Connection Validation**: `TypeOrmExModule.forRoot()` now throws `"Connection Not Supported"` when no valid connection type is provided (previously defaulted silently to MySQL).
113
-
114
- ## 🔒 Security
115
-
116
- - **nestjs-common**: Trust proxy fail-closed default prevents IP spoofing when misconfigured. Comprehensive security documentation with provider presets.
117
- - **nestjs-storage**: GDrive refreshToken security best practices documented. Provider capability matrix added.
118
- - **nestjs-throttler**: Documented that `getTracker()` executes synchronously — no async TOCTOU race condition in rate limiting.
119
- - **nestjs-typeorm**: Stored procedure name validation with whitelist pattern (`/^[a-zA-Z_][a-zA-Z0-9_.]*$/`) prevents SQL injection.
120
- - **nestjs-cache**: Tag registry now receives TTL for proper expiration of tag-to-key mappings.
121
- - **nestjs-microservices**: Fixed gRPC Bearer token extraction whitespace bug. Full test coverage for all guards.
122
- - **nestjs-auth-2fa**: Timing-safe TOTP verification prevents timing attacks.
123
-
124
- ## ✨ Features & Improvements
125
-
126
- - **nestjs-storage**: Added native support for **Azure Blob Storage** and **Google Cloud Storage**. Provider capability matrix documents supported methods per provider.
127
- - **nestjs-microservices**: Full guard coverage (100%), Service Identity JWT + HMAC authentication, `ServicePermissionRegistry` for fine-grained access control.
128
- - **nestjs-typeorm**: Automatic mapping of database errors to `AppException` via `TypeOrmExceptionFilter`.
129
- - **nestjs-auth-2fa**: `BaseTwoFactorGuard` with flexible policy engine. DI-aware provider factory with comprehensive architectural documentation.
130
- - **nestjs-cache**: Deep-cloning of cached objects to prevent cross-request state leakage. Touch fallback avoided for distributed strategies (race condition prevention).
131
- - **nestjs-queue**: Race-condition fixes in BullMQ/RabbitMQ batch accumulators.
132
- - **nestjs-prisma**: `PrismaExceptionFilter` and transaction helper. Parallel query execution validated.
133
- - **nestjs-auth**: Comprehensive JSDoc on all public APIs. All TODO comments resolved.
134
- - **nestjs-common**: `ConfigurableModuleBuilder` with `externallyConfigured()` support.
135
- - **Global**: 2,500+ tests across all 13 packages. Comprehensive JSDoc for all public APIs.
136
-
137
- ## 📚 Documentation
138
-
139
- - `nestjs-common/docs/trust-proxy-security.md` — IP spoofing risks, preset configurations, verification steps
140
- - `nestjs-storage/docs/gdrive-security.md` — refreshToken security best practices
141
- - `nestjs-storage/docs/provider-capabilities.md` — method support matrix per provider
142
- - All packages: JSDoc on public APIs, MIGRATION.md guides where applicable
143
-
144
- ### Patch Changes
145
-
146
- - Updated dependencies [86a36b8]
147
- - @nathapp/nestjs-common@3.0.0
148
- - @nathapp/nestjs-auth@3.0.0
149
-
150
- ## 3.0.0-rc.0
151
-
152
- ### Major Changes
153
-
154
- - # 🚀 v3.0.0-rc Monorepo Enterprise Upgrade
155
-
156
- This release brings significant security, reliability, and observability improvements across the entire Nathapp ecosystem.
157
-
158
- ## ⚠️ [BREAKING CHANGES]
159
-
160
- ### nestjs-common
161
-
162
- - **Trust Proxy (Fail-Closed)**: Trust proxy is now disabled by default. Production deployments MUST configure `trustedProxies` or use a preset (`cloudflare`, `aws-alb`, etc.).
163
- - **SerializableInterceptor**: Now uses pure transformation. Original response objects are no longer mutated.
164
- - **AppException**: Now generic `AppException<T>` for strict argument typing.
165
-
166
- ### nestjs-logging
167
-
168
- - **Redaction**: Default redact paths are now constrained to 3 levels deep (`*.*.key`).
169
- - **Structured Logs**: Standardized field names for ELK/Loki/Datadog compatibility.
170
-
171
- ## ✨ Features & Improvements
172
-
173
- - **nestjs-storage**: Added native support for **Azure Blob Storage** and **Google Cloud Storage**.
174
- - **nestjs-microservices**: Full guard coverage and secured gRPC Bearer token extraction.
175
- - **nestjs-typeorm**: Automatic mapping of database errors to `AppException`.
176
- - **nestjs-auth-2fa**: Timing-safe TOTP verification and flexible policy engine.
177
- - **nestjs-cache**: Deep-cloning of cached objects to prevent cross-request state leakage.
178
- - **nestjs-queue**: Race-condition fixes in BullMQ/RabbitMQ batch accumulators.
179
- - **nestjs-throttler**: Added async trust proxy support.
180
- - **Global**: Comprehensive JSDoc for all public APIs across all packages.
181
-
182
- ### Patch Changes
183
-
184
- - Updated dependencies
185
- - @nathapp/nestjs-common@3.0.0-rc.0
186
- - @nathapp/nestjs-auth@3.0.0-rc.0
187
-
188
- ## 2.1.5
189
-
190
- ### Patch Changes
191
-
192
- - # @nathapp/nestjs-notification v2.2.0 - Enterprise-Grade Upgrade
193
-
194
- Major enterprise enhancements to the notification system with 9 phases of improvements:
195
-
196
- ## New Features
197
-
198
- ### Phase 1: Pluggable Template Engine
199
-
200
- - `TemplateEngine` interface for custom template rendering
201
- - `StringFormatEngine` as default (backwards compatible)
202
- - Apps can now inject Handlebars, EJS, or custom engines
203
-
204
- ### Phase 2: Configurable Strict Mode
205
-
206
- - `strict: true` (default) throws errors when services aren't configured
207
- - `strict: false` for graceful degradation (returns `{ success: false }`)
208
- - Clear error messages via `NotificationConfigError`
209
-
210
- ### Phase 3: Unified `send()` Method
211
-
212
- - Single method dispatches to multiple channels
213
- - `NotificationPayload` with `channels: ['email', 'push', 'sms']`
214
- - Aggregated results across all channels
215
-
216
- ### Phase 4: Platform Alias
217
-
218
- - Added `platform` field (deprecated `paltform` typo)
219
- - Backwards compatible with fallback
220
-
221
- ### Phase 5: SMS Integration
222
-
223
- - `SmsService` wired into `NotificationModule`
224
- - `sendSms()` with full template support
225
- - Ready for provider packages (Twilio, SNS)
226
-
227
- ### Phase 6: Interceptors & Hooks
228
-
229
- - `NotificationInterceptor` interface
230
- - `beforeSend`, `afterSend`, `onError` hooks
231
- - Global logging, auditing, message modification
232
-
233
- ### Phase 7: WhatsApp Channel
234
-
235
- - `WhatsAppService` abstract class
236
- - `WhatsAppMessage` interface with Meta Business API support
237
- - Template-based WhatsApp notifications
238
-
239
- ### Phase 8: Channel Fallback
240
-
241
- - `fallback: ['sms']` on `NotificationPayload`
242
- - Auto-retry through fallback channels when primary fails
243
- - Interceptors receive `isFallback` + `failedChannel` context
244
-
245
- ### Phase 9: Unified Provider Registry (⚠️ Breaking)
246
-
247
- - Replaced per-channel modules with unified `providers` array
248
- - `NotificationProviderFactory` validates provider ↔ channel match
249
- - `NotificationModuleOptionsFactory` for async configuration
250
- - Simplified API: `NotificationModule.forRoot({ providers: [...] })`
251
-
252
- ## Breaking Changes (Phase 9)
253
-
254
- - `emailOptions` → removed (use `providers` array)
255
- - `pushNotificationOptions` → removed (use `providers` array)
256
- - `smsService` → removed (use `providers` array)
257
- - `whatsAppService` → removed (use `providers` array)
258
- - `EmailModule`, `PushNotificationModule` no longer exported from main index
259
-
260
- ## Migration Guide
261
-
262
- ### Before
263
-
264
- ```typescript
265
- NotificationModule.forRoot({
266
- emailOptions: EmailModule.forRoot({ option: { type: 'smtp', options: {...} } }),
267
- templateLoader: MyLoader,
268
- })
269
- ```
270
-
271
- ### After
272
-
273
- ```typescript
274
- NotificationModule.forRoot({
275
- providers: [
276
- {
277
- channel: "email",
278
- provider: SmtpEmailProvider,
279
- options: { url: "...", from: "..." },
280
- },
281
- ],
282
- templateLoader: MyLoader,
283
- });
284
- ```
285
-
286
- ## Stats
287
-
288
- - **159 tests** (all passing)
289
- - **88.5% code coverage**
290
- - Fully backwards compatible (except Phase 9 breaking changes)
291
-
292
- - Updated dependencies
293
- - @nathapp/nestjs-auth@2.1.5
294
- - @nathapp/nestjs-common@2.1.5
295
-
296
- ## 2.1.1
297
-
298
- ### Patch Changes
299
-
300
- - 1244520: fix: correct main/types paths to dist/ directory
301
- - Updated dependencies [1244520]
302
- - @nathapp/nestjs-auth@2.1.1
303
- - @nathapp/nestjs-common@2.1.1
304
-
305
- ## 3.0.0-rc.4
306
-
307
- ### Minor Changes
308
-
309
- - de7078f: bump version
310
-
311
- ### Patch Changes
312
-
313
- - Updated dependencies [de7078f]
314
- - @nathapp/nestjs-auth@3.0.0-rc.4
315
- - @nathapp/nestjs-common@3.0.0-rc.4
316
-
317
- ## 2.0.4
318
-
319
- ### Patch Changes
320
-
321
- - 65148c4: security patch
322
- - Updated dependencies [65148c4]
323
- - @nathapp/nestjs-auth@2.0.4
324
- - @nathapp/nestjs-common@2.0.4
325
-
326
- ## 2.0.3
327
-
328
- ### Patch Changes
329
-
330
- - 9da9d5a: add createClassTypeOrAsyncOptionsProvider, createAsyncOptionsProvider
331
- - Updated dependencies [9da9d5a]
332
- - @nathapp/nestjs-common@2.0.3
333
- - @nathapp/nestjs-auth@2.0.3
334
-
335
- ## 2.0.3-rc.0
336
-
337
- ### Patch Changes
338
-
339
- - 9da9d5a: add createClassTypeOrAsyncOptionsProvider, createAsyncOptionsProvider
340
- - Updated dependencies [9da9d5a]
341
- - @nathapp/nestjs-common@2.0.3-rc.0
342
- - @nathapp/nestjs-auth@2.0.3-rc.0
343
-
344
- ## 2.0.2
345
-
346
- ### Patch Changes
347
-
348
- - 07fb6ad: fix nathapp i18nService & patch package security
349
-
350
- ## 2.0.1-rc.1
351
-
352
- ### Patch Changes
353
-
354
- - 07fb6ad: fix nathapp i18nService & patch package security
355
-
356
- ## 2.0.1-rc.0
357
-
358
- ### Patch Changes
359
-
360
- - Updated dependencies [ea53607]
361
- - @nathapp/nestjs-common@2.0.1-rc.0
362
- - @nathapp/nestjs-auth@2.0.1-rc.0
363
-
364
- ## 2.0.0
365
-
366
- ### Major Changes
367
-
368
- - c8d545b: upgrade to nestjs 11
369
-
370
- ### Patch Changes
371
-
372
- - Updated dependencies [c8d545b]
373
- - @nathapp/nestjs-common@2.0.0
374
- - @nathapp/nestjs-auth@2.0.0
375
-
376
- ## 2.0.0-rc.0
377
-
378
- ### Major Changes
379
-
380
- - c8d545b: upgrade to nestjs 11
381
-
382
- ### Patch Changes
383
-
384
- - Updated dependencies [c8d545b]
385
- - @nathapp/nestjs-common@2.0.0-rc.0
386
- - @nathapp/nestjs-auth@2.0.0-rc.0
387
-
388
- ## 1.0.0
389
-
390
- ### Patch Changes
391
-
392
- - 7e62204: fix two factor bug
393
- - 5370d3a: Add Two Factor Module & Two Factor Exception
394
- - 748e227: make otplib as optional
395
-
396
- ## 1.0.0-rc.3
397
-
398
- ### Patch Changes
399
-
400
- - 748e227: make otplib as optional
401
-
402
- ## 1.0.0-rc.2
403
-
404
- ### Patch Changes
405
-
406
- - 7e62204: fix two factor bug
407
-
408
- ## 1.0.0-rc.1
409
-
410
- ### Patch Changes
411
-
412
- - 5370d3a: Add Two Factor Module & Two Factor Exception