@eventcatalog/core 3.5.2 → 3.6.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 (46) hide show
  1. package/README.md +1 -1
  2. package/dist/analytics/analytics.cjs +1 -1
  3. package/dist/analytics/analytics.js +2 -2
  4. package/dist/analytics/log-build.cjs +1 -1
  5. package/dist/analytics/log-build.js +3 -3
  6. package/dist/{chunk-YVX5C6L3.js → chunk-FCIJEGOL.js} +1 -1
  7. package/dist/{chunk-WO3AKJVB.js → chunk-N2VBSHPU.js} +1 -1
  8. package/dist/{chunk-OKWCSRLE.js → chunk-OFHFRJ42.js} +1 -1
  9. package/dist/{chunk-YOFNY2RC.js → chunk-SI6IEUYS.js} +1 -1
  10. package/dist/{chunk-YTZSPYJN.js → chunk-XRLZZXIS.js} +1 -1
  11. package/dist/constants.cjs +1 -1
  12. package/dist/constants.js +1 -1
  13. package/dist/eventcatalog.cjs +1 -1
  14. package/dist/eventcatalog.js +5 -5
  15. package/dist/generate.cjs +1 -1
  16. package/dist/generate.js +3 -3
  17. package/dist/utils/cli-logger.cjs +1 -1
  18. package/dist/utils/cli-logger.js +2 -2
  19. package/eventcatalog/astro.config.mjs +2 -1
  20. package/eventcatalog/src/components/EnvironmentDropdown.tsx +1 -1
  21. package/eventcatalog/src/components/MDX/ResourceRef/ResourceRef.astro +477 -0
  22. package/eventcatalog/src/components/MDX/components.tsx +2 -0
  23. package/eventcatalog/src/components/Search/SearchDataLoader.astro +23 -11
  24. package/eventcatalog/src/components/Search/SearchModal.tsx +17 -2
  25. package/eventcatalog/src/components/SideNav/NestedSideBar/SearchBar.tsx +12 -6
  26. package/eventcatalog/src/components/SideNav/NestedSideBar/index.tsx +37 -16
  27. package/eventcatalog/src/components/Tables/Discover/DiscoverTable.tsx +816 -0
  28. package/eventcatalog/src/components/Tables/Discover/FilterComponents.tsx +161 -0
  29. package/eventcatalog/src/components/Tables/Discover/columns.tsx +565 -0
  30. package/eventcatalog/src/components/Tables/Discover/index.ts +4 -0
  31. package/eventcatalog/src/components/Tables/columns/ContainersTableColumns.tsx +1 -1
  32. package/eventcatalog/src/components/Tables/columns/DomainTableColumns.tsx +1 -1
  33. package/eventcatalog/src/components/Tables/columns/FlowTableColumns.tsx +1 -1
  34. package/eventcatalog/src/components/Tables/columns/MessageTableColumns.tsx +1 -1
  35. package/eventcatalog/src/components/Tables/columns/ServiceTableColumns.tsx +54 -64
  36. package/eventcatalog/src/components/Tables/columns/SharedColumns.tsx +15 -30
  37. package/eventcatalog/src/enterprise/plans/index.astro +125 -98
  38. package/eventcatalog/src/layouts/VerticalSideBarLayout.astro +1 -1
  39. package/eventcatalog/src/pages/api/sidebar-data.json.ts +22 -0
  40. package/eventcatalog/src/pages/discover/[type]/_index.data.ts +5 -1
  41. package/eventcatalog/src/pages/discover/[type]/index.astro +360 -41
  42. package/eventcatalog/src/pages/docs/custom/feature.astro +45 -39
  43. package/eventcatalog/src/remark-plugins/resource-ref.ts +51 -0
  44. package/eventcatalog/src/stores/sidebar-store/builders/shared.ts +1 -1
  45. package/eventcatalog/src/stores/sidebar-store/state.ts +25 -22
  46. package/package.json +3 -2
@@ -8,7 +8,12 @@ import SearchBar from './SearchBar';
8
8
  import { saveState, loadState, saveCollapsedSections, loadCollapsedSections } from './storage';
9
9
  import { useStore } from '@nanostores/react';
10
10
  import { sidebarStore } from '@stores/sidebar-store';
11
- import { favoritesStore, toggleFavorite as toggleFavoriteAction, type FavoriteItem } from '@stores/favorites-store';
11
+ import {
12
+ favoritesStore,
13
+ toggleFavorite as toggleFavoriteAction,
14
+ removeFavorite as removeFavoriteAction,
15
+ type FavoriteItem,
16
+ } from '@stores/favorites-store';
12
17
  import { getBadgeClasses } from './utils';
13
18
 
14
19
  const cn = (...classes: (string | false | undefined)[]) => classes.filter(Boolean).join(' ');
@@ -50,10 +55,14 @@ export default function NestedSideBar() {
50
55
  const nodeLookup = useMemo(() => {
51
56
  const lookup = new Map<string, string>();
52
57
 
53
- Object.keys(nodes).forEach((key) => {
58
+ Object.entries(nodes).forEach(([key, value]) => {
59
+ // Skip keys that are references (string values pointing to other keys)
60
+ // These are unversioned aliases like "domain:E-Commerce" -> "domain:E-Commerce:1.0.0"
61
+ if (typeof value === 'string') return;
62
+
54
63
  // Key formats:
55
64
  // - "type:id:version" (e.g., "service:OrdersService:0.0.3")
56
- // - "type:id" (e.g., "service:OrdersService", "user:john", "team:backend")
65
+ // - "type:id" (e.g., "user:john", "team:backend") - non-versioned resources
57
66
  // - "list:name" (e.g., "list:domains") - skip these
58
67
  const parts = key.split(':');
59
68
 
@@ -124,11 +133,18 @@ export default function NestedSideBar() {
124
133
 
125
134
  /**
126
135
  * Resolve a child reference to a NavNode
136
+ * Handles both direct keys and string references (unversioned aliases pointing to versioned keys)
127
137
  */
128
138
  const resolveRef = useCallback(
129
139
  (ref: ChildRef): NavNode | null => {
130
140
  if (typeof ref === 'string') {
131
- return nodes[ref] ?? null;
141
+ const node = nodes[ref];
142
+ if (!node) return null;
143
+ // If node is a string, it's a reference to another key (e.g., unversioned alias)
144
+ if (typeof node === 'string') {
145
+ return (nodes[node] as NavNode) ?? null;
146
+ }
147
+ return node;
132
148
  }
133
149
  return ref;
134
150
  },
@@ -151,7 +167,7 @@ export default function NestedSideBar() {
151
167
  const stack: NavigationLevel[] = [{ key: null, entries: roots, title: 'Documentation' }];
152
168
 
153
169
  for (const key of path) {
154
- const node = nodes[key];
170
+ const node = resolveRef(key);
155
171
  if (node && node.pages) {
156
172
  stack.push({
157
173
  key,
@@ -167,7 +183,7 @@ export default function NestedSideBar() {
167
183
 
168
184
  return stack;
169
185
  },
170
- [roots, nodes]
186
+ [roots, resolveRef]
171
187
  );
172
188
 
173
189
  /**
@@ -250,7 +266,7 @@ export default function NestedSideBar() {
250
266
  */
251
267
  const tryConnectStack = useCallback(
252
268
  (targetKey: string, currentStack: NavigationLevel[]): NavigationLevel[] | null => {
253
- const targetNode = nodes[targetKey];
269
+ const targetNode = resolveRef(targetKey);
254
270
  if (!targetNode) return null;
255
271
 
256
272
  // 1. Check if we are already at this level (or above)
@@ -262,7 +278,7 @@ export default function NestedSideBar() {
262
278
 
263
279
  // 2. Check if it's a child of the current last level
264
280
  const lastLevel = currentStack[currentStack.length - 1];
265
- const lastNode = lastLevel.key ? nodes[lastLevel.key] : null;
281
+ const lastNode = lastLevel.key ? resolveRef(lastLevel.key) : null;
266
282
 
267
283
  // If root level (key=null), we check against roots
268
284
  const parentChildren = lastLevel.key === null ? roots : lastNode?.pages;
@@ -289,7 +305,7 @@ export default function NestedSideBar() {
289
305
 
290
306
  return null;
291
307
  },
292
- [nodes, roots]
308
+ [resolveRef, roots]
293
309
  );
294
310
 
295
311
  /**
@@ -308,7 +324,7 @@ export default function NestedSideBar() {
308
324
  return connectedStack;
309
325
  }
310
326
 
311
- const foundNode = nodes[foundNodeKey];
327
+ const foundNode = resolveRef(foundNodeKey);
312
328
  if (foundNode && foundNode.pages && foundNode.pages.length > 0) {
313
329
  // Fallback: Flattened navigation
314
330
  return [
@@ -333,7 +349,7 @@ export default function NestedSideBar() {
333
349
  }
334
350
  return false;
335
351
  },
336
- [findNodeKeyByUrl, tryConnectStack, nodes, roots]
352
+ [findNodeKeyByUrl, tryConnectStack, resolveRef, roots]
337
353
  );
338
354
 
339
355
  /**
@@ -374,7 +390,7 @@ export default function NestedSideBar() {
374
390
 
375
391
  // 2. If no valid stack from step 1, try just the target (flattened)
376
392
  if (!finalStack && targetKey) {
377
- const targetNode = nodes[targetKey];
393
+ const targetNode = resolveRef(targetKey);
378
394
  if (targetNode && targetNode.pages && targetNode.pages.length > 0) {
379
395
  finalStack = [
380
396
  { key: null, entries: roots, title: 'Documentation' },
@@ -391,7 +407,7 @@ export default function NestedSideBar() {
391
407
  }
392
408
 
393
409
  setIsInitialized(true);
394
- }, [data, roots, nodes, isInitialized, buildStackFromPath, findNodeKeyByUrl, tryConnectStack]);
410
+ }, [data, roots, isInitialized, buildStackFromPath, findNodeKeyByUrl, tryConnectStack, resolveRef]);
395
411
 
396
412
  /**
397
413
  * Save state whenever navigation changes
@@ -600,7 +616,7 @@ export default function NestedSideBar() {
600
616
  */
601
617
  const navigateToFavorite = (favorite: FavoriteItem) => {
602
618
  // If it has an href and no children, just navigate to the URL
603
- const node = nodes[favorite.nodeKey];
619
+ const node = resolveRef(favorite.nodeKey);
604
620
  if (favorite.href && (!node?.pages || node.pages.length === 0)) {
605
621
  window.location.href = favorite.href;
606
622
  return;
@@ -1048,7 +1064,7 @@ export default function NestedSideBar() {
1048
1064
  </div>
1049
1065
  <div className="flex flex-col gap-0.5 border-l ml-3.5 border-amber-200">
1050
1066
  {favorites.map((fav, index) => {
1051
- const node = nodes[fav.nodeKey];
1067
+ const node = resolveRef(fav.nodeKey);
1052
1068
  const isActive = fav.href && currentPath === fav.href;
1053
1069
 
1054
1070
  return (
@@ -1087,7 +1103,12 @@ export default function NestedSideBar() {
1087
1103
  <div
1088
1104
  onClick={(e) => {
1089
1105
  e.stopPropagation();
1090
- if (node) toggleFavorite(fav.nodeKey, node);
1106
+ if (node) {
1107
+ toggleFavorite(fav.nodeKey, node);
1108
+ } else {
1109
+ // Node no longer exists, remove directly using nodeKey
1110
+ removeFavoriteAction(fav.nodeKey);
1111
+ }
1091
1112
  }}
1092
1113
  className="flex items-center justify-center w-5 h-5 text-amber-400 hover:text-amber-500 rounded transition-colors cursor-pointer"
1093
1114
  >