@dagger.io/dagger 0.18.17 → 0.18.19
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.
- package/dist/src/api/client.gen.d.ts +361 -5
- package/dist/src/api/client.gen.d.ts.map +1 -1
- package/dist/src/api/client.gen.js +521 -3
- package/dist/src/common/utils.d.ts +1 -0
- package/dist/src/common/utils.d.ts.map +1 -1
- package/dist/src/module/introspector/dagger_module/module.d.ts +4 -0
- package/dist/src/module/introspector/dagger_module/module.d.ts.map +1 -1
- package/dist/src/module/introspector/dagger_module/module.js +35 -13
- package/dist/src/module/introspector/typescript_module/ast.d.ts +1 -0
- package/dist/src/module/introspector/typescript_module/ast.d.ts.map +1 -1
- package/dist/src/module/introspector/typescript_module/ast.js +33 -0
- package/dist/src/provisioning/default.d.ts +1 -1
- package/dist/src/provisioning/default.js +1 -1
- package/package.json +22 -22
|
@@ -505,6 +505,99 @@ function TypeDefKindNameToValue(name) {
|
|
|
505
505
|
return name;
|
|
506
506
|
}
|
|
507
507
|
}
|
|
508
|
+
/**
|
|
509
|
+
* A standardized address to load containers, directories, secrets, and other object types. Address format depends on the type, and is validated at type selection.
|
|
510
|
+
*/
|
|
511
|
+
export class Address extends BaseClient {
|
|
512
|
+
_id = undefined;
|
|
513
|
+
_value = undefined;
|
|
514
|
+
/**
|
|
515
|
+
* Constructor is used for internal usage only, do not create object from it.
|
|
516
|
+
*/
|
|
517
|
+
constructor(ctx, _id, _value) {
|
|
518
|
+
super(ctx);
|
|
519
|
+
this._id = _id;
|
|
520
|
+
this._value = _value;
|
|
521
|
+
}
|
|
522
|
+
/**
|
|
523
|
+
* A unique identifier for this Address.
|
|
524
|
+
*/
|
|
525
|
+
id = async () => {
|
|
526
|
+
if (this._id) {
|
|
527
|
+
return this._id;
|
|
528
|
+
}
|
|
529
|
+
const ctx = this._ctx.select("id");
|
|
530
|
+
const response = await ctx.execute();
|
|
531
|
+
return response;
|
|
532
|
+
};
|
|
533
|
+
/**
|
|
534
|
+
* Load a container from the address.
|
|
535
|
+
*/
|
|
536
|
+
container = () => {
|
|
537
|
+
const ctx = this._ctx.select("container");
|
|
538
|
+
return new Container(ctx);
|
|
539
|
+
};
|
|
540
|
+
/**
|
|
541
|
+
* Load a directory from the address.
|
|
542
|
+
*/
|
|
543
|
+
directory = (opts) => {
|
|
544
|
+
const ctx = this._ctx.select("directory", { ...opts });
|
|
545
|
+
return new Directory(ctx);
|
|
546
|
+
};
|
|
547
|
+
/**
|
|
548
|
+
* Load a file from the address.
|
|
549
|
+
*/
|
|
550
|
+
file = (opts) => {
|
|
551
|
+
const ctx = this._ctx.select("file", { ...opts });
|
|
552
|
+
return new File(ctx);
|
|
553
|
+
};
|
|
554
|
+
/**
|
|
555
|
+
* Load a git ref (branch, tag or commit) from the address.
|
|
556
|
+
*/
|
|
557
|
+
gitRef = () => {
|
|
558
|
+
const ctx = this._ctx.select("gitRef");
|
|
559
|
+
return new GitRef(ctx);
|
|
560
|
+
};
|
|
561
|
+
/**
|
|
562
|
+
* Load a git repository from the address.
|
|
563
|
+
*/
|
|
564
|
+
gitRepository = () => {
|
|
565
|
+
const ctx = this._ctx.select("gitRepository");
|
|
566
|
+
return new GitRepository(ctx);
|
|
567
|
+
};
|
|
568
|
+
/**
|
|
569
|
+
* Load a secret from the address.
|
|
570
|
+
*/
|
|
571
|
+
secret = () => {
|
|
572
|
+
const ctx = this._ctx.select("secret");
|
|
573
|
+
return new Secret(ctx);
|
|
574
|
+
};
|
|
575
|
+
/**
|
|
576
|
+
* Load a service from the address.
|
|
577
|
+
*/
|
|
578
|
+
service = () => {
|
|
579
|
+
const ctx = this._ctx.select("service");
|
|
580
|
+
return new Service(ctx);
|
|
581
|
+
};
|
|
582
|
+
/**
|
|
583
|
+
* Load a local socket from the address.
|
|
584
|
+
*/
|
|
585
|
+
socket = () => {
|
|
586
|
+
const ctx = this._ctx.select("socket");
|
|
587
|
+
return new Socket(ctx);
|
|
588
|
+
};
|
|
589
|
+
/**
|
|
590
|
+
* The address value
|
|
591
|
+
*/
|
|
592
|
+
value = async () => {
|
|
593
|
+
if (this._value) {
|
|
594
|
+
return this._value;
|
|
595
|
+
}
|
|
596
|
+
const ctx = this._ctx.select("value");
|
|
597
|
+
const response = await ctx.execute();
|
|
598
|
+
return response;
|
|
599
|
+
};
|
|
600
|
+
}
|
|
508
601
|
export class Binding extends BaseClient {
|
|
509
602
|
_id = undefined;
|
|
510
603
|
_asString = undefined;
|
|
@@ -535,6 +628,13 @@ export class Binding extends BaseClient {
|
|
|
535
628
|
const response = await ctx.execute();
|
|
536
629
|
return response;
|
|
537
630
|
};
|
|
631
|
+
/**
|
|
632
|
+
* Retrieve the binding value, as type Address
|
|
633
|
+
*/
|
|
634
|
+
asAddress = () => {
|
|
635
|
+
const ctx = this._ctx.select("asAddress");
|
|
636
|
+
return new Address(ctx);
|
|
637
|
+
};
|
|
538
638
|
/**
|
|
539
639
|
* Retrieve the binding value, as type CacheVolume
|
|
540
640
|
*/
|
|
@@ -542,6 +642,13 @@ export class Binding extends BaseClient {
|
|
|
542
642
|
const ctx = this._ctx.select("asCacheVolume");
|
|
543
643
|
return new CacheVolume(ctx);
|
|
544
644
|
};
|
|
645
|
+
/**
|
|
646
|
+
* Retrieve the binding value, as type Changeset
|
|
647
|
+
*/
|
|
648
|
+
asChangeset = () => {
|
|
649
|
+
const ctx = this._ctx.select("asChangeset");
|
|
650
|
+
return new Changeset(ctx);
|
|
651
|
+
};
|
|
545
652
|
/**
|
|
546
653
|
* Retrieve the binding value, as type Cloud
|
|
547
654
|
*/
|
|
@@ -570,6 +677,13 @@ export class Binding extends BaseClient {
|
|
|
570
677
|
const ctx = this._ctx.select("asEnv");
|
|
571
678
|
return new Env(ctx);
|
|
572
679
|
};
|
|
680
|
+
/**
|
|
681
|
+
* Retrieve the binding value, as type EnvFile
|
|
682
|
+
*/
|
|
683
|
+
asEnvFile = () => {
|
|
684
|
+
const ctx = this._ctx.select("asEnvFile");
|
|
685
|
+
return new EnvFile(ctx);
|
|
686
|
+
};
|
|
573
687
|
/**
|
|
574
688
|
* Retrieve the binding value, as type File
|
|
575
689
|
*/
|
|
@@ -741,6 +855,106 @@ export class CacheVolume extends BaseClient {
|
|
|
741
855
|
return response;
|
|
742
856
|
};
|
|
743
857
|
}
|
|
858
|
+
/**
|
|
859
|
+
* A comparison between two directories representing changes that can be applied.
|
|
860
|
+
*/
|
|
861
|
+
export class Changeset extends BaseClient {
|
|
862
|
+
_id = undefined;
|
|
863
|
+
_export = undefined;
|
|
864
|
+
_sync = undefined;
|
|
865
|
+
/**
|
|
866
|
+
* Constructor is used for internal usage only, do not create object from it.
|
|
867
|
+
*/
|
|
868
|
+
constructor(ctx, _id, _export, _sync) {
|
|
869
|
+
super(ctx);
|
|
870
|
+
this._id = _id;
|
|
871
|
+
this._export = _export;
|
|
872
|
+
this._sync = _sync;
|
|
873
|
+
}
|
|
874
|
+
/**
|
|
875
|
+
* A unique identifier for this Changeset.
|
|
876
|
+
*/
|
|
877
|
+
id = async () => {
|
|
878
|
+
if (this._id) {
|
|
879
|
+
return this._id;
|
|
880
|
+
}
|
|
881
|
+
const ctx = this._ctx.select("id");
|
|
882
|
+
const response = await ctx.execute();
|
|
883
|
+
return response;
|
|
884
|
+
};
|
|
885
|
+
/**
|
|
886
|
+
* Files and directories that were added in the newer directory.
|
|
887
|
+
*/
|
|
888
|
+
addedPaths = async () => {
|
|
889
|
+
const ctx = this._ctx.select("addedPaths");
|
|
890
|
+
const response = await ctx.execute();
|
|
891
|
+
return response;
|
|
892
|
+
};
|
|
893
|
+
/**
|
|
894
|
+
* The newer/upper snapshot.
|
|
895
|
+
*/
|
|
896
|
+
after = () => {
|
|
897
|
+
const ctx = this._ctx.select("after");
|
|
898
|
+
return new Directory(ctx);
|
|
899
|
+
};
|
|
900
|
+
/**
|
|
901
|
+
* Return a Git-compatible patch of the changes
|
|
902
|
+
*/
|
|
903
|
+
asPatch = () => {
|
|
904
|
+
const ctx = this._ctx.select("asPatch");
|
|
905
|
+
return new File(ctx);
|
|
906
|
+
};
|
|
907
|
+
/**
|
|
908
|
+
* The older/lower snapshot to compare against.
|
|
909
|
+
*/
|
|
910
|
+
before = () => {
|
|
911
|
+
const ctx = this._ctx.select("before");
|
|
912
|
+
return new Directory(ctx);
|
|
913
|
+
};
|
|
914
|
+
/**
|
|
915
|
+
* Applies the diff represented by this changeset to a path on the host.
|
|
916
|
+
* @param path Location of the copied directory (e.g., "logs/").
|
|
917
|
+
*/
|
|
918
|
+
export = async (path) => {
|
|
919
|
+
if (this._export) {
|
|
920
|
+
return this._export;
|
|
921
|
+
}
|
|
922
|
+
const ctx = this._ctx.select("export", { path });
|
|
923
|
+
const response = await ctx.execute();
|
|
924
|
+
return response;
|
|
925
|
+
};
|
|
926
|
+
/**
|
|
927
|
+
* Return a snapshot containing only the created and modified files
|
|
928
|
+
*/
|
|
929
|
+
layer = () => {
|
|
930
|
+
const ctx = this._ctx.select("layer");
|
|
931
|
+
return new Directory(ctx);
|
|
932
|
+
};
|
|
933
|
+
/**
|
|
934
|
+
* Files and directories that existed before and were updated in the newer directory.
|
|
935
|
+
*/
|
|
936
|
+
modifiedPaths = async () => {
|
|
937
|
+
const ctx = this._ctx.select("modifiedPaths");
|
|
938
|
+
const response = await ctx.execute();
|
|
939
|
+
return response;
|
|
940
|
+
};
|
|
941
|
+
/**
|
|
942
|
+
* Files and directories that were removed. Directories are indicated by a trailing slash, and their child paths are not included.
|
|
943
|
+
*/
|
|
944
|
+
removedPaths = async () => {
|
|
945
|
+
const ctx = this._ctx.select("removedPaths");
|
|
946
|
+
const response = await ctx.execute();
|
|
947
|
+
return response;
|
|
948
|
+
};
|
|
949
|
+
/**
|
|
950
|
+
* Force evaluation in the engine.
|
|
951
|
+
*/
|
|
952
|
+
sync = async () => {
|
|
953
|
+
const ctx = this._ctx.select("sync");
|
|
954
|
+
const response = await ctx.execute();
|
|
955
|
+
return new Client(ctx.copy()).loadChangesetFromID(response);
|
|
956
|
+
};
|
|
957
|
+
}
|
|
744
958
|
/**
|
|
745
959
|
* Dagger Cloud configuration and state
|
|
746
960
|
*/
|
|
@@ -1874,17 +2088,19 @@ export class Directory extends BaseClient {
|
|
|
1874
2088
|
_digest = undefined;
|
|
1875
2089
|
_exists = undefined;
|
|
1876
2090
|
_export = undefined;
|
|
2091
|
+
_findUp = undefined;
|
|
1877
2092
|
_name = undefined;
|
|
1878
2093
|
_sync = undefined;
|
|
1879
2094
|
/**
|
|
1880
2095
|
* Constructor is used for internal usage only, do not create object from it.
|
|
1881
2096
|
*/
|
|
1882
|
-
constructor(ctx, _id, _digest, _exists, _export, _name, _sync) {
|
|
2097
|
+
constructor(ctx, _id, _digest, _exists, _export, _findUp, _name, _sync) {
|
|
1883
2098
|
super(ctx);
|
|
1884
2099
|
this._id = _id;
|
|
1885
2100
|
this._digest = _digest;
|
|
1886
2101
|
this._exists = _exists;
|
|
1887
2102
|
this._export = _export;
|
|
2103
|
+
this._findUp = _findUp;
|
|
1888
2104
|
this._name = _name;
|
|
1889
2105
|
this._sync = _sync;
|
|
1890
2106
|
}
|
|
@@ -1926,6 +2142,29 @@ export class Directory extends BaseClient {
|
|
|
1926
2142
|
const ctx = this._ctx.select("asModuleSource", { ...opts });
|
|
1927
2143
|
return new ModuleSource(ctx);
|
|
1928
2144
|
};
|
|
2145
|
+
/**
|
|
2146
|
+
* Return the difference between this directory and another directory, typically an older snapshot.
|
|
2147
|
+
*
|
|
2148
|
+
* The difference is encoded as a changeset, which also tracks removed files, and can be applied to other directories.
|
|
2149
|
+
* @param from The base directory snapshot to compare against
|
|
2150
|
+
*/
|
|
2151
|
+
changes = (from) => {
|
|
2152
|
+
const ctx = this._ctx.select("changes", { from });
|
|
2153
|
+
return new Changeset(ctx);
|
|
2154
|
+
};
|
|
2155
|
+
/**
|
|
2156
|
+
* Change the owner of the directory contents recursively.
|
|
2157
|
+
* @param path Path of the directory to change ownership of (e.g., "/").
|
|
2158
|
+
* @param owner A user:group to set for the mounted directory and its contents.
|
|
2159
|
+
*
|
|
2160
|
+
* The user and group must be an ID (1000:1000), not a name (foo:bar).
|
|
2161
|
+
*
|
|
2162
|
+
* If the group is omitted, it defaults to the same as the user.
|
|
2163
|
+
*/
|
|
2164
|
+
chown = (path, owner) => {
|
|
2165
|
+
const ctx = this._ctx.select("chown", { path, owner });
|
|
2166
|
+
return new Directory(ctx);
|
|
2167
|
+
};
|
|
1929
2168
|
/**
|
|
1930
2169
|
* Return the difference between this directory and an another directory. The difference is encoded as a directory.
|
|
1931
2170
|
* @param other The directory to compare against
|
|
@@ -2030,6 +2269,19 @@ export class Directory extends BaseClient {
|
|
|
2030
2269
|
const ctx = this._ctx.select("filter", { ...opts });
|
|
2031
2270
|
return new Directory(ctx);
|
|
2032
2271
|
};
|
|
2272
|
+
/**
|
|
2273
|
+
* Search up the directory tree for a file or directory, and return its path. If no match, return null
|
|
2274
|
+
* @param name The name of the file or directory to search for
|
|
2275
|
+
* @param start The path to start the search from
|
|
2276
|
+
*/
|
|
2277
|
+
findUp = async (name, start) => {
|
|
2278
|
+
if (this._findUp) {
|
|
2279
|
+
return this._findUp;
|
|
2280
|
+
}
|
|
2281
|
+
const ctx = this._ctx.select("findUp", { name, start });
|
|
2282
|
+
const response = await ctx.execute();
|
|
2283
|
+
return response;
|
|
2284
|
+
};
|
|
2033
2285
|
/**
|
|
2034
2286
|
* Returns a list of files and directories that matche the given pattern.
|
|
2035
2287
|
* @param pattern Pattern to match (e.g., "*.md").
|
|
@@ -2090,12 +2342,25 @@ export class Directory extends BaseClient {
|
|
|
2090
2342
|
const ctx = this._ctx.select("terminal", { ...opts });
|
|
2091
2343
|
return new Directory(ctx);
|
|
2092
2344
|
};
|
|
2345
|
+
/**
|
|
2346
|
+
* Return a directory with changes from another directory applied to it.
|
|
2347
|
+
* @param changes Changes to apply to the directory
|
|
2348
|
+
*/
|
|
2349
|
+
withChanges = (changes) => {
|
|
2350
|
+
const ctx = this._ctx.select("withChanges", { changes });
|
|
2351
|
+
return new Directory(ctx);
|
|
2352
|
+
};
|
|
2093
2353
|
/**
|
|
2094
2354
|
* Return a snapshot with a directory added
|
|
2095
2355
|
* @param path Location of the written directory (e.g., "/src/").
|
|
2096
2356
|
* @param directory Identifier of the directory to copy.
|
|
2097
2357
|
* @param opts.exclude Exclude artifacts that match the given pattern (e.g., ["node_modules/", ".git*"]).
|
|
2098
2358
|
* @param opts.include Include only artifacts that match the given pattern (e.g., ["app/", "package.*"]).
|
|
2359
|
+
* @param opts.owner A user:group to set for the copied directory and its contents.
|
|
2360
|
+
*
|
|
2361
|
+
* The user and group must be an ID (1000:1000), not a name (foo:bar).
|
|
2362
|
+
*
|
|
2363
|
+
* If the group is omitted, it defaults to the same as the user.
|
|
2099
2364
|
*/
|
|
2100
2365
|
withDirectory = (path, directory, opts) => {
|
|
2101
2366
|
const ctx = this._ctx.select("withDirectory", { path, directory, ...opts });
|
|
@@ -2106,6 +2371,11 @@ export class Directory extends BaseClient {
|
|
|
2106
2371
|
* @param path Location of the copied file (e.g., "/file.txt").
|
|
2107
2372
|
* @param source Identifier of the file to copy.
|
|
2108
2373
|
* @param opts.permissions Permission given to the copied file (e.g., 0600).
|
|
2374
|
+
* @param opts.owner A user:group to set for the copied directory and its contents.
|
|
2375
|
+
*
|
|
2376
|
+
* The user and group must be an ID (1000:1000), not a name (foo:bar).
|
|
2377
|
+
*
|
|
2378
|
+
* If the group is omitted, it defaults to the same as the user.
|
|
2109
2379
|
*/
|
|
2110
2380
|
withFile = (path, source, opts) => {
|
|
2111
2381
|
const ctx = this._ctx.select("withFile", { path, source, ...opts });
|
|
@@ -2149,6 +2419,15 @@ export class Directory extends BaseClient {
|
|
|
2149
2419
|
const ctx = this._ctx.select("withPatch", { patch });
|
|
2150
2420
|
return new Directory(ctx);
|
|
2151
2421
|
};
|
|
2422
|
+
/**
|
|
2423
|
+
* Retrieves this directory with the given Git-compatible patch file applied.
|
|
2424
|
+
* @param patch File containing the patch to apply
|
|
2425
|
+
* @experimental
|
|
2426
|
+
*/
|
|
2427
|
+
withPatchFile = (patch) => {
|
|
2428
|
+
const ctx = this._ctx.select("withPatchFile", { patch });
|
|
2429
|
+
return new Directory(ctx);
|
|
2430
|
+
};
|
|
2152
2431
|
/**
|
|
2153
2432
|
* Return a snapshot with a symlink
|
|
2154
2433
|
* @param target Location of the file or directory to link to (e.g., "/existing/file").
|
|
@@ -2695,6 +2974,29 @@ export class Env extends BaseClient {
|
|
|
2695
2974
|
const response = await ctx.execute();
|
|
2696
2975
|
return response.map((r) => new Client(ctx.copy()).loadBindingFromID(r.id));
|
|
2697
2976
|
};
|
|
2977
|
+
/**
|
|
2978
|
+
* Create or update a binding of type Address in the environment
|
|
2979
|
+
* @param name The name of the binding
|
|
2980
|
+
* @param value The Address value to assign to the binding
|
|
2981
|
+
* @param description The purpose of the input
|
|
2982
|
+
*/
|
|
2983
|
+
withAddressInput = (name, value, description) => {
|
|
2984
|
+
const ctx = this._ctx.select("withAddressInput", {
|
|
2985
|
+
name,
|
|
2986
|
+
value,
|
|
2987
|
+
description,
|
|
2988
|
+
});
|
|
2989
|
+
return new Env(ctx);
|
|
2990
|
+
};
|
|
2991
|
+
/**
|
|
2992
|
+
* Declare a desired Address output to be assigned in the environment
|
|
2993
|
+
* @param name The name of the binding
|
|
2994
|
+
* @param description A description of the desired value of the binding
|
|
2995
|
+
*/
|
|
2996
|
+
withAddressOutput = (name, description) => {
|
|
2997
|
+
const ctx = this._ctx.select("withAddressOutput", { name, description });
|
|
2998
|
+
return new Env(ctx);
|
|
2999
|
+
};
|
|
2698
3000
|
/**
|
|
2699
3001
|
* Create or update a binding of type CacheVolume in the environment
|
|
2700
3002
|
* @param name The name of the binding
|
|
@@ -2718,6 +3020,29 @@ export class Env extends BaseClient {
|
|
|
2718
3020
|
const ctx = this._ctx.select("withCacheVolumeOutput", { name, description });
|
|
2719
3021
|
return new Env(ctx);
|
|
2720
3022
|
};
|
|
3023
|
+
/**
|
|
3024
|
+
* Create or update a binding of type Changeset in the environment
|
|
3025
|
+
* @param name The name of the binding
|
|
3026
|
+
* @param value The Changeset value to assign to the binding
|
|
3027
|
+
* @param description The purpose of the input
|
|
3028
|
+
*/
|
|
3029
|
+
withChangesetInput = (name, value, description) => {
|
|
3030
|
+
const ctx = this._ctx.select("withChangesetInput", {
|
|
3031
|
+
name,
|
|
3032
|
+
value,
|
|
3033
|
+
description,
|
|
3034
|
+
});
|
|
3035
|
+
return new Env(ctx);
|
|
3036
|
+
};
|
|
3037
|
+
/**
|
|
3038
|
+
* Declare a desired Changeset output to be assigned in the environment
|
|
3039
|
+
* @param name The name of the binding
|
|
3040
|
+
* @param description A description of the desired value of the binding
|
|
3041
|
+
*/
|
|
3042
|
+
withChangesetOutput = (name, description) => {
|
|
3043
|
+
const ctx = this._ctx.select("withChangesetOutput", { name, description });
|
|
3044
|
+
return new Env(ctx);
|
|
3045
|
+
};
|
|
2721
3046
|
/**
|
|
2722
3047
|
* Create or update a binding of type Cloud in the environment
|
|
2723
3048
|
* @param name The name of the binding
|
|
@@ -2783,6 +3108,29 @@ export class Env extends BaseClient {
|
|
|
2783
3108
|
const ctx = this._ctx.select("withDirectoryOutput", { name, description });
|
|
2784
3109
|
return new Env(ctx);
|
|
2785
3110
|
};
|
|
3111
|
+
/**
|
|
3112
|
+
* Create or update a binding of type EnvFile in the environment
|
|
3113
|
+
* @param name The name of the binding
|
|
3114
|
+
* @param value The EnvFile value to assign to the binding
|
|
3115
|
+
* @param description The purpose of the input
|
|
3116
|
+
*/
|
|
3117
|
+
withEnvFileInput = (name, value, description) => {
|
|
3118
|
+
const ctx = this._ctx.select("withEnvFileInput", {
|
|
3119
|
+
name,
|
|
3120
|
+
value,
|
|
3121
|
+
description,
|
|
3122
|
+
});
|
|
3123
|
+
return new Env(ctx);
|
|
3124
|
+
};
|
|
3125
|
+
/**
|
|
3126
|
+
* Declare a desired EnvFile output to be assigned in the environment
|
|
3127
|
+
* @param name The name of the binding
|
|
3128
|
+
* @param description A description of the desired value of the binding
|
|
3129
|
+
*/
|
|
3130
|
+
withEnvFileOutput = (name, description) => {
|
|
3131
|
+
const ctx = this._ctx.select("withEnvFileOutput", { name, description });
|
|
3132
|
+
return new Env(ctx);
|
|
3133
|
+
};
|
|
2786
3134
|
/**
|
|
2787
3135
|
* Create or update a binding of type Env in the environment
|
|
2788
3136
|
* @param name The name of the binding
|
|
@@ -3140,6 +3488,98 @@ export class Env extends BaseClient {
|
|
|
3140
3488
|
return arg(this);
|
|
3141
3489
|
};
|
|
3142
3490
|
}
|
|
3491
|
+
/**
|
|
3492
|
+
* A collection of environment variables.
|
|
3493
|
+
*/
|
|
3494
|
+
export class EnvFile extends BaseClient {
|
|
3495
|
+
_id = undefined;
|
|
3496
|
+
_exists = undefined;
|
|
3497
|
+
_get = undefined;
|
|
3498
|
+
/**
|
|
3499
|
+
* Constructor is used for internal usage only, do not create object from it.
|
|
3500
|
+
*/
|
|
3501
|
+
constructor(ctx, _id, _exists, _get) {
|
|
3502
|
+
super(ctx);
|
|
3503
|
+
this._id = _id;
|
|
3504
|
+
this._exists = _exists;
|
|
3505
|
+
this._get = _get;
|
|
3506
|
+
}
|
|
3507
|
+
/**
|
|
3508
|
+
* A unique identifier for this EnvFile.
|
|
3509
|
+
*/
|
|
3510
|
+
id = async () => {
|
|
3511
|
+
if (this._id) {
|
|
3512
|
+
return this._id;
|
|
3513
|
+
}
|
|
3514
|
+
const ctx = this._ctx.select("id");
|
|
3515
|
+
const response = await ctx.execute();
|
|
3516
|
+
return response;
|
|
3517
|
+
};
|
|
3518
|
+
/**
|
|
3519
|
+
* Return as a file
|
|
3520
|
+
*/
|
|
3521
|
+
asFile = () => {
|
|
3522
|
+
const ctx = this._ctx.select("asFile");
|
|
3523
|
+
return new File(ctx);
|
|
3524
|
+
};
|
|
3525
|
+
/**
|
|
3526
|
+
* Check if a variable exists
|
|
3527
|
+
* @param name Variable name
|
|
3528
|
+
*/
|
|
3529
|
+
exists = async (name) => {
|
|
3530
|
+
if (this._exists) {
|
|
3531
|
+
return this._exists;
|
|
3532
|
+
}
|
|
3533
|
+
const ctx = this._ctx.select("exists", { name });
|
|
3534
|
+
const response = await ctx.execute();
|
|
3535
|
+
return response;
|
|
3536
|
+
};
|
|
3537
|
+
/**
|
|
3538
|
+
* Lookup a variable (last occurrence wins) and return its value, or an empty string
|
|
3539
|
+
* @param name Variable name
|
|
3540
|
+
*/
|
|
3541
|
+
get = async (name) => {
|
|
3542
|
+
if (this._get) {
|
|
3543
|
+
return this._get;
|
|
3544
|
+
}
|
|
3545
|
+
const ctx = this._ctx.select("get", { name });
|
|
3546
|
+
const response = await ctx.execute();
|
|
3547
|
+
return response;
|
|
3548
|
+
};
|
|
3549
|
+
/**
|
|
3550
|
+
* Return all variables
|
|
3551
|
+
*/
|
|
3552
|
+
variables = async () => {
|
|
3553
|
+
const ctx = this._ctx.select("variables").select("id");
|
|
3554
|
+
const response = await ctx.execute();
|
|
3555
|
+
return response.map((r) => new Client(ctx.copy()).loadEnvVariableFromID(r.id));
|
|
3556
|
+
};
|
|
3557
|
+
/**
|
|
3558
|
+
* Add a variable
|
|
3559
|
+
* @param name Variable name
|
|
3560
|
+
* @param value Variable value
|
|
3561
|
+
*/
|
|
3562
|
+
withVariable = (name, value) => {
|
|
3563
|
+
const ctx = this._ctx.select("withVariable", { name, value });
|
|
3564
|
+
return new EnvFile(ctx);
|
|
3565
|
+
};
|
|
3566
|
+
/**
|
|
3567
|
+
* Remove all occurrences of the named variable
|
|
3568
|
+
* @param name Variable name
|
|
3569
|
+
*/
|
|
3570
|
+
withoutVariable = (name) => {
|
|
3571
|
+
const ctx = this._ctx.select("withoutVariable", { name });
|
|
3572
|
+
return new EnvFile(ctx);
|
|
3573
|
+
};
|
|
3574
|
+
/**
|
|
3575
|
+
* Call the provided function with current EnvFile.
|
|
3576
|
+
*
|
|
3577
|
+
* This is useful for reusability and readability by not breaking the calling chain.
|
|
3578
|
+
*/
|
|
3579
|
+
with = (arg) => {
|
|
3580
|
+
return arg(this);
|
|
3581
|
+
};
|
|
3582
|
+
}
|
|
3143
3583
|
/**
|
|
3144
3584
|
* An environment variable name and value.
|
|
3145
3585
|
*/
|
|
@@ -3397,6 +3837,26 @@ export class File extends BaseClient {
|
|
|
3397
3837
|
const response = await ctx.execute();
|
|
3398
3838
|
return response;
|
|
3399
3839
|
};
|
|
3840
|
+
/**
|
|
3841
|
+
* Parse as an env file
|
|
3842
|
+
* @param opts.expand Replace "${VAR}" or "$VAR" with the value of other vars
|
|
3843
|
+
*/
|
|
3844
|
+
asEnvFile = (opts) => {
|
|
3845
|
+
const ctx = this._ctx.select("asEnvFile", { ...opts });
|
|
3846
|
+
return new EnvFile(ctx);
|
|
3847
|
+
};
|
|
3848
|
+
/**
|
|
3849
|
+
* Change the owner of the file recursively.
|
|
3850
|
+
* @param owner A user:group to set for the file.
|
|
3851
|
+
*
|
|
3852
|
+
* The user and group must be an ID (1000:1000), not a name (foo:bar).
|
|
3853
|
+
*
|
|
3854
|
+
* If the group is omitted, it defaults to the same as the user.
|
|
3855
|
+
*/
|
|
3856
|
+
chown = (owner) => {
|
|
3857
|
+
const ctx = this._ctx.select("chown", { owner });
|
|
3858
|
+
return new File(ctx);
|
|
3859
|
+
};
|
|
3400
3860
|
/**
|
|
3401
3861
|
* Retrieves the contents of the file.
|
|
3402
3862
|
* @param opts.offsetLines Start reading after this line
|
|
@@ -4169,12 +4629,14 @@ export class GitRepository extends BaseClient {
|
|
|
4169
4629
|
*/
|
|
4170
4630
|
export class Host extends BaseClient {
|
|
4171
4631
|
_id = undefined;
|
|
4632
|
+
_findUp = undefined;
|
|
4172
4633
|
/**
|
|
4173
4634
|
* Constructor is used for internal usage only, do not create object from it.
|
|
4174
4635
|
*/
|
|
4175
|
-
constructor(ctx, _id) {
|
|
4636
|
+
constructor(ctx, _id, _findUp) {
|
|
4176
4637
|
super(ctx);
|
|
4177
4638
|
this._id = _id;
|
|
4639
|
+
this._findUp = _findUp;
|
|
4178
4640
|
}
|
|
4179
4641
|
/**
|
|
4180
4642
|
* A unique identifier for this Host.
|
|
@@ -4201,7 +4663,7 @@ export class Host extends BaseClient {
|
|
|
4201
4663
|
* @param opts.exclude Exclude artifacts that match the given pattern (e.g., ["node_modules/", ".git*"]).
|
|
4202
4664
|
* @param opts.include Include only artifacts that match the given pattern (e.g., ["app/", "package.*"]).
|
|
4203
4665
|
* @param opts.noCache If true, the directory will always be reloaded from the host.
|
|
4204
|
-
* @param opts.
|
|
4666
|
+
* @param opts.gitignore Apply .gitignore filter rules inside the directory
|
|
4205
4667
|
*/
|
|
4206
4668
|
directory = (path, opts) => {
|
|
4207
4669
|
const ctx = this._ctx.select("directory", { path, ...opts });
|
|
@@ -4216,6 +4678,18 @@ export class Host extends BaseClient {
|
|
|
4216
4678
|
const ctx = this._ctx.select("file", { path, ...opts });
|
|
4217
4679
|
return new File(ctx);
|
|
4218
4680
|
};
|
|
4681
|
+
/**
|
|
4682
|
+
* Search for a file or directory by walking up the tree from system workdir. Return its relative path. If no match, return null
|
|
4683
|
+
* @param name name of the file or directory to search for
|
|
4684
|
+
*/
|
|
4685
|
+
findUp = async (name, opts) => {
|
|
4686
|
+
if (this._findUp) {
|
|
4687
|
+
return this._findUp;
|
|
4688
|
+
}
|
|
4689
|
+
const ctx = this._ctx.select("findUp", { name, ...opts });
|
|
4690
|
+
const response = await ctx.execute();
|
|
4691
|
+
return response;
|
|
4692
|
+
};
|
|
4219
4693
|
/**
|
|
4220
4694
|
* Creates a service that forwards traffic to a specified address via the host.
|
|
4221
4695
|
* @param ports Ports to expose via the service, forwarding through the host network.
|
|
@@ -5519,6 +5993,14 @@ export class ModuleSource extends BaseClient {
|
|
|
5519
5993
|
const ctx = this._ctx.select("withUpdateDependencies", { dependencies });
|
|
5520
5994
|
return new ModuleSource(ctx);
|
|
5521
5995
|
};
|
|
5996
|
+
/**
|
|
5997
|
+
* Update one or more clients.
|
|
5998
|
+
* @param clients The clients to update
|
|
5999
|
+
*/
|
|
6000
|
+
withUpdatedClients = (clients) => {
|
|
6001
|
+
const ctx = this._ctx.select("withUpdatedClients", { clients });
|
|
6002
|
+
return new ModuleSource(ctx);
|
|
6003
|
+
};
|
|
5522
6004
|
/**
|
|
5523
6005
|
* Remove the current blueprint from the module source.
|
|
5524
6006
|
*/
|
|
@@ -5740,6 +6222,13 @@ export class Client extends BaseClient {
|
|
|
5740
6222
|
getGQLClient() {
|
|
5741
6223
|
return this._ctx.getGQLClient();
|
|
5742
6224
|
}
|
|
6225
|
+
/**
|
|
6226
|
+
* initialize an address to load directories, containers, secrets or other object types.
|
|
6227
|
+
*/
|
|
6228
|
+
address = (value) => {
|
|
6229
|
+
const ctx = this._ctx.select("address", { value });
|
|
6230
|
+
return new Address(ctx);
|
|
6231
|
+
};
|
|
5743
6232
|
/**
|
|
5744
6233
|
* Constructs a cache volume for a given cache key.
|
|
5745
6234
|
* @param key A string identifier to target this cache volume (e.g., "modules-cache").
|
|
@@ -5821,6 +6310,14 @@ export class Client extends BaseClient {
|
|
|
5821
6310
|
const ctx = this._ctx.select("env", { ...opts });
|
|
5822
6311
|
return new Env(ctx);
|
|
5823
6312
|
};
|
|
6313
|
+
/**
|
|
6314
|
+
* Initialize an environment file
|
|
6315
|
+
* @param opts.expand Replace "${VAR}" or "$VAR" with the value of other vars
|
|
6316
|
+
*/
|
|
6317
|
+
envFile = (opts) => {
|
|
6318
|
+
const ctx = this._ctx.select("envFile", { ...opts });
|
|
6319
|
+
return new EnvFile(ctx);
|
|
6320
|
+
};
|
|
5824
6321
|
/**
|
|
5825
6322
|
* Create a new error.
|
|
5826
6323
|
* @param message A brief description of the error.
|
|
@@ -5910,6 +6407,13 @@ export class Client extends BaseClient {
|
|
|
5910
6407
|
const ctx = this._ctx.select("llm", { ...opts });
|
|
5911
6408
|
return new LLM(ctx);
|
|
5912
6409
|
};
|
|
6410
|
+
/**
|
|
6411
|
+
* Load a Address from its ID.
|
|
6412
|
+
*/
|
|
6413
|
+
loadAddressFromID = (id) => {
|
|
6414
|
+
const ctx = this._ctx.select("loadAddressFromID", { id });
|
|
6415
|
+
return new Address(ctx);
|
|
6416
|
+
};
|
|
5913
6417
|
/**
|
|
5914
6418
|
* Load a Binding from its ID.
|
|
5915
6419
|
*/
|
|
@@ -5924,6 +6428,13 @@ export class Client extends BaseClient {
|
|
|
5924
6428
|
const ctx = this._ctx.select("loadCacheVolumeFromID", { id });
|
|
5925
6429
|
return new CacheVolume(ctx);
|
|
5926
6430
|
};
|
|
6431
|
+
/**
|
|
6432
|
+
* Load a Changeset from its ID.
|
|
6433
|
+
*/
|
|
6434
|
+
loadChangesetFromID = (id) => {
|
|
6435
|
+
const ctx = this._ctx.select("loadChangesetFromID", { id });
|
|
6436
|
+
return new Changeset(ctx);
|
|
6437
|
+
};
|
|
5927
6438
|
/**
|
|
5928
6439
|
* Load a Cloud from its ID.
|
|
5929
6440
|
*/
|
|
@@ -5994,6 +6505,13 @@ export class Client extends BaseClient {
|
|
|
5994
6505
|
const ctx = this._ctx.select("loadEnumValueTypeDefFromID", { id });
|
|
5995
6506
|
return new EnumValueTypeDef(ctx);
|
|
5996
6507
|
};
|
|
6508
|
+
/**
|
|
6509
|
+
* Load a EnvFile from its ID.
|
|
6510
|
+
*/
|
|
6511
|
+
loadEnvFileFromID = (id) => {
|
|
6512
|
+
const ctx = this._ctx.select("loadEnvFileFromID", { id });
|
|
6513
|
+
return new EnvFile(ctx);
|
|
6514
|
+
};
|
|
5997
6515
|
/**
|
|
5998
6516
|
* Load a Env from its ID.
|
|
5999
6517
|
*/
|