@eventcatalog/core 3.2.1 → 3.3.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 (49) 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-VBEYXPR5.js → chunk-I4CMEOEN.js} +1 -1
  6. package/dist/{chunk-SYOF3QEG.js → chunk-NGKYYZZP.js} +1 -1
  7. package/dist/{chunk-SFQ3BU4M.js → chunk-OAUYXPXT.js} +1 -1
  8. package/dist/{chunk-7PHTRC72.js → chunk-QZF5ZYJB.js} +1 -1
  9. package/dist/{chunk-LWUJQOCC.js → chunk-UPSN5H7S.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/ChatPanel/ChatPanel.tsx +9 -0
  19. package/eventcatalog/src/components/ChatPanel/ChatPanelButton.tsx +11 -1
  20. package/eventcatalog/src/components/CopyAsMarkdown.tsx +47 -28
  21. package/eventcatalog/src/content.config.ts +18 -0
  22. package/eventcatalog/src/enterprise/ai/chat-api.ts +24 -2
  23. package/eventcatalog/src/pages/diagrams/[id]/[version]/_index.data.ts +57 -0
  24. package/eventcatalog/src/pages/diagrams/[id]/[version]/embed.astro +267 -0
  25. package/eventcatalog/src/pages/diagrams/[id]/[version]/index.astro +411 -0
  26. package/eventcatalog/src/pages/diagrams/[id]/[version].mdx.ts +47 -0
  27. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/changelog/index.astro +28 -33
  28. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/index.astro +1 -0
  29. package/eventcatalog/src/pages/docs/[type]/[id]/[version].md.ts +3 -2
  30. package/eventcatalog/src/pages/docs/[type]/[id]/[version].mdx.ts +5 -1
  31. package/eventcatalog/src/pages/docs/[type]/[id]/language.mdx.ts +2 -1
  32. package/eventcatalog/src/pages/docs/custom/[...path].mdx.ts +2 -2
  33. package/eventcatalog/src/pages/docs/teams/[id].md.ts +3 -2
  34. package/eventcatalog/src/pages/docs/teams/[id].mdx.ts +3 -3
  35. package/eventcatalog/src/pages/docs/users/[id].md.ts +3 -2
  36. package/eventcatalog/src/pages/docs/users/[id].mdx.ts +3 -3
  37. package/eventcatalog/src/stores/sidebar-store/builders/container.ts +20 -4
  38. package/eventcatalog/src/stores/sidebar-store/builders/domain.ts +20 -12
  39. package/eventcatalog/src/stores/sidebar-store/builders/flow.ts +1 -1
  40. package/eventcatalog/src/stores/sidebar-store/builders/message.ts +20 -4
  41. package/eventcatalog/src/stores/sidebar-store/builders/service.ts +18 -6
  42. package/eventcatalog/src/stores/sidebar-store/builders/shared.ts +20 -0
  43. package/eventcatalog/src/stores/sidebar-store/state.ts +34 -6
  44. package/eventcatalog/src/types/index.ts +4 -2
  45. package/eventcatalog/src/utils/collections/diagrams.ts +64 -0
  46. package/eventcatalog/src/utils/collections/util.ts +2 -0
  47. package/eventcatalog/src/utils/feature.ts +4 -2
  48. package/eventcatalog/src/utils/page-loaders/page-data-loader.ts +2 -0
  49. 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 = "3.2.1";
40
+ var version = "3.3.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-SFQ3BU4M.js";
4
- import "../chunk-SYOF3QEG.js";
3
+ } from "../chunk-OAUYXPXT.js";
4
+ import "../chunk-NGKYYZZP.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.2.1";
109
+ var version = "3.3.0";
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-LWUJQOCC.js";
4
- import "../chunk-SFQ3BU4M.js";
5
- import "../chunk-SYOF3QEG.js";
3
+ } from "../chunk-UPSN5H7S.js";
4
+ import "../chunk-OAUYXPXT.js";
5
+ import "../chunk-NGKYYZZP.js";
6
6
  import "../chunk-UPONRQSN.js";
7
7
  export {
8
8
  log_build_default as default
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VERSION
3
- } from "./chunk-SYOF3QEG.js";
3
+ } from "./chunk-NGKYYZZP.js";
4
4
 
5
5
  // src/utils/cli-logger.ts
6
6
  import pc from "picocolors";
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "3.2.1";
2
+ var version = "3.3.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-SYOF3QEG.js";
3
+ } from "./chunk-NGKYYZZP.js";
4
4
 
5
5
  // src/analytics/analytics.js
6
6
  import axios from "axios";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  logger
3
- } from "./chunk-VBEYXPR5.js";
3
+ } from "./chunk-I4CMEOEN.js";
4
4
  import {
5
5
  cleanup,
6
6
  getEventCatalogConfigFile
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  raiseEvent
3
- } from "./chunk-SFQ3BU4M.js";
3
+ } from "./chunk-OAUYXPXT.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 = "3.2.1";
28
+ var version = "3.3.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-SYOF3QEG.js";
3
+ } from "./chunk-NGKYYZZP.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.2.1";
112
+ var version = "3.3.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-LWUJQOCC.js";
10
- import "./chunk-SFQ3BU4M.js";
9
+ } from "./chunk-UPSN5H7S.js";
10
+ import "./chunk-OAUYXPXT.js";
11
11
  import {
12
12
  runMigrations
13
13
  } from "./chunk-BH3JMNAV.js";
@@ -21,13 +21,13 @@ import {
21
21
  } from "./chunk-5VBIXL6C.js";
22
22
  import {
23
23
  generate
24
- } from "./chunk-7PHTRC72.js";
24
+ } from "./chunk-QZF5ZYJB.js";
25
25
  import {
26
26
  logger
27
- } from "./chunk-VBEYXPR5.js";
27
+ } from "./chunk-I4CMEOEN.js";
28
28
  import {
29
29
  VERSION
30
- } from "./chunk-SYOF3QEG.js";
30
+ } from "./chunk-NGKYYZZP.js";
31
31
  import "./chunk-UPONRQSN.js";
32
32
 
33
33
  // src/eventcatalog.ts
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.2.1";
76
+ var version = "3.3.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-7PHTRC72.js";
4
- import "./chunk-VBEYXPR5.js";
5
- import "./chunk-SYOF3QEG.js";
3
+ } from "./chunk-QZF5ZYJB.js";
4
+ import "./chunk-I4CMEOEN.js";
5
+ import "./chunk-NGKYYZZP.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.2.1";
39
+ var version = "3.3.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-VBEYXPR5.js";
4
- import "../chunk-SYOF3QEG.js";
3
+ } from "../chunk-I4CMEOEN.js";
4
+ import "../chunk-NGKYYZZP.js";
5
5
  export {
6
6
  logger
7
7
  };
@@ -171,6 +171,15 @@ const suggestedQuestionsConfig: QuestionConfig[] = [
171
171
  { label: 'Who owns this domain?', prompt: 'Who owns this domain and how do I contact them?' },
172
172
  ],
173
173
  },
174
+ // Designs page
175
+ {
176
+ pattern: /^\/diagrams\/.+/,
177
+ questions: [
178
+ { label: 'Tell me more about this diagram?', prompt: 'Tell me more about this diagram?' },
179
+ { label: 'Help me understand this diagram', prompt: 'Help me understand this diagram' },
180
+ { label: 'What is the context of this diagram?', prompt: 'What is the context of this diagram, what is it related to?' },
181
+ ],
182
+ },
174
183
  // Match /schemas with specType=graphql as query parameter
175
184
  {
176
185
  pattern: /^\/schemas.*[?&]specType=graphql/,
@@ -1,10 +1,20 @@
1
- import { useState } from 'react';
1
+ import { useState, useEffect } from 'react';
2
2
  import { BookOpen } from 'lucide-react';
3
3
  import ChatPanel from './ChatPanel';
4
4
 
5
5
  const ChatPanelButton = () => {
6
6
  const [isOpen, setIsOpen] = useState(false);
7
7
 
8
+ // Listen for custom event to open chat panel from other components
9
+ useEffect(() => {
10
+ const handleOpenChat = () => {
11
+ setIsOpen(true);
12
+ };
13
+
14
+ window.addEventListener('eventcatalog:open-chat', handleOpenChat);
15
+ return () => window.removeEventListener('eventcatalog:open-chat', handleOpenChat);
16
+ }, []);
17
+
8
18
  return (
9
19
  <>
10
20
  <button
@@ -49,6 +49,8 @@ export function CopyPageMenu({
49
49
  editUrl,
50
50
  markdownDownloadEnabled = false,
51
51
  rssFeedEnabled = false,
52
+ preferChatAsDefault = false,
53
+ chatButtonText = 'Ask',
52
54
  }: {
53
55
  schemas: Schema[];
54
56
  chatQuery?: string;
@@ -56,6 +58,8 @@ export function CopyPageMenu({
56
58
  editUrl: string;
57
59
  markdownDownloadEnabled: boolean;
58
60
  rssFeedEnabled: boolean;
61
+ preferChatAsDefault?: boolean;
62
+ chatButtonText?: string;
59
63
  }) {
60
64
  // Define available actions
61
65
  const availableActions = {
@@ -81,6 +85,14 @@ export function CopyPageMenu({
81
85
 
82
86
  // Determine the default action based on what's available
83
87
  const getDefaultAction = () => {
88
+ // If chat is preferred and available, make it the default
89
+ if (preferChatAsDefault && availableActions.chat) {
90
+ return {
91
+ type: 'chat',
92
+ text: chatButtonText,
93
+ icon: MessageCircleQuestion,
94
+ };
95
+ }
84
96
  if (availableActions.copyMarkdown) {
85
97
  return {
86
98
  type: 'copyMarkdown',
@@ -112,7 +124,7 @@ export function CopyPageMenu({
112
124
  if (availableActions.chat) {
113
125
  return {
114
126
  type: 'chat',
115
- text: 'Open Chat',
127
+ text: chatButtonText,
116
128
  icon: MessageCircleQuestion,
117
129
  };
118
130
  }
@@ -187,7 +199,8 @@ export function CopyPageMenu({
187
199
  window.open(markdownUrl, '_blank');
188
200
  break;
189
201
  case 'chat':
190
- window.open(buildUrl(`/chat?query=${chatQuery}`));
202
+ // Dispatch custom event to open chat panel instead of navigating
203
+ window.dispatchEvent(new CustomEvent('eventcatalog:open-chat'));
191
204
  break;
192
205
  }
193
206
  };
@@ -227,6 +240,22 @@ export function CopyPageMenu({
227
240
  sideOffset={5}
228
241
  align="end"
229
242
  >
243
+ {availableActions.chat && (
244
+ <>
245
+ <DropdownMenu.Item
246
+ className="cursor-pointer hover:bg-[rgb(var(--ec-dropdown-hover))] focus:outline-none focus:bg-[rgb(var(--ec-dropdown-hover))]"
247
+ onSelect={() => window.dispatchEvent(new CustomEvent('eventcatalog:open-chat'))}
248
+ >
249
+ <MenuItemContent
250
+ icon={MessageCircleQuestion}
251
+ title="EventCatalog Assistant"
252
+ description="Ask questions about this page"
253
+ />
254
+ </DropdownMenu.Item>
255
+ <DropdownMenu.Separator className="h-px my-1 bg-[rgb(var(--ec-dropdown-border))]" />
256
+ </>
257
+ )}
258
+
230
259
  {availableActions.copyMarkdown && (
231
260
  <DropdownMenu.Item
232
261
  className="cursor-pointer hover:bg-[rgb(var(--ec-dropdown-hover))] focus:outline-none focus:bg-[rgb(var(--ec-dropdown-hover))]"
@@ -236,20 +265,6 @@ export function CopyPageMenu({
236
265
  </DropdownMenu.Item>
237
266
  )}
238
267
 
239
- {availableActions.editPage && (
240
- <DropdownMenu.Item
241
- className="cursor-pointer hover:bg-[rgb(var(--ec-dropdown-hover))] focus:outline-none focus:bg-[rgb(var(--ec-dropdown-hover))]"
242
- onSelect={() => window.open(editUrl, '_blank')}
243
- >
244
- <MenuItemContent
245
- icon={PenSquareIcon}
246
- title="Edit page"
247
- description="Edit the contents of this page"
248
- external={true}
249
- />
250
- </DropdownMenu.Item>
251
- )}
252
-
253
268
  {availableActions.copySchemas &&
254
269
  schemas.map((schema) => {
255
270
  const title =
@@ -305,18 +320,22 @@ export function CopyPageMenu({
305
320
  <MenuItemContent icon={RssIcon} title="RSS Feed" description="View this page as RSS feed" external={true} />
306
321
  </DropdownMenu.Item>
307
322
  )}
308
- {availableActions.chat && (
309
- <DropdownMenu.Item
310
- className="cursor-pointer hover:bg-[rgb(var(--ec-dropdown-hover))] focus:outline-none focus:bg-[rgb(var(--ec-dropdown-hover))]"
311
- onSelect={() => window.open(buildUrl(`/chat`) + `?query=${chatQuery}`)}
312
- >
313
- <MenuItemContent
314
- icon={MessageCircleQuestion}
315
- title="Open in EventCatalog Chat"
316
- description="Ask questions about this page"
317
- external={true}
318
- />
319
- </DropdownMenu.Item>
323
+
324
+ {availableActions.editPage && (
325
+ <>
326
+ <DropdownMenu.Separator className="h-px my-1 bg-[rgb(var(--ec-dropdown-border))]" />
327
+ <DropdownMenu.Item
328
+ className="cursor-pointer hover:bg-[rgb(var(--ec-dropdown-hover))] focus:outline-none focus:bg-[rgb(var(--ec-dropdown-hover))]"
329
+ onSelect={() => window.open(editUrl, '_blank')}
330
+ >
331
+ <MenuItemContent
332
+ icon={PenSquareIcon}
333
+ title="Edit page"
334
+ description="Edit the contents of this page"
335
+ external={true}
336
+ />
337
+ </DropdownMenu.Item>
338
+ </>
320
339
  )}
321
340
  </DropdownMenu.Content>
322
341
  </DropdownMenu.Root>
@@ -187,6 +187,7 @@ const baseSchema = z.object({
187
187
  ])
188
188
  )
189
189
  .optional(),
190
+ diagrams: z.array(pointer).optional(),
190
191
  // Used by eventcatalog
191
192
  versions: z.array(z.string()).optional(),
192
193
  latestVersion: z.string().optional(),
@@ -691,6 +692,20 @@ const designs = defineCollection({
691
692
  }),
692
693
  });
693
694
 
695
+ const diagrams = defineCollection({
696
+ loader: glob({
697
+ pattern: ['**/diagrams/**/index.(md|mdx)', '**/diagrams/**/versioned/*/index.(md|mdx)'],
698
+ base: projectDirBase,
699
+ generateId: ({ data }) => `${data.id}-${data.version}`,
700
+ }),
701
+ schema: z.object({
702
+ id: z.string(),
703
+ name: z.string(),
704
+ version: z.string(),
705
+ summary: z.string().optional(),
706
+ }),
707
+ });
708
+
694
709
  export const collections = {
695
710
  events,
696
711
  commands,
@@ -714,4 +729,7 @@ export const collections = {
714
729
 
715
730
  // EventCatalog Studio Collections
716
731
  designs,
732
+
733
+ // Diagrams Collection
734
+ diagrams,
717
735
  };
@@ -191,7 +191,18 @@ export const POST = async ({ request }: APIContext<{ question: string; messages:
191
191
  'Use this tool to get events, services, commands, queries, flows, domains, channels, entities from EventCatalog',
192
192
  inputSchema: z.object({
193
193
  collection: z
194
- .enum(['events', 'services', 'commands', 'queries', 'flows', 'domains', 'channels', 'entities', 'containers'])
194
+ .enum([
195
+ 'events',
196
+ 'services',
197
+ 'commands',
198
+ 'queries',
199
+ 'flows',
200
+ 'domains',
201
+ 'channels',
202
+ 'entities',
203
+ 'containers',
204
+ 'diagrams',
205
+ ])
195
206
  .describe('The collection to get the events from'),
196
207
  }),
197
208
  execute: async ({ collection }) => {
@@ -207,7 +218,18 @@ export const POST = async ({ request }: APIContext<{ question: string; messages:
207
218
  description: 'Use this tool to get a specific resource from EventCatalog by its id and version',
208
219
  inputSchema: z.object({
209
220
  collection: z
210
- .enum(['events', 'services', 'commands', 'queries', 'flows', 'domains', 'channels', 'entities', 'containers'])
221
+ .enum([
222
+ 'events',
223
+ 'services',
224
+ 'commands',
225
+ 'queries',
226
+ 'flows',
227
+ 'domains',
228
+ 'channels',
229
+ 'entities',
230
+ 'containers',
231
+ 'diagrams',
232
+ ])
211
233
  .describe('The collection to get the events from'),
212
234
  id: z.string().describe('The id of the resource to get'),
213
235
  version: z.string().describe('The version of the resource to get'),
@@ -0,0 +1,57 @@
1
+ import { isSSR } from '@utils/feature';
2
+ import { HybridPage } from '@utils/page-loaders/hybrid-page';
3
+ import { getDiagrams } from '@utils/collections/diagrams';
4
+
5
+ /**
6
+ * Diagrams page class for full-screen diagram viewing
7
+ */
8
+ export class Page extends HybridPage {
9
+ static async getStaticPaths() {
10
+ if (isSSR()) {
11
+ return [];
12
+ }
13
+
14
+ const diagrams = await getDiagrams();
15
+
16
+ return diagrams.map((diagram) => ({
17
+ params: {
18
+ id: diagram.data.id,
19
+ version: diagram.data.version,
20
+ },
21
+ props: {},
22
+ }));
23
+ }
24
+
25
+ protected static async fetchData(params: any) {
26
+ const { id, version } = params;
27
+
28
+ if (!id || !version) {
29
+ return null;
30
+ }
31
+
32
+ const diagrams = await getDiagrams();
33
+ const diagram = diagrams.find((d) => d.data.id === id && d.data.version === version);
34
+
35
+ if (!diagram) {
36
+ return null;
37
+ }
38
+
39
+ // Get all versions of this diagram for the version selector
40
+ const allVersions = diagrams
41
+ .filter((d) => d.data.id === id)
42
+ .map((d) => d.data.version)
43
+ .sort((a, b) => b.localeCompare(a, undefined, { numeric: true }));
44
+
45
+ return {
46
+ ...diagram,
47
+ allVersions,
48
+ };
49
+ }
50
+
51
+ protected static createNotFoundResponse(): Response {
52
+ return new Response(null, {
53
+ status: 404,
54
+ statusText: 'Diagram not found',
55
+ });
56
+ }
57
+ }