@eventcatalog/core 2.21.5 → 2.23.0
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-FZHOYLWJ.js → chunk-CLNIEHVG.js} +1 -1
- package/dist/{chunk-UYXIOPEC.js → chunk-F55C3RGO.js} +1 -1
- package/dist/{chunk-XLSTKMWD.js → chunk-WNRZ5O5C.js} +1 -1
- package/dist/constants.cjs +1 -1
- package/dist/constants.js +1 -1
- package/dist/eventcatalog.cjs +1 -1
- package/dist/eventcatalog.config.d.cts +7 -0
- package/dist/eventcatalog.config.d.ts +7 -0
- package/dist/eventcatalog.js +3 -3
- package/eventcatalog/src/components/SideNav/CatalogResourcesSideBar/getCatalogResources.ts +65 -0
- package/eventcatalog/src/components/{SideBars → SideNav}/CatalogResourcesSideBar/index.tsx +1 -1
- package/eventcatalog/src/components/SideNav/SideNav.astro +31 -0
- package/eventcatalog/src/components/SideNav/TreeView/getTreeView.ts +189 -0
- package/eventcatalog/src/components/SideNav/TreeView/index.tsx +94 -0
- package/eventcatalog/src/components/TreeView/index.tsx +328 -0
- package/eventcatalog/src/components/TreeView/styles.module.css +264 -0
- package/eventcatalog/src/components/TreeView/useSlots.ts +95 -0
- package/eventcatalog/src/content/config.ts +2 -0
- package/eventcatalog/src/layouts/VerticalSideBarLayout.astro +5 -51
- package/eventcatalog/src/pages/docs/[type]/[id]/[version].md.ts +55 -0
- package/eventcatalog/src/pages/docs/llm/llms-full.txt.ts +31 -0
- package/eventcatalog/src/pages/docs/llm/llms.txt.ts +47 -0
- package/eventcatalog/src/pages/docs/teams/[id].md.ts +40 -0
- package/eventcatalog/src/pages/docs/users/[id].md.ts +36 -0
- package/package.json +1 -1
- /package/eventcatalog/src/components/{SideBars → SideNav}/CatalogResourcesSideBar/styles.css +0 -0
|
@@ -8,6 +8,7 @@ interface Props {
|
|
|
8
8
|
import { BookOpenText, Workflow, TableProperties, House, BookUser } from 'lucide-react';
|
|
9
9
|
import Header from '../components/Header.astro';
|
|
10
10
|
import SEO from '../components/Seo.astro';
|
|
11
|
+
import SideNav from '../components/SideNav/SideNav.astro';
|
|
11
12
|
|
|
12
13
|
import { getCommands } from '@utils/commands';
|
|
13
14
|
import { getDomains } from '@utils/collections/domains';
|
|
@@ -17,8 +18,6 @@ import { getFlows } from '@utils/collections/flows';
|
|
|
17
18
|
import { isCollectionVisibleInCatalog } from '@eventcatalog';
|
|
18
19
|
import { buildUrl } from '@utils/url-builder';
|
|
19
20
|
import { getQueries } from '@utils/queries';
|
|
20
|
-
import { getChannels } from '@utils/channels';
|
|
21
|
-
import CatalogResourcesSideBar from '@components/SideBars/CatalogResourcesSideBar';
|
|
22
21
|
import { hasLandingPageForDocs } from '@utils/pages';
|
|
23
22
|
|
|
24
23
|
const events = await getEvents({ getAllVersions: false });
|
|
@@ -26,14 +25,8 @@ const commands = await getCommands({ getAllVersions: false });
|
|
|
26
25
|
const queries = await getQueries({ getAllVersions: false });
|
|
27
26
|
const services = await getServices({ getAllVersions: false });
|
|
28
27
|
const domains = await getDomains({ getAllVersions: false });
|
|
29
|
-
const channels = await getChannels({ getAllVersions: false });
|
|
30
28
|
const flows = await getFlows({ getAllVersions: false });
|
|
31
29
|
|
|
32
|
-
const messages = [...events, ...commands, ...queries];
|
|
33
|
-
|
|
34
|
-
// @ts-ignore for large catalogs https://github.com/event-catalog/eventcatalog/issues/552
|
|
35
|
-
const allData = [...domains, ...services, ...messages, ...channels, ...flows];
|
|
36
|
-
|
|
37
30
|
const currentPath = Astro.url.pathname;
|
|
38
31
|
|
|
39
32
|
const catalogHasDefaultLandingPageForDocs = await hasLandingPageForDocs();
|
|
@@ -101,45 +94,8 @@ const navigationItems = [
|
|
|
101
94
|
},
|
|
102
95
|
];
|
|
103
96
|
|
|
104
|
-
const allDataAsSideNav = allData.reduce((acc, item) => {
|
|
105
|
-
const title = item.collection;
|
|
106
|
-
const group = acc[title] || [];
|
|
107
|
-
const currentPath = Astro.url.pathname;
|
|
108
|
-
const route = currentPath.includes('visualiser') ? 'visualiser' : 'docs';
|
|
109
|
-
|
|
110
|
-
const navigationItem = {
|
|
111
|
-
label: item.data.name,
|
|
112
|
-
version: item.data.version,
|
|
113
|
-
visible: isCollectionVisibleInCatalog(item.collection),
|
|
114
|
-
// @ts-ignore
|
|
115
|
-
href: item.data.version
|
|
116
|
-
? // @ts-ignore
|
|
117
|
-
buildUrl(`/${route}/${item.collection}/${item.data.id}/${item.data.version}`)
|
|
118
|
-
: buildUrl(`/${route}/${item.collection}/${item.data.id}`),
|
|
119
|
-
collection: item.collection,
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
group.push(navigationItem);
|
|
123
|
-
|
|
124
|
-
return {
|
|
125
|
-
...acc,
|
|
126
|
-
[title]: group,
|
|
127
|
-
};
|
|
128
|
-
}, {} as any);
|
|
129
|
-
|
|
130
|
-
const sideNav = {
|
|
131
|
-
...(currentPath.includes('visualiser')
|
|
132
|
-
? {
|
|
133
|
-
'bounded context map': [
|
|
134
|
-
{ label: 'Domain map', href: buildUrl('/visualiser/context-map'), collection: 'bounded-context-map' },
|
|
135
|
-
],
|
|
136
|
-
}
|
|
137
|
-
: {}),
|
|
138
|
-
...allDataAsSideNav,
|
|
139
|
-
};
|
|
140
|
-
|
|
141
97
|
const currentNavigationItem = navigationItems.find((item) => item.current);
|
|
142
|
-
const { title, description
|
|
98
|
+
const { title, description } = Astro.props;
|
|
143
99
|
|
|
144
100
|
const showSideBarOnLoad = currentNavigationItem?.sidebar;
|
|
145
101
|
|
|
@@ -198,12 +154,10 @@ const canPageBeEmbedded = process.env.ENABLE_EMBED === 'true';
|
|
|
198
154
|
</nav>
|
|
199
155
|
</div>
|
|
200
156
|
|
|
201
|
-
<
|
|
157
|
+
<SideNav
|
|
202
158
|
id="sidebar"
|
|
203
|
-
class={`sidebar-transition h-content
|
|
204
|
-
|
|
205
|
-
<CatalogResourcesSideBar resources={sideNav} currentPath={currentPath} client:load />
|
|
206
|
-
</div>
|
|
159
|
+
class={`sidebar-transition h-content overflow-y-auto bg-white border-r border-gray-100 w-60 ml-16 ${showSideBarOnLoad ? 'block' : 'hidden'}`}
|
|
160
|
+
/>
|
|
207
161
|
</aside>
|
|
208
162
|
<main
|
|
209
163
|
class={`sidebar-transition w-full max-h-content overflow-y-auto ${showSideBarOnLoad ? 'ml-0' : 'ml-16'}`}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// This file exposes the markdown for EventCatalog in the Url
|
|
2
|
+
// For example http://localhost:3000/docs/events/OrderAmended/0.0.1 loads the Page and http://localhost:3000/docs/events/OrderAmended/0.0.1.md loads the markdown
|
|
3
|
+
// This is used for the LLMs to load the markdown for the given item (llms.txt);
|
|
4
|
+
|
|
5
|
+
import type { APIRoute } from 'astro';
|
|
6
|
+
import { getCollection } from 'astro:content';
|
|
7
|
+
import config from '@config';
|
|
8
|
+
import fs from 'fs';
|
|
9
|
+
|
|
10
|
+
const events = await getCollection('events');
|
|
11
|
+
const commands = await getCollection('commands');
|
|
12
|
+
const queries = await getCollection('queries');
|
|
13
|
+
const services = await getCollection('services');
|
|
14
|
+
const domains = await getCollection('domains');
|
|
15
|
+
const flows = await getCollection('flows');
|
|
16
|
+
const channels = await getCollection('channels');
|
|
17
|
+
|
|
18
|
+
export async function getStaticPaths() {
|
|
19
|
+
// Just return empty array if LLMs are not enabled
|
|
20
|
+
if (!config.llmsTxt?.enabled) {
|
|
21
|
+
return [];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const collections = {
|
|
25
|
+
events,
|
|
26
|
+
commands,
|
|
27
|
+
queries,
|
|
28
|
+
services,
|
|
29
|
+
domains,
|
|
30
|
+
flows,
|
|
31
|
+
channels,
|
|
32
|
+
};
|
|
33
|
+
const paths = Object.keys(collections).map((type) => {
|
|
34
|
+
return collections[type as keyof typeof collections].map((item: { data: { id: string; version: string } }) => ({
|
|
35
|
+
params: { type, id: item.data.id, version: item.data.version },
|
|
36
|
+
props: { content: item },
|
|
37
|
+
}));
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
return paths.flat();
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export const GET: APIRoute = async ({ params, props }) => {
|
|
44
|
+
// Just return empty array if LLMs are not enabled
|
|
45
|
+
if (!config.llmsTxt?.enabled) {
|
|
46
|
+
return new Response('llms.txt is not enabled for this Catalog.', { status: 404 });
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (props?.content?.data?.pathToFile) {
|
|
50
|
+
const file = fs.readFileSync(props.content.data.pathToFile, 'utf8');
|
|
51
|
+
return new Response(file, { status: 200 });
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return new Response('Not found', { status: 404 });
|
|
55
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { getCollection } from 'astro:content';
|
|
2
|
+
import config from '@config';
|
|
3
|
+
import type { APIRoute } from 'astro';
|
|
4
|
+
import fs from 'fs';
|
|
5
|
+
|
|
6
|
+
const events = await getCollection('events');
|
|
7
|
+
const commands = await getCollection('commands');
|
|
8
|
+
const queries = await getCollection('queries');
|
|
9
|
+
const services = await getCollection('services');
|
|
10
|
+
const domains = await getCollection('domains');
|
|
11
|
+
const teams = await getCollection('teams');
|
|
12
|
+
const users = await getCollection('users');
|
|
13
|
+
|
|
14
|
+
export const GET: APIRoute = async ({ params, request }) => {
|
|
15
|
+
if (!config.llmsTxt?.enabled) {
|
|
16
|
+
return new Response('llms.txt is not enabled for this Catalog.', { status: 404 });
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const resources = [...events, ...commands, ...queries, ...services, ...domains, ...teams, ...users];
|
|
20
|
+
|
|
21
|
+
const content = resources
|
|
22
|
+
.map((item) => {
|
|
23
|
+
if (!item.data.pathToFile) return '';
|
|
24
|
+
return fs.readFileSync(item.data.pathToFile, 'utf8');
|
|
25
|
+
})
|
|
26
|
+
.join('\n');
|
|
27
|
+
|
|
28
|
+
return new Response(content, {
|
|
29
|
+
headers: { 'Content-Type': 'text/plain; charset=utf-8' },
|
|
30
|
+
});
|
|
31
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { getCollection } from 'astro:content';
|
|
2
|
+
import config from '@config';
|
|
3
|
+
import type { APIRoute } from 'astro';
|
|
4
|
+
|
|
5
|
+
const events = await getCollection('events');
|
|
6
|
+
const commands = await getCollection('commands');
|
|
7
|
+
const queries = await getCollection('queries');
|
|
8
|
+
|
|
9
|
+
const services = await getCollection('services');
|
|
10
|
+
const domains = await getCollection('domains');
|
|
11
|
+
|
|
12
|
+
const teams = await getCollection('teams');
|
|
13
|
+
const users = await getCollection('users');
|
|
14
|
+
|
|
15
|
+
export const GET: APIRoute = async ({ params, request }) => {
|
|
16
|
+
const url = new URL(request.url);
|
|
17
|
+
const baseUrl = `${url.protocol}//${url.host}`;
|
|
18
|
+
|
|
19
|
+
const formatVersionedItem = (item: any, type: string) =>
|
|
20
|
+
`- [${item.data.name} - ${item.data.id} - ${item.data.version}](${baseUrl}/docs/${type}/${item.data.id}/${item.data.version}.md) - ${item.data.summary}`;
|
|
21
|
+
|
|
22
|
+
const formatSimpleItem = (item: any, type: string) =>
|
|
23
|
+
`- [${item.id.replace('.md', '')}](${baseUrl}/docs/${type}/${item.data.id}.md) - ${item.data.name}`;
|
|
24
|
+
|
|
25
|
+
const content = [
|
|
26
|
+
`# ${config.organizationName} EventCatalog Documentation\n`,
|
|
27
|
+
`> ${config.tagline}`,
|
|
28
|
+
'\n## Events',
|
|
29
|
+
events.map((item) => formatVersionedItem(item, 'events')).join(''),
|
|
30
|
+
'\n## Commands',
|
|
31
|
+
commands.map((item) => formatVersionedItem(item, 'commands')).join(''),
|
|
32
|
+
'\n## Queries',
|
|
33
|
+
queries.map((item) => formatVersionedItem(item, 'queries')).join(''),
|
|
34
|
+
'\n## Services',
|
|
35
|
+
services.map((item) => formatVersionedItem(item, 'services')).join(''),
|
|
36
|
+
'\n## Domains',
|
|
37
|
+
domains.map((item) => formatVersionedItem(item, 'domains')).join(''),
|
|
38
|
+
'\n## Teams',
|
|
39
|
+
teams.map((item) => formatSimpleItem(item, 'teams')).join('\n'),
|
|
40
|
+
'\n## Users',
|
|
41
|
+
users.map((item) => formatSimpleItem(item, 'users')).join('\n'),
|
|
42
|
+
].join('\n');
|
|
43
|
+
|
|
44
|
+
return new Response(content, {
|
|
45
|
+
headers: { 'Content-Type': 'text/plain; charset=utf-8' },
|
|
46
|
+
});
|
|
47
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// This file exposes the markdown for EventCatalog in the Url
|
|
2
|
+
// For example http://localhost:3000/docs/events/OrderAmended/0.0.1 loads the Page and http://localhost:3000/docs/events/OrderAmended/0.0.1.md loads the markdown
|
|
3
|
+
// This is used for the LLMs to load the markdown for the given item (llms.txt);
|
|
4
|
+
|
|
5
|
+
import type { APIRoute } from 'astro';
|
|
6
|
+
import { getCollection } from 'astro:content';
|
|
7
|
+
import config from '@config';
|
|
8
|
+
import fs from 'fs';
|
|
9
|
+
|
|
10
|
+
const teams = await getCollection('teams');
|
|
11
|
+
|
|
12
|
+
export async function getStaticPaths() {
|
|
13
|
+
// Just return empty array if LLMs are not enabled
|
|
14
|
+
if (!config.llmsTxt?.enabled) {
|
|
15
|
+
return [];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
console.log(teams);
|
|
19
|
+
|
|
20
|
+
return teams.map((team) => ({
|
|
21
|
+
params: { type: 'teams', id: team.data.id },
|
|
22
|
+
props: { content: team },
|
|
23
|
+
}));
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export const GET: APIRoute = async ({ params, props }) => {
|
|
27
|
+
// Just return empty array if LLMs are not enabled
|
|
28
|
+
if (!config.llmsTxt?.enabled) {
|
|
29
|
+
return new Response('llms.txt is not enabled for this Catalog.', { status: 404 });
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
console.log(props.context);
|
|
33
|
+
|
|
34
|
+
if (props?.content?.data?.pathToFile) {
|
|
35
|
+
const file = fs.readFileSync(props.content.data.pathToFile, 'utf8');
|
|
36
|
+
return new Response(file, { status: 200 });
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return new Response('Not found', { status: 404 });
|
|
40
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// This file exposes the markdown for EventCatalog in the Url
|
|
2
|
+
// For example http://localhost:3000/docs/events/OrderAmended/0.0.1 loads the Page and http://localhost:3000/docs/events/OrderAmended/0.0.1.md loads the markdown
|
|
3
|
+
// This is used for the LLMs to load the markdown for the given item (llms.txt);
|
|
4
|
+
|
|
5
|
+
import type { APIRoute } from 'astro';
|
|
6
|
+
import { getCollection } from 'astro:content';
|
|
7
|
+
import config from '@config';
|
|
8
|
+
import fs from 'fs';
|
|
9
|
+
|
|
10
|
+
const users = await getCollection('users');
|
|
11
|
+
|
|
12
|
+
export async function getStaticPaths() {
|
|
13
|
+
// Just return empty array if LLMs are not enabled
|
|
14
|
+
if (!config.llmsTxt?.enabled) {
|
|
15
|
+
return [];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return users.map((user) => ({
|
|
19
|
+
params: { type: 'users', id: user.data.id },
|
|
20
|
+
props: { content: user },
|
|
21
|
+
}));
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const GET: APIRoute = async ({ params, props }) => {
|
|
25
|
+
// Just return empty array if LLMs are not enabled
|
|
26
|
+
if (!config.llmsTxt?.enabled) {
|
|
27
|
+
return new Response('llms.txt is not enabled for this Catalog.', { status: 404 });
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (props?.content?.data?.pathToFile) {
|
|
31
|
+
const file = fs.readFileSync(props.content.data.pathToFile, 'utf8');
|
|
32
|
+
return new Response(file, { status: 200 });
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return new Response('Not found', { status: 404 });
|
|
36
|
+
};
|
package/package.json
CHANGED
/package/eventcatalog/src/components/{SideBars → SideNav}/CatalogResourcesSideBar/styles.css
RENAMED
|
File without changes
|