@likec4/core 1.20.2 → 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.PYycpzvA.mjs → core.Cz9Oy_FA.mjs} +476 -410
- package/dist/shared/{core.BIZD3l1g.d.cts → core.D0KD4FiT.d.mts} +1 -1
- package/dist/shared/{core.DxJ1KbOs.cjs → core.D91uYrqI.cjs} +552 -486
- 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.mts → core.QP35c488.d.mts} +33 -1
- package/dist/shared/{core.BJfn72tj.d.cts → 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/element-view/memory/memory.ts +1 -1
- 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,16 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { u as u$6, a as nonNullable, i as invariant, n as nonexhaustive } from './core.
|
|
1
|
+
import { d as DefaultElementShape, e as DefaultThemeColor, h as DefaultShapeSize, aa as o$8, t as isElementWhere, P as whereOperatorAsPredicate, G as isWildcard, q as isElementKindExpr, s as isElementTagExpr, n as n$4, u as isExpandedElementExpr, r as isElementRef, l as isCustomElement, a8 as isViewRuleStyle, ab as y$2, U as ComputedNode, E as ElementKind, Q as DefaultArrowType, I as FqnExpr, R as RelationExpr, o as o$9, a7 as isViewRulePredicate, a3 as isViewRuleAutoLayout, a6 as isViewRuleGroup, a4 as isViewRuleGlobalPredicateRef, a5 as isViewRuleGlobalStyle, a9 as stepEdgeId, a1 as isDynamicViewParallelSteps, S as DefaultLineStyle, T as DefaultRelationshipColor, x as isOutgoing$1, v as isIncoming$1, w as isInOut, y as isRelation, F as isRelationWhere, m as isCustomRelationExpr, C as isRelationPredicateExpr, b as isElementPredicateExpr, a as isElementView, a0 as isDynamicView, $ as isDeploymentView, D as DeploymentElement, X as extractStep, a2 as isStepEdgeId, c as isScopedElementView } from './core.CYNYaH2U.mjs';
|
|
2
|
+
import { R as C, T as s$1, U as a$5, s as hierarchyLevel, u as isAncestor, j as commonAncestor, x as sortNaturalByFqn, m as m$3, f as commonHead, V as getDefaultExportFromCjs, W as requireForeach, X as requireIterator, Y as u$7, Q as objectHash, M as intersection, K as difference, O as union, P as stringHash, L as equals, v as isDescendantOf, B as isString, c as isSameHierarchy, H as isome, C as ifilter, G as isIterable, t as toSet, y as sortParentsFirst, J as toArray, D as DefaultMap, F as imap, a as i$9, Z as d$6, p as parentFqn, _ as n$5, k as compareByFqnHierarchically, A as isNonEmptyArray, g as compareNatural, n as nameFromFqn, b as t$6, l as l$7, $ as hasIntersection, w as sortByFqnHierarchically, h as ancestorsFqn, S as Stack, I as iunique, E as iflat, z as getOrCreate, i as ifind } from './core.CeefT_JU.mjs';
|
|
3
|
+
import { u as u$6, a as nonNullable, i as invariant, n as nonexhaustive } from './core.BfZZXtur.mjs';
|
|
4
4
|
|
|
5
|
-
function
|
|
5
|
+
function y$1(t,i){let a=i.length-t.length;if(a===1){let[n,...r]=i;return C(n,{lazy:t,lazyArgs:r})}if(a===0){let n={lazy:t,lazyArgs:i};return Object.assign(e=>C(e,n),n)}throw new Error("Wrong number of arguments")}
|
|
6
6
|
|
|
7
7
|
function r$3(...t){return u$6(Object.values,t)}
|
|
8
8
|
|
|
9
9
|
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);
|
|
10
10
|
|
|
11
|
-
function i$8(...e){return
|
|
11
|
+
function i$8(...e){return y$1(a$4,e)}function a$4(){let e=new Set;return t=>e.has(t)?s$1:(e.add(t),{done:false,hasNext:true,next:t})}
|
|
12
12
|
|
|
13
|
-
function l$6(...
|
|
13
|
+
function l$6(...r){return u$6(o$7,r,u$5)}var o$7=(r,e)=>e<0?[]:r.slice(0,e);function u$5(r){if(r<=0)return a$5;let e=r;return a=>(e-=1,{done:e<=0,hasNext:true,next:a})}
|
|
14
14
|
|
|
15
15
|
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;
|
|
16
16
|
|
|
@@ -30,7 +30,7 @@ function i$6(...e){return u$6(o$5,e)}function o$5(e,n){let t={};for(let r of n)r
|
|
|
30
30
|
|
|
31
31
|
function d$2(...e){return u$6(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}
|
|
32
32
|
|
|
33
|
-
function i$4(...n){return o=>
|
|
33
|
+
function i$4(...n){return o=>C(o,...n)}
|
|
34
34
|
|
|
35
35
|
function d$1(...e){return u$6(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}
|
|
36
36
|
|
|
@@ -56,11 +56,11 @@ function k(...n){return u$6(u$2,n)}function u$2(n,e){if(n===e||Object.is(n,e))re
|
|
|
56
56
|
|
|
57
57
|
function u$1(...a){return u$6(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}};
|
|
58
58
|
|
|
59
|
-
function u(...e){return u$6(o$1,e,i$1)}function o$1(e,
|
|
59
|
+
function u(...e){return u$6(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});
|
|
60
60
|
|
|
61
61
|
function t$1(...r){return u$6(Object.entries,r)}
|
|
62
62
|
|
|
63
|
-
function T(...a){return u$6(l,a,y)}var l=(a,
|
|
63
|
+
function T(...a){return u$6(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}:s$1;
|
|
64
64
|
|
|
65
65
|
function o(...e){return u$6(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}};
|
|
66
66
|
|
|
@@ -115,6 +115,12 @@ class ElementModel {
|
|
|
115
115
|
get isRoot() {
|
|
116
116
|
return this.parent === null;
|
|
117
117
|
}
|
|
118
|
+
get style() {
|
|
119
|
+
return {
|
|
120
|
+
size: DefaultShapeSize,
|
|
121
|
+
...this.$element.style
|
|
122
|
+
};
|
|
123
|
+
}
|
|
118
124
|
isAncestorOf(another) {
|
|
119
125
|
return isAncestor(this, another);
|
|
120
126
|
}
|
|
@@ -252,7 +258,7 @@ function isElementModel(element) {
|
|
|
252
258
|
}
|
|
253
259
|
|
|
254
260
|
function buildElementNotations(nodes) {
|
|
255
|
-
return
|
|
261
|
+
return C(
|
|
256
262
|
nodes,
|
|
257
263
|
i$2(p$1("notation")),
|
|
258
264
|
i$3(
|
|
@@ -1353,7 +1359,7 @@ function topologicalSort(param) {
|
|
|
1353
1359
|
allowSelfLoops: true,
|
|
1354
1360
|
type: "directed"
|
|
1355
1361
|
});
|
|
1356
|
-
const enrichedEdges =
|
|
1362
|
+
const enrichedEdges = C(
|
|
1357
1363
|
edges,
|
|
1358
1364
|
m$3((edge, __dirname) => {
|
|
1359
1365
|
const source = getNode(edge.source), target = getNode(edge.target), parent = edge.parent ? getNode(edge.parent) : null;
|
|
@@ -1387,7 +1393,7 @@ function topologicalSort(param) {
|
|
|
1387
1393
|
for (const { edge, source, target } of edgesBetweenLeafs) {
|
|
1388
1394
|
addEdgeToGraph(edge);
|
|
1389
1395
|
if (target.parent && target.parent !== edge.parent) {
|
|
1390
|
-
|
|
1396
|
+
C(
|
|
1391
1397
|
ancestorsOfNode(target, param.nodes),
|
|
1392
1398
|
u$7((ancestor) => ancestor.inEdges.includes(edge.id)),
|
|
1393
1399
|
u((ancestor) => {
|
|
@@ -1453,12 +1459,12 @@ function calcViewLayoutHash(view) {
|
|
|
1453
1459
|
id: view.id,
|
|
1454
1460
|
__: view.__ ?? "element",
|
|
1455
1461
|
autoLayout: view.autoLayout,
|
|
1456
|
-
nodes:
|
|
1462
|
+
nodes: C(
|
|
1457
1463
|
view.nodes,
|
|
1458
1464
|
m$3(i$6(["id", "title", "description", "technology", "shape", "icon", "children"])),
|
|
1459
1465
|
l$3(({ id, icon, ...node }) => [id, { ...node, icon: n$2(icon) ? "Y" : "N" }])
|
|
1460
1466
|
),
|
|
1461
|
-
edges:
|
|
1467
|
+
edges: C(
|
|
1462
1468
|
view.edges,
|
|
1463
1469
|
m$3(i$6(["source", "target", "label", "description", "technology", "dir", "head", "tail", "line"])),
|
|
1464
1470
|
l$3(({ source, target, ...edge }) => [`${source}:${target}`, edge])
|
|
@@ -1535,6 +1541,7 @@ class AbstractDeploymentElementModel {
|
|
|
1535
1541
|
return {
|
|
1536
1542
|
shape: DefaultElementShape,
|
|
1537
1543
|
color: DefaultThemeColor,
|
|
1544
|
+
size: DefaultShapeSize,
|
|
1538
1545
|
...this.$node.style
|
|
1539
1546
|
};
|
|
1540
1547
|
}
|
|
@@ -1795,6 +1802,7 @@ class DeployedInstanceModel extends AbstractDeploymentElementModel {
|
|
|
1795
1802
|
return {
|
|
1796
1803
|
shape: this.element.shape,
|
|
1797
1804
|
color: this.element.color,
|
|
1805
|
+
size: DefaultShapeSize,
|
|
1798
1806
|
...icon && { icon },
|
|
1799
1807
|
...style,
|
|
1800
1808
|
...this.$instance.style
|
|
@@ -2173,7 +2181,7 @@ function sortConnectionsByBoundaryHierarchy(connections, sort) {
|
|
|
2173
2181
|
return _sortByBoundary(connections, sort ?? "asc");
|
|
2174
2182
|
}
|
|
2175
2183
|
function _sortByBoundary(connections, order) {
|
|
2176
|
-
return
|
|
2184
|
+
return C(
|
|
2177
2185
|
connections,
|
|
2178
2186
|
m$3((conn) => ({
|
|
2179
2187
|
id: boundaryHierarchy(conn),
|
|
@@ -2367,7 +2375,7 @@ class ConnectionModel {
|
|
|
2367
2375
|
* Returns true if includes relations between nested elements of the source and target elements.
|
|
2368
2376
|
*/
|
|
2369
2377
|
get isImplicit() {
|
|
2370
|
-
return this.nonEmpty() && isome(this.relations, o$
|
|
2378
|
+
return this.nonEmpty() && isome(this.relations, o$8(hasSameSourceTarget(this)));
|
|
2371
2379
|
}
|
|
2372
2380
|
get directRelations() {
|
|
2373
2381
|
return new Set(ifilter(this.relations, hasSameSourceTarget(this)));
|
|
@@ -2587,7 +2595,7 @@ class AbstractStageExclude {
|
|
|
2587
2595
|
disconnected,
|
|
2588
2596
|
state.elements
|
|
2589
2597
|
);
|
|
2590
|
-
disconnected =
|
|
2598
|
+
disconnected = C(
|
|
2591
2599
|
disconnected,
|
|
2592
2600
|
ifilter((el) => {
|
|
2593
2601
|
return state.explicits.has(el) && !isome(state.final, isDescendantOf(el));
|
|
@@ -2675,7 +2683,6 @@ class AbstractStageExclude {
|
|
|
2675
2683
|
if (this.excluded.elements.size > 0) {
|
|
2676
2684
|
state = this.removeElements(state);
|
|
2677
2685
|
}
|
|
2678
|
-
state = this.moveDisconnectedExplicitsToImplicits(state);
|
|
2679
2686
|
return this.memory.update(this.postcommit(state));
|
|
2680
2687
|
}
|
|
2681
2688
|
}
|
|
@@ -2881,7 +2888,7 @@ function findCrossBoundarySameSourceOrTarget(connections) {
|
|
|
2881
2888
|
if (!i$9(sameRelationGroup, 2)) {
|
|
2882
2889
|
continue;
|
|
2883
2890
|
}
|
|
2884
|
-
|
|
2891
|
+
C(
|
|
2885
2892
|
sameRelationGroup,
|
|
2886
2893
|
u$1((conn) => [
|
|
2887
2894
|
{ group: `$source-${conn.source.id}`, conn },
|
|
@@ -2944,7 +2951,7 @@ function findCrossBoundaryConnections(connections) {
|
|
|
2944
2951
|
}
|
|
2945
2952
|
}
|
|
2946
2953
|
}
|
|
2947
|
-
return
|
|
2954
|
+
return C(
|
|
2948
2955
|
excludedRelations.entries(),
|
|
2949
2956
|
imap(
|
|
2950
2957
|
([c, excluded]) => c.update({
|
|
@@ -2962,7 +2969,7 @@ function cleanCrossBoundary(connections) {
|
|
|
2962
2969
|
);
|
|
2963
2970
|
}
|
|
2964
2971
|
function findRedundantConnections$1(connections) {
|
|
2965
|
-
return
|
|
2972
|
+
return C(
|
|
2966
2973
|
connections,
|
|
2967
2974
|
mergeConnections,
|
|
2968
2975
|
l$5((redundants, connection) => {
|
|
@@ -3044,17 +3051,17 @@ let StageInclude$1 = class StageInclude extends AbstractStageInclude {
|
|
|
3044
3051
|
return hasChanged();
|
|
3045
3052
|
}
|
|
3046
3053
|
processConnections(connections) {
|
|
3047
|
-
const clean =
|
|
3054
|
+
const clean = C(
|
|
3048
3055
|
connections,
|
|
3049
3056
|
cleanCrossBoundary,
|
|
3050
3057
|
cleanRedundantRelationships
|
|
3051
3058
|
);
|
|
3052
|
-
|
|
3059
|
+
C(
|
|
3053
3060
|
clean,
|
|
3054
3061
|
// Process only connection from this stage
|
|
3055
3062
|
// filter(c => this._connections.some(c2 => c2.id === c.id)),
|
|
3056
3063
|
u(({ source, target, boundary }) => {
|
|
3057
|
-
|
|
3064
|
+
C(
|
|
3058
3065
|
d$6(
|
|
3059
3066
|
[...toArray(source.ancestors()).reverse(), source],
|
|
3060
3067
|
[...toArray(target.ancestors()).reverse(), target]
|
|
@@ -3173,10 +3180,10 @@ function elementExprToPredicate(target) {
|
|
|
3173
3180
|
}
|
|
3174
3181
|
|
|
3175
3182
|
function applyViewRuleStyle(rule, predicates, nodes) {
|
|
3176
|
-
|
|
3183
|
+
C(
|
|
3177
3184
|
nodes,
|
|
3178
|
-
T(o$
|
|
3179
|
-
T(y$
|
|
3185
|
+
T(o$8(ComputedNode.isNodesGroup)),
|
|
3186
|
+
T(y$2(predicates)),
|
|
3180
3187
|
u((n) => {
|
|
3181
3188
|
n.shape = rule.style.shape ?? n.shape;
|
|
3182
3189
|
n.color = rule.style.color ?? n.color;
|
|
@@ -3196,6 +3203,15 @@ function applyViewRuleStyle(rule, predicates, nodes) {
|
|
|
3196
3203
|
if (n$5(rule.style.multiple)) {
|
|
3197
3204
|
styleOverride = { ...styleOverride, multiple: rule.style.multiple };
|
|
3198
3205
|
}
|
|
3206
|
+
if (n$5(rule.style.padding)) {
|
|
3207
|
+
styleOverride = { ...styleOverride, padding: rule.style.padding };
|
|
3208
|
+
}
|
|
3209
|
+
if (n$5(rule.style.size)) {
|
|
3210
|
+
styleOverride = { ...styleOverride, size: rule.style.size };
|
|
3211
|
+
}
|
|
3212
|
+
if (n$5(rule.style.textSize)) {
|
|
3213
|
+
styleOverride = { ...styleOverride, textSize: rule.style.textSize };
|
|
3214
|
+
}
|
|
3199
3215
|
if (styleOverride) {
|
|
3200
3216
|
n.style = {
|
|
3201
3217
|
...n.style,
|
|
@@ -3261,7 +3277,11 @@ function buildComputedNodes(elements, groups) {
|
|
|
3261
3277
|
links: null,
|
|
3262
3278
|
style: {
|
|
3263
3279
|
border: viewRule.border ?? "dashed",
|
|
3264
|
-
opacity: viewRule.opacity ?? 0
|
|
3280
|
+
opacity: viewRule.opacity ?? 0,
|
|
3281
|
+
size: viewRule.size ?? "md",
|
|
3282
|
+
multiple: viewRule.multiple ?? false,
|
|
3283
|
+
padding: viewRule.padding ?? "md",
|
|
3284
|
+
textSize: viewRule.textSize ?? "md"
|
|
3265
3285
|
}
|
|
3266
3286
|
});
|
|
3267
3287
|
for (const e of elements2) {
|
|
@@ -3351,7 +3371,7 @@ function pickRelationshipProps(relation) {
|
|
|
3351
3371
|
};
|
|
3352
3372
|
}
|
|
3353
3373
|
function mergePropsFromRelationships(relations, prefer) {
|
|
3354
|
-
const allprops =
|
|
3374
|
+
const allprops = C(
|
|
3355
3375
|
relations,
|
|
3356
3376
|
l$5(
|
|
3357
3377
|
(acc, r) => {
|
|
@@ -3435,7 +3455,7 @@ function mergePropsFromRelationships(relations, prefer) {
|
|
|
3435
3455
|
}
|
|
3436
3456
|
|
|
3437
3457
|
function uniqueTags(elements) {
|
|
3438
|
-
const tags =
|
|
3458
|
+
const tags = C(
|
|
3439
3459
|
elements,
|
|
3440
3460
|
u$1((e) => e.tags ?? []),
|
|
3441
3461
|
i$8(),
|
|
@@ -3657,108 +3677,6 @@ function applyDeploymentViewRuleStyles(rules, nodes) {
|
|
|
3657
3677
|
return nodes;
|
|
3658
3678
|
}
|
|
3659
3679
|
|
|
3660
|
-
const DeploymentRefPredicate = {
|
|
3661
|
-
include: (ctx) => {
|
|
3662
|
-
const { expr } = ctx;
|
|
3663
|
-
const el = ctx.model.element(expr.ref.deployment);
|
|
3664
|
-
if (isDeployedInstance(el)) {
|
|
3665
|
-
ctx.stage.addExplicit(el);
|
|
3666
|
-
ctx.stage.connectWithExisting(el);
|
|
3667
|
-
return ctx.stage;
|
|
3668
|
-
}
|
|
3669
|
-
switch (true) {
|
|
3670
|
-
case expr.selector === "expanded":
|
|
3671
|
-
includeDeployedNodeWithExpanded(el, ctx);
|
|
3672
|
-
break;
|
|
3673
|
-
case expr.selector === "children":
|
|
3674
|
-
includeDeployedNodeChildren(el, ctx);
|
|
3675
|
-
break;
|
|
3676
|
-
case expr.selector === "descendants":
|
|
3677
|
-
includeDeployedNodeDescendants(el, ctx);
|
|
3678
|
-
break;
|
|
3679
|
-
default: {
|
|
3680
|
-
ctx.stage.addExplicit(el);
|
|
3681
|
-
ctx.stage.connectWithExisting(el);
|
|
3682
|
-
}
|
|
3683
|
-
}
|
|
3684
|
-
return ctx.stage;
|
|
3685
|
-
},
|
|
3686
|
-
exclude: ({ expr, stage, memory }) => {
|
|
3687
|
-
const exprPredicate = deploymentExpressionToPredicate(expr);
|
|
3688
|
-
stage.exclude([...memory.elements].filter(exprPredicate));
|
|
3689
|
-
return stage;
|
|
3690
|
-
}
|
|
3691
|
-
};
|
|
3692
|
-
function includeDeployedNodeChildren(node, { stage }) {
|
|
3693
|
-
const children = [...node.children()];
|
|
3694
|
-
if (children.length === 0) {
|
|
3695
|
-
return;
|
|
3696
|
-
}
|
|
3697
|
-
stage.addImplicit(node);
|
|
3698
|
-
stage.addConnections(findConnectionsWithin(children));
|
|
3699
|
-
stage.connectWithExisting(children);
|
|
3700
|
-
stage.addExplicit(children);
|
|
3701
|
-
}
|
|
3702
|
-
function includeDeployedNodeWithExpanded(node, { memory, stage }) {
|
|
3703
|
-
const children = [...node.children()];
|
|
3704
|
-
stage.addImplicit(node);
|
|
3705
|
-
stage.connectWithExisting(node);
|
|
3706
|
-
let hasConnectionsWithVisible = false;
|
|
3707
|
-
for (const child of children) {
|
|
3708
|
-
if (findConnectionsBetween(child, memory.elements).length > 0) {
|
|
3709
|
-
hasConnectionsWithVisible = true;
|
|
3710
|
-
break;
|
|
3711
|
-
}
|
|
3712
|
-
}
|
|
3713
|
-
if (hasConnectionsWithVisible) {
|
|
3714
|
-
stage.connectWithExisting(children, "in");
|
|
3715
|
-
stage.addConnections(findConnectionsWithin(children));
|
|
3716
|
-
stage.connectWithExisting(children, "out");
|
|
3717
|
-
}
|
|
3718
|
-
stage.addImplicit(children);
|
|
3719
|
-
if (stage.connections.length > 0) {
|
|
3720
|
-
stage.addExplicit(node);
|
|
3721
|
-
}
|
|
3722
|
-
}
|
|
3723
|
-
function includeDeployedNodeDescendants(node, { stage }) {
|
|
3724
|
-
const dfs = (node2) => {
|
|
3725
|
-
const children = [];
|
|
3726
|
-
for (const child of node2.children()) {
|
|
3727
|
-
if (child.isDeploymentNode()) {
|
|
3728
|
-
children.push(...dfs(child));
|
|
3729
|
-
}
|
|
3730
|
-
children.push(child);
|
|
3731
|
-
}
|
|
3732
|
-
stage.connectWithExisting(children, "in");
|
|
3733
|
-
stage.addConnections(findConnectionsWithin(children));
|
|
3734
|
-
stage.addImplicit(children);
|
|
3735
|
-
return children;
|
|
3736
|
-
};
|
|
3737
|
-
const descendants = dfs(node);
|
|
3738
|
-
if (descendants.length === 0) {
|
|
3739
|
-
return;
|
|
3740
|
-
}
|
|
3741
|
-
stage.connectWithExisting(descendants, "out");
|
|
3742
|
-
const allconnected = findConnectedElements(stage);
|
|
3743
|
-
descendants.forEach((desc) => {
|
|
3744
|
-
if (allconnected.has(desc)) {
|
|
3745
|
-
stage.addExplicit(desc);
|
|
3746
|
-
}
|
|
3747
|
-
});
|
|
3748
|
-
}
|
|
3749
|
-
function findConnectedElements(stage) {
|
|
3750
|
-
return x(
|
|
3751
|
-
stage.mergedConnections(),
|
|
3752
|
-
cleanCrossBoundary,
|
|
3753
|
-
cleanRedundantRelationships,
|
|
3754
|
-
l$5((acc, c) => {
|
|
3755
|
-
acc.add(c.source);
|
|
3756
|
-
acc.add(c.target);
|
|
3757
|
-
return acc;
|
|
3758
|
-
}, /* @__PURE__ */ new Set())
|
|
3759
|
-
);
|
|
3760
|
-
}
|
|
3761
|
-
|
|
3762
3680
|
function isDeploymentNode(model) {
|
|
3763
3681
|
return model.isDeploymentNode();
|
|
3764
3682
|
}
|
|
@@ -3772,6 +3690,61 @@ function isDeploymentElementModel(x) {
|
|
|
3772
3690
|
return x instanceof DeploymentNodeModel || x instanceof DeployedInstanceModel;
|
|
3773
3691
|
}
|
|
3774
3692
|
|
|
3693
|
+
const IncomingRelationPredicate = {
|
|
3694
|
+
include: ({ expr, model, memory, stage, where }) => {
|
|
3695
|
+
const sources = [...memory.elements];
|
|
3696
|
+
if (FqnExpr.isWildcard(expr.incoming)) {
|
|
3697
|
+
for (const source of sources) {
|
|
3698
|
+
if (source.allOutgoing.isEmpty) {
|
|
3699
|
+
continue;
|
|
3700
|
+
}
|
|
3701
|
+
const targets2 = [...resolveAscendingSiblings(source)];
|
|
3702
|
+
const toInclude = applyPredicate(findConnectionsBetween(source, targets2, "directed"), where);
|
|
3703
|
+
stage.addConnections(toInclude);
|
|
3704
|
+
}
|
|
3705
|
+
return stage;
|
|
3706
|
+
}
|
|
3707
|
+
invariant(FqnExpr.isDeploymentRef(expr.incoming), "Only deployment refs are supported in include");
|
|
3708
|
+
const targets = resolveElements$1(model, expr.incoming);
|
|
3709
|
+
for (const source of sources) {
|
|
3710
|
+
const toInclude = applyPredicate(findConnectionsBetween(source, targets, "directed"), where);
|
|
3711
|
+
stage.addConnections(toInclude);
|
|
3712
|
+
}
|
|
3713
|
+
return stage;
|
|
3714
|
+
},
|
|
3715
|
+
exclude: ({ expr, model, memory, stage, where }) => {
|
|
3716
|
+
if (FqnExpr.isModelRef(expr.incoming)) {
|
|
3717
|
+
const excludedRelations = resolveAllImcomingRelations(model, expr.incoming);
|
|
3718
|
+
return excludeModelRelations(excludedRelations, { stage, memory }, where);
|
|
3719
|
+
}
|
|
3720
|
+
if (FqnExpr.isWildcard(expr.incoming)) {
|
|
3721
|
+
return stage;
|
|
3722
|
+
}
|
|
3723
|
+
const isIncoming = filterIncomingConnections(resolveElements$1(model, expr.incoming));
|
|
3724
|
+
const toExclude = C(
|
|
3725
|
+
memory.connections,
|
|
3726
|
+
T(isIncoming),
|
|
3727
|
+
applyPredicate(where)
|
|
3728
|
+
);
|
|
3729
|
+
stage.excludeConnections(toExclude);
|
|
3730
|
+
return stage;
|
|
3731
|
+
}
|
|
3732
|
+
};
|
|
3733
|
+
function filterIncomingConnections(targets) {
|
|
3734
|
+
return y$2(
|
|
3735
|
+
targets.map((target) => {
|
|
3736
|
+
const satisfies = (el) => el === target || isAncestor(target, el);
|
|
3737
|
+
return (connection) => {
|
|
3738
|
+
return !satisfies(connection.source) && satisfies(connection.target);
|
|
3739
|
+
};
|
|
3740
|
+
})
|
|
3741
|
+
);
|
|
3742
|
+
}
|
|
3743
|
+
function resolveAllImcomingRelations(model, moodelRef) {
|
|
3744
|
+
const targets = resolveModelElements(model, moodelRef);
|
|
3745
|
+
return new Set(targets.flatMap((e) => [...e.allIncoming]));
|
|
3746
|
+
}
|
|
3747
|
+
|
|
3775
3748
|
const OutgoingRelationPredicate = {
|
|
3776
3749
|
include: ({ expr, model, memory, stage, where }) => {
|
|
3777
3750
|
const targets = [...memory.elements];
|
|
@@ -3804,7 +3777,7 @@ const OutgoingRelationPredicate = {
|
|
|
3804
3777
|
return stage;
|
|
3805
3778
|
}
|
|
3806
3779
|
const isOutgoing = filterOutgoingConnections(resolveElements$1(model, expr.outgoing));
|
|
3807
|
-
const toExclude =
|
|
3780
|
+
const toExclude = C(
|
|
3808
3781
|
memory.connections,
|
|
3809
3782
|
T(isOutgoing),
|
|
3810
3783
|
applyPredicate(where)
|
|
@@ -3814,7 +3787,7 @@ const OutgoingRelationPredicate = {
|
|
|
3814
3787
|
}
|
|
3815
3788
|
};
|
|
3816
3789
|
function filterOutgoingConnections(sources) {
|
|
3817
|
-
return y$
|
|
3790
|
+
return y$2(
|
|
3818
3791
|
sources.map((source) => {
|
|
3819
3792
|
const satisfies = (el) => el === source || isAncestor(source, el);
|
|
3820
3793
|
return (connection) => {
|
|
@@ -3828,33 +3801,199 @@ function resolveAllOutgoingRelations(model, moodelRef) {
|
|
|
3828
3801
|
return new Set(targets.flatMap((e) => [...e.allOutgoing]));
|
|
3829
3802
|
}
|
|
3830
3803
|
|
|
3831
|
-
const
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
|
|
3836
|
-
|
|
3837
|
-
|
|
3838
|
-
|
|
3804
|
+
const resolveAscendingSiblings = (element) => {
|
|
3805
|
+
const siblings = /* @__PURE__ */ new Set();
|
|
3806
|
+
for (let sibling of element.descendingSiblings()) {
|
|
3807
|
+
siblings.add(sibling);
|
|
3808
|
+
}
|
|
3809
|
+
return siblings;
|
|
3810
|
+
};
|
|
3811
|
+
const DirectRelationPredicate = {
|
|
3812
|
+
include: ({ expr: { source, target, isBidirectional = false }, model, stage, where }) => {
|
|
3813
|
+
invariant(!FqnExpr.isModelRef(source), "Invalid source model ref in direct relation");
|
|
3814
|
+
invariant(!FqnExpr.isModelRef(target), "Invalid target model ref in direct relation");
|
|
3815
|
+
const sourceIsWildcard = FqnExpr.isWildcard(source);
|
|
3816
|
+
const targetIsWildcard = FqnExpr.isWildcard(target);
|
|
3817
|
+
const dir = isBidirectional ? "both" : "directed";
|
|
3818
|
+
let connections;
|
|
3819
|
+
switch (true) {
|
|
3820
|
+
// * -> *
|
|
3821
|
+
case (sourceIsWildcard && targetIsWildcard): {
|
|
3822
|
+
connections = C(
|
|
3823
|
+
findConnectionsWithin(model.instances()),
|
|
3824
|
+
applyPredicate(where),
|
|
3825
|
+
m$3((c) => {
|
|
3826
|
+
stage.addImplicit(c.boundary);
|
|
3827
|
+
return c;
|
|
3828
|
+
})
|
|
3829
|
+
);
|
|
3830
|
+
break;
|
|
3831
|
+
}
|
|
3832
|
+
// source -> *; source <-> *
|
|
3833
|
+
case (!sourceIsWildcard && targetIsWildcard): {
|
|
3834
|
+
const sources = resolveElements$1(model, source);
|
|
3835
|
+
const isSource = filterOutgoingConnections(sources);
|
|
3836
|
+
let postFilter = isSource;
|
|
3837
|
+
if (isBidirectional) {
|
|
3838
|
+
const isTarget = filterIncomingConnections(sources);
|
|
3839
|
+
postFilter = (c) => isSource(c) !== isTarget(c);
|
|
3840
|
+
}
|
|
3841
|
+
connections = C(
|
|
3842
|
+
sources,
|
|
3843
|
+
u$1((source2) => {
|
|
3844
|
+
const targets = resolveAscendingSiblings(source2);
|
|
3845
|
+
return findConnectionsBetween(source2, targets, dir);
|
|
3846
|
+
}),
|
|
3847
|
+
T(postFilter),
|
|
3848
|
+
applyPredicate(where)
|
|
3849
|
+
);
|
|
3850
|
+
break;
|
|
3851
|
+
}
|
|
3852
|
+
// * -> target; * <-> target
|
|
3853
|
+
case (sourceIsWildcard && !targetIsWildcard): {
|
|
3854
|
+
const targets = resolveElements$1(model, target);
|
|
3855
|
+
const isTarget = filterIncomingConnections(targets);
|
|
3856
|
+
let postFilter = isTarget;
|
|
3857
|
+
if (isBidirectional) {
|
|
3858
|
+
const isSource = filterOutgoingConnections(targets);
|
|
3859
|
+
postFilter = (c) => isSource(c) !== isTarget(c);
|
|
3860
|
+
}
|
|
3861
|
+
connections = C(
|
|
3862
|
+
targets,
|
|
3863
|
+
u$1((target2) => {
|
|
3864
|
+
const sources = resolveAscendingSiblings(target2);
|
|
3865
|
+
return [...sources].flatMap((source2) => findConnection(source2, target2, dir));
|
|
3866
|
+
}),
|
|
3867
|
+
T(postFilter),
|
|
3868
|
+
applyPredicate(where)
|
|
3869
|
+
);
|
|
3870
|
+
break;
|
|
3871
|
+
}
|
|
3872
|
+
default: {
|
|
3873
|
+
invariant(!sourceIsWildcard, "Inferrence failed - source should be a deployment ref");
|
|
3874
|
+
invariant(!targetIsWildcard, "Inferrence failed - target should be a deployment ref");
|
|
3875
|
+
const sources = resolveElements$1(model, source);
|
|
3876
|
+
const targets = resolveElements$1(model, target);
|
|
3877
|
+
const isSource = filterOutgoingConnections(sources);
|
|
3878
|
+
const isTarget = filterIncomingConnections(targets);
|
|
3879
|
+
connections = C(
|
|
3880
|
+
sources,
|
|
3881
|
+
u$1((s) => findConnectionsBetween(s, targets, dir)),
|
|
3882
|
+
T((c) => isSource(c) && isTarget(c)),
|
|
3883
|
+
applyPredicate(where)
|
|
3884
|
+
);
|
|
3839
3885
|
}
|
|
3840
|
-
return stage;
|
|
3841
3886
|
}
|
|
3842
|
-
|
|
3843
|
-
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
|
|
3887
|
+
stage.addConnections(connections);
|
|
3888
|
+
if (FqnExpr.isDeploymentRef(source) && l$7(source.selector)) {
|
|
3889
|
+
stage.addImplicit(model.element(source.ref.deployment));
|
|
3890
|
+
}
|
|
3891
|
+
if (FqnExpr.isDeploymentRef(target) && l$7(target.selector)) {
|
|
3892
|
+
stage.addImplicit(model.element(target.ref.deployment));
|
|
3847
3893
|
}
|
|
3848
3894
|
return stage;
|
|
3849
3895
|
},
|
|
3850
3896
|
exclude: ({ expr, model, memory, stage, where }) => {
|
|
3851
|
-
|
|
3852
|
-
|
|
3853
|
-
|
|
3897
|
+
const isTarget = deploymentExpressionToPredicate(expr.target);
|
|
3898
|
+
const isSource = deploymentExpressionToPredicate(expr.source);
|
|
3899
|
+
let modelRelationsToExclude;
|
|
3900
|
+
switch (true) {
|
|
3901
|
+
// * -> *
|
|
3902
|
+
case (FqnExpr.isWildcard(expr.source) && FqnExpr.isWildcard(expr.target)):
|
|
3903
|
+
stage.excludeConnections(applyPredicate(memory.connections, where));
|
|
3854
3904
|
return stage;
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
|
|
3905
|
+
// model -> model
|
|
3906
|
+
case (FqnExpr.isModelRef(expr.source) && FqnExpr.isModelRef(expr.target)):
|
|
3907
|
+
modelRelationsToExclude = resolveRelationsBetweenModelElements({
|
|
3908
|
+
source: expr.source,
|
|
3909
|
+
target: expr.target,
|
|
3910
|
+
expr,
|
|
3911
|
+
model
|
|
3912
|
+
});
|
|
3913
|
+
return excludeModelRelations(modelRelationsToExclude, { stage, memory }, where);
|
|
3914
|
+
// model -> *
|
|
3915
|
+
case (FqnExpr.isModelRef(expr.source) && FqnExpr.isWildcard(expr.target)):
|
|
3916
|
+
modelRelationsToExclude = resolveAllOutgoingRelations(model, expr.source);
|
|
3917
|
+
return excludeModelRelations(modelRelationsToExclude, { stage, memory }, where);
|
|
3918
|
+
// model -> deployment
|
|
3919
|
+
case FqnExpr.isModelRef(expr.source):
|
|
3920
|
+
modelRelationsToExclude = resolveAllOutgoingRelations(model, expr.source);
|
|
3921
|
+
return excludeModelRelations(
|
|
3922
|
+
modelRelationsToExclude,
|
|
3923
|
+
{ stage, memory },
|
|
3924
|
+
where,
|
|
3925
|
+
(c) => isTarget(c.target)
|
|
3926
|
+
);
|
|
3927
|
+
// deployment -> model
|
|
3928
|
+
case FqnExpr.isModelRef(expr.target):
|
|
3929
|
+
modelRelationsToExclude = resolveAllImcomingRelations(model, expr.target);
|
|
3930
|
+
return excludeModelRelations(
|
|
3931
|
+
modelRelationsToExclude,
|
|
3932
|
+
{ stage, memory },
|
|
3933
|
+
where,
|
|
3934
|
+
(c) => isSource(c.source)
|
|
3935
|
+
);
|
|
3936
|
+
// deployment -> deployment
|
|
3937
|
+
default:
|
|
3938
|
+
const satisfies = (connection) => {
|
|
3939
|
+
return isSource(connection.source) && isTarget(connection.target) || expr.isBidirectional === true && isSource(connection.target) && isTarget(connection.source);
|
|
3940
|
+
};
|
|
3941
|
+
const deploymentRelationsToExclude = C(
|
|
3942
|
+
memory.connections,
|
|
3943
|
+
T(satisfies),
|
|
3944
|
+
applyPredicate(where)
|
|
3945
|
+
);
|
|
3946
|
+
if (deploymentRelationsToExclude.length === 0) {
|
|
3947
|
+
return stage;
|
|
3948
|
+
}
|
|
3949
|
+
stage.excludeConnections(deploymentRelationsToExclude);
|
|
3950
|
+
return stage;
|
|
3951
|
+
}
|
|
3952
|
+
}
|
|
3953
|
+
};
|
|
3954
|
+
function resolveRelationsBetweenModelElements({
|
|
3955
|
+
source,
|
|
3956
|
+
target,
|
|
3957
|
+
expr,
|
|
3958
|
+
model
|
|
3959
|
+
}) {
|
|
3960
|
+
const sources = resolveModelElements(model, source);
|
|
3961
|
+
const targets = resolveModelElements(model, target);
|
|
3962
|
+
const dir = expr.isBidirectional ? "both" : "directed";
|
|
3963
|
+
const modelConnections = [];
|
|
3964
|
+
for (const source2 of sources) {
|
|
3965
|
+
modelConnections.push(...findConnectionsBetween$1(source2, targets, dir));
|
|
3966
|
+
}
|
|
3967
|
+
return new Set(modelConnections.flatMap((c) => [...c.relations]));
|
|
3968
|
+
}
|
|
3969
|
+
|
|
3970
|
+
const InOutRelationPredicate$1 = {
|
|
3971
|
+
include: ({ expr, model, memory, stage, where }) => {
|
|
3972
|
+
const sources = [...memory.elements];
|
|
3973
|
+
if (FqnExpr.isWildcard(expr.inout)) {
|
|
3974
|
+
for (const source of sources) {
|
|
3975
|
+
const targets2 = [...resolveAscendingSiblings(source)];
|
|
3976
|
+
const toInclude = matchConnections(findConnectionsBetween(source, targets2, "both"), where);
|
|
3977
|
+
stage.addConnections(toInclude);
|
|
3978
|
+
}
|
|
3979
|
+
return stage;
|
|
3980
|
+
}
|
|
3981
|
+
invariant(FqnExpr.isDeploymentRef(expr.inout), "Only deployment refs are supported in include");
|
|
3982
|
+
const targets = resolveElements$1(model, expr.inout);
|
|
3983
|
+
for (const source of sources) {
|
|
3984
|
+
const toInclude = matchConnections(findConnectionsBetween(source, targets, "both"), where);
|
|
3985
|
+
stage.addConnections(toInclude);
|
|
3986
|
+
}
|
|
3987
|
+
return stage;
|
|
3988
|
+
},
|
|
3989
|
+
exclude: ({ expr, model, memory, stage, where }) => {
|
|
3990
|
+
if (FqnExpr.isModelRef(expr.inout)) {
|
|
3991
|
+
const elements2 = resolveModelElements(model, expr.inout);
|
|
3992
|
+
if (elements2.length === 0) {
|
|
3993
|
+
return stage;
|
|
3994
|
+
}
|
|
3995
|
+
const excludedRelations = union(
|
|
3996
|
+
/* @__PURE__ */ new Set(),
|
|
3858
3997
|
...elements2.flatMap((e) => [e.allIncoming, e.allOutgoing])
|
|
3859
3998
|
);
|
|
3860
3999
|
return excludeModelRelations(excludedRelations, { stage, memory }, where);
|
|
@@ -3865,7 +4004,7 @@ const InOutRelationPredicate$1 = {
|
|
|
3865
4004
|
const elements = resolveElements$1(model, expr.inout);
|
|
3866
4005
|
const isIncoming = filterIncomingConnections(elements);
|
|
3867
4006
|
const isOutgoing = filterOutgoingConnections(elements);
|
|
3868
|
-
const toExclude =
|
|
4007
|
+
const toExclude = C(
|
|
3869
4008
|
memory.connections,
|
|
3870
4009
|
T((c) => isIncoming(c) !== isOutgoing(c)),
|
|
3871
4010
|
applyPredicate(where)
|
|
@@ -3887,14 +4026,18 @@ const WhereRelationPredicate = {
|
|
|
3887
4026
|
};
|
|
3888
4027
|
|
|
3889
4028
|
const WildcardPredicate$1 = {
|
|
3890
|
-
include: ({ model, stage }) => {
|
|
4029
|
+
include: ({ model, stage, where }) => {
|
|
3891
4030
|
const children = [];
|
|
3892
|
-
const rootElements =
|
|
3893
|
-
|
|
3894
|
-
|
|
3895
|
-
|
|
3896
|
-
|
|
3897
|
-
|
|
4031
|
+
const rootElements = C(
|
|
4032
|
+
[...model.roots()],
|
|
4033
|
+
applyElementPredicate(where),
|
|
4034
|
+
m$3((root) => {
|
|
4035
|
+
if (!root.onlyOneInstance()) {
|
|
4036
|
+
children.push(...root.children());
|
|
4037
|
+
}
|
|
4038
|
+
return root;
|
|
4039
|
+
})
|
|
4040
|
+
);
|
|
3898
4041
|
stage.addExplicit(rootElements);
|
|
3899
4042
|
if (children.length > 1) {
|
|
3900
4043
|
stage.addConnections(findConnectionsWithin([
|
|
@@ -3904,8 +4047,12 @@ const WildcardPredicate$1 = {
|
|
|
3904
4047
|
}
|
|
3905
4048
|
return stage;
|
|
3906
4049
|
},
|
|
3907
|
-
exclude: ({ stage, memory }) => {
|
|
3908
|
-
|
|
4050
|
+
exclude: ({ stage, memory, where }) => {
|
|
4051
|
+
const elementsToExclude = C(
|
|
4052
|
+
[...memory.elements],
|
|
4053
|
+
applyElementPredicate(where)
|
|
4054
|
+
);
|
|
4055
|
+
stage.exclude(elementsToExclude);
|
|
3909
4056
|
return stage;
|
|
3910
4057
|
}
|
|
3911
4058
|
};
|
|
@@ -3936,7 +4083,7 @@ function excludeModelRelations(relationsToExclude, { stage, memory }, where, fil
|
|
|
3936
4083
|
if (relationsToExclude.size === 0) {
|
|
3937
4084
|
return stage;
|
|
3938
4085
|
}
|
|
3939
|
-
const toExclude =
|
|
4086
|
+
const toExclude = C(
|
|
3940
4087
|
memory.connections,
|
|
3941
4088
|
T((c) => filterConnections(c)),
|
|
3942
4089
|
// Find connections that have at least one relation in common with the excluded relations
|
|
@@ -3966,7 +4113,7 @@ function applyPredicate(...args) {
|
|
|
3966
4113
|
if (where === null) {
|
|
3967
4114
|
return c;
|
|
3968
4115
|
}
|
|
3969
|
-
if (o$
|
|
4116
|
+
if (o$9(c)) {
|
|
3970
4117
|
return c.map((x) => applyPredicate(x, where)).filter((x) => x.nonEmpty());
|
|
3971
4118
|
}
|
|
3972
4119
|
return c.update({
|
|
@@ -3974,11 +4121,21 @@ function applyPredicate(...args) {
|
|
|
3974
4121
|
deployment: new Set([...c.relations.deployment.values()].filter((r) => where(toFilterableRelation(c)(r))))
|
|
3975
4122
|
});
|
|
3976
4123
|
}
|
|
4124
|
+
function applyElementPredicate(...args) {
|
|
4125
|
+
if (args.length === 1) {
|
|
4126
|
+
return (x) => applyElementPredicate(x, args[0]);
|
|
4127
|
+
}
|
|
4128
|
+
const [c, where] = args;
|
|
4129
|
+
if (o$9(c)) {
|
|
4130
|
+
return c.filter((x) => applyElementPredicate(x, where));
|
|
4131
|
+
}
|
|
4132
|
+
return where?.(toFilterable(c, c)) ?? true;
|
|
4133
|
+
}
|
|
3977
4134
|
function matchConnections(connections, where) {
|
|
3978
4135
|
if (!where) {
|
|
3979
4136
|
return connections;
|
|
3980
4137
|
}
|
|
3981
|
-
return
|
|
4138
|
+
return C(
|
|
3982
4139
|
connections,
|
|
3983
4140
|
T((c) => matchConnection(c, where))
|
|
3984
4141
|
);
|
|
@@ -4014,225 +4171,117 @@ function toFilterableRelation(c) {
|
|
|
4014
4171
|
});
|
|
4015
4172
|
}
|
|
4016
4173
|
|
|
4017
|
-
const
|
|
4018
|
-
include: (
|
|
4019
|
-
const
|
|
4020
|
-
|
|
4021
|
-
|
|
4022
|
-
|
|
4023
|
-
|
|
4024
|
-
|
|
4025
|
-
const targets2 = [...resolveAscendingSiblings(source)];
|
|
4026
|
-
const toInclude = applyPredicate(findConnectionsBetween(source, targets2, "directed"), where);
|
|
4027
|
-
stage.addConnections(toInclude);
|
|
4174
|
+
const DeploymentRefPredicate = {
|
|
4175
|
+
include: (ctx) => {
|
|
4176
|
+
const { expr, where } = ctx;
|
|
4177
|
+
const el = ctx.model.element(expr.ref.deployment);
|
|
4178
|
+
if (isDeployedInstance(el)) {
|
|
4179
|
+
if (applyElementPredicate(el, where)) {
|
|
4180
|
+
ctx.stage.addExplicit(el);
|
|
4181
|
+
ctx.stage.connectWithExisting(el);
|
|
4028
4182
|
}
|
|
4029
|
-
return stage;
|
|
4183
|
+
return ctx.stage;
|
|
4030
4184
|
}
|
|
4031
|
-
|
|
4032
|
-
|
|
4033
|
-
|
|
4034
|
-
|
|
4035
|
-
|
|
4185
|
+
switch (true) {
|
|
4186
|
+
case expr.selector === "expanded":
|
|
4187
|
+
includeDeployedNodeWithExpanded(el, ctx);
|
|
4188
|
+
break;
|
|
4189
|
+
case expr.selector === "children":
|
|
4190
|
+
includeDeployedNodeChildren(el, ctx);
|
|
4191
|
+
break;
|
|
4192
|
+
case expr.selector === "descendants":
|
|
4193
|
+
includeDeployedNodeDescendants(el, ctx);
|
|
4194
|
+
break;
|
|
4195
|
+
default: {
|
|
4196
|
+
if (applyElementPredicate(el, where)) {
|
|
4197
|
+
ctx.stage.addExplicit(el);
|
|
4198
|
+
ctx.stage.connectWithExisting(el);
|
|
4199
|
+
}
|
|
4200
|
+
}
|
|
4036
4201
|
}
|
|
4037
|
-
return stage;
|
|
4202
|
+
return ctx.stage;
|
|
4038
4203
|
},
|
|
4039
|
-
exclude: ({ expr,
|
|
4040
|
-
|
|
4041
|
-
|
|
4042
|
-
|
|
4043
|
-
|
|
4044
|
-
|
|
4045
|
-
return stage;
|
|
4046
|
-
}
|
|
4047
|
-
const isIncoming = filterIncomingConnections(resolveElements$1(model, expr.incoming));
|
|
4048
|
-
const toExclude = x(
|
|
4049
|
-
memory.connections,
|
|
4050
|
-
T(isIncoming),
|
|
4051
|
-
applyPredicate(where)
|
|
4204
|
+
exclude: ({ expr, stage, memory, where }) => {
|
|
4205
|
+
const exprPredicate = deploymentExpressionToPredicate(expr);
|
|
4206
|
+
const toExclude = C(
|
|
4207
|
+
[...memory.elements],
|
|
4208
|
+
T(exprPredicate),
|
|
4209
|
+
applyElementPredicate(where)
|
|
4052
4210
|
);
|
|
4053
|
-
stage.
|
|
4211
|
+
stage.exclude(toExclude);
|
|
4054
4212
|
return stage;
|
|
4055
4213
|
}
|
|
4056
4214
|
};
|
|
4057
|
-
function
|
|
4058
|
-
|
|
4059
|
-
|
|
4060
|
-
|
|
4061
|
-
|
|
4062
|
-
|
|
4063
|
-
|
|
4064
|
-
|
|
4065
|
-
);
|
|
4066
|
-
}
|
|
4067
|
-
function resolveAllImcomingRelations(model, moodelRef) {
|
|
4068
|
-
const targets = resolveModelElements(model, moodelRef);
|
|
4069
|
-
return new Set(targets.flatMap((e) => [...e.allIncoming]));
|
|
4215
|
+
function includeDeployedNodeChildren(node, { stage, where }) {
|
|
4216
|
+
const children = applyElementPredicate([...node.children()], where);
|
|
4217
|
+
if (children.length === 0) {
|
|
4218
|
+
return;
|
|
4219
|
+
}
|
|
4220
|
+
stage.addImplicit(node);
|
|
4221
|
+
stage.addConnections(findConnectionsWithin(children));
|
|
4222
|
+
stage.connectWithExisting(children);
|
|
4223
|
+
stage.addExplicit(children);
|
|
4070
4224
|
}
|
|
4071
|
-
|
|
4072
|
-
|
|
4073
|
-
|
|
4074
|
-
|
|
4075
|
-
|
|
4225
|
+
function includeDeployedNodeWithExpanded(node, { memory, stage, where }) {
|
|
4226
|
+
stage.addImplicit(node);
|
|
4227
|
+
stage.connectWithExisting(node);
|
|
4228
|
+
const children = applyElementPredicate([...node.children()], where);
|
|
4229
|
+
let hasConnectionsWithVisible = false;
|
|
4230
|
+
for (const child of children) {
|
|
4231
|
+
if (findConnectionsBetween(child, memory.elements).length > 0) {
|
|
4232
|
+
hasConnectionsWithVisible = true;
|
|
4233
|
+
break;
|
|
4234
|
+
}
|
|
4076
4235
|
}
|
|
4077
|
-
|
|
4078
|
-
|
|
4079
|
-
|
|
4080
|
-
|
|
4081
|
-
|
|
4082
|
-
|
|
4083
|
-
|
|
4084
|
-
|
|
4085
|
-
|
|
4086
|
-
|
|
4087
|
-
|
|
4088
|
-
|
|
4089
|
-
|
|
4090
|
-
|
|
4091
|
-
|
|
4092
|
-
|
|
4093
|
-
m$3((c) => {
|
|
4094
|
-
stage.addImplicit(c.boundary);
|
|
4095
|
-
return c;
|
|
4096
|
-
})
|
|
4097
|
-
);
|
|
4098
|
-
break;
|
|
4099
|
-
}
|
|
4100
|
-
// source -> *; source <-> *
|
|
4101
|
-
case (!sourceIsWildcard && targetIsWildcard): {
|
|
4102
|
-
const sources = resolveElements$1(model, source);
|
|
4103
|
-
const isSource = filterOutgoingConnections(sources);
|
|
4104
|
-
let postFilter = isSource;
|
|
4105
|
-
if (isBidirectional) {
|
|
4106
|
-
const isTarget = filterIncomingConnections(sources);
|
|
4107
|
-
postFilter = (c) => isSource(c) !== isTarget(c);
|
|
4108
|
-
}
|
|
4109
|
-
connections = x(
|
|
4110
|
-
sources,
|
|
4111
|
-
u$1((source2) => {
|
|
4112
|
-
const targets = resolveAscendingSiblings(source2);
|
|
4113
|
-
return findConnectionsBetween(source2, targets, dir);
|
|
4114
|
-
}),
|
|
4115
|
-
T(postFilter),
|
|
4116
|
-
applyPredicate(where)
|
|
4117
|
-
);
|
|
4118
|
-
break;
|
|
4119
|
-
}
|
|
4120
|
-
// * -> target; * <-> target
|
|
4121
|
-
case (sourceIsWildcard && !targetIsWildcard): {
|
|
4122
|
-
const targets = resolveElements$1(model, target);
|
|
4123
|
-
const isTarget = filterIncomingConnections(targets);
|
|
4124
|
-
let postFilter = isTarget;
|
|
4125
|
-
if (isBidirectional) {
|
|
4126
|
-
const isSource = filterOutgoingConnections(targets);
|
|
4127
|
-
postFilter = (c) => isSource(c) !== isTarget(c);
|
|
4128
|
-
}
|
|
4129
|
-
connections = x(
|
|
4130
|
-
targets,
|
|
4131
|
-
u$1((target2) => {
|
|
4132
|
-
const sources = resolveAscendingSiblings(target2);
|
|
4133
|
-
return [...sources].flatMap((source2) => findConnection(source2, target2, dir));
|
|
4134
|
-
}),
|
|
4135
|
-
T(postFilter),
|
|
4136
|
-
applyPredicate(where)
|
|
4137
|
-
);
|
|
4138
|
-
break;
|
|
4236
|
+
if (hasConnectionsWithVisible) {
|
|
4237
|
+
stage.connectWithExisting(children, "in");
|
|
4238
|
+
stage.addConnections(findConnectionsWithin(children));
|
|
4239
|
+
stage.connectWithExisting(children, "out");
|
|
4240
|
+
}
|
|
4241
|
+
stage.addImplicit(children);
|
|
4242
|
+
if (stage.connections.length > 0) {
|
|
4243
|
+
stage.addExplicit(node);
|
|
4244
|
+
}
|
|
4245
|
+
}
|
|
4246
|
+
function includeDeployedNodeDescendants(node, { stage, where }) {
|
|
4247
|
+
const dfs = (node2) => {
|
|
4248
|
+
const children = [];
|
|
4249
|
+
for (const child of node2.children()) {
|
|
4250
|
+
if (child.isDeploymentNode()) {
|
|
4251
|
+
children.push(...dfs(child));
|
|
4139
4252
|
}
|
|
4140
|
-
|
|
4141
|
-
|
|
4142
|
-
invariant(!targetIsWildcard, "Inferrence failed - target should be a deployment ref");
|
|
4143
|
-
const sources = resolveElements$1(model, source);
|
|
4144
|
-
const targets = resolveElements$1(model, target);
|
|
4145
|
-
const isSource = filterOutgoingConnections(sources);
|
|
4146
|
-
const isTarget = filterIncomingConnections(targets);
|
|
4147
|
-
connections = x(
|
|
4148
|
-
sources,
|
|
4149
|
-
u$1((s) => findConnectionsBetween(s, targets, dir)),
|
|
4150
|
-
T((c) => isSource(c) && isTarget(c)),
|
|
4151
|
-
applyPredicate(where)
|
|
4152
|
-
);
|
|
4253
|
+
if (applyElementPredicate(child, where)) {
|
|
4254
|
+
children.push(child);
|
|
4153
4255
|
}
|
|
4154
4256
|
}
|
|
4155
|
-
stage.
|
|
4156
|
-
|
|
4157
|
-
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
|
|
4161
|
-
|
|
4162
|
-
return
|
|
4163
|
-
},
|
|
4164
|
-
exclude: ({ expr, model, memory, stage, where }) => {
|
|
4165
|
-
const isTarget = deploymentExpressionToPredicate(expr.target);
|
|
4166
|
-
const isSource = deploymentExpressionToPredicate(expr.source);
|
|
4167
|
-
let modelRelationsToExclude;
|
|
4168
|
-
switch (true) {
|
|
4169
|
-
// * -> *
|
|
4170
|
-
case (FqnExpr.isWildcard(expr.source) && FqnExpr.isWildcard(expr.target)):
|
|
4171
|
-
stage.excludeConnections(applyPredicate(memory.connections, where));
|
|
4172
|
-
return stage;
|
|
4173
|
-
// model -> model
|
|
4174
|
-
case (FqnExpr.isModelRef(expr.source) && FqnExpr.isModelRef(expr.target)):
|
|
4175
|
-
modelRelationsToExclude = resolveRelationsBetweenModelElements({
|
|
4176
|
-
source: expr.source,
|
|
4177
|
-
target: expr.target,
|
|
4178
|
-
expr,
|
|
4179
|
-
model
|
|
4180
|
-
});
|
|
4181
|
-
return excludeModelRelations(modelRelationsToExclude, { stage, memory }, where);
|
|
4182
|
-
// model -> *
|
|
4183
|
-
case (FqnExpr.isModelRef(expr.source) && FqnExpr.isWildcard(expr.target)):
|
|
4184
|
-
modelRelationsToExclude = resolveAllOutgoingRelations(model, expr.source);
|
|
4185
|
-
return excludeModelRelations(modelRelationsToExclude, { stage, memory }, where);
|
|
4186
|
-
// model -> deployment
|
|
4187
|
-
case FqnExpr.isModelRef(expr.source):
|
|
4188
|
-
modelRelationsToExclude = resolveAllOutgoingRelations(model, expr.source);
|
|
4189
|
-
return excludeModelRelations(
|
|
4190
|
-
modelRelationsToExclude,
|
|
4191
|
-
{ stage, memory },
|
|
4192
|
-
where,
|
|
4193
|
-
(c) => isTarget(c.target)
|
|
4194
|
-
);
|
|
4195
|
-
// deployment -> model
|
|
4196
|
-
case FqnExpr.isModelRef(expr.target):
|
|
4197
|
-
modelRelationsToExclude = resolveAllImcomingRelations(model, expr.target);
|
|
4198
|
-
return excludeModelRelations(
|
|
4199
|
-
modelRelationsToExclude,
|
|
4200
|
-
{ stage, memory },
|
|
4201
|
-
where,
|
|
4202
|
-
(c) => isSource(c.source)
|
|
4203
|
-
);
|
|
4204
|
-
// deployment -> deployment
|
|
4205
|
-
default:
|
|
4206
|
-
const satisfies = (connection) => {
|
|
4207
|
-
return isSource(connection.source) && isTarget(connection.target) || expr.isBidirectional === true && isSource(connection.target) && isTarget(connection.source);
|
|
4208
|
-
};
|
|
4209
|
-
const deploymentRelationsToExclude = x(
|
|
4210
|
-
memory.connections,
|
|
4211
|
-
T(satisfies),
|
|
4212
|
-
applyPredicate(where)
|
|
4213
|
-
);
|
|
4214
|
-
if (deploymentRelationsToExclude.length === 0) {
|
|
4215
|
-
return stage;
|
|
4216
|
-
}
|
|
4217
|
-
stage.excludeConnections(deploymentRelationsToExclude);
|
|
4218
|
-
return stage;
|
|
4219
|
-
}
|
|
4220
|
-
}
|
|
4221
|
-
};
|
|
4222
|
-
function resolveRelationsBetweenModelElements({
|
|
4223
|
-
source,
|
|
4224
|
-
target,
|
|
4225
|
-
expr,
|
|
4226
|
-
model
|
|
4227
|
-
}) {
|
|
4228
|
-
const sources = resolveModelElements(model, source);
|
|
4229
|
-
const targets = resolveModelElements(model, target);
|
|
4230
|
-
const dir = expr.isBidirectional ? "both" : "directed";
|
|
4231
|
-
const modelConnections = [];
|
|
4232
|
-
for (const source2 of sources) {
|
|
4233
|
-
modelConnections.push(...findConnectionsBetween$1(source2, targets, dir));
|
|
4257
|
+
stage.connectWithExisting(children, "in");
|
|
4258
|
+
stage.addConnections(findConnectionsWithin(children));
|
|
4259
|
+
stage.addImplicit(children);
|
|
4260
|
+
return children;
|
|
4261
|
+
};
|
|
4262
|
+
const descendants = dfs(node);
|
|
4263
|
+
if (descendants.length === 0) {
|
|
4264
|
+
return;
|
|
4234
4265
|
}
|
|
4235
|
-
|
|
4266
|
+
stage.connectWithExisting(descendants, "out");
|
|
4267
|
+
const allConnected = findConnectedElements(stage);
|
|
4268
|
+
C(
|
|
4269
|
+
descendants,
|
|
4270
|
+
T((desc) => allConnected.has(desc)),
|
|
4271
|
+
u((desc) => stage.addExplicit(desc))
|
|
4272
|
+
);
|
|
4273
|
+
}
|
|
4274
|
+
function findConnectedElements(stage) {
|
|
4275
|
+
return C(
|
|
4276
|
+
stage.mergedConnections(),
|
|
4277
|
+
cleanCrossBoundary,
|
|
4278
|
+
cleanRedundantRelationships,
|
|
4279
|
+
l$5((acc, c) => {
|
|
4280
|
+
acc.add(c.source);
|
|
4281
|
+
acc.add(c.target);
|
|
4282
|
+
return acc;
|
|
4283
|
+
}, /* @__PURE__ */ new Set())
|
|
4284
|
+
);
|
|
4236
4285
|
}
|
|
4237
4286
|
|
|
4238
4287
|
let StageFinal$1 = class StageFinal {
|
|
@@ -4246,7 +4295,7 @@ let StageFinal$1 = class StageFinal {
|
|
|
4246
4295
|
if (memory.connections.length < 2) {
|
|
4247
4296
|
return memory;
|
|
4248
4297
|
}
|
|
4249
|
-
const connections =
|
|
4298
|
+
const connections = C(
|
|
4250
4299
|
memory.connections,
|
|
4251
4300
|
// Keep connections
|
|
4252
4301
|
// - between leafs
|
|
@@ -4298,7 +4347,7 @@ let StageFinal$1 = class StageFinal {
|
|
|
4298
4347
|
}
|
|
4299
4348
|
return false;
|
|
4300
4349
|
};
|
|
4301
|
-
|
|
4350
|
+
C(
|
|
4302
4351
|
difference(implicits, snapshot),
|
|
4303
4352
|
ifilter((e) => e.isDeploymentNode()),
|
|
4304
4353
|
toArray(),
|
|
@@ -4483,7 +4532,15 @@ function applyCustomElementProperties(_rules, _nodes) {
|
|
|
4483
4532
|
for (const {
|
|
4484
4533
|
custom: { expr, ...props }
|
|
4485
4534
|
} of rules) {
|
|
4486
|
-
const {
|
|
4535
|
+
const {
|
|
4536
|
+
border,
|
|
4537
|
+
opacity,
|
|
4538
|
+
multiple,
|
|
4539
|
+
padding,
|
|
4540
|
+
size,
|
|
4541
|
+
textSize,
|
|
4542
|
+
...rest
|
|
4543
|
+
} = d$1(props, n$4);
|
|
4487
4544
|
const notEmpty = !n(rest);
|
|
4488
4545
|
const satisfies = elementExprToPredicate(expr);
|
|
4489
4546
|
nodes.forEach((node, i) => {
|
|
@@ -4507,6 +4564,15 @@ function applyCustomElementProperties(_rules, _nodes) {
|
|
|
4507
4564
|
if (multiple !== undefined) {
|
|
4508
4565
|
styleOverride = { ...styleOverride, multiple };
|
|
4509
4566
|
}
|
|
4567
|
+
if (padding !== undefined) {
|
|
4568
|
+
styleOverride = { ...styleOverride, padding };
|
|
4569
|
+
}
|
|
4570
|
+
if (size !== undefined) {
|
|
4571
|
+
styleOverride = { ...styleOverride, size };
|
|
4572
|
+
}
|
|
4573
|
+
if (textSize !== undefined) {
|
|
4574
|
+
styleOverride = { ...styleOverride, textSize };
|
|
4575
|
+
}
|
|
4510
4576
|
if (styleOverride) {
|
|
4511
4577
|
node = {
|
|
4512
4578
|
...node,
|
|
@@ -4737,7 +4803,7 @@ class DynamicViewCompute {
|
|
|
4737
4803
|
notation: null
|
|
4738
4804
|
};
|
|
4739
4805
|
}
|
|
4740
|
-
const alltags =
|
|
4806
|
+
const alltags = C(
|
|
4741
4807
|
relationships,
|
|
4742
4808
|
u$1((r) => r.tags),
|
|
4743
4809
|
T(n$2),
|
|
@@ -4747,7 +4813,7 @@ class DynamicViewCompute {
|
|
|
4747
4813
|
const relations = i$9(relationships, 1) ? m$3(relationships, (r) => r.id) : null;
|
|
4748
4814
|
const relation = t$2(relationships) || relationships.find((r) => r.source === source && r.target === target);
|
|
4749
4815
|
const relationNavigateTo = relation?.$relationship.navigateTo ?? null;
|
|
4750
|
-
const navigateTo = relationNavigateTo && relationNavigateTo !== this.view.id ? relationNavigateTo :
|
|
4816
|
+
const navigateTo = relationNavigateTo && relationNavigateTo !== this.view.id ? relationNavigateTo : C(
|
|
4751
4817
|
relationships,
|
|
4752
4818
|
m$3((r) => r.$relationship.navigateTo),
|
|
4753
4819
|
T(n$2),
|
|
@@ -4755,7 +4821,7 @@ class DynamicViewCompute {
|
|
|
4755
4821
|
i$8(),
|
|
4756
4822
|
t$2()
|
|
4757
4823
|
);
|
|
4758
|
-
const commonProperties =
|
|
4824
|
+
const commonProperties = C(
|
|
4759
4825
|
relationships,
|
|
4760
4826
|
l$5((acc, { title, $relationship: r }) => {
|
|
4761
4827
|
n$2(title) && acc.title.add(title);
|
|
@@ -4882,7 +4948,7 @@ class NodesGroup {
|
|
|
4882
4948
|
|
|
4883
4949
|
class StageExclude extends AbstractStageExclude {
|
|
4884
4950
|
excludeRelations(excluded) {
|
|
4885
|
-
|
|
4951
|
+
C(
|
|
4886
4952
|
this.memory.connections,
|
|
4887
4953
|
T((c) => hasIntersection(c.relations, excluded)),
|
|
4888
4954
|
u((c) => {
|
|
@@ -4979,10 +5045,10 @@ class StageInclude extends AbstractStageInclude {
|
|
|
4979
5045
|
if (isRelationPredicateExpr(this.expression)) {
|
|
4980
5046
|
return connections;
|
|
4981
5047
|
}
|
|
4982
|
-
|
|
5048
|
+
C(
|
|
4983
5049
|
connections,
|
|
4984
5050
|
u(({ source, target, boundary }) => {
|
|
4985
|
-
|
|
5051
|
+
C(
|
|
4986
5052
|
d$6(
|
|
4987
5053
|
[...toArray(source.ancestors()).reverse(), source],
|
|
4988
5054
|
[...toArray(target.ancestors()).reverse(), target]
|
|
@@ -5093,7 +5159,7 @@ class ActiveGroupMemory extends Memory {
|
|
|
5093
5159
|
static enter(memory, rule) {
|
|
5094
5160
|
const groupId = `@gr${memory.groups.length + 1}`;
|
|
5095
5161
|
if (memory instanceof ActiveGroupMemory) {
|
|
5096
|
-
const stack2 = Stack.from(memory.stack);
|
|
5162
|
+
const stack2 = Stack.from([...memory.stack].reverse());
|
|
5097
5163
|
const state2 = memory.mutableState();
|
|
5098
5164
|
state2.groups.push(new NodesGroup(groupId, rule, memory.activeGroupId));
|
|
5099
5165
|
stack2.push(groupId);
|
|
@@ -5142,7 +5208,7 @@ class ActiveGroupMemory extends Memory {
|
|
|
5142
5208
|
}
|
|
5143
5209
|
|
|
5144
5210
|
function findRedundantConnections(connections) {
|
|
5145
|
-
return
|
|
5211
|
+
return C(
|
|
5146
5212
|
[...connections],
|
|
5147
5213
|
mergeConnections,
|
|
5148
5214
|
l$5((reducedConnections, connection, _, all) => {
|
|
@@ -5222,7 +5288,7 @@ class StageFinal {
|
|
|
5222
5288
|
}
|
|
5223
5289
|
return false;
|
|
5224
5290
|
};
|
|
5225
|
-
|
|
5291
|
+
C(
|
|
5226
5292
|
difference(implicits, snapshot),
|
|
5227
5293
|
toArray(),
|
|
5228
5294
|
sortByFqnHierarchically,
|
|
@@ -5335,7 +5401,7 @@ function includeDescendantsFromMemory(elements, memory) {
|
|
|
5335
5401
|
if (memory.isEmpty() || elements.length === 0) {
|
|
5336
5402
|
return elements;
|
|
5337
5403
|
}
|
|
5338
|
-
const descedantsOf = y$
|
|
5404
|
+
const descedantsOf = y$2(elements.map((e) => isDescendantOf(e)));
|
|
5339
5405
|
const fromMemory = toArray(
|
|
5340
5406
|
ifilter(
|
|
5341
5407
|
memory.elements,
|
|
@@ -5458,7 +5524,7 @@ const DirectRelationExprPredicate = {
|
|
|
5458
5524
|
// This is a special case, we look for all relationships that satisfy the where clause
|
|
5459
5525
|
// * -> * ; Empty memory; Where clause
|
|
5460
5526
|
case (sourceIsWildcard && targetIsWildcard && memory.isEmpty() && where !== NoWhere): {
|
|
5461
|
-
const connections2 =
|
|
5527
|
+
const connections2 = C(
|
|
5462
5528
|
model.relationships(),
|
|
5463
5529
|
ifilter(where),
|
|
5464
5530
|
toArray(),
|
|
@@ -5486,10 +5552,10 @@ const DirectRelationExprPredicate = {
|
|
|
5486
5552
|
// element -> *; Where clause
|
|
5487
5553
|
case (!sourceIsWildcard && targetIsWildcard && where !== NoWhere): {
|
|
5488
5554
|
const sources = resolveElements(model, source);
|
|
5489
|
-
const connections2 =
|
|
5555
|
+
const connections2 = C(
|
|
5490
5556
|
sources,
|
|
5491
5557
|
u$1(
|
|
5492
|
-
(source2) =>
|
|
5558
|
+
(source2) => C(
|
|
5493
5559
|
source2,
|
|
5494
5560
|
d$5(r(isBidirectional === true), {
|
|
5495
5561
|
onTrue: (s) => union(s.allIncoming, s.allOutgoing),
|
|
@@ -5500,7 +5566,7 @@ const DirectRelationExprPredicate = {
|
|
|
5500
5566
|
toArray(),
|
|
5501
5567
|
d$3((r) => r.source === source2),
|
|
5502
5568
|
([outgoing, incoming]) => a(
|
|
5503
|
-
|
|
5569
|
+
C(
|
|
5504
5570
|
outgoing,
|
|
5505
5571
|
m$3(
|
|
5506
5572
|
(outgoing2) => new ConnectionModel(
|
|
@@ -5510,7 +5576,7 @@ const DirectRelationExprPredicate = {
|
|
|
5510
5576
|
)
|
|
5511
5577
|
)
|
|
5512
5578
|
),
|
|
5513
|
-
|
|
5579
|
+
C(
|
|
5514
5580
|
incoming,
|
|
5515
5581
|
m$3(
|
|
5516
5582
|
(incoming2) => new ConnectionModel(
|
|
@@ -5542,10 +5608,10 @@ const DirectRelationExprPredicate = {
|
|
|
5542
5608
|
// * -> element; Where clause
|
|
5543
5609
|
case (sourceIsWildcard && !targetIsWildcard && where !== NoWhere): {
|
|
5544
5610
|
const targets = resolveElements(model, target);
|
|
5545
|
-
const connections2 =
|
|
5611
|
+
const connections2 = C(
|
|
5546
5612
|
targets,
|
|
5547
5613
|
u$1(
|
|
5548
|
-
(target2) =>
|
|
5614
|
+
(target2) => C(
|
|
5549
5615
|
target2,
|
|
5550
5616
|
d$5(r(isBidirectional === true), {
|
|
5551
5617
|
onTrue: (s) => union(s.allIncoming, s.allOutgoing),
|
|
@@ -5555,7 +5621,7 @@ const DirectRelationExprPredicate = {
|
|
|
5555
5621
|
toArray(),
|
|
5556
5622
|
d$3((r) => r.target === target2),
|
|
5557
5623
|
([incoming, outgoing]) => a(
|
|
5558
|
-
|
|
5624
|
+
C(
|
|
5559
5625
|
outgoing,
|
|
5560
5626
|
m$3(
|
|
5561
5627
|
(outgoing2) => new ConnectionModel(
|
|
@@ -5565,7 +5631,7 @@ const DirectRelationExprPredicate = {
|
|
|
5565
5631
|
)
|
|
5566
5632
|
)
|
|
5567
5633
|
),
|
|
5568
|
-
|
|
5634
|
+
C(
|
|
5569
5635
|
incoming,
|
|
5570
5636
|
m$3(
|
|
5571
5637
|
(incoming2) => new ConnectionModel(
|
|
@@ -5618,7 +5684,7 @@ const DirectRelationExprPredicate = {
|
|
|
5618
5684
|
switch (true) {
|
|
5619
5685
|
// * -> *
|
|
5620
5686
|
case (sourceIsWildcard && targetIsWildcard): {
|
|
5621
|
-
relations =
|
|
5687
|
+
relations = C(
|
|
5622
5688
|
memory.connections,
|
|
5623
5689
|
u$1(i$4(
|
|
5624
5690
|
p$1("relations"),
|
|
@@ -5632,10 +5698,10 @@ const DirectRelationExprPredicate = {
|
|
|
5632
5698
|
// element -> *
|
|
5633
5699
|
case (!sourceIsWildcard && targetIsWildcard): {
|
|
5634
5700
|
const sources = resolveElements(model, source);
|
|
5635
|
-
relations =
|
|
5701
|
+
relations = C(
|
|
5636
5702
|
sources,
|
|
5637
5703
|
u$1(
|
|
5638
|
-
(source2) =>
|
|
5704
|
+
(source2) => C(
|
|
5639
5705
|
source2,
|
|
5640
5706
|
d$5(r(isBidirectional === true), {
|
|
5641
5707
|
onTrue: (s) => union(s.allIncoming, s.allOutgoing),
|
|
@@ -5652,10 +5718,10 @@ const DirectRelationExprPredicate = {
|
|
|
5652
5718
|
// * -> element
|
|
5653
5719
|
case (sourceIsWildcard && !targetIsWildcard): {
|
|
5654
5720
|
const targets = resolveElements(model, target);
|
|
5655
|
-
relations =
|
|
5721
|
+
relations = C(
|
|
5656
5722
|
targets,
|
|
5657
5723
|
u$1(
|
|
5658
|
-
(target2) =>
|
|
5724
|
+
(target2) => C(
|
|
5659
5725
|
target2,
|
|
5660
5726
|
d$5(r(isBidirectional === true), {
|
|
5661
5727
|
onTrue: (s) => union(s.allIncoming, s.allOutgoing),
|
|
@@ -5707,7 +5773,7 @@ function resolveWildcard(nonWildcard, { memory, model }) {
|
|
|
5707
5773
|
includeDescendantsFromMemory(targets2, memory)
|
|
5708
5774
|
];
|
|
5709
5775
|
}
|
|
5710
|
-
const targets =
|
|
5776
|
+
const targets = C(
|
|
5711
5777
|
sources,
|
|
5712
5778
|
m$3((el) => el.ascendingSiblings()),
|
|
5713
5779
|
iflat(),
|
|
@@ -5786,14 +5852,14 @@ function incomingConnectionPredicate(model, expr) {
|
|
|
5786
5852
|
return (connection) => isElement(connection.target);
|
|
5787
5853
|
}
|
|
5788
5854
|
case (isElementRef(expr) && expr.isChildren): {
|
|
5789
|
-
return y$
|
|
5855
|
+
return y$2(
|
|
5790
5856
|
[...model.children(expr.element)].map(
|
|
5791
5857
|
(el) => Connection.isIncoming(el.id)
|
|
5792
5858
|
)
|
|
5793
5859
|
);
|
|
5794
5860
|
}
|
|
5795
5861
|
case (isElementRef(expr) && expr.isDescendants): {
|
|
5796
|
-
return y$
|
|
5862
|
+
return y$2([
|
|
5797
5863
|
Connection.isInside(expr.element),
|
|
5798
5864
|
...[...model.children(expr.element)].map(
|
|
5799
5865
|
(el) => Connection.isIncoming(el.id)
|
|
@@ -5801,7 +5867,7 @@ function incomingConnectionPredicate(model, expr) {
|
|
|
5801
5867
|
]);
|
|
5802
5868
|
}
|
|
5803
5869
|
case isExpandedElementExpr(expr): {
|
|
5804
|
-
return y$
|
|
5870
|
+
return y$2([
|
|
5805
5871
|
Connection.isIncoming(expr.expanded),
|
|
5806
5872
|
Connection.isInside(expr.expanded)
|
|
5807
5873
|
]);
|
|
@@ -5936,14 +6002,14 @@ function outgoingConnectionPredicate(model, expr) {
|
|
|
5936
6002
|
return (connection) => isElement(connection.source);
|
|
5937
6003
|
}
|
|
5938
6004
|
case (isElementRef(expr) && expr.isChildren): {
|
|
5939
|
-
return y$
|
|
6005
|
+
return y$2(
|
|
5940
6006
|
[...model.children(expr.element)].map(
|
|
5941
6007
|
(el) => Connection.isOutgoing(el.id)
|
|
5942
6008
|
)
|
|
5943
6009
|
);
|
|
5944
6010
|
}
|
|
5945
6011
|
case (isElementRef(expr) && expr.isDescendants): {
|
|
5946
|
-
return y$
|
|
6012
|
+
return y$2([
|
|
5947
6013
|
Connection.isInside(expr.element),
|
|
5948
6014
|
...[...model.children(expr.element)].map(
|
|
5949
6015
|
(el) => Connection.isOutgoing(el.id)
|
|
@@ -5951,7 +6017,7 @@ function outgoingConnectionPredicate(model, expr) {
|
|
|
5951
6017
|
]);
|
|
5952
6018
|
}
|
|
5953
6019
|
case isExpandedElementExpr(expr): {
|
|
5954
|
-
return y$
|
|
6020
|
+
return y$2([
|
|
5955
6021
|
Connection.isOutgoing(expr.expanded),
|
|
5956
6022
|
Connection.isInside(expr.expanded)
|
|
5957
6023
|
]);
|
|
@@ -6072,7 +6138,7 @@ function processRelationtPredicate(expr, op, ctx) {
|
|
|
6072
6138
|
return new Set(T([...relations], where));
|
|
6073
6139
|
};
|
|
6074
6140
|
const filterWhere = (connections) => {
|
|
6075
|
-
return
|
|
6141
|
+
return C(
|
|
6076
6142
|
connections,
|
|
6077
6143
|
m$3((c) => new ConnectionModel(c.source, c.target, filterRelations(c.relations))),
|
|
6078
6144
|
T((c) => c.nonEmpty())
|
|
@@ -6230,7 +6296,7 @@ function assignElementsToGroups(memory) {
|
|
|
6230
6296
|
}
|
|
6231
6297
|
return false;
|
|
6232
6298
|
};
|
|
6233
|
-
|
|
6299
|
+
C(
|
|
6234
6300
|
sortParentsFirst([...memory.explicitFirstSeenIn.keys()]),
|
|
6235
6301
|
u((el) => {
|
|
6236
6302
|
if (!isAncestorAssigned(el)) {
|
|
@@ -6240,7 +6306,7 @@ function assignElementsToGroups(memory) {
|
|
|
6240
6306
|
}
|
|
6241
6307
|
})
|
|
6242
6308
|
);
|
|
6243
|
-
|
|
6309
|
+
C(
|
|
6244
6310
|
sortParentsFirst([...memory.lastSeenIn.keys()]),
|
|
6245
6311
|
T((el) => !assignedTo.has(el)),
|
|
6246
6312
|
u((el) => {
|
|
@@ -7088,7 +7154,7 @@ class LikeC4Model {
|
|
|
7088
7154
|
}
|
|
7089
7155
|
}
|
|
7090
7156
|
this.deployment = new LikeC4DeploymentModel(this, $model.deployments);
|
|
7091
|
-
const views =
|
|
7157
|
+
const views = C(
|
|
7092
7158
|
r$3($model.views),
|
|
7093
7159
|
m$1((a, b) => compareNatural(a.title ?? "untitled", b.title ?? "untitled"))
|
|
7094
7160
|
);
|