@cosmoner/sdk 1.9.0 → 1.10.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 +13 -0
- package/dist/client.d.ts +3 -0
- package/dist/index.d.ts +9 -7
- package/dist/index.js +279 -1
- package/dist/index.mjs +278 -1
- package/dist/services/apps.d.ts +90 -0
- package/dist/services/buckets.d.ts +38 -0
- package/dist/services/catalog.d.ts +106 -0
- package/dist/services/databases.d.ts +31 -0
- package/dist/services/hosting.d.ts +52 -0
- package/dist/services/preview.d.ts +29 -0
- package/dist/services/redis.d.ts +31 -0
- package/dist/services/registries.d.ts +42 -0
- package/dist/services/servers.d.ts +34 -0
- package/dist/version.d.ts +2 -2
- package/package.json +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/** Hosting service namespace — shared web hosting sites and how to reach their files. */
|
|
2
2
|
import { type ResolvedConfig } from "../config";
|
|
3
|
+
import type { CheckoutPreview } from "./preview";
|
|
3
4
|
import type { Transport } from "../transport";
|
|
4
5
|
/** Lifecycle state of a hosting site. */
|
|
5
6
|
export type HostingSiteStatus = "PROVISIONING" | "ACTIVE" | "SUSPENDED" | "DEPROVISIONED" | "ERROR";
|
|
@@ -71,6 +72,45 @@ export type GetHostingSiteResponse = Envelope<HostingSite & {
|
|
|
71
72
|
export type GetHostingSiteWithCredentialsResponse = Envelope<HostingSiteWithCredentials>;
|
|
72
73
|
export type GetHostingAccessResponse = Envelope<HostingAccess>;
|
|
73
74
|
export type DeleteHostingSiteResponse = Envelope<Record<string, never>>;
|
|
75
|
+
/** A hosting plan. */
|
|
76
|
+
export type HostingTier = "STARTER" | "GROWTH" | "SCALE";
|
|
77
|
+
/** A hosting plan's price. `monthly` is in minor units. */
|
|
78
|
+
export interface HostingPrice {
|
|
79
|
+
tier: HostingTier;
|
|
80
|
+
monthly: number;
|
|
81
|
+
currency: string;
|
|
82
|
+
}
|
|
83
|
+
/** Arguments accepted by `client.hosting.preview()`. */
|
|
84
|
+
export interface PreviewHostingSiteParams extends ProjectScopedParams {
|
|
85
|
+
tier: HostingTier;
|
|
86
|
+
/** Extra storage in 10 GB blocks, up to 50. */
|
|
87
|
+
extraStorageGb?: number;
|
|
88
|
+
}
|
|
89
|
+
/** Arguments accepted by `client.hosting.create()`. */
|
|
90
|
+
export interface CreateHostingSiteParams extends ProjectScopedParams {
|
|
91
|
+
/** 3–40 characters: a lowercase letter, then lowercase letters, digits and underscores. */
|
|
92
|
+
siteName: string;
|
|
93
|
+
/** Defaults to `STARTER` server-side. */
|
|
94
|
+
tier?: HostingTier;
|
|
95
|
+
/** `8.1`, `8.2` or `8.3`; defaults to `8.3` server-side. */
|
|
96
|
+
phpVersion?: string;
|
|
97
|
+
/** Creates a MySQL database with this name alongside the site. */
|
|
98
|
+
database?: string;
|
|
99
|
+
extraStorageGb?: number;
|
|
100
|
+
}
|
|
101
|
+
export type ListHostingPricesResponse = Envelope<HostingPrice[]>;
|
|
102
|
+
export type PreviewHostingSiteResponse = Envelope<CheckoutPreview>;
|
|
103
|
+
export type CreateHostingSiteResponse = Envelope<{
|
|
104
|
+
tenantId: string;
|
|
105
|
+
status: HostingSiteStatus;
|
|
106
|
+
database?: {
|
|
107
|
+
id: string;
|
|
108
|
+
name: string;
|
|
109
|
+
status: string;
|
|
110
|
+
};
|
|
111
|
+
/** Set when the site was created but its database was not. */
|
|
112
|
+
databaseError?: string;
|
|
113
|
+
}>;
|
|
74
114
|
/** Read operations on a project's shared hosting sites. */
|
|
75
115
|
export declare class HostingService {
|
|
76
116
|
private readonly transport;
|
|
@@ -89,5 +129,17 @@ export declare class HostingService {
|
|
|
89
129
|
access(siteId: string, params?: ProjectScopedParams): Promise<GetHostingAccessResponse>;
|
|
90
130
|
/** Permanently deletes a hosting site with its files, databases and domains, and stops its billing. */
|
|
91
131
|
delete(siteId: string, params?: ProjectScopedParams): Promise<DeleteHostingSiteResponse>;
|
|
132
|
+
/** Lists hosting plans and their monthly prices. */
|
|
133
|
+
prices(params?: ProjectScopedParams): Promise<ListHostingPricesResponse>;
|
|
134
|
+
/** Prices a site before ordering it. `monthly` is exact; `dueToday` is an estimate once the project has a subscription. */
|
|
135
|
+
preview(params: PreviewHostingSiteParams): Promise<PreviewHostingSiteResponse>;
|
|
136
|
+
/**
|
|
137
|
+
* Orders a hosting site, and its database when one is named.
|
|
138
|
+
*
|
|
139
|
+
* Charges the project's saved card immediately, with a prorated invoice. It
|
|
140
|
+
* is refused with 402 before anything is created when the project cannot be
|
|
141
|
+
* billed.
|
|
142
|
+
*/
|
|
143
|
+
create(params: CreateHostingSiteParams): Promise<CreateHostingSiteResponse>;
|
|
92
144
|
}
|
|
93
145
|
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/** What the API quotes before a paid resource is ordered or resized. */
|
|
2
|
+
/**
|
|
3
|
+
* The price of a new resource. Amounts are integers in the currency's minor
|
|
4
|
+
* units (cents for USD).
|
|
5
|
+
*
|
|
6
|
+
* `monthly` is exact. `dueToday` is exact for a project's first paid
|
|
7
|
+
* resource; for a project that already has a subscription it is an estimate,
|
|
8
|
+
* because the real charge is prorated onto that subscription.
|
|
9
|
+
*/
|
|
10
|
+
export interface CheckoutPreview {
|
|
11
|
+
subtotal: number;
|
|
12
|
+
/** Null when the tax location could not be resolved. */
|
|
13
|
+
tax: number | null;
|
|
14
|
+
creditApplied: number;
|
|
15
|
+
dueToday: number;
|
|
16
|
+
/** The recurring monthly price, before tax. */
|
|
17
|
+
monthly: number;
|
|
18
|
+
/** Upper-case ISO code, e.g. `USD`. */
|
|
19
|
+
currency: string;
|
|
20
|
+
/** When the next invoice is drawn, as an ISO timestamp. */
|
|
21
|
+
nextBillingDate: string;
|
|
22
|
+
}
|
|
23
|
+
/** The price of moving an existing resource to another plan or size. */
|
|
24
|
+
export interface PlanChangePreview extends CheckoutPreview {
|
|
25
|
+
direction: "upgrade" | "downgrade";
|
|
26
|
+
/** Credit returned for the unused time on the current plan. */
|
|
27
|
+
creditBack: number;
|
|
28
|
+
currentMonthly: number;
|
|
29
|
+
}
|
package/dist/services/redis.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/** Redis service namespace — a project's managed Redis and Valkey databases. */
|
|
2
2
|
import { type ResolvedConfig } from "../config";
|
|
3
|
+
import type { CheckoutPreview } from "./preview";
|
|
3
4
|
import type { Transport } from "../transport";
|
|
4
5
|
/** A Redis database as the API lists it. The API returns more; the rest are present at runtime. */
|
|
5
6
|
export interface RedisDatabase {
|
|
@@ -41,6 +42,25 @@ interface Envelope<T> {
|
|
|
41
42
|
export type ListRedisDatabasesResponse = Envelope<RedisDatabase[]>;
|
|
42
43
|
export type GetRedisDatabaseResponse = Envelope<RedisDatabaseDetail>;
|
|
43
44
|
export type DeleteRedisDatabaseResponse = Envelope<Record<string, never>>;
|
|
45
|
+
/** How a Redis database keeps its data across restarts. */
|
|
46
|
+
export type RedisPersistence = "NONE" | "AOF_EVERY_WRITE" | "AOF_EVERY_1_SECOND" | "SNAPSHOT_EVERY_1_HOUR" | "SNAPSHOT_EVERY_6_HOURS" | "SNAPSHOT_EVERY_12_HOURS";
|
|
47
|
+
/** Arguments accepted by `client.redis.preview()`. */
|
|
48
|
+
export interface PreviewRedisParams extends ProjectScopedParams {
|
|
49
|
+
/** A plan slug from `client.catalog.redisPlans()`. */
|
|
50
|
+
plan: string;
|
|
51
|
+
}
|
|
52
|
+
/** Arguments accepted by `client.redis.create()`. */
|
|
53
|
+
export interface CreateRedisParams extends PreviewRedisParams {
|
|
54
|
+
name: string;
|
|
55
|
+
/** A region slug from `client.catalog.redisRegions()`. */
|
|
56
|
+
region: string;
|
|
57
|
+
/** Defaults to `NONE` server-side. */
|
|
58
|
+
persistence?: RedisPersistence;
|
|
59
|
+
}
|
|
60
|
+
export type PreviewRedisResponse = Envelope<CheckoutPreview>;
|
|
61
|
+
export type CreateRedisResponse = Envelope<{
|
|
62
|
+
deployed: true;
|
|
63
|
+
}>;
|
|
44
64
|
/** Read operations on a project's Redis databases. */
|
|
45
65
|
export declare class RedisService {
|
|
46
66
|
private readonly transport;
|
|
@@ -54,5 +74,16 @@ export declare class RedisService {
|
|
|
54
74
|
get(redisId: string, params?: ProjectScopedParams): Promise<GetRedisDatabaseResponse>;
|
|
55
75
|
/** Permanently deletes a Redis database and its data, and stops its billing. */
|
|
56
76
|
delete(redisId: string, params?: ProjectScopedParams): Promise<DeleteRedisDatabaseResponse>;
|
|
77
|
+
/** Prices a Redis database before ordering it. `monthly` is exact; `dueToday` is an estimate once the project has a subscription. */
|
|
78
|
+
preview(params: PreviewRedisParams): Promise<PreviewRedisResponse>;
|
|
79
|
+
/**
|
|
80
|
+
* Orders a Redis database. It starts `CREATING`; the response carries no
|
|
81
|
+
* id, so list and match the name to follow it.
|
|
82
|
+
*
|
|
83
|
+
* Charges the project's saved card immediately, with a prorated invoice. It
|
|
84
|
+
* is refused with 402 before anything is created when the project cannot be
|
|
85
|
+
* billed.
|
|
86
|
+
*/
|
|
87
|
+
create(params: CreateRedisParams): Promise<CreateRedisResponse>;
|
|
57
88
|
}
|
|
58
89
|
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/** Registries service namespace — a project's container registries. */
|
|
2
2
|
import { type ResolvedConfig } from "../config";
|
|
3
|
+
import type { CheckoutPreview } from "./preview";
|
|
3
4
|
import type { Transport } from "../transport";
|
|
4
5
|
/** One repository in a registry. */
|
|
5
6
|
export interface RegistryRepository {
|
|
@@ -33,6 +34,31 @@ interface Envelope<T> {
|
|
|
33
34
|
export type ListRegistriesResponse = Envelope<Registry[]>;
|
|
34
35
|
export type GetRegistryResponse = Envelope<Registry>;
|
|
35
36
|
export type DeleteRegistryResponse = Envelope<Record<string, never>>;
|
|
37
|
+
/** A registry provider and the regions it offers. */
|
|
38
|
+
export interface RegistryProvider {
|
|
39
|
+
value: string;
|
|
40
|
+
label: string;
|
|
41
|
+
description: string;
|
|
42
|
+
regions: Array<{
|
|
43
|
+
value: string;
|
|
44
|
+
label: string;
|
|
45
|
+
}>;
|
|
46
|
+
}
|
|
47
|
+
/** Arguments accepted by `client.registries.create()`. */
|
|
48
|
+
export interface CreateRegistryParams extends ProjectScopedParams {
|
|
49
|
+
/** 3–33 lowercase letters, digits and hyphens; unique in the project. */
|
|
50
|
+
name: string;
|
|
51
|
+
/** A region from `providers()`. */
|
|
52
|
+
region: string;
|
|
53
|
+
/** A provider from `providers()`. Defaults to `AWS_ECR` server-side. */
|
|
54
|
+
provider?: string;
|
|
55
|
+
}
|
|
56
|
+
export type PreviewRegistryResponse = Envelope<CheckoutPreview>;
|
|
57
|
+
export type ListRegistryProvidersResponse = Envelope<RegistryProvider[]>;
|
|
58
|
+
export type CreateRegistryResponse = Envelope<{
|
|
59
|
+
deployed: true;
|
|
60
|
+
id: string;
|
|
61
|
+
}>;
|
|
36
62
|
/** Read operations on a project's container registries. */
|
|
37
63
|
export declare class RegistriesService {
|
|
38
64
|
private readonly transport;
|
|
@@ -46,5 +72,21 @@ export declare class RegistriesService {
|
|
|
46
72
|
get(registryId: string, params?: ProjectScopedParams): Promise<GetRegistryResponse>;
|
|
47
73
|
/** Permanently deletes a registry with every repository and image in it, and stops its billing. */
|
|
48
74
|
delete(registryId: string, params?: ProjectScopedParams): Promise<DeleteRegistryResponse>;
|
|
75
|
+
/**
|
|
76
|
+
* Prices a registry's base fee before ordering it. Storage and egress are
|
|
77
|
+
* metered and not included. `monthly` is exact; `dueToday` is an estimate
|
|
78
|
+
* once the project has a subscription.
|
|
79
|
+
*/
|
|
80
|
+
preview(params?: ProjectScopedParams): Promise<PreviewRegistryResponse>;
|
|
81
|
+
/** Lists the providers a registry can be created with, and their regions. */
|
|
82
|
+
providers(params?: ProjectScopedParams): Promise<ListRegistryProvidersResponse>;
|
|
83
|
+
/**
|
|
84
|
+
* Orders a registry. It is ready when this returns.
|
|
85
|
+
*
|
|
86
|
+
* Charges the project's saved card immediately, with a prorated invoice. It
|
|
87
|
+
* is refused with 402 before anything is created when the project cannot be
|
|
88
|
+
* billed.
|
|
89
|
+
*/
|
|
90
|
+
create(params: CreateRegistryParams): Promise<CreateRegistryResponse>;
|
|
49
91
|
}
|
|
50
92
|
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/** Servers service namespace — a project's virtual servers. */
|
|
2
2
|
import { type ResolvedConfig } from "../config";
|
|
3
|
+
import type { CheckoutPreview } from "./preview";
|
|
3
4
|
import type { Transport } from "../transport";
|
|
4
5
|
export type ServerStatus = "PROVISIONING" | "RUNNING" | "STOPPED" | "ERROR" | "TERMINATED";
|
|
5
6
|
/** A server as the API lists it. The API returns more; the rest are present at runtime. */
|
|
@@ -42,6 +43,28 @@ interface Envelope<T> {
|
|
|
42
43
|
export type ListServersResponse = Envelope<Server[]>;
|
|
43
44
|
export type GetServerResponse = Envelope<ServerDetail>;
|
|
44
45
|
export type DeleteServerResponse = Envelope<Record<string, never>>;
|
|
46
|
+
/** Arguments accepted by `client.servers.preview()`. */
|
|
47
|
+
export interface PreviewServerParams extends ProjectScopedParams {
|
|
48
|
+
/** A size slug from `client.catalog.serverSizes()`. */
|
|
49
|
+
size: string;
|
|
50
|
+
/** Defaults to `digitalocean`, the only provider on sale. */
|
|
51
|
+
provider?: string;
|
|
52
|
+
}
|
|
53
|
+
/** Arguments accepted by `client.servers.create()`. */
|
|
54
|
+
export interface CreateServerParams extends PreviewServerParams {
|
|
55
|
+
/** Lowercase letters, digits and hyphens. */
|
|
56
|
+
name: string;
|
|
57
|
+
/** A region slug from `client.catalog.serverRegions()`. */
|
|
58
|
+
region: string;
|
|
59
|
+
/** A one-click image slug from `client.catalog.serverImages()`. */
|
|
60
|
+
image?: string;
|
|
61
|
+
/** SSH keys to install, by id. */
|
|
62
|
+
sshKeyIds?: string[];
|
|
63
|
+
}
|
|
64
|
+
export type PreviewServerResponse = Envelope<CheckoutPreview>;
|
|
65
|
+
export type CreateServerResponse = Envelope<{
|
|
66
|
+
deployed: true;
|
|
67
|
+
}>;
|
|
45
68
|
/** Read operations on a project's servers. */
|
|
46
69
|
export declare class ServersService {
|
|
47
70
|
private readonly transport;
|
|
@@ -55,5 +78,16 @@ export declare class ServersService {
|
|
|
55
78
|
get(serverId: string, params?: ProjectScopedParams): Promise<GetServerResponse>;
|
|
56
79
|
/** Permanently deletes a server and its disk, and stops its billing. */
|
|
57
80
|
delete(serverId: string, params?: ProjectScopedParams): Promise<DeleteServerResponse>;
|
|
81
|
+
/** Prices a server before ordering it. `monthly` is exact; `dueToday` is an estimate once the project has a subscription. */
|
|
82
|
+
preview(params: PreviewServerParams): Promise<PreviewServerResponse>;
|
|
83
|
+
/**
|
|
84
|
+
* Orders a server. It starts `PROVISIONING`; the response carries no id, so
|
|
85
|
+
* list servers and match the name to follow it.
|
|
86
|
+
*
|
|
87
|
+
* Charges the project's saved card immediately, with a prorated invoice. It
|
|
88
|
+
* is refused with 402 before anything is created when the project cannot be
|
|
89
|
+
* billed.
|
|
90
|
+
*/
|
|
91
|
+
create(params: CreateServerParams): Promise<CreateServerResponse>;
|
|
58
92
|
}
|
|
59
93
|
export {};
|
package/dist/version.d.ts
CHANGED
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
* the release workflow runs that straight after `npm version`, and
|
|
9
9
|
* `version.test.ts` fails the build if the two ever disagree.
|
|
10
10
|
*/
|
|
11
|
-
export declare const VERSION = "1.
|
|
12
|
-
export declare const USER_AGENT = "cosmoner-node/1.
|
|
11
|
+
export declare const VERSION = "1.10.0";
|
|
12
|
+
export declare const USER_AGENT = "cosmoner-node/1.10.0";
|