@likec4/core 0.7.0 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/colors.d.ts +79 -0
- package/dist/colors.js +94 -0
- package/dist/compute-view/EdgeBuilder.js +1 -1
- package/dist/compute-view/compute-ctx.d.ts +18 -0
- package/dist/compute-view/compute-ctx.js +25 -0
- package/dist/compute-view/compute-element-view.d.ts +4 -0
- package/dist/compute-view/compute-element-view.js +416 -0
- package/dist/compute-view/compute.d.ts +1 -2
- package/dist/compute-view/compute.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/model-index/ModelIndex.js +3 -3
- package/dist/types/diagram.d.ts +6 -0
- package/dist/types/element.d.ts +2 -2
- package/dist/utils/compute-node-levels.d.ts +8 -0
- package/dist/utils/compute-node-levels.js +31 -0
- package/dist/utils/fqn.d.ts +2 -0
- package/dist/utils/fqn.js +22 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +1 -0
- package/dist/utils/relations.d.ts +2 -1
- package/dist/utils/relations.js +10 -4
- package/package.json +18 -10
- package/dist/__test__/data.d.ts +0 -174
- package/dist/__test__/data.js +0 -188
- package/dist/__test__/index.d.ts +0 -2
- package/dist/__test__/index.js +0 -1
- package/dist/compute-view/compute.element-view.d.ts +0 -5
- package/dist/compute-view/compute.element-view.js +0 -168
- package/dist/compute-view/utils/evaluate-expression.d.ts +0 -11
- package/dist/compute-view/utils/evaluate-expression.js +0 -186
package/dist/types/diagram.d.ts
CHANGED
|
@@ -24,5 +24,11 @@ export interface DiagramEdge extends ComputedEdge {
|
|
|
24
24
|
export interface DiagramView extends ComputedView<DiagramNode, DiagramEdge> {
|
|
25
25
|
width: number;
|
|
26
26
|
height: number;
|
|
27
|
+
boundingBox: {
|
|
28
|
+
x: number;
|
|
29
|
+
y: number;
|
|
30
|
+
width: number;
|
|
31
|
+
height: number;
|
|
32
|
+
};
|
|
27
33
|
}
|
|
28
34
|
//# sourceMappingURL=diagram.d.ts.map
|
package/dist/types/element.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import type { Opaque } from './opaque';
|
|
|
2
2
|
export type Fqn = Opaque<string, 'Fqn'>;
|
|
3
3
|
export declare function Fqn(name: string, parent?: Fqn | null): Fqn;
|
|
4
4
|
export type ElementKind = Opaque<string, 'ElementKind'>;
|
|
5
|
-
export type ThemeColor = 'primary' | 'secondary' | '
|
|
6
|
-
export type ElementShape = 'rectangle' | 'person' | 'browser' | 'cylinder' | 'storage' | 'queue';
|
|
5
|
+
export type ThemeColor = 'amber' | 'blue' | 'gray' | 'slate' | 'green' | 'indigo' | 'muted' | 'primary' | 'red' | 'secondary' | 'sky';
|
|
6
|
+
export type ElementShape = 'rectangle' | 'person' | 'browser' | 'mobile' | 'cylinder' | 'storage' | 'queue';
|
|
7
7
|
export declare const DefaultThemeColor: ThemeColor;
|
|
8
8
|
export declare const DefaultElementShape: ElementShape;
|
|
9
9
|
export interface ElementStyle {
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ComputedView } from '../types/computed-view';
|
|
2
|
+
type NodeLevelDepth = {
|
|
3
|
+
level: number;
|
|
4
|
+
depth: number;
|
|
5
|
+
};
|
|
6
|
+
export declare const computeNodeLevels: ({ nodes }: ComputedView) => Record<import("..").Fqn, NodeLevelDepth>;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=compute-node-levels.d.ts.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import invariant from 'tiny-invariant';
|
|
2
|
+
export const computeNodeLevels = ({ nodes }) => {
|
|
3
|
+
const nodeLevels = {};
|
|
4
|
+
const compute = (node, level) => {
|
|
5
|
+
let levels = nodeLevels[node.id];
|
|
6
|
+
if (levels) {
|
|
7
|
+
return levels;
|
|
8
|
+
}
|
|
9
|
+
if (node.children.length === 0) {
|
|
10
|
+
levels = { level, depth: 0 };
|
|
11
|
+
nodeLevels[node.id] = levels;
|
|
12
|
+
return levels;
|
|
13
|
+
}
|
|
14
|
+
let depth = 1;
|
|
15
|
+
for (const childId of node.children) {
|
|
16
|
+
const child = nodes.find(n => n.id === childId);
|
|
17
|
+
invariant(child, `Child ${childId} not found`);
|
|
18
|
+
const { depth: childDepth } = compute(child, level + 1);
|
|
19
|
+
depth = Math.max(childDepth + 1, depth);
|
|
20
|
+
}
|
|
21
|
+
levels = { level, depth };
|
|
22
|
+
nodeLevels[node.id] = levels;
|
|
23
|
+
return levels;
|
|
24
|
+
};
|
|
25
|
+
for (const node of nodes) {
|
|
26
|
+
if (!node.parent) {
|
|
27
|
+
compute(node, 0);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return nodeLevels;
|
|
31
|
+
};
|
package/dist/utils/fqn.d.ts
CHANGED
|
@@ -2,6 +2,8 @@ import type { Element, Fqn } from '../types';
|
|
|
2
2
|
export declare function nameFromFqn(fqn: Fqn): string;
|
|
3
3
|
export declare function isAncestor(...args: [ancestor: Fqn, another: Fqn] | [ancestor: Element, another: Element]): boolean;
|
|
4
4
|
export declare function isSameHierarchy(...args: [one: Fqn, another: Fqn] | [one: Element, another: Element]): boolean;
|
|
5
|
+
export declare function isDescendantOf(ancestors: Element[]): (e: Element) => boolean;
|
|
6
|
+
export declare function notDescendantOf(ancestors: Element[]): (e: Element) => boolean;
|
|
5
7
|
export declare function commonAncestor(first: Fqn, second: Fqn): Fqn | null;
|
|
6
8
|
export declare function parentFqn(fqn: Fqn): Fqn | null;
|
|
7
9
|
export declare const compareFqnHierarchically: (a: string, b: string) => number;
|
package/dist/utils/fqn.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { anyPass } from 'rambdax';
|
|
1
2
|
import { isString } from './guards';
|
|
2
3
|
export function nameFromFqn(fqn) {
|
|
3
4
|
const lastDot = fqn.lastIndexOf('.');
|
|
@@ -18,7 +19,26 @@ export function isSameHierarchy(...args) {
|
|
|
18
19
|
const another = isString(args[1]) ? args[1] : args[1].id;
|
|
19
20
|
return one === another || another.startsWith(one + '.') || one.startsWith(another + '.');
|
|
20
21
|
}
|
|
22
|
+
export function isDescendantOf(ancestors) {
|
|
23
|
+
const predicates = ancestors.flatMap(a => [
|
|
24
|
+
(e) => e.id === a.id,
|
|
25
|
+
(e) => isAncestor(a, e)
|
|
26
|
+
]);
|
|
27
|
+
return anyPass(predicates);
|
|
28
|
+
}
|
|
29
|
+
export function notDescendantOf(ancestors) {
|
|
30
|
+
const isDescendant = isDescendantOf(ancestors);
|
|
31
|
+
return (e) => !isDescendant(e);
|
|
32
|
+
}
|
|
21
33
|
export function commonAncestor(first, second) {
|
|
34
|
+
const parentA = parentFqn(first);
|
|
35
|
+
const parentB = parentFqn(second);
|
|
36
|
+
if (parentA === parentB) {
|
|
37
|
+
return parentA;
|
|
38
|
+
}
|
|
39
|
+
if (!parentA || !parentB) {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
22
42
|
const a = first.split('.');
|
|
23
43
|
const b = second.split('.');
|
|
24
44
|
let ancestor = null;
|
|
@@ -40,7 +60,8 @@ export const compareFqnHierarchically = (a, b) => {
|
|
|
40
60
|
const depthA = a.split('.').length;
|
|
41
61
|
const depthB = b.split('.').length;
|
|
42
62
|
if (depthA === depthB) {
|
|
43
|
-
return a.localeCompare(b)
|
|
63
|
+
// return a.localeCompare(b)
|
|
64
|
+
return 0;
|
|
44
65
|
}
|
|
45
66
|
else {
|
|
46
67
|
return depthA - depthB;
|
package/dist/utils/index.d.ts
CHANGED
package/dist/utils/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Fqn } from '../types';
|
|
1
|
+
import type { Fqn, Element } from '../types';
|
|
2
2
|
type Relation = {
|
|
3
3
|
source: Fqn;
|
|
4
4
|
target: Fqn;
|
|
@@ -13,5 +13,6 @@ export declare const isAnyBetween: (source: Fqn, target: Fqn) => import("rambdax
|
|
|
13
13
|
export declare const isIncoming: (target: Fqn) => (rel: Relation) => boolean;
|
|
14
14
|
export declare const isOutgoing: (source: Fqn) => (rel: Relation) => boolean;
|
|
15
15
|
export declare const isAnyInOut: (source: Fqn) => import("rambdax").Predicate<Relation>;
|
|
16
|
+
export declare const hasRelation: (rel: Relation) => (element: Element) => boolean;
|
|
16
17
|
export {};
|
|
17
18
|
//# sourceMappingURL=relations.d.ts.map
|
package/dist/utils/relations.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { either } from 'rambdax';
|
|
2
|
-
import { compareFqnHierarchically } from './fqn';
|
|
2
|
+
import { compareFqnHierarchically, isAncestor } from './fqn';
|
|
3
3
|
export const compareRelations = (a, b) => {
|
|
4
4
|
return (compareFqnHierarchically(a.source, b.source) || compareFqnHierarchically(a.target, b.target));
|
|
5
5
|
};
|
|
@@ -13,7 +13,8 @@ export const isBetween = (source, target) => {
|
|
|
13
13
|
const sourcePrefix = source + '.';
|
|
14
14
|
const targetPrefix = target + '.';
|
|
15
15
|
return (rel) => {
|
|
16
|
-
return ((rel.source
|
|
16
|
+
return ((rel.source === source || (rel.source + '.').startsWith(sourcePrefix)) &&
|
|
17
|
+
(rel.target === target || (rel.target + '.').startsWith(targetPrefix)));
|
|
17
18
|
};
|
|
18
19
|
};
|
|
19
20
|
export const isAnyBetween = (source, target) => {
|
|
@@ -22,15 +23,20 @@ export const isAnyBetween = (source, target) => {
|
|
|
22
23
|
export const isIncoming = (target) => {
|
|
23
24
|
const targetPrefix = target + '.';
|
|
24
25
|
return (rel) => {
|
|
25
|
-
return (!(rel.source + '.').startsWith(targetPrefix) && (rel.target + '.').startsWith(targetPrefix));
|
|
26
|
+
return (!(rel.source + '.').startsWith(targetPrefix) && (rel.target === target || (rel.target + '.').startsWith(targetPrefix)));
|
|
26
27
|
};
|
|
27
28
|
};
|
|
28
29
|
export const isOutgoing = (source) => {
|
|
29
30
|
const sourcePrefix = source + '.';
|
|
30
31
|
return (rel) => {
|
|
31
|
-
return ((rel.source + '.').startsWith(sourcePrefix) && !(rel.target + '.').startsWith(sourcePrefix));
|
|
32
|
+
return ((rel.source === source || (rel.source + '.').startsWith(sourcePrefix)) && !(rel.target + '.').startsWith(sourcePrefix));
|
|
32
33
|
};
|
|
33
34
|
};
|
|
34
35
|
export const isAnyInOut = (source) => {
|
|
35
36
|
return either(isIncoming(source), isOutgoing(source));
|
|
36
37
|
};
|
|
38
|
+
export const hasRelation = (rel) => {
|
|
39
|
+
return (element) => {
|
|
40
|
+
return isAncestor(rel.source, element.id) || isAncestor(rel.target, element.id);
|
|
41
|
+
};
|
|
42
|
+
};
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@likec4/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"bugs": "https://github.com/likec4/likec4/issues",
|
|
6
6
|
"homepage": "https://likec4.dev",
|
|
7
7
|
"author": "Denis Davydkov <denis@davydkov.com>",
|
|
8
8
|
"files": [
|
|
9
9
|
"dist",
|
|
10
|
-
"
|
|
11
|
-
"!**/*.spec
|
|
10
|
+
"!dist/__test__",
|
|
11
|
+
"!**/*.spec.*",
|
|
12
12
|
"!**/*.map"
|
|
13
13
|
],
|
|
14
14
|
"repository": {
|
|
@@ -21,11 +21,11 @@
|
|
|
21
21
|
"build": "tsc",
|
|
22
22
|
"dev": "tsc --watch",
|
|
23
23
|
"lint": "run -T eslint src/ --fix",
|
|
24
|
-
"test": "vitest run",
|
|
25
|
-
"test:watch": "vitest",
|
|
24
|
+
"test": "run -T vitest run",
|
|
25
|
+
"test:watch": "run -T vitest",
|
|
26
26
|
"clean": "run -T rimraf dist"
|
|
27
27
|
},
|
|
28
|
-
"
|
|
28
|
+
"module": "./dist/index.js",
|
|
29
29
|
"types": "./dist/index.d.ts",
|
|
30
30
|
"type": "module",
|
|
31
31
|
"exports": {
|
|
@@ -39,6 +39,11 @@
|
|
|
39
39
|
"import": "./dist/types/index.js",
|
|
40
40
|
"default": "./dist/types/index.js"
|
|
41
41
|
},
|
|
42
|
+
"./colors": {
|
|
43
|
+
"types": "./dist/colors.d.ts",
|
|
44
|
+
"import": "./dist/colors.js",
|
|
45
|
+
"default": "./dist/colors.js"
|
|
46
|
+
},
|
|
42
47
|
"./utils": {
|
|
43
48
|
"types": "./dist/utils/index.d.ts",
|
|
44
49
|
"import": "./dist/utils/index.js",
|
|
@@ -54,7 +59,7 @@
|
|
|
54
59
|
"publishConfig": {
|
|
55
60
|
"registry": "https://registry.npmjs.org",
|
|
56
61
|
"access": "public",
|
|
57
|
-
"
|
|
62
|
+
"module": "./dist/index.js",
|
|
58
63
|
"types": "./dist/index.d.ts",
|
|
59
64
|
"exports": {
|
|
60
65
|
".": {
|
|
@@ -67,6 +72,11 @@
|
|
|
67
72
|
"import": "./dist/types/index.js",
|
|
68
73
|
"default": "./dist/types/index.js"
|
|
69
74
|
},
|
|
75
|
+
"./colors": {
|
|
76
|
+
"types": "./dist/colors.d.ts",
|
|
77
|
+
"import": "./dist/colors.js",
|
|
78
|
+
"default": "./dist/colors.js"
|
|
79
|
+
},
|
|
70
80
|
"./utils": {
|
|
71
81
|
"types": "./dist/utils/index.d.ts",
|
|
72
82
|
"import": "./dist/utils/index.js",
|
|
@@ -85,8 +95,6 @@
|
|
|
85
95
|
"tiny-invariant": "^1.3.1"
|
|
86
96
|
},
|
|
87
97
|
"devDependencies": {
|
|
88
|
-
"typescript": "^5.
|
|
89
|
-
"vite": "^4.3.3",
|
|
90
|
-
"vitest": "^0.31.0"
|
|
98
|
+
"typescript": "^5.1.3"
|
|
91
99
|
}
|
|
92
100
|
}
|
package/dist/__test__/data.d.ts
DELETED
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
import { ModelIndex } from '../model-index';
|
|
2
|
-
import type { ElementKind, ElementView, Fqn, RelationID } from '../types';
|
|
3
|
-
/**
|
|
4
|
-
┌──────────────────────────────────────────────────┐
|
|
5
|
-
│ cloud │
|
|
6
|
-
│ ┌───────────────────────────────────────────┐ │
|
|
7
|
-
│ │ frontend │ │
|
|
8
|
-
┏━━━━━━━━━━┓ │ │ ┏━━━━━━━━━━━━━┓ ┏━━━━━━━━━━━━━━━━┓ │ │ ┏━━━━━━━━━━━┓
|
|
9
|
-
┃ ┃ │ │ ┃ ┃ ┃ ┃ │ │ ┃ ┃
|
|
10
|
-
┃ customer ┃──┼──┼──▶┃ dashboard ┃ ┃ adminpanel ┃◀───┼───┼───┃ support ┃
|
|
11
|
-
┃ ┃ │ │ ┃ ┃ ┃ ┃ │ │ ┃ ┃
|
|
12
|
-
┗━━━━━━━━━━┛ │ │ ┗━━━━━━┳━━━━━━┛ ┗━━━━━━━━┳━━━━━━━┛ │ │ ┗━━━━━━━━━━━┛
|
|
13
|
-
│ └──────────┼───────────────────┼────────────┘ │
|
|
14
|
-
│ ├───────────────────┘ │
|
|
15
|
-
│ │ │
|
|
16
|
-
│ ┌──────────┼────────────────────────────────┐ │
|
|
17
|
-
│ │ ▼ backend │ │
|
|
18
|
-
│ │ ┏━━━━━━━━━━━━━┓ ┏━━━━━━━━━━━━━┓ │ │
|
|
19
|
-
│ │ ┃ ┃ ┃ ┃ │ │
|
|
20
|
-
│ │ ┃ graphlql ┃──────▶┃ storage ┃ │ │
|
|
21
|
-
│ │ ┃ ┃ ┃ ┃ │ │
|
|
22
|
-
│ │ ┗━━━━━━━━━━━━━┛ ┗━━━━━━┳━━━━━━┛ │ │
|
|
23
|
-
│ └────────────────────────────────┼──────────┘ │
|
|
24
|
-
└───────────────────────────────────┼──────────────┘
|
|
25
|
-
│
|
|
26
|
-
┌─────────┼─────────┐
|
|
27
|
-
│ amazon │ │
|
|
28
|
-
│ ▼ │
|
|
29
|
-
│ ┏━━━━━━━━━━━━━━┓ │
|
|
30
|
-
│ ┃ ┃ │
|
|
31
|
-
│ ┃ s3 ┃ │
|
|
32
|
-
│ ┃ ┃ │
|
|
33
|
-
│ ┗━━━━━━━━━━━━━━┛ │
|
|
34
|
-
└───────────────────┘
|
|
35
|
-
|
|
36
|
-
specification {
|
|
37
|
-
element actor
|
|
38
|
-
element system
|
|
39
|
-
element component
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
model {
|
|
43
|
-
|
|
44
|
-
actor customer
|
|
45
|
-
actor support
|
|
46
|
-
|
|
47
|
-
system cloud {
|
|
48
|
-
component backend {
|
|
49
|
-
component graphql
|
|
50
|
-
component storage
|
|
51
|
-
|
|
52
|
-
graphql -> storage
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
component frontend {
|
|
56
|
-
component dashboard {
|
|
57
|
-
-> graphql
|
|
58
|
-
}
|
|
59
|
-
component adminPanel {
|
|
60
|
-
-> graphql
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
customer -> dashboard
|
|
66
|
-
support -> adminPanel
|
|
67
|
-
|
|
68
|
-
system amazon {
|
|
69
|
-
component s3
|
|
70
|
-
|
|
71
|
-
cloud.backend.storage -> s3
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
*/
|
|
77
|
-
export declare const fakeElements: {
|
|
78
|
-
amazon: {
|
|
79
|
-
id: Fqn;
|
|
80
|
-
kind: ElementKind;
|
|
81
|
-
title: string;
|
|
82
|
-
};
|
|
83
|
-
cloud: {
|
|
84
|
-
id: Fqn;
|
|
85
|
-
kind: ElementKind;
|
|
86
|
-
title: string;
|
|
87
|
-
};
|
|
88
|
-
customer: {
|
|
89
|
-
id: Fqn;
|
|
90
|
-
kind: ElementKind;
|
|
91
|
-
title: string;
|
|
92
|
-
};
|
|
93
|
-
support: {
|
|
94
|
-
id: Fqn;
|
|
95
|
-
kind: ElementKind;
|
|
96
|
-
title: string;
|
|
97
|
-
};
|
|
98
|
-
'amazon.s3': {
|
|
99
|
-
id: Fqn;
|
|
100
|
-
kind: ElementKind;
|
|
101
|
-
title: string;
|
|
102
|
-
};
|
|
103
|
-
'cloud.backend': {
|
|
104
|
-
id: Fqn;
|
|
105
|
-
kind: ElementKind;
|
|
106
|
-
title: string;
|
|
107
|
-
};
|
|
108
|
-
'cloud.frontend': {
|
|
109
|
-
id: Fqn;
|
|
110
|
-
kind: ElementKind;
|
|
111
|
-
title: string;
|
|
112
|
-
};
|
|
113
|
-
'cloud.backend.graphql': {
|
|
114
|
-
id: Fqn;
|
|
115
|
-
kind: ElementKind;
|
|
116
|
-
title: string;
|
|
117
|
-
};
|
|
118
|
-
'cloud.backend.storage': {
|
|
119
|
-
id: Fqn;
|
|
120
|
-
kind: ElementKind;
|
|
121
|
-
title: string;
|
|
122
|
-
};
|
|
123
|
-
'cloud.frontend.adminPanel': {
|
|
124
|
-
id: Fqn;
|
|
125
|
-
kind: ElementKind;
|
|
126
|
-
title: string;
|
|
127
|
-
};
|
|
128
|
-
'cloud.frontend.dashboard': {
|
|
129
|
-
id: Fqn;
|
|
130
|
-
kind: ElementKind;
|
|
131
|
-
title: string;
|
|
132
|
-
};
|
|
133
|
-
};
|
|
134
|
-
export declare const fakeRelations: {
|
|
135
|
-
'customer:cloud.frontend.dashboard': {
|
|
136
|
-
id: RelationID;
|
|
137
|
-
source: Fqn;
|
|
138
|
-
target: Fqn;
|
|
139
|
-
title: string;
|
|
140
|
-
};
|
|
141
|
-
'support:cloud.frontend.adminPanel': {
|
|
142
|
-
id: RelationID;
|
|
143
|
-
source: Fqn;
|
|
144
|
-
target: Fqn;
|
|
145
|
-
title: string;
|
|
146
|
-
};
|
|
147
|
-
'cloud.backend.storage:amazon.s3': {
|
|
148
|
-
id: RelationID;
|
|
149
|
-
source: Fqn;
|
|
150
|
-
target: Fqn;
|
|
151
|
-
title: string;
|
|
152
|
-
};
|
|
153
|
-
'cloud.backend.graphql:cloud.backend.storage': {
|
|
154
|
-
id: RelationID;
|
|
155
|
-
source: Fqn;
|
|
156
|
-
target: Fqn;
|
|
157
|
-
title: string;
|
|
158
|
-
};
|
|
159
|
-
'cloud.frontend.dashboard:cloud.backend.graphql': {
|
|
160
|
-
id: RelationID;
|
|
161
|
-
source: Fqn;
|
|
162
|
-
target: Fqn;
|
|
163
|
-
title: string;
|
|
164
|
-
};
|
|
165
|
-
'cloud.frontend.adminPanel:cloud.backend.graphql': {
|
|
166
|
-
id: RelationID;
|
|
167
|
-
source: Fqn;
|
|
168
|
-
target: Fqn;
|
|
169
|
-
title: string;
|
|
170
|
-
};
|
|
171
|
-
};
|
|
172
|
-
export declare const fakeElementView: ElementView;
|
|
173
|
-
export declare const fakeModel: () => ModelIndex;
|
|
174
|
-
//# sourceMappingURL=data.d.ts.map
|
package/dist/__test__/data.js
DELETED
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
import { ModelIndex } from '../model-index';
|
|
2
|
-
/**
|
|
3
|
-
┌──────────────────────────────────────────────────┐
|
|
4
|
-
│ cloud │
|
|
5
|
-
│ ┌───────────────────────────────────────────┐ │
|
|
6
|
-
│ │ frontend │ │
|
|
7
|
-
┏━━━━━━━━━━┓ │ │ ┏━━━━━━━━━━━━━┓ ┏━━━━━━━━━━━━━━━━┓ │ │ ┏━━━━━━━━━━━┓
|
|
8
|
-
┃ ┃ │ │ ┃ ┃ ┃ ┃ │ │ ┃ ┃
|
|
9
|
-
┃ customer ┃──┼──┼──▶┃ dashboard ┃ ┃ adminpanel ┃◀───┼───┼───┃ support ┃
|
|
10
|
-
┃ ┃ │ │ ┃ ┃ ┃ ┃ │ │ ┃ ┃
|
|
11
|
-
┗━━━━━━━━━━┛ │ │ ┗━━━━━━┳━━━━━━┛ ┗━━━━━━━━┳━━━━━━━┛ │ │ ┗━━━━━━━━━━━┛
|
|
12
|
-
│ └──────────┼───────────────────┼────────────┘ │
|
|
13
|
-
│ ├───────────────────┘ │
|
|
14
|
-
│ │ │
|
|
15
|
-
│ ┌──────────┼────────────────────────────────┐ │
|
|
16
|
-
│ │ ▼ backend │ │
|
|
17
|
-
│ │ ┏━━━━━━━━━━━━━┓ ┏━━━━━━━━━━━━━┓ │ │
|
|
18
|
-
│ │ ┃ ┃ ┃ ┃ │ │
|
|
19
|
-
│ │ ┃ graphlql ┃──────▶┃ storage ┃ │ │
|
|
20
|
-
│ │ ┃ ┃ ┃ ┃ │ │
|
|
21
|
-
│ │ ┗━━━━━━━━━━━━━┛ ┗━━━━━━┳━━━━━━┛ │ │
|
|
22
|
-
│ └────────────────────────────────┼──────────┘ │
|
|
23
|
-
└───────────────────────────────────┼──────────────┘
|
|
24
|
-
│
|
|
25
|
-
┌─────────┼─────────┐
|
|
26
|
-
│ amazon │ │
|
|
27
|
-
│ ▼ │
|
|
28
|
-
│ ┏━━━━━━━━━━━━━━┓ │
|
|
29
|
-
│ ┃ ┃ │
|
|
30
|
-
│ ┃ s3 ┃ │
|
|
31
|
-
│ ┃ ┃ │
|
|
32
|
-
│ ┗━━━━━━━━━━━━━━┛ │
|
|
33
|
-
└───────────────────┘
|
|
34
|
-
|
|
35
|
-
specification {
|
|
36
|
-
element actor
|
|
37
|
-
element system
|
|
38
|
-
element component
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
model {
|
|
42
|
-
|
|
43
|
-
actor customer
|
|
44
|
-
actor support
|
|
45
|
-
|
|
46
|
-
system cloud {
|
|
47
|
-
component backend {
|
|
48
|
-
component graphql
|
|
49
|
-
component storage
|
|
50
|
-
|
|
51
|
-
graphql -> storage
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
component frontend {
|
|
55
|
-
component dashboard {
|
|
56
|
-
-> graphql
|
|
57
|
-
}
|
|
58
|
-
component adminPanel {
|
|
59
|
-
-> graphql
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
customer -> dashboard
|
|
65
|
-
support -> adminPanel
|
|
66
|
-
|
|
67
|
-
system amazon {
|
|
68
|
-
component s3
|
|
69
|
-
|
|
70
|
-
cloud.backend.storage -> s3
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
*/
|
|
76
|
-
export const fakeElements = {
|
|
77
|
-
amazon: {
|
|
78
|
-
id: 'amazon',
|
|
79
|
-
kind: 'system',
|
|
80
|
-
title: 'amazon'
|
|
81
|
-
},
|
|
82
|
-
cloud: {
|
|
83
|
-
id: 'cloud',
|
|
84
|
-
kind: 'system',
|
|
85
|
-
title: 'cloud'
|
|
86
|
-
},
|
|
87
|
-
customer: {
|
|
88
|
-
id: 'customer',
|
|
89
|
-
kind: 'actor',
|
|
90
|
-
title: 'customer'
|
|
91
|
-
},
|
|
92
|
-
support: {
|
|
93
|
-
id: 'support',
|
|
94
|
-
kind: 'actor',
|
|
95
|
-
title: 'support'
|
|
96
|
-
},
|
|
97
|
-
'amazon.s3': {
|
|
98
|
-
id: 'amazon.s3',
|
|
99
|
-
kind: 'component',
|
|
100
|
-
title: 's3'
|
|
101
|
-
},
|
|
102
|
-
'cloud.backend': {
|
|
103
|
-
id: 'cloud.backend',
|
|
104
|
-
kind: 'component',
|
|
105
|
-
title: 'backend'
|
|
106
|
-
},
|
|
107
|
-
'cloud.frontend': {
|
|
108
|
-
id: 'cloud.frontend',
|
|
109
|
-
kind: 'component',
|
|
110
|
-
title: 'frontend'
|
|
111
|
-
},
|
|
112
|
-
'cloud.backend.graphql': {
|
|
113
|
-
id: 'cloud.backend.graphql',
|
|
114
|
-
kind: 'component',
|
|
115
|
-
title: 'graphql'
|
|
116
|
-
},
|
|
117
|
-
'cloud.backend.storage': {
|
|
118
|
-
id: 'cloud.backend.storage',
|
|
119
|
-
kind: 'component',
|
|
120
|
-
title: 'storage'
|
|
121
|
-
},
|
|
122
|
-
'cloud.frontend.adminPanel': {
|
|
123
|
-
id: 'cloud.frontend.adminPanel',
|
|
124
|
-
kind: 'component',
|
|
125
|
-
title: 'adminPanel'
|
|
126
|
-
},
|
|
127
|
-
'cloud.frontend.dashboard': {
|
|
128
|
-
id: 'cloud.frontend.dashboard',
|
|
129
|
-
kind: 'component',
|
|
130
|
-
title: 'dashboard'
|
|
131
|
-
}
|
|
132
|
-
};
|
|
133
|
-
export const fakeRelations = {
|
|
134
|
-
'customer:cloud.frontend.dashboard': {
|
|
135
|
-
id: 'customer:cloud.frontend.dashboard',
|
|
136
|
-
source: 'customer',
|
|
137
|
-
target: 'cloud.frontend.dashboard',
|
|
138
|
-
title: ''
|
|
139
|
-
},
|
|
140
|
-
'support:cloud.frontend.adminPanel': {
|
|
141
|
-
id: 'support:cloud.frontend.adminPanel',
|
|
142
|
-
source: 'support',
|
|
143
|
-
target: 'cloud.frontend.adminPanel',
|
|
144
|
-
title: ''
|
|
145
|
-
},
|
|
146
|
-
'cloud.backend.storage:amazon.s3': {
|
|
147
|
-
id: 'cloud.backend.storage:amazon.s3',
|
|
148
|
-
source: 'cloud.backend.storage',
|
|
149
|
-
target: 'amazon.s3',
|
|
150
|
-
title: ''
|
|
151
|
-
},
|
|
152
|
-
'cloud.backend.graphql:cloud.backend.storage': {
|
|
153
|
-
id: 'cloud.backend.graphql:cloud.backend.storage',
|
|
154
|
-
source: 'cloud.backend.graphql',
|
|
155
|
-
target: 'cloud.backend.storage',
|
|
156
|
-
title: ''
|
|
157
|
-
},
|
|
158
|
-
'cloud.frontend.dashboard:cloud.backend.graphql': {
|
|
159
|
-
id: 'cloud.frontend.dashboard:cloud.backend.graphql',
|
|
160
|
-
source: 'cloud.frontend.dashboard',
|
|
161
|
-
target: 'cloud.backend.graphql',
|
|
162
|
-
title: ''
|
|
163
|
-
},
|
|
164
|
-
'cloud.frontend.adminPanel:cloud.backend.graphql': {
|
|
165
|
-
id: 'cloud.frontend.adminPanel:cloud.backend.graphql',
|
|
166
|
-
source: 'cloud.frontend.adminPanel',
|
|
167
|
-
target: 'cloud.backend.graphql',
|
|
168
|
-
title: ''
|
|
169
|
-
}
|
|
170
|
-
};
|
|
171
|
-
export const fakeElementView = {
|
|
172
|
-
id: 'fakeView',
|
|
173
|
-
title: '',
|
|
174
|
-
viewOf: 'cloud',
|
|
175
|
-
rules: [
|
|
176
|
-
{
|
|
177
|
-
isInclude: true,
|
|
178
|
-
exprs: [{ wildcard: true }]
|
|
179
|
-
}
|
|
180
|
-
]
|
|
181
|
-
};
|
|
182
|
-
export const fakeModel = () => ModelIndex.from({
|
|
183
|
-
elements: fakeElements,
|
|
184
|
-
relations: fakeRelations,
|
|
185
|
-
views: {
|
|
186
|
-
[fakeElementView.id]: fakeElementView
|
|
187
|
-
}
|
|
188
|
-
});
|
package/dist/__test__/index.d.ts
DELETED
package/dist/__test__/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './data';
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { ModelIndex } from '../model-index';
|
|
2
|
-
import { type ElementView } from '../types';
|
|
3
|
-
import type { ComputedView } from '../types/computed-view';
|
|
4
|
-
export declare function computeElementView(view: ElementView, index: ModelIndex): ComputedView;
|
|
5
|
-
//# sourceMappingURL=compute.element-view.d.ts.map
|