@eventcatalog/core 2.21.0 → 2.21.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.21.0";
40
+ var version = "2.21.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-5S57Z3LK.js";
4
- import "../chunk-BPHBVY4J.js";
3
+ } from "../chunk-6UDSGYH7.js";
4
+ import "../chunk-KC3LZQXV.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.21.0";
109
+ var version = "2.21.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-7R3BVREH.js";
4
- import "../chunk-5S57Z3LK.js";
5
- import "../chunk-BPHBVY4J.js";
3
+ } from "../chunk-4CHHTLUN.js";
4
+ import "../chunk-6UDSGYH7.js";
5
+ import "../chunk-KC3LZQXV.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
  raiseEvent
3
- } from "./chunk-5S57Z3LK.js";
3
+ } from "./chunk-6UDSGYH7.js";
4
4
  import {
5
5
  getEventCatalogConfigFile,
6
6
  verifyRequiredFieldsAreInCatalogConfigFile
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VERSION
3
- } from "./chunk-BPHBVY4J.js";
3
+ } from "./chunk-KC3LZQXV.js";
4
4
 
5
5
  // src/analytics/analytics.js
6
6
  import axios from "axios";
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "2.21.0";
2
+ var version = "2.21.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.21.0";
28
+ var version = "2.21.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-BPHBVY4J.js";
3
+ } from "./chunk-KC3LZQXV.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.21.0";
164
+ var version = "2.21.1";
165
165
 
166
166
  // src/constants.ts
167
167
  var VERSION = version;
@@ -3,14 +3,14 @@ import {
3
3
  } from "./chunk-FSKZU5FH.js";
4
4
  import {
5
5
  log_build_default
6
- } from "./chunk-7R3BVREH.js";
7
- import "./chunk-5S57Z3LK.js";
6
+ } from "./chunk-4CHHTLUN.js";
7
+ import "./chunk-6UDSGYH7.js";
8
8
  import {
9
9
  catalogToAstro
10
10
  } from "./chunk-WF34R5UT.js";
11
11
  import {
12
12
  VERSION
13
- } from "./chunk-BPHBVY4J.js";
13
+ } from "./chunk-KC3LZQXV.js";
14
14
  import {
15
15
  generate
16
16
  } from "./chunk-YEQVKHST.js";
@@ -17,7 +17,7 @@
17
17
  <strong>This is a web feed,</strong> also known as an RSS feed. <strong>Subscribe</strong> by copying the URL from the address bar into your newsreader.
18
18
  </p>
19
19
  <!-- <p class="text-gray">
20
- Visit <a href="https://aboutfeeds.com">About Feeds</a> to get started with newsreaders and subscribing. Its free.
20
+ Visit <a href="https://aboutfeeds.com">About Feeds</a> to get started with newsreaders and subscribing. It's free.
21
21
  </p> -->
22
22
  </nav>
23
23
  <div class="container-md px-3 py-3 markdown-body">
@@ -50,7 +50,10 @@
50
50
  <xsl:value-of select="description"/>
51
51
  </p>
52
52
  <small class="text-gray">
53
- Published: <xsl:value-of select="pubDate" />
53
+ Last updated on: <xsl:value-of select="pubDate" />
54
+ <xsl:if test="author">
55
+ by <xsl:value-of select="author" />
56
+ </xsl:if>
54
57
  </small>
55
58
  </div>
56
59
  </xsl:for-each>
@@ -3,11 +3,12 @@ import { getCollection } from 'astro:content';
3
3
  import { statSync } from 'fs';
4
4
  import { buildUrl } from '@utils/url-builder';
5
5
  import config from '@config';
6
+ import { getGitHistory } from '@utils/git';
6
7
 
7
8
  const isRSSEnabled = config.rss?.enabled;
8
9
  const rssLimit = config.rss?.limit || 15;
9
10
 
10
- const collections = ['events', 'services', 'domains', 'commands', 'flows', 'all'];
11
+ const collections = ['events', 'services', 'domains', 'commands', 'queries', 'flows', 'all'];
11
12
 
12
13
  export function getStaticPaths() {
13
14
  return collections.map((collection) => ({
@@ -34,17 +35,32 @@ export async function GET(context) {
34
35
  items = await getCollection(collection);
35
36
  }
36
37
 
37
- // console.log(events);
38
-
39
38
  const rssItems = items
40
39
  .map((event) => {
41
40
  const pathToFile = event.data.pathToFile;
42
41
 
43
- // Get file stats to access modified date
44
- const stats = statSync(pathToFile);
42
+ let modifiedDate;
43
+ let modifiedAuthor;
44
+
45
+ try {
46
+ const gitHistory = getGitHistory(pathToFile, {
47
+ includeAuthor: true,
48
+ age: 'newest',
49
+ });
50
+
51
+ modifiedDate = gitHistory.date;
52
+ modifiedAuthor = gitHistory.author;
53
+ } catch (error) {
54
+ // Failed to get git history, use the file stats
55
+ const stats = statSync(pathToFile);
56
+ modifiedDate = stats.mtime;
57
+ modifiedAuthor = undefined;
58
+ }
59
+
45
60
  return {
46
61
  ...event,
47
- modifiedDate: stats.mtime,
62
+ modifiedDate: modifiedDate,
63
+ modifiedAuthor: modifiedAuthor,
48
64
  };
49
65
  })
50
66
  .sort((a, b) => b.modifiedDate - a.modifiedDate) // Sort in descending order (newest first)
@@ -71,6 +87,7 @@ export async function GET(context) {
71
87
  description: event.data.summary,
72
88
  // Optional: Include modified date in the RSS feed
73
89
  lastBuildDate: items.find((item) => item.id === event.id)?.modifiedDate,
90
+ author: event.modifiedAuthor,
74
91
  // categories: event.data.badges,
75
92
  })),
76
93
  // (optional) inject custom xml
@@ -0,0 +1,58 @@
1
+ import shell from 'shelljs';
2
+
3
+ export function hasGit() {
4
+ return !!shell.which('git');
5
+ }
6
+
7
+ export function getGitHistory(
8
+ filePath: string,
9
+ {
10
+ includeAuthor = true,
11
+ age = 'newest',
12
+ }: {
13
+ includeAuthor?: boolean;
14
+ age?: 'newest' | 'oldest';
15
+ maxCount?: number;
16
+ }
17
+ ): {
18
+ timestamp: number;
19
+ date: Date;
20
+ author: string | undefined;
21
+ } {
22
+ if (!hasGit()) {
23
+ throw new Error('Git is not installed');
24
+ }
25
+
26
+ const resultFormat = includeAuthor ? 'RESULT:%ct,%an' : 'RESULT:%ct';
27
+
28
+ const args = [`--format=${resultFormat}`, '--max-count=1', age === 'oldest' ? '--follow --diff-filter=A' : undefined]
29
+ .filter(Boolean)
30
+ .join(' ');
31
+
32
+ const command = `git -c log.showSignature=false log ${args} -- "${filePath}"`;
33
+
34
+ const result = shell.exec(command, { silent: true });
35
+
36
+ const regex = includeAuthor
37
+ ? /(?:^|\n)RESULT:(?<timestamp>\d+),(?<author>.+)(?:$|\n)/
38
+ : /(?:^|\n)RESULT:(?<timestamp>\d+)(?:$|\n)/;
39
+
40
+ const output = result.stdout.trim();
41
+
42
+ const match = output.match(regex);
43
+
44
+ if (!match) {
45
+ throw new Error(`Failed to retrieve the git history for file "${filePath}" with unexpected output: ${output}`);
46
+ }
47
+
48
+ const timestampInSeconds = Number(match.groups?.timestamp);
49
+ const timestamp = timestampInSeconds * 1_000;
50
+ const date = new Date(timestamp);
51
+ const author = match.groups?.author;
52
+
53
+ return {
54
+ timestamp,
55
+ date,
56
+ author,
57
+ };
58
+ }
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.21.0",
9
+ "version": "2.21.1",
10
10
  "publishConfig": {
11
11
  "access": "public"
12
12
  },
@@ -67,6 +67,7 @@
67
67
  "remark-gfm": "^3.0.1",
68
68
  "rimraf": "^5.0.7",
69
69
  "semver": "7.6.3",
70
+ "shelljs": "^0.8.5",
70
71
  "tailwindcss": "^3.4.3",
71
72
  "typescript": "^5.4.5",
72
73
  "unist-util-visit": "^5.0.0",
@@ -85,6 +86,7 @@
85
86
  "@types/react": "^18.3.3",
86
87
  "@types/react-dom": "^18.3.0",
87
88
  "@types/semver": "^7.5.8",
89
+ "@types/shelljs": "^0.8.15",
88
90
  "prettier": "^3.3.3",
89
91
  "prettier-plugin-astro": "^0.14.1",
90
92
  "tsup": "^8.1.0",