@teambit/graph 0.0.551 → 0.0.556
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/graph.ui.runtime.d.ts +7 -0
- package/dist/ui/dependencies-graph/calc-elements.d.ts +3 -0
- package/dist/ui/dependencies-graph/calc-layout.d.ts +3 -0
- package/dist/ui/dependencies-graph/graph-context.d.ts +1 -0
- package/dist/ui/query/use-graph-query.d.ts +1 -0
- package/package.json +18 -12
- package/component-graph/component-graph.ts +0 -105
- package/component-graph/index.ts +0 -2
- package/duplicate-dependency.ts +0 -18
- package/edge-type.ts +0 -5
- package/graph-builder.ts +0 -56
- package/graph.aspect.ts +0 -7
- package/graph.docs.md +0 -7
- package/graph.graphql.ts +0 -94
- package/graph.main.runtime.ts +0 -15
- package/graph.provider.ts +0 -14
- package/graph.ui.runtime.tsx +0 -41
- package/index.ts +0 -11
- package/model/dependency/dependency.ts +0 -11
- package/model/dependency/index.ts +0 -1
- package/model/graph-filters/graph-filters.ts +0 -1
- package/model/graph-filters/index.ts +0 -1
- package/object-list-to-graph.ts +0 -54
- package/package-tar/teambit-graph-0.0.551.tgz +0 -0
- package/tsconfig.json +0 -35
- package/types/asset.d.ts +0 -29
- package/types/style.d.ts +0 -42
- package/ui/component-node/component-node.module.scss +0 -63
- package/ui/component-node/component-node.tsx +0 -61
- package/ui/component-node/index.ts +0 -3
- package/ui/component-node/variants.module.scss +0 -43
- package/ui/component-node/variants.ts +0 -5
- package/ui/dependencies-graph/calc-elements.tsx +0 -47
- package/ui/dependencies-graph/calc-layout.tsx +0 -36
- package/ui/dependencies-graph/dep-edge/dep-edge.tsx +0 -28
- package/ui/dependencies-graph/dep-edge/edge.module.scss +0 -10
- package/ui/dependencies-graph/dep-edge/index.ts +0 -1
- package/ui/dependencies-graph/dependencies-graph.module.scss +0 -83
- package/ui/dependencies-graph/dependencies-graph.tsx +0 -98
- package/ui/dependencies-graph/graph-context.ts +0 -9
- package/ui/dependencies-graph/index.ts +0 -3
- package/ui/dependencies-graph/minimap.ts +0 -15
- package/ui/graph-page/graph-filters.tsx +0 -27
- package/ui/graph-page/graph-page.module.scss +0 -35
- package/ui/graph-page/graph-page.tsx +0 -54
- package/ui/graph-page/index.ts +0 -1
- package/ui/graph.section.tsx +0 -19
- package/ui/query/edge-model.ts +0 -16
- package/ui/query/get-graph.query.ts +0 -73
- package/ui/query/graph-model.ts +0 -12
- package/ui/query/index.ts +0 -6
- package/ui/query/node-model.ts +0 -16
- package/ui/query/use-graph-query.ts +0 -29
- package/ui/query/use-graph.tsx +0 -12
package/ui/graph.section.tsx
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
import { Section } from '@teambit/component';
|
2
|
-
import React from 'react';
|
3
|
-
|
4
|
-
import { GraphPage } from './graph-page';
|
5
|
-
import { ComponentWidgetSlot } from '../graph.ui.runtime';
|
6
|
-
|
7
|
-
export class GraphSection implements Section {
|
8
|
-
constructor(private componentWidgetSlot: ComponentWidgetSlot) {}
|
9
|
-
|
10
|
-
route = {
|
11
|
-
path: '~dependencies',
|
12
|
-
children: <GraphPage componentWidgets={this.componentWidgetSlot} />,
|
13
|
-
};
|
14
|
-
navigationLink = {
|
15
|
-
href: '~dependencies',
|
16
|
-
children: 'Dependencies',
|
17
|
-
};
|
18
|
-
order = 40;
|
19
|
-
}
|
package/ui/query/edge-model.ts
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
import { EdgeType } from '@teambit/graph';
|
2
|
-
import { RawEdge } from './get-graph.query';
|
3
|
-
|
4
|
-
export class EdgeModel {
|
5
|
-
sourceId: string;
|
6
|
-
targetId: string;
|
7
|
-
dependencyLifecycleType: EdgeType;
|
8
|
-
|
9
|
-
static from(rawEdge: RawEdge) {
|
10
|
-
const edge = new EdgeModel();
|
11
|
-
edge.sourceId = rawEdge.sourceId;
|
12
|
-
edge.targetId = rawEdge.targetId;
|
13
|
-
edge.dependencyLifecycleType = rawEdge.dependencyLifecycleType;
|
14
|
-
return edge;
|
15
|
-
}
|
16
|
-
}
|
@@ -1,73 +0,0 @@
|
|
1
|
-
import { gql } from '@apollo/client';
|
2
|
-
import { EdgeType } from '@teambit/graph';
|
3
|
-
|
4
|
-
// please update types when updating query, for added safety
|
5
|
-
|
6
|
-
export const GET_GRAPH = gql`
|
7
|
-
query graph($ids: [String], $filter: String) {
|
8
|
-
graph(ids: $ids, filter: $filter) {
|
9
|
-
nodes {
|
10
|
-
id
|
11
|
-
component {
|
12
|
-
id {
|
13
|
-
name
|
14
|
-
version
|
15
|
-
scope
|
16
|
-
}
|
17
|
-
displayName
|
18
|
-
|
19
|
-
deprecation {
|
20
|
-
isDeprecate
|
21
|
-
}
|
22
|
-
|
23
|
-
env {
|
24
|
-
id
|
25
|
-
icon
|
26
|
-
}
|
27
|
-
}
|
28
|
-
}
|
29
|
-
edges {
|
30
|
-
sourceId
|
31
|
-
targetId
|
32
|
-
dependencyLifecycleType
|
33
|
-
}
|
34
|
-
}
|
35
|
-
}
|
36
|
-
`;
|
37
|
-
|
38
|
-
export type RawGraphQuery = {
|
39
|
-
graph: RawGraph;
|
40
|
-
};
|
41
|
-
|
42
|
-
export type RawGraph = {
|
43
|
-
nodes: RawNode[];
|
44
|
-
edges: [];
|
45
|
-
};
|
46
|
-
|
47
|
-
export type RawNode = {
|
48
|
-
id: string;
|
49
|
-
component: {
|
50
|
-
id: {
|
51
|
-
name: string;
|
52
|
-
scope: string;
|
53
|
-
version: string;
|
54
|
-
};
|
55
|
-
|
56
|
-
displayName: string;
|
57
|
-
|
58
|
-
deprecation: {
|
59
|
-
isDeprecate: boolean;
|
60
|
-
};
|
61
|
-
|
62
|
-
env: {
|
63
|
-
id: string;
|
64
|
-
icon: string;
|
65
|
-
};
|
66
|
-
};
|
67
|
-
};
|
68
|
-
|
69
|
-
export type RawEdge = {
|
70
|
-
sourceId: string;
|
71
|
-
targetId: string;
|
72
|
-
dependencyLifecycleType: EdgeType;
|
73
|
-
};
|
package/ui/query/graph-model.ts
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
import { RawGraph } from './get-graph.query';
|
2
|
-
import { NodeModel } from './node-model';
|
3
|
-
import { EdgeModel } from './edge-model';
|
4
|
-
|
5
|
-
export class GraphModel {
|
6
|
-
constructor(public nodes: NodeModel[], public edges: EdgeModel[]) {}
|
7
|
-
static from(rawGraph: RawGraph) {
|
8
|
-
const nodes = rawGraph.nodes.map(NodeModel.from);
|
9
|
-
const edges = rawGraph.edges.map(EdgeModel.from);
|
10
|
-
return new GraphModel(nodes, edges);
|
11
|
-
}
|
12
|
-
}
|
package/ui/query/index.ts
DELETED
package/ui/query/node-model.ts
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
import { ComponentModel } from '@teambit/component';
|
2
|
-
import { RawNode } from './get-graph.query';
|
3
|
-
|
4
|
-
export class NodeModel {
|
5
|
-
id: string;
|
6
|
-
component: ComponentModel;
|
7
|
-
|
8
|
-
static from(rawNode: RawNode) {
|
9
|
-
const node = new NodeModel();
|
10
|
-
node.id = rawNode.id;
|
11
|
-
// @TODO - component model should not expect all fields to have values
|
12
|
-
// @ts-ignore
|
13
|
-
node.component = ComponentModel.from(rawNode.component);
|
14
|
-
return node;
|
15
|
-
}
|
16
|
-
}
|
@@ -1,29 +0,0 @@
|
|
1
|
-
import { useMemo } from 'react';
|
2
|
-
import { useDataQuery } from '@teambit/ui-foundation.ui.hooks.use-data-query';
|
3
|
-
import { GraphQlError } from '@teambit/graphql';
|
4
|
-
import { GET_GRAPH, RawGraphQuery } from './get-graph.query';
|
5
|
-
import { GraphModel } from './graph-model';
|
6
|
-
|
7
|
-
type QueryVariables = {
|
8
|
-
ids: string[];
|
9
|
-
filter?: string;
|
10
|
-
};
|
11
|
-
|
12
|
-
/** provides dependencies graph data from graphQL */
|
13
|
-
export function useGraphQuery(componentId: string[], filter?: string) {
|
14
|
-
const { data, error, loading } = useDataQuery<RawGraphQuery, QueryVariables>(GET_GRAPH, {
|
15
|
-
variables: { ids: componentId, filter },
|
16
|
-
});
|
17
|
-
|
18
|
-
const rawGraph = data?.graph;
|
19
|
-
const clientError = !rawGraph && !loading ? new GraphQlError(404) : undefined;
|
20
|
-
const serverError = error ? new GraphQlError(500, error.message) : undefined;
|
21
|
-
|
22
|
-
return useMemo(() => {
|
23
|
-
return {
|
24
|
-
graph: rawGraph ? GraphModel.from(rawGraph) : undefined,
|
25
|
-
error: serverError || clientError,
|
26
|
-
loading,
|
27
|
-
};
|
28
|
-
}, [rawGraph, error]);
|
29
|
-
}
|
package/ui/query/use-graph.tsx
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
import { useRouteMatch } from 'react-router-dom';
|
2
|
-
|
3
|
-
import { useGraphQuery } from './use-graph-query';
|
4
|
-
|
5
|
-
export function useGraph() {
|
6
|
-
const {
|
7
|
-
// @ts-ignore
|
8
|
-
params: { componentId },
|
9
|
-
} = useRouteMatch();
|
10
|
-
|
11
|
-
return useGraphQuery([componentId]);
|
12
|
-
}
|