@likec4/core 1.30.0 → 1.32.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/README.md +407 -5
- package/dist/builder/index.d.mts +221 -42
- package/dist/builder/index.mjs +118 -65
- package/dist/compute-view/index.d.mts +23 -7
- package/dist/compute-view/index.mjs +11 -6
- package/dist/compute-view/relationships-view/index.d.mts +9 -7
- package/dist/compute-view/relationships-view/index.mjs +3 -2
- package/dist/index.d.mts +10 -14
- package/dist/index.mjs +10 -6
- package/dist/model/index.d.mts +173 -19
- package/dist/model/index.mjs +6 -1
- package/dist/shared/core.BaYE_r29.d.mts +258 -0
- package/dist/shared/core.Bk7wEZFG.mjs +276 -0
- package/dist/shared/core.BrCnZFTn.mjs +32 -0
- package/dist/shared/core.BuO4ncfY.d.mts +146 -0
- package/dist/shared/{core.CAcZ6_cP.mjs → core.CBpKAlhj.mjs} +1742 -4128
- package/dist/shared/core.CCWXGc6G.d.mts +920 -0
- package/dist/shared/core.CUYDgv2-.mjs +214 -0
- package/dist/shared/{core.Cu-UdkSl.mjs → core.CpXlRyE5.mjs} +7 -494
- package/dist/shared/{core.C-YXI-43.mjs → core.Cy9smucx.mjs} +3 -1
- package/dist/shared/core.CywrQs86.d.mts +31 -0
- package/dist/shared/core.DoK86JEe.mjs +518 -0
- package/dist/shared/core.Dpq3P3YJ.d.mts +1265 -0
- package/dist/shared/{core.D2830qgg.d.mts → core.Pf5I9o0e.d.mts} +1 -1
- package/dist/shared/core.cbA9VZ02.mjs +2681 -0
- package/dist/shared/{core.CQXU9DF7.mjs → core.rmvsy0n3.mjs} +23 -32
- package/dist/types/aux.d.mts +3 -0
- package/dist/types/aux.mjs +1 -0
- package/dist/types/index.d.mts +7 -45
- package/dist/types/index.mjs +130 -3
- package/dist/utils/index.d.mts +221 -53
- package/dist/utils/index.mjs +14 -10
- package/package.json +19 -10
- package/src/builder/Builder.deploymentModel.ts +82 -18
- package/src/builder/Builder.element.ts +40 -20
- package/src/builder/Builder.model.ts +66 -17
- package/src/builder/Builder.ts +168 -76
- package/src/builder/Builder.view-common.ts +35 -17
- package/src/builder/Builder.view-deployment.ts +25 -25
- package/src/builder/Builder.view-element.ts +13 -12
- package/src/builder/Builder.views.ts +12 -7
- package/src/builder/__snapshots__/Builder-style1.spec.ts.snap +62 -34
- package/src/builder/__snapshots__/Builder-style2.compute-model.json5 +319 -0
- package/src/builder/__snapshots__/Builder-style2.spec.ts.snap +45 -24
- package/src/builder/_types.ts +34 -27
- package/src/compute-view/compute-view.ts +31 -34
- package/src/compute-view/deployment-view/__test__/TestHelper.ts +27 -14
- package/src/compute-view/deployment-view/__test__/fixture.ts +15 -13
- package/src/compute-view/deployment-view/_types.ts +10 -10
- package/src/compute-view/deployment-view/clean-connections.ts +5 -7
- package/src/compute-view/deployment-view/compute.ts +16 -13
- package/src/compute-view/deployment-view/memory/memory.ts +5 -6
- package/src/compute-view/deployment-view/predicates/deploymentRefs.ts +4 -5
- package/src/compute-view/deployment-view/predicates/relation-direct.ts +25 -50
- package/src/compute-view/deployment-view/predicates/relation-in-out.ts +5 -7
- package/src/compute-view/deployment-view/predicates/relation-incoming.ts +7 -11
- package/src/compute-view/deployment-view/predicates/relation-outgoing.ts +7 -10
- package/src/compute-view/deployment-view/predicates/utils.ts +37 -31
- package/src/compute-view/deployment-view/predicates/wildcard.ts +3 -2
- package/src/compute-view/deployment-view/stages/stage-final.ts +2 -2
- package/src/compute-view/deployment-view/stages/stage-include.ts +1 -1
- package/src/compute-view/deployment-view/utils.ts +79 -72
- package/src/compute-view/dynamic-view/__test__/fixture.ts +20 -11
- package/src/compute-view/dynamic-view/compute.ts +60 -53
- package/src/compute-view/element-view/__test__/TestHelper.ts +53 -29
- package/src/compute-view/element-view/__test__/__snapshots__/legacy.spec.ts.snap +26 -26
- package/src/compute-view/element-view/__test__/fixture.ts +134 -83
- package/src/compute-view/element-view/_types.ts +14 -19
- package/src/compute-view/element-view/clean-connections.ts +12 -8
- package/src/compute-view/element-view/compute.ts +61 -51
- package/src/compute-view/element-view/memory/NodeGroup.ts +8 -9
- package/src/compute-view/element-view/memory/memory.ts +22 -22
- package/src/compute-view/element-view/memory/stage-include.ts +5 -3
- package/src/compute-view/element-view/predicates/_utils.ts +18 -14
- package/src/compute-view/element-view/predicates/element-expand.ts +4 -5
- package/src/compute-view/element-view/predicates/element-kind-tag.ts +3 -4
- package/src/compute-view/element-view/predicates/element-ref.ts +3 -4
- package/src/compute-view/element-view/predicates/relation-direct.ts +16 -12
- package/src/compute-view/element-view/predicates/relation-in-out.ts +7 -8
- package/src/compute-view/element-view/predicates/relation-in.ts +19 -26
- package/src/compute-view/element-view/predicates/relation-out.ts +20 -21
- package/src/compute-view/element-view/predicates/wildcard.ts +3 -3
- package/src/compute-view/element-view/utils.ts +25 -23
- package/src/compute-view/index.ts +1 -1
- package/src/compute-view/memory/AbstractStageExclude.ts +3 -4
- package/src/compute-view/memory/AbstractStageInclude.ts +1 -1
- package/src/compute-view/memory/_types.ts +3 -2
- package/src/compute-view/relationships-view/_types.ts +3 -4
- package/src/compute-view/relationships-view/compute.ts +8 -11
- package/src/compute-view/relationships-view/layout.ts +6 -6
- package/src/compute-view/relationships-view/utils.ts +4 -4
- package/src/compute-view/utils/ancestorsOfNode.ts +7 -7
- package/src/compute-view/utils/applyCustomElementProperties.ts +16 -8
- package/src/compute-view/utils/applyCustomRelationProperties.ts +19 -9
- package/src/compute-view/utils/applyViewRuleStyles.ts +18 -10
- package/src/compute-view/utils/buildComputedNodes.ts +40 -40
- package/src/compute-view/utils/buildElementNotations.ts +14 -14
- package/src/compute-view/utils/elementExpressionToPredicate.ts +14 -15
- package/src/compute-view/utils/link-nodes-with-edges.ts +6 -4
- package/src/compute-view/utils/merge-props-from-relationships.ts +52 -20
- package/src/compute-view/utils/relationExpressionToPredicates.ts +19 -19
- package/src/compute-view/utils/resolve-extended-views.ts +8 -7
- package/src/compute-view/utils/resolve-global-rules.ts +31 -26
- package/src/compute-view/utils/topological-sort.ts +14 -14
- package/src/compute-view/utils/view-hash.ts +2 -2
- package/src/compute-view/utils/with-readable-edges.ts +9 -5
- package/src/index.ts +0 -32
- package/src/model/DeploymentElementModel.ts +182 -137
- package/src/model/DeploymentModel.ts +88 -65
- package/src/model/ElementModel.ts +92 -72
- package/src/model/LikeC4Model.ts +430 -241
- package/src/model/RelationModel.ts +69 -26
- package/src/model/__test__/fixture.ts +50 -36
- package/src/model/connection/Connection.ts +2 -2
- package/src/model/connection/deployment/DeploymentConnectionModel.ts +21 -24
- package/src/model/connection/deployment/find.ts +1 -1
- package/src/model/connection/model/ConnectionModel.ts +21 -20
- package/src/model/connection/model/find.ts +7 -7
- package/src/model/connection/ops.ts +6 -6
- package/src/model/guards.ts +66 -14
- package/src/model/index.ts +20 -7
- package/src/model/types.ts +41 -97
- package/src/model/view/EdgeModel.ts +47 -41
- package/src/model/view/LikeC4ViewModel.ts +130 -80
- package/src/model/view/NodeModel.ts +102 -96
- package/src/theme/element.ts +1 -1
- package/src/theme/index.ts +9 -9
- package/src/theme/relationships.ts +1 -1
- package/src/types/_common.ts +21 -15
- package/src/types/aux.ts +285 -0
- package/src/types/const.ts +34 -0
- package/src/types/expression-model.ts +292 -0
- package/src/types/expression.ts +311 -0
- package/src/types/fqnRef.ts +88 -0
- package/src/types/geometry.ts +131 -0
- package/src/types/global.ts +10 -8
- package/src/types/index.ts +39 -201
- package/src/types/model-data.ts +52 -84
- package/src/types/model-deployment.ts +87 -0
- package/src/types/model-dump.ts +72 -0
- package/src/types/model-logical.ts +111 -0
- package/src/types/model-spec.ts +81 -0
- package/src/types/operators.ts +51 -52
- package/src/types/scalar.ts +114 -0
- package/src/types/styles.ts +123 -0
- package/src/types/view-changes.ts +4 -5
- package/src/types/view-common.ts +157 -0
- package/src/types/view-computed.ts +113 -0
- package/src/types/view-layouted.ts +82 -0
- package/src/types/view-parsed.deployment.ts +40 -0
- package/src/types/view-parsed.dynamic.ts +78 -0
- package/src/types/view-parsed.element.ts +65 -0
- package/src/types/view.ts +122 -542
- package/src/utils/compare-natural.ts +43 -1
- package/src/utils/getOrCreate.ts +0 -34
- package/src/utils/index.ts +7 -12
- package/src/utils/iterable/filter.ts +1 -1
- package/src/utils/iterable/find.ts +3 -1
- package/src/utils/iterable/head.ts +22 -0
- package/src/utils/iterable/index.ts +1 -0
- package/src/utils/iterable/map.ts +1 -1
- package/src/utils/iterable/reduce.ts +1 -1
- package/src/utils/iterable/some.ts +1 -1
- package/src/utils/memoize-prop.ts +30 -0
- package/src/utils/object-hash.ts +1 -1
- package/src/utils/relations.ts +14 -11
- package/src/utils/string-hash.ts +1 -1
- package/dist/shared/core.CZR9J1Qx.d.mts +0 -146
- package/dist/shared/core.CiFKryGW.d.mts +0 -745
- package/dist/shared/core.DJvmfnEi.d.mts +0 -1153
- package/dist/shared/core.DgfwjBtu.mjs +0 -495
- package/dist/shared/core.SjLhMA7a.d.mts +0 -62
- package/src/builder/__snapshots__/Builder.spec.ts.snap +0 -374
- package/src/compute-view/element-view/predicates.ts +0 -520
- package/src/compute-view/utils/uniqueTags.ts +0 -21
- package/src/types/deployments.ts +0 -170
- package/src/types/element.ts +0 -109
- package/src/types/expression-v2-model.ts +0 -314
- package/src/types/expression-v2.ts +0 -392
- package/src/types/overview-graph.ts +0 -43
- package/src/types/relation.ts +0 -61
- package/src/types/scalars.ts +0 -39
- package/src/types/theme.ts +0 -82
- package/src/types/view-notation.ts +0 -9
- package/src/utils/graphlib.ts +0 -10
- /package/src/{errors/index.ts → utils/invariant.ts} +0 -0
|
@@ -1,495 +0,0 @@
|
|
|
1
|
-
import { i as invariant, a as nonexhaustive } from './core.C-YXI-43.mjs';
|
|
2
|
-
import { u } from './core.DbRvwARP.mjs';
|
|
3
|
-
|
|
4
|
-
function n$1(e){return !!e}
|
|
5
|
-
|
|
6
|
-
function o$1(a){return t=>!a(t)}
|
|
7
|
-
|
|
8
|
-
function n(e){return e==null}
|
|
9
|
-
|
|
10
|
-
function o(r){return Array.isArray(r)}
|
|
11
|
-
|
|
12
|
-
function t(...a){return u(e,a)}var e=(a,o)=>o.every(l=>l(a));
|
|
13
|
-
|
|
14
|
-
function y(...a){return u(r,a)}var r=(a,o)=>o.some(e=>e(a));
|
|
15
|
-
|
|
16
|
-
const BorderStyles = ["solid", "dashed", "dotted", "none"];
|
|
17
|
-
var ElementKind;
|
|
18
|
-
((ElementKind2) => {
|
|
19
|
-
ElementKind2.Group = "@group";
|
|
20
|
-
})(ElementKind || (ElementKind = {}));
|
|
21
|
-
const ElementShapes = [
|
|
22
|
-
"rectangle",
|
|
23
|
-
"person",
|
|
24
|
-
"browser",
|
|
25
|
-
"mobile",
|
|
26
|
-
"cylinder",
|
|
27
|
-
"storage",
|
|
28
|
-
"queue"
|
|
29
|
-
];
|
|
30
|
-
const DefaultThemeColor = "primary";
|
|
31
|
-
const DefaultElementShape = "rectangle";
|
|
32
|
-
const DefaultShapeSize = "md";
|
|
33
|
-
const DefaultPaddingSize = "md";
|
|
34
|
-
const DefaultTextSize = "md";
|
|
35
|
-
|
|
36
|
-
function AsFqn(name, parent) {
|
|
37
|
-
return parent ? parent + "." + name : name;
|
|
38
|
-
}
|
|
39
|
-
function GlobalFqn(projectId, name) {
|
|
40
|
-
invariant(n$1(projectId), "Project ID must start with @");
|
|
41
|
-
return "@" + projectId + "." + name;
|
|
42
|
-
}
|
|
43
|
-
function isGlobalFqn(fqn) {
|
|
44
|
-
return fqn.startsWith("@");
|
|
45
|
-
}
|
|
46
|
-
function splitGlobalFqn(fqn) {
|
|
47
|
-
if (!fqn.startsWith("@")) {
|
|
48
|
-
return [null, fqn];
|
|
49
|
-
}
|
|
50
|
-
const firstDot = fqn.indexOf(".");
|
|
51
|
-
if (firstDot < 2) {
|
|
52
|
-
throw new Error("Invalid global FQN");
|
|
53
|
-
}
|
|
54
|
-
const projectId = fqn.slice(1, firstDot);
|
|
55
|
-
const name = fqn.slice(firstDot + 1);
|
|
56
|
-
return [projectId, name];
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
var DeploymentElement;
|
|
60
|
-
((DeploymentElement2) => {
|
|
61
|
-
DeploymentElement2.isDeploymentNode = (el) => {
|
|
62
|
-
return "kind" in el && !("element" in el);
|
|
63
|
-
};
|
|
64
|
-
DeploymentElement2.isInstance = (el) => {
|
|
65
|
-
return "element" in el && !("kind" in el);
|
|
66
|
-
};
|
|
67
|
-
})(DeploymentElement || (DeploymentElement = {}));
|
|
68
|
-
|
|
69
|
-
var FqnRef;
|
|
70
|
-
((FqnRef2) => {
|
|
71
|
-
FqnRef2.isInsideInstanceRef = (ref) => {
|
|
72
|
-
return "deployment" in ref && "element" in ref;
|
|
73
|
-
};
|
|
74
|
-
FqnRef2.isDeploymentElementRef = (ref) => {
|
|
75
|
-
return "deployment" in ref && !("element" in ref);
|
|
76
|
-
};
|
|
77
|
-
FqnRef2.isDeploymentRef = (ref) => {
|
|
78
|
-
return !(0, FqnRef2.isModelRef)(ref) && !(0, FqnRef2.isImportRef)(ref);
|
|
79
|
-
};
|
|
80
|
-
FqnRef2.isModelRef = (ref) => {
|
|
81
|
-
return "model" in ref && !("project" in ref);
|
|
82
|
-
};
|
|
83
|
-
FqnRef2.isImportRef = (ref) => {
|
|
84
|
-
return "project" in ref && "model" in ref;
|
|
85
|
-
};
|
|
86
|
-
FqnRef2.toDeploymentRef = (ref) => {
|
|
87
|
-
invariant((0, FqnRef2.isDeploymentRef)(ref), "Expected DeploymentRef");
|
|
88
|
-
return (0, FqnRef2.isInsideInstanceRef)(ref) ? {
|
|
89
|
-
id: ref.deployment,
|
|
90
|
-
element: ref.element
|
|
91
|
-
} : {
|
|
92
|
-
id: ref.deployment
|
|
93
|
-
};
|
|
94
|
-
};
|
|
95
|
-
FqnRef2.toModelFqn = (ref) => {
|
|
96
|
-
if ((0, FqnRef2.isImportRef)(ref)) {
|
|
97
|
-
return GlobalFqn(ref.project, ref.model);
|
|
98
|
-
}
|
|
99
|
-
if ((0, FqnRef2.isModelRef)(ref)) {
|
|
100
|
-
return ref.model;
|
|
101
|
-
}
|
|
102
|
-
throw new Error("Expected FqnRef.ModelRef or FqnRef.ImportRef");
|
|
103
|
-
};
|
|
104
|
-
})(FqnRef || (FqnRef = {}));
|
|
105
|
-
var FqnExpr;
|
|
106
|
-
((FqnExpr2) => {
|
|
107
|
-
FqnExpr2.isWildcard = (expr) => {
|
|
108
|
-
return "wildcard" in expr && expr.wildcard === true;
|
|
109
|
-
};
|
|
110
|
-
FqnExpr2.isModelRef = (ref) => {
|
|
111
|
-
return "ref" in ref && (FqnRef.isModelRef(ref.ref) || FqnRef.isImportRef(ref.ref));
|
|
112
|
-
};
|
|
113
|
-
FqnExpr2.isDeploymentRef = (ref) => {
|
|
114
|
-
return "ref" in ref && FqnRef.isDeploymentRef(ref.ref);
|
|
115
|
-
};
|
|
116
|
-
function isElementKindExpr(expr) {
|
|
117
|
-
return "elementKind" in expr && "isEqual" in expr;
|
|
118
|
-
}
|
|
119
|
-
FqnExpr2.isElementKindExpr = isElementKindExpr;
|
|
120
|
-
function isElementTagExpr(expr) {
|
|
121
|
-
return "elementTag" in expr && "isEqual" in expr;
|
|
122
|
-
}
|
|
123
|
-
FqnExpr2.isElementTagExpr = isElementTagExpr;
|
|
124
|
-
FqnExpr2.isWhere = (expr) => {
|
|
125
|
-
return "where" in expr && (0, FqnExpr2.is)(expr.where.expr);
|
|
126
|
-
};
|
|
127
|
-
FqnExpr2.isCustom = (expr) => {
|
|
128
|
-
return "custom" in expr && ((0, FqnExpr2.is)(expr.custom.expr) || (0, FqnExpr2.isWhere)(expr.custom.expr));
|
|
129
|
-
};
|
|
130
|
-
FqnExpr2.is = (expr) => {
|
|
131
|
-
return (0, FqnExpr2.isWildcard)(expr) || (0, FqnExpr2.isModelRef)(expr) || (0, FqnExpr2.isDeploymentRef)(expr) || isElementKindExpr(expr) || isElementTagExpr(expr);
|
|
132
|
-
};
|
|
133
|
-
FqnExpr2.unwrap = (expr) => {
|
|
134
|
-
if ((0, FqnExpr2.isCustom)(expr)) {
|
|
135
|
-
expr = expr.custom.expr;
|
|
136
|
-
}
|
|
137
|
-
if ((0, FqnExpr2.isWhere)(expr)) {
|
|
138
|
-
expr = expr.where.expr;
|
|
139
|
-
}
|
|
140
|
-
return expr;
|
|
141
|
-
};
|
|
142
|
-
})(FqnExpr || (FqnExpr = {}));
|
|
143
|
-
var RelationExpr;
|
|
144
|
-
((RelationExpr2) => {
|
|
145
|
-
RelationExpr2.isDirect = (expr) => {
|
|
146
|
-
return "source" in expr && "target" in expr;
|
|
147
|
-
};
|
|
148
|
-
RelationExpr2.isIncoming = (expr) => {
|
|
149
|
-
return "incoming" in expr;
|
|
150
|
-
};
|
|
151
|
-
RelationExpr2.isOutgoing = (expr) => {
|
|
152
|
-
return "outgoing" in expr;
|
|
153
|
-
};
|
|
154
|
-
RelationExpr2.isInOut = (expr) => {
|
|
155
|
-
return "inout" in expr;
|
|
156
|
-
};
|
|
157
|
-
RelationExpr2.isWhere = (expr) => {
|
|
158
|
-
return "where" in expr && ((0, RelationExpr2.isDirect)(expr.where.expr) || (0, RelationExpr2.isIncoming)(expr.where.expr) || (0, RelationExpr2.isOutgoing)(expr.where.expr) || (0, RelationExpr2.isInOut)(expr.where.expr));
|
|
159
|
-
};
|
|
160
|
-
RelationExpr2.isCustom = (expr) => {
|
|
161
|
-
return "customRelation" in expr;
|
|
162
|
-
};
|
|
163
|
-
RelationExpr2.is = (expr) => {
|
|
164
|
-
return (0, RelationExpr2.isDirect)(expr) || (0, RelationExpr2.isIncoming)(expr) || (0, RelationExpr2.isOutgoing)(expr) || (0, RelationExpr2.isInOut)(expr);
|
|
165
|
-
};
|
|
166
|
-
RelationExpr2.unwrap = (expr) => {
|
|
167
|
-
if ((0, RelationExpr2.isCustom)(expr)) {
|
|
168
|
-
expr = expr.customRelation.expr;
|
|
169
|
-
}
|
|
170
|
-
if ((0, RelationExpr2.isWhere)(expr)) {
|
|
171
|
-
expr = expr.where.expr;
|
|
172
|
-
}
|
|
173
|
-
return expr;
|
|
174
|
-
};
|
|
175
|
-
})(RelationExpr || (RelationExpr = {}));
|
|
176
|
-
var ExpressionV2;
|
|
177
|
-
((ExpressionV22) => {
|
|
178
|
-
ExpressionV22.isWhere = (expr) => {
|
|
179
|
-
return "where" in expr;
|
|
180
|
-
};
|
|
181
|
-
ExpressionV22.isRelationWhere = (expr) => {
|
|
182
|
-
return RelationExpr.isWhere(expr);
|
|
183
|
-
};
|
|
184
|
-
ExpressionV22.isFqnExprWhere = (expr) => {
|
|
185
|
-
return FqnExpr.isWhere(expr);
|
|
186
|
-
};
|
|
187
|
-
ExpressionV22.isFqnExpr = (expr) => {
|
|
188
|
-
return FqnExpr.is(expr) || FqnExpr.isWhere(expr) || FqnExpr.isCustom(expr);
|
|
189
|
-
};
|
|
190
|
-
ExpressionV22.isRelation = (expr) => {
|
|
191
|
-
return RelationExpr.is(expr) || RelationExpr.isWhere(expr) || RelationExpr.isCustom(expr);
|
|
192
|
-
};
|
|
193
|
-
})(ExpressionV2 || (ExpressionV2 = {}));
|
|
194
|
-
|
|
195
|
-
var ModelLayer;
|
|
196
|
-
((ModelLayer2) => {
|
|
197
|
-
((FqnRef2) => {
|
|
198
|
-
FqnRef2.isModelRef = (ref) => {
|
|
199
|
-
return "model" in ref && !("project" in ref);
|
|
200
|
-
};
|
|
201
|
-
FqnRef2.isImportRef = (ref) => {
|
|
202
|
-
return "project" in ref && "model" in ref;
|
|
203
|
-
};
|
|
204
|
-
FqnRef2.toFqn = (ref) => {
|
|
205
|
-
if ((0, FqnRef2.isImportRef)(ref)) {
|
|
206
|
-
return GlobalFqn(ref.project, ref.model);
|
|
207
|
-
}
|
|
208
|
-
if ((0, FqnRef2.isModelRef)(ref)) {
|
|
209
|
-
return ref.model;
|
|
210
|
-
}
|
|
211
|
-
throw new Error("Expected FqnRef.ModelRef or FqnRef.ImportRef");
|
|
212
|
-
};
|
|
213
|
-
})(ModelLayer2.FqnRef || (ModelLayer2.FqnRef = {}));
|
|
214
|
-
let FqnExpr;
|
|
215
|
-
((FqnExpr2) => {
|
|
216
|
-
FqnExpr2.isWildcard = (expr) => {
|
|
217
|
-
return "wildcard" in expr && expr.wildcard === true;
|
|
218
|
-
};
|
|
219
|
-
FqnExpr2.isModelRef = (ref) => {
|
|
220
|
-
return "ref" in ref;
|
|
221
|
-
};
|
|
222
|
-
function isElementKindExpr(expr) {
|
|
223
|
-
return "elementKind" in expr && "isEqual" in expr;
|
|
224
|
-
}
|
|
225
|
-
FqnExpr2.isElementKindExpr = isElementKindExpr;
|
|
226
|
-
function isElementTagExpr(expr) {
|
|
227
|
-
return "elementTag" in expr && "isEqual" in expr;
|
|
228
|
-
}
|
|
229
|
-
FqnExpr2.isElementTagExpr = isElementTagExpr;
|
|
230
|
-
FqnExpr2.isWhere = (expr) => {
|
|
231
|
-
return "where" in expr && (0, FqnExpr2.is)(expr.where.expr);
|
|
232
|
-
};
|
|
233
|
-
FqnExpr2.isCustom = (expr) => {
|
|
234
|
-
return "custom" in expr && ((0, FqnExpr2.is)(expr.custom.expr) || (0, FqnExpr2.isWhere)(expr.custom.expr));
|
|
235
|
-
};
|
|
236
|
-
FqnExpr2.is = (expr) => {
|
|
237
|
-
return (0, FqnExpr2.isWildcard)(expr) || (0, FqnExpr2.isModelRef)(expr) || isElementKindExpr(expr) || isElementTagExpr(expr);
|
|
238
|
-
};
|
|
239
|
-
})(FqnExpr = ModelLayer2.FqnExpr || (ModelLayer2.FqnExpr = {}));
|
|
240
|
-
function isAnyFqnExpr(expr) {
|
|
241
|
-
return FqnExpr.is(expr) || FqnExpr.isWhere(expr) || FqnExpr.isCustom(expr);
|
|
242
|
-
}
|
|
243
|
-
ModelLayer2.isAnyFqnExpr = isAnyFqnExpr;
|
|
244
|
-
let RelationExpr;
|
|
245
|
-
((RelationExpr2) => {
|
|
246
|
-
RelationExpr2.isDirect = (expr) => {
|
|
247
|
-
return "source" in expr && "target" in expr;
|
|
248
|
-
};
|
|
249
|
-
RelationExpr2.isIncoming = (expr) => {
|
|
250
|
-
return "incoming" in expr;
|
|
251
|
-
};
|
|
252
|
-
RelationExpr2.isOutgoing = (expr) => {
|
|
253
|
-
return "outgoing" in expr;
|
|
254
|
-
};
|
|
255
|
-
RelationExpr2.isInOut = (expr) => {
|
|
256
|
-
return "inout" in expr;
|
|
257
|
-
};
|
|
258
|
-
RelationExpr2.isWhere = (expr) => {
|
|
259
|
-
return "where" in expr && (0, RelationExpr2.is)(expr.where.expr);
|
|
260
|
-
};
|
|
261
|
-
RelationExpr2.isCustom = (expr) => {
|
|
262
|
-
return "customRelation" in expr;
|
|
263
|
-
};
|
|
264
|
-
RelationExpr2.is = (expr) => {
|
|
265
|
-
return (0, RelationExpr2.isDirect)(expr) || (0, RelationExpr2.isIncoming)(expr) || (0, RelationExpr2.isOutgoing)(expr) || (0, RelationExpr2.isInOut)(expr);
|
|
266
|
-
};
|
|
267
|
-
})(RelationExpr = ModelLayer2.RelationExpr || (ModelLayer2.RelationExpr = {}));
|
|
268
|
-
function isAnyRelationExpr(expr) {
|
|
269
|
-
return RelationExpr.is(expr) || RelationExpr.isWhere(expr) || RelationExpr.isCustom(expr);
|
|
270
|
-
}
|
|
271
|
-
ModelLayer2.isAnyRelationExpr = isAnyRelationExpr;
|
|
272
|
-
function isExpression(expr) {
|
|
273
|
-
return isAnyFqnExpr(expr) || isAnyRelationExpr(expr);
|
|
274
|
-
}
|
|
275
|
-
ModelLayer2.isExpression = isExpression;
|
|
276
|
-
((Expression2) => {
|
|
277
|
-
Expression2.isWhere = (expr) => {
|
|
278
|
-
return "where" in expr;
|
|
279
|
-
};
|
|
280
|
-
Expression2.isCustomFqnExpr = (expr) => {
|
|
281
|
-
return FqnExpr.isCustom(expr);
|
|
282
|
-
};
|
|
283
|
-
Expression2.isCustomRelationExpr = (expr) => {
|
|
284
|
-
return RelationExpr.isCustom(expr);
|
|
285
|
-
};
|
|
286
|
-
Expression2.isFqnExpr = (expr) => {
|
|
287
|
-
return FqnExpr.is(expr);
|
|
288
|
-
};
|
|
289
|
-
Expression2.isRelation = (expr) => {
|
|
290
|
-
return RelationExpr.is(expr);
|
|
291
|
-
};
|
|
292
|
-
})(ModelLayer2.Expression || (ModelLayer2.Expression = {}));
|
|
293
|
-
})(ModelLayer || (ModelLayer = {}));
|
|
294
|
-
|
|
295
|
-
const isTagEqual = (operator) => {
|
|
296
|
-
return "tag" in operator;
|
|
297
|
-
};
|
|
298
|
-
const isKindEqual = (operator) => {
|
|
299
|
-
return "kind" in operator;
|
|
300
|
-
};
|
|
301
|
-
const isParticipantOperator = (operator) => {
|
|
302
|
-
return "participant" in operator;
|
|
303
|
-
};
|
|
304
|
-
const isNotOperator = (operator) => {
|
|
305
|
-
return "not" in operator;
|
|
306
|
-
};
|
|
307
|
-
const isAndOperator = (operator) => {
|
|
308
|
-
return "and" in operator;
|
|
309
|
-
};
|
|
310
|
-
const isOrOperator = (operator) => {
|
|
311
|
-
return "or" in operator;
|
|
312
|
-
};
|
|
313
|
-
function whereOperatorAsPredicate(operator) {
|
|
314
|
-
switch (true) {
|
|
315
|
-
case isParticipantOperator(operator): {
|
|
316
|
-
const participant = operator.participant;
|
|
317
|
-
const participantPredicate = whereOperatorAsPredicate(operator.operator);
|
|
318
|
-
return participantIs(participant, participantPredicate);
|
|
319
|
-
}
|
|
320
|
-
case isTagEqual(operator): {
|
|
321
|
-
if ("eq" in operator.tag) {
|
|
322
|
-
const tag2 = operator.tag.eq;
|
|
323
|
-
return (value) => {
|
|
324
|
-
return Array.isArray(value.tags) && value.tags.includes(tag2);
|
|
325
|
-
};
|
|
326
|
-
}
|
|
327
|
-
const tag = operator.tag.neq;
|
|
328
|
-
return (value) => {
|
|
329
|
-
return !Array.isArray(value.tags) || !value.tags.includes(tag);
|
|
330
|
-
};
|
|
331
|
-
}
|
|
332
|
-
case isKindEqual(operator): {
|
|
333
|
-
if ("eq" in operator.kind) {
|
|
334
|
-
const kind2 = operator.kind.eq;
|
|
335
|
-
return (value) => {
|
|
336
|
-
return value.kind === kind2;
|
|
337
|
-
};
|
|
338
|
-
}
|
|
339
|
-
const kind = operator.kind.neq;
|
|
340
|
-
return (value) => {
|
|
341
|
-
return n(value.kind) || value.kind !== kind;
|
|
342
|
-
};
|
|
343
|
-
}
|
|
344
|
-
case isNotOperator(operator): {
|
|
345
|
-
const predicate = whereOperatorAsPredicate(operator.not);
|
|
346
|
-
return o$1(predicate);
|
|
347
|
-
}
|
|
348
|
-
case isAndOperator(operator): {
|
|
349
|
-
const predicates = operator.and.map(whereOperatorAsPredicate);
|
|
350
|
-
return t(predicates);
|
|
351
|
-
}
|
|
352
|
-
case isOrOperator(operator): {
|
|
353
|
-
const predicates = operator.or.map(whereOperatorAsPredicate);
|
|
354
|
-
return y(predicates);
|
|
355
|
-
}
|
|
356
|
-
default:
|
|
357
|
-
nonexhaustive(operator);
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
function participantIs(participant, predicate) {
|
|
361
|
-
return (value) => {
|
|
362
|
-
if (!value.source || !value.target) {
|
|
363
|
-
return false;
|
|
364
|
-
}
|
|
365
|
-
switch (participant) {
|
|
366
|
-
case "source": {
|
|
367
|
-
return predicate(value.source);
|
|
368
|
-
}
|
|
369
|
-
case "target": {
|
|
370
|
-
return predicate(value.target);
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
};
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
const DefaultLineStyle = "dashed";
|
|
377
|
-
const DefaultArrowType = "normal";
|
|
378
|
-
const DefaultRelationshipColor = "gray";
|
|
379
|
-
|
|
380
|
-
function isViewRulePredicate(rule) {
|
|
381
|
-
return "include" in rule && Array.isArray(rule.include) || "exclude" in rule && Array.isArray(rule.exclude);
|
|
382
|
-
}
|
|
383
|
-
function isViewRuleGlobalPredicateRef(rule) {
|
|
384
|
-
return "predicateId" in rule;
|
|
385
|
-
}
|
|
386
|
-
function isViewRuleStyle(rule) {
|
|
387
|
-
return "style" in rule && "targets" in rule && Array.isArray(rule.targets);
|
|
388
|
-
}
|
|
389
|
-
function isViewRuleGlobalStyle(rule) {
|
|
390
|
-
return "styleId" in rule;
|
|
391
|
-
}
|
|
392
|
-
function isAutoLayoutDirection(autoLayout) {
|
|
393
|
-
return autoLayout === "TB" || autoLayout === "BT" || autoLayout === "LR" || autoLayout === "RL";
|
|
394
|
-
}
|
|
395
|
-
function isViewRuleAutoLayout(rule) {
|
|
396
|
-
return "direction" in rule;
|
|
397
|
-
}
|
|
398
|
-
function isViewRuleGroup(rule) {
|
|
399
|
-
return "title" in rule && "groupRules" in rule && Array.isArray(rule.groupRules);
|
|
400
|
-
}
|
|
401
|
-
function isDynamicViewParallelSteps(step) {
|
|
402
|
-
return "__parallel" in step && o(step.__parallel);
|
|
403
|
-
}
|
|
404
|
-
function isDeploymentView(view) {
|
|
405
|
-
return view.__ === "deployment";
|
|
406
|
-
}
|
|
407
|
-
function isDynamicView(view) {
|
|
408
|
-
return view.__ === "dynamic";
|
|
409
|
-
}
|
|
410
|
-
function isElementView(view) {
|
|
411
|
-
return n(view.__) || view.__ === "element";
|
|
412
|
-
}
|
|
413
|
-
function isExtendsElementView(view) {
|
|
414
|
-
return isElementView(view) && "extends" in view;
|
|
415
|
-
}
|
|
416
|
-
function isScopedElementView(view) {
|
|
417
|
-
return isElementView(view) && "viewOf" in view;
|
|
418
|
-
}
|
|
419
|
-
function stepEdgeId(step, parallelStep) {
|
|
420
|
-
const id = `step-${String(step).padStart(2, "0")}`;
|
|
421
|
-
return parallelStep ? `${id}.${parallelStep}` : id;
|
|
422
|
-
}
|
|
423
|
-
function isStepEdgeId(id) {
|
|
424
|
-
return id.startsWith("step-");
|
|
425
|
-
}
|
|
426
|
-
function extractStep(id) {
|
|
427
|
-
if (!isStepEdgeId(id)) {
|
|
428
|
-
throw new Error(`Invalid step edge id: ${id}`);
|
|
429
|
-
}
|
|
430
|
-
return parseFloat(id.slice("step-".length));
|
|
431
|
-
}
|
|
432
|
-
function getParallelStepsPrefix(id) {
|
|
433
|
-
if (isStepEdgeId(id) && id.includes(".")) {
|
|
434
|
-
return id.slice(0, id.indexOf(".") + 1);
|
|
435
|
-
}
|
|
436
|
-
return null;
|
|
437
|
-
}
|
|
438
|
-
var ComputedNode;
|
|
439
|
-
((ComputedNode2) => {
|
|
440
|
-
function modelRef(node) {
|
|
441
|
-
return node.modelRef === 1 ? node.id : node.modelRef ?? null;
|
|
442
|
-
}
|
|
443
|
-
ComputedNode2.modelRef = modelRef;
|
|
444
|
-
function deploymentRef(node) {
|
|
445
|
-
return node.deploymentRef === 1 ? node.id : node.deploymentRef ?? null;
|
|
446
|
-
}
|
|
447
|
-
ComputedNode2.deploymentRef = deploymentRef;
|
|
448
|
-
function isNodesGroup(node) {
|
|
449
|
-
return node.kind === ElementKind.Group;
|
|
450
|
-
}
|
|
451
|
-
ComputedNode2.isNodesGroup = isNodesGroup;
|
|
452
|
-
})(ComputedNode || (ComputedNode = {}));
|
|
453
|
-
var ComputedView;
|
|
454
|
-
((ComputedView2) => {
|
|
455
|
-
function isDeployment(view) {
|
|
456
|
-
return view.__ === "deployment";
|
|
457
|
-
}
|
|
458
|
-
ComputedView2.isDeployment = isDeployment;
|
|
459
|
-
function isDynamic(view) {
|
|
460
|
-
return view.__ === "dynamic";
|
|
461
|
-
}
|
|
462
|
-
ComputedView2.isDynamic = isDynamic;
|
|
463
|
-
function isElement(view) {
|
|
464
|
-
return n(view.__) || view.__ === "element";
|
|
465
|
-
}
|
|
466
|
-
ComputedView2.isElement = isElement;
|
|
467
|
-
})(ComputedView || (ComputedView = {}));
|
|
468
|
-
function getBBoxCenter({
|
|
469
|
-
x,
|
|
470
|
-
y,
|
|
471
|
-
width,
|
|
472
|
-
height
|
|
473
|
-
}) {
|
|
474
|
-
return {
|
|
475
|
-
x: x + width / 2,
|
|
476
|
-
y: y + height / 2
|
|
477
|
-
};
|
|
478
|
-
}
|
|
479
|
-
var DiagramNode;
|
|
480
|
-
((DiagramNode2) => {
|
|
481
|
-
function modelRef(node) {
|
|
482
|
-
return node.modelRef === 1 ? node.id : node.modelRef ?? null;
|
|
483
|
-
}
|
|
484
|
-
DiagramNode2.modelRef = modelRef;
|
|
485
|
-
function deploymentRef(node) {
|
|
486
|
-
return node.deploymentRef === 1 ? node.id : node.deploymentRef ?? null;
|
|
487
|
-
}
|
|
488
|
-
DiagramNode2.deploymentRef = deploymentRef;
|
|
489
|
-
function isNodesGroup(node) {
|
|
490
|
-
return node.kind === ElementKind.Group;
|
|
491
|
-
}
|
|
492
|
-
DiagramNode2.isNodesGroup = isNodesGroup;
|
|
493
|
-
})(DiagramNode || (DiagramNode = {}));
|
|
494
|
-
|
|
495
|
-
export { y as $, AsFqn as A, BorderStyles as B, ComputedNode as C, DefaultElementShape as D, ElementKind as E, FqnExpr as F, GlobalFqn as G, DiagramNode as H, extractStep as I, getBBoxCenter as J, getParallelStepsPrefix as K, isAutoLayoutDirection as L, ModelLayer as M, isDeploymentView as N, isDynamicView as O, isDynamicViewParallelSteps as P, isStepEdgeId as Q, RelationExpr as R, isViewRuleAutoLayout as S, isViewRuleGlobalPredicateRef as T, isViewRuleGlobalStyle as U, isViewRuleGroup as V, isViewRulePredicate as W, isViewRuleStyle as X, stepEdgeId as Y, n$1 as Z, o$1 as _, isElementView as a, DefaultThemeColor as b, DeploymentElement as c, isScopedElementView as d, isGlobalFqn as e, DefaultPaddingSize as f, DefaultShapeSize as g, DefaultTextSize as h, isExtendsElementView as i, ElementShapes as j, ExpressionV2 as k, FqnRef as l, isAndOperator as m, n, o, isKindEqual as p, isNotOperator as q, isOrOperator as r, splitGlobalFqn as s, isParticipantOperator as t, isTagEqual as u, DefaultArrowType as v, whereOperatorAsPredicate as w, DefaultLineStyle as x, DefaultRelationshipColor as y, ComputedView as z };
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { Simplify, UnionToIntersection, Tagged } from 'type-fest';
|
|
2
|
-
|
|
3
|
-
type NonEmptyArray<T> = [T, ...T[]];
|
|
4
|
-
type NonEmptyReadonlyArray<T> = readonly [T, ...T[]];
|
|
5
|
-
type CustomColor = string;
|
|
6
|
-
type Point = readonly [x: number, y: number];
|
|
7
|
-
interface XYPoint {
|
|
8
|
-
x: number;
|
|
9
|
-
y: number;
|
|
10
|
-
}
|
|
11
|
-
type KeysOf<T> = keyof T extends infer K extends string ? K : never;
|
|
12
|
-
type AllNever<Expressions> = UnionToIntersection<{
|
|
13
|
-
[Name in keyof Expressions]: {
|
|
14
|
-
-readonly [Key in keyof Expressions[Name]]?: never;
|
|
15
|
-
};
|
|
16
|
-
}[keyof Expressions]>;
|
|
17
|
-
/**
|
|
18
|
-
* @example
|
|
19
|
-
* type Variant1 = {
|
|
20
|
-
* a: string
|
|
21
|
-
* }
|
|
22
|
-
* type Variant2 = {
|
|
23
|
-
* b: number
|
|
24
|
-
* }
|
|
25
|
-
*
|
|
26
|
-
* type Variants = ExclusiveUnion<{
|
|
27
|
-
* Variant1: Variant1,
|
|
28
|
-
* Variant2: Variant2
|
|
29
|
-
* }>
|
|
30
|
-
*
|
|
31
|
-
* Fail here
|
|
32
|
-
* const variant1: Variants = {
|
|
33
|
-
* a: 'one',
|
|
34
|
-
* b: 1
|
|
35
|
-
* }
|
|
36
|
-
*/
|
|
37
|
-
type ExclusiveUnion<Expressions> = Expressions extends object ? {
|
|
38
|
-
[Name in keyof Expressions]: Simplify<Omit<AllNever<Expressions>, keyof Expressions[Name]> & Expressions[Name]>;
|
|
39
|
-
}[keyof Expressions] : Expressions;
|
|
40
|
-
/**
|
|
41
|
-
* Copy from https://github.com/remeda/remeda/blob/main/src/internal/types/NTuple.ts
|
|
42
|
-
* An array with *exactly* N elements in it.
|
|
43
|
-
*
|
|
44
|
-
* Only literal N values are supported. For very large N the type might result
|
|
45
|
-
* in a recurse depth error. For negative N the type would result in an infinite
|
|
46
|
-
* recursion. None of these have protections because this is an internal type!
|
|
47
|
-
*/
|
|
48
|
-
type NTuple<T, N extends number, Result extends Array<unknown> = []> = Result['length'] extends N ? Result : NTuple<T, N, [...Result, T]>;
|
|
49
|
-
type IteratorLike<T> = IteratorObject<T, BuiltinIteratorReturn>;
|
|
50
|
-
type Predicate<T> = (x: T) => boolean;
|
|
51
|
-
|
|
52
|
-
type ProjectId = Tagged<string, 'ProjectID'>;
|
|
53
|
-
type IconUrl = Tagged<string, 'IconUrl'> | 'none';
|
|
54
|
-
type Fqn<Id extends string = string> = Tagged<Id, 'Fqn'>;
|
|
55
|
-
type Tag<Tags extends string = string> = Tagged<Tags, 'Tag'>;
|
|
56
|
-
declare function AsFqn(name: string, parent?: Fqn | null): Fqn;
|
|
57
|
-
type GlobalFqn<Id extends string = string> = Tagged<Fqn<Id>, 'GlobalFqn'>;
|
|
58
|
-
declare function GlobalFqn(projectId: ProjectId, name: string): GlobalFqn;
|
|
59
|
-
declare function isGlobalFqn(fqn: string): fqn is GlobalFqn;
|
|
60
|
-
declare function splitGlobalFqn<Id extends string>(fqn: Fqn<Id> | GlobalFqn<Id>): [ProjectId | null, Fqn<Id>];
|
|
61
|
-
|
|
62
|
-
export { AsFqn as A, type CustomColor as C, type ExclusiveUnion as E, type Fqn as F, GlobalFqn as G, type IteratorLike as I, type KeysOf as K, type NonEmptyArray as N, type Point as P, type Tag as T, type XYPoint as X, type NonEmptyReadonlyArray as a, type NTuple as b, type Predicate as c, type IconUrl as d, type ProjectId as e, isGlobalFqn as i, splitGlobalFqn as s };
|