@dagger.io/dagger 0.18.16 → 0.18.18

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.
@@ -542,6 +542,13 @@ export class Binding extends BaseClient {
542
542
  const ctx = this._ctx.select("asCacheVolume");
543
543
  return new CacheVolume(ctx);
544
544
  };
545
+ /**
546
+ * Retrieve the binding value, as type Changeset
547
+ */
548
+ asChangeset = () => {
549
+ const ctx = this._ctx.select("asChangeset");
550
+ return new Changeset(ctx);
551
+ };
545
552
  /**
546
553
  * Retrieve the binding value, as type Cloud
547
554
  */
@@ -570,6 +577,13 @@ export class Binding extends BaseClient {
570
577
  const ctx = this._ctx.select("asEnv");
571
578
  return new Env(ctx);
572
579
  };
580
+ /**
581
+ * Retrieve the binding value, as type EnvFile
582
+ */
583
+ asEnvFile = () => {
584
+ const ctx = this._ctx.select("asEnvFile");
585
+ return new EnvFile(ctx);
586
+ };
573
587
  /**
574
588
  * Retrieve the binding value, as type File
575
589
  */
@@ -591,6 +605,13 @@ export class Binding extends BaseClient {
591
605
  const ctx = this._ctx.select("asGitRepository");
592
606
  return new GitRepository(ctx);
593
607
  };
608
+ /**
609
+ * Retrieve the binding value, as type JSONValue
610
+ */
611
+ asJSONValue = () => {
612
+ const ctx = this._ctx.select("asJSONValue");
613
+ return new JSONValue(ctx);
614
+ };
594
615
  /**
595
616
  * Retrieve the binding value, as type LLM
596
617
  */
@@ -619,6 +640,20 @@ export class Binding extends BaseClient {
619
640
  const ctx = this._ctx.select("asModuleSource");
620
641
  return new ModuleSource(ctx);
621
642
  };
643
+ /**
644
+ * Retrieve the binding value, as type SearchResult
645
+ */
646
+ asSearchResult = () => {
647
+ const ctx = this._ctx.select("asSearchResult");
648
+ return new SearchResult(ctx);
649
+ };
650
+ /**
651
+ * Retrieve the binding value, as type SearchSubmatch
652
+ */
653
+ asSearchSubmatch = () => {
654
+ const ctx = this._ctx.select("asSearchSubmatch");
655
+ return new SearchSubmatch(ctx);
656
+ };
622
657
  /**
623
658
  * Retrieve the binding value, as type Secret
624
659
  */
@@ -720,6 +755,92 @@ export class CacheVolume extends BaseClient {
720
755
  return response;
721
756
  };
722
757
  }
758
+ /**
759
+ * A comparison between two directories representing changes that can be applied.
760
+ */
761
+ export class Changeset extends BaseClient {
762
+ _id = undefined;
763
+ _sync = undefined;
764
+ /**
765
+ * Constructor is used for internal usage only, do not create object from it.
766
+ */
767
+ constructor(ctx, _id, _sync) {
768
+ super(ctx);
769
+ this._id = _id;
770
+ this._sync = _sync;
771
+ }
772
+ /**
773
+ * A unique identifier for this Changeset.
774
+ */
775
+ id = async () => {
776
+ if (this._id) {
777
+ return this._id;
778
+ }
779
+ const ctx = this._ctx.select("id");
780
+ const response = await ctx.execute();
781
+ return response;
782
+ };
783
+ /**
784
+ * Files and directories that were added in the newer directory.
785
+ */
786
+ addedPaths = async () => {
787
+ const ctx = this._ctx.select("addedPaths");
788
+ const response = await ctx.execute();
789
+ return response;
790
+ };
791
+ /**
792
+ * The newer/upper snapshot.
793
+ */
794
+ after = () => {
795
+ const ctx = this._ctx.select("after");
796
+ return new Directory(ctx);
797
+ };
798
+ /**
799
+ * Return a Git-compatible patch of the changes
800
+ */
801
+ asPatch = () => {
802
+ const ctx = this._ctx.select("asPatch");
803
+ return new File(ctx);
804
+ };
805
+ /**
806
+ * The older/lower snapshot to compare against.
807
+ */
808
+ before = () => {
809
+ const ctx = this._ctx.select("before");
810
+ return new Directory(ctx);
811
+ };
812
+ /**
813
+ * Return a snapshot containing only the created and modified files
814
+ */
815
+ layer = () => {
816
+ const ctx = this._ctx.select("layer");
817
+ return new Directory(ctx);
818
+ };
819
+ /**
820
+ * Files and directories that existed before and were updated in the newer directory.
821
+ */
822
+ modifiedPaths = async () => {
823
+ const ctx = this._ctx.select("modifiedPaths");
824
+ const response = await ctx.execute();
825
+ return response;
826
+ };
827
+ /**
828
+ * Files and directories that were removed. Directories are indicated by a trailing slash, and their child paths are not included.
829
+ */
830
+ removedPaths = async () => {
831
+ const ctx = this._ctx.select("removedPaths");
832
+ const response = await ctx.execute();
833
+ return response;
834
+ };
835
+ /**
836
+ * Force evaluation in the engine.
837
+ */
838
+ sync = async () => {
839
+ const ctx = this._ctx.select("sync");
840
+ const response = await ctx.execute();
841
+ return new Client(ctx.copy()).loadChangesetFromID(response);
842
+ };
843
+ }
723
844
  /**
724
845
  * Dagger Cloud configuration and state
725
846
  */
@@ -762,6 +883,7 @@ export class Cloud extends BaseClient {
762
883
  */
763
884
  export class Container extends BaseClient {
764
885
  _id = undefined;
886
+ _combinedOutput = undefined;
765
887
  _envVariable = undefined;
766
888
  _exists = undefined;
767
889
  _exitCode = undefined;
@@ -780,9 +902,10 @@ export class Container extends BaseClient {
780
902
  /**
781
903
  * Constructor is used for internal usage only, do not create object from it.
782
904
  */
783
- constructor(ctx, _id, _envVariable, _exists, _exitCode, _export, _exportImage, _imageRef, _label, _platform, _publish, _stderr, _stdout, _sync, _up, _user, _workdir) {
905
+ constructor(ctx, _id, _combinedOutput, _envVariable, _exists, _exitCode, _export, _exportImage, _imageRef, _label, _platform, _publish, _stderr, _stdout, _sync, _up, _user, _workdir) {
784
906
  super(ctx);
785
907
  this._id = _id;
908
+ this._combinedOutput = _combinedOutput;
786
909
  this._envVariable = _envVariable;
787
910
  this._exists = _exists;
788
911
  this._exitCode = _exitCode;
@@ -872,6 +995,19 @@ export class Container extends BaseClient {
872
995
  const ctx = this._ctx.select("build", { context, ...opts });
873
996
  return new Container(ctx);
874
997
  };
998
+ /**
999
+ * The combined buffered standard output and standard error stream of the last executed command
1000
+ *
1001
+ * Returns an error if no command was executed
1002
+ */
1003
+ combinedOutput = async () => {
1004
+ if (this._combinedOutput) {
1005
+ return this._combinedOutput;
1006
+ }
1007
+ const ctx = this._ctx.select("combinedOutput");
1008
+ const response = await ctx.execute();
1009
+ return response;
1010
+ };
875
1011
  /**
876
1012
  * Return the container's default arguments.
877
1013
  */
@@ -1838,17 +1974,19 @@ export class Directory extends BaseClient {
1838
1974
  _digest = undefined;
1839
1975
  _exists = undefined;
1840
1976
  _export = undefined;
1977
+ _findUp = undefined;
1841
1978
  _name = undefined;
1842
1979
  _sync = undefined;
1843
1980
  /**
1844
1981
  * Constructor is used for internal usage only, do not create object from it.
1845
1982
  */
1846
- constructor(ctx, _id, _digest, _exists, _export, _name, _sync) {
1983
+ constructor(ctx, _id, _digest, _exists, _export, _findUp, _name, _sync) {
1847
1984
  super(ctx);
1848
1985
  this._id = _id;
1849
1986
  this._digest = _digest;
1850
1987
  this._exists = _exists;
1851
1988
  this._export = _export;
1989
+ this._findUp = _findUp;
1852
1990
  this._name = _name;
1853
1991
  this._sync = _sync;
1854
1992
  }
@@ -1890,6 +2028,29 @@ export class Directory extends BaseClient {
1890
2028
  const ctx = this._ctx.select("asModuleSource", { ...opts });
1891
2029
  return new ModuleSource(ctx);
1892
2030
  };
2031
+ /**
2032
+ * Return the difference between this directory and another directory, typically an older snapshot.
2033
+ *
2034
+ * The difference is encoded as a changeset, which also tracks removed files, and can be applied to other directories.
2035
+ * @param from The base directory snapshot to compare against
2036
+ */
2037
+ changes = (from) => {
2038
+ const ctx = this._ctx.select("changes", { from });
2039
+ return new Changeset(ctx);
2040
+ };
2041
+ /**
2042
+ * Change the owner of the directory contents recursively.
2043
+ * @param path Path of the directory to change ownership of (e.g., "/").
2044
+ * @param owner A user:group to set for the mounted directory and its contents.
2045
+ *
2046
+ * The user and group must be an ID (1000:1000), not a name (foo:bar).
2047
+ *
2048
+ * If the group is omitted, it defaults to the same as the user.
2049
+ */
2050
+ chown = (path, owner) => {
2051
+ const ctx = this._ctx.select("chown", { path, owner });
2052
+ return new Directory(ctx);
2053
+ };
1893
2054
  /**
1894
2055
  * Return the difference between this directory and an another directory. The difference is encoded as a directory.
1895
2056
  * @param other The directory to compare against
@@ -1994,6 +2155,19 @@ export class Directory extends BaseClient {
1994
2155
  const ctx = this._ctx.select("filter", { ...opts });
1995
2156
  return new Directory(ctx);
1996
2157
  };
2158
+ /**
2159
+ * Search up the directory tree for a file or directory, and return its path. If no match, return null
2160
+ * @param name The name of the file or directory to search for
2161
+ * @param start The path to start the search from
2162
+ */
2163
+ findUp = async (name, start) => {
2164
+ if (this._findUp) {
2165
+ return this._findUp;
2166
+ }
2167
+ const ctx = this._ctx.select("findUp", { name, start });
2168
+ const response = await ctx.execute();
2169
+ return response;
2170
+ };
1997
2171
  /**
1998
2172
  * Returns a list of files and directories that matche the given pattern.
1999
2173
  * @param pattern Pattern to match (e.g., "*.md").
@@ -2014,6 +2188,27 @@ export class Directory extends BaseClient {
2014
2188
  const response = await ctx.execute();
2015
2189
  return response;
2016
2190
  };
2191
+ /**
2192
+ * Searches for content matching the given regular expression or literal string.
2193
+ *
2194
+ * Uses Rust regex syntax; escape literal ., [, ], {, }, | with backslashes.
2195
+ * @param opts.paths Directory or file paths to search
2196
+ * @param opts.globs Glob patterns to match (e.g., "*.md")
2197
+ * @param opts.pattern The text to match.
2198
+ * @param opts.literal Interpret the pattern as a literal string instead of a regular expression.
2199
+ * @param opts.multiline Enable searching across multiple lines.
2200
+ * @param opts.dotall Allow the . pattern to match newlines in multiline mode.
2201
+ * @param opts.insensitive Enable case-insensitive matching.
2202
+ * @param opts.skipIgnored Honor .gitignore, .ignore, and .rgignore files.
2203
+ * @param opts.skipHidden Skip hidden files (files starting with .).
2204
+ * @param opts.filesOnly Only return matching files, not lines and content
2205
+ * @param opts.limit Limit the number of results to return
2206
+ */
2207
+ search = async (opts) => {
2208
+ const ctx = this._ctx.select("search", { ...opts }).select("id");
2209
+ const response = await ctx.execute();
2210
+ return response.map((r) => new Client(ctx.copy()).loadSearchResultFromID(r.id));
2211
+ };
2017
2212
  /**
2018
2213
  * Force evaluation in the engine.
2019
2214
  */
@@ -2033,12 +2228,25 @@ export class Directory extends BaseClient {
2033
2228
  const ctx = this._ctx.select("terminal", { ...opts });
2034
2229
  return new Directory(ctx);
2035
2230
  };
2231
+ /**
2232
+ * Return a directory with changes from another directory applied to it.
2233
+ * @param changes Changes to apply to the directory
2234
+ */
2235
+ withChanges = (changes) => {
2236
+ const ctx = this._ctx.select("withChanges", { changes });
2237
+ return new Directory(ctx);
2238
+ };
2036
2239
  /**
2037
2240
  * Return a snapshot with a directory added
2038
2241
  * @param path Location of the written directory (e.g., "/src/").
2039
2242
  * @param directory Identifier of the directory to copy.
2040
2243
  * @param opts.exclude Exclude artifacts that match the given pattern (e.g., ["node_modules/", ".git*"]).
2041
2244
  * @param opts.include Include only artifacts that match the given pattern (e.g., ["app/", "package.*"]).
2245
+ * @param opts.owner A user:group to set for the copied directory and its contents.
2246
+ *
2247
+ * The user and group must be an ID (1000:1000), not a name (foo:bar).
2248
+ *
2249
+ * If the group is omitted, it defaults to the same as the user.
2042
2250
  */
2043
2251
  withDirectory = (path, directory, opts) => {
2044
2252
  const ctx = this._ctx.select("withDirectory", { path, directory, ...opts });
@@ -2049,6 +2257,11 @@ export class Directory extends BaseClient {
2049
2257
  * @param path Location of the copied file (e.g., "/file.txt").
2050
2258
  * @param source Identifier of the file to copy.
2051
2259
  * @param opts.permissions Permission given to the copied file (e.g., 0600).
2260
+ * @param opts.owner A user:group to set for the copied directory and its contents.
2261
+ *
2262
+ * The user and group must be an ID (1000:1000), not a name (foo:bar).
2263
+ *
2264
+ * If the group is omitted, it defaults to the same as the user.
2052
2265
  */
2053
2266
  withFile = (path, source, opts) => {
2054
2267
  const ctx = this._ctx.select("withFile", { path, source, ...opts });
@@ -2092,6 +2305,15 @@ export class Directory extends BaseClient {
2092
2305
  const ctx = this._ctx.select("withPatch", { patch });
2093
2306
  return new Directory(ctx);
2094
2307
  };
2308
+ /**
2309
+ * Retrieves this directory with the given Git-compatible patch file applied.
2310
+ * @param patch File containing the patch to apply
2311
+ * @experimental
2312
+ */
2313
+ withPatchFile = (patch) => {
2314
+ const ctx = this._ctx.select("withPatchFile", { patch });
2315
+ return new Directory(ctx);
2316
+ };
2095
2317
  /**
2096
2318
  * Return a snapshot with a symlink
2097
2319
  * @param target Location of the file or directory to link to (e.g., "/existing/file").
@@ -2661,6 +2883,29 @@ export class Env extends BaseClient {
2661
2883
  const ctx = this._ctx.select("withCacheVolumeOutput", { name, description });
2662
2884
  return new Env(ctx);
2663
2885
  };
2886
+ /**
2887
+ * Create or update a binding of type Changeset in the environment
2888
+ * @param name The name of the binding
2889
+ * @param value The Changeset value to assign to the binding
2890
+ * @param description The purpose of the input
2891
+ */
2892
+ withChangesetInput = (name, value, description) => {
2893
+ const ctx = this._ctx.select("withChangesetInput", {
2894
+ name,
2895
+ value,
2896
+ description,
2897
+ });
2898
+ return new Env(ctx);
2899
+ };
2900
+ /**
2901
+ * Declare a desired Changeset output to be assigned in the environment
2902
+ * @param name The name of the binding
2903
+ * @param description A description of the desired value of the binding
2904
+ */
2905
+ withChangesetOutput = (name, description) => {
2906
+ const ctx = this._ctx.select("withChangesetOutput", { name, description });
2907
+ return new Env(ctx);
2908
+ };
2664
2909
  /**
2665
2910
  * Create or update a binding of type Cloud in the environment
2666
2911
  * @param name The name of the binding
@@ -2726,6 +2971,29 @@ export class Env extends BaseClient {
2726
2971
  const ctx = this._ctx.select("withDirectoryOutput", { name, description });
2727
2972
  return new Env(ctx);
2728
2973
  };
2974
+ /**
2975
+ * Create or update a binding of type EnvFile in the environment
2976
+ * @param name The name of the binding
2977
+ * @param value The EnvFile value to assign to the binding
2978
+ * @param description The purpose of the input
2979
+ */
2980
+ withEnvFileInput = (name, value, description) => {
2981
+ const ctx = this._ctx.select("withEnvFileInput", {
2982
+ name,
2983
+ value,
2984
+ description,
2985
+ });
2986
+ return new Env(ctx);
2987
+ };
2988
+ /**
2989
+ * Declare a desired EnvFile output to be assigned in the environment
2990
+ * @param name The name of the binding
2991
+ * @param description A description of the desired value of the binding
2992
+ */
2993
+ withEnvFileOutput = (name, description) => {
2994
+ const ctx = this._ctx.select("withEnvFileOutput", { name, description });
2995
+ return new Env(ctx);
2996
+ };
2729
2997
  /**
2730
2998
  * Create or update a binding of type Env in the environment
2731
2999
  * @param name The name of the binding
@@ -2813,6 +3081,29 @@ export class Env extends BaseClient {
2813
3081
  });
2814
3082
  return new Env(ctx);
2815
3083
  };
3084
+ /**
3085
+ * Create or update a binding of type JSONValue in the environment
3086
+ * @param name The name of the binding
3087
+ * @param value The JSONValue value to assign to the binding
3088
+ * @param description The purpose of the input
3089
+ */
3090
+ withJSONValueInput = (name, value, description) => {
3091
+ const ctx = this._ctx.select("withJSONValueInput", {
3092
+ name,
3093
+ value,
3094
+ description,
3095
+ });
3096
+ return new Env(ctx);
3097
+ };
3098
+ /**
3099
+ * Declare a desired JSONValue output to be assigned in the environment
3100
+ * @param name The name of the binding
3101
+ * @param description A description of the desired value of the binding
3102
+ */
3103
+ withJSONValueOutput = (name, description) => {
3104
+ const ctx = this._ctx.select("withJSONValueOutput", { name, description });
3105
+ return new Env(ctx);
3106
+ };
2816
3107
  /**
2817
3108
  * Create or update a binding of type LLM in the environment
2818
3109
  * @param name The name of the binding
@@ -2907,6 +3198,58 @@ export class Env extends BaseClient {
2907
3198
  });
2908
3199
  return new Env(ctx);
2909
3200
  };
3201
+ /**
3202
+ * Create or update a binding of type SearchResult in the environment
3203
+ * @param name The name of the binding
3204
+ * @param value The SearchResult value to assign to the binding
3205
+ * @param description The purpose of the input
3206
+ */
3207
+ withSearchResultInput = (name, value, description) => {
3208
+ const ctx = this._ctx.select("withSearchResultInput", {
3209
+ name,
3210
+ value,
3211
+ description,
3212
+ });
3213
+ return new Env(ctx);
3214
+ };
3215
+ /**
3216
+ * Declare a desired SearchResult output to be assigned in the environment
3217
+ * @param name The name of the binding
3218
+ * @param description A description of the desired value of the binding
3219
+ */
3220
+ withSearchResultOutput = (name, description) => {
3221
+ const ctx = this._ctx.select("withSearchResultOutput", {
3222
+ name,
3223
+ description,
3224
+ });
3225
+ return new Env(ctx);
3226
+ };
3227
+ /**
3228
+ * Create or update a binding of type SearchSubmatch in the environment
3229
+ * @param name The name of the binding
3230
+ * @param value The SearchSubmatch value to assign to the binding
3231
+ * @param description The purpose of the input
3232
+ */
3233
+ withSearchSubmatchInput = (name, value, description) => {
3234
+ const ctx = this._ctx.select("withSearchSubmatchInput", {
3235
+ name,
3236
+ value,
3237
+ description,
3238
+ });
3239
+ return new Env(ctx);
3240
+ };
3241
+ /**
3242
+ * Declare a desired SearchSubmatch output to be assigned in the environment
3243
+ * @param name The name of the binding
3244
+ * @param description A description of the desired value of the binding
3245
+ */
3246
+ withSearchSubmatchOutput = (name, description) => {
3247
+ const ctx = this._ctx.select("withSearchSubmatchOutput", {
3248
+ name,
3249
+ description,
3250
+ });
3251
+ return new Env(ctx);
3252
+ };
2910
3253
  /**
2911
3254
  * Create or update a binding of type Secret in the environment
2912
3255
  * @param name The name of the binding
@@ -3008,6 +3351,98 @@ export class Env extends BaseClient {
3008
3351
  return arg(this);
3009
3352
  };
3010
3353
  }
3354
+ /**
3355
+ * A collection of environment variables.
3356
+ */
3357
+ export class EnvFile extends BaseClient {
3358
+ _id = undefined;
3359
+ _exists = undefined;
3360
+ _get = undefined;
3361
+ /**
3362
+ * Constructor is used for internal usage only, do not create object from it.
3363
+ */
3364
+ constructor(ctx, _id, _exists, _get) {
3365
+ super(ctx);
3366
+ this._id = _id;
3367
+ this._exists = _exists;
3368
+ this._get = _get;
3369
+ }
3370
+ /**
3371
+ * A unique identifier for this EnvFile.
3372
+ */
3373
+ id = async () => {
3374
+ if (this._id) {
3375
+ return this._id;
3376
+ }
3377
+ const ctx = this._ctx.select("id");
3378
+ const response = await ctx.execute();
3379
+ return response;
3380
+ };
3381
+ /**
3382
+ * Return as a file
3383
+ */
3384
+ asFile = () => {
3385
+ const ctx = this._ctx.select("asFile");
3386
+ return new File(ctx);
3387
+ };
3388
+ /**
3389
+ * Check if a variable exists
3390
+ * @param name Variable name
3391
+ */
3392
+ exists = async (name) => {
3393
+ if (this._exists) {
3394
+ return this._exists;
3395
+ }
3396
+ const ctx = this._ctx.select("exists", { name });
3397
+ const response = await ctx.execute();
3398
+ return response;
3399
+ };
3400
+ /**
3401
+ * Lookup a variable (last occurrence wins) and return its value, or an empty string
3402
+ * @param name Variable name
3403
+ */
3404
+ get = async (name) => {
3405
+ if (this._get) {
3406
+ return this._get;
3407
+ }
3408
+ const ctx = this._ctx.select("get", { name });
3409
+ const response = await ctx.execute();
3410
+ return response;
3411
+ };
3412
+ /**
3413
+ * Return all variables
3414
+ */
3415
+ variables = async () => {
3416
+ const ctx = this._ctx.select("variables").select("id");
3417
+ const response = await ctx.execute();
3418
+ return response.map((r) => new Client(ctx.copy()).loadEnvVariableFromID(r.id));
3419
+ };
3420
+ /**
3421
+ * Add a variable
3422
+ * @param name Variable name
3423
+ * @param value Variable value
3424
+ */
3425
+ withVariable = (name, value) => {
3426
+ const ctx = this._ctx.select("withVariable", { name, value });
3427
+ return new EnvFile(ctx);
3428
+ };
3429
+ /**
3430
+ * Remove all occurrences of the named variable
3431
+ * @param name Variable name
3432
+ */
3433
+ withoutVariable = (name) => {
3434
+ const ctx = this._ctx.select("withoutVariable", { name });
3435
+ return new EnvFile(ctx);
3436
+ };
3437
+ /**
3438
+ * Call the provided function with current EnvFile.
3439
+ *
3440
+ * This is useful for reusability and readability by not breaking the calling chain.
3441
+ */
3442
+ with = (arg) => {
3443
+ return arg(this);
3444
+ };
3445
+ }
3011
3446
  /**
3012
3447
  * An environment variable name and value.
3013
3448
  */
@@ -3265,14 +3700,36 @@ export class File extends BaseClient {
3265
3700
  const response = await ctx.execute();
3266
3701
  return response;
3267
3702
  };
3703
+ /**
3704
+ * Parse as an env file
3705
+ * @param opts.expand Replace "${VAR}" or "$VAR" with the value of other vars
3706
+ */
3707
+ asEnvFile = (opts) => {
3708
+ const ctx = this._ctx.select("asEnvFile", { ...opts });
3709
+ return new EnvFile(ctx);
3710
+ };
3711
+ /**
3712
+ * Change the owner of the file recursively.
3713
+ * @param owner A user:group to set for the file.
3714
+ *
3715
+ * The user and group must be an ID (1000:1000), not a name (foo:bar).
3716
+ *
3717
+ * If the group is omitted, it defaults to the same as the user.
3718
+ */
3719
+ chown = (owner) => {
3720
+ const ctx = this._ctx.select("chown", { owner });
3721
+ return new File(ctx);
3722
+ };
3268
3723
  /**
3269
3724
  * Retrieves the contents of the file.
3725
+ * @param opts.offsetLines Start reading after this line
3726
+ * @param opts.limitLines Maximum number of lines to read
3270
3727
  */
3271
- contents = async () => {
3728
+ contents = async (opts) => {
3272
3729
  if (this._contents) {
3273
3730
  return this._contents;
3274
3731
  }
3275
- const ctx = this._ctx.select("contents");
3732
+ const ctx = this._ctx.select("contents", { ...opts });
3276
3733
  const response = await ctx.execute();
3277
3734
  return response;
3278
3735
  };
@@ -3312,6 +3769,25 @@ export class File extends BaseClient {
3312
3769
  const response = await ctx.execute();
3313
3770
  return response;
3314
3771
  };
3772
+ /**
3773
+ * Searches for content matching the given regular expression or literal string.
3774
+ *
3775
+ * Uses Rust regex syntax; escape literal ., [, ], {, }, | with backslashes.
3776
+ * @param pattern The text to match.
3777
+ * @param opts.literal Interpret the pattern as a literal string instead of a regular expression.
3778
+ * @param opts.multiline Enable searching across multiple lines.
3779
+ * @param opts.dotall Allow the . pattern to match newlines in multiline mode.
3780
+ * @param opts.insensitive Enable case-insensitive matching.
3781
+ * @param opts.skipIgnored Honor .gitignore, .ignore, and .rgignore files.
3782
+ * @param opts.skipHidden Skip hidden files (files starting with .).
3783
+ * @param opts.filesOnly Only return matching files, not lines and content
3784
+ * @param opts.limit Limit the number of results to return
3785
+ */
3786
+ search = async (pattern, opts) => {
3787
+ const ctx = this._ctx.select("search", { pattern, ...opts }).select("id");
3788
+ const response = await ctx.execute();
3789
+ return response.map((r) => new Client(ctx.copy()).loadSearchResultFromID(r.id));
3790
+ };
3315
3791
  /**
3316
3792
  * Retrieves the size of the file, in bytes.
3317
3793
  */
@@ -3339,6 +3815,29 @@ export class File extends BaseClient {
3339
3815
  const ctx = this._ctx.select("withName", { name });
3340
3816
  return new File(ctx);
3341
3817
  };
3818
+ /**
3819
+ * Retrieves the file with content replaced with the given text.
3820
+ *
3821
+ * If 'all' is true, all occurrences of the pattern will be replaced.
3822
+ *
3823
+ * If 'firstAfter' is specified, only the first match starting at the specified line will be replaced.
3824
+ *
3825
+ * If neither are specified, and there are multiple matches for the pattern, this will error.
3826
+ *
3827
+ * If there are no matches for the pattern, this will error.
3828
+ * @param search The text to match.
3829
+ * @param replacement The text to match.
3830
+ * @param opts.all Replace all occurrences of the pattern.
3831
+ * @param opts.firstFrom Replace the first match starting from the specified line.
3832
+ */
3833
+ withReplaced = (search, replacement, opts) => {
3834
+ const ctx = this._ctx.select("withReplaced", {
3835
+ search,
3836
+ replacement,
3837
+ ...opts,
3838
+ });
3839
+ return new File(ctx);
3840
+ };
3342
3841
  /**
3343
3842
  * Retrieves this file with its created/modified timestamps set to the given time.
3344
3843
  * @param timestamp Timestamp to set dir/files in.
@@ -3866,12 +4365,14 @@ export class GitRef extends BaseClient {
3866
4365
  */
3867
4366
  export class GitRepository extends BaseClient {
3868
4367
  _id = undefined;
4368
+ _url = undefined;
3869
4369
  /**
3870
4370
  * Constructor is used for internal usage only, do not create object from it.
3871
4371
  */
3872
- constructor(ctx, _id) {
4372
+ constructor(ctx, _id, _url) {
3873
4373
  super(ctx);
3874
4374
  this._id = _id;
4375
+ this._url = _url;
3875
4376
  }
3876
4377
  /**
3877
4378
  * A unique identifier for this GitRepository.
@@ -3948,6 +4449,17 @@ export class GitRepository extends BaseClient {
3948
4449
  const response = await ctx.execute();
3949
4450
  return response;
3950
4451
  };
4452
+ /**
4453
+ * The URL of the git repository.
4454
+ */
4455
+ url = async () => {
4456
+ if (this._url) {
4457
+ return this._url;
4458
+ }
4459
+ const ctx = this._ctx.select("url");
4460
+ const response = await ctx.execute();
4461
+ return response;
4462
+ };
3951
4463
  /**
3952
4464
  * Header to authenticate the remote with.
3953
4465
  * @param header Secret used to populate the Authorization HTTP header
@@ -3980,12 +4492,14 @@ export class GitRepository extends BaseClient {
3980
4492
  */
3981
4493
  export class Host extends BaseClient {
3982
4494
  _id = undefined;
4495
+ _findUp = undefined;
3983
4496
  /**
3984
4497
  * Constructor is used for internal usage only, do not create object from it.
3985
4498
  */
3986
- constructor(ctx, _id) {
4499
+ constructor(ctx, _id, _findUp) {
3987
4500
  super(ctx);
3988
4501
  this._id = _id;
4502
+ this._findUp = _findUp;
3989
4503
  }
3990
4504
  /**
3991
4505
  * A unique identifier for this Host.
@@ -3998,12 +4512,21 @@ export class Host extends BaseClient {
3998
4512
  const response = await ctx.execute();
3999
4513
  return response;
4000
4514
  };
4515
+ /**
4516
+ * Accesses a container image on the host.
4517
+ * @param name Name of the image to access.
4518
+ */
4519
+ containerImage = (name) => {
4520
+ const ctx = this._ctx.select("containerImage", { name });
4521
+ return new Container(ctx);
4522
+ };
4001
4523
  /**
4002
4524
  * Accesses a directory on the host.
4003
4525
  * @param path Location of the directory to access (e.g., ".").
4004
4526
  * @param opts.exclude Exclude artifacts that match the given pattern (e.g., ["node_modules/", ".git*"]).
4005
4527
  * @param opts.include Include only artifacts that match the given pattern (e.g., ["app/", "package.*"]).
4006
4528
  * @param opts.noCache If true, the directory will always be reloaded from the host.
4529
+ * @param opts.gitignore Apply .gitignore filter rules inside the directory
4007
4530
  */
4008
4531
  directory = (path, opts) => {
4009
4532
  const ctx = this._ctx.select("directory", { path, ...opts });
@@ -4018,6 +4541,18 @@ export class Host extends BaseClient {
4018
4541
  const ctx = this._ctx.select("file", { path, ...opts });
4019
4542
  return new File(ctx);
4020
4543
  };
4544
+ /**
4545
+ * Search for a file or directory by walking up the tree from system workdir. Return its relative path. If no match, return null
4546
+ * @param name name of the file or directory to search for
4547
+ */
4548
+ findUp = async (name, opts) => {
4549
+ if (this._findUp) {
4550
+ return this._findUp;
4551
+ }
4552
+ const ctx = this._ctx.select("findUp", { name, ...opts });
4553
+ const response = await ctx.execute();
4554
+ return response;
4555
+ };
4021
4556
  /**
4022
4557
  * Creates a service that forwards traffic to a specified address via the host.
4023
4558
  * @param ports Ports to expose via the service, forwarding through the host network.
@@ -4196,6 +4731,154 @@ export class InterfaceTypeDef extends BaseClient {
4196
4731
  return response;
4197
4732
  };
4198
4733
  }
4734
+ export class JSONValue extends BaseClient {
4735
+ _id = undefined;
4736
+ _asBoolean = undefined;
4737
+ _asInteger = undefined;
4738
+ _asString = undefined;
4739
+ _contents = undefined;
4740
+ /**
4741
+ * Constructor is used for internal usage only, do not create object from it.
4742
+ */
4743
+ constructor(ctx, _id, _asBoolean, _asInteger, _asString, _contents) {
4744
+ super(ctx);
4745
+ this._id = _id;
4746
+ this._asBoolean = _asBoolean;
4747
+ this._asInteger = _asInteger;
4748
+ this._asString = _asString;
4749
+ this._contents = _contents;
4750
+ }
4751
+ /**
4752
+ * A unique identifier for this JSONValue.
4753
+ */
4754
+ id = async () => {
4755
+ if (this._id) {
4756
+ return this._id;
4757
+ }
4758
+ const ctx = this._ctx.select("id");
4759
+ const response = await ctx.execute();
4760
+ return response;
4761
+ };
4762
+ /**
4763
+ * Decode an array from json
4764
+ */
4765
+ asArray = async () => {
4766
+ const ctx = this._ctx.select("asArray").select("id");
4767
+ const response = await ctx.execute();
4768
+ return response.map((r) => new Client(ctx.copy()).loadJSONValueFromID(r.id));
4769
+ };
4770
+ /**
4771
+ * Decode a boolean from json
4772
+ */
4773
+ asBoolean = async () => {
4774
+ if (this._asBoolean) {
4775
+ return this._asBoolean;
4776
+ }
4777
+ const ctx = this._ctx.select("asBoolean");
4778
+ const response = await ctx.execute();
4779
+ return response;
4780
+ };
4781
+ /**
4782
+ * Decode an integer from json
4783
+ */
4784
+ asInteger = async () => {
4785
+ if (this._asInteger) {
4786
+ return this._asInteger;
4787
+ }
4788
+ const ctx = this._ctx.select("asInteger");
4789
+ const response = await ctx.execute();
4790
+ return response;
4791
+ };
4792
+ /**
4793
+ * Decode a string from json
4794
+ */
4795
+ asString = async () => {
4796
+ if (this._asString) {
4797
+ return this._asString;
4798
+ }
4799
+ const ctx = this._ctx.select("asString");
4800
+ const response = await ctx.execute();
4801
+ return response;
4802
+ };
4803
+ /**
4804
+ * Return the value encoded as json
4805
+ * @param opts.pretty Pretty-print
4806
+ * @param opts.indent Optional line prefix
4807
+ */
4808
+ contents = async (opts) => {
4809
+ if (this._contents) {
4810
+ return this._contents;
4811
+ }
4812
+ const ctx = this._ctx.select("contents", { ...opts });
4813
+ const response = await ctx.execute();
4814
+ return response;
4815
+ };
4816
+ /**
4817
+ * Lookup the field at the given path, and return its value.
4818
+ * @param path Path of the field to lookup, encoded as an array of field names
4819
+ */
4820
+ field = (path) => {
4821
+ const ctx = this._ctx.select("field", { path });
4822
+ return new JSONValue(ctx);
4823
+ };
4824
+ /**
4825
+ * List fields of the encoded object
4826
+ */
4827
+ fields = async () => {
4828
+ const ctx = this._ctx.select("fields");
4829
+ const response = await ctx.execute();
4830
+ return response;
4831
+ };
4832
+ /**
4833
+ * Encode a boolean to json
4834
+ * @param value New boolean value
4835
+ */
4836
+ newBoolean = (value) => {
4837
+ const ctx = this._ctx.select("newBoolean", { value });
4838
+ return new JSONValue(ctx);
4839
+ };
4840
+ /**
4841
+ * Encode an integer to json
4842
+ * @param value New integer value
4843
+ */
4844
+ newInteger = (value) => {
4845
+ const ctx = this._ctx.select("newInteger", { value });
4846
+ return new JSONValue(ctx);
4847
+ };
4848
+ /**
4849
+ * Encode a string to json
4850
+ * @param value New string value
4851
+ */
4852
+ newString = (value) => {
4853
+ const ctx = this._ctx.select("newString", { value });
4854
+ return new JSONValue(ctx);
4855
+ };
4856
+ /**
4857
+ * Return a new json value, decoded from the given content
4858
+ * @param contents New JSON-encoded contents
4859
+ */
4860
+ withContents = (contents) => {
4861
+ const ctx = this._ctx.select("withContents", { contents });
4862
+ return new JSONValue(ctx);
4863
+ };
4864
+ /**
4865
+ * Set a new field at the given path
4866
+ * @param path Path of the field to set, encoded as an array of field names
4867
+ * @param value The new value of the field
4868
+ */
4869
+ withField = (path, value) => {
4870
+ const ctx = this._ctx.select("withField", { path, value });
4871
+ return new JSONValue(ctx);
4872
+ };
4873
+ /**
4874
+ * Call the provided function with current JSONValue.
4875
+ *
4876
+ * This is useful for reusability and readability by not breaking the calling chain.
4877
+ */
4878
+ with = (arg) => {
4879
+ return arg(this);
4880
+ };
4881
+ }
4199
4882
  export class LLM extends BaseClient {
4200
4883
  _id = undefined;
4201
4884
  _historyJSON = undefined;
@@ -5475,6 +6158,14 @@ export class Client extends BaseClient {
5475
6158
  const ctx = this._ctx.select("env", { ...opts });
5476
6159
  return new Env(ctx);
5477
6160
  };
6161
+ /**
6162
+ * Initialize an environment file
6163
+ * @param opts.expand Replace "${VAR}" or "$VAR" with the value of other vars
6164
+ */
6165
+ envFile = (opts) => {
6166
+ const ctx = this._ctx.select("envFile", { ...opts });
6167
+ return new EnvFile(ctx);
6168
+ };
5478
6169
  /**
5479
6170
  * Create a new error.
5480
6171
  * @param message A brief description of the error.
@@ -5547,6 +6238,13 @@ export class Client extends BaseClient {
5547
6238
  const ctx = this._ctx.select("http", { url, ...opts });
5548
6239
  return new File(ctx);
5549
6240
  };
6241
+ /**
6242
+ * Initialize a JSON value
6243
+ */
6244
+ json = () => {
6245
+ const ctx = this._ctx.select("json");
6246
+ return new JSONValue(ctx);
6247
+ };
5550
6248
  /**
5551
6249
  * Initialize a Large Language Model (LLM)
5552
6250
  * @param opts.model Model to use
@@ -5571,6 +6269,13 @@ export class Client extends BaseClient {
5571
6269
  const ctx = this._ctx.select("loadCacheVolumeFromID", { id });
5572
6270
  return new CacheVolume(ctx);
5573
6271
  };
6272
+ /**
6273
+ * Load a Changeset from its ID.
6274
+ */
6275
+ loadChangesetFromID = (id) => {
6276
+ const ctx = this._ctx.select("loadChangesetFromID", { id });
6277
+ return new Changeset(ctx);
6278
+ };
5574
6279
  /**
5575
6280
  * Load a Cloud from its ID.
5576
6281
  */
@@ -5641,6 +6346,13 @@ export class Client extends BaseClient {
5641
6346
  const ctx = this._ctx.select("loadEnumValueTypeDefFromID", { id });
5642
6347
  return new EnumValueTypeDef(ctx);
5643
6348
  };
6349
+ /**
6350
+ * Load a EnvFile from its ID.
6351
+ */
6352
+ loadEnvFileFromID = (id) => {
6353
+ const ctx = this._ctx.select("loadEnvFileFromID", { id });
6354
+ return new EnvFile(ctx);
6355
+ };
5644
6356
  /**
5645
6357
  * Load a Env from its ID.
5646
6358
  */
@@ -5753,6 +6465,13 @@ export class Client extends BaseClient {
5753
6465
  const ctx = this._ctx.select("loadInterfaceTypeDefFromID", { id });
5754
6466
  return new InterfaceTypeDef(ctx);
5755
6467
  };
6468
+ /**
6469
+ * Load a JSONValue from its ID.
6470
+ */
6471
+ loadJSONValueFromID = (id) => {
6472
+ const ctx = this._ctx.select("loadJSONValueFromID", { id });
6473
+ return new JSONValue(ctx);
6474
+ };
5756
6475
  /**
5757
6476
  * Load a LLM from its ID.
5758
6477
  */
@@ -5830,6 +6549,20 @@ export class Client extends BaseClient {
5830
6549
  const ctx = this._ctx.select("loadScalarTypeDefFromID", { id });
5831
6550
  return new ScalarTypeDef(ctx);
5832
6551
  };
6552
+ /**
6553
+ * Load a SearchResult from its ID.
6554
+ */
6555
+ loadSearchResultFromID = (id) => {
6556
+ const ctx = this._ctx.select("loadSearchResultFromID", { id });
6557
+ return new SearchResult(ctx);
6558
+ };
6559
+ /**
6560
+ * Load a SearchSubmatch from its ID.
6561
+ */
6562
+ loadSearchSubmatchFromID = (id) => {
6563
+ const ctx = this._ctx.select("loadSearchSubmatchFromID", { id });
6564
+ return new SearchSubmatch(ctx);
6565
+ };
5833
6566
  /**
5834
6567
  * Load a Secret from its ID.
5835
6568
  */
@@ -6051,6 +6784,147 @@ export class ScalarTypeDef extends BaseClient {
6051
6784
  return response;
6052
6785
  };
6053
6786
  }
6787
+ export class SearchResult extends BaseClient {
6788
+ _id = undefined;
6789
+ _absoluteOffset = undefined;
6790
+ _filePath = undefined;
6791
+ _lineNumber = undefined;
6792
+ _matchedLines = undefined;
6793
+ /**
6794
+ * Constructor is used for internal usage only, do not create object from it.
6795
+ */
6796
+ constructor(ctx, _id, _absoluteOffset, _filePath, _lineNumber, _matchedLines) {
6797
+ super(ctx);
6798
+ this._id = _id;
6799
+ this._absoluteOffset = _absoluteOffset;
6800
+ this._filePath = _filePath;
6801
+ this._lineNumber = _lineNumber;
6802
+ this._matchedLines = _matchedLines;
6803
+ }
6804
+ /**
6805
+ * A unique identifier for this SearchResult.
6806
+ */
6807
+ id = async () => {
6808
+ if (this._id) {
6809
+ return this._id;
6810
+ }
6811
+ const ctx = this._ctx.select("id");
6812
+ const response = await ctx.execute();
6813
+ return response;
6814
+ };
6815
+ /**
6816
+ * The byte offset of this line within the file.
6817
+ */
6818
+ absoluteOffset = async () => {
6819
+ if (this._absoluteOffset) {
6820
+ return this._absoluteOffset;
6821
+ }
6822
+ const ctx = this._ctx.select("absoluteOffset");
6823
+ const response = await ctx.execute();
6824
+ return response;
6825
+ };
6826
+ /**
6827
+ * The path to the file that matched.
6828
+ */
6829
+ filePath = async () => {
6830
+ if (this._filePath) {
6831
+ return this._filePath;
6832
+ }
6833
+ const ctx = this._ctx.select("filePath");
6834
+ const response = await ctx.execute();
6835
+ return response;
6836
+ };
6837
+ /**
6838
+ * The first line that matched.
6839
+ */
6840
+ lineNumber = async () => {
6841
+ if (this._lineNumber) {
6842
+ return this._lineNumber;
6843
+ }
6844
+ const ctx = this._ctx.select("lineNumber");
6845
+ const response = await ctx.execute();
6846
+ return response;
6847
+ };
6848
+ /**
6849
+ * The line content that matched.
6850
+ */
6851
+ matchedLines = async () => {
6852
+ if (this._matchedLines) {
6853
+ return this._matchedLines;
6854
+ }
6855
+ const ctx = this._ctx.select("matchedLines");
6856
+ const response = await ctx.execute();
6857
+ return response;
6858
+ };
6859
+ /**
6860
+ * Sub-match positions and content within the matched lines.
6861
+ */
6862
+ submatches = async () => {
6863
+ const ctx = this._ctx.select("submatches").select("id");
6864
+ const response = await ctx.execute();
6865
+ return response.map((r) => new Client(ctx.copy()).loadSearchSubmatchFromID(r.id));
6866
+ };
6867
+ }
6868
+ export class SearchSubmatch extends BaseClient {
6869
+ _id = undefined;
6870
+ _end = undefined;
6871
+ _start = undefined;
6872
+ _text = undefined;
6873
+ /**
6874
+ * Constructor is used for internal usage only, do not create object from it.
6875
+ */
6876
+ constructor(ctx, _id, _end, _start, _text) {
6877
+ super(ctx);
6878
+ this._id = _id;
6879
+ this._end = _end;
6880
+ this._start = _start;
6881
+ this._text = _text;
6882
+ }
6883
+ /**
6884
+ * A unique identifier for this SearchSubmatch.
6885
+ */
6886
+ id = async () => {
6887
+ if (this._id) {
6888
+ return this._id;
6889
+ }
6890
+ const ctx = this._ctx.select("id");
6891
+ const response = await ctx.execute();
6892
+ return response;
6893
+ };
6894
+ /**
6895
+ * The match's end offset within the matched lines.
6896
+ */
6897
+ end = async () => {
6898
+ if (this._end) {
6899
+ return this._end;
6900
+ }
6901
+ const ctx = this._ctx.select("end");
6902
+ const response = await ctx.execute();
6903
+ return response;
6904
+ };
6905
+ /**
6906
+ * The match's start offset within the matched lines.
6907
+ */
6908
+ start = async () => {
6909
+ if (this._start) {
6910
+ return this._start;
6911
+ }
6912
+ const ctx = this._ctx.select("start");
6913
+ const response = await ctx.execute();
6914
+ return response;
6915
+ };
6916
+ /**
6917
+ * The matched text.
6918
+ */
6919
+ text = async () => {
6920
+ if (this._text) {
6921
+ return this._text;
6922
+ }
6923
+ const ctx = this._ctx.select("text");
6924
+ const response = await ctx.execute();
6925
+ return response;
6926
+ };
6927
+ }
6054
6928
  /**
6055
6929
  * A reference to a secret value, which can be handled more safely than the value itself.
6056
6930
  */
@@ -6123,17 +6997,19 @@ export class Service extends BaseClient {
6123
6997
  _hostname = undefined;
6124
6998
  _start = undefined;
6125
6999
  _stop = undefined;
7000
+ _sync = undefined;
6126
7001
  _up = undefined;
6127
7002
  /**
6128
7003
  * Constructor is used for internal usage only, do not create object from it.
6129
7004
  */
6130
- constructor(ctx, _id, _endpoint, _hostname, _start, _stop, _up) {
7005
+ constructor(ctx, _id, _endpoint, _hostname, _start, _stop, _sync, _up) {
6131
7006
  super(ctx);
6132
7007
  this._id = _id;
6133
7008
  this._endpoint = _endpoint;
6134
7009
  this._hostname = _hostname;
6135
7010
  this._start = _start;
6136
7011
  this._stop = _stop;
7012
+ this._sync = _sync;
6137
7013
  this._up = _up;
6138
7014
  }
6139
7015
  /**
@@ -6202,6 +7078,18 @@ export class Service extends BaseClient {
6202
7078
  const response = await ctx.execute();
6203
7079
  return new Client(ctx.copy()).loadServiceFromID(response);
6204
7080
  };
7081
+ /**
7082
+ * Forces evaluation of the pipeline in the engine.
7083
+ */
7084
+ sync = async () => {
7085
+ const ctx = this._ctx.select("sync");
7086
+ const response = await ctx.execute();
7087
+ return new Client(ctx.copy()).loadServiceFromID(response);
7088
+ };
7089
+ terminal = (opts) => {
7090
+ const ctx = this._ctx.select("terminal", { ...opts });
7091
+ return new Service(ctx);
7092
+ };
6205
7093
  /**
6206
7094
  * Creates a tunnel that forwards traffic from the caller's network to this service.
6207
7095
  * @param opts.ports List of frontend/backend port mappings to forward.