@finatic/client 0.0.135 → 0.0.136
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/dist/index.d.ts +4 -1
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -1
- package/dist/index.mjs.map +1 -1
- package/dist/types/types/api/errors.d.ts +8 -0
- package/dist/types/utils/errors.d.ts +3 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -836,6 +836,9 @@ declare class OrderError extends ApiError {
|
|
|
836
836
|
declare class OrderValidationError extends ApiError {
|
|
837
837
|
constructor(message: string, details?: Record<string, any>);
|
|
838
838
|
}
|
|
839
|
+
declare class TradingNotEnabledError extends ApiError {
|
|
840
|
+
constructor(message: string, details?: Record<string, any>);
|
|
841
|
+
}
|
|
839
842
|
|
|
840
843
|
declare class ApiClient {
|
|
841
844
|
private readonly baseUrl;
|
|
@@ -1769,5 +1772,5 @@ declare class MockFactory {
|
|
|
1769
1772
|
};
|
|
1770
1773
|
}
|
|
1771
1774
|
|
|
1772
|
-
export { ApiClient, ApiError, AuthenticationError, AuthorizationError, BaseError, CompanyAccessError, EventEmitter, FinaticConnect, MockFactory, NetworkError, OrderError, OrderValidationError, PaginatedResult, RateLimitError, SecurityError, SessionError, TokenError, appendThemeToURL, createCustomThemeFromPreset, generatePortalThemeURL, getThemePreset, portalThemePresets, validateCustomTheme };
|
|
1775
|
+
export { ApiClient, ApiError, AuthenticationError, AuthorizationError, BaseError, CompanyAccessError, EventEmitter, FinaticConnect, MockFactory, NetworkError, OrderError, OrderValidationError, PaginatedResult, RateLimitError, SecurityError, SessionError, TokenError, TradingNotEnabledError, appendThemeToURL, createCustomThemeFromPreset, generatePortalThemeURL, getThemePreset, portalThemePresets, validateCustomTheme };
|
|
1773
1776
|
export type { AccountsFilter, ApiConfig, ApiResponse, BrokerAccount, BrokerConnection, BrokerDataAccount, BrokerDataOptions, BrokerDataOrder, BrokerDataPosition, BrokerExtras, BrokerInfo, BrokerOrder, BrokerOrderParams, BrokerPosition, CryptoOrderOptions, DeviceInfo$1 as DeviceInfo, FilteredAccountsResponse, FilteredOrdersResponse, FilteredPositionsResponse, FinaticConnectOptions, FinaticUserToken, Holding, OptionsOrder, OptionsOrderOptions, Order, OrderNotFoundError, OrderResponse, OrdersFilter, OtpRequestResponse, OtpVerifyResponse, PerformanceMetrics, PortalMessage, PortalProps, PortalResponse, PortalTheme, PortalThemeConfig, PortalThemePreset, PortalUrlResponse, Portfolio, PortfolioSnapshot, PositionsFilter, RefreshTokenRequest, RefreshTokenResponse, RequestHeaders, SessionAuthenticateResponse, SessionInitResponse, SessionResponse, SessionStartResponse, SessionStatus, SessionValidationResponse, TokenInfo, TradeAccessDeniedError, TradingContext, UserToken, ValidationError };
|
package/dist/index.js
CHANGED
|
@@ -198,6 +198,12 @@ class OrderValidationError extends ApiError {
|
|
|
198
198
|
this.name = 'OrderValidationError';
|
|
199
199
|
}
|
|
200
200
|
}
|
|
201
|
+
class TradingNotEnabledError extends ApiError {
|
|
202
|
+
constructor(message, details) {
|
|
203
|
+
super(403, message, details);
|
|
204
|
+
this.name = 'TradingNotEnabledError';
|
|
205
|
+
}
|
|
206
|
+
}
|
|
201
207
|
|
|
202
208
|
class ApiClient {
|
|
203
209
|
constructor(baseUrl, deviceInfo) {
|
|
@@ -513,6 +519,9 @@ class ApiClient {
|
|
|
513
519
|
if (error.detail?.code === 'NO_COMPANY_ACCESS') {
|
|
514
520
|
return new CompanyAccessError(error.detail.message || 'No broker connections found for this company', error.detail);
|
|
515
521
|
}
|
|
522
|
+
if (error.detail?.code === 'TRADING_NOT_ENABLED') {
|
|
523
|
+
return new TradingNotEnabledError(error.detail.message || 'Trading is not enabled for your company', error.detail);
|
|
524
|
+
}
|
|
516
525
|
return new AuthorizationError(message || 'Forbidden: No access to the requested data', error);
|
|
517
526
|
case 404:
|
|
518
527
|
return new ApiError(status, message || 'Not found: The requested data does not exist', error);
|
|
@@ -4911,6 +4920,7 @@ exports.RateLimitError = RateLimitError;
|
|
|
4911
4920
|
exports.SecurityError = SecurityError;
|
|
4912
4921
|
exports.SessionError = SessionError;
|
|
4913
4922
|
exports.TokenError = TokenError;
|
|
4923
|
+
exports.TradingNotEnabledError = TradingNotEnabledError;
|
|
4914
4924
|
exports.ValidationError = ValidationError;
|
|
4915
4925
|
exports.appendThemeToURL = appendThemeToURL;
|
|
4916
4926
|
exports.createCustomThemeFromPreset = createCustomThemeFromPreset;
|