@likec4/core 1.18.0 → 1.19.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/LICENSE +1 -1
- package/dist/builder/index.d.mts +502 -0
- package/dist/builder/index.d.ts +502 -0
- package/dist/builder/index.js +871 -0
- package/dist/compute-view/index.d.mts +9 -78
- package/dist/compute-view/index.d.ts +9 -78
- package/dist/compute-view/index.js +78 -0
- package/dist/index.d.mts +9 -730
- package/dist/index.d.ts +9 -730
- package/dist/{index.mjs → index.js} +7 -784
- package/dist/model/index.d.mts +218 -606
- package/dist/model/index.d.ts +218 -606
- package/dist/model/index.js +1 -0
- package/dist/shared/chunk-RAAYCPUM.M-JWF7SS.js +21 -0
- package/dist/shared/core.BIfgabEw.d.ts +719 -0
- package/dist/shared/core.BZ9Msq7w.d.mts +719 -0
- package/dist/shared/{core.DMYY7C8s.d.mts → core.C05RDLhi.d.ts} +179 -230
- package/dist/shared/{core.DMYY7C8s.d.ts → core.CmYMqgha.d.mts} +179 -230
- package/dist/shared/core.D6-fWbM3.d.ts +127 -0
- package/dist/shared/core.D74xkKkG.d.mts +148 -0
- package/dist/shared/core.D74xkKkG.d.ts +148 -0
- package/dist/shared/core.sLaWHBjR.d.mts +127 -0
- package/dist/shared/index.DafVOuVd.js +7443 -0
- package/dist/shared/object_hash.CE_oF3I3.js +1222 -0
- package/dist/shared/view.CyZrG8BJ.js +354 -0
- package/dist/types/index.d.mts +4 -2
- package/dist/types/index.d.ts +4 -2
- package/dist/types/index.js +20 -0
- package/dist/utils/index.d.mts +419 -0
- package/dist/utils/index.d.ts +419 -0
- package/dist/utils/index.js +347 -0
- package/package.json +47 -33
- package/src/builder/Builder-style1.test-d.ts +190 -0
- package/src/builder/Builder-style2.test-d.ts +175 -0
- package/src/builder/Builder.deployment.ts +25 -20
- package/src/builder/Builder.deploymentModel.ts +80 -55
- package/src/builder/Builder.element.ts +2 -0
- package/src/builder/Builder.model.ts +57 -43
- package/src/builder/Builder.ts +412 -431
- package/src/builder/Builder.view-common.ts +234 -0
- package/src/builder/Builder.view-deployment.ts +135 -0
- package/src/builder/Builder.view-element.ts +189 -0
- package/src/builder/Builder.views.ts +109 -33
- package/src/builder/Builder.with.ts +475 -0
- package/src/builder/__snapshots__/Builder-style1.spec.ts.snap +374 -0
- package/src/builder/__snapshots__/Builder-style2.spec.ts.snap +183 -0
- package/src/builder/__snapshots__/Builder.spec.ts.snap +374 -0
- package/src/builder/_types.ts +28 -5
- package/src/builder/index.ts +10 -4
- package/src/colors/index.ts +2 -2
- package/src/compute-view/compute-view.ts +45 -54
- package/src/compute-view/deployment-view/__test__/TestHelper.ts +236 -0
- package/src/compute-view/deployment-view/__test__/fixture.ts +50 -62
- package/src/compute-view/deployment-view/_types.ts +26 -18
- package/src/compute-view/deployment-view/clean-connections.ts +173 -164
- package/src/compute-view/deployment-view/compute.ts +51 -37
- package/src/compute-view/deployment-view/memory/index.ts +9 -0
- package/src/compute-view/deployment-view/memory/memory.ts +97 -0
- package/src/compute-view/deployment-view/predicates/elements.ts +144 -0
- package/src/compute-view/deployment-view/predicates/relation-direct.ts +183 -76
- package/src/compute-view/deployment-view/predicates/relation-in-out.ts +38 -20
- package/src/compute-view/deployment-view/predicates/relation-incoming.ts +72 -23
- package/src/compute-view/deployment-view/predicates/relation-outgoing.ts +61 -22
- package/src/compute-view/deployment-view/predicates/wildcard.ts +15 -15
- package/src/compute-view/deployment-view/stages/stage-exclude.ts +5 -0
- package/src/compute-view/deployment-view/stages/stage-final.ts +245 -0
- package/src/compute-view/deployment-view/stages/stage-include.ts +95 -0
- package/src/compute-view/deployment-view/utils.ts +95 -31
- package/src/compute-view/dynamic-view/__test__/fixture.ts +4 -4
- package/src/compute-view/dynamic-view/compute.ts +59 -45
- package/src/compute-view/element-view/__test__/TestHelper.ts +258 -0
- package/src/compute-view/element-view/__test__/__snapshots__/legacy.spec.ts.snap +64 -62
- package/src/compute-view/element-view/__test__/fixture.ts +147 -117
- package/src/compute-view/element-view/_types.ts +48 -0
- package/src/compute-view/element-view/clean-connections.ts +113 -0
- package/src/compute-view/element-view/compute.ts +264 -683
- package/src/compute-view/element-view/memory/NodeGroup.ts +31 -0
- package/src/compute-view/element-view/memory/index.ts +10 -0
- package/src/compute-view/element-view/memory/memory.ts +177 -0
- package/src/compute-view/element-view/memory/stage-exclude.ts +59 -0
- package/src/compute-view/element-view/memory/stage-final.ts +129 -0
- package/src/compute-view/element-view/memory/stage-include.ts +128 -0
- package/src/compute-view/element-view/predicates/_utils.ts +86 -0
- package/src/compute-view/element-view/predicates/element-expand.ts +33 -0
- package/src/compute-view/element-view/predicates/element-kind-tag.ts +26 -0
- package/src/compute-view/element-view/predicates/element-ref.ts +37 -0
- package/src/compute-view/element-view/predicates/relation-direct.ts +309 -0
- package/src/compute-view/element-view/predicates/relation-in-out.ts +66 -0
- package/src/compute-view/element-view/predicates/relation-in.ts +118 -0
- package/src/compute-view/element-view/predicates/relation-out.ts +116 -0
- package/src/compute-view/element-view/predicates/wildcard.ts +88 -0
- package/src/compute-view/element-view/utils.ts +59 -0
- package/src/compute-view/index.ts +3 -4
- package/src/compute-view/memory/AbstractMemory.ts +45 -0
- package/src/compute-view/memory/AbstractStageExclude.ts +216 -0
- package/src/compute-view/memory/AbstractStageInclude.ts +200 -0
- package/src/compute-view/memory/_types.ts +147 -0
- package/src/compute-view/memory/index.ts +5 -0
- package/src/compute-view/memory/ops.ts +43 -0
- package/src/compute-view/utils/buildComputedNodes.ts +4 -4
- package/src/compute-view/utils/elementExpressionToPredicate.ts +1 -3
- package/src/compute-view/utils/link-nodes-with-edges.ts +3 -7
- package/src/compute-view/utils/{derive-edge-props-from-relationships.ts → merge-props-from-relationships.ts} +54 -23
- package/src/compute-view/utils/relationExpressionToPredicates.ts +2 -2
- package/src/compute-view/utils/resolve-extended-views.ts +44 -40
- package/src/compute-view/utils/resolve-global-rules.ts +6 -6
- package/src/compute-view/utils/topological-sort.ts +167 -71
- package/src/compute-view/utils/with-readable-edges.ts +14 -9
- package/src/index.ts +22 -16
- package/src/model/DeploymentElementModel.ts +150 -85
- package/src/model/DeploymentModel.ts +27 -21
- package/src/model/ElementModel.ts +51 -25
- package/src/model/LikeC4Model.test-d.ts +4 -3
- package/src/model/LikeC4Model.ts +98 -42
- package/src/model/RelationModel.ts +5 -4
- package/src/model/__test__/fixture.ts +5 -9
- package/src/model/connection/Connection.ts +72 -0
- package/src/model/connection/deployment/DeploymentConnectionModel.ts +178 -0
- package/src/model/connection/{deployment.ts → deployment/find.ts} +14 -18
- package/src/model/connection/deployment/index.ts +8 -0
- package/src/model/connection/index.ts +22 -0
- package/src/model/connection/model/ConnectionModel.ts +157 -0
- package/src/model/connection/{model.ts → model/find.ts} +43 -49
- package/src/model/connection/model/index.ts +8 -0
- package/src/model/connection/ops.ts +274 -0
- package/src/model/guards.ts +9 -0
- package/src/model/index.ts +45 -3
- package/src/model/types.ts +35 -18
- package/src/model/view/EdgeModel.ts +6 -6
- package/src/model/view/LikeC4ViewModel.ts +14 -8
- package/src/model/view/NodeModel.ts +6 -5
- package/src/types/_common.ts +53 -1
- package/src/types/deployments.ts +88 -156
- package/src/types/element.ts +2 -2
- package/src/types/expression-v2.ts +172 -0
- package/src/types/expression.ts +9 -5
- package/src/types/global.ts +3 -3
- package/src/types/index.ts +220 -13
- package/src/types/model.ts +28 -24
- package/src/types/operators.ts +1 -1
- package/src/types/relation.ts +14 -10
- package/src/types/theme.ts +0 -1
- package/src/types/view.ts +20 -18
- package/src/utils/const.ts +1 -0
- package/src/utils/fqn.ts +140 -49
- package/src/utils/getOrCreate.ts +1 -1
- package/src/utils/index.ts +75 -9
- package/src/utils/iterable/_types.ts +5 -0
- package/src/utils/iterable/filter.ts +55 -0
- package/src/utils/iterable/find.ts +36 -0
- package/src/utils/iterable/flat.ts +17 -0
- package/src/utils/iterable/index.ts +13 -0
- package/src/utils/iterable/map.ts +40 -0
- package/src/utils/iterable/reduce.ts +24 -0
- package/src/utils/iterable/some.ts +36 -0
- package/src/utils/iterable/to.ts +19 -0
- package/src/utils/iterable/unique.ts +29 -0
- package/src/utils/relations.ts +3 -64
- package/src/utils/set.ts +11 -9
- package/src/utils/string-hash.ts +1 -1
- package/dist/compute-view/index.mjs +0 -79
- package/dist/model/index.mjs +0 -2
- package/dist/shared/core.BBgiAAv1.mjs +0 -144
- package/dist/shared/core.BPyJvuMU.mjs +0 -2420
- package/dist/shared/core.BQ4AbfvB.mjs +0 -9228
- package/dist/shared/core.k12s_keD.mjs +0 -203
- package/dist/types/index.mjs +0 -21
- package/src/builder/Builder.test-d.ts +0 -124
- package/src/builder/Builder.view.ts +0 -543
- package/src/compute-view/LikeC4ModelGraph.ts +0 -330
- package/src/compute-view/deployment-view/Memory.ts +0 -108
- package/src/compute-view/deployment-view/Stage.ts +0 -145
- package/src/compute-view/deployment-view/predicates/deployment-ref.ts +0 -146
- package/src/compute-view/element-view/predicates.ts +0 -517
- package/src/compute-view/utils/sortNodes.ts +0 -101
- package/src/model/connection/ConnectionModel.ts +0 -94
- package/src/model/connection/DeploymentConnectionModel.ts +0 -99
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import { indexBy, isArray, isString, map, mapValues, pipe, prop } from 'remeda'
|
|
2
|
+
import type { Writable } from 'type-fest'
|
|
3
|
+
import type { ExpectStatic } from 'vitest'
|
|
4
|
+
import { expect as vitestExpect } from 'vitest'
|
|
5
|
+
import {
|
|
6
|
+
type AnyTypes,
|
|
7
|
+
type Builder,
|
|
8
|
+
type ElementViewRulesBuilder,
|
|
9
|
+
type Types,
|
|
10
|
+
type ViewPredicate,
|
|
11
|
+
} from '../../../builder'
|
|
12
|
+
import * as viewhelpers from '../../../builder/Builder.view-common'
|
|
13
|
+
import { mkViewBuilder } from '../../../builder/Builder.views'
|
|
14
|
+
import { differenceConnections } from '../../../model/connection'
|
|
15
|
+
import type { ComputedElementView, ElementView, ViewId, ViewRule } from '../../../types'
|
|
16
|
+
import { compareNatural } from '../../../utils'
|
|
17
|
+
import { imap, toArray } from '../../../utils/iterable'
|
|
18
|
+
import { difference as differenceSet } from '../../../utils/set'
|
|
19
|
+
import type { CtxConnection, CtxElement } from '../../memory'
|
|
20
|
+
import { withReadableEdges } from '../../utils/with-readable-edges'
|
|
21
|
+
import { processPredicates as processPredicatesImpl } from '../compute'
|
|
22
|
+
import { type Ctx, Memory } from '../memory'
|
|
23
|
+
|
|
24
|
+
type ConnectionExpression<T extends AnyTypes> = `${T['Fqn']} -> ${T['Fqn']}`
|
|
25
|
+
|
|
26
|
+
// type ConnectionsDeepMatcher<T extends AnyTypes> = {
|
|
27
|
+
// [K in `${T['Fqn']} -> ${T['Fqn']}`]?: {
|
|
28
|
+
// relations?: Array<`${T['Fqn']} -> ${T['Fqn']}`>
|
|
29
|
+
// }
|
|
30
|
+
// }
|
|
31
|
+
|
|
32
|
+
type ConnectionsDeepMatcher<Expr extends string> = {
|
|
33
|
+
[K in Expr]?: Array<Expr>
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
type ConnectionEqual<T extends AnyTypes> = [ConnectionsDeepMatcher<ConnectionExpression<T>>] | [
|
|
37
|
+
ConnectionExpression<T>,
|
|
38
|
+
...ConnectionExpression<T>[],
|
|
39
|
+
]
|
|
40
|
+
|
|
41
|
+
type Elem = CtxElement<Ctx>
|
|
42
|
+
type Connection = CtxConnection<Ctx>
|
|
43
|
+
|
|
44
|
+
export class TestHelper<T extends AnyTypes> {
|
|
45
|
+
model: Types.ToLikeC4Model<T>
|
|
46
|
+
|
|
47
|
+
static $include = viewhelpers.$include
|
|
48
|
+
static $exclude = viewhelpers.$exclude
|
|
49
|
+
static $rules = viewhelpers.$rules
|
|
50
|
+
static $style = viewhelpers.$style
|
|
51
|
+
|
|
52
|
+
$include = viewhelpers.$include
|
|
53
|
+
$exclude = viewhelpers.$exclude
|
|
54
|
+
$style = viewhelpers.$style
|
|
55
|
+
|
|
56
|
+
static from<const T extends AnyTypes>(builder: Builder<T>, expect = vitestExpect): TestHelper<T> {
|
|
57
|
+
return new TestHelper(builder, expect)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
constructor(
|
|
61
|
+
private builder: Builder<T>,
|
|
62
|
+
private _expect: ExpectStatic,
|
|
63
|
+
) {
|
|
64
|
+
this.model = builder.toLikeC4Model() as Types.ToLikeC4Model<T>
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
computeView = (...rules: ElementViewRulesBuilder<T>[]) => {
|
|
68
|
+
return withReadableEdges(
|
|
69
|
+
this.builder
|
|
70
|
+
.clone()
|
|
71
|
+
.views(_ => _.view('dev').with(...rules))
|
|
72
|
+
.toLikeC4Model()
|
|
73
|
+
.view('dev')
|
|
74
|
+
.$view as ComputedElementView<'dev'>,
|
|
75
|
+
' -> ',
|
|
76
|
+
)
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
processPredicates(...rules: ElementViewRulesBuilder<T>[]) {
|
|
80
|
+
return ProcessPredicates.execute(this, ...rules)
|
|
81
|
+
}
|
|
82
|
+
processPredicatesWithScope(scope: T['Fqn'], ...rules: ElementViewRulesBuilder<T>[]) {
|
|
83
|
+
return ProcessPredicates.executeWithScope(this, scope, ...rules)
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
expectView(view: ComputedElementView) {
|
|
87
|
+
return {
|
|
88
|
+
toHave: (nodesAndEdges: { nodes: Array<T['Fqn']>; edges: Array<ConnectionExpression<T>> }) => {
|
|
89
|
+
const actual = {
|
|
90
|
+
nodes: view.nodes.map(prop('id')),
|
|
91
|
+
edges: view.edges.map(prop('id')),
|
|
92
|
+
}
|
|
93
|
+
this._expect(actual).toEqual(nodesAndEdges)
|
|
94
|
+
},
|
|
95
|
+
toHaveNodes: <Id extends T['Fqn']>(...nodes: Id[]) => {
|
|
96
|
+
this._expect(view.nodes.map(prop('id'))).toEqual(nodes)
|
|
97
|
+
},
|
|
98
|
+
toHaveEdges: <Id extends ConnectionExpression<T>>(...edges: Id[]) => {
|
|
99
|
+
this._expect(view.edges.map(prop('id'))).toEqual(edges)
|
|
100
|
+
},
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
expectComputedView(...rules: ElementViewRulesBuilder<T>[]) {
|
|
105
|
+
return this.expectView(this.computeView(...rules))
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
expectMemory = (memory: Memory) => ({
|
|
109
|
+
toHaveAllElements: <Id extends T['Fqn']>(...ids: Id[]) => {
|
|
110
|
+
this._expect(map([...memory.elements], prop('id'))).toEqual(ids)
|
|
111
|
+
},
|
|
112
|
+
/**
|
|
113
|
+
* Final elements (visible in the view)
|
|
114
|
+
*/
|
|
115
|
+
toHaveElements: <Id extends T['Fqn']>(...ids: Id[]) => {
|
|
116
|
+
this._expect(map([...memory.final], prop('id'))).toEqual(ids)
|
|
117
|
+
},
|
|
118
|
+
toHaveConnections: (...matchers: ConnectionEqual<T>) => {
|
|
119
|
+
this.expectConnections(memory.connections).toEqual(...matchers)
|
|
120
|
+
},
|
|
121
|
+
})
|
|
122
|
+
|
|
123
|
+
expectElements = (elements: ReadonlySet<Elem>) => ({
|
|
124
|
+
toEqual: <const Id extends ViewPredicate.DeploymentConnectionExpression<T>>(...ids: Id[]) => {
|
|
125
|
+
this._expect(toArray(imap(elements, prop('id')))).toEqual(ids)
|
|
126
|
+
},
|
|
127
|
+
})
|
|
128
|
+
|
|
129
|
+
expectConnections = (connections: ReadonlyArray<Connection>) => ({
|
|
130
|
+
toBeEmpty: () => {
|
|
131
|
+
this._expect(connections.map(c => c.expression)).to.be.empty
|
|
132
|
+
},
|
|
133
|
+
toEqual: (...matchers: ConnectionEqual<T>) => {
|
|
134
|
+
const [matcher, ...rest] = matchers
|
|
135
|
+
if (isString(matcher)) {
|
|
136
|
+
this._expect(connections.map(c => c.expression)).toEqual([matcher, ...rest])
|
|
137
|
+
return
|
|
138
|
+
}
|
|
139
|
+
const obj = pipe(
|
|
140
|
+
connections,
|
|
141
|
+
indexBy(prop('expression')),
|
|
142
|
+
mapValues(c => [...c.relations].map(prop('expression')).sort(compareNatural)),
|
|
143
|
+
)
|
|
144
|
+
const expected = mapValues(matcher, (v: any) => [...v].sort(compareNatural))
|
|
145
|
+
this._expect(obj).toEqual(expected)
|
|
146
|
+
},
|
|
147
|
+
})
|
|
148
|
+
|
|
149
|
+
expectStep = (step: ProcessPredicates<T>) => ({
|
|
150
|
+
...this.expectMemory(step.memory),
|
|
151
|
+
})
|
|
152
|
+
|
|
153
|
+
expect(value: ComputedElementView): ReturnType<typeof this['expectView']>
|
|
154
|
+
expect(value: Set<Elem>): ReturnType<typeof this['expectElements']>
|
|
155
|
+
expect(value: ReadonlyArray<Connection>): ReturnType<typeof this['expectConnections']>
|
|
156
|
+
expect(value: Memory | ProcessPredicates<T>): ReturnType<typeof this['expectMemory']>
|
|
157
|
+
expect(value: Memory | ProcessPredicates<T> | Set<Elem> | ComputedElementView | ReadonlyArray<Connection>) {
|
|
158
|
+
if (value instanceof Memory) {
|
|
159
|
+
return this.expectMemory(value)
|
|
160
|
+
}
|
|
161
|
+
if (value instanceof ProcessPredicates) {
|
|
162
|
+
return this.expectStep(value)
|
|
163
|
+
}
|
|
164
|
+
if (value instanceof Set) {
|
|
165
|
+
return this.expectElements(value)
|
|
166
|
+
}
|
|
167
|
+
if (isArray(value)) {
|
|
168
|
+
return this.expectConnections(value)
|
|
169
|
+
}
|
|
170
|
+
return this.expectView(value)
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
class ProcessPredicates<T extends AnyTypes> {
|
|
175
|
+
static execute<A extends AnyTypes>(
|
|
176
|
+
test: TestHelper<A>,
|
|
177
|
+
...rules: ElementViewRulesBuilder<A>[]
|
|
178
|
+
): ProcessPredicates<A> {
|
|
179
|
+
const processor = new ProcessPredicates(test)
|
|
180
|
+
processor.next(...rules)
|
|
181
|
+
return processor
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
static executeWithScope<A extends AnyTypes>(
|
|
185
|
+
test: TestHelper<A>,
|
|
186
|
+
scope: A['Fqn'],
|
|
187
|
+
...rules: ElementViewRulesBuilder<A>[]
|
|
188
|
+
): ProcessPredicates<A> {
|
|
189
|
+
const processor = new ProcessPredicates(test, scope)
|
|
190
|
+
processor.next(...rules)
|
|
191
|
+
return processor
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
public viewrules: ReadonlyArray<ViewRule> = []
|
|
195
|
+
|
|
196
|
+
public previousMemory: Memory = Memory.empty(null)
|
|
197
|
+
public memory: Memory = Memory.empty(null)
|
|
198
|
+
public predicates: ElementViewRulesBuilder<T>[] = []
|
|
199
|
+
|
|
200
|
+
constructor(
|
|
201
|
+
public readonly t: TestHelper<T>,
|
|
202
|
+
public scope: T['Fqn'] | null = null,
|
|
203
|
+
protected age = 0,
|
|
204
|
+
) {}
|
|
205
|
+
|
|
206
|
+
get elements() {
|
|
207
|
+
return toArray(imap(this.memory.elements, prop('id')))
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
get connections() {
|
|
211
|
+
return this.memory.connections.map(c => c.expression)
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
diff() {
|
|
215
|
+
const prevState = this.previousMemory
|
|
216
|
+
const state = this.memory
|
|
217
|
+
return {
|
|
218
|
+
added: this.memory.update({
|
|
219
|
+
elements: differenceSet(state.elements, prevState.elements),
|
|
220
|
+
explicits: differenceSet(state.explicits, prevState.explicits),
|
|
221
|
+
final: differenceSet(state.final, prevState.final),
|
|
222
|
+
connections: differenceConnections(state.connections, prevState.connections),
|
|
223
|
+
}),
|
|
224
|
+
removed: this.memory.update({
|
|
225
|
+
elements: differenceSet(prevState.elements, state.elements),
|
|
226
|
+
explicits: differenceSet(prevState.explicits, state.explicits),
|
|
227
|
+
final: differenceSet(prevState.final, state.final),
|
|
228
|
+
connections: differenceConnections(prevState.connections, state.connections),
|
|
229
|
+
}),
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
next(...predicates: ElementViewRulesBuilder<T>[]): this {
|
|
234
|
+
const view = {
|
|
235
|
+
id: 'test' as ViewId,
|
|
236
|
+
__: 'element',
|
|
237
|
+
rules: [],
|
|
238
|
+
} as any as Writable<ElementView>
|
|
239
|
+
let vb = mkViewBuilder(view) as any
|
|
240
|
+
this.predicates = [
|
|
241
|
+
...this.predicates,
|
|
242
|
+
...predicates,
|
|
243
|
+
]
|
|
244
|
+
for (const rule of this.predicates) {
|
|
245
|
+
rule(vb)
|
|
246
|
+
}
|
|
247
|
+
this.previousMemory = this.memory
|
|
248
|
+
this.viewrules = view.rules
|
|
249
|
+
const scope = this.scope ? this.t.model.element(this.scope) : null
|
|
250
|
+
this.memory = processPredicatesImpl(
|
|
251
|
+
this.t.model,
|
|
252
|
+
Memory.empty(scope),
|
|
253
|
+
view.rules,
|
|
254
|
+
)
|
|
255
|
+
this.age++
|
|
256
|
+
return this
|
|
257
|
+
}
|
|
258
|
+
}
|
|
@@ -24,57 +24,59 @@ exports[`compute-element-view > view of cloud 1`] = `
|
|
|
24
24
|
"label": "manages",
|
|
25
25
|
"parent": null,
|
|
26
26
|
"relations": [
|
|
27
|
-
"support:cloud.frontend.
|
|
27
|
+
"support:cloud.frontend.supportPanel",
|
|
28
28
|
],
|
|
29
29
|
"source": "support",
|
|
30
30
|
"target": "cloud.frontend",
|
|
31
31
|
},
|
|
32
32
|
{
|
|
33
33
|
"id": "cloud.frontend:cloud.backend",
|
|
34
|
+
"kind": "graphlql",
|
|
34
35
|
"label": "requests",
|
|
35
36
|
"parent": "cloud",
|
|
36
37
|
"relations": [
|
|
37
38
|
"cloud.frontend:cloud.backend",
|
|
38
39
|
"cloud.frontend.dashboard:cloud.backend.graphql",
|
|
39
|
-
"cloud.frontend.
|
|
40
|
+
"cloud.frontend.supportPanel:cloud.backend.graphql",
|
|
40
41
|
],
|
|
41
42
|
"source": "cloud.frontend",
|
|
42
43
|
"tags": [
|
|
43
44
|
"next",
|
|
44
45
|
"old",
|
|
45
46
|
],
|
|
47
|
+
"tail": "odiamond",
|
|
46
48
|
"target": "cloud.backend",
|
|
47
49
|
},
|
|
48
50
|
{
|
|
49
|
-
"id": "cloud.backend:
|
|
50
|
-
"label": "
|
|
51
|
+
"id": "cloud.backend:email",
|
|
52
|
+
"label": "schedule",
|
|
51
53
|
"parent": null,
|
|
52
54
|
"relations": [
|
|
53
|
-
"cloud.backend
|
|
55
|
+
"cloud.backend:email",
|
|
54
56
|
],
|
|
55
57
|
"source": "cloud.backend",
|
|
56
58
|
"tags": [
|
|
57
|
-
"
|
|
58
|
-
"legacy",
|
|
59
|
-
"storage",
|
|
59
|
+
"communication",
|
|
60
60
|
],
|
|
61
|
-
"target": "
|
|
61
|
+
"target": "email",
|
|
62
62
|
},
|
|
63
63
|
{
|
|
64
|
-
"id": "cloud.backend:
|
|
65
|
-
"label": "
|
|
64
|
+
"id": "cloud.backend:amazon",
|
|
65
|
+
"label": "uploads",
|
|
66
66
|
"parent": null,
|
|
67
67
|
"relations": [
|
|
68
|
-
"cloud.backend:
|
|
68
|
+
"cloud.backend.storage:amazon.s3",
|
|
69
69
|
],
|
|
70
70
|
"source": "cloud.backend",
|
|
71
71
|
"tags": [
|
|
72
|
-
"
|
|
72
|
+
"aws",
|
|
73
|
+
"storage",
|
|
74
|
+
"legacy",
|
|
73
75
|
],
|
|
74
|
-
"target": "
|
|
76
|
+
"target": "amazon",
|
|
75
77
|
},
|
|
76
78
|
],
|
|
77
|
-
"hash": "
|
|
79
|
+
"hash": "6df052156ae59d91622677537c2d657e4946d803",
|
|
78
80
|
"id": "index",
|
|
79
81
|
"links": null,
|
|
80
82
|
"nodes": [
|
|
@@ -128,16 +130,16 @@ exports[`compute-element-view > view of cloud 1`] = `
|
|
|
128
130
|
"description": null,
|
|
129
131
|
"id": "cloud",
|
|
130
132
|
"inEdges": [
|
|
131
|
-
"support:cloud.frontend",
|
|
132
133
|
"customer:cloud.frontend",
|
|
134
|
+
"support:cloud.frontend",
|
|
133
135
|
],
|
|
134
136
|
"kind": "system",
|
|
135
137
|
"level": 0,
|
|
136
138
|
"links": null,
|
|
137
139
|
"modelRef": 1,
|
|
138
140
|
"outEdges": [
|
|
139
|
-
"cloud.backend:amazon",
|
|
140
141
|
"cloud.backend:email",
|
|
142
|
+
"cloud.backend:amazon",
|
|
141
143
|
],
|
|
142
144
|
"parent": null,
|
|
143
145
|
"shape": "rectangle",
|
|
@@ -155,8 +157,8 @@ exports[`compute-element-view > view of cloud 1`] = `
|
|
|
155
157
|
"description": null,
|
|
156
158
|
"id": "cloud.frontend",
|
|
157
159
|
"inEdges": [
|
|
158
|
-
"support:cloud.frontend",
|
|
159
160
|
"customer:cloud.frontend",
|
|
161
|
+
"support:cloud.frontend",
|
|
160
162
|
],
|
|
161
163
|
"kind": "container",
|
|
162
164
|
"level": 1,
|
|
@@ -185,8 +187,8 @@ exports[`compute-element-view > view of cloud 1`] = `
|
|
|
185
187
|
"links": null,
|
|
186
188
|
"modelRef": 1,
|
|
187
189
|
"outEdges": [
|
|
188
|
-
"cloud.backend:amazon",
|
|
189
190
|
"cloud.backend:email",
|
|
191
|
+
"cloud.backend:amazon",
|
|
190
192
|
],
|
|
191
193
|
"parent": "cloud",
|
|
192
194
|
"shape": "rectangle",
|
|
@@ -254,16 +256,6 @@ exports[`compute-element-view > view of cloud.frontend 1`] = `
|
|
|
254
256
|
"customColorDefinitions": {},
|
|
255
257
|
"description": null,
|
|
256
258
|
"edges": [
|
|
257
|
-
{
|
|
258
|
-
"id": "support:cloud.frontend.adminPanel",
|
|
259
|
-
"label": "manages",
|
|
260
|
-
"parent": null,
|
|
261
|
-
"relations": [
|
|
262
|
-
"support:cloud.frontend.adminPanel",
|
|
263
|
-
],
|
|
264
|
-
"source": "support",
|
|
265
|
-
"target": "cloud.frontend.adminPanel",
|
|
266
|
-
},
|
|
267
259
|
{
|
|
268
260
|
"id": "customer:cloud.frontend.dashboard",
|
|
269
261
|
"label": "opens in browser",
|
|
@@ -275,20 +267,14 @@ exports[`compute-element-view > view of cloud.frontend 1`] = `
|
|
|
275
267
|
"target": "cloud.frontend.dashboard",
|
|
276
268
|
},
|
|
277
269
|
{
|
|
278
|
-
"id": "cloud.frontend.
|
|
279
|
-
"
|
|
280
|
-
"label": "fetches",
|
|
281
|
-
"line": "dashed",
|
|
270
|
+
"id": "support:cloud.frontend.supportPanel",
|
|
271
|
+
"label": "manages",
|
|
282
272
|
"parent": null,
|
|
283
273
|
"relations": [
|
|
284
|
-
"cloud.frontend.
|
|
274
|
+
"support:cloud.frontend.supportPanel",
|
|
285
275
|
],
|
|
286
|
-
"source": "
|
|
287
|
-
"
|
|
288
|
-
"old",
|
|
289
|
-
],
|
|
290
|
-
"tail": "odiamond",
|
|
291
|
-
"target": "cloud.backend",
|
|
276
|
+
"source": "support",
|
|
277
|
+
"target": "cloud.frontend.supportPanel",
|
|
292
278
|
},
|
|
293
279
|
{
|
|
294
280
|
"id": "cloud.frontend.dashboard:cloud.backend",
|
|
@@ -305,8 +291,24 @@ exports[`compute-element-view > view of cloud.frontend 1`] = `
|
|
|
305
291
|
],
|
|
306
292
|
"target": "cloud.backend",
|
|
307
293
|
},
|
|
294
|
+
{
|
|
295
|
+
"id": "cloud.frontend.supportPanel:cloud.backend",
|
|
296
|
+
"kind": "graphlql",
|
|
297
|
+
"label": "fetches",
|
|
298
|
+
"line": "dashed",
|
|
299
|
+
"parent": null,
|
|
300
|
+
"relations": [
|
|
301
|
+
"cloud.frontend.supportPanel:cloud.backend.graphql",
|
|
302
|
+
],
|
|
303
|
+
"source": "cloud.frontend.supportPanel",
|
|
304
|
+
"tags": [
|
|
305
|
+
"old",
|
|
306
|
+
],
|
|
307
|
+
"tail": "odiamond",
|
|
308
|
+
"target": "cloud.backend",
|
|
309
|
+
},
|
|
308
310
|
],
|
|
309
|
-
"hash": "
|
|
311
|
+
"hash": "388ed63a4179b91d2953e5c4908c651e3e826eb0",
|
|
310
312
|
"id": "index",
|
|
311
313
|
"links": null,
|
|
312
314
|
"nodes": [
|
|
@@ -314,46 +316,46 @@ exports[`compute-element-view > view of cloud.frontend 1`] = `
|
|
|
314
316
|
"children": [],
|
|
315
317
|
"color": "primary",
|
|
316
318
|
"description": null,
|
|
317
|
-
"id": "
|
|
319
|
+
"id": "customer",
|
|
318
320
|
"inEdges": [],
|
|
319
321
|
"kind": "actor",
|
|
320
322
|
"level": 0,
|
|
321
323
|
"links": null,
|
|
322
324
|
"modelRef": 1,
|
|
323
325
|
"outEdges": [
|
|
324
|
-
"
|
|
326
|
+
"customer:cloud.frontend.dashboard",
|
|
325
327
|
],
|
|
326
328
|
"parent": null,
|
|
327
329
|
"shape": "person",
|
|
328
330
|
"style": {},
|
|
329
331
|
"tags": null,
|
|
330
332
|
"technology": null,
|
|
331
|
-
"title": "
|
|
333
|
+
"title": "customer",
|
|
332
334
|
},
|
|
333
335
|
{
|
|
334
336
|
"children": [],
|
|
335
337
|
"color": "primary",
|
|
336
338
|
"description": null,
|
|
337
|
-
"id": "
|
|
339
|
+
"id": "support",
|
|
338
340
|
"inEdges": [],
|
|
339
341
|
"kind": "actor",
|
|
340
342
|
"level": 0,
|
|
341
343
|
"links": null,
|
|
342
344
|
"modelRef": 1,
|
|
343
345
|
"outEdges": [
|
|
344
|
-
"
|
|
346
|
+
"support:cloud.frontend.supportPanel",
|
|
345
347
|
],
|
|
346
348
|
"parent": null,
|
|
347
349
|
"shape": "person",
|
|
348
350
|
"style": {},
|
|
349
351
|
"tags": null,
|
|
350
352
|
"technology": null,
|
|
351
|
-
"title": "
|
|
353
|
+
"title": "support",
|
|
352
354
|
},
|
|
353
355
|
{
|
|
354
356
|
"children": [
|
|
355
|
-
"cloud.frontend.adminPanel",
|
|
356
357
|
"cloud.frontend.dashboard",
|
|
358
|
+
"cloud.frontend.supportPanel",
|
|
357
359
|
],
|
|
358
360
|
"color": "primary",
|
|
359
361
|
"depth": 1,
|
|
@@ -361,7 +363,7 @@ exports[`compute-element-view > view of cloud.frontend 1`] = `
|
|
|
361
363
|
"id": "cloud.frontend",
|
|
362
364
|
"inEdges": [
|
|
363
365
|
"customer:cloud.frontend.dashboard",
|
|
364
|
-
"support:cloud.frontend.
|
|
366
|
+
"support:cloud.frontend.supportPanel",
|
|
365
367
|
],
|
|
366
368
|
"kind": "container",
|
|
367
369
|
"level": 0,
|
|
@@ -369,7 +371,7 @@ exports[`compute-element-view > view of cloud.frontend 1`] = `
|
|
|
369
371
|
"modelRef": 1,
|
|
370
372
|
"outEdges": [
|
|
371
373
|
"cloud.frontend.dashboard:cloud.backend",
|
|
372
|
-
"cloud.frontend.
|
|
374
|
+
"cloud.frontend.supportPanel:cloud.backend",
|
|
373
375
|
],
|
|
374
376
|
"parent": null,
|
|
375
377
|
"shape": "browser",
|
|
@@ -382,50 +384,50 @@ exports[`compute-element-view > view of cloud.frontend 1`] = `
|
|
|
382
384
|
"children": [],
|
|
383
385
|
"color": "primary",
|
|
384
386
|
"description": null,
|
|
385
|
-
"
|
|
387
|
+
"icon": "tech:react",
|
|
388
|
+
"id": "cloud.frontend.dashboard",
|
|
386
389
|
"inEdges": [
|
|
387
|
-
"
|
|
390
|
+
"customer:cloud.frontend.dashboard",
|
|
388
391
|
],
|
|
389
392
|
"kind": "component",
|
|
390
393
|
"level": 1,
|
|
391
394
|
"links": null,
|
|
392
395
|
"modelRef": 1,
|
|
393
396
|
"outEdges": [
|
|
394
|
-
"cloud.frontend.
|
|
397
|
+
"cloud.frontend.dashboard:cloud.backend",
|
|
395
398
|
],
|
|
396
399
|
"parent": "cloud.frontend",
|
|
397
400
|
"shape": "rectangle",
|
|
398
401
|
"style": {},
|
|
399
402
|
"tags": [
|
|
400
|
-
"
|
|
403
|
+
"next",
|
|
401
404
|
],
|
|
402
405
|
"technology": null,
|
|
403
|
-
"title": "
|
|
406
|
+
"title": "dashboard",
|
|
404
407
|
},
|
|
405
408
|
{
|
|
406
409
|
"children": [],
|
|
407
410
|
"color": "primary",
|
|
408
411
|
"description": null,
|
|
409
|
-
"
|
|
410
|
-
"id": "cloud.frontend.dashboard",
|
|
412
|
+
"id": "cloud.frontend.supportPanel",
|
|
411
413
|
"inEdges": [
|
|
412
|
-
"
|
|
414
|
+
"support:cloud.frontend.supportPanel",
|
|
413
415
|
],
|
|
414
416
|
"kind": "component",
|
|
415
417
|
"level": 1,
|
|
416
418
|
"links": null,
|
|
417
419
|
"modelRef": 1,
|
|
418
420
|
"outEdges": [
|
|
419
|
-
"cloud.frontend.
|
|
421
|
+
"cloud.frontend.supportPanel:cloud.backend",
|
|
420
422
|
],
|
|
421
423
|
"parent": "cloud.frontend",
|
|
422
424
|
"shape": "rectangle",
|
|
423
425
|
"style": {},
|
|
424
426
|
"tags": [
|
|
425
|
-
"
|
|
427
|
+
"old",
|
|
426
428
|
],
|
|
427
429
|
"technology": null,
|
|
428
|
-
"title": "
|
|
430
|
+
"title": "adminPanel",
|
|
429
431
|
},
|
|
430
432
|
{
|
|
431
433
|
"children": [],
|
|
@@ -434,7 +436,7 @@ exports[`compute-element-view > view of cloud.frontend 1`] = `
|
|
|
434
436
|
"id": "cloud.backend",
|
|
435
437
|
"inEdges": [
|
|
436
438
|
"cloud.frontend.dashboard:cloud.backend",
|
|
437
|
-
"cloud.frontend.
|
|
439
|
+
"cloud.frontend.supportPanel:cloud.backend",
|
|
438
440
|
],
|
|
439
441
|
"kind": "container",
|
|
440
442
|
"level": 0,
|