@dagger.io/dagger 0.9.6 → 0.9.8

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.
@@ -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
  /**
@@ -58,18 +57,20 @@ export var ImageMediaTypes;
58
57
  ImageMediaTypes["Dockermediatypes"] = "DockerMediaTypes";
59
58
  ImageMediaTypes["Ocimediatypes"] = "OCIMediaTypes";
60
59
  })(ImageMediaTypes || (ImageMediaTypes = {}));
60
+ /**
61
+ * The kind of module source.
62
+ */
63
+ export var ModuleSourceKind;
64
+ (function (ModuleSourceKind) {
65
+ ModuleSourceKind["GitSource"] = "GIT_SOURCE";
66
+ ModuleSourceKind["LocalSource"] = "LOCAL_SOURCE";
67
+ })(ModuleSourceKind || (ModuleSourceKind = {}));
61
68
  /**
62
69
  * Transport layer network protocol associated to a port.
63
70
  */
64
71
  export var NetworkProtocol;
65
72
  (function (NetworkProtocol) {
66
- /**
67
- * TCP (Transmission Control Protocol)
68
- */
69
73
  NetworkProtocol["Tcp"] = "TCP";
70
- /**
71
- * UDP (User Datagram Protocol)
72
- */
73
74
  NetworkProtocol["Udp"] = "UDP";
74
75
  })(NetworkProtocol || (NetworkProtocol = {}));
75
76
  /**
@@ -78,43 +79,45 @@ export var NetworkProtocol;
78
79
  export var TypeDefKind;
79
80
  (function (TypeDefKind) {
80
81
  /**
81
- * A boolean value
82
+ * A boolean value.
83
+ */
84
+ TypeDefKind["BooleanKind"] = "BOOLEAN_KIND";
85
+ /**
86
+ * A graphql input type, used only when representing the core API via TypeDefs.
82
87
  */
83
- TypeDefKind["Booleankind"] = "BooleanKind";
88
+ TypeDefKind["InputKind"] = "INPUT_KIND";
84
89
  /**
85
- * An integer value
90
+ * An integer value.
86
91
  */
87
- TypeDefKind["Integerkind"] = "IntegerKind";
92
+ TypeDefKind["IntegerKind"] = "INTEGER_KIND";
88
93
  /**
89
94
  * A named type of functions that can be matched+implemented by other objects+interfaces.
90
95
  *
91
96
  * Always paired with an InterfaceTypeDef.
92
97
  */
93
- TypeDefKind["Interfacekind"] = "InterfaceKind";
98
+ TypeDefKind["InterfaceKind"] = "INTERFACE_KIND";
94
99
  /**
95
100
  * A list of values all having the same type.
96
101
  *
97
102
  * Always paired with a ListTypeDef.
98
103
  */
99
- TypeDefKind["Listkind"] = "ListKind";
104
+ TypeDefKind["ListKind"] = "LIST_KIND";
100
105
  /**
101
106
  * A named type defined in the GraphQL schema, with fields and functions.
102
107
  *
103
108
  * Always paired with an ObjectTypeDef.
104
109
  */
105
- TypeDefKind["Objectkind"] = "ObjectKind";
110
+ TypeDefKind["ObjectKind"] = "OBJECT_KIND";
106
111
  /**
107
- * A string value
112
+ * A string value.
108
113
  */
109
- TypeDefKind["Stringkind"] = "StringKind";
114
+ TypeDefKind["StringKind"] = "STRING_KIND";
110
115
  /**
111
116
  * A special kind used to signify that no value is returned.
112
117
  *
113
- * This is used for functions that have no return value. The outer TypeDef
114
- * specifying this Kind is always Optional, as the Void is never actually
115
- * represented.
118
+ * 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.
116
119
  */
117
- TypeDefKind["Voidkind"] = "VoidKind";
120
+ TypeDefKind["VoidKind"] = "VOID_KIND";
118
121
  })(TypeDefKind || (TypeDefKind = {}));
119
122
  /**
120
123
  * A directory whose contents persist across runs.
@@ -128,6 +131,9 @@ export class CacheVolume extends BaseClient {
128
131
  super(parent);
129
132
  this._id = _id;
130
133
  }
134
+ /**
135
+ * A unique identifier for this CacheVolume.
136
+ */
131
137
  id = async () => {
132
138
  if (this._id) {
133
139
  return this._id;
@@ -142,7 +148,7 @@ export class CacheVolume extends BaseClient {
142
148
  };
143
149
  }
144
150
  /**
145
- * An OCI-compatible container, also known as a docker container.
151
+ * An OCI-compatible container, also known as a Docker container.
146
152
  */
147
153
  export class Container extends BaseClient {
148
154
  _id = undefined;
@@ -152,7 +158,6 @@ export class Container extends BaseClient {
152
158
  _label = undefined;
153
159
  _platform = undefined;
154
160
  _publish = undefined;
155
- _shellEndpoint = undefined;
156
161
  _stderr = undefined;
157
162
  _stdout = undefined;
158
163
  _sync = undefined;
@@ -161,7 +166,7 @@ export class Container extends BaseClient {
161
166
  /**
162
167
  * Constructor is used for internal usage only, do not create object from it.
163
168
  */
164
- constructor(parent, _id, _envVariable, _export, _imageRef, _label, _platform, _publish, _shellEndpoint, _stderr, _stdout, _sync, _user, _workdir) {
169
+ constructor(parent, _id, _envVariable, _export, _imageRef, _label, _platform, _publish, _stderr, _stdout, _sync, _user, _workdir) {
165
170
  super(parent);
166
171
  this._id = _id;
167
172
  this._envVariable = _envVariable;
@@ -170,7 +175,6 @@ export class Container extends BaseClient {
170
175
  this._label = _label;
171
176
  this._platform = _platform;
172
177
  this._publish = _publish;
173
- this._shellEndpoint = _shellEndpoint;
174
178
  this._stderr = _stderr;
175
179
  this._stdout = _stdout;
176
180
  this._sync = _sync;
@@ -178,7 +182,7 @@ export class Container extends BaseClient {
178
182
  this._workdir = _workdir;
179
183
  }
180
184
  /**
181
- * A unique identifier for this container.
185
+ * A unique identifier for this Container.
182
186
  */
183
187
  id = async () => {
184
188
  if (this._id) {
@@ -211,15 +215,14 @@ export class Container extends BaseClient {
211
215
  /**
212
216
  * Returns a File representing the container serialized to a tarball.
213
217
  * @param opts.platformVariants Identifiers for other platform specific containers.
214
- * Used for multi-platform image.
218
+ *
219
+ * Used for multi-platform images.
215
220
  * @param opts.forcedCompression Force each layer of the image to use the specified compression algorithm.
216
- * If this is unset, then if a layer already has a compressed blob in the engine's
217
- * cache, that will be used (this can result in a mix of compression algorithms for
218
- * different layers). If this is unset and a layer has no compressed blob in the
219
- * engine's cache, then it will be compressed using Gzip.
220
- * @param opts.mediaTypes Use the specified media types for the image's layers. Defaults to OCI, which
221
- * is largely compatible with most recent container runtimes, but Docker may be needed
222
- * for older runtimes without OCI support.
221
+ *
222
+ * 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.
223
+ * @param opts.mediaTypes Use the specified media types for the image's layers.
224
+ *
225
+ * Defaults to OCI, which is largely compatible with most recent container runtimes, but Docker may be needed for older runtimes without OCI support.
223
226
  */
224
227
  asTarball = (opts) => {
225
228
  const metadata = {
@@ -241,17 +244,13 @@ export class Container extends BaseClient {
241
244
  * Initializes this container from a Dockerfile build.
242
245
  * @param context Directory context used by the Dockerfile.
243
246
  * @param opts.dockerfile Path to the Dockerfile to use.
244
- *
245
- * Default: './Dockerfile'.
246
- * @param opts.buildArgs Additional build arguments.
247
247
  * @param opts.target Target build stage to build.
248
+ * @param opts.buildArgs Additional build arguments.
248
249
  * @param opts.secrets Secrets to pass to the build.
249
250
  *
250
251
  * They will be mounted at /run/secrets/[secret-name] in the build container
251
252
  *
252
- * They can be accessed in the Dockerfile using the "secret" mount type
253
- * and mount path /run/secrets/[secret-name]
254
- * e.g. RUN --mount=type=secret,id=my-secret curl url?token=$(cat /run/secrets/my-secret)"
253
+ * 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)
255
254
  */
256
255
  build = (context, opts) => {
257
256
  return new Container({
@@ -334,18 +333,24 @@ export class Container extends BaseClient {
334
333
  operation: "envVariables",
335
334
  },
336
335
  {
337
- operation: "name value",
336
+ operation: "id",
338
337
  },
339
338
  ], await this._ctx.connection());
340
339
  return response.map((r) => new EnvVariable({
341
- queryTree: this.queryTree,
340
+ queryTree: [
341
+ {
342
+ operation: "loadEnvVariableFromID",
343
+ args: { id: r.id },
344
+ },
345
+ ],
342
346
  ctx: this._ctx,
343
- }, r.name, r.value));
347
+ }, r.id));
344
348
  };
345
349
  /**
346
350
  * EXPERIMENTAL API! Subject to change/removal at any time.
347
351
  *
348
- * experimentalWithAllGPUs configures all available GPUs on the host to be accessible to this container.
352
+ * Configures all available GPUs on the host to be accessible to this container.
353
+ *
349
354
  * This currently works for Nvidia devices only.
350
355
  */
351
356
  experimentalWithAllGPUs = () => {
@@ -362,8 +367,10 @@ export class Container extends BaseClient {
362
367
  /**
363
368
  * EXPERIMENTAL API! Subject to change/removal at any time.
364
369
  *
365
- * experimentalWithGPU configures the provided list of devices to be accesible to this container.
370
+ * Configures the provided list of devices to be accesible to this container.
371
+ *
366
372
  * This currently works for Nvidia devices only.
373
+ * @param devices List of devices to be accessible to this container.
367
374
  */
368
375
  experimentalWithGPU = (devices) => {
369
376
  return new Container({
@@ -378,22 +385,23 @@ export class Container extends BaseClient {
378
385
  });
379
386
  };
380
387
  /**
381
- * Writes the container as an OCI tarball to the destination file path on the host for the specified platform variants.
388
+ * Writes the container as an OCI tarball to the destination file path on the host.
382
389
  *
383
390
  * Return true on success.
384
- * It can also publishes platform variants.
391
+ *
392
+ * It can also export platform variants.
385
393
  * @param path Host's destination path (e.g., "./tarball").
394
+ *
386
395
  * Path can be relative to the engine's workdir or absolute.
387
396
  * @param opts.platformVariants Identifiers for other platform specific containers.
397
+ *
388
398
  * Used for multi-platform image.
389
399
  * @param opts.forcedCompression Force each layer of the exported image to use the specified compression algorithm.
390
- * If this is unset, then if a layer already has a compressed blob in the engine's
391
- * cache, that will be used (this can result in a mix of compression algorithms for
392
- * different layers). If this is unset and a layer has no compressed blob in the
393
- * engine's cache, then it will be compressed using Gzip.
394
- * @param opts.mediaTypes Use the specified media types for the exported image's layers. Defaults to OCI, which
395
- * is largely compatible with most recent container runtimes, but Docker may be needed
396
- * for older runtimes without OCI support.
400
+ *
401
+ * 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.
402
+ * @param opts.mediaTypes Use the specified media types for the exported image's layers.
403
+ *
404
+ * Defaults to OCI, which is largely compatible with most recent container runtimes, but Docker may be needed for older runtimes without OCI support.
397
405
  */
398
406
  export = async (path, opts) => {
399
407
  if (this._export) {
@@ -415,8 +423,7 @@ export class Container extends BaseClient {
415
423
  /**
416
424
  * Retrieves the list of exposed ports.
417
425
  *
418
- * This includes ports already exposed by the image, even if not
419
- * explicitly added with dagger.
426
+ * This includes ports already exposed by the image, even if not explicitly added with dagger.
420
427
  */
421
428
  exposedPorts = async () => {
422
429
  const response = await computeQuery([
@@ -425,13 +432,18 @@ export class Container extends BaseClient {
425
432
  operation: "exposedPorts",
426
433
  },
427
434
  {
428
- operation: "description port protocol",
435
+ operation: "id",
429
436
  },
430
437
  ], await this._ctx.connection());
431
438
  return response.map((r) => new Port({
432
- queryTree: this.queryTree,
439
+ queryTree: [
440
+ {
441
+ operation: "loadPortFromID",
442
+ args: { id: r.id },
443
+ },
444
+ ],
433
445
  ctx: this._ctx,
434
- }, r.description, r.port, r.protocol));
446
+ }, r.id));
435
447
  };
436
448
  /**
437
449
  * Retrieves a file at the given path.
@@ -486,12 +498,8 @@ export class Container extends BaseClient {
486
498
  };
487
499
  /**
488
500
  * Reads the container from an OCI tarball.
489
- *
490
- * NOTE: this involves unpacking the tarball to an OCI store on the host at
491
- * $XDG_CACHE_DIR/dagger/oci. This directory can be removed whenever you like.
492
501
  * @param source File to read the container from.
493
- * @param opts.tag Identifies the tag to import from the archive, if the archive bundles
494
- * multiple tags.
502
+ * @param opts.tag Identifies the tag to import from the archive, if the archive bundles multiple tags.
495
503
  */
496
504
  import_ = (source, opts) => {
497
505
  return new Container({
@@ -507,6 +515,7 @@ export class Container extends BaseClient {
507
515
  };
508
516
  /**
509
517
  * Retrieves the value of the specified label.
518
+ * @param name The name of the label (e.g., "org.opencontainers.artifact.created").
510
519
  */
511
520
  label = async (name) => {
512
521
  if (this._label) {
@@ -531,13 +540,18 @@ export class Container extends BaseClient {
531
540
  operation: "labels",
532
541
  },
533
542
  {
534
- operation: "name value",
543
+ operation: "id",
535
544
  },
536
545
  ], await this._ctx.connection());
537
546
  return response.map((r) => new Label({
538
- queryTree: this.queryTree,
547
+ queryTree: [
548
+ {
549
+ operation: "loadLabelFromID",
550
+ args: { id: r.id },
551
+ },
552
+ ],
539
553
  ctx: this._ctx,
540
- }, r.name, r.value));
554
+ }, r.id));
541
555
  };
542
556
  /**
543
557
  * Retrieves the list of paths where a directory is mounted.
@@ -552,10 +566,10 @@ export class Container extends BaseClient {
552
566
  return response;
553
567
  };
554
568
  /**
555
- * Creates a named sub-pipeline
556
- * @param name Pipeline name.
557
- * @param opts.description Pipeline description.
558
- * @param opts.labels Pipeline labels.
569
+ * Creates a named sub-pipeline.
570
+ * @param name Name of the sub-pipeline.
571
+ * @param opts.description Description of the sub-pipeline.
572
+ * @param opts.labels Labels to apply to the sub-pipeline.
559
573
  */
560
574
  pipeline = (name, opts) => {
561
575
  return new Container({
@@ -588,20 +602,20 @@ export class Container extends BaseClient {
588
602
  * Publishes this container as a new image to the specified address.
589
603
  *
590
604
  * Publish returns a fully qualified ref.
605
+ *
591
606
  * It can also publish platform variants.
592
607
  * @param address Registry's address to publish the image to.
593
608
  *
594
609
  * Formatted as [host]/[user]/[repo]:[tag] (e.g. "docker.io/dagger/dagger:main").
595
610
  * @param opts.platformVariants Identifiers for other platform specific containers.
611
+ *
596
612
  * Used for multi-platform image.
597
613
  * @param opts.forcedCompression Force each layer of the published image to use the specified compression algorithm.
598
- * If this is unset, then if a layer already has a compressed blob in the engine's
599
- * cache, that will be used (this can result in a mix of compression algorithms for
600
- * different layers). If this is unset and a layer has no compressed blob in the
601
- * engine's cache, then it will be compressed using Gzip.
602
- * @param opts.mediaTypes Use the specified media types for the published image's layers. Defaults to OCI, which
603
- * is largely compatible with most recent registries, but Docker may be needed for older
604
- * registries without OCI support.
614
+ *
615
+ * 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.
616
+ * @param opts.mediaTypes Use the specified media types for the published image's layers.
617
+ *
618
+ * Defaults to OCI, which is largely compatible with most recent registries, but Docker may be needed for older registries without OCI support.
605
619
  */
606
620
  publish = async (address, opts) => {
607
621
  if (this._publish) {
@@ -635,22 +649,20 @@ export class Container extends BaseClient {
635
649
  });
636
650
  };
637
651
  /**
638
- * Return a websocket endpoint that, if connected to, will start the container with a TTY streamed
639
- * over the websocket.
640
- *
641
- * Primarily intended for internal use with the dagger CLI.
652
+ * Return an interactive terminal for this container using its configured shell if not overridden by args (or sh as a fallback default).
653
+ * @param opts.args If set, override the container's default shell and invoke these arguments instead.
642
654
  */
643
- shellEndpoint = async () => {
644
- if (this._shellEndpoint) {
645
- return this._shellEndpoint;
646
- }
647
- const response = await computeQuery([
648
- ...this._queryTree,
649
- {
650
- operation: "shellEndpoint",
651
- },
652
- ], await this._ctx.connection());
653
- return response;
655
+ shell = (opts) => {
656
+ return new Terminal({
657
+ queryTree: [
658
+ ...this._queryTree,
659
+ {
660
+ operation: "shell",
661
+ args: { ...opts },
662
+ },
663
+ ],
664
+ ctx: this._ctx,
665
+ });
654
666
  };
655
667
  /**
656
668
  * The error stream of the last executed command.
@@ -731,12 +743,28 @@ export class Container extends BaseClient {
731
743
  ctx: this._ctx,
732
744
  });
733
745
  };
746
+ /**
747
+ * Set the default command to invoke for the "shell" API.
748
+ * @param args The args of the command to set the default shell to.
749
+ */
750
+ withDefaultShell = (args) => {
751
+ return new Container({
752
+ queryTree: [
753
+ ...this._queryTree,
754
+ {
755
+ operation: "withDefaultShell",
756
+ args: { args },
757
+ },
758
+ ],
759
+ ctx: this._ctx,
760
+ });
761
+ };
734
762
  /**
735
763
  * Retrieves this container plus a directory written at the given path.
736
764
  * @param path Location of the written directory (e.g., "/tmp/directory").
737
765
  * @param directory Identifier of the directory to write
738
- * @param opts.exclude Patterns to exclude in the written directory (e.g., ["node_modules/**", ".gitignore", ".git/"]).
739
- * @param opts.include Patterns to include in the written directory (e.g., ["*.go", "go.mod", "go.sum"]).
766
+ * @param opts.exclude Patterns to exclude in the written directory (e.g. ["node_modules/**", ".gitignore", ".git/"]).
767
+ * @param opts.include Patterns to include in the written directory (e.g. ["*.go", "go.mod", "go.sum"]).
740
768
  * @param opts.owner A user:group to set for the directory and its contents.
741
769
  *
742
770
  * The user and group can either be an ID (1000:1000) or a name (foo:bar).
@@ -776,8 +804,7 @@ export class Container extends BaseClient {
776
804
  * Retrieves this container plus the given environment variable.
777
805
  * @param name The name of the environment variable (e.g., "HOST").
778
806
  * @param value The value of the environment variable. (e.g., "localhost").
779
- * @param opts.expand Replace `${VAR}` or $VAR in the value according to the current environment
780
- * variables defined in the container (e.g., "/opt/bin:$PATH").
807
+ * @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").
781
808
  */
782
809
  withEnvVariable = (name, value, opts) => {
783
810
  return new Container({
@@ -802,12 +829,8 @@ export class Container extends BaseClient {
802
829
  * @param opts.redirectStderr Redirect the command's standard error to a file in the container (e.g., "/tmp/stderr").
803
830
  * @param opts.experimentalPrivilegedNesting Provides dagger access to the executed command.
804
831
  *
805
- * Do not use this option unless you trust the command being executed.
806
- * The command being executed WILL BE GRANTED FULL ACCESS TO YOUR HOST FILESYSTEM.
807
- * @param opts.insecureRootCapabilities Execute the command with all root capabilities. This is similar to running a command
808
- * with "sudo" or executing `docker run` with the `--privileged` flag. Containerization
809
- * does not provide any security guarantees when using this option. It should only be used
810
- * when absolutely necessary and only with trusted commands.
832
+ * 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.
833
+ * @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.
811
834
  */
812
835
  withExec = (args, opts) => {
813
836
  return new Container({
@@ -827,10 +850,12 @@ export class Container extends BaseClient {
827
850
  * Exposed ports serve two purposes:
828
851
  *
829
852
  * - For health checks and introspection, when running services
853
+ *
830
854
  * - For setting the EXPOSE OCI field when publishing the container
831
855
  * @param port Port number to expose
832
856
  * @param opts.protocol Transport layer network protocol
833
857
  * @param opts.description Optional port description
858
+ * @param opts.experimentalSkipHealthcheck Skip the health check when run as a service.
834
859
  */
835
860
  withExposedPort = (port, opts) => {
836
861
  const metadata = {
@@ -852,8 +877,6 @@ export class Container extends BaseClient {
852
877
  * @param path Location of the copied file (e.g., "/tmp/file.txt").
853
878
  * @param source Identifier of the file to copy.
854
879
  * @param opts.permissions Permission given to the copied file (e.g., 0600).
855
- *
856
- * Default: 0644.
857
880
  * @param opts.owner A user:group to set for the file.
858
881
  *
859
882
  * The user and group can either be an ID (1000:1000) or a name (foo:bar).
@@ -873,8 +896,7 @@ export class Container extends BaseClient {
873
896
  });
874
897
  };
875
898
  /**
876
- * Indicate that subsequent operations should be featured more prominently in
877
- * the UI.
899
+ * Indicate that subsequent operations should be featured more prominently in the UI.
878
900
  */
879
901
  withFocus = () => {
880
902
  return new Container({
@@ -912,9 +934,7 @@ export class Container extends BaseClient {
912
934
  * @param opts.sharing Sharing mode of the cache volume.
913
935
  * @param opts.owner A user:group to set for the mounted cache directory.
914
936
  *
915
- * Note that this changes the ownership of the specified mount along with the
916
- * initial filesystem provided by source (if any). It does not have any effect
917
- * if/when the cache has already been created.
937
+ * 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.
918
938
  *
919
939
  * The user and group can either be an ID (1000:1000) or a name (foo:bar).
920
940
  *
@@ -989,9 +1009,8 @@ export class Container extends BaseClient {
989
1009
  *
990
1010
  * If the group is omitted, it defaults to the same as the user.
991
1011
  * @param opts.mode Permission given to the mounted secret (e.g., 0600).
992
- * This option requires an owner to be set to be active.
993
1012
  *
994
- * Default: 0400.
1013
+ * This option requires an owner to be set to be active.
995
1014
  */
996
1015
  withMountedSecret = (path, source, opts) => {
997
1016
  return new Container({
@@ -1026,8 +1045,6 @@ export class Container extends BaseClient {
1026
1045
  * @param path Location of the written file (e.g., "/tmp/file.txt").
1027
1046
  * @param opts.contents Content of the file to write (e.g., "Hello world!").
1028
1047
  * @param opts.permissions Permission given to the written file (e.g., 0600).
1029
- *
1030
- * Default: 0644.
1031
1048
  * @param opts.owner A user:group to set for the file.
1032
1049
  *
1033
1050
  * The user and group can either be an ID (1000:1000) or a name (foo:bar).
@@ -1049,6 +1066,7 @@ export class Container extends BaseClient {
1049
1066
  /**
1050
1067
  * Retrieves this container with a registry authentication for a given address.
1051
1068
  * @param address Registry's address to bind the authentication to.
1069
+ *
1052
1070
  * Formatted as [host]/[user]/[repo]:[tag] (e.g. docker.io/dagger/dagger:main).
1053
1071
  * @param username The username of the registry's account (e.g., "Dagger").
1054
1072
  * @param secret The API key, password or token to authenticate to this registry.
@@ -1066,7 +1084,8 @@ export class Container extends BaseClient {
1066
1084
  });
1067
1085
  };
1068
1086
  /**
1069
- * Initializes this container from this DirectoryID.
1087
+ * Retrieves the container with the given directory mounted to /.
1088
+ * @param directory Directory to mount.
1070
1089
  */
1071
1090
  withRootfs = (directory) => {
1072
1091
  return new Container({
@@ -1100,8 +1119,7 @@ export class Container extends BaseClient {
1100
1119
  /**
1101
1120
  * Establish a runtime dependency on a service.
1102
1121
  *
1103
- * The service will be started automatically when needed and detached when it is
1104
- * no longer needed, executing the default command if none is set.
1122
+ * The service will be started automatically when needed and detached when it is no longer needed, executing the default command if none is set.
1105
1123
  *
1106
1124
  * The service will be reachable from the container via the provided hostname alias.
1107
1125
  *
@@ -1242,8 +1260,7 @@ export class Container extends BaseClient {
1242
1260
  });
1243
1261
  };
1244
1262
  /**
1245
- * Indicate that subsequent operations should not be featured more prominently
1246
- * in the UI.
1263
+ * Indicate that subsequent operations should not be featured more prominently in the UI.
1247
1264
  *
1248
1265
  * This is the initial state of all containers.
1249
1266
  */
@@ -1293,6 +1310,7 @@ export class Container extends BaseClient {
1293
1310
  /**
1294
1311
  * Retrieves this container without the registry authentication of a given address.
1295
1312
  * @param address Registry's address to remove the authentication from.
1313
+ *
1296
1314
  * Formatted as [host]/[user]/[repo]:[tag] (e.g. docker.io/dagger/dagger:main).
1297
1315
  */
1298
1316
  withoutRegistryAuth = (address) => {
@@ -1379,6 +1397,99 @@ export class Container extends BaseClient {
1379
1397
  return arg(this);
1380
1398
  };
1381
1399
  }
1400
+ /**
1401
+ * Reflective module API provided to functions at runtime.
1402
+ */
1403
+ export class CurrentModule extends BaseClient {
1404
+ _id = undefined;
1405
+ _name = undefined;
1406
+ /**
1407
+ * Constructor is used for internal usage only, do not create object from it.
1408
+ */
1409
+ constructor(parent, _id, _name) {
1410
+ super(parent);
1411
+ this._id = _id;
1412
+ this._name = _name;
1413
+ }
1414
+ /**
1415
+ * A unique identifier for this CurrentModule.
1416
+ */
1417
+ id = async () => {
1418
+ if (this._id) {
1419
+ return this._id;
1420
+ }
1421
+ const response = await computeQuery([
1422
+ ...this._queryTree,
1423
+ {
1424
+ operation: "id",
1425
+ },
1426
+ ], await this._ctx.connection());
1427
+ return response;
1428
+ };
1429
+ /**
1430
+ * The name of the module being executed in
1431
+ */
1432
+ name = async () => {
1433
+ if (this._name) {
1434
+ return this._name;
1435
+ }
1436
+ const response = await computeQuery([
1437
+ ...this._queryTree,
1438
+ {
1439
+ operation: "name",
1440
+ },
1441
+ ], await this._ctx.connection());
1442
+ return response;
1443
+ };
1444
+ /**
1445
+ * The directory containing the module's source code loaded into the engine (plus any generated code that may have been created).
1446
+ */
1447
+ source = () => {
1448
+ return new Directory({
1449
+ queryTree: [
1450
+ ...this._queryTree,
1451
+ {
1452
+ operation: "source",
1453
+ },
1454
+ ],
1455
+ ctx: this._ctx,
1456
+ });
1457
+ };
1458
+ /**
1459
+ * Load a directory from the module's scratch working directory, including any changes that may have been made to it during module function execution.
1460
+ * @param path Location of the directory to access (e.g., ".").
1461
+ * @param opts.exclude Exclude artifacts that match the given pattern (e.g., ["node_modules/", ".git*"]).
1462
+ * @param opts.include Include only artifacts that match the given pattern (e.g., ["app/", "package.*"]).
1463
+ */
1464
+ workdir = (path, opts) => {
1465
+ return new Directory({
1466
+ queryTree: [
1467
+ ...this._queryTree,
1468
+ {
1469
+ operation: "workdir",
1470
+ args: { path, ...opts },
1471
+ },
1472
+ ],
1473
+ ctx: this._ctx,
1474
+ });
1475
+ };
1476
+ /**
1477
+ * Load a file from the module's scratch working directory, including any changes that may have been made to it during module function execution.Load a file from the module's scratch working directory, including any changes that may have been made to it during module function execution.
1478
+ * @param path Location of the file to retrieve (e.g., "README.md").
1479
+ */
1480
+ workdirFile = (path) => {
1481
+ return new File({
1482
+ queryTree: [
1483
+ ...this._queryTree,
1484
+ {
1485
+ operation: "workdirFile",
1486
+ args: { path },
1487
+ },
1488
+ ],
1489
+ ctx: this._ctx,
1490
+ });
1491
+ };
1492
+ }
1382
1493
  /**
1383
1494
  * A directory.
1384
1495
  */
@@ -1396,7 +1507,7 @@ export class Directory extends BaseClient {
1396
1507
  this._sync = _sync;
1397
1508
  }
1398
1509
  /**
1399
- * The content-addressed identifier of the directory.
1510
+ * A unique identifier for this Directory.
1400
1511
  */
1401
1512
  id = async () => {
1402
1513
  if (this._id) {
@@ -1412,16 +1523,11 @@ export class Directory extends BaseClient {
1412
1523
  };
1413
1524
  /**
1414
1525
  * Load the directory as a Dagger module
1415
- * @param opts.sourceSubpath An optional subpath of the directory which contains the module's source
1416
- * code.
1526
+ * @param opts.sourceSubpath An optional subpath of the directory which contains the module's source code.
1417
1527
  *
1418
- * This is needed when the module code is in a subdirectory but requires
1419
- * parent directories to be loaded in order to execute. For example, the
1420
- * module source code may need a go.mod, project.toml, package.json, etc. file
1421
- * from a parent directory.
1528
+ * 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.
1422
1529
  *
1423
- * If not set, the module source code is loaded from the root of the
1424
- * directory.
1530
+ * If not set, the module source code is loaded from the root of the directory.
1425
1531
  */
1426
1532
  asModule = (opts) => {
1427
1533
  return new Module_({
@@ -1469,12 +1575,10 @@ export class Directory extends BaseClient {
1469
1575
  };
1470
1576
  /**
1471
1577
  * Builds a new Docker container from this directory.
1472
- * @param opts.dockerfile Path to the Dockerfile to use (e.g., "frontend.Dockerfile").
1473
- *
1474
- * Defaults: './Dockerfile'.
1475
1578
  * @param opts.platform The platform to build.
1476
- * @param opts.buildArgs Build arguments to use in the build.
1579
+ * @param opts.dockerfile Path to the Dockerfile to use (e.g., "frontend.Dockerfile").
1477
1580
  * @param opts.target Target build stage to build.
1581
+ * @param opts.buildArgs Build arguments to use in the build.
1478
1582
  * @param opts.secrets Secrets to pass to the build.
1479
1583
  *
1480
1584
  * They will be mounted at /run/secrets/[secret-name].
@@ -1553,10 +1657,10 @@ export class Directory extends BaseClient {
1553
1657
  return response;
1554
1658
  };
1555
1659
  /**
1556
- * Creates a named sub-pipeline
1557
- * @param name Pipeline name.
1558
- * @param opts.description Pipeline description.
1559
- * @param opts.labels Pipeline labels.
1660
+ * Creates a named sub-pipeline.
1661
+ * @param name Name of the sub-pipeline.
1662
+ * @param opts.description Description of the sub-pipeline.
1663
+ * @param opts.labels Labels to apply to the sub-pipeline.
1560
1664
  */
1561
1665
  pipeline = (name, opts) => {
1562
1666
  return new Directory({
@@ -1606,8 +1710,6 @@ export class Directory extends BaseClient {
1606
1710
  * @param path Location of the copied file (e.g., "/file.txt").
1607
1711
  * @param source Identifier of the file to copy.
1608
1712
  * @param opts.permissions Permission given to the copied file (e.g., 0600).
1609
- *
1610
- * Default: 0644.
1611
1713
  */
1612
1714
  withFile = (path, source, opts) => {
1613
1715
  return new Directory({
@@ -1625,8 +1727,6 @@ export class Directory extends BaseClient {
1625
1727
  * Retrieves this directory plus a new directory created at the given path.
1626
1728
  * @param path Location of the directory created (e.g., "/logs").
1627
1729
  * @param opts.permissions Permission granted to the created directory (e.g., 0777).
1628
- *
1629
- * Default: 0755.
1630
1730
  */
1631
1731
  withNewDirectory = (path, opts) => {
1632
1732
  return new Directory({
@@ -1645,8 +1745,6 @@ export class Directory extends BaseClient {
1645
1745
  * @param path Location of the written file (e.g., "/file.txt").
1646
1746
  * @param contents Content of the written file (e.g., "Hello world!").
1647
1747
  * @param opts.permissions Permission given to the copied file (e.g., 0600).
1648
- *
1649
- * Default: 0644.
1650
1748
  */
1651
1749
  withNewFile = (path, contents, opts) => {
1652
1750
  return new Directory({
@@ -1720,22 +1818,36 @@ export class Directory extends BaseClient {
1720
1818
  };
1721
1819
  }
1722
1820
  /**
1723
- * A simple key value object that represents an environment variable.
1821
+ * An environment variable name and value.
1724
1822
  */
1725
1823
  export class EnvVariable extends BaseClient {
1824
+ _id = undefined;
1726
1825
  _name = undefined;
1727
1826
  _value = undefined;
1728
1827
  /**
1729
1828
  * Constructor is used for internal usage only, do not create object from it.
1730
1829
  */
1731
- constructor(parent, _name, _value) {
1830
+ constructor(parent, _id, _name, _value) {
1732
1831
  super(parent);
1832
+ this._id = _id;
1733
1833
  this._name = _name;
1734
1834
  this._value = _value;
1735
1835
  }
1736
1836
  /**
1737
- * The environment variable name.
1837
+ * A unique identifier for this EnvVariable.
1738
1838
  */
1839
+ id = async () => {
1840
+ if (this._id) {
1841
+ return this._id;
1842
+ }
1843
+ const response = await computeQuery([
1844
+ ...this._queryTree,
1845
+ {
1846
+ operation: "id",
1847
+ },
1848
+ ], await this._ctx.connection());
1849
+ return response;
1850
+ };
1739
1851
  name = async () => {
1740
1852
  if (this._name) {
1741
1853
  return this._name;
@@ -1748,9 +1860,6 @@ export class EnvVariable extends BaseClient {
1748
1860
  ], await this._ctx.connection());
1749
1861
  return response;
1750
1862
  };
1751
- /**
1752
- * The environment variable value.
1753
- */
1754
1863
  value = async () => {
1755
1864
  if (this._value) {
1756
1865
  return this._value;
@@ -1766,23 +1875,37 @@ export class EnvVariable extends BaseClient {
1766
1875
  }
1767
1876
  /**
1768
1877
  * A definition of a field on a custom object defined in a Module.
1769
- * A field on an object has a static value, as opposed to a function on an
1770
- * object whose value is computed by invoking code (and can accept arguments).
1878
+ *
1879
+ * 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).
1771
1880
  */
1772
1881
  export class FieldTypeDef extends BaseClient {
1882
+ _id = undefined;
1773
1883
  _description = undefined;
1774
1884
  _name = undefined;
1775
1885
  /**
1776
1886
  * Constructor is used for internal usage only, do not create object from it.
1777
1887
  */
1778
- constructor(parent, _description, _name) {
1888
+ constructor(parent, _id, _description, _name) {
1779
1889
  super(parent);
1890
+ this._id = _id;
1780
1891
  this._description = _description;
1781
1892
  this._name = _name;
1782
1893
  }
1783
1894
  /**
1784
- * A doc string for the field, if any
1895
+ * A unique identifier for this FieldTypeDef.
1785
1896
  */
1897
+ id = async () => {
1898
+ if (this._id) {
1899
+ return this._id;
1900
+ }
1901
+ const response = await computeQuery([
1902
+ ...this._queryTree,
1903
+ {
1904
+ operation: "id",
1905
+ },
1906
+ ], await this._ctx.connection());
1907
+ return response;
1908
+ };
1786
1909
  description = async () => {
1787
1910
  if (this._description) {
1788
1911
  return this._description;
@@ -1795,9 +1918,6 @@ export class FieldTypeDef extends BaseClient {
1795
1918
  ], await this._ctx.connection());
1796
1919
  return response;
1797
1920
  };
1798
- /**
1799
- * The name of the field in the object
1800
- */
1801
1921
  name = async () => {
1802
1922
  if (this._name) {
1803
1923
  return this._name;
@@ -1810,9 +1930,6 @@ export class FieldTypeDef extends BaseClient {
1810
1930
  ], await this._ctx.connection());
1811
1931
  return response;
1812
1932
  };
1813
- /**
1814
- * The type of the field
1815
- */
1816
1933
  typeDef = () => {
1817
1934
  return new TypeDef({
1818
1935
  queryTree: [
@@ -1832,21 +1949,23 @@ export class File extends BaseClient {
1832
1949
  _id = undefined;
1833
1950
  _contents = undefined;
1834
1951
  _export = undefined;
1952
+ _name = undefined;
1835
1953
  _size = undefined;
1836
1954
  _sync = undefined;
1837
1955
  /**
1838
1956
  * Constructor is used for internal usage only, do not create object from it.
1839
1957
  */
1840
- constructor(parent, _id, _contents, _export, _size, _sync) {
1958
+ constructor(parent, _id, _contents, _export, _name, _size, _sync) {
1841
1959
  super(parent);
1842
1960
  this._id = _id;
1843
1961
  this._contents = _contents;
1844
1962
  this._export = _export;
1963
+ this._name = _name;
1845
1964
  this._size = _size;
1846
1965
  this._sync = _sync;
1847
1966
  }
1848
1967
  /**
1849
- * Retrieves the content-addressed identifier of the file.
1968
+ * A unique identifier for this File.
1850
1969
  */
1851
1970
  id = async () => {
1852
1971
  if (this._id) {
@@ -1878,8 +1997,7 @@ export class File extends BaseClient {
1878
1997
  /**
1879
1998
  * Writes the file to a file path on the host.
1880
1999
  * @param path Location of the written directory (e.g., "output.txt").
1881
- * @param opts.allowParentDirPath If allowParentDirPath is true, the path argument can be a directory path, in which case
1882
- * the file will be created in that directory.
2000
+ * @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.
1883
2001
  */
1884
2002
  export = async (path, opts) => {
1885
2003
  if (this._export) {
@@ -1895,7 +2013,22 @@ export class File extends BaseClient {
1895
2013
  return response;
1896
2014
  };
1897
2015
  /**
1898
- * Gets the size of the file, in bytes.
2016
+ * Retrieves the name of the file.
2017
+ */
2018
+ name = async () => {
2019
+ if (this._name) {
2020
+ return this._name;
2021
+ }
2022
+ const response = await computeQuery([
2023
+ ...this._queryTree,
2024
+ {
2025
+ operation: "name",
2026
+ },
2027
+ ], await this._ctx.connection());
2028
+ return response;
2029
+ };
2030
+ /**
2031
+ * Retrieves the size of the file, in bytes.
1899
2032
  */
1900
2033
  size = async () => {
1901
2034
  if (this._size) {
@@ -1951,8 +2084,7 @@ export class File extends BaseClient {
1951
2084
  /**
1952
2085
  * Function represents a resolver provided by a Module.
1953
2086
  *
1954
- * A function always evaluates against a parent object and is given a set of
1955
- * named arguments.
2087
+ * A function always evaluates against a parent object and is given a set of named arguments.
1956
2088
  */
1957
2089
  export class Function_ extends BaseClient {
1958
2090
  _id = undefined;
@@ -1968,7 +2100,7 @@ export class Function_ extends BaseClient {
1968
2100
  this._name = _name;
1969
2101
  }
1970
2102
  /**
1971
- * The ID of the function
2103
+ * A unique identifier for this Function.
1972
2104
  */
1973
2105
  id = async () => {
1974
2106
  if (this._id) {
@@ -1982,9 +2114,6 @@ export class Function_ extends BaseClient {
1982
2114
  ], await this._ctx.connection());
1983
2115
  return response;
1984
2116
  };
1985
- /**
1986
- * Arguments accepted by this function, if any
1987
- */
1988
2117
  args = async () => {
1989
2118
  const response = await computeQuery([
1990
2119
  ...this._queryTree,
@@ -1996,13 +2125,15 @@ export class Function_ extends BaseClient {
1996
2125
  },
1997
2126
  ], await this._ctx.connection());
1998
2127
  return response.map((r) => new FunctionArg({
1999
- queryTree: this.queryTree,
2128
+ queryTree: [
2129
+ {
2130
+ operation: "loadFunctionArgFromID",
2131
+ args: { id: r.id },
2132
+ },
2133
+ ],
2000
2134
  ctx: this._ctx,
2001
2135
  }, r.id));
2002
2136
  };
2003
- /**
2004
- * A doc string for the function, if any
2005
- */
2006
2137
  description = async () => {
2007
2138
  if (this._description) {
2008
2139
  return this._description;
@@ -2015,9 +2146,6 @@ export class Function_ extends BaseClient {
2015
2146
  ], await this._ctx.connection());
2016
2147
  return response;
2017
2148
  };
2018
- /**
2019
- * The name of the function
2020
- */
2021
2149
  name = async () => {
2022
2150
  if (this._name) {
2023
2151
  return this._name;
@@ -2030,9 +2158,6 @@ export class Function_ extends BaseClient {
2030
2158
  ], await this._ctx.connection());
2031
2159
  return response;
2032
2160
  };
2033
- /**
2034
- * The type returned by this function
2035
- */
2036
2161
  returnType = () => {
2037
2162
  return new TypeDef({
2038
2163
  queryTree: [
@@ -2064,7 +2189,8 @@ export class Function_ extends BaseClient {
2064
2189
  });
2065
2190
  };
2066
2191
  /**
2067
- * Returns the function with the doc string
2192
+ * Returns the function with the given doc string.
2193
+ * @param description The doc string to set.
2068
2194
  */
2069
2195
  withDescription = (description) => {
2070
2196
  return new Function_({
@@ -2090,8 +2216,7 @@ export class Function_ extends BaseClient {
2090
2216
  /**
2091
2217
  * An argument accepted by a function.
2092
2218
  *
2093
- * This is a specification for an argument at function definition time, not an
2094
- * argument passed at function call time.
2219
+ * This is a specification for an argument at function definition time, not an argument passed at function call time.
2095
2220
  */
2096
2221
  export class FunctionArg extends BaseClient {
2097
2222
  _id = undefined;
@@ -2109,7 +2234,7 @@ export class FunctionArg extends BaseClient {
2109
2234
  this._name = _name;
2110
2235
  }
2111
2236
  /**
2112
- * The ID of the argument
2237
+ * A unique identifier for this FunctionArg.
2113
2238
  */
2114
2239
  id = async () => {
2115
2240
  if (this._id) {
@@ -2123,9 +2248,6 @@ export class FunctionArg extends BaseClient {
2123
2248
  ], await this._ctx.connection());
2124
2249
  return response;
2125
2250
  };
2126
- /**
2127
- * A default value to use for this argument when not explicitly set by the caller, if any
2128
- */
2129
2251
  defaultValue = async () => {
2130
2252
  if (this._defaultValue) {
2131
2253
  return this._defaultValue;
@@ -2138,9 +2260,6 @@ export class FunctionArg extends BaseClient {
2138
2260
  ], await this._ctx.connection());
2139
2261
  return response;
2140
2262
  };
2141
- /**
2142
- * A doc string for the argument, if any
2143
- */
2144
2263
  description = async () => {
2145
2264
  if (this._description) {
2146
2265
  return this._description;
@@ -2153,9 +2272,6 @@ export class FunctionArg extends BaseClient {
2153
2272
  ], await this._ctx.connection());
2154
2273
  return response;
2155
2274
  };
2156
- /**
2157
- * The name of the argument
2158
- */
2159
2275
  name = async () => {
2160
2276
  if (this._name) {
2161
2277
  return this._name;
@@ -2168,9 +2284,6 @@ export class FunctionArg extends BaseClient {
2168
2284
  ], await this._ctx.connection());
2169
2285
  return response;
2170
2286
  };
2171
- /**
2172
- * The type of the argument
2173
- */
2174
2287
  typeDef = () => {
2175
2288
  return new TypeDef({
2176
2289
  queryTree: [
@@ -2183,7 +2296,11 @@ export class FunctionArg extends BaseClient {
2183
2296
  });
2184
2297
  };
2185
2298
  }
2299
+ /**
2300
+ * An active function call.
2301
+ */
2186
2302
  export class FunctionCall extends BaseClient {
2303
+ _id = undefined;
2187
2304
  _name = undefined;
2188
2305
  _parent = undefined;
2189
2306
  _parentName = undefined;
@@ -2191,34 +2308,49 @@ export class FunctionCall extends BaseClient {
2191
2308
  /**
2192
2309
  * Constructor is used for internal usage only, do not create object from it.
2193
2310
  */
2194
- constructor(parent, _name, _parent, _parentName, _returnValue) {
2311
+ constructor(parent, _id, _name, _parent, _parentName, _returnValue) {
2195
2312
  super(parent);
2313
+ this._id = _id;
2196
2314
  this._name = _name;
2197
2315
  this._parent = _parent;
2198
2316
  this._parentName = _parentName;
2199
2317
  this._returnValue = _returnValue;
2200
2318
  }
2201
2319
  /**
2202
- * The argument values the function is being invoked with.
2320
+ * A unique identifier for this FunctionCall.
2203
2321
  */
2204
- inputArgs = async () => {
2322
+ id = async () => {
2323
+ if (this._id) {
2324
+ return this._id;
2325
+ }
2205
2326
  const response = await computeQuery([
2206
2327
  ...this._queryTree,
2207
2328
  {
2208
- operation: "inputArgs",
2329
+ operation: "id",
2330
+ },
2331
+ ], await this._ctx.connection());
2332
+ return response;
2333
+ };
2334
+ inputArgs = async () => {
2335
+ const response = await computeQuery([
2336
+ ...this._queryTree,
2337
+ {
2338
+ operation: "inputArgs",
2209
2339
  },
2210
2340
  {
2211
- operation: "name value",
2341
+ operation: "id",
2212
2342
  },
2213
2343
  ], await this._ctx.connection());
2214
2344
  return response.map((r) => new FunctionCallArgValue({
2215
- queryTree: this.queryTree,
2345
+ queryTree: [
2346
+ {
2347
+ operation: "loadFunctionCallArgValueFromID",
2348
+ args: { id: r.id },
2349
+ },
2350
+ ],
2216
2351
  ctx: this._ctx,
2217
- }, r.name, r.value));
2352
+ }, r.id));
2218
2353
  };
2219
- /**
2220
- * The name of the function being called.
2221
- */
2222
2354
  name = async () => {
2223
2355
  if (this._name) {
2224
2356
  return this._name;
@@ -2231,10 +2363,6 @@ export class FunctionCall extends BaseClient {
2231
2363
  ], await this._ctx.connection());
2232
2364
  return response;
2233
2365
  };
2234
- /**
2235
- * The value of the parent object of the function being called.
2236
- * If the function is "top-level" to the module, this is always an empty object.
2237
- */
2238
2366
  parent = async () => {
2239
2367
  if (this._parent) {
2240
2368
  return this._parent;
@@ -2247,10 +2375,6 @@ export class FunctionCall extends BaseClient {
2247
2375
  ], await this._ctx.connection());
2248
2376
  return response;
2249
2377
  };
2250
- /**
2251
- * The name of the parent object of the function being called.
2252
- * If the function is "top-level" to the module, this is the name of the module.
2253
- */
2254
2378
  parentName = async () => {
2255
2379
  if (this._parentName) {
2256
2380
  return this._parentName;
@@ -2265,7 +2389,7 @@ export class FunctionCall extends BaseClient {
2265
2389
  };
2266
2390
  /**
2267
2391
  * Set the return value of the function call to the provided value.
2268
- * The value should be a string of the JSON serialization of the return value.
2392
+ * @param value JSON serialization of the return value.
2269
2393
  */
2270
2394
  returnValue = async (value) => {
2271
2395
  if (this._returnValue) {
@@ -2281,20 +2405,37 @@ export class FunctionCall extends BaseClient {
2281
2405
  return response;
2282
2406
  };
2283
2407
  }
2408
+ /**
2409
+ * A value passed as a named argument to a function call.
2410
+ */
2284
2411
  export class FunctionCallArgValue extends BaseClient {
2412
+ _id = undefined;
2285
2413
  _name = undefined;
2286
2414
  _value = undefined;
2287
2415
  /**
2288
2416
  * Constructor is used for internal usage only, do not create object from it.
2289
2417
  */
2290
- constructor(parent, _name, _value) {
2418
+ constructor(parent, _id, _name, _value) {
2291
2419
  super(parent);
2420
+ this._id = _id;
2292
2421
  this._name = _name;
2293
2422
  this._value = _value;
2294
2423
  }
2295
2424
  /**
2296
- * The name of the argument.
2425
+ * A unique identifier for this FunctionCallArgValue.
2297
2426
  */
2427
+ id = async () => {
2428
+ if (this._id) {
2429
+ return this._id;
2430
+ }
2431
+ const response = await computeQuery([
2432
+ ...this._queryTree,
2433
+ {
2434
+ operation: "id",
2435
+ },
2436
+ ], await this._ctx.connection());
2437
+ return response;
2438
+ };
2298
2439
  name = async () => {
2299
2440
  if (this._name) {
2300
2441
  return this._name;
@@ -2307,9 +2448,6 @@ export class FunctionCallArgValue extends BaseClient {
2307
2448
  ], await this._ctx.connection());
2308
2449
  return response;
2309
2450
  };
2310
- /**
2311
- * The value of the argument represented as a string of the JSON serialization.
2312
- */
2313
2451
  value = async () => {
2314
2452
  if (this._value) {
2315
2453
  return this._value;
@@ -2323,6 +2461,9 @@ export class FunctionCallArgValue extends BaseClient {
2323
2461
  return response;
2324
2462
  };
2325
2463
  }
2464
+ /**
2465
+ * The result of running an SDK's codegen.
2466
+ */
2326
2467
  export class GeneratedCode extends BaseClient {
2327
2468
  _id = undefined;
2328
2469
  /**
@@ -2332,6 +2473,9 @@ export class GeneratedCode extends BaseClient {
2332
2473
  super(parent);
2333
2474
  this._id = _id;
2334
2475
  }
2476
+ /**
2477
+ * A unique identifier for this GeneratedCode.
2478
+ */
2335
2479
  id = async () => {
2336
2480
  if (this._id) {
2337
2481
  return this._id;
@@ -2344,9 +2488,6 @@ export class GeneratedCode extends BaseClient {
2344
2488
  ], await this._ctx.connection());
2345
2489
  return response;
2346
2490
  };
2347
- /**
2348
- * The directory containing the generated code
2349
- */
2350
2491
  code = () => {
2351
2492
  return new Directory({
2352
2493
  queryTree: [
@@ -2358,9 +2499,6 @@ export class GeneratedCode extends BaseClient {
2358
2499
  ctx: this._ctx,
2359
2500
  });
2360
2501
  };
2361
- /**
2362
- * List of paths to mark generated in version control (i.e. .gitattributes)
2363
- */
2364
2502
  vcsGeneratedPaths = async () => {
2365
2503
  const response = await computeQuery([
2366
2504
  ...this._queryTree,
@@ -2370,9 +2508,6 @@ export class GeneratedCode extends BaseClient {
2370
2508
  ], await this._ctx.connection());
2371
2509
  return response;
2372
2510
  };
2373
- /**
2374
- * List of paths to ignore in version control (i.e. .gitignore)
2375
- */
2376
2511
  vcsIgnoredPaths = async () => {
2377
2512
  const response = await computeQuery([
2378
2513
  ...this._queryTree,
@@ -2383,7 +2518,7 @@ export class GeneratedCode extends BaseClient {
2383
2518
  return response;
2384
2519
  };
2385
2520
  /**
2386
- * Set the list of paths to mark generated in version control
2521
+ * Set the list of paths to mark generated in version control.
2387
2522
  */
2388
2523
  withVCSGeneratedPaths = (paths) => {
2389
2524
  return new GeneratedCode({
@@ -2398,7 +2533,7 @@ export class GeneratedCode extends BaseClient {
2398
2533
  });
2399
2534
  };
2400
2535
  /**
2401
- * Set the list of paths to ignore in version control
2536
+ * Set the list of paths to ignore in version control.
2402
2537
  */
2403
2538
  withVCSIgnoredPaths = (paths) => {
2404
2539
  return new GeneratedCode({
@@ -2422,7 +2557,111 @@ export class GeneratedCode extends BaseClient {
2422
2557
  };
2423
2558
  }
2424
2559
  /**
2425
- * A git ref (tag, branch or commit).
2560
+ * Module source originating from a git repo.
2561
+ */
2562
+ export class GitModuleSource extends BaseClient {
2563
+ _id = undefined;
2564
+ _cloneURL = undefined;
2565
+ _commit = undefined;
2566
+ _htmlURL = undefined;
2567
+ _sourceSubpath = undefined;
2568
+ _version = undefined;
2569
+ /**
2570
+ * Constructor is used for internal usage only, do not create object from it.
2571
+ */
2572
+ constructor(parent, _id, _cloneURL, _commit, _htmlURL, _sourceSubpath, _version) {
2573
+ super(parent);
2574
+ this._id = _id;
2575
+ this._cloneURL = _cloneURL;
2576
+ this._commit = _commit;
2577
+ this._htmlURL = _htmlURL;
2578
+ this._sourceSubpath = _sourceSubpath;
2579
+ this._version = _version;
2580
+ }
2581
+ /**
2582
+ * A unique identifier for this GitModuleSource.
2583
+ */
2584
+ id = async () => {
2585
+ if (this._id) {
2586
+ return this._id;
2587
+ }
2588
+ const response = await computeQuery([
2589
+ ...this._queryTree,
2590
+ {
2591
+ operation: "id",
2592
+ },
2593
+ ], await this._ctx.connection());
2594
+ return response;
2595
+ };
2596
+ /**
2597
+ * The URL from which the source's git repo can be cloned.
2598
+ */
2599
+ cloneURL = async () => {
2600
+ if (this._cloneURL) {
2601
+ return this._cloneURL;
2602
+ }
2603
+ const response = await computeQuery([
2604
+ ...this._queryTree,
2605
+ {
2606
+ operation: "cloneURL",
2607
+ },
2608
+ ], await this._ctx.connection());
2609
+ return response;
2610
+ };
2611
+ commit = async () => {
2612
+ if (this._commit) {
2613
+ return this._commit;
2614
+ }
2615
+ const response = await computeQuery([
2616
+ ...this._queryTree,
2617
+ {
2618
+ operation: "commit",
2619
+ },
2620
+ ], await this._ctx.connection());
2621
+ return response;
2622
+ };
2623
+ /**
2624
+ * The URL to the source's git repo in a web browser
2625
+ */
2626
+ htmlURL = async () => {
2627
+ if (this._htmlURL) {
2628
+ return this._htmlURL;
2629
+ }
2630
+ const response = await computeQuery([
2631
+ ...this._queryTree,
2632
+ {
2633
+ operation: "htmlURL",
2634
+ },
2635
+ ], await this._ctx.connection());
2636
+ return response;
2637
+ };
2638
+ sourceSubpath = async () => {
2639
+ if (this._sourceSubpath) {
2640
+ return this._sourceSubpath;
2641
+ }
2642
+ const response = await computeQuery([
2643
+ ...this._queryTree,
2644
+ {
2645
+ operation: "sourceSubpath",
2646
+ },
2647
+ ], await this._ctx.connection());
2648
+ return response;
2649
+ };
2650
+ version = async () => {
2651
+ if (this._version) {
2652
+ return this._version;
2653
+ }
2654
+ const response = await computeQuery([
2655
+ ...this._queryTree,
2656
+ {
2657
+ operation: "version",
2658
+ },
2659
+ ], await this._ctx.connection());
2660
+ return response;
2661
+ };
2662
+ }
2663
+ /**
2664
+ * A git ref (tag, branch, or commit).
2426
2665
  */
2427
2666
  export class GitRef extends BaseClient {
2428
2667
  _id = undefined;
@@ -2436,7 +2675,7 @@ export class GitRef extends BaseClient {
2436
2675
  this._commit = _commit;
2437
2676
  }
2438
2677
  /**
2439
- * Retrieves the content-addressed identifier of the git ref.
2678
+ * A unique identifier for this GitRef.
2440
2679
  */
2441
2680
  id = async () => {
2442
2681
  if (this._id) {
@@ -2467,6 +2706,8 @@ export class GitRef extends BaseClient {
2467
2706
  };
2468
2707
  /**
2469
2708
  * The filesystem tree at this ref.
2709
+ * @param opts.sshKnownHosts DEPRECATED: This option should be passed to `git` instead.
2710
+ * @param opts.sshAuthSocket DEPRECATED: This option should be passed to `git` instead.
2470
2711
  */
2471
2712
  tree = (opts) => {
2472
2713
  return new Directory({
@@ -2494,7 +2735,7 @@ export class GitRepository extends BaseClient {
2494
2735
  this._id = _id;
2495
2736
  }
2496
2737
  /**
2497
- * Retrieves the content-addressed identifier of the git repository.
2738
+ * A unique identifier for this GitRepository.
2498
2739
  */
2499
2740
  id = async () => {
2500
2741
  if (this._id) {
@@ -2509,7 +2750,7 @@ export class GitRepository extends BaseClient {
2509
2750
  return response;
2510
2751
  };
2511
2752
  /**
2512
- * Returns details on one branch.
2753
+ * Returns details of a branch.
2513
2754
  * @param name Branch's name (e.g., "main").
2514
2755
  */
2515
2756
  branch = (name) => {
@@ -2525,7 +2766,7 @@ export class GitRepository extends BaseClient {
2525
2766
  });
2526
2767
  };
2527
2768
  /**
2528
- * Returns details on one commit.
2769
+ * Returns details of a commit.
2529
2770
  * @param id Identifier of the commit (e.g., "b6315d8f2810962c601af73f86831f6866ea798b").
2530
2771
  */
2531
2772
  commit = (id) => {
@@ -2541,7 +2782,7 @@ export class GitRepository extends BaseClient {
2541
2782
  });
2542
2783
  };
2543
2784
  /**
2544
- * Returns details on one tag.
2785
+ * Returns details of a tag.
2545
2786
  * @param name Tag's name (e.g., "v0.3.9").
2546
2787
  */
2547
2788
  tag = (name) => {
@@ -2558,15 +2799,32 @@ export class GitRepository extends BaseClient {
2558
2799
  };
2559
2800
  }
2560
2801
  /**
2561
- * Information about the host execution environment.
2802
+ * Information about the host environment.
2562
2803
  */
2563
2804
  export class Host extends BaseClient {
2805
+ _id = undefined;
2564
2806
  /**
2565
2807
  * Constructor is used for internal usage only, do not create object from it.
2566
2808
  */
2567
- constructor(parent) {
2809
+ constructor(parent, _id) {
2568
2810
  super(parent);
2811
+ this._id = _id;
2569
2812
  }
2813
+ /**
2814
+ * A unique identifier for this Host.
2815
+ */
2816
+ id = async () => {
2817
+ if (this._id) {
2818
+ return this._id;
2819
+ }
2820
+ const response = await computeQuery([
2821
+ ...this._queryTree,
2822
+ {
2823
+ operation: "id",
2824
+ },
2825
+ ], await this._ctx.connection());
2826
+ return response;
2827
+ };
2570
2828
  /**
2571
2829
  * Accesses a directory on the host.
2572
2830
  * @param path Location of the directory to access (e.g., ".").
@@ -2603,21 +2861,20 @@ export class Host extends BaseClient {
2603
2861
  };
2604
2862
  /**
2605
2863
  * Creates a service that forwards traffic to a specified address via the host.
2606
- * @param ports Ports to expose via the service, forwarding through the host network.
2864
+ * @param opts.host Upstream host to forward traffic to.
2865
+ * @param opts.ports Ports to expose via the service, forwarding through the host network.
2607
2866
  *
2608
- * If a port's frontend is unspecified or 0, it defaults to the same as the
2609
- * backend port.
2867
+ * If a port's frontend is unspecified or 0, it defaults to the same as the backend port.
2610
2868
  *
2611
2869
  * An empty set of ports is not valid; an error will be returned.
2612
- * @param opts.host Upstream host to forward traffic to.
2613
2870
  */
2614
- service = (ports, opts) => {
2871
+ service = (opts) => {
2615
2872
  return new Service({
2616
2873
  queryTree: [
2617
2874
  ...this._queryTree,
2618
2875
  {
2619
2876
  operation: "service",
2620
- args: { ports, ...opts },
2877
+ args: { ...opts },
2621
2878
  },
2622
2879
  ],
2623
2880
  ctx: this._ctx,
@@ -2625,6 +2882,7 @@ export class Host extends BaseClient {
2625
2882
  };
2626
2883
  /**
2627
2884
  * Sets a secret given a user-defined name and the file path on the host, and returns the secret.
2885
+ *
2628
2886
  * The file is limited to a size of 512000 bytes.
2629
2887
  * @param name The user defined name for this secret.
2630
2888
  * @param path Location of the file to set as a secret.
@@ -2644,20 +2902,16 @@ export class Host extends BaseClient {
2644
2902
  /**
2645
2903
  * Creates a tunnel that forwards traffic from the host to a service.
2646
2904
  * @param service Service to send traffic from the tunnel.
2647
- * @param opts.native Map each service port to the same port on the host, as if the service were
2648
- * running natively.
2649
- *
2650
- * Note: enabling may result in port conflicts.
2651
2905
  * @param opts.ports Configure explicit port forwarding rules for the tunnel.
2652
2906
  *
2653
- * If a port's frontend is unspecified or 0, a random port will be chosen by
2654
- * the host.
2907
+ * If a port's frontend is unspecified or 0, a random port will be chosen by the host.
2655
2908
  *
2656
- * If no ports are given, all of the service's ports are forwarded. If native
2657
- * is true, each port maps to the same port on the host. If native is false,
2658
- * each port maps to a random port chosen by the host.
2909
+ * 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.
2659
2910
  *
2660
2911
  * If ports are given and native is true, the ports are additive.
2912
+ * @param opts.native Map each service port to the same port on the host, as if the service were running natively.
2913
+ *
2914
+ * Note: enabling may result in port conflicts.
2661
2915
  */
2662
2916
  tunnel = (service, opts) => {
2663
2917
  return new Service({
@@ -2688,25 +2942,104 @@ export class Host extends BaseClient {
2688
2942
  });
2689
2943
  };
2690
2944
  }
2945
+ /**
2946
+ * A graphql input type, which is essentially just a group of named args.
2947
+ * This is currently only used to represent pre-existing usage of graphql input types
2948
+ * in the core API. It is not used by user modules and shouldn't ever be as user
2949
+ * module accept input objects via their id rather than graphql input types.
2950
+ */
2951
+ export class InputTypeDef extends BaseClient {
2952
+ _id = undefined;
2953
+ _name = undefined;
2954
+ /**
2955
+ * Constructor is used for internal usage only, do not create object from it.
2956
+ */
2957
+ constructor(parent, _id, _name) {
2958
+ super(parent);
2959
+ this._id = _id;
2960
+ this._name = _name;
2961
+ }
2962
+ /**
2963
+ * A unique identifier for this InputTypeDef.
2964
+ */
2965
+ id = async () => {
2966
+ if (this._id) {
2967
+ return this._id;
2968
+ }
2969
+ const response = await computeQuery([
2970
+ ...this._queryTree,
2971
+ {
2972
+ operation: "id",
2973
+ },
2974
+ ], await this._ctx.connection());
2975
+ return response;
2976
+ };
2977
+ fields = async () => {
2978
+ const response = await computeQuery([
2979
+ ...this._queryTree,
2980
+ {
2981
+ operation: "fields",
2982
+ },
2983
+ {
2984
+ operation: "id",
2985
+ },
2986
+ ], await this._ctx.connection());
2987
+ return response.map((r) => new FieldTypeDef({
2988
+ queryTree: [
2989
+ {
2990
+ operation: "loadFieldTypeDefFromID",
2991
+ args: { id: r.id },
2992
+ },
2993
+ ],
2994
+ ctx: this._ctx,
2995
+ }, r.id));
2996
+ };
2997
+ name = async () => {
2998
+ if (this._name) {
2999
+ return this._name;
3000
+ }
3001
+ const response = await computeQuery([
3002
+ ...this._queryTree,
3003
+ {
3004
+ operation: "name",
3005
+ },
3006
+ ], await this._ctx.connection());
3007
+ return response;
3008
+ };
3009
+ }
2691
3010
  /**
2692
3011
  * A definition of a custom interface defined in a Module.
2693
3012
  */
2694
3013
  export class InterfaceTypeDef extends BaseClient {
3014
+ _id = undefined;
2695
3015
  _description = undefined;
2696
3016
  _name = undefined;
2697
3017
  _sourceModuleName = undefined;
2698
3018
  /**
2699
3019
  * Constructor is used for internal usage only, do not create object from it.
2700
3020
  */
2701
- constructor(parent, _description, _name, _sourceModuleName) {
3021
+ constructor(parent, _id, _description, _name, _sourceModuleName) {
2702
3022
  super(parent);
3023
+ this._id = _id;
2703
3024
  this._description = _description;
2704
3025
  this._name = _name;
2705
3026
  this._sourceModuleName = _sourceModuleName;
2706
3027
  }
2707
3028
  /**
2708
- * The doc string for the interface, if any
3029
+ * A unique identifier for this InterfaceTypeDef.
2709
3030
  */
3031
+ id = async () => {
3032
+ if (this._id) {
3033
+ return this._id;
3034
+ }
3035
+ const response = await computeQuery([
3036
+ ...this._queryTree,
3037
+ {
3038
+ operation: "id",
3039
+ },
3040
+ ], await this._ctx.connection());
3041
+ return response;
3042
+ };
2710
3043
  description = async () => {
2711
3044
  if (this._description) {
2712
3045
  return this._description;
@@ -2719,9 +3052,6 @@ export class InterfaceTypeDef extends BaseClient {
2719
3052
  ], await this._ctx.connection());
2720
3053
  return response;
2721
3054
  };
2722
- /**
2723
- * Functions defined on this interface, if any
2724
- */
2725
3055
  functions = async () => {
2726
3056
  const response = await computeQuery([
2727
3057
  ...this._queryTree,
@@ -2733,13 +3063,15 @@ export class InterfaceTypeDef extends BaseClient {
2733
3063
  },
2734
3064
  ], await this._ctx.connection());
2735
3065
  return response.map((r) => new Function_({
2736
- queryTree: this.queryTree,
3066
+ queryTree: [
3067
+ {
3068
+ operation: "loadFunction_FromID",
3069
+ args: { id: r.id },
3070
+ },
3071
+ ],
2737
3072
  ctx: this._ctx,
2738
3073
  }, r.id));
2739
3074
  };
2740
- /**
2741
- * The name of the interface
2742
- */
2743
3075
  name = async () => {
2744
3076
  if (this._name) {
2745
3077
  return this._name;
@@ -2752,9 +3084,6 @@ export class InterfaceTypeDef extends BaseClient {
2752
3084
  ], await this._ctx.connection());
2753
3085
  return response;
2754
3086
  };
2755
- /**
2756
- * If this InterfaceTypeDef is associated with a Module, the name of the module. Unset otherwise.
2757
- */
2758
3087
  sourceModuleName = async () => {
2759
3088
  if (this._sourceModuleName) {
2760
3089
  return this._sourceModuleName;
@@ -2772,19 +3101,33 @@ export class InterfaceTypeDef extends BaseClient {
2772
3101
  * A simple key value object that represents a label.
2773
3102
  */
2774
3103
  export class Label extends BaseClient {
3104
+ _id = undefined;
2775
3105
  _name = undefined;
2776
3106
  _value = undefined;
2777
3107
  /**
2778
3108
  * Constructor is used for internal usage only, do not create object from it.
2779
3109
  */
2780
- constructor(parent, _name, _value) {
3110
+ constructor(parent, _id, _name, _value) {
2781
3111
  super(parent);
3112
+ this._id = _id;
2782
3113
  this._name = _name;
2783
3114
  this._value = _value;
2784
3115
  }
2785
3116
  /**
2786
- * The label name.
3117
+ * A unique identifier for this Label.
2787
3118
  */
3119
+ id = async () => {
3120
+ if (this._id) {
3121
+ return this._id;
3122
+ }
3123
+ const response = await computeQuery([
3124
+ ...this._queryTree,
3125
+ {
3126
+ operation: "id",
3127
+ },
3128
+ ], await this._ctx.connection());
3129
+ return response;
3130
+ };
2788
3131
  name = async () => {
2789
3132
  if (this._name) {
2790
3133
  return this._name;
@@ -2797,9 +3140,6 @@ export class Label extends BaseClient {
2797
3140
  ], await this._ctx.connection());
2798
3141
  return response;
2799
3142
  };
2800
- /**
2801
- * The label value.
2802
- */
2803
3143
  value = async () => {
2804
3144
  if (this._value) {
2805
3145
  return this._value;
@@ -2817,48 +3157,105 @@ export class Label extends BaseClient {
2817
3157
  * A definition of a list type in a Module.
2818
3158
  */
2819
3159
  export class ListTypeDef extends BaseClient {
3160
+ _id = undefined;
2820
3161
  /**
2821
3162
  * Constructor is used for internal usage only, do not create object from it.
2822
3163
  */
2823
- constructor(parent) {
3164
+ constructor(parent, _id) {
2824
3165
  super(parent);
3166
+ this._id = _id;
2825
3167
  }
2826
3168
  /**
2827
- * The type of the elements in the list
3169
+ * A unique identifier for this ListTypeDef.
2828
3170
  */
2829
- elementTypeDef = () => {
2830
- return new TypeDef({
2831
- queryTree: [
2832
- ...this._queryTree,
2833
- {
2834
- operation: "elementTypeDef",
2835
- },
2836
- ],
2837
- ctx: this._ctx,
3171
+ id = async () => {
3172
+ if (this._id) {
3173
+ return this._id;
3174
+ }
3175
+ const response = await computeQuery([
3176
+ ...this._queryTree,
3177
+ {
3178
+ operation: "id",
3179
+ },
3180
+ ], await this._ctx.connection());
3181
+ return response;
3182
+ };
3183
+ elementTypeDef = () => {
3184
+ return new TypeDef({
3185
+ queryTree: [
3186
+ ...this._queryTree,
3187
+ {
3188
+ operation: "elementTypeDef",
3189
+ },
3190
+ ],
3191
+ ctx: this._ctx,
2838
3192
  });
2839
3193
  };
2840
3194
  }
3195
+ /**
3196
+ * Module source that that originates from a path locally relative to an arbitrary directory.
3197
+ */
3198
+ export class LocalModuleSource extends BaseClient {
3199
+ _id = undefined;
3200
+ _sourceSubpath = undefined;
3201
+ /**
3202
+ * Constructor is used for internal usage only, do not create object from it.
3203
+ */
3204
+ constructor(parent, _id, _sourceSubpath) {
3205
+ super(parent);
3206
+ this._id = _id;
3207
+ this._sourceSubpath = _sourceSubpath;
3208
+ }
3209
+ /**
3210
+ * A unique identifier for this LocalModuleSource.
3211
+ */
3212
+ id = async () => {
3213
+ if (this._id) {
3214
+ return this._id;
3215
+ }
3216
+ const response = await computeQuery([
3217
+ ...this._queryTree,
3218
+ {
3219
+ operation: "id",
3220
+ },
3221
+ ], await this._ctx.connection());
3222
+ return response;
3223
+ };
3224
+ sourceSubpath = async () => {
3225
+ if (this._sourceSubpath) {
3226
+ return this._sourceSubpath;
3227
+ }
3228
+ const response = await computeQuery([
3229
+ ...this._queryTree,
3230
+ {
3231
+ operation: "sourceSubpath",
3232
+ },
3233
+ ], await this._ctx.connection());
3234
+ return response;
3235
+ };
3236
+ }
3237
+ /**
3238
+ * A Dagger module.
3239
+ */
2841
3240
  export class Module_ extends BaseClient {
2842
3241
  _id = undefined;
2843
3242
  _description = undefined;
2844
3243
  _name = undefined;
2845
3244
  _sdk = undefined;
2846
3245
  _serve = undefined;
2847
- _sourceDirectorySubPath = undefined;
2848
3246
  /**
2849
3247
  * Constructor is used for internal usage only, do not create object from it.
2850
3248
  */
2851
- constructor(parent, _id, _description, _name, _sdk, _serve, _sourceDirectorySubPath) {
3249
+ constructor(parent, _id, _description, _name, _sdk, _serve) {
2852
3250
  super(parent);
2853
3251
  this._id = _id;
2854
3252
  this._description = _description;
2855
3253
  this._name = _name;
2856
3254
  this._sdk = _sdk;
2857
3255
  this._serve = _serve;
2858
- this._sourceDirectorySubPath = _sourceDirectorySubPath;
2859
3256
  }
2860
3257
  /**
2861
- * The ID of the module
3258
+ * A unique identifier for this Module.
2862
3259
  */
2863
3260
  id = async () => {
2864
3261
  if (this._id) {
@@ -2872,9 +3269,6 @@ export class Module_ extends BaseClient {
2872
3269
  ], await this._ctx.connection());
2873
3270
  return response;
2874
3271
  };
2875
- /**
2876
- * Modules used by this module
2877
- */
2878
3272
  dependencies = async () => {
2879
3273
  const response = await computeQuery([
2880
3274
  ...this._queryTree,
@@ -2886,25 +3280,35 @@ export class Module_ extends BaseClient {
2886
3280
  },
2887
3281
  ], await this._ctx.connection());
2888
3282
  return response.map((r) => new Module_({
2889
- queryTree: this.queryTree,
3283
+ queryTree: [
3284
+ {
3285
+ operation: "loadModule_FromID",
3286
+ args: { id: r.id },
3287
+ },
3288
+ ],
2890
3289
  ctx: this._ctx,
2891
3290
  }, r.id));
2892
3291
  };
2893
- /**
2894
- * The dependencies as configured by the module
2895
- */
2896
3292
  dependencyConfig = async () => {
2897
3293
  const response = await computeQuery([
2898
3294
  ...this._queryTree,
2899
3295
  {
2900
3296
  operation: "dependencyConfig",
2901
3297
  },
3298
+ {
3299
+ operation: "id",
3300
+ },
2902
3301
  ], await this._ctx.connection());
2903
- return response;
3302
+ return response.map((r) => new ModuleDependency({
3303
+ queryTree: [
3304
+ {
3305
+ operation: "loadModuleDependencyFromID",
3306
+ args: { id: r.id },
3307
+ },
3308
+ ],
3309
+ ctx: this._ctx,
3310
+ }, r.id));
2904
3311
  };
2905
- /**
2906
- * The doc string of the module, if any
2907
- */
2908
3312
  description = async () => {
2909
3313
  if (this._description) {
2910
3314
  return this._description;
@@ -2918,22 +3322,33 @@ export class Module_ extends BaseClient {
2918
3322
  return response;
2919
3323
  };
2920
3324
  /**
2921
- * The code generated by the SDK's runtime
3325
+ * The module's root directory containing the config file for it and its source (possibly as a subdir). It includes any generated code or updated config files created after initial load, but not any files/directories that were unchanged after sdk codegen was run.
2922
3326
  */
2923
- generatedCode = () => {
2924
- return new GeneratedCode({
3327
+ generatedSourceRootDirectory = () => {
3328
+ return new Directory({
2925
3329
  queryTree: [
2926
3330
  ...this._queryTree,
2927
3331
  {
2928
- operation: "generatedCode",
3332
+ operation: "generatedSourceRootDirectory",
2929
3333
  },
2930
3334
  ],
2931
3335
  ctx: this._ctx,
2932
3336
  });
2933
3337
  };
2934
3338
  /**
2935
- * Interfaces served by this module
3339
+ * Retrieves the module with the objects loaded via its SDK.
2936
3340
  */
3341
+ initialize = () => {
3342
+ return new Module_({
3343
+ queryTree: [
3344
+ ...this._queryTree,
3345
+ {
3346
+ operation: "initialize",
3347
+ },
3348
+ ],
3349
+ ctx: this._ctx,
3350
+ });
3351
+ };
2937
3352
  interfaces = async () => {
2938
3353
  const response = await computeQuery([
2939
3354
  ...this._queryTree,
@@ -2945,13 +3360,15 @@ export class Module_ extends BaseClient {
2945
3360
  },
2946
3361
  ], await this._ctx.connection());
2947
3362
  return response.map((r) => new TypeDef({
2948
- queryTree: this.queryTree,
3363
+ queryTree: [
3364
+ {
3365
+ operation: "loadTypeDefFromID",
3366
+ args: { id: r.id },
3367
+ },
3368
+ ],
2949
3369
  ctx: this._ctx,
2950
3370
  }, r.id));
2951
3371
  };
2952
- /**
2953
- * The name of the module
2954
- */
2955
3372
  name = async () => {
2956
3373
  if (this._name) {
2957
3374
  return this._name;
@@ -2964,9 +3381,6 @@ export class Module_ extends BaseClient {
2964
3381
  ], await this._ctx.connection());
2965
3382
  return response;
2966
3383
  };
2967
- /**
2968
- * Objects served by this module
2969
- */
2970
3384
  objects = async () => {
2971
3385
  const response = await computeQuery([
2972
3386
  ...this._queryTree,
@@ -2978,13 +3392,26 @@ export class Module_ extends BaseClient {
2978
3392
  },
2979
3393
  ], await this._ctx.connection());
2980
3394
  return response.map((r) => new TypeDef({
2981
- queryTree: this.queryTree,
3395
+ queryTree: [
3396
+ {
3397
+ operation: "loadTypeDefFromID",
3398
+ args: { id: r.id },
3399
+ },
3400
+ ],
2982
3401
  ctx: this._ctx,
2983
3402
  }, r.id));
2984
3403
  };
2985
- /**
2986
- * The SDK used by this module. Either a name of a builtin SDK or a module ref pointing to the SDK's implementation.
2987
- */
3404
+ runtime = () => {
3405
+ return new Container({
3406
+ queryTree: [
3407
+ ...this._queryTree,
3408
+ {
3409
+ operation: "runtime",
3410
+ },
3411
+ ],
3412
+ ctx: this._ctx,
3413
+ });
3414
+ };
2988
3415
  sdk = async () => {
2989
3416
  if (this._sdk) {
2990
3417
  return this._sdk;
@@ -2999,8 +3426,8 @@ export class Module_ extends BaseClient {
2999
3426
  };
3000
3427
  /**
3001
3428
  * Serve a module's API in the current session.
3002
- * Note: this can only be called once per session.
3003
- * In the future, it could return a stream or service to remove the side effect.
3429
+ *
3430
+ * Note: this can only be called once per session. In the future, it could return a stream or service to remove the side effect.
3004
3431
  */
3005
3432
  serve = async () => {
3006
3433
  if (this._serve) {
@@ -3014,34 +3441,48 @@ export class Module_ extends BaseClient {
3014
3441
  ], await this._ctx.connection());
3015
3442
  return response;
3016
3443
  };
3444
+ source = () => {
3445
+ return new ModuleSource({
3446
+ queryTree: [
3447
+ ...this._queryTree,
3448
+ {
3449
+ operation: "source",
3450
+ },
3451
+ ],
3452
+ ctx: this._ctx,
3453
+ });
3454
+ };
3017
3455
  /**
3018
- * The directory containing the module's source code
3456
+ * Update the module configuration to use the given dependencies.
3457
+ * @param dependencies The dependency modules to install.
3019
3458
  */
3020
- sourceDirectory = () => {
3021
- return new Directory({
3459
+ withDependencies = (dependencies) => {
3460
+ return new Module_({
3022
3461
  queryTree: [
3023
3462
  ...this._queryTree,
3024
3463
  {
3025
- operation: "sourceDirectory",
3464
+ operation: "withDependencies",
3465
+ args: { dependencies },
3026
3466
  },
3027
3467
  ],
3028
3468
  ctx: this._ctx,
3029
3469
  });
3030
3470
  };
3031
3471
  /**
3032
- * The module's subpath within the source directory
3472
+ * Retrieves the module with the given description
3473
+ * @param description The description to set
3033
3474
  */
3034
- sourceDirectorySubPath = async () => {
3035
- if (this._sourceDirectorySubPath) {
3036
- return this._sourceDirectorySubPath;
3037
- }
3038
- const response = await computeQuery([
3039
- ...this._queryTree,
3040
- {
3041
- operation: "sourceDirectorySubPath",
3042
- },
3043
- ], await this._ctx.connection());
3044
- return response;
3475
+ withDescription = (description) => {
3476
+ return new Module_({
3477
+ queryTree: [
3478
+ ...this._queryTree,
3479
+ {
3480
+ operation: "withDescription",
3481
+ args: { description },
3482
+ },
3483
+ ],
3484
+ ctx: this._ctx,
3485
+ });
3045
3486
  };
3046
3487
  /**
3047
3488
  * This module plus the given Interface type and associated functions
@@ -3059,7 +3500,23 @@ export class Module_ extends BaseClient {
3059
3500
  });
3060
3501
  };
3061
3502
  /**
3062
- * This module plus the given Object type and associated functions
3503
+ * Update the module configuration to use the given name.
3504
+ * @param name The name to use.
3505
+ */
3506
+ withName = (name) => {
3507
+ return new Module_({
3508
+ queryTree: [
3509
+ ...this._queryTree,
3510
+ {
3511
+ operation: "withName",
3512
+ args: { name },
3513
+ },
3514
+ ],
3515
+ ctx: this._ctx,
3516
+ });
3517
+ };
3518
+ /**
3519
+ * This module plus the given Object type and associated functions.
3063
3520
  */
3064
3521
  withObject = (object) => {
3065
3522
  return new Module_({
@@ -3073,6 +3530,38 @@ export class Module_ extends BaseClient {
3073
3530
  ctx: this._ctx,
3074
3531
  });
3075
3532
  };
3533
+ /**
3534
+ * Update the module configuration to use the given SDK.
3535
+ * @param sdk The SDK to use.
3536
+ */
3537
+ withSDK = (sdk) => {
3538
+ return new Module_({
3539
+ queryTree: [
3540
+ ...this._queryTree,
3541
+ {
3542
+ operation: "withSDK",
3543
+ args: { sdk },
3544
+ },
3545
+ ],
3546
+ ctx: this._ctx,
3547
+ });
3548
+ };
3549
+ /**
3550
+ * Retrieves the module with basic configuration loaded if present.
3551
+ * @param source The module source to initialize from.
3552
+ */
3553
+ withSource = (source) => {
3554
+ return new Module_({
3555
+ queryTree: [
3556
+ ...this._queryTree,
3557
+ {
3558
+ operation: "withSource",
3559
+ args: { source },
3560
+ },
3561
+ ],
3562
+ ctx: this._ctx,
3563
+ });
3564
+ };
3076
3565
  /**
3077
3566
  * Call the provided function with current Module.
3078
3567
  *
@@ -3083,122 +3572,271 @@ export class Module_ extends BaseClient {
3083
3572
  };
3084
3573
  }
3085
3574
  /**
3086
- * Static configuration for a module (e.g. parsed contents of dagger.json)
3575
+ * The configuration of dependency of a module.
3087
3576
  */
3088
- export class ModuleConfig extends BaseClient {
3577
+ export class ModuleDependency extends BaseClient {
3578
+ _id = undefined;
3089
3579
  _name = undefined;
3090
- _root = undefined;
3091
- _sdk = undefined;
3092
3580
  /**
3093
3581
  * Constructor is used for internal usage only, do not create object from it.
3094
3582
  */
3095
- constructor(parent, _name, _root, _sdk) {
3583
+ constructor(parent, _id, _name) {
3096
3584
  super(parent);
3585
+ this._id = _id;
3097
3586
  this._name = _name;
3098
- this._root = _root;
3099
- this._sdk = _sdk;
3100
3587
  }
3101
3588
  /**
3102
- * Modules that this module depends on.
3589
+ * A unique identifier for this ModuleDependency.
3103
3590
  */
3104
- dependencies = async () => {
3591
+ id = async () => {
3592
+ if (this._id) {
3593
+ return this._id;
3594
+ }
3105
3595
  const response = await computeQuery([
3106
3596
  ...this._queryTree,
3107
3597
  {
3108
- operation: "dependencies",
3598
+ operation: "id",
3109
3599
  },
3110
3600
  ], await this._ctx.connection());
3111
3601
  return response;
3112
3602
  };
3113
- /**
3114
- * Exclude these file globs when loading the module root.
3115
- */
3116
- exclude = async () => {
3603
+ name = async () => {
3604
+ if (this._name) {
3605
+ return this._name;
3606
+ }
3117
3607
  const response = await computeQuery([
3118
3608
  ...this._queryTree,
3119
3609
  {
3120
- operation: "exclude",
3610
+ operation: "name",
3121
3611
  },
3122
3612
  ], await this._ctx.connection());
3123
3613
  return response;
3124
3614
  };
3615
+ source = () => {
3616
+ return new ModuleSource({
3617
+ queryTree: [
3618
+ ...this._queryTree,
3619
+ {
3620
+ operation: "source",
3621
+ },
3622
+ ],
3623
+ ctx: this._ctx,
3624
+ });
3625
+ };
3626
+ }
3627
+ /**
3628
+ * The source needed to load and run a module, along with any metadata about the source such as versions/urls/etc.
3629
+ */
3630
+ export class ModuleSource extends BaseClient {
3631
+ _id = undefined;
3632
+ _asString = undefined;
3633
+ _kind = undefined;
3634
+ _moduleName = undefined;
3635
+ _subpath = undefined;
3125
3636
  /**
3126
- * Include only these file globs when loading the module root.
3637
+ * Constructor is used for internal usage only, do not create object from it.
3127
3638
  */
3128
- include = async () => {
3129
- const response = await computeQuery([
3130
- ...this._queryTree,
3131
- {
3132
- operation: "include",
3133
- },
3134
- ], await this._ctx.connection());
3135
- return response;
3136
- };
3639
+ constructor(parent, _id, _asString, _kind, _moduleName, _subpath) {
3640
+ super(parent);
3641
+ this._id = _id;
3642
+ this._asString = _asString;
3643
+ this._kind = _kind;
3644
+ this._moduleName = _moduleName;
3645
+ this._subpath = _subpath;
3646
+ }
3137
3647
  /**
3138
- * The name of the module.
3648
+ * A unique identifier for this ModuleSource.
3139
3649
  */
3140
- name = async () => {
3141
- if (this._name) {
3142
- return this._name;
3650
+ id = async () => {
3651
+ if (this._id) {
3652
+ return this._id;
3143
3653
  }
3144
3654
  const response = await computeQuery([
3145
3655
  ...this._queryTree,
3146
3656
  {
3147
- operation: "name",
3657
+ operation: "id",
3148
3658
  },
3149
3659
  ], await this._ctx.connection());
3150
3660
  return response;
3151
3661
  };
3662
+ asGitSource = () => {
3663
+ return new GitModuleSource({
3664
+ queryTree: [
3665
+ ...this._queryTree,
3666
+ {
3667
+ operation: "asGitSource",
3668
+ },
3669
+ ],
3670
+ ctx: this._ctx,
3671
+ });
3672
+ };
3673
+ asLocalSource = () => {
3674
+ return new LocalModuleSource({
3675
+ queryTree: [
3676
+ ...this._queryTree,
3677
+ {
3678
+ operation: "asLocalSource",
3679
+ },
3680
+ ],
3681
+ ctx: this._ctx,
3682
+ });
3683
+ };
3684
+ /**
3685
+ * Load the source as a module. If this is a local source, the parent directory must have been provided during module source creation
3686
+ */
3687
+ asModule = () => {
3688
+ return new Module_({
3689
+ queryTree: [
3690
+ ...this._queryTree,
3691
+ {
3692
+ operation: "asModule",
3693
+ },
3694
+ ],
3695
+ ctx: this._ctx,
3696
+ });
3697
+ };
3152
3698
  /**
3153
- * The root directory of the module's project, which may be above the module source code.
3699
+ * A human readable ref string representation of this module source.
3154
3700
  */
3155
- root = async () => {
3156
- if (this._root) {
3157
- return this._root;
3701
+ asString = async () => {
3702
+ if (this._asString) {
3703
+ return this._asString;
3158
3704
  }
3159
3705
  const response = await computeQuery([
3160
3706
  ...this._queryTree,
3161
3707
  {
3162
- operation: "root",
3708
+ operation: "asString",
3163
3709
  },
3164
3710
  ], await this._ctx.connection());
3165
3711
  return response;
3166
3712
  };
3167
3713
  /**
3168
- * Either the name of a built-in SDK ('go', 'python', etc.) OR a module reference pointing to the SDK's module implementation.
3714
+ * The directory containing the actual module's source code, as determined from the root directory and subpath.
3715
+ * @param path The path from the source directory to select.
3169
3716
  */
3170
- sdk = async () => {
3171
- if (this._sdk) {
3172
- return this._sdk;
3717
+ directory = (path) => {
3718
+ return new Directory({
3719
+ queryTree: [
3720
+ ...this._queryTree,
3721
+ {
3722
+ operation: "directory",
3723
+ args: { path },
3724
+ },
3725
+ ],
3726
+ ctx: this._ctx,
3727
+ });
3728
+ };
3729
+ kind = async () => {
3730
+ if (this._kind) {
3731
+ return this._kind;
3173
3732
  }
3174
3733
  const response = await computeQuery([
3175
3734
  ...this._queryTree,
3176
3735
  {
3177
- operation: "sdk",
3736
+ operation: "kind",
3737
+ },
3738
+ ], await this._ctx.connection());
3739
+ return response;
3740
+ };
3741
+ /**
3742
+ * If set, the name of the module this source references
3743
+ */
3744
+ moduleName = async () => {
3745
+ if (this._moduleName) {
3746
+ return this._moduleName;
3747
+ }
3748
+ const response = await computeQuery([
3749
+ ...this._queryTree,
3750
+ {
3751
+ operation: "moduleName",
3752
+ },
3753
+ ], await this._ctx.connection());
3754
+ return response;
3755
+ };
3756
+ /**
3757
+ * Resolve the provided module source arg as a dependency relative to this module source.
3758
+ * @param dep The dependency module source to resolve.
3759
+ */
3760
+ resolveDependency = (dep) => {
3761
+ return new ModuleSource({
3762
+ queryTree: [
3763
+ ...this._queryTree,
3764
+ {
3765
+ operation: "resolveDependency",
3766
+ args: { dep },
3767
+ },
3768
+ ],
3769
+ ctx: this._ctx,
3770
+ });
3771
+ };
3772
+ rootDirectory = () => {
3773
+ return new Directory({
3774
+ queryTree: [
3775
+ ...this._queryTree,
3776
+ {
3777
+ operation: "rootDirectory",
3778
+ },
3779
+ ],
3780
+ ctx: this._ctx,
3781
+ });
3782
+ };
3783
+ /**
3784
+ * The path to the module subdirectory containing the actual module's source code.
3785
+ */
3786
+ subpath = async () => {
3787
+ if (this._subpath) {
3788
+ return this._subpath;
3789
+ }
3790
+ const response = await computeQuery([
3791
+ ...this._queryTree,
3792
+ {
3793
+ operation: "subpath",
3178
3794
  },
3179
3795
  ], await this._ctx.connection());
3180
3796
  return response;
3181
3797
  };
3798
+ /**
3799
+ * Call the provided function with current ModuleSource.
3800
+ *
3801
+ * This is useful for reusability and readability by not breaking the calling chain.
3802
+ */
3803
+ with = (arg) => {
3804
+ return arg(this);
3805
+ };
3182
3806
  }
3183
3807
  /**
3184
3808
  * A definition of a custom object defined in a Module.
3185
3809
  */
3186
3810
  export class ObjectTypeDef extends BaseClient {
3811
+ _id = undefined;
3187
3812
  _description = undefined;
3188
3813
  _name = undefined;
3189
3814
  _sourceModuleName = undefined;
3190
3815
  /**
3191
3816
  * Constructor is used for internal usage only, do not create object from it.
3192
3817
  */
3193
- constructor(parent, _description, _name, _sourceModuleName) {
3818
+ constructor(parent, _id, _description, _name, _sourceModuleName) {
3194
3819
  super(parent);
3820
+ this._id = _id;
3195
3821
  this._description = _description;
3196
3822
  this._name = _name;
3197
3823
  this._sourceModuleName = _sourceModuleName;
3198
3824
  }
3199
3825
  /**
3200
- * The function used to construct new instances of this object, if any
3826
+ * A unique identifier for this ObjectTypeDef.
3201
3827
  */
3828
+ id = async () => {
3829
+ if (this._id) {
3830
+ return this._id;
3831
+ }
3832
+ const response = await computeQuery([
3833
+ ...this._queryTree,
3834
+ {
3835
+ operation: "id",
3836
+ },
3837
+ ], await this._ctx.connection());
3838
+ return response;
3839
+ };
3202
3840
  constructor_ = () => {
3203
3841
  return new Function_({
3204
3842
  queryTree: [
@@ -3210,9 +3848,6 @@ export class ObjectTypeDef extends BaseClient {
3210
3848
  ctx: this._ctx,
3211
3849
  });
3212
3850
  };
3213
- /**
3214
- * The doc string for the object, if any
3215
- */
3216
3851
  description = async () => {
3217
3852
  if (this._description) {
3218
3853
  return this._description;
@@ -3225,9 +3860,6 @@ export class ObjectTypeDef extends BaseClient {
3225
3860
  ], await this._ctx.connection());
3226
3861
  return response;
3227
3862
  };
3228
- /**
3229
- * Static fields defined on this object, if any
3230
- */
3231
3863
  fields = async () => {
3232
3864
  const response = await computeQuery([
3233
3865
  ...this._queryTree,
@@ -3235,17 +3867,19 @@ export class ObjectTypeDef extends BaseClient {
3235
3867
  operation: "fields",
3236
3868
  },
3237
3869
  {
3238
- operation: "description name",
3870
+ operation: "id",
3239
3871
  },
3240
3872
  ], await this._ctx.connection());
3241
3873
  return response.map((r) => new FieldTypeDef({
3242
- queryTree: this.queryTree,
3874
+ queryTree: [
3875
+ {
3876
+ operation: "loadFieldTypeDefFromID",
3877
+ args: { id: r.id },
3878
+ },
3879
+ ],
3243
3880
  ctx: this._ctx,
3244
- }, r.description, r.name));
3881
+ }, r.id));
3245
3882
  };
3246
- /**
3247
- * Functions defined on this object, if any
3248
- */
3249
3883
  functions = async () => {
3250
3884
  const response = await computeQuery([
3251
3885
  ...this._queryTree,
@@ -3257,13 +3891,15 @@ export class ObjectTypeDef extends BaseClient {
3257
3891
  },
3258
3892
  ], await this._ctx.connection());
3259
3893
  return response.map((r) => new Function_({
3260
- queryTree: this.queryTree,
3894
+ queryTree: [
3895
+ {
3896
+ operation: "loadFunction_FromID",
3897
+ args: { id: r.id },
3898
+ },
3899
+ ],
3261
3900
  ctx: this._ctx,
3262
3901
  }, r.id));
3263
3902
  };
3264
- /**
3265
- * The name of the object
3266
- */
3267
3903
  name = async () => {
3268
3904
  if (this._name) {
3269
3905
  return this._name;
@@ -3276,9 +3912,6 @@ export class ObjectTypeDef extends BaseClient {
3276
3912
  ], await this._ctx.connection());
3277
3913
  return response;
3278
3914
  };
3279
- /**
3280
- * If this ObjectTypeDef is associated with a Module, the name of the module. Unset otherwise.
3281
- */
3282
3915
  sourceModuleName = async () => {
3283
3916
  if (this._sourceModuleName) {
3284
3917
  return this._sourceModuleName;
@@ -3296,21 +3929,37 @@ export class ObjectTypeDef extends BaseClient {
3296
3929
  * A port exposed by a container.
3297
3930
  */
3298
3931
  export class Port extends BaseClient {
3932
+ _id = undefined;
3299
3933
  _description = undefined;
3934
+ _experimentalSkipHealthcheck = undefined;
3300
3935
  _port = undefined;
3301
3936
  _protocol = undefined;
3302
3937
  /**
3303
3938
  * Constructor is used for internal usage only, do not create object from it.
3304
3939
  */
3305
- constructor(parent, _description, _port, _protocol) {
3940
+ constructor(parent, _id, _description, _experimentalSkipHealthcheck, _port, _protocol) {
3306
3941
  super(parent);
3942
+ this._id = _id;
3307
3943
  this._description = _description;
3944
+ this._experimentalSkipHealthcheck = _experimentalSkipHealthcheck;
3308
3945
  this._port = _port;
3309
3946
  this._protocol = _protocol;
3310
3947
  }
3311
3948
  /**
3312
- * The port description.
3949
+ * A unique identifier for this Port.
3313
3950
  */
3951
+ id = async () => {
3952
+ if (this._id) {
3953
+ return this._id;
3954
+ }
3955
+ const response = await computeQuery([
3956
+ ...this._queryTree,
3957
+ {
3958
+ operation: "id",
3959
+ },
3960
+ ], await this._ctx.connection());
3961
+ return response;
3962
+ };
3314
3963
  description = async () => {
3315
3964
  if (this._description) {
3316
3965
  return this._description;
@@ -3323,9 +3972,18 @@ export class Port extends BaseClient {
3323
3972
  ], await this._ctx.connection());
3324
3973
  return response;
3325
3974
  };
3326
- /**
3327
- * The port number.
3328
- */
3975
+ experimentalSkipHealthcheck = async () => {
3976
+ if (this._experimentalSkipHealthcheck) {
3977
+ return this._experimentalSkipHealthcheck;
3978
+ }
3979
+ const response = await computeQuery([
3980
+ ...this._queryTree,
3981
+ {
3982
+ operation: "experimentalSkipHealthcheck",
3983
+ },
3984
+ ], await this._ctx.connection());
3985
+ return response;
3986
+ };
3329
3987
  port = async () => {
3330
3988
  if (this._port) {
3331
3989
  return this._port;
@@ -3338,9 +3996,6 @@ export class Port extends BaseClient {
3338
3996
  ], await this._ctx.connection());
3339
3997
  return response;
3340
3998
  };
3341
- /**
3342
- * The transport layer network protocol.
3343
- */
3344
3999
  protocol = async () => {
3345
4000
  if (this._protocol) {
3346
4001
  return this._protocol;
@@ -3354,6 +4009,9 @@ export class Port extends BaseClient {
3354
4009
  return response;
3355
4010
  };
3356
4011
  }
4012
+ /**
4013
+ * The root of the DAG.
4014
+ */
3357
4015
  export class Client extends BaseClient {
3358
4016
  _checkVersionCompatibility = undefined;
3359
4017
  _defaultPlatform = undefined;
@@ -3365,6 +4023,25 @@ export class Client extends BaseClient {
3365
4023
  this._checkVersionCompatibility = _checkVersionCompatibility;
3366
4024
  this._defaultPlatform = _defaultPlatform;
3367
4025
  }
4026
+ /**
4027
+ * Retrieves a content-addressed blob.
4028
+ * @param digest Digest of the blob
4029
+ * @param size Size of the blob
4030
+ * @param mediaType Media type of the blob
4031
+ * @param uncompressed Digest of the uncompressed blob
4032
+ */
4033
+ blob = (digest, size, mediaType, uncompressed) => {
4034
+ return new Directory({
4035
+ queryTree: [
4036
+ ...this._queryTree,
4037
+ {
4038
+ operation: "blob",
4039
+ args: { digest, size, mediaType, uncompressed },
4040
+ },
4041
+ ],
4042
+ ctx: this._ctx,
4043
+ });
4044
+ };
3368
4045
  /**
3369
4046
  * Constructs a cache volume for a given cache key.
3370
4047
  * @param key A string identifier to target this cache volume (e.g., "modules-cache").
@@ -3383,7 +4060,7 @@ export class Client extends BaseClient {
3383
4060
  };
3384
4061
  /**
3385
4062
  * Checks if the current Dagger Engine is compatible with an SDK's required version.
3386
- * @param version The SDK's required version.
4063
+ * @param version Version required by the SDK.
3387
4064
  */
3388
4065
  checkVersionCompatibility = async (version) => {
3389
4066
  const response = await computeQuery([
@@ -3396,108 +4073,366 @@ export class Client extends BaseClient {
3396
4073
  return response;
3397
4074
  };
3398
4075
  /**
3399
- * Creates a scratch container or loads one by ID.
4076
+ * Creates a scratch container.
4077
+ *
4078
+ * Optional platform argument initializes new containers to execute and publish as that platform. Platform defaults to that of the builder's host.
4079
+ * @param opts.id DEPRECATED: Use `loadContainerFromID` instead.
4080
+ * @param opts.platform Platform to initialize the container with.
4081
+ */
4082
+ container = (opts) => {
4083
+ return new Container({
4084
+ queryTree: [
4085
+ ...this._queryTree,
4086
+ {
4087
+ operation: "container",
4088
+ args: { ...opts },
4089
+ },
4090
+ ],
4091
+ ctx: this._ctx,
4092
+ });
4093
+ };
4094
+ /**
4095
+ * The FunctionCall context that the SDK caller is currently executing in.
4096
+ *
4097
+ * If the caller is not currently executing in a function, this will return an error.
4098
+ */
4099
+ currentFunctionCall = () => {
4100
+ return new FunctionCall({
4101
+ queryTree: [
4102
+ ...this._queryTree,
4103
+ {
4104
+ operation: "currentFunctionCall",
4105
+ },
4106
+ ],
4107
+ ctx: this._ctx,
4108
+ });
4109
+ };
4110
+ /**
4111
+ * The module currently being served in the session, if any.
4112
+ */
4113
+ currentModule = () => {
4114
+ return new CurrentModule({
4115
+ queryTree: [
4116
+ ...this._queryTree,
4117
+ {
4118
+ operation: "currentModule",
4119
+ },
4120
+ ],
4121
+ ctx: this._ctx,
4122
+ });
4123
+ };
4124
+ /**
4125
+ * The TypeDef representations of the objects currently being served in the session.
4126
+ */
4127
+ currentTypeDefs = async () => {
4128
+ const response = await computeQuery([
4129
+ ...this._queryTree,
4130
+ {
4131
+ operation: "currentTypeDefs",
4132
+ },
4133
+ {
4134
+ operation: "id",
4135
+ },
4136
+ ], await this._ctx.connection());
4137
+ return response.map((r) => new TypeDef({
4138
+ queryTree: [
4139
+ {
4140
+ operation: "loadTypeDefFromID",
4141
+ args: { id: r.id },
4142
+ },
4143
+ ],
4144
+ ctx: this._ctx,
4145
+ }, r.id));
4146
+ };
4147
+ /**
4148
+ * The default platform of the engine.
4149
+ */
4150
+ defaultPlatform = async () => {
4151
+ const response = await computeQuery([
4152
+ ...this._queryTree,
4153
+ {
4154
+ operation: "defaultPlatform",
4155
+ },
4156
+ ], await this._ctx.connection());
4157
+ return response;
4158
+ };
4159
+ /**
4160
+ * Creates an empty directory.
4161
+ * @param opts.id DEPRECATED: Use `loadDirectoryFromID` isntead.
4162
+ */
4163
+ directory = (opts) => {
4164
+ return new Directory({
4165
+ queryTree: [
4166
+ ...this._queryTree,
4167
+ {
4168
+ operation: "directory",
4169
+ args: { ...opts },
4170
+ },
4171
+ ],
4172
+ ctx: this._ctx,
4173
+ });
4174
+ };
4175
+ /**
4176
+ * @deprecated Use loadFileFromID instead.
4177
+ */
4178
+ file = (id) => {
4179
+ return new File({
4180
+ queryTree: [
4181
+ ...this._queryTree,
4182
+ {
4183
+ operation: "file",
4184
+ args: { id },
4185
+ },
4186
+ ],
4187
+ ctx: this._ctx,
4188
+ });
4189
+ };
4190
+ /**
4191
+ * Creates a function.
4192
+ * @param name Name of the function, in its original format from the implementation language.
4193
+ * @param returnType Return type of the function.
4194
+ */
4195
+ function_ = (name, returnType) => {
4196
+ return new Function_({
4197
+ queryTree: [
4198
+ ...this._queryTree,
4199
+ {
4200
+ operation: "function",
4201
+ args: { name, returnType },
4202
+ },
4203
+ ],
4204
+ ctx: this._ctx,
4205
+ });
4206
+ };
4207
+ /**
4208
+ * Create a code generation result, given a directory containing the generated code.
4209
+ */
4210
+ generatedCode = (code) => {
4211
+ return new GeneratedCode({
4212
+ queryTree: [
4213
+ ...this._queryTree,
4214
+ {
4215
+ operation: "generatedCode",
4216
+ args: { code },
4217
+ },
4218
+ ],
4219
+ ctx: this._ctx,
4220
+ });
4221
+ };
4222
+ /**
4223
+ * Queries a Git repository.
4224
+ * @param url URL of the git repository.
4225
+ *
4226
+ * Can be formatted as `https://{host}/{owner}/{repo}`, `git@{host}:{owner}/{repo}`.
3400
4227
  *
3401
- * Optional platform argument initializes new containers to execute and publish
3402
- * as that platform. Platform defaults to that of the builder's host.
4228
+ * Suffix ".git" is optional.
4229
+ * @param opts.keepGitDir Set to true to keep .git directory.
4230
+ * @param opts.experimentalServiceHost A service which must be started before the repo is fetched.
4231
+ * @param opts.sshKnownHosts Set SSH known hosts
4232
+ * @param opts.sshAuthSocket Set SSH auth socket
4233
+ */
4234
+ git = (url, opts) => {
4235
+ return new GitRepository({
4236
+ queryTree: [
4237
+ ...this._queryTree,
4238
+ {
4239
+ operation: "git",
4240
+ args: { url, ...opts },
4241
+ },
4242
+ ],
4243
+ ctx: this._ctx,
4244
+ });
4245
+ };
4246
+ /**
4247
+ * Queries the host environment.
4248
+ */
4249
+ host = () => {
4250
+ return new Host({
4251
+ queryTree: [
4252
+ ...this._queryTree,
4253
+ {
4254
+ operation: "host",
4255
+ },
4256
+ ],
4257
+ ctx: this._ctx,
4258
+ });
4259
+ };
4260
+ /**
4261
+ * Returns a file containing an http remote url content.
4262
+ * @param url HTTP url to get the content from (e.g., "https://docs.dagger.io").
4263
+ * @param opts.experimentalServiceHost A service which must be started before the URL is fetched.
4264
+ */
4265
+ http = (url, opts) => {
4266
+ return new File({
4267
+ queryTree: [
4268
+ ...this._queryTree,
4269
+ {
4270
+ operation: "http",
4271
+ args: { url, ...opts },
4272
+ },
4273
+ ],
4274
+ ctx: this._ctx,
4275
+ });
4276
+ };
4277
+ /**
4278
+ * Load a CacheVolume from its ID.
4279
+ */
4280
+ loadCacheVolumeFromID = (id) => {
4281
+ return new CacheVolume({
4282
+ queryTree: [
4283
+ ...this._queryTree,
4284
+ {
4285
+ operation: "loadCacheVolumeFromID",
4286
+ args: { id },
4287
+ },
4288
+ ],
4289
+ ctx: this._ctx,
4290
+ });
4291
+ };
4292
+ /**
4293
+ * Load a Container from its ID.
4294
+ */
4295
+ loadContainerFromID = (id) => {
4296
+ return new Container({
4297
+ queryTree: [
4298
+ ...this._queryTree,
4299
+ {
4300
+ operation: "loadContainerFromID",
4301
+ args: { id },
4302
+ },
4303
+ ],
4304
+ ctx: this._ctx,
4305
+ });
4306
+ };
4307
+ /**
4308
+ * Load a CurrentModule from its ID.
4309
+ */
4310
+ loadCurrentModuleFromID = (id) => {
4311
+ return new CurrentModule({
4312
+ queryTree: [
4313
+ ...this._queryTree,
4314
+ {
4315
+ operation: "loadCurrentModuleFromID",
4316
+ args: { id },
4317
+ },
4318
+ ],
4319
+ ctx: this._ctx,
4320
+ });
4321
+ };
4322
+ /**
4323
+ * Load a Directory from its ID.
4324
+ */
4325
+ loadDirectoryFromID = (id) => {
4326
+ return new Directory({
4327
+ queryTree: [
4328
+ ...this._queryTree,
4329
+ {
4330
+ operation: "loadDirectoryFromID",
4331
+ args: { id },
4332
+ },
4333
+ ],
4334
+ ctx: this._ctx,
4335
+ });
4336
+ };
4337
+ /**
4338
+ * Load a EnvVariable from its ID.
3403
4339
  */
3404
- container = (opts) => {
3405
- return new Container({
4340
+ loadEnvVariableFromID = (id) => {
4341
+ return new EnvVariable({
3406
4342
  queryTree: [
3407
4343
  ...this._queryTree,
3408
4344
  {
3409
- operation: "container",
3410
- args: { ...opts },
4345
+ operation: "loadEnvVariableFromID",
4346
+ args: { id },
3411
4347
  },
3412
4348
  ],
3413
4349
  ctx: this._ctx,
3414
4350
  });
3415
4351
  };
3416
4352
  /**
3417
- * The FunctionCall context that the SDK caller is currently executing in.
3418
- * If the caller is not currently executing in a function, this will return
3419
- * an error.
4353
+ * Load a FieldTypeDef from its ID.
3420
4354
  */
3421
- currentFunctionCall = () => {
3422
- return new FunctionCall({
4355
+ loadFieldTypeDefFromID = (id) => {
4356
+ return new FieldTypeDef({
3423
4357
  queryTree: [
3424
4358
  ...this._queryTree,
3425
4359
  {
3426
- operation: "currentFunctionCall",
4360
+ operation: "loadFieldTypeDefFromID",
4361
+ args: { id },
3427
4362
  },
3428
4363
  ],
3429
4364
  ctx: this._ctx,
3430
4365
  });
3431
4366
  };
3432
4367
  /**
3433
- * The module currently being served in the session, if any.
4368
+ * Load a File from its ID.
3434
4369
  */
3435
- currentModule = () => {
3436
- return new Module_({
4370
+ loadFileFromID = (id) => {
4371
+ return new File({
3437
4372
  queryTree: [
3438
4373
  ...this._queryTree,
3439
4374
  {
3440
- operation: "currentModule",
4375
+ operation: "loadFileFromID",
4376
+ args: { id },
3441
4377
  },
3442
4378
  ],
3443
4379
  ctx: this._ctx,
3444
4380
  });
3445
4381
  };
3446
4382
  /**
3447
- * The TypeDef representations of the objects currently being served in the session.
4383
+ * Load a FunctionArg from its ID.
3448
4384
  */
3449
- currentTypeDefs = async () => {
3450
- const response = await computeQuery([
3451
- ...this._queryTree,
3452
- {
3453
- operation: "currentTypeDefs",
3454
- },
3455
- {
3456
- operation: "id",
3457
- },
3458
- ], await this._ctx.connection());
3459
- return response.map((r) => new TypeDef({
3460
- queryTree: this.queryTree,
4385
+ loadFunctionArgFromID = (id) => {
4386
+ return new FunctionArg({
4387
+ queryTree: [
4388
+ ...this._queryTree,
4389
+ {
4390
+ operation: "loadFunctionArgFromID",
4391
+ args: { id },
4392
+ },
4393
+ ],
3461
4394
  ctx: this._ctx,
3462
- }, r.id));
4395
+ });
3463
4396
  };
3464
4397
  /**
3465
- * The default platform of the builder.
4398
+ * Load a FunctionCallArgValue from its ID.
3466
4399
  */
3467
- defaultPlatform = async () => {
3468
- const response = await computeQuery([
3469
- ...this._queryTree,
3470
- {
3471
- operation: "defaultPlatform",
3472
- },
3473
- ], await this._ctx.connection());
3474
- return response;
4400
+ loadFunctionCallArgValueFromID = (id) => {
4401
+ return new FunctionCallArgValue({
4402
+ queryTree: [
4403
+ ...this._queryTree,
4404
+ {
4405
+ operation: "loadFunctionCallArgValueFromID",
4406
+ args: { id },
4407
+ },
4408
+ ],
4409
+ ctx: this._ctx,
4410
+ });
3475
4411
  };
3476
4412
  /**
3477
- * Creates an empty directory or loads one by ID.
4413
+ * Load a FunctionCall from its ID.
3478
4414
  */
3479
- directory = (opts) => {
3480
- return new Directory({
4415
+ loadFunctionCallFromID = (id) => {
4416
+ return new FunctionCall({
3481
4417
  queryTree: [
3482
4418
  ...this._queryTree,
3483
4419
  {
3484
- operation: "directory",
3485
- args: { ...opts },
4420
+ operation: "loadFunctionCallFromID",
4421
+ args: { id },
3486
4422
  },
3487
4423
  ],
3488
4424
  ctx: this._ctx,
3489
4425
  });
3490
4426
  };
3491
4427
  /**
3492
- * Loads a file by ID.
3493
- * @deprecated Use loadFileFromID instead.
4428
+ * Load a Function from its ID.
3494
4429
  */
3495
- file = (id) => {
3496
- return new File({
4430
+ loadFunctionFromID = (id) => {
4431
+ return new Function_({
3497
4432
  queryTree: [
3498
4433
  ...this._queryTree,
3499
4434
  {
3500
- operation: "file",
4435
+ operation: "loadFunctionFromID",
3501
4436
  args: { id },
3502
4437
  },
3503
4438
  ],
@@ -3505,98 +4440,89 @@ export class Client extends BaseClient {
3505
4440
  });
3506
4441
  };
3507
4442
  /**
3508
- * Create a function.
4443
+ * Load a GeneratedCode from its ID.
3509
4444
  */
3510
- function_ = (name, returnType) => {
3511
- return new Function_({
4445
+ loadGeneratedCodeFromID = (id) => {
4446
+ return new GeneratedCode({
3512
4447
  queryTree: [
3513
4448
  ...this._queryTree,
3514
4449
  {
3515
- operation: "function",
3516
- args: { name, returnType },
4450
+ operation: "loadGeneratedCodeFromID",
4451
+ args: { id },
3517
4452
  },
3518
4453
  ],
3519
4454
  ctx: this._ctx,
3520
4455
  });
3521
4456
  };
3522
4457
  /**
3523
- * Create a code generation result, given a directory containing the generated
3524
- * code.
4458
+ * Load a GitModuleSource from its ID.
3525
4459
  */
3526
- generatedCode = (code) => {
3527
- return new GeneratedCode({
4460
+ loadGitModuleSourceFromID = (id) => {
4461
+ return new GitModuleSource({
3528
4462
  queryTree: [
3529
4463
  ...this._queryTree,
3530
4464
  {
3531
- operation: "generatedCode",
3532
- args: { code },
4465
+ operation: "loadGitModuleSourceFromID",
4466
+ args: { id },
3533
4467
  },
3534
4468
  ],
3535
4469
  ctx: this._ctx,
3536
4470
  });
3537
4471
  };
3538
4472
  /**
3539
- * Queries a git repository.
3540
- * @param url Url of the git repository.
3541
- * Can be formatted as `https://{host}/{owner}/{repo}`, `git@{host}:{owner}/{repo}`
3542
- * Suffix ".git" is optional.
3543
- * @param opts.keepGitDir Set to true to keep .git directory.
3544
- * @param opts.sshKnownHosts Set SSH known hosts
3545
- * @param opts.sshAuthSocket Set SSH auth socket
3546
- * @param opts.experimentalServiceHost A service which must be started before the repo is fetched.
4473
+ * Load a GitRef from its ID.
3547
4474
  */
3548
- git = (url, opts) => {
3549
- return new GitRepository({
4475
+ loadGitRefFromID = (id) => {
4476
+ return new GitRef({
3550
4477
  queryTree: [
3551
4478
  ...this._queryTree,
3552
4479
  {
3553
- operation: "git",
3554
- args: { url, ...opts },
4480
+ operation: "loadGitRefFromID",
4481
+ args: { id },
3555
4482
  },
3556
4483
  ],
3557
4484
  ctx: this._ctx,
3558
4485
  });
3559
4486
  };
3560
4487
  /**
3561
- * Queries the host environment.
4488
+ * Load a GitRepository from its ID.
3562
4489
  */
3563
- host = () => {
3564
- return new Host({
4490
+ loadGitRepositoryFromID = (id) => {
4491
+ return new GitRepository({
3565
4492
  queryTree: [
3566
4493
  ...this._queryTree,
3567
4494
  {
3568
- operation: "host",
4495
+ operation: "loadGitRepositoryFromID",
4496
+ args: { id },
3569
4497
  },
3570
4498
  ],
3571
4499
  ctx: this._ctx,
3572
4500
  });
3573
4501
  };
3574
4502
  /**
3575
- * Returns a file containing an http remote url content.
3576
- * @param url HTTP url to get the content from (e.g., "https://docs.dagger.io").
3577
- * @param opts.experimentalServiceHost A service which must be started before the URL is fetched.
4503
+ * Load a Host from its ID.
3578
4504
  */
3579
- http = (url, opts) => {
3580
- return new File({
4505
+ loadHostFromID = (id) => {
4506
+ return new Host({
3581
4507
  queryTree: [
3582
4508
  ...this._queryTree,
3583
4509
  {
3584
- operation: "http",
3585
- args: { url, ...opts },
4510
+ operation: "loadHostFromID",
4511
+ args: { id },
3586
4512
  },
3587
4513
  ],
3588
4514
  ctx: this._ctx,
3589
4515
  });
3590
4516
  };
3591
4517
  /**
3592
- * Load a CacheVolume from its ID.
4518
+ * Load a InputTypeDef from its ID.
3593
4519
  */
3594
- loadCacheVolumeFromID = (id) => {
3595
- return new CacheVolume({
4520
+ loadInputTypeDefFromID = (id) => {
4521
+ return new InputTypeDef({
3596
4522
  queryTree: [
3597
4523
  ...this._queryTree,
3598
4524
  {
3599
- operation: "loadCacheVolumeFromID",
4525
+ operation: "loadInputTypeDefFromID",
3600
4526
  args: { id },
3601
4527
  },
3602
4528
  ],
@@ -3604,14 +4530,14 @@ export class Client extends BaseClient {
3604
4530
  });
3605
4531
  };
3606
4532
  /**
3607
- * Loads a container from an ID.
4533
+ * Load a InterfaceTypeDef from its ID.
3608
4534
  */
3609
- loadContainerFromID = (id) => {
3610
- return new Container({
4535
+ loadInterfaceTypeDefFromID = (id) => {
4536
+ return new InterfaceTypeDef({
3611
4537
  queryTree: [
3612
4538
  ...this._queryTree,
3613
4539
  {
3614
- operation: "loadContainerFromID",
4540
+ operation: "loadInterfaceTypeDefFromID",
3615
4541
  args: { id },
3616
4542
  },
3617
4543
  ],
@@ -3619,14 +4545,14 @@ export class Client extends BaseClient {
3619
4545
  });
3620
4546
  };
3621
4547
  /**
3622
- * Load a Directory from its ID.
4548
+ * Load a Label from its ID.
3623
4549
  */
3624
- loadDirectoryFromID = (id) => {
3625
- return new Directory({
4550
+ loadLabelFromID = (id) => {
4551
+ return new Label({
3626
4552
  queryTree: [
3627
4553
  ...this._queryTree,
3628
4554
  {
3629
- operation: "loadDirectoryFromID",
4555
+ operation: "loadLabelFromID",
3630
4556
  args: { id },
3631
4557
  },
3632
4558
  ],
@@ -3634,14 +4560,14 @@ export class Client extends BaseClient {
3634
4560
  });
3635
4561
  };
3636
4562
  /**
3637
- * Load a File from its ID.
4563
+ * Load a ListTypeDef from its ID.
3638
4564
  */
3639
- loadFileFromID = (id) => {
3640
- return new File({
4565
+ loadListTypeDefFromID = (id) => {
4566
+ return new ListTypeDef({
3641
4567
  queryTree: [
3642
4568
  ...this._queryTree,
3643
4569
  {
3644
- operation: "loadFileFromID",
4570
+ operation: "loadListTypeDefFromID",
3645
4571
  args: { id },
3646
4572
  },
3647
4573
  ],
@@ -3649,14 +4575,14 @@ export class Client extends BaseClient {
3649
4575
  });
3650
4576
  };
3651
4577
  /**
3652
- * Load a function argument by ID.
4578
+ * Load a LocalModuleSource from its ID.
3653
4579
  */
3654
- loadFunctionArgFromID = (id) => {
3655
- return new FunctionArg({
4580
+ loadLocalModuleSourceFromID = (id) => {
4581
+ return new LocalModuleSource({
3656
4582
  queryTree: [
3657
4583
  ...this._queryTree,
3658
4584
  {
3659
- operation: "loadFunctionArgFromID",
4585
+ operation: "loadLocalModuleSourceFromID",
3660
4586
  args: { id },
3661
4587
  },
3662
4588
  ],
@@ -3664,14 +4590,14 @@ export class Client extends BaseClient {
3664
4590
  });
3665
4591
  };
3666
4592
  /**
3667
- * Load a function by ID.
4593
+ * Load a ModuleDependency from its ID.
3668
4594
  */
3669
- loadFunctionFromID = (id) => {
3670
- return new Function_({
4595
+ loadModuleDependencyFromID = (id) => {
4596
+ return new ModuleDependency({
3671
4597
  queryTree: [
3672
4598
  ...this._queryTree,
3673
4599
  {
3674
- operation: "loadFunctionFromID",
4600
+ operation: "loadModuleDependencyFromID",
3675
4601
  args: { id },
3676
4602
  },
3677
4603
  ],
@@ -3679,14 +4605,14 @@ export class Client extends BaseClient {
3679
4605
  });
3680
4606
  };
3681
4607
  /**
3682
- * Load a GeneratedCode by ID.
4608
+ * Load a Module from its ID.
3683
4609
  */
3684
- loadGeneratedCodeFromID = (id) => {
3685
- return new GeneratedCode({
4610
+ loadModuleFromID = (id) => {
4611
+ return new Module_({
3686
4612
  queryTree: [
3687
4613
  ...this._queryTree,
3688
4614
  {
3689
- operation: "loadGeneratedCodeFromID",
4615
+ operation: "loadModuleFromID",
3690
4616
  args: { id },
3691
4617
  },
3692
4618
  ],
@@ -3694,14 +4620,14 @@ export class Client extends BaseClient {
3694
4620
  });
3695
4621
  };
3696
4622
  /**
3697
- * Load a git ref from its ID.
4623
+ * Load a ModuleSource from its ID.
3698
4624
  */
3699
- loadGitRefFromID = (id) => {
3700
- return new GitRef({
4625
+ loadModuleSourceFromID = (id) => {
4626
+ return new ModuleSource({
3701
4627
  queryTree: [
3702
4628
  ...this._queryTree,
3703
4629
  {
3704
- operation: "loadGitRefFromID",
4630
+ operation: "loadModuleSourceFromID",
3705
4631
  args: { id },
3706
4632
  },
3707
4633
  ],
@@ -3709,14 +4635,14 @@ export class Client extends BaseClient {
3709
4635
  });
3710
4636
  };
3711
4637
  /**
3712
- * Load a git repository from its ID.
4638
+ * Load a ObjectTypeDef from its ID.
3713
4639
  */
3714
- loadGitRepositoryFromID = (id) => {
3715
- return new GitRepository({
4640
+ loadObjectTypeDefFromID = (id) => {
4641
+ return new ObjectTypeDef({
3716
4642
  queryTree: [
3717
4643
  ...this._queryTree,
3718
4644
  {
3719
- operation: "loadGitRepositoryFromID",
4645
+ operation: "loadObjectTypeDefFromID",
3720
4646
  args: { id },
3721
4647
  },
3722
4648
  ],
@@ -3724,14 +4650,14 @@ export class Client extends BaseClient {
3724
4650
  });
3725
4651
  };
3726
4652
  /**
3727
- * Load a module by ID.
4653
+ * Load a Port from its ID.
3728
4654
  */
3729
- loadModuleFromID = (id) => {
3730
- return new Module_({
4655
+ loadPortFromID = (id) => {
4656
+ return new Port({
3731
4657
  queryTree: [
3732
4658
  ...this._queryTree,
3733
4659
  {
3734
- operation: "loadModuleFromID",
4660
+ operation: "loadPortFromID",
3735
4661
  args: { id },
3736
4662
  },
3737
4663
  ],
@@ -3754,7 +4680,7 @@ export class Client extends BaseClient {
3754
4680
  });
3755
4681
  };
3756
4682
  /**
3757
- * Loads a service from ID.
4683
+ * Load a Service from its ID.
3758
4684
  */
3759
4685
  loadServiceFromID = (id) => {
3760
4686
  return new Service({
@@ -3784,7 +4710,22 @@ export class Client extends BaseClient {
3784
4710
  });
3785
4711
  };
3786
4712
  /**
3787
- * Load a TypeDef by ID.
4713
+ * Load a Terminal from its ID.
4714
+ */
4715
+ loadTerminalFromID = (id) => {
4716
+ return new Terminal({
4717
+ queryTree: [
4718
+ ...this._queryTree,
4719
+ {
4720
+ operation: "loadTerminalFromID",
4721
+ args: { id },
4722
+ },
4723
+ ],
4724
+ ctx: this._ctx,
4725
+ });
4726
+ };
4727
+ /**
4728
+ * Load a TypeDef from its ID.
3788
4729
  */
3789
4730
  loadTypeDefFromID = (id) => {
3790
4731
  return new TypeDef({
@@ -3813,15 +4754,35 @@ export class Client extends BaseClient {
3813
4754
  });
3814
4755
  };
3815
4756
  /**
3816
- * Load the static configuration for a module from the given source directory and optional subpath.
4757
+ * Create a new module dependency configuration from a module source and name
4758
+ * @param source The source of the dependency
4759
+ * @param opts.name If set, the name to use for the dependency. Otherwise, once installed to a parent module, the name of the dependency module will be used by default.
4760
+ */
4761
+ moduleDependency = (source, opts) => {
4762
+ return new ModuleDependency({
4763
+ queryTree: [
4764
+ ...this._queryTree,
4765
+ {
4766
+ operation: "moduleDependency",
4767
+ args: { source, ...opts },
4768
+ },
4769
+ ],
4770
+ ctx: this._ctx,
4771
+ });
4772
+ };
4773
+ /**
4774
+ * Create a new module source instance from a source ref string.
4775
+ * @param refString The string ref representation of the module source
4776
+ * @param opts.rootDirectory An explicitly set root directory for the module source. This is required to load local sources as modules; other source types implicitly encode the root directory and do not require this.
4777
+ * @param opts.stable If true, enforce that the source is a stable version for source kinds that support versioning.
3817
4778
  */
3818
- moduleConfig = (sourceDirectory, opts) => {
3819
- return new ModuleConfig({
4779
+ moduleSource = (refString, opts) => {
4780
+ return new ModuleSource({
3820
4781
  queryTree: [
3821
4782
  ...this._queryTree,
3822
4783
  {
3823
- operation: "moduleConfig",
3824
- args: { sourceDirectory, ...opts },
4784
+ operation: "moduleSource",
4785
+ args: { refString, ...opts },
3825
4786
  },
3826
4787
  ],
3827
4788
  ctx: this._ctx,
@@ -3829,9 +4790,9 @@ export class Client extends BaseClient {
3829
4790
  };
3830
4791
  /**
3831
4792
  * Creates a named sub-pipeline.
3832
- * @param name Pipeline name.
3833
- * @param opts.description Pipeline description.
3834
- * @param opts.labels Pipeline labels.
4793
+ * @param name Name of the sub-pipeline.
4794
+ * @param opts.description Description of the sub-pipeline.
4795
+ * @param opts.labels Labels to apply to the sub-pipeline.
3835
4796
  */
3836
4797
  pipeline = (name, opts) => {
3837
4798
  return new Client({
@@ -3846,16 +4807,15 @@ export class Client extends BaseClient {
3846
4807
  });
3847
4808
  };
3848
4809
  /**
3849
- * Loads a secret from its ID.
3850
- * @deprecated Use loadSecretFromID instead
4810
+ * Reference a secret by name.
3851
4811
  */
3852
- secret = (id) => {
4812
+ secret = (name) => {
3853
4813
  return new Secret({
3854
4814
  queryTree: [
3855
4815
  ...this._queryTree,
3856
4816
  {
3857
4817
  operation: "secret",
3858
- args: { id },
4818
+ args: { name },
3859
4819
  },
3860
4820
  ],
3861
4821
  ctx: this._ctx,
@@ -3863,6 +4823,7 @@ export class Client extends BaseClient {
3863
4823
  };
3864
4824
  /**
3865
4825
  * Sets a secret given a user defined name to its plaintext and returns the secret.
4826
+ *
3866
4827
  * The plaintext value is limited to a size of 128000 bytes.
3867
4828
  * @param name The user defined name for this secret
3868
4829
  * @param plaintext The plaintext of the secret
@@ -3883,13 +4844,13 @@ export class Client extends BaseClient {
3883
4844
  * Loads a socket by its ID.
3884
4845
  * @deprecated Use loadSocketFromID instead.
3885
4846
  */
3886
- socket = (opts) => {
4847
+ socket = (id) => {
3887
4848
  return new Socket({
3888
4849
  queryTree: [
3889
4850
  ...this._queryTree,
3890
4851
  {
3891
4852
  operation: "socket",
3892
- args: { ...opts },
4853
+ args: { id },
3893
4854
  },
3894
4855
  ],
3895
4856
  ctx: this._ctx,
@@ -3933,7 +4894,7 @@ export class Secret extends BaseClient {
3933
4894
  this._plaintext = _plaintext;
3934
4895
  }
3935
4896
  /**
3936
- * The identifier for this secret.
4897
+ * A unique identifier for this Secret.
3937
4898
  */
3938
4899
  id = async () => {
3939
4900
  if (this._id) {
@@ -3963,25 +4924,30 @@ export class Secret extends BaseClient {
3963
4924
  return response;
3964
4925
  };
3965
4926
  }
4927
+ /**
4928
+ * A content-addressed service providing TCP connectivity.
4929
+ */
3966
4930
  export class Service extends BaseClient {
3967
4931
  _id = undefined;
3968
4932
  _endpoint = undefined;
3969
4933
  _hostname = undefined;
3970
4934
  _start = undefined;
3971
4935
  _stop = undefined;
4936
+ _up = undefined;
3972
4937
  /**
3973
4938
  * Constructor is used for internal usage only, do not create object from it.
3974
4939
  */
3975
- constructor(parent, _id, _endpoint, _hostname, _start, _stop) {
4940
+ constructor(parent, _id, _endpoint, _hostname, _start, _stop, _up) {
3976
4941
  super(parent);
3977
4942
  this._id = _id;
3978
4943
  this._endpoint = _endpoint;
3979
4944
  this._hostname = _hostname;
3980
4945
  this._start = _start;
3981
4946
  this._stop = _stop;
4947
+ this._up = _up;
3982
4948
  }
3983
4949
  /**
3984
- * A unique identifier for this service.
4950
+ * A unique identifier for this Service.
3985
4951
  */
3986
4952
  id = async () => {
3987
4953
  if (this._id) {
@@ -4042,13 +5008,18 @@ export class Service extends BaseClient {
4042
5008
  operation: "ports",
4043
5009
  },
4044
5010
  {
4045
- operation: "description port protocol",
5011
+ operation: "id",
4046
5012
  },
4047
5013
  ], await this._ctx.connection());
4048
5014
  return response.map((r) => new Port({
4049
- queryTree: this.queryTree,
5015
+ queryTree: [
5016
+ {
5017
+ operation: "loadPortFromID",
5018
+ args: { id: r.id },
5019
+ },
5020
+ ],
4050
5021
  ctx: this._ctx,
4051
- }, r.description, r.port, r.protocol));
5022
+ }, r.id));
4052
5023
  };
4053
5024
  /**
4054
5025
  * Start the service and wait for its health checks to succeed.
@@ -4066,17 +5037,38 @@ export class Service extends BaseClient {
4066
5037
  };
4067
5038
  /**
4068
5039
  * Stop the service.
5040
+ * @param opts.kill Immediately kill the service without waiting for a graceful exit
4069
5041
  */
4070
- stop = async () => {
5042
+ stop = async (opts) => {
4071
5043
  await computeQuery([
4072
5044
  ...this._queryTree,
4073
5045
  {
4074
5046
  operation: "stop",
5047
+ args: { ...opts },
4075
5048
  },
4076
5049
  ], await this._ctx.connection());
4077
5050
  return this;
4078
5051
  };
5052
+ /**
5053
+ * Creates a tunnel that forwards traffic from the caller's network to this service.
5054
+ */
5055
+ up = async (opts) => {
5056
+ if (this._up) {
5057
+ return this._up;
5058
+ }
5059
+ const response = await computeQuery([
5060
+ ...this._queryTree,
5061
+ {
5062
+ operation: "up",
5063
+ args: { ...opts },
5064
+ },
5065
+ ], await this._ctx.connection());
5066
+ return response;
5067
+ };
4079
5068
  }
5069
+ /**
5070
+ * A Unix or TCP/IP socket that can be mounted into a container.
5071
+ */
4080
5072
  export class Socket extends BaseClient {
4081
5073
  _id = undefined;
4082
5074
  /**
@@ -4087,7 +5079,37 @@ export class Socket extends BaseClient {
4087
5079
  this._id = _id;
4088
5080
  }
4089
5081
  /**
4090
- * The content-addressed identifier of the socket.
5082
+ * A unique identifier for this Socket.
5083
+ */
5084
+ id = async () => {
5085
+ if (this._id) {
5086
+ return this._id;
5087
+ }
5088
+ const response = await computeQuery([
5089
+ ...this._queryTree,
5090
+ {
5091
+ operation: "id",
5092
+ },
5093
+ ], await this._ctx.connection());
5094
+ return response;
5095
+ };
5096
+ }
5097
+ /**
5098
+ * An interactive terminal that clients can connect to.
5099
+ */
5100
+ export class Terminal extends BaseClient {
5101
+ _id = undefined;
5102
+ _websocketEndpoint = undefined;
5103
+ /**
5104
+ * Constructor is used for internal usage only, do not create object from it.
5105
+ */
5106
+ constructor(parent, _id, _websocketEndpoint) {
5107
+ super(parent);
5108
+ this._id = _id;
5109
+ this._websocketEndpoint = _websocketEndpoint;
5110
+ }
5111
+ /**
5112
+ * A unique identifier for this Terminal.
4091
5113
  */
4092
5114
  id = async () => {
4093
5115
  if (this._id) {
@@ -4101,6 +5123,21 @@ export class Socket extends BaseClient {
4101
5123
  ], await this._ctx.connection());
4102
5124
  return response;
4103
5125
  };
5126
+ /**
5127
+ * An http endpoint at which this terminal can be connected to over a websocket.
5128
+ */
5129
+ websocketEndpoint = async () => {
5130
+ if (this._websocketEndpoint) {
5131
+ return this._websocketEndpoint;
5132
+ }
5133
+ const response = await computeQuery([
5134
+ ...this._queryTree,
5135
+ {
5136
+ operation: "websocketEndpoint",
5137
+ },
5138
+ ], await this._ctx.connection());
5139
+ return response;
5140
+ };
4104
5141
  }
4105
5142
  /**
4106
5143
  * A definition of a parameter or return type in a Module.
@@ -4118,6 +5155,9 @@ export class TypeDef extends BaseClient {
4118
5155
  this._kind = _kind;
4119
5156
  this._optional = _optional;
4120
5157
  }
5158
+ /**
5159
+ * A unique identifier for this TypeDef.
5160
+ */
4121
5161
  id = async () => {
4122
5162
  if (this._id) {
4123
5163
  return this._id;
@@ -4130,10 +5170,17 @@ export class TypeDef extends BaseClient {
4130
5170
  ], await this._ctx.connection());
4131
5171
  return response;
4132
5172
  };
4133
- /**
4134
- * If kind is INTERFACE, the interface-specific type definition.
4135
- * If kind is not INTERFACE, this will be null.
4136
- */
5173
+ asInput = () => {
5174
+ return new InputTypeDef({
5175
+ queryTree: [
5176
+ ...this._queryTree,
5177
+ {
5178
+ operation: "asInput",
5179
+ },
5180
+ ],
5181
+ ctx: this._ctx,
5182
+ });
5183
+ };
4137
5184
  asInterface = () => {
4138
5185
  return new InterfaceTypeDef({
4139
5186
  queryTree: [
@@ -4145,10 +5192,6 @@ export class TypeDef extends BaseClient {
4145
5192
  ctx: this._ctx,
4146
5193
  });
4147
5194
  };
4148
- /**
4149
- * If kind is LIST, the list-specific type definition.
4150
- * If kind is not LIST, this will be null.
4151
- */
4152
5195
  asList = () => {
4153
5196
  return new ListTypeDef({
4154
5197
  queryTree: [
@@ -4160,10 +5203,6 @@ export class TypeDef extends BaseClient {
4160
5203
  ctx: this._ctx,
4161
5204
  });
4162
5205
  };
4163
- /**
4164
- * If kind is OBJECT, the object-specific type definition.
4165
- * If kind is not OBJECT, this will be null.
4166
- */
4167
5206
  asObject = () => {
4168
5207
  return new ObjectTypeDef({
4169
5208
  queryTree: [
@@ -4175,9 +5214,6 @@ export class TypeDef extends BaseClient {
4175
5214
  ctx: this._ctx,
4176
5215
  });
4177
5216
  };
4178
- /**
4179
- * The kind of type this is (e.g. primitive, list, object)
4180
- */
4181
5217
  kind = async () => {
4182
5218
  if (this._kind) {
4183
5219
  return this._kind;
@@ -4190,9 +5226,6 @@ export class TypeDef extends BaseClient {
4190
5226
  ], await this._ctx.connection());
4191
5227
  return response;
4192
5228
  };
4193
- /**
4194
- * Whether this type can be set to null. Defaults to false.
4195
- */
4196
5229
  optional = async () => {
4197
5230
  if (this._optional) {
4198
5231
  return this._optional;
@@ -4308,9 +5341,7 @@ export class TypeDef extends BaseClient {
4308
5341
  /**
4309
5342
  * Returns a TypeDef of kind Object with the provided name.
4310
5343
  *
4311
- * Note that an object's fields and functions may be omitted if the intent is
4312
- * only to refer to an object. This is how functions are able to return their
4313
- * own object, or any other circular reference.
5344
+ * 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.
4314
5345
  */
4315
5346
  withObject = (name, opts) => {
4316
5347
  return new TypeDef({