@dagger.io/dagger 0.3.0 → 0.3.2

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