@dagger.io/dagger 0.3.3 → 0.3.5

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.
@@ -53,6 +53,20 @@ export var CacheSharingMode;
53
53
  */
54
54
  CacheSharingMode[CacheSharingMode["Shared"] = 2] = "Shared";
55
55
  })(CacheSharingMode || (CacheSharingMode = {}));
56
+ /**
57
+ * Transport layer network protocol associated to a port.
58
+ */
59
+ export var NetworkProtocol;
60
+ (function (NetworkProtocol) {
61
+ /**
62
+ * TCP (Transmission Control Protocol)
63
+ */
64
+ NetworkProtocol[NetworkProtocol["Tcp"] = 0] = "Tcp";
65
+ /**
66
+ * UDP (User Datagram Protocol)
67
+ */
68
+ NetworkProtocol[NetworkProtocol["Udp"] = 1] = "Udp";
69
+ })(NetworkProtocol || (NetworkProtocol = {}));
56
70
  /**
57
71
  * A directory whose contents persist across runs.
58
72
  */
@@ -68,16 +82,41 @@ export class CacheVolume extends BaseClient {
68
82
  return response;
69
83
  });
70
84
  }
85
+ /**
86
+ * Chain objects together
87
+ * @example
88
+ * ```ts
89
+ * function AddAFewMounts(c) {
90
+ * return c
91
+ * .withMountedDirectory("/foo", new Client().host().directory("/Users/slumbering/forks/dagger"))
92
+ * .withMountedDirectory("/bar", new Client().host().directory("/Users/slumbering/forks/dagger/sdk/nodejs"))
93
+ * }
94
+ *
95
+ * connect(async (client) => {
96
+ * const tree = await client
97
+ * .container()
98
+ * .from("alpine")
99
+ * .withWorkdir("/foo")
100
+ * .with(AddAFewMounts)
101
+ * .withExec(["ls", "-lh"])
102
+ * .stdout()
103
+ * })
104
+ *```
105
+ */
106
+ with(arg) {
107
+ return arg(this);
108
+ }
71
109
  }
72
110
  /**
73
111
  * An OCI-compatible container, also known as a docker container.
74
112
  */
75
113
  export class Container extends BaseClient {
76
114
  /**
77
- * Initializes this container from a Dockerfile build, using the context, a dockerfile file path and some additional buildArgs.
115
+ * Initializes this container from a Dockerfile build.
78
116
  * @param context Directory context used by the Dockerfile.
79
117
  * @param opts.dockerfile Path to the Dockerfile to use.
80
- Defaults to './Dockerfile'.
118
+ *
119
+ * Default: './Dockerfile'.
81
120
  * @param opts.buildArgs Additional build arguments.
82
121
  * @param opts.target Target build stage to build.
83
122
  */
@@ -109,7 +148,10 @@ export class Container extends BaseClient {
109
148
  });
110
149
  }
111
150
  /**
112
- * Retrieves a directory at the given path. Mounts are included.
151
+ * Retrieves a directory at the given path.
152
+ *
153
+ * Mounts are included.
154
+ * @param path The path of the directory to retrieve (e.g., "./src").
113
155
  */
114
156
  directory(path) {
115
157
  return new Directory({
@@ -124,6 +166,27 @@ export class Container extends BaseClient {
124
166
  sessionToken: this.sessionToken,
125
167
  });
126
168
  }
169
+ /**
170
+ * Retrieves an endpoint that clients can use to reach this container.
171
+ *
172
+ * If no port is specified, the first exposed port is used. If none exist an error is returned.
173
+ *
174
+ * If a scheme is specified, a URL is returned. Otherwise, a host:port pair is returned.
175
+ * @param opts.port The exposed port number for the endpoint
176
+ * @param opts.scheme Return a URL with the given scheme, eg. http for http://
177
+ */
178
+ endpoint(opts) {
179
+ return __awaiter(this, void 0, void 0, function* () {
180
+ const response = yield computeQuery([
181
+ ...this._queryTree,
182
+ {
183
+ operation: "endpoint",
184
+ args: Object.assign({}, opts),
185
+ },
186
+ ], this.client);
187
+ return response;
188
+ });
189
+ }
127
190
  /**
128
191
  * Retrieves entrypoint to be prepended to the arguments of all commands.
129
192
  */
@@ -140,6 +203,7 @@ export class Container extends BaseClient {
140
203
  }
141
204
  /**
142
205
  * Retrieves the value of the specified environment variable.
206
+ * @param name The name of the environment variable to retrieve (e.g., "PATH").
143
207
  */
144
208
  envVariable(name) {
145
209
  return __awaiter(this, void 0, void 0, function* () {
@@ -169,13 +233,13 @@ export class Container extends BaseClient {
169
233
  }
170
234
  /**
171
235
  * Retrieves this container after executing the specified command inside it.
172
- * @param opts.args Command to run instead of the container's default command.
173
- * @param opts.stdin Content to write to the command's standard input before closing.
174
- * @param opts.redirectStdout Redirect the command's standard output to a file in the container.
175
- * @param opts.redirectStderr Redirect the command's standard error to a file in the container.
236
+ * @param opts.args Command to run instead of the container's default command (e.g., ["run", "main.go"]).
237
+ * @param opts.stdin Content to write to the command's standard input before closing (e.g., "Hello world").
238
+ * @param opts.redirectStdout Redirect the command's standard output to a file in the container (e.g., "/tmp/stdout").
239
+ * @param opts.redirectStderr Redirect the command's standard error to a file in the container (e.g., "/tmp/stderr").
176
240
  * @param opts.experimentalPrivilegedNesting Provide dagger access to the executed command.
177
- Do not use this option unless you trust the command being executed.
178
- The command being executed WILL BE GRANTED FULL ACCESS TO YOUR HOST FILESYSTEM.
241
+ * Do not use this option unless you trust the command being executed.
242
+ * The command being executed WILL BE GRANTED FULL ACCESS TO YOUR HOST FILESYSTEM.
179
243
  * @deprecated Replaced by withExec.
180
244
  */
181
245
  exec(opts) {
@@ -207,12 +271,14 @@ export class Container extends BaseClient {
207
271
  });
208
272
  }
209
273
  /**
210
- * Writes the container as an OCI tarball to the destination file path on the host for the specified platformVariants.
274
+ * Writes the container as an OCI tarball to the destination file path on the host for the specified platform variants.
275
+ *
211
276
  * Return true on success.
212
- * @param path Host's destination path.
213
- Path can be relative to the engine's workdir or absolute.
277
+ * It can also publishes platform variants.
278
+ * @param path Host's destination path (e.g., "./tarball").
279
+ * Path can be relative to the engine's workdir or absolute.
214
280
  * @param opts.platformVariants Identifiers for other platform specific containers.
215
- Used for multi-platform image.
281
+ * Used for multi-platform image.
216
282
  */
217
283
  export(path, opts) {
218
284
  return __awaiter(this, void 0, void 0, function* () {
@@ -227,7 +293,24 @@ export class Container extends BaseClient {
227
293
  });
228
294
  }
229
295
  /**
230
- * Retrieves a file at the given path. Mounts are included.
296
+ * Retrieves the list of exposed ports
297
+ */
298
+ exposedPorts() {
299
+ return __awaiter(this, void 0, void 0, function* () {
300
+ const response = yield computeQuery([
301
+ ...this._queryTree,
302
+ {
303
+ operation: "exposedPorts",
304
+ },
305
+ ], this.client);
306
+ return response;
307
+ });
308
+ }
309
+ /**
310
+ * Retrieves a file at the given path.
311
+ *
312
+ * Mounts are included.
313
+ * @param path The path of the file to retrieve (e.g., "./README.md").
231
314
  */
232
315
  file(path) {
233
316
  return new File({
@@ -243,9 +326,10 @@ export class Container extends BaseClient {
243
326
  });
244
327
  }
245
328
  /**
246
- * Initializes this container from the base image published at the given address.
329
+ * Initializes this container from a pulled base image.
247
330
  * @param address Image's address from its registry.
248
- Formatted as [host]/[user]/[repo]:[tag] (e.g. docker.io/dagger/dagger:main).
331
+ *
332
+ * Formatted as [host]/[user]/[repo]:[tag] (e.g., "docker.io/dagger/dagger:main").
249
333
  */
250
334
  from(address) {
251
335
  return new Container({
@@ -276,6 +360,20 @@ export class Container extends BaseClient {
276
360
  sessionToken: this.sessionToken,
277
361
  });
278
362
  }
363
+ /**
364
+ * Retrieves a hostname which can be used by clients to reach this container.
365
+ */
366
+ hostname() {
367
+ return __awaiter(this, void 0, void 0, function* () {
368
+ const response = yield computeQuery([
369
+ ...this._queryTree,
370
+ {
371
+ operation: "hostname",
372
+ },
373
+ ], this.client);
374
+ return response;
375
+ });
376
+ }
279
377
  /**
280
378
  * A unique identifier for this container.
281
379
  */
@@ -290,6 +388,20 @@ export class Container extends BaseClient {
290
388
  return response;
291
389
  });
292
390
  }
391
+ /**
392
+ * The unique image reference which can only be retrieved immediately after the 'Container.From' call.
393
+ */
394
+ imageRef() {
395
+ return __awaiter(this, void 0, void 0, function* () {
396
+ const response = yield computeQuery([
397
+ ...this._queryTree,
398
+ {
399
+ operation: "imageRef",
400
+ },
401
+ ], this.client);
402
+ return response;
403
+ });
404
+ }
293
405
  /**
294
406
  * Retrieves the value of the specified label.
295
407
  */
@@ -364,11 +476,15 @@ export class Container extends BaseClient {
364
476
  });
365
477
  }
366
478
  /**
367
- * Publishes this container as a new image to the specified address, for the platformVariants, returning a fully qualified ref.
479
+ * Publishes this container as a new image to the specified address.
480
+ *
481
+ * Publish returns a fully qualified ref.
482
+ * It can also publish platform variants.
368
483
  * @param address Registry's address to publish the image to.
369
- Formatted as [host]/[user]/[repo]:[tag] (e.g. docker.io/dagger/dagger:main).
484
+ *
485
+ * Formatted as [host]/[user]/[repo]:[tag] (e.g. "docker.io/dagger/dagger:main").
370
486
  * @param opts.platformVariants Identifiers for other platform specific containers.
371
- Used for multi-platform image.
487
+ * Used for multi-platform image.
372
488
  */
373
489
  publish(address, opts) {
374
490
  return __awaiter(this, void 0, void 0, function* () {
@@ -443,6 +559,7 @@ export class Container extends BaseClient {
443
559
  }
444
560
  /**
445
561
  * Configures default arguments for future commands.
562
+ * @param opts.args Arguments to prepend to future executions (e.g., ["-v", "--no-cache"]).
446
563
  */
447
564
  withDefaultArgs(opts) {
448
565
  return new Container({
@@ -459,6 +576,10 @@ export class Container extends BaseClient {
459
576
  }
460
577
  /**
461
578
  * Retrieves this container plus a directory written at the given path.
579
+ * @param path Location of the written directory (e.g., "/tmp/directory").
580
+ * @param directory Identifier of the directory to write
581
+ * @param opts.exclude Patterns to exclude in the written directory (e.g., ["node_modules/**", ".gitignore", ".git/"]).
582
+ * @param opts.include Patterns to include in the written directory (e.g., ["*.go", "go.mod", "go.sum"]).
462
583
  */
463
584
  withDirectory(path, directory, opts) {
464
585
  return new Container({
@@ -475,6 +596,7 @@ export class Container extends BaseClient {
475
596
  }
476
597
  /**
477
598
  * Retrieves this container but with a different command entrypoint.
599
+ * @param args Entrypoint to use for future executions (e.g., ["go", "run"]).
478
600
  */
479
601
  withEntrypoint(args) {
480
602
  return new Container({
@@ -491,6 +613,8 @@ export class Container extends BaseClient {
491
613
  }
492
614
  /**
493
615
  * Retrieves this container plus the given environment variable.
616
+ * @param name The name of the environment variable (e.g., "HOST").
617
+ * @param value The value of the environment variable. (e.g., "localhost").
494
618
  */
495
619
  withEnvVariable(name, value) {
496
620
  return new Container({
@@ -507,13 +631,14 @@ export class Container extends BaseClient {
507
631
  }
508
632
  /**
509
633
  * Retrieves this container after executing the specified command inside it.
510
- * @param args Command to run instead of the container's default command.
511
- * @param opts.stdin Content to write to the command's standard input before closing.
512
- * @param opts.redirectStdout Redirect the command's standard output to a file in the container.
513
- * @param opts.redirectStderr Redirect the command's standard error to a file in the container.
514
- * @param opts.experimentalPrivilegedNesting Provide dagger access to the executed command.
515
- Do not use this option unless you trust the command being executed.
516
- The command being executed WILL BE GRANTED FULL ACCESS TO YOUR HOST FILESYSTEM.
634
+ * @param args Command to run instead of the container's default command (e.g., ["run", "main.go"]).
635
+ * @param opts.stdin Content to write to the command's standard input before closing (e.g., "Hello world").
636
+ * @param opts.redirectStdout Redirect the command's standard output to a file in the container (e.g., "/tmp/stdout").
637
+ * @param opts.redirectStderr Redirect the command's standard error to a file in the container (e.g., "/tmp/stderr").
638
+ * @param opts.experimentalPrivilegedNesting Provides dagger access to the executed command.
639
+ *
640
+ * Do not use this option unless you trust the command being executed.
641
+ * The command being executed WILL BE GRANTED FULL ACCESS TO YOUR HOST FILESYSTEM.
517
642
  */
518
643
  withExec(args, opts) {
519
644
  return new Container({
@@ -528,6 +653,28 @@ export class Container extends BaseClient {
528
653
  sessionToken: this.sessionToken,
529
654
  });
530
655
  }
656
+ /**
657
+ * Expose a network port.
658
+ * Exposed ports serve two purposes:
659
+ * - For health checks and introspection, when running services
660
+ * - For setting the EXPOSE OCI field when publishing the container
661
+ * @param port Port number to expose
662
+ * @param opts.protocol Transport layer network protocol
663
+ * @param opts.description Optional port description
664
+ */
665
+ withExposedPort(port, opts) {
666
+ return new Container({
667
+ queryTree: [
668
+ ...this._queryTree,
669
+ {
670
+ operation: "withExposedPort",
671
+ args: Object.assign({ port }, opts),
672
+ },
673
+ ],
674
+ host: this.clientHost,
675
+ sessionToken: this.sessionToken,
676
+ });
677
+ }
531
678
  /**
532
679
  * Initializes this container from this DirectoryID.
533
680
  * @deprecated Replaced by withRootfs.
@@ -547,6 +694,11 @@ export class Container extends BaseClient {
547
694
  }
548
695
  /**
549
696
  * Retrieves this container plus the contents of the given file copied to the given path.
697
+ * @param path Location of the copied file (e.g., "/tmp/file.txt").
698
+ * @param source Identifier of the file to copy.
699
+ * @param opts.permissions Permission given to the copied file (e.g., 0600).
700
+ *
701
+ * Default: 0644.
550
702
  */
551
703
  withFile(path, source, opts) {
552
704
  return new Container({
@@ -563,6 +715,8 @@ export class Container extends BaseClient {
563
715
  }
564
716
  /**
565
717
  * Retrieves this container plus the given label.
718
+ * @param name The name of the label (e.g., "org.opencontainers.artifact.created").
719
+ * @param value The value of the label (e.g., "2023-01-01T00:00:00Z").
566
720
  */
567
721
  withLabel(name, value) {
568
722
  return new Container({
@@ -579,9 +733,9 @@ export class Container extends BaseClient {
579
733
  }
580
734
  /**
581
735
  * Retrieves this container plus a cache volume mounted at the given path.
582
- * @param path Path to mount the cache volume at.
583
- * @param cache ID of the cache to mount.
584
- * @param opts.source Directory to use as the cache volume's root.
736
+ * @param path Location of the cache directory (e.g., "/cache/node_modules").
737
+ * @param cache Identifier of the cache volume to mount.
738
+ * @param opts.source Identifier of the directory to use as the cache volume's root.
585
739
  * @param opts.sharing Sharing mode of the cache volume.
586
740
  */
587
741
  withMountedCache(path, cache, opts) {
@@ -599,6 +753,8 @@ export class Container extends BaseClient {
599
753
  }
600
754
  /**
601
755
  * Retrieves this container plus a directory mounted at the given path.
756
+ * @param path Location of the mounted directory (e.g., "/mnt/directory").
757
+ * @param source Identifier of the mounted directory.
602
758
  */
603
759
  withMountedDirectory(path, source) {
604
760
  return new Container({
@@ -615,6 +771,8 @@ export class Container extends BaseClient {
615
771
  }
616
772
  /**
617
773
  * Retrieves this container plus a file mounted at the given path.
774
+ * @param path Location of the mounted file (e.g., "/tmp/file.txt").
775
+ * @param source Identifier of the mounted file.
618
776
  */
619
777
  withMountedFile(path, source) {
620
778
  return new Container({
@@ -631,6 +789,8 @@ export class Container extends BaseClient {
631
789
  }
632
790
  /**
633
791
  * Retrieves this container plus a secret mounted into a file at the given path.
792
+ * @param path Location of the secret file (e.g., "/tmp/secret.txt").
793
+ * @param source Identifier of the secret to mount.
634
794
  */
635
795
  withMountedSecret(path, source) {
636
796
  return new Container({
@@ -647,6 +807,7 @@ export class Container extends BaseClient {
647
807
  }
648
808
  /**
649
809
  * Retrieves this container plus a temporary directory mounted at the given path.
810
+ * @param path Location of the temporary directory (e.g., "/tmp/temp_dir").
650
811
  */
651
812
  withMountedTemp(path) {
652
813
  return new Container({
@@ -663,6 +824,11 @@ export class Container extends BaseClient {
663
824
  }
664
825
  /**
665
826
  * Retrieves this container plus a new file written at the given path.
827
+ * @param path Location of the written file (e.g., "/tmp/file.txt").
828
+ * @param opts.contents Content of the file to write (e.g., "Hello world!").
829
+ * @param opts.permissions Permission given to the written file (e.g., 0600).
830
+ *
831
+ * Default: 0644.
666
832
  */
667
833
  withNewFile(path, opts) {
668
834
  return new Container({
@@ -680,7 +846,7 @@ export class Container extends BaseClient {
680
846
  /**
681
847
  * Retrieves this container with a registry authentication for a given address.
682
848
  * @param address Registry's address to bind the authentication to.
683
- Formatted as [host]/[user]/[repo]:[tag] (e.g. docker.io/dagger/dagger:main).
849
+ * Formatted as [host]/[user]/[repo]:[tag] (e.g. docker.io/dagger/dagger:main).
684
850
  * @param username The username of the registry's account (e.g., "Dagger").
685
851
  * @param secret The API key, password or token to authenticate to this registry.
686
852
  */
@@ -715,6 +881,8 @@ export class Container extends BaseClient {
715
881
  }
716
882
  /**
717
883
  * Retrieves this container plus an env variable containing the given secret.
884
+ * @param name The name of the secret variable (e.g., "API_SECRET").
885
+ * @param secret The identifier of the secret value.
718
886
  */
719
887
  withSecretVariable(name, secret) {
720
888
  return new Container({
@@ -729,8 +897,32 @@ export class Container extends BaseClient {
729
897
  sessionToken: this.sessionToken,
730
898
  });
731
899
  }
900
+ /**
901
+ * Establish a runtime dependency on a service. The service will be started automatically when needed and detached when it is no longer needed.
902
+ *
903
+ * The service will be reachable from the container via the provided hostname alias.
904
+ *
905
+ * The service dependency will also convey to any files or directories produced by the container.
906
+ * @param alias A name that can be used to reach the service from the container
907
+ * @param service Identifier of the service container
908
+ */
909
+ withServiceBinding(alias, service) {
910
+ return new Container({
911
+ queryTree: [
912
+ ...this._queryTree,
913
+ {
914
+ operation: "withServiceBinding",
915
+ args: { alias, service },
916
+ },
917
+ ],
918
+ host: this.clientHost,
919
+ sessionToken: this.sessionToken,
920
+ });
921
+ }
732
922
  /**
733
923
  * Retrieves this container plus a socket forwarded to the given Unix socket path.
924
+ * @param path Location of the forwarded Unix socket (e.g., "/tmp/socket").
925
+ * @param source Identifier of the socket to forward.
734
926
  */
735
927
  withUnixSocket(path, source) {
736
928
  return new Container({
@@ -746,7 +938,8 @@ export class Container extends BaseClient {
746
938
  });
747
939
  }
748
940
  /**
749
- * Retrieves this containers with a different command user.
941
+ * Retrieves this container with a different command user.
942
+ * @param name The user to set (e.g., "root").
750
943
  */
751
944
  withUser(name) {
752
945
  return new Container({
@@ -763,6 +956,7 @@ export class Container extends BaseClient {
763
956
  }
764
957
  /**
765
958
  * Retrieves this container with a different working directory.
959
+ * @param path The path to set as the working directory (e.g., "/app").
766
960
  */
767
961
  withWorkdir(path) {
768
962
  return new Container({
@@ -779,6 +973,7 @@ export class Container extends BaseClient {
779
973
  }
780
974
  /**
781
975
  * Retrieves this container minus the given environment variable.
976
+ * @param name The name of the environment variable (e.g., "HOST").
782
977
  */
783
978
  withoutEnvVariable(name) {
784
979
  return new Container({
@@ -793,8 +988,27 @@ export class Container extends BaseClient {
793
988
  sessionToken: this.sessionToken,
794
989
  });
795
990
  }
991
+ /**
992
+ * Unexpose a previously exposed port.
993
+ * @param port Port number to unexpose
994
+ * @param opts.protocol Port protocol to unexpose
995
+ */
996
+ withoutExposedPort(port, opts) {
997
+ return new Container({
998
+ queryTree: [
999
+ ...this._queryTree,
1000
+ {
1001
+ operation: "withoutExposedPort",
1002
+ args: Object.assign({ port }, opts),
1003
+ },
1004
+ ],
1005
+ host: this.clientHost,
1006
+ sessionToken: this.sessionToken,
1007
+ });
1008
+ }
796
1009
  /**
797
1010
  * Retrieves this container minus the given environment label.
1011
+ * @param name The name of the label to remove (e.g., "org.opencontainers.artifact.created").
798
1012
  */
799
1013
  withoutLabel(name) {
800
1014
  return new Container({
@@ -811,6 +1025,7 @@ export class Container extends BaseClient {
811
1025
  }
812
1026
  /**
813
1027
  * Retrieves this container after unmounting everything at the given path.
1028
+ * @param path Location of the cache directory (e.g., "/cache/node_modules").
814
1029
  */
815
1030
  withoutMount(path) {
816
1031
  return new Container({
@@ -828,7 +1043,7 @@ export class Container extends BaseClient {
828
1043
  /**
829
1044
  * Retrieves this container without the registry authentication of a given address.
830
1045
  * @param address Registry's address to remove the authentication from.
831
- Formatted as [host]/[user]/[repo]:[tag] (e.g. docker.io/dagger/dagger:main).
1046
+ * Formatted as [host]/[user]/[repo]:[tag] (e.g. docker.io/dagger/dagger:main).
832
1047
  */
833
1048
  withoutRegistryAuth(address) {
834
1049
  return new Container({
@@ -845,6 +1060,7 @@ export class Container extends BaseClient {
845
1060
  }
846
1061
  /**
847
1062
  * Retrieves this container with a previously added Unix socket removed.
1063
+ * @param path Location of the socket to remove (e.g., "/tmp/socket").
848
1064
  */
849
1065
  withoutUnixSocket(path) {
850
1066
  return new Container({
@@ -873,6 +1089,30 @@ export class Container extends BaseClient {
873
1089
  return response;
874
1090
  });
875
1091
  }
1092
+ /**
1093
+ * Chain objects together
1094
+ * @example
1095
+ * ```ts
1096
+ * function AddAFewMounts(c) {
1097
+ * return c
1098
+ * .withMountedDirectory("/foo", new Client().host().directory("/Users/slumbering/forks/dagger"))
1099
+ * .withMountedDirectory("/bar", new Client().host().directory("/Users/slumbering/forks/dagger/sdk/nodejs"))
1100
+ * }
1101
+ *
1102
+ * connect(async (client) => {
1103
+ * const tree = await client
1104
+ * .container()
1105
+ * .from("alpine")
1106
+ * .withWorkdir("/foo")
1107
+ * .with(AddAFewMounts)
1108
+ * .withExec(["ls", "-lh"])
1109
+ * .stdout()
1110
+ * })
1111
+ *```
1112
+ */
1113
+ with(arg) {
1114
+ return arg(this);
1115
+ }
876
1116
  }
877
1117
  /**
878
1118
  * A directory.
@@ -880,6 +1120,7 @@ export class Container extends BaseClient {
880
1120
  export class Directory extends BaseClient {
881
1121
  /**
882
1122
  * Gets the difference between this directory and an another directory.
1123
+ * @param other Identifier of the directory to compare.
883
1124
  */
884
1125
  diff(other) {
885
1126
  return new Directory({
@@ -896,6 +1137,7 @@ export class Directory extends BaseClient {
896
1137
  }
897
1138
  /**
898
1139
  * Retrieves a directory at the given path.
1140
+ * @param path Location of the directory to retrieve (e.g., "/src").
899
1141
  */
900
1142
  directory(path) {
901
1143
  return new Directory({
@@ -912,10 +1154,11 @@ export class Directory extends BaseClient {
912
1154
  }
913
1155
  /**
914
1156
  * Builds a new Docker container from this directory.
915
- * @param opts.dockerfile Path to the Dockerfile to use.
916
- Defaults to './Dockerfile'.
1157
+ * @param opts.dockerfile Path to the Dockerfile to use (e.g., "frontend.Dockerfile").
1158
+ *
1159
+ * Defaults: './Dockerfile'.
917
1160
  * @param opts.platform The platform to build.
918
- * @param opts.buildArgs Additional build arguments.
1161
+ * @param opts.buildArgs Build arguments to use in the build.
919
1162
  * @param opts.target Target build stage to build.
920
1163
  */
921
1164
  dockerBuild(opts) {
@@ -933,6 +1176,7 @@ export class Directory extends BaseClient {
933
1176
  }
934
1177
  /**
935
1178
  * Returns a list of files and directories at the given path.
1179
+ * @param opts.path Location of the directory to look at (e.g., "/src").
936
1180
  */
937
1181
  entries(opts) {
938
1182
  return __awaiter(this, void 0, void 0, function* () {
@@ -948,6 +1192,7 @@ export class Directory extends BaseClient {
948
1192
  }
949
1193
  /**
950
1194
  * Writes the contents of the directory to a path on the host.
1195
+ * @param path Location of the copied directory (e.g., "logs/").
951
1196
  */
952
1197
  export(path) {
953
1198
  return __awaiter(this, void 0, void 0, function* () {
@@ -963,6 +1208,7 @@ export class Directory extends BaseClient {
963
1208
  }
964
1209
  /**
965
1210
  * Retrieves a file at the given path.
1211
+ * @param path Location of the file to retrieve (e.g., "README.md").
966
1212
  */
967
1213
  file(path) {
968
1214
  return new File({
@@ -1025,10 +1271,10 @@ export class Directory extends BaseClient {
1025
1271
  }
1026
1272
  /**
1027
1273
  * Retrieves this directory plus a directory written at the given path.
1028
- * @param opts.exclude Exclude artifacts that match the given pattern.
1029
- (e.g. ["node_modules/", ".git*"]).
1030
- * @param opts.include Include only artifacts that match the given pattern.
1031
- (e.g. ["app/", "package.*"]).
1274
+ * @param path Location of the written directory (e.g., "/src/").
1275
+ * @param directory Identifier of the directory to copy.
1276
+ * @param opts.exclude Exclude artifacts that match the given pattern (e.g., ["node_modules/", ".git*"]).
1277
+ * @param opts.include Include only artifacts that match the given pattern (e.g., ["app/", "package.*"]).
1032
1278
  */
1033
1279
  withDirectory(path, directory, opts) {
1034
1280
  return new Directory({
@@ -1045,6 +1291,11 @@ export class Directory extends BaseClient {
1045
1291
  }
1046
1292
  /**
1047
1293
  * Retrieves this directory plus the contents of the given file copied to the given path.
1294
+ * @param path Location of the copied file (e.g., "/file.txt").
1295
+ * @param source Identifier of the file to copy.
1296
+ * @param opts.permissions Permission given to the copied file (e.g., 0600).
1297
+ *
1298
+ * Default: 0644.
1048
1299
  */
1049
1300
  withFile(path, source, opts) {
1050
1301
  return new Directory({
@@ -1061,6 +1312,10 @@ export class Directory extends BaseClient {
1061
1312
  }
1062
1313
  /**
1063
1314
  * Retrieves this directory plus a new directory created at the given path.
1315
+ * @param path Location of the directory created (e.g., "/logs").
1316
+ * @param opts.permissions Permission granted to the created directory (e.g., 0777).
1317
+ *
1318
+ * Default: 0755.
1064
1319
  */
1065
1320
  withNewDirectory(path, opts) {
1066
1321
  return new Directory({
@@ -1077,6 +1332,11 @@ export class Directory extends BaseClient {
1077
1332
  }
1078
1333
  /**
1079
1334
  * Retrieves this directory plus a new file written at the given path.
1335
+ * @param path Location of the written file (e.g., "/file.txt").
1336
+ * @param contents Content of the written file (e.g., "Hello world!").
1337
+ * @param opts.permissions Permission given to the copied file (e.g., 0600).
1338
+ *
1339
+ * Default: 0644.
1080
1340
  */
1081
1341
  withNewFile(path, contents, opts) {
1082
1342
  return new Directory({
@@ -1092,7 +1352,10 @@ export class Directory extends BaseClient {
1092
1352
  });
1093
1353
  }
1094
1354
  /**
1095
- * Retrieves this directory with all file/dir timestamps set to the given time, in seconds from the Unix epoch.
1355
+ * Retrieves this directory with all file/dir timestamps set to the given time.
1356
+ * @param timestamp Timestamp to set dir/files in.
1357
+ *
1358
+ * Formatted in seconds following Unix epoch (e.g., 1672531199).
1096
1359
  */
1097
1360
  withTimestamps(timestamp) {
1098
1361
  return new Directory({
@@ -1109,6 +1372,7 @@ export class Directory extends BaseClient {
1109
1372
  }
1110
1373
  /**
1111
1374
  * Retrieves this directory with the directory at the given path removed.
1375
+ * @param path Location of the directory to remove (e.g., ".github/").
1112
1376
  */
1113
1377
  withoutDirectory(path) {
1114
1378
  return new Directory({
@@ -1125,6 +1389,7 @@ export class Directory extends BaseClient {
1125
1389
  }
1126
1390
  /**
1127
1391
  * Retrieves this directory with the file at the given path removed.
1392
+ * @param path Location of the file to remove (e.g., "/file.txt").
1128
1393
  */
1129
1394
  withoutFile(path) {
1130
1395
  return new Directory({
@@ -1139,6 +1404,30 @@ export class Directory extends BaseClient {
1139
1404
  sessionToken: this.sessionToken,
1140
1405
  });
1141
1406
  }
1407
+ /**
1408
+ * Chain objects together
1409
+ * @example
1410
+ * ```ts
1411
+ * function AddAFewMounts(c) {
1412
+ * return c
1413
+ * .withMountedDirectory("/foo", new Client().host().directory("/Users/slumbering/forks/dagger"))
1414
+ * .withMountedDirectory("/bar", new Client().host().directory("/Users/slumbering/forks/dagger/sdk/nodejs"))
1415
+ * }
1416
+ *
1417
+ * connect(async (client) => {
1418
+ * const tree = await client
1419
+ * .container()
1420
+ * .from("alpine")
1421
+ * .withWorkdir("/foo")
1422
+ * .with(AddAFewMounts)
1423
+ * .withExec(["ls", "-lh"])
1424
+ * .stdout()
1425
+ * })
1426
+ *```
1427
+ */
1428
+ with(arg) {
1429
+ return arg(this);
1430
+ }
1142
1431
  }
1143
1432
  /**
1144
1433
  * A simple key value object that represents an environment variable.
@@ -1172,6 +1461,30 @@ export class EnvVariable extends BaseClient {
1172
1461
  return response;
1173
1462
  });
1174
1463
  }
1464
+ /**
1465
+ * Chain objects together
1466
+ * @example
1467
+ * ```ts
1468
+ * function AddAFewMounts(c) {
1469
+ * return c
1470
+ * .withMountedDirectory("/foo", new Client().host().directory("/Users/slumbering/forks/dagger"))
1471
+ * .withMountedDirectory("/bar", new Client().host().directory("/Users/slumbering/forks/dagger/sdk/nodejs"))
1472
+ * }
1473
+ *
1474
+ * connect(async (client) => {
1475
+ * const tree = await client
1476
+ * .container()
1477
+ * .from("alpine")
1478
+ * .withWorkdir("/foo")
1479
+ * .with(AddAFewMounts)
1480
+ * .withExec(["ls", "-lh"])
1481
+ * .stdout()
1482
+ * })
1483
+ *```
1484
+ */
1485
+ with(arg) {
1486
+ return arg(this);
1487
+ }
1175
1488
  }
1176
1489
  /**
1177
1490
  * A file.
@@ -1193,6 +1506,7 @@ export class File extends BaseClient {
1193
1506
  }
1194
1507
  /**
1195
1508
  * Writes the file to a file path on the host.
1509
+ * @param path Location of the written directory (e.g., "output.txt").
1196
1510
  */
1197
1511
  export(path) {
1198
1512
  return __awaiter(this, void 0, void 0, function* () {
@@ -1250,7 +1564,10 @@ export class File extends BaseClient {
1250
1564
  });
1251
1565
  }
1252
1566
  /**
1253
- * Retrieves this file with its created/modified timestamps set to the given time, in seconds from the Unix epoch.
1567
+ * Retrieves this file with its created/modified timestamps set to the given time.
1568
+ * @param timestamp Timestamp to set dir/files in.
1569
+ *
1570
+ * Formatted in seconds following Unix epoch (e.g., 1672531199).
1254
1571
  */
1255
1572
  withTimestamps(timestamp) {
1256
1573
  return new File({
@@ -1265,6 +1582,30 @@ export class File extends BaseClient {
1265
1582
  sessionToken: this.sessionToken,
1266
1583
  });
1267
1584
  }
1585
+ /**
1586
+ * Chain objects together
1587
+ * @example
1588
+ * ```ts
1589
+ * function AddAFewMounts(c) {
1590
+ * return c
1591
+ * .withMountedDirectory("/foo", new Client().host().directory("/Users/slumbering/forks/dagger"))
1592
+ * .withMountedDirectory("/bar", new Client().host().directory("/Users/slumbering/forks/dagger/sdk/nodejs"))
1593
+ * }
1594
+ *
1595
+ * connect(async (client) => {
1596
+ * const tree = await client
1597
+ * .container()
1598
+ * .from("alpine")
1599
+ * .withWorkdir("/foo")
1600
+ * .with(AddAFewMounts)
1601
+ * .withExec(["ls", "-lh"])
1602
+ * .stdout()
1603
+ * })
1604
+ *```
1605
+ */
1606
+ with(arg) {
1607
+ return arg(this);
1608
+ }
1268
1609
  }
1269
1610
  /**
1270
1611
  * A git ref (tag, branch or commit).
@@ -1300,6 +1641,30 @@ export class GitRef extends BaseClient {
1300
1641
  sessionToken: this.sessionToken,
1301
1642
  });
1302
1643
  }
1644
+ /**
1645
+ * Chain objects together
1646
+ * @example
1647
+ * ```ts
1648
+ * function AddAFewMounts(c) {
1649
+ * return c
1650
+ * .withMountedDirectory("/foo", new Client().host().directory("/Users/slumbering/forks/dagger"))
1651
+ * .withMountedDirectory("/bar", new Client().host().directory("/Users/slumbering/forks/dagger/sdk/nodejs"))
1652
+ * }
1653
+ *
1654
+ * connect(async (client) => {
1655
+ * const tree = await client
1656
+ * .container()
1657
+ * .from("alpine")
1658
+ * .withWorkdir("/foo")
1659
+ * .with(AddAFewMounts)
1660
+ * .withExec(["ls", "-lh"])
1661
+ * .stdout()
1662
+ * })
1663
+ *```
1664
+ */
1665
+ with(arg) {
1666
+ return arg(this);
1667
+ }
1303
1668
  }
1304
1669
  /**
1305
1670
  * A git repository.
@@ -1307,6 +1672,7 @@ export class GitRef extends BaseClient {
1307
1672
  export class GitRepository extends BaseClient {
1308
1673
  /**
1309
1674
  * Returns details on one branch.
1675
+ * @param name Branch's name (e.g., "main").
1310
1676
  */
1311
1677
  branch(name) {
1312
1678
  return new GitRef({
@@ -1337,6 +1703,7 @@ export class GitRepository extends BaseClient {
1337
1703
  }
1338
1704
  /**
1339
1705
  * Returns details on one commit.
1706
+ * @param id Identifier of the commit (e.g., "b6315d8f2810962c601af73f86831f6866ea798b").
1340
1707
  */
1341
1708
  commit(id) {
1342
1709
  return new GitRef({
@@ -1353,6 +1720,7 @@ export class GitRepository extends BaseClient {
1353
1720
  }
1354
1721
  /**
1355
1722
  * Returns details on one tag.
1723
+ * @param name Tag's name (e.g., "v0.3.9").
1356
1724
  */
1357
1725
  tag(name) {
1358
1726
  return new GitRef({
@@ -1381,6 +1749,30 @@ export class GitRepository extends BaseClient {
1381
1749
  return response;
1382
1750
  });
1383
1751
  }
1752
+ /**
1753
+ * Chain objects together
1754
+ * @example
1755
+ * ```ts
1756
+ * function AddAFewMounts(c) {
1757
+ * return c
1758
+ * .withMountedDirectory("/foo", new Client().host().directory("/Users/slumbering/forks/dagger"))
1759
+ * .withMountedDirectory("/bar", new Client().host().directory("/Users/slumbering/forks/dagger/sdk/nodejs"))
1760
+ * }
1761
+ *
1762
+ * connect(async (client) => {
1763
+ * const tree = await client
1764
+ * .container()
1765
+ * .from("alpine")
1766
+ * .withWorkdir("/foo")
1767
+ * .with(AddAFewMounts)
1768
+ * .withExec(["ls", "-lh"])
1769
+ * .stdout()
1770
+ * })
1771
+ *```
1772
+ */
1773
+ with(arg) {
1774
+ return arg(this);
1775
+ }
1384
1776
  }
1385
1777
  /**
1386
1778
  * Information about the host execution environment.
@@ -1388,6 +1780,9 @@ export class GitRepository extends BaseClient {
1388
1780
  export class Host extends BaseClient {
1389
1781
  /**
1390
1782
  * Accesses a directory on the host.
1783
+ * @param path Location of the directory to access (e.g., ".").
1784
+ * @param opts.exclude Exclude artifacts that match the given pattern (e.g., ["node_modules/", ".git*"]).
1785
+ * @param opts.include Include only artifacts that match the given pattern (e.g., ["app/", "package.*"]).
1391
1786
  */
1392
1787
  directory(path, opts) {
1393
1788
  return new Directory({
@@ -1404,6 +1799,7 @@ export class Host extends BaseClient {
1404
1799
  }
1405
1800
  /**
1406
1801
  * Accesses an environment variable on the host.
1802
+ * @param name Name of the environment variable (e.g., "PATH").
1407
1803
  */
1408
1804
  envVariable(name) {
1409
1805
  return new HostVariable({
@@ -1420,6 +1816,7 @@ export class Host extends BaseClient {
1420
1816
  }
1421
1817
  /**
1422
1818
  * Accesses a Unix socket on the host.
1819
+ * @param path Location of the Unix socket (e.g., "/var/run/docker.sock").
1423
1820
  */
1424
1821
  unixSocket(path) {
1425
1822
  return new Socket({
@@ -1436,6 +1833,8 @@ export class Host extends BaseClient {
1436
1833
  }
1437
1834
  /**
1438
1835
  * Retrieves the current working directory on the host.
1836
+ * @param opts.exclude Exclude artifacts that match the given pattern (e.g., ["node_modules/", ".git*"]).
1837
+ * @param opts.include Include only artifacts that match the given pattern (e.g., ["app/", "package.*"]).
1439
1838
  * @deprecated Use directory with path set to '.' instead.
1440
1839
  */
1441
1840
  workdir(opts) {
@@ -1451,6 +1850,30 @@ export class Host extends BaseClient {
1451
1850
  sessionToken: this.sessionToken,
1452
1851
  });
1453
1852
  }
1853
+ /**
1854
+ * Chain objects together
1855
+ * @example
1856
+ * ```ts
1857
+ * function AddAFewMounts(c) {
1858
+ * return c
1859
+ * .withMountedDirectory("/foo", new Client().host().directory("/Users/slumbering/forks/dagger"))
1860
+ * .withMountedDirectory("/bar", new Client().host().directory("/Users/slumbering/forks/dagger/sdk/nodejs"))
1861
+ * }
1862
+ *
1863
+ * connect(async (client) => {
1864
+ * const tree = await client
1865
+ * .container()
1866
+ * .from("alpine")
1867
+ * .withWorkdir("/foo")
1868
+ * .with(AddAFewMounts)
1869
+ * .withExec(["ls", "-lh"])
1870
+ * .stdout()
1871
+ * })
1872
+ *```
1873
+ */
1874
+ with(arg) {
1875
+ return arg(this);
1876
+ }
1454
1877
  }
1455
1878
  /**
1456
1879
  * An environment variable on the host environment.
@@ -1485,6 +1908,30 @@ export class HostVariable extends BaseClient {
1485
1908
  return response;
1486
1909
  });
1487
1910
  }
1911
+ /**
1912
+ * Chain objects together
1913
+ * @example
1914
+ * ```ts
1915
+ * function AddAFewMounts(c) {
1916
+ * return c
1917
+ * .withMountedDirectory("/foo", new Client().host().directory("/Users/slumbering/forks/dagger"))
1918
+ * .withMountedDirectory("/bar", new Client().host().directory("/Users/slumbering/forks/dagger/sdk/nodejs"))
1919
+ * }
1920
+ *
1921
+ * connect(async (client) => {
1922
+ * const tree = await client
1923
+ * .container()
1924
+ * .from("alpine")
1925
+ * .withWorkdir("/foo")
1926
+ * .with(AddAFewMounts)
1927
+ * .withExec(["ls", "-lh"])
1928
+ * .stdout()
1929
+ * })
1930
+ *```
1931
+ */
1932
+ with(arg) {
1933
+ return arg(this);
1934
+ }
1488
1935
  }
1489
1936
  /**
1490
1937
  * A simple key value object that represents a label.
@@ -1518,6 +1965,101 @@ export class Label extends BaseClient {
1518
1965
  return response;
1519
1966
  });
1520
1967
  }
1968
+ /**
1969
+ * Chain objects together
1970
+ * @example
1971
+ * ```ts
1972
+ * function AddAFewMounts(c) {
1973
+ * return c
1974
+ * .withMountedDirectory("/foo", new Client().host().directory("/Users/slumbering/forks/dagger"))
1975
+ * .withMountedDirectory("/bar", new Client().host().directory("/Users/slumbering/forks/dagger/sdk/nodejs"))
1976
+ * }
1977
+ *
1978
+ * connect(async (client) => {
1979
+ * const tree = await client
1980
+ * .container()
1981
+ * .from("alpine")
1982
+ * .withWorkdir("/foo")
1983
+ * .with(AddAFewMounts)
1984
+ * .withExec(["ls", "-lh"])
1985
+ * .stdout()
1986
+ * })
1987
+ *```
1988
+ */
1989
+ with(arg) {
1990
+ return arg(this);
1991
+ }
1992
+ }
1993
+ /**
1994
+ * A port exposed by a container.
1995
+ */
1996
+ export class Port extends BaseClient {
1997
+ /**
1998
+ * The port description.
1999
+ */
2000
+ description() {
2001
+ return __awaiter(this, void 0, void 0, function* () {
2002
+ const response = yield computeQuery([
2003
+ ...this._queryTree,
2004
+ {
2005
+ operation: "description",
2006
+ },
2007
+ ], this.client);
2008
+ return response;
2009
+ });
2010
+ }
2011
+ /**
2012
+ * The port number.
2013
+ */
2014
+ port() {
2015
+ return __awaiter(this, void 0, void 0, function* () {
2016
+ const response = yield computeQuery([
2017
+ ...this._queryTree,
2018
+ {
2019
+ operation: "port",
2020
+ },
2021
+ ], this.client);
2022
+ return response;
2023
+ });
2024
+ }
2025
+ /**
2026
+ * The transport layer network protocol.
2027
+ */
2028
+ protocol() {
2029
+ return __awaiter(this, void 0, void 0, function* () {
2030
+ const response = yield computeQuery([
2031
+ ...this._queryTree,
2032
+ {
2033
+ operation: "protocol",
2034
+ },
2035
+ ], this.client);
2036
+ return response;
2037
+ });
2038
+ }
2039
+ /**
2040
+ * Chain objects together
2041
+ * @example
2042
+ * ```ts
2043
+ * function AddAFewMounts(c) {
2044
+ * return c
2045
+ * .withMountedDirectory("/foo", new Client().host().directory("/Users/slumbering/forks/dagger"))
2046
+ * .withMountedDirectory("/bar", new Client().host().directory("/Users/slumbering/forks/dagger/sdk/nodejs"))
2047
+ * }
2048
+ *
2049
+ * connect(async (client) => {
2050
+ * const tree = await client
2051
+ * .container()
2052
+ * .from("alpine")
2053
+ * .withWorkdir("/foo")
2054
+ * .with(AddAFewMounts)
2055
+ * .withExec(["ls", "-lh"])
2056
+ * .stdout()
2057
+ * })
2058
+ *```
2059
+ */
2060
+ with(arg) {
2061
+ return arg(this);
2062
+ }
1521
2063
  }
1522
2064
  /**
1523
2065
  * A set of scripts and/or extensions
@@ -1608,11 +2150,35 @@ export class Project extends BaseClient {
1608
2150
  return response;
1609
2151
  });
1610
2152
  }
2153
+ /**
2154
+ * Chain objects together
2155
+ * @example
2156
+ * ```ts
2157
+ * function AddAFewMounts(c) {
2158
+ * return c
2159
+ * .withMountedDirectory("/foo", new Client().host().directory("/Users/slumbering/forks/dagger"))
2160
+ * .withMountedDirectory("/bar", new Client().host().directory("/Users/slumbering/forks/dagger/sdk/nodejs"))
2161
+ * }
2162
+ *
2163
+ * connect(async (client) => {
2164
+ * const tree = await client
2165
+ * .container()
2166
+ * .from("alpine")
2167
+ * .withWorkdir("/foo")
2168
+ * .with(AddAFewMounts)
2169
+ * .withExec(["ls", "-lh"])
2170
+ * .stdout()
2171
+ * })
2172
+ *```
2173
+ */
2174
+ with(arg) {
2175
+ return arg(this);
2176
+ }
1611
2177
  }
1612
2178
  export default class Client extends BaseClient {
1613
2179
  /**
1614
2180
  * Constructs a cache volume for a given cache key.
1615
- * @param key A string identifier to target this cache volume (e.g. "myapp-cache").
2181
+ * @param key A string identifier to target this cache volume (e.g., "modules-cache").
1616
2182
  */
1617
2183
  cacheVolume(key) {
1618
2184
  return new CacheVolume({
@@ -1629,8 +2195,10 @@ export default class Client extends BaseClient {
1629
2195
  }
1630
2196
  /**
1631
2197
  * Loads a container from ID.
2198
+ *
1632
2199
  * Null ID returns an empty container (scratch).
1633
- * Optional platform argument initializes new containers to execute and publish as that platform. Platform defaults to that of the builder's host.
2200
+ * Optional platform argument initializes new containers to execute and publish as that platform.
2201
+ * Platform defaults to that of the builder's host.
1634
2202
  */
1635
2203
  container(opts) {
1636
2204
  return new Container({
@@ -1693,6 +2261,11 @@ export default class Client extends BaseClient {
1693
2261
  }
1694
2262
  /**
1695
2263
  * Queries a git repository.
2264
+ * @param url Url of the git repository.
2265
+ * Can be formatted as https://{host}/{owner}/{repo}, git@{host}/{owner}/{repo}
2266
+ * Suffix ".git" is optional.
2267
+ * @param opts.keepGitDir Set to true to keep .git directory.
2268
+ * @param opts.experimentalServiceHost A service which must be started before the repo is fetched.
1696
2269
  */
1697
2270
  git(url, opts) {
1698
2271
  return new GitRepository({
@@ -1724,14 +2297,16 @@ export default class Client extends BaseClient {
1724
2297
  }
1725
2298
  /**
1726
2299
  * Returns a file containing an http remote url content.
2300
+ * @param url HTTP url to get the content from (e.g., "https://docs.dagger.io").
2301
+ * @param opts.experimentalServiceHost A service which must be started before the URL is fetched.
1727
2302
  */
1728
- http(url) {
2303
+ http(url, opts) {
1729
2304
  return new File({
1730
2305
  queryTree: [
1731
2306
  ...this._queryTree,
1732
2307
  {
1733
2308
  operation: "http",
1734
- args: { url },
2309
+ args: Object.assign({ url }, opts),
1735
2310
  },
1736
2311
  ],
1737
2312
  host: this.clientHost,
@@ -1835,6 +2410,30 @@ export class Secret extends BaseClient {
1835
2410
  return response;
1836
2411
  });
1837
2412
  }
2413
+ /**
2414
+ * Chain objects together
2415
+ * @example
2416
+ * ```ts
2417
+ * function AddAFewMounts(c) {
2418
+ * return c
2419
+ * .withMountedDirectory("/foo", new Client().host().directory("/Users/slumbering/forks/dagger"))
2420
+ * .withMountedDirectory("/bar", new Client().host().directory("/Users/slumbering/forks/dagger/sdk/nodejs"))
2421
+ * }
2422
+ *
2423
+ * connect(async (client) => {
2424
+ * const tree = await client
2425
+ * .container()
2426
+ * .from("alpine")
2427
+ * .withWorkdir("/foo")
2428
+ * .with(AddAFewMounts)
2429
+ * .withExec(["ls", "-lh"])
2430
+ * .stdout()
2431
+ * })
2432
+ *```
2433
+ */
2434
+ with(arg) {
2435
+ return arg(this);
2436
+ }
1838
2437
  }
1839
2438
  export class Socket extends BaseClient {
1840
2439
  /**
@@ -1851,4 +2450,28 @@ export class Socket extends BaseClient {
1851
2450
  return response;
1852
2451
  });
1853
2452
  }
2453
+ /**
2454
+ * Chain objects together
2455
+ * @example
2456
+ * ```ts
2457
+ * function AddAFewMounts(c) {
2458
+ * return c
2459
+ * .withMountedDirectory("/foo", new Client().host().directory("/Users/slumbering/forks/dagger"))
2460
+ * .withMountedDirectory("/bar", new Client().host().directory("/Users/slumbering/forks/dagger/sdk/nodejs"))
2461
+ * }
2462
+ *
2463
+ * connect(async (client) => {
2464
+ * const tree = await client
2465
+ * .container()
2466
+ * .from("alpine")
2467
+ * .withWorkdir("/foo")
2468
+ * .with(AddAFewMounts)
2469
+ * .withExec(["ls", "-lh"])
2470
+ * .stdout()
2471
+ * })
2472
+ *```
2473
+ */
2474
+ with(arg) {
2475
+ return arg(this);
2476
+ }
1854
2477
  }