@likec4/core 1.20.3 → 1.21.0
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/builder/index.cjs +24 -18
- package/dist/builder/index.d.cts +11 -5
- package/dist/builder/index.d.mts +11 -5
- package/dist/builder/index.d.ts +11 -5
- package/dist/builder/index.mjs +10 -4
- package/dist/compute-view/index.cjs +6 -6
- package/dist/compute-view/index.d.cts +4 -4
- package/dist/compute-view/index.d.mts +4 -4
- package/dist/compute-view/index.d.ts +4 -4
- package/dist/compute-view/index.mjs +6 -6
- package/dist/index.cjs +52 -14
- package/dist/index.d.cts +6 -6
- package/dist/index.d.mts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.mjs +46 -11
- package/dist/model/index.cjs +1 -1
- package/dist/model/index.d.cts +5 -5
- package/dist/model/index.d.mts +5 -5
- package/dist/model/index.d.ts +5 -5
- package/dist/model/index.mjs +1 -1
- package/dist/shared/{core.Cmfo_N4F.d.mts → core.5Z5cpENq.d.mts} +5 -4
- package/dist/shared/{core.D4wZW7zR.d.ts → core.BJfq046m.d.ts} +5 -4
- package/dist/shared/{core.C0ygs98j.d.cts → core.BS_nXBsP.d.cts} +9 -2
- package/dist/shared/{core.CajOK_t3.d.mts → core.BYs5deiY.d.cts} +1 -1
- package/dist/shared/{core.Bezy7K65.mjs → core.BfZZXtur.mjs} +2 -2
- package/dist/shared/{core.CwZmAghJ.d.cts → core.BgPZ8Tl8.d.cts} +5 -4
- package/dist/shared/{core.FACQZmma.cjs → core.BjR0D3IO.cjs} +15 -15
- package/dist/shared/{core.uxHtIZaH.cjs → core.CAkSSvJ6.cjs} +11 -5
- package/dist/shared/{core.El-gigOM.mjs → core.CE-kCVHA.mjs} +1 -1
- package/dist/shared/{core.DjMYkPMQ.d.mts → core.CJaCUZQ9.d.mts} +9 -2
- package/dist/shared/{core.88YY6vtF.d.mts → core.CT1nzYjO.d.cts} +2 -2
- package/dist/shared/{core.0PxLtLpP.mjs → core.CYNYaH2U.mjs} +5 -2
- package/dist/shared/{core.CCyhaU-4.mjs → core.CeefT_JU.mjs} +6 -6
- package/dist/shared/{core.BG1hfxpq.mjs → core.Cz9Oy_FA.mjs} +475 -409
- package/dist/shared/{core.BIZD3l1g.d.cts → core.D0KD4FiT.d.mts} +1 -1
- package/dist/shared/{core.DRfrKNT6.cjs → core.D91uYrqI.cjs} +551 -485
- package/dist/shared/{core.BtISRjMA.d.ts → core.DQCc-Jxk.d.ts} +1 -1
- package/dist/shared/{core.Db_OTRdC.cjs → core.DnPc_NDM.cjs} +1 -1
- package/dist/shared/{core.CNUzoKM7.d.ts → core.Dp3HTiRV.d.ts} +2 -2
- package/dist/shared/{core.CKYxnFEl.cjs → core.DqQrj2oQ.cjs} +2 -2
- package/dist/shared/{core.Bs71hdR4.d.ts → core.DsDq-blc.d.ts} +9 -2
- package/dist/shared/{core.Lh2RFJf1.d.cts → core.DuuS_BrY.d.mts} +2 -2
- package/dist/shared/{core.BJfn72tj.d.ts → core.QP35c488.d.cts} +33 -1
- package/dist/shared/{core.BJfn72tj.d.cts → core.QP35c488.d.mts} +33 -1
- package/dist/shared/{core.BJfn72tj.d.mts → core.QP35c488.d.ts} +33 -1
- package/dist/types/index.cjs +4 -1
- package/dist/types/index.d.cts +4 -4
- package/dist/types/index.d.mts +4 -4
- package/dist/types/index.d.ts +4 -4
- package/dist/types/index.mjs +1 -1
- package/dist/utils/index.cjs +3 -3
- package/dist/utils/index.d.cts +2 -2
- package/dist/utils/index.d.mts +2 -2
- package/dist/utils/index.d.ts +2 -2
- package/dist/utils/index.mjs +3 -3
- package/package.json +6 -6
- package/src/builder/Builder.ts +11 -5
- package/src/builder/Builder.view-common.ts +1 -0
- package/src/builder/__snapshots__/Builder-style1.spec.ts.snap +16 -4
- package/src/builder/__snapshots__/Builder-style2.spec.ts.snap +21 -5
- package/src/builder/_types.ts +9 -0
- package/src/colors/index.ts +41 -5
- package/src/compute-view/deployment-view/predicates/{elements.ts → deploymentRefs.ts} +32 -21
- package/src/compute-view/deployment-view/predicates/index.ts +1 -1
- package/src/compute-view/deployment-view/predicates/utils.ts +56 -1
- package/src/compute-view/deployment-view/predicates/wildcard.ts +20 -9
- package/src/compute-view/memory/AbstractStageExclude.ts +1 -1
- package/src/compute-view/utils/applyCustomElementProperties.ts +18 -1
- package/src/compute-view/utils/applyViewRuleStyles.ts +9 -0
- package/src/compute-view/utils/buildComputedNodes.ts +13 -9
- package/src/model/DeploymentElementModel.ts +5 -2
- package/src/model/ElementModel.ts +10 -0
- package/src/types/element.ts +19 -1
- package/src/types/expression.ts +4 -1
- package/src/types/index.ts +6 -0
- package/src/types/theme.ts +22 -1
- package/src/types/view.ts +5 -1
|
@@ -1,50 +1,50 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const
|
|
3
|
+
const view = require('./core.CAkSSvJ6.cjs');
|
|
4
|
+
const object_hash = require('./core.BjR0D3IO.cjs');
|
|
5
|
+
const chunkWIMGWYZL = require('./core.DqQrj2oQ.cjs');
|
|
6
6
|
|
|
7
|
-
function
|
|
7
|
+
function y$1(t,i){let a=i.length-t.length;if(a===1){let[n,...r]=i;return object_hash.C(n,{lazy:t,lazyArgs:r})}if(a===0){let n={lazy:t,lazyArgs:i};return Object.assign(e=>object_hash.C(e,n),n)}throw new Error("Wrong number of arguments")}
|
|
8
8
|
|
|
9
|
-
function r$3(...t){return
|
|
9
|
+
function r$3(...t){return chunkWIMGWYZL.u(Object.values,t)}
|
|
10
10
|
|
|
11
11
|
function d$5(...e){return e.length===2?(n,...r)=>t$5(n,...e,...r):t$5(...e)}var t$5=(e,n,r,...a)=>n(e,...a)?typeof r=="function"?r(e,...a):r.onTrue(e,...a):typeof r=="function"?e:r.onFalse(e,...a);
|
|
12
12
|
|
|
13
|
-
function i$8(...e){return
|
|
13
|
+
function i$8(...e){return y$1(a$4,e)}function a$4(){let e=new Set;return t=>e.has(t)?object_hash.s:(e.add(t),{done:false,hasNext:true,next:t})}
|
|
14
14
|
|
|
15
|
-
function l$6(...
|
|
15
|
+
function l$6(...r){return chunkWIMGWYZL.u(o$7,r,u$5)}var o$7=(r,e)=>e<0?[]:r.slice(0,e);function u$5(r){if(r<=0)return object_hash.a;let e=r;return a=>(e-=1,{done:e<=0,hasNext:true,next:a})}
|
|
16
16
|
|
|
17
17
|
var T$1={asc:(r,n)=>r>n,desc:(r,n)=>r<n};function s(r,n){let[e,...o]=n;if(!m$2(e)){let t=u$4(...o);return r(e,t)}let a=u$4(e,...o);return t=>r(t,a)}function u$4(r,n,...e){let o=typeof r=="function"?r:r[0],a=typeof r=="function"?"asc":r[1],{[a]:t}=T$1,i=n===undefined?undefined:u$4(n,...e);return (y,c)=>{let p=o(y),l=o(c);return t(p,l)?1:t(l,p)?-1:i?.(y,c)??0}}function m$2(r){if(d$4(r))return true;if(typeof r!="object"||!Array.isArray(r))return false;let[n,e,...o]=r;return d$4(n)&&typeof e=="string"&&e in T$1&&o.length===0}var d$4=r=>typeof r=="function"&&r.length===1;
|
|
18
18
|
|
|
19
|
-
function m$1(...r){return
|
|
19
|
+
function m$1(...r){return chunkWIMGWYZL.u(o$6,r)}function o$6(r,t){let e=[...r];return e.sort(t),e}
|
|
20
20
|
|
|
21
21
|
function a$3(...r){return s(n$3,r)}var n$3=(r,t)=>[...r].sort(t);
|
|
22
22
|
|
|
23
|
-
function l$5(...e){return
|
|
23
|
+
function l$5(...e){return chunkWIMGWYZL.u(u$3,e)}var u$3=(e,a,n)=>e.reduce(a,n);
|
|
24
24
|
|
|
25
|
-
function t$4(...e){return
|
|
25
|
+
function t$4(...e){return chunkWIMGWYZL.u(r$2,e)}function r$2(e){return [...e].reverse()}
|
|
26
26
|
|
|
27
|
-
function p$1(...e){return
|
|
27
|
+
function p$1(...e){return chunkWIMGWYZL.u(t$3,e)}var t$3=(e,o)=>e[o];
|
|
28
28
|
|
|
29
|
-
function d$3(...r){return
|
|
29
|
+
function d$3(...r){return chunkWIMGWYZL.u(i$7,r)}var i$7=(r,t)=>{let a=[[],[]];for(let[o,e]of r.entries())t(e,o,r)?a[0].push(e):a[1].push(e);return a};
|
|
30
30
|
|
|
31
|
-
function i$6(...e){return
|
|
31
|
+
function i$6(...e){return chunkWIMGWYZL.u(o$5,e)}function o$5(e,n){let t={};for(let r of n)r in e&&(t[r]=e[r]);return t}
|
|
32
32
|
|
|
33
|
-
function d$2(...e){return
|
|
33
|
+
function d$2(...e){return chunkWIMGWYZL.u(i$5,e)}function i$5(e,o){let t={};for(let[r,n]of Object.entries(e))o(n,r,e)&&(t[r]=n);return t}
|
|
34
34
|
|
|
35
|
-
function i$4(...n){return o=>object_hash.
|
|
35
|
+
function i$4(...n){return o=>object_hash.C(o,...n)}
|
|
36
36
|
|
|
37
|
-
function d$1(...e){return
|
|
37
|
+
function d$1(...e){return chunkWIMGWYZL.u(l$4,e)}function l$4(e,a){let t={...e};for(let[n,o]of Object.entries(t))a(o,n,e)&&delete t[n];return t}
|
|
38
38
|
|
|
39
|
-
function t$2(...n){return
|
|
39
|
+
function t$2(...n){return chunkWIMGWYZL.u(o$4,n)}var o$4=n=>n.length===1?n[0]:undefined;
|
|
40
40
|
|
|
41
|
-
function i$3(...e){return
|
|
41
|
+
function i$3(...e){return chunkWIMGWYZL.u(o$3,e)}function o$3(e,r){let a={};for(let[n,u]of Object.entries(e)){let l=r(u,n,e);a[n]=l;}return a}
|
|
42
42
|
|
|
43
43
|
function n$2(e){return !!e}
|
|
44
44
|
|
|
45
|
-
function a$2(...e){return
|
|
45
|
+
function a$2(...e){return chunkWIMGWYZL.u(n$1,e)}var n$1=e=>e.at(-1);
|
|
46
46
|
|
|
47
|
-
function l$3(...n){return
|
|
47
|
+
function l$3(...n){return chunkWIMGWYZL.u(d,n)}function d(n,o){let e={};for(let[a,t]of n.entries()){let[y,u]=o(t,a,n);e[y]=u;}return e}
|
|
48
48
|
|
|
49
49
|
function e$1(r){return typeof r=="number"&&!Number.isNaN(r)}
|
|
50
50
|
|
|
@@ -52,23 +52,23 @@ function n(e){return e===undefined?true:typeof e=="string"||Array.isArray(e)?e.l
|
|
|
52
52
|
|
|
53
53
|
function e(o){return typeof o=="boolean"}
|
|
54
54
|
|
|
55
|
-
function i$2(...e){return
|
|
55
|
+
function i$2(...e){return chunkWIMGWYZL.u(p,e)}var p=(e,a)=>{let n={};for(let[d,t]of e.entries()){let y=a(t,d,e);if(y!==undefined){let{[y]:r}=n;r===undefined&&(r=[],n[y]=r),r.push(t);}}return n};
|
|
56
56
|
|
|
57
|
-
function k(...n){return
|
|
57
|
+
function k(...n){return chunkWIMGWYZL.u(u$2,n)}function u$2(n,e){if(n===e||Object.is(n,e))return true;if(typeof n!="object"||typeof e!="object"||n===null||e===null||Object.getPrototypeOf(n)!==Object.getPrototypeOf(e))return false;if(Array.isArray(n))return l$2(n,e);if(n instanceof Map)return a$1(n,e);if(n instanceof Set)return c(n,e);if(n instanceof Date)return n.getTime()===e.getTime();if(n instanceof RegExp)return n.toString()===e.toString();if(Object.keys(n).length!==Object.keys(e).length)return false;for(let[r,t]of Object.entries(n))if(!(r in e)||!u$2(t,e[r]))return false;return true}function l$2(n,e){if(n.length!==e.length)return false;for(let[r,t]of n.entries())if(!u$2(t,e[r]))return false;return true}function a$1(n,e){if(n.size!==e.size)return false;for(let[r,t]of n.entries())if(!e.has(r)||!u$2(t,e.get(r)))return false;return true}function c(n,e){if(n.size!==e.size)return false;let r=[...e];for(let t of n){let o=false;for(let[s,f]of r.entries())if(u$2(t,f)){o=true,r.splice(s,1);break}if(!o)return false}return true}
|
|
58
58
|
|
|
59
|
-
function u$1(...a){return
|
|
59
|
+
function u$1(...a){return chunkWIMGWYZL.u(o$2,a,l$1)}var o$2=(a,r)=>a.flatMap(r),l$1=a=>(r,t,y)=>{let n=a(r,t,y);return Array.isArray(n)?{done:false,hasNext:true,hasMany:true,next:n}:{done:false,hasNext:true,next:n}};
|
|
60
60
|
|
|
61
|
-
function u(...e){return
|
|
61
|
+
function u(...e){return chunkWIMGWYZL.u(o$1,e,i$1)}function o$1(e,a){return e.forEach(a),e}var i$1=e=>(a,n,t)=>(e(a,n,t),{done:false,hasNext:true,next:a});
|
|
62
62
|
|
|
63
|
-
function t$1(...r){return
|
|
63
|
+
function t$1(...r){return chunkWIMGWYZL.u(Object.entries,r)}
|
|
64
64
|
|
|
65
|
-
function T(...a){return
|
|
65
|
+
function T(...a){return chunkWIMGWYZL.u(l,a,y)}var l=(a,r)=>a.filter(r),y=a=>(r,t,o)=>a(r,t,o)?{done:false,hasNext:true,next:r}:object_hash.s;
|
|
66
66
|
|
|
67
|
-
function o(...e){return
|
|
67
|
+
function o(...e){return chunkWIMGWYZL.u(t,e)}var t=(e,r)=>{for(let n=e.length-1;n>=0;n--){let a=e[n];if(r(a,n,e))return a}};
|
|
68
68
|
|
|
69
|
-
function m(...e){return
|
|
69
|
+
function m(...e){return chunkWIMGWYZL.u(i,e)}function i(e,t){for(let[n,o]of e.entries())if(!t(o,n,e))return e.slice(n);return []}
|
|
70
70
|
|
|
71
|
-
function a(...e){return
|
|
71
|
+
function a(...e){return chunkWIMGWYZL.u(r$1,e)}var r$1=(e,t)=>[...e,...t];
|
|
72
72
|
|
|
73
73
|
function r(n){return ()=>n}
|
|
74
74
|
|
|
@@ -117,6 +117,12 @@ class ElementModel {
|
|
|
117
117
|
get isRoot() {
|
|
118
118
|
return this.parent === null;
|
|
119
119
|
}
|
|
120
|
+
get style() {
|
|
121
|
+
return {
|
|
122
|
+
size: view.DefaultShapeSize,
|
|
123
|
+
...this.$element.style
|
|
124
|
+
};
|
|
125
|
+
}
|
|
120
126
|
isAncestorOf(another) {
|
|
121
127
|
return object_hash.isAncestor(this, another);
|
|
122
128
|
}
|
|
@@ -254,7 +260,7 @@ function isElementModel(element) {
|
|
|
254
260
|
}
|
|
255
261
|
|
|
256
262
|
function buildElementNotations(nodes) {
|
|
257
|
-
return object_hash.
|
|
263
|
+
return object_hash.C(
|
|
258
264
|
nodes,
|
|
259
265
|
i$2(p$1("notation")),
|
|
260
266
|
i$3(
|
|
@@ -310,7 +316,7 @@ function ancestorsOfNode(node, nodes) {
|
|
|
310
316
|
const ancestors = [];
|
|
311
317
|
let parentId = node.parent;
|
|
312
318
|
while (parentId) {
|
|
313
|
-
const parentNode =
|
|
319
|
+
const parentNode = chunkWIMGWYZL.nonNullable(nodes.get(parentId), `Parent node ${parentId} not found`);
|
|
314
320
|
ancestors.push(parentNode);
|
|
315
321
|
parentId = parentNode.parent;
|
|
316
322
|
}
|
|
@@ -321,8 +327,8 @@ function linkNodesWithEdges(nodesMap, edges) {
|
|
|
321
327
|
for (const edge of edges) {
|
|
322
328
|
const source = nodesMap.get(edge.source);
|
|
323
329
|
const target = nodesMap.get(edge.target);
|
|
324
|
-
|
|
325
|
-
|
|
330
|
+
chunkWIMGWYZL.invariant(source, `Source node ${edge.source} not found`);
|
|
331
|
+
chunkWIMGWYZL.invariant(target, `Target node ${edge.target} not found`);
|
|
326
332
|
source.outEdges.push(edge.id);
|
|
327
333
|
target.inEdges.push(edge.id);
|
|
328
334
|
const sourceAncestors = ancestorsOfNode(source, nodesMap);
|
|
@@ -1349,13 +1355,13 @@ function topologicalSort(param) {
|
|
|
1349
1355
|
edges
|
|
1350
1356
|
};
|
|
1351
1357
|
}
|
|
1352
|
-
const getNode = (id) =>
|
|
1358
|
+
const getNode = (id) => chunkWIMGWYZL.nonNullable(param.nodes.get(id));
|
|
1353
1359
|
const g = new Graph({
|
|
1354
1360
|
multi: true,
|
|
1355
1361
|
allowSelfLoops: true,
|
|
1356
1362
|
type: "directed"
|
|
1357
1363
|
});
|
|
1358
|
-
const enrichedEdges = object_hash.
|
|
1364
|
+
const enrichedEdges = object_hash.C(
|
|
1359
1365
|
edges,
|
|
1360
1366
|
object_hash.m((edge, __dirname) => {
|
|
1361
1367
|
const source = getNode(edge.source), target = getNode(edge.target), parent = edge.parent ? getNode(edge.parent) : null;
|
|
@@ -1389,7 +1395,7 @@ function topologicalSort(param) {
|
|
|
1389
1395
|
for (const { edge, source, target } of edgesBetweenLeafs) {
|
|
1390
1396
|
addEdgeToGraph(edge);
|
|
1391
1397
|
if (target.parent && target.parent !== edge.parent) {
|
|
1392
|
-
object_hash.
|
|
1398
|
+
object_hash.C(
|
|
1393
1399
|
ancestorsOfNode(target, param.nodes),
|
|
1394
1400
|
object_hash.u((ancestor) => ancestor.inEdges.includes(edge.id)),
|
|
1395
1401
|
u((ancestor) => {
|
|
@@ -1419,13 +1425,13 @@ function topologicalSort(param) {
|
|
|
1419
1425
|
for (const { edge } of edgesWithCompounds) {
|
|
1420
1426
|
addEdgeToGraph(edge);
|
|
1421
1427
|
}
|
|
1422
|
-
|
|
1428
|
+
chunkWIMGWYZL.invariant(sortedEdges.length === edges.length, "Not all edges were added to the graph");
|
|
1423
1429
|
const sortedIds = topologicalSortExports.topologicalSort(g);
|
|
1424
1430
|
let sorted = [];
|
|
1425
1431
|
let unsorted = nodes.slice();
|
|
1426
1432
|
for (const sortedId of sortedIds) {
|
|
1427
1433
|
const indx = unsorted.findIndex((n) => n.id === sortedId);
|
|
1428
|
-
|
|
1434
|
+
chunkWIMGWYZL.invariant(indx >= 0, `Node "${sortedId}" not found`);
|
|
1429
1435
|
sorted.push(...unsorted.splice(indx, 1));
|
|
1430
1436
|
}
|
|
1431
1437
|
if (unsorted.length > 0 && sorted.length > 0) {
|
|
@@ -1455,12 +1461,12 @@ function calcViewLayoutHash(view) {
|
|
|
1455
1461
|
id: view.id,
|
|
1456
1462
|
__: view.__ ?? "element",
|
|
1457
1463
|
autoLayout: view.autoLayout,
|
|
1458
|
-
nodes: object_hash.
|
|
1464
|
+
nodes: object_hash.C(
|
|
1459
1465
|
view.nodes,
|
|
1460
1466
|
object_hash.m(i$6(["id", "title", "description", "technology", "shape", "icon", "children"])),
|
|
1461
1467
|
l$3(({ id, icon, ...node }) => [id, { ...node, icon: n$2(icon) ? "Y" : "N" }])
|
|
1462
1468
|
),
|
|
1463
|
-
edges: object_hash.
|
|
1469
|
+
edges: object_hash.C(
|
|
1464
1470
|
view.edges,
|
|
1465
1471
|
object_hash.m(i$6(["source", "target", "label", "description", "technology", "dir", "head", "tail", "line"])),
|
|
1466
1472
|
l$3(({ source, target, ...edge }) => [`${source}:${target}`, edge])
|
|
@@ -1537,6 +1543,7 @@ class AbstractDeploymentElementModel {
|
|
|
1537
1543
|
return {
|
|
1538
1544
|
shape: view.DefaultElementShape,
|
|
1539
1545
|
color: view.DefaultThemeColor,
|
|
1546
|
+
size: view.DefaultShapeSize,
|
|
1540
1547
|
...this.$node.style
|
|
1541
1548
|
};
|
|
1542
1549
|
}
|
|
@@ -1790,13 +1797,14 @@ class DeployedInstanceModel extends AbstractDeploymentElementModel {
|
|
|
1790
1797
|
return this.$instance;
|
|
1791
1798
|
}
|
|
1792
1799
|
get parent() {
|
|
1793
|
-
return
|
|
1800
|
+
return chunkWIMGWYZL.nonNullable(this.$model.parent(this), `Parent of ${this.id} not found`);
|
|
1794
1801
|
}
|
|
1795
1802
|
get style() {
|
|
1796
1803
|
const { icon, style } = this.element.$element;
|
|
1797
1804
|
return {
|
|
1798
1805
|
shape: this.element.shape,
|
|
1799
1806
|
color: this.element.color,
|
|
1807
|
+
size: view.DefaultShapeSize,
|
|
1800
1808
|
...icon && { icon },
|
|
1801
1809
|
...style,
|
|
1802
1810
|
...this.$instance.style
|
|
@@ -2080,8 +2088,8 @@ class DeploymentConnectionModel {
|
|
|
2080
2088
|
if (Array.isArray(other)) {
|
|
2081
2089
|
return other.reduce((acc, o) => acc.mergeWith(o), this);
|
|
2082
2090
|
}
|
|
2083
|
-
|
|
2084
|
-
|
|
2091
|
+
chunkWIMGWYZL.invariant(this.source.id === other.source.id, "Cannot merge connections with different sources");
|
|
2092
|
+
chunkWIMGWYZL.invariant(this.target.id === other.target.id, "Cannot merge connections with different targets");
|
|
2085
2093
|
return new DeploymentConnectionModel(
|
|
2086
2094
|
this.source,
|
|
2087
2095
|
this.target,
|
|
@@ -2103,7 +2111,7 @@ class DeploymentConnectionModel {
|
|
|
2103
2111
|
);
|
|
2104
2112
|
}
|
|
2105
2113
|
equals(other) {
|
|
2106
|
-
|
|
2114
|
+
chunkWIMGWYZL.invariant(other instanceof DeploymentConnectionModel, "Other should ne DeploymentConnectionModel");
|
|
2107
2115
|
return this.id === other.id && this.source.id === other.source.id && this.target.id === other.target.id && object_hash.equals(this.relations.model, other.relations.model) && object_hash.equals(this.relations.deployment, other.relations.deployment);
|
|
2108
2116
|
}
|
|
2109
2117
|
/**
|
|
@@ -2175,7 +2183,7 @@ function sortConnectionsByBoundaryHierarchy(connections, sort) {
|
|
|
2175
2183
|
return _sortByBoundary(connections, sort ?? "asc");
|
|
2176
2184
|
}
|
|
2177
2185
|
function _sortByBoundary(connections, order) {
|
|
2178
|
-
return object_hash.
|
|
2186
|
+
return object_hash.C(
|
|
2179
2187
|
connections,
|
|
2180
2188
|
object_hash.m((conn) => ({
|
|
2181
2189
|
id: boundaryHierarchy(conn),
|
|
@@ -2378,8 +2386,8 @@ class ConnectionModel {
|
|
|
2378
2386
|
return this.relations.size > 0;
|
|
2379
2387
|
}
|
|
2380
2388
|
mergeWith(other) {
|
|
2381
|
-
|
|
2382
|
-
|
|
2389
|
+
chunkWIMGWYZL.invariant(this.source.id === other.source.id, "Cannot merge connections with different sources");
|
|
2390
|
+
chunkWIMGWYZL.invariant(this.target.id === other.target.id, "Cannot merge connections with different targets");
|
|
2383
2391
|
return new ConnectionModel(
|
|
2384
2392
|
this.source,
|
|
2385
2393
|
this.target,
|
|
@@ -2394,7 +2402,7 @@ class ConnectionModel {
|
|
|
2394
2402
|
);
|
|
2395
2403
|
}
|
|
2396
2404
|
intersect(other) {
|
|
2397
|
-
|
|
2405
|
+
chunkWIMGWYZL.invariant(other instanceof ConnectionModel, "Cannot intersect connection with different type");
|
|
2398
2406
|
return new ConnectionModel(
|
|
2399
2407
|
this.source,
|
|
2400
2408
|
this.target,
|
|
@@ -2402,7 +2410,7 @@ class ConnectionModel {
|
|
|
2402
2410
|
);
|
|
2403
2411
|
}
|
|
2404
2412
|
equals(other) {
|
|
2405
|
-
|
|
2413
|
+
chunkWIMGWYZL.invariant(other instanceof ConnectionModel, "Cannot merge connection with different type");
|
|
2406
2414
|
return this.id === other.id && this.source.id === other.source.id && this.target.id === other.target.id && object_hash.equals(this.relations, other.relations);
|
|
2407
2415
|
}
|
|
2408
2416
|
/**
|
|
@@ -2548,7 +2556,7 @@ class AbstractStageExclude {
|
|
|
2548
2556
|
*/
|
|
2549
2557
|
excludeConnections(connection, moveExplicitToImplicit) {
|
|
2550
2558
|
if (e(moveExplicitToImplicit)) {
|
|
2551
|
-
|
|
2559
|
+
chunkWIMGWYZL.invariant(!this.markedToMoveExplicitToImplicit, "Already marked to move explicits");
|
|
2552
2560
|
this.markedToMoveExplicitToImplicit = moveExplicitToImplicit;
|
|
2553
2561
|
}
|
|
2554
2562
|
if (object_hash.isIterable(connection)) {
|
|
@@ -2589,7 +2597,7 @@ class AbstractStageExclude {
|
|
|
2589
2597
|
disconnected,
|
|
2590
2598
|
state.elements
|
|
2591
2599
|
);
|
|
2592
|
-
disconnected = object_hash.
|
|
2600
|
+
disconnected = object_hash.C(
|
|
2593
2601
|
disconnected,
|
|
2594
2602
|
object_hash.ifilter((el) => {
|
|
2595
2603
|
return state.explicits.has(el) && !object_hash.isome(state.final, object_hash.isDescendantOf(el));
|
|
@@ -2658,8 +2666,8 @@ class AbstractStageExclude {
|
|
|
2658
2666
|
* Postcommit hook
|
|
2659
2667
|
*/
|
|
2660
2668
|
postcommit(state) {
|
|
2661
|
-
|
|
2662
|
-
|
|
2669
|
+
chunkWIMGWYZL.invariant(object_hash.difference(state.explicits, state.elements).size === 0, "Explicits must be subset of elements");
|
|
2670
|
+
chunkWIMGWYZL.invariant(object_hash.difference(state.final, state.elements).size === 0, "Final elements must be subset of elements");
|
|
2663
2671
|
return state;
|
|
2664
2672
|
}
|
|
2665
2673
|
commit() {
|
|
@@ -2677,7 +2685,6 @@ class AbstractStageExclude {
|
|
|
2677
2685
|
if (this.excluded.elements.size > 0) {
|
|
2678
2686
|
state = this.removeElements(state);
|
|
2679
2687
|
}
|
|
2680
|
-
state = this.moveDisconnectedExplicitsToImplicits(state);
|
|
2681
2688
|
return this.memory.update(this.postcommit(state));
|
|
2682
2689
|
}
|
|
2683
2690
|
}
|
|
@@ -2883,7 +2890,7 @@ function findCrossBoundarySameSourceOrTarget(connections) {
|
|
|
2883
2890
|
if (!object_hash.i(sameRelationGroup, 2)) {
|
|
2884
2891
|
continue;
|
|
2885
2892
|
}
|
|
2886
|
-
object_hash.
|
|
2893
|
+
object_hash.C(
|
|
2887
2894
|
sameRelationGroup,
|
|
2888
2895
|
u$1((conn) => [
|
|
2889
2896
|
{ group: `$source-${conn.source.id}`, conn },
|
|
@@ -2918,7 +2925,7 @@ function findCrossBoundaryConnections(connections) {
|
|
|
2918
2925
|
const connectionModelRelations = c.relations.model;
|
|
2919
2926
|
if (source.isDeploymentNode() !== target.isDeploymentNode()) {
|
|
2920
2927
|
const node = source.isDeploymentNode() ? source : c.target;
|
|
2921
|
-
|
|
2928
|
+
chunkWIMGWYZL.invariant(node.isDeploymentNode());
|
|
2922
2929
|
const nodeInternals = node.internalModelRelationships();
|
|
2923
2930
|
const toExclude = object_hash.intersection(
|
|
2924
2931
|
connectionModelRelations,
|
|
@@ -2946,7 +2953,7 @@ function findCrossBoundaryConnections(connections) {
|
|
|
2946
2953
|
}
|
|
2947
2954
|
}
|
|
2948
2955
|
}
|
|
2949
|
-
return object_hash.
|
|
2956
|
+
return object_hash.C(
|
|
2950
2957
|
excludedRelations.entries(),
|
|
2951
2958
|
object_hash.imap(
|
|
2952
2959
|
([c, excluded]) => c.update({
|
|
@@ -2964,7 +2971,7 @@ function cleanCrossBoundary(connections) {
|
|
|
2964
2971
|
);
|
|
2965
2972
|
}
|
|
2966
2973
|
function findRedundantConnections$1(connections) {
|
|
2967
|
-
return object_hash.
|
|
2974
|
+
return object_hash.C(
|
|
2968
2975
|
connections,
|
|
2969
2976
|
mergeConnections,
|
|
2970
2977
|
l$5((redundants, connection) => {
|
|
@@ -3046,17 +3053,17 @@ let StageInclude$1 = class StageInclude extends AbstractStageInclude {
|
|
|
3046
3053
|
return hasChanged();
|
|
3047
3054
|
}
|
|
3048
3055
|
processConnections(connections) {
|
|
3049
|
-
const clean = object_hash.
|
|
3056
|
+
const clean = object_hash.C(
|
|
3050
3057
|
connections,
|
|
3051
3058
|
cleanCrossBoundary,
|
|
3052
3059
|
cleanRedundantRelationships
|
|
3053
3060
|
);
|
|
3054
|
-
object_hash.
|
|
3061
|
+
object_hash.C(
|
|
3055
3062
|
clean,
|
|
3056
3063
|
// Process only connection from this stage
|
|
3057
3064
|
// filter(c => this._connections.some(c2 => c2.id === c.id)),
|
|
3058
3065
|
u(({ source, target, boundary }) => {
|
|
3059
|
-
object_hash.
|
|
3066
|
+
object_hash.C(
|
|
3060
3067
|
object_hash.d(
|
|
3061
3068
|
[...object_hash.toArray(source.ancestors()).reverse(), source],
|
|
3062
3069
|
[...object_hash.toArray(target.ancestors()).reverse(), target]
|
|
@@ -3171,11 +3178,11 @@ function elementExprToPredicate(target) {
|
|
|
3171
3178
|
if (view.isCustomElement(target)) {
|
|
3172
3179
|
return elementExprToPredicate(target.custom.expr);
|
|
3173
3180
|
}
|
|
3174
|
-
|
|
3181
|
+
chunkWIMGWYZL.nonexhaustive(target);
|
|
3175
3182
|
}
|
|
3176
3183
|
|
|
3177
3184
|
function applyViewRuleStyle(rule, predicates, nodes) {
|
|
3178
|
-
object_hash.
|
|
3185
|
+
object_hash.C(
|
|
3179
3186
|
nodes,
|
|
3180
3187
|
T(view.o$1(view.ComputedNode.isNodesGroup)),
|
|
3181
3188
|
T(view.y(predicates)),
|
|
@@ -3198,6 +3205,15 @@ function applyViewRuleStyle(rule, predicates, nodes) {
|
|
|
3198
3205
|
if (object_hash.n(rule.style.multiple)) {
|
|
3199
3206
|
styleOverride = { ...styleOverride, multiple: rule.style.multiple };
|
|
3200
3207
|
}
|
|
3208
|
+
if (object_hash.n(rule.style.padding)) {
|
|
3209
|
+
styleOverride = { ...styleOverride, padding: rule.style.padding };
|
|
3210
|
+
}
|
|
3211
|
+
if (object_hash.n(rule.style.size)) {
|
|
3212
|
+
styleOverride = { ...styleOverride, size: rule.style.size };
|
|
3213
|
+
}
|
|
3214
|
+
if (object_hash.n(rule.style.textSize)) {
|
|
3215
|
+
styleOverride = { ...styleOverride, textSize: rule.style.textSize };
|
|
3216
|
+
}
|
|
3201
3217
|
if (styleOverride) {
|
|
3202
3218
|
n.style = {
|
|
3203
3219
|
...n.style,
|
|
@@ -3243,7 +3259,7 @@ function buildComputedNodes(elements, groups) {
|
|
|
3243
3259
|
const elementToGroup = /* @__PURE__ */ new Map();
|
|
3244
3260
|
groups?.forEach(({ id, parent, viewRule, elements: elements2 }) => {
|
|
3245
3261
|
if (parent) {
|
|
3246
|
-
|
|
3262
|
+
chunkWIMGWYZL.nonNullable(nodesMap.get(parent), `Parent group node ${parent} not found`).children.push(id);
|
|
3247
3263
|
}
|
|
3248
3264
|
nodesMap.set(id, {
|
|
3249
3265
|
id,
|
|
@@ -3263,7 +3279,11 @@ function buildComputedNodes(elements, groups) {
|
|
|
3263
3279
|
links: null,
|
|
3264
3280
|
style: {
|
|
3265
3281
|
border: viewRule.border ?? "dashed",
|
|
3266
|
-
opacity: viewRule.opacity ?? 0
|
|
3282
|
+
opacity: viewRule.opacity ?? 0,
|
|
3283
|
+
size: viewRule.size ?? "md",
|
|
3284
|
+
multiple: viewRule.multiple ?? false,
|
|
3285
|
+
padding: viewRule.padding ?? "md",
|
|
3286
|
+
textSize: viewRule.textSize ?? "md"
|
|
3267
3287
|
}
|
|
3268
3288
|
});
|
|
3269
3289
|
for (const e of elements2) {
|
|
@@ -3317,10 +3337,10 @@ function buildComputedNodes(elements, groups) {
|
|
|
3317
3337
|
});
|
|
3318
3338
|
const orderedMap = /* @__PURE__ */ new Map();
|
|
3319
3339
|
groups?.forEach(({ id }) => {
|
|
3320
|
-
orderedMap.set(id,
|
|
3340
|
+
orderedMap.set(id, chunkWIMGWYZL.nonNullable(nodesMap.get(id)));
|
|
3321
3341
|
});
|
|
3322
3342
|
elements.forEach(({ id }) => {
|
|
3323
|
-
orderedMap.set(id,
|
|
3343
|
+
orderedMap.set(id, chunkWIMGWYZL.nonNullable(nodesMap.get(id)));
|
|
3324
3344
|
});
|
|
3325
3345
|
return orderedMap;
|
|
3326
3346
|
}
|
|
@@ -3353,7 +3373,7 @@ function pickRelationshipProps(relation) {
|
|
|
3353
3373
|
};
|
|
3354
3374
|
}
|
|
3355
3375
|
function mergePropsFromRelationships(relations, prefer) {
|
|
3356
|
-
const allprops = object_hash.
|
|
3376
|
+
const allprops = object_hash.C(
|
|
3357
3377
|
relations,
|
|
3358
3378
|
l$5(
|
|
3359
3379
|
(acc, r) => {
|
|
@@ -3437,7 +3457,7 @@ function mergePropsFromRelationships(relations, prefer) {
|
|
|
3437
3457
|
}
|
|
3438
3458
|
|
|
3439
3459
|
function uniqueTags(elements) {
|
|
3440
|
-
const tags = object_hash.
|
|
3460
|
+
const tags = object_hash.C(
|
|
3441
3461
|
elements,
|
|
3442
3462
|
u$1((e) => e.tags ?? []),
|
|
3443
3463
|
i$8(),
|
|
@@ -3541,7 +3561,7 @@ function deploymentExpressionToPredicate(target) {
|
|
|
3541
3561
|
return m === fqn;
|
|
3542
3562
|
};
|
|
3543
3563
|
}
|
|
3544
|
-
|
|
3564
|
+
chunkWIMGWYZL.nonexhaustive(target);
|
|
3545
3565
|
}
|
|
3546
3566
|
function toNodeSource$1(el) {
|
|
3547
3567
|
if (el.isDeploymentNode()) {
|
|
@@ -3569,7 +3589,7 @@ function toNodeSource$1(el) {
|
|
|
3569
3589
|
id
|
|
3570
3590
|
};
|
|
3571
3591
|
}
|
|
3572
|
-
|
|
3592
|
+
chunkWIMGWYZL.invariant(el.isInstance(), "Expected Instance");
|
|
3573
3593
|
const instance = el.$instance;
|
|
3574
3594
|
const element = el.element.$element;
|
|
3575
3595
|
const icon = instance.style?.icon ?? element.icon;
|
|
@@ -3611,7 +3631,7 @@ function toComputedEdges$1(connections) {
|
|
|
3611
3631
|
...e.relations.model,
|
|
3612
3632
|
...e.relations.deployment
|
|
3613
3633
|
];
|
|
3614
|
-
|
|
3634
|
+
chunkWIMGWYZL.invariant(object_hash.i(relations, 1), "Edge must have at least one relation");
|
|
3615
3635
|
const source = e.source.id;
|
|
3616
3636
|
const target = e.target.id;
|
|
3617
3637
|
const {
|
|
@@ -3659,108 +3679,6 @@ function applyDeploymentViewRuleStyles(rules, nodes) {
|
|
|
3659
3679
|
return nodes;
|
|
3660
3680
|
}
|
|
3661
3681
|
|
|
3662
|
-
const DeploymentRefPredicate = {
|
|
3663
|
-
include: (ctx) => {
|
|
3664
|
-
const { expr } = ctx;
|
|
3665
|
-
const el = ctx.model.element(expr.ref.deployment);
|
|
3666
|
-
if (isDeployedInstance(el)) {
|
|
3667
|
-
ctx.stage.addExplicit(el);
|
|
3668
|
-
ctx.stage.connectWithExisting(el);
|
|
3669
|
-
return ctx.stage;
|
|
3670
|
-
}
|
|
3671
|
-
switch (true) {
|
|
3672
|
-
case expr.selector === "expanded":
|
|
3673
|
-
includeDeployedNodeWithExpanded(el, ctx);
|
|
3674
|
-
break;
|
|
3675
|
-
case expr.selector === "children":
|
|
3676
|
-
includeDeployedNodeChildren(el, ctx);
|
|
3677
|
-
break;
|
|
3678
|
-
case expr.selector === "descendants":
|
|
3679
|
-
includeDeployedNodeDescendants(el, ctx);
|
|
3680
|
-
break;
|
|
3681
|
-
default: {
|
|
3682
|
-
ctx.stage.addExplicit(el);
|
|
3683
|
-
ctx.stage.connectWithExisting(el);
|
|
3684
|
-
}
|
|
3685
|
-
}
|
|
3686
|
-
return ctx.stage;
|
|
3687
|
-
},
|
|
3688
|
-
exclude: ({ expr, stage, memory }) => {
|
|
3689
|
-
const exprPredicate = deploymentExpressionToPredicate(expr);
|
|
3690
|
-
stage.exclude([...memory.elements].filter(exprPredicate));
|
|
3691
|
-
return stage;
|
|
3692
|
-
}
|
|
3693
|
-
};
|
|
3694
|
-
function includeDeployedNodeChildren(node, { stage }) {
|
|
3695
|
-
const children = [...node.children()];
|
|
3696
|
-
if (children.length === 0) {
|
|
3697
|
-
return;
|
|
3698
|
-
}
|
|
3699
|
-
stage.addImplicit(node);
|
|
3700
|
-
stage.addConnections(findConnectionsWithin(children));
|
|
3701
|
-
stage.connectWithExisting(children);
|
|
3702
|
-
stage.addExplicit(children);
|
|
3703
|
-
}
|
|
3704
|
-
function includeDeployedNodeWithExpanded(node, { memory, stage }) {
|
|
3705
|
-
const children = [...node.children()];
|
|
3706
|
-
stage.addImplicit(node);
|
|
3707
|
-
stage.connectWithExisting(node);
|
|
3708
|
-
let hasConnectionsWithVisible = false;
|
|
3709
|
-
for (const child of children) {
|
|
3710
|
-
if (findConnectionsBetween(child, memory.elements).length > 0) {
|
|
3711
|
-
hasConnectionsWithVisible = true;
|
|
3712
|
-
break;
|
|
3713
|
-
}
|
|
3714
|
-
}
|
|
3715
|
-
if (hasConnectionsWithVisible) {
|
|
3716
|
-
stage.connectWithExisting(children, "in");
|
|
3717
|
-
stage.addConnections(findConnectionsWithin(children));
|
|
3718
|
-
stage.connectWithExisting(children, "out");
|
|
3719
|
-
}
|
|
3720
|
-
stage.addImplicit(children);
|
|
3721
|
-
if (stage.connections.length > 0) {
|
|
3722
|
-
stage.addExplicit(node);
|
|
3723
|
-
}
|
|
3724
|
-
}
|
|
3725
|
-
function includeDeployedNodeDescendants(node, { stage }) {
|
|
3726
|
-
const dfs = (node2) => {
|
|
3727
|
-
const children = [];
|
|
3728
|
-
for (const child of node2.children()) {
|
|
3729
|
-
if (child.isDeploymentNode()) {
|
|
3730
|
-
children.push(...dfs(child));
|
|
3731
|
-
}
|
|
3732
|
-
children.push(child);
|
|
3733
|
-
}
|
|
3734
|
-
stage.connectWithExisting(children, "in");
|
|
3735
|
-
stage.addConnections(findConnectionsWithin(children));
|
|
3736
|
-
stage.addImplicit(children);
|
|
3737
|
-
return children;
|
|
3738
|
-
};
|
|
3739
|
-
const descendants = dfs(node);
|
|
3740
|
-
if (descendants.length === 0) {
|
|
3741
|
-
return;
|
|
3742
|
-
}
|
|
3743
|
-
stage.connectWithExisting(descendants, "out");
|
|
3744
|
-
const allconnected = findConnectedElements(stage);
|
|
3745
|
-
descendants.forEach((desc) => {
|
|
3746
|
-
if (allconnected.has(desc)) {
|
|
3747
|
-
stage.addExplicit(desc);
|
|
3748
|
-
}
|
|
3749
|
-
});
|
|
3750
|
-
}
|
|
3751
|
-
function findConnectedElements(stage) {
|
|
3752
|
-
return object_hash.x(
|
|
3753
|
-
stage.mergedConnections(),
|
|
3754
|
-
cleanCrossBoundary,
|
|
3755
|
-
cleanRedundantRelationships,
|
|
3756
|
-
l$5((acc, c) => {
|
|
3757
|
-
acc.add(c.source);
|
|
3758
|
-
acc.add(c.target);
|
|
3759
|
-
return acc;
|
|
3760
|
-
}, /* @__PURE__ */ new Set())
|
|
3761
|
-
);
|
|
3762
|
-
}
|
|
3763
|
-
|
|
3764
3682
|
function isDeploymentNode(model) {
|
|
3765
3683
|
return model.isDeploymentNode();
|
|
3766
3684
|
}
|
|
@@ -3774,6 +3692,61 @@ function isDeploymentElementModel(x) {
|
|
|
3774
3692
|
return x instanceof DeploymentNodeModel || x instanceof DeployedInstanceModel;
|
|
3775
3693
|
}
|
|
3776
3694
|
|
|
3695
|
+
const IncomingRelationPredicate = {
|
|
3696
|
+
include: ({ expr, model, memory, stage, where }) => {
|
|
3697
|
+
const sources = [...memory.elements];
|
|
3698
|
+
if (view.FqnExpr.isWildcard(expr.incoming)) {
|
|
3699
|
+
for (const source of sources) {
|
|
3700
|
+
if (source.allOutgoing.isEmpty) {
|
|
3701
|
+
continue;
|
|
3702
|
+
}
|
|
3703
|
+
const targets2 = [...resolveAscendingSiblings(source)];
|
|
3704
|
+
const toInclude = applyPredicate(findConnectionsBetween(source, targets2, "directed"), where);
|
|
3705
|
+
stage.addConnections(toInclude);
|
|
3706
|
+
}
|
|
3707
|
+
return stage;
|
|
3708
|
+
}
|
|
3709
|
+
chunkWIMGWYZL.invariant(view.FqnExpr.isDeploymentRef(expr.incoming), "Only deployment refs are supported in include");
|
|
3710
|
+
const targets = resolveElements$1(model, expr.incoming);
|
|
3711
|
+
for (const source of sources) {
|
|
3712
|
+
const toInclude = applyPredicate(findConnectionsBetween(source, targets, "directed"), where);
|
|
3713
|
+
stage.addConnections(toInclude);
|
|
3714
|
+
}
|
|
3715
|
+
return stage;
|
|
3716
|
+
},
|
|
3717
|
+
exclude: ({ expr, model, memory, stage, where }) => {
|
|
3718
|
+
if (view.FqnExpr.isModelRef(expr.incoming)) {
|
|
3719
|
+
const excludedRelations = resolveAllImcomingRelations(model, expr.incoming);
|
|
3720
|
+
return excludeModelRelations(excludedRelations, { stage, memory }, where);
|
|
3721
|
+
}
|
|
3722
|
+
if (view.FqnExpr.isWildcard(expr.incoming)) {
|
|
3723
|
+
return stage;
|
|
3724
|
+
}
|
|
3725
|
+
const isIncoming = filterIncomingConnections(resolveElements$1(model, expr.incoming));
|
|
3726
|
+
const toExclude = object_hash.C(
|
|
3727
|
+
memory.connections,
|
|
3728
|
+
T(isIncoming),
|
|
3729
|
+
applyPredicate(where)
|
|
3730
|
+
);
|
|
3731
|
+
stage.excludeConnections(toExclude);
|
|
3732
|
+
return stage;
|
|
3733
|
+
}
|
|
3734
|
+
};
|
|
3735
|
+
function filterIncomingConnections(targets) {
|
|
3736
|
+
return view.y(
|
|
3737
|
+
targets.map((target) => {
|
|
3738
|
+
const satisfies = (el) => el === target || object_hash.isAncestor(target, el);
|
|
3739
|
+
return (connection) => {
|
|
3740
|
+
return !satisfies(connection.source) && satisfies(connection.target);
|
|
3741
|
+
};
|
|
3742
|
+
})
|
|
3743
|
+
);
|
|
3744
|
+
}
|
|
3745
|
+
function resolveAllImcomingRelations(model, moodelRef) {
|
|
3746
|
+
const targets = resolveModelElements(model, moodelRef);
|
|
3747
|
+
return new Set(targets.flatMap((e) => [...e.allIncoming]));
|
|
3748
|
+
}
|
|
3749
|
+
|
|
3777
3750
|
const OutgoingRelationPredicate = {
|
|
3778
3751
|
include: ({ expr, model, memory, stage, where }) => {
|
|
3779
3752
|
const targets = [...memory.elements];
|
|
@@ -3789,7 +3762,7 @@ const OutgoingRelationPredicate = {
|
|
|
3789
3762
|
}
|
|
3790
3763
|
return stage;
|
|
3791
3764
|
}
|
|
3792
|
-
|
|
3765
|
+
chunkWIMGWYZL.invariant(view.FqnExpr.isDeploymentRef(expr.outgoing), "Only deployment refs are supported in include");
|
|
3793
3766
|
const sources = resolveElements$1(model, expr.outgoing);
|
|
3794
3767
|
for (const source of sources) {
|
|
3795
3768
|
const toInclude = applyPredicate(findConnectionsBetween(source, targets, "directed"), where);
|
|
@@ -3806,7 +3779,7 @@ const OutgoingRelationPredicate = {
|
|
|
3806
3779
|
return stage;
|
|
3807
3780
|
}
|
|
3808
3781
|
const isOutgoing = filterOutgoingConnections(resolveElements$1(model, expr.outgoing));
|
|
3809
|
-
const toExclude = object_hash.
|
|
3782
|
+
const toExclude = object_hash.C(
|
|
3810
3783
|
memory.connections,
|
|
3811
3784
|
T(isOutgoing),
|
|
3812
3785
|
applyPredicate(where)
|
|
@@ -3830,44 +3803,210 @@ function resolveAllOutgoingRelations(model, moodelRef) {
|
|
|
3830
3803
|
return new Set(targets.flatMap((e) => [...e.allOutgoing]));
|
|
3831
3804
|
}
|
|
3832
3805
|
|
|
3833
|
-
const
|
|
3834
|
-
|
|
3835
|
-
|
|
3836
|
-
|
|
3837
|
-
|
|
3838
|
-
|
|
3839
|
-
|
|
3840
|
-
|
|
3806
|
+
const resolveAscendingSiblings = (element) => {
|
|
3807
|
+
const siblings = /* @__PURE__ */ new Set();
|
|
3808
|
+
for (let sibling of element.descendingSiblings()) {
|
|
3809
|
+
siblings.add(sibling);
|
|
3810
|
+
}
|
|
3811
|
+
return siblings;
|
|
3812
|
+
};
|
|
3813
|
+
const DirectRelationPredicate = {
|
|
3814
|
+
include: ({ expr: { source, target, isBidirectional = false }, model, stage, where }) => {
|
|
3815
|
+
chunkWIMGWYZL.invariant(!view.FqnExpr.isModelRef(source), "Invalid source model ref in direct relation");
|
|
3816
|
+
chunkWIMGWYZL.invariant(!view.FqnExpr.isModelRef(target), "Invalid target model ref in direct relation");
|
|
3817
|
+
const sourceIsWildcard = view.FqnExpr.isWildcard(source);
|
|
3818
|
+
const targetIsWildcard = view.FqnExpr.isWildcard(target);
|
|
3819
|
+
const dir = isBidirectional ? "both" : "directed";
|
|
3820
|
+
let connections;
|
|
3821
|
+
switch (true) {
|
|
3822
|
+
// * -> *
|
|
3823
|
+
case (sourceIsWildcard && targetIsWildcard): {
|
|
3824
|
+
connections = object_hash.C(
|
|
3825
|
+
findConnectionsWithin(model.instances()),
|
|
3826
|
+
applyPredicate(where),
|
|
3827
|
+
object_hash.m((c) => {
|
|
3828
|
+
stage.addImplicit(c.boundary);
|
|
3829
|
+
return c;
|
|
3830
|
+
})
|
|
3831
|
+
);
|
|
3832
|
+
break;
|
|
3833
|
+
}
|
|
3834
|
+
// source -> *; source <-> *
|
|
3835
|
+
case (!sourceIsWildcard && targetIsWildcard): {
|
|
3836
|
+
const sources = resolveElements$1(model, source);
|
|
3837
|
+
const isSource = filterOutgoingConnections(sources);
|
|
3838
|
+
let postFilter = isSource;
|
|
3839
|
+
if (isBidirectional) {
|
|
3840
|
+
const isTarget = filterIncomingConnections(sources);
|
|
3841
|
+
postFilter = (c) => isSource(c) !== isTarget(c);
|
|
3842
|
+
}
|
|
3843
|
+
connections = object_hash.C(
|
|
3844
|
+
sources,
|
|
3845
|
+
u$1((source2) => {
|
|
3846
|
+
const targets = resolveAscendingSiblings(source2);
|
|
3847
|
+
return findConnectionsBetween(source2, targets, dir);
|
|
3848
|
+
}),
|
|
3849
|
+
T(postFilter),
|
|
3850
|
+
applyPredicate(where)
|
|
3851
|
+
);
|
|
3852
|
+
break;
|
|
3853
|
+
}
|
|
3854
|
+
// * -> target; * <-> target
|
|
3855
|
+
case (sourceIsWildcard && !targetIsWildcard): {
|
|
3856
|
+
const targets = resolveElements$1(model, target);
|
|
3857
|
+
const isTarget = filterIncomingConnections(targets);
|
|
3858
|
+
let postFilter = isTarget;
|
|
3859
|
+
if (isBidirectional) {
|
|
3860
|
+
const isSource = filterOutgoingConnections(targets);
|
|
3861
|
+
postFilter = (c) => isSource(c) !== isTarget(c);
|
|
3862
|
+
}
|
|
3863
|
+
connections = object_hash.C(
|
|
3864
|
+
targets,
|
|
3865
|
+
u$1((target2) => {
|
|
3866
|
+
const sources = resolveAscendingSiblings(target2);
|
|
3867
|
+
return [...sources].flatMap((source2) => findConnection(source2, target2, dir));
|
|
3868
|
+
}),
|
|
3869
|
+
T(postFilter),
|
|
3870
|
+
applyPredicate(where)
|
|
3871
|
+
);
|
|
3872
|
+
break;
|
|
3873
|
+
}
|
|
3874
|
+
default: {
|
|
3875
|
+
chunkWIMGWYZL.invariant(!sourceIsWildcard, "Inferrence failed - source should be a deployment ref");
|
|
3876
|
+
chunkWIMGWYZL.invariant(!targetIsWildcard, "Inferrence failed - target should be a deployment ref");
|
|
3877
|
+
const sources = resolveElements$1(model, source);
|
|
3878
|
+
const targets = resolveElements$1(model, target);
|
|
3879
|
+
const isSource = filterOutgoingConnections(sources);
|
|
3880
|
+
const isTarget = filterIncomingConnections(targets);
|
|
3881
|
+
connections = object_hash.C(
|
|
3882
|
+
sources,
|
|
3883
|
+
u$1((s) => findConnectionsBetween(s, targets, dir)),
|
|
3884
|
+
T((c) => isSource(c) && isTarget(c)),
|
|
3885
|
+
applyPredicate(where)
|
|
3886
|
+
);
|
|
3841
3887
|
}
|
|
3842
|
-
return stage;
|
|
3843
3888
|
}
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
|
|
3847
|
-
|
|
3848
|
-
|
|
3889
|
+
stage.addConnections(connections);
|
|
3890
|
+
if (view.FqnExpr.isDeploymentRef(source) && object_hash.l(source.selector)) {
|
|
3891
|
+
stage.addImplicit(model.element(source.ref.deployment));
|
|
3892
|
+
}
|
|
3893
|
+
if (view.FqnExpr.isDeploymentRef(target) && object_hash.l(target.selector)) {
|
|
3894
|
+
stage.addImplicit(model.element(target.ref.deployment));
|
|
3849
3895
|
}
|
|
3850
3896
|
return stage;
|
|
3851
3897
|
},
|
|
3852
3898
|
exclude: ({ expr, model, memory, stage, where }) => {
|
|
3853
|
-
|
|
3854
|
-
|
|
3855
|
-
|
|
3899
|
+
const isTarget = deploymentExpressionToPredicate(expr.target);
|
|
3900
|
+
const isSource = deploymentExpressionToPredicate(expr.source);
|
|
3901
|
+
let modelRelationsToExclude;
|
|
3902
|
+
switch (true) {
|
|
3903
|
+
// * -> *
|
|
3904
|
+
case (view.FqnExpr.isWildcard(expr.source) && view.FqnExpr.isWildcard(expr.target)):
|
|
3905
|
+
stage.excludeConnections(applyPredicate(memory.connections, where));
|
|
3856
3906
|
return stage;
|
|
3857
|
-
|
|
3858
|
-
|
|
3859
|
-
|
|
3860
|
-
|
|
3861
|
-
|
|
3862
|
-
|
|
3863
|
-
|
|
3864
|
-
|
|
3907
|
+
// model -> model
|
|
3908
|
+
case (view.FqnExpr.isModelRef(expr.source) && view.FqnExpr.isModelRef(expr.target)):
|
|
3909
|
+
modelRelationsToExclude = resolveRelationsBetweenModelElements({
|
|
3910
|
+
source: expr.source,
|
|
3911
|
+
target: expr.target,
|
|
3912
|
+
expr,
|
|
3913
|
+
model
|
|
3914
|
+
});
|
|
3915
|
+
return excludeModelRelations(modelRelationsToExclude, { stage, memory }, where);
|
|
3916
|
+
// model -> *
|
|
3917
|
+
case (view.FqnExpr.isModelRef(expr.source) && view.FqnExpr.isWildcard(expr.target)):
|
|
3918
|
+
modelRelationsToExclude = resolveAllOutgoingRelations(model, expr.source);
|
|
3919
|
+
return excludeModelRelations(modelRelationsToExclude, { stage, memory }, where);
|
|
3920
|
+
// model -> deployment
|
|
3921
|
+
case view.FqnExpr.isModelRef(expr.source):
|
|
3922
|
+
modelRelationsToExclude = resolveAllOutgoingRelations(model, expr.source);
|
|
3923
|
+
return excludeModelRelations(
|
|
3924
|
+
modelRelationsToExclude,
|
|
3925
|
+
{ stage, memory },
|
|
3926
|
+
where,
|
|
3927
|
+
(c) => isTarget(c.target)
|
|
3928
|
+
);
|
|
3929
|
+
// deployment -> model
|
|
3930
|
+
case view.FqnExpr.isModelRef(expr.target):
|
|
3931
|
+
modelRelationsToExclude = resolveAllImcomingRelations(model, expr.target);
|
|
3932
|
+
return excludeModelRelations(
|
|
3933
|
+
modelRelationsToExclude,
|
|
3934
|
+
{ stage, memory },
|
|
3935
|
+
where,
|
|
3936
|
+
(c) => isSource(c.source)
|
|
3937
|
+
);
|
|
3938
|
+
// deployment -> deployment
|
|
3939
|
+
default:
|
|
3940
|
+
const satisfies = (connection) => {
|
|
3941
|
+
return isSource(connection.source) && isTarget(connection.target) || expr.isBidirectional === true && isSource(connection.target) && isTarget(connection.source);
|
|
3942
|
+
};
|
|
3943
|
+
const deploymentRelationsToExclude = object_hash.C(
|
|
3944
|
+
memory.connections,
|
|
3945
|
+
T(satisfies),
|
|
3946
|
+
applyPredicate(where)
|
|
3947
|
+
);
|
|
3948
|
+
if (deploymentRelationsToExclude.length === 0) {
|
|
3949
|
+
return stage;
|
|
3950
|
+
}
|
|
3951
|
+
stage.excludeConnections(deploymentRelationsToExclude);
|
|
3952
|
+
return stage;
|
|
3953
|
+
}
|
|
3954
|
+
}
|
|
3955
|
+
};
|
|
3956
|
+
function resolveRelationsBetweenModelElements({
|
|
3957
|
+
source,
|
|
3958
|
+
target,
|
|
3959
|
+
expr,
|
|
3960
|
+
model
|
|
3961
|
+
}) {
|
|
3962
|
+
const sources = resolveModelElements(model, source);
|
|
3963
|
+
const targets = resolveModelElements(model, target);
|
|
3964
|
+
const dir = expr.isBidirectional ? "both" : "directed";
|
|
3965
|
+
const modelConnections = [];
|
|
3966
|
+
for (const source2 of sources) {
|
|
3967
|
+
modelConnections.push(...findConnectionsBetween$1(source2, targets, dir));
|
|
3968
|
+
}
|
|
3969
|
+
return new Set(modelConnections.flatMap((c) => [...c.relations]));
|
|
3970
|
+
}
|
|
3971
|
+
|
|
3972
|
+
const InOutRelationPredicate$1 = {
|
|
3973
|
+
include: ({ expr, model, memory, stage, where }) => {
|
|
3974
|
+
const sources = [...memory.elements];
|
|
3975
|
+
if (view.FqnExpr.isWildcard(expr.inout)) {
|
|
3976
|
+
for (const source of sources) {
|
|
3977
|
+
const targets2 = [...resolveAscendingSiblings(source)];
|
|
3978
|
+
const toInclude = matchConnections(findConnectionsBetween(source, targets2, "both"), where);
|
|
3979
|
+
stage.addConnections(toInclude);
|
|
3980
|
+
}
|
|
3981
|
+
return stage;
|
|
3982
|
+
}
|
|
3983
|
+
chunkWIMGWYZL.invariant(view.FqnExpr.isDeploymentRef(expr.inout), "Only deployment refs are supported in include");
|
|
3984
|
+
const targets = resolveElements$1(model, expr.inout);
|
|
3985
|
+
for (const source of sources) {
|
|
3986
|
+
const toInclude = matchConnections(findConnectionsBetween(source, targets, "both"), where);
|
|
3987
|
+
stage.addConnections(toInclude);
|
|
3988
|
+
}
|
|
3989
|
+
return stage;
|
|
3990
|
+
},
|
|
3991
|
+
exclude: ({ expr, model, memory, stage, where }) => {
|
|
3992
|
+
if (view.FqnExpr.isModelRef(expr.inout)) {
|
|
3993
|
+
const elements2 = resolveModelElements(model, expr.inout);
|
|
3994
|
+
if (elements2.length === 0) {
|
|
3995
|
+
return stage;
|
|
3996
|
+
}
|
|
3997
|
+
const excludedRelations = object_hash.union(
|
|
3998
|
+
/* @__PURE__ */ new Set(),
|
|
3999
|
+
...elements2.flatMap((e) => [e.allIncoming, e.allOutgoing])
|
|
4000
|
+
);
|
|
4001
|
+
return excludeModelRelations(excludedRelations, { stage, memory }, where);
|
|
4002
|
+
}
|
|
4003
|
+
if (view.FqnExpr.isWildcard(expr.inout)) {
|
|
3865
4004
|
return stage;
|
|
3866
4005
|
}
|
|
3867
4006
|
const elements = resolveElements$1(model, expr.inout);
|
|
3868
4007
|
const isIncoming = filterIncomingConnections(elements);
|
|
3869
4008
|
const isOutgoing = filterOutgoingConnections(elements);
|
|
3870
|
-
const toExclude = object_hash.
|
|
4009
|
+
const toExclude = object_hash.C(
|
|
3871
4010
|
memory.connections,
|
|
3872
4011
|
T((c) => isIncoming(c) !== isOutgoing(c)),
|
|
3873
4012
|
applyPredicate(where)
|
|
@@ -3889,14 +4028,18 @@ const WhereRelationPredicate = {
|
|
|
3889
4028
|
};
|
|
3890
4029
|
|
|
3891
4030
|
const WildcardPredicate$1 = {
|
|
3892
|
-
include: ({ model, stage }) => {
|
|
4031
|
+
include: ({ model, stage, where }) => {
|
|
3893
4032
|
const children = [];
|
|
3894
|
-
const rootElements =
|
|
3895
|
-
|
|
3896
|
-
|
|
3897
|
-
|
|
3898
|
-
|
|
3899
|
-
|
|
4033
|
+
const rootElements = object_hash.C(
|
|
4034
|
+
[...model.roots()],
|
|
4035
|
+
applyElementPredicate(where),
|
|
4036
|
+
object_hash.m((root) => {
|
|
4037
|
+
if (!root.onlyOneInstance()) {
|
|
4038
|
+
children.push(...root.children());
|
|
4039
|
+
}
|
|
4040
|
+
return root;
|
|
4041
|
+
})
|
|
4042
|
+
);
|
|
3900
4043
|
stage.addExplicit(rootElements);
|
|
3901
4044
|
if (children.length > 1) {
|
|
3902
4045
|
stage.addConnections(findConnectionsWithin([
|
|
@@ -3906,8 +4049,12 @@ const WildcardPredicate$1 = {
|
|
|
3906
4049
|
}
|
|
3907
4050
|
return stage;
|
|
3908
4051
|
},
|
|
3909
|
-
exclude: ({ stage, memory }) => {
|
|
3910
|
-
|
|
4052
|
+
exclude: ({ stage, memory, where }) => {
|
|
4053
|
+
const elementsToExclude = object_hash.C(
|
|
4054
|
+
[...memory.elements],
|
|
4055
|
+
applyElementPredicate(where)
|
|
4056
|
+
);
|
|
4057
|
+
stage.exclude(elementsToExclude);
|
|
3911
4058
|
return stage;
|
|
3912
4059
|
}
|
|
3913
4060
|
};
|
|
@@ -3931,14 +4078,14 @@ function predicateToPatch(op, { expr, where, ...ctx }) {
|
|
|
3931
4078
|
case view.RelationExpr.isWhere(expr):
|
|
3932
4079
|
return WhereRelationPredicate[op]({ ...ctx, expr, where });
|
|
3933
4080
|
default:
|
|
3934
|
-
|
|
4081
|
+
chunkWIMGWYZL.nonexhaustive(expr);
|
|
3935
4082
|
}
|
|
3936
4083
|
}
|
|
3937
4084
|
function excludeModelRelations(relationsToExclude, { stage, memory }, where, filterConnections = () => true) {
|
|
3938
4085
|
if (relationsToExclude.size === 0) {
|
|
3939
4086
|
return stage;
|
|
3940
4087
|
}
|
|
3941
|
-
const toExclude = object_hash.
|
|
4088
|
+
const toExclude = object_hash.C(
|
|
3942
4089
|
memory.connections,
|
|
3943
4090
|
T((c) => filterConnections(c)),
|
|
3944
4091
|
// Find connections that have at least one relation in common with the excluded relations
|
|
@@ -3976,11 +4123,21 @@ function applyPredicate(...args) {
|
|
|
3976
4123
|
deployment: new Set([...c.relations.deployment.values()].filter((r) => where(toFilterableRelation(c)(r))))
|
|
3977
4124
|
});
|
|
3978
4125
|
}
|
|
4126
|
+
function applyElementPredicate(...args) {
|
|
4127
|
+
if (args.length === 1) {
|
|
4128
|
+
return (x) => applyElementPredicate(x, args[0]);
|
|
4129
|
+
}
|
|
4130
|
+
const [c, where] = args;
|
|
4131
|
+
if (view.o(c)) {
|
|
4132
|
+
return c.filter((x) => applyElementPredicate(x, where));
|
|
4133
|
+
}
|
|
4134
|
+
return where?.(toFilterable(c, c)) ?? true;
|
|
4135
|
+
}
|
|
3979
4136
|
function matchConnections(connections, where) {
|
|
3980
4137
|
if (!where) {
|
|
3981
4138
|
return connections;
|
|
3982
4139
|
}
|
|
3983
|
-
return object_hash.
|
|
4140
|
+
return object_hash.C(
|
|
3984
4141
|
connections,
|
|
3985
4142
|
T((c) => matchConnection(c, where))
|
|
3986
4143
|
);
|
|
@@ -4005,7 +4162,7 @@ function toFilterable(relationEndpoint, connectionEndpoint) {
|
|
|
4005
4162
|
if (isDeploymentNode(relationEndpoint)) {
|
|
4006
4163
|
return i$6(relationEndpoint, ["tags", "kind"]);
|
|
4007
4164
|
}
|
|
4008
|
-
|
|
4165
|
+
chunkWIMGWYZL.nonexhaustive(relationEndpoint);
|
|
4009
4166
|
}
|
|
4010
4167
|
function toFilterableRelation(c) {
|
|
4011
4168
|
return (relation) => ({
|
|
@@ -4016,225 +4173,117 @@ function toFilterableRelation(c) {
|
|
|
4016
4173
|
});
|
|
4017
4174
|
}
|
|
4018
4175
|
|
|
4019
|
-
const
|
|
4020
|
-
include: (
|
|
4021
|
-
const
|
|
4022
|
-
|
|
4023
|
-
|
|
4024
|
-
|
|
4025
|
-
|
|
4026
|
-
|
|
4027
|
-
const targets2 = [...resolveAscendingSiblings(source)];
|
|
4028
|
-
const toInclude = applyPredicate(findConnectionsBetween(source, targets2, "directed"), where);
|
|
4029
|
-
stage.addConnections(toInclude);
|
|
4176
|
+
const DeploymentRefPredicate = {
|
|
4177
|
+
include: (ctx) => {
|
|
4178
|
+
const { expr, where } = ctx;
|
|
4179
|
+
const el = ctx.model.element(expr.ref.deployment);
|
|
4180
|
+
if (isDeployedInstance(el)) {
|
|
4181
|
+
if (applyElementPredicate(el, where)) {
|
|
4182
|
+
ctx.stage.addExplicit(el);
|
|
4183
|
+
ctx.stage.connectWithExisting(el);
|
|
4030
4184
|
}
|
|
4031
|
-
return stage;
|
|
4185
|
+
return ctx.stage;
|
|
4032
4186
|
}
|
|
4033
|
-
|
|
4034
|
-
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
|
|
4187
|
+
switch (true) {
|
|
4188
|
+
case expr.selector === "expanded":
|
|
4189
|
+
includeDeployedNodeWithExpanded(el, ctx);
|
|
4190
|
+
break;
|
|
4191
|
+
case expr.selector === "children":
|
|
4192
|
+
includeDeployedNodeChildren(el, ctx);
|
|
4193
|
+
break;
|
|
4194
|
+
case expr.selector === "descendants":
|
|
4195
|
+
includeDeployedNodeDescendants(el, ctx);
|
|
4196
|
+
break;
|
|
4197
|
+
default: {
|
|
4198
|
+
if (applyElementPredicate(el, where)) {
|
|
4199
|
+
ctx.stage.addExplicit(el);
|
|
4200
|
+
ctx.stage.connectWithExisting(el);
|
|
4201
|
+
}
|
|
4202
|
+
}
|
|
4038
4203
|
}
|
|
4039
|
-
return stage;
|
|
4204
|
+
return ctx.stage;
|
|
4040
4205
|
},
|
|
4041
|
-
exclude: ({ expr,
|
|
4042
|
-
|
|
4043
|
-
|
|
4044
|
-
|
|
4045
|
-
|
|
4046
|
-
|
|
4047
|
-
return stage;
|
|
4048
|
-
}
|
|
4049
|
-
const isIncoming = filterIncomingConnections(resolveElements$1(model, expr.incoming));
|
|
4050
|
-
const toExclude = object_hash.x(
|
|
4051
|
-
memory.connections,
|
|
4052
|
-
T(isIncoming),
|
|
4053
|
-
applyPredicate(where)
|
|
4206
|
+
exclude: ({ expr, stage, memory, where }) => {
|
|
4207
|
+
const exprPredicate = deploymentExpressionToPredicate(expr);
|
|
4208
|
+
const toExclude = object_hash.C(
|
|
4209
|
+
[...memory.elements],
|
|
4210
|
+
T(exprPredicate),
|
|
4211
|
+
applyElementPredicate(where)
|
|
4054
4212
|
);
|
|
4055
|
-
stage.
|
|
4213
|
+
stage.exclude(toExclude);
|
|
4056
4214
|
return stage;
|
|
4057
4215
|
}
|
|
4058
4216
|
};
|
|
4059
|
-
function
|
|
4060
|
-
|
|
4061
|
-
|
|
4062
|
-
|
|
4063
|
-
|
|
4064
|
-
|
|
4065
|
-
|
|
4066
|
-
|
|
4067
|
-
);
|
|
4068
|
-
}
|
|
4069
|
-
function resolveAllImcomingRelations(model, moodelRef) {
|
|
4070
|
-
const targets = resolveModelElements(model, moodelRef);
|
|
4071
|
-
return new Set(targets.flatMap((e) => [...e.allIncoming]));
|
|
4217
|
+
function includeDeployedNodeChildren(node, { stage, where }) {
|
|
4218
|
+
const children = applyElementPredicate([...node.children()], where);
|
|
4219
|
+
if (children.length === 0) {
|
|
4220
|
+
return;
|
|
4221
|
+
}
|
|
4222
|
+
stage.addImplicit(node);
|
|
4223
|
+
stage.addConnections(findConnectionsWithin(children));
|
|
4224
|
+
stage.connectWithExisting(children);
|
|
4225
|
+
stage.addExplicit(children);
|
|
4072
4226
|
}
|
|
4073
|
-
|
|
4074
|
-
|
|
4075
|
-
|
|
4076
|
-
|
|
4077
|
-
|
|
4227
|
+
function includeDeployedNodeWithExpanded(node, { memory, stage, where }) {
|
|
4228
|
+
stage.addImplicit(node);
|
|
4229
|
+
stage.connectWithExisting(node);
|
|
4230
|
+
const children = applyElementPredicate([...node.children()], where);
|
|
4231
|
+
let hasConnectionsWithVisible = false;
|
|
4232
|
+
for (const child of children) {
|
|
4233
|
+
if (findConnectionsBetween(child, memory.elements).length > 0) {
|
|
4234
|
+
hasConnectionsWithVisible = true;
|
|
4235
|
+
break;
|
|
4236
|
+
}
|
|
4078
4237
|
}
|
|
4079
|
-
|
|
4080
|
-
|
|
4081
|
-
|
|
4082
|
-
|
|
4083
|
-
|
|
4084
|
-
|
|
4085
|
-
|
|
4086
|
-
|
|
4087
|
-
|
|
4088
|
-
|
|
4089
|
-
|
|
4090
|
-
|
|
4091
|
-
|
|
4092
|
-
|
|
4093
|
-
|
|
4094
|
-
|
|
4095
|
-
object_hash.m((c) => {
|
|
4096
|
-
stage.addImplicit(c.boundary);
|
|
4097
|
-
return c;
|
|
4098
|
-
})
|
|
4099
|
-
);
|
|
4100
|
-
break;
|
|
4101
|
-
}
|
|
4102
|
-
// source -> *; source <-> *
|
|
4103
|
-
case (!sourceIsWildcard && targetIsWildcard): {
|
|
4104
|
-
const sources = resolveElements$1(model, source);
|
|
4105
|
-
const isSource = filterOutgoingConnections(sources);
|
|
4106
|
-
let postFilter = isSource;
|
|
4107
|
-
if (isBidirectional) {
|
|
4108
|
-
const isTarget = filterIncomingConnections(sources);
|
|
4109
|
-
postFilter = (c) => isSource(c) !== isTarget(c);
|
|
4110
|
-
}
|
|
4111
|
-
connections = object_hash.x(
|
|
4112
|
-
sources,
|
|
4113
|
-
u$1((source2) => {
|
|
4114
|
-
const targets = resolveAscendingSiblings(source2);
|
|
4115
|
-
return findConnectionsBetween(source2, targets, dir);
|
|
4116
|
-
}),
|
|
4117
|
-
T(postFilter),
|
|
4118
|
-
applyPredicate(where)
|
|
4119
|
-
);
|
|
4120
|
-
break;
|
|
4121
|
-
}
|
|
4122
|
-
// * -> target; * <-> target
|
|
4123
|
-
case (sourceIsWildcard && !targetIsWildcard): {
|
|
4124
|
-
const targets = resolveElements$1(model, target);
|
|
4125
|
-
const isTarget = filterIncomingConnections(targets);
|
|
4126
|
-
let postFilter = isTarget;
|
|
4127
|
-
if (isBidirectional) {
|
|
4128
|
-
const isSource = filterOutgoingConnections(targets);
|
|
4129
|
-
postFilter = (c) => isSource(c) !== isTarget(c);
|
|
4130
|
-
}
|
|
4131
|
-
connections = object_hash.x(
|
|
4132
|
-
targets,
|
|
4133
|
-
u$1((target2) => {
|
|
4134
|
-
const sources = resolveAscendingSiblings(target2);
|
|
4135
|
-
return [...sources].flatMap((source2) => findConnection(source2, target2, dir));
|
|
4136
|
-
}),
|
|
4137
|
-
T(postFilter),
|
|
4138
|
-
applyPredicate(where)
|
|
4139
|
-
);
|
|
4140
|
-
break;
|
|
4238
|
+
if (hasConnectionsWithVisible) {
|
|
4239
|
+
stage.connectWithExisting(children, "in");
|
|
4240
|
+
stage.addConnections(findConnectionsWithin(children));
|
|
4241
|
+
stage.connectWithExisting(children, "out");
|
|
4242
|
+
}
|
|
4243
|
+
stage.addImplicit(children);
|
|
4244
|
+
if (stage.connections.length > 0) {
|
|
4245
|
+
stage.addExplicit(node);
|
|
4246
|
+
}
|
|
4247
|
+
}
|
|
4248
|
+
function includeDeployedNodeDescendants(node, { stage, where }) {
|
|
4249
|
+
const dfs = (node2) => {
|
|
4250
|
+
const children = [];
|
|
4251
|
+
for (const child of node2.children()) {
|
|
4252
|
+
if (child.isDeploymentNode()) {
|
|
4253
|
+
children.push(...dfs(child));
|
|
4141
4254
|
}
|
|
4142
|
-
|
|
4143
|
-
|
|
4144
|
-
chunkRAAYCPUM.invariant(!targetIsWildcard, "Inferrence failed - target should be a deployment ref");
|
|
4145
|
-
const sources = resolveElements$1(model, source);
|
|
4146
|
-
const targets = resolveElements$1(model, target);
|
|
4147
|
-
const isSource = filterOutgoingConnections(sources);
|
|
4148
|
-
const isTarget = filterIncomingConnections(targets);
|
|
4149
|
-
connections = object_hash.x(
|
|
4150
|
-
sources,
|
|
4151
|
-
u$1((s) => findConnectionsBetween(s, targets, dir)),
|
|
4152
|
-
T((c) => isSource(c) && isTarget(c)),
|
|
4153
|
-
applyPredicate(where)
|
|
4154
|
-
);
|
|
4255
|
+
if (applyElementPredicate(child, where)) {
|
|
4256
|
+
children.push(child);
|
|
4155
4257
|
}
|
|
4156
4258
|
}
|
|
4157
|
-
stage.
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
|
|
4161
|
-
|
|
4162
|
-
|
|
4163
|
-
|
|
4164
|
-
return
|
|
4165
|
-
},
|
|
4166
|
-
exclude: ({ expr, model, memory, stage, where }) => {
|
|
4167
|
-
const isTarget = deploymentExpressionToPredicate(expr.target);
|
|
4168
|
-
const isSource = deploymentExpressionToPredicate(expr.source);
|
|
4169
|
-
let modelRelationsToExclude;
|
|
4170
|
-
switch (true) {
|
|
4171
|
-
// * -> *
|
|
4172
|
-
case (view.FqnExpr.isWildcard(expr.source) && view.FqnExpr.isWildcard(expr.target)):
|
|
4173
|
-
stage.excludeConnections(applyPredicate(memory.connections, where));
|
|
4174
|
-
return stage;
|
|
4175
|
-
// model -> model
|
|
4176
|
-
case (view.FqnExpr.isModelRef(expr.source) && view.FqnExpr.isModelRef(expr.target)):
|
|
4177
|
-
modelRelationsToExclude = resolveRelationsBetweenModelElements({
|
|
4178
|
-
source: expr.source,
|
|
4179
|
-
target: expr.target,
|
|
4180
|
-
expr,
|
|
4181
|
-
model
|
|
4182
|
-
});
|
|
4183
|
-
return excludeModelRelations(modelRelationsToExclude, { stage, memory }, where);
|
|
4184
|
-
// model -> *
|
|
4185
|
-
case (view.FqnExpr.isModelRef(expr.source) && view.FqnExpr.isWildcard(expr.target)):
|
|
4186
|
-
modelRelationsToExclude = resolveAllOutgoingRelations(model, expr.source);
|
|
4187
|
-
return excludeModelRelations(modelRelationsToExclude, { stage, memory }, where);
|
|
4188
|
-
// model -> deployment
|
|
4189
|
-
case view.FqnExpr.isModelRef(expr.source):
|
|
4190
|
-
modelRelationsToExclude = resolveAllOutgoingRelations(model, expr.source);
|
|
4191
|
-
return excludeModelRelations(
|
|
4192
|
-
modelRelationsToExclude,
|
|
4193
|
-
{ stage, memory },
|
|
4194
|
-
where,
|
|
4195
|
-
(c) => isTarget(c.target)
|
|
4196
|
-
);
|
|
4197
|
-
// deployment -> model
|
|
4198
|
-
case view.FqnExpr.isModelRef(expr.target):
|
|
4199
|
-
modelRelationsToExclude = resolveAllImcomingRelations(model, expr.target);
|
|
4200
|
-
return excludeModelRelations(
|
|
4201
|
-
modelRelationsToExclude,
|
|
4202
|
-
{ stage, memory },
|
|
4203
|
-
where,
|
|
4204
|
-
(c) => isSource(c.source)
|
|
4205
|
-
);
|
|
4206
|
-
// deployment -> deployment
|
|
4207
|
-
default:
|
|
4208
|
-
const satisfies = (connection) => {
|
|
4209
|
-
return isSource(connection.source) && isTarget(connection.target) || expr.isBidirectional === true && isSource(connection.target) && isTarget(connection.source);
|
|
4210
|
-
};
|
|
4211
|
-
const deploymentRelationsToExclude = object_hash.x(
|
|
4212
|
-
memory.connections,
|
|
4213
|
-
T(satisfies),
|
|
4214
|
-
applyPredicate(where)
|
|
4215
|
-
);
|
|
4216
|
-
if (deploymentRelationsToExclude.length === 0) {
|
|
4217
|
-
return stage;
|
|
4218
|
-
}
|
|
4219
|
-
stage.excludeConnections(deploymentRelationsToExclude);
|
|
4220
|
-
return stage;
|
|
4221
|
-
}
|
|
4222
|
-
}
|
|
4223
|
-
};
|
|
4224
|
-
function resolveRelationsBetweenModelElements({
|
|
4225
|
-
source,
|
|
4226
|
-
target,
|
|
4227
|
-
expr,
|
|
4228
|
-
model
|
|
4229
|
-
}) {
|
|
4230
|
-
const sources = resolveModelElements(model, source);
|
|
4231
|
-
const targets = resolveModelElements(model, target);
|
|
4232
|
-
const dir = expr.isBidirectional ? "both" : "directed";
|
|
4233
|
-
const modelConnections = [];
|
|
4234
|
-
for (const source2 of sources) {
|
|
4235
|
-
modelConnections.push(...findConnectionsBetween$1(source2, targets, dir));
|
|
4259
|
+
stage.connectWithExisting(children, "in");
|
|
4260
|
+
stage.addConnections(findConnectionsWithin(children));
|
|
4261
|
+
stage.addImplicit(children);
|
|
4262
|
+
return children;
|
|
4263
|
+
};
|
|
4264
|
+
const descendants = dfs(node);
|
|
4265
|
+
if (descendants.length === 0) {
|
|
4266
|
+
return;
|
|
4236
4267
|
}
|
|
4237
|
-
|
|
4268
|
+
stage.connectWithExisting(descendants, "out");
|
|
4269
|
+
const allConnected = findConnectedElements(stage);
|
|
4270
|
+
object_hash.C(
|
|
4271
|
+
descendants,
|
|
4272
|
+
T((desc) => allConnected.has(desc)),
|
|
4273
|
+
u((desc) => stage.addExplicit(desc))
|
|
4274
|
+
);
|
|
4275
|
+
}
|
|
4276
|
+
function findConnectedElements(stage) {
|
|
4277
|
+
return object_hash.C(
|
|
4278
|
+
stage.mergedConnections(),
|
|
4279
|
+
cleanCrossBoundary,
|
|
4280
|
+
cleanRedundantRelationships,
|
|
4281
|
+
l$5((acc, c) => {
|
|
4282
|
+
acc.add(c.source);
|
|
4283
|
+
acc.add(c.target);
|
|
4284
|
+
return acc;
|
|
4285
|
+
}, /* @__PURE__ */ new Set())
|
|
4286
|
+
);
|
|
4238
4287
|
}
|
|
4239
4288
|
|
|
4240
4289
|
let StageFinal$1 = class StageFinal {
|
|
@@ -4248,7 +4297,7 @@ let StageFinal$1 = class StageFinal {
|
|
|
4248
4297
|
if (memory.connections.length < 2) {
|
|
4249
4298
|
return memory;
|
|
4250
4299
|
}
|
|
4251
|
-
const connections = object_hash.
|
|
4300
|
+
const connections = object_hash.C(
|
|
4252
4301
|
memory.connections,
|
|
4253
4302
|
// Keep connections
|
|
4254
4303
|
// - between leafs
|
|
@@ -4300,7 +4349,7 @@ let StageFinal$1 = class StageFinal {
|
|
|
4300
4349
|
}
|
|
4301
4350
|
return false;
|
|
4302
4351
|
};
|
|
4303
|
-
object_hash.
|
|
4352
|
+
object_hash.C(
|
|
4304
4353
|
object_hash.difference(implicits, snapshot),
|
|
4305
4354
|
object_hash.ifilter((e) => e.isDeploymentNode()),
|
|
4306
4355
|
object_hash.toArray(),
|
|
@@ -4485,7 +4534,15 @@ function applyCustomElementProperties(_rules, _nodes) {
|
|
|
4485
4534
|
for (const {
|
|
4486
4535
|
custom: { expr, ...props }
|
|
4487
4536
|
} of rules) {
|
|
4488
|
-
const {
|
|
4537
|
+
const {
|
|
4538
|
+
border,
|
|
4539
|
+
opacity,
|
|
4540
|
+
multiple,
|
|
4541
|
+
padding,
|
|
4542
|
+
size,
|
|
4543
|
+
textSize,
|
|
4544
|
+
...rest
|
|
4545
|
+
} = d$1(props, view.n);
|
|
4489
4546
|
const notEmpty = !n(rest);
|
|
4490
4547
|
const satisfies = elementExprToPredicate(expr);
|
|
4491
4548
|
nodes.forEach((node, i) => {
|
|
@@ -4509,6 +4566,15 @@ function applyCustomElementProperties(_rules, _nodes) {
|
|
|
4509
4566
|
if (multiple !== undefined) {
|
|
4510
4567
|
styleOverride = { ...styleOverride, multiple };
|
|
4511
4568
|
}
|
|
4569
|
+
if (padding !== undefined) {
|
|
4570
|
+
styleOverride = { ...styleOverride, padding };
|
|
4571
|
+
}
|
|
4572
|
+
if (size !== undefined) {
|
|
4573
|
+
styleOverride = { ...styleOverride, size };
|
|
4574
|
+
}
|
|
4575
|
+
if (textSize !== undefined) {
|
|
4576
|
+
styleOverride = { ...styleOverride, textSize };
|
|
4577
|
+
}
|
|
4512
4578
|
if (styleOverride) {
|
|
4513
4579
|
node = {
|
|
4514
4580
|
...node,
|
|
@@ -4657,8 +4723,8 @@ class DynamicViewCompute {
|
|
|
4657
4723
|
const elements = [...this.explicits].map((e) => e.$element);
|
|
4658
4724
|
const nodesMap = buildComputedNodesFromElements(elements);
|
|
4659
4725
|
const edges = this.steps.map(({ source, target, relations, title, isBackward, ...step }) => {
|
|
4660
|
-
const sourceNode =
|
|
4661
|
-
const targetNode =
|
|
4726
|
+
const sourceNode = chunkWIMGWYZL.nonNullable(nodesMap.get(source.id), `Source node ${source.id} not found`);
|
|
4727
|
+
const targetNode = chunkWIMGWYZL.nonNullable(nodesMap.get(target.id), `Target node ${target.id} not found`);
|
|
4662
4728
|
const edge = {
|
|
4663
4729
|
parent: object_hash.commonAncestor(source.id, target.id),
|
|
4664
4730
|
source: source.id,
|
|
@@ -4697,7 +4763,7 @@ class DynamicViewCompute {
|
|
|
4697
4763
|
applyViewRuleStyles(
|
|
4698
4764
|
rules,
|
|
4699
4765
|
// Keep order of elements
|
|
4700
|
-
elements.map((e) =>
|
|
4766
|
+
elements.map((e) => chunkWIMGWYZL.nonNullable(nodesMap.get(e.id)))
|
|
4701
4767
|
)
|
|
4702
4768
|
);
|
|
4703
4769
|
const autoLayoutRule = o(rules, view.isViewRuleAutoLayout);
|
|
@@ -4739,7 +4805,7 @@ class DynamicViewCompute {
|
|
|
4739
4805
|
notation: null
|
|
4740
4806
|
};
|
|
4741
4807
|
}
|
|
4742
|
-
const alltags = object_hash.
|
|
4808
|
+
const alltags = object_hash.C(
|
|
4743
4809
|
relationships,
|
|
4744
4810
|
u$1((r) => r.tags),
|
|
4745
4811
|
T(n$2),
|
|
@@ -4749,7 +4815,7 @@ class DynamicViewCompute {
|
|
|
4749
4815
|
const relations = object_hash.i(relationships, 1) ? object_hash.m(relationships, (r) => r.id) : null;
|
|
4750
4816
|
const relation = t$2(relationships) || relationships.find((r) => r.source === source && r.target === target);
|
|
4751
4817
|
const relationNavigateTo = relation?.$relationship.navigateTo ?? null;
|
|
4752
|
-
const navigateTo = relationNavigateTo && relationNavigateTo !== this.view.id ? relationNavigateTo : object_hash.
|
|
4818
|
+
const navigateTo = relationNavigateTo && relationNavigateTo !== this.view.id ? relationNavigateTo : object_hash.C(
|
|
4753
4819
|
relationships,
|
|
4754
4820
|
object_hash.m((r) => r.$relationship.navigateTo),
|
|
4755
4821
|
T(n$2),
|
|
@@ -4757,7 +4823,7 @@ class DynamicViewCompute {
|
|
|
4757
4823
|
i$8(),
|
|
4758
4824
|
t$2()
|
|
4759
4825
|
);
|
|
4760
|
-
const commonProperties = object_hash.
|
|
4826
|
+
const commonProperties = object_hash.C(
|
|
4761
4827
|
relationships,
|
|
4762
4828
|
l$5((acc, { title, $relationship: r }) => {
|
|
4763
4829
|
n$2(title) && acc.title.add(title);
|
|
@@ -4824,7 +4890,7 @@ function relationExpressionToPredicates(expr) {
|
|
|
4824
4890
|
return (edge) => isSource(edge.source);
|
|
4825
4891
|
}
|
|
4826
4892
|
default:
|
|
4827
|
-
|
|
4893
|
+
chunkWIMGWYZL.nonexhaustive(expr);
|
|
4828
4894
|
}
|
|
4829
4895
|
}
|
|
4830
4896
|
|
|
@@ -4884,7 +4950,7 @@ class NodesGroup {
|
|
|
4884
4950
|
|
|
4885
4951
|
class StageExclude extends AbstractStageExclude {
|
|
4886
4952
|
excludeRelations(excluded) {
|
|
4887
|
-
object_hash.
|
|
4953
|
+
object_hash.C(
|
|
4888
4954
|
this.memory.connections,
|
|
4889
4955
|
T((c) => object_hash.hasIntersection(c.relations, excluded)),
|
|
4890
4956
|
u((c) => {
|
|
@@ -4981,10 +5047,10 @@ class StageInclude extends AbstractStageInclude {
|
|
|
4981
5047
|
if (view.isRelationPredicateExpr(this.expression)) {
|
|
4982
5048
|
return connections;
|
|
4983
5049
|
}
|
|
4984
|
-
object_hash.
|
|
5050
|
+
object_hash.C(
|
|
4985
5051
|
connections,
|
|
4986
5052
|
u(({ source, target, boundary }) => {
|
|
4987
|
-
object_hash.
|
|
5053
|
+
object_hash.C(
|
|
4988
5054
|
object_hash.d(
|
|
4989
5055
|
[...object_hash.toArray(source.ancestors()).reverse(), source],
|
|
4990
5056
|
[...object_hash.toArray(target.ancestors()).reverse(), target]
|
|
@@ -5107,7 +5173,7 @@ class ActiveGroupMemory extends Memory {
|
|
|
5107
5173
|
return new ActiveGroupMemory(state, memory.scope, stack);
|
|
5108
5174
|
}
|
|
5109
5175
|
get activeGroupId() {
|
|
5110
|
-
return
|
|
5176
|
+
return chunkWIMGWYZL.nonNullable(this.stack.peek(), "Stack must not be empty");
|
|
5111
5177
|
}
|
|
5112
5178
|
mutableState() {
|
|
5113
5179
|
const state = super.mutableState();
|
|
@@ -5144,7 +5210,7 @@ class ActiveGroupMemory extends Memory {
|
|
|
5144
5210
|
}
|
|
5145
5211
|
|
|
5146
5212
|
function findRedundantConnections(connections) {
|
|
5147
|
-
return object_hash.
|
|
5213
|
+
return object_hash.C(
|
|
5148
5214
|
[...connections],
|
|
5149
5215
|
mergeConnections,
|
|
5150
5216
|
l$5((reducedConnections, connection, _, all) => {
|
|
@@ -5224,7 +5290,7 @@ class StageFinal {
|
|
|
5224
5290
|
}
|
|
5225
5291
|
return false;
|
|
5226
5292
|
};
|
|
5227
|
-
object_hash.
|
|
5293
|
+
object_hash.C(
|
|
5228
5294
|
object_hash.difference(implicits, snapshot),
|
|
5229
5295
|
object_hash.toArray(),
|
|
5230
5296
|
object_hash.sortByFqnHierarchically,
|
|
@@ -5330,7 +5396,7 @@ function resolveElements(model, expr) {
|
|
|
5330
5396
|
return expr.isEqual === el.tags.includes(expr.elementTag);
|
|
5331
5397
|
})];
|
|
5332
5398
|
default:
|
|
5333
|
-
|
|
5399
|
+
chunkWIMGWYZL.nonexhaustive(expr);
|
|
5334
5400
|
}
|
|
5335
5401
|
}
|
|
5336
5402
|
function includeDescendantsFromMemory(elements, memory) {
|
|
@@ -5420,7 +5486,7 @@ function toComputedEdges(connections) {
|
|
|
5420
5486
|
const relations = [
|
|
5421
5487
|
...e.relations
|
|
5422
5488
|
];
|
|
5423
|
-
|
|
5489
|
+
chunkWIMGWYZL.invariant(object_hash.i(relations, 1), "Edge must have at least one relation");
|
|
5424
5490
|
const source = e.source.id;
|
|
5425
5491
|
const target = e.target.id;
|
|
5426
5492
|
const {
|
|
@@ -5460,7 +5526,7 @@ const DirectRelationExprPredicate = {
|
|
|
5460
5526
|
// This is a special case, we look for all relationships that satisfy the where clause
|
|
5461
5527
|
// * -> * ; Empty memory; Where clause
|
|
5462
5528
|
case (sourceIsWildcard && targetIsWildcard && memory.isEmpty() && where !== NoWhere): {
|
|
5463
|
-
const connections2 = object_hash.
|
|
5529
|
+
const connections2 = object_hash.C(
|
|
5464
5530
|
model.relationships(),
|
|
5465
5531
|
object_hash.ifilter(where),
|
|
5466
5532
|
object_hash.toArray(),
|
|
@@ -5488,10 +5554,10 @@ const DirectRelationExprPredicate = {
|
|
|
5488
5554
|
// element -> *; Where clause
|
|
5489
5555
|
case (!sourceIsWildcard && targetIsWildcard && where !== NoWhere): {
|
|
5490
5556
|
const sources = resolveElements(model, source);
|
|
5491
|
-
const connections2 = object_hash.
|
|
5557
|
+
const connections2 = object_hash.C(
|
|
5492
5558
|
sources,
|
|
5493
5559
|
u$1(
|
|
5494
|
-
(source2) => object_hash.
|
|
5560
|
+
(source2) => object_hash.C(
|
|
5495
5561
|
source2,
|
|
5496
5562
|
d$5(r(isBidirectional === true), {
|
|
5497
5563
|
onTrue: (s) => object_hash.union(s.allIncoming, s.allOutgoing),
|
|
@@ -5502,7 +5568,7 @@ const DirectRelationExprPredicate = {
|
|
|
5502
5568
|
object_hash.toArray(),
|
|
5503
5569
|
d$3((r) => r.source === source2),
|
|
5504
5570
|
([outgoing, incoming]) => a(
|
|
5505
|
-
object_hash.
|
|
5571
|
+
object_hash.C(
|
|
5506
5572
|
outgoing,
|
|
5507
5573
|
object_hash.m(
|
|
5508
5574
|
(outgoing2) => new ConnectionModel(
|
|
@@ -5512,7 +5578,7 @@ const DirectRelationExprPredicate = {
|
|
|
5512
5578
|
)
|
|
5513
5579
|
)
|
|
5514
5580
|
),
|
|
5515
|
-
object_hash.
|
|
5581
|
+
object_hash.C(
|
|
5516
5582
|
incoming,
|
|
5517
5583
|
object_hash.m(
|
|
5518
5584
|
(incoming2) => new ConnectionModel(
|
|
@@ -5544,10 +5610,10 @@ const DirectRelationExprPredicate = {
|
|
|
5544
5610
|
// * -> element; Where clause
|
|
5545
5611
|
case (sourceIsWildcard && !targetIsWildcard && where !== NoWhere): {
|
|
5546
5612
|
const targets = resolveElements(model, target);
|
|
5547
|
-
const connections2 = object_hash.
|
|
5613
|
+
const connections2 = object_hash.C(
|
|
5548
5614
|
targets,
|
|
5549
5615
|
u$1(
|
|
5550
|
-
(target2) => object_hash.
|
|
5616
|
+
(target2) => object_hash.C(
|
|
5551
5617
|
target2,
|
|
5552
5618
|
d$5(r(isBidirectional === true), {
|
|
5553
5619
|
onTrue: (s) => object_hash.union(s.allIncoming, s.allOutgoing),
|
|
@@ -5557,7 +5623,7 @@ const DirectRelationExprPredicate = {
|
|
|
5557
5623
|
object_hash.toArray(),
|
|
5558
5624
|
d$3((r) => r.target === target2),
|
|
5559
5625
|
([incoming, outgoing]) => a(
|
|
5560
|
-
object_hash.
|
|
5626
|
+
object_hash.C(
|
|
5561
5627
|
outgoing,
|
|
5562
5628
|
object_hash.m(
|
|
5563
5629
|
(outgoing2) => new ConnectionModel(
|
|
@@ -5567,7 +5633,7 @@ const DirectRelationExprPredicate = {
|
|
|
5567
5633
|
)
|
|
5568
5634
|
)
|
|
5569
5635
|
),
|
|
5570
|
-
object_hash.
|
|
5636
|
+
object_hash.C(
|
|
5571
5637
|
incoming,
|
|
5572
5638
|
object_hash.m(
|
|
5573
5639
|
(incoming2) => new ConnectionModel(
|
|
@@ -5596,8 +5662,8 @@ const DirectRelationExprPredicate = {
|
|
|
5596
5662
|
break;
|
|
5597
5663
|
}
|
|
5598
5664
|
default: {
|
|
5599
|
-
|
|
5600
|
-
|
|
5665
|
+
chunkWIMGWYZL.invariant(!view.isWildcard(source), "Inference failed - source must be not a wildcard");
|
|
5666
|
+
chunkWIMGWYZL.invariant(!view.isWildcard(target), "Inference failed - target must be not a wildcard");
|
|
5601
5667
|
const sources = resolveAndIncludeFromMemory(source, { memory, model });
|
|
5602
5668
|
const targets = resolveAndIncludeFromMemory(target, { memory, model });
|
|
5603
5669
|
const dir = isBidirectional ? "both" : "directed";
|
|
@@ -5620,7 +5686,7 @@ const DirectRelationExprPredicate = {
|
|
|
5620
5686
|
switch (true) {
|
|
5621
5687
|
// * -> *
|
|
5622
5688
|
case (sourceIsWildcard && targetIsWildcard): {
|
|
5623
|
-
relations = object_hash.
|
|
5689
|
+
relations = object_hash.C(
|
|
5624
5690
|
memory.connections,
|
|
5625
5691
|
u$1(i$4(
|
|
5626
5692
|
p$1("relations"),
|
|
@@ -5634,10 +5700,10 @@ const DirectRelationExprPredicate = {
|
|
|
5634
5700
|
// element -> *
|
|
5635
5701
|
case (!sourceIsWildcard && targetIsWildcard): {
|
|
5636
5702
|
const sources = resolveElements(model, source);
|
|
5637
|
-
relations = object_hash.
|
|
5703
|
+
relations = object_hash.C(
|
|
5638
5704
|
sources,
|
|
5639
5705
|
u$1(
|
|
5640
|
-
(source2) => object_hash.
|
|
5706
|
+
(source2) => object_hash.C(
|
|
5641
5707
|
source2,
|
|
5642
5708
|
d$5(r(isBidirectional === true), {
|
|
5643
5709
|
onTrue: (s) => object_hash.union(s.allIncoming, s.allOutgoing),
|
|
@@ -5654,10 +5720,10 @@ const DirectRelationExprPredicate = {
|
|
|
5654
5720
|
// * -> element
|
|
5655
5721
|
case (sourceIsWildcard && !targetIsWildcard): {
|
|
5656
5722
|
const targets = resolveElements(model, target);
|
|
5657
|
-
relations = object_hash.
|
|
5723
|
+
relations = object_hash.C(
|
|
5658
5724
|
targets,
|
|
5659
5725
|
u$1(
|
|
5660
|
-
(target2) => object_hash.
|
|
5726
|
+
(target2) => object_hash.C(
|
|
5661
5727
|
target2,
|
|
5662
5728
|
d$5(r(isBidirectional === true), {
|
|
5663
5729
|
onTrue: (s) => object_hash.union(s.allIncoming, s.allOutgoing),
|
|
@@ -5672,8 +5738,8 @@ const DirectRelationExprPredicate = {
|
|
|
5672
5738
|
break;
|
|
5673
5739
|
}
|
|
5674
5740
|
default: {
|
|
5675
|
-
|
|
5676
|
-
|
|
5741
|
+
chunkWIMGWYZL.invariant(!view.isWildcard(source), "Inferrence failed - source must be not a wildcard");
|
|
5742
|
+
chunkWIMGWYZL.invariant(!view.isWildcard(target), "Inferrence failed - target must be not a wildcard");
|
|
5677
5743
|
const sources = resolveElements(model, source);
|
|
5678
5744
|
const targets = resolveElements(model, target);
|
|
5679
5745
|
let accum = /* @__PURE__ */ new Set();
|
|
@@ -5709,7 +5775,7 @@ function resolveWildcard(nonWildcard, { memory, model }) {
|
|
|
5709
5775
|
includeDescendantsFromMemory(targets2, memory)
|
|
5710
5776
|
];
|
|
5711
5777
|
}
|
|
5712
|
-
const targets = object_hash.
|
|
5778
|
+
const targets = object_hash.C(
|
|
5713
5779
|
sources,
|
|
5714
5780
|
object_hash.m((el) => el.ascendingSiblings()),
|
|
5715
5781
|
object_hash.iflat(),
|
|
@@ -5812,7 +5878,7 @@ function incomingConnectionPredicate(model, expr) {
|
|
|
5812
5878
|
return exports.Connection.isIncoming(expr.element);
|
|
5813
5879
|
}
|
|
5814
5880
|
default:
|
|
5815
|
-
|
|
5881
|
+
chunkWIMGWYZL.nonexhaustive(expr);
|
|
5816
5882
|
}
|
|
5817
5883
|
}
|
|
5818
5884
|
|
|
@@ -5962,7 +6028,7 @@ function outgoingConnectionPredicate(model, expr) {
|
|
|
5962
6028
|
return exports.Connection.isOutgoing(expr.element);
|
|
5963
6029
|
}
|
|
5964
6030
|
default:
|
|
5965
|
-
|
|
6031
|
+
chunkWIMGWYZL.nonexhaustive(expr);
|
|
5966
6032
|
}
|
|
5967
6033
|
}
|
|
5968
6034
|
|
|
@@ -6057,7 +6123,7 @@ function processElementPredicate(expr, op, ctx) {
|
|
|
6057
6123
|
case view.isElementTagExpr(expr):
|
|
6058
6124
|
return ElementKindOrTagPredicate[op]({ ...ctx, expr }) ?? ctx.stage;
|
|
6059
6125
|
default:
|
|
6060
|
-
|
|
6126
|
+
chunkWIMGWYZL.nonexhaustive(expr);
|
|
6061
6127
|
}
|
|
6062
6128
|
}
|
|
6063
6129
|
function processRelationtPredicate(expr, op, ctx) {
|
|
@@ -6074,7 +6140,7 @@ function processRelationtPredicate(expr, op, ctx) {
|
|
|
6074
6140
|
return new Set(T([...relations], where));
|
|
6075
6141
|
};
|
|
6076
6142
|
const filterWhere = (connections) => {
|
|
6077
|
-
return object_hash.
|
|
6143
|
+
return object_hash.C(
|
|
6078
6144
|
connections,
|
|
6079
6145
|
object_hash.m((c) => new ConnectionModel(c.source, c.target, filterRelations(c.relations))),
|
|
6080
6146
|
T((c) => c.nonEmpty())
|
|
@@ -6099,7 +6165,7 @@ function processRelationtPredicate(expr, op, ctx) {
|
|
|
6099
6165
|
return IncomingExprPredicate[op]({ ...ctx, expr }) ?? ctx.stage;
|
|
6100
6166
|
}
|
|
6101
6167
|
default:
|
|
6102
|
-
|
|
6168
|
+
chunkWIMGWYZL.nonexhaustive(expr);
|
|
6103
6169
|
}
|
|
6104
6170
|
}
|
|
6105
6171
|
function processPredicates(model, memory, rules) {
|
|
@@ -6113,7 +6179,7 @@ function processPredicates(model, memory, rules) {
|
|
|
6113
6179
|
if (view.isViewRuleGroup(rule)) {
|
|
6114
6180
|
const groupMemory = ActiveGroupMemory.enter(memory, rule);
|
|
6115
6181
|
memory = processPredicates(model, groupMemory, rule.groupRules);
|
|
6116
|
-
|
|
6182
|
+
chunkWIMGWYZL.invariant(memory instanceof ActiveGroupMemory, "processPredicates must return ActiveGroupMemory");
|
|
6117
6183
|
memory = memory.leave();
|
|
6118
6184
|
continue;
|
|
6119
6185
|
}
|
|
@@ -6138,7 +6204,7 @@ function processPredicates(model, memory, rules) {
|
|
|
6138
6204
|
}) ?? stage;
|
|
6139
6205
|
break;
|
|
6140
6206
|
default:
|
|
6141
|
-
|
|
6207
|
+
chunkWIMGWYZL.nonexhaustive(expr);
|
|
6142
6208
|
}
|
|
6143
6209
|
memory = stage.commit();
|
|
6144
6210
|
}
|
|
@@ -6232,17 +6298,17 @@ function assignElementsToGroups(memory) {
|
|
|
6232
6298
|
}
|
|
6233
6299
|
return false;
|
|
6234
6300
|
};
|
|
6235
|
-
object_hash.
|
|
6301
|
+
object_hash.C(
|
|
6236
6302
|
object_hash.sortParentsFirst([...memory.explicitFirstSeenIn.keys()]),
|
|
6237
6303
|
u((el) => {
|
|
6238
6304
|
if (!isAncestorAssigned(el)) {
|
|
6239
|
-
const groupId =
|
|
6305
|
+
const groupId = chunkWIMGWYZL.nonNullable(memory.explicitFirstSeenIn.get(el));
|
|
6240
6306
|
assignedTo.set(el, groupId);
|
|
6241
6307
|
groupAssignments.get(groupId).add(el);
|
|
6242
6308
|
}
|
|
6243
6309
|
})
|
|
6244
6310
|
);
|
|
6245
|
-
object_hash.
|
|
6311
|
+
object_hash.C(
|
|
6246
6312
|
object_hash.sortParentsFirst([...memory.lastSeenIn.keys()]),
|
|
6247
6313
|
T((el) => !assignedTo.has(el)),
|
|
6248
6314
|
u((el) => {
|
|
@@ -6252,7 +6318,7 @@ function assignElementsToGroups(memory) {
|
|
|
6252
6318
|
if (isDescendantAssigned(el)) {
|
|
6253
6319
|
return;
|
|
6254
6320
|
}
|
|
6255
|
-
const groupId =
|
|
6321
|
+
const groupId = chunkWIMGWYZL.nonNullable(memory.lastSeenIn.get(el));
|
|
6256
6322
|
assignedTo.set(el, groupId);
|
|
6257
6323
|
groupAssignments.get(groupId).add(el);
|
|
6258
6324
|
})
|
|
@@ -6280,7 +6346,7 @@ function unsafeComputeView(viewsource, likec4model) {
|
|
|
6280
6346
|
case view.isElementView(viewsource):
|
|
6281
6347
|
return computeElementView(likec4model, viewsource);
|
|
6282
6348
|
default:
|
|
6283
|
-
|
|
6349
|
+
chunkWIMGWYZL.nonexhaustive(viewsource);
|
|
6284
6350
|
}
|
|
6285
6351
|
}
|
|
6286
6352
|
function computeView(viewsource, likec4model) {
|
|
@@ -6367,14 +6433,14 @@ class LikeC4DeploymentModel {
|
|
|
6367
6433
|
return el;
|
|
6368
6434
|
}
|
|
6369
6435
|
const id = getId(el);
|
|
6370
|
-
return
|
|
6436
|
+
return chunkWIMGWYZL.nonNullable(this.#elements.get(id), `Element ${id} not found`);
|
|
6371
6437
|
}
|
|
6372
6438
|
findElement(el) {
|
|
6373
6439
|
return this.#elements.get(el) ?? null;
|
|
6374
6440
|
}
|
|
6375
6441
|
node(el) {
|
|
6376
6442
|
const element = this.element(el);
|
|
6377
|
-
|
|
6443
|
+
chunkWIMGWYZL.invariant(element.isDeploymentNode(), `Element ${element.id} is not a deployment node`);
|
|
6378
6444
|
return element;
|
|
6379
6445
|
}
|
|
6380
6446
|
findNode(el) {
|
|
@@ -6382,12 +6448,12 @@ class LikeC4DeploymentModel {
|
|
|
6382
6448
|
if (!element) {
|
|
6383
6449
|
return null;
|
|
6384
6450
|
}
|
|
6385
|
-
|
|
6451
|
+
chunkWIMGWYZL.invariant(element.isDeploymentNode(), `Element ${element?.id} is not a deployment node`);
|
|
6386
6452
|
return element;
|
|
6387
6453
|
}
|
|
6388
6454
|
instance(el) {
|
|
6389
6455
|
const element = this.element(el);
|
|
6390
|
-
|
|
6456
|
+
chunkWIMGWYZL.invariant(element.isInstance(), `Element ${element.id} is not a deployed instance`);
|
|
6391
6457
|
return element;
|
|
6392
6458
|
}
|
|
6393
6459
|
findInstance(el) {
|
|
@@ -6395,7 +6461,7 @@ class LikeC4DeploymentModel {
|
|
|
6395
6461
|
if (!element) {
|
|
6396
6462
|
return null;
|
|
6397
6463
|
}
|
|
6398
|
-
|
|
6464
|
+
chunkWIMGWYZL.invariant(element.isInstance(), `Element ${element?.id} is not a deployed instance`);
|
|
6399
6465
|
return element;
|
|
6400
6466
|
}
|
|
6401
6467
|
/**
|
|
@@ -6459,7 +6525,7 @@ class LikeC4DeploymentModel {
|
|
|
6459
6525
|
* Returns a specific relationship by its ID.
|
|
6460
6526
|
*/
|
|
6461
6527
|
relationship(id) {
|
|
6462
|
-
return
|
|
6528
|
+
return chunkWIMGWYZL.nonNullable(this.#relations.get(id), `DeploymentRelationModel ${id} not found`);
|
|
6463
6529
|
}
|
|
6464
6530
|
findRelationship(id) {
|
|
6465
6531
|
return this.#relations.get(id) ?? null;
|
|
@@ -6574,11 +6640,11 @@ class LikeC4DeploymentModel {
|
|
|
6574
6640
|
this.#elements.set(el.id, el);
|
|
6575
6641
|
const parentId = object_hash.parentFqn(el.id);
|
|
6576
6642
|
if (parentId) {
|
|
6577
|
-
|
|
6643
|
+
chunkWIMGWYZL.invariant(this.#elements.has(parentId), `Parent ${parentId} of ${el.id} not found`);
|
|
6578
6644
|
this.#parents.set(el.id, this.node(parentId));
|
|
6579
6645
|
this.#children.get(parentId).add(el);
|
|
6580
6646
|
} else {
|
|
6581
|
-
|
|
6647
|
+
chunkWIMGWYZL.invariant(el.isDeploymentNode(), `Root element ${el.id} is not a deployment node`);
|
|
6582
6648
|
this.#rootElements.add(el);
|
|
6583
6649
|
}
|
|
6584
6650
|
return el;
|
|
@@ -6987,7 +7053,7 @@ class LikeC4ViewModel {
|
|
|
6987
7053
|
*/
|
|
6988
7054
|
node(node) {
|
|
6989
7055
|
const nodeId = getId(node);
|
|
6990
|
-
return
|
|
7056
|
+
return chunkWIMGWYZL.nonNullable(this.#nodes.get(nodeId), `Node ${nodeId} not found in view ${this.$view.id}`);
|
|
6991
7057
|
}
|
|
6992
7058
|
/**
|
|
6993
7059
|
* Find node by id.
|
|
@@ -7012,7 +7078,7 @@ class LikeC4ViewModel {
|
|
|
7012
7078
|
*/
|
|
7013
7079
|
edge(edge) {
|
|
7014
7080
|
const edgeId = getId(edge);
|
|
7015
|
-
return
|
|
7081
|
+
return chunkWIMGWYZL.nonNullable(this.#edges.get(edgeId), `Edge ${edgeId} not found in view ${this.$view.id}`);
|
|
7016
7082
|
}
|
|
7017
7083
|
findEdge(edge) {
|
|
7018
7084
|
return this.#edges.get(getId(edge)) ?? null;
|
|
@@ -7090,7 +7156,7 @@ class LikeC4Model {
|
|
|
7090
7156
|
}
|
|
7091
7157
|
}
|
|
7092
7158
|
this.deployment = new LikeC4DeploymentModel(this, $model.deployments);
|
|
7093
|
-
const views = object_hash.
|
|
7159
|
+
const views = object_hash.C(
|
|
7094
7160
|
r$3($model.views),
|
|
7095
7161
|
m$1((a, b) => object_hash.compareNatural(a.title ?? "untitled", b.title ?? "untitled"))
|
|
7096
7162
|
);
|
|
@@ -7182,7 +7248,7 @@ class LikeC4Model {
|
|
|
7182
7248
|
return el;
|
|
7183
7249
|
}
|
|
7184
7250
|
const id = getId(el);
|
|
7185
|
-
return
|
|
7251
|
+
return chunkWIMGWYZL.nonNullable(this.findElement(id), `Element ${getId(el)} not found`);
|
|
7186
7252
|
}
|
|
7187
7253
|
findElement(el) {
|
|
7188
7254
|
return this.#elements.get(el) ?? null;
|
|
@@ -7211,9 +7277,9 @@ class LikeC4Model {
|
|
|
7211
7277
|
}
|
|
7212
7278
|
let model = this.#relations.get(id) ?? null;
|
|
7213
7279
|
if (model || type === "model") {
|
|
7214
|
-
return
|
|
7280
|
+
return chunkWIMGWYZL.nonNullable(model, `Model relation ${id} not found`);
|
|
7215
7281
|
}
|
|
7216
|
-
return
|
|
7282
|
+
return chunkWIMGWYZL.nonNullable(this.deployment.findRelationship(id), `No model/deployment relation ${id} not found`);
|
|
7217
7283
|
}
|
|
7218
7284
|
findRelationship(id, type) {
|
|
7219
7285
|
if (type === "deployment") {
|
|
@@ -7235,7 +7301,7 @@ class LikeC4Model {
|
|
|
7235
7301
|
* Returns a specific view by its ID.
|
|
7236
7302
|
*/
|
|
7237
7303
|
view(viewId) {
|
|
7238
|
-
return
|
|
7304
|
+
return chunkWIMGWYZL.nonNullable(this.#views.get(viewId), `View ${viewId} not found`);
|
|
7239
7305
|
}
|
|
7240
7306
|
findView(viewId) {
|
|
7241
7307
|
return this.#views.get(viewId) ?? null;
|
|
@@ -7348,7 +7414,7 @@ class LikeC4Model {
|
|
|
7348
7414
|
this.#elements.set(el.id, el);
|
|
7349
7415
|
const parentId = object_hash.parentFqn(el.id);
|
|
7350
7416
|
if (parentId) {
|
|
7351
|
-
|
|
7417
|
+
chunkWIMGWYZL.invariant(this.#elements.has(parentId), `Parent ${parentId} of ${el.id} not found`);
|
|
7352
7418
|
this.#parents.set(el.id, this.element(parentId));
|
|
7353
7419
|
this.#children.get(parentId).add(el);
|
|
7354
7420
|
} else {
|