tychat-contracts 1.4.9 → 1.5.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.
- package/dist/auth/auth-kafka.payloads.d.ts +10 -0
- package/dist/auth/auth-kafka.payloads.d.ts.map +1 -1
- package/dist/auth/auth-kafka.payloads.js +58 -1
- package/dist/auth/auth-login-response.dto.d.ts +5 -3
- package/dist/auth/auth-login-response.dto.d.ts.map +1 -1
- package/dist/auth/auth-login-response.dto.js +17 -3
- package/dist/auth/index.d.ts +3 -1
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/auth/index.js +8 -1
- package/dist/auth/login-2fa.dto.d.ts +5 -0
- package/dist/auth/login-2fa.dto.d.ts.map +1 -0
- package/dist/auth/login-2fa.dto.js +31 -0
- package/dist/auth/totp-user.dto.d.ts +12 -0
- package/dist/auth/totp-user.dto.d.ts.map +1 -0
- package/dist/auth/totp-user.dto.js +54 -0
- package/dist/notifications/index.d.ts +1 -1
- package/dist/notifications/index.d.ts.map +1 -1
- package/dist/notifications/index.js +2 -1
- package/dist/notifications/notifications-kafka.payloads.d.ts +16 -0
- package/dist/notifications/notifications-kafka.payloads.d.ts.map +1 -1
- package/dist/notifications/notifications-kafka.payloads.js +84 -1
- package/package.json +1 -1
- package/src/auth/auth-kafka.payloads.ts +44 -2
- package/src/auth/auth-login-response.dto.ts +18 -7
- package/src/auth/index.ts +7 -0
- package/src/auth/login-2fa.dto.ts +14 -0
- package/src/auth/totp-user.dto.ts +29 -0
- package/src/notifications/index.ts +1 -0
- package/src/notifications/notifications-kafka.payloads.ts +62 -0
|
@@ -3,6 +3,16 @@ import { RefreshTokenDto } from './refresh-token.dto';
|
|
|
3
3
|
export declare class LoginPayload extends LoginDto {
|
|
4
4
|
tenant: string;
|
|
5
5
|
}
|
|
6
|
+
/** Segundo passo do login quando 2FA está ativo (RMQ/Kafka → auth-service). */
|
|
7
|
+
export declare class Login2faPayload {
|
|
8
|
+
tenant: string;
|
|
9
|
+
pre_auth_token: string;
|
|
10
|
+
totp: string;
|
|
11
|
+
device_name?: string;
|
|
12
|
+
device_type?: 'web' | 'mobile' | 'api';
|
|
13
|
+
ip_address?: string | null;
|
|
14
|
+
location?: string | null;
|
|
15
|
+
}
|
|
6
16
|
export declare class ValidatePayload {
|
|
7
17
|
tenant: string;
|
|
8
18
|
access_token: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth-kafka.payloads.d.ts","sourceRoot":"","sources":["../../src/auth/auth-kafka.payloads.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,qBAAa,YAAa,SAAQ,QAAQ;IAKxC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,qBAAa,eAAe;IAK1B,MAAM,EAAE,MAAM,CAAC;IAMf,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,qBAAa,cAAe,SAAQ,eAAe;IAKjD,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,2FAA2F;AAC3F,qBAAa,iBAAiB;IAK5B,MAAM,EAAE,MAAM,CAAC;IAQf,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,qBAAa,2BAA2B;IAKtC,MAAM,EAAE,MAAM,CAAC;IAMf,KAAK,EAAE,MAAM,CAAC;CACf;AAED,qBAAa,2BAA2B;IAKtC,MAAM,EAAE,MAAM,CAAC;IAMf,YAAY,EAAE,MAAM,CAAC;IAMrB,QAAQ,EAAE,MAAM,CAAC;CAClB"}
|
|
1
|
+
{"version":3,"file":"auth-kafka.payloads.d.ts","sourceRoot":"","sources":["../../src/auth/auth-kafka.payloads.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,qBAAa,YAAa,SAAQ,QAAQ;IAKxC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,+EAA+E;AAC/E,qBAAa,eAAe;IAK1B,MAAM,EAAE,MAAM,CAAC;IAKf,cAAc,EAAE,MAAM,CAAC;IAKvB,IAAI,EAAE,MAAM,CAAC;IAMb,WAAW,CAAC,EAAE,MAAM,CAAC;IAKrB,WAAW,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,KAAK,CAAC;IAMvC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAM3B,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED,qBAAa,eAAe;IAK1B,MAAM,EAAE,MAAM,CAAC;IAMf,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,qBAAa,cAAe,SAAQ,eAAe;IAKjD,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,2FAA2F;AAC3F,qBAAa,iBAAiB;IAK5B,MAAM,EAAE,MAAM,CAAC;IAQf,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,qBAAa,2BAA2B;IAKtC,MAAM,EAAE,MAAM,CAAC;IAMf,KAAK,EAAE,MAAM,CAAC;CACf;AAED,qBAAa,2BAA2B;IAKtC,MAAM,EAAE,MAAM,CAAC;IAMf,YAAY,EAAE,MAAM,CAAC;IAMrB,QAAQ,EAAE,MAAM,CAAC;CAClB"}
|
|
@@ -9,7 +9,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.ConfirmPasswordResetPayload = exports.RequestPasswordResetPayload = exports.GetProfilePayload = exports.RefreshPayload = exports.ValidatePayload = exports.LoginPayload = void 0;
|
|
12
|
+
exports.ConfirmPasswordResetPayload = exports.RequestPasswordResetPayload = exports.GetProfilePayload = exports.RefreshPayload = exports.ValidatePayload = exports.Login2faPayload = exports.LoginPayload = void 0;
|
|
13
13
|
const swagger_1 = require("@nestjs/swagger");
|
|
14
14
|
const class_validator_1 = require("class-validator");
|
|
15
15
|
const login_dto_1 = require("./login.dto");
|
|
@@ -25,6 +25,63 @@ __decorate([
|
|
|
25
25
|
(0, class_validator_1.MaxLength)(255),
|
|
26
26
|
__metadata("design:type", String)
|
|
27
27
|
], LoginPayload.prototype, "tenant", void 0);
|
|
28
|
+
/** Segundo passo do login quando 2FA está ativo (RMQ/Kafka → auth-service). */
|
|
29
|
+
class Login2faPayload {
|
|
30
|
+
tenant;
|
|
31
|
+
pre_auth_token;
|
|
32
|
+
totp;
|
|
33
|
+
device_name;
|
|
34
|
+
device_type;
|
|
35
|
+
ip_address;
|
|
36
|
+
location;
|
|
37
|
+
}
|
|
38
|
+
exports.Login2faPayload = Login2faPayload;
|
|
39
|
+
__decorate([
|
|
40
|
+
(0, swagger_1.ApiProperty)({ description: 'ID do tenant', example: 'tenant1' }),
|
|
41
|
+
(0, class_validator_1.IsString)(),
|
|
42
|
+
(0, class_validator_1.MinLength)(1, { message: 'tenant não pode ser vazio' }),
|
|
43
|
+
(0, class_validator_1.MaxLength)(255),
|
|
44
|
+
__metadata("design:type", String)
|
|
45
|
+
], Login2faPayload.prototype, "tenant", void 0);
|
|
46
|
+
__decorate([
|
|
47
|
+
(0, swagger_1.ApiProperty)({ description: 'JWT pre_2fa do primeiro passo' }),
|
|
48
|
+
(0, class_validator_1.IsString)(),
|
|
49
|
+
(0, class_validator_1.MinLength)(1, { message: 'pre_auth_token não pode ser vazio' }),
|
|
50
|
+
__metadata("design:type", String)
|
|
51
|
+
], Login2faPayload.prototype, "pre_auth_token", void 0);
|
|
52
|
+
__decorate([
|
|
53
|
+
(0, swagger_1.ApiProperty)({ description: 'Código TOTP de 6 dígitos' }),
|
|
54
|
+
(0, class_validator_1.IsString)(),
|
|
55
|
+
(0, class_validator_1.Matches)(/^\d{6}$/, { message: 'totp deve ser exatamente 6 dígitos' }),
|
|
56
|
+
__metadata("design:type", String)
|
|
57
|
+
], Login2faPayload.prototype, "totp", void 0);
|
|
58
|
+
__decorate([
|
|
59
|
+
(0, swagger_1.ApiPropertyOptional)({ example: 'Chrome — Windows' }),
|
|
60
|
+
(0, class_validator_1.IsOptional)(),
|
|
61
|
+
(0, class_validator_1.IsString)(),
|
|
62
|
+
(0, class_validator_1.MaxLength)(255),
|
|
63
|
+
__metadata("design:type", String)
|
|
64
|
+
], Login2faPayload.prototype, "device_name", void 0);
|
|
65
|
+
__decorate([
|
|
66
|
+
(0, swagger_1.ApiPropertyOptional)({ enum: ['web', 'mobile', 'api'] }),
|
|
67
|
+
(0, class_validator_1.IsOptional)(),
|
|
68
|
+
(0, class_validator_1.IsIn)(['web', 'mobile', 'api']),
|
|
69
|
+
__metadata("design:type", String)
|
|
70
|
+
], Login2faPayload.prototype, "device_type", void 0);
|
|
71
|
+
__decorate([
|
|
72
|
+
(0, swagger_1.ApiPropertyOptional)(),
|
|
73
|
+
(0, class_validator_1.IsOptional)(),
|
|
74
|
+
(0, class_validator_1.IsString)(),
|
|
75
|
+
(0, class_validator_1.MaxLength)(64),
|
|
76
|
+
__metadata("design:type", Object)
|
|
77
|
+
], Login2faPayload.prototype, "ip_address", void 0);
|
|
78
|
+
__decorate([
|
|
79
|
+
(0, swagger_1.ApiPropertyOptional)(),
|
|
80
|
+
(0, class_validator_1.IsOptional)(),
|
|
81
|
+
(0, class_validator_1.IsString)(),
|
|
82
|
+
(0, class_validator_1.MaxLength)(255),
|
|
83
|
+
__metadata("design:type", Object)
|
|
84
|
+
], Login2faPayload.prototype, "location", void 0);
|
|
28
85
|
class ValidatePayload {
|
|
29
86
|
tenant;
|
|
30
87
|
access_token;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export declare class AuthLoginResponseDto {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
two_factor_required: boolean;
|
|
3
|
+
pre_auth_token?: string;
|
|
4
|
+
access_token?: string;
|
|
5
|
+
refresh_token?: string;
|
|
6
|
+
force_change_password?: boolean;
|
|
5
7
|
}
|
|
6
8
|
//# sourceMappingURL=auth-login-response.dto.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth-login-response.dto.d.ts","sourceRoot":"","sources":["../../src/auth/auth-login-response.dto.ts"],"names":[],"mappings":"AAEA,qBAAa,oBAAoB;
|
|
1
|
+
{"version":3,"file":"auth-login-response.dto.d.ts","sourceRoot":"","sources":["../../src/auth/auth-login-response.dto.ts"],"names":[],"mappings":"AAEA,qBAAa,oBAAoB;IAK/B,mBAAmB,EAAE,OAAO,CAAC;IAK7B,cAAc,CAAC,EAAE,MAAM,CAAC;IAGxB,YAAY,CAAC,EAAE,MAAM,CAAC;IAGtB,aAAa,CAAC,EAAE,MAAM,CAAC;IAMvB,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC"}
|
|
@@ -12,21 +12,35 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.AuthLoginResponseDto = void 0;
|
|
13
13
|
const swagger_1 = require("@nestjs/swagger");
|
|
14
14
|
class AuthLoginResponseDto {
|
|
15
|
+
two_factor_required;
|
|
16
|
+
pre_auth_token;
|
|
15
17
|
access_token;
|
|
16
18
|
refresh_token;
|
|
17
19
|
force_change_password;
|
|
18
20
|
}
|
|
19
21
|
exports.AuthLoginResponseDto = AuthLoginResponseDto;
|
|
20
22
|
__decorate([
|
|
21
|
-
(0, swagger_1.ApiProperty)({
|
|
23
|
+
(0, swagger_1.ApiProperty)({
|
|
24
|
+
description: 'Se true, o cliente deve enviar pre_auth_token e código TOTP em POST /auth/login-2fa (ou login-health-2fa)',
|
|
25
|
+
}),
|
|
26
|
+
__metadata("design:type", Boolean)
|
|
27
|
+
], AuthLoginResponseDto.prototype, "two_factor_required", void 0);
|
|
28
|
+
__decorate([
|
|
29
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
30
|
+
description: 'JWT de curta duração; presente quando two_factor_required é true',
|
|
31
|
+
}),
|
|
32
|
+
__metadata("design:type", String)
|
|
33
|
+
], AuthLoginResponseDto.prototype, "pre_auth_token", void 0);
|
|
34
|
+
__decorate([
|
|
35
|
+
(0, swagger_1.ApiPropertyOptional)({ description: 'Presente quando two_factor_required é false' }),
|
|
22
36
|
__metadata("design:type", String)
|
|
23
37
|
], AuthLoginResponseDto.prototype, "access_token", void 0);
|
|
24
38
|
__decorate([
|
|
25
|
-
(0, swagger_1.
|
|
39
|
+
(0, swagger_1.ApiPropertyOptional)({ description: 'Presente quando two_factor_required é false' }),
|
|
26
40
|
__metadata("design:type", String)
|
|
27
41
|
], AuthLoginResponseDto.prototype, "refresh_token", void 0);
|
|
28
42
|
__decorate([
|
|
29
|
-
(0, swagger_1.
|
|
43
|
+
(0, swagger_1.ApiPropertyOptional)({
|
|
30
44
|
description: 'Indica se o usuário deve alterar a senha no primeiro acesso',
|
|
31
45
|
example: true,
|
|
32
46
|
}),
|
package/dist/auth/index.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export { LoginDto } from './login.dto';
|
|
2
|
-
export { LoginPayload, ValidatePayload, RefreshPayload, GetProfilePayload, RequestPasswordResetPayload, ConfirmPasswordResetPayload, } from './auth-kafka.payloads';
|
|
2
|
+
export { LoginPayload, Login2faPayload, ValidatePayload, RefreshPayload, GetProfilePayload, RequestPasswordResetPayload, ConfirmPasswordResetPayload, } from './auth-kafka.payloads';
|
|
3
3
|
export { RefreshTokenDto } from './refresh-token.dto';
|
|
4
4
|
export { RequestPasswordResetDto } from './request-password-reset.dto';
|
|
5
5
|
export { ConfirmPasswordResetDto } from './confirm-password-reset.dto';
|
|
6
6
|
export { AuthLoginResponseDto } from './auth-login-response.dto';
|
|
7
|
+
export { Login2faDto } from './login-2fa.dto';
|
|
8
|
+
export { TotpSetupConfirmDto, TotpDisableDto, TotpSetupStartResponseDto, } from './totp-user.dto';
|
|
7
9
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/auth/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EACL,YAAY,EACZ,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,2BAA2B,EAC3B,2BAA2B,GAC5B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EACL,YAAY,EACZ,eAAe,EACf,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,2BAA2B,EAC3B,2BAA2B,GAC5B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EACL,mBAAmB,EACnB,cAAc,EACd,yBAAyB,GAC1B,MAAM,iBAAiB,CAAC"}
|
package/dist/auth/index.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AuthLoginResponseDto = exports.ConfirmPasswordResetDto = exports.RequestPasswordResetDto = exports.RefreshTokenDto = exports.ConfirmPasswordResetPayload = exports.RequestPasswordResetPayload = exports.GetProfilePayload = exports.RefreshPayload = exports.ValidatePayload = exports.LoginPayload = exports.LoginDto = void 0;
|
|
3
|
+
exports.TotpSetupStartResponseDto = exports.TotpDisableDto = exports.TotpSetupConfirmDto = exports.Login2faDto = exports.AuthLoginResponseDto = exports.ConfirmPasswordResetDto = exports.RequestPasswordResetDto = exports.RefreshTokenDto = exports.ConfirmPasswordResetPayload = exports.RequestPasswordResetPayload = exports.GetProfilePayload = exports.RefreshPayload = exports.ValidatePayload = exports.Login2faPayload = exports.LoginPayload = exports.LoginDto = void 0;
|
|
4
4
|
var login_dto_1 = require("./login.dto");
|
|
5
5
|
Object.defineProperty(exports, "LoginDto", { enumerable: true, get: function () { return login_dto_1.LoginDto; } });
|
|
6
6
|
var auth_kafka_payloads_1 = require("./auth-kafka.payloads");
|
|
7
7
|
Object.defineProperty(exports, "LoginPayload", { enumerable: true, get: function () { return auth_kafka_payloads_1.LoginPayload; } });
|
|
8
|
+
Object.defineProperty(exports, "Login2faPayload", { enumerable: true, get: function () { return auth_kafka_payloads_1.Login2faPayload; } });
|
|
8
9
|
Object.defineProperty(exports, "ValidatePayload", { enumerable: true, get: function () { return auth_kafka_payloads_1.ValidatePayload; } });
|
|
9
10
|
Object.defineProperty(exports, "RefreshPayload", { enumerable: true, get: function () { return auth_kafka_payloads_1.RefreshPayload; } });
|
|
10
11
|
Object.defineProperty(exports, "GetProfilePayload", { enumerable: true, get: function () { return auth_kafka_payloads_1.GetProfilePayload; } });
|
|
@@ -18,3 +19,9 @@ var confirm_password_reset_dto_1 = require("./confirm-password-reset.dto");
|
|
|
18
19
|
Object.defineProperty(exports, "ConfirmPasswordResetDto", { enumerable: true, get: function () { return confirm_password_reset_dto_1.ConfirmPasswordResetDto; } });
|
|
19
20
|
var auth_login_response_dto_1 = require("./auth-login-response.dto");
|
|
20
21
|
Object.defineProperty(exports, "AuthLoginResponseDto", { enumerable: true, get: function () { return auth_login_response_dto_1.AuthLoginResponseDto; } });
|
|
22
|
+
var login_2fa_dto_1 = require("./login-2fa.dto");
|
|
23
|
+
Object.defineProperty(exports, "Login2faDto", { enumerable: true, get: function () { return login_2fa_dto_1.Login2faDto; } });
|
|
24
|
+
var totp_user_dto_1 = require("./totp-user.dto");
|
|
25
|
+
Object.defineProperty(exports, "TotpSetupConfirmDto", { enumerable: true, get: function () { return totp_user_dto_1.TotpSetupConfirmDto; } });
|
|
26
|
+
Object.defineProperty(exports, "TotpDisableDto", { enumerable: true, get: function () { return totp_user_dto_1.TotpDisableDto; } });
|
|
27
|
+
Object.defineProperty(exports, "TotpSetupStartResponseDto", { enumerable: true, get: function () { return totp_user_dto_1.TotpSetupStartResponseDto; } });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"login-2fa.dto.d.ts","sourceRoot":"","sources":["../../src/auth/login-2fa.dto.ts"],"names":[],"mappings":"AAGA,qBAAa,WAAW;IAItB,cAAc,EAAE,MAAM,CAAC;IAKvB,IAAI,EAAE,MAAM,CAAC;CACd"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
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
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.Login2faDto = void 0;
|
|
13
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
14
|
+
const class_validator_1 = require("class-validator");
|
|
15
|
+
class Login2faDto {
|
|
16
|
+
pre_auth_token;
|
|
17
|
+
totp;
|
|
18
|
+
}
|
|
19
|
+
exports.Login2faDto = Login2faDto;
|
|
20
|
+
__decorate([
|
|
21
|
+
(0, swagger_1.ApiProperty)({ description: 'JWT retornado no primeiro passo do login (two_factor_required)' }),
|
|
22
|
+
(0, class_validator_1.IsString)(),
|
|
23
|
+
(0, class_validator_1.MinLength)(1, { message: 'pre_auth_token não pode ser vazio' }),
|
|
24
|
+
__metadata("design:type", String)
|
|
25
|
+
], Login2faDto.prototype, "pre_auth_token", void 0);
|
|
26
|
+
__decorate([
|
|
27
|
+
(0, swagger_1.ApiProperty)({ description: 'Código TOTP de 6 dígitos do aplicativo autenticador' }),
|
|
28
|
+
(0, class_validator_1.IsString)(),
|
|
29
|
+
(0, class_validator_1.Matches)(/^\d{6}$/, { message: 'totp deve ser exatamente 6 dígitos' }),
|
|
30
|
+
__metadata("design:type", String)
|
|
31
|
+
], Login2faDto.prototype, "totp", void 0);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare class TotpSetupConfirmDto {
|
|
2
|
+
totp: string;
|
|
3
|
+
}
|
|
4
|
+
export declare class TotpDisableDto {
|
|
5
|
+
current_password: string;
|
|
6
|
+
totp: string;
|
|
7
|
+
}
|
|
8
|
+
export declare class TotpSetupStartResponseDto {
|
|
9
|
+
otpauth_url: string;
|
|
10
|
+
secret_base32: string;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=totp-user.dto.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"totp-user.dto.d.ts","sourceRoot":"","sources":["../../src/auth/totp-user.dto.ts"],"names":[],"mappings":"AAGA,qBAAa,mBAAmB;IAI9B,IAAI,EAAE,MAAM,CAAC;CACd;AAED,qBAAa,cAAc;IAIzB,gBAAgB,EAAE,MAAM,CAAC;IAKzB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,qBAAa,yBAAyB;IAEpC,WAAW,EAAE,MAAM,CAAC;IAGpB,aAAa,EAAE,MAAM,CAAC;CACvB"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
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
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.TotpSetupStartResponseDto = exports.TotpDisableDto = exports.TotpSetupConfirmDto = void 0;
|
|
13
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
14
|
+
const class_validator_1 = require("class-validator");
|
|
15
|
+
class TotpSetupConfirmDto {
|
|
16
|
+
totp;
|
|
17
|
+
}
|
|
18
|
+
exports.TotpSetupConfirmDto = TotpSetupConfirmDto;
|
|
19
|
+
__decorate([
|
|
20
|
+
(0, swagger_1.ApiProperty)({ description: 'Código TOTP de 6 dígitos para confirmar o pareamento' }),
|
|
21
|
+
(0, class_validator_1.IsString)(),
|
|
22
|
+
(0, class_validator_1.Matches)(/^\d{6}$/, { message: 'totp deve ser exatamente 6 dígitos' }),
|
|
23
|
+
__metadata("design:type", String)
|
|
24
|
+
], TotpSetupConfirmDto.prototype, "totp", void 0);
|
|
25
|
+
class TotpDisableDto {
|
|
26
|
+
current_password;
|
|
27
|
+
totp;
|
|
28
|
+
}
|
|
29
|
+
exports.TotpDisableDto = TotpDisableDto;
|
|
30
|
+
__decorate([
|
|
31
|
+
(0, swagger_1.ApiProperty)({ description: 'Senha atual do utilizador' }),
|
|
32
|
+
(0, class_validator_1.IsString)(),
|
|
33
|
+
(0, class_validator_1.MinLength)(1, { message: 'current_password não pode ser vazio' }),
|
|
34
|
+
__metadata("design:type", String)
|
|
35
|
+
], TotpDisableDto.prototype, "current_password", void 0);
|
|
36
|
+
__decorate([
|
|
37
|
+
(0, swagger_1.ApiProperty)({ description: 'Código TOTP atual de 6 dígitos' }),
|
|
38
|
+
(0, class_validator_1.IsString)(),
|
|
39
|
+
(0, class_validator_1.Matches)(/^\d{6}$/, { message: 'totp deve ser exatamente 6 dígitos' }),
|
|
40
|
+
__metadata("design:type", String)
|
|
41
|
+
], TotpDisableDto.prototype, "totp", void 0);
|
|
42
|
+
class TotpSetupStartResponseDto {
|
|
43
|
+
otpauth_url;
|
|
44
|
+
secret_base32;
|
|
45
|
+
}
|
|
46
|
+
exports.TotpSetupStartResponseDto = TotpSetupStartResponseDto;
|
|
47
|
+
__decorate([
|
|
48
|
+
(0, swagger_1.ApiProperty)({ description: 'URI otpauth para QR code' }),
|
|
49
|
+
__metadata("design:type", String)
|
|
50
|
+
], TotpSetupStartResponseDto.prototype, "otpauth_url", void 0);
|
|
51
|
+
__decorate([
|
|
52
|
+
(0, swagger_1.ApiProperty)({ description: 'Segredo em Base32 para entrada manual' }),
|
|
53
|
+
__metadata("design:type", String)
|
|
54
|
+
], TotpSetupStartResponseDto.prototype, "secret_base32", void 0);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { NotificationUserCreatedEventPayload, NotificationPasswordResetRequestedEventPayload, NotificationConversationChangeToHumanEventPayload, NotificationTenantAiTokensThresholdEventPayload, } from './notifications-kafka.payloads';
|
|
1
|
+
export { NotificationUserCreatedEventPayload, NotificationPasswordResetRequestedEventPayload, NotificationNewDeviceLoginEventPayload, NotificationConversationChangeToHumanEventPayload, NotificationTenantAiTokensThresholdEventPayload, } from './notifications-kafka.payloads';
|
|
2
2
|
export { TOPIC_NOTIFICATIONS_FIND_ALL, TOPIC_NOTIFICATIONS_REGISTER_PUSH_TOKEN, TOPIC_NOTIFICATIONS_UNREGISTER_PUSH_TOKEN, TOPIC_NOTIFICATIONS_UPDATE_VIEWED, TOPIC_NOTIFICATIONS_SEND_PUSH_TO_USER, EVENT_NOTIFICATIONS_ADMIN_BROADCAST_PUSH, EVENT_NOTIFICATIONS_CONVERSATION_HANDOFF_PUSH, EVENT_NOTIFICATIONS_HUMAN_ATTENDANT_IDLE_WARNING_PUSH, EVENT_NOTIFICATIONS_TENANT_AI_TOKENS_THRESHOLD, } from './notifications-kafka-topics';
|
|
3
3
|
export { AdminBroadcastPushDto, ADMIN_NOTIFICATION_KINDS, type AdminNotificationKind, } from './admin-broadcast-push.dto';
|
|
4
4
|
export { RegisterPushTokenDto, NotificationsRegisterPushTokenKafkaDto, NotificationsUnregisterPushTokenKafkaDto, } from './register-push-token.dto';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/notifications/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mCAAmC,EACnC,8CAA8C,EAC9C,iDAAiD,EACjD,+CAA+C,GAChD,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,4BAA4B,EAC5B,uCAAuC,EACvC,yCAAyC,EACzC,iCAAiC,EACjC,qCAAqC,EACrC,wCAAwC,EACxC,6CAA6C,EAC7C,qDAAqD,EACrD,8CAA8C,GAC/C,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,qBAAqB,EACrB,wBAAwB,EACxB,KAAK,qBAAqB,GAC3B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,oBAAoB,EACpB,sCAAsC,EACtC,wCAAwC,GACzC,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,yBAAyB,EACzB,6BAA6B,EAC7B,2BAA2B,EAC3B,KAAK,6BAA6B,EAClC,KAAK,2BAA2B,GACjC,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,4BAA4B,EAAE,MAAM,oCAAoC,CAAC;AAClF,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EACL,2BAA2B,EAC3B,iCAAiC,GAClC,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,mCAAmC,EAAE,MAAM,uCAAuC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/notifications/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mCAAmC,EACnC,8CAA8C,EAC9C,sCAAsC,EACtC,iDAAiD,EACjD,+CAA+C,GAChD,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,4BAA4B,EAC5B,uCAAuC,EACvC,yCAAyC,EACzC,iCAAiC,EACjC,qCAAqC,EACrC,wCAAwC,EACxC,6CAA6C,EAC7C,qDAAqD,EACrD,8CAA8C,GAC/C,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,qBAAqB,EACrB,wBAAwB,EACxB,KAAK,qBAAqB,GAC3B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,oBAAoB,EACpB,sCAAsC,EACtC,wCAAwC,GACzC,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,yBAAyB,EACzB,6BAA6B,EAC7B,2BAA2B,EAC3B,KAAK,6BAA6B,EAClC,KAAK,2BAA2B,GACjC,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,4BAA4B,EAAE,MAAM,oCAAoC,CAAC;AAClF,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EACL,2BAA2B,EAC3B,iCAAiC,GAClC,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,mCAAmC,EAAE,MAAM,uCAAuC,CAAC"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NotificationsSendPushToUserKafkaDto = exports.NotificationsUpdateViewedKafkaDto = exports.UpdateNotificationViewedDto = exports.NotificationListItemDto = exports.NotificationsFindAllKafkaDto = exports.NOTIFICATION_STATUS_FILTERS = exports.NOTIFICATION_PROVIDER_FILTERS = exports.ListNotificationsQueryDto = exports.NotificationsUnregisterPushTokenKafkaDto = exports.NotificationsRegisterPushTokenKafkaDto = exports.RegisterPushTokenDto = exports.ADMIN_NOTIFICATION_KINDS = exports.AdminBroadcastPushDto = exports.EVENT_NOTIFICATIONS_TENANT_AI_TOKENS_THRESHOLD = exports.EVENT_NOTIFICATIONS_HUMAN_ATTENDANT_IDLE_WARNING_PUSH = exports.EVENT_NOTIFICATIONS_CONVERSATION_HANDOFF_PUSH = exports.EVENT_NOTIFICATIONS_ADMIN_BROADCAST_PUSH = exports.TOPIC_NOTIFICATIONS_SEND_PUSH_TO_USER = exports.TOPIC_NOTIFICATIONS_UPDATE_VIEWED = exports.TOPIC_NOTIFICATIONS_UNREGISTER_PUSH_TOKEN = exports.TOPIC_NOTIFICATIONS_REGISTER_PUSH_TOKEN = exports.TOPIC_NOTIFICATIONS_FIND_ALL = exports.NotificationTenantAiTokensThresholdEventPayload = exports.NotificationConversationChangeToHumanEventPayload = exports.NotificationPasswordResetRequestedEventPayload = exports.NotificationUserCreatedEventPayload = void 0;
|
|
3
|
+
exports.NotificationsSendPushToUserKafkaDto = exports.NotificationsUpdateViewedKafkaDto = exports.UpdateNotificationViewedDto = exports.NotificationListItemDto = exports.NotificationsFindAllKafkaDto = exports.NOTIFICATION_STATUS_FILTERS = exports.NOTIFICATION_PROVIDER_FILTERS = exports.ListNotificationsQueryDto = exports.NotificationsUnregisterPushTokenKafkaDto = exports.NotificationsRegisterPushTokenKafkaDto = exports.RegisterPushTokenDto = exports.ADMIN_NOTIFICATION_KINDS = exports.AdminBroadcastPushDto = exports.EVENT_NOTIFICATIONS_TENANT_AI_TOKENS_THRESHOLD = exports.EVENT_NOTIFICATIONS_HUMAN_ATTENDANT_IDLE_WARNING_PUSH = exports.EVENT_NOTIFICATIONS_CONVERSATION_HANDOFF_PUSH = exports.EVENT_NOTIFICATIONS_ADMIN_BROADCAST_PUSH = exports.TOPIC_NOTIFICATIONS_SEND_PUSH_TO_USER = exports.TOPIC_NOTIFICATIONS_UPDATE_VIEWED = exports.TOPIC_NOTIFICATIONS_UNREGISTER_PUSH_TOKEN = exports.TOPIC_NOTIFICATIONS_REGISTER_PUSH_TOKEN = exports.TOPIC_NOTIFICATIONS_FIND_ALL = exports.NotificationTenantAiTokensThresholdEventPayload = exports.NotificationConversationChangeToHumanEventPayload = exports.NotificationNewDeviceLoginEventPayload = exports.NotificationPasswordResetRequestedEventPayload = exports.NotificationUserCreatedEventPayload = void 0;
|
|
4
4
|
var notifications_kafka_payloads_1 = require("./notifications-kafka.payloads");
|
|
5
5
|
Object.defineProperty(exports, "NotificationUserCreatedEventPayload", { enumerable: true, get: function () { return notifications_kafka_payloads_1.NotificationUserCreatedEventPayload; } });
|
|
6
6
|
Object.defineProperty(exports, "NotificationPasswordResetRequestedEventPayload", { enumerable: true, get: function () { return notifications_kafka_payloads_1.NotificationPasswordResetRequestedEventPayload; } });
|
|
7
|
+
Object.defineProperty(exports, "NotificationNewDeviceLoginEventPayload", { enumerable: true, get: function () { return notifications_kafka_payloads_1.NotificationNewDeviceLoginEventPayload; } });
|
|
7
8
|
Object.defineProperty(exports, "NotificationConversationChangeToHumanEventPayload", { enumerable: true, get: function () { return notifications_kafka_payloads_1.NotificationConversationChangeToHumanEventPayload; } });
|
|
8
9
|
Object.defineProperty(exports, "NotificationTenantAiTokensThresholdEventPayload", { enumerable: true, get: function () { return notifications_kafka_payloads_1.NotificationTenantAiTokensThresholdEventPayload; } });
|
|
9
10
|
var notifications_kafka_topics_1 = require("./notifications-kafka-topics");
|
|
@@ -13,6 +13,22 @@ export declare class NotificationPasswordResetRequestedEventPayload {
|
|
|
13
13
|
verifyToken: string;
|
|
14
14
|
occurredAt: string;
|
|
15
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* Evento RabbitMQ `notifications.new_device_login` — alerta de login a partir de um perfil de
|
|
18
|
+
* dispositivo ainda não registado para o utilizador (par deviceName + deviceType após normalização no auth).
|
|
19
|
+
*/
|
|
20
|
+
export declare class NotificationNewDeviceLoginEventPayload {
|
|
21
|
+
eventId: string;
|
|
22
|
+
tenant: string;
|
|
23
|
+
userId: string;
|
|
24
|
+
email: string;
|
|
25
|
+
name: string;
|
|
26
|
+
deviceName: string;
|
|
27
|
+
deviceType: string;
|
|
28
|
+
ipAddress?: string;
|
|
29
|
+
location?: string;
|
|
30
|
+
occurredAt: string;
|
|
31
|
+
}
|
|
16
32
|
/** Evento Kafka `notifications.conversation-change-to-human` (IA ou clínica → fila humana). */
|
|
17
33
|
export declare class NotificationConversationChangeToHumanEventPayload {
|
|
18
34
|
eventId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notifications-kafka.payloads.d.ts","sourceRoot":"","sources":["../../src/notifications/notifications-kafka.payloads.ts"],"names":[],"mappings":"AAiBA,qBAAa,mCAAmC;IAM9C,OAAO,EAAE,MAAM,CAAC;IAShB,MAAM,EAAE,MAAM,CAAC;IAQf,KAAK,EAAE,MAAM,CAAC;IASd,IAAI,EAAE,MAAM,CAAC;IASb,QAAQ,EAAE,MAAM,CAAC;IAOjB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,qBAAa,8CAA8C;IAMzD,OAAO,EAAE,MAAM,CAAC;IAShB,MAAM,EAAE,MAAM,CAAC;IAQf,KAAK,EAAE,MAAM,CAAC;IASd,WAAW,EAAE,MAAM,CAAC;IAOpB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,+FAA+F;AAC/F,qBAAa,iDAAiD;IAG5D,OAAO,EAAE,MAAM,CAAC;IAMhB,MAAM,EAAE,MAAM,CAAC;IAIf,SAAS,EAAE,MAAM,CAAC;IAKlB,WAAW,EAAE,MAAM,CAAC;IAMpB,MAAM,EAAE,MAAM,CAAC;IAIf,UAAU,EAAE,MAAM,CAAC;IAMnB,WAAW,CAAC,EAAE,MAAM,CAAC;IAKrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAOhB,QAAQ,CAAC,EAAE,OAAO,CAAC;IAKnB,aAAa,CAAC,EAAE,IAAI,GAAG,QAAQ,CAAC;CACjC;AAED,0FAA0F;AAC1F,qBAAa,+CAA+C;IAG1D,OAAO,EAAE,MAAM,CAAC;IAMhB,MAAM,EAAE,MAAM,CAAC;IASf,gBAAgB,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,GAAG,CAAC;IAMrC,eAAe,EAAE,MAAM,CAAC;IAMxB,gBAAgB,EAAE,MAAM,CAAC;IAKzB,cAAc,EAAE,MAAM,CAAC;IAKvB,gBAAgB,EAAE,MAAM,CAAC;IAIzB,cAAc,EAAE,MAAM,CAAC;IAIvB,aAAa,EAAE,MAAM,CAAC;IAItB,UAAU,EAAE,MAAM,CAAC;CACpB"}
|
|
1
|
+
{"version":3,"file":"notifications-kafka.payloads.d.ts","sourceRoot":"","sources":["../../src/notifications/notifications-kafka.payloads.ts"],"names":[],"mappings":"AAiBA,qBAAa,mCAAmC;IAM9C,OAAO,EAAE,MAAM,CAAC;IAShB,MAAM,EAAE,MAAM,CAAC;IAQf,KAAK,EAAE,MAAM,CAAC;IASd,IAAI,EAAE,MAAM,CAAC;IASb,QAAQ,EAAE,MAAM,CAAC;IAOjB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,qBAAa,8CAA8C;IAMzD,OAAO,EAAE,MAAM,CAAC;IAShB,MAAM,EAAE,MAAM,CAAC;IAQf,KAAK,EAAE,MAAM,CAAC;IASd,WAAW,EAAE,MAAM,CAAC;IAOpB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;GAGG;AACH,qBAAa,sCAAsC;IAMjD,OAAO,EAAE,MAAM,CAAC;IAMhB,MAAM,EAAE,MAAM,CAAC;IAIf,MAAM,EAAE,MAAM,CAAC;IAKf,KAAK,EAAE,MAAM,CAAC;IAMd,IAAI,EAAE,MAAM,CAAC;IAMb,UAAU,EAAE,MAAM,CAAC;IAMnB,UAAU,EAAE,MAAM,CAAC;IAMnB,SAAS,CAAC,EAAE,MAAM,CAAC;IAMnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAIlB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,+FAA+F;AAC/F,qBAAa,iDAAiD;IAG5D,OAAO,EAAE,MAAM,CAAC;IAMhB,MAAM,EAAE,MAAM,CAAC;IAIf,SAAS,EAAE,MAAM,CAAC;IAKlB,WAAW,EAAE,MAAM,CAAC;IAMpB,MAAM,EAAE,MAAM,CAAC;IAIf,UAAU,EAAE,MAAM,CAAC;IAMnB,WAAW,CAAC,EAAE,MAAM,CAAC;IAKrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAOhB,QAAQ,CAAC,EAAE,OAAO,CAAC;IAKnB,aAAa,CAAC,EAAE,IAAI,GAAG,QAAQ,CAAC;CACjC;AAED,0FAA0F;AAC1F,qBAAa,+CAA+C;IAG1D,OAAO,EAAE,MAAM,CAAC;IAMhB,MAAM,EAAE,MAAM,CAAC;IASf,gBAAgB,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,GAAG,CAAC;IAMrC,eAAe,EAAE,MAAM,CAAC;IAMxB,gBAAgB,EAAE,MAAM,CAAC;IAKzB,cAAc,EAAE,MAAM,CAAC;IAKvB,gBAAgB,EAAE,MAAM,CAAC;IAIzB,cAAc,EAAE,MAAM,CAAC;IAIvB,aAAa,EAAE,MAAM,CAAC;IAItB,UAAU,EAAE,MAAM,CAAC;CACpB"}
|
|
@@ -9,7 +9,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.NotificationTenantAiTokensThresholdEventPayload = exports.NotificationConversationChangeToHumanEventPayload = exports.NotificationPasswordResetRequestedEventPayload = exports.NotificationUserCreatedEventPayload = void 0;
|
|
12
|
+
exports.NotificationTenantAiTokensThresholdEventPayload = exports.NotificationConversationChangeToHumanEventPayload = exports.NotificationNewDeviceLoginEventPayload = exports.NotificationPasswordResetRequestedEventPayload = exports.NotificationUserCreatedEventPayload = void 0;
|
|
13
13
|
const swagger_1 = require("@nestjs/swagger");
|
|
14
14
|
const class_validator_1 = require("class-validator");
|
|
15
15
|
class NotificationUserCreatedEventPayload {
|
|
@@ -129,6 +129,89 @@ __decorate([
|
|
|
129
129
|
(0, class_validator_1.IsISO8601)(),
|
|
130
130
|
__metadata("design:type", String)
|
|
131
131
|
], NotificationPasswordResetRequestedEventPayload.prototype, "occurredAt", void 0);
|
|
132
|
+
/**
|
|
133
|
+
* Evento RabbitMQ `notifications.new_device_login` — alerta de login a partir de um perfil de
|
|
134
|
+
* dispositivo ainda não registado para o utilizador (par deviceName + deviceType após normalização no auth).
|
|
135
|
+
*/
|
|
136
|
+
class NotificationNewDeviceLoginEventPayload {
|
|
137
|
+
eventId;
|
|
138
|
+
tenant;
|
|
139
|
+
userId;
|
|
140
|
+
email;
|
|
141
|
+
name;
|
|
142
|
+
deviceName;
|
|
143
|
+
deviceType;
|
|
144
|
+
ipAddress;
|
|
145
|
+
location;
|
|
146
|
+
occurredAt;
|
|
147
|
+
}
|
|
148
|
+
exports.NotificationNewDeviceLoginEventPayload = NotificationNewDeviceLoginEventPayload;
|
|
149
|
+
__decorate([
|
|
150
|
+
(0, swagger_1.ApiProperty)({
|
|
151
|
+
description: 'Idempotência',
|
|
152
|
+
example: '2d3ecf0d-8d38-4b95-95c8-d3e903e6f1fe',
|
|
153
|
+
}),
|
|
154
|
+
(0, class_validator_1.IsUUID)(),
|
|
155
|
+
__metadata("design:type", String)
|
|
156
|
+
], NotificationNewDeviceLoginEventPayload.prototype, "eventId", void 0);
|
|
157
|
+
__decorate([
|
|
158
|
+
(0, swagger_1.ApiProperty)({ example: 'default' }),
|
|
159
|
+
(0, class_validator_1.IsString)(),
|
|
160
|
+
(0, class_validator_1.MinLength)(1),
|
|
161
|
+
(0, class_validator_1.MaxLength)(255),
|
|
162
|
+
__metadata("design:type", String)
|
|
163
|
+
], NotificationNewDeviceLoginEventPayload.prototype, "tenant", void 0);
|
|
164
|
+
__decorate([
|
|
165
|
+
(0, swagger_1.ApiProperty)(),
|
|
166
|
+
(0, class_validator_1.IsUUID)(),
|
|
167
|
+
__metadata("design:type", String)
|
|
168
|
+
], NotificationNewDeviceLoginEventPayload.prototype, "userId", void 0);
|
|
169
|
+
__decorate([
|
|
170
|
+
(0, swagger_1.ApiProperty)({ example: 'maria.silva@example.com' }),
|
|
171
|
+
(0, class_validator_1.IsEmail)(),
|
|
172
|
+
(0, class_validator_1.MaxLength)(255),
|
|
173
|
+
__metadata("design:type", String)
|
|
174
|
+
], NotificationNewDeviceLoginEventPayload.prototype, "email", void 0);
|
|
175
|
+
__decorate([
|
|
176
|
+
(0, swagger_1.ApiProperty)({ example: 'Maria Silva' }),
|
|
177
|
+
(0, class_validator_1.IsString)(),
|
|
178
|
+
(0, class_validator_1.MinLength)(1),
|
|
179
|
+
(0, class_validator_1.MaxLength)(255),
|
|
180
|
+
__metadata("design:type", String)
|
|
181
|
+
], NotificationNewDeviceLoginEventPayload.prototype, "name", void 0);
|
|
182
|
+
__decorate([
|
|
183
|
+
(0, swagger_1.ApiProperty)({ example: 'Chrome on Windows' }),
|
|
184
|
+
(0, class_validator_1.IsString)(),
|
|
185
|
+
(0, class_validator_1.MinLength)(1),
|
|
186
|
+
(0, class_validator_1.MaxLength)(255),
|
|
187
|
+
__metadata("design:type", String)
|
|
188
|
+
], NotificationNewDeviceLoginEventPayload.prototype, "deviceName", void 0);
|
|
189
|
+
__decorate([
|
|
190
|
+
(0, swagger_1.ApiProperty)({ example: 'web' }),
|
|
191
|
+
(0, class_validator_1.IsString)(),
|
|
192
|
+
(0, class_validator_1.MinLength)(1),
|
|
193
|
+
(0, class_validator_1.MaxLength)(32),
|
|
194
|
+
__metadata("design:type", String)
|
|
195
|
+
], NotificationNewDeviceLoginEventPayload.prototype, "deviceType", void 0);
|
|
196
|
+
__decorate([
|
|
197
|
+
(0, swagger_1.ApiPropertyOptional)({ example: '203.0.113.10' }),
|
|
198
|
+
(0, class_validator_1.IsOptional)(),
|
|
199
|
+
(0, class_validator_1.IsString)(),
|
|
200
|
+
(0, class_validator_1.MaxLength)(64),
|
|
201
|
+
__metadata("design:type", String)
|
|
202
|
+
], NotificationNewDeviceLoginEventPayload.prototype, "ipAddress", void 0);
|
|
203
|
+
__decorate([
|
|
204
|
+
(0, swagger_1.ApiPropertyOptional)({ example: 'Lisboa, PT' }),
|
|
205
|
+
(0, class_validator_1.IsOptional)(),
|
|
206
|
+
(0, class_validator_1.IsString)(),
|
|
207
|
+
(0, class_validator_1.MaxLength)(255),
|
|
208
|
+
__metadata("design:type", String)
|
|
209
|
+
], NotificationNewDeviceLoginEventPayload.prototype, "location", void 0);
|
|
210
|
+
__decorate([
|
|
211
|
+
(0, swagger_1.ApiProperty)({ example: '2026-03-22T12:30:00.000Z' }),
|
|
212
|
+
(0, class_validator_1.IsISO8601)(),
|
|
213
|
+
__metadata("design:type", String)
|
|
214
|
+
], NotificationNewDeviceLoginEventPayload.prototype, "occurredAt", void 0);
|
|
132
215
|
/** Evento Kafka `notifications.conversation-change-to-human` (IA ou clínica → fila humana). */
|
|
133
216
|
class NotificationConversationChangeToHumanEventPayload {
|
|
134
217
|
eventId;
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ApiProperty } from '@nestjs/swagger';
|
|
2
|
-
import { IsString, IsUUID, MaxLength, MinLength } from 'class-validator';
|
|
1
|
+
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
|
2
|
+
import { IsIn, IsOptional, IsString, IsUUID, Matches, MaxLength, MinLength } from 'class-validator';
|
|
3
3
|
import { LoginDto } from './login.dto';
|
|
4
4
|
import { RefreshTokenDto } from './refresh-token.dto';
|
|
5
5
|
|
|
@@ -11,6 +11,48 @@ export class LoginPayload extends LoginDto {
|
|
|
11
11
|
tenant: string;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
/** Segundo passo do login quando 2FA está ativo (RMQ/Kafka → auth-service). */
|
|
15
|
+
export class Login2faPayload {
|
|
16
|
+
@ApiProperty({ description: 'ID do tenant', example: 'tenant1' })
|
|
17
|
+
@IsString()
|
|
18
|
+
@MinLength(1, { message: 'tenant não pode ser vazio' })
|
|
19
|
+
@MaxLength(255)
|
|
20
|
+
tenant: string;
|
|
21
|
+
|
|
22
|
+
@ApiProperty({ description: 'JWT pre_2fa do primeiro passo' })
|
|
23
|
+
@IsString()
|
|
24
|
+
@MinLength(1, { message: 'pre_auth_token não pode ser vazio' })
|
|
25
|
+
pre_auth_token: string;
|
|
26
|
+
|
|
27
|
+
@ApiProperty({ description: 'Código TOTP de 6 dígitos' })
|
|
28
|
+
@IsString()
|
|
29
|
+
@Matches(/^\d{6}$/, { message: 'totp deve ser exatamente 6 dígitos' })
|
|
30
|
+
totp: string;
|
|
31
|
+
|
|
32
|
+
@ApiPropertyOptional({ example: 'Chrome — Windows' })
|
|
33
|
+
@IsOptional()
|
|
34
|
+
@IsString()
|
|
35
|
+
@MaxLength(255)
|
|
36
|
+
device_name?: string;
|
|
37
|
+
|
|
38
|
+
@ApiPropertyOptional({ enum: ['web', 'mobile', 'api'] })
|
|
39
|
+
@IsOptional()
|
|
40
|
+
@IsIn(['web', 'mobile', 'api'])
|
|
41
|
+
device_type?: 'web' | 'mobile' | 'api';
|
|
42
|
+
|
|
43
|
+
@ApiPropertyOptional()
|
|
44
|
+
@IsOptional()
|
|
45
|
+
@IsString()
|
|
46
|
+
@MaxLength(64)
|
|
47
|
+
ip_address?: string | null;
|
|
48
|
+
|
|
49
|
+
@ApiPropertyOptional()
|
|
50
|
+
@IsOptional()
|
|
51
|
+
@IsString()
|
|
52
|
+
@MaxLength(255)
|
|
53
|
+
location?: string | null;
|
|
54
|
+
}
|
|
55
|
+
|
|
14
56
|
export class ValidatePayload {
|
|
15
57
|
@ApiProperty({ description: 'ID do tenant', example: 'tenant1' })
|
|
16
58
|
@IsString()
|
|
@@ -1,15 +1,26 @@
|
|
|
1
|
-
import { ApiProperty } from '@nestjs/swagger';
|
|
1
|
+
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
|
2
2
|
|
|
3
3
|
export class AuthLoginResponseDto {
|
|
4
|
-
@ApiProperty({
|
|
5
|
-
|
|
4
|
+
@ApiProperty({
|
|
5
|
+
description:
|
|
6
|
+
'Se true, o cliente deve enviar pre_auth_token e código TOTP em POST /auth/login-2fa (ou login-health-2fa)',
|
|
7
|
+
})
|
|
8
|
+
two_factor_required: boolean;
|
|
9
|
+
|
|
10
|
+
@ApiPropertyOptional({
|
|
11
|
+
description: 'JWT de curta duração; presente quando two_factor_required é true',
|
|
12
|
+
})
|
|
13
|
+
pre_auth_token?: string;
|
|
6
14
|
|
|
7
|
-
@
|
|
8
|
-
|
|
15
|
+
@ApiPropertyOptional({ description: 'Presente quando two_factor_required é false' })
|
|
16
|
+
access_token?: string;
|
|
9
17
|
|
|
10
|
-
@
|
|
18
|
+
@ApiPropertyOptional({ description: 'Presente quando two_factor_required é false' })
|
|
19
|
+
refresh_token?: string;
|
|
20
|
+
|
|
21
|
+
@ApiPropertyOptional({
|
|
11
22
|
description: 'Indica se o usuário deve alterar a senha no primeiro acesso',
|
|
12
23
|
example: true,
|
|
13
24
|
})
|
|
14
|
-
force_change_password
|
|
25
|
+
force_change_password?: boolean;
|
|
15
26
|
}
|
package/src/auth/index.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { LoginDto } from './login.dto';
|
|
2
2
|
export {
|
|
3
3
|
LoginPayload,
|
|
4
|
+
Login2faPayload,
|
|
4
5
|
ValidatePayload,
|
|
5
6
|
RefreshPayload,
|
|
6
7
|
GetProfilePayload,
|
|
@@ -11,3 +12,9 @@ export { RefreshTokenDto } from './refresh-token.dto';
|
|
|
11
12
|
export { RequestPasswordResetDto } from './request-password-reset.dto';
|
|
12
13
|
export { ConfirmPasswordResetDto } from './confirm-password-reset.dto';
|
|
13
14
|
export { AuthLoginResponseDto } from './auth-login-response.dto';
|
|
15
|
+
export { Login2faDto } from './login-2fa.dto';
|
|
16
|
+
export {
|
|
17
|
+
TotpSetupConfirmDto,
|
|
18
|
+
TotpDisableDto,
|
|
19
|
+
TotpSetupStartResponseDto,
|
|
20
|
+
} from './totp-user.dto';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ApiProperty } from '@nestjs/swagger';
|
|
2
|
+
import { IsString, Matches, MinLength } from 'class-validator';
|
|
3
|
+
|
|
4
|
+
export class Login2faDto {
|
|
5
|
+
@ApiProperty({ description: 'JWT retornado no primeiro passo do login (two_factor_required)' })
|
|
6
|
+
@IsString()
|
|
7
|
+
@MinLength(1, { message: 'pre_auth_token não pode ser vazio' })
|
|
8
|
+
pre_auth_token: string;
|
|
9
|
+
|
|
10
|
+
@ApiProperty({ description: 'Código TOTP de 6 dígitos do aplicativo autenticador' })
|
|
11
|
+
@IsString()
|
|
12
|
+
@Matches(/^\d{6}$/, { message: 'totp deve ser exatamente 6 dígitos' })
|
|
13
|
+
totp: string;
|
|
14
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ApiProperty } from '@nestjs/swagger';
|
|
2
|
+
import { IsString, Matches, MinLength } from 'class-validator';
|
|
3
|
+
|
|
4
|
+
export class TotpSetupConfirmDto {
|
|
5
|
+
@ApiProperty({ description: 'Código TOTP de 6 dígitos para confirmar o pareamento' })
|
|
6
|
+
@IsString()
|
|
7
|
+
@Matches(/^\d{6}$/, { message: 'totp deve ser exatamente 6 dígitos' })
|
|
8
|
+
totp: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export class TotpDisableDto {
|
|
12
|
+
@ApiProperty({ description: 'Senha atual do utilizador' })
|
|
13
|
+
@IsString()
|
|
14
|
+
@MinLength(1, { message: 'current_password não pode ser vazio' })
|
|
15
|
+
current_password: string;
|
|
16
|
+
|
|
17
|
+
@ApiProperty({ description: 'Código TOTP atual de 6 dígitos' })
|
|
18
|
+
@IsString()
|
|
19
|
+
@Matches(/^\d{6}$/, { message: 'totp deve ser exatamente 6 dígitos' })
|
|
20
|
+
totp: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export class TotpSetupStartResponseDto {
|
|
24
|
+
@ApiProperty({ description: 'URI otpauth para QR code' })
|
|
25
|
+
otpauth_url: string;
|
|
26
|
+
|
|
27
|
+
@ApiProperty({ description: 'Segredo em Base32 para entrada manual' })
|
|
28
|
+
secret_base32: string;
|
|
29
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export {
|
|
2
2
|
NotificationUserCreatedEventPayload,
|
|
3
3
|
NotificationPasswordResetRequestedEventPayload,
|
|
4
|
+
NotificationNewDeviceLoginEventPayload,
|
|
4
5
|
NotificationConversationChangeToHumanEventPayload,
|
|
5
6
|
NotificationTenantAiTokensThresholdEventPayload,
|
|
6
7
|
} from './notifications-kafka.payloads';
|
|
@@ -108,6 +108,68 @@ export class NotificationPasswordResetRequestedEventPayload {
|
|
|
108
108
|
occurredAt: string;
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
+
/**
|
|
112
|
+
* Evento RabbitMQ `notifications.new_device_login` — alerta de login a partir de um perfil de
|
|
113
|
+
* dispositivo ainda não registado para o utilizador (par deviceName + deviceType após normalização no auth).
|
|
114
|
+
*/
|
|
115
|
+
export class NotificationNewDeviceLoginEventPayload {
|
|
116
|
+
@ApiProperty({
|
|
117
|
+
description: 'Idempotência',
|
|
118
|
+
example: '2d3ecf0d-8d38-4b95-95c8-d3e903e6f1fe',
|
|
119
|
+
})
|
|
120
|
+
@IsUUID()
|
|
121
|
+
eventId: string;
|
|
122
|
+
|
|
123
|
+
@ApiProperty({ example: 'default' })
|
|
124
|
+
@IsString()
|
|
125
|
+
@MinLength(1)
|
|
126
|
+
@MaxLength(255)
|
|
127
|
+
tenant: string;
|
|
128
|
+
|
|
129
|
+
@ApiProperty()
|
|
130
|
+
@IsUUID()
|
|
131
|
+
userId: string;
|
|
132
|
+
|
|
133
|
+
@ApiProperty({ example: 'maria.silva@example.com' })
|
|
134
|
+
@IsEmail()
|
|
135
|
+
@MaxLength(255)
|
|
136
|
+
email: string;
|
|
137
|
+
|
|
138
|
+
@ApiProperty({ example: 'Maria Silva' })
|
|
139
|
+
@IsString()
|
|
140
|
+
@MinLength(1)
|
|
141
|
+
@MaxLength(255)
|
|
142
|
+
name: string;
|
|
143
|
+
|
|
144
|
+
@ApiProperty({ example: 'Chrome on Windows' })
|
|
145
|
+
@IsString()
|
|
146
|
+
@MinLength(1)
|
|
147
|
+
@MaxLength(255)
|
|
148
|
+
deviceName: string;
|
|
149
|
+
|
|
150
|
+
@ApiProperty({ example: 'web' })
|
|
151
|
+
@IsString()
|
|
152
|
+
@MinLength(1)
|
|
153
|
+
@MaxLength(32)
|
|
154
|
+
deviceType: string;
|
|
155
|
+
|
|
156
|
+
@ApiPropertyOptional({ example: '203.0.113.10' })
|
|
157
|
+
@IsOptional()
|
|
158
|
+
@IsString()
|
|
159
|
+
@MaxLength(64)
|
|
160
|
+
ipAddress?: string;
|
|
161
|
+
|
|
162
|
+
@ApiPropertyOptional({ example: 'Lisboa, PT' })
|
|
163
|
+
@IsOptional()
|
|
164
|
+
@IsString()
|
|
165
|
+
@MaxLength(255)
|
|
166
|
+
location?: string;
|
|
167
|
+
|
|
168
|
+
@ApiProperty({ example: '2026-03-22T12:30:00.000Z' })
|
|
169
|
+
@IsISO8601()
|
|
170
|
+
occurredAt: string;
|
|
171
|
+
}
|
|
172
|
+
|
|
111
173
|
/** Evento Kafka `notifications.conversation-change-to-human` (IA ou clínica → fila humana). */
|
|
112
174
|
export class NotificationConversationChangeToHumanEventPayload {
|
|
113
175
|
@ApiProperty({ description: 'Idempotência' })
|