@eventcatalog/core 3.2.2 → 3.3.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-JPKOTGEV.js → chunk-AJ7F2ASU.js} +1 -1
- package/dist/{chunk-34AD2NAO.js → chunk-B5CNGEHG.js} +1 -1
- package/dist/{chunk-7YZYT44Y.js → chunk-DXXGEMLA.js} +1 -1
- package/dist/{chunk-6OFLYNWB.js → chunk-IFELNUKH.js} +1 -1
- package/dist/{chunk-AETVSFIG.js → chunk-LZMHPUTE.js} +1 -1
- package/dist/constants.cjs +1 -1
- package/dist/constants.js +1 -1
- package/dist/eventcatalog.cjs +4 -3
- package/dist/eventcatalog.js +8 -7
- 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/src/components/ChatPanel/ChatPanel.tsx +9 -0
- package/eventcatalog/src/components/ChatPanel/ChatPanelButton.tsx +11 -1
- package/eventcatalog/src/components/CopyAsMarkdown.tsx +47 -28
- package/eventcatalog/src/content.config.ts +20 -0
- package/eventcatalog/src/enterprise/ai/chat-api.ts +24 -2
- package/eventcatalog/src/pages/diagrams/[id]/[version]/_index.data.ts +57 -0
- package/eventcatalog/src/pages/diagrams/[id]/[version]/embed.astro +267 -0
- package/eventcatalog/src/pages/diagrams/[id]/[version]/index.astro +411 -0
- package/eventcatalog/src/pages/diagrams/[id]/[version].mdx.ts +47 -0
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/asyncapi/[filename].astro +24 -1
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/index.astro +1 -0
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/spec/[filename].astro +22 -1
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/spec/_OpenAPI.tsx +28 -4
- package/eventcatalog/src/pages/docs/[type]/[id]/[version].md.ts +3 -2
- package/eventcatalog/src/pages/docs/[type]/[id]/[version].mdx.ts +5 -1
- package/eventcatalog/src/pages/docs/[type]/[id]/language.mdx.ts +2 -1
- package/eventcatalog/src/pages/docs/custom/[...path].mdx.ts +2 -2
- package/eventcatalog/src/pages/docs/teams/[id].md.ts +3 -2
- package/eventcatalog/src/pages/docs/teams/[id].mdx.ts +3 -3
- package/eventcatalog/src/pages/docs/users/[id].md.ts +3 -2
- package/eventcatalog/src/pages/docs/users/[id].mdx.ts +3 -3
- package/eventcatalog/src/stores/sidebar-store/builders/container.ts +20 -4
- package/eventcatalog/src/stores/sidebar-store/builders/domain.ts +20 -12
- package/eventcatalog/src/stores/sidebar-store/builders/flow.ts +1 -1
- package/eventcatalog/src/stores/sidebar-store/builders/message.ts +20 -4
- package/eventcatalog/src/stores/sidebar-store/builders/service.ts +18 -6
- package/eventcatalog/src/stores/sidebar-store/builders/shared.ts +20 -0
- package/eventcatalog/src/stores/sidebar-store/state.ts +34 -6
- package/eventcatalog/src/types/index.ts +4 -2
- package/eventcatalog/src/utils/collections/diagrams.ts +64 -0
- package/eventcatalog/src/utils/collections/util.ts +2 -0
- package/eventcatalog/src/utils/feature.ts +4 -2
- package/eventcatalog/src/utils/page-loaders/page-data-loader.ts +2 -0
- package/package.json +3 -3
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// This file exposes the markdown for diagrams in the URL
|
|
2
|
+
// For example http://localhost:3000/diagrams/target-architecture/1.0.0 loads the Page
|
|
3
|
+
// and http://localhost:3000/diagrams/target-architecture/1.0.0.mdx loads the markdown
|
|
4
|
+
// This is used for LLMs to load the markdown for diagrams (llms.txt)
|
|
5
|
+
|
|
6
|
+
import type { APIRoute } from 'astro';
|
|
7
|
+
import { getCollection } from 'astro:content';
|
|
8
|
+
import fs from 'fs';
|
|
9
|
+
import { isLLMSTxtEnabled, isSSR } from '@utils/feature';
|
|
10
|
+
|
|
11
|
+
const diagrams = await getCollection('diagrams');
|
|
12
|
+
|
|
13
|
+
export async function getStaticPaths() {
|
|
14
|
+
// Just return empty array if LLMs are not enabled
|
|
15
|
+
if (!isLLMSTxtEnabled()) {
|
|
16
|
+
return [];
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return diagrams.map((diagram) => ({
|
|
20
|
+
params: { id: diagram.data.id, version: diagram.data.version },
|
|
21
|
+
props: { content: diagram },
|
|
22
|
+
}));
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export const GET: APIRoute = async ({ params, props }) => {
|
|
26
|
+
// Just return empty array if LLMs are not enabled
|
|
27
|
+
if (!isLLMSTxtEnabled()) {
|
|
28
|
+
return new Response('llms.txt is not enabled for this Catalog.', { status: 404 });
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (isSSR()) {
|
|
32
|
+
// For SSR mode, find the diagram and read its file
|
|
33
|
+
const diagram = diagrams.find((d) => d.data.id === params.id && d.data.version === params.version);
|
|
34
|
+
if (!diagram?.filePath) {
|
|
35
|
+
return new Response('Not found', { status: 404 });
|
|
36
|
+
}
|
|
37
|
+
const file = fs.readFileSync(diagram.filePath, 'utf8');
|
|
38
|
+
return new Response(file, { status: 200 });
|
|
39
|
+
} else {
|
|
40
|
+
if (props?.content?.filePath) {
|
|
41
|
+
const file = fs.readFileSync(props.content.filePath, 'utf8');
|
|
42
|
+
return new Response(file, { status: 200 });
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return new Response('Not found', { status: 404 });
|
|
47
|
+
};
|
|
@@ -9,6 +9,8 @@ import '@asyncapi/react-component/styles/default.min.css';
|
|
|
9
9
|
import js from '@asyncapi/react-component/browser/standalone/without-parser.js?url';
|
|
10
10
|
import { AsyncApiComponentWP, type ConfigInterface } from '@asyncapi/react-component';
|
|
11
11
|
import VerticalSideBarLayout from '@layouts/VerticalSideBarLayout.astro';
|
|
12
|
+
import CopyAsMarkdown from '@components/CopyAsMarkdown';
|
|
13
|
+
import { isEventCatalogChatEnabled } from '@utils/feature';
|
|
12
14
|
import Config from '@utils/eventcatalog-config/catalog';
|
|
13
15
|
import { Page } from './_[filename].data';
|
|
14
16
|
import { getAbsoluteFilePathForAstroFile } from '@utils/files';
|
|
@@ -46,6 +48,10 @@ const renderedComponent = renderToString(component);
|
|
|
46
48
|
// Capitalize the first letter of a string
|
|
47
49
|
const pageTitle = `${collection} | ${data.name} | AsyncApi Spec`.replace(/^\w/, (c) => c.toUpperCase());
|
|
48
50
|
|
|
51
|
+
// Chat configuration
|
|
52
|
+
const chatEnabled = isEventCatalogChatEnabled();
|
|
53
|
+
const chatQuery = `Tell me about the AsyncAPI specification for "${data.name}" (version ${data.version})`;
|
|
54
|
+
|
|
49
55
|
// Index only the latest version
|
|
50
56
|
const pagefindAttributes =
|
|
51
57
|
data.version === data.latestVersion
|
|
@@ -57,13 +63,30 @@ const pagefindAttributes =
|
|
|
57
63
|
---
|
|
58
64
|
|
|
59
65
|
<VerticalSideBarLayout title={pageTitle}>
|
|
60
|
-
<div {...pagefindAttributes}>
|
|
66
|
+
<div {...pagefindAttributes} class="relative">
|
|
61
67
|
{
|
|
62
68
|
// Currently, Pagefind does not index metadata (such as the title),
|
|
63
69
|
// so we need to ensure it is included as text on the page.
|
|
64
70
|
// https://github.com/CloudCannon/pagefind/issues/437
|
|
65
71
|
}
|
|
66
72
|
<h2 class="hidden">{pageTitle}</h2>
|
|
73
|
+
{
|
|
74
|
+
chatEnabled && (
|
|
75
|
+
<div class="absolute top-3 right-4 z-10">
|
|
76
|
+
<CopyAsMarkdown
|
|
77
|
+
client:only="react"
|
|
78
|
+
schemas={[]}
|
|
79
|
+
chatQuery={chatQuery}
|
|
80
|
+
chatEnabled={chatEnabled}
|
|
81
|
+
editUrl=""
|
|
82
|
+
markdownDownloadEnabled={false}
|
|
83
|
+
rssFeedEnabled={false}
|
|
84
|
+
preferChatAsDefault={true}
|
|
85
|
+
chatButtonText="Ask about this specification"
|
|
86
|
+
/>
|
|
87
|
+
</div>
|
|
88
|
+
)
|
|
89
|
+
}
|
|
67
90
|
<div id="asyncapi" class="md:pr-14" set:html={renderedComponent} />
|
|
68
91
|
</div>
|
|
69
92
|
</VerticalSideBarLayout>
|
|
@@ -4,6 +4,8 @@ import OpenAPISpec from './_OpenAPI.tsx';
|
|
|
4
4
|
|
|
5
5
|
import { DocumentMinusIcon } from '@heroicons/react/24/outline';
|
|
6
6
|
import VerticalSideBarLayout from '@layouts/VerticalSideBarLayout.astro';
|
|
7
|
+
import CopyAsMarkdown from '@components/CopyAsMarkdown';
|
|
8
|
+
import { isEventCatalogChatEnabled } from '@utils/feature';
|
|
7
9
|
import './_styles.css';
|
|
8
10
|
import { Page } from './_[filename].data.ts';
|
|
9
11
|
import { getAbsoluteFilePathForAstroFile } from '@utils/files';
|
|
@@ -27,6 +29,10 @@ let content = '';
|
|
|
27
29
|
// Capitalize the first letter of a string
|
|
28
30
|
const pageTitle = `${collection} | ${data.name} | OpenAPI Spec`.replace(/^\w/, (c) => c.toUpperCase());
|
|
29
31
|
|
|
32
|
+
// Chat configuration
|
|
33
|
+
const chatEnabled = isEventCatalogChatEnabled();
|
|
34
|
+
const chatQuery = `Tell me about the OpenAPI specification for "${data.name}" (version ${data.version})`;
|
|
35
|
+
|
|
30
36
|
// Index only the latest version
|
|
31
37
|
const pagefindAttributes =
|
|
32
38
|
data.version === data.latestVersion
|
|
@@ -57,13 +63,28 @@ if (isRemote) {
|
|
|
57
63
|
</p>
|
|
58
64
|
</div>
|
|
59
65
|
) : (
|
|
60
|
-
<div {...pagefindAttributes}>
|
|
66
|
+
<div {...pagefindAttributes} class="relative">
|
|
61
67
|
{
|
|
62
68
|
// Currently, Pagefind does not index metadata (such as the title),
|
|
63
69
|
// so we need to ensure it is included as text on the page.
|
|
64
70
|
// https://github.com/CloudCannon/pagefind/issues/437
|
|
65
71
|
}
|
|
66
72
|
<h2 class="hidden">{pageTitle}</h2>
|
|
73
|
+
{chatEnabled && (
|
|
74
|
+
<div class="absolute top-3 right-14 z-10">
|
|
75
|
+
<CopyAsMarkdown
|
|
76
|
+
client:only="react"
|
|
77
|
+
schemas={[]}
|
|
78
|
+
chatQuery={chatQuery}
|
|
79
|
+
chatEnabled={chatEnabled}
|
|
80
|
+
editUrl=""
|
|
81
|
+
markdownDownloadEnabled={false}
|
|
82
|
+
rssFeedEnabled={false}
|
|
83
|
+
preferChatAsDefault={true}
|
|
84
|
+
chatButtonText="Ask about this specification"
|
|
85
|
+
/>
|
|
86
|
+
</div>
|
|
87
|
+
)}
|
|
67
88
|
<OpenAPISpec client:only="react" spec={content} />
|
|
68
89
|
</div>
|
|
69
90
|
)
|
|
@@ -1,13 +1,38 @@
|
|
|
1
|
-
import { useState } from 'react';
|
|
1
|
+
import { useState, useEffect } from 'react';
|
|
2
2
|
import { ApiReferenceReact } from '@scalar/api-reference-react';
|
|
3
3
|
import '@scalar/api-reference-react/style.css';
|
|
4
4
|
import './_styles.css';
|
|
5
|
+
|
|
5
6
|
const OpenAPISpec = ({ spec }: { spec: string }) => {
|
|
6
7
|
const [loaded, setLoaded] = useState(false);
|
|
8
|
+
const [isDarkMode, setIsDarkMode] = useState(() => {
|
|
9
|
+
return document.documentElement.getAttribute('data-theme') === 'dark';
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
// Watch for theme changes
|
|
14
|
+
const observer = new MutationObserver((mutations) => {
|
|
15
|
+
mutations.forEach((mutation) => {
|
|
16
|
+
if (mutation.attributeName === 'data-theme') {
|
|
17
|
+
const theme = document.documentElement.getAttribute('data-theme');
|
|
18
|
+
setIsDarkMode(theme === 'dark');
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
observer.observe(document.documentElement, {
|
|
24
|
+
attributes: true,
|
|
25
|
+
attributeFilter: ['data-theme'],
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
return () => observer.disconnect();
|
|
29
|
+
}, []);
|
|
30
|
+
|
|
7
31
|
return (
|
|
8
32
|
<div>
|
|
9
33
|
{!loaded && <div>Loading...</div>}
|
|
10
34
|
<ApiReferenceReact
|
|
35
|
+
key={isDarkMode ? 'dark' : 'light'}
|
|
11
36
|
configuration={{
|
|
12
37
|
spec: {
|
|
13
38
|
content: spec,
|
|
@@ -17,13 +42,12 @@ const OpenAPISpec = ({ spec }: { spec: string }) => {
|
|
|
17
42
|
onLoaded: () => {
|
|
18
43
|
setLoaded(true);
|
|
19
44
|
},
|
|
20
|
-
forceDarkModeState: 'light',
|
|
21
|
-
darkMode:
|
|
45
|
+
forceDarkModeState: isDarkMode ? 'dark' : 'light',
|
|
46
|
+
darkMode: isDarkMode,
|
|
22
47
|
defaultOpenAllTags: true,
|
|
23
48
|
hideDarkModeToggle: true,
|
|
24
49
|
searchHotKey: 'p',
|
|
25
50
|
showSidebar: true,
|
|
26
|
-
customCss: 'bg-red-500',
|
|
27
51
|
}}
|
|
28
52
|
/>
|
|
29
53
|
</div>
|
|
@@ -7,6 +7,7 @@ import { getCollection } from 'astro:content';
|
|
|
7
7
|
import { getEntities } from '@utils/collections/entities';
|
|
8
8
|
import config from '@config';
|
|
9
9
|
import fs from 'fs';
|
|
10
|
+
import { isLLMSTxtEnabled } from '@utils/feature';
|
|
10
11
|
|
|
11
12
|
const events = await getCollection('events');
|
|
12
13
|
const commands = await getCollection('commands');
|
|
@@ -19,7 +20,7 @@ const containers = await getCollection('containers');
|
|
|
19
20
|
const entities = await getEntities();
|
|
20
21
|
export async function getStaticPaths() {
|
|
21
22
|
// Just return empty array if LLMs are not enabled
|
|
22
|
-
if (!
|
|
23
|
+
if (!isLLMSTxtEnabled()) {
|
|
23
24
|
return [];
|
|
24
25
|
}
|
|
25
26
|
|
|
@@ -46,7 +47,7 @@ export async function getStaticPaths() {
|
|
|
46
47
|
|
|
47
48
|
export const GET: APIRoute = async ({ params, props }) => {
|
|
48
49
|
// Just return empty array if LLMs are not enabled
|
|
49
|
-
if (!
|
|
50
|
+
if (!isLLMSTxtEnabled()) {
|
|
50
51
|
return new Response('llms.txt is not enabled for this Catalog.', { status: 404 });
|
|
51
52
|
}
|
|
52
53
|
|
|
@@ -21,7 +21,7 @@ import utils from '@eventcatalog/sdk';
|
|
|
21
21
|
|
|
22
22
|
export async function getStaticPaths() {
|
|
23
23
|
// Just return empty array if LLMs are not enabled
|
|
24
|
-
if (!
|
|
24
|
+
if (!isLLMSTxtEnabled()) {
|
|
25
25
|
return [];
|
|
26
26
|
}
|
|
27
27
|
const collections = {
|
|
@@ -45,11 +45,15 @@ export async function getStaticPaths() {
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
export const GET: APIRoute = async ({ params, props }) => {
|
|
48
|
+
console.log('props', props);
|
|
49
|
+
|
|
48
50
|
// Just return empty array if LLMs are not enabled
|
|
49
51
|
if (!isLLMSTxtEnabled()) {
|
|
50
52
|
return new Response('llms.txt is not enabled for this Catalog.', { status: 404 });
|
|
51
53
|
}
|
|
52
54
|
|
|
55
|
+
console.log('params', params);
|
|
56
|
+
|
|
53
57
|
if (isSSR()) {
|
|
54
58
|
const { getResourcePath } = utils(process.env.PROJECT_DIR ?? '');
|
|
55
59
|
const filePath = await getResourcePath(process.env.PROJECT_DIR ?? '', params.id ?? '', params.version ?? '');
|
|
@@ -3,6 +3,7 @@ import type { CollectionEntry } from 'astro:content';
|
|
|
3
3
|
import type { APIRoute } from 'astro';
|
|
4
4
|
import config from '@config';
|
|
5
5
|
import fs from 'fs';
|
|
6
|
+
import { isLLMSTxtEnabled } from '@utils/feature';
|
|
6
7
|
|
|
7
8
|
export async function getStaticPaths() {
|
|
8
9
|
const domains = await getDomains({ getAllVersions: false });
|
|
@@ -25,7 +26,7 @@ export async function getStaticPaths() {
|
|
|
25
26
|
|
|
26
27
|
export const GET: APIRoute = async ({ params, props }) => {
|
|
27
28
|
// Just return empty array if LLMs are not enabled
|
|
28
|
-
if (!
|
|
29
|
+
if (!isLLMSTxtEnabled()) {
|
|
29
30
|
return new Response('llms.txt is not enabled for this Catalog.', { status: 404 });
|
|
30
31
|
}
|
|
31
32
|
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
import type { APIRoute, GetStaticPaths } from 'astro';
|
|
6
6
|
import { getCollection } from 'astro:content';
|
|
7
|
-
import config from '@config';
|
|
8
7
|
import fs from 'fs';
|
|
8
|
+
import { isLLMSTxtEnabled } from '@utils/feature';
|
|
9
9
|
|
|
10
10
|
export const getStaticPaths = (async () => {
|
|
11
11
|
const docs = await getCollection('customPages');
|
|
@@ -19,7 +19,7 @@ export const getStaticPaths = (async () => {
|
|
|
19
19
|
|
|
20
20
|
export const GET: APIRoute = async ({ params, props }) => {
|
|
21
21
|
// Just return empty array if LLMs are not enabled
|
|
22
|
-
if (!
|
|
22
|
+
if (!isLLMSTxtEnabled()) {
|
|
23
23
|
return new Response('llms.txt is not enabled for this Catalog.', { status: 404 });
|
|
24
24
|
}
|
|
25
25
|
|
|
@@ -6,12 +6,13 @@ import type { APIRoute } from 'astro';
|
|
|
6
6
|
import { getCollection } from 'astro:content';
|
|
7
7
|
import config from '@config';
|
|
8
8
|
import fs from 'fs';
|
|
9
|
+
import { isLLMSTxtEnabled } from '@utils/feature';
|
|
9
10
|
|
|
10
11
|
const teams = await getCollection('teams');
|
|
11
12
|
|
|
12
13
|
export async function getStaticPaths() {
|
|
13
14
|
// Just return empty array if LLMs are not enabled
|
|
14
|
-
if (!
|
|
15
|
+
if (!isLLMSTxtEnabled()) {
|
|
15
16
|
return [];
|
|
16
17
|
}
|
|
17
18
|
|
|
@@ -23,7 +24,7 @@ export async function getStaticPaths() {
|
|
|
23
24
|
|
|
24
25
|
export const GET: APIRoute = async ({ params, props }) => {
|
|
25
26
|
// Just return empty array if LLMs are not enabled
|
|
26
|
-
if (!
|
|
27
|
+
if (!isLLMSTxtEnabled()) {
|
|
27
28
|
return new Response('llms.txt is not enabled for this Catalog.', { status: 404 });
|
|
28
29
|
}
|
|
29
30
|
|
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
|
|
5
5
|
import type { APIRoute } from 'astro';
|
|
6
6
|
import { getCollection } from 'astro:content';
|
|
7
|
-
import
|
|
7
|
+
import { isLLMSTxtEnabled } from '@utils/feature';
|
|
8
8
|
import fs from 'fs';
|
|
9
9
|
|
|
10
10
|
const teams = await getCollection('teams');
|
|
11
11
|
|
|
12
12
|
export async function getStaticPaths() {
|
|
13
13
|
// Just return empty array if LLMs are not enabled
|
|
14
|
-
if (!
|
|
14
|
+
if (!isLLMSTxtEnabled()) {
|
|
15
15
|
return [];
|
|
16
16
|
}
|
|
17
17
|
|
|
@@ -23,7 +23,7 @@ export async function getStaticPaths() {
|
|
|
23
23
|
|
|
24
24
|
export const GET: APIRoute = async ({ params, props }) => {
|
|
25
25
|
// Just return empty array if LLMs are not enabled
|
|
26
|
-
if (!
|
|
26
|
+
if (!isLLMSTxtEnabled()) {
|
|
27
27
|
return new Response('llms.txt is not enabled for this Catalog.', { status: 404 });
|
|
28
28
|
}
|
|
29
29
|
|
|
@@ -6,12 +6,13 @@ import type { APIRoute } from 'astro';
|
|
|
6
6
|
import { getCollection } from 'astro:content';
|
|
7
7
|
import config from '@config';
|
|
8
8
|
import fs from 'fs';
|
|
9
|
+
import { isLLMSTxtEnabled } from '@utils/feature';
|
|
9
10
|
|
|
10
11
|
const users = await getCollection('users');
|
|
11
12
|
|
|
12
13
|
export async function getStaticPaths() {
|
|
13
14
|
// Just return empty array if LLMs are not enabled
|
|
14
|
-
if (!
|
|
15
|
+
if (!isLLMSTxtEnabled()) {
|
|
15
16
|
return [];
|
|
16
17
|
}
|
|
17
18
|
|
|
@@ -23,7 +24,7 @@ export async function getStaticPaths() {
|
|
|
23
24
|
|
|
24
25
|
export const GET: APIRoute = async ({ params, props }) => {
|
|
25
26
|
// Just return empty array if LLMs are not enabled
|
|
26
|
-
if (!
|
|
27
|
+
if (!isLLMSTxtEnabled()) {
|
|
27
28
|
return new Response('llms.txt is not enabled for this Catalog.', { status: 404 });
|
|
28
29
|
}
|
|
29
30
|
|
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
|
|
5
5
|
import type { APIRoute } from 'astro';
|
|
6
6
|
import { getCollection } from 'astro:content';
|
|
7
|
-
import
|
|
7
|
+
import { isLLMSTxtEnabled } from '@utils/feature';
|
|
8
8
|
import fs from 'fs';
|
|
9
9
|
|
|
10
10
|
const users = await getCollection('users');
|
|
11
11
|
|
|
12
12
|
export async function getStaticPaths() {
|
|
13
13
|
// Just return empty array if LLMs are not enabled
|
|
14
|
-
if (!
|
|
14
|
+
if (!isLLMSTxtEnabled()) {
|
|
15
15
|
return [];
|
|
16
16
|
}
|
|
17
17
|
|
|
@@ -23,7 +23,7 @@ export async function getStaticPaths() {
|
|
|
23
23
|
|
|
24
24
|
export const GET: APIRoute = async ({ params, props }) => {
|
|
25
25
|
// Just return empty array if LLMs are not enabled
|
|
26
|
-
if (!
|
|
26
|
+
if (!isLLMSTxtEnabled()) {
|
|
27
27
|
return new Response('llms.txt is not enabled for this Catalog.', { status: 404 });
|
|
28
28
|
}
|
|
29
29
|
|
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
import type { CollectionEntry } from 'astro:content';
|
|
2
2
|
import { buildUrl } from '@utils/url-builder';
|
|
3
|
-
import type { NavNode, ChildRef } from './shared';
|
|
3
|
+
import type { NavNode, ChildRef, ResourceGroupContext } from './shared';
|
|
4
4
|
import {
|
|
5
5
|
buildQuickReferenceSection,
|
|
6
6
|
buildOwnersSection,
|
|
7
7
|
shouldRenderSideBarSection,
|
|
8
8
|
buildRepositorySection,
|
|
9
9
|
buildAttachmentsSection,
|
|
10
|
+
buildDiagramNavItems,
|
|
10
11
|
} from './shared';
|
|
11
12
|
import { isVisualiserEnabled } from '@utils/feature';
|
|
12
13
|
|
|
13
|
-
export const buildContainerNode = (
|
|
14
|
+
export const buildContainerNode = (
|
|
15
|
+
container: CollectionEntry<'containers'>,
|
|
16
|
+
owners: any[],
|
|
17
|
+
context: ResourceGroupContext
|
|
18
|
+
): NavNode => {
|
|
14
19
|
const servicesWritingToContainer = container.data.servicesThatWriteToContainer || [];
|
|
15
20
|
const servicesReadingFromContainer = container.data.servicesThatReadFromContainer || [];
|
|
16
21
|
|
|
@@ -27,6 +32,11 @@ export const buildContainerNode = (container: CollectionEntry<'containers'>, own
|
|
|
27
32
|
|
|
28
33
|
const renderRepository = container.data.repository && shouldRenderSideBarSection(container, 'repository');
|
|
29
34
|
|
|
35
|
+
// Diagrams
|
|
36
|
+
const containerDiagrams = container.data.diagrams || [];
|
|
37
|
+
const diagramNavItems = buildDiagramNavItems(containerDiagrams, context.diagrams);
|
|
38
|
+
const hasDiagrams = diagramNavItems.length > 0;
|
|
39
|
+
|
|
30
40
|
return {
|
|
31
41
|
type: 'item',
|
|
32
42
|
title: container.data.name,
|
|
@@ -41,16 +51,22 @@ export const buildContainerNode = (container: CollectionEntry<'containers'>, own
|
|
|
41
51
|
]),
|
|
42
52
|
renderVisualiser && {
|
|
43
53
|
type: 'group',
|
|
44
|
-
title: 'Architecture
|
|
54
|
+
title: 'Architecture',
|
|
45
55
|
icon: 'Workflow',
|
|
46
56
|
pages: [
|
|
47
57
|
{
|
|
48
58
|
type: 'item',
|
|
49
|
-
title: '
|
|
59
|
+
title: 'Map',
|
|
50
60
|
href: buildUrl(`/visualiser/containers/${container.data.id}/${container.data.version}`),
|
|
51
61
|
},
|
|
52
62
|
],
|
|
53
63
|
},
|
|
64
|
+
hasDiagrams && {
|
|
65
|
+
type: 'group',
|
|
66
|
+
title: 'Diagrams',
|
|
67
|
+
icon: 'FileImage',
|
|
68
|
+
pages: diagramNavItems,
|
|
69
|
+
},
|
|
54
70
|
renderServicesWritingToContainer && {
|
|
55
71
|
type: 'group',
|
|
56
72
|
title: 'Services (Writes)',
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
shouldRenderSideBarSection,
|
|
9
9
|
buildRepositorySection,
|
|
10
10
|
buildAttachmentsSection,
|
|
11
|
+
buildDiagramNavItems,
|
|
11
12
|
} from './shared';
|
|
12
13
|
import { isVisualiserEnabled } from '@utils/feature';
|
|
13
14
|
|
|
@@ -35,6 +36,12 @@ export const buildDomainNode = (domain: CollectionEntry<'domains'>, owners: any[
|
|
|
35
36
|
const hasAttachments = domain.data.attachments && domain.data.attachments.length > 0;
|
|
36
37
|
|
|
37
38
|
const renderRepository = domain.data.repository && shouldRenderSideBarSection(domain, 'repository');
|
|
39
|
+
|
|
40
|
+
// Diagrams
|
|
41
|
+
const domainDiagrams = domain.data.diagrams || [];
|
|
42
|
+
const diagramNavItems = buildDiagramNavItems(domainDiagrams, context.diagrams);
|
|
43
|
+
const hasDiagrams = diagramNavItems.length > 0;
|
|
44
|
+
|
|
38
45
|
return {
|
|
39
46
|
type: 'item',
|
|
40
47
|
title: domain.data.name,
|
|
@@ -47,32 +54,33 @@ export const buildDomainNode = (domain: CollectionEntry<'domains'>, owners: any[
|
|
|
47
54
|
]),
|
|
48
55
|
{
|
|
49
56
|
type: 'group',
|
|
50
|
-
title: 'Architecture
|
|
57
|
+
title: 'Architecture',
|
|
51
58
|
icon: 'Workflow',
|
|
52
59
|
pages: [
|
|
53
60
|
{
|
|
54
61
|
type: 'item',
|
|
55
|
-
title: '
|
|
62
|
+
title: 'Overview',
|
|
56
63
|
href: buildUrl(`/architecture/domains/${domain.data.id}/${domain.data.version}`),
|
|
57
64
|
},
|
|
65
|
+
renderVisualiser && {
|
|
66
|
+
type: 'item',
|
|
67
|
+
title: 'Map',
|
|
68
|
+
href: buildUrl(`/visualiser/domains/${domain.data.id}/${domain.data.version}`),
|
|
69
|
+
},
|
|
58
70
|
renderEntities &&
|
|
59
71
|
renderVisualiser && {
|
|
60
72
|
type: 'item',
|
|
61
73
|
title: 'Entity Map',
|
|
62
74
|
href: buildUrl(`/visualiser/domains/${domain.data.id}/${domain.data.version}/entity-map`),
|
|
63
75
|
},
|
|
64
|
-
renderVisualiser && {
|
|
65
|
-
type: 'item',
|
|
66
|
-
title: 'Interaction Map',
|
|
67
|
-
href: buildUrl(`/visualiser/domains/${domain.data.id}/${domain.data.version}`),
|
|
68
|
-
},
|
|
69
|
-
renderVisualiser && {
|
|
70
|
-
type: 'item',
|
|
71
|
-
title: 'Global Domain Map',
|
|
72
|
-
href: buildUrl(`/visualiser/domain-integrations`),
|
|
73
|
-
},
|
|
74
76
|
].filter(Boolean) as ChildRef[],
|
|
75
77
|
},
|
|
78
|
+
hasDiagrams && {
|
|
79
|
+
type: 'group',
|
|
80
|
+
title: 'Diagrams',
|
|
81
|
+
icon: 'FileImage',
|
|
82
|
+
pages: diagramNavItems,
|
|
83
|
+
},
|
|
76
84
|
renderSubDomains && {
|
|
77
85
|
type: 'group',
|
|
78
86
|
title: 'Subdomains',
|
|
@@ -14,7 +14,7 @@ export const buildFlowNode = (flow: CollectionEntry<'flows'>): NavNode => {
|
|
|
14
14
|
buildQuickReferenceSection([{ title: 'Overview', href: buildUrl(`/docs/flows/${flow.data.id}/${flow.data.version}`) }]),
|
|
15
15
|
{
|
|
16
16
|
type: 'group',
|
|
17
|
-
title: 'Architecture
|
|
17
|
+
title: 'Architecture',
|
|
18
18
|
icon: 'Workflow',
|
|
19
19
|
pages: [
|
|
20
20
|
{
|
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
import type { CollectionEntry } from 'astro:content';
|
|
2
2
|
import { buildUrl } from '@utils/url-builder';
|
|
3
3
|
import { getSchemaFormatFromURL } from '@utils/collections/schemas';
|
|
4
|
-
import type { NavNode, ChildRef } from './shared';
|
|
4
|
+
import type { NavNode, ChildRef, ResourceGroupContext } from './shared';
|
|
5
5
|
import {
|
|
6
6
|
buildQuickReferenceSection,
|
|
7
7
|
buildOwnersSection,
|
|
8
8
|
shouldRenderSideBarSection,
|
|
9
9
|
buildRepositorySection,
|
|
10
10
|
buildAttachmentsSection,
|
|
11
|
+
buildDiagramNavItems,
|
|
11
12
|
} from './shared';
|
|
12
13
|
import { isVisualiserEnabled } from '@utils/feature';
|
|
13
14
|
|
|
14
|
-
export const buildMessageNode = (
|
|
15
|
+
export const buildMessageNode = (
|
|
16
|
+
message: CollectionEntry<'events' | 'commands' | 'queries'>,
|
|
17
|
+
owners: any[],
|
|
18
|
+
context: ResourceGroupContext
|
|
19
|
+
): NavNode => {
|
|
15
20
|
const producers = message.data.producers || [];
|
|
16
21
|
const consumers = message.data.consumers || [];
|
|
17
22
|
const collection = message.collection;
|
|
@@ -35,6 +40,11 @@ export const buildMessageNode = (message: CollectionEntry<'events' | 'commands'
|
|
|
35
40
|
|
|
36
41
|
const renderOwners = owners.length > 0 && shouldRenderSideBarSection(message, 'owners');
|
|
37
42
|
|
|
43
|
+
// Diagrams
|
|
44
|
+
const messageDiagrams = message.data.diagrams || [];
|
|
45
|
+
const diagramNavItems = buildDiagramNavItems(messageDiagrams, context.diagrams);
|
|
46
|
+
const hasDiagrams = diagramNavItems.length > 0;
|
|
47
|
+
|
|
38
48
|
return {
|
|
39
49
|
type: 'item',
|
|
40
50
|
title: message.data.name,
|
|
@@ -49,16 +59,22 @@ export const buildMessageNode = (message: CollectionEntry<'events' | 'commands'
|
|
|
49
59
|
]),
|
|
50
60
|
renderVisualiser && {
|
|
51
61
|
type: 'group',
|
|
52
|
-
title: 'Architecture
|
|
62
|
+
title: 'Architecture',
|
|
53
63
|
icon: 'Workflow',
|
|
54
64
|
pages: [
|
|
55
65
|
{
|
|
56
66
|
type: 'item',
|
|
57
|
-
title: '
|
|
67
|
+
title: 'Map',
|
|
58
68
|
href: buildUrl(`/visualiser/${collection}/${message.data.id}/${message.data.version}`),
|
|
59
69
|
},
|
|
60
70
|
],
|
|
61
71
|
},
|
|
72
|
+
hasDiagrams && {
|
|
73
|
+
type: 'group',
|
|
74
|
+
title: 'Diagrams',
|
|
75
|
+
icon: 'FileImage',
|
|
76
|
+
pages: diagramNavItems,
|
|
77
|
+
},
|
|
62
78
|
hasSchema && {
|
|
63
79
|
type: 'group',
|
|
64
80
|
title: `API & Contracts`,
|