@eventcatalog/core 2.42.10 → 2.43.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.
- 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/catalog-to-astro-content-directory.js +2 -2
- package/dist/{chunk-QVBE3VN4.js → chunk-A6LT34RD.js} +1 -1
- package/dist/{chunk-HDG7YSFG.js → chunk-LUUBKWYP.js} +8 -0
- package/dist/{chunk-ZG2E6QCK.js → chunk-QYZZIYJW.js} +1 -1
- package/dist/{chunk-K7RD2O76.js → chunk-ZV5T7TKQ.js} +1 -1
- package/dist/constants.cjs +1 -1
- package/dist/constants.js +1 -1
- package/dist/eventcatalog.auth.cjs +18 -0
- package/dist/eventcatalog.auth.d.cts +20 -0
- package/dist/eventcatalog.auth.d.ts +20 -0
- package/dist/eventcatalog.auth.js +0 -0
- package/dist/eventcatalog.cjs +50 -23
- package/dist/eventcatalog.js +29 -8
- package/dist/features.cjs +9 -0
- package/dist/features.d.cts +2 -1
- package/dist/features.d.ts +2 -1
- package/dist/features.js +3 -1
- package/dist/watcher.js +1 -1
- package/eventcatalog/astro.config.mjs +7 -3
- package/eventcatalog/auth.config.ts +156 -0
- package/eventcatalog/src/components/Header.astro +125 -25
- package/eventcatalog/src/middleware.ts +62 -0
- package/eventcatalog/src/pages/auth/error.astro +55 -0
- package/eventcatalog/src/pages/auth/login.astro +267 -0
- package/eventcatalog/src/pages/directory/[type]/_index.data.ts +63 -0
- package/eventcatalog/src/pages/directory/[type]/index.astro +6 -23
- package/eventcatalog/src/pages/discover/[type]/_index.data.ts +62 -0
- package/eventcatalog/src/pages/discover/[type]/index.astro +7 -24
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/_index.data.ts +62 -0
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/asyncapi/[filename].astro +5 -37
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/asyncapi/_[filename].data.ts +98 -0
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/changelog/_index.data.ts +68 -0
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/changelog/index.astro +5 -25
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/index.astro +6 -25
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/spec/[filename].astro +6 -35
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/spec/_[filename].data.ts +99 -0
- package/eventcatalog/src/pages/docs/[type]/[id]/index.astro +1 -0
- package/eventcatalog/src/pages/docs/[type]/[id]/language/_index.data.ts +40 -0
- package/eventcatalog/src/pages/docs/[type]/[id]/{language.astro → language/index.astro} +6 -20
- package/eventcatalog/src/pages/docs/custom/[...path]/_index.data.ts +49 -0
- package/eventcatalog/src/pages/docs/custom/[...path]/index.astro +5 -11
- package/eventcatalog/src/pages/docs/teams/[id]/_index.data.ts +46 -0
- package/eventcatalog/src/pages/docs/teams/[id]/index.astro +6 -10
- package/eventcatalog/src/pages/docs/users/[id]/_index.data.ts +46 -0
- package/eventcatalog/src/pages/docs/users/[id]/index.astro +5 -9
- package/eventcatalog/src/pages/visualiser/[type]/[id]/[version]/_index.data.ts +99 -0
- package/eventcatalog/src/pages/visualiser/[type]/[id]/[version]/index.astro +5 -29
- package/eventcatalog/src/utils/feature.ts +10 -0
- package/eventcatalog/src/utils/page-loaders/hybrid-page.ts +68 -0
- package/eventcatalog/tsconfig.json +2 -1
- package/package.json +3 -1
- package/dist/{chunk-SLEMYHTU.js → chunk-SFA7F3CQ.js} +3 -3
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import components from '@components/MDX/components';
|
|
3
3
|
|
|
4
4
|
// SideBars
|
|
5
|
-
import { getTeams } from '@utils/teams';
|
|
6
5
|
import { getEntry, render } from 'astro:content';
|
|
7
6
|
import type { CollectionEntry } from 'astro:content';
|
|
8
7
|
import OwnersList from '@components/Lists/OwnersList';
|
|
@@ -10,21 +9,18 @@ import PillListFlat from '@components/Lists/PillListFlat';
|
|
|
10
9
|
import EnvelopeIcon from '@heroicons/react/16/solid/EnvelopeIcon';
|
|
11
10
|
import { buildUrl } from '@utils/url-builder';
|
|
12
11
|
import VerticalSideBarLayout from '@layouts/VerticalSideBarLayout.astro';
|
|
12
|
+
import { Page } from './_index.data';
|
|
13
13
|
|
|
14
|
-
export
|
|
15
|
-
|
|
14
|
+
export const prerender = Page.prerender;
|
|
15
|
+
export const getStaticPaths = Page.getStaticPaths;
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
props: team,
|
|
20
|
-
}));
|
|
21
|
-
}
|
|
17
|
+
// Get data
|
|
18
|
+
const props = await Page.getData(Astro);
|
|
22
19
|
|
|
23
|
-
const props = Astro.props;
|
|
24
20
|
const { Content } = await render(props);
|
|
25
21
|
|
|
26
22
|
const membersRaw = props.data.members || [];
|
|
27
|
-
const members = (await Promise.all(membersRaw.map((m) => getEntry(m)))).filter(Boolean);
|
|
23
|
+
const members = (await Promise.all(membersRaw.map((m: CollectionEntry<'teams'>) => getEntry(m)))).filter(Boolean);
|
|
28
24
|
|
|
29
25
|
const domains = props.data.ownedDomains as CollectionEntry<'domains'>[];
|
|
30
26
|
const services = props.data.ownedServices as CollectionEntry<'services'>[];
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// pages/teams/[id]/index.page.ts
|
|
2
|
+
import { isSSR } from '@utils/feature';
|
|
3
|
+
import { HybridPage } from '@utils/page-loaders/hybrid-page';
|
|
4
|
+
|
|
5
|
+
export class Page extends HybridPage {
|
|
6
|
+
static get prerender(): boolean {
|
|
7
|
+
return !isSSR();
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
static async getStaticPaths(): Promise<Array<{ params: any; props: any }>> {
|
|
11
|
+
if (isSSR()) {
|
|
12
|
+
return [];
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const { getUsers } = await import('@utils/users');
|
|
16
|
+
const users = await getUsers();
|
|
17
|
+
|
|
18
|
+
return users.map((user) => ({
|
|
19
|
+
params: { id: user.data.id },
|
|
20
|
+
props: user,
|
|
21
|
+
}));
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
protected static async fetchData(params: any) {
|
|
25
|
+
const { id } = params;
|
|
26
|
+
|
|
27
|
+
if (!id) {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const { getUsers } = await import('@utils/users');
|
|
32
|
+
const users = await getUsers();
|
|
33
|
+
|
|
34
|
+
// Find the specific team by id
|
|
35
|
+
const user = users.find((u) => u.data.id === id);
|
|
36
|
+
|
|
37
|
+
return user || null;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
protected static createNotFoundResponse(): Response {
|
|
41
|
+
return new Response(null, {
|
|
42
|
+
status: 404,
|
|
43
|
+
statusText: 'User not found',
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -6,21 +6,17 @@ import { render } from 'astro:content';
|
|
|
6
6
|
import type { CollectionEntry } from 'astro:content';
|
|
7
7
|
import OwnersList from '@components/Lists/OwnersList';
|
|
8
8
|
import PillListFlat from '@components/Lists/PillListFlat';
|
|
9
|
-
import { getUsers } from '@utils/users';
|
|
10
9
|
import EnvelopeIcon from '@heroicons/react/16/solid/EnvelopeIcon';
|
|
11
10
|
import { buildUrl } from '@utils/url-builder';
|
|
12
11
|
import VerticalSideBarLayout from '@layouts/VerticalSideBarLayout.astro';
|
|
12
|
+
import { Page } from './_index.data';
|
|
13
13
|
|
|
14
|
-
export
|
|
15
|
-
|
|
14
|
+
export const prerender = Page.prerender;
|
|
15
|
+
export const getStaticPaths = Page.getStaticPaths;
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
props: user,
|
|
20
|
-
}));
|
|
21
|
-
}
|
|
17
|
+
// Get data
|
|
18
|
+
const props = await Page.getData(Astro);
|
|
22
19
|
|
|
23
|
-
const props = Astro.props;
|
|
24
20
|
const { Content } = await render(props);
|
|
25
21
|
|
|
26
22
|
const domains = props.data.ownedDomains as CollectionEntry<'domains'>[];
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
// pages/visualiser/[type]/[id]/[version]/index.page.ts
|
|
2
|
+
import { HybridPage } from '@utils/page-loaders/hybrid-page';
|
|
3
|
+
import { isAuthEnabled } from '@utils/feature';
|
|
4
|
+
import type { PageTypes } from '@types';
|
|
5
|
+
import { pageDataLoader } from '@utils/page-loaders/page-data-loader';
|
|
6
|
+
|
|
7
|
+
type PageTypesWithFlows = PageTypes | 'flows';
|
|
8
|
+
|
|
9
|
+
export class Page extends HybridPage {
|
|
10
|
+
static async getStaticPaths(): Promise<Array<{ params: any; props: any }>> {
|
|
11
|
+
if (isAuthEnabled()) {
|
|
12
|
+
return [];
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const { getFlows } = await import('@utils/collections/flows');
|
|
16
|
+
|
|
17
|
+
const loaders = {
|
|
18
|
+
...pageDataLoader,
|
|
19
|
+
flows: getFlows,
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const itemTypes: PageTypesWithFlows[] = ['events', 'commands', 'queries', 'services', 'domains', 'flows'];
|
|
23
|
+
const allItems = await Promise.all(itemTypes.map((type) => loaders[type]()));
|
|
24
|
+
|
|
25
|
+
return allItems.flatMap((items, index) =>
|
|
26
|
+
items
|
|
27
|
+
.filter((item) => item.data.visualiser !== false)
|
|
28
|
+
.map((item) => ({
|
|
29
|
+
params: {
|
|
30
|
+
type: itemTypes[index],
|
|
31
|
+
id: item.data.id,
|
|
32
|
+
version: item.data.version,
|
|
33
|
+
},
|
|
34
|
+
props: {
|
|
35
|
+
type: itemTypes[index],
|
|
36
|
+
...item,
|
|
37
|
+
},
|
|
38
|
+
}))
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
protected static async fetchData(params: any) {
|
|
43
|
+
const { type, id, version } = params;
|
|
44
|
+
|
|
45
|
+
if (!type || !id || !version) {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const { getFlows } = await import('@utils/collections/flows');
|
|
50
|
+
|
|
51
|
+
const loaders = {
|
|
52
|
+
...pageDataLoader,
|
|
53
|
+
flows: getFlows,
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
// Get all items of the specified type
|
|
57
|
+
const items = await loaders[type as PageTypesWithFlows]();
|
|
58
|
+
|
|
59
|
+
// Find the specific item by id and version
|
|
60
|
+
const item = items.find((i) => i.data.id === id && i.data.version === version && i.data.visualiser !== false);
|
|
61
|
+
|
|
62
|
+
if (!item) {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return {
|
|
67
|
+
type,
|
|
68
|
+
...item,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
protected static createNotFoundResponse(): Response {
|
|
73
|
+
return new Response(null, {
|
|
74
|
+
status: 404,
|
|
75
|
+
statusText: 'Visualiser page not found',
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
static get clientAuthScript(): string {
|
|
80
|
+
if (!isAuthEnabled()) {
|
|
81
|
+
return '';
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return `
|
|
85
|
+
if (typeof window !== 'undefined' && !import.meta.env.SSR) {
|
|
86
|
+
fetch('/api/auth/session')
|
|
87
|
+
.then(res => res.json())
|
|
88
|
+
.then(session => {
|
|
89
|
+
if (!session?.user) {
|
|
90
|
+
window.location.href = '/auth/login?callbackUrl=' + encodeURIComponent(window.location.pathname);
|
|
91
|
+
}
|
|
92
|
+
})
|
|
93
|
+
.catch(() => {
|
|
94
|
+
window.location.href = '/auth/login?callbackUrl=' + encodeURIComponent(window.location.pathname);
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
`;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
@@ -2,40 +2,16 @@
|
|
|
2
2
|
import NodeGraph from '@components/MDX/NodeGraph/NodeGraph.astro';
|
|
3
3
|
import VisualiserLayout from '@layouts/VisualiserLayout.astro';
|
|
4
4
|
import type { PageTypes } from '@types';
|
|
5
|
-
import { getFlows } from '@utils/collections/flows';
|
|
6
5
|
import { buildUrl } from '@utils/url-builder';
|
|
7
|
-
|
|
8
|
-
import { pageDataLoader } from '@utils/page-loaders/page-data-loader';
|
|
9
6
|
import { ClientRouter } from 'astro:transitions';
|
|
10
|
-
type PageTypesWithFlows = PageTypes | 'flows';
|
|
11
|
-
|
|
12
|
-
export async function getStaticPaths() {
|
|
13
|
-
const loaders = {
|
|
14
|
-
...pageDataLoader,
|
|
15
|
-
flows: getFlows,
|
|
16
|
-
};
|
|
17
7
|
|
|
18
|
-
|
|
19
|
-
const allItems = await Promise.all(itemTypes.map((type) => loaders[type]()));
|
|
8
|
+
import { Page } from './_index.data';
|
|
20
9
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
.filter((item) => item.data.visualiser !== false)
|
|
24
|
-
.map((item) => ({
|
|
25
|
-
params: {
|
|
26
|
-
type: itemTypes[index],
|
|
27
|
-
id: item.data.id,
|
|
28
|
-
version: item.data.version,
|
|
29
|
-
},
|
|
30
|
-
props: {
|
|
31
|
-
type: itemTypes[index],
|
|
32
|
-
...item,
|
|
33
|
-
},
|
|
34
|
-
}))
|
|
35
|
-
);
|
|
36
|
-
}
|
|
10
|
+
export const prerender = Page.prerender;
|
|
11
|
+
export const getStaticPaths = Page.getStaticPaths;
|
|
37
12
|
|
|
38
|
-
|
|
13
|
+
// Get data
|
|
14
|
+
const props = await Page.getData(Astro);
|
|
39
15
|
|
|
40
16
|
const {
|
|
41
17
|
data: { id },
|
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
14
|
import config from '@config';
|
|
15
|
+
import fs from 'fs';
|
|
16
|
+
import { join } from 'path';
|
|
15
17
|
|
|
16
18
|
// These functions check for valid, legally obtained access to premium features
|
|
17
19
|
export const isEventCatalogStarterEnabled = () => process.env.EVENTCATALOG_STARTER === 'true';
|
|
@@ -42,3 +44,11 @@ export const isEventCatalogUpgradeEnabled = () => !isEventCatalogStarterEnabled(
|
|
|
42
44
|
export const isCustomLandingPageEnabled = () => isEventCatalogStarterEnabled() || isEventCatalogScaleEnabled();
|
|
43
45
|
|
|
44
46
|
export const isMarkdownDownloadEnabled = () => config?.llmsTxt?.enabled ?? false;
|
|
47
|
+
|
|
48
|
+
export const isAuthEnabled = () => {
|
|
49
|
+
const directory = process.env.PROJECT_DIR || process.cwd();
|
|
50
|
+
const hasAuthConfig = fs.existsSync(join(directory, 'eventcatalog.auth.js'));
|
|
51
|
+
return (hasAuthConfig && isSSR() && isEventCatalogScaleEnabled()) || false;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export const isSSR = () => config?.output === 'server';
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { AstroGlobal } from 'astro';
|
|
2
|
+
import { isSSR } from '@utils/feature';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Base class for all hybrid pages with static methods
|
|
6
|
+
*/
|
|
7
|
+
export class HybridPage<T = any> {
|
|
8
|
+
/**
|
|
9
|
+
* Static method for prerender setting
|
|
10
|
+
*/
|
|
11
|
+
static get prerender(): boolean {
|
|
12
|
+
return !isSSR();
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Static method for generating static paths
|
|
17
|
+
*/
|
|
18
|
+
static async getStaticPaths(): Promise<Array<{ params: any; props: any }>> {
|
|
19
|
+
if (isSSR()) {
|
|
20
|
+
return [];
|
|
21
|
+
}
|
|
22
|
+
// Don't call this.generateStaticPaths() here - let each subclass implement this method directly
|
|
23
|
+
throw new Error('getStaticPaths must be implemented by subclass');
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Static method for getting data
|
|
28
|
+
*/
|
|
29
|
+
static async getData(astro: AstroGlobal): Promise<any> {
|
|
30
|
+
// Try props first (static mode)
|
|
31
|
+
if (astro.props && this.hasValidProps(astro.props)) {
|
|
32
|
+
return this.transformProps(astro.props);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const data = await this.fetchData(astro.params);
|
|
36
|
+
|
|
37
|
+
if (!data) {
|
|
38
|
+
throw this.createNotFoundResponse();
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return data;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Methods to be overridden by subclasses
|
|
46
|
+
*/
|
|
47
|
+
protected static async fetchData(params: any): Promise<any> {
|
|
48
|
+
throw new Error('fetchData must be implemented by subclass');
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Override these static methods if needed
|
|
53
|
+
*/
|
|
54
|
+
protected static hasValidProps(props: any): boolean {
|
|
55
|
+
return props && Object.keys(props).length > 0 && props.data;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
protected static transformProps(props: any): any {
|
|
59
|
+
return props;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
protected static createNotFoundResponse(): Response {
|
|
63
|
+
return new Response(null, {
|
|
64
|
+
status: 404,
|
|
65
|
+
statusText: 'Not found',
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
"@utils/*": ["src/utils/*"],
|
|
14
14
|
"@layouts/*": ["src/layouts/*"],
|
|
15
15
|
"@enterprise/*": ["src/enterprise/*"],
|
|
16
|
-
"@ai/*": ["src/generated-ai/*"]
|
|
16
|
+
"@ai/*": ["src/generated-ai/*"],
|
|
17
|
+
"auth:config": ["./auth.config.ts"]
|
|
17
18
|
},
|
|
18
19
|
"jsx": "react-jsx",
|
|
19
20
|
"jsxImportSource": "react",
|
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.
|
|
9
|
+
"version": "2.43.1",
|
|
10
10
|
"publishConfig": {
|
|
11
11
|
"access": "public"
|
|
12
12
|
},
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
"@asyncapi/avro-schema-parser": "^3.0.24",
|
|
34
34
|
"@asyncapi/parser": "^3.4.0",
|
|
35
35
|
"@asyncapi/react-component": "^2.4.3",
|
|
36
|
+
"@auth/core": "^0.37.4",
|
|
36
37
|
"@eventcatalog/generator-ai": "^1.1.0",
|
|
37
38
|
"@eventcatalog/sdk": "^2.2.7",
|
|
38
39
|
"@fontsource/inter": "^5.2.5",
|
|
@@ -58,6 +59,7 @@
|
|
|
58
59
|
"astro-expressive-code": "^0.40.1",
|
|
59
60
|
"astro-pagefind": "^1.6.0",
|
|
60
61
|
"astro-seo": "^0.8.4",
|
|
62
|
+
"auth-astro": "^4.2.0",
|
|
61
63
|
"axios": "^1.7.7",
|
|
62
64
|
"boxen": "^8.0.1",
|
|
63
65
|
"commander": "^12.1.0",
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
verifyRequiredFieldsAreInCatalogConfigFile
|
|
3
|
-
} from "./chunk-E7TXTI7G.js";
|
|
4
1
|
import {
|
|
5
2
|
mapCatalogToAstro
|
|
6
3
|
} from "./chunk-EXAALOQA.js";
|
|
4
|
+
import {
|
|
5
|
+
verifyRequiredFieldsAreInCatalogConfigFile
|
|
6
|
+
} from "./chunk-E7TXTI7G.js";
|
|
7
7
|
|
|
8
8
|
// src/catalog-to-astro-content-directory.js
|
|
9
9
|
import { glob } from "glob";
|