@riocrypto/common-server 1.0.510 → 1.0.511
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/clients/ccxt-client.d.ts +1 -4
- package/build/clients/ccxt-client.js +8 -9
- package/build/clients/fireblocks-client.d.ts +1 -1
- package/build/clients/fixer-client.d.ts +1 -1
- package/build/clients/kushki-client.d.ts +1 -3
- package/build/clients/kushki-client.js +3 -3
- package/build/clients/rio-client.d.ts +1 -21
- package/build/helpers/get-user-helper.d.ts +2 -3
- package/build/index.d.ts +0 -51
- package/build/index.js +0 -51
- package/build/middlewares/authorize.d.ts +1 -1
- package/build/middlewares/authorize.js +32 -41
- package/build/middlewares/error-handler.js +2 -2
- package/build/middlewares/get-order.js +7 -9
- package/build/middlewares/get-user.js +3 -3
- package/build/middlewares/require-admin-api-key.js +2 -2
- package/build/middlewares/require-auth.js +2 -2
- package/build/middlewares/require-priveleges.js +3 -4
- package/build/middlewares/validate-auth.js +4 -5
- package/build/middlewares/validate-kyc.js +7 -9
- package/build/middlewares/validate-request.js +2 -2
- package/build/models/auth.d.ts +1 -2
- package/build/models/business-user.d.ts +1 -7
- package/build/models/checked-address.d.ts +1 -1
- package/build/models/order.d.ts +1 -11
- package/build/models/partner.d.ts +1 -1
- package/build/models/user.d.ts +1 -6
- package/package.json +2 -1
- package/build/errors/address-check-failed-error.d.ts +0 -8
- package/build/errors/address-check-failed-error.js +0 -15
- package/build/errors/admin-already-exists-error.d.ts +0 -8
- package/build/errors/admin-already-exists-error.js +0 -15
- package/build/errors/admin-not-found-error.d.ts +0 -8
- package/build/errors/admin-not-found-error.js +0 -15
- package/build/errors/admin-only-error.d.ts +0 -8
- package/build/errors/admin-only-error.js +0 -15
- package/build/errors/api-key-not-found-error.d.ts +0 -8
- package/build/errors/api-key-not-found-error.js +0 -15
- package/build/errors/auth-already-exists-error.d.ts +0 -8
- package/build/errors/auth-already-exists-error.js +0 -15
- package/build/errors/auth-not-found-error.d.ts +0 -8
- package/build/errors/auth-not-found-error.js +0 -15
- package/build/errors/authorization-failed-error.d.ts +0 -8
- package/build/errors/authorization-failed-error.js +0 -15
- package/build/errors/custom-error.d.ts +0 -8
- package/build/errors/custom-error.js +0 -10
- package/build/errors/database-connection-error.d.ts +0 -9
- package/build/errors/database-connection-error.js +0 -16
- package/build/errors/insufficient-liquidity-error.d.ts +0 -8
- package/build/errors/insufficient-liquidity-error.js +0 -19
- package/build/errors/invalid-order-size-error.d.ts +0 -8
- package/build/errors/invalid-order-size-error.js +0 -15
- package/build/errors/message-failed-error.d.ts +0 -8
- package/build/errors/message-failed-error.js +0 -15
- package/build/errors/missing-kyc-approval-error.d.ts +0 -8
- package/build/errors/missing-kyc-approval-error.js +0 -15
- package/build/errors/missing-password-error.d.ts +0 -8
- package/build/errors/missing-password-error.js +0 -15
- package/build/errors/missing-security-question-error.d.ts +0 -8
- package/build/errors/missing-security-question-error.js +0 -15
- package/build/errors/missing-user-error.d.ts +0 -8
- package/build/errors/missing-user-error.js +0 -15
- package/build/errors/not-authorized-error.d.ts +0 -8
- package/build/errors/not-authorized-error.js +0 -15
- package/build/errors/not-broker-error.d.ts +0 -8
- package/build/errors/not-broker-error.js +0 -17
- package/build/errors/not-found-error.d.ts +0 -8
- package/build/errors/not-found-error.js +0 -15
- package/build/errors/partner-already-exists-error.d.ts +0 -8
- package/build/errors/partner-already-exists-error.js +0 -15
- package/build/errors/partner-not-found-error.d.ts +0 -8
- package/build/errors/partner-not-found-error.js +0 -15
- package/build/errors/password-already-used-error.d.ts +0 -8
- package/build/errors/password-already-used-error.js +0 -15
- package/build/errors/request-validation-error.d.ts +0 -11
- package/build/errors/request-validation-error.js +0 -18
- package/build/errors/rio-settings-already-exists-error.d.ts +0 -8
- package/build/errors/rio-settings-already-exists-error.js +0 -15
- package/build/errors/rio-settings-not-found-error.d.ts +0 -8
- package/build/errors/rio-settings-not-found-error.js +0 -15
- package/build/errors/user-already-exists-error.d.ts +0 -8
- package/build/errors/user-already-exists-error.js +0 -15
- package/build/errors/verification-failed-error.d.ts +0 -8
- package/build/errors/verification-failed-error.js +0 -15
- package/build/errors/wrong-order-state-error.d.ts +0 -8
- package/build/errors/wrong-order-state-error.js +0 -17
- package/build/errors/wrong-password-error.d.ts +0 -8
- package/build/errors/wrong-password-error.js +0 -15
- package/build/errors/wrong-processor-error.d.ts +0 -8
- package/build/errors/wrong-processor-error.js +0 -15
- package/build/errors/wrong-security-answer-error.d.ts +0 -8
- package/build/errors/wrong-security-answer-error.js +0 -15
- package/build/events/admin-created-event.d.ts +0 -8
- package/build/events/admin-created-event.js +0 -2
- package/build/events/admin-deleted-event.d.ts +0 -7
- package/build/events/admin-deleted-event.js +0 -2
- package/build/events/bank-payout-initialized-event.d.ts +0 -12
- package/build/events/bank-payout-initialized-event.js +0 -2
- package/build/events/base-listener.d.ts +0 -18
- package/build/events/base-listener.js +0 -30
- package/build/events/base-publisher.d.ts +0 -13
- package/build/events/base-publisher.js +0 -20
- package/build/events/business-kyc-failed-event.d.ts +0 -7
- package/build/events/business-kyc-failed-event.js +0 -2
- package/build/events/business-kyc-passed-event.d.ts +0 -7
- package/build/events/business-kyc-passed-event.js +0 -2
- package/build/events/checked-address-created-event.d.ts +0 -11
- package/build/events/checked-address-created-event.js +0 -2
- package/build/events/checked-address-updated-event.d.ts +0 -10
- package/build/events/checked-address-updated-event.js +0 -2
- package/build/events/clip-card-payment-created-event.d.ts +0 -8
- package/build/events/clip-card-payment-created-event.js +0 -2
- package/build/events/clip-card-payment-failed-event.d.ts +0 -7
- package/build/events/clip-card-payment-failed-event.js +0 -2
- package/build/events/deposit-address-created-event.d.ts +0 -8
- package/build/events/deposit-address-created-event.js +0 -2
- package/build/events/deposit-address-failed-event.d.ts +0 -7
- package/build/events/deposit-address-failed-event.js +0 -2
- package/build/events/deposit-completed-event.d.ts +0 -9
- package/build/events/deposit-completed-event.js +0 -2
- package/build/events/deposit-registered-event.d.ts +0 -9
- package/build/events/deposit-registered-event.js +0 -2
- package/build/events/dlocal-bank-payment-created-event.d.ts +0 -9
- package/build/events/dlocal-bank-payment-created-event.js +0 -2
- package/build/events/dlocal-bank-payment-failed-event.d.ts +0 -7
- package/build/events/dlocal-bank-payment-failed-event.js +0 -2
- package/build/events/fees-failed-event.d.ts +0 -7
- package/build/events/fees-failed-event.js +0 -2
- package/build/events/kyc-failed-event.d.ts +0 -7
- package/build/events/kyc-failed-event.js +0 -2
- package/build/events/kyc-passed-event.d.ts +0 -7
- package/build/events/kyc-passed-event.js +0 -2
- package/build/events/liquidity-fill-failed-event.d.ts +0 -7
- package/build/events/liquidity-fill-failed-event.js +0 -2
- package/build/events/liquidity-filled-event.d.ts +0 -11
- package/build/events/liquidity-filled-event.js +0 -2
- package/build/events/liquidity-routed-event.d.ts +0 -9
- package/build/events/liquidity-routed-event.js +0 -2
- package/build/events/liquidity-routing-failed-event.d.ts +0 -7
- package/build/events/liquidity-routing-failed-event.js +0 -2
- package/build/events/liquidity-transfer-failed-event.d.ts +0 -7
- package/build/events/liquidity-transfer-failed-event.js +0 -2
- package/build/events/liquidity-transfered-event.d.ts +0 -9
- package/build/events/liquidity-transfered-event.js +0 -2
- package/build/events/order-created-event.d.ts +0 -39
- package/build/events/order-created-event.js +0 -2
- package/build/events/order-deleted-event.d.ts +0 -7
- package/build/events/order-deleted-event.js +0 -2
- package/build/events/order-updated-event.d.ts +0 -37
- package/build/events/order-updated-event.js +0 -2
- package/build/events/partner-created-event.d.ts +0 -14
- package/build/events/partner-created-event.js +0 -2
- package/build/events/partner-updated-event.d.ts +0 -19
- package/build/events/partner-updated-event.js +0 -2
- package/build/events/payment-complete-event.d.ts +0 -9
- package/build/events/payment-complete-event.js +0 -2
- package/build/events/payment-created-event.d.ts +0 -8
- package/build/events/payment-created-event.js +0 -2
- package/build/events/payment-failed-event.d.ts +0 -7
- package/build/events/payment-failed-event.js +0 -2
- package/build/events/processor-routed-event.d.ts +0 -9
- package/build/events/processor-routed-event.js +0 -2
- package/build/events/processor-routing-failed-event.d.ts +0 -7
- package/build/events/processor-routing-failed-event.js +0 -2
- package/build/events/quote-failed-event.d.ts +0 -7
- package/build/events/quote-failed-event.js +0 -2
- package/build/events/rio-settings-created-event.d.ts +0 -8
- package/build/events/rio-settings-created-event.js +0 -2
- package/build/events/rio-settings-updated-event.d.ts +0 -8
- package/build/events/rio-settings-updated-event.js +0 -2
- package/build/events/subjects.d.ts +0 -60
- package/build/events/subjects.js +0 -64
- package/build/events/user-created-event.d.ts +0 -25
- package/build/events/user-created-event.js +0 -2
- package/build/events/user-deleted-event.d.ts +0 -7
- package/build/events/user-deleted-event.js +0 -2
- package/build/events/user-disabled-event.d.ts +0 -7
- package/build/events/user-disabled-event.js +0 -2
- package/build/events/user-updated-event.d.ts +0 -23
- package/build/events/user-updated-event.js +0 -2
- package/build/events/wyre-ach-payment-created-event.d.ts +0 -9
- package/build/events/wyre-ach-payment-created-event.js +0 -2
- package/build/events/wyre-payment-method-created-event.d.ts +0 -11
- package/build/events/wyre-payment-method-created-event.js +0 -2
- package/build/events/wyre-transfer-completed-event.d.ts +0 -9
- package/build/events/wyre-transfer-completed-event.js +0 -2
- package/build/events/wyre-transfer-created-event.d.ts +0 -9
- package/build/events/wyre-transfer-created-event.js +0 -2
- package/build/events/wyre-transfer-failed-event.d.ts +0 -9
- package/build/events/wyre-transfer-failed-event.js +0 -2
- package/build/events/wyre-user-created-event.d.ts +0 -9
- package/build/events/wyre-user-created-event.js +0 -2
- package/build/types/address-check-result.d.ts +0 -4
- package/build/types/address-check-result.js +0 -8
- package/build/types/admin.d.ts +0 -4
- package/build/types/admin.js +0 -2
- package/build/types/api-key.d.ts +0 -5
- package/build/types/api-key.js +0 -2
- package/build/types/auth-update.d.ts +0 -8
- package/build/types/auth-update.js +0 -2
- package/build/types/auth.d.ts +0 -6
- package/build/types/auth.js +0 -2
- package/build/types/authorization-type.d.ts +0 -9
- package/build/types/authorization-type.js +0 -13
- package/build/types/bank-payout.d.ts +0 -7
- package/build/types/bank-payout.js +0 -2
- package/build/types/business-user-input.d.ts +0 -27
- package/build/types/business-user-input.js +0 -2
- package/build/types/business-user-update.d.ts +0 -26
- package/build/types/business-user-update.js +0 -2
- package/build/types/business-user.d.ts +0 -30
- package/build/types/business-user.js +0 -2
- package/build/types/ccxt-liquidity-provider.d.ts +0 -5
- package/build/types/ccxt-liquidity-provider.js +0 -9
- package/build/types/checked-address.d.ts +0 -7
- package/build/types/checked-address.js +0 -2
- package/build/types/clip-payment-status.d.ts +0 -3
- package/build/types/clip-payment-status.js +0 -7
- package/build/types/country.d.ts +0 -57
- package/build/types/country.js +0 -256
- package/build/types/crypto.d.ts +0 -6
- package/build/types/crypto.js +0 -38
- package/build/types/dlocal-payment-method.d.ts +0 -4
- package/build/types/dlocal-payment-method.js +0 -8
- package/build/types/fees.d.ts +0 -9
- package/build/types/fees.js +0 -2
- package/build/types/fiat.d.ts +0 -6
- package/build/types/fiat.js +0 -45
- package/build/types/kyc-status.d.ts +0 -7
- package/build/types/kyc-status.js +0 -11
- package/build/types/language.d.ts +0 -6
- package/build/types/language.js +0 -10
- package/build/types/liquidity-provider.d.ts +0 -9
- package/build/types/liquidity-provider.js +0 -13
- package/build/types/order-input.d.ts +0 -31
- package/build/types/order-input.js +0 -2
- package/build/types/order-status.d.ts +0 -21
- package/build/types/order-status.js +0 -51
- package/build/types/order.d.ts +0 -37
- package/build/types/order.js +0 -2
- package/build/types/partner-auth.d.ts +0 -5
- package/build/types/partner-auth.js +0 -2
- package/build/types/partner-stats.d.ts +0 -5
- package/build/types/partner-stats.js +0 -2
- package/build/types/partner-status.d.ts +0 -6
- package/build/types/partner-status.js +0 -10
- package/build/types/partner-update.d.ts +0 -10
- package/build/types/partner-update.js +0 -2
- package/build/types/partner.d.ts +0 -15
- package/build/types/partner.js +0 -2
- package/build/types/payment-method.d.ts +0 -5
- package/build/types/payment-method.js +0 -9
- package/build/types/payout-method.d.ts +0 -3
- package/build/types/payout-method.js +0 -7
- package/build/types/platform-fee-range.d.ts +0 -5
- package/build/types/platform-fee-range.js +0 -2
- package/build/types/processor.d.ts +0 -12
- package/build/types/processor.js +0 -16
- package/build/types/quote.d.ts +0 -21
- package/build/types/quote.js +0 -2
- package/build/types/rio-env.d.ts +0 -6
- package/build/types/rio-env.js +0 -10
- package/build/types/rio-settings-update.d.ts +0 -4
- package/build/types/rio-settings-update.js +0 -2
- package/build/types/rio-settings.d.ts +0 -4
- package/build/types/rio-settings.js +0 -2
- package/build/types/security-question.d.ts +0 -7
- package/build/types/security-question.js +0 -11
- package/build/types/side.d.ts +0 -4
- package/build/types/side.js +0 -8
- package/build/types/us-state.d.ts +0 -61
- package/build/types/us-state.js +0 -65
- package/build/types/user-attribute.d.ts +0 -10
- package/build/types/user-attribute.js +0 -14
- package/build/types/user-input.d.ts +0 -26
- package/build/types/user-input.js +0 -2
- package/build/types/user-type.d.ts +0 -4
- package/build/types/user-type.js +0 -8
- package/build/types/user-update.d.ts +0 -25
- package/build/types/user-update.js +0 -2
- package/build/types/user.d.ts +0 -30
- package/build/types/user.js +0 -2
- package/build/types/users-stats.d.ts +0 -3
- package/build/types/users-stats.js +0 -2
- package/build/types/wyre-address.d.ts +0 -9
- package/build/types/wyre-address.js +0 -2
- package/build/types/wyre-order-status.d.ts +0 -7
- package/build/types/wyre-order-status.js +0 -11
- package/build/types/wyre-payment-method.d.ts +0 -40
- package/build/types/wyre-payment-method.js +0 -2
- package/build/types/wyre-webhook-notification.d.ts +0 -12
- package/build/types/wyre-webhook-notification.js +0 -2
|
@@ -10,19 +10,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.validateKYC = void 0;
|
|
13
|
-
const
|
|
14
|
-
const kyc_status_1 = require("../types/kyc-status");
|
|
15
|
-
const user_type_1 = require("../types/user-type");
|
|
13
|
+
const common_1 = require("@riocrypto/common");
|
|
16
14
|
const validateKYC = (req, res, next) => __awaiter(void 0, void 0, void 0, function* () {
|
|
17
15
|
const user = req.user;
|
|
18
|
-
if ((user === null || user === void 0 ? void 0 : user.type) ===
|
|
19
|
-
if (user.kycStatus !==
|
|
20
|
-
throw new
|
|
16
|
+
if ((user === null || user === void 0 ? void 0 : user.type) === common_1.UserType.Individual) {
|
|
17
|
+
if (user.kycStatus !== common_1.KYCStatus.Passed) {
|
|
18
|
+
throw new common_1.MissingKYCApprovalError();
|
|
21
19
|
}
|
|
22
20
|
}
|
|
23
|
-
if ((user === null || user === void 0 ? void 0 : user.type) ===
|
|
24
|
-
if (user.kycStatus !==
|
|
25
|
-
throw new
|
|
21
|
+
if ((user === null || user === void 0 ? void 0 : user.type) === common_1.UserType.Business) {
|
|
22
|
+
if (user.kycStatus !== common_1.KYCStatus.businessApproved) {
|
|
23
|
+
throw new common_1.MissingKYCApprovalError();
|
|
26
24
|
}
|
|
27
25
|
}
|
|
28
26
|
next();
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.validateRequest = void 0;
|
|
4
|
+
const common_1 = require("@riocrypto/common");
|
|
4
5
|
const express_validator_1 = require("express-validator");
|
|
5
|
-
const request_validation_error_1 = require("../errors/request-validation-error");
|
|
6
6
|
const validateRequest = (req, res, next) => {
|
|
7
7
|
const errors = (0, express_validator_1.validationResult)(req);
|
|
8
8
|
if (!errors.isEmpty()) {
|
|
9
|
-
throw new
|
|
9
|
+
throw new common_1.RequestValidationError(errors.array());
|
|
10
10
|
}
|
|
11
11
|
next();
|
|
12
12
|
};
|
package/build/models/auth.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { APIKey } from "
|
|
2
|
-
import { SecurityQuestion } from "../types/security-question";
|
|
1
|
+
import { APIKey, SecurityQuestion } from "@riocrypto/common";
|
|
3
2
|
import { Mongoose, Model, Document } from "mongoose";
|
|
4
3
|
interface AuthAttrs {
|
|
5
4
|
phoneNumber: string;
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
import { Country } from "
|
|
2
|
-
import { KYCStatus } from "../types/kyc-status";
|
|
3
|
-
import { Language } from "../types/language";
|
|
4
|
-
import { PlatformFeeRange } from "../types/platform-fee-range";
|
|
5
|
-
import { USState } from "../types/us-state";
|
|
6
|
-
import { UserAttribute } from "../types/user-attribute";
|
|
7
|
-
import { UserType } from "../types/user-type";
|
|
1
|
+
import { Country, KYCStatus, Language, PlatformFeeRange, USState, UserAttribute, UserType } from "@riocrypto/common";
|
|
8
2
|
import { Mongoose, Model, Document } from "mongoose";
|
|
9
3
|
interface BusinessUserAttrs {
|
|
10
4
|
authId?: string;
|
package/build/models/order.d.ts
CHANGED
|
@@ -1,14 +1,4 @@
|
|
|
1
|
-
import { Country } from "
|
|
2
|
-
import { Fees } from "../types/fees";
|
|
3
|
-
import { Fiat } from "../types/fiat";
|
|
4
|
-
import { LiquidityProvider } from "../types/liquidity-provider";
|
|
5
|
-
import { OrderStatus } from "../types/order-status";
|
|
6
|
-
import { PaymentMethod } from "../types/payment-method";
|
|
7
|
-
import { PayoutMethod } from "../types/payout-method";
|
|
8
|
-
import { Processor } from "../types/processor";
|
|
9
|
-
import { Side } from "../types/side";
|
|
10
|
-
import { USState } from "../types/us-state";
|
|
11
|
-
import { Crypto } from "../types/crypto";
|
|
1
|
+
import { Country, Fees, Fiat, LiquidityProvider, OrderStatus, PaymentMethod, PayoutMethod, Processor, Side, USState } from "@riocrypto/common";
|
|
12
2
|
import { Mongoose, Model, Document } from "mongoose";
|
|
13
3
|
interface OrderAttrs {
|
|
14
4
|
userId: string;
|
package/build/models/user.d.ts
CHANGED
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
import { Country } from "
|
|
2
|
-
import { KYCStatus } from "../types/kyc-status";
|
|
3
|
-
import { Language } from "../types/language";
|
|
4
|
-
import { USState } from "../types/us-state";
|
|
5
|
-
import { UserAttribute } from "../types/user-attribute";
|
|
6
|
-
import { UserType } from "../types/user-type";
|
|
1
|
+
import { Country, KYCStatus, Language, USState, UserAttribute, UserType } from "@riocrypto/common";
|
|
7
2
|
import { Mongoose, Model, Document } from "mongoose";
|
|
8
3
|
interface UserAttrs {
|
|
9
4
|
authId: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@riocrypto/common-server",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.511",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./build/index.js",
|
|
6
6
|
"types": "./build/index.d.ts",
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@aws-sdk/client-s3": "^3.297.0",
|
|
25
|
+
"@riocrypto/common": "^1.0.524",
|
|
25
26
|
"@types/express": "^4.17.13",
|
|
26
27
|
"axios": "^0.27.2",
|
|
27
28
|
"ccxt": "^3.0.30",
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AddressCheckFailed = void 0;
|
|
4
|
-
const custom_error_1 = require("./custom-error");
|
|
5
|
-
class AddressCheckFailed extends custom_error_1.CustomError {
|
|
6
|
-
constructor() {
|
|
7
|
-
super("Address check failed");
|
|
8
|
-
this.statusCode = 400;
|
|
9
|
-
Object.setPrototypeOf(this, AddressCheckFailed.prototype);
|
|
10
|
-
}
|
|
11
|
-
serializeErrors() {
|
|
12
|
-
return [{ message: "Address check failed" }];
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
exports.AddressCheckFailed = AddressCheckFailed;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AdminAlreadyExistsError = void 0;
|
|
4
|
-
const custom_error_1 = require("./custom-error");
|
|
5
|
-
class AdminAlreadyExistsError extends custom_error_1.CustomError {
|
|
6
|
-
constructor() {
|
|
7
|
-
super("Admin with provided email already exists");
|
|
8
|
-
this.statusCode = 409;
|
|
9
|
-
Object.setPrototypeOf(this, AdminAlreadyExistsError.prototype);
|
|
10
|
-
}
|
|
11
|
-
serializeErrors() {
|
|
12
|
-
return [{ message: "Admin with provided email already exists" }];
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
exports.AdminAlreadyExistsError = AdminAlreadyExistsError;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AdminNotFoundError = void 0;
|
|
4
|
-
const custom_error_1 = require("./custom-error");
|
|
5
|
-
class AdminNotFoundError extends custom_error_1.CustomError {
|
|
6
|
-
constructor() {
|
|
7
|
-
super("Admin not found");
|
|
8
|
-
this.statusCode = 404;
|
|
9
|
-
Object.setPrototypeOf(this, AdminNotFoundError.prototype);
|
|
10
|
-
}
|
|
11
|
-
serializeErrors() {
|
|
12
|
-
return [{ message: "Admin not found" }];
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
exports.AdminNotFoundError = AdminNotFoundError;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AdminOnlyError = void 0;
|
|
4
|
-
const custom_error_1 = require("./custom-error");
|
|
5
|
-
class AdminOnlyError extends custom_error_1.CustomError {
|
|
6
|
-
constructor() {
|
|
7
|
-
super("This endpoint can only be called by admins");
|
|
8
|
-
this.statusCode = 401;
|
|
9
|
-
Object.setPrototypeOf(this, AdminOnlyError.prototype);
|
|
10
|
-
}
|
|
11
|
-
serializeErrors() {
|
|
12
|
-
return [{ message: "This endpoint can only be called by admins" }];
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
exports.AdminOnlyError = AdminOnlyError;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.APIKeyNotFoundError = void 0;
|
|
4
|
-
const custom_error_1 = require("./custom-error");
|
|
5
|
-
class APIKeyNotFoundError extends custom_error_1.CustomError {
|
|
6
|
-
constructor() {
|
|
7
|
-
super("API key not found");
|
|
8
|
-
this.statusCode = 404;
|
|
9
|
-
Object.setPrototypeOf(this, APIKeyNotFoundError.prototype);
|
|
10
|
-
}
|
|
11
|
-
serializeErrors() {
|
|
12
|
-
return [{ message: "API key not found" }];
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
exports.APIKeyNotFoundError = APIKeyNotFoundError;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AuthAlreadyExistsError = void 0;
|
|
4
|
-
const custom_error_1 = require("./custom-error");
|
|
5
|
-
class AuthAlreadyExistsError extends custom_error_1.CustomError {
|
|
6
|
-
constructor() {
|
|
7
|
-
super("Auth with provided phone number already exists");
|
|
8
|
-
this.statusCode = 409;
|
|
9
|
-
Object.setPrototypeOf(this, AuthAlreadyExistsError.prototype);
|
|
10
|
-
}
|
|
11
|
-
serializeErrors() {
|
|
12
|
-
return [{ message: "Auth with provided phone number already exists" }];
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
exports.AuthAlreadyExistsError = AuthAlreadyExistsError;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AuthNotFoundError = void 0;
|
|
4
|
-
const custom_error_1 = require("./custom-error");
|
|
5
|
-
class AuthNotFoundError extends custom_error_1.CustomError {
|
|
6
|
-
constructor() {
|
|
7
|
-
super("Auth not found");
|
|
8
|
-
this.statusCode = 404;
|
|
9
|
-
Object.setPrototypeOf(this, AuthNotFoundError.prototype);
|
|
10
|
-
}
|
|
11
|
-
serializeErrors() {
|
|
12
|
-
return [{ message: "Auth not found" }];
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
exports.AuthNotFoundError = AuthNotFoundError;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AuthorizationFailedError = void 0;
|
|
4
|
-
const custom_error_1 = require("./custom-error");
|
|
5
|
-
class AuthorizationFailedError extends custom_error_1.CustomError {
|
|
6
|
-
constructor() {
|
|
7
|
-
super("Wyre authorization codes failed validation");
|
|
8
|
-
this.statusCode = 400;
|
|
9
|
-
Object.setPrototypeOf(this, AuthorizationFailedError.prototype);
|
|
10
|
-
}
|
|
11
|
-
serializeErrors() {
|
|
12
|
-
return [{ message: "Authorization failed" }];
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
exports.AuthorizationFailedError = AuthorizationFailedError;
|
|
@@ -1,10 +0,0 @@
|
|
|
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();
|
|
7
|
-
Object.setPrototypeOf(this, CustomError.prototype);
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
exports.CustomError = CustomError;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DatabaseConnectionError = void 0;
|
|
4
|
-
const custom_error_1 = require("./custom-error");
|
|
5
|
-
class DatabaseConnectionError extends custom_error_1.CustomError {
|
|
6
|
-
constructor() {
|
|
7
|
-
super("Error connecting to database");
|
|
8
|
-
this.statusCode = 500;
|
|
9
|
-
this.reason = "Error connecting to database";
|
|
10
|
-
Object.setPrototypeOf(this, DatabaseConnectionError.prototype);
|
|
11
|
-
}
|
|
12
|
-
serializeErrors() {
|
|
13
|
-
return [{ message: this.reason }];
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
exports.DatabaseConnectionError = DatabaseConnectionError;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.InsufficientLiquidityError = void 0;
|
|
4
|
-
const custom_error_1 = require("./custom-error");
|
|
5
|
-
class InsufficientLiquidityError extends custom_error_1.CustomError {
|
|
6
|
-
constructor() {
|
|
7
|
-
super("Insufficient liquidity to process order");
|
|
8
|
-
this.statusCode = 400;
|
|
9
|
-
Object.setPrototypeOf(this, InsufficientLiquidityError.prototype);
|
|
10
|
-
}
|
|
11
|
-
serializeErrors() {
|
|
12
|
-
return [
|
|
13
|
-
{
|
|
14
|
-
message: "Insufficient liquidity to process order, please try again later",
|
|
15
|
-
},
|
|
16
|
-
];
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
exports.InsufficientLiquidityError = InsufficientLiquidityError;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.InvalidOrderSizeError = void 0;
|
|
4
|
-
const custom_error_1 = require("./custom-error");
|
|
5
|
-
class InvalidOrderSizeError extends custom_error_1.CustomError {
|
|
6
|
-
constructor() {
|
|
7
|
-
super("Invalid order size");
|
|
8
|
-
this.statusCode = 400;
|
|
9
|
-
Object.setPrototypeOf(this, InvalidOrderSizeError.prototype);
|
|
10
|
-
}
|
|
11
|
-
serializeErrors() {
|
|
12
|
-
return [{ message: "Invalid order size" }];
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
exports.InvalidOrderSizeError = InvalidOrderSizeError;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MessageFailedError = void 0;
|
|
4
|
-
const custom_error_1 = require("./custom-error");
|
|
5
|
-
class MessageFailedError extends custom_error_1.CustomError {
|
|
6
|
-
constructor() {
|
|
7
|
-
super("Failed to send verification code");
|
|
8
|
-
this.statusCode = 500;
|
|
9
|
-
Object.setPrototypeOf(this, MessageFailedError.prototype);
|
|
10
|
-
}
|
|
11
|
-
serializeErrors() {
|
|
12
|
-
return [{ message: "Failed to send verification code" }];
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
exports.MessageFailedError = MessageFailedError;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MissingKYCApprovalError = void 0;
|
|
4
|
-
const custom_error_1 = require("./custom-error");
|
|
5
|
-
class MissingKYCApprovalError extends custom_error_1.CustomError {
|
|
6
|
-
constructor() {
|
|
7
|
-
super("KYC status is not approved");
|
|
8
|
-
this.statusCode = 401;
|
|
9
|
-
Object.setPrototypeOf(this, MissingKYCApprovalError.prototype);
|
|
10
|
-
}
|
|
11
|
-
serializeErrors() {
|
|
12
|
-
return [{ message: "KYC status is not approved" }];
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
exports.MissingKYCApprovalError = MissingKYCApprovalError;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MissingPasswordError = void 0;
|
|
4
|
-
const custom_error_1 = require("./custom-error");
|
|
5
|
-
class MissingPasswordError extends custom_error_1.CustomError {
|
|
6
|
-
constructor() {
|
|
7
|
-
super("Password is not registered");
|
|
8
|
-
this.statusCode = 401;
|
|
9
|
-
Object.setPrototypeOf(this, MissingPasswordError.prototype);
|
|
10
|
-
}
|
|
11
|
-
serializeErrors() {
|
|
12
|
-
return [{ message: "Password is not registered" }];
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
exports.MissingPasswordError = MissingPasswordError;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MissingSecurityQuestionError = void 0;
|
|
4
|
-
const custom_error_1 = require("./custom-error");
|
|
5
|
-
class MissingSecurityQuestionError extends custom_error_1.CustomError {
|
|
6
|
-
constructor() {
|
|
7
|
-
super("Security question is not registered");
|
|
8
|
-
this.statusCode = 401;
|
|
9
|
-
Object.setPrototypeOf(this, MissingSecurityQuestionError.prototype);
|
|
10
|
-
}
|
|
11
|
-
serializeErrors() {
|
|
12
|
-
return [{ message: "Security question is not registered" }];
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
exports.MissingSecurityQuestionError = MissingSecurityQuestionError;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MissingUserError = void 0;
|
|
4
|
-
const custom_error_1 = require("./custom-error");
|
|
5
|
-
class MissingUserError extends custom_error_1.CustomError {
|
|
6
|
-
constructor() {
|
|
7
|
-
super("Auth is not registered to a user");
|
|
8
|
-
this.statusCode = 401;
|
|
9
|
-
Object.setPrototypeOf(this, MissingUserError.prototype);
|
|
10
|
-
}
|
|
11
|
-
serializeErrors() {
|
|
12
|
-
return [{ message: "Auth is not registered to a user" }];
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
exports.MissingUserError = MissingUserError;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NotAuthorizedError = void 0;
|
|
4
|
-
const custom_error_1 = require("./custom-error");
|
|
5
|
-
class NotAuthorizedError extends custom_error_1.CustomError {
|
|
6
|
-
constructor() {
|
|
7
|
-
super("Not authorized");
|
|
8
|
-
this.statusCode = 401;
|
|
9
|
-
Object.setPrototypeOf(this, NotAuthorizedError.prototype);
|
|
10
|
-
}
|
|
11
|
-
serializeErrors() {
|
|
12
|
-
return [{ message: "Not authorized" }];
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
exports.NotAuthorizedError = NotAuthorizedError;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NotBrokerError = void 0;
|
|
4
|
-
const custom_error_1 = require("./custom-error");
|
|
5
|
-
class NotBrokerError extends custom_error_1.CustomError {
|
|
6
|
-
constructor() {
|
|
7
|
-
super("To call this endpoint as a user, you must be a broker");
|
|
8
|
-
this.statusCode = 401;
|
|
9
|
-
Object.setPrototypeOf(this, NotBrokerError.prototype);
|
|
10
|
-
}
|
|
11
|
-
serializeErrors() {
|
|
12
|
-
return [
|
|
13
|
-
{ message: "To call this endpoint as a user, you must be a broker" },
|
|
14
|
-
];
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
exports.NotBrokerError = NotBrokerError;
|