@eventcatalog/core 3.47.1 → 3.47.2

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.
@@ -36,7 +36,7 @@ module.exports = __toCommonJS(analytics_exports);
36
36
  var import_os = __toESM(require("os"), 1);
37
37
 
38
38
  // package.json
39
- var version = "3.47.1";
39
+ var version = "3.47.2";
40
40
 
41
41
  // src/constants.ts
42
42
  var VERSION = version;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  raiseEvent
3
- } from "../chunk-UKMUMDL5.js";
4
- import "../chunk-TL2SVMED.js";
3
+ } from "../chunk-7QEB6VKU.js";
4
+ import "../chunk-Y7YNYWYT.js";
5
5
  export {
6
6
  raiseEvent
7
7
  };
@@ -140,7 +140,7 @@ var verifyRequiredFieldsAreInCatalogConfigFile = async (projectDirectory) => {
140
140
  var import_os = __toESM(require("os"), 1);
141
141
 
142
142
  // package.json
143
- var version = "3.47.1";
143
+ var version = "3.47.2";
144
144
 
145
145
  // src/constants.ts
146
146
  var VERSION = version;
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  log_build_default
3
- } from "../chunk-KCQPWC27.js";
4
- import "../chunk-UKMUMDL5.js";
3
+ } from "../chunk-JJXPDJAK.js";
4
+ import "../chunk-7QEB6VKU.js";
5
5
  import "../chunk-DAOXTQVS.js";
6
- import "../chunk-TL2SVMED.js";
6
+ import "../chunk-Y7YNYWYT.js";
7
7
  import "../chunk-6QENHZZP.js";
8
8
  export {
9
9
  log_build_default as default
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VERSION
3
- } from "./chunk-TL2SVMED.js";
3
+ } from "./chunk-Y7YNYWYT.js";
4
4
 
5
5
  // src/analytics/analytics.js
6
6
  import os from "os";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  raiseEvent
3
- } from "./chunk-UKMUMDL5.js";
3
+ } from "./chunk-7QEB6VKU.js";
4
4
  import {
5
5
  countResources,
6
6
  serializeCounts
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  logger
3
- } from "./chunk-X5CVZQHR.js";
3
+ } from "./chunk-Y7XPSO3E.js";
4
4
  import {
5
5
  cleanup,
6
6
  getEventCatalogConfigFile
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VERSION
3
- } from "./chunk-TL2SVMED.js";
3
+ } from "./chunk-Y7YNYWYT.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.47.1";
2
+ var version = "3.47.2";
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.47.1";
28
+ var version = "3.47.2";
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-TL2SVMED.js";
3
+ } from "./chunk-Y7YNYWYT.js";
4
4
  export {
5
5
  VERSION
6
6
  };
@@ -144,7 +144,7 @@ var verifyRequiredFieldsAreInCatalogConfigFile = async (projectDirectory) => {
144
144
  var import_picocolors = __toESM(require("picocolors"), 1);
145
145
 
146
146
  // package.json
147
- var version = "3.47.1";
147
+ var version = "3.47.2";
148
148
 
149
149
  // src/constants.ts
150
150
  var VERSION = version;
@@ -13,8 +13,8 @@ import {
13
13
  } from "./chunk-3H2RT3CM.js";
14
14
  import {
15
15
  log_build_default
16
- } from "./chunk-KCQPWC27.js";
17
- import "./chunk-UKMUMDL5.js";
16
+ } from "./chunk-JJXPDJAK.js";
17
+ import "./chunk-7QEB6VKU.js";
18
18
  import "./chunk-DAOXTQVS.js";
19
19
  import {
20
20
  catalogToAstro
@@ -28,13 +28,13 @@ import {
28
28
  } from "./chunk-B7HCX5HM.js";
29
29
  import {
30
30
  generate
31
- } from "./chunk-6GSS7Q6C.js";
31
+ } from "./chunk-XORTIVNN.js";
32
32
  import {
33
33
  logger
34
- } from "./chunk-X5CVZQHR.js";
34
+ } from "./chunk-Y7XPSO3E.js";
35
35
  import {
36
36
  VERSION
37
- } from "./chunk-TL2SVMED.js";
37
+ } from "./chunk-Y7YNYWYT.js";
38
38
  import {
39
39
  getEventCatalogConfigFile,
40
40
  verifyRequiredFieldsAreInCatalogConfigFile
package/dist/generate.cjs CHANGED
@@ -108,7 +108,7 @@ var getEventCatalogConfigFile = async (projectDirectory) => {
108
108
  var import_picocolors = __toESM(require("picocolors"), 1);
109
109
 
110
110
  // package.json
111
- var version = "3.47.1";
111
+ var version = "3.47.2";
112
112
 
113
113
  // src/constants.ts
114
114
  var VERSION = version;
package/dist/generate.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  generate
3
- } from "./chunk-6GSS7Q6C.js";
4
- import "./chunk-X5CVZQHR.js";
5
- import "./chunk-TL2SVMED.js";
3
+ } from "./chunk-XORTIVNN.js";
4
+ import "./chunk-Y7XPSO3E.js";
5
+ import "./chunk-Y7YNYWYT.js";
6
6
  import "./chunk-6QENHZZP.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.47.1";
39
+ var version = "3.47.2";
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-X5CVZQHR.js";
4
- import "../chunk-TL2SVMED.js";
3
+ } from "../chunk-Y7XPSO3E.js";
4
+ import "../chunk-Y7YNYWYT.js";
5
5
  export {
6
6
  logger
7
7
  };
@@ -13,6 +13,7 @@ import node from '@astrojs/node';
13
13
  import remarkComment from 'remark-comment';
14
14
  import rehypeSlug from 'rehype-slug';
15
15
  import rehypeAutolinkHeadings from 'rehype-autolink-headings';
16
+ import { eventCatalogLikeC4 } from './src/plugins/likec4';
16
17
 
17
18
  import rehypeExpressiveCode from 'rehype-expressive-code';
18
19
 
@@ -41,7 +42,7 @@ const mdxRemarkPlugins = [...markdownRemarkPlugins, remarkResourceRef];
41
42
  // https://astro.build/config
42
43
  export default defineConfig({
43
44
  base,
44
- server: {
45
+ server: {
45
46
  port: config.port || 3000,
46
47
  host: host,
47
48
  // Add allowed hosts if its set
@@ -110,7 +111,7 @@ export default defineConfig({
110
111
  eventCatalogIntegration(),
111
112
  ].filter(Boolean),
112
113
  vite: {
113
- plugins: [tailwindcss()],
114
+ plugins: [tailwindcss(), ...(await eventCatalogLikeC4(projectDirectory))],
114
115
  define: {
115
116
  /**
116
117
  * Trailing slash is exposed as global variable here principally for `@utils/url-builder`.
@@ -124,7 +125,7 @@ export default defineConfig({
124
125
  },
125
126
  server: {
126
127
  fs: {
127
- allow: ['..', './node_modules/@fontsource', searchForWorkspaceRoot(process.cwd())],
128
+ allow: ['..', './node_modules/@fontsource', projectDirectory, searchForWorkspaceRoot(process.cwd())],
128
129
  },
129
130
  // Prevent stale FSEvents from triggering a config-dependency restart on first run.
130
131
  // During startup, catalogToAstro copies eventcatalog.config.js into .eventcatalog-core
@@ -0,0 +1,13 @@
1
+ ---
2
+ import LikeC4ViewWrapper from './LikeC4ViewWrapper';
3
+
4
+ interface Props {
5
+ viewId: string;
6
+ project?: string;
7
+ height?: string;
8
+ }
9
+
10
+ const { viewId, project, height } = Astro.props;
11
+ ---
12
+
13
+ <LikeC4ViewWrapper viewId={viewId} project={project} height={height} client:only="react" />
@@ -0,0 +1,52 @@
1
+ import { lazy, Suspense, useMemo, type ComponentType } from 'react';
2
+ import { getProjectLoader } from 'virtual:likec4-projects';
3
+
4
+ interface LikeC4ViewWrapperProps {
5
+ viewId: string;
6
+ project?: string;
7
+ height?: string;
8
+ }
9
+
10
+ interface LikeC4ViewProps {
11
+ viewId: string;
12
+ controls?: boolean;
13
+ browser?: {
14
+ enableFocusMode?: boolean;
15
+ enableSearch?: boolean;
16
+ };
17
+ }
18
+
19
+ const lazyComponentCache = new Map<string, ComponentType<LikeC4ViewProps>>();
20
+
21
+ const getLazyComponent = (project: string): ComponentType<LikeC4ViewProps> => {
22
+ const key = project || 'default';
23
+
24
+ if (!lazyComponentCache.has(key)) {
25
+ const loader = getProjectLoader(key);
26
+ const LazyComponent = lazy(() => loader().then((mod) => ({ default: mod.LikeC4View })));
27
+ lazyComponentCache.set(key, LazyComponent);
28
+ }
29
+
30
+ return lazyComponentCache.get(key)!;
31
+ };
32
+
33
+ export default function LikeC4ViewWrapper({ viewId, project, height = '600px' }: LikeC4ViewWrapperProps) {
34
+ const LikeC4ViewComponent = useMemo(() => getLazyComponent(project || 'default'), [project]);
35
+
36
+ return (
37
+ <div style={{ height, maxHeight: height }} className="w-full overflow-hidden rounded-lg border border-gray-200">
38
+ <Suspense
39
+ fallback={<div className="flex h-full items-center justify-center rounded-lg bg-gray-100">Loading diagram...</div>}
40
+ >
41
+ <LikeC4ViewComponent
42
+ viewId={viewId}
43
+ controls={false}
44
+ browser={{
45
+ enableFocusMode: false,
46
+ enableSearch: false,
47
+ }}
48
+ />
49
+ </Suspense>
50
+ </div>
51
+ );
52
+ }
@@ -31,6 +31,7 @@ import FigJam from '@components/MDX/FigJam/FigJam.astro';
31
31
  import IcePanel from '@components/MDX/IcePanel/IcePanel.astro';
32
32
  import Design from '@components/MDX/Design/Design.astro';
33
33
  import MermaidFileLoader from '@components/MDX/MermaidFileLoader/MermaidFileLoader.astro';
34
+ import LikeC4View from '@components/MDX/LikeC4View/LikeC4View.astro';
34
35
  // Portals: required for server/client components
35
36
  import NodeGraphPortal from '@components/MDX/NodeGraph/NodeGraphPortal';
36
37
  import SchemaViewerPortal from '@components/MDX/SchemaViewer/SchemaViewerPortal';
@@ -76,6 +77,7 @@ const components = (props: any) => {
76
77
  FigJam: (mdxProp: any) => jsx(FigJam, { ...props, ...mdxProp }),
77
78
  IcePanel: (mdxProp: any) => jsx(IcePanel, { ...props, ...mdxProp }),
78
79
  MermaidFileLoader: (mdxProp: any) => jsx(MermaidFileLoader, { ...props, ...mdxProp }),
80
+ LikeC4View: (mdxProp: any) => jsx(LikeC4View, { ...props, ...mdxProp }),
79
81
  };
80
82
  };
81
83
 
@@ -129,7 +129,7 @@ export const BillingSettingsForm = ({ currentPlan }: Props) => {
129
129
  <div className="divide-y divide-[rgb(var(--ec-page-border))]">
130
130
  <Row
131
131
  title="Billing plan"
132
- description="View and manage your billing plan. Upgrade unlocks the AI assistant, MCP server, and other Scale-only features."
132
+ description="View and manage your billing plan. Paid plans unlock the AI assistant, with MCP server and other advanced features available on Scale."
133
133
  canEdit={false}
134
134
  dirty={false}
135
135
  >
@@ -6,7 +6,7 @@
6
6
  import type { APIContext } from 'astro';
7
7
  import { convertToModelMessages, stepCountIs, streamText, tool, type LanguageModel, type ModelMessage, type UIMessage } from 'ai';
8
8
  import { join } from 'node:path';
9
- import { isEventCatalogScaleEnabled } from '@utils/feature';
9
+ import { isEventCatalogScaleEnabled, isEventCatalogStarterEnabled } from '@utils/feature';
10
10
  import { getCollection, getEntry } from 'astro:content';
11
11
  import { z } from 'astro/zod';
12
12
  import { getConsumersOfMessage, getProducersOfMessage } from '@utils/collections/services';
@@ -41,6 +41,8 @@ let model: LanguageModel;
41
41
  let modelConfiguration: any;
42
42
  let extendedTools: any;
43
43
 
44
+ const hasAssistantPlan = () => isEventCatalogStarterEnabled() || isEventCatalogScaleEnabled();
45
+
44
46
  try {
45
47
  const providerConfiguration = await import(/* @vite-ignore */ join(catalogDirectory, 'eventcatalog.chat.js'));
46
48
  model = await providerConfiguration.default();
@@ -158,7 +160,7 @@ interface Message {
158
160
  }
159
161
 
160
162
  export const GET = async ({ request }: APIContext<{ question: string; messages: Message[]; additionalContext?: string }>) => {
161
- if (!isEventCatalogScaleEnabled()) {
163
+ if (!hasAssistantPlan()) {
162
164
  return new Response(JSON.stringify({ error: 'Chat is not enabled' }), {
163
165
  status: 403,
164
166
  headers: { 'Content-Type': 'application/json' },
@@ -183,8 +185,8 @@ export const GET = async ({ request }: APIContext<{ question: string; messages:
183
185
  export const POST = async ({ request }: APIContext<{ question: string; messages: Message[]; additionalContext?: string }>) => {
184
186
  const { messages }: { messages: UIMessage[] } = await request.json();
185
187
 
186
- if (!isEventCatalogScaleEnabled()) {
187
- return new Response(JSON.stringify({ error: 'Chat is not enabled, please upgrade to the scale plan to use this feature' }), {
188
+ if (!hasAssistantPlan()) {
189
+ return new Response(JSON.stringify({ error: 'Chat is not enabled, please upgrade to a paid plan to use this feature' }), {
188
190
  status: 403,
189
191
  headers: { 'Content-Type': 'application/json' },
190
192
  });
@@ -5,6 +5,12 @@ declare const __EC_TRAILING_SLASH__: boolean;
5
5
  declare const __EC_BASE__: string;
6
6
  declare const __EC_SEARCH_TYPE__: 'resource' | 'indexed';
7
7
 
8
+ declare module 'virtual:likec4-projects' {
9
+ export const projectRegistry: Record<string, () => Promise<{ LikeC4View: import('react').ComponentType<any> }>>;
10
+ export const discoveredProjects: string[];
11
+ export function getProjectLoader(projectName: string): () => Promise<{ LikeC4View: import('react').ComponentType<any> }>;
12
+ }
13
+
8
14
  interface EventCatalogConfig {
9
15
  mermaid?: {
10
16
  iconPacks?: string[];
@@ -0,0 +1,169 @@
1
+ import type { Plugin } from 'vite';
2
+ import { readFileSync } from 'node:fs';
3
+ import { createRequire } from 'node:module';
4
+ import { join } from 'node:path';
5
+ import { pathToFileURL } from 'node:url';
6
+ import { glob, globSync } from 'glob';
7
+
8
+ interface LikeC4Config {
9
+ name?: string;
10
+ }
11
+
12
+ const virtualModuleId = 'virtual:likec4-projects';
13
+ const resolvedVirtualModuleId = `\0${virtualModuleId}`;
14
+
15
+ const likeC4InstallMessage = `LikeC4 diagrams were found, but LikeC4 is not installed.
16
+
17
+ Install LikeC4 in your EventCatalog project:
18
+
19
+ npm install --save-dev likec4@latest @likec4/icons@latest
20
+ pnpm add -D likec4@latest @likec4/icons@latest
21
+ yarn add -D likec4@latest @likec4/icons@latest`;
22
+
23
+ export const eventCatalogLikeC4 = async (workspaceDir: string): Promise<Plugin[]> => {
24
+ const enabled = hasLikeC4Sources(workspaceDir);
25
+ const registry = likeC4ProjectRegistry(workspaceDir, enabled);
26
+
27
+ if (!enabled) {
28
+ return [registry];
29
+ }
30
+
31
+ const LikeC4VitePlugin = await loadLikeC4VitePlugin(workspaceDir);
32
+
33
+ return [
34
+ LikeC4VitePlugin({
35
+ workspace: workspaceDir,
36
+ }),
37
+ registry,
38
+ ];
39
+ };
40
+
41
+ const hasLikeC4Sources = (workspaceDir: string) => {
42
+ return (
43
+ globSync('**/*.{c4,likec4}', {
44
+ cwd: workspaceDir,
45
+ ignore: ['**/node_modules/**'],
46
+ }).length > 0
47
+ );
48
+ };
49
+
50
+ const loadLikeC4VitePlugin = async (workspaceDir: string) => {
51
+ try {
52
+ const requireFromCatalog = createRequire(join(workspaceDir, 'package.json'));
53
+ const likeC4VitePluginPath = requireFromCatalog.resolve('likec4/vite-plugin');
54
+ const likeC4 = await import(/* @vite-ignore */ pathToFileURL(likeC4VitePluginPath).href);
55
+
56
+ if (!likeC4.LikeC4VitePlugin) {
57
+ throw new Error('The installed likec4 package does not export LikeC4VitePlugin from likec4/vite-plugin.');
58
+ }
59
+
60
+ return likeC4.LikeC4VitePlugin;
61
+ } catch (error) {
62
+ throw new Error(`${likeC4InstallMessage}\n\n${error instanceof Error ? error.message : String(error)}`);
63
+ }
64
+ };
65
+
66
+ const likeC4ProjectRegistry = (workspaceDir: string, enabled: boolean): Plugin => {
67
+ let discoveredProjects: string[] = [];
68
+
69
+ const discoverProjects = async () => {
70
+ const configFiles = await glob('**/{likec4.config.json,.likec4rc}', {
71
+ cwd: workspaceDir,
72
+ ignore: ['**/node_modules/**'],
73
+ absolute: true,
74
+ });
75
+
76
+ const projectNames = new Set<string>();
77
+
78
+ for (const configPath of configFiles) {
79
+ try {
80
+ const config = JSON.parse(readFileSync(configPath, 'utf-8')) as LikeC4Config;
81
+ if (config.name) {
82
+ projectNames.add(config.name);
83
+ }
84
+ } catch (error) {
85
+ console.warn(`[likec4-registry] Failed to parse ${configPath}:`, error);
86
+ }
87
+ }
88
+
89
+ discoveredProjects = Array.from(projectNames).sort();
90
+
91
+ if (discoveredProjects.length > 0) {
92
+ console.log(`[likec4-registry] Discovered projects: ${discoveredProjects.join(', ')}`);
93
+ }
94
+ };
95
+
96
+ return {
97
+ name: 'eventcatalog-likec4',
98
+
99
+ async buildStart() {
100
+ if (enabled) {
101
+ await discoverProjects();
102
+ }
103
+ },
104
+
105
+ resolveId(id) {
106
+ if (id === virtualModuleId) {
107
+ return resolvedVirtualModuleId;
108
+ }
109
+ },
110
+
111
+ load(id) {
112
+ if (id !== resolvedVirtualModuleId) {
113
+ return;
114
+ }
115
+
116
+ if (!enabled) {
117
+ return `
118
+ export const projectRegistry = {
119
+ default: () => Promise.resolve({
120
+ LikeC4View: () => null,
121
+ }),
122
+ };
123
+
124
+ export const discoveredProjects = [];
125
+
126
+ export function getProjectLoader() {
127
+ return projectRegistry.default;
128
+ }
129
+ `;
130
+ }
131
+
132
+ const imports = discoveredProjects
133
+ .map((name, index) => `import * as project_${index} from ${JSON.stringify(`likec4:react/${name}`)};`)
134
+ .join('\n');
135
+ const registryEntries = discoveredProjects
136
+ .map((name, index) => ` ${JSON.stringify(name)}: () => Promise.resolve(project_${index}),`)
137
+ .join('\n');
138
+
139
+ return `
140
+ import * as defaultProject from 'likec4:react';
141
+ ${imports}
142
+
143
+ export const projectRegistry = {
144
+ default: () => Promise.resolve(defaultProject),
145
+ ${registryEntries}
146
+ };
147
+
148
+ export const discoveredProjects = ${JSON.stringify(discoveredProjects)};
149
+
150
+ export function getProjectLoader(projectName) {
151
+ return projectRegistry[projectName] || projectRegistry.default;
152
+ }
153
+ `;
154
+ },
155
+
156
+ configureServer(server) {
157
+ server.watcher.add(join(workspaceDir, '**/likec4.config.json'));
158
+ server.watcher.on('change', async (path) => {
159
+ if (path.endsWith('likec4.config.json')) {
160
+ await discoverProjects();
161
+ const module = server.moduleGraph.getModuleById(resolvedVirtualModuleId);
162
+ if (module) {
163
+ server.moduleGraph.invalidateModule(module);
164
+ }
165
+ }
166
+ });
167
+ },
168
+ };
169
+ };
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  },
8
8
  "license": "SEE LICENSE IN LICENSE",
9
9
  "type": "module",
10
- "version": "3.47.1",
10
+ "version": "3.47.2",
11
11
  "publishConfig": {
12
12
  "access": "public"
13
13
  },
@@ -30,9 +30,9 @@
30
30
  "dependencies": {
31
31
  "@ai-sdk/react": "^3.0.17",
32
32
  "@astrojs/markdown-remark": "^7.2.0",
33
- "@astrojs/mdx": "^6.0.1",
34
- "@astrojs/node": "^10.1.2",
35
- "@astrojs/react": "^5.0.6",
33
+ "@astrojs/mdx": "^6.0.3",
34
+ "@astrojs/node": "^10.1.4",
35
+ "@astrojs/react": "^5.0.7",
36
36
  "@astrojs/rss": "^4.0.18",
37
37
  "@asyncapi/avro-schema-parser": "3.0.24",
38
38
  "@asyncapi/parser": "^3.6.0",
@@ -58,7 +58,7 @@
58
58
  "@tanstack/react-table": "^8.17.3",
59
59
  "@xyflow/react": "^12.3.6",
60
60
  "ai": "^6.0.17",
61
- "astro": "^6.4.1",
61
+ "astro": "^6.4.7",
62
62
  "astro-compress": "^2.4.0",
63
63
  "astro-expressive-code": "^0.41.7",
64
64
  "astro-seo": "^0.8.4",
@@ -112,8 +112,8 @@
112
112
  "uuid": "^10.0.0",
113
113
  "zod": "^4.3.6",
114
114
  "@eventcatalog/linter": "1.0.29",
115
- "@eventcatalog/sdk": "2.24.1",
116
- "@eventcatalog/visualiser": "^3.22.1"
115
+ "@eventcatalog/visualiser": "^3.22.1",
116
+ "@eventcatalog/sdk": "2.24.1"
117
117
  },
118
118
  "devDependencies": {
119
119
  "@astrojs/check": "^0.9.9",