@bemoje/cli 0.0.2 → 0.0.3
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/index.cjs.js +2338 -1764
- package/index.esm.js +2243 -1659
- package/package.json +5 -3
- package/src/{core/CommandBuilder → arg}/ArgumentBuilder.d.ts +5 -6
- package/src/arg/ArgumentParserSelector.d.ts +8 -0
- package/src/{core/CommandBuilder → arg}/ArgumentReader.d.ts +1 -2
- package/src/arg/ArgumentValidatorSelector.d.ts +7 -0
- package/src/cmd/CLI.d.ts +2 -0
- package/src/cmd/CommandBuilder.d.ts +238 -0
- package/src/cmd/CommandBuilderMetaData.d.ts +23 -0
- package/src/cmd/CommandFeatureSelector.d.ts +79 -0
- package/src/cmd/DefaultHelpConfig.d.ts +2 -0
- package/src/core/OutputManager.d.ts +63 -0
- package/src/{parsers/selector/AbstractStringParserSelector.d.ts → core/ParserSelector.d.ts} +5 -6
- package/src/core/ValidatorSelector.d.ts +16 -0
- package/src/core/counter.d.ts +3 -0
- package/src/db/AbstractJsonFileSection.d.ts +136 -0
- package/src/db/AppDataSection.d.ts +29 -0
- package/src/db/ConfigSection.d.ts +47 -0
- package/src/db/JsonFile.d.ts +35 -0
- package/src/db/PresetsSection.d.ts +44 -0
- package/src/index.d.ts +102 -112
- package/src/opt/OptionArgumentParserSelector.d.ts +7 -0
- package/src/opt/OptionArgumentValidatorSelector.d.ts +7 -0
- package/src/{core/CommandBuilder → opt}/OptionBuilder.d.ts +6 -5
- package/src/opt/OptionHelpers.d.ts +32 -0
- package/src/{core/CommandBuilder → opt}/OptionReader.d.ts +2 -3
- package/src/proto/overrideCommanderPrototype.d.ts +8 -0
- package/src/types/IConfig.d.ts +21 -0
- package/src/types/IPreset.d.ts +6 -7
- package/src/util/array/arrLast.d.ts +12 -0
- package/src/util/array/arrSome.d.ts +15 -0
- package/src/util/array/types/ArrayPredicate.d.ts +10 -0
- package/src/util/db/JsonDB.d.ts +65 -0
- package/src/util/fs/promptUserEditInTextEditor/IGetUserInputFromEditorOptions.d.ts +15 -0
- package/src/util/fs/promptUserEditInTextEditor/promptUserEditInTextEditorSync.d.ts +9 -0
- package/src/util/fs/promptUserEditInTextEditor/promptUserEditJsonInTextEditorSync.d.ts +13 -0
- package/src/util/fs/readFile/readFileSafeSync.d.ts +13 -0
- package/src/util/fs/readFile/readFileSync.d.ts +10 -0
- package/src/util/fs/readJsonFile/readJsonFileSafeSync.d.ts +9 -0
- package/src/util/fs/removeFile/removeFile.d.ts +1 -0
- package/src/util/fs/tempFile/tempFileSync.d.ts +7 -0
- package/src/util/fs/types/IReadJsonFileOptions.d.ts +1 -0
- package/src/util/fs/writeFile/writeFileSafeSync.d.ts +1 -0
- package/src/util/fs/writeFile/writeFileSync.d.ts +1 -0
- package/src/util/fs/writeJsonFile/writeJsonFileSafe.d.ts +1 -0
- package/src/{core/util → util/function}/MethodDisabler.d.ts +4 -3
- package/src/util/function/funSetName.d.ts +13 -0
- package/src/util/node/execInherit.d.ts +1 -0
- package/src/{core/util → util/object}/createArrayMerger.d.ts +3 -0
- package/src/{core/util → util/object}/createObjectMerger.d.ts +4 -1
- package/src/util/object/objUpdatePropertyDescriptors.d.ts +16 -0
- package/src/util/object/setNonEnumerable.d.ts +15 -0
- package/src/util/os/defaultOpenInEditorCommand.d.ts +5 -0
- package/src/util/os/isOSX.d.ts +6 -0
- package/src/util/os/isVsCodeInstalled.d.ts +5 -0
- package/src/util/os/isWindows.d.ts +8 -0
- package/src/util/path/getTempDataPath.d.ts +6 -0
- package/src/util/regex/regexEscapeString.d.ts +11 -0
- package/src/util/string/strEnsureStartsWith.d.ts +12 -0
- package/src/util/string/strFirstCharToUpperCase.d.ts +9 -0
- package/src/util/string/strIsLowerCase.d.ts +11 -0
- package/src/util/string/strIsUpperCase.d.ts +11 -0
- package/src/util/string/strSplitCamelCase.d.ts +11 -0
- package/src/util/types/Any.d.ts +1 -0
- package/src/util/types/DeepArray.d.ts +10 -0
- package/src/util/types/DeepObject.d.ts +14 -0
- package/src/util/types/JsonArray.d.ts +6 -0
- package/src/util/types/JsonDefinedPrimitive.d.ts +4 -0
- package/src/util/types/JsonObject.d.ts +6 -0
- package/src/util/types/JsonRawPrimitive.d.ts +5 -0
- package/src/util/types/JsonValue.d.ts +7 -0
- package/src/util/types/ObjectKey.d.ts +1 -0
- package/src/util/types/TConstructor.d.ts +5 -0
- package/src/util/types/TFunction.d.ts +4 -0
- package/src/util/types/TFunctionNoNew.d.ts +2 -0
- package/src/util/types/TPlainObject.d.ts +2 -0
- package/src/util/types/TPrimitive.d.ts +1 -0
- package/src/util/types/TValidator.d.ts +1 -0
- package/src/{validators → util/validation}/createTypedArrayValidator.d.ts +1 -3
- package/src/util/validation/ensureThat.d.ts +6 -0
- package/src/util/validation/isFunction.d.ts +11 -0
- package/src/{validators → util/validation}/isNamedFunction.d.ts +1 -1
- package/src/util/validation/isObject.d.ts +15 -0
- package/src/util/validation/isPlainObject.d.ts +6 -0
- package/src/util/validation/isPrimitive.d.ts +12 -0
- package/src/util/validation/numbers/isInteger.d.ts +13 -0
- package/src/util/validation/numbers/isValidNumber.d.ts +15 -0
- package/src/core/CommandBuilder/Base.d.ts +0 -5
- package/src/core/CommandBuilder/CommandBuilder.d.ts +0 -80
- package/src/core/CommandBuilder/CommandBuilder.example.d.ts +0 -1
- package/src/core/CommandBuilder/CommandBuilderMetaData.d.ts +0 -17
- package/src/core/CommandBuilder/CommandFeatureSelector.d.ts +0 -26
- package/src/core/CommandBuilder/OutputManager.d.ts +0 -47
- package/src/core/CommandBuilder/assertCommandNameNotReserved.d.ts +0 -1
- package/src/core/CommandBuilder/ensureBackRefToCommandBuilder.d.ts +0 -7
- package/src/core/CommandBuilder/features/action/actionWrapper.d.ts +0 -5
- package/src/core/CommandBuilder/features/action/combineVariadicArgs.d.ts +0 -3
- package/src/core/CommandBuilder/features/action/debugLogArgsOpts.d.ts +0 -4
- package/src/core/CommandBuilder/features/action/deleteOptionsWithDefaultOrNoValue.d.ts +0 -3
- package/src/core/CommandBuilder/features/action/getPresetArgsAndOpts.d.ts +0 -3
- package/src/core/CommandBuilder/features/action/handleError.d.ts +0 -2
- package/src/core/CommandBuilder/features/action/handleOutputOptions.d.ts +0 -2
- package/src/core/CommandBuilder/features/action/optsWithGlobalsParsed.d.ts +0 -2
- package/src/core/CommandBuilder/features/action/padArgsWithUndefinedUntilExpectedLength.d.ts +0 -3
- package/src/core/CommandBuilder/features/action/parseArguments.d.ts +0 -2
- package/src/core/CommandBuilder/features/action/parseOptions.d.ts +0 -6
- package/src/core/CommandBuilder/features/action/parsedValidArgsOptsWithPresets.d.ts +0 -2
- package/src/core/CommandBuilder/features/action/parsedValidArgsWithPresets.d.ts +0 -2
- package/src/core/CommandBuilder/features/action/parsedValidOptsWithPresets.d.ts +0 -3
- package/src/core/CommandBuilder/features/addConfigCommands.d.ts +0 -3
- package/src/core/CommandBuilder/features/addPresetsCommands.d.ts +0 -3
- package/src/core/CommandBuilder/features/addUtilCommands.d.ts +0 -2
- package/src/core/CommandBuilder/features/assertNoDuplicateCommandNames.d.ts +0 -2
- package/src/core/CommandBuilder/features/assertNoDuplicateOptionNames.d.ts +0 -2
- package/src/core/CommandBuilder/features/autoAssignMissingOptionFlags.d.ts +0 -14
- package/src/core/CommandBuilder/features/autoAssignSubCommandAliases.d.ts +0 -13
- package/src/core/CommandBuilder/features/getClosestNonNativeParent.d.ts +0 -2
- package/src/core/CommandBuilder/getGlobalOptions.d.ts +0 -3
- package/src/core/CommandBuilder/getOwnAndGlobalOptions.d.ts +0 -3
- package/src/core/CommandBuilder/initializeCommand.d.ts +0 -2
- package/src/core/db/AbstractJsonFileSection.d.ts +0 -45
- package/src/core/db/ConfigSection.d.ts +0 -19
- package/src/core/db/JsonDB.d.ts +0 -19
- package/src/core/db/JsonFile.d.ts +0 -25
- package/src/core/db/JsonFileError.d.ts +0 -6
- package/src/core/db/PresetsSection.d.ts +0 -14
- package/src/core/help/configureHelp.d.ts +0 -2
- package/src/core/util/assertPresetArgsOptional.d.ts +0 -3
- package/src/core/util/assertValidArguments.d.ts +0 -6
- package/src/core/util/assertValidOptions.d.ts +0 -6
- package/src/core/util/assertValidPreset.d.ts +0 -3
- package/src/core/util/commandExists.d.ts +0 -5
- package/src/core/util/commandLocation.d.ts +0 -5
- package/src/core/util/errorToString.d.ts +0 -1
- package/src/core/util/escapeShellCommandArgument.d.ts +0 -5
- package/src/core/util/forEachChildRecursive.d.ts +0 -4
- package/src/core/util/getARGV.d.ts +0 -1
- package/src/core/util/getAncestors.d.ts +0 -7
- package/src/core/util/getChildren.d.ts +0 -4
- package/src/core/util/getJsonFilepath.d.ts +0 -2
- package/src/core/util/getOptionArgumentName.d.ts +0 -5
- package/src/core/util/getRootCommand.d.ts +0 -5
- package/src/core/util/getSiblings.d.ts +0 -5
- package/src/core/util/hasVariadicArguments.d.ts +0 -5
- package/src/core/util/objDestroy.d.ts +0 -2
- package/src/core/util/optHasArgument.d.ts +0 -2
- package/src/core/util/prefixArray.d.ts +0 -5
- package/src/core/util/prefixString.d.ts +0 -5
- package/src/core/util/prefixStringsRecursive.d.ts +0 -5
- package/src/core/util/renderOptionFlags.d.ts +0 -6
- package/src/core/util/setOptionLongName.d.ts +0 -6
- package/src/core/util/setOptionShortName.d.ts +0 -6
- package/src/core/util/walkAncestors.d.ts +0 -7
- package/src/core/util/walkChildren.d.ts +0 -4
- package/src/core/util/walkSiblings.d.ts +0 -5
- package/src/parsers/createTupleListParser.d.ts +0 -11
- package/src/parsers/selector/ArgumentParserSelector.d.ts +0 -7
- package/src/parsers/selector/OptionArgumentParserSelector.d.ts +0 -7
- package/src/types/IDefinePropertyOptions.d.ts +0 -9
- package/src/types/IPresets.d.ts +0 -6
- package/src/types/TValidator.d.ts +0 -2
- package/src/validators/createLengthValidator.d.ts +0 -7
- package/src/validators/isInteger.d.ts +0 -1
- package/src/validators/isIntegerArray.d.ts +0 -4
- package/src/validators/isNull.d.ts +0 -1
- package/src/validators/isNumber.d.ts +0 -1
- package/src/validators/isNumberArray.d.ts +0 -4
- package/src/validators/isNumericString.d.ts +0 -1
- package/src/validators/selector/ArgumentValidatorSelector.d.ts +0 -6
- package/src/validators/selector/OptionArgumentValidatorSelector.d.ts +0 -6
- package/src/validators/selector/ValidatorSelector.d.ts +0 -17
- /package/src/core/{util/splitCombinedArgvShorts.d.ts → splitCombinedArgvShorts.d.ts} +0 -0
- /package/src/{core/CommandBuilder → util/errors}/ErrorParser.d.ts +0 -0
- /package/src/{core/CommandBuilder/features → util/node}/formatTableForTerminal.d.ts +0 -0
- /package/src/{core/util → util/object}/arrAssign.d.ts +0 -0
- /package/src/{core/util → util/object}/objAssign.d.ts +0 -0
- /package/src/{core/util → util/object}/realizeLazyProperty.d.ts +0 -0
- /package/src/{parsers → util/string-parsers}/createBooleanParser.d.ts +0 -0
- /package/src/{parsers → util/string-parsers}/createTypedListParser.d.ts +0 -0
- /package/src/{parsers → util/string-parsers}/parseBoolean.d.ts +0 -0
- /package/src/{parsers → util/string-parsers}/parseInteger.d.ts +0 -0
- /package/src/{parsers → util/string-parsers}/parseNumber.d.ts +0 -0
- /package/src/{parsers → util/string-parsers}/parseString.d.ts +0 -0
- /package/src/{types → util/types}/TStringParser.d.ts +0 -0
- /package/src/{validators → util/validation}/isArray.d.ts +0 -0
- /package/src/{validators → util/validation}/isBoolean.d.ts +0 -0
- /package/src/{validators → util/validation}/isNamedFunctionArray.d.ts +0 -0
- /package/src/{validators → util/validation}/isString.d.ts +0 -0
- /package/src/{validators → util/validation}/isStringArray.d.ts +0 -0
- /package/src/{validators → util/validation}/isStringWithNoSpacesOrDashes.d.ts +0 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { AbstractJsonFileSection } from './AbstractJsonFileSection';
|
|
2
|
+
import { JsonFile } from './JsonFile';
|
|
3
|
+
import { JsonValue } from '../util/types/JsonValue';
|
|
4
|
+
/**
|
|
5
|
+
* A class that represents the appdata section of the JSON file used as simple database.
|
|
6
|
+
*/
|
|
7
|
+
export declare class AppDataSection<Val extends JsonValue = JsonValue> extends AbstractJsonFileSection<Val> {
|
|
8
|
+
/**
|
|
9
|
+
* Creates an instance of AppDataSection.
|
|
10
|
+
* @param file - The parent JsonFile instance.
|
|
11
|
+
* @param name - The name of the section.
|
|
12
|
+
*/
|
|
13
|
+
constructor(file: JsonFile, name: string);
|
|
14
|
+
/**
|
|
15
|
+
* Does nothing
|
|
16
|
+
*/
|
|
17
|
+
assertValid(): void;
|
|
18
|
+
/**
|
|
19
|
+
* Defines a property for the section.
|
|
20
|
+
* @param key - The key of the property.
|
|
21
|
+
*/
|
|
22
|
+
defineProperty(key: string, value: Val): void;
|
|
23
|
+
/**
|
|
24
|
+
* Initializes the section.
|
|
25
|
+
* @param save - Indicates whether to save the section after initialization.
|
|
26
|
+
* @returns A string if an error occurred during initialization, otherwise void.
|
|
27
|
+
*/
|
|
28
|
+
initialize(save?: boolean): void;
|
|
29
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { AbstractJsonFileSection } from './AbstractJsonFileSection';
|
|
2
|
+
import { IConfig } from '../types/IConfig';
|
|
3
|
+
import { JsonFile } from './JsonFile';
|
|
4
|
+
import { JsonValue } from '../util/types/JsonValue';
|
|
5
|
+
import { TStringParser } from '../util/types/TStringParser';
|
|
6
|
+
import { TValidator } from '../util/types/TValidator';
|
|
7
|
+
/**
|
|
8
|
+
* A class that represents the user-config section of the JSON file used as simple database.
|
|
9
|
+
*/
|
|
10
|
+
export declare class ConfigSection<Val extends JsonValue = JsonValue> extends AbstractJsonFileSection<Val> {
|
|
11
|
+
/**
|
|
12
|
+
* String parsers for when editing config from command-line.
|
|
13
|
+
*/
|
|
14
|
+
readonly parsers: Record<string, TStringParser<Val>>;
|
|
15
|
+
/**
|
|
16
|
+
* Descriptions for each property key.
|
|
17
|
+
*/
|
|
18
|
+
readonly descriptions: Record<string, string>;
|
|
19
|
+
/**
|
|
20
|
+
* Validators for each property key.
|
|
21
|
+
*/
|
|
22
|
+
readonly validators: Record<string, TValidator<Val>>;
|
|
23
|
+
/**
|
|
24
|
+
* Creates an instance of AbstractJsonFileSection.
|
|
25
|
+
* @param file - The parent JsonFile instance.
|
|
26
|
+
* @param name - The name of the section.
|
|
27
|
+
*/
|
|
28
|
+
constructor(file: JsonFile, name: string);
|
|
29
|
+
/**
|
|
30
|
+
* Asserts that a key-value pair is valid.
|
|
31
|
+
* @param key - The key to assert.
|
|
32
|
+
* @param value - The value to assert.
|
|
33
|
+
*/
|
|
34
|
+
assertValid(key: string, value: Val): void;
|
|
35
|
+
/**
|
|
36
|
+
* Defines a property for the section.
|
|
37
|
+
* @param key - The key of the property.
|
|
38
|
+
* @param options - The options for the property.
|
|
39
|
+
*/
|
|
40
|
+
defineProperty(key: string, options: IConfig<Val>): void;
|
|
41
|
+
/**
|
|
42
|
+
* Initializes the section.
|
|
43
|
+
* @param save - Indicates whether to save the section after initialization.
|
|
44
|
+
* @returns A string if an error occurred during initialization, otherwise void.
|
|
45
|
+
*/
|
|
46
|
+
initialize(save?: boolean): void;
|
|
47
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { AppDataSection } from './AppDataSection';
|
|
2
|
+
import { CommandBuilder } from '../cmd/CommandBuilder';
|
|
3
|
+
import { ConfigSection } from './ConfigSection';
|
|
4
|
+
import { JsonDB } from '../util/db/JsonDB';
|
|
5
|
+
import { PresetsSection } from './PresetsSection';
|
|
6
|
+
/**
|
|
7
|
+
* A class that represents the JSON file used as a simple database.
|
|
8
|
+
*/
|
|
9
|
+
export declare class JsonFile {
|
|
10
|
+
readonly cmd: CommandBuilder;
|
|
11
|
+
/**
|
|
12
|
+
* @param cmd The parent CommandBuilder instance.
|
|
13
|
+
*/
|
|
14
|
+
constructor(cmd: CommandBuilder);
|
|
15
|
+
/**
|
|
16
|
+
* A lazy-loaded instance of the JsonDB instance containing the data.
|
|
17
|
+
* Upon first property access, it is stored as a property on the instance.
|
|
18
|
+
* If the command is a subcommand, the root command's JsonDB instance is returned.
|
|
19
|
+
*/
|
|
20
|
+
get db(): JsonDB;
|
|
21
|
+
/**
|
|
22
|
+
* A lazy-loaded instance of the `config` section of the JSON file.
|
|
23
|
+
* Upon first property access, it is stored as a property on the instance.
|
|
24
|
+
*/
|
|
25
|
+
get config(): ConfigSection;
|
|
26
|
+
/**
|
|
27
|
+
* A lazy-loaded instance of the `appData` section of the JSON file.
|
|
28
|
+
* Upon first property access, it is stored as a property on the instance.
|
|
29
|
+
*/
|
|
30
|
+
get appData(): AppDataSection;
|
|
31
|
+
/**
|
|
32
|
+
* A lazy-loaded instance of the `presets` section of the JSON file.
|
|
33
|
+
*/
|
|
34
|
+
get presets(): PresetsSection;
|
|
35
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { AbstractJsonFileSection } from './AbstractJsonFileSection';
|
|
2
|
+
import { IPreset } from '../types/IPreset';
|
|
3
|
+
import { JsonFile } from './JsonFile';
|
|
4
|
+
/**
|
|
5
|
+
* A class that represents the user-presets section of the JSON file used as simple database.
|
|
6
|
+
*/
|
|
7
|
+
export declare class PresetsSection extends AbstractJsonFileSection<IPreset> {
|
|
8
|
+
/**
|
|
9
|
+
* Creates an instance of AppDataSection.
|
|
10
|
+
* @param file - The parent JsonFile instance.
|
|
11
|
+
* @param name - The name of the section.
|
|
12
|
+
*/
|
|
13
|
+
constructor(file: JsonFile, name: string);
|
|
14
|
+
/**
|
|
15
|
+
* Asserts that a key-value pair is valid.
|
|
16
|
+
* @param key - The key to assert.
|
|
17
|
+
* @param value - The preset options to validate.
|
|
18
|
+
*/
|
|
19
|
+
assertValid(key: string, value: IPreset): void;
|
|
20
|
+
/**
|
|
21
|
+
* Defines a property for the section.
|
|
22
|
+
* @param key - The key of the property.
|
|
23
|
+
* @param options - The options for the property.
|
|
24
|
+
*/
|
|
25
|
+
defineProperty(key: string, options: IPreset): void;
|
|
26
|
+
/**
|
|
27
|
+
* Initializes the section.
|
|
28
|
+
* @param save - Indicates whether to save the section after initialization.
|
|
29
|
+
* @returns A string if an error occurred during initialization, otherwise void.
|
|
30
|
+
*/
|
|
31
|
+
initialize(save?: boolean): void;
|
|
32
|
+
/**
|
|
33
|
+
* Sets all the values in the section.
|
|
34
|
+
* @param values - The values to set.
|
|
35
|
+
* @param save - Indicates whether to save the section after setting the values.
|
|
36
|
+
*/
|
|
37
|
+
setAll(presets: typeof this.defaultValues, save?: boolean): Promise<void>;
|
|
38
|
+
/**
|
|
39
|
+
* Deletes the value associated with the specified key.
|
|
40
|
+
* @param key - The key to delete.
|
|
41
|
+
* @param save - Indicates whether to save the section after deleting the value.
|
|
42
|
+
*/
|
|
43
|
+
delete(name: string, save?: boolean): void;
|
|
44
|
+
}
|
package/src/index.d.ts
CHANGED
|
@@ -1,113 +1,103 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export * from './
|
|
3
|
-
export * from './
|
|
4
|
-
export * from './
|
|
5
|
-
export * from './
|
|
6
|
-
export * from './
|
|
7
|
-
export * from './
|
|
8
|
-
export * from './
|
|
9
|
-
export * from './
|
|
10
|
-
export * from './core/
|
|
11
|
-
export * from './core/
|
|
12
|
-
export * from './core/
|
|
13
|
-
export * from './core/
|
|
14
|
-
export * from './core/
|
|
15
|
-
export * from './
|
|
16
|
-
export * from './
|
|
17
|
-
export * from './
|
|
18
|
-
export * from './
|
|
19
|
-
export * from './
|
|
20
|
-
export * from './
|
|
21
|
-
export * from './
|
|
22
|
-
export * from './
|
|
23
|
-
export * from './
|
|
24
|
-
export * from './
|
|
25
|
-
export * from './
|
|
26
|
-
export * from './
|
|
27
|
-
export * from './core/CommandBuilder/features/assertNoDuplicateCommandNames';
|
|
28
|
-
export * from './core/CommandBuilder/features/assertNoDuplicateOptionNames';
|
|
29
|
-
export * from './core/CommandBuilder/features/autoAssignMissingOptionFlags';
|
|
30
|
-
export * from './core/CommandBuilder/features/autoAssignSubCommandAliases';
|
|
31
|
-
export * from './core/CommandBuilder/features/formatTableForTerminal';
|
|
32
|
-
export * from './core/CommandBuilder/features/getClosestNonNativeParent';
|
|
33
|
-
export * from './core/CommandBuilder/getGlobalOptions';
|
|
34
|
-
export * from './core/CommandBuilder/getOwnAndGlobalOptions';
|
|
35
|
-
export * from './core/CommandBuilder/initializeCommand';
|
|
36
|
-
export * from './core/CommandBuilder/OptionBuilder';
|
|
37
|
-
export * from './core/CommandBuilder/OptionReader';
|
|
38
|
-
export * from './core/CommandBuilder/OutputManager';
|
|
39
|
-
export * from './core/db/AbstractJsonFileSection';
|
|
40
|
-
export * from './core/db/ConfigSection';
|
|
41
|
-
export * from './core/db/JsonDB';
|
|
42
|
-
export * from './core/db/JsonFile';
|
|
43
|
-
export * from './core/db/JsonFileError';
|
|
44
|
-
export * from './core/db/PresetsSection';
|
|
45
|
-
export * from './core/help/configureHelp';
|
|
46
|
-
export * from './core/util/arrAssign';
|
|
47
|
-
export * from './core/util/assertPresetArgsOptional';
|
|
48
|
-
export * from './core/util/assertValidArguments';
|
|
49
|
-
export * from './core/util/assertValidOptions';
|
|
50
|
-
export * from './core/util/assertValidPreset';
|
|
51
|
-
export * from './core/util/commandExists';
|
|
52
|
-
export * from './core/util/commandLocation';
|
|
53
|
-
export * from './core/util/createArrayMerger';
|
|
54
|
-
export * from './core/util/createObjectMerger';
|
|
55
|
-
export * from './core/util/errorToString';
|
|
56
|
-
export * from './core/util/escapeShellCommandArgument';
|
|
57
|
-
export * from './core/util/forEachChildRecursive';
|
|
58
|
-
export * from './core/util/getAncestors';
|
|
59
|
-
export * from './core/util/getARGV';
|
|
60
|
-
export * from './core/util/getChildren';
|
|
61
|
-
export * from './core/util/getJsonFilepath';
|
|
62
|
-
export * from './core/util/getOptionArgumentName';
|
|
63
|
-
export * from './core/util/getRootCommand';
|
|
64
|
-
export * from './core/util/getSiblings';
|
|
65
|
-
export * from './core/util/hasVariadicArguments';
|
|
66
|
-
export * from './core/util/MethodDisabler';
|
|
67
|
-
export * from './core/util/objAssign';
|
|
68
|
-
export * from './core/util/objDestroy';
|
|
69
|
-
export * from './core/util/optHasArgument';
|
|
70
|
-
export * from './core/util/prefixArray';
|
|
71
|
-
export * from './core/util/prefixString';
|
|
72
|
-
export * from './core/util/prefixStringsRecursive';
|
|
73
|
-
export * from './core/util/realizeLazyProperty';
|
|
74
|
-
export * from './core/util/renderOptionFlags';
|
|
75
|
-
export * from './core/util/setOptionLongName';
|
|
76
|
-
export * from './core/util/setOptionShortName';
|
|
77
|
-
export * from './core/util/splitCombinedArgvShorts';
|
|
78
|
-
export * from './core/util/walkAncestors';
|
|
79
|
-
export * from './core/util/walkChildren';
|
|
80
|
-
export * from './core/util/walkSiblings';
|
|
81
|
-
export * from './parsers/createBooleanParser';
|
|
82
|
-
export * from './parsers/createTupleListParser';
|
|
83
|
-
export * from './parsers/createTypedListParser';
|
|
84
|
-
export * from './parsers/parseBoolean';
|
|
85
|
-
export * from './parsers/parseInteger';
|
|
86
|
-
export * from './parsers/parseNumber';
|
|
87
|
-
export * from './parsers/parseString';
|
|
88
|
-
export * from './parsers/selector/AbstractStringParserSelector';
|
|
89
|
-
export * from './parsers/selector/ArgumentParserSelector';
|
|
90
|
-
export * from './parsers/selector/OptionArgumentParserSelector';
|
|
91
|
-
export * from './types/IDefinePropertyOptions';
|
|
1
|
+
export * from './arg/ArgumentBuilder';
|
|
2
|
+
export * from './arg/ArgumentParserSelector';
|
|
3
|
+
export * from './arg/ArgumentReader';
|
|
4
|
+
export * from './arg/ArgumentValidatorSelector';
|
|
5
|
+
export * from './cmd/CLI';
|
|
6
|
+
export * from './cmd/CommandBuilder';
|
|
7
|
+
export * from './cmd/CommandBuilderMetaData';
|
|
8
|
+
export * from './cmd/CommandFeatureSelector';
|
|
9
|
+
export * from './cmd/DefaultHelpConfig';
|
|
10
|
+
export * from './core/counter';
|
|
11
|
+
export * from './core/OutputManager';
|
|
12
|
+
export * from './core/ParserSelector';
|
|
13
|
+
export * from './core/splitCombinedArgvShorts';
|
|
14
|
+
export * from './core/ValidatorSelector';
|
|
15
|
+
export * from './db/AbstractJsonFileSection';
|
|
16
|
+
export * from './db/AppDataSection';
|
|
17
|
+
export * from './db/ConfigSection';
|
|
18
|
+
export * from './db/JsonFile';
|
|
19
|
+
export * from './db/PresetsSection';
|
|
20
|
+
export * from './opt/OptionArgumentParserSelector';
|
|
21
|
+
export * from './opt/OptionArgumentValidatorSelector';
|
|
22
|
+
export * from './opt/OptionBuilder';
|
|
23
|
+
export * from './opt/OptionHelpers';
|
|
24
|
+
export * from './opt/OptionReader';
|
|
25
|
+
export * from './proto/overrideCommanderPrototype';
|
|
26
|
+
export * from './types/IConfig';
|
|
92
27
|
export * from './types/IPreset';
|
|
93
|
-
export * from './
|
|
94
|
-
export * from './
|
|
95
|
-
export * from './types/
|
|
96
|
-
export * from './
|
|
97
|
-
export * from './
|
|
98
|
-
export * from './
|
|
99
|
-
export * from './
|
|
100
|
-
export * from './
|
|
101
|
-
export * from './
|
|
102
|
-
export * from './
|
|
103
|
-
export * from './
|
|
104
|
-
export * from './
|
|
105
|
-
export * from './
|
|
106
|
-
export * from './
|
|
107
|
-
export * from './
|
|
108
|
-
export * from './
|
|
109
|
-
export * from './
|
|
110
|
-
export * from './
|
|
111
|
-
export * from './
|
|
112
|
-
export * from './
|
|
113
|
-
export * from './
|
|
28
|
+
export * from './util/array/arrLast';
|
|
29
|
+
export * from './util/array/arrSome';
|
|
30
|
+
export * from './util/array/types/ArrayPredicate';
|
|
31
|
+
export * from './util/db/JsonDB';
|
|
32
|
+
export * from './util/errors/ErrorParser';
|
|
33
|
+
export * from './util/fs/promptUserEditInTextEditor/IGetUserInputFromEditorOptions';
|
|
34
|
+
export * from './util/fs/promptUserEditInTextEditor/promptUserEditInTextEditorSync';
|
|
35
|
+
export * from './util/fs/promptUserEditInTextEditor/promptUserEditJsonInTextEditorSync';
|
|
36
|
+
export * from './util/fs/readFile/readFileSafeSync';
|
|
37
|
+
export * from './util/fs/readFile/readFileSync';
|
|
38
|
+
export * from './util/fs/readJsonFile/readJsonFileSafeSync';
|
|
39
|
+
export * from './util/fs/removeFile/removeFile';
|
|
40
|
+
export * from './util/fs/tempFile/tempFileSync';
|
|
41
|
+
export * from './util/fs/types/IReadJsonFileOptions';
|
|
42
|
+
export * from './util/fs/writeFile/writeFileSafeSync';
|
|
43
|
+
export * from './util/fs/writeFile/writeFileSync';
|
|
44
|
+
export * from './util/fs/writeJsonFile/writeJsonFileSafe';
|
|
45
|
+
export * from './util/function/funSetName';
|
|
46
|
+
export * from './util/function/MethodDisabler';
|
|
47
|
+
export * from './util/node/execInherit';
|
|
48
|
+
export * from './util/node/formatTableForTerminal';
|
|
49
|
+
export * from './util/object/arrAssign';
|
|
50
|
+
export * from './util/object/createArrayMerger';
|
|
51
|
+
export * from './util/object/createObjectMerger';
|
|
52
|
+
export * from './util/object/objAssign';
|
|
53
|
+
export * from './util/object/objUpdatePropertyDescriptors';
|
|
54
|
+
export * from './util/object/realizeLazyProperty';
|
|
55
|
+
export * from './util/object/setNonEnumerable';
|
|
56
|
+
export * from './util/os/defaultOpenInEditorCommand';
|
|
57
|
+
export * from './util/os/isOSX';
|
|
58
|
+
export * from './util/os/isVsCodeInstalled';
|
|
59
|
+
export * from './util/os/isWindows';
|
|
60
|
+
export * from './util/path/getTempDataPath';
|
|
61
|
+
export * from './util/regex/regexEscapeString';
|
|
62
|
+
export * from './util/string/strEnsureStartsWith';
|
|
63
|
+
export * from './util/string/strFirstCharToUpperCase';
|
|
64
|
+
export * from './util/string/strIsLowerCase';
|
|
65
|
+
export * from './util/string/strIsUpperCase';
|
|
66
|
+
export * from './util/string/strSplitCamelCase';
|
|
67
|
+
export * from './util/string-parsers/createBooleanParser';
|
|
68
|
+
export * from './util/string-parsers/createTypedListParser';
|
|
69
|
+
export * from './util/string-parsers/parseBoolean';
|
|
70
|
+
export * from './util/string-parsers/parseInteger';
|
|
71
|
+
export * from './util/string-parsers/parseNumber';
|
|
72
|
+
export * from './util/string-parsers/parseString';
|
|
73
|
+
export * from './util/types/Any';
|
|
74
|
+
export * from './util/types/DeepArray';
|
|
75
|
+
export * from './util/types/DeepObject';
|
|
76
|
+
export * from './util/types/JsonArray';
|
|
77
|
+
export * from './util/types/JsonDefinedPrimitive';
|
|
78
|
+
export * from './util/types/JsonObject';
|
|
79
|
+
export * from './util/types/JsonRawPrimitive';
|
|
80
|
+
export * from './util/types/JsonValue';
|
|
81
|
+
export * from './util/types/ObjectKey';
|
|
82
|
+
export * from './util/types/TConstructor';
|
|
83
|
+
export * from './util/types/TFunction';
|
|
84
|
+
export * from './util/types/TFunctionNoNew';
|
|
85
|
+
export * from './util/types/TPlainObject';
|
|
86
|
+
export * from './util/types/TPrimitive';
|
|
87
|
+
export * from './util/types/TStringParser';
|
|
88
|
+
export * from './util/types/TValidator';
|
|
89
|
+
export * from './util/validation/createTypedArrayValidator';
|
|
90
|
+
export * from './util/validation/ensureThat';
|
|
91
|
+
export * from './util/validation/isArray';
|
|
92
|
+
export * from './util/validation/isBoolean';
|
|
93
|
+
export * from './util/validation/isFunction';
|
|
94
|
+
export * from './util/validation/isNamedFunction';
|
|
95
|
+
export * from './util/validation/isNamedFunctionArray';
|
|
96
|
+
export * from './util/validation/isObject';
|
|
97
|
+
export * from './util/validation/isPlainObject';
|
|
98
|
+
export * from './util/validation/isPrimitive';
|
|
99
|
+
export * from './util/validation/isString';
|
|
100
|
+
export * from './util/validation/isStringArray';
|
|
101
|
+
export * from './util/validation/isStringWithNoSpacesOrDashes';
|
|
102
|
+
export * from './util/validation/numbers/isInteger';
|
|
103
|
+
export * from './util/validation/numbers/isValidNumber';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { OptionBuilder } from './OptionBuilder';
|
|
2
|
+
import { ParserSelector } from '../core/ParserSelector';
|
|
3
|
+
import { TStringParser } from '../util/types/TStringParser';
|
|
4
|
+
export declare class OptionArgumentParserSelector extends ParserSelector<OptionBuilder> {
|
|
5
|
+
constructor(builder: OptionBuilder);
|
|
6
|
+
custom<T>(parser: TStringParser<T>): OptionBuilder;
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { OptionBuilder } from './OptionBuilder';
|
|
2
|
+
import { TValidator } from '../util/types/TValidator';
|
|
3
|
+
import { ValidatorSelector } from '../core/ValidatorSelector';
|
|
4
|
+
export declare class OptionArgumentValidatorSelector extends ValidatorSelector<OptionBuilder> {
|
|
5
|
+
constructor(builder: OptionBuilder);
|
|
6
|
+
custom<O>(validator: TValidator<O>): OptionBuilder;
|
|
7
|
+
}
|
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { CommandBuilder } from './CommandBuilder';
|
|
1
|
+
import { CommandBuilder } from '../cmd/CommandBuilder';
|
|
3
2
|
import { Option, OptionValues } from 'commander';
|
|
4
|
-
import { OptionArgumentParserSelector } from '
|
|
5
|
-
import { OptionArgumentValidatorSelector } from '
|
|
3
|
+
import { OptionArgumentParserSelector } from './OptionArgumentParserSelector';
|
|
4
|
+
import { OptionArgumentValidatorSelector } from './OptionArgumentValidatorSelector';
|
|
6
5
|
import { OptionReader } from './OptionReader';
|
|
7
6
|
/**
|
|
8
7
|
* Wrapper around the @see Option class, for more intuitive construction.
|
|
9
8
|
* @remarks Options are one of boolean, negated, required argument, or optional argument.
|
|
10
9
|
*/
|
|
11
|
-
export declare class OptionBuilder
|
|
10
|
+
export declare class OptionBuilder {
|
|
12
11
|
readonly cmd: CommandBuilder;
|
|
13
12
|
readonly $: Option;
|
|
14
13
|
constructor(cmd: CommandBuilder, flags: string);
|
|
15
14
|
description(string: string): this;
|
|
15
|
+
mandatory(mandatory?: boolean): this;
|
|
16
16
|
hideHelp(hide?: boolean): this;
|
|
17
17
|
hidden(hidden?: boolean): this;
|
|
18
|
+
preset(arg: unknown): this;
|
|
18
19
|
default(value: unknown, description?: string): this;
|
|
19
20
|
choices(values: readonly string[]): this;
|
|
20
21
|
conflicts(names: string | string[]): this;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Option } from 'commander';
|
|
2
|
+
/**
|
|
3
|
+
* Extract the argument name from an option's 'flags' string.
|
|
4
|
+
*/
|
|
5
|
+
declare function getArgumentName(opt: Option): string | undefined;
|
|
6
|
+
/**
|
|
7
|
+
* Check if an option has an argument.
|
|
8
|
+
*/
|
|
9
|
+
declare function hasArgument(opt: Option): boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Update an Option's 'flags' property from its 'short' and 'long' properties.
|
|
12
|
+
* The flags property is not automatically updated when 'short' or 'long' are changed.
|
|
13
|
+
*/
|
|
14
|
+
declare function renderFlags(opt: Option): string;
|
|
15
|
+
/**
|
|
16
|
+
* Set an Option's 'long' name. The 'flags' property is updated accordingly.
|
|
17
|
+
* The '--' prefix is automatically added if not present.
|
|
18
|
+
*/
|
|
19
|
+
declare function setLong(opt: Option, long: string): void;
|
|
20
|
+
/**
|
|
21
|
+
* Set an Option's 'short' name. The 'flags' property is updated accordingly.
|
|
22
|
+
* The '-' prefix is automatically added if not present.
|
|
23
|
+
*/
|
|
24
|
+
declare function setShort(opt: Option, short: string): void;
|
|
25
|
+
export declare const OptionHelpers: {
|
|
26
|
+
getArgumentName: typeof getArgumentName;
|
|
27
|
+
hasArgument: typeof hasArgument;
|
|
28
|
+
renderFlags: typeof renderFlags;
|
|
29
|
+
setLong: typeof setLong;
|
|
30
|
+
setShort: typeof setShort;
|
|
31
|
+
};
|
|
32
|
+
export {};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { Base } from './Base';
|
|
2
1
|
import { OptionBuilder } from './OptionBuilder';
|
|
3
|
-
export declare class OptionReader
|
|
2
|
+
export declare class OptionReader {
|
|
4
3
|
protected readonly parent: OptionBuilder;
|
|
5
4
|
constructor(parent: OptionBuilder);
|
|
6
5
|
get $(): import("commander").Option;
|
|
@@ -12,13 +11,13 @@ export declare class OptionReader extends Base {
|
|
|
12
11
|
get variadic(): boolean;
|
|
13
12
|
get short(): string | undefined;
|
|
14
13
|
get long(): string | undefined;
|
|
14
|
+
get preset(): unknown;
|
|
15
15
|
get default(): any;
|
|
16
16
|
get choices(): string[] | undefined;
|
|
17
17
|
get env(): string | undefined;
|
|
18
18
|
get flags(): string;
|
|
19
19
|
get name(): string;
|
|
20
20
|
get attributeName(): string;
|
|
21
|
-
get fullDescription(): string;
|
|
22
21
|
get defaultValueDescription(): string | undefined;
|
|
23
22
|
get hasArgument(): boolean;
|
|
24
23
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { JsonValue } from '../util/types/JsonValue';
|
|
2
|
+
import { TStringParser } from '../util/types/TStringParser';
|
|
3
|
+
import { TValidator } from '../util/types/TValidator';
|
|
4
|
+
export interface IConfig<Val extends JsonValue> {
|
|
5
|
+
/**
|
|
6
|
+
* The default value of the property.
|
|
7
|
+
*/
|
|
8
|
+
defaultValue: Val;
|
|
9
|
+
/**
|
|
10
|
+
* The description of the property.
|
|
11
|
+
*/
|
|
12
|
+
description: string;
|
|
13
|
+
/**
|
|
14
|
+
* A function that parses a string to the desired type.
|
|
15
|
+
*/
|
|
16
|
+
parse?: TStringParser<Val>;
|
|
17
|
+
/**
|
|
18
|
+
* A function that validates the value.
|
|
19
|
+
*/
|
|
20
|
+
validate?: TValidator<Val>;
|
|
21
|
+
}
|
package/src/types/IPreset.d.ts
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { Any } from '@bemoje/util';
|
|
2
1
|
import { OptionValues } from 'commander';
|
|
3
|
-
export interface IPreset
|
|
2
|
+
export interface IPreset {
|
|
4
3
|
description: string;
|
|
5
4
|
presets: string[];
|
|
6
|
-
args:
|
|
7
|
-
options:
|
|
5
|
+
args: OptionValues[keyof OptionValues][];
|
|
6
|
+
options: OptionValues;
|
|
8
7
|
}
|
|
9
|
-
export interface IPresetPartial
|
|
8
|
+
export interface IPresetPartial {
|
|
10
9
|
description: string;
|
|
11
10
|
presets?: string[];
|
|
12
|
-
args?:
|
|
13
|
-
options?:
|
|
11
|
+
args?: OptionValues[keyof OptionValues][];
|
|
12
|
+
options?: OptionValues;
|
|
14
13
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns the last element of an array.
|
|
3
|
+
* Throws an error if the array is empty.
|
|
4
|
+
* @template T The type of elements in the array.
|
|
5
|
+
* @param array The array to get the last element from.
|
|
6
|
+
* @returns The last element of the array.
|
|
7
|
+
* @throws If the array is empty.
|
|
8
|
+
* @example const numbers = [1, 2, 3, 4, 5];
|
|
9
|
+
* const lastNumber = arrLast(numbers);
|
|
10
|
+
* //=> 5
|
|
11
|
+
*/
|
|
12
|
+
export declare function arrLast<T>(array: T[]): T;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ArrayPredicate } from './types/ArrayPredicate';
|
|
2
|
+
/**
|
|
3
|
+
* Checks if at least one element in the array satisfies the provided predicate.
|
|
4
|
+
* @param predicate The predicate function to apply to each element.
|
|
5
|
+
* @template T The type of elements in the input array.
|
|
6
|
+
* @returns Returns `true` if at least one element in the array passes the test implemented by the provided function, otherwise `false`.
|
|
7
|
+
* @param input The array to check.
|
|
8
|
+
* @example ```ts
|
|
9
|
+
* const numbers = [1, 2, 3, 4, 5];
|
|
10
|
+
* const isEven = (num) => num % 2 === 0;
|
|
11
|
+
* arrSome(numbers, isEven);
|
|
12
|
+
* //=> true
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export declare function arrSome<T>(input: Array<T>, predicate: ArrayPredicate<T>): boolean;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definition for a predicate function that operates on arrays.
|
|
3
|
+
* @remarks This type is useful when you want to create a function that can be used with methods like `Array.prototype.filter`.
|
|
4
|
+
* @typeparam T - The type of elements in the array.
|
|
5
|
+
* @param value - The current element being processed in the array.
|
|
6
|
+
* @param index - The index of the current element being processed in the array.
|
|
7
|
+
* @param array - The array `ArrayPredicate` was called upon.
|
|
8
|
+
* @returns A boolean indicating whether the current element passes the test.
|
|
9
|
+
*/
|
|
10
|
+
export type ArrayPredicate<T> = (value: T, index: number, array: T[]) => boolean;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { JsonObject } from '../types/JsonObject';
|
|
2
|
+
import { JsonValue } from '../types/JsonValue';
|
|
3
|
+
/**
|
|
4
|
+
* Represents a simple JSON file database.
|
|
5
|
+
*/
|
|
6
|
+
export declare class JsonDB {
|
|
7
|
+
protected filepath: string;
|
|
8
|
+
protected indents: number;
|
|
9
|
+
/**
|
|
10
|
+
* The data stored in the JSON database.
|
|
11
|
+
*/
|
|
12
|
+
protected data: JsonObject;
|
|
13
|
+
/**
|
|
14
|
+
* Creates a new instance of the JsonDB class.
|
|
15
|
+
* @param filepath - The filepath where the data file is stored or to be stored.
|
|
16
|
+
*/
|
|
17
|
+
constructor(filepath: string, indents?: number);
|
|
18
|
+
/**
|
|
19
|
+
* Saves the data to the JSON file.
|
|
20
|
+
*/
|
|
21
|
+
save(indents?: number): Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* Sets the filepath of the JSON file.
|
|
24
|
+
* @param filepath - The new filepath.
|
|
25
|
+
*/
|
|
26
|
+
setFilepath(filepath: string, save?: boolean): void;
|
|
27
|
+
/**
|
|
28
|
+
* Sets a value in the JSON database.
|
|
29
|
+
* @param prefix - Object path prefix as dot-separated keys.
|
|
30
|
+
* @param value - The value to set.
|
|
31
|
+
* @param save - Whether to save the data to the JSON file.
|
|
32
|
+
*/
|
|
33
|
+
set(prefix?: string, value?: JsonValue, save?: boolean): void;
|
|
34
|
+
/**
|
|
35
|
+
* Gets a value from the JSON database.
|
|
36
|
+
* @param prefix - Object path prefix as dot-separated keys.
|
|
37
|
+
* @returns The value associated with the key.
|
|
38
|
+
* @throws An error if no entry is found at the specified key.
|
|
39
|
+
*/
|
|
40
|
+
get<T = JsonValue>(prefix?: string): T;
|
|
41
|
+
/**
|
|
42
|
+
* Gets a value from the JSON database safely.
|
|
43
|
+
* @param prefix - Object path prefix as dot-separated keys.
|
|
44
|
+
* @returns The value associated with the key, or undefined if no entry is found.
|
|
45
|
+
*/
|
|
46
|
+
getSafe<T = JsonValue>(prefix?: string): T | undefined;
|
|
47
|
+
/**
|
|
48
|
+
* Checks if a key exists in the JSON database.
|
|
49
|
+
* @param prefix - Object path prefix as dot-separated keys.
|
|
50
|
+
* @returns True if the key exists, false otherwise.
|
|
51
|
+
*/
|
|
52
|
+
has(prefix?: string): boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Deletes a value from the JSON database.
|
|
55
|
+
* @param prefix - Object path prefix as dot-separated keys.
|
|
56
|
+
* @param save - Whether to save the data to the JSON file.
|
|
57
|
+
*/
|
|
58
|
+
delete(prefix?: string, save?: boolean): void;
|
|
59
|
+
/**
|
|
60
|
+
* Creates a deep clone of an object.
|
|
61
|
+
* @param obj - The object to clone.
|
|
62
|
+
* @returns The cloned object.
|
|
63
|
+
*/
|
|
64
|
+
protected cloneDeep<T extends JsonValue>(obj: T): T;
|
|
65
|
+
}
|