@eventcatalog/core 4.11.0 → 4.11.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.
Files changed (60) 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/astro-output.cjs +60 -1
  6. package/dist/astro-output.js +1 -1
  7. package/dist/{chunk-U52FCZQ6.js → chunk-2YJRF4ZX.js} +1 -1
  8. package/dist/chunk-634NFV5U.js +75 -0
  9. package/dist/{chunk-H3324DNT.js → chunk-AFPH6ERZ.js} +1 -1
  10. package/dist/chunk-DHH5U5PF.js +53 -0
  11. package/dist/{chunk-XJOKK5ZO.js → chunk-EGH3ALRY.js} +1 -1
  12. package/dist/chunk-FWXEV4LF.js +19 -0
  13. package/dist/{chunk-SW7SJZIX.js → chunk-LAWEGSJH.js} +1 -1
  14. package/dist/{chunk-DWC5GRFX.js → chunk-XMRPNDXB.js} +1 -1
  15. package/dist/{chunk-W4LDIMUI.js → chunk-Z6OKCHWL.js} +1 -1
  16. package/dist/constants.cjs +1 -1
  17. package/dist/constants.js +1 -1
  18. package/dist/copy-core.cjs +88 -0
  19. package/dist/copy-core.d.cts +4 -0
  20. package/dist/copy-core.d.ts +4 -0
  21. package/dist/copy-core.js +8 -0
  22. package/dist/eventcatalog.cjs +234 -115
  23. package/dist/eventcatalog.js +36 -30
  24. package/dist/federation/federate.js +3 -3
  25. package/dist/federation/source-provider.js +2 -2
  26. package/dist/generate.cjs +1 -1
  27. package/dist/generate.js +3 -3
  28. package/dist/update-check.cjs +44 -0
  29. package/dist/update-check.d.cts +18 -0
  30. package/dist/update-check.d.ts +18 -0
  31. package/dist/update-check.js +8 -0
  32. package/dist/utils/cli-logger.cjs +1 -1
  33. package/dist/utils/cli-logger.js +2 -2
  34. package/eventcatalog/astro.config.mjs +6 -0
  35. package/eventcatalog/src/plugins/empty-collection-warning.d.ts +21 -0
  36. package/eventcatalog/src/plugins/empty-collection-warning.mjs +107 -0
  37. package/eventcatalog/src/plugins/quiet-empty-collections-logger.mjs +11 -0
  38. package/eventcatalog/src/utils/collections/channels.ts +12 -4
  39. package/eventcatalog/src/utils/node-graphs/message-node-graph.ts +17 -15
  40. package/package.json +4 -3
  41. package/dist/chunk-RDYYZQYU.js +0 -18
  42. package/eventcatalog/src/components/EnvironmentDropdown.test.ts +0 -64
  43. package/eventcatalog/src/components/Grids/message-link.spec.ts +0 -59
  44. package/eventcatalog/src/components/MDX/CodeGroup/code-group.spec.tsx +0 -89
  45. package/eventcatalog/src/components/MDX/Columns/columns.spec.tsx +0 -66
  46. package/eventcatalog/src/components/MDX/CustomProperties/custom-properties.spec.ts +0 -38
  47. package/eventcatalog/src/components/MDX/SchemaViewer/schema-viewer-utils.spec.ts +0 -116
  48. package/eventcatalog/src/components/SchemaExplorer/JSONSchemaViewer.test.tsx +0 -114
  49. package/eventcatalog/src/components/SchemaExplorer/ProtobufSchemaViewer.test.tsx +0 -91
  50. package/eventcatalog/src/components/SchemaExplorer/SchemaViewerHover.test.tsx +0 -33
  51. package/eventcatalog/src/components/SchemaExplorer/protobuf-validation.test.ts +0 -84
  52. package/eventcatalog/src/components/Search/search-utils.spec.ts +0 -173
  53. package/eventcatalog/src/components/SideNav/NestedSideBar/utils.spec.ts +0 -105
  54. package/eventcatalog/src/components/navigation-progress.spec.ts +0 -68
  55. package/eventcatalog/src/enterprise/directory/user-team-directory.spec.ts +0 -527
  56. package/eventcatalog/src/enterprise/fields/field-extractor.test.ts +0 -302
  57. package/eventcatalog/src/enterprise/fields/fields-db.test.ts +0 -185
  58. package/eventcatalog/src/stores/eventcatalog-store.spec.ts +0 -60
  59. package/eventcatalog/src/utils/collections/glob-loader.spec.ts +0 -87
  60. package/dist/{chunk-6K7XZAYI.js → chunk-A2RZR3U4.js} +3 -3
@@ -1,28 +1,31 @@
1
- import {
2
- runMigrations
3
- } from "./chunk-XUAF2H54.js";
4
- import "./chunk-CA4U2JP7.js";
5
- import {
6
- log_build_default
7
- } from "./chunk-XJOKK5ZO.js";
8
- import "./chunk-H3324DNT.js";
9
- import "./chunk-ZAZHAVKB.js";
10
1
  import {
11
2
  FederationConflictError,
12
3
  FederationDiagnosticError,
13
4
  federateCatalog
14
- } from "./chunk-U52FCZQ6.js";
5
+ } from "./chunk-2YJRF4ZX.js";
15
6
  import "./chunk-WRNH5C3U.js";
16
7
  import "./chunk-5EPNFDT5.js";
17
- import "./chunk-6K7XZAYI.js";
8
+ import "./chunk-A2RZR3U4.js";
9
+ import "./chunk-SDZQJTJW.js";
18
10
  import "./chunk-352FGP6W.js";
11
+ import {
12
+ runMigrations
13
+ } from "./chunk-XUAF2H54.js";
14
+ import "./chunk-CA4U2JP7.js";
15
+ import {
16
+ watch
17
+ } from "./chunk-KLOHNCNF.js";
18
+ import {
19
+ log_build_default
20
+ } from "./chunk-EGH3ALRY.js";
21
+ import "./chunk-AFPH6ERZ.js";
22
+ import "./chunk-ZAZHAVKB.js";
19
23
  import "./chunk-R7Z5ALYI.js";
20
24
  import {
21
25
  getFederationDiagnosticCounts,
22
26
  getVisibleFederationDiagnostics
23
27
  } from "./chunk-JJPB6EOZ.js";
24
28
  import "./chunk-FV56YFM4.js";
25
- import "./chunk-SDZQJTJW.js";
26
29
  import {
27
30
  getProjectOutDir,
28
31
  isAuthEnabled,
@@ -31,10 +34,10 @@ import {
31
34
  } from "./chunk-B7HCX5HM.js";
32
35
  import {
33
36
  generate
34
- } from "./chunk-W4LDIMUI.js";
37
+ } from "./chunk-Z6OKCHWL.js";
35
38
  import {
36
39
  logger
37
- } from "./chunk-DWC5GRFX.js";
40
+ } from "./chunk-XMRPNDXB.js";
38
41
  import {
39
42
  resolve_catalog_dependencies_default
40
43
  } from "./chunk-LHR4G2UO.js";
@@ -42,19 +45,24 @@ import {
42
45
  buildSearchIndex
43
46
  } from "./chunk-6U72KINX.js";
44
47
  import {
45
- watch
46
- } from "./chunk-KLOHNCNF.js";
48
+ getEventCatalogUpdateMessage,
49
+ resolveInstalledCoreVersion
50
+ } from "./chunk-FWXEV4LF.js";
47
51
  import {
48
52
  createAstroDevLineFilter,
49
53
  createAstroLineFilter
50
- } from "./chunk-RDYYZQYU.js";
54
+ } from "./chunk-634NFV5U.js";
51
55
  import {
52
56
  catalogToAstro
53
57
  } from "./chunk-T4RVWPIQ.js";
54
58
  import "./chunk-W5JQON7Z.js";
55
59
  import {
56
60
  VERSION
57
- } from "./chunk-SW7SJZIX.js";
61
+ } from "./chunk-LAWEGSJH.js";
62
+ import {
63
+ pruneExcludedCoreEntries,
64
+ shouldCopyCoreEntry
65
+ } from "./chunk-DHH5U5PF.js";
58
66
  import {
59
67
  linkCoreNodeModules,
60
68
  resolveInstalledCoreNodeModules
@@ -820,12 +828,9 @@ var copyCore = () => {
820
828
  }
821
829
  fs3.cpSync(eventCatalogDir, core, {
822
830
  recursive: true,
823
- filter: (src) => {
824
- const relativePath = path2.relative(eventCatalogDir, src);
825
- const pathParts = relativePath.split(path2.sep);
826
- return !pathParts.some((part) => [".astro", "dist", "node_modules"].includes(part));
827
- }
831
+ filter: (src) => shouldCopyCoreEntry(eventCatalogDir, src)
828
832
  });
833
+ pruneExcludedCoreEntries(core);
829
834
  const coreNodeModules = path2.join(core, "node_modules");
830
835
  const installedCoreNodeModules = resolveInstalledCoreNodeModules(currentDir);
831
836
  linkCoreNodeModules({ coreNodeModules, installedCoreNodeModules });
@@ -834,13 +839,13 @@ var clearCore = () => {
834
839
  if (fs3.existsSync(core)) fs3.rmSync(core, { recursive: true });
835
840
  };
836
841
  var checkForUpdate = () => {
837
- const installedVersion = getInstalledEventCatalogVersion();
838
- if (!installedVersion) return;
839
- const majorVersion = parseInt(installedVersion.replace(/[^0-9.]/g, "").split(".")[0], 10);
842
+ const declaredVersion = getInstalledEventCatalogVersion();
843
+ if (!declaredVersion) return;
844
+ const majorVersion = parseInt(declaredVersion.replace(/[^0-9.]/g, "").split(".")[0], 10);
840
845
  if (majorVersion < 3) {
841
846
  const v3Message = `\u{1F680} EventCatalog V3 is now available in beta!
842
847
 
843
- You are currently on version ${installedVersion}.
848
+ You are currently on version ${declaredVersion}.
844
849
  V3 brings exciting new features and improvements.
845
850
 
846
851
  Upgrade now: npm i @eventcatalog/core@beta`;
@@ -855,11 +860,12 @@ Upgrade now: npm i @eventcatalog/core@beta`;
855
860
  );
856
861
  return;
857
862
  }
863
+ const installedVersion = resolveInstalledCoreVersion(VERSION, declaredVersion);
864
+ if (!installedVersion) return;
858
865
  const pkg = { name: "@eventcatalog/core", version: installedVersion };
859
866
  const notifier = updateNotifier({ pkg, updateCheckInterval: 0 });
860
- if (notifier.update) {
861
- const message = `EventCatalog update available ${notifier.update.current} \u2192 ${notifier.update.latest}
862
- Run npm i @eventcatalog/core to update`;
867
+ const message = getEventCatalogUpdateMessage(installedVersion, notifier.update?.latest);
868
+ if (message) {
863
869
  console.log(
864
870
  boxen(message, {
865
871
  padding: 1,
@@ -2,15 +2,15 @@ import {
2
2
  FederationConflictError,
3
3
  FederationDiagnosticError,
4
4
  federateCatalog
5
- } from "../chunk-U52FCZQ6.js";
5
+ } from "../chunk-2YJRF4ZX.js";
6
6
  import "../chunk-WRNH5C3U.js";
7
7
  import "../chunk-5EPNFDT5.js";
8
- import "../chunk-6K7XZAYI.js";
8
+ import "../chunk-A2RZR3U4.js";
9
+ import "../chunk-SDZQJTJW.js";
9
10
  import "../chunk-352FGP6W.js";
10
11
  import "../chunk-R7Z5ALYI.js";
11
12
  import "../chunk-JJPB6EOZ.js";
12
13
  import "../chunk-FV56YFM4.js";
13
- import "../chunk-SDZQJTJW.js";
14
14
  import "../chunk-6QENHZZP.js";
15
15
  export {
16
16
  FederationConflictError,
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  createFederationSourceProvider
3
- } from "../chunk-6K7XZAYI.js";
4
- import "../chunk-352FGP6W.js";
3
+ } from "../chunk-A2RZR3U4.js";
5
4
  import "../chunk-SDZQJTJW.js";
5
+ import "../chunk-352FGP6W.js";
6
6
  export {
7
7
  createFederationSourceProvider
8
8
  };
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 = "4.11.0";
111
+ var version = "4.11.2";
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-W4LDIMUI.js";
4
- import "./chunk-DWC5GRFX.js";
5
- import "./chunk-SW7SJZIX.js";
3
+ } from "./chunk-Z6OKCHWL.js";
4
+ import "./chunk-XMRPNDXB.js";
5
+ import "./chunk-LAWEGSJH.js";
6
6
  import "./chunk-6QENHZZP.js";
7
7
  export {
8
8
  generate
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/update-check.ts
21
+ var update_check_exports = {};
22
+ __export(update_check_exports, {
23
+ getEventCatalogUpdateMessage: () => getEventCatalogUpdateMessage,
24
+ resolveInstalledCoreVersion: () => resolveInstalledCoreVersion
25
+ });
26
+ module.exports = __toCommonJS(update_check_exports);
27
+ var import_semver = require("semver");
28
+ var resolveInstalledCoreVersion = (runningVersion, declaredDependency) => {
29
+ if ((0, import_semver.valid)(runningVersion)) return runningVersion;
30
+ if (declaredDependency && (0, import_semver.valid)(declaredDependency)) return declaredDependency;
31
+ return null;
32
+ };
33
+ var getEventCatalogUpdateMessage = (current, latest) => {
34
+ if (!latest || !(0, import_semver.valid)(current) || !(0, import_semver.valid)(latest) || !(0, import_semver.gt)(latest, current)) {
35
+ return null;
36
+ }
37
+ return `EventCatalog update available ${current} \u2192 ${latest}
38
+ Run npm i @eventcatalog/core to update`;
39
+ };
40
+ // Annotate the CommonJS export names for ESM import in node:
41
+ 0 && (module.exports = {
42
+ getEventCatalogUpdateMessage,
43
+ resolveInstalledCoreVersion
44
+ });
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Version to compare with the published release.
3
+ *
4
+ * Prefer the running CLI version. The catalog `package.json` dependency is often
5
+ * a range (`^4.10.0`) and is not the installed package. An exact pin is used
6
+ * only when the running version itself is not semver.
7
+ */
8
+ declare const resolveInstalledCoreVersion: (runningVersion: string, declaredDependency?: string | null) => string | null;
9
+ /**
10
+ * Message for the CLI update banner, or null when no update should be shown.
11
+ *
12
+ * `update-notifier` treats any semver difference as an update, including when the
13
+ * installed release is newer than the cached or tagged "latest". Only a strictly
14
+ * newer published version is an update.
15
+ */
16
+ declare const getEventCatalogUpdateMessage: (current: string, latest: string | undefined) => string | null;
17
+
18
+ export { getEventCatalogUpdateMessage, resolveInstalledCoreVersion };
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Version to compare with the published release.
3
+ *
4
+ * Prefer the running CLI version. The catalog `package.json` dependency is often
5
+ * a range (`^4.10.0`) and is not the installed package. An exact pin is used
6
+ * only when the running version itself is not semver.
7
+ */
8
+ declare const resolveInstalledCoreVersion: (runningVersion: string, declaredDependency?: string | null) => string | null;
9
+ /**
10
+ * Message for the CLI update banner, or null when no update should be shown.
11
+ *
12
+ * `update-notifier` treats any semver difference as an update, including when the
13
+ * installed release is newer than the cached or tagged "latest". Only a strictly
14
+ * newer published version is an update.
15
+ */
16
+ declare const getEventCatalogUpdateMessage: (current: string, latest: string | undefined) => string | null;
17
+
18
+ export { getEventCatalogUpdateMessage, resolveInstalledCoreVersion };
@@ -0,0 +1,8 @@
1
+ import {
2
+ getEventCatalogUpdateMessage,
3
+ resolveInstalledCoreVersion
4
+ } from "./chunk-FWXEV4LF.js";
5
+ export {
6
+ getEventCatalogUpdateMessage,
7
+ resolveInstalledCoreVersion
8
+ };
@@ -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 = "4.11.0";
39
+ var version = "4.11.2";
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-DWC5GRFX.js";
4
- import "../chunk-SW7SJZIX.js";
3
+ } from "../chunk-XMRPNDXB.js";
4
+ import "../chunk-LAWEGSJH.js";
5
5
  export {
6
6
  logger
7
7
  };
@@ -98,6 +98,12 @@ export default defineConfig({
98
98
 
99
99
  // just turn this off for all users (for now...)
100
100
  devToolbar: { enabled: false },
101
+
102
+ // Unused resource types are valid. Astro otherwise warns on every getCollection()
103
+ // call for those empty collections ("check your content config file for errors").
104
+ logger: {
105
+ entrypoint: new URL('./src/plugins/quiet-empty-collections-logger.mjs', import.meta.url),
106
+ },
101
107
  integrations: [
102
108
  react(),
103
109
  // Options are loaded automatically from ec.config.mjs.
@@ -0,0 +1,21 @@
1
+ export const KNOWN_EVENTCATALOG_COLLECTIONS: ReadonlySet<string>;
2
+
3
+ export function collectionNameFromEmptyWarning(message: string): string | null;
4
+
5
+ export function isIntentionalEmptyCollectionMessage(message: string): boolean;
6
+
7
+ export function isIntentionalEmptyCollectionLine(line: string): boolean;
8
+
9
+ export interface QuietLoggerEvent {
10
+ level?: string;
11
+ label?: string | null;
12
+ message?: string;
13
+ }
14
+
15
+ export interface QuietLoggerDestination {
16
+ write: (event: QuietLoggerEvent) => void;
17
+ flush?: () => void;
18
+ close?: () => void;
19
+ }
20
+
21
+ export function wrapLoggerDestination<T extends QuietLoggerDestination>(destination: T): QuietLoggerDestination;
@@ -0,0 +1,107 @@
1
+ /**
2
+ * Astro's getCollection() warns when a collection is missing from the content store:
3
+ * `The collection "<name>" does not exist or is empty. Please check your content config file for errors.`
4
+ *
5
+ * EventCatalog always defines every resource collection. A catalog that does not use a resource
6
+ * type leaves that collection empty, and Astro repeats the warning for every getCollection() call.
7
+ * That warning is noise. Schema failures, loader errors, and warnings for unknown collection
8
+ * names use different messages (or a collection name outside this set) and stay visible.
9
+ *
10
+ * Keep this set aligned with `export const collections` in content.config.ts.
11
+ */
12
+ export const KNOWN_EVENTCATALOG_COLLECTIONS = new Set([
13
+ 'events',
14
+ 'commands',
15
+ 'queries',
16
+ 'examples',
17
+ 'services',
18
+ 'agents',
19
+ 'adrs',
20
+ 'channels',
21
+ 'users',
22
+ 'teams',
23
+ 'domains',
24
+ 'systems',
25
+ 'flows',
26
+ 'pages',
27
+ 'changelogs',
28
+ 'containers',
29
+ 'data-products',
30
+ 'ubiquitousLanguages',
31
+ 'entities',
32
+ 'customPages',
33
+ 'resourceDocs',
34
+ 'resourceDocCategories',
35
+ 'designs',
36
+ 'diagrams',
37
+ 'schemas',
38
+ 'sidebars',
39
+ ]);
40
+
41
+ const EMPTY_COLLECTION_MESSAGE =
42
+ /^The collection ("(?:\\.|[^"\\])*") does not exist or is empty\. Please check your content config file for errors\.$/;
43
+
44
+ const ANSI_PATTERN = /\u001B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])/g;
45
+
46
+ /**
47
+ * Timestamp text, then Astro's content logger prefix: `[WARN] [content]`.
48
+ * A `[WARN]` line from any other label, such as `[build]`, is not this warning.
49
+ */
50
+ const ASTRO_CONTENT_WARN_PREFIX = /^[^[\]]*\[WARN\]\s+\[content\](?:\s+\[[^\]]+\])*\s*$/;
51
+
52
+ export function collectionNameFromEmptyWarning(message) {
53
+ const match = message.match(EMPTY_COLLECTION_MESSAGE);
54
+ if (!match) return null;
55
+
56
+ try {
57
+ const name = JSON.parse(match[1]);
58
+ return typeof name === 'string' ? name : null;
59
+ } catch {
60
+ return null;
61
+ }
62
+ }
63
+
64
+ export function isIntentionalEmptyCollectionMessage(message) {
65
+ const name = collectionNameFromEmptyWarning(message);
66
+ return name !== null && KNOWN_EVENTCATALOG_COLLECTIONS.has(name);
67
+ }
68
+
69
+ /**
70
+ * Matches the warning as Astro prints it: a bare message, or the node/console logger line
71
+ * `<time> [WARN] [content] <message>`, including ANSI color on the prefix.
72
+ * The same sentence from another logger label, extra diagnostic text, and `[ERROR]` lines stay visible.
73
+ */
74
+ export function isIntentionalEmptyCollectionLine(line) {
75
+ const plain = line.replace(ANSI_PATTERN, '').replace(/\r/g, '').trim();
76
+ const marker = 'The collection "';
77
+ const start = plain.indexOf(marker);
78
+ if (start === -1) return false;
79
+
80
+ const message = plain.slice(start).trim();
81
+ if (!isIntentionalEmptyCollectionMessage(message)) return false;
82
+
83
+ const before = plain.slice(0, start).trim();
84
+ return before.length === 0 || ASTRO_CONTENT_WARN_PREFIX.test(before);
85
+ }
86
+
87
+ export function wrapLoggerDestination(destination) {
88
+ return {
89
+ write(event) {
90
+ if (
91
+ event?.level === 'warn' &&
92
+ event?.label === 'content' &&
93
+ typeof event.message === 'string' &&
94
+ isIntentionalEmptyCollectionMessage(event.message)
95
+ ) {
96
+ return;
97
+ }
98
+ destination.write(event);
99
+ },
100
+ flush() {
101
+ return destination.flush?.();
102
+ },
103
+ close() {
104
+ return destination.close?.();
105
+ },
106
+ };
107
+ }
@@ -0,0 +1,11 @@
1
+ import nodeLogger from 'astro/logger/node';
2
+ import { wrapLoggerDestination } from './empty-collection-warning.mjs';
3
+
4
+ /**
5
+ * Astro logger destination used by EventCatalog builds and the dev server.
6
+ * Drops the empty-collection content warning for collections EventCatalog defines.
7
+ * Every other log event is written with Astro's default node logger.
8
+ */
9
+ export default function quietEmptyCollectionsLogger(options) {
10
+ return wrapLoggerDestination(nodeLogger(options));
11
+ }
@@ -118,11 +118,15 @@ export const getChannels = async ({ getAllVersions = true }: Props = {}): Promis
118
118
 
119
119
  // Could be recursive, we need to keep going until we find a loop or until we reach the target channel
120
120
  export const isChannelsConnected = (
121
- sourceChannel: CollectionEntry<'channels'>,
122
- targetChannel: CollectionEntry<'channels'>,
121
+ sourceChannel: CollectionEntry<'channels'> | undefined,
122
+ targetChannel: CollectionEntry<'channels'> | undefined,
123
123
  channels: CollectionEntry<'channels'>[],
124
124
  visited: Set<string> = new Set()
125
125
  ) => {
126
+ if (!sourceChannel?.data || !targetChannel?.data) {
127
+ return false;
128
+ }
129
+
126
130
  // Create a unique key for this channel (id + version to handle multiple versions)
127
131
  const channelKey = `${sourceChannel.data.id}:${sourceChannel.data.version}`;
128
132
 
@@ -159,10 +163,14 @@ export const isChannelsConnected = (
159
163
 
160
164
  // Go from the source to the target channel and return the channel chain
161
165
  export const getChannelChain = (
162
- sourceChannel: CollectionEntry<'channels'>,
163
- targetChannel: CollectionEntry<'channels'>,
166
+ sourceChannel: CollectionEntry<'channels'> | undefined,
167
+ targetChannel: CollectionEntry<'channels'> | undefined,
164
168
  channels: CollectionEntry<'channels'>[]
165
169
  ): CollectionEntry<'channels'>[] => {
170
+ if (!sourceChannel?.data || !targetChannel?.data) {
171
+ return [];
172
+ }
173
+
166
174
  // Base case: we've reached the target channel
167
175
  if (sourceChannel.data.id === targetChannel.data.id && sourceChannel.data.version === targetChannel.data.version) {
168
176
  return [sourceChannel];
@@ -515,19 +515,21 @@ const getNodesAndEdges = async ({
515
515
  (receive) => receive.id === message.data.id && versionMatches(receive.version, message.data.version)
516
516
  )?.from ?? [];
517
517
 
518
- for (const producerChannel of producerChannels) {
519
- const producerChannelValue = findInMap(
520
- channelMap,
521
- producerChannel.id,
522
- producerChannel.version
523
- ) as CollectionEntry<'channels'>;
524
-
525
- for (const consumerChannel of consumerChannels) {
526
- const consumerChannelValue = findInMap(
527
- channelMap,
528
- consumerChannel.id,
529
- consumerChannel.version
530
- ) as CollectionEntry<'channels'>;
518
+ const resolvedProducerChannels = producerChannels
519
+ .map(
520
+ (producerChannel) =>
521
+ findInMap(channelMap, producerChannel.id, producerChannel.version) as CollectionEntry<'channels'> | undefined
522
+ )
523
+ .filter((resolved): resolved is CollectionEntry<'channels'> => resolved !== undefined);
524
+ const resolvedConsumerChannels = consumerChannels
525
+ .map(
526
+ (consumerChannel) =>
527
+ findInMap(channelMap, consumerChannel.id, consumerChannel.version) as CollectionEntry<'channels'> | undefined
528
+ )
529
+ .filter((resolved): resolved is CollectionEntry<'channels'> => resolved !== undefined);
530
+
531
+ for (const producerChannelValue of resolvedProducerChannels) {
532
+ for (const consumerChannelValue of resolvedConsumerChannels) {
531
533
  const channelChainToRender = getChannelChain(producerChannelValue, consumerChannelValue, channels);
532
534
 
533
535
  // If there is a chain between them we need to render them al
@@ -573,8 +575,8 @@ const getNodesAndEdges = async ({
573
575
  }
574
576
  }
575
577
 
576
- // If producer does not have a any channels defined, we need to connect the message to the consumer directly
577
- if (producerChannels.length === 0 && channel) {
578
+ // If producer does not have any resolved channels, connect via the consumer channel
579
+ if (resolvedProducerChannels.length === 0 && channel) {
578
580
  // Create the channel node
579
581
  nodes.push(
580
582
  createNode({
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  },
8
8
  "license": "SEE LICENSE IN LICENSE",
9
9
  "type": "module",
10
- "version": "4.11.0",
10
+ "version": "4.11.2",
11
11
  "publishConfig": {
12
12
  "access": "public"
13
13
  },
@@ -27,6 +27,7 @@
27
27
  "!eventcatalog/dist/",
28
28
  "!eventcatalog/node_modules/",
29
29
  "!eventcatalog/**/__tests__/",
30
+ "!eventcatalog/**/*.{spec,test}.{js,jsx,cjs,mjs,ts,tsx,cts,mts}",
30
31
  "bin/",
31
32
  "dist/"
32
33
  ],
@@ -120,8 +121,8 @@
120
121
  "uuid": "^11.1.1",
121
122
  "zod": "^4.3.6",
122
123
  "@eventcatalog/linter": "1.1.20",
123
- "@eventcatalog/visualiser": "^4.1.4",
124
- "@eventcatalog/sdk": "2.29.1"
124
+ "@eventcatalog/sdk": "2.29.1",
125
+ "@eventcatalog/visualiser": "^4.1.4"
125
126
  },
126
127
  "devDependencies": {
127
128
  "@astrojs/check": "^0.9.10",
@@ -1,18 +0,0 @@
1
- // src/astro-output.ts
2
- var createAstroLineFilter = () => {
3
- return (line) => {
4
- const isIgnoredGetStaticPathsWarning = line.includes("[router]") && line.includes("getStaticPaths() ignored in dynamic page");
5
- return line.includes("[glob-loader]") || isIgnoredGetStaticPathsWarning || /^\s*The collection ".*" does not exist or is empty\. Please check your content config file for errors\.\s*$/.test(line);
6
- };
7
- };
8
- var createAstroDevLineFilter = () => {
9
- const shouldFilterAstroLine = createAstroLineFilter();
10
- return (line) => {
11
- return shouldFilterAstroLine(line) || line.includes("[router]");
12
- };
13
- };
14
-
15
- export {
16
- createAstroLineFilter,
17
- createAstroDevLineFilter
18
- };
@@ -1,64 +0,0 @@
1
- import { describe, expect, it } from 'vitest';
2
- import { buildEnvironmentUrl, findCurrentEnvironment } from './EnvironmentDropdown';
3
-
4
- const environments = [
5
- {
6
- name: 'Development',
7
- url: 'https://example.com/event-catalog/dev',
8
- shortName: 'Dev',
9
- },
10
- {
11
- name: 'UAT',
12
- url: 'https://example.com/event-catalog/uat',
13
- shortName: 'UAT',
14
- },
15
- {
16
- name: 'Production',
17
- url: 'https://example.com/event-catalog/prod',
18
- shortName: 'Prod',
19
- },
20
- ];
21
-
22
- describe('EnvironmentDropdown', () => {
23
- it('finds the current environment when environments share an origin but use different base paths', () => {
24
- expect(findCurrentEnvironment(environments, 'https://example.com/event-catalog/uat/services/foo')?.name).toBe('UAT');
25
- });
26
-
27
- it('builds environment urls by replacing the current environment base path', () => {
28
- expect(
29
- buildEnvironmentUrl(
30
- 'https://example.com/event-catalog/prod',
31
- 'https://example.com/event-catalog/uat/services/foo',
32
- 'https://example.com/event-catalog/uat'
33
- )
34
- ).toBe('https://example.com/event-catalog/prod/services/foo');
35
- });
36
-
37
- it('preserves search params and hashes when switching environments', () => {
38
- expect(
39
- buildEnvironmentUrl(
40
- 'https://example.com/event-catalog/prod',
41
- 'https://example.com/event-catalog/uat/services/foo?tab=messages#latest',
42
- 'https://example.com/event-catalog/uat'
43
- )
44
- ).toBe('https://example.com/event-catalog/prod/services/foo?tab=messages#latest');
45
- });
46
-
47
- it('keeps existing origin based environment switching for root catalogs', () => {
48
- expect(
49
- buildEnvironmentUrl('https://prod.example.com', 'https://uat.example.com/services/foo', 'https://uat.example.com')
50
- ).toBe('https://prod.example.com/services/foo');
51
- });
52
-
53
- it('switches from a root catalog to a subpath catalog', () => {
54
- expect(buildEnvironmentUrl('https://example.com/prod', 'https://example.com/services/foo', 'https://example.com')).toBe(
55
- 'https://example.com/prod/services/foo'
56
- );
57
- });
58
-
59
- it('preserves the current path when the current environment is unknown', () => {
60
- expect(buildEnvironmentUrl('https://example.com/prod', 'http://localhost:3000/services/foo')).toBe(
61
- 'https://example.com/prod/services/foo'
62
- );
63
- });
64
- });