@eventcatalog/core 2.8.6 → 2.8.7

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @eventcatalog/core
2
2
 
3
+ ## 2.8.7
4
+
5
+ ### Patch Changes
6
+
7
+ - ce04693: fix(core): fixed visualization node graph for domains, reduced overlapping
8
+
3
9
  ## 2.8.6
4
10
 
5
11
  ### Patch Changes
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "url": "https://github.com/event-catalog/eventcatalog.git"
7
7
  },
8
8
  "type": "module",
9
- "version": "2.8.6",
9
+ "version": "2.8.7",
10
10
  "publishConfig": {
11
11
  "access": "public"
12
12
  },
@@ -1,19 +1,11 @@
1
1
  import { getCollection } from 'astro:content';
2
- import dagre from 'dagre';
2
+ import { createDagreGraph, calculatedNodes } from '@utils/node-graph-utils/utils';
3
3
  import { getNodesAndEdges as getServicesNodeAndEdges } from '../services/node-graph';
4
4
  import merge from 'lodash.merge';
5
5
  import { getItemsFromCollectionByIdAndSemverOrLatest } from '@utils/collections/util';
6
6
 
7
7
  type DagreGraph = any;
8
8
 
9
- // Creates a new dagre graph
10
- export const getDagreGraph = () => {
11
- const graph = new dagre.graphlib.Graph({ compound: true });
12
- graph.setGraph({ rankdir: 'LR', ranksep: 200, nodesep: 100 });
13
- graph.setDefaultEdgeLabel(() => ({}));
14
- return graph;
15
- };
16
-
17
9
  interface Props {
18
10
  id: string;
19
11
  version: string;
@@ -22,7 +14,7 @@ interface Props {
22
14
  }
23
15
 
24
16
  export const getNodesAndEdges = async ({ id, version, defaultFlow, mode = 'simple' }: Props) => {
25
- const flow = defaultFlow || getDagreGraph();
17
+ const flow = defaultFlow || createDagreGraph({ ranksep: 360, nodesep: 50, edgesep: 50 });
26
18
  let nodes = new Map(),
27
19
  edges = new Map();
28
20
 
@@ -73,7 +65,7 @@ export const getNodesAndEdges = async ({ id, version, defaultFlow, mode = 'simpl
73
65
  }
74
66
 
75
67
  return {
76
- nodes: [...nodes.values()],
68
+ nodes: calculatedNodes(flow, Array.from(nodes.values())),
77
69
  edges: [...edges.values()],
78
70
  };
79
71
  };
@@ -2,8 +2,6 @@ import type { CollectionEntry } from 'astro:content';
2
2
  import type { Node } from 'reactflow';
3
3
  import dagre from 'dagre';
4
4
 
5
- type DagreGraph = any;
6
-
7
5
  export const generateIdForNode = (node: CollectionEntry<'events' | 'services' | 'commands'>) => {
8
6
  return `${node.data.id}-${node.data.version}`;
9
7
  };
@@ -23,9 +21,9 @@ export const calculatedNodes = (flow: dagre.graphlib.Graph, nodes: Node[]) => {
23
21
  };
24
22
 
25
23
  // Creates a new dagre graph
26
- export const createDagreGraph = ({ ranksep = 180, nodesep = 50 }: any) => {
24
+ export const createDagreGraph = ({ ranksep = 180, nodesep = 50, ...rest }: any) => {
27
25
  const graph = new dagre.graphlib.Graph({ compound: true });
28
- graph.setGraph({ rankdir: 'LR', ranksep, nodesep });
26
+ graph.setGraph({ rankdir: 'LR', ranksep, nodesep, ...rest });
29
27
  graph.setDefaultEdgeLabel(() => ({}));
30
28
  return graph;
31
29
  };