@eventcatalog/core 3.3.1 → 3.4.1
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/{chunk-IFELNUKH.js → chunk-56E6QDHD.js} +1 -1
- package/dist/{chunk-AJ7F2ASU.js → chunk-6AW5YJSJ.js} +1 -1
- package/dist/{chunk-B5CNGEHG.js → chunk-7CV7NFRY.js} +1 -1
- package/dist/{chunk-LZMHPUTE.js → chunk-IVLW66F7.js} +1 -1
- package/dist/{chunk-DXXGEMLA.js → chunk-SPL7HGIZ.js} +1 -1
- package/dist/constants.cjs +1 -1
- package/dist/constants.js +1 -1
- package/dist/eventcatalog.cjs +1 -1
- package/dist/eventcatalog.js +5 -5
- package/dist/generate.cjs +1 -1
- package/dist/generate.js +3 -3
- package/dist/utils/cli-logger.cjs +1 -1
- package/dist/utils/cli-logger.js +2 -2
- package/eventcatalog/integrations/eventcatalog-features.ts +9 -0
- package/eventcatalog/src/content.config.ts +1 -0
- package/eventcatalog/src/enterprise/ai/chat-api.ts +27 -83
- package/eventcatalog/src/enterprise/custom-documentation/pages/docs/custom/index.astro +21 -142
- package/eventcatalog/src/enterprise/mcp/mcp-server.ts +512 -0
- package/eventcatalog/src/enterprise/tools/catalog-tools.ts +690 -0
- package/eventcatalog/src/enterprise/tools/index.ts +5 -0
- package/eventcatalog/src/env.d.ts +11 -0
- package/eventcatalog/src/pages/diagrams/[id]/[version]/embed.astro +433 -10
- package/eventcatalog/src/pages/diagrams/[id]/[version]/index.astro +21 -100
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/index.astro +26 -141
- package/eventcatalog/src/pages/docs/[type]/[id]/[version].mdx.ts +0 -4
- package/eventcatalog/src/types/mcp-modules.d.ts +66 -0
- package/eventcatalog/src/utils/feature.ts +2 -0
- package/eventcatalog/src/utils/mermaid-zoom.ts +751 -0
- package/eventcatalog/tsconfig.json +1 -1
- package/package.json +4 -1
|
@@ -571,162 +571,47 @@ nodeGraphs.push({
|
|
|
571
571
|
</script>
|
|
572
572
|
|
|
573
573
|
<script>
|
|
574
|
-
|
|
574
|
+
import { destroyZoomInstances, renderMermaidWithZoom } from '@utils/mermaid-zoom';
|
|
575
|
+
|
|
576
|
+
// Listen for Astro transitions
|
|
575
577
|
document.addEventListener('astro:page-load', () => {
|
|
578
|
+
destroyZoomInstances();
|
|
576
579
|
const graphs = document.getElementsByClassName('mermaid');
|
|
577
|
-
if (
|
|
578
|
-
|
|
580
|
+
if (graphs.length > 0) {
|
|
581
|
+
renderMermaidWithZoom(graphs, window.eventcatalog?.mermaid);
|
|
579
582
|
}
|
|
580
583
|
});
|
|
581
584
|
|
|
582
|
-
|
|
583
|
-
* Renders mermaid diagrams in the page
|
|
584
|
-
* @param {HTMLCollectionOf<HTMLElement>} graphs - The collection of mermaid graph elements
|
|
585
|
-
*/
|
|
586
|
-
async function renderDiagrams(graphs: any) {
|
|
587
|
-
const { default: mermaid } = await import('mermaid');
|
|
588
|
-
|
|
589
|
-
if (window.eventcatalog.mermaid) {
|
|
590
|
-
const { icons } = await import('@iconify-json/logos');
|
|
591
|
-
const { iconPacks = [], enableSupportForElkLayout = false } = window.eventcatalog.mermaid ?? {};
|
|
592
|
-
|
|
593
|
-
if (iconPacks.length > 0) {
|
|
594
|
-
const iconPacksToRegister = iconPacks.map((name: any) => {
|
|
595
|
-
return {
|
|
596
|
-
name,
|
|
597
|
-
icons,
|
|
598
|
-
};
|
|
599
|
-
});
|
|
600
|
-
|
|
601
|
-
mermaid.registerIconPacks(iconPacksToRegister);
|
|
602
|
-
}
|
|
603
|
-
|
|
604
|
-
if (enableSupportForElkLayout) {
|
|
605
|
-
// @ts-ignore
|
|
606
|
-
const { default: elkLayouts } = await import('@mermaid-js/layout-elk/dist/mermaid-layout-elk.core.mjs');
|
|
607
|
-
mermaid.registerLayoutLoaders(elkLayouts);
|
|
608
|
-
}
|
|
609
|
-
}
|
|
610
|
-
|
|
611
|
-
// Detect current theme from data-theme attribute
|
|
612
|
-
const isDarkMode = document.documentElement.getAttribute('data-theme') === 'dark';
|
|
613
|
-
const currentTheme = isDarkMode ? 'dark' : 'default';
|
|
614
|
-
|
|
615
|
-
// Custom theme variables for better readability in dark mode
|
|
616
|
-
const darkThemeVariables = {
|
|
617
|
-
// Sequence diagram - improve text contrast
|
|
618
|
-
signalColor: '#f0f6fc',
|
|
619
|
-
signalTextColor: '#f0f6fc',
|
|
620
|
-
actorTextColor: '#0d1117',
|
|
621
|
-
actorBkg: '#f0f6fc',
|
|
622
|
-
actorBorder: '#484f58',
|
|
623
|
-
actorLineColor: '#6b7280',
|
|
624
|
-
// General text colors
|
|
625
|
-
primaryTextColor: '#f0f6fc',
|
|
626
|
-
secondaryTextColor: '#c9d1d9',
|
|
627
|
-
tertiaryTextColor: '#f0f6fc',
|
|
628
|
-
// Line colors
|
|
629
|
-
lineColor: '#6b7280',
|
|
630
|
-
};
|
|
631
|
-
|
|
632
|
-
mermaid.initialize({
|
|
633
|
-
// fontSize: 2,
|
|
634
|
-
flowchart: {
|
|
635
|
-
curve: 'linear',
|
|
636
|
-
rankSpacing: 0,
|
|
637
|
-
nodeSpacing: 0,
|
|
638
|
-
},
|
|
639
|
-
startOnLoad: false,
|
|
640
|
-
fontFamily: 'var(--sans-font)',
|
|
641
|
-
// @ts-ignore This works, but TS expects a enum for some reason
|
|
642
|
-
theme: currentTheme,
|
|
643
|
-
themeVariables: isDarkMode ? darkThemeVariables : undefined,
|
|
644
|
-
architecture: {
|
|
645
|
-
useMaxWidth: true,
|
|
646
|
-
},
|
|
647
|
-
});
|
|
648
|
-
|
|
649
|
-
for (const graph of graphs) {
|
|
650
|
-
const content = graph.getAttribute('data-content');
|
|
651
|
-
if (!content) continue;
|
|
652
|
-
let svg = document.createElement('svg');
|
|
653
|
-
const id = (svg.id = 'mermaid-' + Math.round(Math.random() * 100000));
|
|
654
|
-
graph.appendChild(svg);
|
|
655
|
-
mermaid.render(id, content).then((result) => {
|
|
656
|
-
graph.innerHTML = result.svg;
|
|
657
|
-
});
|
|
658
|
-
}
|
|
659
|
-
}
|
|
660
|
-
|
|
585
|
+
// Initial render
|
|
661
586
|
const graphs = document.getElementsByClassName('mermaid');
|
|
662
|
-
if (
|
|
663
|
-
|
|
587
|
+
if (graphs.length > 0) {
|
|
588
|
+
renderMermaidWithZoom(graphs, window.eventcatalog?.mermaid);
|
|
664
589
|
}
|
|
665
590
|
|
|
666
|
-
// Make
|
|
667
|
-
window.renderDiagrams =
|
|
591
|
+
// Make available globally for accordion component
|
|
592
|
+
window.renderDiagrams = (graphs: HTMLCollectionOf<Element>) => {
|
|
593
|
+
renderMermaidWithZoom(graphs, window.eventcatalog?.mermaid);
|
|
594
|
+
};
|
|
668
595
|
</script>
|
|
669
596
|
|
|
670
597
|
<script>
|
|
671
|
-
import
|
|
672
|
-
document.addEventListener('astro:page-load', () => {
|
|
673
|
-
const blocks = document.getElementsByClassName('plantuml');
|
|
674
|
-
if (blocks.length > 0) {
|
|
675
|
-
renderPlantUML(blocks, deflate);
|
|
676
|
-
}
|
|
677
|
-
});
|
|
678
|
-
|
|
679
|
-
function renderPlantUML(blocks: any, deflate: any) {
|
|
680
|
-
for (const block of blocks) {
|
|
681
|
-
const content = block.getAttribute('data-content');
|
|
682
|
-
if (!content) continue;
|
|
683
|
-
|
|
684
|
-
const encoded = encodePlantUML(content, deflate);
|
|
685
|
-
const img = document.createElement('img');
|
|
686
|
-
img.src = `https://www.plantuml.com/plantuml/svg/~1${encoded}`;
|
|
687
|
-
img.alt = 'PlantUML diagram';
|
|
688
|
-
img.loading = 'lazy';
|
|
689
|
-
block.innerHTML = '';
|
|
690
|
-
// Add class to the img
|
|
691
|
-
img.classList.add('mx-auto');
|
|
692
|
-
block.appendChild(img);
|
|
693
|
-
}
|
|
694
|
-
}
|
|
598
|
+
import { renderPlantUMLWithZoom } from '@utils/mermaid-zoom';
|
|
695
599
|
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
600
|
+
function initPlantUML() {
|
|
601
|
+
const blocks = document.getElementsByClassName('plantuml');
|
|
602
|
+
if (blocks.length > 0) {
|
|
603
|
+
renderPlantUMLWithZoom(blocks);
|
|
700
604
|
}
|
|
605
|
+
}
|
|
701
606
|
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
let i = 0;
|
|
706
|
-
while (i < data.length) {
|
|
707
|
-
let b1 = data[i++];
|
|
708
|
-
let b2 = i < data.length ? data[i++] : 0;
|
|
709
|
-
let b3 = i < data.length ? data[i++] : 0;
|
|
710
|
-
|
|
711
|
-
let c1 = b1 >> 2;
|
|
712
|
-
let c2 = ((b1 & 0x3) << 4) | (b2 >> 4);
|
|
713
|
-
let c3 = ((b2 & 0xf) << 2) | (b3 >> 6);
|
|
714
|
-
let c4 = b3 & 0x3f;
|
|
715
|
-
|
|
716
|
-
str += chars[c1] + chars[c2] + chars[c3] + chars[c4];
|
|
717
|
-
}
|
|
718
|
-
return str;
|
|
719
|
-
};
|
|
607
|
+
// Run on initial load and page transitions
|
|
608
|
+
initPlantUML();
|
|
609
|
+
document.addEventListener('astro:page-load', initPlantUML);
|
|
720
610
|
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
window.renderPlantUML = (graphs: any) => {
|
|
727
|
-
renderPlantUML(graphs, deflate);
|
|
728
|
-
};
|
|
729
|
-
});
|
|
611
|
+
// Make available globally for accordion component
|
|
612
|
+
window.renderPlantUML = (blocks: HTMLCollectionOf<Element>) => {
|
|
613
|
+
renderPlantUMLWithZoom(blocks);
|
|
614
|
+
};
|
|
730
615
|
</script>
|
|
731
616
|
<script>
|
|
732
617
|
// @ts-nocheck
|
|
@@ -45,15 +45,11 @@ export async function getStaticPaths() {
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
export const GET: APIRoute = async ({ params, props }) => {
|
|
48
|
-
console.log('props', props);
|
|
49
|
-
|
|
50
48
|
// Just return empty array if LLMs are not enabled
|
|
51
49
|
if (!isLLMSTxtEnabled()) {
|
|
52
50
|
return new Response('llms.txt is not enabled for this Catalog.', { status: 404 });
|
|
53
51
|
}
|
|
54
52
|
|
|
55
|
-
console.log('params', params);
|
|
56
|
-
|
|
57
53
|
if (isSSR()) {
|
|
58
54
|
const { getResourcePath } = utils(process.env.PROJECT_DIR ?? '');
|
|
59
55
|
const filePath = await getResourcePath(process.env.PROJECT_DIR ?? '', params.id ?? '', params.version ?? '');
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type declarations for MCP server dependencies
|
|
3
|
+
* These are used by the enterprise MCP server feature
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
declare module 'hono' {
|
|
7
|
+
export interface Context {
|
|
8
|
+
req: {
|
|
9
|
+
raw: Request;
|
|
10
|
+
};
|
|
11
|
+
json: (data: unknown, status?: number) => Response;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export class Hono {
|
|
15
|
+
constructor();
|
|
16
|
+
basePath(path: string): Hono;
|
|
17
|
+
get(path: string, handler: (c: Context) => Response | Promise<Response>): void;
|
|
18
|
+
post(path: string, handler: (c: Context) => Response | Promise<Response>): void;
|
|
19
|
+
fetch(request: Request): Promise<Response>;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
declare module '@modelcontextprotocol/sdk/server/mcp.js' {
|
|
24
|
+
import { z } from 'zod';
|
|
25
|
+
|
|
26
|
+
export interface ToolConfig {
|
|
27
|
+
description: string;
|
|
28
|
+
inputSchema: z.ZodType<any>;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface ToolResult {
|
|
32
|
+
content: Array<{ type: 'text'; text: string }>;
|
|
33
|
+
isError?: boolean;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface ResourceConfig {
|
|
37
|
+
description: string;
|
|
38
|
+
mimeType: string;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface ResourceResult {
|
|
42
|
+
contents: Array<{
|
|
43
|
+
uri: string;
|
|
44
|
+
text: string;
|
|
45
|
+
mimeType: string;
|
|
46
|
+
}>;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export class McpServer {
|
|
50
|
+
constructor(config: { name: string; version: string });
|
|
51
|
+
registerTool(name: string, config: ToolConfig, handler: (params: any) => Promise<ToolResult>): void;
|
|
52
|
+
registerResource(name: string, uri: string, config: ResourceConfig, handler: (uri: URL) => Promise<ResourceResult>): void;
|
|
53
|
+
connect(transport: any): Promise<void>;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
declare module '@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js' {
|
|
58
|
+
export interface WebStandardStreamableHTTPServerTransportConfig {
|
|
59
|
+
sessionIdGenerator: undefined;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export class WebStandardStreamableHTTPServerTransport {
|
|
63
|
+
constructor(config: WebStandardStreamableHTTPServerTransportConfig);
|
|
64
|
+
handleRequest(request: Request): Promise<Response>;
|
|
65
|
+
}
|
|
66
|
+
}
|