@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.
@@ -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.19.0";
40
+ var version = "2.19.1";
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-C5RXW75W.js";
4
- import "../chunk-BKJCPC3B.js";
3
+ } from "../chunk-BKWJZFAQ.js";
4
+ import "../chunk-HICY5YZU.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.19.0";
109
+ var version = "2.19.1";
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-UEGAODIF.js";
4
- import "../chunk-C5RXW75W.js";
5
- import "../chunk-BKJCPC3B.js";
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
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VERSION
3
- } from "./chunk-BKJCPC3B.js";
3
+ } from "./chunk-HICY5YZU.js";
4
4
 
5
5
  // src/analytics/analytics.js
6
6
  import axios from "axios";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  raiseEvent
3
- } from "./chunk-C5RXW75W.js";
3
+ } from "./chunk-BKWJZFAQ.js";
4
4
  import {
5
5
  getEventCatalogConfigFile,
6
6
  verifyRequiredFieldsAreInCatalogConfigFile
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "2.19.0";
2
+ var version = "2.19.1";
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.19.0";
28
+ var version = "2.19.1";
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-BKJCPC3B.js";
3
+ } from "./chunk-HICY5YZU.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.19.0";
164
+ var version = "2.19.1";
165
165
 
166
166
  // src/constants.ts
167
167
  var VERSION = version;
@@ -3,14 +3,14 @@ import {
3
3
  } from "./chunk-SHCMAL37.js";
4
4
  import {
5
5
  log_build_default
6
- } from "./chunk-UEGAODIF.js";
7
- import "./chunk-C5RXW75W.js";
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-BKJCPC3B.js";
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, type Domain, getUbiquitousLanguage } from '@utils/collections/domains';
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.id.includes(slug);
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, compare } from 'semver';
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).sort();
12
- const versions = [...new Set(allVersions)].reverse();
13
- const latestVersion = versions[0];
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
- export function findLatestVersion(versions: string[]) {
18
- // try to coerce semver versions from string input
19
- const semverVersions = versions.map((v) => ({ original: v, semver: coerce(v) }));
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 order the versions
23
+ // if all versions are semver'ish, use semver to sort them
22
24
  if (semverVersions.every((v) => v.semver != null)) {
23
- return semverVersions.sort((a, b) => compare(b.semver!, a.semver!))[0].original;
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 versions.sort().reverse()[0];
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).map((i) => i.data.version);
38
+ const allVersionsForItem = collection.filter((i) => i.data.id === item.data.id);
35
39
 
36
- // unique versions
37
- const versions = [...new Set(allVersionsForItem)];
40
+ return getVersions(allVersionsForItem);
41
+ };
38
42
 
39
- let latestVersion = findLatestVersion(versions);
43
+ export function sortStringVersions(versions: string[]) {
44
+ const sorted = sortVersioned(versions, (v) => v);
40
45
 
41
- return { versions, latestVersion };
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.sort((a, b) => {
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.length > 0 ? [sorted[sorted.length - 1]] : [];
75
+ return sorted[0] != null ? [sorted[0]] : [];
73
76
  };
74
77
 
75
78
  export const findMatchingNodes = (
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.19.0",
9
+ "version": "2.19.1",
10
10
  "publishConfig": {
11
11
  "access": "public"
12
12
  },