ogi-addon 2.1.0 → 2.3.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.
package/README.md CHANGED
@@ -2,21 +2,31 @@
2
2
 
3
3
  A library to interface with OpenGameInstaller's addon system.
4
4
 
5
- # Installation
5
+ ## Installation
6
6
 
7
7
  ```bash
8
- $ npm install ogi-addon
8
+ bun add ogi-addon
9
9
  ```
10
10
 
11
- # Examples
11
+ ## Documentation
12
12
 
13
- Check out the [test-addon](https://github.com/Nat3z/OpenGameInstaller/tree/main/test-addon) folder to see how to use the addon library.
13
+ - [First addon guide](https://ogi.nat3z.com/docs/first-addon)
14
+ - [Configuration setup](https://ogi.nat3z.com/docs/first-addon/adding-configs)
15
+ - [Discover catalogs and carousel](https://ogi.nat3z.com/docs/first-addon/adding-discover-catalogs)
16
+ - [Action buttons and tasks](https://ogi.nat3z.com/docs/first-addon/action-buttons-and-tasks)
17
+ - [Game update support](https://ogi.nat3z.com/docs/first-addon/adding-game-updates)
18
+ - [Migration guide (v2.0.x to v2.1)](https://ogi.nat3z.com/docs/updates/2.0-to-2.1)
14
19
 
15
- # Boilerplate
20
+ ## Example Addon
16
21
 
17
- Your addon should include an `addon.json` file which describes how to setup your addon. It should always include a `run` script so OpenGameInstaller will know how to start your addon.
22
+ See `test-addon` for an end-to-end example:
23
+ [test-addon](https://github.com/Nat3z/OpenGameInstaller/tree/main/test-addon)
18
24
 
19
- ```typescript
25
+ ## `addon.json` Boilerplate
26
+
27
+ Your addon should include an `addon.json` file that describes setup and runtime scripts.
28
+
29
+ ```ts
20
30
  interface AddonFileConfigurationSchema {
21
31
  author: string;
22
32
  scripts: {
@@ -28,22 +38,20 @@ interface AddonFileConfigurationSchema {
28
38
  }
29
39
  ```
30
40
 
31
- ## How to Develop
41
+ ## Local Development in OGI
32
42
 
33
- In OpenGameInstaller, go to `Settings > General` and use the **local:** prefix to define that your addon is hosted locally instead of through a remote git repository.
43
+ In OpenGameInstaller, go to `Settings > General` and use the `local:` prefix to point to your addon path.
34
44
 
35
- For Example:
45
+ Example:
36
46
 
37
- ```
47
+ ```text
38
48
  local:C:\Users\[you]\Documents\Addon\
39
49
  ```
40
50
 
41
- This will allow OpenGameInstaller to launch your addon securely instead of opening up the addon server for unsigned connections.
42
-
43
- ### Disable Signature Requirement for Addons
51
+ ### Disable Signature Requirement (Debug Only)
44
52
 
45
- If you want to debug your addon without relying on OpenGameInstaller to launch it, you can disable the signature requirement.
53
+ If you need to debug outside normal launch flow, you can disable signature checks.
46
54
 
47
- ⚠️ **WARNING** This is VERY unsafe to do, as it allows for any malicious program to connect to the addon server without needing to provide the addon secret. We recommend enabling this temporarily for debugging purposes and disabling it once you can.
55
+ Warning: this is unsafe and allows unsigned programs to connect to the addon server.
48
56
 
49
- To disable the signature requirement, go to `Settings > Developer` and select **Disable Server Secret Check**. Restart OpenGameInstaller.
57
+ To disable, go to `Settings > Developer`, select `Disable Server Secret Check`, and restart OGI.
@@ -1,2 +1,41 @@
1
- import { t as EventResponse } from "./EventResponse-Btb5YASI.cjs";
2
- export = EventResponse;
1
+ import { ConfigurationBuilder } from "./config/ConfigurationBuilder.cjs";
2
+
3
+ //#region src/EventResponse.d.ts
4
+ declare class EventResponse<T> {
5
+ data: T | undefined;
6
+ deffered: boolean;
7
+ resolved: boolean;
8
+ progress: number;
9
+ logs: string[];
10
+ failed: string | undefined;
11
+ onInputAsked?: <U extends Record<string, string | number | boolean>>(screen: ConfigurationBuilder<U>, name: string, description: string) => Promise<U>;
12
+ constructor(onInputAsked?: <U extends Record<string, string | number | boolean>>(screen: ConfigurationBuilder<U>, name: string, description: string) => Promise<U>);
13
+ defer(promise?: () => Promise<void>): void;
14
+ /**
15
+ * Resolve the event with data. This acts like a promise resolve, and will stop the event from being processed further. **You must always call this method when you are done with the event.**
16
+ * @param data {T}
17
+ */
18
+ resolve(data: T): void;
19
+ /**
20
+ * Completes the event and resolves it, but does not return any data. **You must always call this method when you are done with the event.**
21
+ */
22
+ complete(): void;
23
+ fail(message: string): void;
24
+ /**
25
+ * Logs a message to the event. This is useful for debugging and logging information to the user.
26
+ * @param message {string}
27
+ */
28
+ log(message: string): void;
29
+ /**
30
+ * Send a screen to the client to ask for input. Use the `ConfigurationBuilder` system to build the screen. Once sent to the user, the addon cannot change the screen.
31
+ * The return type is inferred from the ConfigurationBuilder's accumulated option types.
32
+ * @async
33
+ * @param name {string} The name/title of the input prompt.
34
+ * @param description {string} The description of what input is needed.
35
+ * @param screen {ConfigurationBuilder<U>} The configuration builder for the input form.
36
+ * @returns {Promise<U>} The user's input with types matching the configuration options.
37
+ */
38
+ askForInput<U extends Record<string, string | number | boolean>>(name: string, description: string, screen: ConfigurationBuilder<U>): Promise<U>;
39
+ }
40
+ export = EventResponse;
41
+ //# sourceMappingURL=EventResponse.d.cts.map
@@ -1,2 +1,43 @@
1
- import { t as EventResponse } from "./EventResponse-Clg-5HI_.mjs";
2
- export { EventResponse as default };
1
+ import { ConfigurationBuilder } from "./config/ConfigurationBuilder.mjs";
2
+ import "./main.mjs";
3
+
4
+ //#region src/EventResponse.d.ts
5
+ declare class EventResponse<T> {
6
+ data: T | undefined;
7
+ deffered: boolean;
8
+ resolved: boolean;
9
+ progress: number;
10
+ logs: string[];
11
+ failed: string | undefined;
12
+ onInputAsked?: <U extends Record<string, string | number | boolean>>(screen: ConfigurationBuilder<U>, name: string, description: string) => Promise<U>;
13
+ constructor(onInputAsked?: <U extends Record<string, string | number | boolean>>(screen: ConfigurationBuilder<U>, name: string, description: string) => Promise<U>);
14
+ defer(promise?: () => Promise<void>): void;
15
+ /**
16
+ * Resolve the event with data. This acts like a promise resolve, and will stop the event from being processed further. **You must always call this method when you are done with the event.**
17
+ * @param data {T}
18
+ */
19
+ resolve(data: T): void;
20
+ /**
21
+ * Completes the event and resolves it, but does not return any data. **You must always call this method when you are done with the event.**
22
+ */
23
+ complete(): void;
24
+ fail(message: string): void;
25
+ /**
26
+ * Logs a message to the event. This is useful for debugging and logging information to the user.
27
+ * @param message {string}
28
+ */
29
+ log(message: string): void;
30
+ /**
31
+ * Send a screen to the client to ask for input. Use the `ConfigurationBuilder` system to build the screen. Once sent to the user, the addon cannot change the screen.
32
+ * The return type is inferred from the ConfigurationBuilder's accumulated option types.
33
+ * @async
34
+ * @param name {string} The name/title of the input prompt.
35
+ * @param description {string} The description of what input is needed.
36
+ * @param screen {ConfigurationBuilder<U>} The configuration builder for the input form.
37
+ * @returns {Promise<U>} The user's input with types matching the configuration options.
38
+ */
39
+ askForInput<U extends Record<string, string | number | boolean>>(name: string, description: string, screen: ConfigurationBuilder<U>): Promise<U>;
40
+ }
41
+ //#endregion
42
+ export { EventResponse as default };
43
+ //# sourceMappingURL=EventResponse.d.mts.map
@@ -1,2 +1,25 @@
1
- import { t as SearchResult } from "./SearchEngine-Cn_-M-at.cjs";
2
- export { SearchResult };
1
+ //#region src/SearchEngine.d.ts
2
+ type BaseRequiredFields = {
3
+ name: string;
4
+ manifest?: Record<string, any>;
5
+ };
6
+ type SearchResult = BaseRequiredFields & ({
7
+ downloadType: 'torrent' | 'magnet';
8
+ filename: string;
9
+ downloadURL: string;
10
+ } | {
11
+ downloadType: 'direct';
12
+ files: {
13
+ name: string;
14
+ downloadURL: string;
15
+ headers?: Record<string, string>;
16
+ }[];
17
+ } | {
18
+ downloadType: 'task';
19
+ taskName: string;
20
+ } | {
21
+ downloadType: 'request' | 'empty';
22
+ });
23
+ //#endregion
24
+ export { SearchResult };
25
+ //# sourceMappingURL=SearchEngine.d.cts.map
@@ -1,2 +1,25 @@
1
- import { t as SearchResult } from "./SearchEngine-lZioNunY.mjs";
2
- export { SearchResult };
1
+ //#region src/SearchEngine.d.ts
2
+ type BaseRequiredFields = {
3
+ name: string;
4
+ manifest?: Record<string, any>;
5
+ };
6
+ type SearchResult = BaseRequiredFields & ({
7
+ downloadType: 'torrent' | 'magnet';
8
+ filename: string;
9
+ downloadURL: string;
10
+ } | {
11
+ downloadType: 'direct';
12
+ files: {
13
+ name: string;
14
+ downloadURL: string;
15
+ headers?: Record<string, string>;
16
+ }[];
17
+ } | {
18
+ downloadType: 'task';
19
+ taskName: string;
20
+ } | {
21
+ downloadType: 'request' | 'empty';
22
+ });
23
+ //#endregion
24
+ export { SearchResult };
25
+ //# sourceMappingURL=SearchEngine.d.mts.map
@@ -0,0 +1,34 @@
1
+ //#region \0rolldown/runtime.js
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
+
29
+ Object.defineProperty(exports, '__toESM', {
30
+ enumerable: true,
31
+ get: function () {
32
+ return __toESM;
33
+ }
34
+ });
@@ -1,4 +1,5 @@
1
- const require_ConfigurationBuilder = require('../ConfigurationBuilder-CFXi6UwU.cjs');
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_config_ConfigurationBuilder = require('./ConfigurationBuilder.cjs');
2
3
 
3
4
  //#region src/config/Configuration.ts
4
5
  var Configuration = class {
@@ -49,15 +50,15 @@ var Configuration = class {
49
50
  };
50
51
 
51
52
  //#endregion
52
- exports.ActionOption = require_ConfigurationBuilder.ActionOption;
53
- exports.BooleanOption = require_ConfigurationBuilder.BooleanOption;
53
+ exports.ActionOption = require_config_ConfigurationBuilder.ActionOption;
54
+ exports.BooleanOption = require_config_ConfigurationBuilder.BooleanOption;
54
55
  exports.Configuration = Configuration;
55
- exports.ConfigurationBuilder = require_ConfigurationBuilder.ConfigurationBuilder;
56
- exports.ConfigurationOption = require_ConfigurationBuilder.ConfigurationOption;
57
- exports.NumberOption = require_ConfigurationBuilder.NumberOption;
58
- exports.StringOption = require_ConfigurationBuilder.StringOption;
59
- exports.isActionOption = require_ConfigurationBuilder.isActionOption;
60
- exports.isBooleanOption = require_ConfigurationBuilder.isBooleanOption;
61
- exports.isNumberOption = require_ConfigurationBuilder.isNumberOption;
62
- exports.isStringOption = require_ConfigurationBuilder.isStringOption;
56
+ exports.ConfigurationBuilder = require_config_ConfigurationBuilder.ConfigurationBuilder;
57
+ exports.ConfigurationOption = require_config_ConfigurationBuilder.ConfigurationOption;
58
+ exports.NumberOption = require_config_ConfigurationBuilder.NumberOption;
59
+ exports.StringOption = require_config_ConfigurationBuilder.StringOption;
60
+ exports.isActionOption = require_config_ConfigurationBuilder.isActionOption;
61
+ exports.isBooleanOption = require_config_ConfigurationBuilder.isBooleanOption;
62
+ exports.isNumberOption = require_config_ConfigurationBuilder.isNumberOption;
63
+ exports.isStringOption = require_config_ConfigurationBuilder.isStringOption;
63
64
  //# sourceMappingURL=Configuration.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Configuration.cjs","names":[],"sources":["../../src/config/Configuration.ts"],"sourcesContent":["import {\n ConfigurationBuilder,\n BooleanOption,\n ConfigurationOption,\n NumberOption,\n StringOption,\n ActionOption,\n isBooleanOption,\n isNumberOption,\n isStringOption,\n isActionOption,\n} from './ConfigurationBuilder';\nimport type {\n ConfigurationFile,\n ConfigurationOptionType,\n} from './ConfigurationBuilder';\n\ninterface DefiniteConfig {\n [key: string]: string | number | boolean;\n}\nexport class Configuration {\n readonly storedConfigTemplate: ConfigurationFile;\n definiteConfig: DefiniteConfig = {};\n constructor(configTemplate: ConfigurationFile) {\n this.storedConfigTemplate = configTemplate;\n }\n\n updateConfig(\n config: DefiniteConfig,\n validate: boolean = true\n ): [boolean, { [key: string]: string }] {\n this.definiteConfig = config;\n if (validate) {\n const result = this.validateConfig();\n return result;\n }\n return [true, {}];\n }\n // provides falsey or truthy value, and an error message if falsey\n private validateConfig(): [boolean, { [key: string]: string }] {\n const erroredKeys = new Map<string, string>();\n for (const key in this.storedConfigTemplate) {\n if (\n this.storedConfigTemplate[key].type !== 'action' &&\n (this.definiteConfig[key] === null ||\n this.definiteConfig[key] === undefined)\n ) {\n console.warn(\n 'Option ' +\n key +\n ' is not defined. Using default value Value: ' +\n this.storedConfigTemplate[key].defaultValue\n );\n this.definiteConfig[key] = this.storedConfigTemplate[key]\n .defaultValue as string | number | boolean;\n }\n if (\n this.storedConfigTemplate[key].type !== 'action' &&\n this.storedConfigTemplate[key].type !== typeof this.definiteConfig[key]\n ) {\n throw new Error('Option ' + key + ' is not of the correct type.');\n }\n\n if (this.storedConfigTemplate[key].type === 'action') {\n continue;\n }\n\n const result = this.storedConfigTemplate[key].validate(\n this.definiteConfig[key]\n );\n if (!result[0]) {\n erroredKeys.set(key, result[1]);\n }\n }\n\n for (const key in this.definiteConfig) {\n if (this.storedConfigTemplate[key] === undefined) {\n // remove the key from the definite config\n delete this.definiteConfig[key];\n console.warn(\n 'Option ' +\n key +\n ' is not defined in the configuration template. Removing from config.'\n );\n }\n }\n\n if (erroredKeys.size > 0) {\n return [false, Object.fromEntries(erroredKeys)];\n }\n\n return [true, Object.fromEntries(erroredKeys)];\n }\n\n getStringValue(optionName: string): string {\n if (\n this.definiteConfig[optionName] === null ||\n this.definiteConfig[optionName] === undefined\n ) {\n throw new Error('Option ' + optionName + ' is not defined');\n }\n if (typeof this.definiteConfig[optionName] !== 'string') {\n throw new Error('Option ' + optionName + ' is not a string');\n }\n return this.definiteConfig[optionName];\n }\n\n getNumberValue(optionName: string): number {\n if (\n this.definiteConfig[optionName] === null ||\n this.definiteConfig[optionName] === undefined\n ) {\n throw new Error('Option ' + optionName + ' is not defined');\n }\n if (typeof this.definiteConfig[optionName] !== 'number') {\n throw new Error('Option ' + optionName + ' is not a number');\n }\n return this.definiteConfig[optionName];\n }\n\n getBooleanValue(optionName: string): boolean {\n if (\n this.definiteConfig[optionName] === null ||\n this.definiteConfig[optionName] === undefined\n ) {\n throw new Error('Option ' + optionName + ' is not defined');\n }\n if (typeof this.definiteConfig[optionName] !== 'boolean') {\n throw new Error('Option ' + optionName + ' is not a boolean');\n }\n return this.definiteConfig[optionName];\n }\n}\n\nexport {\n ConfigurationBuilder,\n BooleanOption,\n ConfigurationOption,\n NumberOption,\n StringOption,\n ActionOption,\n isBooleanOption,\n isNumberOption,\n isStringOption,\n isActionOption,\n};\n\nexport type { ConfigurationFile, ConfigurationOptionType };\n"],"mappings":";;;AAoBA,IAAa,gBAAb,MAA2B;CACzB,AAAS;CACT,iBAAiC,EAAE;CACnC,YAAY,gBAAmC;AAC7C,OAAK,uBAAuB;;CAG9B,aACE,QACA,WAAoB,MACkB;AACtC,OAAK,iBAAiB;AACtB,MAAI,SAEF,QADe,KAAK,gBAAgB;AAGtC,SAAO,CAAC,MAAM,EAAE,CAAC;;CAGnB,AAAQ,iBAAuD;EAC7D,MAAM,8BAAc,IAAI,KAAqB;AAC7C,OAAK,MAAM,OAAO,KAAK,sBAAsB;AAC3C,OACE,KAAK,qBAAqB,KAAK,SAAS,aACvC,KAAK,eAAe,SAAS,QAC5B,KAAK,eAAe,SAAS,SAC/B;AACA,YAAQ,KACN,YACE,MACA,iDACA,KAAK,qBAAqB,KAAK,aAClC;AACD,SAAK,eAAe,OAAO,KAAK,qBAAqB,KAClD;;AAEL,OACE,KAAK,qBAAqB,KAAK,SAAS,YACxC,KAAK,qBAAqB,KAAK,SAAS,OAAO,KAAK,eAAe,KAEn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"sourcesContent":["import {\n ConfigurationBuilder,\n BooleanOption,\n ConfigurationOption,\n NumberOption,\n StringOption,\n ActionOption,\n isBooleanOption,\n isNumberOption,\n isStringOption,\n isActionOption,\n} from './ConfigurationBuilder';\nimport type {\n ConfigurationFile,\n ConfigurationOptionType,\n} from './ConfigurationBuilder';\n\ninterface DefiniteConfig {\n [key: string]: string | number | boolean;\n}\nexport class Configuration {\n readonly storedConfigTemplate: ConfigurationFile;\n definiteConfig: DefiniteConfig = {};\n constructor(configTemplate: ConfigurationFile) {\n this.storedConfigTemplate = configTemplate;\n }\n\n updateConfig(\n config: DefiniteConfig,\n validate: boolean = true\n ): [boolean, { [key: string]: string }] {\n this.definiteConfig = config;\n if (validate) {\n const result = this.validateConfig();\n return result;\n }\n return [true, {}];\n }\n // provides falsey or truthy value, and an error message if falsey\n private validateConfig(): [boolean, { [key: string]: string }] {\n const erroredKeys = new Map<string, string>();\n for (const key in this.storedConfigTemplate) {\n if (\n this.storedConfigTemplate[key].type !== 'action' &&\n (this.definiteConfig[key] === null ||\n this.definiteConfig[key] === undefined)\n ) {\n console.warn(\n 'Option ' +\n key +\n ' is not defined. Using default value Value: ' +\n this.storedConfigTemplate[key].defaultValue\n );\n this.definiteConfig[key] = this.storedConfigTemplate[key]\n .defaultValue as string | number | boolean;\n }\n if (\n this.storedConfigTemplate[key].type !== 'action' &&\n this.storedConfigTemplate[key].type !== typeof this.definiteConfig[key]\n ) {\n throw new Error('Option ' + key + ' is not of the correct type.');\n }\n\n if (this.storedConfigTemplate[key].type === 'action') {\n continue;\n }\n\n const result = this.storedConfigTemplate[key].validate(\n this.definiteConfig[key]\n );\n if (!result[0]) {\n erroredKeys.set(key, result[1]);\n }\n }\n\n for (const key in this.definiteConfig) {\n if (this.storedConfigTemplate[key] === undefined) {\n // remove the key from the definite config\n delete this.definiteConfig[key];\n console.warn(\n 'Option ' +\n key +\n ' is not defined in the configuration template. Removing from config.'\n );\n }\n }\n\n if (erroredKeys.size > 0) {\n return [false, Object.fromEntries(erroredKeys)];\n }\n\n return [true, Object.fromEntries(erroredKeys)];\n }\n\n getStringValue(optionName: string): string {\n if (\n this.definiteConfig[optionName] === null ||\n this.definiteConfig[optionName] === undefined\n ) {\n throw new Error('Option ' + optionName + ' is not defined');\n }\n if (typeof this.definiteConfig[optionName] !== 'string') {\n throw new Error('Option ' + optionName + ' is not a string');\n }\n return this.definiteConfig[optionName];\n }\n\n getNumberValue(optionName: string): number {\n if (\n this.definiteConfig[optionName] === null ||\n this.definiteConfig[optionName] === undefined\n ) {\n throw new Error('Option ' + optionName + ' is not defined');\n }\n if (typeof this.definiteConfig[optionName] !== 'number') {\n throw new Error('Option ' + optionName + ' is not a number');\n }\n return this.definiteConfig[optionName];\n }\n\n getBooleanValue(optionName: string): boolean {\n if (\n this.definiteConfig[optionName] === null ||\n this.definiteConfig[optionName] === undefined\n ) {\n throw new Error('Option ' + optionName + ' is not defined');\n }\n if (typeof this.definiteConfig[optionName] !== 'boolean') {\n throw new Error('Option ' + optionName + ' is not a boolean');\n }\n return this.definiteConfig[optionName];\n }\n}\n\nexport {\n ConfigurationBuilder,\n BooleanOption,\n ConfigurationOption,\n NumberOption,\n StringOption,\n ActionOption,\n isBooleanOption,\n isNumberOption,\n isStringOption,\n isActionOption,\n};\n\nexport type { ConfigurationFile, ConfigurationOptionType };\n"],"mappings":";;;;AAoBA,IAAa,gBAAb,MAA2B;CACzB,AAAS;CACT,iBAAiC,EAAE;CACnC,YAAY,gBAAmC;AAC7C,OAAK,uBAAuB;;CAG9B,aACE,QACA,WAAoB,MACkB;AACtC,OAAK,iBAAiB;AACtB,MAAI,SAEF,QADe,KAAK,gBAAgB;AAGtC,SAAO,CAAC,MAAM,EAAE,CAAC;;CAGnB,AAAQ,iBAAuD;EAC7D,MAAM,8BAAc,IAAI,KAAqB;AAC7C,OAAK,MAAM,OAAO,KAAK,sBAAsB;AAC3C,OACE,KAAK,qBAAqB,KAAK,SAAS,aACvC,KAAK,eAAe,SAAS,QAC5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gBAAgB,OAEpC,OAAM,IAAI,MAAM,YAAY,aAAa,kBAAkB;AAE7D,MAAI,OAAO,KAAK,eAAe,gBAAgB,UAC7C,OAAM,IAAI,MAAM,YAAY,aAAa,oBAAoB;AAE/D,SAAO,KAAK,eAAe"}
@@ -1,3 +1,21 @@
1
- import { a as ConfigurationOption, c as StringOption, d as isNumberOption, f as isStringOption, i as ConfigurationFile, l as isActionOption, n as BooleanOption, o as ConfigurationOptionType, r as ConfigurationBuilder, s as NumberOption, t as ActionOption, u as isBooleanOption } from "../ConfigurationBuilder-C83EP5v2.cjs";
2
- import { t as Configuration } from "../Configuration-DdkCGFMU.cjs";
3
- export { ActionOption, BooleanOption, Configuration, ConfigurationBuilder, ConfigurationFile, ConfigurationOption, ConfigurationOptionType, NumberOption, StringOption, isActionOption, isBooleanOption, isNumberOption, isStringOption };
1
+ import { ActionOption, BooleanOption, ConfigurationBuilder, ConfigurationFile, ConfigurationOption, ConfigurationOptionType, NumberOption, StringOption, isActionOption, isBooleanOption, isNumberOption, isStringOption } from "./ConfigurationBuilder.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 { ActionOption, BooleanOption, Configuration, ConfigurationBuilder, type ConfigurationFile, ConfigurationOption, type ConfigurationOptionType, NumberOption, StringOption, isActionOption, isBooleanOption, isNumberOption, isStringOption };
21
+ //# sourceMappingURL=Configuration.d.cts.map
@@ -1,3 +1,21 @@
1
- import { a as ConfigurationOption, c as StringOption, d as isNumberOption, f as isStringOption, i as ConfigurationFile, l as isActionOption, n as BooleanOption, o as ConfigurationOptionType, r as ConfigurationBuilder, s as NumberOption, t as ActionOption, u as isBooleanOption } from "../ConfigurationBuilder-lzKf9gHw.mjs";
2
- import { t as Configuration } from "../Configuration-fDtr2bmH.mjs";
3
- export { ActionOption, BooleanOption, Configuration, ConfigurationBuilder, ConfigurationFile, ConfigurationOption, ConfigurationOptionType, NumberOption, StringOption, isActionOption, isBooleanOption, isNumberOption, isStringOption };
1
+ import { ActionOption, BooleanOption, ConfigurationBuilder, ConfigurationFile, ConfigurationOption, ConfigurationOptionType, NumberOption, StringOption, isActionOption, isBooleanOption, isNumberOption, isStringOption } from "./ConfigurationBuilder.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 { ActionOption, BooleanOption, Configuration, ConfigurationBuilder, type ConfigurationFile, ConfigurationOption, type ConfigurationOptionType, NumberOption, StringOption, isActionOption, isBooleanOption, isNumberOption, isStringOption };
21
+ //# sourceMappingURL=Configuration.d.mts.map