@eventcatalog/core 2.65.0-beta.2 → 2.65.0-beta.3
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-TXHHRRSK.js → chunk-76KMPQRC.js} +1 -1
- package/dist/{chunk-BY4A6ISY.js → chunk-V2GM5B5L.js} +1 -1
- package/dist/{chunk-HH3PA5HC.js → chunk-Z5H2XGTS.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/api/schemas/[collection]/[id]/[version]/index.ts +45 -8
- package/package.json +2 -2
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
log_build_default
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
5
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-V2GM5B5L.js";
|
|
4
|
+
import "../chunk-Z5H2XGTS.js";
|
|
5
|
+
import "../chunk-76KMPQRC.js";
|
|
6
6
|
import "../chunk-UPONRQSN.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
|
@@ -6,8 +6,8 @@ import {
|
|
|
6
6
|
} from "./chunk-PLNJC7NZ.js";
|
|
7
7
|
import {
|
|
8
8
|
log_build_default
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-V2GM5B5L.js";
|
|
10
|
+
import "./chunk-Z5H2XGTS.js";
|
|
11
11
|
import {
|
|
12
12
|
runMigrations
|
|
13
13
|
} from "./chunk-BH3JMNAV.js";
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
import "./chunk-55D645EH.js";
|
|
20
20
|
import {
|
|
21
21
|
VERSION
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-76KMPQRC.js";
|
|
23
23
|
import {
|
|
24
24
|
getProjectOutDir,
|
|
25
25
|
isAuthEnabled,
|
|
@@ -3,23 +3,60 @@ import { getCollection } from 'astro:content';
|
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
import fs from 'node:fs';
|
|
5
5
|
import { isEventCatalogScaleEnabled } from '@utils/feature';
|
|
6
|
+
import { sortVersioned } from '@utils/collections/util';
|
|
6
7
|
|
|
7
8
|
export async function getStaticPaths() {
|
|
8
9
|
const events = await getCollection('events');
|
|
9
10
|
const commands = await getCollection('commands');
|
|
10
11
|
const queries = await getCollection('queries');
|
|
11
12
|
const messages = [...events, ...commands, ...queries];
|
|
12
|
-
|
|
13
|
+
|
|
14
|
+
const messagesWithSchemas = messages
|
|
13
15
|
.filter((message) => message.data.schemaPath)
|
|
14
|
-
.filter((message) => fs.existsSync(path.join(path.dirname(message.filePath ?? ''), message.data.schemaPath ?? '')))
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
.filter((message) => fs.existsSync(path.join(path.dirname(message.filePath ?? ''), message.data.schemaPath ?? '')));
|
|
17
|
+
|
|
18
|
+
// Generate paths for specific versions
|
|
19
|
+
const versionedPaths = messagesWithSchemas.map((message) => ({
|
|
20
|
+
params: { collection: message.collection, id: message.data.id, version: message.data.version },
|
|
21
|
+
props: {
|
|
22
|
+
pathToSchema: path.join(path.dirname(message.filePath ?? ''), message.data.schemaPath ?? ''),
|
|
23
|
+
schema: fs.readFileSync(path.join(path.dirname(message.filePath ?? ''), message.data.schemaPath ?? ''), 'utf8'),
|
|
24
|
+
extension: message.data.schemaPath?.split('.').pop(),
|
|
25
|
+
},
|
|
26
|
+
}));
|
|
27
|
+
|
|
28
|
+
// Group messages by collection and id to find latest versions
|
|
29
|
+
const groupedMessages = messagesWithSchemas.reduce(
|
|
30
|
+
(acc, message) => {
|
|
31
|
+
const key = `${message.collection}:${message.data.id}`;
|
|
32
|
+
if (!acc[key]) {
|
|
33
|
+
acc[key] = [];
|
|
34
|
+
}
|
|
35
|
+
acc[key].push(message);
|
|
36
|
+
return acc;
|
|
37
|
+
},
|
|
38
|
+
{} as Record<string, typeof messagesWithSchemas>
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
// Generate "latest" paths for each unique collection/id combination
|
|
42
|
+
const latestPaths = Object.values(groupedMessages).map((group) => {
|
|
43
|
+
// Sort by version (descending) and get the latest
|
|
44
|
+
const sorted = sortVersioned(group, (m) => m.data.version);
|
|
45
|
+
const latestMessage = sorted[0];
|
|
46
|
+
return {
|
|
47
|
+
params: { collection: latestMessage.collection, id: latestMessage.data.id, version: 'latest' },
|
|
17
48
|
props: {
|
|
18
|
-
pathToSchema: path.join(path.dirname(
|
|
19
|
-
schema: fs.readFileSync(
|
|
20
|
-
|
|
49
|
+
pathToSchema: path.join(path.dirname(latestMessage.filePath ?? ''), latestMessage.data.schemaPath ?? ''),
|
|
50
|
+
schema: fs.readFileSync(
|
|
51
|
+
path.join(path.dirname(latestMessage.filePath ?? ''), latestMessage.data.schemaPath ?? ''),
|
|
52
|
+
'utf8'
|
|
53
|
+
),
|
|
54
|
+
extension: latestMessage.data.schemaPath?.split('.').pop(),
|
|
21
55
|
},
|
|
22
|
-
}
|
|
56
|
+
};
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
return [...versionedPaths, ...latestPaths];
|
|
23
60
|
}
|
|
24
61
|
|
|
25
62
|
export const GET: APIRoute = async ({ props }) => {
|
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.65.0-beta.
|
|
9
|
+
"version": "2.65.0-beta.3",
|
|
10
10
|
"publishConfig": {
|
|
11
11
|
"access": "public"
|
|
12
12
|
},
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"diff2html": "^3.4.48",
|
|
73
73
|
"dotenv": "^16.5.0",
|
|
74
74
|
"elkjs": "^0.10.0",
|
|
75
|
-
"glob": "^10.
|
|
75
|
+
"glob": "^10.5.0",
|
|
76
76
|
"gray-matter": "^4.0.3",
|
|
77
77
|
"html-to-image": "^1.11.11",
|
|
78
78
|
"js-yaml": "^4.1.0",
|