@likec4/core 1.27.3 → 1.28.1
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.d.mts +6 -6
- package/dist/builder/index.mjs +23 -13
- package/dist/compute-view/index.d.mts +3 -3
- package/dist/compute-view/index.mjs +3 -3
- package/dist/compute-view/relationships-view/index.d.mts +3 -3
- package/dist/index.d.mts +6 -6
- package/dist/index.mjs +2 -2
- package/dist/model/index.d.mts +6 -6
- package/dist/model/index.mjs +1 -1
- package/dist/shared/{core.BpuZeqlX.d.mts → core.CZR9J1Qx.d.mts} +2 -2
- package/dist/shared/{core.Djro-kuQ.d.mts → core.CiFKryGW.d.mts} +7 -2
- package/dist/shared/{core.HKn0jlo_.d.mts → core.D2830qgg.d.mts} +1 -1
- package/dist/shared/{core.CFDwncxs.d.mts → core.DJvmfnEi.d.mts} +481 -186
- package/dist/shared/{core.BMep80lJ.mjs → core.DgfwjBtu.mjs} +198 -87
- package/dist/shared/core.SjLhMA7a.d.mts +62 -0
- package/dist/shared/{core.RjpTh3vE.mjs → core.w6BcP9z5.mjs} +263 -168
- package/dist/types/index.d.mts +4 -4
- package/dist/types/index.mjs +1 -1
- package/dist/utils/index.d.mts +2 -2
- package/package.json +7 -7
- package/src/builder/Builder.ts +1 -0
- package/src/builder/Builder.view-common.ts +10 -10
- package/src/builder/Builder.view-element.ts +26 -14
- package/src/builder/__snapshots__/Builder-style1.spec.ts.snap +23 -8
- package/src/builder/__snapshots__/Builder-style2.spec.ts.snap +9 -4
- package/src/compute-view/deployment-view/predicates/deploymentRefs-where.ts +18 -0
- package/src/compute-view/deployment-view/predicates/relation-direct.ts +6 -0
- package/src/compute-view/deployment-view/predicates/relation-in-out.ts +3 -0
- package/src/compute-view/deployment-view/predicates/relation-incoming.ts +3 -0
- package/src/compute-view/deployment-view/predicates/relation-outgoing.ts +3 -0
- package/src/compute-view/deployment-view/predicates/utils.ts +10 -3
- package/src/compute-view/deployment-view/utils.ts +7 -4
- package/src/compute-view/element-view/__test__/fixture.ts +72 -65
- package/src/compute-view/element-view/_types.ts +13 -9
- package/src/compute-view/element-view/compute.ts +27 -27
- package/src/compute-view/element-view/memory/NodeGroup.ts +4 -3
- package/src/compute-view/element-view/memory/memory.ts +3 -2
- package/src/compute-view/element-view/memory/stage-include.ts +2 -2
- package/src/compute-view/element-view/predicates/_utils.ts +25 -24
- package/src/compute-view/element-view/predicates/element-expand.ts +7 -10
- package/src/compute-view/element-view/predicates/element-kind-tag.ts +5 -3
- package/src/compute-view/element-view/predicates/element-ref.ts +7 -19
- package/src/compute-view/element-view/predicates/relation-direct.ts +15 -13
- package/src/compute-view/element-view/predicates/relation-in-out.ts +5 -6
- package/src/compute-view/element-view/predicates/relation-in.ts +36 -32
- package/src/compute-view/element-view/predicates/relation-out.ts +37 -33
- package/src/compute-view/element-view/predicates/wildcard.ts +2 -2
- package/src/compute-view/utils/applyCustomElementProperties.ts +9 -4
- package/src/compute-view/utils/applyCustomRelationProperties.ts +10 -7
- package/src/compute-view/utils/elementExpressionToPredicate.ts +27 -26
- package/src/compute-view/utils/link-nodes-with-edges.ts +1 -1
- package/src/compute-view/utils/relationExpressionToPredicates.ts +10 -17
- package/src/compute-view/utils/uniqueTags.ts +3 -3
- package/src/index.ts +0 -2
- package/src/model/ElementModel.ts +25 -6
- package/src/model/LikeC4Model.ts +47 -6
- package/src/model/RelationModel.ts +4 -2
- package/src/model/view/LikeC4ViewModel.ts +3 -2
- package/src/types/_common.ts +0 -4
- package/src/types/deployments.ts +3 -2
- package/src/types/element.ts +2 -10
- package/src/types/expression-v2-model.ts +314 -0
- package/src/types/expression-v2.ts +238 -30
- package/src/types/index.ts +15 -46
- package/src/types/model-data.ts +4 -1
- package/src/types/relation.ts +2 -1
- package/src/types/scalars.ts +39 -0
- package/src/types/view-changes.ts +2 -1
- package/src/types/view.ts +7 -8
- package/dist/shared/core.30yYKXcZ.d.mts +0 -186
- package/src/types/expression.ts +0 -207
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { i as invariant, a as nonexhaustive } from './core.C-YXI-43.mjs';
|
|
2
2
|
import { u } from './core.DbRvwARP.mjs';
|
|
3
3
|
|
|
4
|
+
function n$1(e){return !!e}
|
|
5
|
+
|
|
4
6
|
function o$1(a){return t=>!a(t)}
|
|
5
7
|
|
|
6
8
|
function n(e){return e==null}
|
|
@@ -11,19 +13,6 @@ function t(...a){return u(e,a)}var e=(a,o)=>o.every(l=>l(a));
|
|
|
11
13
|
|
|
12
14
|
function y(...a){return u(r,a)}var r=(a,o)=>o.some(e=>e(a));
|
|
13
15
|
|
|
14
|
-
var DeploymentElement;
|
|
15
|
-
((DeploymentElement2) => {
|
|
16
|
-
DeploymentElement2.isDeploymentNode = (el) => {
|
|
17
|
-
return "kind" in el && !("element" in el);
|
|
18
|
-
};
|
|
19
|
-
DeploymentElement2.isInstance = (el) => {
|
|
20
|
-
return "element" in el && !("kind" in el);
|
|
21
|
-
};
|
|
22
|
-
})(DeploymentElement || (DeploymentElement = {}));
|
|
23
|
-
|
|
24
|
-
function AsFqn(name, parent) {
|
|
25
|
-
return parent ? parent + "." + name : name;
|
|
26
|
-
}
|
|
27
16
|
const BorderStyles = ["solid", "dashed", "dotted", "none"];
|
|
28
17
|
var ElementKind;
|
|
29
18
|
((ElementKind2) => {
|
|
@@ -44,78 +33,38 @@ const DefaultShapeSize = "md";
|
|
|
44
33
|
const DefaultPaddingSize = "md";
|
|
45
34
|
const DefaultTextSize = "md";
|
|
46
35
|
|
|
47
|
-
function
|
|
48
|
-
return "
|
|
49
|
-
}
|
|
50
|
-
function isExpandedElementExpr(expr) {
|
|
51
|
-
return "expanded" in expr;
|
|
52
|
-
}
|
|
53
|
-
function isCustomElement(expr) {
|
|
54
|
-
return "custom" in expr && (isElement(expr.custom.expr) || isElementWhere(expr.custom.expr));
|
|
55
|
-
}
|
|
56
|
-
function isWildcard(expr) {
|
|
57
|
-
return "wildcard" in expr;
|
|
58
|
-
}
|
|
59
|
-
function isElementKindExpr(expr) {
|
|
60
|
-
return "elementKind" in expr && "isEqual" in expr;
|
|
61
|
-
}
|
|
62
|
-
function isElementTagExpr(expr) {
|
|
63
|
-
return "elementTag" in expr && "isEqual" in expr;
|
|
64
|
-
}
|
|
65
|
-
function isElement(expr) {
|
|
66
|
-
return isElementRef(expr) || isWildcard(expr) || isElementKindExpr(expr) || isElementTagExpr(expr) || isExpandedElementExpr(expr);
|
|
67
|
-
}
|
|
68
|
-
function isElementWhere(expr) {
|
|
69
|
-
return "where" in expr && isElement(expr.where.expr);
|
|
70
|
-
}
|
|
71
|
-
function isElementPredicateExpr(expr) {
|
|
72
|
-
return isElement(expr) || isElementWhere(expr) || isCustomElement(expr);
|
|
73
|
-
}
|
|
74
|
-
function isRelation(expr) {
|
|
75
|
-
return "source" in expr && "target" in expr;
|
|
76
|
-
}
|
|
77
|
-
function isInOut(expr) {
|
|
78
|
-
return "inout" in expr;
|
|
79
|
-
}
|
|
80
|
-
function isIncoming(expr) {
|
|
81
|
-
return "incoming" in expr;
|
|
82
|
-
}
|
|
83
|
-
function isOutgoing(expr) {
|
|
84
|
-
return "outgoing" in expr;
|
|
85
|
-
}
|
|
86
|
-
function isRelationExpression(expr) {
|
|
87
|
-
return isRelation(expr) || isInOut(expr) || isIncoming(expr) || isOutgoing(expr);
|
|
36
|
+
function AsFqn(name, parent) {
|
|
37
|
+
return parent ? parent + "." + name : name;
|
|
88
38
|
}
|
|
89
|
-
function
|
|
90
|
-
|
|
39
|
+
function GlobalFqn(projectId, name) {
|
|
40
|
+
invariant(n$1(projectId), "Project ID must start with @");
|
|
41
|
+
return "@" + projectId + "." + name;
|
|
91
42
|
}
|
|
92
|
-
function
|
|
93
|
-
return "
|
|
43
|
+
function isGlobalFqn(fqn) {
|
|
44
|
+
return fqn.startsWith("@");
|
|
94
45
|
}
|
|
95
|
-
function
|
|
96
|
-
|
|
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];
|
|
97
57
|
}
|
|
98
58
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
isElementWhere: isElementWhere,
|
|
109
|
-
isExpandedElementExpr: isExpandedElementExpr,
|
|
110
|
-
isInOut: isInOut,
|
|
111
|
-
isIncoming: isIncoming,
|
|
112
|
-
isOutgoing: isOutgoing,
|
|
113
|
-
isRelation: isRelation,
|
|
114
|
-
isRelationExpression: isRelationExpression,
|
|
115
|
-
isRelationPredicateExpr: isRelationPredicateExpr,
|
|
116
|
-
isRelationWhere: isRelationWhere,
|
|
117
|
-
isWildcard: isWildcard
|
|
118
|
-
};
|
|
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 = {}));
|
|
119
68
|
|
|
120
69
|
var FqnRef;
|
|
121
70
|
((FqnRef2) => {
|
|
@@ -126,10 +75,13 @@ var FqnRef;
|
|
|
126
75
|
return "deployment" in ref && !("element" in ref);
|
|
127
76
|
};
|
|
128
77
|
FqnRef2.isDeploymentRef = (ref) => {
|
|
129
|
-
return !(0, FqnRef2.isModelRef)(ref);
|
|
78
|
+
return !(0, FqnRef2.isModelRef)(ref) && !(0, FqnRef2.isImportRef)(ref);
|
|
130
79
|
};
|
|
131
80
|
FqnRef2.isModelRef = (ref) => {
|
|
132
|
-
return "model" in ref;
|
|
81
|
+
return "model" in ref && !("project" in ref);
|
|
82
|
+
};
|
|
83
|
+
FqnRef2.isImportRef = (ref) => {
|
|
84
|
+
return "project" in ref && "model" in ref;
|
|
133
85
|
};
|
|
134
86
|
FqnRef2.toDeploymentRef = (ref) => {
|
|
135
87
|
invariant((0, FqnRef2.isDeploymentRef)(ref), "Expected DeploymentRef");
|
|
@@ -140,6 +92,15 @@ var FqnRef;
|
|
|
140
92
|
id: ref.deployment
|
|
141
93
|
};
|
|
142
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
|
+
};
|
|
143
104
|
})(FqnRef || (FqnRef = {}));
|
|
144
105
|
var FqnExpr;
|
|
145
106
|
((FqnExpr2) => {
|
|
@@ -147,11 +108,37 @@ var FqnExpr;
|
|
|
147
108
|
return "wildcard" in expr && expr.wildcard === true;
|
|
148
109
|
};
|
|
149
110
|
FqnExpr2.isModelRef = (ref) => {
|
|
150
|
-
return "ref" in ref && FqnRef.isModelRef(ref.ref);
|
|
111
|
+
return "ref" in ref && (FqnRef.isModelRef(ref.ref) || FqnRef.isImportRef(ref.ref));
|
|
151
112
|
};
|
|
152
113
|
FqnExpr2.isDeploymentRef = (ref) => {
|
|
153
114
|
return "ref" in ref && FqnRef.isDeploymentRef(ref.ref);
|
|
154
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
|
+
};
|
|
155
142
|
})(FqnExpr || (FqnExpr = {}));
|
|
156
143
|
var RelationExpr;
|
|
157
144
|
((RelationExpr2) => {
|
|
@@ -168,19 +155,143 @@ var RelationExpr;
|
|
|
168
155
|
return "inout" in expr;
|
|
169
156
|
};
|
|
170
157
|
RelationExpr2.isWhere = (expr) => {
|
|
171
|
-
return "where" in 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;
|
|
172
174
|
};
|
|
173
175
|
})(RelationExpr || (RelationExpr = {}));
|
|
174
176
|
var ExpressionV2;
|
|
175
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
|
+
};
|
|
176
187
|
ExpressionV22.isFqnExpr = (expr) => {
|
|
177
|
-
return FqnExpr.
|
|
188
|
+
return FqnExpr.is(expr) || FqnExpr.isWhere(expr) || FqnExpr.isCustom(expr);
|
|
178
189
|
};
|
|
179
190
|
ExpressionV22.isRelation = (expr) => {
|
|
180
|
-
return RelationExpr.
|
|
191
|
+
return RelationExpr.is(expr) || RelationExpr.isWhere(expr) || RelationExpr.isCustom(expr);
|
|
181
192
|
};
|
|
182
193
|
})(ExpressionV2 || (ExpressionV2 = {}));
|
|
183
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
|
+
|
|
184
295
|
const isTagEqual = (operator) => {
|
|
185
296
|
return "tag" in operator;
|
|
186
297
|
};
|
|
@@ -381,4 +492,4 @@ var DiagramNode;
|
|
|
381
492
|
DiagramNode2.isNodesGroup = isNodesGroup;
|
|
382
493
|
})(DiagramNode || (DiagramNode = {}));
|
|
383
494
|
|
|
384
|
-
export {
|
|
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 };
|
|
@@ -0,0 +1,62 @@
|
|
|
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 };
|