@dagger.io/dagger 0.9.5 → 0.9.7

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 (34) hide show
  1. package/README.md +10 -10
  2. package/dist/api/client.gen.d.ts +519 -480
  3. package/dist/api/client.gen.d.ts.map +1 -1
  4. package/dist/api/client.gen.js +885 -406
  5. package/dist/entrypoint/entrypoint.d.ts +1 -1
  6. package/dist/entrypoint/entrypoint.d.ts.map +1 -1
  7. package/dist/entrypoint/entrypoint.js +13 -25
  8. package/dist/entrypoint/invoke.d.ts +14 -6
  9. package/dist/entrypoint/invoke.d.ts.map +1 -1
  10. package/dist/entrypoint/invoke.js +21 -8
  11. package/dist/entrypoint/load.d.ts +42 -5
  12. package/dist/entrypoint/load.d.ts.map +1 -1
  13. package/dist/entrypoint/load.js +122 -25
  14. package/dist/entrypoint/register.d.ts +3 -2
  15. package/dist/entrypoint/register.d.ts.map +1 -1
  16. package/dist/entrypoint/register.js +15 -16
  17. package/dist/index.d.ts +1 -0
  18. package/dist/index.d.ts.map +1 -1
  19. package/dist/index.js +1 -0
  20. package/dist/introspector/registry/registry.d.ts +1 -9
  21. package/dist/introspector/registry/registry.d.ts.map +1 -1
  22. package/dist/introspector/registry/registry.js +6 -25
  23. package/dist/introspector/scanner/metadata.d.ts +1 -1
  24. package/dist/introspector/scanner/scan.d.ts +8 -4
  25. package/dist/introspector/scanner/scan.d.ts.map +1 -1
  26. package/dist/introspector/scanner/scan.js +33 -22
  27. package/dist/introspector/scanner/serialize.d.ts +3 -3
  28. package/dist/introspector/scanner/serialize.js +3 -3
  29. package/dist/introspector/scanner/typeDefs.d.ts +16 -7
  30. package/dist/introspector/scanner/typeDefs.d.ts.map +1 -1
  31. package/dist/introspector/scanner/utils.js +6 -6
  32. package/dist/provisioning/default.d.ts +1 -1
  33. package/dist/provisioning/default.js +1 -1
  34. package/package.json +5 -4
@@ -27,8 +27,7 @@ class BaseClient {
27
27
  export var CacheSharingMode;
28
28
  (function (CacheSharingMode) {
29
29
  /**
30
- * Shares the cache volume amongst many build pipelines,
31
- * but will serialize the writes
30
+ * Shares the cache volume amongst many build pipelines, but will serialize the writes
32
31
  */
33
32
  CacheSharingMode["Locked"] = "LOCKED";
34
33
  /**
@@ -63,13 +62,7 @@ export var ImageMediaTypes;
63
62
  */
64
63
  export var NetworkProtocol;
65
64
  (function (NetworkProtocol) {
66
- /**
67
- * TCP (Transmission Control Protocol)
68
- */
69
65
  NetworkProtocol["Tcp"] = "TCP";
70
- /**
71
- * UDP (User Datagram Protocol)
72
- */
73
66
  NetworkProtocol["Udp"] = "UDP";
74
67
  })(NetworkProtocol || (NetworkProtocol = {}));
75
68
  /**
@@ -78,37 +71,41 @@ export var NetworkProtocol;
78
71
  export var TypeDefKind;
79
72
  (function (TypeDefKind) {
80
73
  /**
81
- * A boolean value
74
+ * A boolean value.
82
75
  */
83
- TypeDefKind["Booleankind"] = "BooleanKind";
76
+ TypeDefKind["BooleanKind"] = "BOOLEAN_KIND";
84
77
  /**
85
- * An integer value
78
+ * An integer value.
86
79
  */
87
- TypeDefKind["Integerkind"] = "IntegerKind";
80
+ TypeDefKind["IntegerKind"] = "INTEGER_KIND";
81
+ /**
82
+ * A named type of functions that can be matched+implemented by other objects+interfaces.
83
+ *
84
+ * Always paired with an InterfaceTypeDef.
85
+ */
86
+ TypeDefKind["InterfaceKind"] = "INTERFACE_KIND";
88
87
  /**
89
88
  * A list of values all having the same type.
90
89
  *
91
90
  * Always paired with a ListTypeDef.
92
91
  */
93
- TypeDefKind["Listkind"] = "ListKind";
92
+ TypeDefKind["ListKind"] = "LIST_KIND";
94
93
  /**
95
94
  * A named type defined in the GraphQL schema, with fields and functions.
96
95
  *
97
96
  * Always paired with an ObjectTypeDef.
98
97
  */
99
- TypeDefKind["Objectkind"] = "ObjectKind";
98
+ TypeDefKind["ObjectKind"] = "OBJECT_KIND";
100
99
  /**
101
- * A string value
100
+ * A string value.
102
101
  */
103
- TypeDefKind["Stringkind"] = "StringKind";
102
+ TypeDefKind["StringKind"] = "STRING_KIND";
104
103
  /**
105
104
  * A special kind used to signify that no value is returned.
106
105
  *
107
- * This is used for functions that have no return value. The outer TypeDef
108
- * specifying this Kind is always Optional, as the Void is never actually
109
- * represented.
106
+ * This is used for functions that have no return value. The outer TypeDef specifying this Kind is always Optional, as the Void is never actually represented.
110
107
  */
111
- TypeDefKind["Voidkind"] = "VoidKind";
108
+ TypeDefKind["VoidKind"] = "VOID_KIND";
112
109
  })(TypeDefKind || (TypeDefKind = {}));
113
110
  /**
114
111
  * A directory whose contents persist across runs.
@@ -122,6 +119,9 @@ export class CacheVolume extends BaseClient {
122
119
  super(parent);
123
120
  this._id = _id;
124
121
  }
122
+ /**
123
+ * A unique identifier for this CacheVolume.
124
+ */
125
125
  id = async () => {
126
126
  if (this._id) {
127
127
  return this._id;
@@ -136,7 +136,7 @@ export class CacheVolume extends BaseClient {
136
136
  };
137
137
  }
138
138
  /**
139
- * An OCI-compatible container, also known as a docker container.
139
+ * An OCI-compatible container, also known as a Docker container.
140
140
  */
141
141
  export class Container extends BaseClient {
142
142
  _id = undefined;
@@ -172,7 +172,7 @@ export class Container extends BaseClient {
172
172
  this._workdir = _workdir;
173
173
  }
174
174
  /**
175
- * A unique identifier for this container.
175
+ * A unique identifier for this Container.
176
176
  */
177
177
  id = async () => {
178
178
  if (this._id) {
@@ -205,15 +205,14 @@ export class Container extends BaseClient {
205
205
  /**
206
206
  * Returns a File representing the container serialized to a tarball.
207
207
  * @param opts.platformVariants Identifiers for other platform specific containers.
208
- * Used for multi-platform image.
208
+ *
209
+ * Used for multi-platform images.
209
210
  * @param opts.forcedCompression Force each layer of the image to use the specified compression algorithm.
210
- * If this is unset, then if a layer already has a compressed blob in the engine's
211
- * cache, that will be used (this can result in a mix of compression algorithms for
212
- * different layers). If this is unset and a layer has no compressed blob in the
213
- * engine's cache, then it will be compressed using Gzip.
214
- * @param opts.mediaTypes Use the specified media types for the image's layers. Defaults to OCI, which
215
- * is largely compatible with most recent container runtimes, but Docker may be needed
216
- * for older runtimes without OCI support.
211
+ *
212
+ * If this is unset, then if a layer already has a compressed blob in the engine's cache, that will be used (this can result in a mix of compression algorithms for different layers). If this is unset and a layer has no compressed blob in the engine's cache, then it will be compressed using Gzip.
213
+ * @param opts.mediaTypes Use the specified media types for the image's layers.
214
+ *
215
+ * Defaults to OCI, which is largely compatible with most recent container runtimes, but Docker may be needed for older runtimes without OCI support.
217
216
  */
218
217
  asTarball = (opts) => {
219
218
  const metadata = {
@@ -235,17 +234,13 @@ export class Container extends BaseClient {
235
234
  * Initializes this container from a Dockerfile build.
236
235
  * @param context Directory context used by the Dockerfile.
237
236
  * @param opts.dockerfile Path to the Dockerfile to use.
238
- *
239
- * Default: './Dockerfile'.
240
- * @param opts.buildArgs Additional build arguments.
241
237
  * @param opts.target Target build stage to build.
238
+ * @param opts.buildArgs Additional build arguments.
242
239
  * @param opts.secrets Secrets to pass to the build.
243
240
  *
244
241
  * They will be mounted at /run/secrets/[secret-name] in the build container
245
242
  *
246
- * They can be accessed in the Dockerfile using the "secret" mount type
247
- * and mount path /run/secrets/[secret-name]
248
- * e.g. RUN --mount=type=secret,id=my-secret curl url?token=$(cat /run/secrets/my-secret)"
243
+ * They can be accessed in the Dockerfile using the "secret" mount type and mount path /run/secrets/[secret-name], e.g. RUN --mount=type=secret,id=my-secret curl http://example.com?token=$(cat /run/secrets/my-secret)
249
244
  */
250
245
  build = (context, opts) => {
251
246
  return new Container({
@@ -328,18 +323,24 @@ export class Container extends BaseClient {
328
323
  operation: "envVariables",
329
324
  },
330
325
  {
331
- operation: "name value",
326
+ operation: "id",
332
327
  },
333
328
  ], await this._ctx.connection());
334
329
  return response.map((r) => new EnvVariable({
335
- queryTree: this.queryTree,
330
+ queryTree: [
331
+ {
332
+ operation: "loadEnvVariableFromID",
333
+ args: { id: r.id },
334
+ },
335
+ ],
336
336
  ctx: this._ctx,
337
- }, r.name, r.value));
337
+ }, r.id));
338
338
  };
339
339
  /**
340
340
  * EXPERIMENTAL API! Subject to change/removal at any time.
341
341
  *
342
- * experimentalWithAllGPUs configures all available GPUs on the host to be accessible to this container.
342
+ * Configures all available GPUs on the host to be accessible to this container.
343
+ *
343
344
  * This currently works for Nvidia devices only.
344
345
  */
345
346
  experimentalWithAllGPUs = () => {
@@ -356,8 +357,10 @@ export class Container extends BaseClient {
356
357
  /**
357
358
  * EXPERIMENTAL API! Subject to change/removal at any time.
358
359
  *
359
- * experimentalWithGPU configures the provided list of devices to be accesible to this container.
360
+ * Configures the provided list of devices to be accesible to this container.
361
+ *
360
362
  * This currently works for Nvidia devices only.
363
+ * @param devices List of devices to be accessible to this container.
361
364
  */
362
365
  experimentalWithGPU = (devices) => {
363
366
  return new Container({
@@ -372,22 +375,23 @@ export class Container extends BaseClient {
372
375
  });
373
376
  };
374
377
  /**
375
- * Writes the container as an OCI tarball to the destination file path on the host for the specified platform variants.
378
+ * Writes the container as an OCI tarball to the destination file path on the host.
376
379
  *
377
380
  * Return true on success.
378
- * It can also publishes platform variants.
381
+ *
382
+ * It can also export platform variants.
379
383
  * @param path Host's destination path (e.g., "./tarball").
384
+ *
380
385
  * Path can be relative to the engine's workdir or absolute.
381
386
  * @param opts.platformVariants Identifiers for other platform specific containers.
387
+ *
382
388
  * Used for multi-platform image.
383
389
  * @param opts.forcedCompression Force each layer of the exported image to use the specified compression algorithm.
384
- * If this is unset, then if a layer already has a compressed blob in the engine's
385
- * cache, that will be used (this can result in a mix of compression algorithms for
386
- * different layers). If this is unset and a layer has no compressed blob in the
387
- * engine's cache, then it will be compressed using Gzip.
388
- * @param opts.mediaTypes Use the specified media types for the exported image's layers. Defaults to OCI, which
389
- * is largely compatible with most recent container runtimes, but Docker may be needed
390
- * for older runtimes without OCI support.
390
+ *
391
+ * If this is unset, then if a layer already has a compressed blob in the engine's cache, that will be used (this can result in a mix of compression algorithms for different layers). If this is unset and a layer has no compressed blob in the engine's cache, then it will be compressed using Gzip.
392
+ * @param opts.mediaTypes Use the specified media types for the exported image's layers.
393
+ *
394
+ * Defaults to OCI, which is largely compatible with most recent container runtimes, but Docker may be needed for older runtimes without OCI support.
391
395
  */
392
396
  export = async (path, opts) => {
393
397
  if (this._export) {
@@ -409,8 +413,7 @@ export class Container extends BaseClient {
409
413
  /**
410
414
  * Retrieves the list of exposed ports.
411
415
  *
412
- * This includes ports already exposed by the image, even if not
413
- * explicitly added with dagger.
416
+ * This includes ports already exposed by the image, even if not explicitly added with dagger.
414
417
  */
415
418
  exposedPorts = async () => {
416
419
  const response = await computeQuery([
@@ -419,13 +422,18 @@ export class Container extends BaseClient {
419
422
  operation: "exposedPorts",
420
423
  },
421
424
  {
422
- operation: "description port protocol",
425
+ operation: "id",
423
426
  },
424
427
  ], await this._ctx.connection());
425
428
  return response.map((r) => new Port({
426
- queryTree: this.queryTree,
429
+ queryTree: [
430
+ {
431
+ operation: "loadPortFromID",
432
+ args: { id: r.id },
433
+ },
434
+ ],
427
435
  ctx: this._ctx,
428
- }, r.description, r.port, r.protocol));
436
+ }, r.id));
429
437
  };
430
438
  /**
431
439
  * Retrieves a file at the given path.
@@ -480,12 +488,8 @@ export class Container extends BaseClient {
480
488
  };
481
489
  /**
482
490
  * Reads the container from an OCI tarball.
483
- *
484
- * NOTE: this involves unpacking the tarball to an OCI store on the host at
485
- * $XDG_CACHE_DIR/dagger/oci. This directory can be removed whenever you like.
486
491
  * @param source File to read the container from.
487
- * @param opts.tag Identifies the tag to import from the archive, if the archive bundles
488
- * multiple tags.
492
+ * @param opts.tag Identifies the tag to import from the archive, if the archive bundles multiple tags.
489
493
  */
490
494
  import_ = (source, opts) => {
491
495
  return new Container({
@@ -501,6 +505,7 @@ export class Container extends BaseClient {
501
505
  };
502
506
  /**
503
507
  * Retrieves the value of the specified label.
508
+ * @param name The name of the label (e.g., "org.opencontainers.artifact.created").
504
509
  */
505
510
  label = async (name) => {
506
511
  if (this._label) {
@@ -525,13 +530,18 @@ export class Container extends BaseClient {
525
530
  operation: "labels",
526
531
  },
527
532
  {
528
- operation: "name value",
533
+ operation: "id",
529
534
  },
530
535
  ], await this._ctx.connection());
531
536
  return response.map((r) => new Label({
532
- queryTree: this.queryTree,
537
+ queryTree: [
538
+ {
539
+ operation: "loadLabelFromID",
540
+ args: { id: r.id },
541
+ },
542
+ ],
533
543
  ctx: this._ctx,
534
- }, r.name, r.value));
544
+ }, r.id));
535
545
  };
536
546
  /**
537
547
  * Retrieves the list of paths where a directory is mounted.
@@ -546,10 +556,10 @@ export class Container extends BaseClient {
546
556
  return response;
547
557
  };
548
558
  /**
549
- * Creates a named sub-pipeline
550
- * @param name Pipeline name.
551
- * @param opts.description Pipeline description.
552
- * @param opts.labels Pipeline labels.
559
+ * Creates a named sub-pipeline.
560
+ * @param name Name of the sub-pipeline.
561
+ * @param opts.description Description of the sub-pipeline.
562
+ * @param opts.labels Labels to apply to the sub-pipeline.
553
563
  */
554
564
  pipeline = (name, opts) => {
555
565
  return new Container({
@@ -582,20 +592,20 @@ export class Container extends BaseClient {
582
592
  * Publishes this container as a new image to the specified address.
583
593
  *
584
594
  * Publish returns a fully qualified ref.
595
+ *
585
596
  * It can also publish platform variants.
586
597
  * @param address Registry's address to publish the image to.
587
598
  *
588
599
  * Formatted as [host]/[user]/[repo]:[tag] (e.g. "docker.io/dagger/dagger:main").
589
600
  * @param opts.platformVariants Identifiers for other platform specific containers.
601
+ *
590
602
  * Used for multi-platform image.
591
603
  * @param opts.forcedCompression Force each layer of the published image to use the specified compression algorithm.
592
- * If this is unset, then if a layer already has a compressed blob in the engine's
593
- * cache, that will be used (this can result in a mix of compression algorithms for
594
- * different layers). If this is unset and a layer has no compressed blob in the
595
- * engine's cache, then it will be compressed using Gzip.
596
- * @param opts.mediaTypes Use the specified media types for the published image's layers. Defaults to OCI, which
597
- * is largely compatible with most recent registries, but Docker may be needed for older
598
- * registries without OCI support.
604
+ *
605
+ * If this is unset, then if a layer already has a compressed blob in the engine's cache, that will be used (this can result in a mix of compression algorithms for different layers). If this is unset and a layer has no compressed blob in the engine's cache, then it will be compressed using Gzip.
606
+ * @param opts.mediaTypes Use the specified media types for the published image's layers.
607
+ *
608
+ * Defaults to OCI, which is largely compatible with most recent registries, but Docker may be needed for older registries without OCI support.
599
609
  */
600
610
  publish = async (address, opts) => {
601
611
  if (this._publish) {
@@ -629,8 +639,7 @@ export class Container extends BaseClient {
629
639
  });
630
640
  };
631
641
  /**
632
- * Return a websocket endpoint that, if connected to, will start the container with a TTY streamed
633
- * over the websocket.
642
+ * Return a websocket endpoint that, if connected to, will start the container with a TTY streamed over the websocket.
634
643
  *
635
644
  * Primarily intended for internal use with the dagger CLI.
636
645
  */
@@ -711,15 +720,15 @@ export class Container extends BaseClient {
711
720
  };
712
721
  /**
713
722
  * Configures default arguments for future commands.
714
- * @param opts.args Arguments to prepend to future executions (e.g., ["-v", "--no-cache"]).
723
+ * @param args Arguments to prepend to future executions (e.g., ["-v", "--no-cache"]).
715
724
  */
716
- withDefaultArgs = (opts) => {
725
+ withDefaultArgs = (args) => {
717
726
  return new Container({
718
727
  queryTree: [
719
728
  ...this._queryTree,
720
729
  {
721
730
  operation: "withDefaultArgs",
722
- args: { ...opts },
731
+ args: { args },
723
732
  },
724
733
  ],
725
734
  ctx: this._ctx,
@@ -729,8 +738,8 @@ export class Container extends BaseClient {
729
738
  * Retrieves this container plus a directory written at the given path.
730
739
  * @param path Location of the written directory (e.g., "/tmp/directory").
731
740
  * @param directory Identifier of the directory to write
732
- * @param opts.exclude Patterns to exclude in the written directory (e.g., ["node_modules/**", ".gitignore", ".git/"]).
733
- * @param opts.include Patterns to include in the written directory (e.g., ["*.go", "go.mod", "go.sum"]).
741
+ * @param opts.exclude Patterns to exclude in the written directory (e.g. ["node_modules/**", ".gitignore", ".git/"]).
742
+ * @param opts.include Patterns to include in the written directory (e.g. ["*.go", "go.mod", "go.sum"]).
734
743
  * @param opts.owner A user:group to set for the directory and its contents.
735
744
  *
736
745
  * The user and group can either be an ID (1000:1000) or a name (foo:bar).
@@ -770,8 +779,7 @@ export class Container extends BaseClient {
770
779
  * Retrieves this container plus the given environment variable.
771
780
  * @param name The name of the environment variable (e.g., "HOST").
772
781
  * @param value The value of the environment variable. (e.g., "localhost").
773
- * @param opts.expand Replace `${VAR}` or $VAR in the value according to the current environment
774
- * variables defined in the container (e.g., "/opt/bin:$PATH").
782
+ * @param opts.expand Replace `${VAR}` or `$VAR` in the value according to the current environment variables defined in the container (e.g., "/opt/bin:$PATH").
775
783
  */
776
784
  withEnvVariable = (name, value, opts) => {
777
785
  return new Container({
@@ -796,12 +804,8 @@ export class Container extends BaseClient {
796
804
  * @param opts.redirectStderr Redirect the command's standard error to a file in the container (e.g., "/tmp/stderr").
797
805
  * @param opts.experimentalPrivilegedNesting Provides dagger access to the executed command.
798
806
  *
799
- * Do not use this option unless you trust the command being executed.
800
- * The command being executed WILL BE GRANTED FULL ACCESS TO YOUR HOST FILESYSTEM.
801
- * @param opts.insecureRootCapabilities Execute the command with all root capabilities. This is similar to running a command
802
- * with "sudo" or executing `docker run` with the `--privileged` flag. Containerization
803
- * does not provide any security guarantees when using this option. It should only be used
804
- * when absolutely necessary and only with trusted commands.
807
+ * Do not use this option unless you trust the command being executed; the command being executed WILL BE GRANTED FULL ACCESS TO YOUR HOST FILESYSTEM.
808
+ * @param opts.insecureRootCapabilities Execute the command with all root capabilities. This is similar to running a command with "sudo" or executing "docker run" with the "--privileged" flag. Containerization does not provide any security guarantees when using this option. It should only be used when absolutely necessary and only with trusted commands.
805
809
  */
806
810
  withExec = (args, opts) => {
807
811
  return new Container({
@@ -821,6 +825,7 @@ export class Container extends BaseClient {
821
825
  * Exposed ports serve two purposes:
822
826
  *
823
827
  * - For health checks and introspection, when running services
828
+ *
824
829
  * - For setting the EXPOSE OCI field when publishing the container
825
830
  * @param port Port number to expose
826
831
  * @param opts.protocol Transport layer network protocol
@@ -846,8 +851,6 @@ export class Container extends BaseClient {
846
851
  * @param path Location of the copied file (e.g., "/tmp/file.txt").
847
852
  * @param source Identifier of the file to copy.
848
853
  * @param opts.permissions Permission given to the copied file (e.g., 0600).
849
- *
850
- * Default: 0644.
851
854
  * @param opts.owner A user:group to set for the file.
852
855
  *
853
856
  * The user and group can either be an ID (1000:1000) or a name (foo:bar).
@@ -867,8 +870,7 @@ export class Container extends BaseClient {
867
870
  });
868
871
  };
869
872
  /**
870
- * Indicate that subsequent operations should be featured more prominently in
871
- * the UI.
873
+ * Indicate that subsequent operations should be featured more prominently in the UI.
872
874
  */
873
875
  withFocus = () => {
874
876
  return new Container({
@@ -906,9 +908,7 @@ export class Container extends BaseClient {
906
908
  * @param opts.sharing Sharing mode of the cache volume.
907
909
  * @param opts.owner A user:group to set for the mounted cache directory.
908
910
  *
909
- * Note that this changes the ownership of the specified mount along with the
910
- * initial filesystem provided by source (if any). It does not have any effect
911
- * if/when the cache has already been created.
911
+ * Note that this changes the ownership of the specified mount along with the initial filesystem provided by source (if any). It does not have any effect if/when the cache has already been created.
912
912
  *
913
913
  * The user and group can either be an ID (1000:1000) or a name (foo:bar).
914
914
  *
@@ -983,9 +983,8 @@ export class Container extends BaseClient {
983
983
  *
984
984
  * If the group is omitted, it defaults to the same as the user.
985
985
  * @param opts.mode Permission given to the mounted secret (e.g., 0600).
986
- * This option requires an owner to be set to be active.
987
986
  *
988
- * Default: 0400.
987
+ * This option requires an owner to be set to be active.
989
988
  */
990
989
  withMountedSecret = (path, source, opts) => {
991
990
  return new Container({
@@ -1020,8 +1019,6 @@ export class Container extends BaseClient {
1020
1019
  * @param path Location of the written file (e.g., "/tmp/file.txt").
1021
1020
  * @param opts.contents Content of the file to write (e.g., "Hello world!").
1022
1021
  * @param opts.permissions Permission given to the written file (e.g., 0600).
1023
- *
1024
- * Default: 0644.
1025
1022
  * @param opts.owner A user:group to set for the file.
1026
1023
  *
1027
1024
  * The user and group can either be an ID (1000:1000) or a name (foo:bar).
@@ -1043,6 +1040,7 @@ export class Container extends BaseClient {
1043
1040
  /**
1044
1041
  * Retrieves this container with a registry authentication for a given address.
1045
1042
  * @param address Registry's address to bind the authentication to.
1043
+ *
1046
1044
  * Formatted as [host]/[user]/[repo]:[tag] (e.g. docker.io/dagger/dagger:main).
1047
1045
  * @param username The username of the registry's account (e.g., "Dagger").
1048
1046
  * @param secret The API key, password or token to authenticate to this registry.
@@ -1060,7 +1058,8 @@ export class Container extends BaseClient {
1060
1058
  });
1061
1059
  };
1062
1060
  /**
1063
- * Initializes this container from this DirectoryID.
1061
+ * Retrieves the container with the given directory mounted to /.
1062
+ * @param directory Directory to mount.
1064
1063
  */
1065
1064
  withRootfs = (directory) => {
1066
1065
  return new Container({
@@ -1094,8 +1093,7 @@ export class Container extends BaseClient {
1094
1093
  /**
1095
1094
  * Establish a runtime dependency on a service.
1096
1095
  *
1097
- * The service will be started automatically when needed and detached when it is
1098
- * no longer needed, executing the default command if none is set.
1096
+ * The service will be started automatically when needed and detached when it is no longer needed, executing the default command if none is set.
1099
1097
  *
1100
1098
  * The service will be reachable from the container via the provided hostname alias.
1101
1099
  *
@@ -1236,8 +1234,7 @@ export class Container extends BaseClient {
1236
1234
  });
1237
1235
  };
1238
1236
  /**
1239
- * Indicate that subsequent operations should not be featured more prominently
1240
- * in the UI.
1237
+ * Indicate that subsequent operations should not be featured more prominently in the UI.
1241
1238
  *
1242
1239
  * This is the initial state of all containers.
1243
1240
  */
@@ -1287,6 +1284,7 @@ export class Container extends BaseClient {
1287
1284
  /**
1288
1285
  * Retrieves this container without the registry authentication of a given address.
1289
1286
  * @param address Registry's address to remove the authentication from.
1287
+ *
1290
1288
  * Formatted as [host]/[user]/[repo]:[tag] (e.g. docker.io/dagger/dagger:main).
1291
1289
  */
1292
1290
  withoutRegistryAuth = (address) => {
@@ -1390,7 +1388,7 @@ export class Directory extends BaseClient {
1390
1388
  this._sync = _sync;
1391
1389
  }
1392
1390
  /**
1393
- * The content-addressed identifier of the directory.
1391
+ * A unique identifier for this Directory.
1394
1392
  */
1395
1393
  id = async () => {
1396
1394
  if (this._id) {
@@ -1406,16 +1404,11 @@ export class Directory extends BaseClient {
1406
1404
  };
1407
1405
  /**
1408
1406
  * Load the directory as a Dagger module
1409
- * @param opts.sourceSubpath An optional subpath of the directory which contains the module's source
1410
- * code.
1407
+ * @param opts.sourceSubpath An optional subpath of the directory which contains the module's source code.
1411
1408
  *
1412
- * This is needed when the module code is in a subdirectory but requires
1413
- * parent directories to be loaded in order to execute. For example, the
1414
- * module source code may need a go.mod, project.toml, package.json, etc. file
1415
- * from a parent directory.
1409
+ * This is needed when the module code is in a subdirectory but requires parent directories to be loaded in order to execute. For example, the module source code may need a go.mod, project.toml, package.json, etc. file from a parent directory.
1416
1410
  *
1417
- * If not set, the module source code is loaded from the root of the
1418
- * directory.
1411
+ * If not set, the module source code is loaded from the root of the directory.
1419
1412
  */
1420
1413
  asModule = (opts) => {
1421
1414
  return new Module_({
@@ -1463,12 +1456,10 @@ export class Directory extends BaseClient {
1463
1456
  };
1464
1457
  /**
1465
1458
  * Builds a new Docker container from this directory.
1466
- * @param opts.dockerfile Path to the Dockerfile to use (e.g., "frontend.Dockerfile").
1467
- *
1468
- * Defaults: './Dockerfile'.
1469
1459
  * @param opts.platform The platform to build.
1470
- * @param opts.buildArgs Build arguments to use in the build.
1460
+ * @param opts.dockerfile Path to the Dockerfile to use (e.g., "frontend.Dockerfile").
1471
1461
  * @param opts.target Target build stage to build.
1462
+ * @param opts.buildArgs Build arguments to use in the build.
1472
1463
  * @param opts.secrets Secrets to pass to the build.
1473
1464
  *
1474
1465
  * They will be mounted at /run/secrets/[secret-name].
@@ -1547,10 +1538,10 @@ export class Directory extends BaseClient {
1547
1538
  return response;
1548
1539
  };
1549
1540
  /**
1550
- * Creates a named sub-pipeline
1551
- * @param name Pipeline name.
1552
- * @param opts.description Pipeline description.
1553
- * @param opts.labels Pipeline labels.
1541
+ * Creates a named sub-pipeline.
1542
+ * @param name Name of the sub-pipeline.
1543
+ * @param opts.description Description of the sub-pipeline.
1544
+ * @param opts.labels Labels to apply to the sub-pipeline.
1554
1545
  */
1555
1546
  pipeline = (name, opts) => {
1556
1547
  return new Directory({
@@ -1600,8 +1591,6 @@ export class Directory extends BaseClient {
1600
1591
  * @param path Location of the copied file (e.g., "/file.txt").
1601
1592
  * @param source Identifier of the file to copy.
1602
1593
  * @param opts.permissions Permission given to the copied file (e.g., 0600).
1603
- *
1604
- * Default: 0644.
1605
1594
  */
1606
1595
  withFile = (path, source, opts) => {
1607
1596
  return new Directory({
@@ -1619,8 +1608,6 @@ export class Directory extends BaseClient {
1619
1608
  * Retrieves this directory plus a new directory created at the given path.
1620
1609
  * @param path Location of the directory created (e.g., "/logs").
1621
1610
  * @param opts.permissions Permission granted to the created directory (e.g., 0777).
1622
- *
1623
- * Default: 0755.
1624
1611
  */
1625
1612
  withNewDirectory = (path, opts) => {
1626
1613
  return new Directory({
@@ -1639,8 +1626,6 @@ export class Directory extends BaseClient {
1639
1626
  * @param path Location of the written file (e.g., "/file.txt").
1640
1627
  * @param contents Content of the written file (e.g., "Hello world!").
1641
1628
  * @param opts.permissions Permission given to the copied file (e.g., 0600).
1642
- *
1643
- * Default: 0644.
1644
1629
  */
1645
1630
  withNewFile = (path, contents, opts) => {
1646
1631
  return new Directory({
@@ -1714,22 +1699,36 @@ export class Directory extends BaseClient {
1714
1699
  };
1715
1700
  }
1716
1701
  /**
1717
- * A simple key value object that represents an environment variable.
1702
+ * An environment variable name and value.
1718
1703
  */
1719
1704
  export class EnvVariable extends BaseClient {
1705
+ _id = undefined;
1720
1706
  _name = undefined;
1721
1707
  _value = undefined;
1722
1708
  /**
1723
1709
  * Constructor is used for internal usage only, do not create object from it.
1724
1710
  */
1725
- constructor(parent, _name, _value) {
1711
+ constructor(parent, _id, _name, _value) {
1726
1712
  super(parent);
1713
+ this._id = _id;
1727
1714
  this._name = _name;
1728
1715
  this._value = _value;
1729
1716
  }
1730
1717
  /**
1731
- * The environment variable name.
1718
+ * A unique identifier for this EnvVariable.
1732
1719
  */
1720
+ id = async () => {
1721
+ if (this._id) {
1722
+ return this._id;
1723
+ }
1724
+ const response = await computeQuery([
1725
+ ...this._queryTree,
1726
+ {
1727
+ operation: "id",
1728
+ },
1729
+ ], await this._ctx.connection());
1730
+ return response;
1731
+ };
1733
1732
  name = async () => {
1734
1733
  if (this._name) {
1735
1734
  return this._name;
@@ -1742,9 +1741,6 @@ export class EnvVariable extends BaseClient {
1742
1741
  ], await this._ctx.connection());
1743
1742
  return response;
1744
1743
  };
1745
- /**
1746
- * The environment variable value.
1747
- */
1748
1744
  value = async () => {
1749
1745
  if (this._value) {
1750
1746
  return this._value;
@@ -1760,23 +1756,37 @@ export class EnvVariable extends BaseClient {
1760
1756
  }
1761
1757
  /**
1762
1758
  * A definition of a field on a custom object defined in a Module.
1763
- * A field on an object has a static value, as opposed to a function on an
1764
- * object whose value is computed by invoking code (and can accept arguments).
1759
+ *
1760
+ * A field on an object has a static value, as opposed to a function on an object whose value is computed by invoking code (and can accept arguments).
1765
1761
  */
1766
1762
  export class FieldTypeDef extends BaseClient {
1763
+ _id = undefined;
1767
1764
  _description = undefined;
1768
1765
  _name = undefined;
1769
1766
  /**
1770
1767
  * Constructor is used for internal usage only, do not create object from it.
1771
1768
  */
1772
- constructor(parent, _description, _name) {
1769
+ constructor(parent, _id, _description, _name) {
1773
1770
  super(parent);
1771
+ this._id = _id;
1774
1772
  this._description = _description;
1775
1773
  this._name = _name;
1776
1774
  }
1777
1775
  /**
1778
- * A doc string for the field, if any
1776
+ * A unique identifier for this FieldTypeDef.
1779
1777
  */
1778
+ id = async () => {
1779
+ if (this._id) {
1780
+ return this._id;
1781
+ }
1782
+ const response = await computeQuery([
1783
+ ...this._queryTree,
1784
+ {
1785
+ operation: "id",
1786
+ },
1787
+ ], await this._ctx.connection());
1788
+ return response;
1789
+ };
1780
1790
  description = async () => {
1781
1791
  if (this._description) {
1782
1792
  return this._description;
@@ -1789,9 +1799,6 @@ export class FieldTypeDef extends BaseClient {
1789
1799
  ], await this._ctx.connection());
1790
1800
  return response;
1791
1801
  };
1792
- /**
1793
- * The name of the field in the object
1794
- */
1795
1802
  name = async () => {
1796
1803
  if (this._name) {
1797
1804
  return this._name;
@@ -1804,9 +1811,6 @@ export class FieldTypeDef extends BaseClient {
1804
1811
  ], await this._ctx.connection());
1805
1812
  return response;
1806
1813
  };
1807
- /**
1808
- * The type of the field
1809
- */
1810
1814
  typeDef = () => {
1811
1815
  return new TypeDef({
1812
1816
  queryTree: [
@@ -1826,21 +1830,23 @@ export class File extends BaseClient {
1826
1830
  _id = undefined;
1827
1831
  _contents = undefined;
1828
1832
  _export = undefined;
1833
+ _name = undefined;
1829
1834
  _size = undefined;
1830
1835
  _sync = undefined;
1831
1836
  /**
1832
1837
  * Constructor is used for internal usage only, do not create object from it.
1833
1838
  */
1834
- constructor(parent, _id, _contents, _export, _size, _sync) {
1839
+ constructor(parent, _id, _contents, _export, _name, _size, _sync) {
1835
1840
  super(parent);
1836
1841
  this._id = _id;
1837
1842
  this._contents = _contents;
1838
1843
  this._export = _export;
1844
+ this._name = _name;
1839
1845
  this._size = _size;
1840
1846
  this._sync = _sync;
1841
1847
  }
1842
1848
  /**
1843
- * Retrieves the content-addressed identifier of the file.
1849
+ * A unique identifier for this File.
1844
1850
  */
1845
1851
  id = async () => {
1846
1852
  if (this._id) {
@@ -1872,8 +1878,7 @@ export class File extends BaseClient {
1872
1878
  /**
1873
1879
  * Writes the file to a file path on the host.
1874
1880
  * @param path Location of the written directory (e.g., "output.txt").
1875
- * @param opts.allowParentDirPath If allowParentDirPath is true, the path argument can be a directory path, in which case
1876
- * the file will be created in that directory.
1881
+ * @param opts.allowParentDirPath If allowParentDirPath is true, the path argument can be a directory path, in which case the file will be created in that directory.
1877
1882
  */
1878
1883
  export = async (path, opts) => {
1879
1884
  if (this._export) {
@@ -1889,7 +1894,22 @@ export class File extends BaseClient {
1889
1894
  return response;
1890
1895
  };
1891
1896
  /**
1892
- * Gets the size of the file, in bytes.
1897
+ * Retrieves the name of the file.
1898
+ */
1899
+ name = async () => {
1900
+ if (this._name) {
1901
+ return this._name;
1902
+ }
1903
+ const response = await computeQuery([
1904
+ ...this._queryTree,
1905
+ {
1906
+ operation: "name",
1907
+ },
1908
+ ], await this._ctx.connection());
1909
+ return response;
1910
+ };
1911
+ /**
1912
+ * Retrieves the size of the file, in bytes.
1893
1913
  */
1894
1914
  size = async () => {
1895
1915
  if (this._size) {
@@ -1945,8 +1965,7 @@ export class File extends BaseClient {
1945
1965
  /**
1946
1966
  * Function represents a resolver provided by a Module.
1947
1967
  *
1948
- * A function always evaluates against a parent object and is given a set of
1949
- * named arguments.
1968
+ * A function always evaluates against a parent object and is given a set of named arguments.
1950
1969
  */
1951
1970
  export class Function_ extends BaseClient {
1952
1971
  _id = undefined;
@@ -1962,7 +1981,7 @@ export class Function_ extends BaseClient {
1962
1981
  this._name = _name;
1963
1982
  }
1964
1983
  /**
1965
- * The ID of the function
1984
+ * A unique identifier for this Function.
1966
1985
  */
1967
1986
  id = async () => {
1968
1987
  if (this._id) {
@@ -1976,9 +1995,6 @@ export class Function_ extends BaseClient {
1976
1995
  ], await this._ctx.connection());
1977
1996
  return response;
1978
1997
  };
1979
- /**
1980
- * Arguments accepted by this function, if any
1981
- */
1982
1998
  args = async () => {
1983
1999
  const response = await computeQuery([
1984
2000
  ...this._queryTree,
@@ -1990,13 +2006,15 @@ export class Function_ extends BaseClient {
1990
2006
  },
1991
2007
  ], await this._ctx.connection());
1992
2008
  return response.map((r) => new FunctionArg({
1993
- queryTree: this.queryTree,
2009
+ queryTree: [
2010
+ {
2011
+ operation: "loadFunctionArgFromID",
2012
+ args: { id: r.id },
2013
+ },
2014
+ ],
1994
2015
  ctx: this._ctx,
1995
2016
  }, r.id));
1996
2017
  };
1997
- /**
1998
- * A doc string for the function, if any
1999
- */
2000
2018
  description = async () => {
2001
2019
  if (this._description) {
2002
2020
  return this._description;
@@ -2009,9 +2027,6 @@ export class Function_ extends BaseClient {
2009
2027
  ], await this._ctx.connection());
2010
2028
  return response;
2011
2029
  };
2012
- /**
2013
- * The name of the function
2014
- */
2015
2030
  name = async () => {
2016
2031
  if (this._name) {
2017
2032
  return this._name;
@@ -2024,9 +2039,6 @@ export class Function_ extends BaseClient {
2024
2039
  ], await this._ctx.connection());
2025
2040
  return response;
2026
2041
  };
2027
- /**
2028
- * The type returned by this function
2029
- */
2030
2042
  returnType = () => {
2031
2043
  return new TypeDef({
2032
2044
  queryTree: [
@@ -2058,7 +2070,8 @@ export class Function_ extends BaseClient {
2058
2070
  });
2059
2071
  };
2060
2072
  /**
2061
- * Returns the function with the doc string
2073
+ * Returns the function with the given doc string.
2074
+ * @param description The doc string to set.
2062
2075
  */
2063
2076
  withDescription = (description) => {
2064
2077
  return new Function_({
@@ -2084,8 +2097,7 @@ export class Function_ extends BaseClient {
2084
2097
  /**
2085
2098
  * An argument accepted by a function.
2086
2099
  *
2087
- * This is a specification for an argument at function definition time, not an
2088
- * argument passed at function call time.
2100
+ * This is a specification for an argument at function definition time, not an argument passed at function call time.
2089
2101
  */
2090
2102
  export class FunctionArg extends BaseClient {
2091
2103
  _id = undefined;
@@ -2103,7 +2115,7 @@ export class FunctionArg extends BaseClient {
2103
2115
  this._name = _name;
2104
2116
  }
2105
2117
  /**
2106
- * The ID of the argument
2118
+ * A unique identifier for this FunctionArg.
2107
2119
  */
2108
2120
  id = async () => {
2109
2121
  if (this._id) {
@@ -2117,9 +2129,6 @@ export class FunctionArg extends BaseClient {
2117
2129
  ], await this._ctx.connection());
2118
2130
  return response;
2119
2131
  };
2120
- /**
2121
- * A default value to use for this argument when not explicitly set by the caller, if any
2122
- */
2123
2132
  defaultValue = async () => {
2124
2133
  if (this._defaultValue) {
2125
2134
  return this._defaultValue;
@@ -2132,9 +2141,6 @@ export class FunctionArg extends BaseClient {
2132
2141
  ], await this._ctx.connection());
2133
2142
  return response;
2134
2143
  };
2135
- /**
2136
- * A doc string for the argument, if any
2137
- */
2138
2144
  description = async () => {
2139
2145
  if (this._description) {
2140
2146
  return this._description;
@@ -2147,9 +2153,6 @@ export class FunctionArg extends BaseClient {
2147
2153
  ], await this._ctx.connection());
2148
2154
  return response;
2149
2155
  };
2150
- /**
2151
- * The name of the argument
2152
- */
2153
2156
  name = async () => {
2154
2157
  if (this._name) {
2155
2158
  return this._name;
@@ -2162,9 +2165,6 @@ export class FunctionArg extends BaseClient {
2162
2165
  ], await this._ctx.connection());
2163
2166
  return response;
2164
2167
  };
2165
- /**
2166
- * The type of the argument
2167
- */
2168
2168
  typeDef = () => {
2169
2169
  return new TypeDef({
2170
2170
  queryTree: [
@@ -2177,7 +2177,11 @@ export class FunctionArg extends BaseClient {
2177
2177
  });
2178
2178
  };
2179
2179
  }
2180
+ /**
2181
+ * An active function call.
2182
+ */
2180
2183
  export class FunctionCall extends BaseClient {
2184
+ _id = undefined;
2181
2185
  _name = undefined;
2182
2186
  _parent = undefined;
2183
2187
  _parentName = undefined;
@@ -2185,16 +2189,29 @@ export class FunctionCall extends BaseClient {
2185
2189
  /**
2186
2190
  * Constructor is used for internal usage only, do not create object from it.
2187
2191
  */
2188
- constructor(parent, _name, _parent, _parentName, _returnValue) {
2192
+ constructor(parent, _id, _name, _parent, _parentName, _returnValue) {
2189
2193
  super(parent);
2194
+ this._id = _id;
2190
2195
  this._name = _name;
2191
2196
  this._parent = _parent;
2192
2197
  this._parentName = _parentName;
2193
2198
  this._returnValue = _returnValue;
2194
2199
  }
2195
2200
  /**
2196
- * The argument values the function is being invoked with.
2201
+ * A unique identifier for this FunctionCall.
2197
2202
  */
2203
+ id = async () => {
2204
+ if (this._id) {
2205
+ return this._id;
2206
+ }
2207
+ const response = await computeQuery([
2208
+ ...this._queryTree,
2209
+ {
2210
+ operation: "id",
2211
+ },
2212
+ ], await this._ctx.connection());
2213
+ return response;
2214
+ };
2198
2215
  inputArgs = async () => {
2199
2216
  const response = await computeQuery([
2200
2217
  ...this._queryTree,
@@ -2202,17 +2219,19 @@ export class FunctionCall extends BaseClient {
2202
2219
  operation: "inputArgs",
2203
2220
  },
2204
2221
  {
2205
- operation: "name value",
2222
+ operation: "id",
2206
2223
  },
2207
2224
  ], await this._ctx.connection());
2208
2225
  return response.map((r) => new FunctionCallArgValue({
2209
- queryTree: this.queryTree,
2226
+ queryTree: [
2227
+ {
2228
+ operation: "loadFunctionCallArgValueFromID",
2229
+ args: { id: r.id },
2230
+ },
2231
+ ],
2210
2232
  ctx: this._ctx,
2211
- }, r.name, r.value));
2233
+ }, r.id));
2212
2234
  };
2213
- /**
2214
- * The name of the function being called.
2215
- */
2216
2235
  name = async () => {
2217
2236
  if (this._name) {
2218
2237
  return this._name;
@@ -2225,10 +2244,6 @@ export class FunctionCall extends BaseClient {
2225
2244
  ], await this._ctx.connection());
2226
2245
  return response;
2227
2246
  };
2228
- /**
2229
- * The value of the parent object of the function being called.
2230
- * If the function is "top-level" to the module, this is always an empty object.
2231
- */
2232
2247
  parent = async () => {
2233
2248
  if (this._parent) {
2234
2249
  return this._parent;
@@ -2241,10 +2256,6 @@ export class FunctionCall extends BaseClient {
2241
2256
  ], await this._ctx.connection());
2242
2257
  return response;
2243
2258
  };
2244
- /**
2245
- * The name of the parent object of the function being called.
2246
- * If the function is "top-level" to the module, this is the name of the module.
2247
- */
2248
2259
  parentName = async () => {
2249
2260
  if (this._parentName) {
2250
2261
  return this._parentName;
@@ -2259,7 +2270,7 @@ export class FunctionCall extends BaseClient {
2259
2270
  };
2260
2271
  /**
2261
2272
  * Set the return value of the function call to the provided value.
2262
- * The value should be a string of the JSON serialization of the return value.
2273
+ * @param value JSON serialization of the return value.
2263
2274
  */
2264
2275
  returnValue = async (value) => {
2265
2276
  if (this._returnValue) {
@@ -2275,20 +2286,37 @@ export class FunctionCall extends BaseClient {
2275
2286
  return response;
2276
2287
  };
2277
2288
  }
2289
+ /**
2290
+ * A value passed as a named argument to a function call.
2291
+ */
2278
2292
  export class FunctionCallArgValue extends BaseClient {
2293
+ _id = undefined;
2279
2294
  _name = undefined;
2280
2295
  _value = undefined;
2281
2296
  /**
2282
2297
  * Constructor is used for internal usage only, do not create object from it.
2283
2298
  */
2284
- constructor(parent, _name, _value) {
2299
+ constructor(parent, _id, _name, _value) {
2285
2300
  super(parent);
2301
+ this._id = _id;
2286
2302
  this._name = _name;
2287
2303
  this._value = _value;
2288
2304
  }
2289
2305
  /**
2290
- * The name of the argument.
2306
+ * A unique identifier for this FunctionCallArgValue.
2291
2307
  */
2308
+ id = async () => {
2309
+ if (this._id) {
2310
+ return this._id;
2311
+ }
2312
+ const response = await computeQuery([
2313
+ ...this._queryTree,
2314
+ {
2315
+ operation: "id",
2316
+ },
2317
+ ], await this._ctx.connection());
2318
+ return response;
2319
+ };
2292
2320
  name = async () => {
2293
2321
  if (this._name) {
2294
2322
  return this._name;
@@ -2301,9 +2329,6 @@ export class FunctionCallArgValue extends BaseClient {
2301
2329
  ], await this._ctx.connection());
2302
2330
  return response;
2303
2331
  };
2304
- /**
2305
- * The value of the argument represented as a string of the JSON serialization.
2306
- */
2307
2332
  value = async () => {
2308
2333
  if (this._value) {
2309
2334
  return this._value;
@@ -2317,6 +2342,9 @@ export class FunctionCallArgValue extends BaseClient {
2317
2342
  return response;
2318
2343
  };
2319
2344
  }
2345
+ /**
2346
+ * The result of running an SDK's codegen.
2347
+ */
2320
2348
  export class GeneratedCode extends BaseClient {
2321
2349
  _id = undefined;
2322
2350
  /**
@@ -2326,6 +2354,9 @@ export class GeneratedCode extends BaseClient {
2326
2354
  super(parent);
2327
2355
  this._id = _id;
2328
2356
  }
2357
+ /**
2358
+ * A unique identifier for this GeneratedCode.
2359
+ */
2329
2360
  id = async () => {
2330
2361
  if (this._id) {
2331
2362
  return this._id;
@@ -2338,9 +2369,6 @@ export class GeneratedCode extends BaseClient {
2338
2369
  ], await this._ctx.connection());
2339
2370
  return response;
2340
2371
  };
2341
- /**
2342
- * The directory containing the generated code
2343
- */
2344
2372
  code = () => {
2345
2373
  return new Directory({
2346
2374
  queryTree: [
@@ -2352,9 +2380,6 @@ export class GeneratedCode extends BaseClient {
2352
2380
  ctx: this._ctx,
2353
2381
  });
2354
2382
  };
2355
- /**
2356
- * List of paths to mark generated in version control (i.e. .gitattributes)
2357
- */
2358
2383
  vcsGeneratedPaths = async () => {
2359
2384
  const response = await computeQuery([
2360
2385
  ...this._queryTree,
@@ -2364,9 +2389,6 @@ export class GeneratedCode extends BaseClient {
2364
2389
  ], await this._ctx.connection());
2365
2390
  return response;
2366
2391
  };
2367
- /**
2368
- * List of paths to ignore in version control (i.e. .gitignore)
2369
- */
2370
2392
  vcsIgnoredPaths = async () => {
2371
2393
  const response = await computeQuery([
2372
2394
  ...this._queryTree,
@@ -2377,7 +2399,7 @@ export class GeneratedCode extends BaseClient {
2377
2399
  return response;
2378
2400
  };
2379
2401
  /**
2380
- * Set the list of paths to mark generated in version control
2402
+ * Set the list of paths to mark generated in version control.
2381
2403
  */
2382
2404
  withVCSGeneratedPaths = (paths) => {
2383
2405
  return new GeneratedCode({
@@ -2392,7 +2414,7 @@ export class GeneratedCode extends BaseClient {
2392
2414
  });
2393
2415
  };
2394
2416
  /**
2395
- * Set the list of paths to ignore in version control
2417
+ * Set the list of paths to ignore in version control.
2396
2418
  */
2397
2419
  withVCSIgnoredPaths = (paths) => {
2398
2420
  return new GeneratedCode({
@@ -2416,7 +2438,7 @@ export class GeneratedCode extends BaseClient {
2416
2438
  };
2417
2439
  }
2418
2440
  /**
2419
- * A git ref (tag, branch or commit).
2441
+ * A git ref (tag, branch, or commit).
2420
2442
  */
2421
2443
  export class GitRef extends BaseClient {
2422
2444
  _id = undefined;
@@ -2430,7 +2452,7 @@ export class GitRef extends BaseClient {
2430
2452
  this._commit = _commit;
2431
2453
  }
2432
2454
  /**
2433
- * Retrieves the content-addressed identifier of the git ref.
2455
+ * A unique identifier for this GitRef.
2434
2456
  */
2435
2457
  id = async () => {
2436
2458
  if (this._id) {
@@ -2461,6 +2483,8 @@ export class GitRef extends BaseClient {
2461
2483
  };
2462
2484
  /**
2463
2485
  * The filesystem tree at this ref.
2486
+ * @param opts.sshKnownHosts DEPRECATED: This option should be passed to `git` instead.
2487
+ * @param opts.sshAuthSocket DEPRECATED: This option should be passed to `git` instead.
2464
2488
  */
2465
2489
  tree = (opts) => {
2466
2490
  return new Directory({
@@ -2488,7 +2512,7 @@ export class GitRepository extends BaseClient {
2488
2512
  this._id = _id;
2489
2513
  }
2490
2514
  /**
2491
- * Retrieves the content-addressed identifier of the git repository.
2515
+ * A unique identifier for this GitRepository.
2492
2516
  */
2493
2517
  id = async () => {
2494
2518
  if (this._id) {
@@ -2503,7 +2527,7 @@ export class GitRepository extends BaseClient {
2503
2527
  return response;
2504
2528
  };
2505
2529
  /**
2506
- * Returns details on one branch.
2530
+ * Returns details of a branch.
2507
2531
  * @param name Branch's name (e.g., "main").
2508
2532
  */
2509
2533
  branch = (name) => {
@@ -2519,7 +2543,7 @@ export class GitRepository extends BaseClient {
2519
2543
  });
2520
2544
  };
2521
2545
  /**
2522
- * Returns details on one commit.
2546
+ * Returns details of a commit.
2523
2547
  * @param id Identifier of the commit (e.g., "b6315d8f2810962c601af73f86831f6866ea798b").
2524
2548
  */
2525
2549
  commit = (id) => {
@@ -2535,7 +2559,7 @@ export class GitRepository extends BaseClient {
2535
2559
  });
2536
2560
  };
2537
2561
  /**
2538
- * Returns details on one tag.
2562
+ * Returns details of a tag.
2539
2563
  * @param name Tag's name (e.g., "v0.3.9").
2540
2564
  */
2541
2565
  tag = (name) => {
@@ -2552,15 +2576,32 @@ export class GitRepository extends BaseClient {
2552
2576
  };
2553
2577
  }
2554
2578
  /**
2555
- * Information about the host execution environment.
2579
+ * Information about the host environment.
2556
2580
  */
2557
2581
  export class Host extends BaseClient {
2582
+ _id = undefined;
2558
2583
  /**
2559
2584
  * Constructor is used for internal usage only, do not create object from it.
2560
2585
  */
2561
- constructor(parent) {
2586
+ constructor(parent, _id) {
2562
2587
  super(parent);
2588
+ this._id = _id;
2563
2589
  }
2590
+ /**
2591
+ * A unique identifier for this Host.
2592
+ */
2593
+ id = async () => {
2594
+ if (this._id) {
2595
+ return this._id;
2596
+ }
2597
+ const response = await computeQuery([
2598
+ ...this._queryTree,
2599
+ {
2600
+ operation: "id",
2601
+ },
2602
+ ], await this._ctx.connection());
2603
+ return response;
2604
+ };
2564
2605
  /**
2565
2606
  * Accesses a directory on the host.
2566
2607
  * @param path Location of the directory to access (e.g., ".").
@@ -2597,21 +2638,20 @@ export class Host extends BaseClient {
2597
2638
  };
2598
2639
  /**
2599
2640
  * Creates a service that forwards traffic to a specified address via the host.
2600
- * @param ports Ports to expose via the service, forwarding through the host network.
2641
+ * @param opts.host Upstream host to forward traffic to.
2642
+ * @param opts.ports Ports to expose via the service, forwarding through the host network.
2601
2643
  *
2602
- * If a port's frontend is unspecified or 0, it defaults to the same as the
2603
- * backend port.
2644
+ * If a port's frontend is unspecified or 0, it defaults to the same as the backend port.
2604
2645
  *
2605
2646
  * An empty set of ports is not valid; an error will be returned.
2606
- * @param opts.host Upstream host to forward traffic to.
2607
2647
  */
2608
- service = (ports, opts) => {
2648
+ service = (opts) => {
2609
2649
  return new Service({
2610
2650
  queryTree: [
2611
2651
  ...this._queryTree,
2612
2652
  {
2613
2653
  operation: "service",
2614
- args: { ports, ...opts },
2654
+ args: { ...opts },
2615
2655
  },
2616
2656
  ],
2617
2657
  ctx: this._ctx,
@@ -2619,6 +2659,7 @@ export class Host extends BaseClient {
2619
2659
  };
2620
2660
  /**
2621
2661
  * Sets a secret given a user-defined name and the file path on the host, and returns the secret.
2662
+ *
2622
2663
  * The file is limited to a size of 512000 bytes.
2623
2664
  * @param name The user defined name for this secret.
2624
2665
  * @param path Location of the file to set as a secret.
@@ -2638,20 +2679,16 @@ export class Host extends BaseClient {
2638
2679
  /**
2639
2680
  * Creates a tunnel that forwards traffic from the host to a service.
2640
2681
  * @param service Service to send traffic from the tunnel.
2641
- * @param opts.native Map each service port to the same port on the host, as if the service were
2642
- * running natively.
2643
- *
2644
- * Note: enabling may result in port conflicts.
2645
2682
  * @param opts.ports Configure explicit port forwarding rules for the tunnel.
2646
2683
  *
2647
- * If a port's frontend is unspecified or 0, a random port will be chosen by
2648
- * the host.
2684
+ * If a port's frontend is unspecified or 0, a random port will be chosen by the host.
2649
2685
  *
2650
- * If no ports are given, all of the service's ports are forwarded. If native
2651
- * is true, each port maps to the same port on the host. If native is false,
2652
- * each port maps to a random port chosen by the host.
2686
+ * If no ports are given, all of the service's ports are forwarded. If native is true, each port maps to the same port on the host. If native is false, each port maps to a random port chosen by the host.
2653
2687
  *
2654
2688
  * If ports are given and native is true, the ports are additive.
2689
+ * @param opts.native Map each service port to the same port on the host, as if the service were running natively.
2690
+ *
2691
+ * Note: enabling may result in port conflicts.
2655
2692
  */
2656
2693
  tunnel = (service, opts) => {
2657
2694
  return new Service({
@@ -2683,63 +2720,178 @@ export class Host extends BaseClient {
2683
2720
  };
2684
2721
  }
2685
2722
  /**
2686
- * A simple key value object that represents a label.
2723
+ * A definition of a custom interface defined in a Module.
2687
2724
  */
2688
- export class Label extends BaseClient {
2725
+ export class InterfaceTypeDef extends BaseClient {
2726
+ _id = undefined;
2727
+ _description = undefined;
2689
2728
  _name = undefined;
2690
- _value = undefined;
2729
+ _sourceModuleName = undefined;
2691
2730
  /**
2692
2731
  * Constructor is used for internal usage only, do not create object from it.
2693
2732
  */
2694
- constructor(parent, _name, _value) {
2733
+ constructor(parent, _id, _description, _name, _sourceModuleName) {
2695
2734
  super(parent);
2735
+ this._id = _id;
2736
+ this._description = _description;
2696
2737
  this._name = _name;
2697
- this._value = _value;
2738
+ this._sourceModuleName = _sourceModuleName;
2698
2739
  }
2699
2740
  /**
2700
- * The label name.
2741
+ * A unique identifier for this InterfaceTypeDef.
2701
2742
  */
2702
- name = async () => {
2703
- if (this._name) {
2704
- return this._name;
2743
+ id = async () => {
2744
+ if (this._id) {
2745
+ return this._id;
2705
2746
  }
2706
2747
  const response = await computeQuery([
2707
2748
  ...this._queryTree,
2708
2749
  {
2709
- operation: "name",
2750
+ operation: "id",
2710
2751
  },
2711
2752
  ], await this._ctx.connection());
2712
2753
  return response;
2713
2754
  };
2714
- /**
2715
- * The label value.
2716
- */
2717
- value = async () => {
2718
- if (this._value) {
2719
- return this._value;
2755
+ description = async () => {
2756
+ if (this._description) {
2757
+ return this._description;
2720
2758
  }
2721
2759
  const response = await computeQuery([
2722
2760
  ...this._queryTree,
2723
2761
  {
2724
- operation: "value",
2762
+ operation: "description",
2725
2763
  },
2726
2764
  ], await this._ctx.connection());
2727
2765
  return response;
2728
2766
  };
2729
- }
2730
- /**
2731
- * A definition of a list type in a Module.
2732
- */
2733
- export class ListTypeDef extends BaseClient {
2734
- /**
2735
- * Constructor is used for internal usage only, do not create object from it.
2736
- */
2737
- constructor(parent) {
2738
- super(parent);
2739
- }
2740
- /**
2741
- * The type of the elements in the list
2767
+ functions = async () => {
2768
+ const response = await computeQuery([
2769
+ ...this._queryTree,
2770
+ {
2771
+ operation: "functions",
2772
+ },
2773
+ {
2774
+ operation: "id",
2775
+ },
2776
+ ], await this._ctx.connection());
2777
+ return response.map((r) => new Function_({
2778
+ queryTree: [
2779
+ {
2780
+ operation: "loadFunction_FromID",
2781
+ args: { id: r.id },
2782
+ },
2783
+ ],
2784
+ ctx: this._ctx,
2785
+ }, r.id));
2786
+ };
2787
+ name = async () => {
2788
+ if (this._name) {
2789
+ return this._name;
2790
+ }
2791
+ const response = await computeQuery([
2792
+ ...this._queryTree,
2793
+ {
2794
+ operation: "name",
2795
+ },
2796
+ ], await this._ctx.connection());
2797
+ return response;
2798
+ };
2799
+ sourceModuleName = async () => {
2800
+ if (this._sourceModuleName) {
2801
+ return this._sourceModuleName;
2802
+ }
2803
+ const response = await computeQuery([
2804
+ ...this._queryTree,
2805
+ {
2806
+ operation: "sourceModuleName",
2807
+ },
2808
+ ], await this._ctx.connection());
2809
+ return response;
2810
+ };
2811
+ }
2812
+ /**
2813
+ * A simple key value object that represents a label.
2814
+ */
2815
+ export class Label extends BaseClient {
2816
+ _id = undefined;
2817
+ _name = undefined;
2818
+ _value = undefined;
2819
+ /**
2820
+ * Constructor is used for internal usage only, do not create object from it.
2821
+ */
2822
+ constructor(parent, _id, _name, _value) {
2823
+ super(parent);
2824
+ this._id = _id;
2825
+ this._name = _name;
2826
+ this._value = _value;
2827
+ }
2828
+ /**
2829
+ * A unique identifier for this Label.
2830
+ */
2831
+ id = async () => {
2832
+ if (this._id) {
2833
+ return this._id;
2834
+ }
2835
+ const response = await computeQuery([
2836
+ ...this._queryTree,
2837
+ {
2838
+ operation: "id",
2839
+ },
2840
+ ], await this._ctx.connection());
2841
+ return response;
2842
+ };
2843
+ name = async () => {
2844
+ if (this._name) {
2845
+ return this._name;
2846
+ }
2847
+ const response = await computeQuery([
2848
+ ...this._queryTree,
2849
+ {
2850
+ operation: "name",
2851
+ },
2852
+ ], await this._ctx.connection());
2853
+ return response;
2854
+ };
2855
+ value = async () => {
2856
+ if (this._value) {
2857
+ return this._value;
2858
+ }
2859
+ const response = await computeQuery([
2860
+ ...this._queryTree,
2861
+ {
2862
+ operation: "value",
2863
+ },
2864
+ ], await this._ctx.connection());
2865
+ return response;
2866
+ };
2867
+ }
2868
+ /**
2869
+ * A definition of a list type in a Module.
2870
+ */
2871
+ export class ListTypeDef extends BaseClient {
2872
+ _id = undefined;
2873
+ /**
2874
+ * Constructor is used for internal usage only, do not create object from it.
2742
2875
  */
2876
+ constructor(parent, _id) {
2877
+ super(parent);
2878
+ this._id = _id;
2879
+ }
2880
+ /**
2881
+ * A unique identifier for this ListTypeDef.
2882
+ */
2883
+ id = async () => {
2884
+ if (this._id) {
2885
+ return this._id;
2886
+ }
2887
+ const response = await computeQuery([
2888
+ ...this._queryTree,
2889
+ {
2890
+ operation: "id",
2891
+ },
2892
+ ], await this._ctx.connection());
2893
+ return response;
2894
+ };
2743
2895
  elementTypeDef = () => {
2744
2896
  return new TypeDef({
2745
2897
  queryTree: [
@@ -2752,27 +2904,30 @@ export class ListTypeDef extends BaseClient {
2752
2904
  });
2753
2905
  };
2754
2906
  }
2907
+ /**
2908
+ * A Dagger module.
2909
+ */
2755
2910
  export class Module_ extends BaseClient {
2756
2911
  _id = undefined;
2757
2912
  _description = undefined;
2758
2913
  _name = undefined;
2759
2914
  _sdk = undefined;
2760
2915
  _serve = undefined;
2761
- _sourceDirectorySubPath = undefined;
2916
+ _sourceDirectorySubpath = undefined;
2762
2917
  /**
2763
2918
  * Constructor is used for internal usage only, do not create object from it.
2764
2919
  */
2765
- constructor(parent, _id, _description, _name, _sdk, _serve, _sourceDirectorySubPath) {
2920
+ constructor(parent, _id, _description, _name, _sdk, _serve, _sourceDirectorySubpath) {
2766
2921
  super(parent);
2767
2922
  this._id = _id;
2768
2923
  this._description = _description;
2769
2924
  this._name = _name;
2770
2925
  this._sdk = _sdk;
2771
2926
  this._serve = _serve;
2772
- this._sourceDirectorySubPath = _sourceDirectorySubPath;
2927
+ this._sourceDirectorySubpath = _sourceDirectorySubpath;
2773
2928
  }
2774
2929
  /**
2775
- * The ID of the module
2930
+ * A unique identifier for this Module.
2776
2931
  */
2777
2932
  id = async () => {
2778
2933
  if (this._id) {
@@ -2786,9 +2941,6 @@ export class Module_ extends BaseClient {
2786
2941
  ], await this._ctx.connection());
2787
2942
  return response;
2788
2943
  };
2789
- /**
2790
- * Modules used by this module
2791
- */
2792
2944
  dependencies = async () => {
2793
2945
  const response = await computeQuery([
2794
2946
  ...this._queryTree,
@@ -2800,13 +2952,15 @@ export class Module_ extends BaseClient {
2800
2952
  },
2801
2953
  ], await this._ctx.connection());
2802
2954
  return response.map((r) => new Module_({
2803
- queryTree: this.queryTree,
2955
+ queryTree: [
2956
+ {
2957
+ operation: "loadModule_FromID",
2958
+ args: { id: r.id },
2959
+ },
2960
+ ],
2804
2961
  ctx: this._ctx,
2805
2962
  }, r.id));
2806
2963
  };
2807
- /**
2808
- * The dependencies as configured by the module
2809
- */
2810
2964
  dependencyConfig = async () => {
2811
2965
  const response = await computeQuery([
2812
2966
  ...this._queryTree,
@@ -2816,9 +2970,6 @@ export class Module_ extends BaseClient {
2816
2970
  ], await this._ctx.connection());
2817
2971
  return response;
2818
2972
  };
2819
- /**
2820
- * The doc string of the module, if any
2821
- */
2822
2973
  description = async () => {
2823
2974
  if (this._description) {
2824
2975
  return this._description;
@@ -2831,9 +2982,6 @@ export class Module_ extends BaseClient {
2831
2982
  ], await this._ctx.connection());
2832
2983
  return response;
2833
2984
  };
2834
- /**
2835
- * The code generated by the SDK's runtime
2836
- */
2837
2985
  generatedCode = () => {
2838
2986
  return new GeneratedCode({
2839
2987
  queryTree: [
@@ -2846,8 +2994,39 @@ export class Module_ extends BaseClient {
2846
2994
  });
2847
2995
  };
2848
2996
  /**
2849
- * The name of the module
2997
+ * Retrieves the module with the objects loaded via its SDK.
2850
2998
  */
2999
+ initialize = () => {
3000
+ return new Module_({
3001
+ queryTree: [
3002
+ ...this._queryTree,
3003
+ {
3004
+ operation: "initialize",
3005
+ },
3006
+ ],
3007
+ ctx: this._ctx,
3008
+ });
3009
+ };
3010
+ interfaces = async () => {
3011
+ const response = await computeQuery([
3012
+ ...this._queryTree,
3013
+ {
3014
+ operation: "interfaces",
3015
+ },
3016
+ {
3017
+ operation: "id",
3018
+ },
3019
+ ], await this._ctx.connection());
3020
+ return response.map((r) => new TypeDef({
3021
+ queryTree: [
3022
+ {
3023
+ operation: "loadTypeDefFromID",
3024
+ args: { id: r.id },
3025
+ },
3026
+ ],
3027
+ ctx: this._ctx,
3028
+ }, r.id));
3029
+ };
2851
3030
  name = async () => {
2852
3031
  if (this._name) {
2853
3032
  return this._name;
@@ -2860,9 +3039,6 @@ export class Module_ extends BaseClient {
2860
3039
  ], await this._ctx.connection());
2861
3040
  return response;
2862
3041
  };
2863
- /**
2864
- * Objects served by this module
2865
- */
2866
3042
  objects = async () => {
2867
3043
  const response = await computeQuery([
2868
3044
  ...this._queryTree,
@@ -2874,13 +3050,15 @@ export class Module_ extends BaseClient {
2874
3050
  },
2875
3051
  ], await this._ctx.connection());
2876
3052
  return response.map((r) => new TypeDef({
2877
- queryTree: this.queryTree,
3053
+ queryTree: [
3054
+ {
3055
+ operation: "loadTypeDefFromID",
3056
+ args: { id: r.id },
3057
+ },
3058
+ ],
2878
3059
  ctx: this._ctx,
2879
3060
  }, r.id));
2880
3061
  };
2881
- /**
2882
- * The SDK used by this module. Either a name of a builtin SDK or a module ref pointing to the SDK's implementation.
2883
- */
2884
3062
  sdk = async () => {
2885
3063
  if (this._sdk) {
2886
3064
  return this._sdk;
@@ -2895,8 +3073,8 @@ export class Module_ extends BaseClient {
2895
3073
  };
2896
3074
  /**
2897
3075
  * Serve a module's API in the current session.
2898
- * Note: this can only be called once per session.
2899
- * In the future, it could return a stream or service to remove the side effect.
3076
+ *
3077
+ * Note: this can only be called once per session. In the future, it could return a stream or service to remove the side effect.
2900
3078
  */
2901
3079
  serve = async () => {
2902
3080
  if (this._serve) {
@@ -2910,9 +3088,6 @@ export class Module_ extends BaseClient {
2910
3088
  ], await this._ctx.connection());
2911
3089
  return response;
2912
3090
  };
2913
- /**
2914
- * The directory containing the module's source code
2915
- */
2916
3091
  sourceDirectory = () => {
2917
3092
  return new Directory({
2918
3093
  queryTree: [
@@ -2924,23 +3099,35 @@ export class Module_ extends BaseClient {
2924
3099
  ctx: this._ctx,
2925
3100
  });
2926
3101
  };
2927
- /**
2928
- * The module's subpath within the source directory
2929
- */
2930
- sourceDirectorySubPath = async () => {
2931
- if (this._sourceDirectorySubPath) {
2932
- return this._sourceDirectorySubPath;
3102
+ sourceDirectorySubpath = async () => {
3103
+ if (this._sourceDirectorySubpath) {
3104
+ return this._sourceDirectorySubpath;
2933
3105
  }
2934
3106
  const response = await computeQuery([
2935
3107
  ...this._queryTree,
2936
3108
  {
2937
- operation: "sourceDirectorySubPath",
3109
+ operation: "sourceDirectorySubpath",
2938
3110
  },
2939
3111
  ], await this._ctx.connection());
2940
3112
  return response;
2941
3113
  };
2942
3114
  /**
2943
- * This module plus the given Object type and associated functions
3115
+ * This module plus the given Interface type and associated functions
3116
+ */
3117
+ withInterface = (iface) => {
3118
+ return new Module_({
3119
+ queryTree: [
3120
+ ...this._queryTree,
3121
+ {
3122
+ operation: "withInterface",
3123
+ args: { iface },
3124
+ },
3125
+ ],
3126
+ ctx: this._ctx,
3127
+ });
3128
+ };
3129
+ /**
3130
+ * This module plus the given Object type and associated functions.
2944
3131
  */
2945
3132
  withObject = (object) => {
2946
3133
  return new Module_({
@@ -2954,6 +3141,27 @@ export class Module_ extends BaseClient {
2954
3141
  ctx: this._ctx,
2955
3142
  });
2956
3143
  };
3144
+ /**
3145
+ * Retrieves the module with basic configuration loaded, ready for initialization.
3146
+ * @param directory The directory containing the module's source code.
3147
+ * @param opts.subpath An optional subpath of the directory which contains the module's source code.
3148
+ *
3149
+ * This is needed when the module code is in a subdirectory but requires parent directories to be loaded in order to execute. For example, the module source code may need a go.mod, project.toml, package.json, etc. file from a parent directory.
3150
+ *
3151
+ * If not set, the module source code is loaded from the root of the directory.
3152
+ */
3153
+ withSource = (directory, opts) => {
3154
+ return new Module_({
3155
+ queryTree: [
3156
+ ...this._queryTree,
3157
+ {
3158
+ operation: "withSource",
3159
+ args: { directory, ...opts },
3160
+ },
3161
+ ],
3162
+ ctx: this._ctx,
3163
+ });
3164
+ };
2957
3165
  /**
2958
3166
  * Call the provided function with current Module.
2959
3167
  *
@@ -2967,21 +3175,35 @@ export class Module_ extends BaseClient {
2967
3175
  * Static configuration for a module (e.g. parsed contents of dagger.json)
2968
3176
  */
2969
3177
  export class ModuleConfig extends BaseClient {
3178
+ _id = undefined;
2970
3179
  _name = undefined;
2971
3180
  _root = undefined;
2972
3181
  _sdk = undefined;
2973
3182
  /**
2974
3183
  * Constructor is used for internal usage only, do not create object from it.
2975
3184
  */
2976
- constructor(parent, _name, _root, _sdk) {
3185
+ constructor(parent, _id, _name, _root, _sdk) {
2977
3186
  super(parent);
3187
+ this._id = _id;
2978
3188
  this._name = _name;
2979
3189
  this._root = _root;
2980
3190
  this._sdk = _sdk;
2981
3191
  }
2982
3192
  /**
2983
- * Modules that this module depends on.
3193
+ * A unique identifier for this ModuleConfig.
2984
3194
  */
3195
+ id = async () => {
3196
+ if (this._id) {
3197
+ return this._id;
3198
+ }
3199
+ const response = await computeQuery([
3200
+ ...this._queryTree,
3201
+ {
3202
+ operation: "id",
3203
+ },
3204
+ ], await this._ctx.connection());
3205
+ return response;
3206
+ };
2985
3207
  dependencies = async () => {
2986
3208
  const response = await computeQuery([
2987
3209
  ...this._queryTree,
@@ -2991,9 +3213,6 @@ export class ModuleConfig extends BaseClient {
2991
3213
  ], await this._ctx.connection());
2992
3214
  return response;
2993
3215
  };
2994
- /**
2995
- * Exclude these file globs when loading the module root.
2996
- */
2997
3216
  exclude = async () => {
2998
3217
  const response = await computeQuery([
2999
3218
  ...this._queryTree,
@@ -3003,9 +3222,6 @@ export class ModuleConfig extends BaseClient {
3003
3222
  ], await this._ctx.connection());
3004
3223
  return response;
3005
3224
  };
3006
- /**
3007
- * Include only these file globs when loading the module root.
3008
- */
3009
3225
  include = async () => {
3010
3226
  const response = await computeQuery([
3011
3227
  ...this._queryTree,
@@ -3015,9 +3231,6 @@ export class ModuleConfig extends BaseClient {
3015
3231
  ], await this._ctx.connection());
3016
3232
  return response;
3017
3233
  };
3018
- /**
3019
- * The name of the module.
3020
- */
3021
3234
  name = async () => {
3022
3235
  if (this._name) {
3023
3236
  return this._name;
@@ -3030,9 +3243,6 @@ export class ModuleConfig extends BaseClient {
3030
3243
  ], await this._ctx.connection());
3031
3244
  return response;
3032
3245
  };
3033
- /**
3034
- * The root directory of the module's project, which may be above the module source code.
3035
- */
3036
3246
  root = async () => {
3037
3247
  if (this._root) {
3038
3248
  return this._root;
@@ -3045,9 +3255,6 @@ export class ModuleConfig extends BaseClient {
3045
3255
  ], await this._ctx.connection());
3046
3256
  return response;
3047
3257
  };
3048
- /**
3049
- * Either the name of a built-in SDK ('go', 'python', etc.) OR a module reference pointing to the SDK's module implementation.
3050
- */
3051
3258
  sdk = async () => {
3052
3259
  if (this._sdk) {
3053
3260
  return this._sdk;
@@ -3065,19 +3272,35 @@ export class ModuleConfig extends BaseClient {
3065
3272
  * A definition of a custom object defined in a Module.
3066
3273
  */
3067
3274
  export class ObjectTypeDef extends BaseClient {
3275
+ _id = undefined;
3068
3276
  _description = undefined;
3069
3277
  _name = undefined;
3278
+ _sourceModuleName = undefined;
3070
3279
  /**
3071
3280
  * Constructor is used for internal usage only, do not create object from it.
3072
3281
  */
3073
- constructor(parent, _description, _name) {
3282
+ constructor(parent, _id, _description, _name, _sourceModuleName) {
3074
3283
  super(parent);
3284
+ this._id = _id;
3075
3285
  this._description = _description;
3076
3286
  this._name = _name;
3287
+ this._sourceModuleName = _sourceModuleName;
3077
3288
  }
3078
3289
  /**
3079
- * The function used to construct new instances of this object, if any
3290
+ * A unique identifier for this ObjectTypeDef.
3080
3291
  */
3292
+ id = async () => {
3293
+ if (this._id) {
3294
+ return this._id;
3295
+ }
3296
+ const response = await computeQuery([
3297
+ ...this._queryTree,
3298
+ {
3299
+ operation: "id",
3300
+ },
3301
+ ], await this._ctx.connection());
3302
+ return response;
3303
+ };
3081
3304
  constructor_ = () => {
3082
3305
  return new Function_({
3083
3306
  queryTree: [
@@ -3089,9 +3312,6 @@ export class ObjectTypeDef extends BaseClient {
3089
3312
  ctx: this._ctx,
3090
3313
  });
3091
3314
  };
3092
- /**
3093
- * The doc string for the object, if any
3094
- */
3095
3315
  description = async () => {
3096
3316
  if (this._description) {
3097
3317
  return this._description;
@@ -3104,9 +3324,6 @@ export class ObjectTypeDef extends BaseClient {
3104
3324
  ], await this._ctx.connection());
3105
3325
  return response;
3106
3326
  };
3107
- /**
3108
- * Static fields defined on this object, if any
3109
- */
3110
3327
  fields = async () => {
3111
3328
  const response = await computeQuery([
3112
3329
  ...this._queryTree,
@@ -3114,17 +3331,19 @@ export class ObjectTypeDef extends BaseClient {
3114
3331
  operation: "fields",
3115
3332
  },
3116
3333
  {
3117
- operation: "description name",
3334
+ operation: "id",
3118
3335
  },
3119
3336
  ], await this._ctx.connection());
3120
3337
  return response.map((r) => new FieldTypeDef({
3121
- queryTree: this.queryTree,
3338
+ queryTree: [
3339
+ {
3340
+ operation: "loadFieldTypeDefFromID",
3341
+ args: { id: r.id },
3342
+ },
3343
+ ],
3122
3344
  ctx: this._ctx,
3123
- }, r.description, r.name));
3345
+ }, r.id));
3124
3346
  };
3125
- /**
3126
- * Functions defined on this object, if any
3127
- */
3128
3347
  functions = async () => {
3129
3348
  const response = await computeQuery([
3130
3349
  ...this._queryTree,
@@ -3136,13 +3355,15 @@ export class ObjectTypeDef extends BaseClient {
3136
3355
  },
3137
3356
  ], await this._ctx.connection());
3138
3357
  return response.map((r) => new Function_({
3139
- queryTree: this.queryTree,
3358
+ queryTree: [
3359
+ {
3360
+ operation: "loadFunction_FromID",
3361
+ args: { id: r.id },
3362
+ },
3363
+ ],
3140
3364
  ctx: this._ctx,
3141
3365
  }, r.id));
3142
3366
  };
3143
- /**
3144
- * The name of the object
3145
- */
3146
3367
  name = async () => {
3147
3368
  if (this._name) {
3148
3369
  return this._name;
@@ -3155,26 +3376,52 @@ export class ObjectTypeDef extends BaseClient {
3155
3376
  ], await this._ctx.connection());
3156
3377
  return response;
3157
3378
  };
3379
+ sourceModuleName = async () => {
3380
+ if (this._sourceModuleName) {
3381
+ return this._sourceModuleName;
3382
+ }
3383
+ const response = await computeQuery([
3384
+ ...this._queryTree,
3385
+ {
3386
+ operation: "sourceModuleName",
3387
+ },
3388
+ ], await this._ctx.connection());
3389
+ return response;
3390
+ };
3158
3391
  }
3159
3392
  /**
3160
3393
  * A port exposed by a container.
3161
3394
  */
3162
3395
  export class Port extends BaseClient {
3396
+ _id = undefined;
3163
3397
  _description = undefined;
3164
3398
  _port = undefined;
3165
3399
  _protocol = undefined;
3166
3400
  /**
3167
3401
  * Constructor is used for internal usage only, do not create object from it.
3168
3402
  */
3169
- constructor(parent, _description, _port, _protocol) {
3403
+ constructor(parent, _id, _description, _port, _protocol) {
3170
3404
  super(parent);
3405
+ this._id = _id;
3171
3406
  this._description = _description;
3172
3407
  this._port = _port;
3173
3408
  this._protocol = _protocol;
3174
3409
  }
3175
3410
  /**
3176
- * The port description.
3411
+ * A unique identifier for this Port.
3177
3412
  */
3413
+ id = async () => {
3414
+ if (this._id) {
3415
+ return this._id;
3416
+ }
3417
+ const response = await computeQuery([
3418
+ ...this._queryTree,
3419
+ {
3420
+ operation: "id",
3421
+ },
3422
+ ], await this._ctx.connection());
3423
+ return response;
3424
+ };
3178
3425
  description = async () => {
3179
3426
  if (this._description) {
3180
3427
  return this._description;
@@ -3187,9 +3434,6 @@ export class Port extends BaseClient {
3187
3434
  ], await this._ctx.connection());
3188
3435
  return response;
3189
3436
  };
3190
- /**
3191
- * The port number.
3192
- */
3193
3437
  port = async () => {
3194
3438
  if (this._port) {
3195
3439
  return this._port;
@@ -3202,9 +3446,6 @@ export class Port extends BaseClient {
3202
3446
  ], await this._ctx.connection());
3203
3447
  return response;
3204
3448
  };
3205
- /**
3206
- * The transport layer network protocol.
3207
- */
3208
3449
  protocol = async () => {
3209
3450
  if (this._protocol) {
3210
3451
  return this._protocol;
@@ -3218,6 +3459,9 @@ export class Port extends BaseClient {
3218
3459
  return response;
3219
3460
  };
3220
3461
  }
3462
+ /**
3463
+ * The root of the DAG.
3464
+ */
3221
3465
  export class Client extends BaseClient {
3222
3466
  _checkVersionCompatibility = undefined;
3223
3467
  _defaultPlatform = undefined;
@@ -3229,6 +3473,25 @@ export class Client extends BaseClient {
3229
3473
  this._checkVersionCompatibility = _checkVersionCompatibility;
3230
3474
  this._defaultPlatform = _defaultPlatform;
3231
3475
  }
3476
+ /**
3477
+ * Retrieves a content-addressed blob.
3478
+ * @param digest Digest of the blob
3479
+ * @param size Size of the blob
3480
+ * @param mediaType Media type of the blob
3481
+ * @param uncompressed Digest of the uncompressed blob
3482
+ */
3483
+ blob = (digest, size, mediaType, uncompressed) => {
3484
+ return new Directory({
3485
+ queryTree: [
3486
+ ...this._queryTree,
3487
+ {
3488
+ operation: "blob",
3489
+ args: { digest, size, mediaType, uncompressed },
3490
+ },
3491
+ ],
3492
+ ctx: this._ctx,
3493
+ });
3494
+ };
3232
3495
  /**
3233
3496
  * Constructs a cache volume for a given cache key.
3234
3497
  * @param key A string identifier to target this cache volume (e.g., "modules-cache").
@@ -3247,7 +3510,7 @@ export class Client extends BaseClient {
3247
3510
  };
3248
3511
  /**
3249
3512
  * Checks if the current Dagger Engine is compatible with an SDK's required version.
3250
- * @param version The SDK's required version.
3513
+ * @param version Version required by the SDK.
3251
3514
  */
3252
3515
  checkVersionCompatibility = async (version) => {
3253
3516
  const response = await computeQuery([
@@ -3260,10 +3523,11 @@ export class Client extends BaseClient {
3260
3523
  return response;
3261
3524
  };
3262
3525
  /**
3263
- * Creates a scratch container or loads one by ID.
3526
+ * Creates a scratch container.
3264
3527
  *
3265
- * Optional platform argument initializes new containers to execute and publish
3266
- * as that platform. Platform defaults to that of the builder's host.
3528
+ * Optional platform argument initializes new containers to execute and publish as that platform. Platform defaults to that of the builder's host.
3529
+ * @param opts.id DEPRECATED: Use `loadContainerFromID` instead.
3530
+ * @param opts.platform Platform to initialize the container with.
3267
3531
  */
3268
3532
  container = (opts) => {
3269
3533
  return new Container({
@@ -3279,8 +3543,8 @@ export class Client extends BaseClient {
3279
3543
  };
3280
3544
  /**
3281
3545
  * The FunctionCall context that the SDK caller is currently executing in.
3282
- * If the caller is not currently executing in a function, this will return
3283
- * an error.
3546
+ *
3547
+ * If the caller is not currently executing in a function, this will return an error.
3284
3548
  */
3285
3549
  currentFunctionCall = () => {
3286
3550
  return new FunctionCall({
@@ -3308,7 +3572,30 @@ export class Client extends BaseClient {
3308
3572
  });
3309
3573
  };
3310
3574
  /**
3311
- * The default platform of the builder.
3575
+ * The TypeDef representations of the objects currently being served in the session.
3576
+ */
3577
+ currentTypeDefs = async () => {
3578
+ const response = await computeQuery([
3579
+ ...this._queryTree,
3580
+ {
3581
+ operation: "currentTypeDefs",
3582
+ },
3583
+ {
3584
+ operation: "id",
3585
+ },
3586
+ ], await this._ctx.connection());
3587
+ return response.map((r) => new TypeDef({
3588
+ queryTree: [
3589
+ {
3590
+ operation: "loadTypeDefFromID",
3591
+ args: { id: r.id },
3592
+ },
3593
+ ],
3594
+ ctx: this._ctx,
3595
+ }, r.id));
3596
+ };
3597
+ /**
3598
+ * The default platform of the engine.
3312
3599
  */
3313
3600
  defaultPlatform = async () => {
3314
3601
  const response = await computeQuery([
@@ -3320,7 +3607,8 @@ export class Client extends BaseClient {
3320
3607
  return response;
3321
3608
  };
3322
3609
  /**
3323
- * Creates an empty directory or loads one by ID.
3610
+ * Creates an empty directory.
3611
+ * @param opts.id DEPRECATED: Use `loadDirectoryFromID` isntead.
3324
3612
  */
3325
3613
  directory = (opts) => {
3326
3614
  return new Directory({
@@ -3335,7 +3623,6 @@ export class Client extends BaseClient {
3335
3623
  });
3336
3624
  };
3337
3625
  /**
3338
- * Loads a file by ID.
3339
3626
  * @deprecated Use loadFileFromID instead.
3340
3627
  */
3341
3628
  file = (id) => {
@@ -3351,7 +3638,9 @@ export class Client extends BaseClient {
3351
3638
  });
3352
3639
  };
3353
3640
  /**
3354
- * Create a function.
3641
+ * Creates a function.
3642
+ * @param name Name of the function, in its original format from the implementation language.
3643
+ * @param returnType Return type of the function.
3355
3644
  */
3356
3645
  function_ = (name, returnType) => {
3357
3646
  return new Function_({
@@ -3366,8 +3655,7 @@ export class Client extends BaseClient {
3366
3655
  });
3367
3656
  };
3368
3657
  /**
3369
- * Create a code generation result, given a directory containing the generated
3370
- * code.
3658
+ * Create a code generation result, given a directory containing the generated code.
3371
3659
  */
3372
3660
  generatedCode = (code) => {
3373
3661
  return new GeneratedCode({
@@ -3382,14 +3670,16 @@ export class Client extends BaseClient {
3382
3670
  });
3383
3671
  };
3384
3672
  /**
3385
- * Queries a git repository.
3386
- * @param url Url of the git repository.
3387
- * Can be formatted as `https://{host}/{owner}/{repo}`, `git@{host}:{owner}/{repo}`
3673
+ * Queries a Git repository.
3674
+ * @param url URL of the git repository.
3675
+ *
3676
+ * Can be formatted as `https://{host}/{owner}/{repo}`, `git@{host}:{owner}/{repo}`.
3677
+ *
3388
3678
  * Suffix ".git" is optional.
3389
3679
  * @param opts.keepGitDir Set to true to keep .git directory.
3680
+ * @param opts.experimentalServiceHost A service which must be started before the repo is fetched.
3390
3681
  * @param opts.sshKnownHosts Set SSH known hosts
3391
3682
  * @param opts.sshAuthSocket Set SSH auth socket
3392
- * @param opts.experimentalServiceHost A service which must be started before the repo is fetched.
3393
3683
  */
3394
3684
  git = (url, opts) => {
3395
3685
  return new GitRepository({
@@ -3450,7 +3740,7 @@ export class Client extends BaseClient {
3450
3740
  });
3451
3741
  };
3452
3742
  /**
3453
- * Loads a container from an ID.
3743
+ * Load a Container from its ID.
3454
3744
  */
3455
3745
  loadContainerFromID = (id) => {
3456
3746
  return new Container({
@@ -3479,6 +3769,36 @@ export class Client extends BaseClient {
3479
3769
  ctx: this._ctx,
3480
3770
  });
3481
3771
  };
3772
+ /**
3773
+ * Load a EnvVariable from its ID.
3774
+ */
3775
+ loadEnvVariableFromID = (id) => {
3776
+ return new EnvVariable({
3777
+ queryTree: [
3778
+ ...this._queryTree,
3779
+ {
3780
+ operation: "loadEnvVariableFromID",
3781
+ args: { id },
3782
+ },
3783
+ ],
3784
+ ctx: this._ctx,
3785
+ });
3786
+ };
3787
+ /**
3788
+ * Load a FieldTypeDef from its ID.
3789
+ */
3790
+ loadFieldTypeDefFromID = (id) => {
3791
+ return new FieldTypeDef({
3792
+ queryTree: [
3793
+ ...this._queryTree,
3794
+ {
3795
+ operation: "loadFieldTypeDefFromID",
3796
+ args: { id },
3797
+ },
3798
+ ],
3799
+ ctx: this._ctx,
3800
+ });
3801
+ };
3482
3802
  /**
3483
3803
  * Load a File from its ID.
3484
3804
  */
@@ -3495,7 +3815,7 @@ export class Client extends BaseClient {
3495
3815
  });
3496
3816
  };
3497
3817
  /**
3498
- * Load a function argument by ID.
3818
+ * Load a FunctionArg from its ID.
3499
3819
  */
3500
3820
  loadFunctionArgFromID = (id) => {
3501
3821
  return new FunctionArg({
@@ -3510,7 +3830,37 @@ export class Client extends BaseClient {
3510
3830
  });
3511
3831
  };
3512
3832
  /**
3513
- * Load a function by ID.
3833
+ * Load a FunctionCallArgValue from its ID.
3834
+ */
3835
+ loadFunctionCallArgValueFromID = (id) => {
3836
+ return new FunctionCallArgValue({
3837
+ queryTree: [
3838
+ ...this._queryTree,
3839
+ {
3840
+ operation: "loadFunctionCallArgValueFromID",
3841
+ args: { id },
3842
+ },
3843
+ ],
3844
+ ctx: this._ctx,
3845
+ });
3846
+ };
3847
+ /**
3848
+ * Load a FunctionCall from its ID.
3849
+ */
3850
+ loadFunctionCallFromID = (id) => {
3851
+ return new FunctionCall({
3852
+ queryTree: [
3853
+ ...this._queryTree,
3854
+ {
3855
+ operation: "loadFunctionCallFromID",
3856
+ args: { id },
3857
+ },
3858
+ ],
3859
+ ctx: this._ctx,
3860
+ });
3861
+ };
3862
+ /**
3863
+ * Load a Function from its ID.
3514
3864
  */
3515
3865
  loadFunctionFromID = (id) => {
3516
3866
  return new Function_({
@@ -3525,7 +3875,7 @@ export class Client extends BaseClient {
3525
3875
  });
3526
3876
  };
3527
3877
  /**
3528
- * Load a GeneratedCode by ID.
3878
+ * Load a GeneratedCode from its ID.
3529
3879
  */
3530
3880
  loadGeneratedCodeFromID = (id) => {
3531
3881
  return new GeneratedCode({
@@ -3540,7 +3890,7 @@ export class Client extends BaseClient {
3540
3890
  });
3541
3891
  };
3542
3892
  /**
3543
- * Load a git ref from its ID.
3893
+ * Load a GitRef from its ID.
3544
3894
  */
3545
3895
  loadGitRefFromID = (id) => {
3546
3896
  return new GitRef({
@@ -3555,7 +3905,7 @@ export class Client extends BaseClient {
3555
3905
  });
3556
3906
  };
3557
3907
  /**
3558
- * Load a git repository from its ID.
3908
+ * Load a GitRepository from its ID.
3559
3909
  */
3560
3910
  loadGitRepositoryFromID = (id) => {
3561
3911
  return new GitRepository({
@@ -3570,7 +3920,82 @@ export class Client extends BaseClient {
3570
3920
  });
3571
3921
  };
3572
3922
  /**
3573
- * Load a module by ID.
3923
+ * Load a Host from its ID.
3924
+ */
3925
+ loadHostFromID = (id) => {
3926
+ return new Host({
3927
+ queryTree: [
3928
+ ...this._queryTree,
3929
+ {
3930
+ operation: "loadHostFromID",
3931
+ args: { id },
3932
+ },
3933
+ ],
3934
+ ctx: this._ctx,
3935
+ });
3936
+ };
3937
+ /**
3938
+ * Load a InterfaceTypeDef from its ID.
3939
+ */
3940
+ loadInterfaceTypeDefFromID = (id) => {
3941
+ return new InterfaceTypeDef({
3942
+ queryTree: [
3943
+ ...this._queryTree,
3944
+ {
3945
+ operation: "loadInterfaceTypeDefFromID",
3946
+ args: { id },
3947
+ },
3948
+ ],
3949
+ ctx: this._ctx,
3950
+ });
3951
+ };
3952
+ /**
3953
+ * Load a Label from its ID.
3954
+ */
3955
+ loadLabelFromID = (id) => {
3956
+ return new Label({
3957
+ queryTree: [
3958
+ ...this._queryTree,
3959
+ {
3960
+ operation: "loadLabelFromID",
3961
+ args: { id },
3962
+ },
3963
+ ],
3964
+ ctx: this._ctx,
3965
+ });
3966
+ };
3967
+ /**
3968
+ * Load a ListTypeDef from its ID.
3969
+ */
3970
+ loadListTypeDefFromID = (id) => {
3971
+ return new ListTypeDef({
3972
+ queryTree: [
3973
+ ...this._queryTree,
3974
+ {
3975
+ operation: "loadListTypeDefFromID",
3976
+ args: { id },
3977
+ },
3978
+ ],
3979
+ ctx: this._ctx,
3980
+ });
3981
+ };
3982
+ /**
3983
+ * Load a ModuleConfig from its ID.
3984
+ */
3985
+ loadModuleConfigFromID = (id) => {
3986
+ return new ModuleConfig({
3987
+ queryTree: [
3988
+ ...this._queryTree,
3989
+ {
3990
+ operation: "loadModuleConfigFromID",
3991
+ args: { id },
3992
+ },
3993
+ ],
3994
+ ctx: this._ctx,
3995
+ });
3996
+ };
3997
+ /**
3998
+ * Load a Module from its ID.
3574
3999
  */
3575
4000
  loadModuleFromID = (id) => {
3576
4001
  return new Module_({
@@ -3584,6 +4009,36 @@ export class Client extends BaseClient {
3584
4009
  ctx: this._ctx,
3585
4010
  });
3586
4011
  };
4012
+ /**
4013
+ * Load a ObjectTypeDef from its ID.
4014
+ */
4015
+ loadObjectTypeDefFromID = (id) => {
4016
+ return new ObjectTypeDef({
4017
+ queryTree: [
4018
+ ...this._queryTree,
4019
+ {
4020
+ operation: "loadObjectTypeDefFromID",
4021
+ args: { id },
4022
+ },
4023
+ ],
4024
+ ctx: this._ctx,
4025
+ });
4026
+ };
4027
+ /**
4028
+ * Load a Port from its ID.
4029
+ */
4030
+ loadPortFromID = (id) => {
4031
+ return new Port({
4032
+ queryTree: [
4033
+ ...this._queryTree,
4034
+ {
4035
+ operation: "loadPortFromID",
4036
+ args: { id },
4037
+ },
4038
+ ],
4039
+ ctx: this._ctx,
4040
+ });
4041
+ };
3587
4042
  /**
3588
4043
  * Load a Secret from its ID.
3589
4044
  */
@@ -3600,7 +4055,7 @@ export class Client extends BaseClient {
3600
4055
  });
3601
4056
  };
3602
4057
  /**
3603
- * Loads a service from ID.
4058
+ * Load a Service from its ID.
3604
4059
  */
3605
4060
  loadServiceFromID = (id) => {
3606
4061
  return new Service({
@@ -3630,7 +4085,7 @@ export class Client extends BaseClient {
3630
4085
  });
3631
4086
  };
3632
4087
  /**
3633
- * Load a TypeDef by ID.
4088
+ * Load a TypeDef from its ID.
3634
4089
  */
3635
4090
  loadTypeDefFromID = (id) => {
3636
4091
  return new TypeDef({
@@ -3675,9 +4130,9 @@ export class Client extends BaseClient {
3675
4130
  };
3676
4131
  /**
3677
4132
  * Creates a named sub-pipeline.
3678
- * @param name Pipeline name.
3679
- * @param opts.description Pipeline description.
3680
- * @param opts.labels Pipeline labels.
4133
+ * @param name Name of the sub-pipeline.
4134
+ * @param opts.description Description of the sub-pipeline.
4135
+ * @param opts.labels Labels to apply to the sub-pipeline.
3681
4136
  */
3682
4137
  pipeline = (name, opts) => {
3683
4138
  return new Client({
@@ -3692,16 +4147,15 @@ export class Client extends BaseClient {
3692
4147
  });
3693
4148
  };
3694
4149
  /**
3695
- * Loads a secret from its ID.
3696
- * @deprecated Use loadSecretFromID instead
4150
+ * Reference a secret by name.
3697
4151
  */
3698
- secret = (id) => {
4152
+ secret = (name) => {
3699
4153
  return new Secret({
3700
4154
  queryTree: [
3701
4155
  ...this._queryTree,
3702
4156
  {
3703
4157
  operation: "secret",
3704
- args: { id },
4158
+ args: { name },
3705
4159
  },
3706
4160
  ],
3707
4161
  ctx: this._ctx,
@@ -3709,6 +4163,7 @@ export class Client extends BaseClient {
3709
4163
  };
3710
4164
  /**
3711
4165
  * Sets a secret given a user defined name to its plaintext and returns the secret.
4166
+ *
3712
4167
  * The plaintext value is limited to a size of 128000 bytes.
3713
4168
  * @param name The user defined name for this secret
3714
4169
  * @param plaintext The plaintext of the secret
@@ -3729,13 +4184,13 @@ export class Client extends BaseClient {
3729
4184
  * Loads a socket by its ID.
3730
4185
  * @deprecated Use loadSocketFromID instead.
3731
4186
  */
3732
- socket = (opts) => {
4187
+ socket = (id) => {
3733
4188
  return new Socket({
3734
4189
  queryTree: [
3735
4190
  ...this._queryTree,
3736
4191
  {
3737
4192
  operation: "socket",
3738
- args: { ...opts },
4193
+ args: { id },
3739
4194
  },
3740
4195
  ],
3741
4196
  ctx: this._ctx,
@@ -3779,7 +4234,7 @@ export class Secret extends BaseClient {
3779
4234
  this._plaintext = _plaintext;
3780
4235
  }
3781
4236
  /**
3782
- * The identifier for this secret.
4237
+ * A unique identifier for this Secret.
3783
4238
  */
3784
4239
  id = async () => {
3785
4240
  if (this._id) {
@@ -3809,6 +4264,9 @@ export class Secret extends BaseClient {
3809
4264
  return response;
3810
4265
  };
3811
4266
  }
4267
+ /**
4268
+ * A content-addressed service providing TCP connectivity.
4269
+ */
3812
4270
  export class Service extends BaseClient {
3813
4271
  _id = undefined;
3814
4272
  _endpoint = undefined;
@@ -3827,7 +4285,7 @@ export class Service extends BaseClient {
3827
4285
  this._stop = _stop;
3828
4286
  }
3829
4287
  /**
3830
- * A unique identifier for this service.
4288
+ * A unique identifier for this Service.
3831
4289
  */
3832
4290
  id = async () => {
3833
4291
  if (this._id) {
@@ -3888,13 +4346,18 @@ export class Service extends BaseClient {
3888
4346
  operation: "ports",
3889
4347
  },
3890
4348
  {
3891
- operation: "description port protocol",
4349
+ operation: "id",
3892
4350
  },
3893
4351
  ], await this._ctx.connection());
3894
4352
  return response.map((r) => new Port({
3895
- queryTree: this.queryTree,
4353
+ queryTree: [
4354
+ {
4355
+ operation: "loadPortFromID",
4356
+ args: { id: r.id },
4357
+ },
4358
+ ],
3896
4359
  ctx: this._ctx,
3897
- }, r.description, r.port, r.protocol));
4360
+ }, r.id));
3898
4361
  };
3899
4362
  /**
3900
4363
  * Start the service and wait for its health checks to succeed.
@@ -3923,6 +4386,9 @@ export class Service extends BaseClient {
3923
4386
  return this;
3924
4387
  };
3925
4388
  }
4389
+ /**
4390
+ * A Unix or TCP/IP socket that can be mounted into a container.
4391
+ */
3926
4392
  export class Socket extends BaseClient {
3927
4393
  _id = undefined;
3928
4394
  /**
@@ -3933,7 +4399,7 @@ export class Socket extends BaseClient {
3933
4399
  this._id = _id;
3934
4400
  }
3935
4401
  /**
3936
- * The content-addressed identifier of the socket.
4402
+ * A unique identifier for this Socket.
3937
4403
  */
3938
4404
  id = async () => {
3939
4405
  if (this._id) {
@@ -3964,6 +4430,9 @@ export class TypeDef extends BaseClient {
3964
4430
  this._kind = _kind;
3965
4431
  this._optional = _optional;
3966
4432
  }
4433
+ /**
4434
+ * A unique identifier for this TypeDef.
4435
+ */
3967
4436
  id = async () => {
3968
4437
  if (this._id) {
3969
4438
  return this._id;
@@ -3976,10 +4445,17 @@ export class TypeDef extends BaseClient {
3976
4445
  ], await this._ctx.connection());
3977
4446
  return response;
3978
4447
  };
3979
- /**
3980
- * If kind is LIST, the list-specific type definition.
3981
- * If kind is not LIST, this will be null.
3982
- */
4448
+ asInterface = () => {
4449
+ return new InterfaceTypeDef({
4450
+ queryTree: [
4451
+ ...this._queryTree,
4452
+ {
4453
+ operation: "asInterface",
4454
+ },
4455
+ ],
4456
+ ctx: this._ctx,
4457
+ });
4458
+ };
3983
4459
  asList = () => {
3984
4460
  return new ListTypeDef({
3985
4461
  queryTree: [
@@ -3991,10 +4467,6 @@ export class TypeDef extends BaseClient {
3991
4467
  ctx: this._ctx,
3992
4468
  });
3993
4469
  };
3994
- /**
3995
- * If kind is OBJECT, the object-specific type definition.
3996
- * If kind is not OBJECT, this will be null.
3997
- */
3998
4470
  asObject = () => {
3999
4471
  return new ObjectTypeDef({
4000
4472
  queryTree: [
@@ -4006,9 +4478,6 @@ export class TypeDef extends BaseClient {
4006
4478
  ctx: this._ctx,
4007
4479
  });
4008
4480
  };
4009
- /**
4010
- * The kind of type this is (e.g. primitive, list, object)
4011
- */
4012
4481
  kind = async () => {
4013
4482
  if (this._kind) {
4014
4483
  return this._kind;
@@ -4021,9 +4490,6 @@ export class TypeDef extends BaseClient {
4021
4490
  ], await this._ctx.connection());
4022
4491
  return response;
4023
4492
  };
4024
- /**
4025
- * Whether this type can be set to null. Defaults to false.
4026
- */
4027
4493
  optional = async () => {
4028
4494
  if (this._optional) {
4029
4495
  return this._optional;
@@ -4072,7 +4538,7 @@ export class TypeDef extends BaseClient {
4072
4538
  });
4073
4539
  };
4074
4540
  /**
4075
- * Adds a function for an Object TypeDef, failing if the type is not an object.
4541
+ * Adds a function for an Object or Interface TypeDef, failing if the type is not one of those kinds.
4076
4542
  */
4077
4543
  withFunction = (function_) => {
4078
4544
  return new TypeDef({
@@ -4088,6 +4554,21 @@ export class TypeDef extends BaseClient {
4088
4554
  ctx: this._ctx,
4089
4555
  });
4090
4556
  };
4557
+ /**
4558
+ * Returns a TypeDef of kind Interface with the provided name.
4559
+ */
4560
+ withInterface = (name, opts) => {
4561
+ return new TypeDef({
4562
+ queryTree: [
4563
+ ...this._queryTree,
4564
+ {
4565
+ operation: "withInterface",
4566
+ args: { name, ...opts },
4567
+ },
4568
+ ],
4569
+ ctx: this._ctx,
4570
+ });
4571
+ };
4091
4572
  /**
4092
4573
  * Sets the kind of the type.
4093
4574
  */
@@ -4124,9 +4605,7 @@ export class TypeDef extends BaseClient {
4124
4605
  /**
4125
4606
  * Returns a TypeDef of kind Object with the provided name.
4126
4607
  *
4127
- * Note that an object's fields and functions may be omitted if the intent is
4128
- * only to refer to an object. This is how functions are able to return their
4129
- * own object, or any other circular reference.
4608
+ * Note that an object's fields and functions may be omitted if the intent is only to refer to an object. This is how functions are able to return their own object, or any other circular reference.
4130
4609
  */
4131
4610
  withObject = (name, opts) => {
4132
4611
  return new TypeDef({