@cryptexlabs/codex-nodejs-common 0.12.1 → 0.12.3

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/lib/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cryptexlabs/codex-nodejs-common",
3
- "version": "0.12.1",
3
+ "version": "0.12.3",
4
4
  "description": "Common code for Codex framework",
5
5
  "main": "lib/src/index.js",
6
6
  "type": "commonjs",
@@ -3,18 +3,22 @@ import { EmailDto } from "./email.dto";
3
3
  import { PhoneDto } from "./phone.dto";
4
4
  import { PhotoDto } from "./photo.dto";
5
5
  import { NameDto } from "./name.dto";
6
+ declare class EmailsDto {
7
+ primary: EmailDto | null;
8
+ other: EmailDto[];
9
+ }
10
+ declare class PhonesDto {
11
+ primary: PhoneDto | null;
12
+ other: PhoneDto[];
13
+ }
14
+ declare class PhotosDto {
15
+ primary: PhotoDto | null;
16
+ other: PhotoDto[];
17
+ }
6
18
  export declare class ProfileDto implements ProfileInterface {
7
- email: {
8
- primary: EmailDto | null;
9
- other: EmailDto[];
10
- };
11
- phone: {
12
- primary: PhoneDto | null;
13
- other: PhoneDto[];
14
- };
15
- photo: {
16
- primary: PhotoDto | null;
17
- other: PhotoDto[];
18
- };
19
+ email: EmailsDto;
20
+ phone: PhonesDto;
21
+ photo: PhotosDto;
19
22
  name: NameDto;
20
23
  }
24
+ export {};
@@ -1,7 +1,81 @@
1
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
+ };
2
11
  Object.defineProperty(exports, "__esModule", { value: true });
3
12
  exports.ProfileDto = void 0;
13
+ const email_dto_1 = require("./email.dto");
14
+ const phone_dto_1 = require("./phone.dto");
15
+ const photo_dto_1 = require("./photo.dto");
16
+ const name_dto_1 = require("./name.dto");
17
+ const class_validator_1 = require("class-validator");
18
+ const class_transformer_1 = require("class-transformer");
19
+ class EmailsDto {
20
+ }
21
+ __decorate([
22
+ (0, class_validator_1.ValidateNested)(),
23
+ (0, class_transformer_1.Type)(() => email_dto_1.EmailDto),
24
+ __metadata("design:type", email_dto_1.EmailDto)
25
+ ], EmailsDto.prototype, "primary", void 0);
26
+ __decorate([
27
+ (0, class_validator_1.IsArray)(),
28
+ (0, class_validator_1.ValidateNested)({ each: true }),
29
+ (0, class_transformer_1.Type)(() => email_dto_1.EmailDto),
30
+ __metadata("design:type", Array)
31
+ ], EmailsDto.prototype, "other", void 0);
32
+ class PhonesDto {
33
+ }
34
+ __decorate([
35
+ (0, class_validator_1.ValidateNested)(),
36
+ (0, class_transformer_1.Type)(() => phone_dto_1.PhoneDto),
37
+ __metadata("design:type", phone_dto_1.PhoneDto)
38
+ ], PhonesDto.prototype, "primary", void 0);
39
+ __decorate([
40
+ (0, class_validator_1.IsArray)(),
41
+ (0, class_validator_1.ValidateNested)({ each: true }),
42
+ (0, class_transformer_1.Type)(() => phone_dto_1.PhoneDto),
43
+ __metadata("design:type", Array)
44
+ ], PhonesDto.prototype, "other", void 0);
45
+ class PhotosDto {
46
+ }
47
+ __decorate([
48
+ (0, class_validator_1.ValidateNested)(),
49
+ (0, class_transformer_1.Type)(() => photo_dto_1.PhotoDto),
50
+ __metadata("design:type", photo_dto_1.PhotoDto)
51
+ ], PhotosDto.prototype, "primary", void 0);
52
+ __decorate([
53
+ (0, class_validator_1.IsArray)(),
54
+ (0, class_validator_1.ValidateNested)({ each: true }),
55
+ (0, class_transformer_1.Type)(() => photo_dto_1.PhotoDto),
56
+ __metadata("design:type", Array)
57
+ ], PhotosDto.prototype, "other", void 0);
4
58
  class ProfileDto {
5
59
  }
6
60
  exports.ProfileDto = ProfileDto;
61
+ __decorate([
62
+ (0, class_validator_1.ValidateNested)(),
63
+ (0, class_transformer_1.Type)(() => EmailsDto),
64
+ __metadata("design:type", EmailsDto)
65
+ ], ProfileDto.prototype, "email", void 0);
66
+ __decorate([
67
+ (0, class_validator_1.ValidateNested)(),
68
+ (0, class_transformer_1.Type)(() => PhonesDto),
69
+ __metadata("design:type", PhonesDto)
70
+ ], ProfileDto.prototype, "phone", void 0);
71
+ __decorate([
72
+ (0, class_validator_1.ValidateNested)(),
73
+ (0, class_transformer_1.Type)(() => PhotosDto),
74
+ __metadata("design:type", PhotosDto)
75
+ ], ProfileDto.prototype, "photo", void 0);
76
+ __decorate([
77
+ (0, class_validator_1.ValidateNested)(),
78
+ (0, class_transformer_1.Type)(() => name_dto_1.NameDto),
79
+ __metadata("design:type", name_dto_1.NameDto)
80
+ ], ProfileDto.prototype, "name", void 0);
7
81
  //# sourceMappingURL=profile.dto.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"profile.dto.js","sourceRoot":"","sources":["../../../src/dto/profile.dto.ts"],"names":[],"mappings":";;;AAYA,MAAa,UAAU;CAiBtB;AAjBD,gCAiBC"}
1
+ {"version":3,"file":"profile.dto.js","sourceRoot":"","sources":["../../../src/dto/profile.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,2CAAuC;AACvC,2CAAuC;AACvC,2CAAuC;AACvC,yCAAqC;AACrC,qDAA0D;AAC1D,yDAAyC;AAEzC,MAAM,SAAS;CASd;AANC;IAFC,IAAA,gCAAc,GAAE;IAChB,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,oBAAQ,CAAC;8BACZ,oBAAQ;0CAAQ;AAKzB;IAHC,IAAA,yBAAO,GAAE;IACT,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) {
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.UserDto = void 0;
13
13
  const class_validator_1 = require("class-validator");
14
+ const profile_dto_1 = require("./profile.dto");
14
15
  const decorator_1 = require("../decorator");
16
+ const class_transformer_1 = require("class-transformer");
15
17
  class UserDto {
16
18
  }
17
19
  exports.UserDto = UserDto;
@@ -19,6 +21,11 @@ __decorate([
19
21
  (0, class_validator_1.IsString)(),
20
22
  __metadata("design:type", String)
21
23
  ], UserDto.prototype, "username", void 0);
24
+ __decorate([
25
+ (0, class_validator_1.ValidateNested)(),
26
+ (0, class_transformer_1.Type)(() => profile_dto_1.ProfileDto),
27
+ __metadata("design:type", profile_dto_1.ProfileDto)
28
+ ], UserDto.prototype, "profile", void 0);
22
29
  __decorate([
23
30
  (0, decorator_1.IsValidUtcTimezone)(),
24
31
  __metadata("design:type", String)
@@ -1 +1 @@
1
- {"version":3,"file":"user.dto.js","sourceRoot":"","sources":["../../../src/dto/user.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,qDAA2C;AAE3C,4CAAkD;AAElD,MAAa,OAAO;CAQnB;AARD,0BAQC;AANC;IADC,IAAA,0BAAQ,GAAE;;yCACM;AAKjB;IADC,IAAA,8BAAkB,GAAE;;yCACC"}
1
+ {"version":3,"file":"user.dto.js","sourceRoot":"","sources":["../../../src/dto/user.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,qDAA2D;AAC3D,+CAA2C;AAC3C,4CAAkD;AAClD,yDAAyC;AAEzC,MAAa,OAAO;CAUnB;AAVD,0BAUC;AARC;IADC,IAAA,0BAAQ,GAAE;;yCACM;AAIjB;IAFC,IAAA,gCAAc,GAAE;IAChB,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,wBAAU,CAAC;8BACd,wBAAU;wCAAC;AAGpB;IADC,IAAA,8BAAkB,GAAE;;yCACC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cryptexlabs/codex-nodejs-common",
3
- "version": "0.12.1",
3
+ "version": "0.12.3",
4
4
  "description": "Common code for Codex framework",
5
5
  "main": "lib/src/index.js",
6
6
  "type": "commonjs",
@@ -1,30 +1,58 @@
1
- import {
2
- EmailInterface,
3
- NameInterface,
4
- PhoneInterface,
5
- PhotoInterface,
6
- ProfileInterface,
7
- } from "@cryptexlabs/authf-data-model";
1
+ import { ProfileInterface } from "@cryptexlabs/authf-data-model";
8
2
  import { EmailDto } from "./email.dto";
9
3
  import { PhoneDto } from "./phone.dto";
10
4
  import { PhotoDto } from "./photo.dto";
11
5
  import { NameDto } from "./name.dto";
6
+ import { ValidateNested, IsArray } from "class-validator";
7
+ import { Type } from "class-transformer";
8
+
9
+ class EmailsDto {
10
+ @ValidateNested()
11
+ @Type(() => EmailDto)
12
+ primary: EmailDto | null;
13
+
14
+ @IsArray()
15
+ @ValidateNested({ each: true })
16
+ @Type(() => EmailDto)
17
+ other: EmailDto[];
18
+ }
19
+
20
+ class PhonesDto {
21
+ @ValidateNested()
22
+ @Type(() => PhoneDto)
23
+ primary: PhoneDto | null;
24
+
25
+ @IsArray()
26
+ @ValidateNested({ each: true })
27
+ @Type(() => PhoneDto)
28
+ other: PhoneDto[];
29
+ }
30
+
31
+ class PhotosDto {
32
+ @ValidateNested()
33
+ @Type(() => PhotoDto)
34
+ primary: PhotoDto | null;
35
+
36
+ @IsArray()
37
+ @ValidateNested({ each: true })
38
+ @Type(() => PhotoDto)
39
+ other: PhotoDto[];
40
+ }
12
41
 
13
42
  export class ProfileDto implements ProfileInterface {
14
- email: {
15
- primary: EmailDto | null;
16
- other: EmailDto[];
17
- };
43
+ @ValidateNested()
44
+ @Type(() => EmailsDto)
45
+ email: EmailsDto;
18
46
 
19
- phone: {
20
- primary: PhoneDto | null;
21
- other: PhoneDto[];
22
- };
47
+ @ValidateNested()
48
+ @Type(() => PhonesDto)
49
+ phone: PhonesDto;
23
50
 
24
- photo: {
25
- primary: PhotoDto | null;
26
- other: PhotoDto[];
27
- };
51
+ @ValidateNested()
52
+ @Type(() => PhotosDto)
53
+ photo: PhotosDto;
28
54
 
55
+ @ValidateNested()
56
+ @Type(() => NameDto)
29
57
  name: NameDto;
30
58
  }
@@ -1,12 +1,15 @@
1
1
  import { UserInterface, UtcTimezone } from "@cryptexlabs/authf-data-model";
2
- import { IsString } from "class-validator";
2
+ import { IsString, ValidateNested } from "class-validator";
3
3
  import { ProfileDto } from "./profile.dto";
4
4
  import { IsValidUtcTimezone } from "../decorator";
5
+ import { Type } from "class-transformer";
5
6
 
6
7
  export class UserDto implements UserInterface {
7
8
  @IsString()
8
9
  username: string;
9
10
 
11
+ @ValidateNested()
12
+ @Type(() => ProfileDto)
10
13
  profile: ProfileDto;
11
14
 
12
15
  @IsValidUtcTimezone()