@eventcatalog/core 3.6.2 → 3.7.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/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-S3764NRV.js → chunk-2CIYDOFG.js} +1 -1
- package/dist/{chunk-NI3M6IVT.js → chunk-6DINZHVK.js} +1 -1
- package/dist/{chunk-BWIAPGUD.js → chunk-TWL75YK3.js} +1 -1
- package/dist/{chunk-KOD6UMZD.js → chunk-VA6OWAKW.js} +1 -1
- package/dist/{chunk-LFXU3MEP.js → chunk-WFIM5UXN.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 +5 -5
- package/dist/generate.cjs +1 -1
- package/dist/generate.js +3 -3
- package/dist/utils/cli-logger.cjs +1 -1
- package/dist/utils/cli-logger.js +2 -2
- package/eventcatalog/src/content.config.ts +2 -0
- package/eventcatalog/src/pages/api/sidebar-data.json.ts +8 -3
- package/eventcatalog/src/stores/sidebar-store/builders/domain.ts +24 -0
- package/eventcatalog/src/utils/collections/domains.ts +52 -32
- 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-2CIYDOFG.js";
|
|
4
|
+
import "../chunk-6DINZHVK.js";
|
|
5
|
+
import "../chunk-WFIM5UXN.js";
|
|
6
6
|
import "../chunk-UPONRQSN.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
|
@@ -109,7 +109,7 @@ var verifyRequiredFieldsAreInCatalogConfigFile = async (projectDirectory) => {
|
|
|
109
109
|
var import_picocolors = __toESM(require("picocolors"), 1);
|
|
110
110
|
|
|
111
111
|
// package.json
|
|
112
|
-
var version = "3.
|
|
112
|
+
var version = "3.7.0";
|
|
113
113
|
|
|
114
114
|
// src/constants.ts
|
|
115
115
|
var VERSION = version;
|
package/dist/eventcatalog.js
CHANGED
|
@@ -6,8 +6,8 @@ import {
|
|
|
6
6
|
} from "./chunk-PLNJC7NZ.js";
|
|
7
7
|
import {
|
|
8
8
|
log_build_default
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-2CIYDOFG.js";
|
|
10
|
+
import "./chunk-6DINZHVK.js";
|
|
11
11
|
import {
|
|
12
12
|
runMigrations
|
|
13
13
|
} from "./chunk-BH3JMNAV.js";
|
|
@@ -21,13 +21,13 @@ import {
|
|
|
21
21
|
} from "./chunk-5VBIXL6C.js";
|
|
22
22
|
import {
|
|
23
23
|
generate
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-VA6OWAKW.js";
|
|
25
25
|
import {
|
|
26
26
|
logger
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-TWL75YK3.js";
|
|
28
28
|
import {
|
|
29
29
|
VERSION
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-WFIM5UXN.js";
|
|
31
31
|
import "./chunk-UPONRQSN.js";
|
|
32
32
|
|
|
33
33
|
// src/eventcatalog.ts
|
package/dist/generate.cjs
CHANGED
package/dist/generate.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
generate
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-VA6OWAKW.js";
|
|
4
|
+
import "./chunk-TWL75YK3.js";
|
|
5
|
+
import "./chunk-WFIM5UXN.js";
|
|
6
6
|
import "./chunk-UPONRQSN.js";
|
|
7
7
|
export {
|
|
8
8
|
generate
|
package/dist/utils/cli-logger.js
CHANGED
|
@@ -490,6 +490,8 @@ const domains = defineCollection({
|
|
|
490
490
|
domains: z.array(pointer).optional(),
|
|
491
491
|
entities: z.array(pointer).optional(),
|
|
492
492
|
flows: z.array(pointer).optional(),
|
|
493
|
+
sends: z.array(sendsPointer).optional(),
|
|
494
|
+
receives: z.array(receivesPointer).optional(),
|
|
493
495
|
detailsPanel: z
|
|
494
496
|
.object({
|
|
495
497
|
parentDomains: detailPanelPropertySchema.optional(),
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { APIRoute } from 'astro';
|
|
2
2
|
import { getNestedSideBarData } from '@stores/sidebar-store/state';
|
|
3
3
|
|
|
4
|
+
const isDev = import.meta.env.DEV;
|
|
5
|
+
|
|
4
6
|
/**
|
|
5
7
|
* API route that returns the sidebar navigation data as JSON.
|
|
6
8
|
* This is pre-rendered in static mode to avoid embedding the data in every HTML page.
|
|
@@ -12,11 +14,14 @@ export const GET: APIRoute = async () => {
|
|
|
12
14
|
return new Response(JSON.stringify(sidebarData), {
|
|
13
15
|
headers: {
|
|
14
16
|
'Content-Type': 'application/json',
|
|
15
|
-
//
|
|
16
|
-
'Cache-Control':
|
|
17
|
+
// In dev mode, disable caching to ensure fresh data. In production, cache for 1 hour.
|
|
18
|
+
'Cache-Control': isDev
|
|
19
|
+
? 'no-cache, no-store, must-revalidate'
|
|
20
|
+
: 'public, max-age=3600, s-maxage=3600, stale-while-revalidate=86400',
|
|
17
21
|
},
|
|
18
22
|
});
|
|
19
23
|
};
|
|
20
24
|
|
|
21
25
|
// Pre-render this route in static mode so it becomes a static JSON file
|
|
22
|
-
|
|
26
|
+
// In dev mode, don't pre-render to allow dynamic updates
|
|
27
|
+
export const prerender = !isDev;
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
buildDiagramNavItems,
|
|
12
12
|
} from './shared';
|
|
13
13
|
import { isVisualiserEnabled } from '@utils/feature';
|
|
14
|
+
import { pluralizeMessageType } from '@utils/collections/messages';
|
|
14
15
|
|
|
15
16
|
export const buildDomainNode = (domain: CollectionEntry<'domains'>, owners: any[], context: ResourceGroupContext): NavNode => {
|
|
16
17
|
const servicesInDomain = domain.data.services || [];
|
|
@@ -37,6 +38,11 @@ export const buildDomainNode = (domain: CollectionEntry<'domains'>, owners: any[
|
|
|
37
38
|
|
|
38
39
|
const renderRepository = domain.data.repository && shouldRenderSideBarSection(domain, 'repository');
|
|
39
40
|
|
|
41
|
+
// Domain-level messages (sends/receives)
|
|
42
|
+
const sendsMessages = domain.data.sends || [];
|
|
43
|
+
const receivesMessages = domain.data.receives || [];
|
|
44
|
+
const renderMessages = shouldRenderSideBarSection(domain, 'messages');
|
|
45
|
+
|
|
40
46
|
// Diagrams
|
|
41
47
|
const domainDiagrams = domain.data.diagrams || [];
|
|
42
48
|
const diagramNavItems = buildDiagramNavItems(domainDiagrams, context.diagrams);
|
|
@@ -111,6 +117,24 @@ export const buildDomainNode = (domain: CollectionEntry<'domains'>, owners: any[
|
|
|
111
117
|
icon: 'Server',
|
|
112
118
|
pages: servicesInDomain.map((service) => `service:${(service as any).data.id}:${(service as any).data.version}`),
|
|
113
119
|
},
|
|
120
|
+
sendsMessages.length > 0 &&
|
|
121
|
+
renderMessages && {
|
|
122
|
+
type: 'group',
|
|
123
|
+
title: 'Domain Events',
|
|
124
|
+
icon: 'Mail',
|
|
125
|
+
pages: sendsMessages.map(
|
|
126
|
+
(message) => `${pluralizeMessageType(message as any)}:${(message as any).data.id}:${(message as any).data.version}`
|
|
127
|
+
),
|
|
128
|
+
},
|
|
129
|
+
receivesMessages.length > 0 &&
|
|
130
|
+
renderMessages && {
|
|
131
|
+
type: 'group',
|
|
132
|
+
title: 'External Events',
|
|
133
|
+
icon: 'Mail',
|
|
134
|
+
pages: receivesMessages.map(
|
|
135
|
+
(receive) => `${pluralizeMessageType(receive as any)}:${(receive as any).data.id}:${(receive as any).data.version}`
|
|
136
|
+
),
|
|
137
|
+
},
|
|
114
138
|
renderOwners && buildOwnersSection(owners),
|
|
115
139
|
renderRepository && buildRepositorySection(domain.data.repository as { url: string; language: string }),
|
|
116
140
|
hasAttachments && buildAttachmentsSection(domain.data.attachments as any[]),
|
|
@@ -79,35 +79,21 @@ export const getDomains = async ({
|
|
|
79
79
|
return memoryCache[cacheKey];
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
// 1. Fetch collections
|
|
83
|
-
const
|
|
82
|
+
// 1. Fetch collections (always fetch messages to hydrate domain-level sends/receives)
|
|
83
|
+
const [allDomains, allServices, allEntities, allFlows, allEvents, allCommands, allQueries, allContainers] = await Promise.all([
|
|
84
84
|
getCollection('domains'),
|
|
85
85
|
getCollection('services'),
|
|
86
86
|
getCollection('entities'),
|
|
87
87
|
getCollection('flows'),
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
getCollection('commands'),
|
|
94
|
-
getCollection('queries'),
|
|
95
|
-
getCollection('containers')
|
|
96
|
-
);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
const results = await Promise.all(collectionsToFetch);
|
|
100
|
-
const [allDomains, allServices, allEntities, allFlows] = results;
|
|
101
|
-
|
|
102
|
-
let messageMap = new Map();
|
|
103
|
-
let containerMap = new Map();
|
|
88
|
+
getCollection('events'),
|
|
89
|
+
getCollection('commands'),
|
|
90
|
+
getCollection('queries'),
|
|
91
|
+
getCollection('containers'),
|
|
92
|
+
]);
|
|
104
93
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
messageMap = createVersionedMap(allMessages);
|
|
109
|
-
containerMap = createVersionedMap(allContainers);
|
|
110
|
-
}
|
|
94
|
+
const allMessages = [...allEvents, ...allCommands, ...allQueries];
|
|
95
|
+
const messageMap = createVersionedMap(allMessages);
|
|
96
|
+
const containerMap = createVersionedMap(allContainers);
|
|
111
97
|
|
|
112
98
|
// 2. Build optimized maps
|
|
113
99
|
const domainMap = createVersionedMap(allDomains);
|
|
@@ -192,6 +178,15 @@ export const getDomains = async ({
|
|
|
192
178
|
? [...(hydratedMainServices as any), ...(hydratedSubdomainServices as any)]
|
|
193
179
|
: (hydratedMainServices as any);
|
|
194
180
|
|
|
181
|
+
// Hydrate domain-level sends and receives
|
|
182
|
+
const domainSends = (domain.data.sends || [])
|
|
183
|
+
.map((m: { id: string; version: string | undefined }) => findInMap(messageMap, m.id, m.version))
|
|
184
|
+
.filter((e): e is CollectionEntry<CollectionMessageTypes> => !!e);
|
|
185
|
+
|
|
186
|
+
const domainReceives = (domain.data.receives || [])
|
|
187
|
+
.map((m: { id: string; version: string | undefined }) => findInMap(messageMap, m.id, m.version))
|
|
188
|
+
.filter((e): e is CollectionEntry<CollectionMessageTypes> => !!e);
|
|
189
|
+
|
|
195
190
|
// Calculate folder paths
|
|
196
191
|
const folderName = await getResourceFolderName(
|
|
197
192
|
process.env.PROJECT_DIR ?? '',
|
|
@@ -208,6 +203,8 @@ export const getDomains = async ({
|
|
|
208
203
|
domains: subDomains as any,
|
|
209
204
|
entities: entities as any,
|
|
210
205
|
flows: flows as any,
|
|
206
|
+
sends: domainSends as any,
|
|
207
|
+
receives: domainReceives as any,
|
|
211
208
|
latestVersion,
|
|
212
209
|
versions,
|
|
213
210
|
},
|
|
@@ -249,20 +246,43 @@ export const getMessagesForDomain = async (
|
|
|
249
246
|
const allMessages = [...events, ...commands, ...queries];
|
|
250
247
|
const messageMap = createVersionedMap(allMessages);
|
|
251
248
|
|
|
252
|
-
|
|
253
|
-
const
|
|
249
|
+
// Get service-level sends/receives
|
|
250
|
+
const serviceSends = services.flatMap((service) => service.data.sends || []);
|
|
251
|
+
const serviceReceives = services.flatMap((service) => service.data.receives || []);
|
|
252
|
+
|
|
253
|
+
// Get domain-level sends/receives (already hydrated if domain came from getDomains)
|
|
254
|
+
const domainSends = domain.data.sends || [];
|
|
255
|
+
const domainReceives = domain.data.receives || [];
|
|
254
256
|
|
|
255
|
-
|
|
256
|
-
|
|
257
|
+
// Combine and deduplicate - domain-level messages take priority
|
|
258
|
+
const allSends = [...domainSends, ...serviceSends];
|
|
259
|
+
const allReceives = [...domainReceives, ...serviceReceives];
|
|
260
|
+
|
|
261
|
+
const sendsMessages = allSends
|
|
262
|
+
.map((send: any) => {
|
|
263
|
+
// If already hydrated (has data property), return as-is
|
|
264
|
+
if (send.data) return send;
|
|
265
|
+
// Otherwise, resolve from map
|
|
266
|
+
return findInMap(messageMap, send.id, send.version);
|
|
267
|
+
})
|
|
257
268
|
.filter((msg): msg is CollectionEntry<CollectionMessageTypes> => !!msg);
|
|
258
269
|
|
|
259
|
-
const receivesMessages =
|
|
260
|
-
.map((receive) =>
|
|
270
|
+
const receivesMessages = allReceives
|
|
271
|
+
.map((receive: any) => {
|
|
272
|
+
// If already hydrated (has data property), return as-is
|
|
273
|
+
if (receive.data) return receive;
|
|
274
|
+
// Otherwise, resolve from map
|
|
275
|
+
return findInMap(messageMap, receive.id, receive.version);
|
|
276
|
+
})
|
|
261
277
|
.filter((msg): msg is CollectionEntry<CollectionMessageTypes> => !!msg);
|
|
262
278
|
|
|
279
|
+
// Deduplicate by id and version
|
|
280
|
+
const uniqueSends = Array.from(new Map(sendsMessages.map((msg) => [`${msg.data.id}-${msg.data.version}`, msg])).values());
|
|
281
|
+
const uniqueReceives = Array.from(new Map(receivesMessages.map((msg) => [`${msg.data.id}-${msg.data.version}`, msg])).values());
|
|
282
|
+
|
|
263
283
|
return {
|
|
264
|
-
sends:
|
|
265
|
-
receives:
|
|
284
|
+
sends: uniqueSends,
|
|
285
|
+
receives: uniqueReceives,
|
|
266
286
|
};
|
|
267
287
|
};
|
|
268
288
|
|