cloreai 0.1.12 → 0.1.14
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/cloreai/CloreAI.d.ts +24 -24
- package/build/cloreai/CloreAI.js +55 -61
- package/build/cloreai/endpoints/cancelOrder.d.ts +4 -5
- package/build/cloreai/endpoints/createOrder.d.ts +4 -26
- package/build/cloreai/endpoints/marketplace.d.ts +4 -12
- package/build/cloreai/endpoints/myOrders.d.ts +5 -24
- package/build/cloreai/endpoints/myServers.d.ts +5 -5
- package/build/cloreai/endpoints/serverConfig.d.ts +8 -8
- package/build/cloreai/endpoints/setServerSettings.d.ts +3 -4
- package/build/cloreai/endpoints/setSpotPrice.d.ts +4 -17
- package/build/cloreai/endpoints/spotMarketplace.d.ts +5 -21
- package/build/cloreai/endpoints/wallets.d.ts +5 -5
- package/build/cloreai/index.d.ts +11 -11
- package/build/cloreai/index.js +0 -11
- package/build/cloreai/types.d.ts +2 -2
- package/build/common/constants.d.ts +7 -2
- package/build/common/constants.js +7 -2
- package/build/common/endpoints/cancelOrder.d.ts +3 -0
- package/build/common/endpoints/cancelOrder.js +2 -0
- package/build/common/endpoints/createOrder.d.ts +25 -0
- package/build/common/endpoints/marketplace.d.ts +19 -0
- package/build/common/endpoints/myOrders.d.ts +23 -0
- package/build/common/endpoints/setSpotPrice.d.ts +16 -0
- package/build/common/endpoints/setSpotPrice.js +2 -0
- package/build/common/endpoints/spotMarketplace.d.ts +19 -0
- package/build/common/errors.d.ts +2 -2
- package/build/common/errors.js +2 -2
- package/build/common/helpers.d.ts +6 -0
- package/build/common/helpers.js +25 -0
- package/build/common/index.d.ts +8 -3
- package/build/common/index.js +1 -3
- package/build/common/types.d.ts +57 -4
- package/build/webapi/WebAPI.d.ts +16 -16
- package/build/webapi/WebAPI.js +37 -43
- package/build/webapi/endpoints/cancelOrder.d.ts +4 -5
- package/build/webapi/endpoints/createOrder.d.ts +4 -27
- package/build/webapi/endpoints/marketplace.d.ts +10 -0
- package/build/webapi/endpoints/marketplace.js +1 -0
- package/build/webapi/endpoints/myOrders.d.ts +15 -0
- package/build/webapi/endpoints/myOrders.js +1 -0
- package/build/webapi/endpoints/setSpotPrice.d.ts +4 -17
- package/build/webapi/endpoints/spotMarketplace.d.ts +8 -0
- package/build/webapi/endpoints/spotMarketplace.js +1 -0
- package/build/webapi/index.d.ts +7 -7
- package/build/webapi/index.js +0 -7
- package/build/webapi/types.d.ts +2 -2
- package/package.json +15 -15
- package/build/common/api.d.ts +0 -30
- package/build/common/getErrorMessage.d.ts +0 -1
- package/build/common/getErrorMessage.js +0 -11
- package/build/webapi/endpoints/getSpot.d.ts +0 -26
- package/build/webapi/endpoints/orders.d.ts +0 -34
- package/build/webapi/endpoints/servers.d.ts +0 -25
- /package/build/common/{api.js → endpoints/createOrder.js} +0 -0
- /package/build/{webapi/endpoints/getSpot.js → common/endpoints/marketplace.js} +0 -0
- /package/build/{webapi/endpoints/orders.js → common/endpoints/myOrders.js} +0 -0
- /package/build/{webapi/endpoints/servers.js → common/endpoints/spotMarketplace.js} +0 -0
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
import { type AxiosInstance, type AxiosRequestConfig } from 'axios';
|
|
2
|
-
import PQueue
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
5
|
-
import type {
|
|
6
|
-
import type {
|
|
7
|
-
import type {
|
|
8
|
-
import type {
|
|
9
|
-
import type {
|
|
10
|
-
import type {
|
|
11
|
-
import type {
|
|
12
|
-
import type {
|
|
2
|
+
import PQueue from 'p-queue';
|
|
3
|
+
import type { CancelOrderRequestData, CancelOrderResponseData } from './endpoints/cancelOrder.js';
|
|
4
|
+
import type { CreateOrderRequestData, CreateOrderResponseData } from './endpoints/createOrder.js';
|
|
5
|
+
import type { MarketplaceResponseData } from './endpoints/marketplace.js';
|
|
6
|
+
import type { MyOrdersRequestParams, MyOrdersResponseData } from './endpoints/myOrders.js';
|
|
7
|
+
import type { MyServersResponseData } from './endpoints/myServers.js';
|
|
8
|
+
import type { ServerConfigRequestData, ServerConfigResponseData } from './endpoints/serverConfig.js';
|
|
9
|
+
import type { SetServerSettingsRequestData, SetServerSettingsResponseData } from './endpoints/setServerSettings.js';
|
|
10
|
+
import type { SetSpotPriceRequestData, SetSpotPriceResponseData } from './endpoints/setSpotPrice.js';
|
|
11
|
+
import type { SpotMarketplaceRequestParams, SpotMarketplaceResponseData } from './endpoints/spotMarketplace.js';
|
|
12
|
+
import type { WalletsResponseData } from './endpoints/wallets.js';
|
|
13
13
|
import type { Config } from './types.js';
|
|
14
14
|
declare class CloreAI {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
axios: AxiosInstance;
|
|
16
|
+
rateLimitQueue: PQueue;
|
|
17
|
+
rateLimitQueueCreateOrder: PQueue;
|
|
18
18
|
constructor(config: Config);
|
|
19
|
-
wallets(
|
|
20
|
-
myServers(
|
|
21
|
-
serverConfig(
|
|
22
|
-
marketplace(
|
|
23
|
-
myOrders(params
|
|
24
|
-
spotMarketplace(params:
|
|
25
|
-
setServerSettings(
|
|
26
|
-
setSpotPrice(
|
|
27
|
-
cancelOrder(
|
|
28
|
-
createOrder(
|
|
19
|
+
wallets(config?: AxiosRequestConfig): Promise<WalletsResponseData>;
|
|
20
|
+
myServers(config?: AxiosRequestConfig): Promise<MyServersResponseData>;
|
|
21
|
+
serverConfig(data: ServerConfigRequestData, config?: AxiosRequestConfig): Promise<ServerConfigResponseData>;
|
|
22
|
+
marketplace(config?: AxiosRequestConfig): Promise<MarketplaceResponseData>;
|
|
23
|
+
myOrders(params: MyOrdersRequestParams, config?: AxiosRequestConfig): Promise<MyOrdersResponseData>;
|
|
24
|
+
spotMarketplace(params: SpotMarketplaceRequestParams, config?: AxiosRequestConfig): Promise<SpotMarketplaceResponseData>;
|
|
25
|
+
setServerSettings(data: SetServerSettingsRequestData, config?: AxiosRequestConfig): Promise<SetServerSettingsResponseData>;
|
|
26
|
+
setSpotPrice(data: SetSpotPriceRequestData, config?: AxiosRequestConfig): Promise<SetSpotPriceResponseData>;
|
|
27
|
+
cancelOrder(data: CancelOrderRequestData, config?: AxiosRequestConfig): Promise<CancelOrderResponseData>;
|
|
28
|
+
createOrder(data: CreateOrderRequestData, config?: AxiosRequestConfig): Promise<CreateOrderResponseData>;
|
|
29
29
|
}
|
|
30
30
|
export default CloreAI;
|
package/build/cloreai/CloreAI.js
CHANGED
|
@@ -1,28 +1,32 @@
|
|
|
1
1
|
import axios from 'axios';
|
|
2
2
|
import PQueue from 'p-queue';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { priorityLevels, RATE_LIMIT, RATE_LIMIT_CREATE_ORDER, statusCodes } from '../common/constants.js';
|
|
4
|
+
import { DatabaseError, ExceededError, InvalidApiTokenError, InvalidEndpointError, InvalidInputDataError, OtherError, UnknownError } from '../common/errors.js';
|
|
5
|
+
import { getErrorMessage, getQueueOptions } from '../common/helpers.js';
|
|
5
6
|
class CloreAI {
|
|
6
7
|
axios;
|
|
7
|
-
rateLimitQueue
|
|
8
|
-
|
|
9
|
-
intervalCap: 1,
|
|
10
|
-
concurrency: 1,
|
|
11
|
-
});
|
|
12
|
-
rateLimitCreateOrderQueue = new PQueue({
|
|
13
|
-
interval: RATE_LIMIT_CREATE_ORDER,
|
|
14
|
-
intervalCap: 1,
|
|
15
|
-
concurrency: 1,
|
|
16
|
-
});
|
|
8
|
+
rateLimitQueue;
|
|
9
|
+
rateLimitQueueCreateOrder;
|
|
17
10
|
constructor(config) {
|
|
18
|
-
|
|
11
|
+
this.rateLimitQueue = new PQueue({
|
|
12
|
+
interval: RATE_LIMIT,
|
|
13
|
+
intervalCap: 1,
|
|
14
|
+
concurrency: 1,
|
|
15
|
+
...config.rateLimitQueueOptions,
|
|
16
|
+
});
|
|
17
|
+
this.rateLimitQueueCreateOrder = new PQueue({
|
|
18
|
+
interval: RATE_LIMIT_CREATE_ORDER,
|
|
19
|
+
intervalCap: 1,
|
|
20
|
+
concurrency: 1,
|
|
21
|
+
...config.rateLimitQueueOptionsCreateOrder,
|
|
22
|
+
});
|
|
19
23
|
this.axios = axios.create({
|
|
20
|
-
...axiosConfig,
|
|
24
|
+
...config.axiosConfig,
|
|
21
25
|
baseURL: 'https://api.clore.ai/v1',
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
+
});
|
|
27
|
+
this.axios.interceptors.request.use((request) => {
|
|
28
|
+
request.headers.set('auth', config.apiKey);
|
|
29
|
+
return request;
|
|
26
30
|
});
|
|
27
31
|
this.axios.interceptors.response.use((response) => {
|
|
28
32
|
if (response.data.code === statusCodes.NORMAL) {
|
|
@@ -47,81 +51,71 @@ class CloreAI {
|
|
|
47
51
|
throw new InvalidEndpointError(...axiosErrorParameters);
|
|
48
52
|
case statusCodes.EXCEEDED:
|
|
49
53
|
throw new ExceededError(...axiosErrorParameters);
|
|
50
|
-
case statusCodes.
|
|
51
|
-
throw new
|
|
54
|
+
case statusCodes.OTHER:
|
|
55
|
+
throw new OtherError(...axiosErrorParameters);
|
|
52
56
|
default:
|
|
53
57
|
throw new UnknownError(...axiosErrorParameters);
|
|
54
58
|
}
|
|
55
59
|
});
|
|
56
60
|
}
|
|
57
|
-
async wallets(
|
|
61
|
+
async wallets(config) {
|
|
58
62
|
const response = await this.rateLimitQueue.add(async () => {
|
|
59
|
-
return await this.axios.get('/wallets',
|
|
60
|
-
},
|
|
63
|
+
return await this.axios.get('/wallets', config);
|
|
64
|
+
}, getQueueOptions(priorityLevels.NORMAL, config));
|
|
61
65
|
return response.data;
|
|
62
66
|
}
|
|
63
|
-
async myServers(
|
|
67
|
+
async myServers(config) {
|
|
64
68
|
const response = await this.rateLimitQueue.add(async () => {
|
|
65
|
-
return await this.axios.get('/my_servers',
|
|
66
|
-
},
|
|
69
|
+
return await this.axios.get('/my_servers', config);
|
|
70
|
+
}, getQueueOptions(priorityLevels.NORMAL, config));
|
|
67
71
|
return response.data;
|
|
68
72
|
}
|
|
69
|
-
async serverConfig(
|
|
73
|
+
async serverConfig(data, config) {
|
|
70
74
|
const response = await this.rateLimitQueue.add(async () => {
|
|
71
|
-
return await this.axios.get('/server_config', { ...
|
|
72
|
-
},
|
|
75
|
+
return await this.axios.get('/server_config', { ...config, data });
|
|
76
|
+
}, getQueueOptions(priorityLevels.NORMAL, config));
|
|
73
77
|
return response.data;
|
|
74
78
|
}
|
|
75
|
-
async marketplace(
|
|
79
|
+
async marketplace(config) {
|
|
76
80
|
const response = await this.rateLimitQueue.add(async () => {
|
|
77
|
-
return await this.axios.get('/marketplace',
|
|
78
|
-
},
|
|
81
|
+
return await this.axios.get('/marketplace', config);
|
|
82
|
+
}, getQueueOptions(priorityLevels.NORMAL, config));
|
|
79
83
|
return response.data;
|
|
80
84
|
}
|
|
81
|
-
async myOrders(params,
|
|
85
|
+
async myOrders(params, config) {
|
|
82
86
|
const response = await this.rateLimitQueue.add(async () => {
|
|
83
|
-
return await this.axios.get('/my_orders', { ...
|
|
84
|
-
},
|
|
87
|
+
return await this.axios.get('/my_orders', { ...config, params });
|
|
88
|
+
}, getQueueOptions(priorityLevels.NORMAL, config));
|
|
85
89
|
return response.data;
|
|
86
90
|
}
|
|
87
|
-
async spotMarketplace(params,
|
|
91
|
+
async spotMarketplace(params, config) {
|
|
88
92
|
const response = await this.rateLimitQueue.add(async () => {
|
|
89
|
-
return await this.axios.get('/spot_marketplace', { ...
|
|
90
|
-
},
|
|
93
|
+
return await this.axios.get('/spot_marketplace', { ...config, params });
|
|
94
|
+
}, getQueueOptions(priorityLevels.NORMAL, config));
|
|
91
95
|
return response.data;
|
|
92
96
|
}
|
|
93
|
-
async setServerSettings(
|
|
97
|
+
async setServerSettings(data, config) {
|
|
94
98
|
const response = await this.rateLimitQueue.add(async () => {
|
|
95
|
-
return await this.axios.post('/set_server_settings',
|
|
96
|
-
},
|
|
99
|
+
return await this.axios.post('/set_server_settings', data, config);
|
|
100
|
+
}, getQueueOptions(priorityLevels.HIGH, config));
|
|
97
101
|
return response.data;
|
|
98
102
|
}
|
|
99
|
-
async setSpotPrice(
|
|
103
|
+
async setSpotPrice(data, config) {
|
|
100
104
|
const response = await this.rateLimitQueue.add(async () => {
|
|
101
|
-
return await this.axios.post('/set_spot_price',
|
|
102
|
-
},
|
|
105
|
+
return await this.axios.post('/set_spot_price', data, config);
|
|
106
|
+
}, getQueueOptions(priorityLevels.HIGH, config));
|
|
103
107
|
return response.data;
|
|
104
108
|
}
|
|
105
|
-
async cancelOrder(
|
|
109
|
+
async cancelOrder(data, config) {
|
|
106
110
|
const response = await this.rateLimitQueue.add(async () => {
|
|
107
|
-
return await this.axios.post('/cancel_order',
|
|
108
|
-
},
|
|
111
|
+
return await this.axios.post('/cancel_order', data, config);
|
|
112
|
+
}, getQueueOptions(priorityLevels.HIGH, config));
|
|
109
113
|
return response.data;
|
|
110
114
|
}
|
|
111
|
-
async createOrder(
|
|
112
|
-
const response = await this.
|
|
113
|
-
this.
|
|
114
|
-
|
|
115
|
-
return await this.rateLimitCreateOrderQueue.add(async () => {
|
|
116
|
-
return await this.axios.post('/create_order', body, axiosConfig);
|
|
117
|
-
}, { ...queueOptions, throwOnTimeout: true });
|
|
118
|
-
}
|
|
119
|
-
finally {
|
|
120
|
-
setTimeout(() => {
|
|
121
|
-
this.rateLimitQueue.start();
|
|
122
|
-
}, RATE_LIMIT);
|
|
123
|
-
}
|
|
124
|
-
}, { ...queueOptions, throwOnTimeout: true });
|
|
115
|
+
async createOrder(data, config) {
|
|
116
|
+
const response = await this.rateLimitQueueCreateOrder.add(async () => {
|
|
117
|
+
return await this.axios.post('/create_order', data, config);
|
|
118
|
+
}, getQueueOptions(priorityLevels.HIGHEST, config));
|
|
125
119
|
return response.data;
|
|
126
120
|
}
|
|
127
121
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import type { CancelOrderRequestDataCommon } from '../../common/endpoints/cancelOrder.js';
|
|
2
|
+
import type { ResponseData } from '../types.js';
|
|
3
|
+
export interface CancelOrderRequestData extends CancelOrderRequestDataCommon {
|
|
4
4
|
issue?: string;
|
|
5
5
|
}
|
|
6
|
-
export
|
|
7
|
-
}
|
|
6
|
+
export type CancelOrderResponseData = ResponseData;
|
|
@@ -1,26 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
currency: Currency;
|
|
6
|
-
image: string;
|
|
7
|
-
renting_server: number;
|
|
8
|
-
ports?: Record<string, string>;
|
|
9
|
-
env?: Record<string, string>;
|
|
10
|
-
jupyter_token?: string;
|
|
11
|
-
ssh_key?: string;
|
|
12
|
-
ssh_password?: string;
|
|
13
|
-
command?: string;
|
|
14
|
-
required_price?: number;
|
|
15
|
-
autossh_entrypoint?: boolean;
|
|
16
|
-
}
|
|
17
|
-
export interface CreateOrderOnDemand extends CreateOrderCommon {
|
|
18
|
-
type: 'on-demand';
|
|
19
|
-
}
|
|
20
|
-
export interface CreateOrderSpot extends CreateOrderCommon {
|
|
21
|
-
type: 'spot';
|
|
22
|
-
spotprice: number;
|
|
23
|
-
}
|
|
24
|
-
export type CreateOrderBody = CreateOrderOnDemand | CreateOrderSpot;
|
|
25
|
-
export interface CreateOrderOutput extends Output {
|
|
26
|
-
}
|
|
1
|
+
import type { CreateOrderRequestDataCommon } from '../../common/endpoints/createOrder.js';
|
|
2
|
+
import type { ResponseData } from '../types.js';
|
|
3
|
+
export type CreateOrderRequestData = CreateOrderRequestDataCommon;
|
|
4
|
+
export type CreateOrderResponseData = ResponseData;
|
|
@@ -1,14 +1,6 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
export interface
|
|
4
|
-
|
|
5
|
-
owner: number;
|
|
6
|
-
mrl: number;
|
|
7
|
-
price: Price;
|
|
8
|
-
rented: boolean;
|
|
9
|
-
specs: Specs;
|
|
10
|
-
}
|
|
11
|
-
export interface MarketplaceOutput extends Output {
|
|
12
|
-
servers: MarketplaceServer[];
|
|
1
|
+
import type { MarketplaceResponseDataServerCommon } from '../../common/endpoints/marketplace.js';
|
|
2
|
+
import type { ResponseData } from '../types.js';
|
|
3
|
+
export interface MarketplaceResponseData extends ResponseData {
|
|
4
|
+
servers: MarketplaceResponseDataServerCommon[];
|
|
13
5
|
my_servers: number[];
|
|
14
6
|
}
|
|
@@ -1,28 +1,9 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
export interface
|
|
1
|
+
import type { MyOrdersResponseDataOrderCommon } from '../../common/endpoints/myOrders.js';
|
|
2
|
+
import type { ResponseData } from '../types.js';
|
|
3
|
+
export interface MyOrdersRequestParams {
|
|
4
4
|
return_completed?: boolean;
|
|
5
5
|
}
|
|
6
|
-
export interface
|
|
7
|
-
|
|
8
|
-
fee: number;
|
|
9
|
-
creation_fee: number;
|
|
10
|
-
price: number;
|
|
11
|
-
mrl: number;
|
|
12
|
-
image: string;
|
|
13
|
-
currency: Currency;
|
|
14
|
-
spend: number;
|
|
15
|
-
ct: number;
|
|
16
|
-
p: number;
|
|
17
|
-
specs: Specs;
|
|
18
|
-
si: number;
|
|
19
|
-
pub_cluster: string[];
|
|
20
|
-
tcp_ports: string[];
|
|
21
|
-
http_port: string;
|
|
22
|
-
spot: boolean;
|
|
23
|
-
expired: boolean;
|
|
24
|
-
}
|
|
25
|
-
export interface MyOrdersOutput extends Output {
|
|
26
|
-
orders: MyOrdersOrder[];
|
|
6
|
+
export interface MyOrdersResponseData extends ResponseData {
|
|
7
|
+
orders: MyOrdersResponseDataOrderCommon[];
|
|
27
8
|
limit: number;
|
|
28
9
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Pricing, Specs, Visibility } from '../../common/
|
|
2
|
-
import type {
|
|
3
|
-
export interface
|
|
1
|
+
import type { Pricing, Specs, Visibility } from '../../common/types.js';
|
|
2
|
+
import type { ResponseData } from '../types.js';
|
|
3
|
+
export interface MyServersResponseDataServer {
|
|
4
4
|
name: string;
|
|
5
5
|
connected: boolean;
|
|
6
6
|
visibility: Visibility;
|
|
@@ -10,7 +10,7 @@ export interface MyServersServer {
|
|
|
10
10
|
init_token: string;
|
|
11
11
|
specs: Specs;
|
|
12
12
|
}
|
|
13
|
-
export interface
|
|
14
|
-
servers:
|
|
13
|
+
export interface MyServersResponseData extends ResponseData {
|
|
14
|
+
servers: MyServersResponseDataServer[];
|
|
15
15
|
limit: number;
|
|
16
16
|
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import type { Pricing, Specs, Visibility } from '../../common/
|
|
2
|
-
import type {
|
|
3
|
-
export interface
|
|
1
|
+
import type { Pricing, Specs, Visibility } from '../../common/types.js';
|
|
2
|
+
import type { ResponseData } from '../types.js';
|
|
3
|
+
export interface ServerConfigRequestData {
|
|
4
4
|
server_name: string;
|
|
5
5
|
}
|
|
6
|
-
export interface
|
|
6
|
+
export interface ServerConfigResponseDataConfigBackgroundJob {
|
|
7
7
|
times_updated: number;
|
|
8
8
|
image: string;
|
|
9
9
|
command: string;
|
|
10
10
|
env: Record<string, string>;
|
|
11
11
|
}
|
|
12
|
-
export interface
|
|
12
|
+
export interface ServerConfigResponseDataConfig {
|
|
13
13
|
name: string;
|
|
14
14
|
connected: boolean;
|
|
15
15
|
visibility: Visibility;
|
|
@@ -21,9 +21,9 @@ export interface ServerConfigConfig {
|
|
|
21
21
|
id: number;
|
|
22
22
|
rental_status: number;
|
|
23
23
|
specs: Specs;
|
|
24
|
-
background_job:
|
|
24
|
+
background_job: ServerConfigResponseDataConfigBackgroundJob;
|
|
25
25
|
}
|
|
26
|
-
export interface
|
|
27
|
-
config:
|
|
26
|
+
export interface ServerConfigResponseData extends ResponseData {
|
|
27
|
+
config: ServerConfigResponseDataConfig;
|
|
28
28
|
creation_completed: boolean;
|
|
29
29
|
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export interface
|
|
1
|
+
import type { ResponseData } from '../types.js';
|
|
2
|
+
export interface SetServerSettingsRequestData {
|
|
3
3
|
name: string;
|
|
4
4
|
availability: boolean;
|
|
5
5
|
mrl: number;
|
|
6
6
|
on_demand: number;
|
|
7
7
|
spot: number;
|
|
8
8
|
}
|
|
9
|
-
export
|
|
10
|
-
}
|
|
9
|
+
export type SetServerSettingsResponseData = ResponseData;
|
|
@@ -1,17 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
export interface SetSpotPriceMaxStep extends Output {
|
|
7
|
-
error: 'exceeded_max_step';
|
|
8
|
-
max_step: number;
|
|
9
|
-
}
|
|
10
|
-
export interface SetSpotPriceTimeToLowering extends Output {
|
|
11
|
-
error: 'can_lower_every_600_seconds';
|
|
12
|
-
time_to_lowering: number;
|
|
13
|
-
}
|
|
14
|
-
export interface SetSpotPriceSuccess extends Output {
|
|
15
|
-
error: undefined;
|
|
16
|
-
}
|
|
17
|
-
export type SetSpotPriceOutput = SetSpotPriceMaxStep | SetSpotPriceTimeToLowering | SetSpotPriceSuccess;
|
|
1
|
+
import type { SetSpotPriceRequestDataCommon, SetSpotPriceResponseDataCommon } from '../../common/endpoints/setSpotPrice.js';
|
|
2
|
+
import type { ResponseData } from '../types.js';
|
|
3
|
+
export type SetSpotPriceRequestData = SetSpotPriceRequestDataCommon;
|
|
4
|
+
export type SetSpotPriceResponseData = SetSpotPriceResponseDataCommon & ResponseData;
|
|
@@ -1,25 +1,9 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
export interface
|
|
1
|
+
import type { SpotMarketplaceResponseDataCommon } from '../../common/endpoints/spotMarketplace.js';
|
|
2
|
+
import type { ResponseData } from '../types.js';
|
|
3
|
+
export interface SpotMarketplaceRequestParams {
|
|
4
4
|
market: number;
|
|
5
5
|
}
|
|
6
|
-
export interface
|
|
7
|
-
|
|
8
|
-
bid: number;
|
|
9
|
-
active: boolean;
|
|
10
|
-
my: boolean;
|
|
11
|
-
}
|
|
12
|
-
export interface SpotMarketplaceMarketServer {
|
|
13
|
-
min_pricing: Pricing;
|
|
14
|
-
mrl: number;
|
|
15
|
-
visibility: Visibility;
|
|
16
|
-
online: boolean;
|
|
17
|
-
}
|
|
18
|
-
export interface SpotMarketplaceMarket {
|
|
19
|
-
offers: SpotMarketplaceMarketOffer[];
|
|
20
|
-
server: SpotMarketplaceMarketServer;
|
|
21
|
-
}
|
|
22
|
-
export interface SpotMarketplaceOutput extends Output {
|
|
23
|
-
market: SpotMarketplaceMarket;
|
|
6
|
+
export interface SpotMarketplaceResponseData extends ResponseData {
|
|
7
|
+
market: SpotMarketplaceResponseDataCommon;
|
|
24
8
|
exists: boolean;
|
|
25
9
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type { Currency } from '../../common/
|
|
2
|
-
import type {
|
|
3
|
-
export interface
|
|
1
|
+
import type { Currency } from '../../common/types.js';
|
|
2
|
+
import type { ResponseData } from '../types.js';
|
|
3
|
+
export interface WalletsResponseDataWallet {
|
|
4
4
|
name: Currency;
|
|
5
5
|
deposit: string;
|
|
6
6
|
balance: number;
|
|
7
7
|
withdrawal_fee: number;
|
|
8
8
|
}
|
|
9
|
-
export interface
|
|
10
|
-
wallets:
|
|
9
|
+
export interface WalletsResponseData extends ResponseData {
|
|
10
|
+
wallets: WalletsResponseDataWallet[];
|
|
11
11
|
}
|
package/build/cloreai/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import CloreAI from './CloreAI.js';
|
|
2
|
-
export * from './endpoints/cancelOrder.js';
|
|
3
|
-
export * from './endpoints/createOrder.js';
|
|
4
|
-
export * from './endpoints/marketplace.js';
|
|
5
|
-
export * from './endpoints/myOrders.js';
|
|
6
|
-
export * from './endpoints/myServers.js';
|
|
7
|
-
export * from './endpoints/serverConfig.js';
|
|
8
|
-
export * from './endpoints/setServerSettings.js';
|
|
9
|
-
export * from './endpoints/setSpotPrice.js';
|
|
10
|
-
export * from './endpoints/spotMarketplace.js';
|
|
11
|
-
export * from './endpoints/wallets.js';
|
|
12
|
-
export * from './types.js';
|
|
2
|
+
export type * from './endpoints/cancelOrder.js';
|
|
3
|
+
export type * from './endpoints/createOrder.js';
|
|
4
|
+
export type * from './endpoints/marketplace.js';
|
|
5
|
+
export type * from './endpoints/myOrders.js';
|
|
6
|
+
export type * from './endpoints/myServers.js';
|
|
7
|
+
export type * from './endpoints/serverConfig.js';
|
|
8
|
+
export type * from './endpoints/setServerSettings.js';
|
|
9
|
+
export type * from './endpoints/setSpotPrice.js';
|
|
10
|
+
export type * from './endpoints/spotMarketplace.js';
|
|
11
|
+
export type * from './endpoints/wallets.js';
|
|
12
|
+
export type * from './types.js';
|
|
13
13
|
export default CloreAI;
|
package/build/cloreai/index.js
CHANGED
|
@@ -1,13 +1,2 @@
|
|
|
1
1
|
import CloreAI from './CloreAI.js';
|
|
2
|
-
export * from './endpoints/cancelOrder.js';
|
|
3
|
-
export * from './endpoints/createOrder.js';
|
|
4
|
-
export * from './endpoints/marketplace.js';
|
|
5
|
-
export * from './endpoints/myOrders.js';
|
|
6
|
-
export * from './endpoints/myServers.js';
|
|
7
|
-
export * from './endpoints/serverConfig.js';
|
|
8
|
-
export * from './endpoints/setServerSettings.js';
|
|
9
|
-
export * from './endpoints/setSpotPrice.js';
|
|
10
|
-
export * from './endpoints/spotMarketplace.js';
|
|
11
|
-
export * from './endpoints/wallets.js';
|
|
12
|
-
export * from './types.js';
|
|
13
2
|
export default CloreAI;
|
package/build/cloreai/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { CommonConfig,
|
|
1
|
+
import type { CommonConfig, CommonResponseData } from '../common/types.js';
|
|
2
2
|
export interface Config extends CommonConfig {
|
|
3
3
|
apiKey: string;
|
|
4
4
|
}
|
|
5
|
-
export interface
|
|
5
|
+
export interface ResponseData extends CommonResponseData {
|
|
6
6
|
code: number;
|
|
7
7
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const RATE_LIMIT =
|
|
1
|
+
export declare const RATE_LIMIT = 1800;
|
|
2
2
|
export declare const RATE_LIMIT_CREATE_ORDER = 5000;
|
|
3
3
|
export declare const statusCodes: {
|
|
4
4
|
NORMAL: number;
|
|
@@ -7,5 +7,10 @@ export declare const statusCodes: {
|
|
|
7
7
|
INVALID_API_TOKEN: number;
|
|
8
8
|
INVALID_ENDPOINT: number;
|
|
9
9
|
EXCEEDED: number;
|
|
10
|
-
|
|
10
|
+
OTHER: number;
|
|
11
|
+
};
|
|
12
|
+
export declare const priorityLevels: {
|
|
13
|
+
NORMAL: number;
|
|
14
|
+
HIGH: number;
|
|
15
|
+
HIGHEST: number;
|
|
11
16
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const RATE_LIMIT =
|
|
1
|
+
export const RATE_LIMIT = 1_800;
|
|
2
2
|
export const RATE_LIMIT_CREATE_ORDER = 5_000;
|
|
3
3
|
export const statusCodes = {
|
|
4
4
|
NORMAL: 0,
|
|
@@ -7,5 +7,10 @@ export const statusCodes = {
|
|
|
7
7
|
INVALID_API_TOKEN: 3,
|
|
8
8
|
INVALID_ENDPOINT: 4,
|
|
9
9
|
EXCEEDED: 5,
|
|
10
|
-
|
|
10
|
+
OTHER: 6,
|
|
11
|
+
};
|
|
12
|
+
export const priorityLevels = {
|
|
13
|
+
NORMAL: 0,
|
|
14
|
+
HIGH: 1,
|
|
15
|
+
HIGHEST: 2,
|
|
11
16
|
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Currency, OrderType } from '../types.js';
|
|
2
|
+
export interface CreateOrderRequestDataBase {
|
|
3
|
+
type: OrderType;
|
|
4
|
+
currency: Currency;
|
|
5
|
+
image: string;
|
|
6
|
+
renting_server: number;
|
|
7
|
+
ports?: Record<string, string>;
|
|
8
|
+
env?: Record<string, string>;
|
|
9
|
+
jupyter_token?: string;
|
|
10
|
+
ssh_key?: string;
|
|
11
|
+
ssh_password?: string;
|
|
12
|
+
command?: string;
|
|
13
|
+
required_price?: number;
|
|
14
|
+
autossh_entrypoint?: boolean;
|
|
15
|
+
remember_password?: boolean;
|
|
16
|
+
dockerhub_auth?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface CreateOrderRequestDataOnDemand extends CreateOrderRequestDataBase {
|
|
19
|
+
type: 'on-demand';
|
|
20
|
+
}
|
|
21
|
+
export interface CreateOrderRequestDataSpot extends CreateOrderRequestDataBase {
|
|
22
|
+
type: 'spot';
|
|
23
|
+
spotprice: number;
|
|
24
|
+
}
|
|
25
|
+
export type CreateOrderRequestDataCommon = CreateOrderRequestDataOnDemand | CreateOrderRequestDataSpot;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Currency, Price, Specs } from '../types.js';
|
|
2
|
+
export interface MarketplaceResponseDataServerRatingCommon {
|
|
3
|
+
avg: number;
|
|
4
|
+
cnt: number;
|
|
5
|
+
}
|
|
6
|
+
export interface MarketplaceResponseDataServerCommon {
|
|
7
|
+
allowed_coins: Currency[];
|
|
8
|
+
cuda_version: string;
|
|
9
|
+
gpu_array: string[];
|
|
10
|
+
id: number;
|
|
11
|
+
mrl: number;
|
|
12
|
+
oc: boolean;
|
|
13
|
+
owner: number;
|
|
14
|
+
price: Price;
|
|
15
|
+
rating: MarketplaceResponseDataServerRatingCommon;
|
|
16
|
+
reliability: number;
|
|
17
|
+
rented: boolean;
|
|
18
|
+
specs: Specs;
|
|
19
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Currency, Specs } from '../../common/types.js';
|
|
2
|
+
export interface MyOrdersResponseDataOrderCommon {
|
|
3
|
+
auto_login: string;
|
|
4
|
+
id: number;
|
|
5
|
+
fee: number;
|
|
6
|
+
creation_fee: number;
|
|
7
|
+
price: number;
|
|
8
|
+
mrl: number;
|
|
9
|
+
online: boolean;
|
|
10
|
+
image: string;
|
|
11
|
+
mon_container: number;
|
|
12
|
+
currency: Currency;
|
|
13
|
+
spend: number;
|
|
14
|
+
ct: number;
|
|
15
|
+
p: number;
|
|
16
|
+
specs: Specs;
|
|
17
|
+
si: number;
|
|
18
|
+
spot: boolean;
|
|
19
|
+
expired: boolean;
|
|
20
|
+
pub_cluster: string[];
|
|
21
|
+
tcp_ports: string[];
|
|
22
|
+
http_port: string;
|
|
23
|
+
}
|