cloreai 1.0.0 → 2.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 +42 -43
- package/build/CloreAI.d.ts +13 -13
- package/build/CloreAI.js +8 -8
- package/build/Gigaspot.d.ts +7 -7
- package/build/Gigaspot.js +4 -4
- package/build/constants.d.ts +14 -0
- package/build/constants.js +14 -0
- package/build/getQueueOptions.d.ts +5 -0
- package/build/{helpers.js → getQueueOptions.js} +0 -14
- package/build/index.d.ts +15 -15
- package/build/{endpoints → resources}/marketplace.d.ts +4 -7
- package/build/{endpoints → resources}/myOrders.d.ts +10 -3
- package/build/types.d.ts +23 -15
- package/package.json +9 -10
- package/build/helpers.d.ts +0 -19
- package/build/{endpoints → resources}/cancelOrder.d.ts +0 -0
- package/build/{endpoints → resources}/cancelOrder.js +0 -0
- package/build/{endpoints → resources}/cancelOrders.d.ts +0 -0
- package/build/{endpoints → resources}/cancelOrders.js +0 -0
- package/build/{endpoints → resources}/createGigaspotOrders.d.ts +2 -2
- package/build/{endpoints → resources}/createGigaspotOrders.js +0 -0
- package/build/{endpoints → resources}/createOrder.d.ts +0 -0
- package/build/{endpoints → resources}/createOrder.js +0 -0
- package/build/{endpoints → resources}/editGigaspotOrders.d.ts +2 -2
- /package/build/{endpoints → resources}/editGigaspotOrders.js +0 -0
- /package/build/{endpoints → resources}/getGigaspot.d.ts +0 -0
- /package/build/{endpoints → resources}/getGigaspot.js +0 -0
- /package/build/{endpoints → resources}/marketplace.js +0 -0
- /package/build/{endpoints → resources}/myOrders.js +0 -0
- /package/build/{endpoints → resources}/myServers.d.ts +0 -0
- /package/build/{endpoints → resources}/myServers.js +0 -0
- /package/build/{endpoints → resources}/pohBalance.d.ts +0 -0
- /package/build/{endpoints → resources}/pohBalance.js +0 -0
- /package/build/{endpoints → resources}/serverConfig.d.ts +0 -0
- /package/build/{endpoints → resources}/serverConfig.js +0 -0
- /package/build/{endpoints → resources}/setServerSettings.d.ts +0 -0
- /package/build/{endpoints → resources}/setServerSettings.js +0 -0
- /package/build/{endpoints → resources}/setSpotPrice.d.ts +0 -0
- /package/build/{endpoints → resources}/setSpotPrice.js +0 -0
- /package/build/{endpoints → resources}/spotMarketplace.d.ts +0 -0
- /package/build/{endpoints → resources}/spotMarketplace.js +0 -0
- /package/build/{endpoints → resources}/wallets.d.ts +0 -0
- /package/build/{endpoints → resources}/wallets.js +0 -0
package/README.md
CHANGED
|
@@ -2,37 +2,37 @@
|
|
|
2
2
|
|
|
3
3
|
> CLORE.AI API client
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Features:
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
-
|
|
7
|
+
- Based on [axios](https://github.com/axios/axios)
|
|
8
|
+
- Protects from rate limit exceeded (429 errors) via
|
|
9
9
|
[p-queue](https://github.com/sindresorhus/p-queue)
|
|
10
|
-
-
|
|
10
|
+
- Error handling via try...catch and instanceof
|
|
11
|
+
- Supports GigaSPOT
|
|
11
12
|
|
|
12
|
-
|
|
13
|
+
Official documentation: [clore.ai/api-docs](https://clore.ai/api-docs)
|
|
13
14
|
|
|
14
|
-
|
|
15
|
+
Official GigaSPOT documentation:
|
|
15
16
|
[gigaspot-api-docs.clore.ai](https://gigaspot-api-docs.clore.ai)
|
|
16
17
|
|
|
17
|
-
##
|
|
18
|
+
## Installation
|
|
18
19
|
|
|
19
20
|
```shell
|
|
20
21
|
npm install cloreai
|
|
21
22
|
```
|
|
22
23
|
|
|
23
|
-
##
|
|
24
|
+
## Usage
|
|
24
25
|
|
|
25
|
-
###
|
|
26
|
+
### Creating an instance
|
|
26
27
|
|
|
27
28
|
```typescript
|
|
28
29
|
import CloreAI from 'cloreai'
|
|
29
30
|
|
|
30
|
-
const cloreai = new CloreAI({
|
|
31
|
-
apiKey: '<API_KEY>', // (required)
|
|
31
|
+
const cloreai = new CloreAI('<API_KEY>', {
|
|
32
32
|
axiosOptions: {}, // (optional) Axios instance options https://github.com/axios/axios
|
|
33
33
|
queueOptions: {}, // (optional) Queue instance options https://github.com/sindresorhus/p-queue
|
|
34
34
|
queueOptionsCreateOrder: {}, // (optional) Create order queue instance options https://github.com/sindresorhus/p-queue
|
|
35
|
-
queueOptionsGigaspot: {}, //
|
|
35
|
+
queueOptionsGigaspot: {}, // (optional) Gigaspot queue instance options https://github.com/sindresorhus/p-queue
|
|
36
36
|
})
|
|
37
37
|
```
|
|
38
38
|
|
|
@@ -184,10 +184,10 @@ await cloreai.gigaspot.cancelOrders({
|
|
|
184
184
|
})
|
|
185
185
|
```
|
|
186
186
|
|
|
187
|
-
###
|
|
187
|
+
### Request Configuration
|
|
188
188
|
|
|
189
|
-
|
|
190
|
-
|
|
189
|
+
All methods accept an optional request configuration for axios as the last
|
|
190
|
+
parameter, for example:
|
|
191
191
|
|
|
192
192
|
```typescript
|
|
193
193
|
const marketplace = await cloreai.marketplace({
|
|
@@ -195,25 +195,25 @@ const marketplace = await cloreai.marketplace({
|
|
|
195
195
|
})
|
|
196
196
|
```
|
|
197
197
|
|
|
198
|
-
###
|
|
198
|
+
### Access to axios instance
|
|
199
199
|
|
|
200
|
-
|
|
200
|
+
Use the field `cloreai.axios`.
|
|
201
201
|
|
|
202
|
-
|
|
202
|
+
Refer to the documentation [axios](https://github.com/axios/axios).
|
|
203
203
|
|
|
204
|
-
###
|
|
204
|
+
### Access to p-queue instances
|
|
205
205
|
|
|
206
|
-
|
|
206
|
+
Use the fields:
|
|
207
207
|
|
|
208
|
-
- `cloreai.queue` -
|
|
209
|
-
- `cloreai.queueCreateOrder` -
|
|
210
|
-
- `cloreai.gigaspot.queue` -
|
|
208
|
+
- `cloreai.queue` - for main request queue
|
|
209
|
+
- `cloreai.queueCreateOrder` - for createOrder request queue
|
|
210
|
+
- `cloreai.gigaspot.queue` - for gigaspot request queue
|
|
211
211
|
|
|
212
|
-
|
|
212
|
+
Refer to the documentation [p-queue](https://github.com/sindresorhus/p-queue).
|
|
213
213
|
|
|
214
|
-
###
|
|
214
|
+
### Error Handling
|
|
215
215
|
|
|
216
|
-
|
|
216
|
+
The library exports the following error types:
|
|
217
217
|
|
|
218
218
|
- `DatabaseError`
|
|
219
219
|
- `InvalidInputDataError`
|
|
@@ -223,9 +223,9 @@ const marketplace = await cloreai.marketplace({
|
|
|
223
223
|
- `OtherError`
|
|
224
224
|
- `UnknownError`
|
|
225
225
|
|
|
226
|
-
|
|
226
|
+
All these errors inherit from `AxiosError`.
|
|
227
227
|
|
|
228
|
-
|
|
228
|
+
Check the error type via the `instanceof` operator:
|
|
229
229
|
|
|
230
230
|
```typescript
|
|
231
231
|
import { AxiosError } from 'axios'
|
|
@@ -236,23 +236,23 @@ try {
|
|
|
236
236
|
} catch (error) {
|
|
237
237
|
if (error instanceof AxiosError) {
|
|
238
238
|
console.log('AxiosError')
|
|
239
|
+
}
|
|
239
240
|
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
}
|
|
243
|
-
} else {
|
|
244
|
-
throw error
|
|
241
|
+
if (error instanceof ExceededError) {
|
|
242
|
+
console.log('ExceededError')
|
|
245
243
|
}
|
|
244
|
+
|
|
245
|
+
throw error
|
|
246
246
|
}
|
|
247
247
|
```
|
|
248
248
|
|
|
249
249
|
### Rate limit
|
|
250
250
|
|
|
251
|
-
|
|
252
|
-
[p-queue](https://github.com/sindresorhus/p-queue),
|
|
253
|
-
|
|
251
|
+
All methods are protected from rate limit exceeded via
|
|
252
|
+
[p-queue](https://github.com/sindresorhus/p-queue), they automatically pause for
|
|
253
|
+
the required time to avoid exceeding the limit.
|
|
254
254
|
|
|
255
|
-
|
|
255
|
+
Default rate limit values are available as constants:
|
|
256
256
|
|
|
257
257
|
```typescript
|
|
258
258
|
import {
|
|
@@ -266,21 +266,20 @@ console.log(RATE_LIMIT_CREATE_ORDER)
|
|
|
266
266
|
console.log(RATE_LIMIT_GIGASPOT)
|
|
267
267
|
```
|
|
268
268
|
|
|
269
|
-
|
|
269
|
+
You can set your own rate limit values for each request queue:
|
|
270
270
|
|
|
271
271
|
```typescript
|
|
272
272
|
import CloreAI from 'cloreai'
|
|
273
273
|
|
|
274
|
-
const cloreai = new CloreAI({
|
|
275
|
-
apiKey: '<API_KEY>',
|
|
274
|
+
const cloreai = new CloreAI('<API_KEY>', {
|
|
276
275
|
queueOptions: {
|
|
277
|
-
interval:
|
|
276
|
+
interval: 2000, // For example 2 seconds
|
|
278
277
|
},
|
|
279
278
|
queueOptionsCreateOrder: {
|
|
280
|
-
interval:
|
|
279
|
+
interval: 6000, // For example 6 seconds
|
|
281
280
|
},
|
|
282
281
|
queueOptionsGigaspot: {
|
|
283
|
-
interval:
|
|
282
|
+
interval: 2000, // For example 2 seconds
|
|
284
283
|
},
|
|
285
284
|
})
|
|
286
285
|
```
|
package/build/CloreAI.d.ts
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import { type AxiosInstance, type AxiosRequestConfig } from 'axios';
|
|
2
2
|
import PQueue from 'p-queue';
|
|
3
|
-
import type { CancelOrderRequestData, CancelOrderResponseData } from './
|
|
4
|
-
import type { CreateOrderRequestData, CreateOrderResponseData } from './
|
|
5
|
-
import type { MarketplaceResponseData } from './
|
|
6
|
-
import type { MyOrdersRequestParams, MyOrdersResponseData } from './
|
|
7
|
-
import type { MyServersResponseData } from './
|
|
8
|
-
import type { PohBalanceResponseData } from './
|
|
9
|
-
import type { ServerConfigRequestData, ServerConfigResponseData } from './
|
|
10
|
-
import type { SetServerSettingsRequestData, SetServerSettingsResponseData } from './
|
|
11
|
-
import type { SetSpotPriceRequestData, SetSpotPriceResponseData } from './
|
|
12
|
-
import type { SpotMarketplaceRequestParams, SpotMarketplaceResponseData } from './
|
|
13
|
-
import type { WalletsResponseData } from './
|
|
14
|
-
import type {
|
|
3
|
+
import type { CancelOrderRequestData, CancelOrderResponseData } from './resources/cancelOrder.js';
|
|
4
|
+
import type { CreateOrderRequestData, CreateOrderResponseData } from './resources/createOrder.js';
|
|
5
|
+
import type { MarketplaceResponseData } from './resources/marketplace.js';
|
|
6
|
+
import type { MyOrdersRequestParams, MyOrdersResponseData } from './resources/myOrders.js';
|
|
7
|
+
import type { MyServersResponseData } from './resources/myServers.js';
|
|
8
|
+
import type { PohBalanceResponseData } from './resources/pohBalance.js';
|
|
9
|
+
import type { ServerConfigRequestData, ServerConfigResponseData } from './resources/serverConfig.js';
|
|
10
|
+
import type { SetServerSettingsRequestData, SetServerSettingsResponseData } from './resources/setServerSettings.js';
|
|
11
|
+
import type { SetSpotPriceRequestData, SetSpotPriceResponseData } from './resources/setSpotPrice.js';
|
|
12
|
+
import type { SpotMarketplaceRequestParams, SpotMarketplaceResponseData } from './resources/spotMarketplace.js';
|
|
13
|
+
import type { WalletsResponseData } from './resources/wallets.js';
|
|
14
|
+
import type { Options } from './types.js';
|
|
15
15
|
import Gigaspot from './Gigaspot.js';
|
|
16
16
|
declare class CloreAI {
|
|
17
17
|
axios: AxiosInstance;
|
|
18
18
|
queue: PQueue;
|
|
19
19
|
queueCreateOrder: PQueue;
|
|
20
20
|
gigaspot: Gigaspot;
|
|
21
|
-
constructor(
|
|
21
|
+
constructor(apiKey: string, options?: Options);
|
|
22
22
|
wallets(config?: AxiosRequestConfig): Promise<WalletsResponseData>;
|
|
23
23
|
myServers(config?: AxiosRequestConfig): Promise<MyServersResponseData>;
|
|
24
24
|
serverConfig(data: ServerConfigRequestData, config?: AxiosRequestConfig): Promise<ServerConfigResponseData>;
|
package/build/CloreAI.js
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
import axios from 'axios';
|
|
2
2
|
import PQueue from 'p-queue';
|
|
3
|
-
import { RATE_LIMIT, RATE_LIMIT_CREATE_ORDER } from './constants.js';
|
|
3
|
+
import { priorityLevels, RATE_LIMIT, RATE_LIMIT_CREATE_ORDER, statusCodes } from './constants.js';
|
|
4
4
|
import { DatabaseError, ExceededError, InvalidApiTokenError, InvalidEndpointError, InvalidInputDataError, OtherError, UnknownError } from './errors.js';
|
|
5
|
+
import { getQueueOptions } from './getQueueOptions.js';
|
|
5
6
|
import Gigaspot from './Gigaspot.js';
|
|
6
|
-
import { getQueueOptions, priorityLevels, statusCodes } from './helpers.js';
|
|
7
7
|
class CloreAI {
|
|
8
8
|
axios;
|
|
9
9
|
queue;
|
|
10
10
|
queueCreateOrder;
|
|
11
11
|
gigaspot;
|
|
12
|
-
constructor(
|
|
12
|
+
constructor(apiKey, options = {}) {
|
|
13
13
|
this.queue = new PQueue({
|
|
14
14
|
interval: RATE_LIMIT,
|
|
15
15
|
intervalCap: 1,
|
|
16
16
|
concurrency: 1,
|
|
17
|
-
...
|
|
17
|
+
...options.queueOptions,
|
|
18
18
|
});
|
|
19
19
|
this.queueCreateOrder = new PQueue({
|
|
20
20
|
interval: RATE_LIMIT_CREATE_ORDER,
|
|
21
21
|
intervalCap: 1,
|
|
22
22
|
concurrency: 1,
|
|
23
|
-
...
|
|
23
|
+
...options.queueOptionsCreateOrder,
|
|
24
24
|
});
|
|
25
25
|
this.axios = axios.create({
|
|
26
|
-
...
|
|
26
|
+
...options.axiosOptions,
|
|
27
27
|
baseURL: 'https://api.clore.ai/v1',
|
|
28
28
|
});
|
|
29
29
|
this.axios.interceptors.request.use((request) => {
|
|
30
|
-
request.headers.set('auth',
|
|
30
|
+
request.headers.set('auth', apiKey);
|
|
31
31
|
return request;
|
|
32
32
|
});
|
|
33
33
|
this.axios.interceptors.response.use((response) => {
|
|
@@ -61,7 +61,7 @@ class CloreAI {
|
|
|
61
61
|
throw new UnknownError(...axiosErrorParameters);
|
|
62
62
|
}
|
|
63
63
|
});
|
|
64
|
-
this.gigaspot = new Gigaspot(
|
|
64
|
+
this.gigaspot = new Gigaspot(options, this.axios);
|
|
65
65
|
}
|
|
66
66
|
async wallets(config) {
|
|
67
67
|
const response = await this.queue.add(async () => {
|
package/build/Gigaspot.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { type AxiosInstance, type AxiosRequestConfig } from 'axios';
|
|
2
2
|
import PQueue from 'p-queue';
|
|
3
|
-
import type { CancelOrdersRequestData, CancelOrdersResponseData } from './
|
|
4
|
-
import type { CreateGigaspotOrdersRequestData, CreateGigaspotOrdersResponseData } from './
|
|
5
|
-
import type { EditGigaspotOrdersRequestData, EditGigaspotOrdersResponseData } from './
|
|
6
|
-
import type { GetGigaspotResponseData } from './
|
|
7
|
-
import type {
|
|
3
|
+
import type { CancelOrdersRequestData, CancelOrdersResponseData } from './resources/cancelOrders.js';
|
|
4
|
+
import type { CreateGigaspotOrdersRequestData, CreateGigaspotOrdersResponseData } from './resources/createGigaspotOrders.js';
|
|
5
|
+
import type { EditGigaspotOrdersRequestData, EditGigaspotOrdersResponseData } from './resources/editGigaspotOrders.js';
|
|
6
|
+
import type { GetGigaspotResponseData } from './resources/getGigaspot.js';
|
|
7
|
+
import type { Options } from './types.js';
|
|
8
8
|
declare class Gigaspot {
|
|
9
9
|
queue: PQueue;
|
|
10
|
-
private
|
|
11
|
-
constructor(
|
|
10
|
+
private axios;
|
|
11
|
+
constructor(options: Options, axios: AxiosInstance);
|
|
12
12
|
getGigaspot(config?: AxiosRequestConfig): Promise<GetGigaspotResponseData>;
|
|
13
13
|
createGigaspotOrders(data: CreateGigaspotOrdersRequestData, config?: AxiosRequestConfig): Promise<CreateGigaspotOrdersResponseData>;
|
|
14
14
|
editGigaspotOrders(data: EditGigaspotOrdersRequestData, config?: AxiosRequestConfig): Promise<EditGigaspotOrdersResponseData>;
|
package/build/Gigaspot.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import axios from 'axios';
|
|
2
2
|
import PQueue from 'p-queue';
|
|
3
|
-
import { RATE_LIMIT_GIGASPOT } from './constants.js';
|
|
4
|
-
import { getQueueOptions
|
|
3
|
+
import { priorityLevels, RATE_LIMIT_GIGASPOT } from './constants.js';
|
|
4
|
+
import { getQueueOptions } from './getQueueOptions.js';
|
|
5
5
|
class Gigaspot {
|
|
6
6
|
queue;
|
|
7
7
|
axios;
|
|
8
|
-
constructor(
|
|
8
|
+
constructor(options, axios) {
|
|
9
9
|
this.queue = new PQueue({
|
|
10
10
|
interval: RATE_LIMIT_GIGASPOT,
|
|
11
11
|
intervalCap: 1,
|
|
12
12
|
concurrency: 1,
|
|
13
|
-
...
|
|
13
|
+
...options.queueOptionsGigaspot,
|
|
14
14
|
});
|
|
15
15
|
this.axios = axios;
|
|
16
16
|
}
|
package/build/constants.d.ts
CHANGED
|
@@ -5,3 +5,17 @@ export declare const gigaspotBaseImages: {
|
|
|
5
5
|
UBUNTU: string;
|
|
6
6
|
HIVEOS: string;
|
|
7
7
|
};
|
|
8
|
+
export declare const statusCodes: {
|
|
9
|
+
NORMAL: number;
|
|
10
|
+
DATABASE_ERROR: number;
|
|
11
|
+
INVALID_INPUT_DATA: number;
|
|
12
|
+
INVALID_API_TOKEN: number;
|
|
13
|
+
INVALID_ENDPOINT: number;
|
|
14
|
+
EXCEEDED: number;
|
|
15
|
+
OTHER: number;
|
|
16
|
+
};
|
|
17
|
+
export declare const priorityLevels: {
|
|
18
|
+
NORMAL: number;
|
|
19
|
+
HIGH: number;
|
|
20
|
+
HIGHEST: number;
|
|
21
|
+
};
|
package/build/constants.js
CHANGED
|
@@ -5,3 +5,17 @@ export const gigaspotBaseImages = {
|
|
|
5
5
|
UBUNTU: 'a3f9c4d7e5b088d8a0bff880',
|
|
6
6
|
HIVEOS: 'c9a4e2f6b7d488d8f0bab0ff',
|
|
7
7
|
};
|
|
8
|
+
export const statusCodes = {
|
|
9
|
+
NORMAL: 0,
|
|
10
|
+
DATABASE_ERROR: 1,
|
|
11
|
+
INVALID_INPUT_DATA: 2,
|
|
12
|
+
INVALID_API_TOKEN: 3,
|
|
13
|
+
INVALID_ENDPOINT: 4,
|
|
14
|
+
EXCEEDED: 5,
|
|
15
|
+
OTHER: 6,
|
|
16
|
+
};
|
|
17
|
+
export const priorityLevels = {
|
|
18
|
+
NORMAL: 0,
|
|
19
|
+
HIGH: 1,
|
|
20
|
+
HIGHEST: 2,
|
|
21
|
+
};
|
|
@@ -1,17 +1,3 @@
|
|
|
1
|
-
export const statusCodes = {
|
|
2
|
-
NORMAL: 0,
|
|
3
|
-
DATABASE_ERROR: 1,
|
|
4
|
-
INVALID_INPUT_DATA: 2,
|
|
5
|
-
INVALID_API_TOKEN: 3,
|
|
6
|
-
INVALID_ENDPOINT: 4,
|
|
7
|
-
EXCEEDED: 5,
|
|
8
|
-
OTHER: 6,
|
|
9
|
-
};
|
|
10
|
-
export const priorityLevels = {
|
|
11
|
-
NORMAL: 0,
|
|
12
|
-
HIGH: 1,
|
|
13
|
-
HIGHEST: 2,
|
|
14
|
-
};
|
|
15
1
|
export function getQueueOptions(priority, config) {
|
|
16
2
|
const defaultQueueOptions = {
|
|
17
3
|
throwOnTimeout: true,
|
package/build/index.d.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import CloreAI from './CloreAI.js';
|
|
2
2
|
export * from './constants.js';
|
|
3
|
-
export type * from './endpoints/cancelOrder.js';
|
|
4
|
-
export type * from './endpoints/cancelOrders.js';
|
|
5
|
-
export type * from './endpoints/createGigaspotOrders.js';
|
|
6
|
-
export type * from './endpoints/createOrder.js';
|
|
7
|
-
export type * from './endpoints/editGigaspotOrders.js';
|
|
8
|
-
export type * from './endpoints/getGigaspot.js';
|
|
9
|
-
export type * from './endpoints/marketplace.js';
|
|
10
|
-
export type * from './endpoints/myOrders.js';
|
|
11
|
-
export type * from './endpoints/myServers.js';
|
|
12
|
-
export type * from './endpoints/pohBalance.js';
|
|
13
|
-
export type * from './endpoints/serverConfig.js';
|
|
14
|
-
export type * from './endpoints/setServerSettings.js';
|
|
15
|
-
export type * from './endpoints/setSpotPrice.js';
|
|
16
|
-
export type * from './endpoints/spotMarketplace.js';
|
|
17
|
-
export type * from './endpoints/wallets.js';
|
|
18
3
|
export * from './errors.js';
|
|
4
|
+
export type * from './resources/cancelOrder.js';
|
|
5
|
+
export type * from './resources/cancelOrders.js';
|
|
6
|
+
export type * from './resources/createGigaspotOrders.js';
|
|
7
|
+
export type * from './resources/createOrder.js';
|
|
8
|
+
export type * from './resources/editGigaspotOrders.js';
|
|
9
|
+
export type * from './resources/getGigaspot.js';
|
|
10
|
+
export type * from './resources/marketplace.js';
|
|
11
|
+
export type * from './resources/myOrders.js';
|
|
12
|
+
export type * from './resources/myServers.js';
|
|
13
|
+
export type * from './resources/pohBalance.js';
|
|
14
|
+
export type * from './resources/serverConfig.js';
|
|
15
|
+
export type * from './resources/setServerSettings.js';
|
|
16
|
+
export type * from './resources/setSpotPrice.js';
|
|
17
|
+
export type * from './resources/spotMarketplace.js';
|
|
18
|
+
export type * from './resources/wallets.js';
|
|
19
19
|
export type * from './types.js';
|
|
20
20
|
export default CloreAI;
|
|
@@ -1,20 +1,17 @@
|
|
|
1
|
-
import type { Currency, Price, ResponseData, Specs } from '../types.js';
|
|
2
|
-
export interface MarketplaceResponseDataServerRating {
|
|
3
|
-
avg: number;
|
|
4
|
-
cnt: number;
|
|
5
|
-
}
|
|
1
|
+
import type { Currency, Price, Rating, ResponseData, Specs } from '../types.js';
|
|
6
2
|
export interface MarketplaceResponseDataServer {
|
|
7
3
|
id: number;
|
|
8
4
|
owner: number;
|
|
5
|
+
autoprice?: string;
|
|
9
6
|
mrl: number;
|
|
10
7
|
price: Price;
|
|
11
8
|
rented: boolean;
|
|
12
9
|
specs: Specs;
|
|
13
10
|
reliability: number;
|
|
14
11
|
allowed_coins: Currency[];
|
|
15
|
-
rating:
|
|
12
|
+
rating: Rating;
|
|
16
13
|
gpu_array: string[];
|
|
17
|
-
gigaspot
|
|
14
|
+
gigaspot?: boolean;
|
|
18
15
|
oc?: boolean;
|
|
19
16
|
cuda_version: string;
|
|
20
17
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Currency, ResponseData, Specs } from '../types.js';
|
|
1
|
+
import type { Currency, Rating, ResponseData, Specs } from '../types.js';
|
|
2
2
|
export interface MyOrdersRequestParams {
|
|
3
3
|
return_completed?: boolean;
|
|
4
4
|
}
|
|
@@ -10,10 +10,12 @@ export interface MyOrdersResponseDataOrder {
|
|
|
10
10
|
mrl: number;
|
|
11
11
|
image: string;
|
|
12
12
|
currency: Currency;
|
|
13
|
+
original_price_usd?: number;
|
|
13
14
|
spend: number;
|
|
14
15
|
ct: number;
|
|
15
16
|
specs: Specs;
|
|
16
17
|
si: number;
|
|
18
|
+
my_past_rating?: number;
|
|
17
19
|
auto_login: string;
|
|
18
20
|
mon_container: number;
|
|
19
21
|
online: boolean;
|
|
@@ -21,8 +23,13 @@ export interface MyOrdersResponseDataOrder {
|
|
|
21
23
|
tcp_ports: string[];
|
|
22
24
|
http_port: string;
|
|
23
25
|
http_pub: string;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
+
rating: Rating;
|
|
27
|
+
reliability: number;
|
|
28
|
+
owner: number;
|
|
29
|
+
cuda_version: string;
|
|
30
|
+
gpu_array: string[];
|
|
31
|
+
spot?: boolean;
|
|
32
|
+
expired?: boolean;
|
|
26
33
|
}
|
|
27
34
|
export interface MyOrdersResponseData extends ResponseData {
|
|
28
35
|
orders: MyOrdersResponseDataOrder[];
|
package/build/types.d.ts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import type { CreateAxiosDefaults } from 'axios';
|
|
2
|
-
import type { Options, Queue, QueueAddOptions } from 'p-queue';
|
|
3
|
-
export type
|
|
4
|
-
export interface
|
|
5
|
-
apiKey: string;
|
|
2
|
+
import type { Options as PQueueOptions, Queue, QueueAddOptions } from 'p-queue';
|
|
3
|
+
export type QueueOptions = PQueueOptions<Queue<() => Promise<unknown>, QueueAddOptions>, QueueAddOptions>;
|
|
4
|
+
export interface Options {
|
|
6
5
|
axiosOptions?: CreateAxiosDefaults;
|
|
7
|
-
queueOptions?:
|
|
8
|
-
queueOptionsCreateOrder?:
|
|
9
|
-
queueOptionsGigaspot?:
|
|
6
|
+
queueOptions?: QueueOptions;
|
|
7
|
+
queueOptionsCreateOrder?: QueueOptions;
|
|
8
|
+
queueOptionsGigaspot?: QueueOptions;
|
|
10
9
|
}
|
|
11
10
|
export interface ResponseData {
|
|
12
11
|
code: number;
|
|
@@ -20,15 +19,20 @@ export interface Pricing {
|
|
|
20
19
|
'bitcoin': number;
|
|
21
20
|
'usd'?: number;
|
|
22
21
|
}
|
|
23
|
-
export interface
|
|
22
|
+
export interface PricingInUsd {
|
|
24
23
|
on_demand_btc: number;
|
|
25
24
|
on_demand_clore: number;
|
|
26
25
|
spot: number;
|
|
27
26
|
}
|
|
27
|
+
export interface PricingInOriginalUsd {
|
|
28
|
+
on_demand: number;
|
|
29
|
+
spot: number;
|
|
30
|
+
}
|
|
28
31
|
export interface Price {
|
|
29
32
|
on_demand: Pricing;
|
|
30
33
|
spot: Pricing;
|
|
31
|
-
usd?:
|
|
34
|
+
usd?: PricingInUsd;
|
|
35
|
+
original_usd?: PricingInOriginalUsd;
|
|
32
36
|
}
|
|
33
37
|
export interface Net {
|
|
34
38
|
cc: string;
|
|
@@ -36,6 +40,12 @@ export interface Net {
|
|
|
36
40
|
up: number;
|
|
37
41
|
test_history: string[];
|
|
38
42
|
}
|
|
43
|
+
export interface Gpu {
|
|
44
|
+
type: string;
|
|
45
|
+
mem: number;
|
|
46
|
+
pcie_gen: number;
|
|
47
|
+
pcie_width: number;
|
|
48
|
+
}
|
|
39
49
|
export interface Overclock {
|
|
40
50
|
model: string;
|
|
41
51
|
core_offset: number | null;
|
|
@@ -43,12 +53,6 @@ export interface Overclock {
|
|
|
43
53
|
core_lock: number | null;
|
|
44
54
|
mem_lock: number | null;
|
|
45
55
|
}
|
|
46
|
-
export interface Gpu {
|
|
47
|
-
type: string;
|
|
48
|
-
mem: number;
|
|
49
|
-
pcie_gen: number;
|
|
50
|
-
pcie_width: number;
|
|
51
|
-
}
|
|
52
56
|
export interface Specs {
|
|
53
57
|
mb: string;
|
|
54
58
|
cpu: string;
|
|
@@ -69,3 +73,7 @@ export interface Specs {
|
|
|
69
73
|
stock_pl: number[];
|
|
70
74
|
stock_oc: Overclock[] | 'default';
|
|
71
75
|
}
|
|
76
|
+
export interface Rating {
|
|
77
|
+
avg: number;
|
|
78
|
+
cnt: number;
|
|
79
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cloreai",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "CLORE.AI API client",
|
|
6
6
|
"repository": {
|
|
@@ -27,20 +27,19 @@
|
|
|
27
27
|
"typecheck": "tsc --noEmit"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"axios": "^1.
|
|
30
|
+
"axios": "^1.10.0",
|
|
31
31
|
"p-queue": "^8.1.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@tsconfig/node-lts": "^22.0.
|
|
34
|
+
"@tsconfig/node-lts": "^22.0.2",
|
|
35
35
|
"@tsconfig/strictest": "^2.0.5",
|
|
36
|
-
"@types/node": "^
|
|
37
|
-
"eslint": "^9.
|
|
38
|
-
"eslint-config-vladpuz": "^
|
|
36
|
+
"@types/node": "^24.0.12",
|
|
37
|
+
"eslint": "^9.30.1",
|
|
38
|
+
"eslint-config-vladpuz": "^2.0.2",
|
|
39
39
|
"husky": "^9.1.7",
|
|
40
|
-
"
|
|
41
|
-
"prettier": "^
|
|
42
|
-
"prettier-config-vladpuz": "^1.0.0",
|
|
40
|
+
"prettier": "^3.6.2",
|
|
41
|
+
"prettier-config-vladpuz": "^1.0.2",
|
|
43
42
|
"rimraf": "^6.0.1",
|
|
44
|
-
"typescript": "^5.8.
|
|
43
|
+
"typescript": "^5.8.3"
|
|
45
44
|
}
|
|
46
45
|
}
|
package/build/helpers.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { AxiosRequestConfig } from 'axios';
|
|
2
|
-
import type { QueueAddOptions } from 'p-queue';
|
|
3
|
-
export declare const statusCodes: {
|
|
4
|
-
NORMAL: number;
|
|
5
|
-
DATABASE_ERROR: number;
|
|
6
|
-
INVALID_INPUT_DATA: number;
|
|
7
|
-
INVALID_API_TOKEN: number;
|
|
8
|
-
INVALID_ENDPOINT: number;
|
|
9
|
-
EXCEEDED: number;
|
|
10
|
-
OTHER: number;
|
|
11
|
-
};
|
|
12
|
-
export declare const priorityLevels: {
|
|
13
|
-
NORMAL: number;
|
|
14
|
-
HIGH: number;
|
|
15
|
-
HIGHEST: number;
|
|
16
|
-
};
|
|
17
|
-
export declare function getQueueOptions(priority: number, config?: AxiosRequestConfig): QueueAddOptions & {
|
|
18
|
-
throwOnTimeout: true;
|
|
19
|
-
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { Currency, ResponseData } from '../types.js';
|
|
2
2
|
export interface CreateGigaspotOrdersRequestDataOrderOverclock {
|
|
3
3
|
pl: number;
|
|
4
|
+
core_offset?: number;
|
|
5
|
+
mem_offset?: number;
|
|
4
6
|
core_lock?: number;
|
|
5
7
|
mem_lock?: number;
|
|
6
|
-
mem_offset?: number;
|
|
7
|
-
core_offset?: number;
|
|
8
8
|
}
|
|
9
9
|
export interface CreateGigaspotOrdersRequestDataOrder {
|
|
10
10
|
currency: Currency;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { ResponseData } from '../types.js';
|
|
2
2
|
export interface EditGigaspotOrdersRequestDataOrderOverclock {
|
|
3
3
|
pl: number;
|
|
4
|
+
core_offset?: number;
|
|
5
|
+
mem_offset?: number;
|
|
4
6
|
core_lock?: number;
|
|
5
7
|
mem_lock?: number;
|
|
6
|
-
mem_offset?: number;
|
|
7
|
-
core_offset?: number;
|
|
8
8
|
}
|
|
9
9
|
export interface EditGigaspotOrdersRequestDataOrder {
|
|
10
10
|
order_id: number;
|
|
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
|
|
File without changes
|