@bemoje/cli 0.0.21 → 0.0.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. package/cjs/cli/src/arg/ArgumentBuilder.d.ts +23 -0
  2. package/cjs/cli/src/arg/ArgumentBuilder.d.ts.map +1 -0
  3. package/cjs/cli/src/arg/ArgumentBuilder.js +52 -0
  4. package/cjs/cli/src/arg/ArgumentBuilder.js.map +1 -0
  5. package/cjs/cli/src/arg/ArgumentParserSelector.d.ts +9 -0
  6. package/cjs/cli/src/arg/ArgumentParserSelector.d.ts.map +1 -0
  7. package/cjs/cli/src/arg/ArgumentParserSelector.js +15 -0
  8. package/cjs/cli/src/arg/ArgumentParserSelector.js.map +1 -0
  9. package/cjs/cli/src/arg/ArgumentReader.d.ts +15 -0
  10. package/cjs/cli/src/arg/ArgumentReader.d.ts.map +1 -0
  11. package/cjs/cli/src/arg/ArgumentReader.js +38 -0
  12. package/cjs/cli/src/arg/ArgumentReader.js.map +1 -0
  13. package/cjs/cli/src/arg/ArgumentValidatorSelector.d.ts +8 -0
  14. package/cjs/cli/src/arg/ArgumentValidatorSelector.d.ts.map +1 -0
  15. package/cjs/cli/src/arg/ArgumentValidatorSelector.js +16 -0
  16. package/cjs/cli/src/arg/ArgumentValidatorSelector.js.map +1 -0
  17. package/cjs/cli/src/cmd/CommandBuilder.d.ts +389 -0
  18. package/cjs/cli/src/cmd/CommandBuilder.d.ts.map +1 -0
  19. package/cjs/cli/src/cmd/CommandBuilder.js +1238 -0
  20. package/cjs/cli/src/cmd/CommandBuilder.js.map +1 -0
  21. package/cjs/cli/src/cmd/CommandBuilderMetaData.d.ts +26 -0
  22. package/cjs/cli/src/cmd/CommandBuilderMetaData.d.ts.map +1 -0
  23. package/cjs/cli/src/cmd/CommandBuilderMetaData.js +45 -0
  24. package/cjs/cli/src/cmd/CommandBuilderMetaData.js.map +1 -0
  25. package/cjs/cli/src/cmd/CommandFeatureSelector.d.ts +80 -0
  26. package/cjs/cli/src/cmd/CommandFeatureSelector.d.ts.map +1 -0
  27. package/cjs/cli/src/cmd/CommandFeatureSelector.js +114 -0
  28. package/cjs/cli/src/cmd/CommandFeatureSelector.js.map +1 -0
  29. package/cjs/cli/src/cmd/DefaultHelpConfig.d.ts +29 -0
  30. package/cjs/cli/src/cmd/DefaultHelpConfig.d.ts.map +1 -0
  31. package/cjs/cli/src/cmd/DefaultHelpConfig.js +159 -0
  32. package/cjs/cli/src/cmd/DefaultHelpConfig.js.map +1 -0
  33. package/cjs/cli/src/core/OutputManager.d.ts +64 -0
  34. package/cjs/cli/src/core/OutputManager.d.ts.map +1 -0
  35. package/cjs/cli/src/core/OutputManager.js +97 -0
  36. package/cjs/cli/src/core/OutputManager.js.map +1 -0
  37. package/cjs/cli/src/core/ParserSelector.d.ts +17 -0
  38. package/cjs/cli/src/core/ParserSelector.d.ts.map +1 -0
  39. package/cjs/cli/src/core/ParserSelector.js +36 -0
  40. package/cjs/cli/src/core/ParserSelector.js.map +1 -0
  41. package/cjs/cli/src/core/ValidatorSelector.d.ts +17 -0
  42. package/cjs/cli/src/core/ValidatorSelector.d.ts.map +1 -0
  43. package/cjs/cli/src/core/ValidatorSelector.js +36 -0
  44. package/cjs/cli/src/core/ValidatorSelector.js.map +1 -0
  45. package/cjs/cli/src/core/splitCombinedArgvShorts.d.ts +2 -0
  46. package/cjs/cli/src/core/splitCombinedArgvShorts.d.ts.map +1 -0
  47. package/cjs/cli/src/core/splitCombinedArgvShorts.js +15 -0
  48. package/cjs/cli/src/core/splitCombinedArgvShorts.js.map +1 -0
  49. package/cjs/cli/src/db/AbstractJsonFileSection.d.ts +136 -0
  50. package/cjs/cli/src/db/AbstractJsonFileSection.d.ts.map +1 -0
  51. package/cjs/cli/src/db/AbstractJsonFileSection.js +189 -0
  52. package/cjs/cli/src/db/AbstractJsonFileSection.js.map +1 -0
  53. package/cjs/cli/src/db/AppDataSection.d.ts +30 -0
  54. package/cjs/cli/src/db/AppDataSection.d.ts.map +1 -0
  55. package/cjs/cli/src/db/AppDataSection.js +48 -0
  56. package/cjs/cli/src/db/AppDataSection.js.map +1 -0
  57. package/cjs/cli/src/db/ConfigSection.d.ts +46 -0
  58. package/cjs/cli/src/db/ConfigSection.d.ts.map +1 -0
  59. package/cjs/cli/src/db/ConfigSection.js +70 -0
  60. package/cjs/cli/src/db/ConfigSection.js.map +1 -0
  61. package/cjs/cli/src/db/JsonFile.d.ts +36 -0
  62. package/cjs/cli/src/db/JsonFile.d.ts.map +1 -0
  63. package/cjs/cli/src/db/JsonFile.js +59 -0
  64. package/cjs/cli/src/db/JsonFile.js.map +1 -0
  65. package/cjs/cli/src/db/PresetsSection.d.ts +45 -0
  66. package/cjs/cli/src/db/PresetsSection.d.ts.map +1 -0
  67. package/cjs/cli/src/db/PresetsSection.js +92 -0
  68. package/cjs/cli/src/db/PresetsSection.js.map +1 -0
  69. package/cjs/cli/src/index.d.ts +25 -0
  70. package/cjs/cli/src/index.d.ts.map +1 -0
  71. package/cjs/cli/src/index.js +28 -0
  72. package/cjs/cli/src/index.js.map +1 -0
  73. package/cjs/cli/src/opt/OptionArgumentParserSelector.d.ts +8 -0
  74. package/cjs/cli/src/opt/OptionArgumentParserSelector.d.ts.map +1 -0
  75. package/cjs/cli/src/opt/OptionArgumentParserSelector.js +16 -0
  76. package/cjs/cli/src/opt/OptionArgumentParserSelector.js.map +1 -0
  77. package/cjs/cli/src/opt/OptionArgumentValidatorSelector.d.ts +8 -0
  78. package/cjs/cli/src/opt/OptionArgumentValidatorSelector.d.ts.map +1 -0
  79. package/cjs/cli/src/opt/OptionArgumentValidatorSelector.js +19 -0
  80. package/cjs/cli/src/opt/OptionArgumentValidatorSelector.js.map +1 -0
  81. package/cjs/cli/src/opt/OptionBuilder.d.ts +32 -0
  82. package/cjs/cli/src/opt/OptionBuilder.d.ts.map +1 -0
  83. package/cjs/cli/src/opt/OptionBuilder.js +94 -0
  84. package/cjs/cli/src/opt/OptionBuilder.js.map +1 -0
  85. package/cjs/cli/src/opt/OptionHelpers.d.ts +33 -0
  86. package/cjs/cli/src/opt/OptionHelpers.d.ts.map +1 -0
  87. package/cjs/cli/src/opt/OptionHelpers.js +57 -0
  88. package/cjs/cli/src/opt/OptionHelpers.js.map +1 -0
  89. package/cjs/cli/src/opt/OptionReader.d.ts +24 -0
  90. package/cjs/cli/src/opt/OptionReader.d.ts.map +1 -0
  91. package/cjs/cli/src/opt/OptionReader.js +66 -0
  92. package/cjs/cli/src/opt/OptionReader.js.map +1 -0
  93. package/cjs/cli/src/types/IConfig.d.ts +22 -0
  94. package/cjs/cli/src/types/IConfig.d.ts.map +1 -0
  95. package/cjs/cli/src/types/IConfig.js +3 -0
  96. package/cjs/cli/src/types/IConfig.js.map +1 -0
  97. package/cjs/cli/src/types/IPreset.d.ts +15 -0
  98. package/cjs/cli/src/types/IPreset.d.ts.map +1 -0
  99. package/cjs/cli/src/types/IPreset.js +3 -0
  100. package/cjs/cli/src/types/IPreset.js.map +1 -0
  101. package/cjs/util/src/string/strEnsureEndsWith.d.ts +13 -0
  102. package/cjs/util/src/string/strEnsureEndsWith.d.ts.map +1 -0
  103. package/cjs/util/src/string/strEnsureEndsWith.js +19 -0
  104. package/cjs/util/src/string/strEnsureEndsWith.js.map +1 -0
  105. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OutputManager.d.ts","sourceRoot":"","sources":["../../../../../../../packages/cli/src/core/OutputManager.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAA;AAChC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAA;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAE7C;;GAEG;AACH,qBAAa,aAAa;IACxB;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAe;IAEtC;;;OAGG;IACH,MAAM,CAAC,WAAW;IAKlB;;OAEG;IACH,QAAQ,CAAC,MAAM,gBAAS;IAExB;;OAEG;IACH,QAAQ,CAAC,MAAM,iBAA8C;IAE7D;;OAEG;IACH,QAAQ,CAAC,MAAM,iBAA8C;IAE7D;;OAEG;IACH,QAAQ,CAAC,KAAK,iBAAuC;IAErD;;OAEG;IACH,SAAS,CAAC,QAAQ,CAAC,aAAa,EAAE,CAAC,MAAM,GAAG,CAAC,EAAE,CAAK;IAEpD;;;OAGG;;IAcH,IAAI,SAAS,WAEZ;IAED;;;;;;;OAOG;IACH,KAAK;IAQL;;;;;OAKG;IACH,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG;IAKzB;;OAEG;IACH,sBAAsB;CAIvB"}
@@ -0,0 +1,97 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OutputManager = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const ansi_colors_1 = tslib_1.__importDefault(require("ansi-colors"));
6
+ const util_1 = require("@bemoje/util");
7
+ /**
8
+ * The OutputManager class manages the output of debug messages to the console.
9
+ */
10
+ class OutputManager {
11
+ /**
12
+ * The singleton instance of the OutputManager class.
13
+ */
14
+ static instance;
15
+ /**
16
+ * Returns the singleton instance of the OutputManager class.
17
+ * If the instance does not exist, it creates a new one.
18
+ */
19
+ static getInstance() {
20
+ if (!this.instance)
21
+ this.instance = new OutputManager();
22
+ return this.instance;
23
+ }
24
+ /**
25
+ * Ansi-colors object
26
+ */
27
+ colors = ansi_colors_1.default;
28
+ /**
29
+ * A MethodDisabler instance for disabling the write method of the process.stdout object.
30
+ */
31
+ stdout = new util_1.MethodDisabler(process.stdout, 'write');
32
+ /**
33
+ * A MethodDisabler instance for disabling the write method of the process.stderr object.
34
+ */
35
+ stderr = new util_1.MethodDisabler(process.stderr, 'write');
36
+ /**
37
+ * A MethodDisabler instance for disabling the debug method of the console object.
38
+ */
39
+ debug = new util_1.MethodDisabler(console, 'debug');
40
+ /**
41
+ * An array that holds queued debug messages.
42
+ */
43
+ debugMsgQueue = [];
44
+ /**
45
+ * Constructs a new instance of the OutputManager class.
46
+ * console.debug is disabled by default.
47
+ */
48
+ constructor() {
49
+ this.debug.disable();
50
+ ansi_colors_1.default.enabled = (() => {
51
+ const { FORCE_COLOR, NODE_DISABLE_COLORS, NO_COLOR, TERM } = process.env;
52
+ return (!NODE_DISABLE_COLORS &&
53
+ NO_COLOR == null &&
54
+ TERM !== 'dumb' &&
55
+ ((FORCE_COLOR != null && FORCE_COLOR !== '0') || (process.stdout && process.stdout.isTTY)));
56
+ })();
57
+ }
58
+ get queueSize() {
59
+ return this.debugMsgQueue.length;
60
+ }
61
+ /**
62
+ * Resets the OutputManager to its default state.
63
+ * - Enables colors.
64
+ * - Enables the write method of the process.stdout object.
65
+ * - Enables the write method of the process.stderr object.
66
+ * - Disables the debug method of the console object.
67
+ * @returns The OutputManager instance.
68
+ */
69
+ reset() {
70
+ this.colors.enabled = true;
71
+ this.stdout.enable();
72
+ this.stderr.enable();
73
+ this.debug.disable();
74
+ return this;
75
+ }
76
+ /**
77
+ * Outputs a debug message to the console.
78
+ * If the debug method is enabled, the message is immediately logged to the console.
79
+ * Otherwise, the message is added to the debug message queue.
80
+ * @param fn - A function that returns the debug message.
81
+ */
82
+ outputDebug(fn) {
83
+ if (this.debug.isEnabled)
84
+ console.debug(fn());
85
+ else
86
+ this.debugMsgQueue.push(fn);
87
+ }
88
+ /**
89
+ * Drains the debug message queue by logging all the messages to the console.
90
+ */
91
+ drainDebugMessageQueue() {
92
+ this.debugMsgQueue.forEach((fn) => console.debug(fn()));
93
+ this.debugMsgQueue.splice(0, this.debugMsgQueue.length);
94
+ }
95
+ }
96
+ exports.OutputManager = OutputManager;
97
+ //# sourceMappingURL=OutputManager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OutputManager.js","sourceRoot":"","sources":["../../../../../../../packages/cli/src/core/OutputManager.ts"],"names":[],"mappings":";;;;AAAA,sEAAgC;AAEhC,uCAA6C;AAE7C;;GAEG;AACH,MAAa,aAAa;IACxB;;OAEG;IACK,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AAM,CAAC,MAAM,EAAE,CAAA;QACpB,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAA;QACpB,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAA;QACpB,OAAO,IAAI,CAAA;IACb,CAAC;IAED;;;;;OAKG;IACH,WAAW,CAAC,EAAa;QACvB,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS;YAAE,OAAO,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,CAAA;;YACxC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IAClC,CAAC;IAED;;OAEG;IACH,sBAAsB;QACpB,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,CAAA;QACvD,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,CAAA;IACzD,CAAC;CACF;AA/FD,sCA+FC"}
@@ -0,0 +1,17 @@
1
+ import { ArgumentBuilder } from '../arg/ArgumentBuilder';
2
+ import type { JsonValue } from '@bemoje/util';
3
+ import { OptionBuilder } from '../opt/OptionBuilder';
4
+ import type { TStringParser } from '@bemoje/util';
5
+ export declare abstract class ParserSelector<Builder extends ArgumentBuilder | OptionBuilder> {
6
+ protected readonly builder: Builder;
7
+ constructor(builder: Builder);
8
+ abstract custom<T extends JsonValue>(parser: TStringParser<T>): Builder;
9
+ string(): Builder;
10
+ number(): Builder;
11
+ integer(): Builder;
12
+ delimitedStrings(delimiter?: string): Builder;
13
+ delimitedNumbers(delimiter?: string): Builder;
14
+ delimitedIntegers(delimiter?: string): Builder;
15
+ delimited<T extends JsonValue>(delimiter: string, parser: TStringParser<T>): Builder;
16
+ }
17
+ //# sourceMappingURL=ParserSelector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ParserSelector.d.ts","sourceRoot":"","sources":["../../../../../../../packages/cli/src/core/ParserSelector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAExD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAIpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAEjD,8BAAsB,cAAc,CAAC,OAAO,SAAS,eAAe,GAAG,aAAa;IACtE,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,OAAO;gBAAhB,OAAO,EAAE,OAAO;IAE/C,QAAQ,CAAC,MAAM,CAAC,CAAC,SAAS,SAAS,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,OAAO;IAEvE,MAAM;IAGN,MAAM;IAGN,OAAO;IAIP,gBAAgB,CAAC,SAAS,SAAM;IAGhC,gBAAgB,CAAC,SAAS,SAAM;IAGhC,iBAAiB,CAAC,SAAS,SAAM;IAIjC,SAAS,CAAC,CAAC,SAAS,SAAS,EAAE,SAAS,QAAM,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC;CAGzE"}
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ParserSelector = void 0;
4
+ const util_1 = require("@bemoje/util");
5
+ const util_2 = require("@bemoje/util");
6
+ const util_3 = require("@bemoje/util");
7
+ const util_4 = require("@bemoje/util");
8
+ class ParserSelector {
9
+ builder;
10
+ constructor(builder) {
11
+ this.builder = builder;
12
+ }
13
+ string() {
14
+ return this.custom(util_4.parseString);
15
+ }
16
+ number() {
17
+ return this.custom(util_3.parseNumber);
18
+ }
19
+ integer() {
20
+ return this.custom(util_2.parseInteger);
21
+ }
22
+ delimitedStrings(delimiter = ',') {
23
+ return this.delimited(delimiter, util_4.parseString);
24
+ }
25
+ delimitedNumbers(delimiter = ',') {
26
+ return this.delimited(delimiter, util_3.parseNumber);
27
+ }
28
+ delimitedIntegers(delimiter = ',') {
29
+ return this.delimited(delimiter, util_2.parseInteger);
30
+ }
31
+ delimited(delimiter = ',', parser) {
32
+ return this.custom((0, util_1.createTypedListParser)(delimiter, parser));
33
+ }
34
+ }
35
+ exports.ParserSelector = ParserSelector;
36
+ //# sourceMappingURL=ParserSelector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ParserSelector.js","sourceRoot":"","sources":["../../../../../../../packages/cli/src/core/ParserSelector.ts"],"names":[],"mappings":";;;AACA,uCAAoD;AAGpD,uCAA2C;AAC3C,uCAA0C;AAC1C,uCAA0C;AAG1C,MAAsB,cAAc;IACH;IAA/B,YAA+B,OAAgB;QAAhB,YAAO,GAAP,OAAO,CAAS;IAAG,CAAC;IAInD,MAAM;QACJ,OAAO,IAAI,CAAC,MAAM,CAAS,kBAAW,CAAC,CAAA;IACzC,CAAC;IACD,MAAM;QACJ,OAAO,IAAI,CAAC,MAAM,CAAS,kBAAW,CAAC,CAAA;IACzC,CAAC;IACD,OAAO;QACL,OAAO,IAAI,CAAC,MAAM,CAAS,mBAAY,CAAC,CAAA;IAC1C,CAAC;IAED,gBAAgB,CAAC,SAAS,GAAG,GAAG;QAC9B,OAAO,IAAI,CAAC,SAAS,CAAS,SAAS,EAAE,kBAAW,CAAC,CAAA;IACvD,CAAC;IACD,gBAAgB,CAAC,SAAS,GAAG,GAAG;QAC9B,OAAO,IAAI,CAAC,SAAS,CAAS,SAAS,EAAE,kBAAW,CAAC,CAAA;IACvD,CAAC;IACD,iBAAiB,CAAC,SAAS,GAAG,GAAG;QAC/B,OAAO,IAAI,CAAC,SAAS,CAAS,SAAS,EAAE,mBAAY,CAAC,CAAA;IACxD,CAAC;IAED,SAAS,CAAsB,SAAS,GAAG,GAAG,EAAE,MAAwB;QACtE,OAAO,IAAI,CAAC,MAAM,CAAC,IAAA,4BAAqB,EAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAA;IAC9D,CAAC;CACF;AA5BD,wCA4BC"}
@@ -0,0 +1,17 @@
1
+ import { ArgumentBuilder } from '../arg/ArgumentBuilder';
2
+ import type { JsonValue } from '@bemoje/util';
3
+ import { OptionBuilder } from '../opt/OptionBuilder';
4
+ import type { TValidator } from '@bemoje/util';
5
+ export declare abstract class ValidatorSelector<Builder extends OptionBuilder | ArgumentBuilder> {
6
+ protected readonly builder: Builder;
7
+ constructor(builder: Builder);
8
+ abstract custom<O>(validator: TValidator<O>): typeof this.builder;
9
+ isString(): Builder;
10
+ isNumber(): Builder;
11
+ isInteger(): Builder;
12
+ isStringArray(): Builder;
13
+ isNumberArray(): Builder;
14
+ isIntegerArray(): Builder;
15
+ arrayWhereEach<O extends JsonValue = JsonValue>(...validators: TValidator<O>[]): Builder;
16
+ }
17
+ //# sourceMappingURL=ValidatorSelector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ValidatorSelector.d.ts","sourceRoot":"","sources":["../../../../../../../packages/cli/src/core/ValidatorSelector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAKxD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAE9C,8BAAsB,iBAAiB,CAAC,OAAO,SAAS,aAAa,GAAG,eAAe;IACzE,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,OAAO;gBAAhB,OAAO,EAAE,OAAO;IAE/C,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,OAAO,IAAI,CAAC,OAAO;IAEjE,QAAQ;IAGR,QAAQ;IAGR,SAAS;IAIT,aAAa;IAGb,aAAa;IAGb,cAAc;IAId,cAAc,CAAC,CAAC,SAAS,SAAS,GAAG,SAAS,EAAE,GAAG,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE;CAG/E"}
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ValidatorSelector = void 0;
4
+ const util_1 = require("@bemoje/util");
5
+ const util_2 = require("@bemoje/util");
6
+ const util_3 = require("@bemoje/util");
7
+ const util_4 = require("@bemoje/util");
8
+ class ValidatorSelector {
9
+ builder;
10
+ constructor(builder) {
11
+ this.builder = builder;
12
+ }
13
+ isString() {
14
+ return this.custom(util_3.isString);
15
+ }
16
+ isNumber() {
17
+ return this.custom(util_4.isValidNumber);
18
+ }
19
+ isInteger() {
20
+ return this.custom(util_2.isInteger);
21
+ }
22
+ isStringArray() {
23
+ return this.arrayWhereEach(util_3.isString);
24
+ }
25
+ isNumberArray() {
26
+ return this.arrayWhereEach(util_4.isValidNumber);
27
+ }
28
+ isIntegerArray() {
29
+ return this.arrayWhereEach(util_2.isInteger);
30
+ }
31
+ arrayWhereEach(...validators) {
32
+ return this.custom((0, util_1.createTypedArrayValidator)(validators));
33
+ }
34
+ }
35
+ exports.ValidatorSelector = ValidatorSelector;
36
+ //# sourceMappingURL=ValidatorSelector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ValidatorSelector.js","sourceRoot":"","sources":["../../../../../../../packages/cli/src/core/ValidatorSelector.ts"],"names":[],"mappings":";;;AACA,uCAAwD;AACxD,uCAAwC;AACxC,uCAAuC;AACvC,uCAA4C;AAK5C,MAAsB,iBAAiB;IACN;IAA/B,YAA+B,OAAgB;QAAhB,YAAO,GAAP,OAAO,CAAS;IAAG,CAAC;IAInD,QAAQ;QACN,OAAO,IAAI,CAAC,MAAM,CAAC,eAAQ,CAAC,CAAA;IAC9B,CAAC;IACD,QAAQ;QACN,OAAO,IAAI,CAAC,MAAM,CAAC,oBAAa,CAAC,CAAA;IACnC,CAAC;IACD,SAAS;QACP,OAAO,IAAI,CAAC,MAAM,CAAC,gBAAS,CAAC,CAAA;IAC/B,CAAC;IAED,aAAa;QACX,OAAO,IAAI,CAAC,cAAc,CAAC,eAAQ,CAAC,CAAA;IACtC,CAAC;IACD,aAAa;QACX,OAAO,IAAI,CAAC,cAAc,CAAC,oBAAa,CAAC,CAAA;IAC3C,CAAC;IACD,cAAc;QACZ,OAAO,IAAI,CAAC,cAAc,CAAC,gBAAS,CAAC,CAAA;IACvC,CAAC;IAED,cAAc,CAAkC,GAAG,UAA2B;QAC5E,OAAO,IAAI,CAAC,MAAM,CAAC,IAAA,gCAAyB,EAAC,UAAU,CAAC,CAAC,CAAA;IAC3D,CAAC;CACF;AA5BD,8CA4BC"}
@@ -0,0 +1,2 @@
1
+ export declare function splitCombinedArgvShorts(argv: string[]): string[];
2
+ //# sourceMappingURL=splitCombinedArgvShorts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"splitCombinedArgvShorts.d.ts","sourceRoot":"","sources":["../../../../../../../packages/cli/src/core/splitCombinedArgvShorts.ts"],"names":[],"mappings":"AAAA,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,EAAE,YASrD"}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.splitCombinedArgvShorts = void 0;
4
+ function splitCombinedArgvShorts(argv) {
5
+ return argv
6
+ .map((arg) => {
7
+ if (arg.length < 3 || !arg.startsWith('-') || arg.startsWith('--') || arg.includes('=')) {
8
+ return arg;
9
+ }
10
+ return Array.from(arg.replace('-', '')).map((s) => '-' + s);
11
+ })
12
+ .flat();
13
+ }
14
+ exports.splitCombinedArgvShorts = splitCombinedArgvShorts;
15
+ //# sourceMappingURL=splitCombinedArgvShorts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"splitCombinedArgvShorts.js","sourceRoot":"","sources":["../../../../../../../packages/cli/src/core/splitCombinedArgvShorts.ts"],"names":[],"mappings":";;;AAAA,SAAgB,uBAAuB,CAAC,IAAc;IACpD,OAAO,IAAI;SACR,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;QACX,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;YACvF,OAAO,GAAG,CAAA;SACX;QACD,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,CAAA;IAC7D,CAAC,CAAC;SACD,IAAI,EAAE,CAAA;AACX,CAAC;AATD,0DASC"}
@@ -0,0 +1,136 @@
1
+ import { Any, JsonValue } from '@bemoje/util';
2
+ import { JsonFile } from './JsonFile';
3
+ /**
4
+ * A class that represents a section of the JSON file used as a simple database.
5
+ */
6
+ export declare abstract class AbstractJsonFileSection<Val = JsonValue> {
7
+ readonly file: JsonFile;
8
+ protected readonly name: string;
9
+ protected readonly keysAreFixed: boolean;
10
+ /**
11
+ * Indicates whether the section has been initialized.
12
+ */
13
+ protected isInitialized: boolean;
14
+ /**
15
+ * The default values for the section.
16
+ */
17
+ readonly defaultValues: Record<string, Val>;
18
+ /**
19
+ * The base string used as a prefix for the section.
20
+ */
21
+ readonly prefixBaseString: string;
22
+ /**
23
+ * Creates an instance of AbstractJsonFileSection.
24
+ * @param file - The parent JsonFile instance.
25
+ * @param name - The name of the section.
26
+ * @param keysAreFixed - Indicates whether the keys in the section are fixed.
27
+ */
28
+ constructor(file: JsonFile, name: string, keysAreFixed: boolean);
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
+ abstract 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
+ abstract defineProperty(key: string, options: Any): 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
+ abstract initialize(save?: boolean): void | string;
47
+ /**
48
+ * The JsonDB associated with the section.
49
+ */
50
+ get db(): import("@bemoje/util").JsonDB;
51
+ /**
52
+ * The CommandBuilder associated with the section.
53
+ */
54
+ get cmd(): import("..").CommandBuilder<unknown[], import("@commander-js/extra-typings").OptionValues>;
55
+ /**
56
+ * Saves the section.
57
+ * @returns A promise that resolves when the section is saved.
58
+ */
59
+ save(): Promise<void>;
60
+ /**
61
+ * Gets the object path prefix as dot-separated keys for this section of the JSON file database.
62
+ * @param key - An optional key to append to the prefix path.
63
+ * @returns The object path prefix.
64
+ * @throws An error if the keys are fixed and the specified key does not exist in the default values.
65
+ */
66
+ prefix(key?: string): string;
67
+ /**
68
+ * Gets the value associated with the specified key.
69
+ * @param key - The key to get the value for.
70
+ * @returns The value associated with the key.
71
+ */
72
+ get<T extends Val = Val>(key: string): T;
73
+ /**
74
+ * Gets all the values in the section.
75
+ * @returns All the values in the section.
76
+ */
77
+ getAll(): Record<string, Val>;
78
+ /**
79
+ * Gets the keys in the section.
80
+ * @returns The keys in the section.
81
+ */
82
+ get keys(): string[];
83
+ /**
84
+ * Gets the number of keys in the section.
85
+ * @returns The number of keys in the section.
86
+ */
87
+ count(): number;
88
+ /**
89
+ * Sets the value associated with the specified key.
90
+ * @param key - The key to set the value for.
91
+ * @param value - The value to set.
92
+ * @param save - Indicates whether to save the section after setting the value.
93
+ */
94
+ set(key: string, value: Val, save?: boolean): void;
95
+ /**
96
+ * Sets all the values in the section.
97
+ * @param values - The values to set.
98
+ * @param save - Indicates whether to save the section after setting the values.
99
+ */
100
+ setAll(values: typeof this.defaultValues, save?: boolean): void;
101
+ /**
102
+ * Updates the value associated with the specified key.
103
+ * @param key - The key to set the value for.
104
+ * @param callback - The callback function that returns the new value.
105
+ * @param save - Indicates whether to save the section after setting the value.
106
+ */
107
+ update(key: string, callback: (val: Val, key: string) => Val, save?: boolean): void;
108
+ /**
109
+ * Resets the value associated with the specified key to its default value.
110
+ * @param key - The key to reset.
111
+ * @param save - Indicates whether to save the section after resetting the value.
112
+ */
113
+ reset(key: string, save?: boolean): void;
114
+ /**
115
+ * Resets all the values in the section to their default values.
116
+ * @param save - Indicates whether to save the section after resetting the values.
117
+ */
118
+ resetAll(save?: boolean): void;
119
+ /**
120
+ * Deletes the value associated with the specified key.
121
+ * @param key - The key to delete.
122
+ * @param save - Indicates whether to save the section after deleting the value.
123
+ */
124
+ delete(key: string, save?: boolean): void;
125
+ /**
126
+ * Deletes all the values in the section.
127
+ * @param save - Indicates whether to save the section after deleting the values.
128
+ */
129
+ deleteAll(save?: boolean): void;
130
+ /**
131
+ * Edits the values in the section using a text editor.
132
+ * @param editor - The text editor to use. If not specified, the default text editor command will be used.
133
+ */
134
+ edit(editor?: string): void;
135
+ }
136
+ //# sourceMappingURL=AbstractJsonFileSection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AbstractJsonFileSection.d.ts","sourceRoot":"","sources":["../../../../../../../packages/cli/src/db/AbstractJsonFileSection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAA8B,SAAS,EAAsC,MAAM,cAAc,CAAA;AAC7G,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAErC;;GAEG;AACH,8BAAsB,uBAAuB,CAAC,GAAG,GAAG,SAAS;IAsB/C,QAAQ,CAAC,IAAI,EAAE,QAAQ;IAAE,SAAS,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM;IAAE,SAAS,CAAC,QAAQ,CAAC,YAAY,EAAE,OAAO;IArB9G;;OAEG;IACH,SAAS,CAAC,aAAa,UAAQ;IAE/B;;OAEG;IACH,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAK;IAEhD;;OAEG;IACH,QAAQ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G;IACH,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,UAAO;IAK/B;;;OAGG;IACH,SAAS,CAAC,IAAI,UAAO;IAOrB;;;OAGG;IACH,IAAI,CAAC,MAAM,CAAC,EAAE,MAAM;CAKrB"}
@@ -0,0 +1,189 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AbstractJsonFileSection = void 0;
4
+ const util_1 = require("@bemoje/util");
5
+ /**
6
+ * A class that represents a section of the JSON file used as a simple database.
7
+ */
8
+ class AbstractJsonFileSection {
9
+ file;
10
+ name;
11
+ keysAreFixed;
12
+ /**
13
+ * Indicates whether the section has been initialized.
14
+ */
15
+ isInitialized = false;
16
+ /**
17
+ * The default values for the section.
18
+ */
19
+ defaultValues = {};
20
+ /**
21
+ * The base string used as a prefix for the section.
22
+ */
23
+ prefixBaseString;
24
+ /**
25
+ * Creates an instance of AbstractJsonFileSection.
26
+ * @param file - The parent JsonFile instance.
27
+ * @param name - The name of the section.
28
+ * @param keysAreFixed - Indicates whether the keys in the section are fixed.
29
+ */
30
+ constructor(file, name, keysAreFixed) {
31
+ this.file = file;
32
+ this.name = name;
33
+ this.keysAreFixed = keysAreFixed;
34
+ this.prefixBaseString = file.cmd.getPrefixArray().join('_');
35
+ }
36
+ /**
37
+ * The JsonDB associated with the section.
38
+ */
39
+ get db() {
40
+ return this.file.db;
41
+ }
42
+ /**
43
+ * The CommandBuilder associated with the section.
44
+ */
45
+ get cmd() {
46
+ return this.file.cmd;
47
+ }
48
+ /**
49
+ * Saves the section.
50
+ * @returns A promise that resolves when the section is saved.
51
+ */
52
+ async save() {
53
+ return await this.db.save();
54
+ }
55
+ /**
56
+ * Gets the object path prefix as dot-separated keys for this section of the JSON file database.
57
+ * @param key - An optional key to append to the prefix path.
58
+ * @returns The object path prefix.
59
+ * @throws An error if the keys are fixed and the specified key does not exist in the default values.
60
+ */
61
+ prefix(key) {
62
+ if (this.keysAreFixed && key && !Object.hasOwn(this.defaultValues, key)) {
63
+ throw new Error(`No entry with key '${key}'`);
64
+ }
65
+ return this.prefixBaseString + '.' + this.name + (key ? '.' + key : '');
66
+ }
67
+ /**
68
+ * Gets the value associated with the specified key.
69
+ * @param key - The key to get the value for.
70
+ * @returns The value associated with the key.
71
+ */
72
+ get(key) {
73
+ this.initialize(false);
74
+ return this.db.getSafe(this.prefix(key)) ?? this.defaultValues[key];
75
+ }
76
+ /**
77
+ * Gets all the values in the section.
78
+ * @returns All the values in the section.
79
+ */
80
+ getAll() {
81
+ this.initialize(false);
82
+ return (this.db.getSafe(this.prefix()) ?? JSON.parse(JSON.stringify(this.defaultValues)));
83
+ }
84
+ /**
85
+ * Gets the keys in the section.
86
+ * @returns The keys in the section.
87
+ */
88
+ get keys() {
89
+ // if (this.keysAreFixed) return Object.keys(this.defaultValues)
90
+ return Object.keys(this.getAll());
91
+ }
92
+ /**
93
+ * Gets the number of keys in the section.
94
+ * @returns The number of keys in the section.
95
+ */
96
+ count() {
97
+ return this.keys.length;
98
+ }
99
+ /**
100
+ * Sets the value associated with the specified key.
101
+ * @param key - The key to set the value for.
102
+ * @param value - The value to set.
103
+ * @param save - Indicates whether to save the section after setting the value.
104
+ */
105
+ set(key, value, save = true) {
106
+ this.initialize();
107
+ this.assertValid(key, value);
108
+ this.db.set(this.prefix(key), value, save);
109
+ }
110
+ /**
111
+ * Sets all the values in the section.
112
+ * @param values - The values to set.
113
+ * @param save - Indicates whether to save the section after setting the values.
114
+ */
115
+ setAll(values, save = true) {
116
+ const original = this.getAll();
117
+ for (const [key, value] of Object.entries(values)) {
118
+ if (value === original[key])
119
+ continue;
120
+ if (JSON.stringify(value) === JSON.stringify(original[key]))
121
+ continue;
122
+ this.set(key, value, false);
123
+ }
124
+ if (!this.keysAreFixed) {
125
+ for (const name of Object.keys(original)) {
126
+ if (Object.hasOwn(values, name))
127
+ continue;
128
+ this.delete(name, false);
129
+ }
130
+ }
131
+ if (save)
132
+ this.save();
133
+ }
134
+ /**
135
+ * Updates the value associated with the specified key.
136
+ * @param key - The key to set the value for.
137
+ * @param callback - The callback function that returns the new value.
138
+ * @param save - Indicates whether to save the section after setting the value.
139
+ */
140
+ update(key, callback, save = true) {
141
+ this.set(key, callback(this.get(key), key), save);
142
+ }
143
+ /**
144
+ * Resets the value associated with the specified key to its default value.
145
+ * @param key - The key to reset.
146
+ * @param save - Indicates whether to save the section after resetting the value.
147
+ */
148
+ reset(key, save = true) {
149
+ this.set(key, this.defaultValues[key], save);
150
+ }
151
+ /**
152
+ * Resets all the values in the section to their default values.
153
+ * @param save - Indicates whether to save the section after resetting the values.
154
+ */
155
+ resetAll(save = true) {
156
+ this.setAll(this.defaultValues, save);
157
+ }
158
+ /**
159
+ * Deletes the value associated with the specified key.
160
+ * @param key - The key to delete.
161
+ * @param save - Indicates whether to save the section after deleting the value.
162
+ */
163
+ delete(key, save = true) {
164
+ this.initialize();
165
+ this.db.delete(this.prefix(key), save);
166
+ }
167
+ /**
168
+ * Deletes all the values in the section.
169
+ * @param save - Indicates whether to save the section after deleting the values.
170
+ */
171
+ deleteAll(save = true) {
172
+ for (const key of this.keys) {
173
+ this.delete(key, false);
174
+ }
175
+ if (save)
176
+ this.save();
177
+ }
178
+ /**
179
+ * Edits the values in the section using a text editor.
180
+ * @param editor - The text editor to use. If not specified, the default text editor command will be used.
181
+ */
182
+ edit(editor) {
183
+ const original = this.getAll();
184
+ const parsed = (0, util_1.promptUserEditJsonInTextEditorSync)(original, editor || (0, util_1.defaultOpenInEditorCommand)());
185
+ this.setAll(parsed);
186
+ }
187
+ }
188
+ exports.AbstractJsonFileSection = AbstractJsonFileSection;
189
+ //# sourceMappingURL=AbstractJsonFileSection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AbstractJsonFileSection.js","sourceRoot":"","sources":["../../../../../../../packages/cli/src/db/AbstractJsonFileSection.ts"],"names":[],"mappings":";;;AAAA,uCAA6G;AAG7G;;GAEG;AACH,MAAsB,uBAAuB;IAsBtB;IAAmC;IA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IAAI,GAAG,IAAI;QACnB,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,IAAI,EAAE;YAC3B,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;SACxB;QACD,IAAI,IAAI;YAAE,IAAI,CAAC,IAAI,EAAE,CAAA;IACvB,CAAC;IAED;;;OAGG;IACH,IAAI,CAAC,MAAe;QAClB,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,EAAE,CAAA;QAC9B,MAAM,MAAM,GAAG,IAAA,yCAAkC,EAAC,QAAqB,EAAE,MAAM,IAAI,IAAA,iCAA0B,GAAE,CAAC,CAAA;QAChH,IAAI,CAAC,MAAM,CAAC,MAA6B,CAAC,CAAA;IAC5C,CAAC;CACF;AAhND,0DAgNC"}
@@ -0,0 +1,30 @@
1
+ import { AbstractJsonFileSection } from './AbstractJsonFileSection';
2
+ import { JsonFile } from './JsonFile';
3
+ import { JsonValue } from '@bemoje/util';
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
+ }
30
+ //# sourceMappingURL=AppDataSection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AppDataSection.d.ts","sourceRoot":"","sources":["../../../../../../../packages/cli/src/db/AppDataSection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAA;AACnE,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAExC;;GAEG;AACH,qBAAa,cAAc,CAAC,GAAG,SAAS,SAAS,GAAG,SAAS,CAAE,SAAQ,uBAAuB,CAAC,GAAG,CAAC;IACjG;;;;OAIG;gBACS,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM;IAIxC;;OAEG;IACM,WAAW;IAIpB;;;OAGG;IACM,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG;IAM/C;;;;OAIG;IACM,UAAU,CAAC,IAAI,UAAQ;CAMjC"}