@dagger.io/dagger 0.1.0-alpha.4 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/README.md +1 -1
  2. package/dist/api/client.gen.d.ts +67 -26
  3. package/dist/api/client.gen.d.ts.map +1 -1
  4. package/dist/api/client.gen.js +566 -336
  5. package/dist/api/utils.d.ts.map +1 -1
  6. package/dist/api/utils.js +14 -15
  7. package/dist/connect.d.ts +7 -6
  8. package/dist/connect.d.ts.map +1 -1
  9. package/dist/connect.js +4 -4
  10. package/dist/index.d.ts +2 -2
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +2 -2
  13. package/dist/provisioning/bin/bin.d.ts +21 -0
  14. package/dist/provisioning/bin/bin.d.ts.map +1 -0
  15. package/dist/provisioning/bin/bin.js +112 -0
  16. package/dist/provisioning/bin/index.d.ts +2 -0
  17. package/dist/provisioning/bin/index.d.ts.map +1 -0
  18. package/dist/provisioning/bin/index.js +1 -0
  19. package/dist/provisioning/default.d.ts.map +1 -1
  20. package/dist/provisioning/default.js +2 -1
  21. package/dist/provisioning/docker-provision/image.d.ts +1 -0
  22. package/dist/provisioning/docker-provision/image.d.ts.map +1 -1
  23. package/dist/provisioning/docker-provision/image.js +37 -19
  24. package/dist/provisioning/docker-provision/index.d.ts +1 -1
  25. package/dist/provisioning/docker-provision/index.d.ts.map +1 -1
  26. package/dist/provisioning/docker-provision/index.js +1 -1
  27. package/dist/provisioning/engineconn.d.ts +3 -2
  28. package/dist/provisioning/engineconn.d.ts.map +1 -1
  29. package/dist/provisioning/http/http.d.ts.map +1 -1
  30. package/dist/provisioning/http/http.js +1 -0
  31. package/dist/provisioning/http/index.d.ts.map +1 -1
  32. package/dist/provisioning/index.d.ts +4 -4
  33. package/dist/provisioning/index.d.ts.map +1 -1
  34. package/dist/provisioning/index.js +4 -4
  35. package/dist/provisioning/provisioner.d.ts.map +1 -1
  36. package/dist/provisioning/provisioner.js +2 -0
  37. package/package.json +10 -6
  38. package/dist/api/types.d.ts +0 -302
  39. package/dist/api/types.d.ts.map +0 -1
  40. package/dist/api/types.js +0 -1
@@ -14,20 +14,31 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
14
14
  import { GraphQLClient, gql } from "graphql-request";
15
15
  import { queryBuilder, queryFlatten } from "./utils.js";
16
16
  class BaseClient {
17
+ /**
18
+ * @hidden
19
+ */
17
20
  constructor({ queryTree, host } = {}) {
18
21
  this._queryTree = queryTree || [];
19
- this._host = host || "127.0.0.1:8080";
22
+ this.clientHost = host || "127.0.0.1:8080";
20
23
  this.client = new GraphQLClient(`http://${host}/query`);
21
24
  }
25
+ /**
26
+ * @hidden
27
+ */
22
28
  get queryTree() {
23
29
  return this._queryTree;
24
30
  }
31
+ /**
32
+ * @hidden
33
+ */
25
34
  _compute() {
26
35
  return __awaiter(this, void 0, void 0, function* () {
27
36
  try {
28
37
  // run the query and return the result.
29
38
  const query = queryBuilder(this._queryTree);
30
- const computeQuery = yield this.client.request(gql `${query}`);
39
+ const computeQuery = yield this.client.request(gql `
40
+ ${query}
41
+ `);
31
42
  return queryFlatten(computeQuery);
32
43
  }
33
44
  catch (error) {
@@ -40,14 +51,14 @@ class BaseClient {
40
51
  /**
41
52
  * A directory whose contents persist across runs
42
53
  */
43
- class CacheVolume extends BaseClient {
54
+ export class CacheVolume extends BaseClient {
44
55
  id() {
45
56
  return __awaiter(this, void 0, void 0, function* () {
46
57
  this._queryTree = [
47
58
  ...this._queryTree,
48
59
  {
49
- operation: 'id'
50
- }
60
+ operation: "id",
61
+ },
51
62
  ];
52
63
  const response = yield this._compute();
53
64
  return response;
@@ -57,18 +68,21 @@ class CacheVolume extends BaseClient {
57
68
  /**
58
69
  * An OCI-compatible container, also known as a docker container
59
70
  */
60
- class Container extends BaseClient {
71
+ export class Container extends BaseClient {
61
72
  /**
62
73
  * Initialize this container from a Dockerfile build
63
74
  */
64
75
  build(context, dockerfile) {
65
- return new Container({ queryTree: [
76
+ return new Container({
77
+ queryTree: [
66
78
  ...this._queryTree,
67
79
  {
68
- operation: 'build',
69
- args: { context, dockerfile }
70
- }
71
- ], host: this._host });
80
+ operation: "build",
81
+ args: { context, dockerfile },
82
+ },
83
+ ],
84
+ host: this.clientHost,
85
+ });
72
86
  }
73
87
  /**
74
88
  * Default arguments for future commands
@@ -78,8 +92,8 @@ class Container extends BaseClient {
78
92
  this._queryTree = [
79
93
  ...this._queryTree,
80
94
  {
81
- operation: 'defaultArgs'
82
- }
95
+ operation: "defaultArgs",
96
+ },
83
97
  ];
84
98
  const response = yield this._compute();
85
99
  return response;
@@ -89,13 +103,16 @@ class Container extends BaseClient {
89
103
  * Retrieve a directory at the given path. Mounts are included.
90
104
  */
91
105
  directory(path) {
92
- return new Directory({ queryTree: [
106
+ return new Directory({
107
+ queryTree: [
93
108
  ...this._queryTree,
94
109
  {
95
- operation: 'directory',
96
- args: { path }
97
- }
98
- ], host: this._host });
110
+ operation: "directory",
111
+ args: { path },
112
+ },
113
+ ],
114
+ host: this.clientHost,
115
+ });
99
116
  }
100
117
  /**
101
118
  * Entrypoint to be prepended to the arguments of all commands
@@ -105,8 +122,8 @@ class Container extends BaseClient {
105
122
  this._queryTree = [
106
123
  ...this._queryTree,
107
124
  {
108
- operation: 'entrypoint'
109
- }
125
+ operation: "entrypoint",
126
+ },
110
127
  ];
111
128
  const response = yield this._compute();
112
129
  return response;
@@ -120,9 +137,9 @@ class Container extends BaseClient {
120
137
  this._queryTree = [
121
138
  ...this._queryTree,
122
139
  {
123
- operation: 'envVariable',
124
- args: { name }
125
- }
140
+ operation: "envVariable",
141
+ args: { name },
142
+ },
126
143
  ];
127
144
  const response = yield this._compute();
128
145
  return response;
@@ -136,8 +153,8 @@ class Container extends BaseClient {
136
153
  this._queryTree = [
137
154
  ...this._queryTree,
138
155
  {
139
- operation: 'envVariables'
140
- }
156
+ operation: "envVariables",
157
+ },
141
158
  ];
142
159
  const response = yield this._compute();
143
160
  return response;
@@ -145,15 +162,26 @@ class Container extends BaseClient {
145
162
  }
146
163
  /**
147
164
  * This container after executing the specified command inside it
165
+ *
166
+ * @deprecated Replaced by withExec.
148
167
  */
149
168
  exec(args, stdin, redirectStdout, redirectStderr, experimentalPrivilegedNesting) {
150
- return new Container({ queryTree: [
151
- ...this._queryTree,
152
- {
153
- operation: 'exec',
154
- args: { args, stdin, redirectStdout, redirectStderr, experimentalPrivilegedNesting }
155
- }
156
- ], host: this._host });
169
+ return new Container({
170
+ queryTree: [
171
+ ...this._queryTree,
172
+ {
173
+ operation: "exec",
174
+ args: {
175
+ args,
176
+ stdin,
177
+ redirectStdout,
178
+ redirectStderr,
179
+ experimentalPrivilegedNesting,
180
+ },
181
+ },
182
+ ],
183
+ host: this.clientHost,
184
+ });
157
185
  }
158
186
  /**
159
187
  * Exit code of the last executed command. Zero means success.
@@ -164,8 +192,8 @@ class Container extends BaseClient {
164
192
  this._queryTree = [
165
193
  ...this._queryTree,
166
194
  {
167
- operation: 'exitCode'
168
- }
195
+ operation: "exitCode",
196
+ },
169
197
  ];
170
198
  const response = yield this._compute();
171
199
  return response;
@@ -179,9 +207,9 @@ class Container extends BaseClient {
179
207
  this._queryTree = [
180
208
  ...this._queryTree,
181
209
  {
182
- operation: 'export',
183
- args: { path, platformVariants }
184
- }
210
+ operation: "export",
211
+ args: { path, platformVariants },
212
+ },
185
213
  ];
186
214
  const response = yield this._compute();
187
215
  return response;
@@ -191,36 +219,47 @@ class Container extends BaseClient {
191
219
  * Retrieve a file at the given path. Mounts are included.
192
220
  */
193
221
  file(path) {
194
- return new File({ queryTree: [
222
+ return new File({
223
+ queryTree: [
195
224
  ...this._queryTree,
196
225
  {
197
- operation: 'file',
198
- args: { path }
199
- }
200
- ], host: this._host });
226
+ operation: "file",
227
+ args: { path },
228
+ },
229
+ ],
230
+ host: this.clientHost,
231
+ });
201
232
  }
202
233
  /**
203
234
  * Initialize this container from the base image published at the given address
204
235
  */
205
236
  from(address) {
206
- return new Container({ queryTree: [
237
+ return new Container({
238
+ queryTree: [
207
239
  ...this._queryTree,
208
240
  {
209
- operation: 'from',
210
- args: { address }
211
- }
212
- ], host: this._host });
241
+ operation: "from",
242
+ args: { address },
243
+ },
244
+ ],
245
+ host: this.clientHost,
246
+ });
213
247
  }
214
248
  /**
215
249
  * This container's root filesystem. Mounts are not included.
250
+ *
251
+ * @deprecated Replaced by rootfs.
216
252
  */
217
253
  fs() {
218
- return new Directory({ queryTree: [
254
+ return new Directory({
255
+ queryTree: [
219
256
  ...this._queryTree,
220
257
  {
221
- operation: 'fs'
222
- }
223
- ], host: this._host });
258
+ operation: "fs",
259
+ },
260
+ ],
261
+ host: this.clientHost,
262
+ });
224
263
  }
225
264
  /**
226
265
  * A unique identifier for this container
@@ -230,8 +269,8 @@ class Container extends BaseClient {
230
269
  this._queryTree = [
231
270
  ...this._queryTree,
232
271
  {
233
- operation: 'id'
234
- }
272
+ operation: "id",
273
+ },
235
274
  ];
236
275
  const response = yield this._compute();
237
276
  return response;
@@ -245,8 +284,8 @@ class Container extends BaseClient {
245
284
  this._queryTree = [
246
285
  ...this._queryTree,
247
286
  {
248
- operation: 'mounts'
249
- }
287
+ operation: "mounts",
288
+ },
250
289
  ];
251
290
  const response = yield this._compute();
252
291
  return response;
@@ -260,8 +299,8 @@ class Container extends BaseClient {
260
299
  this._queryTree = [
261
300
  ...this._queryTree,
262
301
  {
263
- operation: 'platform'
264
- }
302
+ operation: "platform",
303
+ },
265
304
  ];
266
305
  const response = yield this._compute();
267
306
  return response;
@@ -275,37 +314,59 @@ class Container extends BaseClient {
275
314
  this._queryTree = [
276
315
  ...this._queryTree,
277
316
  {
278
- operation: 'publish',
279
- args: { address, platformVariants }
280
- }
317
+ operation: "publish",
318
+ args: { address, platformVariants },
319
+ },
281
320
  ];
282
321
  const response = yield this._compute();
283
322
  return response;
284
323
  });
285
324
  }
325
+ /**
326
+ * This container's root filesystem. Mounts are not included.
327
+ */
328
+ rootfs() {
329
+ return new Directory({
330
+ queryTree: [
331
+ ...this._queryTree,
332
+ {
333
+ operation: "rootfs",
334
+ },
335
+ ],
336
+ host: this.clientHost,
337
+ });
338
+ }
286
339
  /**
287
340
  * The error stream of the last executed command.
288
341
  * Null if no command has been executed.
289
342
  */
290
343
  stderr() {
291
- return new File({ queryTree: [
344
+ return __awaiter(this, void 0, void 0, function* () {
345
+ this._queryTree = [
292
346
  ...this._queryTree,
293
347
  {
294
- operation: 'stderr'
295
- }
296
- ], host: this._host });
348
+ operation: "stderr",
349
+ },
350
+ ];
351
+ const response = yield this._compute();
352
+ return response;
353
+ });
297
354
  }
298
355
  /**
299
356
  * The output stream of the last executed command.
300
357
  * Null if no command has been executed.
301
358
  */
302
359
  stdout() {
303
- return new File({ queryTree: [
360
+ return __awaiter(this, void 0, void 0, function* () {
361
+ this._queryTree = [
304
362
  ...this._queryTree,
305
363
  {
306
- operation: 'stdout'
307
- }
308
- ], host: this._host });
364
+ operation: "stdout",
365
+ },
366
+ ];
367
+ const response = yield this._compute();
368
+ return response;
369
+ });
309
370
  }
310
371
  /**
311
372
  * The user to be set for all commands
@@ -315,8 +376,8 @@ class Container extends BaseClient {
315
376
  this._queryTree = [
316
377
  ...this._queryTree,
317
378
  {
318
- operation: 'user'
319
- }
379
+ operation: "user",
380
+ },
320
381
  ];
321
382
  const response = yield this._compute();
322
383
  return response;
@@ -326,169 +387,249 @@ class Container extends BaseClient {
326
387
  * Configures default arguments for future commands
327
388
  */
328
389
  withDefaultArgs(args) {
329
- return new Container({ queryTree: [
390
+ return new Container({
391
+ queryTree: [
330
392
  ...this._queryTree,
331
393
  {
332
- operation: 'withDefaultArgs',
333
- args: { args }
334
- }
335
- ], host: this._host });
394
+ operation: "withDefaultArgs",
395
+ args: { args },
396
+ },
397
+ ],
398
+ host: this.clientHost,
399
+ });
336
400
  }
337
401
  /**
338
402
  * This container but with a different command entrypoint
339
403
  */
340
404
  withEntrypoint(args) {
341
- return new Container({ queryTree: [
405
+ return new Container({
406
+ queryTree: [
342
407
  ...this._queryTree,
343
408
  {
344
- operation: 'withEntrypoint',
345
- args: { args }
346
- }
347
- ], host: this._host });
409
+ operation: "withEntrypoint",
410
+ args: { args },
411
+ },
412
+ ],
413
+ host: this.clientHost,
414
+ });
348
415
  }
349
416
  /**
350
417
  * This container plus the given environment variable
351
418
  */
352
419
  withEnvVariable(name, value) {
353
- return new Container({ queryTree: [
420
+ return new Container({
421
+ queryTree: [
354
422
  ...this._queryTree,
355
423
  {
356
- operation: 'withEnvVariable',
357
- args: { name, value }
358
- }
359
- ], host: this._host });
424
+ operation: "withEnvVariable",
425
+ args: { name, value },
426
+ },
427
+ ],
428
+ host: this.clientHost,
429
+ });
430
+ }
431
+ /**
432
+ * This container after executing the specified command inside it
433
+ */
434
+ withExec(args, stdin, redirectStdout, redirectStderr, experimentalPrivilegedNesting) {
435
+ return new Container({
436
+ queryTree: [
437
+ ...this._queryTree,
438
+ {
439
+ operation: "withExec",
440
+ args: {
441
+ args,
442
+ stdin,
443
+ redirectStdout,
444
+ redirectStderr,
445
+ experimentalPrivilegedNesting,
446
+ },
447
+ },
448
+ ],
449
+ host: this.clientHost,
450
+ });
360
451
  }
361
452
  /**
362
453
  * Initialize this container from this DirectoryID
454
+ *
455
+ * @deprecated Replaced by withRootfs.
363
456
  */
364
457
  withFS(id) {
365
- return new Container({ queryTree: [
458
+ return new Container({
459
+ queryTree: [
366
460
  ...this._queryTree,
367
461
  {
368
- operation: 'withFS',
369
- args: { id }
370
- }
371
- ], host: this._host });
462
+ operation: "withFS",
463
+ args: { id },
464
+ },
465
+ ],
466
+ host: this.clientHost,
467
+ });
372
468
  }
373
469
  /**
374
470
  * This container plus a cache volume mounted at the given path
375
471
  */
376
472
  withMountedCache(path, cache, source) {
377
- return new Container({ queryTree: [
473
+ return new Container({
474
+ queryTree: [
378
475
  ...this._queryTree,
379
476
  {
380
- operation: 'withMountedCache',
381
- args: { path, cache, source }
382
- }
383
- ], host: this._host });
477
+ operation: "withMountedCache",
478
+ args: { path, cache, source },
479
+ },
480
+ ],
481
+ host: this.clientHost,
482
+ });
384
483
  }
385
484
  /**
386
485
  * This container plus a directory mounted at the given path
387
486
  */
388
487
  withMountedDirectory(path, source) {
389
- return new Container({ queryTree: [
488
+ return new Container({
489
+ queryTree: [
390
490
  ...this._queryTree,
391
491
  {
392
- operation: 'withMountedDirectory',
393
- args: { path, source }
394
- }
395
- ], host: this._host });
492
+ operation: "withMountedDirectory",
493
+ args: { path, source },
494
+ },
495
+ ],
496
+ host: this.clientHost,
497
+ });
396
498
  }
397
499
  /**
398
500
  * This container plus a file mounted at the given path
399
501
  */
400
502
  withMountedFile(path, source) {
401
- return new Container({ queryTree: [
503
+ return new Container({
504
+ queryTree: [
402
505
  ...this._queryTree,
403
506
  {
404
- operation: 'withMountedFile',
405
- args: { path, source }
406
- }
407
- ], host: this._host });
507
+ operation: "withMountedFile",
508
+ args: { path, source },
509
+ },
510
+ ],
511
+ host: this.clientHost,
512
+ });
408
513
  }
409
514
  /**
410
515
  * This container plus a secret mounted into a file at the given path
411
516
  */
412
517
  withMountedSecret(path, source) {
413
- return new Container({ queryTree: [
518
+ return new Container({
519
+ queryTree: [
414
520
  ...this._queryTree,
415
521
  {
416
- operation: 'withMountedSecret',
417
- args: { path, source }
418
- }
419
- ], host: this._host });
522
+ operation: "withMountedSecret",
523
+ args: { path, source },
524
+ },
525
+ ],
526
+ host: this.clientHost,
527
+ });
420
528
  }
421
529
  /**
422
530
  * This container plus a temporary directory mounted at the given path
423
531
  */
424
532
  withMountedTemp(path) {
425
- return new Container({ queryTree: [
533
+ return new Container({
534
+ queryTree: [
426
535
  ...this._queryTree,
427
536
  {
428
- operation: 'withMountedTemp',
429
- args: { path }
430
- }
431
- ], host: this._host });
537
+ operation: "withMountedTemp",
538
+ args: { path },
539
+ },
540
+ ],
541
+ host: this.clientHost,
542
+ });
543
+ }
544
+ /**
545
+ * Initialize this container from this DirectoryID
546
+ */
547
+ withRootfs(id) {
548
+ return new Container({
549
+ queryTree: [
550
+ ...this._queryTree,
551
+ {
552
+ operation: "withRootfs",
553
+ args: { id },
554
+ },
555
+ ],
556
+ host: this.clientHost,
557
+ });
432
558
  }
433
559
  /**
434
560
  * This container plus an env variable containing the given secret
435
561
  */
436
562
  withSecretVariable(name, secret) {
437
- return new Container({ queryTree: [
563
+ return new Container({
564
+ queryTree: [
438
565
  ...this._queryTree,
439
566
  {
440
- operation: 'withSecretVariable',
441
- args: { name, secret }
442
- }
443
- ], host: this._host });
567
+ operation: "withSecretVariable",
568
+ args: { name, secret },
569
+ },
570
+ ],
571
+ host: this.clientHost,
572
+ });
444
573
  }
445
574
  /**
446
575
  * This container but with a different command user
447
576
  */
448
577
  withUser(name) {
449
- return new Container({ queryTree: [
578
+ return new Container({
579
+ queryTree: [
450
580
  ...this._queryTree,
451
581
  {
452
- operation: 'withUser',
453
- args: { name }
454
- }
455
- ], host: this._host });
582
+ operation: "withUser",
583
+ args: { name },
584
+ },
585
+ ],
586
+ host: this.clientHost,
587
+ });
456
588
  }
457
589
  /**
458
590
  * This container but with a different working directory
459
591
  */
460
592
  withWorkdir(path) {
461
- return new Container({ queryTree: [
593
+ return new Container({
594
+ queryTree: [
462
595
  ...this._queryTree,
463
596
  {
464
- operation: 'withWorkdir',
465
- args: { path }
466
- }
467
- ], host: this._host });
597
+ operation: "withWorkdir",
598
+ args: { path },
599
+ },
600
+ ],
601
+ host: this.clientHost,
602
+ });
468
603
  }
469
604
  /**
470
605
  * This container minus the given environment variable
471
606
  */
472
607
  withoutEnvVariable(name) {
473
- return new Container({ queryTree: [
608
+ return new Container({
609
+ queryTree: [
474
610
  ...this._queryTree,
475
611
  {
476
- operation: 'withoutEnvVariable',
477
- args: { name }
478
- }
479
- ], host: this._host });
612
+ operation: "withoutEnvVariable",
613
+ args: { name },
614
+ },
615
+ ],
616
+ host: this.clientHost,
617
+ });
480
618
  }
481
619
  /**
482
620
  * This container after unmounting everything at the given path.
483
621
  */
484
622
  withoutMount(path) {
485
- return new Container({ queryTree: [
623
+ return new Container({
624
+ queryTree: [
486
625
  ...this._queryTree,
487
626
  {
488
- operation: 'withoutMount',
489
- args: { path }
490
- }
491
- ], host: this._host });
627
+ operation: "withoutMount",
628
+ args: { path },
629
+ },
630
+ ],
631
+ host: this.clientHost,
632
+ });
492
633
  }
493
634
  /**
494
635
  * The working directory for all commands
@@ -498,8 +639,8 @@ class Container extends BaseClient {
498
639
  this._queryTree = [
499
640
  ...this._queryTree,
500
641
  {
501
- operation: 'workdir'
502
- }
642
+ operation: "workdir",
643
+ },
503
644
  ];
504
645
  const response = yield this._compute();
505
646
  return response;
@@ -509,30 +650,36 @@ class Container extends BaseClient {
509
650
  /**
510
651
  * A directory
511
652
  */
512
- class Directory extends BaseClient {
653
+ export class Directory extends BaseClient {
513
654
  /**
514
655
  * The difference between this directory and an another directory
515
656
  */
516
657
  diff(other) {
517
- return new Directory({ queryTree: [
658
+ return new Directory({
659
+ queryTree: [
518
660
  ...this._queryTree,
519
661
  {
520
- operation: 'diff',
521
- args: { other }
522
- }
523
- ], host: this._host });
662
+ operation: "diff",
663
+ args: { other },
664
+ },
665
+ ],
666
+ host: this.clientHost,
667
+ });
524
668
  }
525
669
  /**
526
670
  * Retrieve a directory at the given path
527
671
  */
528
672
  directory(path) {
529
- return new Directory({ queryTree: [
673
+ return new Directory({
674
+ queryTree: [
530
675
  ...this._queryTree,
531
676
  {
532
- operation: 'directory',
533
- args: { path }
534
- }
535
- ], host: this._host });
677
+ operation: "directory",
678
+ args: { path },
679
+ },
680
+ ],
681
+ host: this.clientHost,
682
+ });
536
683
  }
537
684
  /**
538
685
  * Return a list of files and directories at the given path
@@ -542,9 +689,9 @@ class Directory extends BaseClient {
542
689
  this._queryTree = [
543
690
  ...this._queryTree,
544
691
  {
545
- operation: 'entries',
546
- args: { path }
547
- }
692
+ operation: "entries",
693
+ args: { path },
694
+ },
548
695
  ];
549
696
  const response = yield this._compute();
550
697
  return response;
@@ -558,9 +705,9 @@ class Directory extends BaseClient {
558
705
  this._queryTree = [
559
706
  ...this._queryTree,
560
707
  {
561
- operation: 'export',
562
- args: { path }
563
- }
708
+ operation: "export",
709
+ args: { path },
710
+ },
564
711
  ];
565
712
  const response = yield this._compute();
566
713
  return response;
@@ -570,13 +717,16 @@ class Directory extends BaseClient {
570
717
  * Retrieve a file at the given path
571
718
  */
572
719
  file(path) {
573
- return new File({ queryTree: [
720
+ return new File({
721
+ queryTree: [
574
722
  ...this._queryTree,
575
723
  {
576
- operation: 'file',
577
- args: { path }
578
- }
579
- ], host: this._host });
724
+ operation: "file",
725
+ args: { path },
726
+ },
727
+ ],
728
+ host: this.clientHost,
729
+ });
580
730
  }
581
731
  /**
582
732
  * The content-addressed identifier of the directory
@@ -586,8 +736,8 @@ class Directory extends BaseClient {
586
736
  this._queryTree = [
587
737
  ...this._queryTree,
588
738
  {
589
- operation: 'id'
590
- }
739
+ operation: "id",
740
+ },
591
741
  ];
592
742
  const response = yield this._compute();
593
743
  return response;
@@ -597,91 +747,112 @@ class Directory extends BaseClient {
597
747
  * load a project's metadata
598
748
  */
599
749
  loadProject(configPath) {
600
- return new Project({ queryTree: [
750
+ return new Project({
751
+ queryTree: [
601
752
  ...this._queryTree,
602
753
  {
603
- operation: 'loadProject',
604
- args: { configPath }
605
- }
606
- ], host: this._host });
754
+ operation: "loadProject",
755
+ args: { configPath },
756
+ },
757
+ ],
758
+ host: this.clientHost,
759
+ });
607
760
  }
608
761
  /**
609
762
  * This directory plus a directory written at the given path
610
763
  */
611
764
  withDirectory(path, directory, exclude, include) {
612
- return new Directory({ queryTree: [
765
+ return new Directory({
766
+ queryTree: [
613
767
  ...this._queryTree,
614
768
  {
615
- operation: 'withDirectory',
616
- args: { path, directory, exclude, include }
617
- }
618
- ], host: this._host });
769
+ operation: "withDirectory",
770
+ args: { path, directory, exclude, include },
771
+ },
772
+ ],
773
+ host: this.clientHost,
774
+ });
619
775
  }
620
776
  /**
621
777
  * This directory plus the contents of the given file copied to the given path
622
778
  */
623
779
  withFile(path, source) {
624
- return new Directory({ queryTree: [
780
+ return new Directory({
781
+ queryTree: [
625
782
  ...this._queryTree,
626
783
  {
627
- operation: 'withFile',
628
- args: { path, source }
629
- }
630
- ], host: this._host });
784
+ operation: "withFile",
785
+ args: { path, source },
786
+ },
787
+ ],
788
+ host: this.clientHost,
789
+ });
631
790
  }
632
791
  /**
633
792
  * This directory plus a new directory created at the given path
634
793
  */
635
794
  withNewDirectory(path) {
636
- return new Directory({ queryTree: [
795
+ return new Directory({
796
+ queryTree: [
637
797
  ...this._queryTree,
638
798
  {
639
- operation: 'withNewDirectory',
640
- args: { path }
641
- }
642
- ], host: this._host });
799
+ operation: "withNewDirectory",
800
+ args: { path },
801
+ },
802
+ ],
803
+ host: this.clientHost,
804
+ });
643
805
  }
644
806
  /**
645
807
  * This directory plus a new file written at the given path
646
808
  */
647
809
  withNewFile(path, contents) {
648
- return new Directory({ queryTree: [
810
+ return new Directory({
811
+ queryTree: [
649
812
  ...this._queryTree,
650
813
  {
651
- operation: 'withNewFile',
652
- args: { path, contents }
653
- }
654
- ], host: this._host });
814
+ operation: "withNewFile",
815
+ args: { path, contents },
816
+ },
817
+ ],
818
+ host: this.clientHost,
819
+ });
655
820
  }
656
821
  /**
657
822
  * This directory with the directory at the given path removed
658
823
  */
659
824
  withoutDirectory(path) {
660
- return new Directory({ queryTree: [
825
+ return new Directory({
826
+ queryTree: [
661
827
  ...this._queryTree,
662
828
  {
663
- operation: 'withoutDirectory',
664
- args: { path }
665
- }
666
- ], host: this._host });
829
+ operation: "withoutDirectory",
830
+ args: { path },
831
+ },
832
+ ],
833
+ host: this.clientHost,
834
+ });
667
835
  }
668
836
  /**
669
837
  * This directory with the file at the given path removed
670
838
  */
671
839
  withoutFile(path) {
672
- return new Directory({ queryTree: [
840
+ return new Directory({
841
+ queryTree: [
673
842
  ...this._queryTree,
674
843
  {
675
- operation: 'withoutFile',
676
- args: { path }
677
- }
678
- ], host: this._host });
844
+ operation: "withoutFile",
845
+ args: { path },
846
+ },
847
+ ],
848
+ host: this.clientHost,
849
+ });
679
850
  }
680
851
  }
681
852
  /**
682
853
  * EnvVariable is a simple key value object that represents an environment variable.
683
854
  */
684
- class EnvVariable extends BaseClient {
855
+ export class EnvVariable extends BaseClient {
685
856
  /**
686
857
  * name is the environment variable name.
687
858
  */
@@ -690,8 +861,8 @@ class EnvVariable extends BaseClient {
690
861
  this._queryTree = [
691
862
  ...this._queryTree,
692
863
  {
693
- operation: 'name'
694
- }
864
+ operation: "name",
865
+ },
695
866
  ];
696
867
  const response = yield this._compute();
697
868
  return response;
@@ -705,8 +876,8 @@ class EnvVariable extends BaseClient {
705
876
  this._queryTree = [
706
877
  ...this._queryTree,
707
878
  {
708
- operation: 'value'
709
- }
879
+ operation: "value",
880
+ },
710
881
  ];
711
882
  const response = yield this._compute();
712
883
  return response;
@@ -716,7 +887,7 @@ class EnvVariable extends BaseClient {
716
887
  /**
717
888
  * A file
718
889
  */
719
- class File extends BaseClient {
890
+ export class File extends BaseClient {
720
891
  /**
721
892
  * The contents of the file
722
893
  */
@@ -725,8 +896,8 @@ class File extends BaseClient {
725
896
  this._queryTree = [
726
897
  ...this._queryTree,
727
898
  {
728
- operation: 'contents'
729
- }
899
+ operation: "contents",
900
+ },
730
901
  ];
731
902
  const response = yield this._compute();
732
903
  return response;
@@ -740,9 +911,9 @@ class File extends BaseClient {
740
911
  this._queryTree = [
741
912
  ...this._queryTree,
742
913
  {
743
- operation: 'export',
744
- args: { path }
745
- }
914
+ operation: "export",
915
+ args: { path },
916
+ },
746
917
  ];
747
918
  const response = yield this._compute();
748
919
  return response;
@@ -756,20 +927,23 @@ class File extends BaseClient {
756
927
  this._queryTree = [
757
928
  ...this._queryTree,
758
929
  {
759
- operation: 'id'
760
- }
930
+ operation: "id",
931
+ },
761
932
  ];
762
933
  const response = yield this._compute();
763
934
  return response;
764
935
  });
765
936
  }
766
937
  secret() {
767
- return new Secret({ queryTree: [
938
+ return new Secret({
939
+ queryTree: [
768
940
  ...this._queryTree,
769
941
  {
770
- operation: 'secret'
771
- }
772
- ], host: this._host });
942
+ operation: "secret",
943
+ },
944
+ ],
945
+ host: this.clientHost,
946
+ });
773
947
  }
774
948
  /**
775
949
  * The size of the file, in bytes
@@ -779,8 +953,8 @@ class File extends BaseClient {
779
953
  this._queryTree = [
780
954
  ...this._queryTree,
781
955
  {
782
- operation: 'size'
783
- }
956
+ operation: "size",
957
+ },
784
958
  ];
785
959
  const response = yield this._compute();
786
960
  return response;
@@ -790,7 +964,7 @@ class File extends BaseClient {
790
964
  /**
791
965
  * A git ref (tag or branch)
792
966
  */
793
- class GitRef extends BaseClient {
967
+ export class GitRef extends BaseClient {
794
968
  /**
795
969
  * The digest of the current value of this ref
796
970
  */
@@ -799,8 +973,8 @@ class GitRef extends BaseClient {
799
973
  this._queryTree = [
800
974
  ...this._queryTree,
801
975
  {
802
- operation: 'digest'
803
- }
976
+ operation: "digest",
977
+ },
804
978
  ];
805
979
  const response = yield this._compute();
806
980
  return response;
@@ -810,29 +984,35 @@ class GitRef extends BaseClient {
810
984
  * The filesystem tree at this ref
811
985
  */
812
986
  tree() {
813
- return new Directory({ queryTree: [
987
+ return new Directory({
988
+ queryTree: [
814
989
  ...this._queryTree,
815
990
  {
816
- operation: 'tree'
817
- }
818
- ], host: this._host });
991
+ operation: "tree",
992
+ },
993
+ ],
994
+ host: this.clientHost,
995
+ });
819
996
  }
820
997
  }
821
998
  /**
822
999
  * A git repository
823
1000
  */
824
- class GitRepository extends BaseClient {
1001
+ export class GitRepository extends BaseClient {
825
1002
  /**
826
1003
  * Details on one branch
827
1004
  */
828
1005
  branch(name) {
829
- return new GitRef({ queryTree: [
1006
+ return new GitRef({
1007
+ queryTree: [
830
1008
  ...this._queryTree,
831
1009
  {
832
- operation: 'branch',
833
- args: { name }
834
- }
835
- ], host: this._host });
1010
+ operation: "branch",
1011
+ args: { name },
1012
+ },
1013
+ ],
1014
+ host: this.clientHost,
1015
+ });
836
1016
  }
837
1017
  /**
838
1018
  * List of branches on the repository
@@ -842,8 +1022,8 @@ class GitRepository extends BaseClient {
842
1022
  this._queryTree = [
843
1023
  ...this._queryTree,
844
1024
  {
845
- operation: 'branches'
846
- }
1025
+ operation: "branches",
1026
+ },
847
1027
  ];
848
1028
  const response = yield this._compute();
849
1029
  return response;
@@ -853,25 +1033,31 @@ class GitRepository extends BaseClient {
853
1033
  * Details on one commit
854
1034
  */
855
1035
  commit(id) {
856
- return new GitRef({ queryTree: [
1036
+ return new GitRef({
1037
+ queryTree: [
857
1038
  ...this._queryTree,
858
1039
  {
859
- operation: 'commit',
860
- args: { id }
861
- }
862
- ], host: this._host });
1040
+ operation: "commit",
1041
+ args: { id },
1042
+ },
1043
+ ],
1044
+ host: this.clientHost,
1045
+ });
863
1046
  }
864
1047
  /**
865
1048
  * Details on one tag
866
1049
  */
867
1050
  tag(name) {
868
- return new GitRef({ queryTree: [
1051
+ return new GitRef({
1052
+ queryTree: [
869
1053
  ...this._queryTree,
870
1054
  {
871
- operation: 'tag',
872
- args: { name }
873
- }
874
- ], host: this._host });
1055
+ operation: "tag",
1056
+ args: { name },
1057
+ },
1058
+ ],
1059
+ host: this.clientHost,
1060
+ });
875
1061
  }
876
1062
  /**
877
1063
  * List of tags on the repository
@@ -881,8 +1067,8 @@ class GitRepository extends BaseClient {
881
1067
  this._queryTree = [
882
1068
  ...this._queryTree,
883
1069
  {
884
- operation: 'tags'
885
- }
1070
+ operation: "tags",
1071
+ },
886
1072
  ];
887
1073
  const response = yield this._compute();
888
1074
  return response;
@@ -892,58 +1078,72 @@ class GitRepository extends BaseClient {
892
1078
  /**
893
1079
  * Information about the host execution environment
894
1080
  */
895
- class Host extends BaseClient {
1081
+ export class Host extends BaseClient {
896
1082
  /**
897
1083
  * Access a directory on the host
898
1084
  */
899
1085
  directory(path, exclude, include) {
900
- return new Directory({ queryTree: [
1086
+ return new Directory({
1087
+ queryTree: [
901
1088
  ...this._queryTree,
902
1089
  {
903
- operation: 'directory',
904
- args: { path, exclude, include }
905
- }
906
- ], host: this._host });
1090
+ operation: "directory",
1091
+ args: { path, exclude, include },
1092
+ },
1093
+ ],
1094
+ host: this.clientHost,
1095
+ });
907
1096
  }
908
1097
  /**
909
1098
  * Lookup the value of an environment variable. Null if the variable is not available.
910
1099
  */
911
1100
  envVariable(name) {
912
- return new HostVariable({ queryTree: [
1101
+ return new HostVariable({
1102
+ queryTree: [
913
1103
  ...this._queryTree,
914
1104
  {
915
- operation: 'envVariable',
916
- args: { name }
917
- }
918
- ], host: this._host });
1105
+ operation: "envVariable",
1106
+ args: { name },
1107
+ },
1108
+ ],
1109
+ host: this.clientHost,
1110
+ });
919
1111
  }
920
1112
  /**
921
1113
  * The current working directory on the host
1114
+ *
1115
+ * @deprecated Use directory with path set to '.' instead.
922
1116
  */
923
1117
  workdir(exclude, include) {
924
- return new Directory({ queryTree: [
1118
+ return new Directory({
1119
+ queryTree: [
925
1120
  ...this._queryTree,
926
1121
  {
927
- operation: 'workdir',
928
- args: { exclude, include }
929
- }
930
- ], host: this._host });
1122
+ operation: "workdir",
1123
+ args: { exclude, include },
1124
+ },
1125
+ ],
1126
+ host: this.clientHost,
1127
+ });
931
1128
  }
932
1129
  }
933
1130
  /**
934
1131
  * An environment variable on the host environment
935
1132
  */
936
- class HostVariable extends BaseClient {
1133
+ export class HostVariable extends BaseClient {
937
1134
  /**
938
1135
  * A secret referencing the value of this variable
939
1136
  */
940
1137
  secret() {
941
- return new Secret({ queryTree: [
1138
+ return new Secret({
1139
+ queryTree: [
942
1140
  ...this._queryTree,
943
1141
  {
944
- operation: 'secret'
945
- }
946
- ], host: this._host });
1142
+ operation: "secret",
1143
+ },
1144
+ ],
1145
+ host: this.clientHost,
1146
+ });
947
1147
  }
948
1148
  /**
949
1149
  * The value of this variable
@@ -953,8 +1153,8 @@ class HostVariable extends BaseClient {
953
1153
  this._queryTree = [
954
1154
  ...this._queryTree,
955
1155
  {
956
- operation: 'value'
957
- }
1156
+ operation: "value",
1157
+ },
958
1158
  ];
959
1159
  const response = yield this._compute();
960
1160
  return response;
@@ -964,7 +1164,7 @@ class HostVariable extends BaseClient {
964
1164
  /**
965
1165
  * A set of scripts and/or extensions
966
1166
  */
967
- class Project extends BaseClient {
1167
+ export class Project extends BaseClient {
968
1168
  /**
969
1169
  * extensions in this project
970
1170
  */
@@ -973,8 +1173,8 @@ class Project extends BaseClient {
973
1173
  this._queryTree = [
974
1174
  ...this._queryTree,
975
1175
  {
976
- operation: 'extensions'
977
- }
1176
+ operation: "extensions",
1177
+ },
978
1178
  ];
979
1179
  const response = yield this._compute();
980
1180
  return response;
@@ -984,12 +1184,15 @@ class Project extends BaseClient {
984
1184
  * Code files generated by the SDKs in the project
985
1185
  */
986
1186
  generatedCode() {
987
- return new Directory({ queryTree: [
1187
+ return new Directory({
1188
+ queryTree: [
988
1189
  ...this._queryTree,
989
1190
  {
990
- operation: 'generatedCode'
991
- }
992
- ], host: this._host });
1191
+ operation: "generatedCode",
1192
+ },
1193
+ ],
1194
+ host: this.clientHost,
1195
+ });
993
1196
  }
994
1197
  /**
995
1198
  * install the project's schema
@@ -999,8 +1202,8 @@ class Project extends BaseClient {
999
1202
  this._queryTree = [
1000
1203
  ...this._queryTree,
1001
1204
  {
1002
- operation: 'install'
1003
- }
1205
+ operation: "install",
1206
+ },
1004
1207
  ];
1005
1208
  const response = yield this._compute();
1006
1209
  return response;
@@ -1014,8 +1217,8 @@ class Project extends BaseClient {
1014
1217
  this._queryTree = [
1015
1218
  ...this._queryTree,
1016
1219
  {
1017
- operation: 'name'
1018
- }
1220
+ operation: "name",
1221
+ },
1019
1222
  ];
1020
1223
  const response = yield this._compute();
1021
1224
  return response;
@@ -1029,8 +1232,8 @@ class Project extends BaseClient {
1029
1232
  this._queryTree = [
1030
1233
  ...this._queryTree,
1031
1234
  {
1032
- operation: 'schema'
1033
- }
1235
+ operation: "schema",
1236
+ },
1034
1237
  ];
1035
1238
  const response = yield this._compute();
1036
1239
  return response;
@@ -1044,8 +1247,8 @@ class Project extends BaseClient {
1044
1247
  this._queryTree = [
1045
1248
  ...this._queryTree,
1046
1249
  {
1047
- operation: 'sdk'
1048
- }
1250
+ operation: "sdk",
1251
+ },
1049
1252
  ];
1050
1253
  const response = yield this._compute();
1051
1254
  return response;
@@ -1057,13 +1260,16 @@ export default class Client extends BaseClient {
1057
1260
  * Construct a cache volume for a given cache key
1058
1261
  */
1059
1262
  cacheVolume(key) {
1060
- return new CacheVolume({ queryTree: [
1263
+ return new CacheVolume({
1264
+ queryTree: [
1061
1265
  ...this._queryTree,
1062
1266
  {
1063
- operation: 'cacheVolume',
1064
- args: { key }
1065
- }
1066
- ], host: this._host });
1267
+ operation: "cacheVolume",
1268
+ args: { key },
1269
+ },
1270
+ ],
1271
+ host: this.clientHost,
1272
+ });
1067
1273
  }
1068
1274
  /**
1069
1275
  * Load a container from ID.
@@ -1071,13 +1277,16 @@ export default class Client extends BaseClient {
1071
1277
  * Optional platform argument initializes new containers to execute and publish as that platform. Platform defaults to that of the builder's host.
1072
1278
  */
1073
1279
  container(id, platform) {
1074
- return new Container({ queryTree: [
1280
+ return new Container({
1281
+ queryTree: [
1075
1282
  ...this._queryTree,
1076
1283
  {
1077
- operation: 'container',
1078
- args: { id, platform }
1079
- }
1080
- ], host: this._host });
1284
+ operation: "container",
1285
+ args: { id, platform },
1286
+ },
1287
+ ],
1288
+ host: this.clientHost,
1289
+ });
1081
1290
  }
1082
1291
  /**
1083
1292
  * The default platform of the builder.
@@ -1087,8 +1296,8 @@ export default class Client extends BaseClient {
1087
1296
  this._queryTree = [
1088
1297
  ...this._queryTree,
1089
1298
  {
1090
- operation: 'defaultPlatform'
1091
- }
1299
+ operation: "defaultPlatform",
1300
+ },
1092
1301
  ];
1093
1302
  const response = yield this._compute();
1094
1303
  return response;
@@ -1098,90 +1307,111 @@ export default class Client extends BaseClient {
1098
1307
  * Load a directory by ID. No argument produces an empty directory.
1099
1308
  */
1100
1309
  directory(id) {
1101
- return new Directory({ queryTree: [
1310
+ return new Directory({
1311
+ queryTree: [
1102
1312
  ...this._queryTree,
1103
1313
  {
1104
- operation: 'directory',
1105
- args: { id }
1106
- }
1107
- ], host: this._host });
1314
+ operation: "directory",
1315
+ args: { id },
1316
+ },
1317
+ ],
1318
+ host: this.clientHost,
1319
+ });
1108
1320
  }
1109
1321
  /**
1110
1322
  * Load a file by ID
1111
1323
  */
1112
1324
  file(id) {
1113
- return new File({ queryTree: [
1325
+ return new File({
1326
+ queryTree: [
1114
1327
  ...this._queryTree,
1115
1328
  {
1116
- operation: 'file',
1117
- args: { id }
1118
- }
1119
- ], host: this._host });
1329
+ operation: "file",
1330
+ args: { id },
1331
+ },
1332
+ ],
1333
+ host: this.clientHost,
1334
+ });
1120
1335
  }
1121
1336
  /**
1122
1337
  * Query a git repository
1123
1338
  */
1124
1339
  git(url, keepGitDir) {
1125
- return new GitRepository({ queryTree: [
1340
+ return new GitRepository({
1341
+ queryTree: [
1126
1342
  ...this._queryTree,
1127
1343
  {
1128
- operation: 'git',
1129
- args: { url, keepGitDir }
1130
- }
1131
- ], host: this._host });
1344
+ operation: "git",
1345
+ args: { url, keepGitDir },
1346
+ },
1347
+ ],
1348
+ host: this.clientHost,
1349
+ });
1132
1350
  }
1133
1351
  /**
1134
1352
  * Query the host environment
1135
1353
  */
1136
1354
  host() {
1137
- return new Host({ queryTree: [
1355
+ return new Host({
1356
+ queryTree: [
1138
1357
  ...this._queryTree,
1139
1358
  {
1140
- operation: 'host'
1141
- }
1142
- ], host: this._host });
1359
+ operation: "host",
1360
+ },
1361
+ ],
1362
+ host: this.clientHost,
1363
+ });
1143
1364
  }
1144
1365
  /**
1145
1366
  * An http remote
1146
1367
  */
1147
1368
  http(url) {
1148
- return new File({ queryTree: [
1369
+ return new File({
1370
+ queryTree: [
1149
1371
  ...this._queryTree,
1150
1372
  {
1151
- operation: 'http',
1152
- args: { url }
1153
- }
1154
- ], host: this._host });
1373
+ operation: "http",
1374
+ args: { url },
1375
+ },
1376
+ ],
1377
+ host: this.clientHost,
1378
+ });
1155
1379
  }
1156
1380
  /**
1157
1381
  * Look up a project by name
1158
1382
  */
1159
1383
  project(name) {
1160
- return new Project({ queryTree: [
1384
+ return new Project({
1385
+ queryTree: [
1161
1386
  ...this._queryTree,
1162
1387
  {
1163
- operation: 'project',
1164
- args: { name }
1165
- }
1166
- ], host: this._host });
1388
+ operation: "project",
1389
+ args: { name },
1390
+ },
1391
+ ],
1392
+ host: this.clientHost,
1393
+ });
1167
1394
  }
1168
1395
  /**
1169
1396
  * Load a secret from its ID
1170
1397
  */
1171
1398
  secret(id) {
1172
- return new Secret({ queryTree: [
1399
+ return new Secret({
1400
+ queryTree: [
1173
1401
  ...this._queryTree,
1174
1402
  {
1175
- operation: 'secret',
1176
- args: { id }
1177
- }
1178
- ], host: this._host });
1403
+ operation: "secret",
1404
+ args: { id },
1405
+ },
1406
+ ],
1407
+ host: this.clientHost,
1408
+ });
1179
1409
  }
1180
1410
  }
1181
1411
  /**
1182
1412
  * A reference to a secret value, which can be handled more safely than the value itself
1183
1413
  */
1184
- class Secret extends BaseClient {
1414
+ export class Secret extends BaseClient {
1185
1415
  /**
1186
1416
  * The identifier for this secret
1187
1417
  */
@@ -1190,8 +1420,8 @@ class Secret extends BaseClient {
1190
1420
  this._queryTree = [
1191
1421
  ...this._queryTree,
1192
1422
  {
1193
- operation: 'id'
1194
- }
1423
+ operation: "id",
1424
+ },
1195
1425
  ];
1196
1426
  const response = yield this._compute();
1197
1427
  return response;
@@ -1205,8 +1435,8 @@ class Secret extends BaseClient {
1205
1435
  this._queryTree = [
1206
1436
  ...this._queryTree,
1207
1437
  {
1208
- operation: 'plaintext'
1209
- }
1438
+ operation: "plaintext",
1439
+ },
1210
1440
  ];
1211
1441
  const response = yield this._compute();
1212
1442
  return response;