@eventcatalog/core 2.19.0 → 2.19.1
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-C5RXW75W.js → chunk-BKWJZFAQ.js} +1 -1
- package/dist/{chunk-UEGAODIF.js → chunk-G3WSEVOS.js} +1 -1
- package/dist/{chunk-BKJCPC3B.js → chunk-HICY5YZU.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/pages/docs/[type]/[id]/language/[dictionaryId]/index.astro +6 -1
- package/eventcatalog/src/utils/collections/changelogs.ts +1 -1
- package/eventcatalog/src/utils/collections/util.ts +24 -21
- 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-G3WSEVOS.js";
|
|
4
|
+
import "../chunk-BKWJZFAQ.js";
|
|
5
|
+
import "../chunk-HICY5YZU.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-G3WSEVOS.js";
|
|
7
|
+
import "./chunk-BKWJZFAQ.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-HICY5YZU.js";
|
|
14
14
|
import {
|
|
15
15
|
generate
|
|
16
16
|
} from "./chunk-YEQVKHST.js";
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import RectangleGroupIcon from '@heroicons/react/24/outline/RectangleGroupIcon';
|
|
3
3
|
import Footer from '@layouts/Footer.astro';
|
|
4
4
|
import VerticalSideBarLayout from '@layouts/VerticalSideBarLayout.astro';
|
|
5
|
-
import { getDomains,
|
|
5
|
+
import { getDomains, getUbiquitousLanguage } from '@utils/collections/domains';
|
|
6
6
|
import { buildUrl } from '@utils/url-builder';
|
|
7
7
|
import { ClientRouter } from 'astro:transitions';
|
|
8
8
|
import { marked } from 'marked';
|
|
@@ -13,6 +13,11 @@ export async function getStaticPaths() {
|
|
|
13
13
|
const pages = await domains.reduce<Promise<any[]>>(async (acc, domain) => {
|
|
14
14
|
const accumulator = await acc;
|
|
15
15
|
const ubiquitousLanguages = await getUbiquitousLanguage(domain);
|
|
16
|
+
|
|
17
|
+
if (ubiquitousLanguages.length === 0) {
|
|
18
|
+
return accumulator;
|
|
19
|
+
}
|
|
20
|
+
|
|
16
21
|
const dictionary = ubiquitousLanguages[0].data.dictionary;
|
|
17
22
|
|
|
18
23
|
if (!dictionary) {
|
|
@@ -8,7 +8,7 @@ export const getChangeLogs = async (item: CollectionEntry<CollectionTypes>): Pro
|
|
|
8
8
|
|
|
9
9
|
// Get all logs for collection type and filter by given collection
|
|
10
10
|
const logs = await getCollection('changelogs', (log) => {
|
|
11
|
-
return log.id.includes(`${collection}/`) && log.
|
|
11
|
+
return log.id.includes(`${collection}/`) && log.slug.includes(slug);
|
|
12
12
|
});
|
|
13
13
|
|
|
14
14
|
const hydratedLogs = logs.map((log) => {
|
|
@@ -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
|
|
3
|
+
import { coerce, compare, satisfies as satisfiesRange } from 'semver';
|
|
4
4
|
|
|
5
5
|
export const getPreviousVersion = (version: string, versions: string[]) => {
|
|
6
6
|
const index = versions.indexOf(version);
|
|
@@ -8,22 +8,26 @@ export const getPreviousVersion = (version: string, versions: string[]) => {
|
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
export const getVersions = (data: CollectionEntry<CollectionTypes>[]) => {
|
|
11
|
-
const allVersions = data.map((item) => item.data.version)
|
|
12
|
-
const versions = [...new Set(allVersions)]
|
|
13
|
-
|
|
14
|
-
return { versions, latestVersion };
|
|
11
|
+
const allVersions = data.map((item) => item.data.version);
|
|
12
|
+
const versions = [...new Set(allVersions)];
|
|
13
|
+
return sortStringVersions(versions);
|
|
15
14
|
};
|
|
16
15
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Sorts versioned items. Latest version first.
|
|
18
|
+
*/
|
|
19
|
+
export function sortVersioned<T>(versioned: T[], versionExtractor: (e: T) => string): T[] {
|
|
20
|
+
// try to coerce semver versions from input version
|
|
21
|
+
const semverVersions = versioned.map((v) => ({ original: v, semver: coerce(versionExtractor(v)) }));
|
|
20
22
|
|
|
21
|
-
// if all versions are semver'ish, use semver to
|
|
23
|
+
// if all versions are semver'ish, use semver to sort them
|
|
22
24
|
if (semverVersions.every((v) => v.semver != null)) {
|
|
23
|
-
|
|
25
|
+
const sorted = semverVersions.sort((a, b) => compare(b.semver!, a.semver!));
|
|
26
|
+
|
|
27
|
+
return sorted.map((v) => v.original);
|
|
24
28
|
} else {
|
|
25
29
|
// fallback to default sort
|
|
26
|
-
return
|
|
30
|
+
return versioned.sort((a, b) => versionExtractor(b).localeCompare(versionExtractor(a)));
|
|
27
31
|
}
|
|
28
32
|
}
|
|
29
33
|
|
|
@@ -31,15 +35,16 @@ export const getVersionForCollectionItem = (
|
|
|
31
35
|
item: CollectionEntry<CollectionTypes>,
|
|
32
36
|
collection: CollectionEntry<CollectionTypes>[]
|
|
33
37
|
) => {
|
|
34
|
-
const allVersionsForItem = collection.filter((i) => i.data.id === item.data.id)
|
|
38
|
+
const allVersionsForItem = collection.filter((i) => i.data.id === item.data.id);
|
|
35
39
|
|
|
36
|
-
|
|
37
|
-
|
|
40
|
+
return getVersions(allVersionsForItem);
|
|
41
|
+
};
|
|
38
42
|
|
|
39
|
-
|
|
43
|
+
export function sortStringVersions(versions: string[]) {
|
|
44
|
+
const sorted = sortVersioned(versions, (v) => v);
|
|
40
45
|
|
|
41
|
-
return {
|
|
42
|
-
}
|
|
46
|
+
return { latestVersion: sorted[0], versions: sorted };
|
|
47
|
+
}
|
|
43
48
|
|
|
44
49
|
/**
|
|
45
50
|
* @param {string} version A valid version (number | v{\d+} | semver)
|
|
@@ -64,12 +69,10 @@ export const getItemsFromCollectionByIdAndSemverOrLatest = <T extends { data: {
|
|
|
64
69
|
}
|
|
65
70
|
|
|
66
71
|
// Order by version
|
|
67
|
-
const sorted = filteredCollection
|
|
68
|
-
return a.data.version.localeCompare(b.data.version);
|
|
69
|
-
});
|
|
72
|
+
const sorted = sortVersioned(filteredCollection, (item) => item.data.version);
|
|
70
73
|
|
|
71
74
|
// latest version
|
|
72
|
-
return sorted
|
|
75
|
+
return sorted[0] != null ? [sorted[0]] : [];
|
|
73
76
|
};
|
|
74
77
|
|
|
75
78
|
export const findMatchingNodes = (
|