mongodb-dynamic-api 2.13.0 → 2.14.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/CHANGELOG.md +7 -0
- package/package.json +1 -1
- package/src/modules/auth/auth.module.d.ts +4 -6
- package/src/modules/auth/auth.module.js +8 -4
- package/src/modules/auth/auth.module.js.map +1 -1
- package/src/modules/auth/interfaces/auth-options.interface.d.ts +4 -1
- package/src/version.json +1 -1
- package/tsconfig.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
Changelog
|
|
2
2
|
|
|
3
|
+
## [2.14.0](https://github.com/MikeDev75015/mongodb-dynamic-api/compare/v2.13.0...v2.14.0) (2025-10-23)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### authentication
|
|
7
|
+
|
|
8
|
+
* **authentication:** add the possibility to set extras imports/providers/controllers ([2fe2bb2](https://github.com/MikeDev75015/mongodb-dynamic-api/commit/2fe2bb2c8ae59acb418ca68775fbe4e3cb398df3))
|
|
9
|
+
|
|
3
10
|
## [2.13.0](https://github.com/MikeDev75015/mongodb-dynamic-api/compare/v2.12.0...v2.13.0) (2025-10-21)
|
|
4
11
|
|
|
5
12
|
|
package/package.json
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { BaseEntity } from '../../models';
|
|
2
|
-
import { BcryptService } from '../../services';
|
|
3
2
|
import { DynamicApiAuthOptions } from './interfaces';
|
|
4
|
-
import { JwtStrategy } from './strategies';
|
|
5
3
|
export declare class AuthModule {
|
|
6
|
-
static forRoot<Entity extends BaseEntity>(options: DynamicApiAuthOptions<Entity
|
|
4
|
+
static forRoot<Entity extends BaseEntity>(options: DynamicApiAuthOptions<Entity>): {
|
|
7
5
|
module: typeof AuthModule;
|
|
8
|
-
imports: any[];
|
|
9
|
-
providers: (
|
|
10
|
-
controllers: import("
|
|
6
|
+
imports: (import("@nestjs/common").Type<any> | import("@nestjs/common").DynamicModule | Promise<import("@nestjs/common").DynamicModule> | import("@nestjs/common").ForwardReference<any>)[];
|
|
7
|
+
providers: (import("../../interfaces/dynamic-api-service-provider.interface").DynamicAPIServiceProvider | import("@nestjs/common").Provider)[];
|
|
8
|
+
controllers: import("@nestjs/common").Type<any>[];
|
|
11
9
|
};
|
|
12
10
|
private static initializeAuthOptions;
|
|
13
11
|
}
|
|
@@ -18,8 +18,8 @@ const services_1 = require("../../services");
|
|
|
18
18
|
const auth_helper_1 = require("./auth.helper");
|
|
19
19
|
const strategies_1 = require("./strategies");
|
|
20
20
|
let AuthModule = AuthModule_1 = class AuthModule {
|
|
21
|
-
static forRoot(options
|
|
22
|
-
const { userEntity, login: { loginField, passwordField, ...login }, register, updateAccount, resetPassword, jwt: { secret, expiresIn }, validationPipeOptions, webSocket, } = this.initializeAuthOptions(options);
|
|
21
|
+
static forRoot(options) {
|
|
22
|
+
const { userEntity, login: { loginField, passwordField, ...login }, register, updateAccount, resetPassword, jwt: { secret, expiresIn }, validationPipeOptions, webSocket, extraImports, extraProviders, extraControllers, } = this.initializeAuthOptions(options);
|
|
23
23
|
const { resetPasswordCallback, ...resetPasswordOptionsRest } = resetPassword;
|
|
24
24
|
const resetPasswordOptions = resetPasswordCallback
|
|
25
25
|
? { resetPasswordCallback, ...resetPasswordOptionsRest }
|
|
@@ -63,11 +63,12 @@ let AuthModule = AuthModule_1 = class AuthModule {
|
|
|
63
63
|
strategies_1.JwtStrategy,
|
|
64
64
|
services_1.BcryptService,
|
|
65
65
|
...webSocketsProviders,
|
|
66
|
+
...extraProviders,
|
|
66
67
|
],
|
|
67
|
-
controllers: [AuthController],
|
|
68
|
+
controllers: [AuthController, ...extraControllers],
|
|
68
69
|
};
|
|
69
70
|
}
|
|
70
|
-
static initializeAuthOptions({ userEntity, jwt, login, register, updateAccount, resetPassword, validationPipeOptions, webSocket, }) {
|
|
71
|
+
static initializeAuthOptions({ userEntity, jwt, login, register, updateAccount, resetPassword, validationPipeOptions, webSocket, extraImports = [], extraProviders = [], extraControllers = [], }) {
|
|
71
72
|
return {
|
|
72
73
|
userEntity: userEntity,
|
|
73
74
|
jwt: {
|
|
@@ -96,6 +97,9 @@ let AuthModule = AuthModule_1 = class AuthModule {
|
|
|
96
97
|
},
|
|
97
98
|
validationPipeOptions: validationPipeOptions,
|
|
98
99
|
webSocket,
|
|
100
|
+
extraImports,
|
|
101
|
+
extraProviders,
|
|
102
|
+
extraControllers,
|
|
99
103
|
};
|
|
100
104
|
}
|
|
101
105
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.module.js","sourceRoot":"","sources":["../../../../libs/dynamic-api/src/modules/auth/auth.module.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,2CAAwC;AACxC,qCAAwC;AACxC,+CAAkD;AAClD,+CAAkD;AAClD,iEAA4D;AAC5D,2CAAmF;AAEnF,6CAA6E;AAC7E,+CAAyJ;AAEzJ,6CAA2C;AAGpC,IAAM,UAAU,kBAAhB,MAAM,UAAU;IACrB,MAAM,CAAC,OAAO,CACZ,OAAsC
|
|
1
|
+
{"version":3,"file":"auth.module.js","sourceRoot":"","sources":["../../../../libs/dynamic-api/src/modules/auth/auth.module.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,2CAAwC;AACxC,qCAAwC;AACxC,+CAAkD;AAClD,+CAAkD;AAClD,iEAA4D;AAC5D,2CAAmF;AAEnF,6CAA6E;AAC7E,+CAAyJ;AAEzJ,6CAA2C;AAGpC,IAAM,UAAU,kBAAhB,MAAM,UAAU;IACrB,MAAM,CAAC,OAAO,CACZ,OAAsC;QAEtC,MAAM,EACJ,UAAU,EACV,KAAK,EAAE,EACL,UAAU,EACV,aAAa,EACb,GAAG,KAAK,EACT,EACD,QAAQ,EACR,aAAa,EACb,aAAa,EACb,GAAG,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,EAC1B,qBAAqB,EACrB,SAAS,EACT,YAAY,EACZ,cAAc,EACd,gBAAgB,GACjB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ACD,QAAQ,EAAE;gBACR,GAAG,QAAQ;gBACX,gBAAgB,EAAE,QAAQ,EAAE,gBAAgB,IAAI,EAAE;gBAClD,SAAS,EAAE,QAAQ,EAAE,SAAS,IAAI,CAAC,CAAC,QAAQ,EAAE,gBAAgB;aAC/D;YACD,aAAa,EAAE;gBACb,GAAG,aAAa;gBAChB,yBAAyB,EAAE,aAAa,EAAE,yBAAyB,IAAI,EAAE;aAC1E;YACD,aAAa,EAAE;gBACb,GAAG,aAAa;gBAChB,UAAU,EAAE,CAAC,CAAC,aAAa,EAAE,UAAU,CAAC,CAAC,CAAC,OAAuB,CAAC,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;gBACrG,mBAAmB,EAAE,aAAa,EAAE,mBAAmB,IAAI,EAAE;aAC9D;YACD,qBAAqB,EAAE,qBAAqB;YAC5C,SAAS;YACT,YAAY;YACZ,cAAc;YACd,gBAAgB;SACjB,CAAC;IACJ,CAAC;CACF,CAAA;AA7JY,gCAAU;qBAAV,UAAU;IADtB,IAAA,eAAM,EAAC,EAAE,CAAC;GACE,UAAU,CA6JtB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NestInterceptor, Type, ValidationPipeOptions } from '@nestjs/common';
|
|
1
|
+
import { ModuleMetadata, NestInterceptor, Type, ValidationPipeOptions } from '@nestjs/common';
|
|
2
2
|
import { AuthAbilityPredicate, DynamicApiResetPasswordCallback, DynamicApiServiceBeforeSaveCallback, DynamicApiServiceCallback, DynamicApiWebSocketOptions } from '../../../interfaces';
|
|
3
3
|
import { BaseEntity } from '../../../models';
|
|
4
4
|
type DynamicApiJWTOptions = {
|
|
@@ -50,5 +50,8 @@ type DynamicApiAuthOptions<Entity extends BaseEntity = any> = {
|
|
|
50
50
|
resetPassword?: Partial<DynamicApiResetPasswordOptions<Entity>>;
|
|
51
51
|
validationPipeOptions?: ValidationPipeOptions;
|
|
52
52
|
webSocket?: DynamicApiWebSocketOptions;
|
|
53
|
+
extraImports?: ModuleMetadata['imports'];
|
|
54
|
+
extraProviders?: ModuleMetadata['providers'];
|
|
55
|
+
extraControllers?: ModuleMetadata['controllers'];
|
|
53
56
|
};
|
|
54
57
|
export type { DynamicApiAuthOptions, DynamicApiRegisterOptions, DynamicApiUpdateAccountOptions, DynamicApiJWTOptions, DynamicApiLoginOptions, DynamicApiResetPasswordOptions, };
|
package/src/version.json
CHANGED