@rivascva/dt-idl 1.1.9 → 1.1.10

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.cjs.js CHANGED
@@ -490,5 +490,10 @@ function mergeHeaders(...allHeaders) {
490
490
  const createMarketServiceClient = (options) => createClient(options);
491
491
  const createTradeServiceClient = (options) => createClient(options);
492
492
 
493
+ const isMarketServiceError = (error) => typeof error === 'object';
494
+ const isTradeServiceError = (error) => typeof error === 'object';
495
+
493
496
  exports.createMarketServiceClient = createMarketServiceClient;
494
497
  exports.createTradeServiceClient = createTradeServiceClient;
498
+ exports.isMarketServiceError = isMarketServiceError;
499
+ exports.isTradeServiceError = isTradeServiceError;
package/dist/index.d.ts CHANGED
@@ -902,6 +902,17 @@ interface operations {
902
902
  declare const createMarketServiceClient: (options: ClientOptions) => openapi_fetch.Client<paths$1, `${string}/${string}`>;
903
903
  declare const createTradeServiceClient: (options: ClientOptions) => openapi_fetch.Client<paths, `${string}/${string}`>;
904
904
 
905
+ declare const isMarketServiceError: (error: unknown) => error is {
906
+ status: number;
907
+ code: "ERROR";
908
+ message: string;
909
+ };
910
+ declare const isTradeServiceError: (error: unknown) => error is {
911
+ status: number;
912
+ code: "ERROR" | "NOT_ENOUGH_CASH" | "NOT_ENOUGH_SHARES" | "REQS_NOT_MET";
913
+ message: string;
914
+ };
915
+
905
916
  type MarketServiceSchemas = components$1['schemas'];
906
917
  type TradeServiceSchemas = components['schemas'];
907
918
  type SimpleQuote = MarketServiceSchemas['SimpleQuote'];
@@ -917,4 +928,4 @@ type Order = TradeServiceSchemas['Order'];
917
928
  type OrderType = TradeServiceSchemas['OrderType'];
918
929
  type TradeServiceError = TradeServiceSchemas['Error'];
919
930
 
920
- export { type FullQuote, type MarketServiceError, type NewsArticle, type Order, type OrderPayload, type OrderType, type Portfolio, type PortfolioType, type SimpleQuote, type StockNewsArticle, type TradeServiceError, type User, createMarketServiceClient, createTradeServiceClient };
931
+ export { type FullQuote, type MarketServiceError, type NewsArticle, type Order, type OrderPayload, type OrderType, type Portfolio, type PortfolioType, type SimpleQuote, type StockNewsArticle, type TradeServiceError, type User, createMarketServiceClient, createTradeServiceClient, isMarketServiceError, isTradeServiceError };
package/dist/index.esm.js CHANGED
@@ -488,4 +488,7 @@ function mergeHeaders(...allHeaders) {
488
488
  const createMarketServiceClient = (options) => createClient(options);
489
489
  const createTradeServiceClient = (options) => createClient(options);
490
490
 
491
- export { createMarketServiceClient, createTradeServiceClient };
491
+ const isMarketServiceError = (error) => typeof error === 'object';
492
+ const isTradeServiceError = (error) => typeof error === 'object';
493
+
494
+ export { createMarketServiceClient, createTradeServiceClient, isMarketServiceError, isTradeServiceError };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rivascva/dt-idl",
3
- "version": "1.1.9",
3
+ "version": "1.1.10",
4
4
  "description": "Dream Trade - Interface Definition Language",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
@@ -0,0 +1,7 @@
1
+ import { MarketServiceError, TradeServiceError } from '@ts/types';
2
+
3
+ export const isMarketServiceError = (error: unknown): error is MarketServiceError =>
4
+ typeof error === 'object';
5
+
6
+ export const isTradeServiceError = (error: unknown): error is TradeServiceError =>
7
+ typeof error === 'object';
@@ -1 +1,2 @@
1
1
  export * from './clients';
2
+ export * from './errors';