@eventcatalog/core 2.12.0 → 2.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/CHANGELOG.md +13 -0
- package/README.md +9 -0
- package/bin/dist/eventcatalog.config.d.cts +3 -0
- package/bin/dist/eventcatalog.config.d.ts +3 -0
- package/bin/eventcatalog.config.ts +3 -0
- package/images/sponsors/oso-logo-green.png +0 -0
- package/package.json +2 -2
- package/src/components/SideBars/DomainSideBar.astro +1 -1
- package/src/components/SideBars/MessageSideBar.astro +1 -1
- package/src/components/SideBars/ServiceSideBar.astro +1 -1
- package/src/layouts/VerticalSideBarLayout.astro +20 -33
- package/src/pages/docs/[type]/[id]/[version]/asyncapi/index.astro +4 -3
- package/src/pages/docs/index.astro +8 -4
- package/src/utils/config/catalog.ts +15 -0
- package/src/utils/pages.ts +5 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @eventcatalog/core
|
|
2
2
|
|
|
3
|
+
## 2.12.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 93e224c: fix(core): custom defined landing page for docs now render on docs tab
|
|
8
|
+
|
|
9
|
+
## 2.12.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- a57282e: fix(core): new property for AsyncAPI rendering
|
|
14
|
+
- d739d7b: fix(core): changelog buttons now render the correct changelog
|
|
15
|
+
|
|
3
16
|
## 2.12.0
|
|
4
17
|
|
|
5
18
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -133,6 +133,15 @@ Thank you to our project sponsors.
|
|
|
133
133
|
|
|
134
134
|
<hr />
|
|
135
135
|
|
|
136
|
+
<div align="center">
|
|
137
|
+
<img alt="oso" src="./images/sponsors/oso-logo-green.png" width="30%" />
|
|
138
|
+
<p style="margin: 0; padding: 0;">Delivering Apache Kafka professional services to your business
|
|
139
|
+
</p>
|
|
140
|
+
<a href="https://oso.sh/?utm_source=eventcatalog&utm_medium=web&utm_campaign=sponsorship" target="_blank" >Learn more</a>
|
|
141
|
+
</div>
|
|
142
|
+
|
|
143
|
+
<hr />
|
|
144
|
+
|
|
136
145
|
_Sponsors help make EventCatalog sustainable, want to help the project? Get in touch! Or [visit our sponsor page](https://www.eventcatalog.dev/support)._
|
|
137
146
|
|
|
138
147
|
# Enterprise support
|
|
Binary file
|
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.12.
|
|
9
|
+
"version": "2.12.2",
|
|
10
10
|
"publishConfig": {
|
|
11
11
|
"access": "public"
|
|
12
12
|
},
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"@astrojs/mdx": "^3.1.8",
|
|
42
42
|
"@astrojs/react": "^3.6.2",
|
|
43
43
|
"@astrojs/tailwind": "^5.1.2",
|
|
44
|
-
"@asyncapi/react-component": "^2.
|
|
44
|
+
"@asyncapi/react-component": "^2.4.3",
|
|
45
45
|
"@headlessui/react": "^2.0.3",
|
|
46
46
|
"@heroicons/react": "^2.1.3",
|
|
47
47
|
"@parcel/watcher": "^2.4.1",
|
|
@@ -66,7 +66,7 @@ const ownersList = owners.map((o) => ({
|
|
|
66
66
|
<span class="block">View in visualiser</span>
|
|
67
67
|
</a>
|
|
68
68
|
<a
|
|
69
|
-
href={buildUrl(`/docs/${domain.collection}/${domain.data.id}/${domain.data.
|
|
69
|
+
href={buildUrl(`/docs/${domain.collection}/${domain.data.id}/${domain.data.latestVersion}/changelog`)}
|
|
70
70
|
class="flex items-center space-x-2 justify-center text-center rounded-md w-full bg-white px-3.5 py-2.5 text-sm font-semibold text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 hover:bg-gray-100/60 hover:text-primary"
|
|
71
71
|
>
|
|
72
72
|
<ScrollText strokeWidth={2} size={16} />
|
|
@@ -151,7 +151,7 @@ const schemaURL = path.join(publicPath, schemaFilePath || '');
|
|
|
151
151
|
</a>
|
|
152
152
|
|
|
153
153
|
<a
|
|
154
|
-
href={buildUrl(`/docs/${message.collection}/${message.data.id}/${message.data.
|
|
154
|
+
href={buildUrl(`/docs/${message.collection}/${message.data.id}/${message.data.latestVersion}/changelog`)}
|
|
155
155
|
class="flex items-center space-x-2 justify-center text-center rounded-md w-full bg-white px-3.5 py-2.5 text-sm font-semibold text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 hover:bg-gray-100/60 hover:text-primary"
|
|
156
156
|
>
|
|
157
157
|
<ScrollText strokeWidth={2} size={16} />
|
|
@@ -107,7 +107,7 @@ const schemaURL = join(publicPath, schemaFilePath || '');
|
|
|
107
107
|
<span class="block">View in visualiser</span>
|
|
108
108
|
</a>
|
|
109
109
|
<a
|
|
110
|
-
href={buildUrl(`/docs/${service.collection}/${service.data.id}/${service.data.
|
|
110
|
+
href={buildUrl(`/docs/${service.collection}/${service.data.id}/${service.data.latestVersion}/changelog`)}
|
|
111
111
|
class="flex items-center space-x-2 justify-center text-center rounded-md w-full bg-white px-3.5 py-2.5 text-sm font-semibold text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 hover:bg-gray-100/60 hover:text-primary"
|
|
112
112
|
>
|
|
113
113
|
<ScrollText strokeWidth={2} size={16} />
|
|
@@ -16,10 +16,11 @@ import { getServices } from '@utils/services/services';
|
|
|
16
16
|
import { getFlows } from '@utils/flows/flows';
|
|
17
17
|
import { getTeams } from '@utils/teams';
|
|
18
18
|
import { getUsers } from '@utils/users';
|
|
19
|
-
import
|
|
19
|
+
import { isCollectionVisibleInCatalog } from '@eventcatalog';
|
|
20
20
|
import { buildUrl } from '@utils/url-builder';
|
|
21
21
|
import { getQueries } from '@utils/queries';
|
|
22
22
|
import CatalogResourcesSideBar from '@components/SideBars/CatalogResourcesSideBar';
|
|
23
|
+
import { hasLandingPageForDocs } from '@utils/pages';
|
|
23
24
|
|
|
24
25
|
const events = await getEvents({ getAllVersions: false });
|
|
25
26
|
const commands = await getCommands({ getAllVersions: false });
|
|
@@ -37,12 +38,23 @@ const allData = [...domains, ...services, ...messages, ...flows, ...teams, ...us
|
|
|
37
38
|
|
|
38
39
|
const currentPath = Astro.url.pathname;
|
|
39
40
|
|
|
41
|
+
const catalogHasDefaultLandingPageForDocs = await hasLandingPageForDocs();
|
|
42
|
+
|
|
40
43
|
const getDefaultUrl = (route: string, defaultValue: string) => {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
const collections = [
|
|
45
|
+
{ data: domains, key: 'domains' },
|
|
46
|
+
{ data: services, key: 'services' },
|
|
47
|
+
{ data: messages, key: 'messages' },
|
|
48
|
+
{ data: flows, key: 'flows' },
|
|
49
|
+
];
|
|
50
|
+
|
|
51
|
+
for (const { data, key } of collections) {
|
|
52
|
+
if (data.length > 0 && isCollectionVisibleInCatalog(key)) {
|
|
53
|
+
const item = data[0];
|
|
54
|
+
return buildUrl(`/${route}/${key}/${item.data.id}/${item.data.latestVersion}`);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
46
58
|
return buildUrl(defaultValue);
|
|
47
59
|
};
|
|
48
60
|
|
|
@@ -59,7 +71,7 @@ const navigationItems = [
|
|
|
59
71
|
id: '/docs',
|
|
60
72
|
label: 'Documentation',
|
|
61
73
|
icon: BookOpenText,
|
|
62
|
-
href: getDefaultUrl('docs', '/docs'),
|
|
74
|
+
href: catalogHasDefaultLandingPageForDocs ? buildUrl('/docs') : getDefaultUrl('docs', '/docs'),
|
|
63
75
|
current: currentPath.includes('/docs'),
|
|
64
76
|
sidebar: true,
|
|
65
77
|
},
|
|
@@ -81,31 +93,6 @@ const navigationItems = [
|
|
|
81
93
|
},
|
|
82
94
|
];
|
|
83
95
|
|
|
84
|
-
const eventCatalogConfig = config as CatalogConfig;
|
|
85
|
-
|
|
86
|
-
const {
|
|
87
|
-
services: servicesConfig,
|
|
88
|
-
domains: domainsConfig,
|
|
89
|
-
messages: messagesConfig,
|
|
90
|
-
flows: flowsConfig,
|
|
91
|
-
teams: teamsConfig,
|
|
92
|
-
users: usersConfig,
|
|
93
|
-
} = eventCatalogConfig?.docs?.sidebar || {};
|
|
94
|
-
|
|
95
|
-
const getConfigValue = (obj: any, key: string, defaultValue: any) => {
|
|
96
|
-
return obj?.[key] ?? defaultValue;
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
const visibleCollections: { [key: string]: boolean } = {
|
|
100
|
-
events: getConfigValue(messagesConfig, 'visible', true),
|
|
101
|
-
commands: getConfigValue(messagesConfig, 'visible', true),
|
|
102
|
-
domains: getConfigValue(domainsConfig, 'visible', true),
|
|
103
|
-
flows: getConfigValue(flowsConfig, 'visible', true),
|
|
104
|
-
services: getConfigValue(servicesConfig, 'visible', true),
|
|
105
|
-
teams: getConfigValue(teamsConfig, 'visible', true),
|
|
106
|
-
users: getConfigValue(usersConfig, 'visible', true),
|
|
107
|
-
};
|
|
108
|
-
|
|
109
96
|
const sideNav = allData.reduce((acc, item) => {
|
|
110
97
|
const title = item.collection;
|
|
111
98
|
const group = acc[title] || [];
|
|
@@ -120,7 +107,7 @@ const sideNav = allData.reduce((acc, item) => {
|
|
|
120
107
|
label: item.data.name,
|
|
121
108
|
version: item.collection === 'teams' || item.collection === 'users' ? null : item.data.version,
|
|
122
109
|
// items: item.collection === 'users' ? [] : item.headings,
|
|
123
|
-
visible:
|
|
110
|
+
visible: isCollectionVisibleInCatalog(item.collection),
|
|
124
111
|
// @ts-ignore
|
|
125
112
|
href: item.data.version
|
|
126
113
|
? // @ts-ignore
|
|
@@ -7,14 +7,13 @@ import { Parser } from '@asyncapi/parser';
|
|
|
7
7
|
|
|
8
8
|
import type { CollectionTypes, PageTypes } from '@types';
|
|
9
9
|
|
|
10
|
-
import PlainPage from '@layouts/PlainPage.astro';
|
|
11
|
-
|
|
12
10
|
import '@asyncapi/react-component/styles/default.min.css';
|
|
13
11
|
import js from '@asyncapi/react-component/browser/standalone/without-parser.js?url';
|
|
14
12
|
import { AsyncApiComponentWP, type ConfigInterface } from '@asyncapi/react-component';
|
|
15
13
|
import { pageDataLoader } from '@utils/pages/pages';
|
|
16
14
|
import type { CollectionEntry } from 'astro:content';
|
|
17
15
|
import VerticalSideBarLayout from '@layouts/VerticalSideBarLayout.astro';
|
|
16
|
+
import Config from '@eventcatalog';
|
|
18
17
|
|
|
19
18
|
export async function getStaticPaths() {
|
|
20
19
|
const itemTypes: PageTypes[] = ['events', 'commands', 'queries', 'services', 'domains'];
|
|
@@ -45,7 +44,9 @@ const pathToSpec = path.join(catalog.publicPath, fileName);
|
|
|
45
44
|
const pathOnDisk = path.join(process.cwd(), 'public', pathToSpec);
|
|
46
45
|
const fileContent = readFileSync(pathOnDisk, 'utf-8');
|
|
47
46
|
|
|
48
|
-
|
|
47
|
+
// AsyncAPI parser will parser schemas for users, they can turn this off.
|
|
48
|
+
const parseSchemas = Config?.asyncAPI?.renderParsedSchemas ?? true;
|
|
49
|
+
const parsed = await new Parser().parse(fileContent, { parseSchemas });
|
|
49
50
|
const stringified = parsed.document?.json();
|
|
50
51
|
const config: ConfigInterface = { show: { sidebar: true, errors: true } };
|
|
51
52
|
|
|
@@ -17,11 +17,15 @@ if (page) {
|
|
|
17
17
|
{
|
|
18
18
|
CustomContent && (
|
|
19
19
|
<VerticalSideBarLayout title="EventCatalog">
|
|
20
|
-
<main class="
|
|
21
|
-
<div class="
|
|
22
|
-
<
|
|
20
|
+
<main class="flex sm:px-8 docs-layout h-full">
|
|
21
|
+
<div class="flex docs-layout w-full">
|
|
22
|
+
<div class="w-full lg:mr-2 pr-8 overflow-y-auto py-8">
|
|
23
|
+
<div class="prose prose-md w-full !max-w-none">
|
|
24
|
+
<CustomContent components={components} />
|
|
25
|
+
</div>
|
|
26
|
+
<Footer />
|
|
27
|
+
</div>
|
|
23
28
|
</div>
|
|
24
|
-
<Footer />
|
|
25
29
|
</main>
|
|
26
30
|
</VerticalSideBarLayout>
|
|
27
31
|
)
|
|
@@ -18,4 +18,19 @@ export type CatalogConfig = {
|
|
|
18
18
|
};
|
|
19
19
|
};
|
|
20
20
|
|
|
21
|
+
const getConfigValue = (obj: any, key: string, defaultValue: any) => {
|
|
22
|
+
return obj?.[key] ?? defaultValue;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export const isCollectionVisibleInCatalog = (collection: string) => {
|
|
26
|
+
const sidebarConfig = config?.default?.docs?.sidebar || {};
|
|
27
|
+
const collections = ['events', 'commands', 'queries', 'domains', 'flows', 'services', 'teams', 'users'];
|
|
28
|
+
|
|
29
|
+
if (!collections.includes(collection)) return false;
|
|
30
|
+
|
|
31
|
+
const collectionConfig =
|
|
32
|
+
sidebarConfig[collection === 'events' || collection === 'commands' || collection === 'queries' ? 'messages' : collection];
|
|
33
|
+
return getConfigValue(collectionConfig, 'visible', true);
|
|
34
|
+
};
|
|
35
|
+
|
|
21
36
|
export default config.default;
|
package/src/utils/pages.ts
CHANGED
|
@@ -13,3 +13,8 @@ export const getIndexPage = async (): Promise<Page> => {
|
|
|
13
13
|
const pages = await getCollection('pages');
|
|
14
14
|
return pages.find((page) => page.slug === 'index')!;
|
|
15
15
|
};
|
|
16
|
+
|
|
17
|
+
export const hasLandingPageForDocs = async (): Promise<boolean> => {
|
|
18
|
+
const pages = await getCollection('pages');
|
|
19
|
+
return pages.some((page) => page.slug === 'index')!;
|
|
20
|
+
};
|