@eventcatalog/core 3.12.8 → 3.13.0-beta.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.
Files changed (83) hide show
  1. package/dist/analytics/analytics.cjs +1 -1
  2. package/dist/analytics/analytics.js +2 -2
  3. package/dist/analytics/log-build.cjs +1 -1
  4. package/dist/analytics/log-build.js +3 -3
  5. package/dist/{chunk-DINAMVEI.js → chunk-7RCUF3VG.js} +1 -1
  6. package/dist/{chunk-GOLMKUV3.js → chunk-AY2OEUWV.js} +1 -1
  7. package/dist/{chunk-6MBAYHHT.js → chunk-NXATPLVB.js} +1 -1
  8. package/dist/{chunk-JUWMXGCI.js → chunk-V3GX7FC3.js} +1 -1
  9. package/dist/{chunk-ROHEB5DM.js → chunk-VXTATPGX.js} +1 -1
  10. package/dist/constants.cjs +1 -1
  11. package/dist/constants.js +1 -1
  12. package/dist/eventcatalog.cjs +1 -1
  13. package/dist/eventcatalog.js +5 -5
  14. package/dist/generate.cjs +1 -1
  15. package/dist/generate.js +3 -3
  16. package/dist/utils/cli-logger.cjs +1 -1
  17. package/dist/utils/cli-logger.js +2 -2
  18. package/eventcatalog/src/components/MDX/Design/Design.astro +2 -2
  19. package/eventcatalog/src/components/MDX/EntityMap/EntityMap.astro +2 -2
  20. package/eventcatalog/src/components/MDX/File.tsx +7 -7
  21. package/eventcatalog/src/components/MDX/Flow/Flow.astro +2 -2
  22. package/eventcatalog/src/components/MDX/NodeGraph/AstroNodeGraph.tsx +104 -0
  23. package/eventcatalog/src/components/MDX/NodeGraph/NodeGraph.astro +2 -2
  24. package/eventcatalog/src/components/MDX/NodeGraph/README.md +85 -0
  25. package/eventcatalog/src/components/MDX/Schema.astro +3 -6
  26. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/index.astro +1 -6
  27. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/spec/[filename].astro +2 -2
  28. package/eventcatalog/src/pages/visualiser/designs/[id]/index.astro +2 -2
  29. package/eventcatalog/src/utils/collections/channels.ts +1 -26
  30. package/eventcatalog/src/utils/collections/commands.ts +1 -26
  31. package/eventcatalog/src/utils/collections/containers.ts +1 -32
  32. package/eventcatalog/src/utils/collections/data-products.ts +1 -19
  33. package/eventcatalog/src/utils/collections/diagrams.ts +0 -7
  34. package/eventcatalog/src/utils/collections/domains.ts +0 -18
  35. package/eventcatalog/src/utils/collections/entities.ts +1 -27
  36. package/eventcatalog/src/utils/collections/events.ts +1 -22
  37. package/eventcatalog/src/utils/collections/flows.ts +0 -8
  38. package/eventcatalog/src/utils/collections/queries.ts +1 -22
  39. package/eventcatalog/src/utils/collections/schemas.ts +9 -4
  40. package/eventcatalog/src/utils/collections/services.ts +0 -20
  41. package/eventcatalog/src/utils/collections/teams.ts +0 -6
  42. package/eventcatalog/src/utils/collections/users.ts +0 -6
  43. package/eventcatalog/src/utils/collections/util.ts +10 -1
  44. package/eventcatalog/src/utils/node-graphs/container-node-graph.ts +66 -17
  45. package/eventcatalog/src/utils/node-graphs/data-products-node-graph.ts +14 -5
  46. package/eventcatalog/src/utils/node-graphs/domains-node-graph.ts +1 -1
  47. package/eventcatalog/src/utils/node-graphs/message-node-graph.ts +133 -18
  48. package/eventcatalog/src/utils/node-graphs/services-node-graph.ts +36 -14
  49. package/eventcatalog/src/utils/node-graphs/utils/utils.ts +115 -4
  50. package/package.json +4 -4
  51. package/eventcatalog/src/components/MDX/NodeGraph/DownloadButton.tsx +0 -62
  52. package/eventcatalog/src/components/MDX/NodeGraph/Edges/AnimatedMessageEdge.tsx +0 -110
  53. package/eventcatalog/src/components/MDX/NodeGraph/Edges/FlowEdge.tsx +0 -96
  54. package/eventcatalog/src/components/MDX/NodeGraph/Edges/MultilineEdgeLabel.tsx +0 -52
  55. package/eventcatalog/src/components/MDX/NodeGraph/FocusMode/FocusModeContent.tsx +0 -294
  56. package/eventcatalog/src/components/MDX/NodeGraph/FocusMode/FocusModeNodeActions.tsx +0 -92
  57. package/eventcatalog/src/components/MDX/NodeGraph/FocusMode/FocusModePlaceholder.tsx +0 -26
  58. package/eventcatalog/src/components/MDX/NodeGraph/FocusMode/utils.ts +0 -163
  59. package/eventcatalog/src/components/MDX/NodeGraph/FocusModeModal.tsx +0 -99
  60. package/eventcatalog/src/components/MDX/NodeGraph/MermaidView.tsx +0 -242
  61. package/eventcatalog/src/components/MDX/NodeGraph/NodeGraph.tsx +0 -1181
  62. package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Actor.tsx +0 -46
  63. package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Channel.tsx +0 -55
  64. package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Command.tsx +0 -27
  65. package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Custom.tsx +0 -159
  66. package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Data.tsx +0 -63
  67. package/eventcatalog/src/components/MDX/NodeGraph/Nodes/DataProduct.tsx +0 -132
  68. package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Domain.tsx +0 -155
  69. package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Entity.tsx +0 -154
  70. package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Event.tsx +0 -29
  71. package/eventcatalog/src/components/MDX/NodeGraph/Nodes/ExternalSystem.tsx +0 -79
  72. package/eventcatalog/src/components/MDX/NodeGraph/Nodes/ExternalSystem2.tsx +0 -24
  73. package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Flow.tsx +0 -107
  74. package/eventcatalog/src/components/MDX/NodeGraph/Nodes/MessageContextMenu.tsx +0 -63
  75. package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Query.tsx +0 -28
  76. package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Service.tsx +0 -127
  77. package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Step.tsx +0 -64
  78. package/eventcatalog/src/components/MDX/NodeGraph/Nodes/User.tsx +0 -76
  79. package/eventcatalog/src/components/MDX/NodeGraph/Nodes/View.tsx +0 -24
  80. package/eventcatalog/src/components/MDX/NodeGraph/StepWalkthrough.tsx +0 -296
  81. package/eventcatalog/src/components/MDX/NodeGraph/StudioModal.tsx +0 -129
  82. package/eventcatalog/src/components/MDX/NodeGraph/VisualiserSearch.tsx +0 -258
  83. package/eventcatalog/src/components/MDX/NodeGraph/VisualizerDropdownContent.tsx +0 -313
@@ -1,154 +0,0 @@
1
- import { CubeIcon } from '@heroicons/react/16/solid';
2
- import type { CollectionEntry } from 'astro:content';
3
- import { Handle, Position } from '@xyflow/react';
4
- import { getIcon } from '@utils/badges';
5
- import * as ContextMenu from '@radix-ui/react-context-menu';
6
- import { buildUrl } from '@utils/url-builder';
7
- import { useState } from 'react';
8
-
9
- interface Data {
10
- title: string;
11
- label: string;
12
- bgColor: string;
13
- color: string;
14
- mode: 'simple' | 'full';
15
- entity: CollectionEntry<'entities'>;
16
- showTarget?: boolean;
17
- showSource?: boolean;
18
- externalToDomain?: boolean;
19
- domainName?: string;
20
- domainId?: string;
21
- group?: {
22
- type: string;
23
- value: string;
24
- };
25
- }
26
-
27
- function classNames(...classes: any) {
28
- return classes.filter(Boolean).join(' ');
29
- }
30
-
31
- export default function EntityNode({ data, sourcePosition, targetPosition }: any) {
32
- const { mode, entity, externalToDomain, domainName } = data as Data;
33
- const { name, version, properties = [], aggregateRoot, styles, sidebar } = entity.data;
34
-
35
- const { node: { color = 'blue', label } = {}, icon = 'CubeIcon' } = styles || {};
36
-
37
- const Icon = getIcon(icon);
38
-
39
- const [hoveredProperty, setHoveredProperty] = useState<string | null>(null);
40
-
41
- return (
42
- <ContextMenu.Root>
43
- <ContextMenu.Trigger>
44
- <div
45
- className={classNames(
46
- 'bg-white border border-blue-300 rounded-lg shadow-sm min-w-[200px]',
47
- externalToDomain ? 'border-yellow-400' : ''
48
- )}
49
- >
50
- {/* Table Header */}
51
- <div
52
- className={classNames(
53
- 'bg-blue-100 px-4 py-2 rounded-t-lg border-b border-gray-300',
54
- externalToDomain ? 'bg-yellow-400' : ''
55
- )}
56
- >
57
- <div className="flex items-center gap-2">
58
- {Icon && <Icon className="w-4 h-4 text-gray-600" />}
59
- <span className="font-semibold text-gray-800 text-sm">{name}</span>
60
- {aggregateRoot && <span className="text-xs bg-yellow-100 text-yellow-800 px-1.5 py-0.5 rounded">AR</span>}
61
- </div>
62
- {/* {externalToDomain && domainName && ( */}
63
- <div className="text-xs text-yellow-800 font-medium mt-1">from {domainName} domain</div>
64
- {/* )} */}
65
- {mode === 'full' && <div className="text-xs text-gray-600 mt-1">v{version}</div>}
66
- </div>
67
-
68
- {/* Properties Table */}
69
- {properties.length > 0 ? (
70
- <div className="divide-y divide-gray-200 relative">
71
- {properties.map((property: any, index: number) => {
72
- const propertyKey = `${property.name}-${index}`;
73
- const isHovered = hoveredProperty === propertyKey;
74
- return (
75
- <div
76
- key={propertyKey}
77
- className="relative flex items-center justify-between px-4 py-2 hover:bg-gray-50"
78
- onMouseEnter={() => property.description && setHoveredProperty(propertyKey)}
79
- onMouseLeave={() => setHoveredProperty(null)}
80
- >
81
- {/* Target handle */}
82
- <Handle
83
- type="target"
84
- position={Position.Left}
85
- id={`${property.name}-target`}
86
- className="!w-3 !h-3 !bg-white !border-2 !border-gray-400 !rounded-full !left-[-0px]"
87
- style={{ left: '-6px' }}
88
- />
89
-
90
- {/* Source handle */}
91
- <Handle
92
- type="source"
93
- position={Position.Right}
94
- id={`${property.name}-source`}
95
- className="!w-3 !h-3 !bg-white !border-2 !border-gray-400 !rounded-full !right-[-0px]"
96
- style={{ right: '-6px' }}
97
- />
98
-
99
- {/* Property content */}
100
- <div className="flex-1 flex items-center justify-between">
101
- <div className="flex items-center gap-1">
102
- <span className="text-sm font-medium text-gray-900">{property.name}</span>
103
- {property.required && <span className="text-red-500 text-xs">*</span>}
104
- </div>
105
- <span className="text-sm text-gray-600 font-mono">{property.type}</span>
106
- </div>
107
-
108
- {/* Reference indicator */}
109
- {property.references && (
110
- <div className="absolute right-2 top-1/2 transform -translate-y-1/2">
111
- <div className="w-2 h-2 bg-blue-500 rounded-full" title={`References ${property.references}`}></div>
112
- </div>
113
- )}
114
-
115
- {/* Property Tooltip */}
116
- {isHovered && property.description && (
117
- <div className="absolute left-full ml-2 top-1/2 transform -translate-y-1/2 z-[9999] w-[200px] bg-gray-900 text-white text-xs rounded-lg py-2 px-3 pointer-events-none shadow-xl max-w-xl opacity-100">
118
- <div className="text-gray-200 whitespace-normal break-words">{property.description}</div>
119
- <div className="absolute right-full top-1/2 transform -translate-y-1/2 border-4 border-transparent border-r-gray-900"></div>
120
- </div>
121
- )}
122
- </div>
123
- );
124
- })}
125
- </div>
126
- ) : (
127
- <div className="px-4 py-3 text-sm text-gray-500 text-center">No properties defined</div>
128
- )}
129
-
130
- {/* Main node handles (if no properties) */}
131
- {properties.length === 0 && (
132
- <>
133
- {targetPosition && <Handle type="target" position={targetPosition} />}
134
- {sourcePosition && <Handle type="source" position={sourcePosition} />}
135
- </>
136
- )}
137
- </div>
138
- </ContextMenu.Trigger>
139
- <ContextMenu.Portal>
140
- <ContextMenu.Content
141
- className="min-w-[220px] bg-white rounded-md p-1 shadow-md border border-gray-200"
142
- onClick={(e) => e.stopPropagation()}
143
- >
144
- <ContextMenu.Item
145
- asChild
146
- className="text-sm px-2 py-1.5 outline-none cursor-pointer hover:bg-orange-100 rounded-sm flex items-center"
147
- >
148
- <a href={buildUrl(`/docs/entities/${entity.data.id}/${version}`)}>Read documentation</a>
149
- </ContextMenu.Item>
150
- </ContextMenu.Content>
151
- </ContextMenu.Portal>
152
- </ContextMenu.Root>
153
- );
154
- }
@@ -1,29 +0,0 @@
1
- import { Handle } from '@xyflow/react';
2
- import MessageContextMenu from './MessageContextMenu';
3
- import { Position } from '@xyflow/react';
4
-
5
- // Import from properly installed package
6
- import { nodeComponents, type EventNode } from '@eventcatalog/visualizer';
7
- const EventComponent = nodeComponents.event;
8
-
9
- export default function EventNode(props: EventNode) {
10
- return (
11
- <MessageContextMenu message={props.data.message as any} messageType="events">
12
- <div className="relative">
13
- <Handle
14
- type="target"
15
- position={Position.Left}
16
- style={{ width: 10, height: 10, background: 'orange', zIndex: 10 }}
17
- className="bg-orange-500"
18
- />
19
- <Handle
20
- type="source"
21
- position={Position.Right}
22
- style={{ width: 10, height: 10, background: 'orange', zIndex: 10 }}
23
- className="bg-orange-500"
24
- />
25
- <EventComponent {...props} />
26
- </div>
27
- </MessageContextMenu>
28
- );
29
- }
@@ -1,79 +0,0 @@
1
- import { ServerIcon } from '@heroicons/react/16/solid';
2
- import { GlobeAmericasIcon } from '@heroicons/react/20/solid';
3
- import type { CollectionEntry } from 'astro:content';
4
- import { Handle } from '@xyflow/react';
5
-
6
- interface Data {
7
- label: string;
8
- bgColor: string;
9
- color: string;
10
- mode: 'simple' | 'full';
11
- step: { id: string; title: string; summary: string; externalSystem: { name: string; summary?: string; url?: string } };
12
- showTarget?: boolean;
13
- showSource?: boolean;
14
- }
15
-
16
- function classNames(...classes: any) {
17
- return classes.filter(Boolean).join(' ');
18
- }
19
-
20
- export default function ExternalSystemNode({ data, sourcePosition, targetPosition }: any) {
21
- const { mode, step } = data as Data;
22
- const { externalSystem } = step;
23
- const { name, summary, url } = externalSystem;
24
-
25
- return (
26
- <div
27
- className={classNames(
28
- `w-full rounded-md border flex justify-start bg-white text-black border-pink-500`,
29
- mode === 'full' ? 'min-h-[7em]' : 'min-h-[2em]'
30
- )}
31
- >
32
- <div
33
- className={classNames(
34
- 'bg-gradient-to-b from-pink-500 to-pink-700 relative flex items-center w-5 justify-center rounded-l-sm text-red-100-500',
35
- `border-r-[1px] border-pink-500`
36
- )}
37
- >
38
- <GlobeAmericasIcon className="w-4 h-4 opacity-90 text-white absolute top-1 " />
39
- {mode === 'full' && (
40
- <span className="rotate -rotate-90 w-1/2 text-center absolute bottom-1 text-[9px] text-white font-bold uppercase tracking-[3px] ">
41
- External
42
- </span>
43
- )}
44
- </div>
45
- <div className="p-1 min-w-60 max-w-[min-content]">
46
- {targetPosition && <Handle type="target" position={targetPosition} />}
47
- {sourcePosition && <Handle type="source" position={sourcePosition} />}
48
- <div className={classNames(mode === 'full' ? `border-b border-gray-200` : '')}>
49
- <div className="h-full ">
50
- <span className="text-sm font-bold pb-0.5 block w-full">{name}</span>
51
- {mode === 'simple' && (
52
- <div className="w-full text-right">
53
- <span className=" w-full text-[10px] text-gray-500 font-light block pt-0.5 pb-0.5 ">External System</span>
54
- </div>
55
- )}
56
- </div>
57
- </div>
58
- {mode === 'full' && (
59
- <div className="divide-y divide-gray-200 ">
60
- <div className="leading-3 py-1">
61
- <span className="text-[8px] font-light">{summary}</span>
62
- </div>
63
-
64
- {url && (
65
- <div className="grid grid-cols-2 gap-x-4 py-1">
66
- <span className="text-xs" style={{ fontSize: '0.2em' }}>
67
- URL:{' '}
68
- <a href={url} target="_blank" className="text-primary underline">
69
- {url}
70
- </a>
71
- </span>
72
- </div>
73
- )}
74
- </div>
75
- )}
76
- </div>
77
- </div>
78
- );
79
- }
@@ -1,24 +0,0 @@
1
- import { Handle, Position } from '@xyflow/react';
2
-
3
- import { nodeComponents, type ExternalSystemNode } from '@eventcatalog/visualizer';
4
- const ExternalSystemComponent = nodeComponents.externalSystem;
5
-
6
- export default function ExternalSystemNode(props: ExternalSystemNode) {
7
- return (
8
- <div className="relative">
9
- <Handle
10
- type="target"
11
- position={Position.Left}
12
- style={{ width: 10, height: 10, background: 'pink', zIndex: 10 }}
13
- className="bg-gray-500"
14
- />
15
- <Handle
16
- type="source"
17
- position={Position.Right}
18
- style={{ width: 10, height: 10, background: 'pink', zIndex: 10 }}
19
- className="bg-gray-500"
20
- />
21
- <ExternalSystemComponent {...props} />
22
- </div>
23
- );
24
- }
@@ -1,107 +0,0 @@
1
- import type { CollectionEntry } from 'astro:content';
2
- import { Handle } from '@xyflow/react';
3
- import * as ContextMenu from '@radix-ui/react-context-menu';
4
- import { buildUrl } from '@utils/url-builder';
5
- import { getIcon } from '@utils/badges';
6
-
7
- interface Data {
8
- label: string;
9
- bgColor: string;
10
- color: string;
11
- mode: 'simple' | 'full';
12
- flow: CollectionEntry<'flows'>;
13
- showTarget?: boolean;
14
- showSource?: boolean;
15
- }
16
-
17
- function classNames(...classes: any) {
18
- return classes.filter(Boolean).join(' ');
19
- }
20
-
21
- export default function FlowNode({ data, sourcePosition, targetPosition }: any) {
22
- const { mode, flow } = data as Data;
23
-
24
- const { id, version, owners = [], name, styles } = flow.data;
25
- const { node: { color = 'teal', label } = {}, icon = 'QueueListIcon' } = styles || {};
26
-
27
- const Icon = getIcon(icon);
28
- const nodeLabel = label || flow?.data?.sidebar?.badge || 'Flow';
29
- const fontSize = nodeLabel.length > 10 ? '7px' : '9px';
30
-
31
- return (
32
- <ContextMenu.Root>
33
- <ContextMenu.Trigger>
34
- <div className={classNames(`w-full rounded-md border flex justify-start bg-white text-black border-${color}-400`)}>
35
- <div
36
- className={classNames(
37
- `bg-gradient-to-b from-${color}-500 to-${color}-700 relative flex items-center w-5 justify-center rounded-l-sm text-${color}-100`,
38
- `border-r-[1px] border-${color}-500`
39
- )}
40
- >
41
- {Icon && <Icon className="w-4 h-4 opacity-90 text-white absolute top-1 " />}
42
- {mode === 'full' && (
43
- <span
44
- className={`rotate -rotate-90 w-1/2 text-center absolute bottom-1 text-[${fontSize}] text-white font-bold uppercase tracking-[3px] `}
45
- >
46
- {nodeLabel}
47
- </span>
48
- )}
49
- </div>
50
- <div className="p-1 min-w-60 max-w-[min-content]">
51
- {targetPosition && <Handle type="target" position={targetPosition} />}
52
- {sourcePosition && <Handle type="source" position={sourcePosition} />}
53
- <div className={classNames(mode === 'full' ? `border-b border-gray-200` : '')}>
54
- <span className="text-xs font-bold block pt-0.5 pb-0.5">{name}</span>
55
- <div className="flex justify-between">
56
- <span className="text-[10px] font-light block pt-0.5 pb-0.5 ">v{version}</span>
57
- {mode === 'simple' && (
58
- <span className="text-[10px] text-gray-500 font-light block pt-0.5 pb-0.5 ">{nodeLabel}</span>
59
- )}
60
- </div>
61
- </div>
62
- {mode === 'full' && (
63
- <div className="divide-y divide-gray-200 ">
64
- <div className="leading-3 py-1">
65
- <span className="text-[8px] font-light">{flow.data.summary}</span>
66
- </div>
67
-
68
- <div className="grid grid-cols-2 gap-x-4 py-1">
69
- <span className="text-xs" style={{ fontSize: '0.2em' }}>
70
- Owners: {owners.length}
71
- </span>
72
- </div>
73
- </div>
74
- )}
75
- </div>
76
- </div>
77
- </ContextMenu.Trigger>
78
- <ContextMenu.Portal>
79
- <ContextMenu.Content className="min-w-[220px] bg-white rounded-md p-1 shadow-md border border-gray-200">
80
- <ContextMenu.Item
81
- asChild
82
- className="text-sm px-2 py-1.5 outline-none cursor-pointer hover:bg-orange-100 rounded-sm flex items-center"
83
- >
84
- <a href={buildUrl(`/docs/flows/${id}/${version}`)}>Read documentation</a>
85
- </ContextMenu.Item>
86
- <ContextMenu.Item
87
- asChild
88
- className="text-sm px-2 py-1.5 outline-none cursor-pointer hover:bg-orange-100 rounded-sm flex items-center"
89
- >
90
- <a href={buildUrl(`/visualiser/flows/${id}/${version}`)}>View in visualiser</a>
91
- </ContextMenu.Item>
92
- <ContextMenu.Separator className="h-[1px] bg-gray-200 m-1" />
93
- <ContextMenu.Item asChild>
94
- <a
95
- href={buildUrl(`/docs/flows/${id}/${version}/changelog`)}
96
- className="text-sm px-2 py-1.5 outline-none cursor-pointer hover:bg-orange-100 rounded-sm flex items-center"
97
- target="_blank"
98
- rel="noopener noreferrer"
99
- >
100
- Read changelog
101
- </a>
102
- </ContextMenu.Item>
103
- </ContextMenu.Content>
104
- </ContextMenu.Portal>
105
- </ContextMenu.Root>
106
- );
107
- }
@@ -1,63 +0,0 @@
1
- import * as ContextMenu from '@radix-ui/react-context-menu';
2
- import { buildUrl } from '@utils/url-builder';
3
- import type { CollectionMessageTypes } from '@types';
4
- interface Data {
5
- message: {
6
- id: string;
7
- version: string;
8
- name: string;
9
- schemaPath: string;
10
- };
11
- messageType: CollectionMessageTypes;
12
- children: React.ReactNode;
13
- }
14
-
15
- export default function MessageContextMenu(data: Data) {
16
- const { message, messageType, children } = data;
17
- const { id, version, name, schemaPath } = message;
18
-
19
- if (!id) return null;
20
-
21
- return (
22
- <ContextMenu.Root>
23
- <ContextMenu.Trigger>{children}</ContextMenu.Trigger>
24
- <ContextMenu.Portal>
25
- <ContextMenu.Content
26
- className="min-w-[220px] bg-white rounded-md p-1 shadow-md border border-gray-200"
27
- onClick={(e) => e.stopPropagation()}
28
- >
29
- <ContextMenu.Item
30
- asChild
31
- className="text-sm px-2 py-1.5 outline-none cursor-pointer hover:bg-orange-100 rounded-sm flex items-center"
32
- >
33
- <a href={buildUrl(`/docs/${messageType}/${id}/${version}`)}>Read documentation</a>
34
- </ContextMenu.Item>
35
- <ContextMenu.Separator className="h-[1px] bg-gray-200 m-1" />
36
- {schemaPath && (
37
- <ContextMenu.Item asChild>
38
- <a
39
- href={buildUrl(`/generated/${messageType}/${id}/${schemaPath}`)}
40
- download={`${name}(${version})-${schemaPath}`}
41
- className="text-sm px-2 py-1.5 outline-none cursor-pointer hover:bg-orange-100 rounded-sm flex items-center"
42
- target="_blank"
43
- rel="noopener noreferrer"
44
- >
45
- Download schema
46
- </a>
47
- </ContextMenu.Item>
48
- )}
49
- <ContextMenu.Item asChild>
50
- <a
51
- href={buildUrl(`/docs/${messageType}/${id}/${version}/changelog`)}
52
- className="text-sm px-2 py-1.5 outline-none cursor-pointer hover:bg-orange-100 rounded-sm flex items-center"
53
- target="_blank"
54
- rel="noopener noreferrer"
55
- >
56
- Read changelog
57
- </a>
58
- </ContextMenu.Item>
59
- </ContextMenu.Content>
60
- </ContextMenu.Portal>
61
- </ContextMenu.Root>
62
- );
63
- }
@@ -1,28 +0,0 @@
1
- import { Handle } from '@xyflow/react';
2
- import MessageContextMenu from './MessageContextMenu';
3
- import { Position } from '@xyflow/react';
4
-
5
- import { nodeComponents, type QueryNode } from '@eventcatalog/visualizer';
6
- const QueryComponent = nodeComponents.query;
7
-
8
- export default function QueryNode(props: QueryNode) {
9
- return (
10
- <MessageContextMenu message={props.data.message as any} messageType="queries">
11
- <div className="relative">
12
- <Handle
13
- type="target"
14
- position={Position.Left}
15
- style={{ width: 10, height: 10, background: 'green', zIndex: 10 }}
16
- className="bg-green-500"
17
- />
18
- <Handle
19
- type="source"
20
- position={Position.Right}
21
- style={{ width: 10, height: 10, background: 'green', zIndex: 10 }}
22
- className="bg-green-500"
23
- />
24
- <QueryComponent {...props} />
25
- </div>
26
- </MessageContextMenu>
27
- );
28
- }
@@ -1,127 +0,0 @@
1
- import { Handle } from '@xyflow/react';
2
- import * as ContextMenu from '@radix-ui/react-context-menu';
3
- import { buildUrl } from '@utils/url-builder';
4
- import { Position } from '@xyflow/react';
5
-
6
- import { nodeComponents, type ServiceNode } from '@eventcatalog/visualizer';
7
- const ServiceComponent = nodeComponents.service;
8
-
9
- export default function ServiceNode(props: ServiceNode) {
10
- const { id, version, specifications, repository } = props.data.service as any;
11
-
12
- let asyncApiFiles = Array.isArray(specifications) ? specifications?.filter((spec) => spec.type === 'asyncapi') : ([] as any);
13
- let openApiFiles = Array.isArray(specifications) ? specifications?.filter((spec) => spec.type === 'openapi') : ([] as any);
14
-
15
- if (!Array.isArray(specifications) && specifications?.asyncapiPath) {
16
- asyncApiFiles.push({ path: specifications.asyncapiPath, type: 'asyncapi', name: 'AsyncAPI' });
17
- }
18
-
19
- if (!Array.isArray(specifications) && specifications?.openapiPath) {
20
- openApiFiles.push({ path: specifications.openapiPath, type: 'openapi', name: 'OpenAPI' });
21
- }
22
-
23
- // Add filename on asyncApiFiles and openApiFiles
24
- asyncApiFiles = asyncApiFiles.map((file: any) => {
25
- return {
26
- ...file,
27
- filename: file.path.split('/').pop()?.split('.').shift(),
28
- };
29
- });
30
- openApiFiles = openApiFiles.map((file: any) => {
31
- return {
32
- ...file,
33
- filename: file.path.split('/').pop()?.split('.').shift(),
34
- name: file.name,
35
- };
36
- });
37
-
38
- const repositoryUrl = repository?.url;
39
-
40
- return (
41
- <ContextMenu.Root>
42
- <ContextMenu.Trigger>
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} />
57
- </div>
58
- </ContextMenu.Trigger>
59
- <ContextMenu.Portal>
60
- <ContextMenu.Content
61
- className="min-w-[220px] bg-white rounded-md p-1 shadow-md border border-gray-200"
62
- onClick={(e) => e.stopPropagation()}
63
- >
64
- <ContextMenu.Item
65
- asChild
66
- className="text-sm px-2 py-1.5 outline-none cursor-pointer hover:bg-orange-100 rounded-sm flex items-center"
67
- >
68
- <a href={buildUrl(`/docs/services/${id}/${version}`)}>Read documentation</a>
69
- </ContextMenu.Item>
70
- <ContextMenu.Separator className="h-[1px] bg-gray-200 m-1" />
71
- {asyncApiFiles.length > 0 &&
72
- asyncApiFiles.map((file: any) => (
73
- <ContextMenu.Item asChild key={file.path}>
74
- <a
75
- href={buildUrl(`/docs/services/${id}/${version}/asyncapi/${file.filename}`)}
76
- className="text-sm px-2 py-1.5 outline-none cursor-pointer hover:bg-orange-100 rounded-sm flex items-center"
77
- target="_blank"
78
- rel="noopener noreferrer"
79
- >
80
- View AsyncAPI specification {file.name ? `(${file.name})` : ''}
81
- </a>
82
- </ContextMenu.Item>
83
- ))}
84
- {openApiFiles.length > 0 &&
85
- openApiFiles.map((file: any) => (
86
- <ContextMenu.Item asChild key={file.path}>
87
- <a
88
- href={buildUrl(`/docs/services/${id}/${version}/spec/${file.filename}`)}
89
- className="text-sm px-2 py-1.5 outline-none cursor-pointer hover:bg-orange-100 rounded-sm flex items-center"
90
- target="_blank"
91
- rel="noopener noreferrer"
92
- >
93
- View OpenAPI specification {file.name ? `(${file.name})` : ''}
94
- </a>
95
- </ContextMenu.Item>
96
- ))}
97
- {asyncApiFiles.length > 0 && openApiFiles.length > 0 && <ContextMenu.Separator className="h-[1px] bg-gray-200 m-1" />}
98
- {repositoryUrl && (
99
- <>
100
- <ContextMenu.Item asChild>
101
- <a
102
- href={repositoryUrl}
103
- className="text-sm px-2 py-1.5 outline-none cursor-pointer hover:bg-orange-100 rounded-sm flex items-center"
104
- target="_blank"
105
- rel="noopener noreferrer"
106
- >
107
- View code repository
108
- </a>
109
- </ContextMenu.Item>
110
- <ContextMenu.Separator className="h-[1px] bg-gray-200 m-1" />
111
- </>
112
- )}
113
- <ContextMenu.Item asChild>
114
- <a
115
- href={buildUrl(`/docs/services/${id}/${version}/changelog`)}
116
- className="text-sm px-2 py-1.5 outline-none cursor-pointer hover:bg-orange-100 rounded-sm flex items-center"
117
- target="_blank"
118
- rel="noopener noreferrer"
119
- >
120
- Read changelog
121
- </a>
122
- </ContextMenu.Item>
123
- </ContextMenu.Content>
124
- </ContextMenu.Portal>
125
- </ContextMenu.Root>
126
- );
127
- }