@konplit-services/common 1.0.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.
Files changed (177) hide show
  1. package/build/Schema/CFLESCHEMA.d.ts +138 -0
  2. package/build/Schema/CFLESCHEMA.js +144 -0
  3. package/build/errors/axios-request-error.d.ts +17 -0
  4. package/build/errors/axios-request-error.js +32 -0
  5. package/build/errors/bad-request-error.d.ts +17 -0
  6. package/build/errors/bad-request-error.js +28 -0
  7. package/build/errors/custom-error.d.ts +15 -0
  8. package/build/errors/custom-error.js +11 -0
  9. package/build/errors/database-error.d.ts +17 -0
  10. package/build/errors/database-error.js +28 -0
  11. package/build/errors/error.interface.d.ts +4 -0
  12. package/build/errors/error.interface.js +2 -0
  13. package/build/errors/forbidden-error.d.ts +17 -0
  14. package/build/errors/forbidden-error.js +28 -0
  15. package/build/errors/invalid-input-error.d.ts +19 -0
  16. package/build/errors/invalid-input-error.js +31 -0
  17. package/build/errors/mongoose-validation-error.d.ts +17 -0
  18. package/build/errors/mongoose-validation-error.js +28 -0
  19. package/build/errors/not-found.d.ts +17 -0
  20. package/build/errors/not-found.js +28 -0
  21. package/build/errors/notAuthorized.d.ts +17 -0
  22. package/build/errors/notAuthorized.js +28 -0
  23. package/build/errors/request-validation-error.d.ts +17 -0
  24. package/build/errors/request-validation-error.js +28 -0
  25. package/build/errors/service-not-available.d.ts +17 -0
  26. package/build/errors/service-not-available.js +28 -0
  27. package/build/events/accounts-events/interfaces/account-created.interface.d.ts +11 -0
  28. package/build/events/accounts-events/interfaces/account-created.interface.js +2 -0
  29. package/build/events/accounts-events/interfaces/account-updated.interface.d.ts +0 -0
  30. package/build/events/accounts-events/interfaces/account-updated.interface.js +1 -0
  31. package/build/events/accounts-events/interfaces/permission-created.interface.d.ts +12 -0
  32. package/build/events/accounts-events/interfaces/permission-created.interface.js +2 -0
  33. package/build/events/accounts-events/interfaces/permission-removed.interface.d.ts +12 -0
  34. package/build/events/accounts-events/interfaces/permission-removed.interface.js +2 -0
  35. package/build/events/base-events/base-events.listener.d.ts +103 -0
  36. package/build/events/base-events/base-events.listener.js +164 -0
  37. package/build/events/base-events/base-events.publisher.d.ts +75 -0
  38. package/build/events/base-events/base-events.publisher.js +110 -0
  39. package/build/events/logs-events/interfaces/admins-logs.created.interface.d.ts +15 -0
  40. package/build/events/logs-events/interfaces/admins-logs.created.interface.js +2 -0
  41. package/build/events/logs-events/interfaces/merchants-logs-created.interface.d.ts +15 -0
  42. package/build/events/logs-events/interfaces/merchants-logs-created.interface.js +2 -0
  43. package/build/events/subjects.d.ts +26 -0
  44. package/build/events/subjects.js +37 -0
  45. package/build/events/types/order-statu.types.d.ts +22 -0
  46. package/build/events/types/order-statu.types.js +26 -0
  47. package/build/helper/Two-fa-type.d.ts +7 -0
  48. package/build/helper/Two-fa-type.js +11 -0
  49. package/build/helper/account-balance-types.d.ts +4 -0
  50. package/build/helper/account-balance-types.js +8 -0
  51. package/build/helper/account-status.d.ts +4 -0
  52. package/build/helper/account-status.js +8 -0
  53. package/build/helper/bank-code.d.ts +1 -0
  54. package/build/helper/bank-code.js +16 -0
  55. package/build/helper/business-category.d.ts +12 -0
  56. package/build/helper/business-category.js +17 -0
  57. package/build/helper/bvn-validation-type.d.ts +4 -0
  58. package/build/helper/bvn-validation-type.js +8 -0
  59. package/build/helper/card-types.d.ts +10 -0
  60. package/build/helper/card-types.js +14 -0
  61. package/build/helper/card_auth_type.d.ts +5 -0
  62. package/build/helper/card_auth_type.js +9 -0
  63. package/build/helper/chargeback.d.ts +7 -0
  64. package/build/helper/chargeback.js +11 -0
  65. package/build/helper/charges.d.ts +7 -0
  66. package/build/helper/charges.js +11 -0
  67. package/build/helper/currency-types.d.ts +4 -0
  68. package/build/helper/currency-types.js +8 -0
  69. package/build/helper/custom-paginate.d.ts +19 -0
  70. package/build/helper/custom-paginate.js +50 -0
  71. package/build/helper/email-types.d.ts +22 -0
  72. package/build/helper/email-types.js +26 -0
  73. package/build/helper/errorCodes/error-codes.d.ts +92 -0
  74. package/build/helper/errorCodes/error-codes.js +99 -0
  75. package/build/helper/extract-card-details.d.ts +4 -0
  76. package/build/helper/extract-card-details.js +20 -0
  77. package/build/helper/invoice.d.ts +19 -0
  78. package/build/helper/invoice.js +26 -0
  79. package/build/helper/lang/email.d.ts +12 -0
  80. package/build/helper/lang/email.js +19 -0
  81. package/build/helper/lang/error-text.d.ts +32 -0
  82. package/build/helper/lang/error-text.js +35 -0
  83. package/build/helper/lang/error.d.ts +0 -0
  84. package/build/helper/lang/error.js +1 -0
  85. package/build/helper/lang/language.d.ts +113 -0
  86. package/build/helper/lang/language.js +146 -0
  87. package/build/helper/last-three.d.ts +1 -0
  88. package/build/helper/last-three.js +8 -0
  89. package/build/helper/location.d.ts +2 -0
  90. package/build/helper/location.js +20 -0
  91. package/build/helper/media-types.d.ts +6 -0
  92. package/build/helper/media-types.js +10 -0
  93. package/build/helper/nibss-scopes.d.ts +9 -0
  94. package/build/helper/nibss-scopes.js +13 -0
  95. package/build/helper/payment-options.d.ts +7 -0
  96. package/build/helper/payment-options.js +11 -0
  97. package/build/helper/pdf-generator.d.ts +9 -0
  98. package/build/helper/pdf-generator.js +73 -0
  99. package/build/helper/permistions.d.ts +126 -0
  100. package/build/helper/permistions.js +129 -0
  101. package/build/helper/plan-types.d.ts +9 -0
  102. package/build/helper/plan-types.js +13 -0
  103. package/build/helper/query/query-option.d.ts +23 -0
  104. package/build/helper/query/query-option.js +40 -0
  105. package/build/helper/refund.d.ts +21 -0
  106. package/build/helper/refund.js +28 -0
  107. package/build/helper/roles.d.ts +15 -0
  108. package/build/helper/roles.js +19 -0
  109. package/build/helper/settlement.d.ts +14 -0
  110. package/build/helper/settlement.js +20 -0
  111. package/build/helper/status.d.ts +15 -0
  112. package/build/helper/status.js +19 -0
  113. package/build/helper/subscriptions-types.d.ts +16 -0
  114. package/build/helper/subscriptions-types.js +22 -0
  115. package/build/helper/success-response.d.ts +9 -0
  116. package/build/helper/success-response.js +13 -0
  117. package/build/helper/transaction-authentication-type.d.ts +5 -0
  118. package/build/helper/transaction-authentication-type.js +9 -0
  119. package/build/helper/transaction-type.d.ts +15 -0
  120. package/build/helper/transaction-type.js +20 -0
  121. package/build/helper/transfer.d.ts +9 -0
  122. package/build/helper/transfer.js +13 -0
  123. package/build/helper/user-types.d.ts +4 -0
  124. package/build/helper/user-types.js +8 -0
  125. package/build/helper/util/gender.d.ts +4 -0
  126. package/build/helper/util/gender.js +8 -0
  127. package/build/helper/util/get-transaction-id.d.ts +9 -0
  128. package/build/helper/util/get-transaction-id.js +17 -0
  129. package/build/helper/util/getobject-keys.d.ts +10 -0
  130. package/build/helper/util/getobject-keys.js +22 -0
  131. package/build/helper/util/pagination.d.ts +25 -0
  132. package/build/helper/util/pagination.js +19 -0
  133. package/build/helper/util/remove-transactionId.d.ts +14 -0
  134. package/build/helper/util/remove-transactionId.js +16 -0
  135. package/build/helper/util/sort-by.d.ts +8 -0
  136. package/build/helper/util/sort-by.js +11 -0
  137. package/build/helper/validateParams.d.ts +7 -0
  138. package/build/helper/validateParams.js +13 -0
  139. package/build/helper/worker-task-types.d.ts +8 -0
  140. package/build/helper/worker-task-types.js +12 -0
  141. package/build/index.d.ts +79 -0
  142. package/build/index.js +103 -0
  143. package/build/log-activities/actions.d.ts +17 -0
  144. package/build/log-activities/actions.js +25 -0
  145. package/build/middlewares/check-inputs.d.ts +2 -0
  146. package/build/middlewares/check-inputs.js +24 -0
  147. package/build/middlewares/current-user.d.ts +10 -0
  148. package/build/middlewares/current-user.js +41 -0
  149. package/build/middlewares/error-handler.d.ts +3 -0
  150. package/build/middlewares/error-handler.js +61 -0
  151. package/build/middlewares/permission.d.ts +10 -0
  152. package/build/middlewares/permission.js +46 -0
  153. package/build/middlewares/require-auth.d.ts +2 -0
  154. package/build/middlewares/require-auth.js +13 -0
  155. package/build/middlewares/validate-request.d.ts +2 -0
  156. package/build/middlewares/validate-request.js +13 -0
  157. package/build/redis/base/index.d.ts +13 -0
  158. package/build/redis/base/index.js +104 -0
  159. package/build/redis/constants/index.d.ts +5 -0
  160. package/build/redis/constants/index.js +12 -0
  161. package/build/repository/interface/baseRepository.d.ts +9 -0
  162. package/build/repository/interface/baseRepository.js +8 -0
  163. package/build/repository/interface/based.d.ts +9 -0
  164. package/build/repository/interface/based.js +2 -0
  165. package/build/services/Jwt.d.ts +17 -0
  166. package/build/services/Jwt.js +44 -0
  167. package/build/services/base.service.d.ts +14 -0
  168. package/build/services/base.service.js +20 -0
  169. package/build/services/mailersend.d.ts +25 -0
  170. package/build/services/mailersend.js +56 -0
  171. package/build/util/jwt.validation.d.ts +1 -0
  172. package/build/util/jwt.validation.js +27 -0
  173. package/build/util/lib/nats/nat-error-codes.d.ts +4 -0
  174. package/build/util/lib/nats/nat-error-codes.js +7 -0
  175. package/build/util/parse-query-string.d.ts +4 -0
  176. package/build/util/parse-query-string.js +22 -0
  177. package/package.json +46 -0
@@ -0,0 +1,138 @@
1
+ declare const schemaDefinition: (_key: string) => {
2
+ "konplit.merchantbusinesses": {
3
+ bsonType: string;
4
+ properties: {
5
+ keys: {
6
+ bsonType: string;
7
+ properties: {
8
+ kpLivePrivate: {
9
+ encrypt: {
10
+ bsonType: string;
11
+ algorithm: string;
12
+ keyId: string[];
13
+ };
14
+ };
15
+ kpTestPrivate: {
16
+ encrypt: {
17
+ bsonType: string;
18
+ algorithm: string;
19
+ keyId: string[];
20
+ };
21
+ };
22
+ kpLiveEncryption: {
23
+ encrypt: {
24
+ bsonType: string;
25
+ algorithm: string;
26
+ keyId: string[];
27
+ };
28
+ };
29
+ };
30
+ };
31
+ };
32
+ };
33
+ "konplit.merchantcustomers": {
34
+ bsonType: string;
35
+ properties: {
36
+ email: {
37
+ encrypt: {
38
+ bsonType: string;
39
+ algorithm: string;
40
+ keyId: string[];
41
+ };
42
+ };
43
+ phone: {
44
+ encrypt: {
45
+ bsonType: string;
46
+ algorithm: string;
47
+ keyId: string[];
48
+ };
49
+ };
50
+ publicKey: {
51
+ encrypt: {
52
+ bsonType: string;
53
+ algorithm: string;
54
+ keyId: string[];
55
+ };
56
+ };
57
+ };
58
+ };
59
+ "konplit.blacklistedcards": {
60
+ bsonType: string;
61
+ properties: {
62
+ card_pan: {
63
+ encrypt: {
64
+ bsonType: string;
65
+ algorithm: string;
66
+ keyId: string[];
67
+ };
68
+ };
69
+ card_expiry_date: {
70
+ encrypt: {
71
+ bsonType: string;
72
+ algorithm: string;
73
+ keyId: string[];
74
+ };
75
+ };
76
+ card_holder_name: {
77
+ encrypt: {
78
+ bsonType: string;
79
+ algorithm: string;
80
+ keyId: string[];
81
+ };
82
+ };
83
+ };
84
+ };
85
+ "konplit.subaccounts": {
86
+ bsonType: string;
87
+ properties: {
88
+ account_number: {
89
+ encrypt: {
90
+ bsonType: string;
91
+ algorithm: string;
92
+ keyId: string[];
93
+ };
94
+ };
95
+ };
96
+ };
97
+ "konplit.cards": {
98
+ bsonType: string;
99
+ properties: {
100
+ expiry_year: {
101
+ encrypt: {
102
+ bsonType: string;
103
+ algorithm: string;
104
+ keyId: string[];
105
+ };
106
+ };
107
+ expiry_month: {
108
+ encrypt: {
109
+ bsonType: string;
110
+ algorithm: string;
111
+ keyId: string[];
112
+ };
113
+ };
114
+ card_pan: {
115
+ encrypt: {
116
+ bsonType: string;
117
+ algorithm: string;
118
+ keyId: string[];
119
+ };
120
+ };
121
+ card_holder: {
122
+ encrypt: {
123
+ bsonType: string;
124
+ algorithm: string;
125
+ keyId: string[];
126
+ };
127
+ };
128
+ token_expir_date: {
129
+ encrypt: {
130
+ bsonType: string;
131
+ algorithm: string;
132
+ keyId: string[];
133
+ };
134
+ };
135
+ };
136
+ };
137
+ };
138
+ export { schemaDefinition };
@@ -0,0 +1,144 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.schemaDefinition = void 0;
4
+ const schemaDefinition = (_key) => {
5
+ const schema = {
6
+ "konplit.merchantbusinesses": {
7
+ bsonType: 'object',
8
+ properties: {
9
+ keys: {
10
+ bsonType: 'object',
11
+ properties: {
12
+ kpLivePrivate: {
13
+ encrypt: {
14
+ bsonType: 'string',
15
+ algorithm: 'AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic',
16
+ keyId: [_key]
17
+ }
18
+ },
19
+ kpTestPrivate: {
20
+ encrypt: {
21
+ bsonType: 'string',
22
+ algorithm: 'AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic',
23
+ keyId: [_key]
24
+ }
25
+ },
26
+ kpLiveEncryption: {
27
+ encrypt: {
28
+ bsonType: 'string',
29
+ algorithm: 'AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic',
30
+ keyId: [_key]
31
+ }
32
+ },
33
+ },
34
+ },
35
+ }
36
+ },
37
+ "konplit.merchantcustomers": {
38
+ bsonType: 'object',
39
+ properties: {
40
+ email: {
41
+ encrypt: {
42
+ bsonType: 'string',
43
+ algorithm: 'AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic',
44
+ keyId: [_key]
45
+ }
46
+ },
47
+ phone: {
48
+ encrypt: {
49
+ bsonType: 'string',
50
+ algorithm: 'AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic',
51
+ keyId: [_key]
52
+ }
53
+ },
54
+ publicKey: {
55
+ encrypt: {
56
+ bsonType: 'string',
57
+ algorithm: 'AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic',
58
+ keyId: [_key]
59
+ }
60
+ },
61
+ }
62
+ },
63
+ "konplit.blacklistedcards": {
64
+ bsonType: 'object',
65
+ properties: {
66
+ card_pan: {
67
+ encrypt: {
68
+ bsonType: 'string',
69
+ algorithm: 'AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic',
70
+ keyId: [_key]
71
+ }
72
+ },
73
+ card_expiry_date: {
74
+ encrypt: {
75
+ bsonType: 'string',
76
+ algorithm: 'AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic',
77
+ keyId: [_key]
78
+ }
79
+ },
80
+ card_holder_name: {
81
+ encrypt: {
82
+ bsonType: 'string',
83
+ algorithm: 'AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic',
84
+ keyId: [_key]
85
+ }
86
+ },
87
+ }
88
+ },
89
+ "konplit.subaccounts": {
90
+ bsonType: 'object',
91
+ properties: {
92
+ account_number: {
93
+ encrypt: {
94
+ bsonType: 'string',
95
+ algorithm: 'AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic',
96
+ keyId: [_key]
97
+ }
98
+ },
99
+ }
100
+ },
101
+ "konplit.cards": {
102
+ bsonType: 'object',
103
+ properties: {
104
+ expiry_year: {
105
+ encrypt: {
106
+ bsonType: 'string',
107
+ algorithm: 'AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic',
108
+ keyId: [_key]
109
+ }
110
+ },
111
+ expiry_month: {
112
+ encrypt: {
113
+ bsonType: 'string',
114
+ algorithm: 'AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic',
115
+ keyId: [_key]
116
+ }
117
+ },
118
+ card_pan: {
119
+ encrypt: {
120
+ bsonType: 'string',
121
+ algorithm: 'AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic',
122
+ keyId: [_key]
123
+ }
124
+ },
125
+ card_holder: {
126
+ encrypt: {
127
+ bsonType: 'string',
128
+ algorithm: 'AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic',
129
+ keyId: [_key]
130
+ }
131
+ },
132
+ token_expir_date: {
133
+ encrypt: {
134
+ bsonType: 'string',
135
+ algorithm: 'AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic',
136
+ keyId: [_key]
137
+ }
138
+ }
139
+ }
140
+ },
141
+ };
142
+ return schema;
143
+ };
144
+ exports.schemaDefinition = schemaDefinition;
@@ -0,0 +1,17 @@
1
+ import { Status } from "../helper/status";
2
+ import { CustomError } from "./custom-error";
3
+ import { ErrorReturn } from "./error.interface";
4
+ export declare class AxiosRequestError extends CustomError {
5
+ message: string;
6
+ private error_data;
7
+ readonly statusCode: number;
8
+ constructor(message: string, error_data: ErrorReturn);
9
+ sequalizeErrors(): {
10
+ status: Status;
11
+ errors: {
12
+ message: string;
13
+ error_code: string;
14
+ code: number;
15
+ }[];
16
+ };
17
+ }
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AxiosRequestError = void 0;
4
+ const status_1 = require("../helper/status");
5
+ const custom_error_1 = require("./custom-error");
6
+ class AxiosRequestError extends custom_error_1.CustomError {
7
+ constructor(message, error_data) {
8
+ super(message);
9
+ this.message = message;
10
+ this.error_data = error_data;
11
+ this.statusCode = 500;
12
+ this.error_data = error_data;
13
+ Object.setPrototypeOf(this, AxiosRequestError.prototype);
14
+ }
15
+ sequalizeErrors() {
16
+ return {
17
+ status: status_1.Status.Failed,
18
+ errors: [
19
+ {
20
+ message: this.message
21
+ ? this.message
22
+ : "Sorry! We are aware of this issue...but you can also reach us form our contact page",
23
+ error_code: this.error_data.error_code
24
+ ? this.error_data.error_code
25
+ : "Server error",
26
+ code: this.error_data.code,
27
+ },
28
+ ],
29
+ };
30
+ }
31
+ }
32
+ exports.AxiosRequestError = AxiosRequestError;
@@ -0,0 +1,17 @@
1
+ import { Status } from "../helper/status";
2
+ import { CustomError } from "./custom-error";
3
+ import { ErrorReturn } from "./error.interface";
4
+ export declare class BadRequestError extends CustomError {
5
+ message: string;
6
+ private error_data;
7
+ readonly statusCode: number;
8
+ constructor(message: string, error_data: ErrorReturn);
9
+ sequalizeErrors(): {
10
+ status: Status;
11
+ errors: {
12
+ message: string;
13
+ error_code: string;
14
+ code: number;
15
+ }[];
16
+ };
17
+ }
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BadRequestError = void 0;
4
+ const status_1 = require("../helper/status");
5
+ const custom_error_1 = require("./custom-error");
6
+ class BadRequestError extends custom_error_1.CustomError {
7
+ constructor(message, error_data) {
8
+ super(message);
9
+ this.message = message;
10
+ this.error_data = error_data;
11
+ this.statusCode = 400;
12
+ this.error_data = error_data;
13
+ Object.setPrototypeOf(this, BadRequestError.prototype);
14
+ }
15
+ sequalizeErrors() {
16
+ return {
17
+ status: status_1.Status.Failed,
18
+ errors: [
19
+ {
20
+ message: this.message,
21
+ error_code: this.error_data.error_code,
22
+ code: this.error_data.code,
23
+ },
24
+ ],
25
+ };
26
+ }
27
+ }
28
+ exports.BadRequestError = BadRequestError;
@@ -0,0 +1,15 @@
1
+ import { Status } from "../helper/status";
2
+ export declare abstract class CustomError extends Error {
3
+ message: string;
4
+ abstract statusCode: number;
5
+ constructor(message: string);
6
+ abstract sequalizeErrors(): {
7
+ status: Status;
8
+ errors: {
9
+ message: string;
10
+ field?: string;
11
+ error_code: string;
12
+ code: number;
13
+ }[];
14
+ };
15
+ }
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CustomError = void 0;
4
+ class CustomError extends Error {
5
+ constructor(message) {
6
+ super(message);
7
+ this.message = message;
8
+ Object.setPrototypeOf(this, CustomError.prototype);
9
+ }
10
+ }
11
+ exports.CustomError = CustomError;
@@ -0,0 +1,17 @@
1
+ import { Status } from "../helper/status";
2
+ import { CustomError } from "./custom-error";
3
+ import { ErrorReturn } from "./error.interface";
4
+ export declare class DatabaseConnectionError extends CustomError {
5
+ message: string;
6
+ private error_data;
7
+ readonly statusCode = 500;
8
+ constructor(message: string, error_data: ErrorReturn);
9
+ sequalizeErrors(): {
10
+ status: Status;
11
+ errors: {
12
+ message: string;
13
+ error_code: string;
14
+ code: number;
15
+ }[];
16
+ };
17
+ }
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DatabaseConnectionError = void 0;
4
+ const status_1 = require("../helper/status");
5
+ const custom_error_1 = require("./custom-error");
6
+ class DatabaseConnectionError extends custom_error_1.CustomError {
7
+ constructor(message, error_data) {
8
+ super(message);
9
+ this.message = message;
10
+ this.error_data = error_data;
11
+ this.statusCode = 500;
12
+ this.error_data = error_data;
13
+ Object.setPrototypeOf(this, DatabaseConnectionError.prototype);
14
+ }
15
+ sequalizeErrors() {
16
+ return {
17
+ status: status_1.Status.Failed,
18
+ errors: [
19
+ {
20
+ message: this.message,
21
+ error_code: this.error_data.error_code,
22
+ code: this.error_data.code,
23
+ },
24
+ ],
25
+ };
26
+ }
27
+ }
28
+ exports.DatabaseConnectionError = DatabaseConnectionError;
@@ -0,0 +1,4 @@
1
+ export interface ErrorReturn {
2
+ code: number;
3
+ error_code: string;
4
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,17 @@
1
+ import { Status } from "../helper/status";
2
+ import { CustomError } from "./custom-error";
3
+ import { ErrorReturn } from "./error.interface";
4
+ export declare class ForbiddenError extends CustomError {
5
+ message: string;
6
+ private error_data;
7
+ readonly statusCode: number;
8
+ constructor(message: string, error_data: ErrorReturn);
9
+ sequalizeErrors(): {
10
+ status: Status;
11
+ errors: {
12
+ message: string;
13
+ error_code: string;
14
+ code: number;
15
+ }[];
16
+ };
17
+ }
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ForbiddenError = void 0;
4
+ const status_1 = require("../helper/status");
5
+ const custom_error_1 = require("./custom-error");
6
+ class ForbiddenError extends custom_error_1.CustomError {
7
+ constructor(message, error_data) {
8
+ super(message);
9
+ this.message = message;
10
+ this.error_data = error_data;
11
+ this.statusCode = 403;
12
+ this.error_data = error_data;
13
+ Object.setPrototypeOf(this, ForbiddenError.prototype);
14
+ }
15
+ sequalizeErrors() {
16
+ return {
17
+ status: status_1.Status.Failed,
18
+ errors: [
19
+ {
20
+ message: this.message,
21
+ error_code: this.error_data.error_code,
22
+ code: this.error_data.code,
23
+ },
24
+ ],
25
+ };
26
+ }
27
+ }
28
+ exports.ForbiddenError = ForbiddenError;
@@ -0,0 +1,19 @@
1
+ import { Status } from "../helper/status";
2
+ import { CustomError } from "./custom-error";
3
+ import { ErrorReturn } from "./error.interface";
4
+ export declare class InvalidInputError extends CustomError {
5
+ message: string;
6
+ private field;
7
+ private error_data;
8
+ readonly statusCode: number;
9
+ constructor(message: string, field: string, error_data: ErrorReturn);
10
+ sequalizeErrors(): {
11
+ status: Status;
12
+ errors: {
13
+ message: string;
14
+ error_code: string;
15
+ field: string;
16
+ code: number;
17
+ }[];
18
+ };
19
+ }
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.InvalidInputError = void 0;
4
+ const status_1 = require("../helper/status");
5
+ const custom_error_1 = require("./custom-error");
6
+ class InvalidInputError extends custom_error_1.CustomError {
7
+ constructor(message, field, error_data) {
8
+ super(message);
9
+ this.message = message;
10
+ this.field = field;
11
+ this.error_data = error_data;
12
+ this.statusCode = 400;
13
+ this.error_data = error_data;
14
+ this.field = field;
15
+ Object.setPrototypeOf(this, InvalidInputError.prototype);
16
+ }
17
+ sequalizeErrors() {
18
+ return {
19
+ status: status_1.Status.Failed,
20
+ errors: [
21
+ {
22
+ message: this.message,
23
+ error_code: this.error_data.error_code,
24
+ field: this.field,
25
+ code: this.error_data.code,
26
+ },
27
+ ],
28
+ };
29
+ }
30
+ }
31
+ exports.InvalidInputError = InvalidInputError;
@@ -0,0 +1,17 @@
1
+ import { Status } from "../helper/status";
2
+ import { CustomError } from "./custom-error";
3
+ import { ErrorReturn } from "./error.interface";
4
+ export declare class MongooseBadRequestError extends CustomError {
5
+ message: string;
6
+ private error_data;
7
+ readonly statusCode: number;
8
+ constructor(message: string, error_data: ErrorReturn);
9
+ sequalizeErrors(): {
10
+ status: Status;
11
+ errors: {
12
+ message: string;
13
+ error_code: string;
14
+ code: number;
15
+ }[];
16
+ };
17
+ }
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MongooseBadRequestError = void 0;
4
+ const status_1 = require("../helper/status");
5
+ const custom_error_1 = require("./custom-error");
6
+ class MongooseBadRequestError extends custom_error_1.CustomError {
7
+ constructor(message, error_data) {
8
+ super(message);
9
+ this.message = message;
10
+ this.error_data = error_data;
11
+ this.statusCode = 400;
12
+ this.error_data = error_data;
13
+ Object.setPrototypeOf(this, MongooseBadRequestError.prototype);
14
+ }
15
+ sequalizeErrors() {
16
+ return {
17
+ status: status_1.Status.Failed,
18
+ errors: [
19
+ {
20
+ message: this.message,
21
+ error_code: this.error_data.error_code,
22
+ code: this.error_data.code,
23
+ },
24
+ ],
25
+ };
26
+ }
27
+ }
28
+ exports.MongooseBadRequestError = MongooseBadRequestError;
@@ -0,0 +1,17 @@
1
+ import { Status } from "../helper/status";
2
+ import { CustomError } from "./custom-error";
3
+ import { ErrorReturn } from "./error.interface";
4
+ export declare class NotFoundError extends CustomError {
5
+ message: string;
6
+ private error_data;
7
+ readonly statusCode = 404;
8
+ constructor(message: string, error_data: ErrorReturn);
9
+ sequalizeErrors(): {
10
+ status: Status;
11
+ errors: {
12
+ message: string;
13
+ error_code: string;
14
+ code: number;
15
+ }[];
16
+ };
17
+ }
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NotFoundError = void 0;
4
+ const status_1 = require("../helper/status");
5
+ const custom_error_1 = require("./custom-error");
6
+ class NotFoundError extends custom_error_1.CustomError {
7
+ constructor(message, error_data) {
8
+ super(message);
9
+ this.message = message;
10
+ this.error_data = error_data;
11
+ this.statusCode = 404;
12
+ this.error_data = error_data;
13
+ Object.setPrototypeOf(this, NotFoundError.prototype);
14
+ }
15
+ sequalizeErrors() {
16
+ return {
17
+ status: status_1.Status.Failed,
18
+ errors: [
19
+ {
20
+ message: this.message,
21
+ error_code: this.error_data.error_code,
22
+ code: this.error_data.code,
23
+ },
24
+ ],
25
+ };
26
+ }
27
+ }
28
+ exports.NotFoundError = NotFoundError;
@@ -0,0 +1,17 @@
1
+ import { Status } from "../helper/status";
2
+ import { CustomError } from "./custom-error";
3
+ import { ErrorReturn } from "./error.interface";
4
+ export declare class NotAuthorizedError extends CustomError {
5
+ message: string;
6
+ private error_data;
7
+ readonly statusCode: number;
8
+ constructor(message: string, error_data: ErrorReturn);
9
+ sequalizeErrors(): {
10
+ status: Status;
11
+ errors: {
12
+ message: string;
13
+ error_code: string;
14
+ code: number;
15
+ }[];
16
+ };
17
+ }