@likec4/core 1.40.0 → 1.42.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/builder/package.json +4 -0
- package/compute-view/package.json +4 -0
- package/compute-view/relationships/package.json +4 -0
- package/dist/builder/index.d.mts +83 -20
- package/dist/builder/index.mjs +210 -126
- package/dist/compute-view/index.d.mts +8 -7
- package/dist/compute-view/index.mjs +14 -11
- package/dist/compute-view/relationships-view/index.d.mts +9 -8
- package/dist/compute-view/relationships-view/index.mjs +6 -6
- package/dist/index.d.mts +7 -7
- package/dist/index.mjs +12 -12
- package/dist/model/connection/deployment/index.d.mts +11 -10
- package/dist/model/connection/deployment/index.mjs +2 -2
- package/dist/model/connection/index.d.mts +12 -11
- package/dist/model/connection/index.mjs +3 -3
- package/dist/model/connection/model/index.d.mts +11 -10
- package/dist/model/connection/model/index.mjs +2 -2
- package/dist/model/index.d.mts +14 -14
- package/dist/model/index.mjs +4 -5
- package/dist/shared/{core.DHQ32OHa.mjs → core.01VTr9qu.mjs} +10 -29
- package/dist/shared/core.1vX5a9AY.mjs +86 -0
- package/dist/shared/{core.BVNaR17u.mjs → core.B7KhhkRY.mjs} +1 -1
- package/dist/shared/core.B85MJLTf.mjs +5 -0
- package/dist/shared/{core.BIAlzwKc.mjs → core.BIqHjQiH.mjs} +85 -45
- package/dist/shared/core.BKlholso.mjs +3 -0
- package/dist/shared/core.BR4zXDH-.mjs +13 -0
- package/dist/shared/{core.yHe79zEl.mjs → core.BYNkXQ8A.mjs} +21 -12
- package/dist/shared/core.BazD6cot.mjs +14 -0
- package/dist/shared/{core.BuoXfSMj.mjs → core.BbE4y-yl.mjs} +1 -1
- package/dist/shared/core.BoYfZOBm.mjs +3 -0
- package/dist/shared/core.BsSXS-_R.mjs +7 -0
- package/dist/shared/{core.T-eLZTW_.mjs → core.BzTakU3I.mjs} +15 -7
- package/dist/shared/{core.4u1dVmfX.mjs → core.C2TiyjI6.mjs} +2 -2
- package/dist/shared/{core.DLpidoWc.mjs → core.C3JowhaZ.mjs} +3 -3
- package/dist/shared/{core.CNGyqkJh.mjs → core.C4x8aaWa.mjs} +3 -1
- package/dist/shared/{core.BB6zA-UU.mjs → core.C8YY6Uub.mjs} +38 -9
- package/dist/shared/{core.FPITT8Vx.mjs → core.C8sl5Y8Z.mjs} +144 -61
- package/dist/shared/{core.DuR3R-xJ.mjs → core.CNgZvKb8.mjs} +3 -5176
- package/dist/shared/{core.BbThmf6M.d.mts → core.CQngdcuj.d.mts} +85 -4
- package/dist/shared/{core.Be1n9a0i.mjs → core.C_Ni6yHl.mjs} +5 -4
- package/dist/shared/core.CbT8JVYL.mjs +5 -0
- package/dist/shared/core.CqAJJpK_.mjs +3 -0
- package/dist/shared/{core.CySf-2gP.d.mts → core.D0PjZzIS.d.mts} +52 -15
- package/dist/shared/{core.DrvfVXkh.d.mts → core.D5fzJWbF.d.mts} +11 -2
- package/dist/shared/{core.DrVOJuxX.d.mts → core.DACpKp35.d.mts} +5 -5
- package/dist/shared/core.DFi2dOTl.mjs +39548 -0
- package/dist/shared/{core.D704WZES.d.mts → core.DIol3syK.d.mts} +2 -2
- package/dist/shared/{core.DlG1xWt2.mjs → core.DMMOWQqc.mjs} +3 -2
- package/dist/shared/core.DNbUPnve.mjs +3990 -0
- package/dist/shared/{core.CCD1ID81.mjs → core.DRJma0Ol.mjs} +4 -3
- package/dist/shared/{core.DgttqsJc.mjs → core.DRhg-gVU.mjs} +9 -9
- package/dist/shared/core.DSO_rTC2.mjs +5322 -0
- package/dist/shared/{core.vWJTxpLV.d.mts → core.D_vkffV4.d.mts} +4 -2
- package/dist/shared/core.DdMJk7nx.d.mts +476 -0
- package/dist/shared/{core.D_fI5Lf6.d.mts → core.Dgs6-nuz.d.mts} +24 -4
- package/dist/shared/{core.Be4Jy9Qx.mjs → core.FZ305VYd.mjs} +2 -2
- package/dist/shared/core.OHD4KXm9.mjs +5 -0
- package/dist/shared/{core.GTgsmXS_.mjs → core.QJD_fcrc.mjs} +2 -2
- package/dist/shared/core.RfnaEmgA.mjs +7 -0
- package/dist/shared/core.fHR_8Tnq.d.mts +450 -0
- package/dist/shared/{core.D0EgVMQK.mjs → core.lRvxPoao.mjs} +14 -12
- package/dist/shared/{core.CaT0SUUK.mjs → core.rCeaAqgW.mjs} +1 -84
- package/dist/shared/{core.kxeJe0OY.d.mts → core.s9uwOt60.d.mts} +4 -4
- package/dist/shared/core.yna0OdV5.d.mts +98 -0
- package/dist/styles/index.d.mts +106 -0
- package/dist/styles/index.mjs +1 -0
- package/dist/types/_aux.d.mts +2 -2
- package/dist/types/_aux.mjs +1 -5
- package/dist/types/expression-model.d.mts +3 -4
- package/dist/types/expression.d.mts +3 -4
- package/dist/types/fqnRef.d.mts +2 -2
- package/dist/types/fqnRef.mjs +3 -3
- package/dist/types/index.d.mts +8 -8
- package/dist/types/index.mjs +151 -6
- package/dist/types/scalar.mjs +3 -2
- package/dist/utils/graphology/index.d.mts +1864 -0
- package/dist/utils/graphology/index.mjs +1 -0
- package/dist/utils/index.d.mts +11 -6
- package/dist/utils/index.mjs +21 -37
- package/dist/utils/iterable/index.d.mts +1 -1
- package/dist/utils/iterable/index.mjs +45 -7
- package/model/package.json +4 -0
- package/package.json +42 -24
- package/styles/package.json +4 -0
- package/types/package.json +4 -0
- package/utils/graphology/package.json +4 -0
- package/utils/package.json +4 -0
- package/dist/shared/core.6_Vp2iiN.mjs +0 -172
- package/dist/shared/core.Bpou6c2f.d.mts +0 -850
- package/dist/shared/core.CUw_2J9j.mjs +0 -47
- package/dist/shared/core.CzdwsPmY.d.mts +0 -69
- package/dist/shared/core.DoM6aM9N.mjs +0 -7
- package/dist/shared/core.ILwny7BV.mjs +0 -38
- package/dist/theme/index.d.mts +0 -11
- package/dist/theme/index.mjs +0 -232
- package/src/builder/Builder.deployment.ts +0 -224
- package/src/builder/Builder.deploymentModel.ts +0 -449
- package/src/builder/Builder.element.ts +0 -241
- package/src/builder/Builder.model.ts +0 -494
- package/src/builder/Builder.ts +0 -870
- package/src/builder/Builder.view-common.ts +0 -273
- package/src/builder/Builder.view-deployment.ts +0 -135
- package/src/builder/Builder.view-element.ts +0 -202
- package/src/builder/Builder.views.ts +0 -399
- package/src/builder/Builder.with.ts +0 -156
- package/src/builder/_types.ts +0 -320
- package/src/builder/index.ts +0 -11
- package/src/compute-view/compute-view.ts +0 -80
- package/src/compute-view/deployment-view/_types.ts +0 -38
- package/src/compute-view/deployment-view/clean-connections.ts +0 -236
- package/src/compute-view/deployment-view/compute.ts +0 -94
- package/src/compute-view/deployment-view/memory/index.ts +0 -9
- package/src/compute-view/deployment-view/memory/memory.ts +0 -96
- package/src/compute-view/deployment-view/predicates/deploymentRefs-where.ts +0 -18
- package/src/compute-view/deployment-view/predicates/deploymentRefs.ts +0 -154
- package/src/compute-view/deployment-view/predicates/index.ts +0 -8
- package/src/compute-view/deployment-view/predicates/relation-direct.ts +0 -243
- package/src/compute-view/deployment-view/predicates/relation-in-out.ts +0 -70
- package/src/compute-view/deployment-view/predicates/relation-incoming.ts +0 -101
- package/src/compute-view/deployment-view/predicates/relation-outgoing.ts +0 -95
- package/src/compute-view/deployment-view/predicates/relation-where.ts +0 -18
- package/src/compute-view/deployment-view/predicates/utils.ts +0 -282
- package/src/compute-view/deployment-view/predicates/wildcard.ts +0 -41
- package/src/compute-view/deployment-view/stages/stage-exclude.ts +0 -5
- package/src/compute-view/deployment-view/stages/stage-final.ts +0 -245
- package/src/compute-view/deployment-view/stages/stage-include.ts +0 -95
- package/src/compute-view/deployment-view/utils.ts +0 -286
- package/src/compute-view/dynamic-view/compute.ts +0 -312
- package/src/compute-view/element-view/_types.ts +0 -47
- package/src/compute-view/element-view/clean-connections.ts +0 -117
- package/src/compute-view/element-view/compute.ts +0 -324
- package/src/compute-view/element-view/memory/NodeGroup.ts +0 -31
- package/src/compute-view/element-view/memory/index.ts +0 -10
- package/src/compute-view/element-view/memory/memory.ts +0 -178
- package/src/compute-view/element-view/memory/stage-exclude.ts +0 -59
- package/src/compute-view/element-view/memory/stage-final.ts +0 -129
- package/src/compute-view/element-view/memory/stage-include.ts +0 -130
- package/src/compute-view/element-view/predicates/_utils.ts +0 -91
- package/src/compute-view/element-view/predicates/element-expand.ts +0 -29
- package/src/compute-view/element-view/predicates/element-kind-tag.ts +0 -27
- package/src/compute-view/element-view/predicates/element-ref.ts +0 -24
- package/src/compute-view/element-view/predicates/relation-direct.ts +0 -321
- package/src/compute-view/element-view/predicates/relation-in-out.ts +0 -64
- package/src/compute-view/element-view/predicates/relation-in.ts +0 -115
- package/src/compute-view/element-view/predicates/relation-out.ts +0 -119
- package/src/compute-view/element-view/predicates/wildcard.ts +0 -88
- package/src/compute-view/element-view/utils.ts +0 -65
- package/src/compute-view/index.ts +0 -4
- package/src/compute-view/memory/AbstractMemory.ts +0 -45
- package/src/compute-view/memory/AbstractStageExclude.ts +0 -215
- package/src/compute-view/memory/AbstractStageInclude.ts +0 -200
- package/src/compute-view/memory/_types.ts +0 -148
- package/src/compute-view/memory/index.ts +0 -5
- package/src/compute-view/memory/ops.ts +0 -43
- package/src/compute-view/relationships-view/_types.ts +0 -16
- package/src/compute-view/relationships-view/compute.ts +0 -159
- package/src/compute-view/relationships-view/index.ts +0 -3
- package/src/compute-view/relationships-view/layout.ts +0 -357
- package/src/compute-view/relationships-view/utils.ts +0 -73
- package/src/compute-view/utils/ancestorsOfNode.ts +0 -19
- package/src/compute-view/utils/applyCustomElementProperties.ts +0 -107
- package/src/compute-view/utils/applyCustomRelationProperties.ts +0 -58
- package/src/compute-view/utils/applyViewRuleStyles.ts +0 -73
- package/src/compute-view/utils/buildComputedNodes.ts +0 -153
- package/src/compute-view/utils/buildElementNotations.ts +0 -63
- package/src/compute-view/utils/elementExpressionToPredicate.ts +0 -50
- package/src/compute-view/utils/link-nodes-with-edges.ts +0 -56
- package/src/compute-view/utils/merge-props-from-relationships.ts +0 -161
- package/src/compute-view/utils/relationExpressionToPredicates.ts +0 -55
- package/src/compute-view/utils/resolve-extended-views.ts +0 -85
- package/src/compute-view/utils/resolve-global-rules.ts +0 -88
- package/src/compute-view/utils/topological-sort.ts +0 -256
- package/src/compute-view/utils/view-hash.ts +0 -45
- package/src/compute-view/utils/with-readable-edges.ts +0 -40
- package/src/index.ts +0 -32
- package/src/model/DeploymentElementModel.ts +0 -682
- package/src/model/DeploymentModel.ts +0 -393
- package/src/model/ElementModel.ts +0 -293
- package/src/model/LikeC4Model.ts +0 -882
- package/src/model/RelationModel.ts +0 -152
- package/src/model/connection/Connection.ts +0 -72
- package/src/model/connection/deployment/DeploymentConnectionModel.ts +0 -185
- package/src/model/connection/deployment/find.ts +0 -120
- package/src/model/connection/deployment/index.ts +0 -8
- package/src/model/connection/index.ts +0 -22
- package/src/model/connection/model/ConnectionModel.ts +0 -158
- package/src/model/connection/model/find.ts +0 -117
- package/src/model/connection/model/index.ts +0 -8
- package/src/model/connection/ops.ts +0 -276
- package/src/model/guards.ts +0 -77
- package/src/model/index.ts +0 -72
- package/src/model/types.ts +0 -67
- package/src/model/utils.ts +0 -66
- package/src/model/view/EdgeModel.ts +0 -120
- package/src/model/view/LikeC4ViewModel.ts +0 -361
- package/src/model/view/LikeC4ViewsFolder.ts +0 -151
- package/src/model/view/NodeModel.ts +0 -247
- package/src/theme/element.ts +0 -61
- package/src/theme/index.ts +0 -127
- package/src/theme/relationships.ts +0 -54
- package/src/types/RichText.ts +0 -206
- package/src/types/_aux.ts +0 -291
- package/src/types/_common.ts +0 -80
- package/src/types/const.ts +0 -34
- package/src/types/expression-model.ts +0 -294
- package/src/types/expression.ts +0 -313
- package/src/types/fqnRef.ts +0 -91
- package/src/types/geometry.ts +0 -159
- package/src/types/global.ts +0 -21
- package/src/types/index.ts +0 -42
- package/src/types/model-data.ts +0 -77
- package/src/types/model-deployment.ts +0 -88
- package/src/types/model-dump.ts +0 -79
- package/src/types/model-logical.ts +0 -135
- package/src/types/model-spec.ts +0 -85
- package/src/types/operators.ts +0 -156
- package/src/types/project.ts +0 -14
- package/src/types/scalar.ts +0 -162
- package/src/types/styles.ts +0 -122
- package/src/types/view-changes.ts +0 -32
- package/src/types/view-common.ts +0 -157
- package/src/types/view-computed.ts +0 -118
- package/src/types/view-layouted.ts +0 -98
- package/src/types/view-parsed.deployment.ts +0 -39
- package/src/types/view-parsed.dynamic.ts +0 -89
- package/src/types/view-parsed.element.ts +0 -65
- package/src/types/view.ts +0 -113
- package/src/utils/common-head.ts +0 -22
- package/src/utils/compare-natural.ts +0 -60
- package/src/utils/const.ts +0 -1
- package/src/utils/fqn.ts +0 -302
- package/src/utils/getOrCreate.ts +0 -8
- package/src/utils/guards.ts +0 -9
- package/src/utils/index.ts +0 -68
- package/src/utils/invariant.ts +0 -29
- package/src/utils/iterable/_types.ts +0 -5
- package/src/utils/iterable/filter.ts +0 -55
- package/src/utils/iterable/find.ts +0 -38
- package/src/utils/iterable/first.ts +0 -48
- package/src/utils/iterable/flat.ts +0 -17
- package/src/utils/iterable/head.ts +0 -22
- package/src/utils/iterable/index.ts +0 -15
- package/src/utils/iterable/map.ts +0 -40
- package/src/utils/iterable/reduce.ts +0 -24
- package/src/utils/iterable/some.ts +0 -36
- package/src/utils/iterable/to.ts +0 -19
- package/src/utils/iterable/unique.ts +0 -23
- package/src/utils/markdown/index.ts +0 -2
- package/src/utils/markdown/to-html.ts +0 -32
- package/src/utils/markdown/to-text.ts +0 -14
- package/src/utils/memoize-prop.ts +0 -30
- package/src/utils/mnemonist.ts +0 -9
- package/src/utils/object-hash.ts +0 -14
- package/src/utils/promises.ts +0 -24
- package/src/utils/relations.ts +0 -36
- package/src/utils/set.ts +0 -83
- package/src/utils/string-hash.ts +0 -16
|
@@ -1,294 +0,0 @@
|
|
|
1
|
-
import type * as aux from './_aux'
|
|
2
|
-
import type { ExclusiveUnion } from './_common'
|
|
3
|
-
import type { PredicateSelector } from './expression'
|
|
4
|
-
import { FqnRef } from './fqnRef'
|
|
5
|
-
import type { WhereOperator } from './operators'
|
|
6
|
-
import type * as scalar from './scalar'
|
|
7
|
-
import type {
|
|
8
|
-
BorderStyle,
|
|
9
|
-
Color,
|
|
10
|
-
ElementShape,
|
|
11
|
-
RelationshipArrowType,
|
|
12
|
-
RelationshipLineType,
|
|
13
|
-
ShapeSize,
|
|
14
|
-
} from './styles'
|
|
15
|
-
|
|
16
|
-
// Alias for bundle exports
|
|
17
|
-
type AnyAux = aux.Any
|
|
18
|
-
|
|
19
|
-
export namespace ModelFqnExpr {
|
|
20
|
-
export type Wildcard = {
|
|
21
|
-
wildcard: true
|
|
22
|
-
}
|
|
23
|
-
export function isWildcard<A extends AnyAux>(expr: ModelExpression<A>): expr is ModelFqnExpr.Wildcard {
|
|
24
|
-
return 'wildcard' in expr && expr.wildcard === true
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export interface Ref<M extends AnyAux> {
|
|
28
|
-
ref: FqnRef.ModelRef<M>
|
|
29
|
-
selector?: PredicateSelector
|
|
30
|
-
}
|
|
31
|
-
export function isModelRef<A extends AnyAux>(ref: ModelExpression<A>): ref is ModelFqnExpr.Ref<A> {
|
|
32
|
-
return 'ref' in ref && FqnRef.isModelRef(ref.ref)
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export interface ElementKindExpr<A extends AnyAux = AnyAux> {
|
|
36
|
-
elementKind: aux.ElementKind<A>
|
|
37
|
-
isEqual: boolean
|
|
38
|
-
}
|
|
39
|
-
export function isElementKindExpr<A extends AnyAux>(expr: ModelExpression<A>): expr is ElementKindExpr<A> {
|
|
40
|
-
return 'elementKind' in expr && 'isEqual' in expr
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export interface ElementTagExpr<A extends AnyAux> {
|
|
44
|
-
elementTag: aux.Tag<A>
|
|
45
|
-
isEqual: boolean
|
|
46
|
-
}
|
|
47
|
-
export function isElementTagExpr<A extends AnyAux>(expr: ModelExpression<A>): expr is ElementTagExpr<A> {
|
|
48
|
-
return 'elementTag' in expr && 'isEqual' in expr
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export type NonWildcard<A extends AnyAux = AnyAux> = ExclusiveUnion<{
|
|
52
|
-
Ref: Ref<A>
|
|
53
|
-
ElementKind: ElementKindExpr<A>
|
|
54
|
-
ElementTag: ElementTagExpr<A>
|
|
55
|
-
}>
|
|
56
|
-
|
|
57
|
-
export interface Where<A extends AnyAux = AnyAux> {
|
|
58
|
-
where: {
|
|
59
|
-
expr: ExclusiveUnion<{
|
|
60
|
-
Wildcard: Wildcard
|
|
61
|
-
Ref: Ref<A>
|
|
62
|
-
ElementKind: ElementKindExpr<A>
|
|
63
|
-
ElementTag: ElementTagExpr<A>
|
|
64
|
-
}>
|
|
65
|
-
condition: WhereOperator<A>
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export function isWhere<A extends AnyAux>(expr: ModelExpression<A>): expr is ModelFqnExpr.Where<A> {
|
|
70
|
-
return 'where' in expr && is(expr.where.expr)
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
export interface Custom<A extends AnyAux = AnyAux> {
|
|
74
|
-
custom: {
|
|
75
|
-
expr: OrWhere<A>
|
|
76
|
-
title?: string
|
|
77
|
-
description?: scalar.MarkdownOrString
|
|
78
|
-
technology?: string
|
|
79
|
-
notation?: string
|
|
80
|
-
shape?: ElementShape
|
|
81
|
-
color?: Color
|
|
82
|
-
icon?: scalar.Icon
|
|
83
|
-
border?: BorderStyle
|
|
84
|
-
opacity?: number
|
|
85
|
-
navigateTo?: aux.StrictViewId<A>
|
|
86
|
-
multiple?: boolean
|
|
87
|
-
size?: ShapeSize
|
|
88
|
-
padding?: ShapeSize
|
|
89
|
-
textSize?: ShapeSize
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
export function isCustom<A extends AnyAux>(expr: ModelExpression<A>): expr is Custom<A> {
|
|
94
|
-
return 'custom' in expr && (is(expr.custom.expr) || isWhere(expr.custom.expr))
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
export function is<A extends AnyAux>(expr: ModelExpression<A>): expr is ModelFqnExpr<A> {
|
|
98
|
-
return isWildcard(expr)
|
|
99
|
-
|| isModelRef(expr)
|
|
100
|
-
|| isElementKindExpr(expr)
|
|
101
|
-
|| isElementTagExpr(expr)
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
export type OrWhere<A extends AnyAux = AnyAux> = ExclusiveUnion<{
|
|
105
|
-
Wildcard: ModelFqnExpr.Wildcard
|
|
106
|
-
Ref: ModelFqnExpr.Ref<A>
|
|
107
|
-
ElementKind: ElementKindExpr<A>
|
|
108
|
-
ElementTag: ElementTagExpr<A>
|
|
109
|
-
Where: ModelFqnExpr.Where<A>
|
|
110
|
-
}>
|
|
111
|
-
|
|
112
|
-
export type Any<A extends AnyAux = AnyAux> = ExclusiveUnion<{
|
|
113
|
-
Wildcard: Wildcard
|
|
114
|
-
Ref: Ref<A>
|
|
115
|
-
ElementKind: ElementKindExpr<A>
|
|
116
|
-
ElementTag: ElementTagExpr<A>
|
|
117
|
-
Where: Where<A>
|
|
118
|
-
Custom: Custom<A>
|
|
119
|
-
}>
|
|
120
|
-
|
|
121
|
-
export function unwrap<A extends AnyAux>(
|
|
122
|
-
expr: ModelFqnExpr.Any<A>,
|
|
123
|
-
): Wildcard | Ref<A> | ElementKindExpr<A> | ElementTagExpr<A> {
|
|
124
|
-
if (isCustom(expr)) {
|
|
125
|
-
expr = expr.custom.expr
|
|
126
|
-
}
|
|
127
|
-
if (isWhere(expr)) {
|
|
128
|
-
expr = expr.where.expr
|
|
129
|
-
}
|
|
130
|
-
return expr
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
export type ModelFqnExpr<A extends AnyAux = AnyAux> = ExclusiveUnion<{
|
|
135
|
-
Wildcard: ModelFqnExpr.Wildcard
|
|
136
|
-
Ref: ModelFqnExpr.Ref<A>
|
|
137
|
-
ElementKind: ModelFqnExpr.ElementKindExpr<A>
|
|
138
|
-
ElementTag: ModelFqnExpr.ElementTagExpr<A>
|
|
139
|
-
}>
|
|
140
|
-
|
|
141
|
-
export namespace ModelRelationExpr {
|
|
142
|
-
export type Endpoint<A extends AnyAux = AnyAux> = ModelFqnExpr.Where<A>['where']['expr']
|
|
143
|
-
|
|
144
|
-
export interface Direct<A extends AnyAux = AnyAux> {
|
|
145
|
-
source: Endpoint<A>
|
|
146
|
-
target: Endpoint<A>
|
|
147
|
-
isBidirectional?: boolean
|
|
148
|
-
}
|
|
149
|
-
export function isDirect<A extends AnyAux>(expr: ModelExpression<A>): expr is ModelRelationExpr.Direct<A> {
|
|
150
|
-
return 'source' in expr && 'target' in expr
|
|
151
|
-
}
|
|
152
|
-
export interface Incoming<A extends AnyAux = AnyAux> {
|
|
153
|
-
incoming: Endpoint<A>
|
|
154
|
-
}
|
|
155
|
-
export function isIncoming<A extends AnyAux>(expr: ModelExpression<A>): expr is ModelRelationExpr.Incoming<A> {
|
|
156
|
-
return 'incoming' in expr
|
|
157
|
-
}
|
|
158
|
-
export interface Outgoing<A extends AnyAux = AnyAux> {
|
|
159
|
-
outgoing: Endpoint<A>
|
|
160
|
-
}
|
|
161
|
-
export function isOutgoing<A extends AnyAux>(expr: ModelExpression<A>): expr is ModelRelationExpr.Outgoing<A> {
|
|
162
|
-
return 'outgoing' in expr
|
|
163
|
-
}
|
|
164
|
-
export interface InOut<A extends AnyAux = AnyAux> {
|
|
165
|
-
inout: Endpoint<A>
|
|
166
|
-
}
|
|
167
|
-
export function isInOut<A extends AnyAux>(expr: ModelExpression<A>): expr is ModelRelationExpr.InOut<A> {
|
|
168
|
-
return 'inout' in expr
|
|
169
|
-
}
|
|
170
|
-
export interface Where<A extends AnyAux = AnyAux> {
|
|
171
|
-
where: {
|
|
172
|
-
expr: ExclusiveUnion<{
|
|
173
|
-
Direct: ModelRelationExpr.Direct<A>
|
|
174
|
-
Incoming: ModelRelationExpr.Incoming<A>
|
|
175
|
-
Outgoing: ModelRelationExpr.Outgoing<A>
|
|
176
|
-
InOut: ModelRelationExpr.InOut<A>
|
|
177
|
-
}>
|
|
178
|
-
condition: WhereOperator<A>
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
export function isWhere<A extends AnyAux>(expr: ModelExpression<A>): expr is ModelRelationExpr.Where<A> {
|
|
182
|
-
return 'where' in expr &&
|
|
183
|
-
(isDirect(expr.where.expr) || isIncoming(expr.where.expr) || isOutgoing(expr.where.expr) ||
|
|
184
|
-
isInOut(expr.where.expr))
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
export interface Custom<A extends AnyAux = AnyAux> {
|
|
188
|
-
customRelation: {
|
|
189
|
-
expr: OrWhere<A>
|
|
190
|
-
title?: string
|
|
191
|
-
description?: string
|
|
192
|
-
technology?: string
|
|
193
|
-
notation?: string
|
|
194
|
-
// Link to dynamic view
|
|
195
|
-
navigateTo?: aux.StrictViewId<A>
|
|
196
|
-
// Notes for walkthrough
|
|
197
|
-
notes?: string
|
|
198
|
-
color?: Color
|
|
199
|
-
line?: RelationshipLineType
|
|
200
|
-
head?: RelationshipArrowType
|
|
201
|
-
tail?: RelationshipArrowType
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
export function isCustom<A extends AnyAux>(expr: ModelExpression<A>): expr is Custom<A> {
|
|
206
|
-
return 'customRelation' in expr
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
export function is<A extends AnyAux>(expr: ModelExpression<A>): expr is ModelRelationExpr<A> {
|
|
210
|
-
return isDirect(expr)
|
|
211
|
-
|| isIncoming(expr)
|
|
212
|
-
|| isOutgoing(expr)
|
|
213
|
-
|| isInOut(expr)
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
export type OrWhere<A extends AnyAux = AnyAux> = ExclusiveUnion<{
|
|
217
|
-
Direct: Direct<A>
|
|
218
|
-
Incoming: Incoming<A>
|
|
219
|
-
Outgoing: Outgoing<A>
|
|
220
|
-
InOut: InOut<A>
|
|
221
|
-
Where: Where<A>
|
|
222
|
-
}>
|
|
223
|
-
|
|
224
|
-
export type Any<A extends AnyAux = AnyAux> = ExclusiveUnion<{
|
|
225
|
-
Direct: Direct<A>
|
|
226
|
-
Incoming: Incoming<A>
|
|
227
|
-
Outgoing: Outgoing<A>
|
|
228
|
-
InOut: InOut<A>
|
|
229
|
-
Where: Where<A>
|
|
230
|
-
Custom: Custom<A>
|
|
231
|
-
}>
|
|
232
|
-
|
|
233
|
-
export function unwrap<A extends AnyAux>(
|
|
234
|
-
expr: ModelRelationExpr.Any<A>,
|
|
235
|
-
): Direct<A> | Incoming<A> | Outgoing<A> | InOut<A> {
|
|
236
|
-
if (isCustom(expr)) {
|
|
237
|
-
expr = expr.customRelation.expr
|
|
238
|
-
}
|
|
239
|
-
if (isWhere(expr)) {
|
|
240
|
-
expr = expr.where.expr
|
|
241
|
-
}
|
|
242
|
-
return expr
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
export type ModelRelationExpr<A extends AnyAux = AnyAux> = ExclusiveUnion<{
|
|
247
|
-
Direct: ModelRelationExpr.Direct<A>
|
|
248
|
-
Incoming: ModelRelationExpr.Incoming<A>
|
|
249
|
-
Outgoing: ModelRelationExpr.Outgoing<A>
|
|
250
|
-
InOut: ModelRelationExpr.InOut<A>
|
|
251
|
-
}>
|
|
252
|
-
|
|
253
|
-
/**
|
|
254
|
-
* Represents a version 2 expression which can be one of several types.
|
|
255
|
-
*
|
|
256
|
-
* @template D - The type for the deployment FQN, defaults to `Fqn`.
|
|
257
|
-
* @template M - The type for the model FQN, defaults to `Fqn`.
|
|
258
|
-
*/
|
|
259
|
-
export type ModelExpression<A extends AnyAux = AnyAux> = ExclusiveUnion<{
|
|
260
|
-
Wildcard: ModelFqnExpr.Wildcard
|
|
261
|
-
Ref: ModelFqnExpr.Ref<A>
|
|
262
|
-
ElementKind: ModelFqnExpr.ElementKindExpr<A>
|
|
263
|
-
ElementTag: ModelFqnExpr.ElementTagExpr<A>
|
|
264
|
-
Custom: ModelFqnExpr.Custom<A>
|
|
265
|
-
Direct: ModelRelationExpr.Direct<A>
|
|
266
|
-
Incoming: ModelRelationExpr.Incoming<A>
|
|
267
|
-
Outgoing: ModelRelationExpr.Outgoing<A>
|
|
268
|
-
InOut: ModelRelationExpr.InOut<A>
|
|
269
|
-
Where: ModelExpression.Where<A>
|
|
270
|
-
CustomRelation: ModelRelationExpr.Custom<A>
|
|
271
|
-
}>
|
|
272
|
-
|
|
273
|
-
export namespace ModelExpression {
|
|
274
|
-
export type Where<A extends AnyAux = AnyAux> = ModelFqnExpr.Where<A> | ModelRelationExpr.Where<A>
|
|
275
|
-
export function isWhere<A extends AnyAux>(expr: ModelExpression<A>): expr is ModelExpression.Where<A> {
|
|
276
|
-
return 'where' in expr
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
export function isRelationWhere<A extends AnyAux>(expr: ModelExpression<A>): expr is ModelRelationExpr.Where<A> {
|
|
280
|
-
return ModelRelationExpr.isWhere(expr)
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
export function isFqnExprWhere<A extends AnyAux>(expr: ModelExpression<A>): expr is ModelFqnExpr.Where<A> {
|
|
284
|
-
return ModelFqnExpr.isWhere(expr)
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
export function isFqnExpr<A extends AnyAux>(expr: ModelExpression<A>): expr is ModelFqnExpr.Any<A> {
|
|
288
|
-
return ModelFqnExpr.is(expr) || ModelFqnExpr.isWhere(expr) || ModelFqnExpr.isCustom(expr)
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
export function isRelationExpr<A extends AnyAux>(expr: ModelExpression<A>): expr is ModelRelationExpr.Any<A> {
|
|
292
|
-
return ModelRelationExpr.is(expr) || ModelRelationExpr.isWhere(expr) || ModelRelationExpr.isCustom(expr)
|
|
293
|
-
}
|
|
294
|
-
}
|
package/src/types/expression.ts
DELETED
|
@@ -1,313 +0,0 @@
|
|
|
1
|
-
import type * as aux from './_aux'
|
|
2
|
-
import type { ExclusiveUnion } from './_common'
|
|
3
|
-
import { FqnRef } from './fqnRef'
|
|
4
|
-
import type { WhereOperator } from './operators'
|
|
5
|
-
import type * as scalar from './scalar'
|
|
6
|
-
import type {
|
|
7
|
-
BorderStyle,
|
|
8
|
-
Color,
|
|
9
|
-
ElementShape,
|
|
10
|
-
RelationshipArrowType,
|
|
11
|
-
RelationshipLineType,
|
|
12
|
-
ShapeSize,
|
|
13
|
-
} from './styles'
|
|
14
|
-
|
|
15
|
-
// Alias for bundle exports
|
|
16
|
-
type AnyAux = aux.Any
|
|
17
|
-
|
|
18
|
-
export type PredicateSelector =
|
|
19
|
-
| 'children' // ele.*
|
|
20
|
-
| 'expanded' // ele._
|
|
21
|
-
| 'descendants' // ele.**
|
|
22
|
-
|
|
23
|
-
export namespace FqnExpr {
|
|
24
|
-
export type Wildcard = {
|
|
25
|
-
wildcard: true
|
|
26
|
-
}
|
|
27
|
-
export function isWildcard<A extends AnyAux>(expr: Expression<A>): expr is FqnExpr.Wildcard {
|
|
28
|
-
return 'wildcard' in expr && expr.wildcard === true
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export interface ModelRef<M extends AnyAux = AnyAux> {
|
|
32
|
-
ref: FqnRef.ModelRef<M>
|
|
33
|
-
selector?: PredicateSelector
|
|
34
|
-
}
|
|
35
|
-
export function isModelRef<A extends AnyAux>(ref: Expression<A>): ref is FqnExpr.ModelRef<A> {
|
|
36
|
-
return 'ref' in ref && FqnRef.isModelRef(ref.ref)
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export interface DeploymentRef<A extends AnyAux = AnyAux> {
|
|
40
|
-
ref: FqnRef.DeploymentRef<A>
|
|
41
|
-
selector?: PredicateSelector
|
|
42
|
-
}
|
|
43
|
-
export function isDeploymentRef<A extends AnyAux>(expr: Expression<A>): expr is FqnExpr.DeploymentRef<A> {
|
|
44
|
-
return 'ref' in expr && FqnRef.isDeploymentRef(expr.ref)
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export interface ElementKindExpr<A extends AnyAux = AnyAux> {
|
|
48
|
-
elementKind: aux.ElementKind<A>
|
|
49
|
-
isEqual: boolean
|
|
50
|
-
}
|
|
51
|
-
export function isElementKindExpr<A extends AnyAux>(expr: Expression<A>): expr is ElementKindExpr<A> {
|
|
52
|
-
return 'elementKind' in expr && 'isEqual' in expr
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export interface ElementTagExpr<A extends AnyAux = AnyAux> {
|
|
56
|
-
elementTag: aux.Tag<A>
|
|
57
|
-
isEqual: boolean
|
|
58
|
-
}
|
|
59
|
-
export function isElementTagExpr<A extends AnyAux>(expr: Expression<A>): expr is ElementTagExpr<A> {
|
|
60
|
-
return 'elementTag' in expr && 'isEqual' in expr
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export type NonWildcard<A extends AnyAux = AnyAux> = ExclusiveUnion<{
|
|
64
|
-
ModelRef: ModelRef<A>
|
|
65
|
-
DeploymentRef: DeploymentRef<A>
|
|
66
|
-
ElementKind: ElementKindExpr<A>
|
|
67
|
-
ElementTag: ElementTagExpr<A>
|
|
68
|
-
}>
|
|
69
|
-
|
|
70
|
-
export interface Where<A extends AnyAux = AnyAux> {
|
|
71
|
-
where: {
|
|
72
|
-
expr: ExclusiveUnion<{
|
|
73
|
-
Wildcard: Wildcard
|
|
74
|
-
ModelRef: ModelRef<A>
|
|
75
|
-
DeploymentRef: DeploymentRef<A>
|
|
76
|
-
ElementKind: ElementKindExpr<A>
|
|
77
|
-
ElementTag: ElementTagExpr<A>
|
|
78
|
-
}>
|
|
79
|
-
condition: WhereOperator<A>
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
export function isWhere<A extends AnyAux>(expr: Expression<A>): expr is FqnExpr.Where<A> {
|
|
84
|
-
return 'where' in expr && is(expr.where.expr)
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
export interface Custom<A extends AnyAux = AnyAux> {
|
|
88
|
-
custom: {
|
|
89
|
-
expr: OrWhere<A>
|
|
90
|
-
title?: string
|
|
91
|
-
description?: scalar.MarkdownOrString
|
|
92
|
-
technology?: string
|
|
93
|
-
notation?: string
|
|
94
|
-
shape?: ElementShape
|
|
95
|
-
color?: Color
|
|
96
|
-
icon?: scalar.Icon
|
|
97
|
-
border?: BorderStyle
|
|
98
|
-
opacity?: number
|
|
99
|
-
navigateTo?: aux.StrictViewId<A>
|
|
100
|
-
multiple?: boolean
|
|
101
|
-
size?: ShapeSize
|
|
102
|
-
padding?: ShapeSize
|
|
103
|
-
textSize?: ShapeSize
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
export function isCustom<A extends AnyAux>(expr: Expression<A>): expr is Custom<A> {
|
|
108
|
-
return 'custom' in expr && (is(expr.custom.expr) || isWhere(expr.custom.expr))
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
export function is<A extends AnyAux>(expr: Expression<A>): expr is FqnExpr<A> {
|
|
112
|
-
return isWildcard(expr)
|
|
113
|
-
|| isModelRef(expr)
|
|
114
|
-
|| isDeploymentRef(expr)
|
|
115
|
-
|| isElementKindExpr(expr)
|
|
116
|
-
|| isElementTagExpr(expr)
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
export type OrWhere<A extends AnyAux = AnyAux> = ExclusiveUnion<{
|
|
120
|
-
Wildcard: FqnExpr.Wildcard
|
|
121
|
-
ModelRef: FqnExpr.ModelRef<A>
|
|
122
|
-
DeploymentRef: FqnExpr.DeploymentRef<A>
|
|
123
|
-
ElementKind: ElementKindExpr<A>
|
|
124
|
-
ElementTag: ElementTagExpr<A>
|
|
125
|
-
Where: FqnExpr.Where<A>
|
|
126
|
-
}>
|
|
127
|
-
|
|
128
|
-
export type Any<A extends AnyAux = AnyAux> = ExclusiveUnion<{
|
|
129
|
-
Wildcard: Wildcard
|
|
130
|
-
ModelRef: ModelRef<A>
|
|
131
|
-
DeploymentRef: DeploymentRef<A>
|
|
132
|
-
ElementKind: ElementKindExpr<A>
|
|
133
|
-
ElementTag: ElementTagExpr<A>
|
|
134
|
-
Where: Where<A>
|
|
135
|
-
Custom: Custom<A>
|
|
136
|
-
}>
|
|
137
|
-
|
|
138
|
-
export function unwrap<A extends AnyAux>(
|
|
139
|
-
expr: FqnExpr.Any<A>,
|
|
140
|
-
): Wildcard | ModelRef<A> | DeploymentRef<A> | ElementKindExpr<A> | ElementTagExpr<A> {
|
|
141
|
-
if (isCustom(expr)) {
|
|
142
|
-
expr = expr.custom.expr
|
|
143
|
-
}
|
|
144
|
-
if (isWhere(expr)) {
|
|
145
|
-
expr = expr.where.expr
|
|
146
|
-
}
|
|
147
|
-
return expr
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
export type FqnExpr<A extends AnyAux = AnyAux> = ExclusiveUnion<{
|
|
152
|
-
Wildcard: FqnExpr.Wildcard
|
|
153
|
-
ModelRef: FqnExpr.ModelRef<A>
|
|
154
|
-
DeploymentRef: FqnExpr.DeploymentRef<A>
|
|
155
|
-
ElementKind: FqnExpr.ElementKindExpr<A>
|
|
156
|
-
ElementTag: FqnExpr.ElementTagExpr<A>
|
|
157
|
-
}>
|
|
158
|
-
|
|
159
|
-
export namespace RelationExpr {
|
|
160
|
-
export type Endpoint<A extends AnyAux = AnyAux> = FqnExpr.Where<A>['where']['expr']
|
|
161
|
-
|
|
162
|
-
export interface Direct<A extends AnyAux = AnyAux> {
|
|
163
|
-
source: Endpoint<A>
|
|
164
|
-
target: Endpoint<A>
|
|
165
|
-
isBidirectional?: boolean
|
|
166
|
-
}
|
|
167
|
-
export function isDirect<A extends AnyAux>(expr: Expression<A>): expr is RelationExpr.Direct<A> {
|
|
168
|
-
return 'source' in expr && 'target' in expr
|
|
169
|
-
}
|
|
170
|
-
export interface Incoming<A extends AnyAux = AnyAux> {
|
|
171
|
-
incoming: Endpoint<A>
|
|
172
|
-
}
|
|
173
|
-
export function isIncoming<A extends AnyAux>(expr: Expression<A>): expr is RelationExpr.Incoming<A> {
|
|
174
|
-
return 'incoming' in expr
|
|
175
|
-
}
|
|
176
|
-
export interface Outgoing<A extends AnyAux = AnyAux> {
|
|
177
|
-
outgoing: Endpoint<A>
|
|
178
|
-
}
|
|
179
|
-
export function isOutgoing<A extends AnyAux>(expr: Expression<A>): expr is RelationExpr.Outgoing<A> {
|
|
180
|
-
return 'outgoing' in expr
|
|
181
|
-
}
|
|
182
|
-
export interface InOut<A extends AnyAux = AnyAux> {
|
|
183
|
-
inout: Endpoint<A>
|
|
184
|
-
}
|
|
185
|
-
export function isInOut<A extends AnyAux>(expr: Expression<A>): expr is RelationExpr.InOut<A> {
|
|
186
|
-
return 'inout' in expr
|
|
187
|
-
}
|
|
188
|
-
export interface Where<A extends AnyAux = AnyAux> {
|
|
189
|
-
where: {
|
|
190
|
-
expr: ExclusiveUnion<{
|
|
191
|
-
Direct: RelationExpr.Direct<A>
|
|
192
|
-
Incoming: RelationExpr.Incoming<A>
|
|
193
|
-
Outgoing: RelationExpr.Outgoing<A>
|
|
194
|
-
InOut: RelationExpr.InOut<A>
|
|
195
|
-
}>
|
|
196
|
-
condition: WhereOperator<A>
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
export function isWhere<A extends AnyAux>(expr: Expression<A>): expr is RelationExpr.Where<A> {
|
|
200
|
-
return 'where' in expr &&
|
|
201
|
-
(isDirect(expr.where.expr) || isIncoming(expr.where.expr) || isOutgoing(expr.where.expr) ||
|
|
202
|
-
isInOut(expr.where.expr))
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
export interface Custom<A extends AnyAux = AnyAux> {
|
|
206
|
-
customRelation: {
|
|
207
|
-
expr: OrWhere<A>
|
|
208
|
-
title?: string
|
|
209
|
-
description?: string
|
|
210
|
-
technology?: string
|
|
211
|
-
notation?: string
|
|
212
|
-
// Link to dynamic view
|
|
213
|
-
navigateTo?: aux.StrictViewId<A>
|
|
214
|
-
// Notes for walkthrough
|
|
215
|
-
notes?: string
|
|
216
|
-
color?: Color
|
|
217
|
-
line?: RelationshipLineType
|
|
218
|
-
head?: RelationshipArrowType
|
|
219
|
-
tail?: RelationshipArrowType
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
export function isCustom<A extends AnyAux>(expr: Expression<A>): expr is Custom<A> {
|
|
224
|
-
return 'customRelation' in expr
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
export function is<A extends AnyAux>(expr: Expression<A>): expr is RelationExpr<A> {
|
|
228
|
-
return isDirect(expr)
|
|
229
|
-
|| isIncoming(expr)
|
|
230
|
-
|| isOutgoing(expr)
|
|
231
|
-
|| isInOut(expr)
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
export type OrWhere<A extends AnyAux = AnyAux> = ExclusiveUnion<{
|
|
235
|
-
Direct: Direct<A>
|
|
236
|
-
Incoming: Incoming<A>
|
|
237
|
-
Outgoing: Outgoing<A>
|
|
238
|
-
InOut: InOut<A>
|
|
239
|
-
Where: Where<A>
|
|
240
|
-
}>
|
|
241
|
-
|
|
242
|
-
export type Any<A extends AnyAux = AnyAux> = ExclusiveUnion<{
|
|
243
|
-
Direct: Direct<A>
|
|
244
|
-
Incoming: Incoming<A>
|
|
245
|
-
Outgoing: Outgoing<A>
|
|
246
|
-
InOut: InOut<A>
|
|
247
|
-
Where: Where<A>
|
|
248
|
-
Custom: Custom<A>
|
|
249
|
-
}>
|
|
250
|
-
|
|
251
|
-
export function unwrap<A extends AnyAux>(
|
|
252
|
-
expr: RelationExpr.Any<A>,
|
|
253
|
-
): Direct<A> | Incoming<A> | Outgoing<A> | InOut<A> {
|
|
254
|
-
if (isCustom(expr)) {
|
|
255
|
-
expr = expr.customRelation.expr
|
|
256
|
-
}
|
|
257
|
-
if (isWhere(expr)) {
|
|
258
|
-
expr = expr.where.expr
|
|
259
|
-
}
|
|
260
|
-
return expr
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
export type RelationExpr<A extends AnyAux = AnyAux> = ExclusiveUnion<{
|
|
265
|
-
Direct: RelationExpr.Direct<A>
|
|
266
|
-
Incoming: RelationExpr.Incoming<A>
|
|
267
|
-
Outgoing: RelationExpr.Outgoing<A>
|
|
268
|
-
InOut: RelationExpr.InOut<A>
|
|
269
|
-
}>
|
|
270
|
-
|
|
271
|
-
/**
|
|
272
|
-
* Represents a version 2 expression which can be one of several types.
|
|
273
|
-
*
|
|
274
|
-
* @template D - The type for the deployment FQN, defaults to `Fqn`.
|
|
275
|
-
* @template M - The type for the model FQN, defaults to `Fqn`.
|
|
276
|
-
*/
|
|
277
|
-
export type Expression<A extends AnyAux = AnyAux> = ExclusiveUnion<{
|
|
278
|
-
Wildcard: FqnExpr.Wildcard
|
|
279
|
-
ModelRef: FqnExpr.ModelRef<A>
|
|
280
|
-
DeploymentRef: FqnExpr.DeploymentRef<A>
|
|
281
|
-
ElementKind: FqnExpr.ElementKindExpr<A>
|
|
282
|
-
ElementTag: FqnExpr.ElementTagExpr<A>
|
|
283
|
-
Custom: FqnExpr.Custom<A>
|
|
284
|
-
Direct: RelationExpr.Direct<A>
|
|
285
|
-
Incoming: RelationExpr.Incoming<A>
|
|
286
|
-
Outgoing: RelationExpr.Outgoing<A>
|
|
287
|
-
InOut: RelationExpr.InOut<A>
|
|
288
|
-
Where: Expression.Where<A>
|
|
289
|
-
CustomRelation: RelationExpr.Custom<A>
|
|
290
|
-
}>
|
|
291
|
-
|
|
292
|
-
export namespace Expression {
|
|
293
|
-
export type Where<A extends AnyAux = AnyAux> = FqnExpr.Where<A> | RelationExpr.Where<A>
|
|
294
|
-
export function isWhere<A extends AnyAux>(expr: Expression<A>): expr is Expression.Where<A> {
|
|
295
|
-
return 'where' in expr
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
export function isRelationWhere<A extends AnyAux>(expr: Expression<A>): expr is RelationExpr.Where<A> {
|
|
299
|
-
return RelationExpr.isWhere(expr)
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
export function isFqnExprWhere<A extends AnyAux>(expr: Expression<A>): expr is FqnExpr.Where<A> {
|
|
303
|
-
return FqnExpr.isWhere(expr)
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
export function isFqnExpr<A extends AnyAux>(expr: Expression<A>): expr is FqnExpr.Any<A> {
|
|
307
|
-
return FqnExpr.is(expr) || FqnExpr.isWhere(expr) || FqnExpr.isCustom(expr)
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
export function isRelation<A extends AnyAux>(expr: Expression<A>): expr is RelationExpr.Any<A> {
|
|
311
|
-
return RelationExpr.is(expr) || RelationExpr.isWhere(expr) || RelationExpr.isCustom(expr)
|
|
312
|
-
}
|
|
313
|
-
}
|
package/src/types/fqnRef.ts
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { isString } from 'remeda'
|
|
2
|
-
import type * as aux from './_aux'
|
|
3
|
-
import type { ExclusiveUnion } from './_common'
|
|
4
|
-
import { GlobalFqn } from './scalar'
|
|
5
|
-
|
|
6
|
-
// Alias for bundle exports
|
|
7
|
-
type AnyAux = aux.Any
|
|
8
|
-
type Unknown = aux.Unknown
|
|
9
|
-
|
|
10
|
-
export namespace FqnRef {
|
|
11
|
-
/**
|
|
12
|
-
* Reference to logical model element
|
|
13
|
-
*/
|
|
14
|
-
export interface ElementRef<A extends AnyAux = Unknown> {
|
|
15
|
-
project?: never
|
|
16
|
-
model: aux.ElementId<A>
|
|
17
|
-
}
|
|
18
|
-
export function isElementRef<A extends AnyAux>(ref: FqnRef<A>): ref is ElementRef<A> {
|
|
19
|
-
return 'model' in ref && !('project' in ref)
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Reference to imported logical model element
|
|
24
|
-
*/
|
|
25
|
-
export interface ImportRef<A extends AnyAux = Unknown> {
|
|
26
|
-
project: aux.ProjectId<A>
|
|
27
|
-
model: aux.ElementId<A>
|
|
28
|
-
}
|
|
29
|
-
export function isImportRef<A extends AnyAux>(ref: FqnRef<A>): ref is ImportRef<A> {
|
|
30
|
-
return 'project' in ref && 'model' in ref
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export function flatten<A extends AnyAux>(ref: FqnRef<A>): aux.StrictFqn<A> {
|
|
34
|
-
if (isString(ref)) {
|
|
35
|
-
throw new Error(`Expected FqnRef, got: "${ref}"`)
|
|
36
|
-
}
|
|
37
|
-
if (isImportRef(ref)) {
|
|
38
|
-
return GlobalFqn(ref.project, ref.model) as unknown as aux.StrictFqn<A>
|
|
39
|
-
}
|
|
40
|
-
if (isElementRef(ref)) {
|
|
41
|
-
return ref.model as unknown as aux.StrictFqn<A>
|
|
42
|
-
}
|
|
43
|
-
throw new Error('Expected FqnRef.ModelRef or FqnRef.ImportRef')
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export type ModelRef<A extends AnyAux = Unknown> = ImportRef<A> | ElementRef<A>
|
|
47
|
-
export function isModelRef<A extends AnyAux>(ref: FqnRef<A>): ref is ModelRef<A> {
|
|
48
|
-
return isElementRef(ref) || isImportRef(ref)
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Represents a reference to an instance within a deployment.
|
|
53
|
-
*
|
|
54
|
-
* @template D - The type representing the deployment fqn. Defaults to `Fqn`.
|
|
55
|
-
* @template M - The type representing the model fqn. Defaults to `Fqn`.
|
|
56
|
-
*
|
|
57
|
-
* @property {D} deployment - TThe fully qualified name (FQN) of the deployed instance.
|
|
58
|
-
* @property {M} element - The element reference within the deployment.
|
|
59
|
-
*/
|
|
60
|
-
export interface InsideInstanceRef<A extends AnyAux = Unknown> {
|
|
61
|
-
deployment: aux.DeploymentId<A>
|
|
62
|
-
element: aux.ElementId<A>
|
|
63
|
-
}
|
|
64
|
-
export function isInsideInstanceRef<A extends AnyAux>(ref: FqnRef<A>): ref is InsideInstanceRef<A> {
|
|
65
|
-
return 'deployment' in ref && 'element' in ref
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Represents a reference to a deployment element.
|
|
70
|
-
*
|
|
71
|
-
* @template F - The type of the fully qualified name (FQN) of the deployment element. Defaults to `Fqn`.
|
|
72
|
-
* @property {F} deployment - The fully qualified name (FQN) of the deployment element.
|
|
73
|
-
*/
|
|
74
|
-
export interface DeploymentElementRef<A extends AnyAux> {
|
|
75
|
-
deployment: aux.DeploymentId<A>
|
|
76
|
-
element?: never
|
|
77
|
-
}
|
|
78
|
-
export function isDeploymentElementRef<A extends AnyAux>(ref: FqnRef<A>): ref is DeploymentElementRef<A> {
|
|
79
|
-
return 'deployment' in ref && !('element' in ref)
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
export type DeploymentRef<A extends AnyAux> = DeploymentElementRef<A> | InsideInstanceRef<A>
|
|
83
|
-
export function isDeploymentRef<A extends AnyAux>(ref: FqnRef<A>): ref is DeploymentRef<A> {
|
|
84
|
-
return isDeploymentElementRef(ref) || isInsideInstanceRef(ref)
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
export type FqnRef<A extends AnyAux = Unknown> = ExclusiveUnion<{
|
|
89
|
-
DeploymentRef: FqnRef.DeploymentRef<A>
|
|
90
|
-
ModelRef: FqnRef.ModelRef<A>
|
|
91
|
-
}>
|