@dagger.io/dagger 0.3.0 → 0.3.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/README.md +72 -1
- package/dist/api/client.gen.d.ts +220 -128
- package/dist/api/client.gen.d.ts.map +1 -1
- package/dist/api/client.gen.js +280 -154
- package/dist/api/utils.d.ts +1 -1
- package/dist/api/utils.d.ts.map +1 -1
- package/dist/api/utils.js +43 -41
- package/dist/common/errors/DaggerSDKError.d.ts +4 -3
- package/dist/common/errors/DaggerSDKError.d.ts.map +1 -1
- package/dist/common/errors/DockerImageRefValidationError.d.ts +2 -2
- package/dist/common/errors/DockerImageRefValidationError.d.ts.map +1 -1
- package/dist/common/errors/DockerImageRefValidationError.js +3 -2
- package/dist/common/errors/EngineSessionConnectParamsParseError.d.ts +21 -0
- package/dist/common/errors/EngineSessionConnectParamsParseError.d.ts.map +1 -0
- package/dist/common/errors/EngineSessionConnectParamsParseError.js +16 -0
- package/dist/common/errors/EngineSessionConnectionTimeoutError.d.ts +21 -0
- package/dist/common/errors/EngineSessionConnectionTimeoutError.d.ts.map +1 -0
- package/dist/common/errors/EngineSessionConnectionTimeoutError.js +16 -0
- package/dist/common/errors/EngineSessionEOFErrorOptions.d.ts +16 -0
- package/dist/common/errors/EngineSessionEOFErrorOptions.d.ts.map +1 -0
- package/dist/common/errors/EngineSessionEOFErrorOptions.js +16 -0
- package/dist/common/errors/GraphQLRequestError.d.ts +2 -2
- package/dist/common/errors/GraphQLRequestError.d.ts.map +1 -1
- package/dist/common/errors/GraphQLRequestError.js +3 -2
- package/dist/common/errors/InitEngineSessionBinaryError.d.ts +2 -2
- package/dist/common/errors/InitEngineSessionBinaryError.d.ts.map +1 -1
- package/dist/common/errors/InitEngineSessionBinaryError.js +3 -2
- package/dist/common/errors/TooManyNestedObjectsError.d.ts +2 -2
- package/dist/common/errors/TooManyNestedObjectsError.d.ts.map +1 -1
- package/dist/common/errors/TooManyNestedObjectsError.js +3 -2
- package/dist/common/errors/UnknownDaggerError.d.ts +2 -2
- package/dist/common/errors/UnknownDaggerError.d.ts.map +1 -1
- package/dist/common/errors/UnknownDaggerError.js +3 -2
- package/dist/common/errors/errors-codes.d.ts +43 -0
- package/dist/common/errors/errors-codes.d.ts.map +1 -0
- package/dist/common/errors/errors-codes.js +35 -0
- package/dist/common/errors/index.d.ts +4 -1
- package/dist/common/errors/index.d.ts.map +1 -1
- package/dist/common/errors/index.js +4 -1
- package/dist/common/utils.d.ts +3 -3
- package/dist/connect.d.ts +24 -1
- package/dist/connect.d.ts.map +1 -1
- package/dist/connect.js +29 -5
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/provisioning/{docker-provision/image.d.ts → bin.d.ts} +31 -29
- package/dist/provisioning/bin.d.ts.map +1 -0
- package/dist/provisioning/bin.js +328 -0
- package/dist/provisioning/default.d.ts +1 -1
- package/dist/provisioning/default.d.ts.map +1 -1
- package/dist/provisioning/default.js +1 -2
- package/dist/provisioning/engineconn.d.ts +1 -1
- package/dist/provisioning/engineconn.d.ts.map +1 -1
- package/dist/provisioning/index.d.ts +1 -2
- package/dist/provisioning/index.d.ts.map +1 -1
- package/dist/provisioning/index.js +1 -2
- package/package.json +18 -11
- package/dist/common/errors/EngineSessionPortParseError.d.ts +0 -25
- package/dist/common/errors/EngineSessionPortParseError.d.ts.map +0 -1
- package/dist/common/errors/EngineSessionPortParseError.js +0 -20
- package/dist/provisioning/bin/bin.d.ts +0 -21
- package/dist/provisioning/bin/bin.d.ts.map +0 -1
- package/dist/provisioning/bin/bin.js +0 -116
- package/dist/provisioning/bin/index.d.ts +0 -2
- package/dist/provisioning/bin/index.d.ts.map +0 -1
- package/dist/provisioning/bin/index.js +0 -1
- package/dist/provisioning/docker-provision/image.d.ts.map +0 -1
- package/dist/provisioning/docker-provision/image.js +0 -275
- package/dist/provisioning/docker-provision/index.d.ts +0 -2
- package/dist/provisioning/docker-provision/index.d.ts.map +0 -1
- package/dist/provisioning/docker-provision/index.js +0 -1
- package/dist/provisioning/http/http.d.ts +0 -14
- package/dist/provisioning/http/http.d.ts.map +0 -1
- package/dist/provisioning/http/http.js +0 -33
- package/dist/provisioning/http/index.d.ts +0 -2
- package/dist/provisioning/http/index.d.ts.map +0 -1
- package/dist/provisioning/http/index.js +0 -1
- package/dist/provisioning/provisioner.d.ts +0 -11
- package/dist/provisioning/provisioner.d.ts.map +0 -1
- package/dist/provisioning/provisioner.js +0 -26
package/dist/api/client.gen.js
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file was auto-generated by `cloak clientgen`.
|
|
3
|
-
* Do not make direct changes to the file.
|
|
4
|
-
*/
|
|
5
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
6
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
7
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -11,16 +7,25 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
12
8
|
});
|
|
13
9
|
};
|
|
10
|
+
/**
|
|
11
|
+
* This file was auto-generated by `client-gen`.
|
|
12
|
+
* Do not make direct changes to the file.
|
|
13
|
+
*/
|
|
14
14
|
import { GraphQLClient } from "graphql-request";
|
|
15
|
-
import {
|
|
15
|
+
import { computeQuery } from "./utils.js";
|
|
16
16
|
class BaseClient {
|
|
17
17
|
/**
|
|
18
18
|
* @hidden
|
|
19
19
|
*/
|
|
20
|
-
constructor({ queryTree, host } = {}) {
|
|
20
|
+
constructor({ queryTree, host, sessionToken } = {}) {
|
|
21
21
|
this._queryTree = queryTree || [];
|
|
22
22
|
this.clientHost = host || "127.0.0.1:8080";
|
|
23
|
-
this.
|
|
23
|
+
this.sessionToken = sessionToken || "";
|
|
24
|
+
this.client = new GraphQLClient(`http://${host}/query`, {
|
|
25
|
+
headers: {
|
|
26
|
+
Authorization: "Basic " + Buffer.from(sessionToken + ":").toString("base64"),
|
|
27
|
+
},
|
|
28
|
+
});
|
|
24
29
|
}
|
|
25
30
|
/**
|
|
26
31
|
* @hidden
|
|
@@ -30,12 +35,12 @@ class BaseClient {
|
|
|
30
35
|
}
|
|
31
36
|
}
|
|
32
37
|
/**
|
|
33
|
-
* A directory whose contents persist across runs
|
|
38
|
+
* A directory whose contents persist across runs.
|
|
34
39
|
*/
|
|
35
40
|
export class CacheVolume extends BaseClient {
|
|
36
41
|
id() {
|
|
37
42
|
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
-
const response = yield
|
|
43
|
+
const response = yield computeQuery([
|
|
39
44
|
...this._queryTree,
|
|
40
45
|
{
|
|
41
46
|
operation: "id",
|
|
@@ -46,11 +51,15 @@ export class CacheVolume extends BaseClient {
|
|
|
46
51
|
}
|
|
47
52
|
}
|
|
48
53
|
/**
|
|
49
|
-
* An OCI-compatible container, also known as a docker container
|
|
54
|
+
* An OCI-compatible container, also known as a docker container.
|
|
50
55
|
*/
|
|
51
56
|
export class Container extends BaseClient {
|
|
52
57
|
/**
|
|
53
|
-
*
|
|
58
|
+
* Initializes this container from a Dockerfile build, using the context, a dockerfile file path and some additional buildArgs.
|
|
59
|
+
* @param context Directory context used by the Dockerfile.
|
|
60
|
+
* @param opts.dockerfile Path to the Dockerfile to use.
|
|
61
|
+
Defaults to './Dockerfile'.
|
|
62
|
+
* @param opts.buildArgs Additional build arguments.
|
|
54
63
|
*/
|
|
55
64
|
build(context, opts) {
|
|
56
65
|
return new Container({
|
|
@@ -62,14 +71,15 @@ export class Container extends BaseClient {
|
|
|
62
71
|
},
|
|
63
72
|
],
|
|
64
73
|
host: this.clientHost,
|
|
74
|
+
sessionToken: this.sessionToken,
|
|
65
75
|
});
|
|
66
76
|
}
|
|
67
77
|
/**
|
|
68
|
-
*
|
|
78
|
+
* Retrieves default arguments for future commands.
|
|
69
79
|
*/
|
|
70
80
|
defaultArgs() {
|
|
71
81
|
return __awaiter(this, void 0, void 0, function* () {
|
|
72
|
-
const response = yield
|
|
82
|
+
const response = yield computeQuery([
|
|
73
83
|
...this._queryTree,
|
|
74
84
|
{
|
|
75
85
|
operation: "defaultArgs",
|
|
@@ -79,7 +89,7 @@ export class Container extends BaseClient {
|
|
|
79
89
|
});
|
|
80
90
|
}
|
|
81
91
|
/**
|
|
82
|
-
*
|
|
92
|
+
* Retrieves a directory at the given path. Mounts are included.
|
|
83
93
|
*/
|
|
84
94
|
directory(path) {
|
|
85
95
|
return new Directory({
|
|
@@ -91,14 +101,15 @@ export class Container extends BaseClient {
|
|
|
91
101
|
},
|
|
92
102
|
],
|
|
93
103
|
host: this.clientHost,
|
|
104
|
+
sessionToken: this.sessionToken,
|
|
94
105
|
});
|
|
95
106
|
}
|
|
96
107
|
/**
|
|
97
|
-
*
|
|
108
|
+
* Retrieves entrypoint to be prepended to the arguments of all commands.
|
|
98
109
|
*/
|
|
99
110
|
entrypoint() {
|
|
100
111
|
return __awaiter(this, void 0, void 0, function* () {
|
|
101
|
-
const response = yield
|
|
112
|
+
const response = yield computeQuery([
|
|
102
113
|
...this._queryTree,
|
|
103
114
|
{
|
|
104
115
|
operation: "entrypoint",
|
|
@@ -108,11 +119,11 @@ export class Container extends BaseClient {
|
|
|
108
119
|
});
|
|
109
120
|
}
|
|
110
121
|
/**
|
|
111
|
-
*
|
|
122
|
+
* Retrieves the value of the specified environment variable.
|
|
112
123
|
*/
|
|
113
124
|
envVariable(name) {
|
|
114
125
|
return __awaiter(this, void 0, void 0, function* () {
|
|
115
|
-
const response = yield
|
|
126
|
+
const response = yield computeQuery([
|
|
116
127
|
...this._queryTree,
|
|
117
128
|
{
|
|
118
129
|
operation: "envVariable",
|
|
@@ -123,11 +134,11 @@ export class Container extends BaseClient {
|
|
|
123
134
|
});
|
|
124
135
|
}
|
|
125
136
|
/**
|
|
126
|
-
*
|
|
137
|
+
* Retrieves the list of environment variables passed to commands.
|
|
127
138
|
*/
|
|
128
139
|
envVariables() {
|
|
129
140
|
return __awaiter(this, void 0, void 0, function* () {
|
|
130
|
-
const response = yield
|
|
141
|
+
const response = yield computeQuery([
|
|
131
142
|
...this._queryTree,
|
|
132
143
|
{
|
|
133
144
|
operation: "envVariables",
|
|
@@ -137,10 +148,14 @@ export class Container extends BaseClient {
|
|
|
137
148
|
});
|
|
138
149
|
}
|
|
139
150
|
/**
|
|
140
|
-
*
|
|
141
|
-
*
|
|
142
|
-
* @param opts
|
|
143
|
-
*
|
|
151
|
+
* Retrieves this container after executing the specified command inside it.
|
|
152
|
+
* @param opts.args Command to run instead of the container's default command.
|
|
153
|
+
* @param opts.stdin Content to write to the command's standard input before closing.
|
|
154
|
+
* @param opts.redirectStdout Redirect the command's standard output to a file in the container.
|
|
155
|
+
* @param opts.redirectStderr Redirect the command's standard error to a file in the container.
|
|
156
|
+
* @param opts.experimentalPrivilegedNesting Provide dagger access to the executed command.
|
|
157
|
+
Do not use this option unless you trust the command being executed.
|
|
158
|
+
The command being executed WILL BE GRANTED FULL ACCESS TO YOUR HOST FILESYSTEM.
|
|
144
159
|
* @deprecated Replaced by withExec.
|
|
145
160
|
*/
|
|
146
161
|
exec(opts) {
|
|
@@ -153,6 +168,7 @@ export class Container extends BaseClient {
|
|
|
153
168
|
},
|
|
154
169
|
],
|
|
155
170
|
host: this.clientHost,
|
|
171
|
+
sessionToken: this.sessionToken,
|
|
156
172
|
});
|
|
157
173
|
}
|
|
158
174
|
/**
|
|
@@ -161,7 +177,7 @@ export class Container extends BaseClient {
|
|
|
161
177
|
*/
|
|
162
178
|
exitCode() {
|
|
163
179
|
return __awaiter(this, void 0, void 0, function* () {
|
|
164
|
-
const response = yield
|
|
180
|
+
const response = yield computeQuery([
|
|
165
181
|
...this._queryTree,
|
|
166
182
|
{
|
|
167
183
|
operation: "exitCode",
|
|
@@ -171,11 +187,16 @@ export class Container extends BaseClient {
|
|
|
171
187
|
});
|
|
172
188
|
}
|
|
173
189
|
/**
|
|
174
|
-
*
|
|
190
|
+
* Writes the container as an OCI tarball to the destination file path on the host for the specified platformVariants.
|
|
191
|
+
* Return true on success.
|
|
192
|
+
* @param path Host's destination path.
|
|
193
|
+
Path can be relative to the engine's workdir or absolute.
|
|
194
|
+
* @param opts.platformVariants Identifiers for other platform specific containers.
|
|
195
|
+
Used for multi-platform image.
|
|
175
196
|
*/
|
|
176
197
|
export(path, opts) {
|
|
177
198
|
return __awaiter(this, void 0, void 0, function* () {
|
|
178
|
-
const response = yield
|
|
199
|
+
const response = yield computeQuery([
|
|
179
200
|
...this._queryTree,
|
|
180
201
|
{
|
|
181
202
|
operation: "export",
|
|
@@ -186,7 +207,7 @@ export class Container extends BaseClient {
|
|
|
186
207
|
});
|
|
187
208
|
}
|
|
188
209
|
/**
|
|
189
|
-
*
|
|
210
|
+
* Retrieves a file at the given path. Mounts are included.
|
|
190
211
|
*/
|
|
191
212
|
file(path) {
|
|
192
213
|
return new File({
|
|
@@ -198,10 +219,13 @@ export class Container extends BaseClient {
|
|
|
198
219
|
},
|
|
199
220
|
],
|
|
200
221
|
host: this.clientHost,
|
|
222
|
+
sessionToken: this.sessionToken,
|
|
201
223
|
});
|
|
202
224
|
}
|
|
203
225
|
/**
|
|
204
|
-
*
|
|
226
|
+
* Initializes this container from the base image published at the given address.
|
|
227
|
+
* @param address Image's address from its registry.
|
|
228
|
+
Formatted as {host}/{user}/{repo}:{tag} (e.g. docker.io/dagger/dagger:main).
|
|
205
229
|
*/
|
|
206
230
|
from(address) {
|
|
207
231
|
return new Container({
|
|
@@ -213,12 +237,11 @@ export class Container extends BaseClient {
|
|
|
213
237
|
},
|
|
214
238
|
],
|
|
215
239
|
host: this.clientHost,
|
|
240
|
+
sessionToken: this.sessionToken,
|
|
216
241
|
});
|
|
217
242
|
}
|
|
218
243
|
/**
|
|
219
|
-
*
|
|
220
|
-
*
|
|
221
|
-
*
|
|
244
|
+
* Retrieves this container's root filesystem. Mounts are not included.
|
|
222
245
|
* @deprecated Replaced by rootfs.
|
|
223
246
|
*/
|
|
224
247
|
fs() {
|
|
@@ -230,14 +253,15 @@ export class Container extends BaseClient {
|
|
|
230
253
|
},
|
|
231
254
|
],
|
|
232
255
|
host: this.clientHost,
|
|
256
|
+
sessionToken: this.sessionToken,
|
|
233
257
|
});
|
|
234
258
|
}
|
|
235
259
|
/**
|
|
236
|
-
* A unique identifier for this container
|
|
260
|
+
* A unique identifier for this container.
|
|
237
261
|
*/
|
|
238
262
|
id() {
|
|
239
263
|
return __awaiter(this, void 0, void 0, function* () {
|
|
240
|
-
const response = yield
|
|
264
|
+
const response = yield computeQuery([
|
|
241
265
|
...this._queryTree,
|
|
242
266
|
{
|
|
243
267
|
operation: "id",
|
|
@@ -247,11 +271,11 @@ export class Container extends BaseClient {
|
|
|
247
271
|
});
|
|
248
272
|
}
|
|
249
273
|
/**
|
|
250
|
-
*
|
|
274
|
+
* Retrieves the list of paths where a directory is mounted.
|
|
251
275
|
*/
|
|
252
276
|
mounts() {
|
|
253
277
|
return __awaiter(this, void 0, void 0, function* () {
|
|
254
|
-
const response = yield
|
|
278
|
+
const response = yield computeQuery([
|
|
255
279
|
...this._queryTree,
|
|
256
280
|
{
|
|
257
281
|
operation: "mounts",
|
|
@@ -261,11 +285,11 @@ export class Container extends BaseClient {
|
|
|
261
285
|
});
|
|
262
286
|
}
|
|
263
287
|
/**
|
|
264
|
-
* The platform this container executes and publishes as
|
|
288
|
+
* The platform this container executes and publishes as.
|
|
265
289
|
*/
|
|
266
290
|
platform() {
|
|
267
291
|
return __awaiter(this, void 0, void 0, function* () {
|
|
268
|
-
const response = yield
|
|
292
|
+
const response = yield computeQuery([
|
|
269
293
|
...this._queryTree,
|
|
270
294
|
{
|
|
271
295
|
operation: "platform",
|
|
@@ -275,11 +299,15 @@ export class Container extends BaseClient {
|
|
|
275
299
|
});
|
|
276
300
|
}
|
|
277
301
|
/**
|
|
278
|
-
*
|
|
302
|
+
* Publishes this container as a new image to the specified address, for the platformVariants, returning a fully qualified ref.
|
|
303
|
+
* @param address Registry's address to publish the image to.
|
|
304
|
+
Formatted as {host}/{user}/{repo}:{tag} (e.g. docker.io/dagger/dagger:main).
|
|
305
|
+
* @param opts.platformVariants Identifiers for other platform specific containers.
|
|
306
|
+
Used for multi-platform image.
|
|
279
307
|
*/
|
|
280
308
|
publish(address, opts) {
|
|
281
309
|
return __awaiter(this, void 0, void 0, function* () {
|
|
282
|
-
const response = yield
|
|
310
|
+
const response = yield computeQuery([
|
|
283
311
|
...this._queryTree,
|
|
284
312
|
{
|
|
285
313
|
operation: "publish",
|
|
@@ -290,7 +318,7 @@ export class Container extends BaseClient {
|
|
|
290
318
|
});
|
|
291
319
|
}
|
|
292
320
|
/**
|
|
293
|
-
*
|
|
321
|
+
* Retrieves this container's root filesystem. Mounts are not included.
|
|
294
322
|
*/
|
|
295
323
|
rootfs() {
|
|
296
324
|
return new Directory({
|
|
@@ -301,6 +329,7 @@ export class Container extends BaseClient {
|
|
|
301
329
|
},
|
|
302
330
|
],
|
|
303
331
|
host: this.clientHost,
|
|
332
|
+
sessionToken: this.sessionToken,
|
|
304
333
|
});
|
|
305
334
|
}
|
|
306
335
|
/**
|
|
@@ -309,7 +338,7 @@ export class Container extends BaseClient {
|
|
|
309
338
|
*/
|
|
310
339
|
stderr() {
|
|
311
340
|
return __awaiter(this, void 0, void 0, function* () {
|
|
312
|
-
const response = yield
|
|
341
|
+
const response = yield computeQuery([
|
|
313
342
|
...this._queryTree,
|
|
314
343
|
{
|
|
315
344
|
operation: "stderr",
|
|
@@ -324,7 +353,7 @@ export class Container extends BaseClient {
|
|
|
324
353
|
*/
|
|
325
354
|
stdout() {
|
|
326
355
|
return __awaiter(this, void 0, void 0, function* () {
|
|
327
|
-
const response = yield
|
|
356
|
+
const response = yield computeQuery([
|
|
328
357
|
...this._queryTree,
|
|
329
358
|
{
|
|
330
359
|
operation: "stdout",
|
|
@@ -334,11 +363,11 @@ export class Container extends BaseClient {
|
|
|
334
363
|
});
|
|
335
364
|
}
|
|
336
365
|
/**
|
|
337
|
-
*
|
|
366
|
+
* Retrieves the user to be set for all commands.
|
|
338
367
|
*/
|
|
339
368
|
user() {
|
|
340
369
|
return __awaiter(this, void 0, void 0, function* () {
|
|
341
|
-
const response = yield
|
|
370
|
+
const response = yield computeQuery([
|
|
342
371
|
...this._queryTree,
|
|
343
372
|
{
|
|
344
373
|
operation: "user",
|
|
@@ -348,7 +377,7 @@ export class Container extends BaseClient {
|
|
|
348
377
|
});
|
|
349
378
|
}
|
|
350
379
|
/**
|
|
351
|
-
* Configures default arguments for future commands
|
|
380
|
+
* Configures default arguments for future commands.
|
|
352
381
|
*/
|
|
353
382
|
withDefaultArgs(opts) {
|
|
354
383
|
return new Container({
|
|
@@ -360,10 +389,11 @@ export class Container extends BaseClient {
|
|
|
360
389
|
},
|
|
361
390
|
],
|
|
362
391
|
host: this.clientHost,
|
|
392
|
+
sessionToken: this.sessionToken,
|
|
363
393
|
});
|
|
364
394
|
}
|
|
365
395
|
/**
|
|
366
|
-
*
|
|
396
|
+
* Retrieves this container plus a directory written at the given path.
|
|
367
397
|
*/
|
|
368
398
|
withDirectory(path, directory, opts) {
|
|
369
399
|
return new Container({
|
|
@@ -375,10 +405,11 @@ export class Container extends BaseClient {
|
|
|
375
405
|
},
|
|
376
406
|
],
|
|
377
407
|
host: this.clientHost,
|
|
408
|
+
sessionToken: this.sessionToken,
|
|
378
409
|
});
|
|
379
410
|
}
|
|
380
411
|
/**
|
|
381
|
-
*
|
|
412
|
+
* Retrieves this container but with a different command entrypoint.
|
|
382
413
|
*/
|
|
383
414
|
withEntrypoint(args) {
|
|
384
415
|
return new Container({
|
|
@@ -390,10 +421,11 @@ export class Container extends BaseClient {
|
|
|
390
421
|
},
|
|
391
422
|
],
|
|
392
423
|
host: this.clientHost,
|
|
424
|
+
sessionToken: this.sessionToken,
|
|
393
425
|
});
|
|
394
426
|
}
|
|
395
427
|
/**
|
|
396
|
-
*
|
|
428
|
+
* Retrieves this container plus the given environment variable.
|
|
397
429
|
*/
|
|
398
430
|
withEnvVariable(name, value) {
|
|
399
431
|
return new Container({
|
|
@@ -405,10 +437,18 @@ export class Container extends BaseClient {
|
|
|
405
437
|
},
|
|
406
438
|
],
|
|
407
439
|
host: this.clientHost,
|
|
440
|
+
sessionToken: this.sessionToken,
|
|
408
441
|
});
|
|
409
442
|
}
|
|
410
443
|
/**
|
|
411
|
-
*
|
|
444
|
+
* Retrieves this container after executing the specified command inside it.
|
|
445
|
+
* @param args Command to run instead of the container's default command.
|
|
446
|
+
* @param opts.stdin Content to write to the command's standard input before closing.
|
|
447
|
+
* @param opts.redirectStdout Redirect the command's standard output to a file in the container.
|
|
448
|
+
* @param opts.redirectStderr Redirect the command's standard error to a file in the container.
|
|
449
|
+
* @param opts.experimentalPrivilegedNesting Provide dagger access to the executed command.
|
|
450
|
+
Do not use this option unless you trust the command being executed.
|
|
451
|
+
The command being executed WILL BE GRANTED FULL ACCESS TO YOUR HOST FILESYSTEM.
|
|
412
452
|
*/
|
|
413
453
|
withExec(args, opts) {
|
|
414
454
|
return new Container({
|
|
@@ -420,12 +460,11 @@ export class Container extends BaseClient {
|
|
|
420
460
|
},
|
|
421
461
|
],
|
|
422
462
|
host: this.clientHost,
|
|
463
|
+
sessionToken: this.sessionToken,
|
|
423
464
|
});
|
|
424
465
|
}
|
|
425
466
|
/**
|
|
426
|
-
*
|
|
427
|
-
*
|
|
428
|
-
*
|
|
467
|
+
* Initializes this container from this DirectoryID.
|
|
429
468
|
* @deprecated Replaced by withRootfs.
|
|
430
469
|
*/
|
|
431
470
|
withFS(id) {
|
|
@@ -438,25 +477,27 @@ export class Container extends BaseClient {
|
|
|
438
477
|
},
|
|
439
478
|
],
|
|
440
479
|
host: this.clientHost,
|
|
480
|
+
sessionToken: this.sessionToken,
|
|
441
481
|
});
|
|
442
482
|
}
|
|
443
483
|
/**
|
|
444
|
-
*
|
|
484
|
+
* Retrieves this container plus the contents of the given file copied to the given path.
|
|
445
485
|
*/
|
|
446
|
-
withFile(path, source) {
|
|
486
|
+
withFile(path, source, opts) {
|
|
447
487
|
return new Container({
|
|
448
488
|
queryTree: [
|
|
449
489
|
...this._queryTree,
|
|
450
490
|
{
|
|
451
491
|
operation: "withFile",
|
|
452
|
-
args: { path, source },
|
|
492
|
+
args: Object.assign({ path, source }, opts),
|
|
453
493
|
},
|
|
454
494
|
],
|
|
455
495
|
host: this.clientHost,
|
|
496
|
+
sessionToken: this.sessionToken,
|
|
456
497
|
});
|
|
457
498
|
}
|
|
458
499
|
/**
|
|
459
|
-
*
|
|
500
|
+
* Retrieves this container plus a cache volume mounted at the given path.
|
|
460
501
|
*/
|
|
461
502
|
withMountedCache(path, cache, opts) {
|
|
462
503
|
return new Container({
|
|
@@ -468,10 +509,11 @@ export class Container extends BaseClient {
|
|
|
468
509
|
},
|
|
469
510
|
],
|
|
470
511
|
host: this.clientHost,
|
|
512
|
+
sessionToken: this.sessionToken,
|
|
471
513
|
});
|
|
472
514
|
}
|
|
473
515
|
/**
|
|
474
|
-
*
|
|
516
|
+
* Retrieves this container plus a directory mounted at the given path.
|
|
475
517
|
*/
|
|
476
518
|
withMountedDirectory(path, source) {
|
|
477
519
|
return new Container({
|
|
@@ -483,10 +525,11 @@ export class Container extends BaseClient {
|
|
|
483
525
|
},
|
|
484
526
|
],
|
|
485
527
|
host: this.clientHost,
|
|
528
|
+
sessionToken: this.sessionToken,
|
|
486
529
|
});
|
|
487
530
|
}
|
|
488
531
|
/**
|
|
489
|
-
*
|
|
532
|
+
* Retrieves this container plus a file mounted at the given path.
|
|
490
533
|
*/
|
|
491
534
|
withMountedFile(path, source) {
|
|
492
535
|
return new Container({
|
|
@@ -498,10 +541,11 @@ export class Container extends BaseClient {
|
|
|
498
541
|
},
|
|
499
542
|
],
|
|
500
543
|
host: this.clientHost,
|
|
544
|
+
sessionToken: this.sessionToken,
|
|
501
545
|
});
|
|
502
546
|
}
|
|
503
547
|
/**
|
|
504
|
-
*
|
|
548
|
+
* Retrieves this container plus a secret mounted into a file at the given path.
|
|
505
549
|
*/
|
|
506
550
|
withMountedSecret(path, source) {
|
|
507
551
|
return new Container({
|
|
@@ -513,10 +557,11 @@ export class Container extends BaseClient {
|
|
|
513
557
|
},
|
|
514
558
|
],
|
|
515
559
|
host: this.clientHost,
|
|
560
|
+
sessionToken: this.sessionToken,
|
|
516
561
|
});
|
|
517
562
|
}
|
|
518
563
|
/**
|
|
519
|
-
*
|
|
564
|
+
* Retrieves this container plus a temporary directory mounted at the given path.
|
|
520
565
|
*/
|
|
521
566
|
withMountedTemp(path) {
|
|
522
567
|
return new Container({
|
|
@@ -528,10 +573,11 @@ export class Container extends BaseClient {
|
|
|
528
573
|
},
|
|
529
574
|
],
|
|
530
575
|
host: this.clientHost,
|
|
576
|
+
sessionToken: this.sessionToken,
|
|
531
577
|
});
|
|
532
578
|
}
|
|
533
579
|
/**
|
|
534
|
-
*
|
|
580
|
+
* Retrieves this container plus a new file written at the given path.
|
|
535
581
|
*/
|
|
536
582
|
withNewFile(path, opts) {
|
|
537
583
|
return new Container({
|
|
@@ -543,10 +589,11 @@ export class Container extends BaseClient {
|
|
|
543
589
|
},
|
|
544
590
|
],
|
|
545
591
|
host: this.clientHost,
|
|
592
|
+
sessionToken: this.sessionToken,
|
|
546
593
|
});
|
|
547
594
|
}
|
|
548
595
|
/**
|
|
549
|
-
*
|
|
596
|
+
* Initializes this container from this DirectoryID.
|
|
550
597
|
*/
|
|
551
598
|
withRootfs(id) {
|
|
552
599
|
return new Container({
|
|
@@ -558,10 +605,11 @@ export class Container extends BaseClient {
|
|
|
558
605
|
},
|
|
559
606
|
],
|
|
560
607
|
host: this.clientHost,
|
|
608
|
+
sessionToken: this.sessionToken,
|
|
561
609
|
});
|
|
562
610
|
}
|
|
563
611
|
/**
|
|
564
|
-
*
|
|
612
|
+
* Retrieves this container plus an env variable containing the given secret.
|
|
565
613
|
*/
|
|
566
614
|
withSecretVariable(name, secret) {
|
|
567
615
|
return new Container({
|
|
@@ -573,10 +621,11 @@ export class Container extends BaseClient {
|
|
|
573
621
|
},
|
|
574
622
|
],
|
|
575
623
|
host: this.clientHost,
|
|
624
|
+
sessionToken: this.sessionToken,
|
|
576
625
|
});
|
|
577
626
|
}
|
|
578
627
|
/**
|
|
579
|
-
*
|
|
628
|
+
* Retrieves this container plus a socket forwarded to the given Unix socket path.
|
|
580
629
|
*/
|
|
581
630
|
withUnixSocket(path, source) {
|
|
582
631
|
return new Container({
|
|
@@ -588,10 +637,11 @@ export class Container extends BaseClient {
|
|
|
588
637
|
},
|
|
589
638
|
],
|
|
590
639
|
host: this.clientHost,
|
|
640
|
+
sessionToken: this.sessionToken,
|
|
591
641
|
});
|
|
592
642
|
}
|
|
593
643
|
/**
|
|
594
|
-
*
|
|
644
|
+
* Retrieves this containers with a different command user.
|
|
595
645
|
*/
|
|
596
646
|
withUser(name) {
|
|
597
647
|
return new Container({
|
|
@@ -603,10 +653,11 @@ export class Container extends BaseClient {
|
|
|
603
653
|
},
|
|
604
654
|
],
|
|
605
655
|
host: this.clientHost,
|
|
656
|
+
sessionToken: this.sessionToken,
|
|
606
657
|
});
|
|
607
658
|
}
|
|
608
659
|
/**
|
|
609
|
-
*
|
|
660
|
+
* Retrieves this container with a different working directory.
|
|
610
661
|
*/
|
|
611
662
|
withWorkdir(path) {
|
|
612
663
|
return new Container({
|
|
@@ -618,10 +669,11 @@ export class Container extends BaseClient {
|
|
|
618
669
|
},
|
|
619
670
|
],
|
|
620
671
|
host: this.clientHost,
|
|
672
|
+
sessionToken: this.sessionToken,
|
|
621
673
|
});
|
|
622
674
|
}
|
|
623
675
|
/**
|
|
624
|
-
*
|
|
676
|
+
* Retrieves this container minus the given environment variable.
|
|
625
677
|
*/
|
|
626
678
|
withoutEnvVariable(name) {
|
|
627
679
|
return new Container({
|
|
@@ -633,10 +685,11 @@ export class Container extends BaseClient {
|
|
|
633
685
|
},
|
|
634
686
|
],
|
|
635
687
|
host: this.clientHost,
|
|
688
|
+
sessionToken: this.sessionToken,
|
|
636
689
|
});
|
|
637
690
|
}
|
|
638
691
|
/**
|
|
639
|
-
*
|
|
692
|
+
* Retrieves this container after unmounting everything at the given path.
|
|
640
693
|
*/
|
|
641
694
|
withoutMount(path) {
|
|
642
695
|
return new Container({
|
|
@@ -648,10 +701,11 @@ export class Container extends BaseClient {
|
|
|
648
701
|
},
|
|
649
702
|
],
|
|
650
703
|
host: this.clientHost,
|
|
704
|
+
sessionToken: this.sessionToken,
|
|
651
705
|
});
|
|
652
706
|
}
|
|
653
707
|
/**
|
|
654
|
-
*
|
|
708
|
+
* Retrieves this container with a previously added Unix socket removed.
|
|
655
709
|
*/
|
|
656
710
|
withoutUnixSocket(path) {
|
|
657
711
|
return new Container({
|
|
@@ -663,14 +717,15 @@ export class Container extends BaseClient {
|
|
|
663
717
|
},
|
|
664
718
|
],
|
|
665
719
|
host: this.clientHost,
|
|
720
|
+
sessionToken: this.sessionToken,
|
|
666
721
|
});
|
|
667
722
|
}
|
|
668
723
|
/**
|
|
669
|
-
*
|
|
724
|
+
* Retrieves the working directory for all commands.
|
|
670
725
|
*/
|
|
671
726
|
workdir() {
|
|
672
727
|
return __awaiter(this, void 0, void 0, function* () {
|
|
673
|
-
const response = yield
|
|
728
|
+
const response = yield computeQuery([
|
|
674
729
|
...this._queryTree,
|
|
675
730
|
{
|
|
676
731
|
operation: "workdir",
|
|
@@ -681,11 +736,11 @@ export class Container extends BaseClient {
|
|
|
681
736
|
}
|
|
682
737
|
}
|
|
683
738
|
/**
|
|
684
|
-
* A directory
|
|
739
|
+
* A directory.
|
|
685
740
|
*/
|
|
686
741
|
export class Directory extends BaseClient {
|
|
687
742
|
/**
|
|
688
|
-
*
|
|
743
|
+
* Gets the difference between this directory and an another directory.
|
|
689
744
|
*/
|
|
690
745
|
diff(other) {
|
|
691
746
|
return new Directory({
|
|
@@ -697,10 +752,11 @@ export class Directory extends BaseClient {
|
|
|
697
752
|
},
|
|
698
753
|
],
|
|
699
754
|
host: this.clientHost,
|
|
755
|
+
sessionToken: this.sessionToken,
|
|
700
756
|
});
|
|
701
757
|
}
|
|
702
758
|
/**
|
|
703
|
-
*
|
|
759
|
+
* Retrieves a directory at the given path.
|
|
704
760
|
*/
|
|
705
761
|
directory(path) {
|
|
706
762
|
return new Directory({
|
|
@@ -712,10 +768,13 @@ export class Directory extends BaseClient {
|
|
|
712
768
|
},
|
|
713
769
|
],
|
|
714
770
|
host: this.clientHost,
|
|
771
|
+
sessionToken: this.sessionToken,
|
|
715
772
|
});
|
|
716
773
|
}
|
|
717
774
|
/**
|
|
718
|
-
*
|
|
775
|
+
* Builds a new Docker container from this directory.
|
|
776
|
+
* @param opts.dockerfile Path to the Dockerfile to use.
|
|
777
|
+
Defaults to './Dockerfile'.
|
|
719
778
|
*/
|
|
720
779
|
dockerBuild(opts) {
|
|
721
780
|
return new Container({
|
|
@@ -727,14 +786,15 @@ export class Directory extends BaseClient {
|
|
|
727
786
|
},
|
|
728
787
|
],
|
|
729
788
|
host: this.clientHost,
|
|
789
|
+
sessionToken: this.sessionToken,
|
|
730
790
|
});
|
|
731
791
|
}
|
|
732
792
|
/**
|
|
733
|
-
*
|
|
793
|
+
* Returns a list of files and directories at the given path.
|
|
734
794
|
*/
|
|
735
795
|
entries(opts) {
|
|
736
796
|
return __awaiter(this, void 0, void 0, function* () {
|
|
737
|
-
const response = yield
|
|
797
|
+
const response = yield computeQuery([
|
|
738
798
|
...this._queryTree,
|
|
739
799
|
{
|
|
740
800
|
operation: "entries",
|
|
@@ -745,11 +805,11 @@ export class Directory extends BaseClient {
|
|
|
745
805
|
});
|
|
746
806
|
}
|
|
747
807
|
/**
|
|
748
|
-
*
|
|
808
|
+
* Writes the contents of the directory to a path on the host.
|
|
749
809
|
*/
|
|
750
810
|
export(path) {
|
|
751
811
|
return __awaiter(this, void 0, void 0, function* () {
|
|
752
|
-
const response = yield
|
|
812
|
+
const response = yield computeQuery([
|
|
753
813
|
...this._queryTree,
|
|
754
814
|
{
|
|
755
815
|
operation: "export",
|
|
@@ -760,7 +820,7 @@ export class Directory extends BaseClient {
|
|
|
760
820
|
});
|
|
761
821
|
}
|
|
762
822
|
/**
|
|
763
|
-
*
|
|
823
|
+
* Retrieves a file at the given path.
|
|
764
824
|
*/
|
|
765
825
|
file(path) {
|
|
766
826
|
return new File({
|
|
@@ -772,14 +832,15 @@ export class Directory extends BaseClient {
|
|
|
772
832
|
},
|
|
773
833
|
],
|
|
774
834
|
host: this.clientHost,
|
|
835
|
+
sessionToken: this.sessionToken,
|
|
775
836
|
});
|
|
776
837
|
}
|
|
777
838
|
/**
|
|
778
|
-
* The content-addressed identifier of the directory
|
|
839
|
+
* The content-addressed identifier of the directory.
|
|
779
840
|
*/
|
|
780
841
|
id() {
|
|
781
842
|
return __awaiter(this, void 0, void 0, function* () {
|
|
782
|
-
const response = yield
|
|
843
|
+
const response = yield computeQuery([
|
|
783
844
|
...this._queryTree,
|
|
784
845
|
{
|
|
785
846
|
operation: "id",
|
|
@@ -801,10 +862,15 @@ export class Directory extends BaseClient {
|
|
|
801
862
|
},
|
|
802
863
|
],
|
|
803
864
|
host: this.clientHost,
|
|
865
|
+
sessionToken: this.sessionToken,
|
|
804
866
|
});
|
|
805
867
|
}
|
|
806
868
|
/**
|
|
807
|
-
*
|
|
869
|
+
* Retrieves this directory plus a directory written at the given path.
|
|
870
|
+
* @param opts.exclude Exclude artifacts that match the given pattern.
|
|
871
|
+
(e.g. ["node_modules/", ".git*"]).
|
|
872
|
+
* @param opts.include Include only artifacts that match the given pattern.
|
|
873
|
+
(e.g. ["app/", "package.*"]).
|
|
808
874
|
*/
|
|
809
875
|
withDirectory(path, directory, opts) {
|
|
810
876
|
return new Directory({
|
|
@@ -816,55 +882,75 @@ export class Directory extends BaseClient {
|
|
|
816
882
|
},
|
|
817
883
|
],
|
|
818
884
|
host: this.clientHost,
|
|
885
|
+
sessionToken: this.sessionToken,
|
|
819
886
|
});
|
|
820
887
|
}
|
|
821
888
|
/**
|
|
822
|
-
*
|
|
889
|
+
* Retrieves this directory plus the contents of the given file copied to the given path.
|
|
823
890
|
*/
|
|
824
|
-
withFile(path, source) {
|
|
891
|
+
withFile(path, source, opts) {
|
|
825
892
|
return new Directory({
|
|
826
893
|
queryTree: [
|
|
827
894
|
...this._queryTree,
|
|
828
895
|
{
|
|
829
896
|
operation: "withFile",
|
|
830
|
-
args: { path, source },
|
|
897
|
+
args: Object.assign({ path, source }, opts),
|
|
831
898
|
},
|
|
832
899
|
],
|
|
833
900
|
host: this.clientHost,
|
|
901
|
+
sessionToken: this.sessionToken,
|
|
834
902
|
});
|
|
835
903
|
}
|
|
836
904
|
/**
|
|
837
|
-
*
|
|
905
|
+
* Retrieves this directory plus a new directory created at the given path.
|
|
838
906
|
*/
|
|
839
|
-
withNewDirectory(path) {
|
|
907
|
+
withNewDirectory(path, opts) {
|
|
840
908
|
return new Directory({
|
|
841
909
|
queryTree: [
|
|
842
910
|
...this._queryTree,
|
|
843
911
|
{
|
|
844
912
|
operation: "withNewDirectory",
|
|
845
|
-
args: { path },
|
|
913
|
+
args: Object.assign({ path }, opts),
|
|
846
914
|
},
|
|
847
915
|
],
|
|
848
916
|
host: this.clientHost,
|
|
917
|
+
sessionToken: this.sessionToken,
|
|
849
918
|
});
|
|
850
919
|
}
|
|
851
920
|
/**
|
|
852
|
-
*
|
|
921
|
+
* Retrieves this directory plus a new file written at the given path.
|
|
853
922
|
*/
|
|
854
|
-
withNewFile(path, contents) {
|
|
923
|
+
withNewFile(path, contents, opts) {
|
|
855
924
|
return new Directory({
|
|
856
925
|
queryTree: [
|
|
857
926
|
...this._queryTree,
|
|
858
927
|
{
|
|
859
928
|
operation: "withNewFile",
|
|
860
|
-
args: { path, contents },
|
|
929
|
+
args: Object.assign({ path, contents }, opts),
|
|
861
930
|
},
|
|
862
931
|
],
|
|
863
932
|
host: this.clientHost,
|
|
933
|
+
sessionToken: this.sessionToken,
|
|
864
934
|
});
|
|
865
935
|
}
|
|
866
936
|
/**
|
|
867
|
-
*
|
|
937
|
+
* Retrieves this directory with all file/dir timestamps set to the given time, in seconds from the Unix epoch.
|
|
938
|
+
*/
|
|
939
|
+
withTimestamps(timestamp) {
|
|
940
|
+
return new Directory({
|
|
941
|
+
queryTree: [
|
|
942
|
+
...this._queryTree,
|
|
943
|
+
{
|
|
944
|
+
operation: "withTimestamps",
|
|
945
|
+
args: { timestamp },
|
|
946
|
+
},
|
|
947
|
+
],
|
|
948
|
+
host: this.clientHost,
|
|
949
|
+
sessionToken: this.sessionToken,
|
|
950
|
+
});
|
|
951
|
+
}
|
|
952
|
+
/**
|
|
953
|
+
* Retrieves this directory with the directory at the given path removed.
|
|
868
954
|
*/
|
|
869
955
|
withoutDirectory(path) {
|
|
870
956
|
return new Directory({
|
|
@@ -876,10 +962,11 @@ export class Directory extends BaseClient {
|
|
|
876
962
|
},
|
|
877
963
|
],
|
|
878
964
|
host: this.clientHost,
|
|
965
|
+
sessionToken: this.sessionToken,
|
|
879
966
|
});
|
|
880
967
|
}
|
|
881
968
|
/**
|
|
882
|
-
*
|
|
969
|
+
* Retrieves this directory with the file at the given path removed.
|
|
883
970
|
*/
|
|
884
971
|
withoutFile(path) {
|
|
885
972
|
return new Directory({
|
|
@@ -891,19 +978,20 @@ export class Directory extends BaseClient {
|
|
|
891
978
|
},
|
|
892
979
|
],
|
|
893
980
|
host: this.clientHost,
|
|
981
|
+
sessionToken: this.sessionToken,
|
|
894
982
|
});
|
|
895
983
|
}
|
|
896
984
|
}
|
|
897
985
|
/**
|
|
898
|
-
*
|
|
986
|
+
* A simple key value object that represents an environment variable.
|
|
899
987
|
*/
|
|
900
988
|
export class EnvVariable extends BaseClient {
|
|
901
989
|
/**
|
|
902
|
-
*
|
|
990
|
+
* The environment variable name.
|
|
903
991
|
*/
|
|
904
992
|
name() {
|
|
905
993
|
return __awaiter(this, void 0, void 0, function* () {
|
|
906
|
-
const response = yield
|
|
994
|
+
const response = yield computeQuery([
|
|
907
995
|
...this._queryTree,
|
|
908
996
|
{
|
|
909
997
|
operation: "name",
|
|
@@ -913,11 +1001,11 @@ export class EnvVariable extends BaseClient {
|
|
|
913
1001
|
});
|
|
914
1002
|
}
|
|
915
1003
|
/**
|
|
916
|
-
*
|
|
1004
|
+
* The environment variable value.
|
|
917
1005
|
*/
|
|
918
1006
|
value() {
|
|
919
1007
|
return __awaiter(this, void 0, void 0, function* () {
|
|
920
|
-
const response = yield
|
|
1008
|
+
const response = yield computeQuery([
|
|
921
1009
|
...this._queryTree,
|
|
922
1010
|
{
|
|
923
1011
|
operation: "value",
|
|
@@ -928,15 +1016,15 @@ export class EnvVariable extends BaseClient {
|
|
|
928
1016
|
}
|
|
929
1017
|
}
|
|
930
1018
|
/**
|
|
931
|
-
* A file
|
|
1019
|
+
* A file.
|
|
932
1020
|
*/
|
|
933
1021
|
export class File extends BaseClient {
|
|
934
1022
|
/**
|
|
935
|
-
*
|
|
1023
|
+
* Retrieves the contents of the file.
|
|
936
1024
|
*/
|
|
937
1025
|
contents() {
|
|
938
1026
|
return __awaiter(this, void 0, void 0, function* () {
|
|
939
|
-
const response = yield
|
|
1027
|
+
const response = yield computeQuery([
|
|
940
1028
|
...this._queryTree,
|
|
941
1029
|
{
|
|
942
1030
|
operation: "contents",
|
|
@@ -946,11 +1034,11 @@ export class File extends BaseClient {
|
|
|
946
1034
|
});
|
|
947
1035
|
}
|
|
948
1036
|
/**
|
|
949
|
-
*
|
|
1037
|
+
* Writes the file to a file path on the host.
|
|
950
1038
|
*/
|
|
951
1039
|
export(path) {
|
|
952
1040
|
return __awaiter(this, void 0, void 0, function* () {
|
|
953
|
-
const response = yield
|
|
1041
|
+
const response = yield computeQuery([
|
|
954
1042
|
...this._queryTree,
|
|
955
1043
|
{
|
|
956
1044
|
operation: "export",
|
|
@@ -961,11 +1049,11 @@ export class File extends BaseClient {
|
|
|
961
1049
|
});
|
|
962
1050
|
}
|
|
963
1051
|
/**
|
|
964
|
-
*
|
|
1052
|
+
* Retrieves the content-addressed identifier of the file.
|
|
965
1053
|
*/
|
|
966
1054
|
id() {
|
|
967
1055
|
return __awaiter(this, void 0, void 0, function* () {
|
|
968
|
-
const response = yield
|
|
1056
|
+
const response = yield computeQuery([
|
|
969
1057
|
...this._queryTree,
|
|
970
1058
|
{
|
|
971
1059
|
operation: "id",
|
|
@@ -974,6 +1062,9 @@ export class File extends BaseClient {
|
|
|
974
1062
|
return response;
|
|
975
1063
|
});
|
|
976
1064
|
}
|
|
1065
|
+
/**
|
|
1066
|
+
* Retrieves a secret referencing the contents of this file.
|
|
1067
|
+
*/
|
|
977
1068
|
secret() {
|
|
978
1069
|
return new Secret({
|
|
979
1070
|
queryTree: [
|
|
@@ -983,14 +1074,15 @@ export class File extends BaseClient {
|
|
|
983
1074
|
},
|
|
984
1075
|
],
|
|
985
1076
|
host: this.clientHost,
|
|
1077
|
+
sessionToken: this.sessionToken,
|
|
986
1078
|
});
|
|
987
1079
|
}
|
|
988
1080
|
/**
|
|
989
|
-
*
|
|
1081
|
+
* Gets the size of the file, in bytes.
|
|
990
1082
|
*/
|
|
991
1083
|
size() {
|
|
992
1084
|
return __awaiter(this, void 0, void 0, function* () {
|
|
993
|
-
const response = yield
|
|
1085
|
+
const response = yield computeQuery([
|
|
994
1086
|
...this._queryTree,
|
|
995
1087
|
{
|
|
996
1088
|
operation: "size",
|
|
@@ -999,17 +1091,33 @@ export class File extends BaseClient {
|
|
|
999
1091
|
return response;
|
|
1000
1092
|
});
|
|
1001
1093
|
}
|
|
1094
|
+
/**
|
|
1095
|
+
* Retrieves this file with its created/modified timestamps set to the given time, in seconds from the Unix epoch.
|
|
1096
|
+
*/
|
|
1097
|
+
withTimestamps(timestamp) {
|
|
1098
|
+
return new File({
|
|
1099
|
+
queryTree: [
|
|
1100
|
+
...this._queryTree,
|
|
1101
|
+
{
|
|
1102
|
+
operation: "withTimestamps",
|
|
1103
|
+
args: { timestamp },
|
|
1104
|
+
},
|
|
1105
|
+
],
|
|
1106
|
+
host: this.clientHost,
|
|
1107
|
+
sessionToken: this.sessionToken,
|
|
1108
|
+
});
|
|
1109
|
+
}
|
|
1002
1110
|
}
|
|
1003
1111
|
/**
|
|
1004
|
-
* A git ref (tag or
|
|
1112
|
+
* A git ref (tag, branch or commit).
|
|
1005
1113
|
*/
|
|
1006
1114
|
export class GitRef extends BaseClient {
|
|
1007
1115
|
/**
|
|
1008
|
-
* The digest of the current value of this ref
|
|
1116
|
+
* The digest of the current value of this ref.
|
|
1009
1117
|
*/
|
|
1010
1118
|
digest() {
|
|
1011
1119
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1012
|
-
const response = yield
|
|
1120
|
+
const response = yield computeQuery([
|
|
1013
1121
|
...this._queryTree,
|
|
1014
1122
|
{
|
|
1015
1123
|
operation: "digest",
|
|
@@ -1019,7 +1127,7 @@ export class GitRef extends BaseClient {
|
|
|
1019
1127
|
});
|
|
1020
1128
|
}
|
|
1021
1129
|
/**
|
|
1022
|
-
* The filesystem tree at this ref
|
|
1130
|
+
* The filesystem tree at this ref.
|
|
1023
1131
|
*/
|
|
1024
1132
|
tree(opts) {
|
|
1025
1133
|
return new Directory({
|
|
@@ -1031,15 +1139,16 @@ export class GitRef extends BaseClient {
|
|
|
1031
1139
|
},
|
|
1032
1140
|
],
|
|
1033
1141
|
host: this.clientHost,
|
|
1142
|
+
sessionToken: this.sessionToken,
|
|
1034
1143
|
});
|
|
1035
1144
|
}
|
|
1036
1145
|
}
|
|
1037
1146
|
/**
|
|
1038
|
-
* A git repository
|
|
1147
|
+
* A git repository.
|
|
1039
1148
|
*/
|
|
1040
1149
|
export class GitRepository extends BaseClient {
|
|
1041
1150
|
/**
|
|
1042
|
-
*
|
|
1151
|
+
* Returns details on one branch.
|
|
1043
1152
|
*/
|
|
1044
1153
|
branch(name) {
|
|
1045
1154
|
return new GitRef({
|
|
@@ -1051,14 +1160,15 @@ export class GitRepository extends BaseClient {
|
|
|
1051
1160
|
},
|
|
1052
1161
|
],
|
|
1053
1162
|
host: this.clientHost,
|
|
1163
|
+
sessionToken: this.sessionToken,
|
|
1054
1164
|
});
|
|
1055
1165
|
}
|
|
1056
1166
|
/**
|
|
1057
|
-
*
|
|
1167
|
+
* Lists of branches on the repository.
|
|
1058
1168
|
*/
|
|
1059
1169
|
branches() {
|
|
1060
1170
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1061
|
-
const response = yield
|
|
1171
|
+
const response = yield computeQuery([
|
|
1062
1172
|
...this._queryTree,
|
|
1063
1173
|
{
|
|
1064
1174
|
operation: "branches",
|
|
@@ -1068,7 +1178,7 @@ export class GitRepository extends BaseClient {
|
|
|
1068
1178
|
});
|
|
1069
1179
|
}
|
|
1070
1180
|
/**
|
|
1071
|
-
*
|
|
1181
|
+
* Returns details on one commit.
|
|
1072
1182
|
*/
|
|
1073
1183
|
commit(id) {
|
|
1074
1184
|
return new GitRef({
|
|
@@ -1080,10 +1190,11 @@ export class GitRepository extends BaseClient {
|
|
|
1080
1190
|
},
|
|
1081
1191
|
],
|
|
1082
1192
|
host: this.clientHost,
|
|
1193
|
+
sessionToken: this.sessionToken,
|
|
1083
1194
|
});
|
|
1084
1195
|
}
|
|
1085
1196
|
/**
|
|
1086
|
-
*
|
|
1197
|
+
* Returns details on one tag.
|
|
1087
1198
|
*/
|
|
1088
1199
|
tag(name) {
|
|
1089
1200
|
return new GitRef({
|
|
@@ -1095,14 +1206,15 @@ export class GitRepository extends BaseClient {
|
|
|
1095
1206
|
},
|
|
1096
1207
|
],
|
|
1097
1208
|
host: this.clientHost,
|
|
1209
|
+
sessionToken: this.sessionToken,
|
|
1098
1210
|
});
|
|
1099
1211
|
}
|
|
1100
1212
|
/**
|
|
1101
|
-
*
|
|
1213
|
+
* Lists of tags on the repository.
|
|
1102
1214
|
*/
|
|
1103
1215
|
tags() {
|
|
1104
1216
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1105
|
-
const response = yield
|
|
1217
|
+
const response = yield computeQuery([
|
|
1106
1218
|
...this._queryTree,
|
|
1107
1219
|
{
|
|
1108
1220
|
operation: "tags",
|
|
@@ -1113,11 +1225,11 @@ export class GitRepository extends BaseClient {
|
|
|
1113
1225
|
}
|
|
1114
1226
|
}
|
|
1115
1227
|
/**
|
|
1116
|
-
* Information about the host execution environment
|
|
1228
|
+
* Information about the host execution environment.
|
|
1117
1229
|
*/
|
|
1118
1230
|
export class Host extends BaseClient {
|
|
1119
1231
|
/**
|
|
1120
|
-
*
|
|
1232
|
+
* Accesses a directory on the host.
|
|
1121
1233
|
*/
|
|
1122
1234
|
directory(path, opts) {
|
|
1123
1235
|
return new Directory({
|
|
@@ -1129,10 +1241,11 @@ export class Host extends BaseClient {
|
|
|
1129
1241
|
},
|
|
1130
1242
|
],
|
|
1131
1243
|
host: this.clientHost,
|
|
1244
|
+
sessionToken: this.sessionToken,
|
|
1132
1245
|
});
|
|
1133
1246
|
}
|
|
1134
1247
|
/**
|
|
1135
|
-
*
|
|
1248
|
+
* Accesses an environment variable on the host.
|
|
1136
1249
|
*/
|
|
1137
1250
|
envVariable(name) {
|
|
1138
1251
|
return new HostVariable({
|
|
@@ -1144,10 +1257,11 @@ export class Host extends BaseClient {
|
|
|
1144
1257
|
},
|
|
1145
1258
|
],
|
|
1146
1259
|
host: this.clientHost,
|
|
1260
|
+
sessionToken: this.sessionToken,
|
|
1147
1261
|
});
|
|
1148
1262
|
}
|
|
1149
1263
|
/**
|
|
1150
|
-
*
|
|
1264
|
+
* Accesses a Unix socket on the host.
|
|
1151
1265
|
*/
|
|
1152
1266
|
unixSocket(path) {
|
|
1153
1267
|
return new Socket({
|
|
@@ -1159,13 +1273,11 @@ export class Host extends BaseClient {
|
|
|
1159
1273
|
},
|
|
1160
1274
|
],
|
|
1161
1275
|
host: this.clientHost,
|
|
1276
|
+
sessionToken: this.sessionToken,
|
|
1162
1277
|
});
|
|
1163
1278
|
}
|
|
1164
1279
|
/**
|
|
1165
|
-
*
|
|
1166
|
-
*
|
|
1167
|
-
* @param opts optional params for workdir
|
|
1168
|
-
*
|
|
1280
|
+
* Retrieves the current working directory on the host.
|
|
1169
1281
|
* @deprecated Use directory with path set to '.' instead.
|
|
1170
1282
|
*/
|
|
1171
1283
|
workdir(opts) {
|
|
@@ -1178,15 +1290,16 @@ export class Host extends BaseClient {
|
|
|
1178
1290
|
},
|
|
1179
1291
|
],
|
|
1180
1292
|
host: this.clientHost,
|
|
1293
|
+
sessionToken: this.sessionToken,
|
|
1181
1294
|
});
|
|
1182
1295
|
}
|
|
1183
1296
|
}
|
|
1184
1297
|
/**
|
|
1185
|
-
* An environment variable on the host environment
|
|
1298
|
+
* An environment variable on the host environment.
|
|
1186
1299
|
*/
|
|
1187
1300
|
export class HostVariable extends BaseClient {
|
|
1188
1301
|
/**
|
|
1189
|
-
* A secret referencing the value of this variable
|
|
1302
|
+
* A secret referencing the value of this variable.
|
|
1190
1303
|
*/
|
|
1191
1304
|
secret() {
|
|
1192
1305
|
return new Secret({
|
|
@@ -1197,14 +1310,15 @@ export class HostVariable extends BaseClient {
|
|
|
1197
1310
|
},
|
|
1198
1311
|
],
|
|
1199
1312
|
host: this.clientHost,
|
|
1313
|
+
sessionToken: this.sessionToken,
|
|
1200
1314
|
});
|
|
1201
1315
|
}
|
|
1202
1316
|
/**
|
|
1203
|
-
* The value of this variable
|
|
1317
|
+
* The value of this variable.
|
|
1204
1318
|
*/
|
|
1205
1319
|
value() {
|
|
1206
1320
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1207
|
-
const response = yield
|
|
1321
|
+
const response = yield computeQuery([
|
|
1208
1322
|
...this._queryTree,
|
|
1209
1323
|
{
|
|
1210
1324
|
operation: "value",
|
|
@@ -1223,7 +1337,7 @@ export class Project extends BaseClient {
|
|
|
1223
1337
|
*/
|
|
1224
1338
|
extensions() {
|
|
1225
1339
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1226
|
-
const response = yield
|
|
1340
|
+
const response = yield computeQuery([
|
|
1227
1341
|
...this._queryTree,
|
|
1228
1342
|
{
|
|
1229
1343
|
operation: "extensions",
|
|
@@ -1244,6 +1358,7 @@ export class Project extends BaseClient {
|
|
|
1244
1358
|
},
|
|
1245
1359
|
],
|
|
1246
1360
|
host: this.clientHost,
|
|
1361
|
+
sessionToken: this.sessionToken,
|
|
1247
1362
|
});
|
|
1248
1363
|
}
|
|
1249
1364
|
/**
|
|
@@ -1251,7 +1366,7 @@ export class Project extends BaseClient {
|
|
|
1251
1366
|
*/
|
|
1252
1367
|
install() {
|
|
1253
1368
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1254
|
-
const response = yield
|
|
1369
|
+
const response = yield computeQuery([
|
|
1255
1370
|
...this._queryTree,
|
|
1256
1371
|
{
|
|
1257
1372
|
operation: "install",
|
|
@@ -1265,7 +1380,7 @@ export class Project extends BaseClient {
|
|
|
1265
1380
|
*/
|
|
1266
1381
|
name() {
|
|
1267
1382
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1268
|
-
const response = yield
|
|
1383
|
+
const response = yield computeQuery([
|
|
1269
1384
|
...this._queryTree,
|
|
1270
1385
|
{
|
|
1271
1386
|
operation: "name",
|
|
@@ -1279,7 +1394,7 @@ export class Project extends BaseClient {
|
|
|
1279
1394
|
*/
|
|
1280
1395
|
schema() {
|
|
1281
1396
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1282
|
-
const response = yield
|
|
1397
|
+
const response = yield computeQuery([
|
|
1283
1398
|
...this._queryTree,
|
|
1284
1399
|
{
|
|
1285
1400
|
operation: "schema",
|
|
@@ -1293,7 +1408,7 @@ export class Project extends BaseClient {
|
|
|
1293
1408
|
*/
|
|
1294
1409
|
sdk() {
|
|
1295
1410
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1296
|
-
const response = yield
|
|
1411
|
+
const response = yield computeQuery([
|
|
1297
1412
|
...this._queryTree,
|
|
1298
1413
|
{
|
|
1299
1414
|
operation: "sdk",
|
|
@@ -1305,7 +1420,8 @@ export class Project extends BaseClient {
|
|
|
1305
1420
|
}
|
|
1306
1421
|
export default class Client extends BaseClient {
|
|
1307
1422
|
/**
|
|
1308
|
-
*
|
|
1423
|
+
* Constructs a cache volume for a given cache key.
|
|
1424
|
+
* @param key A string identifier to target this cache volume (e.g. "myapp-cache").
|
|
1309
1425
|
*/
|
|
1310
1426
|
cacheVolume(key) {
|
|
1311
1427
|
return new CacheVolume({
|
|
@@ -1317,10 +1433,11 @@ export default class Client extends BaseClient {
|
|
|
1317
1433
|
},
|
|
1318
1434
|
],
|
|
1319
1435
|
host: this.clientHost,
|
|
1436
|
+
sessionToken: this.sessionToken,
|
|
1320
1437
|
});
|
|
1321
1438
|
}
|
|
1322
1439
|
/**
|
|
1323
|
-
*
|
|
1440
|
+
* Loads a container from ID.
|
|
1324
1441
|
* Null ID returns an empty container (scratch).
|
|
1325
1442
|
* Optional platform argument initializes new containers to execute and publish as that platform. Platform defaults to that of the builder's host.
|
|
1326
1443
|
*/
|
|
@@ -1334,6 +1451,7 @@ export default class Client extends BaseClient {
|
|
|
1334
1451
|
},
|
|
1335
1452
|
],
|
|
1336
1453
|
host: this.clientHost,
|
|
1454
|
+
sessionToken: this.sessionToken,
|
|
1337
1455
|
});
|
|
1338
1456
|
}
|
|
1339
1457
|
/**
|
|
@@ -1341,7 +1459,7 @@ export default class Client extends BaseClient {
|
|
|
1341
1459
|
*/
|
|
1342
1460
|
defaultPlatform() {
|
|
1343
1461
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1344
|
-
const response = yield
|
|
1462
|
+
const response = yield computeQuery([
|
|
1345
1463
|
...this._queryTree,
|
|
1346
1464
|
{
|
|
1347
1465
|
operation: "defaultPlatform",
|
|
@@ -1363,10 +1481,11 @@ export default class Client extends BaseClient {
|
|
|
1363
1481
|
},
|
|
1364
1482
|
],
|
|
1365
1483
|
host: this.clientHost,
|
|
1484
|
+
sessionToken: this.sessionToken,
|
|
1366
1485
|
});
|
|
1367
1486
|
}
|
|
1368
1487
|
/**
|
|
1369
|
-
*
|
|
1488
|
+
* Loads a file by ID.
|
|
1370
1489
|
*/
|
|
1371
1490
|
file(id) {
|
|
1372
1491
|
return new File({
|
|
@@ -1378,10 +1497,11 @@ export default class Client extends BaseClient {
|
|
|
1378
1497
|
},
|
|
1379
1498
|
],
|
|
1380
1499
|
host: this.clientHost,
|
|
1500
|
+
sessionToken: this.sessionToken,
|
|
1381
1501
|
});
|
|
1382
1502
|
}
|
|
1383
1503
|
/**
|
|
1384
|
-
*
|
|
1504
|
+
* Queries a git repository.
|
|
1385
1505
|
*/
|
|
1386
1506
|
git(url, opts) {
|
|
1387
1507
|
return new GitRepository({
|
|
@@ -1393,10 +1513,11 @@ export default class Client extends BaseClient {
|
|
|
1393
1513
|
},
|
|
1394
1514
|
],
|
|
1395
1515
|
host: this.clientHost,
|
|
1516
|
+
sessionToken: this.sessionToken,
|
|
1396
1517
|
});
|
|
1397
1518
|
}
|
|
1398
1519
|
/**
|
|
1399
|
-
*
|
|
1520
|
+
* Queries the host environment.
|
|
1400
1521
|
*/
|
|
1401
1522
|
host() {
|
|
1402
1523
|
return new Host({
|
|
@@ -1407,10 +1528,11 @@ export default class Client extends BaseClient {
|
|
|
1407
1528
|
},
|
|
1408
1529
|
],
|
|
1409
1530
|
host: this.clientHost,
|
|
1531
|
+
sessionToken: this.sessionToken,
|
|
1410
1532
|
});
|
|
1411
1533
|
}
|
|
1412
1534
|
/**
|
|
1413
|
-
*
|
|
1535
|
+
* Returns a file containing an http remote url content.
|
|
1414
1536
|
*/
|
|
1415
1537
|
http(url) {
|
|
1416
1538
|
return new File({
|
|
@@ -1422,6 +1544,7 @@ export default class Client extends BaseClient {
|
|
|
1422
1544
|
},
|
|
1423
1545
|
],
|
|
1424
1546
|
host: this.clientHost,
|
|
1547
|
+
sessionToken: this.sessionToken,
|
|
1425
1548
|
});
|
|
1426
1549
|
}
|
|
1427
1550
|
/**
|
|
@@ -1437,10 +1560,11 @@ export default class Client extends BaseClient {
|
|
|
1437
1560
|
},
|
|
1438
1561
|
],
|
|
1439
1562
|
host: this.clientHost,
|
|
1563
|
+
sessionToken: this.sessionToken,
|
|
1440
1564
|
});
|
|
1441
1565
|
}
|
|
1442
1566
|
/**
|
|
1443
|
-
*
|
|
1567
|
+
* Loads a secret from its ID.
|
|
1444
1568
|
*/
|
|
1445
1569
|
secret(id) {
|
|
1446
1570
|
return new Secret({
|
|
@@ -1452,10 +1576,11 @@ export default class Client extends BaseClient {
|
|
|
1452
1576
|
},
|
|
1453
1577
|
],
|
|
1454
1578
|
host: this.clientHost,
|
|
1579
|
+
sessionToken: this.sessionToken,
|
|
1455
1580
|
});
|
|
1456
1581
|
}
|
|
1457
1582
|
/**
|
|
1458
|
-
*
|
|
1583
|
+
* Loads a socket by its ID.
|
|
1459
1584
|
*/
|
|
1460
1585
|
socket(opts) {
|
|
1461
1586
|
return new Socket({
|
|
@@ -1467,19 +1592,20 @@ export default class Client extends BaseClient {
|
|
|
1467
1592
|
},
|
|
1468
1593
|
],
|
|
1469
1594
|
host: this.clientHost,
|
|
1595
|
+
sessionToken: this.sessionToken,
|
|
1470
1596
|
});
|
|
1471
1597
|
}
|
|
1472
1598
|
}
|
|
1473
1599
|
/**
|
|
1474
|
-
* A reference to a secret value, which can be handled more safely than the value itself
|
|
1600
|
+
* A reference to a secret value, which can be handled more safely than the value itself.
|
|
1475
1601
|
*/
|
|
1476
1602
|
export class Secret extends BaseClient {
|
|
1477
1603
|
/**
|
|
1478
|
-
* The identifier for this secret
|
|
1604
|
+
* The identifier for this secret.
|
|
1479
1605
|
*/
|
|
1480
1606
|
id() {
|
|
1481
1607
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1482
|
-
const response = yield
|
|
1608
|
+
const response = yield computeQuery([
|
|
1483
1609
|
...this._queryTree,
|
|
1484
1610
|
{
|
|
1485
1611
|
operation: "id",
|
|
@@ -1489,11 +1615,11 @@ export class Secret extends BaseClient {
|
|
|
1489
1615
|
});
|
|
1490
1616
|
}
|
|
1491
1617
|
/**
|
|
1492
|
-
* The value of this secret
|
|
1618
|
+
* The value of this secret.
|
|
1493
1619
|
*/
|
|
1494
1620
|
plaintext() {
|
|
1495
1621
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1496
|
-
const response = yield
|
|
1622
|
+
const response = yield computeQuery([
|
|
1497
1623
|
...this._queryTree,
|
|
1498
1624
|
{
|
|
1499
1625
|
operation: "plaintext",
|
|
@@ -1505,11 +1631,11 @@ export class Secret extends BaseClient {
|
|
|
1505
1631
|
}
|
|
1506
1632
|
export class Socket extends BaseClient {
|
|
1507
1633
|
/**
|
|
1508
|
-
* The content-addressed identifier of the socket
|
|
1634
|
+
* The content-addressed identifier of the socket.
|
|
1509
1635
|
*/
|
|
1510
1636
|
id() {
|
|
1511
1637
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1512
|
-
const response = yield
|
|
1638
|
+
const response = yield computeQuery([
|
|
1513
1639
|
...this._queryTree,
|
|
1514
1640
|
{
|
|
1515
1641
|
operation: "id",
|