definition-generator-framework 1.12.5 → 1.12.7

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