@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.
@@ -37,7 +37,7 @@ var import_axios = __toESM(require("axios"), 1);
37
37
  var import_os = __toESM(require("os"), 1);
38
38
 
39
39
  // package.json
40
- var version = "2.21.5";
40
+ var version = "2.22.0";
41
41
 
42
42
  // src/constants.ts
43
43
  var VERSION = version;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  raiseEvent
3
- } from "../chunk-FZHOYLWJ.js";
4
- import "../chunk-XLSTKMWD.js";
3
+ } from "../chunk-6HZQETSS.js";
4
+ import "../chunk-NQSIMY3C.js";
5
5
  export {
6
6
  raiseEvent
7
7
  };
@@ -106,7 +106,7 @@ var import_axios = __toESM(require("axios"), 1);
106
106
  var import_os = __toESM(require("os"), 1);
107
107
 
108
108
  // package.json
109
- var version = "2.21.5";
109
+ var version = "2.22.0";
110
110
 
111
111
  // src/constants.ts
112
112
  var VERSION = version;
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  log_build_default
3
- } from "../chunk-UYXIOPEC.js";
4
- import "../chunk-FZHOYLWJ.js";
5
- import "../chunk-XLSTKMWD.js";
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
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VERSION
3
- } from "./chunk-XLSTKMWD.js";
3
+ } from "./chunk-NQSIMY3C.js";
4
4
 
5
5
  // src/analytics/analytics.js
6
6
  import axios from "axios";
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "2.21.5";
2
+ var version = "2.22.0";
3
3
 
4
4
  // src/constants.ts
5
5
  var VERSION = version;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  raiseEvent
3
- } from "./chunk-FZHOYLWJ.js";
3
+ } from "./chunk-6HZQETSS.js";
4
4
  import {
5
5
  getEventCatalogConfigFile,
6
6
  verifyRequiredFieldsAreInCatalogConfigFile
@@ -25,7 +25,7 @@ __export(constants_exports, {
25
25
  module.exports = __toCommonJS(constants_exports);
26
26
 
27
27
  // package.json
28
- var version = "2.21.5";
28
+ var version = "2.22.0";
29
29
 
30
30
  // src/constants.ts
31
31
  var VERSION = version;
package/dist/constants.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VERSION
3
- } from "./chunk-XLSTKMWD.js";
3
+ } from "./chunk-NQSIMY3C.js";
4
4
  export {
5
5
  VERSION
6
6
  };
@@ -161,7 +161,7 @@ var import_axios = __toESM(require("axios"), 1);
161
161
  var import_os = __toESM(require("os"), 1);
162
162
 
163
163
  // package.json
164
- var version = "2.21.5";
164
+ var version = "2.22.0";
165
165
 
166
166
  // src/constants.ts
167
167
  var VERSION = version;
@@ -19,6 +19,9 @@ interface Config {
19
19
  enabled: boolean;
20
20
  limit: number;
21
21
  };
22
+ llmsTxt?: {
23
+ enabled: boolean;
24
+ };
22
25
  logo?: {
23
26
  alt: string;
24
27
  src: string;
@@ -19,6 +19,9 @@ interface Config {
19
19
  enabled: boolean;
20
20
  limit: number;
21
21
  };
22
+ llmsTxt?: {
23
+ enabled: boolean;
24
+ };
22
25
  logo?: {
23
26
  alt: string;
24
27
  src: string;
@@ -6,14 +6,14 @@ import {
6
6
  } from "./chunk-OW2FQPYP.js";
7
7
  import {
8
8
  log_build_default
9
- } from "./chunk-UYXIOPEC.js";
10
- import "./chunk-FZHOYLWJ.js";
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-XLSTKMWD.js";
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
+ };
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.21.5",
9
+ "version": "2.22.0",
10
10
  "publishConfig": {
11
11
  "access": "public"
12
12
  },