resurgence-data 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/authentication/authentication.data.js +2 -0
- package/dist/authentication/authentication.dto.js +104 -0
- package/dist/authentication/index.js +19 -0
- package/dist/authentication/invite.data.js +1 -0
- package/dist/authentication/invite.dto.js +60 -0
- package/dist/exception/authentication.exception.js +13 -0
- package/dist/exception/authorization.exception.js +10 -0
- package/dist/exception/data.exception.js +7 -0
- package/dist/exception/database.exception.js +7 -0
- package/dist/exception/exception.js +16 -0
- package/dist/exception/index.js +21 -0
- package/dist/exception/resource.exception.js +16 -0
- package/dist/index.js +19 -0
- package/dist/response/index.js +17 -0
- package/dist/response/response.dto.js +2 -0
- package/dist/types/account.type.js +5 -0
- package/dist/types/error.type.js +2 -0
- package/dist/user/index.js +17 -0
- package/dist/user/user.js +58 -0
- package/dist/validation/custom-validation.js +22 -0
- package/package.json +25 -0
@@ -0,0 +1,104 @@
|
|
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.LoginResponseDTO = exports.TwoFactorAuthRequestDTO = exports.UpdateAuthenticationDTO = exports.ActivationRequestDTO = exports.SendInviteDTO = exports.RecoverAccountDTO = exports.LoginRequestDTO = exports.SignUpDTO = void 0;
|
13
|
+
const class_validator_1 = require("class-validator");
|
14
|
+
const account_type_1 = require("../types/account.type");
|
15
|
+
const custom_validation_1 = require("../validation/custom-validation");
|
16
|
+
class SignUpDTO {
|
17
|
+
}
|
18
|
+
exports.SignUpDTO = SignUpDTO;
|
19
|
+
class LoginRequestDTO {
|
20
|
+
}
|
21
|
+
exports.LoginRequestDTO = LoginRequestDTO;
|
22
|
+
__decorate([
|
23
|
+
(0, class_validator_1.IsString)({ message: "Please enter your username / email address" }),
|
24
|
+
__metadata("design:type", String)
|
25
|
+
], LoginRequestDTO.prototype, "emailAddress", void 0);
|
26
|
+
__decorate([
|
27
|
+
(0, class_validator_1.IsString)({ message: "Please enter your password" }),
|
28
|
+
__metadata("design:type", String)
|
29
|
+
], LoginRequestDTO.prototype, "password", void 0);
|
30
|
+
class RecoverAccountDTO {
|
31
|
+
}
|
32
|
+
exports.RecoverAccountDTO = RecoverAccountDTO;
|
33
|
+
__decorate([
|
34
|
+
(0, class_validator_1.IsString)({ message: "Please enter your email address." }),
|
35
|
+
__metadata("design:type", String)
|
36
|
+
], RecoverAccountDTO.prototype, "emailAddress", void 0);
|
37
|
+
class SendInviteDTO {
|
38
|
+
}
|
39
|
+
exports.SendInviteDTO = SendInviteDTO;
|
40
|
+
__decorate([
|
41
|
+
(0, class_validator_1.IsUUID)(4, { message: "Please provide a valid merchant / biller identifier" }),
|
42
|
+
__metadata("design:type", String)
|
43
|
+
], SendInviteDTO.prototype, "billerId", void 0);
|
44
|
+
__decorate([
|
45
|
+
(0, class_validator_1.IsString)({ message: "Please enter the email address of your invitee" }),
|
46
|
+
(0, class_validator_1.IsEmail)(undefined, { message: "Please enter a valid email address" }),
|
47
|
+
__metadata("design:type", String)
|
48
|
+
], SendInviteDTO.prototype, "emailAddress", void 0);
|
49
|
+
__decorate([
|
50
|
+
(0, class_validator_1.IsString)({ message: "Please enter a valid data type" }),
|
51
|
+
(0, class_validator_1.IsIn)(account_type_1.accountTypes, { message: "Please select a valid role type" }),
|
52
|
+
__metadata("design:type", String)
|
53
|
+
], SendInviteDTO.prototype, "role", void 0);
|
54
|
+
class ActivationRequestDTO {
|
55
|
+
}
|
56
|
+
exports.ActivationRequestDTO = ActivationRequestDTO;
|
57
|
+
__decorate([
|
58
|
+
(0, class_validator_1.IsString)({ message: "Please provide your activation code" }),
|
59
|
+
__metadata("design:type", String)
|
60
|
+
], ActivationRequestDTO.prototype, "token", void 0);
|
61
|
+
__decorate([
|
62
|
+
(0, class_validator_1.IsString)({ message: "Please provide your password" }),
|
63
|
+
__metadata("design:type", String)
|
64
|
+
], ActivationRequestDTO.prototype, "password", void 0);
|
65
|
+
__decorate([
|
66
|
+
(0, class_validator_1.IsOptional)(),
|
67
|
+
(0, class_validator_1.IsString)({ message: "Please confirm your password" }),
|
68
|
+
(0, custom_validation_1.isSameAs)("password", { message: "Your passwords to not match. Please check" }),
|
69
|
+
__metadata("design:type", String)
|
70
|
+
], ActivationRequestDTO.prototype, "passwordConfirm", void 0);
|
71
|
+
class UpdateAuthenticationDTO {
|
72
|
+
}
|
73
|
+
exports.UpdateAuthenticationDTO = UpdateAuthenticationDTO;
|
74
|
+
__decorate([
|
75
|
+
(0, class_validator_1.IsUUID)(),
|
76
|
+
__metadata("design:type", String)
|
77
|
+
], UpdateAuthenticationDTO.prototype, "userId", void 0);
|
78
|
+
__decorate([
|
79
|
+
(0, class_validator_1.IsOptional)(),
|
80
|
+
(0, class_validator_1.IsBoolean)(),
|
81
|
+
__metadata("design:type", Boolean)
|
82
|
+
], UpdateAuthenticationDTO.prototype, "active", void 0);
|
83
|
+
__decorate([
|
84
|
+
(0, class_validator_1.IsOptional)(),
|
85
|
+
(0, class_validator_1.IsString)({ message: "Please enter a valid data type" }),
|
86
|
+
(0, class_validator_1.IsIn)(account_type_1.accountTypes, { message: "Please select a valid role type" }),
|
87
|
+
__metadata("design:type", String)
|
88
|
+
], UpdateAuthenticationDTO.prototype, "role", void 0);
|
89
|
+
class TwoFactorAuthRequestDTO {
|
90
|
+
}
|
91
|
+
exports.TwoFactorAuthRequestDTO = TwoFactorAuthRequestDTO;
|
92
|
+
__decorate([
|
93
|
+
(0, class_validator_1.IsEmail)(undefined, { message: "Please enter a valid email address" }),
|
94
|
+
(0, class_validator_1.IsString)({ message: "Please enter the email address of your invitee" }),
|
95
|
+
__metadata("design:type", String)
|
96
|
+
], TwoFactorAuthRequestDTO.prototype, "emailAddress", void 0);
|
97
|
+
__decorate([
|
98
|
+
(0, class_validator_1.IsString)({ message: "Please provide the 6 character code" }),
|
99
|
+
(0, class_validator_1.Length)(6, 6, { message: "Please enter a 6 character code" }),
|
100
|
+
__metadata("design:type", String)
|
101
|
+
], TwoFactorAuthRequestDTO.prototype, "token", void 0);
|
102
|
+
class LoginResponseDTO {
|
103
|
+
}
|
104
|
+
exports.LoginResponseDTO = LoginResponseDTO;
|
@@ -0,0 +1,19 @@
|
|
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("./authentication.data"), exports);
|
18
|
+
__exportStar(require("./authentication.dto"), exports);
|
19
|
+
__exportStar(require("./invite.dto"), exports);
|
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";
|
@@ -0,0 +1,60 @@
|
|
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.RevokeInviteDTO = exports.AcceptInviteInviteDTO = exports.InviteRequestDTO = void 0;
|
13
|
+
const class_validator_1 = require("class-validator");
|
14
|
+
const account_type_1 = require("../types/account.type");
|
15
|
+
class InviteRequestDTO {
|
16
|
+
}
|
17
|
+
exports.InviteRequestDTO = InviteRequestDTO;
|
18
|
+
__decorate([
|
19
|
+
(0, class_validator_1.IsString)({ message: "Please enter your invitees first name" }),
|
20
|
+
__metadata("design:type", String)
|
21
|
+
], InviteRequestDTO.prototype, "firstName", void 0);
|
22
|
+
__decorate([
|
23
|
+
(0, class_validator_1.IsString)({ message: "Please enter your invitees first name" }),
|
24
|
+
__metadata("design:type", String)
|
25
|
+
], InviteRequestDTO.prototype, "lastName", void 0);
|
26
|
+
__decorate([
|
27
|
+
(0, class_validator_1.IsEmail)(undefined, { message: "Please enter a valid email address" }),
|
28
|
+
(0, class_validator_1.IsString)({ message: "Please enter your invitees first name" }),
|
29
|
+
__metadata("design:type", String)
|
30
|
+
], InviteRequestDTO.prototype, "emailAddress", void 0);
|
31
|
+
__decorate([
|
32
|
+
(0, class_validator_1.IsIn)(account_type_1.accountTypes, { message: "Please select a valid role tyoe" }),
|
33
|
+
__metadata("design:type", String)
|
34
|
+
], InviteRequestDTO.prototype, "role", void 0);
|
35
|
+
__decorate([
|
36
|
+
(0, class_validator_1.IsUUID)(4, { message: "Please enter a valid merchant identifier" }),
|
37
|
+
__metadata("design:type", String)
|
38
|
+
], InviteRequestDTO.prototype, "billerId", void 0);
|
39
|
+
__decorate([
|
40
|
+
(0, class_validator_1.IsUUID)(4, { message: "Please enter a valid user identifier" }),
|
41
|
+
__metadata("design:type", String)
|
42
|
+
], InviteRequestDTO.prototype, "userId", void 0);
|
43
|
+
class AcceptInviteInviteDTO {
|
44
|
+
}
|
45
|
+
exports.AcceptInviteInviteDTO = AcceptInviteInviteDTO;
|
46
|
+
__decorate([
|
47
|
+
(0, class_validator_1.IsString)({ message: "Please enter the valid invite token" }),
|
48
|
+
__metadata("design:type", String)
|
49
|
+
], AcceptInviteInviteDTO.prototype, "token", void 0);
|
50
|
+
__decorate([
|
51
|
+
(0, class_validator_1.IsString)({ message: "Please enter a valid password" }),
|
52
|
+
__metadata("design:type", String)
|
53
|
+
], AcceptInviteInviteDTO.prototype, "password", void 0);
|
54
|
+
class RevokeInviteDTO {
|
55
|
+
}
|
56
|
+
exports.RevokeInviteDTO = RevokeInviteDTO;
|
57
|
+
__decorate([
|
58
|
+
(0, class_validator_1.IsUUID)(4, { message: "Please select a valid invite" }),
|
59
|
+
__metadata("design:type", String)
|
60
|
+
], RevokeInviteDTO.prototype, "id", void 0);
|
@@ -0,0 +1,13 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.InactiveUserException = exports.InvalidUserException = exports.InvalidCredentialsException = void 0;
|
4
|
+
const exception_1 = require("./exception");
|
5
|
+
class InvalidCredentialsException extends exception_1.Exception {
|
6
|
+
}
|
7
|
+
exports.InvalidCredentialsException = InvalidCredentialsException;
|
8
|
+
class InvalidUserException extends exception_1.Exception {
|
9
|
+
}
|
10
|
+
exports.InvalidUserException = InvalidUserException;
|
11
|
+
class InactiveUserException extends exception_1.Exception {
|
12
|
+
}
|
13
|
+
exports.InactiveUserException = InactiveUserException;
|
@@ -0,0 +1,10 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.ExpiredAuthorizationException = exports.InvalidAuthorizationException = void 0;
|
4
|
+
const exception_1 = require("./exception");
|
5
|
+
class InvalidAuthorizationException extends exception_1.Exception {
|
6
|
+
}
|
7
|
+
exports.InvalidAuthorizationException = InvalidAuthorizationException;
|
8
|
+
class ExpiredAuthorizationException extends exception_1.Exception {
|
9
|
+
}
|
10
|
+
exports.ExpiredAuthorizationException = ExpiredAuthorizationException;
|
@@ -0,0 +1,7 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.InvalidPayloadException = void 0;
|
4
|
+
const exception_1 = require("./exception");
|
5
|
+
class InvalidPayloadException extends exception_1.Exception {
|
6
|
+
}
|
7
|
+
exports.InvalidPayloadException = InvalidPayloadException;
|
@@ -0,0 +1,7 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.DatabaseProcessException = void 0;
|
4
|
+
const exception_1 = require("./exception");
|
5
|
+
class DatabaseProcessException extends exception_1.Exception {
|
6
|
+
}
|
7
|
+
exports.DatabaseProcessException = DatabaseProcessException;
|
@@ -0,0 +1,16 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.Exception = void 0;
|
4
|
+
class Exception extends Error {
|
5
|
+
constructor(errorContent) {
|
6
|
+
super();
|
7
|
+
if (errorContent) {
|
8
|
+
this.message = errorContent.message;
|
9
|
+
this.description = errorContent.description;
|
10
|
+
if (errorContent.status) {
|
11
|
+
this.status = errorContent.status;
|
12
|
+
}
|
13
|
+
}
|
14
|
+
}
|
15
|
+
}
|
16
|
+
exports.Exception = Exception;
|
@@ -0,0 +1,21 @@
|
|
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("./resource.exception"), exports);
|
18
|
+
__exportStar(require("./exception"), exports);
|
19
|
+
__exportStar(require("./authentication.exception"), exports);
|
20
|
+
__exportStar(require("./authorization.exception"), exports);
|
21
|
+
__exportStar(require("./database.exception"), exports);
|
@@ -0,0 +1,16 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.ExpiredResourceException = exports.UnauthorizedResourceActionException = exports.ResourceExistsException = exports.ResourceNotFoundException = void 0;
|
4
|
+
const exception_1 = require("./exception");
|
5
|
+
class ResourceNotFoundException extends exception_1.Exception {
|
6
|
+
}
|
7
|
+
exports.ResourceNotFoundException = ResourceNotFoundException;
|
8
|
+
class ResourceExistsException extends exception_1.Exception {
|
9
|
+
}
|
10
|
+
exports.ResourceExistsException = ResourceExistsException;
|
11
|
+
class UnauthorizedResourceActionException extends exception_1.Exception {
|
12
|
+
}
|
13
|
+
exports.UnauthorizedResourceActionException = UnauthorizedResourceActionException;
|
14
|
+
class ExpiredResourceException extends exception_1.Exception {
|
15
|
+
}
|
16
|
+
exports.ExpiredResourceException = ExpiredResourceException;
|
package/dist/index.js
ADDED
@@ -0,0 +1,19 @@
|
|
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("./authentication"), exports);
|
18
|
+
__exportStar(require("./response"), exports);
|
19
|
+
__exportStar(require("./exception"), exports);
|
@@ -0,0 +1,17 @@
|
|
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("./response.dto"), exports);
|
@@ -0,0 +1,5 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.InviteStatuses = exports.accountTypes = void 0;
|
4
|
+
exports.accountTypes = ["ADMINISTRATOR", "USER", "SUPPORT", "BILLER", "BILLER_ADMINISTRATOR", "BILLER_USER"];
|
5
|
+
exports.InviteStatuses = ["ACCEPTED", "PENDING", "REVOKED"];
|
@@ -0,0 +1,17 @@
|
|
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("./user"), exports);
|
@@ -0,0 +1,58 @@
|
|
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.UpdateUserDTO = exports.CreateUserDTO = void 0;
|
13
|
+
const class_validator_1 = require("class-validator");
|
14
|
+
class CreateUserDTO {
|
15
|
+
}
|
16
|
+
exports.CreateUserDTO = CreateUserDTO;
|
17
|
+
__decorate([
|
18
|
+
(0, class_validator_1.IsString)({ message: "Please enter your first name." }),
|
19
|
+
__metadata("design:type", String)
|
20
|
+
], CreateUserDTO.prototype, "firstName", void 0);
|
21
|
+
__decorate([
|
22
|
+
(0, class_validator_1.IsString)({ message: "Please enter your last name." }),
|
23
|
+
__metadata("design:type", String)
|
24
|
+
], CreateUserDTO.prototype, "lastName", void 0);
|
25
|
+
__decorate([
|
26
|
+
(0, class_validator_1.IsString)({ message: "Please enter a valid email address." }),
|
27
|
+
__metadata("design:type", String)
|
28
|
+
], CreateUserDTO.prototype, "emailAddress", void 0);
|
29
|
+
__decorate([
|
30
|
+
(0, class_validator_1.IsString)({ message: "Please enter your phone number." }),
|
31
|
+
__metadata("design:type", String)
|
32
|
+
], CreateUserDTO.prototype, "phoneNumber", void 0);
|
33
|
+
__decorate([
|
34
|
+
(0, class_validator_1.IsString)({ message: "Please enter your business name." }),
|
35
|
+
__metadata("design:type", String)
|
36
|
+
], CreateUserDTO.prototype, "businessName", void 0);
|
37
|
+
__decorate([
|
38
|
+
(0, class_validator_1.IsOptional)() // Allows the property to be optional
|
39
|
+
,
|
40
|
+
(0, class_validator_1.IsString)({ message: "Please provide a valid avatar URL." }),
|
41
|
+
__metadata("design:type", String)
|
42
|
+
], CreateUserDTO.prototype, "avatarUrl", void 0);
|
43
|
+
__decorate([
|
44
|
+
(0, class_validator_1.IsOptional)(),
|
45
|
+
(0, class_validator_1.IsBoolean)({ message: "Corporate must be a boolean value." }),
|
46
|
+
__metadata("design:type", Boolean)
|
47
|
+
], CreateUserDTO.prototype, "corporate", void 0);
|
48
|
+
__decorate([
|
49
|
+
(0, class_validator_1.IsString)({ message: "Please specify the account type." }),
|
50
|
+
__metadata("design:type", String)
|
51
|
+
], CreateUserDTO.prototype, "accountType", void 0);
|
52
|
+
class UpdateUserDTO extends CreateUserDTO {
|
53
|
+
}
|
54
|
+
exports.UpdateUserDTO = UpdateUserDTO;
|
55
|
+
__decorate([
|
56
|
+
(0, class_validator_1.IsUUID)(4, { message: "Please enter a valid user id format" }),
|
57
|
+
__metadata("design:type", String)
|
58
|
+
], UpdateUserDTO.prototype, "id", void 0);
|
@@ -0,0 +1,22 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.isSameAs = isSameAs;
|
4
|
+
const class_validator_1 = require("class-validator");
|
5
|
+
function isSameAs(property, validationOptions) {
|
6
|
+
return function (object, propertyName) {
|
7
|
+
(0, class_validator_1.registerDecorator)({
|
8
|
+
name: "isSameAs",
|
9
|
+
target: object.constructor,
|
10
|
+
propertyName: propertyName,
|
11
|
+
constraints: [property],
|
12
|
+
options: validationOptions,
|
13
|
+
validator: {
|
14
|
+
validate(value, args) {
|
15
|
+
const [relatedPropertyName] = args.constraints;
|
16
|
+
const relatedValue = args.object[relatedPropertyName];
|
17
|
+
return value === relatedValue;
|
18
|
+
},
|
19
|
+
},
|
20
|
+
});
|
21
|
+
};
|
22
|
+
}
|
package/package.json
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
{
|
2
|
+
"name": "resurgence-data",
|
3
|
+
"version": "1.0.0",
|
4
|
+
"description": "DTOs and shareable resources",
|
5
|
+
"main": "dist/index.js",
|
6
|
+
"types": "dist/index.d.ts",
|
7
|
+
"files": [
|
8
|
+
"dist"
|
9
|
+
],
|
10
|
+
"scripts": {
|
11
|
+
"build": "tsc",
|
12
|
+
"test": "jest"
|
13
|
+
},
|
14
|
+
"author": "Anthony Egwu",
|
15
|
+
"license": "ISC",
|
16
|
+
"devDependencies": {
|
17
|
+
"@types/node": "^22.10.2",
|
18
|
+
"jest": "^29.7.0",
|
19
|
+
"typescript": "^5.7.2"
|
20
|
+
},
|
21
|
+
"dependencies": {
|
22
|
+
"class-transformer": "^0.5.1",
|
23
|
+
"class-validator": "^0.14.1"
|
24
|
+
}
|
25
|
+
}
|