@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
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
import { F as FqnRef, c as n, d as isStepEdgeId } from './core.CUYDgv2-.mjs';
|
|
2
|
+
|
|
3
|
+
function o(r){return Array.isArray(r)}
|
|
4
|
+
|
|
5
|
+
var FqnExpr;
|
|
6
|
+
((FqnExpr2) => {
|
|
7
|
+
function isWildcard(expr) {
|
|
8
|
+
return "wildcard" in expr && expr.wildcard === true;
|
|
9
|
+
}
|
|
10
|
+
FqnExpr2.isWildcard = isWildcard;
|
|
11
|
+
function isModelRef(ref) {
|
|
12
|
+
return "ref" in ref && FqnRef.isModelRef(ref.ref);
|
|
13
|
+
}
|
|
14
|
+
FqnExpr2.isModelRef = isModelRef;
|
|
15
|
+
function isDeploymentRef(expr) {
|
|
16
|
+
return "ref" in expr && FqnRef.isDeploymentRef(expr.ref);
|
|
17
|
+
}
|
|
18
|
+
FqnExpr2.isDeploymentRef = isDeploymentRef;
|
|
19
|
+
function isElementKindExpr(expr) {
|
|
20
|
+
return "elementKind" in expr && "isEqual" in expr;
|
|
21
|
+
}
|
|
22
|
+
FqnExpr2.isElementKindExpr = isElementKindExpr;
|
|
23
|
+
function isElementTagExpr(expr) {
|
|
24
|
+
return "elementTag" in expr && "isEqual" in expr;
|
|
25
|
+
}
|
|
26
|
+
FqnExpr2.isElementTagExpr = isElementTagExpr;
|
|
27
|
+
function isWhere(expr) {
|
|
28
|
+
return "where" in expr && is(expr.where.expr);
|
|
29
|
+
}
|
|
30
|
+
FqnExpr2.isWhere = isWhere;
|
|
31
|
+
function isCustom(expr) {
|
|
32
|
+
return "custom" in expr && (is(expr.custom.expr) || isWhere(expr.custom.expr));
|
|
33
|
+
}
|
|
34
|
+
FqnExpr2.isCustom = isCustom;
|
|
35
|
+
function is(expr) {
|
|
36
|
+
return isWildcard(expr) || isModelRef(expr) || isDeploymentRef(expr) || isElementKindExpr(expr) || isElementTagExpr(expr);
|
|
37
|
+
}
|
|
38
|
+
FqnExpr2.is = is;
|
|
39
|
+
function unwrap(expr) {
|
|
40
|
+
if (isCustom(expr)) {
|
|
41
|
+
expr = expr.custom.expr;
|
|
42
|
+
}
|
|
43
|
+
if (isWhere(expr)) {
|
|
44
|
+
expr = expr.where.expr;
|
|
45
|
+
}
|
|
46
|
+
return expr;
|
|
47
|
+
}
|
|
48
|
+
FqnExpr2.unwrap = unwrap;
|
|
49
|
+
})(FqnExpr || (FqnExpr = {}));
|
|
50
|
+
var RelationExpr;
|
|
51
|
+
((RelationExpr2) => {
|
|
52
|
+
function isDirect(expr) {
|
|
53
|
+
return "source" in expr && "target" in expr;
|
|
54
|
+
}
|
|
55
|
+
RelationExpr2.isDirect = isDirect;
|
|
56
|
+
function isIncoming(expr) {
|
|
57
|
+
return "incoming" in expr;
|
|
58
|
+
}
|
|
59
|
+
RelationExpr2.isIncoming = isIncoming;
|
|
60
|
+
function isOutgoing(expr) {
|
|
61
|
+
return "outgoing" in expr;
|
|
62
|
+
}
|
|
63
|
+
RelationExpr2.isOutgoing = isOutgoing;
|
|
64
|
+
function isInOut(expr) {
|
|
65
|
+
return "inout" in expr;
|
|
66
|
+
}
|
|
67
|
+
RelationExpr2.isInOut = isInOut;
|
|
68
|
+
function isWhere(expr) {
|
|
69
|
+
return "where" in expr && (isDirect(expr.where.expr) || isIncoming(expr.where.expr) || isOutgoing(expr.where.expr) || isInOut(expr.where.expr));
|
|
70
|
+
}
|
|
71
|
+
RelationExpr2.isWhere = isWhere;
|
|
72
|
+
function isCustom(expr) {
|
|
73
|
+
return "customRelation" in expr;
|
|
74
|
+
}
|
|
75
|
+
RelationExpr2.isCustom = isCustom;
|
|
76
|
+
function is(expr) {
|
|
77
|
+
return isDirect(expr) || isIncoming(expr) || isOutgoing(expr) || isInOut(expr);
|
|
78
|
+
}
|
|
79
|
+
RelationExpr2.is = is;
|
|
80
|
+
function unwrap(expr) {
|
|
81
|
+
if (isCustom(expr)) {
|
|
82
|
+
expr = expr.customRelation.expr;
|
|
83
|
+
}
|
|
84
|
+
if (isWhere(expr)) {
|
|
85
|
+
expr = expr.where.expr;
|
|
86
|
+
}
|
|
87
|
+
return expr;
|
|
88
|
+
}
|
|
89
|
+
RelationExpr2.unwrap = unwrap;
|
|
90
|
+
})(RelationExpr || (RelationExpr = {}));
|
|
91
|
+
var Expression;
|
|
92
|
+
((Expression2) => {
|
|
93
|
+
function isWhere(expr) {
|
|
94
|
+
return "where" in expr;
|
|
95
|
+
}
|
|
96
|
+
Expression2.isWhere = isWhere;
|
|
97
|
+
function isRelationWhere(expr) {
|
|
98
|
+
return RelationExpr.isWhere(expr);
|
|
99
|
+
}
|
|
100
|
+
Expression2.isRelationWhere = isRelationWhere;
|
|
101
|
+
function isFqnExprWhere(expr) {
|
|
102
|
+
return FqnExpr.isWhere(expr);
|
|
103
|
+
}
|
|
104
|
+
Expression2.isFqnExprWhere = isFqnExprWhere;
|
|
105
|
+
function isFqnExpr(expr) {
|
|
106
|
+
return FqnExpr.is(expr) || FqnExpr.isWhere(expr) || FqnExpr.isCustom(expr);
|
|
107
|
+
}
|
|
108
|
+
Expression2.isFqnExpr = isFqnExpr;
|
|
109
|
+
function isRelation(expr) {
|
|
110
|
+
return RelationExpr.is(expr) || RelationExpr.isWhere(expr) || RelationExpr.isCustom(expr);
|
|
111
|
+
}
|
|
112
|
+
Expression2.isRelation = isRelation;
|
|
113
|
+
})(Expression || (Expression = {}));
|
|
114
|
+
|
|
115
|
+
var ModelFqnExpr;
|
|
116
|
+
((ModelFqnExpr2) => {
|
|
117
|
+
function isWildcard(expr) {
|
|
118
|
+
return "wildcard" in expr && expr.wildcard === true;
|
|
119
|
+
}
|
|
120
|
+
ModelFqnExpr2.isWildcard = isWildcard;
|
|
121
|
+
function isModelRef(ref) {
|
|
122
|
+
return "ref" in ref && FqnRef.isModelRef(ref.ref);
|
|
123
|
+
}
|
|
124
|
+
ModelFqnExpr2.isModelRef = isModelRef;
|
|
125
|
+
function isElementKindExpr(expr) {
|
|
126
|
+
return "elementKind" in expr && "isEqual" in expr;
|
|
127
|
+
}
|
|
128
|
+
ModelFqnExpr2.isElementKindExpr = isElementKindExpr;
|
|
129
|
+
function isElementTagExpr(expr) {
|
|
130
|
+
return "elementTag" in expr && "isEqual" in expr;
|
|
131
|
+
}
|
|
132
|
+
ModelFqnExpr2.isElementTagExpr = isElementTagExpr;
|
|
133
|
+
function isWhere(expr) {
|
|
134
|
+
return "where" in expr && is(expr.where.expr);
|
|
135
|
+
}
|
|
136
|
+
ModelFqnExpr2.isWhere = isWhere;
|
|
137
|
+
function isCustom(expr) {
|
|
138
|
+
return "custom" in expr && (is(expr.custom.expr) || isWhere(expr.custom.expr));
|
|
139
|
+
}
|
|
140
|
+
ModelFqnExpr2.isCustom = isCustom;
|
|
141
|
+
function is(expr) {
|
|
142
|
+
return isWildcard(expr) || isModelRef(expr) || isElementKindExpr(expr) || isElementTagExpr(expr);
|
|
143
|
+
}
|
|
144
|
+
ModelFqnExpr2.is = is;
|
|
145
|
+
function unwrap(expr) {
|
|
146
|
+
if (isCustom(expr)) {
|
|
147
|
+
expr = expr.custom.expr;
|
|
148
|
+
}
|
|
149
|
+
if (isWhere(expr)) {
|
|
150
|
+
expr = expr.where.expr;
|
|
151
|
+
}
|
|
152
|
+
return expr;
|
|
153
|
+
}
|
|
154
|
+
ModelFqnExpr2.unwrap = unwrap;
|
|
155
|
+
})(ModelFqnExpr || (ModelFqnExpr = {}));
|
|
156
|
+
var ModelRelationExpr;
|
|
157
|
+
((ModelRelationExpr2) => {
|
|
158
|
+
function isDirect(expr) {
|
|
159
|
+
return "source" in expr && "target" in expr;
|
|
160
|
+
}
|
|
161
|
+
ModelRelationExpr2.isDirect = isDirect;
|
|
162
|
+
function isIncoming(expr) {
|
|
163
|
+
return "incoming" in expr;
|
|
164
|
+
}
|
|
165
|
+
ModelRelationExpr2.isIncoming = isIncoming;
|
|
166
|
+
function isOutgoing(expr) {
|
|
167
|
+
return "outgoing" in expr;
|
|
168
|
+
}
|
|
169
|
+
ModelRelationExpr2.isOutgoing = isOutgoing;
|
|
170
|
+
function isInOut(expr) {
|
|
171
|
+
return "inout" in expr;
|
|
172
|
+
}
|
|
173
|
+
ModelRelationExpr2.isInOut = isInOut;
|
|
174
|
+
function isWhere(expr) {
|
|
175
|
+
return "where" in expr && (isDirect(expr.where.expr) || isIncoming(expr.where.expr) || isOutgoing(expr.where.expr) || isInOut(expr.where.expr));
|
|
176
|
+
}
|
|
177
|
+
ModelRelationExpr2.isWhere = isWhere;
|
|
178
|
+
function isCustom(expr) {
|
|
179
|
+
return "customRelation" in expr;
|
|
180
|
+
}
|
|
181
|
+
ModelRelationExpr2.isCustom = isCustom;
|
|
182
|
+
function is(expr) {
|
|
183
|
+
return isDirect(expr) || isIncoming(expr) || isOutgoing(expr) || isInOut(expr);
|
|
184
|
+
}
|
|
185
|
+
ModelRelationExpr2.is = is;
|
|
186
|
+
function unwrap(expr) {
|
|
187
|
+
if (isCustom(expr)) {
|
|
188
|
+
expr = expr.customRelation.expr;
|
|
189
|
+
}
|
|
190
|
+
if (isWhere(expr)) {
|
|
191
|
+
expr = expr.where.expr;
|
|
192
|
+
}
|
|
193
|
+
return expr;
|
|
194
|
+
}
|
|
195
|
+
ModelRelationExpr2.unwrap = unwrap;
|
|
196
|
+
})(ModelRelationExpr || (ModelRelationExpr = {}));
|
|
197
|
+
var ModelExpression;
|
|
198
|
+
((ModelExpression2) => {
|
|
199
|
+
function isWhere(expr) {
|
|
200
|
+
return "where" in expr;
|
|
201
|
+
}
|
|
202
|
+
ModelExpression2.isWhere = isWhere;
|
|
203
|
+
function isRelationWhere(expr) {
|
|
204
|
+
return ModelRelationExpr.isWhere(expr);
|
|
205
|
+
}
|
|
206
|
+
ModelExpression2.isRelationWhere = isRelationWhere;
|
|
207
|
+
function isFqnExprWhere(expr) {
|
|
208
|
+
return ModelFqnExpr.isWhere(expr);
|
|
209
|
+
}
|
|
210
|
+
ModelExpression2.isFqnExprWhere = isFqnExprWhere;
|
|
211
|
+
function isFqnExpr(expr) {
|
|
212
|
+
return ModelFqnExpr.is(expr) || ModelFqnExpr.isWhere(expr) || ModelFqnExpr.isCustom(expr);
|
|
213
|
+
}
|
|
214
|
+
ModelExpression2.isFqnExpr = isFqnExpr;
|
|
215
|
+
function isRelationExpr(expr) {
|
|
216
|
+
return ModelRelationExpr.is(expr) || ModelRelationExpr.isWhere(expr) || ModelRelationExpr.isCustom(expr);
|
|
217
|
+
}
|
|
218
|
+
ModelExpression2.isRelationExpr = isRelationExpr;
|
|
219
|
+
})(ModelExpression || (ModelExpression = {}));
|
|
220
|
+
|
|
221
|
+
function isViewRulePredicate(rule) {
|
|
222
|
+
return "include" in rule || "exclude" in rule;
|
|
223
|
+
}
|
|
224
|
+
function isViewRuleStyle(rule) {
|
|
225
|
+
return "targets" in rule && "style" in rule;
|
|
226
|
+
}
|
|
227
|
+
function isComputedView(view) {
|
|
228
|
+
return view._stage === "computed";
|
|
229
|
+
}
|
|
230
|
+
function isDiagramView(view) {
|
|
231
|
+
return view._stage === "layouted";
|
|
232
|
+
}
|
|
233
|
+
function isElementView(view) {
|
|
234
|
+
return view._type === "element";
|
|
235
|
+
}
|
|
236
|
+
function isScopedElementView(view) {
|
|
237
|
+
return isElementView(view) && n(view.viewOf);
|
|
238
|
+
}
|
|
239
|
+
function isExtendsElementView(view) {
|
|
240
|
+
return isElementView(view) && n(view.extends);
|
|
241
|
+
}
|
|
242
|
+
function isDeploymentView(view) {
|
|
243
|
+
return view._type === "deployment";
|
|
244
|
+
}
|
|
245
|
+
function isDynamicView(view) {
|
|
246
|
+
return view._type === "dynamic";
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
function isViewRuleGlobalStyle(rule) {
|
|
250
|
+
return "styleId" in rule;
|
|
251
|
+
}
|
|
252
|
+
function isViewRuleGlobalPredicateRef(rule) {
|
|
253
|
+
return "predicateId" in rule;
|
|
254
|
+
}
|
|
255
|
+
function isAutoLayoutDirection(autoLayout) {
|
|
256
|
+
return autoLayout === "TB" || autoLayout === "BT" || autoLayout === "LR" || autoLayout === "RL";
|
|
257
|
+
}
|
|
258
|
+
function isViewRuleAutoLayout(rule) {
|
|
259
|
+
return "direction" in rule;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
function getParallelStepsPrefix(id) {
|
|
263
|
+
if (isStepEdgeId(id) && id.includes(".")) {
|
|
264
|
+
return id.slice(0, id.indexOf(".") + 1);
|
|
265
|
+
}
|
|
266
|
+
return null;
|
|
267
|
+
}
|
|
268
|
+
function isDynamicViewParallelSteps(step) {
|
|
269
|
+
return "__parallel" in step && o(step.__parallel);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
function isViewRuleGroup(rule) {
|
|
273
|
+
return "title" in rule && "groupRules" in rule && Array.isArray(rule.groupRules);
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
export { Expression as E, FqnExpr as F, ModelFqnExpr as M, RelationExpr as R, isElementView as a, isViewRuleStyle as b, isViewRulePredicate as c, isViewRuleAutoLayout as d, isViewRuleGroup as e, isViewRuleGlobalPredicateRef as f, isViewRuleGlobalStyle as g, isDynamicViewParallelSteps as h, isExtendsElementView as i, ModelRelationExpr as j, ModelExpression as k, isDynamicView as l, isDeploymentView as m, isComputedView as n, o, isDiagramView as p, isScopedElementView as q, isAutoLayoutDirection as r, getParallelStepsPrefix as s };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { t } from './core.rmvsy0n3.mjs';
|
|
2
|
+
import { i as invariant } from './core.Cy9smucx.mjs';
|
|
3
|
+
|
|
4
|
+
function imap(arg1, arg2) {
|
|
5
|
+
const mapper = arg2 ?? arg1;
|
|
6
|
+
invariant(t(mapper));
|
|
7
|
+
function* _map(iter) {
|
|
8
|
+
for (const value of iter) {
|
|
9
|
+
yield mapper(value);
|
|
10
|
+
}
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
if (!arg2) {
|
|
14
|
+
return _map;
|
|
15
|
+
}
|
|
16
|
+
return _map(arg1);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function toArray(iterable) {
|
|
20
|
+
if (iterable) {
|
|
21
|
+
return Array.from(iterable);
|
|
22
|
+
}
|
|
23
|
+
return (it) => Array.from(it);
|
|
24
|
+
}
|
|
25
|
+
function toSet(iterable) {
|
|
26
|
+
if (iterable) {
|
|
27
|
+
return new Set(iterable);
|
|
28
|
+
}
|
|
29
|
+
return (it) => new Set(it);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export { toArray as a, imap as i, toSet as t };
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { IsAny, UnionToIntersection, Simplify, Tagged } from 'type-fest';
|
|
2
|
+
|
|
3
|
+
type NonEmptyArray<T> = [T, ...T[]];
|
|
4
|
+
type NonEmptyReadonlyArray<T> = readonly [T, ...T[]];
|
|
5
|
+
type KeysOf<T> = keyof T extends infer K extends string ? K : never;
|
|
6
|
+
type AllNever<Expressions> = UnionToIntersection<{
|
|
7
|
+
[Name in keyof Expressions]: {
|
|
8
|
+
-readonly [Key in keyof Expressions[Name]]?: never;
|
|
9
|
+
};
|
|
10
|
+
}[keyof Expressions]>;
|
|
11
|
+
/**
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* type Variant1 = {
|
|
15
|
+
* a: string
|
|
16
|
+
* }
|
|
17
|
+
* type Variant2 = {
|
|
18
|
+
* b: number
|
|
19
|
+
* }
|
|
20
|
+
*
|
|
21
|
+
* type Variants = ExclusiveUnion<{
|
|
22
|
+
* Variant1: Variant1,
|
|
23
|
+
* Variant2: Variant2
|
|
24
|
+
* }>
|
|
25
|
+
*
|
|
26
|
+
* // Fail here
|
|
27
|
+
* const variant1: Variants = {
|
|
28
|
+
* a: 'one',
|
|
29
|
+
* b: 1
|
|
30
|
+
* }
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
type ExclusiveUnion<Expressions, All = AllNever<Expressions>> = Expressions extends object ? {
|
|
34
|
+
[Name in keyof Expressions]: Simplify<Omit<All, keyof Expressions[Name]> & Expressions[Name]>;
|
|
35
|
+
}[keyof Expressions] : never;
|
|
36
|
+
/**
|
|
37
|
+
* Copy from https://github.com/remeda/remeda/blob/main/src/internal/types/NTuple.ts
|
|
38
|
+
* An array with *exactly* N elements in it.
|
|
39
|
+
*
|
|
40
|
+
* Only literal N values are supported. For very large N the type might result
|
|
41
|
+
* in a recurse depth error. For negative N the type would result in an infinite
|
|
42
|
+
* recursion. None of these have protections because this is an internal type!
|
|
43
|
+
*/
|
|
44
|
+
type NTuple<T, N extends number, Result extends Array<unknown> = []> = Result['length'] extends N ? Result : NTuple<T, N, [...Result, T]>;
|
|
45
|
+
type IteratorLike<T> = IteratorObject<T, BuiltinIteratorReturn>;
|
|
46
|
+
type Predicate<T> = (x: T) => boolean;
|
|
47
|
+
interface Link {
|
|
48
|
+
title?: string;
|
|
49
|
+
url: string;
|
|
50
|
+
relative?: string;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Coalesce `V` to a string if it is `any`
|
|
54
|
+
*/
|
|
55
|
+
type Coalesce<V extends string, OrIfAny = string> = IsAny<V> extends true ? OrIfAny : V;
|
|
56
|
+
|
|
57
|
+
type ProjectId<T = string> = Tagged<T, 'ProjectID'>;
|
|
58
|
+
type BuiltInIcon = 'none' | `${'aws' | 'azure' | 'gcp' | 'tech'}:${string}`;
|
|
59
|
+
type Icon = Tagged<string, 'Icon'> | BuiltInIcon;
|
|
60
|
+
type IconUrl = Icon;
|
|
61
|
+
/**
|
|
62
|
+
* Full-qualified-name for model elements
|
|
63
|
+
*
|
|
64
|
+
* @param This - Fqn of the element (specific element)
|
|
65
|
+
* @param All - The type of all known FQNs
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```ts
|
|
69
|
+
* type ElementAFqn = Fqn<'a', 'a' | ' | 'b'>
|
|
70
|
+
*
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
73
|
+
type Fqn<Id = string> = Tagged<Id, 'Fqn'>;
|
|
74
|
+
declare function Fqn(name: string, parent?: Fqn | null): Fqn;
|
|
75
|
+
type ElementKind<Kinds = string> = Tagged<Kinds, 'ElementKind'>;
|
|
76
|
+
declare const GroupElementKind: ElementKind<"@group">;
|
|
77
|
+
type GroupElementKind = typeof GroupElementKind;
|
|
78
|
+
declare function isGroupElementKind<V extends {
|
|
79
|
+
kind?: any;
|
|
80
|
+
}>(v: V): v is V & {
|
|
81
|
+
kind: GroupElementKind;
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* Full-qualified-name for deployment elements
|
|
85
|
+
*/
|
|
86
|
+
type DeploymentFqn<T = string> = Tagged<T, 'DeploymentFqn'>;
|
|
87
|
+
declare function DeploymentFqn(name: string, parent?: DeploymentFqn | null): DeploymentFqn;
|
|
88
|
+
type DeploymentKind<Kinds = string> = Tagged<Kinds, 'DeploymentKind'>;
|
|
89
|
+
type ViewId<Id = string> = Tagged<Id, 'ViewId'>;
|
|
90
|
+
declare function ViewId(id: string): ViewId;
|
|
91
|
+
type AnyFqn<T = string> = DeploymentFqn<T> | Fqn<T>;
|
|
92
|
+
/**
|
|
93
|
+
* @deprecated Use {@link RelationshipKind} instead
|
|
94
|
+
*/
|
|
95
|
+
type RelationKind<Kinds = string> = RelationshipKind<Kinds>;
|
|
96
|
+
type RelationshipKind<Kinds = string> = Tagged<Kinds, 'RelationshipKind'>;
|
|
97
|
+
type RelationId<Id = string> = Tagged<Id, 'RelationId'>;
|
|
98
|
+
declare function RelationId(id: string): RelationId;
|
|
99
|
+
type Tag<T = string> = Tagged<T, 'Tag'>;
|
|
100
|
+
type GlobalFqn<Id = string> = Tagged<Fqn<Id>, 'GlobalFqn'>;
|
|
101
|
+
declare function GlobalFqn<A>(projectId: A | ProjectId<A>, name: string): GlobalFqn<A>;
|
|
102
|
+
declare function isGlobalFqn<A extends string>(fqn: A): fqn is GlobalFqn<A>;
|
|
103
|
+
declare function splitGlobalFqn<I extends string>(fqn: Fqn<I> | GlobalFqn<I>): [ProjectId | null, Fqn<I>];
|
|
104
|
+
type NodeId = Tagged<string, 'NodeId' | 'Fqn' | 'DeploymentFqn'>;
|
|
105
|
+
declare function NodeId(id: string): NodeId;
|
|
106
|
+
type EdgeId = Tagged<string, 'EdgeId'>;
|
|
107
|
+
declare function EdgeId(id: string): EdgeId;
|
|
108
|
+
type StepEdgeIdLiteral = `step-${number}` | `step-${number}.${number}`;
|
|
109
|
+
type StepEdgeId = Tagged<StepEdgeIdLiteral, 'EdgeId'>;
|
|
110
|
+
declare function stepEdgeId(step: number, parallelStep?: number): StepEdgeId;
|
|
111
|
+
declare const StepEdgeKind = "@step";
|
|
112
|
+
declare function isStepEdgeId(id: string): id is StepEdgeId;
|
|
113
|
+
declare function extractStep(id: EdgeId): number;
|
|
114
|
+
|
|
115
|
+
type scalar_AnyFqn<T = string> = AnyFqn<T>;
|
|
116
|
+
type scalar_BuiltInIcon = BuiltInIcon;
|
|
117
|
+
declare const scalar_DeploymentFqn: typeof DeploymentFqn;
|
|
118
|
+
type scalar_DeploymentKind<Kinds = string> = DeploymentKind<Kinds>;
|
|
119
|
+
declare const scalar_EdgeId: typeof EdgeId;
|
|
120
|
+
type scalar_ElementKind<Kinds = string> = ElementKind<Kinds>;
|
|
121
|
+
declare const scalar_Fqn: typeof Fqn;
|
|
122
|
+
declare const scalar_GlobalFqn: typeof GlobalFqn;
|
|
123
|
+
type scalar_GroupElementKind = GroupElementKind;
|
|
124
|
+
type scalar_Icon = Icon;
|
|
125
|
+
type scalar_IconUrl = IconUrl;
|
|
126
|
+
declare const scalar_NodeId: typeof NodeId;
|
|
127
|
+
type scalar_ProjectId<T = string> = ProjectId<T>;
|
|
128
|
+
declare const scalar_RelationId: typeof RelationId;
|
|
129
|
+
type scalar_RelationKind<Kinds = string> = RelationKind<Kinds>;
|
|
130
|
+
type scalar_RelationshipKind<Kinds = string> = RelationshipKind<Kinds>;
|
|
131
|
+
type scalar_StepEdgeId = StepEdgeId;
|
|
132
|
+
type scalar_StepEdgeIdLiteral = StepEdgeIdLiteral;
|
|
133
|
+
declare const scalar_StepEdgeKind: typeof StepEdgeKind;
|
|
134
|
+
type scalar_Tag<T = string> = Tag<T>;
|
|
135
|
+
declare const scalar_ViewId: typeof ViewId;
|
|
136
|
+
declare const scalar_extractStep: typeof extractStep;
|
|
137
|
+
declare const scalar_isGlobalFqn: typeof isGlobalFqn;
|
|
138
|
+
declare const scalar_isGroupElementKind: typeof isGroupElementKind;
|
|
139
|
+
declare const scalar_isStepEdgeId: typeof isStepEdgeId;
|
|
140
|
+
declare const scalar_splitGlobalFqn: typeof splitGlobalFqn;
|
|
141
|
+
declare const scalar_stepEdgeId: typeof stepEdgeId;
|
|
142
|
+
declare namespace scalar {
|
|
143
|
+
export { type scalar_AnyFqn as AnyFqn, type scalar_BuiltInIcon as BuiltInIcon, scalar_DeploymentFqn as DeploymentFqn, type scalar_DeploymentKind as DeploymentKind, scalar_EdgeId as EdgeId, type scalar_ElementKind as ElementKind, scalar_Fqn as Fqn, scalar_GlobalFqn as GlobalFqn, type scalar_GroupElementKind as GroupElementKind, type scalar_Icon as Icon, type scalar_IconUrl as IconUrl, scalar_NodeId as NodeId, type scalar_ProjectId as ProjectId, scalar_RelationId as RelationId, type scalar_RelationKind as RelationKind, type scalar_RelationshipKind as RelationshipKind, type scalar_StepEdgeId as StepEdgeId, type scalar_StepEdgeIdLiteral as StepEdgeIdLiteral, scalar_StepEdgeKind as StepEdgeKind, type scalar_Tag as Tag, scalar_ViewId as ViewId, scalar_extractStep as extractStep, scalar_isGlobalFqn as isGlobalFqn, scalar_isGroupElementKind as isGroupElementKind, scalar_isStepEdgeId as isStepEdgeId, scalar_splitGlobalFqn as splitGlobalFqn, scalar_stepEdgeId as stepEdgeId };
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export { type AnyFqn as A, type BuiltInIcon as B, type Coalesce as C, DeploymentFqn as D, EdgeId as E, Fqn as F, GroupElementKind as G, type IteratorLike as I, type KeysOf as K, type Link as L, NodeId as N, type ProjectId as P, RelationId as R, type StepEdgeIdLiteral as S, type Tag as T, ViewId as V, type ElementKind as a, type DeploymentKind as b, type RelationshipKind as c, type NonEmptyArray as d, type NonEmptyReadonlyArray as e, type ExclusiveUnion as f, type NTuple as g, type Predicate as h, type Icon as i, type IconUrl as j, isGroupElementKind as k, type RelationKind as l, GlobalFqn as m, isGlobalFqn as n, splitGlobalFqn as o, type StepEdgeId as p, stepEdgeId as q, StepEdgeKind as r, scalar as s, isStepEdgeId as t, extractStep as u };
|