@explorins/pers-shared 2.1.9 → 2.1.11

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 (230) hide show
  1. package/README.md +62 -13
  2. package/dist/cjs/dto/auth.dto.d.ts +2 -6
  3. package/dist/cjs/dto/auth.dto.d.ts.map +1 -1
  4. package/dist/cjs/dto/auth.dto.js +17 -23
  5. package/dist/cjs/dto/auth.dto.js.map +1 -1
  6. package/dist/cjs/index.d.ts +1 -3
  7. package/dist/cjs/index.d.ts.map +1 -1
  8. package/dist/cjs/index.js +0 -4
  9. package/dist/cjs/index.js.map +1 -1
  10. package/dist/cjs/interfaces/token-transaction-input-data.interface.d.ts +12 -3
  11. package/dist/cjs/interfaces/token-transaction-input-data.interface.d.ts.map +1 -1
  12. package/dist/cjs/internal/database/index.d.ts +6 -0
  13. package/dist/cjs/internal/database/index.d.ts.map +1 -0
  14. package/dist/cjs/internal/database/index.js +24 -0
  15. package/dist/cjs/internal/database/index.js.map +1 -0
  16. package/dist/cjs/internal/database/models/base.model.d.ts +7 -0
  17. package/dist/cjs/internal/database/models/base.model.d.ts.map +1 -0
  18. package/dist/cjs/internal/database/models/base.model.js +11 -0
  19. package/dist/cjs/internal/database/models/base.model.js.map +1 -0
  20. package/dist/cjs/internal/database/models/fixture.model.d.ts +4 -0
  21. package/dist/cjs/internal/database/models/fixture.model.d.ts.map +1 -0
  22. package/dist/cjs/internal/database/models/fixture.model.js +8 -0
  23. package/dist/cjs/internal/database/models/fixture.model.js.map +1 -0
  24. package/dist/cjs/internal/database/schemas/fixture-fields.schema.d.ts +5 -0
  25. package/dist/cjs/internal/database/schemas/fixture-fields.schema.d.ts.map +1 -0
  26. package/dist/cjs/internal/database/schemas/fixture-fields.schema.js +11 -0
  27. package/dist/cjs/internal/database/schemas/fixture-fields.schema.js.map +1 -0
  28. package/dist/cjs/internal/database/schemas/shared-fields.schema.d.ts +44 -0
  29. package/dist/cjs/internal/database/schemas/shared-fields.schema.d.ts.map +1 -0
  30. package/dist/cjs/internal/database/schemas/shared-fields.schema.js +64 -0
  31. package/dist/cjs/internal/database/schemas/shared-fields.schema.js.map +1 -0
  32. package/dist/cjs/internal/database/schemas/tenant-fields.schema.d.ts +51 -0
  33. package/dist/cjs/internal/database/schemas/tenant-fields.schema.d.ts.map +1 -0
  34. package/dist/cjs/internal/database/schemas/tenant-fields.schema.js +57 -0
  35. package/dist/cjs/internal/database/schemas/tenant-fields.schema.js.map +1 -0
  36. package/dist/cjs/internal/enums/lambda.enum.d.ts +28 -0
  37. package/dist/cjs/internal/enums/lambda.enum.d.ts.map +1 -0
  38. package/dist/cjs/internal/enums/lambda.enum.js +34 -0
  39. package/dist/cjs/internal/enums/lambda.enum.js.map +1 -0
  40. package/dist/cjs/internal/exceptions/base/error-classification-enums.d.ts +118 -0
  41. package/dist/cjs/internal/exceptions/base/error-classification-enums.d.ts.map +1 -0
  42. package/dist/cjs/internal/exceptions/base/error-classification-enums.js +111 -0
  43. package/dist/cjs/internal/exceptions/base/error-classification-enums.js.map +1 -0
  44. package/dist/cjs/internal/exceptions/base/error-classification.interface.d.ts +48 -0
  45. package/dist/cjs/internal/exceptions/base/error-classification.interface.d.ts.map +1 -0
  46. package/dist/cjs/internal/exceptions/base/error-classification.interface.js +6 -0
  47. package/dist/cjs/internal/exceptions/base/error-classification.interface.js.map +1 -0
  48. package/dist/cjs/internal/exceptions/base/error-classifier.d.ts +23 -0
  49. package/dist/cjs/internal/exceptions/base/error-classifier.d.ts.map +1 -0
  50. package/dist/cjs/internal/exceptions/base/error-classifier.js +149 -0
  51. package/dist/cjs/internal/exceptions/base/error-classifier.js.map +1 -0
  52. package/dist/cjs/internal/exceptions/index.d.ts +3 -0
  53. package/dist/cjs/internal/exceptions/index.d.ts.map +1 -0
  54. package/dist/cjs/internal/exceptions/index.js +24 -0
  55. package/dist/cjs/internal/exceptions/index.js.map +1 -0
  56. package/dist/cjs/internal/functions/crypto.functions.d.ts +16 -0
  57. package/dist/cjs/internal/functions/crypto.functions.d.ts.map +1 -0
  58. package/dist/cjs/internal/functions/crypto.functions.js +110 -0
  59. package/dist/cjs/internal/functions/crypto.functions.js.map +1 -0
  60. package/dist/cjs/internal/functions/helper.functions.d.ts +10 -0
  61. package/dist/cjs/internal/functions/helper.functions.d.ts.map +1 -0
  62. package/dist/cjs/internal/functions/helper.functions.js +38 -0
  63. package/dist/cjs/internal/functions/helper.functions.js.map +1 -0
  64. package/dist/cjs/internal/functions/index.d.ts +4 -0
  65. package/dist/cjs/internal/functions/index.d.ts.map +1 -0
  66. package/dist/cjs/internal/functions/index.js +21 -0
  67. package/dist/cjs/internal/functions/index.js.map +1 -0
  68. package/dist/cjs/internal/functions/request.functions.d.ts +14 -0
  69. package/dist/cjs/internal/functions/request.functions.d.ts.map +1 -0
  70. package/dist/cjs/internal/functions/request.functions.js +69 -0
  71. package/dist/cjs/internal/functions/request.functions.js.map +1 -0
  72. package/dist/cjs/internal/index.d.ts +14 -0
  73. package/dist/cjs/internal/index.d.ts.map +1 -0
  74. package/dist/cjs/internal/index.js +42 -0
  75. package/dist/cjs/internal/index.js.map +1 -0
  76. package/dist/cjs/internal/interfaces/index.d.ts +3 -0
  77. package/dist/cjs/internal/interfaces/index.d.ts.map +1 -0
  78. package/dist/cjs/internal/interfaces/index.js +19 -0
  79. package/dist/cjs/internal/interfaces/index.js.map +1 -0
  80. package/dist/cjs/internal/interfaces/request.interface.d.ts +21 -0
  81. package/dist/cjs/internal/interfaces/request.interface.d.ts.map +1 -0
  82. package/dist/cjs/internal/interfaces/request.interface.js +15 -0
  83. package/dist/cjs/internal/interfaces/request.interface.js.map +1 -0
  84. package/dist/cjs/internal/interfaces/stripe-payment-intent-metadata.interface.d.ts +9 -0
  85. package/dist/cjs/internal/interfaces/stripe-payment-intent-metadata.interface.d.ts.map +1 -0
  86. package/dist/cjs/internal/interfaces/stripe-payment-intent-metadata.interface.js +3 -0
  87. package/dist/cjs/internal/interfaces/stripe-payment-intent-metadata.interface.js.map +1 -0
  88. package/dist/cjs/internal/internal-index.d.ts +8 -0
  89. package/dist/cjs/internal/internal-index.d.ts.map +1 -0
  90. package/dist/cjs/internal/internal-index.js +33 -0
  91. package/dist/cjs/internal/internal-index.js.map +1 -0
  92. package/dist/cjs/internal/orchestrators/base-orchestrator.d.ts +90 -0
  93. package/dist/cjs/internal/orchestrators/base-orchestrator.d.ts.map +1 -0
  94. package/dist/cjs/internal/orchestrators/base-orchestrator.js +124 -0
  95. package/dist/cjs/internal/orchestrators/base-orchestrator.js.map +1 -0
  96. package/dist/cjs/internal/orchestrators/base-workflow.d.ts +50 -0
  97. package/dist/cjs/internal/orchestrators/base-workflow.d.ts.map +1 -0
  98. package/dist/cjs/internal/orchestrators/base-workflow.js +68 -0
  99. package/dist/cjs/internal/orchestrators/base-workflow.js.map +1 -0
  100. package/dist/cjs/internal/orchestrators/index.d.ts +26 -0
  101. package/dist/cjs/internal/orchestrators/index.d.ts.map +1 -0
  102. package/dist/cjs/internal/orchestrators/index.js +46 -0
  103. package/dist/cjs/internal/orchestrators/index.js.map +1 -0
  104. package/dist/cjs/internal/utils/index.d.ts +2 -0
  105. package/dist/cjs/internal/utils/index.d.ts.map +1 -0
  106. package/dist/cjs/internal/utils/index.js +19 -0
  107. package/dist/cjs/internal/utils/index.js.map +1 -0
  108. package/dist/cjs/internal/utils/validation.utils.d.ts +49 -0
  109. package/dist/cjs/internal/utils/validation.utils.d.ts.map +1 -0
  110. package/dist/cjs/internal/utils/validation.utils.js +76 -0
  111. package/dist/cjs/internal/utils/validation.utils.js.map +1 -0
  112. package/dist/cjs/value-objects/token-transaction-input.vo.d.ts +2 -3
  113. package/dist/cjs/value-objects/token-transaction-input.vo.d.ts.map +1 -1
  114. package/dist/cjs/value-objects/token-transaction-input.vo.js +12 -20
  115. package/dist/cjs/value-objects/token-transaction-input.vo.js.map +1 -1
  116. package/dist/esm/dto/auth.dto.d.ts +2 -6
  117. package/dist/esm/dto/auth.dto.d.ts.map +1 -1
  118. package/dist/esm/dto/auth.dto.js +14 -18
  119. package/dist/esm/dto/auth.dto.js.map +1 -1
  120. package/dist/esm/index.d.ts +1 -3
  121. package/dist/esm/index.d.ts.map +1 -1
  122. package/dist/esm/index.js +0 -4
  123. package/dist/esm/index.js.map +1 -1
  124. package/dist/esm/interfaces/token-transaction-input-data.interface.d.ts +12 -3
  125. package/dist/esm/interfaces/token-transaction-input-data.interface.d.ts.map +1 -1
  126. package/dist/esm/internal/database/index.d.ts +6 -0
  127. package/dist/esm/internal/database/index.d.ts.map +1 -0
  128. package/dist/esm/internal/database/index.js +8 -0
  129. package/dist/esm/internal/database/index.js.map +1 -0
  130. package/dist/esm/internal/database/models/base.model.d.ts +7 -0
  131. package/dist/esm/internal/database/models/base.model.d.ts.map +1 -0
  132. package/dist/esm/internal/database/models/base.model.js +7 -0
  133. package/dist/esm/internal/database/models/base.model.js.map +1 -0
  134. package/dist/esm/internal/database/models/fixture.model.d.ts +4 -0
  135. package/dist/esm/internal/database/models/fixture.model.d.ts.map +1 -0
  136. package/dist/esm/internal/database/models/fixture.model.js +4 -0
  137. package/dist/esm/internal/database/models/fixture.model.js.map +1 -0
  138. package/dist/esm/internal/database/schemas/fixture-fields.schema.d.ts +5 -0
  139. package/dist/esm/internal/database/schemas/fixture-fields.schema.d.ts.map +1 -0
  140. package/dist/esm/internal/database/schemas/fixture-fields.schema.js +8 -0
  141. package/dist/esm/internal/database/schemas/fixture-fields.schema.js.map +1 -0
  142. package/dist/esm/internal/database/schemas/shared-fields.schema.d.ts +44 -0
  143. package/dist/esm/internal/database/schemas/shared-fields.schema.d.ts.map +1 -0
  144. package/dist/esm/internal/database/schemas/shared-fields.schema.js +61 -0
  145. package/dist/esm/internal/database/schemas/shared-fields.schema.js.map +1 -0
  146. package/dist/esm/internal/database/schemas/tenant-fields.schema.d.ts +51 -0
  147. package/dist/esm/internal/database/schemas/tenant-fields.schema.d.ts.map +1 -0
  148. package/dist/esm/internal/database/schemas/tenant-fields.schema.js +54 -0
  149. package/dist/esm/internal/database/schemas/tenant-fields.schema.js.map +1 -0
  150. package/dist/esm/internal/enums/lambda.enum.d.ts +28 -0
  151. package/dist/esm/internal/enums/lambda.enum.d.ts.map +1 -0
  152. package/dist/esm/internal/enums/lambda.enum.js +31 -0
  153. package/dist/esm/internal/enums/lambda.enum.js.map +1 -0
  154. package/dist/esm/internal/exceptions/base/error-classification-enums.d.ts +118 -0
  155. package/dist/esm/internal/exceptions/base/error-classification-enums.d.ts.map +1 -0
  156. package/dist/esm/internal/exceptions/base/error-classification-enums.js +108 -0
  157. package/dist/esm/internal/exceptions/base/error-classification-enums.js.map +1 -0
  158. package/dist/esm/internal/exceptions/base/error-classification.interface.d.ts +48 -0
  159. package/dist/esm/internal/exceptions/base/error-classification.interface.d.ts.map +1 -0
  160. package/dist/esm/internal/exceptions/base/error-classification.interface.js +5 -0
  161. package/dist/esm/internal/exceptions/base/error-classification.interface.js.map +1 -0
  162. package/dist/esm/internal/exceptions/base/error-classifier.d.ts +23 -0
  163. package/dist/esm/internal/exceptions/base/error-classifier.d.ts.map +1 -0
  164. package/dist/esm/internal/exceptions/base/error-classifier.js +145 -0
  165. package/dist/esm/internal/exceptions/base/error-classifier.js.map +1 -0
  166. package/dist/esm/internal/exceptions/index.d.ts +3 -0
  167. package/dist/esm/internal/exceptions/index.d.ts.map +1 -0
  168. package/dist/esm/internal/exceptions/index.js +6 -0
  169. package/dist/esm/internal/exceptions/index.js.map +1 -0
  170. package/dist/esm/internal/functions/crypto.functions.d.ts +16 -0
  171. package/dist/esm/internal/functions/crypto.functions.d.ts.map +1 -0
  172. package/dist/esm/internal/functions/crypto.functions.js +67 -0
  173. package/dist/esm/internal/functions/crypto.functions.js.map +1 -0
  174. package/dist/esm/internal/functions/helper.functions.d.ts +10 -0
  175. package/dist/esm/internal/functions/helper.functions.d.ts.map +1 -0
  176. package/dist/esm/internal/functions/helper.functions.js +32 -0
  177. package/dist/esm/internal/functions/helper.functions.js.map +1 -0
  178. package/dist/esm/internal/functions/index.d.ts +4 -0
  179. package/dist/esm/internal/functions/index.d.ts.map +1 -0
  180. package/dist/esm/internal/functions/index.js +5 -0
  181. package/dist/esm/internal/functions/index.js.map +1 -0
  182. package/dist/esm/internal/functions/request.functions.d.ts +14 -0
  183. package/dist/esm/internal/functions/request.functions.d.ts.map +1 -0
  184. package/dist/esm/internal/functions/request.functions.js +61 -0
  185. package/dist/esm/internal/functions/request.functions.js.map +1 -0
  186. package/dist/esm/internal/index.d.ts +14 -0
  187. package/dist/esm/internal/index.d.ts.map +1 -0
  188. package/dist/esm/internal/index.js +26 -0
  189. package/dist/esm/internal/index.js.map +1 -0
  190. package/dist/esm/internal/interfaces/index.d.ts +3 -0
  191. package/dist/esm/internal/interfaces/index.d.ts.map +1 -0
  192. package/dist/esm/internal/interfaces/index.js +3 -0
  193. package/dist/esm/internal/interfaces/index.js.map +1 -0
  194. package/dist/esm/internal/interfaces/request.interface.d.ts +21 -0
  195. package/dist/esm/internal/interfaces/request.interface.d.ts.map +1 -0
  196. package/dist/esm/internal/interfaces/request.interface.js +11 -0
  197. package/dist/esm/internal/interfaces/request.interface.js.map +1 -0
  198. package/dist/esm/internal/interfaces/stripe-payment-intent-metadata.interface.d.ts +9 -0
  199. package/dist/esm/internal/interfaces/stripe-payment-intent-metadata.interface.d.ts.map +1 -0
  200. package/dist/esm/internal/interfaces/stripe-payment-intent-metadata.interface.js +2 -0
  201. package/dist/esm/internal/interfaces/stripe-payment-intent-metadata.interface.js.map +1 -0
  202. package/dist/esm/internal/internal-index.d.ts +8 -0
  203. package/dist/esm/internal/internal-index.d.ts.map +1 -0
  204. package/dist/esm/internal/internal-index.js +17 -0
  205. package/dist/esm/internal/internal-index.js.map +1 -0
  206. package/dist/esm/internal/orchestrators/base-orchestrator.d.ts +90 -0
  207. package/dist/esm/internal/orchestrators/base-orchestrator.d.ts.map +1 -0
  208. package/dist/esm/internal/orchestrators/base-orchestrator.js +116 -0
  209. package/dist/esm/internal/orchestrators/base-orchestrator.js.map +1 -0
  210. package/dist/esm/internal/orchestrators/base-workflow.d.ts +50 -0
  211. package/dist/esm/internal/orchestrators/base-workflow.d.ts.map +1 -0
  212. package/dist/esm/internal/orchestrators/base-workflow.js +64 -0
  213. package/dist/esm/internal/orchestrators/base-workflow.js.map +1 -0
  214. package/dist/esm/internal/orchestrators/index.d.ts +26 -0
  215. package/dist/esm/internal/orchestrators/index.d.ts.map +1 -0
  216. package/dist/esm/internal/orchestrators/index.js +30 -0
  217. package/dist/esm/internal/orchestrators/index.js.map +1 -0
  218. package/dist/esm/internal/utils/index.d.ts +2 -0
  219. package/dist/esm/internal/utils/index.d.ts.map +1 -0
  220. package/dist/esm/internal/utils/index.js +3 -0
  221. package/dist/esm/internal/utils/index.js.map +1 -0
  222. package/dist/esm/internal/utils/validation.utils.d.ts +49 -0
  223. package/dist/esm/internal/utils/validation.utils.d.ts.map +1 -0
  224. package/dist/esm/internal/utils/validation.utils.js +70 -0
  225. package/dist/esm/internal/utils/validation.utils.js.map +1 -0
  226. package/dist/esm/value-objects/token-transaction-input.vo.d.ts +2 -3
  227. package/dist/esm/value-objects/token-transaction-input.vo.d.ts.map +1 -1
  228. package/dist/esm/value-objects/token-transaction-input.vo.js +10 -18
  229. package/dist/esm/value-objects/token-transaction-input.vo.js.map +1 -1
  230. package/package.json +7 -1
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Lambda function enums for internal microservice communication
3
+ * Used across multiple domains for lambda-based orchestration
4
+ */
5
+ /**
6
+ * Domain enum for Lambda function names
7
+ * Contains business-meaningful function categories
8
+ */
9
+ export declare enum LambdaFunctionName {
10
+ TRANSACTION = "transaction"
11
+ }
12
+ /**
13
+ * Domain enum for specific invokable Lambda functions
14
+ * Represents the business operations available through Lambda
15
+ */
16
+ export declare enum LambdaInvokableFunctionName {
17
+ RUN_TRANSACTION_ASYNC = "runTransactionAsync",
18
+ SUBMIT_SIGNED_TRANSACTION = "submitSignedTransaction"
19
+ }
20
+ /**
21
+ * Domain enum for Lambda invocation types
22
+ * Business perspective on synchronous vs asynchronous operations
23
+ */
24
+ export declare enum LambdaInvocationType {
25
+ SYNCHRONOUS = "RequestResponse",
26
+ ASYNCHRONOUS = "Event"
27
+ }
28
+ //# sourceMappingURL=lambda.enum.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lambda.enum.d.ts","sourceRoot":"","sources":["../../../../src/internal/enums/lambda.enum.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,oBAAY,kBAAkB;IAC5B,WAAW,gBAAgB;CAC5B;AAED;;;GAGG;AACH,oBAAY,2BAA2B;IACrC,qBAAqB,wBAAwB;IAC7C,yBAAyB,4BAA4B;CACtD;AAED;;;GAGG;AACH,oBAAY,oBAAoB;IAC9B,WAAW,oBAAoB;IAC/B,YAAY,UAAU;CACvB"}
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ /**
3
+ * Lambda function enums for internal microservice communication
4
+ * Used across multiple domains for lambda-based orchestration
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.LambdaInvocationType = exports.LambdaInvokableFunctionName = exports.LambdaFunctionName = void 0;
8
+ /**
9
+ * Domain enum for Lambda function names
10
+ * Contains business-meaningful function categories
11
+ */
12
+ var LambdaFunctionName;
13
+ (function (LambdaFunctionName) {
14
+ LambdaFunctionName["TRANSACTION"] = "transaction";
15
+ })(LambdaFunctionName || (exports.LambdaFunctionName = LambdaFunctionName = {}));
16
+ /**
17
+ * Domain enum for specific invokable Lambda functions
18
+ * Represents the business operations available through Lambda
19
+ */
20
+ var LambdaInvokableFunctionName;
21
+ (function (LambdaInvokableFunctionName) {
22
+ LambdaInvokableFunctionName["RUN_TRANSACTION_ASYNC"] = "runTransactionAsync";
23
+ LambdaInvokableFunctionName["SUBMIT_SIGNED_TRANSACTION"] = "submitSignedTransaction";
24
+ })(LambdaInvokableFunctionName || (exports.LambdaInvokableFunctionName = LambdaInvokableFunctionName = {}));
25
+ /**
26
+ * Domain enum for Lambda invocation types
27
+ * Business perspective on synchronous vs asynchronous operations
28
+ */
29
+ var LambdaInvocationType;
30
+ (function (LambdaInvocationType) {
31
+ LambdaInvocationType["SYNCHRONOUS"] = "RequestResponse";
32
+ LambdaInvocationType["ASYNCHRONOUS"] = "Event";
33
+ })(LambdaInvocationType || (exports.LambdaInvocationType = LambdaInvocationType = {}));
34
+ //# sourceMappingURL=lambda.enum.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lambda.enum.js","sourceRoot":"","sources":["../../../../src/internal/enums/lambda.enum.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH;;;GAGG;AACH,IAAY,kBAEX;AAFD,WAAY,kBAAkB;IAC5B,iDAA2B,CAAA;AAC7B,CAAC,EAFW,kBAAkB,kCAAlB,kBAAkB,QAE7B;AAED;;;GAGG;AACH,IAAY,2BAGX;AAHD,WAAY,2BAA2B;IACrC,4EAA6C,CAAA;IAC7C,oFAAqD,CAAA;AACvD,CAAC,EAHW,2BAA2B,2CAA3B,2BAA2B,QAGtC;AAED;;;GAGG;AACH,IAAY,oBAGX;AAHD,WAAY,oBAAoB;IAC9B,uDAA+B,CAAA;IAC/B,8CAAsB,CAAA;AACxB,CAAC,EAHW,oBAAoB,oCAApB,oBAAoB,QAG/B"}
@@ -0,0 +1,118 @@
1
+ /**
2
+ * Error Classification Enums and Interfaces
3
+ *
4
+ * This file defines the error categorization system used throughout the application.
5
+ *
6
+ * 🎯 DEVELOPER GUIDANCE:
7
+ *
8
+ * When creating errors, choose the appropriate category:
9
+ *
10
+ * 1. DOMAIN_RULE: Business logic violations
11
+ * → Use BusinessLogicError subclasses (e.g., TokenTypeNotFoundError)
12
+ *
13
+ * 2. TECHNICAL: Application/config issues
14
+ * → Use TechnicalError.withMessage() for meaningful technical errors
15
+ *
16
+ * 3. VALIDATION: Input format/validation failures
17
+ * → Let NestJS validation decorators handle these automatically
18
+ *
19
+ * 4. INFRASTRUCTURE: External system failures
20
+ * → These are usually classified automatically from generic Error() instances
21
+ *
22
+ * 5. SECURITY: Auth/authorization issues
23
+ * → Use NestJS guards and filters for consistent security errors
24
+ *
25
+ * 💡 TIP: Prefer structured errors (BusinessLogicError/TechnicalError) over generic Error()
26
+ * for better user experience and debugging capability.
27
+ *
28
+ * 📊 QUICK REFERENCE TABLE:
29
+ * ┌─────────────────┬─────────────┬─────────────────────────────────────┬───────────┐
30
+ * │ Category │ HTTP Status │ Example │ Retryable │
31
+ * ├─────────────────┼─────────────┼─────────────────────────────────────┼───────────┤
32
+ * │ VALIDATION │ 400 │ "Email format invalid" │ No │
33
+ * │ DOMAIN_RULE │ 422 │ "Insufficient balance" │ No │
34
+ * │ TECHNICAL │ 422 │ "Invalid file format" │ Maybe │
35
+ * │ INFRASTRUCTURE │ 503 │ "Database connection failed" │ Yes │
36
+ * │ SECURITY │ 403 │ "Access denied" │ No │
37
+ * │ RATE_LIMIT │ 429 │ "API rate limit exceeded" │ Yes │
38
+ * │ TIMEOUT │ 504 │ "Request timeout" │ Yes │
39
+ * │ UNKNOWN │ 500 │ Generic Error() instances │ Yes │
40
+ * └─────────────────┴─────────────┴─────────────────────────────────────┴───────────┘
41
+ */
42
+ /**
43
+ * Error severity levels for prioritization and alerting
44
+ *
45
+ * Determines the urgency of response and escalation procedures:
46
+ * - Monitoring alert thresholds
47
+ * - On-call escalation policies
48
+ * - SLA response times
49
+ * - Business impact assessment
50
+ */
51
+ export declare enum ErrorSeverity {
52
+ /**
53
+ * Low severity - Minor issues, degraded experience but service functional
54
+ * Examples: Optional feature failures, cosmetic issues, non-critical warnings
55
+ * Response Time: 24-48 hours
56
+ * Escalation: Development team during business hours
57
+ * Business Impact: Minimal
58
+ */
59
+ LOW = "LOW",
60
+ /**
61
+ * Medium severity - Noticeable issues, some functionality impaired
62
+ * Examples: Performance degradation, secondary feature failures, data sync delays
63
+ * Response Time: 4-8 hours
64
+ * Escalation: Development team within same day
65
+ * Business Impact: Moderate
66
+ */
67
+ MEDIUM = "MEDIUM",
68
+ /**
69
+ * High severity - Significant issues, core functionality impaired
70
+ * Examples: Payment failures, authentication issues, critical feature outages
71
+ * Response Time: 1-2 hours
72
+ * Escalation: Immediate development team notification
73
+ * Business Impact: High
74
+ */
75
+ HIGH = "HIGH",
76
+ /**
77
+ * Critical severity - System down, major business impact
78
+ * Examples: Complete service outage, data corruption, security breaches
79
+ * Response Time: Immediate (< 15 minutes)
80
+ * Escalation: Page on-call engineer, notify leadership
81
+ * Business Impact: Severe
82
+ */
83
+ CRITICAL = "CRITICAL"
84
+ }
85
+ /**
86
+ * API error response format including correlation tracking
87
+ */
88
+ export interface ApiErrorResponse {
89
+ code: string;
90
+ domain: string;
91
+ message: string;
92
+ developerMessage?: string;
93
+ action?: string;
94
+ timestamp: string;
95
+ category: string;
96
+ correlationId: string;
97
+ retryable: boolean;
98
+ severity: ErrorSeverity;
99
+ }
100
+ /**
101
+ * HTTP Status codes used by our error classification system
102
+ *
103
+ * Centralized here to maintain consistency across error classification
104
+ * and avoid duplication with NestJS HttpStatus values.
105
+ */
106
+ export declare enum ErrorHttpStatus {
107
+ BAD_REQUEST = 400,
108
+ UNAUTHORIZED = 401,
109
+ FORBIDDEN = 403,
110
+ NOT_FOUND = 404,
111
+ CONFLICT = 409,
112
+ UNPROCESSABLE_ENTITY = 422,
113
+ TOO_MANY_REQUESTS = 429,
114
+ INTERNAL_SERVER_ERROR = 500,
115
+ SERVICE_UNAVAILABLE = 503,
116
+ GATEWAY_TIMEOUT = 504
117
+ }
118
+ //# sourceMappingURL=error-classification-enums.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-classification-enums.d.ts","sourceRoot":"","sources":["../../../../../src/internal/exceptions/base/error-classification-enums.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAKH;;;;;;;;GAQG;AACH,oBAAY,aAAa;IACvB;;;;;;OAMG;IACH,GAAG,QAAQ;IAEX;;;;;;OAMG;IACH,MAAM,WAAW;IAEjB;;;;;;OAMG;IACH,IAAI,SAAS;IAEb;;;;;;OAMG;IACH,QAAQ,aAAa;CACtB;AAID;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,aAAa,CAAC;CACzB;AAID;;;;;GAKG;AACH,oBAAY,eAAe;IACzB,WAAW,MAAM;IACjB,YAAY,MAAM;IAClB,SAAS,MAAM;IACf,SAAS,MAAM;IACf,QAAQ,MAAM;IACd,oBAAoB,MAAM;IAC1B,iBAAiB,MAAM;IACvB,qBAAqB,MAAM;IAC3B,mBAAmB,MAAM;IACzB,eAAe,MAAM;CACtB"}
@@ -0,0 +1,111 @@
1
+ "use strict";
2
+ /**
3
+ * Error Classification Enums and Interfaces
4
+ *
5
+ * This file defines the error categorization system used throughout the application.
6
+ *
7
+ * 🎯 DEVELOPER GUIDANCE:
8
+ *
9
+ * When creating errors, choose the appropriate category:
10
+ *
11
+ * 1. DOMAIN_RULE: Business logic violations
12
+ * → Use BusinessLogicError subclasses (e.g., TokenTypeNotFoundError)
13
+ *
14
+ * 2. TECHNICAL: Application/config issues
15
+ * → Use TechnicalError.withMessage() for meaningful technical errors
16
+ *
17
+ * 3. VALIDATION: Input format/validation failures
18
+ * → Let NestJS validation decorators handle these automatically
19
+ *
20
+ * 4. INFRASTRUCTURE: External system failures
21
+ * → These are usually classified automatically from generic Error() instances
22
+ *
23
+ * 5. SECURITY: Auth/authorization issues
24
+ * → Use NestJS guards and filters for consistent security errors
25
+ *
26
+ * 💡 TIP: Prefer structured errors (BusinessLogicError/TechnicalError) over generic Error()
27
+ * for better user experience and debugging capability.
28
+ *
29
+ * 📊 QUICK REFERENCE TABLE:
30
+ * ┌─────────────────┬─────────────┬─────────────────────────────────────┬───────────┐
31
+ * │ Category │ HTTP Status │ Example │ Retryable │
32
+ * ├─────────────────┼─────────────┼─────────────────────────────────────┼───────────┤
33
+ * │ VALIDATION │ 400 │ "Email format invalid" │ No │
34
+ * │ DOMAIN_RULE │ 422 │ "Insufficient balance" │ No │
35
+ * │ TECHNICAL │ 422 │ "Invalid file format" │ Maybe │
36
+ * │ INFRASTRUCTURE │ 503 │ "Database connection failed" │ Yes │
37
+ * │ SECURITY │ 403 │ "Access denied" │ No │
38
+ * │ RATE_LIMIT │ 429 │ "API rate limit exceeded" │ Yes │
39
+ * │ TIMEOUT │ 504 │ "Request timeout" │ Yes │
40
+ * │ UNKNOWN │ 500 │ Generic Error() instances │ Yes │
41
+ * └─────────────────┴─────────────┴─────────────────────────────────────┴───────────┘
42
+ */
43
+ Object.defineProperty(exports, "__esModule", { value: true });
44
+ exports.ErrorHttpStatus = exports.ErrorSeverity = void 0;
45
+ // Note: ErrorCategory is now imported from @explorins/pers-shared
46
+ // This library contains only the detailed classification enums and interfaces
47
+ /**
48
+ * Error severity levels for prioritization and alerting
49
+ *
50
+ * Determines the urgency of response and escalation procedures:
51
+ * - Monitoring alert thresholds
52
+ * - On-call escalation policies
53
+ * - SLA response times
54
+ * - Business impact assessment
55
+ */
56
+ var ErrorSeverity;
57
+ (function (ErrorSeverity) {
58
+ /**
59
+ * Low severity - Minor issues, degraded experience but service functional
60
+ * Examples: Optional feature failures, cosmetic issues, non-critical warnings
61
+ * Response Time: 24-48 hours
62
+ * Escalation: Development team during business hours
63
+ * Business Impact: Minimal
64
+ */
65
+ ErrorSeverity["LOW"] = "LOW";
66
+ /**
67
+ * Medium severity - Noticeable issues, some functionality impaired
68
+ * Examples: Performance degradation, secondary feature failures, data sync delays
69
+ * Response Time: 4-8 hours
70
+ * Escalation: Development team within same day
71
+ * Business Impact: Moderate
72
+ */
73
+ ErrorSeverity["MEDIUM"] = "MEDIUM";
74
+ /**
75
+ * High severity - Significant issues, core functionality impaired
76
+ * Examples: Payment failures, authentication issues, critical feature outages
77
+ * Response Time: 1-2 hours
78
+ * Escalation: Immediate development team notification
79
+ * Business Impact: High
80
+ */
81
+ ErrorSeverity["HIGH"] = "HIGH";
82
+ /**
83
+ * Critical severity - System down, major business impact
84
+ * Examples: Complete service outage, data corruption, security breaches
85
+ * Response Time: Immediate (< 15 minutes)
86
+ * Escalation: Page on-call engineer, notify leadership
87
+ * Business Impact: Severe
88
+ */
89
+ ErrorSeverity["CRITICAL"] = "CRITICAL";
90
+ })(ErrorSeverity || (exports.ErrorSeverity = ErrorSeverity = {}));
91
+ // Note: All interfaces moved to @explorins/pers-shared for proper data contract separation
92
+ /**
93
+ * HTTP Status codes used by our error classification system
94
+ *
95
+ * Centralized here to maintain consistency across error classification
96
+ * and avoid duplication with NestJS HttpStatus values.
97
+ */
98
+ var ErrorHttpStatus;
99
+ (function (ErrorHttpStatus) {
100
+ ErrorHttpStatus[ErrorHttpStatus["BAD_REQUEST"] = 400] = "BAD_REQUEST";
101
+ ErrorHttpStatus[ErrorHttpStatus["UNAUTHORIZED"] = 401] = "UNAUTHORIZED";
102
+ ErrorHttpStatus[ErrorHttpStatus["FORBIDDEN"] = 403] = "FORBIDDEN";
103
+ ErrorHttpStatus[ErrorHttpStatus["NOT_FOUND"] = 404] = "NOT_FOUND";
104
+ ErrorHttpStatus[ErrorHttpStatus["CONFLICT"] = 409] = "CONFLICT";
105
+ ErrorHttpStatus[ErrorHttpStatus["UNPROCESSABLE_ENTITY"] = 422] = "UNPROCESSABLE_ENTITY";
106
+ ErrorHttpStatus[ErrorHttpStatus["TOO_MANY_REQUESTS"] = 429] = "TOO_MANY_REQUESTS";
107
+ ErrorHttpStatus[ErrorHttpStatus["INTERNAL_SERVER_ERROR"] = 500] = "INTERNAL_SERVER_ERROR";
108
+ ErrorHttpStatus[ErrorHttpStatus["SERVICE_UNAVAILABLE"] = 503] = "SERVICE_UNAVAILABLE";
109
+ ErrorHttpStatus[ErrorHttpStatus["GATEWAY_TIMEOUT"] = 504] = "GATEWAY_TIMEOUT";
110
+ })(ErrorHttpStatus || (exports.ErrorHttpStatus = ErrorHttpStatus = {}));
111
+ //# sourceMappingURL=error-classification-enums.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-classification-enums.js","sourceRoot":"","sources":["../../../../../src/internal/exceptions/base/error-classification-enums.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;;;AAEH,kEAAkE;AAClE,8EAA8E;AAE9E;;;;;;;;GAQG;AACH,IAAY,aAoCX;AApCD,WAAY,aAAa;IACvB;;;;;;OAMG;IACH,4BAAW,CAAA;IAEX;;;;;;OAMG;IACH,kCAAiB,CAAA;IAEjB;;;;;;OAMG;IACH,8BAAa,CAAA;IAEb;;;;;;OAMG;IACH,sCAAqB,CAAA;AACvB,CAAC,EApCW,aAAa,6BAAb,aAAa,QAoCxB;AAoBD,2FAA2F;AAE3F;;;;;GAKG;AACH,IAAY,eAWX;AAXD,WAAY,eAAe;IACzB,qEAAiB,CAAA;IACjB,uEAAkB,CAAA;IAClB,iEAAe,CAAA;IACf,iEAAe,CAAA;IACf,+DAAc,CAAA;IACd,uFAA0B,CAAA;IAC1B,iFAAuB,CAAA;IACvB,yFAA2B,CAAA;IAC3B,qFAAyB,CAAA;IACzB,6EAAqB,CAAA;AACvB,CAAC,EAXW,eAAe,+BAAf,eAAe,QAW1B"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Error classification and response interfaces for domain-driven error handling
3
+ */
4
+ import { ErrorCategory } from '@explorins/pers-shared';
5
+ import { ErrorSeverity } from './error-classification-enums';
6
+ export interface ErrorClassificationResult {
7
+ category: ErrorCategory;
8
+ severity: ErrorSeverity;
9
+ retryable: boolean;
10
+ userFacing: boolean;
11
+ httpStatusCode: number;
12
+ }
13
+ export interface ApiErrorResponse {
14
+ code: string;
15
+ domain: string;
16
+ message: string;
17
+ developerMessage?: string;
18
+ action?: string;
19
+ timestamp: string;
20
+ category: string;
21
+ correlationId: string;
22
+ retryable?: boolean;
23
+ severity?: string;
24
+ }
25
+ export interface LoggingContext {
26
+ domain: string;
27
+ operation: string;
28
+ errorCode: string;
29
+ severity: ErrorSeverity;
30
+ additionalContext?: Record<string, any>;
31
+ }
32
+ /**
33
+ * Interface for self-classifying errors
34
+ */
35
+ export interface SelfClassifyingError {
36
+ classify(): ErrorClassificationResult;
37
+ toApiResponse(correlationId: string): ApiErrorResponse;
38
+ getLoggingContext(): LoggingContext;
39
+ }
40
+ /**
41
+ * Interface for domain-specific error classifiers
42
+ */
43
+ export interface DomainErrorClassifier {
44
+ canClassify(error: any): boolean;
45
+ classify(error: any): ErrorClassificationResult;
46
+ formatApiResponse(error: any, correlationId: string): ApiErrorResponse;
47
+ }
48
+ //# sourceMappingURL=error-classification.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-classification.interface.d.ts","sourceRoot":"","sources":["../../../../../src/internal/exceptions/base/error-classification.interface.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAE7D,MAAM,WAAW,yBAAyB;IACxC,QAAQ,EAAE,aAAa,CAAC;IACxB,QAAQ,EAAE,aAAa,CAAC;IACxB,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,aAAa,CAAC;IACxB,iBAAiB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACzC;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,QAAQ,IAAI,yBAAyB,CAAC;IACtC,aAAa,CAAC,aAAa,EAAE,MAAM,GAAG,gBAAgB,CAAC;IACvD,iBAAiB,IAAI,cAAc,CAAC;CACrC;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,WAAW,CAAC,KAAK,EAAE,GAAG,GAAG,OAAO,CAAC;IACjC,QAAQ,CAAC,KAAK,EAAE,GAAG,GAAG,yBAAyB,CAAC;IAChD,iBAAiB,CAAC,KAAK,EAAE,GAAG,EAAE,aAAa,EAAE,MAAM,GAAG,gBAAgB,CAAC;CACxE"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ /**
3
+ * Error classification and response interfaces for domain-driven error handling
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ //# sourceMappingURL=error-classification.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-classification.interface.js","sourceRoot":"","sources":["../../../../../src/internal/exceptions/base/error-classification.interface.ts"],"names":[],"mappings":";AAAA;;GAEG"}
@@ -0,0 +1,23 @@
1
+ import { StructuredError } from '@explorins/pers-shared';
2
+ /**
3
+ * Error classification utilities with 3-path decision logic
4
+ */
5
+ export declare class ErrorClassifier {
6
+ /**
7
+ * Simplified error classification with 3-path logic
8
+ * 1. BusinessLogicError -> Preserve structure (fast path)
9
+ * 2. TechnicalError -> Preserve message (fast path)
10
+ * 3. Everything else -> Security-first fallback
11
+ */
12
+ static classify(error: any, domain: string): StructuredError;
13
+ /**
14
+ * Determine if an error message is safe to expose to users
15
+ * Uses a balanced approach: block sensitive system data while allowing business messages
16
+ */
17
+ private static isSafeForUsers;
18
+ /**
19
+ * Convert structured error to HTTP status code
20
+ */
21
+ static getHttpStatusCode(structuredError: StructuredError): number;
22
+ }
23
+ //# sourceMappingURL=error-classifier.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-classifier.d.ts","sourceRoot":"","sources":["../../../../../src/internal/exceptions/base/error-classifier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqD,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAG5G;;GAEG;AACH,qBAAa,eAAe;IAC1B;;;;;OAKG;IACH,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,GAAG,eAAe;IAyD5D;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,cAAc;IAgE7B;;OAEG;IACH,MAAM,CAAC,iBAAiB,CAAC,eAAe,EAAE,eAAe,GAAG,MAAM;CAkBnE"}
@@ -0,0 +1,149 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ErrorClassifier = void 0;
4
+ const pers_shared_1 = require("@explorins/pers-shared");
5
+ const error_classification_enums_1 = require("./error-classification-enums");
6
+ /**
7
+ * Error classification utilities with 3-path decision logic
8
+ */
9
+ class ErrorClassifier {
10
+ /**
11
+ * Simplified error classification with 3-path logic
12
+ * 1. BusinessLogicError -> Preserve structure (fast path)
13
+ * 2. TechnicalError -> Preserve message (fast path)
14
+ * 3. Everything else -> Security-first fallback
15
+ */
16
+ static classify(error, domain) {
17
+ // Fast path 1: BusinessLogicError (already structured)
18
+ if (pers_shared_1.BusinessLogicError.isBusinessError(error)) {
19
+ const response = error.getResponse();
20
+ const responseObj = typeof response === 'object' ? response : {};
21
+ return {
22
+ category: pers_shared_1.ErrorCategory.DOMAIN_RULE,
23
+ code: responseObj.code || 'BUSINESS_ERROR',
24
+ message: responseObj.message || error.message,
25
+ userMessage: responseObj.message || error.message,
26
+ retryable: false
27
+ };
28
+ }
29
+ // Fast path 2: TechnicalError (preserve meaningful messages)
30
+ if (pers_shared_1.TechnicalError.isTechnicalError(error)) {
31
+ const response = error.getResponse();
32
+ const responseObj = typeof response === 'object' ? response : {};
33
+ return {
34
+ category: pers_shared_1.ErrorCategory.INFRASTRUCTURE,
35
+ code: 'TECHNICAL_ERROR',
36
+ message: responseObj.message || error.message,
37
+ userMessage: responseObj.message || error.message,
38
+ retryable: false
39
+ };
40
+ }
41
+ // Fast path 3: HttpExceptions with BUSINESS_LOGIC category (for backward compatibility)
42
+ if (typeof error.getStatus === 'function') {
43
+ const response = error.getResponse ? error.getResponse() : null;
44
+ if (typeof response === 'object' && response?.category === 'BUSINESS_LOGIC') {
45
+ const responseObj = response;
46
+ return {
47
+ category: pers_shared_1.ErrorCategory.DOMAIN_RULE,
48
+ code: responseObj.code || 'BUSINESS_ERROR',
49
+ message: responseObj.message || error.message,
50
+ userMessage: responseObj.message || error.message,
51
+ retryable: false
52
+ };
53
+ }
54
+ }
55
+ // Security-first fallback for everything else
56
+ const message = error.message || 'Unknown error';
57
+ // Check if error message is safe to expose to users
58
+ const isSafe = this.isSafeForUsers(message);
59
+ return {
60
+ category: pers_shared_1.ErrorCategory.UNKNOWN,
61
+ code: 'INTERNAL_ERROR',
62
+ message: isSafe ? message : 'Internal server error',
63
+ userMessage: isSafe ? message : 'An unexpected error occurred. Please try again.',
64
+ retryable: true
65
+ };
66
+ }
67
+ /**
68
+ * Determine if an error message is safe to expose to users
69
+ * Uses a balanced approach: block sensitive system data while allowing business messages
70
+ */
71
+ static isSafeForUsers(message) {
72
+ if (!message || message.length < 3 || message.length > 300)
73
+ return false;
74
+ // Allow common business error phrases that are safe for users
75
+ const safeBusinessPatterns = [
76
+ /cannot process payment/i,
77
+ /unable to complete transaction/i,
78
+ /insufficient (balance|funds)/i,
79
+ /user not found/i,
80
+ /token not active/i,
81
+ /wallet not found/i,
82
+ /invalid (amount|address|format)/i,
83
+ /transaction (failed|rejected|expired)/i,
84
+ /account (locked|inactive|suspended)/i,
85
+ /permission denied/i,
86
+ /rate limit exceeded/i,
87
+ /service temporarily unavailable/i
88
+ ];
89
+ // If it matches safe business patterns, allow it
90
+ if (safeBusinessPatterns.some(pattern => pattern.test(message))) {
91
+ return true;
92
+ }
93
+ // Block definitely unsafe patterns (system internals and sensitive data)
94
+ const unsafePatterns = [
95
+ // System internals with technical context
96
+ /internal server error/i,
97
+ /database connection (failed|lost|timeout)/i,
98
+ /sql (error|exception|syntax)/i,
99
+ /stack trace|stacktrace/i,
100
+ /undefined (property|method|function)/i,
101
+ /null pointer|reference error/i,
102
+ // Sensitive data indicators
103
+ /secret|password|private.?key|credential/i,
104
+ /jwt.?token|bearer.?token|api.?key/i,
105
+ /localhost|127\.0\.0\.1|192\.168\.|10\.\d+\./i,
106
+ /\.env|config\.json|\.xml|\.yml/i,
107
+ // Technical stack traces and system paths
108
+ /\/var\/|\/etc\/|\/home\/|\/usr\/bin|\/opt\//i,
109
+ /node_modules|package\.json|tsconfig/i,
110
+ /at Object\.|at Function\.|at async/i,
111
+ // Database and system queries
112
+ /SELECT.*FROM|INSERT.*INTO|UPDATE.*SET/i,
113
+ /mongodb|postgresql|redis|elasticsearch/i
114
+ ];
115
+ // Block if it matches unsafe patterns
116
+ if (unsafePatterns.some(pattern => pattern.test(message))) {
117
+ return false;
118
+ }
119
+ // For everything else, apply basic safety checks
120
+ // Allow if it looks like a user-friendly business message
121
+ const hasBusinessContext = /\b(user|account|transaction|payment|balance|wallet|token)\b/i.test(message);
122
+ const hasGenericWords = /\b(invalid|missing|required|expired|failed|rejected|denied)\b/i.test(message);
123
+ const noSystemJargon = !/\b(undefined|null|exception|stack|trace|object|function|method|class)\b/i.test(message);
124
+ return (hasBusinessContext || hasGenericWords) && noSystemJargon;
125
+ }
126
+ /**
127
+ * Convert structured error to HTTP status code
128
+ */
129
+ static getHttpStatusCode(structuredError) {
130
+ switch (structuredError.category) {
131
+ case pers_shared_1.ErrorCategory.VALIDATION:
132
+ return error_classification_enums_1.ErrorHttpStatus.BAD_REQUEST;
133
+ case pers_shared_1.ErrorCategory.DOMAIN_RULE:
134
+ return error_classification_enums_1.ErrorHttpStatus.UNPROCESSABLE_ENTITY;
135
+ case pers_shared_1.ErrorCategory.SECURITY:
136
+ return error_classification_enums_1.ErrorHttpStatus.FORBIDDEN;
137
+ case pers_shared_1.ErrorCategory.RATE_LIMIT:
138
+ return error_classification_enums_1.ErrorHttpStatus.TOO_MANY_REQUESTS;
139
+ case pers_shared_1.ErrorCategory.TIMEOUT:
140
+ return error_classification_enums_1.ErrorHttpStatus.GATEWAY_TIMEOUT;
141
+ case pers_shared_1.ErrorCategory.INFRASTRUCTURE:
142
+ return error_classification_enums_1.ErrorHttpStatus.SERVICE_UNAVAILABLE;
143
+ default:
144
+ return error_classification_enums_1.ErrorHttpStatus.INTERNAL_SERVER_ERROR;
145
+ }
146
+ }
147
+ }
148
+ exports.ErrorClassifier = ErrorClassifier;
149
+ //# sourceMappingURL=error-classifier.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-classifier.js","sourceRoot":"","sources":["../../../../../src/internal/exceptions/base/error-classifier.ts"],"names":[],"mappings":";;;AAAA,wDAA4G;AAC5G,6EAA+D;AAE/D;;GAEG;AACH,MAAa,eAAe;IAC1B;;;;;OAKG;IACH,MAAM,CAAC,QAAQ,CAAC,KAAU,EAAE,MAAc;QACxC,uDAAuD;QACvD,IAAI,gCAAkB,CAAC,eAAe,CAAC,KAAK,CAAC,EAAE,CAAC;YAC9C,MAAM,QAAQ,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC;YACrC,MAAM,WAAW,GAAG,OAAO,QAAQ,KAAK,QAAQ,CAAC,C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AAC;YACzC,KAAK,2BAAa,CAAC,cAAc;gBAC/B,OAAO,4CAAe,CAAC,mBAAmB,CAAC;YAC7C;gBACE,OAAO,4CAAe,CAAC,qBAAqB,CAAC;QACjD,CAAC;IACH,CAAC;CACF;AAzJD,0CAyJC"}
@@ -0,0 +1,3 @@
1
+ export * from './base/error-classification-enums';
2
+ export { ErrorClassifier } from './base/error-classifier';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/internal/exceptions/index.ts"],"names":[],"mappings":"AACA,cAAc,mCAAmC,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC"}
@@ -0,0 +1,24 @@
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
+ exports.ErrorClassifier = void 0;
18
+ // Error classification utilities (patterns-specific logic only)
19
+ __exportStar(require("./base/error-classification-enums"), exports);
20
+ var error_classifier_1 = require("./base/error-classifier");
21
+ Object.defineProperty(exports, "ErrorClassifier", { enumerable: true, get: function () { return error_classifier_1.ErrorClassifier; } });
22
+ // Note: All error classes (BusinessLogicError, TechnicalError, domain errors) are exported from @explorins/pers-shared
23
+ // This library only contains error classification logic and patterns
24
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/internal/exceptions/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,gEAAgE;AAChE,oEAAkD;AAClD,4DAA0D;AAAjD,mHAAA,eAAe,OAAA;AAExB,uHAAuH;AACvH,qEAAqE"}
@@ -0,0 +1,16 @@
1
+ type KeyFormat = 'pem';
2
+ type KeyType = 'pkcs1' | 'pkcs8';
3
+ export interface EncryptedDataObject {
4
+ encryptedData: string;
5
+ iv: string;
6
+ authTag: string;
7
+ }
8
+ export declare const hashString: (input: string, maxLength?: number | null, algorithm?: "sha256" | "sha512" | "md5") => string;
9
+ export declare const checkMatching: (plainString: string, hashedString: string) => Promise<any>;
10
+ export declare const hashPassword: (password: string, saltRounds?: number) => Promise<string>;
11
+ export declare const generatePseudoRandomData: (size?: number) => string;
12
+ export declare const generateDecryptedPrivateKey: (privateKey: string, passphrase: string | undefined, keyType?: KeyType, keyFormat?: KeyFormat) => string;
13
+ export declare const encryptData: (data: string, encryptionKey: string) => EncryptedDataObject;
14
+ export declare const decryptData: (encryptedDataObject: EncryptedDataObject, encryptionKey: string) => string;
15
+ export {};
16
+ //# sourceMappingURL=crypto.functions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"crypto.functions.d.ts","sourceRoot":"","sources":["../../../../src/internal/functions/crypto.functions.ts"],"names":[],"mappings":"AAKA,KAAK,SAAS,GAAG,KAAK,CAAE;AACxB,KAAK,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC;AAEjC,MAAM,WAAW,mBAAmB;IAChC,aAAa,EAAE,MAAM,CAAC;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;CACjB;AAEC,eAAO,MAAM,UAAU,GAAI,OAAO,MAAM,EAAE,YAAW,MAAM,GAAG,IAAW,EAAE,YAAW,QAAQ,GAAG,QAAQ,GAAG,KAAgB,KAAG,MAO9H,CAAA;AAED,eAAO,MAAM,aAAa,GAAU,aAAa,MAAM,EAAE,cAAc,MAAM,iBAG5E,CAAA;AAED,eAAO,MAAM,YAAY,GAAU,UAAU,MAAM,EAAE,aAAY,MAA0B,KAAG,OAAO,CAAC,MAAM,CAE3G,CAAA;AAED,eAAO,MAAM,wBAAwB,GAAI,OAAM,MAAW,WAKzD,CAAA;AAED,eAAO,MAAM,2BAA2B,GACpC,YAAY,MAAM,EAClB,YAAY,MAAM,GAAG,SAAS,EAC9B,UAAS,OAAiB,EAC1B,YAAW,SAAiB,KAC7B,MAWJ,CAAA;AAEH,eAAO,MAAM,WAAW,GAAI,MAAM,MAAM,EAAE,eAAe,MAAM,KAAG,mBAmBjE,CAAA;AAED,eAAO,MAAM,WAAW,GAAI,qBAAqB,mBAAmB,EAAE,eAAe,MAAM,KAAG,MAgB7F,CAAA"}