cloreai 0.1.4 → 0.1.6

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.
@@ -1,15 +1,15 @@
1
1
  import { type AxiosInstance, type AxiosRequestConfig } from 'axios';
2
- import { type CancelOrderBody, type CancelOrderOutput } from './types/cloreai/cancelOrder.js';
3
- import { type CreateOrderBody, type CreateOrderOutput } from './types/cloreai/createOrder.js';
4
- import { type MarketplaceOutput } from './types/cloreai/marketplace.js';
5
- import { type MyOrdersOutput, type MyOrdersParams } from './types/cloreai/myOrders.js';
6
- import { type MyServersOutput } from './types/cloreai/myServers.js';
7
- import { type ServerConfigBody, type ServerConfigOutput } from './types/cloreai/serverConfig.js';
8
- import { type SetServerSettingsBody, type SetServerSettingsOutput } from './types/cloreai/setServerSettings.js';
9
- import { type SetSpotPriceBody, type SetSpotPriceOutput } from './types/cloreai/setSpotPrice.js';
10
- import { type SpotMarketplaceOutput, type SpotMarketplaceParams } from './types/cloreai/spotMarketplace.js';
11
- import { type WalletsOutput } from './types/cloreai/wallets.js';
12
- import { type Config } from './types/config.js';
2
+ import type { CancelOrderBody, CancelOrderOutput } from './types/cloreai/cancelOrder.js';
3
+ import type { CreateOrderBody, CreateOrderOutput } from './types/cloreai/createOrder.js';
4
+ import type { MarketplaceOutput } from './types/cloreai/marketplace.js';
5
+ import type { MyOrdersOutput, MyOrdersParams } from './types/cloreai/myOrders.js';
6
+ import type { MyServersOutput } from './types/cloreai/myServers.js';
7
+ import type { ServerConfigBody, ServerConfigOutput } from './types/cloreai/serverConfig.js';
8
+ import type { SetServerSettingsBody, SetServerSettingsOutput } from './types/cloreai/setServerSettings.js';
9
+ import type { SetSpotPriceBody, SetSpotPriceOutput } from './types/cloreai/setSpotPrice.js';
10
+ import type { SpotMarketplaceOutput, SpotMarketplaceParams } from './types/cloreai/spotMarketplace.js';
11
+ import type { WalletsOutput } from './types/cloreai/wallets.js';
12
+ import type { Config } from './types/config.js';
13
13
  export declare class CloreAI {
14
14
  readonly api: AxiosInstance;
15
15
  constructor(config: Config);
package/build/WebAPI.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  import { type AxiosInstance, type AxiosRequestConfig } from 'axios';
2
- import { type WebConfig } from './types/config.js';
3
- import { type WebCancelOrderBody, type WebCancelOrderOutput } from './types/webapi/cancelOrder.js';
4
- import { type WebCreateOrderBody, type WebCreateOrderOutput } from './types/webapi/createOrder.js';
5
- import { type WebGetSpotBody, type WebGetSpotOutput } from './types/webapi/getSpot.js';
6
- import { type WebOrdersBody } from './types/webapi/orders.js';
7
- import { type WebServersOutput } from './types/webapi/servers.js';
8
- import { type WebSetSpotPriceBody, type WebSetSpotPriceOutput } from './types/webapi/setSpotPrice.js';
2
+ import type { WebConfig } from './types/config.js';
3
+ import type { WebCancelOrderBody, WebCancelOrderOutput } from './types/webapi/cancelOrder.js';
4
+ import type { WebCreateOrderBody, WebCreateOrderOutput } from './types/webapi/createOrder.js';
5
+ import type { WebGetSpotBody, WebGetSpotOutput } from './types/webapi/getSpot.js';
6
+ import type { WebOrdersBody } from './types/webapi/orders.js';
7
+ import type { WebServersOutput } from './types/webapi/servers.js';
8
+ import type { WebSetSpotPriceBody, WebSetSpotPriceOutput } from './types/webapi/setSpotPrice.js';
9
9
  export declare class WebAPI {
10
10
  readonly api: AxiosInstance;
11
11
  constructor(config: WebConfig);
package/build/WebAPI.js CHANGED
@@ -1,5 +1,4 @@
1
1
  import axios from 'axios';
2
- import { webStatusCodes } from './constants.js';
3
2
  import { UnknownError } from './errors.js';
4
3
  import { getErrorMessage } from './getErrorMessage.js';
5
4
  export class WebAPI {
@@ -18,7 +17,8 @@ export class WebAPI {
18
17
  return request;
19
18
  });
20
19
  this.api.interceptors.response.use((response) => {
21
- if (response.data.status === webStatusCodes['NORMAL']) {
20
+ const hasError = Boolean(response.data.error);
21
+ if (!hasError) {
22
22
  return response;
23
23
  }
24
24
  const errorMessage = getErrorMessage(response.data.status, response.data.error);
@@ -1,4 +1,3 @@
1
1
  export declare const GLOBAL_RATE_LIMIT = 1000;
2
2
  export declare const CREATE_ORDER_RATE_LIMIT = 5000;
3
3
  export declare const statusCodes: Record<string, number>;
4
- export declare const webStatusCodes: Record<string, string>;
@@ -9,6 +9,3 @@ export const statusCodes = {
9
9
  EXCEEDED: 5,
10
10
  ERROR: 6,
11
11
  };
12
- export const webStatusCodes = {
13
- NORMAL: 'ok',
14
- };
@@ -1,4 +1,4 @@
1
- import { type Output } from '../output.js';
1
+ import type { Output } from '../output.js';
2
2
  export interface CancelOrderBody {
3
3
  id: number;
4
4
  issue?: string;
@@ -1,5 +1,5 @@
1
- import { type Currency } from '../common.js';
2
- import { type Output } from '../output.js';
1
+ import type { Currency } from '../common.js';
2
+ import type { Output } from '../output.js';
3
3
  export interface CreateOrderCommon {
4
4
  currency: Currency;
5
5
  image: string;
@@ -1,5 +1,5 @@
1
- import { type Price, type Specs } from '../common.js';
2
- import { type Output } from '../output.js';
1
+ import type { Price, Specs } from '../common.js';
2
+ import type { Output } from '../output.js';
3
3
  export interface MarketplaceServer {
4
4
  id: number;
5
5
  owner: number;
@@ -1,5 +1,5 @@
1
- import { type Currency, type Specs } from '../common.js';
2
- import { type Output } from '../output.js';
1
+ import type { Currency, Specs } from '../common.js';
2
+ import type { Output } from '../output.js';
3
3
  export interface MyOrdersParams {
4
4
  return_completed?: boolean;
5
5
  }
@@ -1,5 +1,5 @@
1
- import { type Pricing, type Specs, type Visibility } from '../common.js';
2
- import { type Output } from '../output.js';
1
+ import type { Pricing, Specs, Visibility } from '../common.js';
2
+ import type { Output } from '../output.js';
3
3
  export interface MyServersServer {
4
4
  name: string;
5
5
  connected: boolean;
@@ -1,5 +1,5 @@
1
- import { type Pricing, type Specs, type Visibility } from '../common.js';
2
- import { type Output } from '../output.js';
1
+ import type { Pricing, Specs, Visibility } from '../common.js';
2
+ import type { Output } from '../output.js';
3
3
  export interface ServerConfigBody {
4
4
  server_name: string;
5
5
  }
@@ -1,4 +1,4 @@
1
- import { type Output } from '../output.js';
1
+ import type { Output } from '../output.js';
2
2
  export interface SetServerSettingsBody {
3
3
  name: string;
4
4
  availability: boolean;
@@ -1,4 +1,4 @@
1
- import { type Output } from '../output.js';
1
+ import type { Output } from '../output.js';
2
2
  export interface SetSpotPriceBody {
3
3
  order_id: number;
4
4
  desired_price: number;
@@ -1,5 +1,5 @@
1
- import { type Pricing, type Visibility } from '../common.js';
2
- import { type Output } from '../output.js';
1
+ import type { Pricing, Visibility } from '../common.js';
2
+ import type { Output } from '../output.js';
3
3
  export interface SpotMarketplaceParams {
4
4
  market: number;
5
5
  }
@@ -1,5 +1,5 @@
1
- import { type Currency } from '../common.js';
2
- import { type Output } from '../output.js';
1
+ import type { Currency } from '../common.js';
2
+ import type { Output } from '../output.js';
3
3
  export interface WalletsWallet {
4
4
  name: Currency;
5
5
  deposit: string;
@@ -1,4 +1,4 @@
1
- import { type CreateAxiosDefaults } from 'axios';
1
+ import type { CreateAxiosDefaults } from 'axios';
2
2
  export interface CommonConfig {
3
3
  axiosConfig?: CreateAxiosDefaults;
4
4
  }
@@ -1,4 +1,4 @@
1
- import { type WebOutput } from '../output.js';
1
+ import type { WebOutput } from '../output.js';
2
2
  export interface WebCancelOrderBody {
3
3
  id: number;
4
4
  rating: number;
@@ -1,5 +1,5 @@
1
- import { type Currency } from '../common.js';
2
- import { type WebOutput } from '../output.js';
1
+ import type { Currency } from '../common.js';
2
+ import type { WebOutput } from '../output.js';
3
3
  export interface WebCreateOrderCommon {
4
4
  currency: Currency;
5
5
  image: string;
@@ -1,5 +1,5 @@
1
- import { type Currency, type Pricing, type Visibility } from '../common.js';
2
- import { type WebOutput } from '../output.js';
1
+ import type { Currency, Pricing, Visibility } from '../common.js';
2
+ import type { WebOutput } from '../output.js';
3
3
  export interface WebGetSpotBody {
4
4
  id: number;
5
5
  }
@@ -1,5 +1,5 @@
1
- import { type Currency, type Price, type Specs } from '../common.js';
2
- import { type WebOutput } from '../output.js';
1
+ import type { Currency, Price, Specs } from '../common.js';
2
+ import type { WebOutput } from '../output.js';
3
3
  export interface WebOrdersBody {
4
4
  rc: boolean;
5
5
  }
@@ -1,5 +1,5 @@
1
- import { type Currency, type Price, type Specs } from '../common.js';
2
- import { type WebOutput } from '../output.js';
1
+ import type { Currency, Price, Specs } from '../common.js';
2
+ import type { WebOutput } from '../output.js';
3
3
  export interface WebServersServerRating {
4
4
  avg: number;
5
5
  cnt: number;
@@ -1,4 +1,4 @@
1
- import { type WebOutput } from '../output.js';
1
+ import type { WebOutput } from '../output.js';
2
2
  export interface WebSetSpotPriceBody {
3
3
  desired_price: number;
4
4
  order_id: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cloreai",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "CLORE.AI API client",
5
5
  "keywords": [
6
6
  "cloreai",
@@ -26,9 +26,7 @@
26
26
  "prepare": "husky",
27
27
  "start-playground": "node playground/main.js",
28
28
  "typecheck": "tsc --noEmit",
29
- "update-check": "npm-check-updates --peer",
30
- "update-latest": "npm-check-updates --peer --upgrade --target latest",
31
- "update-minor": "npm-check-updates --peer --upgrade --target minor"
29
+ "update-latest": "rimraf package-lock.json && npm-check-updates --peer --upgrade && npm install"
32
30
  },
33
31
  "dependencies": {
34
32
  "axios": "^1.7.2"
@@ -36,12 +34,12 @@
36
34
  "devDependencies": {
37
35
  "@tsconfig/strictest": "^2.0.5",
38
36
  "eslint": "^8.57.0",
39
- "eslint-config-vladpuz": "^0.7.0",
40
- "husky": "^9.0.11",
37
+ "eslint-config-vladpuz": "^0.8.0",
38
+ "husky": "^9.1.1",
41
39
  "npm-check-updates": "^16.14.20",
42
40
  "prettier": "^3.3.3",
43
- "prettier-config-vladpuz": "^0.4.0",
41
+ "prettier-config-vladpuz": "^0.5.0",
44
42
  "rimraf": "^6.0.1",
45
- "typescript": "^5.5.3"
43
+ "typescript": "^5.5.4"
46
44
  }
47
45
  }