@eventcatalog/core 2.31.4 → 2.32.0
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-C3M26NRD.js → chunk-EIEK445B.js} +1 -1
- package/dist/{chunk-W5HUNIMM.js → chunk-NPZQE3LM.js} +1 -1
- package/dist/{chunk-H5QIDJHP.js → chunk-YXHR3YSA.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 +3 -3
- package/eventcatalog/src/components/Lists/CustomSideBarSectionList.astro +67 -0
- package/eventcatalog/src/components/MDX/MessageTable/MessageTable.client.tsx +2 -2
- package/eventcatalog/src/components/MDX/ResourceGroupTable/ResourceGroupTable.astro +126 -0
- package/eventcatalog/src/components/MDX/ResourceGroupTable/ResourceGroupTable.client.tsx +408 -0
- package/eventcatalog/src/components/MDX/components.tsx +2 -0
- package/eventcatalog/src/components/SideBars/DomainSideBar.astro +8 -0
- package/eventcatalog/src/components/SideBars/FlowSideBar.astro +8 -1
- package/eventcatalog/src/components/SideBars/MessageSideBar.astro +8 -0
- package/eventcatalog/src/components/SideBars/ServiceSideBar.astro +8 -1
- package/eventcatalog/src/components/SideNav/CustomDocsNav.astro +1 -1
- package/eventcatalog/src/components/Tables/columns/ServiceTableColumns.tsx +4 -6
- package/eventcatalog/src/components/Tables/columns/TeamsTableColumns.tsx +0 -15
- package/eventcatalog/src/content.config.ts +17 -0
- package/eventcatalog/src/enterprise/custom-documentation/components/CustomDocsNav/CustomDocsNav.astro +9 -0
- package/eventcatalog/src/enterprise/custom-documentation/components/CustomDocsNav/components/NestedItem.tsx +26 -96
- package/eventcatalog/src/enterprise/custom-documentation/components/CustomDocsNav/index.tsx +19 -16
- package/eventcatalog/src/enterprise/custom-documentation/components/CustomDocsNav/types.ts +1 -0
- package/eventcatalog/src/enterprise/custom-documentation/pages/{index.astro → docs/custom/index.astro} +10 -5
- package/eventcatalog/src/enterprise/custom-documentation/utils/custom-docs.ts +6 -3
- package/eventcatalog/src/pages/docs/custom/[...path]/index.astro +4 -4
- package/eventcatalog/src/utils/collections/icons.ts +29 -0
- package/eventcatalog/src/utils/collections/services.ts +4 -4
- package/package.json +1 -1
- package/eventcatalog/src/components/SideNav/CustomDocsNav/CustomDocsNavWrapper.tsx +0 -11
- package/eventcatalog/src/components/SideNav/CustomDocsNav/components/NestedItem.tsx +0 -183
- package/eventcatalog/src/components/SideNav/CustomDocsNav/components/NoResultsFound.tsx +0 -21
- package/eventcatalog/src/components/SideNav/CustomDocsNav/index.tsx +0 -250
- package/eventcatalog/src/components/SideNav/CustomDocsNav/types.ts +0 -29
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
log_build_default
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
5
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-EIEK445B.js";
|
|
4
|
+
import "../chunk-NPZQE3LM.js";
|
|
5
|
+
import "../chunk-YXHR3YSA.js";
|
|
6
6
|
import "../chunk-E7TXTI7G.js";
|
|
7
7
|
export {
|
|
8
8
|
log_build_default as default
|
package/dist/constants.cjs
CHANGED
package/dist/constants.js
CHANGED
package/dist/eventcatalog.cjs
CHANGED
package/dist/eventcatalog.js
CHANGED
|
@@ -6,15 +6,15 @@ import {
|
|
|
6
6
|
} from "./chunk-UKJ7F5WR.js";
|
|
7
7
|
import {
|
|
8
8
|
log_build_default
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-EIEK445B.js";
|
|
10
|
+
import "./chunk-NPZQE3LM.js";
|
|
11
11
|
import {
|
|
12
12
|
catalogToAstro,
|
|
13
13
|
checkAndConvertMdToMdx
|
|
14
14
|
} from "./chunk-7SI5EVOX.js";
|
|
15
15
|
import {
|
|
16
16
|
VERSION
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-YXHR3YSA.js";
|
|
18
18
|
import {
|
|
19
19
|
isBackstagePluginEnabled,
|
|
20
20
|
isEventCatalogProEnabled
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { buildUrl } from '@utils/url-builder';
|
|
3
|
+
import { getCollection } from 'astro:content';
|
|
4
|
+
import { getItemsFromCollectionByIdAndSemverOrLatest } from '@utils/collections/util';
|
|
5
|
+
import PillListFlat from './PillListFlat';
|
|
6
|
+
interface Props {
|
|
7
|
+
section?: {
|
|
8
|
+
title?: string;
|
|
9
|
+
limit?: number;
|
|
10
|
+
items: {
|
|
11
|
+
id: string;
|
|
12
|
+
type: string;
|
|
13
|
+
version?: string;
|
|
14
|
+
}[];
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const { section } = Astro.props;
|
|
19
|
+
const title = section?.title || 'Custom Section';
|
|
20
|
+
const limit = section?.limit || 10;
|
|
21
|
+
const sectionItems = section?.items || [];
|
|
22
|
+
|
|
23
|
+
// Type-safe mapping of resource types to collection names
|
|
24
|
+
const resourceToCollectionMap = {
|
|
25
|
+
service: 'services',
|
|
26
|
+
event: 'events',
|
|
27
|
+
command: 'commands',
|
|
28
|
+
query: 'queries',
|
|
29
|
+
domain: 'domains',
|
|
30
|
+
flow: 'flows',
|
|
31
|
+
channel: 'channels',
|
|
32
|
+
user: 'users',
|
|
33
|
+
team: 'teams',
|
|
34
|
+
} as const; // Make this a const assertion
|
|
35
|
+
|
|
36
|
+
// Array to store resolved related resources
|
|
37
|
+
const resolvedResources = [];
|
|
38
|
+
|
|
39
|
+
// Fetch related resources
|
|
40
|
+
for (const resource of sectionItems) {
|
|
41
|
+
try {
|
|
42
|
+
// Use type assertion to ensure TypeScript understands this is a valid collection name
|
|
43
|
+
const collectionName = resourceToCollectionMap[resource.type as keyof typeof resourceToCollectionMap];
|
|
44
|
+
|
|
45
|
+
// Use getEntry instead of getCollection for single item lookup by ID
|
|
46
|
+
const allItemsInCollection = await getCollection(collectionName);
|
|
47
|
+
// @ts-ignore
|
|
48
|
+
const entryToMatchVersion = getItemsFromCollectionByIdAndSemverOrLatest(allItemsInCollection, resource.id, resource.version);
|
|
49
|
+
const entry = entryToMatchVersion[0];
|
|
50
|
+
|
|
51
|
+
if (entry) {
|
|
52
|
+
resolvedResources.push(entry);
|
|
53
|
+
}
|
|
54
|
+
} catch (error) {
|
|
55
|
+
console.error(`Failed to fetch related resource: ${resource.id} of type ${resource.type}`, error);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const sectionList = resolvedResources.map((p: any) => ({
|
|
60
|
+
label: `${p.data.name}`,
|
|
61
|
+
tag: `v${p.data.version}`,
|
|
62
|
+
collection: p.collection,
|
|
63
|
+
href: buildUrl(`/docs/${p.collection}/${p.data.id}/${p.data.version}`),
|
|
64
|
+
}));
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
<PillListFlat title={`${title} (${sectionList.length})`} pills={sectionList} color="orange" limit={limit} client:load />
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getColorAndIconForCollection } from '@utils/collections/icons';
|
|
2
2
|
import { buildUrl } from '@utils/url-builder';
|
|
3
3
|
import { useState, useMemo, useCallback, memo } from 'react';
|
|
4
4
|
|
|
@@ -25,7 +25,7 @@ type MessageType = 'event' | 'query' | 'command' | null;
|
|
|
25
25
|
|
|
26
26
|
const MessageRow = memo(
|
|
27
27
|
({ message, showChannels, collection }: { message: MessageTableMessage; showChannels?: boolean; collection: string }) => {
|
|
28
|
-
const { color, Icon } =
|
|
28
|
+
const { color, Icon } = getColorAndIconForCollection(message.collection);
|
|
29
29
|
const url = buildUrl(`/docs/${collection}/${message.id}/${message.version}`);
|
|
30
30
|
let type = collection.slice(0, -1);
|
|
31
31
|
type = type === 'querie' ? 'query' : type;
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { CollectionEntry } from 'astro:content';
|
|
3
|
+
import { getCollection } from 'astro:content';
|
|
4
|
+
import { getItemsFromCollectionByIdAndSemverOrLatest } from '@utils/collections/util';
|
|
5
|
+
import ResourceGroupTableClient from './ResourceGroupTable.client';
|
|
6
|
+
import Admonition from '../Admonition';
|
|
7
|
+
|
|
8
|
+
export interface Props extends CollectionEntry<'services'> {
|
|
9
|
+
limit?: number;
|
|
10
|
+
id: string;
|
|
11
|
+
showTags?: boolean;
|
|
12
|
+
showOwners?: boolean;
|
|
13
|
+
title?: string;
|
|
14
|
+
subtitle?: string;
|
|
15
|
+
description?: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const {
|
|
19
|
+
id,
|
|
20
|
+
limit,
|
|
21
|
+
showTags = false,
|
|
22
|
+
showOwners = false,
|
|
23
|
+
title = 'Resources',
|
|
24
|
+
subtitle,
|
|
25
|
+
description = 'Browse resources in this group or search by name, type, or description.',
|
|
26
|
+
...resource
|
|
27
|
+
} = Astro.props;
|
|
28
|
+
|
|
29
|
+
// Find the requested resource group section by ID
|
|
30
|
+
const section = resource.data.resourceGroups?.find((section: any) => section.id === id);
|
|
31
|
+
|
|
32
|
+
const collection = Astro.props.collection as 'services' | 'domains';
|
|
33
|
+
|
|
34
|
+
// Type-safe mapping of resource types to collection names
|
|
35
|
+
const resourceToCollectionMap = {
|
|
36
|
+
service: 'services',
|
|
37
|
+
event: 'events',
|
|
38
|
+
command: 'commands',
|
|
39
|
+
query: 'queries',
|
|
40
|
+
domain: 'domains',
|
|
41
|
+
flow: 'flows',
|
|
42
|
+
channel: 'channels',
|
|
43
|
+
user: 'users',
|
|
44
|
+
team: 'teams',
|
|
45
|
+
} as const;
|
|
46
|
+
|
|
47
|
+
// This will hold our processed resources for the client component
|
|
48
|
+
const resolvedResources: any[] = [];
|
|
49
|
+
|
|
50
|
+
// Process each resource item in the section
|
|
51
|
+
if (section?.items) {
|
|
52
|
+
for (const item of section.items) {
|
|
53
|
+
// Get the collection name from the resource type
|
|
54
|
+
const collectionName = resourceToCollectionMap[item.type as keyof typeof resourceToCollectionMap];
|
|
55
|
+
|
|
56
|
+
if (!collectionName) continue;
|
|
57
|
+
|
|
58
|
+
try {
|
|
59
|
+
// Get all items in the collection
|
|
60
|
+
const allItemsInCollection = await getCollection(collectionName);
|
|
61
|
+
|
|
62
|
+
// Find the specific version of the resource
|
|
63
|
+
const matchedItems = getItemsFromCollectionByIdAndSemverOrLatest(allItemsInCollection as any, item.id, item.version);
|
|
64
|
+
|
|
65
|
+
if (matchedItems.length > 0) {
|
|
66
|
+
const entry = matchedItems[0] as any;
|
|
67
|
+
|
|
68
|
+
// Create a simplified resource object for the client component
|
|
69
|
+
resolvedResources.push({
|
|
70
|
+
id: entry.data?.id || entry.id || item.id,
|
|
71
|
+
name: entry.data?.name || item.id,
|
|
72
|
+
version: entry.data?.version || item.version || '1.0.0',
|
|
73
|
+
collection: entry.collection || collectionName,
|
|
74
|
+
type: item.type,
|
|
75
|
+
summary: entry.data?.summary || '',
|
|
76
|
+
description: entry.data?.description || '',
|
|
77
|
+
owners: entry.data?.owners || [],
|
|
78
|
+
tags: entry.data?.tags || [],
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
} catch (error) {
|
|
82
|
+
console.error(`Error processing resource ${item.id} of type ${item.type}:`, error);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
{
|
|
89
|
+
resolvedResources.length > 0 && (
|
|
90
|
+
<ResourceGroupTableClient
|
|
91
|
+
client:load
|
|
92
|
+
resources={resolvedResources}
|
|
93
|
+
limit={limit}
|
|
94
|
+
title={title}
|
|
95
|
+
subtitle={subtitle}
|
|
96
|
+
description={description}
|
|
97
|
+
showTags={showTags}
|
|
98
|
+
showOwners={showOwners}
|
|
99
|
+
/>
|
|
100
|
+
)
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
{
|
|
104
|
+
!resolvedResources.length && (
|
|
105
|
+
<Admonition type="warning">
|
|
106
|
+
<div>
|
|
107
|
+
{`<ResourceGroupTable/>`} cannot find any resources in your catalog for the resource group with id {id}.
|
|
108
|
+
</div>
|
|
109
|
+
</Admonition>
|
|
110
|
+
)
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
{
|
|
114
|
+
!section && (
|
|
115
|
+
<Admonition type="warning">
|
|
116
|
+
<div>
|
|
117
|
+
<span class="font-bold">
|
|
118
|
+
{`<ResourceGroupTable/>`} cannot find the resource group with id {id}.
|
|
119
|
+
</span>
|
|
120
|
+
<span class="block">
|
|
121
|
+
Please make sure the id is correct and the resource group is defined in this {collection.slice(0, -1)}.
|
|
122
|
+
</span>
|
|
123
|
+
</div>
|
|
124
|
+
</Admonition>
|
|
125
|
+
)
|
|
126
|
+
}
|