@eventcatalog/core 2.29.4 → 2.30.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/catalog-to-astro-content-directory.cjs +24 -64
- package/dist/catalog-to-astro-content-directory.d.cts +2 -1
- package/dist/catalog-to-astro-content-directory.d.ts +2 -1
- package/dist/catalog-to-astro-content-directory.js +6 -4
- package/dist/{chunk-7PSA2C5C.js → chunk-4Q54XOED.js} +1 -1
- package/dist/chunk-DE2TXYKB.js +59 -0
- package/dist/{chunk-FIY5JLSQ.js → chunk-HAYFEAB4.js} +3 -18
- package/dist/{chunk-6DVICCCE.js → chunk-MZLYNODU.js} +1 -1
- package/dist/{chunk-DH6NCUJX.js → chunk-T2XS2ZVB.js} +1 -1
- package/dist/{chunk-WUCY3QHK.js → chunk-UKJ7F5WR.js} +4 -12
- package/dist/constants.cjs +1 -1
- package/dist/constants.js +1 -1
- package/dist/eventcatalog.cjs +59 -88
- package/dist/eventcatalog.js +43 -24
- package/dist/map-catalog-to-astro.cjs +3 -18
- package/dist/map-catalog-to-astro.js +1 -1
- package/dist/watcher.cjs +6 -30
- package/dist/watcher.js +2 -2
- package/eventcatalog/astro.config.mjs +5 -0
- package/eventcatalog/src/components/MDX/Schema.astro +4 -3
- package/eventcatalog/src/components/MDX/SchemaViewer/SchemaViewer.astro +3 -3
- package/eventcatalog/src/components/SideBars/MessageSideBar.astro +1 -0
- package/eventcatalog/src/components/SideNav/TreeView/getTreeView.ts +2 -2
- package/eventcatalog/src/content.config.ts +94 -34
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/asyncapi/index.astro +11 -6
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/changelog/index.astro +7 -1
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/index.astro +4 -2
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/spec/_OpenAPI.tsx +1 -1
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/spec/index.astro +12 -5
- package/eventcatalog/src/pages/docs/[type]/[id]/[version].md.ts +2 -2
- package/eventcatalog/src/pages/docs/[type]/[id]/[version].mdx.ts +55 -0
- package/eventcatalog/src/pages/docs/llm/llms-full.txt.ts +2 -2
- package/eventcatalog/src/pages/docs/llm/llms.txt.ts +2 -2
- package/eventcatalog/src/pages/docs/teams/[id].md.ts +2 -2
- package/eventcatalog/src/pages/docs/users/[id].md.ts +2 -2
- package/eventcatalog/src/pages/rss/[resource]/rss.xml.js +2 -2
- package/eventcatalog/src/utils/channels.ts +2 -2
- package/eventcatalog/src/utils/collections/changelogs.ts +6 -2
- package/eventcatalog/src/utils/collections/domains.ts +5 -3
- package/eventcatalog/src/utils/collections/file-diffs.ts +1 -1
- package/eventcatalog/src/utils/collections/flows.ts +2 -2
- package/eventcatalog/src/utils/collections/services.ts +8 -6
- package/eventcatalog/src/utils/commands.ts +2 -2
- package/eventcatalog/src/utils/events.ts +2 -2
- package/eventcatalog/src/utils/queries.ts +2 -2
- package/package.json +6 -5
- package/dist/chunk-R2NILSWL.js +0 -82
|
@@ -35,11 +35,18 @@ export async function getStaticPaths() {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
// @ts-ignore
|
|
38
|
-
const { data, catalog } = Astro.props;
|
|
38
|
+
const { data, catalog, filePath } = Astro.props;
|
|
39
39
|
const fileName = data.specifications?.openapiPath || 'openapi.yml';
|
|
40
|
-
|
|
41
|
-
const
|
|
42
|
-
const
|
|
40
|
+
|
|
41
|
+
const directory = path.dirname(filePath || '');
|
|
42
|
+
const pathToSpec = path.join(directory, fileName);
|
|
43
|
+
const fileExists = fs.existsSync(pathToSpec);
|
|
44
|
+
|
|
45
|
+
let content = '';
|
|
46
|
+
|
|
47
|
+
if (fileExists) {
|
|
48
|
+
content = fs.readFileSync(pathToSpec, 'utf8');
|
|
49
|
+
}
|
|
43
50
|
---
|
|
44
51
|
|
|
45
52
|
<VerticalSideBarLayout title="OpenAPI Spec">
|
|
@@ -54,7 +61,7 @@ const fileExists = fs.existsSync(pathOnDisk);
|
|
|
54
61
|
</div>
|
|
55
62
|
) : (
|
|
56
63
|
<div>
|
|
57
|
-
<OpenAPISpec client:only="react" spec={
|
|
64
|
+
<OpenAPISpec client:only="react" spec={content} />
|
|
58
65
|
</div>
|
|
59
66
|
)
|
|
60
67
|
}
|
|
@@ -46,8 +46,8 @@ export const GET: APIRoute = async ({ params, props }) => {
|
|
|
46
46
|
return new Response('llms.txt is not enabled for this Catalog.', { status: 404 });
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
if (props?.content?.
|
|
50
|
-
const file = fs.readFileSync(props.content.
|
|
49
|
+
if (props?.content?.filePath) {
|
|
50
|
+
const file = fs.readFileSync(props.content.filePath, 'utf8');
|
|
51
51
|
return new Response(file, { status: 200 });
|
|
52
52
|
}
|
|
53
53
|
|
|
@@ -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?.filePath) {
|
|
50
|
+
const file = fs.readFileSync(props.content.filePath, 'utf8');
|
|
51
|
+
return new Response(file, { status: 200 });
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return new Response('Not found', { status: 404 });
|
|
55
|
+
};
|
|
@@ -20,8 +20,8 @@ export const GET: APIRoute = async ({ params, request }) => {
|
|
|
20
20
|
|
|
21
21
|
const content = resources
|
|
22
22
|
.map((item) => {
|
|
23
|
-
if (!item.
|
|
24
|
-
return fs.readFileSync(item.
|
|
23
|
+
if (!item.filePath) return '';
|
|
24
|
+
return fs.readFileSync(item.filePath, 'utf8');
|
|
25
25
|
})
|
|
26
26
|
.join('\n');
|
|
27
27
|
|
|
@@ -17,10 +17,10 @@ export const GET: APIRoute = async ({ params, request }) => {
|
|
|
17
17
|
const baseUrl = `${url.protocol}//${url.host}`;
|
|
18
18
|
|
|
19
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}.
|
|
20
|
+
`- [${item.data.name} - ${item.data.id} - ${item.data.version}](${baseUrl}/docs/${type}/${item.data.id}/${item.data.version}.mdx) - ${item.data.summary}`;
|
|
21
21
|
|
|
22
22
|
const formatSimpleItem = (item: any, type: string) =>
|
|
23
|
-
`- [${item.id.replace('.
|
|
23
|
+
`- [${item.id.replace('.mdx', '')}](${baseUrl}/docs/${type}/${item.data.id}.mdx) - ${item.data.name}`;
|
|
24
24
|
|
|
25
25
|
const content = [
|
|
26
26
|
`# ${config.organizationName} EventCatalog Documentation\n`,
|
|
@@ -27,8 +27,8 @@ export const GET: APIRoute = async ({ params, props }) => {
|
|
|
27
27
|
return new Response('llms.txt is not enabled for this Catalog.', { status: 404 });
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
if (props?.content?.
|
|
31
|
-
const file = fs.readFileSync(props.content.
|
|
30
|
+
if (props?.content?.filePath) {
|
|
31
|
+
const file = fs.readFileSync(props.content.filePath, 'utf8');
|
|
32
32
|
return new Response(file, { status: 200 });
|
|
33
33
|
}
|
|
34
34
|
|
|
@@ -27,8 +27,8 @@ export const GET: APIRoute = async ({ params, props }) => {
|
|
|
27
27
|
return new Response('llms.txt is not enabled for this Catalog.', { status: 404 });
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
if (props?.content?.
|
|
31
|
-
const file = fs.readFileSync(props.content
|
|
30
|
+
if (props?.content?.filePath) {
|
|
31
|
+
const file = fs.readFileSync(props.content?.filePath, 'utf8');
|
|
32
32
|
return new Response(file, { status: 200 });
|
|
33
33
|
}
|
|
34
34
|
|
|
@@ -37,9 +37,9 @@ export async function GET(context) {
|
|
|
37
37
|
|
|
38
38
|
const rssItems = items
|
|
39
39
|
// Make sure the item is valid before we try and get the git history
|
|
40
|
-
.filter((item) => item?.
|
|
40
|
+
.filter((item) => item?.filePath)
|
|
41
41
|
.map((event) => {
|
|
42
|
-
const pathToFile = event.
|
|
42
|
+
const pathToFile = event.filePath;
|
|
43
43
|
|
|
44
44
|
let modifiedDate;
|
|
45
45
|
let modifiedAuthor;
|
|
@@ -33,7 +33,7 @@ export const getChannels = async ({ getAllVersions = true }: Props = {}): Promis
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
const channels = await getCollection('channels', (query) => {
|
|
36
|
-
return (getAllVersions || !query.
|
|
36
|
+
return (getAllVersions || !query.filePath?.includes('versioned')) && query.data.hidden !== true;
|
|
37
37
|
});
|
|
38
38
|
|
|
39
39
|
const { commands, events, queries } = await getMessages();
|
|
@@ -68,7 +68,7 @@ export const getChannels = async ({ getAllVersions = true }: Props = {}): Promis
|
|
|
68
68
|
absoluteFilePath: path.join(PROJECT_DIR, channel.collection, channel.id.replace('/index.mdx', '/index.md')),
|
|
69
69
|
astroContentFilePath: path.join(process.cwd(), 'src', 'content', channel.collection, channel.id),
|
|
70
70
|
filePath: path.join(process.cwd(), 'src', 'catalog-files', channel.collection, channel.id.replace('/index.mdx', '')),
|
|
71
|
-
publicPath: path.join('/generated', channel.collection, channel.id.replace(
|
|
71
|
+
publicPath: path.join('/generated', channel.collection, channel.id.replace(`-${channel.data.version}`, '')),
|
|
72
72
|
type: 'event',
|
|
73
73
|
},
|
|
74
74
|
};
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import type { CollectionTypes } from '@types';
|
|
2
2
|
import { getCollection, type CollectionEntry } from 'astro:content';
|
|
3
|
+
import path from 'node:path';
|
|
3
4
|
|
|
4
5
|
export type ChangeLog = CollectionEntry<'changelogs'>;
|
|
5
6
|
|
|
6
7
|
export const getChangeLogs = async (item: CollectionEntry<CollectionTypes>): Promise<ChangeLog[]> => {
|
|
7
|
-
const { collection, data,
|
|
8
|
+
const { collection, data, filePath } = item;
|
|
8
9
|
|
|
9
10
|
// Get all logs for collection type and filter by given collection
|
|
10
11
|
const logs = await getCollection('changelogs', (log) => {
|
|
11
|
-
|
|
12
|
+
const collectionDirectory = path.dirname(item?.filePath || '');
|
|
13
|
+
const isRootChangeLog = path.join(collectionDirectory, 'changelog.md') === log.filePath;
|
|
14
|
+
const isVersionedChangeLog = log.filePath?.includes(path.join(collectionDirectory, 'versioned'));
|
|
15
|
+
return log.id.includes(`${collection}/`) && (isRootChangeLog || isVersionedChangeLog);
|
|
12
16
|
});
|
|
13
17
|
|
|
14
18
|
const hydratedLogs = logs.map((log) => {
|
|
@@ -28,7 +28,7 @@ export const getDomains = async ({ getAllVersions = true }: Props = {}): Promise
|
|
|
28
28
|
|
|
29
29
|
// Get all the domains that are not versioned
|
|
30
30
|
const domains = await getCollection('domains', (domain) => {
|
|
31
|
-
return (getAllVersions || !domain.
|
|
31
|
+
return (getAllVersions || !domain.filePath?.includes('versioned')) && domain.data.hidden !== true;
|
|
32
32
|
});
|
|
33
33
|
|
|
34
34
|
// Get all the services that are not versioned
|
|
@@ -60,7 +60,7 @@ export const getDomains = async ({ getAllVersions = true }: Props = {}): Promise
|
|
|
60
60
|
absoluteFilePath: path.join(PROJECT_DIR, domain.collection, domain.id.replace('/index.mdx', '/index.md')),
|
|
61
61
|
astroContentFilePath: path.join(process.cwd(), 'src', 'content', domain.collection, domain.id),
|
|
62
62
|
filePath: path.join(process.cwd(), 'src', 'catalog-files', domain.collection, domain.id.replace('/index.mdx', '')),
|
|
63
|
-
publicPath: path.join('/generated', domain.collection, domain.id.replace(
|
|
63
|
+
publicPath: path.join('/generated', domain.collection, domain.id.replace(`-${domain.data.version}`, '')),
|
|
64
64
|
type: 'service',
|
|
65
65
|
},
|
|
66
66
|
};
|
|
@@ -102,7 +102,9 @@ export const getMessagesForDomain = async (
|
|
|
102
102
|
|
|
103
103
|
export const getUbiquitousLanguage = async (domain: Domain): Promise<UbiquitousLanguage[]> => {
|
|
104
104
|
const ubiquitousLanguages = await getCollection('ubiquitousLanguages', (ubiquitousLanguage: UbiquitousLanguage) => {
|
|
105
|
-
|
|
105
|
+
const domainFolder = path.dirname(domain.filePath || '');
|
|
106
|
+
const ubiquitousLanguageFolder = path.dirname(ubiquitousLanguage.filePath || '');
|
|
107
|
+
return domainFolder === ubiquitousLanguageFolder;
|
|
106
108
|
});
|
|
107
109
|
|
|
108
110
|
return ubiquitousLanguages;
|
|
@@ -29,7 +29,7 @@ export async function getFilesForDiffInCollection(
|
|
|
29
29
|
collection: CollectionEntry<CollectionTypes>
|
|
30
30
|
): Promise<Array<{ file: string; dir: string }>> {
|
|
31
31
|
// @ts-ignore
|
|
32
|
-
const pathToFolder = collection.
|
|
32
|
+
const pathToFolder = collection.filePath;
|
|
33
33
|
if (!pathToFolder) return [];
|
|
34
34
|
|
|
35
35
|
const dir = dirname(pathToFolder);
|
|
@@ -26,7 +26,7 @@ export const getFlows = async ({ getAllVersions = true }: Props = {}): Promise<F
|
|
|
26
26
|
|
|
27
27
|
// Get flows that are not versioned
|
|
28
28
|
const flows = await getCollection('flows', (flow) => {
|
|
29
|
-
return (getAllVersions || !flow.
|
|
29
|
+
return (getAllVersions || !flow.filePath?.includes('versioned')) && flow.data.hidden !== true;
|
|
30
30
|
});
|
|
31
31
|
|
|
32
32
|
const events = await getCollection('events');
|
|
@@ -63,7 +63,7 @@ export const getFlows = async ({ getAllVersions = true }: Props = {}): Promise<F
|
|
|
63
63
|
absoluteFilePath: path.join(PROJECT_DIR, flow.collection, flow.id.replace('/index.mdx', '/index.md')),
|
|
64
64
|
astroContentFilePath: path.join(process.cwd(), 'src', 'content', flow.collection, flow.id),
|
|
65
65
|
filePath: path.join(process.cwd(), 'src', 'catalog-files', flow.collection, flow.id.replace('/index.mdx', '')),
|
|
66
|
-
publicPath: path.join('/generated', flow.collection
|
|
66
|
+
publicPath: path.join('/generated', flow.collection),
|
|
67
67
|
type: 'flow',
|
|
68
68
|
},
|
|
69
69
|
};
|
|
@@ -21,15 +21,16 @@ let cachedServices: Record<string, Service[]> = {
|
|
|
21
21
|
export const getServices = async ({ getAllVersions = true }: Props = {}): Promise<Service[]> => {
|
|
22
22
|
const cacheKey = getAllVersions ? 'allVersions' : 'currentVersions';
|
|
23
23
|
|
|
24
|
-
// Check if we have cached domains for this specific getAllVersions value
|
|
25
|
-
if (cachedServices[cacheKey].length > 0) {
|
|
26
|
-
|
|
27
|
-
}
|
|
24
|
+
// // Check if we have cached domains for this specific getAllVersions value
|
|
25
|
+
// if (cachedServices[cacheKey].length > 0) {
|
|
26
|
+
// return cachedServices[cacheKey];
|
|
27
|
+
// }
|
|
28
28
|
|
|
29
29
|
// Get services that are not versioned
|
|
30
30
|
const services = await getCollection('services', (service) => {
|
|
31
|
-
return (getAllVersions || !service.
|
|
31
|
+
return (getAllVersions || !service.filePath?.includes('versioned')) && service.data.hidden !== true;
|
|
32
32
|
});
|
|
33
|
+
|
|
33
34
|
const events = await getCollection('events');
|
|
34
35
|
const commands = await getCollection('commands');
|
|
35
36
|
const queries = await getCollection('queries');
|
|
@@ -73,7 +74,8 @@ export const getServices = async ({ getAllVersions = true }: Props = {}): Promis
|
|
|
73
74
|
absoluteFilePath: path.join(PROJECT_DIR, service.collection, service.id.replace('/index.mdx', '/index.md')),
|
|
74
75
|
astroContentFilePath: path.join(process.cwd(), 'src', 'content', service.collection, service.id),
|
|
75
76
|
filePath: path.join(process.cwd(), 'src', 'catalog-files', service.collection, service.id.replace('/index.mdx', '')),
|
|
76
|
-
|
|
77
|
+
// service will be MySerive-0.0.1 remove the version
|
|
78
|
+
publicPath: path.join('/generated', service.collection, service.id.replace(`-${service.data.version}`, '')),
|
|
77
79
|
type: 'service',
|
|
78
80
|
},
|
|
79
81
|
};
|
|
@@ -31,7 +31,7 @@ export const getCommands = async ({ getAllVersions = true }: Props = {}): Promis
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
const commands = await getCollection('commands', (command) => {
|
|
34
|
-
return (getAllVersions || !command.
|
|
34
|
+
return (getAllVersions || !command.filePath?.includes('versioned')) && command.data.hidden !== true;
|
|
35
35
|
});
|
|
36
36
|
|
|
37
37
|
const services = await getCollection('services');
|
|
@@ -74,7 +74,7 @@ export const getCommands = async ({ getAllVersions = true }: Props = {}): Promis
|
|
|
74
74
|
absoluteFilePath: path.join(PROJECT_DIR, command.collection, command.id.replace('/index.mdx', '/index.md')),
|
|
75
75
|
astroContentFilePath: path.join(process.cwd(), 'src', 'content', command.collection, command.id),
|
|
76
76
|
filePath: path.join(process.cwd(), 'src', 'catalog-files', command.collection, command.id.replace('/index.mdx', '')),
|
|
77
|
-
publicPath: path.join('/generated', command.collection, command.id.replace(
|
|
77
|
+
publicPath: path.join('/generated', command.collection, command.id.replace(`-${command.data.version}`, '')),
|
|
78
78
|
type: 'command',
|
|
79
79
|
},
|
|
80
80
|
};
|
|
@@ -31,7 +31,7 @@ export const getEvents = async ({ getAllVersions = true }: Props = {}): Promise<
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
const events = await getCollection('events', (event) => {
|
|
34
|
-
return (getAllVersions || !event.
|
|
34
|
+
return (getAllVersions || !event.filePath?.includes('versioned')) && event.data.hidden !== true;
|
|
35
35
|
});
|
|
36
36
|
|
|
37
37
|
const services = await getCollection('services');
|
|
@@ -74,7 +74,7 @@ export const getEvents = async ({ getAllVersions = true }: Props = {}): Promise<
|
|
|
74
74
|
absoluteFilePath: path.join(PROJECT_DIR, event.collection, event.id.replace('/index.mdx', '/index.md')),
|
|
75
75
|
astroContentFilePath: path.join(process.cwd(), 'src', 'content', event.collection, event.id),
|
|
76
76
|
filePath: path.join(process.cwd(), 'src', 'catalog-files', event.collection, event.id.replace('/index.mdx', '')),
|
|
77
|
-
publicPath: path.join('/generated', event.collection, event.id.replace(
|
|
77
|
+
publicPath: path.join('/generated', event.collection, event.id.replace(`-${event.data.version}`, '')),
|
|
78
78
|
type: 'event',
|
|
79
79
|
},
|
|
80
80
|
};
|
|
@@ -31,7 +31,7 @@ export const getQueries = async ({ getAllVersions = true }: Props = {}): Promise
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
const queries = await getCollection('queries', (query) => {
|
|
34
|
-
return (getAllVersions || !query.
|
|
34
|
+
return (getAllVersions || !query.filePath?.includes('versioned')) && query.data.hidden !== true;
|
|
35
35
|
});
|
|
36
36
|
|
|
37
37
|
const services = await getCollection('services');
|
|
@@ -74,7 +74,7 @@ export const getQueries = async ({ getAllVersions = true }: Props = {}): Promise
|
|
|
74
74
|
absoluteFilePath: path.join(PROJECT_DIR, query.collection, query.id.replace('/index.mdx', '/index.md')),
|
|
75
75
|
astroContentFilePath: path.join(process.cwd(), 'src', 'content', query.collection, query.id),
|
|
76
76
|
filePath: path.join(process.cwd(), 'src', 'catalog-files', query.collection, query.id.replace('/index.mdx', '')),
|
|
77
|
-
publicPath: path.join('/generated', query.collection, query.id.replace(
|
|
77
|
+
publicPath: path.join('/generated', query.collection, query.id.replace(`-${query.data.version}`, '')),
|
|
78
78
|
type: 'event',
|
|
79
79
|
},
|
|
80
80
|
};
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"url": "https://github.com/event-catalog/eventcatalog.git"
|
|
7
7
|
},
|
|
8
8
|
"type": "module",
|
|
9
|
-
"version": "2.
|
|
9
|
+
"version": "2.30.0",
|
|
10
10
|
"publishConfig": {
|
|
11
11
|
"access": "public"
|
|
12
12
|
},
|
|
@@ -21,15 +21,15 @@
|
|
|
21
21
|
"default-files-for-collections/"
|
|
22
22
|
],
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@astrojs/markdown-remark": "^6.
|
|
25
|
-
"@astrojs/mdx": "^4.
|
|
24
|
+
"@astrojs/markdown-remark": "^6.3.0",
|
|
25
|
+
"@astrojs/mdx": "^4.2.0",
|
|
26
26
|
"@astrojs/react": "^4.2.1",
|
|
27
27
|
"@astrojs/rss": "^4.0.11",
|
|
28
28
|
"@astrojs/tailwind": "^6.0.0",
|
|
29
29
|
"@asyncapi/avro-schema-parser": "^3.0.24",
|
|
30
30
|
"@asyncapi/parser": "^3.4.0",
|
|
31
31
|
"@asyncapi/react-component": "^2.4.3",
|
|
32
|
-
"@eventcatalog/generator-ai": "^0.
|
|
32
|
+
"@eventcatalog/generator-ai": "^1.0.0",
|
|
33
33
|
"@fontsource/inter": "^5.2.5",
|
|
34
34
|
"@headlessui/react": "^2.0.3",
|
|
35
35
|
"@heroicons/react": "^2.1.3",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"@tailwindcss/typography": "^0.5.13",
|
|
46
46
|
"@tanstack/react-table": "^8.17.3",
|
|
47
47
|
"@xyflow/react": "^12.3.6",
|
|
48
|
-
"astro": "^5.
|
|
48
|
+
"astro": "^5.5.2",
|
|
49
49
|
"astro-expressive-code": "^0.40.1",
|
|
50
50
|
"astro-pagefind": "^1.6.0",
|
|
51
51
|
"astro-seo": "^0.8.4",
|
|
@@ -99,6 +99,7 @@
|
|
|
99
99
|
"@types/semver": "^7.5.8",
|
|
100
100
|
"@types/shelljs": "^0.8.15",
|
|
101
101
|
"@types/update-notifier": "^6.0.8",
|
|
102
|
+
"@types/uuid": "^10.0.0",
|
|
102
103
|
"prettier": "^3.3.3",
|
|
103
104
|
"prettier-plugin-astro": "^0.14.1",
|
|
104
105
|
"tsup": "^8.1.0",
|
package/dist/chunk-R2NILSWL.js
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
addPropertyToFrontMatter,
|
|
3
|
-
verifyRequiredFieldsAreInCatalogConfigFile
|
|
4
|
-
} from "./chunk-E7TXTI7G.js";
|
|
5
|
-
import {
|
|
6
|
-
mapCatalogToAstro
|
|
7
|
-
} from "./chunk-FIY5JLSQ.js";
|
|
8
|
-
|
|
9
|
-
// src/catalog-to-astro-content-directory.js
|
|
10
|
-
import { glob } from "glob";
|
|
11
|
-
import * as path from "node:path";
|
|
12
|
-
import fs from "fs";
|
|
13
|
-
import { fileURLToPath } from "url";
|
|
14
|
-
import os from "node:os";
|
|
15
|
-
var __filename = fileURLToPath(import.meta.url);
|
|
16
|
-
var rootPkg = path.resolve(path.dirname(__filename), "../");
|
|
17
|
-
var copyFiles = async (source, target) => {
|
|
18
|
-
const files = await glob(path.join(source, "**"), {
|
|
19
|
-
nodir: true,
|
|
20
|
-
windowsPathsNoEscape: os.platform() == "win32"
|
|
21
|
-
});
|
|
22
|
-
for (const file of files) {
|
|
23
|
-
mapCatalogToAstro({
|
|
24
|
-
filePath: file,
|
|
25
|
-
astroDir: target,
|
|
26
|
-
projectDir: source
|
|
27
|
-
}).map((astroPath) => {
|
|
28
|
-
fs.cpSync(file, astroPath);
|
|
29
|
-
return { oldPath: file, newPath: astroPath };
|
|
30
|
-
}).map(({ oldPath, newPath }) => {
|
|
31
|
-
if (!oldPath.endsWith(".md") && !oldPath.endsWith(".mdx")) return;
|
|
32
|
-
try {
|
|
33
|
-
const content = fs.readFileSync(newPath, "utf-8");
|
|
34
|
-
const frontmatter = addPropertyToFrontMatter(content, "pathToFile", oldPath);
|
|
35
|
-
fs.writeFileSync(newPath, frontmatter);
|
|
36
|
-
} catch (error) {
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
var ensureAstroCollectionNotEmpty = async (astroDir) => {
|
|
42
|
-
const COLLECTIONS = [
|
|
43
|
-
"events",
|
|
44
|
-
"commands",
|
|
45
|
-
"services",
|
|
46
|
-
"domains",
|
|
47
|
-
"flows",
|
|
48
|
-
"changelogs",
|
|
49
|
-
"queries",
|
|
50
|
-
"channels",
|
|
51
|
-
"ubiquitousLanguages"
|
|
52
|
-
];
|
|
53
|
-
const emptyCollections = [];
|
|
54
|
-
for (const collection of COLLECTIONS) {
|
|
55
|
-
const markdownFiles = await glob(path.join(astroDir, "src/content/", collection, "**"), {
|
|
56
|
-
nodir: true,
|
|
57
|
-
windowsPathsNoEscape: os.platform() == "win32"
|
|
58
|
-
});
|
|
59
|
-
if (markdownFiles.length === 0) emptyCollections.push(collection);
|
|
60
|
-
}
|
|
61
|
-
const defaultCollectionFilesDir = path.join(rootPkg, "default-files-for-collections");
|
|
62
|
-
for (const collection of emptyCollections) {
|
|
63
|
-
const defaultFile = path.join(defaultCollectionFilesDir, `${collection}.md`);
|
|
64
|
-
const targetDir = path.join(astroDir, "src/content/", collection);
|
|
65
|
-
if (!fs.existsSync(targetDir)) {
|
|
66
|
-
fs.mkdirSync(targetDir, { recursive: true });
|
|
67
|
-
}
|
|
68
|
-
fs.cpSync(defaultFile, path.join(targetDir, `${collection}.md`));
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
var catalogToAstro = async (source, astroDir) => {
|
|
72
|
-
const astroContentDir = path.join(astroDir, "src/content/");
|
|
73
|
-
if (fs.existsSync(astroContentDir)) fs.rmSync(astroContentDir, { recursive: true });
|
|
74
|
-
fs.mkdirSync(astroContentDir);
|
|
75
|
-
await verifyRequiredFieldsAreInCatalogConfigFile(source);
|
|
76
|
-
await copyFiles(source, astroDir);
|
|
77
|
-
await ensureAstroCollectionNotEmpty(astroDir);
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
export {
|
|
81
|
-
catalogToAstro
|
|
82
|
-
};
|