@dagger.io/dagger 0.8.7 → 0.9.0

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.
@@ -50,12 +50,6 @@ export type BuildArg = {
50
50
  */
51
51
  value: string;
52
52
  };
53
- /**
54
- * A global cache volume identifier.
55
- */
56
- export type CacheID = string & {
57
- __CacheID: never;
58
- };
59
53
  /**
60
54
  * Sharing mode of the cache volume.
61
55
  */
@@ -74,6 +68,33 @@ export declare enum CacheSharingMode {
74
68
  */
75
69
  Shared = "SHARED"
76
70
  }
71
+ /**
72
+ * A global cache volume identifier.
73
+ */
74
+ export type CacheVolumeID = string & {
75
+ __CacheVolumeID: never;
76
+ };
77
+ export type ContainerAsTarballOpts = {
78
+ /**
79
+ * Identifiers for other platform specific containers.
80
+ * Used for multi-platform image.
81
+ */
82
+ platformVariants?: Container[];
83
+ /**
84
+ * Force each layer of the image to use the specified compression algorithm.
85
+ * If this is unset, then if a layer already has a compressed blob in the engine's
86
+ * cache, that will be used (this can result in a mix of compression algorithms for
87
+ * different layers). If this is unset and a layer has no compressed blob in the
88
+ * engine's cache, then it will be compressed using Gzip.
89
+ */
90
+ forcedCompression?: ImageLayerCompression;
91
+ /**
92
+ * Use the specified media types for the image's layers. Defaults to OCI, which
93
+ * is largely compatible with most recent container runtimes, but Docker may be needed
94
+ * for older runtimes without OCI support.
95
+ */
96
+ mediaTypes?: ImageMediaTypes;
97
+ };
77
98
  export type ContainerBuildOpts = {
78
99
  /**
79
100
  * Path to the Dockerfile to use.
@@ -100,16 +121,6 @@ export type ContainerBuildOpts = {
100
121
  */
101
122
  secrets?: Secret[];
102
123
  };
103
- export type ContainerEndpointOpts = {
104
- /**
105
- * The exposed port number for the endpoint
106
- */
107
- port?: number;
108
- /**
109
- * Return a URL with the given scheme, eg. http for http://
110
- */
111
- scheme?: string;
112
- };
113
124
  export type ContainerExportOpts = {
114
125
  /**
115
126
  * Identifiers for other platform specific containers.
@@ -365,6 +376,21 @@ export type ContainerID = string & {
365
376
  export type DateTime = string & {
366
377
  __DateTime: never;
367
378
  };
379
+ export type DirectoryAsModuleOpts = {
380
+ /**
381
+ * An optional subpath of the directory which contains the module's source
382
+ * code.
383
+ *
384
+ * This is needed when the module code is in a subdirectory but requires
385
+ * parent directories to be loaded in order to execute. For example, the
386
+ * module source code may need a go.mod, project.toml, package.json, etc. file
387
+ * from a parent directory.
388
+ *
389
+ * If not set, the module source code is loaded from the root of the
390
+ * directory.
391
+ */
392
+ sourceSubpath?: string;
393
+ };
368
394
  export type DirectoryDockerBuildOpts = {
369
395
  /**
370
396
  * Path to the Dockerfile to use (e.g., "frontend.Dockerfile").
@@ -460,6 +486,47 @@ export type FileExportOpts = {
460
486
  export type FileID = string & {
461
487
  __FileID: never;
462
488
  };
489
+ export type FunctionCallOpts = {
490
+ input?: FunctionCallInput[];
491
+ };
492
+ export type FunctionWithArgOpts = {
493
+ /**
494
+ * A doc string for the argument, if any
495
+ */
496
+ description?: string;
497
+ /**
498
+ * A default value to use for this argument if not explicitly set by the caller, if any
499
+ */
500
+ defaultValue?: JSON;
501
+ };
502
+ /**
503
+ * A reference to a FunctionArg.
504
+ */
505
+ export type FunctionArgID = string & {
506
+ __FunctionArgID: never;
507
+ };
508
+ export type FunctionCallInput = {
509
+ /**
510
+ * The name of the argument to the function
511
+ */
512
+ name: string;
513
+ /**
514
+ * The value of the argument represented as a string of the JSON serialization.
515
+ */
516
+ value: JSON;
517
+ };
518
+ /**
519
+ * A reference to a Function.
520
+ */
521
+ export type FunctionID = string & {
522
+ __FunctionID: never;
523
+ };
524
+ /**
525
+ * A reference to GeneratedCode.
526
+ */
527
+ export type GeneratedCodeID = string & {
528
+ __GeneratedCodeID: never;
529
+ };
463
530
  export type GitRefTreeOpts = {
464
531
  sshKnownHosts?: string;
465
532
  sshAuthSocket?: Socket;
@@ -474,6 +541,34 @@ export type HostDirectoryOpts = {
474
541
  */
475
542
  include?: string[];
476
543
  };
544
+ export type HostServiceOpts = {
545
+ /**
546
+ * Upstream host to forward traffic to.
547
+ */
548
+ host?: string;
549
+ };
550
+ export type HostTunnelOpts = {
551
+ /**
552
+ * Map each service port to the same port on the host, as if the service were
553
+ * running natively.
554
+ *
555
+ * Note: enabling may result in port conflicts.
556
+ */
557
+ native?: boolean;
558
+ /**
559
+ * Configure explicit port forwarding rules for the tunnel.
560
+ *
561
+ * If a port's frontend is unspecified or 0, a random port will be chosen by
562
+ * the host.
563
+ *
564
+ * If no ports are given, all of the service's ports are forwarded. If native
565
+ * is true, each port maps to the same port on the host. If native is false,
566
+ * each port maps to a random port chosen by the host.
567
+ *
568
+ * If ports are given and native is true, the ports are additive.
569
+ */
570
+ ports?: PortForward[];
571
+ };
477
572
  /**
478
573
  * The `ID` scalar type represents a unique identifier, often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as `"4"`) or integer (such as `4`) input value will be accepted as an ID.
479
574
  */
@@ -496,6 +591,18 @@ export declare enum ImageMediaTypes {
496
591
  Dockermediatypes = "DockerMediaTypes",
497
592
  Ocimediatypes = "OCIMediaTypes"
498
593
  }
594
+ /**
595
+ * An arbitrary JSON-encoded value.
596
+ */
597
+ export type JSON = string & {
598
+ __JSON: never;
599
+ };
600
+ /**
601
+ * A reference to a Module.
602
+ */
603
+ export type ModuleID = string & {
604
+ __ModuleID: never;
605
+ };
499
606
  /**
500
607
  * Transport layer network protocol associated to a port.
501
608
  */
@@ -527,17 +634,19 @@ export type PipelineLabel = {
527
634
  export type Platform = string & {
528
635
  __Platform: never;
529
636
  };
530
- /**
531
- * A unique project command identifier.
532
- */
533
- export type ProjectCommandID = string & {
534
- __ProjectCommandID: never;
535
- };
536
- /**
537
- * A unique project identifier.
538
- */
539
- export type ProjectID = string & {
540
- __ProjectID: never;
637
+ export type PortForward = {
638
+ /**
639
+ * Destination port for traffic.
640
+ */
641
+ backend: number;
642
+ /**
643
+ * Port to expose to clients. If unspecified, a default will be chosen.
644
+ */
645
+ frontend?: number;
646
+ /**
647
+ * Protocol to use for traffic.
648
+ */
649
+ protocol?: NetworkProtocol;
541
650
  };
542
651
  export type ClientContainerOpts = {
543
652
  id?: ContainerID;
@@ -554,13 +663,16 @@ export type ClientGitOpts = {
554
663
  /**
555
664
  * A service which must be started before the repo is fetched.
556
665
  */
557
- experimentalServiceHost?: Container;
666
+ experimentalServiceHost?: Service;
558
667
  };
559
668
  export type ClientHttpOpts = {
560
669
  /**
561
670
  * A service which must be started before the URL is fetched.
562
671
  */
563
- experimentalServiceHost?: Container;
672
+ experimentalServiceHost?: Service;
673
+ };
674
+ export type ClientModuleConfigOpts = {
675
+ subpath?: string;
564
676
  };
565
677
  export type ClientPipelineOpts = {
566
678
  /**
@@ -572,12 +684,6 @@ export type ClientPipelineOpts = {
572
684
  */
573
685
  labels?: PipelineLabel[];
574
686
  };
575
- export type ClientProjectOpts = {
576
- id?: ProjectID;
577
- };
578
- export type ClientProjectCommandOpts = {
579
- id?: ProjectCommandID;
580
- };
581
687
  export type ClientSocketOpts = {
582
688
  id?: SocketID;
583
689
  };
@@ -587,12 +693,88 @@ export type ClientSocketOpts = {
587
693
  export type SecretID = string & {
588
694
  __SecretID: never;
589
695
  };
696
+ export type ServiceEndpointOpts = {
697
+ /**
698
+ * The exposed port number for the endpoint
699
+ */
700
+ port?: number;
701
+ /**
702
+ * Return a URL with the given scheme, eg. http for http://
703
+ */
704
+ scheme?: string;
705
+ };
706
+ /**
707
+ * A unique service identifier.
708
+ */
709
+ export type ServiceID = string & {
710
+ __ServiceID: never;
711
+ };
590
712
  /**
591
713
  * A content-addressed socket identifier.
592
714
  */
593
715
  export type SocketID = string & {
594
716
  __SocketID: never;
595
717
  };
718
+ export type TypeDefWithFieldOpts = {
719
+ /**
720
+ * A doc string for the field, if any
721
+ */
722
+ description?: string;
723
+ };
724
+ export type TypeDefWithObjectOpts = {
725
+ description?: string;
726
+ };
727
+ /**
728
+ * A reference to a TypeDef.
729
+ */
730
+ export type TypeDefID = string & {
731
+ __TypeDefID: never;
732
+ };
733
+ /**
734
+ * Distinguishes the different kinds of TypeDefs.
735
+ */
736
+ export declare enum TypeDefKind {
737
+ /**
738
+ * A boolean value
739
+ */
740
+ Booleankind = "BooleanKind",
741
+ /**
742
+ * An integer value
743
+ */
744
+ Integerkind = "IntegerKind",
745
+ /**
746
+ * A list of values all having the same type.
747
+ *
748
+ * Always paired with a ListTypeDef.
749
+ */
750
+ Listkind = "ListKind",
751
+ /**
752
+ * A named type defined in the GraphQL schema, with fields and functions.
753
+ *
754
+ * Always paired with an ObjectTypeDef.
755
+ */
756
+ Objectkind = "ObjectKind",
757
+ /**
758
+ * A string value
759
+ */
760
+ Stringkind = "StringKind",
761
+ /**
762
+ * A special kind used to signify that no value is returned.
763
+ *
764
+ * This is used for functions that have no return value. The outer TypeDef
765
+ * specifying this Kind is always Optional, as the Void is never actually
766
+ * represented.
767
+ */
768
+ Voidkind = "VoidKind"
769
+ }
770
+ /**
771
+ * The absense of a value.
772
+ *
773
+ * A Null Void is used as a placeholder for resolvers that do not return anything.
774
+ */
775
+ export type Void = string & {
776
+ __Void: never;
777
+ };
596
778
  export type __TypeEnumValuesOpts = {
597
779
  includeDeprecated?: boolean;
598
780
  };
@@ -611,22 +793,21 @@ export declare class CacheVolume extends BaseClient {
611
793
  queryTree?: QueryTree[];
612
794
  host?: string;
613
795
  sessionToken?: string;
614
- }, _id?: CacheID);
615
- id(): Promise<CacheID>;
796
+ }, _id?: CacheVolumeID);
797
+ id(): Promise<CacheVolumeID>;
616
798
  }
617
799
  /**
618
800
  * An OCI-compatible container, also known as a docker container.
619
801
  */
620
802
  export declare class Container extends BaseClient {
621
- private readonly _endpoint?;
803
+ private readonly _id?;
622
804
  private readonly _envVariable?;
623
805
  private readonly _export?;
624
- private readonly _hostname?;
625
- private readonly _id?;
626
806
  private readonly _imageRef?;
627
807
  private readonly _label?;
628
808
  private readonly _platform?;
629
809
  private readonly _publish?;
810
+ private readonly _shellEndpoint?;
630
811
  private readonly _stderr?;
631
812
  private readonly _stdout?;
632
813
  private readonly _sync?;
@@ -639,7 +820,31 @@ export declare class Container extends BaseClient {
639
820
  queryTree?: QueryTree[];
640
821
  host?: string;
641
822
  sessionToken?: string;
642
- }, _endpoint?: string, _envVariable?: string, _export?: boolean, _hostname?: string, _id?: ContainerID, _imageRef?: string, _label?: string, _platform?: Platform, _publish?: string, _stderr?: string, _stdout?: string, _sync?: ContainerID, _user?: string, _workdir?: string);
823
+ }, _id?: ContainerID, _envVariable?: string, _export?: boolean, _imageRef?: string, _label?: string, _platform?: Platform, _publish?: string, _shellEndpoint?: string, _stderr?: string, _stdout?: string, _sync?: ContainerID, _user?: string, _workdir?: string);
824
+ /**
825
+ * A unique identifier for this container.
826
+ */
827
+ id(): Promise<ContainerID>;
828
+ /**
829
+ * Turn the container into a Service.
830
+ *
831
+ * Be sure to set any exposed ports before this conversion.
832
+ */
833
+ asService(): Service;
834
+ /**
835
+ * Returns a File representing the container serialized to a tarball.
836
+ * @param opts.platformVariants Identifiers for other platform specific containers.
837
+ * Used for multi-platform image.
838
+ * @param opts.forcedCompression Force each layer of the image to use the specified compression algorithm.
839
+ * If this is unset, then if a layer already has a compressed blob in the engine's
840
+ * cache, that will be used (this can result in a mix of compression algorithms for
841
+ * different layers). If this is unset and a layer has no compressed blob in the
842
+ * engine's cache, then it will be compressed using Gzip.
843
+ * @param opts.mediaTypes Use the specified media types for the image's layers. Defaults to OCI, which
844
+ * is largely compatible with most recent container runtimes, but Docker may be needed
845
+ * for older runtimes without OCI support.
846
+ */
847
+ asTarball(opts?: ContainerAsTarballOpts): File;
643
848
  /**
644
849
  * Initializes this container from a Dockerfile build.
645
850
  * @param context Directory context used by the Dockerfile.
@@ -668,18 +873,6 @@ export declare class Container extends BaseClient {
668
873
  * @param path The path of the directory to retrieve (e.g., "./src").
669
874
  */
670
875
  directory(path: string): Directory;
671
- /**
672
- * Retrieves an endpoint that clients can use to reach this container.
673
- *
674
- * If no port is specified, the first exposed port is used. If none exist an error is returned.
675
- *
676
- * If a scheme is specified, a URL is returned. Otherwise, a host:port pair is returned.
677
- *
678
- * Currently experimental; set _EXPERIMENTAL_DAGGER_SERVICES_DNS=0 to disable.
679
- * @param opts.port The exposed port number for the endpoint
680
- * @param opts.scheme Return a URL with the given scheme, eg. http for http://
681
- */
682
- endpoint(opts?: ContainerEndpointOpts): Promise<string>;
683
876
  /**
684
877
  * Retrieves entrypoint to be prepended to the arguments of all commands.
685
878
  */
@@ -717,8 +910,6 @@ export declare class Container extends BaseClient {
717
910
  *
718
911
  * This includes ports already exposed by the image, even if not
719
912
  * explicitly added with dagger.
720
- *
721
- * Currently experimental; set _EXPERIMENTAL_DAGGER_SERVICES_DNS=0 to disable.
722
913
  */
723
914
  exposedPorts(): Promise<Port[]>;
724
915
  /**
@@ -735,16 +926,6 @@ export declare class Container extends BaseClient {
735
926
  * Formatted as [host]/[user]/[repo]:[tag] (e.g., "docker.io/dagger/dagger:main").
736
927
  */
737
928
  from(address: string): Container;
738
- /**
739
- * Retrieves a hostname which can be used by clients to reach this container.
740
- *
741
- * Currently experimental; set _EXPERIMENTAL_DAGGER_SERVICES_DNS=0 to disable.
742
- */
743
- hostname(): Promise<string>;
744
- /**
745
- * A unique identifier for this container.
746
- */
747
- id(): Promise<ContainerID>;
748
929
  /**
749
930
  * The unique image reference which can only be retrieved immediately after the 'Container.From' call.
750
931
  */
@@ -758,7 +939,7 @@ export declare class Container extends BaseClient {
758
939
  * @param opts.tag Identifies the tag to import from the archive, if the archive bundles
759
940
  * multiple tags.
760
941
  */
761
- import(source: File, opts?: ContainerImportOpts): Container;
942
+ import_(source: File, opts?: ContainerImportOpts): Container;
762
943
  /**
763
944
  * Retrieves the value of the specified label.
764
945
  */
@@ -806,6 +987,13 @@ export declare class Container extends BaseClient {
806
987
  * Retrieves this container's root filesystem. Mounts are not included.
807
988
  */
808
989
  rootfs(): Directory;
990
+ /**
991
+ * Return a websocket endpoint that, if connected to, will start the container with a TTY streamed
992
+ * over the websocket.
993
+ *
994
+ * Primarily intended for internal use with the dagger CLI.
995
+ */
996
+ shellEndpoint(): Promise<string>;
809
997
  /**
810
998
  * The error stream of the last executed command.
811
999
  *
@@ -884,8 +1072,6 @@ export declare class Container extends BaseClient {
884
1072
  * Exposed ports serve two purposes:
885
1073
  * - For health checks and introspection, when running services
886
1074
  * - For setting the EXPOSE OCI field when publishing the container
887
- *
888
- * Currently experimental; set _EXPERIMENTAL_DAGGER_SERVICES_DNS=0 to disable.
889
1075
  * @param port Port number to expose
890
1076
  * @param opts.protocol Transport layer network protocol
891
1077
  * @param opts.description Optional port description
@@ -1016,12 +1202,10 @@ export declare class Container extends BaseClient {
1016
1202
  * The service will be reachable from the container via the provided hostname alias.
1017
1203
  *
1018
1204
  * The service dependency will also convey to any files or directories produced by the container.
1019
- *
1020
- * Currently experimental; set _EXPERIMENTAL_DAGGER_SERVICES_DNS=0 to disable.
1021
1205
  * @param alias A name that can be used to reach the service from the container
1022
1206
  * @param service Identifier of the service container
1023
1207
  */
1024
- withServiceBinding(alias: string, service: Container): Container;
1208
+ withServiceBinding(alias: string, service: Service): Container;
1025
1209
  /**
1026
1210
  * Retrieves this container plus a socket forwarded to the given Unix socket path.
1027
1211
  * @param path Location of the forwarded Unix socket (e.g., "/tmp/socket").
@@ -1050,8 +1234,6 @@ export declare class Container extends BaseClient {
1050
1234
  withoutEnvVariable(name: string): Container;
1051
1235
  /**
1052
1236
  * Unexpose a previously exposed port.
1053
- *
1054
- * Currently experimental; set _EXPERIMENTAL_DAGGER_SERVICES_DNS=0 to disable.
1055
1237
  * @param port Port number to unexpose
1056
1238
  * @param opts.protocol Port protocol to unexpose
1057
1239
  */
@@ -1099,8 +1281,8 @@ export declare class Container extends BaseClient {
1099
1281
  * A directory.
1100
1282
  */
1101
1283
  export declare class Directory extends BaseClient {
1102
- private readonly _export?;
1103
1284
  private readonly _id?;
1285
+ private readonly _export?;
1104
1286
  private readonly _sync?;
1105
1287
  /**
1106
1288
  * Constructor is used for internal usage only, do not create object from it.
@@ -1109,7 +1291,25 @@ export declare class Directory extends BaseClient {
1109
1291
  queryTree?: QueryTree[];
1110
1292
  host?: string;
1111
1293
  sessionToken?: string;
1112
- }, _export?: boolean, _id?: DirectoryID, _sync?: DirectoryID);
1294
+ }, _id?: DirectoryID, _export?: boolean, _sync?: DirectoryID);
1295
+ /**
1296
+ * The content-addressed identifier of the directory.
1297
+ */
1298
+ id(): Promise<DirectoryID>;
1299
+ /**
1300
+ * Load the directory as a Dagger module
1301
+ * @param opts.sourceSubpath An optional subpath of the directory which contains the module's source
1302
+ * code.
1303
+ *
1304
+ * This is needed when the module code is in a subdirectory but requires
1305
+ * parent directories to be loaded in order to execute. For example, the
1306
+ * module source code may need a go.mod, project.toml, package.json, etc. file
1307
+ * from a parent directory.
1308
+ *
1309
+ * If not set, the module source code is loaded from the root of the
1310
+ * directory.
1311
+ */
1312
+ asModule(opts?: DirectoryAsModuleOpts): Module_;
1113
1313
  /**
1114
1314
  * Gets the difference between this directory and an another directory.
1115
1315
  * @param other Identifier of the directory to compare.
@@ -1148,10 +1348,6 @@ export declare class Directory extends BaseClient {
1148
1348
  * @param path Location of the file to retrieve (e.g., "README.md").
1149
1349
  */
1150
1350
  file(path: string): File;
1151
- /**
1152
- * The content-addressed identifier of the directory.
1153
- */
1154
- id(): Promise<DirectoryID>;
1155
1351
  /**
1156
1352
  * Creates a named sub-pipeline
1157
1353
  * @param name Pipeline name.
@@ -1244,13 +1440,42 @@ export declare class EnvVariable extends BaseClient {
1244
1440
  */
1245
1441
  value(): Promise<string>;
1246
1442
  }
1443
+ /**
1444
+ * A definition of a field on a custom object defined in a Module.
1445
+ * A field on an object has a static value, as opposed to a function on an
1446
+ * object whose value is computed by invoking code (and can accept arguments).
1447
+ */
1448
+ export declare class FieldTypeDef extends BaseClient {
1449
+ private readonly _description?;
1450
+ private readonly _name?;
1451
+ /**
1452
+ * Constructor is used for internal usage only, do not create object from it.
1453
+ */
1454
+ constructor(parent?: {
1455
+ queryTree?: QueryTree[];
1456
+ host?: string;
1457
+ sessionToken?: string;
1458
+ }, _description?: string, _name?: string);
1459
+ /**
1460
+ * A doc string for the field, if any
1461
+ */
1462
+ description(): Promise<string>;
1463
+ /**
1464
+ * The name of the field in the object
1465
+ */
1466
+ name(): Promise<string>;
1467
+ /**
1468
+ * The type of the field
1469
+ */
1470
+ typeDef(): TypeDef;
1471
+ }
1247
1472
  /**
1248
1473
  * A file.
1249
1474
  */
1250
1475
  export declare class File extends BaseClient {
1476
+ private readonly _id?;
1251
1477
  private readonly _contents?;
1252
1478
  private readonly _export?;
1253
- private readonly _id?;
1254
1479
  private readonly _size?;
1255
1480
  private readonly _sync?;
1256
1481
  /**
@@ -1260,7 +1485,11 @@ export declare class File extends BaseClient {
1260
1485
  queryTree?: QueryTree[];
1261
1486
  host?: string;
1262
1487
  sessionToken?: string;
1263
- }, _contents?: string, _export?: boolean, _id?: FileID, _size?: number, _sync?: FileID);
1488
+ }, _id?: FileID, _contents?: string, _export?: boolean, _size?: number, _sync?: FileID);
1489
+ /**
1490
+ * Retrieves the content-addressed identifier of the file.
1491
+ */
1492
+ id(): Promise<FileID>;
1264
1493
  /**
1265
1494
  * Retrieves the contents of the file.
1266
1495
  */
@@ -1272,10 +1501,6 @@ export declare class File extends BaseClient {
1272
1501
  * the file will be created in that directory.
1273
1502
  */
1274
1503
  export(path: string, opts?: FileExportOpts): Promise<boolean>;
1275
- /**
1276
- * Retrieves the content-addressed identifier of the file.
1277
- */
1278
- id(): Promise<FileID>;
1279
1504
  /**
1280
1505
  * Gets the size of the file, in bytes.
1281
1506
  */
@@ -1299,9 +1524,16 @@ export declare class File extends BaseClient {
1299
1524
  with(arg: (param: File) => File): File;
1300
1525
  }
1301
1526
  /**
1302
- * A git ref (tag, branch or commit).
1527
+ * Function represents a resolver provided by a Module.
1528
+ *
1529
+ * A function always evaluates against a parent object and is given a set of
1530
+ * named arguments.
1303
1531
  */
1304
- export declare class GitRef extends BaseClient {
1532
+ export declare class Function_ extends BaseClient {
1533
+ private readonly _id?;
1534
+ private readonly _call?;
1535
+ private readonly _description?;
1536
+ private readonly _name?;
1305
1537
  /**
1306
1538
  * Constructor is used for internal usage only, do not create object from it.
1307
1539
  */
@@ -1309,31 +1541,227 @@ export declare class GitRef extends BaseClient {
1309
1541
  queryTree?: QueryTree[];
1310
1542
  host?: string;
1311
1543
  sessionToken?: string;
1312
- });
1544
+ }, _id?: FunctionID, _call?: JSON, _description?: string, _name?: string);
1313
1545
  /**
1314
- * The filesystem tree at this ref.
1546
+ * The ID of the function
1315
1547
  */
1316
- tree(opts?: GitRefTreeOpts): Directory;
1317
- }
1318
- /**
1319
- * A git repository.
1320
- */
1321
- export declare class GitRepository extends BaseClient {
1548
+ id(): Promise<FunctionID>;
1322
1549
  /**
1323
- * Constructor is used for internal usage only, do not create object from it.
1550
+ * Arguments accepted by this function, if any
1324
1551
  */
1325
- constructor(parent?: {
1326
- queryTree?: QueryTree[];
1327
- host?: string;
1328
- sessionToken?: string;
1329
- });
1552
+ args(): Promise<FunctionArg[]>;
1330
1553
  /**
1331
- * Returns details on one branch.
1332
- * @param name Branch's name (e.g., "main").
1554
+ * Execute this function using dynamic input+output types.
1555
+ *
1556
+ * Typically, it's preferable to invoke a function using a type
1557
+ * safe graphql query rather than using this call field. However,
1558
+ * call is useful for some advanced use cases where dynamically
1559
+ * loading arbitrary modules and invoking functions in them is
1560
+ * required.
1333
1561
  */
1334
- branch(name: string): GitRef;
1562
+ call(opts?: FunctionCallOpts): Promise<JSON>;
1335
1563
  /**
1336
- * Returns details on one commit.
1564
+ * A doc string for the function, if any
1565
+ */
1566
+ description(): Promise<string>;
1567
+ /**
1568
+ * The name of the function
1569
+ */
1570
+ name(): Promise<string>;
1571
+ /**
1572
+ * The type returned by this function
1573
+ */
1574
+ returnType(): TypeDef;
1575
+ /**
1576
+ * Returns the function with the provided argument
1577
+ * @param name The name of the argument
1578
+ * @param typeDef The type of the argument
1579
+ * @param opts.description A doc string for the argument, if any
1580
+ * @param opts.defaultValue A default value to use for this argument if not explicitly set by the caller, if any
1581
+ */
1582
+ withArg(name: string, typeDef: TypeDef, opts?: FunctionWithArgOpts): Function_;
1583
+ /**
1584
+ * Returns the function with the doc string
1585
+ */
1586
+ withDescription(description: string): Function_;
1587
+ /**
1588
+ * Call the provided function with current Function.
1589
+ *
1590
+ * This is useful for reusability and readability by not breaking the calling chain.
1591
+ */
1592
+ with(arg: (param: Function_) => Function_): Function_;
1593
+ }
1594
+ /**
1595
+ * An argument accepted by a function.
1596
+ *
1597
+ * This is a specification for an argument at function definition time, not an
1598
+ * argument passed at function call time.
1599
+ */
1600
+ export declare class FunctionArg extends BaseClient {
1601
+ private readonly _id?;
1602
+ private readonly _defaultValue?;
1603
+ private readonly _description?;
1604
+ private readonly _name?;
1605
+ /**
1606
+ * Constructor is used for internal usage only, do not create object from it.
1607
+ */
1608
+ constructor(parent?: {
1609
+ queryTree?: QueryTree[];
1610
+ host?: string;
1611
+ sessionToken?: string;
1612
+ }, _id?: FunctionArgID, _defaultValue?: JSON, _description?: string, _name?: string);
1613
+ /**
1614
+ * The ID of the argument
1615
+ */
1616
+ id(): Promise<FunctionArgID>;
1617
+ /**
1618
+ * A default value to use for this argument when not explicitly set by the caller, if any
1619
+ */
1620
+ defaultValue(): Promise<JSON>;
1621
+ /**
1622
+ * A doc string for the argument, if any
1623
+ */
1624
+ description(): Promise<string>;
1625
+ /**
1626
+ * The name of the argument
1627
+ */
1628
+ name(): Promise<string>;
1629
+ /**
1630
+ * The type of the argument
1631
+ */
1632
+ typeDef(): TypeDef;
1633
+ }
1634
+ export declare class FunctionCall extends BaseClient {
1635
+ private readonly _name?;
1636
+ private readonly _parent?;
1637
+ private readonly _parentName?;
1638
+ private readonly _returnValue?;
1639
+ /**
1640
+ * Constructor is used for internal usage only, do not create object from it.
1641
+ */
1642
+ constructor(parent?: {
1643
+ queryTree?: QueryTree[];
1644
+ host?: string;
1645
+ sessionToken?: string;
1646
+ }, _name?: string, _parent?: JSON, _parentName?: string, _returnValue?: Void);
1647
+ /**
1648
+ * The argument values the function is being invoked with.
1649
+ */
1650
+ inputArgs(): Promise<FunctionCallArgValue[]>;
1651
+ /**
1652
+ * The name of the function being called.
1653
+ */
1654
+ name(): Promise<string>;
1655
+ /**
1656
+ * The value of the parent object of the function being called.
1657
+ * If the function is "top-level" to the module, this is always an empty object.
1658
+ */
1659
+ parent(): Promise<JSON>;
1660
+ /**
1661
+ * The name of the parent object of the function being called.
1662
+ * If the function is "top-level" to the module, this is the name of the module.
1663
+ */
1664
+ parentName(): Promise<string>;
1665
+ /**
1666
+ * Set the return value of the function call to the provided value.
1667
+ * The value should be a string of the JSON serialization of the return value.
1668
+ */
1669
+ returnValue(value: JSON): Promise<Void>;
1670
+ }
1671
+ export declare class FunctionCallArgValue extends BaseClient {
1672
+ private readonly _name?;
1673
+ private readonly _value?;
1674
+ /**
1675
+ * Constructor is used for internal usage only, do not create object from it.
1676
+ */
1677
+ constructor(parent?: {
1678
+ queryTree?: QueryTree[];
1679
+ host?: string;
1680
+ sessionToken?: string;
1681
+ }, _name?: string, _value?: JSON);
1682
+ /**
1683
+ * The name of the argument.
1684
+ */
1685
+ name(): Promise<string>;
1686
+ /**
1687
+ * The value of the argument represented as a string of the JSON serialization.
1688
+ */
1689
+ value(): Promise<JSON>;
1690
+ }
1691
+ export declare class GeneratedCode extends BaseClient {
1692
+ private readonly _id?;
1693
+ /**
1694
+ * Constructor is used for internal usage only, do not create object from it.
1695
+ */
1696
+ constructor(parent?: {
1697
+ queryTree?: QueryTree[];
1698
+ host?: string;
1699
+ sessionToken?: string;
1700
+ }, _id?: GeneratedCodeID);
1701
+ id(): Promise<GeneratedCodeID>;
1702
+ /**
1703
+ * The directory containing the generated code
1704
+ */
1705
+ code(): Directory;
1706
+ /**
1707
+ * List of paths to mark generated in version control (i.e. .gitattributes)
1708
+ */
1709
+ vcsGeneratedPaths(): Promise<string[]>;
1710
+ /**
1711
+ * List of paths to ignore in version control (i.e. .gitignore)
1712
+ */
1713
+ vcsIgnoredPaths(): Promise<string[]>;
1714
+ /**
1715
+ * Set the list of paths to mark generated in version control
1716
+ */
1717
+ withVCSGeneratedPaths(paths: string[]): GeneratedCode;
1718
+ /**
1719
+ * Set the list of paths to ignore in version control
1720
+ */
1721
+ withVCSIgnoredPaths(paths: string[]): GeneratedCode;
1722
+ /**
1723
+ * Call the provided function with current GeneratedCode.
1724
+ *
1725
+ * This is useful for reusability and readability by not breaking the calling chain.
1726
+ */
1727
+ with(arg: (param: GeneratedCode) => GeneratedCode): GeneratedCode;
1728
+ }
1729
+ /**
1730
+ * A git ref (tag, branch or commit).
1731
+ */
1732
+ export declare class GitRef extends BaseClient {
1733
+ /**
1734
+ * Constructor is used for internal usage only, do not create object from it.
1735
+ */
1736
+ constructor(parent?: {
1737
+ queryTree?: QueryTree[];
1738
+ host?: string;
1739
+ sessionToken?: string;
1740
+ });
1741
+ /**
1742
+ * The filesystem tree at this ref.
1743
+ */
1744
+ tree(opts?: GitRefTreeOpts): Directory;
1745
+ }
1746
+ /**
1747
+ * A git repository.
1748
+ */
1749
+ export declare class GitRepository extends BaseClient {
1750
+ /**
1751
+ * Constructor is used for internal usage only, do not create object from it.
1752
+ */
1753
+ constructor(parent?: {
1754
+ queryTree?: QueryTree[];
1755
+ host?: string;
1756
+ sessionToken?: string;
1757
+ });
1758
+ /**
1759
+ * Returns details on one branch.
1760
+ * @param name Branch's name (e.g., "main").
1761
+ */
1762
+ branch(name: string): GitRef;
1763
+ /**
1764
+ * Returns details on one commit.
1337
1765
  * @param id Identifier of the commit (e.g., "b6315d8f2810962c601af73f86831f6866ea798b").
1338
1766
  */
1339
1767
  commit(id: string): GitRef;
@@ -1367,6 +1795,17 @@ export declare class Host extends BaseClient {
1367
1795
  * @param path Location of the file to retrieve (e.g., "README.md").
1368
1796
  */
1369
1797
  file(path: string): File;
1798
+ /**
1799
+ * Creates a service that forwards traffic to a specified address via the host.
1800
+ * @param ports Ports to expose via the service, forwarding through the host network.
1801
+ *
1802
+ * If a port's frontend is unspecified or 0, it defaults to the same as the
1803
+ * backend port.
1804
+ *
1805
+ * An empty set of ports is not valid; an error will be returned.
1806
+ * @param opts.host Upstream host to forward traffic to.
1807
+ */
1808
+ service(ports: PortForward[], opts?: HostServiceOpts): Service;
1370
1809
  /**
1371
1810
  * Sets a secret given a user-defined name and the file path on the host, and returns the secret.
1372
1811
  * The file is limited to a size of 512000 bytes.
@@ -1374,6 +1813,25 @@ export declare class Host extends BaseClient {
1374
1813
  * @param path Location of the file to set as a secret.
1375
1814
  */
1376
1815
  setSecretFile(name: string, path: string): Secret;
1816
+ /**
1817
+ * Creates a tunnel that forwards traffic from the host to a service.
1818
+ * @param service Service to send traffic from the tunnel.
1819
+ * @param opts.native Map each service port to the same port on the host, as if the service were
1820
+ * running natively.
1821
+ *
1822
+ * Note: enabling may result in port conflicts.
1823
+ * @param opts.ports Configure explicit port forwarding rules for the tunnel.
1824
+ *
1825
+ * If a port's frontend is unspecified or 0, a random port will be chosen by
1826
+ * the host.
1827
+ *
1828
+ * If no ports are given, all of the service's ports are forwarded. If native
1829
+ * is true, each port maps to the same port on the host. If native is false,
1830
+ * each port maps to a random port chosen by the host.
1831
+ *
1832
+ * If ports are given and native is true, the ports are additive.
1833
+ */
1834
+ tunnel(service: Service, opts?: HostTunnelOpts): Service;
1377
1835
  /**
1378
1836
  * Accesses a Unix socket on the host.
1379
1837
  * @param path Location of the Unix socket (e.g., "/var/run/docker.sock").
@@ -1404,12 +1862,9 @@ export declare class Label extends BaseClient {
1404
1862
  value(): Promise<string>;
1405
1863
  }
1406
1864
  /**
1407
- * A port exposed by a container.
1865
+ * A definition of a list type in a Module.
1408
1866
  */
1409
- export declare class Port extends BaseClient {
1410
- private readonly _description?;
1411
- private readonly _port?;
1412
- private readonly _protocol?;
1867
+ export declare class ListTypeDef extends BaseClient {
1413
1868
  /**
1414
1869
  * Constructor is used for internal usage only, do not create object from it.
1415
1870
  */
@@ -1417,26 +1872,19 @@ export declare class Port extends BaseClient {
1417
1872
  queryTree?: QueryTree[];
1418
1873
  host?: string;
1419
1874
  sessionToken?: string;
1420
- }, _description?: string, _port?: number, _protocol?: NetworkProtocol);
1421
- /**
1422
- * The port description.
1423
- */
1424
- description(): Promise<string>;
1425
- /**
1426
- * The port number.
1427
- */
1428
- port(): Promise<number>;
1875
+ });
1429
1876
  /**
1430
- * The transport layer network protocol.
1877
+ * The type of the elements in the list
1431
1878
  */
1432
- protocol(): Promise<NetworkProtocol>;
1879
+ elementTypeDef(): TypeDef;
1433
1880
  }
1434
- /**
1435
- * A collection of Dagger resources that can be queried and invoked.
1436
- */
1437
- export declare class Project extends BaseClient {
1881
+ export declare class Module_ extends BaseClient {
1438
1882
  private readonly _id?;
1883
+ private readonly _description?;
1439
1884
  private readonly _name?;
1885
+ private readonly _sdk?;
1886
+ private readonly _serve?;
1887
+ private readonly _sourceDirectorySubPath?;
1440
1888
  /**
1441
1889
  * Constructor is used for internal usage only, do not create object from it.
1442
1890
  */
@@ -1444,38 +1892,71 @@ export declare class Project extends BaseClient {
1444
1892
  queryTree?: QueryTree[];
1445
1893
  host?: string;
1446
1894
  sessionToken?: string;
1447
- }, _id?: ProjectID, _name?: string);
1895
+ }, _id?: ModuleID, _description?: string, _name?: string, _sdk?: string, _serve?: Void, _sourceDirectorySubPath?: string);
1896
+ /**
1897
+ * The ID of the module
1898
+ */
1899
+ id(): Promise<ModuleID>;
1448
1900
  /**
1449
- * Commands provided by this project
1901
+ * Modules used by this module
1450
1902
  */
1451
- commands(): Promise<ProjectCommand[]>;
1903
+ dependencies(): Promise<Module_[]>;
1452
1904
  /**
1453
- * A unique identifier for this project.
1905
+ * The dependencies as configured by the module
1454
1906
  */
1455
- id(): Promise<ProjectID>;
1907
+ dependencyConfig(): Promise<string[]>;
1908
+ /**
1909
+ * The doc string of the module, if any
1910
+ */
1911
+ description(): Promise<string>;
1456
1912
  /**
1457
- * Initialize this project from the given directory and config path
1913
+ * The code generated by the SDK's runtime
1458
1914
  */
1459
- load(source: Directory, configPath: string): Project;
1915
+ generatedCode(): GeneratedCode;
1460
1916
  /**
1461
- * Name of the project
1917
+ * The name of the module
1462
1918
  */
1463
1919
  name(): Promise<string>;
1464
1920
  /**
1465
- * Call the provided function with current Project.
1921
+ * Objects served by this module
1922
+ */
1923
+ objects(): Promise<TypeDef[]>;
1924
+ /**
1925
+ * The SDK used by this module. Either a name of a builtin SDK or a module ref pointing to the SDK's implementation.
1926
+ */
1927
+ sdk(): Promise<string>;
1928
+ /**
1929
+ * Serve a module's API in the current session.
1930
+ * Note: this can only be called once per session.
1931
+ * In the future, it could return a stream or service to remove the side effect.
1932
+ */
1933
+ serve(): Promise<Void>;
1934
+ /**
1935
+ * The directory containing the module's source code
1936
+ */
1937
+ sourceDirectory(): Directory;
1938
+ /**
1939
+ * The module's subpath within the source directory
1940
+ */
1941
+ sourceDirectorySubPath(): Promise<string>;
1942
+ /**
1943
+ * This module plus the given Object type and associated functions
1944
+ */
1945
+ withObject(object: TypeDef): Module_;
1946
+ /**
1947
+ * Call the provided function with current Module.
1466
1948
  *
1467
1949
  * This is useful for reusability and readability by not breaking the calling chain.
1468
1950
  */
1469
- with(arg: (param: Project) => Project): Project;
1951
+ with(arg: (param: Module_) => Module_): Module_;
1470
1952
  }
1471
1953
  /**
1472
- * A command defined in a project that can be invoked from the CLI.
1954
+ * Static configuration for a module (e.g. parsed contents of dagger.json)
1473
1955
  */
1474
- export declare class ProjectCommand extends BaseClient {
1475
- private readonly _description?;
1476
- private readonly _id?;
1956
+ export declare class ModuleConfig extends BaseClient {
1477
1957
  private readonly _name?;
1478
- private readonly _resultType?;
1958
+ private readonly _root?;
1959
+ private readonly _sdk?;
1479
1960
  /**
1480
1961
  * Constructor is used for internal usage only, do not create object from it.
1481
1962
  */
@@ -1483,36 +1964,36 @@ export declare class ProjectCommand extends BaseClient {
1483
1964
  queryTree?: QueryTree[];
1484
1965
  host?: string;
1485
1966
  sessionToken?: string;
1486
- }, _description?: string, _id?: ProjectCommandID, _name?: string, _resultType?: string);
1967
+ }, _name?: string, _root?: string, _sdk?: string);
1487
1968
  /**
1488
- * Documentation for what this command does.
1969
+ * Modules that this module depends on.
1489
1970
  */
1490
- description(): Promise<string>;
1971
+ dependencies(): Promise<string[]>;
1491
1972
  /**
1492
- * Flags accepted by this command.
1973
+ * Exclude these file globs when loading the module root.
1493
1974
  */
1494
- flags(): Promise<ProjectCommandFlag[]>;
1975
+ exclude(): Promise<string[]>;
1495
1976
  /**
1496
- * A unique identifier for this command.
1977
+ * Include only these file globs when loading the module root.
1497
1978
  */
1498
- id(): Promise<ProjectCommandID>;
1979
+ include(): Promise<string[]>;
1499
1980
  /**
1500
- * The name of the command.
1981
+ * The name of the module.
1501
1982
  */
1502
1983
  name(): Promise<string>;
1503
1984
  /**
1504
- * The name of the type returned by this command.
1985
+ * The root directory of the module's project, which may be above the module source code.
1505
1986
  */
1506
- resultType(): Promise<string>;
1987
+ root(): Promise<string>;
1507
1988
  /**
1508
- * Subcommands, if any, that this command provides.
1989
+ * Either the name of a built-in SDK ('go', 'python', etc.) OR a module reference pointing to the SDK's module implementation.
1509
1990
  */
1510
- subcommands(): Promise<ProjectCommand[]>;
1991
+ sdk(): Promise<string>;
1511
1992
  }
1512
1993
  /**
1513
- * A flag accepted by a project command.
1994
+ * A definition of a custom object defined in a Module.
1514
1995
  */
1515
- export declare class ProjectCommandFlag extends BaseClient {
1996
+ export declare class ObjectTypeDef extends BaseClient {
1516
1997
  private readonly _description?;
1517
1998
  private readonly _name?;
1518
1999
  /**
@@ -1524,14 +2005,50 @@ export declare class ProjectCommandFlag extends BaseClient {
1524
2005
  sessionToken?: string;
1525
2006
  }, _description?: string, _name?: string);
1526
2007
  /**
1527
- * Documentation for what this flag sets.
2008
+ * The doc string for the object, if any
1528
2009
  */
1529
2010
  description(): Promise<string>;
1530
2011
  /**
1531
- * The name of the flag.
2012
+ * Static fields defined on this object, if any
2013
+ */
2014
+ fields(): Promise<FieldTypeDef[]>;
2015
+ /**
2016
+ * Functions defined on this object, if any
2017
+ */
2018
+ functions(): Promise<Function_[]>;
2019
+ /**
2020
+ * The name of the object
1532
2021
  */
1533
2022
  name(): Promise<string>;
1534
2023
  }
2024
+ /**
2025
+ * A port exposed by a container.
2026
+ */
2027
+ export declare class Port extends BaseClient {
2028
+ private readonly _description?;
2029
+ private readonly _port?;
2030
+ private readonly _protocol?;
2031
+ /**
2032
+ * Constructor is used for internal usage only, do not create object from it.
2033
+ */
2034
+ constructor(parent?: {
2035
+ queryTree?: QueryTree[];
2036
+ host?: string;
2037
+ sessionToken?: string;
2038
+ }, _description?: string, _port?: number, _protocol?: NetworkProtocol);
2039
+ /**
2040
+ * The port description.
2041
+ */
2042
+ description(): Promise<string>;
2043
+ /**
2044
+ * The port number.
2045
+ */
2046
+ port(): Promise<number>;
2047
+ /**
2048
+ * The transport layer network protocol.
2049
+ */
2050
+ protocol(): Promise<NetworkProtocol>;
2051
+ }
1535
2052
  export declare class Client extends BaseClient {
1536
2053
  private readonly _checkVersionCompatibility?;
1537
2054
  private readonly _defaultPlatform?;
@@ -1554,25 +2071,44 @@ export declare class Client extends BaseClient {
1554
2071
  */
1555
2072
  checkVersionCompatibility(version: string): Promise<boolean>;
1556
2073
  /**
1557
- * Loads a container from ID.
2074
+ * Creates a scratch container or loads one by ID.
1558
2075
  *
1559
- * Null ID returns an empty container (scratch).
1560
- * Optional platform argument initializes new containers to execute and publish as that platform.
1561
- * Platform defaults to that of the builder's host.
2076
+ * Optional platform argument initializes new containers to execute and publish
2077
+ * as that platform. Platform defaults to that of the builder's host.
1562
2078
  */
1563
2079
  container(opts?: ClientContainerOpts): Container;
2080
+ /**
2081
+ * The FunctionCall context that the SDK caller is currently executing in.
2082
+ * If the caller is not currently executing in a function, this will return
2083
+ * an error.
2084
+ */
2085
+ currentFunctionCall(): FunctionCall;
2086
+ /**
2087
+ * The module currently being served in the session, if any.
2088
+ */
2089
+ currentModule(): Module_;
1564
2090
  /**
1565
2091
  * The default platform of the builder.
1566
2092
  */
1567
2093
  defaultPlatform(): Promise<Platform>;
1568
2094
  /**
1569
- * Load a directory by ID. No argument produces an empty directory.
2095
+ * Creates an empty directory or loads one by ID.
1570
2096
  */
1571
2097
  directory(opts?: ClientDirectoryOpts): Directory;
1572
2098
  /**
1573
2099
  * Loads a file by ID.
2100
+ * @deprecated Use loadFileFromID instead.
1574
2101
  */
1575
2102
  file(id: FileID): File;
2103
+ /**
2104
+ * Create a function.
2105
+ */
2106
+ function_(name: string, returnType: TypeDef): Function_;
2107
+ /**
2108
+ * Create a code generation result, given a directory containing the generated
2109
+ * code.
2110
+ */
2111
+ generatedCode(code: Directory): GeneratedCode;
1576
2112
  /**
1577
2113
  * Queries a git repository.
1578
2114
  * @param url Url of the git repository.
@@ -1592,6 +2128,62 @@ export declare class Client extends BaseClient {
1592
2128
  * @param opts.experimentalServiceHost A service which must be started before the URL is fetched.
1593
2129
  */
1594
2130
  http(url: string, opts?: ClientHttpOpts): File;
2131
+ /**
2132
+ * Load a CacheVolume from its ID.
2133
+ */
2134
+ loadCacheVolumeFromID(id: CacheVolumeID): CacheVolume;
2135
+ /**
2136
+ * Loads a container from an ID.
2137
+ */
2138
+ loadContainerFromID(id: ContainerID): Container;
2139
+ /**
2140
+ * Load a Directory from its ID.
2141
+ */
2142
+ loadDirectoryFromID(id: DirectoryID): Directory;
2143
+ /**
2144
+ * Load a File from its ID.
2145
+ */
2146
+ loadFileFromID(id: FileID): File;
2147
+ /**
2148
+ * Load a function argument by ID.
2149
+ */
2150
+ loadFunctionArgFromID(id: FunctionArgID): FunctionArg;
2151
+ /**
2152
+ * Load a function by ID.
2153
+ */
2154
+ loadFunctionFromID(id: FunctionID): Function_;
2155
+ /**
2156
+ * Load a GeneratedCode by ID.
2157
+ */
2158
+ loadGeneratedCodeFromID(id: GeneratedCodeID): GeneratedCode;
2159
+ /**
2160
+ * Load a module by ID.
2161
+ */
2162
+ loadModuleFromID(id: ModuleID): Module_;
2163
+ /**
2164
+ * Load a Secret from its ID.
2165
+ */
2166
+ loadSecretFromID(id: SecretID): Secret;
2167
+ /**
2168
+ * Loads a service from ID.
2169
+ */
2170
+ loadServiceFromID(id: ServiceID): Service;
2171
+ /**
2172
+ * Load a Socket from its ID.
2173
+ */
2174
+ loadSocketFromID(id: SocketID): Socket;
2175
+ /**
2176
+ * Load a TypeDef by ID.
2177
+ */
2178
+ loadTypeDefFromID(id: TypeDefID): TypeDef;
2179
+ /**
2180
+ * Create a new module.
2181
+ */
2182
+ module_(): Module_;
2183
+ /**
2184
+ * Load the static configuration for a module from the given source directory and optional subpath.
2185
+ */
2186
+ moduleConfig(sourceDirectory: Directory, opts?: ClientModuleConfigOpts): ModuleConfig;
1595
2187
  /**
1596
2188
  * Creates a named sub-pipeline.
1597
2189
  * @param name Pipeline name.
@@ -1599,16 +2191,9 @@ export declare class Client extends BaseClient {
1599
2191
  * @param opts.labels Pipeline labels.
1600
2192
  */
1601
2193
  pipeline(name: string, opts?: ClientPipelineOpts): Client;
1602
- /**
1603
- * Load a project from ID.
1604
- */
1605
- project(opts?: ClientProjectOpts): Project;
1606
- /**
1607
- * Load a project command from ID.
1608
- */
1609
- projectCommand(opts?: ClientProjectCommandOpts): ProjectCommand;
1610
2194
  /**
1611
2195
  * Loads a secret from its ID.
2196
+ * @deprecated Use loadSecretFromID instead
1612
2197
  */
1613
2198
  secret(id: SecretID): Secret;
1614
2199
  /**
@@ -1620,8 +2205,13 @@ export declare class Client extends BaseClient {
1620
2205
  setSecret(name: string, plaintext: string): Secret;
1621
2206
  /**
1622
2207
  * Loads a socket by its ID.
2208
+ * @deprecated Use loadSocketFromID instead.
1623
2209
  */
1624
2210
  socket(opts?: ClientSocketOpts): Socket;
2211
+ /**
2212
+ * Create a new TypeDef.
2213
+ */
2214
+ typeDef(): TypeDef;
1625
2215
  /**
1626
2216
  * Call the provided function with current Client.
1627
2217
  *
@@ -1652,6 +2242,53 @@ export declare class Secret extends BaseClient {
1652
2242
  */
1653
2243
  plaintext(): Promise<string>;
1654
2244
  }
2245
+ export declare class Service extends BaseClient {
2246
+ private readonly _id?;
2247
+ private readonly _endpoint?;
2248
+ private readonly _hostname?;
2249
+ private readonly _start?;
2250
+ private readonly _stop?;
2251
+ /**
2252
+ * Constructor is used for internal usage only, do not create object from it.
2253
+ */
2254
+ constructor(parent?: {
2255
+ queryTree?: QueryTree[];
2256
+ host?: string;
2257
+ sessionToken?: string;
2258
+ }, _id?: ServiceID, _endpoint?: string, _hostname?: string, _start?: ServiceID, _stop?: ServiceID);
2259
+ /**
2260
+ * A unique identifier for this service.
2261
+ */
2262
+ id(): Promise<ServiceID>;
2263
+ /**
2264
+ * Retrieves an endpoint that clients can use to reach this container.
2265
+ *
2266
+ * If no port is specified, the first exposed port is used. If none exist an error is returned.
2267
+ *
2268
+ * If a scheme is specified, a URL is returned. Otherwise, a host:port pair is returned.
2269
+ * @param opts.port The exposed port number for the endpoint
2270
+ * @param opts.scheme Return a URL with the given scheme, eg. http for http://
2271
+ */
2272
+ endpoint(opts?: ServiceEndpointOpts): Promise<string>;
2273
+ /**
2274
+ * Retrieves a hostname which can be used by clients to reach this container.
2275
+ */
2276
+ hostname(): Promise<string>;
2277
+ /**
2278
+ * Retrieves the list of ports provided by the service.
2279
+ */
2280
+ ports(): Promise<Port[]>;
2281
+ /**
2282
+ * Start the service and wait for its health checks to succeed.
2283
+ *
2284
+ * Services bound to a Container do not need to be manually started.
2285
+ */
2286
+ start(): Promise<Service>;
2287
+ /**
2288
+ * Stop the service.
2289
+ */
2290
+ stop(): Promise<Service>;
2291
+ }
1655
2292
  export declare class Socket extends BaseClient {
1656
2293
  private readonly _id?;
1657
2294
  /**
@@ -1667,5 +2304,77 @@ export declare class Socket extends BaseClient {
1667
2304
  */
1668
2305
  id(): Promise<SocketID>;
1669
2306
  }
2307
+ /**
2308
+ * A definition of a parameter or return type in a Module.
2309
+ */
2310
+ export declare class TypeDef extends BaseClient {
2311
+ private readonly _id?;
2312
+ private readonly _kind?;
2313
+ private readonly _optional?;
2314
+ /**
2315
+ * Constructor is used for internal usage only, do not create object from it.
2316
+ */
2317
+ constructor(parent?: {
2318
+ queryTree?: QueryTree[];
2319
+ host?: string;
2320
+ sessionToken?: string;
2321
+ }, _id?: TypeDefID, _kind?: TypeDefKind, _optional?: boolean);
2322
+ id(): Promise<TypeDefID>;
2323
+ /**
2324
+ * If kind is LIST, the list-specific type definition.
2325
+ * If kind is not LIST, this will be null.
2326
+ */
2327
+ asList(): ListTypeDef;
2328
+ /**
2329
+ * If kind is OBJECT, the object-specific type definition.
2330
+ * If kind is not OBJECT, this will be null.
2331
+ */
2332
+ asObject(): ObjectTypeDef;
2333
+ /**
2334
+ * The kind of type this is (e.g. primitive, list, object)
2335
+ */
2336
+ kind(): Promise<TypeDefKind>;
2337
+ /**
2338
+ * Whether this type can be set to null. Defaults to false.
2339
+ */
2340
+ optional(): Promise<boolean>;
2341
+ /**
2342
+ * Adds a static field for an Object TypeDef, failing if the type is not an object.
2343
+ * @param name The name of the field in the object
2344
+ * @param typeDef The type of the field
2345
+ * @param opts.description A doc string for the field, if any
2346
+ */
2347
+ withField(name: string, typeDef: TypeDef, opts?: TypeDefWithFieldOpts): TypeDef;
2348
+ /**
2349
+ * Adds a function for an Object TypeDef, failing if the type is not an object.
2350
+ */
2351
+ withFunction(function_: Function_): TypeDef;
2352
+ /**
2353
+ * Sets the kind of the type.
2354
+ */
2355
+ withKind(kind: TypeDefKind): TypeDef;
2356
+ /**
2357
+ * Returns a TypeDef of kind List with the provided type for its elements.
2358
+ */
2359
+ withListOf(elementType: TypeDef): TypeDef;
2360
+ /**
2361
+ * Returns a TypeDef of kind Object with the provided name.
2362
+ *
2363
+ * Note that an object's fields and functions may be omitted if the intent is
2364
+ * only to refer to an object. This is how functions are able to return their
2365
+ * own object, or any other circular reference.
2366
+ */
2367
+ withObject(name: string, opts?: TypeDefWithObjectOpts): TypeDef;
2368
+ /**
2369
+ * Sets whether this type can be set to null.
2370
+ */
2371
+ withOptional(optional: boolean): TypeDef;
2372
+ /**
2373
+ * Call the provided function with current TypeDef.
2374
+ *
2375
+ * This is useful for reusability and readability by not breaking the calling chain.
2376
+ */
2377
+ with(arg: (param: TypeDef) => TypeDef): TypeDef;
2378
+ }
1670
2379
  export {};
1671
2380
  //# sourceMappingURL=client.gen.d.ts.map