@eventcatalog/core 3.47.1 → 3.47.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.
- package/dist/analytics/analytics.cjs +1 -1
- package/dist/analytics/analytics.js +2 -2
- package/dist/analytics/log-build.cjs +1 -1
- package/dist/analytics/log-build.js +3 -3
- package/dist/catalog-to-astro-content-directory.cjs +17 -0
- package/dist/catalog-to-astro-content-directory.js +2 -2
- package/dist/{chunk-TL2SVMED.js → chunk-L2S6Y5ND.js} +1 -1
- package/dist/{chunk-3H2RT3CM.js → chunk-O3Y2G6CY.js} +1 -1
- package/dist/{chunk-6GSS7Q6C.js → chunk-RESGIWJP.js} +1 -1
- package/dist/{chunk-UKMUMDL5.js → chunk-RI354NOR.js} +1 -1
- package/dist/{chunk-KCQPWC27.js → chunk-RXNCY52G.js} +1 -1
- package/dist/{chunk-IR4IAKWS.js → chunk-VC6VUJIX.js} +6 -0
- package/dist/{chunk-X5CVZQHR.js → chunk-VGYTVGLU.js} +1 -1
- package/dist/{chunk-4SMA4HQ3.js → chunk-WQNKHIDM.js} +12 -1
- package/dist/constants.cjs +1 -1
- package/dist/constants.js +1 -1
- package/dist/eventcatalog.cjs +18 -1
- package/dist/eventcatalog.js +8 -8
- package/dist/generate.cjs +1 -1
- package/dist/generate.js +3 -3
- package/dist/map-catalog-to-astro.cjs +6 -0
- package/dist/map-catalog-to-astro.js +1 -1
- package/dist/utils/cli-logger.cjs +1 -1
- package/dist/utils/cli-logger.js +2 -2
- package/dist/watcher.cjs +6 -0
- package/dist/watcher.js +2 -2
- package/eventcatalog/astro.config.mjs +4 -3
- package/eventcatalog/src/components/MDX/LikeC4View/LikeC4View.astro +13 -0
- package/eventcatalog/src/components/MDX/LikeC4View/LikeC4ViewWrapper.tsx +52 -0
- package/eventcatalog/src/components/MDX/components.tsx +2 -0
- package/eventcatalog/src/components/Settings/BillingSettingsForm.tsx +1 -1
- package/eventcatalog/src/enterprise/ai/chat-api.ts +6 -4
- package/eventcatalog/src/env.d.ts +6 -0
- package/eventcatalog/src/plugins/likec4.ts +169 -0
- package/package.json +8 -8
|
@@ -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.
|
|
143
|
+
var version = "3.47.3";
|
|
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-
|
|
4
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-RXNCY52G.js";
|
|
4
|
+
import "../chunk-RI354NOR.js";
|
|
5
5
|
import "../chunk-DAOXTQVS.js";
|
|
6
|
-
import "../chunk-
|
|
6
|
+
import "../chunk-L2S6Y5ND.js";
|
|
7
7
|
import "../chunk-6QENHZZP.js";
|
|
8
8
|
export {
|
|
9
9
|
log_build_default as default
|
|
@@ -165,6 +165,9 @@ var COLLECTION_KEYS = [
|
|
|
165
165
|
];
|
|
166
166
|
function mapCatalogToAstro({ filePath, astroDir, projectDir }) {
|
|
167
167
|
const relativeFilePath = removeBasePath(filePath, projectDir);
|
|
168
|
+
if (isLikeC4Source(relativeFilePath)) {
|
|
169
|
+
return [];
|
|
170
|
+
}
|
|
168
171
|
if (!isCatalogRelated(relativeFilePath)) {
|
|
169
172
|
return [];
|
|
170
173
|
}
|
|
@@ -179,6 +182,9 @@ function removeBasePath(fullPath, basePath) {
|
|
|
179
182
|
function isCollectionKey(key) {
|
|
180
183
|
return COLLECTION_KEYS.includes(key);
|
|
181
184
|
}
|
|
185
|
+
function isLikeC4Source(filePath) {
|
|
186
|
+
return filePath.endsWith(".c4") || filePath.endsWith(".likec4");
|
|
187
|
+
}
|
|
182
188
|
function isCatalogRelated(filePath) {
|
|
183
189
|
const filePathArr = filePath.split(import_node_path2.default.sep).filter(Boolean);
|
|
184
190
|
if ([
|
|
@@ -266,6 +272,16 @@ var copyFiles = async (source, target) => {
|
|
|
266
272
|
});
|
|
267
273
|
}
|
|
268
274
|
};
|
|
275
|
+
var removeGeneratedLikeC4Sources = async (target) => {
|
|
276
|
+
const generatedDir = path3.join(target, "public", "generated");
|
|
277
|
+
const files = await (0, import_glob.glob)(path3.join(generatedDir, "**/*.{c4,likec4}"), {
|
|
278
|
+
nodir: true,
|
|
279
|
+
windowsPathsNoEscape: import_node_os2.default.platform() == "win32"
|
|
280
|
+
});
|
|
281
|
+
for (const file of files) {
|
|
282
|
+
import_fs.default.rmSync(file);
|
|
283
|
+
}
|
|
284
|
+
};
|
|
269
285
|
var catalogToAstro = async (source, astroDir) => {
|
|
270
286
|
const astroContentDir = path3.join(astroDir, "src/content/");
|
|
271
287
|
if (import_fs.default.existsSync(astroContentDir)) import_fs.default.rmSync(astroContentDir, { recursive: true });
|
|
@@ -274,6 +290,7 @@ var catalogToAstro = async (source, astroDir) => {
|
|
|
274
290
|
if (!import_fs.default.existsSync(path3.join(source, "eventcatalog.styles.css"))) {
|
|
275
291
|
import_fs.default.writeFileSync(path3.join(source, "eventcatalog.styles.css"), "");
|
|
276
292
|
}
|
|
293
|
+
await removeGeneratedLikeC4Sources(astroDir);
|
|
277
294
|
await copyFiles(source, astroDir);
|
|
278
295
|
};
|
|
279
296
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -16,6 +16,9 @@ var COLLECTION_KEYS = [
|
|
|
16
16
|
];
|
|
17
17
|
function mapCatalogToAstro({ filePath, astroDir, projectDir }) {
|
|
18
18
|
const relativeFilePath = removeBasePath(filePath, projectDir);
|
|
19
|
+
if (isLikeC4Source(relativeFilePath)) {
|
|
20
|
+
return [];
|
|
21
|
+
}
|
|
19
22
|
if (!isCatalogRelated(relativeFilePath)) {
|
|
20
23
|
return [];
|
|
21
24
|
}
|
|
@@ -30,6 +33,9 @@ function removeBasePath(fullPath, basePath) {
|
|
|
30
33
|
function isCollectionKey(key) {
|
|
31
34
|
return COLLECTION_KEYS.includes(key);
|
|
32
35
|
}
|
|
36
|
+
function isLikeC4Source(filePath) {
|
|
37
|
+
return filePath.endsWith(".c4") || filePath.endsWith(".likec4");
|
|
38
|
+
}
|
|
33
39
|
function isCatalogRelated(filePath) {
|
|
34
40
|
const filePathArr = filePath.split(path.sep).filter(Boolean);
|
|
35
41
|
if ([
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
mapCatalogToAstro
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-VC6VUJIX.js";
|
|
4
4
|
import {
|
|
5
5
|
verifyRequiredFieldsAreInCatalogConfigFile
|
|
6
6
|
} from "./chunk-6QENHZZP.js";
|
|
@@ -40,6 +40,16 @@ var copyFiles = async (source, target) => {
|
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
42
|
};
|
|
43
|
+
var removeGeneratedLikeC4Sources = async (target) => {
|
|
44
|
+
const generatedDir = path.join(target, "public", "generated");
|
|
45
|
+
const files = await glob(path.join(generatedDir, "**/*.{c4,likec4}"), {
|
|
46
|
+
nodir: true,
|
|
47
|
+
windowsPathsNoEscape: os.platform() == "win32"
|
|
48
|
+
});
|
|
49
|
+
for (const file of files) {
|
|
50
|
+
fs.rmSync(file);
|
|
51
|
+
}
|
|
52
|
+
};
|
|
43
53
|
var catalogToAstro = async (source, astroDir) => {
|
|
44
54
|
const astroContentDir = path.join(astroDir, "src/content/");
|
|
45
55
|
if (fs.existsSync(astroContentDir)) fs.rmSync(astroContentDir, { recursive: true });
|
|
@@ -48,6 +58,7 @@ var catalogToAstro = async (source, astroDir) => {
|
|
|
48
58
|
if (!fs.existsSync(path.join(source, "eventcatalog.styles.css"))) {
|
|
49
59
|
fs.writeFileSync(path.join(source, "eventcatalog.styles.css"), "");
|
|
50
60
|
}
|
|
61
|
+
await removeGeneratedLikeC4Sources(astroDir);
|
|
51
62
|
await copyFiles(source, astroDir);
|
|
52
63
|
};
|
|
53
64
|
|
package/dist/constants.cjs
CHANGED
package/dist/constants.js
CHANGED
package/dist/eventcatalog.cjs
CHANGED
|
@@ -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.
|
|
147
|
+
var version = "3.47.3";
|
|
148
148
|
|
|
149
149
|
// src/constants.ts
|
|
150
150
|
var VERSION = version;
|
|
@@ -429,6 +429,9 @@ var COLLECTION_KEYS = [
|
|
|
429
429
|
];
|
|
430
430
|
function mapCatalogToAstro({ filePath, astroDir, projectDir }) {
|
|
431
431
|
const relativeFilePath = removeBasePath(filePath, projectDir);
|
|
432
|
+
if (isLikeC4Source(relativeFilePath)) {
|
|
433
|
+
return [];
|
|
434
|
+
}
|
|
432
435
|
if (!isCatalogRelated(relativeFilePath)) {
|
|
433
436
|
return [];
|
|
434
437
|
}
|
|
@@ -443,6 +446,9 @@ function removeBasePath(fullPath, basePath) {
|
|
|
443
446
|
function isCollectionKey(key) {
|
|
444
447
|
return COLLECTION_KEYS.includes(key);
|
|
445
448
|
}
|
|
449
|
+
function isLikeC4Source(filePath) {
|
|
450
|
+
return filePath.endsWith(".c4") || filePath.endsWith(".likec4");
|
|
451
|
+
}
|
|
446
452
|
function isCatalogRelated(filePath) {
|
|
447
453
|
const filePathArr = filePath.split(import_node_path3.default.sep).filter(Boolean);
|
|
448
454
|
if ([
|
|
@@ -626,6 +632,16 @@ var copyFiles = async (source, target) => {
|
|
|
626
632
|
});
|
|
627
633
|
}
|
|
628
634
|
};
|
|
635
|
+
var removeGeneratedLikeC4Sources = async (target) => {
|
|
636
|
+
const generatedDir = path4.join(target, "public", "generated");
|
|
637
|
+
const files = await (0, import_glob2.glob)(path4.join(generatedDir, "**/*.{c4,likec4}"), {
|
|
638
|
+
nodir: true,
|
|
639
|
+
windowsPathsNoEscape: import_node_os2.default.platform() == "win32"
|
|
640
|
+
});
|
|
641
|
+
for (const file of files) {
|
|
642
|
+
import_fs.default.rmSync(file);
|
|
643
|
+
}
|
|
644
|
+
};
|
|
629
645
|
var catalogToAstro = async (source, astroDir) => {
|
|
630
646
|
const astroContentDir = path4.join(astroDir, "src/content/");
|
|
631
647
|
if (import_fs.default.existsSync(astroContentDir)) import_fs.default.rmSync(astroContentDir, { recursive: true });
|
|
@@ -634,6 +650,7 @@ var catalogToAstro = async (source, astroDir) => {
|
|
|
634
650
|
if (!import_fs.default.existsSync(path4.join(source, "eventcatalog.styles.css"))) {
|
|
635
651
|
import_fs.default.writeFileSync(path4.join(source, "eventcatalog.styles.css"), "");
|
|
636
652
|
}
|
|
653
|
+
await removeGeneratedLikeC4Sources(astroDir);
|
|
637
654
|
await copyFiles(source, astroDir);
|
|
638
655
|
};
|
|
639
656
|
|
package/dist/eventcatalog.js
CHANGED
|
@@ -10,16 +10,16 @@ import {
|
|
|
10
10
|
} from "./chunk-ZONBICNH.js";
|
|
11
11
|
import {
|
|
12
12
|
watch
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-O3Y2G6CY.js";
|
|
14
14
|
import {
|
|
15
15
|
log_build_default
|
|
16
|
-
} from "./chunk-
|
|
17
|
-
import "./chunk-
|
|
16
|
+
} from "./chunk-RXNCY52G.js";
|
|
17
|
+
import "./chunk-RI354NOR.js";
|
|
18
18
|
import "./chunk-DAOXTQVS.js";
|
|
19
19
|
import {
|
|
20
20
|
catalogToAstro
|
|
21
|
-
} from "./chunk-
|
|
22
|
-
import "./chunk-
|
|
21
|
+
} from "./chunk-WQNKHIDM.js";
|
|
22
|
+
import "./chunk-VC6VUJIX.js";
|
|
23
23
|
import {
|
|
24
24
|
getProjectOutDir,
|
|
25
25
|
isAuthEnabled,
|
|
@@ -28,13 +28,13 @@ import {
|
|
|
28
28
|
} from "./chunk-B7HCX5HM.js";
|
|
29
29
|
import {
|
|
30
30
|
generate
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-RESGIWJP.js";
|
|
32
32
|
import {
|
|
33
33
|
logger
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-VGYTVGLU.js";
|
|
35
35
|
import {
|
|
36
36
|
VERSION
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-L2S6Y5ND.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.
|
|
111
|
+
var version = "3.47.3";
|
|
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-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-RESGIWJP.js";
|
|
4
|
+
import "./chunk-VGYTVGLU.js";
|
|
5
|
+
import "./chunk-L2S6Y5ND.js";
|
|
6
6
|
import "./chunk-6QENHZZP.js";
|
|
7
7
|
export {
|
|
8
8
|
generate
|
|
@@ -50,6 +50,9 @@ var COLLECTION_KEYS = [
|
|
|
50
50
|
];
|
|
51
51
|
function mapCatalogToAstro({ filePath, astroDir, projectDir }) {
|
|
52
52
|
const relativeFilePath = removeBasePath(filePath, projectDir);
|
|
53
|
+
if (isLikeC4Source(relativeFilePath)) {
|
|
54
|
+
return [];
|
|
55
|
+
}
|
|
53
56
|
if (!isCatalogRelated(relativeFilePath)) {
|
|
54
57
|
return [];
|
|
55
58
|
}
|
|
@@ -64,6 +67,9 @@ function removeBasePath(fullPath, basePath) {
|
|
|
64
67
|
function isCollectionKey(key) {
|
|
65
68
|
return COLLECTION_KEYS.includes(key);
|
|
66
69
|
}
|
|
70
|
+
function isLikeC4Source(filePath) {
|
|
71
|
+
return filePath.endsWith(".c4") || filePath.endsWith(".likec4");
|
|
72
|
+
}
|
|
67
73
|
function isCatalogRelated(filePath) {
|
|
68
74
|
const filePathArr = filePath.split(import_node_path.default.sep).filter(Boolean);
|
|
69
75
|
if ([
|
package/dist/utils/cli-logger.js
CHANGED
package/dist/watcher.cjs
CHANGED
|
@@ -54,6 +54,9 @@ var COLLECTION_KEYS = [
|
|
|
54
54
|
];
|
|
55
55
|
function mapCatalogToAstro({ filePath, astroDir, projectDir }) {
|
|
56
56
|
const relativeFilePath = removeBasePath(filePath, projectDir);
|
|
57
|
+
if (isLikeC4Source(relativeFilePath)) {
|
|
58
|
+
return [];
|
|
59
|
+
}
|
|
57
60
|
if (!isCatalogRelated(relativeFilePath)) {
|
|
58
61
|
return [];
|
|
59
62
|
}
|
|
@@ -68,6 +71,9 @@ function removeBasePath(fullPath, basePath) {
|
|
|
68
71
|
function isCollectionKey(key) {
|
|
69
72
|
return COLLECTION_KEYS.includes(key);
|
|
70
73
|
}
|
|
74
|
+
function isLikeC4Source(filePath) {
|
|
75
|
+
return filePath.endsWith(".c4") || filePath.endsWith(".likec4");
|
|
76
|
+
}
|
|
71
77
|
function isCatalogRelated(filePath) {
|
|
72
78
|
const filePathArr = filePath.split(import_node_path.default.sep).filter(Boolean);
|
|
73
79
|
if ([
|
package/dist/watcher.js
CHANGED
|
@@ -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.
|
|
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 (!
|
|
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 (!
|
|
187
|
-
return new Response(JSON.stringify({ error: 'Chat is not enabled, please upgrade to
|
|
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@1.57.0 @likec4/icons@latest
|
|
20
|
+
pnpm add -D likec4@1.57.0 @likec4/icons@latest
|
|
21
|
+
yarn add -D likec4@1.57.0 @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.
|
|
10
|
+
"version": "3.47.3",
|
|
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.
|
|
34
|
-
"@astrojs/node": "^10.1.
|
|
35
|
-
"@astrojs/react": "^5.0.
|
|
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.
|
|
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",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"gray-matter": "^4.0.3",
|
|
76
76
|
"hono": "4.12.21",
|
|
77
77
|
"html-to-image": "^1.11.11",
|
|
78
|
-
"js-yaml": "^4.
|
|
78
|
+
"js-yaml": "^4.2.0",
|
|
79
79
|
"jsonpath-plus": "^10.4.0",
|
|
80
80
|
"jsonwebtoken": "^9.0.2",
|
|
81
81
|
"lodash.debounce": "^4.0.8",
|
|
@@ -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/
|
|
116
|
-
"@eventcatalog/
|
|
115
|
+
"@eventcatalog/visualiser": "^3.22.1",
|
|
116
|
+
"@eventcatalog/sdk": "2.24.1"
|
|
117
117
|
},
|
|
118
118
|
"devDependencies": {
|
|
119
119
|
"@astrojs/check": "^0.9.9",
|