@eventcatalog/core 2.45.3 → 2.47.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.45.3";
40
+ var version = "2.47.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-ZOCINDXG.js";
4
- import "../chunk-KLNIUFPG.js";
3
+ } from "../chunk-UJDCXC7T.js";
4
+ import "../chunk-LXBFFIQM.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.45.3";
109
+ var version = "2.47.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-YIR6C2W3.js";
4
- import "../chunk-ZOCINDXG.js";
5
- import "../chunk-KLNIUFPG.js";
3
+ } from "../chunk-7ZZ4EMKR.js";
4
+ import "../chunk-UJDCXC7T.js";
5
+ import "../chunk-LXBFFIQM.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
  raiseEvent
3
- } from "./chunk-ZOCINDXG.js";
3
+ } from "./chunk-UJDCXC7T.js";
4
4
  import {
5
5
  getEventCatalogConfigFile,
6
6
  verifyRequiredFieldsAreInCatalogConfigFile
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "2.45.3";
2
+ var version = "2.47.0";
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-KLNIUFPG.js";
3
+ } from "./chunk-LXBFFIQM.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 = "2.45.3";
28
+ var version = "2.47.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-KLNIUFPG.js";
3
+ } from "./chunk-LXBFFIQM.js";
4
4
  export {
5
5
  VERSION
6
6
  };
@@ -157,7 +157,7 @@ var import_axios = __toESM(require("axios"), 1);
157
157
  var import_os = __toESM(require("os"), 1);
158
158
 
159
159
  // package.json
160
- var version = "2.45.3";
160
+ var version = "2.47.0";
161
161
 
162
162
  // src/constants.ts
163
163
  var VERSION = version;
@@ -6,8 +6,8 @@ import {
6
6
  } from "./chunk-DCLTVJDP.js";
7
7
  import {
8
8
  log_build_default
9
- } from "./chunk-YIR6C2W3.js";
10
- import "./chunk-ZOCINDXG.js";
9
+ } from "./chunk-7ZZ4EMKR.js";
10
+ import "./chunk-UJDCXC7T.js";
11
11
  import {
12
12
  catalogToAstro,
13
13
  checkAndConvertMdToMdx
@@ -15,7 +15,7 @@ import {
15
15
  import "./chunk-EXAALOQA.js";
16
16
  import {
17
17
  VERSION
18
- } from "./chunk-KLNIUFPG.js";
18
+ } from "./chunk-LXBFFIQM.js";
19
19
  import {
20
20
  isAuthEnabled,
21
21
  isBackstagePluginEnabled,
@@ -4,6 +4,7 @@ import mdx from '@astrojs/mdx';
4
4
  import react from '@astrojs/react';
5
5
  import pagefind from "astro-pagefind";
6
6
  import { mermaid } from "./src/remark-plugins/mermaid"
7
+ import { plantuml } from "./src/remark-plugins/plantuml"
7
8
  import { join } from 'node:path';
8
9
  import remarkDirective from 'remark-directive';
9
10
  import { remarkDirectives } from "./src/remark-plugins/directives"
@@ -60,7 +61,7 @@ export default defineConfig({
60
61
  mdx({
61
62
  // https://docs.astro.build/en/guides/integrations-guide/mdx/#optimize
62
63
  optimize: config.mdxOptimize || false,
63
- remarkPlugins: [remarkDirective, remarkDirectives, remarkComment, mermaid],
64
+ remarkPlugins: [remarkDirective, remarkDirectives, remarkComment, mermaid, plantuml],
64
65
  rehypePlugins: [
65
66
  rehypeSlug,
66
67
  [
@@ -68,13 +69,16 @@ export default defineConfig({
68
69
  {
69
70
  behavior: 'append',
70
71
  properties: { className: ['anchor-link'] },
71
-
72
+
72
73
  },
73
74
  ],
74
75
  ],
75
76
  gfm: true,
76
77
  }),
77
78
  config.output !== 'server' && pagefind(),
79
+ config.output !== 'server' && (await import("astro-compress")).default({
80
+ Logger: 0,
81
+ }),
78
82
  ].filter(Boolean),
79
83
  vite: {
80
84
  define: {
@@ -76,9 +76,6 @@ const ServiceItem = React.memo(
76
76
  isVisualizer: boolean;
77
77
  searchTerm: string;
78
78
  }) => {
79
- const asyncAPISpecifications = item.specifications?.filter((spec) => spec.type === 'asyncapi');
80
- const openAPISpecifications = item.specifications?.filter((spec) => spec.type === 'openapi');
81
-
82
79
  return (
83
80
  <CollapsibleGroup
84
81
  isCollapsed={collapsedGroups[item.href]}
@@ -8,6 +8,15 @@ import { getCommands } from '@utils/commands';
8
8
  import { getEvents } from '@utils/events';
9
9
  import { getQueries } from '@utils/queries';
10
10
 
11
+ const stripCollection = (collection: any) => {
12
+ return collection.map((item: any) => ({
13
+ data: {
14
+ id: item.data.id,
15
+ version: item.data.version,
16
+ },
17
+ }));
18
+ };
19
+
11
20
  export async function getResourcesForNavigation({ currentPath }: { currentPath: string }) {
12
21
  const events = await getEvents({ getAllVersions: false });
13
22
  const commands = await getCommands({ getAllVersions: false });
@@ -45,15 +54,33 @@ export async function getResourcesForNavigation({ currentPath }: { currentPath:
45
54
  const entities = isCollectionDomain || isCollectionService ? item.data.entities || null : null;
46
55
  // Add href to the sends and receives
47
56
  const sendsWithHref = sends?.map((send: any) => ({
48
- ...send,
57
+ id: send.data.id,
58
+ data: {
59
+ name: send.data.name,
60
+ sidebar: send.data.sidebar,
61
+ aggregateRoot: send?.data?.aggregateRoot,
62
+ },
63
+ collection: send.collection,
49
64
  href: buildUrl(`/${route}/${send.collection}/${send.data.id}/${send.data.version}`),
50
65
  }));
51
66
  const receivesWithHref = receives?.map((receive: any) => ({
52
- ...receive,
67
+ id: receive.data.id,
68
+ data: {
69
+ name: receive.data.name,
70
+ sidebar: receive.data.sidebar,
71
+ aggregateRoot: receive?.data?.aggregateRoot,
72
+ },
73
+ collection: receive.collection,
53
74
  href: buildUrl(`/${route}/${receive.collection}/${receive.data.id}/${receive.data.version}`),
54
75
  }));
55
76
  const entitiesWithHref = entities?.map((entity: any) => ({
56
- ...entity,
77
+ id: entity.data.id,
78
+ data: {
79
+ name: entity.data.name,
80
+ sidebar: entity.data.sidebar,
81
+ aggregateRoot: entity?.data?.aggregateRoot,
82
+ },
83
+ collection: entity.collection,
57
84
  href: buildUrl(`/${route}/${entity.collection}/${entity.data.id}/${entity.data.version}`),
58
85
  }));
59
86
 
@@ -76,8 +103,8 @@ export async function getResourcesForNavigation({ currentPath }: { currentPath:
76
103
  servicesCount,
77
104
  id: item.data.id,
78
105
  name: item.data.name,
79
- services: isCollectionDomain ? item.data.services : null,
80
- domains: isCollectionDomain ? item.data.domains : null,
106
+ services: isCollectionDomain ? stripCollection(item.data.services) : null,
107
+ domains: isCollectionDomain ? stripCollection(item.data.domains) : null,
81
108
  sends: sendsWithHref,
82
109
  receives: receivesWithHref,
83
110
  entities: entitiesWithHref,
@@ -19,10 +19,10 @@ let props;
19
19
 
20
20
  const SIDENAV_TYPE = config?.docs?.sidebar?.type ?? 'LIST_VIEW';
21
21
 
22
- if (SIDENAV_TYPE === 'TREE_VIEW') {
23
- props = getTreeView({ projectDir: process.env.PROJECT_DIR!, currentPath });
24
- } else if (SIDENAV_TYPE === 'LIST_VIEW') {
22
+ if (SIDENAV_TYPE === 'LIST_VIEW') {
25
23
  props = await getListViewResources({ currentPath });
24
+ } else if (SIDENAV_TYPE === 'TREE_VIEW') {
25
+ props = getTreeView({ projectDir: process.env.PROJECT_DIR!, currentPath });
26
26
  }
27
27
  ---
28
28
 
@@ -412,3 +412,60 @@ const badges = doc?.badges || [];
412
412
 
413
413
  document.addEventListener('astro:page-load', setupObserver);
414
414
  </script>
415
+
416
+ <script>
417
+ import('pako').then(({ deflate }: any) => {
418
+ document.addEventListener('astro:page-load', () => {
419
+ const blocks = document.getElementsByClassName('plantuml');
420
+ if (blocks.length > 0) {
421
+ renderPlantUML(blocks, deflate);
422
+ }
423
+ });
424
+
425
+ function renderPlantUML(blocks: any, deflate: any) {
426
+ for (const block of blocks) {
427
+ const content = block.getAttribute('data-content');
428
+ if (!content) continue;
429
+
430
+ const encoded = encodePlantUML(content, deflate);
431
+ const img = document.createElement('img');
432
+ img.src = `https://www.plantuml.com/plantuml/svg/~1${encoded}`;
433
+ img.alt = 'PlantUML diagram';
434
+ img.loading = 'lazy';
435
+ block.innerHTML = '';
436
+ img.classList.add('mx-auto');
437
+ block.appendChild(img);
438
+ }
439
+ }
440
+
441
+ function encodePlantUML(text: any, deflate: any) {
442
+ const utf8encoded = new TextEncoder().encode(text);
443
+ const compressed = deflate(utf8encoded, { level: 9 });
444
+ return encode64(compressed);
445
+ }
446
+
447
+ const encode64 = (data: any) => {
448
+ const chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_';
449
+ let str = '';
450
+ let i = 0;
451
+ while (i < data.length) {
452
+ let b1 = data[i++];
453
+ let b2 = i < data.length ? data[i++] : 0;
454
+ let b3 = i < data.length ? data[i++] : 0;
455
+
456
+ let c1 = b1 >> 2;
457
+ let c2 = ((b1 & 0x3) << 4) | (b2 >> 4);
458
+ let c3 = ((b2 & 0xf) << 2) | (b3 >> 6);
459
+ let c4 = b3 & 0x3f;
460
+
461
+ str += chars[c1] + chars[c2] + chars[c3] + chars[c4];
462
+ }
463
+ return str;
464
+ };
465
+
466
+ const graphs = document.getElementsByClassName('plantuml');
467
+ if (document.getElementsByClassName('plantuml').length > 0) {
468
+ renderPlantUML(graphs, deflate);
469
+ }
470
+ });
471
+ </script>
@@ -459,4 +459,62 @@ nodeGraphs.push({
459
459
  renderDiagrams(graphs);
460
460
  }
461
461
  </script>
462
+
463
+ <script>
464
+ import('pako').then(({ deflate }: any) => {
465
+ document.addEventListener('astro:page-load', () => {
466
+ const blocks = document.getElementsByClassName('plantuml');
467
+ if (blocks.length > 0) {
468
+ renderPlantUML(blocks, deflate);
469
+ }
470
+ });
471
+
472
+ function renderPlantUML(blocks: any, deflate: any) {
473
+ for (const block of blocks) {
474
+ const content = block.getAttribute('data-content');
475
+ if (!content) continue;
476
+
477
+ const encoded = encodePlantUML(content, deflate);
478
+ const img = document.createElement('img');
479
+ img.src = `https://www.plantuml.com/plantuml/svg/~1${encoded}`;
480
+ img.alt = 'PlantUML diagram';
481
+ img.loading = 'lazy';
482
+ block.innerHTML = '';
483
+ // Add class to the img
484
+ img.classList.add('mx-auto');
485
+ block.appendChild(img);
486
+ }
487
+ }
488
+
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);
493
+ }
494
+
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);
517
+ }
518
+ });
519
+ </script>
462
520
  </VerticalSideBarLayout>
@@ -18,9 +18,11 @@ export const mermaid: RemarkPlugin<[]> = () => (tree) => {
18
18
  // @ts-ignore test
19
19
  node.type = 'html';
20
20
  node.value = `
21
- <div class="mermaid" data-content="${escapeHtml(node.value)}">
21
+ <div class="mermaid-block pb-4">
22
+ <div class="mermaid border border-gray-200 rounded-lg p-1" data-content="${escapeHtml(node.value)}">
22
23
  <p>Loading graph...</p>
23
24
  </div>
25
+ </div>
24
26
  `;
25
27
  });
26
28
  };
@@ -0,0 +1,40 @@
1
+ import type { RemarkPlugin } from '@astrojs/markdown-remark';
2
+ import { visit } from 'unist-util-visit';
3
+
4
+ const escapeMap: Record<string, string> = {
5
+ '&': '&amp;',
6
+ '<': '&lt;',
7
+ '>': '&gt;',
8
+ '"': '&quot;',
9
+ "'": '&#39;',
10
+ };
11
+
12
+ const escapeHtml = (str: string) => str.replace(/[&<>"']/g, (c) => escapeMap[c]);
13
+
14
+ function extractTitle(meta: string | undefined): string | null {
15
+ if (!meta) return null;
16
+ const match = meta.match(/title="([^"]+)"/);
17
+ return match ? match[1] : null;
18
+ }
19
+
20
+ export const plantuml: RemarkPlugin<[]> = () => (tree) => {
21
+ visit(tree, 'code', (node) => {
22
+ if (node.lang !== 'plantuml') return;
23
+
24
+ // @ts-ignore
25
+ const title = extractTitle(node.meta);
26
+ const escapedContent = escapeHtml(node.value);
27
+ const escapedTitle = title ? escapeHtml(title) : null;
28
+
29
+ // @ts-ignore
30
+ node.type = 'html';
31
+ node.value = `
32
+ <div class="plantuml-block pb-4">
33
+ ${escapedTitle ? `<h2 class="plantuml-title">${escapedTitle}</h2>` : ''}
34
+ <div class="plantuml border border-gray-200 rounded-lg p-1" data-content="${escapedContent}">
35
+ <p>Rendering PlantUML diagram...</p>
36
+ </div>
37
+ </div>
38
+ `;
39
+ });
40
+ };
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.45.3",
9
+ "version": "2.47.0",
10
10
  "publishConfig": {
11
11
  "access": "public"
12
12
  },
@@ -56,6 +56,7 @@
56
56
  "@xyflow/react": "^12.3.6",
57
57
  "ai": "^4.3.9",
58
58
  "astro": "^5.9.3",
59
+ "astro-compress": "^2.3.8",
59
60
  "astro-expressive-code": "^0.40.1",
60
61
  "astro-pagefind": "^1.6.0",
61
62
  "astro-seo": "^0.8.4",
@@ -81,6 +82,7 @@
81
82
  "lucide-react": "^0.453.0",
82
83
  "marked": "^15.0.6",
83
84
  "mermaid": "^11.4.1",
85
+ "pako": "^2.1.0",
84
86
  "react": "^18.3.1",
85
87
  "react-dom": "^18.3.1",
86
88
  "react-markdown": "^10.1.0",
@@ -110,6 +112,7 @@
110
112
  "@types/lodash.debounce": "^4.0.9",
111
113
  "@types/lodash.merge": "4.6.9",
112
114
  "@types/node": "^20.14.2",
115
+ "@types/pako": "^2.0.3",
113
116
  "@types/react": "^18.3.3",
114
117
  "@types/react-dom": "^18.3.0",
115
118
  "@types/react-syntax-highlighter": "^15.5.13",