@eventcatalog/core 3.3.1 → 3.4.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.
Files changed (34) 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-IFELNUKH.js → chunk-56E6QDHD.js} +1 -1
  6. package/dist/{chunk-AJ7F2ASU.js → chunk-6AW5YJSJ.js} +1 -1
  7. package/dist/{chunk-B5CNGEHG.js → chunk-7CV7NFRY.js} +1 -1
  8. package/dist/{chunk-LZMHPUTE.js → chunk-IVLW66F7.js} +1 -1
  9. package/dist/{chunk-DXXGEMLA.js → chunk-SPL7HGIZ.js} +1 -1
  10. package/dist/constants.cjs +1 -1
  11. package/dist/constants.js +1 -1
  12. package/dist/eventcatalog.cjs +1 -1
  13. package/dist/eventcatalog.js +5 -5
  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 +1 -0
  20. package/eventcatalog/src/enterprise/ai/chat-api.ts +27 -83
  21. package/eventcatalog/src/enterprise/custom-documentation/pages/docs/custom/index.astro +21 -142
  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/env.d.ts +11 -0
  26. package/eventcatalog/src/pages/diagrams/[id]/[version]/embed.astro +433 -10
  27. package/eventcatalog/src/pages/diagrams/[id]/[version]/index.astro +21 -100
  28. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/index.astro +26 -141
  29. package/eventcatalog/src/pages/docs/[type]/[id]/[version].mdx.ts +0 -4
  30. package/eventcatalog/src/types/mcp-modules.d.ts +66 -0
  31. package/eventcatalog/src/utils/feature.ts +2 -0
  32. package/eventcatalog/src/utils/mermaid-zoom.ts +751 -0
  33. package/eventcatalog/tsconfig.json +1 -1
  34. package/package.json +4 -1
@@ -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.1";
40
+ var version = "3.4.1";
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-LZMHPUTE.js";
4
- import "../chunk-B5CNGEHG.js";
3
+ } from "../chunk-IVLW66F7.js";
4
+ import "../chunk-7CV7NFRY.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.1";
109
+ var version = "3.4.1";
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-AJ7F2ASU.js";
4
- import "../chunk-LZMHPUTE.js";
5
- import "../chunk-B5CNGEHG.js";
3
+ } from "../chunk-6AW5YJSJ.js";
4
+ import "../chunk-IVLW66F7.js";
5
+ import "../chunk-7CV7NFRY.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
  logger
3
- } from "./chunk-DXXGEMLA.js";
3
+ } from "./chunk-SPL7HGIZ.js";
4
4
  import {
5
5
  cleanup,
6
6
  getEventCatalogConfigFile
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  raiseEvent
3
- } from "./chunk-LZMHPUTE.js";
3
+ } from "./chunk-IVLW66F7.js";
4
4
  import {
5
5
  getEventCatalogConfigFile,
6
6
  verifyRequiredFieldsAreInCatalogConfigFile
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "3.3.1";
2
+ var version = "3.4.1";
3
3
 
4
4
  // src/constants.ts
5
5
  var VERSION = version;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VERSION
3
- } from "./chunk-B5CNGEHG.js";
3
+ } from "./chunk-7CV7NFRY.js";
4
4
 
5
5
  // src/analytics/analytics.js
6
6
  import axios from "axios";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VERSION
3
- } from "./chunk-B5CNGEHG.js";
3
+ } from "./chunk-7CV7NFRY.js";
4
4
 
5
5
  // src/utils/cli-logger.ts
6
6
  import pc from "picocolors";
@@ -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.1";
28
+ var version = "3.4.1";
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-B5CNGEHG.js";
3
+ } from "./chunk-7CV7NFRY.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.1";
112
+ var version = "3.4.1";
113
113
 
114
114
  // src/constants.ts
115
115
  var VERSION = version;
@@ -6,8 +6,8 @@ import {
6
6
  } from "./chunk-PLNJC7NZ.js";
7
7
  import {
8
8
  log_build_default
9
- } from "./chunk-AJ7F2ASU.js";
10
- import "./chunk-LZMHPUTE.js";
9
+ } from "./chunk-6AW5YJSJ.js";
10
+ import "./chunk-IVLW66F7.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-IFELNUKH.js";
24
+ } from "./chunk-56E6QDHD.js";
25
25
  import {
26
26
  logger
27
- } from "./chunk-DXXGEMLA.js";
27
+ } from "./chunk-SPL7HGIZ.js";
28
28
  import {
29
29
  VERSION
30
- } from "./chunk-B5CNGEHG.js";
30
+ } from "./chunk-7CV7NFRY.js";
31
31
  import "./chunk-UPONRQSN.js";
32
32
 
33
33
  // src/eventcatalog.ts
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.1";
76
+ var version = "3.4.1";
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-IFELNUKH.js";
4
- import "./chunk-DXXGEMLA.js";
5
- import "./chunk-B5CNGEHG.js";
3
+ } from "./chunk-56E6QDHD.js";
4
+ import "./chunk-SPL7HGIZ.js";
5
+ import "./chunk-7CV7NFRY.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.1";
39
+ var version = "3.4.1";
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-DXXGEMLA.js";
4
- import "../chunk-B5CNGEHG.js";
3
+ } from "../chunk-SPL7HGIZ.js";
4
+ import "../chunk-7CV7NFRY.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(),
@@ -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({
@@ -368,156 +368,35 @@ const badges = doc?.badges || [];
368
368
 
369
369
  setupObserver();
370
370
 
371
- document.addEventListener('astro:page-load', () => {
372
- const graphs = document.getElementsByClassName('mermaid');
373
- if (document.getElementsByClassName('mermaid').length > 0) {
374
- renderDiagrams(graphs);
375
- }
376
- });
377
-
378
- async function renderDiagrams(graphs: any) {
379
- const { default: mermaid } = await import('mermaid');
380
-
381
- if (window.eventcatalog.mermaid) {
382
- const { icons } = await import('@iconify-json/logos');
383
- const { iconPacks = [], enableSupportForElkLayout = false } = window.eventcatalog.mermaid ?? {};
384
-
385
- if (iconPacks.length > 0) {
386
- const iconPacksToRegister = iconPacks.map((name: string) => {
387
- return {
388
- name,
389
- icons,
390
- };
391
- });
392
-
393
- mermaid.registerIconPacks(iconPacksToRegister);
394
- }
395
-
396
- if (enableSupportForElkLayout) {
397
- // @ts-ignore
398
- const { default: elkLayouts } = await import('@mermaid-js/layout-elk/dist/mermaid-layout-elk.core.mjs');
399
- mermaid.registerLayoutLoaders(elkLayouts);
400
- }
401
- }
402
-
403
- // Detect current theme from data-theme attribute
404
- const isDarkMode = document.documentElement.getAttribute('data-theme') === 'dark';
405
- const currentTheme = isDarkMode ? 'dark' : 'default';
406
-
407
- // Custom theme variables for better readability in dark mode
408
- const darkThemeVariables = {
409
- // Sequence diagram - improve text contrast
410
- signalColor: '#f0f6fc',
411
- signalTextColor: '#f0f6fc',
412
- actorTextColor: '#0d1117',
413
- actorBkg: '#f0f6fc',
414
- actorBorder: '#484f58',
415
- actorLineColor: '#6b7280',
416
- // General text colors
417
- primaryTextColor: '#f0f6fc',
418
- secondaryTextColor: '#c9d1d9',
419
- tertiaryTextColor: '#f0f6fc',
420
- // Line colors
421
- lineColor: '#6b7280',
422
- };
423
-
424
- mermaid.initialize({
425
- // fontSize: 2,
426
- flowchart: {
427
- curve: 'linear',
428
- rankSpacing: 0,
429
- nodeSpacing: 0,
430
- },
431
- startOnLoad: false,
432
- fontFamily: 'var(--sans-font)',
433
- // @ts-ignore This works, but TS expects a enum for some reason
434
- theme: currentTheme,
435
- themeVariables: isDarkMode ? darkThemeVariables : undefined,
436
- architecture: {
437
- useMaxWidth: true,
438
- },
439
- });
440
-
441
- for (const graph of graphs) {
442
- const content = graph.getAttribute('data-content');
443
- if (!content) continue;
444
- let svg = document.createElement('svg');
445
- const id = (svg.id = 'mermaid-' + Math.round(Math.random() * 100000));
446
- graph.appendChild(svg);
447
- mermaid.render(id, content).then((result) => {
448
- graph.innerHTML = result.svg;
449
- });
450
- }
451
- }
452
-
453
- const graphs = document.getElementsByClassName('mermaid');
454
- if (document.getElementsByClassName('mermaid').length > 0) {
455
- renderDiagrams(graphs);
456
- }
457
-
458
- // Make renderDiagrams available globally for accordion component
459
- window.renderDiagrams = renderDiagrams;
460
-
461
371
  document.addEventListener('astro:page-load', setupObserver);
462
372
  </script>
463
373
 
464
374
  <script>
465
- import('pako').then(({ deflate }: any) => {
466
- document.addEventListener('astro:page-load', () => {
467
- const blocks = document.getElementsByClassName('plantuml');
468
- if (blocks.length > 0) {
469
- renderPlantUML(blocks, deflate);
470
- }
471
- });
375
+ import { destroyZoomInstances, renderMermaidWithZoom, renderPlantUMLWithZoom } from '@utils/mermaid-zoom';
472
376
 
473
- function renderPlantUML(blocks: any, deflate: any) {
474
- for (const block of blocks) {
475
- const content = block.getAttribute('data-content');
476
- if (!content) continue;
477
-
478
- const encoded = encodePlantUML(content, deflate);
479
- const img = document.createElement('img');
480
- img.src = `https://www.plantuml.com/plantuml/svg/~1${encoded}`;
481
- img.alt = 'PlantUML diagram';
482
- img.loading = 'lazy';
483
- block.innerHTML = '';
484
- img.classList.add('mx-auto');
485
- block.appendChild(img);
486
- }
487
- }
377
+ function initDiagrams() {
378
+ destroyZoomInstances();
488
379
 
489
- function encodePlantUML(text: any, deflate: any) {
490
- const utf8encoded = new TextEncoder().encode(text);
491
- const compressed = deflate(utf8encoded, { level: 9 });
492
- return encode64(compressed);
380
+ const mermaidGraphs = document.getElementsByClassName('mermaid');
381
+ if (mermaidGraphs.length > 0) {
382
+ renderMermaidWithZoom(mermaidGraphs, window.eventcatalog?.mermaid);
493
383
  }
494
384
 
495
- const encode64 = (data: any) => {
496
- const chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_';
497
- let str = '';
498
- let i = 0;
499
- while (i < data.length) {
500
- let b1 = data[i++];
501
- let b2 = i < data.length ? data[i++] : 0;
502
- let b3 = i < data.length ? data[i++] : 0;
503
-
504
- let c1 = b1 >> 2;
505
- let c2 = ((b1 & 0x3) << 4) | (b2 >> 4);
506
- let c3 = ((b2 & 0xf) << 2) | (b3 >> 6);
507
- let c4 = b3 & 0x3f;
508
-
509
- str += chars[c1] + chars[c2] + chars[c3] + chars[c4];
510
- }
511
- return str;
512
- };
513
-
514
- const graphs = document.getElementsByClassName('plantuml');
515
- if (document.getElementsByClassName('plantuml').length > 0) {
516
- renderPlantUML(graphs, deflate);
385
+ const plantumlBlocks = document.getElementsByClassName('plantuml');
386
+ if (plantumlBlocks.length > 0) {
387
+ renderPlantUMLWithZoom(plantumlBlocks);
517
388
  }
389
+ }
518
390
 
519
- window.renderPlantUML = (graphs: any) => {
520
- renderPlantUML(graphs, deflate);
521
- };
522
- });
391
+ // Run on initial load and page transitions
392
+ initDiagrams();
393
+ document.addEventListener('astro:page-load', initDiagrams);
394
+
395
+ // Make available globally for accordion component
396
+ window.renderDiagrams = (graphs: HTMLCollectionOf<Element>) => {
397
+ renderMermaidWithZoom(graphs, window.eventcatalog?.mermaid);
398
+ };
399
+ window.renderPlantUML = (blocks: HTMLCollectionOf<Element>) => {
400
+ renderPlantUMLWithZoom(blocks);
401
+ };
523
402
  </script>