@cosmoner/sdk 1.9.0 → 1.11.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
@@ -166,6 +166,19 @@ scope, so guard keys that carry it: `databases.getDedicated` always includes
166
166
  `connectionUri`, a full connection URI with the password, and `redis.get`
167
167
  always includes the plaintext `password`.
168
168
 
169
+ ### Ordering paid resources
170
+
171
+ `servers.create`, `redis.create`, `databases.createDedicated`,
172
+ `buckets.create`, `registries.create`, `hosting.create`, `apps.create` and
173
+ `apps.resize` charge the project's saved card at once, and are refused with a
174
+ 402 before anything is created when the project cannot be billed. Each has a
175
+ `preview` (`previewDedicated`, `resizePreview`) that returns the price first:
176
+ `monthly` is exact, `dueToday` an estimate once the project has a
177
+ subscription. `client.catalog` lists the sizes, plans and regions to order
178
+ with, and needs no project. An app is ordered in two calls: `createDraft`
179
+ saves what it should be, for free, and `create` turns the draft into a billed
180
+ app.
181
+
169
182
  Deletes are permanent, and a delete of a billed resource stops its billing.
170
183
  `apps.update` changes settings only, for free; it leaves environment variables
171
184
  to the deployment file. `domains.create` adds a domain you already own: publish
package/dist/client.d.ts CHANGED
@@ -2,6 +2,7 @@
2
2
  import { type CosmonerConfig } from "./config";
3
3
  import { AppsService } from "./services/apps";
4
4
  import { BucketsService } from "./services/buckets";
5
+ import { CatalogService } from "./services/catalog";
5
6
  import { DatabasesService } from "./services/databases";
6
7
  import { DomainsService } from "./services/domains";
7
8
  import { EmailService } from "./services/email";
@@ -46,6 +47,8 @@ export declare class Cosmoner {
46
47
  readonly members: MembersService;
47
48
  /** Account-level: never uses the client's default project. */
48
49
  readonly projects: ProjectsService;
50
+ /** Sizes, plans and regions to order with. Account-level. */
51
+ readonly catalog: CatalogService;
49
52
  readonly redis: RedisService;
50
53
  readonly registries: RegistriesService;
51
54
  readonly secrets: SecretsService;
package/dist/index.d.ts CHANGED
@@ -5,19 +5,21 @@ 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 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";
8
+ export { AppsService, FINISHED_DEPLOYMENT_PHASES, type App, type AppDeployment, type AppLogLine, type AppLogType, type AppLogsParams, type AppLogsResponse, type AppSizes, type AppStatus, type CreateAppDraftParams, type CreateAppDraftResponse, type CreateAppParams, type CreateAppResponse, type DeleteAppResponse, type DeployAppParams, type DeployAppResponse, type DeploymentPhase, type GetAppResponse, type GetAppSizesResponse, type GetDeploymentResponse, type ImageDeployPolicy, type ListAppsResponse, type PreviewAppResizeResponse, type PreviewAppResponse, type ResizeAppResponse, type UpdateAppParams, type UpdateAppResponse, type WaitForDeploymentParams, } from "./services/apps";
9
+ export { BucketsService, type Bucket, type BucketTier, type CreateBucketParams, type CreateBucketResponse, type DeleteBucketResponse, type ListBucketsResponse, type PreviewBucketParams, type PreviewBucketResponse, } from "./services/buckets";
10
+ export { CatalogService, type AppSize, type CatalogRegion, type DatabaseCatalog, type DatabaseSize, type GetDatabaseCatalogResponse, type ListAppRegionsResponse, type ListAppSizesResponse, type ListRedisPlansResponse, type ListRegionsResponse, type ListServerImagesResponse, type ListServerSizesResponse, type RedisPlan, type ServerSize, } from "./services/catalog";
11
+ export { DatabasesService, type CreateDedicatedDatabaseParams, type CreateDedicatedDatabaseResponse, type DatabaseSummary, type DedicatedDatabase, type DedicatedDatabaseDetail, type DeleteDatabaseResponse, type GetDedicatedDatabaseResponse, type GetSharedDatabaseResponse, type ListDatabasesResponse, type ListDedicatedDatabasesResponse, type ListSharedDatabasesResponse, type PreviewDedicatedDatabaseParams, type PreviewDedicatedDatabaseResponse, type SharedDatabase, } from "./services/databases";
11
12
  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";
13
+ export { EmailService, type CreateSmtpCredentialParams, type CreateSmtpCredentialResponse, type EmailDomain, type EmailDomainDetail, type GetEmailDomainResponse, type ListEmailDomainsResponse, type NewSmtpCredential, type SendEmailParams, type SendEmailResponse, } from "./services/email";
14
+ export { HostingService, type CreateHostingSiteParams, type CreateHostingSiteResponse, type DeleteHostingSiteResponse, type GetHostingAccessResponse, type GetHostingSiteParams, type GetHostingSiteResponse, type GetHostingSiteWithCredentialsResponse, type HostingAccess, type HostingPrice, type HostingSite, type HostingSiteStatus, type HostingSiteWithCredentials, type HostingTier, type ListHostingPricesResponse, type ListHostingSitesResponse, type PreviewHostingSiteParams, type PreviewHostingSiteResponse, } from "./services/hosting";
15
+ export { IamService, type CreateIamCredentialParams, type CreateIamCredentialResponse, type GetIamCredentialResponse, type IamCredential, type IamCredentialList, type IamRegistryGrant, type IamStorageGrant, type ListIamCredentialsResponse, type NewIamCredential, } from "./services/iam";
15
16
  export { MembersService, type ListMembersResponse, type ProjectMember, type ProjectMembers } from "./services/members";
17
+ export type { CheckoutPreview, PlanChangePreview } from "./services/preview";
16
18
  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";
19
+ export { RedisService, type CreateRedisParams, type CreateRedisResponse, type DeleteRedisDatabaseResponse, type GetRedisDatabaseResponse, type ListRedisDatabasesResponse, type PreviewRedisParams, type PreviewRedisResponse, type RedisDatabase, type RedisDatabaseDetail, type RedisPersistence, } from "./services/redis";
20
+ export { RegistriesService, type CreateRegistryParams, type CreateRegistryResponse, type DeleteRegistryResponse, type GetRegistryResponse, type ListRegistriesResponse, type ListRegistryProvidersResponse, type PreviewRegistryResponse, type Registry, type RegistryProvider, type RegistryRepository, } from "./services/registries";
21
+ export { ServersService, type CreateServerParams, type CreateServerResponse, type DeleteServerResponse, type GetServerResponse, type ListServersResponse, type PreviewServerParams, type PreviewServerResponse, type Server, type ServerDetail, type ServerStatus, } from "./services/servers";
22
+ export { SshKeysService, type CreateSshKeyParams, type CreateSshKeyResponse, type DeleteSshKeyResponse, type GenerateSshKeyResponse, type GeneratedSshKey, type ListSshKeysResponse, type SshKey, } from "./services/ssh-keys";
21
23
  export { PROJECT_ENVIRONMENTS, type Actor, type ProjectEnvironment, } from "./services/project-config";
22
24
  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";
23
25
  export { VariablesService, type CreateVariableParams, type GetVariableResponse, type ListVariablesParams, type ListVariablesResponse, type ProjectVariable, type SetVariableResponse, type UpdateVariableParams, } from "./services/variables";
package/dist/index.js CHANGED
@@ -24,6 +24,7 @@ __export(index_exports, {
24
24
  AppsService: () => AppsService,
25
25
  AuthenticationError: () => AuthenticationError,
26
26
  BucketsService: () => BucketsService,
27
+ CatalogService: () => CatalogService,
27
28
  ConflictError: () => ConflictError,
28
29
  Cosmoner: () => Cosmoner,
29
30
  CosmonerConnectionError: () => CosmonerConnectionError,
@@ -223,6 +224,64 @@ var AppsService = class {
223
224
  if (!appId) throw new Error("appId is required");
224
225
  return this.transport.request("DELETE", `${this.basePath(params.projectId)}/${appId}`);
225
226
  }
227
+ /** Prices an app of a size before ordering it. `monthly` is exact; `dueToday` is an estimate once the project has a subscription. */
228
+ async preview(params) {
229
+ if (!params?.size) throw new Error("size is required");
230
+ return this.transport.request("GET", `${this.basePath(params.projectId)}/preview`, {
231
+ query: { size: params.size }
232
+ });
233
+ }
234
+ /**
235
+ * Saves what an app should be, without creating or billing anything. The
236
+ * draft expires after 24 hours; `create()` turns it into an app. The app
237
+ * gets a Cosmoner subdomain.
238
+ */
239
+ async createDraft(params) {
240
+ if (!params?.name) throw new Error("name is required");
241
+ if (!params.size) throw new Error("size is required");
242
+ if (!params.region) throw new Error("region is required");
243
+ const { projectId, ...fields } = params;
244
+ return this.transport.request("POST", `${this.basePath(projectId)}/draft`, {
245
+ body: { ...fields, domainType: "cosmoner" }
246
+ });
247
+ }
248
+ /**
249
+ * Creates and deploys the app a draft describes. It starts `DEPLOYING`.
250
+ *
251
+ * Charges the project's saved card immediately, with a prorated invoice. It
252
+ * is refused with 402 before anything is created when the project cannot be
253
+ * billed.
254
+ */
255
+ async create(params) {
256
+ if (!params?.draftId) throw new Error("draftId is required");
257
+ if (!params.size) throw new Error("size is required");
258
+ return this.transport.request("POST", this.basePath(params.projectId), {
259
+ body: { draftId: params.draftId, size: params.size }
260
+ });
261
+ }
262
+ /** Lists the sizes an app can move to, and whether it can be resized at all. */
263
+ async sizes(appId, params = {}) {
264
+ if (!appId) throw new Error("appId is required");
265
+ return this.transport.request("GET", `${this.basePath(params.projectId)}/${appId}/sizes`);
266
+ }
267
+ /** Prices moving an app to another size. */
268
+ async resizePreview(appId, params) {
269
+ if (!appId) throw new Error("appId is required");
270
+ if (!params?.size) throw new Error("size is required");
271
+ return this.transport.request(
272
+ "GET",
273
+ `${this.basePath(params.projectId)}/${appId}/resize-preview`,
274
+ { query: { size: params.size } }
275
+ );
276
+ }
277
+ /** Moves an app to another size. Charges the difference to the saved card immediately. */
278
+ async resize(appId, params) {
279
+ if (!appId) throw new Error("appId is required");
280
+ if (!params?.size) throw new Error("size is required");
281
+ return this.transport.request("PATCH", `${this.basePath(params.projectId)}/${appId}/size`, {
282
+ body: { size: params.size }
283
+ });
284
+ }
226
285
  };
227
286
 
228
287
  // src/services/buckets.ts
@@ -247,6 +306,78 @@ var BucketsService = class {
247
306
  basePath(projectId) {
248
307
  return `/v1/projects/${resolveProjectId(this.config, projectId)}/storage/object-storage`;
249
308
  }
309
+ /**
310
+ * Prices a bucket's tier before ordering it. CDN traffic is metered and not
311
+ * included. `monthly` is exact; `dueToday` is an estimate once the project
312
+ * has a subscription.
313
+ */
314
+ async preview(params = {}) {
315
+ return this.transport.request("GET", `${this.basePath(params.projectId)}/preview`, {
316
+ query: { provider: "AWS_S3", tier: params.tier ?? "STARTER" }
317
+ });
318
+ }
319
+ /**
320
+ * Orders a bucket. It is ready when this returns; names are unique, so list
321
+ * and match the name to read it.
322
+ *
323
+ * Charges the project's saved card immediately, with a prorated invoice. It
324
+ * is refused with 402 before anything is created when the project cannot be
325
+ * billed.
326
+ */
327
+ async create(params) {
328
+ if (!params?.name) throw new Error("name is required");
329
+ if (!params.region) throw new Error("region is required");
330
+ return this.transport.request("POST", this.basePath(params.projectId), {
331
+ body: {
332
+ name: params.name,
333
+ provider: "AWS_S3",
334
+ region: params.region,
335
+ tier: params.tier,
336
+ publicAccess: params.publicAccess,
337
+ versioning: params.versioning,
338
+ cdnEnabled: params.cdnEnabled
339
+ }
340
+ });
341
+ }
342
+ };
343
+
344
+ // src/services/catalog.ts
345
+ var CatalogService = class {
346
+ constructor(transport) {
347
+ this.transport = transport;
348
+ }
349
+ /** Lists server sizes and their prices. */
350
+ async serverSizes() {
351
+ return this.transport.request("GET", "/v1/catalog/servers/sizes");
352
+ }
353
+ /** Lists the regions servers can be created in. */
354
+ async serverRegions() {
355
+ return this.transport.request("GET", "/v1/catalog/servers/regions");
356
+ }
357
+ /** Lists the one-click images a server can be created from. */
358
+ async serverImages() {
359
+ return this.transport.request("GET", "/v1/catalog/servers/1-clicks");
360
+ }
361
+ /** Lists Redis plans and their prices. */
362
+ async redisPlans() {
363
+ return this.transport.request("GET", "/v1/catalog/redis/plans");
364
+ }
365
+ /** Lists the regions Redis can be created in. */
366
+ async redisRegions() {
367
+ return this.transport.request("GET", "/v1/catalog/redis/regions");
368
+ }
369
+ /** Lists dedicated database sizes, engines with their versions, and regions. */
370
+ async databases() {
371
+ return this.transport.request("GET", "/v1/catalog/databases");
372
+ }
373
+ /** Lists app sizes and their prices. */
374
+ async appSizes() {
375
+ return this.transport.request("GET", "/v1/catalog/apps/sizes");
376
+ }
377
+ /** Lists the regions apps can be created in. */
378
+ async appRegions() {
379
+ return this.transport.request("GET", "/v1/catalog/apps/regions");
380
+ }
250
381
  };
251
382
 
252
383
  // src/services/databases.ts
@@ -303,6 +434,42 @@ var DatabasesService = class {
303
434
  `${this.basePath(params.projectId)}/shared/${tenantId}`
304
435
  );
305
436
  }
437
+ /** Prices a dedicated database before ordering it. `monthly` is exact; `dueToday` is an estimate once the project has a subscription. */
438
+ async previewDedicated(params) {
439
+ if (!params?.size) throw new Error("size is required");
440
+ return this.transport.request(
441
+ "GET",
442
+ `${this.basePath(params.projectId)}/dedicated/preview`,
443
+ { query: { slug: params.size } }
444
+ );
445
+ }
446
+ /**
447
+ * Orders a dedicated database. It starts `CREATING`; the response carries
448
+ * no id, so list and match the name to follow it.
449
+ *
450
+ * Charges the project's saved card immediately, with a prorated invoice. It
451
+ * is refused with 402 before anything is created when the project cannot be
452
+ * billed.
453
+ */
454
+ async createDedicated(params) {
455
+ if (!params?.name) throw new Error("name is required");
456
+ if (!params.size) throw new Error("size is required");
457
+ if (!params.version) throw new Error("version is required");
458
+ if (!params.region) throw new Error("region is required");
459
+ return this.transport.request(
460
+ "POST",
461
+ `${this.basePath(params.projectId)}/dedicated`,
462
+ {
463
+ body: {
464
+ name: params.name,
465
+ engine: params.engine ?? "POSTGRESQL",
466
+ version: params.version,
467
+ slug: params.size,
468
+ region: params.region
469
+ }
470
+ }
471
+ );
472
+ }
306
473
  };
307
474
 
308
475
  // src/services/domains.ts
@@ -421,6 +588,33 @@ var EmailService = class {
421
588
  `/v1/projects/${resolveProjectId(this.config, params.projectId)}/email/${emailDomainId}`
422
589
  );
423
590
  }
591
+ /**
592
+ * Creates an SMTP credential for a sending domain. The response holds
593
+ * `smtpPassword` this once: the API keeps only a hash.
594
+ */
595
+ // eslint-disable-next-line require-await -- `async` makes the validation below reject rather than throw synchronously.
596
+ async createCredential(emailDomainId, params) {
597
+ if (!emailDomainId) throw new Error("emailDomainId is required");
598
+ if (!params?.label) throw new Error("label is required");
599
+ if (!params.fromAddress) throw new Error("fromAddress is required");
600
+ return this.transport.request(
601
+ "POST",
602
+ `/v1/projects/${resolveProjectId(this.config, params.projectId)}/email/${emailDomainId}/credentials`,
603
+ { body: { label: params.label, fromAddress: params.fromAddress } }
604
+ );
605
+ }
606
+ /**
607
+ * Deletes an SMTP credential; anything sending with it stops working. The
608
+ * API answers 204, so there is nothing to return.
609
+ */
610
+ async deleteCredential(emailDomainId, credentialId, params = {}) {
611
+ if (!emailDomainId) throw new Error("emailDomainId is required");
612
+ if (!credentialId) throw new Error("credentialId is required");
613
+ await this.transport.request(
614
+ "DELETE",
615
+ `/v1/projects/${resolveProjectId(this.config, params.projectId)}/email/${emailDomainId}/credentials/${credentialId}`
616
+ );
617
+ }
424
618
  };
425
619
 
426
620
  // src/services/hosting.ts
@@ -458,6 +652,36 @@ var HostingService = class {
458
652
  if (!siteId) throw new Error("siteId is required");
459
653
  return this.transport.request("DELETE", `${this.basePath(params.projectId)}/${siteId}`);
460
654
  }
655
+ /** Lists hosting plans and their monthly prices. */
656
+ async prices(params = {}) {
657
+ return this.transport.request("GET", `${this.basePath(params.projectId)}/prices`);
658
+ }
659
+ /** Prices a site before ordering it. `monthly` is exact; `dueToday` is an estimate once the project has a subscription. */
660
+ async preview(params) {
661
+ if (!params?.tier) throw new Error("tier is required");
662
+ return this.transport.request("GET", `${this.basePath(params.projectId)}/preview`, {
663
+ query: { tier: params.tier, extraStorageGb: params.extraStorageGb ?? 0 }
664
+ });
665
+ }
666
+ /**
667
+ * Orders a hosting site, and its database when one is named.
668
+ *
669
+ * Charges the project's saved card immediately, with a prorated invoice. It
670
+ * is refused with 402 before anything is created when the project cannot be
671
+ * billed.
672
+ */
673
+ async create(params) {
674
+ if (!params?.siteName) throw new Error("siteName is required");
675
+ return this.transport.request("POST", this.basePath(params.projectId), {
676
+ body: {
677
+ siteName: params.siteName,
678
+ tier: params.tier,
679
+ phpVersion: params.phpVersion,
680
+ database: params.database === void 0 ? void 0 : { name: params.database },
681
+ extraStorageGb: params.extraStorageGb
682
+ }
683
+ });
684
+ }
461
685
  };
462
686
 
463
687
  // src/services/iam.ts
@@ -490,6 +714,18 @@ var IamService = class {
490
714
  if (!iamUserName) throw new Error("iamUserName is required");
491
715
  await this.transport.request("DELETE", `${this.basePath(params.projectId)}/${encodeURIComponent(iamUserName)}`);
492
716
  }
717
+ /**
718
+ * Creates an access key for object storage, the container registry, or both.
719
+ * The response holds `secretAccessKey` this once: the API keeps no copy, and
720
+ * no later read returns it.
721
+ */
722
+ async create(params) {
723
+ if (!params?.label) throw new Error("label is required");
724
+ if (!params.storage && !params.registry) throw new Error("storage or registry is required");
725
+ return this.transport.request("POST", this.basePath(params.projectId), {
726
+ body: { label: params.label, storage: params.storage, registry: params.registry }
727
+ });
728
+ }
493
729
  };
494
730
 
495
731
  // src/services/members.ts
@@ -547,6 +783,29 @@ var RedisService = class {
547
783
  if (!redisId) throw new Error("redisId is required");
548
784
  return this.transport.request("DELETE", `${this.basePath(params.projectId)}/${redisId}`);
549
785
  }
786
+ /** Prices a Redis database before ordering it. `monthly` is exact; `dueToday` is an estimate once the project has a subscription. */
787
+ async preview(params) {
788
+ if (!params?.plan) throw new Error("plan is required");
789
+ return this.transport.request("GET", `${this.basePath(params.projectId)}/preview`, {
790
+ query: { planSlug: params.plan }
791
+ });
792
+ }
793
+ /**
794
+ * Orders a Redis database. It starts `CREATING`; the response carries no
795
+ * id, so list and match the name to follow it.
796
+ *
797
+ * Charges the project's saved card immediately, with a prorated invoice. It
798
+ * is refused with 402 before anything is created when the project cannot be
799
+ * billed.
800
+ */
801
+ async create(params) {
802
+ if (!params?.name) throw new Error("name is required");
803
+ if (!params.plan) throw new Error("plan is required");
804
+ if (!params.region) throw new Error("region is required");
805
+ return this.transport.request("POST", this.basePath(params.projectId), {
806
+ body: { name: params.name, planSlug: params.plan, region: params.region, dataPersistence: params.persistence }
807
+ });
808
+ }
550
809
  };
551
810
 
552
811
  // src/services/registries.ts
@@ -573,6 +832,32 @@ var RegistriesService = class {
573
832
  if (!registryId) throw new Error("registryId is required");
574
833
  return this.transport.request("DELETE", `${this.basePath(params.projectId)}/${registryId}`);
575
834
  }
835
+ /**
836
+ * Prices a registry's base fee before ordering it. Storage and egress are
837
+ * metered and not included. `monthly` is exact; `dueToday` is an estimate
838
+ * once the project has a subscription.
839
+ */
840
+ async preview(params = {}) {
841
+ return this.transport.request("GET", `${this.basePath(params.projectId)}/preview`);
842
+ }
843
+ /** Lists the providers a registry can be created with, and their regions. */
844
+ async providers(params = {}) {
845
+ return this.transport.request("GET", `${this.basePath(params.projectId)}/providers`);
846
+ }
847
+ /**
848
+ * Orders a registry. It is ready when this returns.
849
+ *
850
+ * Charges the project's saved card immediately, with a prorated invoice. It
851
+ * is refused with 402 before anything is created when the project cannot be
852
+ * billed.
853
+ */
854
+ async create(params) {
855
+ if (!params?.name) throw new Error("name is required");
856
+ if (!params.region) throw new Error("region is required");
857
+ return this.transport.request("POST", this.basePath(params.projectId), {
858
+ body: { name: params.name, region: params.region, provider: params.provider }
859
+ });
860
+ }
576
861
  };
577
862
 
578
863
  // src/services/project-config.ts
@@ -705,6 +990,36 @@ var ServersService = class {
705
990
  if (!serverId) throw new Error("serverId is required");
706
991
  return this.transport.request("DELETE", `${this.basePath(params.projectId)}/${serverId}`);
707
992
  }
993
+ /** Prices a server before ordering it. `monthly` is exact; `dueToday` is an estimate once the project has a subscription. */
994
+ async preview(params) {
995
+ if (!params?.size) throw new Error("size is required");
996
+ return this.transport.request("GET", `${this.basePath(params.projectId)}/preview`, {
997
+ query: { provider: params.provider ?? "digitalocean", slug: params.size }
998
+ });
999
+ }
1000
+ /**
1001
+ * Orders a server. It starts `PROVISIONING`; the response carries no id, so
1002
+ * list servers and match the name to follow it.
1003
+ *
1004
+ * Charges the project's saved card immediately, with a prorated invoice. It
1005
+ * is refused with 402 before anything is created when the project cannot be
1006
+ * billed.
1007
+ */
1008
+ async create(params) {
1009
+ if (!params?.name) throw new Error("name is required");
1010
+ if (!params.size) throw new Error("size is required");
1011
+ if (!params.region) throw new Error("region is required");
1012
+ return this.transport.request("POST", this.basePath(params.projectId), {
1013
+ body: {
1014
+ name: params.name,
1015
+ slug: params.size,
1016
+ provider: params.provider ?? "digitalocean",
1017
+ region: params.region,
1018
+ template: params.image,
1019
+ sshKeyIds: params.sshKeyIds
1020
+ }
1021
+ });
1022
+ }
708
1023
  };
709
1024
 
710
1025
  // src/services/ssh-keys.ts
@@ -737,6 +1052,16 @@ var SshKeysService = class {
737
1052
  basePath(projectId) {
738
1053
  return `/v1/projects/${resolveProjectId(this.config, projectId)}/ssh-keys`;
739
1054
  }
1055
+ /**
1056
+ * Generates a key pair and adds its public half to the project. The response
1057
+ * holds `privateKey` this once: the API never stores it.
1058
+ */
1059
+ async generate(params) {
1060
+ if (!params?.name) throw new Error("name is required");
1061
+ return this.transport.request("POST", `${this.basePath(params.projectId)}/generate`, {
1062
+ body: { name: params.name }
1063
+ });
1064
+ }
740
1065
  };
741
1066
 
742
1067
  // src/services/variables.ts
@@ -1185,7 +1510,7 @@ function sleep(ms) {
1185
1510
  }
1186
1511
 
1187
1512
  // src/version.ts
1188
- var VERSION = "1.9.0";
1513
+ var VERSION = "1.11.0";
1189
1514
  var USER_AGENT = `cosmoner-node/${VERSION}`;
1190
1515
 
1191
1516
  // src/transport.ts
@@ -1317,6 +1642,7 @@ var Cosmoner = class {
1317
1642
  this.iam = new IamService(this.transport, this.config);
1318
1643
  this.members = new MembersService(this.transport, this.config);
1319
1644
  this.projects = new ProjectsService(this.transport);
1645
+ this.catalog = new CatalogService(this.transport);
1320
1646
  this.redis = new RedisService(this.transport, this.config);
1321
1647
  this.registries = new RegistriesService(this.transport, this.config);
1322
1648
  this.secrets = new SecretsService(this.transport, this.config);
@@ -1666,6 +1992,7 @@ var index_default = Cosmoner;
1666
1992
  AppsService,
1667
1993
  AuthenticationError,
1668
1994
  BucketsService,
1995
+ CatalogService,
1669
1996
  ConflictError,
1670
1997
  Cosmoner,
1671
1998
  CosmonerConnectionError,