withruntime 1.1.2 → 1.4.58
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 +5 -2
- package/dist/generated/agentSessions.d.ts +2 -2
- package/dist/generated/agentSessions.js +2 -2
- package/dist/generated/agents.d.ts +2 -2
- package/dist/generated/agents.js +1 -1
- package/dist/generated/apps.d.ts +8 -6
- package/dist/generated/apps.js +10 -6
- package/dist/generated/browsers.d.ts +8 -6
- package/dist/generated/browsers.js +10 -6
- package/dist/generated/builds.d.ts +8 -6
- package/dist/generated/builds.js +10 -6
- package/dist/generated/ci.d.ts +106 -6
- package/dist/generated/ci.js +14 -6
- package/dist/generated/containers.d.ts +8 -6
- package/dist/generated/containers.js +10 -6
- package/dist/generated/desktops.d.ts +8 -6
- package/dist/generated/desktops.js +10 -6
- package/dist/generated/dropins/e2b.d.ts +180 -0
- package/dist/generated/dropins/e2b.js +342 -0
- package/dist/generated/dropins/e2b_code_interpreter.d.ts +180 -0
- package/dist/generated/dropins/e2b_code_interpreter.js +342 -0
- package/dist/generated/dropins/modal.d.ts +195 -0
- package/dist/generated/dropins/modal.js +375 -0
- package/dist/generated/dropins/runtime.d.ts +74 -0
- package/dist/generated/dropins/runtime.js +180 -0
- package/dist/generated/dropins/vercel.d.ts +78 -0
- package/dist/generated/dropins/vercel.js +154 -0
- package/dist/generated/egressIps.d.ts +2 -2
- package/dist/generated/egressIps.js +2 -2
- package/dist/generated/functions.d.ts +8 -6
- package/dist/generated/functions.js +10 -6
- package/dist/generated/identities.d.ts +42 -4
- package/dist/generated/identities.js +60 -0
- package/dist/generated/images.d.ts +3 -0
- package/dist/generated/images.js +4 -0
- package/dist/generated/index.d.ts +1 -1
- package/dist/generated/jobs.d.ts +2 -2
- package/dist/generated/jobs.js +1 -1
- package/dist/generated/keys.d.ts +28 -0
- package/dist/generated/keys.js +4 -0
- package/dist/generated/notebooks.d.ts +8 -6
- package/dist/generated/notebooks.js +10 -6
- package/dist/generated/ports.d.ts +2 -0
- package/dist/generated/projects.d.ts +49 -7
- package/dist/generated/projects.js +72 -3
- package/dist/generated/roles.d.ts +43 -5
- package/dist/generated/roles.js +61 -0
- package/dist/generated/routes.js +1 -1
- package/dist/generated/runtime.d.ts +49 -3
- package/dist/generated/runtime.js +235 -26
- package/dist/generated/sandboxes.d.ts +33 -14
- package/dist/generated/sandboxes.js +10 -6
- package/dist/generated/sites.d.ts +8 -6
- package/dist/generated/sites.js +10 -6
- package/dist/generated/snapshots.d.ts +7 -2
- package/dist/generated/snapshots.js +6 -2
- package/dist/generated/usage.d.ts +9 -3
- package/dist/generated/volumes.d.ts +30 -11
- package/dist/generated/volumes.js +19 -6
- package/dist/generated/workspaces.d.ts +8 -6
- package/dist/generated/workspaces.js +10 -6
- package/dist/v2/cli.d.ts +29 -0
- package/dist/v2/cli.js +156 -7
- package/dist/v2/login.d.ts +4 -0
- package/dist/v2/login.js +1 -1
- package/dist/v2/mcp.d.ts +4 -2
- package/dist/v2/mcp.js +69 -12
- package/dist/v2/openapi.json +2656 -1375
- package/dist/v2/shims/base.d.ts +0 -3
- package/dist/v2/shims/base.js +2 -7
- package/dist/v2/shims/blaxel.js +2 -1
- package/dist/v2/shims/daytona.js +3 -2
- package/dist/v2/shims/morph.js +3 -1
- package/dist/v2/shims/vercel.js +2 -1
- package/package.json +3 -2
- package/dist/v2/shims/e2b.d.ts +0 -142
- package/dist/v2/shims/e2b.js +0 -238
package/dist/generated/keys.d.ts
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
import type { RequestOptions, Transport } from "./runtime.js";
|
|
2
2
|
import { Paginated } from "./runtime.js";
|
|
3
|
+
/** The GitHub Actions jobs a key trusts, as it holds them: by GitHub's own numbers. */
|
|
4
|
+
export interface KeyGitHubTrust {
|
|
5
|
+
/** The repository's name as GitHub gave it when the key was made: in the create's answer alone, as its name is GitHub's to change. */
|
|
6
|
+
repository?: string;
|
|
7
|
+
/** GitHub's number for the repository, which a rename keeps. */
|
|
8
|
+
repositoryId: number;
|
|
9
|
+
/** GitHub's number for the account that owns it. */
|
|
10
|
+
ownerId: number;
|
|
11
|
+
/** The workflow a job must run, as its path in the repository; any when omitted. */
|
|
12
|
+
workflow?: string;
|
|
13
|
+
/** The ref a job must run on; any when omitted. */
|
|
14
|
+
ref?: string;
|
|
15
|
+
}
|
|
3
16
|
/** An API key, without its secret. */
|
|
4
17
|
export interface Key {
|
|
5
18
|
/** Its ID. */
|
|
@@ -32,6 +45,8 @@ export interface Key {
|
|
|
32
45
|
spent?: string;
|
|
33
46
|
/** When it was revoked: a delete's answer, its state `deleted`. */
|
|
34
47
|
deletedAt?: string;
|
|
48
|
+
/** The GitHub Actions jobs that may assume it: such a key has no secret. */
|
|
49
|
+
github?: KeyGitHubTrust;
|
|
35
50
|
}
|
|
36
51
|
/** An OAuth client's request for a key, as `/v2/oauth/authorize` received it. */
|
|
37
52
|
export interface KeyAuthorization {
|
|
@@ -44,6 +59,15 @@ export interface KeyAuthorization {
|
|
|
44
59
|
/** Its `state`, sent back unchanged. */
|
|
45
60
|
state?: string;
|
|
46
61
|
}
|
|
62
|
+
/** The GitHub Actions jobs that may assume a key (`POST /v2/keys/{id}:assume`), with their workflow's OpenID Connect token. */
|
|
63
|
+
export interface KeyGitHub {
|
|
64
|
+
/** The repository, `owner/name`: one that a GitHub account connected to the organization through Runtime's GitHub App holds. The key holds it by GitHub's own numbers for it and its owner, so a renamed repository still passes and another repository made under its old name never does. */
|
|
65
|
+
repository: string;
|
|
66
|
+
/** The workflow a job must run, as its path in the repository (`.github/workflows/deploy.yml`); any of the repository's when omitted. */
|
|
67
|
+
workflow?: string;
|
|
68
|
+
/** The ref a job must run on (`refs/heads/main`); any when omitted. */
|
|
69
|
+
ref?: string;
|
|
70
|
+
}
|
|
47
71
|
/** A key to make. */
|
|
48
72
|
export interface KeyCreate {
|
|
49
73
|
/** Its name. At least 1 character. At most 64 characters. */
|
|
@@ -66,6 +90,8 @@ export interface KeyCreate {
|
|
|
66
90
|
userCode?: string;
|
|
67
91
|
/** An OAuth client's request (authorization code with PKCE): the key goes to that client, never in this answer. */
|
|
68
92
|
authorization?: KeyAuthorization;
|
|
93
|
+
/** The GitHub Actions jobs that may assume it, by their workflow's OpenID Connect token: it then has no secret, and needs actions, none of them a key's. */
|
|
94
|
+
github?: KeyGitHub;
|
|
69
95
|
}
|
|
70
96
|
/** A key just made, with its secret: shown this once, never again. */
|
|
71
97
|
export interface KeyCreated extends Key {
|
|
@@ -100,6 +126,8 @@ export declare class Keys {
|
|
|
100
126
|
list(query?: KeyListQuery & RequestOptions, options?: RequestOptions): Paginated<Key>;
|
|
101
127
|
/** Makes a key that acts as the caller, or as one of the organization's agents for the caller, and returns its secret this once. With `userCode` or `authorization`, the key goes to the device or OAuth client that asked for it instead, which collects it once from `/v2/oauth/token`. A key made with a key works until its own end, never past that key's: it lives on when that key is revoked, so a key is rotated by making its next with it. */
|
|
102
128
|
create(input: KeyCreate, options?: RequestOptions): Promise<KeyCreated>;
|
|
129
|
+
/** Makes a key for one GitHub Actions job from a key whose `github` admits it, and returns its secret this once. The job's OpenID Connect token, asked for with audience `withruntime.com` (`permissions: id-token: write`), is the call's bearer token: no API key is sent. The new key acts as the trusted key does, with its project and actions, makes no keys, and works for an hour; what it spends counts toward the trusted key's spendCap. */
|
|
130
|
+
assume(id: string, options?: RequestOptions): Promise<KeyCreated>;
|
|
103
131
|
/** Renames a key, or sets or removes its caps (`maxCost`, `spendCap`); its secret stays as it is. A cap is never set above that of a key it was made with, nor above the caller's own key's, so a key never raises its own caps. An owner or an admin changes any key of the organization; everyone else, their own. */
|
|
104
132
|
update(id: string, input?: KeyUpdate, options?: RequestOptions): Promise<Key>;
|
|
105
133
|
/** Revokes a key: refused from its next call, with the hand-off tokens made from it; a key made with it works on. An owner or an admin revokes any key of the organization; everyone else, their own. Revoked again, it returns 404. */
|
package/dist/generated/keys.js
CHANGED
|
@@ -15,6 +15,10 @@ export class Keys {
|
|
|
15
15
|
create(input, options) {
|
|
16
16
|
return this.transport.request("POST", `/v2/keys`, { body: input, options });
|
|
17
17
|
}
|
|
18
|
+
/** Makes a key for one GitHub Actions job from a key whose `github` admits it, and returns its secret this once. The job's OpenID Connect token, asked for with audience `withruntime.com` (`permissions: id-token: write`), is the call's bearer token: no API key is sent. The new key acts as the trusted key does, with its project and actions, makes no keys, and works for an hour; what it spends counts toward the trusted key's spendCap. */
|
|
19
|
+
assume(id, options) {
|
|
20
|
+
return this.transport.request("POST", `/v2/keys/${encodeURIComponent(id)}:assume`, { options });
|
|
21
|
+
}
|
|
18
22
|
/** Renames a key, or sets or removes its caps (`maxCost`, `spendCap`); its secret stays as it is. A cap is never set above that of a key it was made with, nor above the caller's own key's, so a key never raises its own caps. An owner or an admin changes any key of the organization; everyone else, their own. */
|
|
19
23
|
update(id, input = {}, options) {
|
|
20
24
|
return this.transport.request("POST", `/v2/keys/${encodeURIComponent(id)}:update`, { body: input, options, idempotent: true });
|
|
@@ -164,7 +164,7 @@ export declare class NotebookFiles {
|
|
|
164
164
|
beginFolderUpload(path: string, input?: Omit<FolderUploadBegin, "path">, options?: RequestOptions): Promise<FolderUpload>;
|
|
165
165
|
/** Sends the request's bytes, a part of the archive at its offset, into tar's input as they arrive, of any size, and returns the bytes received in all once tar took them. A part past them is refused 409 `upload_incomplete`, naming them: send the parts in order. */
|
|
166
166
|
writeFolderUpload(upload: string, data: Uint8Array | string, query?: NotebookWriteFolderUploadQuery & RequestOptions, options?: RequestOptions): Promise<FolderUploadReceived>;
|
|
167
|
-
/** Ends a folder upload's input and returns once tar has ended, as an exec returns once its command has: the folder, or 400 `invalid_archive` with what tar said.
|
|
167
|
+
/** Ends a folder upload's input and returns once tar has ended, as an exec returns once its command has: the folder, or 400 `invalid_archive` with what tar said. Sent again, it returns how tar ended. An upload no call has named for 10 minutes since its last part or commit is ended. */
|
|
168
168
|
commitFolderUpload(upload: string, options?: RequestOptions): Promise<FolderUnpacked>;
|
|
169
169
|
/** Stops a folder upload's tar; what it unpacked so far stays. */
|
|
170
170
|
abortFolderUpload(upload: string, options?: RequestOptions): Promise<FolderUploadAborted>;
|
|
@@ -172,7 +172,7 @@ export declare class NotebookFiles {
|
|
|
172
172
|
mkdir(path: string, input?: Omit<FileMkdir, "path">, options?: RequestOptions): Promise<FileMade>;
|
|
173
173
|
/** Moves a file, a link or a directory; refused 409 when something is at its new path, unless overwrite. With sha256 or size, a file written in parts is put in place once whole: its writes ended, then only a file of that size with every byte written and whose bytes hash to it moves; refused 409 `upload_incomplete` or `checksum_mismatch`, nothing moved. With sha256, it is safe to send again: once moved, it returns the same answer while `from` is gone and `to` holds those bytes. */
|
|
174
174
|
rename(input: FileRename, options?: RequestOptions): Promise<FileRenamed>;
|
|
175
|
-
/** Makes an expiring address for one file that anyone may open with no API key, from a browser, curl or another service: GET downloads it (Range works, so videos play and downloads resume; archive: true downloads a folder as .tar.gz), PUT with the raw body uploads it (up to maxBytes, written whole; Content-Length required). The link acts as the key that made it: an upload link needs write, and the link ends with its key, with revokeLinks or with its notebook. A paused notebook is woken for it unless wake is false. */
|
|
175
|
+
/** Makes an expiring address for one file that anyone may open with no API key, from a browser, curl or another service: GET downloads it (Range works, so videos play and downloads resume; archive: true downloads a folder as .tar.gz), PUT with the raw body uploads it (up to maxBytes, written whole; Content-Length required). The link acts as the key that made it: an upload link needs write, and the link ends with its key, with revokeLinks or with its notebook. A paused notebook is woken for it unless wake is false. A port it serves is shared by a preview (previews.create), not a link. */
|
|
176
176
|
link(path: string, input?: Omit<FileLinkCreate, "path">, options?: RequestOptions): Promise<FileLink>;
|
|
177
177
|
/** Ends every file link made for a notebook so far; links made after work. */
|
|
178
178
|
revokeLinks(options?: RequestOptions): Promise<FileLinksRevoked>;
|
|
@@ -212,7 +212,7 @@ export declare class Notebook {
|
|
|
212
212
|
constructor(client: Notebooks, info: SandboxInfo);
|
|
213
213
|
/** Its id. */
|
|
214
214
|
get id(): string;
|
|
215
|
-
/** Its vCPUs; its product's default when omitted. At least
|
|
215
|
+
/** Its vCPUs, at least every plan's least (a smaller number is taken as it); its product's default when omitted. At least 2. */
|
|
216
216
|
get vcpu(): number | undefined;
|
|
217
217
|
/** Its memory in GB (1 GB is 1,024 MiB); a fraction is taken to the MiB (`1.5`). Its product's default when omitted. At least 1. */
|
|
218
218
|
get memoryGB(): number | undefined;
|
|
@@ -220,7 +220,7 @@ export declare class Notebook {
|
|
|
220
220
|
get diskGB(): number | undefined;
|
|
221
221
|
/** The image it boots, by name (its newest version), `name:version` or ID; Runtime's default image when omitted. */
|
|
222
222
|
get image(): string | undefined;
|
|
223
|
-
/** The secrets it may get, by name, at most 64: only those of them whose scope admits it; [] none; every one whose scope admits it when omitted. A name with no secret yet takes effect once that secret is created.
|
|
223
|
+
/** The secrets it may get, by name, at most 64: only those of them whose scope admits it; [] none; every one whose scope admits it when omitted. A name with no secret yet takes effect once that secret is created. An update changes it; a fork or a copy of a snapshot keeps it. At most 64 items. */
|
|
224
224
|
get secrets(): string[] | undefined;
|
|
225
225
|
/** The command it starts at every fresh boot and keeps running, as a service: a web server, a runner, a desktop. A wake with its memory kept does not start it again. Its image's when omitted. */
|
|
226
226
|
get start(): MachineStart | undefined;
|
|
@@ -254,6 +254,8 @@ export declare class Notebook {
|
|
|
254
254
|
get pausedAt(): string | undefined;
|
|
255
255
|
/** A create's answer alone, for a start with a ready check: how its wait went. */
|
|
256
256
|
get ready(): MachineReady | undefined;
|
|
257
|
+
/** For a machine that serves a port of its own (an app, a site or a function on 8080, a container on its image's, a notebook on 8888, a workspace on 8080, a desktop on 6080, a browser's DevTools on 9222): a link that opens it, answered by its create, get and update, none for a key that may not share its ports. It works for 10 minutes; a browser that opens it is given a cookie for that address for a day and sent on to the address without it, so no history keeps a link that still opens it. Another port is shared with previews.create. */
|
|
258
|
+
get url(): string | undefined;
|
|
257
259
|
/** When Runtime deletes it (`deleteAfterSeconds`), finally: it can't be undone, as its delete can't; none: kept until deleted. */
|
|
258
260
|
get deleteAt(): string | undefined;
|
|
259
261
|
/** Whether its delete is refused (409 `delete_protected`) until an update turns this off. */
|
|
@@ -335,7 +337,7 @@ export declare class Notebooks {
|
|
|
335
337
|
beginFolderUpload(id: string, input: FolderUploadBegin, options?: RequestOptions): Promise<FolderUpload>;
|
|
336
338
|
/** Sends the request's bytes, a part of the archive at its offset, into tar's input as they arrive, of any size, and returns the bytes received in all once tar took them. A part past them is refused 409 `upload_incomplete`, naming them: send the parts in order. */
|
|
337
339
|
writeFolderUpload(id: string, upload: string, data: Uint8Array | string, query?: NotebookWriteFolderUploadQuery & RequestOptions, options?: RequestOptions): Promise<FolderUploadReceived>;
|
|
338
|
-
/** Ends a folder upload's input and returns once tar has ended, as an exec returns once its command has: the folder, or 400 `invalid_archive` with what tar said.
|
|
340
|
+
/** Ends a folder upload's input and returns once tar has ended, as an exec returns once its command has: the folder, or 400 `invalid_archive` with what tar said. Sent again, it returns how tar ended. An upload no call has named for 10 minutes since its last part or commit is ended. */
|
|
339
341
|
commitFolderUpload(id: string, upload: string, options?: RequestOptions): Promise<FolderUnpacked>;
|
|
340
342
|
/** Stops a folder upload's tar; what it unpacked so far stays. */
|
|
341
343
|
abortFolderUpload(id: string, upload: string, options?: RequestOptions): Promise<FolderUploadAborted>;
|
|
@@ -343,7 +345,7 @@ export declare class Notebooks {
|
|
|
343
345
|
mkdir(id: string, input: FileMkdir, options?: RequestOptions): Promise<FileMade>;
|
|
344
346
|
/** Moves a file, a link or a directory; refused 409 when something is at its new path, unless overwrite. With sha256 or size, a file written in parts is put in place once whole: its writes ended, then only a file of that size with every byte written and whose bytes hash to it moves; refused 409 `upload_incomplete` or `checksum_mismatch`, nothing moved. With sha256, it is safe to send again: once moved, it returns the same answer while `from` is gone and `to` holds those bytes. */
|
|
345
347
|
rename(id: string, input: FileRename, options?: RequestOptions): Promise<FileRenamed>;
|
|
346
|
-
/** Makes an expiring address for one file that anyone may open with no API key, from a browser, curl or another service: GET downloads it (Range works, so videos play and downloads resume; archive: true downloads a folder as .tar.gz), PUT with the raw body uploads it (up to maxBytes, written whole; Content-Length required). The link acts as the key that made it: an upload link needs write, and the link ends with its key, with revokeLinks or with its notebook. A paused notebook is woken for it unless wake is false. */
|
|
348
|
+
/** Makes an expiring address for one file that anyone may open with no API key, from a browser, curl or another service: GET downloads it (Range works, so videos play and downloads resume; archive: true downloads a folder as .tar.gz), PUT with the raw body uploads it (up to maxBytes, written whole; Content-Length required). The link acts as the key that made it: an upload link needs write, and the link ends with its key, with revokeLinks or with its notebook. A paused notebook is woken for it unless wake is false. A port it serves is shared by a preview (previews.create), not a link. */
|
|
347
349
|
link(id: string, input: FileLinkCreate, options?: RequestOptions): Promise<FileLink>;
|
|
348
350
|
/** Ends every file link made for a notebook so far; links made after work. */
|
|
349
351
|
revokeLinks(id: string, options?: RequestOptions): Promise<FileLinksRevoked>;
|
|
@@ -45,7 +45,7 @@ export class NotebookFiles {
|
|
|
45
45
|
writeFolderUpload(upload, data, query = {}, options) {
|
|
46
46
|
return this.#c.writeFolderUpload(this.#id, upload, data, query, options);
|
|
47
47
|
}
|
|
48
|
-
/** Ends a folder upload's input and returns once tar has ended, as an exec returns once its command has: the folder, or 400 `invalid_archive` with what tar said.
|
|
48
|
+
/** Ends a folder upload's input and returns once tar has ended, as an exec returns once its command has: the folder, or 400 `invalid_archive` with what tar said. Sent again, it returns how tar ended. An upload no call has named for 10 minutes since its last part or commit is ended. */
|
|
49
49
|
commitFolderUpload(upload, options) {
|
|
50
50
|
return this.#c.commitFolderUpload(this.#id, upload, options);
|
|
51
51
|
}
|
|
@@ -61,7 +61,7 @@ export class NotebookFiles {
|
|
|
61
61
|
rename(input, options) {
|
|
62
62
|
return this.#c.rename(this.#id, input, options);
|
|
63
63
|
}
|
|
64
|
-
/** Makes an expiring address for one file that anyone may open with no API key, from a browser, curl or another service: GET downloads it (Range works, so videos play and downloads resume; archive: true downloads a folder as .tar.gz), PUT with the raw body uploads it (up to maxBytes, written whole; Content-Length required). The link acts as the key that made it: an upload link needs write, and the link ends with its key, with revokeLinks or with its notebook. A paused notebook is woken for it unless wake is false. */
|
|
64
|
+
/** Makes an expiring address for one file that anyone may open with no API key, from a browser, curl or another service: GET downloads it (Range works, so videos play and downloads resume; archive: true downloads a folder as .tar.gz), PUT with the raw body uploads it (up to maxBytes, written whole; Content-Length required). The link acts as the key that made it: an upload link needs write, and the link ends with its key, with revokeLinks or with its notebook. A paused notebook is woken for it unless wake is false. A port it serves is shared by a preview (previews.create), not a link. */
|
|
65
65
|
link(path, input = {}, options) {
|
|
66
66
|
return this.#c.link(this.#id, { ...input, path: path }, options);
|
|
67
67
|
}
|
|
@@ -135,7 +135,7 @@ export class Notebook {
|
|
|
135
135
|
get id() {
|
|
136
136
|
return this.info.id;
|
|
137
137
|
}
|
|
138
|
-
/** Its vCPUs; its product's default when omitted. At least
|
|
138
|
+
/** Its vCPUs, at least every plan's least (a smaller number is taken as it); its product's default when omitted. At least 2. */
|
|
139
139
|
get vcpu() {
|
|
140
140
|
return this.info.vcpu;
|
|
141
141
|
}
|
|
@@ -151,7 +151,7 @@ export class Notebook {
|
|
|
151
151
|
get image() {
|
|
152
152
|
return this.info.image;
|
|
153
153
|
}
|
|
154
|
-
/** The secrets it may get, by name, at most 64: only those of them whose scope admits it; [] none; every one whose scope admits it when omitted. A name with no secret yet takes effect once that secret is created.
|
|
154
|
+
/** The secrets it may get, by name, at most 64: only those of them whose scope admits it; [] none; every one whose scope admits it when omitted. A name with no secret yet takes effect once that secret is created. An update changes it; a fork or a copy of a snapshot keeps it. At most 64 items. */
|
|
155
155
|
get secrets() {
|
|
156
156
|
return this.info.secrets;
|
|
157
157
|
}
|
|
@@ -219,6 +219,10 @@ export class Notebook {
|
|
|
219
219
|
get ready() {
|
|
220
220
|
return this.info.ready;
|
|
221
221
|
}
|
|
222
|
+
/** For a machine that serves a port of its own (an app, a site or a function on 8080, a container on its image's, a notebook on 8888, a workspace on 8080, a desktop on 6080, a browser's DevTools on 9222): a link that opens it, answered by its create, get and update, none for a key that may not share its ports. It works for 10 minutes; a browser that opens it is given a cookie for that address for a day and sent on to the address without it, so no history keeps a link that still opens it. Another port is shared with previews.create. */
|
|
223
|
+
get url() {
|
|
224
|
+
return this.info.url;
|
|
225
|
+
}
|
|
222
226
|
/** When Runtime deletes it (`deleteAfterSeconds`), finally: it can't be undone, as its delete can't; none: kept until deleted. */
|
|
223
227
|
get deleteAt() {
|
|
224
228
|
return this.info.deleteAt;
|
|
@@ -382,7 +386,7 @@ export class Notebooks {
|
|
|
382
386
|
writeFolderUpload(id, upload, data, query = {}, options) {
|
|
383
387
|
return this.transport.request("PUT", `/v2/notebooks/${encodeURIComponent(id)}/files/archive/uploads/${encodeURIComponent(upload)}`, { data: toBytes(data), query: { ...query }, options, idempotent: true });
|
|
384
388
|
}
|
|
385
|
-
/** Ends a folder upload's input and returns once tar has ended, as an exec returns once its command has: the folder, or 400 `invalid_archive` with what tar said.
|
|
389
|
+
/** Ends a folder upload's input and returns once tar has ended, as an exec returns once its command has: the folder, or 400 `invalid_archive` with what tar said. Sent again, it returns how tar ended. An upload no call has named for 10 minutes since its last part or commit is ended. */
|
|
386
390
|
commitFolderUpload(id, upload, options) {
|
|
387
391
|
return this.transport.request("POST", `/v2/notebooks/${encodeURIComponent(id)}/files/archive/uploads/${encodeURIComponent(upload)}:commit`, { options, idempotent: true });
|
|
388
392
|
}
|
|
@@ -398,7 +402,7 @@ export class Notebooks {
|
|
|
398
402
|
rename(id, input, options) {
|
|
399
403
|
return this.transport.request("POST", `/v2/notebooks/${encodeURIComponent(id)}/files:rename`, { body: input, options });
|
|
400
404
|
}
|
|
401
|
-
/** Makes an expiring address for one file that anyone may open with no API key, from a browser, curl or another service: GET downloads it (Range works, so videos play and downloads resume; archive: true downloads a folder as .tar.gz), PUT with the raw body uploads it (up to maxBytes, written whole; Content-Length required). The link acts as the key that made it: an upload link needs write, and the link ends with its key, with revokeLinks or with its notebook. A paused notebook is woken for it unless wake is false. */
|
|
405
|
+
/** Makes an expiring address for one file that anyone may open with no API key, from a browser, curl or another service: GET downloads it (Range works, so videos play and downloads resume; archive: true downloads a folder as .tar.gz), PUT with the raw body uploads it (up to maxBytes, written whole; Content-Length required). The link acts as the key that made it: an upload link needs write, and the link ends with its key, with revokeLinks or with its notebook. A paused notebook is woken for it unless wake is false. A port it serves is shared by a preview (previews.create), not a link. */
|
|
402
406
|
link(id, input, options) {
|
|
403
407
|
return this.transport.request("POST", `/v2/notebooks/${encodeURIComponent(id)}/files:link`, { body: input, options });
|
|
404
408
|
}
|
|
@@ -6,6 +6,8 @@ export interface PortCreate {
|
|
|
6
6
|
sandboxId: string;
|
|
7
7
|
/** The port inside the machine, 1 to 65535. */
|
|
8
8
|
port: number;
|
|
9
|
+
/** `tcp`, the only one a public port carries: any other is refused, never made as TCP. */
|
|
10
|
+
protocol?: "tcp" | (string & {});
|
|
9
11
|
}
|
|
10
12
|
/** A public TCP port's settings, as it keeps them. */
|
|
11
13
|
export interface PortSettings {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { RequestOptions,
|
|
2
|
-
import { Paginated } from "./runtime.js";
|
|
1
|
+
import type { RequestOptions, ClientOptions } from "./runtime.js";
|
|
2
|
+
import { Paginated, Transport } from "./runtime.js";
|
|
3
3
|
/** A project's own limits: each of its organization's plan limits set lower for it alone, never higher, by the price card's names and in its units. A start in it is held to both. One not set is its organization's. */
|
|
4
4
|
export interface ProjectLimits {
|
|
5
5
|
/** The most vCPUs its machines run at once. At least 0. */
|
|
@@ -14,7 +14,7 @@ export interface ProjectLimits {
|
|
|
14
14
|
newMachinesPerSecond?: number;
|
|
15
15
|
}
|
|
16
16
|
/** A project: where machines, storage, addresses and keys sit. */
|
|
17
|
-
export interface
|
|
17
|
+
export interface ProjectInfo {
|
|
18
18
|
/** Its ID. */
|
|
19
19
|
id: string;
|
|
20
20
|
/** Always `project`. */
|
|
@@ -54,18 +54,60 @@ export type ProjectListQuery = {
|
|
|
54
54
|
/** The most items the page holds. At least 1. At most 200. Default: 50. */
|
|
55
55
|
limit?: number;
|
|
56
56
|
};
|
|
57
|
+
/** What get takes in its query. */
|
|
58
|
+
export type ProjectGetQuery = {
|
|
59
|
+
/** Seconds to wait, at most 60, for its state to differ from `ifState`; it answers once it does, or as it is when the wait ends. At least 0. At most 60. */
|
|
60
|
+
wait?: number;
|
|
61
|
+
/** The state the caller last read, which `wait` waits for it to leave. */
|
|
62
|
+
ifState?: string;
|
|
63
|
+
};
|
|
64
|
+
/** One of projects: A project: where machines, storage, addresses and keys sit, each in one. Every organization has a default project, where a call that names none acts. */
|
|
65
|
+
export declare class Project {
|
|
66
|
+
#private;
|
|
67
|
+
/** What it was when last read. */
|
|
68
|
+
info: ProjectInfo;
|
|
69
|
+
constructor(client: Projects, info: ProjectInfo);
|
|
70
|
+
/** Its id. */
|
|
71
|
+
get id(): string;
|
|
72
|
+
/** Always `project`. */
|
|
73
|
+
get object(): "project" | (string & {});
|
|
74
|
+
/** Its name, unique in the organization. */
|
|
75
|
+
get name(): string;
|
|
76
|
+
/** Whether it is the organization's default project, where a call that names none acts. */
|
|
77
|
+
get default(): boolean;
|
|
78
|
+
/** When it was made. */
|
|
79
|
+
get createdAt(): string;
|
|
80
|
+
/** `active`; `deleted` once deleted: a delete's answer. */
|
|
81
|
+
get state(): "active" | "deleted" | (string & {});
|
|
82
|
+
/** When it was deleted: a delete's answer, its state `deleted`. */
|
|
83
|
+
get deletedAt(): string | undefined;
|
|
84
|
+
/** Makes one and returns it, as `new Runtime().projects.create()` does, with a client of its own: `RUNTIME_API_KEY`, or the key `options` names. */
|
|
85
|
+
static create(input: ProjectCreate, options?: ClientOptions & RequestOptions): Promise<Project>;
|
|
86
|
+
/** Returns one by its ID. Another organization's, one deleted, or one past the key's reach returns 404. */
|
|
87
|
+
refresh(query?: ProjectGetQuery & RequestOptions, options?: RequestOptions): Promise<this>;
|
|
88
|
+
/** Sets a project's own limits: each of its organization's plan limits set lower for it alone, by the price card's names. The whole set: a limit left out is its organization's again. One above its organization's returns 400 `limit_above_org`, naming the limit and both figures. Each start in the project is held to its limits and its organization's. */
|
|
89
|
+
limits(limits: ProjectLimits, input?: Omit<ProjectLimitsSet, "limits">, options?: RequestOptions): Promise<this>;
|
|
90
|
+
/** Renames a project; what is in it stays as it is. A name another project has returns 409. */
|
|
91
|
+
update(name: string, input?: Omit<Rename, "name">, options?: RequestOptions): Promise<this>;
|
|
92
|
+
/** Deletes a project and frees its name, with the grants, keys and invitations held to it. The caller needs `grants:delete` as well, as the grants go with it. The default project, or one that still holds a machine, storage or an address, returns 409. Deleted again, it returns 404. */
|
|
93
|
+
delete(options?: RequestOptions): Promise<ProjectInfo>;
|
|
94
|
+
/** Deletes it when the `await using` block that holds it ends. */
|
|
95
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
96
|
+
}
|
|
57
97
|
/** A project: where machines, storage, addresses and keys sit, each in one. Every organization has a default project, where a call that names none acts. */
|
|
58
98
|
export declare class Projects {
|
|
59
99
|
readonly transport: Transport;
|
|
60
100
|
constructor(transport: Transport);
|
|
61
101
|
/** Lists the organization's projects, the default first, then by name. */
|
|
62
|
-
list(query?: ProjectListQuery & RequestOptions, options?: RequestOptions): Paginated<
|
|
102
|
+
list(query?: ProjectListQuery & RequestOptions, options?: RequestOptions): Paginated<ProjectInfo>;
|
|
103
|
+
/** Returns one by its ID. Another organization's, one deleted, or one past the key's reach returns 404. */
|
|
104
|
+
get(id: string, query?: ProjectGetQuery & RequestOptions, options?: RequestOptions): Promise<Project>;
|
|
63
105
|
/** Creates a project, with its own limits when given. A name another project has returns 409; a limit above its organization's returns 400 `limit_above_org`. Asked again with the same Idempotency-Key, it returns the same one. */
|
|
64
106
|
create(input: ProjectCreate, options?: RequestOptions): Promise<Project>;
|
|
65
107
|
/** Sets a project's own limits: each of its organization's plan limits set lower for it alone, by the price card's names. The whole set: a limit left out is its organization's again. One above its organization's returns 400 `limit_above_org`, naming the limit and both figures. Each start in the project is held to its limits and its organization's. */
|
|
66
|
-
limits(id: string, input: ProjectLimitsSet, options?: RequestOptions): Promise<
|
|
108
|
+
limits(id: string, input: ProjectLimitsSet, options?: RequestOptions): Promise<ProjectInfo>;
|
|
67
109
|
/** Renames a project; what is in it stays as it is. A name another project has returns 409. */
|
|
68
|
-
update(id: string, input: Rename, options?: RequestOptions): Promise<
|
|
110
|
+
update(id: string, input: Rename, options?: RequestOptions): Promise<ProjectInfo>;
|
|
69
111
|
/** Deletes a project and frees its name, with the grants, keys and invitations held to it. The caller needs `grants:delete` as well, as the grants go with it. The default project, or one that still holds a machine, storage or an address, returns 409. Deleted again, it returns 404. */
|
|
70
|
-
delete(id: string, options?: RequestOptions): Promise<
|
|
112
|
+
delete(id: string, options?: RequestOptions): Promise<ProjectInfo>;
|
|
71
113
|
}
|
|
@@ -1,6 +1,71 @@
|
|
|
1
1
|
// Generated by spec-gen from engines/front/crates/spec. Do not edit:
|
|
2
2
|
// change the spec and run `cargo run -p runtime-front-spec-gen -- write`.
|
|
3
|
-
import { Paginated } from "./runtime.js";
|
|
3
|
+
import { Paginated, Transport } from "./runtime.js";
|
|
4
|
+
/** One of projects: A project: where machines, storage, addresses and keys sit, each in one. Every organization has a default project, where a call that names none acts. */
|
|
5
|
+
export class Project {
|
|
6
|
+
#c;
|
|
7
|
+
/** What it was when last read. */
|
|
8
|
+
info;
|
|
9
|
+
constructor(client, info) {
|
|
10
|
+
this.#c = client;
|
|
11
|
+
this.info = info;
|
|
12
|
+
}
|
|
13
|
+
/** Its id. */
|
|
14
|
+
get id() {
|
|
15
|
+
return this.info.id;
|
|
16
|
+
}
|
|
17
|
+
/** Always `project`. */
|
|
18
|
+
get object() {
|
|
19
|
+
return this.info.object;
|
|
20
|
+
}
|
|
21
|
+
/** Its name, unique in the organization. */
|
|
22
|
+
get name() {
|
|
23
|
+
return this.info.name;
|
|
24
|
+
}
|
|
25
|
+
/** Whether it is the organization's default project, where a call that names none acts. */
|
|
26
|
+
get default() {
|
|
27
|
+
return this.info.default;
|
|
28
|
+
}
|
|
29
|
+
/** When it was made. */
|
|
30
|
+
get createdAt() {
|
|
31
|
+
return this.info.createdAt;
|
|
32
|
+
}
|
|
33
|
+
/** `active`; `deleted` once deleted: a delete's answer. */
|
|
34
|
+
get state() {
|
|
35
|
+
return this.info.state;
|
|
36
|
+
}
|
|
37
|
+
/** When it was deleted: a delete's answer, its state `deleted`. */
|
|
38
|
+
get deletedAt() {
|
|
39
|
+
return this.info.deletedAt;
|
|
40
|
+
}
|
|
41
|
+
/** Makes one and returns it, as `new Runtime().projects.create()` does, with a client of its own: `RUNTIME_API_KEY`, or the key `options` names. */
|
|
42
|
+
static async create(input, options = {}) {
|
|
43
|
+
return new Projects(new Transport(options)).create(input, options);
|
|
44
|
+
}
|
|
45
|
+
/** Returns one by its ID. Another organization's, one deleted, or one past the key's reach returns 404. */
|
|
46
|
+
async refresh(query = {}, options) {
|
|
47
|
+
this.info = (await this.#c.get(this.id, query, options)).info;
|
|
48
|
+
return this;
|
|
49
|
+
}
|
|
50
|
+
/** Sets a project's own limits: each of its organization's plan limits set lower for it alone, by the price card's names. The whole set: a limit left out is its organization's again. One above its organization's returns 400 `limit_above_org`, naming the limit and both figures. Each start in the project is held to its limits and its organization's. */
|
|
51
|
+
async limits(limits, input = {}, options) {
|
|
52
|
+
this.info = await this.#c.limits(this.id, { ...input, limits: limits }, options);
|
|
53
|
+
return this;
|
|
54
|
+
}
|
|
55
|
+
/** Renames a project; what is in it stays as it is. A name another project has returns 409. */
|
|
56
|
+
async update(name, input = {}, options) {
|
|
57
|
+
this.info = await this.#c.update(this.id, { ...input, name: name }, options);
|
|
58
|
+
return this;
|
|
59
|
+
}
|
|
60
|
+
/** Deletes a project and frees its name, with the grants, keys and invitations held to it. The caller needs `grants:delete` as well, as the grants go with it. The default project, or one that still holds a machine, storage or an address, returns 409. Deleted again, it returns 404. */
|
|
61
|
+
delete(options) {
|
|
62
|
+
return this.#c.delete(this.id, options);
|
|
63
|
+
}
|
|
64
|
+
/** Deletes it when the `await using` block that holds it ends. */
|
|
65
|
+
async [Symbol.asyncDispose]() {
|
|
66
|
+
await this.delete();
|
|
67
|
+
}
|
|
68
|
+
}
|
|
4
69
|
/** A project: where machines, storage, addresses and keys sit, each in one. Every organization has a default project, where a call that names none acts. */
|
|
5
70
|
export class Projects {
|
|
6
71
|
transport;
|
|
@@ -11,9 +76,13 @@ export class Projects {
|
|
|
11
76
|
list(query = {}, options) {
|
|
12
77
|
return new Paginated((cursor) => this.transport.request("GET", `/v2/projects`, { query: { ...query, cursor }, options, idempotent: true }));
|
|
13
78
|
}
|
|
79
|
+
/** Returns one by its ID. Another organization's, one deleted, or one past the key's reach returns 404. */
|
|
80
|
+
async get(id, query = {}, options) {
|
|
81
|
+
return new Project(this, await this.transport.request("GET", `/v2/projects/${encodeURIComponent(id)}`, { query: { ...query }, options, idempotent: true }));
|
|
82
|
+
}
|
|
14
83
|
/** Creates a project, with its own limits when given. A name another project has returns 409; a limit above its organization's returns 400 `limit_above_org`. Asked again with the same Idempotency-Key, it returns the same one. */
|
|
15
|
-
create(input, options) {
|
|
16
|
-
return this.transport.request("POST", `/v2/projects`, { body: input, options, idempotent: true });
|
|
84
|
+
async create(input, options) {
|
|
85
|
+
return new Project(this, await this.transport.request("POST", `/v2/projects`, { body: input, options, idempotent: true }));
|
|
17
86
|
}
|
|
18
87
|
/** Sets a project's own limits: each of its organization's plan limits set lower for it alone, by the price card's names. The whole set: a limit left out is its organization's again. One above its organization's returns 400 `limit_above_org`, naming the limit and both figures. Each start in the project is held to its limits and its organization's. */
|
|
19
88
|
limits(id, input, options) {
|
|
@@ -2,7 +2,7 @@ import type { RequestOptions, Transport } from "./runtime.js";
|
|
|
2
2
|
import { Paginated } from "./runtime.js";
|
|
3
3
|
import type { Rename } from "./projects.js";
|
|
4
4
|
/** One of the organization's own roles: the actions a grant of it allows. */
|
|
5
|
-
export interface
|
|
5
|
+
export interface RoleInfo {
|
|
6
6
|
/** Its ID. */
|
|
7
7
|
id: string;
|
|
8
8
|
/** Always `role`. */
|
|
@@ -30,16 +30,54 @@ export type RoleListQuery = {
|
|
|
30
30
|
/** The most items the page holds. At least 1. At most 200. Default: 50. */
|
|
31
31
|
limit?: number;
|
|
32
32
|
};
|
|
33
|
+
/** What get takes in its query. */
|
|
34
|
+
export type RoleGetQuery = {
|
|
35
|
+
/** Seconds to wait, at most 60, for its state to differ from `ifState`; it answers once it does, or as it is when the wait ends. At least 0. At most 60. */
|
|
36
|
+
wait?: number;
|
|
37
|
+
/** The state the caller last read, which `wait` waits for it to leave. */
|
|
38
|
+
ifState?: string;
|
|
39
|
+
};
|
|
40
|
+
/** One of roles: One of the organization's own roles: the actions a grant of it allows. The built-in roles (owner, admin, developer, viewer, billing) are not listed here. */
|
|
41
|
+
export declare class Role {
|
|
42
|
+
#private;
|
|
43
|
+
/** What it was when last read. */
|
|
44
|
+
info: RoleInfo;
|
|
45
|
+
constructor(client: Roles, info: RoleInfo);
|
|
46
|
+
/** Its id. */
|
|
47
|
+
get id(): string;
|
|
48
|
+
/** Always `role`. */
|
|
49
|
+
get object(): "role" | (string & {});
|
|
50
|
+
/** Its name, unique in the organization. */
|
|
51
|
+
get name(): string;
|
|
52
|
+
/** When it was made. */
|
|
53
|
+
get createdAt(): string;
|
|
54
|
+
/** `active`; `deleted` once deleted: a delete's answer. */
|
|
55
|
+
get state(): "active" | "deleted" | (string & {});
|
|
56
|
+
/** When it was deleted: a delete's answer, its state `deleted`. */
|
|
57
|
+
get deletedAt(): string | undefined;
|
|
58
|
+
/** Returns one by its ID. Another organization's, one deleted, or one past the key's reach returns 404. */
|
|
59
|
+
refresh(query?: RoleGetQuery & RequestOptions, options?: RequestOptions): Promise<this>;
|
|
60
|
+
/** Adds actions to a role and removes actions from it, in place, and returns the role. Every key and grant that gives the role has the new actions from its next call; no key's secret changes. Only an owner or an admin may change a role's actions, and only to add actions the caller may perform itself across the whole organization: any other caller or action returns 403. An action no call has returns 400. A role Runtime manages (its name starts with `runtime.`) returns 409, as does a removal from a role that a deny grant gives (a deny is lifted only by deleting that grant; an addition is allowed), a removal that would leave the role with no actions, or one that removes an action the role still holds through a wildcard such as `images:*`. Adding an action the role already holds, or removing one it does not hold, changes nothing, so the call is safe to retry. Each change is one audit log entry, `roles:actions`, whose reason lists the actions added and removed. */
|
|
61
|
+
actions(input?: RoleActionsChange, options?: RequestOptions): Promise<this>;
|
|
62
|
+
/** Renames a role; its actions and its grants stay as they are. A built-in role's name, or another role's, returns 409. */
|
|
63
|
+
update(name: string, input?: Omit<Rename, "name">, options?: RequestOptions): Promise<this>;
|
|
64
|
+
/** Deletes a role and frees its name, with the grants and invitations that give it. The caller needs `grants:delete` as well, as the grants go with it. A role that a deny grant gives returns 409: a deny is lifted only by deleting that grant. Deleted again, it returns 404. */
|
|
65
|
+
delete(options?: RequestOptions): Promise<RoleInfo>;
|
|
66
|
+
/** Deletes it when the `await using` block that holds it ends. */
|
|
67
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
68
|
+
}
|
|
33
69
|
/** One of the organization's own roles: the actions a grant of it allows. The built-in roles (owner, admin, developer, viewer, billing) are not listed here. */
|
|
34
70
|
export declare class Roles {
|
|
35
71
|
readonly transport: Transport;
|
|
36
72
|
constructor(transport: Transport);
|
|
37
73
|
/** Lists the organization's own roles, by name. */
|
|
38
|
-
list(query?: RoleListQuery & RequestOptions, options?: RequestOptions): Paginated<
|
|
74
|
+
list(query?: RoleListQuery & RequestOptions, options?: RequestOptions): Paginated<RoleInfo>;
|
|
75
|
+
/** Returns one by its ID. Another organization's, one deleted, or one past the key's reach returns 404. */
|
|
76
|
+
get(id: string, query?: RoleGetQuery & RequestOptions, options?: RequestOptions): Promise<Role>;
|
|
39
77
|
/** Adds actions to a role and removes actions from it, in place, and returns the role. Every key and grant that gives the role has the new actions from its next call; no key's secret changes. Only an owner or an admin may change a role's actions, and only to add actions the caller may perform itself across the whole organization: any other caller or action returns 403. An action no call has returns 400. A role Runtime manages (its name starts with `runtime.`) returns 409, as does a removal from a role that a deny grant gives (a deny is lifted only by deleting that grant; an addition is allowed), a removal that would leave the role with no actions, or one that removes an action the role still holds through a wildcard such as `images:*`. Adding an action the role already holds, or removing one it does not hold, changes nothing, so the call is safe to retry. Each change is one audit log entry, `roles:actions`, whose reason lists the actions added and removed. */
|
|
40
|
-
actions(id: string, input?: RoleActionsChange, options?: RequestOptions): Promise<
|
|
78
|
+
actions(id: string, input?: RoleActionsChange, options?: RequestOptions): Promise<RoleInfo>;
|
|
41
79
|
/** Renames a role; its actions and its grants stay as they are. A built-in role's name, or another role's, returns 409. */
|
|
42
|
-
update(id: string, input: Rename, options?: RequestOptions): Promise<
|
|
80
|
+
update(id: string, input: Rename, options?: RequestOptions): Promise<RoleInfo>;
|
|
43
81
|
/** Deletes a role and frees its name, with the grants and invitations that give it. The caller needs `grants:delete` as well, as the grants go with it. A role that a deny grant gives returns 409: a deny is lifted only by deleting that grant. Deleted again, it returns 404. */
|
|
44
|
-
delete(id: string, options?: RequestOptions): Promise<
|
|
82
|
+
delete(id: string, options?: RequestOptions): Promise<RoleInfo>;
|
|
45
83
|
}
|
package/dist/generated/roles.js
CHANGED
|
@@ -1,6 +1,63 @@
|
|
|
1
1
|
// Generated by spec-gen from engines/front/crates/spec. Do not edit:
|
|
2
2
|
// change the spec and run `cargo run -p runtime-front-spec-gen -- write`.
|
|
3
3
|
import { Paginated } from "./runtime.js";
|
|
4
|
+
/** One of roles: One of the organization's own roles: the actions a grant of it allows. The built-in roles (owner, admin, developer, viewer, billing) are not listed here. */
|
|
5
|
+
export class Role {
|
|
6
|
+
#c;
|
|
7
|
+
/** What it was when last read. */
|
|
8
|
+
info;
|
|
9
|
+
constructor(client, info) {
|
|
10
|
+
this.#c = client;
|
|
11
|
+
this.info = info;
|
|
12
|
+
}
|
|
13
|
+
/** Its id. */
|
|
14
|
+
get id() {
|
|
15
|
+
return this.info.id;
|
|
16
|
+
}
|
|
17
|
+
/** Always `role`. */
|
|
18
|
+
get object() {
|
|
19
|
+
return this.info.object;
|
|
20
|
+
}
|
|
21
|
+
/** Its name, unique in the organization. */
|
|
22
|
+
get name() {
|
|
23
|
+
return this.info.name;
|
|
24
|
+
}
|
|
25
|
+
/** When it was made. */
|
|
26
|
+
get createdAt() {
|
|
27
|
+
return this.info.createdAt;
|
|
28
|
+
}
|
|
29
|
+
/** `active`; `deleted` once deleted: a delete's answer. */
|
|
30
|
+
get state() {
|
|
31
|
+
return this.info.state;
|
|
32
|
+
}
|
|
33
|
+
/** When it was deleted: a delete's answer, its state `deleted`. */
|
|
34
|
+
get deletedAt() {
|
|
35
|
+
return this.info.deletedAt;
|
|
36
|
+
}
|
|
37
|
+
/** Returns one by its ID. Another organization's, one deleted, or one past the key's reach returns 404. */
|
|
38
|
+
async refresh(query = {}, options) {
|
|
39
|
+
this.info = (await this.#c.get(this.id, query, options)).info;
|
|
40
|
+
return this;
|
|
41
|
+
}
|
|
42
|
+
/** Adds actions to a role and removes actions from it, in place, and returns the role. Every key and grant that gives the role has the new actions from its next call; no key's secret changes. Only an owner or an admin may change a role's actions, and only to add actions the caller may perform itself across the whole organization: any other caller or action returns 403. An action no call has returns 400. A role Runtime manages (its name starts with `runtime.`) returns 409, as does a removal from a role that a deny grant gives (a deny is lifted only by deleting that grant; an addition is allowed), a removal that would leave the role with no actions, or one that removes an action the role still holds through a wildcard such as `images:*`. Adding an action the role already holds, or removing one it does not hold, changes nothing, so the call is safe to retry. Each change is one audit log entry, `roles:actions`, whose reason lists the actions added and removed. */
|
|
43
|
+
async actions(input = {}, options) {
|
|
44
|
+
this.info = await this.#c.actions(this.id, input, options);
|
|
45
|
+
return this;
|
|
46
|
+
}
|
|
47
|
+
/** Renames a role; its actions and its grants stay as they are. A built-in role's name, or another role's, returns 409. */
|
|
48
|
+
async update(name, input = {}, options) {
|
|
49
|
+
this.info = await this.#c.update(this.id, { ...input, name: name }, options);
|
|
50
|
+
return this;
|
|
51
|
+
}
|
|
52
|
+
/** Deletes a role and frees its name, with the grants and invitations that give it. The caller needs `grants:delete` as well, as the grants go with it. A role that a deny grant gives returns 409: a deny is lifted only by deleting that grant. Deleted again, it returns 404. */
|
|
53
|
+
delete(options) {
|
|
54
|
+
return this.#c.delete(this.id, options);
|
|
55
|
+
}
|
|
56
|
+
/** Deletes it when the `await using` block that holds it ends. */
|
|
57
|
+
async [Symbol.asyncDispose]() {
|
|
58
|
+
await this.delete();
|
|
59
|
+
}
|
|
60
|
+
}
|
|
4
61
|
/** One of the organization's own roles: the actions a grant of it allows. The built-in roles (owner, admin, developer, viewer, billing) are not listed here. */
|
|
5
62
|
export class Roles {
|
|
6
63
|
transport;
|
|
@@ -11,6 +68,10 @@ export class Roles {
|
|
|
11
68
|
list(query = {}, options) {
|
|
12
69
|
return new Paginated((cursor) => this.transport.request("GET", `/v2/roles`, { query: { ...query, cursor }, options, idempotent: true }));
|
|
13
70
|
}
|
|
71
|
+
/** Returns one by its ID. Another organization's, one deleted, or one past the key's reach returns 404. */
|
|
72
|
+
async get(id, query = {}, options) {
|
|
73
|
+
return new Role(this, await this.transport.request("GET", `/v2/roles/${encodeURIComponent(id)}`, { query: { ...query }, options, idempotent: true }));
|
|
74
|
+
}
|
|
14
75
|
/** Adds actions to a role and removes actions from it, in place, and returns the role. Every key and grant that gives the role has the new actions from its next call; no key's secret changes. Only an owner or an admin may change a role's actions, and only to add actions the caller may perform itself across the whole organization: any other caller or action returns 403. An action no call has returns 400. A role Runtime manages (its name starts with `runtime.`) returns 409, as does a removal from a role that a deny grant gives (a deny is lifted only by deleting that grant; an addition is allowed), a removal that would leave the role with no actions, or one that removes an action the role still holds through a wildcard such as `images:*`. Adding an action the role already holds, or removing one it does not hold, changes nothing, so the call is safe to retry. Each change is one audit log entry, `roles:actions`, whose reason lists the actions added and removed. */
|
|
15
76
|
actions(id, input = {}, options) {
|
|
16
77
|
return this.transport.request("POST", `/v2/roles/${encodeURIComponent(id)}:actions`, { body: input, options, idempotent: true });
|