@cosmoner/sdk 1.7.0 → 1.8.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 +30 -2
- package/dist/client.d.ts +21 -0
- package/dist/index.d.ts +12 -2
- package/dist/index.js +281 -4
- package/dist/index.mjs +271 -4
- package/dist/services/apps.d.ts +24 -0
- package/dist/services/buckets.d.ts +37 -0
- package/dist/services/databases.d.ts +106 -0
- package/dist/services/domains.d.ts +54 -0
- package/dist/services/email.d.ts +56 -0
- package/dist/services/iam.d.ts +61 -0
- package/dist/services/members.d.ts +50 -0
- package/dist/services/projects.d.ts +45 -0
- package/dist/services/redis.d.ts +55 -0
- package/dist/services/registries.d.ts +47 -0
- package/dist/services/secrets.d.ts +3 -3
- package/dist/services/servers.d.ts +56 -0
- package/dist/services/ssh-keys.d.ts +31 -0
- package/dist/version.d.ts +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -139,6 +139,33 @@ 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
|
+
## Read-only namespaces
|
|
143
|
+
|
|
144
|
+
Each of these reads one kind of resource and returns the API envelope. Every
|
|
145
|
+
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 | Methods |
|
|
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 |
|
|
153
|
+
| `servers` | `list()`, `get(serverId)` — adds the installed `sshKeys` |
|
|
154
|
+
| `sshKeys` | `list()` |
|
|
155
|
+
| `databases` | `list()` (every kind), `listDedicated()`, `getDedicated(databaseId)`, `listShared()`, `getShared(tenantId)` |
|
|
156
|
+
| `redis` | `list()`, `get(redisId)` |
|
|
157
|
+
| `domains` | `list()`, `get(domain)` — by id or name, such as `example.com` |
|
|
158
|
+
| `buckets` | `list()` — there is no single-bucket read |
|
|
159
|
+
| `registries` | `list()`, `get(registryId)` |
|
|
160
|
+
| `iam` | `list()`, `get(iamUserName)` — the list holds `credentials` plus partial-failure `errors` |
|
|
161
|
+
| `members` | `list()` — members and pending invitations |
|
|
162
|
+
| `email` | `listDomains()`, `getDomain(emailDomainId)`, alongside `send()` |
|
|
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
|
+
|
|
142
169
|
## Secrets
|
|
143
170
|
|
|
144
171
|
Stores the values a deployment file refers to with `from_secret`. Needs an API
|
|
@@ -170,8 +197,9 @@ Two API behaviours are worth knowing before you debug them:
|
|
|
170
197
|
- **Writes need an owner or admin.** The API checks the member's role
|
|
171
198
|
independently of the key's scopes, so a plain member's key is refused with a
|
|
172
199
|
403 even when it carries `secrets:write`.
|
|
173
|
-
- **Creating is rate-limited** to
|
|
174
|
-
|
|
200
|
+
- **Creating is rate-limited** to 100 per project every 10 minutes, shared by
|
|
201
|
+
every key and machine working on the project, and a project at its secret
|
|
202
|
+
limit answers 402.
|
|
175
203
|
|
|
176
204
|
## Variables
|
|
177
205
|
|
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 {
|
|
8
|
+
export { AppsService, FINISHED_DEPLOYMENT_PHASES, type App, type AppDeployment, type AppLogLine, type AppLogType, type AppLogsParams, type AppLogsResponse, type AppStatus, type DeployAppParams, type DeployAppResponse, type DeploymentPhase, type GetAppResponse, type GetDeploymentResponse, type ImageDeployPolicy, type ListAppsResponse, type WaitForDeploymentParams, } from "./services/apps";
|
|
9
|
+
export { BucketsService, type Bucket, type ListBucketsResponse } from "./services/buckets";
|
|
10
|
+
export { DatabasesService, type DatabaseSummary, type DedicatedDatabase, type DedicatedDatabaseDetail, type GetDedicatedDatabaseResponse, type GetSharedDatabaseResponse, type ListDatabasesResponse, type ListDedicatedDatabasesResponse, type ListSharedDatabasesResponse, type SharedDatabase, } from "./services/databases";
|
|
11
|
+
export { DomainsService, type DnsRecord, type Domain, type GetDomainResponse, type ListDomainsResponse, } from "./services/domains";
|
|
12
|
+
export { EmailService, type EmailDomain, type EmailDomainDetail, type GetEmailDomainResponse, type ListEmailDomainsResponse, type SendEmailParams, type SendEmailResponse, } from "./services/email";
|
|
10
13
|
export { HostingService, 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 GetRedisDatabaseResponse, type ListRedisDatabasesResponse, type RedisDatabase, type RedisDatabaseDetail, } from "./services/redis";
|
|
18
|
+
export { RegistriesService, type GetRegistryResponse, type ListRegistriesResponse, type Registry, type RegistryRepository, } from "./services/registries";
|
|
19
|
+
export { ServersService, type GetServerResponse, type ListServersResponse, type Server, type ServerDetail, type ServerStatus, } from "./services/servers";
|
|
20
|
+
export { SshKeysService, 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
|
*
|
|
@@ -176,6 +204,85 @@ var AppsService = class {
|
|
|
176
204
|
}
|
|
177
205
|
};
|
|
178
206
|
|
|
207
|
+
// src/services/buckets.ts
|
|
208
|
+
var BucketsService = class {
|
|
209
|
+
constructor(transport, config) {
|
|
210
|
+
this.transport = transport;
|
|
211
|
+
this.config = config;
|
|
212
|
+
}
|
|
213
|
+
/** Lists every bucket in the project. */
|
|
214
|
+
async list(params = {}) {
|
|
215
|
+
return this.transport.request(
|
|
216
|
+
"GET",
|
|
217
|
+
`/v1/projects/${resolveProjectId(this.config, params.projectId)}/storage/object-storage`
|
|
218
|
+
);
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
// src/services/databases.ts
|
|
223
|
+
var DatabasesService = class {
|
|
224
|
+
constructor(transport, config) {
|
|
225
|
+
this.transport = transport;
|
|
226
|
+
this.config = config;
|
|
227
|
+
}
|
|
228
|
+
/** Builds the collection route for the resolved project. */
|
|
229
|
+
basePath(projectId) {
|
|
230
|
+
return `/v1/projects/${resolveProjectId(this.config, projectId)}/databases`;
|
|
231
|
+
}
|
|
232
|
+
/** Lists every database in the project, of every kind, newest first. */
|
|
233
|
+
async list(params = {}) {
|
|
234
|
+
return this.transport.request("GET", this.basePath(params.projectId));
|
|
235
|
+
}
|
|
236
|
+
/** Lists the project's dedicated databases. */
|
|
237
|
+
async listDedicated(params = {}) {
|
|
238
|
+
return this.transport.request("GET", `${this.basePath(params.projectId)}/dedicated`);
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Fetches one dedicated database. Its `connectionUri` carries the password;
|
|
242
|
+
* see {@link DedicatedDatabaseDetail}.
|
|
243
|
+
*/
|
|
244
|
+
async getDedicated(databaseId, params = {}) {
|
|
245
|
+
if (!databaseId) throw new Error("databaseId is required");
|
|
246
|
+
return this.transport.request(
|
|
247
|
+
"GET",
|
|
248
|
+
`${this.basePath(params.projectId)}/dedicated/${databaseId}`
|
|
249
|
+
);
|
|
250
|
+
}
|
|
251
|
+
/** Lists the project's databases on the shared cluster. */
|
|
252
|
+
async listShared(params = {}) {
|
|
253
|
+
return this.transport.request("GET", `${this.basePath(params.projectId)}/shared`);
|
|
254
|
+
}
|
|
255
|
+
/** Fetches one database on the shared cluster. */
|
|
256
|
+
async getShared(tenantId, params = {}) {
|
|
257
|
+
if (!tenantId) throw new Error("tenantId is required");
|
|
258
|
+
return this.transport.request("GET", `${this.basePath(params.projectId)}/shared/${tenantId}`);
|
|
259
|
+
}
|
|
260
|
+
};
|
|
261
|
+
|
|
262
|
+
// src/services/domains.ts
|
|
263
|
+
var DomainsService = class {
|
|
264
|
+
constructor(transport, config) {
|
|
265
|
+
this.transport = transport;
|
|
266
|
+
this.config = config;
|
|
267
|
+
}
|
|
268
|
+
/** Builds the collection route for the resolved project. */
|
|
269
|
+
basePath(projectId) {
|
|
270
|
+
return `/v1/projects/${resolveProjectId(this.config, projectId)}/domains`;
|
|
271
|
+
}
|
|
272
|
+
/** Lists every domain in the project, with its DNS records. */
|
|
273
|
+
async list(params = {}) {
|
|
274
|
+
return this.transport.request("GET", this.basePath(params.projectId));
|
|
275
|
+
}
|
|
276
|
+
/** Fetches one domain by id or by name, e.g. `example.com`. */
|
|
277
|
+
async get(domain, params = {}) {
|
|
278
|
+
if (!domain) throw new Error("domain is required");
|
|
279
|
+
return this.transport.request(
|
|
280
|
+
"GET",
|
|
281
|
+
`${this.basePath(params.projectId)}/${encodeURIComponent(domain)}`
|
|
282
|
+
);
|
|
283
|
+
}
|
|
284
|
+
};
|
|
285
|
+
|
|
179
286
|
// src/services/email.ts
|
|
180
287
|
var EmailService = class {
|
|
181
288
|
constructor(transport, config) {
|
|
@@ -210,6 +317,23 @@ var EmailService = class {
|
|
|
210
317
|
}
|
|
211
318
|
);
|
|
212
319
|
}
|
|
320
|
+
/** Lists the project's sending domains, with their SMTP credentials and DNS records. */
|
|
321
|
+
// eslint-disable-next-line require-await -- kept `async` like every method here, so callers get one promise contract.
|
|
322
|
+
async listDomains(params = {}) {
|
|
323
|
+
return this.transport.request(
|
|
324
|
+
"GET",
|
|
325
|
+
`/v1/projects/${resolveProjectId(this.config, params.projectId)}/email`
|
|
326
|
+
);
|
|
327
|
+
}
|
|
328
|
+
/** Fetches one sending domain by its id (not its domain name). */
|
|
329
|
+
// eslint-disable-next-line require-await -- `async` makes the validation below reject rather than throw synchronously.
|
|
330
|
+
async getDomain(emailDomainId, params = {}) {
|
|
331
|
+
if (!emailDomainId) throw new Error("emailDomainId is required");
|
|
332
|
+
return this.transport.request(
|
|
333
|
+
"GET",
|
|
334
|
+
`/v1/projects/${resolveProjectId(this.config, params.projectId)}/email/${emailDomainId}`
|
|
335
|
+
);
|
|
336
|
+
}
|
|
213
337
|
};
|
|
214
338
|
|
|
215
339
|
// src/services/hosting.ts
|
|
@@ -244,6 +368,103 @@ var HostingService = class {
|
|
|
244
368
|
}
|
|
245
369
|
};
|
|
246
370
|
|
|
371
|
+
// src/services/iam.ts
|
|
372
|
+
var IamService = class {
|
|
373
|
+
constructor(transport, config) {
|
|
374
|
+
this.transport = transport;
|
|
375
|
+
this.config = config;
|
|
376
|
+
}
|
|
377
|
+
/** Builds the collection route for the resolved project. */
|
|
378
|
+
basePath(projectId) {
|
|
379
|
+
return `/v1/projects/${resolveProjectId(this.config, projectId)}/iam`;
|
|
380
|
+
}
|
|
381
|
+
/** Lists every access credential in the project, newest first. */
|
|
382
|
+
async list(params = {}) {
|
|
383
|
+
return this.transport.request("GET", this.basePath(params.projectId));
|
|
384
|
+
}
|
|
385
|
+
/** Fetches one credential by its IAM user name. */
|
|
386
|
+
async get(iamUserName, params = {}) {
|
|
387
|
+
if (!iamUserName) throw new Error("iamUserName is required");
|
|
388
|
+
return this.transport.request(
|
|
389
|
+
"GET",
|
|
390
|
+
`${this.basePath(params.projectId)}/${encodeURIComponent(iamUserName)}`
|
|
391
|
+
);
|
|
392
|
+
}
|
|
393
|
+
};
|
|
394
|
+
|
|
395
|
+
// src/services/members.ts
|
|
396
|
+
var MembersService = class {
|
|
397
|
+
constructor(transport, config) {
|
|
398
|
+
this.transport = transport;
|
|
399
|
+
this.config = config;
|
|
400
|
+
}
|
|
401
|
+
/** Lists the project's members and pending invitations. */
|
|
402
|
+
async list(params = {}) {
|
|
403
|
+
return this.transport.request(
|
|
404
|
+
"GET",
|
|
405
|
+
`/v1/projects/${resolveProjectId(this.config, params.projectId)}/members`
|
|
406
|
+
);
|
|
407
|
+
}
|
|
408
|
+
};
|
|
409
|
+
|
|
410
|
+
// src/services/projects.ts
|
|
411
|
+
var ProjectsService = class {
|
|
412
|
+
constructor(transport) {
|
|
413
|
+
this.transport = transport;
|
|
414
|
+
}
|
|
415
|
+
/** Lists every project the credential can reach, newest first. */
|
|
416
|
+
async list() {
|
|
417
|
+
return this.transport.request("GET", "/v1/projects");
|
|
418
|
+
}
|
|
419
|
+
/** Fetches one project by id or slug. */
|
|
420
|
+
async get(project) {
|
|
421
|
+
if (!project) throw new Error("project is required");
|
|
422
|
+
return this.transport.request("GET", `/v1/projects/${encodeURIComponent(project)}`);
|
|
423
|
+
}
|
|
424
|
+
};
|
|
425
|
+
|
|
426
|
+
// src/services/redis.ts
|
|
427
|
+
var RedisService = class {
|
|
428
|
+
constructor(transport, config) {
|
|
429
|
+
this.transport = transport;
|
|
430
|
+
this.config = config;
|
|
431
|
+
}
|
|
432
|
+
/** Builds the collection route for the resolved project. */
|
|
433
|
+
basePath(projectId) {
|
|
434
|
+
return `/v1/projects/${resolveProjectId(this.config, projectId)}/redis`;
|
|
435
|
+
}
|
|
436
|
+
/** Lists every Redis database in the project that has not been terminated. */
|
|
437
|
+
async list(params = {}) {
|
|
438
|
+
return this.transport.request("GET", this.basePath(params.projectId));
|
|
439
|
+
}
|
|
440
|
+
/** Fetches one Redis database, with its password; see {@link RedisDatabaseDetail}. */
|
|
441
|
+
async get(redisId, params = {}) {
|
|
442
|
+
if (!redisId) throw new Error("redisId is required");
|
|
443
|
+
return this.transport.request("GET", `${this.basePath(params.projectId)}/${redisId}`);
|
|
444
|
+
}
|
|
445
|
+
};
|
|
446
|
+
|
|
447
|
+
// src/services/registries.ts
|
|
448
|
+
var RegistriesService = class {
|
|
449
|
+
constructor(transport, config) {
|
|
450
|
+
this.transport = transport;
|
|
451
|
+
this.config = config;
|
|
452
|
+
}
|
|
453
|
+
/** Builds the collection route for the resolved project. */
|
|
454
|
+
basePath(projectId) {
|
|
455
|
+
return `/v1/projects/${resolveProjectId(this.config, projectId)}/storage/container-registry`;
|
|
456
|
+
}
|
|
457
|
+
/** Lists every registry in the project, with its repositories. */
|
|
458
|
+
async list(params = {}) {
|
|
459
|
+
return this.transport.request("GET", this.basePath(params.projectId));
|
|
460
|
+
}
|
|
461
|
+
/** Fetches one registry, with its repositories. */
|
|
462
|
+
async get(registryId, params = {}) {
|
|
463
|
+
if (!registryId) throw new Error("registryId is required");
|
|
464
|
+
return this.transport.request("GET", `${this.basePath(params.projectId)}/${registryId}`);
|
|
465
|
+
}
|
|
466
|
+
};
|
|
467
|
+
|
|
247
468
|
// src/services/project-config.ts
|
|
248
469
|
var PROJECT_ENVIRONMENTS = [
|
|
249
470
|
"default",
|
|
@@ -299,9 +520,9 @@ var SecretsService = class {
|
|
|
299
520
|
/**
|
|
300
521
|
* Stores a new secret, and returns its plaintext value once.
|
|
301
522
|
*
|
|
302
|
-
* Creation is rate-limited to
|
|
303
|
-
*
|
|
304
|
-
* answers 402 — see `usage()`.
|
|
523
|
+
* Creation is rate-limited to 100 per project every 10 minutes, shared by
|
|
524
|
+
* every key and machine working on the project; past it, a `RateLimitError`.
|
|
525
|
+
* A project at its secret limit answers 402 — see `usage()`.
|
|
305
526
|
*/
|
|
306
527
|
async create(params) {
|
|
307
528
|
requireEntryName(params.name);
|
|
@@ -350,6 +571,42 @@ var SecretsService = class {
|
|
|
350
571
|
}
|
|
351
572
|
};
|
|
352
573
|
|
|
574
|
+
// src/services/servers.ts
|
|
575
|
+
var ServersService = class {
|
|
576
|
+
constructor(transport, config) {
|
|
577
|
+
this.transport = transport;
|
|
578
|
+
this.config = config;
|
|
579
|
+
}
|
|
580
|
+
/** Builds the collection route for the resolved project. */
|
|
581
|
+
basePath(projectId) {
|
|
582
|
+
return `/v1/projects/${resolveProjectId(this.config, projectId)}/servers`;
|
|
583
|
+
}
|
|
584
|
+
/** Lists every server in the project that has not been terminated. */
|
|
585
|
+
async list(params = {}) {
|
|
586
|
+
return this.transport.request("GET", this.basePath(params.projectId));
|
|
587
|
+
}
|
|
588
|
+
/** Fetches one server, with the SSH keys installed on it. */
|
|
589
|
+
async get(serverId, params = {}) {
|
|
590
|
+
if (!serverId) throw new Error("serverId is required");
|
|
591
|
+
return this.transport.request("GET", `${this.basePath(params.projectId)}/${serverId}`);
|
|
592
|
+
}
|
|
593
|
+
};
|
|
594
|
+
|
|
595
|
+
// src/services/ssh-keys.ts
|
|
596
|
+
var SshKeysService = class {
|
|
597
|
+
constructor(transport, config) {
|
|
598
|
+
this.transport = transport;
|
|
599
|
+
this.config = config;
|
|
600
|
+
}
|
|
601
|
+
/** Lists every SSH key in the project. */
|
|
602
|
+
async list(params = {}) {
|
|
603
|
+
return this.transport.request(
|
|
604
|
+
"GET",
|
|
605
|
+
`/v1/projects/${resolveProjectId(this.config, params.projectId)}/ssh-keys`
|
|
606
|
+
);
|
|
607
|
+
}
|
|
608
|
+
};
|
|
609
|
+
|
|
353
610
|
// src/services/variables.ts
|
|
354
611
|
var VariablesService = class {
|
|
355
612
|
constructor(transport, config) {
|
|
@@ -796,7 +1053,7 @@ function sleep(ms) {
|
|
|
796
1053
|
}
|
|
797
1054
|
|
|
798
1055
|
// src/version.ts
|
|
799
|
-
var VERSION = "1.
|
|
1056
|
+
var VERSION = "1.8.0";
|
|
800
1057
|
var USER_AGENT = `cosmoner-node/${VERSION}`;
|
|
801
1058
|
|
|
802
1059
|
// src/transport.ts
|
|
@@ -920,9 +1177,19 @@ var Cosmoner = class {
|
|
|
920
1177
|
this.maxRetries = this.config.maxRetries;
|
|
921
1178
|
this.transport = new Transport(this.config);
|
|
922
1179
|
this.apps = new AppsService(this.transport, this.config);
|
|
1180
|
+
this.buckets = new BucketsService(this.transport, this.config);
|
|
1181
|
+
this.databases = new DatabasesService(this.transport, this.config);
|
|
1182
|
+
this.domains = new DomainsService(this.transport, this.config);
|
|
923
1183
|
this.email = new EmailService(this.transport, this.config);
|
|
924
1184
|
this.hosting = new HostingService(this.transport, this.config);
|
|
1185
|
+
this.iam = new IamService(this.transport, this.config);
|
|
1186
|
+
this.members = new MembersService(this.transport, this.config);
|
|
1187
|
+
this.projects = new ProjectsService(this.transport);
|
|
1188
|
+
this.redis = new RedisService(this.transport, this.config);
|
|
1189
|
+
this.registries = new RegistriesService(this.transport, this.config);
|
|
925
1190
|
this.secrets = new SecretsService(this.transport, this.config);
|
|
1191
|
+
this.servers = new ServersService(this.transport, this.config);
|
|
1192
|
+
this.sshKeys = new SshKeysService(this.transport, this.config);
|
|
926
1193
|
this.variables = new VariablesService(this.transport, this.config);
|
|
927
1194
|
this.webhooks = new WebhooksService(this.transport, this.config);
|
|
928
1195
|
}
|
|
@@ -1266,6 +1533,7 @@ var index_default = Cosmoner;
|
|
|
1266
1533
|
APP_SCHEMA_URL,
|
|
1267
1534
|
AppsService,
|
|
1268
1535
|
AuthenticationError,
|
|
1536
|
+
BucketsService,
|
|
1269
1537
|
ConflictError,
|
|
1270
1538
|
Cosmoner,
|
|
1271
1539
|
CosmonerConnectionError,
|
|
@@ -1279,18 +1547,27 @@ var index_default = Cosmoner;
|
|
|
1279
1547
|
DEPLOYMENT_FILE_PATHS,
|
|
1280
1548
|
DEPLOYMENT_KEY_ORDER,
|
|
1281
1549
|
DEPLOYMENT_VERSION,
|
|
1550
|
+
DatabasesService,
|
|
1551
|
+
DomainsService,
|
|
1282
1552
|
EVENT_TYPE_HEADER,
|
|
1283
1553
|
EmailService,
|
|
1284
1554
|
FINISHED_DEPLOYMENT_PHASES,
|
|
1285
1555
|
HostingService,
|
|
1556
|
+
IamService,
|
|
1286
1557
|
InsufficientScopeError,
|
|
1287
1558
|
MAX_DEPLOYMENT_BYTES,
|
|
1559
|
+
MembersService,
|
|
1288
1560
|
NotFoundError,
|
|
1289
1561
|
PROJECT_ENVIRONMENTS,
|
|
1562
|
+
ProjectsService,
|
|
1290
1563
|
RateLimitError,
|
|
1564
|
+
RedisService,
|
|
1565
|
+
RegistriesService,
|
|
1291
1566
|
SIGNATURE_HEADER,
|
|
1292
1567
|
SecretsService,
|
|
1293
1568
|
ServerError,
|
|
1569
|
+
ServersService,
|
|
1570
|
+
SshKeysService,
|
|
1294
1571
|
VERSION,
|
|
1295
1572
|
ValidationError,
|
|
1296
1573
|
VariablesService,
|