@anarchitects/auth-nest 2.0.0 → 3.0.0
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/README.md +9 -11
- package/package.json +3 -3
- package/src/auth.module.js +0 -4
- package/src/auth.module.js.map +1 -1
- package/src/config/auth.config.d.ts +4 -3
- package/src/config/auth.config.js +13 -7
- package/src/config/auth.config.js.map +1 -1
- package/src/config/module-options.d.ts +6 -8
- package/src/config/module-options.js +2 -6
- package/src/config/module-options.js.map +1 -1
- package/src/infrastructure-mailer/index.d.ts +1 -1
- package/src/infrastructure-mailer/mailer.module.js +8 -13
- package/src/infrastructure-mailer/mailer.module.js.map +1 -1
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@ NestJS services, controllers, and infrastructure for the Anarchitecture authenti
|
|
|
7
7
|
- **Application layer** – `JwtAuthService`, `BcryptHashService`, JWT Passport strategy, CASL-based `PoliciesService` and `AbilityFactory` encapsulating business rules for tokens, passwords, and fine-grained access control.
|
|
8
8
|
- **Presentation layer** – `AuthController` exposing REST handlers for the full auth lifecycle, `PoliciesGuard` and `@Policies()` decorator for route-level authorization.
|
|
9
9
|
- **Infrastructure persistence** – `PersistenceModule` with TypeORM entities and repositories (users, roles, permissions, invalidated tokens). Configurable adapters to swap implementations while preserving the application contract.
|
|
10
|
-
- **Infrastructure mailer** – `AuthMailerModule` wrapper over shared `
|
|
10
|
+
- **Infrastructure mailer** – `AuthMailerModule` wrapper over shared `CommonMailerModule.forRoot(...)` provider wiring; `NodeMailerAdapter` is re-exported for compatibility.
|
|
11
11
|
- **Config** – Typed `authConfig` namespace using `@nestjs/config` with an `InjectAuthConfig()` helper decorator.
|
|
12
12
|
|
|
13
13
|
## Installation
|
|
@@ -49,7 +49,7 @@ The library reads configuration through `@nestjs/config` using a namespaced `aut
|
|
|
49
49
|
| `AUTH_ENCRYPTION_ALGORITHM` | Password hashing algorithm (`bcrypt`). | `bcrypt` |
|
|
50
50
|
| `AUTH_ENCRYPTION_KEY` | Symmetric key for additional encryption needs. **Must** be overridden in production. | `default_encryption_key` |
|
|
51
51
|
| `AUTH_PERSISTENCE` | Persistence adapter key used by `forRootFromConfig(...)`. | `typeorm` |
|
|
52
|
-
| `
|
|
52
|
+
| `AUTH_MAILER_PROVIDER` | Domain mailer provider for `forRootFromConfig(...)` (`node` or `noop`). | `node` |
|
|
53
53
|
| `AUTH_STRATEGIES` | Comma-separated auth strategies for config-driven module composition. | `jwt` |
|
|
54
54
|
|
|
55
55
|
> **Security note:** The defaults for `AUTH_JWT_SECRET` and `AUTH_ENCRYPTION_KEY` are intentionally insecure placeholders. Always provide strong, unique values in any deployed environment.
|
|
@@ -113,9 +113,7 @@ import { authConfig } from '@anarchitects/auth-nest/config';
|
|
|
113
113
|
},
|
|
114
114
|
},
|
|
115
115
|
mailer: {
|
|
116
|
-
|
|
117
|
-
enabled: true,
|
|
118
|
-
},
|
|
116
|
+
provider: 'node',
|
|
119
117
|
},
|
|
120
118
|
}),
|
|
121
119
|
],
|
|
@@ -133,7 +131,7 @@ Disable domain mailer wiring when not needed:
|
|
|
133
131
|
```ts
|
|
134
132
|
AuthModule.forRoot({
|
|
135
133
|
presentation: { application: { ... } },
|
|
136
|
-
mailer: {
|
|
134
|
+
mailer: { provider: 'noop' },
|
|
137
135
|
});
|
|
138
136
|
```
|
|
139
137
|
|
|
@@ -174,7 +172,7 @@ import { AuthMailerModule } from '@anarchitects/auth-nest/infrastructure-mailer'
|
|
|
174
172
|
},
|
|
175
173
|
}),
|
|
176
174
|
AuthMailerModule.forRoot({
|
|
177
|
-
|
|
175
|
+
provider: 'node',
|
|
178
176
|
}),
|
|
179
177
|
],
|
|
180
178
|
})
|
|
@@ -185,11 +183,11 @@ Use layered composition when you need to replace or selectively compose infrastr
|
|
|
185
183
|
|
|
186
184
|
## Mailer Migration Note
|
|
187
185
|
|
|
188
|
-
`AuthMailerModule` is now adapter-only. It wraps
|
|
189
|
-
`@anarchitects/common-nest-mailer` and no longer configures transport with
|
|
186
|
+
`AuthMailerModule` is now adapter-only. It wraps shared `CommonMailerModule.forRoot(...)`
|
|
187
|
+
provider wiring from `@anarchitects/common-nest-mailer` and no longer configures transport with
|
|
190
188
|
`MailerModule.forRootAsync(...)`.
|
|
191
|
-
Configure transport once at app root with `CommonMailerModule
|
|
192
|
-
|
|
189
|
+
Configure transport once at app root with `CommonMailerModule`.
|
|
190
|
+
Set `mailer.provider: 'noop'` to disable active delivery behavior per domain.
|
|
193
191
|
The shared mailer DI contract (`MailerPort`) and concrete `NodeMailerAdapter` now live in
|
|
194
192
|
`@anarchitects/common-nest-mailer`.
|
|
195
193
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@anarchitects/auth-nest",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"main": "./src/index.js",
|
|
6
6
|
"types": "./src/index.d.ts",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"tslib": "^2.3.0",
|
|
9
9
|
"@nestjs/common": "^11.0.0",
|
|
10
10
|
"@nestjs/jwt": "^11.0.1",
|
|
11
|
-
"@anarchitects/auth-ts": "
|
|
11
|
+
"@anarchitects/auth-ts": "2.0.0",
|
|
12
12
|
"bcrypt": "^6.0.0",
|
|
13
13
|
"@nestjs/passport": "^11.0.5",
|
|
14
14
|
"passport-jwt": "^4.0.1",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"@nestjs/platform-fastify": "^11.1.6",
|
|
20
20
|
"@casl/ability": "^6.7.3",
|
|
21
21
|
"@nestjs/core": "^11.0.0",
|
|
22
|
-
"@anarchitects/common-nest-mailer": "
|
|
22
|
+
"@anarchitects/common-nest-mailer": "2.0.0"
|
|
23
23
|
},
|
|
24
24
|
"publishConfig": {
|
|
25
25
|
"access": "public"
|
package/src/auth.module.js
CHANGED
package/src/auth.module.js.map
CHANGED
|
@@ -1 +1 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W,EAAE;wBACX,GAAG,aAAa,CAAC,YAAY,EAAE,WAAW,EAAE,WAAW;wBACvD,GAAG,SAAS,CAAC,YAAY,EAAE,WAAW,EAAE,WAAW;qBACpD;iBACF;aACF;YACD,MAAM,EAAE;gBACN,GAAG,aAAa,CAAC,MAAM;gBACvB,GAAG,SAAS,CAAC,MAAM;aACpB;SACF,CAAC,CAAC;QAEH,OAAO;YACL,GAAG,gBAAgB;YACnB,OAAO,EAAE;gBACP,qBAAY,CAAC,UAAU,CAAC,mBAAU,CAAC;gBACnC,GAAG,CAAC,gBAAgB,CAAC,OAAO,IAAI,EAAE,CAAC;aACpC;SACF,CAAC;IACJ,CAAC;CACF,CAAA;AAhDY,gCAAU;qBAAV,UAAU;IADtB,IAAA,eAAM,EAAC,EAAE,CAAC;GACE,UAAU,CAgDtB"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ConfigType } from '@nestjs/config';
|
|
2
|
+
import type { CommonMailerProvider } from '@anarchitects/common-nest-mailer';
|
|
2
3
|
export declare const DEFAULT_AUTH_JWT_SECRET = "default_jwt_secret";
|
|
3
4
|
export declare const DEFAULT_AUTH_JWT_EXPIRATION = "3600s";
|
|
4
5
|
export declare const DEFAULT_AUTH_JWT_AUDIENCE = "your_audience";
|
|
@@ -6,7 +7,7 @@ export declare const DEFAULT_AUTH_JWT_ISSUER = "your_issuer";
|
|
|
6
7
|
export declare const DEFAULT_AUTH_ENCRYPTION_ALGORITHM = "bcrypt";
|
|
7
8
|
export declare const DEFAULT_AUTH_ENCRYPTION_KEY = "default_encryption_key";
|
|
8
9
|
export declare const DEFAULT_AUTH_PERSISTENCE = "typeorm";
|
|
9
|
-
export declare const
|
|
10
|
+
export declare const DEFAULT_AUTH_MAILER_PROVIDER = "node";
|
|
10
11
|
export declare const DEFAULT_AUTH_STRATEGIES: readonly ["jwt"];
|
|
11
12
|
export declare const authConfig: (() => {
|
|
12
13
|
jwtSecret: string;
|
|
@@ -16,7 +17,7 @@ export declare const authConfig: (() => {
|
|
|
16
17
|
encryptionAlgorithm: string;
|
|
17
18
|
encryptionKey: string;
|
|
18
19
|
persistence: string;
|
|
19
|
-
|
|
20
|
+
mailerProvider: CommonMailerProvider;
|
|
20
21
|
authStrategies: string[];
|
|
21
22
|
}) & import("@nestjs/config").ConfigFactoryKeyHost<{
|
|
22
23
|
jwtSecret: string;
|
|
@@ -26,7 +27,7 @@ export declare const authConfig: (() => {
|
|
|
26
27
|
encryptionAlgorithm: string;
|
|
27
28
|
encryptionKey: string;
|
|
28
29
|
persistence: string;
|
|
29
|
-
|
|
30
|
+
mailerProvider: CommonMailerProvider;
|
|
30
31
|
authStrategies: string[];
|
|
31
32
|
}>;
|
|
32
33
|
export type AuthConfig = ConfigType<typeof authConfig>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.InjectAuthConfig = exports.authConfig = exports.DEFAULT_AUTH_STRATEGIES = exports.
|
|
3
|
+
exports.InjectAuthConfig = exports.authConfig = exports.DEFAULT_AUTH_STRATEGIES = exports.DEFAULT_AUTH_MAILER_PROVIDER = exports.DEFAULT_AUTH_PERSISTENCE = exports.DEFAULT_AUTH_ENCRYPTION_KEY = exports.DEFAULT_AUTH_ENCRYPTION_ALGORITHM = exports.DEFAULT_AUTH_JWT_ISSUER = exports.DEFAULT_AUTH_JWT_AUDIENCE = exports.DEFAULT_AUTH_JWT_EXPIRATION = exports.DEFAULT_AUTH_JWT_SECRET = void 0;
|
|
4
4
|
const common_1 = require("@nestjs/common");
|
|
5
5
|
const config_1 = require("@nestjs/config");
|
|
6
6
|
const AUTH_CONFIG_KEY = 'auth';
|
|
@@ -11,14 +11,20 @@ exports.DEFAULT_AUTH_JWT_ISSUER = 'your_issuer';
|
|
|
11
11
|
exports.DEFAULT_AUTH_ENCRYPTION_ALGORITHM = 'bcrypt';
|
|
12
12
|
exports.DEFAULT_AUTH_ENCRYPTION_KEY = 'default_encryption_key';
|
|
13
13
|
exports.DEFAULT_AUTH_PERSISTENCE = 'typeorm';
|
|
14
|
-
exports.
|
|
14
|
+
exports.DEFAULT_AUTH_MAILER_PROVIDER = 'node';
|
|
15
15
|
exports.DEFAULT_AUTH_STRATEGIES = ['jwt'];
|
|
16
|
-
const
|
|
17
|
-
const value = process.env['
|
|
16
|
+
const parseMailerProvider = () => {
|
|
17
|
+
const value = process.env['AUTH_MAILER_PROVIDER'];
|
|
18
18
|
if (value === undefined) {
|
|
19
|
-
return exports.
|
|
19
|
+
return exports.DEFAULT_AUTH_MAILER_PROVIDER;
|
|
20
|
+
}
|
|
21
|
+
switch (value) {
|
|
22
|
+
case 'node':
|
|
23
|
+
case 'noop':
|
|
24
|
+
return value;
|
|
25
|
+
default:
|
|
26
|
+
throw new Error(`Unsupported mailer provider: ${value}`);
|
|
20
27
|
}
|
|
21
|
-
return value !== 'false';
|
|
22
28
|
};
|
|
23
29
|
const parseAuthStrategies = () => {
|
|
24
30
|
const raw = process.env['AUTH_STRATEGIES'];
|
|
@@ -40,7 +46,7 @@ exports.authConfig = (0, config_1.registerAs)(AUTH_CONFIG_KEY, () => ({
|
|
|
40
46
|
exports.DEFAULT_AUTH_ENCRYPTION_ALGORITHM,
|
|
41
47
|
encryptionKey: process.env['AUTH_ENCRYPTION_KEY'] ?? exports.DEFAULT_AUTH_ENCRYPTION_KEY,
|
|
42
48
|
persistence: process.env['AUTH_PERSISTENCE'] ?? exports.DEFAULT_AUTH_PERSISTENCE,
|
|
43
|
-
|
|
49
|
+
mailerProvider: parseMailerProvider(),
|
|
44
50
|
authStrategies: parseAuthStrategies(),
|
|
45
51
|
}));
|
|
46
52
|
const InjectAuthConfig = () => (0, common_1.Inject)(exports.authConfig.KEY);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.config.js","sourceRoot":"","sources":["../../../../../../libs/auth/nest/src/config/auth.config.ts"],"names":[],"mappings":";;;AAAA,2CAAwC;AACxC,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,CAAC,IAAI,EAAE,CAAC;SAClC,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAE7C,OAAO,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,+BAAuB,CAAC,CAAC;AACnE,CAAC,CAAC;AAEW,QAAA,UAAU,GAAG,IAAA,mBAAU,EAAC,eAAe,EAAE,GAAG,EAAE,CAAC,CAAC;IAC3D,SAAS,EAAE,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,IAAI,+BAAuB;IACpE,aAAa,EACX,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,IAAI,mCAA2B;IACnE,WAAW,EAAE,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,IAAI,iCAAyB;IAC1E,SAAS,EAAE,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,IAAI,+BAAuB;IACpE,mBAAmB,EACjB,OAAO,CAAC,GAAG,CAAC,2BAA2B,CAAC;QACxC,yCAAiC;IACnC,aAAa,EACX,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,IAAI,mCAA2B;IACnE,WAAW,EAAE,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,IAAI,gCAAwB;IACxE,cAAc,EAAE,mBAAmB,EAAE;IACrC,cAAc,EAAE,mBAAmB,EAAE;CACtC,CAAC,CAAC,CAAC;AAIG,MAAM,gBAAgB,GAAG,GAAG,EAAE,CAAC,IAAA,eAAM,EAAC,kBAAU,CAAC,GAAG,CAAC,CAAC;AAAhD,QAAA,gBAAgB,oBAAgC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { CommonMailerProvider } from '@anarchitects/common-nest-mailer';
|
|
1
2
|
import type { AuthConfig } from './auth.config';
|
|
2
3
|
export type AuthPersistenceModuleOptions = {
|
|
3
4
|
persistence?: string;
|
|
@@ -5,16 +6,11 @@ export type AuthPersistenceModuleOptions = {
|
|
|
5
6
|
export type ResolvedAuthPersistenceModuleOptions = {
|
|
6
7
|
persistence: string;
|
|
7
8
|
};
|
|
8
|
-
export type AuthMailerModuleFeatures = {
|
|
9
|
-
enabled?: boolean;
|
|
10
|
-
};
|
|
11
9
|
export type AuthMailerModuleOptions = {
|
|
12
|
-
|
|
10
|
+
provider?: CommonMailerProvider;
|
|
13
11
|
};
|
|
14
12
|
export type ResolvedAuthMailerModuleOptions = {
|
|
15
|
-
|
|
16
|
-
enabled: boolean;
|
|
17
|
-
};
|
|
13
|
+
provider: CommonMailerProvider;
|
|
18
14
|
};
|
|
19
15
|
export type AuthApplicationModuleOptions = {
|
|
20
16
|
authStrategies?: string[];
|
|
@@ -38,7 +34,9 @@ export type AuthPresentationModuleOptions = {
|
|
|
38
34
|
export type ResolvedAuthPresentationModuleOptions = {
|
|
39
35
|
application: ResolvedAuthApplicationModuleOptions;
|
|
40
36
|
};
|
|
41
|
-
export type AuthModuleFeatures =
|
|
37
|
+
export type AuthModuleFeatures = {
|
|
38
|
+
provider?: CommonMailerProvider;
|
|
39
|
+
};
|
|
42
40
|
export type AuthModuleOptions = {
|
|
43
41
|
presentation?: AuthPresentationModuleOptions;
|
|
44
42
|
mailer?: AuthMailerModuleOptions;
|
|
@@ -7,9 +7,7 @@ const resolveAuthPersistenceModuleOptions = (options = {}) => ({
|
|
|
7
7
|
});
|
|
8
8
|
exports.resolveAuthPersistenceModuleOptions = resolveAuthPersistenceModuleOptions;
|
|
9
9
|
const resolveAuthMailerModuleOptions = (options = {}) => ({
|
|
10
|
-
|
|
11
|
-
enabled: options.features?.enabled ?? auth_config_1.DEFAULT_AUTH_MAILER_ENABLED,
|
|
12
|
-
},
|
|
10
|
+
provider: options.provider ?? auth_config_1.DEFAULT_AUTH_MAILER_PROVIDER,
|
|
13
11
|
});
|
|
14
12
|
exports.resolveAuthMailerModuleOptions = resolveAuthMailerModuleOptions;
|
|
15
13
|
const resolveAuthApplicationModuleOptions = (options = {}) => ({
|
|
@@ -36,9 +34,7 @@ const mapAuthConfigToPersistenceModuleOptions = (config) => ({
|
|
|
36
34
|
});
|
|
37
35
|
exports.mapAuthConfigToPersistenceModuleOptions = mapAuthConfigToPersistenceModuleOptions;
|
|
38
36
|
const mapAuthConfigToMailerModuleOptions = (config) => ({
|
|
39
|
-
|
|
40
|
-
enabled: config.mailerEnabled ?? auth_config_1.DEFAULT_AUTH_MAILER_ENABLED,
|
|
41
|
-
},
|
|
37
|
+
provider: config.mailerProvider ?? auth_config_1.DEFAULT_AUTH_MAILER_PROVIDER,
|
|
42
38
|
});
|
|
43
39
|
exports.mapAuthConfigToMailerModuleOptions = mapAuthConfigToMailerModuleOptions;
|
|
44
40
|
const mapAuthConfigToApplicationModuleOptions = (config) => ({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module-options.js","sourceRoot":"","sources":["../../../../../../libs/auth/nest/src/config/module-options.ts"],"names":[],"mappings":";;;AAAA,+CAMuB;
|
|
1
|
+
{"version":3,"file":"module-options.js","sourceRoot":"","sources":["../../../../../../libs/auth/nest/src/config/module-options.ts"],"names":[],"mappings":";;;AAAA,+CAMuB;AA4DhB,MAAM,mCAAmC,GAAG,CACjD,UAAwC,EAAE,EACJ,EAAE,CAAC,CAAC;IAC1C,WAAW,EAAE,OAAO,CAAC,WAAW,IAAI,sCAAwB;CAC7D,CAAC,CAAC;AAJU,QAAA,mCAAmC,uCAI7C;AAEI,MAAM,8BAA8B,GAAG,CAC5C,UAAmC,EAAE,EACJ,EAAE,CAAC,CAAC;IACrC,QAAQ,EAAE,OAAO,CAAC,QAAQ,IAAI,0CAA4B;CAC3D,CAAC,CAAC;AAJU,QAAA,8BAA8B,kCAIxC;AAEI,MAAM,mCAAmC,GAAG,CACjD,UAAwC,EAAE,EACJ,EAAE,CAAC,CAAC;IAC1C,cAAc,EAAE,OAAO,CAAC,cAAc,IAAI,CAAC,GAAG,qCAAuB,CAAC;IACtE,UAA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;KACzD;IACD,WAAW,EAAE,IAAA,+CAAuC,EAAC,MAAM,CAAC;CAC7D,CAAC,CAAC;AATU,QAAA,uCAAuC,2CASjD;AAEI,MAAM,wCAAwC,GAAG,CACtD,MAAkB,EACa,EAAE,CAAC,CAAC;IACnC,WAAW,EAAE,IAAA,+CAAuC,EAAC,MAAM,CAAC;CAC7D,CAAC,CAAC;AAJU,QAAA,wCAAwC,4CAIlD;AAEI,MAAM,gCAAgC,GAAG,CAC9C,MAAkB,EACC,EAAE,CAAC,CAAC;IACvB,YAAY,EAAE,IAAA,gDAAwC,EAAC,MAAM,CAAC;IAC9D,MAAM,EAAE,IAAA,0CAAkC,EAAC,MAAM,CAAC;CACnD,CAAC,CAAC;AALU,QAAA,gCAAgC,oCAK1C"}
|
|
@@ -10,22 +10,20 @@ const config_2 = require("../config");
|
|
|
10
10
|
let AuthMailerModule = AuthMailerModule_1 = class AuthMailerModule {
|
|
11
11
|
static forRoot(options = {}) {
|
|
12
12
|
const resolvedOptions = (0, config_2.resolveAuthMailerModuleOptions)(options);
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
};
|
|
17
|
-
}
|
|
13
|
+
const commonMailerModule = common_nest_mailer_1.CommonMailerModule.forRoot({
|
|
14
|
+
provider: resolvedOptions.provider,
|
|
15
|
+
});
|
|
18
16
|
return {
|
|
19
17
|
module: AuthMailerModule_1,
|
|
18
|
+
imports: [commonMailerModule],
|
|
19
|
+
exports: [commonMailerModule],
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
22
|
static forRootFromConfig(overrides = {}) {
|
|
23
23
|
const configOptions = (0, config_2.mapAuthConfigToMailerModuleOptions)((0, config_2.authConfig)());
|
|
24
24
|
const moduleDefinition = this.forRoot({
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
...overrides.features,
|
|
28
|
-
},
|
|
25
|
+
...configOptions,
|
|
26
|
+
...overrides,
|
|
29
27
|
});
|
|
30
28
|
return {
|
|
31
29
|
...moduleDefinition,
|
|
@@ -39,9 +37,6 @@ let AuthMailerModule = AuthMailerModule_1 = class AuthMailerModule {
|
|
|
39
37
|
exports.AuthMailerModule = AuthMailerModule;
|
|
40
38
|
exports.AuthMailerModule = AuthMailerModule = AuthMailerModule_1 = tslib_1.__decorate([
|
|
41
39
|
(0, common_1.Global)(),
|
|
42
|
-
(0, common_1.Module)({
|
|
43
|
-
imports: [common_nest_mailer_1.CommonNodeMailerModule],
|
|
44
|
-
exports: [common_nest_mailer_1.CommonNodeMailerModule],
|
|
45
|
-
})
|
|
40
|
+
(0, common_1.Module)({})
|
|
46
41
|
], AuthMailerModule);
|
|
47
42
|
//# sourceMappingURL=mailer.module.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mailer.module.js","sourceRoot":"","sources":["../../../../../../libs/auth/nest/src/infrastructure-mailer/mailer.module.ts"],"names":[],"mappings":";;;;;AAAA,2CAA+D;AAC/D,2CAA8C;AAC9C,
|
|
1
|
+
{"version":3,"file":"mailer.module.js","sourceRoot":"","sources":["../../../../../../libs/auth/nest/src/infrastructure-mailer/mailer.module.ts"],"names":[],"mappings":";;;;;AAAA,2CAA+D;AAC/D,2CAA8C;AAC9C,yEAAsE;AACtE,sCAImB;AAKZ,IAAM,gBAAgB,wBAAtB,MAAM,gBAAgB;IAC3B,MAAM,CAAC,OAAO,CAAC,UAAmC,EAAE;QAClD,MAAM,eAAe,GAAG,IAAA,uCAA8B,EAAC,OAAO,CAAC,CAAC;QAChE,MAAM,kBAAkB,GAAG,uCAAkB,CAAC,OAAO,CAAC;YACpD,QAAQ,EAAE,eAAe,CAAC,QAAQ;SACnC,CAAC,CAAC;QAEH,OAAO;YACL,MAAM,EAAE,kBAAgB;YACxB,OAAO,EAAE,CAAC,kBAAkB,CAAC;YAC7B,OAAO,EAAE,CAAC,kBAAkB,CAAC;SAC9B,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,iBAAiB,CACtB,YAAqC,EAAE;QAEvC,MAAM,aAAa,GAAG,IAAA,2CAAkC,EAAC,IAAA,mBAAU,GAAE,CAAC,CAAC;QACvE,MAAM,gBAAgB,GAAG,IAAI,CAAC,OAAO,CAAC;YACpC,GAAG,aAAa;YAChB,GAAG,SAAS;SACb,CAAC,CAAC;QAEH,OAAO;YACL,GAAG,gBAAgB;YACnB,OAAO,EAAE;gBACP,qBAAY,CAAC,UAAU,CAAC,mBAAU,CAAC;gBACnC,GAAG,CAAC,gBAAgB,CAAC,OAAO,IAAI,EAAE,CAAC;aACpC;SACF,CAAC;IACJ,CAAC;CACF,CAAA;AA/BY,4CAAgB;2BAAhB,gBAAgB;IAF5B,IAAA,eAAM,GAAE;IACR,IAAA,eAAM,EAAC,EAAE,CAAC;GACE,gBAAgB,CA+B5B"}
|