@likec4/core 0.6.1 → 0.6.2

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.
Files changed (57) hide show
  1. package/package.json +3 -3
  2. package/dist/__test__/data.d.ts +0 -173
  3. package/dist/__test__/data.js +0 -188
  4. package/dist/__test__/index.d.ts +0 -1
  5. package/dist/__test__/index.js +0 -1
  6. package/dist/compute-view/EdgeBuilder.d.ts +0 -7
  7. package/dist/compute-view/EdgeBuilder.js +0 -34
  8. package/dist/compute-view/compute-view.d.ts +0 -11
  9. package/dist/compute-view/compute-view.js +0 -14
  10. package/dist/compute-view/compute.element-view.d.ts +0 -4
  11. package/dist/compute-view/compute.element-view.js +0 -168
  12. package/dist/compute-view/compute.element-view.spec.d.ts +0 -1
  13. package/dist/compute-view/compute.element-view.spec.js +0 -175
  14. package/dist/compute-view/index.d.ts +0 -2
  15. package/dist/compute-view/index.js +0 -1
  16. package/dist/compute-view/utils/anyPossibleRelations.d.ts +0 -2
  17. package/dist/compute-view/utils/anyPossibleRelations.js +0 -12
  18. package/dist/compute-view/utils/evaluate-expression.d.ts +0 -10
  19. package/dist/compute-view/utils/evaluate-expression.js +0 -186
  20. package/dist/compute-view/utils/sortNodes.d.ts +0 -2
  21. package/dist/compute-view/utils/sortNodes.js +0 -42
  22. package/dist/compute-view/utils/sortNodes.spec.d.ts +0 -1
  23. package/dist/compute-view/utils/sortNodes.spec.js +0 -267
  24. package/dist/index.d.ts +0 -4
  25. package/dist/index.js +0 -3
  26. package/dist/model-index/index.d.ts +0 -1
  27. package/dist/model-index/index.js +0 -1
  28. package/dist/model-index/model-index.d.ts +0 -30
  29. package/dist/model-index/model-index.js +0 -143
  30. package/dist/types/computed-view.d.ts +0 -30
  31. package/dist/types/computed-view.js +0 -1
  32. package/dist/types/diagram.d.ts +0 -27
  33. package/dist/types/diagram.js +0 -1
  34. package/dist/types/element.d.ts +0 -26
  35. package/dist/types/element.js +0 -5
  36. package/dist/types/expression.d.ts +0 -43
  37. package/dist/types/expression.js +0 -24
  38. package/dist/types/index.d.ts +0 -10
  39. package/dist/types/index.js +0 -2
  40. package/dist/types/model.d.ts +0 -9
  41. package/dist/types/model.js +0 -1
  42. package/dist/types/opaque.d.ts +0 -102
  43. package/dist/types/opaque.js +0 -1
  44. package/dist/types/relation.d.ts +0 -10
  45. package/dist/types/relation.js +0 -1
  46. package/dist/types/view.d.ts +0 -29
  47. package/dist/types/view.js +0 -9
  48. package/dist/utils/fqn.d.ts +0 -10
  49. package/dist/utils/fqn.js +0 -51
  50. package/dist/utils/fqn.spec.d.ts +0 -1
  51. package/dist/utils/fqn.spec.js +0 -47
  52. package/dist/utils/guards.d.ts +0 -3
  53. package/dist/utils/guards.js +0 -10
  54. package/dist/utils/index.d.ts +0 -3
  55. package/dist/utils/index.js +0 -3
  56. package/dist/utils/relations.d.ts +0 -16
  57. package/dist/utils/relations.js +0 -36
@@ -1,267 +0,0 @@
1
- import { Graph, alg } from '@dagrejs/graphlib';
2
- import { indexBy, pluck, toPairs } from 'rambdax';
3
- import { describe, expect, it } from 'vitest';
4
- import { commonAncestor, parentFqn } from '../../utils';
5
- import { sortNodes } from './sortNodes';
6
- describe('sortNodes', () => {
7
- it('should do topological sort', () => {
8
- const g = new Graph({
9
- compound: true,
10
- directed: true,
11
- multigraph: false
12
- });
13
- g.setNode('customer');
14
- g.setNode('cloud');
15
- g.setNode('cloud.frontend');
16
- g.setEdge('cloud', 'cloud.frontend');
17
- g.setNode('cloud.backend');
18
- g.setEdge('cloud', 'cloud.backend');
19
- g.setNode('cloud.backend.graphql');
20
- g.setEdge('cloud.backend', 'cloud.backend.graphql');
21
- g.setNode('cloud.backend.storage');
22
- g.setEdge('cloud.backend', 'cloud.backend.storage');
23
- g.setEdge('cloud.backend.graphql', 'cloud.backend.storage');
24
- g.setEdge('cloud.frontend', 'cloud.backend.graphql');
25
- g.setEdge('cloud.frontend', 'cloud.backend');
26
- g.setEdge('customer', 'cloud.frontend');
27
- g.setEdge('customer', 'cloud');
28
- expect(alg.topsort(g)).toEqual([
29
- 'customer',
30
- 'cloud',
31
- 'cloud.frontend',
32
- 'cloud.backend',
33
- 'cloud.backend.graphql',
34
- 'cloud.backend.storage'
35
- ]);
36
- });
37
- const testnodes = (_nodes, _edges = []) => {
38
- const nodesreg = indexBy(n => n.id, _nodes.map(nd => ({
39
- parent: null,
40
- children: [],
41
- ...nd
42
- })));
43
- const edges = _edges.map(([source, target]) => {
44
- let parent = commonAncestor(source, target);
45
- while (parent) {
46
- if (parent in nodesreg) {
47
- break;
48
- }
49
- parent = parentFqn(parent);
50
- }
51
- return {
52
- parent,
53
- source,
54
- target
55
- };
56
- });
57
- return sortNodes(new Map(toPairs(nodesreg)), edges);
58
- };
59
- const expectSorting = (_nodes, _edges = []) => expect(testnodes(_nodes, _edges).map(n => n.id));
60
- describe('two nodes inside', () => {
61
- const nodes = [
62
- {
63
- id: 'cloud'
64
- },
65
- {
66
- id: 'customer'
67
- },
68
- {
69
- id: 'cloud.backend',
70
- parent: 'cloud'
71
- },
72
- {
73
- id: 'cloud.frontend',
74
- parent: 'cloud'
75
- }
76
- ];
77
- it('should sort hierarchically, if no edges', () => {
78
- expectSorting(nodes).toEqual(['customer', 'cloud', 'cloud.backend', 'cloud.frontend']);
79
- });
80
- it('should sort nested nodes using edges', () => {
81
- expectSorting(nodes, [['cloud.frontend', 'cloud.backend']]).toEqual([
82
- 'customer',
83
- 'cloud',
84
- 'cloud.frontend',
85
- 'cloud.backend'
86
- ]);
87
- });
88
- it('should sort nodes using edges', () => {
89
- expectSorting(nodes, [
90
- ['customer', 'cloud.frontend'],
91
- ['cloud.frontend', 'cloud.backend']
92
- ]).toEqual(['customer', 'cloud', 'cloud.frontend', 'cloud.backend']);
93
- });
94
- });
95
- describe('three nodes inside', () => {
96
- const nodes = [
97
- {
98
- id: 'cloud'
99
- },
100
- {
101
- id: 'customer'
102
- },
103
- {
104
- id: 'amazon'
105
- },
106
- {
107
- id: 'cloud.db',
108
- parent: 'cloud'
109
- },
110
- {
111
- id: 'cloud.backend',
112
- parent: 'cloud'
113
- },
114
- {
115
- id: 'cloud.frontend',
116
- parent: 'cloud'
117
- }
118
- ];
119
- it('should sort hierarchically if no edges and source order', () => {
120
- const sorted = testnodes(nodes);
121
- expect(pluck('id', sorted)).toEqual([
122
- 'customer',
123
- 'amazon',
124
- 'cloud',
125
- 'cloud.db',
126
- 'cloud.backend',
127
- 'cloud.frontend'
128
- ]);
129
- const cloud = sorted[2];
130
- expect(cloud).toMatchObject({
131
- id: 'cloud',
132
- parent: null,
133
- children: ['cloud.db', 'cloud.backend', 'cloud.frontend']
134
- });
135
- });
136
- it('should sort nested nodes using edges', () => {
137
- const sorted = testnodes(nodes, [
138
- ['cloud.frontend', 'cloud.backend'],
139
- ['cloud.backend', 'cloud.db']
140
- ]);
141
- expect(pluck('id', sorted)).toEqual([
142
- 'customer',
143
- 'amazon',
144
- 'cloud',
145
- 'cloud.frontend',
146
- 'cloud.backend',
147
- 'cloud.db'
148
- ]);
149
- const cloud = sorted[2];
150
- expect(cloud).toMatchObject({
151
- id: 'cloud',
152
- parent: null,
153
- children: ['cloud.frontend', 'cloud.backend', 'cloud.db']
154
- });
155
- });
156
- it('should sort nodes using edges', () => {
157
- expectSorting(nodes, [
158
- ['customer', 'cloud.frontend'],
159
- ['cloud.frontend', 'cloud.backend'],
160
- ['cloud.backend', 'cloud.db'],
161
- ['cloud.db', 'amazon']
162
- ]).toEqual(['customer', 'cloud', 'cloud.frontend', 'cloud.backend', 'cloud.db', 'amazon']);
163
- });
164
- it('should sort nodes using edges and ignore cycles', () => {
165
- expectSorting(nodes, [
166
- ['customer', 'cloud.frontend'],
167
- ['cloud.frontend', 'cloud.backend'],
168
- ['cloud.backend', 'cloud.db'],
169
- ['cloud.db', 'amazon'],
170
- ['amazon', 'cloud.backend']
171
- ]).toEqual(['customer', 'cloud', 'cloud.frontend', 'cloud.backend', 'cloud.db', 'amazon']);
172
- });
173
- });
174
- describe('data from test model', () => {
175
- const nodes = [
176
- {
177
- id: 'amazon'
178
- },
179
- {
180
- id: 'cloud'
181
- },
182
- {
183
- id: 'customer'
184
- },
185
- {
186
- id: 'support'
187
- },
188
- {
189
- id: 'cloud.backend',
190
- parent: 'cloud'
191
- },
192
- {
193
- id: 'amazon.rds',
194
- parent: 'amazon'
195
- },
196
- {
197
- id: 'cloud.backend.graphql',
198
- parent: 'cloud.backend'
199
- },
200
- {
201
- id: 'cloud.backend.storage',
202
- parent: 'cloud.backend'
203
- },
204
- {
205
- id: 'cloud.frontend.adminPanel',
206
- parent: 'cloud'
207
- },
208
- {
209
- id: 'cloud.frontend.dashboard',
210
- parent: 'cloud'
211
- }
212
- ];
213
- it('should sort hierarchically, if no edges', () => {
214
- expectSorting(nodes).toEqual([
215
- 'customer',
216
- 'support',
217
- 'amazon',
218
- 'amazon.rds',
219
- 'cloud',
220
- 'cloud.backend',
221
- 'cloud.backend.graphql',
222
- 'cloud.backend.storage',
223
- 'cloud.frontend.adminPanel',
224
- 'cloud.frontend.dashboard'
225
- ]);
226
- });
227
- it('should sort using top level edges', () => {
228
- expectSorting(nodes, [
229
- ['amazon', 'support'],
230
- ['amazon', 'customer'],
231
- ['customer', 'support']
232
- ]).toEqual([
233
- 'amazon',
234
- 'customer',
235
- 'support',
236
- 'amazon.rds',
237
- 'cloud',
238
- 'cloud.backend',
239
- 'cloud.backend.graphql',
240
- 'cloud.backend.storage',
241
- 'cloud.frontend.adminPanel',
242
- 'cloud.frontend.dashboard'
243
- ]);
244
- });
245
- it('should sort using nested in/out edges', () => {
246
- expectSorting(nodes, [
247
- ['customer', 'cloud.frontend.dashboard'],
248
- ['support', 'cloud.frontend.adminPanel'],
249
- ['cloud.frontend.dashboard', 'cloud.backend.graphql'],
250
- ['cloud.frontend.adminPanel', 'cloud.backend.graphql'],
251
- ['cloud.backend.graphql', 'cloud.backend.storage'],
252
- ['cloud.backend.storage', 'amazon.rds']
253
- ]).toEqual([
254
- 'customer',
255
- 'support',
256
- 'cloud',
257
- 'cloud.frontend.dashboard',
258
- 'cloud.frontend.adminPanel',
259
- 'cloud.backend',
260
- 'cloud.backend.graphql',
261
- 'cloud.backend.storage',
262
- 'amazon',
263
- 'amazon.rds'
264
- ]);
265
- });
266
- });
267
- });
package/dist/index.d.ts DELETED
@@ -1,4 +0,0 @@
1
- export type * as likec4 from './types';
2
- export { computeView } from './compute-view';
3
- export * from './utils';
4
- export * from './model-index';
package/dist/index.js DELETED
@@ -1,3 +0,0 @@
1
- export { computeView } from './compute-view';
2
- export * from './utils';
3
- export * from './model-index';
@@ -1 +0,0 @@
1
- export * from './model-index';
@@ -1 +0,0 @@
1
- export * from './model-index';
@@ -1,30 +0,0 @@
1
- import type { Predicate } from 'rambdax';
2
- import type { Element, ElementView, Fqn, Relation, RelationID, ViewID } from '../types';
3
- type ModelInput = {
4
- elements: Record<Fqn, Element>;
5
- relations: Record<RelationID, Relation>;
6
- views: Record<ViewID, ElementView>;
7
- };
8
- export declare class ModelIndex {
9
- private root;
10
- private _elements;
11
- private _relations;
12
- private _defaultElementView;
13
- get relations(): Relation[];
14
- filterRelations: (predicate: Predicate<Relation>) => Relation[];
15
- static from({ elements, relations, views }: ModelInput): ModelIndex;
16
- addElement(el: Element): void;
17
- private locateTrie;
18
- find: (id: Fqn) => Element;
19
- children: (id: Fqn) => Element[];
20
- siblings: (id: Fqn) => Element[];
21
- /**
22
- * Ancestors from closest parent to root
23
- */
24
- ancestors: (id: Fqn) => Element[];
25
- rootElements(): Element[];
26
- get elements(): Element[];
27
- addRelation(rel: Relation): void;
28
- defaultViewOf: (id: Fqn) => ViewID[];
29
- }
30
- export {};
@@ -1,143 +0,0 @@
1
- import { values } from 'rambdax';
2
- import invariant from 'tiny-invariant';
3
- import { parentFqn } from '../utils/fqn';
4
- function childrenOf(trie) {
5
- const children = [];
6
- for (const { el } of values(trie.children)) {
7
- if (el) {
8
- children.push(el);
9
- }
10
- }
11
- return children;
12
- }
13
- function asPath(id) {
14
- return id.split('.');
15
- }
16
- export class ModelIndex {
17
- root = {
18
- children: {}
19
- };
20
- _elements = new Set();
21
- _relations = new Map();
22
- _defaultElementView = new Map();
23
- // private _taggedElements = new Map<Tag, Set<Element>>()
24
- // private _taggedRelations = new Map<Tag, Set<Relation>>()
25
- get relations() {
26
- return [...this._relations.values()];
27
- }
28
- filterRelations = (predicate) => {
29
- return [...this._relations.values()].filter(predicate);
30
- };
31
- static from({ elements, relations, views }) {
32
- const index = new ModelIndex();
33
- for (const el of Object.values(elements)) {
34
- index.addElement(el);
35
- }
36
- for (const rel of Object.values(relations)) {
37
- index.addRelation(rel);
38
- }
39
- for (const { id, viewOf } of Object.values(views)) {
40
- if (viewOf) {
41
- const views = index._defaultElementView.get(viewOf) ?? [];
42
- views.push(id);
43
- index._defaultElementView.set(viewOf, views);
44
- }
45
- }
46
- return index;
47
- }
48
- addElement(el) {
49
- const path = asPath(el.id);
50
- let scope = this.root;
51
- for (const name of path) {
52
- const next = scope.children[name] ?? {
53
- children: {}
54
- };
55
- scope.children[name] = next;
56
- scope = next;
57
- }
58
- scope.el = el;
59
- this._elements.add(el);
60
- }
61
- locateTrie = (id) => {
62
- let scope = this.root;
63
- for (const name of asPath(id)) {
64
- const next = scope.children[name];
65
- invariant(next, `Invalid index, Element not found at path ${name} of ${id}`);
66
- scope = next;
67
- }
68
- return scope;
69
- };
70
- find = (id) => {
71
- const trie = this.locateTrie(id);
72
- if (!trie.el) {
73
- throw new Error(`Invalid index, element not found at path ${id}`);
74
- }
75
- return trie.el;
76
- };
77
- children = (id) => {
78
- return childrenOf(this.locateTrie(id));
79
- };
80
- siblings = (id) => {
81
- const parent = parentFqn(id);
82
- const trie = parent ? this.locateTrie(parent) : this.root;
83
- return childrenOf(trie).filter(e => e.id !== id);
84
- };
85
- /**
86
- * Ancestors from closest parent to root
87
- */
88
- ancestors = (id) => {
89
- const path = asPath(id);
90
- const ancestors = [];
91
- // The root
92
- if (path.length === 1) {
93
- return ancestors;
94
- }
95
- // Remove the element itself
96
- path.pop();
97
- let name = path.shift();
98
- let trie = this.root;
99
- while (name) {
100
- const next = trie.children[name];
101
- invariant(next, `Invalid index, Element not found at path ${name} of ${id}`);
102
- trie = next;
103
- if (!trie.el) {
104
- throw new Error(`invalid index, no element ${name} found in ${id}`);
105
- }
106
- ancestors.unshift(trie.el);
107
- name = path.shift();
108
- }
109
- return ancestors;
110
- };
111
- // tagged = (tag?: Tag): TaggedResult => {
112
- // return tag ? {
113
- // elements: [...this._taggedElements.get(tag)?.values() ?? []],
114
- // relations: [...this._taggedRelations.get(tag)?.values() ?? []],
115
- // } : {
116
- // elements: uniq([...this._taggedElements.values()].flatMap(s => [...s.values()])),
117
- // relations: uniq([...this._taggedRelations.values()].flatMap(s => [...s.values()]))
118
- // }
119
- // }
120
- rootElements() {
121
- return childrenOf(this.root);
122
- }
123
- get elements() {
124
- return [...this._elements];
125
- }
126
- // hasElement(fqn: Fqn): boolean {
127
- // return fqn in this._elements
128
- // }
129
- addRelation(rel) {
130
- // Validate source and target
131
- this.locateTrie(rel.source);
132
- this.locateTrie(rel.target);
133
- this._relations.set(rel.id, rel);
134
- // for (const tag of rel.tags) {
135
- // const tagged = this._taggedRelations.get(tag) ?? new Set()
136
- // tagged.add(rel)
137
- // this._taggedRelations.set(tag, tagged)
138
- // }
139
- }
140
- defaultViewOf = (id) => {
141
- return this._defaultElementView.get(id) ?? [];
142
- };
143
- }
@@ -1,30 +0,0 @@
1
- import type { Opaque } from './opaque';
2
- import type { ElementShape, Fqn, ThemeColor } from './element';
3
- import type { RelationID } from './relation';
4
- import type { ElementView, ViewID, ViewRuleAutoLayout } from './view';
5
- export type NodeId = Fqn;
6
- export type EdgeId = Opaque<string, 'EdgeId'>;
7
- export interface ComputedNode {
8
- id: NodeId;
9
- parent: NodeId | null;
10
- title: string;
11
- description?: string;
12
- technology?: string;
13
- children: NodeId[];
14
- shape: ElementShape;
15
- color: ThemeColor;
16
- navigateTo?: ViewID;
17
- }
18
- export interface ComputedEdge {
19
- id: EdgeId;
20
- parent: NodeId | null;
21
- source: NodeId;
22
- target: NodeId;
23
- label: string | null;
24
- relations: RelationID[];
25
- }
26
- export interface ComputedView<Node extends ComputedNode = ComputedNode, Edge extends ComputedEdge = ComputedEdge> extends ElementView {
27
- autoLayout: ViewRuleAutoLayout['autoLayout'];
28
- nodes: Node[];
29
- edges: Edge[];
30
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,27 +0,0 @@
1
- import type { ComputedEdge, ComputedNode, ComputedView } from './computed-view';
2
- export type Point = [x: number, y: number];
3
- export interface DiagramLabel {
4
- align: 'left' | 'right' | 'center';
5
- fontStyle?: 'bold' | 'normal';
6
- fontSize: number;
7
- pt: Point;
8
- width: number;
9
- text: string;
10
- }
11
- export interface DiagramNode extends ComputedNode {
12
- size: {
13
- width: number;
14
- height: number;
15
- };
16
- labels: DiagramLabel[];
17
- position: Point;
18
- }
19
- export interface DiagramEdge extends ComputedEdge {
20
- points: Point[];
21
- headArrow?: Point[];
22
- labels: DiagramLabel[];
23
- }
24
- export interface DiagramView extends ComputedView<DiagramNode, DiagramEdge> {
25
- width: number;
26
- height: number;
27
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,26 +0,0 @@
1
- import type { Opaque } from './opaque';
2
- export type Fqn = Opaque<string, 'Fqn'>;
3
- export declare function Fqn(name: string, parent?: Fqn | null): Fqn;
4
- export type ElementKind = Opaque<string, 'ElementKind'>;
5
- export type ThemeColor = 'primary' | 'secondary' | 'muted';
6
- export type ElementShape = 'rectangle' | 'person' | 'browser' | 'cylinder' | 'storage' | 'queue';
7
- export declare const DefaultThemeColor: ThemeColor;
8
- export declare const DefaultElementShape: ElementShape;
9
- export interface ElementStyle {
10
- shape?: ElementShape;
11
- }
12
- export type Tag = Opaque<string, 'Tag'>;
13
- export interface TagSpec {
14
- readonly id: Tag;
15
- readonly style: ElementStyle;
16
- }
17
- export interface Element {
18
- readonly id: Fqn;
19
- readonly kind: ElementKind;
20
- readonly title: string;
21
- readonly description?: string;
22
- readonly technology?: string;
23
- readonly tags?: Tag[];
24
- readonly shape?: ElementShape;
25
- readonly color?: ThemeColor;
26
- }
@@ -1,5 +0,0 @@
1
- export function Fqn(name, parent) {
2
- return (parent ? parent + '.' + name : name);
3
- }
4
- export const DefaultThemeColor = 'primary';
5
- export const DefaultElementShape = 'rectangle';
@@ -1,43 +0,0 @@
1
- import type { Fqn } from './element';
2
- interface BaseExr {
3
- element?: never;
4
- isDescedants?: never;
5
- wildcard?: never;
6
- source?: never;
7
- target?: never;
8
- inout?: never;
9
- incoming?: never;
10
- outgoing?: never;
11
- }
12
- export interface ElementRefExpr extends Omit<BaseExr, 'element' | 'isDescedants'> {
13
- element: Fqn;
14
- isDescedants: boolean;
15
- }
16
- export declare function isElementRef(expr: Expression): expr is ElementRefExpr;
17
- export interface WildcardExpr extends Omit<BaseExr, 'wildcard'> {
18
- wildcard: true;
19
- }
20
- export declare function isWildcard(expr: Expression): expr is WildcardExpr;
21
- export type ElementExpression = ElementRefExpr | WildcardExpr;
22
- export declare function isElement(expr: Expression): expr is ElementExpression;
23
- export interface RelationExpr extends Omit<BaseExr, 'source' | 'target'> {
24
- source: ElementExpression;
25
- target: ElementExpression;
26
- }
27
- export declare function isRelation(expr: Expression): expr is RelationExpr;
28
- export interface InOutExpr extends Omit<BaseExr, 'inout'> {
29
- inout: ElementExpression;
30
- }
31
- export declare function isInOut(expr: Expression): expr is InOutExpr;
32
- export interface IncomingExpr extends Omit<BaseExr, 'incoming'> {
33
- incoming: ElementExpression;
34
- }
35
- export declare function isIncoming(expr: Expression): expr is IncomingExpr;
36
- export interface OutgoingExpr extends Omit<BaseExr, 'outgoing'> {
37
- outgoing: ElementExpression;
38
- }
39
- export declare function isOutgoing(expr: Expression): expr is OutgoingExpr;
40
- export type AnyRelationExpression = RelationExpr | InOutExpr | IncomingExpr | OutgoingExpr;
41
- export declare function isAnyRelation(expr: Expression): expr is AnyRelationExpression;
42
- export type Expression = ElementExpression | AnyRelationExpression;
43
- export {};
@@ -1,24 +0,0 @@
1
- export function isElementRef(expr) {
2
- return 'element' in expr && 'isDescedants' in expr;
3
- }
4
- export function isWildcard(expr) {
5
- return 'wildcard' in expr;
6
- }
7
- export function isElement(expr) {
8
- return isElementRef(expr) || isWildcard(expr);
9
- }
10
- export function isRelation(expr) {
11
- return 'source' in expr && 'target' in expr;
12
- }
13
- export function isInOut(expr) {
14
- return 'inout' in expr;
15
- }
16
- export function isIncoming(expr) {
17
- return 'incoming' in expr;
18
- }
19
- export function isOutgoing(expr) {
20
- return 'outgoing' in expr;
21
- }
22
- export function isAnyRelation(expr) {
23
- return isRelation(expr) || isInOut(expr) || isIncoming(expr) || isOutgoing(expr);
24
- }
@@ -1,10 +0,0 @@
1
- export { Fqn, DefaultThemeColor, DefaultElementShape } from './element';
2
- export { isViewRuleExpression, isViewRuleStyle } from './view';
3
- export type * from './opaque';
4
- export type * from './element';
5
- export type * from './relation';
6
- export type * from './model';
7
- export type * from './view';
8
- export type * from './expression';
9
- export type * from './computed-view';
10
- export type * from './diagram';
@@ -1,2 +0,0 @@
1
- export { Fqn, DefaultThemeColor, DefaultElementShape } from './element';
2
- export { isViewRuleExpression, isViewRuleStyle } from './view';
@@ -1,9 +0,0 @@
1
- import type { Fqn, Element } from './element';
2
- import type { RelationID, Relation } from './relation';
3
- import type { ViewID } from './view';
4
- import type { ComputedView } from '../compute-view';
5
- export interface LikeC4Model {
6
- elements: Record<Fqn, Element>;
7
- relations: Record<RelationID, Relation>;
8
- views: Record<ViewID, ComputedView>;
9
- }
@@ -1 +0,0 @@
1
- export {};