@eventcatalog/core 3.0.0-beta.2 → 3.0.0-beta.21

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 (103) hide show
  1. package/README.md +10 -0
  2. package/dist/__mocks__/astro-content.cjs +32 -0
  3. package/dist/__mocks__/astro-content.d.cts +13 -0
  4. package/dist/__mocks__/astro-content.d.ts +13 -0
  5. package/dist/__mocks__/astro-content.js +7 -0
  6. package/dist/analytics/analytics.cjs +1 -1
  7. package/dist/analytics/analytics.js +2 -2
  8. package/dist/analytics/log-build.cjs +1 -1
  9. package/dist/analytics/log-build.js +3 -3
  10. package/dist/{chunk-JSONCD7V.js → chunk-2FUEBPD3.js} +1 -1
  11. package/dist/{chunk-3W6JYTHP.js → chunk-HABY2LVH.js} +6 -2
  12. package/dist/{chunk-H4QHE5YZ.js → chunk-KQAMO3R4.js} +1 -1
  13. package/dist/chunk-Q6KRYWPV.js +44 -0
  14. package/dist/{chunk-PQL6O5YA.js → chunk-RRP2B7BL.js} +1 -1
  15. package/dist/constants.cjs +1 -1
  16. package/dist/constants.js +1 -1
  17. package/dist/eventcatalog.cjs +84 -65
  18. package/dist/eventcatalog.config.d.cts +4 -0
  19. package/dist/eventcatalog.config.d.ts +4 -0
  20. package/dist/eventcatalog.js +45 -57
  21. package/dist/generate.cjs +48 -2
  22. package/dist/generate.js +3 -1
  23. package/dist/utils/cli-logger.cjs +82 -0
  24. package/dist/utils/cli-logger.d.cts +10 -0
  25. package/dist/utils/cli-logger.d.ts +10 -0
  26. package/dist/utils/cli-logger.js +7 -0
  27. package/eventcatalog/astro.config.mjs +4 -1
  28. package/eventcatalog/integrations/ecstudio-watcher.mjs +1 -1
  29. package/eventcatalog/integrations/eventcatalog-features.ts +69 -0
  30. package/eventcatalog/public/icons/asyncapi-black.svg +2 -0
  31. package/eventcatalog/public/icons/graphql-black.svg +1 -0
  32. package/eventcatalog/public/icons/openapi-black.svg +1 -0
  33. package/eventcatalog/src/components/ChatPanel/ChatPanel.tsx +821 -0
  34. package/eventcatalog/src/components/ChatPanel/ChatPanelButton.tsx +24 -0
  35. package/eventcatalog/src/components/Grids/DomainGrid.tsx +1 -3
  36. package/eventcatalog/src/components/Grids/MessageGrid.tsx +8 -8
  37. package/eventcatalog/src/components/Header.astro +25 -5
  38. package/eventcatalog/src/components/MDX/NodeGraph/NodeGraph.tsx +14 -3
  39. package/eventcatalog/src/components/Search/Search.astro +2 -2
  40. package/eventcatalog/src/components/Search/SearchModal.tsx +16 -7
  41. package/eventcatalog/src/components/SideNav/NestedSideBar/SearchBar.tsx +9 -2
  42. package/eventcatalog/src/components/SideNav/NestedSideBar/builders/domain.ts +7 -6
  43. package/eventcatalog/src/components/SideNav/NestedSideBar/builders/service.ts +6 -3
  44. package/eventcatalog/src/components/SideNav/NestedSideBar/builders/shared.ts +1 -0
  45. package/eventcatalog/src/components/SideNav/NestedSideBar/index.tsx +23 -8
  46. package/eventcatalog/src/components/SideNav/NestedSideBar/sidebar-builder.ts +57 -11
  47. package/eventcatalog/src/content.config.ts +1 -10
  48. package/eventcatalog/src/enterprise/ai/chat-api.ts +262 -0
  49. package/eventcatalog/src/enterprise/auth/[...auth].ts +3 -0
  50. package/eventcatalog/src/enterprise/auth/login.astro +420 -0
  51. package/eventcatalog/src/enterprise/collections/index.ts +0 -1
  52. package/eventcatalog/src/layouts/Footer.astro +8 -5
  53. package/eventcatalog/src/layouts/VerticalSideBarLayout.astro +30 -19
  54. package/eventcatalog/src/pages/_index.astro +8 -9
  55. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/asyncapi/[filename].astro +19 -3
  56. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/changelog/index.astro +7 -7
  57. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/graphql/[filename].astro +1 -1
  58. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/index.astro +5 -5
  59. package/eventcatalog/src/pages/docs/teams/[id].mdx.ts +36 -0
  60. package/eventcatalog/src/pages/docs/users/[id].mdx.ts +36 -0
  61. package/eventcatalog/src/pages/schemas/explorer/_index.data.ts +178 -0
  62. package/eventcatalog/src/pages/schemas/explorer/index.astro +5 -155
  63. package/eventcatalog/src/remark-plugins/directives.ts +30 -9
  64. package/eventcatalog/src/utils/collections/schemas.ts +31 -7
  65. package/eventcatalog/src/utils/feature.ts +8 -4
  66. package/eventcatalog/src/utils/resource-files.ts +86 -0
  67. package/package.json +12 -15
  68. package/default-files-for-collections/changelogs.md +0 -5
  69. package/default-files-for-collections/channels.md +0 -8
  70. package/default-files-for-collections/commands.md +0 -8
  71. package/default-files-for-collections/domains.md +0 -8
  72. package/default-files-for-collections/events.md +0 -8
  73. package/default-files-for-collections/flows.md +0 -11
  74. package/default-files-for-collections/queries.md +0 -8
  75. package/default-files-for-collections/services.md +0 -8
  76. package/default-files-for-collections/ubiquitousLanguages.md +0 -7
  77. package/eventcatalog/src/enterprise/collections/chat-prompts.ts +0 -32
  78. package/eventcatalog/src/enterprise/eventcatalog-chat/components/Chat.tsx +0 -60
  79. package/eventcatalog/src/enterprise/eventcatalog-chat/components/ChatMessage.tsx +0 -414
  80. package/eventcatalog/src/enterprise/eventcatalog-chat/components/ChatSidebar.tsx +0 -169
  81. package/eventcatalog/src/enterprise/eventcatalog-chat/components/InputModal.tsx +0 -244
  82. package/eventcatalog/src/enterprise/eventcatalog-chat/components/MentionInput.tsx +0 -211
  83. package/eventcatalog/src/enterprise/eventcatalog-chat/components/WelcomePromptArea.tsx +0 -176
  84. package/eventcatalog/src/enterprise/eventcatalog-chat/components/default-prompts.ts +0 -93
  85. package/eventcatalog/src/enterprise/eventcatalog-chat/components/hooks/ChatProvider.tsx +0 -143
  86. package/eventcatalog/src/enterprise/eventcatalog-chat/components/windows/ChatWindow.server.tsx +0 -387
  87. package/eventcatalog/src/enterprise/eventcatalog-chat/pages/api/chat.ts +0 -59
  88. package/eventcatalog/src/enterprise/eventcatalog-chat/pages/chat/index.astro +0 -104
  89. package/eventcatalog/src/enterprise/eventcatalog-chat/providers/ai-provider.ts +0 -140
  90. package/eventcatalog/src/enterprise/eventcatalog-chat/providers/anthropic.ts +0 -28
  91. package/eventcatalog/src/enterprise/eventcatalog-chat/providers/google.ts +0 -41
  92. package/eventcatalog/src/enterprise/eventcatalog-chat/providers/index.ts +0 -26
  93. package/eventcatalog/src/enterprise/eventcatalog-chat/providers/openai.ts +0 -61
  94. package/eventcatalog/src/enterprise/eventcatalog-chat/utils/chat-prompts.ts +0 -50
  95. package/eventcatalog/src/pages/auth/login.astro +0 -280
  96. package/eventcatalog/src/pages/chat/feature.astro +0 -179
  97. package/eventcatalog/src/pages/chat/index.astro +0 -10
  98. package/eventcatalog/src/pages/nav-index.json.ts +0 -30
  99. /package/eventcatalog/src/{pages → enterprise}/auth/error.astro +0 -0
  100. /package/eventcatalog/src/{middleware-auth.ts → enterprise/auth/middleware/middleware-auth.ts} +0 -0
  101. /package/eventcatalog/src/{middleware.ts → enterprise/auth/middleware/middleware.ts} +0 -0
  102. /package/eventcatalog/src/{pages/unauthorized/index.astro → enterprise/auth/unauthorized.astro} +0 -0
  103. /package/eventcatalog/src/{pages → enterprise}/plans/index.astro +0 -0
@@ -11,9 +11,9 @@
11
11
  * 3. Follow the official activation instructions
12
12
  */
13
13
 
14
- import config from '@config';
15
14
  import fs from 'fs';
16
15
  import { join } from 'path';
16
+ import config from '../../eventcatalog.config.js';
17
17
 
18
18
  // These functions check for valid, legally obtained access to premium features
19
19
  export const isEventCatalogStarterEnabled = () => process.env.EVENTCATALOG_STARTER === 'true';
@@ -39,9 +39,12 @@ export const showCustomBranding = () => {
39
39
  export const isChangelogEnabled = () => config?.changelog?.enabled ?? false;
40
40
 
41
41
  export const isCustomDocsEnabled = () => isEventCatalogStarterEnabled() || isEventCatalogScaleEnabled();
42
+
42
43
  export const isEventCatalogChatEnabled = () => {
43
44
  const isFeatureEnabledFromPlan = isEventCatalogStarterEnabled() || isEventCatalogScaleEnabled();
44
- return isFeatureEnabledFromPlan && config?.chat?.enabled && isSSR();
45
+ const directory = process.env.PROJECT_DIR || process.cwd();
46
+ const hasChatConfigurationFile = fs.existsSync(join(directory, 'eventcatalog.chat.js'));
47
+ return isFeatureEnabledFromPlan && hasChatConfigurationFile && isSSR();
45
48
  };
46
49
 
47
50
  export const isEventCatalogUpgradeEnabled = () => !isEventCatalogStarterEnabled() && !isEventCatalogScaleEnabled();
@@ -51,9 +54,10 @@ export const isMarkdownDownloadEnabled = () => config?.llmsTxt?.enabled ?? false
51
54
  export const isLLMSTxtEnabled = () => (config?.llmsTxt?.enabled || isEventCatalogChatEnabled()) ?? false;
52
55
 
53
56
  export const isAuthEnabled = () => {
57
+ const isAuthEnabledInCatalog = config?.auth?.enabled ?? false;
54
58
  const directory = process.env.PROJECT_DIR || process.cwd();
55
- const hasAuthConfig = fs.existsSync(join(directory, 'eventcatalog.auth.js'));
56
- return (hasAuthConfig && isSSR() && isEventCatalogScaleEnabled()) || false;
59
+ const hasAuthConfigurationFile = fs.existsSync(join(directory, 'eventcatalog.auth.js'));
60
+ return (isAuthEnabledInCatalog && hasAuthConfigurationFile && isSSR() && isEventCatalogScaleEnabled()) || false;
57
61
  };
58
62
 
59
63
  export const isSSR = () => config?.output === 'server';
@@ -0,0 +1,86 @@
1
+ import fs from 'fs';
2
+ import path from 'path';
3
+ import { isSSR } from '@utils/feature';
4
+
5
+ /**
6
+ * Get the absolute base path for a resource item.
7
+ *
8
+ * In SSR mode, filePath is relative to the Astro core directory (e.g., "../examples/default/domains/...").
9
+ * We need to resolve it using PROJECT_DIR to get the correct absolute path.
10
+ *
11
+ * In static mode, filePath is resolved correctly by Astro's build context.
12
+ *
13
+ * @param item - The resource item with a filePath property
14
+ * @returns The absolute path to the directory containing the resource
15
+ */
16
+ export function getResourceBasePath(item: { filePath?: string }): string {
17
+ if (!item.filePath) {
18
+ return '';
19
+ }
20
+
21
+ const filePath = item.filePath;
22
+
23
+ // In SSR mode, we need to resolve the relative path using PROJECT_DIR
24
+ if (isSSR()) {
25
+ const PROJECT_DIR = process.env.PROJECT_DIR || '';
26
+
27
+ if (PROJECT_DIR) {
28
+ // Get the project folder name from PROJECT_DIR (e.g., "default" from ".../examples/default")
29
+ const projectFolderName = path.basename(PROJECT_DIR);
30
+
31
+ // Find the project folder in the relative path and extract everything after it
32
+ // Pattern: ../examples/default/domains/... -> domains/...
33
+ const regex = new RegExp(`.*?${projectFolderName}/(.+)$`);
34
+ const match = filePath.match(regex);
35
+
36
+ if (match && match[1]) {
37
+ // Join PROJECT_DIR with the relative path within the project
38
+ return path.join(PROJECT_DIR, path.dirname(match[1]));
39
+ }
40
+ }
41
+ }
42
+
43
+ // Static mode: resolve directly using Astro's build context
44
+ return path.dirname(path.resolve(filePath));
45
+ }
46
+
47
+ /**
48
+ * Get the absolute path to a file within a resource directory.
49
+ *
50
+ * @param item - The resource item with a filePath property
51
+ * @param relativePath - The relative path to the file (e.g., "schema.json")
52
+ * @returns The absolute path to the file
53
+ */
54
+ export function getResourceFilePath(item: { filePath?: string }, relativePath: string): string {
55
+ const basePath = getResourceBasePath(item);
56
+ return path.join(basePath, relativePath);
57
+ }
58
+
59
+ /**
60
+ * Check if a file exists within a resource directory.
61
+ *
62
+ * @param item - The resource item with a filePath property
63
+ * @param relativePath - The relative path to the file (e.g., "schema.json")
64
+ * @returns True if the file exists, false otherwise
65
+ */
66
+ export function resourceFileExists(item: { filePath?: string }, relativePath: string): boolean {
67
+ const filePath = getResourceFilePath(item, relativePath);
68
+ return fs.existsSync(filePath);
69
+ }
70
+
71
+ /**
72
+ * Read a file from a resource directory.
73
+ *
74
+ * @param item - The resource item with a filePath property
75
+ * @param relativePath - The relative path to the file (e.g., "schema.json")
76
+ * @returns The file content as a string, or null if the file doesn't exist
77
+ */
78
+ export function readResourceFile(item: { filePath?: string }, relativePath: string): string | null {
79
+ const filePath = getResourceFilePath(item, relativePath);
80
+
81
+ if (!fs.existsSync(filePath)) {
82
+ return null;
83
+ }
84
+
85
+ return fs.readFileSync(filePath, 'utf-8');
86
+ }
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": "3.0.0-beta.2",
9
+ "version": "3.0.0-beta.21",
10
10
  "publishConfig": {
11
11
  "access": "public"
12
12
  },
@@ -17,16 +17,12 @@
17
17
  "eventcatalog/",
18
18
  "!eventcatalog/**/__tests__/",
19
19
  "bin/",
20
- "dist/",
21
- "default-files-for-collections/"
20
+ "dist/"
22
21
  ],
23
22
  "dependencies": {
24
- "@ai-sdk/anthropic": "^2.0.23",
25
- "@ai-sdk/google": "^2.0.17",
26
- "@ai-sdk/openai": "^2.0.42",
27
23
  "@ai-sdk/react": "^2.0.60",
28
- "@astrojs/markdown-remark": "^6.3.9",
29
- "@astrojs/mdx": "^4.3.12",
24
+ "@astrojs/markdown-remark": "^6.3.10",
25
+ "@astrojs/mdx": "^4.3.13",
30
26
  "@astrojs/node": "^9.5.1",
31
27
  "@astrojs/react": "^4.4.2",
32
28
  "@astrojs/rss": "^4.0.14",
@@ -57,7 +53,7 @@
57
53
  "@tanstack/react-table": "^8.17.3",
58
54
  "@xyflow/react": "^12.3.6",
59
55
  "ai": "^5.0.60",
60
- "astro": "^5.16.4",
56
+ "astro": "^5.16.5",
61
57
  "astro-compress": "^2.3.8",
62
58
  "astro-expressive-code": "^0.41.3",
63
59
  "astro-seo": "^0.8.4",
@@ -76,30 +72,31 @@
76
72
  "glob": "^10.5.0",
77
73
  "gray-matter": "^4.0.3",
78
74
  "html-to-image": "^1.11.11",
79
- "js-yaml": "^4.1.0",
75
+ "js-yaml": "^4.1.1",
80
76
  "jsonpath": "^1.1.1",
81
77
  "jsonwebtoken": "^9.0.2",
82
78
  "lodash.debounce": "^4.0.8",
83
79
  "lodash.merge": "4.6.2",
84
80
  "lucide-react": "^0.453.0",
85
81
  "marked": "^15.0.6",
86
- "mermaid": "^11.4.1",
82
+ "mermaid": "^11.12.1",
87
83
  "nanostores": "^1.1.0",
88
- "pagefind": "^1.3.0",
89
84
  "pako": "^2.1.0",
85
+ "picocolors": "^1.1.1",
90
86
  "react": "^18.3.1",
91
87
  "react-dom": "^18.3.1",
92
88
  "react-markdown": "^10.1.0",
93
- "react-syntax-highlighter": "^15.6.1",
89
+ "react-syntax-highlighter": "^16.1.0",
94
90
  "rehype-autolink-headings": "^7.1.0",
95
91
  "rehype-expressive-code": "^0.41.3",
92
+ "rehype-raw": "^7.0.0",
96
93
  "rehype-slug": "^6.0.0",
97
94
  "remark-comment": "^1.0.0",
98
95
  "remark-directive": "^3.0.0",
99
96
  "remark-gfm": "^3.0.1",
100
97
  "rimraf": "^5.0.7",
101
98
  "semver": "7.6.3",
102
- "shelljs": "^0.8.5",
99
+ "shelljs": "^0.9.0",
103
100
  "tailwindcss": "^3.4.3",
104
101
  "tw-animate-css": "^1.4.0",
105
102
  "typescript": "^5.4.5",
@@ -146,7 +143,7 @@
146
143
  "preview": "astro preview",
147
144
  "astro": "astro",
148
145
  "start:catalog": "node scripts/start-catalog-locally.js",
149
- "pagefind": "node scripts/pagefind.js",
146
+ "start:catalog:server": "node scripts/start-server-locally.js",
150
147
  "preview:catalog": "node scripts/preview-catalog-locally.js",
151
148
  "generate:catalog": "node scripts/generate-catalog-locally.js",
152
149
  "verify-build:catalog": "rimraf dist && pnpm run build:cd",
@@ -1,5 +0,0 @@
1
- ---
2
- id: empty
3
- ---
4
-
5
- <!-- Do not delete this file, required for EC, you an ignore this file -->
@@ -1,8 +0,0 @@
1
- ---
2
- id: empty
3
- name: empty
4
- version: 0.0.1
5
- hidden: true
6
- ---
7
-
8
- <!-- Do not delete this file, required for EC, you an ignore this file -->
@@ -1,8 +0,0 @@
1
- ---
2
- id: empty
3
- name: empty
4
- version: 0.0.1
5
- hidden: true
6
- ---
7
-
8
- <!-- Do not delete this file, required for EC, you an ignore this file -->
@@ -1,8 +0,0 @@
1
- ---
2
- id: empty
3
- name: empty
4
- version: 0.0.1
5
- hidden: true
6
- ---
7
-
8
- <!-- Do not delete this file, required for EC, you an ignore this file -->
@@ -1,8 +0,0 @@
1
- ---
2
- id: empty
3
- name: empty
4
- version: 0.0.1
5
- hidden: true
6
- ---
7
-
8
- <!-- Do not delete this file, required for EC, you an ignore this file -->
@@ -1,11 +0,0 @@
1
- ---
2
- id: empty
3
- steps:
4
- - id: "empty"
5
- title: "empty"
6
- name: empty
7
- version: 0.0.1
8
- hidden: true
9
- ---
10
-
11
- <!-- Do not delete this file, required for EC, you an ignore this file -->
@@ -1,8 +0,0 @@
1
- ---
2
- id: empty
3
- name: empty
4
- version: 0.0.1
5
- hidden: true
6
- ---
7
-
8
- <!-- Do not delete this file, required for EC, you an ignore this file -->
@@ -1,8 +0,0 @@
1
- ---
2
- id: empty
3
- name: empty
4
- version: 0.0.1
5
- hidden: true
6
- ---
7
-
8
- <!-- Do not delete this file, required for EC, you an ignore this file -->
@@ -1,7 +0,0 @@
1
- ---
2
- id: ubiquitous-language
3
- name: Ubiquitous Language
4
- summary: A shared language used by all team members to communicate about the system.
5
- description: A shared language used by all team members to communicate about the system.
6
- ---
7
- <!-- Do not delete this file, required for EC, you an ignore this file -->
@@ -1,32 +0,0 @@
1
- import { z } from 'astro:content';
2
-
3
- export const chatPromptsSchema = z.object({
4
- title: z.string(),
5
- type: z.enum(['text', 'code']).default('text'),
6
- inputs: z
7
- .array(
8
- z.object({
9
- id: z.string(),
10
- label: z.string(),
11
- type: z
12
- .enum([
13
- 'text',
14
- 'resource-list-events',
15
- 'resource-list-services',
16
- 'resource-list-commands',
17
- 'resource-list-queries',
18
- 'code',
19
- 'text-area',
20
- 'select',
21
- ])
22
- .default('text'),
23
- options: z.array(z.string()).optional(),
24
- })
25
- )
26
- .optional(),
27
- category: z.object({
28
- id: z.string(),
29
- label: z.string(),
30
- icon: z.string().optional(),
31
- }),
32
- });
@@ -1,60 +0,0 @@
1
- import Sidebar from './ChatSidebar';
2
- import { ChatProvider } from './hooks/ChatProvider';
3
- import ChatWindowServer from './windows/ChatWindow.server';
4
- import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
5
- import type { ChatPromptCategoryGroup } from '@enterprise/eventcatalog-chat/utils/chat-prompts';
6
- interface Resource {
7
- id: string;
8
- type: string;
9
- name: string;
10
- }
11
-
12
- /**
13
- * Chat component has two modes:
14
- * - Server: ChatWindow.server.tsx (uses server-side code, bring your own API key)
15
- *
16
- * The mode is determined by the config.output property in the eventcatalog.config.js file.
17
- */
18
-
19
- const Chat = ({
20
- chatConfig,
21
- resources,
22
- chatPrompts,
23
- output,
24
- }: {
25
- chatConfig: any;
26
- resources: Resource[];
27
- chatPrompts: ChatPromptCategoryGroup[];
28
- output: 'static' | 'server';
29
- }) => {
30
- const queryClient = new QueryClient();
31
-
32
- if (output !== 'server') {
33
- return (
34
- // Message to turn on server side
35
- <div className="flex justify-center items-center h-full bg-gray-100 p-4 rounded-lg text-center">
36
- <div className="space-y-4">
37
- <h1 className="text-3xl font-semibold text-gray-800">Chat is only supported on server side</h1>
38
- <p className="text-sm text-gray-500">
39
- Please switch to server side by setting the <code className="font-mono bg-gray-100 p-0.5 rounded">output</code>{' '}
40
- property to <code className="font-mono bg-gray-100 p-0.5 rounded">server</code> in your{' '}
41
- <code className="font-mono bg-gray-100 p-0.5 rounded">eventcatalog.config.js</code> file.
42
- </p>
43
- </div>
44
- </div>
45
- );
46
- }
47
-
48
- return (
49
- <ChatProvider>
50
- <div className="flex overflow-hidden w-full">
51
- <Sidebar />
52
- <QueryClientProvider client={queryClient}>
53
- <ChatWindowServer {...chatConfig} resources={resources} chatPrompts={chatPrompts} />
54
- </QueryClientProvider>
55
- </div>
56
- </ChatProvider>
57
- );
58
- };
59
-
60
- export default Chat;