@eventcatalog/core 2.6.2 → 2.6.3
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 +6 -0
- package/package.json +1 -1
- package/src/pages/docs/[type]/[id]/[version]/asyncapi/index.astro +14 -24
- package/src/pages/docs/[type]/[id]/[version]/changelog/index.astro +10 -19
- package/src/pages/docs/[type]/[id]/[version]/index.astro +19 -21
- package/src/pages/docs/[type]/[id]/[version]/spec/index.astro +12 -19
- package/src/pages/visualiser/[type]/[id]/[version]/index.astro +17 -21
- package/src/types/index.ts +2 -0
- package/src/utils/messages.ts +12 -6
- package/src/utils/pages/pages.ts +12 -0
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,50 +1,40 @@
|
|
|
1
1
|
---
|
|
2
|
-
import type { CollectionEntry } from 'astro:content';
|
|
3
|
-
import type { CollectionTypes } from '@types';
|
|
4
2
|
import path from 'path';
|
|
5
3
|
import { readFileSync } from 'fs';
|
|
6
|
-
|
|
7
|
-
import PlainPage from '@layouts/PlainPage.astro';
|
|
8
|
-
|
|
9
4
|
import { createElement } from 'react';
|
|
10
5
|
import { renderToString } from 'react-dom/server';
|
|
11
|
-
|
|
12
6
|
import { Parser } from '@asyncapi/parser';
|
|
13
7
|
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
-
import
|
|
17
|
-
import { getDomains } from '@utils/domains/domains';
|
|
8
|
+
import type { CollectionTypes, PageTypes } from '@types';
|
|
9
|
+
|
|
10
|
+
import PlainPage from '@layouts/PlainPage.astro';
|
|
18
11
|
|
|
19
12
|
import '@asyncapi/react-component/styles/default.min.css';
|
|
20
13
|
import js from '@asyncapi/react-component/browser/standalone/without-parser.js?url';
|
|
21
14
|
import { AsyncApiComponentWP, type ConfigInterface } from '@asyncapi/react-component';
|
|
15
|
+
import { pageDataLoader } from '@utils/pages/pages';
|
|
16
|
+
import type { CollectionEntry } from 'astro:content';
|
|
22
17
|
|
|
23
18
|
export async function getStaticPaths() {
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
const services = await getServices();
|
|
27
|
-
const domains = await getDomains();
|
|
19
|
+
const itemTypes: PageTypes[] = ['events', 'commands', 'services', 'domains'];
|
|
20
|
+
const allItems = await Promise.all(itemTypes.map((type) => pageDataLoader[type]()));
|
|
28
21
|
|
|
29
22
|
const hasAsyncAPISpec = (item: CollectionEntry<CollectionTypes>) => item.data.specifications?.asyncapiPath !== undefined;
|
|
23
|
+
const filteredItems = allItems.map((items) => items.filter(hasAsyncAPISpec));
|
|
30
24
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
return filteredCollection.map((item) => ({
|
|
25
|
+
return filteredItems.flatMap((items, index) =>
|
|
26
|
+
items.map((item) => ({
|
|
35
27
|
params: {
|
|
36
|
-
type: item.collection,
|
|
37
28
|
id: item.data.id,
|
|
29
|
+
type: itemTypes[index],
|
|
38
30
|
version: item.data.version,
|
|
39
31
|
},
|
|
40
32
|
props: {
|
|
41
|
-
type:
|
|
33
|
+
type: itemTypes[index],
|
|
42
34
|
...item,
|
|
43
35
|
},
|
|
44
|
-
}))
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
return [...buildPages(domains), ...buildPages(events), ...buildPages(services), ...buildPages(commands)];
|
|
36
|
+
}))
|
|
37
|
+
);
|
|
48
38
|
}
|
|
49
39
|
|
|
50
40
|
// @ts-ignore
|
|
@@ -1,40 +1,31 @@
|
|
|
1
1
|
---
|
|
2
|
-
import type { CollectionEntry } from 'astro:content';
|
|
3
|
-
|
|
4
2
|
import Layout from '@layouts/DocsLayout.astro';
|
|
5
3
|
import Footer from '@layouts/Footer.astro';
|
|
6
4
|
|
|
7
|
-
import {
|
|
8
|
-
import { getServices } from '@utils/services/services';
|
|
9
|
-
import { getCommands } from '@utils/commands';
|
|
10
|
-
import { getDomains } from '@utils/domains/domains';
|
|
11
|
-
import type { CollectionTypes } from '@types';
|
|
5
|
+
import type { PageTypes } from '@types';
|
|
12
6
|
import { getChangeLogs } from '@utils/changelogs/changelogs';
|
|
13
7
|
import { EnvelopeIcon, RectangleGroupIcon, ServerIcon } from '@heroicons/react/24/outline';
|
|
8
|
+
import { pageDataLoader } from '@utils/pages/pages';
|
|
14
9
|
|
|
15
10
|
import { buildUrl } from '@utils/url-builder';
|
|
16
11
|
|
|
17
12
|
export async function getStaticPaths() {
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
const services = await getServices();
|
|
21
|
-
const domains = await getDomains();
|
|
13
|
+
const itemTypes: PageTypes[] = ['events', 'commands', 'services', 'domains'];
|
|
14
|
+
const allItems = await Promise.all(itemTypes.map((type) => pageDataLoader[type]()));
|
|
22
15
|
|
|
23
|
-
|
|
24
|
-
|
|
16
|
+
return allItems.flatMap((items, index) =>
|
|
17
|
+
items.map((item) => ({
|
|
25
18
|
params: {
|
|
26
|
-
type:
|
|
19
|
+
type: itemTypes[index],
|
|
27
20
|
id: item.data.id,
|
|
28
21
|
version: item.data.version,
|
|
29
22
|
},
|
|
30
23
|
props: {
|
|
31
|
-
type:
|
|
24
|
+
type: itemTypes[index],
|
|
32
25
|
...item,
|
|
33
26
|
},
|
|
34
|
-
}))
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
return [...buildPages(domains), ...buildPages(events), ...buildPages(services), ...buildPages(commands)];
|
|
27
|
+
}))
|
|
28
|
+
);
|
|
38
29
|
}
|
|
39
30
|
|
|
40
31
|
const props = Astro.props;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
---
|
|
2
|
-
import type { CollectionEntry } from 'astro:content';
|
|
3
2
|
import DocsLayout from '@layouts/DocsLayout.astro';
|
|
4
3
|
import Footer from '@layouts/Footer.astro';
|
|
5
4
|
|
|
@@ -10,40 +9,39 @@ import SchemaViewer from '@components/MDX/SchemaViewer/SchemaViewer.astro';
|
|
|
10
9
|
// SideBars
|
|
11
10
|
import ServiceSideBar from '@components/SideBars/ServiceSideBar.astro';
|
|
12
11
|
import MessageSideBar from '@components/SideBars/MessageSideBar.astro';
|
|
13
|
-
|
|
14
|
-
import { getEvents } from '@utils/events';
|
|
15
|
-
import { getServices } from '@utils/services/services';
|
|
16
|
-
import { getCommands } from '@utils/commands';
|
|
17
|
-
import { EnvelopeIcon, PencilIcon, QueueListIcon, RectangleGroupIcon, ServerIcon } from '@heroicons/react/24/outline';
|
|
18
|
-
import { getDomains } from '@utils/domains/domains';
|
|
19
12
|
import DomainSideBar from '@components/SideBars/DomainSideBar.astro';
|
|
20
|
-
|
|
13
|
+
|
|
14
|
+
import { EnvelopeIcon, QueueListIcon, RectangleGroupIcon, ServerIcon } from '@heroicons/react/24/outline';
|
|
15
|
+
import type { PageTypes } from '@types';
|
|
21
16
|
|
|
22
17
|
import { buildUrl } from '@utils/url-builder';
|
|
23
18
|
import { getFlows } from '@utils/flows/flows';
|
|
19
|
+
import { pageDataLoader } from '@utils/pages/pages';
|
|
20
|
+
|
|
21
|
+
type PageTypesWithFlows = PageTypes | 'flows';
|
|
24
22
|
|
|
25
23
|
export async function getStaticPaths() {
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const flows = await getFlows();
|
|
24
|
+
const loaders = {
|
|
25
|
+
...pageDataLoader,
|
|
26
|
+
flows: getFlows,
|
|
27
|
+
};
|
|
31
28
|
|
|
32
|
-
const
|
|
33
|
-
|
|
29
|
+
const itemTypes: PageTypesWithFlows[] = ['events', 'commands', 'services', 'domains', 'flows'];
|
|
30
|
+
const allItems = await Promise.all(itemTypes.map((type) => loaders[type]()));
|
|
31
|
+
|
|
32
|
+
return allItems.flatMap((items, index) =>
|
|
33
|
+
items.map((item) => ({
|
|
34
34
|
params: {
|
|
35
|
-
type:
|
|
35
|
+
type: itemTypes[index],
|
|
36
36
|
id: item.data.id,
|
|
37
37
|
version: item.data.version,
|
|
38
38
|
},
|
|
39
39
|
props: {
|
|
40
|
-
type:
|
|
40
|
+
type: itemTypes[index],
|
|
41
41
|
...item,
|
|
42
42
|
},
|
|
43
|
-
}))
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
return [...buildPages(domains), ...buildPages(events), ...buildPages(services), ...buildPages(commands), ...buildPages(flows)];
|
|
43
|
+
}))
|
|
44
|
+
);
|
|
47
45
|
}
|
|
48
46
|
|
|
49
47
|
const props = Astro.props;
|
|
@@ -3,40 +3,33 @@ import type { CollectionEntry } from 'astro:content';
|
|
|
3
3
|
import * as path from 'path';
|
|
4
4
|
import fs from 'node:fs';
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
import { getServices } from '@utils/services/services';
|
|
8
|
-
import { getCommands } from '@utils/commands';
|
|
9
|
-
import { getDomains } from '@utils/domains/domains';
|
|
10
|
-
import type { CollectionTypes } from '@types';
|
|
6
|
+
import type { CollectionTypes, PageTypes } from '@types';
|
|
11
7
|
import PlainPage from '@layouts/PlainPage.astro';
|
|
12
8
|
import { DocumentMinusIcon } from '@heroicons/react/24/outline';
|
|
13
9
|
import { buildUrl } from '@utils/url-builder';
|
|
10
|
+
import { pageDataLoader } from '@utils/pages/pages';
|
|
14
11
|
|
|
15
12
|
export async function getStaticPaths() {
|
|
16
|
-
const
|
|
17
|
-
const commands = await getCommands();
|
|
18
|
-
const services = await getServices();
|
|
19
|
-
const domains = await getDomains();
|
|
13
|
+
const itemTypes: PageTypes[] = ['events', 'commands', 'services', 'domains'];
|
|
20
14
|
|
|
21
|
-
const
|
|
15
|
+
const allItems = await Promise.all(itemTypes.map((type) => pageDataLoader[type]()));
|
|
22
16
|
|
|
23
|
-
const
|
|
24
|
-
|
|
17
|
+
const hasOpenAPISpec = (item: CollectionEntry<CollectionTypes>) => item.data.specifications?.openapiPath !== undefined;
|
|
18
|
+
const filteredItems = allItems.map((items) => items.filter(hasOpenAPISpec));
|
|
25
19
|
|
|
26
|
-
|
|
20
|
+
return filteredItems.flatMap((items, index) =>
|
|
21
|
+
items.map((item) => ({
|
|
27
22
|
params: {
|
|
28
|
-
type:
|
|
23
|
+
type: itemTypes[index],
|
|
29
24
|
id: item.data.id,
|
|
30
25
|
version: item.data.version,
|
|
31
26
|
},
|
|
32
27
|
props: {
|
|
33
|
-
type:
|
|
28
|
+
type: itemTypes[index],
|
|
34
29
|
...item,
|
|
35
30
|
},
|
|
36
|
-
}))
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
return [...buildPages(domains), ...buildPages(events), ...buildPages(services), ...buildPages(commands)];
|
|
31
|
+
}))
|
|
32
|
+
);
|
|
40
33
|
}
|
|
41
34
|
|
|
42
35
|
// @ts-ignore
|
|
@@ -1,39 +1,35 @@
|
|
|
1
1
|
---
|
|
2
2
|
import NodeGraph from '@components/MDX/NodeGraph/NodeGraph.astro';
|
|
3
3
|
import VisualiserLayout from '@layouts/VisualiserLayout.astro';
|
|
4
|
-
import type {
|
|
5
|
-
import { getCommands } from '@utils/commands';
|
|
6
|
-
import { getDomains } from '@utils/domains/domains';
|
|
7
|
-
import { getEvents } from '@utils/events';
|
|
4
|
+
import type { PageTypes } from '@types';
|
|
8
5
|
import { getFlows } from '@utils/flows/flows';
|
|
9
|
-
import { getServices } from '@utils/services/services';
|
|
10
6
|
import { buildUrl } from '@utils/url-builder';
|
|
11
|
-
|
|
7
|
+
|
|
8
|
+
import { pageDataLoader } from '@utils/pages/pages';
|
|
9
|
+
type PageTypesWithFlows = PageTypes | 'flows';
|
|
12
10
|
|
|
13
11
|
export async function getStaticPaths() {
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
]);
|
|
12
|
+
const loaders = {
|
|
13
|
+
...pageDataLoader,
|
|
14
|
+
flows: getFlows,
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const itemTypes: PageTypesWithFlows[] = ['events', 'commands', 'services', 'domains', 'flows'];
|
|
18
|
+
const allItems = await Promise.all(itemTypes.map((type) => loaders[type]()));
|
|
21
19
|
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
return allItems.flatMap((items, index) =>
|
|
21
|
+
items.map((item) => ({
|
|
24
22
|
params: {
|
|
25
|
-
type:
|
|
23
|
+
type: itemTypes[index],
|
|
26
24
|
id: item.data.id,
|
|
27
25
|
version: item.data.version,
|
|
28
26
|
},
|
|
29
27
|
props: {
|
|
30
|
-
type:
|
|
28
|
+
type: itemTypes[index],
|
|
31
29
|
...item,
|
|
32
30
|
},
|
|
33
|
-
}))
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
return [...buildPages(services), ...buildPages(events), ...buildPages(commands), ...buildPages(domains), ...buildPages(flows)];
|
|
31
|
+
}))
|
|
32
|
+
);
|
|
37
33
|
}
|
|
38
34
|
|
|
39
35
|
const props = Astro.props;
|
package/src/types/index.ts
CHANGED
package/src/utils/messages.ts
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
//
|
|
2
|
-
|
|
1
|
+
// Exporting getCommands and getEvents directly
|
|
2
|
+
import { getCommands } from '@utils/commands';
|
|
3
|
+
import { getEvents } from '@utils/events';
|
|
4
|
+
export { getCommands } from '@utils/commands';
|
|
5
|
+
export { getEvents } from '@utils/events';
|
|
3
6
|
|
|
4
|
-
//
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
// Main function that uses the imported functions
|
|
8
|
+
export const getMessages = async () => {
|
|
9
|
+
const commands = await getCommands();
|
|
10
|
+
const events = await getEvents();
|
|
11
|
+
|
|
12
|
+
return { commands, events };
|
|
13
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { CollectionTypes, PageTypes } from '@types';
|
|
2
|
+
import { getDomains } from '@utils/domains/domains';
|
|
3
|
+
import { getCommands, getEvents } from '@utils/messages';
|
|
4
|
+
import { getServices } from '@utils/services/services';
|
|
5
|
+
import type { CollectionEntry } from 'astro:content';
|
|
6
|
+
|
|
7
|
+
export const pageDataLoader: Record<PageTypes, () => Promise<CollectionEntry<CollectionTypes>[]>> = {
|
|
8
|
+
events: getEvents,
|
|
9
|
+
commands: getCommands,
|
|
10
|
+
services: getServices,
|
|
11
|
+
domains: getDomains,
|
|
12
|
+
};
|