@eventcatalog/core 2.18.2 → 2.18.4
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.
- package/dist/analytics/analytics.cjs +1 -1
- package/dist/analytics/analytics.js +2 -2
- package/dist/analytics/log-build.cjs +1 -1
- package/dist/analytics/log-build.js +3 -3
- package/dist/{chunk-PSMNZFCI.js → chunk-OOOLFBRN.js} +1 -1
- package/dist/{chunk-RF2R7CRK.js → chunk-PCKSHEKP.js} +1 -1
- package/dist/{chunk-JG77VIA4.js → chunk-RS3HF4IW.js} +1 -1
- package/dist/constants.cjs +1 -1
- package/dist/constants.js +1 -1
- package/dist/eventcatalog.cjs +1 -1
- package/dist/eventcatalog.js +3 -3
- package/eventcatalog/src/utils/channels.ts +10 -5
- package/eventcatalog/src/utils/collections/domains.ts +4 -4
- package/eventcatalog/src/utils/collections/flows.ts +10 -5
- package/eventcatalog/src/utils/collections/services.ts +11 -5
- package/eventcatalog/src/utils/collections/util.ts +12 -3
- package/eventcatalog/src/utils/commands.ts +10 -5
- package/eventcatalog/src/utils/events.ts +10 -5
- package/eventcatalog/src/utils/queries.ts +10 -5
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
log_build_default
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
5
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-OOOLFBRN.js";
|
|
4
|
+
import "../chunk-RS3HF4IW.js";
|
|
5
|
+
import "../chunk-PCKSHEKP.js";
|
|
6
6
|
import "../chunk-E7TXTI7G.js";
|
|
7
7
|
export {
|
|
8
8
|
log_build_default as default
|
package/dist/constants.cjs
CHANGED
package/dist/constants.js
CHANGED
package/dist/eventcatalog.cjs
CHANGED
package/dist/eventcatalog.js
CHANGED
|
@@ -3,14 +3,14 @@ import {
|
|
|
3
3
|
} from "./chunk-SHCMAL37.js";
|
|
4
4
|
import {
|
|
5
5
|
log_build_default
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-OOOLFBRN.js";
|
|
7
|
+
import "./chunk-RS3HF4IW.js";
|
|
8
8
|
import {
|
|
9
9
|
catalogToAstro
|
|
10
10
|
} from "./chunk-WF34R5UT.js";
|
|
11
11
|
import {
|
|
12
12
|
VERSION
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-PCKSHEKP.js";
|
|
14
14
|
import {
|
|
15
15
|
generate
|
|
16
16
|
} from "./chunk-YEQVKHST.js";
|
|
@@ -20,11 +20,16 @@ interface Props {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
// cache for build time
|
|
23
|
-
|
|
23
|
+
let cachedChannels: Record<string, Channel[]> = {
|
|
24
|
+
allVersions: [],
|
|
25
|
+
currentVersions: [],
|
|
26
|
+
};
|
|
24
27
|
|
|
25
28
|
export const getChannels = async ({ getAllVersions = true }: Props = {}): Promise<Channel[]> => {
|
|
26
|
-
|
|
27
|
-
|
|
29
|
+
const cacheKey = getAllVersions ? 'allVersions' : 'currentVersions';
|
|
30
|
+
|
|
31
|
+
if (cachedChannels[cacheKey].length > 0) {
|
|
32
|
+
return cachedChannels[cacheKey];
|
|
28
33
|
}
|
|
29
34
|
|
|
30
35
|
const channels = await getCollection('channels', (query) => {
|
|
@@ -34,7 +39,7 @@ export const getChannels = async ({ getAllVersions = true }: Props = {}): Promis
|
|
|
34
39
|
const { commands, events, queries } = await getMessages();
|
|
35
40
|
const allMessages = [...commands, ...events, ...queries];
|
|
36
41
|
|
|
37
|
-
cachedChannels = channels.map((channel) => {
|
|
42
|
+
cachedChannels[cacheKey] = channels.map((channel) => {
|
|
38
43
|
const { latestVersion, versions } = getVersionForCollectionItem(channel, channels);
|
|
39
44
|
|
|
40
45
|
const messagesForChannel = allMessages.filter((message) => {
|
|
@@ -69,5 +74,5 @@ export const getChannels = async ({ getAllVersions = true }: Props = {}): Promis
|
|
|
69
74
|
};
|
|
70
75
|
});
|
|
71
76
|
|
|
72
|
-
return cachedChannels;
|
|
77
|
+
return cachedChannels[cacheKey];
|
|
73
78
|
};
|
|
@@ -20,10 +20,10 @@ let cachedDomains: Record<string, Domain[]> = {
|
|
|
20
20
|
export const getDomains = async ({ getAllVersions = true }: Props = {}): Promise<Domain[]> => {
|
|
21
21
|
const cacheKey = getAllVersions ? 'allVersions' : 'currentVersions';
|
|
22
22
|
|
|
23
|
-
//
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
// Check if we have cached domains for this specific getAllVersions value
|
|
24
|
+
if (cachedDomains[cacheKey].length > 0) {
|
|
25
|
+
return cachedDomains[cacheKey];
|
|
26
|
+
}
|
|
27
27
|
|
|
28
28
|
// Get all the domains that are not versioned
|
|
29
29
|
const domains = await getCollection('domains', (domain) => {
|
|
@@ -12,11 +12,16 @@ interface Props {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
// Cache for build time
|
|
15
|
-
let cachedFlows: Flow[] =
|
|
15
|
+
let cachedFlows: Record<string, Flow[]> = {
|
|
16
|
+
allVersions: [],
|
|
17
|
+
currentVersions: [],
|
|
18
|
+
};
|
|
16
19
|
|
|
17
20
|
export const getFlows = async ({ getAllVersions = true }: Props = {}): Promise<Flow[]> => {
|
|
18
|
-
|
|
19
|
-
|
|
21
|
+
const cacheKey = getAllVersions ? 'allVersions' : 'currentVersions';
|
|
22
|
+
|
|
23
|
+
if (cachedFlows[cacheKey].length > 0) {
|
|
24
|
+
return cachedFlows[cacheKey];
|
|
20
25
|
}
|
|
21
26
|
|
|
22
27
|
// Get flows that are not versioned
|
|
@@ -30,7 +35,7 @@ export const getFlows = async ({ getAllVersions = true }: Props = {}): Promise<F
|
|
|
30
35
|
const allMessages = [...events, ...commands];
|
|
31
36
|
|
|
32
37
|
// @ts-ignore // TODO: Fix this type
|
|
33
|
-
cachedFlows = flows.map((flow) => {
|
|
38
|
+
cachedFlows[cacheKey] = flows.map((flow) => {
|
|
34
39
|
// @ts-ignore
|
|
35
40
|
const { latestVersion, versions } = getVersionForCollectionItem(flow, flows);
|
|
36
41
|
const steps = flow.data.steps || [];
|
|
@@ -64,5 +69,5 @@ export const getFlows = async ({ getAllVersions = true }: Props = {}): Promise<F
|
|
|
64
69
|
};
|
|
65
70
|
});
|
|
66
71
|
|
|
67
|
-
return cachedFlows;
|
|
72
|
+
return cachedFlows[cacheKey];
|
|
68
73
|
};
|
|
@@ -13,11 +13,17 @@ interface Props {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
// Cache for build time
|
|
16
|
-
let cachedServices: Service[] =
|
|
16
|
+
let cachedServices: Record<string, Service[]> = {
|
|
17
|
+
allVersions: [],
|
|
18
|
+
currentVersions: [],
|
|
19
|
+
};
|
|
17
20
|
|
|
18
21
|
export const getServices = async ({ getAllVersions = true }: Props = {}): Promise<Service[]> => {
|
|
19
|
-
|
|
20
|
-
|
|
22
|
+
const cacheKey = getAllVersions ? 'allVersions' : 'currentVersions';
|
|
23
|
+
|
|
24
|
+
// Check if we have cached domains for this specific getAllVersions value
|
|
25
|
+
if (cachedServices[cacheKey].length > 0) {
|
|
26
|
+
return cachedServices[cacheKey];
|
|
21
27
|
}
|
|
22
28
|
|
|
23
29
|
// Get services that are not versioned
|
|
@@ -31,7 +37,7 @@ export const getServices = async ({ getAllVersions = true }: Props = {}): Promis
|
|
|
31
37
|
const allMessages = [...events, ...commands, ...queries];
|
|
32
38
|
|
|
33
39
|
// @ts-ignore // TODO: Fix this type
|
|
34
|
-
cachedServices = services.map((service) => {
|
|
40
|
+
cachedServices[cacheKey] = services.map((service) => {
|
|
35
41
|
const { latestVersion, versions } = getVersionForCollectionItem(service, services);
|
|
36
42
|
|
|
37
43
|
const sendsMessages = service.data.sends || [];
|
|
@@ -73,7 +79,7 @@ export const getServices = async ({ getAllVersions = true }: Props = {}): Promis
|
|
|
73
79
|
};
|
|
74
80
|
});
|
|
75
81
|
|
|
76
|
-
return cachedServices;
|
|
82
|
+
return cachedServices[cacheKey];
|
|
77
83
|
};
|
|
78
84
|
|
|
79
85
|
export const getProducersOfMessage = (services: Service[], message: CollectionEntry<'events' | 'commands' | 'queries'>) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { CollectionTypes } from '@types';
|
|
2
2
|
import type { CollectionEntry } from 'astro:content';
|
|
3
|
-
import { coerce, satisfies as satisfiesRange } from 'semver';
|
|
3
|
+
import { coerce, satisfies as satisfiesRange, compare } from 'semver';
|
|
4
4
|
|
|
5
5
|
export const getPreviousVersion = (version: string, versions: string[]) => {
|
|
6
6
|
const index = versions.indexOf(version);
|
|
@@ -22,8 +22,17 @@ export const getVersionForCollectionItem = (
|
|
|
22
22
|
.filter((i) => i.data.id === item.data.id)
|
|
23
23
|
.map((i) => i.data.version)
|
|
24
24
|
.sort();
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
|
|
26
|
+
// unique versions
|
|
27
|
+
const versions = [...new Set(allVersionsForItem)];
|
|
28
|
+
|
|
29
|
+
// Use semver to order the versions
|
|
30
|
+
const orderedVersions = versions.sort((a, b) => {
|
|
31
|
+
return compare(b, a);
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
const latestVersion = orderedVersions[0];
|
|
35
|
+
|
|
27
36
|
return { versions, latestVersion };
|
|
28
37
|
};
|
|
29
38
|
|
|
@@ -18,11 +18,16 @@ interface Props {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
// cache for build time
|
|
21
|
-
|
|
21
|
+
let cachedCommands: Record<string, Command[]> = {
|
|
22
|
+
allVersions: [],
|
|
23
|
+
currentVersions: [],
|
|
24
|
+
};
|
|
22
25
|
|
|
23
26
|
export const getCommands = async ({ getAllVersions = true }: Props = {}): Promise<Command[]> => {
|
|
24
|
-
|
|
25
|
-
|
|
27
|
+
const cacheKey = getAllVersions ? 'allVersions' : 'currentVersions';
|
|
28
|
+
|
|
29
|
+
if (cachedCommands[cacheKey].length > 0) {
|
|
30
|
+
return cachedCommands[cacheKey];
|
|
26
31
|
}
|
|
27
32
|
|
|
28
33
|
const commands = await getCollection('commands', (command) => {
|
|
@@ -32,7 +37,7 @@ export const getCommands = async ({ getAllVersions = true }: Props = {}): Promis
|
|
|
32
37
|
const services = await getCollection('services');
|
|
33
38
|
const allChannels = await getCollection('channels');
|
|
34
39
|
|
|
35
|
-
cachedCommands = commands.map((command) => {
|
|
40
|
+
cachedCommands[cacheKey] = commands.map((command) => {
|
|
36
41
|
const { latestVersion, versions } = getVersionForCollectionItem(command, commands);
|
|
37
42
|
|
|
38
43
|
const producers = services.filter((service) => {
|
|
@@ -75,5 +80,5 @@ export const getCommands = async ({ getAllVersions = true }: Props = {}): Promis
|
|
|
75
80
|
};
|
|
76
81
|
});
|
|
77
82
|
|
|
78
|
-
return cachedCommands;
|
|
83
|
+
return cachedCommands[cacheKey];
|
|
79
84
|
};
|
|
@@ -18,11 +18,16 @@ interface Props {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
// cache for build time
|
|
21
|
-
|
|
21
|
+
let cachedEvents: Record<string, Event[]> = {
|
|
22
|
+
allVersions: [],
|
|
23
|
+
currentVersions: [],
|
|
24
|
+
};
|
|
22
25
|
|
|
23
26
|
export const getEvents = async ({ getAllVersions = true }: Props = {}): Promise<Event[]> => {
|
|
24
|
-
|
|
25
|
-
|
|
27
|
+
const cacheKey = getAllVersions ? 'allVersions' : 'currentVersions';
|
|
28
|
+
|
|
29
|
+
if (cachedEvents[cacheKey].length > 0) {
|
|
30
|
+
return cachedEvents[cacheKey];
|
|
26
31
|
}
|
|
27
32
|
|
|
28
33
|
const events = await getCollection('events', (event) => {
|
|
@@ -32,7 +37,7 @@ export const getEvents = async ({ getAllVersions = true }: Props = {}): Promise<
|
|
|
32
37
|
const services = await getCollection('services');
|
|
33
38
|
const allChannels = await getCollection('channels');
|
|
34
39
|
|
|
35
|
-
cachedEvents = events.map((event) => {
|
|
40
|
+
cachedEvents[cacheKey] = events.map((event) => {
|
|
36
41
|
const { latestVersion, versions } = getVersionForCollectionItem(event, events);
|
|
37
42
|
|
|
38
43
|
const producers = services.filter((service) =>
|
|
@@ -75,5 +80,5 @@ export const getEvents = async ({ getAllVersions = true }: Props = {}): Promise<
|
|
|
75
80
|
};
|
|
76
81
|
});
|
|
77
82
|
|
|
78
|
-
return cachedEvents;
|
|
83
|
+
return cachedEvents[cacheKey];
|
|
79
84
|
};
|
|
@@ -18,11 +18,16 @@ interface Props {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
// Cache for build time
|
|
21
|
-
let cachedQueries: Query[] =
|
|
21
|
+
let cachedQueries: Record<string, Query[]> = {
|
|
22
|
+
allVersions: [],
|
|
23
|
+
currentVersions: [],
|
|
24
|
+
};
|
|
22
25
|
|
|
23
26
|
export const getQueries = async ({ getAllVersions = true }: Props = {}): Promise<Query[]> => {
|
|
24
|
-
|
|
25
|
-
|
|
27
|
+
const cacheKey = getAllVersions ? 'allVersions' : 'currentVersions';
|
|
28
|
+
|
|
29
|
+
if (cachedQueries[cacheKey].length > 0) {
|
|
30
|
+
return cachedQueries[cacheKey];
|
|
26
31
|
}
|
|
27
32
|
|
|
28
33
|
const queries = await getCollection('queries', (query) => {
|
|
@@ -32,7 +37,7 @@ export const getQueries = async ({ getAllVersions = true }: Props = {}): Promise
|
|
|
32
37
|
const services = await getCollection('services');
|
|
33
38
|
const allChannels = await getCollection('channels');
|
|
34
39
|
|
|
35
|
-
cachedQueries = queries.map((query) => {
|
|
40
|
+
cachedQueries[cacheKey] = queries.map((query) => {
|
|
36
41
|
const { latestVersion, versions } = getVersionForCollectionItem(query, queries);
|
|
37
42
|
|
|
38
43
|
const producers = services.filter((service) =>
|
|
@@ -75,5 +80,5 @@ export const getQueries = async ({ getAllVersions = true }: Props = {}): Promise
|
|
|
75
80
|
};
|
|
76
81
|
});
|
|
77
82
|
|
|
78
|
-
return cachedQueries;
|
|
83
|
+
return cachedQueries[cacheKey];
|
|
79
84
|
};
|