@bemoje/cli 0.0.9 → 0.0.10
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/cjs/arg/ArgumentBuilder.js +2 -2
- package/cjs/arg/ArgumentBuilder.js.map +1 -1
- package/cjs/arg/ArgumentValidatorSelector.js +2 -2
- package/cjs/arg/ArgumentValidatorSelector.js.map +1 -1
- package/cjs/cmd/CommandBuilder.js +77 -34
- package/cjs/cmd/CommandBuilder.js.map +1 -1
- package/cjs/cmd/CommandBuilderMetaData.js +2 -2
- package/cjs/cmd/CommandBuilderMetaData.js.map +1 -1
- package/cjs/core/OutputManager.js +4 -4
- package/cjs/core/OutputManager.js.map +1 -1
- package/cjs/core/ParserSelector.js +11 -11
- package/cjs/core/ParserSelector.js.map +1 -1
- package/cjs/core/ValidatorSelector.js +11 -11
- package/cjs/core/ValidatorSelector.js.map +1 -1
- package/cjs/db/AbstractJsonFileSection.js +2 -3
- package/cjs/db/AbstractJsonFileSection.js.map +1 -1
- package/cjs/db/ConfigSection.js +3 -4
- package/cjs/db/ConfigSection.js.map +1 -1
- package/cjs/db/JsonFile.js +5 -6
- package/cjs/db/JsonFile.js.map +1 -1
- package/cjs/db/PresetsSection.js +2 -2
- package/cjs/db/PresetsSection.js.map +1 -1
- package/cjs/index.js +0 -77
- package/cjs/index.js.map +1 -1
- package/cjs/opt/OptionBuilder.js +2 -2
- package/cjs/opt/OptionBuilder.js.map +1 -1
- package/cjs/opt/OptionHelpers.js +5 -5
- package/cjs/opt/OptionHelpers.js.map +1 -1
- package/esm/arg/ArgumentBuilder.js +1 -1
- package/esm/arg/ArgumentBuilder.js.map +1 -1
- package/esm/arg/ArgumentValidatorSelector.js +1 -1
- package/esm/arg/ArgumentValidatorSelector.js.map +1 -1
- package/esm/cmd/CommandBuilder.js +59 -16
- package/esm/cmd/CommandBuilder.js.map +1 -1
- package/esm/cmd/CommandBuilderMetaData.js +1 -1
- package/esm/cmd/CommandBuilderMetaData.js.map +1 -1
- package/esm/core/OutputManager.js +1 -1
- package/esm/core/OutputManager.js.map +1 -1
- package/esm/core/ParserSelector.js +4 -4
- package/esm/core/ParserSelector.js.map +1 -1
- package/esm/core/ValidatorSelector.js +4 -4
- package/esm/core/ValidatorSelector.js.map +1 -1
- package/esm/db/AbstractJsonFileSection.js +1 -2
- package/esm/db/AbstractJsonFileSection.js.map +1 -1
- package/esm/db/ConfigSection.js +1 -2
- package/esm/db/ConfigSection.js.map +1 -1
- package/esm/db/JsonFile.js +1 -2
- package/esm/db/JsonFile.js.map +1 -1
- package/esm/db/PresetsSection.js +1 -1
- package/esm/db/PresetsSection.js.map +1 -1
- package/esm/index.js +0 -77
- package/esm/index.js.map +1 -1
- package/esm/opt/OptionBuilder.js +1 -1
- package/esm/opt/OptionBuilder.js.map +1 -1
- package/esm/opt/OptionHelpers.js +2 -2
- package/esm/opt/OptionHelpers.js.map +1 -1
- package/package.json +1 -1
- package/types/arg/ArgumentParserSelector.d.ts +2 -2
- package/types/arg/ArgumentValidatorSelector.d.ts +1 -1
- package/types/cmd/CommandBuilder.d.ts +38 -4
- package/types/cmd/CommandBuilderMetaData.d.ts +3 -3
- package/types/core/OutputManager.d.ts +2 -2
- package/types/core/ParserSelector.d.ts +2 -2
- package/types/core/ValidatorSelector.d.ts +2 -2
- package/types/db/AbstractJsonFileSection.d.ts +2 -3
- package/types/db/AppDataSection.d.ts +1 -1
- package/types/db/ConfigSection.d.ts +1 -3
- package/types/db/JsonFile.d.ts +1 -1
- package/types/index.d.ts +0 -77
- package/types/opt/OptionArgumentParserSelector.d.ts +1 -1
- package/types/opt/OptionArgumentValidatorSelector.d.ts +1 -1
- package/types/types/IConfig.d.ts +3 -3
- package/types/types/IPreset.d.ts +1 -1
- package/cjs/cmd/asdas.js +0 -27
- package/cjs/cmd/asdas.js.map +0 -1
- package/cjs/util/array/arrLast.js +0 -21
- package/cjs/util/array/arrLast.js.map +0 -1
- package/cjs/util/array/arrSome.js +0 -26
- package/cjs/util/array/arrSome.js.map +0 -1
- package/cjs/util/array/types/ArrayPredicate.js +0 -3
- package/cjs/util/array/types/ArrayPredicate.js.map +0 -1
- package/cjs/util/db/JsonDB.js +0 -145
- package/cjs/util/db/JsonDB.js.map +0 -1
- package/cjs/util/errors/ErrorParser.js +0 -164
- package/cjs/util/errors/ErrorParser.js.map +0 -1
- package/cjs/util/fs/promptUserEditInTextEditor/IGetUserInputFromEditorOptions.js +0 -3
- package/cjs/util/fs/promptUserEditInTextEditor/IGetUserInputFromEditorOptions.js.map +0 -1
- package/cjs/util/fs/promptUserEditInTextEditor/promptUserEditInTextEditorSync.js +0 -32
- package/cjs/util/fs/promptUserEditInTextEditor/promptUserEditInTextEditorSync.js.map +0 -1
- package/cjs/util/fs/promptUserEditInTextEditor/promptUserEditJsonInTextEditorSync.js +0 -25
- package/cjs/util/fs/promptUserEditInTextEditor/promptUserEditJsonInTextEditorSync.js.map +0 -1
- package/cjs/util/fs/readFile/readFileSafeSync.js +0 -28
- package/cjs/util/fs/readFile/readFileSafeSync.js.map +0 -1
- package/cjs/util/fs/readFile/readFileSync.js +0 -20
- package/cjs/util/fs/readFile/readFileSync.js.map +0 -1
- package/cjs/util/fs/readJsonFile/readJsonFileSafeSync.js +0 -24
- package/cjs/util/fs/readJsonFile/readJsonFileSafeSync.js.map +0 -1
- package/cjs/util/fs/removeFile/removeFile.js +0 -6
- package/cjs/util/fs/removeFile/removeFile.js.map +0 -1
- package/cjs/util/fs/tempFile/tempFileSync.js +0 -28
- package/cjs/util/fs/tempFile/tempFileSync.js.map +0 -1
- package/cjs/util/fs/types/IReadJsonFileOptions.js +0 -3
- package/cjs/util/fs/types/IReadJsonFileOptions.js.map +0 -1
- package/cjs/util/fs/writeFile/writeFileSafeSync.js +0 -6
- package/cjs/util/fs/writeFile/writeFileSafeSync.js.map +0 -1
- package/cjs/util/fs/writeFile/writeFileSync.js +0 -6
- package/cjs/util/fs/writeFile/writeFileSync.js.map +0 -1
- package/cjs/util/fs/writeJsonFile/writeJsonFileSafe.js +0 -6
- package/cjs/util/fs/writeJsonFile/writeJsonFileSafe.js.map +0 -1
- package/cjs/util/function/MethodDisabler.js +0 -94
- package/cjs/util/function/MethodDisabler.js.map +0 -1
- package/cjs/util/function/funSetName.js +0 -21
- package/cjs/util/function/funSetName.js.map +0 -1
- package/cjs/util/node/execInherit.js +0 -19
- package/cjs/util/node/execInherit.js.map +0 -1
- package/cjs/util/node/formatTableForTerminal.js +0 -21
- package/cjs/util/node/formatTableForTerminal.js.map +0 -1
- package/cjs/util/object/arrAssign.js +0 -6
- package/cjs/util/object/arrAssign.js.map +0 -1
- package/cjs/util/object/createArrayMerger.js +0 -20
- package/cjs/util/object/createArrayMerger.js.map +0 -1
- package/cjs/util/object/createObjectMerger.js +0 -20
- package/cjs/util/object/createObjectMerger.js.map +0 -1
- package/cjs/util/object/objAssign.js +0 -6
- package/cjs/util/object/objAssign.js.map +0 -1
- package/cjs/util/object/objUpdatePropertyDescriptors.js +0 -28
- package/cjs/util/object/objUpdatePropertyDescriptors.js.map +0 -1
- package/cjs/util/object/realizeLazyProperty.js +0 -14
- package/cjs/util/object/realizeLazyProperty.js.map +0 -1
- package/cjs/util/object/setNonEnumerable.js +0 -25
- package/cjs/util/object/setNonEnumerable.js.map +0 -1
- package/cjs/util/os/defaultOpenInEditorCommand.js +0 -18
- package/cjs/util/os/defaultOpenInEditorCommand.js.map +0 -1
- package/cjs/util/os/isOSX.js +0 -13
- package/cjs/util/os/isOSX.js.map +0 -1
- package/cjs/util/os/isVsCodeInstalled.js +0 -19
- package/cjs/util/os/isVsCodeInstalled.js.map +0 -1
- package/cjs/util/os/isWindows.js +0 -16
- package/cjs/util/os/isWindows.js.map +0 -1
- package/cjs/util/path/getTempDataPath.js +0 -20
- package/cjs/util/path/getTempDataPath.js.map +0 -1
- package/cjs/util/regex/regexEscapeString.js +0 -18
- package/cjs/util/regex/regexEscapeString.js.map +0 -1
- package/cjs/util/string/strEnsureStartsWith.js +0 -19
- package/cjs/util/string/strEnsureStartsWith.js.map +0 -1
- package/cjs/util/string/strFirstCharToUpperCase.js +0 -16
- package/cjs/util/string/strFirstCharToUpperCase.js.map +0 -1
- package/cjs/util/string/strIsLowerCase.js +0 -18
- package/cjs/util/string/strIsLowerCase.js.map +0 -1
- package/cjs/util/string/strIsUpperCase.js +0 -18
- package/cjs/util/string/strIsUpperCase.js.map +0 -1
- package/cjs/util/string/strSplitCamelCase.js +0 -55
- package/cjs/util/string/strSplitCamelCase.js.map +0 -1
- package/cjs/util/string-parsers/createBooleanParser.js +0 -21
- package/cjs/util/string-parsers/createBooleanParser.js.map +0 -1
- package/cjs/util/string-parsers/createTypedListParser.js +0 -22
- package/cjs/util/string-parsers/createTypedListParser.js.map +0 -1
- package/cjs/util/string-parsers/parseBoolean.js +0 -15
- package/cjs/util/string-parsers/parseBoolean.js.map +0 -1
- package/cjs/util/string-parsers/parseInteger.js +0 -17
- package/cjs/util/string-parsers/parseInteger.js.map +0 -1
- package/cjs/util/string-parsers/parseNumber.js +0 -13
- package/cjs/util/string-parsers/parseNumber.js.map +0 -1
- package/cjs/util/string-parsers/parseString.js +0 -8
- package/cjs/util/string-parsers/parseString.js.map +0 -1
- package/cjs/util/types/Any.js +0 -3
- package/cjs/util/types/Any.js.map +0 -1
- package/cjs/util/types/DeepArray.js +0 -3
- package/cjs/util/types/DeepArray.js.map +0 -1
- package/cjs/util/types/DeepObject.js +0 -3
- package/cjs/util/types/DeepObject.js.map +0 -1
- package/cjs/util/types/JsonArray.js +0 -3
- package/cjs/util/types/JsonArray.js.map +0 -1
- package/cjs/util/types/JsonDefinedPrimitive.js +0 -6
- package/cjs/util/types/JsonDefinedPrimitive.js.map +0 -1
- package/cjs/util/types/JsonObject.js +0 -3
- package/cjs/util/types/JsonObject.js.map +0 -1
- package/cjs/util/types/JsonRawPrimitive.js +0 -3
- package/cjs/util/types/JsonRawPrimitive.js.map +0 -1
- package/cjs/util/types/JsonValue.js +0 -3
- package/cjs/util/types/JsonValue.js.map +0 -1
- package/cjs/util/types/ObjectKey.js +0 -3
- package/cjs/util/types/ObjectKey.js.map +0 -1
- package/cjs/util/types/TConstructor.js +0 -3
- package/cjs/util/types/TConstructor.js.map +0 -1
- package/cjs/util/types/TFunction.js +0 -3
- package/cjs/util/types/TFunction.js.map +0 -1
- package/cjs/util/types/TFunctionNoNew.js +0 -3
- package/cjs/util/types/TFunctionNoNew.js.map +0 -1
- package/cjs/util/types/TPlainObject.js +0 -3
- package/cjs/util/types/TPlainObject.js.map +0 -1
- package/cjs/util/types/TPrimitive.js +0 -3
- package/cjs/util/types/TPrimitive.js.map +0 -1
- package/cjs/util/types/TStringParser.js +0 -3
- package/cjs/util/types/TStringParser.js.map +0 -1
- package/cjs/util/types/TValidator.js +0 -3
- package/cjs/util/types/TValidator.js.map +0 -1
- package/cjs/util/validation/createTypedArrayValidator.js +0 -26
- package/cjs/util/validation/createTypedArrayValidator.js.map +0 -1
- package/cjs/util/validation/ensureThat.js +0 -12
- package/cjs/util/validation/ensureThat.js.map +0 -1
- package/cjs/util/validation/isArray.js +0 -5
- package/cjs/util/validation/isArray.js.map +0 -1
- package/cjs/util/validation/isBoolean.js +0 -8
- package/cjs/util/validation/isBoolean.js.map +0 -1
- package/cjs/util/validation/isFunction.js +0 -17
- package/cjs/util/validation/isFunction.js.map +0 -1
- package/cjs/util/validation/isNamedFunction.js +0 -11
- package/cjs/util/validation/isNamedFunction.js.map +0 -1
- package/cjs/util/validation/isNamedFunctionArray.js +0 -9
- package/cjs/util/validation/isNamedFunctionArray.js.map +0 -1
- package/cjs/util/validation/isObject.js +0 -22
- package/cjs/util/validation/isObject.js.map +0 -1
- package/cjs/util/validation/isPlainObject.js +0 -19
- package/cjs/util/validation/isPlainObject.js.map +0 -1
- package/cjs/util/validation/isPrimitive.js +0 -18
- package/cjs/util/validation/isPrimitive.js.map +0 -1
- package/cjs/util/validation/isString.js +0 -8
- package/cjs/util/validation/isString.js.map +0 -1
- package/cjs/util/validation/isStringArray.js +0 -12
- package/cjs/util/validation/isStringArray.js.map +0 -1
- package/cjs/util/validation/isStringWithNoSpacesOrDashes.js +0 -9
- package/cjs/util/validation/isStringWithNoSpacesOrDashes.js.map +0 -1
- package/cjs/util/validation/numbers/isInteger.js +0 -17
- package/cjs/util/validation/numbers/isInteger.js.map +0 -1
- package/cjs/util/validation/numbers/isValidNumber.js +0 -22
- package/cjs/util/validation/numbers/isValidNumber.js.map +0 -1
- package/esm/cmd/asdas.js +0 -25
- package/esm/cmd/asdas.js.map +0 -1
- package/esm/util/array/arrLast.js +0 -17
- package/esm/util/array/arrLast.js.map +0 -1
- package/esm/util/array/arrSome.js +0 -22
- package/esm/util/array/arrSome.js.map +0 -1
- package/esm/util/array/types/ArrayPredicate.js +0 -2
- package/esm/util/array/types/ArrayPredicate.js.map +0 -1
- package/esm/util/db/JsonDB.js +0 -141
- package/esm/util/db/JsonDB.js.map +0 -1
- package/esm/util/errors/ErrorParser.js +0 -154
- package/esm/util/errors/ErrorParser.js.map +0 -1
- package/esm/util/fs/promptUserEditInTextEditor/IGetUserInputFromEditorOptions.js +0 -2
- package/esm/util/fs/promptUserEditInTextEditor/IGetUserInputFromEditorOptions.js.map +0 -1
- package/esm/util/fs/promptUserEditInTextEditor/promptUserEditInTextEditorSync.js +0 -28
- package/esm/util/fs/promptUserEditInTextEditor/promptUserEditInTextEditorSync.js.map +0 -1
- package/esm/util/fs/promptUserEditInTextEditor/promptUserEditJsonInTextEditorSync.js +0 -21
- package/esm/util/fs/promptUserEditInTextEditor/promptUserEditJsonInTextEditorSync.js.map +0 -1
- package/esm/util/fs/readFile/readFileSafeSync.js +0 -21
- package/esm/util/fs/readFile/readFileSafeSync.js.map +0 -1
- package/esm/util/fs/readFile/readFileSync.js +0 -13
- package/esm/util/fs/readFile/readFileSync.js.map +0 -1
- package/esm/util/fs/readJsonFile/readJsonFileSafeSync.js +0 -17
- package/esm/util/fs/readJsonFile/readJsonFileSafeSync.js.map +0 -1
- package/esm/util/fs/removeFile/removeFile.js +0 -2
- package/esm/util/fs/removeFile/removeFile.js.map +0 -1
- package/esm/util/fs/tempFile/tempFileSync.js +0 -21
- package/esm/util/fs/tempFile/tempFileSync.js.map +0 -1
- package/esm/util/fs/types/IReadJsonFileOptions.js +0 -2
- package/esm/util/fs/types/IReadJsonFileOptions.js.map +0 -1
- package/esm/util/fs/writeFile/writeFileSafeSync.js +0 -2
- package/esm/util/fs/writeFile/writeFileSafeSync.js.map +0 -1
- package/esm/util/fs/writeFile/writeFileSync.js +0 -2
- package/esm/util/fs/writeFile/writeFileSync.js.map +0 -1
- package/esm/util/fs/writeJsonFile/writeJsonFileSafe.js +0 -2
- package/esm/util/fs/writeJsonFile/writeJsonFileSafe.js.map +0 -1
- package/esm/util/function/MethodDisabler.js +0 -90
- package/esm/util/function/MethodDisabler.js.map +0 -1
- package/esm/util/function/funSetName.js +0 -17
- package/esm/util/function/funSetName.js.map +0 -1
- package/esm/util/node/execInherit.js +0 -15
- package/esm/util/node/execInherit.js.map +0 -1
- package/esm/util/node/formatTableForTerminal.js +0 -14
- package/esm/util/node/formatTableForTerminal.js.map +0 -1
- package/esm/util/object/arrAssign.js +0 -3
- package/esm/util/object/arrAssign.js.map +0 -1
- package/esm/util/object/createArrayMerger.js +0 -16
- package/esm/util/object/createArrayMerger.js.map +0 -1
- package/esm/util/object/createObjectMerger.js +0 -16
- package/esm/util/object/createObjectMerger.js.map +0 -1
- package/esm/util/object/objAssign.js +0 -3
- package/esm/util/object/objAssign.js.map +0 -1
- package/esm/util/object/objUpdatePropertyDescriptors.js +0 -24
- package/esm/util/object/objUpdatePropertyDescriptors.js.map +0 -1
- package/esm/util/object/realizeLazyProperty.js +0 -10
- package/esm/util/object/realizeLazyProperty.js.map +0 -1
- package/esm/util/object/setNonEnumerable.js +0 -21
- package/esm/util/object/setNonEnumerable.js.map +0 -1
- package/esm/util/os/defaultOpenInEditorCommand.js +0 -14
- package/esm/util/os/defaultOpenInEditorCommand.js.map +0 -1
- package/esm/util/os/isOSX.js +0 -9
- package/esm/util/os/isOSX.js.map +0 -1
- package/esm/util/os/isVsCodeInstalled.js +0 -15
- package/esm/util/os/isVsCodeInstalled.js.map +0 -1
- package/esm/util/os/isWindows.js +0 -12
- package/esm/util/os/isWindows.js.map +0 -1
- package/esm/util/path/getTempDataPath.js +0 -13
- package/esm/util/path/getTempDataPath.js.map +0 -1
- package/esm/util/regex/regexEscapeString.js +0 -14
- package/esm/util/regex/regexEscapeString.js.map +0 -1
- package/esm/util/string/strEnsureStartsWith.js +0 -15
- package/esm/util/string/strEnsureStartsWith.js.map +0 -1
- package/esm/util/string/strFirstCharToUpperCase.js +0 -12
- package/esm/util/string/strFirstCharToUpperCase.js.map +0 -1
- package/esm/util/string/strIsLowerCase.js +0 -14
- package/esm/util/string/strIsLowerCase.js.map +0 -1
- package/esm/util/string/strIsUpperCase.js +0 -14
- package/esm/util/string/strIsUpperCase.js.map +0 -1
- package/esm/util/string/strSplitCamelCase.js +0 -51
- package/esm/util/string/strSplitCamelCase.js.map +0 -1
- package/esm/util/string-parsers/createBooleanParser.js +0 -17
- package/esm/util/string-parsers/createBooleanParser.js.map +0 -1
- package/esm/util/string-parsers/createTypedListParser.js +0 -18
- package/esm/util/string-parsers/createTypedListParser.js.map +0 -1
- package/esm/util/string-parsers/parseBoolean.js +0 -12
- package/esm/util/string-parsers/parseBoolean.js.map +0 -1
- package/esm/util/string-parsers/parseInteger.js +0 -13
- package/esm/util/string-parsers/parseInteger.js.map +0 -1
- package/esm/util/string-parsers/parseNumber.js +0 -9
- package/esm/util/string-parsers/parseNumber.js.map +0 -1
- package/esm/util/string-parsers/parseString.js +0 -4
- package/esm/util/string-parsers/parseString.js.map +0 -1
- package/esm/util/types/Any.js +0 -2
- package/esm/util/types/Any.js.map +0 -1
- package/esm/util/types/DeepArray.js +0 -2
- package/esm/util/types/DeepArray.js.map +0 -1
- package/esm/util/types/DeepObject.js +0 -2
- package/esm/util/types/DeepObject.js.map +0 -1
- package/esm/util/types/JsonArray.js +0 -2
- package/esm/util/types/JsonArray.js.map +0 -1
- package/esm/util/types/JsonDefinedPrimitive.js +0 -5
- package/esm/util/types/JsonDefinedPrimitive.js.map +0 -1
- package/esm/util/types/JsonObject.js +0 -2
- package/esm/util/types/JsonObject.js.map +0 -1
- package/esm/util/types/JsonRawPrimitive.js +0 -2
- package/esm/util/types/JsonRawPrimitive.js.map +0 -1
- package/esm/util/types/JsonValue.js +0 -2
- package/esm/util/types/JsonValue.js.map +0 -1
- package/esm/util/types/ObjectKey.js +0 -2
- package/esm/util/types/ObjectKey.js.map +0 -1
- package/esm/util/types/TConstructor.js +0 -2
- package/esm/util/types/TConstructor.js.map +0 -1
- package/esm/util/types/TFunction.js +0 -2
- package/esm/util/types/TFunction.js.map +0 -1
- package/esm/util/types/TFunctionNoNew.js +0 -2
- package/esm/util/types/TFunctionNoNew.js.map +0 -1
- package/esm/util/types/TPlainObject.js +0 -2
- package/esm/util/types/TPlainObject.js.map +0 -1
- package/esm/util/types/TPrimitive.js +0 -2
- package/esm/util/types/TPrimitive.js.map +0 -1
- package/esm/util/types/TStringParser.js +0 -2
- package/esm/util/types/TStringParser.js.map +0 -1
- package/esm/util/types/TValidator.js +0 -2
- package/esm/util/types/TValidator.js.map +0 -1
- package/esm/util/validation/createTypedArrayValidator.js +0 -22
- package/esm/util/validation/createTypedArrayValidator.js.map +0 -1
- package/esm/util/validation/ensureThat.js +0 -8
- package/esm/util/validation/ensureThat.js.map +0 -1
- package/esm/util/validation/isArray.js +0 -2
- package/esm/util/validation/isArray.js.map +0 -1
- package/esm/util/validation/isBoolean.js +0 -4
- package/esm/util/validation/isBoolean.js.map +0 -1
- package/esm/util/validation/isFunction.js +0 -13
- package/esm/util/validation/isFunction.js.map +0 -1
- package/esm/util/validation/isNamedFunction.js +0 -7
- package/esm/util/validation/isNamedFunction.js.map +0 -1
- package/esm/util/validation/isNamedFunctionArray.js +0 -5
- package/esm/util/validation/isNamedFunctionArray.js.map +0 -1
- package/esm/util/validation/isObject.js +0 -18
- package/esm/util/validation/isObject.js.map +0 -1
- package/esm/util/validation/isPlainObject.js +0 -15
- package/esm/util/validation/isPlainObject.js.map +0 -1
- package/esm/util/validation/isPrimitive.js +0 -14
- package/esm/util/validation/isPrimitive.js.map +0 -1
- package/esm/util/validation/isString.js +0 -4
- package/esm/util/validation/isString.js.map +0 -1
- package/esm/util/validation/isStringArray.js +0 -8
- package/esm/util/validation/isStringArray.js.map +0 -1
- package/esm/util/validation/isStringWithNoSpacesOrDashes.js +0 -5
- package/esm/util/validation/isStringWithNoSpacesOrDashes.js.map +0 -1
- package/esm/util/validation/numbers/isInteger.js +0 -14
- package/esm/util/validation/numbers/isInteger.js.map +0 -1
- package/esm/util/validation/numbers/isValidNumber.js +0 -18
- package/esm/util/validation/numbers/isValidNumber.js.map +0 -1
- package/types/cmd/asdas.d.ts +0 -6
- package/types/util/array/arrLast.d.ts +0 -12
- package/types/util/array/arrSome.d.ts +0 -15
- package/types/util/array/types/ArrayPredicate.d.ts +0 -10
- package/types/util/db/JsonDB.d.ts +0 -65
- package/types/util/errors/ErrorParser.d.ts +0 -15
- package/types/util/fs/promptUserEditInTextEditor/IGetUserInputFromEditorOptions.d.ts +0 -15
- package/types/util/fs/promptUserEditInTextEditor/promptUserEditInTextEditorSync.d.ts +0 -9
- package/types/util/fs/promptUserEditInTextEditor/promptUserEditJsonInTextEditorSync.d.ts +0 -13
- package/types/util/fs/readFile/readFileSafeSync.d.ts +0 -13
- package/types/util/fs/readFile/readFileSync.d.ts +0 -10
- package/types/util/fs/readJsonFile/readJsonFileSafeSync.d.ts +0 -9
- package/types/util/fs/removeFile/removeFile.d.ts +0 -1
- package/types/util/fs/tempFile/tempFileSync.d.ts +0 -7
- package/types/util/fs/types/IReadJsonFileOptions.d.ts +0 -1
- package/types/util/fs/writeFile/writeFileSafeSync.d.ts +0 -1
- package/types/util/fs/writeFile/writeFileSync.d.ts +0 -1
- package/types/util/fs/writeJsonFile/writeJsonFileSafe.d.ts +0 -1
- package/types/util/function/MethodDisabler.d.ts +0 -43
- package/types/util/function/funSetName.d.ts +0 -13
- package/types/util/node/execInherit.d.ts +0 -1
- package/types/util/node/formatTableForTerminal.d.ts +0 -1
- package/types/util/object/arrAssign.d.ts +0 -1
- package/types/util/object/createArrayMerger.d.ts +0 -4
- package/types/util/object/createObjectMerger.d.ts +0 -5
- package/types/util/object/objAssign.d.ts +0 -1
- package/types/util/object/objUpdatePropertyDescriptors.d.ts +0 -16
- package/types/util/object/realizeLazyProperty.d.ts +0 -1
- package/types/util/object/setNonEnumerable.d.ts +0 -15
- package/types/util/os/defaultOpenInEditorCommand.d.ts +0 -5
- package/types/util/os/isOSX.d.ts +0 -6
- package/types/util/os/isVsCodeInstalled.d.ts +0 -5
- package/types/util/os/isWindows.d.ts +0 -8
- package/types/util/path/getTempDataPath.d.ts +0 -6
- package/types/util/regex/regexEscapeString.d.ts +0 -11
- package/types/util/string/strEnsureStartsWith.d.ts +0 -12
- package/types/util/string/strFirstCharToUpperCase.d.ts +0 -9
- package/types/util/string/strIsLowerCase.d.ts +0 -11
- package/types/util/string/strIsUpperCase.d.ts +0 -11
- package/types/util/string/strSplitCamelCase.d.ts +0 -11
- package/types/util/string-parsers/createBooleanParser.d.ts +0 -7
- package/types/util/string-parsers/createTypedListParser.d.ts +0 -11
- package/types/util/string-parsers/parseBoolean.d.ts +0 -10
- package/types/util/string-parsers/parseInteger.d.ts +0 -1
- package/types/util/string-parsers/parseNumber.d.ts +0 -1
- package/types/util/string-parsers/parseString.d.ts +0 -1
- package/types/util/types/Any.d.ts +0 -1
- package/types/util/types/DeepArray.d.ts +0 -10
- package/types/util/types/DeepObject.d.ts +0 -14
- package/types/util/types/JsonArray.d.ts +0 -6
- package/types/util/types/JsonDefinedPrimitive.d.ts +0 -4
- package/types/util/types/JsonObject.d.ts +0 -6
- package/types/util/types/JsonRawPrimitive.d.ts +0 -5
- package/types/util/types/JsonValue.d.ts +0 -7
- package/types/util/types/ObjectKey.d.ts +0 -1
- package/types/util/types/TConstructor.d.ts +0 -5
- package/types/util/types/TFunction.d.ts +0 -4
- package/types/util/types/TFunctionNoNew.d.ts +0 -2
- package/types/util/types/TPlainObject.d.ts +0 -2
- package/types/util/types/TPrimitive.d.ts +0 -1
- package/types/util/types/TStringParser.d.ts +0 -1
- package/types/util/types/TValidator.d.ts +0 -2
- package/types/util/validation/createTypedArrayValidator.d.ts +0 -9
- package/types/util/validation/ensureThat.d.ts +0 -6
- package/types/util/validation/isArray.d.ts +0 -1
- package/types/util/validation/isBoolean.d.ts +0 -1
- package/types/util/validation/isFunction.d.ts +0 -11
- package/types/util/validation/isNamedFunction.d.ts +0 -5
- package/types/util/validation/isNamedFunctionArray.d.ts +0 -1
- package/types/util/validation/isObject.d.ts +0 -15
- package/types/util/validation/isPlainObject.d.ts +0 -6
- package/types/util/validation/isPrimitive.d.ts +0 -12
- package/types/util/validation/isString.d.ts +0 -1
- package/types/util/validation/isStringArray.d.ts +0 -4
- package/types/util/validation/isStringWithNoSpacesOrDashes.d.ts +0 -1
- package/types/util/validation/numbers/isInteger.d.ts +0 -13
- package/types/util/validation/numbers/isValidNumber.d.ts +0 -15
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { Any } from '
|
|
1
|
+
import type { Any } from '@bemoje/util';
|
|
2
2
|
import { CommandBuilder } from './CommandBuilder';
|
|
3
3
|
import { Option } from '@commander-js/extra-typings';
|
|
4
|
-
import type { TStringParser } from '
|
|
5
|
-
import type { TValidator } from '
|
|
4
|
+
import type { TStringParser } from '@bemoje/util';
|
|
5
|
+
import type { TValidator } from '@bemoje/util';
|
|
6
6
|
export declare class CommandBuilderMetaData<Args extends Any[] = unknown[]> {
|
|
7
7
|
subcommands: CommandBuilder[];
|
|
8
8
|
optsMap: Record<string, Option>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import colors from 'ansi-colors';
|
|
2
|
-
import type { Any } from '
|
|
3
|
-
import { MethodDisabler } from '
|
|
2
|
+
import type { Any } from '@bemoje/util';
|
|
3
|
+
import { MethodDisabler } from '@bemoje/util';
|
|
4
4
|
/**
|
|
5
5
|
* The OutputManager class manages the output of debug messages to the console.
|
|
6
6
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ArgumentBuilder } from '../arg/ArgumentBuilder';
|
|
2
|
-
import type { JsonValue } from '
|
|
2
|
+
import type { JsonValue } from '@bemoje/util';
|
|
3
3
|
import { OptionBuilder } from '../opt/OptionBuilder';
|
|
4
|
-
import type { TStringParser } from '
|
|
4
|
+
import type { TStringParser } from '@bemoje/util';
|
|
5
5
|
export declare abstract class ParserSelector<Builder extends ArgumentBuilder | OptionBuilder> {
|
|
6
6
|
protected readonly builder: Builder;
|
|
7
7
|
constructor(builder: Builder);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ArgumentBuilder } from '../arg/ArgumentBuilder';
|
|
2
|
-
import type { JsonValue } from '
|
|
2
|
+
import type { JsonValue } from '@bemoje/util';
|
|
3
3
|
import { OptionBuilder } from '../opt/OptionBuilder';
|
|
4
|
-
import type { TValidator } from '
|
|
4
|
+
import type { TValidator } from '@bemoje/util';
|
|
5
5
|
export declare abstract class ValidatorSelector<Builder extends OptionBuilder | ArgumentBuilder> {
|
|
6
6
|
protected readonly builder: Builder;
|
|
7
7
|
constructor(builder: Builder);
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Any, JsonValue } from '@bemoje/util';
|
|
2
2
|
import { JsonFile } from './JsonFile';
|
|
3
|
-
import type { JsonValue } from '../util/types/JsonValue';
|
|
4
3
|
/**
|
|
5
4
|
* A class that represents a section of the JSON file used as a simple database.
|
|
6
5
|
*/
|
|
@@ -48,7 +47,7 @@ export declare abstract class AbstractJsonFileSection<Val = JsonValue> {
|
|
|
48
47
|
/**
|
|
49
48
|
* The JsonDB associated with the section.
|
|
50
49
|
*/
|
|
51
|
-
get db(): import("
|
|
50
|
+
get db(): import("@bemoje/util").JsonDB;
|
|
52
51
|
/**
|
|
53
52
|
* The CommandBuilder associated with the section.
|
|
54
53
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AbstractJsonFileSection } from './AbstractJsonFileSection';
|
|
2
2
|
import { JsonFile } from './JsonFile';
|
|
3
|
-
import
|
|
3
|
+
import { JsonValue } from '@bemoje/util';
|
|
4
4
|
/**
|
|
5
5
|
* A class that represents the appdata section of the JSON file used as simple database.
|
|
6
6
|
*/
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { AbstractJsonFileSection } from './AbstractJsonFileSection';
|
|
2
|
+
import { JsonValue, TStringParser, TValidator } from '@bemoje/util';
|
|
2
3
|
import type { IConfig } from '../types/IConfig';
|
|
3
4
|
import { JsonFile } from './JsonFile';
|
|
4
|
-
import type { JsonValue } from '../util/types/JsonValue';
|
|
5
|
-
import type { TStringParser } from '../util/types/TStringParser';
|
|
6
|
-
import type { TValidator } from '../util/types/TValidator';
|
|
7
5
|
/**
|
|
8
6
|
* A class that represents the user-config section of the JSON file used as simple database.
|
|
9
7
|
*/
|
package/types/db/JsonFile.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AppDataSection } from './AppDataSection';
|
|
2
2
|
import { CommandBuilder } from '../cmd/CommandBuilder';
|
|
3
3
|
import { ConfigSection } from './ConfigSection';
|
|
4
|
-
import { JsonDB } from '
|
|
4
|
+
import { JsonDB } from '@bemoje/util';
|
|
5
5
|
import { PresetsSection } from './PresetsSection';
|
|
6
6
|
/**
|
|
7
7
|
* A class that represents the JSON file used as a simple database.
|
package/types/index.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ export * from './arg/ArgumentBuilder';
|
|
|
2
2
|
export * from './arg/ArgumentParserSelector';
|
|
3
3
|
export * from './arg/ArgumentReader';
|
|
4
4
|
export * from './arg/ArgumentValidatorSelector';
|
|
5
|
-
export * from './cmd/asdas';
|
|
6
5
|
export * from './cmd/CommandBuilder';
|
|
7
6
|
export * from './cmd/CommandBuilderMetaData';
|
|
8
7
|
export * from './cmd/CommandFeatureSelector';
|
|
@@ -23,79 +22,3 @@ export * from './opt/OptionHelpers';
|
|
|
23
22
|
export * from './opt/OptionReader';
|
|
24
23
|
export * from './types/IConfig';
|
|
25
24
|
export * from './types/IPreset';
|
|
26
|
-
export * from './util/array/arrLast';
|
|
27
|
-
export * from './util/array/arrSome';
|
|
28
|
-
export * from './util/array/types/ArrayPredicate';
|
|
29
|
-
export * from './util/db/JsonDB';
|
|
30
|
-
export * from './util/errors/ErrorParser';
|
|
31
|
-
export * from './util/fs/promptUserEditInTextEditor/IGetUserInputFromEditorOptions';
|
|
32
|
-
export * from './util/fs/promptUserEditInTextEditor/promptUserEditInTextEditorSync';
|
|
33
|
-
export * from './util/fs/promptUserEditInTextEditor/promptUserEditJsonInTextEditorSync';
|
|
34
|
-
export * from './util/fs/readFile/readFileSafeSync';
|
|
35
|
-
export * from './util/fs/readFile/readFileSync';
|
|
36
|
-
export * from './util/fs/readJsonFile/readJsonFileSafeSync';
|
|
37
|
-
export * from './util/fs/removeFile/removeFile';
|
|
38
|
-
export * from './util/fs/tempFile/tempFileSync';
|
|
39
|
-
export * from './util/fs/types/IReadJsonFileOptions';
|
|
40
|
-
export * from './util/fs/writeFile/writeFileSafeSync';
|
|
41
|
-
export * from './util/fs/writeFile/writeFileSync';
|
|
42
|
-
export * from './util/fs/writeJsonFile/writeJsonFileSafe';
|
|
43
|
-
export * from './util/function/funSetName';
|
|
44
|
-
export * from './util/function/MethodDisabler';
|
|
45
|
-
export * from './util/node/execInherit';
|
|
46
|
-
export * from './util/node/formatTableForTerminal';
|
|
47
|
-
export * from './util/object/arrAssign';
|
|
48
|
-
export * from './util/object/createArrayMerger';
|
|
49
|
-
export * from './util/object/createObjectMerger';
|
|
50
|
-
export * from './util/object/objAssign';
|
|
51
|
-
export * from './util/object/objUpdatePropertyDescriptors';
|
|
52
|
-
export * from './util/object/realizeLazyProperty';
|
|
53
|
-
export * from './util/object/setNonEnumerable';
|
|
54
|
-
export * from './util/os/defaultOpenInEditorCommand';
|
|
55
|
-
export * from './util/os/isOSX';
|
|
56
|
-
export * from './util/os/isVsCodeInstalled';
|
|
57
|
-
export * from './util/os/isWindows';
|
|
58
|
-
export * from './util/path/getTempDataPath';
|
|
59
|
-
export * from './util/regex/regexEscapeString';
|
|
60
|
-
export * from './util/string/strEnsureStartsWith';
|
|
61
|
-
export * from './util/string/strFirstCharToUpperCase';
|
|
62
|
-
export * from './util/string/strIsLowerCase';
|
|
63
|
-
export * from './util/string/strIsUpperCase';
|
|
64
|
-
export * from './util/string/strSplitCamelCase';
|
|
65
|
-
export * from './util/string-parsers/createBooleanParser';
|
|
66
|
-
export * from './util/string-parsers/createTypedListParser';
|
|
67
|
-
export * from './util/string-parsers/parseBoolean';
|
|
68
|
-
export * from './util/string-parsers/parseInteger';
|
|
69
|
-
export * from './util/string-parsers/parseNumber';
|
|
70
|
-
export * from './util/string-parsers/parseString';
|
|
71
|
-
export * from './util/types/Any';
|
|
72
|
-
export * from './util/types/DeepArray';
|
|
73
|
-
export * from './util/types/DeepObject';
|
|
74
|
-
export * from './util/types/JsonArray';
|
|
75
|
-
export * from './util/types/JsonDefinedPrimitive';
|
|
76
|
-
export * from './util/types/JsonObject';
|
|
77
|
-
export * from './util/types/JsonRawPrimitive';
|
|
78
|
-
export * from './util/types/JsonValue';
|
|
79
|
-
export * from './util/types/ObjectKey';
|
|
80
|
-
export * from './util/types/TConstructor';
|
|
81
|
-
export * from './util/types/TFunction';
|
|
82
|
-
export * from './util/types/TFunctionNoNew';
|
|
83
|
-
export * from './util/types/TPlainObject';
|
|
84
|
-
export * from './util/types/TPrimitive';
|
|
85
|
-
export * from './util/types/TStringParser';
|
|
86
|
-
export * from './util/types/TValidator';
|
|
87
|
-
export * from './util/validation/createTypedArrayValidator';
|
|
88
|
-
export * from './util/validation/ensureThat';
|
|
89
|
-
export * from './util/validation/isArray';
|
|
90
|
-
export * from './util/validation/isBoolean';
|
|
91
|
-
export * from './util/validation/isFunction';
|
|
92
|
-
export * from './util/validation/isNamedFunction';
|
|
93
|
-
export * from './util/validation/isNamedFunctionArray';
|
|
94
|
-
export * from './util/validation/isObject';
|
|
95
|
-
export * from './util/validation/isPlainObject';
|
|
96
|
-
export * from './util/validation/isPrimitive';
|
|
97
|
-
export * from './util/validation/isString';
|
|
98
|
-
export * from './util/validation/isStringArray';
|
|
99
|
-
export * from './util/validation/isStringWithNoSpacesOrDashes';
|
|
100
|
-
export * from './util/validation/numbers/isInteger';
|
|
101
|
-
export * from './util/validation/numbers/isValidNumber';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { OptionBuilder } from './OptionBuilder';
|
|
2
2
|
import { ParserSelector } from '../core/ParserSelector';
|
|
3
|
-
import type { TStringParser } from '
|
|
3
|
+
import type { TStringParser } from '@bemoje/util';
|
|
4
4
|
export declare class OptionArgumentParserSelector extends ParserSelector<OptionBuilder> {
|
|
5
5
|
constructor(builder: OptionBuilder);
|
|
6
6
|
custom<T>(parser: TStringParser<T>): OptionBuilder;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { OptionBuilder } from './OptionBuilder';
|
|
2
|
-
import type { TValidator } from '
|
|
2
|
+
import type { TValidator } from '@bemoje/util';
|
|
3
3
|
import { ValidatorSelector } from '../core/ValidatorSelector';
|
|
4
4
|
export declare class OptionArgumentValidatorSelector extends ValidatorSelector<OptionBuilder> {
|
|
5
5
|
constructor(builder: OptionBuilder);
|
package/types/types/IConfig.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { JsonValue } from '
|
|
2
|
-
import type { TStringParser } from '
|
|
3
|
-
import type { TValidator } from '
|
|
1
|
+
import type { JsonValue } from '@bemoje/util';
|
|
2
|
+
import type { TStringParser } from '@bemoje/util';
|
|
3
|
+
import type { TValidator } from '@bemoje/util';
|
|
4
4
|
export interface IConfig<Val extends JsonValue> {
|
|
5
5
|
/**
|
|
6
6
|
* The default value of the property.
|
package/types/types/IPreset.d.ts
CHANGED
package/cjs/cmd/asdas.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// export type MappedTypeWithNewProperties<T> = {
|
|
3
|
-
// [K in keyof T]: T[K]
|
|
4
|
-
// }
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const CommandBuilder_1 = require("./CommandBuilder");
|
|
7
|
-
const args = [() => 1, () => '1', () => true];
|
|
8
|
-
const opts = { a: () => 1, b: () => '1', c: () => true };
|
|
9
|
-
const cli = new CommandBuilder_1.CommandBuilder('test', (c) => {
|
|
10
|
-
c.argument('[int]', (a) => {
|
|
11
|
-
a.parser.integer();
|
|
12
|
-
});
|
|
13
|
-
c.argument('[str]', (a) => {
|
|
14
|
-
a.parser.string();
|
|
15
|
-
});
|
|
16
|
-
c.option('--opt1 <value>', (o) => {
|
|
17
|
-
o.parser.string();
|
|
18
|
-
});
|
|
19
|
-
c.option('--opt1 <value>', (o) => {
|
|
20
|
-
o.parser.integer();
|
|
21
|
-
});
|
|
22
|
-
c.action((int, str, opts) => {
|
|
23
|
-
const parsers = cli.meta.argParsers;
|
|
24
|
-
console.log({ int, str, opts });
|
|
25
|
-
});
|
|
26
|
-
});
|
|
27
|
-
//# sourceMappingURL=asdas.js.map
|
package/cjs/cmd/asdas.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"asdas.js","sourceRoot":"","sources":["../../../../../packages/cli/src/cmd/asdas.ts"],"names":[],"mappings":";AAAA,iDAAiD;AACjD,yBAAyB;AACzB,IAAI;;AAEJ,qDAAiD;AAUjD,MAAM,IAAI,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,CAAA;AAC7C,MAAM,IAAI,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,CAAA;AAMxD,MAAM,GAAG,GAAG,IAAI,+BAAc,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE;IAC3C,CAAC,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE;QACxB,CAAC,CAAC,MAAM,CAAC,OAAO,EAAE,CAAA;IACpB,CAAC,CAAC,CAAA;IACF,CAAC,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE;QACxB,CAAC,CAAC,MAAM,CAAC,MAAM,EAAE,CAAA;IACnB,CAAC,CAAC,CAAA;IACF,CAAC,CAAC,MAAM,CAAC,gBAAgB,EAAE,CAAC,CAAC,EAAE,EAAE;QAC/B,CAAC,CAAC,MAAM,CAAC,MAAM,EAAE,CAAA;IACnB,CAAC,CAAC,CAAA;IACF,CAAC,CAAC,MAAM,CAAC,gBAAgB,EAAE,CAAC,CAAC,EAAE,EAAE;QAC/B,CAAC,CAAC,MAAM,CAAC,OAAO,EAAE,CAAA;IACpB,CAAC,CAAC,CAAA;IACF,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;QAC1B,MAAM,OAAO,GAAG,GAAG,CAAC,IAAI,CAAC,UAAU,CAAA;QAEnC,OAAO,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,CAAA;IACjC,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.arrLast = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Returns the last element of an array.
|
|
6
|
-
* Throws an error if the array is empty.
|
|
7
|
-
* @template T The type of elements in the array.
|
|
8
|
-
* @param array The array to get the last element from.
|
|
9
|
-
* @returns The last element of the array.
|
|
10
|
-
* @throws If the array is empty.
|
|
11
|
-
* @example const numbers = [1, 2, 3, 4, 5];
|
|
12
|
-
* const lastNumber = arrLast(numbers);
|
|
13
|
-
* //=> 5
|
|
14
|
-
*/
|
|
15
|
-
function arrLast(array) {
|
|
16
|
-
if (!array.length)
|
|
17
|
-
throw new Error('Cannot get last element of empty array.');
|
|
18
|
-
return array[array.length - 1];
|
|
19
|
-
}
|
|
20
|
-
exports.arrLast = arrLast;
|
|
21
|
-
//# sourceMappingURL=arrLast.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"arrLast.js","sourceRoot":"","sources":["../../../../../../packages/cli/src/util/array/arrLast.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;GAUG;AACH,SAAgB,OAAO,CAAI,KAAU;IACnC,IAAI,CAAC,KAAK,CAAC,MAAM;QAAE,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAA;IAC7E,OAAO,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAA;AAChC,CAAC;AAHD,0BAGC"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.arrSome = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Checks if at least one element in the array satisfies the provided predicate.
|
|
6
|
-
* @param predicate The predicate function to apply to each element.
|
|
7
|
-
* @template T The type of elements in the input array.
|
|
8
|
-
* @returns Returns `true` if at least one element in the array passes the test implemented by the provided function, otherwise `false`.
|
|
9
|
-
* @param input The array to check.
|
|
10
|
-
* @example ```ts
|
|
11
|
-
* const numbers = [1, 2, 3, 4, 5];
|
|
12
|
-
* const isEven = (num) => num % 2 === 0;
|
|
13
|
-
* arrSome(numbers, isEven);
|
|
14
|
-
* //=> true
|
|
15
|
-
* ```
|
|
16
|
-
*/
|
|
17
|
-
function arrSome(input, predicate) {
|
|
18
|
-
for (let i = 0, len = input.length; i < len; i++) {
|
|
19
|
-
if (predicate(input[i], i, input) === true) {
|
|
20
|
-
return true;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
return false;
|
|
24
|
-
}
|
|
25
|
-
exports.arrSome = arrSome;
|
|
26
|
-
//# sourceMappingURL=arrSome.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"arrSome.js","sourceRoot":"","sources":["../../../../../../packages/cli/src/util/array/arrSome.ts"],"names":[],"mappings":";;;AAEA;;;;;;;;;;;;GAYG;AACH,SAAgB,OAAO,CAAI,KAAe,EAAE,SAA4B;IACtE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,EAAE;QAChD,IAAI,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,KAAK,IAAI,EAAE;YAC1C,OAAO,IAAI,CAAA;SACZ;KACF;IACD,OAAO,KAAK,CAAA;AACd,CAAC;AAPD,0BAOC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ArrayPredicate.js","sourceRoot":"","sources":["../../../../../../../packages/cli/src/util/array/types/ArrayPredicate.ts"],"names":[],"mappings":""}
|
package/cjs/util/db/JsonDB.js
DELETED
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.JsonDB = void 0;
|
|
4
|
-
const ensureThat_1 = require("../validation/ensureThat");
|
|
5
|
-
const isObject_1 = require("../validation/isObject");
|
|
6
|
-
const readJsonFileSafeSync_1 = require("../fs/readJsonFile/readJsonFileSafeSync");
|
|
7
|
-
const writeJsonFileSafe_1 = require("../fs/writeJsonFile/writeJsonFileSafe");
|
|
8
|
-
/**
|
|
9
|
-
* Represents a simple JSON file database.
|
|
10
|
-
*/
|
|
11
|
-
class JsonDB {
|
|
12
|
-
filepath;
|
|
13
|
-
indents;
|
|
14
|
-
/**
|
|
15
|
-
* The data stored in the JSON database.
|
|
16
|
-
*/
|
|
17
|
-
data;
|
|
18
|
-
/**
|
|
19
|
-
* Creates a new instance of the JsonDB class.
|
|
20
|
-
* @param filepath - The filepath where the data file is stored or to be stored.
|
|
21
|
-
*/
|
|
22
|
-
constructor(filepath, indents = 0) {
|
|
23
|
-
this.filepath = filepath;
|
|
24
|
-
this.indents = indents;
|
|
25
|
-
this.data = (0, readJsonFileSafeSync_1.readJsonFileSafeSync)(this.filepath) ?? {};
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Saves the data to the JSON file.
|
|
29
|
-
*/
|
|
30
|
-
async save(indents = this.indents) {
|
|
31
|
-
return await (0, writeJsonFileSafe_1.writeJsonFileSafe)(this.filepath, this.data, { spaces: indents });
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Sets the filepath of the JSON file.
|
|
35
|
-
* @param filepath - The new filepath.
|
|
36
|
-
*/
|
|
37
|
-
setFilepath(filepath, save = true) {
|
|
38
|
-
if (this.filepath === filepath)
|
|
39
|
-
return;
|
|
40
|
-
this.filepath = filepath;
|
|
41
|
-
if (save)
|
|
42
|
-
this.save();
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Sets a value in the JSON database.
|
|
46
|
-
* @param prefix - Object path prefix as dot-separated keys.
|
|
47
|
-
* @param value - The value to set.
|
|
48
|
-
* @param save - Whether to save the data to the JSON file.
|
|
49
|
-
*/
|
|
50
|
-
set(prefix, value = {}, save = true) {
|
|
51
|
-
if (!prefix) {
|
|
52
|
-
this.data = (0, ensureThat_1.ensureThat)(value, isObject_1.isObject);
|
|
53
|
-
}
|
|
54
|
-
else {
|
|
55
|
-
const keys = prefix.split('.');
|
|
56
|
-
const lastKey = keys.pop();
|
|
57
|
-
let node = this.data;
|
|
58
|
-
for (const key of keys) {
|
|
59
|
-
if (!Object.hasOwn(node, key)) {
|
|
60
|
-
node[key] = {};
|
|
61
|
-
}
|
|
62
|
-
node = node[key];
|
|
63
|
-
}
|
|
64
|
-
node[lastKey] = this.cloneDeep(value);
|
|
65
|
-
}
|
|
66
|
-
if (save)
|
|
67
|
-
this.save();
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Gets a value from the JSON database.
|
|
71
|
-
* @param prefix - Object path prefix as dot-separated keys.
|
|
72
|
-
* @returns The value associated with the key.
|
|
73
|
-
* @throws An error if no entry is found at the specified key.
|
|
74
|
-
*/
|
|
75
|
-
get(prefix) {
|
|
76
|
-
const value = this.getSafe(prefix);
|
|
77
|
-
if (value === undefined)
|
|
78
|
-
throw new Error(`No entry at '${prefix}'`);
|
|
79
|
-
return this.cloneDeep(value);
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Gets a value from the JSON database safely.
|
|
83
|
-
* @param prefix - Object path prefix as dot-separated keys.
|
|
84
|
-
* @returns The value associated with the key, or undefined if no entry is found.
|
|
85
|
-
*/
|
|
86
|
-
getSafe(prefix) {
|
|
87
|
-
if (!prefix)
|
|
88
|
-
return this.cloneDeep(this.data);
|
|
89
|
-
const keys = prefix.split('.');
|
|
90
|
-
let node = this.data;
|
|
91
|
-
for (const key of keys) {
|
|
92
|
-
if (!Object.hasOwn(node, key)) {
|
|
93
|
-
return undefined;
|
|
94
|
-
}
|
|
95
|
-
node = node[key];
|
|
96
|
-
}
|
|
97
|
-
return this.cloneDeep(node);
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* Checks if a key exists in the JSON database.
|
|
101
|
-
* @param prefix - Object path prefix as dot-separated keys.
|
|
102
|
-
* @returns True if the key exists, false otherwise.
|
|
103
|
-
*/
|
|
104
|
-
has(prefix) {
|
|
105
|
-
if (!prefix)
|
|
106
|
-
return true;
|
|
107
|
-
return this.getSafe(prefix) !== undefined;
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* Deletes a value from the JSON database.
|
|
111
|
-
* @param prefix - Object path prefix as dot-separated keys.
|
|
112
|
-
* @param save - Whether to save the data to the JSON file.
|
|
113
|
-
*/
|
|
114
|
-
delete(prefix, save = true) {
|
|
115
|
-
if (!prefix) {
|
|
116
|
-
this.data = {};
|
|
117
|
-
}
|
|
118
|
-
else {
|
|
119
|
-
const keys = prefix.split('.');
|
|
120
|
-
const lastKey = keys.pop();
|
|
121
|
-
let node = this.data;
|
|
122
|
-
for (const key of keys) {
|
|
123
|
-
if (!Object.hasOwn(node, key)) {
|
|
124
|
-
return;
|
|
125
|
-
}
|
|
126
|
-
node = node[key];
|
|
127
|
-
}
|
|
128
|
-
delete node[lastKey];
|
|
129
|
-
}
|
|
130
|
-
if (save)
|
|
131
|
-
this.save();
|
|
132
|
-
}
|
|
133
|
-
/**
|
|
134
|
-
* Creates a deep clone of an object.
|
|
135
|
-
* @param obj - The object to clone.
|
|
136
|
-
* @returns The cloned object.
|
|
137
|
-
*/
|
|
138
|
-
cloneDeep(obj) {
|
|
139
|
-
if (typeof obj !== 'object')
|
|
140
|
-
return obj;
|
|
141
|
-
return JSON.parse(JSON.stringify(obj));
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
exports.JsonDB = JsonDB;
|
|
145
|
-
//# sourceMappingURL=JsonDB.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"JsonDB.js","sourceRoot":"","sources":["../../../../../../packages/cli/src/util/db/JsonDB.ts"],"names":[],"mappings":";;;AAAA,yDAAqD;AACrD,qDAAiD;AAGjD,kFAA8E;AAC9E,6EAAyE;AAEzE;;GAEG;AACH,MAAa,MAAM;IAUK;IAA4B;IATlD;;OAEG;IACO,IAAI,CAAY;IAE1B;;;OAGG;IACH,YAAsB,QAAgB,EAAY,UAAU,CAAC;QAAvC,aAAQ,GAAR,QAAQ,CAAQ;QAAY,YAAO,GAAP,OAAO,CAAI;QAC3D,IAAI,CAAC,IAAI,GAAG,IAAA,2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YACpC,IAAI,IAAI,GAAe,IAAI,CAAC,IAAI,CAAA;YAChC,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE;gBACtB,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC,EAAE;oBAC7B,OAAM;iBACP;gBACD,IAAI,GAAG,IAAI,CAAC,GAAG,CAAe,CAAA;aAC/B;YACD,OAAO,IAAI,CAAC,OAAO,CAAC,CAAA;SACrB;QACD,IAAI,IAAI;YAAE,IAAI,CAAC,IAAI,EAAE,CAAA;IACvB,CAAC;IAED;;;;OAIG;IACO,SAAS,CAAsB,GAAM;QAC7C,IAAI,OAAO,GAAG,KAAK,QAAQ;YAAE,OAAO,GAAG,CAAA;QACvC,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAM,CAAA;IAC7C,CAAC;CACF;AA/HD,wBA+HC"}
|
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.errToObject = exports.errParseStack = exports.errPrettyStack = exports.ErrorParser = void 0;
|
|
7
|
-
const ansi_colors_1 = __importDefault(require("ansi-colors"));
|
|
8
|
-
const path_1 = __importDefault(require("path"));
|
|
9
|
-
const isPlainObject_1 = require("../validation/isPlainObject");
|
|
10
|
-
const isPrimitive_1 = require("../validation/isPrimitive");
|
|
11
|
-
const regexEscapeString_1 = require("../regex/regexEscapeString");
|
|
12
|
-
class ErrorParser {
|
|
13
|
-
error;
|
|
14
|
-
constructor(error) {
|
|
15
|
-
this.error = error instanceof Error ? error : new Error(String(error));
|
|
16
|
-
}
|
|
17
|
-
get name() {
|
|
18
|
-
return this.error.name;
|
|
19
|
-
}
|
|
20
|
-
get message() {
|
|
21
|
-
return this.error.message;
|
|
22
|
-
}
|
|
23
|
-
get stack() {
|
|
24
|
-
return this.error.stack || '';
|
|
25
|
-
}
|
|
26
|
-
summary() {
|
|
27
|
-
return this.name + ': ' + this.message;
|
|
28
|
-
}
|
|
29
|
-
parseStackFrames() {
|
|
30
|
-
return errParseStack(this.stack);
|
|
31
|
-
}
|
|
32
|
-
prettyStack(parsedStackFrames) {
|
|
33
|
-
return errPrettyStack(this.error, parsedStackFrames);
|
|
34
|
-
}
|
|
35
|
-
toObject() {
|
|
36
|
-
return errToObject(this.error);
|
|
37
|
-
}
|
|
38
|
-
toJSON() {
|
|
39
|
-
return this.toObject();
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
exports.ErrorParser = ErrorParser;
|
|
43
|
-
function errPrettyStack(error, parsedStackFrames) {
|
|
44
|
-
const frames = parsedStackFrames ?? errParseStack(error.stack || '');
|
|
45
|
-
// width of the first column = the longest frame.cell string
|
|
46
|
-
const offset = 2 + frames.reduce((acc, frame) => Math.max(acc, frame[0].length), 0);
|
|
47
|
-
// type and message
|
|
48
|
-
const result = [
|
|
49
|
-
ansi_colors_1.default.bold(ansi_colors_1.default.red(error.name)) +
|
|
50
|
-
': ' +
|
|
51
|
-
' '.repeat(Math.max(0, offset - error.name.length)) +
|
|
52
|
-
ansi_colors_1.default.red(error.message),
|
|
53
|
-
];
|
|
54
|
-
// stack trace
|
|
55
|
-
result.push(ansi_colors_1.default.yellow('stack') + ':');
|
|
56
|
-
result.push(frames
|
|
57
|
-
.map((frame) => {
|
|
58
|
-
const [call, file] = frame;
|
|
59
|
-
let s = ' ';
|
|
60
|
-
let fp;
|
|
61
|
-
if (file.startsWith('node:')) {
|
|
62
|
-
s += ansi_colors_1.default.gray(call);
|
|
63
|
-
fp = ansi_colors_1.default.gray(file);
|
|
64
|
-
}
|
|
65
|
-
else if (file.includes('node_modules')) {
|
|
66
|
-
s += call;
|
|
67
|
-
const base = path_1.default.basename(file.split(':')[0]);
|
|
68
|
-
fp = file.replace(base, ansi_colors_1.default.yellow(base));
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
s += call;
|
|
72
|
-
const base = path_1.default.basename(file.split(':')[0]);
|
|
73
|
-
fp = file.replace(base, ansi_colors_1.default.red(base));
|
|
74
|
-
}
|
|
75
|
-
s += ' '.repeat(offset - call.length);
|
|
76
|
-
s += fp;
|
|
77
|
-
return s;
|
|
78
|
-
})
|
|
79
|
-
.join('\n'));
|
|
80
|
-
// other properties
|
|
81
|
-
const ignore = ['name', 'message', 'frames', 'stack'];
|
|
82
|
-
const keys = Object.getOwnPropertyNames(error).filter((key) => !ignore.includes(key));
|
|
83
|
-
for (const k of keys) {
|
|
84
|
-
if (typeof k === 'symbol')
|
|
85
|
-
continue;
|
|
86
|
-
const key = k;
|
|
87
|
-
let s = ansi_colors_1.default.yellow(key.toString()) + ': ';
|
|
88
|
-
if ((0, isPlainObject_1.isPlainObject)(error[key])) {
|
|
89
|
-
const json = JSON.stringify(error[key], null, 2);
|
|
90
|
-
if (json.length < 350) {
|
|
91
|
-
s += JSON.stringify(error[key], null, 2)
|
|
92
|
-
.split('\n')
|
|
93
|
-
.map((line) => {
|
|
94
|
-
const arr = line.split('": ');
|
|
95
|
-
arr[0] = ansi_colors_1.default.gray(arr[0].replace('"', ''));
|
|
96
|
-
return arr.join(': ');
|
|
97
|
-
})
|
|
98
|
-
.join('\n');
|
|
99
|
-
}
|
|
100
|
-
else {
|
|
101
|
-
s += JSON.stringify(error[key]);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
else if ((0, isPrimitive_1.isPrimitive)(error[key])) {
|
|
105
|
-
s += String(error[key]);
|
|
106
|
-
}
|
|
107
|
-
else if (error[key] != null && typeof error[key] === 'object') {
|
|
108
|
-
s += error[key].toString();
|
|
109
|
-
}
|
|
110
|
-
else {
|
|
111
|
-
s += JSON.stringify(error[key]);
|
|
112
|
-
}
|
|
113
|
-
result.push(s.trim());
|
|
114
|
-
}
|
|
115
|
-
return '\n' + result.join('\n') + '\n';
|
|
116
|
-
}
|
|
117
|
-
exports.errPrettyStack = errPrettyStack;
|
|
118
|
-
function errParseStack(stack) {
|
|
119
|
-
if (!stack)
|
|
120
|
-
return [];
|
|
121
|
-
const nodeRe = /^\s*at (?:((?:\[object object\])?[^\\/]+(?: \[as \S+\])?) )?\(?(.*?):(\d+)(?::(\d+))?\)?\s*$/i;
|
|
122
|
-
const recwd = new RegExp('^' + (0, regexEscapeString_1.regexEscapeString)(process.cwd() + path_1.default.sep), 'i');
|
|
123
|
-
const frames = [];
|
|
124
|
-
for (const line of stack.split('\n')) {
|
|
125
|
-
const parts = nodeRe.exec(line);
|
|
126
|
-
if (!parts)
|
|
127
|
-
continue;
|
|
128
|
-
frames.push([
|
|
129
|
-
parts[1] || '<unknown>',
|
|
130
|
-
`${(parts[2] || '').replace(recwd, '').replace(/\\\\?/g, '/')}:${+parts[3]}:${parts[4] ? +parts[4] : null}`,
|
|
131
|
-
]);
|
|
132
|
-
}
|
|
133
|
-
return frames;
|
|
134
|
-
}
|
|
135
|
-
exports.errParseStack = errParseStack;
|
|
136
|
-
function errToObject(error) {
|
|
137
|
-
const own = Object.getOwnPropertyNames(error).filter((key) => typeof key === 'string');
|
|
138
|
-
const keys = new Set(['name', 'message', 'frames', ...own]);
|
|
139
|
-
keys.delete('stack');
|
|
140
|
-
const entries = Array.from(keys)
|
|
141
|
-
.filter((key) => error[key] !== undefined)
|
|
142
|
-
.map((key) => [key, error[key]]);
|
|
143
|
-
return Object.fromEntries(entries);
|
|
144
|
-
}
|
|
145
|
-
exports.errToObject = errToObject;
|
|
146
|
-
// try {
|
|
147
|
-
// throw new TypeError('wow ok oops')
|
|
148
|
-
// } catch (error) {
|
|
149
|
-
// const err = new ErrorParser(error)
|
|
150
|
-
// console.log('----------------------')
|
|
151
|
-
// console.log({
|
|
152
|
-
// name: err.name,
|
|
153
|
-
// message: err.message,
|
|
154
|
-
// summary: err.summary,
|
|
155
|
-
// })
|
|
156
|
-
// console.log('----------------------')
|
|
157
|
-
// console.log(err.stack)
|
|
158
|
-
// console.log('----------------------')
|
|
159
|
-
// console.log(err.prettyStack())
|
|
160
|
-
// console.log('----------------------')
|
|
161
|
-
// console.log(err.toObject())
|
|
162
|
-
// console.log('----------------------')
|
|
163
|
-
// }
|
|
164
|
-
//# sourceMappingURL=ErrorParser.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorParser.js","sourceRoot":"","sources":["../../../../../../packages/cli/src/util/errors/ErrorParser.ts"],"names":[],"mappings":";;;;;;AAAA,8DAAgC;AAChC,gDAAuB;AAEvB,+DAA2D;AAC3D,2DAAuD;AACvD,kEAA8D;AAE9D,MAAa,WAAW;IACb,KAAK,CAAO;IAErB,YAAY,KAAc;QACxB,IAAI,CAAC,KAAK,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAA;IACxE,CAAC;IAED,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAA;IACxB,CAAC;IAED,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAA;IAC3B,CAAC;IAED,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE,CAAA;IAC/B,CAAC;IAED,OAAO;QACL,OAAO,IAAI,CAAC,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC,OAAO,CAAA;IACxC,CAAC;IAED,gBAAgB;QACd,OAAO,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IAClC,CAAC;IAED,WAAW,CAAC,iBAAsC;QAChD,OAAO,cAAc,CAAC,IAAI,CAAC,KAAK,EAAE,iBAAiB,CAAC,CAAA;IACtD,CAAC;IAED,QAAQ;QACN,OAAO,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IAChC,CAA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