@eventcatalog/core 2.34.1 → 2.34.3
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-XOPHTY4E.js → chunk-TYOHN77U.js} +1 -1
- package/dist/{chunk-GUCQ43OT.js → chunk-VEBXSOLF.js} +1 -1
- package/dist/{chunk-VU6QMU5H.js → chunk-VLBP3PQ5.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.tsx +3 -0
- package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Flow.tsx +107 -0
- package/eventcatalog/src/content.config.ts +5 -7
- package/eventcatalog/src/utils/node-graphs/flows-node-graph.ts +12 -0
- package/package.json +5 -5
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
log_build_default
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
5
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-VLBP3PQ5.js";
|
|
4
|
+
import "../chunk-VEBXSOLF.js";
|
|
5
|
+
import "../chunk-TYOHN77U.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-UKJ7F5WR.js";
|
|
7
7
|
import {
|
|
8
8
|
log_build_default
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-VLBP3PQ5.js";
|
|
10
|
+
import "./chunk-VEBXSOLF.js";
|
|
11
11
|
import {
|
|
12
12
|
catalogToAstro,
|
|
13
13
|
checkAndConvertMdToMdx
|
|
14
14
|
} from "./chunk-7SI5EVOX.js";
|
|
15
15
|
import {
|
|
16
16
|
VERSION
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-TYOHN77U.js";
|
|
18
18
|
import {
|
|
19
19
|
isBackstagePluginEnabled,
|
|
20
20
|
isEventCatalogScaleEnabled,
|
|
@@ -17,6 +17,7 @@ import '@xyflow/react/dist/style.css';
|
|
|
17
17
|
|
|
18
18
|
// Nodes and edges
|
|
19
19
|
import ServiceNode from './Nodes/Service';
|
|
20
|
+
import FlowNode from './Nodes/Flow';
|
|
20
21
|
import EventNode from './Nodes/Event';
|
|
21
22
|
import QueryNode from './Nodes/Query';
|
|
22
23
|
import UserNode from './Nodes/User';
|
|
@@ -63,6 +64,7 @@ const NodeGraphBuilder = ({
|
|
|
63
64
|
const nodeTypes = useMemo(
|
|
64
65
|
() => ({
|
|
65
66
|
services: ServiceNode,
|
|
67
|
+
flows: FlowNode,
|
|
66
68
|
events: EventNode,
|
|
67
69
|
channels: ChannelNode,
|
|
68
70
|
queries: QueryNode,
|
|
@@ -240,6 +242,7 @@ const NodeGraphBuilder = ({
|
|
|
240
242
|
const colorClasses = {
|
|
241
243
|
events: 'bg-orange-600',
|
|
242
244
|
services: 'bg-pink-600',
|
|
245
|
+
flows: 'bg-teal-600',
|
|
243
246
|
commands: 'bg-blue-600',
|
|
244
247
|
queries: 'bg-green-600',
|
|
245
248
|
channels: 'bg-gray-600',
|
|
@@ -0,0 +1,107 @@
|
|
|
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
|
+
}
|
|
@@ -170,6 +170,7 @@ const flows = defineCollection({
|
|
|
170
170
|
summary: z.string().optional(),
|
|
171
171
|
message: pointer.optional(),
|
|
172
172
|
service: pointer.optional(),
|
|
173
|
+
flow: pointer.optional(),
|
|
173
174
|
actor: z
|
|
174
175
|
.object({
|
|
175
176
|
name: z.string(),
|
|
@@ -206,15 +207,12 @@ const flows = defineCollection({
|
|
|
206
207
|
next_steps: z.array(flowStep).optional(),
|
|
207
208
|
})
|
|
208
209
|
.refine((data) => {
|
|
209
|
-
if (!data.message && !data.service && !data.actor) return true;
|
|
210
210
|
// Cant have both next_steps and next_steps
|
|
211
211
|
if (data.next_step && data.next_steps) return false;
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
(data.actor && !data.message && !data.service)
|
|
217
|
-
);
|
|
212
|
+
|
|
213
|
+
// Either one or non types can be present
|
|
214
|
+
const typesUsed = [data.message, data.service, data.flow, data.actor, data.custom].filter((v) => v).length;
|
|
215
|
+
return typesUsed === 0 || typesUsed === 1;
|
|
218
216
|
})
|
|
219
217
|
),
|
|
220
218
|
})
|
|
@@ -25,6 +25,16 @@ const getServiceNode = (step: any, services: CollectionEntry<'services'>[]) => {
|
|
|
25
25
|
};
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
+
const getFlowNode = (step: any, flows: CollectionEntry<'flows'>[]) => {
|
|
29
|
+
const flowsForVersion = getItemsFromCollectionByIdAndSemverOrLatest(flows, step.flow.id, step.flow.version);
|
|
30
|
+
const flow = flowsForVersion?.[0];
|
|
31
|
+
return {
|
|
32
|
+
...step,
|
|
33
|
+
type: flow ? flow.collection : 'step',
|
|
34
|
+
flow,
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
|
|
28
38
|
const getMessageNode = (step: any, messages: CollectionEntry<'events' | 'commands' | 'queries'>[]) => {
|
|
29
39
|
const messagesForVersion = getItemsFromCollectionByIdAndSemverOrLatest(messages, step.message.id, step.message.version);
|
|
30
40
|
const message = messagesForVersion[0];
|
|
@@ -63,6 +73,7 @@ export const getNodesAndEdges = async ({ id, defaultFlow, version, mode = 'simpl
|
|
|
63
73
|
// Hydrate the steps with information they may need.
|
|
64
74
|
const hydratedSteps = steps.map((step: any) => {
|
|
65
75
|
if (step.service) return getServiceNode(step, services);
|
|
76
|
+
if (step.flow) return getFlowNode(step, flows);
|
|
66
77
|
if (step.message) return getMessageNode(step, messages);
|
|
67
78
|
if (step.actor) return { ...step, type: 'actor', actor: step.actor };
|
|
68
79
|
if (step.custom) return { ...step, type: 'custom', custom: step.custom };
|
|
@@ -87,6 +98,7 @@ export const getNodesAndEdges = async ({ id, defaultFlow, version, mode = 'simpl
|
|
|
87
98
|
} as NodeType;
|
|
88
99
|
|
|
89
100
|
if (step.service) node.data.service = step.service;
|
|
101
|
+
if (step.flow) node.data.flow = step.flow;
|
|
90
102
|
if (step.message) node.data.message = step.message;
|
|
91
103
|
if (step.actor) node.data.actor = step.actor;
|
|
92
104
|
if (step.externalSystem) node.data.externalSystem = step.externalSystem;
|
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.34.
|
|
9
|
+
"version": "2.34.3",
|
|
10
10
|
"publishConfig": {
|
|
11
11
|
"access": "public"
|
|
12
12
|
},
|
|
@@ -22,15 +22,15 @@
|
|
|
22
22
|
],
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@astrojs/markdown-remark": "^6.3.1",
|
|
25
|
-
"@astrojs/mdx": "^4.2.
|
|
26
|
-
"@astrojs/react": "^4.2.
|
|
25
|
+
"@astrojs/mdx": "^4.2.4",
|
|
26
|
+
"@astrojs/react": "^4.2.4",
|
|
27
27
|
"@astrojs/rss": "^4.0.11",
|
|
28
28
|
"@astrojs/tailwind": "^6.0.2",
|
|
29
29
|
"@asyncapi/avro-schema-parser": "^3.0.24",
|
|
30
30
|
"@asyncapi/parser": "^3.4.0",
|
|
31
31
|
"@asyncapi/react-component": "^2.4.3",
|
|
32
32
|
"@eventcatalog/generator-ai": "^1.0.0",
|
|
33
|
-
"@eventcatalog/sdk": "^2.2.
|
|
33
|
+
"@eventcatalog/sdk": "^2.2.7",
|
|
34
34
|
"@fontsource/inter": "^5.2.5",
|
|
35
35
|
"@headlessui/react": "^2.0.3",
|
|
36
36
|
"@heroicons/react": "^2.1.3",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"@tailwindcss/typography": "^0.5.13",
|
|
47
47
|
"@tanstack/react-table": "^8.17.3",
|
|
48
48
|
"@xyflow/react": "^12.3.6",
|
|
49
|
-
"astro": "^5.
|
|
49
|
+
"astro": "^5.7.0",
|
|
50
50
|
"astro-expressive-code": "^0.40.1",
|
|
51
51
|
"astro-pagefind": "^1.6.0",
|
|
52
52
|
"astro-seo": "^0.8.4",
|