@eventcatalog/core 4.12.1 → 4.12.2
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-UWSBZYF5.js → chunk-GTIC4R74.js} +3 -3
- package/dist/{chunk-EVXNBTRA.js → chunk-IVVM67LN.js} +1 -1
- package/dist/{chunk-DZZDBFUM.js → chunk-RPVA2SZY.js} +1 -1
- package/dist/{chunk-HHZFKWX7.js → chunk-WK4J6FP3.js} +1 -1
- package/dist/{chunk-HH6GPY4H.js → chunk-ZW3MYAWF.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 +13 -13
- package/dist/federation/federate.js +4 -4
- 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/utils/git.ts +88 -28
- package/package.json +1 -1
- package/dist/{chunk-WRLNLWPW.js → chunk-U4YJSTGV.js} +7 -7
|
@@ -176,7 +176,7 @@ var verifyRequiredFieldsAreInCatalogConfigFile = async (projectDirectory) => {
|
|
|
176
176
|
var import_os = __toESM(require("os"), 1);
|
|
177
177
|
|
|
178
178
|
// package.json
|
|
179
|
-
var version = "4.12.
|
|
179
|
+
var version = "4.12.2";
|
|
180
180
|
|
|
181
181
|
// src/constants.ts
|
|
182
182
|
var VERSION = version;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
log_build_default
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-HH6GPY4H.js";
|
|
3
|
+
} from "../chunk-GTIC4R74.js";
|
|
5
4
|
import "../chunk-ZAZHAVKB.js";
|
|
6
|
-
import "../chunk-
|
|
5
|
+
import "../chunk-ZW3MYAWF.js";
|
|
6
|
+
import "../chunk-WK4J6FP3.js";
|
|
7
7
|
import "../chunk-RFIXKATC.js";
|
|
8
8
|
export {
|
|
9
9
|
log_build_default as default
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
raiseEvent
|
|
3
|
-
} from "./chunk-HH6GPY4H.js";
|
|
4
1
|
import {
|
|
5
2
|
countResources,
|
|
6
3
|
hashCatalogContent,
|
|
7
4
|
serializeCounts
|
|
8
5
|
} from "./chunk-ZAZHAVKB.js";
|
|
6
|
+
import {
|
|
7
|
+
raiseEvent
|
|
8
|
+
} from "./chunk-ZW3MYAWF.js";
|
|
9
9
|
import {
|
|
10
10
|
getEventCatalogConfigFile,
|
|
11
11
|
verifyRequiredFieldsAreInCatalogConfigFile
|
package/dist/constants.cjs
CHANGED
package/dist/constants.js
CHANGED
package/dist/eventcatalog.cjs
CHANGED
|
@@ -181,7 +181,7 @@ var verifyRequiredFieldsAreInCatalogConfigFile = async (projectDirectory) => {
|
|
|
181
181
|
var import_picocolors = __toESM(require("picocolors"), 1);
|
|
182
182
|
|
|
183
183
|
// package.json
|
|
184
|
-
var version = "4.12.
|
|
184
|
+
var version = "4.12.2";
|
|
185
185
|
|
|
186
186
|
// src/constants.ts
|
|
187
187
|
var VERSION = version;
|
package/dist/eventcatalog.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
log_build_default
|
|
3
|
-
} from "./chunk-UWSBZYF5.js";
|
|
4
|
-
import "./chunk-HH6GPY4H.js";
|
|
5
|
-
import "./chunk-ZAZHAVKB.js";
|
|
6
1
|
import {
|
|
7
2
|
runMigrations
|
|
8
3
|
} from "./chunk-XUAF2H54.js";
|
|
9
4
|
import "./chunk-CA4U2JP7.js";
|
|
5
|
+
import {
|
|
6
|
+
log_build_default
|
|
7
|
+
} from "./chunk-GTIC4R74.js";
|
|
8
|
+
import "./chunk-ZAZHAVKB.js";
|
|
10
9
|
import {
|
|
11
10
|
FederationConflictError,
|
|
12
11
|
FederationDiagnosticError,
|
|
13
12
|
federateCatalog
|
|
14
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-U4YJSTGV.js";
|
|
14
|
+
import "./chunk-WRNH5C3U.js";
|
|
15
|
+
import "./chunk-5EPNFDT5.js";
|
|
16
|
+
import "./chunk-A2RZR3U4.js";
|
|
17
|
+
import "./chunk-R7Z5ALYI.js";
|
|
15
18
|
import {
|
|
16
19
|
getFederationDiagnosticCounts,
|
|
17
20
|
getVisibleFederationDiagnostics
|
|
18
21
|
} from "./chunk-JJPB6EOZ.js";
|
|
19
22
|
import "./chunk-FV56YFM4.js";
|
|
20
|
-
import "./chunk-WRNH5C3U.js";
|
|
21
|
-
import "./chunk-5EPNFDT5.js";
|
|
22
|
-
import "./chunk-A2RZR3U4.js";
|
|
23
23
|
import "./chunk-SDZQJTJW.js";
|
|
24
24
|
import "./chunk-352FGP6W.js";
|
|
25
25
|
import {
|
|
@@ -30,10 +30,10 @@ import {
|
|
|
30
30
|
} from "./chunk-MDWB5HLO.js";
|
|
31
31
|
import {
|
|
32
32
|
generate
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-IVVM67LN.js";
|
|
34
34
|
import {
|
|
35
35
|
logger
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-RPVA2SZY.js";
|
|
37
37
|
import {
|
|
38
38
|
resolve_catalog_dependencies_default
|
|
39
39
|
} from "./chunk-36RYTYT5.js";
|
|
@@ -47,7 +47,7 @@ import {
|
|
|
47
47
|
import {
|
|
48
48
|
watch
|
|
49
49
|
} from "./chunk-U63GDPPY.js";
|
|
50
|
-
import "./chunk-
|
|
50
|
+
import "./chunk-ZW3MYAWF.js";
|
|
51
51
|
import {
|
|
52
52
|
getAstroConfigPath
|
|
53
53
|
} from "./chunk-VIJJ7JKH.js";
|
|
@@ -63,7 +63,7 @@ import {
|
|
|
63
63
|
} from "./chunk-LFQJXLHG.js";
|
|
64
64
|
import {
|
|
65
65
|
VERSION
|
|
66
|
-
} from "./chunk-
|
|
66
|
+
} from "./chunk-WK4J6FP3.js";
|
|
67
67
|
import {
|
|
68
68
|
getEventCatalogConfigFile,
|
|
69
69
|
verifyRequiredFieldsAreInCatalogConfigFile
|
|
@@ -2,15 +2,15 @@ import {
|
|
|
2
2
|
FederationConflictError,
|
|
3
3
|
FederationDiagnosticError,
|
|
4
4
|
federateCatalog
|
|
5
|
-
} from "../chunk-
|
|
6
|
-
import "../chunk-JJPB6EOZ.js";
|
|
7
|
-
import "../chunk-FV56YFM4.js";
|
|
5
|
+
} from "../chunk-U4YJSTGV.js";
|
|
8
6
|
import "../chunk-WRNH5C3U.js";
|
|
9
7
|
import "../chunk-5EPNFDT5.js";
|
|
10
8
|
import "../chunk-A2RZR3U4.js";
|
|
9
|
+
import "../chunk-R7Z5ALYI.js";
|
|
10
|
+
import "../chunk-JJPB6EOZ.js";
|
|
11
|
+
import "../chunk-FV56YFM4.js";
|
|
11
12
|
import "../chunk-SDZQJTJW.js";
|
|
12
13
|
import "../chunk-352FGP6W.js";
|
|
13
|
-
import "../chunk-R7Z5ALYI.js";
|
|
14
14
|
import "../chunk-RFIXKATC.js";
|
|
15
15
|
export {
|
|
16
16
|
FederationConflictError,
|
package/dist/generate.cjs
CHANGED
|
@@ -112,7 +112,7 @@ var getEventCatalogConfigFile = async (projectDirectory) => {
|
|
|
112
112
|
var import_picocolors = __toESM(require("picocolors"), 1);
|
|
113
113
|
|
|
114
114
|
// package.json
|
|
115
|
-
var version = "4.12.
|
|
115
|
+
var version = "4.12.2";
|
|
116
116
|
|
|
117
117
|
// src/constants.ts
|
|
118
118
|
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-IVVM67LN.js";
|
|
4
|
+
import "./chunk-RPVA2SZY.js";
|
|
5
|
+
import "./chunk-WK4J6FP3.js";
|
|
6
6
|
import "./chunk-RFIXKATC.js";
|
|
7
7
|
export {
|
|
8
8
|
generate
|
package/dist/utils/cli-logger.js
CHANGED
|
@@ -1,9 +1,86 @@
|
|
|
1
|
+
import { execFileSync } from 'node:child_process';
|
|
2
|
+
import fs from 'node:fs';
|
|
3
|
+
import path from 'node:path';
|
|
1
4
|
import shell from 'shelljs';
|
|
2
5
|
|
|
6
|
+
type Commit = { timestamp: number; author: string };
|
|
7
|
+
|
|
8
|
+
const COMMIT_MARKER = '\x1e';
|
|
9
|
+
|
|
10
|
+
const newestCommitsByRepository = new Map<string, Map<string, Commit> | undefined>();
|
|
11
|
+
|
|
3
12
|
export function hasGit() {
|
|
4
13
|
return !!shell.which('git');
|
|
5
14
|
}
|
|
6
15
|
|
|
16
|
+
const runGit = (args: string[]) => {
|
|
17
|
+
try {
|
|
18
|
+
return execFileSync('git', ['-c', 'log.showSignature=false', ...args], {
|
|
19
|
+
encoding: 'utf8',
|
|
20
|
+
maxBuffer: 1024 * 1024 * 1024,
|
|
21
|
+
stdio: ['ignore', 'pipe', 'ignore'],
|
|
22
|
+
});
|
|
23
|
+
} catch {
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const parseCommit = (header: string): Commit => {
|
|
29
|
+
const [timestamp, ...author] = header.split(',');
|
|
30
|
+
return { timestamp: Number(timestamp) * 1_000, author: author.join(',') };
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
// --no-renames and combined merge diffs list the same commits for a path as a per-file `git log -- <file>`.
|
|
34
|
+
const readNewestCommits = (): Map<string, Commit> | undefined => {
|
|
35
|
+
const root = runGit(['rev-parse', '--show-toplevel'])?.trim();
|
|
36
|
+
if (!root) return undefined;
|
|
37
|
+
|
|
38
|
+
const output =
|
|
39
|
+
runGit(['log', `--format=${COMMIT_MARKER}%ct,%an`, '--name-only', '--no-renames', '--diff-merges=combined', '-z']) ?? '';
|
|
40
|
+
|
|
41
|
+
const realRoot = fs.realpathSync(root);
|
|
42
|
+
const commits = new Map<string, Commit>();
|
|
43
|
+
let current: Commit | undefined;
|
|
44
|
+
for (const token of output.split('\0')) {
|
|
45
|
+
const entry = token.startsWith('\n') ? token.slice(1) : token;
|
|
46
|
+
if (entry.startsWith(COMMIT_MARKER)) {
|
|
47
|
+
current = parseCommit(entry.slice(COMMIT_MARKER.length));
|
|
48
|
+
} else if (entry && current) {
|
|
49
|
+
const file = path.join(realRoot, entry);
|
|
50
|
+
if (!commits.has(file)) commits.set(file, current);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return commits;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const getNewestCommits = () => {
|
|
57
|
+
const cwd = process.cwd();
|
|
58
|
+
if (!newestCommitsByRepository.has(cwd)) {
|
|
59
|
+
newestCommitsByRepository.set(cwd, readNewestCommits());
|
|
60
|
+
}
|
|
61
|
+
return newestCommitsByRepository.get(cwd);
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const toRealPath = (filePath: string) => {
|
|
65
|
+
const absolutePath = path.resolve(filePath);
|
|
66
|
+
try {
|
|
67
|
+
return path.join(fs.realpathSync(path.dirname(absolutePath)), path.basename(absolutePath));
|
|
68
|
+
} catch {
|
|
69
|
+
return absolutePath;
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const readCommit = (filePath: string, age: 'newest' | 'oldest'): Commit => {
|
|
74
|
+
const followArgs = age === 'oldest' ? ['--follow', '--diff-filter=A'] : [];
|
|
75
|
+
const output = runGit(['log', '--format=RESULT:%ct,%an', '--max-count=1', ...followArgs, '--', filePath])?.trim() ?? '';
|
|
76
|
+
|
|
77
|
+
const match = output.match(/(?:^|\n)RESULT:(?<header>\d+,.*)(?:$|\n)/);
|
|
78
|
+
if (!match?.groups) {
|
|
79
|
+
throw new Error(`Failed to retrieve the git history for file "${filePath}" with unexpected output: ${output}`);
|
|
80
|
+
}
|
|
81
|
+
return parseCommit(match.groups.header);
|
|
82
|
+
};
|
|
83
|
+
|
|
7
84
|
export function getGitHistory(
|
|
8
85
|
filePath: string,
|
|
9
86
|
{
|
|
@@ -23,36 +100,19 @@ export function getGitHistory(
|
|
|
23
100
|
throw new Error('Git is not installed');
|
|
24
101
|
}
|
|
25
102
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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}`);
|
|
103
|
+
let commit: Commit | undefined;
|
|
104
|
+
if (age === 'newest') {
|
|
105
|
+
const newestCommits = getNewestCommits();
|
|
106
|
+
if (!newestCommits) {
|
|
107
|
+
throw new Error(`Failed to retrieve the git history for file "${filePath}": not a git repository`);
|
|
108
|
+
}
|
|
109
|
+
commit = newestCommits.get(toRealPath(filePath));
|
|
46
110
|
}
|
|
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;
|
|
111
|
+
commit ??= readCommit(filePath, age);
|
|
52
112
|
|
|
53
113
|
return {
|
|
54
|
-
timestamp,
|
|
55
|
-
date,
|
|
56
|
-
author,
|
|
114
|
+
timestamp: commit.timestamp,
|
|
115
|
+
date: new Date(commit.timestamp),
|
|
116
|
+
author: includeAuthor ? commit.author : undefined,
|
|
57
117
|
};
|
|
58
118
|
}
|
package/package.json
CHANGED
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getFederationDiagnostics,
|
|
3
|
-
resolveFederationRules
|
|
4
|
-
} from "./chunk-JJPB6EOZ.js";
|
|
5
|
-
import {
|
|
6
|
-
isFederationEnabled
|
|
7
|
-
} from "./chunk-FV56YFM4.js";
|
|
8
1
|
import {
|
|
9
2
|
withFederationOutputTransaction
|
|
10
3
|
} from "./chunk-WRNH5C3U.js";
|
|
@@ -17,6 +10,13 @@ import {
|
|
|
17
10
|
import {
|
|
18
11
|
createFederationContentCache
|
|
19
12
|
} from "./chunk-R7Z5ALYI.js";
|
|
13
|
+
import {
|
|
14
|
+
getFederationDiagnostics,
|
|
15
|
+
resolveFederationRules
|
|
16
|
+
} from "./chunk-JJPB6EOZ.js";
|
|
17
|
+
import {
|
|
18
|
+
isFederationEnabled
|
|
19
|
+
} from "./chunk-FV56YFM4.js";
|
|
20
20
|
import {
|
|
21
21
|
getEventCatalogConfigFile
|
|
22
22
|
} from "./chunk-RFIXKATC.js";
|