ogi-addon 1.9.4 → 2.0.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.
Files changed (42) hide show
  1. package/build/{Configuration-CdRZbO6z.d.mts → Configuration-DdkCGFMU.d.cts} +2 -2
  2. package/build/{Configuration-WeOm-F0_.d.cts → Configuration-fDtr2bmH.d.mts} +2 -2
  3. package/build/{ConfigurationBuilder-BbZDA_xx.d.mts → ConfigurationBuilder-C83EP5v2.d.cts} +81 -21
  4. package/build/{ConfigurationBuilder-BSuJ4rSI.cjs → ConfigurationBuilder-CFXi6UwU.cjs} +112 -14
  5. package/build/ConfigurationBuilder-CFXi6UwU.cjs.map +1 -0
  6. package/build/{ConfigurationBuilder-CfHLKMTO.d.cts → ConfigurationBuilder-lzKf9gHw.d.mts} +81 -21
  7. package/build/{EventResponse-CQhmdz3C.d.mts → EventResponse-D0TZjAVC.d.mts} +88 -31
  8. package/build/{EventResponse-D1c-Df5W.d.cts → EventResponse-DgSuJPu8.d.cts} +88 -31
  9. package/build/EventResponse.cjs +5 -4
  10. package/build/EventResponse.cjs.map +1 -1
  11. package/build/EventResponse.d.cts +1 -1
  12. package/build/EventResponse.d.mts +1 -1
  13. package/build/EventResponse.mjs +5 -4
  14. package/build/EventResponse.mjs.map +1 -1
  15. package/build/{SearchEngine-CRQWXfo6.d.mts → SearchEngine-Cn_-M-at.d.cts} +5 -2
  16. package/build/{SearchEngine-DBSUNM4A.d.cts → SearchEngine-lZioNunY.d.mts} +5 -2
  17. package/build/SearchEngine.d.cts +1 -1
  18. package/build/SearchEngine.d.mts +1 -1
  19. package/build/config/Configuration.cjs +6 -3
  20. package/build/config/Configuration.cjs.map +1 -1
  21. package/build/config/Configuration.d.cts +3 -3
  22. package/build/config/Configuration.d.mts +3 -3
  23. package/build/config/Configuration.mjs +5 -4
  24. package/build/config/Configuration.mjs.map +1 -1
  25. package/build/config/ConfigurationBuilder.cjs +3 -1
  26. package/build/config/ConfigurationBuilder.d.cts +2 -2
  27. package/build/config/ConfigurationBuilder.d.mts +2 -2
  28. package/build/config/ConfigurationBuilder.mjs +100 -14
  29. package/build/config/ConfigurationBuilder.mjs.map +1 -1
  30. package/build/main.cjs +116 -14
  31. package/build/main.cjs.map +1 -1
  32. package/build/main.d.cts +5 -5
  33. package/build/main.d.mts +5 -5
  34. package/build/main.mjs +115 -14
  35. package/build/main.mjs.map +1 -1
  36. package/package.json +1 -1
  37. package/src/EventResponse.ts +14 -13
  38. package/src/SearchEngine.ts +5 -1
  39. package/src/config/Configuration.ts +13 -3
  40. package/src/config/ConfigurationBuilder.ts +157 -41
  41. package/src/main.ts +194 -36
  42. package/build/ConfigurationBuilder-BSuJ4rSI.cjs.map +0 -1
@@ -1,4 +1,4 @@
1
- import { r as ConfigurationFile } from "./ConfigurationBuilder-BbZDA_xx.mjs";
1
+ import { i as ConfigurationFile } from "./ConfigurationBuilder-C83EP5v2.cjs";
2
2
 
3
3
  //#region src/config/Configuration.d.ts
4
4
  interface DefiniteConfig {
@@ -18,4 +18,4 @@ declare class Configuration {
18
18
  }
19
19
  //#endregion
20
20
  export { Configuration as t };
21
- //# sourceMappingURL=Configuration-CdRZbO6z.d.mts.map
21
+ //# sourceMappingURL=Configuration-DdkCGFMU.d.cts.map
@@ -1,4 +1,4 @@
1
- import { r as ConfigurationFile } from "./ConfigurationBuilder-CfHLKMTO.cjs";
1
+ import { i as ConfigurationFile } from "./ConfigurationBuilder-lzKf9gHw.mjs";
2
2
 
3
3
  //#region src/config/Configuration.d.ts
4
4
  interface DefiniteConfig {
@@ -18,4 +18,4 @@ declare class Configuration {
18
18
  }
19
19
  //#endregion
20
20
  export { Configuration as t };
21
- //# sourceMappingURL=Configuration-WeOm-F0_.d.cts.map
21
+ //# sourceMappingURL=Configuration-fDtr2bmH.d.mts.map
@@ -1,33 +1,51 @@
1
1
  //#region src/config/ConfigurationBuilder.d.ts
2
2
  interface ConfigurationFile {
3
- [key: string]: ConfigurationOption;
3
+ [key: string]: ConfigurationOption<string>;
4
4
  }
5
- declare function isStringOption(option: ConfigurationOption): option is StringOption;
6
- declare function isNumberOption(option: ConfigurationOption): option is NumberOption;
7
- declare function isBooleanOption(option: ConfigurationOption): option is BooleanOption;
8
- declare class ConfigurationBuilder {
5
+ declare function isStringOption<N extends string = string>(option: ConfigurationOption<N>): option is StringOption<N>;
6
+ declare function isNumberOption<N extends string = string>(option: ConfigurationOption<N>): option is NumberOption<N>;
7
+ declare function isBooleanOption<N extends string = string>(option: ConfigurationOption<N>): option is BooleanOption<N>;
8
+ declare function isActionOption<N extends string = string>(option: ConfigurationOption<N>): option is ActionOption<N>;
9
+ /**
10
+ * A builder for creating configuration screens. The generic type T accumulates
11
+ * the types of all options added to the builder, enabling type-safe access to
12
+ * the configuration values.
13
+ *
14
+ * @template T - The accumulated type of all configuration options
15
+ */
16
+ declare class ConfigurationBuilder<T extends Record<string, string | number | boolean> = {}> {
9
17
  private options;
10
18
  /**
11
19
  * Add a number option to the configuration builder and return the builder for chaining. You must provide a name, display name, and description for the option.
12
- * @param option { (option: NumberOption) => NumberOption }
13
- * @returns
20
+ * @param option { (option: NumberOption) => NumberOption<K> }
21
+ * @returns A new ConfigurationBuilder with the number option's type added
14
22
  */
15
- addNumberOption(option: (option: NumberOption) => NumberOption): ConfigurationBuilder;
23
+ addNumberOption<K extends string>(option: (option: NumberOption) => NumberOption<K>): ConfigurationBuilder<T & { [P in K]: number }>;
16
24
  /**
17
25
  * Add a string option to the configuration builder and return the builder for chaining. You must provide a name, display name, and description for the option.
18
- * @param option { (option: StringOption) => StringOption }
26
+ * @param option { (option: StringOption) => StringOption<K> }
27
+ * @returns A new ConfigurationBuilder with the string option's type added
19
28
  */
20
- addStringOption(option: (option: StringOption) => StringOption): this;
29
+ addStringOption<K extends string>(option: (option: StringOption) => StringOption<K>): ConfigurationBuilder<T & { [P in K]: string }>;
21
30
  /**
22
31
  * Add a boolean option to the configuration builder and return the builder for chaining. You must provide a name, display name, and description for the option.
23
- * @param option { (option: BooleanOption) => BooleanOption }
32
+ * @param option { (option: BooleanOption) => BooleanOption<K> }
33
+ * @returns A new ConfigurationBuilder with the boolean option's type added
34
+ */
35
+ addBooleanOption<K extends string>(option: (option: BooleanOption) => BooleanOption<K>): ConfigurationBuilder<T & { [P in K]: boolean }>;
36
+ /**
37
+ * Add an action option to the configuration builder and return the builder for chaining.
38
+ * Action options contribute a boolean to the return type (true if clicked, false if not).
39
+ * You must provide a name, display name, and description for the option.
40
+ * @param option { (option: ActionOption) => ActionOption<K> }
41
+ * @returns A new ConfigurationBuilder with the action option's type added as boolean
24
42
  */
25
- addBooleanOption(option: (option: BooleanOption) => BooleanOption): this;
43
+ addActionOption<K extends string>(option: (option: ActionOption) => ActionOption<K>): ConfigurationBuilder<T & { [P in K]: boolean }>;
26
44
  build(includeFunctions: boolean): ConfigurationFile;
27
45
  }
28
- type ConfigurationOptionType = 'string' | 'number' | 'boolean' | 'unset';
29
- declare class ConfigurationOption {
30
- name: string;
46
+ type ConfigurationOptionType = 'string' | 'number' | 'boolean' | 'action' | 'unset';
47
+ declare class ConfigurationOption<N extends string = string> {
48
+ name: N;
31
49
  defaultValue: unknown;
32
50
  displayName: string;
33
51
  description: string;
@@ -36,7 +54,7 @@ declare class ConfigurationOption {
36
54
  * Set the name of the option. **REQUIRED**
37
55
  * @param name {string} The name of the option. This is used to reference the option in the configuration file.
38
56
  */
39
- setName(name: string): this;
57
+ setName<K extends string>(name: K): ConfigurationOption<K>;
40
58
  /**
41
59
  * Set the display name of the option. This is used to show the user a human readable version of what the option is. **REQUIRED**
42
60
  * @param displayName {string} The display name of the option.
@@ -55,13 +73,18 @@ declare class ConfigurationOption {
55
73
  */
56
74
  validate(input: unknown): [boolean, string];
57
75
  }
58
- declare class StringOption extends ConfigurationOption {
76
+ declare class StringOption<N extends string = string> extends ConfigurationOption<N> {
59
77
  allowedValues: string[];
60
78
  minTextLength: number;
61
79
  maxTextLength: number;
62
80
  defaultValue: string;
63
81
  inputType: 'text' | 'file' | 'password' | 'folder';
64
82
  type: ConfigurationOptionType;
83
+ /**
84
+ * Set the name of the option. **REQUIRED**
85
+ * @param name {string} The name of the option. This is used to reference the option in the configuration file.
86
+ */
87
+ setName<K extends string>(name: K): StringOption<K>;
65
88
  /**
66
89
  * Set the allowed values for the string. If the array is empty, any value is allowed. When provided, the client will act like this option is a dropdown.
67
90
  * @param allowedValues {string[]} An array of allowed values for the string. If the array is empty, any value is allowed.
@@ -89,12 +112,17 @@ declare class StringOption extends ConfigurationOption {
89
112
  setInputType(inputType: 'text' | 'file' | 'password' | 'folder'): this;
90
113
  validate(input: unknown): [boolean, string];
91
114
  }
92
- declare class NumberOption extends ConfigurationOption {
115
+ declare class NumberOption<N extends string = string> extends ConfigurationOption<N> {
93
116
  min: number;
94
117
  max: number;
95
118
  defaultValue: number;
96
119
  type: ConfigurationOptionType;
97
120
  inputType: 'range' | 'number';
121
+ /**
122
+ * Set the name of the option. **REQUIRED**
123
+ * @param name {string} The name of the option. This is used to reference the option in the configuration file.
124
+ */
125
+ setName<K extends string>(name: K): NumberOption<K>;
98
126
  /**
99
127
  * Set the minimum value for the number. If the user provides a number that is less than this value, the validation will fail.
100
128
  * @param min {number} The minimum value for the number.
@@ -117,9 +145,14 @@ declare class NumberOption extends ConfigurationOption {
117
145
  setDefaultValue(defaultValue: number): this;
118
146
  validate(input: unknown): [boolean, string];
119
147
  }
120
- declare class BooleanOption extends ConfigurationOption {
148
+ declare class BooleanOption<N extends string = string> extends ConfigurationOption<N> {
121
149
  type: ConfigurationOptionType;
122
150
  defaultValue: boolean;
151
+ /**
152
+ * Set the name of the option. **REQUIRED**
153
+ * @param name {string} The name of the option. This is used to reference the option in the configuration file.
154
+ */
155
+ setName<K extends string>(name: K): BooleanOption<K>;
123
156
  /**
124
157
  * Set the default value for the boolean. This value will be used if the user does not provide a value. **HIGHLY RECOMMENDED**
125
158
  * @param defaultValue {boolean} The default value for the boolean.
@@ -127,6 +160,33 @@ declare class BooleanOption extends ConfigurationOption {
127
160
  setDefaultValue(defaultValue: boolean): this;
128
161
  validate(input: unknown): [boolean, string];
129
162
  }
163
+ declare class ActionOption<N extends string = string> extends ConfigurationOption<N> {
164
+ type: ConfigurationOptionType;
165
+ manifest: Record<string, unknown>;
166
+ buttonText: string;
167
+ taskName: string;
168
+ /**
169
+ * Set the name of the option. **REQUIRED**
170
+ * @param name {string} The name of the option. This is used to reference the option in the configuration file.
171
+ */
172
+ setName<K extends string>(name: K): ActionOption<K>;
173
+ /**
174
+ * Set the task name that will be used to identify which task handler to run. This should match the name used in `addon.onTask()`.
175
+ * @param taskName {string} The task name to identify the handler.
176
+ */
177
+ setTaskName(taskName: string): this;
178
+ /**
179
+ * Set the manifest object that will be passed to the task-run handler. The task name should be set via setTaskName() rather than in the manifest.
180
+ * @param manifest {Record<string, unknown>} The manifest object to pass to the task handler.
181
+ */
182
+ setManifest(manifest: Record<string, unknown>): this;
183
+ /**
184
+ * Set the text displayed on the action button.
185
+ * @param text {string} The button text.
186
+ */
187
+ setButtonText(text: string): this;
188
+ validate(_input: unknown): [boolean, string];
189
+ }
130
190
  //#endregion
131
- export { ConfigurationOptionType as a, isBooleanOption as c, ConfigurationOption as i, isNumberOption as l, ConfigurationBuilder as n, NumberOption as o, ConfigurationFile as r, StringOption as s, BooleanOption as t, isStringOption as u };
132
- //# sourceMappingURL=ConfigurationBuilder-BbZDA_xx.d.mts.map
191
+ export { ConfigurationOption as a, StringOption as c, isNumberOption as d, isStringOption as f, ConfigurationFile as i, isActionOption as l, BooleanOption as n, ConfigurationOptionType as o, ConfigurationBuilder as r, NumberOption as s, ActionOption as t, isBooleanOption as u };
192
+ //# sourceMappingURL=ConfigurationBuilder-C83EP5v2.d.cts.map
@@ -43,37 +43,58 @@ function isNumberOption(option) {
43
43
  function isBooleanOption(option) {
44
44
  return option.type === "boolean";
45
45
  }
46
+ function isActionOption(option) {
47
+ return option.type === "action";
48
+ }
49
+ /**
50
+ * A builder for creating configuration screens. The generic type T accumulates
51
+ * the types of all options added to the builder, enabling type-safe access to
52
+ * the configuration values.
53
+ *
54
+ * @template T - The accumulated type of all configuration options
55
+ */
46
56
  var ConfigurationBuilder = class {
47
57
  options = [];
48
58
  /**
49
59
  * Add a number option to the configuration builder and return the builder for chaining. You must provide a name, display name, and description for the option.
50
- * @param option { (option: NumberOption) => NumberOption }
51
- * @returns
60
+ * @param option { (option: NumberOption) => NumberOption<K> }
61
+ * @returns A new ConfigurationBuilder with the number option's type added
52
62
  */
53
63
  addNumberOption(option) {
54
- let newOption = new NumberOption();
55
- newOption = option(newOption);
56
- this.options.push(newOption);
64
+ const configuredOption = option(new NumberOption());
65
+ this.options.push(configuredOption);
57
66
  return this;
58
67
  }
59
68
  /**
60
69
  * Add a string option to the configuration builder and return the builder for chaining. You must provide a name, display name, and description for the option.
61
- * @param option { (option: StringOption) => StringOption }
70
+ * @param option { (option: StringOption) => StringOption<K> }
71
+ * @returns A new ConfigurationBuilder with the string option's type added
62
72
  */
63
73
  addStringOption(option) {
64
- let newOption = new StringOption();
65
- newOption = option(newOption);
66
- this.options.push(newOption);
74
+ const configuredOption = option(new StringOption());
75
+ this.options.push(configuredOption);
67
76
  return this;
68
77
  }
69
78
  /**
70
79
  * Add a boolean option to the configuration builder and return the builder for chaining. You must provide a name, display name, and description for the option.
71
- * @param option { (option: BooleanOption) => BooleanOption }
80
+ * @param option { (option: BooleanOption) => BooleanOption<K> }
81
+ * @returns A new ConfigurationBuilder with the boolean option's type added
72
82
  */
73
83
  addBooleanOption(option) {
74
- let newOption = new BooleanOption();
75
- newOption = option(newOption);
76
- this.options.push(newOption);
84
+ const configuredOption = option(new BooleanOption());
85
+ this.options.push(configuredOption);
86
+ return this;
87
+ }
88
+ /**
89
+ * Add an action option to the configuration builder and return the builder for chaining.
90
+ * Action options contribute a boolean to the return type (true if clicked, false if not).
91
+ * You must provide a name, display name, and description for the option.
92
+ * @param option { (option: ActionOption) => ActionOption<K> }
93
+ * @returns A new ConfigurationBuilder with the action option's type added as boolean
94
+ */
95
+ addActionOption(option) {
96
+ const configuredOption = option(new ActionOption());
97
+ this.options.push(configuredOption);
77
98
  return this;
78
99
  }
79
100
  build(includeFunctions) {
@@ -137,6 +158,14 @@ var StringOption = class extends ConfigurationOption {
137
158
  inputType = "text";
138
159
  type = "string";
139
160
  /**
161
+ * Set the name of the option. **REQUIRED**
162
+ * @param name {string} The name of the option. This is used to reference the option in the configuration file.
163
+ */
164
+ setName(name) {
165
+ this.name = name;
166
+ return this;
167
+ }
168
+ /**
140
169
  * Set the allowed values for the string. If the array is empty, any value is allowed. When provided, the client will act like this option is a dropdown.
141
170
  * @param allowedValues {string[]} An array of allowed values for the string. If the array is empty, any value is allowed.
142
171
  */
@@ -190,6 +219,14 @@ var NumberOption = class extends ConfigurationOption {
190
219
  type = "number";
191
220
  inputType = "number";
192
221
  /**
222
+ * Set the name of the option. **REQUIRED**
223
+ * @param name {string} The name of the option. This is used to reference the option in the configuration file.
224
+ */
225
+ setName(name) {
226
+ this.name = name;
227
+ return this;
228
+ }
229
+ /**
193
230
  * Set the minimum value for the number. If the user provides a number that is less than this value, the validation will fail.
194
231
  * @param min {number} The minimum value for the number.
195
232
  */
@@ -231,6 +268,14 @@ var BooleanOption = class extends ConfigurationOption {
231
268
  type = "boolean";
232
269
  defaultValue = false;
233
270
  /**
271
+ * Set the name of the option. **REQUIRED**
272
+ * @param name {string} The name of the option. This is used to reference the option in the configuration file.
273
+ */
274
+ setName(name) {
275
+ this.name = name;
276
+ return this;
277
+ }
278
+ /**
234
279
  * Set the default value for the boolean. This value will be used if the user does not provide a value. **HIGHLY RECOMMENDED**
235
280
  * @param defaultValue {boolean} The default value for the boolean.
236
281
  */
@@ -243,8 +288,55 @@ var BooleanOption = class extends ConfigurationOption {
243
288
  return [true, ""];
244
289
  }
245
290
  };
291
+ var ActionOption = class extends ConfigurationOption {
292
+ type = "action";
293
+ manifest = {};
294
+ buttonText = "Run";
295
+ taskName = "";
296
+ /**
297
+ * Set the name of the option. **REQUIRED**
298
+ * @param name {string} The name of the option. This is used to reference the option in the configuration file.
299
+ */
300
+ setName(name) {
301
+ this.name = name;
302
+ return this;
303
+ }
304
+ /**
305
+ * Set the task name that will be used to identify which task handler to run. This should match the name used in `addon.onTask()`.
306
+ * @param taskName {string} The task name to identify the handler.
307
+ */
308
+ setTaskName(taskName) {
309
+ this.taskName = taskName;
310
+ return this;
311
+ }
312
+ /**
313
+ * Set the manifest object that will be passed to the task-run handler. The task name should be set via setTaskName() rather than in the manifest.
314
+ * @param manifest {Record<string, unknown>} The manifest object to pass to the task handler.
315
+ */
316
+ setManifest(manifest) {
317
+ this.manifest = manifest;
318
+ return this;
319
+ }
320
+ /**
321
+ * Set the text displayed on the action button.
322
+ * @param text {string} The button text.
323
+ */
324
+ setButtonText(text) {
325
+ this.buttonText = text;
326
+ return this;
327
+ }
328
+ validate(_input) {
329
+ return [true, ""];
330
+ }
331
+ };
246
332
 
247
333
  //#endregion
334
+ Object.defineProperty(exports, 'ActionOption', {
335
+ enumerable: true,
336
+ get: function () {
337
+ return ActionOption;
338
+ }
339
+ });
248
340
  Object.defineProperty(exports, 'BooleanOption', {
249
341
  enumerable: true,
250
342
  get: function () {
@@ -281,6 +373,12 @@ Object.defineProperty(exports, '__toESM', {
281
373
  return __toESM;
282
374
  }
283
375
  });
376
+ Object.defineProperty(exports, 'isActionOption', {
377
+ enumerable: true,
378
+ get: function () {
379
+ return isActionOption;
380
+ }
381
+ });
284
382
  Object.defineProperty(exports, 'isBooleanOption', {
285
383
  enumerable: true,
286
384
  get: function () {
@@ -299,4 +397,4 @@ Object.defineProperty(exports, 'isStringOption', {
299
397
  return isStringOption;
300
398
  }
301
399
  });
302
- //# sourceMappingURL=ConfigurationBuilder-BSuJ4rSI.cjs.map
400
+ //# sourceMappingURL=ConfigurationBuilder-CFXi6UwU.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConfigurationBuilder-CFXi6UwU.cjs","names":["z","ZodError"],"sources":["../src/config/ConfigurationBuilder.ts"],"sourcesContent":["import z, { ZodError } from 'zod';\n\nexport interface ConfigurationFile {\n [key: string]: ConfigurationOption<string>;\n}\n\nconst configValidation = z.object({\n name: z.string().min(1),\n displayName: z.string().min(1),\n description: z.string().min(1),\n});\n\nexport function isStringOption<N extends string = string>(\n option: ConfigurationOption<N>\n): option is StringOption<N> {\n return option.type === 'string';\n}\n\nexport function isNumberOption<N extends string = string>(\n option: ConfigurationOption<N>\n): option is NumberOption<N> {\n return option.type === 'number';\n}\n\nexport function isBooleanOption<N extends string = string>(\n option: ConfigurationOption<N>\n): option is BooleanOption<N> {\n return option.type === 'boolean';\n}\n\nexport function isActionOption<N extends string = string>(\n option: ConfigurationOption<N>\n): option is ActionOption<N> {\n return option.type === 'action';\n}\n\n/**\n * A builder for creating configuration screens. The generic type T accumulates\n * the types of all options added to the builder, enabling type-safe access to\n * the configuration values.\n * \n * @template T - The accumulated type of all configuration options\n */\nexport class ConfigurationBuilder<\n T extends Record<string, string | number | boolean> = {}\n> {\n private options: ConfigurationOption<string>[] = [];\n\n /**\n * Add a number option to the configuration builder and return the builder for chaining. You must provide a name, display name, and description for the option.\n * @param option { (option: NumberOption) => NumberOption<K> }\n * @returns A new ConfigurationBuilder with the number option's type added\n */\n public addNumberOption<K extends string>(\n option: (option: NumberOption) => NumberOption<K>\n ): ConfigurationBuilder<T & { [P in K]: number }> {\n let newOption = new NumberOption();\n const configuredOption = option(newOption);\n this.options.push(configuredOption);\n return this as unknown as ConfigurationBuilder<T & { [P in K]: number }>;\n }\n\n /**\n * Add a string option to the configuration builder and return the builder for chaining. You must provide a name, display name, and description for the option.\n * @param option { (option: StringOption) => StringOption<K> }\n * @returns A new ConfigurationBuilder with the string option's type added\n */\n public addStringOption<K extends string>(\n option: (option: StringOption) => StringOption<K>\n ): ConfigurationBuilder<T & { [P in K]: string }> {\n let newOption = new StringOption();\n const configuredOption = option(newOption);\n this.options.push(configuredOption);\n return this as unknown as ConfigurationBuilder<T & { [P in K]: string }>;\n }\n\n /**\n * Add a boolean option to the configuration builder and return the builder for chaining. You must provide a name, display name, and description for the option.\n * @param option { (option: BooleanOption) => BooleanOption<K> }\n * @returns A new ConfigurationBuilder with the boolean option's type added\n */\n public addBooleanOption<K extends string>(\n option: (option: BooleanOption) => BooleanOption<K>\n ): ConfigurationBuilder<T & { [P in K]: boolean }> {\n let newOption = new BooleanOption();\n const configuredOption = option(newOption);\n this.options.push(configuredOption);\n return this as unknown as ConfigurationBuilder<T & { [P in K]: boolean }>;\n }\n\n /**\n * Add an action option to the configuration builder and return the builder for chaining. \n * Action options contribute a boolean to the return type (true if clicked, false if not).\n * You must provide a name, display name, and description for the option.\n * @param option { (option: ActionOption) => ActionOption<K> }\n * @returns A new ConfigurationBuilder with the action option's type added as boolean\n */\n public addActionOption<K extends string>(\n option: (option: ActionOption) => ActionOption<K>\n ): ConfigurationBuilder<T & { [P in K]: boolean }> {\n let newOption = new ActionOption();\n const configuredOption = option(newOption);\n this.options.push(configuredOption);\n return this as unknown as ConfigurationBuilder<T & { [P in K]: boolean }>;\n }\n\n public build(includeFunctions: boolean): ConfigurationFile {\n let config: ConfigurationFile = {};\n this.options.forEach((option) => {\n // remove all functions from the option object\n if (!includeFunctions) {\n option = JSON.parse(JSON.stringify(option));\n const optionData = configValidation.safeParse(option);\n if (!optionData.success) {\n throw new ZodError(optionData.error.errors);\n }\n\n config[option.name] = option;\n } else {\n config[option.name] = option;\n }\n });\n return config;\n }\n}\n\nexport type ConfigurationOptionType =\n | 'string'\n | 'number'\n | 'boolean'\n | 'action'\n | 'unset';\nexport class ConfigurationOption<N extends string = string> {\n public name: N = '' as N;\n public defaultValue: unknown = '';\n public displayName: string = '';\n public description: string = '';\n public type: ConfigurationOptionType = 'unset';\n\n /**\n * Set the name of the option. **REQUIRED**\n * @param name {string} The name of the option. This is used to reference the option in the configuration file.\n */\n setName<K extends string>(name: K): ConfigurationOption<K> {\n this.name = name as unknown as N;\n return this as unknown as ConfigurationOption<K>;\n }\n\n /**\n * Set the display name of the option. This is used to show the user a human readable version of what the option is. **REQUIRED**\n * @param displayName {string} The display name of the option.\n * @returns\n */\n setDisplayName(displayName: string): this {\n this.displayName = displayName;\n return this;\n }\n\n /**\n * Set the description of the option. This is to show the user a brief description of what this option does. **REQUIRED**\n * @param description {string} The description of the option.\n * @returns\n */\n setDescription(description: string): this {\n this.description = description;\n return this;\n }\n\n /**\n * Validation code for the option. This is called when the user provides input to the option. If the validation fails, the user will be prompted to provide input again.\n * @param input {unknown} The input to validate\n */\n validate(input: unknown): [boolean, string] {\n throw new Error('Validation code not implemented. Value: ' + input);\n }\n}\n\nexport class StringOption<N extends string = string> extends ConfigurationOption<N> {\n public allowedValues: string[] = [];\n public minTextLength: number = 0;\n public maxTextLength: number = Number.MAX_SAFE_INTEGER;\n public defaultValue: string = '';\n public inputType: 'text' | 'file' | 'password' | 'folder' = 'text';\n public type: ConfigurationOptionType = 'string';\n\n /**\n * Set the name of the option. **REQUIRED**\n * @param name {string} The name of the option. This is used to reference the option in the configuration file.\n */\n override setName<K extends string>(name: K): StringOption<K> {\n this.name = name as unknown as N;\n return this as unknown as StringOption<K>;\n }\n\n /**\n * Set the allowed values for the string. If the array is empty, any value is allowed. When provided, the client will act like this option is a dropdown.\n * @param allowedValues {string[]} An array of allowed values for the string. If the array is empty, any value is allowed.\n */\n setAllowedValues(allowedValues: string[]): this {\n this.allowedValues = allowedValues;\n return this;\n }\n\n /**\n * Set the default value for the string. This value will be used if the user does not provide a value. **HIGHLY RECOMMENDED**\n * @param defaultValue {string} The default value for the string.\n */\n setDefaultValue(defaultValue: string): this {\n this.defaultValue = defaultValue;\n return this;\n }\n\n /**\n * Set the minimum text length for the string. If the user provides a string that is less than this value, the validation will fail.\n * @param minTextLength {number} The minimum text length for the string.\n */\n setMinTextLength(minTextLength: number): this {\n this.minTextLength = minTextLength;\n return this;\n }\n\n /**\n * Set the maximum text length for the string. If the user provides a string that is greater than this value, the validation will fail.\n * @param maxTextLength {number} The maximum text length for the string.\n */\n setMaxTextLength(maxTextLength: number): this {\n this.maxTextLength = maxTextLength;\n return this;\n }\n\n /**\n * Set the input type for the string. This will change how the client renders the input.\n * @param inputType {'text' | 'file' | 'password' | 'folder'} The input type for the string.\n */\n setInputType(inputType: 'text' | 'file' | 'password' | 'folder'): this {\n this.inputType = inputType;\n return this;\n }\n\n override validate(input: unknown): [boolean, string] {\n if (typeof input !== 'string') {\n return [false, 'Input is not a string'];\n }\n if (this.allowedValues.length === 0 && input.length !== 0)\n return [true, ''];\n if (\n input.length < this.minTextLength ||\n input.length > this.maxTextLength\n ) {\n return [\n false,\n 'Input is not within the text length ' +\n this.minTextLength +\n ' and ' +\n this.maxTextLength +\n ' characters (currently ' +\n input.length +\n ' characters)',\n ];\n }\n\n return [\n this.allowedValues.includes(input),\n 'Input is not an allowed value',\n ];\n }\n}\n\nexport class NumberOption<N extends string = string> extends ConfigurationOption<N> {\n public min: number = 0;\n public max: number = Number.MAX_SAFE_INTEGER;\n public defaultValue: number = 0;\n public type: ConfigurationOptionType = 'number';\n public inputType: 'range' | 'number' = 'number';\n\n /**\n * Set the name of the option. **REQUIRED**\n * @param name {string} The name of the option. This is used to reference the option in the configuration file.\n */\n override setName<K extends string>(name: K): NumberOption<K> {\n this.name = name as unknown as N;\n return this as unknown as NumberOption<K>;\n }\n\n /**\n * Set the minimum value for the number. If the user provides a number that is less than this value, the validation will fail.\n * @param min {number} The minimum value for the number.\n */\n setMin(min: number): this {\n this.min = min;\n return this;\n }\n\n /**\n * Set the input type for the number. This will change how the client renders the input.\n * @param type {'range' | 'number'} The input type for the number.\n */\n setInputType(type: 'range' | 'number'): this {\n this.inputType = type;\n return this;\n }\n\n /**\n * Set the maximum value for the number. If the user provides a number that is greater than this value, the validation will fail.\n * @param max {number} The maximum value for the number.\n */\n setMax(max: number): this {\n this.max = max;\n return this;\n }\n\n /**\n * Set the default value for the number. This value will be used if the user does not provide a value. **HIGHLY RECOMMENDED**\n * @param defaultValue {number} The default value for the number.\n */\n setDefaultValue(defaultValue: number): this {\n this.defaultValue = defaultValue;\n return this;\n }\n\n override validate(input: unknown): [boolean, string] {\n if (isNaN(Number(input))) {\n return [false, 'Input is not a number'];\n }\n if (Number(input) < this.min || Number(input) > this.max) {\n return [\n false,\n 'Input is not within the range of ' + this.min + ' and ' + this.max,\n ];\n }\n return [true, ''];\n }\n}\n\nexport class BooleanOption<N extends string = string> extends ConfigurationOption<N> {\n public type: ConfigurationOptionType = 'boolean';\n public defaultValue: boolean = false;\n\n /**\n * Set the name of the option. **REQUIRED**\n * @param name {string} The name of the option. This is used to reference the option in the configuration file.\n */\n override setName<K extends string>(name: K): BooleanOption<K> {\n this.name = name as unknown as N;\n return this as unknown as BooleanOption<K>;\n }\n\n /**\n * Set the default value for the boolean. This value will be used if the user does not provide a value. **HIGHLY RECOMMENDED**\n * @param defaultValue {boolean} The default value for the boolean.\n */\n setDefaultValue(defaultValue: boolean): this {\n this.defaultValue = defaultValue;\n return this;\n }\n\n override validate(input: unknown): [boolean, string] {\n if (typeof input !== 'boolean') {\n return [false, 'Input is not a boolean'];\n }\n return [true, ''];\n }\n}\n\nexport class ActionOption<N extends string = string> extends ConfigurationOption<N> {\n public type: ConfigurationOptionType = 'action';\n public manifest: Record<string, unknown> = {};\n public buttonText: string = 'Run';\n public taskName: string = '';\n\n /**\n * Set the name of the option. **REQUIRED**\n * @param name {string} The name of the option. This is used to reference the option in the configuration file.\n */\n override setName<K extends string>(name: K): ActionOption<K> {\n this.name = name as unknown as N;\n return this as unknown as ActionOption<K>;\n }\n\n /**\n * Set the task name that will be used to identify which task handler to run. This should match the name used in `addon.onTask()`.\n * @param taskName {string} The task name to identify the handler.\n */\n setTaskName(taskName: string): this {\n this.taskName = taskName;\n return this;\n }\n\n /**\n * Set the manifest object that will be passed to the task-run handler. The task name should be set via setTaskName() rather than in the manifest.\n * @param manifest {Record<string, unknown>} The manifest object to pass to the task handler.\n */\n setManifest(manifest: Record<string, unknown>): this {\n this.manifest = manifest;\n return this;\n }\n\n /**\n * Set the text displayed on the action button.\n * @param text {string} The button text.\n */\n setButtonText(text: string): this {\n this.buttonText = text;\n return this;\n }\n\n override validate(_input: unknown): [boolean, string] {\n return [true, ''];\n }\n}\n"],"mappings":"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"}
@@ -1,33 +1,51 @@
1
1
  //#region src/config/ConfigurationBuilder.d.ts
2
2
  interface ConfigurationFile {
3
- [key: string]: ConfigurationOption;
3
+ [key: string]: ConfigurationOption<string>;
4
4
  }
5
- declare function isStringOption(option: ConfigurationOption): option is StringOption;
6
- declare function isNumberOption(option: ConfigurationOption): option is NumberOption;
7
- declare function isBooleanOption(option: ConfigurationOption): option is BooleanOption;
8
- declare class ConfigurationBuilder {
5
+ declare function isStringOption<N extends string = string>(option: ConfigurationOption<N>): option is StringOption<N>;
6
+ declare function isNumberOption<N extends string = string>(option: ConfigurationOption<N>): option is NumberOption<N>;
7
+ declare function isBooleanOption<N extends string = string>(option: ConfigurationOption<N>): option is BooleanOption<N>;
8
+ declare function isActionOption<N extends string = string>(option: ConfigurationOption<N>): option is ActionOption<N>;
9
+ /**
10
+ * A builder for creating configuration screens. The generic type T accumulates
11
+ * the types of all options added to the builder, enabling type-safe access to
12
+ * the configuration values.
13
+ *
14
+ * @template T - The accumulated type of all configuration options
15
+ */
16
+ declare class ConfigurationBuilder<T extends Record<string, string | number | boolean> = {}> {
9
17
  private options;
10
18
  /**
11
19
  * Add a number option to the configuration builder and return the builder for chaining. You must provide a name, display name, and description for the option.
12
- * @param option { (option: NumberOption) => NumberOption }
13
- * @returns
20
+ * @param option { (option: NumberOption) => NumberOption<K> }
21
+ * @returns A new ConfigurationBuilder with the number option's type added
14
22
  */
15
- addNumberOption(option: (option: NumberOption) => NumberOption): ConfigurationBuilder;
23
+ addNumberOption<K extends string>(option: (option: NumberOption) => NumberOption<K>): ConfigurationBuilder<T & { [P in K]: number }>;
16
24
  /**
17
25
  * Add a string option to the configuration builder and return the builder for chaining. You must provide a name, display name, and description for the option.
18
- * @param option { (option: StringOption) => StringOption }
26
+ * @param option { (option: StringOption) => StringOption<K> }
27
+ * @returns A new ConfigurationBuilder with the string option's type added
19
28
  */
20
- addStringOption(option: (option: StringOption) => StringOption): this;
29
+ addStringOption<K extends string>(option: (option: StringOption) => StringOption<K>): ConfigurationBuilder<T & { [P in K]: string }>;
21
30
  /**
22
31
  * Add a boolean option to the configuration builder and return the builder for chaining. You must provide a name, display name, and description for the option.
23
- * @param option { (option: BooleanOption) => BooleanOption }
32
+ * @param option { (option: BooleanOption) => BooleanOption<K> }
33
+ * @returns A new ConfigurationBuilder with the boolean option's type added
34
+ */
35
+ addBooleanOption<K extends string>(option: (option: BooleanOption) => BooleanOption<K>): ConfigurationBuilder<T & { [P in K]: boolean }>;
36
+ /**
37
+ * Add an action option to the configuration builder and return the builder for chaining.
38
+ * Action options contribute a boolean to the return type (true if clicked, false if not).
39
+ * You must provide a name, display name, and description for the option.
40
+ * @param option { (option: ActionOption) => ActionOption<K> }
41
+ * @returns A new ConfigurationBuilder with the action option's type added as boolean
24
42
  */
25
- addBooleanOption(option: (option: BooleanOption) => BooleanOption): this;
43
+ addActionOption<K extends string>(option: (option: ActionOption) => ActionOption<K>): ConfigurationBuilder<T & { [P in K]: boolean }>;
26
44
  build(includeFunctions: boolean): ConfigurationFile;
27
45
  }
28
- type ConfigurationOptionType = 'string' | 'number' | 'boolean' | 'unset';
29
- declare class ConfigurationOption {
30
- name: string;
46
+ type ConfigurationOptionType = 'string' | 'number' | 'boolean' | 'action' | 'unset';
47
+ declare class ConfigurationOption<N extends string = string> {
48
+ name: N;
31
49
  defaultValue: unknown;
32
50
  displayName: string;
33
51
  description: string;
@@ -36,7 +54,7 @@ declare class ConfigurationOption {
36
54
  * Set the name of the option. **REQUIRED**
37
55
  * @param name {string} The name of the option. This is used to reference the option in the configuration file.
38
56
  */
39
- setName(name: string): this;
57
+ setName<K extends string>(name: K): ConfigurationOption<K>;
40
58
  /**
41
59
  * Set the display name of the option. This is used to show the user a human readable version of what the option is. **REQUIRED**
42
60
  * @param displayName {string} The display name of the option.
@@ -55,13 +73,18 @@ declare class ConfigurationOption {
55
73
  */
56
74
  validate(input: unknown): [boolean, string];
57
75
  }
58
- declare class StringOption extends ConfigurationOption {
76
+ declare class StringOption<N extends string = string> extends ConfigurationOption<N> {
59
77
  allowedValues: string[];
60
78
  minTextLength: number;
61
79
  maxTextLength: number;
62
80
  defaultValue: string;
63
81
  inputType: 'text' | 'file' | 'password' | 'folder';
64
82
  type: ConfigurationOptionType;
83
+ /**
84
+ * Set the name of the option. **REQUIRED**
85
+ * @param name {string} The name of the option. This is used to reference the option in the configuration file.
86
+ */
87
+ setName<K extends string>(name: K): StringOption<K>;
65
88
  /**
66
89
  * Set the allowed values for the string. If the array is empty, any value is allowed. When provided, the client will act like this option is a dropdown.
67
90
  * @param allowedValues {string[]} An array of allowed values for the string. If the array is empty, any value is allowed.
@@ -89,12 +112,17 @@ declare class StringOption extends ConfigurationOption {
89
112
  setInputType(inputType: 'text' | 'file' | 'password' | 'folder'): this;
90
113
  validate(input: unknown): [boolean, string];
91
114
  }
92
- declare class NumberOption extends ConfigurationOption {
115
+ declare class NumberOption<N extends string = string> extends ConfigurationOption<N> {
93
116
  min: number;
94
117
  max: number;
95
118
  defaultValue: number;
96
119
  type: ConfigurationOptionType;
97
120
  inputType: 'range' | 'number';
121
+ /**
122
+ * Set the name of the option. **REQUIRED**
123
+ * @param name {string} The name of the option. This is used to reference the option in the configuration file.
124
+ */
125
+ setName<K extends string>(name: K): NumberOption<K>;
98
126
  /**
99
127
  * Set the minimum value for the number. If the user provides a number that is less than this value, the validation will fail.
100
128
  * @param min {number} The minimum value for the number.
@@ -117,9 +145,14 @@ declare class NumberOption extends ConfigurationOption {
117
145
  setDefaultValue(defaultValue: number): this;
118
146
  validate(input: unknown): [boolean, string];
119
147
  }
120
- declare class BooleanOption extends ConfigurationOption {
148
+ declare class BooleanOption<N extends string = string> extends ConfigurationOption<N> {
121
149
  type: ConfigurationOptionType;
122
150
  defaultValue: boolean;
151
+ /**
152
+ * Set the name of the option. **REQUIRED**
153
+ * @param name {string} The name of the option. This is used to reference the option in the configuration file.
154
+ */
155
+ setName<K extends string>(name: K): BooleanOption<K>;
123
156
  /**
124
157
  * Set the default value for the boolean. This value will be used if the user does not provide a value. **HIGHLY RECOMMENDED**
125
158
  * @param defaultValue {boolean} The default value for the boolean.
@@ -127,6 +160,33 @@ declare class BooleanOption extends ConfigurationOption {
127
160
  setDefaultValue(defaultValue: boolean): this;
128
161
  validate(input: unknown): [boolean, string];
129
162
  }
163
+ declare class ActionOption<N extends string = string> extends ConfigurationOption<N> {
164
+ type: ConfigurationOptionType;
165
+ manifest: Record<string, unknown>;
166
+ buttonText: string;
167
+ taskName: string;
168
+ /**
169
+ * Set the name of the option. **REQUIRED**
170
+ * @param name {string} The name of the option. This is used to reference the option in the configuration file.
171
+ */
172
+ setName<K extends string>(name: K): ActionOption<K>;
173
+ /**
174
+ * Set the task name that will be used to identify which task handler to run. This should match the name used in `addon.onTask()`.
175
+ * @param taskName {string} The task name to identify the handler.
176
+ */
177
+ setTaskName(taskName: string): this;
178
+ /**
179
+ * Set the manifest object that will be passed to the task-run handler. The task name should be set via setTaskName() rather than in the manifest.
180
+ * @param manifest {Record<string, unknown>} The manifest object to pass to the task handler.
181
+ */
182
+ setManifest(manifest: Record<string, unknown>): this;
183
+ /**
184
+ * Set the text displayed on the action button.
185
+ * @param text {string} The button text.
186
+ */
187
+ setButtonText(text: string): this;
188
+ validate(_input: unknown): [boolean, string];
189
+ }
130
190
  //#endregion
131
- export { ConfigurationOptionType as a, isBooleanOption as c, ConfigurationOption as i, isNumberOption as l, ConfigurationBuilder as n, NumberOption as o, ConfigurationFile as r, StringOption as s, BooleanOption as t, isStringOption as u };
132
- //# sourceMappingURL=ConfigurationBuilder-CfHLKMTO.d.cts.map
191
+ export { ConfigurationOption as a, StringOption as c, isNumberOption as d, isStringOption as f, ConfigurationFile as i, isActionOption as l, BooleanOption as n, ConfigurationOptionType as o, ConfigurationBuilder as r, NumberOption as s, ActionOption as t, isBooleanOption as u };
192
+ //# sourceMappingURL=ConfigurationBuilder-lzKf9gHw.d.mts.map