@eventcatalog/core 2.33.0 → 2.33.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-TNU27WQF.js → chunk-IVIWGH2J.js} +1 -1
- package/dist/{chunk-MXEVMOGW.js → chunk-R3X2SCY6.js} +1 -1
- package/dist/{chunk-MC6EBL4I.js → chunk-VDBGM3NV.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 +3 -3
- package/eventcatalog/src/components/Lists/CustomSideBarSectionList.astro +1 -13
- package/eventcatalog/src/components/MDX/ResourceGroupTable/ResourceGroupTable.astro +1 -13
- package/eventcatalog/src/components/MDX/ResourceLink/ResourceLink.astro +1 -12
- package/eventcatalog/src/components/MDX/SchemaViewer/SchemaViewer.astro +3 -29
- package/eventcatalog/src/components/MDX/components.tsx +1 -1
- package/eventcatalog/src/enterprise/custom-documentation/pages/docs/custom/index.astro +26 -1
- package/eventcatalog/src/pages/docs/custom/[...path].mdx.ts +32 -0
- package/eventcatalog/src/pages/docs/llm/llms-full.txt.ts +19 -2
- package/eventcatalog/src/pages/docs/llm/llms.txt.ts +10 -0
- package/eventcatalog/src/utils/collections/util.ts +12 -0
- package/eventcatalog/src/utils/markdown.ts +30 -0
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
log_build_default
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
5
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-R3X2SCY6.js";
|
|
4
|
+
import "../chunk-VDBGM3NV.js";
|
|
5
|
+
import "../chunk-IVIWGH2J.js";
|
|
6
6
|
import "../chunk-E7TXTI7G.js";
|
|
7
7
|
export {
|
|
8
8
|
log_build_default as default
|
package/dist/constants.cjs
CHANGED
package/dist/constants.js
CHANGED
package/dist/eventcatalog.cjs
CHANGED
package/dist/eventcatalog.js
CHANGED
|
@@ -6,15 +6,15 @@ import {
|
|
|
6
6
|
} from "./chunk-UKJ7F5WR.js";
|
|
7
7
|
import {
|
|
8
8
|
log_build_default
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-R3X2SCY6.js";
|
|
10
|
+
import "./chunk-VDBGM3NV.js";
|
|
11
11
|
import {
|
|
12
12
|
catalogToAstro,
|
|
13
13
|
checkAndConvertMdToMdx
|
|
14
14
|
} from "./chunk-7SI5EVOX.js";
|
|
15
15
|
import {
|
|
16
16
|
VERSION
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-IVIWGH2J.js";
|
|
18
18
|
import {
|
|
19
19
|
isBackstagePluginEnabled,
|
|
20
20
|
isEventCatalogScaleEnabled,
|
|
@@ -3,6 +3,7 @@ import { buildUrl } from '@utils/url-builder';
|
|
|
3
3
|
import { getCollection } from 'astro:content';
|
|
4
4
|
import { getItemsFromCollectionByIdAndSemverOrLatest } from '@utils/collections/util';
|
|
5
5
|
import PillListFlat from './PillListFlat';
|
|
6
|
+
import { resourceToCollectionMap } from '@utils/collections/util';
|
|
6
7
|
interface Props {
|
|
7
8
|
section?: {
|
|
8
9
|
title?: string;
|
|
@@ -20,19 +21,6 @@ const title = section?.title || 'Custom Section';
|
|
|
20
21
|
const limit = section?.limit || 10;
|
|
21
22
|
const sectionItems = section?.items || [];
|
|
22
23
|
|
|
23
|
-
// Type-safe mapping of resource types to collection names
|
|
24
|
-
const resourceToCollectionMap = {
|
|
25
|
-
service: 'services',
|
|
26
|
-
event: 'events',
|
|
27
|
-
command: 'commands',
|
|
28
|
-
query: 'queries',
|
|
29
|
-
domain: 'domains',
|
|
30
|
-
flow: 'flows',
|
|
31
|
-
channel: 'channels',
|
|
32
|
-
user: 'users',
|
|
33
|
-
team: 'teams',
|
|
34
|
-
} as const; // Make this a const assertion
|
|
35
|
-
|
|
36
24
|
// Array to store resolved related resources
|
|
37
25
|
const resolvedResources = [];
|
|
38
26
|
|
|
@@ -4,6 +4,7 @@ import { getCollection } from 'astro:content';
|
|
|
4
4
|
import { getItemsFromCollectionByIdAndSemverOrLatest } from '@utils/collections/util';
|
|
5
5
|
import ResourceGroupTableClient from './ResourceGroupTable.client';
|
|
6
6
|
import Admonition from '../Admonition';
|
|
7
|
+
import { resourceToCollectionMap } from '@utils/collections/util';
|
|
7
8
|
|
|
8
9
|
export interface Props extends CollectionEntry<'services'> {
|
|
9
10
|
limit?: number;
|
|
@@ -31,19 +32,6 @@ const section = resource.data.resourceGroups?.find((section: any) => section.id
|
|
|
31
32
|
|
|
32
33
|
const collection = Astro.props.collection as 'services' | 'domains';
|
|
33
34
|
|
|
34
|
-
// Type-safe mapping of resource types to collection names
|
|
35
|
-
const resourceToCollectionMap = {
|
|
36
|
-
service: 'services',
|
|
37
|
-
event: 'events',
|
|
38
|
-
command: 'commands',
|
|
39
|
-
query: 'queries',
|
|
40
|
-
domain: 'domains',
|
|
41
|
-
flow: 'flows',
|
|
42
|
-
channel: 'channels',
|
|
43
|
-
user: 'users',
|
|
44
|
-
team: 'teams',
|
|
45
|
-
} as const;
|
|
46
|
-
|
|
47
35
|
// This will hold our processed resources for the client component
|
|
48
36
|
const resolvedResources: any[] = [];
|
|
49
37
|
|
|
@@ -1,17 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
import { buildUrl } from '@utils/url-builder';
|
|
3
|
-
|
|
4
|
-
const resourceToCollectionMap = {
|
|
5
|
-
service: 'services',
|
|
6
|
-
event: 'events',
|
|
7
|
-
command: 'commands',
|
|
8
|
-
query: 'queries',
|
|
9
|
-
domain: 'domains',
|
|
10
|
-
flow: 'flows',
|
|
11
|
-
channel: 'channels',
|
|
12
|
-
user: 'users',
|
|
13
|
-
team: 'teams',
|
|
14
|
-
} as const;
|
|
3
|
+
import { resourceToCollectionMap } from '@utils/collections/util';
|
|
15
4
|
|
|
16
5
|
const { id, version, type } = Astro.props;
|
|
17
6
|
const collection = resourceToCollectionMap[type as keyof typeof resourceToCollectionMap];
|
|
@@ -6,39 +6,13 @@ import yaml from 'js-yaml';
|
|
|
6
6
|
import path from 'path';
|
|
7
7
|
import SchemaViewerClient from './SchemaViewer';
|
|
8
8
|
import Admonition from '../Admonition';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
function findSchemaViewers(document: string) {
|
|
12
|
-
// Define regex pattern to match <SchemaViewer ... />
|
|
13
|
-
const pattern = /<SchemaViewer\s+([^>]*)\/>/g;
|
|
14
|
-
|
|
15
|
-
// Find all matches of the pattern
|
|
16
|
-
const matches = [...document.matchAll(pattern)];
|
|
17
|
-
|
|
18
|
-
// Extract the properties of each SchemaViewer
|
|
19
|
-
const schemaViewers = matches.map((match) => {
|
|
20
|
-
const propsString = match[1];
|
|
21
|
-
const props = {};
|
|
22
|
-
|
|
23
|
-
// Use regex to extract key-value pairs from propsString
|
|
24
|
-
const propsPattern = /(\w+)=["']([^"']+)["']/g;
|
|
25
|
-
let propMatch;
|
|
26
|
-
while ((propMatch = propsPattern.exec(propsString)) !== null) {
|
|
27
|
-
const key = propMatch[1];
|
|
28
|
-
const value = propMatch[2];
|
|
29
|
-
// @ts-ignore
|
|
30
|
-
props[key] = value;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
return props;
|
|
34
|
-
});
|
|
9
|
+
import { getMDXComponentsByName } from '@utils/markdown';
|
|
35
10
|
|
|
36
|
-
|
|
37
|
-
}
|
|
11
|
+
let schemas = [];
|
|
38
12
|
|
|
39
13
|
try {
|
|
40
14
|
const file = await fs.readFile(filePath, 'utf-8');
|
|
41
|
-
const schemaViewers =
|
|
15
|
+
const schemaViewers = getMDXComponentsByName(file, 'SchemaViewer');
|
|
42
16
|
|
|
43
17
|
// Loop around all the possible SchemaViewers in the file.
|
|
44
18
|
const getAllComponents = schemaViewers.map(async (schemaViewerProps: any) => {
|
|
@@ -34,7 +34,7 @@ const components = (props: any) => {
|
|
|
34
34
|
Flow,
|
|
35
35
|
Link: (mdxProp: any) => jsx(Link, { ...props, ...mdxProp }),
|
|
36
36
|
MessageTable: (mdxProp: any) => jsx(MessageTable, { ...props, ...mdxProp }),
|
|
37
|
-
NodeGraph: (mdxProp: any) => NodeGraphPortal
|
|
37
|
+
NodeGraph: (mdxProp: any) => jsx(NodeGraphPortal, { ...props.data, ...mdxProp, props, mdxProp }),
|
|
38
38
|
OpenAPI,
|
|
39
39
|
ResourceGroupTable: (mdxProp: any) => jsx(ResourceGroupTable, { ...props, ...mdxProp }),
|
|
40
40
|
ResourceLink: (mdxProp: any) => jsx(ResourceLink, { ...props, ...mdxProp }),
|
|
@@ -9,15 +9,19 @@ import OwnersList from '@components/Lists/OwnersList';
|
|
|
9
9
|
|
|
10
10
|
import { getOwner } from '@utils/collections/owners';
|
|
11
11
|
import { buildUrl } from '@utils/url-builder';
|
|
12
|
+
import { resourceToCollectionMap } from '@utils/collections/util';
|
|
13
|
+
import { getMDXComponentsByName } from '@utils/markdown';
|
|
14
|
+
import { getAdjacentPages } from '@enterprise/custom-documentation/utils/custom-docs';
|
|
12
15
|
|
|
13
16
|
import CustomDocsNav from '@enterprise/custom-documentation/components/CustomDocsNav/CustomDocsNav.astro';
|
|
14
|
-
import
|
|
17
|
+
import NodeGraph from '@components/MDX/NodeGraph/NodeGraph.astro';
|
|
15
18
|
|
|
16
19
|
const props = Astro.props;
|
|
17
20
|
const doc = props.data;
|
|
18
21
|
const { Content, headings } = await render(props as any);
|
|
19
22
|
const currentSlug = props.id;
|
|
20
23
|
|
|
24
|
+
const nodeGraphs = getMDXComponentsByName(props.body, 'NodeGraph') || [];
|
|
21
25
|
// Get sidebar data
|
|
22
26
|
const sidebar = config?.customDocs?.sidebar || [];
|
|
23
27
|
|
|
@@ -116,6 +120,27 @@ const badges = doc?.badges || [];
|
|
|
116
120
|
<Content components={{ ...mdxComponents(props) }} />
|
|
117
121
|
</div>
|
|
118
122
|
|
|
123
|
+
{
|
|
124
|
+
nodeGraphs.length > 0 &&
|
|
125
|
+
nodeGraphs.map((nodeGraph: any) => {
|
|
126
|
+
const collection = resourceToCollectionMap[nodeGraph.type as keyof typeof resourceToCollectionMap];
|
|
127
|
+
return (
|
|
128
|
+
<NodeGraph
|
|
129
|
+
id={nodeGraph.id}
|
|
130
|
+
version={nodeGraph.version}
|
|
131
|
+
collection={collection}
|
|
132
|
+
title={nodeGraph.title}
|
|
133
|
+
mode="simple"
|
|
134
|
+
linksToVisualiser={true}
|
|
135
|
+
href={{
|
|
136
|
+
label: 'Open in Visualiser',
|
|
137
|
+
url: buildUrl(`/visualiser/${collection}/${nodeGraph.id}/${nodeGraph.version}`),
|
|
138
|
+
}}
|
|
139
|
+
/>
|
|
140
|
+
);
|
|
141
|
+
})
|
|
142
|
+
}
|
|
143
|
+
|
|
119
144
|
<!-- Previous / Next Navigation -->
|
|
120
145
|
<div class="py-8 border-t border-gray-200 mt-8">
|
|
121
146
|
<div class="flex flex-col sm:flex-row justify-between w-full gap-4">
|
|
@@ -0,0 +1,32 @@
|
|
|
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, GetStaticPaths } from 'astro';
|
|
6
|
+
import { getCollection } from 'astro:content';
|
|
7
|
+
import config from '@config';
|
|
8
|
+
import fs from 'fs';
|
|
9
|
+
|
|
10
|
+
export const getStaticPaths = (async () => {
|
|
11
|
+
const docs = await getCollection('customPages');
|
|
12
|
+
const paths = docs.map((doc) => ({
|
|
13
|
+
params: { path: doc.id.replace('docs/', '') },
|
|
14
|
+
props: doc,
|
|
15
|
+
type: 'custom',
|
|
16
|
+
}));
|
|
17
|
+
return paths;
|
|
18
|
+
}) satisfies GetStaticPaths;
|
|
19
|
+
|
|
20
|
+
export const GET: APIRoute = async ({ params, props }) => {
|
|
21
|
+
// Just return empty array if LLMs are not enabled
|
|
22
|
+
if (!config.llmsTxt?.enabled) {
|
|
23
|
+
return new Response('llms.txt is not enabled for this Catalog.', { status: 404 });
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if (props.filePath) {
|
|
27
|
+
const file = fs.readFileSync(props.filePath, 'utf8');
|
|
28
|
+
return new Response(file, { status: 200 });
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return new Response('Not found', { status: 404 });
|
|
32
|
+
};
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import { getCollection } from 'astro:content';
|
|
1
|
+
import { getCollection, type CollectionEntry } from 'astro:content';
|
|
2
2
|
import config from '@config';
|
|
3
3
|
import type { APIRoute } from 'astro';
|
|
4
4
|
import fs from 'fs';
|
|
5
|
+
import { isCustomDocsEnabled } from '@utils/feature';
|
|
6
|
+
|
|
7
|
+
type AllowedCollections = 'events' | 'commands' | 'queries' | 'services' | 'domains' | 'teams' | 'users' | 'customPages';
|
|
5
8
|
|
|
6
9
|
const events = await getCollection('events');
|
|
7
10
|
const commands = await getCollection('commands');
|
|
@@ -11,12 +14,26 @@ const domains = await getCollection('domains');
|
|
|
11
14
|
const teams = await getCollection('teams');
|
|
12
15
|
const users = await getCollection('users');
|
|
13
16
|
|
|
17
|
+
const customDocs = await getCollection('customPages');
|
|
18
|
+
|
|
14
19
|
export const GET: APIRoute = async ({ params, request }) => {
|
|
15
20
|
if (!config.llmsTxt?.enabled) {
|
|
16
21
|
return new Response('llms.txt is not enabled for this Catalog.', { status: 404 });
|
|
17
22
|
}
|
|
18
23
|
|
|
19
|
-
const resources = [
|
|
24
|
+
const resources: CollectionEntry<AllowedCollections>[] = [
|
|
25
|
+
...events,
|
|
26
|
+
...commands,
|
|
27
|
+
...queries,
|
|
28
|
+
...services,
|
|
29
|
+
...domains,
|
|
30
|
+
...teams,
|
|
31
|
+
...users,
|
|
32
|
+
];
|
|
33
|
+
|
|
34
|
+
if (isCustomDocsEnabled()) {
|
|
35
|
+
resources.push(...(customDocs as CollectionEntry<AllowedCollections>[]));
|
|
36
|
+
}
|
|
20
37
|
|
|
21
38
|
const content = resources
|
|
22
39
|
.map((item) => {
|
|
@@ -2,6 +2,8 @@ import { getCollection } from 'astro:content';
|
|
|
2
2
|
import config from '@config';
|
|
3
3
|
import type { APIRoute } from 'astro';
|
|
4
4
|
|
|
5
|
+
import { isCustomDocsEnabled } from '@utils/feature';
|
|
6
|
+
|
|
5
7
|
const events = await getCollection('events');
|
|
6
8
|
const commands = await getCollection('commands');
|
|
7
9
|
const queries = await getCollection('queries');
|
|
@@ -12,6 +14,8 @@ const domains = await getCollection('domains');
|
|
|
12
14
|
const teams = await getCollection('teams');
|
|
13
15
|
const users = await getCollection('users');
|
|
14
16
|
|
|
17
|
+
const customDocs = await getCollection('customPages');
|
|
18
|
+
|
|
15
19
|
export const GET: APIRoute = async ({ params, request }) => {
|
|
16
20
|
const url = new URL(request.url);
|
|
17
21
|
const baseUrl = `${url.protocol}//${url.host}`;
|
|
@@ -22,6 +26,9 @@ export const GET: APIRoute = async ({ params, request }) => {
|
|
|
22
26
|
const formatSimpleItem = (item: any, type: string) =>
|
|
23
27
|
`- [${item.id.replace('.mdx', '')}](${baseUrl}/docs/${type}/${item.data.id}.mdx) - ${item.data.name}`;
|
|
24
28
|
|
|
29
|
+
const formatCustomDoc = (item: any, route: string) =>
|
|
30
|
+
`- [${item.data.title}](${baseUrl}/${route}/${item.id.replace('docs\/', '')}.mdx) - ${item.data.summary || ''}`;
|
|
31
|
+
|
|
25
32
|
const content = [
|
|
26
33
|
`# ${config.organizationName} EventCatalog Documentation\n`,
|
|
27
34
|
`> ${config.tagline}`,
|
|
@@ -39,6 +46,9 @@ export const GET: APIRoute = async ({ params, request }) => {
|
|
|
39
46
|
teams.map((item) => formatSimpleItem(item, 'teams')).join('\n'),
|
|
40
47
|
'\n## Users',
|
|
41
48
|
users.map((item) => formatSimpleItem(item, 'users')).join('\n'),
|
|
49
|
+
...(isCustomDocsEnabled()
|
|
50
|
+
? ['\n## Custom Docs', customDocs.map((item) => formatCustomDoc(item, 'docs/custom')).join('\n')]
|
|
51
|
+
: []),
|
|
42
52
|
].join('\n');
|
|
43
53
|
|
|
44
54
|
return new Response(content, {
|
|
@@ -97,3 +97,15 @@ export const findMatchingNodes = (
|
|
|
97
97
|
});
|
|
98
98
|
});
|
|
99
99
|
};
|
|
100
|
+
|
|
101
|
+
export const resourceToCollectionMap = {
|
|
102
|
+
service: 'services',
|
|
103
|
+
event: 'events',
|
|
104
|
+
command: 'commands',
|
|
105
|
+
query: 'queries',
|
|
106
|
+
domain: 'domains',
|
|
107
|
+
flow: 'flows',
|
|
108
|
+
channel: 'channels',
|
|
109
|
+
user: 'users',
|
|
110
|
+
team: 'teams',
|
|
111
|
+
} as const;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// Method returns MDX components and there props in markdown files
|
|
2
|
+
// rarely used, but useful for components that need to know how many times
|
|
3
|
+
// the user wants to render a component in a markdown file
|
|
4
|
+
export const getMDXComponentsByName = (document: string, componentName: string) => {
|
|
5
|
+
// Define regex pattern to match <SchemaViewer ... />
|
|
6
|
+
const pattern = new RegExp(`<${componentName}\\s+([^>]*)\\/>`, 'g');
|
|
7
|
+
|
|
8
|
+
// Find all matches of the pattern
|
|
9
|
+
const matches = [...document.matchAll(pattern)];
|
|
10
|
+
|
|
11
|
+
// Extract the properties of each SchemaViewer
|
|
12
|
+
const components = matches.map((match) => {
|
|
13
|
+
const propsString = match[1];
|
|
14
|
+
const props = {};
|
|
15
|
+
|
|
16
|
+
// Use regex to extract key-value pairs from propsString
|
|
17
|
+
const propsPattern = /(\w+)=["']([^"']+)["']/g;
|
|
18
|
+
let propMatch;
|
|
19
|
+
while ((propMatch = propsPattern.exec(propsString)) !== null) {
|
|
20
|
+
const key = propMatch[1];
|
|
21
|
+
const value = propMatch[2];
|
|
22
|
+
// @ts-ignore
|
|
23
|
+
props[key] = value;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return props;
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
return components;
|
|
30
|
+
};
|