@eventcatalog/core 3.3.0 → 3.4.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.
Files changed (32) hide show
  1. package/dist/analytics/analytics.cjs +1 -1
  2. package/dist/analytics/analytics.js +2 -2
  3. package/dist/analytics/log-build.cjs +1 -1
  4. package/dist/analytics/log-build.js +3 -3
  5. package/dist/{chunk-I4CMEOEN.js → chunk-GLMX3ZTY.js} +1 -1
  6. package/dist/{chunk-NGKYYZZP.js → chunk-KFZIBXRQ.js} +1 -1
  7. package/dist/{chunk-QZF5ZYJB.js → chunk-MJRHV77M.js} +1 -1
  8. package/dist/{chunk-UPSN5H7S.js → chunk-Q4DKMESA.js} +1 -1
  9. package/dist/{chunk-OAUYXPXT.js → chunk-VAGFX36R.js} +1 -1
  10. package/dist/constants.cjs +1 -1
  11. package/dist/constants.js +1 -1
  12. package/dist/eventcatalog.cjs +4 -3
  13. package/dist/eventcatalog.js +8 -7
  14. package/dist/generate.cjs +1 -1
  15. package/dist/generate.js +3 -3
  16. package/dist/utils/cli-logger.cjs +1 -1
  17. package/dist/utils/cli-logger.js +2 -2
  18. package/eventcatalog/integrations/eventcatalog-features.ts +9 -0
  19. package/eventcatalog/src/content.config.ts +9 -6
  20. package/eventcatalog/src/enterprise/ai/chat-api.ts +27 -83
  21. package/eventcatalog/src/enterprise/custom-documentation/pages/docs/custom/index.astro +1 -0
  22. package/eventcatalog/src/enterprise/mcp/mcp-server.ts +512 -0
  23. package/eventcatalog/src/enterprise/tools/catalog-tools.ts +690 -0
  24. package/eventcatalog/src/enterprise/tools/index.ts +5 -0
  25. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/asyncapi/[filename].astro +24 -1
  26. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/index.astro +2 -0
  27. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/spec/[filename].astro +22 -1
  28. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/spec/_OpenAPI.tsx +28 -4
  29. package/eventcatalog/src/pages/docs/[type]/[id]/[version].mdx.ts +0 -4
  30. package/eventcatalog/src/utils/feature.ts +2 -0
  31. package/eventcatalog/tsconfig.json +1 -1
  32. package/package.json +4 -2
@@ -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 = "3.3.0";
40
+ var version = "3.4.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-OAUYXPXT.js";
4
- import "../chunk-NGKYYZZP.js";
3
+ } from "../chunk-VAGFX36R.js";
4
+ import "../chunk-KFZIBXRQ.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 = "3.3.0";
109
+ var version = "3.4.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-UPSN5H7S.js";
4
- import "../chunk-OAUYXPXT.js";
5
- import "../chunk-NGKYYZZP.js";
3
+ } from "../chunk-Q4DKMESA.js";
4
+ import "../chunk-VAGFX36R.js";
5
+ import "../chunk-KFZIBXRQ.js";
6
6
  import "../chunk-UPONRQSN.js";
7
7
  export {
8
8
  log_build_default as default
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VERSION
3
- } from "./chunk-NGKYYZZP.js";
3
+ } from "./chunk-KFZIBXRQ.js";
4
4
 
5
5
  // src/utils/cli-logger.ts
6
6
  import pc from "picocolors";
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "3.3.0";
2
+ var version = "3.4.0";
3
3
 
4
4
  // src/constants.ts
5
5
  var VERSION = version;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  logger
3
- } from "./chunk-I4CMEOEN.js";
3
+ } from "./chunk-GLMX3ZTY.js";
4
4
  import {
5
5
  cleanup,
6
6
  getEventCatalogConfigFile
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  raiseEvent
3
- } from "./chunk-OAUYXPXT.js";
3
+ } from "./chunk-VAGFX36R.js";
4
4
  import {
5
5
  getEventCatalogConfigFile,
6
6
  verifyRequiredFieldsAreInCatalogConfigFile
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VERSION
3
- } from "./chunk-NGKYYZZP.js";
3
+ } from "./chunk-KFZIBXRQ.js";
4
4
 
5
5
  // src/analytics/analytics.js
6
6
  import axios from "axios";
@@ -25,7 +25,7 @@ __export(constants_exports, {
25
25
  module.exports = __toCommonJS(constants_exports);
26
26
 
27
27
  // package.json
28
- var version = "3.3.0";
28
+ var version = "3.4.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-NGKYYZZP.js";
3
+ } from "./chunk-KFZIBXRQ.js";
4
4
  export {
5
5
  VERSION
6
6
  };
@@ -109,7 +109,7 @@ var verifyRequiredFieldsAreInCatalogConfigFile = async (projectDirectory) => {
109
109
  var import_picocolors = __toESM(require("picocolors"), 1);
110
110
 
111
111
  // package.json
112
- var version = "3.3.0";
112
+ var version = "3.4.0";
113
113
 
114
114
  // src/constants.ts
115
115
  var VERSION = version;
@@ -843,10 +843,11 @@ var startServerCatalog = ({
843
843
  isEventCatalogStarter = false,
844
844
  isEventCatalogScale = false
845
845
  }) => {
846
+ const serverEntryPath = import_node_path8.default.join(dir, "dist", "server", "entry.mjs");
846
847
  (0, import_node_child_process.execSync)(
847
- `cross-env PROJECT_DIR='${dir}' CATALOG_DIR='${core}' ENABLE_EMBED=${canEmbedPages} EVENTCATALOG_STARTER=${isEventCatalogStarter} EVENTCATALOG_SCALE=${isEventCatalogScale} node ./dist/server/entry.mjs`,
848
+ `cross-env PROJECT_DIR='${dir}' CATALOG_DIR='${core}' ENABLE_EMBED=${canEmbedPages} EVENTCATALOG_STARTER=${isEventCatalogStarter} EVENTCATALOG_SCALE=${isEventCatalogScale} node "${serverEntryPath}"`,
848
849
  {
849
- cwd: dir,
850
+ cwd: core,
850
851
  stdio: "inherit"
851
852
  }
852
853
  );
@@ -6,8 +6,8 @@ import {
6
6
  } from "./chunk-PLNJC7NZ.js";
7
7
  import {
8
8
  log_build_default
9
- } from "./chunk-UPSN5H7S.js";
10
- import "./chunk-OAUYXPXT.js";
9
+ } from "./chunk-Q4DKMESA.js";
10
+ import "./chunk-VAGFX36R.js";
11
11
  import {
12
12
  runMigrations
13
13
  } from "./chunk-BH3JMNAV.js";
@@ -21,13 +21,13 @@ import {
21
21
  } from "./chunk-5VBIXL6C.js";
22
22
  import {
23
23
  generate
24
- } from "./chunk-QZF5ZYJB.js";
24
+ } from "./chunk-MJRHV77M.js";
25
25
  import {
26
26
  logger
27
- } from "./chunk-I4CMEOEN.js";
27
+ } from "./chunk-GLMX3ZTY.js";
28
28
  import {
29
29
  VERSION
30
- } from "./chunk-NGKYYZZP.js";
30
+ } from "./chunk-KFZIBXRQ.js";
31
31
  import "./chunk-UPONRQSN.js";
32
32
 
33
33
  // src/eventcatalog.ts
@@ -235,10 +235,11 @@ var startServerCatalog = ({
235
235
  isEventCatalogStarter = false,
236
236
  isEventCatalogScale = false
237
237
  }) => {
238
+ const serverEntryPath = path.join(dir, "dist", "server", "entry.mjs");
238
239
  execSync(
239
- `cross-env PROJECT_DIR='${dir}' CATALOG_DIR='${core}' ENABLE_EMBED=${canEmbedPages} EVENTCATALOG_STARTER=${isEventCatalogStarter} EVENTCATALOG_SCALE=${isEventCatalogScale} node ./dist/server/entry.mjs`,
240
+ `cross-env PROJECT_DIR='${dir}' CATALOG_DIR='${core}' ENABLE_EMBED=${canEmbedPages} EVENTCATALOG_STARTER=${isEventCatalogStarter} EVENTCATALOG_SCALE=${isEventCatalogScale} node "${serverEntryPath}"`,
240
241
  {
241
- cwd: dir,
242
+ cwd: core,
242
243
  stdio: "inherit"
243
244
  }
244
245
  );
package/dist/generate.cjs CHANGED
@@ -73,7 +73,7 @@ var getEventCatalogConfigFile = async (projectDirectory) => {
73
73
  var import_picocolors = __toESM(require("picocolors"), 1);
74
74
 
75
75
  // package.json
76
- var version = "3.3.0";
76
+ var version = "3.4.0";
77
77
 
78
78
  // src/constants.ts
79
79
  var VERSION = version;
package/dist/generate.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  generate
3
- } from "./chunk-QZF5ZYJB.js";
4
- import "./chunk-I4CMEOEN.js";
5
- import "./chunk-NGKYYZZP.js";
3
+ } from "./chunk-MJRHV77M.js";
4
+ import "./chunk-GLMX3ZTY.js";
5
+ import "./chunk-KFZIBXRQ.js";
6
6
  import "./chunk-UPONRQSN.js";
7
7
  export {
8
8
  generate
@@ -36,7 +36,7 @@ module.exports = __toCommonJS(cli_logger_exports);
36
36
  var import_picocolors = __toESM(require("picocolors"), 1);
37
37
 
38
38
  // package.json
39
- var version = "3.3.0";
39
+ var version = "3.4.0";
40
40
 
41
41
  // src/constants.ts
42
42
  var VERSION = version;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  logger
3
- } from "../chunk-I4CMEOEN.js";
4
- import "../chunk-NGKYYZZP.js";
3
+ } from "../chunk-GLMX3ZTY.js";
4
+ import "../chunk-KFZIBXRQ.js";
5
5
  export {
6
6
  logger
7
7
  };
@@ -5,6 +5,7 @@ import {
5
5
  isAuthEnabled,
6
6
  isEventCatalogScaleEnabled,
7
7
  isEventCatalogStarterEnabled,
8
+ isEventCatalogMCPEnabled,
8
9
  } from '../src/utils/feature';
9
10
 
10
11
  const catalogDirectory = process.env.CATALOG_DIR || process.cwd();
@@ -51,6 +52,14 @@ export default function eventCatalogIntegration(): AstroIntegration {
51
52
  });
52
53
  }
53
54
 
55
+ // Handle routes for MCP Server (requires SSR + Scale)
56
+ if (isEventCatalogMCPEnabled()) {
57
+ params.injectRoute({
58
+ pattern: '/docs/mcp/[...path]',
59
+ entrypoint: path.join(catalogDirectory, 'src/enterprise/mcp/mcp-server.ts'),
60
+ });
61
+ }
62
+
54
63
  // Handle routes for authentication
55
64
  if (isAuthEnabled()) {
56
65
  configureAuthentication(params);
@@ -448,6 +448,7 @@ const containers = defineCollection({
448
448
  owners: detailPanelPropertySchema.optional(),
449
449
  changelog: detailPanelPropertySchema.optional(),
450
450
  attachments: detailPanelPropertySchema.optional(),
451
+ services: detailPanelPropertySchema.optional(),
451
452
  })
452
453
  .optional(),
453
454
  services: z.array(reference('services')).optional(),
@@ -698,12 +699,14 @@ const diagrams = defineCollection({
698
699
  base: projectDirBase,
699
700
  generateId: ({ data }) => `${data.id}-${data.version}`,
700
701
  }),
701
- schema: z.object({
702
- id: z.string(),
703
- name: z.string(),
704
- version: z.string(),
705
- summary: z.string().optional(),
706
- }),
702
+ schema: z
703
+ .object({
704
+ id: z.string(),
705
+ name: z.string(),
706
+ version: z.string(),
707
+ summary: z.string().optional(),
708
+ })
709
+ .merge(baseSchema),
707
710
  });
708
711
 
709
712
  export const collections = {
@@ -4,8 +4,16 @@ import { join } from 'node:path';
4
4
  import { isEventCatalogScaleEnabled } from '@utils/feature';
5
5
  import { z, getCollection, getEntry } from 'astro:content';
6
6
  import { getConsumersOfMessage, getProducersOfMessage } from '@utils/collections/services';
7
- import { getSchemasFromResource } from '@utils/collections/schemas';
8
- import fs from 'fs';
7
+ import {
8
+ getResources as getResourcesImpl,
9
+ getResource as getResourceImpl,
10
+ getMessagesProducedOrConsumedByResource as getMessagesImpl,
11
+ getSchemaForResource as getSchemaImpl,
12
+ collectionSchema,
13
+ resourceCollectionSchema,
14
+ messageCollectionSchema,
15
+ toolDescriptions,
16
+ } from '@enterprise/tools/catalog-tools';
9
17
 
10
18
  const catalogDirectory = process.env.PROJECT_DIR || process.cwd();
11
19
 
@@ -187,64 +195,31 @@ export const POST = async ({ request }: APIContext<{ question: string; messages:
187
195
  // tools: tools,
188
196
  tools: {
189
197
  getResources: tool({
190
- description:
191
- 'Use this tool to get events, services, commands, queries, flows, domains, channels, entities from EventCatalog',
198
+ description: toolDescriptions.getResources,
192
199
  inputSchema: z.object({
193
- collection: z
194
- .enum([
195
- 'events',
196
- 'services',
197
- 'commands',
198
- 'queries',
199
- 'flows',
200
- 'domains',
201
- 'channels',
202
- 'entities',
203
- 'containers',
204
- 'diagrams',
205
- ])
206
- .describe('The collection to get the events from'),
200
+ collection: collectionSchema.describe('The collection to get the resources from'),
207
201
  }),
208
202
  execute: async ({ collection }) => {
209
- const resources = await getCollection(collection as any);
210
- return resources.map((resource: any) => ({
211
- id: resource.data.id,
212
- version: resource.data.version,
213
- name: resource.data.name,
214
- }));
203
+ const result = await getResourcesImpl({ collection });
204
+ if ('error' in result) return result;
205
+ return result.resources;
215
206
  },
216
207
  }),
217
208
  getResource: tool({
218
- description: 'Use this tool to get a specific resource from EventCatalog by its id and version',
209
+ description: toolDescriptions.getResource,
219
210
  inputSchema: z.object({
220
- collection: z
221
- .enum([
222
- 'events',
223
- 'services',
224
- 'commands',
225
- 'queries',
226
- 'flows',
227
- 'domains',
228
- 'channels',
229
- 'entities',
230
- 'containers',
231
- 'diagrams',
232
- ])
233
- .describe('The collection to get the events from'),
211
+ collection: collectionSchema.describe('The collection to get the resource from'),
234
212
  id: z.string().describe('The id of the resource to get'),
235
213
  version: z.string().describe('The version of the resource to get'),
236
214
  }),
237
215
  execute: async ({ collection, id, version }) => {
238
- const resource = await getEntry(collection as any, `${id}-${version}`);
239
- return resource;
216
+ return await getResourceImpl({ collection, id, version });
240
217
  },
241
218
  }),
242
219
  getProducersAndConsumersFromSchema: tool({
243
220
  description: 'Use this tool to get the producers and consumers for a schema by its id and version',
244
221
  inputSchema: z.object({
245
- collection: z
246
- .enum(['events', 'commands', 'queries'])
247
- .describe('The collection to get the producers and consumers from'),
222
+ collection: messageCollectionSchema.describe('The collection to get the producers and consumers from'),
248
223
  id: z.string().describe('The id of the message to get the producers and consumers for'),
249
224
  version: z.string().describe('The version of the message to get the producers and consumers for'),
250
225
  }),
@@ -259,24 +234,16 @@ export const POST = async ({ request }: APIContext<{ question: string; messages:
259
234
  },
260
235
  }),
261
236
  getMessagesProducedOrConsumedByResource: tool({
262
- description:
263
- 'Use this tool to get the messages produced or consumed by a resource by its id and version. Look at the `sends` and `receives` properties to get the messages produced or consumed by the resource',
237
+ description: toolDescriptions.getMessagesProducedOrConsumedByResource,
264
238
  inputSchema: z.object({
265
239
  resourceId: z.string().describe('The id of the resource to get the messages produced or consumed for'),
266
240
  resourceVersion: z.string().describe('The version of the resource to get the messages produced or consumed for'),
267
- resourceCollection: z
268
- .enum(['services', 'events', 'commands', 'queries', 'flows', 'domains', 'channels', 'entities'])
241
+ resourceCollection: resourceCollectionSchema
269
242
  .describe('The collection of the resource to get the messages produced or consumed for')
270
243
  .default('services'),
271
244
  }),
272
245
  execute: async ({ resourceId, resourceVersion, resourceCollection }) => {
273
- const resource = await getEntry(resourceCollection as any, `${resourceId}-${resourceVersion}`);
274
- if (!resource) {
275
- return {
276
- error: `Resource not found with id ${resourceId} and version ${resourceVersion} and collection ${resourceCollection}`,
277
- };
278
- }
279
- return resource;
246
+ return await getMessagesImpl({ resourceId, resourceVersion, resourceCollection });
280
247
  },
281
248
  }),
282
249
  getProducerAndConsumerForMessage: tool({
@@ -284,8 +251,7 @@ export const POST = async ({ request }: APIContext<{ question: string; messages:
284
251
  inputSchema: z.object({
285
252
  messageId: z.string().describe('The id of the message to get the producers and consumers for'),
286
253
  messageVersion: z.string().describe('The version of the message to get the producers and consumers for'),
287
- messageCollection: z
288
- .enum(['events', 'commands', 'queries'])
254
+ messageCollection: messageCollectionSchema
289
255
  .describe('The collection of the message to get the producers and consumers for')
290
256
  .default('events'),
291
257
  }),
@@ -301,8 +267,7 @@ export const POST = async ({ request }: APIContext<{ question: string; messages:
301
267
  inputSchema: z.object({
302
268
  messageId: z.string().describe('The id of the message to get the consumers for'),
303
269
  messageVersion: z.string().describe('The version of the message to get the consumers for'),
304
- messageCollection: z
305
- .enum(['events', 'commands', 'queries'])
270
+ messageCollection: messageCollectionSchema
306
271
  .describe('The collection of the message to get the consumers for')
307
272
  .default('events'),
308
273
  }),
@@ -314,37 +279,16 @@ export const POST = async ({ request }: APIContext<{ question: string; messages:
314
279
  },
315
280
  }),
316
281
  getSchemaForResource: tool({
317
- description:
318
- 'Use this tool to get the schema or specifications (openapi or asyncapi or graphql) for a resource by its id and version, you will use code blocks to render the schema to the user too',
282
+ description: toolDescriptions.getSchemaForResource,
319
283
  inputSchema: z.object({
320
284
  resourceId: z.string().describe('The id of the resource to get the schema for'),
321
285
  resourceVersion: z.string().describe('The version of the resource to get the schema for'),
322
- resourceCollection: z
323
- .enum(['services', 'events', 'commands', 'queries', 'flows', 'domains', 'channels', 'entities'])
286
+ resourceCollection: resourceCollectionSchema
324
287
  .describe('The collection of the resource to get the schema for')
325
288
  .default('services'),
326
289
  }),
327
290
  execute: async ({ resourceId, resourceVersion, resourceCollection }) => {
328
- const resource = await getEntry(resourceCollection as any, `${resourceId}-${resourceVersion}`);
329
-
330
- if (!resource) {
331
- return {
332
- error: `Resource not found with id ${resourceId} and version ${resourceVersion} and collection ${resourceCollection}`,
333
- };
334
- }
335
-
336
- const schema = await getSchemasFromResource(resource);
337
-
338
- // If we have any schemas back then read them and return them
339
- if (schema.length > 0) {
340
- return schema.map((schemaItem) => ({
341
- url: schemaItem.url,
342
- format: schemaItem.format,
343
- code: fs.readFileSync(schemaItem.url, 'utf-8'),
344
- }));
345
- }
346
-
347
- return [];
291
+ return await getSchemaImpl({ resourceId, resourceVersion, resourceCollection });
348
292
  },
349
293
  }),
350
294
  suggestFollowUpQuestions: tool({
@@ -380,6 +380,7 @@ const badges = doc?.badges || [];
380
380
 
381
381
  if (window.eventcatalog.mermaid) {
382
382
  const { icons } = await import('@iconify-json/logos');
383
+ // @ts-ignore
383
384
  const { iconPacks = [], enableSupportForElkLayout = false } = window.eventcatalog.mermaid ?? {};
384
385
 
385
386
  if (iconPacks.length > 0) {