@eventcatalog/core 2.54.7 → 2.55.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 +4 -4
- package/dist/catalog-to-astro-content-directory.cjs +1 -1
- package/dist/catalog-to-astro-content-directory.js +3 -3
- package/dist/{chunk-BLDONK5J.js → chunk-2C7LRK2M.js} +3 -3
- package/dist/{chunk-YEQVKHST.js → chunk-3W6JYTHP.js} +2 -2
- package/dist/{chunk-LDBRNJIL.js → chunk-55D645EH.js} +1 -1
- package/dist/{chunk-47KZ3TZP.js → chunk-C2SLLLIQ.js} +1 -1
- package/dist/{chunk-IBVRYW45.js → chunk-HVIAPJSO.js} +1 -1
- package/dist/{chunk-MCSZBCOG.js → chunk-I23A46WZ.js} +3 -3
- package/dist/{chunk-XT6J7YSQ.js → chunk-MYOJ2HFW.js} +2 -2
- package/dist/{chunk-XE6PFSH5.js → chunk-PLNJC7NZ.js} +2 -2
- package/dist/{chunk-IZMM7ZGY.js → chunk-R2BJ7MJG.js} +4 -4
- package/dist/{chunk-E7TXTI7G.js → chunk-UPONRQSN.js} +4 -4
- package/dist/constants.cjs +1 -1
- package/dist/constants.js +1 -1
- package/dist/eventcatalog-config-file-utils.js +1 -1
- package/dist/eventcatalog.cjs +2 -2
- package/dist/eventcatalog.js +14 -14
- package/dist/features.js +2 -2
- package/dist/generate.js +2 -2
- package/dist/map-catalog-to-astro.js +1 -1
- package/dist/resolve-catalog-dependencies.js +2 -2
- package/dist/watcher.js +2 -2
- package/eventcatalog/astro.config.mjs +2 -0
- package/eventcatalog/integrations/ecstudio-watcher.mjs +62 -0
- package/eventcatalog/src/components/Grids/ServiceGrid.tsx +2 -2
- package/eventcatalog/src/components/MDX/Design/Design.astro +67 -0
- package/eventcatalog/src/components/MDX/NodeGraph/NodeGraph.tsx +39 -16
- package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Actor.tsx +24 -0
- package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Channel.tsx +20 -119
- package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Command.tsx +19 -76
- package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Data.tsx +24 -0
- package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Event.tsx +20 -82
- package/eventcatalog/src/components/MDX/NodeGraph/Nodes/ExternalSystem2.tsx +24 -0
- package/eventcatalog/src/components/MDX/NodeGraph/Nodes/MessageContextMenu.tsx +9 -3
- package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Query.tsx +19 -74
- package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Service.tsx +19 -73
- package/eventcatalog/src/components/MDX/NodeGraph/Nodes/View.tsx +24 -0
- package/eventcatalog/src/components/MDX/components.tsx +2 -0
- package/eventcatalog/src/components/Search/Search.astro +2 -2
- package/eventcatalog/src/components/SideNav/ListViewSideBar/index.tsx +23 -0
- package/eventcatalog/src/components/SideNav/ListViewSideBar/types.ts +8 -0
- package/eventcatalog/src/components/SideNav/ListViewSideBar/utils.ts +11 -0
- package/eventcatalog/src/content.config.ts +35 -0
- package/eventcatalog/src/pages/visualiser/designs/[id]/_index.data.ts +75 -0
- package/eventcatalog/src/pages/visualiser/designs/[id]/index.astro +31 -0
- package/eventcatalog/src/pages/visualiser/domains/[id]/[version]/entity-map/_index.data.ts +0 -2
- package/eventcatalog/src/utils/collections/designs.ts +13 -0
- package/eventcatalog/src/utils/collections/file-diffs.ts +1 -1
- package/eventcatalog/src/utils/node-graphs/domains-canvas.ts +3 -3
- package/eventcatalog/src/utils/node-graphs/flows-node-graph.ts +7 -7
- package/eventcatalog/src/utils/node-graphs/message-node-graph.ts +8 -3
- package/eventcatalog/src/utils/node-graphs/services-node-graph.ts +7 -6
- package/eventcatalog/src/utils/node-graphs/utils/utils.ts +1 -1
- package/eventcatalog/tailwind.config.mjs +1 -0
- package/package.json +2 -1
|
@@ -1,33 +1,13 @@
|
|
|
1
|
-
import { ServerIcon } from '@heroicons/react/16/solid';
|
|
2
|
-
import type { CollectionEntry } from 'astro:content';
|
|
3
1
|
import { Handle } from '@xyflow/react';
|
|
4
2
|
import * as ContextMenu from '@radix-ui/react-context-menu';
|
|
5
3
|
import { buildUrl } from '@utils/url-builder';
|
|
6
|
-
import {
|
|
4
|
+
import { Position } from '@xyflow/react';
|
|
7
5
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
bgColor: string;
|
|
11
|
-
color: string;
|
|
12
|
-
mode: 'simple' | 'full';
|
|
13
|
-
service: CollectionEntry<'services'>;
|
|
14
|
-
showTarget?: boolean;
|
|
15
|
-
showSource?: boolean;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
function classNames(...classes: any) {
|
|
19
|
-
return classes.filter(Boolean).join(' ');
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export default function ServiceNode({ data, sourcePosition, targetPosition }: any) {
|
|
23
|
-
const { mode, service } = data as Data;
|
|
6
|
+
import { nodeComponents, type ServiceNode } from '@eventcatalog/visualizer';
|
|
7
|
+
const ServiceComponent = nodeComponents.service;
|
|
24
8
|
|
|
25
|
-
|
|
26
|
-
const {
|
|
27
|
-
|
|
28
|
-
const Icon = getIcon(icon);
|
|
29
|
-
const nodeLabel = label || service?.data?.sidebar?.badge || 'Service';
|
|
30
|
-
const fontSize = nodeLabel.length > 10 ? '7px' : '9px';
|
|
9
|
+
export default function ServiceNode(props: ServiceNode) {
|
|
10
|
+
const { id, version, specifications, repository } = props.data.service as any;
|
|
31
11
|
|
|
32
12
|
let asyncApiFiles = Array.isArray(specifications) ? specifications?.filter((spec) => spec.type === 'asyncapi') : ([] as any);
|
|
33
13
|
let openApiFiles = Array.isArray(specifications) ? specifications?.filter((spec) => spec.type === 'openapi') : ([] as any);
|
|
@@ -60,54 +40,20 @@ export default function ServiceNode({ data, sourcePosition, targetPosition }: an
|
|
|
60
40
|
return (
|
|
61
41
|
<ContextMenu.Root>
|
|
62
42
|
<ContextMenu.Trigger>
|
|
63
|
-
<div className=
|
|
64
|
-
<
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
)}
|
|
78
|
-
</div>
|
|
79
|
-
<div className="p-1 min-w-60 max-w-[min-content]">
|
|
80
|
-
{targetPosition && <Handle type="target" position={targetPosition} />}
|
|
81
|
-
{sourcePosition && <Handle type="source" position={sourcePosition} />}
|
|
82
|
-
<div className={classNames(mode === 'full' ? `border-b border-gray-200` : '')}>
|
|
83
|
-
<span className="text-xs font-bold block pt-0.5 pb-0.5">{name}</span>
|
|
84
|
-
<div className="flex justify-between">
|
|
85
|
-
<span className="text-[10px] font-light block pt-0.5 pb-0.5 ">v{version}</span>
|
|
86
|
-
{mode === 'simple' && (
|
|
87
|
-
<span className="text-[10px] text-gray-500 font-light block pt-0.5 pb-0.5 ">{nodeLabel}</span>
|
|
88
|
-
)}
|
|
89
|
-
</div>
|
|
90
|
-
</div>
|
|
91
|
-
{mode === 'full' && (
|
|
92
|
-
<div className="divide-y divide-gray-200 ">
|
|
93
|
-
<div className="leading-3 py-1">
|
|
94
|
-
<span className="text-[8px] font-light">{service.data.summary}</span>
|
|
95
|
-
</div>
|
|
96
|
-
|
|
97
|
-
<div className="grid grid-cols-2 gap-x-4 py-1">
|
|
98
|
-
<span className="text-xs" style={{ fontSize: '0.2em' }}>
|
|
99
|
-
Receives messages: {receives.length}
|
|
100
|
-
</span>
|
|
101
|
-
<span className="text-xs" style={{ fontSize: '0.2em' }}>
|
|
102
|
-
Publishes messages: {sends.length}
|
|
103
|
-
</span>
|
|
104
|
-
<span className="text-xs" style={{ fontSize: '0.2em' }}>
|
|
105
|
-
Owners: {owners.length}
|
|
106
|
-
</span>
|
|
107
|
-
</div>
|
|
108
|
-
</div>
|
|
109
|
-
)}
|
|
110
|
-
</div>
|
|
43
|
+
<div className="relative">
|
|
44
|
+
<Handle
|
|
45
|
+
type="target"
|
|
46
|
+
position={Position.Left}
|
|
47
|
+
style={{ width: 10, height: 10, background: 'pink', zIndex: 10 }}
|
|
48
|
+
className="bg-pink-500"
|
|
49
|
+
/>
|
|
50
|
+
<Handle
|
|
51
|
+
type="source"
|
|
52
|
+
position={Position.Right}
|
|
53
|
+
style={{ width: 10, height: 10, background: 'pink', zIndex: 10 }}
|
|
54
|
+
className="bg-pink-500"
|
|
55
|
+
/>
|
|
56
|
+
<ServiceComponent {...props} />
|
|
111
57
|
</div>
|
|
112
58
|
</ContextMenu.Trigger>
|
|
113
59
|
<ContextMenu.Portal>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Handle, Position } from '@xyflow/react';
|
|
2
|
+
|
|
3
|
+
import { nodeComponents, type ViewNode } from '@eventcatalog/visualizer';
|
|
4
|
+
const ViewComponent = nodeComponents.view;
|
|
5
|
+
|
|
6
|
+
export default function ViewNode(props: ViewNode) {
|
|
7
|
+
return (
|
|
8
|
+
<div className="relative">
|
|
9
|
+
<Handle
|
|
10
|
+
type="target"
|
|
11
|
+
position={Position.Left}
|
|
12
|
+
style={{ width: 10, height: 10, background: 'blue', zIndex: 10 }}
|
|
13
|
+
className="bg-gray-500"
|
|
14
|
+
/>
|
|
15
|
+
<Handle
|
|
16
|
+
type="source"
|
|
17
|
+
position={Position.Right}
|
|
18
|
+
style={{ width: 10, height: 10, background: 'blue', zIndex: 10 }}
|
|
19
|
+
className="bg-gray-500"
|
|
20
|
+
/>
|
|
21
|
+
<ViewComponent {...props} />
|
|
22
|
+
</div>
|
|
23
|
+
);
|
|
24
|
+
}
|
|
@@ -24,6 +24,7 @@ import Miro from '@components/MDX/Miro/Miro.astro';
|
|
|
24
24
|
import Lucid from '@components/MDX/Lucid/Lucid.astro';
|
|
25
25
|
import DrawIO from '@components/MDX/DrawIO/DrawIO.astro';
|
|
26
26
|
import FigJam from '@components/MDX/FigJam/FigJam.astro';
|
|
27
|
+
import Design from '@components/MDX/Design/Design.astro';
|
|
27
28
|
// Portals: required for server/client components
|
|
28
29
|
import NodeGraphPortal from '@components/MDX/NodeGraph/NodeGraphPortal';
|
|
29
30
|
import SchemaViewerPortal from '@components/MDX/SchemaViewer/SchemaViewerPortal';
|
|
@@ -37,6 +38,7 @@ const components = (props: any) => {
|
|
|
37
38
|
Admonition,
|
|
38
39
|
AsyncAPI,
|
|
39
40
|
ChannelInformation: (mdxProp: any) => ChannelInformation({ ...props.data, ...mdxProp }),
|
|
41
|
+
Design: (mdxProp: any) => jsx(Design, { ...props, ...mdxProp }),
|
|
40
42
|
File: (mdxProp: any) => File({ ...props, ...mdxProp }),
|
|
41
43
|
RemoteSchema,
|
|
42
44
|
Flow,
|
|
@@ -3,8 +3,8 @@ import MagnifyingGlassIcon from '@heroicons/react/24/outline/MagnifyingGlassIcon
|
|
|
3
3
|
import SearchModal from './SearchModal.tsx';
|
|
4
4
|
import { buildUrl } from '@utils/url-builder.ts';
|
|
5
5
|
|
|
6
|
-
const pagefindJsUrl = buildUrl('/pagefind/pagefind.js');
|
|
7
|
-
const pagefindCssUrl = buildUrl('/pagefind/pagefind-ui.css');
|
|
6
|
+
const pagefindJsUrl = buildUrl('/pagefind/pagefind.js', true);
|
|
7
|
+
const pagefindCssUrl = buildUrl('/pagefind/pagefind-ui.css', true);
|
|
8
8
|
---
|
|
9
9
|
|
|
10
10
|
<link href={pagefindCssUrl} rel="stylesheet" />
|
|
@@ -314,6 +314,7 @@ const ListViewSideBar: React.FC<ListViewSideBarProps> = ({ resources, currentPat
|
|
|
314
314
|
}))
|
|
315
315
|
.filter((service: ServiceItem & { isVisible: boolean }) => service.isVisible) || [],
|
|
316
316
|
flows: data.flows?.filter(filterItem) || [],
|
|
317
|
+
designs: data.designs?.filter(filterItem) || [],
|
|
317
318
|
messagesNotInService:
|
|
318
319
|
data.messagesNotInService?.filter(
|
|
319
320
|
(msg: MessageItem) =>
|
|
@@ -758,6 +759,28 @@ const ListViewSideBar: React.FC<ListViewSideBarProps> = ({ resources, currentPat
|
|
|
758
759
|
</ul>
|
|
759
760
|
</div>
|
|
760
761
|
)}
|
|
762
|
+
{filteredData['designs'] && isVisualizer && (
|
|
763
|
+
<div className="pt-4 pb-2">
|
|
764
|
+
<ul className="space-y-4">
|
|
765
|
+
{filteredData['designs'].map((item: any) => (
|
|
766
|
+
<li key={item.href} className="space-y-0" data-active={decodedCurrentPath === item.href}>
|
|
767
|
+
<a
|
|
768
|
+
href={item.href}
|
|
769
|
+
data-active={decodedCurrentPath === item.href}
|
|
770
|
+
className={`flex items-center justify-between px-2 py-0.5 text-xs font-bold rounded-md ${
|
|
771
|
+
decodedCurrentPath === item.href ? 'bg-cyan-100 text-cyan-900' : 'hover:bg-purple-100'
|
|
772
|
+
}`}
|
|
773
|
+
>
|
|
774
|
+
<span className="truncate">
|
|
775
|
+
<HighlightedText text={item.label} searchTerm={debouncedSearchTerm} />
|
|
776
|
+
</span>
|
|
777
|
+
<span className="text-cyan-600 ml-2 text-[10px] font-medium bg-cyan-50 px-2 py-0.5 rounded">DESIGN</span>
|
|
778
|
+
</a>
|
|
779
|
+
</li>
|
|
780
|
+
))}
|
|
781
|
+
</ul>
|
|
782
|
+
</div>
|
|
783
|
+
)}
|
|
761
784
|
</>
|
|
762
785
|
)}
|
|
763
786
|
</div>
|
|
@@ -52,6 +52,13 @@ export interface FlowItem {
|
|
|
52
52
|
label: string;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
+
export interface DesignItem {
|
|
56
|
+
href: string;
|
|
57
|
+
label: string;
|
|
58
|
+
id: string;
|
|
59
|
+
name: string;
|
|
60
|
+
}
|
|
61
|
+
|
|
55
62
|
export interface Resources {
|
|
56
63
|
'context-map'?: Array<{
|
|
57
64
|
href: string;
|
|
@@ -62,6 +69,7 @@ export interface Resources {
|
|
|
62
69
|
domains?: DomainItem[];
|
|
63
70
|
services?: ServiceItem[];
|
|
64
71
|
flows?: FlowItem[];
|
|
72
|
+
designs?: DesignItem[];
|
|
65
73
|
messagesNotInService?: MessageItem[];
|
|
66
74
|
commands?: MessageItem[];
|
|
67
75
|
queries?: MessageItem[];
|
|
@@ -7,6 +7,7 @@ import { getServices, getSpecificationsForService } from '@utils/collections/ser
|
|
|
7
7
|
import { getCommands } from '@utils/commands';
|
|
8
8
|
import { getEvents } from '@utils/events';
|
|
9
9
|
import { getQueries } from '@utils/queries';
|
|
10
|
+
import { getDesigns } from '@utils/collections/designs';
|
|
10
11
|
|
|
11
12
|
const stripCollection = (collection: any) => {
|
|
12
13
|
return collection.map((item: any) => ({
|
|
@@ -25,6 +26,7 @@ export async function getResourcesForNavigation({ currentPath }: { currentPath:
|
|
|
25
26
|
const domains = await getDomains({ getAllVersions: false });
|
|
26
27
|
const channels = await getChannels({ getAllVersions: false });
|
|
27
28
|
const flows = await getFlows({ getAllVersions: false });
|
|
29
|
+
const designs = await getDesigns({ getAllVersions: false });
|
|
28
30
|
|
|
29
31
|
const messages = [...events, ...commands, ...queries];
|
|
30
32
|
|
|
@@ -152,5 +154,14 @@ export async function getResourcesForNavigation({ currentPath }: { currentPath:
|
|
|
152
154
|
messagesNotInService: messagesNotInServiceAsSideNav,
|
|
153
155
|
};
|
|
154
156
|
|
|
157
|
+
// Add designs?
|
|
158
|
+
if (designs.length > 0) {
|
|
159
|
+
sideNav['designs'] = designs.map((design) => ({
|
|
160
|
+
label: design.data.name,
|
|
161
|
+
href: buildUrl(`/visualiser/designs/${design.data.id}`),
|
|
162
|
+
collection: 'designs',
|
|
163
|
+
}));
|
|
164
|
+
}
|
|
165
|
+
|
|
155
166
|
return sideNav;
|
|
156
167
|
}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { z, defineCollection, reference } from 'astro:content';
|
|
2
2
|
import { glob } from 'astro/loaders';
|
|
3
|
+
import { glob as globPackage } from 'glob';
|
|
3
4
|
import { v4 as uuidv4 } from 'uuid';
|
|
4
5
|
import { badge, ownerReference } from './content.config-shared-collections';
|
|
6
|
+
import fs from 'fs';
|
|
7
|
+
import path from 'path';
|
|
5
8
|
|
|
6
9
|
// Enterprise Collections
|
|
7
10
|
import { chatPromptsSchema, customPagesSchema } from './enterprise/collections';
|
|
@@ -556,6 +559,35 @@ const teams = defineCollection({
|
|
|
556
559
|
}),
|
|
557
560
|
});
|
|
558
561
|
|
|
562
|
+
const designs = defineCollection({
|
|
563
|
+
loader: async () => {
|
|
564
|
+
const data = await globPackage('**/**/*.ecstudio', { cwd: projectDirBase });
|
|
565
|
+
// File all the files in the designs folder
|
|
566
|
+
// Limit 3 designs community edition?
|
|
567
|
+
const files = data.reduce<{ id: string; name: string }[]>((acc, filePath) => {
|
|
568
|
+
try {
|
|
569
|
+
const data = fs.readFileSync(path.join(projectDirBase!, filePath), 'utf-8');
|
|
570
|
+
const json = JSON.parse(data);
|
|
571
|
+
return [...acc, { ...json }];
|
|
572
|
+
} catch (error) {
|
|
573
|
+
console.error('Error loading design', error);
|
|
574
|
+
return acc;
|
|
575
|
+
}
|
|
576
|
+
}, []);
|
|
577
|
+
return files;
|
|
578
|
+
},
|
|
579
|
+
schema: z.object({
|
|
580
|
+
id: z.string(),
|
|
581
|
+
name: z.string(),
|
|
582
|
+
creationDate: z.string(),
|
|
583
|
+
source: z.string(),
|
|
584
|
+
nodes: z.any(),
|
|
585
|
+
edges: z.any(),
|
|
586
|
+
viewport: z.any(),
|
|
587
|
+
version: z.string(),
|
|
588
|
+
}),
|
|
589
|
+
});
|
|
590
|
+
|
|
559
591
|
export const collections = {
|
|
560
592
|
events,
|
|
561
593
|
commands,
|
|
@@ -576,4 +608,7 @@ export const collections = {
|
|
|
576
608
|
// EventCatalog Pro Collections
|
|
577
609
|
customPages,
|
|
578
610
|
chatPrompts,
|
|
611
|
+
|
|
612
|
+
// EventCatalog Studio Collections
|
|
613
|
+
designs,
|
|
579
614
|
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { HybridPage } from '@utils/page-loaders/hybrid-page';
|
|
2
|
+
import { isAuthEnabled } from '@utils/feature';
|
|
3
|
+
|
|
4
|
+
export class Page extends HybridPage {
|
|
5
|
+
static async getStaticPaths(): Promise<Array<{ params: any; props: any }>> {
|
|
6
|
+
if (isAuthEnabled()) {
|
|
7
|
+
return [];
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const { getDesigns } = await import('@utils/collections/designs');
|
|
11
|
+
|
|
12
|
+
const designs = await getDesigns();
|
|
13
|
+
|
|
14
|
+
return designs.map((item) => ({
|
|
15
|
+
params: {
|
|
16
|
+
type: 'designs',
|
|
17
|
+
id: item.data.id,
|
|
18
|
+
},
|
|
19
|
+
props: {
|
|
20
|
+
type: 'designs',
|
|
21
|
+
...item,
|
|
22
|
+
},
|
|
23
|
+
}));
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
protected static async fetchData(params: any) {
|
|
27
|
+
const { id } = params;
|
|
28
|
+
|
|
29
|
+
if (!id) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const { getDesigns } = await import('@utils/collections/designs');
|
|
34
|
+
const designs = await getDesigns();
|
|
35
|
+
|
|
36
|
+
const design = designs.find((design) => design.data.id === id);
|
|
37
|
+
|
|
38
|
+
if (!design) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return {
|
|
43
|
+
type: 'designs',
|
|
44
|
+
...design,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
protected static createNotFoundResponse(): Response {
|
|
49
|
+
return new Response(null, {
|
|
50
|
+
status: 404,
|
|
51
|
+
statusText: 'Design not found',
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
static get clientAuthScript(): string {
|
|
56
|
+
if (!isAuthEnabled()) {
|
|
57
|
+
return '';
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return `
|
|
61
|
+
if (typeof window !== 'undefined' && !import.meta.env.SSR) {
|
|
62
|
+
fetch('/api/auth/session')
|
|
63
|
+
.then(res => res.json())
|
|
64
|
+
.then(session => {
|
|
65
|
+
if (!session?.user) {
|
|
66
|
+
window.location.href = '/auth/login?callbackUrl=' + encodeURIComponent(window.location.pathname);
|
|
67
|
+
}
|
|
68
|
+
})
|
|
69
|
+
.catch(() => {
|
|
70
|
+
window.location.href = '/auth/login?callbackUrl=' + encodeURIComponent(window.location.pathname);
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
`;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
import NodeGraph from '@components/MDX/NodeGraph/NodeGraph';
|
|
3
|
+
import { ClientRouter } from 'astro:transitions';
|
|
4
|
+
import VerticalSideBarLayout from '@layouts/VerticalSideBarLayout.astro';
|
|
5
|
+
|
|
6
|
+
import { Page } from './_index.data';
|
|
7
|
+
|
|
8
|
+
export const prerender = Page.prerender;
|
|
9
|
+
export const getStaticPaths = Page.getStaticPaths;
|
|
10
|
+
|
|
11
|
+
const props = Astro.props;
|
|
12
|
+
|
|
13
|
+
const { data } = props;
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
<VerticalSideBarLayout title={`Visualiser | Bounded context map`}>
|
|
17
|
+
<div class="bg-gray-100/50 m-4">
|
|
18
|
+
<div class="h-[calc(100vh-130px)] w-full relative border border-gray-200" id={`${data.id}-portal`} transition:animate="fade">
|
|
19
|
+
</div>
|
|
20
|
+
<NodeGraph
|
|
21
|
+
id={data.id}
|
|
22
|
+
nodes={data.nodes}
|
|
23
|
+
edges={data.edges}
|
|
24
|
+
title={data.name}
|
|
25
|
+
client:only="react"
|
|
26
|
+
mode="full"
|
|
27
|
+
linkTo="visualiser"
|
|
28
|
+
/>
|
|
29
|
+
</div>
|
|
30
|
+
<ClientRouter />
|
|
31
|
+
</VerticalSideBarLayout>
|
|
@@ -39,8 +39,6 @@ export class Page extends HybridPage {
|
|
|
39
39
|
// Find the specific item by id and version, and only if it has entities
|
|
40
40
|
const item = items.find((i) => i.data.id === id && i.data.version === version && domainHasEntities(i));
|
|
41
41
|
|
|
42
|
-
console.log('ITEM', item);
|
|
43
|
-
|
|
44
42
|
if (!item) {
|
|
45
43
|
return null;
|
|
46
44
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { getCollection } from 'astro:content';
|
|
2
|
+
import type { CollectionEntry } from 'astro:content';
|
|
3
|
+
|
|
4
|
+
export type Design = CollectionEntry<'designs'>;
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
getAllVersions?: boolean;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const getDesigns = async ({ getAllVersions = true }: Props = {}): Promise<Design[]> => {
|
|
11
|
+
const designs = await getCollection('designs');
|
|
12
|
+
return designs.sort((a, b) => a.data.name.localeCompare(b.data.name));
|
|
13
|
+
};
|
|
@@ -6,7 +6,7 @@ import { getItemsFromCollectionByIdAndSemverOrLatest } from './util';
|
|
|
6
6
|
import type { CollectionEntry } from 'astro:content';
|
|
7
7
|
import type { CollectionTypes } from '@types';
|
|
8
8
|
|
|
9
|
-
const FILE_EXTENSIONS_TO_INCLUDE = ['.json', '.avro', '.yaml', '.yml', '.proto', '.pb', '.pbjson', '.pb.go'];
|
|
9
|
+
const FILE_EXTENSIONS_TO_INCLUDE = ['.json', '.avsc', '.avro', '.yaml', '.yml', '.proto', '.pb', '.pbjson', '.pb.go'];
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Generates a diff string in a unified diff format for two versions of a file.
|
|
@@ -166,7 +166,7 @@ export const getDomainsCanvasData = async (): Promise<DomainCanvasData> => {
|
|
|
166
166
|
position: { x: 0, y: 0 }, // Temporary position, will be calculated by dagre
|
|
167
167
|
data: {
|
|
168
168
|
mode: 'simple',
|
|
169
|
-
message: messageObject,
|
|
169
|
+
message: { ...messageObject.data },
|
|
170
170
|
},
|
|
171
171
|
sourcePosition: 'right',
|
|
172
172
|
targetPosition: 'left',
|
|
@@ -188,7 +188,7 @@ export const getDomainsCanvasData = async (): Promise<DomainCanvasData> => {
|
|
|
188
188
|
animated: true,
|
|
189
189
|
label: 'publishes',
|
|
190
190
|
data: {
|
|
191
|
-
message: messageObject,
|
|
191
|
+
message: { ...messageObject.data },
|
|
192
192
|
type: 'domain-to-message',
|
|
193
193
|
publisherService: service,
|
|
194
194
|
},
|
|
@@ -213,7 +213,7 @@ export const getDomainsCanvasData = async (): Promise<DomainCanvasData> => {
|
|
|
213
213
|
animated: true,
|
|
214
214
|
label: 'consumed by',
|
|
215
215
|
data: {
|
|
216
|
-
message: messageObject,
|
|
216
|
+
message: { ...messageObject.data },
|
|
217
217
|
type: 'message-to-domain',
|
|
218
218
|
consumerService: service,
|
|
219
219
|
},
|
|
@@ -89,7 +89,7 @@ export const getNodesAndEdges = async ({ id, defaultFlow, version, mode = 'simpl
|
|
|
89
89
|
targetPosition: 'left',
|
|
90
90
|
data: {
|
|
91
91
|
mode,
|
|
92
|
-
step: step,
|
|
92
|
+
step: { ...step, ...step.data },
|
|
93
93
|
showTarget: true,
|
|
94
94
|
showSource: true,
|
|
95
95
|
},
|
|
@@ -97,12 +97,12 @@ export const getNodesAndEdges = async ({ id, defaultFlow, version, mode = 'simpl
|
|
|
97
97
|
type: step.type,
|
|
98
98
|
} as NodeType;
|
|
99
99
|
|
|
100
|
-
if (step.service) node.data.service = step.service;
|
|
101
|
-
if (step.flow) node.data.flow = step.flow;
|
|
102
|
-
if (step.message) node.data.message = step.message;
|
|
103
|
-
if (step.actor) node.data.actor = step.actor;
|
|
104
|
-
if (step.externalSystem) node.data.externalSystem = step.externalSystem;
|
|
105
|
-
if (step.custom) node.data.custom = step.custom;
|
|
100
|
+
if (step.service) node.data.service = { ...step.service, ...step.service.data };
|
|
101
|
+
if (step.flow) node.data.flow = { ...step.flow, ...step.flow.data };
|
|
102
|
+
if (step.message) node.data.message = { ...step.message, ...step.message.data };
|
|
103
|
+
if (step.actor) node.data.actor = { ...step.actor, ...step.actor.data };
|
|
104
|
+
if (step.externalSystem) node.data.externalSystem = { ...step.externalSystem, ...step.externalSystem.data };
|
|
105
|
+
if (step.custom) node.data.custom = { ...step.custom, ...step.custom.data };
|
|
106
106
|
nodes.push(node);
|
|
107
107
|
});
|
|
108
108
|
|
|
@@ -66,7 +66,7 @@ const getNodesAndEdges = async ({
|
|
|
66
66
|
type: producer?.collection,
|
|
67
67
|
sourcePosition: 'right',
|
|
68
68
|
targetPosition: 'left',
|
|
69
|
-
data: { mode, service: producer },
|
|
69
|
+
data: { mode, service: { ...producer.data } },
|
|
70
70
|
position: { x: 250, y: 0 },
|
|
71
71
|
});
|
|
72
72
|
|
|
@@ -110,7 +110,12 @@ const getNodesAndEdges = async ({
|
|
|
110
110
|
id: generateIdForNode(message),
|
|
111
111
|
sourcePosition: 'right',
|
|
112
112
|
targetPosition: 'left',
|
|
113
|
-
data: {
|
|
113
|
+
data: {
|
|
114
|
+
mode,
|
|
115
|
+
message: {
|
|
116
|
+
...message.data,
|
|
117
|
+
},
|
|
118
|
+
},
|
|
114
119
|
position: { x: 0, y: 0 },
|
|
115
120
|
type: message.collection,
|
|
116
121
|
});
|
|
@@ -121,7 +126,7 @@ const getNodesAndEdges = async ({
|
|
|
121
126
|
id: generateIdForNode(consumer),
|
|
122
127
|
sourcePosition: 'right',
|
|
123
128
|
targetPosition: 'left',
|
|
124
|
-
data: { title: consumer?.data.id, mode, service: consumer },
|
|
129
|
+
data: { title: consumer?.data.id, mode, service: { ...consumer.data } },
|
|
125
130
|
position: { x: 0, y: 0 },
|
|
126
131
|
type: consumer?.collection,
|
|
127
132
|
});
|
|
@@ -106,7 +106,7 @@ export const getNodesAndEdges = async ({
|
|
|
106
106
|
type: receive?.collection,
|
|
107
107
|
sourcePosition: 'right',
|
|
108
108
|
targetPosition: 'left',
|
|
109
|
-
data: { mode, message: receive },
|
|
109
|
+
data: { mode, message: { ...receive.data } },
|
|
110
110
|
});
|
|
111
111
|
|
|
112
112
|
// does the message have channels defined?
|
|
@@ -132,7 +132,7 @@ export const getNodesAndEdges = async ({
|
|
|
132
132
|
source: generateIdForNode(receive),
|
|
133
133
|
target: generateIdForNode(service),
|
|
134
134
|
label: getReceivesMessageByMessageType(receive?.collection),
|
|
135
|
-
data: { message: receive },
|
|
135
|
+
data: { message: { ...receive.data } },
|
|
136
136
|
})
|
|
137
137
|
);
|
|
138
138
|
}
|
|
@@ -143,7 +143,8 @@ export const getNodesAndEdges = async ({
|
|
|
143
143
|
id: generateIdForNode(service),
|
|
144
144
|
sourcePosition: 'right',
|
|
145
145
|
targetPosition: 'left',
|
|
146
|
-
data: { mode, service: service },
|
|
146
|
+
// data: { mode, service: { ...service, ...service.data } },
|
|
147
|
+
data: { mode, service: { ...service.data } },
|
|
147
148
|
type: service.collection,
|
|
148
149
|
});
|
|
149
150
|
|
|
@@ -153,7 +154,7 @@ export const getNodesAndEdges = async ({
|
|
|
153
154
|
id: generateIdForNode(send),
|
|
154
155
|
sourcePosition: 'right',
|
|
155
156
|
targetPosition: 'left',
|
|
156
|
-
data: { mode, message: send },
|
|
157
|
+
data: { mode, message: { ...send.data } },
|
|
157
158
|
type: send?.collection,
|
|
158
159
|
});
|
|
159
160
|
|
|
@@ -179,7 +180,7 @@ export const getNodesAndEdges = async ({
|
|
|
179
180
|
source: generateIdForNode(service),
|
|
180
181
|
target: generateIdForNode(send),
|
|
181
182
|
label: getSendsMessageByMessageType(send?.collection),
|
|
182
|
-
data: { message: send },
|
|
183
|
+
data: { message: { ...send.data } },
|
|
183
184
|
})
|
|
184
185
|
);
|
|
185
186
|
}
|
|
@@ -194,7 +195,7 @@ export const getNodesAndEdges = async ({
|
|
|
194
195
|
target: generateIdForNode(message),
|
|
195
196
|
label: `${getSendsMessageByMessageType(message?.collection)} & ${getReceivesMessageByMessageType(message?.collection)}`,
|
|
196
197
|
animated: false,
|
|
197
|
-
data: { message },
|
|
198
|
+
data: { message: { ...message.data } },
|
|
198
199
|
markerEnd: {
|
|
199
200
|
type: MarkerType.ArrowClosed,
|
|
200
201
|
width: 40,
|
|
@@ -131,7 +131,7 @@ export const getChannelNodesAndEdges = ({
|
|
|
131
131
|
nodes.push(
|
|
132
132
|
createNode({
|
|
133
133
|
id: channelId,
|
|
134
|
-
data: { title: channel?.data.id, mode, channel, source, target },
|
|
134
|
+
data: { title: channel?.data.id, mode, channel: { ...channel, ...channel.data }, source, target },
|
|
135
135
|
position: { x: 0, y: 0 },
|
|
136
136
|
type: channel?.collection,
|
|
137
137
|
})
|
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.
|
|
9
|
+
"version": "2.55.0",
|
|
10
10
|
"publishConfig": {
|
|
11
11
|
"access": "public"
|
|
12
12
|
},
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
"@eventcatalog/generator-ai": "^1.1.0",
|
|
38
38
|
"@eventcatalog/linter": "^0.0.2",
|
|
39
39
|
"@eventcatalog/sdk": "^2.2.7",
|
|
40
|
+
"@eventcatalog/visualizer": "^0.0.4",
|
|
40
41
|
"@fontsource/inter": "^5.2.5",
|
|
41
42
|
"@headlessui/react": "^2.0.3",
|
|
42
43
|
"@heroicons/react": "^2.1.3",
|