ogi-addon 1.9.2 → 1.9.4
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.
- package/build/Configuration-CdRZbO6z.d.mts +21 -0
- package/build/Configuration-WeOm-F0_.d.cts +21 -0
- package/build/ConfigurationBuilder-BSuJ4rSI.cjs +302 -0
- package/build/ConfigurationBuilder-BSuJ4rSI.cjs.map +1 -0
- package/build/ConfigurationBuilder-BbZDA_xx.d.mts +132 -0
- package/build/ConfigurationBuilder-CfHLKMTO.d.cts +132 -0
- package/build/EventResponse-CQhmdz3C.d.mts +430 -0
- package/build/EventResponse-D1c-Df5W.d.cts +430 -0
- package/build/EventResponse.cjs +55 -79
- package/build/EventResponse.cjs.map +1 -1
- package/build/EventResponse.d.cts +2 -45
- package/build/EventResponse.d.mts +2 -0
- package/build/EventResponse.mjs +58 -0
- package/build/EventResponse.mjs.map +1 -0
- package/build/SearchEngine-CRQWXfo6.d.mts +22 -0
- package/build/SearchEngine-DBSUNM4A.d.cts +22 -0
- package/build/SearchEngine.cjs +0 -19
- package/build/SearchEngine.d.cts +2 -20
- package/build/SearchEngine.d.mts +2 -0
- package/build/SearchEngine.mjs +1 -0
- package/build/config/Configuration.cjs +56 -370
- package/build/config/Configuration.cjs.map +1 -1
- package/build/config/Configuration.d.cts +3 -20
- package/build/config/Configuration.d.mts +3 -0
- package/build/config/Configuration.mjs +52 -0
- package/build/config/Configuration.mjs.map +1 -0
- package/build/config/ConfigurationBuilder.cjs +9 -292
- package/build/config/ConfigurationBuilder.d.cts +2 -130
- package/build/config/ConfigurationBuilder.d.mts +2 -0
- package/build/config/ConfigurationBuilder.mjs +221 -0
- package/build/config/ConfigurationBuilder.mjs.map +1 -0
- package/build/main.cjs +510 -1074
- package/build/main.cjs.map +1 -1
- package/build/main.d.cts +5 -385
- package/build/main.d.mts +5 -0
- package/build/main.mjs +510 -0
- package/build/main.mjs.map +1 -0
- package/package.json +9 -9
- package/src/config/Configuration.ts +18 -7
- package/src/main.ts +19 -12
- package/{tsup.config.js → tsdown.config.js} +2 -1
- package/build/EventResponse.d.ts +0 -45
- package/build/EventResponse.js +0 -62
- package/build/EventResponse.js.map +0 -1
- package/build/SearchEngine.cjs.map +0 -1
- package/build/SearchEngine.d.ts +0 -20
- package/build/SearchEngine.js +0 -1
- package/build/SearchEngine.js.map +0 -1
- package/build/config/Configuration.d.ts +0 -20
- package/build/config/Configuration.js +0 -329
- package/build/config/Configuration.js.map +0 -1
- package/build/config/ConfigurationBuilder.cjs.map +0 -1
- package/build/config/ConfigurationBuilder.d.ts +0 -130
- package/build/config/ConfigurationBuilder.js +0 -251
- package/build/config/ConfigurationBuilder.js.map +0 -1
- package/build/main.d.ts +0 -385
- package/build/main.js +0 -1045
- package/build/main.js.map +0 -1
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { r as ConfigurationFile } from "./ConfigurationBuilder-BbZDA_xx.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/config/Configuration.d.ts
|
|
4
|
+
interface DefiniteConfig {
|
|
5
|
+
[key: string]: string | number | boolean;
|
|
6
|
+
}
|
|
7
|
+
declare class Configuration {
|
|
8
|
+
readonly storedConfigTemplate: ConfigurationFile;
|
|
9
|
+
definiteConfig: DefiniteConfig;
|
|
10
|
+
constructor(configTemplate: ConfigurationFile);
|
|
11
|
+
updateConfig(config: DefiniteConfig, validate?: boolean): [boolean, {
|
|
12
|
+
[key: string]: string;
|
|
13
|
+
}];
|
|
14
|
+
private validateConfig;
|
|
15
|
+
getStringValue(optionName: string): string;
|
|
16
|
+
getNumberValue(optionName: string): number;
|
|
17
|
+
getBooleanValue(optionName: string): boolean;
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
20
|
+
export { Configuration as t };
|
|
21
|
+
//# sourceMappingURL=Configuration-CdRZbO6z.d.mts.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { r as ConfigurationFile } from "./ConfigurationBuilder-CfHLKMTO.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/config/Configuration.d.ts
|
|
4
|
+
interface DefiniteConfig {
|
|
5
|
+
[key: string]: string | number | boolean;
|
|
6
|
+
}
|
|
7
|
+
declare class Configuration {
|
|
8
|
+
readonly storedConfigTemplate: ConfigurationFile;
|
|
9
|
+
definiteConfig: DefiniteConfig;
|
|
10
|
+
constructor(configTemplate: ConfigurationFile);
|
|
11
|
+
updateConfig(config: DefiniteConfig, validate?: boolean): [boolean, {
|
|
12
|
+
[key: string]: string;
|
|
13
|
+
}];
|
|
14
|
+
private validateConfig;
|
|
15
|
+
getStringValue(optionName: string): string;
|
|
16
|
+
getNumberValue(optionName: string): number;
|
|
17
|
+
getBooleanValue(optionName: string): boolean;
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
20
|
+
export { Configuration as t };
|
|
21
|
+
//# sourceMappingURL=Configuration-WeOm-F0_.d.cts.map
|
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
//#region rolldown:runtime
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
+
key = keys[i];
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
13
|
+
__defProp(to, key, {
|
|
14
|
+
get: ((k) => from[k]).bind(null, key),
|
|
15
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
23
|
+
value: mod,
|
|
24
|
+
enumerable: true
|
|
25
|
+
}) : target, mod));
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
let zod = require("zod");
|
|
29
|
+
zod = __toESM(zod);
|
|
30
|
+
|
|
31
|
+
//#region src/config/ConfigurationBuilder.ts
|
|
32
|
+
const configValidation = zod.default.object({
|
|
33
|
+
name: zod.default.string().min(1),
|
|
34
|
+
displayName: zod.default.string().min(1),
|
|
35
|
+
description: zod.default.string().min(1)
|
|
36
|
+
});
|
|
37
|
+
function isStringOption(option) {
|
|
38
|
+
return option.type === "string";
|
|
39
|
+
}
|
|
40
|
+
function isNumberOption(option) {
|
|
41
|
+
return option.type === "number";
|
|
42
|
+
}
|
|
43
|
+
function isBooleanOption(option) {
|
|
44
|
+
return option.type === "boolean";
|
|
45
|
+
}
|
|
46
|
+
var ConfigurationBuilder = class {
|
|
47
|
+
options = [];
|
|
48
|
+
/**
|
|
49
|
+
* 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
|
|
52
|
+
*/
|
|
53
|
+
addNumberOption(option) {
|
|
54
|
+
let newOption = new NumberOption();
|
|
55
|
+
newOption = option(newOption);
|
|
56
|
+
this.options.push(newOption);
|
|
57
|
+
return this;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* 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 }
|
|
62
|
+
*/
|
|
63
|
+
addStringOption(option) {
|
|
64
|
+
let newOption = new StringOption();
|
|
65
|
+
newOption = option(newOption);
|
|
66
|
+
this.options.push(newOption);
|
|
67
|
+
return this;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* 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 }
|
|
72
|
+
*/
|
|
73
|
+
addBooleanOption(option) {
|
|
74
|
+
let newOption = new BooleanOption();
|
|
75
|
+
newOption = option(newOption);
|
|
76
|
+
this.options.push(newOption);
|
|
77
|
+
return this;
|
|
78
|
+
}
|
|
79
|
+
build(includeFunctions) {
|
|
80
|
+
let config = {};
|
|
81
|
+
this.options.forEach((option) => {
|
|
82
|
+
if (!includeFunctions) {
|
|
83
|
+
option = JSON.parse(JSON.stringify(option));
|
|
84
|
+
const optionData = configValidation.safeParse(option);
|
|
85
|
+
if (!optionData.success) throw new zod.ZodError(optionData.error.errors);
|
|
86
|
+
config[option.name] = option;
|
|
87
|
+
} else config[option.name] = option;
|
|
88
|
+
});
|
|
89
|
+
return config;
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
var ConfigurationOption = class {
|
|
93
|
+
name = "";
|
|
94
|
+
defaultValue = "";
|
|
95
|
+
displayName = "";
|
|
96
|
+
description = "";
|
|
97
|
+
type = "unset";
|
|
98
|
+
/**
|
|
99
|
+
* Set the name of the option. **REQUIRED**
|
|
100
|
+
* @param name {string} The name of the option. This is used to reference the option in the configuration file.
|
|
101
|
+
*/
|
|
102
|
+
setName(name) {
|
|
103
|
+
this.name = name;
|
|
104
|
+
return this;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Set the display name of the option. This is used to show the user a human readable version of what the option is. **REQUIRED**
|
|
108
|
+
* @param displayName {string} The display name of the option.
|
|
109
|
+
* @returns
|
|
110
|
+
*/
|
|
111
|
+
setDisplayName(displayName) {
|
|
112
|
+
this.displayName = displayName;
|
|
113
|
+
return this;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Set the description of the option. This is to show the user a brief description of what this option does. **REQUIRED**
|
|
117
|
+
* @param description {string} The description of the option.
|
|
118
|
+
* @returns
|
|
119
|
+
*/
|
|
120
|
+
setDescription(description) {
|
|
121
|
+
this.description = description;
|
|
122
|
+
return this;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* 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.
|
|
126
|
+
* @param input {unknown} The input to validate
|
|
127
|
+
*/
|
|
128
|
+
validate(input) {
|
|
129
|
+
throw new Error("Validation code not implemented. Value: " + input);
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
var StringOption = class extends ConfigurationOption {
|
|
133
|
+
allowedValues = [];
|
|
134
|
+
minTextLength = 0;
|
|
135
|
+
maxTextLength = Number.MAX_SAFE_INTEGER;
|
|
136
|
+
defaultValue = "";
|
|
137
|
+
inputType = "text";
|
|
138
|
+
type = "string";
|
|
139
|
+
/**
|
|
140
|
+
* 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
|
+
* @param allowedValues {string[]} An array of allowed values for the string. If the array is empty, any value is allowed.
|
|
142
|
+
*/
|
|
143
|
+
setAllowedValues(allowedValues) {
|
|
144
|
+
this.allowedValues = allowedValues;
|
|
145
|
+
return this;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Set the default value for the string. This value will be used if the user does not provide a value. **HIGHLY RECOMMENDED**
|
|
149
|
+
* @param defaultValue {string} The default value for the string.
|
|
150
|
+
*/
|
|
151
|
+
setDefaultValue(defaultValue) {
|
|
152
|
+
this.defaultValue = defaultValue;
|
|
153
|
+
return this;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Set the minimum text length for the string. If the user provides a string that is less than this value, the validation will fail.
|
|
157
|
+
* @param minTextLength {number} The minimum text length for the string.
|
|
158
|
+
*/
|
|
159
|
+
setMinTextLength(minTextLength) {
|
|
160
|
+
this.minTextLength = minTextLength;
|
|
161
|
+
return this;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Set the maximum text length for the string. If the user provides a string that is greater than this value, the validation will fail.
|
|
165
|
+
* @param maxTextLength {number} The maximum text length for the string.
|
|
166
|
+
*/
|
|
167
|
+
setMaxTextLength(maxTextLength) {
|
|
168
|
+
this.maxTextLength = maxTextLength;
|
|
169
|
+
return this;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Set the input type for the string. This will change how the client renders the input.
|
|
173
|
+
* @param inputType {'text' | 'file' | 'password' | 'folder'} The input type for the string.
|
|
174
|
+
*/
|
|
175
|
+
setInputType(inputType) {
|
|
176
|
+
this.inputType = inputType;
|
|
177
|
+
return this;
|
|
178
|
+
}
|
|
179
|
+
validate(input) {
|
|
180
|
+
if (typeof input !== "string") return [false, "Input is not a string"];
|
|
181
|
+
if (this.allowedValues.length === 0 && input.length !== 0) return [true, ""];
|
|
182
|
+
if (input.length < this.minTextLength || input.length > this.maxTextLength) return [false, "Input is not within the text length " + this.minTextLength + " and " + this.maxTextLength + " characters (currently " + input.length + " characters)"];
|
|
183
|
+
return [this.allowedValues.includes(input), "Input is not an allowed value"];
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
var NumberOption = class extends ConfigurationOption {
|
|
187
|
+
min = 0;
|
|
188
|
+
max = Number.MAX_SAFE_INTEGER;
|
|
189
|
+
defaultValue = 0;
|
|
190
|
+
type = "number";
|
|
191
|
+
inputType = "number";
|
|
192
|
+
/**
|
|
193
|
+
* Set the minimum value for the number. If the user provides a number that is less than this value, the validation will fail.
|
|
194
|
+
* @param min {number} The minimum value for the number.
|
|
195
|
+
*/
|
|
196
|
+
setMin(min) {
|
|
197
|
+
this.min = min;
|
|
198
|
+
return this;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Set the input type for the number. This will change how the client renders the input.
|
|
202
|
+
* @param type {'range' | 'number'} The input type for the number.
|
|
203
|
+
*/
|
|
204
|
+
setInputType(type) {
|
|
205
|
+
this.inputType = type;
|
|
206
|
+
return this;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Set the maximum value for the number. If the user provides a number that is greater than this value, the validation will fail.
|
|
210
|
+
* @param max {number} The maximum value for the number.
|
|
211
|
+
*/
|
|
212
|
+
setMax(max) {
|
|
213
|
+
this.max = max;
|
|
214
|
+
return this;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Set the default value for the number. This value will be used if the user does not provide a value. **HIGHLY RECOMMENDED**
|
|
218
|
+
* @param defaultValue {number} The default value for the number.
|
|
219
|
+
*/
|
|
220
|
+
setDefaultValue(defaultValue) {
|
|
221
|
+
this.defaultValue = defaultValue;
|
|
222
|
+
return this;
|
|
223
|
+
}
|
|
224
|
+
validate(input) {
|
|
225
|
+
if (isNaN(Number(input))) return [false, "Input is not a number"];
|
|
226
|
+
if (Number(input) < this.min || Number(input) > this.max) return [false, "Input is not within the range of " + this.min + " and " + this.max];
|
|
227
|
+
return [true, ""];
|
|
228
|
+
}
|
|
229
|
+
};
|
|
230
|
+
var BooleanOption = class extends ConfigurationOption {
|
|
231
|
+
type = "boolean";
|
|
232
|
+
defaultValue = false;
|
|
233
|
+
/**
|
|
234
|
+
* Set the default value for the boolean. This value will be used if the user does not provide a value. **HIGHLY RECOMMENDED**
|
|
235
|
+
* @param defaultValue {boolean} The default value for the boolean.
|
|
236
|
+
*/
|
|
237
|
+
setDefaultValue(defaultValue) {
|
|
238
|
+
this.defaultValue = defaultValue;
|
|
239
|
+
return this;
|
|
240
|
+
}
|
|
241
|
+
validate(input) {
|
|
242
|
+
if (typeof input !== "boolean") return [false, "Input is not a boolean"];
|
|
243
|
+
return [true, ""];
|
|
244
|
+
}
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
//#endregion
|
|
248
|
+
Object.defineProperty(exports, 'BooleanOption', {
|
|
249
|
+
enumerable: true,
|
|
250
|
+
get: function () {
|
|
251
|
+
return BooleanOption;
|
|
252
|
+
}
|
|
253
|
+
});
|
|
254
|
+
Object.defineProperty(exports, 'ConfigurationBuilder', {
|
|
255
|
+
enumerable: true,
|
|
256
|
+
get: function () {
|
|
257
|
+
return ConfigurationBuilder;
|
|
258
|
+
}
|
|
259
|
+
});
|
|
260
|
+
Object.defineProperty(exports, 'ConfigurationOption', {
|
|
261
|
+
enumerable: true,
|
|
262
|
+
get: function () {
|
|
263
|
+
return ConfigurationOption;
|
|
264
|
+
}
|
|
265
|
+
});
|
|
266
|
+
Object.defineProperty(exports, 'NumberOption', {
|
|
267
|
+
enumerable: true,
|
|
268
|
+
get: function () {
|
|
269
|
+
return NumberOption;
|
|
270
|
+
}
|
|
271
|
+
});
|
|
272
|
+
Object.defineProperty(exports, 'StringOption', {
|
|
273
|
+
enumerable: true,
|
|
274
|
+
get: function () {
|
|
275
|
+
return StringOption;
|
|
276
|
+
}
|
|
277
|
+
});
|
|
278
|
+
Object.defineProperty(exports, '__toESM', {
|
|
279
|
+
enumerable: true,
|
|
280
|
+
get: function () {
|
|
281
|
+
return __toESM;
|
|
282
|
+
}
|
|
283
|
+
});
|
|
284
|
+
Object.defineProperty(exports, 'isBooleanOption', {
|
|
285
|
+
enumerable: true,
|
|
286
|
+
get: function () {
|
|
287
|
+
return isBooleanOption;
|
|
288
|
+
}
|
|
289
|
+
});
|
|
290
|
+
Object.defineProperty(exports, 'isNumberOption', {
|
|
291
|
+
enumerable: true,
|
|
292
|
+
get: function () {
|
|
293
|
+
return isNumberOption;
|
|
294
|
+
}
|
|
295
|
+
});
|
|
296
|
+
Object.defineProperty(exports, 'isStringOption', {
|
|
297
|
+
enumerable: true,
|
|
298
|
+
get: function () {
|
|
299
|
+
return isStringOption;
|
|
300
|
+
}
|
|
301
|
+
});
|
|
302
|
+
//# sourceMappingURL=ConfigurationBuilder-BSuJ4rSI.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConfigurationBuilder-BSuJ4rSI.cjs","names":["z","ZodError"],"sources":["../src/config/ConfigurationBuilder.ts"],"sourcesContent":["import z, { ZodError } from 'zod';\n\nexport interface ConfigurationFile {\n [key: string]: ConfigurationOption;\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 option: ConfigurationOption\n): option is StringOption {\n return option.type === 'string';\n}\n\nexport function isNumberOption(\n option: ConfigurationOption\n): option is NumberOption {\n return option.type === 'number';\n}\n\nexport function isBooleanOption(\n option: ConfigurationOption\n): option is BooleanOption {\n return option.type === 'boolean';\n}\n\nexport class ConfigurationBuilder {\n private options: ConfigurationOption[] = [];\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 }\n * @returns\n */\n public addNumberOption(\n option: (option: NumberOption) => NumberOption\n ): ConfigurationBuilder {\n let newOption = new NumberOption();\n newOption = option(newOption);\n this.options.push(newOption);\n return this;\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 }\n */\n public addStringOption(option: (option: StringOption) => StringOption) {\n let newOption = new StringOption();\n newOption = option(newOption);\n this.options.push(newOption);\n return this;\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 }\n */\n public addBooleanOption(option: (option: BooleanOption) => BooleanOption) {\n let newOption = new BooleanOption();\n newOption = option(newOption);\n this.options.push(newOption);\n return this;\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 = 'string' | 'number' | 'boolean' | 'unset';\nexport class ConfigurationOption {\n public name: string = '';\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(name: string) {\n this.name = name;\n return this;\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) {\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) {\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 extends ConfigurationOption {\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 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 extends ConfigurationOption {\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 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 extends ConfigurationOption {\n public type: ConfigurationOptionType = 'boolean';\n public defaultValue: boolean = false;\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"],"mappings":"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"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
//#region src/config/ConfigurationBuilder.d.ts
|
|
2
|
+
interface ConfigurationFile {
|
|
3
|
+
[key: string]: ConfigurationOption;
|
|
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 {
|
|
9
|
+
private options;
|
|
10
|
+
/**
|
|
11
|
+
* 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
|
|
14
|
+
*/
|
|
15
|
+
addNumberOption(option: (option: NumberOption) => NumberOption): ConfigurationBuilder;
|
|
16
|
+
/**
|
|
17
|
+
* 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 }
|
|
19
|
+
*/
|
|
20
|
+
addStringOption(option: (option: StringOption) => StringOption): this;
|
|
21
|
+
/**
|
|
22
|
+
* 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 }
|
|
24
|
+
*/
|
|
25
|
+
addBooleanOption(option: (option: BooleanOption) => BooleanOption): this;
|
|
26
|
+
build(includeFunctions: boolean): ConfigurationFile;
|
|
27
|
+
}
|
|
28
|
+
type ConfigurationOptionType = 'string' | 'number' | 'boolean' | 'unset';
|
|
29
|
+
declare class ConfigurationOption {
|
|
30
|
+
name: string;
|
|
31
|
+
defaultValue: unknown;
|
|
32
|
+
displayName: string;
|
|
33
|
+
description: string;
|
|
34
|
+
type: ConfigurationOptionType;
|
|
35
|
+
/**
|
|
36
|
+
* Set the name of the option. **REQUIRED**
|
|
37
|
+
* @param name {string} The name of the option. This is used to reference the option in the configuration file.
|
|
38
|
+
*/
|
|
39
|
+
setName(name: string): this;
|
|
40
|
+
/**
|
|
41
|
+
* 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
|
+
* @param displayName {string} The display name of the option.
|
|
43
|
+
* @returns
|
|
44
|
+
*/
|
|
45
|
+
setDisplayName(displayName: string): this;
|
|
46
|
+
/**
|
|
47
|
+
* Set the description of the option. This is to show the user a brief description of what this option does. **REQUIRED**
|
|
48
|
+
* @param description {string} The description of the option.
|
|
49
|
+
* @returns
|
|
50
|
+
*/
|
|
51
|
+
setDescription(description: string): this;
|
|
52
|
+
/**
|
|
53
|
+
* 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.
|
|
54
|
+
* @param input {unknown} The input to validate
|
|
55
|
+
*/
|
|
56
|
+
validate(input: unknown): [boolean, string];
|
|
57
|
+
}
|
|
58
|
+
declare class StringOption extends ConfigurationOption {
|
|
59
|
+
allowedValues: string[];
|
|
60
|
+
minTextLength: number;
|
|
61
|
+
maxTextLength: number;
|
|
62
|
+
defaultValue: string;
|
|
63
|
+
inputType: 'text' | 'file' | 'password' | 'folder';
|
|
64
|
+
type: ConfigurationOptionType;
|
|
65
|
+
/**
|
|
66
|
+
* 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
|
+
* @param allowedValues {string[]} An array of allowed values for the string. If the array is empty, any value is allowed.
|
|
68
|
+
*/
|
|
69
|
+
setAllowedValues(allowedValues: string[]): this;
|
|
70
|
+
/**
|
|
71
|
+
* Set the default value for the string. This value will be used if the user does not provide a value. **HIGHLY RECOMMENDED**
|
|
72
|
+
* @param defaultValue {string} The default value for the string.
|
|
73
|
+
*/
|
|
74
|
+
setDefaultValue(defaultValue: string): this;
|
|
75
|
+
/**
|
|
76
|
+
* Set the minimum text length for the string. If the user provides a string that is less than this value, the validation will fail.
|
|
77
|
+
* @param minTextLength {number} The minimum text length for the string.
|
|
78
|
+
*/
|
|
79
|
+
setMinTextLength(minTextLength: number): this;
|
|
80
|
+
/**
|
|
81
|
+
* Set the maximum text length for the string. If the user provides a string that is greater than this value, the validation will fail.
|
|
82
|
+
* @param maxTextLength {number} The maximum text length for the string.
|
|
83
|
+
*/
|
|
84
|
+
setMaxTextLength(maxTextLength: number): this;
|
|
85
|
+
/**
|
|
86
|
+
* Set the input type for the string. This will change how the client renders the input.
|
|
87
|
+
* @param inputType {'text' | 'file' | 'password' | 'folder'} The input type for the string.
|
|
88
|
+
*/
|
|
89
|
+
setInputType(inputType: 'text' | 'file' | 'password' | 'folder'): this;
|
|
90
|
+
validate(input: unknown): [boolean, string];
|
|
91
|
+
}
|
|
92
|
+
declare class NumberOption extends ConfigurationOption {
|
|
93
|
+
min: number;
|
|
94
|
+
max: number;
|
|
95
|
+
defaultValue: number;
|
|
96
|
+
type: ConfigurationOptionType;
|
|
97
|
+
inputType: 'range' | 'number';
|
|
98
|
+
/**
|
|
99
|
+
* Set the minimum value for the number. If the user provides a number that is less than this value, the validation will fail.
|
|
100
|
+
* @param min {number} The minimum value for the number.
|
|
101
|
+
*/
|
|
102
|
+
setMin(min: number): this;
|
|
103
|
+
/**
|
|
104
|
+
* Set the input type for the number. This will change how the client renders the input.
|
|
105
|
+
* @param type {'range' | 'number'} The input type for the number.
|
|
106
|
+
*/
|
|
107
|
+
setInputType(type: 'range' | 'number'): this;
|
|
108
|
+
/**
|
|
109
|
+
* Set the maximum value for the number. If the user provides a number that is greater than this value, the validation will fail.
|
|
110
|
+
* @param max {number} The maximum value for the number.
|
|
111
|
+
*/
|
|
112
|
+
setMax(max: number): this;
|
|
113
|
+
/**
|
|
114
|
+
* Set the default value for the number. This value will be used if the user does not provide a value. **HIGHLY RECOMMENDED**
|
|
115
|
+
* @param defaultValue {number} The default value for the number.
|
|
116
|
+
*/
|
|
117
|
+
setDefaultValue(defaultValue: number): this;
|
|
118
|
+
validate(input: unknown): [boolean, string];
|
|
119
|
+
}
|
|
120
|
+
declare class BooleanOption extends ConfigurationOption {
|
|
121
|
+
type: ConfigurationOptionType;
|
|
122
|
+
defaultValue: boolean;
|
|
123
|
+
/**
|
|
124
|
+
* Set the default value for the boolean. This value will be used if the user does not provide a value. **HIGHLY RECOMMENDED**
|
|
125
|
+
* @param defaultValue {boolean} The default value for the boolean.
|
|
126
|
+
*/
|
|
127
|
+
setDefaultValue(defaultValue: boolean): this;
|
|
128
|
+
validate(input: unknown): [boolean, string];
|
|
129
|
+
}
|
|
130
|
+
//#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
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
//#region src/config/ConfigurationBuilder.d.ts
|
|
2
|
+
interface ConfigurationFile {
|
|
3
|
+
[key: string]: ConfigurationOption;
|
|
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 {
|
|
9
|
+
private options;
|
|
10
|
+
/**
|
|
11
|
+
* 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
|
|
14
|
+
*/
|
|
15
|
+
addNumberOption(option: (option: NumberOption) => NumberOption): ConfigurationBuilder;
|
|
16
|
+
/**
|
|
17
|
+
* 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 }
|
|
19
|
+
*/
|
|
20
|
+
addStringOption(option: (option: StringOption) => StringOption): this;
|
|
21
|
+
/**
|
|
22
|
+
* 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 }
|
|
24
|
+
*/
|
|
25
|
+
addBooleanOption(option: (option: BooleanOption) => BooleanOption): this;
|
|
26
|
+
build(includeFunctions: boolean): ConfigurationFile;
|
|
27
|
+
}
|
|
28
|
+
type ConfigurationOptionType = 'string' | 'number' | 'boolean' | 'unset';
|
|
29
|
+
declare class ConfigurationOption {
|
|
30
|
+
name: string;
|
|
31
|
+
defaultValue: unknown;
|
|
32
|
+
displayName: string;
|
|
33
|
+
description: string;
|
|
34
|
+
type: ConfigurationOptionType;
|
|
35
|
+
/**
|
|
36
|
+
* Set the name of the option. **REQUIRED**
|
|
37
|
+
* @param name {string} The name of the option. This is used to reference the option in the configuration file.
|
|
38
|
+
*/
|
|
39
|
+
setName(name: string): this;
|
|
40
|
+
/**
|
|
41
|
+
* 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
|
+
* @param displayName {string} The display name of the option.
|
|
43
|
+
* @returns
|
|
44
|
+
*/
|
|
45
|
+
setDisplayName(displayName: string): this;
|
|
46
|
+
/**
|
|
47
|
+
* Set the description of the option. This is to show the user a brief description of what this option does. **REQUIRED**
|
|
48
|
+
* @param description {string} The description of the option.
|
|
49
|
+
* @returns
|
|
50
|
+
*/
|
|
51
|
+
setDescription(description: string): this;
|
|
52
|
+
/**
|
|
53
|
+
* 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.
|
|
54
|
+
* @param input {unknown} The input to validate
|
|
55
|
+
*/
|
|
56
|
+
validate(input: unknown): [boolean, string];
|
|
57
|
+
}
|
|
58
|
+
declare class StringOption extends ConfigurationOption {
|
|
59
|
+
allowedValues: string[];
|
|
60
|
+
minTextLength: number;
|
|
61
|
+
maxTextLength: number;
|
|
62
|
+
defaultValue: string;
|
|
63
|
+
inputType: 'text' | 'file' | 'password' | 'folder';
|
|
64
|
+
type: ConfigurationOptionType;
|
|
65
|
+
/**
|
|
66
|
+
* 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
|
+
* @param allowedValues {string[]} An array of allowed values for the string. If the array is empty, any value is allowed.
|
|
68
|
+
*/
|
|
69
|
+
setAllowedValues(allowedValues: string[]): this;
|
|
70
|
+
/**
|
|
71
|
+
* Set the default value for the string. This value will be used if the user does not provide a value. **HIGHLY RECOMMENDED**
|
|
72
|
+
* @param defaultValue {string} The default value for the string.
|
|
73
|
+
*/
|
|
74
|
+
setDefaultValue(defaultValue: string): this;
|
|
75
|
+
/**
|
|
76
|
+
* Set the minimum text length for the string. If the user provides a string that is less than this value, the validation will fail.
|
|
77
|
+
* @param minTextLength {number} The minimum text length for the string.
|
|
78
|
+
*/
|
|
79
|
+
setMinTextLength(minTextLength: number): this;
|
|
80
|
+
/**
|
|
81
|
+
* Set the maximum text length for the string. If the user provides a string that is greater than this value, the validation will fail.
|
|
82
|
+
* @param maxTextLength {number} The maximum text length for the string.
|
|
83
|
+
*/
|
|
84
|
+
setMaxTextLength(maxTextLength: number): this;
|
|
85
|
+
/**
|
|
86
|
+
* Set the input type for the string. This will change how the client renders the input.
|
|
87
|
+
* @param inputType {'text' | 'file' | 'password' | 'folder'} The input type for the string.
|
|
88
|
+
*/
|
|
89
|
+
setInputType(inputType: 'text' | 'file' | 'password' | 'folder'): this;
|
|
90
|
+
validate(input: unknown): [boolean, string];
|
|
91
|
+
}
|
|
92
|
+
declare class NumberOption extends ConfigurationOption {
|
|
93
|
+
min: number;
|
|
94
|
+
max: number;
|
|
95
|
+
defaultValue: number;
|
|
96
|
+
type: ConfigurationOptionType;
|
|
97
|
+
inputType: 'range' | 'number';
|
|
98
|
+
/**
|
|
99
|
+
* Set the minimum value for the number. If the user provides a number that is less than this value, the validation will fail.
|
|
100
|
+
* @param min {number} The minimum value for the number.
|
|
101
|
+
*/
|
|
102
|
+
setMin(min: number): this;
|
|
103
|
+
/**
|
|
104
|
+
* Set the input type for the number. This will change how the client renders the input.
|
|
105
|
+
* @param type {'range' | 'number'} The input type for the number.
|
|
106
|
+
*/
|
|
107
|
+
setInputType(type: 'range' | 'number'): this;
|
|
108
|
+
/**
|
|
109
|
+
* Set the maximum value for the number. If the user provides a number that is greater than this value, the validation will fail.
|
|
110
|
+
* @param max {number} The maximum value for the number.
|
|
111
|
+
*/
|
|
112
|
+
setMax(max: number): this;
|
|
113
|
+
/**
|
|
114
|
+
* Set the default value for the number. This value will be used if the user does not provide a value. **HIGHLY RECOMMENDED**
|
|
115
|
+
* @param defaultValue {number} The default value for the number.
|
|
116
|
+
*/
|
|
117
|
+
setDefaultValue(defaultValue: number): this;
|
|
118
|
+
validate(input: unknown): [boolean, string];
|
|
119
|
+
}
|
|
120
|
+
declare class BooleanOption extends ConfigurationOption {
|
|
121
|
+
type: ConfigurationOptionType;
|
|
122
|
+
defaultValue: boolean;
|
|
123
|
+
/**
|
|
124
|
+
* Set the default value for the boolean. This value will be used if the user does not provide a value. **HIGHLY RECOMMENDED**
|
|
125
|
+
* @param defaultValue {boolean} The default value for the boolean.
|
|
126
|
+
*/
|
|
127
|
+
setDefaultValue(defaultValue: boolean): this;
|
|
128
|
+
validate(input: unknown): [boolean, string];
|
|
129
|
+
}
|
|
130
|
+
//#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
|