@eventcatalog/core 2.55.2 → 2.55.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.
@@ -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.55.2";
40
+ var version = "2.55.3";
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-IDIX2ZKS.js";
4
- import "../chunk-GVFJKTWB.js";
3
+ } from "../chunk-T5TRFXGX.js";
4
+ import "../chunk-WYTPPCGQ.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.55.2";
109
+ var version = "2.55.3";
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-5LLK3UBP.js";
4
- import "../chunk-IDIX2ZKS.js";
5
- import "../chunk-GVFJKTWB.js";
3
+ } from "../chunk-6MWKM7BG.js";
4
+ import "../chunk-T5TRFXGX.js";
5
+ import "../chunk-WYTPPCGQ.js";
6
6
  import "../chunk-UPONRQSN.js";
7
7
  export {
8
8
  log_build_default as default
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  raiseEvent
3
- } from "./chunk-IDIX2ZKS.js";
3
+ } from "./chunk-T5TRFXGX.js";
4
4
  import {
5
5
  getEventCatalogConfigFile,
6
6
  verifyRequiredFieldsAreInCatalogConfigFile
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VERSION
3
- } from "./chunk-GVFJKTWB.js";
3
+ } from "./chunk-WYTPPCGQ.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.55.2";
2
+ var version = "2.55.3";
3
3
 
4
4
  // src/constants.ts
5
5
  var VERSION = version;
@@ -25,7 +25,7 @@ __export(constants_exports, {
25
25
  module.exports = __toCommonJS(constants_exports);
26
26
 
27
27
  // package.json
28
- var version = "2.55.2";
28
+ var version = "2.55.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-GVFJKTWB.js";
3
+ } from "./chunk-WYTPPCGQ.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.55.2";
160
+ var version = "2.55.3";
161
161
 
162
162
  // src/constants.ts
163
163
  var VERSION = version;
@@ -6,8 +6,8 @@ import {
6
6
  } from "./chunk-PLNJC7NZ.js";
7
7
  import {
8
8
  log_build_default
9
- } from "./chunk-5LLK3UBP.js";
10
- import "./chunk-IDIX2ZKS.js";
9
+ } from "./chunk-6MWKM7BG.js";
10
+ import "./chunk-T5TRFXGX.js";
11
11
  import {
12
12
  catalogToAstro,
13
13
  checkAndConvertMdToMdx
@@ -15,7 +15,7 @@ import {
15
15
  import "./chunk-55D645EH.js";
16
16
  import {
17
17
  VERSION
18
- } from "./chunk-GVFJKTWB.js";
18
+ } from "./chunk-WYTPPCGQ.js";
19
19
  import {
20
20
  getProjectOutDir,
21
21
  isAuthEnabled,
@@ -7,6 +7,7 @@ import VerticalSideBarLayout from '@layouts/VerticalSideBarLayout.astro';
7
7
  import DomainGrid from '@components/Grids/DomainGrid';
8
8
  import ServiceGrid from '@components/Grids/ServiceGrid';
9
9
  import MessageGrid from '@components/Grids/MessageGrid';
10
+ import { removeContentFromCollection } from '@utils/collections/util';
10
11
 
11
12
  import type { CollectionEntry } from 'astro:content';
12
13
  import type { CollectionMessageTypes } from '@types';
@@ -64,13 +65,9 @@ if (type === 'services') {
64
65
  }) as unknown as Service[];
65
66
  items = filteredServices;
66
67
  } else if (type === 'messages') {
67
- const { events, commands, queries } = await getMessages({ getAllVersions: false });
68
+ const { events, commands, queries } = await getMessages({ getAllVersions: false, hydrateServices: false });
68
69
  const messages = [...events, ...commands, ...queries];
69
- items = messages.map((m) => ({
70
- ...m,
71
- body: undefined,
72
- catalog: undefined,
73
- })) as unknown as CollectionEntry<CollectionMessageTypes>[];
70
+ items = removeContentFromCollection(messages) as unknown as CollectionEntry<CollectionMessageTypes>[];
74
71
  }
75
72
  ---
76
73
 
@@ -148,3 +148,11 @@ export const getDeprecatedDetails = (item: CollectionEntry<CollectionTypes>) =>
148
148
 
149
149
  return options;
150
150
  };
151
+
152
+ export const removeContentFromCollection = (collection: CollectionEntry<CollectionTypes>[]) => {
153
+ return collection.map((item) => ({
154
+ ...item,
155
+ body: undefined,
156
+ catalog: undefined,
157
+ }));
158
+ };
@@ -15,6 +15,7 @@ type Command = CollectionEntry<'commands'> & {
15
15
 
16
16
  interface Props {
17
17
  getAllVersions?: boolean;
18
+ hydrateServices?: boolean;
18
19
  }
19
20
 
20
21
  // cache for build time
@@ -23,10 +24,10 @@ let cachedCommands: Record<string, Command[]> = {
23
24
  currentVersions: [],
24
25
  };
25
26
 
26
- export const getCommands = async ({ getAllVersions = true }: Props = {}): Promise<Command[]> => {
27
+ export const getCommands = async ({ getAllVersions = true, hydrateServices = true }: Props = {}): Promise<Command[]> => {
27
28
  const cacheKey = getAllVersions ? 'allVersions' : 'currentVersions';
28
29
 
29
- if (cachedCommands[cacheKey].length > 0) {
30
+ if (cachedCommands[cacheKey].length > 0 && hydrateServices) {
30
31
  return cachedCommands[cacheKey];
31
32
  }
32
33
 
@@ -37,24 +38,35 @@ export const getCommands = async ({ getAllVersions = true }: Props = {}): Promis
37
38
  const services = await getCollection('services');
38
39
  const allChannels = await getCollection('channels');
39
40
 
41
+ // @ts-ignore
40
42
  cachedCommands[cacheKey] = commands.map((command) => {
41
43
  const { latestVersion, versions } = getVersionForCollectionItem(command, commands);
42
44
 
43
- const producers = services.filter((service) => {
44
- return service.data.sends?.some((item) => {
45
- if (item.id != command.data.id) return false;
46
- if (item.version == 'latest' || item.version == undefined) return command.data.version == latestVersion;
47
- return satisfies(command.data.version, item.version);
45
+ const producers = services
46
+ .filter((service) => {
47
+ return service.data.sends?.some((item) => {
48
+ if (item.id != command.data.id) return false;
49
+ if (item.version == 'latest' || item.version == undefined) return command.data.version == latestVersion;
50
+ return satisfies(command.data.version, item.version);
51
+ });
52
+ })
53
+ .map((service) => {
54
+ if (!hydrateServices) return { id: service.id, version: service.data.version };
55
+ return service;
48
56
  });
49
- });
50
57
 
51
- const consumers = services.filter((service) => {
52
- return service.data.receives?.some((item) => {
53
- if (item.id != command.data.id) return false;
54
- if (item.version == 'latest' || item.version == undefined) return command.data.version == latestVersion;
55
- return satisfies(command.data.version, item.version);
58
+ const consumers = services
59
+ .filter((service) => {
60
+ return service.data.receives?.some((item) => {
61
+ if (item.id != command.data.id) return false;
62
+ if (item.version == 'latest' || item.version == undefined) return command.data.version == latestVersion;
63
+ return satisfies(command.data.version, item.version);
64
+ });
65
+ })
66
+ .map((service) => {
67
+ if (!hydrateServices) return { id: service.id, version: service.data.version };
68
+ return service;
56
69
  });
57
- });
58
70
 
59
71
  const messageChannels = command.data.channels || [];
60
72
  const channelsForCommand = allChannels.filter((c) => messageChannels.some((channel) => c.data.id === channel.id));
@@ -15,6 +15,7 @@ type Event = CollectionEntry<'events'> & {
15
15
 
16
16
  interface Props {
17
17
  getAllVersions?: boolean;
18
+ hydrateServices?: boolean;
18
19
  }
19
20
 
20
21
  // cache for build time
@@ -23,10 +24,10 @@ let cachedEvents: Record<string, Event[]> = {
23
24
  currentVersions: [],
24
25
  };
25
26
 
26
- export const getEvents = async ({ getAllVersions = true }: Props = {}): Promise<Event[]> => {
27
+ export const getEvents = async ({ getAllVersions = true, hydrateServices = true }: Props = {}): Promise<Event[]> => {
27
28
  const cacheKey = getAllVersions ? 'allVersions' : 'currentVersions';
28
29
 
29
- if (cachedEvents[cacheKey].length > 0) {
30
+ if (cachedEvents[cacheKey].length > 0 && hydrateServices) {
30
31
  return cachedEvents[cacheKey];
31
32
  }
32
33
 
@@ -37,24 +38,35 @@ export const getEvents = async ({ getAllVersions = true }: Props = {}): Promise<
37
38
  const services = await getCollection('services');
38
39
  const allChannels = await getCollection('channels');
39
40
 
41
+ // @ts-ignore
40
42
  cachedEvents[cacheKey] = events.map((event) => {
41
43
  const { latestVersion, versions } = getVersionForCollectionItem(event, events);
42
44
 
43
- const producers = services.filter((service) =>
44
- service.data.sends?.some((item) => {
45
- if (item.id != event.data.id) return false;
46
- if (item.version == 'latest' || item.version == undefined) return event.data.version == latestVersion;
47
- return satisfies(event.data.version, item.version);
48
- })
49
- );
45
+ const producers = services
46
+ .filter((service) =>
47
+ service.data.sends?.some((item) => {
48
+ if (item.id != event.data.id) return false;
49
+ if (item.version == 'latest' || item.version == undefined) return event.data.version == latestVersion;
50
+ return satisfies(event.data.version, item.version);
51
+ })
52
+ )
53
+ .map((service) => {
54
+ if (!hydrateServices) return { id: service.id, version: service.data.version };
55
+ return service;
56
+ });
50
57
 
51
- const consumers = services.filter((service) =>
52
- service.data.receives?.some((item) => {
53
- if (item.id != event.data.id) return false;
54
- if (item.version == 'latest' || item.version == undefined) return event.data.version == latestVersion;
55
- return satisfies(event.data.version, item.version);
56
- })
57
- );
58
+ const consumers = services
59
+ .filter((service) =>
60
+ service.data.receives?.some((item) => {
61
+ if (item.id != event.data.id) return false;
62
+ if (item.version == 'latest' || item.version == undefined) return event.data.version == latestVersion;
63
+ return satisfies(event.data.version, item.version);
64
+ })
65
+ )
66
+ .map((service) => {
67
+ if (!hydrateServices) return { id: service.id, version: service.data.version };
68
+ return service;
69
+ });
58
70
 
59
71
  const messageChannels = event.data.channels || [];
60
72
  const channelsForEvent = allChannels.filter((c) => messageChannels.some((channel) => c.data.id === channel.id));
@@ -8,6 +8,7 @@ export { getEvents } from '@utils/events';
8
8
 
9
9
  interface Props {
10
10
  getAllVersions?: boolean;
11
+ hydrateServices?: boolean;
11
12
  }
12
13
 
13
14
  type Messages = {
@@ -17,11 +18,11 @@ type Messages = {
17
18
  };
18
19
 
19
20
  // Main function that uses the imported functions
20
- export const getMessages = async ({ getAllVersions = true }: Props = {}): Promise<Messages> => {
21
+ export const getMessages = async ({ getAllVersions = true, hydrateServices = true }: Props = {}): Promise<Messages> => {
21
22
  const [commands, events, queries] = await Promise.all([
22
- getCommands({ getAllVersions }),
23
- getEvents({ getAllVersions }),
24
- getQueries({ getAllVersions }),
23
+ getCommands({ getAllVersions, hydrateServices }),
24
+ getEvents({ getAllVersions, hydrateServices }),
25
+ getQueries({ getAllVersions, hydrateServices }),
25
26
  ]);
26
27
 
27
28
  return {
@@ -15,6 +15,7 @@ type Query = CollectionEntry<'queries'> & {
15
15
 
16
16
  interface Props {
17
17
  getAllVersions?: boolean;
18
+ hydrateServices?: boolean;
18
19
  }
19
20
 
20
21
  // Cache for build time
@@ -23,10 +24,10 @@ let cachedQueries: Record<string, Query[]> = {
23
24
  currentVersions: [],
24
25
  };
25
26
 
26
- export const getQueries = async ({ getAllVersions = true }: Props = {}): Promise<Query[]> => {
27
+ export const getQueries = async ({ getAllVersions = true, hydrateServices = true }: Props = {}): Promise<Query[]> => {
27
28
  const cacheKey = getAllVersions ? 'allVersions' : 'currentVersions';
28
29
 
29
- if (cachedQueries[cacheKey].length > 0) {
30
+ if (cachedQueries[cacheKey].length > 0 && hydrateServices) {
30
31
  return cachedQueries[cacheKey];
31
32
  }
32
33
 
@@ -37,24 +38,35 @@ export const getQueries = async ({ getAllVersions = true }: Props = {}): Promise
37
38
  const services = await getCollection('services');
38
39
  const allChannels = await getCollection('channels');
39
40
 
41
+ // @ts-ignore
40
42
  cachedQueries[cacheKey] = queries.map((query) => {
41
43
  const { latestVersion, versions } = getVersionForCollectionItem(query, queries);
42
44
 
43
- const producers = services.filter((service) =>
44
- service.data.sends?.some((item) => {
45
- if (item.id != query.data.id) return false;
46
- if (item.version == 'latest' || item.version == undefined) return query.data.version == latestVersion;
47
- return satisfies(query.data.version, item.version);
48
- })
49
- );
45
+ const producers = services
46
+ .filter((service) =>
47
+ service.data.sends?.some((item) => {
48
+ if (item.id != query.data.id) return false;
49
+ if (item.version == 'latest' || item.version == undefined) return query.data.version == latestVersion;
50
+ return satisfies(query.data.version, item.version);
51
+ })
52
+ )
53
+ .map((service) => {
54
+ if (!hydrateServices) return { id: service.id, version: service.data.version };
55
+ return service;
56
+ });
50
57
 
51
- const consumers = services.filter((service) =>
52
- service.data.receives?.some((item) => {
53
- if (item.id != query.data.id) return false;
54
- if (item.version == 'latest' || item.version == undefined) return query.data.version == latestVersion;
55
- return satisfies(query.data.version, item.version);
56
- })
57
- );
58
+ const consumers = services
59
+ .filter((service) =>
60
+ service.data.receives?.some((item) => {
61
+ if (item.id != query.data.id) return false;
62
+ if (item.version == 'latest' || item.version == undefined) return query.data.version == latestVersion;
63
+ return satisfies(query.data.version, item.version);
64
+ })
65
+ )
66
+ .map((service) => {
67
+ if (!hydrateServices) return { id: service.id, version: service.data.version };
68
+ return service;
69
+ });
58
70
 
59
71
  const messageChannels = query.data.channels || [];
60
72
  const channelsForQuery = allChannels.filter((c) => messageChannels.some((channel) => c.data.id === channel.id));
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.55.2",
9
+ "version": "2.55.3",
10
10
  "publishConfig": {
11
11
  "access": "public"
12
12
  },