@eventcatalog/core 2.16.1 → 2.16.3

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 (43) 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-GEPV3ACK.js → chunk-FVZU5WEI.js} +1 -1
  6. package/dist/{chunk-J5H7ICLD.js → chunk-JLXI6Z6O.js} +1 -1
  7. package/dist/{chunk-A3QFF66M.js → chunk-ULFGBIV2.js} +1 -1
  8. package/dist/constants.cjs +1 -1
  9. package/dist/constants.js +1 -1
  10. package/dist/eventcatalog.cjs +1 -1
  11. package/dist/eventcatalog.js +3 -3
  12. package/eventcatalog/package.json +69 -0
  13. package/eventcatalog/src/components/MDX/Accordion/Accordion.tsx +2 -2
  14. package/eventcatalog/src/components/MDX/AsyncAPI/AsyncAPI.astro +2 -2
  15. package/eventcatalog/src/components/MDX/ChannelInformation/ChannelInformation.tsx +2 -2
  16. package/eventcatalog/src/components/MDX/Flow/Flow.astro +2 -2
  17. package/eventcatalog/src/components/MDX/NodeGraph/DownloadButton.tsx +2 -2
  18. package/eventcatalog/src/components/MDX/NodeGraph/Edges/AnimatedMessageEdge.tsx +2 -1
  19. package/eventcatalog/src/components/MDX/NodeGraph/NodeGraph.astro +12 -1
  20. package/eventcatalog/src/components/MDX/NodeGraph/NodeGraph.tsx +6 -5
  21. package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Channel.tsx +1 -1
  22. package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Command.tsx +1 -1
  23. package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Event.tsx +1 -1
  24. package/eventcatalog/src/components/MDX/NodeGraph/Nodes/ExternalSystem.tsx +1 -1
  25. package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Query.tsx +1 -1
  26. package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Service.tsx +1 -1
  27. package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Step.tsx +3 -3
  28. package/eventcatalog/src/components/MDX/NodeGraph/Nodes/User.tsx +3 -3
  29. package/eventcatalog/src/components/MDX/OpenAPI/OpenAPI.astro +2 -2
  30. package/eventcatalog/src/components/MDX/SchemaViewer/SchemaViewer.astro +2 -2
  31. package/eventcatalog/src/components/Tables/Table.tsx +4 -4
  32. package/eventcatalog/src/hooks/eventcatalog-visualizer.ts +12 -7
  33. package/eventcatalog/src/layouts/VerticalSideBarLayout.astro +10 -1
  34. package/eventcatalog/src/pages/docs/[type]/[id]/language.astro +6 -6
  35. package/eventcatalog/src/pages/visualiser/context-map/index.astro +30 -0
  36. package/eventcatalog/src/utils/collections/icons.ts +3 -0
  37. package/eventcatalog/src/utils/collections/services.ts +35 -0
  38. package/eventcatalog/src/utils/node-graphs/domains-node-graph.ts +206 -3
  39. package/eventcatalog/src/utils/node-graphs/flows-node-graph.ts +2 -2
  40. package/eventcatalog/src/utils/node-graphs/message-node-graph.ts +1 -1
  41. package/eventcatalog/src/utils/node-graphs/services-node-graph.ts +1 -1
  42. package/eventcatalog/src/utils/node-graphs/utils/utils.ts +1 -1
  43. package/package.json +2 -2
@@ -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 = "2.16.1";
40
+ var version = "2.16.3";
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-J5H7ICLD.js";
4
- import "../chunk-GEPV3ACK.js";
3
+ } from "../chunk-JLXI6Z6O.js";
4
+ import "../chunk-FVZU5WEI.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 = "2.16.1";
109
+ var version = "2.16.3";
110
110
 
111
111
  // src/constants.ts
112
112
  var VERSION = version;
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  log_build_default
3
- } from "../chunk-A3QFF66M.js";
4
- import "../chunk-J5H7ICLD.js";
5
- import "../chunk-GEPV3ACK.js";
3
+ } from "../chunk-ULFGBIV2.js";
4
+ import "../chunk-JLXI6Z6O.js";
5
+ import "../chunk-FVZU5WEI.js";
6
6
  import "../chunk-E7TXTI7G.js";
7
7
  export {
8
8
  log_build_default as default
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "2.16.1";
2
+ var version = "2.16.3";
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-GEPV3ACK.js";
3
+ } from "./chunk-FVZU5WEI.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-J5H7ICLD.js";
3
+ } from "./chunk-JLXI6Z6O.js";
4
4
  import {
5
5
  getEventCatalogConfigFile,
6
6
  verifyRequiredFieldsAreInCatalogConfigFile
@@ -25,7 +25,7 @@ __export(constants_exports, {
25
25
  module.exports = __toCommonJS(constants_exports);
26
26
 
27
27
  // package.json
28
- var version = "2.16.1";
28
+ var version = "2.16.3";
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-GEPV3ACK.js";
3
+ } from "./chunk-FVZU5WEI.js";
4
4
  export {
5
5
  VERSION
6
6
  };
@@ -161,7 +161,7 @@ var import_axios = __toESM(require("axios"), 1);
161
161
  var import_os = __toESM(require("os"), 1);
162
162
 
163
163
  // package.json
164
- var version = "2.16.1";
164
+ var version = "2.16.3";
165
165
 
166
166
  // src/constants.ts
167
167
  var VERSION = version;
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  log_build_default
3
- } from "./chunk-A3QFF66M.js";
4
- import "./chunk-J5H7ICLD.js";
3
+ } from "./chunk-ULFGBIV2.js";
4
+ import "./chunk-JLXI6Z6O.js";
5
5
  import {
6
6
  catalogToAstro
7
7
  } from "./chunk-55YPRY5U.js";
8
8
  import {
9
9
  VERSION
10
- } from "./chunk-GEPV3ACK.js";
10
+ } from "./chunk-FVZU5WEI.js";
11
11
  import {
12
12
  generate
13
13
  } from "./chunk-YEQVKHST.js";
@@ -0,0 +1,69 @@
1
+ {
2
+ "name": "eventcatalog",
3
+ "homepage": "https://github.com/event-catalog/eventcatalog",
4
+ "repository": {
5
+ "type": "git",
6
+ "url": "https://github.com/event-catalog/eventcatalog.git",
7
+ "directory": "eventcatalog/"
8
+ },
9
+ "type": "module",
10
+ "version": "0.1.0",
11
+ "private": true,
12
+ "scripts": {
13
+ "astro": "astro",
14
+ "build": "astro build",
15
+ "dev": "astro dev",
16
+ "preview": "astro preview",
17
+ "start": "astro dev"
18
+ },
19
+ "dependencies": {
20
+ "@astrojs/markdown-remark": "^5.3.0",
21
+ "@astrojs/mdx": "^3.1.8",
22
+ "@astrojs/react": "^3.6.2",
23
+ "@astrojs/tailwind": "^5.1.2",
24
+ "@asyncapi/avro-schema-parser": "^3.0.24",
25
+ "@asyncapi/parser": "^3.4.0",
26
+ "@asyncapi/react-component": "^2.4.3",
27
+ "@headlessui/react": "^2.0.3",
28
+ "@heroicons/react": "^2.1.3",
29
+ "@stoplight/json-schema-viewer": "^4.7.0",
30
+ "@stoplight/mosaic": "^1.53.2",
31
+ "@tailwindcss/typography": "^0.5.13",
32
+ "@tanstack/react-table": "^8.17.3",
33
+ "@xyflow/react": "^12.3.6",
34
+ "astro": "^4.16.5",
35
+ "astro-expressive-code": "^0.36.1",
36
+ "astro-pagefind": "^1.6.0",
37
+ "astro-seo": "^0.8.4",
38
+ "dagre": "^0.8.5",
39
+ "diff": "^7.0.0",
40
+ "diff2html": "^3.4.48",
41
+ "html-to-image": "^1.11.11",
42
+ "js-yaml": "^4.1.0",
43
+ "lodash.debounce": "^4.0.8",
44
+ "lodash.merge": "4.6.2",
45
+ "lucide-react": "^0.453.0",
46
+ "mermaid": "^10.9.1",
47
+ "prismjs": "^1.29.0",
48
+ "rapidoc": "^9.3.4",
49
+ "react": "^18.3.1",
50
+ "react-dom": "^18.3.1",
51
+ "rehype-slug": "^6.0.0",
52
+ "remark-gfm": "^3.0.1",
53
+ "semver": "7.6.3",
54
+ "tailwindcss": "^3.4.3",
55
+ "unist-util-visit": "^5.0.0"
56
+ },
57
+ "devDependencies": {
58
+ "@types/dagre": "^0.7.52",
59
+ "@types/diff": "^5.2.2",
60
+ "@types/js-yaml": "^4.0.9",
61
+ "@types/lodash.debounce": "^4.0.9",
62
+ "@types/lodash.merge": "4.6.9",
63
+ "@types/node": "^20.14.2",
64
+ "@types/react": "^18.3.3",
65
+ "@types/react-dom": "^18.3.0",
66
+ "@types/semver": "^7.5.8",
67
+ "typescript": "^5.4.5"
68
+ }
69
+ }
@@ -7,7 +7,7 @@ export default function Example({ title, children }: any) {
7
7
  <div className="border border-gray-200 rounded-md px-4 shadow-sm py-2 accordion">
8
8
  <Disclosure as="div" key={title} className="">
9
9
  {({ open }) => (
10
- <>
10
+ <div>
11
11
  <DisclosureButton className="flex w-full items-start justify-between text-left text-gray-900">
12
12
  <span className="text-base font-semibold leading-7">{title}</span>
13
13
  <span className="ml-6 flex h-7 items-center">
@@ -21,7 +21,7 @@ export default function Example({ title, children }: any) {
21
21
  <DisclosurePanel as="dd" className="pr-12 not-prose py-4">
22
22
  <p className="text-base leading-7 text-gray-600">{children}</p>
23
23
  </DisclosurePanel>
24
- </>
24
+ </div>
25
25
  )}
26
26
  </Disclosure>
27
27
  </div>
@@ -4,13 +4,13 @@ import Admonition from '../Admonition';
4
4
 
5
5
  <div class="mb-4">
6
6
  <Admonition type="warning">
7
- <>
7
+ <div>
8
8
  <span class="block font-bold">{`<AsyncAPI/>`} component now deprecated</span>
9
9
  <span class="block"
10
10
  >Use the new specifications frontmatter api. <a href="https://www.eventcatalog.dev/docs/api/service-api"
11
11
  >Read more here.</a
12
12
  ></span
13
13
  >
14
- </>
14
+ </div>
15
15
  </Admonition>
16
16
  </div>
@@ -25,9 +25,9 @@ const ChannelParameters = (data: CollectionEntry<'channels'>['data']) => {
25
25
  <div>
26
26
  <p className="text-md">
27
27
  {data.address && (
28
- <>
28
+ <div>
29
29
  <span className="font-semibold">Address:</span> <code className="bg-gray-100 p-1 rounded">{data.address}</code>
30
- </>
30
+ </div>
31
31
  )}
32
32
  {data.protocols && data.protocols.length > 0 && (
33
33
  <div className="mt-2 flex items-center space-x-1">
@@ -23,12 +23,12 @@ const { nodes, edges } = await getNodesAndEdges({
23
23
  {
24
24
  !flow && (
25
25
  <Admonition type="warning">
26
- <>
26
+ <div>
27
27
  <span class="block font-bold">{`<Flow/>`} failed to load</span>
28
28
  <span class="block">
29
29
  Tried to load flow id: {id} with version {version}. Make sure you have this flow defined in your project.
30
30
  </span>
31
- </>
31
+ </div>
32
32
  </Admonition>
33
33
  )
34
34
  }
@@ -1,4 +1,4 @@
1
- import { Panel, useReactFlow, getNodesBounds, getViewportForBounds } from 'reactflow';
1
+ import { Panel, useReactFlow, getNodesBounds, getViewportForBounds } from '@xyflow/react';
2
2
  import { toPng } from 'html-to-image';
3
3
  import { DocumentArrowDownIcon } from '@heroicons/react/24/outline';
4
4
 
@@ -19,7 +19,7 @@ function DownloadButton({ filename, addPadding = true }: { filename?: string; ad
19
19
  const nodesBounds = getNodesBounds(getNodes());
20
20
  const width = imageWidth > nodesBounds.width ? imageWidth : nodesBounds.width;
21
21
  const height = imageHeight > nodesBounds.height ? imageHeight : nodesBounds.height;
22
- const viewport = getViewportForBounds(nodesBounds, width, height, 0.5, 2);
22
+ const viewport = getViewportForBounds(nodesBounds, width, height, 0.5, 2, 0);
23
23
 
24
24
  // Hide the button
25
25
  // @ts-ignore
@@ -1,5 +1,5 @@
1
1
  import { useMemo } from 'react';
2
- import { BaseEdge, getBezierPath } from 'reactflow';
2
+ import { BaseEdge, getBezierPath } from '@xyflow/react';
3
3
 
4
4
  const AnimatedMessageEdge = ({
5
5
  id,
@@ -44,6 +44,7 @@ const AnimatedMessageEdge = ({
44
44
  const randomDelay = useMemo(() => Math.random() * 1, []);
45
45
 
46
46
  return (
47
+ // @ts-ignore
47
48
  <>
48
49
  <BaseEdge id={id} path={edgePath} markerEnd={markerEnd} />
49
50
  {/* Circle Icon */}
@@ -6,7 +6,10 @@ import {
6
6
  getNodesAndEdgesForEvents,
7
7
  getNodesAndEdgesForQueries,
8
8
  } from '@utils/node-graphs/message-node-graph';
9
- import { getNodesAndEdges as getNodesAndEdgesForDomain } from '@utils/node-graphs/domains-node-graph';
9
+ import {
10
+ getNodesAndEdges as getNodesAndEdgesForDomain,
11
+ getNodesAndEdgesForDomainContextMap,
12
+ } from '@utils/node-graphs/domains-node-graph';
10
13
  import { getNodesAndEdges as getNodesAndEdgesForFlows } from '@utils/node-graphs/flows-node-graph';
11
14
 
12
15
  interface Props {
@@ -24,8 +27,10 @@ interface Props {
24
27
  }
25
28
 
26
29
  const { id, collection, title, mode = 'simple', linkTo = 'docs', version, href, linksToVisualiser } = Astro.props;
30
+
27
31
  let nodes = [],
28
32
  edges = [];
33
+
29
34
  const getNodesAndEdgesFunctions = {
30
35
  services: getNodesAndEdgesForService,
31
36
  events: getNodesAndEdgesForEvents,
@@ -47,6 +52,12 @@ if (collection in getNodesAndEdgesFunctions) {
47
52
  nodes = fetchedNodes;
48
53
  edges = fetchedEdges;
49
54
  }
55
+
56
+ if (collection === 'domain-context-map') {
57
+ const { nodes: fetchedNodes, edges: fetchedEdges } = await getNodesAndEdgesForDomainContextMap({});
58
+ nodes = fetchedNodes;
59
+ edges = fetchedEdges;
60
+ }
50
61
  ---
51
62
 
52
63
  <div>
@@ -1,6 +1,7 @@
1
1
  import { useEffect, useMemo, useState, useCallback, useRef } from 'react';
2
2
  import { createPortal } from 'react-dom';
3
- import ReactFlow, {
3
+ import {
4
+ ReactFlow,
4
5
  Background,
5
6
  ConnectionLineType,
6
7
  Controls,
@@ -11,8 +12,8 @@ import ReactFlow, {
11
12
  type Edge,
12
13
  type Node,
13
14
  useReactFlow,
14
- } from 'reactflow';
15
- import 'reactflow/dist/style.css';
15
+ } from '@xyflow/react';
16
+ import '@xyflow/react/dist/style.css';
16
17
 
17
18
  // Nodes and edges
18
19
  import ServiceNode from './Nodes/Service';
@@ -105,10 +106,10 @@ const NodeGraphBuilder = ({
105
106
  (_: any, node: Node) => {
106
107
  if (linksToVisualiser) {
107
108
  if (node.type === 'events' || node.type === 'commands') {
108
- navigate(getVisualiserUrlForCollection(node.data.message));
109
+ navigate(getVisualiserUrlForCollection(node.data.message as CollectionEntry<CollectionTypes>));
109
110
  }
110
111
  if (node.type === 'services') {
111
- navigate(getVisualiserUrlForCollection(node.data.service));
112
+ navigate(getVisualiserUrlForCollection(node.data.service as CollectionEntry<'services'>));
112
113
  }
113
114
  return;
114
115
  }
@@ -2,7 +2,7 @@ import { BoltIcon } from '@heroicons/react/16/solid';
2
2
  import { ArrowsRightLeftIcon } from '@heroicons/react/20/solid';
3
3
  import type { CollectionMessageTypes, CollectionTypes } from '@types';
4
4
  import type { CollectionEntry } from 'astro:content';
5
- import { Handle } from 'reactflow';
5
+ import { Handle } from '@xyflow/react';
6
6
 
7
7
  interface Data {
8
8
  title: string;
@@ -1,6 +1,6 @@
1
1
  import { ChatBubbleLeftIcon } from '@heroicons/react/16/solid';
2
2
  import type { CollectionEntry } from 'astro:content';
3
- import { Handle } from 'reactflow';
3
+ import { Handle } from '@xyflow/react';
4
4
 
5
5
  interface Data {
6
6
  title: string;
@@ -1,6 +1,6 @@
1
1
  import { BoltIcon } from '@heroicons/react/16/solid';
2
2
  import type { CollectionEntry } from 'astro:content';
3
- import { Handle } from 'reactflow';
3
+ import { Handle } from '@xyflow/react';
4
4
 
5
5
  interface Data {
6
6
  title: string;
@@ -1,7 +1,7 @@
1
1
  import { ServerIcon } from '@heroicons/react/16/solid';
2
2
  import { GlobeAmericasIcon } from '@heroicons/react/20/solid';
3
3
  import type { CollectionEntry } from 'astro:content';
4
- import { Handle } from 'reactflow';
4
+ import { Handle } from '@xyflow/react';
5
5
 
6
6
  interface Data {
7
7
  label: string;
@@ -1,6 +1,6 @@
1
1
  import { MagnifyingGlassIcon } from '@heroicons/react/16/solid';
2
2
  import type { CollectionEntry } from 'astro:content';
3
- import { Handle } from 'reactflow';
3
+ import { Handle } from '@xyflow/react';
4
4
 
5
5
  interface Data {
6
6
  title: string;
@@ -1,6 +1,6 @@
1
1
  import { ServerIcon } from '@heroicons/react/16/solid';
2
2
  import type { CollectionEntry } from 'astro:content';
3
- import { Handle } from 'reactflow';
3
+ import { Handle } from '@xyflow/react';
4
4
 
5
5
  interface Data {
6
6
  label: string;
@@ -1,4 +1,4 @@
1
- import { Handle } from 'reactflow';
1
+ import { Handle } from '@xyflow/react';
2
2
 
3
3
  interface Data {
4
4
  title: string;
@@ -45,7 +45,7 @@ export default function StepNode({ data, sourcePosition, targetPosition }: any)
45
45
  )}
46
46
 
47
47
  {summary && (
48
- <>
48
+ <div>
49
49
  <div className={classNames(mode === 'full' ? `border-b border-gray-200` : '')}>
50
50
  <span className="text-xs font-bold block pb-0.5">{title}</span>
51
51
  </div>
@@ -56,7 +56,7 @@ export default function StepNode({ data, sourcePosition, targetPosition }: any)
56
56
  </div>
57
57
  </div>
58
58
  )}
59
- </>
59
+ </div>
60
60
  )}
61
61
  </div>
62
62
  </div>
@@ -1,5 +1,5 @@
1
1
  import { UserIcon } from '@heroicons/react/20/solid';
2
- import { Handle } from 'reactflow';
2
+ import { Handle } from '@xyflow/react';
3
3
 
4
4
  interface Data {
5
5
  title: string;
@@ -57,7 +57,7 @@ export default function UserNode({ data, sourcePosition, targetPosition }: any)
57
57
  )}
58
58
 
59
59
  {summary && mode === 'full' && (
60
- <>
60
+ <div>
61
61
  <div className={classNames(mode === 'full' ? `border-b border-gray-200` : '')}>
62
62
  <span className="text-xs font-bold block pb-0.5">{name}</span>
63
63
  </div>
@@ -68,7 +68,7 @@ export default function UserNode({ data, sourcePosition, targetPosition }: any)
68
68
  </div>
69
69
  </div>
70
70
  )}
71
- </>
71
+ </div>
72
72
  )}
73
73
  </div>
74
74
  </div>
@@ -4,13 +4,13 @@ import Admonition from '../Admonition';
4
4
 
5
5
  <div class="mb-4">
6
6
  <Admonition type="warning">
7
- <>
7
+ <div>
8
8
  <span class="block font-bold">{`<OpenAPI/>`} component now deprecated</span>
9
9
  <span class="block"
10
10
  >Use the new specifications frontmatter api. <a href="https://www.eventcatalog.dev/docs/api/service-api"
11
11
  >Read more here.</a
12
12
  ></span
13
13
  >
14
- </>
14
+ </div>
15
15
  </Admonition>
16
16
  </div>
@@ -82,10 +82,10 @@ try {
82
82
  {/* User has tried to load the schema, but it was not found on file system */}
83
83
  {!schema.exists && (
84
84
  <Admonition type="warning">
85
- <>
85
+ <div>
86
86
  <span class="block font-bold">{`<SchemaViewer/>`} failed to load</span>
87
87
  <span class="block">Tried to load schema from {schema.schemaPath}, but no schema can be found</span>
88
- </>
88
+ </div>
89
89
  </Admonition>
90
90
  )}
91
91
  </div>
@@ -67,7 +67,7 @@ export const Table = ({
67
67
  });
68
68
 
69
69
  return (
70
- <>
70
+ <div>
71
71
  {/* <div className='text-right text-gray-400'>{table.getPrePaginationRowModel().rows.length} results</div> */}
72
72
  <div className=" bg-gray-100/20 rounded-md border-2 border-gray-200 shadow-sm ">
73
73
  <table className="min-w-full divide-y divide-gray-200 rounded-md ">
@@ -171,7 +171,7 @@ export const Table = ({
171
171
  </select>
172
172
  </div>
173
173
  </div>
174
- </>
174
+ </div>
175
175
  );
176
176
  };
177
177
 
@@ -225,7 +225,7 @@ function Filter({ column }: { column: Column<any, unknown> }) {
225
225
  }, [column.getFacetedUniqueValues(), filterVariant]);
226
226
 
227
227
  return (
228
- <>
228
+ <div>
229
229
  {/* Autocomplete suggestions from faceted values feature */}
230
230
  <datalist id={column.id + 'list'}>
231
231
  {sortedUniqueValues.map((value: any, index) => (
@@ -241,6 +241,6 @@ function Filter({ column }: { column: Column<any, unknown> }) {
241
241
  list={column.id + 'list'}
242
242
  />
243
243
  <div className="h-1" />
244
- </>
244
+ </div>
245
245
  );
246
246
  }
@@ -1,5 +1,5 @@
1
1
  import { useCallback, useMemo, useState, useEffect } from 'react';
2
- import { type Edge, type Node } from 'reactflow';
2
+ import { type Edge, type Node } from '@xyflow/react';
3
3
  import {
4
4
  createEdge,
5
5
  generatedIdForEdge,
@@ -8,6 +8,8 @@ import {
8
8
  getEdgeLabelForServiceAsTarget,
9
9
  getNodesAndEdgesFromDagre,
10
10
  } from '@utils/node-graphs/utils/utils';
11
+ import type { CollectionEntry } from 'astro:content';
12
+ import type { CollectionMessageTypes, CollectionTypes } from '@types';
11
13
 
12
14
  interface EventCatalogVisualizerProps {
13
15
  nodes: Node[];
@@ -50,18 +52,21 @@ export const useEventCatalogVisualiser = ({ nodes, edges, setNodes, setEdges }:
50
52
  return [...acc, edge];
51
53
  }
52
54
 
55
+ const dataTarget = data?.target as CollectionEntry<CollectionTypes>;
56
+ const dataSource = data?.source as CollectionEntry<CollectionTypes>;
57
+
53
58
  if (sourceIsChannel) {
54
59
  const edgeLabel =
55
- data.target.collection === 'services'
56
- ? getEdgeLabelForMessageAsSource(data.source)
57
- : getEdgeLabelForServiceAsTarget(data.target);
60
+ dataTarget?.collection === 'services'
61
+ ? getEdgeLabelForMessageAsSource(dataSource as CollectionEntry<CollectionMessageTypes>)
62
+ : getEdgeLabelForServiceAsTarget(dataTarget as CollectionEntry<CollectionMessageTypes>);
58
63
 
59
64
  return [
60
65
  ...acc,
61
66
  createEdge({
62
- id: generatedIdForEdge(data.source, data.target),
63
- source: generateIdForNode(data.source),
64
- target: generateIdForNode(data.target),
67
+ id: generatedIdForEdge(dataSource, dataTarget),
68
+ source: generateIdForNode(dataSource),
69
+ target: generateIdForNode(dataTarget),
65
70
  label: edgeLabel,
66
71
  }),
67
72
  ];
@@ -95,7 +95,7 @@ const navigationItems = [
95
95
  },
96
96
  ];
97
97
 
98
- const sideNav = allData.reduce((acc, item) => {
98
+ const allDataAsSideNav = allData.reduce((acc, item) => {
99
99
  const title = item.collection;
100
100
  const group = acc[title] || [];
101
101
  const currentPath = Astro.url.pathname;
@@ -129,6 +129,15 @@ const sideNav = allData.reduce((acc, item) => {
129
129
  };
130
130
  }, {} as any);
131
131
 
132
+ const sideNav = {
133
+ ...(currentPath.includes('visualiser')
134
+ ? {
135
+ 'bounded context map': [{ label: 'Domain map', href: '/visualiser/context-map', collection: 'bounded-context-map' }],
136
+ }
137
+ : {}),
138
+ ...allDataAsSideNav,
139
+ };
140
+
132
141
  const currentNavigationItem = navigationItems.find((item) => item.current);
133
142
  const { title, description, sidebar: showSideBarOverride } = Astro.props;
134
143
 
@@ -81,7 +81,7 @@ const ubiquitousLanguage = ubiquitousLanguages[0];
81
81
  <div class="py-4 w-full min-h-[calc(100vh-10em)]">
82
82
  {
83
83
  ubiquitousLanguage && (
84
- <>
84
+ <div>
85
85
  <div class="mb-6">
86
86
  <input
87
87
  type="text"
@@ -102,13 +102,13 @@ const ubiquitousLanguage = ubiquitousLanguages[0];
102
102
  <div class="term-card block bg-white border border-gray-200 rounded-lg p-6 transition-all duration-300 ease-in-out hover:shadow-md hover:border-primary focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-primary focus:ring-white min-h-[12em] cursor-pointer">
103
103
  <div class="flex flex-col h-full space-y-8">
104
104
  {term.icon && (
105
- <>
105
+ <div>
106
106
  {(() => {
107
107
  const Icon = LucideIcons[term.icon as keyof typeof LucideIcons];
108
108
  //@ts-ignore
109
109
  return Icon ? <Icon className="w-6 h-6 text-primary" /> : null;
110
110
  })()}
111
- </>
111
+ </div>
112
112
  )}
113
113
  <div>
114
114
  <h3 class="text-gray-800 text-lg font-semibold transition-colors duration-300 ease-in-out group-hover:text-gray-300">
@@ -119,12 +119,12 @@ const ubiquitousLanguage = ubiquitousLanguages[0];
119
119
  {term.summary}
120
120
  </p>
121
121
  {term.description && (
122
- <>
122
+ <div>
123
123
  <p class="description-text hidden text-gray-600 transition-colors duration-300 ease-in-out group-hover:text-gray-200 m-0 font-light text-sm whitespace-pre-line">
124
124
  {term.description}
125
125
  </p>
126
126
  <span class="show-more-text text-sm text-primary font-medium">Show more</span>
127
- </>
127
+ </div>
128
128
  )}
129
129
  </div>
130
130
  </div>
@@ -138,7 +138,7 @@ const ubiquitousLanguage = ubiquitousLanguages[0];
138
138
  <h3 class="text-lg font-medium text-gray-900">No matching terms</h3>
139
139
  <p class="mt-2 text-sm text-gray-500">Try adjusting your search terms.</p>
140
140
  </div>
141
- </>
141
+ </div>
142
142
  )
143
143
  }
144
144
  </div>
@@ -0,0 +1,30 @@
1
+ ---
2
+ import NodeGraph from '@components/MDX/NodeGraph/NodeGraph.astro';
3
+ import { ViewTransitions } from 'astro:transitions';
4
+ import VerticalSideBarLayout from '@layouts/VerticalSideBarLayout.astro';
5
+ ---
6
+
7
+ <VerticalSideBarLayout title={`Visualiser | Bounded context map`}>
8
+ <div class="bg-gray-100/50 m-4">
9
+ <div
10
+ class="h-[calc(100vh-110px)] w-full relative border border-gray-200"
11
+ id={`domain-context-map-portal`}
12
+ transition:animate="fade"
13
+ >
14
+ </div>
15
+ <NodeGraph
16
+ id="domain-context-map"
17
+ collection="domain-context-map"
18
+ title="Bounded context map"
19
+ mode="full"
20
+ linkTo="visualiser"
21
+ version="1.0.0"
22
+ linksToVisualiser={false}
23
+ href={{
24
+ label: ``,
25
+ url: '/',
26
+ }}
27
+ />
28
+ </div>
29
+ <ViewTransitions />
30
+ </VerticalSideBarLayout>
@@ -9,6 +9,7 @@ import {
9
9
  UserIcon,
10
10
  ArrowsRightLeftIcon,
11
11
  VariableIcon,
12
+ MapIcon,
12
13
  } from '@heroicons/react/24/outline';
13
14
  import { BookText } from 'lucide-react';
14
15
 
@@ -36,6 +37,8 @@ export const getIconForCollection = (collection: string) => {
36
37
  return VariableIcon;
37
38
  case 'ubiquitousLanguages':
38
39
  return BookText;
40
+ case 'bounded-context-map':
41
+ return MapIcon;
39
42
  default:
40
43
  return ServerIcon;
41
44
  }
@@ -2,6 +2,7 @@ import { getItemsFromCollectionByIdAndSemverOrLatest, getVersionForCollectionIte
2
2
  import { getCollection } from 'astro:content';
3
3
  import type { CollectionEntry } from 'astro:content';
4
4
  import path from 'path';
5
+ import semver from 'semver';
5
6
 
6
7
  const PROJECT_DIR = process.env.PROJECT_DIR || process.cwd();
7
8
 
@@ -65,3 +66,37 @@ export const getServices = async ({ getAllVersions = true }: Props = {}): Promis
65
66
  };
66
67
  });
67
68
  };
69
+
70
+ export const getProducersOfMessage = (services: Service[], message: CollectionEntry<'events' | 'commands' | 'queries'>) => {
71
+ return services.filter((service) => {
72
+ return service.data.sends?.some((send) => {
73
+ const idMatch = send.id === message.data.id;
74
+
75
+ // If no version specified in send, treat as 'latest'
76
+ if (!send.version) return idMatch;
77
+
78
+ // If version is 'latest', match any version
79
+ if (send.version === 'latest') return idMatch;
80
+
81
+ // Use semver to compare versions
82
+ return idMatch && semver.satisfies(message.data.version, send.version);
83
+ });
84
+ });
85
+ };
86
+
87
+ export const getConsumersOfMessage = (services: Service[], message: CollectionEntry<'events' | 'commands' | 'queries'>) => {
88
+ return services.filter((service) => {
89
+ return service.data.receives?.some((receive) => {
90
+ const idMatch = receive.id === message.data.id;
91
+
92
+ // If no version specified in send, treat as 'latest'
93
+ if (!receive.version) return idMatch;
94
+
95
+ // If version is 'latest', match any version
96
+ if (receive.version === 'latest') return idMatch;
97
+
98
+ // Use semver to compare versions
99
+ return idMatch && semver.satisfies(message.data.version, receive.version);
100
+ });
101
+ });
102
+ };
@@ -1,19 +1,222 @@
1
1
  import { getCollection } from 'astro:content';
2
- import { createDagreGraph, calculatedNodes } from '@utils/node-graphs/utils/utils';
2
+ import {
3
+ createDagreGraph,
4
+ calculatedNodes,
5
+ generateIdForNode,
6
+ createNode,
7
+ getEdgeLabelForServiceAsTarget,
8
+ generatedIdForEdge,
9
+ createEdge,
10
+ } from '@utils/node-graphs/utils/utils';
3
11
  import { getNodesAndEdges as getServicesNodeAndEdges } from './services-node-graph';
4
12
  import merge from 'lodash.merge';
5
13
  import { getItemsFromCollectionByIdAndSemverOrLatest } from '@utils/collections/util';
14
+ import type { Node } from '@xyflow/react';
15
+ import { getProducersOfMessage } from '@utils/collections/services';
6
16
 
7
17
  type DagreGraph = any;
8
18
 
9
19
  interface Props {
20
+ defaultFlow?: DagreGraph;
21
+ }
22
+
23
+ export const getNodesAndEdgesForDomainContextMap = async ({ defaultFlow = null }: Props) => {
24
+ const flow = defaultFlow ?? createDagreGraph({ ranksep: 360, nodesep: 50, edgesep: 50 });
25
+ let nodes = [] as any,
26
+ edges = [] as any;
27
+
28
+ const allDomains = await getCollection('domains');
29
+ const domains = allDomains.filter((domain) => !domain.id.includes('/versioned'));
30
+ const services = await getCollection('services');
31
+
32
+ const events = await getCollection('events');
33
+ const commands = await getCollection('commands');
34
+ const queries = await getCollection('queries');
35
+
36
+ const messages = [...events, ...commands, ...queries];
37
+
38
+ domains.forEach((domain, index) => {
39
+ const nodeId = generateIdForNode(domain);
40
+ const rawServices = domain.data.services ?? [];
41
+ const domainServices = rawServices
42
+ .map((service) => getItemsFromCollectionByIdAndSemverOrLatest(services, service.id, service.version))
43
+ .flat()
44
+ .filter((e) => e !== undefined);
45
+
46
+ // Calculate domain node size based on services
47
+ const servicesCount = domainServices.length;
48
+ const SERVICES_PER_ROW = 1;
49
+ const SERVICE_WIDTH = 330;
50
+ const SERVICE_HEIGHT = 100;
51
+ const PADDING = 40;
52
+ const TITLE_HEIGHT = 20;
53
+
54
+ const rows = Math.ceil(servicesCount / SERVICES_PER_ROW);
55
+ const domainWidth = SERVICE_WIDTH * SERVICES_PER_ROW;
56
+ const domainHeight = SERVICE_HEIGHT * rows + PADDING * 4;
57
+
58
+ // Position domains in a grid layout
59
+ const DOMAINS_PER_ROW = 2;
60
+ const rowIndex = Math.floor(index / DOMAINS_PER_ROW);
61
+ const colIndex = index % DOMAINS_PER_ROW;
62
+
63
+ const test = servicesCount * SERVICE_HEIGHT + PADDING * 2;
64
+
65
+ nodes.push({
66
+ id: nodeId,
67
+ type: 'group',
68
+ position: {
69
+ x: colIndex * (domainWidth + 400), // Increased from 100 to 400px gap between domains
70
+ y: rowIndex * (domainHeight + 300), // Increased from 100 to 300px gap between rows
71
+ },
72
+ style: {
73
+ width: domainWidth,
74
+ height: domainHeight,
75
+ backgroundColor: 'transparent',
76
+ borderRadius: '8px',
77
+ border: '1px solid #ddd',
78
+ 'box-shadow': '0 0 10px 0 rgba(0, 0, 0, 0.1)',
79
+ },
80
+ data: {
81
+ label: domain.data.name,
82
+ domain,
83
+ },
84
+ });
85
+
86
+ nodes.push({
87
+ id: `domain-context-map-title-${domain.data.name}`,
88
+ data: { label: `Bounded Context: ${domain.data.name}` },
89
+ position: { x: 0, y: 0 },
90
+ style: {
91
+ height: 40,
92
+ backgroundColor: 'transparent',
93
+ border: 'none',
94
+ color: 'black',
95
+ width: domainWidth,
96
+ },
97
+ extent: 'parent',
98
+ parentId: nodeId,
99
+ connectable: false,
100
+ sourcePosition: 'left',
101
+ targetPosition: 'right',
102
+ draggable: false,
103
+ } as Node);
104
+
105
+ // Position services in a grid within the domain
106
+ if (domainServices) {
107
+ domainServices.forEach((service, serviceIndex) => {
108
+ const row = Math.floor(serviceIndex / SERVICES_PER_ROW);
109
+ const col = serviceIndex % SERVICES_PER_ROW;
110
+ const serviceNodeId = `service-${domain.id}-${service.id}`;
111
+
112
+ // Add spacing between services
113
+ const SERVICE_MARGIN = 25;
114
+ const xPosition = PADDING + col * (SERVICE_WIDTH + SERVICE_MARGIN) + 20;
115
+ const yPosition = PADDING + row * (SERVICE_HEIGHT + SERVICE_MARGIN) + TITLE_HEIGHT;
116
+
117
+ nodes.push({
118
+ id: generateIdForNode(service),
119
+ sourcePosition: 'right',
120
+ targetPosition: 'left',
121
+ type: 'services',
122
+ position: {
123
+ x: xPosition,
124
+ y: yPosition,
125
+ },
126
+ parentId: nodeId,
127
+ extent: 'parent',
128
+ draggable: false,
129
+ data: {
130
+ mode: 'full',
131
+ service,
132
+ },
133
+ });
134
+
135
+ // Edges
136
+ const rawReceives = service.data.receives ?? [];
137
+ const rawSends = service.data.sends ?? [];
138
+
139
+ const receives = rawReceives
140
+ .map((receive) => getItemsFromCollectionByIdAndSemverOrLatest(messages, receive.id, receive.version))
141
+ .flat();
142
+ const sends = rawSends.map((send) => getItemsFromCollectionByIdAndSemverOrLatest(messages, send.id, send.version)).flat();
143
+
144
+ for (const receive of receives) {
145
+ const producers = getProducersOfMessage(services, receive);
146
+
147
+ for (const producer of producers) {
148
+ const isSameDomain = domainServices.some((domainService) => domainService.data.id === producer.data.id);
149
+
150
+ if (!isSameDomain) {
151
+ // WIP... adding messages?
152
+ // edges.push(createEdge({
153
+ // id: generatedIdForEdge(receive, service),
154
+ // source: generateIdForNode(receive),
155
+ // target: generateIdForNode(service),
156
+ // label: getEdgeLabelForServiceAsTarget(receive),
157
+ // zIndex: 1000,
158
+ // }));
159
+
160
+ // Find the producer and consumer nodes to get their positions
161
+ // const producerNode = nodes.find(n => n.id === generateIdForNode(producer));
162
+ // const consumerNode = nodes.find(n => n.id === generateIdForNode(service));
163
+
164
+ edges.push(
165
+ createEdge({
166
+ id: generatedIdForEdge(producer, service),
167
+ source: generateIdForNode(producer),
168
+ target: generateIdForNode(service),
169
+ label: getEdgeLabelForServiceAsTarget(receive),
170
+ zIndex: 1000,
171
+ })
172
+ );
173
+
174
+ // // Calculate middle position between producer and consumer
175
+ // const messageX = (producerNode?.position?.x ?? 0) +
176
+ // ((consumerNode?.position?.x ?? 0) - (producerNode?.position?.x ?? 0)) / 2;
177
+ // const messageY = (producerNode?.position?.y ?? 0) +
178
+ // ((consumerNode?.position?.y ?? 0) - (producerNode?.position?.y ?? 0)) / 2;
179
+
180
+ // nodes.push({
181
+ // id: generateIdForNode(receive),
182
+ // type: receive.collection,
183
+ // sourcePosition: 'right',
184
+ // targetPosition: 'left',
185
+ // data: {
186
+ // message: receive,
187
+ // mode: 'full',
188
+ // },
189
+ // position: { x: messageX, y: messageY },
190
+ // });
191
+
192
+ // edges.push(createEdge({
193
+ // id: generatedIdForEdge(producer, receive),
194
+ // source: generateIdForNode(producer),
195
+ // target: generateIdForNode(receive),
196
+ // label: getEdgeLabelForServiceAsTarget(receive),
197
+ // zIndex: 1000,
198
+ // }));
199
+ }
200
+ }
201
+ }
202
+ });
203
+ }
204
+ });
205
+
206
+ return {
207
+ nodes,
208
+ edges,
209
+ };
210
+ };
211
+
212
+ interface NodesAndEdgesProps {
10
213
  id: string;
11
214
  version: string;
12
215
  defaultFlow?: DagreGraph;
13
- mode?: 'simple' | 'full';
216
+ mode: 'simple' | 'full';
14
217
  }
15
218
 
16
- export const getNodesAndEdges = async ({ id, version, defaultFlow, mode = 'simple' }: Props) => {
219
+ export const getNodesAndEdges = async ({ id, version, defaultFlow, mode = 'simple' }: NodesAndEdgesProps) => {
17
220
  const flow = defaultFlow || createDagreGraph({ ranksep: 360, nodesep: 50, edgesep: 50 });
18
221
  let nodes = new Map(),
19
222
  edges = new Map();
@@ -1,8 +1,8 @@
1
1
  import { getCollection, type CollectionEntry } from 'astro:content';
2
2
  import dagre from 'dagre';
3
3
  import { createDagreGraph, calculatedNodes } from '@utils/node-graphs/utils/utils';
4
- import { MarkerType } from 'reactflow';
5
- import type { Node as NodeType } from 'reactflow';
4
+ import { MarkerType } from '@xyflow/react';
5
+ import type { Node as NodeType } from '@xyflow/react';
6
6
  import { getItemsFromCollectionByIdAndSemverOrLatest } from '@utils/collections/util';
7
7
 
8
8
  type DagreGraph = any;
@@ -12,7 +12,7 @@ import {
12
12
  getEdgeLabelForMessageAsSource,
13
13
  getEdgeLabelForServiceAsTarget,
14
14
  } from './utils/utils';
15
- import { MarkerType } from 'reactflow';
15
+ import { MarkerType } from '@xyflow/react';
16
16
  import { findMatchingNodes } from '@utils/collections/util';
17
17
  import type { CollectionMessageTypes } from '@types';
18
18
  import { getCommands } from '@utils/commands';
@@ -9,7 +9,7 @@ import {
9
9
  getChannelNodesAndEdges,
10
10
  } from '@utils/node-graphs/utils/utils';
11
11
  import { findMatchingNodes, getItemsFromCollectionByIdAndSemverOrLatest } from '@utils/collections/util';
12
- import { MarkerType } from 'reactflow';
12
+ import { MarkerType } from '@xyflow/react';
13
13
  import type { CollectionMessageTypes } from '@types';
14
14
 
15
15
  type DagreGraph = any;
@@ -1,5 +1,5 @@
1
1
  import { getCollection, type CollectionEntry } from 'astro:content';
2
- import { MarkerType, Position, type Edge, type Node } from 'reactflow';
2
+ import { MarkerType, Position, type Edge, type Node } from '@xyflow/react';
3
3
  import dagre from 'dagre';
4
4
  import { getItemsFromCollectionByIdAndSemverOrLatest } from '@utils/collections/util';
5
5
  import type { CollectionMessageTypes, CollectionTypes } from '@types';
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.16.1",
9
+ "version": "2.16.3",
10
10
  "publishConfig": {
11
11
  "access": "public"
12
12
  },
@@ -54,6 +54,7 @@
54
54
  "@stoplight/mosaic": "^1.53.2",
55
55
  "@tailwindcss/typography": "^0.5.13",
56
56
  "@tanstack/react-table": "^8.17.3",
57
+ "@xyflow/react": "^12.3.6",
57
58
  "astro": "^4.16.5",
58
59
  "astro-expressive-code": "^0.36.1",
59
60
  "astro-pagefind": "^1.6.0",
@@ -76,7 +77,6 @@
76
77
  "rapidoc": "^9.3.4",
77
78
  "react": "^18.3.1",
78
79
  "react-dom": "^18.3.1",
79
- "reactflow": "^11.11.4",
80
80
  "rehype-slug": "^6.0.0",
81
81
  "remark-gfm": "^3.0.1",
82
82
  "rimraf": "^5.0.7",