cloreai 0.1.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.
Files changed (42) hide show
  1. package/README.md +0 -0
  2. package/build/CloreAI.d.ts +26 -0
  3. package/build/CloreAI.js +84 -0
  4. package/build/WebAPI.d.ts +10 -0
  5. package/build/WebAPI.js +40 -0
  6. package/build/constants.d.ts +4 -0
  7. package/build/constants.js +14 -0
  8. package/build/errors.d.ts +23 -0
  9. package/build/errors.js +43 -0
  10. package/build/index.d.ts +19 -0
  11. package/build/index.js +19 -0
  12. package/build/types/cloreai/cancelOrder.d.ts +7 -0
  13. package/build/types/cloreai/cancelOrder.js +1 -0
  14. package/build/types/cloreai/createOrder.d.ts +25 -0
  15. package/build/types/cloreai/createOrder.js +1 -0
  16. package/build/types/cloreai/marketplace.d.ts +14 -0
  17. package/build/types/cloreai/marketplace.js +1 -0
  18. package/build/types/cloreai/myOrders.d.ts +28 -0
  19. package/build/types/cloreai/myOrders.js +1 -0
  20. package/build/types/cloreai/myServers.d.ts +16 -0
  21. package/build/types/cloreai/myServers.js +1 -0
  22. package/build/types/cloreai/serverConfig.d.ts +29 -0
  23. package/build/types/cloreai/serverConfig.js +1 -0
  24. package/build/types/cloreai/setServerSettings.d.ts +10 -0
  25. package/build/types/cloreai/setServerSettings.js +1 -0
  26. package/build/types/cloreai/setSpotPrice.d.ts +17 -0
  27. package/build/types/cloreai/setSpotPrice.js +1 -0
  28. package/build/types/cloreai/spotMarketplace.d.ts +25 -0
  29. package/build/types/cloreai/spotMarketplace.js +1 -0
  30. package/build/types/cloreai/wallets.d.ts +11 -0
  31. package/build/types/cloreai/wallets.js +1 -0
  32. package/build/types/common.d.ts +30 -0
  33. package/build/types/common.js +1 -0
  34. package/build/types/options.d.ts +10 -0
  35. package/build/types/options.js +1 -0
  36. package/build/types/output.d.ts +9 -0
  37. package/build/types/output.js +1 -0
  38. package/build/types/webapi/createOrder.d.ts +5 -0
  39. package/build/types/webapi/createOrder.js +1 -0
  40. package/build/types/webapi/marketplaceServers.d.ts +25 -0
  41. package/build/types/webapi/marketplaceServers.js +1 -0
  42. package/package.json +47 -0
package/README.md ADDED
File without changes
@@ -0,0 +1,26 @@
1
+ import { type AxiosInstance } 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 Options } from './types/options.js';
13
+ export declare class CloreAI {
14
+ readonly api: AxiosInstance;
15
+ constructor(options: Options);
16
+ wallets(): Promise<WalletsOutput>;
17
+ myServers(): Promise<MyServersOutput>;
18
+ serverConfig(body: ServerConfigBody): Promise<ServerConfigOutput>;
19
+ marketplace(): Promise<MarketplaceOutput>;
20
+ myOrders(params?: MyOrdersParams): Promise<MyOrdersOutput>;
21
+ spotMarketplace(params: SpotMarketplaceParams): Promise<SpotMarketplaceOutput>;
22
+ setServerSettings(body: SetServerSettingsBody): Promise<SetServerSettingsOutput>;
23
+ setSpotPrice(body: SetSpotPriceBody): Promise<SetSpotPriceOutput>;
24
+ cancelOrder(body: CancelOrderBody): Promise<CancelOrderOutput>;
25
+ createOrder(body: CreateOrderBody): Promise<CreateOrderOutput>;
26
+ }
@@ -0,0 +1,84 @@
1
+ import axios from 'axios';
2
+ import { statusCodes } from './constants.js';
3
+ import { CustomError, DatabaseError, ExceededError, InvalidApiTokenError, InvalidEndpointError, InvalidInputDataError, UnknownError } from './errors.js';
4
+ export class CloreAI {
5
+ api;
6
+ constructor(options) {
7
+ const { apiKey, axiosConfig = {} } = options;
8
+ this.api = axios.create({
9
+ ...axiosConfig,
10
+ baseURL: 'https://api.clore.ai/v1',
11
+ headers: {
12
+ ...axiosConfig.headers,
13
+ auth: apiKey,
14
+ },
15
+ });
16
+ this.api.interceptors.response.use((response) => {
17
+ if (response.data.code === statusCodes['NORMAL']) {
18
+ return response;
19
+ }
20
+ const statusCodeMessage = response.data.code != null ? `Status code "${response.data.code}".` : null;
21
+ const errorFieldMessage = response.data.error != null ? `Error field "${response.data.error}".` : null;
22
+ const errorMessageArray = [statusCodeMessage, errorFieldMessage].filter((message) => {
23
+ return message != null;
24
+ });
25
+ const errorMessage = errorMessageArray.join(' ');
26
+ switch (response.data.code) {
27
+ case statusCodes['DATABASE_ERROR']:
28
+ throw new DatabaseError(errorMessage, undefined, response.config, response.request, response);
29
+ case statusCodes['INVALID_INPUT_DATA']:
30
+ throw new InvalidInputDataError(errorMessage, undefined, response.config, response.request, response);
31
+ case statusCodes['INVALID_API_TOKEN']:
32
+ throw new InvalidApiTokenError(errorMessage, undefined, response.config, response.request, response);
33
+ case statusCodes['INVALID_ENDPOINT']:
34
+ throw new InvalidEndpointError(errorMessage, undefined, response.config, response.request, response);
35
+ case statusCodes['EXCEEDED']:
36
+ throw new ExceededError(errorMessage, undefined, response.config, response.request, response);
37
+ case statusCodes['ERROR']:
38
+ throw new CustomError(errorMessage, undefined, response.config, response.request, response);
39
+ default:
40
+ throw new UnknownError(errorMessage, undefined, response.config, response.request, response);
41
+ }
42
+ });
43
+ }
44
+ async wallets() {
45
+ const response = await this.api.get('/wallets');
46
+ return response.data;
47
+ }
48
+ async myServers() {
49
+ const response = await this.api.get('/my_servers');
50
+ return response.data;
51
+ }
52
+ async serverConfig(body) {
53
+ const response = await this.api.get('/server_config', { data: body });
54
+ return response.data;
55
+ }
56
+ async marketplace() {
57
+ const response = await this.api.get('/marketplace');
58
+ return response.data;
59
+ }
60
+ async myOrders(params) {
61
+ const response = await this.api.get('/my_orders', { params });
62
+ return response.data;
63
+ }
64
+ async spotMarketplace(params) {
65
+ const response = await this.api.get('/spot_marketplace', { params });
66
+ return response.data;
67
+ }
68
+ async setServerSettings(body) {
69
+ const response = await this.api.post('/set_server_settings', body);
70
+ return response.data;
71
+ }
72
+ async setSpotPrice(body) {
73
+ const response = await this.api.post('/set_spot_price', body);
74
+ return response.data;
75
+ }
76
+ async cancelOrder(body) {
77
+ const response = await this.api.post('/cancel_order', body);
78
+ return response.data;
79
+ }
80
+ async createOrder(body) {
81
+ const response = await this.api.post('/create_order', body);
82
+ return response.data;
83
+ }
84
+ }
@@ -0,0 +1,10 @@
1
+ import { type AxiosInstance } from 'axios';
2
+ import { type WebOptions } from './types/options.js';
3
+ import { type WebCreateOrderBody, type WebCreateOrderOutput } from './types/webapi/createOrder.js';
4
+ import { type WebMarketplaceServersOutput } from './types/webapi/marketplaceServers.js';
5
+ export declare class WebAPI {
6
+ readonly api: AxiosInstance;
7
+ constructor(options: WebOptions);
8
+ marketplaceServers(): Promise<WebMarketplaceServersOutput>;
9
+ createOrder(body: WebCreateOrderBody): Promise<WebCreateOrderOutput>;
10
+ }
@@ -0,0 +1,40 @@
1
+ import axios from 'axios';
2
+ import { webStatusCodes } from './constants.js';
3
+ import { UnknownError } from './errors.js';
4
+ export class WebAPI {
5
+ api;
6
+ constructor(options) {
7
+ const { token, axiosConfig = {} } = options;
8
+ this.api = axios.create({
9
+ ...axiosConfig,
10
+ baseURL: 'https://clore.ai/webapi',
11
+ });
12
+ this.api.interceptors.request.use((request) => {
13
+ request.data = {
14
+ ...request.data,
15
+ token,
16
+ };
17
+ return request;
18
+ });
19
+ this.api.interceptors.response.use((response) => {
20
+ if (response.data.status === webStatusCodes['NORMAL']) {
21
+ return response;
22
+ }
23
+ const statusCodeMessage = response.data.status != null ? `Status code "${response.data.status}".` : null;
24
+ const errorFieldMessage = response.data.error != null ? `Error field "${response.data.error}".` : null;
25
+ const errorMessageArray = [statusCodeMessage, errorFieldMessage].filter((message) => {
26
+ return message != null;
27
+ });
28
+ const errorMessage = errorMessageArray.join(' ');
29
+ throw new UnknownError(errorMessage, undefined, response.config, response.request, response);
30
+ });
31
+ }
32
+ async marketplaceServers() {
33
+ const response = await this.api.post('/marketplace/servers');
34
+ return response.data;
35
+ }
36
+ async createOrder(body) {
37
+ const response = await this.api.post('/create_order', body);
38
+ return response.data;
39
+ }
40
+ }
@@ -0,0 +1,4 @@
1
+ export declare const GLOBAL_RATE_LIMIT = 1000;
2
+ export declare const CREATE_ORDER_RATE_LIMIT = 5000;
3
+ export declare const statusCodes: Record<string, number>;
4
+ export declare const webStatusCodes: Record<string, string>;
@@ -0,0 +1,14 @@
1
+ export const GLOBAL_RATE_LIMIT = 1_000;
2
+ export const CREATE_ORDER_RATE_LIMIT = 5_000;
3
+ export const statusCodes = {
4
+ NORMAL: 0,
5
+ DATABASE_ERROR: 1,
6
+ INVALID_INPUT_DATA: 2,
7
+ INVALID_API_TOKEN: 3,
8
+ INVALID_ENDPOINT: 4,
9
+ EXCEEDED: 5,
10
+ ERROR: 6,
11
+ };
12
+ export const webStatusCodes = {
13
+ NORMAL: 'ok',
14
+ };
@@ -0,0 +1,23 @@
1
+ import { AxiosError } from 'axios';
2
+ export type AxiosErrorParameters = ConstructorParameters<typeof AxiosError>;
3
+ export declare class DatabaseError extends AxiosError {
4
+ constructor(...args: AxiosErrorParameters);
5
+ }
6
+ export declare class InvalidInputDataError extends AxiosError {
7
+ constructor(...args: AxiosErrorParameters);
8
+ }
9
+ export declare class InvalidApiTokenError extends AxiosError {
10
+ constructor(...args: AxiosErrorParameters);
11
+ }
12
+ export declare class InvalidEndpointError extends AxiosError {
13
+ constructor(...args: AxiosErrorParameters);
14
+ }
15
+ export declare class ExceededError extends AxiosError {
16
+ constructor(...args: AxiosErrorParameters);
17
+ }
18
+ export declare class CustomError extends AxiosError {
19
+ constructor(...args: AxiosErrorParameters);
20
+ }
21
+ export declare class UnknownError extends AxiosError {
22
+ constructor(...args: AxiosErrorParameters);
23
+ }
@@ -0,0 +1,43 @@
1
+ import { AxiosError } from 'axios';
2
+ export class DatabaseError extends AxiosError {
3
+ constructor(...args) {
4
+ super(...args);
5
+ this.name = 'DatabaseError';
6
+ }
7
+ }
8
+ export class InvalidInputDataError extends AxiosError {
9
+ constructor(...args) {
10
+ super(...args);
11
+ this.name = 'InvalidInputDataError';
12
+ }
13
+ }
14
+ export class InvalidApiTokenError extends AxiosError {
15
+ constructor(...args) {
16
+ super(...args);
17
+ this.name = 'InvalidApiTokenError';
18
+ }
19
+ }
20
+ export class InvalidEndpointError extends AxiosError {
21
+ constructor(...args) {
22
+ super(...args);
23
+ this.name = 'InvalidEndpointError';
24
+ }
25
+ }
26
+ export class ExceededError extends AxiosError {
27
+ constructor(...args) {
28
+ super(...args);
29
+ this.name = 'ExceededError';
30
+ }
31
+ }
32
+ export class CustomError extends AxiosError {
33
+ constructor(...args) {
34
+ super(...args);
35
+ this.name = 'CustomError';
36
+ }
37
+ }
38
+ export class UnknownError extends AxiosError {
39
+ constructor(...args) {
40
+ super(...args);
41
+ this.name = 'UnknownError';
42
+ }
43
+ }
@@ -0,0 +1,19 @@
1
+ export { CloreAI as default } from './CloreAI.js';
2
+ export * from './constants.js';
3
+ export * from './errors.js';
4
+ export * from './types/cloreai/cancelOrder.js';
5
+ export * from './types/cloreai/createOrder.js';
6
+ export * from './types/cloreai/marketplace.js';
7
+ export * from './types/cloreai/myOrders.js';
8
+ export * from './types/cloreai/myServers.js';
9
+ export * from './types/cloreai/serverConfig.js';
10
+ export * from './types/cloreai/setServerSettings.js';
11
+ export * from './types/cloreai/setSpotPrice.js';
12
+ export * from './types/cloreai/spotMarketplace.js';
13
+ export * from './types/cloreai/wallets.js';
14
+ export * from './types/common.js';
15
+ export * from './types/options.js';
16
+ export * from './types/output.js';
17
+ export * from './types/webapi/createOrder.js';
18
+ export * from './types/webapi/marketplaceServers.js';
19
+ export * from './WebAPI.js';
package/build/index.js ADDED
@@ -0,0 +1,19 @@
1
+ export { CloreAI as default } from './CloreAI.js';
2
+ export * from './constants.js';
3
+ export * from './errors.js';
4
+ export * from './types/cloreai/cancelOrder.js';
5
+ export * from './types/cloreai/createOrder.js';
6
+ export * from './types/cloreai/marketplace.js';
7
+ export * from './types/cloreai/myOrders.js';
8
+ export * from './types/cloreai/myServers.js';
9
+ export * from './types/cloreai/serverConfig.js';
10
+ export * from './types/cloreai/setServerSettings.js';
11
+ export * from './types/cloreai/setSpotPrice.js';
12
+ export * from './types/cloreai/spotMarketplace.js';
13
+ export * from './types/cloreai/wallets.js';
14
+ export * from './types/common.js';
15
+ export * from './types/options.js';
16
+ export * from './types/output.js';
17
+ export * from './types/webapi/createOrder.js';
18
+ export * from './types/webapi/marketplaceServers.js';
19
+ export * from './WebAPI.js';
@@ -0,0 +1,7 @@
1
+ import { type Output } from '../output.js';
2
+ export interface CancelOrderBody {
3
+ id: number;
4
+ issue?: string;
5
+ }
6
+ export interface CancelOrderOutput extends Output {
7
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,25 @@
1
+ import { type Currency } from '../common.js';
2
+ import { type Output } from '../output.js';
3
+ export interface CreateOrderCommon {
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
+ }
16
+ export interface CreateOrderOnDemand extends CreateOrderCommon {
17
+ type: 'on-demand';
18
+ }
19
+ export interface CreateOrderSpot extends CreateOrderCommon {
20
+ type: 'spot';
21
+ spotprice: number;
22
+ }
23
+ export type CreateOrderBody = CreateOrderOnDemand | CreateOrderSpot;
24
+ export interface CreateOrderOutput extends Output {
25
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,14 @@
1
+ import { type Price, type Specs } from '../common.js';
2
+ import { type Output } from '../output.js';
3
+ export interface MarketplaceServer {
4
+ id: number;
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[];
13
+ my_servers: number[];
14
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,28 @@
1
+ import { type Currency, type Specs } from '../common.js';
2
+ import { type Output } from '../output.js';
3
+ export interface MyOrdersParams {
4
+ return_completed?: boolean;
5
+ }
6
+ export interface MyOrdersOrder {
7
+ id: number;
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[];
27
+ limit: number;
28
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,16 @@
1
+ import { type Pricing, type Specs, type Visibility } from '../common.js';
2
+ import { type Output } from '../output.js';
3
+ export interface MyServersServer {
4
+ name: string;
5
+ connected: boolean;
6
+ visibility: Visibility;
7
+ pricing: Pricing;
8
+ online: boolean;
9
+ min_spot_pricing: Pricing;
10
+ init_token: string;
11
+ specs: Specs;
12
+ }
13
+ export interface MyServersOutput extends Output {
14
+ servers: MyServersServer[];
15
+ limit: number;
16
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,29 @@
1
+ import { type Pricing, type Specs, type Visibility } from '../common.js';
2
+ import { type Output } from '../output.js';
3
+ export interface ServerConfigBody {
4
+ server_name: string;
5
+ }
6
+ export interface ServerConfigConfigBackgroundJob {
7
+ times_updated: number;
8
+ image: string;
9
+ command: string;
10
+ env: Record<string, string>;
11
+ }
12
+ export interface ServerConfigConfig {
13
+ name: string;
14
+ connected: boolean;
15
+ visibility: Visibility;
16
+ pricing: Pricing;
17
+ spot_pricing: Pricing;
18
+ mrl: number;
19
+ online: boolean;
20
+ initialized: boolean;
21
+ id: number;
22
+ rental_status: number;
23
+ specs: Specs;
24
+ background_job: ServerConfigConfigBackgroundJob;
25
+ }
26
+ export interface ServerConfigOutput extends Output {
27
+ config: ServerConfigConfig;
28
+ creation_completed: boolean;
29
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,10 @@
1
+ import { type Output } from '../output.js';
2
+ export interface SetServerSettingsBody {
3
+ name: string;
4
+ availability: boolean;
5
+ mrl: number;
6
+ on_demand: number;
7
+ spot: number;
8
+ }
9
+ export interface SetServerSettingsOutput extends Output {
10
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,17 @@
1
+ import { type Output } from '../output.js';
2
+ export interface SetSpotPriceBody {
3
+ order_id: number;
4
+ desired_price: number;
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;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,25 @@
1
+ import { type Pricing, type Visibility } from '../common.js';
2
+ import { type Output } from '../output.js';
3
+ export interface SpotMarketplaceParams {
4
+ market: number;
5
+ }
6
+ export interface SpotMarketplaceMarketOffer {
7
+ offer_id: number;
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;
24
+ exists: boolean;
25
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,11 @@
1
+ import { type Currency } from '../common.js';
2
+ import { type Output } from '../output.js';
3
+ export interface WalletsWallet {
4
+ name: Currency;
5
+ deposit: string;
6
+ balance: number;
7
+ withdrawal_fee: number;
8
+ }
9
+ export interface WalletsOutput extends Output {
10
+ wallets: WalletsWallet[];
11
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,30 @@
1
+ export type OrderType = 'on-demand' | 'spot';
2
+ export type Visibility = 'public' | 'hidden';
3
+ export type Currency = 'CLORE-Blockchain' | 'bitcoin';
4
+ export type Pricing = Record<Currency, number>;
5
+ export interface Price {
6
+ on_demand: Pricing;
7
+ spot: Pricing;
8
+ }
9
+ export interface Net {
10
+ cc: string;
11
+ down: number;
12
+ up: number;
13
+ }
14
+ export interface Specs {
15
+ mb: string;
16
+ cpu: string;
17
+ cpus: string;
18
+ ram: number;
19
+ disk: string;
20
+ disk_speed: number;
21
+ gpu: string;
22
+ gpuram: number;
23
+ net: Net;
24
+ backend_version: number;
25
+ pcie_rev: number;
26
+ pcie_width: number;
27
+ pl: number[];
28
+ stock_oc_override: boolean;
29
+ stock_pl: number[];
30
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,10 @@
1
+ import { type CreateAxiosDefaults } from 'axios';
2
+ export interface CommonOptions {
3
+ axiosConfig?: CreateAxiosDefaults;
4
+ }
5
+ export interface Options extends CommonOptions {
6
+ apiKey: string;
7
+ }
8
+ export interface WebOptions extends CommonOptions {
9
+ token: string;
10
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,9 @@
1
+ export interface CommonOutput<T = string> {
2
+ error?: T | undefined;
3
+ }
4
+ export interface Output<T = string> extends CommonOutput<T> {
5
+ code: number;
6
+ }
7
+ export interface WebOutput<T = string> extends CommonOutput<T> {
8
+ status: string;
9
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ import { type CreateOrderBody } from '../cloreai/createOrder.js';
2
+ import { type WebOutput } from '../output.js';
3
+ export type WebCreateOrderBody = CreateOrderBody;
4
+ export interface WebCreateOrderOutput extends WebOutput {
5
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,25 @@
1
+ import { type Currency, type Price, type Specs } from '../common.js';
2
+ import { type WebOutput } from '../output.js';
3
+ export interface WebMarketplaceServersServerRating {
4
+ avg: number;
5
+ cnt: number;
6
+ }
7
+ export interface WebMarketplaceServersServer {
8
+ id: number;
9
+ owner: number;
10
+ mrl: number;
11
+ price: Price;
12
+ rented: boolean;
13
+ specs: Specs;
14
+ reliability: number;
15
+ allowed_coins: Currency[];
16
+ rating: WebMarketplaceServersServerRating;
17
+ cuda_version: string;
18
+ }
19
+ export interface WebMarketplaceServersOutput extends WebOutput {
20
+ all_servers: WebMarketplaceServersServer[];
21
+ creation_fees: number;
22
+ disable_usd: number;
23
+ my_servers: number;
24
+ not_rented_available_servers: number;
25
+ }
@@ -0,0 +1 @@
1
+ export {};
package/package.json ADDED
@@ -0,0 +1,47 @@
1
+ {
2
+ "name": "cloreai",
3
+ "version": "0.1.0",
4
+ "description": "CLORE.AI API client",
5
+ "keywords": [
6
+ "cloreai",
7
+ "clore",
8
+ "api"
9
+ ],
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "git+https://github.com/vladpuz/cloreai.git"
13
+ },
14
+ "license": "MIT",
15
+ "author": "Vladislav Puzyrev",
16
+ "type": "module",
17
+ "main": "build/index.js",
18
+ "types": "build/index.d.ts",
19
+ "scripts": {
20
+ "build": "tsc --project tsconfig.build.json",
21
+ "check": "npm run typecheck && npm run lint && npm run format",
22
+ "clean": "rimraf build",
23
+ "format": "prettier --check .",
24
+ "lint": "eslint .",
25
+ "prepack": "npm run clean && npm run build && npm run check",
26
+ "prepare": "husky",
27
+ "start-playground": "node playground/main.js",
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"
32
+ },
33
+ "dependencies": {
34
+ "axios": "^1.7.2"
35
+ },
36
+ "devDependencies": {
37
+ "@tsconfig/strictest": "^2.0.5",
38
+ "eslint": "^8.57.0",
39
+ "eslint-config-vladpuz": "^0.7.0",
40
+ "husky": "^9.0.11",
41
+ "npm-check-updates": "^16.14.20",
42
+ "prettier": "^3.3.3",
43
+ "prettier-config-vladpuz": "^0.3.0",
44
+ "rimraf": "^6.0.1",
45
+ "typescript": "^5.5.3"
46
+ }
47
+ }