@eventcatalog/core 4.7.12 → 4.8.0
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-H6NJQGDB.js → chunk-EDMVOV4H.js} +1 -1
- package/dist/{chunk-GU5QRUIL.js → chunk-JCJYBRLL.js} +1 -1
- package/dist/{chunk-ITXVGX5B.js → chunk-OGZMUG75.js} +1 -1
- package/dist/{chunk-MEP55EFY.js → chunk-TRDXMFBW.js} +1 -1
- package/dist/{chunk-BZAT6KWG.js → chunk-XDKU675D.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 +5 -5
- package/dist/generate.cjs +1 -1
- package/dist/generate.js +3 -3
- package/dist/utils/cli-logger.cjs +1 -1
- package/dist/utils/cli-logger.js +2 -2
- package/eventcatalog/src/components/MDX/Flow/Flow.astro +3 -3
- package/eventcatalog/src/utils/collections/services.ts +0 -1
- package/eventcatalog/src/utils/collections/util.ts +15 -26
- package/eventcatalog/src/utils/collections/version-compare.ts +35 -6
- package/eventcatalog/src/utils/collections/versions.ts +2 -22
- package/package.json +3 -3
|
@@ -140,7 +140,7 @@ var verifyRequiredFieldsAreInCatalogConfigFile = async (projectDirectory) => {
|
|
|
140
140
|
var import_os = __toESM(require("os"), 1);
|
|
141
141
|
|
|
142
142
|
// package.json
|
|
143
|
-
var version = "4.
|
|
143
|
+
var version = "4.8.0";
|
|
144
144
|
|
|
145
145
|
// src/constants.ts
|
|
146
146
|
var VERSION = version;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
log_build_default
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-TRDXMFBW.js";
|
|
4
|
+
import "../chunk-EDMVOV4H.js";
|
|
5
5
|
import "../chunk-K2XIENVT.js";
|
|
6
|
-
import "../chunk-
|
|
6
|
+
import "../chunk-XDKU675D.js";
|
|
7
7
|
import "../chunk-6QENHZZP.js";
|
|
8
8
|
export {
|
|
9
9
|
log_build_default as default
|
package/dist/constants.cjs
CHANGED
package/dist/constants.js
CHANGED
package/dist/eventcatalog.cjs
CHANGED
|
@@ -144,7 +144,7 @@ var verifyRequiredFieldsAreInCatalogConfigFile = async (projectDirectory) => {
|
|
|
144
144
|
var import_picocolors = __toESM(require("picocolors"), 1);
|
|
145
145
|
|
|
146
146
|
// package.json
|
|
147
|
-
var version = "4.
|
|
147
|
+
var version = "4.8.0";
|
|
148
148
|
|
|
149
149
|
// src/constants.ts
|
|
150
150
|
var VERSION = version;
|
package/dist/eventcatalog.js
CHANGED
|
@@ -4,8 +4,8 @@ import {
|
|
|
4
4
|
import "./chunk-CA4U2JP7.js";
|
|
5
5
|
import {
|
|
6
6
|
log_build_default
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-TRDXMFBW.js";
|
|
8
|
+
import "./chunk-EDMVOV4H.js";
|
|
9
9
|
import "./chunk-K2XIENVT.js";
|
|
10
10
|
import {
|
|
11
11
|
FederationConflictError,
|
|
@@ -31,10 +31,10 @@ import {
|
|
|
31
31
|
} from "./chunk-B7HCX5HM.js";
|
|
32
32
|
import {
|
|
33
33
|
generate
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-JCJYBRLL.js";
|
|
35
35
|
import {
|
|
36
36
|
logger
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-OGZMUG75.js";
|
|
38
38
|
import {
|
|
39
39
|
resolve_catalog_dependencies_default
|
|
40
40
|
} from "./chunk-LHR4G2UO.js";
|
|
@@ -54,7 +54,7 @@ import {
|
|
|
54
54
|
import "./chunk-W5JQON7Z.js";
|
|
55
55
|
import {
|
|
56
56
|
VERSION
|
|
57
|
-
} from "./chunk-
|
|
57
|
+
} from "./chunk-XDKU675D.js";
|
|
58
58
|
import {
|
|
59
59
|
linkCoreNodeModules,
|
|
60
60
|
resolveInstalledCoreNodeModules
|
package/dist/generate.cjs
CHANGED
|
@@ -108,7 +108,7 @@ var getEventCatalogConfigFile = async (projectDirectory) => {
|
|
|
108
108
|
var import_picocolors = __toESM(require("picocolors"), 1);
|
|
109
109
|
|
|
110
110
|
// package.json
|
|
111
|
-
var version = "4.
|
|
111
|
+
var version = "4.8.0";
|
|
112
112
|
|
|
113
113
|
// src/constants.ts
|
|
114
114
|
var VERSION = version;
|
package/dist/generate.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
generate
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-JCJYBRLL.js";
|
|
4
|
+
import "./chunk-OGZMUG75.js";
|
|
5
|
+
import "./chunk-XDKU675D.js";
|
|
6
6
|
import "./chunk-6QENHZZP.js";
|
|
7
7
|
export {
|
|
8
8
|
generate
|
package/dist/utils/cli-logger.js
CHANGED
|
@@ -25,15 +25,15 @@ const flow = flowCollection[0];
|
|
|
25
25
|
|
|
26
26
|
const { nodes, edges } = await getNodesAndEdges({
|
|
27
27
|
id: id,
|
|
28
|
-
version: flow
|
|
28
|
+
version: flow?.data.version,
|
|
29
29
|
mode: mode,
|
|
30
30
|
});
|
|
31
31
|
|
|
32
32
|
// Load and apply saved layout if it exists
|
|
33
|
-
const resourceKey = buildResourceKey('flows', id, flow
|
|
33
|
+
const resourceKey = buildResourceKey('flows', id, flow?.data.version);
|
|
34
34
|
const savedLayout = await loadSavedLayout(resourceKey);
|
|
35
35
|
const nodesWithLayout = applyLayoutToNodes(nodes, savedLayout);
|
|
36
|
-
const portalId = `${id}-${flow
|
|
36
|
+
const portalId = `${id}-${flow?.data.version}-flow-${randomUUID()}-portal`;
|
|
37
37
|
---
|
|
38
38
|
|
|
39
39
|
{
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { getCollection } from 'astro:content';
|
|
2
2
|
import type { CollectionEntry } from 'astro:content';
|
|
3
|
-
import semver from 'semver';
|
|
4
3
|
import type { CollectionMessageTypes, CollectionTypes } from '@types';
|
|
5
4
|
import { getDomains, getDomainsForService } from './domains';
|
|
6
5
|
import {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { CollectionTypes } from '@types';
|
|
2
2
|
import type { CollectionEntry } from 'astro:content';
|
|
3
|
-
import semver, { coerce, compare, satisfies as satisfiesRange } from 'semver';
|
|
4
3
|
import path from 'node:path';
|
|
4
|
+
import { compareVersions, toComparableVersion, versionSatisfiesRange } from './version-compare';
|
|
5
5
|
|
|
6
6
|
// --- FILE PATH HELPERS ---
|
|
7
7
|
|
|
@@ -95,12 +95,11 @@ export { isSameVersion } from './version-compare';
|
|
|
95
95
|
* Sorts versioned items. Latest version first.
|
|
96
96
|
*/
|
|
97
97
|
export function sortVersioned<T>(versioned: T[], versionExtractor: (e: T) => string): T[] {
|
|
98
|
-
|
|
99
|
-
const semverVersions = versioned.map((v) => ({ original: v, semver: coerce(versionExtractor(v)) }));
|
|
98
|
+
const versions = versioned.map((original) => ({ original, version: versionExtractor(original) }));
|
|
100
99
|
|
|
101
100
|
// if all versions are semver'ish, use semver to sort them
|
|
102
|
-
if (
|
|
103
|
-
const sorted =
|
|
101
|
+
if (versions.every(({ version }) => toComparableVersion(version) !== undefined)) {
|
|
102
|
+
const sorted = versions.sort((a, b) => compareVersions(b.version, a.version)!);
|
|
104
103
|
|
|
105
104
|
return sorted.map((v) => v.original);
|
|
106
105
|
} else {
|
|
@@ -137,9 +136,8 @@ export function sortStringVersions(versions: string[]) {
|
|
|
137
136
|
* @returns {boolean} Returns true if the version satisfies the range.
|
|
138
137
|
*/
|
|
139
138
|
export const satisfies = (version: string, range: string): boolean => {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
return satisfiesRange(coercedVersion, range);
|
|
139
|
+
if (version === range) return true;
|
|
140
|
+
return versionSatisfiesRange(version, range);
|
|
143
141
|
};
|
|
144
142
|
|
|
145
143
|
export const getItemsFromCollectionByIdAndSemverOrLatest = <T extends { data: { id: string; version: string } }>(
|
|
@@ -150,6 +148,9 @@ export const getItemsFromCollectionByIdAndSemverOrLatest = <T extends { data: {
|
|
|
150
148
|
const filteredCollection = collection.filter((c) => c.data.id == id);
|
|
151
149
|
|
|
152
150
|
if (version && version != 'latest') {
|
|
151
|
+
const exactMatches = filteredCollection.filter((item) => item.data.version === version);
|
|
152
|
+
if (exactMatches.length > 0) return exactMatches;
|
|
153
|
+
|
|
153
154
|
return filteredCollection.filter((c) => satisfies(c.data.version, version));
|
|
154
155
|
}
|
|
155
156
|
|
|
@@ -282,12 +283,10 @@ export const createVersionedMap = <T extends { data: { id: string; version?: str
|
|
|
282
283
|
|
|
283
284
|
// Sort every entry so index [0] is always the latest version
|
|
284
285
|
for (const [key, list] of map.entries()) {
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
return semver.valid(vB) && semver.valid(vA) ? semver.rcompare(vA, vB) : vB.localeCompare(vA);
|
|
290
|
-
});
|
|
286
|
+
map.set(
|
|
287
|
+
key,
|
|
288
|
+
sortVersioned(list, (item) => item.data.version || '0.0.0')
|
|
289
|
+
);
|
|
291
290
|
}
|
|
292
291
|
return map;
|
|
293
292
|
};
|
|
@@ -319,11 +318,7 @@ export const findInMap = <T extends { data: { version?: string } }>(
|
|
|
319
318
|
if (exactMatch) return exactMatch;
|
|
320
319
|
|
|
321
320
|
// Try semver match if not exact
|
|
322
|
-
|
|
323
|
-
return items.find((i) => semver.satisfies(i.data.version || '0.0.0', version));
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
return undefined;
|
|
321
|
+
return items.find((i) => satisfies(i.data.version || '0.0.0', version));
|
|
327
322
|
};
|
|
328
323
|
|
|
329
324
|
/**
|
|
@@ -342,13 +337,7 @@ export const versionMatches = (version: string, rangePattern: string): boolean =
|
|
|
342
337
|
if (version === rangePattern) return true;
|
|
343
338
|
|
|
344
339
|
// Try semver range matching
|
|
345
|
-
|
|
346
|
-
if (semver.validRange(rangePattern)) {
|
|
347
|
-
return semver.satisfies(version, rangePattern);
|
|
348
|
-
}
|
|
349
|
-
} catch (error) {
|
|
350
|
-
// Invalid semver, fall through
|
|
351
|
-
}
|
|
340
|
+
if (satisfies(version, rangePattern)) return true;
|
|
352
341
|
|
|
353
342
|
// Handle x-patterns like 1.x, 1.2.x
|
|
354
343
|
if (rangePattern.includes('.x')) {
|
|
@@ -1,12 +1,41 @@
|
|
|
1
|
-
import { coerce,
|
|
1
|
+
import { coerce, compare, satisfies, valid, validRange } from 'semver';
|
|
2
|
+
|
|
3
|
+
// Keep in sync with packages/sdk/src/internal/versions.ts
|
|
4
|
+
const NUMERIC_VERSION_PATTERN = /^[vV]?\d+(?:\.\d+){0,2}$/;
|
|
5
|
+
|
|
6
|
+
export function toComparableVersion(version: string | undefined) {
|
|
7
|
+
if (!version) return undefined;
|
|
8
|
+
|
|
9
|
+
const strictVersion = valid(version);
|
|
10
|
+
if (strictVersion) return strictVersion;
|
|
11
|
+
|
|
12
|
+
if (!NUMERIC_VERSION_PATTERN.test(version)) return undefined;
|
|
13
|
+
|
|
14
|
+
return coerce(version) ?? undefined;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function compareVersions(v1: string | undefined, v2: string | undefined): number | undefined {
|
|
18
|
+
const semverV1 = toComparableVersion(v1);
|
|
19
|
+
const semverV2 = toComparableVersion(v2);
|
|
20
|
+
|
|
21
|
+
if (!semverV1 || !semverV2) return undefined;
|
|
22
|
+
|
|
23
|
+
return compare(semverV1, semverV2);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function versionSatisfiesRange(version: string, range: string) {
|
|
27
|
+
const comparableVersion = toComparableVersion(version);
|
|
28
|
+
const comparableRange = validRange(range) ?? validRange(range.replace(/V(?=\d)/g, 'v'));
|
|
29
|
+
|
|
30
|
+
if (!comparableVersion || !comparableRange) return false;
|
|
31
|
+
|
|
32
|
+
return satisfies(comparableVersion, comparableRange);
|
|
33
|
+
}
|
|
2
34
|
|
|
3
35
|
export function isSameVersion(v1: string | undefined, v2: string | undefined) {
|
|
4
|
-
const
|
|
5
|
-
const semverV2 = coerce(v2);
|
|
36
|
+
const comparison = compareVersions(v1, v2);
|
|
6
37
|
|
|
7
|
-
if (
|
|
8
|
-
return eq(semverV1, semverV2);
|
|
9
|
-
}
|
|
38
|
+
if (comparison !== undefined) return comparison === 0;
|
|
10
39
|
|
|
11
40
|
return v1 === v2;
|
|
12
41
|
}
|
|
@@ -1,31 +1,11 @@
|
|
|
1
1
|
import type { CollectionTypes } from '@types';
|
|
2
2
|
import type { CollectionEntry } from 'astro:content';
|
|
3
|
-
import {
|
|
3
|
+
import { getItemsFromCollectionByIdAndSemverOrLatest } from './util';
|
|
4
4
|
|
|
5
5
|
export const getVersionFromCollection = (
|
|
6
6
|
collection: CollectionEntry<CollectionTypes>[],
|
|
7
7
|
id: string,
|
|
8
8
|
version?: string
|
|
9
9
|
): CollectionEntry<CollectionTypes>[] => {
|
|
10
|
-
|
|
11
|
-
const semverRange = validRange(version);
|
|
12
|
-
|
|
13
|
-
if (semverRange) {
|
|
14
|
-
return data.filter((msg) => msg.data.id == id).filter((msg) => satisfies(msg.data.version, semverRange));
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const filteredEvents = data.filter((event) => event.data.id === id);
|
|
18
|
-
|
|
19
|
-
// Order by semver
|
|
20
|
-
const sorted = filteredEvents.sort((a, b) => {
|
|
21
|
-
const semverA = coerce(a.data.version);
|
|
22
|
-
const semverB = coerce(b.data.version);
|
|
23
|
-
if (semverA && semverB) {
|
|
24
|
-
return compare(semverA, semverB);
|
|
25
|
-
}
|
|
26
|
-
return a.data.version.localeCompare(b.data.version);
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
// latest version
|
|
30
|
-
return [sorted[sorted.length - 1]];
|
|
10
|
+
return getItemsFromCollectionByIdAndSemverOrLatest(collection, id, version);
|
|
31
11
|
};
|
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
},
|
|
8
8
|
"license": "SEE LICENSE IN LICENSE",
|
|
9
9
|
"type": "module",
|
|
10
|
-
"version": "4.
|
|
10
|
+
"version": "4.8.0",
|
|
11
11
|
"publishConfig": {
|
|
12
12
|
"access": "public"
|
|
13
13
|
},
|
|
@@ -119,8 +119,8 @@
|
|
|
119
119
|
"update-notifier": "^7.3.1",
|
|
120
120
|
"uuid": "^11.1.1",
|
|
121
121
|
"zod": "^4.3.6",
|
|
122
|
-
"@eventcatalog/
|
|
123
|
-
"@eventcatalog/
|
|
122
|
+
"@eventcatalog/sdk": "2.28.0",
|
|
123
|
+
"@eventcatalog/linter": "1.1.15",
|
|
124
124
|
"@eventcatalog/visualiser": "^4.1.3"
|
|
125
125
|
},
|
|
126
126
|
"devDependencies": {
|