@likec4/core 1.27.3 → 1.28.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/builder/index.d.mts +6 -6
- package/dist/builder/index.mjs +23 -13
- package/dist/compute-view/index.d.mts +3 -3
- package/dist/compute-view/index.mjs +3 -3
- package/dist/compute-view/relationships-view/index.d.mts +3 -3
- package/dist/index.d.mts +6 -6
- package/dist/index.mjs +2 -2
- package/dist/model/index.d.mts +6 -6
- package/dist/model/index.mjs +1 -1
- package/dist/shared/{core.BpuZeqlX.d.mts → core.CZR9J1Qx.d.mts} +2 -2
- package/dist/shared/{core.Djro-kuQ.d.mts → core.CiFKryGW.d.mts} +7 -2
- package/dist/shared/{core.HKn0jlo_.d.mts → core.D2830qgg.d.mts} +1 -1
- package/dist/shared/{core.CFDwncxs.d.mts → core.DJvmfnEi.d.mts} +481 -186
- package/dist/shared/{core.BMep80lJ.mjs → core.DgfwjBtu.mjs} +198 -87
- package/dist/shared/core.SjLhMA7a.d.mts +62 -0
- package/dist/shared/{core.RjpTh3vE.mjs → core.w6BcP9z5.mjs} +263 -168
- package/dist/types/index.d.mts +4 -4
- package/dist/types/index.mjs +1 -1
- package/dist/utils/index.d.mts +2 -2
- package/package.json +7 -7
- package/src/builder/Builder.ts +1 -0
- package/src/builder/Builder.view-common.ts +10 -10
- package/src/builder/Builder.view-element.ts +26 -14
- package/src/builder/__snapshots__/Builder-style1.spec.ts.snap +23 -8
- package/src/builder/__snapshots__/Builder-style2.spec.ts.snap +9 -4
- package/src/compute-view/deployment-view/predicates/deploymentRefs-where.ts +18 -0
- package/src/compute-view/deployment-view/predicates/relation-direct.ts +6 -0
- package/src/compute-view/deployment-view/predicates/relation-in-out.ts +3 -0
- package/src/compute-view/deployment-view/predicates/relation-incoming.ts +3 -0
- package/src/compute-view/deployment-view/predicates/relation-outgoing.ts +3 -0
- package/src/compute-view/deployment-view/predicates/utils.ts +10 -3
- package/src/compute-view/deployment-view/utils.ts +7 -4
- package/src/compute-view/element-view/__test__/fixture.ts +72 -65
- package/src/compute-view/element-view/_types.ts +13 -9
- package/src/compute-view/element-view/compute.ts +27 -27
- package/src/compute-view/element-view/memory/NodeGroup.ts +4 -3
- package/src/compute-view/element-view/memory/memory.ts +3 -2
- package/src/compute-view/element-view/memory/stage-include.ts +2 -2
- package/src/compute-view/element-view/predicates/_utils.ts +25 -24
- package/src/compute-view/element-view/predicates/element-expand.ts +7 -10
- package/src/compute-view/element-view/predicates/element-kind-tag.ts +5 -3
- package/src/compute-view/element-view/predicates/element-ref.ts +7 -19
- package/src/compute-view/element-view/predicates/relation-direct.ts +15 -13
- package/src/compute-view/element-view/predicates/relation-in-out.ts +5 -6
- package/src/compute-view/element-view/predicates/relation-in.ts +36 -32
- package/src/compute-view/element-view/predicates/relation-out.ts +37 -33
- package/src/compute-view/element-view/predicates/wildcard.ts +2 -2
- package/src/compute-view/utils/applyCustomElementProperties.ts +9 -4
- package/src/compute-view/utils/applyCustomRelationProperties.ts +10 -7
- package/src/compute-view/utils/elementExpressionToPredicate.ts +27 -26
- package/src/compute-view/utils/link-nodes-with-edges.ts +1 -1
- package/src/compute-view/utils/relationExpressionToPredicates.ts +10 -17
- package/src/compute-view/utils/uniqueTags.ts +3 -3
- package/src/index.ts +0 -2
- package/src/model/ElementModel.ts +25 -6
- package/src/model/LikeC4Model.ts +47 -6
- package/src/model/RelationModel.ts +4 -2
- package/src/model/view/LikeC4ViewModel.ts +3 -2
- package/src/types/_common.ts +0 -4
- package/src/types/deployments.ts +3 -2
- package/src/types/element.ts +2 -10
- package/src/types/expression-v2-model.ts +314 -0
- package/src/types/expression-v2.ts +238 -30
- package/src/types/index.ts +15 -46
- package/src/types/model-data.ts +4 -1
- package/src/types/relation.ts +2 -1
- package/src/types/scalars.ts +39 -0
- package/src/types/view-changes.ts +2 -1
- package/src/types/view.ts +7 -8
- package/dist/shared/core.30yYKXcZ.d.mts +0 -186
- package/src/types/expression.ts +0 -207
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
import { LiteralUnion, Tagged, Simplify, UnionToIntersection, TupleToUnion } from 'type-fest';
|
|
2
|
-
|
|
3
|
-
declare const ThemeColors: readonly ["amber", "blue", "gray", "slate", "green", "indigo", "muted", "primary", "red", "secondary", "sky"];
|
|
4
|
-
type ThemeColor = typeof ThemeColors[number];
|
|
5
|
-
type HexColorLiteral = `#${string}`;
|
|
6
|
-
type ColorLiteral = HexColorLiteral;
|
|
7
|
-
type Color = LiteralUnion<ThemeColor, string>;
|
|
8
|
-
type ShapeSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
9
|
-
/**
|
|
10
|
-
* For padding, margin, etc.
|
|
11
|
-
*/
|
|
12
|
-
type SpacingSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
13
|
-
type TextSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
14
|
-
declare function isThemeColor(color: Color): color is ThemeColor;
|
|
15
|
-
interface ElementThemeColorValues {
|
|
16
|
-
fill: ColorLiteral;
|
|
17
|
-
stroke: ColorLiteral;
|
|
18
|
-
hiContrast: ColorLiteral;
|
|
19
|
-
loContrast: ColorLiteral;
|
|
20
|
-
}
|
|
21
|
-
type ElementThemeColors = {
|
|
22
|
-
[key in ThemeColor]: ElementThemeColorValues;
|
|
23
|
-
};
|
|
24
|
-
interface RelationshipThemeColorValues {
|
|
25
|
-
lineColor: ColorLiteral;
|
|
26
|
-
labelBgColor: ColorLiteral;
|
|
27
|
-
labelColor: ColorLiteral;
|
|
28
|
-
}
|
|
29
|
-
interface ThemeColorValues {
|
|
30
|
-
elements: ElementThemeColorValues;
|
|
31
|
-
relationships: RelationshipThemeColorValues;
|
|
32
|
-
}
|
|
33
|
-
type RelationshipThemeColors = {
|
|
34
|
-
[key in ThemeColor]: RelationshipThemeColorValues;
|
|
35
|
-
};
|
|
36
|
-
interface LikeC4Theme {
|
|
37
|
-
font: 'Arial';
|
|
38
|
-
shadow: ColorLiteral;
|
|
39
|
-
relationships: RelationshipThemeColors;
|
|
40
|
-
elements: ElementThemeColors;
|
|
41
|
-
sizes: {
|
|
42
|
-
[key in ShapeSize]: {
|
|
43
|
-
width: number;
|
|
44
|
-
height: number;
|
|
45
|
-
};
|
|
46
|
-
};
|
|
47
|
-
spacing: {
|
|
48
|
-
[key in SpacingSize]: number;
|
|
49
|
-
};
|
|
50
|
-
textSizes: {
|
|
51
|
-
[key in TextSize]: number;
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
type ProjectId = Tagged<string, 'ProjectID'>;
|
|
56
|
-
type NonEmptyArray<T> = [T, ...T[]];
|
|
57
|
-
type NonEmptyReadonlyArray<T> = readonly [T, ...T[]];
|
|
58
|
-
type IconUrl = Tagged<string, 'IconUrl'> | 'none';
|
|
59
|
-
type CustomColor = string;
|
|
60
|
-
type Point = readonly [x: number, y: number];
|
|
61
|
-
interface XYPoint {
|
|
62
|
-
x: number;
|
|
63
|
-
y: number;
|
|
64
|
-
}
|
|
65
|
-
type KeysOf<T> = keyof T extends infer K extends string ? K : never;
|
|
66
|
-
type AllNever<Expressions> = UnionToIntersection<{
|
|
67
|
-
[Name in keyof Expressions]: {
|
|
68
|
-
-readonly [Key in keyof Expressions[Name]]?: never;
|
|
69
|
-
};
|
|
70
|
-
}[keyof Expressions]>;
|
|
71
|
-
/**
|
|
72
|
-
* @example
|
|
73
|
-
* type Variant1 = {
|
|
74
|
-
* a: string
|
|
75
|
-
* }
|
|
76
|
-
* type Variant2 = {
|
|
77
|
-
* b: number
|
|
78
|
-
* }
|
|
79
|
-
*
|
|
80
|
-
* type Variants = ExclusiveUnion<{
|
|
81
|
-
* Variant1: Variant1,
|
|
82
|
-
* Variant2: Variant2
|
|
83
|
-
* }>
|
|
84
|
-
*
|
|
85
|
-
* Fail here
|
|
86
|
-
* const variant1: Variants = {
|
|
87
|
-
* a: 'one',
|
|
88
|
-
* b: 1
|
|
89
|
-
* }
|
|
90
|
-
*/
|
|
91
|
-
type ExclusiveUnion<Expressions> = Expressions extends object ? {
|
|
92
|
-
[Name in keyof Expressions]: Simplify<Omit<AllNever<Expressions>, keyof Expressions[Name]> & Expressions[Name]>;
|
|
93
|
-
}[keyof Expressions] : Expressions;
|
|
94
|
-
/**
|
|
95
|
-
* Copy from https://github.com/remeda/remeda/blob/main/src/internal/types/NTuple.ts
|
|
96
|
-
* An array with *exactly* N elements in it.
|
|
97
|
-
*
|
|
98
|
-
* Only literal N values are supported. For very large N the type might result
|
|
99
|
-
* in a recurse depth error. For negative N the type would result in an infinite
|
|
100
|
-
* recursion. None of these have protections because this is an internal type!
|
|
101
|
-
*/
|
|
102
|
-
type NTuple<T, N extends number, Result extends Array<unknown> = []> = Result['length'] extends N ? Result : NTuple<T, N, [...Result, T]>;
|
|
103
|
-
type IteratorLike<T> = IteratorObject<T, BuiltinIteratorReturn>;
|
|
104
|
-
type Predicate<T> = (x: T) => boolean;
|
|
105
|
-
|
|
106
|
-
type Fqn<Id extends string = string> = Tagged<Id, 'Fqn'>;
|
|
107
|
-
declare function AsFqn(name: string, parent?: Fqn | null): Fqn;
|
|
108
|
-
declare const BorderStyles: readonly ["solid", "dashed", "dotted", "none"];
|
|
109
|
-
type BorderStyle = TupleToUnion<typeof BorderStyles>;
|
|
110
|
-
type ElementKind<Kinds extends string = string> = Tagged<Kinds, 'ElementKind'>;
|
|
111
|
-
declare namespace ElementKind {
|
|
112
|
-
const Group: ElementKind;
|
|
113
|
-
}
|
|
114
|
-
declare const ElementShapes: readonly ["rectangle", "person", "browser", "mobile", "cylinder", "storage", "queue"];
|
|
115
|
-
type ElementShape = TupleToUnion<typeof ElementShapes>;
|
|
116
|
-
declare const DefaultThemeColor: ThemeColor;
|
|
117
|
-
declare const DefaultElementShape: ElementShape;
|
|
118
|
-
declare const DefaultShapeSize: ShapeSize;
|
|
119
|
-
declare const DefaultPaddingSize: SpacingSize;
|
|
120
|
-
declare const DefaultTextSize: TextSize;
|
|
121
|
-
interface ElementStyle {
|
|
122
|
-
readonly border?: BorderStyle;
|
|
123
|
-
/**
|
|
124
|
-
* In percentage 0-100, 0 is fully transparent
|
|
125
|
-
*
|
|
126
|
-
* @default 100
|
|
127
|
-
*/
|
|
128
|
-
readonly opacity?: number;
|
|
129
|
-
/**
|
|
130
|
-
* If true, the element is rendered as multiple shapes
|
|
131
|
-
* @default false
|
|
132
|
-
*/
|
|
133
|
-
readonly multiple?: boolean;
|
|
134
|
-
/**
|
|
135
|
-
* Shape size
|
|
136
|
-
*
|
|
137
|
-
* @default 'md'
|
|
138
|
-
*/
|
|
139
|
-
readonly size?: ShapeSize;
|
|
140
|
-
readonly padding?: SpacingSize;
|
|
141
|
-
readonly textSize?: TextSize;
|
|
142
|
-
}
|
|
143
|
-
type Tag<Tags extends string = string> = Tagged<Tags, 'Tag'>;
|
|
144
|
-
interface TagSpec {
|
|
145
|
-
readonly id: Tag;
|
|
146
|
-
readonly style: ElementStyle;
|
|
147
|
-
}
|
|
148
|
-
interface Link {
|
|
149
|
-
readonly title?: string;
|
|
150
|
-
readonly url: string;
|
|
151
|
-
readonly relative?: string;
|
|
152
|
-
}
|
|
153
|
-
interface TypedElement<Ids extends string, Kinds extends string, Tags extends string, MetadataKeys extends string = never> {
|
|
154
|
-
readonly id: Fqn<Ids>;
|
|
155
|
-
readonly kind: ElementKind<Kinds>;
|
|
156
|
-
readonly title: string;
|
|
157
|
-
readonly description: string | null;
|
|
158
|
-
readonly technology: string | null;
|
|
159
|
-
readonly tags: NonEmptyArray<Tag<Tags>> | null;
|
|
160
|
-
readonly links: NonEmptyArray<Link> | null;
|
|
161
|
-
readonly icon?: IconUrl;
|
|
162
|
-
readonly shape?: ElementShape;
|
|
163
|
-
readonly color?: Color;
|
|
164
|
-
readonly style?: ElementStyle;
|
|
165
|
-
readonly notation?: string;
|
|
166
|
-
readonly metadata?: Record<MetadataKeys, string>;
|
|
167
|
-
}
|
|
168
|
-
interface Element extends TypedElement<string, string, string, string> {
|
|
169
|
-
}
|
|
170
|
-
interface ElementKindSpecificationStyle {
|
|
171
|
-
shape?: ElementShape;
|
|
172
|
-
icon?: IconUrl;
|
|
173
|
-
color?: Color;
|
|
174
|
-
border?: BorderStyle;
|
|
175
|
-
opacity?: number;
|
|
176
|
-
size?: ShapeSize;
|
|
177
|
-
padding?: SpacingSize;
|
|
178
|
-
textSize?: TextSize;
|
|
179
|
-
}
|
|
180
|
-
interface ElementKindSpecification {
|
|
181
|
-
readonly technology?: string;
|
|
182
|
-
readonly notation?: string;
|
|
183
|
-
readonly style: ElementKindSpecificationStyle;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
export { AsFqn as A, BorderStyles as B, type CustomColor as C, DefaultElementShape as D, type ExclusiveUnion as E, type Fqn as F, type ElementThemeColorValues as G, type HexColorLiteral as H, type IconUrl as I, type RelationshipThemeColorValues as J, type KeysOf as K, type LikeC4Theme as L, type SpacingSize as M, type NonEmptyArray as N, type TextSize as O, type Point as P, type ThemeColor as Q, type RelationshipThemeColors as R, type ShapeSize as S, type ThemeColorValues as T, type XYPoint as X, type IteratorLike as a, type NonEmptyReadonlyArray as b, type NTuple as c, type Predicate as d, type ProjectId as e, DefaultPaddingSize as f, DefaultShapeSize as g, DefaultTextSize as h, DefaultThemeColor as i, ElementKind as j, ElementShapes as k, type BorderStyle as l, type Element as m, type ElementKindSpecification as n, type ElementKindSpecificationStyle as o, type ElementShape as p, type ElementStyle as q, type Link as r, type Tag as s, type TagSpec as t, type TypedElement as u, isThemeColor as v, ThemeColors as w, type Color as x, type ColorLiteral as y, type ElementThemeColors as z };
|
package/src/types/expression.ts
DELETED
|
@@ -1,207 +0,0 @@
|
|
|
1
|
-
import type { IconUrl } from './_common'
|
|
2
|
-
import type { BorderStyle, ElementKind, ElementShape, Fqn, Tag } from './element'
|
|
3
|
-
import type { WhereOperator } from './operators'
|
|
4
|
-
import type { RelationshipArrowType, RelationshipLineType } from './relation'
|
|
5
|
-
import type { Color, ShapeSize } from './theme'
|
|
6
|
-
import type { ViewId } from './view'
|
|
7
|
-
|
|
8
|
-
interface BaseExpr {
|
|
9
|
-
where?: never
|
|
10
|
-
element?: never
|
|
11
|
-
custom?: never
|
|
12
|
-
expanded?: never
|
|
13
|
-
elementKind?: never
|
|
14
|
-
elementTag?: never
|
|
15
|
-
isEqual?: never
|
|
16
|
-
isChildren?: never
|
|
17
|
-
isDescendants?: never
|
|
18
|
-
wildcard?: never
|
|
19
|
-
source?: never
|
|
20
|
-
target?: never
|
|
21
|
-
inout?: never
|
|
22
|
-
incoming?: never
|
|
23
|
-
outgoing?: never
|
|
24
|
-
customRelation?: never
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export interface ElementRefExpr extends Omit<BaseExpr, 'element' | 'isChildren' | 'isDescendants'> {
|
|
28
|
-
element: Fqn
|
|
29
|
-
isChildren?: boolean
|
|
30
|
-
isDescendants?: boolean
|
|
31
|
-
}
|
|
32
|
-
export function isElementRef(expr: Expression): expr is ElementRefExpr {
|
|
33
|
-
return 'element' in expr
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export interface ExpandedElementExpr extends Omit<BaseExpr, 'expanded'> {
|
|
37
|
-
expanded: Fqn
|
|
38
|
-
}
|
|
39
|
-
export function isExpandedElementExpr(expr: Expression): expr is ExpandedElementExpr {
|
|
40
|
-
return 'expanded' in expr
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export interface CustomElementExpr extends Omit<BaseExpr, 'custom'> {
|
|
44
|
-
custom: {
|
|
45
|
-
expr: ElementExpression | ElementWhereExpr
|
|
46
|
-
title?: string
|
|
47
|
-
description?: string
|
|
48
|
-
technology?: string
|
|
49
|
-
notation?: string
|
|
50
|
-
shape?: ElementShape
|
|
51
|
-
color?: Color
|
|
52
|
-
icon?: IconUrl
|
|
53
|
-
border?: BorderStyle
|
|
54
|
-
opacity?: number
|
|
55
|
-
navigateTo?: ViewId
|
|
56
|
-
multiple?: boolean
|
|
57
|
-
size?: ShapeSize
|
|
58
|
-
padding?: ShapeSize
|
|
59
|
-
textSize?: ShapeSize
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export function isCustomElement(expr: Expression): expr is CustomElementExpr {
|
|
64
|
-
return 'custom' in expr && (isElement(expr.custom.expr) || isElementWhere(expr.custom.expr))
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
export interface WildcardExpr extends Omit<BaseExpr, 'wildcard'> {
|
|
68
|
-
wildcard: true
|
|
69
|
-
}
|
|
70
|
-
export function isWildcard(expr: Expression): expr is WildcardExpr {
|
|
71
|
-
return 'wildcard' in expr
|
|
72
|
-
}
|
|
73
|
-
export interface ElementKindExpr extends Omit<BaseExpr, 'elementKind' | 'isEqual'> {
|
|
74
|
-
elementKind: ElementKind
|
|
75
|
-
isEqual: boolean
|
|
76
|
-
}
|
|
77
|
-
export function isElementKindExpr(expr: Expression): expr is ElementKindExpr {
|
|
78
|
-
return 'elementKind' in expr && 'isEqual' in expr
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export interface ElementTagExpr extends Omit<BaseExpr, 'elementTag' | 'isEqual'> {
|
|
82
|
-
elementTag: Tag
|
|
83
|
-
isEqual: boolean
|
|
84
|
-
}
|
|
85
|
-
export function isElementTagExpr(expr: Expression): expr is ElementTagExpr {
|
|
86
|
-
return 'elementTag' in expr && 'isEqual' in expr
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
export type NonWilcard =
|
|
90
|
-
| ElementRefExpr
|
|
91
|
-
| ElementKindExpr
|
|
92
|
-
| ElementTagExpr
|
|
93
|
-
| ExpandedElementExpr
|
|
94
|
-
|
|
95
|
-
export type ElementExpression =
|
|
96
|
-
| NonWilcard
|
|
97
|
-
| WildcardExpr
|
|
98
|
-
|
|
99
|
-
export function isElement(expr: Expression): expr is ElementExpression {
|
|
100
|
-
return isElementRef(expr)
|
|
101
|
-
|| isWildcard(expr)
|
|
102
|
-
|| isElementKindExpr(expr)
|
|
103
|
-
|| isElementTagExpr(expr)
|
|
104
|
-
|| isExpandedElementExpr(expr)
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
export interface ElementWhereExpr extends Omit<BaseExpr, 'where'> {
|
|
108
|
-
where: {
|
|
109
|
-
expr: ElementExpression
|
|
110
|
-
condition: WhereOperator<string, string>
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
export function isElementWhere(expr: Expression): expr is ElementWhereExpr {
|
|
114
|
-
return 'where' in expr && isElement(expr.where.expr)
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
export type ElementPredicateExpression = ElementExpression | ElementWhereExpr | CustomElementExpr
|
|
118
|
-
export function isElementPredicateExpr(expr: Expression): expr is ElementPredicateExpression {
|
|
119
|
-
return isElement(expr) || isElementWhere(expr) || isCustomElement(expr)
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
export interface DirectRelationExpr extends Omit<BaseExpr, 'source' | 'target'> {
|
|
123
|
-
source: ElementExpression
|
|
124
|
-
target: ElementExpression
|
|
125
|
-
isBidirectional?: boolean
|
|
126
|
-
}
|
|
127
|
-
export function isRelation(expr: Expression): expr is DirectRelationExpr {
|
|
128
|
-
return 'source' in expr && 'target' in expr
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
export interface InOutExpr extends Omit<BaseExpr, 'inout'> {
|
|
132
|
-
inout: ElementExpression
|
|
133
|
-
}
|
|
134
|
-
export function isInOut(expr: Expression): expr is InOutExpr {
|
|
135
|
-
return 'inout' in expr
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
export interface IncomingExpr extends Omit<BaseExpr, 'incoming'> {
|
|
139
|
-
incoming: ElementExpression
|
|
140
|
-
}
|
|
141
|
-
export function isIncoming(expr: Expression): expr is IncomingExpr {
|
|
142
|
-
return 'incoming' in expr
|
|
143
|
-
}
|
|
144
|
-
export interface OutgoingExpr extends Omit<BaseExpr, 'outgoing'> {
|
|
145
|
-
outgoing: ElementExpression
|
|
146
|
-
}
|
|
147
|
-
export function isOutgoing(expr: Expression): expr is OutgoingExpr {
|
|
148
|
-
return 'outgoing' in expr
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
export type RelationExpression = DirectRelationExpr | InOutExpr | IncomingExpr | OutgoingExpr
|
|
152
|
-
|
|
153
|
-
export function isRelationExpression(expr: Expression): expr is RelationExpression {
|
|
154
|
-
return isRelation(expr) || isInOut(expr) || isIncoming(expr) || isOutgoing(expr)
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
export interface RelationWhereExpr extends Omit<BaseExpr, 'where'> {
|
|
158
|
-
where: {
|
|
159
|
-
expr: RelationExpression
|
|
160
|
-
condition: WhereOperator<string, string>
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
export function isRelationWhere(expr: Expression): expr is RelationWhereExpr {
|
|
164
|
-
return 'where' in expr && isRelationExpression(expr.where.expr)
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
export interface CustomRelationExpr extends Omit<BaseExpr, 'customRelation'> {
|
|
168
|
-
customRelation: {
|
|
169
|
-
relation: RelationExpression | RelationWhereExpr
|
|
170
|
-
title?: string
|
|
171
|
-
description?: string
|
|
172
|
-
technology?: string
|
|
173
|
-
notation?: string
|
|
174
|
-
// Link to dynamic view
|
|
175
|
-
navigateTo?: ViewId
|
|
176
|
-
// Notes for walkthrough
|
|
177
|
-
notes?: string
|
|
178
|
-
color?: Color
|
|
179
|
-
line?: RelationshipLineType
|
|
180
|
-
head?: RelationshipArrowType
|
|
181
|
-
tail?: RelationshipArrowType
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
export function isCustomRelationExpr(expr: Expression): expr is CustomRelationExpr {
|
|
185
|
-
return 'customRelation' in expr
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
export type RelationPredicateExpression = RelationExpression | RelationWhereExpr | CustomRelationExpr
|
|
189
|
-
|
|
190
|
-
export function isRelationPredicateExpr(expr: Expression): expr is RelationPredicateExpression {
|
|
191
|
-
return isRelationExpression(expr) || isRelationWhere(expr) || isCustomRelationExpr(expr)
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
export type Expression = ElementPredicateExpression | RelationPredicateExpression
|
|
195
|
-
|
|
196
|
-
// export const Expr = {
|
|
197
|
-
// isElementRef,
|
|
198
|
-
// isWildcard,
|
|
199
|
-
// isElementKindExpr,
|
|
200
|
-
// isElementTagExpr,
|
|
201
|
-
// isElement,
|
|
202
|
-
// isRelation,
|
|
203
|
-
// isInOut,
|
|
204
|
-
// isIncoming,
|
|
205
|
-
// isOutgoing,
|
|
206
|
-
// isAnyRelation,
|
|
207
|
-
// }
|