@eventcatalog/core 2.65.0-beta.2 → 2.65.0-beta.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.
@@ -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.65.0-beta.2";
40
+ var version = "2.65.0-beta.4";
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-HH3PA5HC.js";
4
- import "../chunk-TXHHRRSK.js";
3
+ } from "../chunk-Q2QEOUZY.js";
4
+ import "../chunk-EXJB4PZB.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.65.0-beta.2";
109
+ var version = "2.65.0-beta.4";
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-BY4A6ISY.js";
4
- import "../chunk-HH3PA5HC.js";
5
- import "../chunk-TXHHRRSK.js";
3
+ } from "../chunk-SDRVO5WD.js";
4
+ import "../chunk-Q2QEOUZY.js";
5
+ import "../chunk-EXJB4PZB.js";
6
6
  import "../chunk-UPONRQSN.js";
7
7
  export {
8
8
  log_build_default as default
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "2.65.0-beta.2";
2
+ var version = "2.65.0-beta.4";
3
3
 
4
4
  // src/constants.ts
5
5
  var VERSION = version;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VERSION
3
- } from "./chunk-TXHHRRSK.js";
3
+ } from "./chunk-EXJB4PZB.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-HH3PA5HC.js";
3
+ } from "./chunk-Q2QEOUZY.js";
4
4
  import {
5
5
  getEventCatalogConfigFile,
6
6
  verifyRequiredFieldsAreInCatalogConfigFile
@@ -25,7 +25,7 @@ __export(constants_exports, {
25
25
  module.exports = __toCommonJS(constants_exports);
26
26
 
27
27
  // package.json
28
- var version = "2.65.0-beta.2";
28
+ var version = "2.65.0-beta.4";
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-TXHHRRSK.js";
3
+ } from "./chunk-EXJB4PZB.js";
4
4
  export {
5
5
  VERSION
6
6
  };
@@ -157,7 +157,7 @@ var import_axios = __toESM(require("axios"), 1);
157
157
  var import_os = __toESM(require("os"), 1);
158
158
 
159
159
  // package.json
160
- var version = "2.65.0-beta.2";
160
+ var version = "2.65.0-beta.4";
161
161
 
162
162
  // src/constants.ts
163
163
  var VERSION = version;
@@ -6,8 +6,8 @@ import {
6
6
  } from "./chunk-PLNJC7NZ.js";
7
7
  import {
8
8
  log_build_default
9
- } from "./chunk-BY4A6ISY.js";
10
- import "./chunk-HH3PA5HC.js";
9
+ } from "./chunk-SDRVO5WD.js";
10
+ import "./chunk-Q2QEOUZY.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-TXHHRRSK.js";
22
+ } from "./chunk-EXJB4PZB.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
- return messages
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
- .map((message) => ({
16
- params: { collection: message.collection, id: message.data.id, version: message.data.version },
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(message.filePath ?? ''), message.data.schemaPath ?? ''),
19
- schema: fs.readFileSync(path.join(path.dirname(message.filePath ?? ''), message.data.schemaPath ?? ''), 'utf8'),
20
- extension: message.data.schemaPath?.split('.').pop(),
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.2",
9
+ "version": "2.65.0-beta.4",
10
10
  "publishConfig": {
11
11
  "access": "public"
12
12
  },
@@ -31,9 +31,9 @@
31
31
  "@astrojs/react": "^4.4.2",
32
32
  "@astrojs/rss": "^4.0.14",
33
33
  "@astrojs/tailwind": "^6.0.2",
34
- "@asyncapi/avro-schema-parser": "^3.0.24",
35
- "@asyncapi/parser": "^3.4.0",
36
- "@asyncapi/react-component": "^2.4.3",
34
+ "@asyncapi/avro-schema-parser": "3.0.24",
35
+ "@asyncapi/parser": "3.4.0",
36
+ "@asyncapi/react-component": "2.4.3",
37
37
  "@auth/core": "^0.37.4",
38
38
  "@eventcatalog/generator-ai": "^1.1.0",
39
39
  "@eventcatalog/license": "^0.0.7",
@@ -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.4.1",
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",