@eventcatalog/core 3.48.1 → 3.48.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.
@@ -36,7 +36,7 @@ module.exports = __toCommonJS(analytics_exports);
36
36
  var import_os = __toESM(require("os"), 1);
37
37
 
38
38
  // package.json
39
- var version = "3.48.1";
39
+ var version = "3.48.3";
40
40
 
41
41
  // src/constants.ts
42
42
  var VERSION = version;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  raiseEvent
3
- } from "../chunk-VH5LYGTZ.js";
4
- import "../chunk-OUXBZ7LA.js";
3
+ } from "../chunk-EE5Q6MJZ.js";
4
+ import "../chunk-X7GMZVB3.js";
5
5
  export {
6
6
  raiseEvent
7
7
  };
@@ -140,7 +140,7 @@ var verifyRequiredFieldsAreInCatalogConfigFile = async (projectDirectory) => {
140
140
  var import_os = __toESM(require("os"), 1);
141
141
 
142
142
  // package.json
143
- var version = "3.48.1";
143
+ var version = "3.48.3";
144
144
 
145
145
  // src/constants.ts
146
146
  var VERSION = version;
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  log_build_default
3
- } from "../chunk-UHKKOUQ6.js";
3
+ } from "../chunk-4BRGEUVO.js";
4
+ import "../chunk-EE5Q6MJZ.js";
4
5
  import "../chunk-DAOXTQVS.js";
5
- import "../chunk-VH5LYGTZ.js";
6
- import "../chunk-OUXBZ7LA.js";
6
+ import "../chunk-X7GMZVB3.js";
7
7
  import "../chunk-6QENHZZP.js";
8
8
  export {
9
9
  log_build_default as default
@@ -1,10 +1,10 @@
1
+ import {
2
+ raiseEvent
3
+ } from "./chunk-EE5Q6MJZ.js";
1
4
  import {
2
5
  countResources,
3
6
  serializeCounts
4
7
  } from "./chunk-DAOXTQVS.js";
5
- import {
6
- raiseEvent
7
- } from "./chunk-VH5LYGTZ.js";
8
8
  import {
9
9
  getEventCatalogConfigFile,
10
10
  verifyRequiredFieldsAreInCatalogConfigFile
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VERSION
3
- } from "./chunk-OUXBZ7LA.js";
3
+ } from "./chunk-X7GMZVB3.js";
4
4
 
5
5
  // src/analytics/analytics.js
6
6
  import os from "os";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VERSION
3
- } from "./chunk-OUXBZ7LA.js";
3
+ } from "./chunk-X7GMZVB3.js";
4
4
 
5
5
  // src/utils/cli-logger.ts
6
6
  import pc from "picocolors";
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "3.48.1";
2
+ var version = "3.48.3";
3
3
 
4
4
  // src/constants.ts
5
5
  var VERSION = version;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  logger
3
- } from "./chunk-D6IADQY4.js";
3
+ } from "./chunk-PWBFBCJ4.js";
4
4
  import {
5
5
  cleanup,
6
6
  getEventCatalogConfigFile
@@ -25,7 +25,7 @@ __export(constants_exports, {
25
25
  module.exports = __toCommonJS(constants_exports);
26
26
 
27
27
  // package.json
28
- var version = "3.48.1";
28
+ var version = "3.48.3";
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-OUXBZ7LA.js";
3
+ } from "./chunk-X7GMZVB3.js";
4
4
  export {
5
5
  VERSION
6
6
  };
@@ -144,7 +144,7 @@ var verifyRequiredFieldsAreInCatalogConfigFile = async (projectDirectory) => {
144
144
  var import_picocolors = __toESM(require("picocolors"), 1);
145
145
 
146
146
  // package.json
147
- var version = "3.48.1";
147
+ var version = "3.48.3";
148
148
 
149
149
  // src/constants.ts
150
150
  var VERSION = version;
@@ -1,7 +1,7 @@
1
1
  import {
2
- log_build_default
3
- } from "./chunk-UHKKOUQ6.js";
4
- import "./chunk-DAOXTQVS.js";
2
+ runMigrations
3
+ } from "./chunk-XUAF2H54.js";
4
+ import "./chunk-CA4U2JP7.js";
5
5
  import {
6
6
  resolve_catalog_dependencies_default
7
7
  } from "./chunk-LHR4G2UO.js";
@@ -12,10 +12,10 @@ import {
12
12
  watch
13
13
  } from "./chunk-O3Y2G6CY.js";
14
14
  import {
15
- runMigrations
16
- } from "./chunk-XUAF2H54.js";
17
- import "./chunk-CA4U2JP7.js";
18
- import "./chunk-VH5LYGTZ.js";
15
+ log_build_default
16
+ } from "./chunk-4BRGEUVO.js";
17
+ import "./chunk-EE5Q6MJZ.js";
18
+ import "./chunk-DAOXTQVS.js";
19
19
  import {
20
20
  catalogToAstro
21
21
  } from "./chunk-WQNKHIDM.js";
@@ -28,13 +28,13 @@ import {
28
28
  } from "./chunk-B7HCX5HM.js";
29
29
  import {
30
30
  generate
31
- } from "./chunk-ZIID2J67.js";
31
+ } from "./chunk-XEUW7PEQ.js";
32
32
  import {
33
33
  logger
34
- } from "./chunk-D6IADQY4.js";
34
+ } from "./chunk-PWBFBCJ4.js";
35
35
  import {
36
36
  VERSION
37
- } from "./chunk-OUXBZ7LA.js";
37
+ } from "./chunk-X7GMZVB3.js";
38
38
  import {
39
39
  getEventCatalogConfigFile,
40
40
  verifyRequiredFieldsAreInCatalogConfigFile
package/dist/generate.cjs CHANGED
@@ -108,7 +108,7 @@ var getEventCatalogConfigFile = async (projectDirectory) => {
108
108
  var import_picocolors = __toESM(require("picocolors"), 1);
109
109
 
110
110
  // package.json
111
- var version = "3.48.1";
111
+ var version = "3.48.3";
112
112
 
113
113
  // src/constants.ts
114
114
  var VERSION = version;
package/dist/generate.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  generate
3
- } from "./chunk-ZIID2J67.js";
4
- import "./chunk-D6IADQY4.js";
5
- import "./chunk-OUXBZ7LA.js";
3
+ } from "./chunk-XEUW7PEQ.js";
4
+ import "./chunk-PWBFBCJ4.js";
5
+ import "./chunk-X7GMZVB3.js";
6
6
  import "./chunk-6QENHZZP.js";
7
7
  export {
8
8
  generate
@@ -36,7 +36,7 @@ module.exports = __toCommonJS(cli_logger_exports);
36
36
  var import_picocolors = __toESM(require("picocolors"), 1);
37
37
 
38
38
  // package.json
39
- var version = "3.48.1";
39
+ var version = "3.48.3";
40
40
 
41
41
  // src/constants.ts
42
42
  var VERSION = version;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  logger
3
- } from "../chunk-D6IADQY4.js";
4
- import "../chunk-OUXBZ7LA.js";
3
+ } from "../chunk-PWBFBCJ4.js";
4
+ import "../chunk-X7GMZVB3.js";
5
5
  export {
6
6
  logger
7
7
  };
@@ -102,6 +102,12 @@ export const buildOwnersSection = (owners: any[]): NavNode | null => {
102
102
  };
103
103
  };
104
104
 
105
+ const byAdrName = (a: Adr, b: Adr) => {
106
+ const name = (a.data.name || a.data.id).localeCompare(b.data.name || b.data.id);
107
+ if (name !== 0) return name;
108
+ return a.data.id.localeCompare(b.data.id);
109
+ };
110
+
105
111
  export const buildArchitectureDecisionsSection = (resource: AdrResource, adrs: Adr[]): NavNode | null => {
106
112
  const relatedAdrs = getAdrsForResource(resource, adrs);
107
113
  if (relatedAdrs.length === 0) return null;
@@ -110,7 +116,7 @@ export const buildArchitectureDecisionsSection = (resource: AdrResource, adrs: A
110
116
  type: 'group',
111
117
  title: 'Decision Records',
112
118
  icon: 'BookText',
113
- pages: relatedAdrs.map(getAdrNodeKey),
119
+ pages: [...relatedAdrs].sort(byAdrName).map(getAdrNodeKey),
114
120
  };
115
121
  };
116
122
 
@@ -58,12 +58,6 @@ const byResourceName = <T extends { data: { name?: string; id: string } }>(a: T,
58
58
 
59
59
  const sortByResourceName = <T extends { data: { name?: string; id: string } }>(items: T[]) => [...items].sort(byResourceName);
60
60
 
61
- const byAdrDateDesc = (a: Adr, b: Adr) => {
62
- const date = new Date(b.data.date).getTime() - new Date(a.data.date).getTime();
63
- if (date !== 0) return date;
64
- return byResourceName(a, b);
65
- };
66
-
67
61
  const groupAdrsByStatus = (adrs: Adr[]): NavNode[] =>
68
62
  ADR_STATUS_VALUES.reduce<NavNode[]>((groups, status) => {
69
63
  const adrsForStatus = adrs.filter((adr) => adr.data.status === status);
@@ -73,7 +67,7 @@ const groupAdrsByStatus = (adrs: Adr[]): NavNode[] =>
73
67
  type: 'group',
74
68
  title: `${formatAdrStatus(status)} (${adrsForStatus.length})`,
75
69
  subtle: true,
76
- pages: [...adrsForStatus].sort(byAdrDateDesc).map(getAdrNodeKey),
70
+ pages: [...adrsForStatus].sort(byResourceName).map(getAdrNodeKey),
77
71
  });
78
72
 
79
73
  return groups;
@@ -26,6 +26,7 @@ interface Props {
26
26
  version: string;
27
27
  defaultFlow?: DagreGraph;
28
28
  mode?: 'simple' | 'full';
29
+ layout?: boolean;
29
30
  }
30
31
 
31
32
  const getNodePropertyFromCollectionType = (type: string) => {
@@ -34,7 +35,7 @@ const getNodePropertyFromCollectionType = (type: string) => {
34
35
  return collectionToResourceMap[type as keyof typeof collectionToResourceMap];
35
36
  };
36
37
 
37
- export const getNodesAndEdges = async ({ id, defaultFlow, version, mode = 'simple' }: Props) => {
38
+ export const getNodesAndEdges = async ({ id, defaultFlow, version, mode = 'simple', layout = true }: Props) => {
38
39
  const flow = defaultFlow || createDagreGraph({ ranksep: 300, nodesep: 50 });
39
40
  let nodes = [] as any,
40
41
  edges = [] as any;
@@ -217,17 +218,19 @@ export const getNodesAndEdges = async ({ id, defaultFlow, version, mode = 'simpl
217
218
  flow.setEdge(edge.source, edge.target);
218
219
  });
219
220
 
220
- // Render the diagram in memory getting the X and Y
221
- dagre.layout(flow);
221
+ if (layout) {
222
+ // Render the diagram in memory getting the X and Y
223
+ dagre.layout(flow);
224
+ }
222
225
 
223
226
  // Find any duplicated edges, and merge them into one edge
224
- const uniqueEdges = edges.reduce((acc: any[], edge: any) => {
225
- const existingEdge = acc.find((e: any) => e.id === edge.id);
226
- if (!existingEdge) {
227
- acc.push(edge);
227
+ const uniqueEdgesById = new Map<string, any>();
228
+ edges.forEach((edge: any) => {
229
+ if (!uniqueEdgesById.has(edge.id)) {
230
+ uniqueEdgesById.set(edge.id, edge);
228
231
  }
229
- return acc;
230
- }, []);
232
+ });
233
+ const uniqueEdges = Array.from(uniqueEdgesById.values());
231
234
 
232
235
  return {
233
236
  nodes: calculatedNodes(flow, nodes),
@@ -1,4 +1,5 @@
1
1
  import { getCollection } from 'astro:content';
2
+ import dagre from 'dagre';
2
3
  import {
3
4
  createDagreGraph,
4
5
  calculatedNodes,
@@ -194,6 +195,7 @@ interface NodesAndEdgesProps {
194
195
  mode: 'simple' | 'full';
195
196
  group?: boolean;
196
197
  channelRenderMode?: 'single' | 'flat';
198
+ layout?: boolean;
197
199
  }
198
200
 
199
201
  export const getNodesAndEdges = async ({
@@ -203,6 +205,7 @@ export const getNodesAndEdges = async ({
203
205
  mode = 'simple',
204
206
  group = false,
205
207
  channelRenderMode = 'flat',
208
+ layout = true,
206
209
  }: NodesAndEdgesProps) => {
207
210
  const flow = defaultFlow || createDagreGraph({ ranksep: 360, nodesep: 50, edgesep: 50 });
208
211
  let nodes = new Map(),
@@ -268,6 +271,7 @@ export const getNodesAndEdges = async ({
268
271
  mode,
269
272
  renderAllEdges: true,
270
273
  channelRenderMode,
274
+ layout: false,
271
275
  });
272
276
  serviceNodes.forEach((n) => {
273
277
  /**
@@ -292,6 +296,7 @@ export const getNodesAndEdges = async ({
292
296
  mode,
293
297
  renderAllEdges: true,
294
298
  channelRenderMode,
299
+ layout: false,
295
300
  });
296
301
  agentNodes.forEach((n) => {
297
302
  nodes.set(n.id, nodes.has(n.id) ? merge(nodes.get(n.id), n) : n);
@@ -306,6 +311,7 @@ export const getNodesAndEdges = async ({
306
311
  version: dataProduct.version,
307
312
  defaultFlow: flow,
308
313
  mode,
314
+ layout: false,
309
315
  });
310
316
  dataProductNodes.forEach((n: any) => {
311
317
  nodes.set(n.id, nodes.has(n.id) ? merge(nodes.get(n.id), n) : n);
@@ -322,6 +328,7 @@ export const getNodesAndEdges = async ({
322
328
  mode,
323
329
  group: true,
324
330
  channelRenderMode,
331
+ layout: false,
325
332
  });
326
333
  subDomainNodes.forEach((n) => {
327
334
  nodes.set(n.id, nodes.has(n.id) ? merge(nodes.get(n.id), n) : n);
@@ -338,6 +345,10 @@ export const getNodesAndEdges = async ({
338
345
  });
339
346
  }
340
347
 
348
+ if (layout) {
349
+ dagre.layout(flow);
350
+ }
351
+
341
352
  return {
342
353
  nodes: calculatedNodes(flow, Array.from(nodes.values())),
343
354
  edges: [...edges.values()],
@@ -119,6 +119,7 @@ interface Props {
119
119
  channelRenderMode?: 'single' | 'flat';
120
120
  renderMessages?: boolean;
121
121
  collection?: 'agents' | 'services';
122
+ layout?: boolean;
122
123
  }
123
124
 
124
125
  const getResourceContextMenu = (resource: CollectionEntry<'agents'> | CollectionEntry<'services'>) => {
@@ -178,6 +179,7 @@ export const getNodesAndEdges = async ({
178
179
  channelRenderMode = 'flat',
179
180
  renderMessages = true,
180
181
  collection = 'services',
182
+ layout = true,
181
183
  }: Props) => {
182
184
  const flow = defaultFlow || createDagreGraph({ ranksep: 300, nodesep: 50 });
183
185
  let nodes = [] as any,
@@ -598,9 +600,13 @@ export const getNodesAndEdges = async ({
598
600
  });
599
601
  });
600
602
 
601
- const uniqueNodes = nodes.filter(
602
- (node: any, index: number, self: any[]) => index === self.findIndex((n: any) => n.id === node.id)
603
- );
603
+ const uniqueNodesById = new Map<string, any>();
604
+ nodes.forEach((node: any) => {
605
+ if (!uniqueNodesById.has(node.id)) {
606
+ uniqueNodesById.set(node.id, node);
607
+ }
608
+ });
609
+ const uniqueNodes = Array.from(uniqueNodesById.values());
604
610
 
605
611
  uniqueNodes.forEach((node: any) => {
606
612
  flow.setNode(node.id, { width: DEFAULT_NODE_WIDTH, height: DEFAULT_NODE_HEIGHT });
@@ -610,12 +616,15 @@ export const getNodesAndEdges = async ({
610
616
  flow.setEdge(edge.source, edge.target);
611
617
  });
612
618
 
613
- // Render the diagram in memory getting the X and Y
614
- dagre.layout(flow);
619
+ if (layout) {
620
+ // Render the diagram in memory getting the X and Y
621
+ dagre.layout(flow);
622
+ }
615
623
 
616
624
  // Find any duplicated edges, and merge them into one edge
617
- const uniqueEdges = edges.reduce((acc: any[], edge: any) => {
618
- const existingEdge = acc.find((e: any) => e.id === edge.id);
625
+ const uniqueEdgesById = new Map<string, any>();
626
+ edges.forEach((edge: any) => {
627
+ const existingEdge = uniqueEdgesById.get(edge.id);
619
628
  if (existingEdge) {
620
629
  if (edge.data?.customColor || existingEdge.data?.customColor) {
621
630
  // Add custom colors to the existing edge when grouped message paths converge.
@@ -629,10 +638,10 @@ export const getNodesAndEdges = async ({
629
638
  };
630
639
  }
631
640
  } else {
632
- acc.push(edge);
641
+ uniqueEdgesById.set(edge.id, edge);
633
642
  }
634
- return acc;
635
- }, []);
643
+ });
644
+ const uniqueEdges = Array.from(uniqueEdgesById.values());
636
645
 
637
646
  return {
638
647
  nodes: calculatedNodes(flow, uniqueNodes),
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  },
8
8
  "license": "SEE LICENSE IN LICENSE",
9
9
  "type": "module",
10
- "version": "3.48.1",
10
+ "version": "3.48.3",
11
11
  "publishConfig": {
12
12
  "access": "public"
13
13
  },
@@ -112,8 +112,8 @@
112
112
  "uuid": "^10.0.0",
113
113
  "zod": "^4.3.6",
114
114
  "@eventcatalog/linter": "1.1.0",
115
- "@eventcatalog/sdk": "2.24.1",
116
- "@eventcatalog/visualiser": "^3.22.1"
115
+ "@eventcatalog/visualiser": "^3.22.1",
116
+ "@eventcatalog/sdk": "2.24.1"
117
117
  },
118
118
  "devDependencies": {
119
119
  "@astrojs/check": "^0.9.9",