@likec4/core 1.19.1 → 1.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/builder/index.cjs +881 -0
- package/dist/builder/index.d.cts +503 -0
- package/dist/builder/index.d.mts +5 -4
- package/dist/builder/index.d.ts +5 -4
- package/dist/builder/{index.js → index.mjs} +14 -4
- package/dist/compute-view/index.cjs +86 -0
- package/dist/compute-view/index.d.cts +23 -0
- package/dist/compute-view/index.d.mts +3 -2
- package/dist/compute-view/index.d.ts +3 -2
- package/dist/compute-view/{index.js → index.mjs} +6 -5
- package/dist/index.cjs +4320 -0
- package/dist/index.d.cts +270 -0
- package/dist/index.d.mts +130 -4
- package/dist/index.d.ts +130 -4
- package/dist/{index.js → index.mjs} +512 -7
- package/dist/model/index.cjs +40 -0
- package/dist/model/index.d.cts +259 -0
- package/dist/model/index.d.mts +8 -3
- package/dist/model/index.d.ts +8 -3
- package/dist/model/index.mjs +1 -0
- package/dist/shared/core.B2QYWlYe.cjs +435 -0
- package/dist/shared/core.B72vUaNB.d.cts +850 -0
- package/dist/shared/core.BGus30EM.cjs +8027 -0
- package/dist/shared/core.BRuJ3Wzf.d.mts +12 -0
- package/dist/shared/{core.BZ9Msq7w.d.mts → core.BdbFkE_p.d.cts} +14 -4
- package/dist/shared/core.BvdNMbcA.d.cts +12 -0
- package/dist/shared/{object_hash.CE_oF3I3.js → core.BxvDITEI.mjs} +26 -389
- package/dist/shared/core.ByNgh-mC.d.cts +127 -0
- package/dist/shared/core.C9DCnJh8.cjs +908 -0
- package/dist/shared/{index.DafVOuVd.js → core.CqCTxzMY.mjs} +1111 -572
- package/dist/shared/core.D74xkKkG.d.cts +148 -0
- package/dist/shared/{core.C05RDLhi.d.ts → core.D_Gc58Gt.d.ts} +23 -5
- package/dist/shared/core.Damrzla-.d.ts +12 -0
- package/dist/shared/{core.CmYMqgha.d.mts → core.Dfzrh1VA.d.mts} +23 -5
- package/dist/shared/core.DsoCu540.cjs +26 -0
- package/dist/shared/{view.CyZrG8BJ.js → core.DunIMHRf.mjs} +27 -1
- package/dist/shared/{core.BIfgabEw.d.ts → core.ZWiGANIJ.d.ts} +14 -4
- package/dist/shared/core.gv1bMwCC.cjs +39 -0
- package/dist/shared/core.jy6z2iRn.d.mts +729 -0
- package/dist/shared/core.m3rCQAv6.mjs +37 -0
- package/dist/types/index.cjs +107 -0
- package/dist/types/index.d.cts +72 -0
- package/dist/types/index.d.mts +2 -2
- package/dist/types/index.d.ts +2 -2
- package/dist/types/{index.js → index.mjs} +1 -1
- package/dist/utils/index.cjs +95 -0
- package/dist/utils/index.d.cts +356 -0
- package/dist/utils/index.d.mts +1 -64
- package/dist/utils/index.d.ts +1 -64
- package/dist/utils/index.mjs +56 -0
- package/package.json +52 -26
- package/src/builder/Builder.view-common.ts +21 -1
- package/src/compute-view/deployment-view/__test__/fixture.ts +31 -3
- package/src/compute-view/deployment-view/_types.ts +2 -1
- package/src/compute-view/deployment-view/compute.ts +4 -36
- package/src/compute-view/deployment-view/predicates/index.ts +8 -0
- package/src/compute-view/deployment-view/predicates/relation-direct.ts +125 -99
- package/src/compute-view/deployment-view/predicates/relation-in-out.ts +16 -8
- package/src/compute-view/deployment-view/predicates/relation-incoming.ts +18 -12
- package/src/compute-view/deployment-view/predicates/relation-outgoing.ts +16 -9
- package/src/compute-view/deployment-view/predicates/relation-where.ts +18 -0
- package/src/compute-view/deployment-view/predicates/utils.ts +214 -0
- package/src/compute-view/element-view/__test__/fixture.ts +17 -4
- package/src/compute-view/element-view/compute.ts +3 -2
- package/src/compute-view/element-view/predicates.ts +520 -0
- package/src/compute-view/element-view/utils.ts +11 -7
- package/src/compute-view/index.ts +1 -0
- package/src/compute-view/relationships-view/_types.ts +16 -0
- package/src/compute-view/relationships-view/compute.ts +74 -0
- package/src/compute-view/relationships-view/layout.ts +357 -0
- package/src/compute-view/relationships-view/utils.ts +40 -0
- package/src/compute-view/utils/relationExpressionToPredicates.ts +11 -4
- package/src/index.ts +16 -0
- package/src/model/DeploymentElementModel.ts +18 -1
- package/src/model/ElementModel.ts +13 -0
- package/src/model/LikeC4Model.ts +2 -2
- package/src/model/RelationModel.ts +9 -0
- package/src/model/connection/deployment/DeploymentConnectionModel.ts +11 -1
- package/src/model/guards.ts +17 -1
- package/src/model/view/LikeC4ViewModel.ts +7 -1
- package/src/model/view/NodeModel.ts +5 -0
- package/src/types/deployments.ts +1 -0
- package/src/types/expression-v2.ts +12 -0
- package/src/types/index.ts +1 -0
- package/src/types/operators.ts +46 -6
- package/src/types/view.ts +2 -2
- package/src/utils/index.ts +0 -5
- package/src/utils/iterable/unique.ts +1 -7
- package/dist/model/index.js +0 -1
- package/dist/utils/index.js +0 -347
- /package/dist/shared/{chunk-RAAYCPUM.M-JWF7SS.js → core.M-JWF7SS.mjs} +0 -0
|
@@ -0,0 +1,850 @@
|
|
|
1
|
+
import { Tagged, NonEmptyTuple, Simplify, MergeExclusive } from 'type-fest';
|
|
2
|
+
import { N as NonEmptyArray, F as Fqn, l as ElementShape, s as Color, I as IconUrl, h as BorderStyle, f as ElementKind, o as Tag, E as ExclusiveUnion, m as ElementStyle, n as Link, T as ThemeColorValues, X as XYPoint, P as Point, x as ThemeColor, j as ElementKindSpecification, q as TypedElement } from './core.D74xkKkG.cjs';
|
|
3
|
+
|
|
4
|
+
type EqualOperator<V> = {
|
|
5
|
+
eq: V;
|
|
6
|
+
neq?: never;
|
|
7
|
+
} | {
|
|
8
|
+
eq?: never;
|
|
9
|
+
neq: V;
|
|
10
|
+
};
|
|
11
|
+
type AllNever = {
|
|
12
|
+
not?: never;
|
|
13
|
+
and?: never;
|
|
14
|
+
or?: never;
|
|
15
|
+
tag?: never;
|
|
16
|
+
kind?: never;
|
|
17
|
+
participant?: never;
|
|
18
|
+
};
|
|
19
|
+
type TagEqual<Tag> = Omit<AllNever, 'tag'> & {
|
|
20
|
+
tag: EqualOperator<Tag>;
|
|
21
|
+
};
|
|
22
|
+
declare const isTagEqual: <Tag>(operator: WhereOperator<Tag, any>) => operator is TagEqual<Tag>;
|
|
23
|
+
type KindEqual<Kind> = Omit<AllNever, 'kind'> & {
|
|
24
|
+
kind: EqualOperator<Kind>;
|
|
25
|
+
};
|
|
26
|
+
declare const isKindEqual: <Kind>(operator: WhereOperator<any, Kind>) => operator is KindEqual<Kind>;
|
|
27
|
+
type Participant = 'source' | 'target';
|
|
28
|
+
type ParticipantOperator<Tag, Kind> = Omit<AllNever, 'participant'> & {
|
|
29
|
+
participant: Participant;
|
|
30
|
+
operator: KindEqual<Kind> | TagEqual<Tag>;
|
|
31
|
+
};
|
|
32
|
+
type NotOperator<Tag, Kind> = Omit<AllNever, 'not'> & {
|
|
33
|
+
not: WhereOperator<Tag, Kind>;
|
|
34
|
+
};
|
|
35
|
+
declare const isNotOperator: <Tag, Kind>(operator: WhereOperator<Tag, Kind>) => operator is NotOperator<Tag, Kind>;
|
|
36
|
+
type AndOperator<Tag, Kind> = Omit<AllNever, 'and'> & {
|
|
37
|
+
and: NonEmptyArray<WhereOperator<Tag, Kind>>;
|
|
38
|
+
};
|
|
39
|
+
declare const isAndOperator: <Tag, Kind>(operator: WhereOperator<Tag, Kind>) => operator is AndOperator<Tag, Kind>;
|
|
40
|
+
type OrOperator<Tag, Kind> = Omit<AllNever, 'or'> & {
|
|
41
|
+
or: NonEmptyArray<WhereOperator<Tag, Kind>>;
|
|
42
|
+
};
|
|
43
|
+
declare const isOrOperator: <Tag, Kind>(operator: WhereOperator<Tag, Kind>) => operator is OrOperator<Tag, Kind>;
|
|
44
|
+
type WhereOperator<Tag, Kind> = TagEqual<Tag> | KindEqual<Kind> | ParticipantOperator<Tag, Kind> | NotOperator<Tag, Kind> | AndOperator<Tag, Kind> | OrOperator<Tag, Kind>;
|
|
45
|
+
type Filterable<FTag extends string | null = string | null, FKind extends string | null = string | null> = {
|
|
46
|
+
tags?: readonly FTag[] | null;
|
|
47
|
+
kind?: FKind;
|
|
48
|
+
source?: Filterable<FTag, FKind>;
|
|
49
|
+
target?: Filterable<FTag, FKind>;
|
|
50
|
+
};
|
|
51
|
+
type OperatorPredicate<V extends Filterable> = (value: V) => boolean;
|
|
52
|
+
declare function whereOperatorAsPredicate<FTag extends string | null = string | null, FKind extends string | null = string | null>(operator: WhereOperator<FTag, FKind>): OperatorPredicate<Filterable>;
|
|
53
|
+
|
|
54
|
+
interface BaseExpr {
|
|
55
|
+
where?: never;
|
|
56
|
+
element?: never;
|
|
57
|
+
custom?: never;
|
|
58
|
+
expanded?: never;
|
|
59
|
+
elementKind?: never;
|
|
60
|
+
elementTag?: never;
|
|
61
|
+
isEqual?: never;
|
|
62
|
+
isChildren?: never;
|
|
63
|
+
isDescendants?: never;
|
|
64
|
+
wildcard?: never;
|
|
65
|
+
source?: never;
|
|
66
|
+
target?: never;
|
|
67
|
+
inout?: never;
|
|
68
|
+
incoming?: never;
|
|
69
|
+
outgoing?: never;
|
|
70
|
+
customRelation?: never;
|
|
71
|
+
}
|
|
72
|
+
interface ElementRefExpr extends Omit<BaseExpr, 'element' | 'isChildren' | 'isDescendants'> {
|
|
73
|
+
element: Fqn;
|
|
74
|
+
isChildren?: boolean;
|
|
75
|
+
isDescendants?: boolean;
|
|
76
|
+
}
|
|
77
|
+
declare function isElementRef(expr: Expression): expr is ElementRefExpr;
|
|
78
|
+
interface ExpandedElementExpr extends Omit<BaseExpr, 'expanded'> {
|
|
79
|
+
expanded: Fqn;
|
|
80
|
+
}
|
|
81
|
+
declare function isExpandedElementExpr(expr: Expression): expr is ExpandedElementExpr;
|
|
82
|
+
interface CustomElementExpr extends Omit<BaseExpr, 'custom'> {
|
|
83
|
+
custom: {
|
|
84
|
+
expr: ElementExpression | ElementWhereExpr;
|
|
85
|
+
title?: string;
|
|
86
|
+
description?: string;
|
|
87
|
+
technology?: string;
|
|
88
|
+
notation?: string;
|
|
89
|
+
shape?: ElementShape;
|
|
90
|
+
color?: Color;
|
|
91
|
+
icon?: IconUrl;
|
|
92
|
+
border?: BorderStyle;
|
|
93
|
+
opacity?: number;
|
|
94
|
+
navigateTo?: ViewId;
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
declare function isCustomElement(expr: Expression): expr is CustomElementExpr;
|
|
98
|
+
interface WildcardExpr extends Omit<BaseExpr, 'wildcard'> {
|
|
99
|
+
wildcard: true;
|
|
100
|
+
}
|
|
101
|
+
declare function isWildcard(expr: Expression): expr is WildcardExpr;
|
|
102
|
+
interface ElementKindExpr extends Omit<BaseExpr, 'elementKind' | 'isEqual'> {
|
|
103
|
+
elementKind: ElementKind;
|
|
104
|
+
isEqual: boolean;
|
|
105
|
+
}
|
|
106
|
+
declare function isElementKindExpr(expr: Expression): expr is ElementKindExpr;
|
|
107
|
+
interface ElementTagExpr extends Omit<BaseExpr, 'elementTag' | 'isEqual'> {
|
|
108
|
+
elementTag: Tag;
|
|
109
|
+
isEqual: boolean;
|
|
110
|
+
}
|
|
111
|
+
declare function isElementTagExpr(expr: Expression): expr is ElementTagExpr;
|
|
112
|
+
type NonWilcard = ElementRefExpr | ElementKindExpr | ElementTagExpr | ExpandedElementExpr;
|
|
113
|
+
type ElementExpression = NonWilcard | WildcardExpr;
|
|
114
|
+
declare function isElement(expr: Expression): expr is ElementExpression;
|
|
115
|
+
interface ElementWhereExpr extends Omit<BaseExpr, 'where'> {
|
|
116
|
+
where: {
|
|
117
|
+
expr: ElementExpression;
|
|
118
|
+
condition: WhereOperator<string, string>;
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
declare function isElementWhere(expr: Expression): expr is ElementWhereExpr;
|
|
122
|
+
type ElementPredicateExpression = ElementExpression | ElementWhereExpr | CustomElementExpr;
|
|
123
|
+
declare function isElementPredicateExpr(expr: Expression): expr is ElementPredicateExpression;
|
|
124
|
+
interface DirectRelationExpr extends Omit<BaseExpr, 'source' | 'target'> {
|
|
125
|
+
source: ElementExpression;
|
|
126
|
+
target: ElementExpression;
|
|
127
|
+
isBidirectional?: boolean;
|
|
128
|
+
}
|
|
129
|
+
declare function isRelation(expr: Expression): expr is DirectRelationExpr;
|
|
130
|
+
interface InOutExpr extends Omit<BaseExpr, 'inout'> {
|
|
131
|
+
inout: ElementExpression;
|
|
132
|
+
}
|
|
133
|
+
declare function isInOut(expr: Expression): expr is InOutExpr;
|
|
134
|
+
interface IncomingExpr extends Omit<BaseExpr, 'incoming'> {
|
|
135
|
+
incoming: ElementExpression;
|
|
136
|
+
}
|
|
137
|
+
declare function isIncoming(expr: Expression): expr is IncomingExpr;
|
|
138
|
+
interface OutgoingExpr extends Omit<BaseExpr, 'outgoing'> {
|
|
139
|
+
outgoing: ElementExpression;
|
|
140
|
+
}
|
|
141
|
+
declare function isOutgoing(expr: Expression): expr is OutgoingExpr;
|
|
142
|
+
type RelationExpression = DirectRelationExpr | InOutExpr | IncomingExpr | OutgoingExpr;
|
|
143
|
+
declare function isRelationExpression(expr: Expression): expr is RelationExpression;
|
|
144
|
+
interface RelationWhereExpr extends Omit<BaseExpr, 'where'> {
|
|
145
|
+
where: {
|
|
146
|
+
expr: RelationExpression;
|
|
147
|
+
condition: WhereOperator<string, string>;
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
declare function isRelationWhere(expr: Expression): expr is RelationWhereExpr;
|
|
151
|
+
interface CustomRelationExpr extends Omit<BaseExpr, 'customRelation'> {
|
|
152
|
+
customRelation: {
|
|
153
|
+
relation: RelationExpression | RelationWhereExpr;
|
|
154
|
+
title?: string;
|
|
155
|
+
description?: string;
|
|
156
|
+
technology?: string;
|
|
157
|
+
notation?: string;
|
|
158
|
+
navigateTo?: ViewId;
|
|
159
|
+
notes?: string;
|
|
160
|
+
color?: Color;
|
|
161
|
+
line?: RelationshipLineType;
|
|
162
|
+
head?: RelationshipArrowType;
|
|
163
|
+
tail?: RelationshipArrowType;
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
declare function isCustomRelationExpr(expr: Expression): expr is CustomRelationExpr;
|
|
167
|
+
type RelationPredicateExpression = RelationExpression | RelationWhereExpr | CustomRelationExpr;
|
|
168
|
+
declare function isRelationPredicateExpr(expr: Expression): expr is RelationPredicateExpression;
|
|
169
|
+
type Expression = ElementPredicateExpression | RelationPredicateExpression;
|
|
170
|
+
|
|
171
|
+
type expression_CustomElementExpr = CustomElementExpr;
|
|
172
|
+
type expression_CustomRelationExpr = CustomRelationExpr;
|
|
173
|
+
type expression_DirectRelationExpr = DirectRelationExpr;
|
|
174
|
+
type expression_ElementExpression = ElementExpression;
|
|
175
|
+
type expression_ElementKindExpr = ElementKindExpr;
|
|
176
|
+
type expression_ElementPredicateExpression = ElementPredicateExpression;
|
|
177
|
+
type expression_ElementRefExpr = ElementRefExpr;
|
|
178
|
+
type expression_ElementTagExpr = ElementTagExpr;
|
|
179
|
+
type expression_ElementWhereExpr = ElementWhereExpr;
|
|
180
|
+
type expression_ExpandedElementExpr = ExpandedElementExpr;
|
|
181
|
+
type expression_Expression = Expression;
|
|
182
|
+
type expression_InOutExpr = InOutExpr;
|
|
183
|
+
type expression_IncomingExpr = IncomingExpr;
|
|
184
|
+
type expression_NonWilcard = NonWilcard;
|
|
185
|
+
type expression_OutgoingExpr = OutgoingExpr;
|
|
186
|
+
type expression_RelationExpression = RelationExpression;
|
|
187
|
+
type expression_RelationPredicateExpression = RelationPredicateExpression;
|
|
188
|
+
type expression_RelationWhereExpr = RelationWhereExpr;
|
|
189
|
+
type expression_WildcardExpr = WildcardExpr;
|
|
190
|
+
declare const expression_isCustomElement: typeof isCustomElement;
|
|
191
|
+
declare const expression_isCustomRelationExpr: typeof isCustomRelationExpr;
|
|
192
|
+
declare const expression_isElement: typeof isElement;
|
|
193
|
+
declare const expression_isElementKindExpr: typeof isElementKindExpr;
|
|
194
|
+
declare const expression_isElementPredicateExpr: typeof isElementPredicateExpr;
|
|
195
|
+
declare const expression_isElementRef: typeof isElementRef;
|
|
196
|
+
declare const expression_isElementTagExpr: typeof isElementTagExpr;
|
|
197
|
+
declare const expression_isElementWhere: typeof isElementWhere;
|
|
198
|
+
declare const expression_isExpandedElementExpr: typeof isExpandedElementExpr;
|
|
199
|
+
declare const expression_isInOut: typeof isInOut;
|
|
200
|
+
declare const expression_isIncoming: typeof isIncoming;
|
|
201
|
+
declare const expression_isOutgoing: typeof isOutgoing;
|
|
202
|
+
declare const expression_isRelation: typeof isRelation;
|
|
203
|
+
declare const expression_isRelationExpression: typeof isRelationExpression;
|
|
204
|
+
declare const expression_isRelationPredicateExpr: typeof isRelationPredicateExpr;
|
|
205
|
+
declare const expression_isRelationWhere: typeof isRelationWhere;
|
|
206
|
+
declare const expression_isWildcard: typeof isWildcard;
|
|
207
|
+
declare namespace expression {
|
|
208
|
+
export { type expression_CustomElementExpr as CustomElementExpr, type expression_CustomRelationExpr as CustomRelationExpr, type expression_DirectRelationExpr as DirectRelationExpr, type expression_ElementExpression as ElementExpression, type expression_ElementKindExpr as ElementKindExpr, type expression_ElementPredicateExpression as ElementPredicateExpression, type expression_ElementRefExpr as ElementRefExpr, type expression_ElementTagExpr as ElementTagExpr, type expression_ElementWhereExpr as ElementWhereExpr, type expression_ExpandedElementExpr as ExpandedElementExpr, type expression_Expression as Expression, type expression_InOutExpr as InOutExpr, type expression_IncomingExpr as IncomingExpr, type expression_NonWilcard as NonWilcard, type expression_OutgoingExpr as OutgoingExpr, type expression_RelationExpression as RelationExpression, type expression_RelationPredicateExpression as RelationPredicateExpression, type expression_RelationWhereExpr as RelationWhereExpr, type expression_WildcardExpr as WildcardExpr, expression_isCustomElement as isCustomElement, expression_isCustomRelationExpr as isCustomRelationExpr, expression_isElement as isElement, expression_isElementKindExpr as isElementKindExpr, expression_isElementPredicateExpr as isElementPredicateExpr, expression_isElementRef as isElementRef, expression_isElementTagExpr as isElementTagExpr, expression_isElementWhere as isElementWhere, expression_isExpandedElementExpr as isExpandedElementExpr, expression_isInOut as isInOut, expression_isIncoming as isIncoming, expression_isOutgoing as isOutgoing, expression_isRelation as isRelation, expression_isRelationExpression as isRelationExpression, expression_isRelationPredicateExpr as isRelationPredicateExpr, expression_isRelationWhere as isRelationWhere, expression_isWildcard as isWildcard };
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
declare namespace FqnRef {
|
|
212
|
+
/**
|
|
213
|
+
* Represents a reference to an instance within a deployment.
|
|
214
|
+
*
|
|
215
|
+
* @template D - The type representing the deployment fqn. Defaults to `Fqn`.
|
|
216
|
+
* @template M - The type representing the model fqn. Defaults to `Fqn`.
|
|
217
|
+
*
|
|
218
|
+
* @property {D} deployment - TThe fully qualified name (FQN) of the deployed instance.
|
|
219
|
+
* @property {M} element - The element reference within the deployment.
|
|
220
|
+
*/
|
|
221
|
+
type InsideInstanceRef<D = Fqn, M = Fqn> = {
|
|
222
|
+
deployment: D;
|
|
223
|
+
element: M;
|
|
224
|
+
};
|
|
225
|
+
const isInsideInstanceRef: (ref: FqnRef) => ref is InsideInstanceRef;
|
|
226
|
+
/**
|
|
227
|
+
* Represents a reference to a deployment element.
|
|
228
|
+
*
|
|
229
|
+
* @template F - The type of the fully qualified name (FQN) of the deployment element. Defaults to `Fqn`.
|
|
230
|
+
* @property {F} deployment - The fully qualified name (FQN) of the deployment element.
|
|
231
|
+
*/
|
|
232
|
+
type DeploymentElementRef<F = Fqn> = {
|
|
233
|
+
deployment: F;
|
|
234
|
+
};
|
|
235
|
+
const isDeploymentElementRef: (ref: FqnRef) => ref is DeploymentElementRef;
|
|
236
|
+
type DeploymentRef<D = Fqn, M = Fqn> = DeploymentElementRef<D> | InsideInstanceRef<D, M>;
|
|
237
|
+
const isDeploymentRef: (ref: FqnRef) => ref is DeploymentRef;
|
|
238
|
+
/**
|
|
239
|
+
* Reference to logical model element
|
|
240
|
+
*/
|
|
241
|
+
type ModelRef<F = Fqn> = {
|
|
242
|
+
model: F;
|
|
243
|
+
};
|
|
244
|
+
const isModelRef: (ref: FqnRef) => ref is ModelRef;
|
|
245
|
+
const toDeploymentRef: (ref: FqnRef) => DeploymentRef;
|
|
246
|
+
}
|
|
247
|
+
type FqnRef<D = Fqn, M = Fqn> = ExclusiveUnion<{
|
|
248
|
+
InsideInstanceRef: FqnRef.InsideInstanceRef<D, M>;
|
|
249
|
+
DeploymentRef: FqnRef.DeploymentRef<D>;
|
|
250
|
+
ModelRef: FqnRef.ModelRef<M>;
|
|
251
|
+
}>;
|
|
252
|
+
declare namespace FqnExpr {
|
|
253
|
+
type Wildcard = {
|
|
254
|
+
wildcard: true;
|
|
255
|
+
};
|
|
256
|
+
const isWildcard: (expr: ExpressionV2) => expr is Wildcard;
|
|
257
|
+
type ModelRef<M = Fqn> = {
|
|
258
|
+
ref: FqnRef.ModelRef<M>;
|
|
259
|
+
selector?: PredicateSelector;
|
|
260
|
+
};
|
|
261
|
+
const isModelRef: (ref: ExpressionV2) => ref is ModelRef;
|
|
262
|
+
type DeploymentRef<D = Fqn, M = Fqn> = {
|
|
263
|
+
ref: FqnRef.DeploymentRef<D> | FqnRef.InsideInstanceRef<D, M>;
|
|
264
|
+
selector?: PredicateSelector;
|
|
265
|
+
};
|
|
266
|
+
const isDeploymentRef: (ref: ExpressionV2) => ref is FqnExpr.DeploymentRef;
|
|
267
|
+
type NonWildcard<D = Fqn, M = Fqn> = ExclusiveUnion<{
|
|
268
|
+
ModelRef: ModelRef<M>;
|
|
269
|
+
DeploymentRef: DeploymentRef<D, M>;
|
|
270
|
+
}>;
|
|
271
|
+
}
|
|
272
|
+
type FqnExpr<D = Fqn, M = Fqn> = ExclusiveUnion<{
|
|
273
|
+
Wildcard: FqnExpr.Wildcard;
|
|
274
|
+
ModelRef: FqnExpr.ModelRef<M>;
|
|
275
|
+
DeploymentRef: FqnExpr.DeploymentRef<D, M>;
|
|
276
|
+
}>;
|
|
277
|
+
declare namespace RelationExpr {
|
|
278
|
+
type Direct<D = Fqn, M = Fqn> = {
|
|
279
|
+
source: FqnExpr<D, M>;
|
|
280
|
+
target: FqnExpr<D, M>;
|
|
281
|
+
isBidirectional?: boolean;
|
|
282
|
+
};
|
|
283
|
+
const isDirect: (expr: ExpressionV2) => expr is Direct;
|
|
284
|
+
type Incoming<D = Fqn, M = Fqn> = {
|
|
285
|
+
incoming: FqnExpr<D, M>;
|
|
286
|
+
};
|
|
287
|
+
const isIncoming: (expr: ExpressionV2) => expr is Incoming;
|
|
288
|
+
type Outgoing<D = Fqn, M = Fqn> = {
|
|
289
|
+
outgoing: FqnExpr<D, M>;
|
|
290
|
+
};
|
|
291
|
+
const isOutgoing: (expr: ExpressionV2) => expr is Outgoing;
|
|
292
|
+
type InOut<D = Fqn, M = Fqn> = {
|
|
293
|
+
inout: FqnExpr<D, M>;
|
|
294
|
+
};
|
|
295
|
+
const isInOut: (expr: ExpressionV2) => expr is InOut;
|
|
296
|
+
type Where<D = Fqn, M = Fqn> = {
|
|
297
|
+
where: {
|
|
298
|
+
expr: ExpressionV2<D, M>;
|
|
299
|
+
condition: WhereOperator<string, string>;
|
|
300
|
+
};
|
|
301
|
+
};
|
|
302
|
+
const isWhere: (expr: ExpressionV2) => expr is Where;
|
|
303
|
+
}
|
|
304
|
+
type RelationExpr<D = Fqn, M = Fqn> = ExclusiveUnion<{
|
|
305
|
+
Direct: RelationExpr.Direct<D, M>;
|
|
306
|
+
Incoming: RelationExpr.Incoming<D, M>;
|
|
307
|
+
Outgoing: RelationExpr.Outgoing<D, M>;
|
|
308
|
+
InOut: RelationExpr.InOut<D, M>;
|
|
309
|
+
Where: RelationExpr.Where<D, M>;
|
|
310
|
+
}>;
|
|
311
|
+
/**
|
|
312
|
+
* Represents a version 2 expression which can be one of several types.
|
|
313
|
+
*
|
|
314
|
+
* @template D - The type for the deployment FQN, defaults to `Fqn`.
|
|
315
|
+
* @template M - The type for the model FQN, defaults to `Fqn`.
|
|
316
|
+
*/
|
|
317
|
+
type ExpressionV2<D = Fqn, M = Fqn> = ExclusiveUnion<{
|
|
318
|
+
Wildcard: FqnExpr.Wildcard;
|
|
319
|
+
ModelRef: FqnExpr.ModelRef<M>;
|
|
320
|
+
DeploymentRef: FqnExpr.DeploymentRef<D, M>;
|
|
321
|
+
Direct: RelationExpr.Direct<D, M>;
|
|
322
|
+
Incoming: RelationExpr.Incoming<D, M>;
|
|
323
|
+
Outgoing: RelationExpr.Outgoing<D, M>;
|
|
324
|
+
InOut: RelationExpr.InOut<D, M>;
|
|
325
|
+
RelationPredicateOrWhere: RelationExpr.Where<D, M>;
|
|
326
|
+
}>;
|
|
327
|
+
declare namespace ExpressionV2 {
|
|
328
|
+
const isFqnExpr: (expr: ExpressionV2) => expr is FqnExpr;
|
|
329
|
+
const isRelation: (expr: ExpressionV2) => expr is RelationExpr;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
type GlobalPredicateId = Tagged<string, 'GlobalPredicateId'>;
|
|
333
|
+
type GlobalPredicates = NonEmptyArray<ViewRulePredicate>;
|
|
334
|
+
type GlobalDynamicPredicates = NonEmptyArray<DynamicViewIncludeRule>;
|
|
335
|
+
type GlobalStyleID = Tagged<string, 'GlobalStyleID'>;
|
|
336
|
+
type GlobalStyles = NonEmptyTuple<ViewRuleStyle>;
|
|
337
|
+
interface ModelGlobals {
|
|
338
|
+
readonly predicates: Record<GlobalPredicateId, GlobalPredicates>;
|
|
339
|
+
readonly dynamicPredicates: Record<GlobalPredicateId, GlobalDynamicPredicates>;
|
|
340
|
+
readonly styles: Record<GlobalStyleID, GlobalStyles>;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
type ElementNotation = {
|
|
344
|
+
kinds: string[];
|
|
345
|
+
shape: ElementShape;
|
|
346
|
+
color: Color;
|
|
347
|
+
title: string;
|
|
348
|
+
};
|
|
349
|
+
|
|
350
|
+
type ViewId<Id extends string = string> = Tagged<Id, 'ViewID'>;
|
|
351
|
+
type ViewRulePredicate = {
|
|
352
|
+
include: Expression[];
|
|
353
|
+
exclude?: never;
|
|
354
|
+
} | {
|
|
355
|
+
include?: never;
|
|
356
|
+
exclude: Expression[];
|
|
357
|
+
};
|
|
358
|
+
declare function isViewRulePredicate(rule: DeploymentViewRule): rule is DeploymentViewRulePredicate;
|
|
359
|
+
declare function isViewRulePredicate(rule: DynamicViewRule): rule is DynamicViewIncludeRule;
|
|
360
|
+
declare function isViewRulePredicate(rule: ViewRule): rule is ViewRulePredicate;
|
|
361
|
+
interface ViewRuleGlobalPredicateRef {
|
|
362
|
+
predicateId: GlobalPredicateId;
|
|
363
|
+
}
|
|
364
|
+
declare function isViewRuleGlobalPredicateRef(rule: ViewRule): rule is ViewRuleGlobalPredicateRef;
|
|
365
|
+
interface ViewRuleStyle {
|
|
366
|
+
targets: ElementExpression[];
|
|
367
|
+
notation?: string;
|
|
368
|
+
style: ElementStyle & {
|
|
369
|
+
color?: Color;
|
|
370
|
+
shape?: ElementShape;
|
|
371
|
+
icon?: IconUrl;
|
|
372
|
+
};
|
|
373
|
+
}
|
|
374
|
+
declare function isViewRuleStyle(rule: DeploymentViewRule): rule is DeploymentViewRuleStyle;
|
|
375
|
+
declare function isViewRuleStyle(rule: ViewRule): rule is ViewRuleStyle;
|
|
376
|
+
interface ViewRuleGlobalStyle {
|
|
377
|
+
styleId: GlobalStyleID;
|
|
378
|
+
}
|
|
379
|
+
declare function isViewRuleGlobalStyle(rule: ViewRule): rule is ViewRuleGlobalStyle;
|
|
380
|
+
type ViewRuleStyleOrGlobalRef = ViewRuleStyle | ViewRuleGlobalStyle;
|
|
381
|
+
type AutoLayoutDirection = 'TB' | 'BT' | 'LR' | 'RL';
|
|
382
|
+
declare function isAutoLayoutDirection(autoLayout: unknown): autoLayout is AutoLayoutDirection;
|
|
383
|
+
interface ViewRuleAutoLayout {
|
|
384
|
+
direction: AutoLayoutDirection;
|
|
385
|
+
nodeSep?: number;
|
|
386
|
+
rankSep?: number;
|
|
387
|
+
}
|
|
388
|
+
declare function isViewRuleAutoLayout(rule: DeploymentViewRule | DynamicViewRule | ViewRule): rule is ViewRuleAutoLayout;
|
|
389
|
+
interface ViewRuleGroup {
|
|
390
|
+
groupRules: Array<ViewRulePredicate | ViewRuleGroup>;
|
|
391
|
+
title: string | null;
|
|
392
|
+
color?: Color;
|
|
393
|
+
border?: BorderStyle;
|
|
394
|
+
opacity?: number;
|
|
395
|
+
}
|
|
396
|
+
declare function isViewRuleGroup(rule: ViewRule): rule is ViewRuleGroup;
|
|
397
|
+
type ViewRule = ViewRulePredicate | ViewRuleGlobalPredicateRef | ViewRuleGroup | ViewRuleStyle | ViewRuleGlobalStyle | ViewRuleAutoLayout;
|
|
398
|
+
interface BasicView<ViewType extends 'element' | 'dynamic' | 'deployment', ViewIDs extends string, Tags extends string> {
|
|
399
|
+
readonly __?: ViewType;
|
|
400
|
+
readonly id: ViewId<ViewIDs>;
|
|
401
|
+
readonly title: string | null;
|
|
402
|
+
readonly description: string | null;
|
|
403
|
+
readonly tags: NonEmptyArray<Tag<Tags>> | null;
|
|
404
|
+
readonly links: NonEmptyArray<Link> | null;
|
|
405
|
+
/**
|
|
406
|
+
* URI to the source file of this view.
|
|
407
|
+
* Undefined if the view is auto-generated.
|
|
408
|
+
*/
|
|
409
|
+
readonly docUri?: string;
|
|
410
|
+
/**
|
|
411
|
+
* For all views we find common ancestor path.
|
|
412
|
+
* This is used to generate relative paths, i.e.:
|
|
413
|
+
* - "/home/project/index.c4" becomes "index.c4"
|
|
414
|
+
* - "/home/project/subdir/views.c4" becomes "subdir/views.c4"
|
|
415
|
+
*
|
|
416
|
+
* Undefined if the view is auto-generated.
|
|
417
|
+
*/
|
|
418
|
+
readonly relativePath?: string;
|
|
419
|
+
/**
|
|
420
|
+
* If the view is changed manually this field contains the layout data.
|
|
421
|
+
*/
|
|
422
|
+
readonly manualLayout?: ViewManualLayout | undefined;
|
|
423
|
+
readonly customColorDefinitions: CustomColorDefinitions;
|
|
424
|
+
}
|
|
425
|
+
interface BasicElementView<ViewIDs extends string, Tags extends string> extends BasicView<'element', ViewIDs, Tags> {
|
|
426
|
+
readonly viewOf?: Fqn;
|
|
427
|
+
readonly rules: ViewRule[];
|
|
428
|
+
}
|
|
429
|
+
interface ScopedElementView<ViewIDs extends string, Tags extends string> extends BasicElementView<ViewIDs, Tags> {
|
|
430
|
+
readonly viewOf: Fqn;
|
|
431
|
+
}
|
|
432
|
+
interface ExtendsElementView<ViewIDs extends string, Tags extends string> extends BasicElementView<ViewIDs, Tags> {
|
|
433
|
+
readonly extends: ViewId<ViewIDs>;
|
|
434
|
+
}
|
|
435
|
+
type ElementView<ViewIDs extends string = string, Tags extends string = string> = ScopedElementView<ViewIDs, Tags> | ExtendsElementView<ViewIDs, Tags> | BasicElementView<ViewIDs, Tags>;
|
|
436
|
+
interface DynamicViewStep {
|
|
437
|
+
readonly source: Fqn;
|
|
438
|
+
readonly target: Fqn;
|
|
439
|
+
readonly title: string | null;
|
|
440
|
+
readonly description?: string;
|
|
441
|
+
readonly technology?: string;
|
|
442
|
+
readonly notation?: string;
|
|
443
|
+
readonly notes?: string;
|
|
444
|
+
readonly color?: Color;
|
|
445
|
+
readonly line?: RelationshipLineType;
|
|
446
|
+
readonly head?: RelationshipArrowType;
|
|
447
|
+
readonly tail?: RelationshipArrowType;
|
|
448
|
+
readonly isBackward?: boolean;
|
|
449
|
+
readonly navigateTo?: ViewId;
|
|
450
|
+
__parallel?: never;
|
|
451
|
+
}
|
|
452
|
+
interface DynamicViewParallelSteps {
|
|
453
|
+
readonly __parallel: DynamicViewStep[];
|
|
454
|
+
}
|
|
455
|
+
type DynamicViewStepOrParallel = DynamicViewStep | DynamicViewParallelSteps;
|
|
456
|
+
type DynamicViewIncludeRule = {
|
|
457
|
+
include: ElementPredicateExpression[];
|
|
458
|
+
};
|
|
459
|
+
type DynamicViewRule = DynamicViewIncludeRule | ViewRuleGlobalPredicateRef | ViewRuleStyle | ViewRuleGlobalStyle | ViewRuleAutoLayout;
|
|
460
|
+
interface DynamicView<ViewIDs extends string = string, Tags extends string = string> extends BasicView<'dynamic', ViewIDs, Tags> {
|
|
461
|
+
readonly __: 'dynamic';
|
|
462
|
+
readonly steps: DynamicViewStepOrParallel[];
|
|
463
|
+
readonly rules: DynamicViewRule[];
|
|
464
|
+
}
|
|
465
|
+
declare function isDynamicViewParallelSteps(step: DynamicViewStepOrParallel): step is DynamicViewParallelSteps;
|
|
466
|
+
type CustomColorDefinitions = {
|
|
467
|
+
[key: string]: ThemeColorValues;
|
|
468
|
+
};
|
|
469
|
+
type DeploymentViewRulePredicate = {
|
|
470
|
+
include: ExpressionV2[];
|
|
471
|
+
exclude?: never;
|
|
472
|
+
} | {
|
|
473
|
+
include?: never;
|
|
474
|
+
exclude: ExpressionV2[];
|
|
475
|
+
};
|
|
476
|
+
type DeploymentViewRuleStyle = {
|
|
477
|
+
targets: FqnExpr[];
|
|
478
|
+
notation?: string;
|
|
479
|
+
style: ElementStyle & {
|
|
480
|
+
color?: Color;
|
|
481
|
+
shape?: ElementShape;
|
|
482
|
+
icon?: IconUrl;
|
|
483
|
+
};
|
|
484
|
+
};
|
|
485
|
+
type DeploymentViewRule = DeploymentViewRulePredicate | ViewRuleAutoLayout | DeploymentViewRuleStyle;
|
|
486
|
+
interface DeploymentView<ViewIDs extends string = string, Tags extends string = string> extends BasicView<'deployment', ViewIDs, Tags> {
|
|
487
|
+
readonly __: 'deployment';
|
|
488
|
+
readonly rules: DeploymentViewRule[];
|
|
489
|
+
}
|
|
490
|
+
type LikeC4View<ViewIDs extends string = string, Tags extends string = string> = ElementView<ViewIDs, Tags> | DynamicView<ViewIDs, Tags> | DeploymentView<ViewIDs, Tags>;
|
|
491
|
+
declare function isDeploymentView(view: LikeC4View): view is DeploymentView;
|
|
492
|
+
declare function isDeploymentView<V extends {
|
|
493
|
+
__?: string;
|
|
494
|
+
}>(view: V): boolean;
|
|
495
|
+
declare function isDynamicView(view: LikeC4View): view is DynamicView;
|
|
496
|
+
declare function isElementView(view: LikeC4View): view is ElementView;
|
|
497
|
+
declare function isExtendsElementView(view: LikeC4View): view is ExtendsElementView<string, string>;
|
|
498
|
+
declare function isScopedElementView(view: LikeC4View): view is ScopedElementView<string, string>;
|
|
499
|
+
type NodeId<IDs extends string = string> = Tagged<IDs, 'Fqn'>;
|
|
500
|
+
type EdgeId = Tagged<string, 'EdgeId'>;
|
|
501
|
+
type StepEdgeIdLiteral = `step-${number}` | `step-${number}.${number}`;
|
|
502
|
+
type StepEdgeId = Tagged<StepEdgeIdLiteral, 'EdgeId'>;
|
|
503
|
+
declare function stepEdgeId(step: number, parallelStep?: number): StepEdgeId;
|
|
504
|
+
declare function isStepEdgeId(id: string): id is StepEdgeId;
|
|
505
|
+
declare function extractStep(id: EdgeId): number;
|
|
506
|
+
declare function getParallelStepsPrefix(id: string): string | null;
|
|
507
|
+
interface ComputedNode {
|
|
508
|
+
id: NodeId;
|
|
509
|
+
kind: string;
|
|
510
|
+
parent: NodeId | null;
|
|
511
|
+
/**
|
|
512
|
+
* Reference to model element
|
|
513
|
+
* If 1 - node id is a reference
|
|
514
|
+
*/
|
|
515
|
+
modelRef?: 1 | Fqn;
|
|
516
|
+
/**
|
|
517
|
+
* Reference to deployment element
|
|
518
|
+
* If 1 - node id is a reference
|
|
519
|
+
*/
|
|
520
|
+
deploymentRef?: 1 | Fqn;
|
|
521
|
+
title: string;
|
|
522
|
+
description: string | null;
|
|
523
|
+
technology: string | null;
|
|
524
|
+
notation?: string;
|
|
525
|
+
tags: NonEmptyArray<Tag> | null;
|
|
526
|
+
links: NonEmptyArray<Link> | null;
|
|
527
|
+
children: NodeId[];
|
|
528
|
+
inEdges: EdgeId[];
|
|
529
|
+
outEdges: EdgeId[];
|
|
530
|
+
shape: ElementShape;
|
|
531
|
+
color: Color;
|
|
532
|
+
/**
|
|
533
|
+
* @deprecated Use `style` instead
|
|
534
|
+
*/
|
|
535
|
+
icon?: IconUrl;
|
|
536
|
+
style: ElementStyle;
|
|
537
|
+
navigateTo?: ViewId | null;
|
|
538
|
+
level: number;
|
|
539
|
+
depth?: number;
|
|
540
|
+
/**
|
|
541
|
+
* If this node was customized in the view
|
|
542
|
+
*/
|
|
543
|
+
isCustomized?: boolean;
|
|
544
|
+
}
|
|
545
|
+
declare namespace ComputedNode {
|
|
546
|
+
function modelRef(node: ComputedNode): Fqn | null;
|
|
547
|
+
function deploymentRef(node: ComputedNode): Fqn | null;
|
|
548
|
+
/**
|
|
549
|
+
* Nodes group is a special kind of node, exisiting only in view
|
|
550
|
+
*/
|
|
551
|
+
function isNodesGroup(node: ComputedNode): boolean;
|
|
552
|
+
}
|
|
553
|
+
interface ComputedEdge {
|
|
554
|
+
id: EdgeId;
|
|
555
|
+
parent: NodeId | null;
|
|
556
|
+
source: NodeId;
|
|
557
|
+
target: NodeId;
|
|
558
|
+
label: string | null;
|
|
559
|
+
description?: string;
|
|
560
|
+
technology?: string;
|
|
561
|
+
relations: RelationId[];
|
|
562
|
+
kind?: RelationshipKind;
|
|
563
|
+
notation?: string;
|
|
564
|
+
notes?: string;
|
|
565
|
+
color?: Color;
|
|
566
|
+
line?: RelationshipLineType;
|
|
567
|
+
head?: RelationshipArrowType;
|
|
568
|
+
tail?: RelationshipArrowType;
|
|
569
|
+
tags?: NonEmptyArray<Tag>;
|
|
570
|
+
navigateTo?: ViewId;
|
|
571
|
+
/**
|
|
572
|
+
* If this edge is derived from custom relationship predicate
|
|
573
|
+
*/
|
|
574
|
+
isCustomized?: boolean;
|
|
575
|
+
/**
|
|
576
|
+
* For layouting purposes
|
|
577
|
+
* @default 'forward'
|
|
578
|
+
*/
|
|
579
|
+
dir?: 'forward' | 'back' | 'both';
|
|
580
|
+
}
|
|
581
|
+
interface ViewWithHash {
|
|
582
|
+
/**
|
|
583
|
+
* Hash of the view object.
|
|
584
|
+
* This is used to detect changes in layout
|
|
585
|
+
*/
|
|
586
|
+
hash: string;
|
|
587
|
+
}
|
|
588
|
+
interface ViewWithNotation {
|
|
589
|
+
notation?: {
|
|
590
|
+
elements: ElementNotation[];
|
|
591
|
+
};
|
|
592
|
+
}
|
|
593
|
+
interface ViewAutoLayout {
|
|
594
|
+
direction: ViewRuleAutoLayout['direction'];
|
|
595
|
+
rankSep?: number;
|
|
596
|
+
nodeSep?: number;
|
|
597
|
+
}
|
|
598
|
+
interface ComputedElementView<ViewIDs extends string = string, Tags extends string = string> extends Omit<ElementView<ViewIDs, Tags>, 'rules' | 'docUri'>, ViewWithHash, ViewWithNotation {
|
|
599
|
+
readonly extends?: ViewId<ViewIDs>;
|
|
600
|
+
readonly autoLayout: ViewAutoLayout;
|
|
601
|
+
readonly nodes: ComputedNode[];
|
|
602
|
+
readonly edges: ComputedEdge[];
|
|
603
|
+
rules?: never;
|
|
604
|
+
docUri?: never;
|
|
605
|
+
}
|
|
606
|
+
interface ComputedDynamicView<ViewIDs extends string = string, Tags extends string = string> extends Omit<DynamicView<ViewIDs, Tags>, 'rules' | 'steps' | 'docUri'>, ViewWithHash, ViewWithNotation {
|
|
607
|
+
readonly autoLayout: ViewAutoLayout;
|
|
608
|
+
readonly nodes: ComputedNode[];
|
|
609
|
+
readonly edges: ComputedEdge[];
|
|
610
|
+
steps?: never;
|
|
611
|
+
rules?: never;
|
|
612
|
+
docUri?: never;
|
|
613
|
+
}
|
|
614
|
+
interface ComputedDeploymentView<ViewIDs extends string = string, Tags extends string = string> extends Omit<DeploymentView<ViewIDs, Tags>, 'rules' | 'docUri'>, ViewWithHash, ViewWithNotation {
|
|
615
|
+
readonly autoLayout: ViewAutoLayout;
|
|
616
|
+
readonly nodes: ComputedNode[];
|
|
617
|
+
readonly edges: ComputedEdge[];
|
|
618
|
+
rules?: never;
|
|
619
|
+
docUri?: never;
|
|
620
|
+
}
|
|
621
|
+
type ComputedView<ViewIDs extends string = string, Tags extends string = string> = ComputedElementView<ViewIDs, Tags> | ComputedDynamicView<ViewIDs, Tags> | ComputedDeploymentView<ViewIDs, Tags>;
|
|
622
|
+
declare namespace ComputedView {
|
|
623
|
+
function isDeployment(view: ComputedView): view is ComputedDeploymentView;
|
|
624
|
+
function isDynamic(view: ComputedView): view is ComputedDynamicView;
|
|
625
|
+
function isElement(view: ComputedView): view is ComputedElementView;
|
|
626
|
+
}
|
|
627
|
+
type BBox = {
|
|
628
|
+
x: number;
|
|
629
|
+
y: number;
|
|
630
|
+
width: number;
|
|
631
|
+
height: number;
|
|
632
|
+
};
|
|
633
|
+
declare function getBBoxCenter({ x, y, width, height, }: BBox): XYPoint;
|
|
634
|
+
interface DiagramNode extends ComputedNode {
|
|
635
|
+
width: number;
|
|
636
|
+
height: number;
|
|
637
|
+
position: Point;
|
|
638
|
+
labelBBox: BBox;
|
|
639
|
+
}
|
|
640
|
+
declare namespace DiagramNode {
|
|
641
|
+
function modelRef(node: DiagramNode): Fqn | null;
|
|
642
|
+
function deploymentRef(node: DiagramNode): Fqn | null;
|
|
643
|
+
/**
|
|
644
|
+
* Nodes group is a special kind of node, exisiting only in view
|
|
645
|
+
*/
|
|
646
|
+
function isNodesGroup(node: DiagramNode): boolean;
|
|
647
|
+
}
|
|
648
|
+
interface DiagramEdge extends ComputedEdge {
|
|
649
|
+
points: NonEmptyArray<Point>;
|
|
650
|
+
controlPoints?: NonEmptyArray<XYPoint>;
|
|
651
|
+
labelBBox?: BBox | null;
|
|
652
|
+
dotpos?: string;
|
|
653
|
+
}
|
|
654
|
+
interface DiagramView<ViewIDs extends string = string, Tags extends string = string> extends Omit<ComputedView<ViewIDs, Tags>, 'nodes' | 'edges' | 'manualLayout'> {
|
|
655
|
+
readonly nodes: DiagramNode[];
|
|
656
|
+
readonly edges: DiagramEdge[];
|
|
657
|
+
readonly bounds: BBox;
|
|
658
|
+
/**
|
|
659
|
+
* If diagram has manual layout
|
|
660
|
+
* But was changed and layout should be recalculated
|
|
661
|
+
*/
|
|
662
|
+
hasLayoutDrift?: boolean;
|
|
663
|
+
manualLayout?: never;
|
|
664
|
+
}
|
|
665
|
+
type ViewManualLayout = {
|
|
666
|
+
readonly hash: string;
|
|
667
|
+
readonly x: number;
|
|
668
|
+
readonly y: number;
|
|
669
|
+
readonly width: number;
|
|
670
|
+
readonly height: number;
|
|
671
|
+
readonly autoLayout: ViewAutoLayout;
|
|
672
|
+
readonly nodes: Record<string, {
|
|
673
|
+
isCompound: boolean;
|
|
674
|
+
x: number;
|
|
675
|
+
y: number;
|
|
676
|
+
width: number;
|
|
677
|
+
height: number;
|
|
678
|
+
}>;
|
|
679
|
+
readonly edges: Record<string, {
|
|
680
|
+
dotpos?: string;
|
|
681
|
+
points: NonEmptyArray<Point>;
|
|
682
|
+
controlPoints?: NonEmptyArray<XYPoint>;
|
|
683
|
+
labelBBox?: BBox;
|
|
684
|
+
}>;
|
|
685
|
+
};
|
|
686
|
+
|
|
687
|
+
type RelationId = Tagged<string, 'RelationID'>;
|
|
688
|
+
type RelationshipKind<Kinds extends string = string> = Tagged<Kinds, 'RelationshipKind'>;
|
|
689
|
+
type RelationshipLineType = 'dashed' | 'solid' | 'dotted';
|
|
690
|
+
type RelationshipArrowType = 'none' | 'normal' | 'onormal' | 'dot' | 'odot' | 'diamond' | 'odiamond' | 'crow' | 'open' | 'vee';
|
|
691
|
+
declare const DefaultLineStyle: RelationshipLineType;
|
|
692
|
+
declare const DefaultArrowType: RelationshipArrowType;
|
|
693
|
+
declare const DefaultRelationshipColor: ThemeColor;
|
|
694
|
+
interface AbstractRelation {
|
|
695
|
+
readonly id: RelationId;
|
|
696
|
+
readonly title?: string;
|
|
697
|
+
readonly description?: string;
|
|
698
|
+
readonly technology?: string;
|
|
699
|
+
readonly tags?: NonEmptyArray<Tag> | null;
|
|
700
|
+
readonly kind?: RelationshipKind;
|
|
701
|
+
readonly color?: Color;
|
|
702
|
+
readonly line?: RelationshipLineType;
|
|
703
|
+
readonly head?: RelationshipArrowType;
|
|
704
|
+
readonly tail?: RelationshipArrowType;
|
|
705
|
+
readonly links?: NonEmptyArray<Link> | null;
|
|
706
|
+
readonly navigateTo?: ViewId;
|
|
707
|
+
readonly metadata?: {
|
|
708
|
+
[key: string]: string;
|
|
709
|
+
};
|
|
710
|
+
}
|
|
711
|
+
interface ModelRelation extends AbstractRelation {
|
|
712
|
+
readonly source: Fqn;
|
|
713
|
+
readonly target: Fqn;
|
|
714
|
+
readonly title: string;
|
|
715
|
+
}
|
|
716
|
+
interface RelationshipKindSpecification {
|
|
717
|
+
readonly technology?: string;
|
|
718
|
+
readonly notation?: string;
|
|
719
|
+
readonly color?: Color;
|
|
720
|
+
readonly line?: RelationshipLineType;
|
|
721
|
+
readonly head?: RelationshipArrowType;
|
|
722
|
+
readonly tail?: RelationshipArrowType;
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
type DeploymentNodeKind<Kinds extends string = string> = Tagged<Kinds, 'DeploymentNodeKind'>;
|
|
726
|
+
type DeploymentElementStyle = ElementStyle & {
|
|
727
|
+
readonly icon?: IconUrl;
|
|
728
|
+
readonly shape?: ElementShape;
|
|
729
|
+
readonly color?: Color;
|
|
730
|
+
};
|
|
731
|
+
interface DeploymentNodeKindSpecification {
|
|
732
|
+
readonly technology?: string;
|
|
733
|
+
readonly notation?: string;
|
|
734
|
+
readonly style: DeploymentElementStyle;
|
|
735
|
+
}
|
|
736
|
+
interface DeploymentNode {
|
|
737
|
+
readonly id: Fqn;
|
|
738
|
+
readonly kind: DeploymentNodeKind;
|
|
739
|
+
readonly title: string;
|
|
740
|
+
readonly description?: string | null;
|
|
741
|
+
readonly technology?: string | null;
|
|
742
|
+
readonly tags?: NonEmptyArray<Tag> | null;
|
|
743
|
+
readonly links?: NonEmptyArray<Link> | null;
|
|
744
|
+
readonly style?: DeploymentElementStyle;
|
|
745
|
+
readonly notation?: string;
|
|
746
|
+
readonly metadata?: Record<string, string>;
|
|
747
|
+
}
|
|
748
|
+
interface DeployedInstance {
|
|
749
|
+
/**
|
|
750
|
+
* Format: `<DeploymentNode Fqn>.<Instance Id>`
|
|
751
|
+
* i.e parent fqn is deployment target
|
|
752
|
+
*/
|
|
753
|
+
readonly id: Fqn;
|
|
754
|
+
readonly element: Fqn;
|
|
755
|
+
readonly title?: string;
|
|
756
|
+
readonly description?: string | null;
|
|
757
|
+
readonly technology?: string | null;
|
|
758
|
+
readonly kind?: string | null;
|
|
759
|
+
readonly tags?: NonEmptyArray<Tag> | null;
|
|
760
|
+
readonly links?: NonEmptyArray<Link> | null;
|
|
761
|
+
readonly style?: DeploymentElementStyle;
|
|
762
|
+
readonly notation?: string;
|
|
763
|
+
readonly metadata?: Record<string, string>;
|
|
764
|
+
}
|
|
765
|
+
type DeploymentElement = Simplify<MergeExclusive<DeploymentNode, DeployedInstance>>;
|
|
766
|
+
declare namespace DeploymentElement {
|
|
767
|
+
const isDeploymentNode: (el: DeploymentElement) => el is DeploymentNode;
|
|
768
|
+
const isInstance: (el: DeploymentElement) => el is DeployedInstance;
|
|
769
|
+
}
|
|
770
|
+
type PredicateSelector = 'children' | 'expanded' | 'descendants';
|
|
771
|
+
interface DeploymentRef {
|
|
772
|
+
readonly id: Fqn;
|
|
773
|
+
readonly element?: Fqn;
|
|
774
|
+
}
|
|
775
|
+
/**
|
|
776
|
+
* NOTE:
|
|
777
|
+
*/
|
|
778
|
+
interface DeploymentRelation extends AbstractRelation {
|
|
779
|
+
readonly id: RelationId;
|
|
780
|
+
readonly source: DeploymentRef;
|
|
781
|
+
readonly target: DeploymentRef;
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
/**
|
|
785
|
+
* Represents a LikeC4 model with customizable type parameters,
|
|
786
|
+
* parsed from DSL or result from Builder
|
|
787
|
+
*
|
|
788
|
+
* !IMPORTANT: This is a low-level type, use `LikeC4Model` instead.
|
|
789
|
+
* !NOTE: Views are not computed yet.
|
|
790
|
+
*
|
|
791
|
+
* @typeParam ElementKinds - Types of elements in the model (defaults to string)
|
|
792
|
+
* @typeParam RelationKinds - Types of relationships (defaults to string)
|
|
793
|
+
* @typeParam Tags - Types of tags that can be applied (defaults to string)
|
|
794
|
+
* @typeParam Fqns - Fully Qualified Names for elements (defaults to string)
|
|
795
|
+
* @typeParam Views - Types of views in the model (defaults to string)
|
|
796
|
+
* @typeParam DeploymentFqns - Fully Qualified Names for deployment nodes (defaults to string)
|
|
797
|
+
*/
|
|
798
|
+
interface ParsedLikeC4Model<ElementKinds extends string = string, RelationKinds extends string = string, Tags extends string = string, Fqns extends string = string, Views extends string = string, DeploymentFqns extends string = string> {
|
|
799
|
+
__?: never;
|
|
800
|
+
specification: {
|
|
801
|
+
tags: Tag<Tags>[];
|
|
802
|
+
elements: Record<ElementKinds, ElementKindSpecification>;
|
|
803
|
+
deployments: Record<DeploymentNodeKind, DeploymentNodeKindSpecification>;
|
|
804
|
+
relationships: Record<RelationKinds, RelationshipKindSpecification>;
|
|
805
|
+
};
|
|
806
|
+
elements: Record<Fqns, TypedElement<Fqns, ElementKinds, Tags>>;
|
|
807
|
+
relations: Record<RelationId, ModelRelation>;
|
|
808
|
+
globals: ModelGlobals;
|
|
809
|
+
views: Record<Views, LikeC4View<Views, Tags>>;
|
|
810
|
+
/**
|
|
811
|
+
* Deployment Model.
|
|
812
|
+
*/
|
|
813
|
+
deployments: {
|
|
814
|
+
elements: Record<DeploymentFqns, DeploymentElement>;
|
|
815
|
+
relations: Record<RelationId, DeploymentRelation>;
|
|
816
|
+
};
|
|
817
|
+
}
|
|
818
|
+
type AnyParsedLikeC4Model = ParsedLikeC4Model<any, any, any, any, any, any>;
|
|
819
|
+
/**
|
|
820
|
+
* Hook to get types from dump
|
|
821
|
+
*/
|
|
822
|
+
type LikeC4ModelDump = {
|
|
823
|
+
elements: {
|
|
824
|
+
[kind: string]: object;
|
|
825
|
+
};
|
|
826
|
+
deployments: {
|
|
827
|
+
elements: {
|
|
828
|
+
[kind: string]: object;
|
|
829
|
+
};
|
|
830
|
+
};
|
|
831
|
+
views: {
|
|
832
|
+
[kind: string]: object;
|
|
833
|
+
};
|
|
834
|
+
};
|
|
835
|
+
/**
|
|
836
|
+
* Same as {@link ParsedLikeC4Model}, but with computed views or layouted views.
|
|
837
|
+
*/
|
|
838
|
+
interface GenericLikeC4Model<Fqns extends string = string, DeploymentFqns extends string = string, Views extends string = string, Tags extends string = string, T = 'computed' | 'layouted'> extends Omit<ParsedLikeC4Model<string, string, Tags, Fqns, Views, DeploymentFqns>, 'views' | '__'> {
|
|
839
|
+
__?: T;
|
|
840
|
+
views: Record<Views, ComputedView<Views> | DiagramView<Views>>;
|
|
841
|
+
}
|
|
842
|
+
interface ComputedLikeC4Model<Fqns extends string = string, DeploymentFqns extends string = string, Views extends string = string, Tags extends string = string> extends Omit<GenericLikeC4Model<Fqns, DeploymentFqns, Views, Tags, 'computed'>, 'views'> {
|
|
843
|
+
views: Record<Views, ComputedView<Views>>;
|
|
844
|
+
}
|
|
845
|
+
interface LayoutedLikeC4Model<Fqns extends string = string, DeploymentFqns extends string = string, Views extends string = string, Tags extends string = string> extends Omit<GenericLikeC4Model<Fqns, DeploymentFqns, Views, Tags, 'layouted'>, 'views'> {
|
|
846
|
+
__: 'layouted';
|
|
847
|
+
views: Record<Views, DiagramView<Views, Tags>>;
|
|
848
|
+
}
|
|
849
|
+
|
|
850
|
+
export { type GlobalDynamicPredicates as $, type CustomElementExpr as A, type CustomRelationExpr as B, ComputedView as C, DeploymentElement as D, type DirectRelationExpr as E, type ElementExpression as F, type ElementKindExpr as G, type ElementPredicateExpression as H, type ElementRefExpr as I, type ElementTagExpr as J, type ElementWhereExpr as K, type LikeC4View as L, type ExpandedElementExpr as M, type Expression as N, type IncomingExpr as O, type PredicateSelector as P, type InOutExpr as Q, type NonWilcard as R, type OutgoingExpr as S, type RelationExpression as T, type RelationPredicateExpression as U, type RelationWhereExpr as V, type WildcardExpr as W, ExpressionV2 as X, FqnExpr as Y, FqnRef as Z, RelationExpr as _, type ComputedLikeC4Model as a, type CustomColorDefinitions as a$, type GlobalPredicateId as a0, type GlobalPredicates as a1, type GlobalStyleID as a2, type GlobalStyles as a3, type ModelGlobals as a4, type AnyParsedLikeC4Model as a5, type GenericLikeC4Model as a6, type LayoutedLikeC4Model as a7, type LikeC4ModelDump as a8, type ParsedLikeC4Model as a9, DiagramNode as aA, extractStep as aB, getBBoxCenter as aC, getParallelStepsPrefix as aD, isAutoLayoutDirection as aE, isDeploymentView as aF, isDynamicView as aG, isDynamicViewParallelSteps as aH, isElementView as aI, isExtendsElementView as aJ, isScopedElementView as aK, isStepEdgeId as aL, isViewRuleAutoLayout as aM, isViewRuleGlobalPredicateRef as aN, isViewRuleGlobalStyle as aO, isViewRuleGroup as aP, isViewRulePredicate as aQ, isViewRuleStyle as aR, stepEdgeId as aS, type AutoLayoutDirection as aT, type BasicElementView as aU, type BasicView as aV, type BBox as aW, type ComputedDeploymentView as aX, type ComputedDynamicView as aY, type ComputedEdge as aZ, type ComputedElementView as a_, isAndOperator as aa, isKindEqual as ab, isNotOperator as ac, isOrOperator as ad, isTagEqual as ae, whereOperatorAsPredicate as af, type AndOperator as ag, type EqualOperator as ah, type Filterable as ai, type KindEqual as aj, type NotOperator as ak, type OperatorPredicate as al, type OrOperator as am, type TagEqual as an, type WhereOperator as ao, DefaultArrowType as ap, DefaultLineStyle as aq, DefaultRelationshipColor as ar, type AbstractRelation as as, type ModelRelation as at, type RelationId as au, type RelationshipArrowType as av, type RelationshipKind as aw, type RelationshipKindSpecification as ax, type RelationshipLineType as ay, ComputedNode as az, type DeployedInstance as b, type DeploymentView as b0, type DeploymentViewRule as b1, type DeploymentViewRulePredicate as b2, type DeploymentViewRuleStyle as b3, type DiagramEdge as b4, type DiagramView as b5, type DynamicView as b6, type DynamicViewIncludeRule as b7, type DynamicViewParallelSteps as b8, type DynamicViewRule as b9, type DynamicViewStep as ba, type DynamicViewStepOrParallel as bb, type EdgeId as bc, type ElementView as bd, type ExtendsElementView as be, type NodeId as bf, type ScopedElementView as bg, type StepEdgeId as bh, type StepEdgeIdLiteral as bi, type ViewAutoLayout as bj, type ViewId as bk, type ViewManualLayout as bl, type ViewRule as bm, type ViewRuleAutoLayout as bn, type ViewRuleGlobalPredicateRef as bo, type ViewRuleGlobalStyle as bp, type ViewRuleGroup as bq, type ViewRulePredicate as br, type ViewRuleStyle as bs, type ViewRuleStyleOrGlobalRef as bt, type ViewWithHash as bu, type ViewWithNotation as bv, type ElementNotation as bw, type Participant as bx, type DeploymentElementStyle as c, type DeploymentNode as d, expression as e, type DeploymentNodeKind as f, type DeploymentNodeKindSpecification as g, type DeploymentRef as h, type DeploymentRelation as i, isCustomElement as j, isCustomRelationExpr as k, isElement as l, isElementKindExpr as m, isElementPredicateExpr as n, isElementRef as o, isElementTagExpr as p, isElementWhere as q, isExpandedElementExpr as r, isIncoming as s, isInOut as t, isOutgoing as u, isRelation as v, isRelationExpression as w, isRelationPredicateExpr as x, isRelationWhere as y, isWildcard as z };
|