@dagger.io/dagger 0.15.3 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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
  */
@@ -3144,18 +2973,18 @@ export class Module_ extends BaseClient {
3144
2973
  _id = undefined;
3145
2974
  _description = undefined;
3146
2975
  _name = undefined;
3147
- _sdk = undefined;
3148
2976
  _serve = undefined;
2977
+ _sync = undefined;
3149
2978
  /**
3150
2979
  * Constructor is used for internal usage only, do not create object from it.
3151
2980
  */
3152
- constructor(ctx, _id, _description, _name, _sdk, _serve) {
2981
+ constructor(ctx, _id, _description, _name, _serve, _sync) {
3153
2982
  super(ctx);
3154
2983
  this._id = _id;
3155
2984
  this._description = _description;
3156
2985
  this._name = _name;
3157
- this._sdk = _sdk;
3158
2986
  this._serve = _serve;
2987
+ this._sync = _sync;
3159
2988
  }
3160
2989
  /**
3161
2990
  * A unique identifier for this Module.
@@ -3169,21 +2998,13 @@ export class Module_ extends BaseClient {
3169
2998
  return response;
3170
2999
  };
3171
3000
  /**
3172
- * Modules used by this module.
3001
+ * The dependencies of the module.
3173
3002
  */
3174
3003
  dependencies = async () => {
3175
3004
  const ctx = this._ctx.select("dependencies").select("id");
3176
3005
  const response = await ctx.execute();
3177
3006
  return response.map((r) => new Client(ctx.copy()).loadModuleFromID(r.id));
3178
3007
  };
3179
- /**
3180
- * The dependencies as configured by the module.
3181
- */
3182
- dependencyConfig = async () => {
3183
- const ctx = this._ctx.select("dependencyConfig").select("id");
3184
- const response = await ctx.execute();
3185
- return response.map((r) => new Client(ctx.copy()).loadModuleDependencyFromID(r.id));
3186
- };
3187
3008
  /**
3188
3009
  * The doc string of the module, if any
3189
3010
  */
@@ -3206,24 +3027,10 @@ export class Module_ extends BaseClient {
3206
3027
  /**
3207
3028
  * The generated files and directories made on top of the module source's context directory.
3208
3029
  */
3209
- generatedContextDiff = () => {
3210
- const ctx = this._ctx.select("generatedContextDiff");
3211
- return new Directory(ctx);
3212
- };
3213
- /**
3214
- * The module source's context plus any configuration and source files created by codegen.
3215
- */
3216
3030
  generatedContextDirectory = () => {
3217
3031
  const ctx = this._ctx.select("generatedContextDirectory");
3218
3032
  return new Directory(ctx);
3219
3033
  };
3220
- /**
3221
- * Retrieves the module with the objects loaded via its SDK.
3222
- */
3223
- initialize = () => {
3224
- const ctx = this._ctx.select("initialize");
3225
- return new Module_(ctx);
3226
- };
3227
3034
  /**
3228
3035
  * Interfaces served by this module.
3229
3036
  */
@@ -3259,15 +3066,11 @@ export class Module_ extends BaseClient {
3259
3066
  return new Container(ctx);
3260
3067
  };
3261
3068
  /**
3262
- * The SDK used by this module. Either a name of a builtin SDK or a module source ref string pointing to the SDK's implementation.
3069
+ * The SDK config used by this module.
3263
3070
  */
3264
- sdk = async () => {
3265
- if (this._sdk) {
3266
- return this._sdk;
3267
- }
3071
+ sdk = () => {
3268
3072
  const ctx = this._ctx.select("sdk");
3269
- const response = await ctx.execute();
3270
- return response;
3073
+ return new SDKConfig(ctx);
3271
3074
  };
3272
3075
  /**
3273
3076
  * Serve a module's API in the current session.
@@ -3288,6 +3091,14 @@ export class Module_ extends BaseClient {
3288
3091
  const ctx = this._ctx.select("source");
3289
3092
  return new ModuleSource(ctx);
3290
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
+ };
3291
3102
  /**
3292
3103
  * Retrieves the module with the given description
3293
3104
  * @param description The description to set
@@ -3319,15 +3130,6 @@ export class Module_ extends BaseClient {
3319
3130
  const ctx = this._ctx.select("withObject", { object });
3320
3131
  return new Module_(ctx);
3321
3132
  };
3322
- /**
3323
- * Retrieves the module with basic configuration loaded if present.
3324
- * @param source The module source to initialize from.
3325
- * @param opts.engineVersion The engine version to upgrade to.
3326
- */
3327
- withSource = (source, opts) => {
3328
- const ctx = this._ctx.select("withSource", { source, ...opts });
3329
- return new Module_(ctx);
3330
- };
3331
3133
  /**
3332
3134
  * Call the provided function with current Module.
3333
3135
  *
@@ -3337,81 +3139,53 @@ export class Module_ extends BaseClient {
3337
3139
  return arg(this);
3338
3140
  };
3339
3141
  }
3340
- /**
3341
- * The configuration of dependency of a module.
3342
- */
3343
- export class ModuleDependency extends BaseClient {
3344
- _id = undefined;
3345
- _name = undefined;
3346
- /**
3347
- * Constructor is used for internal usage only, do not create object from it.
3348
- */
3349
- constructor(ctx, _id, _name) {
3350
- super(ctx);
3351
- this._id = _id;
3352
- this._name = _name;
3353
- }
3354
- /**
3355
- * A unique identifier for this ModuleDependency.
3356
- */
3357
- id = async () => {
3358
- if (this._id) {
3359
- return this._id;
3360
- }
3361
- const ctx = this._ctx.select("id");
3362
- const response = await ctx.execute();
3363
- return response;
3364
- };
3365
- /**
3366
- * The name of the dependency module.
3367
- */
3368
- name = async () => {
3369
- if (this._name) {
3370
- return this._name;
3371
- }
3372
- const ctx = this._ctx.select("name");
3373
- const response = await ctx.execute();
3374
- return response;
3375
- };
3376
- /**
3377
- * The source for the dependency module.
3378
- */
3379
- source = () => {
3380
- const ctx = this._ctx.select("source");
3381
- return new ModuleSource(ctx);
3382
- };
3383
- }
3384
3142
  /**
3385
3143
  * The source needed to load and run a module, along with any metadata about the source such as versions/urls/etc.
3386
3144
  */
3387
3145
  export class ModuleSource extends BaseClient {
3388
3146
  _id = undefined;
3389
3147
  _asString = undefined;
3148
+ _cloneRef = undefined;
3149
+ _commit = undefined;
3390
3150
  _configExists = undefined;
3391
3151
  _digest = undefined;
3152
+ _engineVersion = undefined;
3153
+ _htmlRepoURL = undefined;
3154
+ _htmlURL = undefined;
3392
3155
  _kind = undefined;
3156
+ _localContextDirectoryPath = undefined;
3393
3157
  _moduleName = undefined;
3394
3158
  _moduleOriginalName = undefined;
3395
3159
  _pin = undefined;
3396
- _resolveContextPathFromCaller = undefined;
3160
+ _repoRootPath = undefined;
3397
3161
  _sourceRootSubpath = undefined;
3398
3162
  _sourceSubpath = undefined;
3163
+ _sync = undefined;
3164
+ _version = undefined;
3399
3165
  /**
3400
3166
  * Constructor is used for internal usage only, do not create object from it.
3401
3167
  */
3402
- 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) {
3403
3169
  super(ctx);
3404
3170
  this._id = _id;
3405
3171
  this._asString = _asString;
3172
+ this._cloneRef = _cloneRef;
3173
+ this._commit = _commit;
3406
3174
  this._configExists = _configExists;
3407
3175
  this._digest = _digest;
3176
+ this._engineVersion = _engineVersion;
3177
+ this._htmlRepoURL = _htmlRepoURL;
3178
+ this._htmlURL = _htmlURL;
3408
3179
  this._kind = _kind;
3180
+ this._localContextDirectoryPath = _localContextDirectoryPath;
3409
3181
  this._moduleName = _moduleName;
3410
3182
  this._moduleOriginalName = _moduleOriginalName;
3411
3183
  this._pin = _pin;
3412
- this._resolveContextPathFromCaller = _resolveContextPathFromCaller;
3184
+ this._repoRootPath = _repoRootPath;
3413
3185
  this._sourceRootSubpath = _sourceRootSubpath;
3414
3186
  this._sourceSubpath = _sourceSubpath;
3187
+ this._sync = _sync;
3188
+ this._version = _version;
3415
3189
  }
3416
3190
  /**
3417
3191
  * A unique identifier for this ModuleSource.
@@ -3424,26 +3198,11 @@ export class ModuleSource extends BaseClient {
3424
3198
  const response = await ctx.execute();
3425
3199
  return response;
3426
3200
  };
3427
- /**
3428
- * If the source is a of kind git, the git source representation of it.
3429
- */
3430
- asGitSource = () => {
3431
- const ctx = this._ctx.select("asGitSource");
3432
- return new GitModuleSource(ctx);
3433
- };
3434
- /**
3435
- * If the source is of kind local, the local source representation of it.
3436
- */
3437
- asLocalSource = () => {
3438
- const ctx = this._ctx.select("asLocalSource");
3439
- return new LocalModuleSource(ctx);
3440
- };
3441
3201
  /**
3442
3202
  * Load the source as a module. If this is a local source, the parent directory must have been provided during module source creation
3443
- * @param opts.engineVersion The engine version to upgrade to.
3444
3203
  */
3445
- asModule = (opts) => {
3446
- const ctx = this._ctx.select("asModule", { ...opts });
3204
+ asModule = () => {
3205
+ const ctx = this._ctx.select("asModule");
3447
3206
  return new Module_(ctx);
3448
3207
  };
3449
3208
  /**
@@ -3458,7 +3217,29 @@ export class ModuleSource extends BaseClient {
3458
3217
  return response;
3459
3218
  };
3460
3219
  /**
3461
- * 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.
3462
3243
  */
3463
3244
  configExists = async () => {
3464
3245
  if (this._configExists) {
@@ -3469,22 +3250,22 @@ export class ModuleSource extends BaseClient {
3469
3250
  return response;
3470
3251
  };
3471
3252
  /**
3472
- * 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.
3473
3254
  */
3474
3255
  contextDirectory = () => {
3475
3256
  const ctx = this._ctx.select("contextDirectory");
3476
3257
  return new Directory(ctx);
3477
3258
  };
3478
3259
  /**
3479
- * The effective module source dependencies from the configuration, and calls to withDependencies and withoutDependencies.
3260
+ * The dependencies of the module source.
3480
3261
  */
3481
3262
  dependencies = async () => {
3482
3263
  const ctx = this._ctx.select("dependencies").select("id");
3483
3264
  const response = await ctx.execute();
3484
- return response.map((r) => new Client(ctx.copy()).loadModuleDependencyFromID(r.id));
3265
+ return response.map((r) => new Client(ctx.copy()).loadModuleSourceFromID(r.id));
3485
3266
  };
3486
3267
  /**
3487
- * 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.
3488
3269
  */
3489
3270
  digest = async () => {
3490
3271
  if (this._digest) {
@@ -3496,14 +3277,54 @@ export class ModuleSource extends BaseClient {
3496
3277
  };
3497
3278
  /**
3498
3279
  * The directory containing the module configuration and source code (source code may be in a subdir).
3499
- * @param path The path from the source directory to select.
3280
+ * @param path A subpath from the source directory to select.
3500
3281
  */
3501
3282
  directory = (path) => {
3502
3283
  const ctx = this._ctx.select("directory", { path });
3503
3284
  return new Directory(ctx);
3504
3285
  };
3505
3286
  /**
3506
- * 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).
3507
3328
  */
3508
3329
  kind = async () => {
3509
3330
  if (this._kind) {
@@ -3514,7 +3335,18 @@ export class ModuleSource extends BaseClient {
3514
3335
  return response;
3515
3336
  };
3516
3337
  /**
3517
- * 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.
3518
3350
  */
3519
3351
  moduleName = async () => {
3520
3352
  if (this._moduleName) {
@@ -3525,7 +3357,7 @@ export class ModuleSource extends BaseClient {
3525
3357
  return response;
3526
3358
  };
3527
3359
  /**
3528
- * 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).
3529
3361
  */
3530
3362
  moduleOriginalName = async () => {
3531
3363
  if (this._moduleOriginalName) {
@@ -3547,46 +3379,25 @@ export class ModuleSource extends BaseClient {
3547
3379
  return response;
3548
3380
  };
3549
3381
  /**
3550
- * 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.
3551
3383
  */
3552
- resolveContextPathFromCaller = async () => {
3553
- if (this._resolveContextPathFromCaller) {
3554
- return this._resolveContextPathFromCaller;
3384
+ repoRootPath = async () => {
3385
+ if (this._repoRootPath) {
3386
+ return this._repoRootPath;
3555
3387
  }
3556
- const ctx = this._ctx.select("resolveContextPathFromCaller");
3388
+ const ctx = this._ctx.select("repoRootPath");
3557
3389
  const response = await ctx.execute();
3558
3390
  return response;
3559
3391
  };
3560
3392
  /**
3561
- * Resolve the provided module source arg as a dependency relative to this module source.
3562
- * @param dep The dependency module source to resolve.
3563
- */
3564
- resolveDependency = (dep) => {
3565
- const ctx = this._ctx.select("resolveDependency", { dep });
3566
- return new ModuleSource(ctx);
3567
- };
3568
- /**
3569
- * Load a directory from the caller optionally with a given view applied.
3570
- * @param path The path on the caller's filesystem to load.
3571
- * @param opts.viewName If set, the name of the view to apply to the path.
3572
- * @param opts.ignore Patterns to ignore when loading the directory.
3393
+ * The SDK configuration of the module.
3573
3394
  */
3574
- resolveDirectoryFromCaller = (path, opts) => {
3575
- const ctx = this._ctx.select("resolveDirectoryFromCaller", {
3576
- path,
3577
- ...opts,
3578
- });
3579
- return new Directory(ctx);
3580
- };
3581
- /**
3582
- * Load the source from its path on the caller's filesystem, including only needed+configured files and directories. Only valid for local sources.
3583
- */
3584
- resolveFromCaller = () => {
3585
- const ctx = this._ctx.select("resolveFromCaller");
3586
- return new ModuleSource(ctx);
3395
+ sdk = () => {
3396
+ const ctx = this._ctx.select("sdk");
3397
+ return new SDKConfig(ctx);
3587
3398
  };
3588
3399
  /**
3589
- * 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.
3590
3401
  */
3591
3402
  sourceRootSubpath = async () => {
3592
3403
  if (this._sourceRootSubpath) {
@@ -3597,7 +3408,7 @@ export class ModuleSource extends BaseClient {
3597
3408
  return response;
3598
3409
  };
3599
3410
  /**
3600
- * 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.
3601
3412
  */
3602
3413
  sourceSubpath = async () => {
3603
3414
  if (this._sourceSubpath) {
@@ -3608,28 +3419,23 @@ export class ModuleSource extends BaseClient {
3608
3419
  return response;
3609
3420
  };
3610
3421
  /**
3611
- * Retrieve a named view defined for this module source.
3612
- * @param name The name of the view to retrieve.
3613
- */
3614
- view = (name) => {
3615
- const ctx = this._ctx.select("view", { name });
3616
- return new ModuleSourceView(ctx);
3617
- };
3618
- /**
3619
- * 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.
3620
3423
  */
3621
- views = async () => {
3622
- const ctx = this._ctx.select("views").select("id");
3424
+ sync = async () => {
3425
+ const ctx = this._ctx.select("sync");
3623
3426
  const response = await ctx.execute();
3624
- return response.map((r) => new Client(ctx.copy()).loadModuleSourceViewFromID(r.id));
3427
+ return new Client(ctx.copy()).loadModuleSourceFromID(response);
3625
3428
  };
3626
3429
  /**
3627
- * Update the module source with a new context directory. Only valid for local sources.
3628
- * @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.
3629
3431
  */
3630
- withContextDirectory = (dir) => {
3631
- const ctx = this._ctx.select("withContextDirectory", { dir });
3632
- 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;
3633
3439
  };
3634
3440
  /**
3635
3441
  * Append the provided dependencies to the module source's dependency list.
@@ -3640,11 +3446,19 @@ export class ModuleSource extends BaseClient {
3640
3446
  return new ModuleSource(ctx);
3641
3447
  };
3642
3448
  /**
3643
- * Sets module init arguments
3644
- * @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.
3645
3459
  */
3646
- withInit = (opts) => {
3647
- const ctx = this._ctx.select("withInit", { ...opts });
3460
+ withIncludes = (patterns) => {
3461
+ const ctx = this._ctx.select("withIncludes", { patterns });
3648
3462
  return new ModuleSource(ctx);
3649
3463
  };
3650
3464
  /**
@@ -3657,15 +3471,15 @@ export class ModuleSource extends BaseClient {
3657
3471
  };
3658
3472
  /**
3659
3473
  * Update the module source with a new SDK.
3660
- * @param sdk The SDK to set.
3474
+ * @param source The SDK source to set.
3661
3475
  */
3662
- withSDK = (sdk) => {
3663
- const ctx = this._ctx.select("withSDK", { sdk });
3476
+ withSDK = (source) => {
3477
+ const ctx = this._ctx.select("withSDK", { source });
3664
3478
  return new ModuleSource(ctx);
3665
3479
  };
3666
3480
  /**
3667
3481
  * Update the module source with a new source subpath.
3668
- * @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.
3669
3483
  */
3670
3484
  withSourceSubpath = (path) => {
3671
3485
  const ctx = this._ctx.select("withSourceSubpath", { path });
@@ -3679,15 +3493,6 @@ export class ModuleSource extends BaseClient {
3679
3493
  const ctx = this._ctx.select("withUpdateDependencies", { dependencies });
3680
3494
  return new ModuleSource(ctx);
3681
3495
  };
3682
- /**
3683
- * Update the module source with a new named view.
3684
- * @param name The name of the view to set.
3685
- * @param patterns The patterns to set as the view filters.
3686
- */
3687
- withView = (name, patterns) => {
3688
- const ctx = this._ctx.select("withView", { name, patterns });
3689
- return new ModuleSource(ctx);
3690
- };
3691
3496
  /**
3692
3497
  * Remove the provided dependencies from the module source's dependency list.
3693
3498
  * @param dependencies The dependencies to remove.
@@ -3705,51 +3510,6 @@ export class ModuleSource extends BaseClient {
3705
3510
  return arg(this);
3706
3511
  };
3707
3512
  }
3708
- /**
3709
- * A named set of path filters that can be applied to directory arguments provided to functions.
3710
- */
3711
- export class ModuleSourceView extends BaseClient {
3712
- _id = undefined;
3713
- _name = undefined;
3714
- /**
3715
- * Constructor is used for internal usage only, do not create object from it.
3716
- */
3717
- constructor(ctx, _id, _name) {
3718
- super(ctx);
3719
- this._id = _id;
3720
- this._name = _name;
3721
- }
3722
- /**
3723
- * A unique identifier for this ModuleSourceView.
3724
- */
3725
- id = async () => {
3726
- if (this._id) {
3727
- return this._id;
3728
- }
3729
- const ctx = this._ctx.select("id");
3730
- const response = await ctx.execute();
3731
- return response;
3732
- };
3733
- /**
3734
- * The name of the view
3735
- */
3736
- name = async () => {
3737
- if (this._name) {
3738
- return this._name;
3739
- }
3740
- const ctx = this._ctx.select("name");
3741
- const response = await ctx.execute();
3742
- return response;
3743
- };
3744
- /**
3745
- * The patterns of the view used to filter paths
3746
- */
3747
- patterns = async () => {
3748
- const ctx = this._ctx.select("patterns");
3749
- const response = await ctx.execute();
3750
- return response;
3751
- };
3752
- }
3753
3513
  /**
3754
3514
  * A definition of a custom object defined in a Module.
3755
3515
  */
@@ -4200,13 +3960,6 @@ export class Client extends BaseClient {
4200
3960
  const ctx = this._ctx.select("loadGeneratedCodeFromID", { id });
4201
3961
  return new GeneratedCode(ctx);
4202
3962
  };
4203
- /**
4204
- * Load a GitModuleSource from its ID.
4205
- */
4206
- loadGitModuleSourceFromID = (id) => {
4207
- const ctx = this._ctx.select("loadGitModuleSourceFromID", { id });
4208
- return new GitModuleSource(ctx);
4209
- };
4210
3963
  /**
4211
3964
  * Load a GitRef from its ID.
4212
3965
  */
@@ -4256,20 +4009,6 @@ export class Client extends BaseClient {
4256
4009
  const ctx = this._ctx.select("loadListTypeDefFromID", { id });
4257
4010
  return new ListTypeDef(ctx);
4258
4011
  };
4259
- /**
4260
- * Load a LocalModuleSource from its ID.
4261
- */
4262
- loadLocalModuleSourceFromID = (id) => {
4263
- const ctx = this._ctx.select("loadLocalModuleSourceFromID", { id });
4264
- return new LocalModuleSource(ctx);
4265
- };
4266
- /**
4267
- * Load a ModuleDependency from its ID.
4268
- */
4269
- loadModuleDependencyFromID = (id) => {
4270
- const ctx = this._ctx.select("loadModuleDependencyFromID", { id });
4271
- return new ModuleDependency(ctx);
4272
- };
4273
4012
  /**
4274
4013
  * Load a Module from its ID.
4275
4014
  */
@@ -4284,13 +4023,6 @@ export class Client extends BaseClient {
4284
4023
  const ctx = this._ctx.select("loadModuleSourceFromID", { id });
4285
4024
  return new ModuleSource(ctx);
4286
4025
  };
4287
- /**
4288
- * Load a ModuleSourceView from its ID.
4289
- */
4290
- loadModuleSourceViewFromID = (id) => {
4291
- const ctx = this._ctx.select("loadModuleSourceViewFromID", { id });
4292
- return new ModuleSourceView(ctx);
4293
- };
4294
4026
  /**
4295
4027
  * Load a ObjectTypeDef from its ID.
4296
4028
  */
@@ -4305,6 +4037,13 @@ export class Client extends BaseClient {
4305
4037
  const ctx = this._ctx.select("loadPortFromID", { id });
4306
4038
  return new Port(ctx);
4307
4039
  };
4040
+ /**
4041
+ * Load a SDKConfig from its ID.
4042
+ */
4043
+ loadSDKConfigFromID = (id) => {
4044
+ const ctx = this._ctx.select("loadSDKConfigFromID", { id });
4045
+ return new SDKConfig(ctx);
4046
+ };
4308
4047
  /**
4309
4048
  * Load a ScalarTypeDef from its ID.
4310
4049
  */
@@ -4319,6 +4058,13 @@ export class Client extends BaseClient {
4319
4058
  const ctx = this._ctx.select("loadSecretFromID", { id });
4320
4059
  return new Secret(ctx);
4321
4060
  };
4061
+ /**
4062
+ * Load a Secret from its Name.
4063
+ */
4064
+ loadSecretFromName = (name, opts) => {
4065
+ const ctx = this._ctx.select("loadSecretFromName", { name, ...opts });
4066
+ return new Secret(ctx);
4067
+ };
4322
4068
  /**
4323
4069
  * Load a Service from its ID.
4324
4070
  */
@@ -4362,30 +4108,30 @@ export class Client extends BaseClient {
4362
4108
  return new Module_(ctx);
4363
4109
  };
4364
4110
  /**
4365
- * Create a new module dependency configuration from a module source and name
4366
- * @param source The source of the dependency
4367
- * @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.
4368
- */
4369
- moduleDependency = (source, opts) => {
4370
- const ctx = this._ctx.select("moduleDependency", { source, ...opts });
4371
- return new ModuleDependency(ctx);
4372
- };
4373
- /**
4374
- * Create a new module source instance from a source ref string.
4111
+ * Create a new module source instance from a source ref string
4375
4112
  * @param refString The string ref representation of the module source
4376
4113
  * @param opts.refPin The pinned version of the module source
4377
- * @param opts.stable If true, enforce that the source is a stable version for source kinds that support versioning.
4378
- * @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.
4379
4117
  */
4380
4118
  moduleSource = (refString, opts) => {
4381
- 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
+ });
4382
4127
  return new ModuleSource(ctx);
4383
4128
  };
4384
4129
  /**
4385
- * Reference a secret by name.
4130
+ * Creates a new secret.
4131
+ * @param uri The URI of the secret store
4386
4132
  */
4387
- secret = (name, opts) => {
4388
- const ctx = this._ctx.select("secret", { name, ...opts });
4133
+ secret = (uri) => {
4134
+ const ctx = this._ctx.select("secret", { uri });
4389
4135
  return new Secret(ctx);
4390
4136
  };
4391
4137
  /**
@@ -4425,6 +4171,43 @@ export class Client extends BaseClient {
4425
4171
  return response;
4426
4172
  };
4427
4173
  }
4174
+ /**
4175
+ * The SDK config of the module.
4176
+ */
4177
+ export class SDKConfig extends BaseClient {
4178
+ _id = undefined;
4179
+ _source = undefined;
4180
+ /**
4181
+ * Constructor is used for internal usage only, do not create object from it.
4182
+ */
4183
+ constructor(ctx, _id, _source) {
4184
+ super(ctx);
4185
+ this._id = _id;
4186
+ this._source = _source;
4187
+ }
4188
+ /**
4189
+ * A unique identifier for this SDKConfig.
4190
+ */
4191
+ id = async () => {
4192
+ if (this._id) {
4193
+ return this._id;
4194
+ }
4195
+ const ctx = this._ctx.select("id");
4196
+ const response = await ctx.execute();
4197
+ return response;
4198
+ };
4199
+ /**
4200
+ * Source of the SDK. Either a name of a builtin SDK or a module source ref string pointing to the SDK's implementation.
4201
+ */
4202
+ source = async () => {
4203
+ if (this._source) {
4204
+ return this._source;
4205
+ }
4206
+ const ctx = this._ctx.select("source");
4207
+ const response = await ctx.execute();
4208
+ return response;
4209
+ };
4210
+ }
4428
4211
  /**
4429
4212
  * A definition of a custom scalar defined in a Module.
4430
4213
  */
@@ -4495,14 +4278,16 @@ export class Secret extends BaseClient {
4495
4278
  _id = undefined;
4496
4279
  _name = undefined;
4497
4280
  _plaintext = undefined;
4281
+ _uri = undefined;
4498
4282
  /**
4499
4283
  * Constructor is used for internal usage only, do not create object from it.
4500
4284
  */
4501
- constructor(ctx, _id, _name, _plaintext) {
4285
+ constructor(ctx, _id, _name, _plaintext, _uri) {
4502
4286
  super(ctx);
4503
4287
  this._id = _id;
4504
4288
  this._name = _name;
4505
4289
  this._plaintext = _plaintext;
4290
+ this._uri = _uri;
4506
4291
  }
4507
4292
  /**
4508
4293
  * A unique identifier for this Secret.
@@ -4537,6 +4322,17 @@ export class Secret extends BaseClient {
4537
4322
  const response = await ctx.execute();
4538
4323
  return response;
4539
4324
  };
4325
+ /**
4326
+ * The URI of this secret.
4327
+ */
4328
+ uri = async () => {
4329
+ if (this._uri) {
4330
+ return this._uri;
4331
+ }
4332
+ const ctx = this._ctx.select("uri");
4333
+ const response = await ctx.execute();
4334
+ return response;
4335
+ };
4540
4336
  }
4541
4337
  /**
4542
4338
  * A content-addressed service providing TCP connectivity.