@eventcatalog/core 2.21.5 → 2.22.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-6HZQETSS.js} +1 -1
- package/dist/{chunk-XLSTKMWD.js → chunk-NQSIMY3C.js} +1 -1
- package/dist/{chunk-UYXIOPEC.js → chunk-O3MRQUYC.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 +3 -0
- package/dist/eventcatalog.config.d.ts +3 -0
- package/dist/eventcatalog.js +3 -3
- package/eventcatalog/src/content/config.ts +2 -0
- 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
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
log_build_default
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
5
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-O3MRQUYC.js";
|
|
4
|
+
import "../chunk-6HZQETSS.js";
|
|
5
|
+
import "../chunk-NQSIMY3C.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,14 +6,14 @@ import {
|
|
|
6
6
|
} from "./chunk-OW2FQPYP.js";
|
|
7
7
|
import {
|
|
8
8
|
log_build_default
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-O3MRQUYC.js";
|
|
10
|
+
import "./chunk-6HZQETSS.js";
|
|
11
11
|
import {
|
|
12
12
|
catalogToAstro
|
|
13
13
|
} from "./chunk-CXKIF3EI.js";
|
|
14
14
|
import {
|
|
15
15
|
VERSION
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-NQSIMY3C.js";
|
|
17
17
|
import {
|
|
18
18
|
isBackstagePluginEnabled
|
|
19
19
|
} from "./chunk-XMDPVKIJ.js";
|
|
@@ -269,6 +269,7 @@ const users = defineCollection({
|
|
|
269
269
|
ownedCommands: z.array(reference('commands')).optional(),
|
|
270
270
|
ownedQueries: z.array(reference('queries')).optional(),
|
|
271
271
|
associatedTeams: z.array(reference('teams')).optional(),
|
|
272
|
+
pathToFile: z.string().optional(),
|
|
272
273
|
}),
|
|
273
274
|
});
|
|
274
275
|
|
|
@@ -288,6 +289,7 @@ const teams = defineCollection({
|
|
|
288
289
|
ownedDomains: z.array(reference('domains')).optional(),
|
|
289
290
|
ownedServices: z.array(reference('services')).optional(),
|
|
290
291
|
ownedEvents: z.array(reference('events')).optional(),
|
|
292
|
+
pathToFile: z.string().optional(),
|
|
291
293
|
}),
|
|
292
294
|
});
|
|
293
295
|
|
|
@@ -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
|
+
};
|