@lbdudc/linea-core 0.1.0 → 0.1.2

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 (253) hide show
  1. package/README.md +230 -358
  2. package/dist/analysis/analyze.d.ts +0 -54
  3. package/dist/analysis/analyze.js +1 -70
  4. package/dist/analysis/analyze.js.map +1 -1
  5. package/dist/analysis/runtime.d.ts +4 -73
  6. package/dist/analysis/runtime.js +7 -100
  7. package/dist/analysis/runtime.js.map +1 -1
  8. package/dist/analysis/uvl-text.d.ts +8 -0
  9. package/dist/analysis/uvl-text.js +70 -0
  10. package/dist/analysis/uvl-text.js.map +1 -0
  11. package/dist/assets.d.ts +0 -12
  12. package/dist/assets.js +0 -25
  13. package/dist/assets.js.map +1 -1
  14. package/dist/ci/annotations.d.ts +6 -0
  15. package/dist/ci/annotations.js +12 -0
  16. package/dist/ci/annotations.js.map +1 -0
  17. package/dist/ci/leftovers.d.ts +25 -0
  18. package/dist/ci/leftovers.js +50 -0
  19. package/dist/ci/leftovers.js.map +1 -0
  20. package/dist/ci/pairwise.d.ts +11 -0
  21. package/dist/ci/pairwise.js +35 -0
  22. package/dist/ci/pairwise.js.map +1 -0
  23. package/dist/ci/pipeline.d.ts +18 -0
  24. package/dist/ci/pipeline.js +26 -0
  25. package/dist/ci/pipeline.js.map +1 -0
  26. package/dist/ci/select.d.ts +28 -0
  27. package/dist/ci/select.js +43 -0
  28. package/dist/ci/select.js.map +1 -0
  29. package/dist/ci/validate-specs.d.ts +52 -0
  30. package/dist/ci/validate-specs.js +212 -0
  31. package/dist/ci/validate-specs.js.map +1 -0
  32. package/dist/constants.d.ts +1 -60
  33. package/dist/constants.js +1 -58
  34. package/dist/constants.js.map +1 -1
  35. package/dist/derivation/derive.d.ts +0 -56
  36. package/dist/derivation/derive.js +21 -72
  37. package/dist/derivation/derive.js.map +1 -1
  38. package/dist/derivation/engine.d.ts +10 -42
  39. package/dist/derivation/engine.js +37 -68
  40. package/dist/derivation/engine.js.map +1 -1
  41. package/dist/derivation/selection-error.d.ts +7 -0
  42. package/dist/derivation/selection-error.js +13 -0
  43. package/dist/derivation/selection-error.js.map +1 -0
  44. package/dist/errors.d.ts +19 -47
  45. package/dist/errors.js +28 -47
  46. package/dist/errors.js.map +1 -1
  47. package/dist/feature-model/uvl.d.ts +52 -0
  48. package/dist/feature-model/uvl.js +191 -0
  49. package/dist/feature-model/uvl.js.map +1 -0
  50. package/dist/fs/archive.d.ts +0 -16
  51. package/dist/fs/archive.js +0 -36
  52. package/dist/fs/archive.js.map +1 -1
  53. package/dist/fs/diff.d.ts +0 -30
  54. package/dist/fs/diff.js +4 -65
  55. package/dist/fs/diff.js.map +1 -1
  56. package/dist/fs/format.d.ts +0 -16
  57. package/dist/fs/format.js +0 -52
  58. package/dist/fs/format.js.map +1 -1
  59. package/dist/fs/workspace.d.ts +0 -52
  60. package/dist/fs/workspace.js +0 -56
  61. package/dist/fs/workspace.js.map +1 -1
  62. package/dist/index.d.ts +23 -29
  63. package/dist/index.js +15 -35
  64. package/dist/index.js.map +1 -1
  65. package/dist/internal/guards.d.ts +0 -13
  66. package/dist/internal/guards.js +0 -13
  67. package/dist/internal/guards.js.map +1 -1
  68. package/dist/line/deletion.d.ts +33 -0
  69. package/dist/line/deletion.js +23 -0
  70. package/dist/line/deletion.js.map +1 -0
  71. package/dist/line/platform-files.d.ts +15 -64
  72. package/dist/line/platform-files.js +18 -94
  73. package/dist/line/platform-files.js.map +1 -1
  74. package/dist/line/restoration.d.ts +27 -0
  75. package/dist/line/restoration.js +27 -0
  76. package/dist/line/restoration.js.map +1 -0
  77. package/dist/line/scaffold.d.ts +26 -57
  78. package/dist/line/scaffold.js +32 -93
  79. package/dist/line/scaffold.js.map +1 -1
  80. package/dist/line/templates/core/extra.js +54 -54
  81. package/dist/line/templates/core/transformation.js +208 -196
  82. package/dist/line/templates/pipeline/.gitlab-ci.yml +51 -51
  83. package/dist/line/templates/pipeline/ci/test-client.sh +16 -16
  84. package/dist/line/templates/pipeline/ci/test-server.sh +16 -16
  85. package/dist/line/templates/pipeline/github-ci.yml +50 -0
  86. package/dist/line/templates/pipeline/spl-gitlab-ci.yml +182 -0
  87. package/dist/modules/configuration/configure.d.ts +52 -0
  88. package/dist/modules/configuration/configure.js +101 -0
  89. package/dist/modules/configuration/configure.js.map +1 -0
  90. package/dist/modules/configuration/constants.d.ts +17 -0
  91. package/dist/modules/configuration/constants.js +14 -0
  92. package/dist/modules/configuration/constants.js.map +1 -0
  93. package/dist/modules/configuration/index.d.ts +6 -0
  94. package/dist/modules/configuration/index.js +5 -0
  95. package/dist/modules/configuration/index.js.map +1 -0
  96. package/dist/modules/configuration/names.d.ts +9 -0
  97. package/dist/modules/configuration/names.js +7 -0
  98. package/dist/modules/configuration/names.js.map +1 -0
  99. package/dist/modules/configuration/selection.d.ts +32 -0
  100. package/dist/modules/configuration/selection.js +49 -0
  101. package/dist/modules/configuration/selection.js.map +1 -0
  102. package/dist/modules/diagnostics.d.ts +2 -0
  103. package/dist/modules/diagnostics.js +2 -0
  104. package/dist/modules/diagnostics.js.map +1 -0
  105. package/dist/modules/index.d.ts +18 -0
  106. package/dist/modules/index.js +18 -0
  107. package/dist/modules/index.js.map +1 -0
  108. package/dist/modules/metamodels/engine.d.ts +93 -0
  109. package/dist/modules/metamodels/engine.js +10 -0
  110. package/dist/modules/metamodels/engine.js.map +1 -0
  111. package/dist/modules/metamodels/files.d.ts +40 -0
  112. package/dist/modules/metamodels/files.js +58 -0
  113. package/dist/modules/metamodels/files.js.map +1 -0
  114. package/dist/modules/metamodels/index.d.ts +8 -0
  115. package/dist/modules/metamodels/index.js +5 -0
  116. package/dist/modules/metamodels/index.js.map +1 -0
  117. package/dist/modules/metamodels/layout.d.ts +23 -0
  118. package/dist/modules/metamodels/layout.js +29 -0
  119. package/dist/modules/metamodels/layout.js.map +1 -0
  120. package/dist/modules/metamodels/offered.d.ts +15 -0
  121. package/dist/modules/metamodels/offered.js +14 -0
  122. package/dist/modules/metamodels/offered.js.map +1 -0
  123. package/dist/modules/metamodels/prepare.d.ts +20 -0
  124. package/dist/modules/metamodels/prepare.js +155 -0
  125. package/dist/modules/metamodels/prepare.js.map +1 -0
  126. package/dist/modules/packages/index.d.ts +4 -0
  127. package/dist/modules/packages/index.js +4 -0
  128. package/dist/modules/packages/index.js.map +1 -0
  129. package/dist/modules/packages/location.d.ts +21 -0
  130. package/dist/modules/packages/location.js +34 -0
  131. package/dist/modules/packages/location.js.map +1 -0
  132. package/dist/modules/packages/manifests.d.ts +33 -0
  133. package/dist/modules/packages/manifests.js +231 -0
  134. package/dist/modules/packages/manifests.js.map +1 -0
  135. package/dist/modules/packages/source.d.ts +34 -0
  136. package/dist/modules/packages/source.js +128 -0
  137. package/dist/modules/packages/source.js.map +1 -0
  138. package/dist/modules/products/check.d.ts +28 -0
  139. package/dist/modules/products/check.js +61 -0
  140. package/dist/modules/products/check.js.map +1 -0
  141. package/dist/modules/products/derive.d.ts +30 -0
  142. package/dist/modules/products/derive.js +56 -0
  143. package/dist/modules/products/derive.js.map +1 -0
  144. package/dist/modules/products/index.d.ts +5 -0
  145. package/dist/modules/products/index.js +4 -0
  146. package/dist/modules/products/index.js.map +1 -0
  147. package/dist/modules/products/seed.d.ts +18 -0
  148. package/dist/modules/products/seed.js +23 -0
  149. package/dist/modules/products/seed.js.map +1 -0
  150. package/dist/modules/registry/catalog.d.ts +64 -0
  151. package/dist/modules/registry/catalog.js +91 -0
  152. package/dist/modules/registry/catalog.js.map +1 -0
  153. package/dist/modules/registry/index.d.ts +5 -0
  154. package/dist/modules/registry/index.js +4 -0
  155. package/dist/modules/registry/index.js.map +1 -0
  156. package/dist/modules/registry/registry.d.ts +34 -0
  157. package/dist/modules/registry/registry.js +37 -0
  158. package/dist/modules/registry/registry.js.map +1 -0
  159. package/dist/modules/registry/routing.d.ts +8 -0
  160. package/dist/modules/registry/routing.js +23 -0
  161. package/dist/modules/registry/routing.js.map +1 -0
  162. package/dist/modules/resolution/closure.d.ts +28 -0
  163. package/dist/modules/resolution/closure.js +105 -0
  164. package/dist/modules/resolution/closure.js.map +1 -0
  165. package/dist/modules/resolution/index.d.ts +4 -0
  166. package/dist/modules/resolution/index.js +3 -0
  167. package/dist/modules/resolution/index.js.map +1 -0
  168. package/dist/modules/resolution/resolve.d.ts +33 -0
  169. package/dist/modules/resolution/resolve.js +59 -0
  170. package/dist/modules/resolution/resolve.js.map +1 -0
  171. package/dist/modules/resolution/resolvers.d.ts +23 -0
  172. package/dist/modules/resolution/resolvers.js +34 -0
  173. package/dist/modules/resolution/resolvers.js.map +1 -0
  174. package/dist/modules/spl/check.d.ts +25 -0
  175. package/dist/modules/spl/check.js +21 -0
  176. package/dist/modules/spl/check.js.map +1 -0
  177. package/dist/modules/spl/cip.d.ts +67 -0
  178. package/dist/modules/spl/cip.js +98 -0
  179. package/dist/modules/spl/cip.js.map +1 -0
  180. package/dist/modules/spl/feature-model.d.ts +39 -0
  181. package/dist/modules/spl/feature-model.js +106 -0
  182. package/dist/modules/spl/feature-model.js.map +1 -0
  183. package/dist/modules/spl/index.d.ts +6 -0
  184. package/dist/modules/spl/index.js +4 -0
  185. package/dist/modules/spl/index.js.map +1 -0
  186. package/dist/modules/spl/platform.d.ts +49 -0
  187. package/dist/modules/spl/platform.js +316 -0
  188. package/dist/modules/spl/platform.js.map +1 -0
  189. package/dist/modules/types.d.ts +132 -0
  190. package/dist/modules/types.js +2 -0
  191. package/dist/modules/types.js.map +1 -0
  192. package/dist/product/engine-spec.d.ts +0 -16
  193. package/dist/product/engine-spec.js +4 -50
  194. package/dist/product/engine-spec.js.map +1 -1
  195. package/dist/product/spec.d.ts +0 -82
  196. package/dist/product/spec.js +0 -79
  197. package/dist/product/spec.js.map +1 -1
  198. package/dist/product/version.d.ts +0 -23
  199. package/dist/product/version.js +0 -28
  200. package/dist/product/version.js.map +1 -1
  201. package/dist/products-index/products-index.d.ts +0 -165
  202. package/dist/products-index/products-index.js +0 -176
  203. package/dist/products-index/products-index.js.map +1 -1
  204. package/dist/workspace/context.d.ts +25 -0
  205. package/dist/workspace/context.js +43 -0
  206. package/dist/workspace/context.js.map +1 -0
  207. package/dist/workspace/gitExclude.d.ts +2 -0
  208. package/dist/workspace/gitExclude.js +19 -0
  209. package/dist/workspace/gitExclude.js.map +1 -0
  210. package/dist/workspace/host.d.ts +14 -0
  211. package/dist/workspace/host.js +13 -0
  212. package/dist/workspace/host.js.map +1 -0
  213. package/dist/workspace/index.d.ts +12 -0
  214. package/dist/workspace/index.js +12 -0
  215. package/dist/workspace/index.js.map +1 -0
  216. package/dist/workspace/local.d.ts +81 -0
  217. package/dist/workspace/local.js +287 -0
  218. package/dist/workspace/local.js.map +1 -0
  219. package/dist/workspace/modular.d.ts +95 -0
  220. package/dist/workspace/modular.js +301 -0
  221. package/dist/workspace/modular.js.map +1 -0
  222. package/dist/workspace/operations.d.ts +35 -0
  223. package/dist/workspace/operations.js +57 -0
  224. package/dist/workspace/operations.js.map +1 -0
  225. package/dist/workspace/origin.d.ts +20 -0
  226. package/dist/workspace/origin.js +19 -0
  227. package/dist/workspace/origin.js.map +1 -0
  228. package/package.json +82 -67
  229. package/dist/feature-model/convert.d.ts +0 -35
  230. package/dist/feature-model/convert.js +0 -47
  231. package/dist/feature-model/convert.js.map +0 -1
  232. package/dist/feature-model/engine.d.ts +0 -60
  233. package/dist/feature-model/engine.js +0 -139
  234. package/dist/feature-model/engine.js.map +0 -1
  235. package/dist/feature-model/inspect.d.ts +0 -67
  236. package/dist/feature-model/inspect.js +0 -113
  237. package/dist/feature-model/inspect.js.map +0 -1
  238. package/dist/feature-model/io.d.ts +0 -66
  239. package/dist/feature-model/io.js +0 -92
  240. package/dist/feature-model/io.js.map +0 -1
  241. package/dist/feature-model/parse.d.ts +0 -30
  242. package/dist/feature-model/parse.js +0 -36
  243. package/dist/feature-model/parse.js.map +0 -1
  244. package/dist/feature-model/text.d.ts +0 -54
  245. package/dist/feature-model/text.js +0 -126
  246. package/dist/feature-model/text.js.map +0 -1
  247. package/dist/line/templates/metamodels/dataModel/extra.js +0 -328
  248. package/dist/line/templates/metamodels/dataModel/transformation.js +0 -211
  249. package/dist/line/templates/metamodels/sensor/extra.js +0 -36
  250. package/dist/line/templates/metamodels/sensor/transformation.js +0 -47
  251. package/dist/selection/selection.d.ts +0 -126
  252. package/dist/selection/selection.js +0 -152
  253. package/dist/selection/selection.js.map +0 -1
@@ -1,328 +0,0 @@
1
- function getFilterName(entity, propertyName) {
2
- if (!entity) {
3
- return propertyName;
4
- } else if (entity.displayString == "") {
5
- return "";
6
- } else {
7
- var regExFilter = /^\$[_a-zA-Z0-9-]+$/;
8
- if (regExFilter.test(entity.displayString)) {
9
- var propertyInDisplaString = getProperty(
10
- entity,
11
- entity.displayString.replace(/\$/g, "")
12
- );
13
- if (!propertyInDisplaString || propertyInDisplaString.multiple) {
14
- return "";
15
- } else {
16
- return propertyName + "_" + propertyInDisplaString.name;
17
- }
18
- } else {
19
- return "";
20
- }
21
- }
22
- }
23
-
24
- function getDisplayString(entity, suffix) {
25
- if (!suffix) {
26
- suffix = normalize(entity.name);
27
- }
28
-
29
- if (entity.displayString == "") {
30
- return (
31
- "'" +
32
- entity.name +
33
- "'" +
34
- " + ' ' + " +
35
- suffix +
36
- "." +
37
- getIdProperty(entity).name
38
- );
39
- }
40
-
41
- return (
42
- "'" +
43
- entity.displayString.replace(/\$\w+/g, function myFunction(x) {
44
- return "' + " + x.replace(/\$/g, suffix + ".") + " + '";
45
- }) +
46
- "'"
47
- );
48
- }
49
-
50
- function getDisplayStringName(entity) {
51
- if (entity.displayString == null) {
52
- return null;
53
- }
54
- return entity.displayString.replace("$", "");
55
- }
56
-
57
- function getDisplayStringJava(entity, entityVariableName) {
58
- if (entity.displayString == "") {
59
- return (
60
- '"' +
61
- entity.name +
62
- ' " + ' +
63
- entityVariableName +
64
- ".get" +
65
- normalize(getIdProperty(entity).name, true) +
66
- "()"
67
- );
68
- }
69
-
70
- return (
71
- '"' +
72
- entity.displayString.replace(/\$\w+/g, function myFunction(x) {
73
- return (
74
- '" + ' +
75
- entityVariableName +
76
- ".get" +
77
- normalize(x.split("$")[1], true) +
78
- "()" +
79
- " + " +
80
- '"'
81
- );
82
- }) +
83
- '"'
84
- );
85
- }
86
-
87
- function getEntity(data, entityName) {
88
- return data.dataModel.entities.find(function(en) {
89
- return en.name == entityName;
90
- });
91
- }
92
-
93
- function getForm(data, className) {
94
- return data.forms.find(function(en) {
95
- return en.entity == className;
96
- });
97
- }
98
-
99
- function getProperty(entity, propertyName) {
100
- return entity.properties.find(function(p) {
101
- return p.name == propertyName;
102
- });
103
- }
104
-
105
- function getEnum(data, enumName) {
106
- return data.dataModel.enums.find(function(en) {
107
- return en.name == enumName;
108
- });
109
- }
110
-
111
- function getIdProperty(entity) {
112
- if (!entity) return null;
113
- return entity.properties.find(function(p) {
114
- return p.pk;
115
- });
116
- }
117
-
118
- function getProperties(entity, data) {
119
- const properties = entity.properties;
120
- const superclass = entity.superclass ? getEntity(data, entity.superclass) : null;
121
- if (superclass) {
122
- return properties.concat(getProperties(superclass, data));
123
- } else {
124
- return properties;
125
- }
126
- }
127
-
128
- function getEntityProperty(entity, propertyName) {
129
- if (!entity) return null;
130
-
131
- let foundProp = null;
132
- entity.properties.every((property) => {
133
- if (property.name === propertyName) {
134
- foundProp = property;
135
- return false;
136
- }
137
- return true;
138
- });
139
-
140
- if (!foundProp && entity.superclass) {
141
- const superClasses = getEntitySuperClasses(entity);
142
- superClasses.every((superclass) => {
143
- superclass.properties.every((property) => {
144
- if (property.name === propertyName) {
145
- foundProp = property;
146
- return false;
147
- }
148
- return true;
149
- });
150
- return foundProp == null;
151
- });
152
- }
153
- return foundProp;
154
- }
155
-
156
- function getRelationships(data, entity, propertiesFilter) {
157
- var r = [];
158
-
159
- var properties = entity.properties;
160
-
161
- if (propertiesFilter) {
162
- if (typeof propertiesFilter == "function") {
163
- properties = properties.filter(propertiesFilter);
164
- } else {
165
- properties = properties.filter(function(p) {
166
- return propertiesFilter.indexOf(p.name) != -1;
167
- });
168
- }
169
- }
170
-
171
- properties.forEach(function(property) {
172
- var propertyEntity = getEntity(data, property.class);
173
-
174
- if (propertyEntity != null) {
175
- r.push({
176
- property: property,
177
- class: propertyEntity,
178
- inverseProperty: propertyEntity.properties.find(function(p) {
179
- return p.name == property.bidirectional;
180
- })
181
- });
182
- }
183
- });
184
-
185
- return r;
186
- }
187
-
188
- var inputTypes = [
189
- "Boolean",
190
- "BigDecimal",
191
- "Integer",
192
- "Long",
193
- "Float",
194
- "Double",
195
- "String",
196
- "Text",
197
- "Date",
198
- "DateTime"
199
- ];
200
-
201
- function isInput(data, property) {
202
- return inputTypes.indexOf(property.class) != -1
203
- || property.class.indexOf('autoinc') != -1
204
- || getEntity(data, property.class)
205
- || getEnum(data, property.class);
206
- }
207
-
208
- function getEntityPropertyNamesOfTypes(entity, types) {
209
- const propertyNames = [];
210
- let entities = [];
211
- if (!entity.abstract) {
212
- entities.push(entity);
213
- if (entity.superclass) {
214
- const superClasses = getEntitySuperClasses(entity);
215
- entities = entities.concat(superClasses);
216
- }
217
- }
218
- entities.forEach((_entity) => {
219
- _entity.properties.forEach((property) => {
220
- types.forEach((type) => {
221
- if (property.class == type || property.class == type + " (autoinc)") {
222
- propertyNames.push(property.name);
223
- }
224
- });
225
- });
226
- });
227
- return propertyNames;
228
- }
229
-
230
- function checkEntityContainsPropertiesOfTypes(entity, types) {
231
- return getEntityPropertyNamesOfTypes(entity, types).length !== 0;
232
- }
233
-
234
- function getEntitySuperClasses(entity, superclasses = []) {
235
- let entitySuperClasses = superclasses;
236
- if (!entity.superclass) {
237
- return superclasses;
238
- } else {
239
- let _superclass = data.dataModel.entities.find(e => e.name === entity.superclass);
240
- if (!_superclass) {
241
- return superclasses;
242
- } else {
243
- entitySuperClasses = entitySuperClasses.concat(_superclass);
244
- return getEntitySuperClasses(_superclass, entitySuperClasses);
245
- }
246
- }
247
- }
248
-
249
- function checkAnyEntityContainsPropertiesOfTypes(data, types) {
250
- var propertyTypeFound = false;
251
- data.dataModel.entities.forEach(function(entity) {
252
- var found = checkEntityContainsPropertiesOfTypes(entity, types);
253
- propertyTypeFound = propertyTypeFound || found;
254
- });
255
- return propertyTypeFound;
256
- }
257
-
258
- function checkEntityContainsPatternOfType(entity, patternType) {
259
- var patternFound = false;
260
- entity.properties.forEach(function(property) {
261
- if (property.patternType === patternType) {
262
- patternFound = true;
263
- }
264
- });
265
- return patternFound;
266
- }
267
-
268
- function checkEntityContainsPatternOfTypes(entity, patternTypes) {
269
- var patternsFound = false;
270
- patternTypes.forEach(function(patternType) {
271
- var patternFound = checkEntityContainsPatternOfType(entity, patternType);
272
- patternsFound = patternsFound || patternFound;
273
- });
274
- return patternsFound;
275
- }
276
-
277
- function checkAnyEntityContainsPatternOfType(data, patternType) {
278
- var patternFound = false;
279
- data.dataModel.entities.forEach(function(entity) {
280
- patternFound =
281
- patternFound || checkEntityContainsPatternOfType(entity, patternType);
282
- });
283
- return patternFound;
284
- }
285
-
286
- function checkAnyEntityContainsPatternOfTypes(data, patternTypes) {
287
- var patternsFound = false;
288
- patternTypes.forEach(function(patternType) {
289
- var patternFound = checkAnyEntityContainsPatternOfType(data, patternType);
290
- patternsFound = patternsFound || patternFound;
291
- });
292
- return patternsFound;
293
- }
294
-
295
- function entityIsSuperclass(entity) {
296
- return data.dataModel.entities.find(e => e.superclass === entity.name) != null;
297
- }
298
-
299
- function getTableDataTitleTranslate(entityName, propertyName) {
300
- return (
301
- "'entity." +
302
- normalize(entityName) +
303
- ".prop." +
304
- normalize(propertyName) +
305
- "' | translate"
306
- );
307
- }
308
-
309
- function getOtherRelationshipsNotMultipleAndOwning(data, context) {
310
- var rels = [];
311
-
312
- data.dataModel.entities.forEach(function(entity) {
313
- entity.properties.forEach(function(property) {
314
- if (property.class == context.name && property.owner) {
315
- if (property.bidirectional && !property.multiple) {
316
- var thisProperty = context.properties.find(function(p) {
317
- return p.name == property.bidirectional;
318
- });
319
- if (!thisProperty.multiple) {
320
- rels.push({ entity: entity, property: property });
321
- }
322
- }
323
- }
324
- });
325
- });
326
-
327
- return rels;
328
- }
@@ -1,211 +0,0 @@
1
- registerMetamodelProcessor(function processDataModel(ret, input) {
2
- if (input.data && input.data.dataModel) {
3
- ret.data.dataModel = input.data.dataModel;
4
- } else if (input.dataModel) {
5
- ret.data.dataModel = dataModel(input.dataModel);
6
- } else {
7
- ret.data.dataModel = { entities: [], enums: [] };
8
- }
9
-
10
- if (ret.features.indexOf("GUI_Forms") !== -1) {
11
- ret.data.forms = forms(ret.data.dataModel.entities, ret.features);
12
- } else {
13
- ret.data.forms = [];
14
- }
15
-
16
- if (ret.features.indexOf("GUI_Lists") !== -1) {
17
- ret.data.lists = lists(ret.data.dataModel.entities, ret.features, ret.data.forms);
18
- } else {
19
- ret.data.lists = [];
20
- }
21
- });
22
-
23
- function enums(input) {
24
- return input.map((e) => ({
25
- name: normalize(e.name, true),
26
- values: e.values,
27
- }));
28
- }
29
-
30
- function entities(input) {
31
- return input.map((e) => ({
32
- name: normalize(e.name, true),
33
- properties: properties(e),
34
- displayString: "$" + _getDisplayString(e, input),
35
- superclass: e.superclass && e.superclass.name,
36
- abstract: e.abstract,
37
- traceable: e.traceable,
38
- }));
39
- }
40
-
41
- function properties(entity) {
42
- const ret = [];
43
- entity.properties.forEach((p) => {
44
- if (p.name === "id") {
45
- ret.push({ name: "id", class: "Long (autoinc)", pk: true, required: true, unique: true });
46
- } else {
47
- ret.push({
48
- name: p.name,
49
- class: normalize(p.class, true),
50
- required: p.required,
51
- unique: p.unique,
52
- patternType: p.patternType,
53
- pattern: p.pattern,
54
- min: p.min,
55
- max: p.max,
56
- });
57
- }
58
- });
59
- return ret;
60
- }
61
-
62
- function relationships(ret, input) {
63
- const rels = input.cells.filter((o) => o.type === "custom.Association");
64
-
65
- rels.forEach((r) => {
66
- const source = findEntityByName(normalize(findEntityById(r.source.id, input.cells).name, true), ret);
67
- const target = findEntityByName(normalize(findEntityById(r.target.id, input.cells).name, true), ret);
68
-
69
- source.properties.push({
70
- name: r.sourceOpts.label || normalize(target.name),
71
- class: target.name,
72
- owner: _getRelationshipOwner(r, r.source.id),
73
- bidirectional: r.targetOpts.label || normalize(source.name),
74
- multiple: multiple(r.sourceOpts.multiplicity),
75
- required: required(r.sourceOpts.multiplicity),
76
- });
77
-
78
- target.properties.push({
79
- name: r.targetOpts.label || normalize(source.name),
80
- class: source.name,
81
- owner: _getRelationshipOwner(r, r.target.id),
82
- bidirectional: r.sourceOpts.label || normalize(target.name),
83
- multiple: multiple(r.targetOpts.multiplicity),
84
- required: required(r.targetOpts.multiplicity),
85
- });
86
- });
87
-
88
- return ret;
89
- }
90
-
91
- function dataModel(input) {
92
- const ret = {};
93
- ret.enums = enums(input.cells.filter((o) => o.type === "custom.Enum"));
94
- ret.entities = entities(input.cells.filter((o) => o.type === "custom.Class"));
95
- relationships(ret.entities, input);
96
- return ret;
97
- }
98
-
99
- function forms(entities, features) {
100
- return entities.map((e) => {
101
- const props = _getProperties(e, entities);
102
- return {
103
- id: e.name + " Form",
104
- properties: _sortProperties(props, e),
105
- entity: e.name,
106
- abstract: e.abstract,
107
- creatable: features.indexOf("GUI_F_Creatable") !== -1,
108
- editable: features.indexOf("GUI_F_Editable") !== -1,
109
- removable: features.indexOf("GUI_F_Removable") !== -1,
110
- confirmation: features.indexOf("GUI_F_R_ConfirmationAlert") !== -1,
111
- };
112
- });
113
- }
114
-
115
- function lists(entities, features, forms) {
116
- const formNeeded = features.indexOf("GUI_L_FormLink") !== -1;
117
- return entities
118
- .filter((e) => !e.abstract)
119
- .map((e) => {
120
- const entityForm = _getForm(e.name, forms);
121
- const props = _getProperties(e, entities, forms);
122
- return {
123
- id: e.name + " List",
124
- abstract: e.abstract,
125
- properties: _sortProperties(props, e),
126
- entity: e.name,
127
- form: entityForm && entityForm.id,
128
- removeLink: formNeeded && entityForm && entityForm.removable,
129
- sorting: features.indexOf("GUI_L_Sortable") !== -1,
130
- searching: features.indexOf("GUI_L_F_BasicSearch") !== -1,
131
- filtering: features.indexOf("GUI_L_F_RowFilter") !== -1,
132
- };
133
- });
134
- }
135
-
136
- function _getForm(entityName, forms) {
137
- return forms.find((f) => f.entity === entityName);
138
- }
139
-
140
- function _getProperties(e, entities, forms) {
141
- if (forms === undefined) forms = [];
142
- const props = forms.length ? _getPropertiesLists(e, forms) : _getPropertiesForms(e);
143
- const superclass = e.superclass ? entities.find((entity) => entity.name === e.superclass) : null;
144
- return superclass ? props.concat(_getProperties(superclass, entities, forms)) : props;
145
- }
146
-
147
- function _getPropertiesLists(e, forms) {
148
- return e.properties
149
- .filter((p) => p.owner === undefined || p.owner)
150
- .map((p) => ({
151
- property: p.name,
152
- form: _getForm(e.name, forms) && _getForm(e.name, forms).id,
153
- owner: e.name,
154
- }));
155
- }
156
-
157
- function _getPropertiesForms(e) {
158
- return e.properties
159
- .filter((p) => p.owner === undefined || p.owner)
160
- .map((p) => ({
161
- property: p.name,
162
- viewing: true,
163
- editing: p.name !== "id",
164
- owner: e.name,
165
- }));
166
- }
167
-
168
- function _sortProperties(props, entity) {
169
- const displayString = entity.displayString.replace("$", "");
170
- const idProp = props.find((p) => p.property === "id");
171
- const displayProp = props.find((p) => p.property === displayString);
172
- props = props.filter((p) => p !== idProp && p !== displayProp);
173
- return displayProp !== idProp ? [idProp, displayProp].concat(props) : [idProp].concat(props);
174
- }
175
-
176
- function _getDisplayString(entity, entities) {
177
- const displayString = entity.properties.find((e) => e.displayString);
178
- if (!displayString && entity.superclass) {
179
- return _getDisplayString(entities.find((e) => e.name === entity.superclass.name), entities);
180
- } else if (displayString) {
181
- return displayString.name;
182
- } else {
183
- return "id";
184
- }
185
- }
186
-
187
- function _getRelationshipOwner(rel, entityId) {
188
- const isSource = rel.source.id === entityId;
189
- const relType =
190
- (multiple(rel.targetOpts.multiplicity) ? "Many" : "One") +
191
- "To" +
192
- (multiple(rel.sourceOpts.multiplicity) ? "Many" : "One");
193
- if (relType === "OneToMany") return !isSource;
194
- else return isSource;
195
- }
196
-
197
- function findEntityById(id, col) {
198
- return col.find((o) => o.id === id);
199
- }
200
-
201
- function findEntityByName(name, col) {
202
- return col.find((o) => o.name === name);
203
- }
204
-
205
- function multiple(multiplicity) {
206
- return ["1", "0..1"].find((a) => a === multiplicity) == null;
207
- }
208
-
209
- function required() {
210
- return false;
211
- }
@@ -1,36 +0,0 @@
1
- // Sensor metamodel helper functions
2
- // These are appended to core/extra.js and made available to codegen templates.
3
-
4
- function getSensors(data) {
5
- return (data.dataWarehouse && data.dataWarehouse.sensors) || [];
6
- }
7
-
8
- function getSensor(data, sensorId) {
9
- return getSensors(data).find(function (s) {
10
- return s.id === sensorId;
11
- });
12
- }
13
-
14
- function getSensorMeasurements(sensor) {
15
- return (sensor && sensor.measureData) || [];
16
- }
17
-
18
- function getSensorDimensions(sensor) {
19
- return (sensor && sensor.dimensions) || [];
20
- }
21
-
22
- function getSensorSpatialDimensions(sensor) {
23
- return getSensorDimensions(sensor).filter(function (d) {
24
- return d.type === 'SPATIAL';
25
- });
26
- }
27
-
28
- function getSensorCategoricalDimensions(sensor) {
29
- return getSensorDimensions(sensor).filter(function (d) {
30
- return d.type === 'CATEGORICAL';
31
- });
32
- }
33
-
34
- function getSensorGroups(data) {
35
- return (data.dataWarehouse && data.dataWarehouse.sensorGroups) || [];
36
- }
@@ -1,47 +0,0 @@
1
- // Fallback path: runs when #buildEngineSpec in ProductService did NOT trigger the engine's
2
- // fast-path shortcut (i.e. parsed.data.basicData was absent). For fully-valid sensor products
3
- // the fast-path fires instead and this processor receives input.sensor === undefined.
4
- registerMetamodelProcessor(function processSensor(ret, input) {
5
- const sensor = input.sensor;
6
- if (!sensor || !sensor.parsed) return;
7
-
8
- const parsed = sensor.parsed;
9
-
10
- // The sensor DSL produces its own feature set (SensorViewer, SV_*, etc.).
11
- // Override the FM-selected features so the correct platform capabilities are activated.
12
- if (Array.isArray(parsed.features) && parsed.features.length) {
13
- ret.features = parsed.features;
14
- }
15
-
16
- const data = parsed.data;
17
- if (!data) return;
18
-
19
- // Use the parser's basicData which already has the correct packageInfo key names
20
- // (artifactId / groupId) and the SET DEPLOYMENT extra values.
21
- // Merge database credentials from the product document (user-configured, not in DSL).
22
- if (data.basicData) {
23
- ret.data.basicData = Object.assign({}, data.basicData, {
24
- database: (input.basicData && input.basicData.database) || {}
25
- });
26
- }
27
-
28
- // The sensor DSL parser already outputs a ready-to-use dataModel
29
- // (entities/enums) — pass it through directly, overriding any UML-sourced value.
30
- if (data.dataModel) {
31
- ret.data.dataModel = data.dataModel;
32
- }
33
-
34
- // Sensor-specific data warehouse (sensors, sensorGroups, maps, layers, styles)
35
- if (data.dataWarehouse) {
36
- ret.data.dataWarehouse = data.dataWarehouse;
37
- }
38
-
39
- if (data.mapViewer) {
40
- ret.data.mapViewer = data.mapViewer;
41
- }
42
-
43
- // forms/lists come from the parser (empty for most sensor products, but respect parsed output).
44
- // menus and statics are set by the core transformation AFTER processors run.
45
- ret.data.forms = data.forms || [];
46
- ret.data.lists = data.lists || [];
47
- });