@yamato-daiwa/es-extensions-nodejs 0.0.1 → 1.5.0-alpha.1
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/Distributable/ConsoleApplicationLogger.d.ts +47 -0
- package/Distributable/ConsoleApplicationLogger.js +416 -0
- package/Distributable/ConsoleCommandsParser/ConsoleCommandsParser.d.ts +160 -0
- package/Distributable/ConsoleCommandsParser/ConsoleCommandsParser.js +495 -0
- package/Distributable/ConsoleCommandsParser/ConsoleCommandsParserLocalization.english.d.ts +3 -0
- package/Distributable/ConsoleCommandsParser/ConsoleCommandsParserLocalization.english.js +51 -0
- package/Distributable/DateTime/NodeJS_Timer.d.ts +1 -1
- package/Distributable/DateTime/NodeJS_Timer.js +7 -4
- package/Distributable/Logging/Errors/InvalidConsoleCommandError.d.ts +23 -0
- package/Distributable/Logging/Errors/InvalidConsoleCommandError.js +27 -0
- package/Distributable/Logging/Errors/InvalidConsoleCommandErrorLocalization__English.d.ts +3 -0
- package/Distributable/Logging/Errors/InvalidConsoleCommandErrorLocalization__English.js +11 -0
- package/Distributable/index.d.ts +5 -3
- package/Distributable/index.js +15 -3
- package/README.md +13 -2
- package/package.json +22 -13
- package/tsconfig.test.json +0 -4
|
@@ -0,0 +1,495 @@
|
|
|
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
|
+
const es_extensions_1 = require("@yamato-daiwa/es-extensions");
|
|
7
|
+
const InvalidConsoleCommandError_1 = __importDefault(require("../Logging/Errors/InvalidConsoleCommandError"));
|
|
8
|
+
const json5_1 = __importDefault(require("json5"));
|
|
9
|
+
const ConsoleCommandsParserLocalization_english_1 = __importDefault(require("./ConsoleCommandsParserLocalization.english"));
|
|
10
|
+
class ConsoleCommandsParser {
|
|
11
|
+
constructor({ commandLineInterfaceSpecification, consciouslyInputtedArguments }) {
|
|
12
|
+
this.targetCommandOptions__eachOneWillBeRemovedOnceProcessed = [];
|
|
13
|
+
const helpReference = ConsoleCommandsParser.generateFullHelpReference(commandLineInterfaceSpecification);
|
|
14
|
+
const firstConsciouslyInputtedArgument = consciouslyInputtedArguments[0];
|
|
15
|
+
let targetCommandPhrase;
|
|
16
|
+
let targetCommandOptions;
|
|
17
|
+
let targetCommandOptionsSpecification;
|
|
18
|
+
if ((0, es_extensions_1.isUndefined)(firstConsciouslyInputtedArgument)) {
|
|
19
|
+
if ((0, es_extensions_1.isUndefined)(commandLineInterfaceSpecification.defaultCommand)) {
|
|
20
|
+
es_extensions_1.Logger.throwErrorAndLog({
|
|
21
|
+
errorInstance: new InvalidConsoleCommandError_1.default({
|
|
22
|
+
applicationName: commandLineInterfaceSpecification.applicationName,
|
|
23
|
+
messageSpecificPart: ConsoleCommandsParser.localization.
|
|
24
|
+
generateNoDefaultCommandPhraseAvailableErrorMessage(helpReference)
|
|
25
|
+
}),
|
|
26
|
+
title: InvalidConsoleCommandError_1.default.DEFAULT_TITLE,
|
|
27
|
+
occurrenceLocation: "ConsoleCommandsParser.parse(arrayedConsoleCommand, commandLineInterfaceSpecification)"
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
targetCommandOptionsSpecification = commandLineInterfaceSpecification.defaultCommand;
|
|
31
|
+
}
|
|
32
|
+
else if (ConsoleCommandsParser.isCommandArgumentTheOption(firstConsciouslyInputtedArgument)) {
|
|
33
|
+
if ((0, es_extensions_1.isUndefined)(commandLineInterfaceSpecification.defaultCommand)) {
|
|
34
|
+
es_extensions_1.Logger.throwErrorAndLog({
|
|
35
|
+
errorInstance: new InvalidConsoleCommandError_1.default({
|
|
36
|
+
applicationName: commandLineInterfaceSpecification.applicationName,
|
|
37
|
+
messageSpecificPart: ConsoleCommandsParser.localization.
|
|
38
|
+
generateNoDefaultCommandPhraseAvailableErrorMessage(helpReference)
|
|
39
|
+
}),
|
|
40
|
+
title: InvalidConsoleCommandError_1.default.DEFAULT_TITLE,
|
|
41
|
+
occurrenceLocation: "ConsoleCommandsParser.parse(arrayedConsoleCommand, commandLineInterfaceSpecification)"
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
targetCommandOptions = [...consciouslyInputtedArguments];
|
|
45
|
+
targetCommandOptionsSpecification = commandLineInterfaceSpecification.defaultCommand;
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
if ((0, es_extensions_1.isUndefined)(commandLineInterfaceSpecification.commandPhrases)) {
|
|
49
|
+
es_extensions_1.Logger.throwErrorAndLog({
|
|
50
|
+
errorInstance: new InvalidConsoleCommandError_1.default({
|
|
51
|
+
applicationName: commandLineInterfaceSpecification.applicationName,
|
|
52
|
+
messageSpecificPart: ConsoleCommandsParser.localization.
|
|
53
|
+
generateFirstParameterLooksLikeCommandPhraseWhileNoCommandPhrasesAvailableErrorMessage({
|
|
54
|
+
commandPhraseLikeArgument: firstConsciouslyInputtedArgument, helpReference
|
|
55
|
+
})
|
|
56
|
+
}),
|
|
57
|
+
title: InvalidConsoleCommandError_1.default.DEFAULT_TITLE,
|
|
58
|
+
occurrenceLocation: "ConsoleCommandsParser.parse(arrayedConsoleCommand, commandLineInterfaceSpecification)"
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
targetCommandPhrase = firstConsciouslyInputtedArgument;
|
|
62
|
+
targetCommandOptions = consciouslyInputtedArguments.slice(1);
|
|
63
|
+
for (const [commandPhrase, commandOptionSpecification] of Object.entries(commandLineInterfaceSpecification.commandPhrases)) {
|
|
64
|
+
if (commandPhrase === targetCommandPhrase) {
|
|
65
|
+
targetCommandOptionsSpecification = commandOptionSpecification;
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
if ((0, es_extensions_1.isUndefined)(targetCommandOptionsSpecification)) {
|
|
70
|
+
es_extensions_1.Logger.throwErrorAndLog({
|
|
71
|
+
errorInstance: new InvalidConsoleCommandError_1.default({
|
|
72
|
+
applicationName: commandLineInterfaceSpecification.applicationName,
|
|
73
|
+
messageSpecificPart: ConsoleCommandsParser.localization.generateUnknownCommandPhraseErrorMessage({
|
|
74
|
+
inputtedCommandPhrase: targetCommandPhrase, helpReference
|
|
75
|
+
})
|
|
76
|
+
}),
|
|
77
|
+
title: InvalidConsoleCommandError_1.default.DEFAULT_TITLE,
|
|
78
|
+
occurrenceLocation: "ConsoleCommandsParser.parse(arrayedConsoleCommand, commandLineInterfaceSpecification)"
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
this.applicationName = commandLineInterfaceSpecification.applicationName;
|
|
83
|
+
this.targetCommandPhrase = targetCommandPhrase;
|
|
84
|
+
this.targetCommandOptions = targetCommandOptions;
|
|
85
|
+
this.targetCommandOptionsSpecification = targetCommandOptionsSpecification;
|
|
86
|
+
}
|
|
87
|
+
static parse(argumentsVector, commandLineInterfaceSpecification) {
|
|
88
|
+
if (!Array.isArray(argumentsVector)) {
|
|
89
|
+
es_extensions_1.Logger.throwErrorAndLog({
|
|
90
|
+
errorInstance: new InvalidConsoleCommandError_1.default({
|
|
91
|
+
applicationName: commandLineInterfaceSpecification.applicationName,
|
|
92
|
+
messageSpecificPart: ConsoleCommandsParser.localization.
|
|
93
|
+
generateArgumentsVectorIsNotArrayErrorMessage(argumentsVector)
|
|
94
|
+
}),
|
|
95
|
+
title: InvalidConsoleCommandError_1.default.DEFAULT_TITLE,
|
|
96
|
+
occurrenceLocation: "ConsoleCommandsParser.parse(argumentsVector, commandLineInterfaceSpecification)"
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
if (argumentsVector.length < ConsoleCommandsParser.MINIMAL_ARGUMENTS_IN_VALID_CONSOLE_COMMAND) {
|
|
100
|
+
es_extensions_1.Logger.throwErrorAndLog({
|
|
101
|
+
errorInstance: new InvalidConsoleCommandError_1.default({
|
|
102
|
+
applicationName: commandLineInterfaceSpecification.applicationName,
|
|
103
|
+
messageSpecificPart: ConsoleCommandsParser.localization.
|
|
104
|
+
generateArgumentsVectorHasNotEnoughElementsErrorMessage({
|
|
105
|
+
arrayedConsoleCommand: argumentsVector,
|
|
106
|
+
minimalElementsCount: ConsoleCommandsParser.MINIMAL_ARGUMENTS_IN_VALID_CONSOLE_COMMAND
|
|
107
|
+
})
|
|
108
|
+
}),
|
|
109
|
+
title: InvalidConsoleCommandError_1.default.DEFAULT_TITLE,
|
|
110
|
+
occurrenceLocation: "ConsoleCommandsParser.parse(argumentsVector, commandLineInterfaceSpecification)"
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
const consciouslyInputtedArguments = [];
|
|
114
|
+
const nonStringArguments = [];
|
|
115
|
+
let NodeJS_InterpreterAbsolutePath = "";
|
|
116
|
+
let executableFileAbsolutePath = "";
|
|
117
|
+
for (const [index, argument] of argumentsVector.entries()) {
|
|
118
|
+
if (!(0, es_extensions_1.isString)(argument)) {
|
|
119
|
+
nonStringArguments.push(argument);
|
|
120
|
+
continue;
|
|
121
|
+
}
|
|
122
|
+
switch (index) {
|
|
123
|
+
case 0: {
|
|
124
|
+
NodeJS_InterpreterAbsolutePath = argument;
|
|
125
|
+
break;
|
|
126
|
+
}
|
|
127
|
+
case 1: {
|
|
128
|
+
executableFileAbsolutePath = argument;
|
|
129
|
+
break;
|
|
130
|
+
}
|
|
131
|
+
default: {
|
|
132
|
+
consciouslyInputtedArguments.push(argument);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
if (nonStringArguments.length > 0) {
|
|
137
|
+
es_extensions_1.Logger.throwErrorAndLog({
|
|
138
|
+
errorInstance: new InvalidConsoleCommandError_1.default({
|
|
139
|
+
applicationName: commandLineInterfaceSpecification.applicationName,
|
|
140
|
+
messageSpecificPart: ConsoleCommandsParser.localization.
|
|
141
|
+
generateArgumentsVectorHasNonStringElementsErrorMessage(nonStringArguments)
|
|
142
|
+
}),
|
|
143
|
+
title: InvalidConsoleCommandError_1.default.DEFAULT_TITLE,
|
|
144
|
+
occurrenceLocation: "ConsoleCommandsParser.parse(argumentsVector, commandLineInterfaceSpecification)"
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
const dataHoldingSelfInstance = new ConsoleCommandsParser({
|
|
148
|
+
consciouslyInputtedArguments, commandLineInterfaceSpecification
|
|
149
|
+
});
|
|
150
|
+
return {
|
|
151
|
+
NodeJS_InterpreterAbsolutePath,
|
|
152
|
+
executableFileAbsolutePath,
|
|
153
|
+
phrase: dataHoldingSelfInstance.targetCommandPhrase,
|
|
154
|
+
...dataHoldingSelfInstance.getParsedOptionsAndParameters()
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
static setLocalization(newLocalization) {
|
|
158
|
+
ConsoleCommandsParser.localization = newLocalization;
|
|
159
|
+
}
|
|
160
|
+
getParsedOptionsAndParameters() {
|
|
161
|
+
if ((0, es_extensions_1.isUndefined)(this.targetCommandOptionsSpecification)) {
|
|
162
|
+
return {};
|
|
163
|
+
}
|
|
164
|
+
const parsedOptions = {};
|
|
165
|
+
this.targetCommandOptions__eachOneWillBeRemovedOnceProcessed.push(...this.targetCommandOptions ?? []);
|
|
166
|
+
for (const [optionKey, optionSpecification] of Object.entries(this.targetCommandOptionsSpecification)) {
|
|
167
|
+
const optionKey__withoutPrepended2NDashes = optionKey.startsWith("--") ? optionKey.slice(2) : optionKey;
|
|
168
|
+
const optionKey__withPrepended2NDashes = `--${optionKey__withoutPrepended2NDashes}`;
|
|
169
|
+
const optionFinalName = optionSpecification.newName ?? optionKey__withoutPrepended2NDashes;
|
|
170
|
+
let shortcut__withPrependedNDash;
|
|
171
|
+
if ((0, es_extensions_1.isNotUndefined)(optionSpecification.shortcut)) {
|
|
172
|
+
shortcut__withPrependedNDash = optionSpecification.shortcut.startsWith("-") ?
|
|
173
|
+
optionSpecification.shortcut : `-${optionSpecification.shortcut}`;
|
|
174
|
+
}
|
|
175
|
+
const arrayIndexOfTargetOptionKey = this.targetCommandOptions__eachOneWillBeRemovedOnceProcessed.findIndex((commandOption) => commandOption === optionKey__withPrepended2NDashes || commandOption === shortcut__withPrependedNDash);
|
|
176
|
+
if (optionSpecification.type === ConsoleCommandsParser.ParametersTypes.boolean) {
|
|
177
|
+
if (arrayIndexOfTargetOptionKey !== -1) {
|
|
178
|
+
this.targetCommandOptions__eachOneWillBeRemovedOnceProcessed.splice(arrayIndexOfTargetOptionKey, 1);
|
|
179
|
+
}
|
|
180
|
+
parsedOptions[optionFinalName] = arrayIndexOfTargetOptionKey !== -1;
|
|
181
|
+
continue;
|
|
182
|
+
}
|
|
183
|
+
if (arrayIndexOfTargetOptionKey === -1) {
|
|
184
|
+
if (optionSpecification.required) {
|
|
185
|
+
es_extensions_1.Logger.throwErrorAndLog({
|
|
186
|
+
errorInstance: new InvalidConsoleCommandError_1.default({
|
|
187
|
+
applicationName: this.applicationName,
|
|
188
|
+
messageSpecificPart: ConsoleCommandsParser.localization.generateRequiredOptionKeyIsMissingErrorMessage({
|
|
189
|
+
commandPhrase: this.targetCommandPhrase,
|
|
190
|
+
missingOptionKey: optionKey__withPrepended2NDashes,
|
|
191
|
+
commandHelpReference: ConsoleCommandsParser.generateSingleCommendHelpReference({
|
|
192
|
+
commandPhrase: this.targetCommandPhrase,
|
|
193
|
+
commandOptionsSpecification: this.targetCommandOptionsSpecification ?? {}
|
|
194
|
+
})
|
|
195
|
+
})
|
|
196
|
+
}),
|
|
197
|
+
title: InvalidConsoleCommandError_1.default.DEFAULT_TITLE,
|
|
198
|
+
occurrenceLocation: "ConsoleCommandsParser.parse(parametersObject) -> ..."
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
continue;
|
|
202
|
+
}
|
|
203
|
+
const targetOptionPotentialValue = this.targetCommandOptions__eachOneWillBeRemovedOnceProcessed[arrayIndexOfTargetOptionKey + 1];
|
|
204
|
+
if ((0, es_extensions_1.isUndefined)(targetOptionPotentialValue)) {
|
|
205
|
+
es_extensions_1.Logger.throwErrorAndLog({
|
|
206
|
+
errorInstance: new InvalidConsoleCommandError_1.default({
|
|
207
|
+
applicationName: this.applicationName,
|
|
208
|
+
messageSpecificPart: ConsoleCommandsParser.localization.generateNoValueFollowingTheKeyOfNonBooleanOptionErrorMessage({
|
|
209
|
+
targetOptionKey: optionKey__withPrepended2NDashes,
|
|
210
|
+
commandHelpReference: ConsoleCommandsParser.generateSingleCommendHelpReference({
|
|
211
|
+
commandPhrase: this.targetCommandPhrase, commandOptionsSpecification: this.targetCommandOptionsSpecification ?? {}
|
|
212
|
+
})
|
|
213
|
+
})
|
|
214
|
+
}),
|
|
215
|
+
title: InvalidConsoleCommandError_1.default.DEFAULT_TITLE,
|
|
216
|
+
occurrenceLocation: "ConsoleCommandsParser.parse(parametersObject) -> ..."
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
switch (optionSpecification.type) {
|
|
220
|
+
case ConsoleCommandsParser.ParametersTypes.string: {
|
|
221
|
+
parsedOptions[optionFinalName] = this.processStringTypeOptionValue({
|
|
222
|
+
targetOptionRawValue: targetOptionPotentialValue,
|
|
223
|
+
optionKey__withPrepended2NDashes,
|
|
224
|
+
optionSpecification
|
|
225
|
+
});
|
|
226
|
+
break;
|
|
227
|
+
}
|
|
228
|
+
case ConsoleCommandsParser.ParametersTypes.number: {
|
|
229
|
+
parsedOptions[optionFinalName] = this.processNumberTypeOptionValue({
|
|
230
|
+
targetOptionRawValue: targetOptionPotentialValue,
|
|
231
|
+
optionKey__withPrepended2NDashes,
|
|
232
|
+
optionSpecification
|
|
233
|
+
});
|
|
234
|
+
break;
|
|
235
|
+
}
|
|
236
|
+
case ConsoleCommandsParser.ParametersTypes.JSON5: {
|
|
237
|
+
const targetParsedJSON5_ParameterValue = this.
|
|
238
|
+
extractAndValidateParsedJSON5_ParameterValue({
|
|
239
|
+
targetOptionRawValue: targetOptionPotentialValue,
|
|
240
|
+
optionKey__withPrepended2NDashes,
|
|
241
|
+
optionSpecification
|
|
242
|
+
});
|
|
243
|
+
if ((0, es_extensions_1.isNotUndefined)(targetParsedJSON5_ParameterValue)) {
|
|
244
|
+
parsedOptions[optionFinalName] = targetParsedJSON5_ParameterValue;
|
|
245
|
+
}
|
|
246
|
+
break;
|
|
247
|
+
}
|
|
248
|
+
default: {
|
|
249
|
+
es_extensions_1.Logger.throwErrorAndLog({
|
|
250
|
+
errorType: "InvalidConsoleCommandOptionSpecification",
|
|
251
|
+
title: "Invalid console command option specification",
|
|
252
|
+
description: ConsoleCommandsParser.localization.generateInvalidOptionTypeErrorMessage({
|
|
253
|
+
optionName: optionFinalName
|
|
254
|
+
}),
|
|
255
|
+
occurrenceLocation: "ConsoleCommandsParser.parse(arrayedConsoleCommand, commandLineInterfaceSpecification)"
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
this.targetCommandOptions__eachOneWillBeRemovedOnceProcessed.splice(arrayIndexOfTargetOptionKey, 2);
|
|
260
|
+
}
|
|
261
|
+
if (this.targetCommandOptions__eachOneWillBeRemovedOnceProcessed.length > 0) {
|
|
262
|
+
es_extensions_1.Logger.throwErrorAndLog({
|
|
263
|
+
errorInstance: new InvalidConsoleCommandError_1.default({
|
|
264
|
+
applicationName: this.applicationName,
|
|
265
|
+
messageSpecificPart: ConsoleCommandsParser.localization.generateUnknownOptionsFoundForSpecificCommandErrorMessage({
|
|
266
|
+
commandPhrase: this.targetCommandPhrase,
|
|
267
|
+
commandReference: ConsoleCommandsParser.generateSingleCommendHelpReference({
|
|
268
|
+
commandPhrase: this.targetCommandPhrase, commandOptionsSpecification: this.targetCommandOptionsSpecification
|
|
269
|
+
})
|
|
270
|
+
})
|
|
271
|
+
}),
|
|
272
|
+
title: InvalidConsoleCommandError_1.default.DEFAULT_TITLE,
|
|
273
|
+
occurrenceLocation: "ConsoleCommandsParser.parse(arrayedConsoleCommand, commandLineInterfaceSpecification)"
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
return parsedOptions;
|
|
277
|
+
}
|
|
278
|
+
processStringTypeOptionValue({ targetOptionRawValue, optionKey__withPrepended2NDashes, optionSpecification }) {
|
|
279
|
+
const { allowedAlternatives } = optionSpecification;
|
|
280
|
+
if ((0, es_extensions_1.isNotUndefined)(allowedAlternatives) && !allowedAlternatives.includes(targetOptionRawValue)) {
|
|
281
|
+
es_extensions_1.Logger.throwErrorAndLog({
|
|
282
|
+
errorInstance: new InvalidConsoleCommandError_1.default({
|
|
283
|
+
applicationName: this.applicationName,
|
|
284
|
+
messageSpecificPart: ConsoleCommandsParser.localization.generateOptionValueIsNotAmongAllowedAlternativesErrorMessage({
|
|
285
|
+
targetOptionKey: optionKey__withPrepended2NDashes,
|
|
286
|
+
actualOptionValue: targetOptionRawValue,
|
|
287
|
+
commandReference: ConsoleCommandsParser.generateSingleCommendHelpReference({
|
|
288
|
+
commandPhrase: this.targetCommandPhrase, commandOptionsSpecification: this.targetCommandOptionsSpecification ?? {}
|
|
289
|
+
})
|
|
290
|
+
})
|
|
291
|
+
}),
|
|
292
|
+
title: InvalidConsoleCommandError_1.default.DEFAULT_TITLE,
|
|
293
|
+
occurrenceLocation: "ConsoleCommandsParser.parse(parametersObject) -> ..."
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
return targetOptionRawValue;
|
|
297
|
+
}
|
|
298
|
+
processNumberTypeOptionValue({ targetOptionRawValue, optionKey__withPrepended2NDashes, optionSpecification }) {
|
|
299
|
+
const { numbersSet, minimalValue, maximalValue } = optionSpecification;
|
|
300
|
+
const targetOptionParsedValue = Number(targetOptionRawValue);
|
|
301
|
+
if (Number.isNaN(targetOptionParsedValue)) {
|
|
302
|
+
es_extensions_1.Logger.throwErrorAndLog({
|
|
303
|
+
errorInstance: new InvalidConsoleCommandError_1.default({
|
|
304
|
+
applicationName: this.applicationName,
|
|
305
|
+
messageSpecificPart: ConsoleCommandsParser.localization.generateUnparsableNumericOptionValueErrorMessage({
|
|
306
|
+
targetOptionKey: optionKey__withPrepended2NDashes,
|
|
307
|
+
actualOptionValue: targetOptionRawValue,
|
|
308
|
+
commandReference: ConsoleCommandsParser.generateSingleCommendHelpReference({
|
|
309
|
+
commandPhrase: this.targetCommandPhrase, commandOptionsSpecification: this.targetCommandOptionsSpecification ?? {}
|
|
310
|
+
})
|
|
311
|
+
})
|
|
312
|
+
}),
|
|
313
|
+
title: InvalidConsoleCommandError_1.default.DEFAULT_TITLE,
|
|
314
|
+
occurrenceLocation: "ConsoleCommandsParser.parse(parametersObject) -> ..."
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
let optionValueMatchingWithExpectedNumberSet;
|
|
318
|
+
switch (numbersSet) {
|
|
319
|
+
case es_extensions_1.RawObjectDataProcessor.NumbersSets.naturalNumber: {
|
|
320
|
+
optionValueMatchingWithExpectedNumberSet = (0, es_extensions_1.isNaturalNumber)(targetOptionParsedValue);
|
|
321
|
+
break;
|
|
322
|
+
}
|
|
323
|
+
case es_extensions_1.RawObjectDataProcessor.NumbersSets.nonNegativeInteger: {
|
|
324
|
+
optionValueMatchingWithExpectedNumberSet = (0, es_extensions_1.isNonNegativeInteger)(targetOptionParsedValue);
|
|
325
|
+
break;
|
|
326
|
+
}
|
|
327
|
+
case es_extensions_1.RawObjectDataProcessor.NumbersSets.negativeInteger: {
|
|
328
|
+
optionValueMatchingWithExpectedNumberSet = (0, es_extensions_1.isNegativeInteger)(targetOptionParsedValue);
|
|
329
|
+
break;
|
|
330
|
+
}
|
|
331
|
+
case es_extensions_1.RawObjectDataProcessor.NumbersSets.negativeIntegerOrZero: {
|
|
332
|
+
optionValueMatchingWithExpectedNumberSet = (0, es_extensions_1.isNegativeIntegerOrZero)(targetOptionParsedValue);
|
|
333
|
+
break;
|
|
334
|
+
}
|
|
335
|
+
case es_extensions_1.RawObjectDataProcessor.NumbersSets.anyInteger: {
|
|
336
|
+
optionValueMatchingWithExpectedNumberSet = Number.isInteger(targetOptionParsedValue);
|
|
337
|
+
break;
|
|
338
|
+
}
|
|
339
|
+
case es_extensions_1.RawObjectDataProcessor.NumbersSets.positiveDecimalFraction: {
|
|
340
|
+
optionValueMatchingWithExpectedNumberSet = (0, es_extensions_1.isPositiveDecimalFraction)(targetOptionParsedValue);
|
|
341
|
+
break;
|
|
342
|
+
}
|
|
343
|
+
case es_extensions_1.RawObjectDataProcessor.NumbersSets.negativeDecimalFraction: {
|
|
344
|
+
optionValueMatchingWithExpectedNumberSet = (0, es_extensions_1.isNegativeDecimalFraction)(targetOptionParsedValue);
|
|
345
|
+
break;
|
|
346
|
+
}
|
|
347
|
+
case es_extensions_1.RawObjectDataProcessor.NumbersSets.decimalFractionOfAnySign: {
|
|
348
|
+
optionValueMatchingWithExpectedNumberSet = (0, es_extensions_1.isDecimalFractionOfAnySign)(targetOptionParsedValue);
|
|
349
|
+
break;
|
|
350
|
+
}
|
|
351
|
+
case es_extensions_1.RawObjectDataProcessor.NumbersSets.anyRealNumber: {
|
|
352
|
+
optionValueMatchingWithExpectedNumberSet = true;
|
|
353
|
+
break;
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
if (!optionValueMatchingWithExpectedNumberSet) {
|
|
357
|
+
es_extensions_1.Logger.throwErrorAndLog({
|
|
358
|
+
errorInstance: new InvalidConsoleCommandError_1.default({
|
|
359
|
+
applicationName: this.applicationName,
|
|
360
|
+
messageSpecificPart: ConsoleCommandsParser.localization.
|
|
361
|
+
generatedNumericOptionValueIsNotBelongToExpectedNumbersSetErrorMessage({
|
|
362
|
+
targetOptionKey: optionKey__withPrepended2NDashes,
|
|
363
|
+
expectedNumbersSet: numbersSet,
|
|
364
|
+
actualOptionValue: targetOptionRawValue,
|
|
365
|
+
commandReference: ConsoleCommandsParser.generateSingleCommendHelpReference({
|
|
366
|
+
commandPhrase: this.targetCommandPhrase,
|
|
367
|
+
commandOptionsSpecification: this.targetCommandOptionsSpecification ?? {}
|
|
368
|
+
})
|
|
369
|
+
})
|
|
370
|
+
}),
|
|
371
|
+
title: InvalidConsoleCommandError_1.default.DEFAULT_TITLE,
|
|
372
|
+
occurrenceLocation: "ConsoleCommandsParser.parse(parametersObject) -> ..."
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
if ((0, es_extensions_1.isNotUndefined)(minimalValue) && targetOptionParsedValue <= minimalValue) {
|
|
376
|
+
es_extensions_1.Logger.throwErrorAndLog({
|
|
377
|
+
errorInstance: new InvalidConsoleCommandError_1.default({
|
|
378
|
+
applicationName: this.applicationName,
|
|
379
|
+
messageSpecificPart: ConsoleCommandsParser.localization.
|
|
380
|
+
generateNumericValueIsSmallerThanRequiredMinimumErrorMessage({
|
|
381
|
+
targetOptionKey: optionKey__withPrepended2NDashes,
|
|
382
|
+
requiredMinimum: minimalValue,
|
|
383
|
+
actualOptionValue: targetOptionRawValue,
|
|
384
|
+
commandReference: ConsoleCommandsParser.generateSingleCommendHelpReference({
|
|
385
|
+
commandPhrase: this.targetCommandPhrase,
|
|
386
|
+
commandOptionsSpecification: this.targetCommandOptionsSpecification ?? {}
|
|
387
|
+
})
|
|
388
|
+
})
|
|
389
|
+
}),
|
|
390
|
+
title: InvalidConsoleCommandError_1.default.DEFAULT_TITLE,
|
|
391
|
+
occurrenceLocation: "ConsoleCommandsParser.parse(parametersObject) -> ..."
|
|
392
|
+
});
|
|
393
|
+
}
|
|
394
|
+
if ((0, es_extensions_1.isNotUndefined)(maximalValue) && targetOptionParsedValue >= maximalValue) {
|
|
395
|
+
es_extensions_1.Logger.throwErrorAndLog({
|
|
396
|
+
errorInstance: new InvalidConsoleCommandError_1.default({
|
|
397
|
+
applicationName: this.applicationName,
|
|
398
|
+
messageSpecificPart: ConsoleCommandsParser.localization.
|
|
399
|
+
generateNumericValueIsGreaterThanAllowedMaximumErrorMessage({
|
|
400
|
+
targetOptionKey: optionKey__withPrepended2NDashes,
|
|
401
|
+
allowedMaximum: maximalValue,
|
|
402
|
+
actualOptionValue: targetOptionRawValue,
|
|
403
|
+
commandReference: ConsoleCommandsParser.generateSingleCommendHelpReference({
|
|
404
|
+
commandPhrase: this.targetCommandPhrase,
|
|
405
|
+
commandOptionsSpecification: this.targetCommandOptionsSpecification ?? {}
|
|
406
|
+
})
|
|
407
|
+
})
|
|
408
|
+
}),
|
|
409
|
+
title: InvalidConsoleCommandError_1.default.DEFAULT_TITLE,
|
|
410
|
+
occurrenceLocation: "ConsoleCommandsParser.parse(parametersObject) -> ..."
|
|
411
|
+
});
|
|
412
|
+
}
|
|
413
|
+
return targetOptionParsedValue;
|
|
414
|
+
}
|
|
415
|
+
extractAndValidateParsedJSON5_ParameterValue({ targetOptionRawValue, optionKey__withPrepended2NDashes, optionSpecification }) {
|
|
416
|
+
let targetParameterParsedValue;
|
|
417
|
+
try {
|
|
418
|
+
targetParameterParsedValue = json5_1.default.parse(targetOptionRawValue);
|
|
419
|
+
}
|
|
420
|
+
catch (error) {
|
|
421
|
+
es_extensions_1.Logger.throwErrorAndLog({
|
|
422
|
+
errorInstance: new InvalidConsoleCommandError_1.default({
|
|
423
|
+
applicationName: this.applicationName,
|
|
424
|
+
messageSpecificPart: ConsoleCommandsParser.localization.generateMalformedJSON5_OptionErrorMessage({
|
|
425
|
+
targetOptionKey: optionKey__withPrepended2NDashes,
|
|
426
|
+
commandReference: ConsoleCommandsParser.generateSingleCommendHelpReference({
|
|
427
|
+
commandPhrase: this.targetCommandPhrase, commandOptionsSpecification: this.targetCommandOptionsSpecification ?? {}
|
|
428
|
+
})
|
|
429
|
+
})
|
|
430
|
+
}),
|
|
431
|
+
title: InvalidConsoleCommandError_1.default.DEFAULT_TITLE,
|
|
432
|
+
occurrenceLocation: "ConsoleCommandsParser.parse(arrayedConsoleCommand, commandLineInterfaceSpecification)"
|
|
433
|
+
});
|
|
434
|
+
}
|
|
435
|
+
const validationResult = es_extensions_1.RawObjectDataProcessor.
|
|
436
|
+
process(targetParameterParsedValue, optionSpecification.validValueSpecification);
|
|
437
|
+
if (validationResult.rawDataIsInvalid) {
|
|
438
|
+
es_extensions_1.Logger.throwErrorAndLog({
|
|
439
|
+
errorInstance: new es_extensions_1.InvalidExternalDataError({
|
|
440
|
+
customMessage: ConsoleCommandsParser.localization.generateJSON5_OptionDoesNotMatchWithValidDataSchemaErrorMessage({
|
|
441
|
+
targetOptionKey: optionKey__withPrepended2NDashes,
|
|
442
|
+
formattedValidationErrorsMessages: es_extensions_1.RawObjectDataProcessor.
|
|
443
|
+
formatValidationErrorsList(validationResult.validationErrorsMessages)
|
|
444
|
+
})
|
|
445
|
+
}),
|
|
446
|
+
title: es_extensions_1.InvalidExternalDataError.DEFAULT_TITLE,
|
|
447
|
+
occurrenceLocation: "ConsoleCommandsParser.parse(arrayedConsoleCommand, commandLineInterfaceSpecification)"
|
|
448
|
+
});
|
|
449
|
+
}
|
|
450
|
+
return validationResult.processedData;
|
|
451
|
+
}
|
|
452
|
+
static isCommandArgumentTheOption(consoleCommandArgument) {
|
|
453
|
+
return consoleCommandArgument.startsWith("-");
|
|
454
|
+
}
|
|
455
|
+
static generateFullHelpReference(commandLineInterfaceSpecification) {
|
|
456
|
+
let accumulatingValue = "";
|
|
457
|
+
if ((0, es_extensions_1.isNotUndefined)(commandLineInterfaceSpecification.defaultCommand)) {
|
|
458
|
+
accumulatingValue = "Has default command\n";
|
|
459
|
+
for (const [argumentName, argumentSpecification] of Object.entries(commandLineInterfaceSpecification.defaultCommand)) {
|
|
460
|
+
accumulatingValue = `${argumentName}: ${argumentSpecification.type}\n`;
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
if ((0, es_extensions_1.isNotUndefined)(commandLineInterfaceSpecification.commandPhrases)) {
|
|
464
|
+
for (const [commandPhrase, argumentsSpecification] of Object.entries(commandLineInterfaceSpecification.commandPhrases)) {
|
|
465
|
+
accumulatingValue = `${accumulatingValue}${commandPhrase}:\n`;
|
|
466
|
+
if ((0, es_extensions_1.isUndefined)(argumentsSpecification)) {
|
|
467
|
+
continue;
|
|
468
|
+
}
|
|
469
|
+
for (const [argumentName, argumentSpecification] of Object.entries(argumentsSpecification)) {
|
|
470
|
+
accumulatingValue = `${accumulatingValue}\n ${argumentName}: ${argumentSpecification.type}`;
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
return accumulatingValue;
|
|
475
|
+
}
|
|
476
|
+
static generateSingleCommendHelpReference({ commandPhrase, commandOptionsSpecification }) {
|
|
477
|
+
let accumulatingValue = (0, es_extensions_1.isNotUndefined)(commandPhrase) ? commandPhrase : "(Default command)";
|
|
478
|
+
for (const [argumentName, argumentSpecification] of Object.entries(commandOptionsSpecification)) {
|
|
479
|
+
accumulatingValue = `${accumulatingValue}:\n ${argumentName}: ${argumentSpecification.type}`;
|
|
480
|
+
}
|
|
481
|
+
return accumulatingValue;
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
ConsoleCommandsParser.MINIMAL_ARGUMENTS_IN_VALID_CONSOLE_COMMAND = 2;
|
|
485
|
+
ConsoleCommandsParser.localization = ConsoleCommandsParserLocalization_english_1.default;
|
|
486
|
+
(function (ConsoleCommandsParser) {
|
|
487
|
+
let ParametersTypes;
|
|
488
|
+
(function (ParametersTypes) {
|
|
489
|
+
ParametersTypes["string"] = "string";
|
|
490
|
+
ParametersTypes["number"] = "number";
|
|
491
|
+
ParametersTypes["boolean"] = "boolean";
|
|
492
|
+
ParametersTypes["JSON5"] = "JSON5";
|
|
493
|
+
})(ParametersTypes = ConsoleCommandsParser.ParametersTypes || (ConsoleCommandsParser.ParametersTypes = {}));
|
|
494
|
+
})(ConsoleCommandsParser || (ConsoleCommandsParser = {}));
|
|
495
|
+
exports.default = ConsoleCommandsParser;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const es_extensions_1 = require("@yamato-daiwa/es-extensions");
|
|
4
|
+
const ConsoleCommandsParserLocalization__English = {
|
|
5
|
+
generateArgumentsVectorIsNotArrayErrorMessage: (argumentsVector) => "Expected that the arguments vector will be an array while actually it did not pass 'Array.isArray()' check and" +
|
|
6
|
+
`has the value:\n${(0, es_extensions_1.stringifyAndFormatArbitraryValue)(argumentsVector)}`,
|
|
7
|
+
generateArgumentsVectorHasNotEnoughElementsErrorMessage: ({ minimalElementsCount, arrayedConsoleCommand }) => `The valid arguments vector must be an array of at least ${minimalElementsCount} elements while actually is has ` +
|
|
8
|
+
`${arrayedConsoleCommand.length} elements and value:\n${(0, es_extensions_1.stringifyAndFormatArbitraryValue)(arrayedConsoleCommand)}`,
|
|
9
|
+
generateArgumentsVectorHasNonStringElementsErrorMessage: (nonStringElements) => "The valid arguments vector must be an array of the strings while below arguments are not strings:\n" +
|
|
10
|
+
`${(0, es_extensions_1.stringifyAndFormatArbitraryValue)(nonStringElements)}`,
|
|
11
|
+
generateNoDefaultCommandPhraseAvailableErrorMessage: (helpReference) => "This application has not the default command. Please specify explicitly one of mentioned below command phrases:\n" +
|
|
12
|
+
`${helpReference}`,
|
|
13
|
+
generateFirstParameterLooksLikeCommandPhraseWhileNoCommandPhrasesAvailableErrorMessage: ({ commandPhraseLikeArgument, helpReference }) => `'${commandPhraseLikeArgument}' seems like the command phrase while no command phrases available for this application:\n` +
|
|
14
|
+
`${helpReference}`,
|
|
15
|
+
generateUnknownCommandPhraseErrorMessage: ({ inputtedCommandPhrase, helpReference }) => `The command phrase '${inputtedCommandPhrase}' is unknown. ` +
|
|
16
|
+
`Please input one of below available command phrases:\n${helpReference}`,
|
|
17
|
+
generateUnknownOptionsFoundForSpecificCommandErrorMessage: ({ commandPhrase, commandReference }) => "Below options are unknown for the " +
|
|
18
|
+
`"${(0, es_extensions_1.isNotUndefined)(commandPhrase) ? `command "${commandPhrase}"` : "default command"}".` +
|
|
19
|
+
`Please check the reference for this command:\n${commandReference}`,
|
|
20
|
+
generateInvalidOptionTypeErrorMessage: ({ optionName }) => `Invalid type has been specified for the option '${optionName}'.`,
|
|
21
|
+
generateRequiredOptionKeyIsMissingErrorMessage: ({ missingOptionKey, commandPhrase, commandHelpReference }) => `The option '${missingOptionKey}' is required for the ` +
|
|
22
|
+
`${(0, es_extensions_1.isNotUndefined)(commandPhrase) ? `command '${commandPhrase}'` : "default command"}.` +
|
|
23
|
+
`Please check the reference for this command:\n${commandHelpReference}`,
|
|
24
|
+
generateNoValueFollowingTheKeyOfNonBooleanOptionErrorMessage: ({ targetOptionKey, commandHelpReference }) => `No value following the key '${targetOptionKey}' of non-boolean option has been specified.` +
|
|
25
|
+
`Please check the reference for this command:\n${commandHelpReference}`,
|
|
26
|
+
generateOptionValueIsNotAmongAllowedAlternativesErrorMessage: ({ targetOptionKey, actualOptionValue, commandReference }) => `The value '${actualOptionValue}' of the option '${targetOptionKey}' is not among allowed alternatives. ` +
|
|
27
|
+
`Please check the reference for this command:\n${commandReference}`,
|
|
28
|
+
generateUnparsableNumericOptionValueErrorMessage: ({ actualOptionValue, targetOptionKey, commandReference }) => `The value '${actualOptionValue}' of the option '${targetOptionKey}' is not valid numeric value.` +
|
|
29
|
+
`Please check the reference for this command:\n${commandReference}`,
|
|
30
|
+
generateReadableNumbersSet(numberSet) {
|
|
31
|
+
return es_extensions_1.RawObjectDataProcessorLocalization__English.numbersSet(numberSet);
|
|
32
|
+
},
|
|
33
|
+
generatedNumericOptionValueIsNotBelongToExpectedNumbersSetErrorMessage({ targetOptionKey, expectedNumbersSet, actualOptionValue, commandReference }) {
|
|
34
|
+
return `The value '${actualOptionValue}' of the option '${targetOptionKey}' is not is in not member of ` +
|
|
35
|
+
`'${this.generateReadableNumbersSet(expectedNumbersSet)}' set as required. ` +
|
|
36
|
+
`Please check the reference for target command:\n${commandReference}`;
|
|
37
|
+
},
|
|
38
|
+
generateNumericValueIsSmallerThanRequiredMinimumErrorMessage({ targetOptionKey, requiredMinimum, actualOptionValue, commandReference }) {
|
|
39
|
+
return `The value '${actualOptionValue}' of the option '${targetOptionKey}' is less than required minimal value ` +
|
|
40
|
+
`${requiredMinimum} set as required.\n Please check the reference for this target command:\n${commandReference}`;
|
|
41
|
+
},
|
|
42
|
+
generateNumericValueIsGreaterThanAllowedMaximumErrorMessage({ targetOptionKey, allowedMaximum, actualOptionValue, commandReference }) {
|
|
43
|
+
return `The value '${actualOptionValue}' of the option '${targetOptionKey}' is greater that allowed maximal value ` +
|
|
44
|
+
`${allowedMaximum}. \n Please check the reference for target command:\n${commandReference}`;
|
|
45
|
+
},
|
|
46
|
+
generateMalformedJSON5_OptionErrorMessage: ({ targetOptionKey, commandReference }) => `The value of the option '${targetOptionKey}' is not valid JSON5.` +
|
|
47
|
+
`Please check the reference for this command:\n${commandReference}`,
|
|
48
|
+
generateJSON5_OptionDoesNotMatchWithValidDataSchemaErrorMessage: ({ targetOptionKey, formattedValidationErrorsMessages }) => `The JSON5-type value of the option '${targetOptionKey}' does not match with valid data schema:\n` +
|
|
49
|
+
`${formattedValidationErrorsMessages}`
|
|
50
|
+
};
|
|
51
|
+
exports.default = ConsoleCommandsParserLocalization__English;
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const es_extensions_1 = require("@yamato-daiwa/es-extensions");
|
|
4
|
+
class NodeJS_Timer extends es_extensions_1.Timer {
|
|
3
5
|
start() {
|
|
4
|
-
this.
|
|
6
|
+
this.nativeTimeout = setTimeout(this.onElapsed.bind(this), (0, es_extensions_1.secondsToMilliseconds)(this.period__seconds));
|
|
5
7
|
}
|
|
6
8
|
stop() {
|
|
7
|
-
clearTimeout(this.
|
|
9
|
+
clearTimeout(this.nativeTimeout);
|
|
8
10
|
}
|
|
9
11
|
restart() {
|
|
10
12
|
this.stop();
|
|
11
13
|
this.start();
|
|
12
14
|
}
|
|
13
15
|
}
|
|
16
|
+
exports.default = NodeJS_Timer;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
declare class InvalidConsoleCommandError extends Error {
|
|
2
|
+
static readonly NAME: string;
|
|
3
|
+
static get DEFAULT_TITLE(): string;
|
|
4
|
+
private static localization;
|
|
5
|
+
static setLocalization(localization: InvalidConsoleCommandError.Localization): void;
|
|
6
|
+
constructor(parametersObject: InvalidConsoleCommandError.ConstructorParametersObject);
|
|
7
|
+
}
|
|
8
|
+
declare namespace InvalidConsoleCommandError {
|
|
9
|
+
type ConstructorParametersObject = Localization.GenericDescriptionPartTemplateParameters | {
|
|
10
|
+
customMessage: string;
|
|
11
|
+
};
|
|
12
|
+
type Localization = {
|
|
13
|
+
readonly defaultTitle: string;
|
|
14
|
+
readonly genericDescriptionPartTemplate: (parametersObject: Localization.GenericDescriptionPartTemplateParameters) => string;
|
|
15
|
+
};
|
|
16
|
+
namespace Localization {
|
|
17
|
+
type GenericDescriptionPartTemplateParameters = {
|
|
18
|
+
applicationName: string;
|
|
19
|
+
messageSpecificPart?: string;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
export default InvalidConsoleCommandError;
|
|
@@ -0,0 +1,27 @@
|
|
|
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
|
+
const InvalidConsoleCommandErrorLocalization__English_1 = __importDefault(require("./InvalidConsoleCommandErrorLocalization__English"));
|
|
7
|
+
class InvalidConsoleCommandError extends Error {
|
|
8
|
+
constructor(parametersObject) {
|
|
9
|
+
super();
|
|
10
|
+
this.name = InvalidConsoleCommandError.NAME;
|
|
11
|
+
if ("customMessage" in parametersObject) {
|
|
12
|
+
this.message = parametersObject.customMessage;
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
this.message = InvalidConsoleCommandError.localization.genericDescriptionPartTemplate(parametersObject);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
static get DEFAULT_TITLE() {
|
|
19
|
+
return InvalidConsoleCommandError.localization.defaultTitle;
|
|
20
|
+
}
|
|
21
|
+
static setLocalization(localization) {
|
|
22
|
+
InvalidConsoleCommandError.localization = localization;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
InvalidConsoleCommandError.NAME = "InvalidConsoleCommandError";
|
|
26
|
+
InvalidConsoleCommandError.localization = InvalidConsoleCommandErrorLocalization__English_1.default;
|
|
27
|
+
exports.default = InvalidConsoleCommandError;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const es_extensions_1 = require("@yamato-daiwa/es-extensions");
|
|
4
|
+
const InvalidConsoleCommandErrorLocalization__English = {
|
|
5
|
+
defaultTitle: "Invalid console command",
|
|
6
|
+
genericDescriptionPartTemplate: (parametersObject) => `Invalid console command for the application '${parametersObject.applicationName}'` +
|
|
7
|
+
`${(0, es_extensions_1.insertSubstring)(parametersObject.messageSpecificPart, {
|
|
8
|
+
modifier: (messageSpecificPart) => `\n${messageSpecificPart}`
|
|
9
|
+
})}`
|
|
10
|
+
};
|
|
11
|
+
exports.default = InvalidConsoleCommandErrorLocalization__English;
|