@cosmoner/sdk 1.8.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.
@@ -1,5 +1,6 @@
1
1
  /** Buckets service namespace — a project's object storage buckets. */
2
2
  import { type ResolvedConfig } from "../config";
3
+ import type { CheckoutPreview } from "./preview";
3
4
  import type { Transport } from "../transport";
4
5
  /** A bucket as the API lists it. Its access keys are never part of a listing. */
5
6
  export interface Bucket {
@@ -26,6 +27,29 @@ interface Envelope<T> {
26
27
  data: T;
27
28
  }
28
29
  export type ListBucketsResponse = Envelope<Bucket[]>;
30
+ export type DeleteBucketResponse = Envelope<Record<string, never>>;
31
+ /** A bucket's plan. */
32
+ export type BucketTier = "STARTER" | "GROWTH" | "SCALE" | "ENTERPRISE";
33
+ /** Arguments accepted by `client.buckets.preview()`. */
34
+ export interface PreviewBucketParams extends ProjectScopedParams {
35
+ /** Defaults to `STARTER`. */
36
+ tier?: BucketTier;
37
+ }
38
+ /** Arguments accepted by `client.buckets.create()`. */
39
+ export interface CreateBucketParams extends PreviewBucketParams {
40
+ /** 3–33 lowercase letters, digits and hyphens; unique in the project. */
41
+ name: string;
42
+ /** An AWS region, e.g. `eu-north-1`. */
43
+ region: string;
44
+ publicAccess?: boolean;
45
+ versioning?: boolean;
46
+ /** Needs `publicAccess`. CDN traffic is metered on top of the tier. */
47
+ cdnEnabled?: boolean;
48
+ }
49
+ export type PreviewBucketResponse = Envelope<CheckoutPreview>;
50
+ export type CreateBucketResponse = Envelope<{
51
+ deployed: true;
52
+ }>;
29
53
  /** Read operations on a project's buckets. The API has no single-bucket read. */
30
54
  export declare class BucketsService {
31
55
  private readonly transport;
@@ -33,5 +57,27 @@ export declare class BucketsService {
33
57
  constructor(transport: Transport, config: ResolvedConfig);
34
58
  /** Lists every bucket in the project. */
35
59
  list(params?: ProjectScopedParams): Promise<ListBucketsResponse>;
60
+ /**
61
+ * Permanently deletes a bucket with every object in it and the access
62
+ * credentials made for it, and stops its billing.
63
+ */
64
+ delete(bucketId: string, params?: ProjectScopedParams): Promise<DeleteBucketResponse>;
65
+ /** Builds the collection route for the resolved project. */
66
+ private basePath;
67
+ /**
68
+ * Prices a bucket's tier before ordering it. CDN traffic is metered and not
69
+ * included. `monthly` is exact; `dueToday` is an estimate once the project
70
+ * has a subscription.
71
+ */
72
+ preview(params?: PreviewBucketParams): Promise<PreviewBucketResponse>;
73
+ /**
74
+ * Orders a bucket. It is ready when this returns; names are unique, so list
75
+ * and match the name to read it.
76
+ *
77
+ * Charges the project's saved card immediately, with a prorated invoice. It
78
+ * is refused with 402 before anything is created when the project cannot be
79
+ * billed.
80
+ */
81
+ create(params: CreateBucketParams): Promise<CreateBucketResponse>;
36
82
  }
37
83
  export {};
@@ -0,0 +1,106 @@
1
+ /**
2
+ * Catalog service namespace — the sizes, plans and regions paid resources are
3
+ * ordered with. Account-level: it never uses the client's default project.
4
+ */
5
+ import type { Transport } from "../transport";
6
+ /** A server size. */
7
+ export interface ServerSize {
8
+ slug: string;
9
+ description: string;
10
+ vcpus: number;
11
+ memoryMb: number;
12
+ diskGb: number;
13
+ transferTb: number;
14
+ /** Whole dollars. */
15
+ priceMonthly: number;
16
+ priceHourly: number;
17
+ }
18
+ /** A region a resource can be created in. */
19
+ export interface CatalogRegion {
20
+ slug: string;
21
+ name: string;
22
+ features?: string[];
23
+ }
24
+ /** A Redis plan. */
25
+ export interface RedisPlan {
26
+ slug: string;
27
+ name: string;
28
+ provider: string;
29
+ engine: string;
30
+ planType: string;
31
+ memoryMb: number;
32
+ throughputOps: number | null;
33
+ cpuMilli: number | null;
34
+ supportsReplication: boolean;
35
+ supportsPersistence: boolean;
36
+ /** Dollars. */
37
+ priceMonthly: number;
38
+ }
39
+ /** A dedicated database size. */
40
+ export interface DatabaseSize {
41
+ slug: string;
42
+ description: string;
43
+ nodeClass: string;
44
+ vcpus: number;
45
+ memoryMb: number;
46
+ diskGb: number;
47
+ /** Dollars. */
48
+ priceMonthly: number;
49
+ numNodes: number;
50
+ }
51
+ /** What dedicated databases can be created with. */
52
+ export interface DatabaseCatalog {
53
+ provider: string;
54
+ sizes: DatabaseSize[];
55
+ engines: Array<{
56
+ engine: string;
57
+ versions: string[];
58
+ }>;
59
+ regions: CatalogRegion[];
60
+ storage: unknown;
61
+ }
62
+ /** An app size, with the API's own snake_case keys. */
63
+ export interface AppSize {
64
+ name: string;
65
+ slug: string;
66
+ tier_slug: string;
67
+ cpu_type: string;
68
+ cpus: string | number;
69
+ memory_bytes: string | number;
70
+ bandwidth_allowance_gib?: string | number;
71
+ /** Dollars, as a string. */
72
+ usd_per_month: string;
73
+ }
74
+ interface Envelope<T> {
75
+ success: true;
76
+ data: T;
77
+ }
78
+ export type ListServerSizesResponse = Envelope<ServerSize[]>;
79
+ export type ListRegionsResponse = Envelope<CatalogRegion[]>;
80
+ export type ListServerImagesResponse = Envelope<Array<Record<string, unknown>>>;
81
+ export type ListRedisPlansResponse = Envelope<RedisPlan[]>;
82
+ export type GetDatabaseCatalogResponse = Envelope<DatabaseCatalog>;
83
+ export type ListAppSizesResponse = Envelope<AppSize[]>;
84
+ export type ListAppRegionsResponse = Envelope<Array<Record<string, unknown>>>;
85
+ /** Read-only lookups of what can be ordered. Any credential may call them. */
86
+ export declare class CatalogService {
87
+ private readonly transport;
88
+ constructor(transport: Transport);
89
+ /** Lists server sizes and their prices. */
90
+ serverSizes(): Promise<ListServerSizesResponse>;
91
+ /** Lists the regions servers can be created in. */
92
+ serverRegions(): Promise<ListRegionsResponse>;
93
+ /** Lists the one-click images a server can be created from. */
94
+ serverImages(): Promise<ListServerImagesResponse>;
95
+ /** Lists Redis plans and their prices. */
96
+ redisPlans(): Promise<ListRedisPlansResponse>;
97
+ /** Lists the regions Redis can be created in. */
98
+ redisRegions(): Promise<ListRegionsResponse>;
99
+ /** Lists dedicated database sizes, engines with their versions, and regions. */
100
+ databases(): Promise<GetDatabaseCatalogResponse>;
101
+ /** Lists app sizes and their prices. */
102
+ appSizes(): Promise<ListAppSizesResponse>;
103
+ /** Lists the regions apps can be created in. */
104
+ appRegions(): Promise<ListAppRegionsResponse>;
105
+ }
106
+ export {};
@@ -1,5 +1,6 @@
1
1
  /** Databases service namespace — a project's dedicated and shared databases. */
2
2
  import { type ResolvedConfig } from "../config";
3
+ import type { CheckoutPreview } from "./preview";
3
4
  import type { Transport } from "../transport";
4
5
  /** One database of any kind, as the project overview lists it. */
5
6
  export interface DatabaseSummary {
@@ -82,6 +83,26 @@ export type ListDedicatedDatabasesResponse = Envelope<DedicatedDatabase[]>;
82
83
  export type GetDedicatedDatabaseResponse = Envelope<DedicatedDatabaseDetail>;
83
84
  export type ListSharedDatabasesResponse = Envelope<SharedDatabase[]>;
84
85
  export type GetSharedDatabaseResponse = Envelope<SharedDatabase>;
86
+ export type DeleteDatabaseResponse = Envelope<Record<string, never>>;
87
+ /** Arguments accepted by `client.databases.previewDedicated()`. */
88
+ export interface PreviewDedicatedDatabaseParams extends ProjectScopedParams {
89
+ /** A size slug from `client.catalog.databases()`. */
90
+ size: string;
91
+ }
92
+ /** Arguments accepted by `client.databases.createDedicated()`. */
93
+ export interface CreateDedicatedDatabaseParams extends PreviewDedicatedDatabaseParams {
94
+ name: string;
95
+ /** An engine version from `client.catalog.databases()`, e.g. `"17"`. */
96
+ version: string;
97
+ /** A region slug from `client.catalog.databases()`. */
98
+ region: string;
99
+ /** Defaults to `POSTGRESQL`, the only engine on sale. */
100
+ engine?: string;
101
+ }
102
+ export type PreviewDedicatedDatabaseResponse = Envelope<CheckoutPreview>;
103
+ export type CreateDedicatedDatabaseResponse = Envelope<{
104
+ deployed: true;
105
+ }>;
85
106
  /** Read operations on a project's databases. */
86
107
  export declare class DatabasesService {
87
108
  private readonly transport;
@@ -102,5 +123,20 @@ export declare class DatabasesService {
102
123
  listShared(params?: ProjectScopedParams): Promise<ListSharedDatabasesResponse>;
103
124
  /** Fetches one database on the shared cluster. */
104
125
  getShared(tenantId: string, params?: ProjectScopedParams): Promise<GetSharedDatabaseResponse>;
126
+ /** Permanently deletes a dedicated database cluster and its data, and stops its billing. */
127
+ deleteDedicated(databaseId: string, params?: ProjectScopedParams): Promise<DeleteDatabaseResponse>;
128
+ /** Permanently deletes a shared database and its data, and stops its billing. */
129
+ deleteShared(tenantId: string, params?: ProjectScopedParams): Promise<DeleteDatabaseResponse>;
130
+ /** Prices a dedicated database before ordering it. `monthly` is exact; `dueToday` is an estimate once the project has a subscription. */
131
+ previewDedicated(params: PreviewDedicatedDatabaseParams): Promise<PreviewDedicatedDatabaseResponse>;
132
+ /**
133
+ * Orders a dedicated database. It starts `CREATING`; the response carries
134
+ * no id, so list and match the name to follow it.
135
+ *
136
+ * Charges the project's saved card immediately, with a prorated invoice. It
137
+ * is refused with 402 before anything is created when the project cannot be
138
+ * billed.
139
+ */
140
+ createDedicated(params: CreateDedicatedDatabaseParams): Promise<CreateDedicatedDatabaseResponse>;
105
141
  }
106
142
  export {};
@@ -39,6 +39,25 @@ interface Envelope<T> {
39
39
  }
40
40
  export type ListDomainsResponse = Envelope<Domain[]>;
41
41
  export type GetDomainResponse = Envelope<Domain>;
42
+ /** The TXT record that proves you control a domain you added. */
43
+ export interface VerificationRecord {
44
+ type: "TXT";
45
+ name: string;
46
+ value: string;
47
+ }
48
+ export type CreateDomainResponse = Envelope<Domain & {
49
+ verificationRecord: VerificationRecord;
50
+ }>;
51
+ export type VerifyDomainResponse = Envelope<{
52
+ status: "ACTIVE" | "PENDING";
53
+ verified: boolean;
54
+ record: VerificationRecord;
55
+ /** Why the lookup failed, when it did. */
56
+ error?: string;
57
+ }>;
58
+ export type DeleteDomainResponse = Envelope<{
59
+ id: string;
60
+ }>;
42
61
  /** Read operations on a project's domains. */
43
62
  export declare class DomainsService {
44
63
  private readonly transport;
@@ -50,5 +69,18 @@ export declare class DomainsService {
50
69
  list(params?: ProjectScopedParams): Promise<ListDomainsResponse>;
51
70
  /** Fetches one domain by id or by name, e.g. `example.com`. */
52
71
  get(domain: string, params?: ProjectScopedParams): Promise<GetDomainResponse>;
72
+ /**
73
+ * Adds a domain you already own, e.g. `example.com`. Free. Publish the
74
+ * returned `verificationRecord`, then call `verify()`. Buying a domain is not
75
+ * part of the SDK.
76
+ */
77
+ create(name: string, params?: ProjectScopedParams): Promise<CreateDomainResponse>;
78
+ /** Checks a domain's verification record, by domain id or name. */
79
+ verify(domain: string, params?: ProjectScopedParams): Promise<VerifyDomainResponse>;
80
+ /**
81
+ * Removes a domain and its DNS records, by id or name. Refused with 409
82
+ * while an app or an email domain uses it.
83
+ */
84
+ delete(domain: string, params?: ProjectScopedParams): Promise<DeleteDomainResponse>;
53
85
  }
54
86
  export {};
@@ -86,4 +86,9 @@ export declare class EmailService {
86
86
  listDomains(params?: ProjectScopedParams): Promise<ListEmailDomainsResponse>;
87
87
  /** Fetches one sending domain by its id (not its domain name). */
88
88
  getDomain(emailDomainId: string, params?: ProjectScopedParams): Promise<GetEmailDomainResponse>;
89
+ /**
90
+ * Stops sending from a domain and removes it from email. The domain itself
91
+ * stays in the project. The API answers 204, so there is nothing to return.
92
+ */
93
+ deleteDomain(emailDomainId: string, params?: ProjectScopedParams): Promise<void>;
89
94
  }
@@ -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";
@@ -70,6 +71,46 @@ export type GetHostingSiteResponse = Envelope<HostingSite & {
70
71
  }>;
71
72
  export type GetHostingSiteWithCredentialsResponse = Envelope<HostingSiteWithCredentials>;
72
73
  export type GetHostingAccessResponse = Envelope<HostingAccess>;
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
+ }>;
73
114
  /** Read operations on a project's shared hosting sites. */
74
115
  export declare class HostingService {
75
116
  private readonly transport;
@@ -86,5 +127,19 @@ export declare class HostingService {
86
127
  get(siteId: string, params?: GetHostingSiteParams): Promise<GetHostingSiteResponse>;
87
128
  /** Fetches the host, port and username for SFTP and SSH. */
88
129
  access(siteId: string, params?: ProjectScopedParams): Promise<GetHostingAccessResponse>;
130
+ /** Permanently deletes a hosting site with its files, databases and domains, and stops its billing. */
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>;
89
144
  }
90
145
  export {};
@@ -57,5 +57,10 @@ export declare class IamService {
57
57
  list(params?: ProjectScopedParams): Promise<ListIamCredentialsResponse>;
58
58
  /** Fetches one credential by its IAM user name. */
59
59
  get(iamUserName: string, params?: ProjectScopedParams): Promise<GetIamCredentialResponse>;
60
+ /**
61
+ * Deletes an IAM user and its access keys, by user name. Anything using the
62
+ * keys stops working. The API answers 204, so there is nothing to return.
63
+ */
64
+ delete(iamUserName: string, params?: ProjectScopedParams): Promise<void>;
60
65
  }
61
66
  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
+ }
@@ -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 {
@@ -40,6 +41,26 @@ interface Envelope<T> {
40
41
  }
41
42
  export type ListRedisDatabasesResponse = Envelope<RedisDatabase[]>;
42
43
  export type GetRedisDatabaseResponse = Envelope<RedisDatabaseDetail>;
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
+ }>;
43
64
  /** Read operations on a project's Redis databases. */
44
65
  export declare class RedisService {
45
66
  private readonly transport;
@@ -51,5 +72,18 @@ export declare class RedisService {
51
72
  list(params?: ProjectScopedParams): Promise<ListRedisDatabasesResponse>;
52
73
  /** Fetches one Redis database, with its password; see {@link RedisDatabaseDetail}. */
53
74
  get(redisId: string, params?: ProjectScopedParams): Promise<GetRedisDatabaseResponse>;
75
+ /** Permanently deletes a Redis database and its data, and stops its billing. */
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>;
54
88
  }
55
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 {
@@ -32,6 +33,32 @@ interface Envelope<T> {
32
33
  }
33
34
  export type ListRegistriesResponse = Envelope<Registry[]>;
34
35
  export type GetRegistryResponse = Envelope<Registry>;
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
+ }>;
35
62
  /** Read operations on a project's container registries. */
36
63
  export declare class RegistriesService {
37
64
  private readonly transport;
@@ -43,5 +70,23 @@ export declare class RegistriesService {
43
70
  list(params?: ProjectScopedParams): Promise<ListRegistriesResponse>;
44
71
  /** Fetches one registry, with its repositories. */
45
72
  get(registryId: string, params?: ProjectScopedParams): Promise<GetRegistryResponse>;
73
+ /** Permanently deletes a registry with every repository and image in it, and stops its billing. */
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>;
46
91
  }
47
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. */
@@ -41,6 +42,29 @@ interface Envelope<T> {
41
42
  }
42
43
  export type ListServersResponse = Envelope<Server[]>;
43
44
  export type GetServerResponse = Envelope<ServerDetail>;
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
+ }>;
44
68
  /** Read operations on a project's servers. */
45
69
  export declare class ServersService {
46
70
  private readonly transport;
@@ -52,5 +76,18 @@ export declare class ServersService {
52
76
  list(params?: ProjectScopedParams): Promise<ListServersResponse>;
53
77
  /** Fetches one server, with the SSH keys installed on it. */
54
78
  get(serverId: string, params?: ProjectScopedParams): Promise<GetServerResponse>;
79
+ /** Permanently deletes a server and its disk, and stops its billing. */
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>;
55
92
  }
56
93
  export {};
@@ -20,12 +20,32 @@ interface Envelope<T> {
20
20
  data: T;
21
21
  }
22
22
  export type ListSshKeysResponse = Envelope<SshKey[]>;
23
- /** Read operations on a project's SSH keys. */
23
+ /** Arguments accepted by `client.sshKeys.create()`. */
24
+ export interface CreateSshKeyParams extends ProjectScopedParams {
25
+ name: string;
26
+ /** One OpenSSH public key line, e.g. the contents of `~/.ssh/id_ed25519.pub`. DSA keys are refused. */
27
+ publicKey: string;
28
+ }
29
+ export type CreateSshKeyResponse = Envelope<SshKey>;
30
+ export type DeleteSshKeyResponse = Envelope<{
31
+ /** Servers the key was already installed on, where it still works: deleting does not revoke it there. */
32
+ stillAuthorisedOn: number;
33
+ }>;
34
+ /** A project's SSH keys. */
24
35
  export declare class SshKeysService {
25
36
  private readonly transport;
26
37
  private readonly config;
27
38
  constructor(transport: Transport, config: ResolvedConfig);
28
39
  /** Lists every SSH key in the project. */
29
40
  list(params?: ProjectScopedParams): Promise<ListSshKeysResponse>;
41
+ /** Adds a public key to the project, for installing on servers created later. */
42
+ create(params: CreateSshKeyParams): Promise<CreateSshKeyResponse>;
43
+ /**
44
+ * Removes a key from the project. Servers it was already installed on keep
45
+ * accepting it; `stillAuthorisedOn` says how many.
46
+ */
47
+ delete(sshKeyId: string, params?: ProjectScopedParams): Promise<DeleteSshKeyResponse>;
48
+ /** Builds the collection route for the resolved project. */
49
+ private basePath;
30
50
  }
31
51
  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.8.0";
12
- export declare const USER_AGENT = "cosmoner-node/1.8.0";
11
+ export declare const VERSION = "1.10.0";
12
+ export declare const USER_AGENT = "cosmoner-node/1.10.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cosmoner/sdk",
3
- "version": "1.8.0",
3
+ "version": "1.10.0",
4
4
  "description": "Cosmoner SDK for Node.js",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",