@eventcatalog/core 4.3.1 → 4.3.3
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-GC7WNQP6.js → chunk-2IGBU3PN.js} +1 -1
- package/dist/{chunk-UXHV3GN7.js → chunk-HR6KK56F.js} +1 -1
- package/dist/{chunk-ZYVGVWMQ.js → chunk-OWE74ZHY.js} +3 -3
- package/dist/{chunk-E3KVC4LF.js → chunk-PXBG5QKU.js} +1 -1
- package/dist/{chunk-GC6SSPJI.js → chunk-UW52WRSH.js} +1 -1
- package/dist/constants.cjs +1 -1
- package/dist/constants.js +1 -1
- package/dist/docs/api/02-config.md +24 -0
- package/dist/docs/cli/governance.md +1 -1
- package/dist/docs/cli/snapshots.md +1 -1
- package/dist/docs/development/ask-your-architecture/03-mcp-server/getting-started.md +56 -7
- package/dist/docs/development/ask-your-architecture/03-mcp-server/introduction.md +8 -3
- package/dist/docs/development/deployment/build-ssr-mode.md +1 -9
- package/dist/docs/development/developer-tools/api-catalog.md +1 -1
- package/dist/docs/development/guides/98-versioning-resources.md +15 -0
- package/dist/docs/development/guides/resources/entities/03-model-entity-relationships.md +66 -0
- package/dist/docs/development/guides/resources/entities/05-entity-maps.md +2 -0
- package/dist/docs/development/guides/resources/entities/06-reference.md +29 -2
- package/dist/docs/development/guides/resources/services/07-versioning-and-lifecycle/01-version-services.md +2 -0
- package/dist/docs/plugins/asyncapi/02-plugin-configuration.md +30 -2
- package/dist/docs/plugins/asyncapi/03-features.md +39 -26
- package/dist/docs/plugins/asyncapi/03a-workflows.md +61 -2
- package/dist/docs/plugins/openapi/02-plugin-configuration.md +1 -2
- package/dist/docs/plugins/openapi/03-features.md +8 -6
- package/dist/docs/plugins/openapi/03a-workflows.md +79 -18
- package/dist/eventcatalog.cjs +1 -1
- package/dist/eventcatalog.js +9 -9
- 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/components/LatestVersionRedirect.astro +26 -0
- package/eventcatalog/src/components/MDX/EntityPropertiesTable/EntityPropertiesTable.astro +46 -10
- package/eventcatalog/src/content.config.ts +39 -19
- package/eventcatalog/src/pages/docs/services/[id]/[docType]/[docId]/index.astro +25 -0
- package/eventcatalog/src/pages/docs/services/[id]/asyncapi/[filename].astro +25 -0
- package/eventcatalog/src/pages/docs/services/[id]/changelog/index.astro +25 -0
- package/eventcatalog/src/pages/docs/services/[id]/graphql/[filename].astro +25 -0
- package/eventcatalog/src/pages/docs/services/[id]/spec/[filename].astro +25 -0
- package/eventcatalog/src/pages/docs/services/_latest-version-route.ts +42 -0
- package/eventcatalog/src/stores/sidebar-store/builders/service.ts +9 -12
- package/eventcatalog/src/stores/sidebar-store/builders/shared.ts +4 -2
- package/eventcatalog/src/utils/node-graphs/domain-entity-map.ts +28 -11
- package/package.json +4 -4
- package/dist/docs/cli/import.md +0 -26
|
@@ -963,6 +963,44 @@ const ubiquitousLanguages = defineCollection({
|
|
|
963
963
|
}),
|
|
964
964
|
});
|
|
965
965
|
|
|
966
|
+
interface EntityPropertySchema {
|
|
967
|
+
name: string;
|
|
968
|
+
type: string;
|
|
969
|
+
required?: boolean;
|
|
970
|
+
description?: string;
|
|
971
|
+
references?: string;
|
|
972
|
+
referencesIdentifier?: string;
|
|
973
|
+
referenceTarget?: 'entity';
|
|
974
|
+
relationType?: string;
|
|
975
|
+
enum?: string[];
|
|
976
|
+
properties?: EntityPropertySchema[];
|
|
977
|
+
items?: {
|
|
978
|
+
type: string;
|
|
979
|
+
properties?: EntityPropertySchema[];
|
|
980
|
+
};
|
|
981
|
+
}
|
|
982
|
+
|
|
983
|
+
const entityPropertySchema: z.ZodType<EntityPropertySchema> = z.lazy(() =>
|
|
984
|
+
z.object({
|
|
985
|
+
name: z.string(),
|
|
986
|
+
type: z.string(),
|
|
987
|
+
required: z.boolean().optional(),
|
|
988
|
+
description: z.string().optional(),
|
|
989
|
+
references: z.string().optional(),
|
|
990
|
+
referencesIdentifier: z.string().optional(),
|
|
991
|
+
referenceTarget: z.literal('entity').optional(),
|
|
992
|
+
relationType: z.string().optional(),
|
|
993
|
+
enum: z.array(z.string()).optional(),
|
|
994
|
+
properties: z.array(entityPropertySchema).optional(),
|
|
995
|
+
items: z
|
|
996
|
+
.object({
|
|
997
|
+
type: z.string(),
|
|
998
|
+
properties: z.array(entityPropertySchema).optional(),
|
|
999
|
+
})
|
|
1000
|
+
.optional(),
|
|
1001
|
+
})
|
|
1002
|
+
);
|
|
1003
|
+
|
|
966
1004
|
const entities = defineCollection({
|
|
967
1005
|
loader: globWithSafeWatcher({
|
|
968
1006
|
pattern: withIgnoredBuildArtifacts(['**/entities/*/index.(md|mdx)', '**/entities/*/versioned/*/index.(md|mdx)']),
|
|
@@ -976,25 +1014,7 @@ const entities = defineCollection({
|
|
|
976
1014
|
.object({
|
|
977
1015
|
aggregateRoot: z.boolean().optional(),
|
|
978
1016
|
identifier: z.string().optional(),
|
|
979
|
-
properties: z
|
|
980
|
-
.array(
|
|
981
|
-
z.object({
|
|
982
|
-
name: z.string(),
|
|
983
|
-
type: z.string(),
|
|
984
|
-
required: z.boolean().optional(),
|
|
985
|
-
description: z.string().optional(),
|
|
986
|
-
references: z.string().optional(),
|
|
987
|
-
referencesIdentifier: z.string().optional(),
|
|
988
|
-
relationType: z.string().optional(),
|
|
989
|
-
enum: z.array(z.string()).optional(),
|
|
990
|
-
items: z
|
|
991
|
-
.object({
|
|
992
|
-
type: z.string(),
|
|
993
|
-
})
|
|
994
|
-
.optional(),
|
|
995
|
-
})
|
|
996
|
-
)
|
|
997
|
-
.optional(),
|
|
1017
|
+
properties: z.array(entityPropertySchema).optional(),
|
|
998
1018
|
services: z.array(reference('services')).optional(),
|
|
999
1019
|
domains: z.array(reference('domains')).optional(),
|
|
1000
1020
|
detailsPanel: z
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
import LatestVersionRedirect from '@components/LatestVersionRedirect.astro';
|
|
3
|
+
import { isResourceDocsEnabled, isSSR } from '@utils/feature';
|
|
4
|
+
import { buildUrl } from '@utils/url-builder';
|
|
5
|
+
import { Page as VersionedPage } from '../../../../[type]/[id]/[version]/[docType]/[docId]/_index.data';
|
|
6
|
+
import { getLatestServicePaths, getLatestServiceVersion } from '../../../_latest-version-route';
|
|
7
|
+
|
|
8
|
+
export const prerender = !isSSR();
|
|
9
|
+
export const getStaticPaths = async () => getLatestServicePaths(await VersionedPage.getStaticPaths());
|
|
10
|
+
|
|
11
|
+
const { id, docType, docId } = Astro.params;
|
|
12
|
+
const version = Astro.props.redirectVersion ?? (id ? await getLatestServiceVersion(id) : undefined);
|
|
13
|
+
|
|
14
|
+
if (!isResourceDocsEnabled() || !id || !docType || !docId || !version) {
|
|
15
|
+
throw new Response(null, { status: 404, statusText: 'Resource documentation not found' });
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const redirectUrl = buildUrl(`/docs/services/${id}/${version}/${docType}/${docId}`);
|
|
19
|
+
|
|
20
|
+
if (isSSR()) {
|
|
21
|
+
return Astro.redirect(`${redirectUrl}${Astro.url.search}${Astro.url.hash}`);
|
|
22
|
+
}
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
<LatestVersionRedirect title="Latest service documentation" redirectUrl={redirectUrl} />
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
import LatestVersionRedirect from '@components/LatestVersionRedirect.astro';
|
|
3
|
+
import { isSSR } from '@utils/feature';
|
|
4
|
+
import { buildUrl } from '@utils/url-builder';
|
|
5
|
+
import { Page as VersionedPage } from '../../../[type]/[id]/[version]/asyncapi/_[filename].data';
|
|
6
|
+
import { getLatestServicePaths, getLatestServiceVersion } from '../../_latest-version-route';
|
|
7
|
+
|
|
8
|
+
export const prerender = !isSSR();
|
|
9
|
+
export const getStaticPaths = async () => getLatestServicePaths(await VersionedPage.getStaticPaths());
|
|
10
|
+
|
|
11
|
+
const { id, filename } = Astro.params;
|
|
12
|
+
const version = Astro.props.redirectVersion ?? (id ? await getLatestServiceVersion(id) : undefined);
|
|
13
|
+
|
|
14
|
+
if (!id || !filename || !version) {
|
|
15
|
+
throw new Response(null, { status: 404, statusText: 'AsyncAPI specification not found' });
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const redirectUrl = buildUrl(`/docs/services/${id}/${version}/asyncapi/${filename}`);
|
|
19
|
+
|
|
20
|
+
if (isSSR()) {
|
|
21
|
+
return Astro.redirect(`${redirectUrl}${Astro.url.search}${Astro.url.hash}`);
|
|
22
|
+
}
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
<LatestVersionRedirect title="Latest AsyncAPI specification" redirectUrl={redirectUrl} />
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
import LatestVersionRedirect from '@components/LatestVersionRedirect.astro';
|
|
3
|
+
import { isChangelogEnabled, isSSR } from '@utils/feature';
|
|
4
|
+
import { buildUrl } from '@utils/url-builder';
|
|
5
|
+
import { Page as VersionedPage } from '../../../[type]/[id]/[version]/changelog/_index.data';
|
|
6
|
+
import { getLatestServicePaths, getLatestServiceVersion } from '../../_latest-version-route';
|
|
7
|
+
|
|
8
|
+
export const prerender = !isSSR();
|
|
9
|
+
export const getStaticPaths = async () => getLatestServicePaths(await VersionedPage.getStaticPaths());
|
|
10
|
+
|
|
11
|
+
const { id } = Astro.params;
|
|
12
|
+
const version = Astro.props.redirectVersion ?? (id ? await getLatestServiceVersion(id) : undefined);
|
|
13
|
+
|
|
14
|
+
if (!isChangelogEnabled() || !id || !version) {
|
|
15
|
+
throw new Response(null, { status: 404, statusText: 'Changelog not found' });
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const redirectUrl = buildUrl(`/docs/services/${id}/${version}/changelog`);
|
|
19
|
+
|
|
20
|
+
if (isSSR()) {
|
|
21
|
+
return Astro.redirect(`${redirectUrl}${Astro.url.search}${Astro.url.hash}`);
|
|
22
|
+
}
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
<LatestVersionRedirect title="Latest service changelog" redirectUrl={redirectUrl} />
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
import LatestVersionRedirect from '@components/LatestVersionRedirect.astro';
|
|
3
|
+
import { isSSR } from '@utils/feature';
|
|
4
|
+
import { buildUrl } from '@utils/url-builder';
|
|
5
|
+
import { Page as VersionedPage } from '../../../[type]/[id]/[version]/graphql/_[filename].data';
|
|
6
|
+
import { getLatestServicePaths, getLatestServiceVersion } from '../../_latest-version-route';
|
|
7
|
+
|
|
8
|
+
export const prerender = !isSSR();
|
|
9
|
+
export const getStaticPaths = async () => getLatestServicePaths(await VersionedPage.getStaticPaths());
|
|
10
|
+
|
|
11
|
+
const { id, filename } = Astro.params;
|
|
12
|
+
const version = Astro.props.redirectVersion ?? (id ? await getLatestServiceVersion(id) : undefined);
|
|
13
|
+
|
|
14
|
+
if (!id || !filename || !version) {
|
|
15
|
+
throw new Response(null, { status: 404, statusText: 'GraphQL specification not found' });
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const redirectUrl = buildUrl(`/docs/services/${id}/${version}/graphql/${filename}`);
|
|
19
|
+
|
|
20
|
+
if (isSSR()) {
|
|
21
|
+
return Astro.redirect(`${redirectUrl}${Astro.url.search}${Astro.url.hash}`);
|
|
22
|
+
}
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
<LatestVersionRedirect title="Latest GraphQL specification" redirectUrl={redirectUrl} />
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
import LatestVersionRedirect from '@components/LatestVersionRedirect.astro';
|
|
3
|
+
import { isSSR } from '@utils/feature';
|
|
4
|
+
import { buildUrl } from '@utils/url-builder';
|
|
5
|
+
import { Page as VersionedPage } from '../../../[type]/[id]/[version]/spec/_[filename].data';
|
|
6
|
+
import { getLatestServicePaths, getLatestServiceVersion } from '../../_latest-version-route';
|
|
7
|
+
|
|
8
|
+
export const prerender = !isSSR();
|
|
9
|
+
export const getStaticPaths = async () => getLatestServicePaths(await VersionedPage.getStaticPaths());
|
|
10
|
+
|
|
11
|
+
const { id, filename } = Astro.params;
|
|
12
|
+
const version = Astro.props.redirectVersion ?? (id ? await getLatestServiceVersion(id) : undefined);
|
|
13
|
+
|
|
14
|
+
if (!id || !filename || !version) {
|
|
15
|
+
throw new Response(null, { status: 404, statusText: 'OpenAPI specification not found' });
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const redirectUrl = buildUrl(`/docs/services/${id}/${version}/spec/${filename}`);
|
|
19
|
+
|
|
20
|
+
if (isSSR()) {
|
|
21
|
+
return Astro.redirect(`${redirectUrl}${Astro.url.search}${Astro.url.hash}`);
|
|
22
|
+
}
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
<LatestVersionRedirect title="Latest OpenAPI specification" redirectUrl={redirectUrl} />
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { CollectionEntry } from 'astro:content';
|
|
2
|
+
|
|
3
|
+
type StaticPath = {
|
|
4
|
+
params: Record<string, string | undefined>;
|
|
5
|
+
props?: Record<string, unknown>;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
type LatestService = CollectionEntry<'services'>;
|
|
9
|
+
|
|
10
|
+
export const toLatestServicePaths = (paths: StaticPath[], latestServices: LatestService[]): StaticPath[] => {
|
|
11
|
+
const latestVersions = new Map(latestServices.map((service) => [service.data.id, service.data.version]));
|
|
12
|
+
|
|
13
|
+
return paths.flatMap(({ params, props = {} }) => {
|
|
14
|
+
const { type, version, ...aliasParams } = params;
|
|
15
|
+
|
|
16
|
+
if (type !== 'services' || !params.id || latestVersions.get(params.id) !== version) {
|
|
17
|
+
return [];
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return [
|
|
21
|
+
{
|
|
22
|
+
params: aliasParams,
|
|
23
|
+
props: {
|
|
24
|
+
...props,
|
|
25
|
+
redirectVersion: version,
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
];
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const getLatestServicePaths = async (paths: StaticPath[]): Promise<StaticPath[]> => {
|
|
33
|
+
const { getServices } = await import('@utils/collections/services');
|
|
34
|
+
const latestServices = await getServices({ getAllVersions: false });
|
|
35
|
+
return toLatestServicePaths(paths, latestServices);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export const getLatestServiceVersion = async (id: string): Promise<string | undefined> => {
|
|
39
|
+
const { getServices } = await import('@utils/collections/services');
|
|
40
|
+
const latestServices = await getServices({ getAllVersions: false });
|
|
41
|
+
return latestServices.find((service) => service.data.id === id)?.data.version;
|
|
42
|
+
};
|
|
@@ -58,12 +58,15 @@ export const buildServiceNode = (
|
|
|
58
58
|
const renderEntities = serviceEntities.length > 0 && shouldRenderSideBarSection(service, 'entities');
|
|
59
59
|
const renderOwners = owners.length > 0 && shouldRenderSideBarSection(service, 'owners');
|
|
60
60
|
const renderRepository = service.data.repository && shouldRenderSideBarSection(service, 'repository');
|
|
61
|
+
const isLatestVersion = service.data.version === service.data.latestVersion;
|
|
62
|
+
const docsBasePath = `/docs/services/${service.data.id}${isLatestVersion ? '' : `/${service.data.version}`}`;
|
|
61
63
|
const docsSection = buildResourceDocsSection(
|
|
62
64
|
'services',
|
|
63
65
|
service.data.id,
|
|
64
66
|
service.data.version,
|
|
65
67
|
context.resourceDocs,
|
|
66
|
-
context.resourceDocCategories
|
|
68
|
+
context.resourceDocCategories,
|
|
69
|
+
{ includeVersionInUrl: !isLatestVersion }
|
|
67
70
|
);
|
|
68
71
|
|
|
69
72
|
// Diagrams
|
|
@@ -82,11 +85,11 @@ export const buildServiceNode = (
|
|
|
82
85
|
pages: [
|
|
83
86
|
buildQuickReferenceSection(
|
|
84
87
|
[
|
|
85
|
-
{ title: 'Overview', href: buildUrl(
|
|
88
|
+
{ title: 'Overview', href: buildUrl(docsBasePath) },
|
|
86
89
|
isChangelogEnabled() &&
|
|
87
90
|
shouldRenderSideBarSection(service, 'changelog') && {
|
|
88
91
|
title: 'Changelog',
|
|
89
|
-
href: buildUrl(
|
|
92
|
+
href: buildUrl(`${docsBasePath}/changelog`),
|
|
90
93
|
},
|
|
91
94
|
].filter(Boolean) as { title: string; href: string }[]
|
|
92
95
|
),
|
|
@@ -135,25 +138,19 @@ export const buildServiceNode = (
|
|
|
135
138
|
type: 'item',
|
|
136
139
|
title: `${specification.name}`,
|
|
137
140
|
leftIcon: '/icons/openapi-black.svg',
|
|
138
|
-
href: buildUrl(
|
|
139
|
-
`/docs/services/${service.data.id}/${service.data.version}/spec/${specification.filenameWithoutExtension}`
|
|
140
|
-
),
|
|
141
|
+
href: buildUrl(`${docsBasePath}/spec/${specification.filenameWithoutExtension}`),
|
|
141
142
|
})),
|
|
142
143
|
...asyncAPISpecifications.map((specification) => ({
|
|
143
144
|
type: 'item',
|
|
144
145
|
title: `${specification.name}`,
|
|
145
146
|
leftIcon: '/icons/asyncapi-black.svg',
|
|
146
|
-
href: buildUrl(
|
|
147
|
-
`/docs/services/${service.data.id}/${service.data.version}/asyncapi/${specification.filenameWithoutExtension}`
|
|
148
|
-
),
|
|
147
|
+
href: buildUrl(`${docsBasePath}/asyncapi/${specification.filenameWithoutExtension}`),
|
|
149
148
|
})),
|
|
150
149
|
...graphQLSpecifications.map((specification) => ({
|
|
151
150
|
type: 'item',
|
|
152
151
|
title: `${specification.name}`,
|
|
153
152
|
leftIcon: '/icons/graphql-black.svg',
|
|
154
|
-
href: buildUrl(
|
|
155
|
-
`/docs/services/${service.data.id}/${service.data.version}/graphql/${specification.filenameWithoutExtension}`
|
|
156
|
-
),
|
|
153
|
+
href: buildUrl(`${docsBasePath}/graphql/${specification.filenameWithoutExtension}`),
|
|
157
154
|
})),
|
|
158
155
|
],
|
|
159
156
|
},
|
|
@@ -189,8 +189,10 @@ export const buildResourceDocsSection = (
|
|
|
189
189
|
id: string,
|
|
190
190
|
version: string,
|
|
191
191
|
resourceDocs: ResourceDocEntry[],
|
|
192
|
-
resourceDocCategories: ResourceDocCategoryEntry[]
|
|
192
|
+
resourceDocCategories: ResourceDocCategoryEntry[],
|
|
193
|
+
options: { includeVersionInUrl?: boolean } = {}
|
|
193
194
|
): NavNode | null => {
|
|
195
|
+
const { includeVersionInUrl = true } = options;
|
|
194
196
|
const docsForResource = resourceDocs.filter(
|
|
195
197
|
(doc) => doc.data.resourceCollection === collection && doc.data.resourceId === id && doc.data.resourceVersion === version
|
|
196
198
|
);
|
|
@@ -249,7 +251,7 @@ export const buildResourceDocsSection = (
|
|
|
249
251
|
type: 'item',
|
|
250
252
|
title: doc.data.title || doc.data.id,
|
|
251
253
|
href: buildUrl(
|
|
252
|
-
`/docs/${collection}/${id}
|
|
254
|
+
`/docs/${collection}/${id}${includeVersionInUrl ? `/${version}` : ''}/${encodeURIComponent(doc.data.type)}/${encodeURIComponent(doc.data.id)}`
|
|
253
255
|
),
|
|
254
256
|
})),
|
|
255
257
|
})),
|
|
@@ -10,12 +10,19 @@ import { getServices, type Service } from '@utils/collections/services';
|
|
|
10
10
|
|
|
11
11
|
const elk = new ELK();
|
|
12
12
|
|
|
13
|
+
export const ENTITY_TARGET_HANDLE_ID = '__eventcatalog-entity-target';
|
|
14
|
+
|
|
13
15
|
const getReferencedEntityId = (property: any, entityMap: Map<string, Entity[]>) => {
|
|
14
16
|
if (property.references) return property.references;
|
|
15
17
|
if (property.type === 'array' && property.items?.type && entityMap.has(property.items.type)) return property.items.type;
|
|
16
18
|
return undefined;
|
|
17
19
|
};
|
|
18
20
|
|
|
21
|
+
const getReferencePropertyNames = (entity: Entity, entityMap: Map<string, Entity[]>) =>
|
|
22
|
+
entity.data.properties
|
|
23
|
+
?.filter((property: any) => getReferencedEntityId(property, entityMap))
|
|
24
|
+
.map((property: any) => property.name) ?? [];
|
|
25
|
+
|
|
19
26
|
const getRelationType = (property: any) => {
|
|
20
27
|
if (property.relationType) return property.relationType;
|
|
21
28
|
if (property.type === 'array' && property.items?.type) return 'hasMany';
|
|
@@ -64,7 +71,14 @@ export const getNodesAndEdges = async ({ id, version, entities, type = 'domains'
|
|
|
64
71
|
id: nodeId,
|
|
65
72
|
type: 'entities',
|
|
66
73
|
position: { x: 0, y: 0 },
|
|
67
|
-
data: {
|
|
74
|
+
data: {
|
|
75
|
+
label: entity.data.name,
|
|
76
|
+
entity,
|
|
77
|
+
domainName: resource?.data.name,
|
|
78
|
+
domainId: resource?.data.id,
|
|
79
|
+
entityTargetHandle: ENTITY_TARGET_HANDLE_ID,
|
|
80
|
+
referencePropertyNames: getReferencePropertyNames(entity, entityMap),
|
|
81
|
+
},
|
|
68
82
|
});
|
|
69
83
|
}
|
|
70
84
|
|
|
@@ -116,6 +130,8 @@ export const getNodesAndEdges = async ({ id, version, entities, type = 'domains'
|
|
|
116
130
|
externalToDomain: true,
|
|
117
131
|
domainName: domainName,
|
|
118
132
|
domainId: domainId,
|
|
133
|
+
entityTargetHandle: ENTITY_TARGET_HANDLE_ID,
|
|
134
|
+
referencePropertyNames: getReferencePropertyNames(externalEntity, entityMap),
|
|
119
135
|
},
|
|
120
136
|
});
|
|
121
137
|
addedExternalEntities.push(externalEntity);
|
|
@@ -151,9 +167,12 @@ export const getNodesAndEdges = async ({ id, version, entities, type = 'domains'
|
|
|
151
167
|
// Use the property name as the source handle
|
|
152
168
|
const sourceHandle = `${referenceProperty.name}-source`;
|
|
153
169
|
|
|
154
|
-
//
|
|
170
|
+
// Whole-entity targeting is explicit so existing catalogs retain their
|
|
171
|
+
// identifier/first-property fallback behavior.
|
|
155
172
|
let targetHandle = '';
|
|
156
|
-
if (referenceProperty.
|
|
173
|
+
if (referenceProperty.referenceTarget === 'entity') {
|
|
174
|
+
targetHandle = ENTITY_TARGET_HANDLE_ID;
|
|
175
|
+
} else if (referenceProperty.referencesIdentifier) {
|
|
157
176
|
targetHandle = `${referenceProperty.referencesIdentifier}-target`;
|
|
158
177
|
} else if (referencedEntity.data.identifier) {
|
|
159
178
|
targetHandle = `${referencedEntity.data.identifier}-target`;
|
|
@@ -211,8 +230,8 @@ export const getNodesAndEdges = async ({ id, version, entities, type = 'domains'
|
|
|
211
230
|
// Prepare ELK graph structure
|
|
212
231
|
const elkNodes = nodes.map((node: any) => ({
|
|
213
232
|
id: node.id,
|
|
214
|
-
width:
|
|
215
|
-
height:
|
|
233
|
+
width: 220,
|
|
234
|
+
height: Math.max(120, 72 + (node.data.entity.data.properties?.length ?? 0) * 40),
|
|
216
235
|
}));
|
|
217
236
|
|
|
218
237
|
const elkEdges = edges.map((edge: any) => ({
|
|
@@ -225,12 +244,10 @@ export const getNodesAndEdges = async ({ id, version, entities, type = 'domains'
|
|
|
225
244
|
id: 'root',
|
|
226
245
|
layoutOptions: {
|
|
227
246
|
'elk.algorithm': 'force',
|
|
228
|
-
'elk.force.
|
|
229
|
-
'elk.
|
|
230
|
-
'elk.spacing.
|
|
231
|
-
'elk.
|
|
232
|
-
'elk.spacing.edgeEdge': '30',
|
|
233
|
-
'elk.padding': '[top=50,left=50,bottom=50,right=50]',
|
|
247
|
+
'elk.force.iterations': '300',
|
|
248
|
+
'elk.spacing.nodeNode': '45',
|
|
249
|
+
'elk.spacing.componentComponent': '50',
|
|
250
|
+
'elk.padding': '[top=30,left=30,bottom=30,right=30]',
|
|
234
251
|
'elk.separateConnectedComponents': 'true',
|
|
235
252
|
},
|
|
236
253
|
children: elkNodes,
|
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
},
|
|
8
8
|
"license": "SEE LICENSE IN LICENSE",
|
|
9
9
|
"type": "module",
|
|
10
|
-
"version": "4.3.
|
|
10
|
+
"version": "4.3.3",
|
|
11
11
|
"publishConfig": {
|
|
12
12
|
"access": "public"
|
|
13
13
|
},
|
|
@@ -116,9 +116,9 @@
|
|
|
116
116
|
"update-notifier": "^7.3.1",
|
|
117
117
|
"uuid": "^10.0.0",
|
|
118
118
|
"zod": "^4.3.6",
|
|
119
|
-
"@eventcatalog/
|
|
120
|
-
"@eventcatalog/
|
|
121
|
-
"@eventcatalog/
|
|
119
|
+
"@eventcatalog/linter": "1.1.8",
|
|
120
|
+
"@eventcatalog/sdk": "2.26.3",
|
|
121
|
+
"@eventcatalog/visualiser": "^4.1.1"
|
|
122
122
|
},
|
|
123
123
|
"devDependencies": {
|
|
124
124
|
"@astrojs/check": "^0.9.9",
|
package/dist/docs/cli/import.md
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
id: cli-import
|
|
3
|
-
title: Import
|
|
4
|
-
sidebar_label: Import
|
|
5
|
-
sidebar_position: 18
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
# Import CLI Commands
|
|
9
|
-
|
|
10
|
-
Manage import in your EventCatalog from the command line.
|
|
11
|
-
|
|
12
|
-
## import
|
|
13
|
-
|
|
14
|
-
Import EventCatalog DSL (.ec) files into catalog markdown files. Existing resources with the same version are overridden. Importing a newer version automatically moves the old version into the versioned/ folder.
|
|
15
|
-
|
|
16
|
-
**Arguments:**
|
|
17
|
-
| Name | Type | Required | Description |
|
|
18
|
-
|------|------|----------|-------------|
|
|
19
|
-
| files | string | No | One or more .ec file paths to import |
|
|
20
|
-
| stdin | boolean | No | Read DSL from stdin |
|
|
21
|
-
| dry-run | boolean | No | Preview resources without writing |
|
|
22
|
-
| no-init | boolean | No | Skip catalog initialization prompt |
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
---
|