@eventcatalog/core 4.8.4 → 4.10.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 (72) 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-EGWBSVND.js → chunk-5XURY2JV.js} +1 -1
  6. package/dist/{chunk-FQEK3FUI.js → chunk-BDFTJVGN.js} +1 -1
  7. package/dist/{chunk-QB4W7ZUL.js → chunk-BQXEWQ5J.js} +1 -1
  8. package/dist/{chunk-Y57SL3H3.js → chunk-HFAQXAG3.js} +1 -1
  9. package/dist/{chunk-AATZMWL3.js → chunk-IC6XSXJO.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/Badge.astro +3 -1
  19. package/eventcatalog/src/components/FieldsExplorer/FieldNodeGraph.tsx +0 -5
  20. package/eventcatalog/src/components/MDX/Design/Design.astro +2 -0
  21. package/eventcatalog/src/components/MDX/EntityMap/EntityMap.astro +2 -0
  22. package/eventcatalog/src/components/MDX/Flow/Flow.astro +2 -0
  23. package/eventcatalog/src/components/MDX/NodeGraph/AstroNodeGraph.tsx +5 -7
  24. package/eventcatalog/src/components/MDX/NodeGraph/NodeGraph.astro +5 -0
  25. package/eventcatalog/src/components/MDX/SchemaViewer/schema-viewer-utils.spec.ts +3 -3
  26. package/eventcatalog/src/components/MDX/SchemaViewer/schema-viewer-utils.ts +2 -2
  27. package/eventcatalog/src/components/SchemaExplorer/useDarkMode.ts +13 -4
  28. package/eventcatalog/src/components/SideNav/NestedSideBar/index.tsx +121 -88
  29. package/eventcatalog/src/components/SideNav/NestedSideBar/storage.ts +55 -7
  30. package/eventcatalog/src/components/SideNav/NestedSideBar/utils.spec.ts +59 -15
  31. package/eventcatalog/src/components/SideNav/NestedSideBar/utils.ts +53 -7
  32. package/eventcatalog/src/components/Tables/columns/TeamsTableColumns.tsx +1 -1
  33. package/eventcatalog/src/components/Tables/columns/UserTableColumns.tsx +2 -2
  34. package/eventcatalog/src/content.config.ts +71 -1
  35. package/eventcatalog/src/enterprise/api/schemas/[collection]/[id]/[version]/index.ts +3 -3
  36. package/eventcatalog/src/enterprise/collections/resource-docs-utils.ts +19 -0
  37. package/eventcatalog/src/enterprise/fields/pages/fields.astro +2 -0
  38. package/eventcatalog/src/enterprise/tools/catalog-tools.ts +1 -1
  39. package/eventcatalog/src/pages/architecture/[type]/[id]/[version]/index.astro +1 -1
  40. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/[docType]/[docId]/[docVersion]/index.astro +16 -15
  41. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/[docType]/[docId]/index.astro +21 -17
  42. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/graphql/[filename].astro +1 -1
  43. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/index.astro +4 -4
  44. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/resources/index.astro +16 -8
  45. package/eventcatalog/src/pages/docs/[type]/[id]/language/[dictionaryId]/index.astro +48 -65
  46. package/eventcatalog/src/pages/docs/[type]/[id]/language/index.astro +45 -18
  47. package/eventcatalog/src/pages/docs/llm/schemas.txt.ts +3 -3
  48. package/eventcatalog/src/pages/docs/teams/[id]/index.astro +1 -1
  49. package/eventcatalog/src/pages/docs/users/[id]/index.astro +1 -1
  50. package/eventcatalog/src/pages/schemas/[type]/[id]/[version]/_index.data.ts +6 -4
  51. package/eventcatalog/src/pages/schemas/[type]/[id]/[version]/index.astro +6 -2
  52. package/eventcatalog/src/pages/schemas/explorer/_index.data.ts +2 -2
  53. package/eventcatalog/src/pages/triggers/[type]/[id]/[version]/index.astro +2 -0
  54. package/eventcatalog/src/pages/visualiser/designs/[id]/index.astro +2 -0
  55. package/eventcatalog/src/stores/sidebar-store/builders/adr.ts +96 -34
  56. package/eventcatalog/src/stores/sidebar-store/builders/agent.ts +167 -75
  57. package/eventcatalog/src/stores/sidebar-store/builders/container.ts +135 -59
  58. package/eventcatalog/src/stores/sidebar-store/builders/data-product.ts +144 -58
  59. package/eventcatalog/src/stores/sidebar-store/builders/domain.ts +306 -188
  60. package/eventcatalog/src/stores/sidebar-store/builders/entity.ts +108 -39
  61. package/eventcatalog/src/stores/sidebar-store/builders/flow.ts +147 -63
  62. package/eventcatalog/src/stores/sidebar-store/builders/message.ts +213 -122
  63. package/eventcatalog/src/stores/sidebar-store/builders/service.ts +223 -127
  64. package/eventcatalog/src/stores/sidebar-store/builders/shared.ts +3 -23
  65. package/eventcatalog/src/stores/sidebar-store/builders/system.ts +187 -97
  66. package/eventcatalog/src/stores/sidebar-store/custom-sidebar.ts +678 -0
  67. package/eventcatalog/src/stores/sidebar-store/state.ts +66 -36
  68. package/eventcatalog/src/stores/theme-store.ts +6 -3
  69. package/eventcatalog/src/styles/tailwind.css +82 -0
  70. package/eventcatalog/src/utils/collections/resource-docs.ts +1 -0
  71. package/eventcatalog/src/utils/collections/schema-loader.ts +10 -8
  72. package/package.json +3 -2
@@ -9,14 +9,59 @@ import {
9
9
  buildAttachmentsSection,
10
10
  buildDiagramNavItems,
11
11
  buildResourceDocsSection,
12
+ buildArchitectureDecisionsSection,
12
13
  } from './shared';
13
14
  import { isChangelogEnabled, isVisualiserEnabled } from '@utils/feature';
14
15
  import { customIconFieldsForResource } from '@utils/icon';
16
+ import { resolveSidebarPages, toCustomSidebarContext, type SidebarSpec } from '../custom-sidebar';
15
17
 
16
18
  // Sort resolved collection entries A-Z by their display name (falling back to id).
17
19
  const byResourceName = (a: any, b: any) => (a.data?.name || a.data?.id || '').localeCompare(b.data?.name || b.data?.id || '');
18
20
 
19
- export const buildSystemNode = (system: CollectionEntry<'systems'>, owners: any[], context: ResourceGroupContext): NavNode => {
21
+ /**
22
+ * Predefined sidebar sections for a system, keyed by the token users reference from
23
+ * `sidebar.json` (e.g. `$quick-reference`). Each token is the kebab-cased title of the
24
+ * section as it appears in the default sidebar.
25
+ */
26
+ export type SystemSectionKey =
27
+ | 'quick-reference'
28
+ | 'documentation'
29
+ | 'architecture'
30
+ | 'diagrams'
31
+ | 'resources'
32
+ | 'services'
33
+ | 'flows'
34
+ | 'data-stores'
35
+ | 'entities'
36
+ | 'decision-records'
37
+ | 'owners'
38
+ | 'code'
39
+ | 'attachments';
40
+
41
+ export type SystemSections = Record<SystemSectionKey, NavNode | NavNode[] | null>;
42
+
43
+ /**
44
+ * Order of sections in the default (generated) sidebar. `decision-records` is deliberately
45
+ * absent — in default mode it is inserted before Owners by `withArchitectureDecisionsSection`
46
+ * in state.ts, and only becomes a first-class token for custom sidebars.
47
+ */
48
+ export const DEFAULT_SYSTEM_SECTION_ORDER: SystemSectionKey[] = [
49
+ 'quick-reference',
50
+ 'documentation',
51
+ 'architecture',
52
+ 'diagrams',
53
+ 'resources',
54
+ 'entities',
55
+ 'owners',
56
+ 'code',
57
+ 'attachments',
58
+ ];
59
+
60
+ export const buildSystemSections = (
61
+ system: CollectionEntry<'systems'>,
62
+ owners: any[],
63
+ context: ResourceGroupContext
64
+ ): SystemSections => {
20
65
  const servicesInSystem = [...(system.data.services || [])].sort(byResourceName);
21
66
  const renderServices = servicesInSystem.length > 0 && shouldRenderSideBarSection(system, 'services');
22
67
 
@@ -57,6 +102,146 @@ export const buildSystemNode = (system: CollectionEntry<'systems'>, owners: any[
57
102
  context.resourceDocCategories
58
103
  );
59
104
 
105
+ // Resource subsections. These are built once and shared between the "Resources"
106
+ // umbrella (where they render as subtle subgroups) and their standalone tokens
107
+ // (`$services`, `$flows`, `$data-stores`) for custom sidebars.
108
+ const servicesSection: NavNode | null = renderServices
109
+ ? {
110
+ type: 'group',
111
+ title: 'Services',
112
+ icon: 'Server',
113
+ pages: servicesInSystem.map((service) => `service:${(service as any).data.id}:${(service as any).data.version}`),
114
+ }
115
+ : null;
116
+
117
+ const flowsSection: NavNode | null = renderFlows
118
+ ? {
119
+ type: 'group',
120
+ title: 'Flows',
121
+ icon: 'Waypoints',
122
+ pages: flowsInSystem.map((flow) => `flow:${(flow as any).data.id}:${(flow as any).data.version}`),
123
+ }
124
+ : null;
125
+
126
+ const dataStoresSection: NavNode | null = renderContainers
127
+ ? {
128
+ type: 'group',
129
+ title: 'Data Stores',
130
+ icon: 'Database',
131
+ pages: containersInSystem.map(
132
+ (container) => `container:${(container as any).data.id}:${(container as any).data.version}`
133
+ ),
134
+ }
135
+ : null;
136
+
137
+ const resourceSubsections = [servicesSection, flowsSection, dataStoresSection].filter(Boolean) as NavNode[];
138
+
139
+ return {
140
+ 'quick-reference': buildQuickReferenceSection(
141
+ [
142
+ {
143
+ title: 'Overview',
144
+ href: buildUrl(`/docs/systems/${system.data.id}/${system.data.version}`),
145
+ },
146
+ hasResources && {
147
+ title: 'System Resources',
148
+ href: buildUrl(`/docs/systems/${system.data.id}/${system.data.version}/resources`),
149
+ },
150
+ isChangelogEnabled() &&
151
+ shouldRenderSideBarSection(system, 'changelog') && {
152
+ title: 'Changelog',
153
+ href: buildUrl(`/docs/systems/${system.data.id}/${system.data.version}/changelog`),
154
+ },
155
+ ].filter(Boolean) as { title: string; href: string }[]
156
+ ),
157
+ documentation: docsSection,
158
+ architecture: {
159
+ type: 'group',
160
+ title: 'Architecture',
161
+ icon: 'Workflow',
162
+ pages: [
163
+ {
164
+ type: 'item',
165
+ title: 'Overview',
166
+ href: buildUrl(`/architecture/systems/${system.data.id}/${system.data.version}`),
167
+ },
168
+ renderVisualiser &&
169
+ hasRelationships && {
170
+ type: 'item',
171
+ title: 'Context Diagram',
172
+ href: buildUrl(`/visualiser/systems/${system.data.id}/${system.data.version}/context`),
173
+ },
174
+ renderVisualiser && {
175
+ type: 'item',
176
+ title: 'Resource Diagram',
177
+ href: buildUrl(`/visualiser/systems/${system.data.id}/${system.data.version}`),
178
+ },
179
+ ].filter(Boolean) as ChildRef[],
180
+ },
181
+ diagrams: hasDiagrams
182
+ ? {
183
+ type: 'group',
184
+ title: 'Diagrams',
185
+ icon: 'FileImage',
186
+ pages: diagramNavItems,
187
+ }
188
+ : null,
189
+ resources:
190
+ resourceSubsections.length > 0
191
+ ? {
192
+ type: 'group',
193
+ title: 'Resources',
194
+ icon: 'Boxes',
195
+ // Resource type subsections are ordered A-Z by their title, and the
196
+ // resources within each subsection are ordered A-Z by name (sorted above).
197
+ pages: resourceSubsections
198
+ .map((section) => ({ ...section, subtle: true }))
199
+ .sort((a, b) => a.title.localeCompare(b.title)) as ChildRef[],
200
+ }
201
+ : null,
202
+ services: servicesSection,
203
+ flows: flowsSection,
204
+ 'data-stores': dataStoresSection,
205
+ entities: renderEntities
206
+ ? {
207
+ type: 'group',
208
+ title: 'Entities',
209
+ icon: 'Box',
210
+ pages: entitiesInSystem.map((entity) => ({
211
+ type: 'item',
212
+ title: (entity as any).data?.name || (entity as any).data.id,
213
+ href: buildUrl(`/docs/entities/${(entity as any).data.id}/${(entity as any).data.version}`),
214
+ })),
215
+ }
216
+ : null,
217
+ 'decision-records': shouldRenderSideBarSection(system, 'architectureDecisions')
218
+ ? buildArchitectureDecisionsSection(system, context.adrs || [])
219
+ : null,
220
+ owners: renderOwners ? buildOwnersSection(owners) : null,
221
+ code: renderRepository ? buildRepositorySection(system.data.repository as { url: string; language: string }) : null,
222
+ attachments: hasAttachments ? buildAttachmentsSection(system.data.attachments as any[]) : null,
223
+ };
224
+ };
225
+
226
+ export type BuildSystemNodeOptions = {
227
+ /** A parsed `sidebar.json` for this system. When present it replaces the generated sidebar. */
228
+ sidebar?: SidebarSpec;
229
+ };
230
+
231
+ export const buildSystemNode = (
232
+ system: CollectionEntry<'systems'>,
233
+ owners: any[],
234
+ context: ResourceGroupContext,
235
+ options: BuildSystemNodeOptions = {}
236
+ ): NavNode => {
237
+ const sections = buildSystemSections(system, owners, context);
238
+
239
+ const pages = resolveSidebarPages(sections, DEFAULT_SYSTEM_SECTION_ORDER, {
240
+ sidebar: options.sidebar,
241
+ resource: { collection: 'systems', id: system.data.id, version: system.data.version, entry: system },
242
+ context: toCustomSidebarContext(context),
243
+ });
244
+
60
245
  return {
61
246
  type: 'item',
62
247
  title: system.data.name,
@@ -66,101 +251,6 @@ export const buildSystemNode = (system: CollectionEntry<'systems'>, owners: any[
66
251
  // 'Systems' section header (and System badge) already convey the type, so the
67
252
  // default Group glyph on every item is redundant.
68
253
  ...customIconFieldsForResource(system.data),
69
- pages: [
70
- buildQuickReferenceSection(
71
- [
72
- {
73
- title: 'Overview',
74
- href: buildUrl(`/docs/systems/${system.data.id}/${system.data.version}`),
75
- },
76
- hasResources && {
77
- title: 'System Resources',
78
- href: buildUrl(`/docs/systems/${system.data.id}/${system.data.version}/resources`),
79
- },
80
- isChangelogEnabled() &&
81
- shouldRenderSideBarSection(system, 'changelog') && {
82
- title: 'Changelog',
83
- href: buildUrl(`/docs/systems/${system.data.id}/${system.data.version}/changelog`),
84
- },
85
- ].filter(Boolean) as { title: string; href: string }[]
86
- ),
87
- docsSection,
88
- {
89
- type: 'group',
90
- title: 'Architecture',
91
- icon: 'Workflow',
92
- pages: [
93
- {
94
- type: 'item',
95
- title: 'Overview',
96
- href: buildUrl(`/architecture/systems/${system.data.id}/${system.data.version}`),
97
- },
98
- renderVisualiser &&
99
- hasRelationships && {
100
- type: 'item',
101
- title: 'Context Diagram',
102
- href: buildUrl(`/visualiser/systems/${system.data.id}/${system.data.version}/context`),
103
- },
104
- renderVisualiser && {
105
- type: 'item',
106
- title: 'Resource Diagram',
107
- href: buildUrl(`/visualiser/systems/${system.data.id}/${system.data.version}`),
108
- },
109
- ].filter(Boolean) as ChildRef[],
110
- },
111
- hasDiagrams && {
112
- type: 'group',
113
- title: 'Diagrams',
114
- icon: 'FileImage',
115
- pages: diagramNavItems,
116
- },
117
- (renderServices || renderFlows || renderContainers) && {
118
- type: 'group',
119
- title: 'Resources',
120
- icon: 'Boxes',
121
- // Resource type subsections are ordered A-Z by their title, and the
122
- // resources within each subsection are ordered A-Z by name (sorted above).
123
- pages: (
124
- [
125
- renderServices && {
126
- type: 'group',
127
- title: 'Services',
128
- subtle: true,
129
- icon: 'Server',
130
- pages: servicesInSystem.map((service) => `service:${(service as any).data.id}:${(service as any).data.version}`),
131
- },
132
- renderFlows && {
133
- type: 'group',
134
- title: 'Flows',
135
- subtle: true,
136
- icon: 'Waypoints',
137
- pages: flowsInSystem.map((flow) => `flow:${(flow as any).data.id}:${(flow as any).data.version}`),
138
- },
139
- renderContainers && {
140
- type: 'group',
141
- title: 'Data Stores',
142
- subtle: true,
143
- icon: 'Database',
144
- pages: containersInSystem.map(
145
- (container) => `container:${(container as any).data.id}:${(container as any).data.version}`
146
- ),
147
- },
148
- ].filter(Boolean) as NavNode[]
149
- ).sort((a, b) => a.title.localeCompare(b.title)) as ChildRef[],
150
- },
151
- renderEntities && {
152
- type: 'group',
153
- title: 'Entities',
154
- icon: 'Box',
155
- pages: entitiesInSystem.map((entity) => ({
156
- type: 'item',
157
- title: (entity as any).data?.name || (entity as any).data.id,
158
- href: buildUrl(`/docs/entities/${(entity as any).data.id}/${(entity as any).data.version}`),
159
- })),
160
- },
161
- renderOwners && buildOwnersSection(owners),
162
- renderRepository && buildRepositorySection(system.data.repository as { url: string; language: string }),
163
- hasAttachments && buildAttachmentsSection(system.data.attachments as any[]),
164
- ].filter(Boolean) as ChildRef[],
254
+ pages,
165
255
  };
166
256
  };