@likec4/core 1.18.0 → 1.19.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/LICENSE +1 -1
- package/dist/builder/index.d.mts +502 -0
- package/dist/builder/index.d.ts +502 -0
- package/dist/builder/index.js +871 -0
- package/dist/compute-view/index.d.mts +9 -78
- package/dist/compute-view/index.d.ts +9 -78
- package/dist/compute-view/index.js +78 -0
- package/dist/index.d.mts +9 -730
- package/dist/index.d.ts +9 -730
- package/dist/{index.mjs → index.js} +7 -784
- package/dist/model/index.d.mts +218 -606
- package/dist/model/index.d.ts +218 -606
- package/dist/model/index.js +1 -0
- package/dist/shared/chunk-RAAYCPUM.M-JWF7SS.js +21 -0
- package/dist/shared/core.BIfgabEw.d.ts +719 -0
- package/dist/shared/core.BZ9Msq7w.d.mts +719 -0
- package/dist/shared/{core.DMYY7C8s.d.mts → core.C05RDLhi.d.ts} +179 -230
- package/dist/shared/{core.DMYY7C8s.d.ts → core.CmYMqgha.d.mts} +179 -230
- package/dist/shared/core.D6-fWbM3.d.ts +127 -0
- package/dist/shared/core.D74xkKkG.d.mts +148 -0
- package/dist/shared/core.D74xkKkG.d.ts +148 -0
- package/dist/shared/core.sLaWHBjR.d.mts +127 -0
- package/dist/shared/index.DafVOuVd.js +7443 -0
- package/dist/shared/object_hash.CE_oF3I3.js +1222 -0
- package/dist/shared/view.CyZrG8BJ.js +354 -0
- package/dist/types/index.d.mts +4 -2
- package/dist/types/index.d.ts +4 -2
- package/dist/types/index.js +20 -0
- package/dist/utils/index.d.mts +419 -0
- package/dist/utils/index.d.ts +419 -0
- package/dist/utils/index.js +347 -0
- package/package.json +47 -33
- package/src/builder/Builder-style1.test-d.ts +190 -0
- package/src/builder/Builder-style2.test-d.ts +175 -0
- package/src/builder/Builder.deployment.ts +25 -20
- package/src/builder/Builder.deploymentModel.ts +80 -55
- package/src/builder/Builder.element.ts +2 -0
- package/src/builder/Builder.model.ts +57 -43
- package/src/builder/Builder.ts +412 -431
- package/src/builder/Builder.view-common.ts +234 -0
- package/src/builder/Builder.view-deployment.ts +135 -0
- package/src/builder/Builder.view-element.ts +189 -0
- package/src/builder/Builder.views.ts +109 -33
- package/src/builder/Builder.with.ts +475 -0
- package/src/builder/__snapshots__/Builder-style1.spec.ts.snap +374 -0
- package/src/builder/__snapshots__/Builder-style2.spec.ts.snap +183 -0
- package/src/builder/__snapshots__/Builder.spec.ts.snap +374 -0
- package/src/builder/_types.ts +28 -5
- package/src/builder/index.ts +10 -4
- package/src/colors/index.ts +2 -2
- package/src/compute-view/compute-view.ts +45 -54
- package/src/compute-view/deployment-view/__test__/TestHelper.ts +236 -0
- package/src/compute-view/deployment-view/__test__/fixture.ts +50 -62
- package/src/compute-view/deployment-view/_types.ts +26 -18
- package/src/compute-view/deployment-view/clean-connections.ts +173 -164
- package/src/compute-view/deployment-view/compute.ts +51 -37
- package/src/compute-view/deployment-view/memory/index.ts +9 -0
- package/src/compute-view/deployment-view/memory/memory.ts +97 -0
- package/src/compute-view/deployment-view/predicates/elements.ts +144 -0
- package/src/compute-view/deployment-view/predicates/relation-direct.ts +183 -76
- package/src/compute-view/deployment-view/predicates/relation-in-out.ts +38 -20
- package/src/compute-view/deployment-view/predicates/relation-incoming.ts +72 -23
- package/src/compute-view/deployment-view/predicates/relation-outgoing.ts +61 -22
- package/src/compute-view/deployment-view/predicates/wildcard.ts +15 -15
- package/src/compute-view/deployment-view/stages/stage-exclude.ts +5 -0
- package/src/compute-view/deployment-view/stages/stage-final.ts +245 -0
- package/src/compute-view/deployment-view/stages/stage-include.ts +95 -0
- package/src/compute-view/deployment-view/utils.ts +95 -31
- package/src/compute-view/dynamic-view/__test__/fixture.ts +4 -4
- package/src/compute-view/dynamic-view/compute.ts +59 -45
- package/src/compute-view/element-view/__test__/TestHelper.ts +258 -0
- package/src/compute-view/element-view/__test__/__snapshots__/legacy.spec.ts.snap +64 -62
- package/src/compute-view/element-view/__test__/fixture.ts +147 -117
- package/src/compute-view/element-view/_types.ts +48 -0
- package/src/compute-view/element-view/clean-connections.ts +113 -0
- package/src/compute-view/element-view/compute.ts +264 -683
- package/src/compute-view/element-view/memory/NodeGroup.ts +31 -0
- package/src/compute-view/element-view/memory/index.ts +10 -0
- package/src/compute-view/element-view/memory/memory.ts +177 -0
- package/src/compute-view/element-view/memory/stage-exclude.ts +59 -0
- package/src/compute-view/element-view/memory/stage-final.ts +129 -0
- package/src/compute-view/element-view/memory/stage-include.ts +128 -0
- package/src/compute-view/element-view/predicates/_utils.ts +86 -0
- package/src/compute-view/element-view/predicates/element-expand.ts +33 -0
- package/src/compute-view/element-view/predicates/element-kind-tag.ts +26 -0
- package/src/compute-view/element-view/predicates/element-ref.ts +37 -0
- package/src/compute-view/element-view/predicates/relation-direct.ts +309 -0
- package/src/compute-view/element-view/predicates/relation-in-out.ts +66 -0
- package/src/compute-view/element-view/predicates/relation-in.ts +118 -0
- package/src/compute-view/element-view/predicates/relation-out.ts +116 -0
- package/src/compute-view/element-view/predicates/wildcard.ts +88 -0
- package/src/compute-view/element-view/utils.ts +59 -0
- package/src/compute-view/index.ts +3 -4
- package/src/compute-view/memory/AbstractMemory.ts +45 -0
- package/src/compute-view/memory/AbstractStageExclude.ts +216 -0
- package/src/compute-view/memory/AbstractStageInclude.ts +200 -0
- package/src/compute-view/memory/_types.ts +147 -0
- package/src/compute-view/memory/index.ts +5 -0
- package/src/compute-view/memory/ops.ts +43 -0
- package/src/compute-view/utils/buildComputedNodes.ts +4 -4
- package/src/compute-view/utils/elementExpressionToPredicate.ts +1 -3
- package/src/compute-view/utils/link-nodes-with-edges.ts +3 -7
- package/src/compute-view/utils/{derive-edge-props-from-relationships.ts → merge-props-from-relationships.ts} +54 -23
- package/src/compute-view/utils/relationExpressionToPredicates.ts +2 -2
- package/src/compute-view/utils/resolve-extended-views.ts +44 -40
- package/src/compute-view/utils/resolve-global-rules.ts +6 -6
- package/src/compute-view/utils/topological-sort.ts +167 -71
- package/src/compute-view/utils/with-readable-edges.ts +14 -9
- package/src/index.ts +22 -16
- package/src/model/DeploymentElementModel.ts +150 -85
- package/src/model/DeploymentModel.ts +27 -21
- package/src/model/ElementModel.ts +51 -25
- package/src/model/LikeC4Model.test-d.ts +4 -3
- package/src/model/LikeC4Model.ts +98 -42
- package/src/model/RelationModel.ts +5 -4
- package/src/model/__test__/fixture.ts +5 -9
- package/src/model/connection/Connection.ts +72 -0
- package/src/model/connection/deployment/DeploymentConnectionModel.ts +178 -0
- package/src/model/connection/{deployment.ts → deployment/find.ts} +14 -18
- package/src/model/connection/deployment/index.ts +8 -0
- package/src/model/connection/index.ts +22 -0
- package/src/model/connection/model/ConnectionModel.ts +157 -0
- package/src/model/connection/{model.ts → model/find.ts} +43 -49
- package/src/model/connection/model/index.ts +8 -0
- package/src/model/connection/ops.ts +274 -0
- package/src/model/guards.ts +9 -0
- package/src/model/index.ts +45 -3
- package/src/model/types.ts +35 -18
- package/src/model/view/EdgeModel.ts +6 -6
- package/src/model/view/LikeC4ViewModel.ts +14 -8
- package/src/model/view/NodeModel.ts +6 -5
- package/src/types/_common.ts +53 -1
- package/src/types/deployments.ts +88 -156
- package/src/types/element.ts +2 -2
- package/src/types/expression-v2.ts +172 -0
- package/src/types/expression.ts +9 -5
- package/src/types/global.ts +3 -3
- package/src/types/index.ts +220 -13
- package/src/types/model.ts +28 -24
- package/src/types/operators.ts +1 -1
- package/src/types/relation.ts +14 -10
- package/src/types/theme.ts +0 -1
- package/src/types/view.ts +20 -18
- package/src/utils/const.ts +1 -0
- package/src/utils/fqn.ts +140 -49
- package/src/utils/getOrCreate.ts +1 -1
- package/src/utils/index.ts +75 -9
- package/src/utils/iterable/_types.ts +5 -0
- package/src/utils/iterable/filter.ts +55 -0
- package/src/utils/iterable/find.ts +36 -0
- package/src/utils/iterable/flat.ts +17 -0
- package/src/utils/iterable/index.ts +13 -0
- package/src/utils/iterable/map.ts +40 -0
- package/src/utils/iterable/reduce.ts +24 -0
- package/src/utils/iterable/some.ts +36 -0
- package/src/utils/iterable/to.ts +19 -0
- package/src/utils/iterable/unique.ts +29 -0
- package/src/utils/relations.ts +3 -64
- package/src/utils/set.ts +11 -9
- package/src/utils/string-hash.ts +1 -1
- package/dist/compute-view/index.mjs +0 -79
- package/dist/model/index.mjs +0 -2
- package/dist/shared/core.BBgiAAv1.mjs +0 -144
- package/dist/shared/core.BPyJvuMU.mjs +0 -2420
- package/dist/shared/core.BQ4AbfvB.mjs +0 -9228
- package/dist/shared/core.k12s_keD.mjs +0 -203
- package/dist/types/index.mjs +0 -21
- package/src/builder/Builder.test-d.ts +0 -124
- package/src/builder/Builder.view.ts +0 -543
- package/src/compute-view/LikeC4ModelGraph.ts +0 -330
- package/src/compute-view/deployment-view/Memory.ts +0 -108
- package/src/compute-view/deployment-view/Stage.ts +0 -145
- package/src/compute-view/deployment-view/predicates/deployment-ref.ts +0 -146
- package/src/compute-view/element-view/predicates.ts +0 -517
- package/src/compute-view/utils/sortNodes.ts +0 -101
- package/src/model/connection/ConnectionModel.ts +0 -94
- package/src/model/connection/DeploymentConnectionModel.ts +0 -99
package/dist/model/index.d.mts
CHANGED
|
@@ -1,642 +1,254 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { E as ElementModel, D as DeploymentElementModel, A as AnyAux, f as DeploymentNodeModel, g as DeployedInstanceModel, R as RelationshipsAccum, h as RelationshipModel, i as DeploymentRelationModel } from '../shared/core.BZ9Msq7w.mjs';
|
|
2
|
+
export { b as Aux, j as EdgeModel, L as LikeC4DeploymentModel, d as LikeC4Model, e as LikeC4ViewModel, N as NodeModel } from '../shared/core.BZ9Msq7w.mjs';
|
|
3
|
+
import { F as Fqn, a as IteratorLike } from '../shared/core.D74xkKkG.mjs';
|
|
4
|
+
import { I as IterableContainer, R as ReorderedArray } from '../shared/core.sLaWHBjR.mjs';
|
|
5
|
+
import 'type-fest';
|
|
6
|
+
import '../shared/core.CmYMqgha.mjs';
|
|
3
7
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
id: Id;
|
|
9
|
-
};
|
|
10
|
-
type WithViews<Id extends string, ViewType> = {
|
|
11
|
-
views: Record<Id, ViewType>;
|
|
12
|
-
};
|
|
13
|
-
type AnyAux = Aux<string, string, string, any>;
|
|
14
|
-
/**
|
|
15
|
-
* Auxilary type to keep track
|
|
16
|
-
*/
|
|
17
|
-
interface Aux<Element extends string, Deployment extends string, Views extends string, ViewType> {
|
|
18
|
-
Fqn: IsLiteral<Element> extends true ? Fqn<Element> : Fqn;
|
|
19
|
-
Element: Element;
|
|
20
|
-
ElementOrFqn: Element | WithId<this['Fqn']>;
|
|
21
|
-
DeploymentFqn: IsLiteral<Deployment> extends true ? Fqn<Deployment> : Fqn;
|
|
22
|
-
Deployment: Deployment;
|
|
23
|
-
DeploymentOrFqn: Deployment | WithId<this['DeploymentFqn']>;
|
|
24
|
-
ViewId: IsLiteral<Views> extends true ? ViewId<Views> : ViewId;
|
|
25
|
-
ViewIdLiteral: Views;
|
|
26
|
-
ViewType: ViewType;
|
|
27
|
-
RelationId: RelationId;
|
|
28
|
-
NodeId: NodeId;
|
|
29
|
-
NodeIdLiteral: string;
|
|
30
|
-
EdgeId: EdgeId;
|
|
31
|
-
EdgeIdLiteral: string;
|
|
32
|
-
NodeOrId: LiteralUnion<this['NodeIdLiteral'], string> | WithId<this['NodeId']>;
|
|
33
|
-
EdgeOrId: LiteralUnion<this['EdgeIdLiteral'], string> | WithId<this['EdgeId']>;
|
|
34
|
-
Model: Simplify<Omit<AnyLikeC4Model, 'views'> & WithViews<this['ViewId'], ViewType>>;
|
|
35
|
-
}
|
|
36
|
-
declare namespace Aux {
|
|
37
|
-
type FromModel<M> = M extends AnyLikeC4Model ? Aux<KeysOf<M['elements']>, KeysOf<M['deployments']['elements']>, KeysOf<M['views']>, M extends LayoutedLikeC4Model ? DiagramView<ViewId<KeysOf<M['views']>>, string> : ComputedView<ViewId<KeysOf<M['views']>>, string>> : never;
|
|
38
|
-
type FromDump<M> = M extends ParsedLikeC4ModelDump ? Aux<KeysOf<M['elements']>, KeysOf<M['deployments']['elements']>, KeysOf<M['views']>, DiagramView<ViewId<KeysOf<M['views']>>, string>> : never;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
type RelationshipsIterator<M extends AnyAux> = IteratorLike<RelationshipModel<M>>;
|
|
42
|
-
declare class RelationshipModel<M extends AnyAux> {
|
|
43
|
-
readonly model: LikeC4Model<M>;
|
|
44
|
-
readonly $relationship: Relation;
|
|
45
|
-
readonly source: ElementModel<M>;
|
|
46
|
-
readonly target: ElementModel<M>;
|
|
8
|
+
interface Connection<Elem = ElementModel | DeploymentElementModel, Id = string> {
|
|
9
|
+
readonly id: Id;
|
|
10
|
+
readonly source: Elem;
|
|
11
|
+
readonly target: Elem;
|
|
47
12
|
/**
|
|
48
13
|
* Common ancestor of the source and target elements.
|
|
49
|
-
* Represents the boundary of the
|
|
50
|
-
*/
|
|
51
|
-
readonly boundary:
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
type
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
get color(): ThemeColor;
|
|
76
|
-
get tags(): ReadonlyArray<Tag>;
|
|
77
|
-
get title(): string;
|
|
78
|
-
get description(): string | null;
|
|
79
|
-
get technology(): string | null;
|
|
80
|
-
get links(): ReadonlyArray<Link>;
|
|
81
|
-
get parent(): ElementModel<M> | null;
|
|
82
|
-
get defaultView(): LikeC4ViewModel<M> | null;
|
|
83
|
-
/**
|
|
84
|
-
* Get all ancestor elements (i.e. parent, parent’s parent, etc.)
|
|
85
|
-
* (from closest to root)
|
|
86
|
-
*/
|
|
87
|
-
ancestors(): ElementsIterator<M>;
|
|
88
|
-
/**
|
|
89
|
-
* Returns the common ancestor of this element and another element.
|
|
90
|
-
*/
|
|
91
|
-
commonAncestor(another: ElementModel<M>): ElementModel<M> | null;
|
|
92
|
-
children(): ReadonlySet<ElementModel<M>>;
|
|
93
|
-
/**
|
|
94
|
-
* Get all descendant elements (i.e. children, children’s children, etc.)
|
|
95
|
-
*/
|
|
96
|
-
descendants(): ElementsIterator<M>;
|
|
97
|
-
/**
|
|
98
|
-
* Get all sibling (i.e. same parent)
|
|
99
|
-
*/
|
|
100
|
-
siblings(): ElementsIterator<M>;
|
|
101
|
-
/**
|
|
102
|
-
* Resolve siblings of the element and its ancestors
|
|
103
|
-
* (from closest to root)
|
|
104
|
-
*/
|
|
105
|
-
ascendingSiblings(): ElementsIterator<M>;
|
|
106
|
-
incoming(filter?: IncomingFilter): RelationshipsIterator<M>;
|
|
107
|
-
incomers(filter?: IncomingFilter): ElementsIterator<M>;
|
|
108
|
-
outgoing(filter?: OutgoingFilter): RelationshipsIterator<M>;
|
|
109
|
-
outgoers(filter?: OutgoingFilter): ElementsIterator<M>;
|
|
110
|
-
protected cachedOutgoing: Set<RelationshipModel<M>> | null;
|
|
111
|
-
protected cachedIncoming: Set<RelationshipModel<M>> | null;
|
|
112
|
-
get allOutgoing(): ReadonlySet<RelationshipModel<M>>;
|
|
113
|
-
get allIncoming(): ReadonlySet<RelationshipModel<M>>;
|
|
114
|
-
/**
|
|
115
|
-
* Iterate over all views that include this element.
|
|
116
|
-
*/
|
|
117
|
-
views(): ViewsIterator<M>;
|
|
118
|
-
/**
|
|
119
|
-
* Iterate over all views that scope this element.
|
|
120
|
-
* It is possible that element is not included in the view.
|
|
121
|
-
*/
|
|
122
|
-
scopedViews(): ViewsIterator<M>;
|
|
123
|
-
/**
|
|
124
|
-
* @returns true if the element is deployed
|
|
125
|
-
*/
|
|
126
|
-
isDeployed(): boolean;
|
|
127
|
-
deployments(): DeployedInstancesIterator<M>;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
type NodesIterator<M extends AnyAux, V extends ComputedView | DiagramView> = IteratorLike<NodeModel<M, V>>;
|
|
131
|
-
declare namespace NodeModel {
|
|
132
|
-
interface WithParent<M extends AnyAux, V extends ComputedView | DiagramView> extends NodeModel<M, V> {
|
|
133
|
-
parent: NodeModel<M, V>;
|
|
134
|
-
}
|
|
135
|
-
interface WithElement<M extends AnyAux, V extends ComputedView | DiagramView> extends NodeModel<M, V> {
|
|
136
|
-
kind: ElementKind;
|
|
137
|
-
element: ElementModel<M>;
|
|
138
|
-
}
|
|
139
|
-
interface WithDeploymentElement<M extends AnyAux, V extends ComputedView | DiagramView> extends NodeModel<M, V> {
|
|
140
|
-
kind: DeploymentNodeKind;
|
|
141
|
-
deployment: DeploymentElementModel<M>;
|
|
142
|
-
}
|
|
143
|
-
interface WithDeployedInstance<M extends AnyAux, V extends ComputedView | DiagramView> extends NodeModel<M, V> {
|
|
144
|
-
kind: 'instance';
|
|
145
|
-
element: ElementModel<M>;
|
|
146
|
-
deployment: DeployedInstanceModel<M>;
|
|
147
|
-
}
|
|
148
|
-
interface IsGroup<M extends AnyAux, V extends ComputedView | DiagramView> extends NodeModel<M, V> {
|
|
149
|
-
kind: typeof ElementKind.Group;
|
|
150
|
-
element: null;
|
|
151
|
-
deployment: null;
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
declare class NodeModel<M extends AnyAux, V extends ComputedView | DiagramView = M['ViewType']> {
|
|
155
|
-
readonly $view: LikeC4ViewModel<M, V>;
|
|
156
|
-
readonly $node: V['nodes'][number];
|
|
157
|
-
constructor($view: LikeC4ViewModel<M, V>, $node: V['nodes'][number]);
|
|
158
|
-
get id(): NodeId;
|
|
159
|
-
get title(): string;
|
|
160
|
-
get kind(): ElementKind | DeploymentNodeKind | typeof ElementKind.Group | 'instance';
|
|
161
|
-
get description(): string | null;
|
|
162
|
-
get technology(): string | null;
|
|
163
|
-
get parent(): NodeModel<M, V> | null;
|
|
164
|
-
get element(): ElementModel<M> | null;
|
|
165
|
-
get deployment(): DeploymentElementModel<M> | null;
|
|
166
|
-
get shape(): ElementShape;
|
|
167
|
-
get color(): Color;
|
|
168
|
-
get tags(): ReadonlyArray<Tag>;
|
|
169
|
-
get links(): ReadonlyArray<Link>;
|
|
170
|
-
get navigateTo(): LikeC4ViewModel<M> | null;
|
|
171
|
-
/**
|
|
172
|
-
* Get all ancestor elements (i.e. parent, parent’s parent, etc.)
|
|
173
|
-
* (from closest to root)
|
|
174
|
-
*/
|
|
175
|
-
ancestors(): NodesIterator<M, V>;
|
|
176
|
-
children(): NodesIterator<M, V>;
|
|
177
|
-
sublings(): NodesIterator<M, V>;
|
|
178
|
-
incoming(filter?: IncomingFilter): EdgesIterator<M, V>;
|
|
179
|
-
incomers(filter?: IncomingFilter): NodesIterator<M, V>;
|
|
180
|
-
outgoing(filter?: OutgoingFilter): EdgesIterator<M, V>;
|
|
181
|
-
outgoers(filter?: OutgoingFilter): NodesIterator<M, V>;
|
|
182
|
-
isDiagramNode(): this is NodeModel<M, DiagramView>;
|
|
183
|
-
hasChildren(): boolean;
|
|
184
|
-
hasParent(): this is NodeModel.WithParent<M, V>;
|
|
185
|
-
/**
|
|
186
|
-
* Check if this node references to logical model element.
|
|
187
|
-
*/
|
|
188
|
-
hasElement(): this is NodeModel.WithElement<M, V>;
|
|
189
|
-
/**
|
|
190
|
-
* Check if this node references to deployment element (Node or Instance).
|
|
191
|
-
*/
|
|
192
|
-
hasDeployment(): this is NodeModel.WithDeploymentElement<M, V>;
|
|
193
|
-
/**
|
|
194
|
-
* Check if this node references to deployed instance
|
|
195
|
-
* Deployed instance always references to element and deployment element.
|
|
196
|
-
*/
|
|
197
|
-
hasDeployedInstance(): this is NodeModel.WithDeployedInstance<M, V>;
|
|
198
|
-
isGroup(): this is NodeModel.IsGroup<M, V>;
|
|
14
|
+
* Represents the boundary of the connection.
|
|
15
|
+
*/
|
|
16
|
+
readonly boundary: Elem | null;
|
|
17
|
+
/**
|
|
18
|
+
* Human readable expression of the connection
|
|
19
|
+
* Mostly used for testing and debugging
|
|
20
|
+
*/
|
|
21
|
+
readonly expression: string;
|
|
22
|
+
mergeWith(this: Connection<Elem, Id>, other: typeof this): typeof this;
|
|
23
|
+
nonEmpty(): boolean;
|
|
24
|
+
difference(this: Connection<Elem, Id>, other: typeof this): typeof this;
|
|
25
|
+
intersect(this: Connection<Elem, Id>, other: typeof this): typeof this;
|
|
26
|
+
equals(other: Connection): boolean;
|
|
27
|
+
}
|
|
28
|
+
declare namespace Connection {
|
|
29
|
+
type ConnectionPredicate = <C extends Connection<{
|
|
30
|
+
id: string;
|
|
31
|
+
}, any>>(connection: C) => boolean;
|
|
32
|
+
type ElementId = Fqn | string;
|
|
33
|
+
export const isInside: (fqn: ElementId) => ConnectionPredicate;
|
|
34
|
+
export const isDirectedBetween: (source: ElementId, target: ElementId) => ConnectionPredicate;
|
|
35
|
+
export const isAnyBetween: (source: ElementId, target: ElementId) => ConnectionPredicate;
|
|
36
|
+
export const isIncoming: (target: ElementId) => ConnectionPredicate;
|
|
37
|
+
export const isOutgoing: (source: ElementId) => ConnectionPredicate;
|
|
38
|
+
export const isAnyInOut: (source: ElementId) => ConnectionPredicate;
|
|
39
|
+
export { };
|
|
199
40
|
}
|
|
200
41
|
|
|
201
|
-
|
|
202
|
-
declare class EdgeModel<M extends AnyAux, V extends ComputedView | DiagramView = M['ViewType']> {
|
|
203
|
-
readonly view: LikeC4ViewModel<M, V>;
|
|
204
|
-
readonly $edge: V['edges'][number];
|
|
205
|
-
readonly source: NodeModel<M, V>;
|
|
206
|
-
readonly target: NodeModel<M, V>;
|
|
207
|
-
constructor(view: LikeC4ViewModel<M, V>, $edge: V['edges'][number], source: NodeModel<M, V>, target: NodeModel<M, V>);
|
|
208
|
-
get id(): M['EdgeId'];
|
|
209
|
-
get parent(): NodeModel<M, V> | null;
|
|
210
|
-
get label(): string | null;
|
|
211
|
-
get description(): string | null;
|
|
212
|
-
get technology(): string | null;
|
|
213
|
-
hasParent(): this is EdgeModel.WithParent<M, V>;
|
|
214
|
-
get tags(): ReadonlyArray<Tag>;
|
|
215
|
-
get stepNumber(): number | null;
|
|
216
|
-
get navigateTo(): LikeC4ViewModel<M> | null;
|
|
217
|
-
isStep(): this is EdgeModel.StepEdge<M, ComputedDynamicView>;
|
|
218
|
-
relationships(type: 'model'): IteratorLike<RelationshipModel<M>>;
|
|
219
|
-
relationships(type: 'deployment'): IteratorLike<DeploymentRelationModel<M>>;
|
|
220
|
-
relationships(type?: 'model' | 'deployment'): IteratorLike<LikeC4Model.AnyRelation<M>>;
|
|
221
|
-
includesRelation(rel: M['RelationId']): boolean;
|
|
222
|
-
}
|
|
223
|
-
declare namespace EdgeModel {
|
|
224
|
-
interface StepEdge<M extends AnyAux, V extends ComputedView | DiagramView> extends EdgeModel<M, V> {
|
|
225
|
-
id: StepEdgeId;
|
|
226
|
-
stepNumber: number;
|
|
227
|
-
}
|
|
228
|
-
interface WithParent<M extends AnyAux, V extends ComputedView | DiagramView> extends EdgeModel<M, V> {
|
|
229
|
-
parent: NodeModel<M, V>;
|
|
230
|
-
}
|
|
231
|
-
}
|
|
42
|
+
declare const customInspectSymbol: unique symbol;
|
|
232
43
|
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
get links(): ReadonlyArray<Link>;
|
|
244
|
-
get viewOf(): ElementModel<M> | null;
|
|
245
|
-
/**
|
|
246
|
-
* All tags from nodes and edges.
|
|
247
|
-
*/
|
|
248
|
-
get includedTags(): ReadonlyArray<Tag>;
|
|
249
|
-
roots(): NodesIterator<M, V>;
|
|
250
|
-
/**
|
|
251
|
-
* Iterate over all nodes that have children.
|
|
252
|
-
*/
|
|
253
|
-
compounds(): NodesIterator<M, V>;
|
|
254
|
-
/**
|
|
255
|
-
* Get node by id.
|
|
256
|
-
* @throws Error if node is not found.
|
|
257
|
-
*/
|
|
258
|
-
node(node: M['NodeOrId']): NodeModel<M, V>;
|
|
259
|
-
/**
|
|
260
|
-
* Find node by id.
|
|
261
|
-
*/
|
|
262
|
-
findNode(node: M['NodeOrId']): NodeModel<M, V> | null;
|
|
263
|
-
/**
|
|
264
|
-
* Iterate over all nodes.
|
|
265
|
-
*/
|
|
266
|
-
nodes(): NodesIterator<M, V>;
|
|
267
|
-
/**
|
|
268
|
-
* Find edge by id.
|
|
269
|
-
* @param edge Edge or id
|
|
270
|
-
* @returns EdgeModel
|
|
271
|
-
*/
|
|
272
|
-
edge(edge: M['EdgeOrId']): EdgeModel<M, V>;
|
|
273
|
-
findEdge(edge: M['EdgeOrId']): EdgeModel<M, V> | null;
|
|
274
|
-
/**
|
|
275
|
-
* Iterate over all edges.
|
|
276
|
-
*/
|
|
277
|
-
edges(): EdgesIterator<M, V>;
|
|
278
|
-
/**
|
|
279
|
-
* Iterate over all edges.
|
|
280
|
-
*/
|
|
281
|
-
edgesWithRelation(relation: M['RelationId']): EdgesIterator<M, V>;
|
|
282
|
-
/**
|
|
283
|
-
* Nodes that have references to elements from logical model.
|
|
284
|
-
*/
|
|
285
|
-
elements(): IteratorLike<NodeModel.WithElement<M, V>>;
|
|
286
|
-
includesElement(elementId: M['Element']): boolean;
|
|
287
|
-
includesDeployment(deploymentId: M['Deployment']): boolean;
|
|
288
|
-
includesRelation(relationId: M['RelationId']): boolean;
|
|
289
|
-
/**
|
|
290
|
-
* Below are type guards.
|
|
291
|
-
*/
|
|
292
|
-
isComputed(): this is LikeC4ViewModel<M, ComputedView>;
|
|
293
|
-
isDiagram(): this is LikeC4ViewModel<M, DiagramView>;
|
|
294
|
-
isElementView(): this is LikeC4ViewModel<M, ComputedElementView>;
|
|
295
|
-
isDeploymentView(): this is LikeC4ViewModel<M, ComputedDeploymentView>;
|
|
296
|
-
isDynamicView(): this is LikeC4ViewModel<M, ComputedDynamicView>;
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
declare class LikeC4DeploymentModel<M extends AnyAux = AnyAux> {
|
|
300
|
-
#private;
|
|
301
|
-
readonly $model: LikeC4Model<M>;
|
|
302
|
-
readonly $deployments: AnyLikeC4Model['deployments'];
|
|
303
|
-
constructor($model: LikeC4Model<M>, $deployments: AnyLikeC4Model['deployments']);
|
|
304
|
-
element(el: M['DeploymentOrFqn']): DeploymentElementModel<M>;
|
|
305
|
-
findElement(el: M['Deployment']): DeploymentElementModel<M> | null;
|
|
306
|
-
node(el: M['DeploymentOrFqn']): DeploymentNodeModel<M>;
|
|
307
|
-
findNode(el: M['Deployment']): DeploymentNodeModel<M> | null;
|
|
308
|
-
instance(el: M['DeploymentOrFqn']): DeployedInstanceModel<M>;
|
|
309
|
-
findInstance(el: M['Deployment']): DeployedInstanceModel<M> | null;
|
|
310
|
-
/**
|
|
311
|
-
* Returns the root elements of the model.
|
|
312
|
-
*/
|
|
313
|
-
roots(): DeploymentNodesIterator<M>;
|
|
314
|
-
/**
|
|
315
|
-
* Returns all elements in the model.
|
|
316
|
-
*/
|
|
317
|
-
elements(): DeploymentElementsIterator<M>;
|
|
318
|
-
/**
|
|
319
|
-
* Returns all elements in the model.
|
|
320
|
-
*/
|
|
321
|
-
nodes(): DeploymentNodesIterator<M>;
|
|
322
|
-
instances(): DeployedInstancesIterator<M>;
|
|
323
|
-
/**
|
|
324
|
-
* Iterate over all instances of the given logical element.
|
|
325
|
-
*/
|
|
326
|
-
instancesOf(element: M['ElementOrFqn']): DeployedInstancesIterator<M>;
|
|
327
|
-
deploymentRef(ref: DeploymentRef): DeploymentElementModel<M> | NestedElementOfDeployedInstanceModel<M>;
|
|
328
|
-
/**
|
|
329
|
-
* Returns all relationships in the model.
|
|
330
|
-
*/
|
|
331
|
-
relationships(): IteratorLike<DeploymentRelationModel<M>>;
|
|
332
|
-
/**
|
|
333
|
-
* Returns a specific relationship by its ID.
|
|
334
|
-
*/
|
|
335
|
-
relationship(id: M['RelationId']): DeploymentRelationModel<M>;
|
|
336
|
-
findRelationship(id: LiteralUnion<M['RelationId'], string>): DeploymentRelationModel<M> | null;
|
|
337
|
-
/**
|
|
338
|
-
* Returns all deployment views in the model.
|
|
339
|
-
*/
|
|
340
|
-
views(): IteratorLike<LikeC4ViewModel<M, ComputedDeploymentView>>;
|
|
341
|
-
/**
|
|
342
|
-
* Returns the parent element of given element.
|
|
343
|
-
* @see ancestors
|
|
344
|
-
*/
|
|
345
|
-
parent(element: M['DeploymentOrFqn']): DeploymentNodeModel<M> | null;
|
|
346
|
-
/**
|
|
347
|
-
* Get all children of the element (only direct children),
|
|
348
|
-
* @see descendants
|
|
349
|
-
*/
|
|
350
|
-
children(element: M['DeploymentOrFqn']): ReadonlySet<DeploymentElementModel<M>>;
|
|
44
|
+
/**
|
|
45
|
+
* Connection is ephemeral entity, result of a resolving relationships between source and target.
|
|
46
|
+
* Includes direct relationships and/or between their nested elements.
|
|
47
|
+
*/
|
|
48
|
+
declare class DeploymentConnectionModel<M extends AnyAux = AnyAux> implements Connection<DeploymentElementModel<M>, M['EdgeId']> {
|
|
49
|
+
readonly source: DeploymentNodeModel<M> | DeployedInstanceModel<M>;
|
|
50
|
+
readonly target: DeploymentNodeModel<M> | DeployedInstanceModel<M>;
|
|
51
|
+
readonly relations: RelationshipsAccum<M>;
|
|
52
|
+
constructor(source: DeploymentNodeModel<M> | DeployedInstanceModel<M>, target: DeploymentNodeModel<M> | DeployedInstanceModel<M>, relations: RelationshipsAccum<M>);
|
|
53
|
+
readonly id: M['EdgeId'];
|
|
351
54
|
/**
|
|
352
|
-
*
|
|
55
|
+
* Human readable expression of the connection
|
|
56
|
+
* Mostly used for testing and debugging
|
|
353
57
|
*/
|
|
354
|
-
|
|
58
|
+
get expression(): string;
|
|
59
|
+
private _boundary;
|
|
355
60
|
/**
|
|
356
|
-
*
|
|
357
|
-
*
|
|
61
|
+
* Common ancestor of the source and target elements.
|
|
62
|
+
* Represents the boundary of the connection.
|
|
358
63
|
*/
|
|
359
|
-
|
|
64
|
+
get boundary(): DeploymentNodeModel<M> | null;
|
|
65
|
+
nonEmpty(): boolean;
|
|
66
|
+
[customInspectSymbol](depth: any, inspectOptions: any, inspect: any): string;
|
|
67
|
+
toString(): string;
|
|
360
68
|
/**
|
|
361
|
-
*
|
|
69
|
+
* Check if connection contains deployment relation,
|
|
70
|
+
* that is directly connected to source or target.
|
|
362
71
|
*/
|
|
363
|
-
|
|
72
|
+
hasDirectDeploymentRelation(): boolean;
|
|
73
|
+
values(): IteratorLike<RelationshipModel<M> | DeploymentRelationModel<M>>;
|
|
364
74
|
/**
|
|
365
|
-
*
|
|
366
|
-
*
|
|
75
|
+
* Merge with another connection, if it has the same source and target.
|
|
76
|
+
* Returns new connection with union of relationships.
|
|
367
77
|
*/
|
|
368
|
-
|
|
78
|
+
mergeWith(other: DeploymentConnectionModel<M>): DeploymentConnectionModel<M>;
|
|
79
|
+
difference(other: DeploymentConnectionModel<M>): DeploymentConnectionModel<M>;
|
|
80
|
+
intersect(other: DeploymentConnectionModel<M>): DeploymentConnectionModel<M>;
|
|
81
|
+
equals(other: Connection): boolean;
|
|
369
82
|
/**
|
|
370
|
-
*
|
|
371
|
-
*
|
|
83
|
+
* Creates a clone of the current `DeploymentConnectionModel` instance with optional overrides.
|
|
84
|
+
* if `null` is provided in overrides, the corresponding relation set will be empty.
|
|
372
85
|
*/
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
86
|
+
update(overrides?: {
|
|
87
|
+
model?: ReadonlySet<RelationshipModel<M>> | null;
|
|
88
|
+
deployment?: ReadonlySet<DeploymentRelationModel<M>> | null;
|
|
89
|
+
}): DeploymentConnectionModel<M>;
|
|
376
90
|
}
|
|
377
91
|
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
get technology(): string | null;
|
|
392
|
-
get parent(): DeploymentNodeModel<M> | null;
|
|
393
|
-
get links(): ReadonlyArray<Link>;
|
|
394
|
-
/**
|
|
395
|
-
* Get all ancestor elements (i.e. parent, parent’s parent, etc.)
|
|
396
|
-
* (from closest to root)
|
|
397
|
-
*/
|
|
398
|
-
ancestors(): DeploymentNodesIterator<M>;
|
|
399
|
-
/**
|
|
400
|
-
* Returns the common ancestor of this element and another element.
|
|
401
|
-
*/
|
|
402
|
-
commonAncestor(another: DeploymentElementModel<M>): DeploymentNodeModel<M> | null;
|
|
403
|
-
/**
|
|
404
|
-
* Get all sibling (i.e. same parent)
|
|
405
|
-
*/
|
|
406
|
-
siblings(): DeploymentElementsIterator<M>;
|
|
407
|
-
/**
|
|
408
|
-
* Check if the element is a sibling of another element
|
|
409
|
-
*/
|
|
410
|
-
isSibling(other: DeploymentElementModel<M>): boolean;
|
|
411
|
-
/**
|
|
412
|
-
* Resolve siblings of the element and its ancestors
|
|
413
|
-
* (from closest to root)
|
|
414
|
-
*/
|
|
415
|
-
ascendingSiblings(): DeploymentElementsIterator<M>;
|
|
416
|
-
incoming(filter?: IncomingFilter): IteratorLike<DeploymentRelationModel<M>>;
|
|
417
|
-
outgoing(filter?: OutgoingFilter): IteratorLike<DeploymentRelationModel<M>>;
|
|
418
|
-
incomers(filter?: IncomingFilter): IteratorLike<DeploymentRelationEndpoint<M>>;
|
|
419
|
-
outgoers(filter?: OutgoingFilter): IteratorLike<DeploymentRelationEndpoint<M>>;
|
|
420
|
-
/**
|
|
421
|
-
* Iterate over all views that include this deployment element.
|
|
422
|
-
*/
|
|
423
|
-
views(): IteratorLike<LikeC4ViewModel<M, ComputedDeploymentView>>;
|
|
424
|
-
isDeploymentNode(): this is DeploymentNodeModel<M>;
|
|
425
|
-
isInstance(): this is DeployedInstanceModel<M>;
|
|
426
|
-
abstract outgoingFromModel(): RelationshipsIterator<M>;
|
|
427
|
-
abstract incomingFromModel(): RelationshipsIterator<M>;
|
|
428
|
-
protected cachedOutgoing: RelationshipsAccum<M> | null;
|
|
429
|
-
protected cachedIncoming: RelationshipsAccum<M> | null;
|
|
430
|
-
get allOutgoing(): RelationshipsAccum<M>;
|
|
431
|
-
get allIncoming(): RelationshipsAccum<M>;
|
|
432
|
-
}
|
|
433
|
-
declare class DeploymentNodeModel<M extends AnyAux = AnyAux> extends DeploymentElementModel<M> {
|
|
434
|
-
readonly $model: LikeC4DeploymentModel<M>;
|
|
435
|
-
readonly $node: DeploymentNode;
|
|
436
|
-
constructor($model: LikeC4DeploymentModel<M>, $node: DeploymentNode);
|
|
437
|
-
get kind(): DeploymentNodeKind;
|
|
438
|
-
children(): ReadonlySet<DeploymentElementModel<M>>;
|
|
439
|
-
descendants(): DeploymentElementsIterator<M>;
|
|
440
|
-
isDeploymentNode(): this is DeploymentNodeModel<M>;
|
|
441
|
-
/**
|
|
442
|
-
* Iterate over all instances nested in this deployment node.
|
|
443
|
-
*/
|
|
444
|
-
instances(): DeployedInstancesIterator<M>;
|
|
445
|
-
/**
|
|
446
|
-
* Returns deployed instance inside this deployment node
|
|
447
|
-
* if only there are no more instances
|
|
448
|
-
*/
|
|
449
|
-
onlyOneInstance(): DeployedInstanceModel<M> | null;
|
|
450
|
-
/**
|
|
451
|
-
* Cached result of relationships from instances
|
|
452
|
-
*/
|
|
453
|
-
private _relationshipsFromInstances;
|
|
454
|
-
private relationshipsFromInstances;
|
|
92
|
+
/**
|
|
93
|
+
* Connection refers to any relationships between two elements,
|
|
94
|
+
* both direct and implicit ones (between their nested elements).
|
|
95
|
+
*
|
|
96
|
+
* Merges relationships together to an single edge on the diagram.
|
|
97
|
+
*/
|
|
98
|
+
declare class ConnectionModel<M extends AnyAux = AnyAux> implements Connection<ElementModel<M>, M['EdgeId']> {
|
|
99
|
+
readonly source: ElementModel<M>;
|
|
100
|
+
readonly target: ElementModel<M>;
|
|
101
|
+
readonly relations: ReadonlySet<RelationshipModel<M>>;
|
|
102
|
+
readonly id: M['EdgeId'];
|
|
103
|
+
constructor(source: ElementModel<M>, target: ElementModel<M>, relations?: ReadonlySet<RelationshipModel<M>>);
|
|
104
|
+
private _boundary;
|
|
455
105
|
/**
|
|
456
|
-
*
|
|
106
|
+
* Common ancestor of the source and target elements.
|
|
107
|
+
* Represents the boundary of the connection.
|
|
457
108
|
*/
|
|
458
|
-
|
|
109
|
+
get boundary(): ElementModel<M> | null;
|
|
459
110
|
/**
|
|
460
|
-
*
|
|
111
|
+
* Human readable expression of the connection
|
|
112
|
+
* Mostly used for testing and debugging
|
|
461
113
|
*/
|
|
462
|
-
incomingFromModel(): RelationshipsIterator<M>;
|
|
463
|
-
}
|
|
464
|
-
declare class DeployedInstanceModel<M extends AnyAux = AnyAux> extends DeploymentElementModel<M> {
|
|
465
|
-
readonly $model: LikeC4DeploymentModel<M>;
|
|
466
|
-
readonly $instance: DeployedInstance;
|
|
467
|
-
readonly $element: ElementModel<M>;
|
|
468
|
-
constructor($model: LikeC4DeploymentModel<M>, $instance: DeployedInstance, $element: ElementModel<M>);
|
|
469
|
-
get parent(): DeploymentNodeModel<M>;
|
|
470
|
-
get $node(): DeployedInstance;
|
|
471
|
-
get style(): SetRequired<PhysicalElementStyle, 'shape' | 'color'>;
|
|
472
|
-
get shape(): ElementShape;
|
|
473
|
-
get color(): ThemeColor;
|
|
474
|
-
get tags(): ReadonlyArray<Tag>;
|
|
475
|
-
get title(): string;
|
|
476
|
-
get description(): string | null;
|
|
477
|
-
get technology(): string | null;
|
|
478
|
-
get links(): ReadonlyArray<Link>;
|
|
479
|
-
isInstance(): this is DeployedInstanceModel<M>;
|
|
480
|
-
outgoingFromModel(): RelationshipsIterator<M>;
|
|
481
|
-
incomingFromModel(): RelationshipsIterator<M>;
|
|
482
|
-
}
|
|
483
|
-
declare class NestedElementOfDeployedInstanceModel<M extends AnyAux> {
|
|
484
|
-
readonly instance: DeployedInstanceModel<M>;
|
|
485
|
-
readonly element: ElementModel<M>;
|
|
486
|
-
constructor(instance: DeployedInstanceModel<M>, element: ElementModel<M>);
|
|
487
|
-
get id(): M['DeploymentFqn'];
|
|
488
|
-
get style(): SetRequired<PhysicalElementStyle, 'shape' | 'color'>;
|
|
489
|
-
get shape(): ElementShape;
|
|
490
|
-
get color(): ThemeColor;
|
|
491
|
-
get title(): string;
|
|
492
|
-
get description(): string | null;
|
|
493
|
-
get technology(): string | null;
|
|
494
|
-
isDeploymentNode(): this is DeploymentNodeModel<M>;
|
|
495
|
-
isInstance(): this is DeployedInstanceModel<M>;
|
|
496
|
-
}
|
|
497
|
-
type DeploymentRelationEndpoint<M extends AnyAux> = DeploymentElementModel<M> | NestedElementOfDeployedInstanceModel<M>;
|
|
498
|
-
declare class DeploymentRelationModel<M extends AnyAux> {
|
|
499
|
-
readonly $model: LikeC4DeploymentModel<M>;
|
|
500
|
-
readonly $relationship: DeploymentRelation;
|
|
501
|
-
boundary: DeploymentNodeModel<M> | null;
|
|
502
|
-
source: DeploymentRelationEndpoint<M>;
|
|
503
|
-
target: DeploymentRelationEndpoint<M>;
|
|
504
|
-
constructor($model: LikeC4DeploymentModel<M>, $relationship: DeploymentRelation);
|
|
505
|
-
get id(): M['RelationId'];
|
|
506
114
|
get expression(): string;
|
|
507
|
-
get title(): string | null;
|
|
508
|
-
get technology(): string | null;
|
|
509
|
-
get description(): string | null;
|
|
510
|
-
get tags(): ReadonlyArray<Tag>;
|
|
511
|
-
get navigateTo(): LikeC4ViewModel<M> | null;
|
|
512
|
-
get links(): ReadonlyArray<Link>;
|
|
513
|
-
views(): IteratorLike<LikeC4ViewModel<M, ComputedDeploymentView>>;
|
|
514
|
-
}
|
|
515
|
-
declare class RelationshipsAccum<M extends AnyAux> {
|
|
516
|
-
readonly model: ReadonlySet<RelationshipModel<M>>;
|
|
517
|
-
readonly deployment: ReadonlySet<DeploymentRelationModel<M>>;
|
|
518
115
|
/**
|
|
519
|
-
*
|
|
520
|
-
* @param deployment relationships from deployment model
|
|
116
|
+
* Returns true if only includes relations between the source and target elements.
|
|
521
117
|
*/
|
|
522
|
-
|
|
523
|
-
get isEmpty(): boolean;
|
|
524
|
-
get nonEmpty(): boolean;
|
|
525
|
-
get size(): number;
|
|
118
|
+
get isDirect(): boolean;
|
|
526
119
|
/**
|
|
527
|
-
* Returns
|
|
120
|
+
* Returns true if includes relations between nested elements of the source and target elements.
|
|
528
121
|
*/
|
|
529
|
-
|
|
122
|
+
get isImplicit(): boolean;
|
|
123
|
+
get directRelations(): ReadonlySet<RelationshipModel<M>>;
|
|
124
|
+
nonEmpty(): boolean;
|
|
125
|
+
mergeWith(other: ConnectionModel<M>): ConnectionModel<M>;
|
|
126
|
+
difference(other: ConnectionModel<M>): ConnectionModel<M>;
|
|
127
|
+
intersect(other: ConnectionModel<M>): ConnectionModel<M>;
|
|
128
|
+
equals(other: Connection): boolean;
|
|
530
129
|
/**
|
|
531
|
-
* Returns new
|
|
130
|
+
* Returns a new instance with the updated relations.
|
|
131
|
+
*
|
|
132
|
+
* @param relations - A readonly set of `RelationshipModel` instances representing the new relations.
|
|
133
|
+
* @returns A new `ConnectionModel` instance with the updated relations.
|
|
532
134
|
*/
|
|
533
|
-
|
|
135
|
+
update(relations: ReadonlySet<RelationshipModel<M>>): ConnectionModel<M>;
|
|
136
|
+
[customInspectSymbol](depth: any, inspectOptions: any, inspect: any): string;
|
|
137
|
+
toString(): string;
|
|
534
138
|
/**
|
|
535
|
-
*
|
|
139
|
+
* Creates a new connection with reversed direction (target becomes source and vice versa)
|
|
140
|
+
* @param search - When true, attempts to find an existing connection between the reversed nodes
|
|
536
141
|
*/
|
|
537
|
-
|
|
142
|
+
reversed(search?: boolean): ConnectionModel<M>;
|
|
538
143
|
}
|
|
539
144
|
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
* @see outgoers
|
|
620
|
-
*/
|
|
621
|
-
outgoing(element: M['ElementOrFqn'], filter?: OutgoingFilter): RelationshipsIterator<M>;
|
|
622
|
-
private addElement;
|
|
623
|
-
private addRelation;
|
|
145
|
+
/**
|
|
146
|
+
* Check if connection is nested inside another connection
|
|
147
|
+
* (i.e. between descendants)
|
|
148
|
+
*/
|
|
149
|
+
declare function isNestedConnection<T extends {
|
|
150
|
+
id: string;
|
|
151
|
+
}>(parent: WithSourceTarget<NoInfer<T>>): (nested: WithSourceTarget<T>) => boolean;
|
|
152
|
+
declare function isNestedConnection<T extends {
|
|
153
|
+
id: string;
|
|
154
|
+
}>(nested: WithSourceTarget<T>, parent: WithSourceTarget<T>): boolean;
|
|
155
|
+
type ConnectionElemId = Connection<{
|
|
156
|
+
readonly id: string;
|
|
157
|
+
}, any>;
|
|
158
|
+
declare function findDeepestNestedConnection<C extends ConnectionElemId>(connections: ReadonlyArray<C>, connection: C): C | null;
|
|
159
|
+
declare function sortDeepestFirst<C extends ConnectionElemId>(connections: ReadonlyArray<C>): C[];
|
|
160
|
+
type WithBoundary = {
|
|
161
|
+
boundary: null | {
|
|
162
|
+
id: string;
|
|
163
|
+
};
|
|
164
|
+
};
|
|
165
|
+
declare function sortConnectionsByBoundaryHierarchy(sort?: 'asc' | 'desc'): <T extends WithBoundary, A extends IterableContainer<T>>(array: A) => ReorderedArray<A>;
|
|
166
|
+
declare function sortConnectionsByBoundaryHierarchy<T extends WithBoundary, A extends IterableContainer<T>>(array: A, sort?: 'asc' | 'desc'): ReorderedArray<A>;
|
|
167
|
+
/**
|
|
168
|
+
* Find connections that includes given connection (i.e between it's ancestors)
|
|
169
|
+
*/
|
|
170
|
+
declare function findAscendingConnections<C extends ConnectionElemId>(connections: ReadonlyArray<C>, connection: C): Array<C>;
|
|
171
|
+
/**
|
|
172
|
+
* Find connections that includes given connection (i.e between it's descendants)
|
|
173
|
+
*/
|
|
174
|
+
declare function findDescendantConnections<C extends ConnectionElemId>(connections: ReadonlyArray<C>, connection: C): Array<C>;
|
|
175
|
+
declare function mergeConnections<C extends Connection>(connections: ReadonlyArray<C>): C[];
|
|
176
|
+
/**
|
|
177
|
+
* Excludes the values existing in `other` array.
|
|
178
|
+
* The output maintains the same order as the input.
|
|
179
|
+
*/
|
|
180
|
+
declare function differenceConnections<C extends Connection>(source: Iterable<C>, exclude: Iterable<C>): C[];
|
|
181
|
+
type WithSourceTarget<T = unknown> = {
|
|
182
|
+
source: T;
|
|
183
|
+
target: T;
|
|
184
|
+
};
|
|
185
|
+
declare function hasSameSourceTarget<T>(a: WithSourceTarget<NoInfer<T>>): (b: WithSourceTarget<T>) => boolean;
|
|
186
|
+
declare function hasSameSourceTarget<T>(a: WithSourceTarget<T>, b: WithSourceTarget<T>): boolean;
|
|
187
|
+
declare function hasSameSource<T>(a: WithSourceTarget<NoInfer<T>>): (b: WithSourceTarget<T>) => boolean;
|
|
188
|
+
declare function hasSameSource<T>(a: WithSourceTarget<T>, b: WithSourceTarget<T>): boolean;
|
|
189
|
+
declare function hasSameTarget<T>(a: WithSourceTarget<NoInfer<T>>): (b: WithSourceTarget<T>) => boolean;
|
|
190
|
+
declare function hasSameTarget<T>(a: WithSourceTarget<T>, b: WithSourceTarget<T>): boolean;
|
|
191
|
+
type WithId<T> = {
|
|
192
|
+
id: T;
|
|
193
|
+
};
|
|
194
|
+
declare function isOutgoing<T extends string>(source: WithId<NoInfer<T>>): (a: WithSourceTarget<WithId<T>>) => boolean;
|
|
195
|
+
declare function isOutgoing<T extends string>(a: WithSourceTarget<WithId<T>>, source: WithId<T>): boolean;
|
|
196
|
+
declare function isIncoming<T extends string>(target: WithId<NoInfer<T>>): (a: WithSourceTarget<WithId<T>>) => boolean;
|
|
197
|
+
declare function isIncoming<T extends string>(a: WithSourceTarget<WithId<T>>, target: WithId<T>): boolean;
|
|
198
|
+
declare function isAnyInOut<T extends string>(source: WithId<NoInfer<T>>): (a: WithSourceTarget<WithId<T>>) => boolean;
|
|
199
|
+
declare function isAnyInOut<T extends string>(a: WithSourceTarget<WithId<T>>, source: WithId<T>): boolean;
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Resolve connection from source to target
|
|
203
|
+
* If direction is `both`, also look for reverse connection
|
|
204
|
+
*
|
|
205
|
+
* @default direction directed
|
|
206
|
+
*/
|
|
207
|
+
declare function findConnection$1<M extends AnyAux>(source: DeploymentElementModel<M>, target: DeploymentElementModel<NoInfer<M>>, direction: 'directed'): readonly [DeploymentConnectionModel<M>] | readonly [];
|
|
208
|
+
declare function findConnection$1<M extends AnyAux>(source: DeploymentElementModel<M>, target: DeploymentElementModel<NoInfer<M>>, direction: 'both'): readonly [DeploymentConnectionModel<M>, DeploymentConnectionModel<M>] | readonly [DeploymentConnectionModel<M>] | readonly [];
|
|
209
|
+
declare function findConnection$1<M extends AnyAux>(source: DeploymentElementModel<M>, target: DeploymentElementModel<NoInfer<M>>, direction?: 'directed' | 'both'): readonly [DeploymentConnectionModel<M>, DeploymentConnectionModel<M>] | readonly [DeploymentConnectionModel<M>] | readonly [];
|
|
210
|
+
/**
|
|
211
|
+
* Resolve all connections between element and others
|
|
212
|
+
* By default, look for both directions.
|
|
213
|
+
*
|
|
214
|
+
* @default direction both
|
|
215
|
+
*/
|
|
216
|
+
declare function findConnectionsBetween$1<M extends AnyAux>(element: DeploymentElementModel<M>, others: Iterable<DeploymentElementModel<NoInfer<M>>>, direction?: 'directed' | 'both'): readonly DeploymentConnectionModel<M>[];
|
|
217
|
+
/**
|
|
218
|
+
* Resolve all connections within a given set of elements
|
|
219
|
+
*/
|
|
220
|
+
declare function findConnectionsWithin$1<M extends AnyAux>(elements: Iterable<DeploymentElementModel<M>>): readonly DeploymentConnectionModel<M>[];
|
|
221
|
+
|
|
222
|
+
declare namespace find$1 {
|
|
223
|
+
export { findConnection$1 as findConnection, findConnectionsBetween$1 as findConnectionsBetween, findConnectionsWithin$1 as findConnectionsWithin };
|
|
624
224
|
}
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Resolve connection from source to target
|
|
228
|
+
*
|
|
229
|
+
* @param direction - if 'both', also returns connection from target to source
|
|
230
|
+
* @default `directed`
|
|
231
|
+
*/
|
|
232
|
+
declare function findConnection<M extends AnyAux>(source: ElementModel<M>, target: ElementModel<M>, direction?: 'directed' | 'both'): [ConnectionModel<M>, ConnectionModel<M>] | [ConnectionModel<M>] | [];
|
|
233
|
+
/**
|
|
234
|
+
* Resolve all connections between element and others
|
|
235
|
+
* @param direction - if 'directed', only look for outgoing connections from the element to others
|
|
236
|
+
* @default `both`
|
|
237
|
+
*/
|
|
238
|
+
declare function findConnectionsBetween<M extends AnyAux>(element: ElementModel<M>, others: Iterable<ElementModel<NoInfer<M>>>, direction?: 'directed' | 'both'): readonly ConnectionModel<M>[];
|
|
239
|
+
/**
|
|
240
|
+
* Resolve all connections within a given set of elements
|
|
241
|
+
*/
|
|
242
|
+
declare function findConnectionsWithin<M extends AnyAux>(elements: Iterable<ElementModel<M>>): readonly ConnectionModel<M>[];
|
|
243
|
+
|
|
244
|
+
declare const find_findConnection: typeof findConnection;
|
|
245
|
+
declare const find_findConnectionsBetween: typeof findConnectionsBetween;
|
|
246
|
+
declare const find_findConnectionsWithin: typeof findConnectionsWithin;
|
|
247
|
+
declare namespace find {
|
|
248
|
+
export { find_findConnection as findConnection, find_findConnectionsBetween as findConnectionsBetween, find_findConnectionsWithin as findConnectionsWithin };
|
|
640
249
|
}
|
|
641
250
|
|
|
642
|
-
|
|
251
|
+
declare function isDeploymentNode(model: DeploymentElementModel): model is DeploymentNodeModel;
|
|
252
|
+
declare function isDeployedInstance(model: DeploymentElementModel): model is DeployedInstanceModel;
|
|
253
|
+
|
|
254
|
+
export { AnyAux, Connection, ConnectionModel, DeployedInstanceModel, DeploymentConnectionModel, DeploymentElementModel, DeploymentNodeModel, DeploymentRelationModel, ElementModel, RelationshipModel, find$1 as deploymentConnection, differenceConnections, findAscendingConnections, findDeepestNestedConnection, findDescendantConnections, hasSameSource, hasSameSourceTarget, hasSameTarget, isAnyInOut, isDeployedInstance, isDeploymentNode, isIncoming, isNestedConnection, isOutgoing, mergeConnections, find as modelConnection, sortConnectionsByBoundaryHierarchy, sortDeepestFirst };
|