@eventcatalog/core 3.12.8 → 3.13.0-beta.1

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 (83) 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-DINAMVEI.js → chunk-7RCUF3VG.js} +1 -1
  6. package/dist/{chunk-GOLMKUV3.js → chunk-AY2OEUWV.js} +1 -1
  7. package/dist/{chunk-6MBAYHHT.js → chunk-NXATPLVB.js} +1 -1
  8. package/dist/{chunk-JUWMXGCI.js → chunk-V3GX7FC3.js} +1 -1
  9. package/dist/{chunk-ROHEB5DM.js → chunk-VXTATPGX.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/File.tsx +7 -7
  21. package/eventcatalog/src/components/MDX/Flow/Flow.astro +2 -2
  22. package/eventcatalog/src/components/MDX/NodeGraph/AstroNodeGraph.tsx +104 -0
  23. package/eventcatalog/src/components/MDX/NodeGraph/NodeGraph.astro +2 -2
  24. package/eventcatalog/src/components/MDX/NodeGraph/README.md +85 -0
  25. package/eventcatalog/src/components/MDX/Schema.astro +3 -6
  26. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/index.astro +1 -6
  27. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/spec/[filename].astro +2 -2
  28. package/eventcatalog/src/pages/visualiser/designs/[id]/index.astro +2 -2
  29. package/eventcatalog/src/utils/collections/channels.ts +1 -26
  30. package/eventcatalog/src/utils/collections/commands.ts +1 -26
  31. package/eventcatalog/src/utils/collections/containers.ts +1 -32
  32. package/eventcatalog/src/utils/collections/data-products.ts +1 -19
  33. package/eventcatalog/src/utils/collections/diagrams.ts +0 -7
  34. package/eventcatalog/src/utils/collections/domains.ts +0 -18
  35. package/eventcatalog/src/utils/collections/entities.ts +1 -27
  36. package/eventcatalog/src/utils/collections/events.ts +1 -22
  37. package/eventcatalog/src/utils/collections/flows.ts +0 -8
  38. package/eventcatalog/src/utils/collections/queries.ts +1 -22
  39. package/eventcatalog/src/utils/collections/schemas.ts +9 -4
  40. package/eventcatalog/src/utils/collections/services.ts +0 -20
  41. package/eventcatalog/src/utils/collections/teams.ts +0 -6
  42. package/eventcatalog/src/utils/collections/users.ts +0 -6
  43. package/eventcatalog/src/utils/collections/util.ts +10 -1
  44. package/eventcatalog/src/utils/node-graphs/container-node-graph.ts +66 -17
  45. package/eventcatalog/src/utils/node-graphs/data-products-node-graph.ts +14 -5
  46. package/eventcatalog/src/utils/node-graphs/domains-node-graph.ts +1 -1
  47. package/eventcatalog/src/utils/node-graphs/message-node-graph.ts +133 -18
  48. package/eventcatalog/src/utils/node-graphs/services-node-graph.ts +36 -14
  49. package/eventcatalog/src/utils/node-graphs/utils/utils.ts +115 -4
  50. package/package.json +4 -4
  51. package/eventcatalog/src/components/MDX/NodeGraph/DownloadButton.tsx +0 -62
  52. package/eventcatalog/src/components/MDX/NodeGraph/Edges/AnimatedMessageEdge.tsx +0 -110
  53. package/eventcatalog/src/components/MDX/NodeGraph/Edges/FlowEdge.tsx +0 -96
  54. package/eventcatalog/src/components/MDX/NodeGraph/Edges/MultilineEdgeLabel.tsx +0 -52
  55. package/eventcatalog/src/components/MDX/NodeGraph/FocusMode/FocusModeContent.tsx +0 -294
  56. package/eventcatalog/src/components/MDX/NodeGraph/FocusMode/FocusModeNodeActions.tsx +0 -92
  57. package/eventcatalog/src/components/MDX/NodeGraph/FocusMode/FocusModePlaceholder.tsx +0 -26
  58. package/eventcatalog/src/components/MDX/NodeGraph/FocusMode/utils.ts +0 -163
  59. package/eventcatalog/src/components/MDX/NodeGraph/FocusModeModal.tsx +0 -99
  60. package/eventcatalog/src/components/MDX/NodeGraph/MermaidView.tsx +0 -242
  61. package/eventcatalog/src/components/MDX/NodeGraph/NodeGraph.tsx +0 -1181
  62. package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Actor.tsx +0 -46
  63. package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Channel.tsx +0 -55
  64. package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Command.tsx +0 -27
  65. package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Custom.tsx +0 -159
  66. package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Data.tsx +0 -63
  67. package/eventcatalog/src/components/MDX/NodeGraph/Nodes/DataProduct.tsx +0 -132
  68. package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Domain.tsx +0 -155
  69. package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Entity.tsx +0 -154
  70. package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Event.tsx +0 -29
  71. package/eventcatalog/src/components/MDX/NodeGraph/Nodes/ExternalSystem.tsx +0 -79
  72. package/eventcatalog/src/components/MDX/NodeGraph/Nodes/ExternalSystem2.tsx +0 -24
  73. package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Flow.tsx +0 -107
  74. package/eventcatalog/src/components/MDX/NodeGraph/Nodes/MessageContextMenu.tsx +0 -63
  75. package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Query.tsx +0 -28
  76. package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Service.tsx +0 -127
  77. package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Step.tsx +0 -64
  78. package/eventcatalog/src/components/MDX/NodeGraph/Nodes/User.tsx +0 -76
  79. package/eventcatalog/src/components/MDX/NodeGraph/Nodes/View.tsx +0 -24
  80. package/eventcatalog/src/components/MDX/NodeGraph/StepWalkthrough.tsx +0 -296
  81. package/eventcatalog/src/components/MDX/NodeGraph/StudioModal.tsx +0 -129
  82. package/eventcatalog/src/components/MDX/NodeGraph/VisualiserSearch.tsx +0 -258
  83. 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.8";
40
+ var version = "3.13.0-beta.1";
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-6MBAYHHT.js";
4
- import "../chunk-ROHEB5DM.js";
3
+ } from "../chunk-NXATPLVB.js";
4
+ import "../chunk-VXTATPGX.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.8";
109
+ var version = "3.13.0-beta.1";
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-JUWMXGCI.js";
4
- import "../chunk-6MBAYHHT.js";
3
+ } from "../chunk-V3GX7FC3.js";
4
+ import "../chunk-NXATPLVB.js";
5
5
  import "../chunk-4UVFXLPI.js";
6
- import "../chunk-ROHEB5DM.js";
6
+ import "../chunk-VXTATPGX.js";
7
7
  import "../chunk-UPONRQSN.js";
8
8
  export {
9
9
  log_build_default as default
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VERSION
3
- } from "./chunk-ROHEB5DM.js";
3
+ } from "./chunk-VXTATPGX.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-DINAMVEI.js";
3
+ } from "./chunk-7RCUF3VG.js";
4
4
  import {
5
5
  cleanup,
6
6
  getEventCatalogConfigFile
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VERSION
3
- } from "./chunk-ROHEB5DM.js";
3
+ } from "./chunk-VXTATPGX.js";
4
4
 
5
5
  // src/analytics/analytics.js
6
6
  import axios from "axios";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  raiseEvent
3
- } from "./chunk-6MBAYHHT.js";
3
+ } from "./chunk-NXATPLVB.js";
4
4
  import {
5
5
  countResources,
6
6
  serializeCounts
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "3.12.8";
2
+ var version = "3.13.0-beta.1";
3
3
 
4
4
  // src/constants.ts
5
5
  var VERSION = version;
@@ -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.8";
28
+ var version = "3.13.0-beta.1";
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-ROHEB5DM.js";
3
+ } from "./chunk-VXTATPGX.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.8";
112
+ var version = "3.13.0-beta.1";
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-JUWMXGCI.js";
10
- import "./chunk-6MBAYHHT.js";
9
+ } from "./chunk-V3GX7FC3.js";
10
+ import "./chunk-NXATPLVB.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-GOLMKUV3.js";
25
+ } from "./chunk-AY2OEUWV.js";
26
26
  import {
27
27
  logger
28
- } from "./chunk-DINAMVEI.js";
28
+ } from "./chunk-7RCUF3VG.js";
29
29
  import {
30
30
  VERSION
31
- } from "./chunk-ROHEB5DM.js";
31
+ } from "./chunk-VXTATPGX.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.8";
76
+ var version = "3.13.0-beta.1";
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-GOLMKUV3.js";
4
- import "./chunk-DINAMVEI.js";
5
- import "./chunk-ROHEB5DM.js";
3
+ } from "./chunk-AY2OEUWV.js";
4
+ import "./chunk-7RCUF3VG.js";
5
+ import "./chunk-VXTATPGX.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.8";
39
+ var version = "3.13.0-beta.1";
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-DINAMVEI.js";
4
- import "../chunk-ROHEB5DM.js";
3
+ } from "../chunk-7RCUF3VG.js";
4
+ import "../chunk-VXTATPGX.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}
@@ -1,12 +1,12 @@
1
- import fs from 'fs';
2
- import path from 'path';
1
+ import { resourceFileExists, readResourceFile, getResourceFilePath } from '@utils/resource-files';
3
2
 
4
- const File = ({ file, catalog, title }: any) => {
3
+ const File = ({ file, filePath, title }: any) => {
5
4
  try {
6
- const exists = fs.existsSync(path.join(catalog.filePath, file));
5
+ const item = { filePath };
6
+ const exists = resourceFileExists(item, file);
7
7
 
8
8
  if (exists) {
9
- const text = fs.readFileSync(path.join(catalog.filePath, file), 'utf-8');
9
+ const text = readResourceFile(item, file);
10
10
  return (
11
11
  <div className="not-prose">
12
12
  <pre className="expressive-code" data-language="json">
@@ -23,7 +23,7 @@ const File = ({ file, catalog, title }: any) => {
23
23
  </code>
24
24
  </pre>
25
25
  <div className="copy">
26
- <button title="Copy to clipboard" data-copied="Copied!" data-code={text}>
26
+ <button title="Copy to clipboard" data-copied="Copied!" data-code={text ?? ''}>
27
27
  <div></div>
28
28
  </button>
29
29
  </div>
@@ -32,7 +32,7 @@ const File = ({ file, catalog, title }: any) => {
32
32
  </div>
33
33
  );
34
34
  } else {
35
- return <div className="italic">Tried to load file from {path.join(catalog.filePath, file)}, but no file can be found</div>;
35
+ return <div className="italic">Tried to load file from {getResourceFilePath(item, file)}, but no file can be found</div>;
36
36
  }
37
37
  } catch (error) {
38
38
  console.log('Failed to load file', error);
@@ -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,20 +1,17 @@
1
1
  ---
2
2
  import fs from 'fs';
3
- import path from 'path';
4
3
  import { Code } from 'astro-expressive-code/components';
5
4
  import { getAbsoluteFilePathForAstroFile } from '@utils/files';
5
+ import { getResourceFilePath } from '@utils/resource-files';
6
6
 
7
7
  interface Props {
8
8
  file?: string;
9
- catalog: {
10
- filePath: string;
11
- };
12
9
  title?: string;
13
10
  filePath: string;
14
11
  lang?: string;
15
12
  }
16
13
 
17
- const { file = 'schema.json', catalog, title, filePath, lang = 'json' } = Astro.props;
14
+ const { file = 'schema.json', title, filePath, lang = 'json' } = Astro.props;
18
15
 
19
16
  let code: string | null = null;
20
17
 
@@ -32,6 +29,6 @@ if (exists) {
32
29
  <Code code={code} title={title || file} lang={lang} />
33
30
  </div>
34
31
  ) : (
35
- <div class="italic">Tried to load schema from {path.join(catalog.filePath, file)}, but no schema can be found</div>
32
+ <div class="italic">Tried to load schema from {getResourceFilePath({ filePath }, file)}, but no schema can be found</div>
36
33
  )
37
34
  }
@@ -564,13 +564,8 @@ nodeGraphs.push({
564
564
  }
565
565
  </style>
566
566
 
567
- <script define:vars={{ props, config }}>
568
- // Fix to pass information to componets that are client side only
569
- // and require catalog information
567
+ <script define:vars={{ config }}>
570
568
  window.eventcatalog = {};
571
- // @ts-ignore
572
- window.eventcatalog[`${props.collection}-${props.data.id}`] = props.catalog;
573
-
574
569
  window.eventcatalog.mermaid = config.mermaid;
575
570
  </script>
576
571
 
@@ -17,7 +17,7 @@ export const getStaticPaths = Page.getStaticPaths;
17
17
  const props = await Page.getData(Astro);
18
18
 
19
19
  // @ts-ignore
20
- const { collection, data, catalog, filePath, filename, path: relativeSpecPath } = props;
20
+ const { collection, data, filePath, filename, path: relativeSpecPath } = props;
21
21
  const fileName = filename || 'openapi.yml';
22
22
 
23
23
  const pathToSpec = getAbsoluteFilePathForAstroFile(filePath, fileName);
@@ -59,7 +59,7 @@ if (isRemote) {
59
59
  <DocumentMinusIcon className="mx-auto h-12 w-12 text-gray-400" />
60
60
  <h3 class="mt-2 text-sm font-semibold text-gray-900">No OpenAPI spec file found</h3>
61
61
  <p class="mt-1 text-xs text-gray-400">
62
- Could not find OpenAPI file for {data.name} in {`/${catalog.path}`}
62
+ Could not find OpenAPI file for {data.name} in {`/${collection}/${data.id}`}
63
63
  </p>
64
64
  </div>
65
65
  ) : (
@@ -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,21 +1,11 @@
1
1
  import { getCollection } from 'astro:content';
2
2
  import type { CollectionEntry } from 'astro:content';
3
- import path from 'path';
4
3
  import { getItemsFromCollectionByIdAndSemverOrLatest, createVersionedMap, satisfies } from './util';
5
4
  import type { CollectionMessageTypes } from '@types';
6
- import utils from '@eventcatalog/sdk';
7
5
 
8
- const PROJECT_DIR = process.env.PROJECT_DIR || process.cwd();
9
6
  const CACHE_ENABLED = process.env.DISABLE_EVENTCATALOG_CACHE !== 'true';
10
7
 
11
- type Channel = CollectionEntry<'channels'> & {
12
- catalog: {
13
- path: string;
14
- filePath: string;
15
- type: string;
16
- publicPath: string;
17
- };
18
- };
8
+ type Channel = CollectionEntry<'channels'>;
19
9
 
20
10
  interface Props {
21
11
  getAllVersions?: boolean;
@@ -74,8 +64,6 @@ export const getChannels = async ({ getAllVersions = true }: Props = {}): Promis
74
64
  return true;
75
65
  });
76
66
 
77
- const { getResourceFolderName } = utils(process.env.PROJECT_DIR ?? '');
78
-
79
67
  // 5. Enrich channels
80
68
  const processedChannels = await Promise.all(
81
69
  targetChannels.map(async (channel) => {
@@ -105,13 +93,6 @@ export const getChannels = async ({ getAllVersions = true }: Props = {}): Promis
105
93
  };
106
94
  });
107
95
 
108
- const folderName = await getResourceFolderName(
109
- process.env.PROJECT_DIR ?? '',
110
- channel.data.id,
111
- channel.data.version.toString()
112
- );
113
- const channelFolderName = folderName ?? channel.id.replace(`-${channel.data.version}`, '');
114
-
115
96
  return {
116
97
  ...channel,
117
98
  data: {
@@ -120,12 +101,6 @@ export const getChannels = async ({ getAllVersions = true }: Props = {}): Promis
120
101
  latestVersion,
121
102
  messages,
122
103
  },
123
- catalog: {
124
- path: path.join(channel.collection, channel.id.replace('/index.mdx', '')),
125
- filePath: path.join(process.cwd(), 'src', 'catalog-files', channel.collection, channel.id.replace('/index.mdx', '')),
126
- publicPath: path.join('/generated', channel.collection, channelFolderName),
127
- type: 'event',
128
- },
129
104
  };
130
105
  })
131
106
  );