@cryptexlabs/codex-nodejs-common 0.12.6 → 0.12.7

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.6",
3
+ "version": "0.12.7",
4
4
  "description": "Common code for Codex framework",
5
5
  "main": "lib/src/index.js",
6
6
  "type": "commonjs",
@@ -45,13 +45,27 @@ let AuthfGuard = class AuthfGuard {
45
45
  const token = request.headers.authorization.replace("Bearer ", "");
46
46
  let decodedToken;
47
47
  try {
48
+ if (!token || token.split(".").length !== 3) {
49
+ throw new common_1.UnauthorizedException("Malformed token: Not a valid JWT");
50
+ }
48
51
  jwt.verify(token, this._pem, {
49
52
  algorithms: [this._jwk.alg],
50
53
  });
51
54
  decodedToken = jwt.decode(token);
52
55
  }
53
56
  catch (err) {
54
- throw new common_1.UnauthorizedException(`Invalid token`);
57
+ if (err.name === "TokenExpiredError") {
58
+ throw new common_1.UnauthorizedException("Token has expired");
59
+ }
60
+ else if (err.name === "JsonWebTokenError") {
61
+ throw new common_1.UnauthorizedException(`Invalid token: ${err.message}`);
62
+ }
63
+ else if (err instanceof common_1.UnauthorizedException) {
64
+ throw err;
65
+ }
66
+ else {
67
+ throw new common_1.UnauthorizedException("Token verification failed");
68
+ }
55
69
  }
56
70
  if (this._blacklistedSubjects.includes(decodedToken.sub)) {
57
71
  throw new common_1.UnauthorizedException();
@@ -1 +1 @@
1
- {"version":3,"file":"authf.guard.js","sourceRoot":"","sources":["../../../src/auth/authf.guard.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,sCAA0C;AAC1C,2CAMwB;AAKxB,iCAA0B;AAC1B,+BAAoC;AACpC,wCAAqD;AACrD,uCAAuC;AACvC,oCAAoC;AAI7B,IAAM,UAAU,GAAhB,MAAM,UAAU;IAKrB,YACqC,MAAqB,EACZ,cAA8B;QADv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IAAI,MAAK,SAAS;YACjD,KAAK,CAAC,OAAO,CAAC,MAAA,wBAAwB,CAAC,IAAI,0CAAE,IAAI,CAAC,EAClD,CAAC;YACD,IACE,IAAI,CAAC,oBAAoB,CAAC,MAAM,MAAK,MAAA,wBAAwB,CAAC,IAAI,0CAAE,IAAI,CAAA,EACxE,CAAC;gBACD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,yBAAyB,EAAE;oBAC9C,GAAG,EAAE,IAAI,CAAC,oBAAoB;oBAC9B,GAAG,EAAE,MAAA,wBAAwB,CAAC,IAAI,0CAAE,IAAI;iBACzC,CAAC,CAAC;YACL,CAAC;iBAAM,IAAI,IAAI,CAAC,oBAAoB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAChD,OAAO,CAAC,MAAM,CAAC,OAAO,CACpB,eAAe,EACf,MAAA,wBAAwB,CAAC,IAAI,0CAAE,IAAI,CACpC,CAAC;YACJ,CAAC;YACD,IAAI,CAAC,oBAAoB,GAAG,MAAA,wBAAwB,CAAC,IAAI,0CAAE,IAAI,CAAC;QAClE,CAAC;IACH,CAAC;CACF,CAAA;AAjJY,gCAAU;qBAAV,UAAU;IADtB,IAAA,mBAAU,GAAE;IAOR,WAAA,IAAA,eAAM,EAAC,QAAQ,CAAC,CAAA;IAChB,WAAA,IAAA,eAAM,EAAC,iBAAiB,CAAC,CAAA;qCADiB,sBAAa;QACI,wBAAc;GAPjE,UAAU,CAiJtB"}
@@ -3,7 +3,6 @@ export * from "./client";
3
3
  export * from "./config";
4
4
  export * from "./context";
5
5
  export * from "./decorator";
6
- export * from "./dto";
7
6
  export * from "./event";
8
7
  export * from "./filter";
9
8
  export * from "./logger";
package/lib/src/index.js CHANGED
@@ -19,7 +19,6 @@ __exportStar(require("./client"), exports);
19
19
  __exportStar(require("./config"), exports);
20
20
  __exportStar(require("./context"), exports);
21
21
  __exportStar(require("./decorator"), exports);
22
- __exportStar(require("./dto"), exports);
23
22
  __exportStar(require("./event"), exports);
24
23
  __exportStar(require("./filter"), exports);
25
24
  __exportStar(require("./logger"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yCAAuB;AACvB,2CAAyB;AACzB,2CAAyB;AACzB,4CAA0B;AAC1B,8CAA4B;AAC5B,wCAAsB;AACtB,0CAAwB;AACxB,2CAAyB;AACzB,2CAAyB;AACzB,4CAA0B;AAC1B,yCAAuB;AACvB,6CAA2B;AAC3B,2CAAyB;AACzB,8CAA4B;AAC5B,4CAA0B;AAC1B,4CAA0B;AAC1B,yCAAuB;AACvB,+CAA6B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yCAAuB;AACvB,2CAAyB;AACzB,2CAAyB;AACzB,4CAA0B;AAC1B,8CAA4B;AAC5B,0CAAwB;AACxB,2CAAyB;AACzB,2CAAyB;AACzB,4CAA0B;AAC1B,yCAAuB;AACvB,6CAA2B;AAC3B,2CAAyB;AACzB,8CAA4B;AAC5B,4CAA0B;AAC1B,4CAA0B;AAC1B,yCAAuB;AACvB,+CAA6B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cryptexlabs/codex-nodejs-common",
3
- "version": "0.12.6",
3
+ "version": "0.12.7",
4
4
  "description": "Common code for Codex framework",
5
5
  "main": "lib/src/index.js",
6
6
  "type": "commonjs",
@@ -53,13 +53,27 @@ export class AuthfGuard implements CanActivate {
53
53
  let decodedToken: any;
54
54
 
55
55
  try {
56
+ // Check if the token has three parts separated by a dot
57
+ if (!token || token.split(".").length !== 3) {
58
+ throw new UnauthorizedException("Malformed token: Not a valid JWT");
59
+ }
60
+
61
+ // Proceed to verify the token
56
62
  jwt.verify(token, this._pem, {
57
63
  algorithms: [this._jwk.alg as Algorithm],
58
64
  });
59
65
 
60
66
  decodedToken = (jwt.decode(token) as unknown) as any;
61
67
  } catch (err) {
62
- throw new UnauthorizedException(`Invalid token`);
68
+ if (err.name === "TokenExpiredError") {
69
+ throw new UnauthorizedException("Token has expired");
70
+ } else if (err.name === "JsonWebTokenError") {
71
+ throw new UnauthorizedException(`Invalid token: ${err.message}`);
72
+ } else if (err instanceof UnauthorizedException) {
73
+ throw err; // Re-throw the malformed token error
74
+ } else {
75
+ throw new UnauthorizedException("Token verification failed");
76
+ }
63
77
  }
64
78
 
65
79
  if (this._blacklistedSubjects.includes(decodedToken.sub)) {
package/src/index.ts CHANGED
@@ -3,7 +3,6 @@ export * from "./client";
3
3
  export * from "./config";
4
4
  export * from "./context";
5
5
  export * from "./decorator";
6
- export * from "./dto";
7
6
  export * from "./event";
8
7
  export * from "./filter";
9
8
  export * from "./logger";
@@ -1,5 +0,0 @@
1
- import { EmailInterface, EmailTypeEnum } from "@cryptexlabs/authf-data-model";
2
- export declare class EmailDto implements EmailInterface {
3
- value: string | null;
4
- type: EmailTypeEnum;
5
- }
@@ -1,29 +0,0 @@
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.EmailDto = void 0;
13
- const authf_data_model_1 = require("@cryptexlabs/authf-data-model");
14
- const class_validator_1 = require("class-validator");
15
- const decorator_1 = require("../decorator");
16
- class EmailDto {
17
- }
18
- exports.EmailDto = EmailDto;
19
- __decorate([
20
- (0, class_validator_1.IsOptional)(),
21
- (0, class_validator_1.IsEmail)(),
22
- __metadata("design:type", String)
23
- ], EmailDto.prototype, "value", void 0);
24
- __decorate([
25
- (0, class_validator_1.IsOptional)(),
26
- (0, decorator_1.IsValidEmailType)(),
27
- __metadata("design:type", String)
28
- ], EmailDto.prototype, "type", void 0);
29
- //# sourceMappingURL=email.dto.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"email.dto.js","sourceRoot":"","sources":["../../../src/dto/email.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oEAA8E;AAC9E,qDAAsD;AACtD,4CAAgD;AAEhD,MAAa,QAAQ;CAQpB;AARD,4BAQC;AALC;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,yBAAO,GAAE;;uCACW;AAIrB;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,4BAAgB,GAAE;;sCACC"}
@@ -1,6 +0,0 @@
1
- export * from "./email.dto";
2
- export * from "./name.dto";
3
- export * from "./phone.dto";
4
- export * from "./photo.dto";
5
- export * from "./profile.dto";
6
- export * from "./user.dto";
@@ -1,23 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./email.dto"), exports);
18
- __exportStar(require("./name.dto"), exports);
19
- __exportStar(require("./phone.dto"), exports);
20
- __exportStar(require("./photo.dto"), exports);
21
- __exportStar(require("./profile.dto"), exports);
22
- __exportStar(require("./user.dto"), exports);
23
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/dto/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,6CAA2B;AAC3B,8CAA4B;AAC5B,8CAA4B;AAC5B,gDAA8B;AAC9B,6CAA2B"}
@@ -1,7 +0,0 @@
1
- import { NameInterface } from "@cryptexlabs/authf-data-model";
2
- export declare class NameDto implements NameInterface {
3
- first: string;
4
- middle: string;
5
- last: string;
6
- display: string;
7
- }
@@ -1,37 +0,0 @@
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.NameDto = void 0;
13
- const class_validator_1 = require("class-validator");
14
- class NameDto {
15
- }
16
- exports.NameDto = NameDto;
17
- __decorate([
18
- (0, class_validator_1.IsOptional)(),
19
- (0, class_validator_1.IsString)(),
20
- __metadata("design:type", String)
21
- ], NameDto.prototype, "first", void 0);
22
- __decorate([
23
- (0, class_validator_1.IsOptional)(),
24
- (0, class_validator_1.IsString)(),
25
- __metadata("design:type", String)
26
- ], NameDto.prototype, "middle", void 0);
27
- __decorate([
28
- (0, class_validator_1.IsOptional)(),
29
- (0, class_validator_1.IsString)(),
30
- __metadata("design:type", String)
31
- ], NameDto.prototype, "last", void 0);
32
- __decorate([
33
- (0, class_validator_1.IsOptional)(),
34
- (0, class_validator_1.IsString)(),
35
- __metadata("design:type", String)
36
- ], NameDto.prototype, "display", void 0);
37
- //# sourceMappingURL=name.dto.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"name.dto.js","sourceRoot":"","sources":["../../../src/dto/name.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,qDAAuD;AAEvD,MAAa,OAAO;CAgBnB;AAhBD,0BAgBC;AAbC;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;sCACG;AAId;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;uCACI;AAIf;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;qCACE;AAIb;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;wCACK"}
@@ -1,5 +0,0 @@
1
- import { PhoneInterface, PhoneTypeEnum } from "@cryptexlabs/authf-data-model";
2
- export declare class PhoneDto implements PhoneInterface {
3
- value: string;
4
- type: PhoneTypeEnum;
5
- }
@@ -1,29 +0,0 @@
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.PhoneDto = void 0;
13
- const authf_data_model_1 = require("@cryptexlabs/authf-data-model");
14
- const class_validator_1 = require("class-validator");
15
- const decorator_1 = require("../decorator");
16
- class PhoneDto {
17
- }
18
- exports.PhoneDto = PhoneDto;
19
- __decorate([
20
- (0, class_validator_1.IsOptional)(),
21
- (0, class_validator_1.IsString)(),
22
- __metadata("design:type", String)
23
- ], PhoneDto.prototype, "value", void 0);
24
- __decorate([
25
- (0, class_validator_1.IsOptional)(),
26
- (0, decorator_1.IsValidPhoneType)(),
27
- __metadata("design:type", String)
28
- ], PhoneDto.prototype, "type", void 0);
29
- //# sourceMappingURL=phone.dto.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"phone.dto.js","sourceRoot":"","sources":["../../../src/dto/phone.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oEAA8E;AAC9E,qDAAuD;AACvD,4CAAgD;AAEhD,MAAa,QAAQ;CAQpB;AARD,4BAQC;AALC;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;;uCACG;AAId;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,4BAAgB,GAAE;;sCACC"}
@@ -1,4 +0,0 @@
1
- import { PhotoInterface } from "@cryptexlabs/authf-data-model";
2
- export declare class PhotoDto implements PhotoInterface {
3
- url: string;
4
- }
@@ -1,22 +0,0 @@
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.PhotoDto = void 0;
13
- const class_validator_1 = require("class-validator");
14
- class PhotoDto {
15
- }
16
- exports.PhotoDto = PhotoDto;
17
- __decorate([
18
- (0, class_validator_1.IsOptional)(),
19
- (0, class_validator_1.IsUrl)(),
20
- __metadata("design:type", String)
21
- ], PhotoDto.prototype, "url", void 0);
22
- //# sourceMappingURL=photo.dto.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"photo.dto.js","sourceRoot":"","sources":["../../../src/dto/photo.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,qDAAoD;AAEpD,MAAa,QAAQ;CAIpB;AAJD,4BAIC;AADC;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,uBAAK,GAAE;;qCACI"}
@@ -1,23 +0,0 @@
1
- import { ProfileInterface } from "@cryptexlabs/authf-data-model";
2
- import { EmailDto } from "./email.dto";
3
- import { PhoneDto } from "./phone.dto";
4
- import { PhotoDto } from "./photo.dto";
5
- import { NameDto } from "./name.dto";
6
- export declare class EmailsDto {
7
- primary: EmailDto | null;
8
- other: EmailDto[];
9
- }
10
- export declare class PhonesDto {
11
- primary: PhoneDto | null;
12
- other: PhoneDto[];
13
- }
14
- export declare class PhotosDto {
15
- primary: PhotoDto | null;
16
- other: PhotoDto[];
17
- }
18
- export declare class ProfileDto implements ProfileInterface {
19
- email: EmailsDto;
20
- phone: PhonesDto;
21
- photo: PhotosDto;
22
- name: NameDto;
23
- }
@@ -1,87 +0,0 @@
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.ProfileDto = exports.PhotosDto = exports.PhonesDto = exports.EmailsDto = 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
- exports.EmailsDto = EmailsDto;
22
- __decorate([
23
- (0, class_validator_1.IsOptional)(),
24
- (0, class_validator_1.ValidateNested)(),
25
- (0, class_transformer_1.Type)(() => email_dto_1.EmailDto),
26
- __metadata("design:type", email_dto_1.EmailDto)
27
- ], EmailsDto.prototype, "primary", void 0);
28
- __decorate([
29
- (0, class_validator_1.IsArray)(),
30
- (0, class_validator_1.ValidateNested)({ each: true }),
31
- (0, class_transformer_1.Type)(() => email_dto_1.EmailDto),
32
- __metadata("design:type", Array)
33
- ], EmailsDto.prototype, "other", void 0);
34
- class PhonesDto {
35
- }
36
- exports.PhonesDto = PhonesDto;
37
- __decorate([
38
- (0, class_validator_1.IsOptional)(),
39
- (0, class_validator_1.ValidateNested)(),
40
- (0, class_transformer_1.Type)(() => phone_dto_1.PhoneDto),
41
- __metadata("design:type", phone_dto_1.PhoneDto)
42
- ], PhonesDto.prototype, "primary", void 0);
43
- __decorate([
44
- (0, class_validator_1.IsArray)(),
45
- (0, class_validator_1.ValidateNested)({ each: true }),
46
- (0, class_transformer_1.Type)(() => phone_dto_1.PhoneDto),
47
- __metadata("design:type", Array)
48
- ], PhonesDto.prototype, "other", void 0);
49
- class PhotosDto {
50
- }
51
- exports.PhotosDto = PhotosDto;
52
- __decorate([
53
- (0, class_validator_1.IsOptional)(),
54
- (0, class_validator_1.ValidateNested)(),
55
- (0, class_transformer_1.Type)(() => photo_dto_1.PhotoDto),
56
- __metadata("design:type", photo_dto_1.PhotoDto)
57
- ], PhotosDto.prototype, "primary", void 0);
58
- __decorate([
59
- (0, class_validator_1.IsArray)(),
60
- (0, class_validator_1.ValidateNested)({ each: true }),
61
- (0, class_transformer_1.Type)(() => photo_dto_1.PhotoDto),
62
- __metadata("design:type", Array)
63
- ], PhotosDto.prototype, "other", void 0);
64
- class ProfileDto {
65
- }
66
- exports.ProfileDto = ProfileDto;
67
- __decorate([
68
- (0, class_validator_1.ValidateNested)(),
69
- (0, class_transformer_1.Type)(() => EmailsDto),
70
- __metadata("design:type", EmailsDto)
71
- ], ProfileDto.prototype, "email", void 0);
72
- __decorate([
73
- (0, class_validator_1.ValidateNested)(),
74
- (0, class_transformer_1.Type)(() => PhonesDto),
75
- __metadata("design:type", PhonesDto)
76
- ], ProfileDto.prototype, "phone", void 0);
77
- __decorate([
78
- (0, class_validator_1.ValidateNested)(),
79
- (0, class_transformer_1.Type)(() => PhotosDto),
80
- __metadata("design:type", PhotosDto)
81
- ], ProfileDto.prototype, "photo", void 0);
82
- __decorate([
83
- (0, class_validator_1.ValidateNested)(),
84
- (0, class_transformer_1.Type)(() => name_dto_1.NameDto),
85
- __metadata("design:type", name_dto_1.NameDto)
86
- ], ProfileDto.prototype, "name", void 0);
87
- //# sourceMappingURL=profile.dto.js.map
@@ -1 +0,0 @@
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,qDAAsE;AACtE,yDAAyC;AAEzC,MAAa,SAAS;CAUrB;AAVD,8BAUC;AANC;IAHC,IAAA,4BAAU,GAAE;IACZ,IAAA,gCAAc,GAAE;I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AAE,CAAC,SAAS,CAAC;8BACf,SAAS;yCAAC;AAIjB;IAFC,IAAA,gCAAc,GAAE;IAChB,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,kBAAO,CAAC;8BACd,kBAAO;wCAAC"}
@@ -1,7 +0,0 @@
1
- import { UserInterface, UtcTimezone } from "@cryptexlabs/authf-data-model";
2
- import { ProfileDto } from "./profile.dto";
3
- export declare class UserDto implements UserInterface {
4
- username: string;
5
- profile: ProfileDto;
6
- timezone: UtcTimezone;
7
- }
@@ -1,33 +0,0 @@
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.UserDto = void 0;
13
- const class_validator_1 = require("class-validator");
14
- const profile_dto_1 = require("./profile.dto");
15
- const decorator_1 = require("../decorator");
16
- const class_transformer_1 = require("class-transformer");
17
- class UserDto {
18
- }
19
- exports.UserDto = UserDto;
20
- __decorate([
21
- (0, class_validator_1.IsString)(),
22
- __metadata("design:type", String)
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);
29
- __decorate([
30
- (0, decorator_1.IsValidUtcTimezone)(),
31
- __metadata("design:type", String)
32
- ], UserDto.prototype, "timezone", void 0);
33
- //# sourceMappingURL=user.dto.js.map
@@ -1 +0,0 @@
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"}
@@ -1,13 +0,0 @@
1
- import { EmailInterface, EmailTypeEnum } from "@cryptexlabs/authf-data-model";
2
- import { IsEmail, IsOptional } from "class-validator";
3
- import { IsValidEmailType } from "../decorator";
4
-
5
- export class EmailDto implements EmailInterface {
6
- @IsOptional()
7
- @IsEmail()
8
- value: string | null;
9
-
10
- @IsOptional()
11
- @IsValidEmailType()
12
- type: EmailTypeEnum;
13
- }
package/src/dto/index.ts DELETED
@@ -1,6 +0,0 @@
1
- export * from "./email.dto";
2
- export * from "./name.dto";
3
- export * from "./phone.dto";
4
- export * from "./photo.dto";
5
- export * from "./profile.dto";
6
- export * from "./user.dto";
@@ -1,20 +0,0 @@
1
- import { NameInterface } from "@cryptexlabs/authf-data-model";
2
- import { IsOptional, IsString } from "class-validator";
3
-
4
- export class NameDto implements NameInterface {
5
- @IsOptional()
6
- @IsString()
7
- first: string;
8
-
9
- @IsOptional()
10
- @IsString()
11
- middle: string;
12
-
13
- @IsOptional()
14
- @IsString()
15
- last: string;
16
-
17
- @IsOptional()
18
- @IsString()
19
- display: string;
20
- }
@@ -1,13 +0,0 @@
1
- import { PhoneInterface, PhoneTypeEnum } from "@cryptexlabs/authf-data-model";
2
- import { IsOptional, IsString } from "class-validator";
3
- import { IsValidPhoneType } from "../decorator";
4
-
5
- export class PhoneDto implements PhoneInterface {
6
- @IsOptional()
7
- @IsString()
8
- value: string;
9
-
10
- @IsOptional()
11
- @IsValidPhoneType()
12
- type: PhoneTypeEnum;
13
- }
@@ -1,8 +0,0 @@
1
- import { PhotoInterface } from "@cryptexlabs/authf-data-model";
2
- import { IsOptional, IsUrl } from "class-validator";
3
-
4
- export class PhotoDto implements PhotoInterface {
5
- @IsOptional()
6
- @IsUrl()
7
- url: string;
8
- }
@@ -1,61 +0,0 @@
1
- import { ProfileInterface } from "@cryptexlabs/authf-data-model";
2
- import { EmailDto } from "./email.dto";
3
- import { PhoneDto } from "./phone.dto";
4
- import { PhotoDto } from "./photo.dto";
5
- import { NameDto } from "./name.dto";
6
- import { ValidateNested, IsArray, IsOptional } from "class-validator";
7
- import { Type } from "class-transformer";
8
-
9
- export class EmailsDto {
10
- @IsOptional()
11
- @ValidateNested()
12
- @Type(() => EmailDto)
13
- primary: EmailDto | null;
14
-
15
- @IsArray()
16
- @ValidateNested({ each: true })
17
- @Type(() => EmailDto)
18
- other: EmailDto[];
19
- }
20
-
21
- export class PhonesDto {
22
- @IsOptional()
23
- @ValidateNested()
24
- @Type(() => PhoneDto)
25
- primary: PhoneDto | null;
26
-
27
- @IsArray()
28
- @ValidateNested({ each: true })
29
- @Type(() => PhoneDto)
30
- other: PhoneDto[];
31
- }
32
-
33
- export class PhotosDto {
34
- @IsOptional()
35
- @ValidateNested()
36
- @Type(() => PhotoDto)
37
- primary: PhotoDto | null;
38
-
39
- @IsArray()
40
- @ValidateNested({ each: true })
41
- @Type(() => PhotoDto)
42
- other: PhotoDto[];
43
- }
44
-
45
- export class ProfileDto implements ProfileInterface {
46
- @ValidateNested()
47
- @Type(() => EmailsDto)
48
- email: EmailsDto;
49
-
50
- @ValidateNested()
51
- @Type(() => PhonesDto)
52
- phone: PhonesDto;
53
-
54
- @ValidateNested()
55
- @Type(() => PhotosDto)
56
- photo: PhotosDto;
57
-
58
- @ValidateNested()
59
- @Type(() => NameDto)
60
- name: NameDto;
61
- }
@@ -1,17 +0,0 @@
1
- import { UserInterface, UtcTimezone } from "@cryptexlabs/authf-data-model";
2
- import { IsString, ValidateNested } from "class-validator";
3
- import { ProfileDto } from "./profile.dto";
4
- import { IsValidUtcTimezone } from "../decorator";
5
- import { Type } from "class-transformer";
6
-
7
- export class UserDto implements UserInterface {
8
- @IsString()
9
- username: string;
10
-
11
- @ValidateNested()
12
- @Type(() => ProfileDto)
13
- profile: ProfileDto;
14
-
15
- @IsValidUtcTimezone()
16
- timezone: UtcTimezone;
17
- }