@eventcatalog/core 3.2.2 → 3.3.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 (48) 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-7YZYT44Y.js → chunk-I4CMEOEN.js} +1 -1
  6. package/dist/{chunk-34AD2NAO.js → chunk-NGKYYZZP.js} +1 -1
  7. package/dist/{chunk-AETVSFIG.js → chunk-OAUYXPXT.js} +1 -1
  8. package/dist/{chunk-6OFLYNWB.js → chunk-QZF5ZYJB.js} +1 -1
  9. package/dist/{chunk-JPKOTGEV.js → chunk-UPSN5H7S.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/src/components/ChatPanel/ChatPanel.tsx +9 -0
  19. package/eventcatalog/src/components/ChatPanel/ChatPanelButton.tsx +11 -1
  20. package/eventcatalog/src/components/CopyAsMarkdown.tsx +47 -28
  21. package/eventcatalog/src/content.config.ts +18 -0
  22. package/eventcatalog/src/enterprise/ai/chat-api.ts +24 -2
  23. package/eventcatalog/src/pages/diagrams/[id]/[version]/_index.data.ts +57 -0
  24. package/eventcatalog/src/pages/diagrams/[id]/[version]/embed.astro +267 -0
  25. package/eventcatalog/src/pages/diagrams/[id]/[version]/index.astro +411 -0
  26. package/eventcatalog/src/pages/diagrams/[id]/[version].mdx.ts +47 -0
  27. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/index.astro +1 -0
  28. package/eventcatalog/src/pages/docs/[type]/[id]/[version].md.ts +3 -2
  29. package/eventcatalog/src/pages/docs/[type]/[id]/[version].mdx.ts +5 -1
  30. package/eventcatalog/src/pages/docs/[type]/[id]/language.mdx.ts +2 -1
  31. package/eventcatalog/src/pages/docs/custom/[...path].mdx.ts +2 -2
  32. package/eventcatalog/src/pages/docs/teams/[id].md.ts +3 -2
  33. package/eventcatalog/src/pages/docs/teams/[id].mdx.ts +3 -3
  34. package/eventcatalog/src/pages/docs/users/[id].md.ts +3 -2
  35. package/eventcatalog/src/pages/docs/users/[id].mdx.ts +3 -3
  36. package/eventcatalog/src/stores/sidebar-store/builders/container.ts +20 -4
  37. package/eventcatalog/src/stores/sidebar-store/builders/domain.ts +20 -12
  38. package/eventcatalog/src/stores/sidebar-store/builders/flow.ts +1 -1
  39. package/eventcatalog/src/stores/sidebar-store/builders/message.ts +20 -4
  40. package/eventcatalog/src/stores/sidebar-store/builders/service.ts +18 -6
  41. package/eventcatalog/src/stores/sidebar-store/builders/shared.ts +20 -0
  42. package/eventcatalog/src/stores/sidebar-store/state.ts +34 -6
  43. package/eventcatalog/src/types/index.ts +4 -2
  44. package/eventcatalog/src/utils/collections/diagrams.ts +64 -0
  45. package/eventcatalog/src/utils/collections/util.ts +2 -0
  46. package/eventcatalog/src/utils/feature.ts +4 -2
  47. package/eventcatalog/src/utils/page-loaders/page-data-loader.ts +2 -0
  48. package/package.json +2 -2
@@ -0,0 +1,64 @@
1
+ import { getCollection } from 'astro:content';
2
+ import type { CollectionEntry } from 'astro:content';
3
+ import path from 'path';
4
+ import { createVersionedMap } from '@utils/collections/util';
5
+
6
+ const CACHE_ENABLED = process.env.DISABLE_EVENTCATALOG_CACHE !== 'true';
7
+ export type Diagram = CollectionEntry<'diagrams'>;
8
+
9
+ interface Props {
10
+ getAllVersions?: boolean;
11
+ }
12
+
13
+ // Cache for build time
14
+ let memoryCache: Record<string, Diagram[]> = {};
15
+
16
+ export const getDiagrams = async ({ getAllVersions = true }: Props = {}): Promise<Diagram[]> => {
17
+ const cacheKey = getAllVersions ? 'allVersions' : 'currentVersions';
18
+
19
+ if (memoryCache[cacheKey] && memoryCache[cacheKey].length > 0 && CACHE_ENABLED) {
20
+ return memoryCache[cacheKey];
21
+ }
22
+
23
+ const allDiagrams = await getCollection('diagrams');
24
+
25
+ // Build optimized map for version lookups
26
+ const diagramMap = createVersionedMap(allDiagrams);
27
+
28
+ // Filter diagrams
29
+ const targetDiagrams = allDiagrams.filter((diagram) => {
30
+ if (!getAllVersions && diagram.filePath?.includes('versioned')) return false;
31
+ return true;
32
+ });
33
+
34
+ // Enrich diagrams with version info
35
+ const processedDiagrams = targetDiagrams.map((diagram) => {
36
+ const diagramVersions = diagramMap.get(diagram.data.id) || [];
37
+ const latestVersion = diagramVersions[0]?.data.version || diagram.data.version;
38
+ const versions = diagramVersions.map((d) => d.data.version);
39
+
40
+ return {
41
+ ...diagram,
42
+ data: {
43
+ ...diagram.data,
44
+ versions,
45
+ latestVersion,
46
+ },
47
+ catalog: {
48
+ path: path.join(diagram.collection, diagram.id.replace('/index.mdx', '')),
49
+ filePath: path.join(process.cwd(), 'src', 'catalog-files', diagram.collection, diagram.id.replace('/index.mdx', '')),
50
+ publicPath: path.join('/generated', diagram.collection),
51
+ type: 'diagram',
52
+ },
53
+ };
54
+ });
55
+
56
+ // Sort by name
57
+ processedDiagrams.sort((a, b) => {
58
+ return (a.data.name || a.data.id).localeCompare(b.data.name || b.data.id);
59
+ });
60
+
61
+ memoryCache[cacheKey] = processedDiagrams;
62
+
63
+ return processedDiagrams;
64
+ };
@@ -117,6 +117,7 @@ export const resourceToCollectionMap = {
117
117
  team: 'teams',
118
118
  container: 'containers',
119
119
  entity: 'entities',
120
+ diagram: 'diagrams',
120
121
  } as const;
121
122
 
122
123
  export const collectionToResourceMap = {
@@ -131,6 +132,7 @@ export const collectionToResourceMap = {
131
132
  teams: 'team',
132
133
  containers: 'container',
133
134
  entities: 'entity',
135
+ diagrams: 'diagram',
134
136
  } as const;
135
137
 
136
138
  export const getDeprecatedDetails = (item: CollectionEntry<CollectionTypes>) => {
@@ -50,8 +50,8 @@ export const isEventCatalogChatEnabled = () => {
50
50
  export const isEventCatalogUpgradeEnabled = () => !isEventCatalogStarterEnabled() && !isEventCatalogScaleEnabled();
51
51
  export const isCustomLandingPageEnabled = () => isEventCatalogStarterEnabled() || isEventCatalogScaleEnabled();
52
52
 
53
- export const isMarkdownDownloadEnabled = () => config?.llmsTxt?.enabled ?? false;
54
- export const isLLMSTxtEnabled = () => (config?.llmsTxt?.enabled || isEventCatalogChatEnabled()) ?? true;
53
+ export const isMarkdownDownloadEnabled = () => config?.llmsTxt?.enabled ?? true;
54
+ export const isLLMSTxtEnabled = () => config?.llmsTxt?.enabled ?? true;
55
55
 
56
56
  export const isAuthEnabled = () => {
57
57
  const isAuthEnabledInCatalog = config?.auth?.enabled ?? false;
@@ -67,3 +67,5 @@ export const isVisualiserEnabled = () => config?.visualiser?.enabled ?? true;
67
67
  export const isCustomStylesEnabled = () => {
68
68
  return isEventCatalogStarterEnabled() || isEventCatalogScaleEnabled();
69
69
  };
70
+
71
+ export const isDiagramComparisonEnabled = () => isEventCatalogScaleEnabled();
@@ -7,6 +7,7 @@ import { getServices } from '@utils/collections/services';
7
7
  import { getFlows } from '@utils/collections/flows';
8
8
  import { getEntities } from '@utils/collections/entities';
9
9
  import { getContainers } from '@utils/collections/containers';
10
+ import { getDiagrams } from '@utils/collections/diagrams';
10
11
  import type { CollectionEntry } from 'astro:content';
11
12
 
12
13
  export const pageDataLoader: Record<PageTypes, () => Promise<CollectionEntry<CollectionTypes>[]>> = {
@@ -19,4 +20,5 @@ export const pageDataLoader: Record<PageTypes, () => Promise<CollectionEntry<Col
19
20
  flows: getFlows,
20
21
  entities: getEntities,
21
22
  containers: getContainers,
23
+ diagrams: getDiagrams,
22
24
  };
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": "3.2.2",
9
+ "version": "3.3.0",
10
10
  "publishConfig": {
11
11
  "access": "public"
12
12
  },
@@ -34,7 +34,7 @@
34
34
  "@eventcatalog/generator-ai": "^1.1.0",
35
35
  "@eventcatalog/license": "^0.0.7",
36
36
  "@eventcatalog/linter": "^0.0.2",
37
- "@eventcatalog/sdk": "^2.9.9",
37
+ "@eventcatalog/sdk": "^2.10.0",
38
38
  "@eventcatalog/visualizer": "^0.0.6",
39
39
  "@fontsource/inter": "^5.2.5",
40
40
  "@headlessui/react": "^2.0.3",