@eventcatalog/core 2.17.1 → 2.17.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.17.1";
40
+ var version = "2.17.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-7UY64I6H.js";
4
- import "../chunk-2SREN5TH.js";
3
+ } from "../chunk-Q27R4PJA.js";
4
+ import "../chunk-XSTP7ECG.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.17.1";
109
+ var version = "2.17.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-Z6B4BKLB.js";
4
- import "../chunk-7UY64I6H.js";
5
- import "../chunk-2SREN5TH.js";
3
+ } from "../chunk-EG3QHOOT.js";
4
+ import "../chunk-Q27R4PJA.js";
5
+ import "../chunk-XSTP7ECG.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
  raiseEvent
3
- } from "./chunk-7UY64I6H.js";
3
+ } from "./chunk-Q27R4PJA.js";
4
4
  import {
5
5
  getEventCatalogConfigFile,
6
6
  verifyRequiredFieldsAreInCatalogConfigFile
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VERSION
3
- } from "./chunk-2SREN5TH.js";
3
+ } from "./chunk-XSTP7ECG.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.17.1";
2
+ var version = "2.17.2";
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.17.1";
28
+ var version = "2.17.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-2SREN5TH.js";
3
+ } from "./chunk-XSTP7ECG.js";
4
4
  export {
5
5
  VERSION
6
6
  };
@@ -161,7 +161,7 @@ var import_axios = __toESM(require("axios"), 1);
161
161
  var import_os = __toESM(require("os"), 1);
162
162
 
163
163
  // package.json
164
- var version = "2.17.1";
164
+ var version = "2.17.2";
165
165
 
166
166
  // src/constants.ts
167
167
  var VERSION = version;
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  log_build_default
3
- } from "./chunk-Z6B4BKLB.js";
4
- import "./chunk-7UY64I6H.js";
3
+ } from "./chunk-EG3QHOOT.js";
4
+ import "./chunk-Q27R4PJA.js";
5
5
  import {
6
6
  catalogToAstro
7
7
  } from "./chunk-55YPRY5U.js";
8
8
  import {
9
9
  VERSION
10
- } from "./chunk-2SREN5TH.js";
10
+ } from "./chunk-XSTP7ECG.js";
11
11
  import {
12
12
  generate
13
13
  } from "./chunk-YEQVKHST.js";
@@ -132,7 +132,9 @@ const allDataAsSideNav = allData.reduce((acc, item) => {
132
132
  const sideNav = {
133
133
  ...(currentPath.includes('visualiser')
134
134
  ? {
135
- 'bounded context map': [{ label: 'Domain map', href: '/visualiser/context-map', collection: 'bounded-context-map' }],
135
+ 'bounded context map': [
136
+ { label: 'Domain map', href: buildUrl('/visualiser/context-map'), collection: 'bounded-context-map' },
137
+ ],
136
138
  }
137
139
  : {}),
138
140
  ...allDataAsSideNav,
@@ -19,7 +19,14 @@ interface Props {
19
19
  getAllVersions?: boolean;
20
20
  }
21
21
 
22
+ // cache for build time
23
+ export let cachedChannels: Channel[] = [];
24
+
22
25
  export const getChannels = async ({ getAllVersions = true }: Props = {}): Promise<Channel[]> => {
26
+ if (cachedChannels.length > 0) {
27
+ return cachedChannels;
28
+ }
29
+
23
30
  const channels = await getCollection('channels', (query) => {
24
31
  return (getAllVersions || !query.data?.pathToFile?.includes('versioned')) && query.data.hidden !== true;
25
32
  });
@@ -27,7 +34,7 @@ export const getChannels = async ({ getAllVersions = true }: Props = {}): Promis
27
34
  const { commands, events, queries } = await getMessages();
28
35
  const allMessages = [...commands, ...events, ...queries];
29
36
 
30
- return channels.map((channel) => {
37
+ cachedChannels = channels.map((channel) => {
31
38
  const { latestVersion, versions } = getVersionForCollectionItem(channel, channels);
32
39
 
33
40
  const messagesForChannel = allMessages.filter((message) => {
@@ -61,4 +68,6 @@ export const getChannels = async ({ getAllVersions = true }: Props = {}): Promis
61
68
  },
62
69
  };
63
70
  });
71
+
72
+ return cachedChannels;
64
73
  };
@@ -11,7 +11,14 @@ interface Props {
11
11
  getAllVersions?: boolean;
12
12
  }
13
13
 
14
+ // Cache for build time
15
+ let cachedDomains: Domain[] = [];
16
+
14
17
  export const getDomains = async ({ getAllVersions = true }: Props = {}): Promise<Domain[]> => {
18
+ if (cachedDomains.length > 0) {
19
+ return cachedDomains;
20
+ }
21
+
15
22
  // Get all the domains that are not versioned
16
23
  const domains = await getCollection('domains', (domain) => {
17
24
  return (getAllVersions || !domain.data?.pathToFile?.includes('versioned')) && domain.data.hidden !== true;
@@ -21,7 +28,7 @@ export const getDomains = async ({ getAllVersions = true }: Props = {}): Promise
21
28
  const servicesCollection = await getCollection('services');
22
29
 
23
30
  // @ts-ignore // TODO: Fix this type
24
- return domains.map((domain) => {
31
+ cachedDomains = domains.map((domain) => {
25
32
  const { latestVersion, versions } = getVersionForCollectionItem(domain, domains);
26
33
 
27
34
  // const receives = service.data.receives || [];
@@ -51,6 +58,8 @@ export const getDomains = async ({ getAllVersions = true }: Props = {}): Promise
51
58
  },
52
59
  };
53
60
  });
61
+
62
+ return cachedDomains;
54
63
  };
55
64
 
56
65
  export const getUbiquitousLanguage = async (domain: Domain): Promise<UbiquitousLanguage[]> => {
@@ -11,7 +11,14 @@ interface Props {
11
11
  getAllVersions?: boolean;
12
12
  }
13
13
 
14
+ // Cache for build time
15
+ let cachedFlows: Flow[] = [];
16
+
14
17
  export const getFlows = async ({ getAllVersions = true }: Props = {}): Promise<Flow[]> => {
18
+ if (cachedFlows.length > 0) {
19
+ return cachedFlows;
20
+ }
21
+
15
22
  // Get flows that are not versioned
16
23
  const flows = await getCollection('flows', (flow) => {
17
24
  return (getAllVersions || !flow.data.pathToFile?.includes('versioned')) && flow.data.hidden !== true;
@@ -23,7 +30,7 @@ export const getFlows = async ({ getAllVersions = true }: Props = {}): Promise<F
23
30
  const allMessages = [...events, ...commands];
24
31
 
25
32
  // @ts-ignore // TODO: Fix this type
26
- return flows.map((flow) => {
33
+ cachedFlows = flows.map((flow) => {
27
34
  // @ts-ignore
28
35
  const { latestVersion, versions } = getVersionForCollectionItem(flow, flows);
29
36
  const steps = flow.data.steps || [];
@@ -56,4 +63,6 @@ export const getFlows = async ({ getAllVersions = true }: Props = {}): Promise<F
56
63
  },
57
64
  };
58
65
  });
66
+
67
+ return cachedFlows;
59
68
  };
@@ -12,7 +12,14 @@ interface Props {
12
12
  getAllVersions?: boolean;
13
13
  }
14
14
 
15
+ // Cache for build time
16
+ let cachedServices: Service[] = [];
17
+
15
18
  export const getServices = async ({ getAllVersions = true }: Props = {}): Promise<Service[]> => {
19
+ if (cachedServices.length > 0) {
20
+ return cachedServices;
21
+ }
22
+
16
23
  // Get services that are not versioned
17
24
  const services = await getCollection('services', (service) => {
18
25
  return (getAllVersions || !service.data?.pathToFile?.includes('versioned')) && service.data.hidden !== true;
@@ -24,7 +31,7 @@ export const getServices = async ({ getAllVersions = true }: Props = {}): Promis
24
31
  const allMessages = [...events, ...commands, ...queries];
25
32
 
26
33
  // @ts-ignore // TODO: Fix this type
27
- return services.map((service) => {
34
+ cachedServices = services.map((service) => {
28
35
  const { latestVersion, versions } = getVersionForCollectionItem(service, services);
29
36
 
30
37
  const sendsMessages = service.data.sends || [];
@@ -65,6 +72,8 @@ export const getServices = async ({ getAllVersions = true }: Props = {}): Promis
65
72
  },
66
73
  };
67
74
  });
75
+
76
+ return cachedServices;
68
77
  };
69
78
 
70
79
  export const getProducersOfMessage = (services: Service[], message: CollectionEntry<'events' | 'commands' | 'queries'>) => {
@@ -17,7 +17,14 @@ interface Props {
17
17
  getAllVersions?: boolean;
18
18
  }
19
19
 
20
+ // cache for build time
21
+ export let cachedCommands: Command[] = [];
22
+
20
23
  export const getCommands = async ({ getAllVersions = true }: Props = {}): Promise<Command[]> => {
24
+ if (cachedCommands.length > 0) {
25
+ return cachedCommands;
26
+ }
27
+
21
28
  const commands = await getCollection('commands', (command) => {
22
29
  return (getAllVersions || !command.data?.pathToFile?.includes('versioned')) && command.data.hidden !== true;
23
30
  });
@@ -25,7 +32,7 @@ export const getCommands = async ({ getAllVersions = true }: Props = {}): Promis
25
32
  const services = await getCollection('services');
26
33
  const allChannels = await getCollection('channels');
27
34
 
28
- return commands.map((command) => {
35
+ cachedCommands = commands.map((command) => {
29
36
  const { latestVersion, versions } = getVersionForCollectionItem(command, commands);
30
37
 
31
38
  const producers = services.filter((service) => {
@@ -67,4 +74,6 @@ export const getCommands = async ({ getAllVersions = true }: Props = {}): Promis
67
74
  },
68
75
  };
69
76
  });
77
+
78
+ return cachedCommands;
70
79
  };
@@ -17,7 +17,14 @@ interface Props {
17
17
  getAllVersions?: boolean;
18
18
  }
19
19
 
20
+ // cache for build time
21
+ export let cachedEvents: Event[] = [];
22
+
20
23
  export const getEvents = async ({ getAllVersions = true }: Props = {}): Promise<Event[]> => {
24
+ if (cachedEvents.length > 0) {
25
+ return cachedEvents;
26
+ }
27
+
21
28
  const events = await getCollection('events', (event) => {
22
29
  return (getAllVersions || !event.data?.pathToFile?.includes('versioned')) && event.data.hidden !== true;
23
30
  });
@@ -25,7 +32,7 @@ export const getEvents = async ({ getAllVersions = true }: Props = {}): Promise<
25
32
  const services = await getCollection('services');
26
33
  const allChannels = await getCollection('channels');
27
34
 
28
- return events.map((event) => {
35
+ cachedEvents = events.map((event) => {
29
36
  const { latestVersion, versions } = getVersionForCollectionItem(event, events);
30
37
 
31
38
  const producers = services.filter((service) =>
@@ -67,4 +74,6 @@ export const getEvents = async ({ getAllVersions = true }: Props = {}): Promise<
67
74
  },
68
75
  };
69
76
  });
77
+
78
+ return cachedEvents;
70
79
  };
@@ -15,15 +15,29 @@ type Messages = {
15
15
  events: CollectionEntry<'events'>[];
16
16
  queries: CollectionEntry<'queries'>[];
17
17
  };
18
+
19
+ // Cache for build time
20
+ let cachedMessages: Messages = {
21
+ commands: [],
22
+ events: [],
23
+ queries: [],
24
+ };
25
+
18
26
  // Main function that uses the imported functions
19
27
  export const getMessages = async ({ getAllVersions = true }: Props = {}): Promise<Messages> => {
28
+ if (cachedMessages.commands.length > 0) {
29
+ return cachedMessages;
30
+ }
31
+
20
32
  const commands = await getCommands({ getAllVersions });
21
33
  const events = await getEvents({ getAllVersions });
22
34
  const queries = await getQueries({ getAllVersions });
23
35
 
24
- return {
36
+ cachedMessages = {
25
37
  commands: commands as CollectionEntry<'commands'>[],
26
38
  events: events as CollectionEntry<'events'>[],
27
39
  queries: queries as CollectionEntry<'queries'>[],
28
- } satisfies Messages;
40
+ };
41
+
42
+ return cachedMessages;
29
43
  };
@@ -17,7 +17,14 @@ interface Props {
17
17
  getAllVersions?: boolean;
18
18
  }
19
19
 
20
+ // Cache for build time
21
+ let cachedQueries: Query[] = [];
22
+
20
23
  export const getQueries = async ({ getAllVersions = true }: Props = {}): Promise<Query[]> => {
24
+ if (cachedQueries.length > 0) {
25
+ return cachedQueries;
26
+ }
27
+
21
28
  const queries = await getCollection('queries', (query) => {
22
29
  return (getAllVersions || !query.data?.pathToFile?.includes('versioned')) && query.data.hidden !== true;
23
30
  });
@@ -25,7 +32,7 @@ export const getQueries = async ({ getAllVersions = true }: Props = {}): Promise
25
32
  const services = await getCollection('services');
26
33
  const allChannels = await getCollection('channels');
27
34
 
28
- return queries.map((query) => {
35
+ cachedQueries = queries.map((query) => {
29
36
  const { latestVersion, versions } = getVersionForCollectionItem(query, queries);
30
37
 
31
38
  const producers = services.filter((service) =>
@@ -67,4 +74,6 @@ export const getQueries = async ({ getAllVersions = true }: Props = {}): Promise
67
74
  },
68
75
  };
69
76
  });
77
+
78
+ return cachedQueries;
70
79
  };
@@ -4,7 +4,14 @@ import path from 'path';
4
4
 
5
5
  export type Team = CollectionEntry<'teams'>;
6
6
 
7
+ // Cache for build time
8
+ let cachedTeams: Team[] = [];
9
+
7
10
  export const getTeams = async (): Promise<Team[]> => {
11
+ if (cachedTeams.length > 0) {
12
+ return cachedTeams;
13
+ }
14
+
8
15
  // Get services that are not versioned
9
16
  const teams = await getCollection('teams', (team) => {
10
17
  return team.data.hidden !== true;
@@ -17,7 +24,7 @@ export const getTeams = async (): Promise<Team[]> => {
17
24
  const events = await getCollection('events');
18
25
  const commands = await getCollection('commands');
19
26
 
20
- return teams.map((team) => {
27
+ cachedTeams = teams.map((team) => {
21
28
  const ownedDomains = domains.filter((domain) => {
22
29
  return domain.data.owners?.find((owner) => owner.id === team.data.id);
23
30
  });
@@ -50,4 +57,6 @@ export const getTeams = async (): Promise<Team[]> => {
50
57
  },
51
58
  };
52
59
  });
60
+
61
+ return cachedTeams;
53
62
  };
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.17.1",
9
+ "version": "2.17.2",
10
10
  "publishConfig": {
11
11
  "access": "public"
12
12
  },