@eventcatalog/core 3.7.2 → 3.8.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 (66) 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-O6SRHGZ7.js → chunk-4EJDLNIX.js} +1 -1
  6. package/dist/{chunk-WAX3S32H.js → chunk-EG36OTR7.js} +1 -1
  7. package/dist/{chunk-GQZVIS3Z.js → chunk-GITARDPK.js} +1 -1
  8. package/dist/{chunk-7CTNGTBB.js → chunk-IEEU454Z.js} +1 -1
  9. package/dist/{chunk-M7EPRGHR.js → chunk-ZIG6J4R2.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 +13 -1
  19. package/eventcatalog/src/components/Grids/DomainGrid.tsx +109 -6
  20. package/eventcatalog/src/components/Grids/utils.tsx +10 -1
  21. package/eventcatalog/src/components/MDX/NodeGraph/NodeGraph.astro +2 -0
  22. package/eventcatalog/src/components/MDX/NodeGraph/NodeGraph.tsx +4 -0
  23. package/eventcatalog/src/components/MDX/NodeGraph/Nodes/DataProduct.tsx +132 -0
  24. package/eventcatalog/src/components/SchemaExplorer/SchemaExplorer.tsx +29 -2
  25. package/eventcatalog/src/components/SchemaExplorer/types.ts +5 -1
  26. package/eventcatalog/src/components/SideNav/NestedSideBar/index.tsx +3 -0
  27. package/eventcatalog/src/components/SideNav/NestedSideBar/utils.ts +1 -0
  28. package/eventcatalog/src/components/Tables/Discover/DiscoverTable.tsx +23 -1
  29. package/eventcatalog/src/components/Tables/Discover/columns.tsx +62 -0
  30. package/eventcatalog/src/content.config.ts +34 -0
  31. package/eventcatalog/src/enterprise/ai/chat-api.ts +26 -0
  32. package/eventcatalog/src/enterprise/custom-documentation/utils/custom-docs.ts +1 -1
  33. package/eventcatalog/src/enterprise/tools/catalog-tools.ts +169 -2
  34. package/eventcatalog/src/pages/discover/[type]/_index.data.ts +5 -1
  35. package/eventcatalog/src/pages/discover/[type]/index.astro +57 -1
  36. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/_index.data.ts +1 -0
  37. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/index.astro +5 -1
  38. package/eventcatalog/src/pages/schemas/[type]/[id]/[version]/_index.data.ts +27 -3
  39. package/eventcatalog/src/pages/schemas/[type]/[id]/[version]/index.astro +74 -25
  40. package/eventcatalog/src/pages/schemas/explorer/_index.data.ts +55 -1
  41. package/eventcatalog/src/pages/visualiser/[type]/[id]/[version]/_index.data.ts +10 -1
  42. package/eventcatalog/src/stores/sidebar-store/builders/container.ts +23 -16
  43. package/eventcatalog/src/stores/sidebar-store/builders/data-product.ts +130 -0
  44. package/eventcatalog/src/stores/sidebar-store/builders/domain.ts +11 -0
  45. package/eventcatalog/src/stores/sidebar-store/state.ts +68 -13
  46. package/eventcatalog/src/styles/theme.css +4 -0
  47. package/eventcatalog/src/styles/themes/forest.css +4 -0
  48. package/eventcatalog/src/styles/themes/ocean.css +4 -0
  49. package/eventcatalog/src/styles/themes/sapphire.css +4 -0
  50. package/eventcatalog/src/styles/themes/sunset.css +4 -0
  51. package/eventcatalog/src/types/index.ts +4 -2
  52. package/eventcatalog/src/utils/collections/commands.ts +11 -29
  53. package/eventcatalog/src/utils/collections/containers.ts +25 -1
  54. package/eventcatalog/src/utils/collections/data-products.ts +85 -0
  55. package/eventcatalog/src/utils/collections/domains.ts +28 -10
  56. package/eventcatalog/src/utils/collections/events.ts +11 -29
  57. package/eventcatalog/src/utils/collections/icons.ts +5 -0
  58. package/eventcatalog/src/utils/collections/messages.ts +68 -0
  59. package/eventcatalog/src/utils/collections/queries.ts +11 -29
  60. package/eventcatalog/src/utils/collections/util.ts +11 -2
  61. package/eventcatalog/src/utils/node-graphs/container-node-graph.ts +91 -3
  62. package/eventcatalog/src/utils/node-graphs/data-products-node-graph.ts +225 -0
  63. package/eventcatalog/src/utils/node-graphs/domains-node-graph.ts +28 -2
  64. package/eventcatalog/src/utils/node-graphs/message-node-graph.ts +74 -20
  65. package/eventcatalog/src/utils/page-loaders/page-data-loader.ts +2 -0
  66. package/package.json +2 -2
@@ -84,25 +84,55 @@ const getNodesAndEdges = async ({
84
84
  type: message.collection,
85
85
  });
86
86
 
87
- const producers = (message.data.producers as CollectionEntry<'services'>[]) || [];
88
- const consumers = (message.data.consumers as CollectionEntry<'services'>[]) || [];
87
+ const producers = (message.data.producers as (CollectionEntry<'services'> | CollectionEntry<'data-products'>)[]) || [];
88
+ const consumers = (message.data.consumers as (CollectionEntry<'services'> | CollectionEntry<'data-products'>)[]) || [];
89
89
 
90
- // Track nodes that are both sent and received
91
- const bothSentAndReceived = findMatchingNodes(producers, consumers);
90
+ // Track nodes that are both sent and received (only for services)
91
+ const serviceProducers = producers.filter((p) => p.collection === 'services') as CollectionEntry<'services'>[];
92
+ const serviceConsumers = consumers.filter((c) => c.collection === 'services') as CollectionEntry<'services'>[];
93
+ const bothSentAndReceived = findMatchingNodes(serviceProducers, serviceConsumers);
92
94
 
93
95
  for (const producer of producers) {
94
- // Create the producer node
96
+ const isDataProduct = producer.collection === 'data-products';
97
+
98
+ // Create the producer node with appropriate data structure
95
99
  nodes.push({
96
100
  id: generateIdForNode(producer),
97
- type: producer?.collection,
101
+ type: isDataProduct ? 'data-products' : producer?.collection,
98
102
  sourcePosition: 'right',
99
103
  targetPosition: 'left',
100
- data: { mode, service: { ...producer.data } },
104
+ data: isDataProduct ? { mode, dataProduct: { ...producer.data } } : { mode, service: { ...producer.data } },
101
105
  position: { x: 250, y: 0 },
102
106
  });
103
107
 
108
+ // Data products don't have channel configuration, so connect directly to the message
109
+ if (isDataProduct) {
110
+ const rootSourceAndTarget = {
111
+ source: { id: generateIdForNode(producer), collection: producer.collection },
112
+ target: { id: generateIdForNode(message), collection: message.collection },
113
+ };
114
+
115
+ edges.push({
116
+ id: generatedIdForEdge(producer, message),
117
+ source: generateIdForNode(producer),
118
+ target: generateIdForNode(message),
119
+ label: 'produces',
120
+ data: { customColor: getColorFromString(message.data.id), rootSourceAndTarget },
121
+ animated: false,
122
+ markerEnd: {
123
+ type: MarkerType.ArrowClosed,
124
+ width: 40,
125
+ height: 40,
126
+ },
127
+ });
128
+ continue;
129
+ }
130
+
131
+ // Service-specific channel handling
132
+ const serviceProducer = producer as CollectionEntry<'services'>;
133
+
104
134
  // Is the producer sending this message to a channel?
105
- const producerConfigurationForMessage = producer.data.sends?.find((send) => send.id === message.data.id);
135
+ const producerConfigurationForMessage = serviceProducer.data.sends?.find((send) => send.id === message.data.id);
106
136
  const producerChannelConfiguration = producerConfigurationForMessage?.to ?? [];
107
137
 
108
138
  const producerHasChannels = producerChannelConfiguration?.length > 0;
@@ -184,18 +214,44 @@ const getNodesAndEdges = async ({
184
214
 
185
215
  // The messages the service sends
186
216
  for (const consumer of consumers) {
187
- // Render the consumer node
217
+ const isDataProduct = consumer.collection === 'data-products';
218
+
219
+ // Render the consumer node with appropriate data structure
188
220
  nodes.push({
189
221
  id: generateIdForNode(consumer),
190
222
  sourcePosition: 'right',
191
223
  targetPosition: 'left',
192
- data: { title: consumer?.data.id, mode, service: { ...consumer.data } },
224
+ data: isDataProduct
225
+ ? { title: consumer?.data.id, mode, dataProduct: { ...consumer.data } }
226
+ : { title: consumer?.data.id, mode, service: { ...consumer.data } },
193
227
  position: { x: 0, y: 0 },
194
- type: consumer?.collection,
228
+ type: isDataProduct ? 'data-products' : consumer?.collection,
195
229
  });
196
230
 
231
+ // Data products don't have channel configuration, so connect directly from the message
232
+ if (isDataProduct) {
233
+ const rootSourceAndTarget = {
234
+ source: { id: generateIdForNode(message), collection: message.collection },
235
+ target: { id: generateIdForNode(consumer), collection: consumer.collection },
236
+ };
237
+
238
+ edges.push(
239
+ createEdge({
240
+ id: generatedIdForEdge(message, consumer),
241
+ source: generateIdForNode(message),
242
+ target: generateIdForNode(consumer),
243
+ label: 'consumed by',
244
+ data: { customColor: getColorFromString(message.data.id), rootSourceAndTarget },
245
+ })
246
+ );
247
+ continue;
248
+ }
249
+
250
+ // Service-specific channel handling
251
+ const serviceConsumer = consumer as CollectionEntry<'services'>;
252
+
197
253
  // Is the consumer receiving this message from a channel?
198
- const consumerConfigurationForMessage = consumer.data.receives?.find((receive) => receive.id === message.data.id);
254
+ const consumerConfigurationForMessage = serviceConsumer.data.receives?.find((receive) => receive.id === message.data.id);
199
255
  const consumerChannelConfiguration = consumerConfigurationForMessage?.from ?? [];
200
256
 
201
257
  const consumerHasChannels = consumerChannelConfiguration.length > 0;
@@ -237,10 +293,11 @@ const getNodesAndEdges = async ({
237
293
  }
238
294
 
239
295
  // Can any of the consumer channels be linked to any of the producer channels?
240
- const producerChannels = producers
296
+ // Only consider service producers for channel linking (data products don't have sends/receives)
297
+ const producerChannels = serviceProducers
241
298
  .map((producer) => producer.data.sends?.find((send) => send.id === message.data.id)?.to ?? [])
242
299
  .flat();
243
- const consumerChannels = consumer.data.receives?.find((receive) => receive.id === message.data.id)?.from ?? [];
300
+ const consumerChannels = serviceConsumer.data.receives?.find((receive) => receive.id === message.data.id)?.from ?? [];
244
301
 
245
302
  for (const producerChannel of producerChannels) {
246
303
  const producerChannelValue = findInMap(
@@ -376,8 +433,7 @@ export const getNodesAndEdgesForQueries = async ({
376
433
  mode = 'simple',
377
434
  channelRenderMode = 'flat',
378
435
  }: Props) => {
379
- const queries = await getQueries();
380
- const channels = await getChannels();
436
+ const [queries, channels] = await Promise.all([getQueries(), getChannels()]);
381
437
  return getNodesAndEdges({ id, version, defaultFlow, mode, channelRenderMode, collection: queries, channels });
382
438
  };
383
439
 
@@ -388,8 +444,7 @@ export const getNodesAndEdgesForCommands = async ({
388
444
  mode = 'simple',
389
445
  channelRenderMode = 'flat',
390
446
  }: Props) => {
391
- const commands = await getCommands();
392
- const channels = await getChannels();
447
+ const [commands, channels] = await Promise.all([getCommands(), getChannels()]);
393
448
  return getNodesAndEdges({ id, version, defaultFlow, mode, channelRenderMode, collection: commands, channels });
394
449
  };
395
450
 
@@ -400,8 +455,7 @@ export const getNodesAndEdgesForEvents = async ({
400
455
  mode = 'simple',
401
456
  channelRenderMode = 'flat',
402
457
  }: Props) => {
403
- const events = await getEvents();
404
- const channels = await getChannels();
458
+ const [events, channels] = await Promise.all([getEvents(), getChannels()]);
405
459
  return getNodesAndEdges({ id, version, defaultFlow, mode, channelRenderMode, collection: events, channels });
406
460
  };
407
461
 
@@ -9,6 +9,7 @@ import { getEntities } from '@utils/collections/entities';
9
9
  import { getContainers } from '@utils/collections/containers';
10
10
  import { getDiagrams } from '@utils/collections/diagrams';
11
11
  import type { CollectionEntry } from 'astro:content';
12
+ import { getDataProducts } from '@utils/collections/data-products';
12
13
 
13
14
  export const pageDataLoader: Record<PageTypes, () => Promise<CollectionEntry<CollectionTypes>[]>> = {
14
15
  events: getEvents,
@@ -21,4 +22,5 @@ export const pageDataLoader: Record<PageTypes, () => Promise<CollectionEntry<Col
21
22
  entities: getEntities,
22
23
  containers: getContainers,
23
24
  diagrams: getDiagrams,
25
+ 'data-products': getDataProducts,
24
26
  };
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.7.2",
9
+ "version": "3.8.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.10.0",
37
+ "@eventcatalog/sdk": "^2.11.0",
38
38
  "@eventcatalog/visualizer": "^0.0.6",
39
39
  "@fontsource/inter": "^5.2.5",
40
40
  "@headlessui/react": "^2.0.3",