@eventcatalog/core 2.42.0 → 2.42.2
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/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-BYWZ6BFW.js → chunk-7UGAOGXQ.js} +1 -1
- package/dist/{chunk-6XRQ4VOZ.js → chunk-CJI2BJQN.js} +1 -1
- package/dist/{chunk-M5NGWRPO.js → chunk-JSNXGDYW.js} +1 -1
- package/dist/constants.cjs +1 -1
- package/dist/constants.js +1 -1
- package/dist/eventcatalog.cjs +1 -1
- package/dist/eventcatalog.js +3 -3
- package/eventcatalog/public/logo-old.png +0 -0
- package/eventcatalog/public/logo.png +0 -0
- package/eventcatalog/public/logo_old.png +0 -0
- package/eventcatalog/src/components/MDX/NodeGraph/NodeGraph.astro +3 -0
- package/eventcatalog/src/components/SideBars/ChannelSideBar.astro +44 -1
- package/eventcatalog/src/utils/collections/services.ts +27 -0
- package/eventcatalog/src/utils/node-graphs/message-node-graph.ts +35 -7
- package/eventcatalog/src/utils/node-graphs/utils/utils.ts +4 -3
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
log_build_default
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
5
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-CJI2BJQN.js";
|
|
4
|
+
import "../chunk-7UGAOGXQ.js";
|
|
5
|
+
import "../chunk-JSNXGDYW.js";
|
|
6
6
|
import "../chunk-E7TXTI7G.js";
|
|
7
7
|
export {
|
|
8
8
|
log_build_default as default
|
package/dist/constants.cjs
CHANGED
package/dist/constants.js
CHANGED
package/dist/eventcatalog.cjs
CHANGED
package/dist/eventcatalog.js
CHANGED
|
@@ -6,15 +6,15 @@ import {
|
|
|
6
6
|
} from "./chunk-DCLTVJDP.js";
|
|
7
7
|
import {
|
|
8
8
|
log_build_default
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-CJI2BJQN.js";
|
|
10
|
+
import "./chunk-7UGAOGXQ.js";
|
|
11
11
|
import {
|
|
12
12
|
catalogToAstro,
|
|
13
13
|
checkAndConvertMdToMdx
|
|
14
14
|
} from "./chunk-SLEMYHTU.js";
|
|
15
15
|
import {
|
|
16
16
|
VERSION
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-JSNXGDYW.js";
|
|
18
18
|
import {
|
|
19
19
|
isBackstagePluginEnabled,
|
|
20
20
|
isEventCatalogScaleEnabled,
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -14,6 +14,8 @@ import { getNodesAndEdges as getNodesAndEdgesForFlows } from '@utils/node-graphs
|
|
|
14
14
|
import { buildUrl } from '@utils/url-builder';
|
|
15
15
|
import { getVersionFromCollection } from '@utils/collections/versions';
|
|
16
16
|
import { pageDataLoader } from '@utils/page-loaders/page-data-loader';
|
|
17
|
+
import config from '@config';
|
|
18
|
+
|
|
17
19
|
interface Props {
|
|
18
20
|
id: string;
|
|
19
21
|
collection: string;
|
|
@@ -51,6 +53,7 @@ if (collection in getNodesAndEdgesFunctions) {
|
|
|
51
53
|
id,
|
|
52
54
|
version,
|
|
53
55
|
mode,
|
|
56
|
+
channelRenderMode: config.visualiser?.channels?.renderMode === 'single' ? 'single' : 'flat',
|
|
54
57
|
});
|
|
55
58
|
|
|
56
59
|
nodes = fetchedNodes;
|
|
@@ -8,7 +8,7 @@ import { buildUrl } from '@utils/url-builder';
|
|
|
8
8
|
import { ScrollText } from 'lucide-react';
|
|
9
9
|
import RepositoryList from '@components/Lists/RepositoryList.astro';
|
|
10
10
|
import { getOwner } from '@utils/collections/owners';
|
|
11
|
-
|
|
11
|
+
import { getProducersAndConsumersForChannel } from '@utils/collections/services';
|
|
12
12
|
interface Props {
|
|
13
13
|
channel: CollectionEntry<'channels'>;
|
|
14
14
|
}
|
|
@@ -18,6 +18,7 @@ const { channel } = Astro.props;
|
|
|
18
18
|
const ownersRaw = channel.data?.owners || [];
|
|
19
19
|
const owners = await Promise.all<ReturnType<typeof getOwner>>(ownersRaw.map(getOwner));
|
|
20
20
|
const filteredOwners = owners.filter((o) => o !== undefined);
|
|
21
|
+
const { producers, consumers } = await getProducersAndConsumersForChannel(channel);
|
|
21
22
|
|
|
22
23
|
const channelParameters: Record<string, { enum?: string[]; description?: string }> = channel.data.parameters || {};
|
|
23
24
|
const parameters = Object.keys(channelParameters).map((key) => ({
|
|
@@ -55,10 +56,52 @@ const messageList = (channel.data.messages ?? []).map((p) => ({
|
|
|
55
56
|
tag: `v${p.version}`,
|
|
56
57
|
href: buildUrl(`/docs/${p.collection}/${p.id}/${p.version}`),
|
|
57
58
|
}));
|
|
59
|
+
|
|
60
|
+
const producersList = producers.map((p) => ({
|
|
61
|
+
label: p.data.name,
|
|
62
|
+
badge: p.collection,
|
|
63
|
+
color: 'pink',
|
|
64
|
+
collection: p.collection,
|
|
65
|
+
tag: `v${p.data.version}`,
|
|
66
|
+
href: buildUrl(`/docs/${p.collection}/${p.data.id}/${p.data.version}`),
|
|
67
|
+
}));
|
|
68
|
+
|
|
69
|
+
const consumersList = consumers.map((c) => ({
|
|
70
|
+
label: c.data.name,
|
|
71
|
+
badge: c.collection,
|
|
72
|
+
color: 'blue',
|
|
73
|
+
collection: c.collection,
|
|
74
|
+
tag: `v${c.data.version}`,
|
|
75
|
+
href: buildUrl(`/docs/${c.collection}/${c.data.id}/${c.data.version}`),
|
|
76
|
+
}));
|
|
58
77
|
---
|
|
59
78
|
|
|
60
79
|
<aside class="sticky top-28 left-0 space-y-8 h-full overflow-y-auto py-4">
|
|
61
80
|
<div class="">
|
|
81
|
+
{
|
|
82
|
+
producersList.length > 0 && (
|
|
83
|
+
<PillListFlat
|
|
84
|
+
title={`Producers (${producersList.length})`}
|
|
85
|
+
pills={producersList}
|
|
86
|
+
emptyMessage={`This channel does not have any producers.`}
|
|
87
|
+
color="pink"
|
|
88
|
+
client:load
|
|
89
|
+
/>
|
|
90
|
+
)
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
{
|
|
94
|
+
consumersList.length > 0 && (
|
|
95
|
+
<PillListFlat
|
|
96
|
+
title={`Consumers (${consumersList.length})`}
|
|
97
|
+
pills={consumersList}
|
|
98
|
+
emptyMessage={`This channel does not have any consumers.`}
|
|
99
|
+
color="blue"
|
|
100
|
+
client:load
|
|
101
|
+
/>
|
|
102
|
+
)
|
|
103
|
+
}
|
|
104
|
+
|
|
62
105
|
{
|
|
63
106
|
messageList.length > 0 && (
|
|
64
107
|
<PillListFlat
|
|
@@ -157,3 +157,30 @@ export const getSpecificationsForService = (service: CollectionEntry<CollectionT
|
|
|
157
157
|
filenameWithoutExtension: path.basename(spec.path, path.extname(spec.path)),
|
|
158
158
|
}));
|
|
159
159
|
};
|
|
160
|
+
|
|
161
|
+
// Get services for channel
|
|
162
|
+
export const getProducersAndConsumersForChannel = async (channel: CollectionEntry<'channels'>) => {
|
|
163
|
+
const messages = channel.data.messages ?? [];
|
|
164
|
+
const services = await getServices({ getAllVersions: false });
|
|
165
|
+
|
|
166
|
+
const producers = services.filter((service) => {
|
|
167
|
+
const sends = service.data.sends ?? [];
|
|
168
|
+
return sends.some((send) => {
|
|
169
|
+
// @ts-ignore
|
|
170
|
+
return messages.some((m) => m.id === send.data.id);
|
|
171
|
+
});
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
const consumers = services.filter((service) => {
|
|
175
|
+
const receives = service.data.receives ?? [];
|
|
176
|
+
return receives.some((receive) => {
|
|
177
|
+
// @ts-ignore
|
|
178
|
+
return messages.some((m) => m.id === receive.data.id);
|
|
179
|
+
});
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
return {
|
|
183
|
+
producers: producers ?? [],
|
|
184
|
+
consumers: consumers ?? [],
|
|
185
|
+
};
|
|
186
|
+
};
|
|
@@ -25,10 +25,18 @@ interface Props {
|
|
|
25
25
|
version: string;
|
|
26
26
|
defaultFlow?: DagreGraph;
|
|
27
27
|
mode?: 'simple' | 'full';
|
|
28
|
+
channelRenderMode?: 'flat' | 'single';
|
|
28
29
|
collection?: CollectionEntry<CollectionMessageTypes>[];
|
|
29
30
|
}
|
|
30
31
|
|
|
31
|
-
const getNodesAndEdges = async ({
|
|
32
|
+
const getNodesAndEdges = async ({
|
|
33
|
+
id,
|
|
34
|
+
version,
|
|
35
|
+
defaultFlow,
|
|
36
|
+
mode = 'simple',
|
|
37
|
+
channelRenderMode = 'flat',
|
|
38
|
+
collection = [],
|
|
39
|
+
}: Props) => {
|
|
32
40
|
const flow = defaultFlow || createDagreGraph({ ranksep: 300, nodesep: 50 });
|
|
33
41
|
const nodes = [] as any,
|
|
34
42
|
edges = [] as any;
|
|
@@ -73,6 +81,7 @@ const getNodesAndEdges = async ({ id, version, defaultFlow, mode = 'simple', col
|
|
|
73
81
|
channelToTargetLabel: getEdgeLabelForServiceAsTarget(message),
|
|
74
82
|
mode,
|
|
75
83
|
currentNodes: nodes,
|
|
84
|
+
channelRenderMode,
|
|
76
85
|
});
|
|
77
86
|
nodes.push(...channelNodes);
|
|
78
87
|
edges.push(...channelEdges);
|
|
@@ -126,6 +135,7 @@ const getNodesAndEdges = async ({ id, version, defaultFlow, mode = 'simple', col
|
|
|
126
135
|
channelToTargetLabel: getEdgeLabelForMessageAsSource(message),
|
|
127
136
|
mode,
|
|
128
137
|
currentNodes: nodes,
|
|
138
|
+
channelRenderMode,
|
|
129
139
|
});
|
|
130
140
|
|
|
131
141
|
nodes.push(...channelNodes);
|
|
@@ -175,17 +185,35 @@ const getNodesAndEdges = async ({ id, version, defaultFlow, mode = 'simple', col
|
|
|
175
185
|
};
|
|
176
186
|
};
|
|
177
187
|
|
|
178
|
-
export const getNodesAndEdgesForQueries = async ({
|
|
188
|
+
export const getNodesAndEdgesForQueries = async ({
|
|
189
|
+
id,
|
|
190
|
+
version,
|
|
191
|
+
defaultFlow,
|
|
192
|
+
mode = 'simple',
|
|
193
|
+
channelRenderMode = 'flat',
|
|
194
|
+
}: Props) => {
|
|
179
195
|
const queries = await getQueries();
|
|
180
|
-
return getNodesAndEdges({ id, version, defaultFlow, mode, collection: queries });
|
|
196
|
+
return getNodesAndEdges({ id, version, defaultFlow, mode, channelRenderMode, collection: queries });
|
|
181
197
|
};
|
|
182
198
|
|
|
183
|
-
export const getNodesAndEdgesForCommands = async ({
|
|
199
|
+
export const getNodesAndEdgesForCommands = async ({
|
|
200
|
+
id,
|
|
201
|
+
version,
|
|
202
|
+
defaultFlow,
|
|
203
|
+
mode = 'simple',
|
|
204
|
+
channelRenderMode = 'flat',
|
|
205
|
+
}: Props) => {
|
|
184
206
|
const commands = await getCommands();
|
|
185
|
-
return getNodesAndEdges({ id, version, defaultFlow, mode, collection: commands });
|
|
207
|
+
return getNodesAndEdges({ id, version, defaultFlow, mode, channelRenderMode, collection: commands });
|
|
186
208
|
};
|
|
187
209
|
|
|
188
|
-
export const getNodesAndEdgesForEvents = async ({
|
|
210
|
+
export const getNodesAndEdgesForEvents = async ({
|
|
211
|
+
id,
|
|
212
|
+
version,
|
|
213
|
+
defaultFlow,
|
|
214
|
+
mode = 'simple',
|
|
215
|
+
channelRenderMode = 'flat',
|
|
216
|
+
}: Props) => {
|
|
189
217
|
const events = await getEvents();
|
|
190
|
-
return getNodesAndEdges({ id, version, defaultFlow, mode, collection: events });
|
|
218
|
+
return getNodesAndEdges({ id, version, defaultFlow, mode, channelRenderMode, collection: events });
|
|
191
219
|
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// Can't use the CollectionEntry type from astro:content because a client component is using this util
|
|
2
|
-
|
|
3
|
-
import catalog from '@utils/eventcatalog-config/catalog';
|
|
2
|
+
|
|
4
3
|
import { MarkerType, Position, type Edge, type Node } from '@xyflow/react';
|
|
5
4
|
import dagre from 'dagre';
|
|
6
5
|
import { getItemsFromCollectionByIdAndSemverOrLatest } from '@utils/collections/util';
|
|
@@ -103,6 +102,7 @@ export const getChannelNodesAndEdges = ({
|
|
|
103
102
|
sourceToChannelLabel = 'sends to channel',
|
|
104
103
|
mode = 'full',
|
|
105
104
|
currentNodes = [],
|
|
105
|
+
channelRenderMode = 'flat',
|
|
106
106
|
}: {
|
|
107
107
|
channels: CollectionItem[];
|
|
108
108
|
channelsToRender: { id: string; version: string }[];
|
|
@@ -112,6 +112,7 @@ export const getChannelNodesAndEdges = ({
|
|
|
112
112
|
sourceToChannelLabel?: string;
|
|
113
113
|
mode?: 'simple' | 'full';
|
|
114
114
|
currentNodes?: Node[];
|
|
115
|
+
channelRenderMode?: 'flat' | 'single';
|
|
115
116
|
}) => {
|
|
116
117
|
const nodes: Node[] = [];
|
|
117
118
|
const edges: Edge[] = [];
|
|
@@ -122,7 +123,7 @@ export const getChannelNodesAndEdges = ({
|
|
|
122
123
|
.filter((channel) => channel !== undefined);
|
|
123
124
|
|
|
124
125
|
channels.forEach((channel) => {
|
|
125
|
-
const singleChannel =
|
|
126
|
+
const singleChannel = channelRenderMode === 'single'; // Only one node per channel, other wise one node per channel connection
|
|
126
127
|
const channelId = singleChannel ? generateIdForNodes([channel]) : generateIdForNodes([source, channel, target]);
|
|
127
128
|
|
|
128
129
|
// Need to check if the channel node is already in the graph
|