@riocrypto/common 1.0.776 → 1.0.777

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 (72) hide show
  1. package/build/errors/active-sell-order-error.d.ts +2 -0
  2. package/build/errors/active-sell-order-error.js +2 -0
  3. package/build/errors/address-check-failed-error.d.ts +2 -0
  4. package/build/errors/address-check-failed-error.js +2 -1
  5. package/build/errors/admin-already-exists-error.d.ts +2 -0
  6. package/build/errors/admin-already-exists-error.js +7 -1
  7. package/build/errors/admin-not-found-error.d.ts +2 -0
  8. package/build/errors/admin-not-found-error.js +2 -1
  9. package/build/errors/admin-only-error.d.ts +2 -0
  10. package/build/errors/admin-only-error.js +7 -1
  11. package/build/errors/api-key-not-found-error.d.ts +2 -0
  12. package/build/errors/api-key-not-found-error.js +2 -1
  13. package/build/errors/auth-already-exists-error.d.ts +2 -0
  14. package/build/errors/auth-already-exists-error.js +7 -1
  15. package/build/errors/auth-not-found-error.d.ts +2 -0
  16. package/build/errors/auth-not-found-error.js +2 -1
  17. package/build/errors/authorization-failed-error.d.ts +2 -0
  18. package/build/errors/authorization-failed-error.js +2 -1
  19. package/build/errors/custom-error.d.ts +1 -0
  20. package/build/errors/database-connection-error.d.ts +2 -0
  21. package/build/errors/database-connection-error.js +2 -1
  22. package/build/errors/insufficient-liquidity-error.d.ts +2 -0
  23. package/build/errors/insufficient-liquidity-error.js +2 -0
  24. package/build/errors/invalid-order-size-error.d.ts +2 -0
  25. package/build/errors/invalid-order-size-error.js +2 -0
  26. package/build/errors/message-failed-error.d.ts +2 -0
  27. package/build/errors/message-failed-error.js +4 -1
  28. package/build/errors/missing-cpf-error.d.ts +2 -0
  29. package/build/errors/missing-cpf-error.js +2 -1
  30. package/build/errors/missing-kyc-approval-error.d.ts +2 -0
  31. package/build/errors/missing-kyc-approval-error.js +5 -1
  32. package/build/errors/missing-password-error.d.ts +2 -0
  33. package/build/errors/missing-password-error.js +2 -1
  34. package/build/errors/missing-security-question-error.d.ts +2 -0
  35. package/build/errors/missing-security-question-error.js +7 -1
  36. package/build/errors/missing-user-error.d.ts +2 -0
  37. package/build/errors/missing-user-error.js +4 -1
  38. package/build/errors/not-authorized-error.d.ts +2 -0
  39. package/build/errors/not-authorized-error.js +2 -1
  40. package/build/errors/not-broker-error.d.ts +2 -0
  41. package/build/errors/not-broker-error.js +5 -1
  42. package/build/errors/not-found-error.d.ts +2 -0
  43. package/build/errors/not-found-error.js +2 -1
  44. package/build/errors/partner-already-exists-error.d.ts +2 -0
  45. package/build/errors/partner-already-exists-error.js +2 -1
  46. package/build/errors/partner-auth-already-exists-error.d.ts +2 -0
  47. package/build/errors/partner-auth-already-exists-error.js +7 -1
  48. package/build/errors/partner-auth-not-found-error.d.ts +2 -0
  49. package/build/errors/partner-auth-not-found-error.js +2 -1
  50. package/build/errors/partner-not-found-error.d.ts +2 -0
  51. package/build/errors/partner-not-found-error.js +2 -1
  52. package/build/errors/password-already-used-error.d.ts +2 -0
  53. package/build/errors/password-already-used-error.js +2 -1
  54. package/build/errors/request-validation-error.d.ts +2 -0
  55. package/build/errors/request-validation-error.js +2 -1
  56. package/build/errors/rio-settings-already-exists-error.d.ts +2 -0
  57. package/build/errors/rio-settings-already-exists-error.js +4 -1
  58. package/build/errors/rio-settings-not-found-error.d.ts +2 -0
  59. package/build/errors/rio-settings-not-found-error.js +4 -1
  60. package/build/errors/user-already-exists-error.d.ts +2 -0
  61. package/build/errors/user-already-exists-error.js +2 -1
  62. package/build/errors/verification-failed-error.d.ts +2 -0
  63. package/build/errors/verification-failed-error.js +2 -1
  64. package/build/errors/wrong-order-state-error.d.ts +2 -0
  65. package/build/errors/wrong-order-state-error.js +5 -1
  66. package/build/errors/wrong-password-error.d.ts +2 -0
  67. package/build/errors/wrong-password-error.js +2 -1
  68. package/build/errors/wrong-processor-error.d.ts +2 -0
  69. package/build/errors/wrong-processor-error.js +7 -1
  70. package/build/errors/wrong-security-answer-error.d.ts +2 -0
  71. package/build/errors/wrong-security-answer-error.js +2 -1
  72. package/package.json +1 -1
@@ -2,8 +2,10 @@ import { CustomError } from "./custom-error";
2
2
  export declare class ActiveSellOrderError extends CustomError {
3
3
  private activeOrderId;
4
4
  statusCode: number;
5
+ internalCode: number;
5
6
  constructor(activeOrderId: string);
6
7
  serializeErrors(): {
8
+ code: number;
7
9
  message: string;
8
10
  activeOrderId: string;
9
11
  }[];
@@ -7,11 +7,13 @@ class ActiveSellOrderError extends custom_error_1.CustomError {
7
7
  super("There is an active sell order for this user. Cannot create another one");
8
8
  this.activeOrderId = activeOrderId;
9
9
  this.statusCode = 409;
10
+ this.internalCode = 1;
10
11
  Object.setPrototypeOf(this, ActiveSellOrderError.prototype);
11
12
  }
12
13
  serializeErrors() {
13
14
  return [
14
15
  {
16
+ code: this.internalCode,
15
17
  message: "There is an active sell order for this user. Cannot create another one",
16
18
  activeOrderId: this.activeOrderId,
17
19
  },
@@ -1,8 +1,10 @@
1
1
  import { CustomError } from "./custom-error";
2
2
  export declare class AddressCheckFailed extends CustomError {
3
3
  statusCode: number;
4
+ internalCode: number;
4
5
  constructor();
5
6
  serializeErrors(): {
7
+ code: number;
6
8
  message: string;
7
9
  }[];
8
10
  }
@@ -6,10 +6,11 @@ class AddressCheckFailed extends custom_error_1.CustomError {
6
6
  constructor() {
7
7
  super("Address check failed");
8
8
  this.statusCode = 400;
9
+ this.internalCode = 2;
9
10
  Object.setPrototypeOf(this, AddressCheckFailed.prototype);
10
11
  }
11
12
  serializeErrors() {
12
- return [{ message: "Address check failed" }];
13
+ return [{ code: this.internalCode, message: "Address check failed" }];
13
14
  }
14
15
  }
15
16
  exports.AddressCheckFailed = AddressCheckFailed;
@@ -1,8 +1,10 @@
1
1
  import { CustomError } from "./custom-error";
2
2
  export declare class AdminAlreadyExistsError extends CustomError {
3
3
  statusCode: number;
4
+ internalCode: number;
4
5
  constructor();
5
6
  serializeErrors(): {
7
+ code: number;
6
8
  message: string;
7
9
  }[];
8
10
  }
@@ -6,10 +6,16 @@ class AdminAlreadyExistsError extends custom_error_1.CustomError {
6
6
  constructor() {
7
7
  super("Admin with provided email already exists");
8
8
  this.statusCode = 409;
9
+ this.internalCode = 3;
9
10
  Object.setPrototypeOf(this, AdminAlreadyExistsError.prototype);
10
11
  }
11
12
  serializeErrors() {
12
- return [{ message: "Admin with provided email already exists" }];
13
+ return [
14
+ {
15
+ code: this.internalCode,
16
+ message: "Admin with provided email already exists",
17
+ },
18
+ ];
13
19
  }
14
20
  }
15
21
  exports.AdminAlreadyExistsError = AdminAlreadyExistsError;
@@ -1,8 +1,10 @@
1
1
  import { CustomError } from "./custom-error";
2
2
  export declare class AdminNotFoundError extends CustomError {
3
3
  statusCode: number;
4
+ internalCode: number;
4
5
  constructor();
5
6
  serializeErrors(): {
7
+ code: number;
6
8
  message: string;
7
9
  }[];
8
10
  }
@@ -6,10 +6,11 @@ class AdminNotFoundError extends custom_error_1.CustomError {
6
6
  constructor() {
7
7
  super("Admin not found");
8
8
  this.statusCode = 404;
9
+ this.internalCode = 4;
9
10
  Object.setPrototypeOf(this, AdminNotFoundError.prototype);
10
11
  }
11
12
  serializeErrors() {
12
- return [{ message: "Admin not found" }];
13
+ return [{ code: this.internalCode, message: "Admin not found" }];
13
14
  }
14
15
  }
15
16
  exports.AdminNotFoundError = AdminNotFoundError;
@@ -1,8 +1,10 @@
1
1
  import { CustomError } from "./custom-error";
2
2
  export declare class AdminOnlyError extends CustomError {
3
3
  statusCode: number;
4
+ internalCode: number;
4
5
  constructor();
5
6
  serializeErrors(): {
7
+ code: number;
6
8
  message: string;
7
9
  }[];
8
10
  }
@@ -6,10 +6,16 @@ class AdminOnlyError extends custom_error_1.CustomError {
6
6
  constructor() {
7
7
  super("This endpoint can only be called by admins");
8
8
  this.statusCode = 401;
9
+ this.internalCode = 5;
9
10
  Object.setPrototypeOf(this, AdminOnlyError.prototype);
10
11
  }
11
12
  serializeErrors() {
12
- return [{ message: "This endpoint can only be called by admins" }];
13
+ return [
14
+ {
15
+ code: this.internalCode,
16
+ message: "This endpoint can only be called by admins",
17
+ },
18
+ ];
13
19
  }
14
20
  }
15
21
  exports.AdminOnlyError = AdminOnlyError;
@@ -1,8 +1,10 @@
1
1
  import { CustomError } from "./custom-error";
2
2
  export declare class APIKeyNotFoundError extends CustomError {
3
3
  statusCode: number;
4
+ internalCode: number;
4
5
  constructor();
5
6
  serializeErrors(): {
7
+ code: number;
6
8
  message: string;
7
9
  }[];
8
10
  }
@@ -6,10 +6,11 @@ class APIKeyNotFoundError extends custom_error_1.CustomError {
6
6
  constructor() {
7
7
  super("API key not found");
8
8
  this.statusCode = 404;
9
+ this.internalCode = 6;
9
10
  Object.setPrototypeOf(this, APIKeyNotFoundError.prototype);
10
11
  }
11
12
  serializeErrors() {
12
- return [{ message: "API key not found" }];
13
+ return [{ code: this.internalCode, message: "API key not found" }];
13
14
  }
14
15
  }
15
16
  exports.APIKeyNotFoundError = APIKeyNotFoundError;
@@ -1,8 +1,10 @@
1
1
  import { CustomError } from "./custom-error";
2
2
  export declare class AuthAlreadyExistsError extends CustomError {
3
3
  statusCode: number;
4
+ internalCode: number;
4
5
  constructor();
5
6
  serializeErrors(): {
7
+ code: number;
6
8
  message: string;
7
9
  }[];
8
10
  }
@@ -6,10 +6,16 @@ class AuthAlreadyExistsError extends custom_error_1.CustomError {
6
6
  constructor() {
7
7
  super("Auth with provided phone number already exists");
8
8
  this.statusCode = 409;
9
+ this.internalCode = 7;
9
10
  Object.setPrototypeOf(this, AuthAlreadyExistsError.prototype);
10
11
  }
11
12
  serializeErrors() {
12
- return [{ message: "Auth with provided phone number already exists" }];
13
+ return [
14
+ {
15
+ code: this.internalCode,
16
+ message: "Auth with provided phone number already exists",
17
+ },
18
+ ];
13
19
  }
14
20
  }
15
21
  exports.AuthAlreadyExistsError = AuthAlreadyExistsError;
@@ -1,8 +1,10 @@
1
1
  import { CustomError } from "./custom-error";
2
2
  export declare class AuthNotFoundError extends CustomError {
3
3
  statusCode: number;
4
+ internalCode: number;
4
5
  constructor();
5
6
  serializeErrors(): {
7
+ code: number;
6
8
  message: string;
7
9
  }[];
8
10
  }
@@ -6,10 +6,11 @@ class AuthNotFoundError extends custom_error_1.CustomError {
6
6
  constructor() {
7
7
  super("Auth not found");
8
8
  this.statusCode = 404;
9
+ this.internalCode = 8;
9
10
  Object.setPrototypeOf(this, AuthNotFoundError.prototype);
10
11
  }
11
12
  serializeErrors() {
12
- return [{ message: "Auth not found" }];
13
+ return [{ code: this.internalCode, message: "Auth not found" }];
13
14
  }
14
15
  }
15
16
  exports.AuthNotFoundError = AuthNotFoundError;
@@ -1,8 +1,10 @@
1
1
  import { CustomError } from "./custom-error";
2
2
  export declare class AuthorizationFailedError extends CustomError {
3
3
  statusCode: number;
4
+ internalCode: number;
4
5
  constructor();
5
6
  serializeErrors(): {
7
+ code: number;
6
8
  message: string;
7
9
  }[];
8
10
  }
@@ -6,10 +6,11 @@ class AuthorizationFailedError extends custom_error_1.CustomError {
6
6
  constructor() {
7
7
  super("Wyre authorization codes failed validation");
8
8
  this.statusCode = 400;
9
+ this.internalCode = 9;
9
10
  Object.setPrototypeOf(this, AuthorizationFailedError.prototype);
10
11
  }
11
12
  serializeErrors() {
12
- return [{ message: "Authorization failed" }];
13
+ return [{ code: this.internalCode, message: "Authorization failed" }];
13
14
  }
14
15
  }
15
16
  exports.AuthorizationFailedError = AuthorizationFailedError;
@@ -2,6 +2,7 @@ export declare abstract class CustomError extends Error {
2
2
  abstract statusCode: number;
3
3
  constructor(message: string);
4
4
  abstract serializeErrors(): {
5
+ code: number;
5
6
  message: string;
6
7
  field?: string;
7
8
  }[];
@@ -1,9 +1,11 @@
1
1
  import { CustomError } from "./custom-error";
2
2
  export declare class DatabaseConnectionError extends CustomError {
3
3
  statusCode: number;
4
+ internalCode: number;
4
5
  reason: string;
5
6
  constructor();
6
7
  serializeErrors(): {
8
+ code: number;
7
9
  message: string;
8
10
  }[];
9
11
  }
@@ -6,11 +6,12 @@ class DatabaseConnectionError extends custom_error_1.CustomError {
6
6
  constructor() {
7
7
  super("Error connecting to database");
8
8
  this.statusCode = 500;
9
+ this.internalCode = 10;
9
10
  this.reason = "Error connecting to database";
10
11
  Object.setPrototypeOf(this, DatabaseConnectionError.prototype);
11
12
  }
12
13
  serializeErrors() {
13
- return [{ message: this.reason }];
14
+ return [{ code: this.internalCode, message: this.reason }];
14
15
  }
15
16
  }
16
17
  exports.DatabaseConnectionError = DatabaseConnectionError;
@@ -1,8 +1,10 @@
1
1
  import { CustomError } from "./custom-error";
2
2
  export declare class InsufficientLiquidityError extends CustomError {
3
3
  statusCode: number;
4
+ internalCode: number;
4
5
  constructor();
5
6
  serializeErrors(): {
7
+ code: number;
6
8
  message: string;
7
9
  }[];
8
10
  }
@@ -6,11 +6,13 @@ class InsufficientLiquidityError extends custom_error_1.CustomError {
6
6
  constructor() {
7
7
  super("Insufficient liquidity to process order");
8
8
  this.statusCode = 400;
9
+ this.internalCode = 11;
9
10
  Object.setPrototypeOf(this, InsufficientLiquidityError.prototype);
10
11
  }
11
12
  serializeErrors() {
12
13
  return [
13
14
  {
15
+ code: this.internalCode,
14
16
  message: "Insufficient liquidity to process order, please try again later",
15
17
  },
16
18
  ];
@@ -4,8 +4,10 @@ export declare class InvalidOrderSizeError extends CustomError {
4
4
  private minAmount;
5
5
  private minAmountFiat;
6
6
  statusCode: number;
7
+ internalCode: number;
7
8
  constructor(minAmount: number, minAmountFiat: Fiat);
8
9
  serializeErrors(): {
10
+ code: number;
9
11
  message: string;
10
12
  minAmount: number;
11
13
  minAmountFiat: Fiat;
@@ -8,11 +8,13 @@ class InvalidOrderSizeError extends custom_error_1.CustomError {
8
8
  this.minAmount = minAmount;
9
9
  this.minAmountFiat = minAmountFiat;
10
10
  this.statusCode = 400;
11
+ this.internalCode = 12;
11
12
  Object.setPrototypeOf(this, InvalidOrderSizeError.prototype);
12
13
  }
13
14
  serializeErrors() {
14
15
  return [
15
16
  {
17
+ code: this.internalCode,
16
18
  message: "Invalid order size",
17
19
  minAmount: this.minAmount,
18
20
  minAmountFiat: this.minAmountFiat,
@@ -1,8 +1,10 @@
1
1
  import { CustomError } from "./custom-error";
2
2
  export declare class MessageFailedError extends CustomError {
3
3
  statusCode: number;
4
+ internalCode: number;
4
5
  constructor();
5
6
  serializeErrors(): {
7
+ code: number;
6
8
  message: string;
7
9
  }[];
8
10
  }
@@ -6,10 +6,13 @@ class MessageFailedError extends custom_error_1.CustomError {
6
6
  constructor() {
7
7
  super("Failed to send verification code");
8
8
  this.statusCode = 500;
9
+ this.internalCode = 13;
9
10
  Object.setPrototypeOf(this, MessageFailedError.prototype);
10
11
  }
11
12
  serializeErrors() {
12
- return [{ message: "Failed to send verification code" }];
13
+ return [
14
+ { code: this.internalCode, message: "Failed to send verification code" },
15
+ ];
13
16
  }
14
17
  }
15
18
  exports.MessageFailedError = MessageFailedError;
@@ -1,8 +1,10 @@
1
1
  import { CustomError } from "./custom-error";
2
2
  export declare class MissingCPFError extends CustomError {
3
3
  statusCode: number;
4
+ internalCode: number;
4
5
  constructor();
5
6
  serializeErrors(): {
7
+ code: number;
6
8
  message: string;
7
9
  }[];
8
10
  }
@@ -6,10 +6,11 @@ class MissingCPFError extends custom_error_1.CustomError {
6
6
  constructor() {
7
7
  super("User is missing CPF");
8
8
  this.statusCode = 401;
9
+ this.internalCode = 14;
9
10
  Object.setPrototypeOf(this, MissingCPFError.prototype);
10
11
  }
11
12
  serializeErrors() {
12
- return [{ message: "User is missing CPF" }];
13
+ return [{ code: this.internalCode, message: "User is missing CPF" }];
13
14
  }
14
15
  }
15
16
  exports.MissingCPFError = MissingCPFError;
@@ -1,8 +1,10 @@
1
1
  import { CustomError } from "./custom-error";
2
2
  export declare class MissingKYCApprovalError extends CustomError {
3
3
  statusCode: number;
4
+ internalCode: number;
4
5
  constructor();
5
6
  serializeErrors(): {
7
+ code: number;
6
8
  message: string;
7
9
  }[];
8
10
  }
@@ -6,11 +6,15 @@ class MissingKYCApprovalError extends custom_error_1.CustomError {
6
6
  constructor() {
7
7
  super("KYC status is not approved for this user");
8
8
  this.statusCode = 401;
9
+ this.internalCode = 15;
9
10
  Object.setPrototypeOf(this, MissingKYCApprovalError.prototype);
10
11
  }
11
12
  serializeErrors() {
12
13
  return [
13
- { message: "KYC status is not approved is not approved for this user" },
14
+ {
15
+ code: this.internalCode,
16
+ message: "KYC status is not approved is not approved for this user",
17
+ },
14
18
  ];
15
19
  }
16
20
  }
@@ -1,8 +1,10 @@
1
1
  import { CustomError } from "./custom-error";
2
2
  export declare class MissingPasswordError extends CustomError {
3
3
  statusCode: number;
4
+ internalCode: number;
4
5
  constructor();
5
6
  serializeErrors(): {
7
+ code: number;
6
8
  message: string;
7
9
  }[];
8
10
  }
@@ -6,10 +6,11 @@ class MissingPasswordError extends custom_error_1.CustomError {
6
6
  constructor() {
7
7
  super("Password is not registered");
8
8
  this.statusCode = 401;
9
+ this.internalCode = 16;
9
10
  Object.setPrototypeOf(this, MissingPasswordError.prototype);
10
11
  }
11
12
  serializeErrors() {
12
- return [{ message: "Password is not registered" }];
13
+ return [{ code: this.internalCode, message: "Password is not registered" }];
13
14
  }
14
15
  }
15
16
  exports.MissingPasswordError = MissingPasswordError;
@@ -1,8 +1,10 @@
1
1
  import { CustomError } from "./custom-error";
2
2
  export declare class MissingSecurityQuestionError extends CustomError {
3
3
  statusCode: number;
4
+ internalCode: number;
4
5
  constructor();
5
6
  serializeErrors(): {
7
+ code: number;
6
8
  message: string;
7
9
  }[];
8
10
  }
@@ -6,10 +6,16 @@ class MissingSecurityQuestionError extends custom_error_1.CustomError {
6
6
  constructor() {
7
7
  super("Security question is not registered");
8
8
  this.statusCode = 401;
9
+ this.internalCode = 17;
9
10
  Object.setPrototypeOf(this, MissingSecurityQuestionError.prototype);
10
11
  }
11
12
  serializeErrors() {
12
- return [{ message: "Security question is not registered" }];
13
+ return [
14
+ {
15
+ code: this.internalCode,
16
+ message: "Security question is not registered",
17
+ },
18
+ ];
13
19
  }
14
20
  }
15
21
  exports.MissingSecurityQuestionError = MissingSecurityQuestionError;
@@ -1,8 +1,10 @@
1
1
  import { CustomError } from "./custom-error";
2
2
  export declare class MissingUserError extends CustomError {
3
3
  statusCode: number;
4
+ internalCode: number;
4
5
  constructor();
5
6
  serializeErrors(): {
7
+ code: number;
6
8
  message: string;
7
9
  }[];
8
10
  }
@@ -6,10 +6,13 @@ class MissingUserError extends custom_error_1.CustomError {
6
6
  constructor() {
7
7
  super("Auth is not registered to a user");
8
8
  this.statusCode = 401;
9
+ this.internalCode = 18;
9
10
  Object.setPrototypeOf(this, MissingUserError.prototype);
10
11
  }
11
12
  serializeErrors() {
12
- return [{ message: "Auth is not registered to a user" }];
13
+ return [
14
+ { code: this.internalCode, message: "Auth is not registered to a user" },
15
+ ];
13
16
  }
14
17
  }
15
18
  exports.MissingUserError = MissingUserError;
@@ -1,8 +1,10 @@
1
1
  import { CustomError } from "./custom-error";
2
2
  export declare class NotAuthorizedError extends CustomError {
3
3
  statusCode: number;
4
+ internalCode: number;
4
5
  constructor();
5
6
  serializeErrors(): {
7
+ code: number;
6
8
  message: string;
7
9
  }[];
8
10
  }
@@ -6,10 +6,11 @@ class NotAuthorizedError extends custom_error_1.CustomError {
6
6
  constructor() {
7
7
  super("Not authorized");
8
8
  this.statusCode = 401;
9
+ this.internalCode = 19;
9
10
  Object.setPrototypeOf(this, NotAuthorizedError.prototype);
10
11
  }
11
12
  serializeErrors() {
12
- return [{ message: "Not authorized" }];
13
+ return [{ code: this.internalCode, message: "Not authorized" }];
13
14
  }
14
15
  }
15
16
  exports.NotAuthorizedError = NotAuthorizedError;
@@ -1,8 +1,10 @@
1
1
  import { CustomError } from "./custom-error";
2
2
  export declare class NotBrokerError extends CustomError {
3
3
  statusCode: number;
4
+ internalCode: number;
4
5
  constructor();
5
6
  serializeErrors(): {
7
+ code: number;
6
8
  message: string;
7
9
  }[];
8
10
  }
@@ -6,11 +6,15 @@ class NotBrokerError extends custom_error_1.CustomError {
6
6
  constructor() {
7
7
  super("To call this endpoint as a user, you must be a broker");
8
8
  this.statusCode = 401;
9
+ this.internalCode = 20;
9
10
  Object.setPrototypeOf(this, NotBrokerError.prototype);
10
11
  }
11
12
  serializeErrors() {
12
13
  return [
13
- { message: "To do this operation as a user, you must be a broker" },
14
+ {
15
+ code: this.internalCode,
16
+ message: "To do this operation as a user, you must be a broker",
17
+ },
14
18
  ];
15
19
  }
16
20
  }
@@ -1,8 +1,10 @@
1
1
  import { CustomError } from "./custom-error";
2
2
  export declare class NotFoundError extends CustomError {
3
3
  statusCode: number;
4
+ internalCode: number;
4
5
  constructor();
5
6
  serializeErrors(): {
7
+ code: number;
6
8
  message: string;
7
9
  }[];
8
10
  }
@@ -6,10 +6,11 @@ class NotFoundError extends custom_error_1.CustomError {
6
6
  constructor() {
7
7
  super("Route not found");
8
8
  this.statusCode = 404;
9
+ this.internalCode = 21;
9
10
  Object.setPrototypeOf(this, NotFoundError.prototype);
10
11
  }
11
12
  serializeErrors() {
12
- return [{ message: "Not found" }];
13
+ return [{ code: this.internalCode, message: "Not found" }];
13
14
  }
14
15
  }
15
16
  exports.NotFoundError = NotFoundError;
@@ -1,8 +1,10 @@
1
1
  import { CustomError } from "./custom-error";
2
2
  export declare class PartnerAlreadyExistsError extends CustomError {
3
3
  statusCode: number;
4
+ internalCode: number;
4
5
  constructor();
5
6
  serializeErrors(): {
7
+ code: number;
6
8
  message: string;
7
9
  }[];
8
10
  }
@@ -6,10 +6,11 @@ class PartnerAlreadyExistsError extends custom_error_1.CustomError {
6
6
  constructor() {
7
7
  super("Partner already exists");
8
8
  this.statusCode = 409;
9
+ this.internalCode = 22;
9
10
  Object.setPrototypeOf(this, PartnerAlreadyExistsError.prototype);
10
11
  }
11
12
  serializeErrors() {
12
- return [{ message: "Partner already exists" }];
13
+ return [{ code: this.internalCode, message: "Partner already exists" }];
13
14
  }
14
15
  }
15
16
  exports.PartnerAlreadyExistsError = PartnerAlreadyExistsError;
@@ -1,8 +1,10 @@
1
1
  import { CustomError } from "./custom-error";
2
2
  export declare class PartnerAuthAlreadyExistsError extends CustomError {
3
3
  statusCode: number;
4
+ internalCode: number;
4
5
  constructor();
5
6
  serializeErrors(): {
7
+ code: number;
6
8
  message: string;
7
9
  }[];
8
10
  }
@@ -6,10 +6,16 @@ class PartnerAuthAlreadyExistsError extends custom_error_1.CustomError {
6
6
  constructor() {
7
7
  super("Partner auth with provided email already exists");
8
8
  this.statusCode = 409;
9
+ this.internalCode = 23;
9
10
  Object.setPrototypeOf(this, PartnerAuthAlreadyExistsError.prototype);
10
11
  }
11
12
  serializeErrors() {
12
- return [{ message: "Partner auth with provided email already exists" }];
13
+ return [
14
+ {
15
+ code: this.internalCode,
16
+ message: "Partner auth with provided email already exists",
17
+ },
18
+ ];
13
19
  }
14
20
  }
15
21
  exports.PartnerAuthAlreadyExistsError = PartnerAuthAlreadyExistsError;
@@ -1,8 +1,10 @@
1
1
  import { CustomError } from "./custom-error";
2
2
  export declare class PartnerAuthNotFoundError extends CustomError {
3
3
  statusCode: number;
4
+ internalCode: number;
4
5
  constructor();
5
6
  serializeErrors(): {
7
+ code: number;
6
8
  message: string;
7
9
  }[];
8
10
  }
@@ -6,10 +6,11 @@ class PartnerAuthNotFoundError extends custom_error_1.CustomError {
6
6
  constructor() {
7
7
  super("Partner auth not found");
8
8
  this.statusCode = 404;
9
+ this.internalCode = 24;
9
10
  Object.setPrototypeOf(this, PartnerAuthNotFoundError.prototype);
10
11
  }
11
12
  serializeErrors() {
12
- return [{ message: "Partner auth not found" }];
13
+ return [{ code: this.internalCode, message: "Partner auth not found" }];
13
14
  }
14
15
  }
15
16
  exports.PartnerAuthNotFoundError = PartnerAuthNotFoundError;
@@ -1,8 +1,10 @@
1
1
  import { CustomError } from "./custom-error";
2
2
  export declare class PartnerNotFoundError extends CustomError {
3
3
  statusCode: number;
4
+ internalCode: number;
4
5
  constructor();
5
6
  serializeErrors(): {
7
+ code: number;
6
8
  message: string;
7
9
  }[];
8
10
  }
@@ -6,10 +6,11 @@ class PartnerNotFoundError extends custom_error_1.CustomError {
6
6
  constructor() {
7
7
  super("Partner not found");
8
8
  this.statusCode = 404;
9
+ this.internalCode = 25;
9
10
  Object.setPrototypeOf(this, PartnerNotFoundError.prototype);
10
11
  }
11
12
  serializeErrors() {
12
- return [{ message: "Partner not found" }];
13
+ return [{ code: this.internalCode, message: "Partner not found" }];
13
14
  }
14
15
  }
15
16
  exports.PartnerNotFoundError = PartnerNotFoundError;
@@ -1,8 +1,10 @@
1
1
  import { CustomError } from "./custom-error";
2
2
  export declare class PasswordAlreadyUsedError extends CustomError {
3
3
  statusCode: number;
4
+ internalCode: number;
4
5
  constructor();
5
6
  serializeErrors(): {
7
+ code: number;
6
8
  message: string;
7
9
  }[];
8
10
  }
@@ -6,10 +6,11 @@ class PasswordAlreadyUsedError extends custom_error_1.CustomError {
6
6
  constructor() {
7
7
  super("Password already used");
8
8
  this.statusCode = 400;
9
+ this.internalCode = 26;
9
10
  Object.setPrototypeOf(this, PasswordAlreadyUsedError.prototype);
10
11
  }
11
12
  serializeErrors() {
12
- return [{ message: "Password already used" }];
13
+ return [{ code: this.internalCode, message: "Password already used" }];
13
14
  }
14
15
  }
15
16
  exports.PasswordAlreadyUsedError = PasswordAlreadyUsedError;
@@ -3,8 +3,10 @@ import { ValidationError } from "express-validator";
3
3
  export declare class RequestValidationError extends CustomError {
4
4
  errors: ValidationError[];
5
5
  statusCode: number;
6
+ internalCode: number;
6
7
  constructor(errors: ValidationError[]);
7
8
  serializeErrors(): {
9
+ code: number;
8
10
  message: any;
9
11
  field: string;
10
12
  }[];
@@ -7,11 +7,12 @@ class RequestValidationError extends custom_error_1.CustomError {
7
7
  super("Invalid request parameters");
8
8
  this.errors = errors;
9
9
  this.statusCode = 400;
10
+ this.internalCode = 27;
10
11
  Object.setPrototypeOf(this, RequestValidationError.prototype);
11
12
  }
12
13
  serializeErrors() {
13
14
  return this.errors.map((err) => {
14
- return { message: err.msg, field: err.param };
15
+ return { code: this.internalCode, message: err.msg, field: err.param };
15
16
  });
16
17
  }
17
18
  }
@@ -1,8 +1,10 @@
1
1
  import { CustomError } from "./custom-error";
2
2
  export declare class RioSettingsAlreadyExistsError extends CustomError {
3
3
  statusCode: number;
4
+ internalCode: number;
4
5
  constructor();
5
6
  serializeErrors(): {
7
+ code: number;
6
8
  message: string;
7
9
  }[];
8
10
  }
@@ -6,10 +6,13 @@ class RioSettingsAlreadyExistsError extends custom_error_1.CustomError {
6
6
  constructor() {
7
7
  super("Rio settings already exists");
8
8
  this.statusCode = 409;
9
+ this.internalCode = 28;
9
10
  Object.setPrototypeOf(this, RioSettingsAlreadyExistsError.prototype);
10
11
  }
11
12
  serializeErrors() {
12
- return [{ message: "Rio settings already exists" }];
13
+ return [
14
+ { code: this.internalCode, message: "Rio settings already exists" },
15
+ ];
13
16
  }
14
17
  }
15
18
  exports.RioSettingsAlreadyExistsError = RioSettingsAlreadyExistsError;
@@ -1,8 +1,10 @@
1
1
  import { CustomError } from "./custom-error";
2
2
  export declare class RioSettingsNotFoundError extends CustomError {
3
3
  statusCode: number;
4
+ internalCode: number;
4
5
  constructor();
5
6
  serializeErrors(): {
7
+ code: number;
6
8
  message: string;
7
9
  }[];
8
10
  }
@@ -6,10 +6,13 @@ class RioSettingsNotFoundError extends custom_error_1.CustomError {
6
6
  constructor() {
7
7
  super("Rio settings not found");
8
8
  this.statusCode = 404;
9
+ this.internalCode = 29;
9
10
  Object.setPrototypeOf(this, RioSettingsNotFoundError.prototype);
10
11
  }
11
12
  serializeErrors() {
12
- return [{ message: "Missing internal Rio settings" }];
13
+ return [
14
+ { code: this.internalCode, message: "Missing internal Rio settings" },
15
+ ];
13
16
  }
14
17
  }
15
18
  exports.RioSettingsNotFoundError = RioSettingsNotFoundError;
@@ -1,8 +1,10 @@
1
1
  import { CustomError } from "./custom-error";
2
2
  export declare class UserAlreadyExistsError extends CustomError {
3
3
  statusCode: number;
4
+ internalCode: number;
4
5
  constructor();
5
6
  serializeErrors(): {
7
+ code: number;
6
8
  message: string;
7
9
  }[];
8
10
  }
@@ -6,10 +6,11 @@ class UserAlreadyExistsError extends custom_error_1.CustomError {
6
6
  constructor() {
7
7
  super("User already exists");
8
8
  this.statusCode = 409;
9
+ this.internalCode = 30;
9
10
  Object.setPrototypeOf(this, UserAlreadyExistsError.prototype);
10
11
  }
11
12
  serializeErrors() {
12
- return [{ message: "User already exists" }];
13
+ return [{ code: this.internalCode, message: "User already exists" }];
13
14
  }
14
15
  }
15
16
  exports.UserAlreadyExistsError = UserAlreadyExistsError;
@@ -1,8 +1,10 @@
1
1
  import { CustomError } from "./custom-error";
2
2
  export declare class VerificationFailedError extends CustomError {
3
3
  statusCode: number;
4
+ internalCode: number;
4
5
  constructor();
5
6
  serializeErrors(): {
7
+ code: number;
6
8
  message: string;
7
9
  }[];
8
10
  }
@@ -6,10 +6,11 @@ class VerificationFailedError extends custom_error_1.CustomError {
6
6
  constructor() {
7
7
  super("SMS verification failed");
8
8
  this.statusCode = 401;
9
+ this.internalCode = 31;
9
10
  Object.setPrototypeOf(this, VerificationFailedError.prototype);
10
11
  }
11
12
  serializeErrors() {
12
- return [{ message: "Verification failed" }];
13
+ return [{ code: this.internalCode, message: "Verification failed" }];
13
14
  }
14
15
  }
15
16
  exports.VerificationFailedError = VerificationFailedError;
@@ -1,8 +1,10 @@
1
1
  import { CustomError } from "./custom-error";
2
2
  export declare class WrongOrderStateError extends CustomError {
3
3
  statusCode: number;
4
+ internalCode: number;
4
5
  constructor();
5
6
  serializeErrors(): {
7
+ code: number;
6
8
  message: string;
7
9
  }[];
8
10
  }
@@ -6,11 +6,15 @@ class WrongOrderStateError extends custom_error_1.CustomError {
6
6
  constructor() {
7
7
  super("Order is not in the correct state to call this method");
8
8
  this.statusCode = 400;
9
+ this.internalCode = 32;
9
10
  Object.setPrototypeOf(this, WrongOrderStateError.prototype);
10
11
  }
11
12
  serializeErrors() {
12
13
  return [
13
- { message: "Order is not in the correct state to call this method" },
14
+ {
15
+ code: this.internalCode,
16
+ message: "Order is not in the correct state to call this method",
17
+ },
14
18
  ];
15
19
  }
16
20
  }
@@ -1,8 +1,10 @@
1
1
  import { CustomError } from "./custom-error";
2
2
  export declare class WrongPasswordError extends CustomError {
3
3
  statusCode: number;
4
+ internalCode: number;
4
5
  constructor();
5
6
  serializeErrors(): {
7
+ code: number;
6
8
  message: string;
7
9
  }[];
8
10
  }
@@ -6,10 +6,11 @@ class WrongPasswordError extends custom_error_1.CustomError {
6
6
  constructor() {
7
7
  super("Wrong password");
8
8
  this.statusCode = 401;
9
+ this.internalCode = 33;
9
10
  Object.setPrototypeOf(this, WrongPasswordError.prototype);
10
11
  }
11
12
  serializeErrors() {
12
- return [{ message: "Wrong password" }];
13
+ return [{ code: this.internalCode, message: "Wrong password" }];
13
14
  }
14
15
  }
15
16
  exports.WrongPasswordError = WrongPasswordError;
@@ -1,8 +1,10 @@
1
1
  import { CustomError } from "./custom-error";
2
2
  export declare class WrongProcessorError extends CustomError {
3
3
  statusCode: number;
4
+ internalCode: number;
4
5
  constructor();
5
6
  serializeErrors(): {
7
+ code: number;
6
8
  message: string;
7
9
  }[];
8
10
  }
@@ -6,10 +6,16 @@ class WrongProcessorError extends custom_error_1.CustomError {
6
6
  constructor() {
7
7
  super("Order not assigned to this processor");
8
8
  this.statusCode = 400;
9
+ this.internalCode = 34;
9
10
  Object.setPrototypeOf(this, WrongProcessorError.prototype);
10
11
  }
11
12
  serializeErrors() {
12
- return [{ message: "Order not assigned to this processor" }];
13
+ return [
14
+ {
15
+ code: this.internalCode,
16
+ message: "Order not assigned to this processor",
17
+ },
18
+ ];
13
19
  }
14
20
  }
15
21
  exports.WrongProcessorError = WrongProcessorError;
@@ -1,8 +1,10 @@
1
1
  import { CustomError } from "./custom-error";
2
2
  export declare class WrongSecurityAnswerError extends CustomError {
3
3
  statusCode: number;
4
+ internalCode: number;
4
5
  constructor();
5
6
  serializeErrors(): {
7
+ code: number;
6
8
  message: string;
7
9
  }[];
8
10
  }
@@ -6,10 +6,11 @@ class WrongSecurityAnswerError extends custom_error_1.CustomError {
6
6
  constructor() {
7
7
  super("Wrong security answer");
8
8
  this.statusCode = 401;
9
+ this.internalCode = 35;
9
10
  Object.setPrototypeOf(this, WrongSecurityAnswerError.prototype);
10
11
  }
11
12
  serializeErrors() {
12
- return [{ message: "Wrong security answer" }];
13
+ return [{ code: this.internalCode, message: "Wrong security answer" }];
13
14
  }
14
15
  }
15
16
  exports.WrongSecurityAnswerError = WrongSecurityAnswerError;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common",
3
- "version": "1.0.776",
3
+ "version": "1.0.777",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",