@cosmoner/sdk 1.7.1 → 1.9.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 CHANGED
@@ -139,6 +139,40 @@ const { data: access } = await client.hosting.access(sites[0].id);
139
139
  `sftpPassword`. It needs no scope beyond `hosting:read`, so guard the key
140
140
  accordingly.
141
141
 
142
+ ## Resource namespaces
143
+
144
+ Each of these works on one kind of resource and returns the API envelope.
145
+ Every method takes `{ projectId }` to override the client default, except
146
+ `projects`, which reads across the account and never uses the default project.
147
+ A method taking an id rejects an empty one before sending anything.
148
+
149
+ | Namespace | Read | Change |
150
+ | --- | --- | --- |
151
+ | `projects` | `list()`, `get(project)` — by id or slug | |
152
+ | `apps` | `get(appId)`, `logs(appId, { type: "BUILD" \| "RUN" })`, alongside `list()` and the deploy methods | `update(appId, changes)`, `delete(appId)` |
153
+ | `servers` | `list()`, `get(serverId)` — adds the installed `sshKeys` | `delete(serverId)` |
154
+ | `sshKeys` | `list()` | `create({ name, publicKey })`, `delete(sshKeyId)` |
155
+ | `databases` | `list()` (every kind), `listDedicated()`, `getDedicated(databaseId)`, `listShared()`, `getShared(tenantId)` | `deleteDedicated(databaseId)`, `deleteShared(tenantId)` |
156
+ | `redis` | `list()`, `get(redisId)` | `delete(redisId)` |
157
+ | `domains` | `list()`, `get(domain)` — by id or name, such as `example.com` | `create(name)`, `verify(domain)`, `delete(domain)` |
158
+ | `buckets` | `list()` — there is no single-bucket read | `delete(bucketId)` |
159
+ | `registries` | `list()`, `get(registryId)` | `delete(registryId)` |
160
+ | `iam` | `list()`, `get(iamUserName)` — the list holds `credentials` plus partial-failure `errors` | `delete(iamUserName)` |
161
+ | `members` | `list()` — members and pending invitations | |
162
+ | `email` | `listDomains()`, `getDomain(emailDomainId)`, alongside `send()` | `deleteDomain(emailDomainId)` |
163
+
164
+ Two of these return a credential, and each needs only the namespace's read
165
+ scope, so guard keys that carry it: `databases.getDedicated` always includes
166
+ `connectionUri`, a full connection URI with the password, and `redis.get`
167
+ always includes the plaintext `password`.
168
+
169
+ Deletes are permanent, and a delete of a billed resource stops its billing.
170
+ `apps.update` changes settings only, for free; it leaves environment variables
171
+ to the deployment file. `domains.create` adds a domain you already own: publish
172
+ the returned `verificationRecord`, then call `verify`. Deleting an SSH key
173
+ leaves it on servers it was already installed on — `stillAuthorisedOn` counts
174
+ them.
175
+
142
176
  ## Secrets
143
177
 
144
178
  Stores the values a deployment file refers to with `from_secret`. Needs an API
package/dist/client.d.ts CHANGED
@@ -1,9 +1,19 @@
1
1
  /** Entry-point client exposing the API's service namespaces. */
2
2
  import { type CosmonerConfig } from "./config";
3
3
  import { AppsService } from "./services/apps";
4
+ import { BucketsService } from "./services/buckets";
5
+ import { DatabasesService } from "./services/databases";
6
+ import { DomainsService } from "./services/domains";
4
7
  import { EmailService } from "./services/email";
5
8
  import { HostingService } from "./services/hosting";
9
+ import { IamService } from "./services/iam";
10
+ import { MembersService } from "./services/members";
11
+ import { ProjectsService } from "./services/projects";
12
+ import { RedisService } from "./services/redis";
13
+ import { RegistriesService } from "./services/registries";
6
14
  import { SecretsService } from "./services/secrets";
15
+ import { ServersService } from "./services/servers";
16
+ import { SshKeysService } from "./services/ssh-keys";
7
17
  import { VariablesService } from "./services/variables";
8
18
  import { WebhooksService } from "./services/webhooks";
9
19
  /**
@@ -27,9 +37,20 @@ export declare class Cosmoner {
27
37
  private readonly config;
28
38
  private readonly transport;
29
39
  readonly apps: AppsService;
40
+ readonly buckets: BucketsService;
41
+ readonly databases: DatabasesService;
42
+ readonly domains: DomainsService;
30
43
  readonly email: EmailService;
31
44
  readonly hosting: HostingService;
45
+ readonly iam: IamService;
46
+ readonly members: MembersService;
47
+ /** Account-level: never uses the client's default project. */
48
+ readonly projects: ProjectsService;
49
+ readonly redis: RedisService;
50
+ readonly registries: RegistriesService;
32
51
  readonly secrets: SecretsService;
52
+ readonly servers: ServersService;
53
+ readonly sshKeys: SshKeysService;
33
54
  readonly variables: VariablesService;
34
55
  readonly webhooks: WebhooksService;
35
56
  constructor(config: CosmonerConfig);
package/dist/index.d.ts CHANGED
@@ -5,9 +5,19 @@ export { AuthenticationError, ConflictError, CosmonerConnectionError, CosmonerEr
5
5
  export { APP_SCHEMA_URL, DEPLOYMENT_FILE_PATHS, DEPLOYMENT_KEY_ORDER, DEPLOYMENT_VERSION, MAX_DEPLOYMENT_BYTES, } from "./deployment/spec";
6
6
  export { validateDeployment, validateDeploymentDocument, } from "./deployment/validate";
7
7
  export type { DeploymentBuild, DeploymentEnvVar, DeploymentIssue, DeploymentIssueSeverity, DeploymentService, DeploymentTemplate, DeploymentValidationResult, ValidateDeploymentOptions, } from "./deployment/types";
8
- export { AppsService, FINISHED_DEPLOYMENT_PHASES, type App, type AppDeployment, type AppStatus, type DeployAppParams, type DeployAppResponse, type DeploymentPhase, type GetDeploymentResponse, type ImageDeployPolicy, type ListAppsResponse, type WaitForDeploymentParams, } from "./services/apps";
9
- export { EmailService, type SendEmailParams, type SendEmailResponse, } from "./services/email";
10
- export { HostingService, type GetHostingAccessResponse, type GetHostingSiteParams, type GetHostingSiteResponse, type GetHostingSiteWithCredentialsResponse, type HostingAccess, type HostingSite, type HostingSiteStatus, type HostingSiteWithCredentials, type ListHostingSitesResponse, } from "./services/hosting";
8
+ export { AppsService, FINISHED_DEPLOYMENT_PHASES, type App, type AppDeployment, type AppLogLine, type AppLogType, type AppLogsParams, type AppLogsResponse, type AppStatus, type DeleteAppResponse, type DeployAppParams, type DeployAppResponse, type DeploymentPhase, type GetAppResponse, type GetDeploymentResponse, type ImageDeployPolicy, type ListAppsResponse, type UpdateAppParams, type UpdateAppResponse, type WaitForDeploymentParams, } from "./services/apps";
9
+ export { BucketsService, type Bucket, type DeleteBucketResponse, type ListBucketsResponse } from "./services/buckets";
10
+ export { DatabasesService, type DatabaseSummary, type DedicatedDatabase, type DedicatedDatabaseDetail, type DeleteDatabaseResponse, type GetDedicatedDatabaseResponse, type GetSharedDatabaseResponse, type ListDatabasesResponse, type ListDedicatedDatabasesResponse, type ListSharedDatabasesResponse, type SharedDatabase, } from "./services/databases";
11
+ export { DomainsService, type CreateDomainResponse, type DeleteDomainResponse, type DnsRecord, type Domain, type GetDomainResponse, type ListDomainsResponse, type VerificationRecord, type VerifyDomainResponse, } from "./services/domains";
12
+ export { EmailService, type EmailDomain, type EmailDomainDetail, type GetEmailDomainResponse, type ListEmailDomainsResponse, type SendEmailParams, type SendEmailResponse, } from "./services/email";
13
+ export { HostingService, type DeleteHostingSiteResponse, type GetHostingAccessResponse, type GetHostingSiteParams, type GetHostingSiteResponse, type GetHostingSiteWithCredentialsResponse, type HostingAccess, type HostingSite, type HostingSiteStatus, type HostingSiteWithCredentials, type ListHostingSitesResponse, } from "./services/hosting";
14
+ export { IamService, type GetIamCredentialResponse, type IamCredential, type IamCredentialList, type ListIamCredentialsResponse, } from "./services/iam";
15
+ export { MembersService, type ListMembersResponse, type ProjectMember, type ProjectMembers } from "./services/members";
16
+ export { ProjectsService, type GetProjectResponse, type ListProjectsResponse, type Project } from "./services/projects";
17
+ export { RedisService, type DeleteRedisDatabaseResponse, type GetRedisDatabaseResponse, type ListRedisDatabasesResponse, type RedisDatabase, type RedisDatabaseDetail, } from "./services/redis";
18
+ export { RegistriesService, type DeleteRegistryResponse, type GetRegistryResponse, type ListRegistriesResponse, type Registry, type RegistryRepository, } from "./services/registries";
19
+ export { ServersService, type DeleteServerResponse, type GetServerResponse, type ListServersResponse, type Server, type ServerDetail, type ServerStatus, } from "./services/servers";
20
+ export { SshKeysService, type CreateSshKeyParams, type CreateSshKeyResponse, type DeleteSshKeyResponse, type ListSshKeysResponse, type SshKey, } from "./services/ssh-keys";
11
21
  export { PROJECT_ENVIRONMENTS, type Actor, type ProjectEnvironment, } from "./services/project-config";
12
22
  export { SecretsService, type CreateSecretParams, type GetSecretAuditResponse, type GetSecretResponse, type GetSecretsUsageResponse, type ListSecretsParams, type ListSecretsResponse, type ProjectSecret, type RevealedProjectSecret, type SecretAuditEntry, type SecretsUsage, type SetSecretResponse, type UpdateSecretParams, } from "./services/secrets";
13
23
  export { VariablesService, type CreateVariableParams, type GetVariableResponse, type ListVariablesParams, type ListVariablesResponse, type ProjectVariable, type SetVariableResponse, type UpdateVariableParams, } from "./services/variables";
package/dist/index.js CHANGED
@@ -23,6 +23,7 @@ __export(index_exports, {
23
23
  APP_SCHEMA_URL: () => APP_SCHEMA_URL,
24
24
  AppsService: () => AppsService,
25
25
  AuthenticationError: () => AuthenticationError,
26
+ BucketsService: () => BucketsService,
26
27
  ConflictError: () => ConflictError,
27
28
  Cosmoner: () => Cosmoner,
28
29
  CosmonerConnectionError: () => CosmonerConnectionError,
@@ -36,18 +37,27 @@ __export(index_exports, {
36
37
  DEPLOYMENT_FILE_PATHS: () => DEPLOYMENT_FILE_PATHS,
37
38
  DEPLOYMENT_KEY_ORDER: () => DEPLOYMENT_KEY_ORDER,
38
39
  DEPLOYMENT_VERSION: () => DEPLOYMENT_VERSION,
40
+ DatabasesService: () => DatabasesService,
41
+ DomainsService: () => DomainsService,
39
42
  EVENT_TYPE_HEADER: () => EVENT_TYPE_HEADER,
40
43
  EmailService: () => EmailService,
41
44
  FINISHED_DEPLOYMENT_PHASES: () => FINISHED_DEPLOYMENT_PHASES,
42
45
  HostingService: () => HostingService,
46
+ IamService: () => IamService,
43
47
  InsufficientScopeError: () => InsufficientScopeError,
44
48
  MAX_DEPLOYMENT_BYTES: () => MAX_DEPLOYMENT_BYTES,
49
+ MembersService: () => MembersService,
45
50
  NotFoundError: () => NotFoundError,
46
51
  PROJECT_ENVIRONMENTS: () => PROJECT_ENVIRONMENTS,
52
+ ProjectsService: () => ProjectsService,
47
53
  RateLimitError: () => RateLimitError,
54
+ RedisService: () => RedisService,
55
+ RegistriesService: () => RegistriesService,
48
56
  SIGNATURE_HEADER: () => SIGNATURE_HEADER,
49
57
  SecretsService: () => SecretsService,
50
58
  ServerError: () => ServerError,
59
+ ServersService: () => ServersService,
60
+ SshKeysService: () => SshKeysService,
51
61
  VERSION: () => VERSION,
52
62
  ValidationError: () => ValidationError,
53
63
  VariablesService: () => VariablesService,
@@ -117,6 +127,24 @@ var AppsService = class {
117
127
  async list(params = {}) {
118
128
  return this.transport.request("GET", this.basePath(params.projectId));
119
129
  }
130
+ /**
131
+ * Fetches one app by id, with its full configuration.
132
+ *
133
+ * Environment variables marked secret come back masked; any other
134
+ * variable's value is returned as stored.
135
+ */
136
+ async get(appId, params = {}) {
137
+ if (!appId) throw new Error("appId is required");
138
+ return this.transport.request("GET", `${this.basePath(params.projectId)}/${appId}`);
139
+ }
140
+ /** Fetches the most recent lines of an app's build or runtime log. */
141
+ async logs(appId, params) {
142
+ if (!appId) throw new Error("appId is required");
143
+ if (params?.type !== "BUILD" && params?.type !== "RUN") throw new Error('type must be "BUILD" or "RUN"');
144
+ return this.transport.request("GET", `${this.basePath(params.projectId)}/${appId}/logs`, {
145
+ query: { type: params.type }
146
+ });
147
+ }
120
148
  /**
121
149
  * Starts deploying an image app and returns the deployment without waiting.
122
150
  *
@@ -174,6 +202,161 @@ var AppsService = class {
174
202
  await new Promise((resolve) => setTimeout(resolve, Math.min(interval, remaining)));
175
203
  }
176
204
  }
205
+ /**
206
+ * Changes an app's settings and applies them to the running app.
207
+ *
208
+ * Free: resizing, which is billed, is a separate call. The API answers 502
209
+ * when the settings were saved but the runtime refused them.
210
+ */
211
+ async update(appId, params) {
212
+ if (!appId) throw new Error("appId is required");
213
+ const { projectId, ...changes } = params ?? {};
214
+ const body = Object.fromEntries(Object.entries(changes).filter(([, value]) => value !== void 0));
215
+ if (Object.keys(body).length === 0) throw new Error("at least one change is required");
216
+ return this.transport.request("PATCH", `${this.basePath(projectId)}/${appId}`, { body });
217
+ }
218
+ /**
219
+ * Permanently deletes an app: its runtime, routing, custom hostname and
220
+ * billing, then the app itself. Its deployments go with it.
221
+ */
222
+ async delete(appId, params = {}) {
223
+ if (!appId) throw new Error("appId is required");
224
+ return this.transport.request("DELETE", `${this.basePath(params.projectId)}/${appId}`);
225
+ }
226
+ };
227
+
228
+ // src/services/buckets.ts
229
+ var BucketsService = class {
230
+ constructor(transport, config) {
231
+ this.transport = transport;
232
+ this.config = config;
233
+ }
234
+ /** Lists every bucket in the project. */
235
+ async list(params = {}) {
236
+ return this.transport.request("GET", this.basePath(params.projectId));
237
+ }
238
+ /**
239
+ * Permanently deletes a bucket with every object in it and the access
240
+ * credentials made for it, and stops its billing.
241
+ */
242
+ async delete(bucketId, params = {}) {
243
+ if (!bucketId) throw new Error("bucketId is required");
244
+ return this.transport.request("DELETE", `${this.basePath(params.projectId)}/${bucketId}`);
245
+ }
246
+ /** Builds the collection route for the resolved project. */
247
+ basePath(projectId) {
248
+ return `/v1/projects/${resolveProjectId(this.config, projectId)}/storage/object-storage`;
249
+ }
250
+ };
251
+
252
+ // src/services/databases.ts
253
+ var DatabasesService = class {
254
+ constructor(transport, config) {
255
+ this.transport = transport;
256
+ this.config = config;
257
+ }
258
+ /** Builds the collection route for the resolved project. */
259
+ basePath(projectId) {
260
+ return `/v1/projects/${resolveProjectId(this.config, projectId)}/databases`;
261
+ }
262
+ /** Lists every database in the project, of every kind, newest first. */
263
+ async list(params = {}) {
264
+ return this.transport.request("GET", this.basePath(params.projectId));
265
+ }
266
+ /** Lists the project's dedicated databases. */
267
+ async listDedicated(params = {}) {
268
+ return this.transport.request("GET", `${this.basePath(params.projectId)}/dedicated`);
269
+ }
270
+ /**
271
+ * Fetches one dedicated database. Its `connectionUri` carries the password;
272
+ * see {@link DedicatedDatabaseDetail}.
273
+ */
274
+ async getDedicated(databaseId, params = {}) {
275
+ if (!databaseId) throw new Error("databaseId is required");
276
+ return this.transport.request(
277
+ "GET",
278
+ `${this.basePath(params.projectId)}/dedicated/${databaseId}`
279
+ );
280
+ }
281
+ /** Lists the project's databases on the shared cluster. */
282
+ async listShared(params = {}) {
283
+ return this.transport.request("GET", `${this.basePath(params.projectId)}/shared`);
284
+ }
285
+ /** Fetches one database on the shared cluster. */
286
+ async getShared(tenantId, params = {}) {
287
+ if (!tenantId) throw new Error("tenantId is required");
288
+ return this.transport.request("GET", `${this.basePath(params.projectId)}/shared/${tenantId}`);
289
+ }
290
+ /** Permanently deletes a dedicated database cluster and its data, and stops its billing. */
291
+ async deleteDedicated(databaseId, params = {}) {
292
+ if (!databaseId) throw new Error("databaseId is required");
293
+ return this.transport.request(
294
+ "DELETE",
295
+ `${this.basePath(params.projectId)}/dedicated/${databaseId}`
296
+ );
297
+ }
298
+ /** Permanently deletes a shared database and its data, and stops its billing. */
299
+ async deleteShared(tenantId, params = {}) {
300
+ if (!tenantId) throw new Error("tenantId is required");
301
+ return this.transport.request(
302
+ "DELETE",
303
+ `${this.basePath(params.projectId)}/shared/${tenantId}`
304
+ );
305
+ }
306
+ };
307
+
308
+ // src/services/domains.ts
309
+ var DomainsService = class {
310
+ constructor(transport, config) {
311
+ this.transport = transport;
312
+ this.config = config;
313
+ }
314
+ /** Builds the collection route for the resolved project. */
315
+ basePath(projectId) {
316
+ return `/v1/projects/${resolveProjectId(this.config, projectId)}/domains`;
317
+ }
318
+ /** Lists every domain in the project, with its DNS records. */
319
+ async list(params = {}) {
320
+ return this.transport.request("GET", this.basePath(params.projectId));
321
+ }
322
+ /** Fetches one domain by id or by name, e.g. `example.com`. */
323
+ async get(domain, params = {}) {
324
+ if (!domain) throw new Error("domain is required");
325
+ return this.transport.request(
326
+ "GET",
327
+ `${this.basePath(params.projectId)}/${encodeURIComponent(domain)}`
328
+ );
329
+ }
330
+ /**
331
+ * Adds a domain you already own, e.g. `example.com`. Free. Publish the
332
+ * returned `verificationRecord`, then call `verify()`. Buying a domain is not
333
+ * part of the SDK.
334
+ */
335
+ async create(name, params = {}) {
336
+ if (!name) throw new Error("name is required");
337
+ return this.transport.request("POST", this.basePath(params.projectId), {
338
+ body: { name, type: "EXTERNAL" }
339
+ });
340
+ }
341
+ /** Checks a domain's verification record, by domain id or name. */
342
+ async verify(domain, params = {}) {
343
+ if (!domain) throw new Error("domain is required");
344
+ return this.transport.request(
345
+ "POST",
346
+ `${this.basePath(params.projectId)}/${encodeURIComponent(domain)}/verify`
347
+ );
348
+ }
349
+ /**
350
+ * Removes a domain and its DNS records, by id or name. Refused with 409
351
+ * while an app or an email domain uses it.
352
+ */
353
+ async delete(domain, params = {}) {
354
+ if (!domain) throw new Error("domain is required");
355
+ return this.transport.request(
356
+ "DELETE",
357
+ `${this.basePath(params.projectId)}/${encodeURIComponent(domain)}`
358
+ );
359
+ }
177
360
  };
178
361
 
179
362
  // src/services/email.ts
@@ -210,6 +393,34 @@ var EmailService = class {
210
393
  }
211
394
  );
212
395
  }
396
+ /** Lists the project's sending domains, with their SMTP credentials and DNS records. */
397
+ // eslint-disable-next-line require-await -- kept `async` like every method here, so callers get one promise contract.
398
+ async listDomains(params = {}) {
399
+ return this.transport.request(
400
+ "GET",
401
+ `/v1/projects/${resolveProjectId(this.config, params.projectId)}/email`
402
+ );
403
+ }
404
+ /** Fetches one sending domain by its id (not its domain name). */
405
+ // eslint-disable-next-line require-await -- `async` makes the validation below reject rather than throw synchronously.
406
+ async getDomain(emailDomainId, params = {}) {
407
+ if (!emailDomainId) throw new Error("emailDomainId is required");
408
+ return this.transport.request(
409
+ "GET",
410
+ `/v1/projects/${resolveProjectId(this.config, params.projectId)}/email/${emailDomainId}`
411
+ );
412
+ }
413
+ /**
414
+ * Stops sending from a domain and removes it from email. The domain itself
415
+ * stays in the project. The API answers 204, so there is nothing to return.
416
+ */
417
+ async deleteDomain(emailDomainId, params = {}) {
418
+ if (!emailDomainId) throw new Error("emailDomainId is required");
419
+ await this.transport.request(
420
+ "DELETE",
421
+ `/v1/projects/${resolveProjectId(this.config, params.projectId)}/email/${emailDomainId}`
422
+ );
423
+ }
213
424
  };
214
425
 
215
426
  // src/services/hosting.ts
@@ -242,6 +453,126 @@ var HostingService = class {
242
453
  `${this.basePath(params.projectId)}/${siteId}/access`
243
454
  );
244
455
  }
456
+ /** Permanently deletes a hosting site with its files, databases and domains, and stops its billing. */
457
+ async delete(siteId, params = {}) {
458
+ if (!siteId) throw new Error("siteId is required");
459
+ return this.transport.request("DELETE", `${this.basePath(params.projectId)}/${siteId}`);
460
+ }
461
+ };
462
+
463
+ // src/services/iam.ts
464
+ var IamService = class {
465
+ constructor(transport, config) {
466
+ this.transport = transport;
467
+ this.config = config;
468
+ }
469
+ /** Builds the collection route for the resolved project. */
470
+ basePath(projectId) {
471
+ return `/v1/projects/${resolveProjectId(this.config, projectId)}/iam`;
472
+ }
473
+ /** Lists every access credential in the project, newest first. */
474
+ async list(params = {}) {
475
+ return this.transport.request("GET", this.basePath(params.projectId));
476
+ }
477
+ /** Fetches one credential by its IAM user name. */
478
+ async get(iamUserName, params = {}) {
479
+ if (!iamUserName) throw new Error("iamUserName is required");
480
+ return this.transport.request(
481
+ "GET",
482
+ `${this.basePath(params.projectId)}/${encodeURIComponent(iamUserName)}`
483
+ );
484
+ }
485
+ /**
486
+ * Deletes an IAM user and its access keys, by user name. Anything using the
487
+ * keys stops working. The API answers 204, so there is nothing to return.
488
+ */
489
+ async delete(iamUserName, params = {}) {
490
+ if (!iamUserName) throw new Error("iamUserName is required");
491
+ await this.transport.request("DELETE", `${this.basePath(params.projectId)}/${encodeURIComponent(iamUserName)}`);
492
+ }
493
+ };
494
+
495
+ // src/services/members.ts
496
+ var MembersService = class {
497
+ constructor(transport, config) {
498
+ this.transport = transport;
499
+ this.config = config;
500
+ }
501
+ /** Lists the project's members and pending invitations. */
502
+ async list(params = {}) {
503
+ return this.transport.request(
504
+ "GET",
505
+ `/v1/projects/${resolveProjectId(this.config, params.projectId)}/members`
506
+ );
507
+ }
508
+ };
509
+
510
+ // src/services/projects.ts
511
+ var ProjectsService = class {
512
+ constructor(transport) {
513
+ this.transport = transport;
514
+ }
515
+ /** Lists every project the credential can reach, newest first. */
516
+ async list() {
517
+ return this.transport.request("GET", "/v1/projects");
518
+ }
519
+ /** Fetches one project by id or slug. */
520
+ async get(project) {
521
+ if (!project) throw new Error("project is required");
522
+ return this.transport.request("GET", `/v1/projects/${encodeURIComponent(project)}`);
523
+ }
524
+ };
525
+
526
+ // src/services/redis.ts
527
+ var RedisService = class {
528
+ constructor(transport, config) {
529
+ this.transport = transport;
530
+ this.config = config;
531
+ }
532
+ /** Builds the collection route for the resolved project. */
533
+ basePath(projectId) {
534
+ return `/v1/projects/${resolveProjectId(this.config, projectId)}/redis`;
535
+ }
536
+ /** Lists every Redis database in the project that has not been terminated. */
537
+ async list(params = {}) {
538
+ return this.transport.request("GET", this.basePath(params.projectId));
539
+ }
540
+ /** Fetches one Redis database, with its password; see {@link RedisDatabaseDetail}. */
541
+ async get(redisId, params = {}) {
542
+ if (!redisId) throw new Error("redisId is required");
543
+ return this.transport.request("GET", `${this.basePath(params.projectId)}/${redisId}`);
544
+ }
545
+ /** Permanently deletes a Redis database and its data, and stops its billing. */
546
+ async delete(redisId, params = {}) {
547
+ if (!redisId) throw new Error("redisId is required");
548
+ return this.transport.request("DELETE", `${this.basePath(params.projectId)}/${redisId}`);
549
+ }
550
+ };
551
+
552
+ // src/services/registries.ts
553
+ var RegistriesService = class {
554
+ constructor(transport, config) {
555
+ this.transport = transport;
556
+ this.config = config;
557
+ }
558
+ /** Builds the collection route for the resolved project. */
559
+ basePath(projectId) {
560
+ return `/v1/projects/${resolveProjectId(this.config, projectId)}/storage/container-registry`;
561
+ }
562
+ /** Lists every registry in the project, with its repositories. */
563
+ async list(params = {}) {
564
+ return this.transport.request("GET", this.basePath(params.projectId));
565
+ }
566
+ /** Fetches one registry, with its repositories. */
567
+ async get(registryId, params = {}) {
568
+ if (!registryId) throw new Error("registryId is required");
569
+ return this.transport.request("GET", `${this.basePath(params.projectId)}/${registryId}`);
570
+ }
571
+ /** Permanently deletes a registry with every repository and image in it, and stops its billing. */
572
+ async delete(registryId, params = {}) {
573
+ if (!registryId) throw new Error("registryId is required");
574
+ return this.transport.request("DELETE", `${this.basePath(params.projectId)}/${registryId}`);
575
+ }
245
576
  };
246
577
 
247
578
  // src/services/project-config.ts
@@ -350,6 +681,64 @@ var SecretsService = class {
350
681
  }
351
682
  };
352
683
 
684
+ // src/services/servers.ts
685
+ var ServersService = class {
686
+ constructor(transport, config) {
687
+ this.transport = transport;
688
+ this.config = config;
689
+ }
690
+ /** Builds the collection route for the resolved project. */
691
+ basePath(projectId) {
692
+ return `/v1/projects/${resolveProjectId(this.config, projectId)}/servers`;
693
+ }
694
+ /** Lists every server in the project that has not been terminated. */
695
+ async list(params = {}) {
696
+ return this.transport.request("GET", this.basePath(params.projectId));
697
+ }
698
+ /** Fetches one server, with the SSH keys installed on it. */
699
+ async get(serverId, params = {}) {
700
+ if (!serverId) throw new Error("serverId is required");
701
+ return this.transport.request("GET", `${this.basePath(params.projectId)}/${serverId}`);
702
+ }
703
+ /** Permanently deletes a server and its disk, and stops its billing. */
704
+ async delete(serverId, params = {}) {
705
+ if (!serverId) throw new Error("serverId is required");
706
+ return this.transport.request("DELETE", `${this.basePath(params.projectId)}/${serverId}`);
707
+ }
708
+ };
709
+
710
+ // src/services/ssh-keys.ts
711
+ var SshKeysService = class {
712
+ constructor(transport, config) {
713
+ this.transport = transport;
714
+ this.config = config;
715
+ }
716
+ /** Lists every SSH key in the project. */
717
+ async list(params = {}) {
718
+ return this.transport.request("GET", this.basePath(params.projectId));
719
+ }
720
+ /** Adds a public key to the project, for installing on servers created later. */
721
+ async create(params) {
722
+ if (!params?.name) throw new Error("name is required");
723
+ if (!params.publicKey) throw new Error("publicKey is required");
724
+ return this.transport.request("POST", this.basePath(params.projectId), {
725
+ body: { name: params.name, publicKey: params.publicKey }
726
+ });
727
+ }
728
+ /**
729
+ * Removes a key from the project. Servers it was already installed on keep
730
+ * accepting it; `stillAuthorisedOn` says how many.
731
+ */
732
+ async delete(sshKeyId, params = {}) {
733
+ if (!sshKeyId) throw new Error("sshKeyId is required");
734
+ return this.transport.request("DELETE", `${this.basePath(params.projectId)}/${sshKeyId}`);
735
+ }
736
+ /** Builds the collection route for the resolved project. */
737
+ basePath(projectId) {
738
+ return `/v1/projects/${resolveProjectId(this.config, projectId)}/ssh-keys`;
739
+ }
740
+ };
741
+
353
742
  // src/services/variables.ts
354
743
  var VariablesService = class {
355
744
  constructor(transport, config) {
@@ -796,7 +1185,7 @@ function sleep(ms) {
796
1185
  }
797
1186
 
798
1187
  // src/version.ts
799
- var VERSION = "1.7.1";
1188
+ var VERSION = "1.9.0";
800
1189
  var USER_AGENT = `cosmoner-node/${VERSION}`;
801
1190
 
802
1191
  // src/transport.ts
@@ -920,9 +1309,19 @@ var Cosmoner = class {
920
1309
  this.maxRetries = this.config.maxRetries;
921
1310
  this.transport = new Transport(this.config);
922
1311
  this.apps = new AppsService(this.transport, this.config);
1312
+ this.buckets = new BucketsService(this.transport, this.config);
1313
+ this.databases = new DatabasesService(this.transport, this.config);
1314
+ this.domains = new DomainsService(this.transport, this.config);
923
1315
  this.email = new EmailService(this.transport, this.config);
924
1316
  this.hosting = new HostingService(this.transport, this.config);
1317
+ this.iam = new IamService(this.transport, this.config);
1318
+ this.members = new MembersService(this.transport, this.config);
1319
+ this.projects = new ProjectsService(this.transport);
1320
+ this.redis = new RedisService(this.transport, this.config);
1321
+ this.registries = new RegistriesService(this.transport, this.config);
925
1322
  this.secrets = new SecretsService(this.transport, this.config);
1323
+ this.servers = new ServersService(this.transport, this.config);
1324
+ this.sshKeys = new SshKeysService(this.transport, this.config);
926
1325
  this.variables = new VariablesService(this.transport, this.config);
927
1326
  this.webhooks = new WebhooksService(this.transport, this.config);
928
1327
  }
@@ -1266,6 +1665,7 @@ var index_default = Cosmoner;
1266
1665
  APP_SCHEMA_URL,
1267
1666
  AppsService,
1268
1667
  AuthenticationError,
1668
+ BucketsService,
1269
1669
  ConflictError,
1270
1670
  Cosmoner,
1271
1671
  CosmonerConnectionError,
@@ -1279,18 +1679,27 @@ var index_default = Cosmoner;
1279
1679
  DEPLOYMENT_FILE_PATHS,
1280
1680
  DEPLOYMENT_KEY_ORDER,
1281
1681
  DEPLOYMENT_VERSION,
1682
+ DatabasesService,
1683
+ DomainsService,
1282
1684
  EVENT_TYPE_HEADER,
1283
1685
  EmailService,
1284
1686
  FINISHED_DEPLOYMENT_PHASES,
1285
1687
  HostingService,
1688
+ IamService,
1286
1689
  InsufficientScopeError,
1287
1690
  MAX_DEPLOYMENT_BYTES,
1691
+ MembersService,
1288
1692
  NotFoundError,
1289
1693
  PROJECT_ENVIRONMENTS,
1694
+ ProjectsService,
1290
1695
  RateLimitError,
1696
+ RedisService,
1697
+ RegistriesService,
1291
1698
  SIGNATURE_HEADER,
1292
1699
  SecretsService,
1293
1700
  ServerError,
1701
+ ServersService,
1702
+ SshKeysService,
1294
1703
  VERSION,
1295
1704
  ValidationError,
1296
1705
  VariablesService,