@primmel/primmel 1.3.0 → 1.3.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.
- package/dist/src/ser-des/config/process.d.ts +1 -0
- package/dist/src/ser-des/config/process.d.ts.map +1 -1
- package/dist/src/ser-des/config/process.js +58 -1
- package/dist/src/ser-des/config/process.js.map +1 -1
- package/dist/src/ser-des/dump.d.ts +5 -1
- package/dist/src/ser-des/dump.d.ts.map +1 -1
- package/dist/src/ser-des/dump.js +21 -1
- package/dist/src/ser-des/dump.js.map +1 -1
- package/dist/src/ser-des/includes.js +7 -10
- package/dist/src/ser-des/includes.js.map +1 -1
- package/dist/src/types/process.d.ts +1 -0
- package/dist/src/types/process.d.ts.map +1 -1
- package/dist-browser/index.mjs +1981 -0
- package/package.json +5 -4
|
@@ -0,0 +1,1981 @@
|
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var e = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports);
|
|
3
|
+
//#endregion
|
|
4
|
+
//#region src/ser-des/tokenize.ts
|
|
5
|
+
function t(e) {
|
|
6
|
+
let t = [], n = 1, r = 1, i = 0, a = 0, o = (t) => {
|
|
7
|
+
for (let o = 0; o < t; o++) e.charAt(i) === "\n" ? (n++, r = 1) : r++, i++, a++;
|
|
8
|
+
};
|
|
9
|
+
for (; a < e.length;) {
|
|
10
|
+
let c = e.charAt(a);
|
|
11
|
+
if (c === "#" || c === "/" && a + 1 < e.length && e.charAt(a + 1) === "/") {
|
|
12
|
+
for (; a < e.length && e.charAt(a) !== "\n";) o(1);
|
|
13
|
+
continue;
|
|
14
|
+
}
|
|
15
|
+
if (s(c)) {
|
|
16
|
+
o(1);
|
|
17
|
+
continue;
|
|
18
|
+
}
|
|
19
|
+
let l = n, u = r, d = i, f = "";
|
|
20
|
+
if (c === "\"") for (f += c, o(1); a < e.length;) {
|
|
21
|
+
let t = e.charAt(a);
|
|
22
|
+
if (t === "\\" && a + 1 < e.length) {
|
|
23
|
+
f += t + e.charAt(a + 1), o(2);
|
|
24
|
+
continue;
|
|
25
|
+
}
|
|
26
|
+
if (f += t, o(1), t === "\"") break;
|
|
27
|
+
}
|
|
28
|
+
else if (c === "{") {
|
|
29
|
+
let t = 1;
|
|
30
|
+
for (f += c, o(1); a < e.length && t > 0;) {
|
|
31
|
+
let n = e.charAt(a);
|
|
32
|
+
if (n === "\"") {
|
|
33
|
+
for (f += n, o(1); a < e.length;) {
|
|
34
|
+
let t = e.charAt(a);
|
|
35
|
+
if (t === "\\" && a + 1 < e.length) {
|
|
36
|
+
f += t + e.charAt(a + 1), o(2);
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
if (f += t, o(1), t === "\"") break;
|
|
40
|
+
}
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
n === "{" && t++, n === "}" && t--, f += n, o(1);
|
|
44
|
+
}
|
|
45
|
+
} else for (; a < e.length && !s(e.charAt(a));) f += e.charAt(a), o(1);
|
|
46
|
+
t.push({
|
|
47
|
+
value: f,
|
|
48
|
+
start: {
|
|
49
|
+
line: l,
|
|
50
|
+
col: u,
|
|
51
|
+
offset: d
|
|
52
|
+
},
|
|
53
|
+
end: {
|
|
54
|
+
line: n,
|
|
55
|
+
col: r,
|
|
56
|
+
offset: i
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
return t;
|
|
61
|
+
}
|
|
62
|
+
function n(e) {
|
|
63
|
+
return t(e).map((e) => e.value);
|
|
64
|
+
}
|
|
65
|
+
function r(e) {
|
|
66
|
+
return n(i(e));
|
|
67
|
+
}
|
|
68
|
+
function i(e) {
|
|
69
|
+
return e.length >= 2 ? e.substr(1, e.length - 2) : e;
|
|
70
|
+
}
|
|
71
|
+
function a(e) {
|
|
72
|
+
if (e.length < 2) return e;
|
|
73
|
+
let t = e.charAt(0), n = e.charAt(e.length - 1);
|
|
74
|
+
return t === "\"" && n === "\"" || t === "{" && n === "}" ? e.substr(1, e.length - 2) : e;
|
|
75
|
+
}
|
|
76
|
+
function o(e) {
|
|
77
|
+
return e.replace(/\\/g, "\\\\").replace(/"/g, "\\\"");
|
|
78
|
+
}
|
|
79
|
+
function s(e) {
|
|
80
|
+
return /\s/.test(e);
|
|
81
|
+
}
|
|
82
|
+
//#endregion
|
|
83
|
+
//#region src/duplicate-id.ts
|
|
84
|
+
function c() {
|
|
85
|
+
let e = /* @__PURE__ */ new Map();
|
|
86
|
+
return { check(t, n, r, i) {
|
|
87
|
+
let a = e.get(t);
|
|
88
|
+
a || (a = /* @__PURE__ */ new Map(), e.set(t, a));
|
|
89
|
+
let o = a.get(r);
|
|
90
|
+
if (o) return {
|
|
91
|
+
severity: "error",
|
|
92
|
+
code: "duplicate-id",
|
|
93
|
+
construct: String(t),
|
|
94
|
+
id: r,
|
|
95
|
+
message: `Duplicate ${n} id "${r}" (first declared at line ${o.line} col ${o.col}) — earlier declaration overwritten`,
|
|
96
|
+
position: { ...i }
|
|
97
|
+
};
|
|
98
|
+
a.set(r, i);
|
|
99
|
+
} };
|
|
100
|
+
}
|
|
101
|
+
//#endregion
|
|
102
|
+
//#region src/ser-des/parse.ts
|
|
103
|
+
function l(e, n, r = {}) {
|
|
104
|
+
let i = t(e), a = c(), o = {
|
|
105
|
+
root: "",
|
|
106
|
+
metadata: null,
|
|
107
|
+
approvals: {},
|
|
108
|
+
roles: {},
|
|
109
|
+
processes: {},
|
|
110
|
+
pages: {},
|
|
111
|
+
gateways: {},
|
|
112
|
+
regs: {},
|
|
113
|
+
references: {},
|
|
114
|
+
provisions: {},
|
|
115
|
+
dataclasses: {},
|
|
116
|
+
events: {},
|
|
117
|
+
enums: {},
|
|
118
|
+
variables: {},
|
|
119
|
+
notes: {},
|
|
120
|
+
tables: {},
|
|
121
|
+
figures: {},
|
|
122
|
+
links: {},
|
|
123
|
+
mapProfiles: {},
|
|
124
|
+
viewProfiles: {},
|
|
125
|
+
terms: {},
|
|
126
|
+
forms: {},
|
|
127
|
+
subforms: {},
|
|
128
|
+
symbols: {},
|
|
129
|
+
calculations: {},
|
|
130
|
+
stateMachines: {},
|
|
131
|
+
issues: []
|
|
132
|
+
}, s = 0;
|
|
133
|
+
for (; s < i.length;) {
|
|
134
|
+
let e = i[s++], t = e.value, c = n[t];
|
|
135
|
+
if (!c) {
|
|
136
|
+
if (r.strict) throw Error(`Unknown keyword "${t}" at line ${e.start.line} col ${e.start.col}. Use lenient mode (default) to skip unknown keywords.`);
|
|
137
|
+
continue;
|
|
138
|
+
}
|
|
139
|
+
let l;
|
|
140
|
+
if (c.takesID) {
|
|
141
|
+
if (s + 1 > i.length) throw Error(`Keyword "${t}" at line ${e.start.line} col ${e.start.col} expects an ID and payload, but only ${i.length - s + 1} token(s) remain.`);
|
|
142
|
+
let n = i[s++], r = i[s++];
|
|
143
|
+
if (c.field) {
|
|
144
|
+
let e = a.check(c.field, t, n.value, n.start);
|
|
145
|
+
e && o.issues.push(e);
|
|
146
|
+
}
|
|
147
|
+
l = c.parse(n.value, r.value);
|
|
148
|
+
} else {
|
|
149
|
+
if (s >= i.length) throw Error(`Keyword "${t}" at line ${e.start.line} col ${e.start.col} expects a payload, but no tokens remain.`);
|
|
150
|
+
let n = i[s++];
|
|
151
|
+
l = c.parse(n.value);
|
|
152
|
+
}
|
|
153
|
+
let u = l(o);
|
|
154
|
+
u !== o && (u.issues = o.issues), o = u;
|
|
155
|
+
}
|
|
156
|
+
return o;
|
|
157
|
+
}
|
|
158
|
+
//#endregion
|
|
159
|
+
//#region src/ser-des/resolve.ts
|
|
160
|
+
var u = {
|
|
161
|
+
schema: "",
|
|
162
|
+
author: "",
|
|
163
|
+
title: "",
|
|
164
|
+
edition: "",
|
|
165
|
+
namespace: "",
|
|
166
|
+
shortname: ""
|
|
167
|
+
};
|
|
168
|
+
function d(e, t, n) {
|
|
169
|
+
let r = e[t];
|
|
170
|
+
if (r == null) return;
|
|
171
|
+
let i = r[n];
|
|
172
|
+
if (i !== void 0) {
|
|
173
|
+
if (i._relations) {
|
|
174
|
+
let e = { ...i };
|
|
175
|
+
return delete e._relations, e;
|
|
176
|
+
}
|
|
177
|
+
return i;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
function f(e, t) {
|
|
181
|
+
let n = {
|
|
182
|
+
meta: e.metadata ?? u,
|
|
183
|
+
root: null
|
|
184
|
+
};
|
|
185
|
+
for (let r of Object.keys(t)) {
|
|
186
|
+
let i = t[r];
|
|
187
|
+
if (!i) continue;
|
|
188
|
+
let a = e[r];
|
|
189
|
+
if (!a) continue;
|
|
190
|
+
let o = [];
|
|
191
|
+
for (let [, t] of Object.entries(a)) {
|
|
192
|
+
let n = i.resolve(e, t);
|
|
193
|
+
n !== void 0 && (delete n._relations, o.push(n));
|
|
194
|
+
}
|
|
195
|
+
n[r] = o;
|
|
196
|
+
}
|
|
197
|
+
return e.root && (n.root = e.pages[e.root] ?? null), n;
|
|
198
|
+
}
|
|
199
|
+
//#endregion
|
|
200
|
+
//#region src/ser-des/config/metadata.ts
|
|
201
|
+
var p = function(e) {
|
|
202
|
+
let t = {
|
|
203
|
+
schema: "",
|
|
204
|
+
author: "",
|
|
205
|
+
title: "",
|
|
206
|
+
edition: "",
|
|
207
|
+
namespace: "",
|
|
208
|
+
shortname: ""
|
|
209
|
+
};
|
|
210
|
+
if (e !== "") {
|
|
211
|
+
let n = r(e), a = 0;
|
|
212
|
+
for (; a < n.length;) {
|
|
213
|
+
let e = n[a++];
|
|
214
|
+
if (a < n.length) if (e === "title") t.title = i(n[a++]);
|
|
215
|
+
else if (e === "schema") t.schema = i(n[a++]);
|
|
216
|
+
else if (e === "edition") t.edition = i(n[a++]);
|
|
217
|
+
else if (e === "author") t.author = i(n[a++]);
|
|
218
|
+
else if (e === "namespace") t.namespace = i(n[a++]);
|
|
219
|
+
else if (e === "shortname") t.shortname = i(n[a++]);
|
|
220
|
+
else throw Error("Parsing error: metadata. Unknown keyword " + e);
|
|
221
|
+
else throw Error("Parsing error: metadata. Expecting value for " + e);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
return (e) => (e.metadata = t, e);
|
|
225
|
+
}, ee = function(e) {
|
|
226
|
+
let t = "metadata {\n";
|
|
227
|
+
return t += " title \"" + o(e.title) + "\"\n", t += " schema \"" + o(e.schema) + "\"\n", t += " edition \"" + o(e.edition) + "\"\n", t += " author \"" + o(e.author) + "\"\n", t += " namespace \"" + o(e.namespace) + "\"\n", t += "}\n", t;
|
|
228
|
+
};
|
|
229
|
+
//#endregion
|
|
230
|
+
//#region src/ser-des/parse-block.ts
|
|
231
|
+
function m(e, t, n) {
|
|
232
|
+
if (e === "") return;
|
|
233
|
+
let i = r(e), a = 0;
|
|
234
|
+
for (; a < i.length;) {
|
|
235
|
+
let e = i[a++];
|
|
236
|
+
if (a >= i.length) throw Error(`Parsing error: ${n.construct}. ID ${n.id}: Expecting value for ${e}`);
|
|
237
|
+
t(e, () => i[a++]) || a++;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
function te(e, t, n) {
|
|
241
|
+
if (e === "") return;
|
|
242
|
+
let a = r(e), o = 0;
|
|
243
|
+
for (; o < a.length;) {
|
|
244
|
+
let e = [];
|
|
245
|
+
for (; o < a.length && a[o].charAt(0) !== "{";) e.push(a[o++]);
|
|
246
|
+
if (e.length === 0) throw Error(`Parsing error: ${n.construct}. ID ${n.id}: Attribute is missing its name`);
|
|
247
|
+
if (o >= a.length) throw Error(`Parsing error: ${n.construct}. ID ${n.id}: Expecting { after ${e.join(" ")}`);
|
|
248
|
+
let r = a[o++];
|
|
249
|
+
t(e.join(" "), i(r));
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
function h(e) {
|
|
253
|
+
return i(e());
|
|
254
|
+
}
|
|
255
|
+
//#endregion
|
|
256
|
+
//#region src/ser-des/config/process.ts
|
|
257
|
+
var g = function(e, t) {
|
|
258
|
+
let n = {
|
|
259
|
+
id: e,
|
|
260
|
+
name: "",
|
|
261
|
+
modality: "",
|
|
262
|
+
actor: null,
|
|
263
|
+
output: [],
|
|
264
|
+
input: [],
|
|
265
|
+
provision: [],
|
|
266
|
+
page: null,
|
|
267
|
+
measure: [],
|
|
268
|
+
parent: "",
|
|
269
|
+
children: [],
|
|
270
|
+
_relations: {
|
|
271
|
+
actor: "",
|
|
272
|
+
output: [],
|
|
273
|
+
input: [],
|
|
274
|
+
provision: [],
|
|
275
|
+
page: ""
|
|
276
|
+
}
|
|
277
|
+
}, a = [];
|
|
278
|
+
if (t.trim() !== "") {
|
|
279
|
+
let i = r(t), o = [], s = 0;
|
|
280
|
+
for (; s < i.length;) if (i[s] === "process" && s + 2 < i.length && i[s + 2].startsWith("{")) {
|
|
281
|
+
let t = i[s + 1], r = i[s + 2], o = g(t, r);
|
|
282
|
+
a.push((n) => {
|
|
283
|
+
n = o(n);
|
|
284
|
+
let r = n.processes[t];
|
|
285
|
+
return r && (r.parent = e), n;
|
|
286
|
+
}), n.children.push(t), s += 3;
|
|
287
|
+
} else o.push(i[s]), s++;
|
|
288
|
+
t = "{ " + o.join(" ") + " }";
|
|
289
|
+
}
|
|
290
|
+
return m(t, (e, t) => {
|
|
291
|
+
if (e === "modality") n.modality = t();
|
|
292
|
+
else if (e === "name") n.name = h(t);
|
|
293
|
+
else if (e === "actor") n._relations.actor = t();
|
|
294
|
+
else if (e === "parent") n.parent = t();
|
|
295
|
+
else if (e === "canvas" || e === "subprocess") n._relations.page = t();
|
|
296
|
+
else if (e === "validate_provision") n._relations.provision = r(t());
|
|
297
|
+
else if (e === "validate_measurement") n.measure = r(t()).map((e) => i(e));
|
|
298
|
+
else if (e === "output") n._relations.output = r(t());
|
|
299
|
+
else if (e === "reference_data_registry") n._relations.input = r(t());
|
|
300
|
+
else return !1;
|
|
301
|
+
return !0;
|
|
302
|
+
}, {
|
|
303
|
+
construct: "process",
|
|
304
|
+
id: e
|
|
305
|
+
}), (t) => {
|
|
306
|
+
t.processes[e] = n;
|
|
307
|
+
for (let e of a) t = e(t);
|
|
308
|
+
return t;
|
|
309
|
+
};
|
|
310
|
+
}, ne = function(e, t) {
|
|
311
|
+
let { _relations: n, ...r } = t, i = {
|
|
312
|
+
...r,
|
|
313
|
+
output: [],
|
|
314
|
+
input: [],
|
|
315
|
+
provision: [],
|
|
316
|
+
actor: null,
|
|
317
|
+
page: null
|
|
318
|
+
};
|
|
319
|
+
for (let t of n.output) {
|
|
320
|
+
let n = d(e, "regs", t);
|
|
321
|
+
n !== void 0 && i.output.push(n);
|
|
322
|
+
}
|
|
323
|
+
for (let t of n.input) {
|
|
324
|
+
let n = d(e, "regs", t);
|
|
325
|
+
n !== void 0 && i.input.push(n);
|
|
326
|
+
}
|
|
327
|
+
for (let t of n.provision) {
|
|
328
|
+
let n = d(e, "provisions", t);
|
|
329
|
+
n !== void 0 && i.provision.push(n);
|
|
330
|
+
}
|
|
331
|
+
return n.actor !== "" && (i.actor = d(e, "roles", n.actor) ?? null), n.page !== "" && (i.page = d(e, "pages", n.page) ?? null), i;
|
|
332
|
+
};
|
|
333
|
+
function re(e) {
|
|
334
|
+
return e.split("\n").map((e) => e && " " + e).join("\n");
|
|
335
|
+
}
|
|
336
|
+
function _(e, t) {
|
|
337
|
+
let n = v(e);
|
|
338
|
+
if (e.children.length > 0) {
|
|
339
|
+
let r = [];
|
|
340
|
+
for (let n of e.children) {
|
|
341
|
+
let e = t.get(n);
|
|
342
|
+
e && r.push(re(_(e, t)));
|
|
343
|
+
}
|
|
344
|
+
r.length > 0 && (n = n.replace(/\n}\n$/, "\n" + r.join("\n") + "}\n"));
|
|
345
|
+
}
|
|
346
|
+
return n;
|
|
347
|
+
}
|
|
348
|
+
var v = function(e) {
|
|
349
|
+
let t = "process " + e.id + " {\n";
|
|
350
|
+
if (t += " name \"" + o(e.name) + "\"\n", e.actor !== null && (t += " actor " + e.actor.id + "\n"), e.modality !== "" && (t += " modality " + e.modality + "\n"), e.input.length > 0) {
|
|
351
|
+
t += " reference_data_registry {\n";
|
|
352
|
+
for (let n of e.input) t += " " + n.id + "\n";
|
|
353
|
+
t += " }\n";
|
|
354
|
+
}
|
|
355
|
+
if (e.provision.length > 0) {
|
|
356
|
+
t += " validate_provision {\n";
|
|
357
|
+
for (let n of e.provision) t += " " + n.id + "\n";
|
|
358
|
+
t += " }\n";
|
|
359
|
+
}
|
|
360
|
+
if (e.measure.length > 0) {
|
|
361
|
+
t += " validate_measurement {\n";
|
|
362
|
+
for (let n of e.measure) t += " \"" + n + "\"\n";
|
|
363
|
+
t += " }\n";
|
|
364
|
+
}
|
|
365
|
+
if (e.output.length > 0) {
|
|
366
|
+
t += " output {\n";
|
|
367
|
+
for (let n of e.output) t += " " + n.id + "\n";
|
|
368
|
+
t += " }\n";
|
|
369
|
+
}
|
|
370
|
+
return e.page !== null && (t += " canvas " + e.page.id + "\n"), e.parent && e.children.length === 0 && (t += " parent " + e.parent + "\n"), t += "}\n", t;
|
|
371
|
+
};
|
|
372
|
+
//#endregion
|
|
373
|
+
//#region src/ser-des/dump.ts
|
|
374
|
+
function ie(e, t) {
|
|
375
|
+
let n = "";
|
|
376
|
+
e.root !== null && (n += "root " + e.root.id + "\n\n"), n += ee(e.meta) + "\n";
|
|
377
|
+
let r = /* @__PURE__ */ new Set();
|
|
378
|
+
for (let t of e.processes) for (let e of t.children) r.add(e);
|
|
379
|
+
let i = new Map(e.processes.map((e) => [e.id, e]));
|
|
380
|
+
return Object.keys(t).forEach((a) => {
|
|
381
|
+
if (a === "processes") {
|
|
382
|
+
for (let t of e.processes) r.has(t.id) || (n += _(t, i));
|
|
383
|
+
return;
|
|
384
|
+
}
|
|
385
|
+
let o = e[a], s = t[a];
|
|
386
|
+
for (let e of o) n += s(e);
|
|
387
|
+
}), n;
|
|
388
|
+
}
|
|
389
|
+
//#endregion
|
|
390
|
+
//#region src/ser-des/config/approval.ts
|
|
391
|
+
var ae = function(e, t) {
|
|
392
|
+
let n = {
|
|
393
|
+
id: e,
|
|
394
|
+
name: "",
|
|
395
|
+
modality: "",
|
|
396
|
+
actor: null,
|
|
397
|
+
approver: null,
|
|
398
|
+
records: [],
|
|
399
|
+
ref: [],
|
|
400
|
+
_relations: {
|
|
401
|
+
actor: "",
|
|
402
|
+
approver: "",
|
|
403
|
+
records: [],
|
|
404
|
+
ref: []
|
|
405
|
+
}
|
|
406
|
+
};
|
|
407
|
+
return m(t, (e, t) => {
|
|
408
|
+
if (e === "modality") n.modality = t();
|
|
409
|
+
else if (e === "name") n.name = h(t);
|
|
410
|
+
else if (e === "actor") n._relations.actor = t();
|
|
411
|
+
else if (e === "approve_by") n._relations.approver = t();
|
|
412
|
+
else if (e === "approval_record") n._relations.records = r(t());
|
|
413
|
+
else if (e === "reference") n._relations.ref = r(t());
|
|
414
|
+
else return !1;
|
|
415
|
+
return !0;
|
|
416
|
+
}, {
|
|
417
|
+
construct: "approval",
|
|
418
|
+
id: e
|
|
419
|
+
}), (t) => (t.approvals[e] = n, t);
|
|
420
|
+
}, oe = function(e, t) {
|
|
421
|
+
let { _relations: n, ...r } = t, i = {
|
|
422
|
+
...r,
|
|
423
|
+
records: [],
|
|
424
|
+
ref: []
|
|
425
|
+
};
|
|
426
|
+
n.actor !== "" && (i.actor = d(e, "roles", n.actor) ?? null), n.approver !== "" && (i.approver = d(e, "roles", n.approver) ?? null);
|
|
427
|
+
for (let t of n.records) {
|
|
428
|
+
let n = d(e, "regs", t);
|
|
429
|
+
n !== void 0 && i.records.push(n);
|
|
430
|
+
}
|
|
431
|
+
for (let t of n.ref) {
|
|
432
|
+
let n = d(e, "references", t);
|
|
433
|
+
n !== void 0 && i.ref.push(n);
|
|
434
|
+
}
|
|
435
|
+
return i;
|
|
436
|
+
}, se = function(e) {
|
|
437
|
+
let t = "approval " + e.id + " {\n";
|
|
438
|
+
if (t += " name \"" + o(e.name) + "\"\n", e.actor !== null && (t += " actor " + e.actor.id + "\n"), t += " modality " + e.modality + "\n", e.approver !== null && (t += " approve_by " + e.approver.id + "\n"), e.records.length > 0) {
|
|
439
|
+
t += " approval_record {\n";
|
|
440
|
+
for (let n of e.records) t += " " + n.id + "\n";
|
|
441
|
+
t += " }\n";
|
|
442
|
+
}
|
|
443
|
+
if (e.ref.length > 0) {
|
|
444
|
+
t += " reference {\n";
|
|
445
|
+
for (let n of e.ref) t += " " + n.id + "\n";
|
|
446
|
+
t += " }\n";
|
|
447
|
+
}
|
|
448
|
+
return t += "}\n", t;
|
|
449
|
+
}, ce = (e, t) => {
|
|
450
|
+
let n = {
|
|
451
|
+
id: e,
|
|
452
|
+
values: []
|
|
453
|
+
};
|
|
454
|
+
return m(t, (e, t) => (n.values.push(le(e, t())), !0), {
|
|
455
|
+
construct: "enum",
|
|
456
|
+
id: e
|
|
457
|
+
}), (t) => (t.enums[e] = n, t);
|
|
458
|
+
}, le = (e, t) => {
|
|
459
|
+
let n = {
|
|
460
|
+
id: e,
|
|
461
|
+
value: ""
|
|
462
|
+
};
|
|
463
|
+
return m(t, (e, t) => {
|
|
464
|
+
if (e === "definition") n.value = h(t);
|
|
465
|
+
else return !1;
|
|
466
|
+
return !0;
|
|
467
|
+
}, {
|
|
468
|
+
construct: "enum value",
|
|
469
|
+
id: e
|
|
470
|
+
}), n;
|
|
471
|
+
}, ue = function(e, t) {
|
|
472
|
+
let n = {
|
|
473
|
+
id: e,
|
|
474
|
+
title: "",
|
|
475
|
+
data: null,
|
|
476
|
+
_relations: { data: "" }
|
|
477
|
+
};
|
|
478
|
+
return m(t, (e, t) => {
|
|
479
|
+
if (e === "title") n.title = h(t);
|
|
480
|
+
else if (e === "data_class") n._relations.data = t();
|
|
481
|
+
else return !1;
|
|
482
|
+
return !0;
|
|
483
|
+
}, {
|
|
484
|
+
construct: "registry",
|
|
485
|
+
id: e
|
|
486
|
+
}), (t) => (t.regs[e] = n, t);
|
|
487
|
+
}, de = function(e, t) {
|
|
488
|
+
let n = {
|
|
489
|
+
id: e,
|
|
490
|
+
attributes: []
|
|
491
|
+
};
|
|
492
|
+
return te(t, (e, t) => {
|
|
493
|
+
n.attributes.push(fe(e.trim(), t));
|
|
494
|
+
}, {
|
|
495
|
+
construct: "class",
|
|
496
|
+
id: e
|
|
497
|
+
}), (t) => (t.dataclasses[e] = n, t);
|
|
498
|
+
}, fe = (e, t) => {
|
|
499
|
+
let n = {
|
|
500
|
+
id: "",
|
|
501
|
+
type: "",
|
|
502
|
+
modality: "",
|
|
503
|
+
cardinality: "",
|
|
504
|
+
definition: "",
|
|
505
|
+
ref: [],
|
|
506
|
+
satisfy: [],
|
|
507
|
+
_relations: { ref: [] }
|
|
508
|
+
}, i = e.indexOf("[");
|
|
509
|
+
return i !== -1 && (n.cardinality = e.substr(i + 1, e.length - i - 2).trim(), e = e.substr(0, i)), i = e.indexOf(":"), i !== -1 && (n.type = e.substr(i + 1, e.length - i - 1).trim(), e = e.substr(0, i)), n.id = e.trim(), m(t, (e, t) => {
|
|
510
|
+
if (e === "modality") n.modality = t();
|
|
511
|
+
else if (e === "definition") n.definition = h(t);
|
|
512
|
+
else if (e === "reference") n._relations.ref = r(t());
|
|
513
|
+
else if (e === "satisfy") n.satisfy = r(t());
|
|
514
|
+
else return !1;
|
|
515
|
+
return !0;
|
|
516
|
+
}, {
|
|
517
|
+
construct: "data attribute",
|
|
518
|
+
id: n.id
|
|
519
|
+
}), n;
|
|
520
|
+
}, pe = function(e, t) {
|
|
521
|
+
let n = t.attributes.map((t) => {
|
|
522
|
+
let n = {
|
|
523
|
+
...t,
|
|
524
|
+
ref: []
|
|
525
|
+
};
|
|
526
|
+
for (let r of t._relations.ref) {
|
|
527
|
+
let t = d(e, "references", r);
|
|
528
|
+
t !== void 0 && n.ref.push(t);
|
|
529
|
+
}
|
|
530
|
+
return n;
|
|
531
|
+
});
|
|
532
|
+
return {
|
|
533
|
+
id: t.id,
|
|
534
|
+
attributes: n
|
|
535
|
+
};
|
|
536
|
+
}, me = function(e, t) {
|
|
537
|
+
let { _relations: n, ...r } = t, i = {
|
|
538
|
+
...r,
|
|
539
|
+
data: null
|
|
540
|
+
};
|
|
541
|
+
if (n.data !== "") {
|
|
542
|
+
let t = d(e, "dataclasses", n.data);
|
|
543
|
+
t !== void 0 && (i.data = t);
|
|
544
|
+
}
|
|
545
|
+
return i;
|
|
546
|
+
}, he = function(e) {
|
|
547
|
+
let t = "class " + e.id + " {\n";
|
|
548
|
+
for (let n of e.attributes) t += ge(n);
|
|
549
|
+
return t += "}\n", t;
|
|
550
|
+
}, ge = (e) => {
|
|
551
|
+
let t = " " + e.id;
|
|
552
|
+
if (e.type !== "" && (t += ": " + e.type), e.cardinality !== "" && (t += "[" + e.cardinality + "]"), t += " {\n", t += " definition \"" + o(e.definition) + "\"\n", e.modality !== "" && (t += " modality " + e.modality + "\n"), e.satisfy.length > 0) {
|
|
553
|
+
t += " satisfy {\n";
|
|
554
|
+
for (let n of e.satisfy) t += " " + n + "\n";
|
|
555
|
+
t += " }\n";
|
|
556
|
+
}
|
|
557
|
+
if (e.ref.length > 0) {
|
|
558
|
+
t += " reference {\n";
|
|
559
|
+
for (let n of e.ref) t += " " + n.id + "\n";
|
|
560
|
+
t += " }\n";
|
|
561
|
+
}
|
|
562
|
+
return t += " }\n", t;
|
|
563
|
+
}, y = (e) => {
|
|
564
|
+
let t = " " + e.id + " {\n";
|
|
565
|
+
return t += " definition \"" + o(e.value) + "\"\n", t += " }\n", t;
|
|
566
|
+
}, b = function(e) {
|
|
567
|
+
let t = "enum " + e.id + " {\n";
|
|
568
|
+
for (let n of e.values) t += y(n);
|
|
569
|
+
return t += "}\n", t;
|
|
570
|
+
}, x = function(e) {
|
|
571
|
+
let t = "data_registry " + e.id + " {\n";
|
|
572
|
+
return t += " title \"" + o(e.title) + "\"\n", e.data !== null && (t += " data_class " + e.data.id + "\n"), t += "}\n", t;
|
|
573
|
+
}, S = function(e, t) {
|
|
574
|
+
let n = {
|
|
575
|
+
id: e,
|
|
576
|
+
type: "",
|
|
577
|
+
definition: "",
|
|
578
|
+
description: ""
|
|
579
|
+
};
|
|
580
|
+
return m(t, (e, t) => {
|
|
581
|
+
if (e === "type") n.type = t();
|
|
582
|
+
else if (e === "definition") n.definition = h(t);
|
|
583
|
+
else if (e === "description") n.description = h(t);
|
|
584
|
+
else return !1;
|
|
585
|
+
return !0;
|
|
586
|
+
}, {
|
|
587
|
+
construct: "variable",
|
|
588
|
+
id: e
|
|
589
|
+
}), (t) => (t.variables[e] = n, t);
|
|
590
|
+
}, C = function(e) {
|
|
591
|
+
let t = "variable " + e.id + " {\n";
|
|
592
|
+
return e.type !== "" && (t += " type " + e.type + "\n"), e.definition !== "" && (t += " definition \"" + o(e.definition) + "\"\n"), e.description !== "" && (t += " description \"" + o(e.description) + "\"\n"), t += "}\n", t;
|
|
593
|
+
}, w = function(e, t) {
|
|
594
|
+
let n = {
|
|
595
|
+
id: e,
|
|
596
|
+
eventType: "end"
|
|
597
|
+
};
|
|
598
|
+
if (t !== "" && r(t).length > 0) throw Error(`Parsing error: end_event. ID ${e}: Expecting empty body`);
|
|
599
|
+
return (t) => (t.events[e] = n, t);
|
|
600
|
+
}, T = function(e, t) {
|
|
601
|
+
let n = {
|
|
602
|
+
id: e,
|
|
603
|
+
eventType: "signalcatch",
|
|
604
|
+
signal: ""
|
|
605
|
+
};
|
|
606
|
+
if (t !== "") {
|
|
607
|
+
let a = r(t), o = 0;
|
|
608
|
+
for (; o < a.length;) {
|
|
609
|
+
let t = a[o++];
|
|
610
|
+
if (o < a.length) t === "catch" ? n.signal = i(a[o++]) : o++;
|
|
611
|
+
else throw Error(`Parsing error: Signal Catch Event. ID ${e}: Expecting value for ${t}`);
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
return (t) => (t.events[e] = n, t);
|
|
615
|
+
}, E = function(e, t) {
|
|
616
|
+
let n = {
|
|
617
|
+
id: e,
|
|
618
|
+
eventType: "start"
|
|
619
|
+
};
|
|
620
|
+
if (t !== "" && r(t).length > 0) throw Error(`Parsing error: end_event. ID ${e}: Expecting empty body`);
|
|
621
|
+
return (t) => (t.events[e] = n, t);
|
|
622
|
+
}, D = function(e, t) {
|
|
623
|
+
let n = {
|
|
624
|
+
id: e,
|
|
625
|
+
eventType: "timer",
|
|
626
|
+
type: "",
|
|
627
|
+
para: ""
|
|
628
|
+
};
|
|
629
|
+
if (t !== "") {
|
|
630
|
+
let a = r(t), o = 0;
|
|
631
|
+
for (; o < a.length;) {
|
|
632
|
+
let t = a[o++];
|
|
633
|
+
if (o < a.length) t === "type" ? n.type = a[o++] : t === "para" ? n.para = i(a[o++]) : o++;
|
|
634
|
+
else throw Error(`Parsing error: Timer Event. ID ${e}: Expecting value for ${t}`);
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
return (t) => (t.events[e] = n, t);
|
|
638
|
+
}, O = function(e) {
|
|
639
|
+
return e.eventType === "start" ? j(e) : e.eventType === "end" ? k(e) : e.eventType === "signalcatch" ? A(e) : e.eventType === "timer" ? M(e) : "";
|
|
640
|
+
};
|
|
641
|
+
function k(e) {
|
|
642
|
+
return "end_event " + e.id + " {\n}\n";
|
|
643
|
+
}
|
|
644
|
+
function A(e) {
|
|
645
|
+
let t = "signal_catch_event " + e.id + " {\n";
|
|
646
|
+
return e.signal !== "" && (t += " catch \"" + o(e.signal) + "\"\n"), t += "}\n", t;
|
|
647
|
+
}
|
|
648
|
+
function j(e) {
|
|
649
|
+
return "start_event " + e.id + " {\n}\n";
|
|
650
|
+
}
|
|
651
|
+
function M(e) {
|
|
652
|
+
let t = "timer_event " + e.id + " {\n";
|
|
653
|
+
return e.type !== "" && (t += " type " + e.type + "\n"), e.para !== "" && (t += " para \"" + o(e.para) + "\"\n"), t += "}\n", t;
|
|
654
|
+
}
|
|
655
|
+
//#endregion
|
|
656
|
+
//#region src/ser-des/config/gateway.ts
|
|
657
|
+
var N = function(e, t) {
|
|
658
|
+
let n = {
|
|
659
|
+
id: e,
|
|
660
|
+
gatewayType: "exclusive_gateway",
|
|
661
|
+
label: ""
|
|
662
|
+
};
|
|
663
|
+
return m(t, (e, t) => {
|
|
664
|
+
if (e === "label") n.label = h(t);
|
|
665
|
+
else return !1;
|
|
666
|
+
return !0;
|
|
667
|
+
}, {
|
|
668
|
+
construct: "Exclusive gateway",
|
|
669
|
+
id: e
|
|
670
|
+
}), (t) => (t.gateways[e] = n, t);
|
|
671
|
+
}, P = function(e) {
|
|
672
|
+
return e.gatewayType === "exclusive_gateway" ? F(e) : "";
|
|
673
|
+
};
|
|
674
|
+
function F(e) {
|
|
675
|
+
let t = "exclusive_gateway " + e.id + " {\n";
|
|
676
|
+
return e.label !== "" && (t += " label \"" + o(e.label) + "\"\n"), t += "}\n", t;
|
|
677
|
+
}
|
|
678
|
+
//#endregion
|
|
679
|
+
//#region src/ser-des/config/provision.ts
|
|
680
|
+
var I = function(e, t) {
|
|
681
|
+
let n = {
|
|
682
|
+
subject: /* @__PURE__ */ new Map(),
|
|
683
|
+
id: e,
|
|
684
|
+
modality: "",
|
|
685
|
+
condition: "",
|
|
686
|
+
ref: [],
|
|
687
|
+
_relations: { ref: [] }
|
|
688
|
+
};
|
|
689
|
+
return m(t, (e, t) => (e === "modality" ? n.modality = t() : e === "condition" ? n.condition = h(t) : e === "reference" ? n._relations.ref = r(t()) : n.subject.set(e, t()), !0), {
|
|
690
|
+
construct: "provision",
|
|
691
|
+
id: e
|
|
692
|
+
}), (t) => (t.provisions[e] = n, t);
|
|
693
|
+
}, L = function(e, t) {
|
|
694
|
+
let n = [];
|
|
695
|
+
for (let r of t._relations.ref) {
|
|
696
|
+
let t = d(e, "references", r);
|
|
697
|
+
t !== void 0 && n.push(t);
|
|
698
|
+
}
|
|
699
|
+
return {
|
|
700
|
+
...t,
|
|
701
|
+
ref: n
|
|
702
|
+
};
|
|
703
|
+
}, _e = function(e) {
|
|
704
|
+
let t = "provision " + e.id + " {\n";
|
|
705
|
+
if (e.subject.forEach((e, n) => {
|
|
706
|
+
t += " " + n + " " + e + "\n";
|
|
707
|
+
}), t += " condition \"" + o(e.condition) + "\"\n", e.modality !== "" && (t += " modality " + e.modality + "\n"), e.ref.length > 0) {
|
|
708
|
+
t += " reference {\n";
|
|
709
|
+
for (let n of e.ref) t += " " + n.id + "\n";
|
|
710
|
+
t += " }\n";
|
|
711
|
+
}
|
|
712
|
+
return t += "}\n", t;
|
|
713
|
+
}, ve = (e, t) => {
|
|
714
|
+
let n = {
|
|
715
|
+
id: e,
|
|
716
|
+
document: "",
|
|
717
|
+
clause: ""
|
|
718
|
+
};
|
|
719
|
+
if (t !== "") {
|
|
720
|
+
let a = r(t), o = 0;
|
|
721
|
+
for (; o < a.length;) {
|
|
722
|
+
let t = a[o++];
|
|
723
|
+
if (o < a.length) t === "document" ? n.document = i(a[o++]) : t === "clause" ? n.clause = i(a[o++]) : o++;
|
|
724
|
+
else throw Error(`Parsing error: reference. ID ${e}: Expecting value for ${t}`);
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
return (t) => (t.references[e] = n, t);
|
|
728
|
+
}, ye = function(e) {
|
|
729
|
+
let t = "reference " + e.id + " {\n";
|
|
730
|
+
return t += " document \"" + o(e.document) + "\"\n", t += " clause \"" + o(e.clause) + "\"\n", t += "}\n", t;
|
|
731
|
+
}, be = (e, t) => {
|
|
732
|
+
let n = {
|
|
733
|
+
id: e,
|
|
734
|
+
name: ""
|
|
735
|
+
};
|
|
736
|
+
return m(t, (e, t) => {
|
|
737
|
+
if (e === "name") n.name = h(t);
|
|
738
|
+
else return !1;
|
|
739
|
+
return !0;
|
|
740
|
+
}, {
|
|
741
|
+
construct: "role",
|
|
742
|
+
id: e
|
|
743
|
+
}), (t) => (t.roles[e] = n, t);
|
|
744
|
+
}, xe = function(e) {
|
|
745
|
+
let t = "role " + e.id + " {\n";
|
|
746
|
+
return t += " name \"" + o(e.name) + "\"\n", t += "}\n", t;
|
|
747
|
+
}, Se = function(e, t) {
|
|
748
|
+
let n = {
|
|
749
|
+
id: e,
|
|
750
|
+
childs: [],
|
|
751
|
+
edges: [],
|
|
752
|
+
data: [],
|
|
753
|
+
_relations: {
|
|
754
|
+
childs: [],
|
|
755
|
+
edges: [],
|
|
756
|
+
data: []
|
|
757
|
+
},
|
|
758
|
+
_components: {}
|
|
759
|
+
};
|
|
760
|
+
if (t !== "") {
|
|
761
|
+
let a = r(t), o = 0;
|
|
762
|
+
for (; o < a.length;) {
|
|
763
|
+
let t = a[o++];
|
|
764
|
+
if (o < a.length) t === "elements" ? n = Ce(i(a[o++]))(n) : t === "process_flow" ? n = Te(i(a[o++]))(n) : t === "data" ? n = we(i(a[o++]))(n) : o++;
|
|
765
|
+
else throw Error(`Parsing error: subprocess. ID ${e}: Expecting value for ${t}`);
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
return (t) => (t.pages[e] = n, t);
|
|
769
|
+
}, Ce = function(e) {
|
|
770
|
+
let t = r(e), n = {}, i = 0;
|
|
771
|
+
for (; i < t.length;) {
|
|
772
|
+
let e = t[i++];
|
|
773
|
+
if (i < t.length) {
|
|
774
|
+
let r = e.trim();
|
|
775
|
+
n[r] = R(r, t[i++]);
|
|
776
|
+
} else throw Error(`Parsing error: elements in subprocess. Expecting value for ${e}`);
|
|
777
|
+
}
|
|
778
|
+
return (e) => ({
|
|
779
|
+
...e,
|
|
780
|
+
_components: {
|
|
781
|
+
...e._components,
|
|
782
|
+
...n
|
|
783
|
+
},
|
|
784
|
+
_relations: {
|
|
785
|
+
...e._relations,
|
|
786
|
+
childs: Object.values(n)
|
|
787
|
+
}
|
|
788
|
+
});
|
|
789
|
+
}, we = function(e) {
|
|
790
|
+
let t = r(e), n = {}, i = 0;
|
|
791
|
+
for (; i < t.length;) {
|
|
792
|
+
let e = t[i++];
|
|
793
|
+
if (i < t.length) {
|
|
794
|
+
let r = e.trim();
|
|
795
|
+
n[r] = R(r, t[i++]);
|
|
796
|
+
} else throw Error(`Parsing error: data in subprocess. Expecting value for ${e}`);
|
|
797
|
+
}
|
|
798
|
+
return (e) => ({
|
|
799
|
+
...e,
|
|
800
|
+
_components: {
|
|
801
|
+
...e._components,
|
|
802
|
+
...n
|
|
803
|
+
},
|
|
804
|
+
_relations: {
|
|
805
|
+
...e._relations,
|
|
806
|
+
data: Object.values(n)
|
|
807
|
+
}
|
|
808
|
+
});
|
|
809
|
+
}, Te = function(e) {
|
|
810
|
+
let t = r(e), n = {}, i = 0;
|
|
811
|
+
for (; i < t.length;) {
|
|
812
|
+
let e = t[i++].trim();
|
|
813
|
+
if (i < t.length) n[e] = Ee(e.trim(), t[i++]);
|
|
814
|
+
else throw Error(`Parsing error: edges in subprocess. Expecting value for ${e}`);
|
|
815
|
+
}
|
|
816
|
+
return (e) => ({
|
|
817
|
+
...e,
|
|
818
|
+
_relations: {
|
|
819
|
+
...e._relations,
|
|
820
|
+
edges: Object.values(n)
|
|
821
|
+
}
|
|
822
|
+
});
|
|
823
|
+
};
|
|
824
|
+
function R(e, t) {
|
|
825
|
+
let n = {
|
|
826
|
+
name: e,
|
|
827
|
+
element: null,
|
|
828
|
+
x: 0,
|
|
829
|
+
y: 0,
|
|
830
|
+
_relations: { element: e }
|
|
831
|
+
}, i = r(t), a = 0;
|
|
832
|
+
for (; a < i.length;) {
|
|
833
|
+
let t = i[a++];
|
|
834
|
+
if (a < i.length) t === "x" ? n.x = parseFloat(i[a++]) : t === "y" ? n.y = parseFloat(i[a++]) : a++;
|
|
835
|
+
else throw Error(`Parsing error: subprocess component. Element ${e}: Expecting value for ${t}`);
|
|
836
|
+
}
|
|
837
|
+
return n;
|
|
838
|
+
}
|
|
839
|
+
function Ee(e, t) {
|
|
840
|
+
let n = {
|
|
841
|
+
id: e,
|
|
842
|
+
from: null,
|
|
843
|
+
to: null,
|
|
844
|
+
description: "",
|
|
845
|
+
condition: "",
|
|
846
|
+
_relations: {
|
|
847
|
+
from: "",
|
|
848
|
+
to: ""
|
|
849
|
+
}
|
|
850
|
+
}, a = r(t), o = 0;
|
|
851
|
+
for (; o < a.length;) {
|
|
852
|
+
let t = a[o++];
|
|
853
|
+
if (o < a.length) t === "from" ? n._relations.from = a[o++] : t === "description" ? n.description = i(a[o++]) : t === "condition" ? n.condition = i(a[o++]) : t === "to" ? n._relations.to = a[o++] : o++;
|
|
854
|
+
else throw Error(`Parsing error: process_flow. ID ${e}: Expecting value for ${t}`);
|
|
855
|
+
}
|
|
856
|
+
return n;
|
|
857
|
+
}
|
|
858
|
+
var De = function(e, t) {
|
|
859
|
+
let n = t._relations ?? {
|
|
860
|
+
childs: [],
|
|
861
|
+
edges: [],
|
|
862
|
+
data: []
|
|
863
|
+
}, r = t._components ?? {}, i = /* @__PURE__ */ new Map();
|
|
864
|
+
for (let e of Object.values(r)) e._relations?.element && i.set(e._relations.element, e);
|
|
865
|
+
let a = (t) => ({
|
|
866
|
+
name: t.name,
|
|
867
|
+
x: t.x,
|
|
868
|
+
y: t.y,
|
|
869
|
+
element: Oe(e, t._relations.element)
|
|
870
|
+
});
|
|
871
|
+
return {
|
|
872
|
+
id: t.id,
|
|
873
|
+
childs: n.childs.map(a),
|
|
874
|
+
edges: n.edges.map((e) => {
|
|
875
|
+
let t = e._relations.from ? i.get(e._relations.from) : void 0, n = e._relations.to ? i.get(e._relations.to) : void 0;
|
|
876
|
+
return {
|
|
877
|
+
id: e.id,
|
|
878
|
+
description: e.description,
|
|
879
|
+
condition: e.condition,
|
|
880
|
+
from: t ? a(t) : null,
|
|
881
|
+
to: n ? a(n) : null
|
|
882
|
+
};
|
|
883
|
+
}),
|
|
884
|
+
data: n.data.map(a)
|
|
885
|
+
};
|
|
886
|
+
};
|
|
887
|
+
function Oe(e, t) {
|
|
888
|
+
return d(e, "processes", t) ?? d(e, "approvals", t) ?? d(e, "events", t) ?? d(e, "gateways", t) ?? null;
|
|
889
|
+
}
|
|
890
|
+
var ke = function(e) {
|
|
891
|
+
let t = "canvas " + e.id + " {\n";
|
|
892
|
+
return t += " elements {\n", e.childs.forEach((e) => {
|
|
893
|
+
t += z(e);
|
|
894
|
+
}), t += " }\n", t += " process_flow {\n", e.edges.forEach((e) => {
|
|
895
|
+
t += Ae(e);
|
|
896
|
+
}), t += " }\n", t += " data {\n", e.data.forEach((e) => {
|
|
897
|
+
t += z(e);
|
|
898
|
+
}), t += " }\n", t += "}\n", t;
|
|
899
|
+
};
|
|
900
|
+
function z(e) {
|
|
901
|
+
let t = " " + (e.element?.id ?? e.name) + " {\n";
|
|
902
|
+
return t += " x " + e.x + "\n", t += " y " + e.y + "\n", t += " }\n", t;
|
|
903
|
+
}
|
|
904
|
+
function Ae(e) {
|
|
905
|
+
let t = " " + e.id + " {\n";
|
|
906
|
+
return e.from !== null && e.from.element !== null && (t += " from " + e.from.element.id + "\n"), e.to !== null && e.to.element !== null && (t += " to " + e.to.element.id + "\n"), e.description !== "" && (t += " description \"" + o(e.description) + "\"\n"), e.condition !== "" && (t += " condition \"" + o(e.condition) + "\"\n"), t += " }\n", t;
|
|
907
|
+
}
|
|
908
|
+
//#endregion
|
|
909
|
+
//#region src/ser-des/config/note.ts
|
|
910
|
+
var B = [
|
|
911
|
+
"NOTE",
|
|
912
|
+
"CAUTION",
|
|
913
|
+
"WARNING"
|
|
914
|
+
], je = function(e, t) {
|
|
915
|
+
let n = {
|
|
916
|
+
id: e,
|
|
917
|
+
type: "NOTE",
|
|
918
|
+
message: "",
|
|
919
|
+
ref: [],
|
|
920
|
+
_relations: { ref: [] }
|
|
921
|
+
};
|
|
922
|
+
return m(t, (t, i) => {
|
|
923
|
+
if (t === "type") {
|
|
924
|
+
let t = i();
|
|
925
|
+
if (!B.includes(t)) throw Error(`Parsing error: note. ID ${e}: Unknown type ${t} (valid: ${B.join(", ")})`);
|
|
926
|
+
n.type = t;
|
|
927
|
+
} else if (t === "message") n.message = h(i);
|
|
928
|
+
else if (t === "reference") n._relations.ref = r(i());
|
|
929
|
+
else return !1;
|
|
930
|
+
return !0;
|
|
931
|
+
}, {
|
|
932
|
+
construct: "note",
|
|
933
|
+
id: e
|
|
934
|
+
}), (t) => (t.notes[e] = n, t);
|
|
935
|
+
}, Me = function(e, t) {
|
|
936
|
+
let n = [];
|
|
937
|
+
for (let r of t._relations.ref) {
|
|
938
|
+
let t = d(e, "references", r);
|
|
939
|
+
t !== void 0 && n.push(t);
|
|
940
|
+
}
|
|
941
|
+
return {
|
|
942
|
+
...t,
|
|
943
|
+
ref: n
|
|
944
|
+
};
|
|
945
|
+
}, Ne = function(e) {
|
|
946
|
+
let t = "note " + e.id + " {\n";
|
|
947
|
+
if (t += " type " + e.type + "\n", t += " message \"" + o(e.message) + "\"\n", e.ref.length > 0) {
|
|
948
|
+
t += " reference {\n";
|
|
949
|
+
for (let n of e.ref) t += " " + n.id + "\n";
|
|
950
|
+
t += " }\n";
|
|
951
|
+
}
|
|
952
|
+
return t += "}\n", t;
|
|
953
|
+
}, Pe = function(e, t) {
|
|
954
|
+
let n = {
|
|
955
|
+
id: e,
|
|
956
|
+
title: "",
|
|
957
|
+
columns: "",
|
|
958
|
+
display: "",
|
|
959
|
+
data: [],
|
|
960
|
+
domain: null
|
|
961
|
+
};
|
|
962
|
+
if (t !== "") {
|
|
963
|
+
let a = r(t), o = 0;
|
|
964
|
+
for (; o < a.length;) {
|
|
965
|
+
let t = a[o++];
|
|
966
|
+
if (o < a.length) t === "title" ? n.title = i(a[o++]) : t === "columns" ? n.columns = i(a[o++]) : t === "display" ? n.display = i(a[o++]) : t === "domain" ? n.domain = i(a[o++]) : t === "data" ? n.data = Fe(i(a[o++])) : o++;
|
|
967
|
+
else throw Error(`Parsing error: table. ID ${e}: Expecting value for ${t}`);
|
|
968
|
+
}
|
|
969
|
+
}
|
|
970
|
+
return (t) => (t.tables[e] = n, t);
|
|
971
|
+
};
|
|
972
|
+
function Fe(e) {
|
|
973
|
+
return e.split(/\n+/).map((e) => e.trim()).filter((e) => e.length > 0).map((e) => {
|
|
974
|
+
let t = [], n = /"([^"]*)"|(\S+)/g, r;
|
|
975
|
+
for (; (r = n.exec(e)) !== null;) t.push(r[1] ?? r[2] ?? "");
|
|
976
|
+
return t;
|
|
977
|
+
});
|
|
978
|
+
}
|
|
979
|
+
var Ie = function(e) {
|
|
980
|
+
let t = "table " + e.id + " {\n";
|
|
981
|
+
if (t += " title \"" + e.title + "\"\n", t += " columns \"" + e.columns + "\"\n", e.display && (t += " display \"" + e.display + "\"\n"), e.domain && (t += " domain { }\n"), e.data.length > 0) {
|
|
982
|
+
t += " data {\n";
|
|
983
|
+
for (let n of e.data) {
|
|
984
|
+
let e = n.map((e) => `"${e}"`).join(" ");
|
|
985
|
+
t += " " + e + "\n";
|
|
986
|
+
}
|
|
987
|
+
t += " }\n";
|
|
988
|
+
}
|
|
989
|
+
return t += "}\n", t;
|
|
990
|
+
}, Le = function(e, t) {
|
|
991
|
+
let n = {
|
|
992
|
+
id: e,
|
|
993
|
+
title: "",
|
|
994
|
+
src: ""
|
|
995
|
+
};
|
|
996
|
+
if (t !== "") {
|
|
997
|
+
let a = r(t), o = 0;
|
|
998
|
+
for (; o < a.length;) {
|
|
999
|
+
let t = a[o++];
|
|
1000
|
+
if (o < a.length) t === "title" ? n.title = i(a[o++]) : t === "src" ? n.src = i(a[o++]) : o++;
|
|
1001
|
+
else throw Error(`Parsing error: figure. ID ${e}: Expecting value for ${t}`);
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
1004
|
+
return (t) => (t.figures[e] = n, t);
|
|
1005
|
+
}, Re = function(e) {
|
|
1006
|
+
let t = "figure " + e.id + " {\n";
|
|
1007
|
+
return t += " title \"" + o(e.title) + "\"\n", t += " src \"" + o(e.src) + "\"\n", t += "}\n", t;
|
|
1008
|
+
}, V = ["REPO", "URL"], ze = function(e, t) {
|
|
1009
|
+
let n = {
|
|
1010
|
+
id: e,
|
|
1011
|
+
kind: "URL",
|
|
1012
|
+
target: "",
|
|
1013
|
+
namespace: ""
|
|
1014
|
+
};
|
|
1015
|
+
if (t !== "") {
|
|
1016
|
+
let a = r(t), o = 0;
|
|
1017
|
+
for (; o < a.length;) {
|
|
1018
|
+
let t = a[o++];
|
|
1019
|
+
if (o < a.length) if (t === "type" || t === "kind") {
|
|
1020
|
+
let t = a[o++];
|
|
1021
|
+
if (!V.includes(t)) throw Error(`Parsing error: link. ID ${e}: Unknown kind ${t} (valid: ${V.join(", ")})`);
|
|
1022
|
+
n.kind = t;
|
|
1023
|
+
} else t === "target" || t === "path" || t === "url" ? n.target = i(a[o++]) : t === "namespace" || t === "ns" ? n.namespace = i(a[o++]) : o++;
|
|
1024
|
+
else throw Error(`Parsing error: link. ID ${e}: Expecting value for ${t}`);
|
|
1025
|
+
}
|
|
1026
|
+
}
|
|
1027
|
+
return (t) => (t.links[e] = n, t);
|
|
1028
|
+
}, Be = function(e) {
|
|
1029
|
+
let t = "link " + e.id + " {\n";
|
|
1030
|
+
return t += " type " + e.kind + "\n", t += " target \"" + o(e.target) + "\"\n", e.namespace && (t += " namespace \"" + o(e.namespace) + "\"\n"), t += "}\n", t;
|
|
1031
|
+
}, Ve = function(e, t) {
|
|
1032
|
+
let n = {
|
|
1033
|
+
namespace: e,
|
|
1034
|
+
description: "",
|
|
1035
|
+
mappings: {}
|
|
1036
|
+
};
|
|
1037
|
+
return m(t, (e, t) => {
|
|
1038
|
+
if (e === "description") n.description = h(t);
|
|
1039
|
+
else if (e === "mapping") {
|
|
1040
|
+
let e = h(t);
|
|
1041
|
+
for (let t of e.split(/\n+/).map((e) => e.trim()).filter((e) => e)) {
|
|
1042
|
+
let e = t.match(/^(\S+)\s*->\s*(\S+)$/);
|
|
1043
|
+
e && (n.mappings[e[1]] = e[2]);
|
|
1044
|
+
}
|
|
1045
|
+
} else return !1;
|
|
1046
|
+
return !0;
|
|
1047
|
+
}, {
|
|
1048
|
+
construct: "map_profile",
|
|
1049
|
+
id: e
|
|
1050
|
+
}), (t) => (t.mapProfiles[e] = n, t);
|
|
1051
|
+
}, He = function(e) {
|
|
1052
|
+
let t = "map_profile " + e.namespace + " {\n";
|
|
1053
|
+
e.description && (t += " description \"" + e.description + "\"\n");
|
|
1054
|
+
let n = Object.keys(e.mappings);
|
|
1055
|
+
if (n.length > 0) {
|
|
1056
|
+
t += " mapping {\n";
|
|
1057
|
+
for (let r of n) t += " " + r + " -> " + e.mappings[r] + "\n";
|
|
1058
|
+
t += " }\n";
|
|
1059
|
+
}
|
|
1060
|
+
return t += "}\n", t;
|
|
1061
|
+
}, Ue = function(e, t) {
|
|
1062
|
+
let n = {
|
|
1063
|
+
id: e,
|
|
1064
|
+
description: "",
|
|
1065
|
+
roles: [],
|
|
1066
|
+
visibleElements: []
|
|
1067
|
+
};
|
|
1068
|
+
return m(t, (e, t) => {
|
|
1069
|
+
if (e === "description") n.description = h(t);
|
|
1070
|
+
else if (e === "roles") n.roles = r(t());
|
|
1071
|
+
else if (e === "visible") n.visibleElements = r(t());
|
|
1072
|
+
else return !1;
|
|
1073
|
+
return !0;
|
|
1074
|
+
}, {
|
|
1075
|
+
construct: "view_profile",
|
|
1076
|
+
id: e
|
|
1077
|
+
}), (t) => (t.viewProfiles[e] = n, t);
|
|
1078
|
+
}, We = function(e) {
|
|
1079
|
+
let t = "view_profile " + e.id + " {\n";
|
|
1080
|
+
return e.description && (t += " description \"" + e.description + "\"\n"), e.roles.length > 0 && (t += " roles " + e.roles.join(" ") + "\n"), e.visibleElements.length > 0 && (t += " visible " + e.visibleElements.join(" ") + "\n"), t += "}\n", t;
|
|
1081
|
+
};
|
|
1082
|
+
//#endregion
|
|
1083
|
+
//#region src/ser-des/config/field-parser.ts
|
|
1084
|
+
function H(e, t) {
|
|
1085
|
+
let n = {
|
|
1086
|
+
name: e,
|
|
1087
|
+
type: "string",
|
|
1088
|
+
label: "",
|
|
1089
|
+
definition: "",
|
|
1090
|
+
unit: "",
|
|
1091
|
+
required: !1,
|
|
1092
|
+
measurementMethod: "",
|
|
1093
|
+
calculationId: null,
|
|
1094
|
+
calculationBindings: [],
|
|
1095
|
+
derivation: "",
|
|
1096
|
+
evaluation: null,
|
|
1097
|
+
values: [],
|
|
1098
|
+
defaultValue: "",
|
|
1099
|
+
hasDefault: !1,
|
|
1100
|
+
referenceIds: [],
|
|
1101
|
+
fields: [],
|
|
1102
|
+
itemsType: "",
|
|
1103
|
+
subformRef: null
|
|
1104
|
+
};
|
|
1105
|
+
if (!t || !t.trim()) return n;
|
|
1106
|
+
let o = r(t), s = 0;
|
|
1107
|
+
for (; s < o.length;) {
|
|
1108
|
+
let e = o[s++];
|
|
1109
|
+
if (s >= o.length) break;
|
|
1110
|
+
e === "label" ? n.label = i(o[s++]) : e === "definition" ? n.definition = i(o[s++]) : e === "unit" ? n.unit = i(o[s++]) : e === "required" ? n.required = i(o[s++]) === "true" : e === "measurement_method" ? n.measurementMethod = i(o[s++]) : e === "calculation" ? n.calculationId = a(o[s++]) : e === "calculation_bindings" ? i(o[s++]) : e === "derivation" ? n.derivation = i(o[s++]) : e === "evaluation" ? i(o[s++]) : e === "values" ? n.values = r(o[s++]) : e === "default" ? (n.defaultValue = i(o[s++]), n.hasDefault = !0) : e === "min_items" || e === "max_items" || e === "items" || e === "fields" ? i(o[s++]) : e === "reference" ? n.referenceIds = r(o[s++]) : i(o[s++]);
|
|
1111
|
+
}
|
|
1112
|
+
return n;
|
|
1113
|
+
}
|
|
1114
|
+
//#endregion
|
|
1115
|
+
//#region src/ser-des/config/form.ts
|
|
1116
|
+
var Ge = function(e, t) {
|
|
1117
|
+
let n = {
|
|
1118
|
+
id: e,
|
|
1119
|
+
name: "",
|
|
1120
|
+
description: "",
|
|
1121
|
+
dataClassId: "",
|
|
1122
|
+
headerFormId: "",
|
|
1123
|
+
conformanceProcessId: "",
|
|
1124
|
+
applicability: [],
|
|
1125
|
+
fields: [],
|
|
1126
|
+
passFail: null,
|
|
1127
|
+
referenceIds: [],
|
|
1128
|
+
ref: []
|
|
1129
|
+
};
|
|
1130
|
+
if (t !== "") {
|
|
1131
|
+
let o = r(t), s = 0;
|
|
1132
|
+
for (; s < o.length;) {
|
|
1133
|
+
let t = o[s++];
|
|
1134
|
+
if (s < o.length) if (t === "name") n.name = i(o[s++]);
|
|
1135
|
+
else if (t === "description") n.description = i(o[s++]);
|
|
1136
|
+
else if (t === "data_class") n.dataClassId = a(o[s++]);
|
|
1137
|
+
else if (t === "header") n.headerFormId = a(o[s++]);
|
|
1138
|
+
else if (t === "conformance_process") n.conformanceProcessId = a(o[s++]);
|
|
1139
|
+
else if (t === "applicability") n.applicability = U(i(o[s++]));
|
|
1140
|
+
else if (t === "field") {
|
|
1141
|
+
let e = o[s++];
|
|
1142
|
+
if (s < o.length) {
|
|
1143
|
+
let t = i(o[s++]);
|
|
1144
|
+
n.fields.push(H(e, t));
|
|
1145
|
+
}
|
|
1146
|
+
} else if (t === "subform_ref") {
|
|
1147
|
+
let e = o[s++], t = s < o.length ? i(o[s++]) : "";
|
|
1148
|
+
n.fields.push(qe(e, t));
|
|
1149
|
+
} else t === "pass_fail" ? n.passFail = Ke(i(o[s++])) : t === "reference" ? n.referenceIds = r(o[s++]) : s++;
|
|
1150
|
+
else throw Error(`Parsing error: form. ID ${e}: Expecting value for ${t}`);
|
|
1151
|
+
}
|
|
1152
|
+
}
|
|
1153
|
+
return (t) => (t.forms[e] = n, t);
|
|
1154
|
+
};
|
|
1155
|
+
function U(e) {
|
|
1156
|
+
let t = [], n = r(e), a = 0;
|
|
1157
|
+
for (; a < n.length;) {
|
|
1158
|
+
let e = n[a++];
|
|
1159
|
+
if (a >= n.length) break;
|
|
1160
|
+
if (n[a] === ":" && a++, a < n.length) {
|
|
1161
|
+
let r = i(n[a++]).trim();
|
|
1162
|
+
if (r.startsWith("[")) {
|
|
1163
|
+
let n = r.slice(1, -1).split(/[,\s]+/).filter((e) => e.length > 0);
|
|
1164
|
+
t.push({
|
|
1165
|
+
dimension: e,
|
|
1166
|
+
values: n,
|
|
1167
|
+
mapping: null
|
|
1168
|
+
});
|
|
1169
|
+
} else if (r.startsWith("{")) {
|
|
1170
|
+
let n = r.slice(1, -1), i = {};
|
|
1171
|
+
for (let e of n.split(/[,\n]+/).map((e) => e.trim()).filter((e) => e)) {
|
|
1172
|
+
let t = e.match(/^(\w+)\s*:\s*(.+)$/);
|
|
1173
|
+
t && (i[t[1]] = t[2].trim());
|
|
1174
|
+
}
|
|
1175
|
+
t.push({
|
|
1176
|
+
dimension: e,
|
|
1177
|
+
values: [],
|
|
1178
|
+
mapping: i
|
|
1179
|
+
});
|
|
1180
|
+
} else t.push({
|
|
1181
|
+
dimension: e,
|
|
1182
|
+
values: [r],
|
|
1183
|
+
mapping: null
|
|
1184
|
+
});
|
|
1185
|
+
}
|
|
1186
|
+
}
|
|
1187
|
+
return t;
|
|
1188
|
+
}
|
|
1189
|
+
function Ke(e) {
|
|
1190
|
+
let t = {
|
|
1191
|
+
criteria: "",
|
|
1192
|
+
passIf: ""
|
|
1193
|
+
}, n = r(e), a = 0;
|
|
1194
|
+
for (; a < n.length;) {
|
|
1195
|
+
let e = n[a++];
|
|
1196
|
+
a < n.length && (e === "criteria" ? t.criteria = i(n[a++]) : e === "pass_if" ? t.passIf = i(n[a++]) : i(n[a++]));
|
|
1197
|
+
}
|
|
1198
|
+
return t;
|
|
1199
|
+
}
|
|
1200
|
+
function qe(e, t) {
|
|
1201
|
+
return {
|
|
1202
|
+
name: "",
|
|
1203
|
+
type: "array",
|
|
1204
|
+
label: "",
|
|
1205
|
+
definition: "",
|
|
1206
|
+
unit: "",
|
|
1207
|
+
required: !1,
|
|
1208
|
+
measurementMethod: "",
|
|
1209
|
+
calculationId: null,
|
|
1210
|
+
calculationBindings: [],
|
|
1211
|
+
derivation: "",
|
|
1212
|
+
evaluation: null,
|
|
1213
|
+
values: [],
|
|
1214
|
+
defaultValue: "",
|
|
1215
|
+
hasDefault: !1,
|
|
1216
|
+
referenceIds: [],
|
|
1217
|
+
fields: [],
|
|
1218
|
+
itemsType: "",
|
|
1219
|
+
subformRef: Je(e, t)
|
|
1220
|
+
};
|
|
1221
|
+
}
|
|
1222
|
+
function Je(e, t) {
|
|
1223
|
+
let n = {
|
|
1224
|
+
subformId: e,
|
|
1225
|
+
parameters: {},
|
|
1226
|
+
applicability: []
|
|
1227
|
+
};
|
|
1228
|
+
if (t && t.trim()) {
|
|
1229
|
+
let e = r(t), a = 0;
|
|
1230
|
+
for (; a < e.length;) {
|
|
1231
|
+
let t = e[a++];
|
|
1232
|
+
if (a < e.length) if (t === "parameters") {
|
|
1233
|
+
let t = r(i(e[a++])), o = 0;
|
|
1234
|
+
for (; o < t.length;) {
|
|
1235
|
+
let e = t[o++];
|
|
1236
|
+
o < t.length && (t[o] === ":" && o++, o < t.length && (n.parameters[e] = i(t[o++])));
|
|
1237
|
+
}
|
|
1238
|
+
} else t === "applicability" ? n.applicability = U(i(e[a++])) : i(e[a++]);
|
|
1239
|
+
}
|
|
1240
|
+
}
|
|
1241
|
+
return n;
|
|
1242
|
+
}
|
|
1243
|
+
var Ye = function(e) {
|
|
1244
|
+
let t = "form " + e.id + " {\n";
|
|
1245
|
+
if (t += " name \"" + o(e.name) + "\"\n", e.description && (t += " description \"" + o(e.description) + "\"\n"), e.dataClassId && (t += " data_class " + e.dataClassId + "\n"), e.headerFormId && (t += " header " + e.headerFormId + "\n"), e.conformanceProcessId && (t += " conformance_process " + e.conformanceProcessId + "\n"), e.applicability.length > 0) {
|
|
1246
|
+
t += " applicability {\n";
|
|
1247
|
+
for (let n of e.applicability) if (n.mapping) {
|
|
1248
|
+
t += " " + n.dimension + ": { ";
|
|
1249
|
+
for (let [e, r] of Object.entries(n.mapping)) t += e + ": " + r + " ";
|
|
1250
|
+
t += "}\n";
|
|
1251
|
+
} else t += " " + n.dimension + ": [" + n.values.join(", ") + "]\n";
|
|
1252
|
+
t += " }\n";
|
|
1253
|
+
}
|
|
1254
|
+
for (let n of e.fields) if (n.subformRef) {
|
|
1255
|
+
let e = n.subformRef;
|
|
1256
|
+
t += " subform_ref " + e.subformId + " { ";
|
|
1257
|
+
let r = Object.keys(e.parameters);
|
|
1258
|
+
if (r.length > 0) {
|
|
1259
|
+
t += "parameters { ";
|
|
1260
|
+
for (let n of r) t += n + ": " + e.parameters[n] + " ";
|
|
1261
|
+
t += "} ";
|
|
1262
|
+
}
|
|
1263
|
+
t += "}\n";
|
|
1264
|
+
} else t += " field " + n.name + " { ", n.label && (t += "label \"" + o(n.label) + "\" "), n.unit && (t += "unit \"" + o(n.unit) + "\" "), n.required && (t += "required true "), t += "}\n";
|
|
1265
|
+
return e.passFail && (t += " pass_fail { criteria \"" + o(e.passFail.criteria) + "\" pass_if \"" + o(e.passFail.passIf) + "\" }\n"), t += "}\n", t;
|
|
1266
|
+
}, Xe = function(e, t) {
|
|
1267
|
+
let n = {
|
|
1268
|
+
id: e,
|
|
1269
|
+
description: "",
|
|
1270
|
+
shapeType: "object",
|
|
1271
|
+
parameters: [],
|
|
1272
|
+
fields: []
|
|
1273
|
+
};
|
|
1274
|
+
if (t !== "") {
|
|
1275
|
+
let a = r(t), o = 0;
|
|
1276
|
+
for (; o < a.length;) {
|
|
1277
|
+
let t = a[o++];
|
|
1278
|
+
if (o < a.length) if (t === "description") n.description = i(a[o++]);
|
|
1279
|
+
else if (t === "type") {
|
|
1280
|
+
let t = a[o++];
|
|
1281
|
+
if (t === "object" || t === "array") n.shapeType = t;
|
|
1282
|
+
else throw Error(`Parsing error: subform. ID ${e}: type must be object or array (got ${t})`);
|
|
1283
|
+
} else if (t === "parameters") n.parameters = Ze(i(a[o++]));
|
|
1284
|
+
else if (t === "field") {
|
|
1285
|
+
let e = a[o++];
|
|
1286
|
+
if (o < a.length) {
|
|
1287
|
+
let t = H(e, i(a[o++]));
|
|
1288
|
+
n.fields.push(t);
|
|
1289
|
+
}
|
|
1290
|
+
} else o++;
|
|
1291
|
+
else throw Error(`Parsing error: subform. ID ${e}: Expecting value for ${t}`);
|
|
1292
|
+
}
|
|
1293
|
+
}
|
|
1294
|
+
return (t) => (t.subforms[e] = n, t);
|
|
1295
|
+
};
|
|
1296
|
+
function Ze(e) {
|
|
1297
|
+
let t = [], n = r(e), a = 0;
|
|
1298
|
+
for (; a < n.length;) {
|
|
1299
|
+
let e = n[a++];
|
|
1300
|
+
if (a >= n.length) break;
|
|
1301
|
+
n[a] === ":" && a++;
|
|
1302
|
+
let o = a < n.length ? n[a++] : "integer", s = "", c = !1, l = "", u = null;
|
|
1303
|
+
if (a < n.length && n[a].startsWith("{")) {
|
|
1304
|
+
let e = r(i(n[a++])), t = 0;
|
|
1305
|
+
for (; t < e.length;) {
|
|
1306
|
+
let n = e[t++];
|
|
1307
|
+
if (t < e.length) if (n === "description") s = i(e[t++]);
|
|
1308
|
+
else if (n === "default") l = i(e[t++]), c = !0;
|
|
1309
|
+
else if (n === "mapping") {
|
|
1310
|
+
let n = i(e[t++]);
|
|
1311
|
+
u = {};
|
|
1312
|
+
let a = r(n), o = 0;
|
|
1313
|
+
for (; o < a.length;) {
|
|
1314
|
+
let e = a[o++];
|
|
1315
|
+
o < a.length && (a[o] === ":" && o++, o < a.length && (u[e] = i(a[o++])));
|
|
1316
|
+
}
|
|
1317
|
+
} else t++;
|
|
1318
|
+
}
|
|
1319
|
+
}
|
|
1320
|
+
t.push({
|
|
1321
|
+
name: e,
|
|
1322
|
+
type: o,
|
|
1323
|
+
description: s,
|
|
1324
|
+
hasDefault: c,
|
|
1325
|
+
defaultValue: l,
|
|
1326
|
+
mapping: u
|
|
1327
|
+
});
|
|
1328
|
+
}
|
|
1329
|
+
return t;
|
|
1330
|
+
}
|
|
1331
|
+
var Qe = function(e) {
|
|
1332
|
+
let t = "subform " + e.id + " {\n";
|
|
1333
|
+
if (t += " type " + e.shapeType + "\n", e.description && (t += " description \"" + o(e.description) + "\"\n"), e.parameters.length > 0) {
|
|
1334
|
+
t += " parameters {\n";
|
|
1335
|
+
for (let n of e.parameters) {
|
|
1336
|
+
let e = " " + n.name + " : " + n.type + " { ";
|
|
1337
|
+
if (n.description && (e += "description \"" + o(n.description) + "\" "), n.hasDefault && (e += "default " + n.defaultValue + " "), n.mapping) {
|
|
1338
|
+
e += "mapping { ";
|
|
1339
|
+
for (let [t, r] of Object.entries(n.mapping)) e += t + ": " + r + " ";
|
|
1340
|
+
e += "} ";
|
|
1341
|
+
}
|
|
1342
|
+
e += "}\n", t += e;
|
|
1343
|
+
}
|
|
1344
|
+
t += " }\n";
|
|
1345
|
+
}
|
|
1346
|
+
for (let n of e.fields) t += " field " + n.name + " { ", n.label && (t += "label \"" + o(n.label) + "\" "), n.unit && (t += "unit \"" + o(n.unit) + "\" "), n.required && (t += "required true "), t += "}\n";
|
|
1347
|
+
return t += "}\n", t;
|
|
1348
|
+
}, W = [
|
|
1349
|
+
"number",
|
|
1350
|
+
"integer",
|
|
1351
|
+
"string",
|
|
1352
|
+
"boolean",
|
|
1353
|
+
"enum"
|
|
1354
|
+
], $e = function(e, t) {
|
|
1355
|
+
let n = {
|
|
1356
|
+
id: e,
|
|
1357
|
+
name: "",
|
|
1358
|
+
definition: "",
|
|
1359
|
+
type: "number",
|
|
1360
|
+
unit: "1",
|
|
1361
|
+
latex: "",
|
|
1362
|
+
values: [],
|
|
1363
|
+
ref: [],
|
|
1364
|
+
_relations: { ref: [] }
|
|
1365
|
+
};
|
|
1366
|
+
return m(t, (t, i) => {
|
|
1367
|
+
if (t === "name") n.name = h(i);
|
|
1368
|
+
else if (t === "definition") n.definition = h(i);
|
|
1369
|
+
else if (t === "type") {
|
|
1370
|
+
let t = i();
|
|
1371
|
+
if (!W.includes(t)) throw Error(`Parsing error: symbol. ID ${e}: Unknown type ${t} (valid: ${W.join(", ")})`);
|
|
1372
|
+
n.type = t;
|
|
1373
|
+
} else if (t === "unit") n.unit = h(i);
|
|
1374
|
+
else if (t === "latex") n.latex = h(i);
|
|
1375
|
+
else if (t === "values") n.values = r(i());
|
|
1376
|
+
else if (t === "reference") n._relations.ref = r(i());
|
|
1377
|
+
else return !1;
|
|
1378
|
+
return !0;
|
|
1379
|
+
}, {
|
|
1380
|
+
construct: "symbol",
|
|
1381
|
+
id: e
|
|
1382
|
+
}), (t) => (t.symbols[e] = n, t);
|
|
1383
|
+
}, et = function(e, t) {
|
|
1384
|
+
let n = [];
|
|
1385
|
+
for (let r of t._relations.ref) {
|
|
1386
|
+
let t = d(e, "references", r);
|
|
1387
|
+
t !== void 0 && n.push(t);
|
|
1388
|
+
}
|
|
1389
|
+
return {
|
|
1390
|
+
...t,
|
|
1391
|
+
ref: n
|
|
1392
|
+
};
|
|
1393
|
+
}, tt = function(e) {
|
|
1394
|
+
let t = "symbol " + e.id + " {\n";
|
|
1395
|
+
if (t += " name \"" + o(e.name) + "\"\n", e.definition && (t += " definition \"" + o(e.definition) + "\"\n"), t += " type " + e.type + "\n", e.unit && e.unit !== "1" && (t += " unit \"" + o(e.unit) + "\"\n"), e.latex && (t += " latex \"" + o(e.latex) + "\"\n"), e.values.length > 0 && (t += " values " + e.values.join(" ") + "\n"), e.ref.length > 0) {
|
|
1396
|
+
t += " reference {\n";
|
|
1397
|
+
for (let n of e.ref) t += " " + n.id + "\n";
|
|
1398
|
+
t += " }\n";
|
|
1399
|
+
}
|
|
1400
|
+
return t += "}\n", t;
|
|
1401
|
+
}, nt = function(e, t) {
|
|
1402
|
+
let n = {
|
|
1403
|
+
id: e,
|
|
1404
|
+
name: "",
|
|
1405
|
+
description: "",
|
|
1406
|
+
inputs: [],
|
|
1407
|
+
output: {
|
|
1408
|
+
type: "number",
|
|
1409
|
+
unit: "1"
|
|
1410
|
+
},
|
|
1411
|
+
expression: "",
|
|
1412
|
+
ref: [],
|
|
1413
|
+
_relations: { ref: [] }
|
|
1414
|
+
};
|
|
1415
|
+
if (t !== "") {
|
|
1416
|
+
let a = r(t), o = 0;
|
|
1417
|
+
for (; o < a.length;) {
|
|
1418
|
+
let t = a[o++];
|
|
1419
|
+
if (o < a.length) t === "name" ? n.name = i(a[o++]) : t === "description" ? n.description = i(a[o++]) : t === "expression" ? n.expression = i(a[o++]) : t === "reference" ? n._relations.ref = r(a[o++]) : t === "inputs" ? n.inputs = rt(i(a[o++])) : t === "output" ? n.output = it(i(a[o++])) : o++;
|
|
1420
|
+
else throw Error(`Parsing error: calculation. ID ${e}: Expecting value for ${t}`);
|
|
1421
|
+
}
|
|
1422
|
+
}
|
|
1423
|
+
return (t) => (t.calculations[e] = n, t);
|
|
1424
|
+
};
|
|
1425
|
+
function rt(e) {
|
|
1426
|
+
let t = [], n = r(e), a = 0;
|
|
1427
|
+
for (; a < n.length;) {
|
|
1428
|
+
let e = n[a++];
|
|
1429
|
+
if (a >= n.length) break;
|
|
1430
|
+
n[a] === ":" && a++;
|
|
1431
|
+
let o = a < n.length ? n[a++] : "number", s = "1", c = "", l = "", u = !1;
|
|
1432
|
+
if (a < n.length && n[a].startsWith("{")) {
|
|
1433
|
+
let e = r(i(n[a++])), t = 0;
|
|
1434
|
+
for (; t < e.length;) {
|
|
1435
|
+
let n = e[t++];
|
|
1436
|
+
t < e.length && (n === "unit" ? s = i(e[t++]) : n === "description" ? c = i(e[t++]) : n === "default" ? (l = i(e[t++]), u = !0) : t++);
|
|
1437
|
+
}
|
|
1438
|
+
}
|
|
1439
|
+
t.push({
|
|
1440
|
+
name: e,
|
|
1441
|
+
type: o,
|
|
1442
|
+
unit: s,
|
|
1443
|
+
description: c,
|
|
1444
|
+
defaultValue: l,
|
|
1445
|
+
hasDefault: u
|
|
1446
|
+
});
|
|
1447
|
+
}
|
|
1448
|
+
return t;
|
|
1449
|
+
}
|
|
1450
|
+
function it(e) {
|
|
1451
|
+
let t = r(e), n = 0, a = "number", o = "1";
|
|
1452
|
+
if (t[n] === ":" && n++, n < t.length && (a = t[n++]), n < t.length && t[n].startsWith("{")) {
|
|
1453
|
+
let e = r(i(t[n++])), a = 0;
|
|
1454
|
+
for (; a < e.length;) {
|
|
1455
|
+
let t = e[a++];
|
|
1456
|
+
a < e.length && (t === "unit" ? o = i(e[a++]) : a++);
|
|
1457
|
+
}
|
|
1458
|
+
}
|
|
1459
|
+
return {
|
|
1460
|
+
type: a,
|
|
1461
|
+
unit: o
|
|
1462
|
+
};
|
|
1463
|
+
}
|
|
1464
|
+
var at = function(e, t) {
|
|
1465
|
+
let n = [];
|
|
1466
|
+
for (let r of t._relations.ref) {
|
|
1467
|
+
let t = d(e, "references", r);
|
|
1468
|
+
t !== void 0 && n.push(t);
|
|
1469
|
+
}
|
|
1470
|
+
return {
|
|
1471
|
+
...t,
|
|
1472
|
+
ref: n
|
|
1473
|
+
};
|
|
1474
|
+
}, ot = function(e) {
|
|
1475
|
+
let t = "calculation " + e.id + " {\n";
|
|
1476
|
+
if (t += " name \"" + o(e.name) + "\"\n", e.description && (t += " description \"" + o(e.description) + "\"\n"), e.inputs.length > 0) {
|
|
1477
|
+
t += " inputs {\n";
|
|
1478
|
+
for (let n of e.inputs) {
|
|
1479
|
+
let e = " " + n.name + " : " + n.type + " { ";
|
|
1480
|
+
e += "unit \"" + o(n.unit) + "\"", n.description && (e += " description \"" + o(n.description) + "\""), n.hasDefault && (e += " default " + n.defaultValue), e += " }\n", t += e;
|
|
1481
|
+
}
|
|
1482
|
+
t += " }\n";
|
|
1483
|
+
}
|
|
1484
|
+
if (t += " output : " + e.output.type + " { unit \"" + o(e.output.unit) + "\" }\n", t += " expression \"" + o(e.expression) + "\"\n", e.ref.length > 0) {
|
|
1485
|
+
t += " reference {\n";
|
|
1486
|
+
for (let n of e.ref) t += " " + n.id + "\n";
|
|
1487
|
+
t += " }\n";
|
|
1488
|
+
}
|
|
1489
|
+
return t += "}\n", t;
|
|
1490
|
+
}, st = function(e, t) {
|
|
1491
|
+
let n = {
|
|
1492
|
+
entityName: e,
|
|
1493
|
+
initialState: "",
|
|
1494
|
+
states: [],
|
|
1495
|
+
transitions: [],
|
|
1496
|
+
referenceIds: []
|
|
1497
|
+
};
|
|
1498
|
+
if (t !== "") {
|
|
1499
|
+
let a = r(t), o = 0;
|
|
1500
|
+
for (; o < a.length;) {
|
|
1501
|
+
let t = a[o++];
|
|
1502
|
+
if (o < a.length) if (t === "initial") n.initialState = a[o++];
|
|
1503
|
+
else if (t === "states") {
|
|
1504
|
+
let e = i(a[o++]);
|
|
1505
|
+
for (let t of e.split(/\s+/).filter((e) => e.length > 0)) n.states.push({ name: t });
|
|
1506
|
+
} else if (t === "transition") {
|
|
1507
|
+
let e = a[o++];
|
|
1508
|
+
o < a.length && (a[o] === "->" || a[o] === "→") && o++;
|
|
1509
|
+
let t = o < a.length ? a[o++] : "", s = "";
|
|
1510
|
+
o < a.length && a[o] === "action" && (o++, o < a.length && (s = a[o++]));
|
|
1511
|
+
let c = "", l = [], u = [];
|
|
1512
|
+
if (o < a.length && a[o].startsWith("{")) {
|
|
1513
|
+
let e = r(i(a[o++])), t = 0;
|
|
1514
|
+
for (; t < e.length;) {
|
|
1515
|
+
let n = e[t++];
|
|
1516
|
+
if (t < e.length) if (n === "guard") c = i(e[t++]);
|
|
1517
|
+
else if (n === "cascade") {
|
|
1518
|
+
let n = e[t++];
|
|
1519
|
+
if (t < e.length) {
|
|
1520
|
+
let r = i(e[t++]);
|
|
1521
|
+
l.push(ct(n, r));
|
|
1522
|
+
}
|
|
1523
|
+
} else n === "reference" ? u.push(...r(e[t++])) : i(e[t++]);
|
|
1524
|
+
}
|
|
1525
|
+
}
|
|
1526
|
+
let d = {
|
|
1527
|
+
from: e,
|
|
1528
|
+
to: t,
|
|
1529
|
+
actionName: s,
|
|
1530
|
+
guard: c,
|
|
1531
|
+
cascades: l,
|
|
1532
|
+
referenceIds: u
|
|
1533
|
+
};
|
|
1534
|
+
n.transitions.push(d);
|
|
1535
|
+
} else t === "reference" ? n.referenceIds.push(...r(a[o++])) : o++;
|
|
1536
|
+
else throw Error(`Parsing error: state_machine. Entity ${e}: Expecting value for ${t}`);
|
|
1537
|
+
}
|
|
1538
|
+
}
|
|
1539
|
+
return (t) => (t.stateMachines[e] = n, t);
|
|
1540
|
+
};
|
|
1541
|
+
function ct(e, t) {
|
|
1542
|
+
let n = {
|
|
1543
|
+
targetEntity: e,
|
|
1544
|
+
where: "",
|
|
1545
|
+
set: []
|
|
1546
|
+
}, a = r(t), o = 0;
|
|
1547
|
+
for (; o < a.length;) {
|
|
1548
|
+
let e = a[o++];
|
|
1549
|
+
if (o < a.length) if (e === "where") n.where = i(a[o++]);
|
|
1550
|
+
else if (e === "set") {
|
|
1551
|
+
let e = r(i(a[o++])), t = 0;
|
|
1552
|
+
for (; t < e.length;) {
|
|
1553
|
+
let r = e[t++];
|
|
1554
|
+
if (t < e.length && (e[t] === ":" && t++, t < e.length)) {
|
|
1555
|
+
let a = {
|
|
1556
|
+
field: r,
|
|
1557
|
+
value: i(e[t++])
|
|
1558
|
+
};
|
|
1559
|
+
n.set.push(a);
|
|
1560
|
+
}
|
|
1561
|
+
}
|
|
1562
|
+
} else i(a[o++]);
|
|
1563
|
+
}
|
|
1564
|
+
return n;
|
|
1565
|
+
}
|
|
1566
|
+
var lt = function(e) {
|
|
1567
|
+
let t = "state_machine " + e.entityName + " {\n";
|
|
1568
|
+
if (t += " initial " + e.initialState + "\n", e.states.length > 0) {
|
|
1569
|
+
t += " states {\n";
|
|
1570
|
+
for (let n of e.states) t += " " + n.name + "\n";
|
|
1571
|
+
t += " }\n";
|
|
1572
|
+
}
|
|
1573
|
+
for (let n of e.transitions) {
|
|
1574
|
+
t += " transition " + n.from + " -> " + n.to, n.actionName && (t += " action " + n.actionName), t += " {\n", n.guard && (t += " guard \"" + o(n.guard) + "\"\n");
|
|
1575
|
+
for (let e of n.cascades) {
|
|
1576
|
+
if (t += " cascade " + e.targetEntity + " {\n", e.where && (t += " where \"" + o(e.where) + "\"\n"), e.set.length > 0) {
|
|
1577
|
+
t += " set {\n";
|
|
1578
|
+
for (let n of e.set) t += " " + n.field + ": \"" + o(n.value) + "\"\n";
|
|
1579
|
+
t += " }\n";
|
|
1580
|
+
}
|
|
1581
|
+
t += " }\n";
|
|
1582
|
+
}
|
|
1583
|
+
t += " }\n";
|
|
1584
|
+
}
|
|
1585
|
+
return t += "}\n", t;
|
|
1586
|
+
}, ut = function(e, t) {
|
|
1587
|
+
let n = {
|
|
1588
|
+
id: e,
|
|
1589
|
+
label: "",
|
|
1590
|
+
definition: "",
|
|
1591
|
+
symbolId: "",
|
|
1592
|
+
referenceIds: [],
|
|
1593
|
+
ref: []
|
|
1594
|
+
};
|
|
1595
|
+
return m(t, (e, t) => {
|
|
1596
|
+
if (e === "label") n.label = h(t);
|
|
1597
|
+
else if (e === "definition") n.definition = h(t);
|
|
1598
|
+
else if (e === "symbol") n.symbolId = a(t());
|
|
1599
|
+
else if (e === "reference") n.referenceIds = r(t());
|
|
1600
|
+
else return !1;
|
|
1601
|
+
return !0;
|
|
1602
|
+
}, {
|
|
1603
|
+
construct: "term",
|
|
1604
|
+
id: e
|
|
1605
|
+
}), (t) => (t.terms[e] = n, t);
|
|
1606
|
+
}, dt = function(e) {
|
|
1607
|
+
let t = "term " + e.id + " {\n";
|
|
1608
|
+
if (e.label && (t += " label \"" + o(e.label) + "\"\n"), e.definition && (t += " definition \"" + o(e.definition) + "\"\n"), e.symbolId && (t += " symbol " + e.symbolId + "\n"), e.referenceIds.length > 0) {
|
|
1609
|
+
t += " reference {\n";
|
|
1610
|
+
for (let n of e.referenceIds) t += " " + n + "\n";
|
|
1611
|
+
t += " }\n";
|
|
1612
|
+
}
|
|
1613
|
+
return t += "}\n", t;
|
|
1614
|
+
};
|
|
1615
|
+
//#endregion
|
|
1616
|
+
//#region src/ser-des/config/index.ts
|
|
1617
|
+
function G(e) {
|
|
1618
|
+
return e;
|
|
1619
|
+
}
|
|
1620
|
+
var K = [
|
|
1621
|
+
G({
|
|
1622
|
+
keyword: "role",
|
|
1623
|
+
field: "roles",
|
|
1624
|
+
takesID: !0,
|
|
1625
|
+
parse: be,
|
|
1626
|
+
dump: xe
|
|
1627
|
+
}),
|
|
1628
|
+
G({
|
|
1629
|
+
keyword: "provision",
|
|
1630
|
+
field: "provisions",
|
|
1631
|
+
takesID: !0,
|
|
1632
|
+
parse: I,
|
|
1633
|
+
resolve: L,
|
|
1634
|
+
dump: _e
|
|
1635
|
+
}),
|
|
1636
|
+
G({
|
|
1637
|
+
keyword: "process",
|
|
1638
|
+
field: "processes",
|
|
1639
|
+
takesID: !0,
|
|
1640
|
+
parse: g,
|
|
1641
|
+
resolve: ne,
|
|
1642
|
+
dump: v
|
|
1643
|
+
}),
|
|
1644
|
+
G({
|
|
1645
|
+
keyword: "approval",
|
|
1646
|
+
field: "approvals",
|
|
1647
|
+
takesID: !0,
|
|
1648
|
+
parse: ae,
|
|
1649
|
+
resolve: oe,
|
|
1650
|
+
dump: se
|
|
1651
|
+
}),
|
|
1652
|
+
G({
|
|
1653
|
+
keyword: "class",
|
|
1654
|
+
field: "dataclasses",
|
|
1655
|
+
takesID: !0,
|
|
1656
|
+
parse: de,
|
|
1657
|
+
resolve: pe,
|
|
1658
|
+
dump: he
|
|
1659
|
+
}),
|
|
1660
|
+
G({
|
|
1661
|
+
keyword: "enum",
|
|
1662
|
+
field: "enums",
|
|
1663
|
+
takesID: !0,
|
|
1664
|
+
parse: ce,
|
|
1665
|
+
dump: b
|
|
1666
|
+
}),
|
|
1667
|
+
G({
|
|
1668
|
+
keyword: "data_registry",
|
|
1669
|
+
field: "regs",
|
|
1670
|
+
takesID: !0,
|
|
1671
|
+
parse: ue,
|
|
1672
|
+
resolve: me,
|
|
1673
|
+
dump: x
|
|
1674
|
+
}),
|
|
1675
|
+
G({
|
|
1676
|
+
keyword: "variable",
|
|
1677
|
+
field: "variables",
|
|
1678
|
+
takesID: !0,
|
|
1679
|
+
parse: S,
|
|
1680
|
+
dump: C
|
|
1681
|
+
}),
|
|
1682
|
+
G({
|
|
1683
|
+
keyword: "exclusive_gateway",
|
|
1684
|
+
field: "gateways",
|
|
1685
|
+
takesID: !0,
|
|
1686
|
+
parse: N,
|
|
1687
|
+
dump: P
|
|
1688
|
+
}),
|
|
1689
|
+
G({
|
|
1690
|
+
keyword: "start",
|
|
1691
|
+
aliases: ["start_event"],
|
|
1692
|
+
field: "events",
|
|
1693
|
+
takesID: !0,
|
|
1694
|
+
parse: E,
|
|
1695
|
+
dump: O
|
|
1696
|
+
}),
|
|
1697
|
+
G({
|
|
1698
|
+
keyword: "end",
|
|
1699
|
+
aliases: ["end_event"],
|
|
1700
|
+
field: "events",
|
|
1701
|
+
takesID: !0,
|
|
1702
|
+
parse: w,
|
|
1703
|
+
dump: O
|
|
1704
|
+
}),
|
|
1705
|
+
G({
|
|
1706
|
+
keyword: "signalcatch",
|
|
1707
|
+
aliases: ["signal_catch_event"],
|
|
1708
|
+
field: "events",
|
|
1709
|
+
takesID: !0,
|
|
1710
|
+
parse: T,
|
|
1711
|
+
dump: O
|
|
1712
|
+
}),
|
|
1713
|
+
G({
|
|
1714
|
+
keyword: "timer",
|
|
1715
|
+
aliases: ["timer_event"],
|
|
1716
|
+
field: "events",
|
|
1717
|
+
takesID: !0,
|
|
1718
|
+
parse: D,
|
|
1719
|
+
dump: O
|
|
1720
|
+
}),
|
|
1721
|
+
G({
|
|
1722
|
+
keyword: "reference",
|
|
1723
|
+
field: "references",
|
|
1724
|
+
takesID: !0,
|
|
1725
|
+
parse: ve,
|
|
1726
|
+
dump: ye
|
|
1727
|
+
}),
|
|
1728
|
+
G({
|
|
1729
|
+
keyword: "canvas",
|
|
1730
|
+
aliases: ["subprocess"],
|
|
1731
|
+
field: "pages",
|
|
1732
|
+
takesID: !0,
|
|
1733
|
+
parse: Se,
|
|
1734
|
+
resolve: De,
|
|
1735
|
+
dump: ke
|
|
1736
|
+
}),
|
|
1737
|
+
G({
|
|
1738
|
+
keyword: "note",
|
|
1739
|
+
field: "notes",
|
|
1740
|
+
takesID: !0,
|
|
1741
|
+
parse: je,
|
|
1742
|
+
resolve: Me,
|
|
1743
|
+
dump: Ne
|
|
1744
|
+
}),
|
|
1745
|
+
G({
|
|
1746
|
+
keyword: "table",
|
|
1747
|
+
field: "tables",
|
|
1748
|
+
takesID: !0,
|
|
1749
|
+
parse: Pe,
|
|
1750
|
+
dump: Ie
|
|
1751
|
+
}),
|
|
1752
|
+
G({
|
|
1753
|
+
keyword: "figure",
|
|
1754
|
+
field: "figures",
|
|
1755
|
+
takesID: !0,
|
|
1756
|
+
parse: Le,
|
|
1757
|
+
dump: Re
|
|
1758
|
+
}),
|
|
1759
|
+
G({
|
|
1760
|
+
keyword: "link",
|
|
1761
|
+
field: "links",
|
|
1762
|
+
takesID: !0,
|
|
1763
|
+
parse: ze,
|
|
1764
|
+
dump: Be
|
|
1765
|
+
}),
|
|
1766
|
+
G({
|
|
1767
|
+
keyword: "map_profile",
|
|
1768
|
+
field: "mapProfiles",
|
|
1769
|
+
takesID: !0,
|
|
1770
|
+
parse: Ve,
|
|
1771
|
+
dump: He
|
|
1772
|
+
}),
|
|
1773
|
+
G({
|
|
1774
|
+
keyword: "view_profile",
|
|
1775
|
+
field: "viewProfiles",
|
|
1776
|
+
takesID: !0,
|
|
1777
|
+
parse: Ue,
|
|
1778
|
+
dump: We
|
|
1779
|
+
}),
|
|
1780
|
+
G({
|
|
1781
|
+
keyword: "term",
|
|
1782
|
+
field: "terms",
|
|
1783
|
+
takesID: !0,
|
|
1784
|
+
parse: ut,
|
|
1785
|
+
dump: dt
|
|
1786
|
+
}),
|
|
1787
|
+
G({
|
|
1788
|
+
keyword: "form",
|
|
1789
|
+
field: "forms",
|
|
1790
|
+
takesID: !0,
|
|
1791
|
+
parse: Ge,
|
|
1792
|
+
dump: Ye
|
|
1793
|
+
}),
|
|
1794
|
+
G({
|
|
1795
|
+
keyword: "subform",
|
|
1796
|
+
field: "subforms",
|
|
1797
|
+
takesID: !0,
|
|
1798
|
+
parse: Xe,
|
|
1799
|
+
dump: Qe
|
|
1800
|
+
}),
|
|
1801
|
+
G({
|
|
1802
|
+
keyword: "symbol",
|
|
1803
|
+
field: "symbols",
|
|
1804
|
+
takesID: !0,
|
|
1805
|
+
parse: $e,
|
|
1806
|
+
resolve: et,
|
|
1807
|
+
dump: tt
|
|
1808
|
+
}),
|
|
1809
|
+
G({
|
|
1810
|
+
keyword: "calculation",
|
|
1811
|
+
field: "calculations",
|
|
1812
|
+
takesID: !0,
|
|
1813
|
+
parse: nt,
|
|
1814
|
+
resolve: at,
|
|
1815
|
+
dump: ot
|
|
1816
|
+
}),
|
|
1817
|
+
G({
|
|
1818
|
+
keyword: "state_machine",
|
|
1819
|
+
field: "stateMachines",
|
|
1820
|
+
takesID: !0,
|
|
1821
|
+
parse: st,
|
|
1822
|
+
dump: lt
|
|
1823
|
+
})
|
|
1824
|
+
];
|
|
1825
|
+
function ft(e) {
|
|
1826
|
+
let t = {};
|
|
1827
|
+
for (let n of e) {
|
|
1828
|
+
if (!n.field) continue;
|
|
1829
|
+
let e = {
|
|
1830
|
+
takesID: n.takesID,
|
|
1831
|
+
parse: n.parse,
|
|
1832
|
+
field: n.field
|
|
1833
|
+
};
|
|
1834
|
+
t[n.keyword] = e;
|
|
1835
|
+
for (let r of n.aliases ?? []) t[r] = e;
|
|
1836
|
+
}
|
|
1837
|
+
return t;
|
|
1838
|
+
}
|
|
1839
|
+
function pt(e) {
|
|
1840
|
+
let t = {};
|
|
1841
|
+
for (let n of e) n.field && (t[n.field] = { resolve: n.resolve ?? ((e, t) => t) });
|
|
1842
|
+
return t;
|
|
1843
|
+
}
|
|
1844
|
+
function mt(e) {
|
|
1845
|
+
let t = {};
|
|
1846
|
+
for (let n of e) n.field && (t[n.field] = n.dump);
|
|
1847
|
+
return t;
|
|
1848
|
+
}
|
|
1849
|
+
var q = {
|
|
1850
|
+
root: { parse: (e) => (t) => (t.root = e.trim(), t) },
|
|
1851
|
+
metadata: { parse: p },
|
|
1852
|
+
...ft(K)
|
|
1853
|
+
}, J = pt(K), ht = mt(K), Y = (/* @__PURE__ */ e(((e, t) => {
|
|
1854
|
+
t.exports = {};
|
|
1855
|
+
})))(), gt = /^include\s+"([^"]+)"/gm, _t = /^[ \t]*(#|\/\/)/;
|
|
1856
|
+
function X(e, t = /* @__PURE__ */ new Set()) {
|
|
1857
|
+
let n = (0, Y.resolve)(e);
|
|
1858
|
+
if (t.has(n)) throw Error(`Include cycle detected: ${n} (chain: ${[...t, n].map((e) => e.split("/").pop()).join(" → ")})`);
|
|
1859
|
+
if (t.add(n), !(0, Y.existsSync)(n)) throw Error(`Include file not found: ${n}`);
|
|
1860
|
+
let r = (0, Y.readFileSync)(n, "utf8"), i = (0, Y.dirname)(n);
|
|
1861
|
+
return r.replace(gt, (e, n, a) => {
|
|
1862
|
+
let o = r.lastIndexOf("\n", a) + 1, s = r.slice(o, a);
|
|
1863
|
+
if (_t.test(s)) return e;
|
|
1864
|
+
let c = (0, Y.isAbsolute)(n) ? n : (0, Y.resolve)(i, n);
|
|
1865
|
+
return X(c.endsWith(".mmel") ? c : `${c}.mmel`, new Set(t));
|
|
1866
|
+
});
|
|
1867
|
+
}
|
|
1868
|
+
//#endregion
|
|
1869
|
+
//#region src/validate.ts
|
|
1870
|
+
function vt(e) {
|
|
1871
|
+
let t = [];
|
|
1872
|
+
for (let n of yt) t.push(...n.check(e));
|
|
1873
|
+
return t;
|
|
1874
|
+
}
|
|
1875
|
+
var yt = [
|
|
1876
|
+
{
|
|
1877
|
+
name: "empty-ids",
|
|
1878
|
+
check: bt
|
|
1879
|
+
},
|
|
1880
|
+
{
|
|
1881
|
+
name: "form-references",
|
|
1882
|
+
check: xt
|
|
1883
|
+
},
|
|
1884
|
+
{
|
|
1885
|
+
name: "state-machine-cascades",
|
|
1886
|
+
check: St
|
|
1887
|
+
}
|
|
1888
|
+
];
|
|
1889
|
+
function bt(e) {
|
|
1890
|
+
let t = [];
|
|
1891
|
+
for (let [n, r] of Ct(e)) for (let e of r) (!e.id || e.id.trim() === "") && t.push({
|
|
1892
|
+
severity: "error",
|
|
1893
|
+
code: "empty-id",
|
|
1894
|
+
construct: n,
|
|
1895
|
+
message: `${n} has an empty id — every ${n} must declare a non-empty id`
|
|
1896
|
+
});
|
|
1897
|
+
return t;
|
|
1898
|
+
}
|
|
1899
|
+
function xt(e) {
|
|
1900
|
+
let t = [], n = new Set(e.calculations.map((e) => e.id)), r = new Set(e.processes.map((e) => e.id)), i = new Set(e.subforms.map((e) => e.id));
|
|
1901
|
+
for (let a of e.forms) {
|
|
1902
|
+
a.conformanceProcessId && !r.has(a.conformanceProcessId) && t.push({
|
|
1903
|
+
severity: "error",
|
|
1904
|
+
code: "form-conformance-process-missing",
|
|
1905
|
+
construct: "form",
|
|
1906
|
+
message: `Form "${a.id}" references conformance process "${a.conformanceProcessId}" which does not exist`,
|
|
1907
|
+
id: a.id
|
|
1908
|
+
});
|
|
1909
|
+
for (let e of wt(a)) e.calculationId && !n.has(e.calculationId) && t.push({
|
|
1910
|
+
severity: "error",
|
|
1911
|
+
code: "form-calculation-missing",
|
|
1912
|
+
construct: "form",
|
|
1913
|
+
message: `Form "${a.id}" field "${e.name}" references calculation "${e.calculationId}" which does not exist`,
|
|
1914
|
+
id: a.id
|
|
1915
|
+
}), e.subformRef && !i.has(e.subformRef.subformId) && t.push({
|
|
1916
|
+
severity: "error",
|
|
1917
|
+
code: "form-subform-missing",
|
|
1918
|
+
construct: "form",
|
|
1919
|
+
message: `Form "${a.id}" field "${e.name}" references subform "${e.subformRef.subformId}" which does not exist`,
|
|
1920
|
+
id: a.id
|
|
1921
|
+
});
|
|
1922
|
+
}
|
|
1923
|
+
return t;
|
|
1924
|
+
}
|
|
1925
|
+
function St(e) {
|
|
1926
|
+
let t = [];
|
|
1927
|
+
for (let n of e.stateMachines) {
|
|
1928
|
+
let e = new Set(n.states.map((e) => e.name));
|
|
1929
|
+
e.add("*");
|
|
1930
|
+
for (let r of n.transitions) r.from && !e.has(r.from) && t.push({
|
|
1931
|
+
severity: "warning",
|
|
1932
|
+
code: "state-machine-from-missing",
|
|
1933
|
+
construct: "state_machine",
|
|
1934
|
+
message: `State machine "${n.entityName}" transition from "${r.from}" is not in declared states`,
|
|
1935
|
+
id: n.entityName
|
|
1936
|
+
}), r.to && !e.has(r.to) && t.push({
|
|
1937
|
+
severity: "warning",
|
|
1938
|
+
code: "state-machine-to-missing",
|
|
1939
|
+
construct: "state_machine",
|
|
1940
|
+
message: `State machine "${n.entityName}" transition to "${r.to}" is not in declared states`,
|
|
1941
|
+
id: n.entityName
|
|
1942
|
+
});
|
|
1943
|
+
}
|
|
1944
|
+
return t;
|
|
1945
|
+
}
|
|
1946
|
+
function* Ct(e) {
|
|
1947
|
+
for (let [t, n] of Object.entries(e)) Array.isArray(n) && n.length > 0 && typeof n[0]?.id == "string" && (yield [t, n]);
|
|
1948
|
+
}
|
|
1949
|
+
function* wt(e) {
|
|
1950
|
+
let t = [...e.fields];
|
|
1951
|
+
for (; t.length > 0;) {
|
|
1952
|
+
let e = t.pop();
|
|
1953
|
+
yield e, e.fields && e.fields.length > 0 && t.push(...e.fields);
|
|
1954
|
+
}
|
|
1955
|
+
}
|
|
1956
|
+
//#endregion
|
|
1957
|
+
//#region src/ser-des/index.ts
|
|
1958
|
+
function Z(e, t = {}) {
|
|
1959
|
+
return f(l(e, q, t), J);
|
|
1960
|
+
}
|
|
1961
|
+
function Q(e, t = {}) {
|
|
1962
|
+
let n = l(e, q, t);
|
|
1963
|
+
return {
|
|
1964
|
+
standard: f(n, J),
|
|
1965
|
+
issues: n.issues
|
|
1966
|
+
};
|
|
1967
|
+
}
|
|
1968
|
+
function Tt(e, t = {}) {
|
|
1969
|
+
return Z(X(e), t);
|
|
1970
|
+
}
|
|
1971
|
+
function $(e, t = {}) {
|
|
1972
|
+
return Q(X(e), t);
|
|
1973
|
+
}
|
|
1974
|
+
function Et(e) {
|
|
1975
|
+
return ie(e, ht);
|
|
1976
|
+
}
|
|
1977
|
+
function Dt(e) {
|
|
1978
|
+
return vt(e);
|
|
1979
|
+
}
|
|
1980
|
+
//#endregion
|
|
1981
|
+
export { Et as dump, Z as load, Tt as loadFile, $ as loadFileWithIssues, Q as loadWithIssues, Dt as validate };
|