@eventcatalog/core 2.54.2 → 2.54.4
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 +0 -9
- 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-TFCOMD54.js → chunk-ILYNXPYT.js} +1 -1
- package/dist/{chunk-LC46PXQR.js → chunk-QTOY4HR4.js} +1 -1
- package/dist/{chunk-6BODD7KM.js → chunk-RSPVRELK.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/src/components/MDX/EntityMap/EntityMap.astro +29 -10
- package/eventcatalog/src/components/MDX/SchemaViewer/SchemaViewerRoot.astro +2 -2
- package/eventcatalog/src/components/MDX/components.tsx +1 -1
- package/eventcatalog/src/utils/files.ts +26 -23
- package/eventcatalog/src/utils/node-graphs/domain-entity-map.ts +19 -9
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -140,15 +140,6 @@ Thank you to our project sponsors.
|
|
|
140
140
|
|
|
141
141
|
<hr />
|
|
142
142
|
|
|
143
|
-
<div align="center">
|
|
144
|
-
<img alt="oso" src="./images/sponsors/oso-logo-green.png" width="30%" />
|
|
145
|
-
<p style="margin: 0; padding: 0;">Delivering Apache Kafka professional services to your business
|
|
146
|
-
</p>
|
|
147
|
-
<a href="https://oso.sh/?utm_source=eventcatalog&utm_medium=web&utm_campaign=sponsorship" target="_blank" >Learn more</a>
|
|
148
|
-
</div>
|
|
149
|
-
|
|
150
|
-
<hr />
|
|
151
|
-
|
|
152
143
|
_Sponsors help make EventCatalog sustainable, want to help the project? Get in touch! Or [visit our sponsor page](https://www.eventcatalog.dev/support)._
|
|
153
144
|
|
|
154
145
|
# Enterprise support
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
log_build_default
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
5
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-RSPVRELK.js";
|
|
4
|
+
import "../chunk-QTOY4HR4.js";
|
|
5
|
+
import "../chunk-ILYNXPYT.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,8 +6,8 @@ import {
|
|
|
6
6
|
} from "./chunk-XE6PFSH5.js";
|
|
7
7
|
import {
|
|
8
8
|
log_build_default
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-RSPVRELK.js";
|
|
10
|
+
import "./chunk-QTOY4HR4.js";
|
|
11
11
|
import {
|
|
12
12
|
catalogToAstro,
|
|
13
13
|
checkAndConvertMdToMdx
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
import "./chunk-LDBRNJIL.js";
|
|
16
16
|
import {
|
|
17
17
|
VERSION
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-ILYNXPYT.js";
|
|
19
19
|
import {
|
|
20
20
|
getProjectOutDir,
|
|
21
21
|
isAuthEnabled,
|
|
@@ -4,28 +4,47 @@ import { getNodesAndEdges } from '@utils/node-graphs/domain-entity-map.ts';
|
|
|
4
4
|
import Admonition from '@components/MDX/Admonition';
|
|
5
5
|
import NodeGraph from '../NodeGraph/NodeGraph';
|
|
6
6
|
import { getVersionFromCollection } from '@utils/collections/versions';
|
|
7
|
+
import { getServices } from '@utils/collections/services';
|
|
7
8
|
|
|
8
|
-
const { id, version = 'latest', maxHeight, includeKey = true, entities } = Astro.props;
|
|
9
|
+
const { id, version = 'latest', maxHeight, includeKey = true, entities, collection = 'domains', ...rest } = Astro.props;
|
|
10
|
+
let resource = null;
|
|
9
11
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const
|
|
12
|
+
let resourceId = id;
|
|
13
|
+
|
|
14
|
+
// If the user did not provide an id, we need to use the id from the rest props (the collection)
|
|
15
|
+
const isAstroGeneratedId = id.match(/-\d+\.\d+\.\d+$/);
|
|
16
|
+
if (isAstroGeneratedId) {
|
|
17
|
+
resourceId = rest.data.id;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if (collection === 'domains') {
|
|
21
|
+
const domains = await getDomains();
|
|
22
|
+
const domainCollection = getVersionFromCollection(domains, resourceId, version) || [];
|
|
23
|
+
resource = domainCollection[0];
|
|
24
|
+
} else if (collection === 'services') {
|
|
25
|
+
const services = await getServices();
|
|
26
|
+
const serviceCollection = getVersionFromCollection(services, resourceId, version) || [];
|
|
27
|
+
resource = serviceCollection[0];
|
|
28
|
+
} else {
|
|
29
|
+
throw new Error(`Invalid collection: ${collection}`);
|
|
30
|
+
}
|
|
14
31
|
|
|
15
32
|
const { nodes, edges } = await getNodesAndEdges({
|
|
16
|
-
id:
|
|
17
|
-
version:
|
|
33
|
+
id: resourceId,
|
|
34
|
+
version: resource?.data?.version,
|
|
18
35
|
...(entities ? { entities } : {}), // Pass entities if provided
|
|
36
|
+
type: collection,
|
|
19
37
|
});
|
|
20
38
|
---
|
|
21
39
|
|
|
22
40
|
{
|
|
23
|
-
!
|
|
41
|
+
!resource && (
|
|
24
42
|
<Admonition type="warning">
|
|
25
43
|
<div>
|
|
26
44
|
<span class="block font-bold">{`<EntityMap/>`} failed to load</span>
|
|
27
45
|
<span class="block">
|
|
28
|
-
Tried to load
|
|
46
|
+
Tried to load {collection} id: {id} with version {version}. Make sure you have this {collection} defined in your
|
|
47
|
+
project.
|
|
29
48
|
</span>
|
|
30
49
|
</div>
|
|
31
50
|
</Admonition>
|
|
@@ -49,7 +68,7 @@ const { nodes, edges } = await getNodesAndEdges({
|
|
|
49
68
|
linkTo={'visualiser'}
|
|
50
69
|
mode="simple"
|
|
51
70
|
includeKey={includeKey}
|
|
52
|
-
footerLabel
|
|
71
|
+
footerLabel={`Entity Map - ${resource?.data?.name} - v(${resource?.data?.version})`}
|
|
53
72
|
client:only="react"
|
|
54
73
|
portalId={`${id}-entity-map-portal`}
|
|
55
74
|
/>
|
|
@@ -7,12 +7,12 @@ import path from 'path';
|
|
|
7
7
|
import SchemaViewerClient from './SchemaViewer.astro';
|
|
8
8
|
import Admonition from '../Admonition';
|
|
9
9
|
import { getMDXComponentsByName } from '@utils/markdown';
|
|
10
|
-
import { getAbsoluteFilePathForAstroFile } from '@utils/files';
|
|
10
|
+
import { getAbsoluteFilePathForAstroFile, resolveProjectPath } from '@utils/files';
|
|
11
11
|
|
|
12
12
|
let schemas = [];
|
|
13
13
|
|
|
14
14
|
try {
|
|
15
|
-
const absoluteFilePath =
|
|
15
|
+
const absoluteFilePath = resolveProjectPath(filePath);
|
|
16
16
|
const file = await fs.readFile(absoluteFilePath, 'utf-8');
|
|
17
17
|
const schemaViewers = getMDXComponentsByName(file, 'SchemaViewer');
|
|
18
18
|
|
|
@@ -44,7 +44,7 @@ const components = (props: any) => {
|
|
|
44
44
|
MessageTable: (mdxProp: any) => jsx(MessageTable, { ...props, ...mdxProp }),
|
|
45
45
|
EntityPropertiesTable: (mdxProp: any) => jsx(EntityPropertiesTable, { ...props, ...mdxProp }),
|
|
46
46
|
NodeGraph: (mdxProp: any) => jsx(NodeGraphPortal, { ...props.data, ...mdxProp, props, mdxProp }),
|
|
47
|
-
EntityMap,
|
|
47
|
+
EntityMap: (mdxProp: any) => jsx(EntityMap, { ...props, ...mdxProp }),
|
|
48
48
|
OpenAPI,
|
|
49
49
|
ResourceGroupTable: (mdxProp: any) => jsx(ResourceGroupTable, { ...props, ...mdxProp }),
|
|
50
50
|
ResourceLink: (mdxProp: any) => jsx(ResourceLink, { ...props, ...mdxProp }),
|
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Resolves a file path relative to PROJECT_DIR, handling ../ paths correctly
|
|
5
|
+
* @param filePath - The path to resolve
|
|
6
|
+
* @param projectDir - The project directory to resolve relative to
|
|
7
|
+
* @returns The resolved absolute path
|
|
8
|
+
*/
|
|
9
|
+
export const resolveProjectPath = (filePath: string, projectDir: string = process.env.PROJECT_DIR || process.cwd()): string => {
|
|
10
|
+
if (filePath.startsWith('../')) {
|
|
11
|
+
const pathAfterDotDot = filePath.substring(3);
|
|
12
|
+
const projectDirName = path.basename(projectDir);
|
|
13
|
+
const projectParentName = path.basename(path.dirname(projectDir));
|
|
14
|
+
|
|
15
|
+
if (pathAfterDotDot.startsWith(`${projectParentName}/${projectDirName}/`)) {
|
|
16
|
+
const remainingPath = pathAfterDotDot.substring(`${projectParentName}/${projectDirName}/`.length);
|
|
17
|
+
return path.join(projectDir, remainingPath);
|
|
18
|
+
} else {
|
|
19
|
+
const projectParent = path.dirname(projectDir);
|
|
20
|
+
return path.join(projectParent, pathAfterDotDot);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return path.join(projectDir, filePath);
|
|
24
|
+
};
|
|
25
|
+
|
|
3
26
|
/**
|
|
4
27
|
* Using the Astro filePath, this returns the absolute path to the file
|
|
5
28
|
*
|
|
@@ -14,30 +37,10 @@ export const getAbsoluteFilePathForAstroFile = (filePath: string, fileName?: str
|
|
|
14
37
|
const PROJECT_DIR = process.env.PROJECT_DIR || process.cwd();
|
|
15
38
|
|
|
16
39
|
if (fileName) {
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
// Check for overlapping path segments
|
|
20
|
-
const projectDirSegments = PROJECT_DIR.split(path.sep);
|
|
21
|
-
const relativePathSegments = safeRelativePath.split(path.posix.sep);
|
|
22
|
-
|
|
23
|
-
// Find the longest matching suffix of PROJECT_DIR with prefix of relative path
|
|
24
|
-
let overlapLength = 0;
|
|
25
|
-
for (let i = 1; i <= Math.min(projectDirSegments.length, relativePathSegments.length); i++) {
|
|
26
|
-
const projectSuffix = projectDirSegments.slice(-i);
|
|
27
|
-
const relativPrefix = relativePathSegments.slice(0, i);
|
|
28
|
-
|
|
29
|
-
if (projectSuffix.join(path.sep) === relativPrefix.join(path.posix.sep)) {
|
|
30
|
-
overlapLength = i;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
// Remove overlapping segments from the relative path
|
|
35
|
-
const cleanedRelativePath = relativePathSegments.slice(overlapLength).join(path.posix.sep);
|
|
36
|
-
const absoluteFilePath = path.join(PROJECT_DIR, cleanedRelativePath);
|
|
37
|
-
|
|
38
|
-
const directory = path.dirname(absoluteFilePath || '');
|
|
40
|
+
const resolvedFilePath = resolveProjectPath(filePath, PROJECT_DIR);
|
|
41
|
+
const directory = path.dirname(resolvedFilePath);
|
|
39
42
|
return path.join(directory, fileName);
|
|
40
43
|
}
|
|
41
44
|
|
|
42
|
-
return
|
|
45
|
+
return resolveProjectPath(filePath, PROJECT_DIR);
|
|
43
46
|
};
|
|
@@ -6,6 +6,7 @@ import { getItemsFromCollectionByIdAndSemverOrLatest } from '@utils/collections/
|
|
|
6
6
|
import { getVersionFromCollection } from '@utils/collections/versions';
|
|
7
7
|
import { getEntities, type Entity } from '@utils/entities';
|
|
8
8
|
import { getDomains, type Domain } from '@utils/collections/domains';
|
|
9
|
+
import { getServices, type Service } from '@utils/collections/services';
|
|
9
10
|
|
|
10
11
|
const elk = new ELK();
|
|
11
12
|
|
|
@@ -13,36 +14,45 @@ interface Props {
|
|
|
13
14
|
id: string;
|
|
14
15
|
version: string;
|
|
15
16
|
entities?: string[]; // Optional: array of entity IDs/names to include
|
|
17
|
+
type?: 'domains' | 'services';
|
|
16
18
|
}
|
|
17
19
|
|
|
18
|
-
export const getNodesAndEdges = async ({ id, version, entities }: Props) => {
|
|
20
|
+
export const getNodesAndEdges = async ({ id, version, entities, type = 'domains' }: Props) => {
|
|
19
21
|
let nodes = [] as any,
|
|
20
22
|
edges = [] as any;
|
|
21
23
|
|
|
22
24
|
const allDomains = await getDomains();
|
|
23
25
|
const allEntities = await getEntities();
|
|
26
|
+
const allServices = await getServices();
|
|
24
27
|
|
|
25
|
-
|
|
26
|
-
|
|
28
|
+
let resource = null;
|
|
29
|
+
|
|
30
|
+
if (type === 'domains') {
|
|
31
|
+
resource = getVersionFromCollection(allDomains, id, version)[0] as Domain;
|
|
32
|
+
} else if (type === 'services') {
|
|
33
|
+
resource = getVersionFromCollection(allServices, id, version)[0] as Service;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
let resourceEntities = (resource?.data?.entities ?? []) as any;
|
|
27
37
|
|
|
28
38
|
// If entities filter is provided, filter domainEntities to only those specified
|
|
29
39
|
if (entities && Array.isArray(entities) && entities.length > 0) {
|
|
30
|
-
|
|
40
|
+
resourceEntities = resourceEntities.filter(
|
|
31
41
|
(entity: Entity) => entities.includes(entity.data.id) || entities.includes(entity.data.name)
|
|
32
42
|
);
|
|
33
43
|
}
|
|
34
44
|
|
|
35
|
-
const entitiesWithReferences =
|
|
45
|
+
const entitiesWithReferences = resourceEntities.filter((entity: Entity) =>
|
|
36
46
|
entity.data.properties?.some((property: any) => property.references)
|
|
37
47
|
);
|
|
38
48
|
// Creates all the entity nodes for the domain
|
|
39
|
-
for (const entity of
|
|
49
|
+
for (const entity of resourceEntities) {
|
|
40
50
|
const nodeId = generateIdForNode(entity);
|
|
41
51
|
nodes.push({
|
|
42
52
|
id: nodeId,
|
|
43
53
|
type: 'entities',
|
|
44
54
|
position: { x: 0, y: 0 },
|
|
45
|
-
data: { label: entity.data.name, entity, domainName:
|
|
55
|
+
data: { label: entity.data.name, entity, domainName: resource?.data.name, domainId: resource?.data.id },
|
|
46
56
|
});
|
|
47
57
|
}
|
|
48
58
|
|
|
@@ -53,7 +63,7 @@ export const getNodesAndEdges = async ({ id, version, entities }: Props) => {
|
|
|
53
63
|
.filter((ref: any) => ref !== undefined);
|
|
54
64
|
|
|
55
65
|
const externalToDomain = Array.from(new Set<string>(listOfReferencedEntities as string[])) // Remove duplicates
|
|
56
|
-
.filter((entityId: any) => !
|
|
66
|
+
.filter((entityId: any) => !resourceEntities.some((domainEntity: any) => domainEntity.id === entityId));
|
|
57
67
|
|
|
58
68
|
// Helper function to find which domain an entity belongs to
|
|
59
69
|
const findEntityDomain = (entityId: string) => {
|
|
@@ -98,7 +108,7 @@ export const getNodesAndEdges = async ({ id, version, entities }: Props) => {
|
|
|
98
108
|
entitiesWithReferences.push(...addedExternalEntities);
|
|
99
109
|
|
|
100
110
|
// Create complete list of entities for edge creation and layout
|
|
101
|
-
const allEntitiesInGraph = [...
|
|
111
|
+
const allEntitiesInGraph = [...resourceEntities, ...addedExternalEntities];
|
|
102
112
|
|
|
103
113
|
// Go through any entities that are related to other entities
|
|
104
114
|
for (const entity of entitiesWithReferences) {
|
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": "2.54.
|
|
9
|
+
"version": "2.54.4",
|
|
10
10
|
"publishConfig": {
|
|
11
11
|
"access": "public"
|
|
12
12
|
},
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"@ai-sdk/openai": "^1.3.16",
|
|
27
27
|
"@astrojs/markdown-remark": "^6.3.3",
|
|
28
28
|
"@astrojs/mdx": "^4.3.1",
|
|
29
|
-
"@astrojs/node": "^9.3.
|
|
29
|
+
"@astrojs/node": "^9.3.1",
|
|
30
30
|
"@astrojs/react": "^4.3.0",
|
|
31
31
|
"@astrojs/rss": "^4.0.12",
|
|
32
32
|
"@astrojs/tailwind": "^6.0.2",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"@tanstack/react-table": "^8.17.3",
|
|
57
57
|
"@xyflow/react": "^12.3.6",
|
|
58
58
|
"ai": "^4.3.9",
|
|
59
|
-
"astro": "^5.12.
|
|
59
|
+
"astro": "^5.12.5",
|
|
60
60
|
"astro-compress": "^2.3.8",
|
|
61
61
|
"astro-expressive-code": "^0.40.1",
|
|
62
62
|
"astro-seo": "^0.8.4",
|