@likec4/core 1.48.0 → 1.50.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/THIRD-PARTY-LICENSES.md +1034 -0
- package/dist/_chunks/Builder.view-element.mjs +2 -3284
- package/dist/_chunks/LikeC4Model.d.mts +21 -25
- package/dist/_chunks/_types.d.mts +1 -5
- package/dist/_chunks/_types2.d.mts +2 -4
- package/dist/_chunks/assignTagColors.mjs +1 -24
- package/dist/_chunks/geometry.mjs +1 -335
- package/dist/_chunks/index.d.mts +1995 -131
- package/dist/_chunks/index2.d.mts +153 -892
- package/dist/_chunks/index3.d.mts +15 -13
- package/dist/_chunks/index4.d.mts +229 -3
- package/dist/_chunks/index5.d.mts +392 -30
- package/dist/_chunks/libs/@mantine/colors-generator.mjs +2 -3403
- package/dist/_chunks/libs/@radix-ui/colors.mjs +1 -0
- package/dist/_chunks/libs/@ungap/structured-clone.mjs +1 -213
- package/dist/_chunks/libs/bail.mjs +1 -14
- package/dist/_chunks/libs/ccount.mjs +1 -25
- package/dist/_chunks/libs/character-entities-html4.mjs +1 -263
- package/dist/_chunks/libs/character-entities-legacy.mjs +1 -117
- package/dist/_chunks/libs/character-entities.mjs +2 -2136
- package/dist/_chunks/libs/comma-separated-tokens.mjs +1 -18
- package/dist/_chunks/libs/decode-named-character-reference.mjs +1 -21
- package/dist/_chunks/libs/defu.mjs +1 -42
- package/dist/_chunks/libs/devlop.mjs +1 -5
- package/dist/_chunks/libs/escape-string-regexp.mjs +1 -8
- package/dist/_chunks/libs/extend.mjs +1 -77
- package/dist/_chunks/libs/graphology-dag.mjs +1 -703
- package/dist/_chunks/libs/graphology.mjs +1 -4565
- package/dist/_chunks/libs/hast-util-sanitize.mjs +1 -863
- package/dist/_chunks/libs/hast-util-to-html.mjs +9 -2696
- package/dist/_chunks/libs/is-plain-obj.mjs +1 -9
- package/dist/_chunks/libs/longest-streak.mjs +1 -30
- package/dist/_chunks/libs/markdown-table.mjs +2 -290
- package/dist/_chunks/libs/mdast-util-find-and-replace.mjs +1 -653
- package/dist/_chunks/libs/mdast-util-from-markdown.mjs +3 -8522
- package/dist/_chunks/libs/mdast-util-gfm.mjs +15 -2393
- package/dist/_chunks/libs/mdast-util-to-hast.mjs +11 -1803
- package/dist/_chunks/libs/micromark-extension-gfm.mjs +1 -2243
- package/dist/_chunks/libs/mnemonist.d.mts +1 -91
- package/dist/_chunks/libs/mnemonist.mjs +1 -1978
- package/dist/_chunks/libs/natural-compare-lite.mjs +9 -42
- package/dist/_chunks/libs/ohash.mjs +1 -0
- package/dist/_chunks/libs/rehype-sanitize.mjs +1 -29
- package/dist/_chunks/libs/rehype-stringify.mjs +1 -34
- package/dist/_chunks/libs/remark-gfm.mjs +1 -36
- package/dist/_chunks/libs/remark-github-blockquote-alert.mjs +3 -100
- package/dist/_chunks/libs/remark-parse.mjs +1 -39
- package/dist/_chunks/libs/remark-rehype.mjs +1 -171
- package/dist/_chunks/libs/remeda.mjs +2 -702
- package/dist/_chunks/libs/trough.mjs +1 -158
- package/dist/_chunks/libs/unified.mjs +1 -2212
- package/dist/_chunks/manual-layout.mjs +1 -0
- package/dist/_chunks/model.mjs +4 -1898
- package/dist/_chunks/rolldown-runtime.mjs +1 -42
- package/dist/_chunks/types.mjs +1 -0
- package/dist/_chunks/utils.mjs +1 -483
- package/dist/builder/index.d.mts +3 -6
- package/dist/builder/index.mjs +1 -662
- package/dist/compute-view/index.d.mts +85 -13
- package/dist/compute-view/index.mjs +2 -262
- package/dist/geometry/index.d.mts +2 -2
- package/dist/geometry/index.mjs +1 -3
- package/dist/index.d.mts +7 -13
- package/dist/index.mjs +1 -27
- package/dist/model/index.d.mts +4 -11
- package/dist/model/index.mjs +1 -11
- package/dist/styles/index.d.mts +2 -7
- package/dist/styles/index.mjs +1 -30
- package/dist/types/index.d.mts +3 -9
- package/dist/types/index.mjs +1 -15
- package/dist/utils/graphology/index.d.mts +1 -1
- package/dist/utils/graphology/index.mjs +1 -3
- package/dist/utils/index.d.mts +5 -10
- package/dist/utils/index.mjs +1 -17
- package/package.json +14 -13
- package/dist/_chunks/LikeC4Styles.mjs +0 -691
- package/dist/_chunks/RichText.d.mts +0 -84
- package/dist/_chunks/RichText.mjs +0 -148
- package/dist/_chunks/_aux.d.mts +0 -289
- package/dist/_chunks/_aux.mjs +0 -18
- package/dist/_chunks/calcDriftsFromSnapshot.mjs +0 -379
- package/dist/_chunks/connection.mjs +0 -0
- package/dist/_chunks/const.d.mts +0 -43
- package/dist/_chunks/const.mjs +0 -33
- package/dist/_chunks/expression-model.d.mts +0 -192
- package/dist/_chunks/expression-model.mjs +0 -103
- package/dist/_chunks/expression.d.mts +0 -347
- package/dist/_chunks/expression.mjs +0 -107
- package/dist/_chunks/find.d.mts +0 -82
- package/dist/_chunks/find.mjs +0 -646
- package/dist/_chunks/find2.d.mts +0 -78
- package/dist/_chunks/find2.mjs +0 -287
- package/dist/_chunks/fqnRef.d.mts +0 -58
- package/dist/_chunks/fqnRef.mjs +0 -41
- package/dist/_chunks/index6.d.mts +0 -43
- package/dist/_chunks/index7.d.mts +0 -268
- package/dist/_chunks/index8.d.mts +0 -144
- package/dist/_chunks/invariant.mjs +0 -18
- package/dist/_chunks/iterable.mjs +0 -146
- package/dist/_chunks/libs/graphology-types.d.mts +0 -601
- package/dist/_chunks/libs/graphology.d.mts +0 -6
- package/dist/_chunks/mnemonist.mjs +0 -0
- package/dist/_chunks/model2.mjs +0 -0
- package/dist/_chunks/relationships-view.mjs +0 -132
- package/dist/_chunks/scalar.d.mts +0 -109
- package/dist/_chunks/scalar.mjs +0 -84
- package/dist/compute-view/relationships-view/index.d.mts +0 -16
- package/dist/compute-view/relationships-view/index.mjs +0 -7
- package/dist/model/connection/deployment/index.d.mts +0 -12
- package/dist/model/connection/deployment/index.mjs +0 -9
- package/dist/model/connection/index.d.mts +0 -14
- package/dist/model/connection/index.mjs +0 -10
- package/dist/model/connection/model/index.d.mts +0 -12
- package/dist/model/connection/model/index.mjs +0 -8
- package/dist/types/RichText.d.mts +0 -3
- package/dist/types/RichText.mjs +0 -7
- package/dist/types/_aux.d.mts +0 -3
- package/dist/types/_aux.mjs +0 -3
- package/dist/types/expression-model.d.mts +0 -6
- package/dist/types/expression-model.mjs +0 -7
- package/dist/types/expression.d.mts +0 -5
- package/dist/types/expression.mjs +0 -7
- package/dist/types/fqnRef.d.mts +0 -4
- package/dist/types/fqnRef.mjs +0 -7
- package/dist/types/scalar.d.mts +0 -2
- package/dist/types/scalar.mjs +0 -7
- package/dist/utils/iterable/index.d.mts +0 -9
- package/dist/utils/iterable/index.mjs +0 -3
- package/dist/utils/mnemonist.d.mts +0 -2
- package/dist/utils/mnemonist.mjs +0 -12
package/dist/_chunks/find2.d.mts
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { G as Unknown, f as EdgeId, n as Any } from "./_aux.mjs";
|
|
2
|
-
import { C as ElementModel, T as RelationshipModel } from "./LikeC4Model.mjs";
|
|
3
|
-
import { n as Connection, t as customInspectSymbol } from "./const.mjs";
|
|
4
|
-
|
|
5
|
-
//#region src/model/connection/model/ConnectionModel.d.ts
|
|
6
|
-
/**
|
|
7
|
-
* Connection refers to any relationships between two elements,
|
|
8
|
-
* both direct and implicit ones (between their nested elements).
|
|
9
|
-
*
|
|
10
|
-
* Merges relationships together to an single edge on the diagram.
|
|
11
|
-
*/
|
|
12
|
-
declare class ConnectionModel<A extends Any = Unknown> implements Connection<ElementModel<A>, EdgeId> {
|
|
13
|
-
readonly source: ElementModel<A>;
|
|
14
|
-
readonly target: ElementModel<A>;
|
|
15
|
-
readonly relations: ReadonlySet<RelationshipModel<A>>;
|
|
16
|
-
readonly id: EdgeId;
|
|
17
|
-
constructor(source: ElementModel<A>, target: ElementModel<A>, relations?: ReadonlySet<RelationshipModel<A>>);
|
|
18
|
-
private _boundary;
|
|
19
|
-
/**
|
|
20
|
-
* Common ancestor of the source and target elements.
|
|
21
|
-
* Represents the boundary of the connection.
|
|
22
|
-
*/
|
|
23
|
-
get boundary(): ElementModel<A> | null;
|
|
24
|
-
/**
|
|
25
|
-
* Human readable expression of the connection
|
|
26
|
-
* Mostly used for testing and debugging
|
|
27
|
-
*/
|
|
28
|
-
get expression(): string;
|
|
29
|
-
/**
|
|
30
|
-
* Returns true if only includes relations between the source and target elements.
|
|
31
|
-
*/
|
|
32
|
-
get isDirect(): boolean;
|
|
33
|
-
/**
|
|
34
|
-
* Returns true if includes relations between nested elements of the source and target elements.
|
|
35
|
-
*/
|
|
36
|
-
get isImplicit(): boolean;
|
|
37
|
-
get directRelations(): ReadonlySet<RelationshipModel<A>>;
|
|
38
|
-
nonEmpty(): boolean;
|
|
39
|
-
mergeWith(other: ConnectionModel<A>): ConnectionModel<A>;
|
|
40
|
-
difference(other: ConnectionModel<A>): ConnectionModel<A>;
|
|
41
|
-
intersect(other: ConnectionModel<A>): ConnectionModel<A>;
|
|
42
|
-
equals(other: Connection): boolean;
|
|
43
|
-
/**
|
|
44
|
-
* Returns a new instance with the updated relations.
|
|
45
|
-
*
|
|
46
|
-
* @param relations - A readonly set of `RelationshipModel` instances representing the new relations.
|
|
47
|
-
* @returns A new `ConnectionModel` instance with the updated relations.
|
|
48
|
-
*/
|
|
49
|
-
update(relations: ReadonlySet<RelationshipModel<A>>): ConnectionModel<A>;
|
|
50
|
-
[customInspectSymbol](_depth: any, _inspectOptions: any, _inspect: any): string;
|
|
51
|
-
toString(): string;
|
|
52
|
-
/**
|
|
53
|
-
* Creates a new connection with reversed direction (target becomes source and vice versa)
|
|
54
|
-
*/
|
|
55
|
-
reversed(): ConnectionModel<A>;
|
|
56
|
-
}
|
|
57
|
-
declare namespace find_d_exports {
|
|
58
|
-
export { findConnection, findConnectionsBetween, findConnectionsWithin };
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Resolve connection from source to target
|
|
62
|
-
*
|
|
63
|
-
* @param direction - if 'both', also returns connection from target to source
|
|
64
|
-
* @default `directed`
|
|
65
|
-
*/
|
|
66
|
-
declare function findConnection<A extends Any>(source: ElementModel<A>, target: ElementModel<A>, direction?: 'directed' | 'both'): [ConnectionModel<A>, ConnectionModel<A>] | [ConnectionModel<A>] | [];
|
|
67
|
-
/**
|
|
68
|
-
* Resolve all connections between element and others
|
|
69
|
-
* @param direction - if 'directed', only look for outgoing connections from the element to others
|
|
70
|
-
* @default `both`
|
|
71
|
-
*/
|
|
72
|
-
declare function findConnectionsBetween<M extends Any>(element: ElementModel<M>, others: Iterable<ElementModel<M>>, direction?: 'directed' | 'both'): readonly ConnectionModel<M>[];
|
|
73
|
-
/**
|
|
74
|
-
* Resolve all connections within a given set of elements
|
|
75
|
-
*/
|
|
76
|
-
declare function findConnectionsWithin<M extends Any>(elements: Iterable<ElementModel<M>>): readonly ConnectionModel<M>[];
|
|
77
|
-
//#endregion
|
|
78
|
-
export { ConnectionModel as a, find_d_exports as i, findConnectionsBetween as n, findConnectionsWithin as r, findConnection as t };
|
package/dist/_chunks/find2.mjs
DELETED
|
@@ -1,287 +0,0 @@
|
|
|
1
|
-
import { n as __exportAll } from "./rolldown-runtime.mjs";
|
|
2
|
-
import { M as e, Q as t, w as t$1 } from "./libs/remeda.mjs";
|
|
3
|
-
import { C as isAncestor, P as isString, T as isSameHierarchy, a as difference, c as intersection, k as sortNaturalByFqn, o as equals, r as stringHash, u as union, w as isDescendantOf } from "./utils.mjs";
|
|
4
|
-
import { t as invariant } from "./invariant.mjs";
|
|
5
|
-
import { f as ifilter, i as isome } from "./iterable.mjs";
|
|
6
|
-
import { t as customInspectSymbol } from "./const.mjs";
|
|
7
|
-
|
|
8
|
-
//#region src/model/connection/ops.ts
|
|
9
|
-
function isNestedConnection(nested, parent) {
|
|
10
|
-
if (!parent) {
|
|
11
|
-
const p = nested;
|
|
12
|
-
return (n) => isNestedConnection(n, p);
|
|
13
|
-
}
|
|
14
|
-
const isSameSource = nested.source === parent.source;
|
|
15
|
-
const isSameTarget = nested.target === parent.target;
|
|
16
|
-
if (isSameSource && isSameTarget) return false;
|
|
17
|
-
const isSourceNested = isAncestor(parent.source.id, nested.source.id);
|
|
18
|
-
const isTargetNested = isAncestor(parent.target.id, nested.target.id);
|
|
19
|
-
return isSourceNested && isTargetNested || isSameSource && isTargetNested || isSameTarget && isSourceNested;
|
|
20
|
-
}
|
|
21
|
-
function findDeepestNestedConnection(connections, connection) {
|
|
22
|
-
let deepest = connection;
|
|
23
|
-
for (const c of connections) if (isNestedConnection(c, deepest)) deepest = c;
|
|
24
|
-
return deepest !== connection ? deepest : null;
|
|
25
|
-
}
|
|
26
|
-
function sortDeepestFirst(connections) {
|
|
27
|
-
const sorted = [];
|
|
28
|
-
const unsorted = connections.slice();
|
|
29
|
-
let next;
|
|
30
|
-
while (next = unsorted.shift()) {
|
|
31
|
-
let deepest;
|
|
32
|
-
while (deepest = findDeepestNestedConnection(unsorted, next)) {
|
|
33
|
-
const index = unsorted.indexOf(deepest);
|
|
34
|
-
sorted.push(unsorted.splice(index, 1)[0]);
|
|
35
|
-
}
|
|
36
|
-
sorted.push(next);
|
|
37
|
-
}
|
|
38
|
-
return sorted;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* To make {@link sortConnectionsByBoundaryHierarchy} work correctly we add '.' to boundary
|
|
42
|
-
* Othwerwise connection without boundary will be considered same level as connection with top-level boundary
|
|
43
|
-
*/
|
|
44
|
-
function boundaryHierarchy(conn) {
|
|
45
|
-
return conn.boundary?.id ? `.${conn.boundary.id}` : "";
|
|
46
|
-
}
|
|
47
|
-
function sortConnectionsByBoundaryHierarchy(connections, sort) {
|
|
48
|
-
if (!connections || isString(connections)) {
|
|
49
|
-
const dir = connections ?? "asc";
|
|
50
|
-
return (arr) => _sortByBoundary(arr, dir);
|
|
51
|
-
}
|
|
52
|
-
return _sortByBoundary(connections, sort ?? "asc");
|
|
53
|
-
}
|
|
54
|
-
function _sortByBoundary(connections, order) {
|
|
55
|
-
return t(connections, t$1((conn) => ({
|
|
56
|
-
id: boundaryHierarchy(conn),
|
|
57
|
-
conn
|
|
58
|
-
})), sortNaturalByFqn(order), t$1((p) => p.conn));
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Find connections that includes given connection (i.e between it's ancestors)
|
|
62
|
-
*/
|
|
63
|
-
function findAscendingConnections(connections, connection) {
|
|
64
|
-
return connections.filter((c) => isNestedConnection(connection, c));
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Find connections that given connection includes (i.e between it's descendants)
|
|
68
|
-
*/
|
|
69
|
-
function findDescendantConnections(connections, connection) {
|
|
70
|
-
return connections.filter(isNestedConnection(connection));
|
|
71
|
-
}
|
|
72
|
-
function mergeConnections(connections) {
|
|
73
|
-
const map = /* @__PURE__ */ new Map();
|
|
74
|
-
for (const conn of connections) {
|
|
75
|
-
const existing = map.get(conn.id);
|
|
76
|
-
if (existing) map.set(conn.id, conn.mergeWith(existing));
|
|
77
|
-
else map.set(conn.id, conn);
|
|
78
|
-
}
|
|
79
|
-
return [...map.values()];
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Excludes the values existing in `other` array.
|
|
83
|
-
* The output maintains the same order as the input.
|
|
84
|
-
*/
|
|
85
|
-
function differenceConnections(source, exclude) {
|
|
86
|
-
const minus = new Map([...exclude].map((c) => [c.id, c]));
|
|
87
|
-
return [...source].reduce((acc, c) => {
|
|
88
|
-
const other = minus.get(c.id);
|
|
89
|
-
if (!other) {
|
|
90
|
-
acc.push(c);
|
|
91
|
-
return acc;
|
|
92
|
-
}
|
|
93
|
-
const updated = c.difference(other);
|
|
94
|
-
if (updated.nonEmpty()) acc.push(updated);
|
|
95
|
-
return acc;
|
|
96
|
-
}, []);
|
|
97
|
-
}
|
|
98
|
-
function hasSameSourceTarget(a, b) {
|
|
99
|
-
if (b) return a.source === b.source && a.target === b.target;
|
|
100
|
-
return (b) => a.source === b.source && a.target === b.target;
|
|
101
|
-
}
|
|
102
|
-
function hasSameSource(a, b) {
|
|
103
|
-
if (b) return a.source === b.source;
|
|
104
|
-
return (b) => a.source === b.source;
|
|
105
|
-
}
|
|
106
|
-
function hasSameTarget(a, b) {
|
|
107
|
-
if (b) return a.target === b.target;
|
|
108
|
-
return (b) => a.target === b.target;
|
|
109
|
-
}
|
|
110
|
-
function isOutgoing(a, source) {
|
|
111
|
-
if (!source) {
|
|
112
|
-
const _source = a;
|
|
113
|
-
return (b) => isOutgoing(b, _source);
|
|
114
|
-
}
|
|
115
|
-
const at = a;
|
|
116
|
-
return isDescendantOf(at.source, source) && !isDescendantOf(at.target, source);
|
|
117
|
-
}
|
|
118
|
-
function isIncoming(a, target) {
|
|
119
|
-
if (!target) {
|
|
120
|
-
const _target = a;
|
|
121
|
-
return (b) => isIncoming(b, _target);
|
|
122
|
-
}
|
|
123
|
-
const at = a;
|
|
124
|
-
return isDescendantOf(at.target, target) && !isDescendantOf(at.source, target);
|
|
125
|
-
}
|
|
126
|
-
function isAnyInOut(a, source) {
|
|
127
|
-
if (!source) {
|
|
128
|
-
const _source = a;
|
|
129
|
-
return (b) => isAnyInOut(b, _source);
|
|
130
|
-
}
|
|
131
|
-
const at = a;
|
|
132
|
-
return isDescendantOf(at.source, source) !== isDescendantOf(at.target, source);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
//#endregion
|
|
136
|
-
//#region src/model/connection/model/ConnectionModel.ts
|
|
137
|
-
/**
|
|
138
|
-
* Connection refers to any relationships between two elements,
|
|
139
|
-
* both direct and implicit ones (between their nested elements).
|
|
140
|
-
*
|
|
141
|
-
* Merges relationships together to an single edge on the diagram.
|
|
142
|
-
*/
|
|
143
|
-
var ConnectionModel = class ConnectionModel {
|
|
144
|
-
id;
|
|
145
|
-
constructor(source, target, relations = /* @__PURE__ */ new Set()) {
|
|
146
|
-
this.source = source;
|
|
147
|
-
this.target = target;
|
|
148
|
-
this.relations = relations;
|
|
149
|
-
this.id = stringHash(`model:${source.id}:${target.id}`);
|
|
150
|
-
}
|
|
151
|
-
_boundary;
|
|
152
|
-
/**
|
|
153
|
-
* Common ancestor of the source and target elements.
|
|
154
|
-
* Represents the boundary of the connection.
|
|
155
|
-
*/
|
|
156
|
-
get boundary() {
|
|
157
|
-
return this._boundary ??= this.source.commonAncestor(this.target);
|
|
158
|
-
}
|
|
159
|
-
/**
|
|
160
|
-
* Human readable expression of the connection
|
|
161
|
-
* Mostly used for testing and debugging
|
|
162
|
-
*/
|
|
163
|
-
get expression() {
|
|
164
|
-
return `${this.source.id} -> ${this.target.id}`;
|
|
165
|
-
}
|
|
166
|
-
/**
|
|
167
|
-
* Returns true if only includes relations between the source and target elements.
|
|
168
|
-
*/
|
|
169
|
-
get isDirect() {
|
|
170
|
-
return this.nonEmpty() && !this.isImplicit;
|
|
171
|
-
}
|
|
172
|
-
/**
|
|
173
|
-
* Returns true if includes relations between nested elements of the source and target elements.
|
|
174
|
-
*/
|
|
175
|
-
get isImplicit() {
|
|
176
|
-
return this.nonEmpty() && isome(this.relations, e(hasSameSourceTarget(this)));
|
|
177
|
-
}
|
|
178
|
-
get directRelations() {
|
|
179
|
-
return new Set(ifilter(this.relations, hasSameSourceTarget(this)));
|
|
180
|
-
}
|
|
181
|
-
nonEmpty() {
|
|
182
|
-
return this.relations.size > 0;
|
|
183
|
-
}
|
|
184
|
-
mergeWith(other) {
|
|
185
|
-
invariant(this.source.id === other.source.id, "Cannot merge connections with different sources");
|
|
186
|
-
invariant(this.target.id === other.target.id, "Cannot merge connections with different targets");
|
|
187
|
-
return new ConnectionModel(this.source, this.target, union(this.relations, other.relations));
|
|
188
|
-
}
|
|
189
|
-
difference(other) {
|
|
190
|
-
return new ConnectionModel(this.source, this.target, difference(this.relations, other.relations));
|
|
191
|
-
}
|
|
192
|
-
intersect(other) {
|
|
193
|
-
invariant(other instanceof ConnectionModel, "Cannot intersect connection with different type");
|
|
194
|
-
return new ConnectionModel(this.source, this.target, intersection(this.relations, other.relations));
|
|
195
|
-
}
|
|
196
|
-
equals(other) {
|
|
197
|
-
invariant(other instanceof ConnectionModel, "Cannot merge connection with different type");
|
|
198
|
-
const _other = other;
|
|
199
|
-
return this.id === _other.id && this.source.id === _other.source.id && this.target.id === _other.target.id && equals(this.relations, _other.relations);
|
|
200
|
-
}
|
|
201
|
-
/**
|
|
202
|
-
* Returns a new instance with the updated relations.
|
|
203
|
-
*
|
|
204
|
-
* @param relations - A readonly set of `RelationshipModel` instances representing the new relations.
|
|
205
|
-
* @returns A new `ConnectionModel` instance with the updated relations.
|
|
206
|
-
*/
|
|
207
|
-
update(relations) {
|
|
208
|
-
return new ConnectionModel(this.source, this.target, relations);
|
|
209
|
-
}
|
|
210
|
-
[customInspectSymbol](_depth, _inspectOptions, _inspect) {
|
|
211
|
-
const asString = this.toString();
|
|
212
|
-
Object.defineProperty(asString, "constructor", {
|
|
213
|
-
value: ConnectionModel,
|
|
214
|
-
enumerable: false
|
|
215
|
-
});
|
|
216
|
-
return asString;
|
|
217
|
-
}
|
|
218
|
-
toString() {
|
|
219
|
-
return [
|
|
220
|
-
this.expression,
|
|
221
|
-
this.relations.size ? " relations:" : " relations: [ ]",
|
|
222
|
-
...[...this.relations].map((c) => " " + c.expression)
|
|
223
|
-
].join("\n");
|
|
224
|
-
}
|
|
225
|
-
/**
|
|
226
|
-
* Creates a new connection with reversed direction (target becomes source and vice versa)
|
|
227
|
-
*/
|
|
228
|
-
reversed() {
|
|
229
|
-
return new ConnectionModel(this.target, this.source);
|
|
230
|
-
}
|
|
231
|
-
};
|
|
232
|
-
|
|
233
|
-
//#endregion
|
|
234
|
-
//#region src/model/connection/model/find.ts
|
|
235
|
-
var find_exports = /* @__PURE__ */ __exportAll({
|
|
236
|
-
findConnection: () => findConnection,
|
|
237
|
-
findConnectionsBetween: () => findConnectionsBetween,
|
|
238
|
-
findConnectionsWithin: () => findConnectionsWithin
|
|
239
|
-
});
|
|
240
|
-
/**
|
|
241
|
-
* Resolve connection from source to target
|
|
242
|
-
*
|
|
243
|
-
* @param direction - if 'both', also returns connection from target to source
|
|
244
|
-
* @default `directed`
|
|
245
|
-
*/
|
|
246
|
-
function findConnection(source, target, direction = "directed") {
|
|
247
|
-
if (source === target) return [];
|
|
248
|
-
if (isSameHierarchy(source, target)) return [];
|
|
249
|
-
const directedIntersection = intersection(source.allOutgoing, target.allIncoming);
|
|
250
|
-
const directed = directedIntersection.size > 0 ? new ConnectionModel(source, target, directedIntersection) : null;
|
|
251
|
-
if (direction === "directed") return directed ? [directed] : [];
|
|
252
|
-
const reverseIntersection = intersection(source.allIncoming, target.allOutgoing);
|
|
253
|
-
const reverse = reverseIntersection.size > 0 ? new ConnectionModel(target, source, reverseIntersection) : null;
|
|
254
|
-
if (directed && reverse) return [directed, reverse];
|
|
255
|
-
if (directed) return [directed];
|
|
256
|
-
if (reverse) return [reverse];
|
|
257
|
-
return [];
|
|
258
|
-
}
|
|
259
|
-
/**
|
|
260
|
-
* Resolve all connections between element and others
|
|
261
|
-
* @param direction - if 'directed', only look for outgoing connections from the element to others
|
|
262
|
-
* @default `both`
|
|
263
|
-
*/
|
|
264
|
-
function findConnectionsBetween(element, others, direction = "both") {
|
|
265
|
-
if (element.allIncoming.size === 0 && element.allOutgoing.size === 0) return [];
|
|
266
|
-
const outgoing = [];
|
|
267
|
-
const incoming = [];
|
|
268
|
-
for (const _other of others) {
|
|
269
|
-
if (element === _other) continue;
|
|
270
|
-
for (const found of findConnection(element, _other, direction)) if (found.source === element) outgoing.push(found);
|
|
271
|
-
else incoming.push(found);
|
|
272
|
-
}
|
|
273
|
-
return [...outgoing, ...incoming];
|
|
274
|
-
}
|
|
275
|
-
/**
|
|
276
|
-
* Resolve all connections within a given set of elements
|
|
277
|
-
*/
|
|
278
|
-
function findConnectionsWithin(elements) {
|
|
279
|
-
return [...elements].reduce((acc, el, index, array) => {
|
|
280
|
-
if (index === array.length - 1) return acc;
|
|
281
|
-
acc.push(...findConnectionsBetween(el, array.slice(index + 1), "both"));
|
|
282
|
-
return acc;
|
|
283
|
-
}, []);
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
//#endregion
|
|
287
|
-
export { mergeConnections as _, ConnectionModel as a, findDeepestNestedConnection as c, hasSameSourceTarget as d, hasSameTarget as f, isOutgoing as g, isNestedConnection as h, find_exports as i, findDescendantConnections as l, isIncoming as m, findConnectionsBetween as n, differenceConnections as o, isAnyInOut as p, findConnectionsWithin as r, findAscendingConnections as s, findConnection as t, hasSameSource as u, sortConnectionsByBoundaryHierarchy as v, sortDeepestFirst as y };
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { h as Fqn, j as ProjectId, n as Any, p as ElementId, u as DeploymentId, vt as ExclusiveUnion } from "./_aux.mjs";
|
|
2
|
-
|
|
3
|
-
//#region src/types/fqnRef.d.ts
|
|
4
|
-
type AnyAux = Any;
|
|
5
|
-
declare namespace FqnRef {
|
|
6
|
-
/**
|
|
7
|
-
* Reference to logical model element
|
|
8
|
-
*/
|
|
9
|
-
interface ElementRef<A extends AnyAux = AnyAux> {
|
|
10
|
-
project?: never;
|
|
11
|
-
model: ElementId<A>;
|
|
12
|
-
}
|
|
13
|
-
function isElementRef<A extends AnyAux>(ref: FqnRef<A>): ref is ElementRef<A>;
|
|
14
|
-
/**
|
|
15
|
-
* Reference to imported logical model element
|
|
16
|
-
*/
|
|
17
|
-
interface ImportRef<A extends AnyAux = AnyAux> {
|
|
18
|
-
project: ProjectId<A>;
|
|
19
|
-
model: ElementId<A>;
|
|
20
|
-
}
|
|
21
|
-
function isImportRef<A extends AnyAux>(ref: FqnRef<A>): ref is ImportRef<A>;
|
|
22
|
-
function flatten<A extends AnyAux>(ref: FqnRef<A>): Fqn<A>;
|
|
23
|
-
type ModelRef<A extends AnyAux = AnyAux> = ImportRef<A> | ElementRef<A>;
|
|
24
|
-
function isModelRef<A extends AnyAux>(ref: FqnRef<A>): ref is ModelRef<A>;
|
|
25
|
-
/**
|
|
26
|
-
* Represents a reference to an instance within a deployment.
|
|
27
|
-
*
|
|
28
|
-
* @template D - The type representing the deployment fqn. Defaults to `Fqn`.
|
|
29
|
-
* @template M - The type representing the model fqn. Defaults to `Fqn`.
|
|
30
|
-
*
|
|
31
|
-
* @property {D} deployment - TThe fully qualified name (FQN) of the deployed instance.
|
|
32
|
-
* @property {M} element - The element reference within the deployment.
|
|
33
|
-
*/
|
|
34
|
-
interface InsideInstanceRef<A extends AnyAux = AnyAux> {
|
|
35
|
-
deployment: DeploymentId<A>;
|
|
36
|
-
element: ElementId<A>;
|
|
37
|
-
}
|
|
38
|
-
function isInsideInstanceRef<A extends AnyAux>(ref: FqnRef<A>): ref is InsideInstanceRef<A>;
|
|
39
|
-
/**
|
|
40
|
-
* Represents a reference to a deployment element.
|
|
41
|
-
*
|
|
42
|
-
* @template F - The type of the fully qualified name (FQN) of the deployment element. Defaults to `Fqn`.
|
|
43
|
-
* @property {F} deployment - The fully qualified name (FQN) of the deployment element.
|
|
44
|
-
*/
|
|
45
|
-
interface DeploymentElementRef<A extends AnyAux> {
|
|
46
|
-
deployment: DeploymentId<A>;
|
|
47
|
-
element?: never;
|
|
48
|
-
}
|
|
49
|
-
function isDeploymentElementRef<A extends AnyAux>(ref: FqnRef<A>): ref is DeploymentElementRef<A>;
|
|
50
|
-
type DeploymentRef<A extends AnyAux> = DeploymentElementRef<A> | InsideInstanceRef<A>;
|
|
51
|
-
function isDeploymentRef<A extends AnyAux>(ref: FqnRef<A>): ref is DeploymentRef<A>;
|
|
52
|
-
}
|
|
53
|
-
type FqnRef<A extends AnyAux = AnyAux> = ExclusiveUnion<{
|
|
54
|
-
DeploymentRef: FqnRef.DeploymentRef<A>;
|
|
55
|
-
ModelRef: FqnRef.ModelRef<A>;
|
|
56
|
-
}>;
|
|
57
|
-
//#endregion
|
|
58
|
-
export { FqnRef as t };
|
package/dist/_chunks/fqnRef.mjs
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { O as e } from "./libs/remeda.mjs";
|
|
2
|
-
import { i as GlobalFqn } from "./scalar.mjs";
|
|
3
|
-
|
|
4
|
-
//#region src/types/fqnRef.ts
|
|
5
|
-
let FqnRef;
|
|
6
|
-
(function(_FqnRef) {
|
|
7
|
-
function isElementRef(ref) {
|
|
8
|
-
return "model" in ref && !("project" in ref);
|
|
9
|
-
}
|
|
10
|
-
_FqnRef.isElementRef = isElementRef;
|
|
11
|
-
function isImportRef(ref) {
|
|
12
|
-
return "project" in ref && "model" in ref;
|
|
13
|
-
}
|
|
14
|
-
_FqnRef.isImportRef = isImportRef;
|
|
15
|
-
function flatten(ref) {
|
|
16
|
-
if (e(ref)) throw new Error(`Expected FqnRef, got: "${ref}"`);
|
|
17
|
-
if (isImportRef(ref)) return GlobalFqn(ref.project, ref.model);
|
|
18
|
-
if (isElementRef(ref)) return ref.model;
|
|
19
|
-
throw new Error("Expected FqnRef.ModelRef or FqnRef.ImportRef");
|
|
20
|
-
}
|
|
21
|
-
_FqnRef.flatten = flatten;
|
|
22
|
-
function isModelRef(ref) {
|
|
23
|
-
return isElementRef(ref) || isImportRef(ref);
|
|
24
|
-
}
|
|
25
|
-
_FqnRef.isModelRef = isModelRef;
|
|
26
|
-
function isInsideInstanceRef(ref) {
|
|
27
|
-
return "deployment" in ref && "element" in ref;
|
|
28
|
-
}
|
|
29
|
-
_FqnRef.isInsideInstanceRef = isInsideInstanceRef;
|
|
30
|
-
function isDeploymentElementRef(ref) {
|
|
31
|
-
return "deployment" in ref && !("element" in ref);
|
|
32
|
-
}
|
|
33
|
-
_FqnRef.isDeploymentElementRef = isDeploymentElementRef;
|
|
34
|
-
function isDeploymentRef(ref) {
|
|
35
|
-
return isDeploymentElementRef(ref) || isInsideInstanceRef(ref);
|
|
36
|
-
}
|
|
37
|
-
_FqnRef.isDeploymentRef = isDeploymentRef;
|
|
38
|
-
})(FqnRef || (FqnRef = {}));
|
|
39
|
-
|
|
40
|
-
//#endregion
|
|
41
|
-
export { FqnRef as t };
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { G as Unknown, Y as ViewId, n as Any, p as ElementId } from "./_aux.mjs";
|
|
2
|
-
import { C as ElementModel, T as RelationshipModel, n as LikeC4Model } from "./LikeC4Model.mjs";
|
|
3
|
-
|
|
4
|
-
//#region src/compute-view/relationships-view/_types.d.ts
|
|
5
|
-
type RelationshipsViewData<M extends Any = Unknown> = {
|
|
6
|
-
incomers: ReadonlySet<ElementModel<M>>;
|
|
7
|
-
incoming: ReadonlySet<RelationshipModel<M>>;
|
|
8
|
-
subjects: ReadonlySet<ElementModel<M>>;
|
|
9
|
-
outgoing: ReadonlySet<RelationshipModel<M>>;
|
|
10
|
-
outgoers: ReadonlySet<ElementModel<M>>;
|
|
11
|
-
};
|
|
12
|
-
//#endregion
|
|
13
|
-
//#region src/compute-view/relationships-view/compute.d.ts
|
|
14
|
-
declare function computeRelationshipsView<M extends Any>(subjectId: ElementId<M>, likec4model: LikeC4Model<M>, scopeViewId: ViewId<M> | null, scope?: 'global' | 'view'): RelationshipsViewData<M>;
|
|
15
|
-
//#endregion
|
|
16
|
-
//#region src/compute-view/relationships-view/utils.d.ts
|
|
17
|
-
declare function treeFromElements<M extends Any>(elements: Iterable<ElementModel<M>>): {
|
|
18
|
-
sorted: readonly ElementModel<M>[];
|
|
19
|
-
byId: (id: ElementId<M>) => ElementModel<M>;
|
|
20
|
-
root: ReadonlySet<ElementModel<M>>;
|
|
21
|
-
parent: (el: ElementModel<M>) => ElementModel<M> | null;
|
|
22
|
-
children: (el: ElementModel<M>) => ReadonlyArray<ElementModel<M>>;
|
|
23
|
-
/**
|
|
24
|
-
* Flattens the tree structure by removing redundant hierarchy levels.
|
|
25
|
-
* @example
|
|
26
|
-
* A
|
|
27
|
-
* └── B
|
|
28
|
-
* ├── C
|
|
29
|
-
* │ └── D
|
|
30
|
-
* │ └── E
|
|
31
|
-
* └── F
|
|
32
|
-
* └── G
|
|
33
|
-
* becomes
|
|
34
|
-
* A
|
|
35
|
-
* ├── C
|
|
36
|
-
* │ └── E
|
|
37
|
-
* └── F
|
|
38
|
-
* └── G
|
|
39
|
-
*/
|
|
40
|
-
flatten: () => Set<ElementModel<M>>;
|
|
41
|
-
};
|
|
42
|
-
//#endregion
|
|
43
|
-
export { computeRelationshipsView as n, RelationshipsViewData as r, treeFromElements as t };
|