mongodb-dynamic-api 2.12.0 → 2.13.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 +12 -0
- package/package.json +1 -1
- package/src/modules/auth/auth.helper.d.ts +1 -1
- package/src/modules/auth/auth.helper.js +2 -2
- package/src/modules/auth/auth.helper.js.map +1 -1
- package/src/modules/auth/auth.module.js +3 -11
- package/src/modules/auth/auth.module.js.map +1 -1
- package/src/modules/auth/interfaces/auth-options.interface.d.ts +6 -1
- package/src/modules/auth/mixins/auth-controller.mixin.d.ts +2 -2
- package/src/modules/auth/mixins/auth-controller.mixin.js +25 -20
- package/src/modules/auth/mixins/auth-controller.mixin.js.map +1 -1
- package/src/modules/auth/mixins/auth-gateway.mixin.d.ts +1 -1
- package/src/modules/auth/mixins/auth-gateway.mixin.js +6 -1
- package/src/modules/auth/mixins/auth-gateway.mixin.js.map +1 -1
- package/src/routes/aggregate/aggregate-controller.mixin.d.ts +1 -1
- package/src/routes/aggregate/aggregate-controller.mixin.js +2 -1
- package/src/routes/aggregate/aggregate-controller.mixin.js.map +1 -1
- package/src/routes/aggregate/aggregate-gateway.mixin.d.ts +1 -1
- package/src/routes/aggregate/aggregate-gateway.mixin.js +2 -1
- package/src/routes/aggregate/aggregate-gateway.mixin.js.map +1 -1
- package/src/routes/aggregate/aggregate.helper.d.ts +2 -2
- package/src/routes/aggregate/aggregate.helper.js +4 -3
- package/src/routes/aggregate/aggregate.helper.js.map +1 -1
- package/src/routes/aggregate/aggregate.module.d.ts +2 -2
- package/src/routes/aggregate/aggregate.module.js +4 -3
- package/src/routes/aggregate/aggregate.module.js.map +1 -1
- package/src/version.json +1 -1
- package/tsconfig.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
Changelog
|
|
2
2
|
|
|
3
|
+
## [2.13.0](https://github.com/MikeDev75015/mongodb-dynamic-api/compare/v2.12.0...v2.13.0) (2025-10-21)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### authentication
|
|
7
|
+
|
|
8
|
+
* **authentication:** add the possibility to use method interceptors ([00797af](https://github.com/MikeDev75015/mongodb-dynamic-api/commit/00797af79fdae84bac665cfe9cd81c316fbf6d55))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### aggregate
|
|
12
|
+
|
|
13
|
+
* **aggregate:** add the possibility to use class/method interceptors ([c0aadf7](https://github.com/MikeDev75015/mongodb-dynamic-api/commit/c0aadf734f4daf43180550663fddb360cc4642b9))
|
|
14
|
+
|
|
3
15
|
## [2.12.0](https://github.com/MikeDev75015/mongodb-dynamic-api/compare/v2.11.0...v2.12.0) (2025-10-19)
|
|
4
16
|
|
|
5
17
|
|
package/package.json
CHANGED
|
@@ -7,6 +7,6 @@ declare const authGatewayProviderName = "DynamicApiAuthGateway";
|
|
|
7
7
|
declare const localStrategyProviderName = "DynamicApiLocalStrategy";
|
|
8
8
|
declare function createLocalStrategyProvider<Entity extends BaseEntity>(loginField: keyof Entity, passwordField: keyof Entity, abilityPredicate: AuthAbilityPredicate | undefined): DynamicAPIServiceProvider;
|
|
9
9
|
declare function createAuthServiceProvider<Entity extends BaseEntity>(userEntity: Type<Entity>, { loginField, passwordField, additionalFields, callback: loginCallback }: DynamicApiLoginOptions<Entity>, registerCallback: DynamicApiServiceCallback<Entity> | undefined, resetPasswordOptions: DynamicApiResetPasswordOptions<Entity> | undefined, updateAccountCallback: DynamicApiServiceCallback<Entity> | undefined, beforeRegisterCallback: DynamicApiServiceBeforeSaveCallback<Entity> | undefined, beforeUpdateAccountCallback: DynamicApiServiceBeforeSaveCallback<Entity> | undefined): DynamicAPIServiceProvider;
|
|
10
|
-
declare function createAuthController<Entity extends BaseEntity>(userEntity: Type<Entity>,
|
|
10
|
+
declare function createAuthController<Entity extends BaseEntity>(userEntity: Type<Entity>, loginOptions: DynamicApiLoginOptions<Entity>, registerOptions: DynamicApiRegisterOptions<Entity> | undefined, validationPipeOptions: ValidationPipeOptions | undefined, resetPasswordOptions: DynamicApiResetPasswordOptions<Entity> | undefined, updateAccountOptions: DynamicApiUpdateAccountOptions<Entity> | undefined): AuthControllerConstructor<Entity>;
|
|
11
11
|
declare function createAuthGateway<Entity extends BaseEntity>(userEntity: Type<Entity>, loginOptions: DynamicApiLoginOptions<Entity>, registerOptions: DynamicApiRegisterOptions<Entity> | undefined, validationPipeOptions: ValidationPipeOptions | undefined, resetPasswordOptions: DynamicApiResetPasswordOptions<Entity> | undefined, updateAccountOptions: DynamicApiUpdateAccountOptions<Entity> | undefined, gatewayOptions: GatewayOptions): AuthGatewayConstructor<Entity>;
|
|
12
12
|
export { authServiceProviderName, authGatewayProviderName, createAuthController, createAuthServiceProvider, createAuthGateway, createLocalStrategyProvider, localStrategyProviderName, };
|
|
@@ -96,8 +96,8 @@ function createAuthServiceProvider(userEntity, { loginField, passwordField, addi
|
|
|
96
96
|
};
|
|
97
97
|
}
|
|
98
98
|
exports.createAuthServiceProvider = createAuthServiceProvider;
|
|
99
|
-
function createAuthController(userEntity,
|
|
100
|
-
let AuthController = class AuthController extends (0, mixins_1.AuthControllerMixin)(userEntity,
|
|
99
|
+
function createAuthController(userEntity, loginOptions, registerOptions, validationPipeOptions, resetPasswordOptions, updateAccountOptions) {
|
|
100
|
+
let AuthController = class AuthController extends (0, mixins_1.AuthControllerMixin)(userEntity, loginOptions, registerOptions, resetPasswordOptions, updateAccountOptions) {
|
|
101
101
|
constructor(service) {
|
|
102
102
|
super(service);
|
|
103
103
|
this.service = service;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.helper.js","sourceRoot":"","sources":["../../../../libs/dynamic-api/src/modules/auth/auth.helper.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAoJ;AACpJ,qCAAyC;AACzC,+CAA+C;AAC/C,+CAAoD;AACpD,6CAA0C;AAC1C,mDAAsD;AACtD,uCAAiC;AACjC,mDAA0C;AAC1C,iDA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HR,YAAO,GAAP,OAAO,CAAqB;YAC5B,eAAU,GAAV,UAAU,CAAY;QAG3C,CAAC;KACF,CAAA;IAdK,WAAW;QAHhB,IAAA,6BAAgB,EAAC,cAAc,CAAC;QAChC,IAAA,mBAAU,EAAC,IAAI,qCAA2B,EAAE,CAAC;QAC7C,IAAA,0BAAa,EAAC,qBAAqB,CAAC;QAShC,WAAA,IAAA,eAAM,EAAC,uBAAuB,CAAC,CAAA;iDAED,gBAAU;OAVvC,WAAW,CAchB;IAED,OAAO,WAAW,CAAC;AACrB,CAAC;AAOC,8CAAiB"}
|
|
@@ -20,16 +20,9 @@ const strategies_1 = require("./strategies");
|
|
|
20
20
|
let AuthModule = AuthModule_1 = class AuthModule {
|
|
21
21
|
static forRoot(options, extraImports = []) {
|
|
22
22
|
const { userEntity, login: { loginField, passwordField, ...login }, register, updateAccount, resetPassword, jwt: { secret, expiresIn }, validationPipeOptions, webSocket, } = this.initializeAuthOptions(options);
|
|
23
|
-
const {
|
|
23
|
+
const { resetPasswordCallback, ...resetPasswordOptionsRest } = resetPassword;
|
|
24
24
|
const resetPasswordOptions = resetPasswordCallback
|
|
25
|
-
? {
|
|
26
|
-
beforeChangePasswordCallback,
|
|
27
|
-
resetPasswordCallback,
|
|
28
|
-
changePasswordCallback,
|
|
29
|
-
emailField,
|
|
30
|
-
expirationInMinutes,
|
|
31
|
-
changePasswordAbilityPredicate: changePasswordAbilityPredicate,
|
|
32
|
-
}
|
|
25
|
+
? { resetPasswordCallback, ...resetPasswordOptionsRest }
|
|
33
26
|
: undefined;
|
|
34
27
|
const AuthController = (0, auth_helper_1.createAuthController)(userEntity, { loginField, passwordField, ...login }, register, validationPipeOptions, resetPasswordOptions, updateAccount);
|
|
35
28
|
const AuthServiceProvider = (0, auth_helper_1.createAuthServiceProvider)(userEntity, { loginField, passwordField, ...login }, register.callback, resetPasswordOptions, updateAccount.callback, register.beforeSaveCallback, updateAccount.beforeSaveCallback);
|
|
@@ -43,8 +36,7 @@ let AuthModule = AuthModule_1 = class AuthModule {
|
|
|
43
36
|
useClass: (0, auth_helper_1.createAuthGateway)(userEntity, {
|
|
44
37
|
loginField,
|
|
45
38
|
passwordField,
|
|
46
|
-
|
|
47
|
-
abilityPredicate: login.abilityPredicate,
|
|
39
|
+
...login,
|
|
48
40
|
}, register, validationPipeOptions, resetPasswordOptions, updateAccount, gatewayOptions),
|
|
49
41
|
},
|
|
50
42
|
];
|
|
@@ -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,EACtC,eAAsB,EAAE;QAExB,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,GACV,GAAG,IAAI,CAAC,qBAAqB,CAAS,OAAO,CAAC,CAAC;QAEhD,MAAM,
|
|
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,EACtC,eAAsB,EAA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,aAAa,IAAI,UAAU,CAAiB;gBACnE,gBAAgB,EAAE,KAAK,EAAE,gBAAgB,IAAI,EAAE;aAChD;YACD,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;SACV,CAAC;IACJ,CAAC;CACF,CAAA;AApJY,gCAAU;qBAAV,UAAU;IADtB,IAAA,eAAM,EAAC,EAAE,CAAC;GACE,UAAU,CAoJtB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Type, ValidationPipeOptions } from '@nestjs/common';
|
|
1
|
+
import { 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 = {
|
|
@@ -11,6 +11,7 @@ type DynamicApiLoginOptions<Entity extends BaseEntity = any> = {
|
|
|
11
11
|
callback?: DynamicApiServiceCallback<Entity>;
|
|
12
12
|
abilityPredicate?: AuthAbilityPredicate;
|
|
13
13
|
additionalFields?: (keyof Entity)[];
|
|
14
|
+
useInterceptors?: Type<NestInterceptor>[];
|
|
14
15
|
};
|
|
15
16
|
type DynamicApiRegisterOptions<Entity extends BaseEntity = any> = {
|
|
16
17
|
beforeSaveCallback?: DynamicApiServiceBeforeSaveCallback<Entity>;
|
|
@@ -21,20 +22,24 @@ type DynamicApiRegisterOptions<Entity extends BaseEntity = any> = {
|
|
|
21
22
|
name: keyof Entity;
|
|
22
23
|
required?: boolean;
|
|
23
24
|
})[];
|
|
25
|
+
useInterceptors?: Type<NestInterceptor>[];
|
|
24
26
|
};
|
|
25
27
|
type DynamicApiUpdateAccountOptions<Entity extends BaseEntity = any> = {
|
|
26
28
|
beforeSaveCallback?: DynamicApiServiceBeforeSaveCallback<Entity>;
|
|
27
29
|
callback?: DynamicApiServiceCallback<Entity>;
|
|
28
30
|
abilityPredicate?: AuthAbilityPredicate;
|
|
29
31
|
additionalFieldsToExclude?: (keyof Entity)[];
|
|
32
|
+
useInterceptors?: Type<NestInterceptor>[];
|
|
30
33
|
};
|
|
31
34
|
type DynamicApiResetPasswordOptions<Entity extends BaseEntity = any> = {
|
|
32
35
|
emailField?: keyof Entity | string;
|
|
33
36
|
expirationInMinutes?: number;
|
|
34
37
|
beforeChangePasswordCallback?: DynamicApiServiceBeforeSaveCallback<Entity>;
|
|
35
38
|
resetPasswordCallback?: DynamicApiResetPasswordCallback<Entity>;
|
|
39
|
+
resetPasswordUseInterceptors?: Type<NestInterceptor>[];
|
|
36
40
|
changePasswordCallback?: DynamicApiServiceCallback<Entity>;
|
|
37
41
|
changePasswordAbilityPredicate?: AuthAbilityPredicate;
|
|
42
|
+
changePasswordUseInterceptors?: Type<NestInterceptor>[];
|
|
38
43
|
};
|
|
39
44
|
type DynamicApiAuthOptions<Entity extends BaseEntity = any> = {
|
|
40
45
|
userEntity: Type<Entity>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Type } from '@nestjs/common';
|
|
2
2
|
import { BaseEntity } from '../../../models';
|
|
3
|
-
import { AuthControllerConstructor, DynamicApiRegisterOptions, DynamicApiResetPasswordOptions, DynamicApiUpdateAccountOptions } from '../interfaces';
|
|
4
|
-
declare function AuthControllerMixin<Entity extends BaseEntity>(userEntity: Type<Entity>, loginField:
|
|
3
|
+
import { AuthControllerConstructor, DynamicApiLoginOptions, DynamicApiRegisterOptions, DynamicApiResetPasswordOptions, DynamicApiUpdateAccountOptions } from '../interfaces';
|
|
4
|
+
declare function AuthControllerMixin<Entity extends BaseEntity>(userEntity: Type<Entity>, { loginField, passwordField, additionalFields: additionalRequestFields, useInterceptors: loginUseInterceptors, }: DynamicApiLoginOptions<Entity>, { additionalFields: additionalRegisterFields, protected: registerProtected, abilityPredicate: registerAbilityPredicate, useInterceptors: registerUseInterceptors, }?: DynamicApiRegisterOptions<Entity>, { resetPasswordUseInterceptors, changePasswordUseInterceptors, ...resetPasswordOptions }?: DynamicApiResetPasswordOptions<Entity>, { useInterceptors: updateAccountUseInterceptors, ...updateAccountOptions }?: DynamicApiUpdateAccountOptions<Entity>): AuthControllerConstructor<Entity>;
|
|
5
5
|
export { AuthControllerMixin };
|
|
@@ -23,7 +23,7 @@ const change_password_dto_1 = require("../dtos/change-password.dto");
|
|
|
23
23
|
const reset_password_dto_1 = require("../dtos/reset-password.dto");
|
|
24
24
|
const guards_1 = require("../guards");
|
|
25
25
|
const auth_policies_guard_mixin_1 = require("./auth-policies-guard.mixin");
|
|
26
|
-
function AuthControllerMixin(userEntity, loginField, passwordField, additionalRequestFields = [], { additionalFields: additionalRegisterFields, protected: registerProtected, abilityPredicate: registerAbilityPredicate, } = {}, resetPasswordOptions = {}, updateAccountOptions = {}) {
|
|
26
|
+
function AuthControllerMixin(userEntity, { loginField, passwordField, additionalFields: additionalRequestFields = [], useInterceptors: loginUseInterceptors = [], }, { additionalFields: additionalRegisterFields, protected: registerProtected, abilityPredicate: registerAbilityPredicate, useInterceptors: registerUseInterceptors = [], } = {}, { resetPasswordUseInterceptors = [], changePasswordUseInterceptors = [], ...resetPasswordOptions } = {}, { useInterceptors: updateAccountUseInterceptors = [], ...updateAccountOptions } = {}) {
|
|
27
27
|
var _a;
|
|
28
28
|
if (!loginField || !passwordField) {
|
|
29
29
|
throw new Error('Login and password fields are required');
|
|
@@ -86,8 +86,8 @@ function AuthControllerMixin(userEntity, loginField, passwordField, additionalRe
|
|
|
86
86
|
getAccount(req) {
|
|
87
87
|
return this.service.getAccount(req.user);
|
|
88
88
|
}
|
|
89
|
-
|
|
90
|
-
return this.service.
|
|
89
|
+
changePassword({ resetPasswordToken, newPassword }) {
|
|
90
|
+
return this.service.changePassword(resetPasswordToken, newPassword);
|
|
91
91
|
}
|
|
92
92
|
login(req, _) {
|
|
93
93
|
return this.service.login(req.user);
|
|
@@ -98,8 +98,8 @@ function AuthControllerMixin(userEntity, loginField, passwordField, additionalRe
|
|
|
98
98
|
resetPassword({ email }) {
|
|
99
99
|
return this.service.resetPassword(email);
|
|
100
100
|
}
|
|
101
|
-
|
|
102
|
-
return this.service.
|
|
101
|
+
updateAccount(req, body) {
|
|
102
|
+
return this.service.updateAccount(req.user, body);
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
__decorate([
|
|
@@ -114,21 +114,22 @@ function AuthControllerMixin(userEntity, loginField, passwordField, additionalRe
|
|
|
114
114
|
__metadata("design:returntype", void 0)
|
|
115
115
|
], BaseAuthController.prototype, "getAccount", null);
|
|
116
116
|
__decorate([
|
|
117
|
-
(0,
|
|
118
|
-
(0, common_1.
|
|
119
|
-
(0,
|
|
120
|
-
(0, common_1.
|
|
121
|
-
|
|
122
|
-
__param(
|
|
117
|
+
(0, decorators_1.ApiEndpointVisibility)(!!resetPasswordOptions, (0, decorators_1.Public)()),
|
|
118
|
+
(0, common_1.UseGuards)(new guards_1.ResetPasswordGuard(!!resetPasswordOptions.emailField)),
|
|
119
|
+
(0, common_1.HttpCode)(common_1.HttpStatus.NO_CONTENT),
|
|
120
|
+
(0, common_1.UseInterceptors)(...changePasswordUseInterceptors),
|
|
121
|
+
(0, common_1.Patch)('change-password'),
|
|
122
|
+
__param(0, (0, common_1.Body)()),
|
|
123
123
|
__metadata("design:type", Function),
|
|
124
|
-
__metadata("design:paramtypes", [
|
|
124
|
+
__metadata("design:paramtypes", [change_password_dto_1.ChangePasswordDto]),
|
|
125
125
|
__metadata("design:returntype", void 0)
|
|
126
|
-
], BaseAuthController.prototype, "
|
|
126
|
+
], BaseAuthController.prototype, "changePassword", null);
|
|
127
127
|
__decorate([
|
|
128
128
|
(0, decorators_1.Public)(),
|
|
129
129
|
(0, common_1.UseGuards)(guards_1.LocalAuthGuard),
|
|
130
130
|
(0, common_1.HttpCode)(common_1.HttpStatus.OK),
|
|
131
131
|
(0, swagger_1.ApiOkResponse)({ type: AuthPresenter }),
|
|
132
|
+
(0, common_1.UseInterceptors)(...loginUseInterceptors),
|
|
132
133
|
(0, common_1.Post)('login'),
|
|
133
134
|
__param(0, (0, common_1.Request)()),
|
|
134
135
|
__param(1, (0, common_1.Body)()),
|
|
@@ -140,6 +141,7 @@ function AuthControllerMixin(userEntity, loginField, passwordField, additionalRe
|
|
|
140
141
|
(0, helpers_1.RouteDecoratorsHelper)(authRegisterDecorators),
|
|
141
142
|
(0, common_1.HttpCode)(common_1.HttpStatus.CREATED),
|
|
142
143
|
(0, swagger_1.ApiCreatedResponse)({ type: AuthPresenter }),
|
|
144
|
+
(0, common_1.UseInterceptors)(...registerUseInterceptors),
|
|
143
145
|
(0, common_1.Post)('register'),
|
|
144
146
|
__param(0, (0, common_1.Body)()),
|
|
145
147
|
__metadata("design:type", Function),
|
|
@@ -150,6 +152,7 @@ function AuthControllerMixin(userEntity, loginField, passwordField, additionalRe
|
|
|
150
152
|
(0, decorators_1.ApiEndpointVisibility)(!!resetPasswordOptions, (0, decorators_1.Public)()),
|
|
151
153
|
(0, common_1.UseGuards)(new guards_1.ResetPasswordGuard(!!resetPasswordOptions.emailField)),
|
|
152
154
|
(0, common_1.HttpCode)(common_1.HttpStatus.NO_CONTENT),
|
|
155
|
+
(0, common_1.UseInterceptors)(...resetPasswordUseInterceptors),
|
|
153
156
|
(0, common_1.Post)('reset-password'),
|
|
154
157
|
__param(0, (0, common_1.Body)()),
|
|
155
158
|
__metadata("design:type", Function),
|
|
@@ -157,15 +160,17 @@ function AuthControllerMixin(userEntity, loginField, passwordField, additionalRe
|
|
|
157
160
|
__metadata("design:returntype", void 0)
|
|
158
161
|
], BaseAuthController.prototype, "resetPassword", null);
|
|
159
162
|
__decorate([
|
|
160
|
-
(0,
|
|
161
|
-
(0, common_1.
|
|
162
|
-
(0,
|
|
163
|
-
(0, common_1.
|
|
164
|
-
|
|
163
|
+
(0, helpers_1.RouteDecoratorsHelper)(authUpdateAccountDecorators),
|
|
164
|
+
(0, common_1.HttpCode)(common_1.HttpStatus.OK),
|
|
165
|
+
(0, swagger_1.ApiOkResponse)({ type: AuthUserPresenter }),
|
|
166
|
+
(0, common_1.UseInterceptors)(...updateAccountUseInterceptors),
|
|
167
|
+
(0, common_1.Patch)('account'),
|
|
168
|
+
__param(0, (0, common_1.Request)()),
|
|
169
|
+
__param(1, (0, common_1.Body)()),
|
|
165
170
|
__metadata("design:type", Function),
|
|
166
|
-
__metadata("design:paramtypes", [
|
|
171
|
+
__metadata("design:paramtypes", [Object, AuthUpdateAccountDto]),
|
|
167
172
|
__metadata("design:returntype", void 0)
|
|
168
|
-
], BaseAuthController.prototype, "
|
|
173
|
+
], BaseAuthController.prototype, "updateAccount", null);
|
|
169
174
|
return BaseAuthController;
|
|
170
175
|
}
|
|
171
176
|
exports.AuthControllerMixin = AuthControllerMixin;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth-controller.mixin.js","sourceRoot":"","sources":["../../../../../libs/dynamic-api/src/modules/auth/mixins/auth-controller.mixin.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"auth-controller.mixin.js","sourceRoot":"","sources":["../../../../../libs/dynamic-api/src/modules/auth/mixins/auth-controller.mix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oBAAoB,CAAC,UAAU,CAAC,CAAC;QACpE,IAAA,iBAAQ,EAAC,mBAAU,CAAC,UAAU,CAAC;QAC/B,IAAA,wBAAe,EAAC,GAAG,4BAA4B,CAAC;QAChD,IAAA,aAAI,EAAC,gBAAgB,CAAC;QACR,WAAA,IAAA,aAAI,GAAE,CAAA;;yCAAY,qCAAgB;;2DAEhD;IAOD;QALC,IAAA,+BAAqB,EAAC,2BAA2B,CAAC;QAClD,IAAA,iBAAQ,EAAC,mBAAU,CAAC,EAAE,CAAC;QACvB,IAAA,uBAAa,EAAC,EAAE,IAAI,EAAE,iBAAiB,EAAE,CAAC;QAC1C,IAAA,wBAAe,EAAC,GAAG,4BAA4B,CAAC;QAChD,IAAA,cAAK,EAAC,SAAS,CAAC;QAEd,WAAA,IAAA,gBAAO,GAAE,CAAA;QACT,WAAA,IAAA,aAAI,GAAE,CAAA;;iDAAO,oBAAoB;;2DAGnC;IAGH,OAAO,kBAAkB,CAAC;AAC5B,CAAC;AAEQ,kDAAmB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Type } from '@nestjs/common';
|
|
2
2
|
import { BaseEntity } from '../../../models';
|
|
3
3
|
import { AuthGatewayConstructor, DynamicApiLoginOptions, DynamicApiRegisterOptions, DynamicApiResetPasswordOptions, DynamicApiUpdateAccountOptions } from '../interfaces';
|
|
4
|
-
declare function AuthGatewayMixin<Entity extends BaseEntity>(userEntity: Type<Entity>, { loginField, passwordField, abilityPredicate: loginAbilityPredicate, }: DynamicApiLoginOptions<Entity>, { additionalFields: additionalSocketRegisterFields, protected: registerProtected, abilityPredicate: registerAbilityPredicate, }?: DynamicApiRegisterOptions<Entity>, resetPasswordOptions?: DynamicApiResetPasswordOptions<Entity>, updateAccountOptions?: DynamicApiUpdateAccountOptions<Entity>): AuthGatewayConstructor<Entity>;
|
|
4
|
+
declare function AuthGatewayMixin<Entity extends BaseEntity>(userEntity: Type<Entity>, { loginField, passwordField, abilityPredicate: loginAbilityPredicate, useInterceptors: loginUseInterceptors, }: DynamicApiLoginOptions<Entity>, { additionalFields: additionalSocketRegisterFields, protected: registerProtected, abilityPredicate: registerAbilityPredicate, useInterceptors: registerUseInterceptors, }?: DynamicApiRegisterOptions<Entity>, { resetPasswordUseInterceptors, changePasswordUseInterceptors, ...resetPasswordOptions }?: DynamicApiResetPasswordOptions<Entity>, { useInterceptors: updateAccountUseInterceptors, ...updateAccountOptions }?: DynamicApiUpdateAccountOptions<Entity>): AuthGatewayConstructor<Entity>;
|
|
5
5
|
export { AuthGatewayMixin };
|
|
@@ -24,7 +24,7 @@ const change_password_dto_1 = require("../dtos/change-password.dto");
|
|
|
24
24
|
const reset_password_dto_1 = require("../dtos/reset-password.dto");
|
|
25
25
|
const guards_1 = require("../guards");
|
|
26
26
|
const auth_policies_guard_mixin_1 = require("./auth-policies-guard.mixin");
|
|
27
|
-
function AuthGatewayMixin(userEntity, { loginField, passwordField, abilityPredicate: loginAbilityPredicate, }, { additionalFields: additionalSocketRegisterFields, protected: registerProtected, abilityPredicate: registerAbilityPredicate, } = {}, resetPasswordOptions = {}, updateAccountOptions = {}) {
|
|
27
|
+
function AuthGatewayMixin(userEntity, { loginField, passwordField, abilityPredicate: loginAbilityPredicate, useInterceptors: loginUseInterceptors = [], }, { additionalFields: additionalSocketRegisterFields, protected: registerProtected, abilityPredicate: registerAbilityPredicate, useInterceptors: registerUseInterceptors = [], } = {}, { resetPasswordUseInterceptors = [], changePasswordUseInterceptors = [], ...resetPasswordOptions } = {}, { useInterceptors: updateAccountUseInterceptors = [], ...updateAccountOptions } = {}) {
|
|
28
28
|
var _a;
|
|
29
29
|
class AuthSocketBodyPasswordFieldDto extends (0, swagger_1.PickType)(userEntity, [passwordField]) {
|
|
30
30
|
}
|
|
@@ -142,6 +142,7 @@ function AuthGatewayMixin(userEntity, { loginField, passwordField, abilityPredic
|
|
|
142
142
|
], BaseAuthGateway.prototype, "getAccount", null);
|
|
143
143
|
__decorate([
|
|
144
144
|
(0, common_1.UseGuards)(new guards_1.JwtSocketAuthGuard(), new AuthUpdateAccountPoliciesGuard()),
|
|
145
|
+
(0, common_1.UseInterceptors)(...updateAccountUseInterceptors),
|
|
145
146
|
(0, websockets_1.SubscribeMessage)(updateAccountEvent),
|
|
146
147
|
__param(0, (0, websockets_1.ConnectedSocket)()),
|
|
147
148
|
__param(1, (0, websockets_1.MessageBody)()),
|
|
@@ -150,6 +151,7 @@ function AuthGatewayMixin(userEntity, { loginField, passwordField, abilityPredic
|
|
|
150
151
|
__metadata("design:returntype", Promise)
|
|
151
152
|
], BaseAuthGateway.prototype, "updateAccount", null);
|
|
152
153
|
__decorate([
|
|
154
|
+
(0, common_1.UseInterceptors)(...loginUseInterceptors),
|
|
153
155
|
(0, websockets_1.SubscribeMessage)(loginEvent),
|
|
154
156
|
__param(0, (0, websockets_1.ConnectedSocket)()),
|
|
155
157
|
__param(1, (0, websockets_1.MessageBody)()),
|
|
@@ -159,6 +161,7 @@ function AuthGatewayMixin(userEntity, { loginField, passwordField, abilityPredic
|
|
|
159
161
|
], BaseAuthGateway.prototype, "login", null);
|
|
160
162
|
__decorate([
|
|
161
163
|
(0, common_1.UseGuards)(new AuthRegisterPoliciesGuard()),
|
|
164
|
+
(0, common_1.UseInterceptors)(...registerUseInterceptors),
|
|
162
165
|
(0, websockets_1.SubscribeMessage)(registerEvent),
|
|
163
166
|
__param(0, (0, websockets_1.ConnectedSocket)()),
|
|
164
167
|
__param(1, (0, websockets_1.MessageBody)()),
|
|
@@ -168,6 +171,7 @@ function AuthGatewayMixin(userEntity, { loginField, passwordField, abilityPredic
|
|
|
168
171
|
], BaseAuthGateway.prototype, "register", null);
|
|
169
172
|
__decorate([
|
|
170
173
|
(0, common_1.UseGuards)(new guards_1.ResetPasswordGuard((0, helpers_1.isNotEmptyObject)(resetPasswordOptions))),
|
|
174
|
+
(0, common_1.UseInterceptors)(...resetPasswordUseInterceptors),
|
|
171
175
|
(0, websockets_1.SubscribeMessage)(resetPasswordEvent),
|
|
172
176
|
__param(0, (0, websockets_1.MessageBody)()),
|
|
173
177
|
__metadata("design:type", Function),
|
|
@@ -176,6 +180,7 @@ function AuthGatewayMixin(userEntity, { loginField, passwordField, abilityPredic
|
|
|
176
180
|
], BaseAuthGateway.prototype, "resetPassword", null);
|
|
177
181
|
__decorate([
|
|
178
182
|
(0, common_1.UseGuards)(new guards_1.ResetPasswordGuard((0, helpers_1.isNotEmptyObject)(resetPasswordOptions))),
|
|
183
|
+
(0, common_1.UseInterceptors)(...changePasswordUseInterceptors),
|
|
179
184
|
(0, websockets_1.SubscribeMessage)(changePasswordEvent),
|
|
180
185
|
__param(0, (0, websockets_1.MessageBody)()),
|
|
181
186
|
__metadata("design:type", Function),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth-gateway.mixin.js","sourceRoot":"","sources":["../../../../../libs/dynamic-api/src/modules/auth/mixins/auth-gateway.mixin.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"auth-gateway.mixin.js","sourceRoot":"","sources":["../../../../../libs/dynamic-api/src/modules/auth/mixins/auth-gateway.mixin.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAkE;AAElE,6CAAuF;AACvF,mDAAiG;AACjG,mCAAiC;AACjC,gDAAgD;AAChD,8CAAoD;AAEpD,4CAAkD;AAElD,qEAAgE;AAChE,mEAA8D;AAC9D,sCAAmE;AAEnE,2EAA2E;AAE3E,SAAS,gBAAgB,CACvB,UAAwB,EACxB,EACE,UAAU,EACV,aAAa,EACb,gBAAgB,EAAE,qBAAqB,EACvC,eAAe,EAAE,oBAAoB,GAAG,EAAE,GACX,EACjC,EACE,gBAAgB,EAAE,8BAA8B,EAChD,SAAS,EAAE,iBAAiB,EAC5B,gBAAgB,EAAE,wBAAwB,EAC1C,eAAe,EAAE,uBAAuB,GAAG,EAAE,MACR,EAAE,EACzC,EACE,4BAA4B,GAAG,EAAE,EACjC,6BAA6B,GAAG,EAA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GAAG,uBAAuB,CAAC;QAC3C,IAAA,6BAAgB,EAAC,aAAa,CAAC;QAE7B,WAAA,IAAA,4BAAe,GAAE,CAAA;QACjB,WAAA,IAAA,wBAAW,GAAE,CAAA;;iDAAO,qBAAqB;;mDAQ3C;IAKK;QAHL,IAAA,kBAAS,EAAC,IAAI,2BAAkB,CAAC,IAAA,0BAAgB,EAAC,oBAAoB,CAAC,CAAC,CAAC;QACzE,IAAA,wBAAe,EAAC,GAAG,4BAA4B,CAAC;QAChD,IAAA,6BAAgB,EAAC,kBAAkB,CAAC;QAChB,WAAA,IAAA,wBAAW,GAAE,CAAA;;yCAAY,qCAAgB;;wDAS7D;IAKK;QAHL,IAAA,kBAAS,EAAC,IAAI,2BAAkB,CAAC,IAAA,0BAAgB,EAAC,oBAAoB,CAAC,CAAC,CAAC;QACzE,IAAA,wBAAe,EAAC,GAAG,6BAA6B,CAAC;QACjD,IAAA,6BAAgB,EAAC,mBAAmB,CAAC;QAChB,WAAA,IAAA,wBAAW,GAAE,CAAA;;yCAAsC,uCAAiB;;yDASzF;IAGH,OAAO,eAAe,CAAC;AACzB,CAAC;AAEQ,4CAAgB"}
|
|
@@ -2,5 +2,5 @@ import { Type } from '@nestjs/common';
|
|
|
2
2
|
import { DynamicApiControllerOptions, DynamicAPIRouteConfig } from '../../interfaces';
|
|
3
3
|
import { BaseEntity } from '../../models';
|
|
4
4
|
import { AggregateControllerConstructor } from './aggregate-controller.interface';
|
|
5
|
-
declare function AggregateControllerMixin<Entity extends BaseEntity>(entity: Type<Entity>, controllerOptions: DynamicApiControllerOptions<Entity>, { dTOs, isArrayResponse, ...routeConfig }: DynamicAPIRouteConfig<Entity>, version?: string): AggregateControllerConstructor<Entity>;
|
|
5
|
+
declare function AggregateControllerMixin<Entity extends BaseEntity>(entity: Type<Entity>, controllerOptions: DynamicApiControllerOptions<Entity>, { dTOs, useInterceptors, isArrayResponse, ...routeConfig }: DynamicAPIRouteConfig<Entity>, version?: string): AggregateControllerConstructor<Entity>;
|
|
6
6
|
export { AggregateControllerMixin };
|
|
@@ -19,7 +19,7 @@ const builders_1 = require("../../builders");
|
|
|
19
19
|
const helpers_1 = require("../../helpers");
|
|
20
20
|
const mixins_1 = require("../../mixins");
|
|
21
21
|
const aggregate_presenter_mixin_1 = require("./aggregate-presenter.mixin");
|
|
22
|
-
function AggregateControllerMixin(entity, controllerOptions, { dTOs, isArrayResponse, ...routeConfig }, version) {
|
|
22
|
+
function AggregateControllerMixin(entity, controllerOptions, { dTOs, useInterceptors = [], isArrayResponse, ...routeConfig }, version) {
|
|
23
23
|
const { routeType, displayedName, description, isPublic, abilityPredicate, } = (0, helpers_1.getMixinData)(entity, controllerOptions, routeConfig);
|
|
24
24
|
if (!dTOs?.query) {
|
|
25
25
|
throw new common_1.BadRequestException('Query DTO is required');
|
|
@@ -66,6 +66,7 @@ function AggregateControllerMixin(entity, controllerOptions, { dTOs, isArrayResp
|
|
|
66
66
|
__decorate([
|
|
67
67
|
(0, helpers_1.RouteDecoratorsHelper)(routeDecoratorsBuilder),
|
|
68
68
|
(0, common_1.UseGuards)(AggregatePoliciesGuard),
|
|
69
|
+
(0, common_1.UseInterceptors)(...useInterceptors),
|
|
69
70
|
__param(0, (0, common_1.Query)()),
|
|
70
71
|
__metadata("design:type", Function),
|
|
71
72
|
__metadata("design:paramtypes", [AggregateQuery]),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aggregate-controller.mixin.js","sourceRoot":"","sources":["../../../../libs/dynamic-api/src/routes/aggregate/aggregate-controller.mixin.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"aggregate-controller.mixin.js","sourceRoot":"","sources":["../../../../libs/dynamic-api/src/routes/aggregate/aggregate-controller.mixin.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA8F;AAC9F,yDAAoD;AACpD,6CAAwD;AACxD,2CAAmG;AAEnG,yCAAuD;AAGvD,2EAAsE;AAGtE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qBAAW,EAAC,WAAW,EAAE,aAAa,EAAE,OAAO,EAAE,YAAY,CAAC,EAAE;QAC9E,QAAQ,EAAE,KAAK;KAChB,CAAC,CAAC;IAEH,OAAO,uBAAuB,CAAC;AACjC,CAAC;AAEQ,4DAAwB"}
|
|
@@ -2,5 +2,5 @@ import { Type } from '@nestjs/common';
|
|
|
2
2
|
import { DynamicApiControllerOptions, DynamicAPIRouteConfig } from '../../interfaces';
|
|
3
3
|
import { BaseEntity } from '../../models';
|
|
4
4
|
import { AggregateGatewayConstructor } from './aggregate-gateway.interface';
|
|
5
|
-
declare function AggregateGatewayMixin<Entity extends BaseEntity>(entity: Type<Entity>, controllerOptions: DynamicApiControllerOptions<Entity>, { dTOs, ...routeConfig }: DynamicAPIRouteConfig<Entity>, version?: string): AggregateGatewayConstructor<Entity>;
|
|
5
|
+
declare function AggregateGatewayMixin<Entity extends BaseEntity>(entity: Type<Entity>, controllerOptions: DynamicApiControllerOptions<Entity>, { dTOs, useInterceptors, ...routeConfig }: DynamicAPIRouteConfig<Entity>, version?: string): AggregateGatewayConstructor<Entity>;
|
|
6
6
|
export { AggregateGatewayMixin };
|
|
@@ -22,7 +22,7 @@ const guards_1 = require("../../guards");
|
|
|
22
22
|
const helpers_1 = require("../../helpers");
|
|
23
23
|
const mixins_1 = require("../../mixins");
|
|
24
24
|
const aggregate_presenter_mixin_1 = require("./aggregate-presenter.mixin");
|
|
25
|
-
function AggregateGatewayMixin(entity, controllerOptions, { dTOs, ...routeConfig }, version) {
|
|
25
|
+
function AggregateGatewayMixin(entity, controllerOptions, { dTOs, useInterceptors = [], ...routeConfig }, version) {
|
|
26
26
|
const { routeType, displayedName, isPublic, event, abilityPredicate, } = (0, helpers_1.getMixinData)(entity, controllerOptions, routeConfig, true);
|
|
27
27
|
if (!dTOs?.query) {
|
|
28
28
|
throw new websockets_1.WsException('Query DTO is required');
|
|
@@ -66,6 +66,7 @@ function AggregateGatewayMixin(entity, controllerOptions, { dTOs, ...routeConfig
|
|
|
66
66
|
__decorate([
|
|
67
67
|
(0, common_1.UseFilters)(new filters_1.DynamicAPIWsExceptionFilter()),
|
|
68
68
|
(0, common_1.UseGuards)(new guards_1.JwtSocketGuard(isPublic), AggregatePoliciesGuard),
|
|
69
|
+
(0, common_1.UseInterceptors)(...useInterceptors),
|
|
69
70
|
(0, websockets_1.SubscribeMessage)(event),
|
|
70
71
|
__param(0, (0, websockets_1.ConnectedSocket)()),
|
|
71
72
|
__param(1, (0, websockets_1.MessageBody)()),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aggregate-gateway.mixin.js","sourceRoot":"","sources":["../../../../libs/dynamic-api/src/routes/aggregate/aggregate-gateway.mixin.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"aggregate-gateway.mixin.js","sourceRoot":"","sources":["../../../../libs/dynamic-api/src/routes/aggregate/aggregate-gateway.mixin.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA8E;AAE9E,mDAAiG;AACjG,yDAAoD;AACpD,2CAA4D;AAC5D,6CAA6C;AAC7C,yCAA8C;AAC9C,2CAA4E;AAS5E,yCAAwD;AAGxD,2EAAsE;AAGtE,SAAS,qBAAqB,CAC5B,MAAoB,EACpB,iBAAsD,EACtD,EAAE,IAAI,EAAE,eAAe,GAAG,EAAE,EAAE,GAAG,WAAW,EAAiC,EAC7E,OAAgB;IAEhB,MAAM,EACJ,SAAS,EACT,aAAa,EACb,QAAQ,EACR,KAAK,EACL,gBAAgB,GACjB,GAAG,IAAA,sBAAY,EACd,MAAM,EACN,iBAAiB,EACjB,WAAW,EACX,IAAI,CACL,CAAC;IAEF,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC;QACjB,MAAM,IAAI,wBAAW,CAAC,uBAAuB,CAAC,CAAC;IACjD,CAAC;IAED,MAAM,aAAc,SAAQ,IAAI,CAAC,KAAK;KAAG;IAEzC,MAAM,CAAC,cAAc,CAAC,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IAAI,CAAC,CAAC,CAAC,CAAC;YAElH,MAAM,aAAa,GACjB,iBACD,CAAC,aAAa,CAAC;YAEhB,OAAO;gBACL,KAAK;gBACL,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,aAAa,CAAC,IAAI,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI;aACnE,CAAC;QACJ,CAAC;KACF;IAvBO;QAJL,IAAA,mBAAU,EAAC,IAAI,qCAA2B,EAAE,CAAC;QAC7C,IAAA,kBAAS,EAAC,IAAI,uBAAc,CAAC,QAAQ,CAAC,EAAE,sBAAsB,CAAC;QAC/D,IAAA,wBAAe,EAAC,GAAG,eAAe,CAAC;QACnC,IAAA,6BAAgB,EAAC,KAAK,CAAC;QAErB,WAAA,IAAA,4BAAe,GAAE,CAAA;QACjB,WAAA,IAAA,wBAAW,GAAE,CAAA;;iDAAO,aAAa;;yDAoBnC;IAGH,MAAM,CAAC,cAAc,CAAC,oBAAoB,EAAE,MAAM,EAAE;QAClD,KAAK,EAAE,OAAO,IAAA,qBAAW,EAAC,SAAS,EAAE,aAAa,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE;QACzE,QAAQ,EAAE,KAAK;KAChB,CAAC,CAAC;IAEH,OAAO,oBAAoB,CAAC;AAC9B,CAAC;AAEQ,sDAAqB"}
|
|
@@ -4,6 +4,6 @@ import { BaseEntity } from '../../models';
|
|
|
4
4
|
import { AggregateControllerConstructor } from './aggregate-controller.interface';
|
|
5
5
|
import { AggregateGatewayConstructor } from './aggregate-gateway.interface';
|
|
6
6
|
declare function createAggregateServiceProvider<Entity extends BaseEntity>(entity: Type<Entity>, displayedName: string, version: string | undefined, callback: DynamicApiServiceCallback<Entity> | undefined): DynamicAPIServiceProvider;
|
|
7
|
-
declare function createAggregateController<Entity extends BaseEntity>(entity: Type<Entity>, displayedName: string, controllerOptions: DynamicApiControllerOptions<Entity>, routeConfig: DynamicAPIRouteConfig<Entity>, version?: string, validationPipeOptions?: ValidationPipeOptions): AggregateControllerConstructor<Entity>;
|
|
8
|
-
declare function createAggregateGateway<Entity extends BaseEntity>(entity: Type<Entity>, displayedName: string, controllerOptions: DynamicApiControllerOptions<Entity>, routeConfig: DynamicAPIRouteConfig<Entity>, version?: string, validationPipeOptions?: ValidationPipeOptions, gatewayOptions?: GatewayOptions): AggregateGatewayConstructor<Entity>;
|
|
7
|
+
declare function createAggregateController<Entity extends BaseEntity>(entity: Type<Entity>, displayedName: string, { useInterceptors, ...controllerOptions }: DynamicApiControllerOptions<Entity>, routeConfig: DynamicAPIRouteConfig<Entity>, version?: string, validationPipeOptions?: ValidationPipeOptions): AggregateControllerConstructor<Entity>;
|
|
8
|
+
declare function createAggregateGateway<Entity extends BaseEntity>(entity: Type<Entity>, displayedName: string, { useInterceptors, ...controllerOptions }: DynamicApiControllerOptions<Entity>, routeConfig: DynamicAPIRouteConfig<Entity>, version?: string, validationPipeOptions?: ValidationPipeOptions, gatewayOptions?: GatewayOptions): AggregateGatewayConstructor<Entity>;
|
|
9
9
|
export { createAggregateController, createAggregateGateway, createAggregateServiceProvider };
|
|
@@ -48,7 +48,7 @@ function createAggregateServiceProvider(entity, displayedName, version, callback
|
|
|
48
48
|
};
|
|
49
49
|
}
|
|
50
50
|
exports.createAggregateServiceProvider = createAggregateServiceProvider;
|
|
51
|
-
function createAggregateController(entity, displayedName, controllerOptions, routeConfig, version, validationPipeOptions) {
|
|
51
|
+
function createAggregateController(entity, displayedName, { useInterceptors = [], ...controllerOptions }, routeConfig, version, validationPipeOptions) {
|
|
52
52
|
const { path, apiTag } = controllerOptions;
|
|
53
53
|
let AggregateController = class AggregateController extends (0, aggregate_controller_mixin_1.AggregateControllerMixin)(entity, controllerOptions, routeConfig, version) {
|
|
54
54
|
constructor(service) {
|
|
@@ -60,7 +60,7 @@ function createAggregateController(entity, displayedName, controllerOptions, rou
|
|
|
60
60
|
(0, common_1.Controller)({ path, version }),
|
|
61
61
|
(0, swagger_1.ApiTags)(apiTag || entity.name),
|
|
62
62
|
(0, decorators_1.ValidatorPipe)(validationPipeOptions),
|
|
63
|
-
(0, common_1.UseInterceptors)(common_1.ClassSerializerInterceptor),
|
|
63
|
+
(0, common_1.UseInterceptors)(common_1.ClassSerializerInterceptor, ...useInterceptors),
|
|
64
64
|
__param(0, (0, common_1.Inject)((0, helpers_1.provideName)('Aggregate', displayedName, version, 'Service'))),
|
|
65
65
|
__metadata("design:paramtypes", [Object])
|
|
66
66
|
], AggregateController);
|
|
@@ -71,7 +71,7 @@ function createAggregateController(entity, displayedName, controllerOptions, rou
|
|
|
71
71
|
return AggregateController;
|
|
72
72
|
}
|
|
73
73
|
exports.createAggregateController = createAggregateController;
|
|
74
|
-
function createAggregateGateway(entity, displayedName, controllerOptions, routeConfig, version, validationPipeOptions, gatewayOptions = {}) {
|
|
74
|
+
function createAggregateGateway(entity, displayedName, { useInterceptors = [], ...controllerOptions }, routeConfig, version, validationPipeOptions, gatewayOptions = {}) {
|
|
75
75
|
let AggregateGateway = class AggregateGateway extends (0, aggregate_gateway_mixin_1.AggregateGatewayMixin)(entity, controllerOptions, routeConfig, version) {
|
|
76
76
|
constructor(service, jwtService) {
|
|
77
77
|
super(service, jwtService);
|
|
@@ -82,6 +82,7 @@ function createAggregateGateway(entity, displayedName, controllerOptions, routeC
|
|
|
82
82
|
AggregateGateway = __decorate([
|
|
83
83
|
(0, websockets_1.WebSocketGateway)(gatewayOptions),
|
|
84
84
|
(0, decorators_1.ValidatorPipe)(validationPipeOptions),
|
|
85
|
+
(0, common_1.UseInterceptors)(common_1.ClassSerializerInterceptor, ...useInterceptors),
|
|
85
86
|
__param(0, (0, common_1.Inject)((0, helpers_1.provideName)(routeConfig.type, displayedName, version, 'Service'))),
|
|
86
87
|
__metadata("design:paramtypes", [Object, jwt_1.JwtService])
|
|
87
88
|
], AggregateGateway);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aggregate.helper.js","sourceRoot":"","sources":["../../../../libs/dynamic-api/src/routes/aggregate/aggregate.helper.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAOwB;AACxB,qCAAyC;AACzC,+CAA+C;AAC/C,6CAA0C;AAC1C,mDAAsD;AACtD,uCAAiC;AACjC,iDAAiD;AACjD,iEAA4D;AAC5D,2CAA4C;AAQ5C,qEAAgE;AAEhE,6EAAwE;AAExE,uEAAkE;AAGlE,SAAS,8BAA8B,CACrC,MAAoB,EACpB,aAAqB,EACrB,OAA2B,EAC3B,QAAuD;IAEvD,IAAM,gBAAgB,GAAtB,MAAM,gBAAiB,SAAQ,6CAA4B;QAIzD,YAKE,KAAuC;YAEvC,KAAK,CAAC,KAAK,CAAC,CAAC;YAFM,UAAK,GAAL,KAAK,CAAe;YARtB,WAAM,GAAG,MAAM,CAAC;YAChB,aAAQ,GAAG,QAAQ,CAAC;QAUvC,CAAC;KACF,CAAA;IAbK,gBAAgB;QAKjB,WAAA,IAAA,sBAAW,EACV,MAAM,CAAC,IAAI,EACX,qCAAgB,CAAC,KAAK,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAC7C,CAAA;yCACyB,gBAAK;OAT7B,gBAAgB,CAarB;IAED,MAAM,CAAC,cAAc,CAAC,gBAAgB,EAAE,MAAM,EAAE;QAC9C,KAAK,EAAE,IAAA,qBAAW,EAAC,WAAW,EAAE,aAAa,EAAE,OAAO,EAAE,SAAS,CAAC;QAClE,QAAQ,EAAE,KAAK;KAChB,CAAC,CAAC;IAEH,OAAO;QACL,OAAO,EAAE,IAAA,qBAAW,EAAC,WAAW,EAAE,aAAa,EAAE,OAAO,EAAE,SAAS,CAAC;QACpE,QAAQ,EAAE,gBAAgB;KAC3B,CAAC;AACJ,CAAC;
|
|
1
|
+
{"version":3,"file":"aggregate.helper.js","sourceRoot":"","sources":["../../../../libs/dynamic-api/src/routes/aggregate/aggregate.helper.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAOwB;AACxB,qCAAyC;AACzC,+CAA+C;AAC/C,6CAA0C;AAC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;KACF,CAAA;IAbK,gBAAgB;QAHrB,IAAA,6BAAgB,EAAC,cAAc,CAAC;QAChC,IAAA,0BAAa,EAAC,qBAAqB,CAAC;QACpC,IAAA,wBAAe,EAAC,mCAA0B,EAAE,GAAG,eAAe,CAAC;QAQ3D,WAAA,IAAA,eAAM,EAAC,IAAA,qBAAW,EAAC,WAAW,CAAC,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC,CAAA;iDAE1C,gBAAU;OATvC,gBAAgB,CAarB;IAED,MAAM,CAAC,cAAc,CAAC,gBAAgB,EAAE,MAAM,EAAE;QAC9C,KAAK,EAAE,GAAG,IAAA,qBAAW,EAAC,WAAW,CAAC,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE;QAC5E,QAAQ,EAAE,KAAK;KAChB,CAAC,CAAC;IAEH,OAAO,gBAAgB,CAAC;AAC1B,CAAC;AAEmC,wDAAsB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { DynamicModule, Type, ValidationPipeOptions } from '@nestjs/common';
|
|
1
|
+
import { DynamicModule, ModuleMetadata, Type, ValidationPipeOptions } from '@nestjs/common';
|
|
2
2
|
import { DynamicApiControllerOptions, DynamicAPIRouteConfig, DynamicApiWebSocketOptions } from '../../interfaces';
|
|
3
3
|
import { BaseEntity } from '../../models';
|
|
4
4
|
export declare class AggregateModule {
|
|
5
|
-
static forFeature<Entity extends BaseEntity>(databaseModule: DynamicModule, entity: Type<Entity>, controllerOptions: DynamicApiControllerOptions<Entity>, routeConfig: DynamicAPIRouteConfig<Entity>, version?: string, validationPipeOptions?: ValidationPipeOptions, webSocket?: DynamicApiWebSocketOptions): DynamicModule;
|
|
5
|
+
static forFeature<Entity extends BaseEntity>(databaseModule: DynamicModule, entity: Type<Entity>, controllerOptions: DynamicApiControllerOptions<Entity>, routeConfig: DynamicAPIRouteConfig<Entity>, version?: string, validationPipeOptions?: ValidationPipeOptions, webSocket?: DynamicApiWebSocketOptions, extraImports?: ModuleMetadata['imports'], extraProviders?: ModuleMetadata['providers'], extraControllers?: ModuleMetadata['controllers']): DynamicModule;
|
|
6
6
|
}
|
|
@@ -13,7 +13,7 @@ const dynamic_api_module_1 = require("../../dynamic-api.module");
|
|
|
13
13
|
const helpers_1 = require("../../helpers");
|
|
14
14
|
const aggregate_helper_1 = require("./aggregate.helper");
|
|
15
15
|
let AggregateModule = AggregateModule_1 = class AggregateModule {
|
|
16
|
-
static forFeature(databaseModule, entity, controllerOptions, routeConfig, version, validationPipeOptions, webSocket) {
|
|
16
|
+
static forFeature(databaseModule, entity, controllerOptions, routeConfig, version, validationPipeOptions, webSocket, extraImports, extraProviders, extraControllers) {
|
|
17
17
|
const displayedName = (0, helpers_1.getDisplayedName)(controllerOptions.apiTag, entity.name, routeConfig.subPath);
|
|
18
18
|
const controller = (0, aggregate_helper_1.createAggregateController)(entity, displayedName, controllerOptions, routeConfig, version, validationPipeOptions);
|
|
19
19
|
const ServiceProvider = (0, aggregate_helper_1.createAggregateServiceProvider)(entity, displayedName, version, routeConfig.callback);
|
|
@@ -22,13 +22,14 @@ let AggregateModule = AggregateModule_1 = class AggregateModule {
|
|
|
22
22
|
: dynamic_api_module_1.DynamicApiModule.state.get('gatewayOptions');
|
|
23
23
|
return {
|
|
24
24
|
module: AggregateModule_1,
|
|
25
|
-
imports: [databaseModule],
|
|
26
|
-
controllers: [controller],
|
|
25
|
+
imports: [databaseModule, ...(extraImports || [])],
|
|
26
|
+
controllers: [controller, ...(extraControllers || [])],
|
|
27
27
|
providers: [
|
|
28
28
|
ServiceProvider,
|
|
29
29
|
...(gatewayOptions ? [
|
|
30
30
|
(0, aggregate_helper_1.createAggregateGateway)(entity, displayedName, controllerOptions, routeConfig, version, validationPipeOptions, gatewayOptions)
|
|
31
31
|
] : []),
|
|
32
|
+
...(extraProviders || []),
|
|
32
33
|
],
|
|
33
34
|
};
|
|
34
35
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aggregate.module.js","sourceRoot":"","sources":["../../../../libs/dynamic-api/src/routes/aggregate/aggregate.module.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"aggregate.module.js","sourceRoot":"","sources":["../../../../libs/dynamic-api/src/routes/aggregate/aggregate.module.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,2CAAoG;AAEpG,iEAA4D;AAC5D,2CAA8E;AAG9E,yDAI4B;AAGrB,IAAM,eAAe,uBAArB,MAAM,eAAe;IAC1B,MAAM,CAAC,UAAU,CACf,cAA6B,EAC7B,MAAoB,EACpB,iBAAsD,EACtD,WAA0C,EAC1C,OAAgB,EAChB,qBAA6C,EAC7C,SAAsC,EACtC,YAAwC,EACxC,cAA4C,EAC5C,gBAAgD;QAEhD,MAAM,aAAa,GAAG,IAAA,0BAAgB,EAAC,iBAAiB,CAAC,MAAM,EAAE,MAAM,CAAC,IAAI,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;QAEnG,MAAM,UAAU,GAAG,IAAA,4CAAyB,EAC1C,MAAM,EACN,aAAa,EACb,iBAAiB,EACjB,WAAW,EACX,OAAO,EACP,qBAAqB,CACtB,CAAC;QACF,MAAM,eAAe,GAAG,IAAA,iDAA8B,EAAC,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC;QAE7G,MAAM,cAAc,GAAG,SAAS;YAC9B,CAAC,CAAC,IAAA,qCAA2B,EAAC,SAAS,CAAC;YACxC,CAAC,CAAC,qCAAgB,CAAC,KAAK,CAAC,GAAG,CAAkB,gBAAgB,CAAC,CAAC;QAElE,OAAO;YACL,MAAM,EAAE,iBAAe;YACvB,OAAO,EAAE,CAAC,cAAc,EAAE,GAAG,CAAC,YAAY,IAAI,EAAE,CAAC,CAAC;YAClD,WAAW,EAAE,CAAC,UAAU,EAAE,GAAG,CAAC,gBAAgB,IAAI,EAAE,CAAC,CAAC;YACtD,SAAS,EAAE;gBACT,e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