@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
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,18 +5,20 @@ 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 {
|
|
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
13
|
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 { 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";
|
|
14
15
|
export { IamService, type GetIamCredentialResponse, type IamCredential, type IamCredentialList, type ListIamCredentialsResponse, } 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";
|
|
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";
|
|
20
22
|
export { SshKeysService, type CreateSshKeyParams, type CreateSshKeyResponse, type DeleteSshKeyResponse, 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";
|
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
|
|
@@ -458,6 +625,36 @@ var HostingService = class {
|
|
|
458
625
|
if (!siteId) throw new Error("siteId is required");
|
|
459
626
|
return this.transport.request("DELETE", `${this.basePath(params.projectId)}/${siteId}`);
|
|
460
627
|
}
|
|
628
|
+
/** Lists hosting plans and their monthly prices. */
|
|
629
|
+
async prices(params = {}) {
|
|
630
|
+
return this.transport.request("GET", `${this.basePath(params.projectId)}/prices`);
|
|
631
|
+
}
|
|
632
|
+
/** Prices a site before ordering it. `monthly` is exact; `dueToday` is an estimate once the project has a subscription. */
|
|
633
|
+
async preview(params) {
|
|
634
|
+
if (!params?.tier) throw new Error("tier is required");
|
|
635
|
+
return this.transport.request("GET", `${this.basePath(params.projectId)}/preview`, {
|
|
636
|
+
query: { tier: params.tier, extraStorageGb: params.extraStorageGb ?? 0 }
|
|
637
|
+
});
|
|
638
|
+
}
|
|
639
|
+
/**
|
|
640
|
+
* Orders a hosting site, and its database when one is named.
|
|
641
|
+
*
|
|
642
|
+
* Charges the project's saved card immediately, with a prorated invoice. It
|
|
643
|
+
* is refused with 402 before anything is created when the project cannot be
|
|
644
|
+
* billed.
|
|
645
|
+
*/
|
|
646
|
+
async create(params) {
|
|
647
|
+
if (!params?.siteName) throw new Error("siteName is required");
|
|
648
|
+
return this.transport.request("POST", this.basePath(params.projectId), {
|
|
649
|
+
body: {
|
|
650
|
+
siteName: params.siteName,
|
|
651
|
+
tier: params.tier,
|
|
652
|
+
phpVersion: params.phpVersion,
|
|
653
|
+
database: params.database === void 0 ? void 0 : { name: params.database },
|
|
654
|
+
extraStorageGb: params.extraStorageGb
|
|
655
|
+
}
|
|
656
|
+
});
|
|
657
|
+
}
|
|
461
658
|
};
|
|
462
659
|
|
|
463
660
|
// src/services/iam.ts
|
|
@@ -547,6 +744,29 @@ var RedisService = class {
|
|
|
547
744
|
if (!redisId) throw new Error("redisId is required");
|
|
548
745
|
return this.transport.request("DELETE", `${this.basePath(params.projectId)}/${redisId}`);
|
|
549
746
|
}
|
|
747
|
+
/** Prices a Redis database before ordering it. `monthly` is exact; `dueToday` is an estimate once the project has a subscription. */
|
|
748
|
+
async preview(params) {
|
|
749
|
+
if (!params?.plan) throw new Error("plan is required");
|
|
750
|
+
return this.transport.request("GET", `${this.basePath(params.projectId)}/preview`, {
|
|
751
|
+
query: { planSlug: params.plan }
|
|
752
|
+
});
|
|
753
|
+
}
|
|
754
|
+
/**
|
|
755
|
+
* Orders a Redis database. It starts `CREATING`; the response carries no
|
|
756
|
+
* id, so list and match the name to follow it.
|
|
757
|
+
*
|
|
758
|
+
* Charges the project's saved card immediately, with a prorated invoice. It
|
|
759
|
+
* is refused with 402 before anything is created when the project cannot be
|
|
760
|
+
* billed.
|
|
761
|
+
*/
|
|
762
|
+
async create(params) {
|
|
763
|
+
if (!params?.name) throw new Error("name is required");
|
|
764
|
+
if (!params.plan) throw new Error("plan is required");
|
|
765
|
+
if (!params.region) throw new Error("region is required");
|
|
766
|
+
return this.transport.request("POST", this.basePath(params.projectId), {
|
|
767
|
+
body: { name: params.name, planSlug: params.plan, region: params.region, dataPersistence: params.persistence }
|
|
768
|
+
});
|
|
769
|
+
}
|
|
550
770
|
};
|
|
551
771
|
|
|
552
772
|
// src/services/registries.ts
|
|
@@ -573,6 +793,32 @@ var RegistriesService = class {
|
|
|
573
793
|
if (!registryId) throw new Error("registryId is required");
|
|
574
794
|
return this.transport.request("DELETE", `${this.basePath(params.projectId)}/${registryId}`);
|
|
575
795
|
}
|
|
796
|
+
/**
|
|
797
|
+
* Prices a registry's base fee before ordering it. Storage and egress are
|
|
798
|
+
* metered and not included. `monthly` is exact; `dueToday` is an estimate
|
|
799
|
+
* once the project has a subscription.
|
|
800
|
+
*/
|
|
801
|
+
async preview(params = {}) {
|
|
802
|
+
return this.transport.request("GET", `${this.basePath(params.projectId)}/preview`);
|
|
803
|
+
}
|
|
804
|
+
/** Lists the providers a registry can be created with, and their regions. */
|
|
805
|
+
async providers(params = {}) {
|
|
806
|
+
return this.transport.request("GET", `${this.basePath(params.projectId)}/providers`);
|
|
807
|
+
}
|
|
808
|
+
/**
|
|
809
|
+
* Orders a registry. It is ready when this returns.
|
|
810
|
+
*
|
|
811
|
+
* Charges the project's saved card immediately, with a prorated invoice. It
|
|
812
|
+
* is refused with 402 before anything is created when the project cannot be
|
|
813
|
+
* billed.
|
|
814
|
+
*/
|
|
815
|
+
async create(params) {
|
|
816
|
+
if (!params?.name) throw new Error("name is required");
|
|
817
|
+
if (!params.region) throw new Error("region is required");
|
|
818
|
+
return this.transport.request("POST", this.basePath(params.projectId), {
|
|
819
|
+
body: { name: params.name, region: params.region, provider: params.provider }
|
|
820
|
+
});
|
|
821
|
+
}
|
|
576
822
|
};
|
|
577
823
|
|
|
578
824
|
// src/services/project-config.ts
|
|
@@ -705,6 +951,36 @@ var ServersService = class {
|
|
|
705
951
|
if (!serverId) throw new Error("serverId is required");
|
|
706
952
|
return this.transport.request("DELETE", `${this.basePath(params.projectId)}/${serverId}`);
|
|
707
953
|
}
|
|
954
|
+
/** Prices a server before ordering it. `monthly` is exact; `dueToday` is an estimate once the project has a subscription. */
|
|
955
|
+
async preview(params) {
|
|
956
|
+
if (!params?.size) throw new Error("size is required");
|
|
957
|
+
return this.transport.request("GET", `${this.basePath(params.projectId)}/preview`, {
|
|
958
|
+
query: { provider: params.provider ?? "digitalocean", slug: params.size }
|
|
959
|
+
});
|
|
960
|
+
}
|
|
961
|
+
/**
|
|
962
|
+
* Orders a server. It starts `PROVISIONING`; the response carries no id, so
|
|
963
|
+
* list servers and match the name to follow it.
|
|
964
|
+
*
|
|
965
|
+
* Charges the project's saved card immediately, with a prorated invoice. It
|
|
966
|
+
* is refused with 402 before anything is created when the project cannot be
|
|
967
|
+
* billed.
|
|
968
|
+
*/
|
|
969
|
+
async create(params) {
|
|
970
|
+
if (!params?.name) throw new Error("name is required");
|
|
971
|
+
if (!params.size) throw new Error("size is required");
|
|
972
|
+
if (!params.region) throw new Error("region is required");
|
|
973
|
+
return this.transport.request("POST", this.basePath(params.projectId), {
|
|
974
|
+
body: {
|
|
975
|
+
name: params.name,
|
|
976
|
+
slug: params.size,
|
|
977
|
+
provider: params.provider ?? "digitalocean",
|
|
978
|
+
region: params.region,
|
|
979
|
+
template: params.image,
|
|
980
|
+
sshKeyIds: params.sshKeyIds
|
|
981
|
+
}
|
|
982
|
+
});
|
|
983
|
+
}
|
|
708
984
|
};
|
|
709
985
|
|
|
710
986
|
// src/services/ssh-keys.ts
|
|
@@ -1185,7 +1461,7 @@ function sleep(ms) {
|
|
|
1185
1461
|
}
|
|
1186
1462
|
|
|
1187
1463
|
// src/version.ts
|
|
1188
|
-
var VERSION = "1.
|
|
1464
|
+
var VERSION = "1.10.0";
|
|
1189
1465
|
var USER_AGENT = `cosmoner-node/${VERSION}`;
|
|
1190
1466
|
|
|
1191
1467
|
// src/transport.ts
|
|
@@ -1317,6 +1593,7 @@ var Cosmoner = class {
|
|
|
1317
1593
|
this.iam = new IamService(this.transport, this.config);
|
|
1318
1594
|
this.members = new MembersService(this.transport, this.config);
|
|
1319
1595
|
this.projects = new ProjectsService(this.transport);
|
|
1596
|
+
this.catalog = new CatalogService(this.transport);
|
|
1320
1597
|
this.redis = new RedisService(this.transport, this.config);
|
|
1321
1598
|
this.registries = new RegistriesService(this.transport, this.config);
|
|
1322
1599
|
this.secrets = new SecretsService(this.transport, this.config);
|
|
@@ -1666,6 +1943,7 @@ var index_default = Cosmoner;
|
|
|
1666
1943
|
AppsService,
|
|
1667
1944
|
AuthenticationError,
|
|
1668
1945
|
BucketsService,
|
|
1946
|
+
CatalogService,
|
|
1669
1947
|
ConflictError,
|
|
1670
1948
|
Cosmoner,
|
|
1671
1949
|
CosmonerConnectionError,
|