@likec4/core 1.18.0 → 1.19.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/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.-BdzdI2C.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 +404 -0
- package/dist/utils/index.d.ts +404 -0
- package/dist/utils/index.js +330 -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 +74 -9
- package/src/utils/iterable/_types.ts +5 -0
- package/src/utils/iterable/filter.ts +55 -0
- package/src/utils/iterable/flat.ts +17 -0
- package/src/utils/iterable/index.ts +12 -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/src/types/index.ts
CHANGED
|
@@ -1,13 +1,220 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
export type {
|
|
2
|
+
CustomColor,
|
|
3
|
+
ExclusiveUnion,
|
|
4
|
+
IconUrl,
|
|
5
|
+
IteratorLike,
|
|
6
|
+
KeysOf,
|
|
7
|
+
NonEmptyArray,
|
|
8
|
+
NonEmptyReadonlyArray,
|
|
9
|
+
NTuple,
|
|
10
|
+
Point,
|
|
11
|
+
Predicate,
|
|
12
|
+
XYPoint,
|
|
13
|
+
} from './_common'
|
|
14
|
+
|
|
15
|
+
export { DeploymentElement } from './deployments'
|
|
16
|
+
export type {
|
|
17
|
+
DeployedInstance,
|
|
18
|
+
DeploymentElementStyle,
|
|
19
|
+
DeploymentNode,
|
|
20
|
+
DeploymentNodeKind,
|
|
21
|
+
DeploymentNodeKindSpecification,
|
|
22
|
+
DeploymentRef,
|
|
23
|
+
DeploymentRelation,
|
|
24
|
+
PredicateSelector,
|
|
25
|
+
} from './deployments'
|
|
26
|
+
|
|
27
|
+
export {
|
|
28
|
+
AsFqn,
|
|
29
|
+
BorderStyles,
|
|
30
|
+
DefaultElementShape,
|
|
31
|
+
DefaultThemeColor,
|
|
32
|
+
ElementKind,
|
|
33
|
+
ElementShapes,
|
|
34
|
+
} from './element'
|
|
35
|
+
export type {
|
|
36
|
+
BorderStyle,
|
|
37
|
+
Element,
|
|
38
|
+
ElementKindSpecification,
|
|
39
|
+
ElementKindSpecificationStyle,
|
|
40
|
+
ElementShape,
|
|
41
|
+
ElementStyle,
|
|
42
|
+
Fqn,
|
|
43
|
+
Link,
|
|
44
|
+
Tag,
|
|
45
|
+
TagSpec,
|
|
46
|
+
TypedElement,
|
|
47
|
+
} from './element'
|
|
48
|
+
|
|
49
|
+
export {
|
|
50
|
+
isCustomElement,
|
|
51
|
+
isCustomRelationExpr,
|
|
52
|
+
isElement,
|
|
53
|
+
isElementKindExpr,
|
|
54
|
+
isElementPredicateExpr,
|
|
55
|
+
isElementRef,
|
|
56
|
+
isElementTagExpr,
|
|
57
|
+
isElementWhere,
|
|
58
|
+
isExpandedElementExpr,
|
|
59
|
+
isIncoming,
|
|
60
|
+
isInOut,
|
|
61
|
+
isOutgoing,
|
|
62
|
+
isRelation,
|
|
63
|
+
isRelationExpression,
|
|
64
|
+
isRelationPredicateExpr,
|
|
65
|
+
isRelationWhere,
|
|
66
|
+
isWildcard,
|
|
67
|
+
} from './expression'
|
|
68
|
+
export type {
|
|
69
|
+
CustomElementExpr,
|
|
70
|
+
CustomRelationExpr,
|
|
71
|
+
DirectRelationExpr,
|
|
72
|
+
ElementExpression,
|
|
73
|
+
ElementKindExpr,
|
|
74
|
+
ElementPredicateExpression,
|
|
75
|
+
ElementRefExpr,
|
|
76
|
+
ElementTagExpr,
|
|
77
|
+
ElementWhereExpr,
|
|
78
|
+
ExpandedElementExpr,
|
|
79
|
+
Expression,
|
|
80
|
+
IncomingExpr,
|
|
81
|
+
InOutExpr,
|
|
82
|
+
NonWilcard,
|
|
83
|
+
OutgoingExpr,
|
|
84
|
+
RelationExpression,
|
|
85
|
+
RelationPredicateExpression,
|
|
86
|
+
RelationWhereExpr,
|
|
87
|
+
WildcardExpr,
|
|
88
|
+
} from './expression'
|
|
89
|
+
|
|
90
|
+
export { ExpressionV2, FqnExpr, FqnRef, RelationExpr } from './expression-v2'
|
|
91
|
+
|
|
92
|
+
export type {
|
|
93
|
+
GlobalDynamicPredicates,
|
|
94
|
+
GlobalPredicateId,
|
|
95
|
+
GlobalPredicates,
|
|
96
|
+
GlobalStyleID,
|
|
97
|
+
GlobalStyles,
|
|
98
|
+
ModelGlobals,
|
|
99
|
+
} from './global'
|
|
100
|
+
|
|
101
|
+
export type {
|
|
102
|
+
AnyParsedLikeC4Model,
|
|
103
|
+
ComputedLikeC4Model,
|
|
104
|
+
GenericLikeC4Model,
|
|
105
|
+
LayoutedLikeC4Model,
|
|
106
|
+
LikeC4ModelDump,
|
|
107
|
+
ParsedLikeC4Model,
|
|
108
|
+
} from './model'
|
|
109
|
+
|
|
110
|
+
export {
|
|
111
|
+
isAndOperator,
|
|
112
|
+
isKindEqual,
|
|
113
|
+
isNotOperator,
|
|
114
|
+
isOrOperator,
|
|
115
|
+
isTagEqual,
|
|
116
|
+
whereOperatorAsPredicate,
|
|
117
|
+
} from './operators'
|
|
118
|
+
export type {
|
|
119
|
+
AndOperator,
|
|
120
|
+
EqualOperator,
|
|
121
|
+
Filterable,
|
|
122
|
+
KindEqual,
|
|
123
|
+
NotOperator,
|
|
124
|
+
OrOperator,
|
|
125
|
+
TagEqual,
|
|
126
|
+
WhereOperator,
|
|
127
|
+
} from './operators'
|
|
128
|
+
export type { OverviewGraph } from './overview-graph'
|
|
129
|
+
export { DefaultArrowType, DefaultLineStyle, DefaultRelationshipColor } from './relation'
|
|
130
|
+
export type {
|
|
131
|
+
AbstractRelation,
|
|
132
|
+
ModelRelation,
|
|
133
|
+
RelationId,
|
|
134
|
+
RelationshipArrowType,
|
|
135
|
+
RelationshipKind,
|
|
136
|
+
RelationshipKindSpecification,
|
|
137
|
+
RelationshipLineType,
|
|
138
|
+
} from './relation'
|
|
139
|
+
export { isThemeColor } from './theme'
|
|
140
|
+
export type {
|
|
141
|
+
Color,
|
|
142
|
+
ColorLiteral,
|
|
143
|
+
ElementThemeColors,
|
|
144
|
+
ElementThemeColorValues,
|
|
145
|
+
HexColorLiteral,
|
|
146
|
+
LikeC4Theme,
|
|
147
|
+
RelationshipThemeColors,
|
|
148
|
+
RelationshipThemeColorValues,
|
|
149
|
+
ThemeColor,
|
|
150
|
+
ThemeColorValues,
|
|
151
|
+
} from './theme'
|
|
152
|
+
export {
|
|
153
|
+
ComputedNode, // namespace
|
|
154
|
+
ComputedView, // namespace
|
|
155
|
+
DiagramNode, // namespace
|
|
156
|
+
extractStep,
|
|
157
|
+
getBBoxCenter,
|
|
158
|
+
getParallelStepsPrefix,
|
|
159
|
+
isAutoLayoutDirection,
|
|
160
|
+
isDeploymentView,
|
|
161
|
+
isDynamicView,
|
|
162
|
+
isDynamicViewParallelSteps,
|
|
163
|
+
isElementView,
|
|
164
|
+
isExtendsElementView,
|
|
165
|
+
isScopedElementView,
|
|
166
|
+
isStepEdgeId,
|
|
167
|
+
isViewRuleAutoLayout,
|
|
168
|
+
isViewRuleGlobalPredicateRef,
|
|
169
|
+
isViewRuleGlobalStyle,
|
|
170
|
+
isViewRuleGroup,
|
|
171
|
+
isViewRulePredicate,
|
|
172
|
+
isViewRuleStyle,
|
|
173
|
+
stepEdgeId,
|
|
174
|
+
} from './view'
|
|
175
|
+
export type {
|
|
176
|
+
AutoLayoutDirection,
|
|
177
|
+
BasicElementView,
|
|
178
|
+
BasicView,
|
|
179
|
+
BBox,
|
|
180
|
+
ComputedDeploymentView,
|
|
181
|
+
ComputedDynamicView,
|
|
182
|
+
ComputedEdge,
|
|
183
|
+
ComputedElementView,
|
|
184
|
+
CustomColorDefinitions,
|
|
185
|
+
DeploymentView,
|
|
186
|
+
DeploymentViewRule,
|
|
187
|
+
DeploymentViewRulePredicate,
|
|
188
|
+
DeploymentViewRuleStyle,
|
|
189
|
+
DiagramEdge,
|
|
190
|
+
DiagramView,
|
|
191
|
+
DynamicView,
|
|
192
|
+
DynamicViewIncludeRule,
|
|
193
|
+
DynamicViewParallelSteps,
|
|
194
|
+
DynamicViewRule,
|
|
195
|
+
DynamicViewStep,
|
|
196
|
+
DynamicViewStepOrParallel,
|
|
197
|
+
EdgeId,
|
|
198
|
+
ElementView,
|
|
199
|
+
ExtendsElementView,
|
|
200
|
+
LikeC4View,
|
|
201
|
+
NodeId,
|
|
202
|
+
ScopedElementView,
|
|
203
|
+
StepEdgeId,
|
|
204
|
+
StepEdgeIdLiteral,
|
|
205
|
+
ViewAutoLayout,
|
|
206
|
+
ViewId,
|
|
207
|
+
ViewManualLayout,
|
|
208
|
+
ViewRule,
|
|
209
|
+
ViewRuleAutoLayout,
|
|
210
|
+
ViewRuleGlobalPredicateRef,
|
|
211
|
+
ViewRuleGlobalStyle,
|
|
212
|
+
ViewRuleGroup,
|
|
213
|
+
ViewRulePredicate,
|
|
214
|
+
ViewRuleStyle,
|
|
215
|
+
ViewRuleStyleOrGlobalRef,
|
|
216
|
+
ViewWithHash,
|
|
217
|
+
ViewWithNotation,
|
|
218
|
+
} from './view'
|
|
219
|
+
export type { ViewChange } from './view-changes'
|
|
220
|
+
export type { ElementNotation } from './view-notation'
|
package/src/types/model.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { KeysOf } from './_common'
|
|
2
1
|
import type {
|
|
3
2
|
DeploymentElement,
|
|
4
3
|
DeploymentNodeKind,
|
|
@@ -7,11 +6,22 @@ import type {
|
|
|
7
6
|
} from './deployments'
|
|
8
7
|
import type { ElementKindSpecification, Tag, TypedElement } from './element'
|
|
9
8
|
import type { ModelGlobals } from './global'
|
|
10
|
-
import type {
|
|
9
|
+
import type { ModelRelation, RelationId, RelationshipKindSpecification } from './relation'
|
|
11
10
|
import type { ComputedView, DiagramView, LikeC4View } from './view'
|
|
12
11
|
|
|
13
12
|
/**
|
|
14
|
-
*
|
|
13
|
+
* Represents a LikeC4 model with customizable type parameters,
|
|
14
|
+
* parsed from DSL or result from Builder
|
|
15
|
+
*
|
|
16
|
+
* !IMPORTANT: This is a low-level type, use `LikeC4Model` instead.
|
|
17
|
+
* !NOTE: Views are not computed yet.
|
|
18
|
+
*
|
|
19
|
+
* @typeParam ElementKinds - Types of elements in the model (defaults to string)
|
|
20
|
+
* @typeParam RelationKinds - Types of relationships (defaults to string)
|
|
21
|
+
* @typeParam Tags - Types of tags that can be applied (defaults to string)
|
|
22
|
+
* @typeParam Fqns - Fully Qualified Names for elements (defaults to string)
|
|
23
|
+
* @typeParam Views - Types of views in the model (defaults to string)
|
|
24
|
+
* @typeParam DeploymentFqns - Fully Qualified Names for deployment nodes (defaults to string)
|
|
15
25
|
*/
|
|
16
26
|
export interface ParsedLikeC4Model<
|
|
17
27
|
ElementKinds extends string = string,
|
|
@@ -21,6 +31,8 @@ export interface ParsedLikeC4Model<
|
|
|
21
31
|
Views extends string = string,
|
|
22
32
|
DeploymentFqns extends string = string
|
|
23
33
|
> {
|
|
34
|
+
// To prevent accidental use of this type
|
|
35
|
+
__?: never
|
|
24
36
|
specification: {
|
|
25
37
|
tags: Tag<Tags>[]
|
|
26
38
|
elements: Record<ElementKinds, ElementKindSpecification>
|
|
@@ -28,7 +40,7 @@ export interface ParsedLikeC4Model<
|
|
|
28
40
|
relationships: Record<RelationKinds, RelationshipKindSpecification>
|
|
29
41
|
}
|
|
30
42
|
elements: Record<Fqns, TypedElement<Fqns, ElementKinds, Tags>>
|
|
31
|
-
relations: Record<RelationId,
|
|
43
|
+
relations: Record<RelationId, ModelRelation>
|
|
32
44
|
globals: ModelGlobals
|
|
33
45
|
views: Record<Views, LikeC4View<Views, Tags>>
|
|
34
46
|
/**
|
|
@@ -39,10 +51,12 @@ export interface ParsedLikeC4Model<
|
|
|
39
51
|
relations: Record<RelationId, DeploymentRelation>
|
|
40
52
|
}
|
|
41
53
|
}
|
|
54
|
+
|
|
55
|
+
export type AnyParsedLikeC4Model = ParsedLikeC4Model<any, any, any, any, any, any>
|
|
42
56
|
/**
|
|
43
57
|
* Hook to get types from dump
|
|
44
58
|
*/
|
|
45
|
-
export type
|
|
59
|
+
export type LikeC4ModelDump = {
|
|
46
60
|
elements: {
|
|
47
61
|
[kind: string]: object
|
|
48
62
|
}
|
|
@@ -56,45 +70,35 @@ export type ParsedLikeC4ModelDump = {
|
|
|
56
70
|
}
|
|
57
71
|
}
|
|
58
72
|
|
|
59
|
-
|
|
73
|
+
/**
|
|
74
|
+
* Same as {@link ParsedLikeC4Model}, but with computed views or layouted views.
|
|
75
|
+
*/
|
|
76
|
+
export interface GenericLikeC4Model<
|
|
60
77
|
Fqns extends string = string,
|
|
61
78
|
DeploymentFqns extends string = string,
|
|
62
79
|
Views extends string = string,
|
|
63
80
|
Tags extends string = string,
|
|
64
81
|
T = 'computed' | 'layouted'
|
|
65
|
-
> extends Omit<ParsedLikeC4Model<string, string, Tags, Fqns, Views, DeploymentFqns>, 'views'> {
|
|
82
|
+
> extends Omit<ParsedLikeC4Model<string, string, Tags, Fqns, Views, DeploymentFqns>, 'views' | '__'> {
|
|
66
83
|
__?: T
|
|
67
|
-
views: Record<Views, ComputedView | DiagramView
|
|
84
|
+
views: Record<Views, ComputedView<Views> | DiagramView<Views>>
|
|
68
85
|
}
|
|
69
86
|
|
|
70
|
-
/**
|
|
71
|
-
* Same as `ParsedLikeC4Model` but with computed views.
|
|
72
|
-
*/
|
|
73
87
|
export interface ComputedLikeC4Model<
|
|
74
88
|
Fqns extends string = string,
|
|
75
89
|
DeploymentFqns extends string = string,
|
|
76
90
|
Views extends string = string,
|
|
77
91
|
Tags extends string = string
|
|
78
|
-
> extends Omit<
|
|
79
|
-
views: Record<Views, ComputedView
|
|
92
|
+
> extends Omit<GenericLikeC4Model<Fqns, DeploymentFqns, Views, Tags, 'computed'>, 'views'> {
|
|
93
|
+
views: Record<Views, ComputedView<Views>>
|
|
80
94
|
}
|
|
81
95
|
|
|
82
|
-
export type ComputedLikeC4ModelFromParsed<M> = M extends ParsedLikeC4Model ? ComputedLikeC4Model<
|
|
83
|
-
KeysOf<M['elements']>,
|
|
84
|
-
KeysOf<M['deployments']['elements']>,
|
|
85
|
-
KeysOf<M['views']>
|
|
86
|
-
>
|
|
87
|
-
: ComputedLikeC4Model
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Same as `ParsedLikeC4Model` but with layouted views (DiagramView)
|
|
91
|
-
*/
|
|
92
96
|
export interface LayoutedLikeC4Model<
|
|
93
97
|
Fqns extends string = string,
|
|
94
98
|
DeploymentFqns extends string = string,
|
|
95
99
|
Views extends string = string,
|
|
96
100
|
Tags extends string = string
|
|
97
|
-
> extends Omit<
|
|
101
|
+
> extends Omit<GenericLikeC4Model<Fqns, DeploymentFqns, Views, Tags, 'layouted'>, 'views'> {
|
|
98
102
|
__: 'layouted'
|
|
99
103
|
views: Record<Views, DiagramView<Views, Tags>>
|
|
100
104
|
}
|
package/src/types/operators.ts
CHANGED
package/src/types/relation.ts
CHANGED
|
@@ -22,30 +22,34 @@ export type RelationshipArrowType =
|
|
|
22
22
|
| 'open'
|
|
23
23
|
| 'vee'
|
|
24
24
|
|
|
25
|
-
export const DefaultLineStyle = 'dashed'
|
|
26
|
-
export const DefaultArrowType = 'normal'
|
|
27
|
-
export const DefaultRelationshipColor = 'gray'
|
|
25
|
+
export const DefaultLineStyle: RelationshipLineType = 'dashed'
|
|
26
|
+
export const DefaultArrowType: RelationshipArrowType = 'normal'
|
|
27
|
+
export const DefaultRelationshipColor: ThemeColor = 'gray'
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
export interface Relation {
|
|
29
|
+
export interface AbstractRelation {
|
|
31
30
|
readonly id: RelationId
|
|
32
|
-
readonly
|
|
33
|
-
readonly target: Fqn
|
|
34
|
-
readonly title: string
|
|
31
|
+
readonly title?: string
|
|
35
32
|
readonly description?: string
|
|
36
33
|
readonly technology?: string
|
|
37
|
-
readonly tags?: NonEmptyArray<Tag>
|
|
34
|
+
readonly tags?: NonEmptyArray<Tag> | null
|
|
38
35
|
readonly kind?: RelationshipKind
|
|
39
36
|
readonly color?: Color
|
|
40
37
|
readonly line?: RelationshipLineType
|
|
41
38
|
readonly head?: RelationshipArrowType
|
|
42
39
|
readonly tail?: RelationshipArrowType
|
|
43
|
-
readonly links?: NonEmptyArray<Link>
|
|
40
|
+
readonly links?: NonEmptyArray<Link> | null
|
|
44
41
|
// Link to dynamic view
|
|
45
42
|
readonly navigateTo?: ViewId
|
|
46
43
|
readonly metadata?: { [key: string]: string }
|
|
47
44
|
}
|
|
48
45
|
|
|
46
|
+
// TODO: rename to Relationship
|
|
47
|
+
export interface ModelRelation extends AbstractRelation {
|
|
48
|
+
readonly source: Fqn
|
|
49
|
+
readonly target: Fqn
|
|
50
|
+
readonly title: string
|
|
51
|
+
}
|
|
52
|
+
|
|
49
53
|
export interface RelationshipKindSpecification {
|
|
50
54
|
readonly technology?: string
|
|
51
55
|
readonly notation?: string
|
package/src/types/theme.ts
CHANGED
package/src/types/view.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { isArray, isNullish } from 'remeda'
|
|
2
2
|
import type { Tagged } from 'type-fest'
|
|
3
3
|
import type { IconUrl, NonEmptyArray, Point, XYPoint } from './_common'
|
|
4
|
-
import type { DeploymentExpression } from './deployments'
|
|
5
4
|
import {
|
|
6
5
|
type BorderStyle,
|
|
7
6
|
ElementKind,
|
|
@@ -9,9 +8,10 @@ import {
|
|
|
9
8
|
type ElementStyle,
|
|
10
9
|
type Fqn,
|
|
11
10
|
type Link,
|
|
12
|
-
type Tag
|
|
11
|
+
type Tag,
|
|
13
12
|
} from './element'
|
|
14
13
|
import type { ElementExpression, ElementPredicateExpression, Expression } from './expression'
|
|
14
|
+
import type { ExpressionV2, FqnExpr } from './expression-v2'
|
|
15
15
|
import type { GlobalPredicateId, GlobalStyleID } from './global'
|
|
16
16
|
import type { RelationId, RelationshipArrowType, RelationshipKind, RelationshipLineType } from './relation'
|
|
17
17
|
import type { Color, ThemeColorValues } from './theme'
|
|
@@ -82,7 +82,7 @@ export interface ViewRuleAutoLayout {
|
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
export function isViewRuleAutoLayout(
|
|
85
|
-
rule: DeploymentViewRule | DynamicViewRule | ViewRule
|
|
85
|
+
rule: DeploymentViewRule | DynamicViewRule | ViewRule,
|
|
86
86
|
): rule is ViewRuleAutoLayout {
|
|
87
87
|
return 'direction' in rule
|
|
88
88
|
}
|
|
@@ -111,7 +111,7 @@ export type ViewRule =
|
|
|
111
111
|
export interface BasicView<
|
|
112
112
|
ViewType extends 'element' | 'dynamic' | 'deployment',
|
|
113
113
|
ViewIDs extends string,
|
|
114
|
-
Tags extends string
|
|
114
|
+
Tags extends string,
|
|
115
115
|
> {
|
|
116
116
|
readonly __?: ViewType
|
|
117
117
|
readonly id: ViewId<ViewIDs>
|
|
@@ -162,7 +162,7 @@ export interface ExtendsElementView<ViewIDs extends string, Tags extends string>
|
|
|
162
162
|
}
|
|
163
163
|
export type ElementView<
|
|
164
164
|
ViewIDs extends string = string,
|
|
165
|
-
Tags extends string = string
|
|
165
|
+
Tags extends string = string,
|
|
166
166
|
> =
|
|
167
167
|
| ScopedElementView<ViewIDs, Tags>
|
|
168
168
|
| ExtendsElementView<ViewIDs, Tags>
|
|
@@ -205,7 +205,7 @@ export type DynamicViewRule =
|
|
|
205
205
|
| ViewRuleAutoLayout
|
|
206
206
|
export interface DynamicView<
|
|
207
207
|
ViewIDs extends string = string,
|
|
208
|
-
Tags extends string = string
|
|
208
|
+
Tags extends string = string,
|
|
209
209
|
> extends BasicView<'dynamic', ViewIDs, Tags> {
|
|
210
210
|
readonly __: 'dynamic'
|
|
211
211
|
|
|
@@ -222,15 +222,15 @@ export type CustomColorDefinitions = { [key: string]: ThemeColorValues }
|
|
|
222
222
|
|
|
223
223
|
export type DeploymentViewRulePredicate =
|
|
224
224
|
| {
|
|
225
|
-
include:
|
|
225
|
+
include: ExpressionV2[]
|
|
226
226
|
exclude?: never
|
|
227
227
|
}
|
|
228
228
|
| {
|
|
229
229
|
include?: never
|
|
230
|
-
exclude:
|
|
230
|
+
exclude: ExpressionV2[]
|
|
231
231
|
}
|
|
232
232
|
export type DeploymentViewRuleStyle = {
|
|
233
|
-
targets:
|
|
233
|
+
targets: FqnExpr[]
|
|
234
234
|
notation?: string
|
|
235
235
|
style: ElementStyle & {
|
|
236
236
|
color?: Color
|
|
@@ -242,7 +242,7 @@ export type DeploymentViewRule = DeploymentViewRulePredicate | ViewRuleAutoLayou
|
|
|
242
242
|
|
|
243
243
|
export interface DeploymentView<
|
|
244
244
|
ViewIDs extends string = string,
|
|
245
|
-
Tags extends string = string
|
|
245
|
+
Tags extends string = string,
|
|
246
246
|
> extends BasicView<'deployment', ViewIDs, Tags> {
|
|
247
247
|
readonly __: 'deployment'
|
|
248
248
|
readonly rules: DeploymentViewRule[]
|
|
@@ -250,7 +250,7 @@ export interface DeploymentView<
|
|
|
250
250
|
|
|
251
251
|
export type LikeC4View<
|
|
252
252
|
ViewIDs extends string = string,
|
|
253
|
-
Tags extends string = string
|
|
253
|
+
Tags extends string = string,
|
|
254
254
|
> = ElementView<ViewIDs, Tags> | DynamicView<ViewIDs, Tags> | DeploymentView<ViewIDs, Tags>
|
|
255
255
|
|
|
256
256
|
export function isDeploymentView(view: LikeC4View): view is DeploymentView
|
|
@@ -258,9 +258,11 @@ export function isDeploymentView<V extends { __?: string }>(view: V): boolean
|
|
|
258
258
|
export function isDeploymentView(view: LikeC4View): view is DeploymentView {
|
|
259
259
|
return view.__ === 'deployment'
|
|
260
260
|
}
|
|
261
|
+
|
|
261
262
|
export function isDynamicView(view: LikeC4View): view is DynamicView {
|
|
262
263
|
return view.__ === 'dynamic'
|
|
263
264
|
}
|
|
265
|
+
|
|
264
266
|
export function isElementView(view: LikeC4View): view is ElementView {
|
|
265
267
|
return isNullish(view.__) || view.__ === 'element'
|
|
266
268
|
}
|
|
@@ -408,7 +410,7 @@ export interface ViewAutoLayout {
|
|
|
408
410
|
}
|
|
409
411
|
export interface ComputedElementView<
|
|
410
412
|
ViewIDs extends string = string,
|
|
411
|
-
Tags extends string = string
|
|
413
|
+
Tags extends string = string,
|
|
412
414
|
> extends Omit<ElementView<ViewIDs, Tags>, 'rules' | 'docUri'>, ViewWithHash, ViewWithNotation {
|
|
413
415
|
readonly extends?: ViewId<ViewIDs>
|
|
414
416
|
readonly autoLayout: ViewAutoLayout
|
|
@@ -419,7 +421,7 @@ export interface ComputedElementView<
|
|
|
419
421
|
}
|
|
420
422
|
export interface ComputedDynamicView<
|
|
421
423
|
ViewIDs extends string = string,
|
|
422
|
-
Tags extends string = string
|
|
424
|
+
Tags extends string = string,
|
|
423
425
|
> extends Omit<DynamicView<ViewIDs, Tags>, 'rules' | 'steps' | 'docUri'>, ViewWithHash, ViewWithNotation {
|
|
424
426
|
readonly autoLayout: ViewAutoLayout
|
|
425
427
|
readonly nodes: ComputedNode[]
|
|
@@ -431,7 +433,7 @@ export interface ComputedDynamicView<
|
|
|
431
433
|
|
|
432
434
|
export interface ComputedDeploymentView<
|
|
433
435
|
ViewIDs extends string = string,
|
|
434
|
-
Tags extends string = string
|
|
436
|
+
Tags extends string = string,
|
|
435
437
|
> extends Omit<DeploymentView<ViewIDs, Tags>, 'rules' | 'docUri'>, ViewWithHash, ViewWithNotation {
|
|
436
438
|
readonly autoLayout: ViewAutoLayout
|
|
437
439
|
readonly nodes: ComputedNode[]
|
|
@@ -442,7 +444,7 @@ export interface ComputedDeploymentView<
|
|
|
442
444
|
|
|
443
445
|
export type ComputedView<
|
|
444
446
|
ViewIDs extends string = string,
|
|
445
|
-
Tags extends string = string
|
|
447
|
+
Tags extends string = string,
|
|
446
448
|
> = ComputedElementView<ViewIDs, Tags> | ComputedDynamicView<ViewIDs, Tags> | ComputedDeploymentView<ViewIDs, Tags>
|
|
447
449
|
|
|
448
450
|
export namespace ComputedView {
|
|
@@ -469,11 +471,11 @@ export function getBBoxCenter({
|
|
|
469
471
|
x,
|
|
470
472
|
y,
|
|
471
473
|
width,
|
|
472
|
-
height
|
|
474
|
+
height,
|
|
473
475
|
}: BBox): XYPoint {
|
|
474
476
|
return {
|
|
475
477
|
x: x + width / 2,
|
|
476
|
-
y: y + height / 2
|
|
478
|
+
y: y + height / 2,
|
|
477
479
|
}
|
|
478
480
|
}
|
|
479
481
|
|
|
@@ -513,7 +515,7 @@ export interface DiagramEdge extends ComputedEdge {
|
|
|
513
515
|
|
|
514
516
|
export interface DiagramView<
|
|
515
517
|
ViewIDs extends string = string,
|
|
516
|
-
Tags extends string = string
|
|
518
|
+
Tags extends string = string,
|
|
517
519
|
> extends Omit<ComputedView<ViewIDs, Tags>, 'nodes' | 'edges' | 'manualLayout'> {
|
|
518
520
|
readonly nodes: DiagramNode[]
|
|
519
521
|
readonly edges: DiagramEdge[]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const customInspectSymbol = Symbol.for('nodejs.util.inspect.custom')
|