@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 +34 -0
- package/dist/client.d.ts +21 -0
- package/dist/index.d.ts +13 -3
- package/dist/index.js +410 -1
- package/dist/index.mjs +400 -1
- package/dist/services/apps.d.ts +56 -0
- package/dist/services/buckets.d.ts +45 -0
- package/dist/services/databases.d.ts +111 -0
- package/dist/services/domains.d.ts +86 -0
- package/dist/services/email.d.ts +61 -0
- package/dist/services/hosting.d.ts +3 -0
- package/dist/services/iam.d.ts +66 -0
- package/dist/services/members.d.ts +50 -0
- package/dist/services/projects.d.ts +45 -0
- package/dist/services/redis.d.ts +58 -0
- package/dist/services/registries.d.ts +50 -0
- package/dist/services/servers.d.ts +59 -0
- package/dist/services/ssh-keys.d.ts +51 -0
- package/dist/version.d.ts +2 -2
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -53,6 +53,24 @@ var AppsService = class {
|
|
|
53
53
|
async list(params = {}) {
|
|
54
54
|
return this.transport.request("GET", this.basePath(params.projectId));
|
|
55
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* Fetches one app by id, with its full configuration.
|
|
58
|
+
*
|
|
59
|
+
* Environment variables marked secret come back masked; any other
|
|
60
|
+
* variable's value is returned as stored.
|
|
61
|
+
*/
|
|
62
|
+
async get(appId, params = {}) {
|
|
63
|
+
if (!appId) throw new Error("appId is required");
|
|
64
|
+
return this.transport.request("GET", `${this.basePath(params.projectId)}/${appId}`);
|
|
65
|
+
}
|
|
66
|
+
/** Fetches the most recent lines of an app's build or runtime log. */
|
|
67
|
+
async logs(appId, params) {
|
|
68
|
+
if (!appId) throw new Error("appId is required");
|
|
69
|
+
if (params?.type !== "BUILD" && params?.type !== "RUN") throw new Error('type must be "BUILD" or "RUN"');
|
|
70
|
+
return this.transport.request("GET", `${this.basePath(params.projectId)}/${appId}/logs`, {
|
|
71
|
+
query: { type: params.type }
|
|
72
|
+
});
|
|
73
|
+
}
|
|
56
74
|
/**
|
|
57
75
|
* Starts deploying an image app and returns the deployment without waiting.
|
|
58
76
|
*
|
|
@@ -110,6 +128,161 @@ var AppsService = class {
|
|
|
110
128
|
await new Promise((resolve) => setTimeout(resolve, Math.min(interval, remaining)));
|
|
111
129
|
}
|
|
112
130
|
}
|
|
131
|
+
/**
|
|
132
|
+
* Changes an app's settings and applies them to the running app.
|
|
133
|
+
*
|
|
134
|
+
* Free: resizing, which is billed, is a separate call. The API answers 502
|
|
135
|
+
* when the settings were saved but the runtime refused them.
|
|
136
|
+
*/
|
|
137
|
+
async update(appId, params) {
|
|
138
|
+
if (!appId) throw new Error("appId is required");
|
|
139
|
+
const { projectId, ...changes } = params ?? {};
|
|
140
|
+
const body = Object.fromEntries(Object.entries(changes).filter(([, value]) => value !== void 0));
|
|
141
|
+
if (Object.keys(body).length === 0) throw new Error("at least one change is required");
|
|
142
|
+
return this.transport.request("PATCH", `${this.basePath(projectId)}/${appId}`, { body });
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Permanently deletes an app: its runtime, routing, custom hostname and
|
|
146
|
+
* billing, then the app itself. Its deployments go with it.
|
|
147
|
+
*/
|
|
148
|
+
async delete(appId, params = {}) {
|
|
149
|
+
if (!appId) throw new Error("appId is required");
|
|
150
|
+
return this.transport.request("DELETE", `${this.basePath(params.projectId)}/${appId}`);
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
// src/services/buckets.ts
|
|
155
|
+
var BucketsService = class {
|
|
156
|
+
constructor(transport, config) {
|
|
157
|
+
this.transport = transport;
|
|
158
|
+
this.config = config;
|
|
159
|
+
}
|
|
160
|
+
/** Lists every bucket in the project. */
|
|
161
|
+
async list(params = {}) {
|
|
162
|
+
return this.transport.request("GET", this.basePath(params.projectId));
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Permanently deletes a bucket with every object in it and the access
|
|
166
|
+
* credentials made for it, and stops its billing.
|
|
167
|
+
*/
|
|
168
|
+
async delete(bucketId, params = {}) {
|
|
169
|
+
if (!bucketId) throw new Error("bucketId is required");
|
|
170
|
+
return this.transport.request("DELETE", `${this.basePath(params.projectId)}/${bucketId}`);
|
|
171
|
+
}
|
|
172
|
+
/** Builds the collection route for the resolved project. */
|
|
173
|
+
basePath(projectId) {
|
|
174
|
+
return `/v1/projects/${resolveProjectId(this.config, projectId)}/storage/object-storage`;
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
// src/services/databases.ts
|
|
179
|
+
var DatabasesService = class {
|
|
180
|
+
constructor(transport, config) {
|
|
181
|
+
this.transport = transport;
|
|
182
|
+
this.config = config;
|
|
183
|
+
}
|
|
184
|
+
/** Builds the collection route for the resolved project. */
|
|
185
|
+
basePath(projectId) {
|
|
186
|
+
return `/v1/projects/${resolveProjectId(this.config, projectId)}/databases`;
|
|
187
|
+
}
|
|
188
|
+
/** Lists every database in the project, of every kind, newest first. */
|
|
189
|
+
async list(params = {}) {
|
|
190
|
+
return this.transport.request("GET", this.basePath(params.projectId));
|
|
191
|
+
}
|
|
192
|
+
/** Lists the project's dedicated databases. */
|
|
193
|
+
async listDedicated(params = {}) {
|
|
194
|
+
return this.transport.request("GET", `${this.basePath(params.projectId)}/dedicated`);
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Fetches one dedicated database. Its `connectionUri` carries the password;
|
|
198
|
+
* see {@link DedicatedDatabaseDetail}.
|
|
199
|
+
*/
|
|
200
|
+
async getDedicated(databaseId, params = {}) {
|
|
201
|
+
if (!databaseId) throw new Error("databaseId is required");
|
|
202
|
+
return this.transport.request(
|
|
203
|
+
"GET",
|
|
204
|
+
`${this.basePath(params.projectId)}/dedicated/${databaseId}`
|
|
205
|
+
);
|
|
206
|
+
}
|
|
207
|
+
/** Lists the project's databases on the shared cluster. */
|
|
208
|
+
async listShared(params = {}) {
|
|
209
|
+
return this.transport.request("GET", `${this.basePath(params.projectId)}/shared`);
|
|
210
|
+
}
|
|
211
|
+
/** Fetches one database on the shared cluster. */
|
|
212
|
+
async getShared(tenantId, params = {}) {
|
|
213
|
+
if (!tenantId) throw new Error("tenantId is required");
|
|
214
|
+
return this.transport.request("GET", `${this.basePath(params.projectId)}/shared/${tenantId}`);
|
|
215
|
+
}
|
|
216
|
+
/** Permanently deletes a dedicated database cluster and its data, and stops its billing. */
|
|
217
|
+
async deleteDedicated(databaseId, params = {}) {
|
|
218
|
+
if (!databaseId) throw new Error("databaseId is required");
|
|
219
|
+
return this.transport.request(
|
|
220
|
+
"DELETE",
|
|
221
|
+
`${this.basePath(params.projectId)}/dedicated/${databaseId}`
|
|
222
|
+
);
|
|
223
|
+
}
|
|
224
|
+
/** Permanently deletes a shared database and its data, and stops its billing. */
|
|
225
|
+
async deleteShared(tenantId, params = {}) {
|
|
226
|
+
if (!tenantId) throw new Error("tenantId is required");
|
|
227
|
+
return this.transport.request(
|
|
228
|
+
"DELETE",
|
|
229
|
+
`${this.basePath(params.projectId)}/shared/${tenantId}`
|
|
230
|
+
);
|
|
231
|
+
}
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
// src/services/domains.ts
|
|
235
|
+
var DomainsService = class {
|
|
236
|
+
constructor(transport, config) {
|
|
237
|
+
this.transport = transport;
|
|
238
|
+
this.config = config;
|
|
239
|
+
}
|
|
240
|
+
/** Builds the collection route for the resolved project. */
|
|
241
|
+
basePath(projectId) {
|
|
242
|
+
return `/v1/projects/${resolveProjectId(this.config, projectId)}/domains`;
|
|
243
|
+
}
|
|
244
|
+
/** Lists every domain in the project, with its DNS records. */
|
|
245
|
+
async list(params = {}) {
|
|
246
|
+
return this.transport.request("GET", this.basePath(params.projectId));
|
|
247
|
+
}
|
|
248
|
+
/** Fetches one domain by id or by name, e.g. `example.com`. */
|
|
249
|
+
async get(domain, params = {}) {
|
|
250
|
+
if (!domain) throw new Error("domain is required");
|
|
251
|
+
return this.transport.request(
|
|
252
|
+
"GET",
|
|
253
|
+
`${this.basePath(params.projectId)}/${encodeURIComponent(domain)}`
|
|
254
|
+
);
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Adds a domain you already own, e.g. `example.com`. Free. Publish the
|
|
258
|
+
* returned `verificationRecord`, then call `verify()`. Buying a domain is not
|
|
259
|
+
* part of the SDK.
|
|
260
|
+
*/
|
|
261
|
+
async create(name, params = {}) {
|
|
262
|
+
if (!name) throw new Error("name is required");
|
|
263
|
+
return this.transport.request("POST", this.basePath(params.projectId), {
|
|
264
|
+
body: { name, type: "EXTERNAL" }
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
/** Checks a domain's verification record, by domain id or name. */
|
|
268
|
+
async verify(domain, params = {}) {
|
|
269
|
+
if (!domain) throw new Error("domain is required");
|
|
270
|
+
return this.transport.request(
|
|
271
|
+
"POST",
|
|
272
|
+
`${this.basePath(params.projectId)}/${encodeURIComponent(domain)}/verify`
|
|
273
|
+
);
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* Removes a domain and its DNS records, by id or name. Refused with 409
|
|
277
|
+
* while an app or an email domain uses it.
|
|
278
|
+
*/
|
|
279
|
+
async delete(domain, params = {}) {
|
|
280
|
+
if (!domain) throw new Error("domain is required");
|
|
281
|
+
return this.transport.request(
|
|
282
|
+
"DELETE",
|
|
283
|
+
`${this.basePath(params.projectId)}/${encodeURIComponent(domain)}`
|
|
284
|
+
);
|
|
285
|
+
}
|
|
113
286
|
};
|
|
114
287
|
|
|
115
288
|
// src/services/email.ts
|
|
@@ -146,6 +319,34 @@ var EmailService = class {
|
|
|
146
319
|
}
|
|
147
320
|
);
|
|
148
321
|
}
|
|
322
|
+
/** Lists the project's sending domains, with their SMTP credentials and DNS records. */
|
|
323
|
+
// eslint-disable-next-line require-await -- kept `async` like every method here, so callers get one promise contract.
|
|
324
|
+
async listDomains(params = {}) {
|
|
325
|
+
return this.transport.request(
|
|
326
|
+
"GET",
|
|
327
|
+
`/v1/projects/${resolveProjectId(this.config, params.projectId)}/email`
|
|
328
|
+
);
|
|
329
|
+
}
|
|
330
|
+
/** Fetches one sending domain by its id (not its domain name). */
|
|
331
|
+
// eslint-disable-next-line require-await -- `async` makes the validation below reject rather than throw synchronously.
|
|
332
|
+
async getDomain(emailDomainId, params = {}) {
|
|
333
|
+
if (!emailDomainId) throw new Error("emailDomainId is required");
|
|
334
|
+
return this.transport.request(
|
|
335
|
+
"GET",
|
|
336
|
+
`/v1/projects/${resolveProjectId(this.config, params.projectId)}/email/${emailDomainId}`
|
|
337
|
+
);
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* Stops sending from a domain and removes it from email. The domain itself
|
|
341
|
+
* stays in the project. The API answers 204, so there is nothing to return.
|
|
342
|
+
*/
|
|
343
|
+
async deleteDomain(emailDomainId, params = {}) {
|
|
344
|
+
if (!emailDomainId) throw new Error("emailDomainId is required");
|
|
345
|
+
await this.transport.request(
|
|
346
|
+
"DELETE",
|
|
347
|
+
`/v1/projects/${resolveProjectId(this.config, params.projectId)}/email/${emailDomainId}`
|
|
348
|
+
);
|
|
349
|
+
}
|
|
149
350
|
};
|
|
150
351
|
|
|
151
352
|
// src/services/hosting.ts
|
|
@@ -178,6 +379,126 @@ var HostingService = class {
|
|
|
178
379
|
`${this.basePath(params.projectId)}/${siteId}/access`
|
|
179
380
|
);
|
|
180
381
|
}
|
|
382
|
+
/** Permanently deletes a hosting site with its files, databases and domains, and stops its billing. */
|
|
383
|
+
async delete(siteId, params = {}) {
|
|
384
|
+
if (!siteId) throw new Error("siteId is required");
|
|
385
|
+
return this.transport.request("DELETE", `${this.basePath(params.projectId)}/${siteId}`);
|
|
386
|
+
}
|
|
387
|
+
};
|
|
388
|
+
|
|
389
|
+
// src/services/iam.ts
|
|
390
|
+
var IamService = class {
|
|
391
|
+
constructor(transport, config) {
|
|
392
|
+
this.transport = transport;
|
|
393
|
+
this.config = config;
|
|
394
|
+
}
|
|
395
|
+
/** Builds the collection route for the resolved project. */
|
|
396
|
+
basePath(projectId) {
|
|
397
|
+
return `/v1/projects/${resolveProjectId(this.config, projectId)}/iam`;
|
|
398
|
+
}
|
|
399
|
+
/** Lists every access credential in the project, newest first. */
|
|
400
|
+
async list(params = {}) {
|
|
401
|
+
return this.transport.request("GET", this.basePath(params.projectId));
|
|
402
|
+
}
|
|
403
|
+
/** Fetches one credential by its IAM user name. */
|
|
404
|
+
async get(iamUserName, params = {}) {
|
|
405
|
+
if (!iamUserName) throw new Error("iamUserName is required");
|
|
406
|
+
return this.transport.request(
|
|
407
|
+
"GET",
|
|
408
|
+
`${this.basePath(params.projectId)}/${encodeURIComponent(iamUserName)}`
|
|
409
|
+
);
|
|
410
|
+
}
|
|
411
|
+
/**
|
|
412
|
+
* Deletes an IAM user and its access keys, by user name. Anything using the
|
|
413
|
+
* keys stops working. The API answers 204, so there is nothing to return.
|
|
414
|
+
*/
|
|
415
|
+
async delete(iamUserName, params = {}) {
|
|
416
|
+
if (!iamUserName) throw new Error("iamUserName is required");
|
|
417
|
+
await this.transport.request("DELETE", `${this.basePath(params.projectId)}/${encodeURIComponent(iamUserName)}`);
|
|
418
|
+
}
|
|
419
|
+
};
|
|
420
|
+
|
|
421
|
+
// src/services/members.ts
|
|
422
|
+
var MembersService = class {
|
|
423
|
+
constructor(transport, config) {
|
|
424
|
+
this.transport = transport;
|
|
425
|
+
this.config = config;
|
|
426
|
+
}
|
|
427
|
+
/** Lists the project's members and pending invitations. */
|
|
428
|
+
async list(params = {}) {
|
|
429
|
+
return this.transport.request(
|
|
430
|
+
"GET",
|
|
431
|
+
`/v1/projects/${resolveProjectId(this.config, params.projectId)}/members`
|
|
432
|
+
);
|
|
433
|
+
}
|
|
434
|
+
};
|
|
435
|
+
|
|
436
|
+
// src/services/projects.ts
|
|
437
|
+
var ProjectsService = class {
|
|
438
|
+
constructor(transport) {
|
|
439
|
+
this.transport = transport;
|
|
440
|
+
}
|
|
441
|
+
/** Lists every project the credential can reach, newest first. */
|
|
442
|
+
async list() {
|
|
443
|
+
return this.transport.request("GET", "/v1/projects");
|
|
444
|
+
}
|
|
445
|
+
/** Fetches one project by id or slug. */
|
|
446
|
+
async get(project) {
|
|
447
|
+
if (!project) throw new Error("project is required");
|
|
448
|
+
return this.transport.request("GET", `/v1/projects/${encodeURIComponent(project)}`);
|
|
449
|
+
}
|
|
450
|
+
};
|
|
451
|
+
|
|
452
|
+
// src/services/redis.ts
|
|
453
|
+
var RedisService = class {
|
|
454
|
+
constructor(transport, config) {
|
|
455
|
+
this.transport = transport;
|
|
456
|
+
this.config = config;
|
|
457
|
+
}
|
|
458
|
+
/** Builds the collection route for the resolved project. */
|
|
459
|
+
basePath(projectId) {
|
|
460
|
+
return `/v1/projects/${resolveProjectId(this.config, projectId)}/redis`;
|
|
461
|
+
}
|
|
462
|
+
/** Lists every Redis database in the project that has not been terminated. */
|
|
463
|
+
async list(params = {}) {
|
|
464
|
+
return this.transport.request("GET", this.basePath(params.projectId));
|
|
465
|
+
}
|
|
466
|
+
/** Fetches one Redis database, with its password; see {@link RedisDatabaseDetail}. */
|
|
467
|
+
async get(redisId, params = {}) {
|
|
468
|
+
if (!redisId) throw new Error("redisId is required");
|
|
469
|
+
return this.transport.request("GET", `${this.basePath(params.projectId)}/${redisId}`);
|
|
470
|
+
}
|
|
471
|
+
/** Permanently deletes a Redis database and its data, and stops its billing. */
|
|
472
|
+
async delete(redisId, params = {}) {
|
|
473
|
+
if (!redisId) throw new Error("redisId is required");
|
|
474
|
+
return this.transport.request("DELETE", `${this.basePath(params.projectId)}/${redisId}`);
|
|
475
|
+
}
|
|
476
|
+
};
|
|
477
|
+
|
|
478
|
+
// src/services/registries.ts
|
|
479
|
+
var RegistriesService = class {
|
|
480
|
+
constructor(transport, config) {
|
|
481
|
+
this.transport = transport;
|
|
482
|
+
this.config = config;
|
|
483
|
+
}
|
|
484
|
+
/** Builds the collection route for the resolved project. */
|
|
485
|
+
basePath(projectId) {
|
|
486
|
+
return `/v1/projects/${resolveProjectId(this.config, projectId)}/storage/container-registry`;
|
|
487
|
+
}
|
|
488
|
+
/** Lists every registry in the project, with its repositories. */
|
|
489
|
+
async list(params = {}) {
|
|
490
|
+
return this.transport.request("GET", this.basePath(params.projectId));
|
|
491
|
+
}
|
|
492
|
+
/** Fetches one registry, with its repositories. */
|
|
493
|
+
async get(registryId, params = {}) {
|
|
494
|
+
if (!registryId) throw new Error("registryId is required");
|
|
495
|
+
return this.transport.request("GET", `${this.basePath(params.projectId)}/${registryId}`);
|
|
496
|
+
}
|
|
497
|
+
/** Permanently deletes a registry with every repository and image in it, and stops its billing. */
|
|
498
|
+
async delete(registryId, params = {}) {
|
|
499
|
+
if (!registryId) throw new Error("registryId is required");
|
|
500
|
+
return this.transport.request("DELETE", `${this.basePath(params.projectId)}/${registryId}`);
|
|
501
|
+
}
|
|
181
502
|
};
|
|
182
503
|
|
|
183
504
|
// src/services/project-config.ts
|
|
@@ -286,6 +607,64 @@ var SecretsService = class {
|
|
|
286
607
|
}
|
|
287
608
|
};
|
|
288
609
|
|
|
610
|
+
// src/services/servers.ts
|
|
611
|
+
var ServersService = class {
|
|
612
|
+
constructor(transport, config) {
|
|
613
|
+
this.transport = transport;
|
|
614
|
+
this.config = config;
|
|
615
|
+
}
|
|
616
|
+
/** Builds the collection route for the resolved project. */
|
|
617
|
+
basePath(projectId) {
|
|
618
|
+
return `/v1/projects/${resolveProjectId(this.config, projectId)}/servers`;
|
|
619
|
+
}
|
|
620
|
+
/** Lists every server in the project that has not been terminated. */
|
|
621
|
+
async list(params = {}) {
|
|
622
|
+
return this.transport.request("GET", this.basePath(params.projectId));
|
|
623
|
+
}
|
|
624
|
+
/** Fetches one server, with the SSH keys installed on it. */
|
|
625
|
+
async get(serverId, params = {}) {
|
|
626
|
+
if (!serverId) throw new Error("serverId is required");
|
|
627
|
+
return this.transport.request("GET", `${this.basePath(params.projectId)}/${serverId}`);
|
|
628
|
+
}
|
|
629
|
+
/** Permanently deletes a server and its disk, and stops its billing. */
|
|
630
|
+
async delete(serverId, params = {}) {
|
|
631
|
+
if (!serverId) throw new Error("serverId is required");
|
|
632
|
+
return this.transport.request("DELETE", `${this.basePath(params.projectId)}/${serverId}`);
|
|
633
|
+
}
|
|
634
|
+
};
|
|
635
|
+
|
|
636
|
+
// src/services/ssh-keys.ts
|
|
637
|
+
var SshKeysService = class {
|
|
638
|
+
constructor(transport, config) {
|
|
639
|
+
this.transport = transport;
|
|
640
|
+
this.config = config;
|
|
641
|
+
}
|
|
642
|
+
/** Lists every SSH key in the project. */
|
|
643
|
+
async list(params = {}) {
|
|
644
|
+
return this.transport.request("GET", this.basePath(params.projectId));
|
|
645
|
+
}
|
|
646
|
+
/** Adds a public key to the project, for installing on servers created later. */
|
|
647
|
+
async create(params) {
|
|
648
|
+
if (!params?.name) throw new Error("name is required");
|
|
649
|
+
if (!params.publicKey) throw new Error("publicKey is required");
|
|
650
|
+
return this.transport.request("POST", this.basePath(params.projectId), {
|
|
651
|
+
body: { name: params.name, publicKey: params.publicKey }
|
|
652
|
+
});
|
|
653
|
+
}
|
|
654
|
+
/**
|
|
655
|
+
* Removes a key from the project. Servers it was already installed on keep
|
|
656
|
+
* accepting it; `stillAuthorisedOn` says how many.
|
|
657
|
+
*/
|
|
658
|
+
async delete(sshKeyId, params = {}) {
|
|
659
|
+
if (!sshKeyId) throw new Error("sshKeyId is required");
|
|
660
|
+
return this.transport.request("DELETE", `${this.basePath(params.projectId)}/${sshKeyId}`);
|
|
661
|
+
}
|
|
662
|
+
/** Builds the collection route for the resolved project. */
|
|
663
|
+
basePath(projectId) {
|
|
664
|
+
return `/v1/projects/${resolveProjectId(this.config, projectId)}/ssh-keys`;
|
|
665
|
+
}
|
|
666
|
+
};
|
|
667
|
+
|
|
289
668
|
// src/services/variables.ts
|
|
290
669
|
var VariablesService = class {
|
|
291
670
|
constructor(transport, config) {
|
|
@@ -732,7 +1111,7 @@ function sleep(ms) {
|
|
|
732
1111
|
}
|
|
733
1112
|
|
|
734
1113
|
// src/version.ts
|
|
735
|
-
var VERSION = "1.
|
|
1114
|
+
var VERSION = "1.9.0";
|
|
736
1115
|
var USER_AGENT = `cosmoner-node/${VERSION}`;
|
|
737
1116
|
|
|
738
1117
|
// src/transport.ts
|
|
@@ -856,9 +1235,19 @@ var Cosmoner = class {
|
|
|
856
1235
|
this.maxRetries = this.config.maxRetries;
|
|
857
1236
|
this.transport = new Transport(this.config);
|
|
858
1237
|
this.apps = new AppsService(this.transport, this.config);
|
|
1238
|
+
this.buckets = new BucketsService(this.transport, this.config);
|
|
1239
|
+
this.databases = new DatabasesService(this.transport, this.config);
|
|
1240
|
+
this.domains = new DomainsService(this.transport, this.config);
|
|
859
1241
|
this.email = new EmailService(this.transport, this.config);
|
|
860
1242
|
this.hosting = new HostingService(this.transport, this.config);
|
|
1243
|
+
this.iam = new IamService(this.transport, this.config);
|
|
1244
|
+
this.members = new MembersService(this.transport, this.config);
|
|
1245
|
+
this.projects = new ProjectsService(this.transport);
|
|
1246
|
+
this.redis = new RedisService(this.transport, this.config);
|
|
1247
|
+
this.registries = new RegistriesService(this.transport, this.config);
|
|
861
1248
|
this.secrets = new SecretsService(this.transport, this.config);
|
|
1249
|
+
this.servers = new ServersService(this.transport, this.config);
|
|
1250
|
+
this.sshKeys = new SshKeysService(this.transport, this.config);
|
|
862
1251
|
this.variables = new VariablesService(this.transport, this.config);
|
|
863
1252
|
this.webhooks = new WebhooksService(this.transport, this.config);
|
|
864
1253
|
}
|
|
@@ -1201,6 +1590,7 @@ export {
|
|
|
1201
1590
|
APP_SCHEMA_URL,
|
|
1202
1591
|
AppsService,
|
|
1203
1592
|
AuthenticationError,
|
|
1593
|
+
BucketsService,
|
|
1204
1594
|
ConflictError,
|
|
1205
1595
|
Cosmoner,
|
|
1206
1596
|
CosmonerConnectionError,
|
|
@@ -1214,18 +1604,27 @@ export {
|
|
|
1214
1604
|
DEPLOYMENT_FILE_PATHS,
|
|
1215
1605
|
DEPLOYMENT_KEY_ORDER,
|
|
1216
1606
|
DEPLOYMENT_VERSION,
|
|
1607
|
+
DatabasesService,
|
|
1608
|
+
DomainsService,
|
|
1217
1609
|
EVENT_TYPE_HEADER,
|
|
1218
1610
|
EmailService,
|
|
1219
1611
|
FINISHED_DEPLOYMENT_PHASES,
|
|
1220
1612
|
HostingService,
|
|
1613
|
+
IamService,
|
|
1221
1614
|
InsufficientScopeError,
|
|
1222
1615
|
MAX_DEPLOYMENT_BYTES,
|
|
1616
|
+
MembersService,
|
|
1223
1617
|
NotFoundError,
|
|
1224
1618
|
PROJECT_ENVIRONMENTS,
|
|
1619
|
+
ProjectsService,
|
|
1225
1620
|
RateLimitError,
|
|
1621
|
+
RedisService,
|
|
1622
|
+
RegistriesService,
|
|
1226
1623
|
SIGNATURE_HEADER,
|
|
1227
1624
|
SecretsService,
|
|
1228
1625
|
ServerError,
|
|
1626
|
+
ServersService,
|
|
1627
|
+
SshKeysService,
|
|
1229
1628
|
VERSION,
|
|
1230
1629
|
ValidationError,
|
|
1231
1630
|
VariablesService,
|
package/dist/services/apps.d.ts
CHANGED
|
@@ -71,9 +71,44 @@ interface Envelope<T> {
|
|
|
71
71
|
success: true;
|
|
72
72
|
data: T;
|
|
73
73
|
}
|
|
74
|
+
/** Which log stream `logs()` reads: the image build, or the running app. */
|
|
75
|
+
export type AppLogType = "BUILD" | "RUN";
|
|
76
|
+
/** Arguments accepted by `client.apps.logs()`. */
|
|
77
|
+
export interface AppLogsParams extends ProjectScopedParams {
|
|
78
|
+
type: AppLogType;
|
|
79
|
+
}
|
|
80
|
+
/** One line of an app's log. */
|
|
81
|
+
export interface AppLogLine {
|
|
82
|
+
message: string;
|
|
83
|
+
timestamp: string;
|
|
84
|
+
}
|
|
74
85
|
export type ListAppsResponse = Envelope<App[]>;
|
|
86
|
+
export type GetAppResponse = Envelope<App>;
|
|
87
|
+
export type AppLogsResponse = Envelope<{
|
|
88
|
+
lines: AppLogLine[];
|
|
89
|
+
}>;
|
|
75
90
|
export type DeployAppResponse = Envelope<AppDeployment>;
|
|
76
91
|
export type GetDeploymentResponse = Envelope<AppDeployment>;
|
|
92
|
+
/**
|
|
93
|
+
* The settings `client.apps.update()` can change. Every field is optional, but
|
|
94
|
+
* a call must change at least one. Environment variables are left out on
|
|
95
|
+
* purpose: they belong in the deployment file, and the API masks secret ones,
|
|
96
|
+
* so a read-modify-write of the list would be easy to get wrong.
|
|
97
|
+
*/
|
|
98
|
+
export interface UpdateAppParams extends ProjectScopedParams {
|
|
99
|
+
name?: string;
|
|
100
|
+
buildCommand?: string | null;
|
|
101
|
+
runCommand?: string | null;
|
|
102
|
+
outputDir?: string | null;
|
|
103
|
+
publicPort?: number | null;
|
|
104
|
+
internalPort?: number | null;
|
|
105
|
+
autoDeploy?: boolean;
|
|
106
|
+
imageDeployPolicy?: ImageDeployPolicy;
|
|
107
|
+
/** Refused for an app whose runtime cannot scale horizontally. */
|
|
108
|
+
instances?: number;
|
|
109
|
+
}
|
|
110
|
+
export type UpdateAppResponse = Envelope<App>;
|
|
111
|
+
export type DeleteAppResponse = Envelope<Record<string, never>>;
|
|
77
112
|
/** App lookup and image deploy operations for a project. */
|
|
78
113
|
export declare class AppsService {
|
|
79
114
|
private readonly transport;
|
|
@@ -83,6 +118,15 @@ export declare class AppsService {
|
|
|
83
118
|
private basePath;
|
|
84
119
|
/** Lists every app in the project, newest first. */
|
|
85
120
|
list(params?: ProjectScopedParams): Promise<ListAppsResponse>;
|
|
121
|
+
/**
|
|
122
|
+
* Fetches one app by id, with its full configuration.
|
|
123
|
+
*
|
|
124
|
+
* Environment variables marked secret come back masked; any other
|
|
125
|
+
* variable's value is returned as stored.
|
|
126
|
+
*/
|
|
127
|
+
get(appId: string, params?: ProjectScopedParams): Promise<GetAppResponse>;
|
|
128
|
+
/** Fetches the most recent lines of an app's build or runtime log. */
|
|
129
|
+
logs(appId: string, params: AppLogsParams): Promise<AppLogsResponse>;
|
|
86
130
|
/**
|
|
87
131
|
* Starts deploying an image app and returns the deployment without waiting.
|
|
88
132
|
*
|
|
@@ -101,5 +145,17 @@ export declare class AppsService {
|
|
|
101
145
|
* in which case the deployment keeps going server-side.
|
|
102
146
|
*/
|
|
103
147
|
waitForDeployment(appId: string, deploymentId: string, params?: WaitForDeploymentParams): Promise<AppDeployment>;
|
|
148
|
+
/**
|
|
149
|
+
* Changes an app's settings and applies them to the running app.
|
|
150
|
+
*
|
|
151
|
+
* Free: resizing, which is billed, is a separate call. The API answers 502
|
|
152
|
+
* when the settings were saved but the runtime refused them.
|
|
153
|
+
*/
|
|
154
|
+
update(appId: string, params: UpdateAppParams): Promise<UpdateAppResponse>;
|
|
155
|
+
/**
|
|
156
|
+
* Permanently deletes an app: its runtime, routing, custom hostname and
|
|
157
|
+
* billing, then the app itself. Its deployments go with it.
|
|
158
|
+
*/
|
|
159
|
+
delete(appId: string, params?: ProjectScopedParams): Promise<DeleteAppResponse>;
|
|
104
160
|
}
|
|
105
161
|
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/** Buckets service namespace — a project's object storage buckets. */
|
|
2
|
+
import { type ResolvedConfig } from "../config";
|
|
3
|
+
import type { Transport } from "../transport";
|
|
4
|
+
/** A bucket as the API lists it. Its access keys are never part of a listing. */
|
|
5
|
+
export interface Bucket {
|
|
6
|
+
id: string;
|
|
7
|
+
name: string;
|
|
8
|
+
provider: string;
|
|
9
|
+
region: string;
|
|
10
|
+
endpoint: string | null;
|
|
11
|
+
publicAccess: boolean;
|
|
12
|
+
versioning: boolean;
|
|
13
|
+
status: "CREATING" | "ACTIVE" | "SUSPENDED" | "DELETING";
|
|
14
|
+
tier: string;
|
|
15
|
+
cdnEnabled: boolean;
|
|
16
|
+
cdnDomain: string | null;
|
|
17
|
+
createdAt: string;
|
|
18
|
+
}
|
|
19
|
+
/** Options accepted by every method, for working across projects. */
|
|
20
|
+
export interface ProjectScopedParams {
|
|
21
|
+
/** Overrides the client-level default project for this call. */
|
|
22
|
+
projectId?: string;
|
|
23
|
+
}
|
|
24
|
+
interface Envelope<T> {
|
|
25
|
+
success: true;
|
|
26
|
+
data: T;
|
|
27
|
+
}
|
|
28
|
+
export type ListBucketsResponse = Envelope<Bucket[]>;
|
|
29
|
+
export type DeleteBucketResponse = Envelope<Record<string, never>>;
|
|
30
|
+
/** Read operations on a project's buckets. The API has no single-bucket read. */
|
|
31
|
+
export declare class BucketsService {
|
|
32
|
+
private readonly transport;
|
|
33
|
+
private readonly config;
|
|
34
|
+
constructor(transport: Transport, config: ResolvedConfig);
|
|
35
|
+
/** Lists every bucket in the project. */
|
|
36
|
+
list(params?: ProjectScopedParams): Promise<ListBucketsResponse>;
|
|
37
|
+
/**
|
|
38
|
+
* Permanently deletes a bucket with every object in it and the access
|
|
39
|
+
* credentials made for it, and stops its billing.
|
|
40
|
+
*/
|
|
41
|
+
delete(bucketId: string, params?: ProjectScopedParams): Promise<DeleteBucketResponse>;
|
|
42
|
+
/** Builds the collection route for the resolved project. */
|
|
43
|
+
private basePath;
|
|
44
|
+
}
|
|
45
|
+
export {};
|