definition-generator-framework 1.12.5 → 1.12.6
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/dist/framework/definition-component.d.ts +11 -9
- package/dist/framework/definition-component.js +18 -18
- package/dist/framework/definition-generator.d.ts +6 -5
- package/dist/framework/definition-generator.js +16 -18
- package/dist/framework/file-content-generator/file-content-generator.js +1 -1
- package/dist/framework/file-content-generator/file-content-generator.test.js +49 -49
- package/dist/framework/framework.d.ts +14 -13
- package/dist/framework/framework.data.d.ts +3 -3
- package/dist/framework/framework.data.js +13 -7
- package/dist/framework/framework.js +36 -33
- package/dist/framework/framework.model.d.ts +15 -15
- package/dist/framework/framework.model.js +3 -3
- package/dist/helpers/common-functions/common-functions.js +1 -1
- package/dist/helpers/common-functions/common-functions.spec.js +48 -48
- package/dist/helpers/duplicate-helper/duplicate-helper.spec.js +52 -52
- package/dist/helpers/output-helper/output-helper.d.ts +26 -26
- package/dist/helpers/output-helper/output-helper.js +127 -107
- package/dist/helpers/output-helper/output-helper.spec.d.ts +22 -22
- package/dist/helpers/output-helper/output-helper.spec.js +223 -211
- package/dist/helpers/output-helper/output-helper.test.d.ts +22 -22
- package/dist/helpers/output-helper/output-helper.test.js +224 -212
- package/dist/helpers/raw-definition-helper/raw-definition.helper.spec.js +133 -125
- package/dist/helpers/validator/custom-validator-helper/custom-validator.helper.spec.d.ts +1 -1
- package/dist/helpers/validator/custom-validator-helper/custom-validator.helper.spec.js +174 -156
- package/dist/helpers/validator/custom-validators/image.custom-validator.d.ts +6 -6
- package/dist/helpers/validator/custom-validators/image.custom-validator.js +40 -39
- package/dist/helpers/validator/custom-validators/unique-name-group.custom-validator.d.ts +4 -4
- package/dist/helpers/validator/custom-validators/unique-name-group.custom-validator.js +29 -29
- package/dist/helpers/validator/joi-custom-validators.spec.js +284 -240
- package/dist/helpers/validator/validator.spec.js +313 -303
- package/dist/pipeline/1-select-definitions-helper.d.ts +13 -13
- package/dist/pipeline/1-select-definitions-helper.js +68 -72
- package/dist/pipeline/1-select-definitions.helper.test.js +40 -40
- package/dist/pipeline/1-select-definitions.spec.js +131 -131
- package/dist/pipeline/2-structure-parser.helper.spec.js +266 -266
- package/dist/pipeline/parsers/array-parser.spec.js +116 -113
- package/dist/pipeline/parsers/object-parser.spec.js +159 -153
- package/dist/pipeline/parsers/primitive-parser.spec.js +67 -67
- package/dist/pre-made-components/assets/3-font.js +4 -4
- package/dist/pre-made-components/events/1-event.d.ts +1 -1
- package/dist/pre-made-components/events/1-event.js +157 -125
- package/dist/pre-made-components/events/2-event-test.d.ts +8 -8
- package/dist/pre-made-components/events/2-event-test.js +156 -119
- package/dist/pre-made-components/events/2-script-test.js +0 -1
- package/dist/pre-made-components/events/event-setup.d.ts +10 -5
- package/dist/pre-made-components/events/event-setup.js +15 -15
- package/dist/pre-made-components/events/script-setup.d.ts +5 -3
- package/dist/pre-made-components/events/script-setup.js +11 -11
- package/package.json +5 -10
|
@@ -1,43 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
var __importDefault =
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
var __importDefault =
|
|
3
|
+
(this && this.__importDefault) ||
|
|
4
|
+
function (mod) {
|
|
5
|
+
return mod && mod.__esModule ? mod : { default: mod };
|
|
6
|
+
};
|
|
7
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
6
8
|
exports.ImageCustomValidator = void 0;
|
|
7
|
-
const image_size_1 = __importDefault(require(
|
|
8
|
-
const custom_validator_helper_1 = require(
|
|
9
|
-
const context_1 = require(
|
|
9
|
+
const image_size_1 = __importDefault(require('image-size'));
|
|
10
|
+
const custom_validator_helper_1 = require('../custom-validator-helper/custom-validator.helper');
|
|
11
|
+
const context_1 = require('../../../framework/context');
|
|
10
12
|
class ImageCustomValidator {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
13
|
+
constructor(fs) {
|
|
14
|
+
this.fs = fs;
|
|
15
|
+
this.regex = /^[\S]+$/;
|
|
16
|
+
this.validate = (value, helpers) => {
|
|
17
|
+
let validationState = custom_validator_helper_1.CustomValidatorHelper.getValidationState(helpers);
|
|
18
|
+
if (validationState === 'valid') {
|
|
19
|
+
let { rawDefinition } = custom_validator_helper_1.CustomValidatorHelper.getPathAndRawDefinition(helpers);
|
|
20
|
+
let pathPrefix = rawDefinition.location.path.substring(0, rawDefinition.location.path.lastIndexOf('/') + 1);
|
|
21
|
+
value = pathPrefix + value;
|
|
22
|
+
if (!this.fs.existsSync(value)) {
|
|
23
|
+
throw new Error(`No file is found in the path: "${value}"`);
|
|
24
|
+
} else {
|
|
25
|
+
try {
|
|
26
|
+
let size = (0, image_size_1.default)(value);
|
|
27
|
+
return {
|
|
28
|
+
url: value.replace(context_1.Context.config.projectRoot, '.'),
|
|
29
|
+
size: { x: size.width, y: size.height }
|
|
30
|
+
};
|
|
31
|
+
} catch (error) {
|
|
32
|
+
throw new Error(`The file in the path "${value}" is not an image`);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
} else {
|
|
36
|
+
throw new Error(
|
|
37
|
+
`Internal Error; joi validation context for image validator: Path: "${helpers.state.path}", RawDefinition: "${JSON.stringify(helpers.prefs.context)}"`
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
}
|
|
41
42
|
}
|
|
42
43
|
exports.ImageCustomValidator = ImageCustomValidator;
|
|
43
|
-
//# sourceMappingURL=image.custom-validator.js.map
|
|
44
|
+
//# sourceMappingURL=image.custom-validator.js.map
|
|
@@ -2,8 +2,8 @@ import Joi, { ErrorReport } from 'joi';
|
|
|
2
2
|
import { CustomValidator } from '../joi-custom-validators';
|
|
3
3
|
import { DefinitionComponentClassType } from '../../../framework/definition-component';
|
|
4
4
|
export declare class UniqueNameGroupCustomValidator implements CustomValidator {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
private definitionComponentClass;
|
|
6
|
+
readonly regex: RegExp;
|
|
7
|
+
readonly validate: (value: string, helpers: Joi.CustomHelpers) => any | ErrorReport;
|
|
8
|
+
constructor(definitionComponentClass: DefinitionComponentClassType<any>);
|
|
9
9
|
}
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports,
|
|
1
|
+
'use strict';
|
|
2
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
3
3
|
exports.UniqueNameGroupCustomValidator = void 0;
|
|
4
|
-
const common_functions_1 = require(
|
|
5
|
-
const raw_definition_helper_1 = require(
|
|
6
|
-
const custom_validator_helper_1 = require(
|
|
4
|
+
const common_functions_1 = require('../../common-functions/common-functions');
|
|
5
|
+
const raw_definition_helper_1 = require('../../raw-definition-helper/raw-definition.helper');
|
|
6
|
+
const custom_validator_helper_1 = require('../custom-validator-helper/custom-validator.helper');
|
|
7
7
|
class UniqueNameGroupCustomValidator {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
8
|
+
constructor(definitionComponentClass) {
|
|
9
|
+
this.definitionComponentClass = definitionComponentClass;
|
|
10
|
+
this.regex = /^[a-z]+([a-zA-Z0-9]+)*$/;
|
|
11
|
+
this.validate = (value, helpers) => {
|
|
12
|
+
let componentName = this.definitionComponentClass.$meta.componentName;
|
|
13
|
+
let validationState = custom_validator_helper_1.CustomValidatorHelper.getValidationState(helpers);
|
|
14
|
+
if (validationState === 'valid') {
|
|
15
|
+
let { path, rawDefinition } = custom_validator_helper_1.CustomValidatorHelper.getPathAndRawDefinition(helpers);
|
|
16
|
+
let duplicateHelper = custom_validator_helper_1.CustomValidatorHelper.getDuplicateHelper(componentName);
|
|
17
|
+
duplicateHelper.newEntry(value, {
|
|
18
|
+
line: raw_definition_helper_1.RawDefinitionHelper.findLine(rawDefinition, path),
|
|
19
|
+
path: rawDefinition.location.path
|
|
20
|
+
});
|
|
21
|
+
return common_functions_1.CommonFunctions.decorateDefinitionName(value, componentName);
|
|
22
|
+
} else if (validationState === 'registerLoop') {
|
|
23
|
+
custom_validator_helper_1.CustomValidatorHelper.getDefinitionNames(componentName).add(value);
|
|
24
|
+
} else {
|
|
25
|
+
throw new Error(
|
|
26
|
+
`Internal Error; joi validation context for uniqueNameGroup validator: Path: "${helpers.state.path}", RawDefinition: "${JSON.stringify(helpers.prefs.context)}"`
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
31
|
}
|
|
32
32
|
exports.UniqueNameGroupCustomValidator = UniqueNameGroupCustomValidator;
|
|
33
|
-
//# sourceMappingURL=unique-name-group.custom-validator.js.map
|
|
33
|
+
//# sourceMappingURL=unique-name-group.custom-validator.js.map
|