react-intl-lint 1.0.4 → 1.1.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.
- package/LICENSE.md +21 -21
- package/README.md +299 -229
- package/dist/bin.d.ts +2 -2
- package/dist/bin.js +4 -4
- package/dist/package.json +104 -121
- package/dist/src/cli/bin.d.ts +2 -2
- package/dist/src/cli/bin.js +17 -6
- package/dist/src/cli/bin.js.map +1 -1
- package/dist/src/cli/cli.d.ts +17 -16
- package/dist/src/cli/cli.js +217 -173
- package/dist/src/cli/cli.js.map +1 -1
- package/dist/src/cli/dictionaries/CliOptions.d.ts +3 -3
- package/dist/src/cli/dictionaries/CliOptions.js +171 -157
- package/dist/src/cli/dictionaries/CliOptions.js.map +1 -1
- package/dist/src/cli/dictionaries/index.d.ts +1 -1
- package/dist/src/cli/dictionaries/index.js +17 -17
- package/dist/src/cli/enums/OptionsNames.d.ts +31 -29
- package/dist/src/cli/enums/OptionsNames.js +35 -35
- package/dist/src/cli/enums/OptionsNames.js.map +1 -1
- package/dist/src/cli/enums/OptionsPath.d.ts +6 -5
- package/dist/src/cli/enums/OptionsPath.js +9 -9
- package/dist/src/cli/enums/OptionsPath.js.map +1 -1
- package/dist/src/cli/enums/index.d.ts +2 -2
- package/dist/src/cli/enums/index.js +18 -18
- package/dist/src/cli/models/Option.d.ts +7 -7
- package/dist/src/cli/models/Option.js +35 -35
- package/dist/src/cli/models/Option.js.map +1 -1
- package/dist/src/cli/models/index.d.ts +1 -1
- package/dist/src/cli/models/index.js +17 -17
- package/dist/src/cli/utils/file.d.ts +3 -3
- package/dist/src/cli/utils/file.js +59 -50
- package/dist/src/cli/utils/file.js.map +1 -1
- package/dist/src/cli/utils/index.d.ts +1 -1
- package/dist/src/cli/utils/index.js +17 -17
- package/dist/src/core/index.d.ts +1 -7
- package/dist/src/core/index.js +17 -23
- package/dist/src/core/index.js.map +1 -1
- package/dist/src/react-intl/regex.d.ts +1 -0
- package/dist/src/react-intl/regex.js +8 -0
- package/dist/src/react-intl/regex.js.map +1 -0
- package/package.json +104 -121
- package/dist/src/core/client.d.ts +0 -16
- package/dist/src/core/client.js +0 -171
- package/dist/src/core/client.js.map +0 -1
- package/dist/src/core/config.d.ts +0 -3
- package/dist/src/core/config.js +0 -24
- package/dist/src/core/config.js.map +0 -1
- package/dist/src/core/enums/ErrorFlow.d.ts +0 -15
- package/dist/src/core/enums/ErrorFlow.js +0 -20
- package/dist/src/core/enums/ErrorFlow.js.map +0 -1
- package/dist/src/core/enums/ErrorTypes.d.ts +0 -6
- package/dist/src/core/enums/ErrorTypes.js +0 -11
- package/dist/src/core/enums/ErrorTypes.js.map +0 -1
- package/dist/src/core/enums/StatusCodes.d.ts +0 -6
- package/dist/src/core/enums/StatusCodes.js +0 -11
- package/dist/src/core/enums/StatusCodes.js.map +0 -1
- package/dist/src/core/enums/ToggleRule.d.ts +0 -5
- package/dist/src/core/enums/ToggleRule.js +0 -10
- package/dist/src/core/enums/ToggleRule.js.map +0 -1
- package/dist/src/core/enums/index.d.ts +0 -4
- package/dist/src/core/enums/index.js +0 -21
- package/dist/src/core/enums/index.js.map +0 -1
- package/dist/src/core/interface/IAppConfig.d.ts +0 -10
- package/dist/src/core/interface/IAppConfig.js +0 -3
- package/dist/src/core/interface/IAppConfig.js.map +0 -1
- package/dist/src/core/interface/ILogger.d.ts +0 -5
- package/dist/src/core/interface/ILogger.js +0 -3
- package/dist/src/core/interface/ILogger.js.map +0 -1
- package/dist/src/core/interface/IMisprint.d.ts +0 -6
- package/dist/src/core/interface/IMisprint.js +0 -3
- package/dist/src/core/interface/IMisprint.js.map +0 -1
- package/dist/src/core/interface/IRule.d.ts +0 -8
- package/dist/src/core/interface/IRule.js +0 -3
- package/dist/src/core/interface/IRule.js.map +0 -1
- package/dist/src/core/interface/IRulesConfig.d.ts +0 -14
- package/dist/src/core/interface/IRulesConfig.js +0 -3
- package/dist/src/core/interface/IRulesConfig.js.map +0 -1
- package/dist/src/core/interface/IValidationMessage.d.ts +0 -5
- package/dist/src/core/interface/IValidationMessage.js +0 -3
- package/dist/src/core/interface/IValidationMessage.js.map +0 -1
- package/dist/src/core/interface/index.d.ts +0 -6
- package/dist/src/core/interface/index.js +0 -23
- package/dist/src/core/interface/index.js.map +0 -1
- package/dist/src/core/models/KeyModel.d.ts +0 -8
- package/dist/src/core/models/KeyModel.js +0 -15
- package/dist/src/core/models/KeyModel.js.map +0 -1
- package/dist/src/core/models/KeyModelWithLanguages.d.ts +0 -18
- package/dist/src/core/models/KeyModelWithLanguages.js +0 -29
- package/dist/src/core/models/KeyModelWithLanguages.js.map +0 -1
- package/dist/src/core/models/LanguagesModel.d.ts +0 -7
- package/dist/src/core/models/LanguagesModel.js +0 -12
- package/dist/src/core/models/LanguagesModel.js.map +0 -1
- package/dist/src/core/models/MisprintModel.d.ts +0 -8
- package/dist/src/core/models/MisprintModel.js +0 -12
- package/dist/src/core/models/MisprintModel.js.map +0 -1
- package/dist/src/core/models/StylishLogger.d.ts +0 -11
- package/dist/src/core/models/StylishLogger.js +0 -37
- package/dist/src/core/models/StylishLogger.js.map +0 -1
- package/dist/src/core/models/error/ErrorModel.d.ts +0 -7
- package/dist/src/core/models/error/ErrorModel.js +0 -4
- package/dist/src/core/models/error/ErrorModel.js.map +0 -1
- package/dist/src/core/models/error/FatalErrorModel.d.ts +0 -7
- package/dist/src/core/models/error/FatalErrorModel.js +0 -16
- package/dist/src/core/models/error/FatalErrorModel.js.map +0 -1
- package/dist/src/core/models/error/index.d.ts +0 -2
- package/dist/src/core/models/error/index.js +0 -19
- package/dist/src/core/models/error/index.js.map +0 -1
- package/dist/src/core/models/files/FileLanguageModel.d.ts +0 -10
- package/dist/src/core/models/files/FileLanguageModel.js +0 -90
- package/dist/src/core/models/files/FileLanguageModel.js.map +0 -1
- package/dist/src/core/models/files/FileModel.d.ts +0 -12
- package/dist/src/core/models/files/FileModel.js +0 -44
- package/dist/src/core/models/files/FileModel.js.map +0 -1
- package/dist/src/core/models/files/FileViewModel.d.ts +0 -7
- package/dist/src/core/models/files/FileViewModel.js +0 -22
- package/dist/src/core/models/files/FileViewModel.js.map +0 -1
- package/dist/src/core/models/files/index.d.ts +0 -3
- package/dist/src/core/models/files/index.js +0 -20
- package/dist/src/core/models/files/index.js.map +0 -1
- package/dist/src/core/models/index.d.ts +0 -8
- package/dist/src/core/models/index.js +0 -25
- package/dist/src/core/models/index.js.map +0 -1
- package/dist/src/core/models/results/ResultCliModel.d.ts +0 -22
- package/dist/src/core/models/results/ResultCliModel.js +0 -84
- package/dist/src/core/models/results/ResultCliModel.js.map +0 -1
- package/dist/src/core/models/results/ResultErrorModel.d.ts +0 -13
- package/dist/src/core/models/results/ResultErrorModel.js +0 -43
- package/dist/src/core/models/results/ResultErrorModel.js.map +0 -1
- package/dist/src/core/models/results/ResultFileModel.d.ts +0 -11
- package/dist/src/core/models/results/ResultFileModel.js +0 -16
- package/dist/src/core/models/results/ResultFileModel.js.map +0 -1
- package/dist/src/core/models/results/ResultModel.d.ts +0 -15
- package/dist/src/core/models/results/ResultModel.js +0 -62
- package/dist/src/core/models/results/ResultModel.js.map +0 -1
- package/dist/src/core/models/results/index.d.ts +0 -4
- package/dist/src/core/models/results/index.js +0 -21
- package/dist/src/core/models/results/index.js.map +0 -1
- package/dist/src/core/rules/AbsentViewKeysRule.d.ts +0 -12
- package/dist/src/core/rules/AbsentViewKeysRule.js +0 -38
- package/dist/src/core/rules/AbsentViewKeysRule.js.map +0 -1
- package/dist/src/core/rules/EmptyKeysRule.d.ts +0 -10
- package/dist/src/core/rules/EmptyKeysRule.js +0 -25
- package/dist/src/core/rules/EmptyKeysRule.js.map +0 -1
- package/dist/src/core/rules/MisprintRule.d.ts +0 -12
- package/dist/src/core/rules/MisprintRule.js +0 -38
- package/dist/src/core/rules/MisprintRule.js.map +0 -1
- package/dist/src/core/rules/ZombiesRule.d.ts +0 -10
- package/dist/src/core/rules/ZombiesRule.js +0 -26
- package/dist/src/core/rules/ZombiesRule.js.map +0 -1
- package/dist/src/core/rules/index.d.ts +0 -4
- package/dist/src/core/rules/index.js +0 -21
- package/dist/src/core/rules/index.js.map +0 -1
- package/dist/src/core/utils/index.d.ts +0 -4
- package/dist/src/core/utils/index.js +0 -21
- package/dist/src/core/utils/index.js.map +0 -1
- package/dist/src/core/utils/keys.d.ts +0 -7
- package/dist/src/core/utils/keys.js +0 -40
- package/dist/src/core/utils/keys.js.map +0 -1
- package/dist/src/core/utils/logger.d.ts +0 -3
- package/dist/src/core/utils/logger.js +0 -13
- package/dist/src/core/utils/logger.js.map +0 -1
- package/dist/src/core/utils/path.d.ts +0 -5
- package/dist/src/core/utils/path.js +0 -56
- package/dist/src/core/utils/path.js.map +0 -1
- package/dist/src/core/utils/shared.d.ts +0 -2
- package/dist/src/core/utils/shared.js +0 -24
- package/dist/src/core/utils/shared.js.map +0 -1
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { ErrorTypes } from './../enums';
|
|
2
|
-
import { IMisprint } from '../interface';
|
|
3
|
-
declare class MisprintModel implements IMisprint {
|
|
4
|
-
type: ErrorTypes;
|
|
5
|
-
coefficient: number;
|
|
6
|
-
constructor(type?: ErrorTypes, coefficient?: number);
|
|
7
|
-
}
|
|
8
|
-
export { MisprintModel };
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MisprintModel = void 0;
|
|
4
|
-
const enums_1 = require("./../enums");
|
|
5
|
-
class MisprintModel {
|
|
6
|
-
constructor(type = enums_1.ErrorTypes.warning, coefficient = 0.9) {
|
|
7
|
-
this.type = type;
|
|
8
|
-
this.coefficient = coefficient;
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
exports.MisprintModel = MisprintModel;
|
|
12
|
-
//# sourceMappingURL=MisprintModel.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MisprintModel.js","sourceRoot":"","sources":["../../../../src/core/models/MisprintModel.ts"],"names":[],"mappings":";;;AAAA,sCAAwC;AAGxC,MAAM,aAAa;IAGf,YACI,OAAmB,kBAAU,CAAC,OAAO,EACrC,cAAsB,GAAG;QAEzB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACnC,CAAC;CACJ;AAEQ,sCAAa"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { ILogger } from "./../interface";
|
|
2
|
-
import { ErrorTypes } from "./../enums";
|
|
3
|
-
declare class StylishLogger implements ILogger {
|
|
4
|
-
private logger;
|
|
5
|
-
private errorType;
|
|
6
|
-
constructor(logger: ILogger, errorType?: ErrorTypes);
|
|
7
|
-
error(message: string): void;
|
|
8
|
-
log(message: string): void;
|
|
9
|
-
printMessage(message: string, errorType?: ErrorTypes): void;
|
|
10
|
-
}
|
|
11
|
-
export { StylishLogger };
|
|
@@ -1,37 +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.StylishLogger = void 0;
|
|
7
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
-
const enums_1 = require("./../enums");
|
|
9
|
-
class StylishLogger {
|
|
10
|
-
constructor(logger, errorType = enums_1.ErrorTypes.error) {
|
|
11
|
-
this.logger = logger;
|
|
12
|
-
this.errorType = errorType;
|
|
13
|
-
}
|
|
14
|
-
error(message) {
|
|
15
|
-
// tslint:disable-next-line:no-console
|
|
16
|
-
console.error(chalk_1.default.red(message));
|
|
17
|
-
}
|
|
18
|
-
log(message) {
|
|
19
|
-
// tslint:disable-next-line:no-console
|
|
20
|
-
console.log(chalk_1.default.yellow(message));
|
|
21
|
-
}
|
|
22
|
-
printMessage(message, errorType = this.errorType) {
|
|
23
|
-
switch (errorType) {
|
|
24
|
-
case enums_1.ErrorTypes.error:
|
|
25
|
-
this.error(message);
|
|
26
|
-
break;
|
|
27
|
-
case enums_1.ErrorTypes.warning:
|
|
28
|
-
this.log(message);
|
|
29
|
-
break;
|
|
30
|
-
default:
|
|
31
|
-
this.log(message);
|
|
32
|
-
break;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
exports.StylishLogger = StylishLogger;
|
|
37
|
-
//# sourceMappingURL=StylishLogger.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"StylishLogger.js","sourceRoot":"","sources":["../../../../src/core/models/StylishLogger.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAG1B,sCAAwC;AAExC,MAAM,aAAa;IAIf,YACI,MAAe,EACf,YAAwB,kBAAU,CAAC,KAAK;QAExC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC/B,CAAC;IAEM,KAAK,CAAC,OAAe;QACxB,sCAAsC;QACtC,OAAO,CAAC,KAAK,CAAC,eAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;IACtC,CAAC;IAEM,GAAG,CAAC,OAAe;QACtB,sCAAsC;QACtC,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;IACvC,CAAC;IAEM,YAAY,CAAC,OAAe,EAAE,YAAwB,IAAI,CAAC,SAAS;QACvE,QAAQ,SAAS,EAAE;YACf,KAAK,kBAAU,CAAC,KAAK;gBACjB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;gBACpB,MAAM;YACV,KAAK,kBAAU,CAAC,OAAO;gBACnB,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;gBAClB,MAAM;YACV;gBACI,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;gBAClB,MAAM;SACb;IACL,CAAC;CACJ;AAEQ,sCAAa"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorModel.js","sourceRoot":"","sources":["../../../../../src/core/models/error/ErrorModel.ts"],"names":[],"mappings":""}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FatalErrorModel = void 0;
|
|
4
|
-
class FatalErrorModel extends Error {
|
|
5
|
-
constructor(message, innerError) {
|
|
6
|
-
super(message);
|
|
7
|
-
this.message = message;
|
|
8
|
-
this.innerError = innerError;
|
|
9
|
-
this.name = FatalErrorModel.NAME;
|
|
10
|
-
// Fix prototype chain for target ES5
|
|
11
|
-
Object.setPrototypeOf(this, FatalErrorModel.prototype);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
exports.FatalErrorModel = FatalErrorModel;
|
|
15
|
-
FatalErrorModel.NAME = "FatalError";
|
|
16
|
-
//# sourceMappingURL=FatalErrorModel.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FatalErrorModel.js","sourceRoot":"","sources":["../../../../../src/core/models/error/FatalErrorModel.ts"],"names":[],"mappings":";;;AAAA,MAAM,eAAgB,SAAQ,KAAK;IAE/B,YAAmB,OAAe,EAAS,UAAkB;QACzD,KAAK,CAAC,OAAO,CAAC,CAAC;QADA,YAAO,GAAP,OAAO,CAAQ;QAAS,eAAU,GAAV,UAAU,CAAQ;QAEzD,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC,IAAI,CAAC;QAEjC,qCAAqC;QACrC,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC;IAC3D,CAAC;;AAGI,0CAAe;AAVN,oBAAI,GAAW,YAAY,CAAC"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./ErrorModel"), exports);
|
|
18
|
-
__exportStar(require("./FatalErrorModel"), exports);
|
|
19
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/core/models/error/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA6B;AAC7B,oDAAkC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { KeyModel } from '../KeyModel';
|
|
2
|
-
import { FileModel } from './FileModel';
|
|
3
|
-
declare class FileLanguageModel extends FileModel {
|
|
4
|
-
constructor(path: string, files?: string[], keys?: KeyModel[], ignore?: string);
|
|
5
|
-
getKeys(): FileLanguageModel;
|
|
6
|
-
getKeysWithValue(): FileLanguageModel;
|
|
7
|
-
private getLanguageKeysWithValue;
|
|
8
|
-
private getLanguageKeys;
|
|
9
|
-
}
|
|
10
|
-
export { FileLanguageModel };
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FileLanguageModel = void 0;
|
|
4
|
-
const lodash_1 = require("lodash");
|
|
5
|
-
const KeyModel_1 = require("../KeyModel");
|
|
6
|
-
const FileModel_1 = require("./FileModel");
|
|
7
|
-
class FileLanguageModel extends FileModel_1.FileModel {
|
|
8
|
-
constructor(path, files = [], keys = [], ignore = '') {
|
|
9
|
-
super(path, files, keys, ignore);
|
|
10
|
-
}
|
|
11
|
-
getKeys() {
|
|
12
|
-
this.files = this.getNormalizeFiles();
|
|
13
|
-
this.keys = this.parseKeys((fileData, filePath) => {
|
|
14
|
-
try {
|
|
15
|
-
const fileKeysNames = this.getLanguageKeys(JSON.parse(fileData));
|
|
16
|
-
return !fileKeysNames ? [] : fileKeysNames
|
|
17
|
-
.filter(x => !!x)
|
|
18
|
-
.map((key) => {
|
|
19
|
-
return new KeyModel_1.KeyModel(key, [], [filePath]);
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
catch (e) {
|
|
23
|
-
const errorMessage = `Can't parse JSON file: ${filePath}`;
|
|
24
|
-
throw new Error(errorMessage);
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
return this;
|
|
28
|
-
}
|
|
29
|
-
getKeysWithValue() {
|
|
30
|
-
this.files = this.getNormalizeFiles();
|
|
31
|
-
this.keys = this.parseKeysWithValues((fileData, filePath) => {
|
|
32
|
-
try {
|
|
33
|
-
const fileKeysNames = this.getLanguageKeysWithValue(JSON.parse(fileData));
|
|
34
|
-
return fileKeysNames.map((key) => {
|
|
35
|
-
key.languages.push(filePath);
|
|
36
|
-
return key;
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
catch (e) {
|
|
40
|
-
const errorMessage = `Can't parse JSON file: ${filePath}`;
|
|
41
|
-
throw new Error(errorMessage);
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
return this;
|
|
45
|
-
}
|
|
46
|
-
getLanguageKeysWithValue(obj, cat = null, tKeys = [], tValues = []) {
|
|
47
|
-
const currentKeys = [...tKeys];
|
|
48
|
-
const correctKeys = tValues;
|
|
49
|
-
const objectKeys = Object.keys(obj);
|
|
50
|
-
objectKeys.forEach((key) => {
|
|
51
|
-
// @ts-ignore
|
|
52
|
-
const keyValue = (0, lodash_1.get)(obj, key);
|
|
53
|
-
const isObject = typeof keyValue === 'object';
|
|
54
|
-
const currentKey = cat === null ? key : cat.concat('.', key);
|
|
55
|
-
if (isObject) {
|
|
56
|
-
const childKeys = this.getLanguageKeysWithValue(keyValue, currentKey, tKeys, correctKeys).map((x) => x.name);
|
|
57
|
-
currentKeys.push(...childKeys);
|
|
58
|
-
}
|
|
59
|
-
else {
|
|
60
|
-
correctKeys.push({
|
|
61
|
-
name: currentKey,
|
|
62
|
-
value: keyValue.toString(),
|
|
63
|
-
views: [],
|
|
64
|
-
languages: []
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
return correctKeys;
|
|
69
|
-
}
|
|
70
|
-
getLanguageKeys(obj, cat = null, tKeys = []) {
|
|
71
|
-
const currentKeys = [...tKeys];
|
|
72
|
-
const objectKeys = Object.keys(obj);
|
|
73
|
-
objectKeys.forEach((key) => {
|
|
74
|
-
// @ts-ignore
|
|
75
|
-
const keyValue = (0, lodash_1.get)(obj, key);
|
|
76
|
-
const isObject = typeof keyValue === 'object';
|
|
77
|
-
const currentKey = cat === null ? key : cat.concat('.', key);
|
|
78
|
-
if (isObject) {
|
|
79
|
-
const childKeys = this.getLanguageKeys(keyValue, currentKey, tKeys);
|
|
80
|
-
currentKeys.push(...childKeys);
|
|
81
|
-
}
|
|
82
|
-
else {
|
|
83
|
-
currentKeys.push(currentKey);
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
return currentKeys;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
exports.FileLanguageModel = FileLanguageModel;
|
|
90
|
-
//# sourceMappingURL=FileLanguageModel.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FileLanguageModel.js","sourceRoot":"","sources":["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Model';
|
|
2
|
-
declare abstract class FileModel {
|
|
3
|
-
path: string;
|
|
4
|
-
keys: KeyModel[];
|
|
5
|
-
files: string[];
|
|
6
|
-
ignore: string | undefined;
|
|
7
|
-
protected constructor(path: string, files?: string[], keys?: KeyModel[], ignore?: string | undefined);
|
|
8
|
-
getNormalizeFiles(): string[];
|
|
9
|
-
parseKeys(identity: Function): KeyModel[];
|
|
10
|
-
parseKeysWithValues(identity: Function): KeyModel[];
|
|
11
|
-
}
|
|
12
|
-
export { FileModel };
|
|
@@ -1,44 +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.FileModel = void 0;
|
|
7
|
-
const fs_1 = __importDefault(require("fs"));
|
|
8
|
-
const utils_1 = require("../../utils");
|
|
9
|
-
class FileModel {
|
|
10
|
-
constructor(path, files = [], keys = [], ignore = undefined) {
|
|
11
|
-
this.path = path;
|
|
12
|
-
this.keys = keys;
|
|
13
|
-
this.files = files;
|
|
14
|
-
this.ignore = ignore;
|
|
15
|
-
}
|
|
16
|
-
getNormalizeFiles() {
|
|
17
|
-
const ignorePathList = this.ignore && this.ignore !== '' ? this.ignore.split(',') : [];
|
|
18
|
-
const resultFilesList = utils_1.PathUtils.getNormalizeFiles(this.path, ignorePathList);
|
|
19
|
-
if (!resultFilesList.length) {
|
|
20
|
-
throw Error(`Cannot found files for path: '${this.path}'`);
|
|
21
|
-
}
|
|
22
|
-
return resultFilesList;
|
|
23
|
-
}
|
|
24
|
-
parseKeys(identity) {
|
|
25
|
-
const keysModels = this.files.reduce((acum, filePath) => {
|
|
26
|
-
const fileData = fs_1.default.readFileSync(filePath).toString();
|
|
27
|
-
const models = identity(fileData, filePath);
|
|
28
|
-
acum.push(...models);
|
|
29
|
-
return acum;
|
|
30
|
-
}, []);
|
|
31
|
-
return utils_1.KeysUtils.groupKeysByName(keysModels);
|
|
32
|
-
}
|
|
33
|
-
parseKeysWithValues(identity) {
|
|
34
|
-
const keysModels = this.files.reduce((acum, filePath) => {
|
|
35
|
-
const fileData = fs_1.default.readFileSync(filePath).toString();
|
|
36
|
-
const models = identity(fileData, filePath);
|
|
37
|
-
acum.push(...models);
|
|
38
|
-
return acum;
|
|
39
|
-
}, []);
|
|
40
|
-
return keysModels;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
exports.FileModel = FileModel;
|
|
44
|
-
//# sourceMappingURL=FileModel.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FileModel.js","sourceRoot":"","sources":["../../../../../src/core/models/files/FileModel.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AAGpB,uCAAmD;AAGnD,MAAe,SAAS;IAMpB,YACI,IAAY,EACZ,QAAkB,EAAE,EACpB,OAAmB,EAAE,EACrB,SAA6B,SAAS;QAEtC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACzB,CAAC;IAEM,iBAAiB;QACpB,MAAM,cAAc,GAAa,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACjG,MAAM,eAAe,GAAa,iBAAS,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;QAEzF,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE;YACzB,MAAM,KAAK,CAAC,iCAAiC,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC;SAC9D;QACD,OAAO,eAAe,CAAC;IAC3B,CAAC;IAGM,SAAS,CAAC,QAAkB;QAC/B,MAAM,UAAU,GAAe,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,IAAgB,EAAE,QAAgB,EAAE,EAAE;YACpF,MAAM,QAAQ,GAAW,YAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,QAAQ,EAAE,CAAC;YAC9D,MAAM,MAAM,GAAe,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;YACxD,IAAI,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,CAAC;YACrB,OAAO,IAAI,CAAC;QAChB,CAAC,EAAE,EAAE,CAAC,CAAC;QACP,OAAO,iBAAS,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC;IACjD,CAAC;IAEM,mBAAmB,CAAC,QAAkB;QACzC,MAAM,UAAU,GAAe,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,IAAgB,EAAE,QAAgB,EAAE,EAAE;YACpF,MAAM,QAAQ,GAAW,YAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,QAAQ,EAAE,CAAC;YAC9D,MAAM,MAAM,GAAe,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;YACxD,IAAI,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,CAAC;YACrB,OAAO,IAAI,CAAC;QAChB,CAAC,EAAE,EAAE,CAAC,CAAC;QACP,OAAO,UAAU,CAAC;IACtB,CAAC;CACJ;AAEQ,8BAAS"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { FileModel } from "./FileModel";
|
|
2
|
-
import { KeyModel } from "../KeyModel";
|
|
3
|
-
declare class FileViewModel extends FileModel {
|
|
4
|
-
constructor(path: string, files?: string[], keys?: KeyModel[], ignore?: string);
|
|
5
|
-
getKeys(regExp: RegExp): FileViewModel;
|
|
6
|
-
}
|
|
7
|
-
export { FileViewModel };
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FileViewModel = void 0;
|
|
4
|
-
const FileModel_1 = require("./FileModel");
|
|
5
|
-
const KeyModel_1 = require("../KeyModel");
|
|
6
|
-
class FileViewModel extends FileModel_1.FileModel {
|
|
7
|
-
constructor(path, files = [], keys = [], ignore = '') {
|
|
8
|
-
super(path, files, keys, ignore);
|
|
9
|
-
}
|
|
10
|
-
getKeys(regExp) {
|
|
11
|
-
this.files = this.getNormalizeFiles();
|
|
12
|
-
this.keys = this.parseKeys((fileData, filePath) => {
|
|
13
|
-
const fileKeysNames = fileData.match(regExp);
|
|
14
|
-
return !fileKeysNames ? [] : fileKeysNames
|
|
15
|
-
.filter(x => !!x)
|
|
16
|
-
.map((key) => new KeyModel_1.KeyModel(key, [filePath], []));
|
|
17
|
-
});
|
|
18
|
-
return this;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
exports.FileViewModel = FileViewModel;
|
|
22
|
-
//# sourceMappingURL=FileViewModel.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FileViewModel.js","sourceRoot":"","sources":["../../../../../src/core/models/files/FileViewModel.ts"],"names":[],"mappings":";;;AAAA,2CAAwC;AACxC,0CAAuC;AAEvC,MAAM,aAAc,SAAQ,qBAAS;IACjC,YACI,IAAY,EACZ,QAAkB,EAAE,EACpB,OAAmB,EAAE,EACrB,SAAiB,EAAE;QAEnB,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;IACrC,CAAC;IAEM,OAAO,CAAC,MAAc;QACzB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACtC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,QAAgB,EAAE,QAAgB,EAAc,EAAE;YAC1E,MAAM,aAAa,GAAa,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAa,CAAC;YACnE,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,aAAa;iBACrC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;iBAChB,GAAG,CAAC,CAAC,GAAW,EAAE,EAAE,CAAC,IAAI,mBAAQ,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;QACjE,CAAC,CAAC,CAAC;QACH,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAEQ,sCAAa"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./FileModel"), exports);
|
|
18
|
-
__exportStar(require("./FileViewModel"), exports);
|
|
19
|
-
__exportStar(require("./FileLanguageModel"), exports);
|
|
20
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/core/models/files/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,kDAAgC;AAChC,sDAAoC"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./error"), exports);
|
|
18
|
-
__exportStar(require("./files"), exports);
|
|
19
|
-
__exportStar(require("./results"), exports);
|
|
20
|
-
__exportStar(require("./KeyModel"), exports);
|
|
21
|
-
__exportStar(require("./StylishLogger"), exports);
|
|
22
|
-
__exportStar(require("./MisprintModel"), exports);
|
|
23
|
-
__exportStar(require("./LanguagesModel"), exports);
|
|
24
|
-
__exportStar(require("./KeyModelWithLanguages"), exports);
|
|
25
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/core/models/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,0CAAwB;AACxB,4CAA0B;AAC1B,6CAA2B;AAC3B,kDAAgC;AAChC,kDAAgC;AAChC,mDAAiC;AACjC,0DAAwC"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { ResultModel } from './ResultModel';
|
|
2
|
-
import { ResultErrorModel } from './ResultErrorModel';
|
|
3
|
-
import { StatusCodes } from '../../enums';
|
|
4
|
-
declare class ResultCliModel {
|
|
5
|
-
errors: ResultErrorModel[];
|
|
6
|
-
maxCountWarning: number;
|
|
7
|
-
countWarnings(): number;
|
|
8
|
-
hasWarnings(): boolean;
|
|
9
|
-
isFullOfWarning(): boolean;
|
|
10
|
-
countErrors(): number;
|
|
11
|
-
hasErrors(): boolean;
|
|
12
|
-
countMisprint(): number;
|
|
13
|
-
hasMisprint(): boolean;
|
|
14
|
-
getEmptyKeys(): ResultErrorModel[];
|
|
15
|
-
countEmptyKeys(): number;
|
|
16
|
-
hasEmptyKeys(): boolean;
|
|
17
|
-
exitCode(): StatusCodes;
|
|
18
|
-
constructor(errors?: ResultErrorModel[], maxCountWarning?: number);
|
|
19
|
-
private getResultFiles;
|
|
20
|
-
getResultModel(): ResultModel;
|
|
21
|
-
}
|
|
22
|
-
export { ResultCliModel };
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ResultCliModel = void 0;
|
|
4
|
-
const lodash_1 = require("lodash");
|
|
5
|
-
const utils_1 = require("../../utils");
|
|
6
|
-
const ResultModel_1 = require("./ResultModel");
|
|
7
|
-
const ResultFileModel_1 = require("./ResultFileModel");
|
|
8
|
-
const enums_1 = require("../../enums");
|
|
9
|
-
class ResultCliModel {
|
|
10
|
-
constructor(errors = [], maxCountWarning = 0) {
|
|
11
|
-
this.errors = [];
|
|
12
|
-
this.maxCountWarning = 0;
|
|
13
|
-
this.errors = errors;
|
|
14
|
-
this.maxCountWarning = +maxCountWarning;
|
|
15
|
-
}
|
|
16
|
-
countWarnings() {
|
|
17
|
-
const result = (this.errors.filter((item) => item.errorType === enums_1.ErrorTypes.warning) || []).length;
|
|
18
|
-
return result;
|
|
19
|
-
}
|
|
20
|
-
hasWarnings() {
|
|
21
|
-
const result = this.countWarnings() > 0;
|
|
22
|
-
return result;
|
|
23
|
-
}
|
|
24
|
-
isFullOfWarning() {
|
|
25
|
-
const result = this.maxCountWarning && this.maxCountWarning !== 0 && this.hasWarnings() ? this.countWarnings() > this.maxCountWarning : false;
|
|
26
|
-
return result;
|
|
27
|
-
}
|
|
28
|
-
countErrors() {
|
|
29
|
-
const result = (this.errors.filter((item) => item.errorType === enums_1.ErrorTypes.error) || []).length;
|
|
30
|
-
return result;
|
|
31
|
-
}
|
|
32
|
-
hasErrors() {
|
|
33
|
-
const result = this.countErrors() > 0 || this.isFullOfWarning();
|
|
34
|
-
return result;
|
|
35
|
-
}
|
|
36
|
-
countMisprint() {
|
|
37
|
-
const misprintCount = (this.errors.filter((item) => item.errorFlow === enums_1.ErrorFlow.misprintKeys) || []).length;
|
|
38
|
-
return misprintCount;
|
|
39
|
-
}
|
|
40
|
-
hasMisprint() {
|
|
41
|
-
const result = this.countMisprint() > 0;
|
|
42
|
-
return result;
|
|
43
|
-
}
|
|
44
|
-
getEmptyKeys() {
|
|
45
|
-
const result = (this.errors.filter((item) => item.errorFlow === enums_1.ErrorFlow.emptyKeys) || []);
|
|
46
|
-
return result;
|
|
47
|
-
}
|
|
48
|
-
countEmptyKeys() {
|
|
49
|
-
const result = (this.errors.filter((item) => item.errorFlow === enums_1.ErrorFlow.emptyKeys) || []).length;
|
|
50
|
-
return result;
|
|
51
|
-
}
|
|
52
|
-
hasEmptyKeys() {
|
|
53
|
-
const result = this.countEmptyKeys() > 0;
|
|
54
|
-
return result;
|
|
55
|
-
}
|
|
56
|
-
exitCode() {
|
|
57
|
-
return this.hasErrors() ? enums_1.StatusCodes.error : enums_1.StatusCodes.successful;
|
|
58
|
-
}
|
|
59
|
-
getResultFiles() {
|
|
60
|
-
const resultFiles = (0, lodash_1.chain)(this.errors)
|
|
61
|
-
.groupBy("currentPath")
|
|
62
|
-
.map((dictionary, key) => {
|
|
63
|
-
let clearDictionary = dictionary;
|
|
64
|
-
const hasError = (0, lodash_1.some)(dictionary, { 'errorType': enums_1.ErrorTypes.error });
|
|
65
|
-
const errorType = hasError || this.isFullOfWarning() ? enums_1.ErrorTypes.error : enums_1.ErrorTypes.warning;
|
|
66
|
-
if (this.isFullOfWarning()) {
|
|
67
|
-
clearDictionary = dictionary.map((item) => {
|
|
68
|
-
item.errorType = enums_1.ErrorTypes.error;
|
|
69
|
-
return item;
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
return new ResultFileModel_1.ResultFileModel(key, clearDictionary, errorType);
|
|
73
|
-
})
|
|
74
|
-
.value();
|
|
75
|
-
return resultFiles;
|
|
76
|
-
}
|
|
77
|
-
getResultModel() {
|
|
78
|
-
const resultFiles = this.getResultFiles();
|
|
79
|
-
const resultModel = new ResultModel_1.ResultModel(this, resultFiles, this.hasErrors(), this.hasWarnings(), utils_1.logger);
|
|
80
|
-
return resultModel;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
exports.ResultCliModel = ResultCliModel;
|
|
84
|
-
//# sourceMappingURL=ResultCliModel.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ResultCliModel.js","sourceRoot":"","sources":["../../../../../src/core/models/results/ResultCliModel.ts"],"names":[],"mappings":";;;AAAA,mCAAqC;AAErC,uCAAqC;AACrC,+CAA4C;AAC5C,uDAAoD;AAEpD,uCAAiE;AAEjE,MAAM,cAAc;IA0DhB,YACI,SAA6B,EAAE,EAC/B,kBAA0B,CAAC;QA3DxB,WAAM,GAAuB,EAAE,CAAC;QAEhC,oBAAe,GAAW,CAAC,CAAC;QA2D/B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,eAAe,GAAG,CAAC,eAAe,CAAC;IAC5C,CAAC;IA5DM,aAAa;QAChB,MAAM,MAAM,GAAW,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAsB,EAAE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,CAAC,CAAC,IAAsB,EAAE,EAAE;oBACxD,IAAI,CAAC,SAAS,GAAG,kBAAU,CAAC,KAAK,CAAC;oBAClC,OAAO,IAAI,CAAC;gBAChB,CAAC,CAAC,CAAC;aACN;YACD,OAAO,IAAI,iCAAe,CAAC,GAAG,EAAE,eAAe,EAAE,SAAS,CAAC,CAAC;QAChE,CAAC,CAAC;aACD,KAAK,EAAE,CAAC;QACb,OAAO,WAAW,CAAC;IACvB,CAAC;IAEM,cAAc;QACjB,MAAM,WAAW,GAAsB,IAAI,CAAC,cAAc,EAAE,CAAC;QAC7D,MAAM,WAAW,GAAgB,IAAI,yBAAW,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,CAAC,SAAS,EAAE,EAAE,IAAI,CAAC,WAAW,EAAE,EAAE,cAAM,CAAC,CAAC;QAClH,OAAO,WAAW,CAAC;IACvB,CAAC;CACJ;AAEQ,wCAAc"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { IValidationMessage } from '../../interface';
|
|
2
|
-
import { ErrorFlow, ErrorTypes } from '../../enums';
|
|
3
|
-
declare class ResultErrorModel implements IValidationMessage {
|
|
4
|
-
value: string;
|
|
5
|
-
errorFlow: ErrorFlow;
|
|
6
|
-
errorType: ErrorTypes;
|
|
7
|
-
absentedPath?: string | string[];
|
|
8
|
-
currentPath: string;
|
|
9
|
-
suggestions: string[];
|
|
10
|
-
constructor(value: string, errorFlow: ErrorFlow | undefined, errorType: ErrorTypes | undefined, currentPath: string, absentedPath?: string | string[], suggestions?: string[]);
|
|
11
|
-
message(): string | string[] | null;
|
|
12
|
-
}
|
|
13
|
-
export { ResultErrorModel };
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ResultErrorModel = void 0;
|
|
4
|
-
const lodash_1 = require("lodash");
|
|
5
|
-
const enums_1 = require("../../enums");
|
|
6
|
-
class ResultErrorModel {
|
|
7
|
-
constructor(value, errorFlow = enums_1.ErrorFlow.keysOnViews, errorType = enums_1.ErrorTypes.error, currentPath, absentedPath, suggestions = []) {
|
|
8
|
-
this.value = value;
|
|
9
|
-
this.errorFlow = errorFlow;
|
|
10
|
-
this.errorType = errorType;
|
|
11
|
-
this.currentPath = currentPath;
|
|
12
|
-
this.absentedPath = absentedPath;
|
|
13
|
-
this.suggestions = suggestions;
|
|
14
|
-
}
|
|
15
|
-
message() {
|
|
16
|
-
let message = null;
|
|
17
|
-
switch (this.errorFlow) {
|
|
18
|
-
case enums_1.ErrorFlow.keysOnViews:
|
|
19
|
-
message = (0, lodash_1.isArray)(this.absentedPath)
|
|
20
|
-
? this.absentedPath.map((path) => `Key: '${this.value}' doesn't exist in '${path}'`)
|
|
21
|
-
: `Key: '${this.value}' doesn't exist in '${this.absentedPath}'`;
|
|
22
|
-
break;
|
|
23
|
-
case enums_1.ErrorFlow.zombieKeys:
|
|
24
|
-
message = `Key: '${this.value}' doesn't exist in project'`;
|
|
25
|
-
break;
|
|
26
|
-
case enums_1.ErrorFlow.misprintKeys:
|
|
27
|
-
message = this.suggestions.reduce((accum, item) => {
|
|
28
|
-
accum.push(`Possible match: '${item}' for key '${this.value}'`);
|
|
29
|
-
return accum;
|
|
30
|
-
}, []);
|
|
31
|
-
break;
|
|
32
|
-
case enums_1.ErrorFlow.emptyKeys:
|
|
33
|
-
message = `Key: '${this.value}' is empty in ${this.currentPath}`;
|
|
34
|
-
break;
|
|
35
|
-
default:
|
|
36
|
-
message = 'Unknown error please write to the author';
|
|
37
|
-
break;
|
|
38
|
-
}
|
|
39
|
-
return message;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
exports.ResultErrorModel = ResultErrorModel;
|
|
43
|
-
//# sourceMappingURL=ResultErrorModel.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ResultErrorModel.js","sourceRoot":"","sources":["../../../../../src/core/models/results/ResultErrorModel.ts"],"names":[],"mappings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AC,CAAC;gBACP,MAAM;YACV,KAAK,iBAAS,CAAC,SAAS;gBACpB,OAAO,GAAG,SAAS,IAAI,CAAC,KAAK,iBAAiB,IAAI,CAAC,WAAW,EAAE,CAAC;gBACjE,MAAM;YACV;gBACI,OAAO,GAAG,0CAA0C,CAAC;gBACrD,MAAM;SACb;QACD,OAAO,OAAO,CAAC;IACnB,CAAC;CACJ;AAEQ,4CAAgB"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { ErrorTypes } from "../../enums";
|
|
2
|
-
import { ResultErrorModel } from "./ResultErrorModel";
|
|
3
|
-
import { IValidationMessage } from "./../../interface";
|
|
4
|
-
declare class ResultFileModel implements IValidationMessage {
|
|
5
|
-
value?: string;
|
|
6
|
-
errors: ResultErrorModel[];
|
|
7
|
-
errorType: ErrorTypes;
|
|
8
|
-
constructor(value?: string, errors?: ResultErrorModel[], errorType?: ErrorTypes);
|
|
9
|
-
message(): string | string[] | null;
|
|
10
|
-
}
|
|
11
|
-
export { ResultFileModel };
|