@dagger.io/dagger 0.6.3 → 0.8.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.
@@ -98,30 +98,6 @@ export type ContainerEndpointOpts = {
98
98
  */
99
99
  scheme?: string;
100
100
  };
101
- export type ContainerExecOpts = {
102
- /**
103
- * Command to run instead of the container's default command (e.g., ["run", "main.go"]).
104
- */
105
- args?: string[];
106
- /**
107
- * Content to write to the command's standard input before closing (e.g., "Hello world").
108
- */
109
- stdin?: string;
110
- /**
111
- * Redirect the command's standard output to a file in the container (e.g., "/tmp/stdout").
112
- */
113
- redirectStdout?: string;
114
- /**
115
- * Redirect the command's standard error to a file in the container (e.g., "/tmp/stderr").
116
- */
117
- redirectStderr?: string;
118
- /**
119
- * Provide dagger access to the executed command.
120
- * Do not use this option unless you trust the command being executed.
121
- * The command being executed WILL BE GRANTED FULL ACCESS TO YOUR HOST FILESYSTEM.
122
- */
123
- experimentalPrivilegedNesting?: boolean;
124
- };
125
101
  export type ContainerExportOpts = {
126
102
  /**
127
103
  * Identifiers for other platform specific containers.
@@ -136,6 +112,12 @@ export type ContainerExportOpts = {
136
112
  * engine's cache, then it will be compressed using Gzip.
137
113
  */
138
114
  forcedCompression?: ImageLayerCompression;
115
+ /**
116
+ * Use the specified media types for the exported image's layers. Defaults to OCI, which
117
+ * is largely compatible with most recent container runtimes, but Docker may be needed
118
+ * for older runtimes without OCI support.
119
+ */
120
+ mediaTypes?: ImageMediaTypes;
139
121
  };
140
122
  export type ContainerImportOpts = {
141
123
  /**
@@ -168,6 +150,12 @@ export type ContainerPublishOpts = {
168
150
  * engine's cache, then it will be compressed using Gzip.
169
151
  */
170
152
  forcedCompression?: ImageLayerCompression;
153
+ /**
154
+ * Use the specified media types for the published image's layers. Defaults to OCI, which
155
+ * is largely compatible with most recent registries, but Docker may be needed for older
156
+ * registries without OCI support.
157
+ */
158
+ mediaTypes?: ImageMediaTypes;
171
159
  };
172
160
  export type ContainerWithDefaultArgsOpts = {
173
161
  /**
@@ -467,16 +455,6 @@ export type HostDirectoryOpts = {
467
455
  */
468
456
  include?: string[];
469
457
  };
470
- export type HostWorkdirOpts = {
471
- /**
472
- * Exclude artifacts that match the given pattern (e.g., ["node_modules/", ".git*"]).
473
- */
474
- exclude?: string[];
475
- /**
476
- * Include only artifacts that match the given pattern (e.g., ["app/", "package.*"]).
477
- */
478
- include?: string[];
479
- };
480
458
  /**
481
459
  * 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.
482
460
  */
@@ -484,7 +462,7 @@ export type ID = string & {
484
462
  __ID: never;
485
463
  };
486
464
  /**
487
- * Compression algorithm to use for image layers
465
+ * Compression algorithm to use for image layers.
488
466
  */
489
467
  export declare enum ImageLayerCompression {
490
468
  Estargz = 0,
@@ -492,6 +470,13 @@ export declare enum ImageLayerCompression {
492
470
  Uncompressed = 2,
493
471
  Zstd = 3
494
472
  }
473
+ /**
474
+ * Mediatypes to use in published or exported image metadata.
475
+ */
476
+ export declare enum ImageMediaTypes {
477
+ Dockermediatypes = 0,
478
+ Ocimediatypes = 1
479
+ }
495
480
  /**
496
481
  * Transport layer network protocol associated to a port.
497
482
  */
@@ -599,34 +584,43 @@ export type __TypeFieldsOpts = {
599
584
  * A directory whose contents persist across runs.
600
585
  */
601
586
  export declare class CacheVolume extends BaseClient {
602
- id(): Promise<CacheID>;
587
+ private readonly _id?;
603
588
  /**
604
- * Chain objects together
605
- * @example
606
- * ```ts
607
- * function AddAFewMounts(c) {
608
- * return c
609
- * .withMountedDirectory("/foo", new Client().host().directory("/Users/slumbering/forks/dagger"))
610
- * .withMountedDirectory("/bar", new Client().host().directory("/Users/slumbering/forks/dagger/sdk/nodejs"))
611
- * }
612
- *
613
- * connect(async (client) => {
614
- * const tree = await client
615
- * .container()
616
- * .from("alpine")
617
- * .withWorkdir("/foo")
618
- * .with(AddAFewMounts)
619
- * .withExec(["ls", "-lh"])
620
- * .stdout()
621
- * })
622
- *```
623
- */
624
- with(arg: (param: CacheVolume) => CacheVolume): CacheVolume;
589
+ * Constructor is used for internal usage only, do not create object from it.
590
+ */
591
+ constructor(parent?: {
592
+ queryTree?: QueryTree[];
593
+ host?: string;
594
+ sessionToken?: string;
595
+ }, _id?: CacheID);
596
+ id(): Promise<CacheID>;
625
597
  }
626
598
  /**
627
599
  * An OCI-compatible container, also known as a docker container.
628
600
  */
629
601
  export declare class Container extends BaseClient {
602
+ private readonly _endpoint?;
603
+ private readonly _envVariable?;
604
+ private readonly _export?;
605
+ private readonly _hostname?;
606
+ private readonly _id?;
607
+ private readonly _imageRef?;
608
+ private readonly _label?;
609
+ private readonly _platform?;
610
+ private readonly _publish?;
611
+ private readonly _stderr?;
612
+ private readonly _stdout?;
613
+ private readonly _sync?;
614
+ private readonly _user?;
615
+ private readonly _workdir?;
616
+ /**
617
+ * Constructor is used for internal usage only, do not create object from it.
618
+ */
619
+ constructor(parent?: {
620
+ queryTree?: QueryTree[];
621
+ host?: string;
622
+ sessionToken?: string;
623
+ }, _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);
630
624
  /**
631
625
  * Initializes this container from a Dockerfile build.
632
626
  * @param context Directory context used by the Dockerfile.
@@ -676,24 +670,6 @@ export declare class Container extends BaseClient {
676
670
  * Retrieves the list of environment variables passed to commands.
677
671
  */
678
672
  envVariables(): Promise<EnvVariable[]>;
679
- /**
680
- * Retrieves this container after executing the specified command inside it.
681
- * @param opts.args Command to run instead of the container's default command (e.g., ["run", "main.go"]).
682
- * @param opts.stdin Content to write to the command's standard input before closing (e.g., "Hello world").
683
- * @param opts.redirectStdout Redirect the command's standard output to a file in the container (e.g., "/tmp/stdout").
684
- * @param opts.redirectStderr Redirect the command's standard error to a file in the container (e.g., "/tmp/stderr").
685
- * @param opts.experimentalPrivilegedNesting Provide dagger access to the executed command.
686
- * Do not use this option unless you trust the command being executed.
687
- * The command being executed WILL BE GRANTED FULL ACCESS TO YOUR HOST FILESYSTEM.
688
- * @deprecated Replaced by withExec.
689
- */
690
- exec(opts?: ContainerExecOpts): Container;
691
- /**
692
- * Exit code of the last executed command. Zero means success.
693
- *
694
- * Will execute default command if none is set, or error if there's no default.
695
- */
696
- exitCode(): Promise<number>;
697
673
  /**
698
674
  * Writes the container as an OCI tarball to the destination file path on the host for the specified platform variants.
699
675
  *
@@ -708,6 +684,9 @@ export declare class Container extends BaseClient {
708
684
  * cache, that will be used (this can result in a mix of compression algorithms for
709
685
  * different layers). If this is unset and a layer has no compressed blob in the
710
686
  * engine's cache, then it will be compressed using Gzip.
687
+ * @param opts.mediaTypes Use the specified media types for the exported image's layers. Defaults to OCI, which
688
+ * is largely compatible with most recent container runtimes, but Docker may be needed
689
+ * for older runtimes without OCI support.
711
690
  */
712
691
  export(path: string, opts?: ContainerExportOpts): Promise<boolean>;
713
692
  /**
@@ -733,11 +712,6 @@ export declare class Container extends BaseClient {
733
712
  * Formatted as [host]/[user]/[repo]:[tag] (e.g., "docker.io/dagger/dagger:main").
734
713
  */
735
714
  from(address: string): Container;
736
- /**
737
- * Retrieves this container's root filesystem. Mounts are not included.
738
- * @deprecated Replaced by rootfs.
739
- */
740
- fs(): Directory;
741
715
  /**
742
716
  * Retrieves a hostname which can be used by clients to reach this container.
743
717
  *
@@ -800,6 +774,9 @@ export declare class Container extends BaseClient {
800
774
  * cache, that will be used (this can result in a mix of compression algorithms for
801
775
  * different layers). If this is unset and a layer has no compressed blob in the
802
776
  * engine's cache, then it will be compressed using Gzip.
777
+ * @param opts.mediaTypes Use the specified media types for the published image's layers. Defaults to OCI, which
778
+ * is largely compatible with most recent registries, but Docker may be needed for older
779
+ * registries without OCI support.
803
780
  */
804
781
  publish(address: string, opts?: ContainerPublishOpts): Promise<string>;
805
782
  /**
@@ -891,11 +868,6 @@ export declare class Container extends BaseClient {
891
868
  * @param opts.description Optional port description
892
869
  */
893
870
  withExposedPort(port: number, opts?: ContainerWithExposedPortOpts): Container;
894
- /**
895
- * Initializes this container from this DirectoryID.
896
- * @deprecated Replaced by withRootfs.
897
- */
898
- withFS(id: Directory): Container;
899
871
  /**
900
872
  * Retrieves this container plus the contents of the given file copied to the given path.
901
873
  * @param path Location of the copied file (e.g., "/tmp/file.txt").
@@ -910,6 +882,11 @@ export declare class Container extends BaseClient {
910
882
  * If the group is omitted, it defaults to the same as the user.
911
883
  */
912
884
  withFile(path: string, source: File, opts?: ContainerWithFileOpts): Container;
885
+ /**
886
+ * Indicate that subsequent operations should be featured more prominently in
887
+ * the UI.
888
+ */
889
+ withFocus(): Container;
913
890
  /**
914
891
  * Retrieves this container plus the given label.
915
892
  * @param name The name of the label (e.g., "org.opencontainers.artifact.created").
@@ -996,7 +973,7 @@ export declare class Container extends BaseClient {
996
973
  /**
997
974
  * Initializes this container from this DirectoryID.
998
975
  */
999
- withRootfs(id: Directory): Container;
976
+ withRootfs(directory: Directory): Container;
1000
977
  /**
1001
978
  * Retrieves this container plus an env variable containing the given secret.
1002
979
  * @param name The name of the secret variable (e.g., "API_SECRET").
@@ -1052,6 +1029,13 @@ export declare class Container extends BaseClient {
1052
1029
  * @param opts.protocol Port protocol to unexpose
1053
1030
  */
1054
1031
  withoutExposedPort(port: number, opts?: ContainerWithoutExposedPortOpts): Container;
1032
+ /**
1033
+ * Indicate that subsequent operations should not be featured more prominently
1034
+ * in the UI.
1035
+ *
1036
+ * This is the initial state of all containers.
1037
+ */
1038
+ withoutFocus(): Container;
1055
1039
  /**
1056
1040
  * Retrieves this container minus the given environment label.
1057
1041
  * @param name The name of the label to remove (e.g., "org.opencontainers.artifact.created").
@@ -1078,25 +1062,9 @@ export declare class Container extends BaseClient {
1078
1062
  */
1079
1063
  workdir(): Promise<string>;
1080
1064
  /**
1081
- * Chain objects together
1082
- * @example
1083
- * ```ts
1084
- * function AddAFewMounts(c) {
1085
- * return c
1086
- * .withMountedDirectory("/foo", new Client().host().directory("/Users/slumbering/forks/dagger"))
1087
- * .withMountedDirectory("/bar", new Client().host().directory("/Users/slumbering/forks/dagger/sdk/nodejs"))
1088
- * }
1089
- *
1090
- * connect(async (client) => {
1091
- * const tree = await client
1092
- * .container()
1093
- * .from("alpine")
1094
- * .withWorkdir("/foo")
1095
- * .with(AddAFewMounts)
1096
- * .withExec(["ls", "-lh"])
1097
- * .stdout()
1098
- * })
1099
- *```
1065
+ * Call the provided function with current Container.
1066
+ *
1067
+ * This is useful for reusability and readability by not breaking the calling chain.
1100
1068
  */
1101
1069
  with(arg: (param: Container) => Container): Container;
1102
1070
  }
@@ -1104,6 +1072,17 @@ export declare class Container extends BaseClient {
1104
1072
  * A directory.
1105
1073
  */
1106
1074
  export declare class Directory extends BaseClient {
1075
+ private readonly _export?;
1076
+ private readonly _id?;
1077
+ private readonly _sync?;
1078
+ /**
1079
+ * Constructor is used for internal usage only, do not create object from it.
1080
+ */
1081
+ constructor(parent?: {
1082
+ queryTree?: QueryTree[];
1083
+ host?: string;
1084
+ sessionToken?: string;
1085
+ }, _export?: boolean, _id?: DirectoryID, _sync?: DirectoryID);
1107
1086
  /**
1108
1087
  * Gets the difference between this directory and an another directory.
1109
1088
  * @param other Identifier of the directory to compare.
@@ -1153,6 +1132,10 @@ export declare class Directory extends BaseClient {
1153
1132
  * @param opts.labels Pipeline labels.
1154
1133
  */
1155
1134
  pipeline(name: string, opts?: DirectoryPipelineOpts): Directory;
1135
+ /**
1136
+ * Force evaluation in the engine.
1137
+ */
1138
+ sync(): Promise<Directory>;
1156
1139
  /**
1157
1140
  * Retrieves this directory plus a directory written at the given path.
1158
1141
  * @param path Location of the written directory (e.g., "/src/").
@@ -1205,25 +1188,9 @@ export declare class Directory extends BaseClient {
1205
1188
  */
1206
1189
  withoutFile(path: string): Directory;
1207
1190
  /**
1208
- * Chain objects together
1209
- * @example
1210
- * ```ts
1211
- * function AddAFewMounts(c) {
1212
- * return c
1213
- * .withMountedDirectory("/foo", new Client().host().directory("/Users/slumbering/forks/dagger"))
1214
- * .withMountedDirectory("/bar", new Client().host().directory("/Users/slumbering/forks/dagger/sdk/nodejs"))
1215
- * }
1216
- *
1217
- * connect(async (client) => {
1218
- * const tree = await client
1219
- * .container()
1220
- * .from("alpine")
1221
- * .withWorkdir("/foo")
1222
- * .with(AddAFewMounts)
1223
- * .withExec(["ls", "-lh"])
1224
- * .stdout()
1225
- * })
1226
- *```
1191
+ * Call the provided function with current Directory.
1192
+ *
1193
+ * This is useful for reusability and readability by not breaking the calling chain.
1227
1194
  */
1228
1195
  with(arg: (param: Directory) => Directory): Directory;
1229
1196
  }
@@ -1231,6 +1198,16 @@ export declare class Directory extends BaseClient {
1231
1198
  * A simple key value object that represents an environment variable.
1232
1199
  */
1233
1200
  export declare class EnvVariable extends BaseClient {
1201
+ private readonly _name?;
1202
+ private readonly _value?;
1203
+ /**
1204
+ * Constructor is used for internal usage only, do not create object from it.
1205
+ */
1206
+ constructor(parent?: {
1207
+ queryTree?: QueryTree[];
1208
+ host?: string;
1209
+ sessionToken?: string;
1210
+ }, _name?: string, _value?: string);
1234
1211
  /**
1235
1212
  * The environment variable name.
1236
1213
  */
@@ -1239,33 +1216,24 @@ export declare class EnvVariable extends BaseClient {
1239
1216
  * The environment variable value.
1240
1217
  */
1241
1218
  value(): Promise<string>;
1242
- /**
1243
- * Chain objects together
1244
- * @example
1245
- * ```ts
1246
- * function AddAFewMounts(c) {
1247
- * return c
1248
- * .withMountedDirectory("/foo", new Client().host().directory("/Users/slumbering/forks/dagger"))
1249
- * .withMountedDirectory("/bar", new Client().host().directory("/Users/slumbering/forks/dagger/sdk/nodejs"))
1250
- * }
1251
- *
1252
- * connect(async (client) => {
1253
- * const tree = await client
1254
- * .container()
1255
- * .from("alpine")
1256
- * .withWorkdir("/foo")
1257
- * .with(AddAFewMounts)
1258
- * .withExec(["ls", "-lh"])
1259
- * .stdout()
1260
- * })
1261
- *```
1262
- */
1263
- with(arg: (param: EnvVariable) => EnvVariable): EnvVariable;
1264
1219
  }
1265
1220
  /**
1266
1221
  * A file.
1267
1222
  */
1268
1223
  export declare class File extends BaseClient {
1224
+ private readonly _contents?;
1225
+ private readonly _export?;
1226
+ private readonly _id?;
1227
+ private readonly _size?;
1228
+ private readonly _sync?;
1229
+ /**
1230
+ * Constructor is used for internal usage only, do not create object from it.
1231
+ */
1232
+ constructor(parent?: {
1233
+ queryTree?: QueryTree[];
1234
+ host?: string;
1235
+ sessionToken?: string;
1236
+ }, _contents?: string, _export?: boolean, _id?: FileID, _size?: number, _sync?: FileID);
1269
1237
  /**
1270
1238
  * Retrieves the contents of the file.
1271
1239
  */
@@ -1281,15 +1249,14 @@ export declare class File extends BaseClient {
1281
1249
  * Retrieves the content-addressed identifier of the file.
1282
1250
  */
1283
1251
  id(): Promise<FileID>;
1284
- /**
1285
- * Retrieves a secret referencing the contents of this file.
1286
- * @deprecated insecure, leaves secret in cache. Superseded by setSecret
1287
- */
1288
- secret(): Secret;
1289
1252
  /**
1290
1253
  * Gets the size of the file, in bytes.
1291
1254
  */
1292
1255
  size(): Promise<number>;
1256
+ /**
1257
+ * Force evaluation in the engine.
1258
+ */
1259
+ sync(): Promise<File>;
1293
1260
  /**
1294
1261
  * Retrieves this file with its created/modified timestamps set to the given time.
1295
1262
  * @param timestamp Timestamp to set dir/files in.
@@ -1298,25 +1265,9 @@ export declare class File extends BaseClient {
1298
1265
  */
1299
1266
  withTimestamps(timestamp: number): File;
1300
1267
  /**
1301
- * Chain objects together
1302
- * @example
1303
- * ```ts
1304
- * function AddAFewMounts(c) {
1305
- * return c
1306
- * .withMountedDirectory("/foo", new Client().host().directory("/Users/slumbering/forks/dagger"))
1307
- * .withMountedDirectory("/bar", new Client().host().directory("/Users/slumbering/forks/dagger/sdk/nodejs"))
1308
- * }
1309
- *
1310
- * connect(async (client) => {
1311
- * const tree = await client
1312
- * .container()
1313
- * .from("alpine")
1314
- * .withWorkdir("/foo")
1315
- * .with(AddAFewMounts)
1316
- * .withExec(["ls", "-lh"])
1317
- * .stdout()
1318
- * })
1319
- *```
1268
+ * Call the provided function with current File.
1269
+ *
1270
+ * This is useful for reusability and readability by not breaking the calling chain.
1320
1271
  */
1321
1272
  with(arg: (param: File) => File): File;
1322
1273
  }
@@ -1325,49 +1276,35 @@ export declare class File extends BaseClient {
1325
1276
  */
1326
1277
  export declare class GitRef extends BaseClient {
1327
1278
  /**
1328
- * The digest of the current value of this ref.
1279
+ * Constructor is used for internal usage only, do not create object from it.
1329
1280
  */
1330
- digest(): Promise<string>;
1281
+ constructor(parent?: {
1282
+ queryTree?: QueryTree[];
1283
+ host?: string;
1284
+ sessionToken?: string;
1285
+ });
1331
1286
  /**
1332
1287
  * The filesystem tree at this ref.
1333
1288
  */
1334
1289
  tree(opts?: GitRefTreeOpts): Directory;
1335
- /**
1336
- * Chain objects together
1337
- * @example
1338
- * ```ts
1339
- * function AddAFewMounts(c) {
1340
- * return c
1341
- * .withMountedDirectory("/foo", new Client().host().directory("/Users/slumbering/forks/dagger"))
1342
- * .withMountedDirectory("/bar", new Client().host().directory("/Users/slumbering/forks/dagger/sdk/nodejs"))
1343
- * }
1344
- *
1345
- * connect(async (client) => {
1346
- * const tree = await client
1347
- * .container()
1348
- * .from("alpine")
1349
- * .withWorkdir("/foo")
1350
- * .with(AddAFewMounts)
1351
- * .withExec(["ls", "-lh"])
1352
- * .stdout()
1353
- * })
1354
- *```
1355
- */
1356
- with(arg: (param: GitRef) => GitRef): GitRef;
1357
1290
  }
1358
1291
  /**
1359
1292
  * A git repository.
1360
1293
  */
1361
1294
  export declare class GitRepository extends BaseClient {
1295
+ /**
1296
+ * Constructor is used for internal usage only, do not create object from it.
1297
+ */
1298
+ constructor(parent?: {
1299
+ queryTree?: QueryTree[];
1300
+ host?: string;
1301
+ sessionToken?: string;
1302
+ });
1362
1303
  /**
1363
1304
  * Returns details on one branch.
1364
1305
  * @param name Branch's name (e.g., "main").
1365
1306
  */
1366
1307
  branch(name: string): GitRef;
1367
- /**
1368
- * Lists of branches on the repository.
1369
- */
1370
- branches(): Promise<string[]>;
1371
1308
  /**
1372
1309
  * Returns details on one commit.
1373
1310
  * @param id Identifier of the commit (e.g., "b6315d8f2810962c601af73f86831f6866ea798b").
@@ -1378,37 +1315,19 @@ export declare class GitRepository extends BaseClient {
1378
1315
  * @param name Tag's name (e.g., "v0.3.9").
1379
1316
  */
1380
1317
  tag(name: string): GitRef;
1381
- /**
1382
- * Lists of tags on the repository.
1383
- */
1384
- tags(): Promise<string[]>;
1385
- /**
1386
- * Chain objects together
1387
- * @example
1388
- * ```ts
1389
- * function AddAFewMounts(c) {
1390
- * return c
1391
- * .withMountedDirectory("/foo", new Client().host().directory("/Users/slumbering/forks/dagger"))
1392
- * .withMountedDirectory("/bar", new Client().host().directory("/Users/slumbering/forks/dagger/sdk/nodejs"))
1393
- * }
1394
- *
1395
- * connect(async (client) => {
1396
- * const tree = await client
1397
- * .container()
1398
- * .from("alpine")
1399
- * .withWorkdir("/foo")
1400
- * .with(AddAFewMounts)
1401
- * .withExec(["ls", "-lh"])
1402
- * .stdout()
1403
- * })
1404
- *```
1405
- */
1406
- with(arg: (param: GitRepository) => GitRepository): GitRepository;
1407
1318
  }
1408
1319
  /**
1409
1320
  * Information about the host execution environment.
1410
1321
  */
1411
1322
  export declare class Host extends BaseClient {
1323
+ /**
1324
+ * Constructor is used for internal usage only, do not create object from it.
1325
+ */
1326
+ constructor(parent?: {
1327
+ queryTree?: QueryTree[];
1328
+ host?: string;
1329
+ sessionToken?: string;
1330
+ });
1412
1331
  /**
1413
1332
  * Accesses a directory on the host.
1414
1333
  * @param path Location of the directory to access (e.g., ".").
@@ -1416,91 +1335,38 @@ export declare class Host extends BaseClient {
1416
1335
  * @param opts.include Include only artifacts that match the given pattern (e.g., ["app/", "package.*"]).
1417
1336
  */
1418
1337
  directory(path: string, opts?: HostDirectoryOpts): Directory;
1419
- /**
1420
- * Accesses an environment variable on the host.
1421
- * @param name Name of the environment variable (e.g., "PATH").
1422
- */
1423
- envVariable(name: string): HostVariable;
1424
1338
  /**
1425
1339
  * Accesses a file on the host.
1426
1340
  * @param path Location of the file to retrieve (e.g., "README.md").
1427
1341
  */
1428
1342
  file(path: string): File;
1343
+ /**
1344
+ * Sets a secret given a user-defined name and the file path on the host, and returns the secret.
1345
+ * The file is limited to a size of 512000 bytes.
1346
+ * @param name The user defined name for this secret.
1347
+ * @param path Location of the file to set as a secret.
1348
+ */
1349
+ setSecretFile(name: string, path: string): Secret;
1429
1350
  /**
1430
1351
  * Accesses a Unix socket on the host.
1431
1352
  * @param path Location of the Unix socket (e.g., "/var/run/docker.sock").
1432
1353
  */
1433
1354
  unixSocket(path: string): Socket;
1434
- /**
1435
- * Retrieves the current working directory on the host.
1436
- * @param opts.exclude Exclude artifacts that match the given pattern (e.g., ["node_modules/", ".git*"]).
1437
- * @param opts.include Include only artifacts that match the given pattern (e.g., ["app/", "package.*"]).
1438
- * @deprecated Use directory with path set to '.' instead.
1439
- */
1440
- workdir(opts?: HostWorkdirOpts): Directory;
1441
- /**
1442
- * Chain objects together
1443
- * @example
1444
- * ```ts
1445
- * function AddAFewMounts(c) {
1446
- * return c
1447
- * .withMountedDirectory("/foo", new Client().host().directory("/Users/slumbering/forks/dagger"))
1448
- * .withMountedDirectory("/bar", new Client().host().directory("/Users/slumbering/forks/dagger/sdk/nodejs"))
1449
- * }
1450
- *
1451
- * connect(async (client) => {
1452
- * const tree = await client
1453
- * .container()
1454
- * .from("alpine")
1455
- * .withWorkdir("/foo")
1456
- * .with(AddAFewMounts)
1457
- * .withExec(["ls", "-lh"])
1458
- * .stdout()
1459
- * })
1460
- *```
1461
- */
1462
- with(arg: (param: Host) => Host): Host;
1463
- }
1464
- /**
1465
- * An environment variable on the host environment.
1466
- */
1467
- export declare class HostVariable extends BaseClient {
1468
- /**
1469
- * A secret referencing the value of this variable.
1470
- * @deprecated been superseded by setSecret
1471
- */
1472
- secret(): Secret;
1473
- /**
1474
- * The value of this variable.
1475
- */
1476
- value(): Promise<string>;
1477
- /**
1478
- * Chain objects together
1479
- * @example
1480
- * ```ts
1481
- * function AddAFewMounts(c) {
1482
- * return c
1483
- * .withMountedDirectory("/foo", new Client().host().directory("/Users/slumbering/forks/dagger"))
1484
- * .withMountedDirectory("/bar", new Client().host().directory("/Users/slumbering/forks/dagger/sdk/nodejs"))
1485
- * }
1486
- *
1487
- * connect(async (client) => {
1488
- * const tree = await client
1489
- * .container()
1490
- * .from("alpine")
1491
- * .withWorkdir("/foo")
1492
- * .with(AddAFewMounts)
1493
- * .withExec(["ls", "-lh"])
1494
- * .stdout()
1495
- * })
1496
- *```
1497
- */
1498
- with(arg: (param: HostVariable) => HostVariable): HostVariable;
1499
1355
  }
1500
1356
  /**
1501
1357
  * A simple key value object that represents a label.
1502
1358
  */
1503
1359
  export declare class Label extends BaseClient {
1360
+ private readonly _name?;
1361
+ private readonly _value?;
1362
+ /**
1363
+ * Constructor is used for internal usage only, do not create object from it.
1364
+ */
1365
+ constructor(parent?: {
1366
+ queryTree?: QueryTree[];
1367
+ host?: string;
1368
+ sessionToken?: string;
1369
+ }, _name?: string, _value?: string);
1504
1370
  /**
1505
1371
  * The label name.
1506
1372
  */
@@ -1509,33 +1375,22 @@ export declare class Label extends BaseClient {
1509
1375
  * The label value.
1510
1376
  */
1511
1377
  value(): Promise<string>;
1512
- /**
1513
- * Chain objects together
1514
- * @example
1515
- * ```ts
1516
- * function AddAFewMounts(c) {
1517
- * return c
1518
- * .withMountedDirectory("/foo", new Client().host().directory("/Users/slumbering/forks/dagger"))
1519
- * .withMountedDirectory("/bar", new Client().host().directory("/Users/slumbering/forks/dagger/sdk/nodejs"))
1520
- * }
1521
- *
1522
- * connect(async (client) => {
1523
- * const tree = await client
1524
- * .container()
1525
- * .from("alpine")
1526
- * .withWorkdir("/foo")
1527
- * .with(AddAFewMounts)
1528
- * .withExec(["ls", "-lh"])
1529
- * .stdout()
1530
- * })
1531
- *```
1532
- */
1533
- with(arg: (param: Label) => Label): Label;
1534
1378
  }
1535
1379
  /**
1536
1380
  * A port exposed by a container.
1537
1381
  */
1538
1382
  export declare class Port extends BaseClient {
1383
+ private readonly _description?;
1384
+ private readonly _port?;
1385
+ private readonly _protocol?;
1386
+ /**
1387
+ * Constructor is used for internal usage only, do not create object from it.
1388
+ */
1389
+ constructor(parent?: {
1390
+ queryTree?: QueryTree[];
1391
+ host?: string;
1392
+ sessionToken?: string;
1393
+ }, _description?: string, _port?: number, _protocol?: NetworkProtocol);
1539
1394
  /**
1540
1395
  * The port description.
1541
1396
  */
@@ -1548,33 +1403,21 @@ export declare class Port extends BaseClient {
1548
1403
  * The transport layer network protocol.
1549
1404
  */
1550
1405
  protocol(): Promise<NetworkProtocol>;
1551
- /**
1552
- * Chain objects together
1553
- * @example
1554
- * ```ts
1555
- * function AddAFewMounts(c) {
1556
- * return c
1557
- * .withMountedDirectory("/foo", new Client().host().directory("/Users/slumbering/forks/dagger"))
1558
- * .withMountedDirectory("/bar", new Client().host().directory("/Users/slumbering/forks/dagger/sdk/nodejs"))
1559
- * }
1560
- *
1561
- * connect(async (client) => {
1562
- * const tree = await client
1563
- * .container()
1564
- * .from("alpine")
1565
- * .withWorkdir("/foo")
1566
- * .with(AddAFewMounts)
1567
- * .withExec(["ls", "-lh"])
1568
- * .stdout()
1569
- * })
1570
- *```
1571
- */
1572
- with(arg: (param: Port) => Port): Port;
1573
1406
  }
1574
1407
  /**
1575
1408
  * A collection of Dagger resources that can be queried and invoked.
1576
1409
  */
1577
1410
  export declare class Project extends BaseClient {
1411
+ private readonly _id?;
1412
+ private readonly _name?;
1413
+ /**
1414
+ * Constructor is used for internal usage only, do not create object from it.
1415
+ */
1416
+ constructor(parent?: {
1417
+ queryTree?: QueryTree[];
1418
+ host?: string;
1419
+ sessionToken?: string;
1420
+ }, _id?: ProjectID, _name?: string);
1578
1421
  /**
1579
1422
  * Commands provided by this project
1580
1423
  */
@@ -1592,25 +1435,9 @@ export declare class Project extends BaseClient {
1592
1435
  */
1593
1436
  name(): Promise<string>;
1594
1437
  /**
1595
- * Chain objects together
1596
- * @example
1597
- * ```ts
1598
- * function AddAFewMounts(c) {
1599
- * return c
1600
- * .withMountedDirectory("/foo", new Client().host().directory("/Users/slumbering/forks/dagger"))
1601
- * .withMountedDirectory("/bar", new Client().host().directory("/Users/slumbering/forks/dagger/sdk/nodejs"))
1602
- * }
1603
- *
1604
- * connect(async (client) => {
1605
- * const tree = await client
1606
- * .container()
1607
- * .from("alpine")
1608
- * .withWorkdir("/foo")
1609
- * .with(AddAFewMounts)
1610
- * .withExec(["ls", "-lh"])
1611
- * .stdout()
1612
- * })
1613
- *```
1438
+ * Call the provided function with current Project.
1439
+ *
1440
+ * This is useful for reusability and readability by not breaking the calling chain.
1614
1441
  */
1615
1442
  with(arg: (param: Project) => Project): Project;
1616
1443
  }
@@ -1618,6 +1445,18 @@ export declare class Project extends BaseClient {
1618
1445
  * A command defined in a project that can be invoked from the CLI.
1619
1446
  */
1620
1447
  export declare class ProjectCommand extends BaseClient {
1448
+ private readonly _description?;
1449
+ private readonly _id?;
1450
+ private readonly _name?;
1451
+ private readonly _resultType?;
1452
+ /**
1453
+ * Constructor is used for internal usage only, do not create object from it.
1454
+ */
1455
+ constructor(parent?: {
1456
+ queryTree?: QueryTree[];
1457
+ host?: string;
1458
+ sessionToken?: string;
1459
+ }, _description?: string, _id?: ProjectCommandID, _name?: string, _resultType?: string);
1621
1460
  /**
1622
1461
  * Documentation for what this command does.
1623
1462
  */
@@ -1642,33 +1481,21 @@ export declare class ProjectCommand extends BaseClient {
1642
1481
  * Subcommands, if any, that this command provides.
1643
1482
  */
1644
1483
  subcommands(): Promise<ProjectCommand[]>;
1645
- /**
1646
- * Chain objects together
1647
- * @example
1648
- * ```ts
1649
- * function AddAFewMounts(c) {
1650
- * return c
1651
- * .withMountedDirectory("/foo", new Client().host().directory("/Users/slumbering/forks/dagger"))
1652
- * .withMountedDirectory("/bar", new Client().host().directory("/Users/slumbering/forks/dagger/sdk/nodejs"))
1653
- * }
1654
- *
1655
- * connect(async (client) => {
1656
- * const tree = await client
1657
- * .container()
1658
- * .from("alpine")
1659
- * .withWorkdir("/foo")
1660
- * .with(AddAFewMounts)
1661
- * .withExec(["ls", "-lh"])
1662
- * .stdout()
1663
- * })
1664
- *```
1665
- */
1666
- with(arg: (param: ProjectCommand) => ProjectCommand): ProjectCommand;
1667
1484
  }
1668
1485
  /**
1669
1486
  * A flag accepted by a project command.
1670
1487
  */
1671
1488
  export declare class ProjectCommandFlag extends BaseClient {
1489
+ private readonly _description?;
1490
+ private readonly _name?;
1491
+ /**
1492
+ * Constructor is used for internal usage only, do not create object from it.
1493
+ */
1494
+ constructor(parent?: {
1495
+ queryTree?: QueryTree[];
1496
+ host?: string;
1497
+ sessionToken?: string;
1498
+ }, _description?: string, _name?: string);
1672
1499
  /**
1673
1500
  * Documentation for what this flag sets.
1674
1501
  */
@@ -1677,35 +1504,28 @@ export declare class ProjectCommandFlag extends BaseClient {
1677
1504
  * The name of the flag.
1678
1505
  */
1679
1506
  name(): Promise<string>;
1680
- /**
1681
- * Chain objects together
1682
- * @example
1683
- * ```ts
1684
- * function AddAFewMounts(c) {
1685
- * return c
1686
- * .withMountedDirectory("/foo", new Client().host().directory("/Users/slumbering/forks/dagger"))
1687
- * .withMountedDirectory("/bar", new Client().host().directory("/Users/slumbering/forks/dagger/sdk/nodejs"))
1688
- * }
1689
- *
1690
- * connect(async (client) => {
1691
- * const tree = await client
1692
- * .container()
1693
- * .from("alpine")
1694
- * .withWorkdir("/foo")
1695
- * .with(AddAFewMounts)
1696
- * .withExec(["ls", "-lh"])
1697
- * .stdout()
1698
- * })
1699
- *```
1700
- */
1701
- with(arg: (param: ProjectCommandFlag) => ProjectCommandFlag): ProjectCommandFlag;
1702
1507
  }
1703
- export default class Client extends BaseClient {
1508
+ export declare class Client extends BaseClient {
1509
+ private readonly _checkVersionCompatibility?;
1510
+ private readonly _defaultPlatform?;
1511
+ /**
1512
+ * Constructor is used for internal usage only, do not create object from it.
1513
+ */
1514
+ constructor(parent?: {
1515
+ queryTree?: QueryTree[];
1516
+ host?: string;
1517
+ sessionToken?: string;
1518
+ }, _checkVersionCompatibility?: boolean, _defaultPlatform?: Platform);
1704
1519
  /**
1705
1520
  * Constructs a cache volume for a given cache key.
1706
1521
  * @param key A string identifier to target this cache volume (e.g., "modules-cache").
1707
1522
  */
1708
1523
  cacheVolume(key: string): CacheVolume;
1524
+ /**
1525
+ * Checks if the current Dagger Engine is compatible with an SDK's required version.
1526
+ * @param version The SDK's required version.
1527
+ */
1528
+ checkVersionCompatibility(version: string): Promise<boolean>;
1709
1529
  /**
1710
1530
  * Loads a container from ID.
1711
1531
  *
@@ -1775,11 +1595,27 @@ export default class Client extends BaseClient {
1775
1595
  * Loads a socket by its ID.
1776
1596
  */
1777
1597
  socket(opts?: ClientSocketOpts): Socket;
1598
+ /**
1599
+ * Call the provided function with current Client.
1600
+ *
1601
+ * This is useful for reusability and readability by not breaking the calling chain.
1602
+ */
1603
+ with(arg: (param: Client) => Client): Client;
1778
1604
  }
1779
1605
  /**
1780
1606
  * A reference to a secret value, which can be handled more safely than the value itself.
1781
1607
  */
1782
1608
  export declare class Secret extends BaseClient {
1609
+ private readonly _id?;
1610
+ private readonly _plaintext?;
1611
+ /**
1612
+ * Constructor is used for internal usage only, do not create object from it.
1613
+ */
1614
+ constructor(parent?: {
1615
+ queryTree?: QueryTree[];
1616
+ host?: string;
1617
+ sessionToken?: string;
1618
+ }, _id?: SecretID, _plaintext?: string);
1783
1619
  /**
1784
1620
  * The identifier for this secret.
1785
1621
  */
@@ -1788,56 +1624,21 @@ export declare class Secret extends BaseClient {
1788
1624
  * The value of this secret.
1789
1625
  */
1790
1626
  plaintext(): Promise<string>;
1791
- /**
1792
- * Chain objects together
1793
- * @example
1794
- * ```ts
1795
- * function AddAFewMounts(c) {
1796
- * return c
1797
- * .withMountedDirectory("/foo", new Client().host().directory("/Users/slumbering/forks/dagger"))
1798
- * .withMountedDirectory("/bar", new Client().host().directory("/Users/slumbering/forks/dagger/sdk/nodejs"))
1799
- * }
1800
- *
1801
- * connect(async (client) => {
1802
- * const tree = await client
1803
- * .container()
1804
- * .from("alpine")
1805
- * .withWorkdir("/foo")
1806
- * .with(AddAFewMounts)
1807
- * .withExec(["ls", "-lh"])
1808
- * .stdout()
1809
- * })
1810
- *```
1811
- */
1812
- with(arg: (param: Secret) => Secret): Secret;
1813
1627
  }
1814
1628
  export declare class Socket extends BaseClient {
1629
+ private readonly _id?;
1630
+ /**
1631
+ * Constructor is used for internal usage only, do not create object from it.
1632
+ */
1633
+ constructor(parent?: {
1634
+ queryTree?: QueryTree[];
1635
+ host?: string;
1636
+ sessionToken?: string;
1637
+ }, _id?: SocketID);
1815
1638
  /**
1816
1639
  * The content-addressed identifier of the socket.
1817
1640
  */
1818
1641
  id(): Promise<SocketID>;
1819
- /**
1820
- * Chain objects together
1821
- * @example
1822
- * ```ts
1823
- * function AddAFewMounts(c) {
1824
- * return c
1825
- * .withMountedDirectory("/foo", new Client().host().directory("/Users/slumbering/forks/dagger"))
1826
- * .withMountedDirectory("/bar", new Client().host().directory("/Users/slumbering/forks/dagger/sdk/nodejs"))
1827
- * }
1828
- *
1829
- * connect(async (client) => {
1830
- * const tree = await client
1831
- * .container()
1832
- * .from("alpine")
1833
- * .withWorkdir("/foo")
1834
- * .with(AddAFewMounts)
1835
- * .withExec(["ls", "-lh"])
1836
- * .stdout()
1837
- * })
1838
- *```
1839
- */
1840
- with(arg: (param: Socket) => Socket): Socket;
1841
1642
  }
1842
1643
  export {};
1843
1644
  //# sourceMappingURL=client.gen.d.ts.map