@likec4/core 1.32.2 → 1.34.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.d.mts +6 -4
- package/dist/builder/index.mjs +45 -13
- package/dist/compute-view/index.d.mts +6 -4
- package/dist/compute-view/index.mjs +33 -10
- package/dist/compute-view/relationships-view/index.d.mts +6 -4
- package/dist/compute-view/relationships-view/index.mjs +6 -3
- package/dist/index.d.mts +9 -138
- package/dist/index.mjs +31 -3712
- package/dist/model/connection/deployment/index.d.mts +10 -0
- package/dist/model/connection/deployment/index.mjs +18 -0
- package/dist/model/connection/index.d.mts +70 -0
- package/dist/model/connection/index.mjs +23 -0
- package/dist/model/connection/model/index.d.mts +10 -0
- package/dist/model/connection/model/index.mjs +11 -0
- package/dist/model/index.d.mts +14 -256
- package/dist/model/index.mjs +27 -5
- package/dist/shared/{core.cbA9VZ02.mjs → core.4SpVCM9m.mjs} +31 -1073
- package/dist/shared/{core.BuO4ncfY.d.mts → core.668kXpZq.d.mts} +42 -52
- package/dist/shared/core.8KM0D6va.mjs +33 -0
- package/dist/shared/core.B0oEIXqd.mjs +47 -0
- package/dist/shared/core.BH9nN-_I.mjs +22 -0
- package/dist/shared/core.BMCb0wJI.mjs +177 -0
- package/dist/shared/core.BTnf14gD.mjs +331 -0
- package/dist/shared/core.BgvIuGGU.mjs +3 -0
- package/dist/shared/core.BoyJPEen.mjs +21 -0
- package/dist/shared/{core.CUYDgv2-.mjs → core.Br7Fab9l.mjs} +12 -15
- package/dist/shared/{core.BrCnZFTn.mjs → core.Btl47GOn.mjs} +3 -3
- package/dist/shared/core.ByrmCl9I.mjs +5 -0
- package/dist/shared/core.C80Z37Eu.mjs +29 -0
- package/dist/shared/{core.Pf5I9o0e.d.mts → core.CF82MWyh.d.mts} +1 -1
- package/dist/shared/core.CJSFKrYf.d.mts +83 -0
- package/dist/shared/{core.rmvsy0n3.mjs → core.C_C-3c1S.mjs} +5 -198
- package/dist/shared/{core.DoK86JEe.mjs → core.CpwrZi3D.mjs} +2 -73
- package/dist/shared/{core.CpXlRyE5.mjs → core.CtKXPqN_.mjs} +5 -36
- package/dist/shared/core.CxGKeL-L.mjs +144 -0
- package/dist/shared/core.CzdwsPmY.d.mts +69 -0
- package/dist/shared/core.D3xEWj5B.d.mts +41 -0
- package/dist/shared/{core.Cy9smucx.mjs → core.D4npX2q8.mjs} +1 -3
- package/dist/shared/core.D56nCp7e.mjs +168 -0
- package/dist/shared/core.D5qVzkws.mjs +724 -0
- package/dist/shared/{core.CBxTtXMi.d.mts → core.DAj3LuFH.d.mts} +58 -57
- package/dist/shared/{core.Bk7wEZFG.mjs → core.DXRAwwDB.mjs} +3 -2
- package/dist/shared/core.DcS-0zys.mjs +10 -0
- package/dist/shared/core.Di7__sMg.d.mts +87 -0
- package/dist/shared/{core.DaAyklhe.d.mts → core.DrS4Bf4y.d.mts} +31 -22
- package/dist/shared/core.DsMrjY2q.mjs +34 -0
- package/dist/shared/core.DuSLYTG6.d.mts +57 -0
- package/dist/shared/{core.Bdz6fBF1.d.mts → core.IWLie-Ma.d.mts} +92 -81
- package/dist/shared/{core.CBpKAlhj.mjs → core.PqNe5WxQ.mjs} +96 -56
- package/dist/shared/core.XptQjhMA.mjs +1295 -0
- package/dist/shared/core.zLlww-07.mjs +3 -0
- package/dist/theme/index.d.mts +134 -0
- package/dist/theme/index.mjs +3709 -0
- package/dist/types/_aux.d.mts +4 -0
- package/dist/types/index.d.mts +9 -5
- package/dist/types/index.mjs +17 -146
- package/dist/utils/index.d.mts +15 -100
- package/dist/utils/index.mjs +25 -1315
- package/dist/utils/iterable/index.d.mts +100 -0
- package/dist/utils/iterable/index.mjs +24 -0
- package/package.json +29 -13
- package/src/builder/Builder.ts +13 -4
- package/src/builder/__snapshots__/Builder-style1.spec.ts.snap +0 -13
- package/src/builder/__snapshots__/Builder-style2.compute-model.json5 +2 -6
- package/src/builder/__snapshots__/Builder-style2.spec.ts.snap +0 -7
- package/src/compute-view/deployment-view/__test__/fixture.ts +15 -5
- package/src/compute-view/deployment-view/utils.ts +13 -13
- package/src/compute-view/dynamic-view/compute.ts +2 -1
- package/src/compute-view/element-view/__test__/__snapshots__/legacy.spec.ts.snap +2 -2
- package/src/compute-view/relationships-view/layout.ts +1 -1
- package/src/compute-view/utils/applyCustomElementProperties.ts +8 -0
- package/src/compute-view/utils/applyCustomRelationProperties.ts +2 -0
- package/src/compute-view/utils/buildComputedNodes.ts +4 -3
- package/src/compute-view/utils/merge-props-from-relationships.ts +6 -5
- package/src/compute-view/utils/view-hash.ts +24 -3
- package/src/model/DeploymentElementModel.ts +21 -17
- package/src/model/DeploymentModel.ts +1 -1
- package/src/model/ElementModel.ts +15 -5
- package/src/model/LikeC4Model.ts +1 -1
- package/src/model/RelationModel.ts +20 -17
- package/src/model/index.ts +2 -0
- package/src/model/types.ts +2 -1
- package/src/model/view/EdgeModel.ts +4 -3
- package/src/model/view/LikeC4ViewModel.ts +6 -1
- package/src/model/view/NodeModel.ts +5 -3
- package/src/theme/index.ts +12 -5
- package/src/types/RichText.ts +200 -0
- package/src/types/expression-model.ts +2 -2
- package/src/types/expression.ts +2 -2
- package/src/types/fqnRef.ts +2 -2
- package/src/types/global.ts +1 -1
- package/src/types/index.ts +4 -2
- package/src/types/model-data.ts +2 -2
- package/src/types/model-deployment.ts +6 -5
- package/src/types/model-dump.ts +1 -1
- package/src/types/model-logical.ts +5 -5
- package/src/types/model-spec.ts +2 -2
- package/src/types/operators.ts +2 -2
- package/src/types/scalar.ts +47 -2
- package/src/types/view-common.ts +3 -3
- package/src/types/view-computed.ts +4 -6
- package/src/types/view-layouted.ts +11 -2
- package/src/types/view-parsed.deployment.ts +1 -1
- package/src/types/view-parsed.dynamic.ts +2 -2
- package/src/types/view-parsed.element.ts +2 -2
- package/src/types/view.ts +2 -2
- package/src/utils/index.ts +4 -9
- package/src/utils/markdown/index.ts +2 -0
- package/src/utils/markdown/to-html.ts +32 -0
- package/src/utils/markdown/to-text.ts +14 -0
- package/dist/types/aux.d.mts +0 -3
- /package/dist/types/{aux.mjs → _aux.mjs} +0 -0
- /package/src/types/{aux.ts → _aux.ts} +0 -0
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
import { c as customInspectSymbol } from './core.C80Z37Eu.mjs';
|
|
2
|
+
import { o } from './core.BgvIuGGU.mjs';
|
|
3
|
+
import { a as intersection, b as stringHash, u as union, d as difference, e as equals } from './core.CpwrZi3D.mjs';
|
|
4
|
+
import { u } from './core.DbRvwARP.mjs';
|
|
5
|
+
import { m } from './core.ByrmCl9I.mjs';
|
|
6
|
+
import { j as isDescendantOf, i as isAncestor, q as isString, C, l as sortNaturalByFqn, k as isSameHierarchy } from './core.C_C-3c1S.mjs';
|
|
7
|
+
import { i as isome } from './core.BoyJPEen.mjs';
|
|
8
|
+
import { i as ifilter } from './core.BH9nN-_I.mjs';
|
|
9
|
+
import { i as invariant } from './core.D4npX2q8.mjs';
|
|
10
|
+
|
|
11
|
+
function p(...e){return u(t,e)}var t=(e,o)=>e[o];
|
|
12
|
+
|
|
13
|
+
function isNestedConnection(nested, parent) {
|
|
14
|
+
if (!parent) {
|
|
15
|
+
const p = nested;
|
|
16
|
+
return (n) => isNestedConnection(n, p);
|
|
17
|
+
}
|
|
18
|
+
const isSameSource = nested.source === parent.source;
|
|
19
|
+
const isSameTarget = nested.target === parent.target;
|
|
20
|
+
if (isSameSource && isSameTarget) {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
const isSourceNested = isAncestor(parent.source.id, nested.source.id);
|
|
24
|
+
const isTargetNested = isAncestor(parent.target.id, nested.target.id);
|
|
25
|
+
return isSourceNested && isTargetNested || isSameSource && isTargetNested || isSameTarget && isSourceNested;
|
|
26
|
+
}
|
|
27
|
+
function findDeepestNestedConnection(connections, connection) {
|
|
28
|
+
let deepest = connection;
|
|
29
|
+
for (const c of connections) {
|
|
30
|
+
if (isNestedConnection(c, deepest)) {
|
|
31
|
+
deepest = c;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return deepest !== connection ? deepest : null;
|
|
35
|
+
}
|
|
36
|
+
function sortDeepestFirst(connections) {
|
|
37
|
+
const sorted = [];
|
|
38
|
+
const unsorted = connections.slice();
|
|
39
|
+
let next;
|
|
40
|
+
while (next = unsorted.shift()) {
|
|
41
|
+
let deepest;
|
|
42
|
+
while (deepest = findDeepestNestedConnection(unsorted, next)) {
|
|
43
|
+
const index = unsorted.indexOf(deepest);
|
|
44
|
+
sorted.push(unsorted.splice(index, 1)[0]);
|
|
45
|
+
}
|
|
46
|
+
sorted.push(next);
|
|
47
|
+
}
|
|
48
|
+
return sorted;
|
|
49
|
+
}
|
|
50
|
+
const boundaryHierarchy = (conn) => conn.boundary?.id ? `.${conn.boundary.id}` : "";
|
|
51
|
+
function sortConnectionsByBoundaryHierarchy(connections, sort) {
|
|
52
|
+
if (!connections || isString(connections)) {
|
|
53
|
+
const dir = connections ?? "asc";
|
|
54
|
+
return (arr) => _sortByBoundary(arr, dir);
|
|
55
|
+
}
|
|
56
|
+
return _sortByBoundary(connections, sort ?? "asc");
|
|
57
|
+
}
|
|
58
|
+
function _sortByBoundary(connections, order) {
|
|
59
|
+
return C(
|
|
60
|
+
connections,
|
|
61
|
+
m((conn) => ({
|
|
62
|
+
id: boundaryHierarchy(conn),
|
|
63
|
+
conn
|
|
64
|
+
})),
|
|
65
|
+
sortNaturalByFqn(order),
|
|
66
|
+
m(p("conn"))
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
function findAscendingConnections(connections, connection) {
|
|
70
|
+
return connections.filter((c) => isNestedConnection(connection, c));
|
|
71
|
+
}
|
|
72
|
+
function findDescendantConnections(connections, connection) {
|
|
73
|
+
return connections.filter(isNestedConnection(connection));
|
|
74
|
+
}
|
|
75
|
+
function mergeConnections(connections) {
|
|
76
|
+
const map2 = /* @__PURE__ */ new Map();
|
|
77
|
+
for (const conn of connections) {
|
|
78
|
+
const existing = map2.get(conn.id);
|
|
79
|
+
if (existing) {
|
|
80
|
+
map2.set(conn.id, conn.mergeWith(existing));
|
|
81
|
+
} else {
|
|
82
|
+
map2.set(conn.id, conn);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return [...map2.values()];
|
|
86
|
+
}
|
|
87
|
+
function differenceConnections(source, exclude) {
|
|
88
|
+
const minus = new Map([...exclude].map((c) => [c.id, c]));
|
|
89
|
+
return [...source].reduce((acc, c) => {
|
|
90
|
+
const other = minus.get(c.id);
|
|
91
|
+
if (!other) {
|
|
92
|
+
acc.push(c);
|
|
93
|
+
return acc;
|
|
94
|
+
}
|
|
95
|
+
const updated = c.difference(other);
|
|
96
|
+
if (updated.nonEmpty()) {
|
|
97
|
+
acc.push(updated);
|
|
98
|
+
}
|
|
99
|
+
return acc;
|
|
100
|
+
}, []);
|
|
101
|
+
}
|
|
102
|
+
function hasSameSourceTarget(a, b) {
|
|
103
|
+
if (b) {
|
|
104
|
+
return a.source === b.source && a.target === b.target;
|
|
105
|
+
}
|
|
106
|
+
return (b2) => a.source === b2.source && a.target === b2.target;
|
|
107
|
+
}
|
|
108
|
+
function hasSameSource(a, b) {
|
|
109
|
+
if (b) {
|
|
110
|
+
return a.source === b.source;
|
|
111
|
+
}
|
|
112
|
+
return (b2) => a.source === b2.source;
|
|
113
|
+
}
|
|
114
|
+
function hasSameTarget(a, b) {
|
|
115
|
+
if (b) {
|
|
116
|
+
return a.target === b.target;
|
|
117
|
+
}
|
|
118
|
+
return (b2) => a.target === b2.target;
|
|
119
|
+
}
|
|
120
|
+
function isOutgoing(a, source) {
|
|
121
|
+
if (!source) {
|
|
122
|
+
const _source = a;
|
|
123
|
+
return (b) => isOutgoing(b, _source);
|
|
124
|
+
}
|
|
125
|
+
const at = a;
|
|
126
|
+
return isDescendantOf(at.source, source) && !isDescendantOf(at.target, source);
|
|
127
|
+
}
|
|
128
|
+
function isIncoming(a, target) {
|
|
129
|
+
if (!target) {
|
|
130
|
+
const _target = a;
|
|
131
|
+
return (b) => isIncoming(b, _target);
|
|
132
|
+
}
|
|
133
|
+
const at = a;
|
|
134
|
+
return isDescendantOf(at.target, target) && !isDescendantOf(at.source, target);
|
|
135
|
+
}
|
|
136
|
+
function isAnyInOut(a, source) {
|
|
137
|
+
if (!source) {
|
|
138
|
+
const _source = a;
|
|
139
|
+
return (b) => isAnyInOut(b, _source);
|
|
140
|
+
}
|
|
141
|
+
const at = a;
|
|
142
|
+
return isDescendantOf(at.source, source) !== isDescendantOf(at.target, source);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function findConnection(source, target, direction = "directed") {
|
|
146
|
+
if (source === target) {
|
|
147
|
+
return [];
|
|
148
|
+
}
|
|
149
|
+
if (isSameHierarchy(source, target)) {
|
|
150
|
+
return [];
|
|
151
|
+
}
|
|
152
|
+
const directedIntersection = intersection(source.allOutgoing, target.allIncoming);
|
|
153
|
+
const directed = directedIntersection.size > 0 ? new ConnectionModel(
|
|
154
|
+
source,
|
|
155
|
+
target,
|
|
156
|
+
directedIntersection
|
|
157
|
+
) : null;
|
|
158
|
+
if (direction === "directed") {
|
|
159
|
+
return directed ? [directed] : [];
|
|
160
|
+
}
|
|
161
|
+
const reverseIntersection = intersection(source.allIncoming, target.allOutgoing);
|
|
162
|
+
const reverse = reverseIntersection.size > 0 ? new ConnectionModel(
|
|
163
|
+
target,
|
|
164
|
+
source,
|
|
165
|
+
reverseIntersection
|
|
166
|
+
) : null;
|
|
167
|
+
if (directed && reverse) {
|
|
168
|
+
return [directed, reverse];
|
|
169
|
+
}
|
|
170
|
+
if (directed) {
|
|
171
|
+
return [directed];
|
|
172
|
+
}
|
|
173
|
+
if (reverse) {
|
|
174
|
+
return [reverse];
|
|
175
|
+
}
|
|
176
|
+
return [];
|
|
177
|
+
}
|
|
178
|
+
function findConnectionsBetween(element, others, direction = "both") {
|
|
179
|
+
if (element.allIncoming.size === 0 && element.allOutgoing.size === 0) {
|
|
180
|
+
return [];
|
|
181
|
+
}
|
|
182
|
+
const outgoing = [];
|
|
183
|
+
const incoming = [];
|
|
184
|
+
for (const _other of others) {
|
|
185
|
+
if (element === _other) {
|
|
186
|
+
continue;
|
|
187
|
+
}
|
|
188
|
+
for (const found of findConnection(element, _other, direction)) {
|
|
189
|
+
if (found.source === element) {
|
|
190
|
+
outgoing.push(found);
|
|
191
|
+
} else {
|
|
192
|
+
incoming.push(found);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
return [
|
|
197
|
+
...outgoing,
|
|
198
|
+
...incoming
|
|
199
|
+
];
|
|
200
|
+
}
|
|
201
|
+
function findConnectionsWithin(elements) {
|
|
202
|
+
return [...elements].reduce((acc, el, index, array) => {
|
|
203
|
+
if (index === array.length - 1) {
|
|
204
|
+
return acc;
|
|
205
|
+
}
|
|
206
|
+
acc.push(
|
|
207
|
+
...findConnectionsBetween(el, array.slice(index + 1), "both")
|
|
208
|
+
);
|
|
209
|
+
return acc;
|
|
210
|
+
}, []);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
const modelConnection = {
|
|
214
|
+
__proto__: null,
|
|
215
|
+
findConnection: findConnection,
|
|
216
|
+
findConnectionsBetween: findConnectionsBetween,
|
|
217
|
+
findConnectionsWithin: findConnectionsWithin
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
class ConnectionModel {
|
|
221
|
+
constructor(source, target, relations = /* @__PURE__ */ new Set()) {
|
|
222
|
+
this.source = source;
|
|
223
|
+
this.target = target;
|
|
224
|
+
this.relations = relations;
|
|
225
|
+
this.id = stringHash(`model:${source.id}:${target.id}`);
|
|
226
|
+
}
|
|
227
|
+
id;
|
|
228
|
+
_boundary;
|
|
229
|
+
/**
|
|
230
|
+
* Common ancestor of the source and target elements.
|
|
231
|
+
* Represents the boundary of the connection.
|
|
232
|
+
*/
|
|
233
|
+
get boundary() {
|
|
234
|
+
return this._boundary ??= this.source.commonAncestor(this.target);
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Human readable expression of the connection
|
|
238
|
+
* Mostly used for testing and debugging
|
|
239
|
+
*/
|
|
240
|
+
get expression() {
|
|
241
|
+
return `${this.source.id} -> ${this.target.id}`;
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Returns true if only includes relations between the source and target elements.
|
|
245
|
+
*/
|
|
246
|
+
get isDirect() {
|
|
247
|
+
return this.nonEmpty() && !this.isImplicit;
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Returns true if includes relations between nested elements of the source and target elements.
|
|
251
|
+
*/
|
|
252
|
+
get isImplicit() {
|
|
253
|
+
return this.nonEmpty() && isome(this.relations, o(hasSameSourceTarget(this)));
|
|
254
|
+
}
|
|
255
|
+
get directRelations() {
|
|
256
|
+
return new Set(ifilter(this.relations, hasSameSourceTarget(this)));
|
|
257
|
+
}
|
|
258
|
+
nonEmpty() {
|
|
259
|
+
return this.relations.size > 0;
|
|
260
|
+
}
|
|
261
|
+
mergeWith(other) {
|
|
262
|
+
invariant(this.source.id === other.source.id, "Cannot merge connections with different sources");
|
|
263
|
+
invariant(this.target.id === other.target.id, "Cannot merge connections with different targets");
|
|
264
|
+
return new ConnectionModel(
|
|
265
|
+
this.source,
|
|
266
|
+
this.target,
|
|
267
|
+
union(this.relations, other.relations)
|
|
268
|
+
);
|
|
269
|
+
}
|
|
270
|
+
difference(other) {
|
|
271
|
+
return new ConnectionModel(
|
|
272
|
+
this.source,
|
|
273
|
+
this.target,
|
|
274
|
+
difference(this.relations, other.relations)
|
|
275
|
+
);
|
|
276
|
+
}
|
|
277
|
+
intersect(other) {
|
|
278
|
+
invariant(other instanceof ConnectionModel, "Cannot intersect connection with different type");
|
|
279
|
+
return new ConnectionModel(
|
|
280
|
+
this.source,
|
|
281
|
+
this.target,
|
|
282
|
+
intersection(this.relations, other.relations)
|
|
283
|
+
);
|
|
284
|
+
}
|
|
285
|
+
equals(other) {
|
|
286
|
+
invariant(other instanceof ConnectionModel, "Cannot merge connection with different type");
|
|
287
|
+
const _other = other;
|
|
288
|
+
return this.id === _other.id && this.source.id === _other.source.id && this.target.id === _other.target.id && equals(this.relations, _other.relations);
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Returns a new instance with the updated relations.
|
|
292
|
+
*
|
|
293
|
+
* @param relations - A readonly set of `RelationshipModel` instances representing the new relations.
|
|
294
|
+
* @returns A new `ConnectionModel` instance with the updated relations.
|
|
295
|
+
*/
|
|
296
|
+
update(relations) {
|
|
297
|
+
return new ConnectionModel(
|
|
298
|
+
this.source,
|
|
299
|
+
this.target,
|
|
300
|
+
relations
|
|
301
|
+
);
|
|
302
|
+
}
|
|
303
|
+
[customInspectSymbol](depth, inspectOptions, inspect) {
|
|
304
|
+
const asString = this.toString();
|
|
305
|
+
Object.defineProperty(asString, "constructor", {
|
|
306
|
+
value: ConnectionModel,
|
|
307
|
+
enumerable: false
|
|
308
|
+
});
|
|
309
|
+
return asString;
|
|
310
|
+
}
|
|
311
|
+
toString() {
|
|
312
|
+
return [
|
|
313
|
+
this.expression,
|
|
314
|
+
this.relations.size ? " relations:" : " relations: [ ]",
|
|
315
|
+
...[...this.relations].map((c) => " " + c.expression)
|
|
316
|
+
].join("\n");
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* Creates a new connection with reversed direction (target becomes source and vice versa)
|
|
320
|
+
* @param search - When true, attempts to find an existing connection between the reversed nodes
|
|
321
|
+
*/
|
|
322
|
+
reversed(search = false) {
|
|
323
|
+
if (!search) {
|
|
324
|
+
return new ConnectionModel(this.target, this.source);
|
|
325
|
+
}
|
|
326
|
+
const [found] = findConnection(this.target, this.source, "directed");
|
|
327
|
+
return found ?? new ConnectionModel(this.target, this.source, /* @__PURE__ */ new Set());
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
export { ConnectionModel as C, findDeepestNestedConnection as a, findDescendantConnections as b, hasSameSourceTarget as c, differenceConnections as d, hasSameTarget as e, findAscendingConnections as f, isIncoming as g, hasSameSource as h, isAnyInOut as i, isNestedConnection as j, isOutgoing as k, sortDeepestFirst as l, mergeConnections as m, modelConnection as n, findConnectionsBetween as o, p, findConnection as q, findConnectionsWithin as r, sortConnectionsByBoundaryHierarchy as s };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { t } from './core.BH9nN-_I.mjs';
|
|
2
|
+
import { i as invariant } from './core.D4npX2q8.mjs';
|
|
3
|
+
|
|
4
|
+
function isome(arg1, arg2) {
|
|
5
|
+
const pred = arg2 ?? arg1;
|
|
6
|
+
invariant(t(pred));
|
|
7
|
+
function _some(iter) {
|
|
8
|
+
for (const value of iter) {
|
|
9
|
+
if (pred(value)) {
|
|
10
|
+
return true;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
if (!arg2) {
|
|
16
|
+
return _some;
|
|
17
|
+
}
|
|
18
|
+
return _some(arg1);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export { isome as i };
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as t$1 } from './core.zLlww-07.mjs';
|
|
2
|
+
import { n as n$1 } from './core.D56nCp7e.mjs';
|
|
3
|
+
import { i as invariant, n as nonexhaustive } from './core.D4npX2q8.mjs';
|
|
4
|
+
import { o } from './core.BgvIuGGU.mjs';
|
|
2
5
|
import { u } from './core.DbRvwARP.mjs';
|
|
3
6
|
|
|
4
7
|
function isOnStage(value, stage) {
|
|
@@ -7,16 +10,19 @@ function isOnStage(value, stage) {
|
|
|
7
10
|
const _stage = "_stage";
|
|
8
11
|
const _type = "_type";
|
|
9
12
|
|
|
10
|
-
function n$1(e){return !!e}
|
|
11
|
-
|
|
12
13
|
function n(e){return e==null}
|
|
13
14
|
|
|
14
|
-
function o(a){return t=>!a(t)}
|
|
15
|
-
|
|
16
15
|
function t(...a){return u(e,a)}var e=(a,o)=>o.every(l=>l(a));
|
|
17
16
|
|
|
18
17
|
function y(...a){return u(r,a)}var r=(a,o)=>o.some(e=>e(a));
|
|
19
18
|
|
|
19
|
+
function flattenMarkdownOrString(value) {
|
|
20
|
+
if (value === null || value === void 0) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
const content = t$1(value) ? value : value.txt ?? value.md;
|
|
24
|
+
return n$1(content?.trim()) ? content : null;
|
|
25
|
+
}
|
|
20
26
|
function Fqn(name, parent) {
|
|
21
27
|
return parent ? parent + "." + name : name;
|
|
22
28
|
}
|
|
@@ -121,15 +127,6 @@ function isDeployedInstance(el) {
|
|
|
121
127
|
return "element" in el && n$1(el.element);
|
|
122
128
|
}
|
|
123
129
|
|
|
124
|
-
const DefaultThemeColor = "primary";
|
|
125
|
-
const DefaultElementShape = "rectangle";
|
|
126
|
-
const DefaultShapeSize = "md";
|
|
127
|
-
const DefaultPaddingSize = "md";
|
|
128
|
-
const DefaultTextSize = "md";
|
|
129
|
-
const DefaultLineStyle = "dashed";
|
|
130
|
-
const DefaultArrowType = "normal";
|
|
131
|
-
const DefaultRelationshipColor = "gray";
|
|
132
|
-
|
|
133
130
|
function isTagEqual(operator) {
|
|
134
131
|
return "tag" in operator;
|
|
135
132
|
}
|
|
@@ -211,4 +208,4 @@ function participantIs(participant, predicate) {
|
|
|
211
208
|
};
|
|
212
209
|
}
|
|
213
210
|
|
|
214
|
-
export { DeploymentFqn as
|
|
211
|
+
export { DeploymentFqn as D, EdgeId as E, FqnRef as F, GroupElementKind as G, NodeId as N, RelationId as R, StepEdgeKind as S, ViewId as V, _stage as _, _type as a, isDeploymentNode as b, isDeployedInstance as c, isTagEqual as d, isKindEqual as e, isParticipantOperator as f, isNotOperator as g, isAndOperator as h, isOnStage as i, isOrOperator as j, flattenMarkdownOrString as k, Fqn as l, isGroupElementKind as m, GlobalFqn as n, isGlobalFqn as o, stepEdgeId as p, isStepEdgeId as q, extractStep as r, splitGlobalFqn as s, n as t, whereOperatorAsPredicate as w, y };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t } from './core.
|
|
2
|
-
import { i as invariant } from './core.
|
|
1
|
+
import { t } from './core.BH9nN-_I.mjs';
|
|
2
|
+
import { i as invariant } from './core.D4npX2q8.mjs';
|
|
3
3
|
|
|
4
4
|
function imap(arg1, arg2) {
|
|
5
5
|
const mapper = arg2 ?? arg1;
|
|
@@ -29,4 +29,4 @@ function toSet(iterable) {
|
|
|
29
29
|
return (it) => new Set(it);
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
export {
|
|
32
|
+
export { toSet as a, imap as i, toArray as t };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { i as isAncestor } from './core.C_C-3c1S.mjs';
|
|
2
|
+
|
|
3
|
+
var Connection;
|
|
4
|
+
((Connection2) => {
|
|
5
|
+
Connection2.isInside = (fqn) => {
|
|
6
|
+
return (connection) => isAncestor(fqn, connection.source.id) && isAncestor(fqn, connection.target.id);
|
|
7
|
+
};
|
|
8
|
+
Connection2.isDirectedBetween = (source, target) => {
|
|
9
|
+
return (connection) => (connection.source.id === source || isAncestor(source, connection.source.id)) && (connection.target.id === target || isAncestor(target, connection.target.id));
|
|
10
|
+
};
|
|
11
|
+
Connection2.isAnyBetween = (source, target) => {
|
|
12
|
+
const forward = (0, Connection2.isDirectedBetween)(source, target), backward = (0, Connection2.isDirectedBetween)(target, source);
|
|
13
|
+
return (connection) => forward(connection) || backward(connection);
|
|
14
|
+
};
|
|
15
|
+
Connection2.isIncoming = (target) => {
|
|
16
|
+
return (connection) => (connection.target.id === target || isAncestor(target, connection.target.id)) && !isAncestor(target, connection.source.id);
|
|
17
|
+
};
|
|
18
|
+
Connection2.isOutgoing = (source) => {
|
|
19
|
+
return (connection) => (connection.source.id === source || isAncestor(source, connection.source.id)) && !isAncestor(source, connection.target.id);
|
|
20
|
+
};
|
|
21
|
+
Connection2.isAnyInOut = (source) => {
|
|
22
|
+
const isIn = (0, Connection2.isIncoming)(source), isOut = (0, Connection2.isOutgoing)(source);
|
|
23
|
+
return (connection) => isIn(connection) || isOut(connection);
|
|
24
|
+
};
|
|
25
|
+
})(Connection || (Connection = {}));
|
|
26
|
+
|
|
27
|
+
const customInspectSymbol = Symbol.for("nodejs.util.inspect.custom");
|
|
28
|
+
|
|
29
|
+
export { Connection as C, customInspectSymbol as c };
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { C as Connection, c as customInspectSymbol } from './core.D3xEWj5B.mjs';
|
|
2
|
+
import { E as ElementModel, R as RelationshipModel } from './core.DrS4Bf4y.mjs';
|
|
3
|
+
import { A as Any, U as Unknown, B as EdgeId } from './core.DAj3LuFH.mjs';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Connection refers to any relationships between two elements,
|
|
7
|
+
* both direct and implicit ones (between their nested elements).
|
|
8
|
+
*
|
|
9
|
+
* Merges relationships together to an single edge on the diagram.
|
|
10
|
+
*/
|
|
11
|
+
declare class ConnectionModel<A extends Any = Unknown> implements Connection<ElementModel<A>, EdgeId> {
|
|
12
|
+
readonly source: ElementModel<A>;
|
|
13
|
+
readonly target: ElementModel<A>;
|
|
14
|
+
readonly relations: ReadonlySet<RelationshipModel<A>>;
|
|
15
|
+
readonly id: EdgeId;
|
|
16
|
+
constructor(source: ElementModel<A>, target: ElementModel<A>, relations?: ReadonlySet<RelationshipModel<A>>);
|
|
17
|
+
private _boundary;
|
|
18
|
+
/**
|
|
19
|
+
* Common ancestor of the source and target elements.
|
|
20
|
+
* Represents the boundary of the connection.
|
|
21
|
+
*/
|
|
22
|
+
get boundary(): ElementModel<A> | null;
|
|
23
|
+
/**
|
|
24
|
+
* Human readable expression of the connection
|
|
25
|
+
* Mostly used for testing and debugging
|
|
26
|
+
*/
|
|
27
|
+
get expression(): string;
|
|
28
|
+
/**
|
|
29
|
+
* Returns true if only includes relations between the source and target elements.
|
|
30
|
+
*/
|
|
31
|
+
get isDirect(): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Returns true if includes relations between nested elements of the source and target elements.
|
|
34
|
+
*/
|
|
35
|
+
get isImplicit(): boolean;
|
|
36
|
+
get directRelations(): ReadonlySet<RelationshipModel<A>>;
|
|
37
|
+
nonEmpty(): boolean;
|
|
38
|
+
mergeWith(other: ConnectionModel<A>): ConnectionModel<A>;
|
|
39
|
+
difference(other: ConnectionModel<A>): ConnectionModel<A>;
|
|
40
|
+
intersect(other: ConnectionModel<A>): ConnectionModel<A>;
|
|
41
|
+
equals(other: Connection): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Returns a new instance with the updated relations.
|
|
44
|
+
*
|
|
45
|
+
* @param relations - A readonly set of `RelationshipModel` instances representing the new relations.
|
|
46
|
+
* @returns A new `ConnectionModel` instance with the updated relations.
|
|
47
|
+
*/
|
|
48
|
+
update(relations: ReadonlySet<RelationshipModel<A>>): ConnectionModel<A>;
|
|
49
|
+
[customInspectSymbol](depth: any, inspectOptions: any, inspect: any): string;
|
|
50
|
+
toString(): string;
|
|
51
|
+
/**
|
|
52
|
+
* Creates a new connection with reversed direction (target becomes source and vice versa)
|
|
53
|
+
* @param search - When true, attempts to find an existing connection between the reversed nodes
|
|
54
|
+
*/
|
|
55
|
+
reversed(search?: boolean): ConnectionModel<A>;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Resolve connection from source to target
|
|
60
|
+
*
|
|
61
|
+
* @param direction - if 'both', also returns connection from target to source
|
|
62
|
+
* @default `directed`
|
|
63
|
+
*/
|
|
64
|
+
declare function findConnection<A extends Any>(source: ElementModel<A>, target: ElementModel<A>, direction?: 'directed' | 'both'): [ConnectionModel<A>, ConnectionModel<A>] | [ConnectionModel<A>] | [];
|
|
65
|
+
/**
|
|
66
|
+
* Resolve all connections between element and others
|
|
67
|
+
* @param direction - if 'directed', only look for outgoing connections from the element to others
|
|
68
|
+
* @default `both`
|
|
69
|
+
*/
|
|
70
|
+
declare function findConnectionsBetween<M extends Any>(element: ElementModel<M>, others: Iterable<ElementModel<M>>, direction?: 'directed' | 'both'): readonly ConnectionModel<M>[];
|
|
71
|
+
/**
|
|
72
|
+
* Resolve all connections within a given set of elements
|
|
73
|
+
*/
|
|
74
|
+
declare function findConnectionsWithin<M extends Any>(elements: Iterable<ElementModel<M>>): readonly ConnectionModel<M>[];
|
|
75
|
+
|
|
76
|
+
declare const find_findConnection: typeof findConnection;
|
|
77
|
+
declare const find_findConnectionsBetween: typeof findConnectionsBetween;
|
|
78
|
+
declare const find_findConnectionsWithin: typeof findConnectionsWithin;
|
|
79
|
+
declare namespace find {
|
|
80
|
+
export { find_findConnection as findConnection, find_findConnectionsBetween as findConnectionsBetween, find_findConnectionsWithin as findConnectionsWithin };
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export { ConnectionModel as C, findConnection as a, findConnectionsBetween as b, findConnectionsWithin as c, find as f };
|