@eventcatalog/core 2.38.0 → 2.38.1
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-2WN6WIV6.js → chunk-A6PSUFM3.js} +1 -1
- package/dist/{chunk-QTN3KJEE.js → chunk-C45PRE4R.js} +1 -1
- package/dist/{chunk-XJ2PHUZU.js → chunk-CM25PJCS.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/NodeGraph/NodeGraph.astro +30 -1
- package/eventcatalog/src/components/MDX/NodeGraph/NodeGraph.tsx +32 -2
- 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-C45PRE4R.js";
|
|
4
|
+
import "../chunk-A6PSUFM3.js";
|
|
5
|
+
import "../chunk-CM25PJCS.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-C45PRE4R.js";
|
|
10
|
+
import "./chunk-A6PSUFM3.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-CM25PJCS.js";
|
|
18
18
|
import {
|
|
19
19
|
isBackstagePluginEnabled,
|
|
20
20
|
isEventCatalogScaleEnabled,
|
|
@@ -11,7 +11,9 @@ import {
|
|
|
11
11
|
getNodesAndEdgesForDomainContextMap,
|
|
12
12
|
} from '@utils/node-graphs/domains-node-graph';
|
|
13
13
|
import { getNodesAndEdges as getNodesAndEdgesForFlows } from '@utils/node-graphs/flows-node-graph';
|
|
14
|
-
|
|
14
|
+
import { buildUrl } from '@utils/url-builder';
|
|
15
|
+
import { getVersionFromCollection } from '@utils/collections/versions';
|
|
16
|
+
import { pageDataLoader } from '@utils/page-loaders/page-data-loader';
|
|
15
17
|
interface Props {
|
|
16
18
|
id: string;
|
|
17
19
|
collection: string;
|
|
@@ -40,6 +42,8 @@ const getNodesAndEdgesFunctions = {
|
|
|
40
42
|
flows: getNodesAndEdgesForFlows,
|
|
41
43
|
};
|
|
42
44
|
|
|
45
|
+
let links: { label: string; url: string }[] = [];
|
|
46
|
+
|
|
43
47
|
if (collection in getNodesAndEdgesFunctions) {
|
|
44
48
|
const { nodes: fetchedNodes, edges: fetchedEdges } = await getNodesAndEdgesFunctions[
|
|
45
49
|
collection as keyof typeof getNodesAndEdgesFunctions
|
|
@@ -51,6 +55,30 @@ if (collection in getNodesAndEdgesFunctions) {
|
|
|
51
55
|
|
|
52
56
|
nodes = fetchedNodes;
|
|
53
57
|
edges = fetchedEdges;
|
|
58
|
+
|
|
59
|
+
if (mode === 'full') {
|
|
60
|
+
// Try and get the list of versions for the rendered item
|
|
61
|
+
try {
|
|
62
|
+
const allItems = await pageDataLoader[collection as keyof typeof pageDataLoader]();
|
|
63
|
+
const versions = getVersionFromCollection(allItems, id, version);
|
|
64
|
+
|
|
65
|
+
const item = versions[0];
|
|
66
|
+
const listOfVersions = item.data.versions || [];
|
|
67
|
+
|
|
68
|
+
// Order by version
|
|
69
|
+
listOfVersions.sort((a, b) => b.localeCompare(a));
|
|
70
|
+
|
|
71
|
+
if (listOfVersions.length > 1) {
|
|
72
|
+
links = listOfVersions.map((version) => ({
|
|
73
|
+
label: `${item.data.name} v${version}`,
|
|
74
|
+
url: buildUrl(`/visualiser/${collection}/${id}/${version}`),
|
|
75
|
+
selected: version === version,
|
|
76
|
+
}));
|
|
77
|
+
}
|
|
78
|
+
} catch (error) {
|
|
79
|
+
links = [];
|
|
80
|
+
}
|
|
81
|
+
}
|
|
54
82
|
}
|
|
55
83
|
|
|
56
84
|
if (collection === 'domain-context-map') {
|
|
@@ -71,6 +99,7 @@ if (collection === 'domain-context-map') {
|
|
|
71
99
|
linkTo={linkTo}
|
|
72
100
|
client:only="react"
|
|
73
101
|
linksToVisualiser={linksToVisualiser}
|
|
102
|
+
links={links}
|
|
74
103
|
/>
|
|
75
104
|
</div>
|
|
76
105
|
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
useReactFlow,
|
|
15
15
|
} from '@xyflow/react';
|
|
16
16
|
import '@xyflow/react/dist/style.css';
|
|
17
|
-
|
|
17
|
+
import { HistoryIcon } from 'lucide-react';
|
|
18
18
|
// Nodes and edges
|
|
19
19
|
import ServiceNode from './Nodes/Service';
|
|
20
20
|
import FlowNode from './Nodes/Flow';
|
|
@@ -46,6 +46,7 @@ interface Props {
|
|
|
46
46
|
linkTo: 'docs' | 'visualiser';
|
|
47
47
|
includeKey?: boolean;
|
|
48
48
|
linksToVisualiser?: boolean;
|
|
49
|
+
links?: { label: string; url: string }[];
|
|
49
50
|
}
|
|
50
51
|
|
|
51
52
|
const getVisualiserUrlForCollection = (collectionItem: CollectionEntry<CollectionTypes>) => {
|
|
@@ -60,6 +61,7 @@ const NodeGraphBuilder = ({
|
|
|
60
61
|
linkTo = 'docs',
|
|
61
62
|
includeKey = true,
|
|
62
63
|
linksToVisualiser = false,
|
|
64
|
+
links = [],
|
|
63
65
|
}: Props) => {
|
|
64
66
|
const nodeTypes = useMemo(
|
|
65
67
|
() => ({
|
|
@@ -317,8 +319,33 @@ const NodeGraphBuilder = ({
|
|
|
317
319
|
{title}
|
|
318
320
|
</span>
|
|
319
321
|
)}
|
|
320
|
-
<div className="flex justify-end ">
|
|
322
|
+
<div className="flex justify-end space-x-2">
|
|
321
323
|
<DownloadButton filename={title} addPadding={false} />
|
|
324
|
+
{/* // Dropdown for links */}
|
|
325
|
+
{links.length > 0 && (
|
|
326
|
+
<div className="relative flex items-center -mt-1">
|
|
327
|
+
<span className="absolute left-2 pointer-events-none flex items-center h-full">
|
|
328
|
+
<HistoryIcon className="h-4 w-4 text-gray-600" />
|
|
329
|
+
</span>
|
|
330
|
+
<select
|
|
331
|
+
value={links.find((link) => window.location.href.includes(link.url))?.url || links[0].url}
|
|
332
|
+
onChange={(e) => navigate(e.target.value)}
|
|
333
|
+
className="appearance-none pl-7 pr-6 py-0 text-[14px] bg-white rounded-md border border-gray-200 hover:bg-gray-100/50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-purple-500"
|
|
334
|
+
style={{ minWidth: 120, height: '26px' }}
|
|
335
|
+
>
|
|
336
|
+
{links.map((link) => (
|
|
337
|
+
<option key={link.url} value={link.url}>
|
|
338
|
+
{link.label}
|
|
339
|
+
</option>
|
|
340
|
+
))}
|
|
341
|
+
</select>
|
|
342
|
+
<span className="absolute right-2 pointer-events-none">
|
|
343
|
+
<svg className="w-4 h-4 text-gray-400" fill="none" stroke="currentColor" strokeWidth="2" viewBox="0 0 24 24">
|
|
344
|
+
<path strokeLinecap="round" strokeLinejoin="round" d="M19 9l-7 7-7-7" />
|
|
345
|
+
</svg>
|
|
346
|
+
</span>
|
|
347
|
+
</div>
|
|
348
|
+
)}
|
|
322
349
|
</div>
|
|
323
350
|
</div>
|
|
324
351
|
</Panel>
|
|
@@ -409,6 +436,7 @@ interface NodeGraphProps {
|
|
|
409
436
|
includeKey?: boolean;
|
|
410
437
|
footerLabel?: string;
|
|
411
438
|
linksToVisualiser?: boolean;
|
|
439
|
+
links?: { label: string; url: string }[];
|
|
412
440
|
}
|
|
413
441
|
|
|
414
442
|
const NodeGraph = ({
|
|
@@ -422,6 +450,7 @@ const NodeGraph = ({
|
|
|
422
450
|
includeKey = true,
|
|
423
451
|
footerLabel,
|
|
424
452
|
linksToVisualiser = false,
|
|
453
|
+
links = [],
|
|
425
454
|
}: NodeGraphProps) => {
|
|
426
455
|
const [elem, setElem] = useState(null);
|
|
427
456
|
const [showFooter, setShowFooter] = useState(true);
|
|
@@ -452,6 +481,7 @@ const NodeGraph = ({
|
|
|
452
481
|
linkTo={linkTo}
|
|
453
482
|
includeKey={includeKey}
|
|
454
483
|
linksToVisualiser={linksToVisualiser}
|
|
484
|
+
links={links}
|
|
455
485
|
/>
|
|
456
486
|
|
|
457
487
|
{showFooter && (
|