@eventcatalog/core 2.49.3 → 2.49.5
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-QXSGLYMA.js → chunk-BUPT4PSW.js} +1 -1
- package/dist/{chunk-DRNVNFGC.js → chunk-SRWBNIXA.js} +1 -1
- package/dist/{chunk-L6MICE4M.js → chunk-XHCERMFT.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/CopyAsMarkdown.tsx +18 -2
- package/eventcatalog/src/content.config.ts +1 -0
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/index.astro +19 -2
- package/eventcatalog/src/pages/docs/[type]/[id]/language/[dictionaryId]/_index.data.ts +83 -0
- package/eventcatalog/src/pages/docs/[type]/[id]/language/[dictionaryId]/index.astro +5 -39
- package/eventcatalog/src/utils/url-builder.ts +6 -0
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
log_build_default
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
5
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-BUPT4PSW.js";
|
|
4
|
+
import "../chunk-SRWBNIXA.js";
|
|
5
|
+
import "../chunk-XHCERMFT.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,8 +6,8 @@ import {
|
|
|
6
6
|
} from "./chunk-XE6PFSH5.js";
|
|
7
7
|
import {
|
|
8
8
|
log_build_default
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-BUPT4PSW.js";
|
|
10
|
+
import "./chunk-SRWBNIXA.js";
|
|
11
11
|
import {
|
|
12
12
|
catalogToAstro,
|
|
13
13
|
checkAndConvertMdToMdx
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
import "./chunk-LDBRNJIL.js";
|
|
16
16
|
import {
|
|
17
17
|
VERSION
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-XHCERMFT.js";
|
|
19
19
|
import {
|
|
20
20
|
isAuthEnabled,
|
|
21
21
|
isBackstagePluginEnabled,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { Button } from '@headlessui/react';
|
|
2
1
|
import * as DropdownMenu from '@radix-ui/react-dropdown-menu';
|
|
3
|
-
import { Copy, FileText, MessageCircleQuestion, ChevronDownIcon, ExternalLink } from 'lucide-react';
|
|
2
|
+
import { Copy, FileText, MessageCircleQuestion, ChevronDownIcon, ExternalLink, PenSquareIcon } from 'lucide-react';
|
|
4
3
|
import React, { useState, isValidElement } from 'react';
|
|
5
4
|
import type { Schema } from '@utils/collections/schemas';
|
|
6
5
|
import { buildUrl } from '@utils/url-builder';
|
|
@@ -47,10 +46,12 @@ export function CopyPageMenu({
|
|
|
47
46
|
schemas,
|
|
48
47
|
chatQuery,
|
|
49
48
|
chatEnabled = false,
|
|
49
|
+
editUrl,
|
|
50
50
|
}: {
|
|
51
51
|
schemas: Schema[];
|
|
52
52
|
chatQuery?: string;
|
|
53
53
|
chatEnabled: boolean;
|
|
54
|
+
editUrl: string;
|
|
54
55
|
}) {
|
|
55
56
|
const [buttonText, setButtonText] = useState('Copy page');
|
|
56
57
|
|
|
@@ -136,6 +137,20 @@ export function CopyPageMenu({
|
|
|
136
137
|
<MenuItemContent icon={Copy} title="Copy page" description="Copy page as Markdown for LLMs" />
|
|
137
138
|
</DropdownMenu.Item>
|
|
138
139
|
|
|
140
|
+
{editUrl && (
|
|
141
|
+
<DropdownMenu.Item
|
|
142
|
+
className="cursor-pointer hover:bg-gray-100 focus:outline-none focus:bg-gray-100"
|
|
143
|
+
onSelect={() => window.open(editUrl, '_blank')}
|
|
144
|
+
>
|
|
145
|
+
<MenuItemContent
|
|
146
|
+
icon={PenSquareIcon}
|
|
147
|
+
title="Edit page"
|
|
148
|
+
description="Edit the contents of this page"
|
|
149
|
+
external={true}
|
|
150
|
+
/>
|
|
151
|
+
</DropdownMenu.Item>
|
|
152
|
+
)}
|
|
153
|
+
|
|
139
154
|
{schemas.map((schema) => {
|
|
140
155
|
const title =
|
|
141
156
|
schema.format === 'asyncapi'
|
|
@@ -166,6 +181,7 @@ export function CopyPageMenu({
|
|
|
166
181
|
</DropdownMenu.Item>
|
|
167
182
|
);
|
|
168
183
|
})}
|
|
184
|
+
|
|
169
185
|
<DropdownMenu.Item
|
|
170
186
|
className="cursor-pointer hover:bg-gray-100 focus:outline-none focus:bg-gray-100"
|
|
171
187
|
onSelect={() => window.open(markdownUrl, '_blank')}
|
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
MagnifyingGlassIcon,
|
|
31
31
|
} from '@heroicons/react/24/outline';
|
|
32
32
|
import { ArrowsRightLeftIcon } from '@heroicons/react/20/solid';
|
|
33
|
-
import { Box, Boxes } from 'lucide-react';
|
|
33
|
+
import { Box, Boxes, SquarePenIcon } from 'lucide-react';
|
|
34
34
|
import type { CollectionTypes } from '@types';
|
|
35
35
|
|
|
36
36
|
import { render } from 'astro:content';
|
|
@@ -38,7 +38,7 @@ import type { CollectionEntry } from 'astro:content';
|
|
|
38
38
|
|
|
39
39
|
import { getIcon } from '@utils/badges';
|
|
40
40
|
import { getDeprecatedDetails } from '@utils/collections/util';
|
|
41
|
-
import { buildUrl } from '@utils/url-builder';
|
|
41
|
+
import { buildUrl, buildEditUrlForResource } from '@utils/url-builder';
|
|
42
42
|
import { getSchemasFromResource } from '@utils/collections/schemas';
|
|
43
43
|
import { isEventCatalogChatEnabled, isMarkdownDownloadEnabled } from '@utils/feature';
|
|
44
44
|
|
|
@@ -57,6 +57,8 @@ const { Content } = await render(props);
|
|
|
57
57
|
|
|
58
58
|
const pageTitle = `${props.collection} | ${props.data.name}`.replace(/^\w/, (c) => c.toUpperCase());
|
|
59
59
|
const contentBadges = props.data.badges || [];
|
|
60
|
+
const editUrl =
|
|
61
|
+
props.data.editUrl || (config.editUrl && props?.filePath ? buildEditUrlForResource(config.editUrl, props?.filePath) : '');
|
|
60
62
|
|
|
61
63
|
const getContentBadges = () =>
|
|
62
64
|
contentBadges.map((badge: any) => ({
|
|
@@ -218,6 +220,7 @@ nodeGraphs.push({
|
|
|
218
220
|
schemas={schemasForResource}
|
|
219
221
|
chatQuery={generatePromptForResource(props)}
|
|
220
222
|
chatEnabled={isEventCatalogChatEnabled()}
|
|
223
|
+
editUrl={editUrl}
|
|
221
224
|
/>
|
|
222
225
|
</div>
|
|
223
226
|
)
|
|
@@ -362,6 +365,20 @@ nodeGraphs.push({
|
|
|
362
365
|
}
|
|
363
366
|
</div>
|
|
364
367
|
<Footer />
|
|
368
|
+
<!-- Add edit this page button with icon and text-->
|
|
369
|
+
<div class="flex justify-end">
|
|
370
|
+
<!-- Built with EventCatalog -->
|
|
371
|
+
{
|
|
372
|
+
editUrl && (
|
|
373
|
+
<div class="flex justify-end">
|
|
374
|
+
<a href={editUrl} class="text-sm text-gray-700 hover:text-gray-700 border border-gray-200 rounded-md p-2">
|
|
375
|
+
<SquarePenIcon className="w-4 h-4 inline-block mr-1" />
|
|
376
|
+
Edit this page
|
|
377
|
+
</a>
|
|
378
|
+
</div>
|
|
379
|
+
)
|
|
380
|
+
}
|
|
381
|
+
</div>
|
|
365
382
|
</div>
|
|
366
383
|
<aside class="hidden lg:block sticky top-0 pb-10 w-96 overflow-y-auto py-2" data-pagefind-ignore>
|
|
367
384
|
<!-- @ts-ignore -->
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { getUbiquitousLanguage } from '@utils/collections/domains';
|
|
2
|
+
import { getDomains } from '@utils/collections/domains';
|
|
3
|
+
import { isSSR } from '@utils/feature';
|
|
4
|
+
import { HybridPage } from '@utils/page-loaders/hybrid-page';
|
|
5
|
+
|
|
6
|
+
export class Page extends HybridPage {
|
|
7
|
+
static async getStaticPaths() {
|
|
8
|
+
if (isSSR()) {
|
|
9
|
+
return [];
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const domains = await getDomains({ getAllVersions: false });
|
|
13
|
+
|
|
14
|
+
const pages = await domains.reduce<Promise<any[]>>(async (acc, domain) => {
|
|
15
|
+
const accumulator = await acc;
|
|
16
|
+
const ubiquitousLanguages = await getUbiquitousLanguage(domain);
|
|
17
|
+
|
|
18
|
+
if (ubiquitousLanguages.length === 0) {
|
|
19
|
+
return accumulator;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const dictionary = ubiquitousLanguages[0].data.dictionary;
|
|
23
|
+
|
|
24
|
+
if (!dictionary) {
|
|
25
|
+
return accumulator;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return [
|
|
29
|
+
...accumulator,
|
|
30
|
+
...dictionary.map((item) => ({
|
|
31
|
+
params: {
|
|
32
|
+
type: domain.collection,
|
|
33
|
+
id: domain.data.id,
|
|
34
|
+
dictionaryId: item.id,
|
|
35
|
+
},
|
|
36
|
+
props: {
|
|
37
|
+
type: domain.collection,
|
|
38
|
+
domainId: domain.data.id,
|
|
39
|
+
domain: domain.data,
|
|
40
|
+
ubiquitousLanguage: item,
|
|
41
|
+
...item,
|
|
42
|
+
},
|
|
43
|
+
})),
|
|
44
|
+
];
|
|
45
|
+
}, Promise.resolve([]));
|
|
46
|
+
|
|
47
|
+
return pages;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
protected static async fetchData(params: any) {
|
|
51
|
+
const { getDomains } = await import('@utils/collections/domains');
|
|
52
|
+
const domains = await getDomains({ getAllVersions: false });
|
|
53
|
+
|
|
54
|
+
const domain = domains.find((d) => d.data.id === params.id && d.collection === params.type);
|
|
55
|
+
if (!domain) return null;
|
|
56
|
+
|
|
57
|
+
const ubiquitousLanguages = await getUbiquitousLanguage(domain);
|
|
58
|
+
if (ubiquitousLanguages.length === 0) return null;
|
|
59
|
+
|
|
60
|
+
// Find the ubiquitous language that contains our dictionary item
|
|
61
|
+
const ubiquitousLanguage = ubiquitousLanguages.find((l) => l.data.dictionary?.some((d) => d.id === params.dictionaryId));
|
|
62
|
+
if (!ubiquitousLanguage) return null;
|
|
63
|
+
|
|
64
|
+
// Find the specific dictionary item
|
|
65
|
+
const item = ubiquitousLanguage.data.dictionary?.find((d) => d.id === params.dictionaryId);
|
|
66
|
+
if (!item) return null;
|
|
67
|
+
|
|
68
|
+
return {
|
|
69
|
+
type: domain.collection,
|
|
70
|
+
domainId: domain.data.id,
|
|
71
|
+
domain: domain.data,
|
|
72
|
+
ubiquitousLanguage: item,
|
|
73
|
+
...item,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
protected static createNotFoundResponse(): Response {
|
|
78
|
+
return new Response(null, {
|
|
79
|
+
status: 404,
|
|
80
|
+
statusText: 'Domain not found',
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
}
|
|
@@ -2,51 +2,17 @@
|
|
|
2
2
|
import RectangleGroupIcon from '@heroicons/react/24/outline/RectangleGroupIcon';
|
|
3
3
|
import Footer from '@layouts/Footer.astro';
|
|
4
4
|
import VerticalSideBarLayout from '@layouts/VerticalSideBarLayout.astro';
|
|
5
|
-
import { getDomains, getUbiquitousLanguage } from '@utils/collections/domains';
|
|
6
5
|
import { buildUrl } from '@utils/url-builder';
|
|
7
6
|
import { ClientRouter } from 'astro:transitions';
|
|
8
7
|
import { marked } from 'marked';
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
const domains = await getDomains({ getAllVersions: false });
|
|
9
|
+
import { Page } from './_index.data';
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const ubiquitousLanguages = await getUbiquitousLanguage(domain);
|
|
11
|
+
export const prerender = Page.prerender;
|
|
12
|
+
export const getStaticPaths = Page.getStaticPaths;
|
|
16
13
|
|
|
17
|
-
|
|
18
|
-
return accumulator;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const dictionary = ubiquitousLanguages[0].data.dictionary;
|
|
22
|
-
|
|
23
|
-
if (!dictionary) {
|
|
24
|
-
return accumulator;
|
|
25
|
-
}
|
|
14
|
+
const props = await Page.getData(Astro);
|
|
26
15
|
|
|
27
|
-
return [
|
|
28
|
-
...accumulator,
|
|
29
|
-
...dictionary.map((item) => ({
|
|
30
|
-
params: {
|
|
31
|
-
type: domain.collection,
|
|
32
|
-
id: domain.data.id,
|
|
33
|
-
dictionaryId: item.id,
|
|
34
|
-
},
|
|
35
|
-
props: {
|
|
36
|
-
type: domain.collection,
|
|
37
|
-
domainId: domain.data.id,
|
|
38
|
-
domain: domain.data,
|
|
39
|
-
ubiquitousLanguage: item,
|
|
40
|
-
...item,
|
|
41
|
-
},
|
|
42
|
-
})),
|
|
43
|
-
];
|
|
44
|
-
}, Promise.resolve([]));
|
|
45
|
-
|
|
46
|
-
return pages;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const props = Astro.props;
|
|
50
16
|
const { ubiquitousLanguage } = props;
|
|
51
17
|
const pageTitle = `${props.type} | ${ubiquitousLanguage.name}`.replace(/^\w/, (c) => c.toUpperCase());
|
|
52
18
|
|
|
@@ -89,7 +55,7 @@ const badges = [
|
|
|
89
55
|
>
|
|
90
56
|
<path stroke-linecap="round" stroke-linejoin="round" d="M10.5 19.5L3 12m0 0l7.5-7.5M3 12h18"></path>
|
|
91
57
|
</svg>
|
|
92
|
-
Back to
|
|
58
|
+
Back to Ubiquitous Language List
|
|
93
59
|
</a>
|
|
94
60
|
</li>
|
|
95
61
|
</ol>
|
|
@@ -42,3 +42,9 @@ export const buildUrlWithParams = (baseUrl: string, params: Record<string, strin
|
|
|
42
42
|
|
|
43
43
|
return `${buildUrl(baseUrl)}?${queryString}`;
|
|
44
44
|
};
|
|
45
|
+
|
|
46
|
+
export const buildEditUrlForResource = (editUrl: string, filePath: string) => {
|
|
47
|
+
// filepath may have ../ or ./ in it, so we need to remove it
|
|
48
|
+
const cleanFilePath = filePath.replace(/^\.\.?\//g, '');
|
|
49
|
+
return `${editUrl}/${cleanFilePath}`;
|
|
50
|
+
};
|