@eventcatalog/core 2.65.0 → 3.0.0-beta.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.
- package/README.md +1 -26
- package/dist/analytics/analytics.cjs +1 -1
- package/dist/analytics/analytics.js +2 -2
- package/dist/analytics/log-build.cjs +1 -1
- package/dist/analytics/log-build.js +3 -3
- package/dist/{chunk-NK6OYMRD.js → chunk-JB4YT5JY.js} +1 -1
- package/dist/{chunk-BMDTX5IN.js → chunk-TQ4HZREX.js} +1 -1
- package/dist/{chunk-IJRFYF4B.js → chunk-X4W4YC3U.js} +1 -1
- package/dist/constants.cjs +1 -1
- package/dist/constants.js +1 -1
- package/dist/eventcatalog.cjs +1 -21
- package/dist/eventcatalog.config.d.cts +10 -0
- package/dist/eventcatalog.config.d.ts +10 -0
- package/dist/eventcatalog.js +3 -20
- package/eventcatalog/src/components/CopyAsMarkdown.tsx +19 -1
- package/eventcatalog/src/components/FavoriteButton.tsx +54 -0
- package/eventcatalog/src/components/Grids/DomainGrid.tsx +386 -362
- package/eventcatalog/src/components/Grids/MessageGrid.tsx +166 -518
- package/eventcatalog/src/components/Header.astro +48 -23
- package/eventcatalog/src/components/Lists/VersionList.astro +2 -2
- package/eventcatalog/src/components/MDX/Design/Design.astro +4 -1
- package/eventcatalog/src/components/MDX/Flow/Flow.astro +2 -1
- package/eventcatalog/src/components/MDX/NodeGraph/NodeGraph.astro +3 -3
- package/eventcatalog/src/components/SchemaExplorer/SchemaDetailsPanel.tsx +8 -2
- package/eventcatalog/src/components/SchemaExplorer/SchemaPageViewer.tsx +37 -0
- package/eventcatalog/src/components/Search/Search.astro +48 -28
- package/eventcatalog/src/components/Search/SearchModal.tsx +393 -702
- package/eventcatalog/src/components/SideNav/NestedSideBar/SearchBar.tsx +298 -0
- package/eventcatalog/src/components/SideNav/NestedSideBar/builders/container.ts +66 -0
- package/eventcatalog/src/components/SideNav/NestedSideBar/builders/domain.ts +101 -0
- package/eventcatalog/src/components/SideNav/NestedSideBar/builders/flow.ts +29 -0
- package/eventcatalog/src/components/SideNav/NestedSideBar/builders/message.ts +84 -0
- package/eventcatalog/src/components/SideNav/NestedSideBar/builders/service.ts +147 -0
- package/eventcatalog/src/components/SideNav/NestedSideBar/builders/shared.ts +146 -0
- package/eventcatalog/src/components/SideNav/NestedSideBar/index.tsx +1073 -0
- package/eventcatalog/src/components/SideNav/NestedSideBar/sidebar-builder.ts +365 -0
- package/eventcatalog/src/components/SideNav/NestedSideBar/storage.ts +90 -0
- package/eventcatalog/src/components/SideNav/SideNav.astro +18 -28
- package/eventcatalog/src/content.config.ts +2 -0
- package/eventcatalog/src/enterprise/custom-documentation/pages/docs/custom/index.astro +10 -4
- package/eventcatalog/src/enterprise/eventcatalog-chat/pages/chat/index.astro +3 -3
- package/eventcatalog/src/layouts/DirectoryLayout.astro +2 -2
- package/eventcatalog/src/layouts/DiscoverLayout.astro +3 -3
- package/eventcatalog/src/layouts/VerticalSideBarLayout.astro +85 -63
- package/eventcatalog/src/layouts/VisualiserLayout.astro +3 -3
- package/eventcatalog/src/pages/_index.astro +530 -110
- package/eventcatalog/src/pages/architecture/[type]/[id]/[version]/_index.data.ts +64 -0
- package/eventcatalog/src/pages/architecture/[type]/[id]/[version]/index.astro +29 -0
- package/eventcatalog/src/pages/directory/[type]/_index.data.ts +4 -4
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/_index.data.ts +1 -4
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/changelog/_index.data.ts +3 -3
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/changelog/index.astro +1 -5
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/index.astro +362 -190
- package/eventcatalog/src/pages/docs/[type]/[id]/[version].md.ts +1 -1
- package/eventcatalog/src/pages/docs/[type]/[id]/index.astro +4 -4
- package/eventcatalog/src/pages/docs/[type]/[id]/language/_index.data.ts +1 -4
- package/eventcatalog/src/pages/docs/[type]/[id]/language/index.astro +3 -27
- package/eventcatalog/src/pages/docs/teams/[id]/_index.data.ts +2 -2
- package/eventcatalog/src/pages/docs/users/[id]/_index.data.ts +2 -2
- package/eventcatalog/src/pages/index.astro +14 -5
- package/eventcatalog/src/pages/nav-index.json.ts +30 -0
- package/eventcatalog/src/pages/schemas/[type]/[id]/[version]/_index.data.ts +77 -0
- package/eventcatalog/src/pages/schemas/[type]/[id]/[version]/index.astro +90 -0
- package/eventcatalog/src/pages/schemas/{index.astro → explorer/index.astro} +3 -3
- package/eventcatalog/src/pages/studio.astro +3 -3
- package/eventcatalog/src/pages/visualiser/[type]/[id]/[version]/_index.data.ts +4 -3
- package/eventcatalog/src/pages/visualiser/[type]/[id]/index.astro +2 -2
- package/eventcatalog/src/pages/visualiser/domains/[id]/[version]/entity-map/_index.data.ts +4 -3
- package/eventcatalog/src/stores/favorites-store.ts +83 -0
- package/eventcatalog/src/stores/sidebar-store.ts +8 -0
- package/eventcatalog/src/utils/collections/changelogs.ts +7 -4
- package/eventcatalog/src/utils/{channels.ts → collections/channels.ts} +81 -31
- package/eventcatalog/src/utils/collections/commands.ts +134 -0
- package/eventcatalog/src/utils/collections/containers.ts +44 -33
- package/eventcatalog/src/utils/collections/domains.ts +204 -62
- package/eventcatalog/src/utils/{entities.ts → collections/entities.ts} +44 -24
- package/eventcatalog/src/utils/collections/events.ts +136 -0
- package/eventcatalog/src/utils/collections/flows.ts +59 -25
- package/eventcatalog/src/utils/{messages.ts → collections/messages.ts} +13 -4
- package/eventcatalog/src/utils/{queries.ts → collections/queries.ts} +49 -28
- package/eventcatalog/src/utils/collections/services.ts +100 -68
- package/eventcatalog/src/utils/collections/teams.ts +94 -0
- package/eventcatalog/src/utils/collections/users.ts +122 -0
- package/eventcatalog/src/utils/collections/util.ts +57 -1
- package/eventcatalog/src/utils/feature.ts +3 -1
- package/eventcatalog/src/utils/{collections/file-diffs.ts → file-diffs.ts} +1 -1
- package/eventcatalog/src/utils/node-graphs/container-node-graph.ts +2 -0
- package/eventcatalog/src/utils/node-graphs/domain-entity-map.ts +16 -6
- package/eventcatalog/src/utils/node-graphs/domains-canvas.ts +14 -10
- package/eventcatalog/src/utils/node-graphs/domains-node-graph.ts +36 -64
- package/eventcatalog/src/utils/node-graphs/flows-node-graph.ts +23 -19
- package/eventcatalog/src/utils/node-graphs/message-node-graph.ts +36 -49
- package/eventcatalog/src/utils/node-graphs/services-node-graph.ts +22 -18
- package/eventcatalog/src/utils/page-loaders/page-data-loader.ts +4 -4
- package/eventcatalog/tailwind.config.mjs +14 -0
- package/eventcatalog/tsconfig.json +2 -1
- package/package.json +7 -4
- package/eventcatalog/public/logo_old.png +0 -0
- package/eventcatalog/src/components/DiscoverInsight.astro +0 -61
- package/eventcatalog/src/components/Grids/ServiceGrid.tsx +0 -534
- package/eventcatalog/src/components/Lists/CustomSideBarSectionList.astro +0 -55
- package/eventcatalog/src/components/Lists/ProtocolList.tsx +0 -74
- package/eventcatalog/src/components/Lists/RepositoryList.astro +0 -37
- package/eventcatalog/src/components/Lists/SpecificationsList.astro +0 -67
- package/eventcatalog/src/components/SideBars/ChannelSideBar.astro +0 -204
- package/eventcatalog/src/components/SideBars/ContainerSideBar.astro +0 -180
- package/eventcatalog/src/components/SideBars/DomainSideBar.astro +0 -273
- package/eventcatalog/src/components/SideBars/EntitySideBar.astro +0 -139
- package/eventcatalog/src/components/SideBars/FlowSideBar.astro +0 -128
- package/eventcatalog/src/components/SideBars/MessageSideBar.astro +0 -248
- package/eventcatalog/src/components/SideBars/ServiceSideBar.astro +0 -294
- package/eventcatalog/src/components/SideNav/ListViewSideBar/components/CollapsibleGroup.tsx +0 -46
- package/eventcatalog/src/components/SideNav/ListViewSideBar/components/MessageList.tsx +0 -78
- package/eventcatalog/src/components/SideNav/ListViewSideBar/components/SpecificationList.tsx +0 -83
- package/eventcatalog/src/components/SideNav/ListViewSideBar/index.tsx +0 -1250
- package/eventcatalog/src/components/SideNav/ListViewSideBar/types.ts +0 -91
- package/eventcatalog/src/components/SideNav/ListViewSideBar/utils.ts +0 -201
- package/eventcatalog/src/components/SideNav/TreeView/getTreeView.ts +0 -190
- package/eventcatalog/src/components/SideNav/TreeView/index.tsx +0 -94
- package/eventcatalog/src/components/TreeView/index.tsx +0 -328
- package/eventcatalog/src/components/TreeView/styles.module.css +0 -264
- package/eventcatalog/src/components/TreeView/useSlots.ts +0 -95
- package/eventcatalog/src/pages/architecture/[type]/index.astro +0 -14
- package/eventcatalog/src/pages/architecture/architecture.astro +0 -101
- package/eventcatalog/src/pages/architecture/docs/[type]/index.astro +0 -14
- package/eventcatalog/src/utils/commands.ts +0 -112
- package/eventcatalog/src/utils/events.ts +0 -108
- package/eventcatalog/src/utils/generators/index.ts +0 -10
- package/eventcatalog/src/utils/teams.ts +0 -72
- package/eventcatalog/src/utils/users.ts +0 -72
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// import { getColor } from '@utils/colors';
|
|
2
|
-
import { getEvents } from '@utils/events';
|
|
2
|
+
import { getEvents } from '@utils/collections/events';
|
|
3
3
|
import type { CollectionEntry } from 'astro:content';
|
|
4
4
|
import dagre from 'dagre';
|
|
5
5
|
import {
|
|
@@ -17,15 +17,17 @@ import {
|
|
|
17
17
|
findMatchingNodes,
|
|
18
18
|
getItemsFromCollectionByIdAndSemverOrLatest,
|
|
19
19
|
getLatestVersionInCollectionById,
|
|
20
|
+
createVersionedMap,
|
|
21
|
+
findInMap,
|
|
20
22
|
} from '@utils/collections/util';
|
|
21
23
|
import type { CollectionMessageTypes } from '@types';
|
|
22
|
-
import { getCommands } from '@utils/commands';
|
|
23
|
-
import { getQueries } from '@utils/queries';
|
|
24
|
+
import { getCommands } from '@utils/collections/commands';
|
|
25
|
+
import { getQueries } from '@utils/collections/queries';
|
|
24
26
|
import { createNode } from './utils/utils';
|
|
25
27
|
import { getConsumersOfMessage, getProducersOfMessage } from '@utils/collections/services';
|
|
26
28
|
import { getNodesAndEdgesForChannelChain } from './channel-node-graph';
|
|
27
|
-
import { getChannelChain, isChannelsConnected } from '@utils/channels';
|
|
28
|
-
import { getChannels } from '@utils/channels';
|
|
29
|
+
import { getChannelChain, isChannelsConnected } from '@utils/collections/channels';
|
|
30
|
+
import { getChannels } from '@utils/collections/channels';
|
|
29
31
|
|
|
30
32
|
type DagreGraph = any;
|
|
31
33
|
|
|
@@ -64,6 +66,9 @@ const getNodesAndEdges = async ({
|
|
|
64
66
|
};
|
|
65
67
|
}
|
|
66
68
|
|
|
69
|
+
// Pre-calculate channel map for O(1) lookups
|
|
70
|
+
const channelMap = createVersionedMap(channels);
|
|
71
|
+
|
|
67
72
|
// We always render the message itself
|
|
68
73
|
nodes.push({
|
|
69
74
|
id: generateIdForNode(message),
|
|
@@ -127,11 +132,7 @@ const getNodesAndEdges = async ({
|
|
|
127
132
|
|
|
128
133
|
// If the producer has channels defined, we need to render them
|
|
129
134
|
for (const producerChannel of producerChannelConfiguration) {
|
|
130
|
-
const channel =
|
|
131
|
-
channels,
|
|
132
|
-
producerChannel.id,
|
|
133
|
-
producerChannel.version
|
|
134
|
-
)[0] as CollectionEntry<'channels'>;
|
|
135
|
+
const channel = findInMap(channelMap, producerChannel.id, producerChannel.version) as CollectionEntry<'channels'>;
|
|
135
136
|
|
|
136
137
|
// If we cannot find the channel in EventCatalog, we just connect the producer to the event directly
|
|
137
138
|
if (!channel) {
|
|
@@ -219,11 +220,7 @@ const getNodesAndEdges = async ({
|
|
|
219
220
|
|
|
220
221
|
// If the consumer has channels defined, we try and render them
|
|
221
222
|
for (const consumerChannel of consumerChannelConfiguration) {
|
|
222
|
-
const channel =
|
|
223
|
-
channels,
|
|
224
|
-
consumerChannel.id,
|
|
225
|
-
consumerChannel.version
|
|
226
|
-
)[0] as CollectionEntry<'channels'>;
|
|
223
|
+
const channel = findInMap(channelMap, consumerChannel.id, consumerChannel.version) as CollectionEntry<'channels'>;
|
|
227
224
|
|
|
228
225
|
// If we cannot find the channel in EventCatalog, we connect the message directly to the consumer
|
|
229
226
|
if (!channel) {
|
|
@@ -246,18 +243,18 @@ const getNodesAndEdges = async ({
|
|
|
246
243
|
const consumerChannels = consumer.data.receives?.find((receive) => receive.id === message.data.id)?.from ?? [];
|
|
247
244
|
|
|
248
245
|
for (const producerChannel of producerChannels) {
|
|
249
|
-
const producerChannelValue =
|
|
250
|
-
|
|
246
|
+
const producerChannelValue = findInMap(
|
|
247
|
+
channelMap,
|
|
251
248
|
producerChannel.id,
|
|
252
249
|
producerChannel.version
|
|
253
|
-
)
|
|
250
|
+
) as CollectionEntry<'channels'>;
|
|
254
251
|
|
|
255
252
|
for (const consumerChannel of consumerChannels) {
|
|
256
|
-
const consumerChannelValue =
|
|
257
|
-
|
|
253
|
+
const consumerChannelValue = findInMap(
|
|
254
|
+
channelMap,
|
|
258
255
|
consumerChannel.id,
|
|
259
256
|
consumerChannel.version
|
|
260
|
-
)
|
|
257
|
+
) as CollectionEntry<'channels'>;
|
|
261
258
|
const channelChainToRender = getChannelChain(producerChannelValue, consumerChannelValue, channels);
|
|
262
259
|
|
|
263
260
|
// If there is a chain between them we need to render them al
|
|
@@ -416,6 +413,7 @@ export const getNodesAndEdgesForConsumedMessage = ({
|
|
|
416
413
|
currentNodes = [],
|
|
417
414
|
target,
|
|
418
415
|
mode = 'simple',
|
|
416
|
+
channelMap,
|
|
419
417
|
}: {
|
|
420
418
|
message: CollectionEntry<CollectionMessageTypes>;
|
|
421
419
|
targetChannels?: { id: string; version: string }[];
|
|
@@ -424,10 +422,14 @@ export const getNodesAndEdgesForConsumedMessage = ({
|
|
|
424
422
|
currentNodes: Node[];
|
|
425
423
|
target: CollectionEntry<'services'>;
|
|
426
424
|
mode?: 'simple' | 'full';
|
|
425
|
+
channelMap?: Map<string, CollectionEntry<'channels'>[]>;
|
|
427
426
|
}) => {
|
|
428
427
|
let nodes = [] as Node[],
|
|
429
428
|
edges = [] as any;
|
|
430
429
|
|
|
430
|
+
// Use the provided map or create one if missing
|
|
431
|
+
const map = channelMap || createVersionedMap(channels);
|
|
432
|
+
|
|
431
433
|
const messageId = generateIdForNode(message);
|
|
432
434
|
|
|
433
435
|
const rootSourceAndTarget = {
|
|
@@ -458,8 +460,8 @@ export const getNodesAndEdgesForConsumedMessage = ({
|
|
|
458
460
|
const targetMessageConfiguration = target.data.receives?.find((receive) => receive.id === message.data.id);
|
|
459
461
|
const channelsFromMessageToTarget = targetMessageConfiguration?.from ?? [];
|
|
460
462
|
const hydratedChannelsFromMessageToTarget = channelsFromMessageToTarget
|
|
461
|
-
.map((channel) =>
|
|
462
|
-
.filter((channel) => channel !== undefined);
|
|
463
|
+
.map((channel) => findInMap(map, channel.id, channel.version))
|
|
464
|
+
.filter((channel): channel is CollectionEntry<'channels'> => channel !== undefined);
|
|
463
465
|
|
|
464
466
|
// Now we get the producers of the message and create nodes and edges for them
|
|
465
467
|
const producers = getProducersOfMessage(services, message);
|
|
@@ -467,8 +469,6 @@ export const getNodesAndEdgesForConsumedMessage = ({
|
|
|
467
469
|
const hasProducers = producers.length > 0;
|
|
468
470
|
const targetHasDefinedChannels = targetChannels.length > 0;
|
|
469
471
|
|
|
470
|
-
const isMessageEvent = message.collection === 'events';
|
|
471
|
-
|
|
472
472
|
// Warning edge if no producers or target channels are defined
|
|
473
473
|
if (!hasProducers && !targetHasDefinedChannels) {
|
|
474
474
|
edges.push(
|
|
@@ -485,11 +485,7 @@ export const getNodesAndEdgesForConsumedMessage = ({
|
|
|
485
485
|
// If the target defined channels they consume the message from, we need to create the channel nodes and edges
|
|
486
486
|
if (targetHasDefinedChannels) {
|
|
487
487
|
for (const targetChannel of targetChannels) {
|
|
488
|
-
const channel =
|
|
489
|
-
channels,
|
|
490
|
-
targetChannel.id,
|
|
491
|
-
targetChannel.version
|
|
492
|
-
)[0] as CollectionEntry<'channels'>;
|
|
488
|
+
const channel = findInMap(map, targetChannel.id, targetChannel.version) as CollectionEntry<'channels'>;
|
|
493
489
|
|
|
494
490
|
if (!channel) {
|
|
495
491
|
// No channe found, we just connect the message to the target directly
|
|
@@ -530,8 +526,6 @@ export const getNodesAndEdgesForConsumedMessage = ({
|
|
|
530
526
|
|
|
531
527
|
// If we dont have any producers, we will connect the message to the channel directly
|
|
532
528
|
if (producers.length === 0) {
|
|
533
|
-
const isEvent = message.collection === 'events';
|
|
534
|
-
|
|
535
529
|
edges.push(
|
|
536
530
|
createEdge({
|
|
537
531
|
id: generatedIdForEdge(message, channel),
|
|
@@ -617,11 +611,7 @@ export const getNodesAndEdgesForConsumedMessage = ({
|
|
|
617
611
|
|
|
618
612
|
// Process each producer channel configuration
|
|
619
613
|
for (const producerChannel of producerChannelConfiguration) {
|
|
620
|
-
const channel =
|
|
621
|
-
channels,
|
|
622
|
-
producerChannel.id,
|
|
623
|
-
producerChannel.version
|
|
624
|
-
)[0] as CollectionEntry<'channels'>;
|
|
614
|
+
const channel = findInMap(map, producerChannel.id, producerChannel.version) as CollectionEntry<'channels'>;
|
|
625
615
|
|
|
626
616
|
// If we cannot find the channel in EventCatalog, we just connect the message to the target directly
|
|
627
617
|
if (!channel) {
|
|
@@ -729,6 +719,7 @@ export const getNodesAndEdgesForProducedMessage = ({
|
|
|
729
719
|
currentEdges = [],
|
|
730
720
|
source,
|
|
731
721
|
mode = 'simple',
|
|
722
|
+
channelMap,
|
|
732
723
|
}: {
|
|
733
724
|
message: CollectionEntry<CollectionMessageTypes>;
|
|
734
725
|
sourceChannels?: { id: string; version: string }[];
|
|
@@ -738,10 +729,14 @@ export const getNodesAndEdgesForProducedMessage = ({
|
|
|
738
729
|
currentEdges: Edge[];
|
|
739
730
|
source: CollectionEntry<'services'>;
|
|
740
731
|
mode?: 'simple' | 'full';
|
|
732
|
+
channelMap?: Map<string, CollectionEntry<'channels'>[]>;
|
|
741
733
|
}) => {
|
|
742
734
|
let nodes = [] as Node[],
|
|
743
735
|
edges = [] as any;
|
|
744
736
|
|
|
737
|
+
// Use provided map or create one
|
|
738
|
+
const map = channelMap || createVersionedMap(channels);
|
|
739
|
+
|
|
745
740
|
const messageId = generateIdForNode(message);
|
|
746
741
|
|
|
747
742
|
const rootSourceAndTarget = {
|
|
@@ -784,17 +779,13 @@ export const getNodesAndEdgesForProducedMessage = ({
|
|
|
784
779
|
const channelsFromSourceToMessage = sourceMessageConfiguration?.to ?? [];
|
|
785
780
|
|
|
786
781
|
const hydratedChannelsFromSourceToMessage = channelsFromSourceToMessage
|
|
787
|
-
.map((channel) =>
|
|
788
|
-
.filter((channel) => channel !== undefined);
|
|
782
|
+
.map((channel) => findInMap(map, channel.id, channel.version))
|
|
783
|
+
.filter((channel): channel is CollectionEntry<'channels'> => channel !== undefined);
|
|
789
784
|
|
|
790
785
|
// If the source defined channels they send the message to, we need to create the channel nodes and edges
|
|
791
786
|
if (sourceChannels && sourceChannels.length > 0) {
|
|
792
787
|
for (const sourceChannel of sourceChannels) {
|
|
793
|
-
const channel =
|
|
794
|
-
channels,
|
|
795
|
-
sourceChannel.id,
|
|
796
|
-
sourceChannel.version
|
|
797
|
-
)[0] as CollectionEntry<'channels'>;
|
|
788
|
+
const channel = findInMap(map, sourceChannel.id, sourceChannel.version) as CollectionEntry<'channels'>;
|
|
798
789
|
|
|
799
790
|
if (!channel) {
|
|
800
791
|
// No channel found, we just connect the message to the source directly
|
|
@@ -881,11 +872,7 @@ export const getNodesAndEdgesForProducedMessage = ({
|
|
|
881
872
|
|
|
882
873
|
// Process each consumer channel configuration
|
|
883
874
|
for (const consumerChannel of consumerChannelConfiguration) {
|
|
884
|
-
const channel =
|
|
885
|
-
channels,
|
|
886
|
-
consumerChannel.id,
|
|
887
|
-
consumerChannel.version
|
|
888
|
-
)[0] as CollectionEntry<'channels'>;
|
|
875
|
+
const channel = findInMap(map, consumerChannel.id, consumerChannel.version) as CollectionEntry<'channels'>;
|
|
889
876
|
|
|
890
877
|
const edgeProps = { customColor: getColorFromString(message.data.id), rootSourceAndTarget };
|
|
891
878
|
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
createEdge,
|
|
9
9
|
} from '@utils/node-graphs/utils/utils';
|
|
10
10
|
|
|
11
|
-
import { findMatchingNodes,
|
|
11
|
+
import { findMatchingNodes, findInMap, createVersionedMap } from '@utils/collections/util';
|
|
12
12
|
import { MarkerType } from '@xyflow/react';
|
|
13
13
|
import type { CollectionMessageTypes } from '@types';
|
|
14
14
|
import { getNodesAndEdgesForConsumedMessage, getNodesAndEdgesForProducedMessage } from './message-node-graph';
|
|
@@ -63,7 +63,15 @@ export const getNodesAndEdges = async ({
|
|
|
63
63
|
let nodes = [] as any,
|
|
64
64
|
edges = [] as any;
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
// Fetch all collections in parallel
|
|
67
|
+
const [services, events, commands, queries, channels, containers] = await Promise.all([
|
|
68
|
+
getCollection('services'),
|
|
69
|
+
getCollection('events'),
|
|
70
|
+
getCollection('commands'),
|
|
71
|
+
getCollection('queries'),
|
|
72
|
+
getCollection('channels'),
|
|
73
|
+
getCollection('containers'),
|
|
74
|
+
]);
|
|
67
75
|
|
|
68
76
|
const service = services.find((service) => service.data.id === id && service.data.version === version);
|
|
69
77
|
|
|
@@ -75,37 +83,31 @@ export const getNodesAndEdges = async ({
|
|
|
75
83
|
};
|
|
76
84
|
}
|
|
77
85
|
|
|
86
|
+
// Build maps for O(1) lookups
|
|
87
|
+
const messages = [...events, ...commands, ...queries];
|
|
88
|
+
const messageMap = createVersionedMap(messages);
|
|
89
|
+
const containerMap = createVersionedMap(containers);
|
|
90
|
+
const channelMap = createVersionedMap(channels);
|
|
91
|
+
|
|
78
92
|
const receivesRaw = service?.data.receives || [];
|
|
79
93
|
const sendsRaw = service?.data.sends || [];
|
|
80
94
|
const writesToRaw = service?.data.writesTo || [];
|
|
81
95
|
const readsFromRaw = service?.data.readsFrom || [];
|
|
82
96
|
|
|
83
|
-
const events = await getCollection('events');
|
|
84
|
-
const commands = await getCollection('commands');
|
|
85
|
-
const queries = await getCollection('queries');
|
|
86
|
-
const channels = await getCollection('channels');
|
|
87
|
-
const containers = await getCollection('containers');
|
|
88
|
-
|
|
89
|
-
const messages = [...events, ...commands, ...queries];
|
|
90
|
-
|
|
91
97
|
const receivesHydrated = receivesRaw
|
|
92
|
-
.map((message) =>
|
|
93
|
-
.flat()
|
|
98
|
+
.map((message) => findInMap(messageMap, message.id, message.version))
|
|
94
99
|
.filter((e) => e !== undefined);
|
|
95
100
|
|
|
96
101
|
const sendsHydrated = sendsRaw
|
|
97
|
-
.map((message) =>
|
|
98
|
-
.flat()
|
|
102
|
+
.map((message) => findInMap(messageMap, message.id, message.version))
|
|
99
103
|
.filter((e) => e !== undefined);
|
|
100
104
|
|
|
101
105
|
const writesToHydrated = writesToRaw
|
|
102
|
-
.map((container) =>
|
|
103
|
-
.flat()
|
|
106
|
+
.map((container) => findInMap(containerMap, container.id, container.version))
|
|
104
107
|
.filter((e) => e !== undefined);
|
|
105
108
|
|
|
106
109
|
const readsFromHydrated = readsFromRaw
|
|
107
|
-
.map((container) =>
|
|
108
|
-
.flat()
|
|
110
|
+
.map((container) => findInMap(containerMap, container.id, container.version))
|
|
109
111
|
.filter((e) => e !== undefined);
|
|
110
112
|
|
|
111
113
|
const receives = (receivesHydrated as CollectionEntry<CollectionMessageTypes>[]) || [];
|
|
@@ -130,6 +132,7 @@ export const getNodesAndEdges = async ({
|
|
|
130
132
|
target: service,
|
|
131
133
|
mode,
|
|
132
134
|
channels,
|
|
135
|
+
channelMap,
|
|
133
136
|
});
|
|
134
137
|
|
|
135
138
|
nodes.push(...consumedMessageNodes);
|
|
@@ -221,6 +224,7 @@ export const getNodesAndEdges = async ({
|
|
|
221
224
|
currentEdges: edges,
|
|
222
225
|
mode,
|
|
223
226
|
channels,
|
|
227
|
+
channelMap,
|
|
224
228
|
});
|
|
225
229
|
|
|
226
230
|
nodes.push(...producedMessageNodes);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { CollectionTypes, PageTypes } from '@types';
|
|
2
|
-
import { getChannels } from '@utils/channels';
|
|
2
|
+
import { getChannels } from '@utils/collections/channels';
|
|
3
3
|
import { getDomains } from '@utils/collections/domains';
|
|
4
|
-
import { getCommands, getEvents } from '@utils/messages';
|
|
5
|
-
import { getQueries } from '@utils/queries';
|
|
4
|
+
import { getCommands, getEvents } from '@utils/collections/messages';
|
|
5
|
+
import { getQueries } from '@utils/collections/queries';
|
|
6
6
|
import { getServices } from '@utils/collections/services';
|
|
7
7
|
import { getFlows } from '@utils/collections/flows';
|
|
8
|
-
import { getEntities } from '@utils/entities';
|
|
8
|
+
import { getEntities } from '@utils/collections/entities';
|
|
9
9
|
import { getContainers } from '@utils/collections/containers';
|
|
10
10
|
import type { CollectionEntry } from 'astro:content';
|
|
11
11
|
|
|
@@ -34,6 +34,20 @@ export default {
|
|
|
34
34
|
},
|
|
35
35
|
...theme,
|
|
36
36
|
},
|
|
37
|
+
keyframes: {
|
|
38
|
+
'progress-bar': {
|
|
39
|
+
'0%': { transform: 'translateX(-100%)' },
|
|
40
|
+
'100%': { transform: 'translateX(100%)' },
|
|
41
|
+
},
|
|
42
|
+
'progress-bar-reverse': {
|
|
43
|
+
'0%': { transform: 'translateX(100%)' },
|
|
44
|
+
'100%': { transform: 'translateX(-100%)' },
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
animation: {
|
|
48
|
+
'progress-bar': 'progress-bar 2s linear infinite',
|
|
49
|
+
'progress-bar-reverse': 'progress-bar-reverse 2s linear infinite',
|
|
50
|
+
},
|
|
37
51
|
},
|
|
38
52
|
},
|
|
39
53
|
safelist: [
|
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
"@layouts/*": ["src/layouts/*"],
|
|
16
16
|
"@enterprise/*": ["src/enterprise/*"],
|
|
17
17
|
"@ai/*": ["src/generated-ai/*"],
|
|
18
|
-
"auth:config": ["./auth.config.ts"]
|
|
18
|
+
"auth:config": ["./auth.config.ts"],
|
|
19
|
+
"@stores/*": ["src/stores/*"]
|
|
19
20
|
},
|
|
20
21
|
"jsx": "react-jsx",
|
|
21
22
|
"jsxImportSource": "react",
|
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": "
|
|
9
|
+
"version": "3.0.0-beta.0",
|
|
10
10
|
"publishConfig": {
|
|
11
11
|
"access": "public"
|
|
12
12
|
},
|
|
@@ -45,6 +45,7 @@
|
|
|
45
45
|
"@heroicons/react": "^2.1.3",
|
|
46
46
|
"@iconify-json/logos": "^1.2.4",
|
|
47
47
|
"@mermaid-js/layout-elk": "^0.2.0",
|
|
48
|
+
"@nanostores/react": "^1.0.0",
|
|
48
49
|
"@parcel/watcher": "^2.4.1",
|
|
49
50
|
"@radix-ui/react-context-menu": "^2.2.6",
|
|
50
51
|
"@radix-ui/react-dialog": "^1.1.6",
|
|
@@ -56,7 +57,7 @@
|
|
|
56
57
|
"@tanstack/react-table": "^8.17.3",
|
|
57
58
|
"@xyflow/react": "^12.3.6",
|
|
58
59
|
"ai": "^5.0.60",
|
|
59
|
-
"astro": "^5.16.
|
|
60
|
+
"astro": "^5.16.4",
|
|
60
61
|
"astro-compress": "^2.3.8",
|
|
61
62
|
"astro-expressive-code": "^0.41.3",
|
|
62
63
|
"astro-seo": "^0.8.4",
|
|
@@ -83,6 +84,7 @@
|
|
|
83
84
|
"lucide-react": "^0.453.0",
|
|
84
85
|
"marked": "^15.0.6",
|
|
85
86
|
"mermaid": "^11.4.1",
|
|
87
|
+
"nanostores": "^1.1.0",
|
|
86
88
|
"pagefind": "^1.3.0",
|
|
87
89
|
"pako": "^2.1.0",
|
|
88
90
|
"react": "^18.3.1",
|
|
@@ -99,13 +101,14 @@
|
|
|
99
101
|
"semver": "7.6.3",
|
|
100
102
|
"shelljs": "^0.8.5",
|
|
101
103
|
"tailwindcss": "^3.4.3",
|
|
104
|
+
"tw-animate-css": "^1.4.0",
|
|
102
105
|
"typescript": "^5.4.5",
|
|
103
106
|
"unist-util-visit": "^5.0.0",
|
|
104
107
|
"update-notifier": "^7.3.1",
|
|
105
108
|
"uuid": "^10.0.0"
|
|
106
109
|
},
|
|
107
110
|
"devDependencies": {
|
|
108
|
-
"@astrojs/check": "^0.9.
|
|
111
|
+
"@astrojs/check": "^0.9.6",
|
|
109
112
|
"@changesets/cli": "^2.27.5",
|
|
110
113
|
"@playwright/test": "^1.48.1",
|
|
111
114
|
"@types/dagre": "^0.7.52",
|
|
@@ -134,7 +137,7 @@
|
|
|
134
137
|
"scripts": {
|
|
135
138
|
"dev": "astro dev",
|
|
136
139
|
"build:bin": "tsup",
|
|
137
|
-
"test": "vitest",
|
|
140
|
+
"test": "cross-env DISABLE_EVENTCATALOG_CACHE=true vitest",
|
|
138
141
|
"test:ci": "node scripts/ci/test.js",
|
|
139
142
|
"test:e2e": "playwright test",
|
|
140
143
|
"start": "astro dev",
|
|
Binary file
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
import { buildUrl } from '@utils/url-builder';
|
|
3
|
-
import type React from 'react';
|
|
4
|
-
import config from '@config';
|
|
5
|
-
import { RssIcon } from 'lucide-react';
|
|
6
|
-
interface Props {
|
|
7
|
-
color: string;
|
|
8
|
-
dataTarget: number;
|
|
9
|
-
icon: React.ElementType;
|
|
10
|
-
label: 'domains' | 'services' | 'commands' | 'queries' | 'events' | 'flows';
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const { color, dataTarget, icon: Icon, label } = Astro.props;
|
|
14
|
-
const isRSSEnabled = config.rss?.enabled;
|
|
15
|
-
---
|
|
16
|
-
|
|
17
|
-
<div class={`relative text-center ${color}`}>
|
|
18
|
-
<div class="flex justify-center mb-2">
|
|
19
|
-
<Icon className="w-8 h-8" />
|
|
20
|
-
</div>
|
|
21
|
-
|
|
22
|
-
<div class="text-2xl font-bold mb-1">
|
|
23
|
-
<span class="statistic" data-target={dataTarget}>0</span>
|
|
24
|
-
</div>
|
|
25
|
-
|
|
26
|
-
<a href={buildUrl(`/discover/${label}`)} class="static hover:underline underline-offset-8 text-sm text-gray-600 capitalize">
|
|
27
|
-
{label}
|
|
28
|
-
</a>
|
|
29
|
-
{
|
|
30
|
-
isRSSEnabled && (
|
|
31
|
-
<div class="text-center flex justify-center items-center mt-2">
|
|
32
|
-
<a href={buildUrl(`/rss/${label}/rss.xml`)} class="flex items-center space-x-2 hover:underline underline-offset-8 ">
|
|
33
|
-
<RssIcon className="h-3 w-3 text-gray-800 group-hover:text-white" strokeWidth={1} />
|
|
34
|
-
<span class="text-xs text-gray-600 capitalize">RSS Feed</span>
|
|
35
|
-
</a>
|
|
36
|
-
</div>
|
|
37
|
-
)
|
|
38
|
-
}
|
|
39
|
-
</div>
|
|
40
|
-
|
|
41
|
-
<script>
|
|
42
|
-
function animateStatistics() {
|
|
43
|
-
const statistics = document.querySelectorAll('.statistic');
|
|
44
|
-
statistics.forEach((statistic) => {
|
|
45
|
-
let target = parseInt(statistic.getAttribute('data-target')!);
|
|
46
|
-
let current = 0;
|
|
47
|
-
const increment = target / 50;
|
|
48
|
-
const timer = setInterval(() => {
|
|
49
|
-
current += increment;
|
|
50
|
-
if (current >= target) {
|
|
51
|
-
clearInterval(timer);
|
|
52
|
-
statistic.textContent = target.toString();
|
|
53
|
-
} else {
|
|
54
|
-
statistic.textContent = Math.round(current).toString();
|
|
55
|
-
}
|
|
56
|
-
}, 20);
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
window.addEventListener('load', animateStatistics);
|
|
61
|
-
</script>
|