@dagger.io/dagger 0.19.3 → 0.19.5

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.
Files changed (45) hide show
  1. package/dist/src/api/client.gen.d.ts +143 -6
  2. package/dist/src/api/client.gen.d.ts.map +1 -1
  3. package/dist/src/api/client.gen.js +204 -6
  4. package/dist/src/module/decorators.d.ts.map +1 -1
  5. package/dist/src/module/entrypoint/register.d.ts.map +1 -1
  6. package/dist/src/module/entrypoint/register.js +37 -9
  7. package/dist/src/module/introspector/dagger_module/argument.d.ts +2 -0
  8. package/dist/src/module/introspector/dagger_module/argument.d.ts.map +1 -1
  9. package/dist/src/module/introspector/dagger_module/argument.js +9 -2
  10. package/dist/src/module/introspector/dagger_module/enum.d.ts +2 -0
  11. package/dist/src/module/introspector/dagger_module/enum.d.ts.map +1 -1
  12. package/dist/src/module/introspector/dagger_module/enum.js +5 -1
  13. package/dist/src/module/introspector/dagger_module/enumBase.d.ts +1 -0
  14. package/dist/src/module/introspector/dagger_module/enumBase.d.ts.map +1 -1
  15. package/dist/src/module/introspector/dagger_module/enumClass.d.ts +2 -0
  16. package/dist/src/module/introspector/dagger_module/enumClass.d.ts.map +1 -1
  17. package/dist/src/module/introspector/dagger_module/enumClass.js +5 -1
  18. package/dist/src/module/introspector/dagger_module/function.d.ts +4 -2
  19. package/dist/src/module/introspector/dagger_module/function.d.ts.map +1 -1
  20. package/dist/src/module/introspector/dagger_module/function.js +19 -10
  21. package/dist/src/module/introspector/dagger_module/interfaceFunction.d.ts +4 -1
  22. package/dist/src/module/introspector/dagger_module/interfaceFunction.d.ts.map +1 -1
  23. package/dist/src/module/introspector/dagger_module/interfaceFunction.js +8 -3
  24. package/dist/src/module/introspector/dagger_module/object.d.ts +2 -0
  25. package/dist/src/module/introspector/dagger_module/object.d.ts.map +1 -1
  26. package/dist/src/module/introspector/dagger_module/object.js +5 -1
  27. package/dist/src/module/introspector/dagger_module/objectBase.d.ts +2 -0
  28. package/dist/src/module/introspector/dagger_module/objectBase.d.ts.map +1 -1
  29. package/dist/src/module/introspector/dagger_module/property.d.ts +2 -0
  30. package/dist/src/module/introspector/dagger_module/property.d.ts.map +1 -1
  31. package/dist/src/module/introspector/dagger_module/property.js +5 -1
  32. package/dist/src/module/introspector/dagger_module/typeObject.d.ts +2 -0
  33. package/dist/src/module/introspector/dagger_module/typeObject.d.ts.map +1 -1
  34. package/dist/src/module/introspector/dagger_module/typeObject.js +5 -1
  35. package/dist/src/module/introspector/dagger_module/typeObjectProperty.d.ts +2 -0
  36. package/dist/src/module/introspector/dagger_module/typeObjectProperty.d.ts.map +1 -1
  37. package/dist/src/module/introspector/dagger_module/typeObjectProperty.js +5 -1
  38. package/dist/src/module/introspector/typescript_module/ast.d.ts +5 -0
  39. package/dist/src/module/introspector/typescript_module/ast.d.ts.map +1 -1
  40. package/dist/src/module/introspector/typescript_module/ast.js +24 -1
  41. package/dist/src/module/registry.d.ts +14 -0
  42. package/dist/src/module/registry.d.ts.map +1 -1
  43. package/dist/src/provisioning/default.d.ts +1 -1
  44. package/dist/src/provisioning/default.js +1 -1
  45. package/package.json +15 -15
@@ -112,6 +112,47 @@ function ExistsTypeNameToValue(name) {
112
112
  return name;
113
113
  }
114
114
  }
115
+ /**
116
+ * The behavior configured for function result caching.
117
+ */
118
+ export var FunctionCachePolicy;
119
+ (function (FunctionCachePolicy) {
120
+ FunctionCachePolicy["Default"] = "Default";
121
+ FunctionCachePolicy["Never"] = "Never";
122
+ FunctionCachePolicy["PerSession"] = "PerSession";
123
+ })(FunctionCachePolicy || (FunctionCachePolicy = {}));
124
+ /**
125
+ * Utility function to convert a FunctionCachePolicy value to its name so
126
+ * it can be uses as argument to call a exposed function.
127
+ */
128
+ function FunctionCachePolicyValueToName(value) {
129
+ switch (value) {
130
+ case FunctionCachePolicy.Default:
131
+ return "Default";
132
+ case FunctionCachePolicy.Never:
133
+ return "Never";
134
+ case FunctionCachePolicy.PerSession:
135
+ return "PerSession";
136
+ default:
137
+ return value;
138
+ }
139
+ }
140
+ /**
141
+ * Utility function to convert a FunctionCachePolicy name to its value so
142
+ * it can be properly used inside the module runtime.
143
+ */
144
+ function FunctionCachePolicyNameToValue(name) {
145
+ switch (name) {
146
+ case "Default":
147
+ return FunctionCachePolicy.Default;
148
+ case "Never":
149
+ return FunctionCachePolicy.Never;
150
+ case "PerSession":
151
+ return FunctionCachePolicy.PerSession;
152
+ default:
153
+ return name;
154
+ }
155
+ }
115
156
  /**
116
157
  * Compression algorithm to use for image layers.
117
158
  */
@@ -1561,6 +1602,7 @@ export class Container extends BaseClient {
1561
1602
  * @param source Identifier of the directory to write
1562
1603
  * @param opts.exclude Patterns to exclude in the written directory (e.g. ["node_modules/**", ".gitignore", ".git/"]).
1563
1604
  * @param opts.include Patterns to include in the written directory (e.g. ["*.go", "go.mod", "go.sum"]).
1605
+ * @param opts.gitignore Apply .gitignore rules when writing the directory.
1564
1606
  * @param opts.owner A user:group to set for the directory and its contents.
1565
1607
  *
1566
1608
  * The user and group can either be an ID (1000:1000) or a name (foo:bar).
@@ -2094,6 +2136,7 @@ export class CurrentModule extends BaseClient {
2094
2136
  * @param path Location of the directory to access (e.g., ".").
2095
2137
  * @param opts.exclude Exclude artifacts that match the given pattern (e.g., ["node_modules/", ".git*"]).
2096
2138
  * @param opts.include Include only artifacts that match the given pattern (e.g., ["app/", "package.*"]).
2139
+ * @param opts.gitignore Apply .gitignore filter rules inside the directory
2097
2140
  */
2098
2141
  workdir = (path, opts) => {
2099
2142
  const ctx = this._ctx.select("workdir", { path, ...opts });
@@ -2292,6 +2335,7 @@ export class Directory extends BaseClient {
2292
2335
  * Return a snapshot with some paths included or excluded
2293
2336
  * @param opts.exclude If set, paths matching one of these glob patterns is excluded from the new snapshot. Example: ["node_modules/", ".git*", ".env"]
2294
2337
  * @param opts.include If set, only paths matching one of these glob patterns is included in the new snapshot. Example: (e.g., ["app/", "package.*"]).
2338
+ * @param opts.gitignore If set, apply .gitignore rules when filtering the directory.
2295
2339
  */
2296
2340
  filter = (opts) => {
2297
2341
  const ctx = this._ctx.select("filter", { ...opts });
@@ -2384,6 +2428,7 @@ export class Directory extends BaseClient {
2384
2428
  * @param source Identifier of the directory to copy.
2385
2429
  * @param opts.exclude Exclude artifacts that match the given pattern (e.g., ["node_modules/", ".git*"]).
2386
2430
  * @param opts.include Include only artifacts that match the given pattern (e.g., ["app/", "package.*"]).
2431
+ * @param opts.gitignore Apply .gitignore filter rules inside the directory
2387
2432
  * @param opts.owner A user:group to set for the copied directory and its contents.
2388
2433
  *
2389
2434
  * The user and group must be an ID (1000:1000), not a name (foo:bar).
@@ -2541,6 +2586,14 @@ export class Engine extends BaseClient {
2541
2586
  const response = await ctx.execute();
2542
2587
  return response;
2543
2588
  };
2589
+ /**
2590
+ * The list of connected client IDs
2591
+ */
2592
+ clients = async () => {
2593
+ const ctx = this._ctx.select("clients");
2594
+ const response = await ctx.execute();
2595
+ return response;
2596
+ };
2544
2597
  /**
2545
2598
  * The local (on-disk) cache for the Dagger engine
2546
2599
  */
@@ -2894,15 +2947,17 @@ export class EnumTypeDef extends BaseClient {
2894
2947
  */
2895
2948
  export class EnumValueTypeDef extends BaseClient {
2896
2949
  _id = undefined;
2950
+ _deprecated = undefined;
2897
2951
  _description = undefined;
2898
2952
  _name = undefined;
2899
2953
  _value = undefined;
2900
2954
  /**
2901
2955
  * Constructor is used for internal usage only, do not create object from it.
2902
2956
  */
2903
- constructor(ctx, _id, _description, _name, _value) {
2957
+ constructor(ctx, _id, _deprecated, _description, _name, _value) {
2904
2958
  super(ctx);
2905
2959
  this._id = _id;
2960
+ this._deprecated = _deprecated;
2906
2961
  this._description = _description;
2907
2962
  this._name = _name;
2908
2963
  this._value = _value;
@@ -2918,6 +2973,17 @@ export class EnumValueTypeDef extends BaseClient {
2918
2973
  const response = await ctx.execute();
2919
2974
  return response;
2920
2975
  };
2976
+ /**
2977
+ * The reason this enum member is deprecated, if any.
2978
+ */
2979
+ deprecated = async () => {
2980
+ if (this._deprecated) {
2981
+ return this._deprecated;
2982
+ }
2983
+ const ctx = this._ctx.select("deprecated");
2984
+ const response = await ctx.execute();
2985
+ return response;
2986
+ };
2921
2987
  /**
2922
2988
  * A doc string for the enum member, if any.
2923
2989
  */
@@ -3808,14 +3874,16 @@ export class ErrorValue extends BaseClient {
3808
3874
  */
3809
3875
  export class FieldTypeDef extends BaseClient {
3810
3876
  _id = undefined;
3877
+ _deprecated = undefined;
3811
3878
  _description = undefined;
3812
3879
  _name = undefined;
3813
3880
  /**
3814
3881
  * Constructor is used for internal usage only, do not create object from it.
3815
3882
  */
3816
- constructor(ctx, _id, _description, _name) {
3883
+ constructor(ctx, _id, _deprecated, _description, _name) {
3817
3884
  super(ctx);
3818
3885
  this._id = _id;
3886
+ this._deprecated = _deprecated;
3819
3887
  this._description = _description;
3820
3888
  this._name = _name;
3821
3889
  }
@@ -3830,6 +3898,17 @@ export class FieldTypeDef extends BaseClient {
3830
3898
  const response = await ctx.execute();
3831
3899
  return response;
3832
3900
  };
3901
+ /**
3902
+ * The reason this enum member is deprecated, if any.
3903
+ */
3904
+ deprecated = async () => {
3905
+ if (this._deprecated) {
3906
+ return this._deprecated;
3907
+ }
3908
+ const ctx = this._ctx.select("deprecated");
3909
+ const response = await ctx.execute();
3910
+ return response;
3911
+ };
3833
3912
  /**
3834
3913
  * A doc string for the field, if any.
3835
3914
  */
@@ -4066,14 +4145,16 @@ export class File extends BaseClient {
4066
4145
  */
4067
4146
  export class Function_ extends BaseClient {
4068
4147
  _id = undefined;
4148
+ _deprecated = undefined;
4069
4149
  _description = undefined;
4070
4150
  _name = undefined;
4071
4151
  /**
4072
4152
  * Constructor is used for internal usage only, do not create object from it.
4073
4153
  */
4074
- constructor(ctx, _id, _description, _name) {
4154
+ constructor(ctx, _id, _deprecated, _description, _name) {
4075
4155
  super(ctx);
4076
4156
  this._id = _id;
4157
+ this._deprecated = _deprecated;
4077
4158
  this._description = _description;
4078
4159
  this._name = _name;
4079
4160
  }
@@ -4096,6 +4177,17 @@ export class Function_ extends BaseClient {
4096
4177
  const response = await ctx.execute();
4097
4178
  return response.map((r) => new Client(ctx.copy()).loadFunctionArgFromID(r.id));
4098
4179
  };
4180
+ /**
4181
+ * The reason this function is deprecated, if any.
4182
+ */
4183
+ deprecated = async () => {
4184
+ if (this._deprecated) {
4185
+ return this._deprecated;
4186
+ }
4187
+ const ctx = this._ctx.select("deprecated");
4188
+ const response = await ctx.execute();
4189
+ return response;
4190
+ };
4099
4191
  /**
4100
4192
  * A doc string for the function, if any.
4101
4193
  */
@@ -4141,11 +4233,36 @@ export class Function_ extends BaseClient {
4141
4233
  * @param opts.defaultPath If the argument is a Directory or File type, default to load path from context directory, relative to root directory.
4142
4234
  * @param opts.ignore Patterns to ignore when loading the contextual argument value.
4143
4235
  * @param opts.sourceMap The source map for the argument definition.
4236
+ * @param opts.deprecated If deprecated, the reason or migration path.
4144
4237
  */
4145
4238
  withArg = (name, typeDef, opts) => {
4146
4239
  const ctx = this._ctx.select("withArg", { name, typeDef, ...opts });
4147
4240
  return new Function_(ctx);
4148
4241
  };
4242
+ /**
4243
+ * Returns the function updated to use the provided cache policy.
4244
+ * @param policy The cache policy to use.
4245
+ * @param opts.timeToLive The TTL for the cache policy, if applicable. Provided as a duration string, e.g. "5m", "1h30s".
4246
+ */
4247
+ withCachePolicy = (policy, opts) => {
4248
+ const metadata = {
4249
+ policy: { is_enum: true, value_to_name: FunctionCachePolicyValueToName },
4250
+ };
4251
+ const ctx = this._ctx.select("withCachePolicy", {
4252
+ policy,
4253
+ ...opts,
4254
+ __metadata: metadata,
4255
+ });
4256
+ return new Function_(ctx);
4257
+ };
4258
+ /**
4259
+ * Returns the function with the provided deprecation reason.
4260
+ * @param opts.reason Reason or migration path describing the deprecation.
4261
+ */
4262
+ withDeprecated = (opts) => {
4263
+ const ctx = this._ctx.select("withDeprecated", { ...opts });
4264
+ return new Function_(ctx);
4265
+ };
4149
4266
  /**
4150
4267
  * Returns the function with the given doc string.
4151
4268
  * @param description The doc string to set.
@@ -4180,16 +4297,18 @@ export class FunctionArg extends BaseClient {
4180
4297
  _id = undefined;
4181
4298
  _defaultPath = undefined;
4182
4299
  _defaultValue = undefined;
4300
+ _deprecated = undefined;
4183
4301
  _description = undefined;
4184
4302
  _name = undefined;
4185
4303
  /**
4186
4304
  * Constructor is used for internal usage only, do not create object from it.
4187
4305
  */
4188
- constructor(ctx, _id, _defaultPath, _defaultValue, _description, _name) {
4306
+ constructor(ctx, _id, _defaultPath, _defaultValue, _deprecated, _description, _name) {
4189
4307
  super(ctx);
4190
4308
  this._id = _id;
4191
4309
  this._defaultPath = _defaultPath;
4192
4310
  this._defaultValue = _defaultValue;
4311
+ this._deprecated = _deprecated;
4193
4312
  this._description = _description;
4194
4313
  this._name = _name;
4195
4314
  }
@@ -4226,6 +4345,17 @@ export class FunctionArg extends BaseClient {
4226
4345
  const response = await ctx.execute();
4227
4346
  return response;
4228
4347
  };
4348
+ /**
4349
+ * The reason this function is deprecated, if any.
4350
+ */
4351
+ deprecated = async () => {
4352
+ if (this._deprecated) {
4353
+ return this._deprecated;
4354
+ }
4355
+ const ctx = this._ctx.select("deprecated");
4356
+ const response = await ctx.execute();
4357
+ return response;
4358
+ };
4229
4359
  /**
4230
4360
  * A doc string for the argument, if any.
4231
4361
  */
@@ -4651,6 +4781,13 @@ export class GitRepository extends BaseClient {
4651
4781
  const response = await ctx.execute();
4652
4782
  return response;
4653
4783
  };
4784
+ /**
4785
+ * Returns the changeset of uncommitted changes in the git repository.
4786
+ */
4787
+ uncommitted = () => {
4788
+ const ctx = this._ctx.select("uncommitted");
4789
+ return new Changeset(ctx);
4790
+ };
4654
4791
  /**
4655
4792
  * The URL of the git repository.
4656
4793
  */
@@ -6011,6 +6148,14 @@ export class ModuleSource extends BaseClient {
6011
6148
  const response = await ctx.execute();
6012
6149
  return new Client(ctx.copy()).loadModuleSourceFromID(response);
6013
6150
  };
6151
+ /**
6152
+ * The toolchains referenced by the module source.
6153
+ */
6154
+ toolchains = async () => {
6155
+ const ctx = this._ctx.select("toolchains").select("id");
6156
+ const response = await ctx.execute();
6157
+ return response.map((r) => new Client(ctx.copy()).loadModuleSourceFromID(r.id));
6158
+ };
6014
6159
  /**
6015
6160
  * User-defined defaults read from local .env files
6016
6161
  */
@@ -6102,6 +6247,14 @@ export class ModuleSource extends BaseClient {
6102
6247
  const ctx = this._ctx.select("withSourceSubpath", { path });
6103
6248
  return new ModuleSource(ctx);
6104
6249
  };
6250
+ /**
6251
+ * Add toolchains to the module source.
6252
+ * @param toolchains The toolchain modules to add.
6253
+ */
6254
+ withToolchains = (toolchains) => {
6255
+ const ctx = this._ctx.select("withToolchains", { toolchains });
6256
+ return new ModuleSource(ctx);
6257
+ };
6105
6258
  /**
6106
6259
  * Update the blueprint module to the latest version.
6107
6260
  */
@@ -6117,6 +6270,14 @@ export class ModuleSource extends BaseClient {
6117
6270
  const ctx = this._ctx.select("withUpdateDependencies", { dependencies });
6118
6271
  return new ModuleSource(ctx);
6119
6272
  };
6273
+ /**
6274
+ * Update one or more toolchains.
6275
+ * @param toolchains The toolchains to update.
6276
+ */
6277
+ withUpdateToolchains = (toolchains) => {
6278
+ const ctx = this._ctx.select("withUpdateToolchains", { toolchains });
6279
+ return new ModuleSource(ctx);
6280
+ };
6120
6281
  /**
6121
6282
  * Update one or more clients.
6122
6283
  * @param clients The clients to update
@@ -6156,6 +6317,14 @@ export class ModuleSource extends BaseClient {
6156
6317
  const ctx = this._ctx.select("withoutExperimentalFeatures", { features });
6157
6318
  return new ModuleSource(ctx);
6158
6319
  };
6320
+ /**
6321
+ * Remove the provided toolchains from the module source.
6322
+ * @param toolchains The toolchains to remove.
6323
+ */
6324
+ withoutToolchains = (toolchains) => {
6325
+ const ctx = this._ctx.select("withoutToolchains", { toolchains });
6326
+ return new ModuleSource(ctx);
6327
+ };
6159
6328
  /**
6160
6329
  * Call the provided function with current ModuleSource.
6161
6330
  *
@@ -6170,15 +6339,17 @@ export class ModuleSource extends BaseClient {
6170
6339
  */
6171
6340
  export class ObjectTypeDef extends BaseClient {
6172
6341
  _id = undefined;
6342
+ _deprecated = undefined;
6173
6343
  _description = undefined;
6174
6344
  _name = undefined;
6175
6345
  _sourceModuleName = undefined;
6176
6346
  /**
6177
6347
  * Constructor is used for internal usage only, do not create object from it.
6178
6348
  */
6179
- constructor(ctx, _id, _description, _name, _sourceModuleName) {
6349
+ constructor(ctx, _id, _deprecated, _description, _name, _sourceModuleName) {
6180
6350
  super(ctx);
6181
6351
  this._id = _id;
6352
+ this._deprecated = _deprecated;
6182
6353
  this._description = _description;
6183
6354
  this._name = _name;
6184
6355
  this._sourceModuleName = _sourceModuleName;
@@ -6201,6 +6372,17 @@ export class ObjectTypeDef extends BaseClient {
6201
6372
  const ctx = this._ctx.select("constructor");
6202
6373
  return new Function_(ctx);
6203
6374
  };
6375
+ /**
6376
+ * The reason this enum member is deprecated, if any.
6377
+ */
6378
+ deprecated = async () => {
6379
+ if (this._deprecated) {
6380
+ return this._deprecated;
6381
+ }
6382
+ const ctx = this._ctx.select("deprecated");
6383
+ const response = await ctx.execute();
6384
+ return response;
6385
+ };
6204
6386
  /**
6205
6387
  * The doc string for the object, if any.
6206
6388
  */
@@ -6992,13 +7174,15 @@ export class Client extends BaseClient {
6992
7174
  */
6993
7175
  export class SDKConfig extends BaseClient {
6994
7176
  _id = undefined;
7177
+ _debug = undefined;
6995
7178
  _source = undefined;
6996
7179
  /**
6997
7180
  * Constructor is used for internal usage only, do not create object from it.
6998
7181
  */
6999
- constructor(ctx, _id, _source) {
7182
+ constructor(ctx, _id, _debug, _source) {
7000
7183
  super(ctx);
7001
7184
  this._id = _id;
7185
+ this._debug = _debug;
7002
7186
  this._source = _source;
7003
7187
  }
7004
7188
  /**
@@ -7012,6 +7196,17 @@ export class SDKConfig extends BaseClient {
7012
7196
  const response = await ctx.execute();
7013
7197
  return response;
7014
7198
  };
7199
+ /**
7200
+ * Whether to start the SDK runtime in debug mode with an interactive terminal.
7201
+ */
7202
+ debug = async () => {
7203
+ if (this._debug) {
7204
+ return this._debug;
7205
+ }
7206
+ const ctx = this._ctx.select("debug");
7207
+ const response = await ctx.execute();
7208
+ return response;
7209
+ };
7015
7210
  /**
7016
7211
  * Source of the SDK. Either a name of a builtin SDK or a module source ref string pointing to the SDK's implementation.
7017
7212
  */
@@ -7691,6 +7886,7 @@ export class TypeDef extends BaseClient {
7691
7886
  * @param opts.value The value of the member in the enum
7692
7887
  * @param opts.description A doc string for the member, if any
7693
7888
  * @param opts.sourceMap The source map for the enum member definition.
7889
+ * @param opts.deprecated If deprecated, the reason or migration path.
7694
7890
  */
7695
7891
  withEnumMember = (name, opts) => {
7696
7892
  const ctx = this._ctx.select("withEnumMember", { name, ...opts });
@@ -7701,6 +7897,7 @@ export class TypeDef extends BaseClient {
7701
7897
  * @param value The name of the value in the enum
7702
7898
  * @param opts.description A doc string for the value, if any
7703
7899
  * @param opts.sourceMap The source map for the enum value definition.
7900
+ * @param opts.deprecated If deprecated, the reason or migration path.
7704
7901
  * @deprecated Use withEnumMember instead
7705
7902
  */
7706
7903
  withEnumValue = (value, opts) => {
@@ -7713,6 +7910,7 @@ export class TypeDef extends BaseClient {
7713
7910
  * @param typeDef The type of the field
7714
7911
  * @param opts.description A doc string for the field, if any
7715
7912
  * @param opts.sourceMap The source map for the field definition.
7913
+ * @param opts.deprecated If deprecated, the reason or migration path.
7716
7914
  */
7717
7915
  withField = (name, typeDef, opts) => {
7718
7916
  const ctx = this._ctx.select("withField", { name, typeDef, ...opts });
@@ -1 +1 @@
1
- {"version":3,"file":"decorators.d.ts","sourceRoot":"","sources":["../../../src/module/decorators.ts"],"names":[],"mappings":"AAKA;;;;GAIG;AACH,eAAO,MAAM,MAAM,wEAAkB,CAAA;AAErC;;;;;GAKG;AACH,eAAO,MAAM,IAAI,gFAoCqtC,CAAC,8BApCtsC,CAAA;AAEjC;;;;;;GAMG;AACH,eAAO,MAAM,KAAK,qEAAiB,CAAA;AAEnC;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,wEAAoB,CAAA;AAEzC;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,QAAQ,yIAAoB,CAAA"}
1
+ {"version":3,"file":"decorators.d.ts","sourceRoot":"","sources":["../../../src/module/decorators.ts"],"names":[],"mappings":"AAKA;;;;GAIG;AACH,eAAO,MAAM,MAAM,wEAAkB,CAAA;AAErC;;;;;GAKG;AACH,eAAO,MAAM,IAAI,gFAoC2rD,CAAC,8BApC5qD,CAAA;AAEjC;;;;;;GAMG;AACH,eAAO,MAAM,KAAK,qEAAiB,CAAA;AAEnC;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,wEAAoB,CAAA;AAEzC;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,QAAQ,yIAAoB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../../src/module/entrypoint/register.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,SAAS,EAET,QAAQ,EACR,OAAO,EAGR,MAAM,yBAAyB,CAAA;AAChC,OAAO,EACL,eAAe,IAAI,SAAS,EAC5B,iBAAiB,IAAI,WAAW,EAChC,cAAc,IAAI,MAAM,EACxB,YAAY,EAEZ,cAAc,EACf,MAAM,wCAAwC,CAAA;AAC/C,OAAO,EAAE,uBAAuB,EAAE,MAAM,oDAAoD,CAAA;AAU5F,qBAAa,QAAQ;IACP,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,YAAY;IAEjD;;OAEG;IACG,GAAG,IAAI,OAAO,CAAC,QAAQ,CAAC;IAgF9B;;OAEG;IACH,cAAc,CAAC,WAAW,EAAE,WAAW,EAAE,KAAK,EAAE,OAAO,GAAG,SAAS;IAInE;;OAEG;IACH,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,uBAAuB,GAAG,SAAS;IAQ7D;;OAEG;IACH,MAAM,CAAC,IAAI,EAAE,SAAS,GAAG,CAAC,GAAG,EAAE,SAAS,KAAK,SAAS;IAkDtD;;;;;;;OAOG;IACH,sBAAsB,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,GAAG,SAAS;CA4BjE"}
1
+ {"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../../src/module/entrypoint/register.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,SAAS,EAET,QAAQ,EACR,OAAO,EAQR,MAAM,yBAAyB,CAAA;AAChC,OAAO,EACL,eAAe,IAAI,SAAS,EAC5B,iBAAiB,IAAI,WAAW,EAChC,cAAc,IAAI,MAAM,EACxB,YAAY,EAEZ,cAAc,EACf,MAAM,wCAAwC,CAAA;AAC/C,OAAO,EAAE,uBAAuB,EAAE,MAAM,oDAAoD,CAAA;AAU5F,qBAAa,QAAQ;IACP,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,YAAY;IAEjD;;OAEG;IACG,GAAG,IAAI,OAAO,CAAC,QAAQ,CAAC;IAyF9B;;OAEG;IACH,cAAc,CAAC,WAAW,EAAE,WAAW,EAAE,KAAK,EAAE,OAAO,GAAG,SAAS;IAInE;;OAEG;IACH,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,uBAAuB,GAAG,SAAS;IAgC7D;;OAEG;IACH,MAAM,CAAC,IAAI,EAAE,SAAS,GAAG,CAAC,GAAG,EAAE,SAAS,KAAK,SAAS;IAmDtD;;;;;;;OAOG;IACH,sBAAsB,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,GAAG,SAAS;CA4BjE"}
@@ -1,4 +1,4 @@
1
- import { dag, TypeDefKind, } from "../../api/client.gen.js";
1
+ import { dag, TypeDefKind, FunctionCachePolicy, } from "../../api/client.gen.js";
2
2
  export class Register {
3
3
  module;
4
4
  constructor(module) {
@@ -16,11 +16,13 @@ export class Register {
16
16
  }
17
17
  // For each class scanned, register its type, method and properties in the module.
18
18
  Object.values(this.module.objects).forEach((object) => {
19
- // Register the class Typedef object in Dagger
20
- let typeDef = dag.typeDef().withObject(object.name, {
19
+ const objectOpts = {
21
20
  description: object.description,
22
21
  sourceMap: addSourceMap(object),
23
- });
22
+ deprecated: object.deprecated,
23
+ };
24
+ // Register the class Typedef object in Dagger
25
+ let typeDef = dag.typeDef().withObject(object.name, objectOpts);
24
26
  // Register all functions (methods) to this object
25
27
  Object.values(object.methods).forEach((method) => {
26
28
  typeDef = typeDef.withFunction(this.addFunction(method));
@@ -28,10 +30,12 @@ export class Register {
28
30
  // Register all fields that belong to this object
29
31
  Object.values(object.properties).forEach((field) => {
30
32
  if (field.isExposed) {
31
- typeDef = typeDef.withField(field.alias ?? field.name, addTypeDef(field.type), {
33
+ const fieldOpts = {
32
34
  description: field.description,
33
35
  sourceMap: addSourceMap(field),
34
- });
36
+ deprecated: field.deprecated,
37
+ };
38
+ typeDef = typeDef.withField(field.alias ?? field.name, addTypeDef(field.type), fieldOpts);
35
39
  }
36
40
  });
37
41
  if (object._constructor) {
@@ -47,11 +51,13 @@ export class Register {
47
51
  sourceMap: addSourceMap(enum_),
48
52
  });
49
53
  Object.values(enum_.values).forEach((value) => {
50
- typeDef = typeDef.withEnumMember(value.name, {
54
+ const memberOpts = {
51
55
  value: value.value,
52
56
  description: value.description,
53
57
  sourceMap: addSourceMap(value),
54
- });
58
+ deprecated: value.deprecated,
59
+ };
60
+ typeDef = typeDef.withEnumMember(value.name, memberOpts);
55
61
  });
56
62
  mod = mod.withEnum(typeDef);
57
63
  });
@@ -77,11 +83,32 @@ export class Register {
77
83
  * Create a function in the Dagger API.
78
84
  */
79
85
  addFunction(fct) {
80
- return dag
86
+ let fnDef = dag
81
87
  .function_(fct.alias ?? fct.name, addTypeDef(fct.returnType))
82
88
  .withDescription(fct.description)
83
89
  .withSourceMap(addSourceMap(fct))
84
90
  .with(this.addArg(fct.arguments));
91
+ switch (fct.cache) {
92
+ case "never": {
93
+ fnDef = fnDef.withCachePolicy(FunctionCachePolicy.Never);
94
+ break;
95
+ }
96
+ case "session": {
97
+ fnDef = fnDef.withCachePolicy(FunctionCachePolicy.PerSession);
98
+ break;
99
+ }
100
+ case "": {
101
+ break;
102
+ }
103
+ default: {
104
+ const opts = { timeToLive: fct.cache };
105
+ fnDef = fnDef.withCachePolicy(FunctionCachePolicy.Default, opts);
106
+ }
107
+ }
108
+ if (fct.deprecated !== undefined) {
109
+ fnDef = fnDef.withDeprecated({ reason: fct.deprecated });
110
+ }
111
+ return fnDef;
85
112
  }
86
113
  /**
87
114
  * Register all arguments in the function.
@@ -92,6 +119,7 @@ export class Register {
92
119
  const opts = {
93
120
  description: arg.description,
94
121
  sourceMap: addSourceMap(arg),
122
+ deprecated: arg.deprecated,
95
123
  };
96
124
  let typeDef = addTypeDef(arg.type);
97
125
  if (arg.isOptional) {
@@ -12,6 +12,7 @@ export declare class DaggerArgument extends Locatable {
12
12
  private readonly ast;
13
13
  name: string;
14
14
  description: string;
15
+ deprecated?: string;
15
16
  private _typeRef?;
16
17
  type?: TypeDef<TypeDefKind>;
17
18
  isVariadic: boolean;
@@ -36,6 +37,7 @@ export declare class DaggerArgument extends Locatable {
36
37
  toJSON(): {
37
38
  name: string;
38
39
  description: string;
40
+ deprecated: string | undefined;
39
41
  type: TypeDef<TypeDefKind> | undefined;
40
42
  isVariadic: boolean;
41
43
  isNullable: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"argument.d.ts","sourceRoot":"","sources":["../../../../../src/module/introspector/dagger_module/argument.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,YAAY,CAAA;AAE3B,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AAGxD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EACL,GAAG,EAGJ,MAAM,+BAA+B,CAAA;AAEtC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAE3C,MAAM,MAAM,eAAe,GAAG;IAAE,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc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Ac,CAAA;CAAE,CAAA;AAEhE,qBAAa,cAAe,SAAQ,SAAS;IAgBzC,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,GAAG;IAhBf,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IACnB,UAAU,CAAC,EAAE,MAAM,CAAA;IAC1B,OAAO,CAAC,QAAQ,CAAC,CAAQ;IAClB,IAAI,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,CAAA;IAC3B,UAAU,EAAE,OAAO,CAAA;IACnB,UAAU,EAAE,OAAO,CAAA;IACnB,UAAU,EAAE,OAAO,CAAA;IACnB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;IACjB,YAAY,CAAC,EAAE,GAAG,CAAA;IAEzB,OAAO,CAAC,MAAM,CAAW;gBAGN,IAAI,EAAE,EAAE,CAAC,oBAAoB,EAC7B,GAAG,EAAE,GAAG;IAuC3B;;;;;OAKG;IACH,OAAO,CAAC,OAAO;IAWf,OAAO,CAAC,aAAa;IAgBrB,OAAO,CAAC,eAAe;IAShB,YAAY,IAAI,MAAM,GAAG,SAAS;IAWlC,mBAAmB,CAAC,UAAU,EAAE,UAAU;IAmBjD,MAAM;;;;;;;;;;;;CAcP"}
@@ -9,6 +9,7 @@ export class DaggerArgument extends Locatable {
9
9
  ast;
10
10
  name;
11
11
  description;
12
+ deprecated;
12
13
  _typeRef;
13
14
  type;
14
15
  isVariadic;
@@ -24,16 +25,21 @@ export class DaggerArgument extends Locatable {
24
25
  this.ast = ast;
25
26
  this.symbol = this.ast.getSymbolOrThrow(node.name);
26
27
  this.name = this.node.name.getText();
27
- this.description = this.ast.getDocFromSymbol(this.symbol);
28
+ const { description, deprecated } = this.ast.getSymbolDoc(this.symbol);
29
+ this.description = description;
30
+ this.deprecated = deprecated;
28
31
  this.defaultValue = this.getDefaultValue();
29
32
  this.isVariadic = this.node.dotDotDotToken !== undefined;
30
33
  this.isNullable = this.getIsNullable();
31
34
  this.isOptional =
32
- this.isVariadic || // if arguments has ...
35
+ this.isVariadic || // if argument has ...
33
36
  (this.defaultValue === undefined && // if argument has a default value that couldn't be resolved.
34
37
  this.node.initializer !== undefined) ||
35
38
  this.isNullable || // if argument is nullable
36
39
  this.node.questionToken !== undefined; // if argument has ?
40
+ if (this.deprecated !== undefined && !this.isOptional) {
41
+ throw new IntrospectionError(`argument ${this.name} is required and cannot be deprecated at ${AST.getNodePosition(this.node)}.`);
42
+ }
37
43
  const decoratorArguments = this.ast.getDecoratorArgument(this.node, ARGUMENT_DECORATOR, "object");
38
44
  if (decoratorArguments) {
39
45
  this.ignore = decoratorArguments.ignore;
@@ -99,6 +105,7 @@ export class DaggerArgument extends Locatable {
99
105
  return {
100
106
  name: this.name,
101
107
  description: this.description,
108
+ deprecated: this.deprecated,
102
109
  type: this.type,
103
110
  isVariadic: this.isVariadic,
104
111
  isNullable: this.isNullable,
@@ -14,12 +14,14 @@ export declare class DaggerEnumValue extends Locatable implements DaggerEnumBase
14
14
  name: string;
15
15
  value: string;
16
16
  description: string;
17
+ deprecated?: string;
17
18
  private symbol;
18
19
  constructor(node: ts.EnumMember, ast: AST);
19
20
  toJSON(): {
20
21
  name: string;
21
22
  value: string;
22
23
  description: string;
24
+ deprecated: string | undefined;
23
25
  };
24
26
  }
25
27
  export declare class DaggerEnum extends Locatable implements DaggerEnumBase {
@@ -1 +1 @@
1
- {"version":3,"file":"enum.d.ts","sourceRoot":"","sources":["../../../../../src/module/introspector/dagger_module/enum.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAA;AAG3B,OAAO,EAAE,GAAG,EAAE,MAAM,+BAA+B,CAAA;AACnD,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAE1C,MAAM,MAAM,WAAW,GAAG;IAA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C,IAAI,EAAE,MAAM,GAAG,eAAe,CAAA;CAAE,CAAA;AAElE,qBAAa,eAAgB,SAAQ,SAAU,YAAW,mBAAmB;IASzE,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,GAAG;IATf,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,MAAM,CAAA;IACnB,UAAU,CAAC,EAAE,MAAM,CAAA;IAE1B,OAAO,CAAC,MAAM,CAAW;gBAGN,IAAI,EAAE,EAAE,CAAC,UAAU,EACnB,GAAG,EAAE,GAAG;IAmB3B,MAAM;;;;;;CAQP;AAED,qBAAa,UAAW,SAAQ,SAAU,YAAW,cAAc;IAQ/D,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,GAAG;IARf,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IACnB,MAAM,EAAE,gBAAgB,CAAK;IAEpC,OAAO,CAAC,MAAM,CAAW;gBAGN,IAAI,EAAE,EAAE,CAAC,eAAe,EACxB,GAAG,EAAE,GAAG;IAgB3B,MAAM;;;;;CAOP"}
@@ -7,6 +7,7 @@ export class DaggerEnumValue extends Locatable {
7
7
  name;
8
8
  value;
9
9
  description;
10
+ deprecated;
10
11
  symbol;
11
12
  constructor(node, ast) {
12
13
  super(node);
@@ -14,7 +15,9 @@ export class DaggerEnumValue extends Locatable {
14
15
  this.ast = ast;
15
16
  this.symbol = this.ast.getSymbolOrThrow(this.node.name);
16
17
  this.name = this.node.name.getText();
17
- this.description = this.ast.getDocFromSymbol(this.symbol);
18
+ const { description, deprecated } = this.ast.getSymbolDoc(this.symbol);
19
+ this.description = description;
20
+ this.deprecated = deprecated;
18
21
  const initializer = this.node.initializer;
19
22
  if (!initializer) {
20
23
  throw new IntrospectionError(`enum ${this.name} at ${AST.getNodePosition(this.node)} has no value set to its member.`);
@@ -26,6 +29,7 @@ export class DaggerEnumValue extends Locatable {
26
29
  name: this.name,
27
30
  value: this.value,
28
31
  description: this.description,
32
+ deprecated: this.deprecated,
29
33
  };
30
34
  }
31
35
  }
@@ -3,6 +3,7 @@ export interface DaggerEnumBaseValue extends Locatable {
3
3
  name: string;
4
4
  value: string;
5
5
  description: string;
6
+ deprecated?: string;
6
7
  }
7
8
  export type DaggerEnumBaseValues = {
8
9
  [name: string]: DaggerEnumBaseValue;