@umapi/contracts 1.0.23 → 1.0.24

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.
@@ -0,0 +1,9 @@
1
+ import { AuthMethod } from '../interfaces';
2
+ /**
3
+ * DTO для привязки нового идентификатора к пользователю
4
+ */
5
+ export declare class BindIdentifierRequestDto {
6
+ identifier: string;
7
+ method: AuthMethod;
8
+ }
9
+ //# sourceMappingURL=bind-identifier-request.dto.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bind-identifier-request.dto.d.ts","sourceRoot":"","sources":["../../src/dto/bind-identifier-request.dto.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAI3C;;GAEG;AACH,qBAAa,wBAAwB;IAmBjC,UAAU,EAAG,MAAM,CAAC;IAQpB,MAAM,EAAG,UAAU,CAAC;CACvB"}
@@ -0,0 +1,55 @@
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.BindIdentifierRequestDto = void 0;
13
+ const swagger_1 = require("@nestjs/swagger");
14
+ const class_validator_1 = require("class-validator");
15
+ const class_transformer_1 = require("class-transformer");
16
+ const interfaces_1 = require("../interfaces");
17
+ const phone_helper_1 = require("../helpers/phone.helper");
18
+ const phone_validator_1 = require("../validators/phone.validator");
19
+ /**
20
+ * DTO для привязки нового идентификатора к пользователю
21
+ */
22
+ class BindIdentifierRequestDto {
23
+ }
24
+ exports.BindIdentifierRequestDto = BindIdentifierRequestDto;
25
+ __decorate([
26
+ (0, swagger_1.ApiProperty)({
27
+ description: 'Идентификатор пользователя (телефон или email)',
28
+ required: true,
29
+ example: '+79991234567'
30
+ }),
31
+ (0, class_validator_1.IsNotEmpty)({ message: 'Идентификатор обязателен' }),
32
+ (0, class_validator_1.IsString)(),
33
+ (0, class_transformer_1.Transform)(({ value, obj }) => {
34
+ // Нормализуем телефон, если метод OTP_PHONE
35
+ if (obj.method === interfaces_1.AuthMethod.OTP_PHONE) {
36
+ return phone_helper_1.PhoneHelper.normalize(value) || value; // Если нормализация не удалась, возвращаем оригинал
37
+ }
38
+ return value;
39
+ }),
40
+ (0, class_validator_1.ValidateIf)(o => o.method === interfaces_1.AuthMethod.OTP_PHONE),
41
+ (0, phone_validator_1.IsValidPhone)({ message: 'Неверный формат номера телефона' }),
42
+ (0, class_validator_1.ValidateIf)(o => o.method === interfaces_1.AuthMethod.OTP_EMAIL),
43
+ (0, class_validator_1.IsEmail)({}, { message: 'Неверный формат email' }),
44
+ __metadata("design:type", String)
45
+ ], BindIdentifierRequestDto.prototype, "identifier", void 0);
46
+ __decorate([
47
+ (0, swagger_1.ApiProperty)({
48
+ description: 'Метод аутентификации',
49
+ enum: interfaces_1.AuthMethod,
50
+ example: interfaces_1.AuthMethod.OTP_PHONE
51
+ }),
52
+ (0, class_validator_1.IsEnum)(interfaces_1.AuthMethod),
53
+ __metadata("design:type", String)
54
+ ], BindIdentifierRequestDto.prototype, "method", void 0);
55
+ //# sourceMappingURL=bind-identifier-request.dto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bind-identifier-request.dto.js","sourceRoot":"","sources":["../../src/dto/bind-identifier-request.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAA8C;AAC9C,qDAAoF;AACpF,yDAA8C;AAC9C,8CAA2C;AAC3C,0DAAsD;AACtD,mEAA6D;AAE7D;;GAEG;AACH,MAAa,wBAAwB;CA4BpC;AA5BD,4DA4BC;AATG;IAlBC,IAAA,qBAAW,EAAC;QACT,WAAW,EAAE,gDAAgD;QAC7D,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,cAAc;KAC1B,CAAC;IACD,IAAA,4BAAU,EAAC,EAAE,OAAO,EAAE,0BAA0B,EAAE,CAAC;IACnD,IAAA,0BAAQ,GAAE;IACV,IAAA,6BAAS,EAAC,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE,EAAE;QAC1B,4CAA4C;QAC5C,IAAI,GAAG,CAAC,MAAM,KAAK,uBAAU,CAAC,SAAS,EAAE,CAAC;YACtC,OAAO,0BAAW,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,CAAC,oDAAoD;QACtG,CAAC;QACD,OAAO,KAAK,CAAC;IACjB,CAAC,CAAC;IACD,IAAA,4BAAU,EAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,uBAAU,CAAC,SAAS,CAAC;IAClD,IAAA,8BAAY,EAAC,EAAE,OAAO,EAAE,iCAAiC,EAAE,CAAC;IAC5D,IAAA,4BAAU,EAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,uBAAU,CAAC,SAAS,CAAC;IAClD,IAAA,yBAAO,EAAC,EAAE,EAAE,EAAE,OAAO,EAAE,uBAAuB,EAAE,CAAC;;4DAC9B;AAQpB;IANC,IAAA,qBAAW,EAAC;QACT,WAAW,EAAE,sBAAsB;QACnC,IAAI,EAAE,uBAAU;QAChB,OAAO,EAAE,uBAAU,CAAC,SAAS;KAChC,CAAC;IACD,IAAA,wBAAM,EAAC,uBAAU,CAAC;;wDACC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * DTO для ответа при привязке идентификатора к пользователю
3
+ */
4
+ export declare class BindIdentifierResponseDto {
5
+ status: string;
6
+ message: string;
7
+ user: {
8
+ id: string;
9
+ phone?: string;
10
+ email?: string;
11
+ createdAt: Date;
12
+ };
13
+ }
14
+ //# sourceMappingURL=bind-identifier-response.dto.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bind-identifier-response.dto.d.ts","sourceRoot":"","sources":["../../src/dto/bind-identifier-response.dto.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,qBAAa,yBAAyB;IAKlC,MAAM,EAAG,MAAM,CAAC;IAMhB,OAAO,EAAG,MAAM,CAAC;IAWjB,IAAI,EAAG;QACH,EAAE,EAAE,MAAM,CAAC;QACX,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,SAAS,EAAE,IAAI,CAAC;KACnB,CAAC;CACL"}
@@ -0,0 +1,46 @@
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.BindIdentifierResponseDto = void 0;
13
+ const swagger_1 = require("@nestjs/swagger");
14
+ /**
15
+ * DTO для ответа при привязке идентификатора к пользователю
16
+ */
17
+ class BindIdentifierResponseDto {
18
+ }
19
+ exports.BindIdentifierResponseDto = BindIdentifierResponseDto;
20
+ __decorate([
21
+ (0, swagger_1.ApiProperty)({
22
+ description: 'Статус операции',
23
+ example: 'success'
24
+ }),
25
+ __metadata("design:type", String)
26
+ ], BindIdentifierResponseDto.prototype, "status", void 0);
27
+ __decorate([
28
+ (0, swagger_1.ApiProperty)({
29
+ description: 'Сообщение о результате операции',
30
+ example: 'Идентификатор успешно привязан'
31
+ }),
32
+ __metadata("design:type", String)
33
+ ], BindIdentifierResponseDto.prototype, "message", void 0);
34
+ __decorate([
35
+ (0, swagger_1.ApiProperty)({
36
+ description: 'Информация о пользователе после привязки',
37
+ example: {
38
+ id: 'uuid',
39
+ phone: '+79991234567',
40
+ email: 'user@example.com',
41
+ createdAt: '2023-01-01T00:00:00.000Z'
42
+ }
43
+ }),
44
+ __metadata("design:type", Object)
45
+ ], BindIdentifierResponseDto.prototype, "user", void 0);
46
+ //# sourceMappingURL=bind-identifier-response.dto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bind-identifier-response.dto.js","sourceRoot":"","sources":["../../src/dto/bind-identifier-response.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAA8C;AAE9C;;GAEG;AACH,MAAa,yBAAyB;CA4BrC;AA5BD,8DA4BC;AAvBG;IAJC,IAAA,qBAAW,EAAC;QACT,WAAW,EAAE,iBAAiB;QAC9B,OAAO,EAAE,SAAS;KACrB,CAAC;;yDACc;AAMhB;IAJC,IAAA,qBAAW,EAAC;QACT,WAAW,EAAE,iCAAiC;QAC9C,OAAO,EAAE,gCAAgC;KAC5C,CAAC;;0DACe;AAWjB;IATC,IAAA,qBAAW,EAAC;QACT,WAAW,EAAE,0CAA0C;QACvD,OAAO,EAAE;YACL,EAAE,EAAE,MAAM;YACV,KAAK,EAAE,cAAc;YACrB,KAAK,EAAE,kBAAkB;YACzB,SAAS,EAAE,0BAA0B;SACxC;KACJ,CAAC;;uDAMA"}
@@ -11,4 +11,6 @@ export { ServiceResponse, ServiceResponseErrorDto, ServiceResponseSuccessDto } f
11
11
  export { TokensResponseDto } from './tokens-response.dto';
12
12
  export { UserRequestDto } from './user-request.dto';
13
13
  export { UserResponseDto } from './user-response.dto';
14
+ export { BindIdentifierRequestDto } from './bind-identifier-request.dto';
15
+ export { BindIdentifierResponseDto } from './bind-identifier-response.dto';
14
16
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/dto/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAC5E,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,uBAAuB,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AAC7G,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/dto/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAC5E,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,uBAAuB,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AAC7G,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC"}
package/dist/dto/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UserResponseDto = exports.UserRequestDto = exports.TokensResponseDto = exports.ServiceResponseSuccessDto = exports.ServiceResponseErrorDto = exports.RefreshTokensResponseDto = exports.RefreshTokenRequestDto = exports.OtpVerifyRequestDto = exports.OtpResponseDto = exports.OtpRequestDto = exports.HealthResponseDto = exports.HealthResponseServiceDto = exports.AppInfoServiceResponseDto = exports.AppInfoResponseDto = void 0;
3
+ exports.BindIdentifierResponseDto = exports.BindIdentifierRequestDto = exports.UserResponseDto = exports.UserRequestDto = exports.TokensResponseDto = exports.ServiceResponseSuccessDto = exports.ServiceResponseErrorDto = exports.RefreshTokensResponseDto = exports.RefreshTokenRequestDto = exports.OtpVerifyRequestDto = exports.OtpResponseDto = exports.OtpRequestDto = exports.HealthResponseDto = exports.HealthResponseServiceDto = exports.AppInfoServiceResponseDto = exports.AppInfoResponseDto = void 0;
4
4
  var app_info_response_dto_1 = require("./app-info-response.dto");
5
5
  Object.defineProperty(exports, "AppInfoResponseDto", { enumerable: true, get: function () { return app_info_response_dto_1.AppInfoResponseDto; } });
6
6
  var app_info_service_response_dto_1 = require("./app-info-service-response.dto");
@@ -28,4 +28,8 @@ var user_request_dto_1 = require("./user-request.dto");
28
28
  Object.defineProperty(exports, "UserRequestDto", { enumerable: true, get: function () { return user_request_dto_1.UserRequestDto; } });
29
29
  var user_response_dto_1 = require("./user-response.dto");
30
30
  Object.defineProperty(exports, "UserResponseDto", { enumerable: true, get: function () { return user_response_dto_1.UserResponseDto; } });
31
+ var bind_identifier_request_dto_1 = require("./bind-identifier-request.dto");
32
+ Object.defineProperty(exports, "BindIdentifierRequestDto", { enumerable: true, get: function () { return bind_identifier_request_dto_1.BindIdentifierRequestDto; } });
33
+ var bind_identifier_response_dto_1 = require("./bind-identifier-response.dto");
34
+ Object.defineProperty(exports, "BindIdentifierResponseDto", { enumerable: true, get: function () { return bind_identifier_response_dto_1.BindIdentifierResponseDto; } });
31
35
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/dto/index.ts"],"names":[],"mappings":";;;AAAA,iEAA6D;AAApD,2HAAA,kBAAkB,OAAA;AAC3B,iFAA4E;AAAnE,0IAAA,yBAAyB,OAAA;AAClC,6EAAyE;AAAhE,uIAAA,wBAAwB,OAAA;AACjC,6DAA0D;AAAjD,wHAAA,iBAAiB,OAAA;AAC1B,qDAAkD;AAAzC,gHAAA,aAAa,OAAA;AACtB,uDAAoD;AAA3C,kHAAA,cAAc,OAAA;AACvB,mEAA+D;AAAtD,6HAAA,mBAAmB,OAAA;AAC5B,yEAAqE;AAA5D,mIAAA,sBAAsB,OAAA;AAC/B,6EAAyE;AAAhE,uIAAA,wBAAwB,OAAA;AACjC,+DAA6G;AAAnF,+HAAA,uBAAuB,OAAA;AAAE,iIAAA,yBAAyB,OAAA;AAC5E,6DAA0D;AAAjD,wHAAA,iBAAiB,OAAA;AAC1B,uDAAoD;AAA3C,kHAAA,cAAc,OAAA;AACvB,yDAAsD;AAA7C,oHAAA,eAAe,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/dto/index.ts"],"names":[],"mappings":";;;AAAA,iEAA6D;AAApD,2HAAA,kBAAkB,OAAA;AAC3B,iFAA4E;AAAnE,0IAAA,yBAAyB,OAAA;AAClC,6EAAyE;AAAhE,uIAAA,wBAAwB,OAAA;AACjC,6DAA0D;AAAjD,wHAAA,iBAAiB,OAAA;AAC1B,qDAAkD;AAAzC,gHAAA,aAAa,OAAA;AACtB,uDAAoD;AAA3C,kHAAA,cAAc,OAAA;AACvB,mEAA+D;AAAtD,6HAAA,mBAAmB,OAAA;AAC5B,yEAAqE;AAA5D,mIAAA,sBAAsB,OAAA;AAC/B,6EAAyE;AAAhE,uIAAA,wBAAwB,OAAA;AACjC,+DAA6G;AAAnF,+HAAA,uBAAuB,OAAA;AAAE,iIAAA,yBAAyB,OAAA;AAC5E,6DAA0D;AAAjD,wHAAA,iBAAiB,OAAA;AAC1B,uDAAoD;AAA3C,kHAAA,cAAc,OAAA;AACvB,yDAAsD;AAA7C,oHAAA,eAAe,OAAA;AACxB,6EAAyE;AAAhE,uIAAA,wBAAwB,OAAA;AACjC,+EAA2E;AAAlE,yIAAA,yBAAyB,OAAA"}
@@ -4,8 +4,7 @@ import { AuthMethod } from '../interfaces';
4
4
  */
5
5
  export declare class OtpVerifyRequestDto {
6
6
  method: AuthMethod;
7
- phone?: string;
8
- email?: string;
7
+ identifier: string;
9
8
  code: string;
10
9
  }
11
10
  //# sourceMappingURL=otp-verify-request.dto.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"otp-verify-request.dto.d.ts","sourceRoot":"","sources":["../../src/dto/otp-verify-request.dto.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C;;GAEG;AACH,qBAAa,mBAAmB;IAG5B,MAAM,EAAG,UAAU,CAAC;IAKpB,KAAK,CAAC,EAAE,MAAM,CAAC;IAKf,KAAK,CAAC,EAAE,MAAM,CAAC;IAIf,IAAI,EAAG,MAAM,CAAC;CACjB"}
1
+ {"version":3,"file":"otp-verify-request.dto.d.ts","sourceRoot":"","sources":["../../src/dto/otp-verify-request.dto.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAI3C;;GAEG;AACH,qBAAa,mBAAmB;IAG5B,MAAM,EAAG,UAAU,CAAC;IAoBpB,UAAU,EAAG,MAAM,CAAC;IAIpB,IAAI,EAAG,MAAM,CAAC;CACjB"}
@@ -12,7 +12,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.OtpVerifyRequestDto = void 0;
13
13
  const swagger_1 = require("@nestjs/swagger");
14
14
  const class_validator_1 = require("class-validator");
15
+ const class_transformer_1 = require("class-transformer");
15
16
  const interfaces_1 = require("../interfaces");
17
+ const phone_helper_1 = require("../helpers/phone.helper");
18
+ const phone_validator_1 = require("../validators/phone.validator");
16
19
  /**
17
20
  * DTO для верификации OTP (request)
18
21
  */
@@ -25,17 +28,26 @@ __decorate([
25
28
  __metadata("design:type", String)
26
29
  ], OtpVerifyRequestDto.prototype, "method", void 0);
27
30
  __decorate([
28
- (0, swagger_1.ApiProperty)({ description: 'Номер телефона', required: false, example: '+79991234567' }),
29
- (0, class_validator_1.IsOptional)(),
31
+ (0, swagger_1.ApiProperty)({
32
+ description: 'Идентификатор пользователя (телефон или email)',
33
+ required: true,
34
+ example: '+79991234567'
35
+ }),
36
+ (0, class_validator_1.IsNotEmpty)({ message: 'Идентификатор обязателен' }),
30
37
  (0, class_validator_1.IsString)(),
38
+ (0, class_transformer_1.Transform)(({ value, obj }) => {
39
+ // Нормализуем телефон, если метод OTP_PHONE
40
+ if (obj.method === interfaces_1.AuthMethod.OTP_PHONE) {
41
+ return phone_helper_1.PhoneHelper.normalize(value) || value; // Если нормализация не удалась, возвращаем оригинал
42
+ }
43
+ return value;
44
+ }),
45
+ (0, class_validator_1.ValidateIf)(o => o.method === interfaces_1.AuthMethod.OTP_PHONE),
46
+ (0, phone_validator_1.IsValidPhone)({ message: 'Неверный формат номера телефона' }),
47
+ (0, class_validator_1.ValidateIf)(o => o.method === interfaces_1.AuthMethod.OTP_EMAIL),
48
+ (0, class_validator_1.IsEmail)({}, { message: 'Неверный формат email' }),
31
49
  __metadata("design:type", String)
32
- ], OtpVerifyRequestDto.prototype, "phone", void 0);
33
- __decorate([
34
- (0, swagger_1.ApiProperty)({ description: 'Адрес электронной почты', required: false, example: 'user@example.com' }),
35
- (0, class_validator_1.IsOptional)(),
36
- (0, class_validator_1.IsEmail)(),
37
- __metadata("design:type", String)
38
- ], OtpVerifyRequestDto.prototype, "email", void 0);
50
+ ], OtpVerifyRequestDto.prototype, "identifier", void 0);
39
51
  __decorate([
40
52
  (0, swagger_1.ApiProperty)({ description: 'OTP код', example: '123456' }),
41
53
  (0, class_validator_1.IsString)(),
@@ -1 +1 @@
1
- {"version":3,"file":"otp-verify-request.dto.js","sourceRoot":"","sources":["../../src/dto/otp-verify-request.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAA8C;AAC9C,qDAAwE;AACxE,8CAA2C;AAE3C;;GAEG;AACH,MAAa,mBAAmB;CAkB/B;AAlBD,kDAkBC;AAfG;IAFC,IAAA,qBAAW,EAAC,EAAE,WAAW,EAAE,sBAAsB,EAAE,IAAI,EAAE,uBAAU,EAAE,OAAO,EAAE,uBAAU,CAAC,SAAS,EAAE,CAAC;IACrG,IAAA,wBAAM,EAAC,uBAAU,CAAC;;mDACC;AAKpB;IAHC,IAAA,qBAAW,EAAC,EAAE,WAAW,EAAE,gBAAgB,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,CAAC;IACxF,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;kDACI;AAKf;IAHC,IAAA,qBAAW,EAAC,EAAE,WAAW,EAAE,yBAAyB,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,kBAAkB,EAAE,CAAC;IACrG,IAAA,4BAAU,GAAE;IACZ,IAAA,yBAAO,GAAE;;kDACK;AAIf;IAFC,IAAA,qBAAW,EAAC,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC;IAC1D,IAAA,0BAAQ,GAAE;;iDACG"}
1
+ {"version":3,"file":"otp-verify-request.dto.js","sourceRoot":"","sources":["../../src/dto/otp-verify-request.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAA8C;AAC9C,qDAAoF;AACpF,yDAA8C;AAC9C,8CAA2C;AAC3C,0DAAsD;AACtD,mEAA6D;AAE7D;;GAEG;AACH,MAAa,mBAAmB;CA4B/B;AA5BD,kDA4BC;AAzBG;IAFC,IAAA,qBAAW,EAAC,EAAE,WAAW,EAAE,sBAAsB,EAAE,IAAI,EAAE,uBAAU,EAAE,OAAO,EAAE,uBAAU,CAAC,SAAS,EAAE,CAAC;IACrG,IAAA,wBAAM,EAAC,uBAAU,CAAC;;mDACC;AAoBpB;IAlBC,IAAA,qBAAW,EAAC;QACT,WAAW,EAAE,gDAAgD;QAC7D,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,cAAc;KAC1B,CAAC;IACD,IAAA,4BAAU,EAAC,EAAE,OAAO,EAAE,0BAA0B,EAAE,CAAC;IACnD,IAAA,0BAAQ,GAAE;IACV,IAAA,6BAAS,EAAC,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE,EAAE;QAC1B,4CAA4C;QAC5C,IAAI,GAAG,CAAC,MAAM,KAAK,uBAAU,CAAC,SAAS,EAAE,CAAC;YACtC,OAAO,0BAAW,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,CAAC,oDAAoD;QACtG,CAAC;QACD,OAAO,KAAK,CAAC;IACjB,CAAC,CAAC;IACD,IAAA,4BAAU,EAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,uBAAU,CAAC,SAAS,CAAC;IAClD,IAAA,8BAAY,EAAC,EAAE,OAAO,EAAE,iCAAiC,EAAE,CAAC;IAC5D,IAAA,4BAAU,EAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,uBAAU,CAAC,SAAS,CAAC;IAClD,IAAA,yBAAO,EAAC,EAAE,EAAE,EAAE,OAAO,EAAE,uBAAuB,EAAE,CAAC;;uDAC9B;AAIpB;IAFC,IAAA,qBAAW,EAAC,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC;IAC1D,IAAA,0BAAQ,GAAE;;iDACG"}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,6 @@
1
1
  export * from './dto';
2
2
  export * from './interfaces';
3
3
  export * from './helpers/phone.helper';
4
+ export * from './dto/bind-identifier-request.dto';
5
+ export * from './dto/bind-identifier-response.dto';
4
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,OAAO,CAAC;AACtB,cAAc,cAAc,CAAC;AAC7B,cAAc,wBAAwB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,OAAO,CAAC;AACtB,cAAc,cAAc,CAAC;AAC7B,cAAc,wBAAwB,CAAC;AACvC,cAAc,mCAAmC,CAAC;AAClD,cAAc,oCAAoC,CAAC"}
package/dist/index.js CHANGED
@@ -18,4 +18,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
18
18
  __exportStar(require("./dto"), exports);
19
19
  __exportStar(require("./interfaces"), exports);
20
20
  __exportStar(require("./helpers/phone.helper"), exports);
21
+ __exportStar(require("./dto/bind-identifier-request.dto"), exports);
22
+ __exportStar(require("./dto/bind-identifier-response.dto"), exports);
21
23
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0BAA0B;AAC1B,wCAAsB;AACtB,+CAA6B;AAC7B,yDAAuC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0BAA0B;AAC1B,wCAAsB;AACtB,+CAA6B;AAC7B,yDAAuC;AACvC,oEAAkD;AAClD,qEAAmD"}
@@ -8,6 +8,12 @@ export interface AuthUser {
8
8
  roles: string[];
9
9
  /** Скопы пользователя */
10
10
  scopes: string[];
11
+ /** Телефон пользователя */
12
+ phone?: string;
13
+ /** Email пользователя */
14
+ email?: string;
15
+ /** Дата создания */
16
+ createdAt?: Date;
11
17
  }
12
18
  /**
13
19
  * Методы аутентификации
@@ -1 +1 @@
1
- {"version":3,"file":"auth.interface.d.ts","sourceRoot":"","sources":["../../src/interfaces/auth.interface.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,QAAQ;IACrB,sBAAsB;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,wBAAwB;IACxB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,yBAAyB;IACzB,MAAM,EAAE,MAAM,EAAE,CAAC;CACpB;AAED;;GAEG;AACH,oBAAY,UAAU;IAClB,SAAS,cAAc;IACvB,SAAS,cAAc;IACvB,QAAQ,aAAa;IACrB,KAAK,UAAU;IACf,OAAO,YAAY;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IACzB;;;OAGG;IACH,OAAO,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEjC;;;;OAIG;IACH,MAAM,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;CACvC"}
1
+ {"version":3,"file":"auth.interface.d.ts","sourceRoot":"","sources":["../../src/interfaces/auth.interface.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,QAAQ;IACrB,sBAAsB;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,wBAAwB;IACxB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,yBAAyB;IACzB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,2BAA2B;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,yBAAyB;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oBAAoB;IACpB,SAAS,CAAC,EAAE,IAAI,CAAC;CACpB;AAED;;GAEG;AACH,oBAAY,UAAU;IAClB,SAAS,cAAc;IACvB,SAAS,cAAc;IACvB,QAAQ,aAAa;IACrB,KAAK,UAAU;IACf,OAAO,YAAY;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IACzB;;;OAGG;IACH,OAAO,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEjC;;;;OAIG;IACH,MAAM,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;CACvC"}
@@ -1 +1 @@
1
- {"version":3,"file":"auth.interface.js","sourceRoot":"","sources":["../../src/interfaces/auth.interface.ts"],"names":[],"mappings":";;;AAYA;;GAEG;AACH,IAAY,UAMX;AAND,WAAY,UAAU;IAClB,qCAAuB,CAAA;IACvB,qCAAuB,CAAA;IACvB,mCAAqB,CAAA;IACrB,6BAAe,CAAA;IACf,iCAAmB,CAAA;AACvB,CAAC,EANW,UAAU,0BAAV,UAAU,QAMrB"}
1
+ {"version":3,"file":"auth.interface.js","sourceRoot":"","sources":["../../src/interfaces/auth.interface.ts"],"names":[],"mappings":";;;AAkBA;;GAEG;AACH,IAAY,UAMX;AAND,WAAY,UAAU;IAClB,qCAAuB,CAAA;IACvB,qCAAuB,CAAA;IACvB,mCAAqB,CAAA;IACrB,6BAAe,CAAA;IACf,iCAAmB,CAAA;AACvB,CAAC,EANW,UAAU,0BAAV,UAAU,QAMrB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umapi/contracts",
3
- "version": "1.0.23",
3
+ "version": "1.0.24",
4
4
  "description": "Shared contracts for UMAPI microservices",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",