@eventcatalog/core 2.24.2 → 2.25.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 (36) 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/catalog-to-astro-content-directory.cjs +0 -1
  6. package/dist/catalog-to-astro-content-directory.js +1 -1
  7. package/dist/{chunk-VOOF34RB.js → chunk-7674GE3M.js} +1 -1
  8. package/dist/{chunk-AMO6QDAS.js → chunk-H6PSWK2Z.js} +1 -1
  9. package/dist/{chunk-Q77NQ43U.js → chunk-JENKAK6L.js} +1 -1
  10. package/dist/{chunk-CXKIF3EI.js → chunk-VCR3LHZR.js} +0 -1
  11. package/dist/constants.cjs +1 -1
  12. package/dist/constants.js +1 -1
  13. package/dist/eventcatalog.cjs +1 -2
  14. package/dist/eventcatalog.config.d.cts +1 -0
  15. package/dist/eventcatalog.config.d.ts +1 -0
  16. package/dist/eventcatalog.js +4 -4
  17. package/eventcatalog/src/components/MDX/NodeGraph/NodeGraph.tsx +3 -2
  18. package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Channel.tsx +82 -54
  19. package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Command.tsx +44 -41
  20. package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Event.tsx +43 -41
  21. package/eventcatalog/src/components/MDX/NodeGraph/Nodes/MessageContextMenu.tsx +54 -0
  22. package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Query.tsx +45 -43
  23. package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Service.tsx +112 -42
  24. package/eventcatalog/src/components/SideNav/TreeView/getTreeView.ts +1 -1
  25. package/eventcatalog/src/enterprise/ai-assistant/components/ChatSidebar.tsx +1 -9
  26. package/eventcatalog/src/enterprise/ai-assistant/components/ChatWindow.tsx +240 -118
  27. package/eventcatalog/src/enterprise/ai-assistant/components/hooks/ChatProvider.tsx +13 -13
  28. package/eventcatalog/src/enterprise/ai-assistant/components/workers/document-importer.ts +4 -2
  29. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/spec/index.astro +0 -1
  30. package/eventcatalog/src/pages/docs/_default-docs.mdx +24 -0
  31. package/eventcatalog/src/pages/docs/index.astro +13 -18
  32. package/package.json +3 -2
  33. package/default-files-for-collections/pages.md +0 -7
  34. package/eventcatalog/src/components/DocsNavigation.astro +0 -145
  35. package/eventcatalog/src/layouts/CustomDocsPageLayout.astro +0 -131
  36. package/eventcatalog/src/layouts/PlainPage.astro +0 -29
@@ -1,7 +1,7 @@
1
1
  import { MagnifyingGlassIcon } from '@heroicons/react/16/solid';
2
2
  import type { CollectionEntry } from 'astro:content';
3
3
  import { Handle } from '@xyflow/react';
4
-
4
+ import MessageContextMenu from './MessageContextMenu';
5
5
  interface Data {
6
6
  title: string;
7
7
  label: string;
@@ -22,53 +22,55 @@ export default function QueryNode({ data, sourcePosition, targetPosition }: any)
22
22
 
23
23
  const { name, version, summary, owners = [], producers = [], consumers = [] } = message.data;
24
24
 
25
- const renderTarget = true; //showTarget || (targetPosition && producers.length > 0);
26
- const renderSource = true; // showSource || (sourcePosition && consumers.length > 0);
25
+ const renderTarget = true;
26
+ const renderSource = true;
27
27
 
28
28
  return (
29
- <div className={classNames('w-full rounded-md border flex justify-start bg-white text-black border-green-400')}>
30
- <div
31
- className={classNames(
32
- 'bg-gradient-to-b from-green-500 to-green-700 relative flex items-center w-5 justify-center rounded-l-sm text-green-100-500',
33
- `border-r-[1px] border-green-500`
34
- )}
35
- >
36
- <MagnifyingGlassIcon className="w-4 h-4 opacity-90 text-white absolute top-1 " />
37
- {mode === 'full' && (
38
- <span className="rotate -rotate-90 w-1/2 text-center absolute bottom-1 text-[9px] text-white font-bold uppercase tracking-[3px] ">
39
- Query
40
- </span>
41
- )}
42
- </div>
43
- <div className="p-1 min-w-60 max-w-[min-content]">
44
- {renderTarget && <Handle type="target" position={targetPosition} />}
45
- {renderSource && <Handle type="source" position={sourcePosition} />}
46
- <div className={classNames(mode === 'full' ? `border-b border-gray-200` : '')}>
47
- <span className="text-xs font-bold block pb-0.5">{name}</span>
48
- <div className="flex justify-between">
49
- <span className="text-[10px] font-light block pt-0.5 pb-0.5 ">v{version}</span>
50
- {mode === 'simple' && <span className="text-[10px] text-gray-500 font-light block pt-0.5 pb-0.5 ">Query</span>}
51
- </div>
29
+ <MessageContextMenu message={message} messageType="queries">
30
+ <div className={classNames('w-full rounded-md border flex justify-start bg-white text-black border-green-400')}>
31
+ <div
32
+ className={classNames(
33
+ 'bg-gradient-to-b from-green-500 to-green-700 relative flex items-center w-5 justify-center rounded-l-sm text-green-100-500',
34
+ `border-r-[1px] border-green-500`
35
+ )}
36
+ >
37
+ <MagnifyingGlassIcon className="w-4 h-4 opacity-90 text-white absolute top-1 " />
38
+ {mode === 'full' && (
39
+ <span className="rotate -rotate-90 w-1/2 text-center absolute bottom-1 text-[9px] text-white font-bold uppercase tracking-[3px] ">
40
+ Query
41
+ </span>
42
+ )}
52
43
  </div>
53
- {mode === 'full' && (
54
- <div className="divide-y divide-gray-200 ">
55
- <div className="leading-3 py-1">
56
- <span className="text-[8px] font-light">{summary}</span>
57
- </div>
58
- <div className="grid grid-cols-2 gap-x-4 py-1">
59
- <span className="text-xs" style={{ fontSize: '0.2em' }}>
60
- Producers: {producers.length}
61
- </span>
62
- <span className="text-xs" style={{ fontSize: '0.2em' }}>
63
- Consumers: {consumers.length}
64
- </span>
65
- <span className="text-xs" style={{ fontSize: '0.2em' }}>
66
- Owners: {owners.length}
67
- </span>
44
+ <div className="p-1 min-w-60 max-w-[min-content]">
45
+ {renderTarget && <Handle type="target" position={targetPosition} />}
46
+ {renderSource && <Handle type="source" position={sourcePosition} />}
47
+ <div className={classNames(mode === 'full' ? `border-b border-gray-200` : '')}>
48
+ <span className="text-xs font-bold block pb-0.5">{name}</span>
49
+ <div className="flex justify-between">
50
+ <span className="text-[10px] font-light block pt-0.5 pb-0.5 ">v{version}</span>
51
+ {mode === 'simple' && <span className="text-[10px] text-gray-500 font-light block pt-0.5 pb-0.5 ">Query</span>}
68
52
  </div>
69
53
  </div>
70
- )}
54
+ {mode === 'full' && (
55
+ <div className="divide-y divide-gray-200 ">
56
+ <div className="leading-3 py-1">
57
+ <span className="text-[8px] font-light">{summary}</span>
58
+ </div>
59
+ <div className="grid grid-cols-2 gap-x-4 py-1">
60
+ <span className="text-xs" style={{ fontSize: '0.2em' }}>
61
+ Producers: {producers.length}
62
+ </span>
63
+ <span className="text-xs" style={{ fontSize: '0.2em' }}>
64
+ Consumers: {consumers.length}
65
+ </span>
66
+ <span className="text-xs" style={{ fontSize: '0.2em' }}>
67
+ Owners: {owners.length}
68
+ </span>
69
+ </div>
70
+ </div>
71
+ )}
72
+ </div>
71
73
  </div>
72
- </div>
74
+ </MessageContextMenu>
73
75
  );
74
76
  }
@@ -1,6 +1,8 @@
1
1
  import { ServerIcon } from '@heroicons/react/16/solid';
2
2
  import type { CollectionEntry } from 'astro:content';
3
3
  import { Handle } from '@xyflow/react';
4
+ import * as ContextMenu from '@radix-ui/react-context-menu';
5
+ import { buildUrl } from '@utils/url-builder';
4
6
 
5
7
  interface Data {
6
8
  label: string;
@@ -19,53 +21,121 @@ function classNames(...classes: any) {
19
21
  export default function ServiceNode({ data, sourcePosition, targetPosition }: any) {
20
22
  const { label, bgColor = 'bg-blue-500', mode, service } = data as Data;
21
23
 
22
- const { version, owners = [], sends = [], receives = [], name } = service.data;
24
+ const { id, version, owners = [], sends = [], receives = [], name, specifications, repository } = service.data;
25
+ const asyncApiPath = specifications?.asyncapiPath;
26
+ const openApiPath = specifications?.openapiPath;
27
+ const repositoryUrl = repository?.url;
23
28
 
24
29
  return (
25
- <div className={classNames('w-full rounded-md border flex justify-start bg-white text-black border-pink-500')}>
26
- <div
27
- className={classNames(
28
- 'bg-gradient-to-b from-pink-500 to-pink-700 relative flex items-center w-5 justify-center rounded-l-sm text-red-100-500',
29
- `border-r-[1px] border-pink-500`
30
- )}
31
- >
32
- <ServerIcon className="w-4 h-4 opacity-90 text-white absolute top-1 " />
33
- {mode === 'full' && (
34
- <span className="rotate -rotate-90 w-1/2 text-center absolute bottom-1 text-[9px] text-white font-bold uppercase tracking-[3px] ">
35
- Service
36
- </span>
37
- )}
38
- </div>
39
- <div className="p-1 min-w-60 max-w-[min-content]">
40
- {targetPosition && <Handle type="target" position={targetPosition} />}
41
- {sourcePosition && <Handle type="source" position={sourcePosition} />}
42
- <div className={classNames(mode === 'full' ? `border-b border-gray-200` : '')}>
43
- <span className="text-xs font-bold block pt-0.5 pb-0.5">{name}</span>
44
- <div className="flex justify-between">
45
- <span className="text-[10px] font-light block pt-0.5 pb-0.5 ">v{version}</span>
46
- {mode === 'simple' && <span className="text-[10px] text-gray-500 font-light block pt-0.5 pb-0.5 ">Service</span>}
30
+ <ContextMenu.Root>
31
+ <ContextMenu.Trigger>
32
+ <div className={classNames('w-full rounded-md border flex justify-start bg-white text-black border-pink-500')}>
33
+ <div
34
+ className={classNames(
35
+ 'bg-gradient-to-b from-pink-500 to-pink-700 relative flex items-center w-5 justify-center rounded-l-sm text-red-100-500',
36
+ `border-r-[1px] border-pink-500`
37
+ )}
38
+ >
39
+ <ServerIcon className="w-4 h-4 opacity-90 text-white absolute top-1 " />
40
+ {mode === 'full' && (
41
+ <span className="rotate -rotate-90 w-1/2 text-center absolute bottom-1 text-[9px] text-white font-bold uppercase tracking-[3px] ">
42
+ Service
43
+ </span>
44
+ )}
47
45
  </div>
48
- </div>
49
- {mode === 'full' && (
50
- <div className="divide-y divide-gray-200 ">
51
- <div className="leading-3 py-1">
52
- <span className="text-[8px] font-light">{service.data.summary}</span>
46
+ <div className="p-1 min-w-60 max-w-[min-content]">
47
+ {targetPosition && <Handle type="target" position={targetPosition} />}
48
+ {sourcePosition && <Handle type="source" position={sourcePosition} />}
49
+ <div className={classNames(mode === 'full' ? `border-b border-gray-200` : '')}>
50
+ <span className="text-xs font-bold block pt-0.5 pb-0.5">{name}</span>
51
+ <div className="flex justify-between">
52
+ <span className="text-[10px] font-light block pt-0.5 pb-0.5 ">v{version}</span>
53
+ {mode === 'simple' && <span className="text-[10px] text-gray-500 font-light block pt-0.5 pb-0.5 ">Service</span>}
54
+ </div>
53
55
  </div>
56
+ {mode === 'full' && (
57
+ <div className="divide-y divide-gray-200 ">
58
+ <div className="leading-3 py-1">
59
+ <span className="text-[8px] font-light">{service.data.summary}</span>
60
+ </div>
54
61
 
55
- <div className="grid grid-cols-2 gap-x-4 py-1">
56
- <span className="text-xs" style={{ fontSize: '0.2em' }}>
57
- Receives messages: {receives.length}
58
- </span>
59
- <span className="text-xs" style={{ fontSize: '0.2em' }}>
60
- Publishes messages: {sends.length}
61
- </span>
62
- <span className="text-xs" style={{ fontSize: '0.2em' }}>
63
- Owners: {owners.length}
64
- </span>
65
- </div>
62
+ <div className="grid grid-cols-2 gap-x-4 py-1">
63
+ <span className="text-xs" style={{ fontSize: '0.2em' }}>
64
+ Receives messages: {receives.length}
65
+ </span>
66
+ <span className="text-xs" style={{ fontSize: '0.2em' }}>
67
+ Publishes messages: {sends.length}
68
+ </span>
69
+ <span className="text-xs" style={{ fontSize: '0.2em' }}>
70
+ Owners: {owners.length}
71
+ </span>
72
+ </div>
73
+ </div>
74
+ )}
66
75
  </div>
67
- )}
68
- </div>
69
- </div>
76
+ </div>
77
+ </ContextMenu.Trigger>
78
+ <ContextMenu.Portal>
79
+ <ContextMenu.Content className="min-w-[220px] bg-white rounded-md p-1 shadow-md border border-gray-200">
80
+ <ContextMenu.Item
81
+ asChild
82
+ className="text-sm px-2 py-1.5 outline-none cursor-pointer hover:bg-orange-100 rounded-sm flex items-center"
83
+ >
84
+ <a href={buildUrl(`/docs/services/${id}/${version}`)}>Read documentation</a>
85
+ </ContextMenu.Item>
86
+ <ContextMenu.Separator className="h-[1px] bg-gray-200 m-1" />
87
+ {asyncApiPath && (
88
+ <ContextMenu.Item asChild>
89
+ <a
90
+ href={buildUrl(`/docs/services/${id}/${version}/asyncapi`)}
91
+ className="text-sm px-2 py-1.5 outline-none cursor-pointer hover:bg-orange-100 rounded-sm flex items-center"
92
+ target="_blank"
93
+ rel="noopener noreferrer"
94
+ >
95
+ View AsyncAPI specification
96
+ </a>
97
+ </ContextMenu.Item>
98
+ )}
99
+ {openApiPath && (
100
+ <ContextMenu.Item asChild>
101
+ <a
102
+ href={buildUrl(`/docs/services/${id}/${version}/spec`)}
103
+ className="text-sm px-2 py-1.5 outline-none cursor-pointer hover:bg-orange-100 rounded-sm flex items-center"
104
+ target="_blank"
105
+ rel="noopener noreferrer"
106
+ >
107
+ View OpenAPI specification
108
+ </a>
109
+ </ContextMenu.Item>
110
+ )}
111
+ {asyncApiPath && openApiPath && <ContextMenu.Separator className="h-[1px] bg-gray-200 m-1" />}
112
+ {repositoryUrl && (
113
+ <>
114
+ <ContextMenu.Item asChild>
115
+ <a
116
+ href={repositoryUrl}
117
+ className="text-sm px-2 py-1.5 outline-none cursor-pointer hover:bg-orange-100 rounded-sm flex items-center"
118
+ target="_blank"
119
+ rel="noopener noreferrer"
120
+ >
121
+ View code repository
122
+ </a>
123
+ </ContextMenu.Item>
124
+ <ContextMenu.Separator className="h-[1px] bg-gray-200 m-1" />
125
+ </>
126
+ )}
127
+ <ContextMenu.Item asChild>
128
+ <a
129
+ href={buildUrl(`/docs/services/${id}/${version}/changelog`)}
130
+ className="text-sm px-2 py-1.5 outline-none cursor-pointer hover:bg-orange-100 rounded-sm flex items-center"
131
+ target="_blank"
132
+ rel="noopener noreferrer"
133
+ >
134
+ Read changelog
135
+ </a>
136
+ </ContextMenu.Item>
137
+ </ContextMenu.Content>
138
+ </ContextMenu.Portal>
139
+ </ContextMenu.Root>
70
140
  );
71
141
  }
@@ -138,7 +138,7 @@ function groupChildrenByType(parentNode: TreeNode) {
138
138
  const treeViewCache = new Map<string, TreeNode>();
139
139
 
140
140
  export function getTreeView({ projectDir, currentPath }: { projectDir: string; currentPath: string }): TreeNode {
141
- const basePathname = currentPath.split('/')[1] as 'docs' | 'visualiser';
141
+ const basePathname = currentPath.split('/').find((p) => p === 'docs' || p === 'visualiser') || 'docs';
142
142
 
143
143
  const cacheKey = `${projectDir}:${basePathname}`;
144
144
  if (treeViewCache.has(cacheKey)) return treeViewCache.get(cacheKey)!;
@@ -4,15 +4,7 @@ import { useChat } from './hooks/ChatProvider';
4
4
  import * as Dialog from '@radix-ui/react-dialog';
5
5
 
6
6
  const Sidebar: React.FC<{}> = () => {
7
- const {
8
- sessions = [],
9
- currentSession,
10
- createSession,
11
- deleteSession,
12
- addMessageToSession,
13
- setCurrentSession,
14
- isStreaming,
15
- } = useChat();
7
+ const { sessions = [], currentSession, createSession, deleteSession, setCurrentSession, isStreaming } = useChat();
16
8
  const [showHelp, setShowHelp] = React.useState(false);
17
9
 
18
10
  useEffect(() => {