@lionweb/validation 0.6.13-beta.4 → 0.6.13-beta.5

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 (190) hide show
  1. package/dist/index.d.ts +0 -3
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +0 -3
  4. package/dist/index.js.map +1 -1
  5. package/dist/issues/LanguageIssues.d.ts +4 -4
  6. package/dist/issues/LanguageIssues.d.ts.map +1 -1
  7. package/dist/issues/LanguageIssues.js +1 -1
  8. package/dist/issues/LanguageIssues.js.map +1 -1
  9. package/dist/issues/ReferenceIssues.d.ts +6 -6
  10. package/dist/issues/ReferenceIssues.d.ts.map +1 -1
  11. package/dist/issues/ReferenceIssues.js +3 -3
  12. package/dist/issues/ReferenceIssues.js.map +1 -1
  13. package/dist/issues/SyntaxIssues.d.ts +1 -1
  14. package/dist/issues/SyntaxIssues.d.ts.map +1 -1
  15. package/dist/issues/ValidationIssue.d.ts +1 -1
  16. package/dist/issues/ValidationIssue.d.ts.map +1 -1
  17. package/dist/issues/ValidationIssue.js.map +1 -1
  18. package/dist/issues/index.d.ts +0 -1
  19. package/dist/issues/index.d.ts.map +1 -1
  20. package/dist/issues/index.js +0 -1
  21. package/dist/issues/index.js.map +1 -1
  22. package/dist/languages/CompositeLionWebLanguageWrapper.d.ts +1 -1
  23. package/dist/languages/CompositeLionWebLanguageWrapper.d.ts.map +1 -1
  24. package/dist/languages/LanguageRegistry.d.ts +1 -1
  25. package/dist/languages/LanguageRegistry.d.ts.map +1 -1
  26. package/dist/languages/LanguageUtils.d.ts +1 -1
  27. package/dist/languages/LanguageUtils.d.ts.map +1 -1
  28. package/dist/languages/LanguageUtils.js +5 -5
  29. package/dist/languages/LanguageUtils.js.map +1 -1
  30. package/dist/languages/LionWebLanguageWrapper.d.ts +3 -3
  31. package/dist/languages/LionWebLanguageWrapper.d.ts.map +1 -1
  32. package/dist/languages/LionWebLanguageWrapper.js +2 -2
  33. package/dist/languages/LionWebLanguageWrapper.js.map +1 -1
  34. package/dist/languages/MetaPointerMap.d.ts +2 -2
  35. package/dist/languages/MetaPointerMap.d.ts.map +1 -1
  36. package/dist/languages/MetaPointerMap.js +1 -1
  37. package/dist/languages/MetaPointerMap.js.map +1 -1
  38. package/dist/runners/FileUtils.d.ts.map +1 -1
  39. package/dist/runners/FileUtils.js +1 -1
  40. package/dist/runners/FileUtils.js.map +1 -1
  41. package/dist/runners/RunCheckFolderWithLanguage.js.map +1 -1
  42. package/dist/runners/RunLioncoreDiff.js +1 -1
  43. package/dist/runners/RunLioncoreDiff.js.map +1 -1
  44. package/dist/validators/LionWebChunkDefinitions.d.ts.map +1 -1
  45. package/dist/validators/LionWebChunkDefinitions.js +1 -1
  46. package/dist/validators/LionWebChunkDefinitions.js.map +1 -1
  47. package/dist/validators/LionWebLanguageReferenceValidator.d.ts +2 -4
  48. package/dist/validators/LionWebLanguageReferenceValidator.d.ts.map +1 -1
  49. package/dist/validators/LionWebLanguageReferenceValidator.js +2 -6
  50. package/dist/validators/LionWebLanguageReferenceValidator.js.map +1 -1
  51. package/dist/validators/LionWebLanguageValidator.d.ts +2 -3
  52. package/dist/validators/LionWebLanguageValidator.d.ts.map +1 -1
  53. package/dist/validators/LionWebLanguageValidator.js +2 -4
  54. package/dist/validators/LionWebLanguageValidator.js.map +1 -1
  55. package/dist/validators/LionWebReferenceValidator.d.ts +3 -4
  56. package/dist/validators/LionWebReferenceValidator.d.ts.map +1 -1
  57. package/dist/validators/LionWebReferenceValidator.js +2 -3
  58. package/dist/validators/LionWebReferenceValidator.js.map +1 -1
  59. package/dist/validators/LionWebSyntaxValidator.d.ts.map +1 -1
  60. package/dist/validators/LionWebSyntaxValidator.js +1 -1
  61. package/dist/validators/LionWebSyntaxValidator.js.map +1 -1
  62. package/dist/validators/LionWebValidator.d.ts +1 -1
  63. package/dist/validators/LionWebValidator.d.ts.map +1 -1
  64. package/dist/validators/LionWebValidator.js +2 -2
  65. package/dist/validators/LionWebValidator.js.map +1 -1
  66. package/dist/validators/ValidationFunctions.d.ts +5 -1
  67. package/dist/validators/ValidationFunctions.d.ts.map +1 -1
  68. package/dist/validators/ValidationFunctions.js +0 -4
  69. package/dist/validators/ValidationFunctions.js.map +1 -1
  70. package/dist/validators/generic/SyntaxValidator.d.ts +1 -1
  71. package/dist/validators/generic/SyntaxValidator.d.ts.map +1 -1
  72. package/dist/validators/generic/SyntaxValidator.js +1 -1
  73. package/dist/validators/generic/SyntaxValidator.js.map +1 -1
  74. package/dist/validators/generic/ValidationTypes.d.ts +1 -1
  75. package/dist/validators/generic/ValidationTypes.d.ts.map +1 -1
  76. package/dist/validators/generic/ValidationTypes.js.map +1 -1
  77. package/package.json +6 -1
  78. package/src/index.ts +0 -3
  79. package/src/issues/LanguageIssues.ts +12 -14
  80. package/src/issues/ReferenceIssues.ts +9 -9
  81. package/src/issues/SyntaxIssues.ts +5 -5
  82. package/src/issues/ValidationIssue.ts +7 -4
  83. package/src/issues/index.ts +0 -1
  84. package/src/languages/CompositeLionWebLanguageWrapper.ts +1 -1
  85. package/src/languages/LanguageRegistry.ts +1 -1
  86. package/src/languages/LanguageUtils.ts +6 -6
  87. package/src/languages/LionWebLanguageWrapper.ts +5 -9
  88. package/src/languages/MetaPointerMap.ts +7 -6
  89. package/src/runners/FileUtils.ts +1 -1
  90. package/src/runners/RunCheckFolderWithLanguage.ts +1 -1
  91. package/src/runners/RunLioncoreDiff.ts +2 -2
  92. package/src/validators/LionWebChunkDefinitions.ts +1 -6
  93. package/src/validators/LionWebLanguageReferenceValidator.ts +17 -20
  94. package/src/validators/LionWebLanguageValidator.ts +2 -4
  95. package/src/validators/LionWebReferenceValidator.ts +6 -14
  96. package/src/validators/LionWebSyntaxValidator.ts +1 -1
  97. package/src/validators/LionWebValidator.ts +3 -3
  98. package/src/validators/ValidationFunctions.ts +1 -1
  99. package/src/validators/generic/SyntaxValidator.ts +1 -1
  100. package/src/validators/generic/ValidationTypes.ts +4 -5
  101. package/dist/diff/DiffResult.d.ts +0 -9
  102. package/dist/diff/DiffResult.d.ts.map +0 -1
  103. package/dist/diff/DiffResult.js +0 -18
  104. package/dist/diff/DiffResult.js.map +0 -1
  105. package/dist/diff/LionWebJsonDiff.d.ts +0 -25
  106. package/dist/diff/LionWebJsonDiff.d.ts.map +0 -1
  107. package/dist/diff/LionWebJsonDiff.js +0 -249
  108. package/dist/diff/LionWebJsonDiff.js.map +0 -1
  109. package/dist/diff/changes/Change.d.ts +0 -34
  110. package/dist/diff/changes/Change.d.ts.map +0 -1
  111. package/dist/diff/changes/Change.js +0 -38
  112. package/dist/diff/changes/Change.js.map +0 -1
  113. package/dist/diff/changes/ChunkChange.d.ts +0 -43
  114. package/dist/diff/changes/ChunkChange.d.ts.map +0 -1
  115. package/dist/diff/changes/ChunkChange.js +0 -57
  116. package/dist/diff/changes/ChunkChange.js.map +0 -1
  117. package/dist/diff/changes/ContainmentChange.d.ts +0 -25
  118. package/dist/diff/changes/ContainmentChange.d.ts.map +0 -1
  119. package/dist/diff/changes/ContainmentChange.js +0 -34
  120. package/dist/diff/changes/ContainmentChange.js.map +0 -1
  121. package/dist/diff/changes/NodeChange.d.ts +0 -41
  122. package/dist/diff/changes/NodeChange.d.ts.map +0 -1
  123. package/dist/diff/changes/NodeChange.js +0 -54
  124. package/dist/diff/changes/NodeChange.js.map +0 -1
  125. package/dist/diff/changes/PropertyChange.d.ts +0 -24
  126. package/dist/diff/changes/PropertyChange.d.ts.map +0 -1
  127. package/dist/diff/changes/PropertyChange.js +0 -29
  128. package/dist/diff/changes/PropertyChange.js.map +0 -1
  129. package/dist/diff/changes/ReferenceChange.d.ts +0 -25
  130. package/dist/diff/changes/ReferenceChange.d.ts.map +0 -1
  131. package/dist/diff/changes/ReferenceChange.js +0 -34
  132. package/dist/diff/changes/ReferenceChange.js.map +0 -1
  133. package/dist/diff/changes/index.d.ts +0 -7
  134. package/dist/diff/changes/index.d.ts.map +0 -1
  135. package/dist/diff/changes/index.js +0 -7
  136. package/dist/diff/changes/index.js.map +0 -1
  137. package/dist/diff/index.d.ts +0 -4
  138. package/dist/diff/index.d.ts.map +0 -1
  139. package/dist/diff/index.js +0 -4
  140. package/dist/diff/index.js.map +0 -1
  141. package/dist/json/ChunkUtils.d.ts +0 -26
  142. package/dist/json/ChunkUtils.d.ts.map +0 -1
  143. package/dist/json/ChunkUtils.js +0 -46
  144. package/dist/json/ChunkUtils.js.map +0 -1
  145. package/dist/json/JsonContext.d.ts +0 -11
  146. package/dist/json/JsonContext.d.ts.map +0 -1
  147. package/dist/json/JsonContext.js +0 -25
  148. package/dist/json/JsonContext.js.map +0 -1
  149. package/dist/json/LionWebJson.d.ts +0 -50
  150. package/dist/json/LionWebJson.d.ts.map +0 -1
  151. package/dist/json/LionWebJson.js +0 -27
  152. package/dist/json/LionWebJson.js.map +0 -1
  153. package/dist/json/LionWebJsonChunkWrapper.d.ts +0 -39
  154. package/dist/json/LionWebJsonChunkWrapper.d.ts.map +0 -1
  155. package/dist/json/LionWebJsonChunkWrapper.js +0 -119
  156. package/dist/json/LionWebJsonChunkWrapper.js.map +0 -1
  157. package/dist/json/M3definitions.d.ts +0 -176
  158. package/dist/json/M3definitions.d.ts.map +0 -1
  159. package/dist/json/M3definitions.js +0 -174
  160. package/dist/json/M3definitions.js.map +0 -1
  161. package/dist/json/NodeUtils.d.ts +0 -23
  162. package/dist/json/NodeUtils.d.ts.map +0 -1
  163. package/dist/json/NodeUtils.js +0 -57
  164. package/dist/json/NodeUtils.js.map +0 -1
  165. package/dist/json/index.d.ts +0 -7
  166. package/dist/json/index.d.ts.map +0 -1
  167. package/dist/json/index.js +0 -7
  168. package/dist/json/index.js.map +0 -1
  169. package/dist/util/graphs.d.ts +0 -18
  170. package/dist/util/graphs.d.ts.map +0 -1
  171. package/dist/util/graphs.js +0 -27
  172. package/dist/util/graphs.js.map +0 -1
  173. package/src/diff/DiffResult.ts +0 -21
  174. package/src/diff/LionWebJsonDiff.ts +0 -309
  175. package/src/diff/changes/Change.ts +0 -76
  176. package/src/diff/changes/ChunkChange.ts +0 -68
  177. package/src/diff/changes/ContainmentChange.ts +0 -32
  178. package/src/diff/changes/NodeChange.ts +0 -63
  179. package/src/diff/changes/PropertyChange.ts +0 -31
  180. package/src/diff/changes/ReferenceChange.ts +0 -34
  181. package/src/diff/changes/index.ts +0 -6
  182. package/src/diff/index.ts +0 -3
  183. package/src/json/ChunkUtils.ts +0 -49
  184. package/src/json/JsonContext.ts +0 -31
  185. package/src/json/LionWebJson.ts +0 -80
  186. package/src/json/LionWebJsonChunkWrapper.ts +0 -136
  187. package/src/json/M3definitions.ts +0 -177
  188. package/src/json/NodeUtils.ts +0 -75
  189. package/src/json/index.ts +0 -6
  190. package/src/util/graphs.ts +0 -36
@@ -1,23 +0,0 @@
1
- import { LionWebJsonContainment, LionWebJsonMetaPointer, LionWebJsonNode, LionWebJsonProperty, LionWebJsonReference, LionWebJsonReferenceTarget } from "./LionWebJson.js";
2
- /**
3
- * Utility functions for LionWebJsonNode's
4
- */
5
- export declare class NodeUtils {
6
- /**
7
- * Find property with key equals `key` in `node`.
8
- * @param node
9
- * @param key
10
- */
11
- static findProperty(node: LionWebJsonNode, property: LionWebJsonMetaPointer): LionWebJsonProperty | undefined;
12
- /**
13
- * Find containment child with key equals `key` in `node`.
14
- * @param node
15
- * @param key
16
- */
17
- static findChild(node: LionWebJsonNode, key: string): LionWebJsonContainment | undefined;
18
- static findContainment(node: LionWebJsonNode, containment: LionWebJsonMetaPointer): LionWebJsonContainment | undefined;
19
- static findReference(node: LionWebJsonNode, reference: LionWebJsonMetaPointer): LionWebJsonReference | undefined;
20
- static findReferenceTarget(referenceTargets: LionWebJsonReferenceTarget[], target: LionWebJsonReferenceTarget): LionWebJsonReferenceTarget | undefined;
21
- static findContainmentContainingChild(containments: LionWebJsonContainment[], childId: string): LionWebJsonContainment | undefined;
22
- }
23
- //# sourceMappingURL=NodeUtils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"NodeUtils.d.ts","sourceRoot":"","sources":["../../src/json/NodeUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAGH,sBAAsB,EAAE,sBAAsB,EAC9C,eAAe,EACf,mBAAmB,EACnB,oBAAoB,EACpB,0BAA0B,EAC7B,MAAM,kBAAkB,CAAA;AAEzB;;GAEG;AACH,qBAAa,SAAS;IAClB;;;;OAIG;IACH,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE,eAAe,EAAE,QAAQ,EAAE,sBAAsB,GAAG,mBAAmB,GAAG,SAAS;IAS7G;;;;OAIG;IACH,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE,eAAe,EAAE,GAAG,EAAE,MAAM,GAAG,sBAAsB,GAAG,SAAS;IAYxF,MAAM,CAAC,eAAe,CAAC,IAAI,EAAE,eAAe,EAAE,WAAW,EAAE,sBAAsB,GAAG,sBAAsB,GAAG,SAAS;IAOtH,MAAM,CAAC,aAAa,CAAC,IAAI,EAAE,eAAe,EAAE,SAAS,EAAE,sBAAsB,GAAG,oBAAoB,GAAG,SAAS;IAOhH,MAAM,CAAC,mBAAmB,CACtB,gBAAgB,EAAE,0BAA0B,EAAE,EAC9C,MAAM,EAAE,0BAA0B,GACnC,0BAA0B,GAAG,SAAS;IASzC,MAAM,CAAC,8BAA8B,CAAC,YAAY,EAAE,sBAAsB,EAAE,EAAE,OAAO,EAAE,MAAM,GAAG,sBAAsB,GAAG,SAAS;CAGrI"}
@@ -1,57 +0,0 @@
1
- import { isEqualMetaPointer, isEqualReferenceTarget } from "./LionWebJson.js";
2
- /**
3
- * Utility functions for LionWebJsonNode's
4
- */
5
- export class NodeUtils {
6
- /**
7
- * Find property with key equals `key` in `node`.
8
- * @param node
9
- * @param key
10
- */
11
- static findProperty(node, property) {
12
- if (node === undefined) {
13
- return undefined;
14
- }
15
- return node.properties.find(prop => isEqualMetaPointer(prop.property, property));
16
- }
17
- /**
18
- * Find containment child with key equals `key` in `node`.
19
- * @param node
20
- * @param key
21
- */
22
- static findChild(node, key) {
23
- if (node === undefined) {
24
- return undefined;
25
- }
26
- for (const containment of node.containments) {
27
- if (containment.containment.key === key) {
28
- return containment;
29
- }
30
- }
31
- return undefined;
32
- }
33
- static findContainment(node, containment) {
34
- if (node === undefined) {
35
- return undefined;
36
- }
37
- return node.containments.find(cont => isEqualMetaPointer(cont.containment, containment));
38
- }
39
- static findReference(node, reference) {
40
- if (node === undefined) {
41
- return undefined;
42
- }
43
- return node.references.find(ref => isEqualMetaPointer(ref.reference, reference));
44
- }
45
- static findReferenceTarget(referenceTargets, target) {
46
- for (const refTarget of referenceTargets) {
47
- if (isEqualReferenceTarget(refTarget, target)) {
48
- return refTarget;
49
- }
50
- }
51
- return undefined;
52
- }
53
- static findContainmentContainingChild(containments, childId) {
54
- return containments.find(cont => cont.children.includes(childId));
55
- }
56
- }
57
- //# sourceMappingURL=NodeUtils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"NodeUtils.js","sourceRoot":"","sources":["../../src/json/NodeUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,kBAAkB,EAClB,sBAAsB,EAMzB,MAAM,kBAAkB,CAAA;AAEzB;;GAEG;AACH,MAAM,OAAO,SAAS;IAClB;;;;OAIG;IACH,MAAM,CAAC,YAAY,CAAC,IAAqB,EAAE,QAAgC;QACvE,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YACrB,OAAO,SAAS,CAAA;QACpB,CAAC;QACD,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CACvB,IAAI,CAAC,EAAE,CAAC,kBAAkB,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CACtD,CAAA;IACL,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,SAAS,CAAC,IAAqB,EAAE,GAAW;QAC/C,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YACrB,OAAO,SAAS,CAAA;QACpB,CAAC;QACD,KAAK,MAAM,WAAW,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;YAC1C,IAAI,WAAW,CAAC,WAAW,CAAC,GAAG,KAAK,GAAG,EAAE,CAAC;gBACtC,OAAO,WAAW,CAAA;YACtB,CAAC;QACL,CAAC;QACD,OAAO,SAAS,CAAA;IACpB,CAAC;IAED,MAAM,CAAC,eAAe,CAAC,IAAqB,EAAE,WAAmC;QAC7E,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YACrB,OAAO,SAAS,CAAA;QACpB,CAAC;QACD,OAAO,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,kBAAkB,CAAC,IAAI,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC,CAAA;IAC5F,CAAC;IAED,MAAM,CAAC,aAAa,CAAC,IAAqB,EAAE,SAAiC;QACzE,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YACrB,OAAO,SAAS,CAAA;QACpB,CAAC;QACD,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,kBAAkB,CAAC,GAAG,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC,CAAA;IACpF,CAAC;IAED,MAAM,CAAC,mBAAmB,CACtB,gBAA8C,EAC9C,MAAkC;QAElC,KAAK,MAAM,SAAS,IAAI,gBAAgB,EAAE,CAAC;YACvC,IAAI,sBAAsB,CAAC,SAAS,EAAE,MAAM,CAAC,EAAE,CAAC;gBAC5C,OAAO,SAAS,CAAA;YACpB,CAAC;QACL,CAAC;QACD,OAAO,SAAS,CAAA;IACpB,CAAC;IAED,MAAM,CAAC,8BAA8B,CAAC,YAAsC,EAAE,OAAe;QACzF,OAAO,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAA;IACrE,CAAC;CACJ"}
@@ -1,7 +0,0 @@
1
- export * from "./JsonContext.js";
2
- export * from "./NodeUtils.js";
3
- export * from "./ChunkUtils.js";
4
- export * from "./LionWebJson.js";
5
- export * from "./LionWebJsonChunkWrapper.js";
6
- export * from "./M3definitions.js";
7
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/json/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,kBAAkB,CAAA;AAChC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,oBAAoB,CAAA"}
@@ -1,7 +0,0 @@
1
- export * from "./JsonContext.js";
2
- export * from "./NodeUtils.js";
3
- export * from "./ChunkUtils.js";
4
- export * from "./LionWebJson.js";
5
- export * from "./LionWebJsonChunkWrapper.js";
6
- export * from "./M3definitions.js";
7
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/json/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,kBAAkB,CAAA;AAChC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,oBAAoB,CAAA"}
@@ -1,18 +0,0 @@
1
- /**
2
- * Type def. of a generic "flatMap" function.
3
- */
4
- export type ResultMapper<T, R> = (t: T) => R[];
5
- /**
6
- * Returns a function that performs a "flatMap" on a graph that's specified as a start vertex. and a function that computes (outgoing) edges.
7
- * The "flatMap" is performed depth-first, and doesn't loop on cycles.
8
- *
9
- * @param mapper The function that calculates the result values
10
- * @param nextVertices The function that calculates the next edges to visit.
11
- * @returns A function that takes a starting vertex and resursively calculates the result values for each vertex visited.
12
- */
13
- export declare const visitAndMap: <T, R>(mapper: ResultMapper<T, R>, nextVertices: (t: T) => T[]) => ResultMapper<T, R>;
14
- /**
15
- * A mapper function that returns the node itself as result
16
- */
17
- export declare const selfMapper: <T>(t: T) => T[];
18
- //# sourceMappingURL=graphs.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"graphs.d.ts","sourceRoot":"","sources":["../../src/util/graphs.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,CAAA;AAE9C;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW,uFAenB,CAAA;AAEL;;GAEG;AACH,eAAO,MAAM,UAAU,kBAAmB,CAAA"}
@@ -1,27 +0,0 @@
1
- /**
2
- * Returns a function that performs a "flatMap" on a graph that's specified as a start vertex. and a function that computes (outgoing) edges.
3
- * The "flatMap" is performed depth-first, and doesn't loop on cycles.
4
- *
5
- * @param mapper The function that calculates the result values
6
- * @param nextVertices The function that calculates the next edges to visit.
7
- * @returns A function that takes a starting vertex and resursively calculates the result values for each vertex visited.
8
- */
9
- export const visitAndMap = (mapper, nextVertices) => (startVertex) => {
10
- const visited = [];
11
- const rs = [];
12
- const recurse = (t) => {
13
- if (visited.indexOf(t) > -1) {
14
- return;
15
- }
16
- visited.push(t);
17
- rs.push(...mapper(t));
18
- nextVertices(t).forEach(recurse);
19
- };
20
- recurse(startVertex);
21
- return rs;
22
- };
23
- /**
24
- * A mapper function that returns the node itself as result
25
- */
26
- export const selfMapper = (t) => [t];
27
- //# sourceMappingURL=graphs.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"graphs.js","sourceRoot":"","sources":["../../src/util/graphs.ts"],"names":[],"mappings":"AAOA;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,WAAW,GACpB,CAAO,MAA0B,EAAE,YAA2B,EAAsB,EAAE,CACtF,CAAC,WAAc,EAAO,EAAE;IACpB,MAAM,OAAO,GAAQ,EAAE,CAAA;IACvB,MAAM,EAAE,GAAQ,EAAE,CAAA;IAClB,MAAM,OAAO,GAAG,CAAC,CAAI,EAAE,EAAE;QACrB,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;YAC1B,OAAM;QACV,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;QACf,EAAE,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAA;QACrB,YAAY,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;IACpC,CAAC,CAAA;IACD,OAAO,CAAC,WAAW,CAAC,CAAA;IACpB,OAAO,EAAE,CAAA;AACb,CAAC,CAAA;AAEL;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAI,CAAI,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA"}
@@ -1,21 +0,0 @@
1
- import { Change } from "./changes/Change.js"
2
-
3
- export class DiffResult {
4
- changes: Change[] = []
5
-
6
- change(issue: Change) {
7
- this.changes.push(issue)
8
- }
9
-
10
- reset() {
11
- this.changes = []
12
- }
13
-
14
- hasChanges(): boolean {
15
- return this.changes.length !== 0
16
- }
17
-
18
- asStringArray(): string[] {
19
- return this.changes.map(ch => ch.changeMsg())
20
- }
21
- }
@@ -1,309 +0,0 @@
1
- import { JsonContext } from "../issues/index.js"
2
- import {
3
- ChunkUtils,
4
- isEqualMetaPointer, isEqualReferenceTarget,
5
- LionWebJsonChunk,
6
- LionWebJsonContainment,
7
- LionWebJsonNode,
8
- LionWebJsonProperty,
9
- LionWebJsonReference,
10
- LionWebJsonReferenceTarget,
11
- LwJsonUsedLanguage,
12
- NodeUtils
13
- } from "../json/index.js"
14
- import { Change, GenericChange, Missing } from "./changes/Change.js"
15
- import { LanguageAdded, LanguageRemoved, NodeAdded, NodeRemoved, SerializationFormatChange } from "./changes/ChunkChange.js"
16
- import { ChildAdded, ChildRemoved, ChildOrderChanged } from "./changes/ContainmentChange.js"
17
- import { AnnotationAdded, AnnotationOrderChanged, AnnotationRemoved, TargetAdded, TargetOrderChanged, TargetRemoved } from "./changes/index.js"
18
- import { NodeClassifierChanged, ParentChanged } from "./changes/NodeChange.js"
19
- import { PropertyValueChanged } from "./changes/PropertyChange.js"
20
- import { DiffResult } from "./DiffResult.js"
21
-
22
- /**
23
- * Comparing LionWeb JSON chunks and find all differences
24
- */
25
- export class LionWebJsonDiff {
26
- diffResult = new DiffResult()
27
-
28
- constructor() {}
29
-
30
- change(change: Change): void {
31
- this.diffResult.change(change)
32
- }
33
-
34
- diff(ctx: JsonContext, msg: string) {
35
- const change = new GenericChange(ctx, msg)
36
- this.diffResult.change(change)
37
- }
38
-
39
- /**
40
- * Compare two LwNode objects and return their difference
41
- * @param beforeNode
42
- * @param afterNode
43
- */
44
- diffLwNode(ctx: JsonContext, beforeNode: LionWebJsonNode, afterNode: LionWebJsonNode): void {
45
- if (!isEqualMetaPointer(beforeNode.classifier, afterNode.classifier)) {
46
- this.change(new NodeClassifierChanged(ctx.concat("classifier"), beforeNode, beforeNode.classifier, afterNode.classifier))
47
- }
48
- if (beforeNode.parent !== afterNode.parent) {
49
- this.change(new ParentChanged(ctx, beforeNode, beforeNode.parent, afterNode.parent))
50
- }
51
- // Find diff between previous and next properties
52
- beforeNode.properties.forEach((beforeProperty: LionWebJsonProperty, index: number) => {
53
- const afterProperty = NodeUtils.findProperty(afterNode, beforeProperty.property)
54
- if (afterProperty === undefined) {
55
- this.change(
56
- new PropertyValueChanged(
57
- ctx.concat("properties", index),
58
- beforeNode.id,
59
- beforeProperty.property,
60
- beforeProperty.value,
61
- null,
62
- Missing.MissingAfter
63
- ),
64
- )
65
- } else {
66
- this.diffLwProperty(ctx.concat("properties", index), beforeNode, beforeProperty, afterProperty)
67
- }
68
- })
69
- afterNode.properties.forEach((afterProperty: LionWebJsonProperty, index: number) => {
70
- const beforeProperty = NodeUtils.findProperty(beforeNode, afterProperty.property)
71
- if (beforeProperty === undefined) {
72
- this.change(
73
- new PropertyValueChanged(
74
- ctx.concat("properties", index),
75
- beforeNode.id,
76
- afterProperty.property,
77
- null,
78
- afterProperty.value,
79
- Missing.MissingBefore
80
- ),
81
- )
82
- }
83
- // no else, if the property exists in both nodes, the diff has been claculated in the loop before this one
84
- })
85
- beforeNode.containments.forEach((beforeContainment: LionWebJsonContainment, index: number) => {
86
- const beforeKey = beforeContainment.containment.key
87
- const afterContainment = NodeUtils.findChild(afterNode, beforeKey)
88
- if (afterContainment === undefined) {
89
- // NB No containment is considered equivalent to a containment with empty _children_
90
- if (beforeContainment.children.length !== 0) {
91
- beforeContainment.children.forEach(childId => {
92
- this.change(new ChildRemoved(ctx.concat("containments", index), beforeNode, beforeContainment.containment, afterContainment, childId, Missing.MissingAfter))
93
- })
94
- }
95
- } else {
96
- this.diffContainment(ctx.concat("containments", index), beforeNode, beforeContainment, afterContainment)
97
- }
98
- })
99
- afterNode.containments.forEach((afterContainment: LionWebJsonContainment, index: number) => {
100
- const afterKey = afterContainment.containment.key
101
- const beforeContainment = NodeUtils.findChild(beforeNode, afterKey)
102
- if (beforeContainment === undefined) {
103
- if (afterContainment.children.length !== 0) {
104
- afterContainment.children.forEach(childId => {
105
- this.change(new ChildAdded(ctx.concat("containments", index), afterNode, afterContainment.containment, afterContainment, childId, Missing.MissingBefore))
106
- })
107
- }
108
- }
109
- // No else, has already been done
110
- })
111
- beforeNode.references.forEach((beforeReference: LionWebJsonReference, index: number) => {
112
- const afterReference = NodeUtils.findReference(afterNode, beforeReference.reference)
113
- if (afterReference === undefined) {
114
- if (beforeReference.targets.length !== 0) {
115
- beforeReference.targets.forEach(target => {
116
- this.change(new TargetRemoved(ctx.concat("references", index), afterNode, beforeReference, afterReference, target, Missing.MissingAfter))
117
- })
118
- }
119
- } else {
120
- this.diffLwReference(ctx.concat("references", index), beforeNode, beforeReference, afterReference)
121
- }
122
- })
123
- afterNode.references.forEach((afterReference: LionWebJsonReference, index: number) => {
124
- const beforeReference = NodeUtils.findReference(afterNode, afterReference.reference)
125
- if (beforeReference === undefined) {
126
- if (afterReference.targets.length !== 0) {
127
- afterReference.targets.forEach(target => {
128
- this.change(new TargetAdded(ctx.concat("references", index), afterNode, beforeReference, afterReference, target, Missing.MissingBefore))
129
- })
130
- }
131
- }
132
- })
133
- if (beforeNode.annotations !== undefined && afterNode.annotations !== undefined) {
134
- let annotationDiffFound = false
135
- beforeNode.annotations.forEach((beforeAnn: string, index: number) => {
136
- if (!afterNode.annotations.includes(beforeAnn)) {
137
- annotationDiffFound = true
138
- this.change(new AnnotationRemoved(ctx, beforeNode, afterNode, beforeAnn, index))
139
- }
140
- })
141
- afterNode.annotations.forEach((afterAnn: string, index: number) => {
142
- if (!beforeNode.annotations.includes(afterAnn)) {
143
- annotationDiffFound = true
144
- this.change(new AnnotationAdded(ctx, beforeNode, afterNode, afterAnn, index))
145
- }
146
- })
147
- if (!annotationDiffFound) {
148
- for (let i: number = 0; i < afterNode.annotations.length; i++) {
149
- if (afterNode.annotations[i] !== beforeNode.annotations[i]) {
150
- this.change(new AnnotationOrderChanged(ctx.concat("annotations"), beforeNode, afterNode, "", i))
151
- break
152
- }
153
- }
154
- }
155
- }
156
- }
157
-
158
- diffLwChunk(beforeChunk: LionWebJsonChunk, afterChunk: LionWebJsonChunk): void {
159
- const ctx = new JsonContext(null, ["$"])
160
- if (beforeChunk.serializationFormatVersion !== afterChunk.serializationFormatVersion) {
161
- this.change(
162
- new SerializationFormatChange(
163
- ctx.concat("serializationFormatVersion"),
164
- beforeChunk.serializationFormatVersion,
165
- afterChunk.serializationFormatVersion,
166
- ),
167
- )
168
- }
169
- beforeChunk.languages.forEach((beforeLanguage: LwJsonUsedLanguage, index: number) => {
170
- const afterLanguage = ChunkUtils.findLwUsedLanguage(afterChunk, beforeLanguage.key)
171
- if (afterLanguage === null) {
172
- this.change(new LanguageRemoved(ctx.concat("languages", index), beforeLanguage))
173
- } else {
174
- this.diffLwUsedLanguage(ctx.concat("languages", index), beforeLanguage, afterLanguage)
175
- }
176
- })
177
- afterChunk.languages.forEach((afterLanguage: LwJsonUsedLanguage, index: number) => {
178
- const beforeLanguage = ChunkUtils.findLwUsedLanguage(beforeChunk, afterLanguage.key)
179
- if (beforeLanguage === null) {
180
- this.change(new LanguageAdded(ctx.concat("languages", index), afterLanguage))
181
- }
182
- })
183
- beforeChunk.nodes.forEach((beforeNode: LionWebJsonNode, index: number) => {
184
- const beforeId = beforeNode.id
185
- const afterNode = ChunkUtils.findNode(afterChunk, beforeId)
186
- const newCtx = ctx.concat("nodes", index)
187
- if (afterNode === null || afterNode === undefined) {
188
- this.change(new NodeRemoved(ctx, beforeNode))
189
- } else {
190
- this.diffLwNode(newCtx, beforeNode, afterNode)
191
- }
192
- })
193
- afterChunk.nodes.forEach((afterNode: LionWebJsonNode, index: number) => {
194
- const afterId = afterNode.id
195
- const beforeNode = ChunkUtils.findNode(beforeChunk, afterId)
196
- if (beforeNode === null) {
197
- this.change(new NodeAdded(ctx.concat("nodes", index), afterNode))
198
- }
199
- })
200
- }
201
-
202
- diffContainment(
203
- ctx: JsonContext,
204
- node: LionWebJsonNode,
205
- beforeContainment: LionWebJsonContainment,
206
- afterContainment: LionWebJsonContainment,
207
- ): void {
208
- if (!isEqualMetaPointer(beforeContainment.containment, afterContainment.containment)) {
209
- console.error("diffContainment: MetaPointers of containments should be identical")
210
- this.diff(
211
- ctx,
212
- `Containment Object has concept ${JSON.stringify(beforeContainment.containment)} vs ${JSON.stringify(
213
- afterContainment.containment,
214
- )}`,
215
- )
216
- }
217
- // Check whether children exist in both objects (two for loops)
218
- // TODO Also check for the order that can be changed!!!
219
- let changeFound = false
220
- for (const childId1 of beforeContainment.children) {
221
- if (!afterContainment.children.includes(childId1)) {
222
- changeFound = true
223
- this.change(new ChildRemoved(ctx, node, beforeContainment.containment, afterContainment, childId1))
224
- }
225
- }
226
- for (const childId2 of afterContainment.children) {
227
- if (!beforeContainment.children.includes(childId2)) {
228
- changeFound = true
229
- this.change(new ChildAdded(ctx, node, beforeContainment.containment, afterContainment, childId2))
230
- }
231
- }
232
- if (!changeFound) {
233
- for (let i: number = 0; i < afterContainment.children.length; i++) {
234
- if (afterContainment.children[i] !== beforeContainment.children[i]) {
235
- this.change(new ChildOrderChanged(ctx.concat("children"), node, afterContainment.containment, afterContainment, ""))
236
- break
237
- }
238
- }
239
- }
240
- }
241
-
242
- diffLwReference(ctx: JsonContext, node: LionWebJsonNode, beforeRef: LionWebJsonReference, afterRef: LionWebJsonReference): void {
243
- if (!isEqualMetaPointer(beforeRef.reference, afterRef.reference)) {
244
- console.error("diffContainment: MetaPointers of references should be identical")
245
- this.diff(ctx, `Reference has concept ${JSON.stringify(beforeRef.reference)} vs ${JSON.stringify(afterRef.reference)}`)
246
- }
247
- let diffFound = false;
248
- beforeRef.targets.forEach((beforeTarget: LionWebJsonReferenceTarget, index: number) => {
249
- const afterTarget = NodeUtils.findReferenceTarget(afterRef.targets, beforeTarget)
250
- if (afterTarget === undefined) {
251
- this.change(new TargetRemoved(ctx.concat("targets", index), node, beforeRef, afterRef, beforeTarget))
252
- diffFound = true
253
- } else {
254
- if (!isEqualReferenceTarget(beforeTarget, afterTarget)) {
255
- this.diff(
256
- ctx.concat("targets", index),
257
- `ERROR: reference target ${JSON.stringify(beforeTarget)} vs ${JSON.stringify(afterTarget)}`,
258
- )
259
- }
260
- }
261
- })
262
- afterRef.targets.forEach((afterTarget: LionWebJsonReferenceTarget, index: number) => {
263
- const beforeTarget = NodeUtils.findReferenceTarget(beforeRef.targets, afterTarget)
264
- if (beforeTarget === undefined) {
265
- this.change(new TargetAdded(ctx.concat("targets", index), node, beforeRef, afterRef, afterTarget))
266
- diffFound = true
267
- } else {
268
- if (!isEqualReferenceTarget(beforeTarget, afterTarget)) {
269
- this.diff(
270
- ctx.concat("targets", index),
271
- `ERROR: reference target ${JSON.stringify(beforeTarget)} vs ${JSON.stringify(afterTarget)}`,
272
- )
273
- }
274
- }
275
- })
276
- if (!diffFound) {
277
- for (let i: number = 0; i < beforeRef.targets.length; i++) {
278
- if (!isEqualReferenceTarget(beforeRef.targets[i], afterRef.targets[i])) {
279
- this.change(new TargetOrderChanged(ctx.concat("targets"), node, beforeRef, afterRef, beforeRef.targets[i]))
280
- break
281
- }
282
- }
283
- }
284
- }
285
-
286
- private diffLwUsedLanguage(ctx: JsonContext, obj1: LwJsonUsedLanguage, obj2: LwJsonUsedLanguage) {
287
- if (obj1.key !== obj2.key || obj1.version !== obj2.version) {
288
- this.diff(ctx, `Different used languages ${JSON.stringify(obj1)} vs ${JSON.stringify(obj2)}`)
289
- }
290
- }
291
-
292
- private diffLwProperty(
293
- ctx: JsonContext,
294
- node: LionWebJsonNode,
295
- beforeProperty: LionWebJsonProperty,
296
- afterProperty: LionWebJsonProperty,
297
- ) {
298
- if (!isEqualMetaPointer(beforeProperty.property, afterProperty.property)) {
299
- console.error("diffContainment: MetaPointers of properties should be identical")
300
- this.diff(
301
- ctx,
302
- `Property Object has concept ${JSON.stringify(beforeProperty.property)} vs ${JSON.stringify(afterProperty.property)}`,
303
- )
304
- }
305
- if (beforeProperty.value !== afterProperty.value) {
306
- this.change(new PropertyValueChanged(ctx, node.id, beforeProperty.property, beforeProperty.value, afterProperty.value))
307
- }
308
- }
309
- }
@@ -1,76 +0,0 @@
1
- import { JsonContext } from "../../issues/index.js"
2
-
3
- export type ChangeType =
4
- | "GenericChange"
5
- | "NodeRemoved"
6
- | "NodeAdded"
7
- | "ChildRemoved"
8
- | "ChildAdded"
9
- | "ParentChanged"
10
- | "PropertyValueChanged"
11
- | "SerializationFormatChange"
12
- | "PropertyRemoved"
13
- | "PropertyAdded"
14
- | "NodeClassifierChanged"
15
- | "ContainmentAdded"
16
- | "ContainmentRemoved"
17
- | "LanguageRemoved"
18
- | "LanguageAdded"
19
- | "TargetAdded"
20
- | "TargetRemoved"
21
- | "ReferenceRemoved"
22
- | "ReferenceAdded"
23
- | "AnnotationRemoved"
24
- | "AnnotationAdded"
25
- | "ChildOrderChanged"
26
- | "AnnotationOrderChanged"
27
- | "TargetOrderChanged"
28
-
29
- /**
30
- * Additionbal property in property, contauinment and reference changes to state
31
- * that the whole property/ containment / reference definition is missing.
32
- */
33
- export enum Missing {
34
- /**
35
- * Both before and after have a definition for the property / containment / reference
36
- */
37
- NotMissing,
38
- /**
39
- * The definition is missing _before_ for the property / containment / reference
40
- */
41
- MissingBefore,
42
- /**
43
- * The definition is missing _after_ for the property / containment / reference
44
- */
45
- MissingAfter
46
- }
47
-
48
- export abstract class Change {
49
- abstract readonly changeType: ChangeType
50
- context: JsonContext
51
-
52
- constructor(context: JsonContext) {
53
- this.context = context
54
- }
55
-
56
- protected abstract msg(): string
57
-
58
- public changeMsg(): string {
59
- return `${this.changeType}: ${this.msg()} at ${this.context.toString()} `
60
- }
61
- }
62
-
63
- export class GenericChange extends Change {
64
- readonly changeType = "GenericChange"
65
-
66
- constructor(
67
- context: JsonContext,
68
- protected message: string,
69
- ) {
70
- super(context)
71
- }
72
-
73
- protected msg(): string {
74
- return this.message
75
- }
76
- }
@@ -1,68 +0,0 @@
1
- import { JsonContext } from "../../issues/index.js"
2
- import { LionWebJsonNode, LwJsonUsedLanguage } from "../../json/index.js"
3
- import { Change } from "./Change.js"
4
-
5
- export abstract class ChunkChange extends Change {
6
- constructor(public context: JsonContext) {
7
- super(context)
8
- }
9
- }
10
-
11
- export class SerializationFormatChange extends ChunkChange {
12
- readonly changeType = "SerializationFormatChange"
13
-
14
- constructor(
15
- public context: JsonContext,
16
- protected original: string,
17
- protected newValue: string,
18
- ) {
19
- super(context)
20
- }
21
-
22
- protected msg = () => `Serialization versions do not match: ${this.original} vs ${this.newValue}`
23
- }
24
-
25
- export class NodeRemoved extends ChunkChange {
26
- readonly changeType = "NodeRemoved"
27
-
28
- constructor(
29
- public context: JsonContext,
30
- public node: LionWebJsonNode,
31
- ) {
32
- super(context)
33
- }
34
-
35
- protected msg = () => `Node ${this.node.id} is removed`
36
- }
37
-
38
- export class NodeAdded extends ChunkChange {
39
- readonly changeType = "NodeAdded"
40
-
41
- constructor(
42
- public context: JsonContext,
43
- public node: LionWebJsonNode,
44
- ) {
45
- super(context)
46
- }
47
-
48
- protected msg = () => `Node ${this.node.id} is added`
49
- }
50
-
51
- export abstract class LanguageChange extends ChunkChange {
52
- constructor(
53
- public context: JsonContext,
54
- public language: LwJsonUsedLanguage,
55
- ) {
56
- super(context)
57
- }
58
- }
59
-
60
- export class LanguageRemoved extends LanguageChange {
61
- readonly changeType = "LanguageRemoved"
62
- protected msg = () => `Language with key ${this.language.key} and version ${this.language.version} is removed`
63
- }
64
-
65
- export class LanguageAdded extends LanguageChange {
66
- readonly changeType = "LanguageAdded"
67
- protected msg = () => `Language with key ${this.language.key} and version ${this.language.version} is added`
68
- }