@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.
@@ -37,7 +37,7 @@ var import_axios = __toESM(require("axios"), 1);
37
37
  var import_os = __toESM(require("os"), 1);
38
38
 
39
39
  // package.json
40
- var version = "2.38.0";
40
+ var version = "2.38.1";
41
41
 
42
42
  // src/constants.ts
43
43
  var VERSION = version;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  raiseEvent
3
- } from "../chunk-2WN6WIV6.js";
4
- import "../chunk-XJ2PHUZU.js";
3
+ } from "../chunk-A6PSUFM3.js";
4
+ import "../chunk-CM25PJCS.js";
5
5
  export {
6
6
  raiseEvent
7
7
  };
@@ -106,7 +106,7 @@ var import_axios = __toESM(require("axios"), 1);
106
106
  var import_os = __toESM(require("os"), 1);
107
107
 
108
108
  // package.json
109
- var version = "2.38.0";
109
+ var version = "2.38.1";
110
110
 
111
111
  // src/constants.ts
112
112
  var VERSION = version;
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  log_build_default
3
- } from "../chunk-QTN3KJEE.js";
4
- import "../chunk-2WN6WIV6.js";
5
- import "../chunk-XJ2PHUZU.js";
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
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VERSION
3
- } from "./chunk-XJ2PHUZU.js";
3
+ } from "./chunk-CM25PJCS.js";
4
4
 
5
5
  // src/analytics/analytics.js
6
6
  import axios from "axios";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  raiseEvent
3
- } from "./chunk-2WN6WIV6.js";
3
+ } from "./chunk-A6PSUFM3.js";
4
4
  import {
5
5
  getEventCatalogConfigFile,
6
6
  verifyRequiredFieldsAreInCatalogConfigFile
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "2.38.0";
2
+ var version = "2.38.1";
3
3
 
4
4
  // src/constants.ts
5
5
  var VERSION = version;
@@ -25,7 +25,7 @@ __export(constants_exports, {
25
25
  module.exports = __toCommonJS(constants_exports);
26
26
 
27
27
  // package.json
28
- var version = "2.38.0";
28
+ var version = "2.38.1";
29
29
 
30
30
  // src/constants.ts
31
31
  var VERSION = version;
package/dist/constants.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VERSION
3
- } from "./chunk-XJ2PHUZU.js";
3
+ } from "./chunk-CM25PJCS.js";
4
4
  export {
5
5
  VERSION
6
6
  };
@@ -157,7 +157,7 @@ var import_axios = __toESM(require("axios"), 1);
157
157
  var import_os = __toESM(require("os"), 1);
158
158
 
159
159
  // package.json
160
- var version = "2.38.0";
160
+ var version = "2.38.1";
161
161
 
162
162
  // src/constants.ts
163
163
  var VERSION = version;
@@ -6,15 +6,15 @@ import {
6
6
  } from "./chunk-DCLTVJDP.js";
7
7
  import {
8
8
  log_build_default
9
- } from "./chunk-QTN3KJEE.js";
10
- import "./chunk-2WN6WIV6.js";
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-XJ2PHUZU.js";
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 && (
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.38.0",
9
+ "version": "2.38.1",
10
10
  "publishConfig": {
11
11
  "access": "public"
12
12
  },