@eventcatalog/core 4.9.0 → 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 (60) 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-XQHS36GO.js → chunk-5XURY2JV.js} +1 -1
  6. package/dist/{chunk-3CGSSMTK.js → chunk-BDFTJVGN.js} +1 -1
  7. package/dist/{chunk-HKVOSQTD.js → chunk-BQXEWQ5J.js} +1 -1
  8. package/dist/{chunk-MPHX5C7M.js → chunk-HFAQXAG3.js} +1 -1
  9. package/dist/{chunk-LVGQ23LR.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/SideNav/NestedSideBar/index.tsx +121 -88
  26. package/eventcatalog/src/components/SideNav/NestedSideBar/storage.ts +55 -7
  27. package/eventcatalog/src/components/SideNav/NestedSideBar/utils.spec.ts +59 -15
  28. package/eventcatalog/src/components/SideNav/NestedSideBar/utils.ts +53 -7
  29. package/eventcatalog/src/content.config.ts +70 -0
  30. package/eventcatalog/src/enterprise/collections/resource-docs-utils.ts +19 -0
  31. package/eventcatalog/src/enterprise/fields/pages/fields.astro +2 -0
  32. package/eventcatalog/src/pages/architecture/[type]/[id]/[version]/index.astro +1 -1
  33. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/[docType]/[docId]/[docVersion]/index.astro +16 -15
  34. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/[docType]/[docId]/index.astro +21 -17
  35. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/graphql/[filename].astro +1 -1
  36. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/index.astro +4 -4
  37. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/resources/index.astro +16 -8
  38. package/eventcatalog/src/pages/docs/[type]/[id]/language/[dictionaryId]/index.astro +48 -65
  39. package/eventcatalog/src/pages/docs/[type]/[id]/language/index.astro +45 -18
  40. package/eventcatalog/src/pages/docs/teams/[id]/index.astro +1 -1
  41. package/eventcatalog/src/pages/docs/users/[id]/index.astro +1 -1
  42. package/eventcatalog/src/pages/schemas/[type]/[id]/[version]/index.astro +5 -1
  43. package/eventcatalog/src/pages/triggers/[type]/[id]/[version]/index.astro +2 -0
  44. package/eventcatalog/src/pages/visualiser/designs/[id]/index.astro +2 -0
  45. package/eventcatalog/src/stores/sidebar-store/builders/adr.ts +96 -34
  46. package/eventcatalog/src/stores/sidebar-store/builders/agent.ts +167 -75
  47. package/eventcatalog/src/stores/sidebar-store/builders/container.ts +135 -59
  48. package/eventcatalog/src/stores/sidebar-store/builders/data-product.ts +144 -58
  49. package/eventcatalog/src/stores/sidebar-store/builders/domain.ts +306 -188
  50. package/eventcatalog/src/stores/sidebar-store/builders/entity.ts +108 -39
  51. package/eventcatalog/src/stores/sidebar-store/builders/flow.ts +147 -63
  52. package/eventcatalog/src/stores/sidebar-store/builders/message.ts +212 -121
  53. package/eventcatalog/src/stores/sidebar-store/builders/service.ts +223 -127
  54. package/eventcatalog/src/stores/sidebar-store/builders/shared.ts +3 -23
  55. package/eventcatalog/src/stores/sidebar-store/builders/system.ts +187 -97
  56. package/eventcatalog/src/stores/sidebar-store/custom-sidebar.ts +678 -0
  57. package/eventcatalog/src/stores/sidebar-store/state.ts +66 -36
  58. package/eventcatalog/src/styles/tailwind.css +82 -0
  59. package/eventcatalog/src/utils/collections/resource-docs.ts +1 -0
  60. package/package.json +3 -3
@@ -1,18 +1,26 @@
1
1
  import type { CollectionEntry } from 'astro:content';
2
2
  import { buildUrl } from '@utils/url-builder';
3
- import type { NavNode, ChildRef, ResourceGroupContext } from './shared';
4
- import { buildQuickReferenceSection, buildOwnersSection, shouldRenderSideBarSection, buildResourceDocsSection } from './shared';
3
+ import type { NavNode, ResourceGroupContext } from './shared';
4
+ import {
5
+ buildQuickReferenceSection,
6
+ buildOwnersSection,
7
+ shouldRenderSideBarSection,
8
+ buildResourceDocsSection,
9
+ buildArchitectureDecisionsSection,
10
+ } from './shared';
5
11
  import { isVisualiserEnabled, isChangelogEnabled } from '@utils/feature';
6
12
  import { getItemsFromCollectionByIdAndSemverOrLatest, sortVersioned } from '@utils/collections/util';
7
13
  import { getSchemaFormatFromURL } from '@utils/collections/schemas';
8
14
  import { iconFieldsForResource } from '@utils/icon';
15
+ import { resolveSidebarPages, toCustomSidebarContext, type SidebarSpec } from '../custom-sidebar';
9
16
 
10
17
  type DataProductContext = Pick<
11
18
  ResourceGroupContext,
12
19
  'events' | 'commands' | 'queries' | 'services' | 'containers' | 'resourceDocs' | 'resourceDocCategories'
13
- > & {
14
- channels: CollectionEntry<'channels'>[];
15
- };
20
+ > &
21
+ Partial<Pick<ResourceGroupContext, 'adrs'>> & {
22
+ channels: CollectionEntry<'channels'>[];
23
+ };
16
24
 
17
25
  // Get highest version from matched items (semver ranges may return multiple matches)
18
26
  const getHighestVersion = <T extends { data: { version: string } }>(items: T[]): T | undefined => {
@@ -57,12 +65,46 @@ const resolvePointerToRef = (pointer: { id: string; version?: string }, context:
57
65
  return null;
58
66
  };
59
67
 
60
- export const buildDataProductNode = (
68
+ /**
69
+ * Predefined sidebar sections for a data product, keyed by the token users reference from
70
+ * `sidebar.json` (e.g. `$quick-reference`). Each token is the kebab-cased title of the
71
+ * section as it appears in the default sidebar.
72
+ */
73
+ export type DataProductSectionKey =
74
+ | 'quick-reference'
75
+ | 'documentation'
76
+ | 'architecture'
77
+ | 'inputs'
78
+ | 'outputs'
79
+ | 'data-contracts'
80
+ | 'appears-in-flows'
81
+ | 'decision-records'
82
+ | 'owners';
83
+
84
+ export type DataProductSections = Record<DataProductSectionKey, NavNode | NavNode[] | null>;
85
+
86
+ /**
87
+ * Order of sections in the default (generated) sidebar. `decision-records` is deliberately
88
+ * absent — in default mode it is inserted before Owners by `withArchitectureDecisionsSection`
89
+ * in state.ts, and only becomes a first-class token for custom sidebars.
90
+ */
91
+ export const DEFAULT_DATA_PRODUCT_SECTION_ORDER: DataProductSectionKey[] = [
92
+ 'quick-reference',
93
+ 'documentation',
94
+ 'architecture',
95
+ 'inputs',
96
+ 'outputs',
97
+ 'data-contracts',
98
+ 'appears-in-flows',
99
+ 'owners',
100
+ ];
101
+
102
+ export const buildDataProductSections = (
61
103
  dataProduct: CollectionEntry<'data-products'>,
62
104
  owners: any[],
63
105
  context: DataProductContext,
64
106
  flowRefs: string[] = []
65
- ): NavNode => {
107
+ ): DataProductSections => {
66
108
  const inputs = dataProduct.data.inputs || [];
67
109
  const outputs = dataProduct.data.outputs || [];
68
110
 
@@ -93,62 +135,106 @@ export const buildDataProductNode = (
93
135
  ),
94
136
  }));
95
137
 
138
+ return {
139
+ 'quick-reference': buildQuickReferenceSection(
140
+ [
141
+ { title: 'Overview', href: buildUrl(`/docs/data-products/${dataProduct.data.id}/${dataProduct.data.version}`) },
142
+ isChangelogEnabled() &&
143
+ shouldRenderSideBarSection(dataProduct, 'changelog') && {
144
+ title: 'Changelog',
145
+ href: buildUrl(`/docs/data-products/${dataProduct.data.id}/${dataProduct.data.version}/changelog`),
146
+ },
147
+ ].filter(Boolean) as { title: string; href: string }[]
148
+ ),
149
+ documentation: docsSection,
150
+ architecture: renderVisualiser
151
+ ? {
152
+ type: 'group',
153
+ title: 'Architecture',
154
+ icon: 'Workflow',
155
+ pages: [
156
+ {
157
+ type: 'item',
158
+ title: 'Map',
159
+ href: buildUrl(`/visualiser/data-products/${dataProduct.data.id}/${dataProduct.data.version}`),
160
+ },
161
+ ],
162
+ }
163
+ : null,
164
+ inputs:
165
+ resolvedInputs.length > 0
166
+ ? {
167
+ type: 'group',
168
+ title: 'Inputs',
169
+ icon: 'ArrowDownToLine',
170
+ pages: resolvedInputs,
171
+ }
172
+ : null,
173
+ outputs:
174
+ resolvedOutputs.length > 0
175
+ ? {
176
+ type: 'group',
177
+ title: 'Outputs',
178
+ icon: 'ArrowUpFromLine',
179
+ pages: resolvedOutputs,
180
+ }
181
+ : null,
182
+ 'data-contracts':
183
+ dataContracts.length > 0
184
+ ? {
185
+ type: 'group',
186
+ title: 'Data Contracts',
187
+ icon: 'FileCheck',
188
+ pages: dataContracts,
189
+ }
190
+ : null,
191
+ 'appears-in-flows': renderFlows
192
+ ? {
193
+ type: 'group',
194
+ title: 'Appears in flows',
195
+ icon: 'Waypoints',
196
+ pages: flowRefs,
197
+ visible: flowRefs.length > 0,
198
+ }
199
+ : null,
200
+ 'decision-records': shouldRenderSideBarSection(dataProduct, 'architectureDecisions')
201
+ ? buildArchitectureDecisionsSection(dataProduct, context.adrs || [])
202
+ : null,
203
+ owners: renderOwners ? buildOwnersSection(owners) : null,
204
+ };
205
+ };
206
+
207
+ export type BuildDataProductNodeOptions = {
208
+ /** A parsed `sidebar.json` for this data product. When present it replaces the generated sidebar. */
209
+ sidebar?: SidebarSpec;
210
+ };
211
+
212
+ export const buildDataProductNode = (
213
+ dataProduct: CollectionEntry<'data-products'>,
214
+ owners: any[],
215
+ context: DataProductContext,
216
+ flowRefs: string[] = [],
217
+ options: BuildDataProductNodeOptions = {}
218
+ ): NavNode => {
219
+ const sections = buildDataProductSections(dataProduct, owners, context, flowRefs);
220
+
221
+ const pages = resolveSidebarPages(sections, DEFAULT_DATA_PRODUCT_SECTION_ORDER, {
222
+ sidebar: options.sidebar,
223
+ resource: {
224
+ collection: 'data-products',
225
+ id: dataProduct.data.id,
226
+ version: dataProduct.data.version,
227
+ entry: dataProduct,
228
+ },
229
+ context: toCustomSidebarContext(context),
230
+ });
231
+
96
232
  return {
97
233
  type: 'item',
98
234
  title: dataProduct.data.name,
99
235
  badge: 'Data Product',
100
236
  summary: dataProduct.data.summary,
101
237
  ...iconFieldsForResource(dataProduct.data, 'Package'),
102
- pages: [
103
- buildQuickReferenceSection(
104
- [
105
- { title: 'Overview', href: buildUrl(`/docs/data-products/${dataProduct.data.id}/${dataProduct.data.version}`) },
106
- isChangelogEnabled() &&
107
- shouldRenderSideBarSection(dataProduct, 'changelog') && {
108
- title: 'Changelog',
109
- href: buildUrl(`/docs/data-products/${dataProduct.data.id}/${dataProduct.data.version}/changelog`),
110
- },
111
- ].filter(Boolean) as { title: string; href: string }[]
112
- ),
113
- docsSection,
114
- renderVisualiser && {
115
- type: 'group',
116
- title: 'Architecture',
117
- icon: 'Workflow',
118
- pages: [
119
- {
120
- type: 'item',
121
- title: 'Map',
122
- href: buildUrl(`/visualiser/data-products/${dataProduct.data.id}/${dataProduct.data.version}`),
123
- },
124
- ],
125
- },
126
- resolvedInputs.length > 0 && {
127
- type: 'group',
128
- title: 'Inputs',
129
- icon: 'ArrowDownToLine',
130
- pages: resolvedInputs,
131
- },
132
- resolvedOutputs.length > 0 && {
133
- type: 'group',
134
- title: 'Outputs',
135
- icon: 'ArrowUpFromLine',
136
- pages: resolvedOutputs,
137
- },
138
- dataContracts.length > 0 && {
139
- type: 'group',
140
- title: 'Data Contracts',
141
- icon: 'FileCheck',
142
- pages: dataContracts,
143
- },
144
- renderFlows && {
145
- type: 'group',
146
- title: 'Appears in flows',
147
- icon: 'Waypoints',
148
- pages: flowRefs,
149
- visible: flowRefs.length > 0,
150
- },
151
- renderOwners && buildOwnersSection(owners),
152
- ].filter(Boolean) as ChildRef[],
238
+ pages,
153
239
  };
154
240
  };