@lbdudc/linea-core 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +358 -358
- package/dist/analysis/analyze.js.map +1 -1
- package/dist/analysis/runtime.js.map +1 -1
- package/dist/assets.js.map +1 -1
- package/dist/constants.js.map +1 -1
- package/dist/derivation/derive.js.map +1 -1
- package/dist/derivation/engine.js.map +1 -1
- package/dist/errors.js.map +1 -1
- package/dist/feature-model/convert.js.map +1 -1
- package/dist/feature-model/engine.js.map +1 -1
- package/dist/feature-model/inspect.js.map +1 -1
- package/dist/feature-model/io.js.map +1 -1
- package/dist/feature-model/parse.js.map +1 -1
- package/dist/feature-model/text.js.map +1 -1
- package/dist/fs/archive.js.map +1 -1
- package/dist/fs/diff.js.map +1 -1
- package/dist/fs/format.js.map +1 -1
- package/dist/fs/workspace.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/internal/guards.js.map +1 -1
- package/dist/line/platform-files.js.map +1 -1
- package/dist/line/scaffold.js.map +1 -1
- package/dist/line/templates/core/extra.js +54 -54
- package/dist/line/templates/core/transformation.js +196 -196
- package/dist/line/templates/metamodels/dataModel/extra.js +328 -328
- package/dist/line/templates/metamodels/dataModel/transformation.js +211 -211
- package/dist/line/templates/metamodels/sensor/extra.js +36 -36
- package/dist/line/templates/metamodels/sensor/transformation.js +47 -47
- package/dist/line/templates/pipeline/.gitlab-ci.yml +51 -51
- package/dist/line/templates/pipeline/ci/test-client.sh +16 -16
- package/dist/line/templates/pipeline/ci/test-server.sh +16 -16
- package/dist/product/engine-spec.js.map +1 -1
- package/dist/product/spec.js.map +1 -1
- package/dist/product/version.js.map +1 -1
- package/dist/products-index/products-index.js.map +1 -1
- package/dist/selection/selection.js.map +1 -1
- package/package.json +67 -67
|
@@ -1,196 +1,196 @@
|
|
|
1
|
-
module.exports = modelTransformation;
|
|
2
|
-
|
|
3
|
-
var _metamodelProcessors = [];
|
|
4
|
-
|
|
5
|
-
function registerMetamodelProcessor(fn) {
|
|
6
|
-
_metamodelProcessors.push(fn);
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
function modelTransformation(input) {
|
|
10
|
-
if (input.data && input.data.basicData) return input;
|
|
11
|
-
|
|
12
|
-
let ret = {};
|
|
13
|
-
ret.features = input.features;
|
|
14
|
-
ret.data = {};
|
|
15
|
-
ret.data.basicData = basicData(input.basicData);
|
|
16
|
-
|
|
17
|
-
_metamodelProcessors.forEach(function(processor) {
|
|
18
|
-
processor(ret, input);
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
ret.data.gui = gui(ret.features, input.basicData.name);
|
|
22
|
-
ret.data.menus = menus(ret);
|
|
23
|
-
ret.data.statics = statics(input.statics);
|
|
24
|
-
return ret;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function normalize(str, upper) {
|
|
28
|
-
return str
|
|
29
|
-
.normalize("NFKD")
|
|
30
|
-
.replace(/[\u0300-\u036F]/g, "")
|
|
31
|
-
.replace(/[-_]+/g, " ")
|
|
32
|
-
.replace(/[^\w\s]/gi, "")
|
|
33
|
-
.replace(/\s(.)/g, function ($1) {
|
|
34
|
-
return $1.toUpperCase();
|
|
35
|
-
})
|
|
36
|
-
.replace(/\s/g, "")
|
|
37
|
-
.replace(/^(.)/, function ($1) {
|
|
38
|
-
return upper ? $1.toUpperCase() : $1.toLowerCase();
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
function basicData(input) {
|
|
43
|
-
return {
|
|
44
|
-
index: {
|
|
45
|
-
component: "STATIC",
|
|
46
|
-
view: "welcome",
|
|
47
|
-
},
|
|
48
|
-
languages: input.languages || [],
|
|
49
|
-
name: input.name,
|
|
50
|
-
packageInfo: {
|
|
51
|
-
artifact: normalize(input.name).toLowerCase(),
|
|
52
|
-
group: input.packageGroup || "com.example",
|
|
53
|
-
},
|
|
54
|
-
database: input.database,
|
|
55
|
-
extra: input.extra,
|
|
56
|
-
SRID: input.SRID,
|
|
57
|
-
version: input.version,
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
function gui(features, name) {
|
|
62
|
-
const ret = {
|
|
63
|
-
settings: {
|
|
64
|
-
font: { family: "Arial", size: "14px" },
|
|
65
|
-
colorset: ["#fff", "#eee", "#777", "#555", "#577492", "#333", "#222"],
|
|
66
|
-
header: { type: "Text", text: name },
|
|
67
|
-
},
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
if (features.indexOf("GUI_M_Top") !== -1) {
|
|
71
|
-
ret.design = "1";
|
|
72
|
-
} else if (features.indexOf("GUI_M_Left") !== -1) {
|
|
73
|
-
ret.design = "5";
|
|
74
|
-
} else if (features.indexOf("GUI_M_Right") !== -1) {
|
|
75
|
-
ret.design = "6";
|
|
76
|
-
} else {
|
|
77
|
-
ret.design = "4";
|
|
78
|
-
}
|
|
79
|
-
if (features.indexOf("GUI_M_Top") !== -1 && features.indexOf("GUI_M_Left") !== -1) {
|
|
80
|
-
ret.design = "2";
|
|
81
|
-
}
|
|
82
|
-
if (features.indexOf("GUI_M_Top") !== -1 && features.indexOf("GUI_M_Right") !== -1) {
|
|
83
|
-
ret.design = "3";
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
return ret;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
function statics(input) {
|
|
90
|
-
return input;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
function menus(product) {
|
|
94
|
-
const ret = [];
|
|
95
|
-
|
|
96
|
-
switch (product.data.gui.design) {
|
|
97
|
-
case "1": ret.push({ id: "top", elements: [] }); break;
|
|
98
|
-
case "2": ret.push({ id: "top", elements: [] }); ret.push({ id: "left", elements: [] }); break;
|
|
99
|
-
case "3": ret.push({ id: "top", elements: [] }); ret.push({ id: "right", elements: [] }); break;
|
|
100
|
-
case "4": return [];
|
|
101
|
-
case "5": ret.push({ id: "left", elements: [] }); break;
|
|
102
|
-
case "6": ret.push({ id: "right", elements: [] }); break;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
if (product.data.lists && product.features.indexOf("GUI_Lists") !== -1) {
|
|
106
|
-
ret[0].elements.push(listMenu(product.data.lists));
|
|
107
|
-
}
|
|
108
|
-
ret[0].elements.push(listComponents(product.features));
|
|
109
|
-
|
|
110
|
-
if (product.features.indexOf("UserManagement") !== -1) {
|
|
111
|
-
ret[0].elements.push(listUserManagement(product.features));
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
return ret;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
function listMenu(lists) {
|
|
118
|
-
return {
|
|
119
|
-
id: "Lists",
|
|
120
|
-
type: "MENU",
|
|
121
|
-
elements: lists.map((l) => ({
|
|
122
|
-
id: l.id,
|
|
123
|
-
type: "VIEW",
|
|
124
|
-
view: { component: "LIST", view: l.id },
|
|
125
|
-
})),
|
|
126
|
-
access: { admin: true, logged: true },
|
|
127
|
-
};
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
function listComponents(features) {
|
|
131
|
-
return {
|
|
132
|
-
id: "Components",
|
|
133
|
-
type: "MENU",
|
|
134
|
-
elements: features
|
|
135
|
-
.filter((f) => featureMenu(f, features))
|
|
136
|
-
.map((f) => featureMenu(f, features)),
|
|
137
|
-
access: { admin: true, logged: true },
|
|
138
|
-
};
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
function featureMenu(feature, features) {
|
|
142
|
-
// Add cases for your platform's features here
|
|
143
|
-
// Example: case "MY_FEATURE": return view("MY_COMPONENT", "My View");
|
|
144
|
-
return null;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
function listUserManagement(features) {
|
|
148
|
-
const list = [];
|
|
149
|
-
let aux;
|
|
150
|
-
|
|
151
|
-
if (features.indexOf("UM_Authentication") !== -1) {
|
|
152
|
-
aux = view("USER_MANAGEMENT", "Sign in");
|
|
153
|
-
aux.access = { anonymous: true };
|
|
154
|
-
list.push(aux);
|
|
155
|
-
}
|
|
156
|
-
if (features.indexOf("UM_R_Anonymous") !== -1) {
|
|
157
|
-
aux = view("USER_MANAGEMENT", "Registration");
|
|
158
|
-
aux.access = { anonymous: true };
|
|
159
|
-
list.push(aux);
|
|
160
|
-
}
|
|
161
|
-
if (features.indexOf("UM_UP_ByUser") !== -1) {
|
|
162
|
-
aux = view("USER_MANAGEMENT", "Change password");
|
|
163
|
-
aux.access = { admin: true, logged: true };
|
|
164
|
-
list.push(aux);
|
|
165
|
-
}
|
|
166
|
-
if (features.indexOf("UM_UserProfile") !== -1) {
|
|
167
|
-
aux = view("USER_MANAGEMENT", "Profile details");
|
|
168
|
-
aux.access = { admin: true, logged: true };
|
|
169
|
-
list.push(aux);
|
|
170
|
-
}
|
|
171
|
-
if (features.indexOf("UM_UserSessions") !== -1) {
|
|
172
|
-
aux = view("USER_MANAGEMENT", "Sessions");
|
|
173
|
-
aux.access = { admin: true, logged: true };
|
|
174
|
-
list.push(aux);
|
|
175
|
-
}
|
|
176
|
-
if (features.indexOf("UM_UserCRUD") !== -1) {
|
|
177
|
-
aux = view("USER_MANAGEMENT", "User Management");
|
|
178
|
-
aux.access = { admin: true };
|
|
179
|
-
list.push(aux);
|
|
180
|
-
}
|
|
181
|
-
if (features.indexOf("UM_Authentication") !== -1) {
|
|
182
|
-
aux = view("USER_MANAGEMENT", "Exit");
|
|
183
|
-
aux.access = { admin: true, logged: true };
|
|
184
|
-
list.push(aux);
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
return { id: "Account", type: "MENU", elements: list };
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
function view(comp, view) {
|
|
191
|
-
return {
|
|
192
|
-
id: view,
|
|
193
|
-
type: "VIEW",
|
|
194
|
-
view: { component: comp, view: view },
|
|
195
|
-
};
|
|
196
|
-
}
|
|
1
|
+
module.exports = modelTransformation;
|
|
2
|
+
|
|
3
|
+
var _metamodelProcessors = [];
|
|
4
|
+
|
|
5
|
+
function registerMetamodelProcessor(fn) {
|
|
6
|
+
_metamodelProcessors.push(fn);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
function modelTransformation(input) {
|
|
10
|
+
if (input.data && input.data.basicData) return input;
|
|
11
|
+
|
|
12
|
+
let ret = {};
|
|
13
|
+
ret.features = input.features;
|
|
14
|
+
ret.data = {};
|
|
15
|
+
ret.data.basicData = basicData(input.basicData);
|
|
16
|
+
|
|
17
|
+
_metamodelProcessors.forEach(function(processor) {
|
|
18
|
+
processor(ret, input);
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
ret.data.gui = gui(ret.features, input.basicData.name);
|
|
22
|
+
ret.data.menus = menus(ret);
|
|
23
|
+
ret.data.statics = statics(input.statics);
|
|
24
|
+
return ret;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function normalize(str, upper) {
|
|
28
|
+
return str
|
|
29
|
+
.normalize("NFKD")
|
|
30
|
+
.replace(/[\u0300-\u036F]/g, "")
|
|
31
|
+
.replace(/[-_]+/g, " ")
|
|
32
|
+
.replace(/[^\w\s]/gi, "")
|
|
33
|
+
.replace(/\s(.)/g, function ($1) {
|
|
34
|
+
return $1.toUpperCase();
|
|
35
|
+
})
|
|
36
|
+
.replace(/\s/g, "")
|
|
37
|
+
.replace(/^(.)/, function ($1) {
|
|
38
|
+
return upper ? $1.toUpperCase() : $1.toLowerCase();
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function basicData(input) {
|
|
43
|
+
return {
|
|
44
|
+
index: {
|
|
45
|
+
component: "STATIC",
|
|
46
|
+
view: "welcome",
|
|
47
|
+
},
|
|
48
|
+
languages: input.languages || [],
|
|
49
|
+
name: input.name,
|
|
50
|
+
packageInfo: {
|
|
51
|
+
artifact: normalize(input.name).toLowerCase(),
|
|
52
|
+
group: input.packageGroup || "com.example",
|
|
53
|
+
},
|
|
54
|
+
database: input.database,
|
|
55
|
+
extra: input.extra,
|
|
56
|
+
SRID: input.SRID,
|
|
57
|
+
version: input.version,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function gui(features, name) {
|
|
62
|
+
const ret = {
|
|
63
|
+
settings: {
|
|
64
|
+
font: { family: "Arial", size: "14px" },
|
|
65
|
+
colorset: ["#fff", "#eee", "#777", "#555", "#577492", "#333", "#222"],
|
|
66
|
+
header: { type: "Text", text: name },
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
if (features.indexOf("GUI_M_Top") !== -1) {
|
|
71
|
+
ret.design = "1";
|
|
72
|
+
} else if (features.indexOf("GUI_M_Left") !== -1) {
|
|
73
|
+
ret.design = "5";
|
|
74
|
+
} else if (features.indexOf("GUI_M_Right") !== -1) {
|
|
75
|
+
ret.design = "6";
|
|
76
|
+
} else {
|
|
77
|
+
ret.design = "4";
|
|
78
|
+
}
|
|
79
|
+
if (features.indexOf("GUI_M_Top") !== -1 && features.indexOf("GUI_M_Left") !== -1) {
|
|
80
|
+
ret.design = "2";
|
|
81
|
+
}
|
|
82
|
+
if (features.indexOf("GUI_M_Top") !== -1 && features.indexOf("GUI_M_Right") !== -1) {
|
|
83
|
+
ret.design = "3";
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return ret;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function statics(input) {
|
|
90
|
+
return input;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function menus(product) {
|
|
94
|
+
const ret = [];
|
|
95
|
+
|
|
96
|
+
switch (product.data.gui.design) {
|
|
97
|
+
case "1": ret.push({ id: "top", elements: [] }); break;
|
|
98
|
+
case "2": ret.push({ id: "top", elements: [] }); ret.push({ id: "left", elements: [] }); break;
|
|
99
|
+
case "3": ret.push({ id: "top", elements: [] }); ret.push({ id: "right", elements: [] }); break;
|
|
100
|
+
case "4": return [];
|
|
101
|
+
case "5": ret.push({ id: "left", elements: [] }); break;
|
|
102
|
+
case "6": ret.push({ id: "right", elements: [] }); break;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if (product.data.lists && product.features.indexOf("GUI_Lists") !== -1) {
|
|
106
|
+
ret[0].elements.push(listMenu(product.data.lists));
|
|
107
|
+
}
|
|
108
|
+
ret[0].elements.push(listComponents(product.features));
|
|
109
|
+
|
|
110
|
+
if (product.features.indexOf("UserManagement") !== -1) {
|
|
111
|
+
ret[0].elements.push(listUserManagement(product.features));
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return ret;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function listMenu(lists) {
|
|
118
|
+
return {
|
|
119
|
+
id: "Lists",
|
|
120
|
+
type: "MENU",
|
|
121
|
+
elements: lists.map((l) => ({
|
|
122
|
+
id: l.id,
|
|
123
|
+
type: "VIEW",
|
|
124
|
+
view: { component: "LIST", view: l.id },
|
|
125
|
+
})),
|
|
126
|
+
access: { admin: true, logged: true },
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
function listComponents(features) {
|
|
131
|
+
return {
|
|
132
|
+
id: "Components",
|
|
133
|
+
type: "MENU",
|
|
134
|
+
elements: features
|
|
135
|
+
.filter((f) => featureMenu(f, features))
|
|
136
|
+
.map((f) => featureMenu(f, features)),
|
|
137
|
+
access: { admin: true, logged: true },
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function featureMenu(feature, features) {
|
|
142
|
+
// Add cases for your platform's features here
|
|
143
|
+
// Example: case "MY_FEATURE": return view("MY_COMPONENT", "My View");
|
|
144
|
+
return null;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
function listUserManagement(features) {
|
|
148
|
+
const list = [];
|
|
149
|
+
let aux;
|
|
150
|
+
|
|
151
|
+
if (features.indexOf("UM_Authentication") !== -1) {
|
|
152
|
+
aux = view("USER_MANAGEMENT", "Sign in");
|
|
153
|
+
aux.access = { anonymous: true };
|
|
154
|
+
list.push(aux);
|
|
155
|
+
}
|
|
156
|
+
if (features.indexOf("UM_R_Anonymous") !== -1) {
|
|
157
|
+
aux = view("USER_MANAGEMENT", "Registration");
|
|
158
|
+
aux.access = { anonymous: true };
|
|
159
|
+
list.push(aux);
|
|
160
|
+
}
|
|
161
|
+
if (features.indexOf("UM_UP_ByUser") !== -1) {
|
|
162
|
+
aux = view("USER_MANAGEMENT", "Change password");
|
|
163
|
+
aux.access = { admin: true, logged: true };
|
|
164
|
+
list.push(aux);
|
|
165
|
+
}
|
|
166
|
+
if (features.indexOf("UM_UserProfile") !== -1) {
|
|
167
|
+
aux = view("USER_MANAGEMENT", "Profile details");
|
|
168
|
+
aux.access = { admin: true, logged: true };
|
|
169
|
+
list.push(aux);
|
|
170
|
+
}
|
|
171
|
+
if (features.indexOf("UM_UserSessions") !== -1) {
|
|
172
|
+
aux = view("USER_MANAGEMENT", "Sessions");
|
|
173
|
+
aux.access = { admin: true, logged: true };
|
|
174
|
+
list.push(aux);
|
|
175
|
+
}
|
|
176
|
+
if (features.indexOf("UM_UserCRUD") !== -1) {
|
|
177
|
+
aux = view("USER_MANAGEMENT", "User Management");
|
|
178
|
+
aux.access = { admin: true };
|
|
179
|
+
list.push(aux);
|
|
180
|
+
}
|
|
181
|
+
if (features.indexOf("UM_Authentication") !== -1) {
|
|
182
|
+
aux = view("USER_MANAGEMENT", "Exit");
|
|
183
|
+
aux.access = { admin: true, logged: true };
|
|
184
|
+
list.push(aux);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
return { id: "Account", type: "MENU", elements: list };
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
function view(comp, view) {
|
|
191
|
+
return {
|
|
192
|
+
id: view,
|
|
193
|
+
type: "VIEW",
|
|
194
|
+
view: { component: comp, view: view },
|
|
195
|
+
};
|
|
196
|
+
}
|