@likec4/core 1.31.0 → 1.32.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/README.md +407 -5
- package/dist/builder/index.d.mts +221 -42
- package/dist/builder/index.mjs +118 -65
- package/dist/compute-view/index.d.mts +23 -7
- package/dist/compute-view/index.mjs +11 -6
- package/dist/compute-view/relationships-view/index.d.mts +9 -7
- package/dist/compute-view/relationships-view/index.mjs +3 -2
- package/dist/index.d.mts +10 -14
- package/dist/index.mjs +9 -6
- package/dist/model/index.d.mts +173 -19
- package/dist/model/index.mjs +6 -1
- package/dist/shared/core.BaYE_r29.d.mts +258 -0
- package/dist/shared/core.Bk7wEZFG.mjs +276 -0
- package/dist/shared/core.BrCnZFTn.mjs +32 -0
- package/dist/shared/core.BuO4ncfY.d.mts +146 -0
- package/dist/shared/{core.Bq753SYD.mjs → core.CBpKAlhj.mjs} +2012 -4422
- package/dist/shared/core.CCWXGc6G.d.mts +920 -0
- package/dist/shared/core.CUYDgv2-.mjs +214 -0
- package/dist/shared/{core.Cu-UdkSl.mjs → core.CpXlRyE5.mjs} +7 -494
- package/dist/shared/{core.C-YXI-43.mjs → core.Cy9smucx.mjs} +3 -1
- package/dist/shared/core.CywrQs86.d.mts +31 -0
- package/dist/shared/core.DoK86JEe.mjs +518 -0
- package/dist/shared/core.Dpq3P3YJ.d.mts +1265 -0
- package/dist/shared/{core.D2830qgg.d.mts → core.Pf5I9o0e.d.mts} +1 -1
- package/dist/shared/core.cbA9VZ02.mjs +2681 -0
- package/dist/shared/{core.CQXU9DF7.mjs → core.rmvsy0n3.mjs} +23 -32
- package/dist/types/aux.d.mts +3 -0
- package/dist/types/aux.mjs +1 -0
- package/dist/types/index.d.mts +7 -45
- package/dist/types/index.mjs +130 -3
- package/dist/utils/index.d.mts +221 -53
- package/dist/utils/index.mjs +14 -10
- package/package.json +15 -7
- package/src/builder/Builder.deploymentModel.ts +82 -18
- package/src/builder/Builder.element.ts +40 -20
- package/src/builder/Builder.model.ts +66 -17
- package/src/builder/Builder.ts +168 -76
- package/src/builder/Builder.view-common.ts +35 -17
- package/src/builder/Builder.view-deployment.ts +25 -25
- package/src/builder/Builder.view-element.ts +13 -12
- package/src/builder/Builder.views.ts +12 -7
- package/src/builder/__snapshots__/Builder-style1.spec.ts.snap +62 -34
- package/src/builder/__snapshots__/Builder-style2.compute-model.json5 +319 -0
- package/src/builder/__snapshots__/Builder-style2.spec.ts.snap +45 -24
- package/src/builder/_types.ts +34 -27
- package/src/compute-view/compute-view.ts +31 -34
- package/src/compute-view/deployment-view/__test__/TestHelper.ts +27 -14
- package/src/compute-view/deployment-view/__test__/fixture.ts +15 -13
- package/src/compute-view/deployment-view/_types.ts +10 -10
- package/src/compute-view/deployment-view/clean-connections.ts +5 -7
- package/src/compute-view/deployment-view/compute.ts +16 -13
- package/src/compute-view/deployment-view/memory/memory.ts +5 -6
- package/src/compute-view/deployment-view/predicates/deploymentRefs.ts +4 -5
- package/src/compute-view/deployment-view/predicates/relation-direct.ts +25 -50
- package/src/compute-view/deployment-view/predicates/relation-in-out.ts +5 -7
- package/src/compute-view/deployment-view/predicates/relation-incoming.ts +7 -11
- package/src/compute-view/deployment-view/predicates/relation-outgoing.ts +7 -10
- package/src/compute-view/deployment-view/predicates/utils.ts +37 -31
- package/src/compute-view/deployment-view/predicates/wildcard.ts +3 -2
- package/src/compute-view/deployment-view/stages/stage-final.ts +2 -2
- package/src/compute-view/deployment-view/stages/stage-include.ts +1 -1
- package/src/compute-view/deployment-view/utils.ts +79 -72
- package/src/compute-view/dynamic-view/__test__/fixture.ts +20 -11
- package/src/compute-view/dynamic-view/compute.ts +60 -53
- package/src/compute-view/element-view/__test__/TestHelper.ts +53 -29
- package/src/compute-view/element-view/__test__/__snapshots__/legacy.spec.ts.snap +26 -26
- package/src/compute-view/element-view/__test__/fixture.ts +134 -83
- package/src/compute-view/element-view/_types.ts +14 -19
- package/src/compute-view/element-view/clean-connections.ts +12 -8
- package/src/compute-view/element-view/compute.ts +61 -51
- package/src/compute-view/element-view/memory/NodeGroup.ts +8 -9
- package/src/compute-view/element-view/memory/memory.ts +22 -22
- package/src/compute-view/element-view/memory/stage-include.ts +5 -3
- package/src/compute-view/element-view/predicates/_utils.ts +18 -14
- package/src/compute-view/element-view/predicates/element-expand.ts +4 -5
- package/src/compute-view/element-view/predicates/element-kind-tag.ts +3 -4
- package/src/compute-view/element-view/predicates/element-ref.ts +3 -4
- package/src/compute-view/element-view/predicates/relation-direct.ts +16 -12
- package/src/compute-view/element-view/predicates/relation-in-out.ts +7 -8
- package/src/compute-view/element-view/predicates/relation-in.ts +19 -26
- package/src/compute-view/element-view/predicates/relation-out.ts +20 -21
- package/src/compute-view/element-view/predicates/wildcard.ts +3 -3
- package/src/compute-view/element-view/utils.ts +25 -23
- package/src/compute-view/index.ts +1 -1
- package/src/compute-view/memory/AbstractStageExclude.ts +3 -4
- package/src/compute-view/memory/AbstractStageInclude.ts +1 -1
- package/src/compute-view/memory/_types.ts +3 -2
- package/src/compute-view/relationships-view/_types.ts +3 -4
- package/src/compute-view/relationships-view/compute.ts +8 -11
- package/src/compute-view/relationships-view/layout.ts +6 -6
- package/src/compute-view/relationships-view/utils.ts +4 -4
- package/src/compute-view/utils/ancestorsOfNode.ts +7 -7
- package/src/compute-view/utils/applyCustomElementProperties.ts +16 -8
- package/src/compute-view/utils/applyCustomRelationProperties.ts +19 -9
- package/src/compute-view/utils/applyViewRuleStyles.ts +18 -10
- package/src/compute-view/utils/buildComputedNodes.ts +40 -40
- package/src/compute-view/utils/buildElementNotations.ts +14 -14
- package/src/compute-view/utils/elementExpressionToPredicate.ts +14 -15
- package/src/compute-view/utils/link-nodes-with-edges.ts +6 -4
- package/src/compute-view/utils/merge-props-from-relationships.ts +52 -20
- package/src/compute-view/utils/relationExpressionToPredicates.ts +19 -19
- package/src/compute-view/utils/resolve-extended-views.ts +8 -7
- package/src/compute-view/utils/resolve-global-rules.ts +31 -26
- package/src/compute-view/utils/topological-sort.ts +14 -14
- package/src/compute-view/utils/view-hash.ts +2 -2
- package/src/compute-view/utils/with-readable-edges.ts +9 -5
- package/src/index.ts +0 -32
- package/src/model/DeploymentElementModel.ts +171 -144
- package/src/model/DeploymentModel.ts +88 -65
- package/src/model/ElementModel.ts +85 -74
- package/src/model/LikeC4Model.ts +430 -241
- package/src/model/RelationModel.ts +63 -29
- package/src/model/__test__/fixture.ts +50 -36
- package/src/model/connection/Connection.ts +2 -2
- package/src/model/connection/deployment/DeploymentConnectionModel.ts +21 -24
- package/src/model/connection/deployment/find.ts +1 -1
- package/src/model/connection/model/ConnectionModel.ts +21 -20
- package/src/model/connection/model/find.ts +7 -7
- package/src/model/connection/ops.ts +6 -6
- package/src/model/guards.ts +66 -14
- package/src/model/index.ts +20 -7
- package/src/model/types.ts +41 -97
- package/src/model/view/EdgeModel.ts +47 -41
- package/src/model/view/LikeC4ViewModel.ts +130 -80
- package/src/model/view/NodeModel.ts +102 -96
- package/src/theme/element.ts +1 -1
- package/src/theme/index.ts +9 -9
- package/src/theme/relationships.ts +1 -1
- package/src/types/_common.ts +21 -15
- package/src/types/aux.ts +285 -0
- package/src/types/const.ts +34 -0
- package/src/types/expression-model.ts +292 -0
- package/src/types/expression.ts +311 -0
- package/src/types/fqnRef.ts +88 -0
- package/src/types/geometry.ts +131 -0
- package/src/types/global.ts +10 -8
- package/src/types/index.ts +39 -201
- package/src/types/model-data.ts +52 -84
- package/src/types/model-deployment.ts +87 -0
- package/src/types/model-dump.ts +72 -0
- package/src/types/model-logical.ts +111 -0
- package/src/types/model-spec.ts +81 -0
- package/src/types/operators.ts +51 -52
- package/src/types/scalar.ts +114 -0
- package/src/types/styles.ts +123 -0
- package/src/types/view-changes.ts +4 -5
- package/src/types/view-common.ts +157 -0
- package/src/types/view-computed.ts +113 -0
- package/src/types/view-layouted.ts +82 -0
- package/src/types/view-parsed.deployment.ts +40 -0
- package/src/types/view-parsed.dynamic.ts +78 -0
- package/src/types/view-parsed.element.ts +65 -0
- package/src/types/view.ts +122 -542
- package/src/utils/compare-natural.ts +43 -1
- package/src/utils/getOrCreate.ts +0 -34
- package/src/utils/index.ts +7 -12
- package/src/utils/iterable/filter.ts +1 -1
- package/src/utils/iterable/find.ts +3 -1
- package/src/utils/iterable/head.ts +22 -0
- package/src/utils/iterable/index.ts +1 -0
- package/src/utils/iterable/map.ts +1 -1
- package/src/utils/iterable/reduce.ts +1 -1
- package/src/utils/iterable/some.ts +1 -1
- package/src/utils/memoize-prop.ts +30 -0
- package/src/utils/object-hash.ts +1 -1
- package/src/utils/relations.ts +14 -11
- package/src/utils/string-hash.ts +1 -1
- package/dist/shared/core.CQDU11hR.d.mts +0 -753
- package/dist/shared/core.DJvmfnEi.d.mts +0 -1153
- package/dist/shared/core.DgfwjBtu.mjs +0 -495
- package/dist/shared/core.Dx7siloV.d.mts +0 -146
- package/dist/shared/core.SjLhMA7a.d.mts +0 -62
- package/src/builder/__snapshots__/Builder.spec.ts.snap +0 -374
- package/src/compute-view/element-view/predicates.ts +0 -520
- package/src/compute-view/utils/uniqueTags.ts +0 -21
- package/src/types/deployments.ts +0 -170
- package/src/types/element.ts +0 -109
- package/src/types/expression-v2-model.ts +0 -314
- package/src/types/expression-v2.ts +0 -392
- package/src/types/overview-graph.ts +0 -43
- package/src/types/relation.ts +0 -61
- package/src/types/scalars.ts +0 -39
- package/src/types/theme.ts +0 -82
- package/src/types/view-notation.ts +0 -9
- package/src/utils/graphlib.ts +0 -10
- /package/src/{errors/index.ts → utils/invariant.ts} +0 -0
|
@@ -0,0 +1,1265 @@
|
|
|
1
|
+
import { TupleToUnion, Tagged, Simplify, MergeExclusive, NonEmptyTuple, IsNever, IsAny } from 'type-fest';
|
|
2
|
+
import { f as ExclusiveUnion, d as NonEmptyArray, i as Icon, L as Link, R as RelationId, T as Tag$1, N as NodeId, E as EdgeId, r as StepEdgeKind, K as KeysOf } from './core.BuO4ncfY.mjs';
|
|
3
|
+
import { A as Any, U as Unknown, g as ElementId, P as ProjectId, F as Fqn, u as DeploymentId, v as Tag, y as AllKinds, T as Tags, n as StrictViewId, l as ElementKind, W as WithOptionalTags, z as WithOptionalLinks, _ as _stage, f as _type, B as WithMetadata, j as Metadata, R as RelationKind, V as ViewId, q as DeploymentFqn, D as DeploymentKind, k as MetadataKey, E as ExtractOnStage, M as ModelStage, e as UnknownParsed, c as UnknownComputed, d as UnknownLayouted, S as SpecAux, b as Aux, N as Never } from './core.BaYE_r29.mjs';
|
|
4
|
+
|
|
5
|
+
declare namespace FqnRef {
|
|
6
|
+
/**
|
|
7
|
+
* Reference to logical model element
|
|
8
|
+
*/
|
|
9
|
+
interface ElementRef<A extends Any = Unknown> {
|
|
10
|
+
project?: never;
|
|
11
|
+
model: ElementId<A>;
|
|
12
|
+
}
|
|
13
|
+
function isElementRef<A extends Any>(ref: FqnRef<A>): ref is ElementRef<A>;
|
|
14
|
+
/**
|
|
15
|
+
* Reference to imported logical model element
|
|
16
|
+
*/
|
|
17
|
+
interface ImportRef<A extends Any = Unknown> {
|
|
18
|
+
project: ProjectId<A>;
|
|
19
|
+
model: ElementId<A>;
|
|
20
|
+
}
|
|
21
|
+
function isImportRef<A extends Any>(ref: FqnRef<A>): ref is ImportRef<A>;
|
|
22
|
+
function flatten<A extends Any>(ref: FqnRef<A>): Fqn<A>;
|
|
23
|
+
type ModelRef<A extends Any = Unknown> = ImportRef<A> | ElementRef<A>;
|
|
24
|
+
function isModelRef<A extends Any>(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 Any = Unknown> {
|
|
35
|
+
deployment: DeploymentId<A>;
|
|
36
|
+
element: ElementId<A>;
|
|
37
|
+
}
|
|
38
|
+
function isInsideInstanceRef<A extends Any>(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 Any> {
|
|
46
|
+
deployment: DeploymentId<A>;
|
|
47
|
+
element?: never;
|
|
48
|
+
}
|
|
49
|
+
function isDeploymentElementRef<A extends Any>(ref: FqnRef<A>): ref is DeploymentElementRef<A>;
|
|
50
|
+
type DeploymentRef<A extends Any> = DeploymentElementRef<A> | InsideInstanceRef<A>;
|
|
51
|
+
function isDeploymentRef<A extends Any>(ref: FqnRef<A>): ref is DeploymentRef<A>;
|
|
52
|
+
}
|
|
53
|
+
type FqnRef<A extends Any = Unknown> = ExclusiveUnion<{
|
|
54
|
+
DeploymentRef: FqnRef.DeploymentRef<A>;
|
|
55
|
+
ModelRef: FqnRef.ModelRef<A>;
|
|
56
|
+
}>;
|
|
57
|
+
|
|
58
|
+
type EqualOperator<V> = {
|
|
59
|
+
eq: V;
|
|
60
|
+
neq?: never;
|
|
61
|
+
} | {
|
|
62
|
+
eq?: never;
|
|
63
|
+
neq: V;
|
|
64
|
+
};
|
|
65
|
+
type AllNever = {
|
|
66
|
+
not?: never;
|
|
67
|
+
and?: never;
|
|
68
|
+
or?: never;
|
|
69
|
+
tag?: never;
|
|
70
|
+
kind?: never;
|
|
71
|
+
participant?: never;
|
|
72
|
+
operator?: never;
|
|
73
|
+
};
|
|
74
|
+
type TagEqual<A extends Any> = Omit<AllNever, 'tag'> & {
|
|
75
|
+
tag: EqualOperator<Tag<A>> | Tag<A>;
|
|
76
|
+
};
|
|
77
|
+
declare function isTagEqual<A extends Any>(operator: WhereOperator<A>): operator is TagEqual<A>;
|
|
78
|
+
type KindEqual<A extends Any> = Omit<AllNever, 'kind'> & {
|
|
79
|
+
kind: EqualOperator<AllKinds<A>> | AllKinds<A>;
|
|
80
|
+
};
|
|
81
|
+
declare function isKindEqual<A extends Any>(operator: WhereOperator<A>): operator is KindEqual<A>;
|
|
82
|
+
type Participant = 'source' | 'target';
|
|
83
|
+
type ParticipantOperator<A extends Any> = Omit<AllNever, 'participant' | 'operator'> & {
|
|
84
|
+
participant: Participant;
|
|
85
|
+
operator: KindEqual<A> | TagEqual<A>;
|
|
86
|
+
};
|
|
87
|
+
declare function isParticipantOperator<A extends Any>(operator: WhereOperator<A>): operator is ParticipantOperator<A>;
|
|
88
|
+
type NotOperator<A extends Any> = Omit<AllNever, 'not'> & {
|
|
89
|
+
not: WhereOperator<A>;
|
|
90
|
+
};
|
|
91
|
+
declare function isNotOperator<A extends Any>(operator: WhereOperator<A>): operator is NotOperator<A>;
|
|
92
|
+
type AndOperator<A extends Any> = Omit<AllNever, 'and'> & {
|
|
93
|
+
and: NonEmptyArray<WhereOperator<A>>;
|
|
94
|
+
};
|
|
95
|
+
declare function isAndOperator<A extends Any>(operator: WhereOperator<A>): operator is AndOperator<A>;
|
|
96
|
+
type OrOperator<A extends Any> = Omit<AllNever, 'or'> & {
|
|
97
|
+
or: NonEmptyArray<WhereOperator<A>>;
|
|
98
|
+
};
|
|
99
|
+
declare function isOrOperator<A extends Any>(operator: WhereOperator<A>): operator is OrOperator<A>;
|
|
100
|
+
type WhereOperator<A extends Any = Any> = TagEqual<A> | KindEqual<A> | ParticipantOperator<A> | NotOperator<A> | AndOperator<A> | OrOperator<A>;
|
|
101
|
+
type Filterable<A extends Any> = {
|
|
102
|
+
tags?: Tags<A> | null | undefined;
|
|
103
|
+
kind?: AllKinds<A> | null | undefined;
|
|
104
|
+
source?: Filterable<A>;
|
|
105
|
+
target?: Filterable<A>;
|
|
106
|
+
};
|
|
107
|
+
type OperatorPredicate<A extends Any> = (value: Filterable<A>) => boolean;
|
|
108
|
+
declare function whereOperatorAsPredicate<A extends Any>(operator: WhereOperator<A>): OperatorPredicate<A>;
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* For padding, margin, etc.
|
|
112
|
+
*/
|
|
113
|
+
type SpacingSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
114
|
+
type TextSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
115
|
+
type ShapeSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
116
|
+
declare const BorderStyles: readonly ["solid", "dashed", "dotted", "none"];
|
|
117
|
+
type BorderStyle = TupleToUnion<typeof BorderStyles>;
|
|
118
|
+
declare const ElementShapes: readonly ["rectangle", "person", "browser", "mobile", "cylinder", "storage", "queue"];
|
|
119
|
+
type ElementShape = TupleToUnion<typeof ElementShapes>;
|
|
120
|
+
type HexColor = `#${string}`;
|
|
121
|
+
type Comma = ',' | ', ';
|
|
122
|
+
type ColorLiteral = HexColor | `rgb(${number}${Comma}${number}${Comma}${number})` | `rgba(${number}${Comma}${number}${Comma}${number}${Comma}${number})`;
|
|
123
|
+
type CustomColor<T = string> = Tagged<T, 'CustomColor'>;
|
|
124
|
+
type CustomColorDefinitions = {
|
|
125
|
+
[key: string]: ThemeColorValues;
|
|
126
|
+
};
|
|
127
|
+
type RelationshipLineType = 'dashed' | 'solid' | 'dotted';
|
|
128
|
+
type RelationshipArrowType = 'none' | 'normal' | 'onormal' | 'dot' | 'odot' | 'diamond' | 'odiamond' | 'crow' | 'open' | 'vee';
|
|
129
|
+
declare const ThemeColors: readonly ["amber", "blue", "gray", "slate", "green", "indigo", "muted", "primary", "red", "secondary", "sky"];
|
|
130
|
+
type ThemeColor = typeof ThemeColors[number];
|
|
131
|
+
/**
|
|
132
|
+
* Backward compatibility alias
|
|
133
|
+
* @deprecated Use {@link ThemeColor} instead
|
|
134
|
+
*/
|
|
135
|
+
type Color = ThemeColor | HexColor;
|
|
136
|
+
declare function isThemeColor(color: string): color is ThemeColor;
|
|
137
|
+
interface ElementThemeColorValues {
|
|
138
|
+
fill: HexColor;
|
|
139
|
+
stroke: HexColor;
|
|
140
|
+
hiContrast: HexColor;
|
|
141
|
+
loContrast: HexColor;
|
|
142
|
+
}
|
|
143
|
+
type ElementThemeColors = {
|
|
144
|
+
[key in ThemeColor]: ElementThemeColorValues;
|
|
145
|
+
};
|
|
146
|
+
interface RelationshipThemeColorValues {
|
|
147
|
+
lineColor: HexColor;
|
|
148
|
+
labelBgColor: HexColor;
|
|
149
|
+
labelColor: HexColor;
|
|
150
|
+
}
|
|
151
|
+
interface ThemeColorValues {
|
|
152
|
+
elements: ElementThemeColorValues;
|
|
153
|
+
relationships: RelationshipThemeColorValues;
|
|
154
|
+
}
|
|
155
|
+
type RelationshipThemeColors = {
|
|
156
|
+
[key in ThemeColor]: RelationshipThemeColorValues;
|
|
157
|
+
};
|
|
158
|
+
interface LikeC4Theme {
|
|
159
|
+
font: 'Arial';
|
|
160
|
+
shadow: ColorLiteral;
|
|
161
|
+
relationships: RelationshipThemeColors;
|
|
162
|
+
elements: ElementThemeColors;
|
|
163
|
+
sizes: {
|
|
164
|
+
[key in ShapeSize]: {
|
|
165
|
+
width: number;
|
|
166
|
+
height: number;
|
|
167
|
+
};
|
|
168
|
+
};
|
|
169
|
+
spacing: {
|
|
170
|
+
[key in SpacingSize]: number;
|
|
171
|
+
};
|
|
172
|
+
textSizes: {
|
|
173
|
+
[key in TextSize]: number;
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
type PredicateSelector = 'children' | 'expanded' | 'descendants';
|
|
178
|
+
declare namespace FqnExpr {
|
|
179
|
+
type Wildcard = {
|
|
180
|
+
wildcard: true;
|
|
181
|
+
};
|
|
182
|
+
function isWildcard<A extends Any>(expr: Expression<A>): expr is FqnExpr.Wildcard;
|
|
183
|
+
interface ModelRef<M extends Any = Any> {
|
|
184
|
+
ref: FqnRef.ModelRef<M>;
|
|
185
|
+
selector?: PredicateSelector;
|
|
186
|
+
}
|
|
187
|
+
function isModelRef<A extends Any>(ref: Expression<A>): ref is FqnExpr.ModelRef<A>;
|
|
188
|
+
interface DeploymentRef<A extends Any = Any> {
|
|
189
|
+
ref: FqnRef.DeploymentRef<A>;
|
|
190
|
+
selector?: PredicateSelector;
|
|
191
|
+
}
|
|
192
|
+
function isDeploymentRef<A extends Any>(expr: Expression<A>): expr is FqnExpr.DeploymentRef<A>;
|
|
193
|
+
interface ElementKindExpr<A extends Any = Any> {
|
|
194
|
+
elementKind: ElementKind<A>;
|
|
195
|
+
isEqual: boolean;
|
|
196
|
+
}
|
|
197
|
+
function isElementKindExpr<A extends Any>(expr: Expression<A>): expr is ElementKindExpr<A>;
|
|
198
|
+
interface ElementTagExpr<A extends Any = Any> {
|
|
199
|
+
elementTag: Tag<A>;
|
|
200
|
+
isEqual: boolean;
|
|
201
|
+
}
|
|
202
|
+
function isElementTagExpr<A extends Any>(expr: Expression<A>): expr is ElementTagExpr<A>;
|
|
203
|
+
type NonWildcard<A extends Any = Any> = ExclusiveUnion<{
|
|
204
|
+
ModelRef: ModelRef<A>;
|
|
205
|
+
DeploymentRef: DeploymentRef<A>;
|
|
206
|
+
ElementKind: ElementKindExpr<A>;
|
|
207
|
+
ElementTag: ElementTagExpr<A>;
|
|
208
|
+
}>;
|
|
209
|
+
interface Where<A extends Any = Any> {
|
|
210
|
+
where: {
|
|
211
|
+
expr: ExclusiveUnion<{
|
|
212
|
+
Wildcard: Wildcard;
|
|
213
|
+
ModelRef: ModelRef<A>;
|
|
214
|
+
DeploymentRef: DeploymentRef<A>;
|
|
215
|
+
ElementKind: ElementKindExpr<A>;
|
|
216
|
+
ElementTag: ElementTagExpr<A>;
|
|
217
|
+
}>;
|
|
218
|
+
condition: WhereOperator<A>;
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
function isWhere<A extends Any>(expr: Expression<A>): expr is FqnExpr.Where<A>;
|
|
222
|
+
interface Custom<A extends Any = Any> {
|
|
223
|
+
custom: {
|
|
224
|
+
expr: OrWhere<A>;
|
|
225
|
+
title?: string;
|
|
226
|
+
description?: string;
|
|
227
|
+
technology?: string;
|
|
228
|
+
notation?: string;
|
|
229
|
+
shape?: ElementShape;
|
|
230
|
+
color?: Color;
|
|
231
|
+
icon?: Icon;
|
|
232
|
+
border?: BorderStyle;
|
|
233
|
+
opacity?: number;
|
|
234
|
+
navigateTo?: StrictViewId<A>;
|
|
235
|
+
multiple?: boolean;
|
|
236
|
+
size?: ShapeSize;
|
|
237
|
+
padding?: ShapeSize;
|
|
238
|
+
textSize?: ShapeSize;
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
function isCustom<A extends Any>(expr: Expression<A>): expr is Custom<A>;
|
|
242
|
+
function is<A extends Any>(expr: Expression<A>): expr is FqnExpr<A>;
|
|
243
|
+
type OrWhere<A extends Any = Any> = ExclusiveUnion<{
|
|
244
|
+
Wildcard: FqnExpr.Wildcard;
|
|
245
|
+
ModelRef: FqnExpr.ModelRef<A>;
|
|
246
|
+
DeploymentRef: FqnExpr.DeploymentRef<A>;
|
|
247
|
+
ElementKind: ElementKindExpr<A>;
|
|
248
|
+
ElementTag: ElementTagExpr<A>;
|
|
249
|
+
Where: FqnExpr.Where<A>;
|
|
250
|
+
}>;
|
|
251
|
+
type Any<A extends Any = Any> = ExclusiveUnion<{
|
|
252
|
+
Wildcard: Wildcard;
|
|
253
|
+
ModelRef: ModelRef<A>;
|
|
254
|
+
DeploymentRef: DeploymentRef<A>;
|
|
255
|
+
ElementKind: ElementKindExpr<A>;
|
|
256
|
+
ElementTag: ElementTagExpr<A>;
|
|
257
|
+
Where: Where<A>;
|
|
258
|
+
Custom: Custom<A>;
|
|
259
|
+
}>;
|
|
260
|
+
function unwrap<A extends Any>(expr: FqnExpr.Any<A>): Wildcard | ModelRef<A> | DeploymentRef<A> | ElementKindExpr<A> | ElementTagExpr<A>;
|
|
261
|
+
}
|
|
262
|
+
type FqnExpr<A extends Any = Any> = ExclusiveUnion<{
|
|
263
|
+
Wildcard: FqnExpr.Wildcard;
|
|
264
|
+
ModelRef: FqnExpr.ModelRef<A>;
|
|
265
|
+
DeploymentRef: FqnExpr.DeploymentRef<A>;
|
|
266
|
+
ElementKind: FqnExpr.ElementKindExpr<A>;
|
|
267
|
+
ElementTag: FqnExpr.ElementTagExpr<A>;
|
|
268
|
+
}>;
|
|
269
|
+
declare namespace RelationExpr {
|
|
270
|
+
type Endpoint<A extends Any = Any> = FqnExpr.Where<A>['where']['expr'];
|
|
271
|
+
interface Direct<A extends Any = Any> {
|
|
272
|
+
source: Endpoint<A>;
|
|
273
|
+
target: Endpoint<A>;
|
|
274
|
+
isBidirectional?: boolean;
|
|
275
|
+
}
|
|
276
|
+
function isDirect<A extends Any>(expr: Expression<A>): expr is RelationExpr.Direct<A>;
|
|
277
|
+
interface Incoming<A extends Any = Any> {
|
|
278
|
+
incoming: Endpoint<A>;
|
|
279
|
+
}
|
|
280
|
+
function isIncoming<A extends Any>(expr: Expression<A>): expr is RelationExpr.Incoming<A>;
|
|
281
|
+
interface Outgoing<A extends Any = Any> {
|
|
282
|
+
outgoing: Endpoint<A>;
|
|
283
|
+
}
|
|
284
|
+
function isOutgoing<A extends Any>(expr: Expression<A>): expr is RelationExpr.Outgoing<A>;
|
|
285
|
+
interface InOut<A extends Any = Any> {
|
|
286
|
+
inout: Endpoint<A>;
|
|
287
|
+
}
|
|
288
|
+
function isInOut<A extends Any>(expr: Expression<A>): expr is RelationExpr.InOut<A>;
|
|
289
|
+
interface Where<A extends Any = Any> {
|
|
290
|
+
where: {
|
|
291
|
+
expr: ExclusiveUnion<{
|
|
292
|
+
Direct: RelationExpr.Direct<A>;
|
|
293
|
+
Incoming: RelationExpr.Incoming<A>;
|
|
294
|
+
Outgoing: RelationExpr.Outgoing<A>;
|
|
295
|
+
InOut: RelationExpr.InOut<A>;
|
|
296
|
+
}>;
|
|
297
|
+
condition: WhereOperator<A>;
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
function isWhere<A extends Any>(expr: Expression<A>): expr is RelationExpr.Where<A>;
|
|
301
|
+
interface Custom<A extends Any = Any> {
|
|
302
|
+
customRelation: {
|
|
303
|
+
expr: OrWhere<A>;
|
|
304
|
+
title?: string;
|
|
305
|
+
description?: string;
|
|
306
|
+
technology?: string;
|
|
307
|
+
notation?: string;
|
|
308
|
+
navigateTo?: StrictViewId<A>;
|
|
309
|
+
notes?: string;
|
|
310
|
+
color?: Color;
|
|
311
|
+
line?: RelationshipLineType;
|
|
312
|
+
head?: RelationshipArrowType;
|
|
313
|
+
tail?: RelationshipArrowType;
|
|
314
|
+
};
|
|
315
|
+
}
|
|
316
|
+
function isCustom<A extends Any>(expr: Expression<A>): expr is Custom<A>;
|
|
317
|
+
function is<A extends Any>(expr: Expression<A>): expr is RelationExpr<A>;
|
|
318
|
+
type OrWhere<A extends Any = Any> = ExclusiveUnion<{
|
|
319
|
+
Direct: Direct<A>;
|
|
320
|
+
Incoming: Incoming<A>;
|
|
321
|
+
Outgoing: Outgoing<A>;
|
|
322
|
+
InOut: InOut<A>;
|
|
323
|
+
Where: Where<A>;
|
|
324
|
+
}>;
|
|
325
|
+
type Any<A extends Any = Any> = ExclusiveUnion<{
|
|
326
|
+
Direct: Direct<A>;
|
|
327
|
+
Incoming: Incoming<A>;
|
|
328
|
+
Outgoing: Outgoing<A>;
|
|
329
|
+
InOut: InOut<A>;
|
|
330
|
+
Where: Where<A>;
|
|
331
|
+
Custom: Custom<A>;
|
|
332
|
+
}>;
|
|
333
|
+
function unwrap<A extends Any>(expr: RelationExpr.Any<A>): Direct<A> | Incoming<A> | Outgoing<A> | InOut<A>;
|
|
334
|
+
}
|
|
335
|
+
type RelationExpr<A extends Any = Any> = ExclusiveUnion<{
|
|
336
|
+
Direct: RelationExpr.Direct<A>;
|
|
337
|
+
Incoming: RelationExpr.Incoming<A>;
|
|
338
|
+
Outgoing: RelationExpr.Outgoing<A>;
|
|
339
|
+
InOut: RelationExpr.InOut<A>;
|
|
340
|
+
}>;
|
|
341
|
+
/**
|
|
342
|
+
* Represents a version 2 expression which can be one of several types.
|
|
343
|
+
*
|
|
344
|
+
* @template D - The type for the deployment FQN, defaults to `Fqn`.
|
|
345
|
+
* @template M - The type for the model FQN, defaults to `Fqn`.
|
|
346
|
+
*/
|
|
347
|
+
type Expression<A extends Any = Any> = ExclusiveUnion<{
|
|
348
|
+
Wildcard: FqnExpr.Wildcard;
|
|
349
|
+
ModelRef: FqnExpr.ModelRef<A>;
|
|
350
|
+
DeploymentRef: FqnExpr.DeploymentRef<A>;
|
|
351
|
+
ElementKind: FqnExpr.ElementKindExpr<A>;
|
|
352
|
+
ElementTag: FqnExpr.ElementTagExpr<A>;
|
|
353
|
+
Custom: FqnExpr.Custom<A>;
|
|
354
|
+
Direct: RelationExpr.Direct<A>;
|
|
355
|
+
Incoming: RelationExpr.Incoming<A>;
|
|
356
|
+
Outgoing: RelationExpr.Outgoing<A>;
|
|
357
|
+
InOut: RelationExpr.InOut<A>;
|
|
358
|
+
Where: Expression.Where<A>;
|
|
359
|
+
CustomRelation: RelationExpr.Custom<A>;
|
|
360
|
+
}>;
|
|
361
|
+
declare namespace Expression {
|
|
362
|
+
type Where<A extends Any = Any> = FqnExpr.Where<A> | RelationExpr.Where<A>;
|
|
363
|
+
function isWhere<A extends Any>(expr: Expression<A>): expr is Expression.Where<A>;
|
|
364
|
+
function isRelationWhere<A extends Any>(expr: Expression<A>): expr is RelationExpr.Where<A>;
|
|
365
|
+
function isFqnExprWhere<A extends Any>(expr: Expression<A>): expr is FqnExpr.Where<A>;
|
|
366
|
+
function isFqnExpr<A extends Any>(expr: Expression<A>): expr is FqnExpr.Any<A>;
|
|
367
|
+
function isRelation<A extends Any>(expr: Expression<A>): expr is RelationExpr.Any<A>;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
declare namespace ModelFqnExpr {
|
|
371
|
+
type Wildcard = {
|
|
372
|
+
wildcard: true;
|
|
373
|
+
};
|
|
374
|
+
function isWildcard<A extends Any>(expr: ModelExpression<A>): expr is ModelFqnExpr.Wildcard;
|
|
375
|
+
interface Ref<M extends Any> {
|
|
376
|
+
ref: FqnRef.ModelRef<M>;
|
|
377
|
+
selector?: PredicateSelector;
|
|
378
|
+
}
|
|
379
|
+
function isModelRef<A extends Any>(ref: ModelExpression<A>): ref is ModelFqnExpr.Ref<A>;
|
|
380
|
+
interface ElementKindExpr<A extends Any = Any> {
|
|
381
|
+
elementKind: ElementKind<A>;
|
|
382
|
+
isEqual: boolean;
|
|
383
|
+
}
|
|
384
|
+
function isElementKindExpr<A extends Any>(expr: ModelExpression<A>): expr is ElementKindExpr<A>;
|
|
385
|
+
interface ElementTagExpr<A extends Any> {
|
|
386
|
+
elementTag: Tag<A>;
|
|
387
|
+
isEqual: boolean;
|
|
388
|
+
}
|
|
389
|
+
function isElementTagExpr<A extends Any>(expr: ModelExpression<A>): expr is ElementTagExpr<A>;
|
|
390
|
+
type NonWildcard<A extends Any = Any> = ExclusiveUnion<{
|
|
391
|
+
Ref: Ref<A>;
|
|
392
|
+
ElementKind: ElementKindExpr<A>;
|
|
393
|
+
ElementTag: ElementTagExpr<A>;
|
|
394
|
+
}>;
|
|
395
|
+
interface Where<A extends Any = Any> {
|
|
396
|
+
where: {
|
|
397
|
+
expr: ExclusiveUnion<{
|
|
398
|
+
Wildcard: Wildcard;
|
|
399
|
+
Ref: Ref<A>;
|
|
400
|
+
ElementKind: ElementKindExpr<A>;
|
|
401
|
+
ElementTag: ElementTagExpr<A>;
|
|
402
|
+
}>;
|
|
403
|
+
condition: WhereOperator<A>;
|
|
404
|
+
};
|
|
405
|
+
}
|
|
406
|
+
function isWhere<A extends Any>(expr: ModelExpression<A>): expr is ModelFqnExpr.Where<A>;
|
|
407
|
+
interface Custom<A extends Any = Any> {
|
|
408
|
+
custom: {
|
|
409
|
+
expr: OrWhere<A>;
|
|
410
|
+
title?: string;
|
|
411
|
+
description?: string;
|
|
412
|
+
technology?: string;
|
|
413
|
+
notation?: string;
|
|
414
|
+
shape?: ElementShape;
|
|
415
|
+
color?: Color;
|
|
416
|
+
icon?: Icon;
|
|
417
|
+
border?: BorderStyle;
|
|
418
|
+
opacity?: number;
|
|
419
|
+
navigateTo?: StrictViewId<A>;
|
|
420
|
+
multiple?: boolean;
|
|
421
|
+
size?: ShapeSize;
|
|
422
|
+
padding?: ShapeSize;
|
|
423
|
+
textSize?: ShapeSize;
|
|
424
|
+
};
|
|
425
|
+
}
|
|
426
|
+
function isCustom<A extends Any>(expr: ModelExpression<A>): expr is Custom<A>;
|
|
427
|
+
function is<A extends Any>(expr: ModelExpression<A>): expr is ModelFqnExpr<A>;
|
|
428
|
+
type OrWhere<A extends Any = Any> = ExclusiveUnion<{
|
|
429
|
+
Wildcard: ModelFqnExpr.Wildcard;
|
|
430
|
+
Ref: ModelFqnExpr.Ref<A>;
|
|
431
|
+
ElementKind: ElementKindExpr<A>;
|
|
432
|
+
ElementTag: ElementTagExpr<A>;
|
|
433
|
+
Where: ModelFqnExpr.Where<A>;
|
|
434
|
+
}>;
|
|
435
|
+
type Any<A extends Any = Any> = ExclusiveUnion<{
|
|
436
|
+
Wildcard: Wildcard;
|
|
437
|
+
Ref: Ref<A>;
|
|
438
|
+
ElementKind: ElementKindExpr<A>;
|
|
439
|
+
ElementTag: ElementTagExpr<A>;
|
|
440
|
+
Where: Where<A>;
|
|
441
|
+
Custom: Custom<A>;
|
|
442
|
+
}>;
|
|
443
|
+
function unwrap<A extends Any>(expr: ModelFqnExpr.Any<A>): Wildcard | Ref<A> | ElementKindExpr<A> | ElementTagExpr<A>;
|
|
444
|
+
}
|
|
445
|
+
type ModelFqnExpr<A extends Any = Any> = ExclusiveUnion<{
|
|
446
|
+
Wildcard: ModelFqnExpr.Wildcard;
|
|
447
|
+
Ref: ModelFqnExpr.Ref<A>;
|
|
448
|
+
ElementKind: ModelFqnExpr.ElementKindExpr<A>;
|
|
449
|
+
ElementTag: ModelFqnExpr.ElementTagExpr<A>;
|
|
450
|
+
}>;
|
|
451
|
+
declare namespace ModelRelationExpr {
|
|
452
|
+
type Endpoint<A extends Any = Any> = ModelFqnExpr.Where<A>['where']['expr'];
|
|
453
|
+
interface Direct<A extends Any = Any> {
|
|
454
|
+
source: Endpoint<A>;
|
|
455
|
+
target: Endpoint<A>;
|
|
456
|
+
isBidirectional?: boolean;
|
|
457
|
+
}
|
|
458
|
+
function isDirect<A extends Any>(expr: ModelExpression<A>): expr is ModelRelationExpr.Direct<A>;
|
|
459
|
+
interface Incoming<A extends Any = Any> {
|
|
460
|
+
incoming: Endpoint<A>;
|
|
461
|
+
}
|
|
462
|
+
function isIncoming<A extends Any>(expr: ModelExpression<A>): expr is ModelRelationExpr.Incoming<A>;
|
|
463
|
+
interface Outgoing<A extends Any = Any> {
|
|
464
|
+
outgoing: Endpoint<A>;
|
|
465
|
+
}
|
|
466
|
+
function isOutgoing<A extends Any>(expr: ModelExpression<A>): expr is ModelRelationExpr.Outgoing<A>;
|
|
467
|
+
interface InOut<A extends Any = Any> {
|
|
468
|
+
inout: Endpoint<A>;
|
|
469
|
+
}
|
|
470
|
+
function isInOut<A extends Any>(expr: ModelExpression<A>): expr is ModelRelationExpr.InOut<A>;
|
|
471
|
+
interface Where<A extends Any = Any> {
|
|
472
|
+
where: {
|
|
473
|
+
expr: ExclusiveUnion<{
|
|
474
|
+
Direct: ModelRelationExpr.Direct<A>;
|
|
475
|
+
Incoming: ModelRelationExpr.Incoming<A>;
|
|
476
|
+
Outgoing: ModelRelationExpr.Outgoing<A>;
|
|
477
|
+
InOut: ModelRelationExpr.InOut<A>;
|
|
478
|
+
}>;
|
|
479
|
+
condition: WhereOperator<A>;
|
|
480
|
+
};
|
|
481
|
+
}
|
|
482
|
+
function isWhere<A extends Any>(expr: ModelExpression<A>): expr is ModelRelationExpr.Where<A>;
|
|
483
|
+
interface Custom<A extends Any = Any> {
|
|
484
|
+
customRelation: {
|
|
485
|
+
expr: OrWhere<A>;
|
|
486
|
+
title?: string;
|
|
487
|
+
description?: string;
|
|
488
|
+
technology?: string;
|
|
489
|
+
notation?: string;
|
|
490
|
+
navigateTo?: StrictViewId<A>;
|
|
491
|
+
notes?: string;
|
|
492
|
+
color?: Color;
|
|
493
|
+
line?: RelationshipLineType;
|
|
494
|
+
head?: RelationshipArrowType;
|
|
495
|
+
tail?: RelationshipArrowType;
|
|
496
|
+
};
|
|
497
|
+
}
|
|
498
|
+
function isCustom<A extends Any>(expr: ModelExpression<A>): expr is Custom<A>;
|
|
499
|
+
function is<A extends Any>(expr: ModelExpression<A>): expr is ModelRelationExpr<A>;
|
|
500
|
+
type OrWhere<A extends Any = Any> = ExclusiveUnion<{
|
|
501
|
+
Direct: Direct<A>;
|
|
502
|
+
Incoming: Incoming<A>;
|
|
503
|
+
Outgoing: Outgoing<A>;
|
|
504
|
+
InOut: InOut<A>;
|
|
505
|
+
Where: Where<A>;
|
|
506
|
+
}>;
|
|
507
|
+
type Any<A extends Any = Any> = ExclusiveUnion<{
|
|
508
|
+
Direct: Direct<A>;
|
|
509
|
+
Incoming: Incoming<A>;
|
|
510
|
+
Outgoing: Outgoing<A>;
|
|
511
|
+
InOut: InOut<A>;
|
|
512
|
+
Where: Where<A>;
|
|
513
|
+
Custom: Custom<A>;
|
|
514
|
+
}>;
|
|
515
|
+
function unwrap<A extends Any>(expr: ModelRelationExpr.Any<A>): Direct<A> | Incoming<A> | Outgoing<A> | InOut<A>;
|
|
516
|
+
}
|
|
517
|
+
type ModelRelationExpr<A extends Any = Any> = ExclusiveUnion<{
|
|
518
|
+
Direct: ModelRelationExpr.Direct<A>;
|
|
519
|
+
Incoming: ModelRelationExpr.Incoming<A>;
|
|
520
|
+
Outgoing: ModelRelationExpr.Outgoing<A>;
|
|
521
|
+
InOut: ModelRelationExpr.InOut<A>;
|
|
522
|
+
}>;
|
|
523
|
+
/**
|
|
524
|
+
* Represents a version 2 expression which can be one of several types.
|
|
525
|
+
*
|
|
526
|
+
* @template D - The type for the deployment FQN, defaults to `Fqn`.
|
|
527
|
+
* @template M - The type for the model FQN, defaults to `Fqn`.
|
|
528
|
+
*/
|
|
529
|
+
type ModelExpression<A extends Any = Any> = ExclusiveUnion<{
|
|
530
|
+
Wildcard: ModelFqnExpr.Wildcard;
|
|
531
|
+
Ref: ModelFqnExpr.Ref<A>;
|
|
532
|
+
ElementKind: ModelFqnExpr.ElementKindExpr<A>;
|
|
533
|
+
ElementTag: ModelFqnExpr.ElementTagExpr<A>;
|
|
534
|
+
Custom: ModelFqnExpr.Custom<A>;
|
|
535
|
+
Direct: ModelRelationExpr.Direct<A>;
|
|
536
|
+
Incoming: ModelRelationExpr.Incoming<A>;
|
|
537
|
+
Outgoing: ModelRelationExpr.Outgoing<A>;
|
|
538
|
+
InOut: ModelRelationExpr.InOut<A>;
|
|
539
|
+
Where: ModelExpression.Where<A>;
|
|
540
|
+
CustomRelation: ModelRelationExpr.Custom<A>;
|
|
541
|
+
}>;
|
|
542
|
+
declare namespace ModelExpression {
|
|
543
|
+
type Where<A extends Any = Any> = ModelFqnExpr.Where<A> | ModelRelationExpr.Where<A>;
|
|
544
|
+
function isWhere<A extends Any>(expr: ModelExpression<A>): expr is ModelExpression.Where<A>;
|
|
545
|
+
function isRelationWhere<A extends Any>(expr: ModelExpression<A>): expr is ModelRelationExpr.Where<A>;
|
|
546
|
+
function isFqnExprWhere<A extends Any>(expr: ModelExpression<A>): expr is ModelFqnExpr.Where<A>;
|
|
547
|
+
function isFqnExpr<A extends Any>(expr: ModelExpression<A>): expr is ModelFqnExpr.Any<A>;
|
|
548
|
+
function isRelationExpr<A extends Any>(expr: ModelExpression<A>): expr is ModelRelationExpr.Any<A>;
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
type Point = readonly [x: number, y: number];
|
|
552
|
+
interface XYPoint {
|
|
553
|
+
x: number;
|
|
554
|
+
y: number;
|
|
555
|
+
}
|
|
556
|
+
interface BBox {
|
|
557
|
+
x: number;
|
|
558
|
+
y: number;
|
|
559
|
+
width: number;
|
|
560
|
+
height: number;
|
|
561
|
+
}
|
|
562
|
+
declare namespace BBox {
|
|
563
|
+
function center({ x, y, width, height }: BBox): XYPoint;
|
|
564
|
+
function fromPoints(points: Point[]): BBox;
|
|
565
|
+
function merge(...boxes: BBox[]): BBox;
|
|
566
|
+
function toRectBox(box: BBox): RectBox;
|
|
567
|
+
}
|
|
568
|
+
interface RectBox {
|
|
569
|
+
x1: number;
|
|
570
|
+
y1: number;
|
|
571
|
+
x2: number;
|
|
572
|
+
y2: number;
|
|
573
|
+
}
|
|
574
|
+
declare namespace RectBox {
|
|
575
|
+
function center({ x1, y1, x2, y2 }: RectBox): XYPoint;
|
|
576
|
+
function fromPoints(points: Point[]): RectBox;
|
|
577
|
+
function merge(...boxes: RectBox[]): RectBox;
|
|
578
|
+
function toBBox(box: RectBox): BBox;
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
interface AnyIncludePredicate<Expr> {
|
|
582
|
+
include: Expr[];
|
|
583
|
+
exclude?: never;
|
|
584
|
+
}
|
|
585
|
+
interface AnyExcludePredicate<Expr> {
|
|
586
|
+
include?: never;
|
|
587
|
+
exclude: Expr[];
|
|
588
|
+
}
|
|
589
|
+
interface AnyViewRuleStyle<Expr> {
|
|
590
|
+
targets: Expr[];
|
|
591
|
+
notation?: string;
|
|
592
|
+
style: {
|
|
593
|
+
border?: BorderStyle;
|
|
594
|
+
opacity?: number;
|
|
595
|
+
multiple?: boolean;
|
|
596
|
+
size?: ShapeSize;
|
|
597
|
+
padding?: SpacingSize;
|
|
598
|
+
textSize?: TextSize;
|
|
599
|
+
color?: Color;
|
|
600
|
+
shape?: ElementShape;
|
|
601
|
+
icon?: Icon;
|
|
602
|
+
};
|
|
603
|
+
}
|
|
604
|
+
interface ViewRuleGlobalStyle {
|
|
605
|
+
styleId: GlobalStyleID;
|
|
606
|
+
}
|
|
607
|
+
declare function isViewRuleGlobalStyle(rule: object): rule is ViewRuleGlobalStyle;
|
|
608
|
+
interface ViewRuleGlobalPredicateRef {
|
|
609
|
+
predicateId: GlobalPredicateId;
|
|
610
|
+
}
|
|
611
|
+
declare function isViewRuleGlobalPredicateRef(rule: object): rule is ViewRuleGlobalPredicateRef;
|
|
612
|
+
type AutoLayoutDirection = 'TB' | 'BT' | 'LR' | 'RL';
|
|
613
|
+
declare function isAutoLayoutDirection(autoLayout: unknown): autoLayout is AutoLayoutDirection;
|
|
614
|
+
interface ViewRuleAutoLayout {
|
|
615
|
+
direction: AutoLayoutDirection;
|
|
616
|
+
nodeSep?: number;
|
|
617
|
+
rankSep?: number;
|
|
618
|
+
}
|
|
619
|
+
declare function isViewRuleAutoLayout(rule: object): rule is ViewRuleAutoLayout;
|
|
620
|
+
interface ViewAutoLayout {
|
|
621
|
+
direction: ViewRuleAutoLayout['direction'];
|
|
622
|
+
rankSep?: number;
|
|
623
|
+
nodeSep?: number;
|
|
624
|
+
}
|
|
625
|
+
type ViewManualLayout = {
|
|
626
|
+
readonly hash: string;
|
|
627
|
+
readonly x: number;
|
|
628
|
+
readonly y: number;
|
|
629
|
+
readonly width: number;
|
|
630
|
+
readonly height: number;
|
|
631
|
+
readonly autoLayout: ViewAutoLayout;
|
|
632
|
+
readonly nodes: Record<string, {
|
|
633
|
+
isCompound: boolean;
|
|
634
|
+
x: number;
|
|
635
|
+
y: number;
|
|
636
|
+
width: number;
|
|
637
|
+
height: number;
|
|
638
|
+
}>;
|
|
639
|
+
readonly edges: Record<string, {
|
|
640
|
+
dotpos?: string;
|
|
641
|
+
points: NonEmptyArray<Point>;
|
|
642
|
+
controlPoints?: NonEmptyArray<XYPoint>;
|
|
643
|
+
labelBBox?: BBox;
|
|
644
|
+
}>;
|
|
645
|
+
};
|
|
646
|
+
type ViewType = 'element' | 'dynamic' | 'deployment';
|
|
647
|
+
interface BaseViewProperties<A extends Any> extends WithOptionalTags<A>, WithOptionalLinks {
|
|
648
|
+
readonly id: StrictViewId<A>;
|
|
649
|
+
readonly title: string | null;
|
|
650
|
+
readonly description: string | null;
|
|
651
|
+
/**
|
|
652
|
+
* For all views we find common ancestor path.
|
|
653
|
+
* This is used to generate relative paths, i.e.:
|
|
654
|
+
* - "/home/project/index.c4" becomes "index.c4"
|
|
655
|
+
* - "/home/project/subdir/views.c4" becomes "subdir/views.c4"
|
|
656
|
+
*
|
|
657
|
+
* Undefined if the view is auto-generated.
|
|
658
|
+
*/
|
|
659
|
+
readonly relativePath?: string | undefined;
|
|
660
|
+
}
|
|
661
|
+
interface BaseParsedViewProperties<A extends Any> extends BaseViewProperties<A> {
|
|
662
|
+
/**
|
|
663
|
+
* Internal field to identify the stage of the view.
|
|
664
|
+
* This is used to create the correct type of the view.
|
|
665
|
+
*/
|
|
666
|
+
readonly [_stage]: 'parsed';
|
|
667
|
+
/**
|
|
668
|
+
* URI to the source file of this view.
|
|
669
|
+
* Undefined if the view is auto-generated.
|
|
670
|
+
*/
|
|
671
|
+
readonly docUri?: string | undefined;
|
|
672
|
+
/**
|
|
673
|
+
* If the view is changed manually this field contains the layout data.
|
|
674
|
+
*/
|
|
675
|
+
readonly manualLayout?: ViewManualLayout | undefined;
|
|
676
|
+
}
|
|
677
|
+
type NodeNotation = {
|
|
678
|
+
kinds: string[];
|
|
679
|
+
shape: ElementShape;
|
|
680
|
+
color: Color;
|
|
681
|
+
title: string;
|
|
682
|
+
};
|
|
683
|
+
interface ViewWithNotation {
|
|
684
|
+
notation?: {
|
|
685
|
+
nodes: NodeNotation[];
|
|
686
|
+
};
|
|
687
|
+
}
|
|
688
|
+
interface ViewWithHash {
|
|
689
|
+
/**
|
|
690
|
+
* Hash of the view object.
|
|
691
|
+
* This is used to detect changes in layout
|
|
692
|
+
*/
|
|
693
|
+
hash: string;
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
/**
|
|
697
|
+
* Predicates scoped to logical model
|
|
698
|
+
*/
|
|
699
|
+
interface ElementViewIncludePredicate<A extends Any = Any> extends AnyIncludePredicate<ModelExpression<A>> {
|
|
700
|
+
}
|
|
701
|
+
interface ElementViewExcludePredicate<A extends Any = Any> extends AnyExcludePredicate<ModelExpression<A>> {
|
|
702
|
+
}
|
|
703
|
+
type ElementViewPredicate<A extends Any = Any> = ElementViewIncludePredicate<A> | ElementViewExcludePredicate<A>;
|
|
704
|
+
interface ElementViewRuleGroup<A extends Any = Any> {
|
|
705
|
+
groupRules: Array<ElementViewPredicate<A> | ElementViewRuleGroup<A>>;
|
|
706
|
+
title: string | null;
|
|
707
|
+
color?: Color;
|
|
708
|
+
border?: BorderStyle;
|
|
709
|
+
opacity?: number;
|
|
710
|
+
multiple?: boolean;
|
|
711
|
+
size?: ShapeSize;
|
|
712
|
+
padding?: SpacingSize;
|
|
713
|
+
textSize?: TextSize;
|
|
714
|
+
}
|
|
715
|
+
declare function isViewRuleGroup<A extends Any>(rule: ElementViewRule<A>): rule is ElementViewRuleGroup<A>;
|
|
716
|
+
interface ElementViewRuleStyle<A extends Any = Any> extends AnyViewRuleStyle<ModelFqnExpr<A>> {
|
|
717
|
+
}
|
|
718
|
+
type ElementViewRule<A extends Any = Any> = ExclusiveUnion<{
|
|
719
|
+
IncludePredicate: ElementViewIncludePredicate<A>;
|
|
720
|
+
ExcludePredicate: ElementViewExcludePredicate<A>;
|
|
721
|
+
Group: ElementViewRuleGroup<A>;
|
|
722
|
+
Style: ElementViewRuleStyle<A>;
|
|
723
|
+
GlobalStyle: ViewRuleGlobalStyle;
|
|
724
|
+
GlobalPredicateRef: ViewRuleGlobalPredicateRef;
|
|
725
|
+
AutoLayout: ViewRuleAutoLayout;
|
|
726
|
+
}>;
|
|
727
|
+
interface ParsedElementView<A extends Any = Any> extends BaseParsedViewProperties<A> {
|
|
728
|
+
[_type]: 'element';
|
|
729
|
+
readonly rules: ElementViewRule<A>[];
|
|
730
|
+
readonly viewOf?: Fqn<A>;
|
|
731
|
+
readonly extends?: StrictViewId<A>;
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
interface DynamicViewStep<A extends Any = Any> {
|
|
735
|
+
readonly source: Fqn<A>;
|
|
736
|
+
readonly target: Fqn<A>;
|
|
737
|
+
readonly title: string | null;
|
|
738
|
+
readonly description?: string;
|
|
739
|
+
readonly technology?: string;
|
|
740
|
+
readonly notation?: string;
|
|
741
|
+
readonly notes?: string;
|
|
742
|
+
readonly color?: Color;
|
|
743
|
+
readonly line?: RelationshipLineType;
|
|
744
|
+
readonly head?: RelationshipArrowType;
|
|
745
|
+
readonly tail?: RelationshipArrowType;
|
|
746
|
+
readonly isBackward?: boolean;
|
|
747
|
+
readonly navigateTo?: StrictViewId<A>;
|
|
748
|
+
}
|
|
749
|
+
interface DynamicViewParallelSteps<A extends Any = Any> {
|
|
750
|
+
readonly __parallel: DynamicViewStep<A>[];
|
|
751
|
+
}
|
|
752
|
+
declare function getParallelStepsPrefix(id: string): string | null;
|
|
753
|
+
type DynamicViewStepOrParallel<A extends Any = Any> = Simplify<MergeExclusive<DynamicViewStep<A>, DynamicViewParallelSteps<A>>>;
|
|
754
|
+
interface DynamicViewIncludeRule<A extends Any = Any> {
|
|
755
|
+
include: ModelFqnExpr.Any<A>[];
|
|
756
|
+
}
|
|
757
|
+
type DynamicViewRule<A extends Any = Any> = ExclusiveUnion<{
|
|
758
|
+
Include: DynamicViewIncludeRule<A>;
|
|
759
|
+
GlobalPredicateRef: ViewRuleGlobalPredicateRef;
|
|
760
|
+
ElementViewRuleStyle: ElementViewRuleStyle<A>;
|
|
761
|
+
GlobalStyle: ViewRuleGlobalStyle;
|
|
762
|
+
AutoLayout: ViewRuleAutoLayout;
|
|
763
|
+
}>;
|
|
764
|
+
interface ParsedDynamicView<A extends Any = Any> extends BaseParsedViewProperties<A> {
|
|
765
|
+
[_type]: 'dynamic';
|
|
766
|
+
readonly steps: DynamicViewStepOrParallel<A>[];
|
|
767
|
+
readonly rules: DynamicViewRule<A>[];
|
|
768
|
+
}
|
|
769
|
+
declare function isDynamicViewParallelSteps<A extends Any>(step: DynamicViewStepOrParallel<A>): step is DynamicViewParallelSteps<A>;
|
|
770
|
+
|
|
771
|
+
type GlobalPredicateId = Tagged<string, 'GlobalPredicateId'>;
|
|
772
|
+
type GlobalPredicates<A extends Any = Any> = NonEmptyArray<ElementViewPredicate<A>>;
|
|
773
|
+
type GlobalDynamicPredicates<A extends Any = Any> = NonEmptyArray<DynamicViewIncludeRule<A>>;
|
|
774
|
+
type GlobalStyleID = Tagged<string, 'GlobalStyleID'>;
|
|
775
|
+
type GlobalStyles<A extends Any = Any> = NonEmptyTuple<ElementViewRuleStyle<A>>;
|
|
776
|
+
interface ModelGlobals<A extends Any = Any> {
|
|
777
|
+
readonly predicates: Record<GlobalPredicateId, GlobalPredicates<A>>;
|
|
778
|
+
readonly dynamicPredicates: Record<GlobalPredicateId, GlobalDynamicPredicates<A>>;
|
|
779
|
+
readonly styles: Record<GlobalStyleID, GlobalStyles<A>>;
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
declare const DefaultThemeColor: ThemeColor;
|
|
783
|
+
declare const DefaultElementShape: ElementShape;
|
|
784
|
+
declare const DefaultShapeSize: ShapeSize;
|
|
785
|
+
declare const DefaultPaddingSize: SpacingSize;
|
|
786
|
+
declare const DefaultTextSize: TextSize;
|
|
787
|
+
interface ElementStyle {
|
|
788
|
+
readonly border?: BorderStyle;
|
|
789
|
+
/**
|
|
790
|
+
* In percentage 0-100, 0 is fully transparent
|
|
791
|
+
*
|
|
792
|
+
* @default 100
|
|
793
|
+
*/
|
|
794
|
+
readonly opacity?: number;
|
|
795
|
+
/**
|
|
796
|
+
* If true, the element is rendered as multiple shapes
|
|
797
|
+
* @default false
|
|
798
|
+
*/
|
|
799
|
+
readonly multiple?: boolean;
|
|
800
|
+
/**
|
|
801
|
+
* Shape size
|
|
802
|
+
*
|
|
803
|
+
* @default 'md'
|
|
804
|
+
*/
|
|
805
|
+
readonly size?: ShapeSize;
|
|
806
|
+
readonly padding?: SpacingSize;
|
|
807
|
+
readonly textSize?: TextSize;
|
|
808
|
+
}
|
|
809
|
+
interface Element<A extends Any = Any> extends WithOptionalTags<A>, WithOptionalLinks, WithMetadata<A> {
|
|
810
|
+
readonly id: Fqn<A>;
|
|
811
|
+
readonly kind: ElementKind<A>;
|
|
812
|
+
readonly title: string;
|
|
813
|
+
readonly description?: string | null;
|
|
814
|
+
readonly technology?: string | null;
|
|
815
|
+
readonly tags?: Tags<A> | null;
|
|
816
|
+
readonly links?: readonly Link[] | null;
|
|
817
|
+
readonly icon?: Icon;
|
|
818
|
+
readonly shape?: ElementShape;
|
|
819
|
+
readonly color?: Color;
|
|
820
|
+
readonly style?: ElementStyle;
|
|
821
|
+
readonly notation?: string;
|
|
822
|
+
readonly metadata?: Metadata<A>;
|
|
823
|
+
}
|
|
824
|
+
declare const DefaultLineStyle: RelationshipLineType;
|
|
825
|
+
declare const DefaultArrowType: RelationshipArrowType;
|
|
826
|
+
declare const DefaultRelationshipColor: ThemeColor;
|
|
827
|
+
interface AbstractRelationship<A extends Any> extends WithOptionalTags<A>, WithOptionalLinks, WithMetadata<A> {
|
|
828
|
+
readonly id: RelationId;
|
|
829
|
+
readonly title?: string | null;
|
|
830
|
+
readonly description?: string | null;
|
|
831
|
+
readonly technology?: string | null;
|
|
832
|
+
readonly kind?: RelationKind<A>;
|
|
833
|
+
readonly color?: Color;
|
|
834
|
+
readonly line?: RelationshipLineType;
|
|
835
|
+
readonly head?: RelationshipArrowType;
|
|
836
|
+
readonly tail?: RelationshipArrowType;
|
|
837
|
+
readonly tags?: Tags<A> | null;
|
|
838
|
+
readonly links?: readonly Link[] | null;
|
|
839
|
+
readonly navigateTo?: ViewId<A>;
|
|
840
|
+
readonly metadata?: Metadata<A>;
|
|
841
|
+
}
|
|
842
|
+
/**
|
|
843
|
+
* Relationship between two model elements
|
|
844
|
+
*/
|
|
845
|
+
interface Relationship<A extends Any = Any> extends AbstractRelationship<A> {
|
|
846
|
+
readonly source: FqnRef.ModelRef<A>;
|
|
847
|
+
readonly target: FqnRef.ModelRef<A>;
|
|
848
|
+
}
|
|
849
|
+
/**
|
|
850
|
+
* Backward compatibility alias
|
|
851
|
+
* @deprecated Use {@link Relationship} instead
|
|
852
|
+
*/
|
|
853
|
+
type ModelRelation<A extends Any = Any> = Relationship<A>;
|
|
854
|
+
|
|
855
|
+
interface DeploymentElementStyle extends ElementStyle {
|
|
856
|
+
readonly icon?: Icon;
|
|
857
|
+
readonly shape?: ElementShape;
|
|
858
|
+
readonly color?: Color;
|
|
859
|
+
}
|
|
860
|
+
interface DeploymentNode<A extends Any = Unknown> extends WithOptionalTags<A>, WithOptionalLinks, WithMetadata<A> {
|
|
861
|
+
element?: never;
|
|
862
|
+
readonly id: DeploymentFqn<A>;
|
|
863
|
+
readonly kind: DeploymentKind<A>;
|
|
864
|
+
readonly title: string;
|
|
865
|
+
readonly description?: string | null;
|
|
866
|
+
readonly technology?: string | null;
|
|
867
|
+
readonly tags?: Tags<A> | null;
|
|
868
|
+
readonly links?: readonly Link[] | null;
|
|
869
|
+
readonly style: DeploymentElementStyle;
|
|
870
|
+
readonly notation?: string;
|
|
871
|
+
readonly metadata?: Metadata<A>;
|
|
872
|
+
}
|
|
873
|
+
interface DeployedInstance<A extends Any = Unknown> extends WithOptionalTags<A>, WithOptionalLinks, WithMetadata<A> {
|
|
874
|
+
kind?: never;
|
|
875
|
+
/**
|
|
876
|
+
* Format: `<DeploymentNode Fqn>.<Instance Id>`
|
|
877
|
+
* i.e parent fqn is deployment target
|
|
878
|
+
*/
|
|
879
|
+
readonly id: DeploymentFqn<A>;
|
|
880
|
+
readonly element: Fqn<A>;
|
|
881
|
+
readonly title?: string;
|
|
882
|
+
readonly description?: string | null;
|
|
883
|
+
readonly technology?: string | null;
|
|
884
|
+
readonly tags?: Tags<A> | null;
|
|
885
|
+
readonly links?: readonly Link[] | null;
|
|
886
|
+
readonly style?: DeploymentElementStyle;
|
|
887
|
+
readonly notation?: string;
|
|
888
|
+
readonly metadata?: Metadata<A>;
|
|
889
|
+
}
|
|
890
|
+
type DeploymentElement<A extends Any = Unknown> = DeploymentNode<A> | DeployedInstance<A>;
|
|
891
|
+
type DeploymentElementRef<A extends Any = Unknown> = {
|
|
892
|
+
readonly id: DeploymentFqn<A>;
|
|
893
|
+
readonly element?: Fqn<A>;
|
|
894
|
+
};
|
|
895
|
+
declare function isDeploymentNode<A extends Any>(el: DeploymentElement<A>): el is DeploymentNode<A>;
|
|
896
|
+
declare function isDeployedInstance<A extends Any>(el: DeploymentElement<A>): el is DeployedInstance<A>;
|
|
897
|
+
/**
|
|
898
|
+
* Relationship in deployment model
|
|
899
|
+
*/
|
|
900
|
+
interface DeploymentRelationship<A extends Any = Unknown> extends AbstractRelationship<A> {
|
|
901
|
+
readonly source: FqnRef.DeploymentRef<A>;
|
|
902
|
+
readonly target: FqnRef.DeploymentRef<A>;
|
|
903
|
+
}
|
|
904
|
+
/**
|
|
905
|
+
* Backward compatibility alias
|
|
906
|
+
* @deprecated Use {@link DeploymentRelationship} instead
|
|
907
|
+
*/
|
|
908
|
+
type DeploymentRelation<A extends Any = Unknown> = DeploymentRelationship<A>;
|
|
909
|
+
|
|
910
|
+
/**
|
|
911
|
+
* Element and deployment kind specification
|
|
912
|
+
*/
|
|
913
|
+
interface ElementSpecification {
|
|
914
|
+
tags?: Tag$1[];
|
|
915
|
+
technology?: string;
|
|
916
|
+
notation?: string;
|
|
917
|
+
style: {
|
|
918
|
+
shape?: ElementShape;
|
|
919
|
+
icon?: Icon;
|
|
920
|
+
color?: Color;
|
|
921
|
+
border?: BorderStyle;
|
|
922
|
+
opacity?: number;
|
|
923
|
+
size?: ShapeSize;
|
|
924
|
+
padding?: SpacingSize;
|
|
925
|
+
textSize?: TextSize;
|
|
926
|
+
multiple?: boolean;
|
|
927
|
+
};
|
|
928
|
+
}
|
|
929
|
+
interface TagSpecification {
|
|
930
|
+
color: ThemeColor | ColorLiteral;
|
|
931
|
+
}
|
|
932
|
+
/**
|
|
933
|
+
* Checks if tag color is defined in the specification
|
|
934
|
+
* Expects HEX, `rgb(...)` or `rgba(...)` color
|
|
935
|
+
*/
|
|
936
|
+
declare function isTagColorSpecified(spec: string | TagSpecification): spec is {
|
|
937
|
+
color: ColorLiteral;
|
|
938
|
+
};
|
|
939
|
+
interface RelationshipSpecification {
|
|
940
|
+
technology?: string;
|
|
941
|
+
notation?: string;
|
|
942
|
+
color?: Color;
|
|
943
|
+
line?: RelationshipLineType;
|
|
944
|
+
head?: RelationshipArrowType;
|
|
945
|
+
tail?: RelationshipArrowType;
|
|
946
|
+
}
|
|
947
|
+
type Specification<A> = A extends Any ? {
|
|
948
|
+
tags: {
|
|
949
|
+
[key in Tag<A>]: TagSpecification;
|
|
950
|
+
};
|
|
951
|
+
elements: {
|
|
952
|
+
[key in ElementKind<A>]: Partial<ElementSpecification>;
|
|
953
|
+
};
|
|
954
|
+
deployments: {
|
|
955
|
+
[key in DeploymentKind<A>]: Partial<ElementSpecification>;
|
|
956
|
+
};
|
|
957
|
+
relationships: {
|
|
958
|
+
[key in RelationKind<A>]: Partial<RelationshipSpecification>;
|
|
959
|
+
};
|
|
960
|
+
metadataKeys?: IsNever<MetadataKey<A>> extends true ? never : MetadataKey<A>[];
|
|
961
|
+
customColors?: CustomColorDefinitions;
|
|
962
|
+
} : never;
|
|
963
|
+
|
|
964
|
+
interface ComputedNode<A extends Any = Any> extends WithOptionalLinks {
|
|
965
|
+
id: NodeId;
|
|
966
|
+
kind: ElementKind<A> | DeploymentKind<A> | '@group';
|
|
967
|
+
parent: NodeId | null;
|
|
968
|
+
/**
|
|
969
|
+
* Reference to model element
|
|
970
|
+
* If 1 - node id is a reference
|
|
971
|
+
*/
|
|
972
|
+
modelRef?: Fqn<A> | undefined;
|
|
973
|
+
/**
|
|
974
|
+
* Reference to deployment element
|
|
975
|
+
* If 1 - node id is a reference
|
|
976
|
+
*/
|
|
977
|
+
deploymentRef?: DeploymentFqn<A> | undefined;
|
|
978
|
+
title: string;
|
|
979
|
+
description?: string | null;
|
|
980
|
+
technology?: string | null;
|
|
981
|
+
notation?: string;
|
|
982
|
+
children: NodeId[];
|
|
983
|
+
inEdges: EdgeId[];
|
|
984
|
+
outEdges: EdgeId[];
|
|
985
|
+
tags: Tags<A>;
|
|
986
|
+
shape: ElementShape;
|
|
987
|
+
color: Color;
|
|
988
|
+
icon?: Icon;
|
|
989
|
+
style: ElementStyle;
|
|
990
|
+
navigateTo?: StrictViewId<A> | null;
|
|
991
|
+
level: number;
|
|
992
|
+
depth?: number;
|
|
993
|
+
/**
|
|
994
|
+
* If this node was customized in the view
|
|
995
|
+
*/
|
|
996
|
+
isCustomized?: boolean;
|
|
997
|
+
}
|
|
998
|
+
interface ComputedEdge<A extends Any = Any> extends WithOptionalTags<A> {
|
|
999
|
+
id: EdgeId;
|
|
1000
|
+
parent: NodeId | null;
|
|
1001
|
+
source: NodeId;
|
|
1002
|
+
target: NodeId;
|
|
1003
|
+
label: string | null;
|
|
1004
|
+
description?: string;
|
|
1005
|
+
technology?: string;
|
|
1006
|
+
relations: RelationId[];
|
|
1007
|
+
kind?: RelationKind<A> | typeof StepEdgeKind;
|
|
1008
|
+
notation?: string;
|
|
1009
|
+
notes?: string;
|
|
1010
|
+
color?: Color;
|
|
1011
|
+
line?: RelationshipLineType;
|
|
1012
|
+
head?: RelationshipArrowType;
|
|
1013
|
+
tail?: RelationshipArrowType;
|
|
1014
|
+
navigateTo?: StrictViewId<A> | null;
|
|
1015
|
+
/**
|
|
1016
|
+
* If this edge is derived from custom relationship predicate
|
|
1017
|
+
*/
|
|
1018
|
+
isCustomized?: boolean;
|
|
1019
|
+
/**
|
|
1020
|
+
* For layouting purposes
|
|
1021
|
+
* @default 'forward'
|
|
1022
|
+
*/
|
|
1023
|
+
dir?: 'forward' | 'back' | 'both';
|
|
1024
|
+
}
|
|
1025
|
+
interface BaseComputedViewProperties<A extends Any> extends BaseViewProperties<A>, ViewWithHash, ViewWithNotation {
|
|
1026
|
+
readonly [_stage]: 'computed';
|
|
1027
|
+
readonly autoLayout: ViewAutoLayout;
|
|
1028
|
+
readonly nodes: ComputedNode<A>[];
|
|
1029
|
+
readonly edges: ComputedEdge<A>[];
|
|
1030
|
+
/**
|
|
1031
|
+
* If the view is changed manually this field contains the layout data.
|
|
1032
|
+
*/
|
|
1033
|
+
readonly manualLayout?: ViewManualLayout | undefined;
|
|
1034
|
+
}
|
|
1035
|
+
interface ComputedElementView<A extends Any = Any> extends BaseComputedViewProperties<A> {
|
|
1036
|
+
readonly [_type]: 'element';
|
|
1037
|
+
readonly viewOf?: Fqn<A>;
|
|
1038
|
+
readonly extends?: StrictViewId<A>;
|
|
1039
|
+
}
|
|
1040
|
+
interface ComputedDeploymentView<A extends Any = Any> extends BaseComputedViewProperties<A> {
|
|
1041
|
+
readonly [_type]: 'deployment';
|
|
1042
|
+
}
|
|
1043
|
+
interface ComputedDynamicView<A extends Any = Any> extends BaseComputedViewProperties<A> {
|
|
1044
|
+
readonly [_type]: 'dynamic';
|
|
1045
|
+
}
|
|
1046
|
+
|
|
1047
|
+
interface DiagramNode<A extends Any = Any> extends ComputedNode<A>, BBox {
|
|
1048
|
+
x: number;
|
|
1049
|
+
y: number;
|
|
1050
|
+
width: number;
|
|
1051
|
+
height: number;
|
|
1052
|
+
/**
|
|
1053
|
+
* Absolute position, top left
|
|
1054
|
+
* @deprecated Use `x` and `y` instead
|
|
1055
|
+
*/
|
|
1056
|
+
position: Point;
|
|
1057
|
+
/**
|
|
1058
|
+
* Bounding box of label
|
|
1059
|
+
* (Absolute coordinates)
|
|
1060
|
+
*/
|
|
1061
|
+
labelBBox: BBox;
|
|
1062
|
+
}
|
|
1063
|
+
interface DiagramEdge<A extends Any = Any> extends ComputedEdge<A> {
|
|
1064
|
+
/**
|
|
1065
|
+
* Bezier points
|
|
1066
|
+
* (Absolute coordinates)
|
|
1067
|
+
*/
|
|
1068
|
+
points: NonEmptyArray<Point>;
|
|
1069
|
+
/**
|
|
1070
|
+
* Control points to adjust the edge
|
|
1071
|
+
* (Absolute coordinates)
|
|
1072
|
+
*/
|
|
1073
|
+
controlPoints?: NonEmptyArray<XYPoint>;
|
|
1074
|
+
/**
|
|
1075
|
+
* Bounding box of label
|
|
1076
|
+
* (Absolute coordinates)
|
|
1077
|
+
*/
|
|
1078
|
+
labelBBox?: BBox | null;
|
|
1079
|
+
/**
|
|
1080
|
+
* Graphviz edge POS
|
|
1081
|
+
*
|
|
1082
|
+
* TODO: temporary solution, should be moved out
|
|
1083
|
+
* @deprecated
|
|
1084
|
+
*/
|
|
1085
|
+
dotpos?: string;
|
|
1086
|
+
}
|
|
1087
|
+
interface BaseLayoutedViewProperties<A extends Any> extends BaseViewProperties<A>, ViewWithHash, ViewWithNotation {
|
|
1088
|
+
readonly [_stage]: 'layouted';
|
|
1089
|
+
readonly autoLayout: ViewAutoLayout;
|
|
1090
|
+
readonly nodes: DiagramNode<A>[];
|
|
1091
|
+
readonly edges: DiagramEdge<A>[];
|
|
1092
|
+
readonly bounds: BBox;
|
|
1093
|
+
/**
|
|
1094
|
+
* If diagram has manual layout
|
|
1095
|
+
* But was changed and layout should be recalculated
|
|
1096
|
+
*/
|
|
1097
|
+
hasLayoutDrift?: boolean;
|
|
1098
|
+
}
|
|
1099
|
+
interface LayoutedElementView<A extends Any = Any> extends BaseLayoutedViewProperties<A> {
|
|
1100
|
+
readonly [_type]: 'element';
|
|
1101
|
+
readonly viewOf?: Fqn<A>;
|
|
1102
|
+
readonly extends?: StrictViewId<A>;
|
|
1103
|
+
}
|
|
1104
|
+
interface LayoutedDeploymentView<A extends Any = Any> extends BaseLayoutedViewProperties<A> {
|
|
1105
|
+
readonly [_type]: 'deployment';
|
|
1106
|
+
}
|
|
1107
|
+
interface LayoutedDynamicView<A extends Any = Any> extends BaseLayoutedViewProperties<A> {
|
|
1108
|
+
readonly [_type]: 'dynamic';
|
|
1109
|
+
}
|
|
1110
|
+
|
|
1111
|
+
/**
|
|
1112
|
+
* Predicates scoped to deployment model
|
|
1113
|
+
*/
|
|
1114
|
+
interface DeploymentViewIncludePredicate<A extends Any = Unknown> extends AnyIncludePredicate<Expression<A>> {
|
|
1115
|
+
}
|
|
1116
|
+
interface DeploymentViewExcludePredicate<A extends Any = Unknown> extends AnyExcludePredicate<Expression<A>> {
|
|
1117
|
+
}
|
|
1118
|
+
type DeploymentViewPredicate<A extends Any = Unknown> = DeploymentViewIncludePredicate<A> | DeploymentViewExcludePredicate<A>;
|
|
1119
|
+
interface DeploymentViewRuleStyle<A extends Any = Unknown> extends AnyViewRuleStyle<FqnExpr<A>> {
|
|
1120
|
+
}
|
|
1121
|
+
type DeploymentViewRule<A extends Any = Unknown> = ExclusiveUnion<{
|
|
1122
|
+
Include: DeploymentViewIncludePredicate<A>;
|
|
1123
|
+
Exclude: DeploymentViewExcludePredicate<A>;
|
|
1124
|
+
Style: DeploymentViewRuleStyle<A>;
|
|
1125
|
+
AutoLayout: ViewRuleAutoLayout;
|
|
1126
|
+
}>;
|
|
1127
|
+
interface ParsedDeploymentView<A extends Any = Unknown> extends BaseParsedViewProperties<A> {
|
|
1128
|
+
[_type]: 'deployment';
|
|
1129
|
+
readonly rules: DeploymentViewRule<A>[];
|
|
1130
|
+
}
|
|
1131
|
+
|
|
1132
|
+
type ParsedView<A extends Any = Any> = ParsedElementView<A> | ParsedDeploymentView<A> | ParsedDynamicView<A>;
|
|
1133
|
+
|
|
1134
|
+
type ComputedView<A extends Any = Any> = ComputedElementView<A> | ComputedDeploymentView<A> | ComputedDynamicView<A>;
|
|
1135
|
+
type LayoutedView<A extends Any = Any> = LayoutedElementView<A> | LayoutedDeploymentView<A> | LayoutedDynamicView<A>;
|
|
1136
|
+
type ProcessedView<A extends Any = Any> = ComputedView<A> | LayoutedView<A>;
|
|
1137
|
+
|
|
1138
|
+
type AnyView<A extends Any = Any> = ParsedElementView<A> | ParsedDeploymentView<A> | ParsedDynamicView<A> | ComputedElementView<A> | ComputedDeploymentView<A> | ComputedDynamicView<A> | LayoutedElementView<A> | LayoutedDeploymentView<A> | LayoutedDynamicView<A>;
|
|
1139
|
+
type ViewOnStage<V extends AnyView<Any>, T extends ModelStage> = Extract<V, {
|
|
1140
|
+
[_stage]: T;
|
|
1141
|
+
}>;
|
|
1142
|
+
type ViewWithType<V extends AnyView<Any>, T extends ViewType> = Extract<V, {
|
|
1143
|
+
[_type]: T;
|
|
1144
|
+
}>;
|
|
1145
|
+
type ViewRule<A extends Any = Any> = ParsedView<A>['rules'][number];
|
|
1146
|
+
type ViewRulePredicate<A extends Any = Any> = Extract<ViewRule<A>, {
|
|
1147
|
+
include: any[];
|
|
1148
|
+
} | {
|
|
1149
|
+
exclude: any[];
|
|
1150
|
+
}>;
|
|
1151
|
+
declare function isViewRulePredicate<V extends ViewRule<any>>(rule: V): rule is Extract<V, {
|
|
1152
|
+
include: any[];
|
|
1153
|
+
} | {
|
|
1154
|
+
exclude: any[];
|
|
1155
|
+
}>;
|
|
1156
|
+
declare function isViewRuleStyle<V extends ViewRule<any>>(rule: V): rule is Extract<V, {
|
|
1157
|
+
targets: any[];
|
|
1158
|
+
style: {};
|
|
1159
|
+
}>;
|
|
1160
|
+
declare function isComputedView<V extends AnyView<any>>(view: V): view is ExtractOnStage<V, 'computed'>;
|
|
1161
|
+
declare function isDiagramView<V extends AnyView<any>>(view: V): view is ExtractOnStage<V, 'layouted'>;
|
|
1162
|
+
|
|
1163
|
+
declare function isElementView<V extends AnyView<any>>(view: V): view is ViewWithType<V, 'element'>;
|
|
1164
|
+
declare function isScopedElementView<V extends AnyView<any>>(view: V): view is ViewWithType<V, 'element'> & {
|
|
1165
|
+
viewOf: Fqn<Any>;
|
|
1166
|
+
};
|
|
1167
|
+
declare function isExtendsElementView<V extends AnyView<any>>(view: V): view is ViewWithType<V, 'element'> & {
|
|
1168
|
+
extends: StrictViewId<Any>;
|
|
1169
|
+
};
|
|
1170
|
+
declare function isDeploymentView<V extends AnyView<any>>(view: V): view is ViewWithType<V, 'deployment'>;
|
|
1171
|
+
declare function isDynamicView<V extends AnyView<any>>(view: V): view is ViewWithType<V, 'dynamic'>;
|
|
1172
|
+
|
|
1173
|
+
interface BaseLikeC4ModelData<A extends Any> {
|
|
1174
|
+
projectId: ProjectId<A>;
|
|
1175
|
+
specification: Specification<A>;
|
|
1176
|
+
elements: Record<ElementId<A>, Element<A>>;
|
|
1177
|
+
deployments: {
|
|
1178
|
+
elements: Record<DeploymentId<A>, DeploymentElement<A>>;
|
|
1179
|
+
relations: Record<RelationId, DeploymentRelationship<A>>;
|
|
1180
|
+
};
|
|
1181
|
+
relations: Record<RelationId, Relationship<A>>;
|
|
1182
|
+
globals: ModelGlobals;
|
|
1183
|
+
imports: Record<string, NonEmptyArray<Element<A>>>;
|
|
1184
|
+
}
|
|
1185
|
+
type AuxFromLikeC4ModelData<D> = D extends BaseLikeC4ModelData<infer A extends Any> ? IsAny<A> extends true ? never : A : never;
|
|
1186
|
+
/**
|
|
1187
|
+
* Represents a LikeC4 model with customizable type parameters,
|
|
1188
|
+
* parsed from DSL or result from Builder
|
|
1189
|
+
*
|
|
1190
|
+
* !IMPORTANT: This is a low-level type, use `LikeC4Model` instead.
|
|
1191
|
+
* !NOTE: Views are not computed yet.
|
|
1192
|
+
*
|
|
1193
|
+
* @typeParam ElementKinds - Types of elements in the model (defaults to string)
|
|
1194
|
+
* @typeParam RelationKinds - Types of relationships (defaults to string)
|
|
1195
|
+
* @typeParam Tags - Types of tags that can be applied (defaults to string)
|
|
1196
|
+
* @typeParam Fqns - Fully Qualified Names for elements (defaults to string)
|
|
1197
|
+
* @typeParam Views - Types of views in the model (defaults to string)
|
|
1198
|
+
* @typeParam DeploymentFqns - Fully Qualified Names for deployment nodes (defaults to string)
|
|
1199
|
+
*/
|
|
1200
|
+
interface ParsedLikeC4ModelData<A extends Any = UnknownParsed> extends BaseLikeC4ModelData<A> {
|
|
1201
|
+
[_stage]: 'parsed';
|
|
1202
|
+
views: Record<ViewId<A>, ParsedView<A>>;
|
|
1203
|
+
}
|
|
1204
|
+
interface ComputedLikeC4ModelData<A extends Any = UnknownComputed> extends BaseLikeC4ModelData<A> {
|
|
1205
|
+
[_stage]: 'computed';
|
|
1206
|
+
views: Record<ViewId<A>, ComputedView<A>>;
|
|
1207
|
+
}
|
|
1208
|
+
interface LayoutedLikeC4ModelData<A extends Any = UnknownLayouted> extends BaseLikeC4ModelData<A> {
|
|
1209
|
+
[_stage]: 'layouted';
|
|
1210
|
+
views: Record<ViewId<A>, LayoutedView<A>>;
|
|
1211
|
+
}
|
|
1212
|
+
type LikeC4ModelData<A extends Any> = ParsedLikeC4ModelData<A> | ComputedLikeC4ModelData<A> | LayoutedLikeC4ModelData<A>;
|
|
1213
|
+
|
|
1214
|
+
/**
|
|
1215
|
+
* JSON representation of {@link Specification}
|
|
1216
|
+
*/
|
|
1217
|
+
interface SpecificationDump {
|
|
1218
|
+
elements: {
|
|
1219
|
+
[kind: string]: object;
|
|
1220
|
+
};
|
|
1221
|
+
tags?: {
|
|
1222
|
+
[tag: string]: object;
|
|
1223
|
+
};
|
|
1224
|
+
deployments?: {
|
|
1225
|
+
[kind: string]: object;
|
|
1226
|
+
};
|
|
1227
|
+
relationships?: {
|
|
1228
|
+
[kind: string]: object;
|
|
1229
|
+
};
|
|
1230
|
+
metadataKeys?: string[];
|
|
1231
|
+
customColors?: {
|
|
1232
|
+
[kind: string]: object;
|
|
1233
|
+
};
|
|
1234
|
+
}
|
|
1235
|
+
type SpecTypesFromDump<J> = J extends SpecificationDump ? SpecAux<KeysOf<J['elements']>, KeysOf<J['deployments']>, KeysOf<J['relationships']>, KeysOf<J['tags']>, J['metadataKeys'] extends readonly [string, ...string[]] ? J['metadataKeys'][number] : never> : SpecAux<never, never, never, never, never>;
|
|
1236
|
+
/**
|
|
1237
|
+
* Dump differs from {@link ParsedLikeC4ModelData} by the fact that it is computed or layouted
|
|
1238
|
+
*/
|
|
1239
|
+
type LikeC4ModelDump = {
|
|
1240
|
+
[_stage]?: 'computed' | 'layouted';
|
|
1241
|
+
projectId?: string;
|
|
1242
|
+
specification: SpecificationDump;
|
|
1243
|
+
elements?: {
|
|
1244
|
+
[kind: string]: object;
|
|
1245
|
+
};
|
|
1246
|
+
deployments: {
|
|
1247
|
+
elements?: {
|
|
1248
|
+
[kind: string]: object;
|
|
1249
|
+
};
|
|
1250
|
+
relations?: {};
|
|
1251
|
+
};
|
|
1252
|
+
views?: {
|
|
1253
|
+
[kind: string]: object;
|
|
1254
|
+
};
|
|
1255
|
+
relations?: {};
|
|
1256
|
+
globals?: {
|
|
1257
|
+
predicates?: {};
|
|
1258
|
+
dynamicPredicates?: {};
|
|
1259
|
+
styles?: {};
|
|
1260
|
+
};
|
|
1261
|
+
imports?: {};
|
|
1262
|
+
};
|
|
1263
|
+
type AuxFromDump<D> = D extends LikeC4ModelDump ? Aux<D[_stage] extends infer S extends string & 'computed' | 'layouted' ? S : 'computed' | 'layouted' | 'parsed', KeysOf<D['elements']>, KeysOf<D['deployments']['elements']>, KeysOf<D['views']>, D['projectId'] extends infer P extends string ? P : never, SpecTypesFromDump<D['specification']>> : Never;
|
|
1264
|
+
|
|
1265
|
+
export { type TagSpecification as $, type AuxFromLikeC4ModelData as A, BBox as B, type ColorLiteral as C, type DeploymentElementStyle as D, Expression as E, FqnExpr as F, type GlobalPredicateId as G, DefaultElementShape as H, DefaultShapeSize as I, DefaultPaddingSize as J, DefaultTextSize as K, type LikeC4Theme as L, ModelFqnExpr as M, type ElementStyle as N, type Element as O, type PredicateSelector as P, DefaultLineStyle as Q, RelationExpr as R, type SpecificationDump as S, type ThemeColorValues as T, DefaultArrowType as U, DefaultRelationshipColor as V, type AbstractRelationship as W, type XYPoint as X, type Relationship as Y, type ModelRelation as Z, type ElementSpecification as _, ModelRelationExpr as a, isViewRuleGlobalStyle as a$, isTagColorSpecified as a0, type RelationshipSpecification as a1, type Specification as a2, type EqualOperator as a3, type TagEqual as a4, isTagEqual as a5, type KindEqual as a6, isKindEqual as a7, type Participant as a8, type ParticipantOperator as a9, isThemeColor as aA, type ElementThemeColorValues as aB, type ElementThemeColors as aC, type RelationshipThemeColorValues as aD, type RelationshipThemeColors as aE, type ParsedView as aF, type LayoutedView as aG, isDiagramView as aH, type ComputedView as aI, type ProcessedView as aJ, type AnyView as aK, type ViewOnStage as aL, type ViewWithType as aM, type ViewRule as aN, type ViewRulePredicate as aO, isViewRulePredicate as aP, isViewRuleStyle as aQ, isComputedView as aR, isElementView as aS, isScopedElementView as aT, isExtendsElementView as aU, isDeploymentView as aV, isDynamicView as aW, type AnyIncludePredicate as aX, type AnyExcludePredicate as aY, type AnyViewRuleStyle as aZ, type ViewRuleGlobalStyle as a_, isParticipantOperator as aa, type NotOperator as ab, isNotOperator as ac, type AndOperator as ad, isAndOperator as ae, type OrOperator as af, isOrOperator as ag, type WhereOperator as ah, type Filterable as ai, type OperatorPredicate as aj, whereOperatorAsPredicate as ak, type SpacingSize as al, type TextSize as am, type ShapeSize as an, BorderStyles as ao, type BorderStyle as ap, ElementShapes as aq, type ElementShape as ar, type HexColor as as, type CustomColor as at, type CustomColorDefinitions as au, type RelationshipLineType as av, type RelationshipArrowType as aw, ThemeColors as ax, type ThemeColor as ay, type Color as az, ModelExpression as b, type ViewRuleGlobalPredicateRef as b0, isViewRuleGlobalPredicateRef as b1, type AutoLayoutDirection as b2, isAutoLayoutDirection as b3, type ViewRuleAutoLayout as b4, isViewRuleAutoLayout as b5, type ViewAutoLayout as b6, type ViewManualLayout as b7, type ViewType as b8, type BaseViewProperties as b9, type ParsedDynamicView as bA, isDynamicViewParallelSteps as bB, type ElementViewIncludePredicate as bC, type ElementViewExcludePredicate as bD, type ElementViewPredicate as bE, type ElementViewRuleGroup as bF, isViewRuleGroup as bG, type ElementViewRuleStyle as bH, type ElementViewRule as bI, type ParsedElementView as bJ, type BaseParsedViewProperties as ba, type NodeNotation as bb, type ViewWithNotation as bc, type ViewWithHash as bd, type ComputedNode as be, type ComputedEdge as bf, type ComputedElementView as bg, type ComputedDeploymentView as bh, type ComputedDynamicView as bi, type DiagramNode as bj, type DiagramEdge as bk, type LayoutedElementView as bl, type LayoutedDeploymentView as bm, type LayoutedDynamicView as bn, type DeploymentViewIncludePredicate as bo, type DeploymentViewExcludePredicate as bp, type DeploymentViewPredicate as bq, type DeploymentViewRuleStyle as br, type DeploymentViewRule as bs, type ParsedDeploymentView as bt, type DynamicViewStep as bu, type DynamicViewParallelSteps as bv, getParallelStepsPrefix as bw, type DynamicViewStepOrParallel as bx, type DynamicViewIncludeRule as by, type DynamicViewRule as bz, FqnRef as c, type Point as d, RectBox as e, type GlobalPredicates as f, type GlobalDynamicPredicates as g, type GlobalStyleID as h, type GlobalStyles as i, type ModelGlobals as j, type ParsedLikeC4ModelData as k, type ComputedLikeC4ModelData as l, type LayoutedLikeC4ModelData as m, type LikeC4ModelData as n, type DeploymentNode as o, type DeployedInstance as p, type DeploymentElement as q, type DeploymentElementRef as r, isDeploymentNode as s, isDeployedInstance as t, type DeploymentRelationship as u, type DeploymentRelation as v, type SpecTypesFromDump as w, type LikeC4ModelDump as x, type AuxFromDump as y, DefaultThemeColor as z };
|