@lionweb/validation 0.7.0 → 0.7.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.
Files changed (139) hide show
  1. package/dist/index.d.ts +5 -0
  2. package/dist/index.d.ts.map +1 -0
  3. package/dist/index.js +5 -0
  4. package/dist/index.js.map +1 -0
  5. package/dist/issues/LanguageIssues.d.ts +99 -0
  6. package/dist/issues/LanguageIssues.d.ts.map +1 -0
  7. package/dist/issues/LanguageIssues.js +146 -0
  8. package/dist/issues/LanguageIssues.js.map +1 -0
  9. package/dist/issues/ReferenceIssues.d.ts +43 -0
  10. package/dist/issues/ReferenceIssues.d.ts.map +1 -0
  11. package/dist/issues/ReferenceIssues.js +53 -0
  12. package/dist/issues/ReferenceIssues.js.map +1 -0
  13. package/dist/issues/SyntaxIssues.d.ts +53 -0
  14. package/dist/issues/SyntaxIssues.d.ts.map +1 -0
  15. package/dist/issues/SyntaxIssues.js +81 -0
  16. package/dist/issues/SyntaxIssues.js.map +1 -0
  17. package/dist/issues/ValidationIssue.d.ts +15 -0
  18. package/dist/issues/ValidationIssue.d.ts.map +1 -0
  19. package/dist/issues/ValidationIssue.js +17 -0
  20. package/dist/issues/ValidationIssue.js.map +1 -0
  21. package/dist/issues/index.d.ts +5 -0
  22. package/dist/issues/index.d.ts.map +1 -0
  23. package/dist/issues/index.js +5 -0
  24. package/dist/issues/index.js.map +1 -0
  25. package/dist/languages/CompositeLionWebLanguageWrapper.d.ts +24 -0
  26. package/dist/languages/CompositeLionWebLanguageWrapper.d.ts.map +1 -0
  27. package/dist/languages/CompositeLionWebLanguageWrapper.js +56 -0
  28. package/dist/languages/CompositeLionWebLanguageWrapper.js.map +1 -0
  29. package/dist/languages/LanguageRegistry.d.ts +19 -0
  30. package/dist/languages/LanguageRegistry.d.ts.map +1 -0
  31. package/dist/languages/LanguageRegistry.js +37 -0
  32. package/dist/languages/LanguageRegistry.js.map +1 -0
  33. package/dist/languages/LanguageUtils.d.ts +35 -0
  34. package/dist/languages/LanguageUtils.d.ts.map +1 -0
  35. package/dist/languages/LanguageUtils.js +54 -0
  36. package/dist/languages/LanguageUtils.js.map +1 -0
  37. package/dist/languages/LionCore-M3.json +2356 -0
  38. package/dist/languages/LionCore-builtins.json +372 -0
  39. package/dist/languages/LionWebLanguageWrapper.d.ts +31 -0
  40. package/dist/languages/LionWebLanguageWrapper.d.ts.map +1 -0
  41. package/dist/languages/LionWebLanguageWrapper.js +69 -0
  42. package/dist/languages/LionWebLanguageWrapper.js.map +1 -0
  43. package/dist/languages/MetaPointerMap.d.ts +11 -0
  44. package/dist/languages/MetaPointerMap.d.ts.map +1 -0
  45. package/dist/languages/MetaPointerMap.js +39 -0
  46. package/dist/languages/MetaPointerMap.js.map +1 -0
  47. package/dist/languages/index.d.ts +3 -0
  48. package/dist/languages/index.d.ts.map +1 -0
  49. package/dist/languages/index.js +3 -0
  50. package/dist/languages/index.js.map +1 -0
  51. package/dist/runners/FileUtils.d.ts +6 -0
  52. package/dist/runners/FileUtils.d.ts.map +1 -0
  53. package/dist/runners/FileUtils.js +53 -0
  54. package/dist/runners/FileUtils.js.map +1 -0
  55. package/dist/runners/RunCheckFolder.d.ts +2 -0
  56. package/dist/runners/RunCheckFolder.d.ts.map +1 -0
  57. package/dist/runners/RunCheckFolder.js +6 -0
  58. package/dist/runners/RunCheckFolder.js.map +1 -0
  59. package/dist/runners/RunCheckFolderWithLanguage.d.ts +2 -0
  60. package/dist/runners/RunCheckFolderWithLanguage.d.ts.map +1 -0
  61. package/dist/runners/RunCheckFolderWithLanguage.js +40 -0
  62. package/dist/runners/RunCheckFolderWithLanguage.js.map +1 -0
  63. package/dist/runners/RunCheckOneFile.d.ts +2 -0
  64. package/dist/runners/RunCheckOneFile.d.ts.map +1 -0
  65. package/dist/runners/RunCheckOneFile.js +6 -0
  66. package/dist/runners/RunCheckOneFile.js.map +1 -0
  67. package/dist/runners/RunCheckOneFileWithLanguage.d.ts +2 -0
  68. package/dist/runners/RunCheckOneFileWithLanguage.d.ts.map +1 -0
  69. package/dist/runners/RunCheckOneFileWithLanguage.js +31 -0
  70. package/dist/runners/RunCheckOneFileWithLanguage.js.map +1 -0
  71. package/dist/runners/RunLioncoreDiff.d.ts +2 -0
  72. package/dist/runners/RunLioncoreDiff.d.ts.map +1 -0
  73. package/dist/runners/RunLioncoreDiff.js +22 -0
  74. package/dist/runners/RunLioncoreDiff.js.map +1 -0
  75. package/dist/runners/Utils.d.ts +7 -0
  76. package/dist/runners/Utils.d.ts.map +1 -0
  77. package/dist/runners/Utils.js +48 -0
  78. package/dist/runners/Utils.js.map +1 -0
  79. package/dist/runners/index.d.ts +3 -0
  80. package/dist/runners/index.d.ts.map +1 -0
  81. package/dist/runners/index.js +3 -0
  82. package/dist/runners/index.js.map +1 -0
  83. package/dist/validators/LionWebChunkDefinitions.d.ts +9 -0
  84. package/dist/validators/LionWebChunkDefinitions.d.ts.map +1 -0
  85. package/dist/validators/LionWebChunkDefinitions.js +100 -0
  86. package/dist/validators/LionWebChunkDefinitions.js.map +1 -0
  87. package/dist/validators/LionWebLanguageReferenceValidator.d.ts +21 -0
  88. package/dist/validators/LionWebLanguageReferenceValidator.d.ts.map +1 -0
  89. package/dist/validators/LionWebLanguageReferenceValidator.js +166 -0
  90. package/dist/validators/LionWebLanguageReferenceValidator.js.map +1 -0
  91. package/dist/validators/LionWebLanguageValidator.d.ts +23 -0
  92. package/dist/validators/LionWebLanguageValidator.d.ts.map +1 -0
  93. package/dist/validators/LionWebLanguageValidator.js +67 -0
  94. package/dist/validators/LionWebLanguageValidator.js.map +1 -0
  95. package/dist/validators/LionWebReferenceValidator.d.ts +43 -0
  96. package/dist/validators/LionWebReferenceValidator.d.ts.map +1 -0
  97. package/dist/validators/LionWebReferenceValidator.js +203 -0
  98. package/dist/validators/LionWebReferenceValidator.js.map +1 -0
  99. package/dist/validators/LionWebSyntaxValidator.d.ts +9 -0
  100. package/dist/validators/LionWebSyntaxValidator.d.ts.map +1 -0
  101. package/dist/validators/LionWebSyntaxValidator.js +11 -0
  102. package/dist/validators/LionWebSyntaxValidator.js.map +1 -0
  103. package/dist/validators/LionWebValidator.d.ts +24 -0
  104. package/dist/validators/LionWebValidator.d.ts.map +1 -0
  105. package/dist/validators/LionWebValidator.js +55 -0
  106. package/dist/validators/LionWebValidator.js.map +1 -0
  107. package/dist/validators/ValidationFunctions.d.ts +60 -0
  108. package/dist/validators/ValidationFunctions.d.ts.map +1 -0
  109. package/dist/validators/ValidationFunctions.js +104 -0
  110. package/dist/validators/ValidationFunctions.js.map +1 -0
  111. package/dist/validators/generic/SyntaxValidator.d.ts +37 -0
  112. package/dist/validators/generic/SyntaxValidator.d.ts.map +1 -0
  113. package/dist/validators/generic/SyntaxValidator.js +152 -0
  114. package/dist/validators/generic/SyntaxValidator.js.map +1 -0
  115. package/dist/validators/generic/ValidationResult.d.ts +8 -0
  116. package/dist/validators/generic/ValidationResult.d.ts.map +1 -0
  117. package/dist/validators/generic/ValidationResult.js +15 -0
  118. package/dist/validators/generic/ValidationResult.js.map +1 -0
  119. package/dist/validators/generic/index.d.ts +4 -0
  120. package/dist/validators/generic/index.d.ts.map +1 -0
  121. package/dist/validators/generic/index.js +4 -0
  122. package/dist/validators/generic/index.js.map +1 -0
  123. package/dist/validators/generic/schema/DefinitionSchema.d.ts +23 -0
  124. package/dist/validators/generic/schema/DefinitionSchema.d.ts.map +1 -0
  125. package/dist/validators/generic/schema/DefinitionSchema.js +43 -0
  126. package/dist/validators/generic/schema/DefinitionSchema.js.map +1 -0
  127. package/dist/validators/generic/schema/ValidationTypes.d.ts +101 -0
  128. package/dist/validators/generic/schema/ValidationTypes.d.ts.map +1 -0
  129. package/dist/validators/generic/schema/ValidationTypes.js +43 -0
  130. package/dist/validators/generic/schema/ValidationTypes.js.map +1 -0
  131. package/dist/validators/generic/schema/index.d.ts +3 -0
  132. package/dist/validators/generic/schema/index.d.ts.map +1 -0
  133. package/dist/validators/generic/schema/index.js +3 -0
  134. package/dist/validators/generic/schema/index.js.map +1 -0
  135. package/dist/validators/index.d.ts +9 -0
  136. package/dist/validators/index.d.ts.map +1 -0
  137. package/dist/validators/index.js +9 -0
  138. package/dist/validators/index.js.map +1 -0
  139. package/package.json +11 -7
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=RunCheckFolderWithLanguage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RunCheckFolderWithLanguage.d.ts","sourceRoot":"","sources":["../../src/runners/RunCheckFolderWithLanguage.ts"],"names":[],"mappings":""}
@@ -0,0 +1,40 @@
1
+ import fs from "fs";
2
+ import { LanguageRegistry } from "../languages/index.js";
3
+ import { LionWebLanguageWrapper } from "../languages/LionWebLanguageWrapper.js";
4
+ import { LionWebValidator } from "../validators/LionWebValidator.js";
5
+ import { getFilesRecursive, printIssues } from "./Utils.js";
6
+ const folder = process.argv[2];
7
+ const language = process.argv[3];
8
+ let totalSucceed = 0;
9
+ let totalFailed = 0;
10
+ const registry = new LanguageRegistry();
11
+ const languageString = fs.readFileSync(language, "utf-8");
12
+ const languageJson = JSON.parse(languageString);
13
+ const languageValidator = new LionWebValidator(languageJson, registry);
14
+ registry.addLanguage(new LionWebLanguageWrapper(languageJson));
15
+ console.log("Language is " + language);
16
+ languageValidator.validateSyntax();
17
+ languageValidator.validateReferences();
18
+ if (languageValidator.validationResult.hasErrors()) {
19
+ console.log("===== Language errors, ignoring folder ======");
20
+ printIssues(languageValidator.validationResult);
21
+ process.exit(1);
22
+ }
23
+ for (const modelFile of getFilesRecursive(folder, [])) {
24
+ const jsonString1 = fs.readFileSync(modelFile, "utf-8");
25
+ const jsonModel = JSON.parse(jsonString1);
26
+ const modelValidator = new LionWebValidator(jsonModel, registry);
27
+ modelValidator.validateAll();
28
+ if (modelValidator.validationResult.hasErrors()) {
29
+ totalFailed++;
30
+ // console.log("FAILED: " + modelFile)
31
+ printIssues(modelValidator.validationResult, modelFile);
32
+ }
33
+ else {
34
+ console.log("SUCCEEDED: " + modelFile);
35
+ totalSucceed++;
36
+ }
37
+ }
38
+ console.log("Total without errors: " + totalSucceed);
39
+ console.log("Total with errors: " + totalFailed);
40
+ //# sourceMappingURL=RunCheckFolderWithLanguage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RunCheckFolderWithLanguage.js","sourceRoot":"","sources":["../../src/runners/RunCheckFolderWithLanguage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAA;AACnB,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAA;AAC/E,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAA;AACpE,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAE3D,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AAC9B,MAAM,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AAEhC,IAAI,YAAY,GAAG,CAAC,CAAA;AACpB,IAAI,WAAW,GAAG,CAAC,CAAA;AAEnB,MAAM,QAAQ,GAAG,IAAI,gBAAgB,EAAE,CAAA;AACvC,MAAM,cAAc,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;AACzD,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,CAAA;AAC/C,MAAM,iBAAiB,GAAG,IAAI,gBAAgB,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAA;AACtE,QAAQ,CAAC,WAAW,CAAC,IAAI,sBAAsB,CAAC,YAAY,CAAC,CAAC,CAAA;AAE9D,OAAO,CAAC,GAAG,CAAC,cAAc,GAAG,QAAQ,CAAC,CAAA;AACtC,iBAAiB,CAAC,cAAc,EAAE,CAAA;AAClC,iBAAiB,CAAC,kBAAkB,EAAE,CAAA;AACtC,IAAI,iBAAiB,CAAC,gBAAgB,CAAC,SAAS,EAAE,EAAE,CAAC;IACjD,OAAO,CAAC,GAAG,CAAC,+CAA+C,CAAC,CAAA;IAC5D,WAAW,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,CAAA;IAC/C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACnB,CAAC;AAED,KAAK,MAAM,SAAS,IAAI,iBAAiB,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC;IACpD,MAAM,WAAW,GAAG,EAAE,CAAC,YAAY,CAAC,SAAS,EAAE,OAAO,CAAC,CAAA;IACvD,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAA;IACzC,MAAM,cAAc,GAAG,IAAI,gBAAgB,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAA;IAEhE,cAAc,CAAC,WAAW,EAAE,CAAA;IAC5B,IAAI,cAAc,CAAC,gBAAgB,CAAC,SAAS,EAAE,EAAE,CAAC;QAC9C,WAAW,EAAE,CAAA;QACb,sCAAsC;QACtC,WAAW,CAAC,cAAc,CAAC,gBAAgB,EAAE,SAAS,CAAC,CAAA;IAC3D,CAAC;SAAM,CAAC;QACJ,OAAO,CAAC,GAAG,CAAC,aAAa,GAAG,SAAS,CAAC,CAAA;QACtC,YAAY,EAAE,CAAA;IAClB,CAAC;AACL,CAAC;AAED,OAAO,CAAC,GAAG,CAAC,wBAAwB,GAAG,YAAY,CAAC,CAAA;AACpD,OAAO,CAAC,GAAG,CAAC,qBAAqB,GAAG,WAAW,CAAC,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=RunCheckOneFile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RunCheckOneFile.d.ts","sourceRoot":"","sources":["../../src/runners/RunCheckOneFile.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ import { LanguageRegistry } from "../languages/index.js";
2
+ import { validateFile } from "./FileUtils.js";
3
+ const file1 = process.argv[2];
4
+ const registry = new LanguageRegistry();
5
+ validateFile(file1, registry);
6
+ //# sourceMappingURL=RunCheckOneFile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RunCheckOneFile.js","sourceRoot":"","sources":["../../src/runners/RunCheckOneFile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE7C,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AAE7B,MAAM,QAAQ,GAAG,IAAI,gBAAgB,EAAE,CAAA;AACvC,YAAY,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=RunCheckOneFileWithLanguage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RunCheckOneFileWithLanguage.d.ts","sourceRoot":"","sources":["../../src/runners/RunCheckOneFileWithLanguage.ts"],"names":[],"mappings":""}
@@ -0,0 +1,31 @@
1
+ import fs from "fs";
2
+ import { LanguageRegistry } from "../languages/index.js";
3
+ import { LionWebLanguageWrapper } from "../languages/LionWebLanguageWrapper.js";
4
+ import { LionWebValidator } from "../validators/LionWebValidator.js";
5
+ import { printIssues } from "./Utils.js";
6
+ const modelFile = process.argv[2];
7
+ const language = process.argv[3];
8
+ if (modelFile !== null) {
9
+ const jsonString1 = fs.readFileSync(modelFile, "utf-8");
10
+ const jsonModel = JSON.parse(jsonString1);
11
+ const languageString = fs.readFileSync(language, "utf-8");
12
+ const languageJson = JSON.parse(languageString);
13
+ const m3String = fs.readFileSync("src/json/LionCore_M3.json", "utf-8");
14
+ const m3Json = JSON.parse(m3String);
15
+ const builtinString = fs.readFileSync("src/json/LionCore_builtins.json", "utf-8");
16
+ const builtinJson = JSON.parse(builtinString);
17
+ const registry = new LanguageRegistry();
18
+ registry.addLanguage(new LionWebLanguageWrapper(m3Json));
19
+ registry.addLanguage(new LionWebLanguageWrapper(builtinJson));
20
+ registry.addLanguage(new LionWebLanguageWrapper(languageJson));
21
+ const languageValidator = new LionWebValidator(languageJson, registry);
22
+ languageValidator.validateSyntax();
23
+ languageValidator.validateReferences();
24
+ console.log("===== Language errors ======");
25
+ printIssues(languageValidator.validationResult);
26
+ const modelValidator = new LionWebValidator(jsonModel, registry);
27
+ modelValidator.validateAll();
28
+ console.log("===== Model errors ======");
29
+ printIssues(modelValidator.validationResult);
30
+ }
31
+ //# sourceMappingURL=RunCheckOneFileWithLanguage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RunCheckOneFileWithLanguage.js","sourceRoot":"","sources":["../../src/runners/RunCheckOneFileWithLanguage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAA;AACnB,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAA;AAC/E,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAA;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAExC,MAAM,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACjC,MAAM,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AAEhC,IAAI,SAAS,KAAK,IAAI,EAAE,CAAC;IACrB,MAAM,WAAW,GAAG,EAAE,CAAC,YAAY,CAAC,SAAS,EAAE,OAAO,CAAC,CAAA;IACvD,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAA;IACzC,MAAM,cAAc,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;IACzD,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,CAAA;IAC/C,MAAM,QAAQ,GAAG,EAAE,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,22 @@
1
+ import { LionWebJsonDiff } from "@lionweb/json-diff";
2
+ import fs from "fs";
3
+ const file1 = process.argv[2];
4
+ const file2 = process.argv[3];
5
+ if (file1 !== null && file1 !== undefined) {
6
+ const jsonString1 = fs.readFileSync(file1, "utf-8");
7
+ const json1 = JSON.parse(jsonString1);
8
+ const jsonString2 = fs.readFileSync(file2, "utf-8");
9
+ const json2 = JSON.parse(jsonString2);
10
+ const lwDiff = new LionWebJsonDiff();
11
+ lwDiff.diffLwChunk(json1, json2);
12
+ if (lwDiff.diffResult.changes.length === 0) {
13
+ console.log("LionWebJsonDiff: equal");
14
+ }
15
+ else {
16
+ console.log("LionWebJsonDiff: " + lwDiff.diff);
17
+ }
18
+ }
19
+ else {
20
+ console.log("Error in arguments");
21
+ }
22
+ //# sourceMappingURL=RunLioncoreDiff.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RunLioncoreDiff.js","sourceRoot":"","sources":["../../src/runners/RunLioncoreDiff.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AACpD,OAAO,EAAE,MAAM,IAAI,CAAA;AAEnB,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AAC7B,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AAE7B,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;IACxC,MAAM,WAAW,GAAG,EAAE,CAAC,YAAY,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;IACnD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAA;IACrC,MAAM,WAAW,GAAG,EAAE,CAAC,YAAY,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;IACnD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAA;IAErC,MAAM,MAAM,GAAG,IAAI,eAAe,EAAE,CAAA;IACpC,MAAM,CAAC,WAAW,CAAC,KAAyB,EAAE,KAAyB,CAAC,CAAA;IACxE,IAAI,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzC,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAA;IACzC,CAAC;SAAM,CAAC;QACJ,OAAO,CAAC,GAAG,CAAC,mBAAmB,GAAG,MAAM,CAAC,IAAI,CAAC,CAAA;IAClD,CAAC;AACL,CAAC;KAAM,CAAC;IACJ,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAA;AACrC,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { ValidationResult } from "../validators/generic/ValidationResult.js";
2
+ export declare function getFilesRecursive(dirPath: string, arrayOfFiles: string[]): string[];
3
+ export declare function getFilesDirect(dirPath: string, arrayOfFiles: string[]): string[];
4
+ export declare function getAllDirectories(dirPath: string, arrayOfDirs: string[]): string[];
5
+ export declare function printIssues(result: ValidationResult, file?: string): void;
6
+ export declare function issuestoString(vresult: ValidationResult, file?: string): string;
7
+ //# sourceMappingURL=Utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Utils.d.ts","sourceRoot":"","sources":["../../src/runners/Utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,2CAA2C,CAAA;AAE5E,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,YAYxE;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,YAUrE;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,YAavE;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,gBAAgB,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAEzE;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,gBAAgB,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAI/E"}
@@ -0,0 +1,48 @@
1
+ import fs from "fs";
2
+ import path from "path";
3
+ export function getFilesRecursive(dirPath, arrayOfFiles) {
4
+ const files = fs.readdirSync(dirPath);
5
+ arrayOfFiles = arrayOfFiles || [];
6
+ files.forEach(function (file) {
7
+ if (fs.statSync(dirPath + "/" + file).isDirectory()) {
8
+ arrayOfFiles = getFilesRecursive(dirPath + "/" + file, arrayOfFiles);
9
+ }
10
+ else {
11
+ arrayOfFiles.push(path.join(dirPath, "/", file));
12
+ }
13
+ });
14
+ return arrayOfFiles;
15
+ }
16
+ export function getFilesDirect(dirPath, arrayOfFiles) {
17
+ const files = fs.readdirSync(dirPath);
18
+ arrayOfFiles = arrayOfFiles || [];
19
+ files.forEach(function (file) {
20
+ if (fs.statSync(dirPath + "/" + file).isFile()) {
21
+ arrayOfFiles.push(file);
22
+ }
23
+ });
24
+ return arrayOfFiles;
25
+ }
26
+ export function getAllDirectories(dirPath, arrayOfDirs) {
27
+ const files = fs.readdirSync(dirPath, { withFileTypes: true });
28
+ arrayOfDirs = arrayOfDirs || [];
29
+ files.forEach(function (file) {
30
+ if (file.isDirectory()) {
31
+ arrayOfDirs = getAllDirectories(dirPath + "/" + file.name, arrayOfDirs);
32
+ arrayOfDirs.push(path.join(dirPath, "/", file.name));
33
+ }
34
+ else {
35
+ // ignore files
36
+ }
37
+ });
38
+ return arrayOfDirs;
39
+ }
40
+ export function printIssues(result, file) {
41
+ result.issues.forEach(issue => console.log((file == undefined ? "" : `File ${file}: `) + issue.errorMsg()));
42
+ }
43
+ export function issuestoString(vresult, file) {
44
+ let result = "ISSUES: ";
45
+ vresult.issues.forEach(issue => (result += (file === undefined ? "NOFILE" : `File ${file}: `) + issue.errorMsg() + "\n"));
46
+ return result;
47
+ }
48
+ //# sourceMappingURL=Utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Utils.js","sourceRoot":"","s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.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/runners/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,YAAY,CAAA"}
@@ -0,0 +1,3 @@
1
+ export * from "./FileUtils.js";
2
+ export * from "./Utils.js";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/runners/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,YAAY,CAAA"}
@@ -0,0 +1,9 @@
1
+ import { DefinitionSchema } from "./generic/index.js";
2
+ /**
3
+ * The structure below defines the structure of a LionWeb Chunk by defining all the properties.
4
+ * It can
5
+ * - be used by the SyntaxValidator to validate an object sat runtime.
6
+ * - used to generate all the TypeScript types for a LionWebChunk.
7
+ */
8
+ export declare const LionWebSchema: DefinitionSchema;
9
+ //# sourceMappingURL=LionWebChunkDefinitions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LionWebChunkDefinitions.d.ts","sourceRoot":"","sources":["../../src/validators/LionWebChunkDefinitions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAA2C,MAAM,oBAAoB,CAAA;AAG9F;;;;;GAKG;AACH,eAAO,MAAM,aAAa,EAAE,gBA0F1B,CAAA"}
@@ -0,0 +1,100 @@
1
+ import { DefinitionSchema, MAY_BE_NULL, PropertyDef, PrimitiveDef } from "./generic/index.js";
2
+ import { validateId, validateKey, validateSerializationFormatVersion, validateVersion } from "./ValidationFunctions.js";
3
+ /**
4
+ * The structure below defines the structure of a LionWeb Chunk by defining all the properties.
5
+ * It can
6
+ * - be used by the SyntaxValidator to validate an object sat runtime.
7
+ * - used to generate all the TypeScript types for a LionWebChunk.
8
+ */
9
+ export const LionWebSchema = new DefinitionSchema([
10
+ {
11
+ name: "LionWebJsonMetaPointer",
12
+ properties: [
13
+ PropertyDef({ name: "key", type: "LionWebKey" }),
14
+ PropertyDef({ name: "version", type: "LionWebVersion" }),
15
+ PropertyDef({ name: "language", type: "LionWebKey" })
16
+ ]
17
+ },
18
+ {
19
+ name: "LionWebJsonMetaPointer",
20
+ properties: [
21
+ PropertyDef({ name: "key", type: "LionWebKey" }),
22
+ PropertyDef({ name: "version", type: "LionWebVersion" }),
23
+ PropertyDef({ name: "language", type: "LionWebKey" }),
24
+ ]
25
+ },
26
+ {
27
+ name: "ResponseMessage",
28
+ properties: [
29
+ PropertyDef({ name: "kind", type: "JSstring" }),
30
+ PropertyDef({ name: "message", type: "JSstring" }),
31
+ PropertyDef({ name: "data", type: "JSobject", mayBeNull: true, isOptional: true })
32
+ ]
33
+ },
34
+ {
35
+ name: "LionWebJsonChunk",
36
+ properties: [
37
+ PropertyDef({ name: "serializationFormatVersion", type: "LionWebSerializationFormatVersion" }),
38
+ PropertyDef({ name: "languages", type: "LionWebJsonUsedLanguage", isList: true }),
39
+ PropertyDef({ name: "nodes", type: "LionWebJsonNode", isList: true })
40
+ ]
41
+ },
42
+ {
43
+ name: "LionWebJsonUsedLanguage",
44
+ properties: [
45
+ PropertyDef({ name: "key", type: "LionWebKey" }),
46
+ PropertyDef({ name: "version", type: "LionWebVersion" })
47
+ ]
48
+ },
49
+ {
50
+ name: "LionWebJsonNode",
51
+ properties: [
52
+ PropertyDef({ name: "id", type: "LionWebId" }),
53
+ PropertyDef({ name: "classifier", type: "LionWebJsonMetaPointer" }),
54
+ PropertyDef({ name: "properties", type: "LionWebJsonProperty", isList: true }),
55
+ PropertyDef({ name: "containments", type: "LionWebJsonContainment", isList: true }),
56
+ PropertyDef({ name: "references", type: "LionWebJsonReference", isList: true }),
57
+ PropertyDef({ name: "annotations", type: "LionWebId", isList: true }),
58
+ PropertyDef({ name: "parent", type: "LionWebId", mayBeNull: MAY_BE_NULL }),
59
+ ]
60
+ },
61
+ {
62
+ name: "LionWebJsonProperty",
63
+ properties: [
64
+ PropertyDef({ name: "property", type: "LionWebJsonMetaPointer" }),
65
+ PropertyDef({ name: "value", type: "JSstring", mayBeNull: MAY_BE_NULL }),
66
+ ]
67
+ },
68
+ {
69
+ name: "LionWebJsonContainment",
70
+ properties: [
71
+ PropertyDef({ name: "containment", type: "LionWebJsonMetaPointer" }),
72
+ PropertyDef({ name: "children", type: "LionWebId", isList: true }),
73
+ ]
74
+ },
75
+ {
76
+ name: "LionWebJsonReference",
77
+ properties: [
78
+ PropertyDef({ name: "reference", type: "LionWebJsonMetaPointer" }),
79
+ PropertyDef({ name: "targets", type: "LionWebJsonReferenceTarget", isList: true }),
80
+ ]
81
+ },
82
+ {
83
+ name: "LionWebJsonReferenceTarget",
84
+ properties: [
85
+ PropertyDef({ name: "resolveInfo", type: "JSstring", mayBeNull: MAY_BE_NULL }),
86
+ PropertyDef({ name: "reference", type: "LionWebId", mayBeNull: MAY_BE_NULL }),
87
+ ]
88
+ },
89
+ /**
90
+ * Elements without properties are assumed to be JSON/JS primitive values, and tested using `typeof`
91
+ * and the (optional) validate function.
92
+ */
93
+ PrimitiveDef({ name: "LionWebId", primitiveType: "string", validate: validateId }),
94
+ PrimitiveDef({ name: "LionWebKey", primitiveType: "string", validate: validateKey }),
95
+ PrimitiveDef({ name: "LionWebVersion", primitiveType: "string", validate: validateVersion }),
96
+ PrimitiveDef({ name: "LionWebSerializationFormatVersion", primitiveType: "string", validate: validateSerializationFormatVersion }),
97
+ PrimitiveDef({ name: "JSstring", primitiveType: "string" }),
98
+ PrimitiveDef({ name: "JSobject", primitiveType: "object" }),
99
+ ]);
100
+ //# sourceMappingURL=LionWebChunkDefinitions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LionWebChunkDefinitions.js","sourceRoot":"","sources":["../../src/validators/LionWebChunkDefinitions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAG,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAC9F,OAAO,EAAE,UAAU,EAAE,W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Ae,EAAE,CAAC;IAC3F,YAAY,CAAC,EAAE,IAAI,EAAE,mCAAmC,EAAC,aAAa,EAAE,QAAQ,EAAE,QAAQ,EAAE,kCAAkC,EAAE,CAAC;IACjI,YAAY,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,aAAa,EAAE,QAAQ,EAAE,CAAC;IAC3D,YAAY,CAAC,EAAE,IAAI,EAAE,UAAU,EAAC,aAAa,EAAE,QAAQ,EAAE,CAAC;CAC7D,CAAC,CAAA"}
@@ -0,0 +1,21 @@
1
+ import { LionWebJsonNode, LionWebJsonProperty } from "@lionweb/json";
2
+ import { JsonContext, LionWebJsonChunkWrapper } from "@lionweb/json-utils";
3
+ import { LanguageRegistry } from "../languages/index.js";
4
+ import { ValidationResult } from "./generic/ValidationResult.js";
5
+ /**
6
+ * Check against the language definition
7
+ */
8
+ export declare class LionWebLanguageReferenceValidator {
9
+ private registry;
10
+ validationResult: ValidationResult;
11
+ constructor(validationResult: ValidationResult, registry: LanguageRegistry);
12
+ validate(obj: LionWebJsonChunkWrapper): void;
13
+ private validateContainment;
14
+ private validateReference;
15
+ /**
16
+ * Checks wwhether the value of `prop1` is correct in relation with its property definition in the referred language.
17
+ * @param prop
18
+ */
19
+ validateProperty(_node: LionWebJsonNode, nodeConcept: LionWebJsonNode | undefined, prop: LionWebJsonProperty, context: JsonContext): void;
20
+ }
21
+ //# sourceMappingURL=LionWebLanguageReferenceValidator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LionWebLanguageReferenceValidator.d.ts","sourceRoot":"","sources":["../../src/validators/LionWebLanguageReferenceValidator.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8C,eAAe,EAAE,mBAAmB,EAAwB,MAAM,eAAe,CAAA;AACtI,OAAO,EACH,WAAW,EAGX,uBAAuB,EAI1B,MAAM,qBAAqB,CAAA;AAmB5B,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAA;AAIhE;;GAEG;AACH,qBAAa,iCAAiC;IAGM,OAAO,CAAC,QAAQ;IAFhE,gBAAgB,EAAE,gBAAgB,CAAA;gBAEtB,gBAAgB,EAAE,gBAAgB,EAAU,QAAQ,EAAE,gBAAgB;IASlF,QAAQ,CAAC,GAAG,EAAE,uBAAuB,GAAG,IAAI;IAoB5C,OAAO,CAAC,mBAAmB;IAmB3B,OAAO,CAAC,iBAAiB;IAwBzB;;;OAGG;IACH,gBAAgB,CAAC,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,eAAe,GAAG,SAAS,EAAE,IAAI,EAAE,mBAAmB,EAAE,OAAO,EAAE,WAAW,GAAG,IAAI;CAqF5I"}
@@ -0,0 +1,166 @@
1
+ import { isEqualMetaPointer } from "@lionweb/json";
2
+ import { JsonContext, LION_CORE_BUILTINS_INAMED_NAME, LIONWEB_BOOLEAN_TYPE, LIONWEB_INTEGER_TYPE, LIONWEB_JSON_TYPE, LIONWEB_STRING_TYPE, M3_Keys, MetaPointers, NodeUtils } from "@lionweb/json-utils";
3
+ import { Language_ContainmentMetaPointerNotInClass_Issue, Language_IncorrectPropertyMetaPointer_Issue, Language_PropertyMetaPointerNotInClass_Issue, Language_PropertyValue_Issue, Language_ReferenceMetaPointerNotInClass_Issue, Language_UnknownConcept_Issue } from "../issues/index.js";
4
+ import { Language_IncorrectContainmentMetaPointer_Issue, Language_IncorrectReferenceMetaPointer_Issue, Language_UnknownContainment_Issue, Language_UnknownProperty_Issue, Language_UnknownReference_Issue } from "../issues/LanguageIssues.js";
5
+ import { validateBoolean, validateInteger, validateJSON } from "./ValidationFunctions.js";
6
+ /**
7
+ * Check against the language definition
8
+ */
9
+ export class LionWebLanguageReferenceValidator {
10
+ constructor(validationResult, registry) {
11
+ this.registry = registry;
12
+ this.validationResult = validationResult;
13
+ }
14
+ // reset() {
15
+ // this.validationResult.reset();
16
+ // }
17
+ // TODO test reference and children implementation
18
+ validate(obj) {
19
+ obj.jsonChunk.nodes.forEach((node, nodeIndex) => {
20
+ const nodeContext = new JsonContext(null, ["node", nodeIndex]);
21
+ const nodeConcept = this.registry.getNodeByMetaPointer(node.classifier);
22
+ if (nodeConcept === undefined && nodeContext !== undefined) {
23
+ this.validationResult.issue(new Language_UnknownConcept_Issue(nodeContext, node.classifier));
24
+ return;
25
+ }
26
+ node.properties.forEach((property, propIndex) => {
27
+ this.validateProperty(node, nodeConcept, property, nodeContext.concat("properties", propIndex));
28
+ });
29
+ node.containments.forEach((containment, childIndex) => {
30
+ this.validateContainment(node, nodeConcept, containment, nodeContext.concat("containments", childIndex));
31
+ });
32
+ node.references.forEach((reference, refIndex) => {
33
+ this.validateReference(node, nodeConcept, reference, nodeContext.concat("references", refIndex));
34
+ });
35
+ });
36
+ }
37
+ validateContainment(_node, nodeConcept, containment, context) {
38
+ const metaConcept = this.registry.getNodeByMetaPointer(containment.containment);
39
+ if (metaConcept === null || metaConcept === undefined) {
40
+ this.validationResult.issue(new Language_UnknownContainment_Issue(context, containment.containment));
41
+ return;
42
+ }
43
+ if (metaConcept.classifier.key !== M3_Keys.Containment) {
44
+ this.validationResult.issue(new Language_IncorrectContainmentMetaPointer_Issue(context, containment.containment, metaConcept.classifier.key));
45
+ }
46
+ if (nodeConcept !== undefined) {
47
+ const cons = this.registry.languages.allContainments(nodeConcept);
48
+ if (!cons.includes(metaConcept)) {
49
+ this.validationResult.issue(new Language_ContainmentMetaPointerNotInClass_Issue(context, containment.containment, nodeConcept));
50
+ return;
51
+ }
52
+ }
53
+ // TODO check type of children
54
+ }
55
+ validateReference(_node, nodeConcept, ref, context) {
56
+ const referenceDefinition = this.registry.getNodeByMetaPointer(ref.reference);
57
+ if (referenceDefinition === null || referenceDefinition === undefined) {
58
+ this.validationResult.issue(new Language_UnknownReference_Issue(context, ref.reference));
59
+ return;
60
+ }
61
+ if (referenceDefinition.classifier.key !== M3_Keys.Reference) {
62
+ this.validationResult.issue(new Language_IncorrectReferenceMetaPointer_Issue(context, ref.reference, referenceDefinition.classifier.key));
63
+ }
64
+ if (nodeConcept !== undefined) {
65
+ const refs = this.registry.languages.allReferenceDefinitions(nodeConcept);
66
+ if (!refs.includes(referenceDefinition)) {
67
+ this.validationResult.issue(new Language_ReferenceMetaPointerNotInClass_Issue(context, ref.reference, nodeConcept));
68
+ return;
69
+ }
70
+ }
71
+ // TODO Check type of reference (if possible)
72
+ // TODO Check for duplicate targets?
73
+ // No, already done without language check
74
+ // If so, what to check because there can be either or both a `resolveInfo` and a `reference`
75
+ }
76
+ /**
77
+ * Checks wwhether the value of `prop1` is correct in relation with its property definition in the referred language.
78
+ * @param prop
79
+ */
80
+ validateProperty(_node, nodeConcept, prop, context) {
81
+ if (prop.value === null) {
82
+ return;
83
+ }
84
+ const propertyDefinition = this.registry.getNodeByMetaPointer(prop.property);
85
+ if (propertyDefinition === undefined) {
86
+ this.validationResult.issue(new Language_UnknownProperty_Issue(context, prop.property));
87
+ return;
88
+ }
89
+ if (propertyDefinition.classifier.key !== M3_Keys.Property) {
90
+ this.validationResult.issue(new Language_IncorrectPropertyMetaPointer_Issue(context, prop.property, propertyDefinition.classifier.key));
91
+ return;
92
+ }
93
+ if (nodeConcept !== undefined) {
94
+ const props = this.registry.languages.allProperties(nodeConcept);
95
+ if (!props.includes(propertyDefinition)) {
96
+ this.validationResult.issue(new Language_PropertyMetaPointerNotInClass_Issue(context, prop.property, nodeConcept));
97
+ return;
98
+ }
99
+ }
100
+ const refType = NodeUtils.findReference(propertyDefinition, MetaPointers.PropertyType);
101
+ // const refType = propertyDefinition.references.find(ref => isEqualMetaPointer(ref.reference, MetaPointers.PropertyType))
102
+ const propertyName = propertyDefinition.properties.find(p => p.property.key === LION_CORE_BUILTINS_INAMED_NAME)?.value;
103
+ // console.log("Found type should be " + refType.targets[0].reference);
104
+ if (propertyName !== null && propertyName !== undefined) {
105
+ if (refType !== null && refType !== undefined) {
106
+ const typeReferenceId = refType.targets[0].reference;
107
+ switch (typeReferenceId) {
108
+ case LIONWEB_BOOLEAN_TYPE:
109
+ validateBoolean(prop.value, this.validationResult, context);
110
+ break;
111
+ case LIONWEB_INTEGER_TYPE:
112
+ validateInteger(prop.value, this.validationResult, context);
113
+ break;
114
+ case LIONWEB_STRING_TYPE:
115
+ // Each string is correct and having another JSON type is already captured
116
+ break;
117
+ case LIONWEB_JSON_TYPE:
118
+ validateJSON(prop.value, this.validationResult, context);
119
+ break;
120
+ default: {
121
+ // Check for enumeration
122
+ // console.log("validateProperty: 0")
123
+ const propTypeReference = NodeUtils.findReference(propertyDefinition, MetaPointers.PropertyType);
124
+ if (propTypeReference === undefined) {
125
+ // console.log("validateProperty: 1")
126
+ break;
127
+ }
128
+ const propType = this.registry.findNode(propTypeReference.targets[0].reference);
129
+ if (propType === undefined) {
130
+ // console.log("validateProperty: 1.4 for " + prop.value + " ==> " + propTypeReference.targets[0].reference)
131
+ break;
132
+ }
133
+ let match = false;
134
+ if (isEqualMetaPointer(propType.classifier, MetaPointers.Enumeration)) {
135
+ const literalsContainment = NodeUtils.findContainment(propType, MetaPointers.EnumerationLiterals);
136
+ if (literalsContainment === undefined) {
137
+ // console.log("validateProperty: 2")
138
+ break;
139
+ }
140
+ const literals = literalsContainment.children.map(child => this.registry.findNode(child));
141
+ match = literals.some(lit => {
142
+ if (lit === undefined) {
143
+ // console.log("validateProperty: 3")
144
+ return false;
145
+ }
146
+ const litKeyProp = NodeUtils.findProperty(lit, MetaPointers.IKeyedKey);
147
+ if (litKeyProp === undefined) {
148
+ // console.log("validateProperty: 4")
149
+ return false;
150
+ }
151
+ return prop.value === litKeyProp.value;
152
+ });
153
+ }
154
+ if (!match) {
155
+ this.validationResult.issue(new Language_PropertyValue_Issue(context, prop.property.key, prop.value, propType.classifier.key));
156
+ }
157
+ }
158
+ }
159
+ }
160
+ else {
161
+ // TODO refType not found, but
162
+ }
163
+ }
164
+ }
165
+ }
166
+ //# sourceMappingURL=LionWebLanguageReferenceValidator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"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AChB,CAAC;gCACD,OAAO,IAAI,CAAC,KAAK,KAAK,UAAU,CAAC,KAAK,CAAA;4BAC1C,CAAC,CAAC,CAAA;wBACN,CAAC;wBACD,IAAI,CAAC,KAAK,EAAE,CAAC;4BACT,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,IAAI,4BAA4B,CAAC,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAA;wBAClI,CAAC;oBACL,CAAC;gBACL,CAAC;YACL,CAAC;iBAAM,CAAC;gBACJ,8BAA8B;YAClC,CAAC;QACL,CAAC;IACL,CAAC;CACJ"}
@@ -0,0 +1,23 @@
1
+ import { LionWebJsonChunk, LionWebJsonNode } from "@lionweb/json";
2
+ import { LionWebJsonChunkWrapper } from "@lionweb/json-utils";
3
+ import { LanguageRegistry } from "../languages/index.js";
4
+ import { ValidationResult } from "./generic/ValidationResult.js";
5
+ /**
6
+ * Validates whether a chunk is a valid language definition
7
+ */
8
+ export declare class LionWebLanguageValidator {
9
+ private registry;
10
+ validationResult: ValidationResult;
11
+ chunkWrapper: LionWebJsonChunkWrapper | undefined;
12
+ constructor(validationResult: ValidationResult, registry: LanguageRegistry);
13
+ /**
14
+ * Check whether the metamodel is a Language.
15
+ * Assumption is that _chunk_ is already validated as a correct :LionWebJsonChunk
16
+ * @param chunk
17
+ */
18
+ validateLanguage(chunk: LionWebJsonChunk): void;
19
+ validateConcept(node: LionWebJsonNode): void;
20
+ validateNode(node: LionWebJsonNode): void;
21
+ validateProperties(node: LionWebJsonNode, classifier: LionWebJsonNode): void;
22
+ }
23
+ //# sourceMappingURL=LionWebLanguageValidator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LionWebLanguageValidator.d.ts","sourceRoot":"","sources":["../../src/validators/LionWebLanguageValidator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,gBAAgB,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AACrF,OAAO,EAAoC,uBAAuB,EAAgB,MAAM,qBAAqB,CAAA;AAI7G,OAAO,EAAa,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAA;AAEhE;;GAEG;AACH,qBAAa,wBAAwB;IAKe,OAAO,CAAC,QAAQ;IAJhE,gBAAgB,EAAE,gBAAgB,CAAA;IAClC,YAAY,EAAE,uBAAuB,GAAG,SAAS,CAAA;gBAGrC,gBAAgB,EAAE,gBAAgB,EAAU,QAAQ,EAAE,gBAAgB;IAKlF;;;;OAIG;IACH,gBAAgB,CAAC,KAAK,EAAE,gBAAgB;IAqBxC,eAAe,CAAC,IAAI,EAAE,eAAe,GAAG,IAAI;IAS5C,YAAY,CAAC,IAAI,EAAE,eAAe,GAAG,IAAI;IAWzC,kBAAkB,CAAC,IAAI,EAAE,eAAe,EAAE,UAAU,EAAE,eAAe,GAAG,IAAI;CAW/E"}