@eventcatalog/core 2.34.1 → 2.34.2

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.34.1";
40
+ var version = "2.34.2";
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-GUCQ43OT.js";
4
- import "../chunk-XOPHTY4E.js";
3
+ } from "../chunk-FGG5ZU6C.js";
4
+ import "../chunk-G6O5VE2Y.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.34.1";
109
+ var version = "2.34.2";
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-VU6QMU5H.js";
4
- import "../chunk-GUCQ43OT.js";
5
- import "../chunk-XOPHTY4E.js";
3
+ } from "../chunk-QMNCFJE7.js";
4
+ import "../chunk-FGG5ZU6C.js";
5
+ import "../chunk-G6O5VE2Y.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-XOPHTY4E.js";
3
+ } from "./chunk-G6O5VE2Y.js";
4
4
 
5
5
  // src/analytics/analytics.js
6
6
  import axios from "axios";
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "2.34.1";
2
+ var version = "2.34.2";
3
3
 
4
4
  // src/constants.ts
5
5
  var VERSION = version;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  raiseEvent
3
- } from "./chunk-GUCQ43OT.js";
3
+ } from "./chunk-FGG5ZU6C.js";
4
4
  import {
5
5
  getEventCatalogConfigFile,
6
6
  verifyRequiredFieldsAreInCatalogConfigFile
@@ -25,7 +25,7 @@ __export(constants_exports, {
25
25
  module.exports = __toCommonJS(constants_exports);
26
26
 
27
27
  // package.json
28
- var version = "2.34.1";
28
+ var version = "2.34.2";
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-XOPHTY4E.js";
3
+ } from "./chunk-G6O5VE2Y.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.34.1";
160
+ var version = "2.34.2";
161
161
 
162
162
  // src/constants.ts
163
163
  var VERSION = version;
@@ -6,15 +6,15 @@ import {
6
6
  } from "./chunk-UKJ7F5WR.js";
7
7
  import {
8
8
  log_build_default
9
- } from "./chunk-VU6QMU5H.js";
10
- import "./chunk-GUCQ43OT.js";
9
+ } from "./chunk-QMNCFJE7.js";
10
+ import "./chunk-FGG5ZU6C.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-XOPHTY4E.js";
17
+ } from "./chunk-G6O5VE2Y.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
- // Either message or service or actor must be present, but not all
213
- return (
214
- (data.message && !data.service && !data.actor) ||
215
- (!data.message && data.service) ||
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.1",
9
+ "version": "2.34.2",
10
10
  "publishConfig": {
11
11
  "access": "public"
12
12
  },