withruntime 1.0.0 → 1.1.1
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/CHANGELOG.md +76 -0
- package/README.md +145 -0
- package/dist/generated/agentSessions.d.ts +218 -0
- package/dist/generated/agentSessions.js +154 -0
- package/dist/generated/agents.d.ts +193 -0
- package/dist/generated/agents.js +166 -0
- package/dist/generated/apps.d.ts +87 -28
- package/dist/generated/apps.js +153 -41
- package/dist/generated/audit.d.ts +2 -2
- package/dist/generated/audit.js +3 -3
- package/dist/generated/browsers.d.ts +87 -28
- package/dist/generated/browsers.js +153 -41
- package/dist/generated/builds.d.ts +87 -28
- package/dist/generated/builds.js +153 -41
- package/dist/generated/ci.d.ts +87 -28
- package/dist/generated/ci.js +153 -41
- package/dist/generated/containers.d.ts +87 -28
- package/dist/generated/containers.js +153 -41
- package/dist/generated/desktops.d.ts +89 -30
- package/dist/generated/desktops.js +155 -43
- package/dist/generated/domains.d.ts +52 -15
- package/dist/generated/domains.js +74 -14
- package/dist/generated/egressIps.d.ts +6 -6
- package/dist/generated/egressIps.js +4 -4
- package/dist/generated/events.d.ts +4 -2
- package/dist/generated/events.js +3 -3
- package/dist/generated/feedback.d.ts +1 -1
- package/dist/generated/feedback.js +3 -3
- package/dist/generated/functions.d.ts +87 -28
- package/dist/generated/functions.js +153 -41
- package/dist/generated/identities.d.ts +2 -2
- package/dist/generated/identities.js +5 -5
- package/dist/generated/images.d.ts +68 -14
- package/dist/generated/images.js +96 -15
- package/dist/generated/index.d.ts +9 -0
- package/dist/generated/index.js +12 -0
- package/dist/generated/jobRuns.d.ts +11 -4
- package/dist/generated/jobRuns.js +6 -6
- package/dist/generated/jobs.d.ts +58 -9
- package/dist/generated/jobs.js +98 -14
- package/dist/generated/keys.d.ts +8 -6
- package/dist/generated/keys.js +6 -6
- package/dist/generated/me.d.ts +2 -2
- package/dist/generated/me.js +3 -3
- package/dist/generated/messages.d.ts +67 -0
- package/dist/generated/messages.js +17 -0
- package/dist/generated/networks.d.ts +4 -4
- package/dist/generated/networks.js +4 -4
- package/dist/generated/notebooks.d.ts +87 -28
- package/dist/generated/notebooks.js +153 -41
- package/dist/generated/otel.d.ts +2 -2
- package/dist/generated/otel.js +5 -5
- package/dist/generated/ports.d.ts +11 -11
- package/dist/generated/ports.js +8 -8
- package/dist/generated/previews.d.ts +50 -15
- package/dist/generated/previews.js +70 -18
- package/dist/generated/projects.d.ts +30 -6
- package/dist/generated/projects.js +13 -9
- package/dist/generated/roles.d.ts +11 -2
- package/dist/generated/roles.js +9 -5
- package/dist/generated/routes.js +1 -1
- package/dist/generated/runtime.d.ts +15 -3
- package/dist/generated/runtime.js +31 -18
- package/dist/generated/sandboxes.d.ts +213 -66
- package/dist/generated/sandboxes.js +171 -43
- package/dist/generated/secrets.d.ts +45 -6
- package/dist/generated/secrets.js +69 -9
- package/dist/generated/sessions.d.ts +1 -1
- package/dist/generated/sessions.js +4 -4
- package/dist/generated/signing.js +3 -1
- package/dist/generated/sites.d.ts +87 -28
- package/dist/generated/sites.js +153 -41
- package/dist/generated/snapshots.d.ts +70 -5
- package/dist/generated/snapshots.js +107 -7
- package/dist/generated/tunnels.d.ts +8 -8
- package/dist/generated/tunnels.js +4 -4
- package/dist/generated/usage.d.ts +57 -6
- package/dist/generated/usage.js +4 -4
- package/dist/generated/volumes.d.ts +72 -7
- package/dist/generated/volumes.js +114 -10
- package/dist/generated/webhooks.d.ts +2 -2
- package/dist/generated/webhooks.js +5 -5
- package/dist/generated/workspaces.d.ts +87 -28
- package/dist/generated/workspaces.js +153 -41
- package/dist/v2/bin.d.ts +2 -0
- package/dist/v2/bin.js +15 -0
- package/dist/v2/cli.d.ts +15 -2
- package/dist/v2/cli.js +158 -53
- package/dist/v2/json.d.ts +9 -0
- package/dist/v2/json.js +5 -0
- package/dist/v2/mcp.js +14 -1
- package/dist/v2/openapi.json +7695 -4382
- package/dist/v2/shims/fly.js +49 -13
- package/dist/v2/shims/morph.js +1 -1
- package/dist/v2/table.d.ts +7 -4
- package/dist/v2/table.js +97 -34
- package/package.json +7 -5
package/dist/generated/images.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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, toBytes } from "./runtime.js";
|
|
3
|
+
import { Paginated, Transport, toBytes } from "./runtime.js";
|
|
4
4
|
/** One of images: What a machine boots: a root filesystem, its environment and its start. */
|
|
5
5
|
export class Image {
|
|
6
6
|
#c;
|
|
@@ -14,12 +14,80 @@ export class Image {
|
|
|
14
14
|
get id() {
|
|
15
15
|
return this.info.id;
|
|
16
16
|
}
|
|
17
|
+
/** Its kind: `snapshot`, `image` or `volume`. */
|
|
18
|
+
get object() {
|
|
19
|
+
return this.info.object;
|
|
20
|
+
}
|
|
21
|
+
/** Its name, unique in its project among its kind. */
|
|
22
|
+
get name() {
|
|
23
|
+
return this.info.name;
|
|
24
|
+
}
|
|
25
|
+
/** Where it is. */
|
|
26
|
+
get state() {
|
|
27
|
+
return this.info.state;
|
|
28
|
+
}
|
|
29
|
+
/** Its labels. */
|
|
30
|
+
get labels() {
|
|
31
|
+
return this.info.labels;
|
|
32
|
+
}
|
|
33
|
+
/** What it was made to hold, in bytes. */
|
|
34
|
+
get sizeBytes() {
|
|
35
|
+
return this.info.sizeBytes;
|
|
36
|
+
}
|
|
37
|
+
/** What it holds now, in bytes. */
|
|
38
|
+
get storedBytes() {
|
|
39
|
+
return this.info.storedBytes;
|
|
40
|
+
}
|
|
41
|
+
/** What it was made from (a snapshot's machine, an image's base), if anything. */
|
|
42
|
+
get parentId() {
|
|
43
|
+
return this.info.parentId;
|
|
44
|
+
}
|
|
45
|
+
/** The machine it is attached to now, if any. */
|
|
46
|
+
get attachedTo() {
|
|
47
|
+
return this.info.attachedTo;
|
|
48
|
+
}
|
|
49
|
+
/** When it was made. */
|
|
50
|
+
get createdAt() {
|
|
51
|
+
return this.info.createdAt;
|
|
52
|
+
}
|
|
53
|
+
/** An image's version of its name: each build or keep of a name is its next. */
|
|
54
|
+
get version() {
|
|
55
|
+
return this.info.version;
|
|
56
|
+
}
|
|
57
|
+
/** An image's tags, each `name:tag`. */
|
|
58
|
+
get tags() {
|
|
59
|
+
return this.info.tags;
|
|
60
|
+
}
|
|
61
|
+
/** Why an image's build failed. */
|
|
62
|
+
get error() {
|
|
63
|
+
return this.info.error;
|
|
64
|
+
}
|
|
65
|
+
/** When it was deleted: a delete's answer, its state `deleted`. */
|
|
66
|
+
get deletedAt() {
|
|
67
|
+
return this.info.deletedAt;
|
|
68
|
+
}
|
|
69
|
+
/** When Runtime deletes it (`deleteAfterSeconds`), finally: it can't be undone, as its delete can't; none: kept until deleted. */
|
|
70
|
+
get deleteAt() {
|
|
71
|
+
return this.info.deleteAt;
|
|
72
|
+
}
|
|
73
|
+
/** Once `deleteAt` has passed, what its delete waits for: the App that boots this image, or the machine this volume is attached to, by its ID. It is deleted as soon as that one no longer does. */
|
|
74
|
+
get deleteWaitsFor() {
|
|
75
|
+
return this.info.deleteWaitsFor;
|
|
76
|
+
}
|
|
77
|
+
/** Whether its delete is refused (409 `delete_protected`) until an update turns this off. */
|
|
78
|
+
get deleteProtection() {
|
|
79
|
+
return this.info.deleteProtection;
|
|
80
|
+
}
|
|
81
|
+
/** Makes one and returns it, as `new Runtime().images.create()` does, with a client of its own: `RUNTIME_API_KEY`, or the key `options` names. */
|
|
82
|
+
static async create(input = {}, options = {}) {
|
|
83
|
+
return new Images(new Transport(options)).create(input, options);
|
|
84
|
+
}
|
|
17
85
|
/** Returns an image, by its ID, its name (its newest version) or one of its tags (`name:tag`). */
|
|
18
|
-
async refresh(options) {
|
|
19
|
-
this.info =
|
|
86
|
+
async refresh(query = {}, options) {
|
|
87
|
+
this.info = (await this.#c.get(this.id, query, options)).info;
|
|
20
88
|
return this;
|
|
21
89
|
}
|
|
22
|
-
/** Deletes an image version.
|
|
90
|
+
/** Deletes an image version. Machines already started from it keep running. One an App boots from is refused with image_in_use (409) naming the App. */
|
|
23
91
|
delete(options) {
|
|
24
92
|
return this.#c.delete(this.id, options);
|
|
25
93
|
}
|
|
@@ -27,39 +95,52 @@ export class Image {
|
|
|
27
95
|
logs(query = {}, options) {
|
|
28
96
|
return this.#c.logs(this.id, query, options);
|
|
29
97
|
}
|
|
98
|
+
/** Changes its lifetime (`deleteAfterSeconds`) or delete protection (`deleteProtection`). A lifetime sent again before its end moves the end to that many seconds from now; 0 takes it off. At its end Runtime deletes it as its delete does: final, and it can't be undone. A lifetime and protection are never set together (409 `delete_protected`). Each field left out stays as it is. */
|
|
99
|
+
async update(input = {}, options) {
|
|
100
|
+
this.info = await this.#c.update(this.id, input, options);
|
|
101
|
+
return this;
|
|
102
|
+
}
|
|
103
|
+
/** Deletes it when the `await using` block that holds it ends. */
|
|
104
|
+
async [Symbol.asyncDispose]() {
|
|
105
|
+
await this.delete();
|
|
106
|
+
}
|
|
30
107
|
}
|
|
31
108
|
/** What a machine boots: a root filesystem, its environment and its start. */
|
|
32
109
|
export class Images {
|
|
33
|
-
|
|
110
|
+
transport;
|
|
34
111
|
constructor(transport) {
|
|
35
|
-
this
|
|
112
|
+
this.transport = transport;
|
|
36
113
|
}
|
|
37
114
|
/** Returns an image, by its ID, its name (its newest version) or one of its tags (`name:tag`). */
|
|
38
|
-
async get(id, options) {
|
|
39
|
-
return new Image(this, await this
|
|
115
|
+
async get(id, query = {}, options) {
|
|
116
|
+
return new Image(this, await this.transport.request("GET", `/v2/images/${encodeURIComponent(id)}`, { query: { ...query }, options, idempotent: true }));
|
|
40
117
|
}
|
|
41
118
|
/** Lists the project's images, newest first. */
|
|
42
119
|
list(query = {}, options) {
|
|
43
|
-
return new Paginated((cursor) => this
|
|
120
|
+
return new Paginated((cursor) => this.transport.request("GET", `/v2/images`, { query: { ...query, cursor }, options, idempotent: true }));
|
|
44
121
|
}
|
|
45
122
|
/** Returns which chunks of a build context still need uploading. The chunks it holds count as used, so they are kept for the build that names them: a chunk is kept 24 hours after its last use, and an organization's build context holds at most 200 MiB. */
|
|
46
123
|
missing(input, options) {
|
|
47
|
-
return this
|
|
124
|
+
return this.transport.request("POST", `/v2/images/context:missing`, { body: input, options, idempotent: true });
|
|
48
125
|
}
|
|
49
126
|
/** Uploads one chunk of a build context: the request's bytes, 1 byte to 1 MiB, named by their SHA-256. Asked again, it stores nothing more. */
|
|
50
127
|
put(digest, data, options) {
|
|
51
|
-
return this
|
|
128
|
+
return this.transport.request("PUT", `/v2/images/context/${encodeURIComponent(digest)}`, { data: toBytes(data), options, idempotent: true });
|
|
52
129
|
}
|
|
53
|
-
/** Deletes an image version.
|
|
130
|
+
/** Deletes an image version. Machines already started from it keep running. One an App boots from is refused with image_in_use (409) naming the App. */
|
|
54
131
|
delete(id, options) {
|
|
55
|
-
return this
|
|
132
|
+
return this.transport.request("DELETE", `/v2/images/${encodeURIComponent(id)}`, { options });
|
|
56
133
|
}
|
|
57
134
|
/** Builds an image from an OCI image or a Dockerfile on a machine of its own, and returns it at once, `making`: `ready` once built, else `failed` with `error`. Each build of a name is its next version. Asked again with the same Idempotency-Key, it returns the same one. */
|
|
58
135
|
async create(input = {}, options) {
|
|
59
|
-
return new Image(this, await this
|
|
136
|
+
return new Image(this, await this.transport.request("POST", `/v2/images`, { body: input, options, idempotent: true }));
|
|
60
137
|
}
|
|
61
138
|
/** Returns an image's build log after a line, as the build writes it and once it has ended. */
|
|
62
139
|
logs(id, query = {}, options) {
|
|
63
|
-
return this
|
|
140
|
+
return this.transport.request("GET", `/v2/images/${encodeURIComponent(id)}/logs`, { query: { ...query }, options, idempotent: true });
|
|
141
|
+
}
|
|
142
|
+
/** Changes its lifetime (`deleteAfterSeconds`) or delete protection (`deleteProtection`). A lifetime sent again before its end moves the end to that many seconds from now; 0 takes it off. At its end Runtime deletes it as its delete does: final, and it can't be undone. A lifetime and protection are never set together (409 `delete_protected`). Each field left out stays as it is. */
|
|
143
|
+
update(id, input = {}, options) {
|
|
144
|
+
return this.transport.request("POST", `/v2/images/${encodeURIComponent(id)}:update`, { body: input, options, idempotent: true });
|
|
64
145
|
}
|
|
65
146
|
}
|
|
@@ -14,6 +14,9 @@ import { Containers } from "./containers.js";
|
|
|
14
14
|
import { Builds } from "./builds.js";
|
|
15
15
|
import { Jobs } from "./jobs.js";
|
|
16
16
|
import { JobRuns } from "./jobRuns.js";
|
|
17
|
+
import { Agents } from "./agents.js";
|
|
18
|
+
import { AgentSessions } from "./agentSessions.js";
|
|
19
|
+
import { Messages } from "./messages.js";
|
|
17
20
|
import { Snapshots } from "./snapshots.js";
|
|
18
21
|
import { Images } from "./images.js";
|
|
19
22
|
import { Volumes } from "./volumes.js";
|
|
@@ -50,6 +53,9 @@ export * from "./containers.js";
|
|
|
50
53
|
export * from "./builds.js";
|
|
51
54
|
export * from "./jobs.js";
|
|
52
55
|
export * from "./jobRuns.js";
|
|
56
|
+
export * from "./agents.js";
|
|
57
|
+
export * from "./agentSessions.js";
|
|
58
|
+
export * from "./messages.js";
|
|
53
59
|
export * from "./snapshots.js";
|
|
54
60
|
export * from "./images.js";
|
|
55
61
|
export * from "./volumes.js";
|
|
@@ -110,6 +116,9 @@ export declare class Runtime {
|
|
|
110
116
|
readonly builds: Builds;
|
|
111
117
|
readonly jobs: Jobs;
|
|
112
118
|
readonly jobRuns: JobRuns;
|
|
119
|
+
readonly agents: Agents;
|
|
120
|
+
readonly agentSessions: AgentSessions;
|
|
121
|
+
readonly messages: Messages;
|
|
113
122
|
readonly snapshots: Snapshots;
|
|
114
123
|
readonly images: Images;
|
|
115
124
|
readonly volumes: Volumes;
|
package/dist/generated/index.js
CHANGED
|
@@ -16,6 +16,9 @@ import { Containers } from "./containers.js";
|
|
|
16
16
|
import { Builds } from "./builds.js";
|
|
17
17
|
import { Jobs } from "./jobs.js";
|
|
18
18
|
import { JobRuns } from "./jobRuns.js";
|
|
19
|
+
import { Agents } from "./agents.js";
|
|
20
|
+
import { AgentSessions } from "./agentSessions.js";
|
|
21
|
+
import { Messages } from "./messages.js";
|
|
19
22
|
import { Snapshots } from "./snapshots.js";
|
|
20
23
|
import { Images } from "./images.js";
|
|
21
24
|
import { Volumes } from "./volumes.js";
|
|
@@ -52,6 +55,9 @@ export * from "./containers.js";
|
|
|
52
55
|
export * from "./builds.js";
|
|
53
56
|
export * from "./jobs.js";
|
|
54
57
|
export * from "./jobRuns.js";
|
|
58
|
+
export * from "./agents.js";
|
|
59
|
+
export * from "./agentSessions.js";
|
|
60
|
+
export * from "./messages.js";
|
|
55
61
|
export * from "./snapshots.js";
|
|
56
62
|
export * from "./images.js";
|
|
57
63
|
export * from "./volumes.js";
|
|
@@ -93,6 +99,9 @@ export class Runtime {
|
|
|
93
99
|
builds;
|
|
94
100
|
jobs;
|
|
95
101
|
jobRuns;
|
|
102
|
+
agents;
|
|
103
|
+
agentSessions;
|
|
104
|
+
messages;
|
|
96
105
|
snapshots;
|
|
97
106
|
images;
|
|
98
107
|
volumes;
|
|
@@ -130,6 +139,9 @@ export class Runtime {
|
|
|
130
139
|
this.builds = new Builds(this.transport);
|
|
131
140
|
this.jobs = new Jobs(this.transport);
|
|
132
141
|
this.jobRuns = new JobRuns(this.transport);
|
|
142
|
+
this.agents = new Agents(this.transport);
|
|
143
|
+
this.agentSessions = new AgentSessions(this.transport);
|
|
144
|
+
this.messages = new Messages(this.transport);
|
|
133
145
|
this.snapshots = new Snapshots(this.transport);
|
|
134
146
|
this.images = new Images(this.transport);
|
|
135
147
|
this.volumes = new Volumes(this.transport);
|
|
@@ -48,6 +48,13 @@ export type JobRunListQuery = {
|
|
|
48
48
|
/** The most items the page holds. At least 1. At most 200. Default: 50. */
|
|
49
49
|
limit?: number;
|
|
50
50
|
};
|
|
51
|
+
/** What get takes in its query. */
|
|
52
|
+
export type JobRunGetQuery = {
|
|
53
|
+
/** 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. */
|
|
54
|
+
wait?: number;
|
|
55
|
+
/** The state the caller last read, which `wait` waits for it to leave. */
|
|
56
|
+
ifState?: string;
|
|
57
|
+
};
|
|
51
58
|
/** What output takes in its query. */
|
|
52
59
|
export type JobRunOutputQuery = {
|
|
53
60
|
/** Output after this byte. At least 0. Default: 0. */
|
|
@@ -57,12 +64,12 @@ export type JobRunOutputQuery = {
|
|
|
57
64
|
};
|
|
58
65
|
/** One run of a job: a machine made at one of its times, deleted when its command ends. Its record (exit code, times, the last 256 KiB of its output) stays readable for 7 days after. */
|
|
59
66
|
export declare class JobRuns {
|
|
60
|
-
|
|
67
|
+
readonly transport: Transport;
|
|
61
68
|
constructor(transport: Transport);
|
|
62
69
|
/** Lists a job's runs, oldest first unless `order` is `newest`, deleted ones included while their records are kept. */
|
|
63
|
-
list(query: JobRunListQuery, options?: RequestOptions): Paginated<JobRun>;
|
|
70
|
+
list(query: JobRunListQuery & RequestOptions, options?: RequestOptions): Paginated<JobRun>;
|
|
64
71
|
/** Returns a run. */
|
|
65
|
-
get(id: string, options?: RequestOptions): Promise<JobRun>;
|
|
72
|
+
get(id: string, query?: JobRunGetQuery & RequestOptions, options?: RequestOptions): Promise<JobRun>;
|
|
66
73
|
/** Returns a run's output after a cursor, stdout and stderr together in the order written, and the cursor to read on from. Its last 256 KiB are kept; truncated says when the cursor fell before them. */
|
|
67
|
-
output(id: string, query?: JobRunOutputQuery, options?: RequestOptions): Promise<JobRunOutput>;
|
|
74
|
+
output(id: string, query?: JobRunOutputQuery & RequestOptions, options?: RequestOptions): Promise<JobRunOutput>;
|
|
68
75
|
}
|
|
@@ -3,20 +3,20 @@
|
|
|
3
3
|
import { Paginated } from "./runtime.js";
|
|
4
4
|
/** One run of a job: a machine made at one of its times, deleted when its command ends. Its record (exit code, times, the last 256 KiB of its output) stays readable for 7 days after. */
|
|
5
5
|
export class JobRuns {
|
|
6
|
-
|
|
6
|
+
transport;
|
|
7
7
|
constructor(transport) {
|
|
8
|
-
this
|
|
8
|
+
this.transport = transport;
|
|
9
9
|
}
|
|
10
10
|
/** Lists a job's runs, oldest first unless `order` is `newest`, deleted ones included while their records are kept. */
|
|
11
11
|
list(query, options) {
|
|
12
|
-
return new Paginated((cursor) => this
|
|
12
|
+
return new Paginated((cursor) => this.transport.request("GET", `/v2/job-runs`, { query: { ...query, cursor }, options, idempotent: true }));
|
|
13
13
|
}
|
|
14
14
|
/** Returns a run. */
|
|
15
|
-
get(id, options) {
|
|
16
|
-
return this
|
|
15
|
+
get(id, query = {}, options) {
|
|
16
|
+
return this.transport.request("GET", `/v2/job-runs/${encodeURIComponent(id)}`, { query: { ...query }, options, idempotent: true });
|
|
17
17
|
}
|
|
18
18
|
/** Returns a run's output after a cursor, stdout and stderr together in the order written, and the cursor to read on from. Its last 256 KiB are kept; truncated says when the cursor fell before them. */
|
|
19
19
|
output(id, query = {}, options) {
|
|
20
|
-
return this
|
|
20
|
+
return this.transport.request("GET", `/v2/job-runs/${encodeURIComponent(id)}/output`, { query: { ...query }, options, idempotent: true });
|
|
21
21
|
}
|
|
22
22
|
}
|
package/dist/generated/jobs.d.ts
CHANGED
|
@@ -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
|
import type { SandboxRun } from "./sandboxes.js";
|
|
4
4
|
import type { VolumeMount } from "./sandboxes.js";
|
|
5
5
|
/** When a job runs: once, at `at`; or at each time of its `cron` in its `timezone`. One of the two. */
|
|
@@ -35,11 +35,11 @@ export interface JobSettings {
|
|
|
35
35
|
retry?: JobRetry;
|
|
36
36
|
/** Which of its org's secrets each run gets; every one whose scope admits it when omitted. */
|
|
37
37
|
secrets?: JobSecrets;
|
|
38
|
-
/** Each run's vCPUs
|
|
38
|
+
/** Each run's vCPUs; a job's default (1) when omitted. At least 1. */
|
|
39
39
|
vcpu?: number;
|
|
40
|
-
/** Each run's memory in GB (1 GB is 1,024 MiB); a fraction is taken to the MiB (`0.5`).
|
|
40
|
+
/** Each run's memory in GB (1 GB is 1,024 MiB); a fraction is taken to the MiB (`0.5`). A job's default (1) when omitted. At least 1. */
|
|
41
41
|
memoryGB?: number;
|
|
42
|
-
/** Each run's disk in GB, to the MiB, over a fresh copy of its image. At least 1.
|
|
42
|
+
/** Each run's disk in GB, to the MiB, over a fresh copy of its image. When omitted, a job's default (4) or its image's size, whichever is larger. At least 1. */
|
|
43
43
|
diskGB?: number;
|
|
44
44
|
/** The image each run boots, by name (its newest version), `name:version` or ID; Runtime's default image when omitted. */
|
|
45
45
|
image?: string;
|
|
@@ -93,6 +93,13 @@ export interface JobInfo extends JobSettings {
|
|
|
93
93
|
/** When it was deleted: a delete's answer, its state `deleted`. */
|
|
94
94
|
deletedAt?: string;
|
|
95
95
|
}
|
|
96
|
+
/** What get takes in its query. */
|
|
97
|
+
export type JobGetQuery = {
|
|
98
|
+
/** 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. */
|
|
99
|
+
wait?: number;
|
|
100
|
+
/** The state the caller last read, which `wait` waits for it to leave. */
|
|
101
|
+
ifState?: string;
|
|
102
|
+
};
|
|
96
103
|
/** What list takes in its query. */
|
|
97
104
|
export type JobListQuery = {
|
|
98
105
|
/** Only those with every label given (repeat it for several): key:value, or a key for any value. */
|
|
@@ -108,8 +115,48 @@ export declare class Job {
|
|
|
108
115
|
constructor(client: Jobs, info: JobInfo);
|
|
109
116
|
/** Its id. */
|
|
110
117
|
get id(): string;
|
|
118
|
+
/** When it runs. */
|
|
119
|
+
get schedule(): JobSchedule | undefined;
|
|
120
|
+
/** How a failed run is run again; never when omitted. */
|
|
121
|
+
get retry(): JobRetry | undefined;
|
|
122
|
+
/** Which of its org's secrets each run gets; every one whose scope admits it when omitted. */
|
|
123
|
+
get secrets(): JobSecrets | undefined;
|
|
124
|
+
/** Each run's vCPUs; a job's default (1) when omitted. At least 1. */
|
|
125
|
+
get vcpu(): number | undefined;
|
|
126
|
+
/** Each run's memory in GB (1 GB is 1,024 MiB); a fraction is taken to the MiB (`0.5`). A job's default (1) when omitted. At least 1. */
|
|
127
|
+
get memoryGB(): number | undefined;
|
|
128
|
+
/** Each run's disk in GB, to the MiB, over a fresh copy of its image. When omitted, a job's default (4) or its image's size, whichever is larger. At least 1. */
|
|
129
|
+
get diskGB(): number | undefined;
|
|
130
|
+
/** The image each run boots, by name (its newest version), `name:version` or ID; Runtime's default image when omitted. */
|
|
131
|
+
get image(): string | undefined;
|
|
132
|
+
/** Who its command runs as: `runtime` (uid 1000, with passwordless sudo) or `root`. Its image's when omitted, else `runtime`. */
|
|
133
|
+
get user(): "runtime" | "root" | (string & {}) | undefined;
|
|
134
|
+
/** Volumes each run attaches and mounts, at most one, in the job's project; a run waits while another machine holds it. */
|
|
135
|
+
get volumes(): VolumeMount[] | undefined;
|
|
136
|
+
/** The most one run may cost, in US dollars (`"0.50"`): a run pauses once it has cost that, as a machine at its maxCost does. */
|
|
137
|
+
get maxCost(): string | undefined;
|
|
138
|
+
/** Always `job`. */
|
|
139
|
+
get object(): "job" | (string & {});
|
|
140
|
+
/** Its name, unique in its project. */
|
|
141
|
+
get name(): string | undefined;
|
|
142
|
+
/** Where it is: `scheduled` (its runs are made at their times), `paused` (none is), `finished` (its one time ran). */
|
|
143
|
+
get state(): "scheduled" | "paused" | "finished" | "deleted" | (string & {});
|
|
144
|
+
/** Its labels. */
|
|
145
|
+
get labels(): Record<string, string>;
|
|
146
|
+
/** When its next run is made, or its next retry; none when paused or finished. */
|
|
147
|
+
get nextRunAt(): string | undefined;
|
|
148
|
+
/** Why its last time's run was not made, when it was refused: that time failed and it waits for its next; none once a run is made. */
|
|
149
|
+
get lastError(): JobError | undefined;
|
|
150
|
+
/** When it was created. */
|
|
151
|
+
get createdAt(): string | undefined;
|
|
152
|
+
/** Its revision, changed by every change to it. */
|
|
153
|
+
get revision(): number | undefined;
|
|
154
|
+
/** When it was deleted: a delete's answer, its state `deleted`. */
|
|
155
|
+
get deletedAt(): string | undefined;
|
|
156
|
+
/** Makes one and returns it, as `new Runtime().jobs.create()` does, with a client of its own: `RUNTIME_API_KEY`, or the key `options` names. */
|
|
157
|
+
static create(input?: JobCreate, options?: ClientOptions & RequestOptions): Promise<Job>;
|
|
111
158
|
/** Returns a job. */
|
|
112
|
-
refresh(options?: RequestOptions): Promise<this>;
|
|
159
|
+
refresh(query?: JobGetQuery & RequestOptions, options?: RequestOptions): Promise<this>;
|
|
113
160
|
/** Deletes a job: no run is made from then on, and a run in flight is ended. Its runs' records stay readable for 7 days. */
|
|
114
161
|
delete(options?: RequestOptions): Promise<JobInfo>;
|
|
115
162
|
/** Pauses a job: no run is made at its times until it is resumed. A run in flight runs to its end. */
|
|
@@ -120,17 +167,19 @@ export declare class Job {
|
|
|
120
167
|
update(input?: JobSettings, options?: RequestOptions): Promise<this>;
|
|
121
168
|
/** Makes a run now, beside its schedule; a paused job stays paused. Refused 409 while a run of it is in flight. Asked again with the same Idempotency-Key, it makes nothing more. */
|
|
122
169
|
run(options?: RequestOptions): Promise<this>;
|
|
170
|
+
/** Deletes it when the `await using` block that holds it ends. */
|
|
171
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
123
172
|
}
|
|
124
173
|
/** A command run in a fresh machine, once or on a cron schedule in a timezone. Each run is a machine made at its time, deleted when its command ends, and billed as any machine is; its exit code and its last 256 KiB of output are kept. Runs of one job never overlap: a time that comes while one runs is made once it ends, and times missed make one run. */
|
|
125
174
|
export declare class Jobs {
|
|
126
|
-
|
|
175
|
+
readonly transport: Transport;
|
|
127
176
|
constructor(transport: Transport);
|
|
128
177
|
/** Creates a job. Its first run is made at its schedule's first time. Asked again with the same Idempotency-Key, it returns the same job. */
|
|
129
178
|
create(input?: JobCreate, options?: RequestOptions): Promise<Job>;
|
|
130
179
|
/** Returns a job. */
|
|
131
|
-
get(id: string, options?: RequestOptions): Promise<Job>;
|
|
180
|
+
get(id: string, query?: JobGetQuery & RequestOptions, options?: RequestOptions): Promise<Job>;
|
|
132
181
|
/** Lists the project's jobs, newest first. */
|
|
133
|
-
list(query?: JobListQuery, options?: RequestOptions): Paginated<JobInfo>;
|
|
182
|
+
list(query?: JobListQuery & RequestOptions, options?: RequestOptions): Paginated<JobInfo>;
|
|
134
183
|
/** Deletes a job: no run is made from then on, and a run in flight is ended. Its runs' records stay readable for 7 days. */
|
|
135
184
|
delete(id: string, options?: RequestOptions): Promise<JobInfo>;
|
|
136
185
|
/** Pauses a job: no run is made at its times until it is resumed. A run in flight runs to its end. */
|
package/dist/generated/jobs.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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
4
|
/** One of jobs: A command run in a fresh machine, once or on a cron schedule in a timezone. Each run is a machine made at its time, deleted when its command ends, and billed as any machine is; its exit code and its last 256 KiB of output are kept. Runs of one job never overlap: a time that comes while one runs is made once it ends, and times missed make one run. */
|
|
5
5
|
export class Job {
|
|
6
6
|
#c;
|
|
@@ -14,9 +14,89 @@ export class Job {
|
|
|
14
14
|
get id() {
|
|
15
15
|
return this.info.id;
|
|
16
16
|
}
|
|
17
|
+
/** When it runs. */
|
|
18
|
+
get schedule() {
|
|
19
|
+
return this.info.schedule;
|
|
20
|
+
}
|
|
21
|
+
/** How a failed run is run again; never when omitted. */
|
|
22
|
+
get retry() {
|
|
23
|
+
return this.info.retry;
|
|
24
|
+
}
|
|
25
|
+
/** Which of its org's secrets each run gets; every one whose scope admits it when omitted. */
|
|
26
|
+
get secrets() {
|
|
27
|
+
return this.info.secrets;
|
|
28
|
+
}
|
|
29
|
+
/** Each run's vCPUs; a job's default (1) when omitted. At least 1. */
|
|
30
|
+
get vcpu() {
|
|
31
|
+
return this.info.vcpu;
|
|
32
|
+
}
|
|
33
|
+
/** Each run's memory in GB (1 GB is 1,024 MiB); a fraction is taken to the MiB (`0.5`). A job's default (1) when omitted. At least 1. */
|
|
34
|
+
get memoryGB() {
|
|
35
|
+
return this.info.memoryGB;
|
|
36
|
+
}
|
|
37
|
+
/** Each run's disk in GB, to the MiB, over a fresh copy of its image. When omitted, a job's default (4) or its image's size, whichever is larger. At least 1. */
|
|
38
|
+
get diskGB() {
|
|
39
|
+
return this.info.diskGB;
|
|
40
|
+
}
|
|
41
|
+
/** The image each run boots, by name (its newest version), `name:version` or ID; Runtime's default image when omitted. */
|
|
42
|
+
get image() {
|
|
43
|
+
return this.info.image;
|
|
44
|
+
}
|
|
45
|
+
/** Who its command runs as: `runtime` (uid 1000, with passwordless sudo) or `root`. Its image's when omitted, else `runtime`. */
|
|
46
|
+
get user() {
|
|
47
|
+
return this.info.user;
|
|
48
|
+
}
|
|
49
|
+
/** Volumes each run attaches and mounts, at most one, in the job's project; a run waits while another machine holds it. */
|
|
50
|
+
get volumes() {
|
|
51
|
+
return this.info.volumes;
|
|
52
|
+
}
|
|
53
|
+
/** The most one run may cost, in US dollars (`"0.50"`): a run pauses once it has cost that, as a machine at its maxCost does. */
|
|
54
|
+
get maxCost() {
|
|
55
|
+
return this.info.maxCost;
|
|
56
|
+
}
|
|
57
|
+
/** Always `job`. */
|
|
58
|
+
get object() {
|
|
59
|
+
return this.info.object;
|
|
60
|
+
}
|
|
61
|
+
/** Its name, unique in its project. */
|
|
62
|
+
get name() {
|
|
63
|
+
return this.info.name;
|
|
64
|
+
}
|
|
65
|
+
/** Where it is: `scheduled` (its runs are made at their times), `paused` (none is), `finished` (its one time ran). */
|
|
66
|
+
get state() {
|
|
67
|
+
return this.info.state;
|
|
68
|
+
}
|
|
69
|
+
/** Its labels. */
|
|
70
|
+
get labels() {
|
|
71
|
+
return this.info.labels;
|
|
72
|
+
}
|
|
73
|
+
/** When its next run is made, or its next retry; none when paused or finished. */
|
|
74
|
+
get nextRunAt() {
|
|
75
|
+
return this.info.nextRunAt;
|
|
76
|
+
}
|
|
77
|
+
/** Why its last time's run was not made, when it was refused: that time failed and it waits for its next; none once a run is made. */
|
|
78
|
+
get lastError() {
|
|
79
|
+
return this.info.lastError;
|
|
80
|
+
}
|
|
81
|
+
/** When it was created. */
|
|
82
|
+
get createdAt() {
|
|
83
|
+
return this.info.createdAt;
|
|
84
|
+
}
|
|
85
|
+
/** Its revision, changed by every change to it. */
|
|
86
|
+
get revision() {
|
|
87
|
+
return this.info.revision;
|
|
88
|
+
}
|
|
89
|
+
/** When it was deleted: a delete's answer, its state `deleted`. */
|
|
90
|
+
get deletedAt() {
|
|
91
|
+
return this.info.deletedAt;
|
|
92
|
+
}
|
|
93
|
+
/** Makes one and returns it, as `new Runtime().jobs.create()` does, with a client of its own: `RUNTIME_API_KEY`, or the key `options` names. */
|
|
94
|
+
static async create(input = {}, options = {}) {
|
|
95
|
+
return new Jobs(new Transport(options)).create(input, options);
|
|
96
|
+
}
|
|
17
97
|
/** Returns a job. */
|
|
18
|
-
async refresh(options) {
|
|
19
|
-
this.info =
|
|
98
|
+
async refresh(query = {}, options) {
|
|
99
|
+
this.info = (await this.#c.get(this.id, query, options)).info;
|
|
20
100
|
return this;
|
|
21
101
|
}
|
|
22
102
|
/** Deletes a job: no run is made from then on, and a run in flight is ended. Its runs' records stay readable for 7 days. */
|
|
@@ -43,43 +123,47 @@ export class Job {
|
|
|
43
123
|
this.info = await this.#c.run(this.id, options);
|
|
44
124
|
return this;
|
|
45
125
|
}
|
|
126
|
+
/** Deletes it when the `await using` block that holds it ends. */
|
|
127
|
+
async [Symbol.asyncDispose]() {
|
|
128
|
+
await this.delete();
|
|
129
|
+
}
|
|
46
130
|
}
|
|
47
131
|
/** A command run in a fresh machine, once or on a cron schedule in a timezone. Each run is a machine made at its time, deleted when its command ends, and billed as any machine is; its exit code and its last 256 KiB of output are kept. Runs of one job never overlap: a time that comes while one runs is made once it ends, and times missed make one run. */
|
|
48
132
|
export class Jobs {
|
|
49
|
-
|
|
133
|
+
transport;
|
|
50
134
|
constructor(transport) {
|
|
51
|
-
this
|
|
135
|
+
this.transport = transport;
|
|
52
136
|
}
|
|
53
137
|
/** Creates a job. Its first run is made at its schedule's first time. Asked again with the same Idempotency-Key, it returns the same job. */
|
|
54
138
|
async create(input = {}, options) {
|
|
55
|
-
return new Job(this, await this
|
|
139
|
+
return new Job(this, await this.transport.request("POST", `/v2/jobs`, { body: input, options, idempotent: true }));
|
|
56
140
|
}
|
|
57
141
|
/** Returns a job. */
|
|
58
|
-
async get(id, options) {
|
|
59
|
-
return new Job(this, await this
|
|
142
|
+
async get(id, query = {}, options) {
|
|
143
|
+
return new Job(this, await this.transport.request("GET", `/v2/jobs/${encodeURIComponent(id)}`, { query: { ...query }, options, idempotent: true }));
|
|
60
144
|
}
|
|
61
145
|
/** Lists the project's jobs, newest first. */
|
|
62
146
|
list(query = {}, options) {
|
|
63
|
-
return new Paginated((cursor) => this
|
|
147
|
+
return new Paginated((cursor) => this.transport.request("GET", `/v2/jobs`, { query: { ...query, cursor }, options, idempotent: true }));
|
|
64
148
|
}
|
|
65
149
|
/** Deletes a job: no run is made from then on, and a run in flight is ended. Its runs' records stay readable for 7 days. */
|
|
66
150
|
delete(id, options) {
|
|
67
|
-
return this
|
|
151
|
+
return this.transport.request("DELETE", `/v2/jobs/${encodeURIComponent(id)}`, { options, idempotent: true });
|
|
68
152
|
}
|
|
69
153
|
/** Pauses a job: no run is made at its times until it is resumed. A run in flight runs to its end. */
|
|
70
154
|
pause(id, options) {
|
|
71
|
-
return this
|
|
155
|
+
return this.transport.request("POST", `/v2/jobs/${encodeURIComponent(id)}:pause`, { options, idempotent: true });
|
|
72
156
|
}
|
|
73
157
|
/** Resumes a paused job: its next run is made at its schedule's next time from now. */
|
|
74
158
|
resume(id, options) {
|
|
75
|
-
return this
|
|
159
|
+
return this.transport.request("POST", `/v2/jobs/${encodeURIComponent(id)}:resume`, { options, idempotent: true });
|
|
76
160
|
}
|
|
77
161
|
/** Changes a job's settings: each one named replaces its own, the rest are kept. Runs made from then on use them; one in flight runs as it was made. A new schedule's next run is at its next time from now. */
|
|
78
162
|
update(id, input = {}, options) {
|
|
79
|
-
return this
|
|
163
|
+
return this.transport.request("POST", `/v2/jobs/${encodeURIComponent(id)}:update`, { body: input, options, idempotent: true });
|
|
80
164
|
}
|
|
81
165
|
/** Makes a run now, beside its schedule; a paused job stays paused. Refused 409 while a run of it is in flight. Asked again with the same Idempotency-Key, it makes nothing more. */
|
|
82
166
|
run(id, options) {
|
|
83
|
-
return this
|
|
167
|
+
return this.transport.request("POST", `/v2/jobs/${encodeURIComponent(id)}:run`, { options, idempotent: true });
|
|
84
168
|
}
|
|
85
169
|
}
|
package/dist/generated/keys.d.ts
CHANGED
|
@@ -24,11 +24,11 @@ export interface Key {
|
|
|
24
24
|
lastUsedAt?: string;
|
|
25
25
|
/** The most one request made with it commits, in US dollars. */
|
|
26
26
|
maxCost?: string;
|
|
27
|
-
/** The most the
|
|
27
|
+
/** The most the machines made with it, with those of every key made with it, may spend over spendCapWindowSeconds, in US dollars. */
|
|
28
28
|
spendCap?: string;
|
|
29
29
|
/** The rolling window spendCap counts over, in seconds. */
|
|
30
30
|
spendCapWindowSeconds?: number;
|
|
31
|
-
/** What it spent over spendCapWindowSeconds (the last 24 hours when it has no spendCap), in US dollars, as spendCap counts it: its
|
|
31
|
+
/** What it spent over spendCapWindowSeconds (the last 24 hours when it has no spendCap), in US dollars, as spendCap counts it: its machines' and those of every key made with it. Listed and updated keys only. */
|
|
32
32
|
spent?: string;
|
|
33
33
|
/** When it was revoked: a delete's answer, its state `deleted`. */
|
|
34
34
|
deletedAt?: string;
|
|
@@ -52,11 +52,13 @@ export interface KeyCreate {
|
|
|
52
52
|
projectId?: string;
|
|
53
53
|
/** One of the organization's agents or CI pipelines it acts as, for the caller; the caller itself when omitted. */
|
|
54
54
|
agentId?: string;
|
|
55
|
+
/** The actions it holds, each `product:action` as each call's reference page names it (`sandboxes:create`, `sandboxes:exec`), on every plan: it acts as an agent of its own granted exactly these, never more than its caller may do or spend, in every project its caller reaches (one held to one project, with projectId or by a caller that reaches one alone, starts at Growth), and its agent and role are deleted with it. Omitted, it holds every action its holder's grant allows, or, made with a key that has actions, those actions. Not with agentId. */
|
|
56
|
+
actions?: string[];
|
|
55
57
|
/** Seconds until it stops working; never when omitted. At least 60. At most 31536000. */
|
|
56
58
|
expiresInSeconds?: number;
|
|
57
59
|
/** The most one request made with it may commit, in US dollars (`"5.00"`): one asking more is refused 403, and a create that names no maxCost gets this one. Made with a key that has one, at most that key's. */
|
|
58
60
|
maxCost?: string;
|
|
59
|
-
/** The most the
|
|
61
|
+
/** The most the machines made with it, with those of every key made with it, may spend over spendCapWindowSeconds, in US dollars, as billed: once reached, a create is refused 403 until the window passes it, and a create that names no maxCost gets what is left as its maxCost. Running machines may pass it. Made with a key that has one, at most that key's, and counted in it too. */
|
|
60
62
|
spendCap?: string;
|
|
61
63
|
/** The rolling window spendCap counts over, in seconds; a day when omitted. At least 60. At most 2592000. */
|
|
62
64
|
spendCapWindowSeconds?: number;
|
|
@@ -78,7 +80,7 @@ export interface KeyUpdate {
|
|
|
78
80
|
name?: string;
|
|
79
81
|
/** The most one request made with it may commit, in US dollars (`"5.00"`). Never more than a key it was made with, nor than the key that changes it: a key never raises its own caps. */
|
|
80
82
|
maxCost?: string;
|
|
81
|
-
/** The most the
|
|
83
|
+
/** The most the machines made with it, with those of every key made with it, may spend over spendCapWindowSeconds, in US dollars, as billed. Never more than a key it was made with, nor than the key that changes it. */
|
|
82
84
|
spendCap?: string;
|
|
83
85
|
/** The rolling window spendCap counts over, in seconds; kept when omitted, a day for a key that had no spendCap. At least 60. At most 2592000. */
|
|
84
86
|
spendCapWindowSeconds?: number;
|
|
@@ -92,10 +94,10 @@ export type KeyListQuery = {
|
|
|
92
94
|
};
|
|
93
95
|
/** An API key: what a program, an agent or a CI pipeline calls the API with, acting as the person or agent who made it and never reaching more. Its secret is shown once, when it is made. */
|
|
94
96
|
export declare class Keys {
|
|
95
|
-
|
|
97
|
+
readonly transport: Transport;
|
|
96
98
|
constructor(transport: Transport);
|
|
97
99
|
/** Lists the organization's live keys, newest first, without their secrets: every key for an owner or an admin, the caller's own otherwise. */
|
|
98
|
-
list(query?: KeyListQuery, options?: RequestOptions): Paginated<Key>;
|
|
100
|
+
list(query?: KeyListQuery & RequestOptions, options?: RequestOptions): Paginated<Key>;
|
|
99
101
|
/** 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. */
|
|
100
102
|
create(input: KeyCreate, options?: RequestOptions): Promise<KeyCreated>;
|
|
101
103
|
/** 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. */
|
package/dist/generated/keys.js
CHANGED
|
@@ -3,24 +3,24 @@
|
|
|
3
3
|
import { Paginated } from "./runtime.js";
|
|
4
4
|
/** An API key: what a program, an agent or a CI pipeline calls the API with, acting as the person or agent who made it and never reaching more. Its secret is shown once, when it is made. */
|
|
5
5
|
export class Keys {
|
|
6
|
-
|
|
6
|
+
transport;
|
|
7
7
|
constructor(transport) {
|
|
8
|
-
this
|
|
8
|
+
this.transport = transport;
|
|
9
9
|
}
|
|
10
10
|
/** Lists the organization's live keys, newest first, without their secrets: every key for an owner or an admin, the caller's own otherwise. */
|
|
11
11
|
list(query = {}, options) {
|
|
12
|
-
return new Paginated((cursor) => this
|
|
12
|
+
return new Paginated((cursor) => this.transport.request("GET", `/v2/keys`, { query: { ...query, cursor }, options, idempotent: true }));
|
|
13
13
|
}
|
|
14
14
|
/** 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. */
|
|
15
15
|
create(input, options) {
|
|
16
|
-
return this
|
|
16
|
+
return this.transport.request("POST", `/v2/keys`, { body: input, options });
|
|
17
17
|
}
|
|
18
18
|
/** 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
19
|
update(id, input = {}, options) {
|
|
20
|
-
return this
|
|
20
|
+
return this.transport.request("POST", `/v2/keys/${encodeURIComponent(id)}:update`, { body: input, options, idempotent: true });
|
|
21
21
|
}
|
|
22
22
|
/** 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. */
|
|
23
23
|
delete(id, options) {
|
|
24
|
-
return this
|
|
24
|
+
return this.transport.request("DELETE", `/v2/keys/${encodeURIComponent(id)}`, { options, idempotent: true });
|
|
25
25
|
}
|
|
26
26
|
}
|