@dagger.io/dagger 0.15.4 → 0.16.1

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.
@@ -53,6 +53,7 @@ export var ImageMediaTypes;
53
53
  */
54
54
  export var ModuleSourceKind;
55
55
  (function (ModuleSourceKind) {
56
+ ModuleSourceKind["DirSource"] = "DIR_SOURCE";
56
57
  ModuleSourceKind["GitSource"] = "GIT_SOURCE";
57
58
  ModuleSourceKind["LocalSource"] = "LOCAL_SOURCE";
58
59
  })(ModuleSourceKind || (ModuleSourceKind = {}));
@@ -1201,18 +1202,25 @@ export class Directory extends BaseClient {
1201
1202
  return response;
1202
1203
  };
1203
1204
  /**
1204
- * Load the directory as a Dagger module
1205
+ * Load the directory as a Dagger module source
1205
1206
  * @param opts.sourceRootPath An optional subpath of the directory which contains the module's configuration file.
1206
1207
  *
1207
- * This is needed when the module code is in a subdirectory but requires parent directories to be loaded in order to execute. For example, the module source code may need a go.mod, project.toml, package.json, etc. file from a parent directory.
1208
- *
1209
1208
  * If not set, the module source code is loaded from the root of the directory.
1210
- * @param opts.engineVersion The engine version to upgrade to.
1211
1209
  */
1212
1210
  asModule = (opts) => {
1213
1211
  const ctx = this._ctx.select("asModule", { ...opts });
1214
1212
  return new Module_(ctx);
1215
1213
  };
1214
+ /**
1215
+ * Load the directory as a Dagger module source
1216
+ * @param opts.sourceRootPath An optional subpath of the directory which contains the module's configuration file.
1217
+ *
1218
+ * If not set, the module source code is loaded from the root of the directory.
1219
+ */
1220
+ asModuleSource = (opts) => {
1221
+ const ctx = this._ctx.select("asModuleSource", { ...opts });
1222
+ return new ModuleSource(ctx);
1223
+ };
1216
1224
  /**
1217
1225
  * Gets the difference between this directory and an another directory.
1218
1226
  * @param other Identifier of the directory to compare.
@@ -2518,128 +2526,6 @@ export class GeneratedCode extends BaseClient {
2518
2526
  return arg(this);
2519
2527
  };
2520
2528
  }
2521
- /**
2522
- * Module source originating from a git repo.
2523
- */
2524
- export class GitModuleSource extends BaseClient {
2525
- _id = undefined;
2526
- _cloneRef = undefined;
2527
- _commit = undefined;
2528
- _htmlRepoURL = undefined;
2529
- _htmlURL = undefined;
2530
- _root = undefined;
2531
- _rootSubpath = undefined;
2532
- _version = undefined;
2533
- /**
2534
- * Constructor is used for internal usage only, do not create object from it.
2535
- */
2536
- constructor(ctx, _id, _cloneRef, _commit, _htmlRepoURL, _htmlURL, _root, _rootSubpath, _version) {
2537
- super(ctx);
2538
- this._id = _id;
2539
- this._cloneRef = _cloneRef;
2540
- this._commit = _commit;
2541
- this._htmlRepoURL = _htmlRepoURL;
2542
- this._htmlURL = _htmlURL;
2543
- this._root = _root;
2544
- this._rootSubpath = _rootSubpath;
2545
- this._version = _version;
2546
- }
2547
- /**
2548
- * A unique identifier for this GitModuleSource.
2549
- */
2550
- id = async () => {
2551
- if (this._id) {
2552
- return this._id;
2553
- }
2554
- const ctx = this._ctx.select("id");
2555
- const response = await ctx.execute();
2556
- return response;
2557
- };
2558
- /**
2559
- * The ref to clone the root of the git repo from
2560
- */
2561
- cloneRef = async () => {
2562
- if (this._cloneRef) {
2563
- return this._cloneRef;
2564
- }
2565
- const ctx = this._ctx.select("cloneRef");
2566
- const response = await ctx.execute();
2567
- return response;
2568
- };
2569
- /**
2570
- * The resolved commit of the git repo this source points to.
2571
- */
2572
- commit = async () => {
2573
- if (this._commit) {
2574
- return this._commit;
2575
- }
2576
- const ctx = this._ctx.select("commit");
2577
- const response = await ctx.execute();
2578
- return response;
2579
- };
2580
- /**
2581
- * The directory containing everything needed to load load and use the module.
2582
- */
2583
- contextDirectory = () => {
2584
- const ctx = this._ctx.select("contextDirectory");
2585
- return new Directory(ctx);
2586
- };
2587
- /**
2588
- * The URL to access the web view of the repository (e.g., GitHub, GitLab, Bitbucket)
2589
- */
2590
- htmlRepoURL = async () => {
2591
- if (this._htmlRepoURL) {
2592
- return this._htmlRepoURL;
2593
- }
2594
- const ctx = this._ctx.select("htmlRepoURL");
2595
- const response = await ctx.execute();
2596
- return response;
2597
- };
2598
- /**
2599
- * The URL to the source's git repo in a web browser
2600
- */
2601
- htmlURL = async () => {
2602
- if (this._htmlURL) {
2603
- return this._htmlURL;
2604
- }
2605
- const ctx = this._ctx.select("htmlURL");
2606
- const response = await ctx.execute();
2607
- return response;
2608
- };
2609
- /**
2610
- * The clean module name of the root of the module
2611
- */
2612
- root = async () => {
2613
- if (this._root) {
2614
- return this._root;
2615
- }
2616
- const ctx = this._ctx.select("root");
2617
- const response = await ctx.execute();
2618
- return response;
2619
- };
2620
- /**
2621
- * The path to the root of the module source under the context directory. This directory contains its configuration file. It also contains its source code (possibly as a subdirectory).
2622
- */
2623
- rootSubpath = async () => {
2624
- if (this._rootSubpath) {
2625
- return this._rootSubpath;
2626
- }
2627
- const ctx = this._ctx.select("rootSubpath");
2628
- const response = await ctx.execute();
2629
- return response;
2630
- };
2631
- /**
2632
- * The specified version of the git repo this source points to.
2633
- */
2634
- version = async () => {
2635
- if (this._version) {
2636
- return this._version;
2637
- }
2638
- const ctx = this._ctx.select("version");
2639
- const response = await ctx.execute();
2640
- return response;
2641
- };
2642
- }
2643
2529
  /**
2644
2530
  * A git ref (tag, branch, or commit).
2645
2531
  */
@@ -3080,63 +2966,6 @@ export class ListTypeDef extends BaseClient {
3080
2966
  return new TypeDef(ctx);
3081
2967
  };
3082
2968
  }
3083
- /**
3084
- * Module source that that originates from a path locally relative to an arbitrary directory.
3085
- */
3086
- export class LocalModuleSource extends BaseClient {
3087
- _id = undefined;
3088
- _relHostPath = undefined;
3089
- _rootSubpath = undefined;
3090
- /**
3091
- * Constructor is used for internal usage only, do not create object from it.
3092
- */
3093
- constructor(ctx, _id, _relHostPath, _rootSubpath) {
3094
- super(ctx);
3095
- this._id = _id;
3096
- this._relHostPath = _relHostPath;
3097
- this._rootSubpath = _rootSubpath;
3098
- }
3099
- /**
3100
- * A unique identifier for this LocalModuleSource.
3101
- */
3102
- id = async () => {
3103
- if (this._id) {
3104
- return this._id;
3105
- }
3106
- const ctx = this._ctx.select("id");
3107
- const response = await ctx.execute();
3108
- return response;
3109
- };
3110
- /**
3111
- * The directory containing everything needed to load load and use the module.
3112
- */
3113
- contextDirectory = () => {
3114
- const ctx = this._ctx.select("contextDirectory");
3115
- return new Directory(ctx);
3116
- };
3117
- /**
3118
- * The relative path to the module root from the host directory
3119
- */
3120
- relHostPath = async () => {
3121
- if (this._relHostPath) {
3122
- return this._relHostPath;
3123
- }
3124
- const ctx = this._ctx.select("relHostPath");
3125
- const response = await ctx.execute();
3126
- return response;
3127
- };
3128
- /**
3129
- * The path to the root of the module source under the context directory. This directory contains its configuration file. It also contains its source code (possibly as a subdirectory).
3130
- */
3131
- rootSubpath = async () => {
3132
- if (this._rootSubpath) {
3133
- return this._rootSubpath;
3134
- }
3135
- const ctx = this._ctx.select("rootSubpath");
3136
- const response = await ctx.execute();
3137
- return response;
3138
- };
3139
- }
3140
2969
  /**
3141
2970
  * A Dagger module.
3142
2971
  */
@@ -3145,15 +2974,17 @@ export class Module_ extends BaseClient {
3145
2974
  _description = undefined;
3146
2975
  _name = undefined;
3147
2976
  _serve = undefined;
2977
+ _sync = undefined;
3148
2978
  /**
3149
2979
  * Constructor is used for internal usage only, do not create object from it.
3150
2980
  */
3151
- constructor(ctx, _id, _description, _name, _serve) {
2981
+ constructor(ctx, _id, _description, _name, _serve, _sync) {
3152
2982
  super(ctx);
3153
2983
  this._id = _id;
3154
2984
  this._description = _description;
3155
2985
  this._name = _name;
3156
2986
  this._serve = _serve;
2987
+ this._sync = _sync;
3157
2988
  }
3158
2989
  /**
3159
2990
  * A unique identifier for this Module.
@@ -3167,21 +2998,13 @@ export class Module_ extends BaseClient {
3167
2998
  return response;
3168
2999
  };
3169
3000
  /**
3170
- * Modules used by this module.
3001
+ * The dependencies of the module.
3171
3002
  */
3172
3003
  dependencies = async () => {
3173
3004
  const ctx = this._ctx.select("dependencies").select("id");
3174
3005
  const response = await ctx.execute();
3175
3006
  return response.map((r) => new Client(ctx.copy()).loadModuleFromID(r.id));
3176
3007
  };
3177
- /**
3178
- * The dependencies as configured by the module.
3179
- */
3180
- dependencyConfig = async () => {
3181
- const ctx = this._ctx.select("dependencyConfig").select("id");
3182
- const response = await ctx.execute();
3183
- return response.map((r) => new Client(ctx.copy()).loadModuleDependencyFromID(r.id));
3184
- };
3185
3008
  /**
3186
3009
  * The doc string of the module, if any
3187
3010
  */
@@ -3204,24 +3027,10 @@ export class Module_ extends BaseClient {
3204
3027
  /**
3205
3028
  * The generated files and directories made on top of the module source's context directory.
3206
3029
  */
3207
- generatedContextDiff = () => {
3208
- const ctx = this._ctx.select("generatedContextDiff");
3209
- return new Directory(ctx);
3210
- };
3211
- /**
3212
- * The module source's context plus any configuration and source files created by codegen.
3213
- */
3214
3030
  generatedContextDirectory = () => {
3215
3031
  const ctx = this._ctx.select("generatedContextDirectory");
3216
3032
  return new Directory(ctx);
3217
3033
  };
3218
- /**
3219
- * Retrieves the module with the objects loaded via its SDK.
3220
- */
3221
- initialize = () => {
3222
- const ctx = this._ctx.select("initialize");
3223
- return new Module_(ctx);
3224
- };
3225
3034
  /**
3226
3035
  * Interfaces served by this module.
3227
3036
  */
@@ -3282,6 +3091,14 @@ export class Module_ extends BaseClient {
3282
3091
  const ctx = this._ctx.select("source");
3283
3092
  return new ModuleSource(ctx);
3284
3093
  };
3094
+ /**
3095
+ * Forces evaluation of the module, including any loading into the engine and associated validation.
3096
+ */
3097
+ sync = async () => {
3098
+ const ctx = this._ctx.select("sync");
3099
+ const response = await ctx.execute();
3100
+ return new Client(ctx.copy()).loadModuleFromID(response);
3101
+ };
3285
3102
  /**
3286
3103
  * Retrieves the module with the given description
3287
3104
  * @param description The description to set
@@ -3313,15 +3130,6 @@ export class Module_ extends BaseClient {
3313
3130
  const ctx = this._ctx.select("withObject", { object });
3314
3131
  return new Module_(ctx);
3315
3132
  };
3316
- /**
3317
- * Retrieves the module with basic configuration loaded if present.
3318
- * @param source The module source to initialize from.
3319
- * @param opts.engineVersion The engine version to upgrade to.
3320
- */
3321
- withSource = (source, opts) => {
3322
- const ctx = this._ctx.select("withSource", { source, ...opts });
3323
- return new Module_(ctx);
3324
- };
3325
3133
  /**
3326
3134
  * Call the provided function with current Module.
3327
3135
  *
@@ -3331,81 +3139,53 @@ export class Module_ extends BaseClient {
3331
3139
  return arg(this);
3332
3140
  };
3333
3141
  }
3334
- /**
3335
- * The configuration of dependency of a module.
3336
- */
3337
- export class ModuleDependency extends BaseClient {
3338
- _id = undefined;
3339
- _name = undefined;
3340
- /**
3341
- * Constructor is used for internal usage only, do not create object from it.
3342
- */
3343
- constructor(ctx, _id, _name) {
3344
- super(ctx);
3345
- this._id = _id;
3346
- this._name = _name;
3347
- }
3348
- /**
3349
- * A unique identifier for this ModuleDependency.
3350
- */
3351
- id = async () => {
3352
- if (this._id) {
3353
- return this._id;
3354
- }
3355
- const ctx = this._ctx.select("id");
3356
- const response = await ctx.execute();
3357
- return response;
3358
- };
3359
- /**
3360
- * The name of the dependency module.
3361
- */
3362
- name = async () => {
3363
- if (this._name) {
3364
- return this._name;
3365
- }
3366
- const ctx = this._ctx.select("name");
3367
- const response = await ctx.execute();
3368
- return response;
3369
- };
3370
- /**
3371
- * The source for the dependency module.
3372
- */
3373
- source = () => {
3374
- const ctx = this._ctx.select("source");
3375
- return new ModuleSource(ctx);
3376
- };
3377
- }
3378
3142
  /**
3379
3143
  * The source needed to load and run a module, along with any metadata about the source such as versions/urls/etc.
3380
3144
  */
3381
3145
  export class ModuleSource extends BaseClient {
3382
3146
  _id = undefined;
3383
3147
  _asString = undefined;
3148
+ _cloneRef = undefined;
3149
+ _commit = undefined;
3384
3150
  _configExists = undefined;
3385
3151
  _digest = undefined;
3152
+ _engineVersion = undefined;
3153
+ _htmlRepoURL = undefined;
3154
+ _htmlURL = undefined;
3386
3155
  _kind = undefined;
3156
+ _localContextDirectoryPath = undefined;
3387
3157
  _moduleName = undefined;
3388
3158
  _moduleOriginalName = undefined;
3389
3159
  _pin = undefined;
3390
- _resolveContextPathFromCaller = undefined;
3160
+ _repoRootPath = undefined;
3391
3161
  _sourceRootSubpath = undefined;
3392
3162
  _sourceSubpath = undefined;
3163
+ _sync = undefined;
3164
+ _version = undefined;
3393
3165
  /**
3394
3166
  * Constructor is used for internal usage only, do not create object from it.
3395
3167
  */
3396
- constructor(ctx, _id, _asString, _configExists, _digest, _kind, _moduleName, _moduleOriginalName, _pin, _resolveContextPathFromCaller, _sourceRootSubpath, _sourceSubpath) {
3168
+ constructor(ctx, _id, _asString, _cloneRef, _commit, _configExists, _digest, _engineVersion, _htmlRepoURL, _htmlURL, _kind, _localContextDirectoryPath, _moduleName, _moduleOriginalName, _pin, _repoRootPath, _sourceRootSubpath, _sourceSubpath, _sync, _version) {
3397
3169
  super(ctx);
3398
3170
  this._id = _id;
3399
3171
  this._asString = _asString;
3172
+ this._cloneRef = _cloneRef;
3173
+ this._commit = _commit;
3400
3174
  this._configExists = _configExists;
3401
3175
  this._digest = _digest;
3176
+ this._engineVersion = _engineVersion;
3177
+ this._htmlRepoURL = _htmlRepoURL;
3178
+ this._htmlURL = _htmlURL;
3402
3179
  this._kind = _kind;
3180
+ this._localContextDirectoryPath = _localContextDirectoryPath;
3403
3181
  this._moduleName = _moduleName;
3404
3182
  this._moduleOriginalName = _moduleOriginalName;
3405
3183
  this._pin = _pin;
3406
- this._resolveContextPathFromCaller = _resolveContextPathFromCaller;
3184
+ this._repoRootPath = _repoRootPath;
3407
3185
  this._sourceRootSubpath = _sourceRootSubpath;
3408
3186
  this._sourceSubpath = _sourceSubpath;
3187
+ this._sync = _sync;
3188
+ this._version = _version;
3409
3189
  }
3410
3190
  /**
3411
3191
  * A unique identifier for this ModuleSource.
@@ -3418,26 +3198,11 @@ export class ModuleSource extends BaseClient {
3418
3198
  const response = await ctx.execute();
3419
3199
  return response;
3420
3200
  };
3421
- /**
3422
- * If the source is a of kind git, the git source representation of it.
3423
- */
3424
- asGitSource = () => {
3425
- const ctx = this._ctx.select("asGitSource");
3426
- return new GitModuleSource(ctx);
3427
- };
3428
- /**
3429
- * If the source is of kind local, the local source representation of it.
3430
- */
3431
- asLocalSource = () => {
3432
- const ctx = this._ctx.select("asLocalSource");
3433
- return new LocalModuleSource(ctx);
3434
- };
3435
3201
  /**
3436
3202
  * Load the source as a module. If this is a local source, the parent directory must have been provided during module source creation
3437
- * @param opts.engineVersion The engine version to upgrade to.
3438
3203
  */
3439
- asModule = (opts) => {
3440
- const ctx = this._ctx.select("asModule", { ...opts });
3204
+ asModule = () => {
3205
+ const ctx = this._ctx.select("asModule");
3441
3206
  return new Module_(ctx);
3442
3207
  };
3443
3208
  /**
@@ -3452,7 +3217,29 @@ export class ModuleSource extends BaseClient {
3452
3217
  return response;
3453
3218
  };
3454
3219
  /**
3455
- * Returns whether the module source has a configuration file.
3220
+ * The ref to clone the root of the git repo from. Only valid for git sources.
3221
+ */
3222
+ cloneRef = async () => {
3223
+ if (this._cloneRef) {
3224
+ return this._cloneRef;
3225
+ }
3226
+ const ctx = this._ctx.select("cloneRef");
3227
+ const response = await ctx.execute();
3228
+ return response;
3229
+ };
3230
+ /**
3231
+ * The resolved commit of the git repo this source points to. Only valid for git sources.
3232
+ */
3233
+ commit = async () => {
3234
+ if (this._commit) {
3235
+ return this._commit;
3236
+ }
3237
+ const ctx = this._ctx.select("commit");
3238
+ const response = await ctx.execute();
3239
+ return response;
3240
+ };
3241
+ /**
3242
+ * Whether an existing dagger.json for the module was found.
3456
3243
  */
3457
3244
  configExists = async () => {
3458
3245
  if (this._configExists) {
@@ -3463,22 +3250,22 @@ export class ModuleSource extends BaseClient {
3463
3250
  return response;
3464
3251
  };
3465
3252
  /**
3466
- * The directory containing everything needed to load and use the module.
3253
+ * The full directory loaded for the module source, including the source code as a subdirectory.
3467
3254
  */
3468
3255
  contextDirectory = () => {
3469
3256
  const ctx = this._ctx.select("contextDirectory");
3470
3257
  return new Directory(ctx);
3471
3258
  };
3472
3259
  /**
3473
- * The effective module source dependencies from the configuration, and calls to withDependencies and withoutDependencies.
3260
+ * The dependencies of the module source.
3474
3261
  */
3475
3262
  dependencies = async () => {
3476
3263
  const ctx = this._ctx.select("dependencies").select("id");
3477
3264
  const response = await ctx.execute();
3478
- return response.map((r) => new Client(ctx.copy()).loadModuleDependencyFromID(r.id));
3265
+ return response.map((r) => new Client(ctx.copy()).loadModuleSourceFromID(r.id));
3479
3266
  };
3480
3267
  /**
3481
- * Return the module source's content digest. The format of the digest is not guaranteed to be stable between releases of Dagger. It is guaranteed to be stable between invocations of the same Dagger engine.
3268
+ * A content-hash of the module source. Module sources with the same digest will output the same generated context and convert into the same module instance.
3482
3269
  */
3483
3270
  digest = async () => {
3484
3271
  if (this._digest) {
@@ -3490,14 +3277,54 @@ export class ModuleSource extends BaseClient {
3490
3277
  };
3491
3278
  /**
3492
3279
  * The directory containing the module configuration and source code (source code may be in a subdir).
3493
- * @param path The path from the source directory to select.
3280
+ * @param path A subpath from the source directory to select.
3494
3281
  */
3495
3282
  directory = (path) => {
3496
3283
  const ctx = this._ctx.select("directory", { path });
3497
3284
  return new Directory(ctx);
3498
3285
  };
3499
3286
  /**
3500
- * The kind of source (e.g. local, git, etc.)
3287
+ * The engine version of the module.
3288
+ */
3289
+ engineVersion = async () => {
3290
+ if (this._engineVersion) {
3291
+ return this._engineVersion;
3292
+ }
3293
+ const ctx = this._ctx.select("engineVersion");
3294
+ const response = await ctx.execute();
3295
+ return response;
3296
+ };
3297
+ /**
3298
+ * The generated files and directories made on top of the module source's context directory.
3299
+ */
3300
+ generatedContextDirectory = () => {
3301
+ const ctx = this._ctx.select("generatedContextDirectory");
3302
+ return new Directory(ctx);
3303
+ };
3304
+ /**
3305
+ * The URL to access the web view of the repository (e.g., GitHub, GitLab, Bitbucket). Only valid for git sources.
3306
+ */
3307
+ htmlRepoURL = async () => {
3308
+ if (this._htmlRepoURL) {
3309
+ return this._htmlRepoURL;
3310
+ }
3311
+ const ctx = this._ctx.select("htmlRepoURL");
3312
+ const response = await ctx.execute();
3313
+ return response;
3314
+ };
3315
+ /**
3316
+ * The URL to the source's git repo in a web browser. Only valid for git sources.
3317
+ */
3318
+ htmlURL = async () => {
3319
+ if (this._htmlURL) {
3320
+ return this._htmlURL;
3321
+ }
3322
+ const ctx = this._ctx.select("htmlURL");
3323
+ const response = await ctx.execute();
3324
+ return response;
3325
+ };
3326
+ /**
3327
+ * The kind of module source (currently local, git or dir).
3501
3328
  */
3502
3329
  kind = async () => {
3503
3330
  if (this._kind) {
@@ -3508,7 +3335,18 @@ export class ModuleSource extends BaseClient {
3508
3335
  return response;
3509
3336
  };
3510
3337
  /**
3511
- * If set, the name of the module this source references, including any overrides at runtime by callers.
3338
+ * The full absolute path to the context directory on the caller's host filesystem that this module source is loaded from. Only valid for local module sources.
3339
+ */
3340
+ localContextDirectoryPath = async () => {
3341
+ if (this._localContextDirectoryPath) {
3342
+ return this._localContextDirectoryPath;
3343
+ }
3344
+ const ctx = this._ctx.select("localContextDirectoryPath");
3345
+ const response = await ctx.execute();
3346
+ return response;
3347
+ };
3348
+ /**
3349
+ * The name of the module, including any setting via the withName API.
3512
3350
  */
3513
3351
  moduleName = async () => {
3514
3352
  if (this._moduleName) {
@@ -3519,7 +3357,7 @@ export class ModuleSource extends BaseClient {
3519
3357
  return response;
3520
3358
  };
3521
3359
  /**
3522
- * The original name of the module this source references, as defined in the module configuration.
3360
+ * The original name of the module as read from the module's dagger.json (or set for the first time with the withName API).
3523
3361
  */
3524
3362
  moduleOriginalName = async () => {
3525
3363
  if (this._moduleOriginalName) {
@@ -3541,46 +3379,25 @@ export class ModuleSource extends BaseClient {
3541
3379
  return response;
3542
3380
  };
3543
3381
  /**
3544
- * The path to the module source's context directory on the caller's filesystem. Only valid for local sources.
3382
+ * The import path corresponding to the root of the git repo this source points to. Only valid for git sources.
3545
3383
  */
3546
- resolveContextPathFromCaller = async () => {
3547
- if (this._resolveContextPathFromCaller) {
3548
- return this._resolveContextPathFromCaller;
3384
+ repoRootPath = async () => {
3385
+ if (this._repoRootPath) {
3386
+ return this._repoRootPath;
3549
3387
  }
3550
- const ctx = this._ctx.select("resolveContextPathFromCaller");
3388
+ const ctx = this._ctx.select("repoRootPath");
3551
3389
  const response = await ctx.execute();
3552
3390
  return response;
3553
3391
  };
3554
3392
  /**
3555
- * Resolve the provided module source arg as a dependency relative to this module source.
3556
- * @param dep The dependency module source to resolve.
3557
- */
3558
- resolveDependency = (dep) => {
3559
- const ctx = this._ctx.select("resolveDependency", { dep });
3560
- return new ModuleSource(ctx);
3561
- };
3562
- /**
3563
- * Load a directory from the caller optionally with a given view applied.
3564
- * @param path The path on the caller's filesystem to load.
3565
- * @param opts.viewName If set, the name of the view to apply to the path.
3566
- * @param opts.ignore Patterns to ignore when loading the directory.
3567
- */
3568
- resolveDirectoryFromCaller = (path, opts) => {
3569
- const ctx = this._ctx.select("resolveDirectoryFromCaller", {
3570
- path,
3571
- ...opts,
3572
- });
3573
- return new Directory(ctx);
3574
- };
3575
- /**
3576
- * Load the source from its path on the caller's filesystem, including only needed+configured files and directories. Only valid for local sources.
3393
+ * The SDK configuration of the module.
3577
3394
  */
3578
- resolveFromCaller = () => {
3579
- const ctx = this._ctx.select("resolveFromCaller");
3580
- return new ModuleSource(ctx);
3395
+ sdk = () => {
3396
+ const ctx = this._ctx.select("sdk");
3397
+ return new SDKConfig(ctx);
3581
3398
  };
3582
3399
  /**
3583
- * The path relative to context of the root of the module source, which contains dagger.json. It also contains the module implementation source code, but that may or may not being a subdir of this root.
3400
+ * The path, relative to the context directory, that contains the module's dagger.json.
3584
3401
  */
3585
3402
  sourceRootSubpath = async () => {
3586
3403
  if (this._sourceRootSubpath) {
@@ -3591,7 +3408,7 @@ export class ModuleSource extends BaseClient {
3591
3408
  return response;
3592
3409
  };
3593
3410
  /**
3594
- * The path relative to context of the module implementation source code.
3411
+ * The path to the directory containing the module's source code, relative to the context directory.
3595
3412
  */
3596
3413
  sourceSubpath = async () => {
3597
3414
  if (this._sourceSubpath) {
@@ -3602,28 +3419,23 @@ export class ModuleSource extends BaseClient {
3602
3419
  return response;
3603
3420
  };
3604
3421
  /**
3605
- * Retrieve a named view defined for this module source.
3606
- * @param name The name of the view to retrieve.
3607
- */
3608
- view = (name) => {
3609
- const ctx = this._ctx.select("view", { name });
3610
- return new ModuleSourceView(ctx);
3611
- };
3612
- /**
3613
- * The named views defined for this module source, which are sets of directory filters that can be applied to directory arguments provided to functions.
3422
+ * Forces evaluation of the module source, including any loading into the engine and associated validation.
3614
3423
  */
3615
- views = async () => {
3616
- const ctx = this._ctx.select("views").select("id");
3424
+ sync = async () => {
3425
+ const ctx = this._ctx.select("sync");
3617
3426
  const response = await ctx.execute();
3618
- return response.map((r) => new Client(ctx.copy()).loadModuleSourceViewFromID(r.id));
3427
+ return new Client(ctx.copy()).loadModuleSourceFromID(response);
3619
3428
  };
3620
3429
  /**
3621
- * Update the module source with a new context directory. Only valid for local sources.
3622
- * @param dir The directory to set as the context directory.
3430
+ * The specified version of the git repo this source points to. Only valid for git sources.
3623
3431
  */
3624
- withContextDirectory = (dir) => {
3625
- const ctx = this._ctx.select("withContextDirectory", { dir });
3626
- return new ModuleSource(ctx);
3432
+ version = async () => {
3433
+ if (this._version) {
3434
+ return this._version;
3435
+ }
3436
+ const ctx = this._ctx.select("version");
3437
+ const response = await ctx.execute();
3438
+ return response;
3627
3439
  };
3628
3440
  /**
3629
3441
  * Append the provided dependencies to the module source's dependency list.
@@ -3634,11 +3446,19 @@ export class ModuleSource extends BaseClient {
3634
3446
  return new ModuleSource(ctx);
3635
3447
  };
3636
3448
  /**
3637
- * Sets module init arguments
3638
- * @param opts.merge Merge module dependencies into the current project's
3449
+ * Upgrade the engine version of the module to the given value.
3450
+ * @param version The engine version to upgrade to.
3451
+ */
3452
+ withEngineVersion = (version) => {
3453
+ const ctx = this._ctx.select("withEngineVersion", { version });
3454
+ return new ModuleSource(ctx);
3455
+ };
3456
+ /**
3457
+ * Update the module source with additional include patterns for files+directories from its context that are required for building it
3458
+ * @param patterns The new additional include patterns.
3639
3459
  */
3640
- withInit = (opts) => {
3641
- const ctx = this._ctx.select("withInit", { ...opts });
3460
+ withIncludes = (patterns) => {
3461
+ const ctx = this._ctx.select("withIncludes", { patterns });
3642
3462
  return new ModuleSource(ctx);
3643
3463
  };
3644
3464
  /**
@@ -3659,7 +3479,7 @@ export class ModuleSource extends BaseClient {
3659
3479
  };
3660
3480
  /**
3661
3481
  * Update the module source with a new source subpath.
3662
- * @param path The path to set as the source subpath.
3482
+ * @param path The path to set as the source subpath. Must be relative to the module source's source root directory.
3663
3483
  */
3664
3484
  withSourceSubpath = (path) => {
3665
3485
  const ctx = this._ctx.select("withSourceSubpath", { path });
@@ -3673,15 +3493,6 @@ export class ModuleSource extends BaseClient {
3673
3493
  const ctx = this._ctx.select("withUpdateDependencies", { dependencies });
3674
3494
  return new ModuleSource(ctx);
3675
3495
  };
3676
- /**
3677
- * Update the module source with a new named view.
3678
- * @param name The name of the view to set.
3679
- * @param patterns The patterns to set as the view filters.
3680
- */
3681
- withView = (name, patterns) => {
3682
- const ctx = this._ctx.select("withView", { name, patterns });
3683
- return new ModuleSource(ctx);
3684
- };
3685
3496
  /**
3686
3497
  * Remove the provided dependencies from the module source's dependency list.
3687
3498
  * @param dependencies The dependencies to remove.
@@ -3699,51 +3510,6 @@ export class ModuleSource extends BaseClient {
3699
3510
  return arg(this);
3700
3511
  };
3701
3512
  }
3702
- /**
3703
- * A named set of path filters that can be applied to directory arguments provided to functions.
3704
- */
3705
- export class ModuleSourceView extends BaseClient {
3706
- _id = undefined;
3707
- _name = undefined;
3708
- /**
3709
- * Constructor is used for internal usage only, do not create object from it.
3710
- */
3711
- constructor(ctx, _id, _name) {
3712
- super(ctx);
3713
- this._id = _id;
3714
- this._name = _name;
3715
- }
3716
- /**
3717
- * A unique identifier for this ModuleSourceView.
3718
- */
3719
- id = async () => {
3720
- if (this._id) {
3721
- return this._id;
3722
- }
3723
- const ctx = this._ctx.select("id");
3724
- const response = await ctx.execute();
3725
- return response;
3726
- };
3727
- /**
3728
- * The name of the view
3729
- */
3730
- name = async () => {
3731
- if (this._name) {
3732
- return this._name;
3733
- }
3734
- const ctx = this._ctx.select("name");
3735
- const response = await ctx.execute();
3736
- return response;
3737
- };
3738
- /**
3739
- * The patterns of the view used to filter paths
3740
- */
3741
- patterns = async () => {
3742
- const ctx = this._ctx.select("patterns");
3743
- const response = await ctx.execute();
3744
- return response;
3745
- };
3746
- }
3747
3513
  /**
3748
3514
  * A definition of a custom object defined in a Module.
3749
3515
  */
@@ -4194,13 +3960,6 @@ export class Client extends BaseClient {
4194
3960
  const ctx = this._ctx.select("loadGeneratedCodeFromID", { id });
4195
3961
  return new GeneratedCode(ctx);
4196
3962
  };
4197
- /**
4198
- * Load a GitModuleSource from its ID.
4199
- */
4200
- loadGitModuleSourceFromID = (id) => {
4201
- const ctx = this._ctx.select("loadGitModuleSourceFromID", { id });
4202
- return new GitModuleSource(ctx);
4203
- };
4204
3963
  /**
4205
3964
  * Load a GitRef from its ID.
4206
3965
  */
@@ -4250,20 +4009,6 @@ export class Client extends BaseClient {
4250
4009
  const ctx = this._ctx.select("loadListTypeDefFromID", { id });
4251
4010
  return new ListTypeDef(ctx);
4252
4011
  };
4253
- /**
4254
- * Load a LocalModuleSource from its ID.
4255
- */
4256
- loadLocalModuleSourceFromID = (id) => {
4257
- const ctx = this._ctx.select("loadLocalModuleSourceFromID", { id });
4258
- return new LocalModuleSource(ctx);
4259
- };
4260
- /**
4261
- * Load a ModuleDependency from its ID.
4262
- */
4263
- loadModuleDependencyFromID = (id) => {
4264
- const ctx = this._ctx.select("loadModuleDependencyFromID", { id });
4265
- return new ModuleDependency(ctx);
4266
- };
4267
4012
  /**
4268
4013
  * Load a Module from its ID.
4269
4014
  */
@@ -4278,13 +4023,6 @@ export class Client extends BaseClient {
4278
4023
  const ctx = this._ctx.select("loadModuleSourceFromID", { id });
4279
4024
  return new ModuleSource(ctx);
4280
4025
  };
4281
- /**
4282
- * Load a ModuleSourceView from its ID.
4283
- */
4284
- loadModuleSourceViewFromID = (id) => {
4285
- const ctx = this._ctx.select("loadModuleSourceViewFromID", { id });
4286
- return new ModuleSourceView(ctx);
4287
- };
4288
4026
  /**
4289
4027
  * Load a ObjectTypeDef from its ID.
4290
4028
  */
@@ -4370,23 +4108,22 @@ export class Client extends BaseClient {
4370
4108
  return new Module_(ctx);
4371
4109
  };
4372
4110
  /**
4373
- * Create a new module dependency configuration from a module source and name
4374
- * @param source The source of the dependency
4375
- * @param opts.name If set, the name to use for the dependency. Otherwise, once installed to a parent module, the name of the dependency module will be used by default.
4376
- */
4377
- moduleDependency = (source, opts) => {
4378
- const ctx = this._ctx.select("moduleDependency", { source, ...opts });
4379
- return new ModuleDependency(ctx);
4380
- };
4381
- /**
4382
- * Create a new module source instance from a source ref string.
4111
+ * Create a new module source instance from a source ref string
4383
4112
  * @param refString The string ref representation of the module source
4384
4113
  * @param opts.refPin The pinned version of the module source
4385
- * @param opts.stable If true, enforce that the source is a stable version for source kinds that support versioning.
4386
- * @param opts.relHostPath The relative path to the module root from the host directory
4114
+ * @param opts.disableFindUp If true, do not attempt to find dagger.json in a parent directory of the provided path. Only relevant for local module sources.
4115
+ * @param opts.allowNotExists If true, do not error out if the provided ref string is a local path and does not exist yet. Useful when initializing new modules in directories that don't exist yet.
4116
+ * @param opts.requireKind If set, error out if the ref string is not of the provided requireKind.
4387
4117
  */
4388
4118
  moduleSource = (refString, opts) => {
4389
- const ctx = this._ctx.select("moduleSource", { refString, ...opts });
4119
+ const metadata = {
4120
+ requireKind: { is_enum: true },
4121
+ };
4122
+ const ctx = this._ctx.select("moduleSource", {
4123
+ refString,
4124
+ ...opts,
4125
+ __metadata: metadata,
4126
+ });
4390
4127
  return new ModuleSource(ctx);
4391
4128
  };
4392
4129
  /**