@yamato-daiwa/es-extensions-nodejs 0.0.2 → 0.10.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/Distributable/ConsoleApplicationLogger.d.ts +68 -0
  2. package/Distributable/ConsoleApplicationLogger.js +435 -0
  3. package/Distributable/ConsoleCommandsParser/ConsoleCommandsParser.d.ts +289 -0
  4. package/Distributable/ConsoleCommandsParser/ConsoleCommandsParser.js +702 -0
  5. package/Distributable/ConsoleCommandsParser/ConsoleCommandsParserLocalization.english.d.ts +4 -0
  6. package/Distributable/ConsoleCommandsParser/ConsoleCommandsParserLocalization.english.js +118 -0
  7. package/Distributable/DateTime/NodeJS_Timer.d.ts +21 -7
  8. package/Distributable/DateTime/NodeJS_Timer.js +61 -13
  9. package/Distributable/DotEnvFilesGenerator.d.ts +13 -0
  10. package/Distributable/DotEnvFilesGenerator.js +21 -0
  11. package/Distributable/Errors/FileNotFoundError/FileNotFoundError.d.ts +25 -0
  12. package/Distributable/Errors/FileNotFoundError/FileNotFoundError.js +21 -0
  13. package/Distributable/Errors/FileNotFoundError/FileNotFoundErrorLocalization.english.d.ts +3 -0
  14. package/Distributable/Errors/FileNotFoundError/FileNotFoundErrorLocalization.english.js +7 -0
  15. package/Distributable/Errors/InvalidConsoleCommand/InvalidConsoleCommandError.d.ts +25 -0
  16. package/Distributable/Errors/InvalidConsoleCommand/InvalidConsoleCommandError.js +21 -0
  17. package/Distributable/Errors/InvalidConsoleCommand/InvalidConsoleCommandErrorLocalization.english.d.ts +3 -0
  18. package/Distributable/Errors/InvalidConsoleCommand/InvalidConsoleCommandErrorLocalization.english.js +7 -0
  19. package/Distributable/Errors/PathRefersToDirectoryNotFileError/PathRefersToDirectoryNotFileError.d.ts +25 -0
  20. package/Distributable/Errors/PathRefersToDirectoryNotFileError/PathRefersToDirectoryNotFileError.js +21 -0
  21. package/Distributable/Errors/PathRefersToDirectoryNotFileError/PathRefersToDirectoryNotFileErrorLocalization.english.d.ts +3 -0
  22. package/Distributable/Errors/PathRefersToDirectoryNotFileError/PathRefersToDirectoryNotFileErrorLocalization.english.js +7 -0
  23. package/Distributable/ImprovedFileSystem.d.ts +43 -0
  24. package/Distributable/ImprovedFileSystem.js +142 -0
  25. package/Distributable/ImprovedGlob.d.ts +57 -0
  26. package/Distributable/ImprovedGlob.js +275 -0
  27. package/Distributable/ImprovedPath/ImprovedPath.d.ts +59 -0
  28. package/Distributable/ImprovedPath/ImprovedPath.js +224 -0
  29. package/Distributable/ObjectDataFilesProcessor/ObjectDataFilesProcessor.d.ts +55 -0
  30. package/Distributable/ObjectDataFilesProcessor/ObjectDataFilesProcessor.js +228 -0
  31. package/Distributable/ObjectDataFilesProcessor/ObjectDataFilesProcessorLocalization.english.d.ts +4 -0
  32. package/Distributable/ObjectDataFilesProcessor/ObjectDataFilesProcessorLocalization.english.js +11 -0
  33. package/Distributable/Temporary/appendCharacterIfItDoesNotPresentInLastPosition.d.ts +4 -0
  34. package/Distributable/Temporary/appendCharacterIfItDoesNotPresentInLastPosition.js +7 -0
  35. package/Distributable/Temporary/extractLastExtensionOfFileName.d.ts +9 -0
  36. package/Distributable/Temporary/extractLastExtensionOfFileName.js +21 -0
  37. package/Distributable/index.d.ts +22 -7
  38. package/Distributable/index.js +45 -7
  39. package/Distributable/isErrnoException.d.ts +2 -0
  40. package/Distributable/isErrnoException.js +12 -0
  41. package/LICENSE +1 -1
  42. package/README.md +51 -3
  43. package/package.json +45 -15
  44. package/tsconfig.test.json +0 -4
@@ -0,0 +1,289 @@
1
+ import { RawObjectDataProcessor } from "@yamato-daiwa/es-extensions";
2
+ import type { ParsedJSON } from "@yamato-daiwa/es-extensions";
3
+ declare class ConsoleCommandsParser<TargetCommandsAndOptionsCombinations extends ConsoleCommandsParser.GeneralizedCommandsAndOptionsCombinations> {
4
+ static localization: ConsoleCommandsParser.Localization;
5
+ private static readonly MINIMAL_ARGUMENTS_COUNT_IN_VALID_CONSOLE_COMMAND;
6
+ private static readonly PARSING_METHOD_INVOCATION_EXPRESSION;
7
+ private readonly applicationName;
8
+ private readonly targetCommandPhrase;
9
+ private readonly targetCommandPhraseDescription?;
10
+ private readonly isTargetCommandPhraseDefault;
11
+ private readonly targetCommandOptions?;
12
+ private readonly targetCommandOptionsWhichHasNotBeenProcessedYet;
13
+ private readonly targetCommandOptionsSpecification?;
14
+ static parse<TargetCommandsAndOptionsCombinations extends ConsoleCommandsParser.GeneralizedCommandsAndOptionsCombinations>(commandLineInterfaceSpecification: ConsoleCommandsParser.CommandLineInterfaceSpecification, argumentsVector?: ReadonlyArray<string>): ConsoleCommandsParser.ParsedCommand<TargetCommandsAndOptionsCombinations>;
15
+ static generateFullHelpReference(commandLineInterfaceSpecification: ConsoleCommandsParser.CommandLineInterfaceSpecification): string;
16
+ private constructor();
17
+ private parseOptionsAndParameters;
18
+ private processStringTypeOptionValue;
19
+ private processNumberTypeOptionValue;
20
+ private extractAndValidateParsedJSON5_ParameterValue;
21
+ private static isCommandArgumentTheOption;
22
+ private static generateSingleCommandPhraseHelpReference;
23
+ private static generateSingleCommandOptionHelpReference;
24
+ private static validateCommandLineInterfaceSpecification;
25
+ }
26
+ declare namespace ConsoleCommandsParser {
27
+ type ParsedCommand<TargetCommandsAndOptionsCombinations extends GeneralizedCommandsAndOptionsCombinations> = Readonly<{
28
+ NodeJS_InterpreterAbsolutePath: string;
29
+ executableFileAbsolutePath: string;
30
+ phrase?: string;
31
+ }> & TargetCommandsAndOptionsCombinations;
32
+ type GeneralizedCommandsAndOptionsCombinations = {
33
+ [name: string]: string | number | boolean | ParsedJSON;
34
+ };
35
+ type CommandLineInterfaceSpecification = Readonly<{
36
+ applicationName: string;
37
+ applicationDescription?: string;
38
+ commandPhrases: Readonly<{
39
+ [commandPhrase: string]: CommandPhraseSpecification;
40
+ }>;
41
+ }>;
42
+ type CommandPhraseSpecification = Readonly<{
43
+ isDefault?: boolean;
44
+ description?: string;
45
+ options?: CommandOptionsSpecification;
46
+ }>;
47
+ type CommandOptionsSpecification = Readonly<{
48
+ [optionKey: string]: OptionSpecification;
49
+ }>;
50
+ type OptionSpecification = Readonly<{
51
+ description?: string;
52
+ shortcut?: string;
53
+ newName?: string;
54
+ }> & (StringOptionSpecification | NumberOptionSpecification | BooleanParameterSpecification | JSON5_ParameterSpecification);
55
+ type StringOptionSpecification = Readonly<{
56
+ type: ParametersTypes.string;
57
+ allowedAlternatives?: ReadonlyArray<string>;
58
+ }> & (Readonly<{
59
+ required: boolean;
60
+ }> | Readonly<{
61
+ defaultValue: string;
62
+ }>);
63
+ type NumberOptionSpecification = Readonly<{
64
+ type: ParametersTypes.number;
65
+ numbersSet: RawObjectDataProcessor.NumbersSets;
66
+ minimalValue?: number;
67
+ maximalValue?: number;
68
+ }> & (Readonly<{
69
+ required: boolean;
70
+ }> | Readonly<{
71
+ defaultValue: number;
72
+ }>);
73
+ type BooleanParameterSpecification = Readonly<{
74
+ type: ParametersTypes.boolean;
75
+ }>;
76
+ type JSON5_ParameterSpecification = Readonly<{
77
+ type: ParametersTypes.JSON5;
78
+ validValueSpecification: RawObjectDataProcessor.PropertiesSpecification;
79
+ }> & (Readonly<{
80
+ required: boolean;
81
+ }> | Readonly<{
82
+ defaultValue: ParsedJSON;
83
+ }>);
84
+ enum ParametersTypes {
85
+ string = "string",
86
+ number = "number",
87
+ boolean = "boolean",
88
+ JSON5 = "JSON5"
89
+ }
90
+ type Localization = Readonly<{
91
+ helpReference: Localization.HelpReference;
92
+ generateCheckTheCommandReferenceAsking: (commandReference: string) => string;
93
+ errorsMessages: {
94
+ argumentsVectorIsNotArray: Readonly<{
95
+ generate: (templateVariables: Localization.ErrorsMessages.ArgumentsVectorIsNotArray.TemplateVariables) => string;
96
+ }>;
97
+ argumentsVectorHasNotEnoughElements: Readonly<{
98
+ generate: (templateVariables: Localization.ErrorsMessages.RawArgumentsVectorHasNotEnoughElements.TemplateVariables) => string;
99
+ }>;
100
+ argumentsVectorHasNonStringElements: Readonly<{
101
+ generate: (templateVariables: Localization.ErrorsMessages.ArgumentsVectorHasNonStringElements.TemplateVariables) => string;
102
+ }>;
103
+ moreThanOneCommandPhrasesMarkedAsDefault: Readonly<{
104
+ generate: (templateVariables: Localization.ErrorsMessages.MoreThanOneCommandPhrasesMarkedAsDefault.TemplateVariables) => string;
105
+ }>;
106
+ noDefaultCommandPhraseAvailable: Readonly<{
107
+ generate: (templateVariables: Localization.ErrorsMessages.NoDefaultCommandPhraseAvailable.TemplateVariables) => string;
108
+ }>;
109
+ firstParameterLooksLikeCommandPhraseWhileNoCommandPhrasesAvailable: Readonly<{
110
+ generate: (templateVariables: Localization.ErrorsMessages.FirstParameterLooksLikeCommandPhraseWhileNoCommandPhrasesAvailable.TemplateVariables) => string;
111
+ }>;
112
+ unknownCommandPhrase: Readonly<{
113
+ generate: (templateVariables: Localization.ErrorsMessages.UnknownCommandPhrase.TemplateVariables) => string;
114
+ }>;
115
+ requiredOptionKeyIsMissing: Readonly<{
116
+ generate: (templateVariables: Localization.ErrorsMessages.RequiredOptionKeyIsMissing.TemplateVariables) => string;
117
+ }>;
118
+ noValueFollowingTheKeyOfNonBooleanOption: Readonly<{
119
+ generate: (templateVariables: Localization.ErrorsMessages.NoValueFollowingTheKeyOfNonBooleanOption.TemplateVariables) => string;
120
+ }>;
121
+ invalidCommandOptionTypeAtSpecification: Readonly<{
122
+ generate: (templateVariables: Localization.ErrorsMessages.InvalidCommandOptionTypeAtSpecification.TemplateVariables) => string;
123
+ }>;
124
+ unknownOptionsFoundForSpecificCommand: Readonly<{
125
+ generate: (templateVariables: Localization.ErrorsMessages.UnknownOptionsFoundForSpecificCommand.TemplateVariables) => string;
126
+ }>;
127
+ optionValueIsNotAmongAllowedAlternatives: Readonly<{
128
+ generate: (templateVariables: Localization.ErrorsMessages.OptionValueIsNotAmongAllowedAlternatives.TemplateVariables) => string;
129
+ }>;
130
+ unparsableNumericOptionValue: Readonly<{
131
+ generate: (templateVariables: Localization.ErrorsMessages.UnparsableNumericOptionValue.TemplateVariables) => string;
132
+ }>;
133
+ numericOptionValueIsNotBelongToExpectedNumbersSet: Readonly<{
134
+ generate: (templateVariables: Localization.ErrorsMessages.NumericOptionValueIsNotBelongToExpectedNumbersSet.TemplateVariables) => string;
135
+ }>;
136
+ numericValueIsSmallerThanRequiredMinimum: Readonly<{
137
+ generate: (templateVariables: Localization.ErrorsMessages.NumericValueIsSmallerThanRequiredMinimum.TemplateVariables) => string;
138
+ }>;
139
+ numericValueIsGreaterThanAllowedMaximum: Readonly<{
140
+ generate: (templateVariables: Localization.ErrorsMessages.NumericValueIsGreaterThanAllowedMaximum.TemplateVariables) => string;
141
+ }>;
142
+ malformedJSON5_Option: Readonly<{
143
+ generate: (templateVariables: Localization.ErrorsMessages.MalformedJSON5_Option.TemplateVariables) => string;
144
+ }>;
145
+ JSON5_OptionDoesNotMatchWithValidDataSchema: Readonly<{
146
+ generate: (templateVariables: Localization.ErrorsMessages.JSON5_OptionDoesNotMatchWithValidDataSchema.TemplateVariables) => string;
147
+ }>;
148
+ };
149
+ }>;
150
+ namespace Localization {
151
+ type HelpReference = Readonly<{
152
+ defaultCommandPhrase__parenthetical: string;
153
+ options: string;
154
+ shortcut: string;
155
+ type: string;
156
+ isRequired: string;
157
+ defaultValue: string;
158
+ yes: string;
159
+ no: string;
160
+ allowedAlternatives: string;
161
+ numbersSet: Readonly<{
162
+ key: string;
163
+ generateValue: (numbersSet: RawObjectDataProcessor.NumbersSets) => string;
164
+ }>;
165
+ minimalValue: string;
166
+ maximalValue: string;
167
+ objectTypeValuePropertiesSpecification: string;
168
+ }>;
169
+ namespace ErrorsMessages {
170
+ namespace ArgumentsVectorIsNotArray {
171
+ type TemplateVariables = Readonly<{
172
+ stringifiedActualValueOfArgumentsVector: string;
173
+ }>;
174
+ }
175
+ namespace RawArgumentsVectorHasNotEnoughElements {
176
+ type TemplateVariables = Readonly<{
177
+ minimalElementsCountInArgumentsVector: number;
178
+ actualElementsCountInArgumentsVector: number;
179
+ stringifiedArgumentsVector: string;
180
+ }>;
181
+ }
182
+ namespace ArgumentsVectorHasNonStringElements {
183
+ type TemplateVariables = Readonly<{
184
+ stringifiedFormattedNonStringArguments: string;
185
+ }>;
186
+ }
187
+ namespace MoreThanOneCommandPhrasesMarkedAsDefault {
188
+ type TemplateVariables = Readonly<{
189
+ formattedListOfCommandsPhrasesMarkedAsDefault: string;
190
+ }>;
191
+ }
192
+ namespace NoDefaultCommandPhraseAvailable {
193
+ type TemplateVariables = Readonly<{
194
+ helpReference: string;
195
+ }>;
196
+ }
197
+ namespace FirstParameterLooksLikeCommandPhraseWhileNoCommandPhrasesAvailable {
198
+ type TemplateVariables = Readonly<{
199
+ commandPhraseLikeArgument: string;
200
+ helpReference: string;
201
+ }>;
202
+ }
203
+ namespace UnknownCommandPhrase {
204
+ type TemplateVariables = Readonly<{
205
+ inputtedCommandPhrase: string;
206
+ helpReference: string;
207
+ }>;
208
+ }
209
+ namespace UnknownOptionsFoundForSpecificCommand {
210
+ type TemplateVariables = Readonly<{
211
+ commandPhrase?: string;
212
+ formattedUnknownOptions: string;
213
+ commandHelpReference: string;
214
+ }>;
215
+ }
216
+ namespace InvalidCommandOptionTypeAtSpecification {
217
+ type TemplateVariables = Readonly<{
218
+ optionName: string;
219
+ typeName: string;
220
+ }>;
221
+ }
222
+ namespace RequiredOptionKeyIsMissing {
223
+ type TemplateVariables = Readonly<{
224
+ commandPhrase: string;
225
+ isDefaultCommandPhrase: boolean;
226
+ missingOptionKey: string;
227
+ commandHelpReference: string;
228
+ }>;
229
+ }
230
+ namespace NoValueFollowingTheKeyOfNonBooleanOption {
231
+ type TemplateVariables = Readonly<{
232
+ targetOptionKey: string;
233
+ commandHelpReference: string;
234
+ }>;
235
+ }
236
+ namespace OptionValueIsNotAmongAllowedAlternatives {
237
+ type TemplateVariables = Readonly<{
238
+ targetOptionKey: string;
239
+ actualOptionValue: string;
240
+ commandHelpReference: string;
241
+ }>;
242
+ }
243
+ namespace UnparsableNumericOptionValue {
244
+ type TemplateVariables = Readonly<{
245
+ targetOptionKey: string;
246
+ actualOptionValue: string;
247
+ commandHelpReference: string;
248
+ }>;
249
+ }
250
+ namespace NumericOptionValueIsNotBelongToExpectedNumbersSet {
251
+ type TemplateVariables = Readonly<{
252
+ targetOptionKey: string;
253
+ expectedNumbersSet: RawObjectDataProcessor.NumbersSets;
254
+ actualOptionValue: string;
255
+ commandHelpReference: string;
256
+ }>;
257
+ }
258
+ namespace NumericValueIsSmallerThanRequiredMinimum {
259
+ type TemplateVariables = Readonly<{
260
+ targetOptionKey: string;
261
+ requiredMinimum: number;
262
+ actualOptionValue: string;
263
+ commandHelpReference: string;
264
+ }>;
265
+ }
266
+ namespace NumericValueIsGreaterThanAllowedMaximum {
267
+ type TemplateVariables = Readonly<{
268
+ targetOptionKey: string;
269
+ allowedMaximum: number;
270
+ actualOptionValue: string;
271
+ commandHelpReference: string;
272
+ }>;
273
+ }
274
+ namespace MalformedJSON5_Option {
275
+ type TemplateVariables = Readonly<{
276
+ targetOptionKey: string;
277
+ commandHelpReference: string;
278
+ }>;
279
+ }
280
+ namespace JSON5_OptionDoesNotMatchWithValidDataSchema {
281
+ type TemplateVariables = Readonly<{
282
+ targetOptionKey: string;
283
+ formattedValidationErrorsMessages: string;
284
+ }>;
285
+ }
286
+ }
287
+ }
288
+ }
289
+ export default ConsoleCommandsParser;