@eventcatalog/core 3.12.7 → 3.12.9-beta.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.
Files changed (64) hide show
  1. package/dist/analytics/analytics.cjs +1 -1
  2. package/dist/analytics/analytics.js +2 -2
  3. package/dist/analytics/log-build.cjs +1 -1
  4. package/dist/analytics/log-build.js +3 -3
  5. package/dist/{chunk-RZOSO7BH.js → chunk-2UUS3AQ2.js} +1 -1
  6. package/dist/{chunk-UFF5Q7GJ.js → chunk-EDX2LGRV.js} +1 -1
  7. package/dist/{chunk-2EFYBMLH.js → chunk-RJOB6XEC.js} +1 -1
  8. package/dist/{chunk-YO6IQXB3.js → chunk-V7YMKA4P.js} +1 -1
  9. package/dist/{chunk-PLQAZDJI.js → chunk-WTCJKTEF.js} +1 -1
  10. package/dist/constants.cjs +1 -1
  11. package/dist/constants.js +1 -1
  12. package/dist/eventcatalog.cjs +1 -1
  13. package/dist/eventcatalog.js +5 -5
  14. package/dist/generate.cjs +1 -1
  15. package/dist/generate.js +3 -3
  16. package/dist/utils/cli-logger.cjs +1 -1
  17. package/dist/utils/cli-logger.js +2 -2
  18. package/eventcatalog/src/components/MDX/Design/Design.astro +2 -2
  19. package/eventcatalog/src/components/MDX/EntityMap/EntityMap.astro +2 -2
  20. package/eventcatalog/src/components/MDX/Flow/Flow.astro +2 -2
  21. package/eventcatalog/src/components/MDX/NodeGraph/AstroNodeGraph.tsx +104 -0
  22. package/eventcatalog/src/components/MDX/NodeGraph/NodeGraph.astro +2 -2
  23. package/eventcatalog/src/components/MDX/NodeGraph/README.md +85 -0
  24. package/eventcatalog/src/pages/visualiser/designs/[id]/index.astro +2 -2
  25. package/eventcatalog/src/utils/node-graphs/container-node-graph.ts +66 -17
  26. package/eventcatalog/src/utils/node-graphs/data-products-node-graph.ts +14 -5
  27. package/eventcatalog/src/utils/node-graphs/domains-node-graph.ts +1 -1
  28. package/eventcatalog/src/utils/node-graphs/message-node-graph.ts +133 -18
  29. package/eventcatalog/src/utils/node-graphs/services-node-graph.ts +36 -14
  30. package/eventcatalog/src/utils/node-graphs/utils/utils.ts +115 -4
  31. package/package.json +4 -4
  32. package/eventcatalog/src/components/MDX/NodeGraph/DownloadButton.tsx +0 -62
  33. package/eventcatalog/src/components/MDX/NodeGraph/Edges/AnimatedMessageEdge.tsx +0 -110
  34. package/eventcatalog/src/components/MDX/NodeGraph/Edges/FlowEdge.tsx +0 -96
  35. package/eventcatalog/src/components/MDX/NodeGraph/Edges/MultilineEdgeLabel.tsx +0 -52
  36. package/eventcatalog/src/components/MDX/NodeGraph/FocusMode/FocusModeContent.tsx +0 -294
  37. package/eventcatalog/src/components/MDX/NodeGraph/FocusMode/FocusModeNodeActions.tsx +0 -92
  38. package/eventcatalog/src/components/MDX/NodeGraph/FocusMode/FocusModePlaceholder.tsx +0 -26
  39. package/eventcatalog/src/components/MDX/NodeGraph/FocusMode/utils.ts +0 -163
  40. package/eventcatalog/src/components/MDX/NodeGraph/FocusModeModal.tsx +0 -99
  41. package/eventcatalog/src/components/MDX/NodeGraph/MermaidView.tsx +0 -242
  42. package/eventcatalog/src/components/MDX/NodeGraph/NodeGraph.tsx +0 -1181
  43. package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Actor.tsx +0 -46
  44. package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Channel.tsx +0 -55
  45. package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Command.tsx +0 -27
  46. package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Custom.tsx +0 -159
  47. package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Data.tsx +0 -63
  48. package/eventcatalog/src/components/MDX/NodeGraph/Nodes/DataProduct.tsx +0 -132
  49. package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Domain.tsx +0 -155
  50. package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Entity.tsx +0 -154
  51. package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Event.tsx +0 -29
  52. package/eventcatalog/src/components/MDX/NodeGraph/Nodes/ExternalSystem.tsx +0 -79
  53. package/eventcatalog/src/components/MDX/NodeGraph/Nodes/ExternalSystem2.tsx +0 -24
  54. package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Flow.tsx +0 -107
  55. package/eventcatalog/src/components/MDX/NodeGraph/Nodes/MessageContextMenu.tsx +0 -63
  56. package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Query.tsx +0 -28
  57. package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Service.tsx +0 -127
  58. package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Step.tsx +0 -64
  59. package/eventcatalog/src/components/MDX/NodeGraph/Nodes/User.tsx +0 -76
  60. package/eventcatalog/src/components/MDX/NodeGraph/Nodes/View.tsx +0 -24
  61. package/eventcatalog/src/components/MDX/NodeGraph/StepWalkthrough.tsx +0 -296
  62. package/eventcatalog/src/components/MDX/NodeGraph/StudioModal.tsx +0 -129
  63. package/eventcatalog/src/components/MDX/NodeGraph/VisualiserSearch.tsx +0 -258
  64. package/eventcatalog/src/components/MDX/NodeGraph/VisualizerDropdownContent.tsx +0 -313
@@ -37,7 +37,7 @@ var import_axios = __toESM(require("axios"), 1);
37
37
  var import_os = __toESM(require("os"), 1);
38
38
 
39
39
  // package.json
40
- var version = "3.12.7";
40
+ var version = "3.12.9-beta.0";
41
41
 
42
42
  // src/constants.ts
43
43
  var VERSION = version;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  raiseEvent
3
- } from "../chunk-PLQAZDJI.js";
4
- import "../chunk-RZOSO7BH.js";
3
+ } from "../chunk-WTCJKTEF.js";
4
+ import "../chunk-2UUS3AQ2.js";
5
5
  export {
6
6
  raiseEvent
7
7
  };
@@ -106,7 +106,7 @@ var import_axios = __toESM(require("axios"), 1);
106
106
  var import_os = __toESM(require("os"), 1);
107
107
 
108
108
  // package.json
109
- var version = "3.12.7";
109
+ var version = "3.12.9-beta.0";
110
110
 
111
111
  // src/constants.ts
112
112
  var VERSION = version;
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  log_build_default
3
- } from "../chunk-YO6IQXB3.js";
4
- import "../chunk-PLQAZDJI.js";
3
+ } from "../chunk-V7YMKA4P.js";
4
+ import "../chunk-WTCJKTEF.js";
5
5
  import "../chunk-4UVFXLPI.js";
6
- import "../chunk-RZOSO7BH.js";
6
+ import "../chunk-2UUS3AQ2.js";
7
7
  import "../chunk-UPONRQSN.js";
8
8
  export {
9
9
  log_build_default as default
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "3.12.7";
2
+ var version = "3.12.9-beta.0";
3
3
 
4
4
  // src/constants.ts
5
5
  var VERSION = version;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VERSION
3
- } from "./chunk-RZOSO7BH.js";
3
+ } from "./chunk-2UUS3AQ2.js";
4
4
 
5
5
  // src/utils/cli-logger.ts
6
6
  import pc from "picocolors";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  logger
3
- } from "./chunk-UFF5Q7GJ.js";
3
+ } from "./chunk-EDX2LGRV.js";
4
4
  import {
5
5
  cleanup,
6
6
  getEventCatalogConfigFile
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  raiseEvent
3
- } from "./chunk-PLQAZDJI.js";
3
+ } from "./chunk-WTCJKTEF.js";
4
4
  import {
5
5
  countResources,
6
6
  serializeCounts
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VERSION
3
- } from "./chunk-RZOSO7BH.js";
3
+ } from "./chunk-2UUS3AQ2.js";
4
4
 
5
5
  // src/analytics/analytics.js
6
6
  import axios from "axios";
@@ -25,7 +25,7 @@ __export(constants_exports, {
25
25
  module.exports = __toCommonJS(constants_exports);
26
26
 
27
27
  // package.json
28
- var version = "3.12.7";
28
+ var version = "3.12.9-beta.0";
29
29
 
30
30
  // src/constants.ts
31
31
  var VERSION = version;
package/dist/constants.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VERSION
3
- } from "./chunk-RZOSO7BH.js";
3
+ } from "./chunk-2UUS3AQ2.js";
4
4
  export {
5
5
  VERSION
6
6
  };
@@ -109,7 +109,7 @@ var verifyRequiredFieldsAreInCatalogConfigFile = async (projectDirectory) => {
109
109
  var import_picocolors = __toESM(require("picocolors"), 1);
110
110
 
111
111
  // package.json
112
- var version = "3.12.7";
112
+ var version = "3.12.9-beta.0";
113
113
 
114
114
  // src/constants.ts
115
115
  var VERSION = version;
@@ -6,8 +6,8 @@ import {
6
6
  } from "./chunk-PLNJC7NZ.js";
7
7
  import {
8
8
  log_build_default
9
- } from "./chunk-YO6IQXB3.js";
10
- import "./chunk-PLQAZDJI.js";
9
+ } from "./chunk-V7YMKA4P.js";
10
+ import "./chunk-WTCJKTEF.js";
11
11
  import "./chunk-4UVFXLPI.js";
12
12
  import {
13
13
  runMigrations
@@ -22,13 +22,13 @@ import {
22
22
  } from "./chunk-5VBIXL6C.js";
23
23
  import {
24
24
  generate
25
- } from "./chunk-2EFYBMLH.js";
25
+ } from "./chunk-RJOB6XEC.js";
26
26
  import {
27
27
  logger
28
- } from "./chunk-UFF5Q7GJ.js";
28
+ } from "./chunk-EDX2LGRV.js";
29
29
  import {
30
30
  VERSION
31
- } from "./chunk-RZOSO7BH.js";
31
+ } from "./chunk-2UUS3AQ2.js";
32
32
  import {
33
33
  verifyRequiredFieldsAreInCatalogConfigFile
34
34
  } from "./chunk-UPONRQSN.js";
package/dist/generate.cjs CHANGED
@@ -73,7 +73,7 @@ var getEventCatalogConfigFile = async (projectDirectory) => {
73
73
  var import_picocolors = __toESM(require("picocolors"), 1);
74
74
 
75
75
  // package.json
76
- var version = "3.12.7";
76
+ var version = "3.12.9-beta.0";
77
77
 
78
78
  // src/constants.ts
79
79
  var VERSION = version;
package/dist/generate.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  generate
3
- } from "./chunk-2EFYBMLH.js";
4
- import "./chunk-UFF5Q7GJ.js";
5
- import "./chunk-RZOSO7BH.js";
3
+ } from "./chunk-RJOB6XEC.js";
4
+ import "./chunk-EDX2LGRV.js";
5
+ import "./chunk-2UUS3AQ2.js";
6
6
  import "./chunk-UPONRQSN.js";
7
7
  export {
8
8
  generate
@@ -36,7 +36,7 @@ module.exports = __toCommonJS(cli_logger_exports);
36
36
  var import_picocolors = __toESM(require("picocolors"), 1);
37
37
 
38
38
  // package.json
39
- var version = "3.12.7";
39
+ var version = "3.12.9-beta.0";
40
40
 
41
41
  // src/constants.ts
42
42
  var VERSION = version;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  logger
3
- } from "../chunk-UFF5Q7GJ.js";
4
- import "../chunk-RZOSO7BH.js";
3
+ } from "../chunk-EDX2LGRV.js";
4
+ import "../chunk-2UUS3AQ2.js";
5
5
  export {
6
6
  logger
7
7
  };
@@ -3,7 +3,7 @@ const { file: designPath, filePath, search = true, title } = Astro.props;
3
3
  import fs from 'fs';
4
4
  import { getAbsoluteFilePathForAstroFile } from '@utils/files';
5
5
  import Admonition from '@components/MDX/Admonition';
6
- import NodeGraph from '../NodeGraph/NodeGraph';
6
+ import AstroNodeGraph from '../NodeGraph/AstroNodeGraph';
7
7
 
8
8
  import { isVisualiserEnabled, isEventCatalogChatEnabled, isDevMode } from '@utils/feature';
9
9
  import { loadSavedLayout, applyLayoutToNodes, buildResourceKey } from '@utils/node-graphs/layout-persistence';
@@ -54,7 +54,7 @@ const nodesWithLayout = design ? applyLayoutToNodes(design.nodes || [], savedLay
54
54
  />
55
55
 
56
56
  <div>
57
- <NodeGraph
57
+ <AstroNodeGraph
58
58
  id={id}
59
59
  title={title ?? design.name}
60
60
  nodes={nodesWithLayout}
@@ -2,7 +2,7 @@
2
2
  import { getDomains } from '@utils/collections/domains';
3
3
  import { getNodesAndEdges } from '@utils/node-graphs/domain-entity-map.ts';
4
4
  import Admonition from '@components/MDX/Admonition';
5
- import NodeGraph from '../NodeGraph/NodeGraph';
5
+ import AstroNodeGraph from '../NodeGraph/AstroNodeGraph';
6
6
  import { getVersionFromCollection } from '@utils/collections/versions';
7
7
  import { getServices } from '@utils/collections/services';
8
8
  import { isEventCatalogChatEnabled, isDevMode } from '@utils/feature';
@@ -70,7 +70,7 @@ const nodesWithLayout = applyLayoutToNodes(nodes as any[], savedLayout);
70
70
  </div>
71
71
 
72
72
  <div>
73
- <NodeGraph
73
+ <AstroNodeGraph
74
74
  id={id}
75
75
  nodes={nodesWithLayout}
76
76
  edges={edges}
@@ -2,7 +2,7 @@
2
2
  import { getFlows } from '@utils/collections/flows';
3
3
  import { getNodesAndEdges } from '@utils/node-graphs/flows-node-graph';
4
4
  import Admonition from '@components/MDX/Admonition';
5
- import NodeGraph from '../NodeGraph/NodeGraph';
5
+ import AstroNodeGraph from '../NodeGraph/AstroNodeGraph';
6
6
  import { getVersionFromCollection } from '@utils/collections/versions';
7
7
  import { isVisualiserEnabled, isEventCatalogChatEnabled, isDevMode } from '@utils/feature';
8
8
  import { loadSavedLayout, applyLayoutToNodes, buildResourceKey } from '@utils/node-graphs/layout-persistence';
@@ -53,7 +53,7 @@ const nodesWithLayout = applyLayoutToNodes(nodes, savedLayout);
53
53
  </div>
54
54
 
55
55
  <div>
56
- <NodeGraph
56
+ <AstroNodeGraph
57
57
  id={id}
58
58
  nodes={nodesWithLayout}
59
59
  edges={edges}
@@ -0,0 +1,104 @@
1
+ /**
2
+ * Astro adapter for @eventcatalog/visualiser
3
+ *
4
+ * This component wraps the framework-agnostic NodeGraph from @eventcatalog/visualiser
5
+ * and provides Astro-specific integration including:
6
+ * - Navigation using Astro's navigate function
7
+ * - Layout persistence via Astro API routes
8
+ * - URL building with Astro's URL utilities
9
+ */
10
+
11
+ import { useCallback } from 'react';
12
+ import { NodeGraph } from '@eventcatalog/visualiser';
13
+ import '@eventcatalog/visualiser/styles.css';
14
+ import type { Node, Edge } from '@xyflow/react';
15
+
16
+ interface AstroNodeGraphProps {
17
+ id: string;
18
+ nodes: Node[];
19
+ edges: Edge[];
20
+ title?: string;
21
+ href?: string;
22
+ hrefLabel?: string;
23
+ linkTo?: 'docs' | 'visualiser';
24
+ includeKey?: boolean;
25
+ footerLabel?: string;
26
+ linksToVisualiser?: boolean;
27
+ links?: { label: string; url: string }[];
28
+ mode?: 'full' | 'simple';
29
+ portalId?: string;
30
+ showFlowWalkthrough?: boolean;
31
+ showSearch?: boolean;
32
+ zoomOnScroll?: boolean;
33
+ designId?: string;
34
+ isChatEnabled?: boolean;
35
+ maxTextSize?: number;
36
+ isDevMode?: boolean;
37
+ resourceKey?: string;
38
+ }
39
+
40
+ const AstroNodeGraph = ({ isDevMode = false, resourceKey, ...otherProps }: AstroNodeGraphProps) => {
41
+ // Astro-specific navigation handler
42
+ const handleNavigate = useCallback((url: string) => {
43
+ // Use window.location for navigation since we can't import astro:transitions/client in a React component
44
+ window.location.href = url;
45
+ }, []);
46
+
47
+ // Astro-specific URL builder
48
+ const handleBuildUrl = useCallback((path: string) => {
49
+ // Simple URL builder - just return the path as-is
50
+ // The consuming app (core) should handle base URLs if needed
51
+ return path;
52
+ }, []);
53
+
54
+ // Layout persistence: Save layout to Astro API route
55
+ const handleSaveLayout = useCallback(
56
+ async (key: string, positions: Record<string, { x: number; y: number }>): Promise<boolean> => {
57
+ if (!key) return false;
58
+
59
+ try {
60
+ const response = await fetch('/api/dev/visualizer-layout/save', {
61
+ method: 'POST',
62
+ headers: { 'Content-Type': 'application/json' },
63
+ body: JSON.stringify({ resourceKey: key, positions }),
64
+ });
65
+ const result = await response.json();
66
+ return result.success === true;
67
+ } catch {
68
+ return false;
69
+ }
70
+ },
71
+ []
72
+ );
73
+
74
+ // Layout persistence: Reset layout via Astro API route
75
+ const handleResetLayout = useCallback(async (key: string): Promise<boolean> => {
76
+ if (!key) return false;
77
+
78
+ try {
79
+ const response = await fetch('/api/dev/visualizer-layout/reset', {
80
+ method: 'POST',
81
+ headers: { 'Content-Type': 'application/json' },
82
+ body: JSON.stringify({ resourceKey: key }),
83
+ });
84
+ const result = await response.json();
85
+ return result.success === true;
86
+ } catch {
87
+ return false;
88
+ }
89
+ }, []);
90
+
91
+ return (
92
+ <NodeGraph
93
+ {...otherProps}
94
+ resourceKey={resourceKey}
95
+ isDevMode={isDevMode}
96
+ onNavigate={handleNavigate}
97
+ onBuildUrl={handleBuildUrl}
98
+ onSaveLayout={handleSaveLayout}
99
+ onResetLayout={handleResetLayout}
100
+ />
101
+ );
102
+ };
103
+
104
+ export default AstroNodeGraph;
@@ -1,5 +1,5 @@
1
1
  ---
2
- import NodeGraphNew from './NodeGraph';
2
+ import AstroNodeGraph from './AstroNodeGraph';
3
3
  import { getNodesAndEdges as getNodesAndEdgesForService } from '@utils/node-graphs/services-node-graph';
4
4
  import {
5
5
  getNodesAndEdgesForCommands,
@@ -148,7 +148,7 @@ const nodesWithLayout = applyLayoutToNodes(nodes as any[], savedLayout);
148
148
  ---
149
149
 
150
150
  <div>
151
- <NodeGraphNew
151
+ <AstroNodeGraph
152
152
  id={id}
153
153
  nodes={nodesWithLayout}
154
154
  edges={edges}
@@ -0,0 +1,85 @@
1
+ # NodeGraph - Astro Adapter for @eventcatalog/visualiser
2
+
3
+ ## Overview
4
+
5
+ This directory contains the Astro-specific adapter for the `@eventcatalog/visualiser` package. The visualiser package is framework-agnostic, and this adapter provides Astro-specific integrations.
6
+
7
+ ## Components
8
+
9
+ ### AstroNodeGraph.tsx
10
+
11
+ The main adapter component that wraps the `NodeGraph` from `@eventcatalog/visualiser` and provides:
12
+
13
+ - **Navigation**: Uses Astro's `navigate` function from `astro:transitions/client`
14
+ - **URL Building**: Uses Astro's `buildUrl` utility for consistent URL generation
15
+ - **Layout Persistence**: Integrates with Astro API routes for saving/resetting custom node layouts (dev mode only)
16
+ - `/api/dev/visualiser-layout/save` - Saves node positions
17
+ - `/api/dev/visualiser-layout/reset` - Resets node positions to defaults
18
+
19
+ ### NodeGraph.astro
20
+
21
+ The Astro component that serves as the entry point for rendering node graphs. It:
22
+ - Fetches nodes and edges based on the collection type (services, events, domains, etc.)
23
+ - Applies saved layout positions when available (dev mode feature)
24
+ - Renders the `AstroNodeGraph` component with `client:only="react"`
25
+
26
+ ### NodeGraphPortal.tsx
27
+
28
+ A simple portal component that creates the DOM container where the React component will render. Used by MDX components to embed node graphs in documentation.
29
+
30
+ ## Usage
31
+
32
+ ### In Astro Pages
33
+
34
+ ```astro
35
+ ---
36
+ import NodeGraph from '@components/MDX/NodeGraph/NodeGraph.astro';
37
+ ---
38
+
39
+ <div id="my-graph-portal"></div>
40
+ <NodeGraph
41
+ id="my-graph"
42
+ collection="services"
43
+ version="1.0.0"
44
+ mode="full"
45
+ linkTo="visualiser"
46
+ />
47
+ ```
48
+
49
+ ### In MDX Content
50
+
51
+ ```mdx
52
+ <NodeGraph id="my-service" collection="services" version="1.0.0" />
53
+ ```
54
+
55
+ ## Integration with @eventcatalog/visualiser
56
+
57
+ The `AstroNodeGraph` component directly uses the `NodeGraph` component from `@eventcatalog/visualiser` and provides the framework-specific callbacks:
58
+
59
+ ```typescript
60
+ <NodeGraph
61
+ {...props}
62
+ onNavigate={handleNavigate}
63
+ onBuildUrl={handleBuildUrl}
64
+ onSaveLayout={handleSaveLayout}
65
+ onResetLayout={handleResetLayout}
66
+ />
67
+ ```
68
+
69
+ ### Known Limitations
70
+
71
+ Currently, the `onSaveLayout` and `onResetLayout` callbacks are passed through with a `@ts-expect-error` comment because the visualiser package's outer `NodeGraph` component doesn't expose these props in its TypeScript interface, even though the internal `NodeGraphBuilder` component does accept them.
72
+
73
+ **TODO**: Update the `@eventcatalog/visualiser` package to expose `onSaveLayout` and `onResetLayout` in the `NodeGraphProps` interface and forward them to `NodeGraphBuilder`.
74
+
75
+ ## Migration Notes
76
+
77
+ This adapter replaces the old monolithic `NodeGraph.tsx` component that was previously in this directory. The old component has been:
78
+ - Refactored into the framework-agnostic `@eventcatalog/visualiser` package
79
+ - Wrapped by this new `AstroNodeGraph` adapter for Astro-specific integrations
80
+
81
+ Benefits of this architecture:
82
+ - The visualiser can be used in other frameworks (Next.js, Remix, etc.)
83
+ - Astro-specific concerns are isolated to this adapter
84
+ - Easier to test and maintain
85
+ - Clear separation of concerns
@@ -1,5 +1,5 @@
1
1
  ---
2
- import NodeGraph from '@components/MDX/NodeGraph/NodeGraph';
2
+ import AstroNodeGraph from '@components/MDX/NodeGraph/AstroNodeGraph';
3
3
  import { ClientRouter } from 'astro:transitions';
4
4
  import VerticalSideBarLayout from '@layouts/VerticalSideBarLayout.astro';
5
5
  import { isEventCatalogChatEnabled } from '@utils/feature';
@@ -20,7 +20,7 @@ const { data } = props;
20
20
  <div class="bg-gray-100/50 m-4">
21
21
  <div class="h-[calc(100vh-130px)] w-full relative border border-gray-200" id={`${data.id}-portal`} transition:animate="fade">
22
22
  </div>
23
- <NodeGraph
23
+ <AstroNodeGraph
24
24
  id={data.id}
25
25
  nodes={data.nodes}
26
26
  edges={data.edges}
@@ -1,6 +1,14 @@
1
1
  import type { CollectionEntry } from 'astro:content';
2
2
  import dagre from 'dagre';
3
- import { calculatedNodes, createDagreGraph, createEdge, generatedIdForEdge, generateIdForNode } from './utils/utils';
3
+ import {
4
+ calculatedNodes,
5
+ createDagreGraph,
6
+ createEdge,
7
+ generatedIdForEdge,
8
+ generateIdForNode,
9
+ buildContextMenuForService,
10
+ buildContextMenuForResource,
11
+ } from './utils/utils';
4
12
  import { MarkerType } from '@xyflow/react';
5
13
  import { findMatchingNodes } from '@utils/collections/util';
6
14
  import { getContainers } from '@utils/collections/containers';
@@ -52,7 +60,16 @@ export const getNodesAndEdges = async ({ id, version, defaultFlow, mode = 'simpl
52
60
  type: service?.collection,
53
61
  sourcePosition: 'right',
54
62
  targetPosition: 'left',
55
- data: { mode, service: { ...service.data } },
63
+ data: {
64
+ mode,
65
+ service: { ...service.data },
66
+ contextMenu: buildContextMenuForService({
67
+ id: service.data.id,
68
+ version: service.data.version,
69
+ specifications: service.data.specifications as { type: string; path: string }[],
70
+ repository: service.data.repository as { url: string },
71
+ }),
72
+ },
56
73
  position: { x: 250, y: 0 },
57
74
  });
58
75
 
@@ -79,7 +96,15 @@ export const getNodesAndEdges = async ({ id, version, defaultFlow, mode = 'simpl
79
96
  type: 'data-products',
80
97
  sourcePosition: 'right',
81
98
  targetPosition: 'left',
82
- data: { mode, dataProduct: { ...dataProduct.data } },
99
+ data: {
100
+ mode,
101
+ dataProduct: { ...dataProduct.data },
102
+ contextMenu: buildContextMenuForResource({
103
+ collection: 'data-products',
104
+ id: dataProduct.data.id,
105
+ version: dataProduct.data.version,
106
+ }),
107
+ },
83
108
  position: { x: 250, y: 0 },
84
109
  });
85
110
 
@@ -109,6 +134,11 @@ export const getNodesAndEdges = async ({ id, version, defaultFlow, mode = 'simpl
109
134
  data: {
110
135
  ...container.data,
111
136
  },
137
+ contextMenu: buildContextMenuForResource({
138
+ collection: 'entities',
139
+ id: container.data.id,
140
+ version: container.data.version,
141
+ }),
112
142
  },
113
143
  position: { x: 0, y: 0 },
114
144
  type: 'data',
@@ -120,7 +150,17 @@ export const getNodesAndEdges = async ({ id, version, defaultFlow, mode = 'simpl
120
150
  id: generateIdForNode(service),
121
151
  sourcePosition: 'left',
122
152
  targetPosition: 'right',
123
- data: { title: service?.data.id, mode, service: { ...service.data } },
153
+ data: {
154
+ title: service?.data.id,
155
+ mode,
156
+ service: { ...service.data },
157
+ contextMenu: buildContextMenuForService({
158
+ id: service.data.id,
159
+ version: service.data.version,
160
+ specifications: service.data.specifications as { type: string; path: string }[],
161
+ repository: service.data.repository as { url: string },
162
+ }),
163
+ },
124
164
  position: { x: 0, y: 0 },
125
165
  type: service?.collection,
126
166
  });
@@ -137,8 +177,8 @@ export const getNodesAndEdges = async ({ id, version, defaultFlow, mode = 'simpl
137
177
  // type: 'animatedData',
138
178
  markerStart: {
139
179
  type: MarkerType.ArrowClosed,
140
- width: 40,
141
- height: 40,
180
+ width: 20,
181
+ height: 20,
142
182
  },
143
183
  markerEnd: undefined,
144
184
  })
@@ -152,7 +192,16 @@ export const getNodesAndEdges = async ({ id, version, defaultFlow, mode = 'simpl
152
192
  id: generateIdForNode(dataProduct),
153
193
  sourcePosition: 'left',
154
194
  targetPosition: 'right',
155
- data: { title: dataProduct?.data.id, mode, dataProduct: { ...dataProduct.data } },
195
+ data: {
196
+ title: dataProduct?.data.id,
197
+ mode,
198
+ dataProduct: { ...dataProduct.data },
199
+ contextMenu: buildContextMenuForResource({
200
+ collection: 'data-products',
201
+ id: dataProduct.data.id,
202
+ version: dataProduct.data.version,
203
+ }),
204
+ },
156
205
  position: { x: 0, y: 0 },
157
206
  type: 'data-products',
158
207
  });
@@ -168,8 +217,8 @@ export const getNodesAndEdges = async ({ id, version, defaultFlow, mode = 'simpl
168
217
  type: 'multiline',
169
218
  markerStart: {
170
219
  type: MarkerType.ArrowClosed,
171
- width: 40,
172
- height: 40,
220
+ width: 20,
221
+ height: 20,
173
222
  },
174
223
  markerEnd: undefined,
175
224
  })
@@ -189,13 +238,13 @@ export const getNodesAndEdges = async ({ id, version, defaultFlow, mode = 'simpl
189
238
  type: 'multiline',
190
239
  markerStart: {
191
240
  type: MarkerType.ArrowClosed,
192
- width: 40,
193
- height: 40,
241
+ width: 20,
242
+ height: 20,
194
243
  },
195
244
  markerEnd: {
196
245
  type: MarkerType.ArrowClosed,
197
- width: 40,
198
- height: 40,
246
+ width: 20,
247
+ height: 20,
199
248
  },
200
249
  })
201
250
  );
@@ -214,13 +263,13 @@ export const getNodesAndEdges = async ({ id, version, defaultFlow, mode = 'simpl
214
263
  type: 'multiline',
215
264
  markerStart: {
216
265
  type: MarkerType.ArrowClosed,
217
- width: 40,
218
- height: 40,
266
+ width: 20,
267
+ height: 20,
219
268
  },
220
269
  markerEnd: {
221
270
  type: MarkerType.ArrowClosed,
222
- width: 40,
223
- height: 40,
271
+ width: 20,
272
+ height: 20,
224
273
  },
225
274
  })
226
275
  );
@@ -7,6 +7,7 @@ import {
7
7
  calculatedNodes,
8
8
  createEdge,
9
9
  getColorFromString,
10
+ buildContextMenuForResource,
10
11
  } from '@utils/node-graphs/utils/utils';
11
12
 
12
13
  import { findInMap, createVersionedMap, mergeMaps, collectionToResourceMap } from '@utils/collections/util';
@@ -135,8 +136,8 @@ export const getNodesAndEdges = async ({ id, defaultFlow, version, mode = 'simpl
135
136
  markerEnd: {
136
137
  type: MarkerType.ArrowClosed,
137
138
  color: '#666',
138
- width: 40,
139
- height: 40,
139
+ width: 20,
140
+ height: 20,
140
141
  },
141
142
  })
142
143
  );
@@ -147,7 +148,15 @@ export const getNodesAndEdges = async ({ id, defaultFlow, version, mode = 'simpl
147
148
  id: generateIdForNode(dataProduct),
148
149
  sourcePosition: 'right',
149
150
  targetPosition: 'left',
150
- data: { mode, dataProduct: { ...dataProduct.data } },
151
+ data: {
152
+ mode,
153
+ dataProduct: { ...dataProduct.data },
154
+ contextMenu: buildContextMenuForResource({
155
+ collection: 'data-products',
156
+ id: dataProduct.data.id,
157
+ version: dataProduct.data.version,
158
+ }),
159
+ },
151
160
  type: 'data-products',
152
161
  });
153
162
 
@@ -191,8 +200,8 @@ export const getNodesAndEdges = async ({ id, defaultFlow, version, mode = 'simpl
191
200
  markerEnd: {
192
201
  type: MarkerType.ArrowClosed,
193
202
  color: '#666',
194
- width: 40,
195
- height: 40,
203
+ width: 20,
204
+ height: 20,
196
205
  },
197
206
  })
198
207
  );