@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
@@ -0,0 +1,212 @@
1
+ import { parseUvl } from '../feature-model/uvl.js';
2
+ const selectedNames = (features) => new Set(Array.isArray(features)
3
+ ? features
4
+ : Object.entries(features).filter(([, on]) => on).map(([name]) => name));
5
+ const evaluate = (formula, on) => {
6
+ if ('feature' in formula)
7
+ return on.has(formula.feature);
8
+ if ('not' in formula)
9
+ return !evaluate(formula.not, on);
10
+ const left = evaluate(formula.left, on);
11
+ const right = evaluate(formula.right, on);
12
+ switch (formula.operator) {
13
+ case '&': return left && right;
14
+ case '|': return left || right;
15
+ case '=>': return !left || right;
16
+ case '<=>': return left === right;
17
+ }
18
+ };
19
+ const formulaLabel = (formula) => {
20
+ if ('feature' in formula)
21
+ return formula.feature;
22
+ if ('not' in formula)
23
+ return `!${formulaLabel(formula.not)}`;
24
+ return `(${formulaLabel(formula.left)} ${formula.operator} ${formulaLabel(formula.right)})`;
25
+ };
26
+ const groupBounds = (group) => {
27
+ switch (group.kind) {
28
+ case 'alternative': return { min: 1, max: 1 };
29
+ case 'or': return { min: 1, max: group.features.length };
30
+ case 'cardinality': return { min: group.min ?? 0, max: group.max ?? group.features.length };
31
+ default: return undefined;
32
+ }
33
+ };
34
+ const checkNode = (node, on, problems) => {
35
+ for (const group of node.groups) {
36
+ const chosen = group.features.filter(({ name }) => on.has(name));
37
+ for (const child of group.features) {
38
+ if (group.kind === 'mandatory' && !on.has(child.name)) {
39
+ problems.push({ feature: child.name, message: `"${child.name}" is mandatory under "${node.name}" and is not selected.` });
40
+ }
41
+ }
42
+ const bounds = groupBounds(group);
43
+ if (bounds !== undefined && (chosen.length < bounds.min || chosen.length > bounds.max)) {
44
+ problems.push({
45
+ feature: node.name,
46
+ message: `The ${group.kind} group of "${node.name}" needs ${bounds.min === bounds.max ? bounds.min : `${bounds.min} to ${bounds.max}`} of ${group.features.map(({ name }) => name).join(', ')}; ${chosen.length} selected.`
47
+ });
48
+ }
49
+ for (const child of chosen)
50
+ checkNode(child, on, problems);
51
+ }
52
+ };
53
+ const allNames = (node, into = new Set()) => {
54
+ into.add(node.name);
55
+ for (const group of node.groups)
56
+ for (const child of group.features)
57
+ allNames(child, into);
58
+ return into;
59
+ };
60
+ /**
61
+ * What a constraint leaves no choice about, given what is selected: `A => B` with A selected needs B, a constraint that is a feature on its
62
+ * own makes it mandatory, an `|` with one way left takes it. Where there is a choice nothing is added. (The rule of the feature selection
63
+ * metamodel, so a spec is read the way the derivation reads it.)
64
+ */
65
+ const establish = (formula, on, add) => {
66
+ if (evaluate(formula, on) && !('operator' in formula && (formula.operator === '=>' || formula.operator === '&')))
67
+ return;
68
+ if ('feature' in formula)
69
+ add(formula.feature);
70
+ else if ('not' in formula)
71
+ return;
72
+ else if (formula.operator === '&') {
73
+ establish(formula.left, on, add);
74
+ establish(formula.right, on, add);
75
+ }
76
+ else if (formula.operator === '=>') {
77
+ if (evaluate(formula.left, on))
78
+ establish(formula.right, on, add);
79
+ }
80
+ else if (formula.operator === '<=>') {
81
+ if (evaluate(formula.left, on))
82
+ establish(formula.right, on, add);
83
+ if (evaluate(formula.right, on))
84
+ establish(formula.left, on, add);
85
+ }
86
+ else {
87
+ const alternatives = (f) => ('operator' in f && f.operator === '|' ? [...alternatives(f.left), ...alternatives(f.right)] : [f]);
88
+ const open = alternatives(formula).filter((alternative) => !('not' in alternative && 'feature' in alternative.not && on.has(alternative.not.feature)));
89
+ if (open.length === 1)
90
+ establish(open[0], on, add);
91
+ }
92
+ };
93
+ /** The features a selection comes to once what the model implies is added: the root, the ancestors, what is mandatory, what the constraints need. */
94
+ export const completeSelection = ({ tree, features }) => {
95
+ const on = selectedNames(features);
96
+ on.add(tree.root.name);
97
+ const nodes = new Map();
98
+ const parents = new Map();
99
+ const index = (node) => {
100
+ nodes.set(node.name, node);
101
+ for (const group of node.groups)
102
+ for (const child of group.features) {
103
+ parents.set(child.name, node.name);
104
+ index(child);
105
+ }
106
+ };
107
+ index(tree.root);
108
+ for (let changed = true; changed;) {
109
+ changed = false;
110
+ const add = (name) => { if (nodes.has(name) && !on.has(name)) {
111
+ on.add(name);
112
+ changed = true;
113
+ } };
114
+ for (const name of [...on]) {
115
+ const parent = parents.get(name);
116
+ if (parent !== undefined)
117
+ add(parent);
118
+ for (const group of nodes.get(name)?.groups ?? [])
119
+ if (group.kind === 'mandatory')
120
+ group.features.forEach((child) => add(child.name));
121
+ }
122
+ for (const constraint of tree.constraints)
123
+ establish(constraint, on, add);
124
+ }
125
+ return on;
126
+ };
127
+ /**
128
+ * Whether a feature selection is a valid configuration of a feature model: every feature exists and, once what the model implies is added
129
+ * (`completeSelection`), the groups are respected and every cross-tree constraint holds. The rules flamapy applies, checked directly over
130
+ * the tree, so a pipeline can validate every real product in milliseconds and with no Python runtime.
131
+ */
132
+ export const validateSelection = ({ tree, features }) => {
133
+ const known = allNames(tree.root);
134
+ const problems = [];
135
+ for (const name of selectedNames(features)) {
136
+ if (!known.has(name))
137
+ problems.push({ feature: name, message: `"${name}" is not a feature of the model.` });
138
+ }
139
+ const on = completeSelection({ tree, features });
140
+ checkNode(tree.root, on, problems);
141
+ for (const constraint of tree.constraints) {
142
+ if (!evaluate(constraint, on))
143
+ problems.push({ message: `Constraint not satisfied: ${formulaLabel(constraint)}.` });
144
+ }
145
+ return problems;
146
+ };
147
+ /** `validateSelection` over every product of an SPL, against the UVL of its feature model. */
148
+ export const validateProductSelections = ({ featureModel, products }) => {
149
+ const tree = parseUvl({ content: featureModel });
150
+ return products.map(({ name, features }) => ({ name, problems: validateSelection({ tree, features }) }));
151
+ };
152
+ /**
153
+ * The selection of a product without one of its features (and what hangs from it), for measuring what that feature is worth: the code that
154
+ * disappears is the code the feature brings. `undefined` when the model does not allow it (the feature is mandatory, or something that stays
155
+ * needs it), because that product cannot be derived.
156
+ */
157
+ export const ablateFeature = ({ tree, features, feature }) => {
158
+ const removed = new Set();
159
+ const collect = (node) => { removed.add(node.name); for (const group of node.groups)
160
+ group.features.forEach(collect); };
161
+ const find = (node) => node.name === feature ? node : node.groups.flatMap((group) => group.features).map(find).find((found) => found !== undefined);
162
+ const target = find(tree.root);
163
+ if (target === undefined || target === tree.root)
164
+ return undefined;
165
+ collect(target);
166
+ const complete = completeSelection({ tree, features });
167
+ if (!complete.has(feature))
168
+ return undefined;
169
+ const kept = [...complete].filter((name) => !removed.has(name));
170
+ const again = completeSelection({ tree, features: kept });
171
+ if (again.has(feature) || validateSelection({ tree, features: kept }).length > 0)
172
+ return undefined;
173
+ return kept;
174
+ };
175
+ /** The first selected group that has fewer features chosen than it needs, with the ones that can still be chosen. */
176
+ const deficientGroup = (node, on) => {
177
+ for (const group of node.groups) {
178
+ const bounds = groupBounds(group);
179
+ const chosen = group.features.filter(({ name }) => on.has(name));
180
+ if (bounds !== undefined && chosen.length < bounds.min) {
181
+ return { need: bounds.min - chosen.length, open: group.features.filter(({ name }) => !on.has(name)) };
182
+ }
183
+ for (const child of chosen) {
184
+ const deeper = deficientGroup(child, on);
185
+ if (deeper !== undefined)
186
+ return deeper;
187
+ }
188
+ }
189
+ return undefined;
190
+ };
191
+ /**
192
+ * A valid selection that has a feature, made of the least that has to come with it: what the model implies, and the first feature of every
193
+ * group that asks for a choice. Used to measure what a feature brings when no real product has it. `undefined` when no selection with it
194
+ * is valid (the constraints forbid it).
195
+ */
196
+ export const activateFeature = ({ tree, features, feature }) => {
197
+ if (!allNames(tree.root).has(feature))
198
+ return undefined;
199
+ let selection = completeSelection({ tree, features: [...selectedNames(features), feature] });
200
+ for (let round = 0; round < 100; round++) {
201
+ if (validateSelection({ tree, features: [...selection] }).length === 0)
202
+ return [...selection];
203
+ const gap = deficientGroup(tree.root, selection);
204
+ if (gap === undefined)
205
+ return undefined;
206
+ for (const node of gap.open.slice(0, gap.need))
207
+ selection.add(node.name);
208
+ selection = completeSelection({ tree, features: [...selection] });
209
+ }
210
+ return undefined;
211
+ };
212
+ //# sourceMappingURL=validate-specs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate-specs.js","sourceRoot":"","sources":["../../src/ci/validate-specs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAA4E,MAAM,yBAAyB,CAAA;AAiB5H,MAAM,aAAa,GAAG,CAAC,QAAsC,EAAe,EAAE,CAC5E,IAAI,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC;IAC7B,CAAC,CAAC,QAA6B;IAC/B,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,QAAmC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,CAAA;AAEvG,MAAM,QAAQ,GAAG,CAAC,OAAgB,EAAE,EAAuB,EAAW,EAAE;IACtE,IAAI,SAAS,IAAI,OAAO;QAAE,OAAO,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;IACxD,IAAI,KAAK,IAAI,OAAO;QAAE,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAA;IACvD,MAAM,IAAI,GAAG,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAA;IACvC,MAAM,KAAK,GAAG,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAA;IACzC,QAAQ,OAAO,CAAC,QAAQ,EAAE,CAAC;QACzB,KAAK,GAAG,CAAC,CAAC,OAAO,IAAI,IAAI,KAAK,CAAA;QAC9B,KAAK,GAAG,CAAC,CAAC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CAAC;YAAE,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QACxE,SAAS,GAAG,iBAAiB,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,GAAG,SAAS,CAAC,EAAE,CAAC,CAAA;IACnE,CAAC;IACD,OAAO,SAAS,CAAA;AAClB,CAAC,CAAA","sourcesContent":["import { parseUvl, type FeatureGroup, type FeatureModelTree, type FeatureNode, type Formula } from '../feature-model/uvl.js'\n\nexport interface SelectionProblem {\n readonly feature?: string\n readonly message: string\n}\n\nexport interface ProductSelection {\n readonly name: string\n readonly features: readonly string[] | Readonly<Record<string, boolean>>\n}\n\nexport interface ProductSelectionReport {\n readonly name: string\n readonly problems: SelectionProblem[]\n}\n\nconst selectedNames = (features: ProductSelection['features']): Set<string> =>\n new Set(Array.isArray(features)\n ? features as readonly string[]\n : Object.entries(features as Record<string, boolean>).filter(([, on]) => on).map(([name]) => name))\n\nconst evaluate = (formula: Formula, on: ReadonlySet<string>): boolean => {\n if ('feature' in formula) return on.has(formula.feature)\n if ('not' in formula) return !evaluate(formula.not, on)\n const left = evaluate(formula.left, on)\n const right = evaluate(formula.right, on)\n switch (formula.operator) {\n case '&': return left && right\n case '|': return left || right\n case '=>': return !left || right\n case '<=>': return left === right\n }\n}\n\nconst formulaLabel = (formula: Formula): string => {\n if ('feature' in formula) return formula.feature\n if ('not' in formula) return `!${formulaLabel(formula.not)}`\n return `(${formulaLabel(formula.left)} ${formula.operator} ${formulaLabel(formula.right)})`\n}\n\nconst groupBounds = (group: FeatureGroup): { min: number, max: number } | undefined => {\n switch (group.kind) {\n case 'alternative': return { min: 1, max: 1 }\n case 'or': return { min: 1, max: group.features.length }\n case 'cardinality': return { min: group.min ?? 0, max: group.max ?? group.features.length }\n default: return undefined\n }\n}\n\nconst checkNode = (node: FeatureNode, on: ReadonlySet<string>, problems: SelectionProblem[]): void => {\n for (const group of node.groups) {\n const chosen = group.features.filter(({ name }) => on.has(name))\n for (const child of group.features) {\n if (group.kind === 'mandatory' && !on.has(child.name)) {\n problems.push({ feature: child.name, message: `\"${child.name}\" is mandatory under \"${node.name}\" and is not selected.` })\n }\n }\n const bounds = groupBounds(group)\n if (bounds !== undefined && (chosen.length < bounds.min || chosen.length > bounds.max)) {\n problems.push({\n feature: node.name,\n message: `The ${group.kind} group of \"${node.name}\" needs ${bounds.min === bounds.max ? bounds.min : `${bounds.min} to ${bounds.max}`} of ${group.features.map(({ name }) => name).join(', ')}; ${chosen.length} selected.`\n })\n }\n for (const child of chosen) checkNode(child, on, problems)\n }\n}\n\nconst allNames = (node: FeatureNode, into = new Set<string>()): Set<string> => {\n into.add(node.name)\n for (const group of node.groups) for (const child of group.features) allNames(child, into)\n return into\n}\n\n/**\n * What a constraint leaves no choice about, given what is selected: `A => B` with A selected needs B, a constraint that is a feature on its\n * own makes it mandatory, an `|` with one way left takes it. Where there is a choice nothing is added. (The rule of the feature selection\n * metamodel, so a spec is read the way the derivation reads it.)\n */\nconst establish = (formula: Formula, on: ReadonlySet<string>, add: (name: string) => void): void => {\n if (evaluate(formula, on) && !('operator' in formula && (formula.operator === '=>' || formula.operator === '&'))) return\n if ('feature' in formula) add(formula.feature)\n else if ('not' in formula) return\n else if (formula.operator === '&') { establish(formula.left, on, add); establish(formula.right, on, add) }\n else if (formula.operator === '=>') { if (evaluate(formula.left, on)) establish(formula.right, on, add) }\n else if (formula.operator === '<=>') {\n if (evaluate(formula.left, on)) establish(formula.right, on, add)\n if (evaluate(formula.right, on)) establish(formula.left, on, add)\n } else {\n const alternatives = (f: Formula): Formula[] => ('operator' in f && f.operator === '|' ? [...alternatives(f.left), ...alternatives(f.right)] : [f])\n const open = alternatives(formula).filter((alternative) => !('not' in alternative && 'feature' in alternative.not && on.has(alternative.not.feature)))\n if (open.length === 1) establish(open[0]!, on, add)\n }\n}\n\n/** The features a selection comes to once what the model implies is added: the root, the ancestors, what is mandatory, what the constraints need. */\nexport const completeSelection = ({ tree, features }: { tree: FeatureModelTree, features: ProductSelection['features'] }): Set<string> => {\n const on = selectedNames(features)\n on.add(tree.root.name)\n const nodes = new Map<string, FeatureNode>()\n const parents = new Map<string, string>()\n const index = (node: FeatureNode): void => {\n nodes.set(node.name, node)\n for (const group of node.groups) for (const child of group.features) { parents.set(child.name, node.name); index(child) }\n }\n index(tree.root)\n\n for (let changed = true; changed;) {\n changed = false\n const add = (name: string): void => { if (nodes.has(name) && !on.has(name)) { on.add(name); changed = true } }\n for (const name of [...on]) {\n const parent = parents.get(name)\n if (parent !== undefined) add(parent)\n for (const group of nodes.get(name)?.groups ?? []) if (group.kind === 'mandatory') group.features.forEach((child) => add(child.name))\n }\n for (const constraint of tree.constraints) establish(constraint, on, add)\n }\n return on\n}\n\n/**\n * Whether a feature selection is a valid configuration of a feature model: every feature exists and, once what the model implies is added\n * (`completeSelection`), the groups are respected and every cross-tree constraint holds. The rules flamapy applies, checked directly over\n * the tree, so a pipeline can validate every real product in milliseconds and with no Python runtime.\n */\nexport const validateSelection = ({ tree, features }: { tree: FeatureModelTree, features: ProductSelection['features'] }): SelectionProblem[] => {\n const known = allNames(tree.root)\n const problems: SelectionProblem[] = []\n for (const name of selectedNames(features)) {\n if (!known.has(name)) problems.push({ feature: name, message: `\"${name}\" is not a feature of the model.` })\n }\n const on = completeSelection({ tree, features })\n checkNode(tree.root, on, problems)\n for (const constraint of tree.constraints) {\n if (!evaluate(constraint, on)) problems.push({ message: `Constraint not satisfied: ${formulaLabel(constraint)}.` })\n }\n return problems\n}\n\n/** `validateSelection` over every product of an SPL, against the UVL of its feature model. */\nexport const validateProductSelections = ({ featureModel, products }: { featureModel: string, products: readonly ProductSelection[] }): ProductSelectionReport[] => {\n const tree = parseUvl({ content: featureModel })\n return products.map(({ name, features }) => ({ name, problems: validateSelection({ tree, features }) }))\n}\n\n/**\n * The selection of a product without one of its features (and what hangs from it), for measuring what that feature is worth: the code that\n * disappears is the code the feature brings. `undefined` when the model does not allow it (the feature is mandatory, or something that stays\n * needs it), because that product cannot be derived.\n */\nexport const ablateFeature = ({ tree, features, feature }: { tree: FeatureModelTree, features: ProductSelection['features'], feature: string }): string[] | undefined => {\n const removed = new Set<string>()\n const collect = (node: FeatureNode): void => { removed.add(node.name); for (const group of node.groups) group.features.forEach(collect) }\n const find = (node: FeatureNode): FeatureNode | undefined =>\n node.name === feature ? node : node.groups.flatMap((group) => group.features).map(find).find((found) => found !== undefined)\n const target = find(tree.root)\n if (target === undefined || target === tree.root) return undefined\n collect(target)\n\n const complete = completeSelection({ tree, features })\n if (!complete.has(feature)) return undefined\n const kept = [...complete].filter((name) => !removed.has(name))\n const again = completeSelection({ tree, features: kept })\n if (again.has(feature) || validateSelection({ tree, features: kept }).length > 0) return undefined\n return kept\n}\n\n/** The first selected group that has fewer features chosen than it needs, with the ones that can still be chosen. */\nconst deficientGroup = (node: FeatureNode, on: ReadonlySet<string>): { need: number, open: FeatureNode[] } | undefined => {\n for (const group of node.groups) {\n const bounds = groupBounds(group)\n const chosen = group.features.filter(({ name }) => on.has(name))\n if (bounds !== undefined && chosen.length < bounds.min) {\n return { need: bounds.min - chosen.length, open: group.features.filter(({ name }) => !on.has(name)) }\n }\n for (const child of chosen) {\n const deeper = deficientGroup(child, on)\n if (deeper !== undefined) return deeper\n }\n }\n return undefined\n}\n\n/**\n * A valid selection that has a feature, made of the least that has to come with it: what the model implies, and the first feature of every\n * group that asks for a choice. Used to measure what a feature brings when no real product has it. `undefined` when no selection with it\n * is valid (the constraints forbid it).\n */\nexport const activateFeature = ({ tree, features, feature }: { tree: FeatureModelTree, features: ProductSelection['features'], feature: string }): string[] | undefined => {\n if (!allNames(tree.root).has(feature)) return undefined\n let selection = completeSelection({ tree, features: [...selectedNames(features), feature] })\n for (let round = 0; round < 100; round++) {\n if (validateSelection({ tree, features: [...selection] }).length === 0) return [...selection]\n const gap = deficientGroup(tree.root, selection)\n if (gap === undefined) return undefined\n for (const node of gap.open.slice(0, gap.need)) selection.add(node.name)\n selection = completeSelection({ tree, features: [...selection] })\n }\n return undefined\n}\n"]}
@@ -1,77 +1,18 @@
1
- /**
2
- * Domain constants of linea-core.
3
- *
4
- * ADR-014 forbids global mutable configuration, so everything the monolith read
5
- * from `linea/server/src/resources/properties.yml` at runtime is frozen here as
6
- * a constant. Callers that need different paths pass them explicitly.
7
- */
8
- /**
9
- * Layout of a line's platform directory inside its repository.
10
- *
11
- * Migrated from `linea/server/src/resources/properties.yml` (`paths.platform.*`).
12
- * The `./` prefix used by the YAML is dropped: these are repo-relative segments
13
- * meant to be joined with a working directory (see `resolveLinePaths`).
14
- */
15
1
  export declare const PLATFORM_PATHS: {
16
- /** `paths.platform.root` */
17
2
  readonly root: "src/platform";
18
- /** `paths.platform.code` — annotated source consumed by spl-js-engine. */
19
3
  readonly code: "src/platform/code";
20
- /** `paths.platform.model` — default (UVL) feature model. */
4
+ /** Written when a product is derived (the composed feature model, as UVL): an SPL keeps its feature model as a model of the feature metamodel. */
21
5
  readonly model: "src/platform/model.uvl";
22
- /** XML variant. properties.yml derives it via `model.replace('.uvl', '.xml')`. */
23
- readonly modelXml: "src/platform/model.xml";
24
- /** `paths.platform.config` */
25
6
  readonly config: "src/platform/config.json";
26
- /** `paths.platform.extraJS` */
27
7
  readonly extraJs: "src/platform/extra.js";
28
- /** `paths.platform.transformation` */
29
8
  readonly transformation: "src/platform/transformation.js";
30
9
  };
31
- /**
32
- * Product index kept at the root of every line repository (ADR-011).
33
- * Format: `{ "productos": [{ "name", "repositorio", "version"? }] }`, where
34
- * `version` is the optional, retro-compatible extension ADR-011 foresaw.
35
- */
36
10
  export declare const PRODUCTS_INDEX_PATH = "products.json";
37
- /**
38
- * Valid characters for line and product names.
39
- * Migrated from `linea/server/src/rest/validators/commonValidators.js:NAME_PATTERN`.
40
- */
41
11
  export declare const NAME_PATTERN: RegExp;
42
- /**
43
- * Product version format (`x.y.z`).
44
- * Migrated from `linea/server/src/rest/validators/commonValidators.js:VERSION_PATTERN`.
45
- */
46
12
  export declare const VERSION_PATTERN: RegExp;
47
- /**
48
- * Default UI languages of a generated product.
49
- * Migrated from `linea/server/src/model/entities/product.js:32` and applied as a
50
- * fallback in `generatePipeline.js:218`.
51
- */
52
13
  export declare const DEFAULT_LANGUAGES: readonly ["en", "es", "gl"];
53
- /**
54
- * Default spatial reference system of a generated product.
55
- * Migrated from `linea/server/src/model/entities/product.js:36`.
56
- */
57
14
  export declare const DEFAULT_SRID = "4326";
58
- /** Feature model notations supported by the engine. */
59
- export declare const FEATURE_MODEL_TYPES: readonly ["UVL", "XML"];
60
- /** A feature model notation. */
61
- export type FeatureModelType = (typeof FEATURE_MODEL_TYPES)[number];
62
- /**
63
- * Analysis guard rails, kept for parity with `linea/flamapy-server/main.py`
64
- * (`SKIP_ENUM`, `SKIP_BDD`). Full configuration enumeration and BDD construction
65
- * are exponential; above these feature counts the monolith skips them.
66
- *
67
- * Consumed by `src/analysis/`, which lands in a later batch together with the
68
- * offline-bootstrap ADR.
69
- */
70
15
  export declare const ANALYSIS_THRESHOLDS: {
71
- /** Skip full enumeration above this feature count. */
72
16
  readonly skipEnumeration: 30;
73
- /** Skip BDD-based operations above this feature count. */
74
17
  readonly skipBdd: 100;
75
18
  };
76
- /** Narrowing helper for values coming from outside the library. */
77
- export declare const isFeatureModelType: (value: unknown) => value is FeatureModelType;
package/dist/constants.js CHANGED
@@ -1,76 +1,19 @@
1
- /**
2
- * Domain constants of linea-core.
3
- *
4
- * ADR-014 forbids global mutable configuration, so everything the monolith read
5
- * from `linea/server/src/resources/properties.yml` at runtime is frozen here as
6
- * a constant. Callers that need different paths pass them explicitly.
7
- */
8
- /**
9
- * Layout of a line's platform directory inside its repository.
10
- *
11
- * Migrated from `linea/server/src/resources/properties.yml` (`paths.platform.*`).
12
- * The `./` prefix used by the YAML is dropped: these are repo-relative segments
13
- * meant to be joined with a working directory (see `resolveLinePaths`).
14
- */
15
1
  export const PLATFORM_PATHS = {
16
- /** `paths.platform.root` */
17
2
  root: 'src/platform',
18
- /** `paths.platform.code` — annotated source consumed by spl-js-engine. */
19
3
  code: 'src/platform/code',
20
- /** `paths.platform.model` — default (UVL) feature model. */
4
+ /** Written when a product is derived (the composed feature model, as UVL): an SPL keeps its feature model as a model of the feature metamodel. */
21
5
  model: 'src/platform/model.uvl',
22
- /** XML variant. properties.yml derives it via `model.replace('.uvl', '.xml')`. */
23
- modelXml: 'src/platform/model.xml',
24
- /** `paths.platform.config` */
25
6
  config: 'src/platform/config.json',
26
- /** `paths.platform.extraJS` */
27
7
  extraJs: 'src/platform/extra.js',
28
- /** `paths.platform.transformation` */
29
8
  transformation: 'src/platform/transformation.js'
30
9
  };
31
- /**
32
- * Product index kept at the root of every line repository (ADR-011).
33
- * Format: `{ "productos": [{ "name", "repositorio", "version"? }] }`, where
34
- * `version` is the optional, retro-compatible extension ADR-011 foresaw.
35
- */
36
10
  export const PRODUCTS_INDEX_PATH = 'products.json';
37
- /**
38
- * Valid characters for line and product names.
39
- * Migrated from `linea/server/src/rest/validators/commonValidators.js:NAME_PATTERN`.
40
- */
41
11
  export const NAME_PATTERN = /^[a-zA-Z0-9_\-.]+$/;
42
- /**
43
- * Product version format (`x.y.z`).
44
- * Migrated from `linea/server/src/rest/validators/commonValidators.js:VERSION_PATTERN`.
45
- */
46
12
  export const VERSION_PATTERN = /^\d+\.\d+\.\d+$/;
47
- /**
48
- * Default UI languages of a generated product.
49
- * Migrated from `linea/server/src/model/entities/product.js:32` and applied as a
50
- * fallback in `generatePipeline.js:218`.
51
- */
52
13
  export const DEFAULT_LANGUAGES = ['en', 'es', 'gl'];
53
- /**
54
- * Default spatial reference system of a generated product.
55
- * Migrated from `linea/server/src/model/entities/product.js:36`.
56
- */
57
14
  export const DEFAULT_SRID = '4326';
58
- /** Feature model notations supported by the engine. */
59
- export const FEATURE_MODEL_TYPES = ['UVL', 'XML'];
60
- /**
61
- * Analysis guard rails, kept for parity with `linea/flamapy-server/main.py`
62
- * (`SKIP_ENUM`, `SKIP_BDD`). Full configuration enumeration and BDD construction
63
- * are exponential; above these feature counts the monolith skips them.
64
- *
65
- * Consumed by `src/analysis/`, which lands in a later batch together with the
66
- * offline-bootstrap ADR.
67
- */
68
15
  export const ANALYSIS_THRESHOLDS = {
69
- /** Skip full enumeration above this feature count. */
70
16
  skipEnumeration: 30,
71
- /** Skip BDD-based operations above this feature count. */
72
17
  skipBdd: 100
73
18
  };
74
- /** Narrowing helper for values coming from outside the library. */
75
- export const isFeatureModelType = (value) => typeof value === 'string' && FEATURE_MODEL_TYPES.includes(value);
76
19
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,4BAA4B;IAC5B,IAAI,EAAE,cAAc;IACpB,0EAA0E;IAC1E,IAAI,EAAE,mBAAmB;IACzB,4DAA4D;IAC5D,KAAK,EAAE,wBAAwB;IAC/B,kFAAkF;IAClF,QAAQ,EAAE,wBAAwB;IAClC,8BAA8B;IAC9B,MAAM,EAAE,0BAA0B;IAClC,+BAA+B;IAC/B,OAAO,EAAE,uBAAuB;IAChC,sCAAsC;IACtC,cAAc,EAAE,gCAAgC;CACxC,CAAA;AAEV;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,eAAe,CAAA;AAElD;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,oBAAoB,CAAA;AAEhD;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,iBAAiB,CAAA;AAEhD;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAU,CAAA;AAE5D;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAA;AAElC,uDAAuD;AACvD,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,KAAK,EAAE,KAAK,CAAU,CAAA;AAK1D;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,sDAAsD;IACtD,eAAe,EAAE,EAAE;IACnB,0DAA0D;IAC1D,OAAO,EAAE,GAAG;CACJ,CAAA;AAEV,mEAAmE;AACnE,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,KAAc,EAA6B,EAAE,CAC9E,OAAO,KAAK,KAAK,QAAQ,IAAK,mBAAyC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA","sourcesContent":["/**\r\n * Domain constants of linea-core.\r\n *\r\n * ADR-014 forbids global mutable configuration, so everything the monolith read\r\n * from `linea/server/src/resources/properties.yml` at runtime is frozen here as\r\n * a constant. Callers that need different paths pass them explicitly.\r\n */\r\n\r\n/**\r\n * Layout of a line's platform directory inside its repository.\r\n *\r\n * Migrated from `linea/server/src/resources/properties.yml` (`paths.platform.*`).\r\n * The `./` prefix used by the YAML is dropped: these are repo-relative segments\r\n * meant to be joined with a working directory (see `resolveLinePaths`).\r\n */\r\nexport const PLATFORM_PATHS = {\r\n /** `paths.platform.root` */\r\n root: 'src/platform',\r\n /** `paths.platform.code` — annotated source consumed by spl-js-engine. */\r\n code: 'src/platform/code',\r\n /** `paths.platform.model` — default (UVL) feature model. */\r\n model: 'src/platform/model.uvl',\r\n /** XML variant. properties.yml derives it via `model.replace('.uvl', '.xml')`. */\r\n modelXml: 'src/platform/model.xml',\r\n /** `paths.platform.config` */\r\n config: 'src/platform/config.json',\r\n /** `paths.platform.extraJS` */\r\n extraJs: 'src/platform/extra.js',\r\n /** `paths.platform.transformation` */\r\n transformation: 'src/platform/transformation.js'\r\n} as const\r\n\r\n/**\r\n * Product index kept at the root of every line repository (ADR-011).\r\n * Format: `{ \"productos\": [{ \"name\", \"repositorio\", \"version\"? }] }`, where\r\n * `version` is the optional, retro-compatible extension ADR-011 foresaw.\r\n */\r\nexport const PRODUCTS_INDEX_PATH = 'products.json'\r\n\r\n/**\r\n * Valid characters for line and product names.\r\n * Migrated from `linea/server/src/rest/validators/commonValidators.js:NAME_PATTERN`.\r\n */\r\nexport const NAME_PATTERN = /^[a-zA-Z0-9_\\-.]+$/\r\n\r\n/**\r\n * Product version format (`x.y.z`).\r\n * Migrated from `linea/server/src/rest/validators/commonValidators.js:VERSION_PATTERN`.\r\n */\r\nexport const VERSION_PATTERN = /^\\d+\\.\\d+\\.\\d+$/\r\n\r\n/**\r\n * Default UI languages of a generated product.\r\n * Migrated from `linea/server/src/model/entities/product.js:32` and applied as a\r\n * fallback in `generatePipeline.js:218`.\r\n */\r\nexport const DEFAULT_LANGUAGES = ['en', 'es', 'gl'] as const\r\n\r\n/**\r\n * Default spatial reference system of a generated product.\r\n * Migrated from `linea/server/src/model/entities/product.js:36`.\r\n */\r\nexport const DEFAULT_SRID = '4326'\r\n\r\n/** Feature model notations supported by the engine. */\r\nexport const FEATURE_MODEL_TYPES = ['UVL', 'XML'] as const\r\n\r\n/** A feature model notation. */\r\nexport type FeatureModelType = (typeof FEATURE_MODEL_TYPES)[number]\r\n\r\n/**\r\n * Analysis guard rails, kept for parity with `linea/flamapy-server/main.py`\r\n * (`SKIP_ENUM`, `SKIP_BDD`). Full configuration enumeration and BDD construction\r\n * are exponential; above these feature counts the monolith skips them.\r\n *\r\n * Consumed by `src/analysis/`, which lands in a later batch together with the\r\n * offline-bootstrap ADR.\r\n */\r\nexport const ANALYSIS_THRESHOLDS = {\r\n /** Skip full enumeration above this feature count. */\r\n skipEnumeration: 30,\r\n /** Skip BDD-based operations above this feature count. */\r\n skipBdd: 100\r\n} as const\r\n\r\n/** Narrowing helper for values coming from outside the library. */\r\nexport const isFeatureModelType = (value: unknown): value is FeatureModelType =>\r\n typeof value === 'string' && (FEATURE_MODEL_TYPES as readonly string[]).includes(value)\r\n"]}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,IAAI,EAAE,cAAc;IACpB,IAAI,EAAE,mBAAmB;IACzB,kJAAkJ;IAClJ,KAAK,EAAE,wBAAwB;IAC/B,MAAM,EAAE,0BAA0B;IAClC,OAAO,EAAE,uBAAuB;IAChC,cAAc,EAAE,gCAAgC;CACxC,CAAA;AAEV,MAAM,CAAC,MAAM,mBAAmB,GAAG,eAAe,CAAA;AAElD,MAAM,CAAC,MAAM,YAAY,GAAG,oBAAoB,CAAA;AAEhD,MAAM,CAAC,MAAM,eAAe,GAAG,iBAAiB,CAAA;AAEhD,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAU,CAAA;AAE5D,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAA;AAElC,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,eAAe,EAAE,EAAE;IACnB,OAAO,EAAE,GAAG;CACJ,CAAA","sourcesContent":["\nexport const PLATFORM_PATHS = {\n root: 'src/platform',\n code: 'src/platform/code',\n /** Written when a product is derived (the composed feature model, as UVL): an SPL keeps its feature model as a model of the feature metamodel. */\n model: 'src/platform/model.uvl',\n config: 'src/platform/config.json',\n extraJs: 'src/platform/extra.js',\n transformation: 'src/platform/transformation.js'\n} as const\n\nexport const PRODUCTS_INDEX_PATH = 'products.json'\n\nexport const NAME_PATTERN = /^[a-zA-Z0-9_\\-.]+$/\n\nexport const VERSION_PATTERN = /^\\d+\\.\\d+\\.\\d+$/\n\nexport const DEFAULT_LANGUAGES = ['en', 'es', 'gl'] as const\n\nexport const DEFAULT_SRID = '4326'\n\nexport const ANALYSIS_THRESHOLDS = {\n skipEnumeration: 30,\n skipBdd: 100\n} as const\n"]}
@@ -1,43 +1,4 @@
1
1
  import type { ProductSpec } from '../product/spec.js';
2
- /**
3
- * Derives a product into a directory.
4
- *
5
- * The spec goes through `buildEngineSpec` first, exactly as `runEngine` does, so
6
- * a product carrying a parsed sensor DSL takes the engine's shortcut path.
7
- *
8
- * DELIBERATE DIVERGENCE 1: `runEngine` finishes with
9
- * `fs.rmSync(lineOutput, { recursive: true, force: true })`, deleting the line
10
- * directory it just consumed. linea-core deletes NOTHING. Those directories
11
- * belong to the caller — in the monolith they happen to be throwaway temp dirs,
12
- * but here `lineDir` may well be a user's working copy. Cleaning up is the
13
- * caller's decision (ADR-009/ADR-014). A test pins this.
14
- *
15
- * DELIBERATE DIVERGENCE 2, and the one that matters most for whoever ports
16
- * linea-server: `runEngine` writes
17
- * `(await engine(lineOutput)).generateProduct(...)`. It awaits the CONSTRUCTOR
18
- * — which does return a promise — but NOT the generation, which returns one
19
- * too. So in the monolith the surrounding `try/catch` cannot catch anything
20
- * thrown during generation: the `FeatureSelectionError` its very next line
21
- * means to turn into a 400 becomes an unhandled rejection instead, and the
22
- * `rmSync` above runs while generation may still be reading the directory.
23
- *
24
- * linea-core awaits (below), which fixes both. The consequence is that the
25
- * error classification here does NOT merely replicate `runEngine`'s — it is
26
- * strictly more effective, because in the monolith most of those errors never
27
- * reach the `catch` at all.
28
- *
29
- * @param params.lineDir Line working directory (holding `src/platform/...`).
30
- * @param params.spec Product spec.
31
- * @param params.outputDir Directory to generate into. Created if missing.
32
- * @returns The directory that was generated into.
33
- * @throws {FeatureSelectionInvalidError} when the spec's feature selection is
34
- * not valid for the line's feature model.
35
- * @throws {LinePlatformNotFoundError} when the line has no usable platform, or
36
- * for any other engine failure — including a template calling a helper that
37
- * `extra.js` does not define, reported with the
38
- * `error_messages.missing_function_error` key.
39
- * @throws {InvalidArgumentError} when the arguments are malformed.
40
- */
41
2
  export declare const deriveProduct: ({ lineDir, spec, outputDir }: {
42
3
  lineDir: string;
43
4
  spec: ProductSpec;
@@ -45,23 +6,6 @@ export declare const deriveProduct: ({ lineDir, spec, outputDir }: {
45
6
  }) => Promise<{
46
7
  outputDir: string;
47
8
  }>;
48
- /**
49
- * Derives a product into a zip archive, without writing the generated tree.
50
- *
51
- * Same classification of failures as `deriveProduct`, matching `generateZip`.
52
- *
53
- * RETURN TYPE: the engine hands back a JSZip instance
54
- * (`spl-js-engine/src/output.js:ZipOutput`), which the monolith's controller
55
- * turns into base64 at the HTTP edge (`ProductController.js:117`). linea-core
56
- * materialises it into a `Buffer` instead, so the result is a real artifact a
57
- * caller can write, hash or feed to `extractArchive` without knowing anything
58
- * about JSZip. linea-server gets its base64 with `buffer.toString('base64')`.
59
- *
60
- * @param params.lineDir Line working directory.
61
- * @param params.spec Product spec.
62
- * @returns The zip archive bytes.
63
- * @throws The same errors as `deriveProduct`.
64
- */
65
9
  export declare const deriveProductToZip: ({ lineDir, spec }: {
66
10
  lineDir: string;
67
11
  spec: ProductSpec;
@@ -2,18 +2,6 @@ import { InvalidArgumentError } from '../errors.js';
2
2
  import { ensureDir } from '../fs/workspace.js';
3
3
  import { buildEngineSpec } from '../product/engine-spec.js';
4
4
  import { createEngine, rethrowDerivationError } from './engine.js';
5
- /**
6
- * Hands the spec to the engine unchanged, as `runEngine` does.
7
- *
8
- * The cast is needed because linea-core's `ProductSpec.features` also admits the
9
- * legacy object-map form `{ Feature: true }`, while the engine's
10
- * `completeFeatureSelection` requires a string array.
11
- *
12
- * NOT normalised here, on purpose: the monolith passes `buildEngineSpec(spec)`
13
- * straight through, so an object-map spec fails there too. Normalising silently
14
- * would be a behaviour change hidden inside derivation. Callers holding a legacy
15
- * spec should run it through `normalizeFeatureSelection` first.
16
- */
17
5
  const toEngineSpec = (spec) => buildEngineSpec({ spec });
18
6
  const assertLineDir = (lineDir) => {
19
7
  if (typeof lineDir !== 'string' || lineDir.trim() === '') {
@@ -27,45 +15,6 @@ const assertSpec = (spec) => {
27
15
  }
28
16
  return spec;
29
17
  };
30
- /**
31
- * Derives a product into a directory.
32
- *
33
- * The spec goes through `buildEngineSpec` first, exactly as `runEngine` does, so
34
- * a product carrying a parsed sensor DSL takes the engine's shortcut path.
35
- *
36
- * DELIBERATE DIVERGENCE 1: `runEngine` finishes with
37
- * `fs.rmSync(lineOutput, { recursive: true, force: true })`, deleting the line
38
- * directory it just consumed. linea-core deletes NOTHING. Those directories
39
- * belong to the caller — in the monolith they happen to be throwaway temp dirs,
40
- * but here `lineDir` may well be a user's working copy. Cleaning up is the
41
- * caller's decision (ADR-009/ADR-014). A test pins this.
42
- *
43
- * DELIBERATE DIVERGENCE 2, and the one that matters most for whoever ports
44
- * linea-server: `runEngine` writes
45
- * `(await engine(lineOutput)).generateProduct(...)`. It awaits the CONSTRUCTOR
46
- * — which does return a promise — but NOT the generation, which returns one
47
- * too. So in the monolith the surrounding `try/catch` cannot catch anything
48
- * thrown during generation: the `FeatureSelectionError` its very next line
49
- * means to turn into a 400 becomes an unhandled rejection instead, and the
50
- * `rmSync` above runs while generation may still be reading the directory.
51
- *
52
- * linea-core awaits (below), which fixes both. The consequence is that the
53
- * error classification here does NOT merely replicate `runEngine`'s — it is
54
- * strictly more effective, because in the monolith most of those errors never
55
- * reach the `catch` at all.
56
- *
57
- * @param params.lineDir Line working directory (holding `src/platform/...`).
58
- * @param params.spec Product spec.
59
- * @param params.outputDir Directory to generate into. Created if missing.
60
- * @returns The directory that was generated into.
61
- * @throws {FeatureSelectionInvalidError} when the spec's feature selection is
62
- * not valid for the line's feature model.
63
- * @throws {LinePlatformNotFoundError} when the line has no usable platform, or
64
- * for any other engine failure — including a template calling a helper that
65
- * `extra.js` does not define, reported with the
66
- * `error_messages.missing_function_error` key.
67
- * @throws {InvalidArgumentError} when the arguments are malformed.
68
- */
69
18
  export const deriveProduct = async ({ lineDir, spec, outputDir }) => {
70
19
  assertLineDir(lineDir);
71
20
  const checkedSpec = assertSpec(spec);
@@ -73,43 +22,43 @@ export const deriveProduct = async ({ lineDir, spec, outputDir }) => {
73
22
  throw new InvalidArgumentError('"outputDir" must be a non-empty path.');
74
23
  }
75
24
  const target = ensureDir({ dirPath: outputDir });
25
+ let stage = 'setup';
76
26
  try {
77
27
  const engine = await createEngine(lineDir);
28
+ stage = 'generate';
78
29
  await engine.generateProduct(target, toEngineSpec(checkedSpec));
79
30
  }
80
31
  catch (error) {
81
- rethrowDerivationError(error);
32
+ rethrowDerivationError(error, stage);
82
33
  }
83
34
  return { outputDir: target };
84
35
  };
85
- /**
86
- * Derives a product into a zip archive, without writing the generated tree.
87
- *
88
- * Same classification of failures as `deriveProduct`, matching `generateZip`.
89
- *
90
- * RETURN TYPE: the engine hands back a JSZip instance
91
- * (`spl-js-engine/src/output.js:ZipOutput`), which the monolith's controller
92
- * turns into base64 at the HTTP edge (`ProductController.js:117`). linea-core
93
- * materialises it into a `Buffer` instead, so the result is a real artifact a
94
- * caller can write, hash or feed to `extractArchive` without knowing anything
95
- * about JSZip. linea-server gets its base64 with `buffer.toString('base64')`.
96
- *
97
- * @param params.lineDir Line working directory.
98
- * @param params.spec Product spec.
99
- * @returns The zip archive bytes.
100
- * @throws The same errors as `deriveProduct`.
101
- */
36
+ const withPortableNames = (archive) => {
37
+ for (const name of Object.keys(archive.files)) {
38
+ if (!name.includes('\\'))
39
+ continue;
40
+ const portable = name.replace(/\\/g, '/');
41
+ const entry = archive.files[name];
42
+ delete archive.files[name];
43
+ if (entry === undefined || (entry.dir && portable in archive.files))
44
+ continue;
45
+ entry.name = portable;
46
+ archive.files[portable] = entry;
47
+ }
48
+ return archive;
49
+ };
102
50
  export const deriveProductToZip = async ({ lineDir, spec }) => {
103
51
  assertLineDir(lineDir);
104
52
  const checkedSpec = assertSpec(spec);
53
+ let stage = 'setup';
105
54
  try {
106
55
  const engine = await createEngine(lineDir);
56
+ stage = 'generate';
107
57
  const zip = await engine.generateZip(toEngineSpec(checkedSpec));
108
- const archive = zip;
109
- return await archive.generateAsync({ type: 'nodebuffer' });
58
+ return await withPortableNames(zip).generateAsync({ type: 'nodebuffer' });
110
59
  }
111
60
  catch (error) {
112
- return rethrowDerivationError(error);
61
+ return rethrowDerivationError(error, stage);
113
62
  }
114
63
  };
115
64
  //# sourceMappingURL=derive.js.map