cloreai 0.1.18 → 1.0.0
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/README.md +286 -0
- package/build/{cloreai/CloreAI.d.ts → CloreAI.d.ts} +7 -11
- package/build/{cloreai/CloreAI.js → CloreAI.js} +29 -46
- package/build/Gigaspot.d.ts +17 -0
- package/build/Gigaspot.js +46 -0
- package/build/constants.d.ts +7 -0
- package/build/constants.js +7 -0
- package/build/endpoints/cancelOrder.d.ts +6 -0
- package/build/{cloreai/endpoints → endpoints}/cancelOrders.d.ts +1 -1
- package/build/{cloreai/endpoints → endpoints}/createGigaspotOrders.d.ts +1 -2
- package/build/{common/endpoints → endpoints}/createOrder.d.ts +3 -2
- package/build/{cloreai/endpoints → endpoints}/getGigaspot.d.ts +1 -2
- package/build/endpoints/marketplace.d.ts +24 -0
- package/build/{common/endpoints → endpoints}/myOrders.d.ts +15 -8
- package/build/{cloreai/endpoints → endpoints}/myServers.d.ts +1 -2
- package/build/endpoints/pohBalance.d.ts +31 -0
- package/build/{cloreai/endpoints → endpoints}/serverConfig.d.ts +1 -2
- package/build/endpoints/setServerSettings.d.ts +11 -0
- package/build/endpoints/setSpotPrice.d.ts +17 -0
- package/build/endpoints/spotMarketplace.d.ts +26 -0
- package/build/{cloreai/endpoints → endpoints}/wallets.d.ts +1 -2
- package/build/errors.d.ts +22 -0
- package/build/{common/constants.d.ts → helpers.d.ts} +5 -2
- package/build/{common/helpers.js → helpers.js} +15 -11
- package/build/index.d.ts +19 -3
- package/build/index.js +3 -3
- package/build/{common/types.d.ts → types.d.ts} +24 -14
- package/package.json +11 -26
- package/build/cloreai/endpoints/cancelOrder.d.ts +0 -6
- package/build/cloreai/endpoints/createOrder.d.ts +0 -4
- package/build/cloreai/endpoints/marketplace.d.ts +0 -6
- package/build/cloreai/endpoints/myOrders.d.ts +0 -9
- package/build/cloreai/endpoints/setServerSettings.d.ts +0 -9
- package/build/cloreai/endpoints/setSpotPrice.d.ts +0 -4
- package/build/cloreai/endpoints/spotMarketplace.d.ts +0 -9
- package/build/cloreai/index.d.ts +0 -17
- package/build/cloreai/index.js +0 -2
- package/build/cloreai/types.d.ts +0 -7
- package/build/common/constants.js +0 -16
- package/build/common/endpoints/cancelOrder.d.ts +0 -3
- package/build/common/endpoints/cancelOrder.js +0 -2
- package/build/common/endpoints/createOrder.js +0 -1
- package/build/common/endpoints/marketplace.d.ts +0 -19
- package/build/common/endpoints/marketplace.js +0 -1
- package/build/common/endpoints/myOrders.js +0 -1
- package/build/common/endpoints/setSpotPrice.d.ts +0 -16
- package/build/common/endpoints/spotMarketplace.d.ts +0 -19
- package/build/common/endpoints/spotMarketplace.js +0 -1
- package/build/common/errors.d.ts +0 -23
- package/build/common/helpers.d.ts +0 -6
- package/build/common/index.d.ts +0 -10
- package/build/common/index.js +0 -3
- package/build/common/types.js +0 -1
- package/build/webapi/WebAPI.d.ts +0 -22
- package/build/webapi/WebAPI.js +0 -80
- package/build/webapi/endpoints/cancelOrder.d.ts +0 -6
- package/build/webapi/endpoints/cancelOrder.js +0 -1
- package/build/webapi/endpoints/createOrder.d.ts +0 -4
- package/build/webapi/endpoints/createOrder.js +0 -1
- package/build/webapi/endpoints/marketplace.d.ts +0 -10
- package/build/webapi/endpoints/marketplace.js +0 -1
- package/build/webapi/endpoints/myOrders.d.ts +0 -15
- package/build/webapi/endpoints/myOrders.js +0 -1
- package/build/webapi/endpoints/setSpotPrice.d.ts +0 -4
- package/build/webapi/endpoints/setSpotPrice.js +0 -1
- package/build/webapi/endpoints/spotMarketplace.d.ts +0 -8
- package/build/webapi/endpoints/spotMarketplace.js +0 -1
- package/build/webapi/index.d.ts +0 -9
- package/build/webapi/index.js +0 -2
- package/build/webapi/types.d.ts +0 -7
- package/build/webapi/types.js +0 -1
- package/build/webapi.d.ts +0 -4
- package/build/webapi.js +0 -4
- /package/build/{cloreai/endpoints → endpoints}/cancelOrder.js +0 -0
- /package/build/{cloreai/endpoints → endpoints}/cancelOrders.js +0 -0
- /package/build/{cloreai/endpoints → endpoints}/createGigaspotOrders.js +0 -0
- /package/build/{cloreai/endpoints → endpoints}/createOrder.js +0 -0
- /package/build/{cloreai/endpoints → endpoints}/editGigaspotOrders.d.ts +0 -0
- /package/build/{cloreai/endpoints → endpoints}/editGigaspotOrders.js +0 -0
- /package/build/{cloreai/endpoints → endpoints}/getGigaspot.js +0 -0
- /package/build/{cloreai/endpoints → endpoints}/marketplace.js +0 -0
- /package/build/{cloreai/endpoints → endpoints}/myOrders.js +0 -0
- /package/build/{cloreai/endpoints → endpoints}/myServers.js +0 -0
- /package/build/{cloreai/endpoints/serverConfig.js → endpoints/pohBalance.js} +0 -0
- /package/build/{cloreai/endpoints/setServerSettings.js → endpoints/serverConfig.js} +0 -0
- /package/build/{cloreai/endpoints/setSpotPrice.js → endpoints/setServerSettings.js} +0 -0
- /package/build/{common/endpoints → endpoints}/setSpotPrice.js +0 -0
- /package/build/{cloreai/endpoints → endpoints}/spotMarketplace.js +0 -0
- /package/build/{cloreai/endpoints → endpoints}/wallets.js +0 -0
- /package/build/{common/errors.js → errors.js} +0 -0
- /package/build/{cloreai/types.js → types.js} +0 -0
package/build/webapi/WebAPI.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { type AxiosInstance, type AxiosRequestConfig } from 'axios';
|
|
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 { MyOrdersRequestData, MyOrdersResponseData } from './endpoints/myOrders.js';
|
|
7
|
-
import type { SetSpotPriceRequestData, SetSpotPriceResponseData } from './endpoints/setSpotPrice.js';
|
|
8
|
-
import type { SpotMarketplaceRequestData, SpotMarketplaceResponseData } from './endpoints/spotMarketplace.js';
|
|
9
|
-
import type { Config } from './types.js';
|
|
10
|
-
declare class WebAPI {
|
|
11
|
-
axios: AxiosInstance;
|
|
12
|
-
rateLimitQueue: PQueue;
|
|
13
|
-
rateLimitQueueCreateOrder: PQueue;
|
|
14
|
-
constructor(config: Config);
|
|
15
|
-
marketplace(config?: AxiosRequestConfig): Promise<MarketplaceResponseData>;
|
|
16
|
-
myOrders(data: MyOrdersRequestData, config?: AxiosRequestConfig): Promise<MyOrdersResponseData>;
|
|
17
|
-
spotMarketplace(data: SpotMarketplaceRequestData, config?: AxiosRequestConfig): Promise<SpotMarketplaceResponseData>;
|
|
18
|
-
setSpotPrice(data: SetSpotPriceRequestData, config?: AxiosRequestConfig): Promise<SetSpotPriceResponseData>;
|
|
19
|
-
cancelOrder(data: CancelOrderRequestData, config?: AxiosRequestConfig): Promise<CancelOrderResponseData>;
|
|
20
|
-
createOrder(data: CreateOrderRequestData, config?: AxiosRequestConfig): Promise<CreateOrderResponseData>;
|
|
21
|
-
}
|
|
22
|
-
export default WebAPI;
|
package/build/webapi/WebAPI.js
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import axios from 'axios';
|
|
2
|
-
import PQueue from 'p-queue';
|
|
3
|
-
import { priorityLevels, RATE_LIMIT, RATE_LIMIT_CREATE_ORDER } from '../common/constants.js';
|
|
4
|
-
import { UnknownError } from '../common/errors.js';
|
|
5
|
-
import { getErrorMessage, getQueueOptions } from '../common/helpers.js';
|
|
6
|
-
class WebAPI {
|
|
7
|
-
axios;
|
|
8
|
-
rateLimitQueue;
|
|
9
|
-
rateLimitQueueCreateOrder;
|
|
10
|
-
constructor(config) {
|
|
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
|
-
});
|
|
23
|
-
this.axios = axios.create({
|
|
24
|
-
...config.axiosConfig,
|
|
25
|
-
baseURL: 'https://clore.ai/webapi',
|
|
26
|
-
});
|
|
27
|
-
this.axios.interceptors.request.use((request) => {
|
|
28
|
-
request.data = {
|
|
29
|
-
...request.data,
|
|
30
|
-
token: config.token,
|
|
31
|
-
};
|
|
32
|
-
return request;
|
|
33
|
-
});
|
|
34
|
-
this.axios.interceptors.response.use((response) => {
|
|
35
|
-
const hasError = Boolean(response.data.error);
|
|
36
|
-
if (!hasError) {
|
|
37
|
-
return response;
|
|
38
|
-
}
|
|
39
|
-
const errorMessage = getErrorMessage(response.data.status, response.data.error);
|
|
40
|
-
throw new UnknownError(errorMessage, undefined, response.config, response.request, response);
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
async marketplace(config) {
|
|
44
|
-
const response = await this.rateLimitQueue.add(async () => {
|
|
45
|
-
return await this.axios.post('/marketplace/servers', null, config);
|
|
46
|
-
}, getQueueOptions(priorityLevels.NORMAL, config));
|
|
47
|
-
return response.data;
|
|
48
|
-
}
|
|
49
|
-
async myOrders(data, config) {
|
|
50
|
-
const response = await this.rateLimitQueue.add(async () => {
|
|
51
|
-
return await this.axios.post('/marketplace/orders', data, config);
|
|
52
|
-
}, getQueueOptions(priorityLevels.NORMAL, config));
|
|
53
|
-
return response.data;
|
|
54
|
-
}
|
|
55
|
-
async spotMarketplace(data, config) {
|
|
56
|
-
const response = await this.rateLimitQueue.add(async () => {
|
|
57
|
-
return await this.axios.post('/marketplace/get_spot', data, config);
|
|
58
|
-
}, getQueueOptions(priorityLevels.NORMAL, config));
|
|
59
|
-
return response.data;
|
|
60
|
-
}
|
|
61
|
-
async setSpotPrice(data, config) {
|
|
62
|
-
const response = await this.rateLimitQueue.add(async () => {
|
|
63
|
-
return await this.axios.post('/marketplace/set_spot_price', data, config);
|
|
64
|
-
}, getQueueOptions(priorityLevels.HIGH, config));
|
|
65
|
-
return response.data;
|
|
66
|
-
}
|
|
67
|
-
async cancelOrder(data, config) {
|
|
68
|
-
const response = await this.rateLimitQueue.add(async () => {
|
|
69
|
-
return await this.axios.post('/marketplace/cancel_order', data, config);
|
|
70
|
-
}, getQueueOptions(priorityLevels.HIGH, config));
|
|
71
|
-
return response.data;
|
|
72
|
-
}
|
|
73
|
-
async createOrder(data, config) {
|
|
74
|
-
const response = await this.rateLimitQueueCreateOrder.add(async () => {
|
|
75
|
-
return await this.axios.post('/create_order', data, config);
|
|
76
|
-
}, getQueueOptions(priorityLevels.HIGHEST, config));
|
|
77
|
-
return response.data;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
export default WebAPI;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { CancelOrderRequestDataCommon } from '../../common/endpoints/cancelOrder.js';
|
|
2
|
-
import type { ResponseData } from '../types.js';
|
|
3
|
-
export interface CancelOrderRequestData extends CancelOrderRequestDataCommon {
|
|
4
|
-
rating: number;
|
|
5
|
-
}
|
|
6
|
-
export type CancelOrderResponseData = ResponseData;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { MarketplaceResponseDataServerCommon } from '../../common/endpoints/marketplace.js';
|
|
2
|
-
import type { Price } from '../../common/types.js';
|
|
3
|
-
import type { ResponseData } from '../types.js';
|
|
4
|
-
export interface MarketplaceResponseData extends ResponseData {
|
|
5
|
-
all_servers: MarketplaceResponseDataServerCommon[];
|
|
6
|
-
creation_fees: Price;
|
|
7
|
-
disable_usd: boolean;
|
|
8
|
-
my_servers: MarketplaceResponseDataServerCommon[];
|
|
9
|
-
not_rented_available_servers: MarketplaceResponseDataServerCommon[];
|
|
10
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { MyOrdersResponseDataOrderCommon } from '../../common/endpoints/myOrders.js';
|
|
2
|
-
import type { Currency, Price } from '../../common/types.js';
|
|
3
|
-
import type { ResponseData } from '../types.js';
|
|
4
|
-
export interface MyOrdersRequestData {
|
|
5
|
-
rc: boolean;
|
|
6
|
-
}
|
|
7
|
-
export interface MyOrdersResponseData extends ResponseData {
|
|
8
|
-
PoH_active: boolean;
|
|
9
|
-
PoH_rates: Record<Currency, Record<string, Price>>;
|
|
10
|
-
allowed_features: string[];
|
|
11
|
-
eo: boolean;
|
|
12
|
-
http_endpoint_by_proxy: Record<string, string>;
|
|
13
|
-
ol: number;
|
|
14
|
-
orders: MyOrdersResponseDataOrderCommon[];
|
|
15
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,4 +0,0 @@
|
|
|
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 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { SpotMarketplaceResponseDataCommon } from '../../common/endpoints/spotMarketplace.js';
|
|
2
|
-
import type { ResponseData } from '../types.js';
|
|
3
|
-
export interface SpotMarketplaceRequestData {
|
|
4
|
-
id: number;
|
|
5
|
-
}
|
|
6
|
-
export interface SpotMarketplaceResponseData extends ResponseData {
|
|
7
|
-
data: SpotMarketplaceResponseDataCommon;
|
|
8
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/build/webapi/index.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import WebAPI from './WebAPI.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/setSpotPrice.js';
|
|
7
|
-
export type * from './endpoints/spotMarketplace.js';
|
|
8
|
-
export type * from './types.js';
|
|
9
|
-
export default WebAPI;
|
package/build/webapi/index.js
DELETED
package/build/webapi/types.d.ts
DELETED
package/build/webapi/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/build/webapi.d.ts
DELETED
package/build/webapi.js
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|