@eventcatalog/core 3.13.0-beta.2 → 3.14.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/catalog-to-astro-content-directory.cjs +1 -1
- package/dist/{chunk-XIZQ27W3.js → chunk-2OZIUQR5.js} +1 -1
- package/dist/{chunk-PBMJ6OIP.js → chunk-BWF7CUGM.js} +1 -1
- package/dist/{chunk-QCHSOWJP.js → chunk-KZCWZ5PZ.js} +1 -1
- package/dist/{chunk-VQJRAI3N.js → chunk-Q23QNBZG.js} +1 -1
- package/dist/{chunk-GC6XBLGZ.js → chunk-SJ5OPJEM.js} +1 -1
- package/dist/constants.cjs +1 -1
- package/dist/constants.js +1 -1
- package/dist/eventcatalog.cjs +66 -4
- package/dist/eventcatalog.config.d.cts +2 -1
- package/dist/eventcatalog.config.d.ts +2 -1
- package/dist/eventcatalog.js +70 -7
- package/dist/generate.cjs +1 -1
- package/dist/generate.js +3 -3
- package/dist/utils/cli-logger.cjs +1 -1
- package/dist/utils/cli-logger.js +2 -2
- package/eventcatalog/integrations/eventcatalog-features.ts +9 -0
- package/eventcatalog/src/components/Header.astro +5 -5
- package/eventcatalog/src/components/MDX/NodeGraph/AstroNodeGraph.tsx +14 -11
- package/eventcatalog/src/components/MDX/NodeGraph/NodeGraphPortal.tsx +1 -1
- package/eventcatalog/src/components/MDX/RemoteFile.astro +5 -16
- package/eventcatalog/src/components/Search/Search.astro +1 -1
- package/eventcatalog/src/components/Search/SearchDataLoader.astro +25 -13
- package/eventcatalog/src/components/Search/SearchModal.tsx +101 -39
- package/eventcatalog/src/components/ThemeToggle.tsx +11 -3
- package/eventcatalog/src/content.config.ts +12 -11
- package/eventcatalog/src/enterprise/api/catalog.ts +22 -0
- package/eventcatalog/src/pages/api/search-index.json.ts +46 -0
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/asyncapi/[filename].astro +51 -5
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/spec/_OpenAPI.tsx +26 -21
- package/eventcatalog/src/pages/visualiser/[type]/[id]/[version]/data/_index.data.ts +4 -4
- package/eventcatalog/src/pages/visualiser/[type]/[id]/[version]/data/index.astro +7 -2
- package/eventcatalog/src/pages/visualiser/[type]/[id]/[version]/index.astro +7 -2
- package/eventcatalog/src/pages/visualiser/[type]/[id]/index.astro +5 -0
- package/eventcatalog/src/pages/visualiser/context-map/index.astro +2 -2
- package/eventcatalog/src/pages/visualiser/designs/[id]/_index.data.ts +4 -4
- package/eventcatalog/src/pages/visualiser/designs/[id]/index.astro +6 -2
- package/eventcatalog/src/pages/visualiser/domain-integrations/index.astro +2 -2
- package/eventcatalog/src/pages/visualiser/domains/[id]/[version]/entity-map/index.astro +7 -2
- package/eventcatalog/src/utils/collections/util.ts +2 -0
- package/eventcatalog/src/utils/eventcatalog-config/catalog.ts +3 -18
- package/eventcatalog/src/utils/feature.ts +2 -0
- package/eventcatalog/src/utils/remote-file.ts +15 -0
- package/eventcatalog/src/utils/remote-spec.ts +45 -0
- package/package.json +4 -4
- package/eventcatalog/src/pages/api/catalog.ts +0 -34
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { HybridPage } from '@utils/page-loaders/hybrid-page';
|
|
2
|
-
import { isAuthEnabled } from '@utils/feature';
|
|
2
|
+
import { isAuthEnabled, isVisualiserEnabled } from '@utils/feature';
|
|
3
3
|
|
|
4
4
|
export class Page extends HybridPage {
|
|
5
5
|
static async getStaticPaths(): Promise<Array<{ params: any; props: any }>> {
|
|
6
|
-
if (isAuthEnabled()) {
|
|
6
|
+
if (isAuthEnabled() || !isVisualiserEnabled()) {
|
|
7
7
|
return [];
|
|
8
8
|
}
|
|
9
9
|
|
|
@@ -26,7 +26,7 @@ export class Page extends HybridPage {
|
|
|
26
26
|
protected static async fetchData(params: any) {
|
|
27
27
|
const { id } = params;
|
|
28
28
|
|
|
29
|
-
if (!id) {
|
|
29
|
+
if (!id || !isVisualiserEnabled()) {
|
|
30
30
|
return null;
|
|
31
31
|
}
|
|
32
32
|
|
|
@@ -53,7 +53,7 @@ export class Page extends HybridPage {
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
static get clientAuthScript(): string {
|
|
56
|
-
if (!isAuthEnabled()) {
|
|
56
|
+
if (!isAuthEnabled() || !isVisualiserEnabled()) {
|
|
57
57
|
return '';
|
|
58
58
|
}
|
|
59
59
|
|
|
@@ -17,8 +17,12 @@ const { data } = props;
|
|
|
17
17
|
---
|
|
18
18
|
|
|
19
19
|
<VerticalSideBarLayout title={`Visualiser | Bounded context map`}>
|
|
20
|
-
<div class="
|
|
21
|
-
<div
|
|
20
|
+
<div class="m-4">
|
|
21
|
+
<div
|
|
22
|
+
class="h-[calc(100vh-130px)] w-full relative border border-[rgb(var(--ec-page-border))] rounded-md"
|
|
23
|
+
id={`${data.id}-portal`}
|
|
24
|
+
transition:animate="fade"
|
|
25
|
+
>
|
|
22
26
|
</div>
|
|
23
27
|
<AstroNodeGraph
|
|
24
28
|
id={data.id}
|
|
@@ -6,9 +6,9 @@ import { ClientRouter } from 'astro:transitions';
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
<VisualiserLayout title={`Visualiser | Domain Architecture`} description="High-level view of all domains and their relationships">
|
|
9
|
-
<div class="
|
|
9
|
+
<div class="m-4">
|
|
10
10
|
<div
|
|
11
|
-
class="h-[calc(100vh-130px)] w-full relative border border-
|
|
11
|
+
class="h-[calc(100vh-130px)] w-full relative border border-[rgb(var(--ec-page-border))] rounded-md"
|
|
12
12
|
id="domains-canvas-portal"
|
|
13
13
|
transition:animate="fade"
|
|
14
14
|
>
|
|
@@ -19,8 +19,13 @@ const {
|
|
|
19
19
|
---
|
|
20
20
|
|
|
21
21
|
<VisualiserLayout title={`Visualiser | ${props.data.name} (${props.collection})`} description={props.data.summary}>
|
|
22
|
-
<div class="
|
|
23
|
-
<div
|
|
22
|
+
<div class="m-4">
|
|
23
|
+
<div
|
|
24
|
+
class="h-[calc(100vh-130px)] w-full relative border border-[rgb(var(--ec-page-border))] rounded-md"
|
|
25
|
+
id={`${id}-portal`}
|
|
26
|
+
transition:animate="fade"
|
|
27
|
+
>
|
|
28
|
+
</div>
|
|
24
29
|
<NodeGraph
|
|
25
30
|
id={id}
|
|
26
31
|
collection={`${collection}-entities`}
|
|
@@ -21,6 +21,7 @@ export interface SpecificationInput {
|
|
|
21
21
|
type: SpecificationType;
|
|
22
22
|
path: string;
|
|
23
23
|
name?: string;
|
|
24
|
+
headers?: Record<string, string>;
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
export interface ProcessedSpecification {
|
|
@@ -29,6 +30,7 @@ export interface ProcessedSpecification {
|
|
|
29
30
|
name: string;
|
|
30
31
|
filename: string;
|
|
31
32
|
filenameWithoutExtension: string;
|
|
33
|
+
headers?: Record<string, string>;
|
|
32
34
|
}
|
|
33
35
|
|
|
34
36
|
export const getDefaultSpecificationName = (type: string): string => {
|
|
@@ -1,22 +1,7 @@
|
|
|
1
1
|
import * as config from '@config';
|
|
2
|
+
import type { Config } from '../../../../src/eventcatalog.config';
|
|
2
3
|
|
|
3
|
-
type
|
|
4
|
-
visible?: boolean;
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
export type CatalogConfig = {
|
|
8
|
-
docs: {
|
|
9
|
-
sidebar: {
|
|
10
|
-
showPageHeadings?: boolean;
|
|
11
|
-
domains?: SideBarItemConfig;
|
|
12
|
-
flows?: SideBarItemConfig;
|
|
13
|
-
services?: SideBarItemConfig;
|
|
14
|
-
messages?: SideBarItemConfig;
|
|
15
|
-
teams?: SideBarItemConfig;
|
|
16
|
-
users?: SideBarItemConfig;
|
|
17
|
-
};
|
|
18
|
-
};
|
|
19
|
-
};
|
|
4
|
+
export type CatalogConfig = Config;
|
|
20
5
|
|
|
21
6
|
const getConfigValue = (obj: any, key: string, defaultValue: any) => {
|
|
22
7
|
return obj?.[key] ?? defaultValue;
|
|
@@ -44,4 +29,4 @@ export const isCollectionVisibleInCatalog = (collection: string) => {
|
|
|
44
29
|
return getConfigValue(collectionConfig, 'visible', true);
|
|
45
30
|
};
|
|
46
31
|
|
|
47
|
-
export default config.default;
|
|
32
|
+
export default config.default as CatalogConfig;
|
|
@@ -72,4 +72,6 @@ export const isDiagramComparisonEnabled = () => isEventCatalogScaleEnabled();
|
|
|
72
72
|
|
|
73
73
|
export const isEventCatalogMCPEnabled = () => isEventCatalogScaleEnabled() && isSSR();
|
|
74
74
|
|
|
75
|
+
export const isFullCatalogAPIEnabled = () => config?.api?.fullCatalogAPIEnabled ?? false;
|
|
76
|
+
|
|
75
77
|
export const isDevMode = () => process.env.EVENTCATALOG_DEV_MODE === 'true';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export function resolveTemplateVariables(input: unknown): unknown {
|
|
2
|
+
if (typeof input === 'string') {
|
|
3
|
+
return input.replace(/\$\{(\w+)\}/g, (_, varName) => {
|
|
4
|
+
// Vite may statically replace import.meta.env in SSR builds;
|
|
5
|
+
// process.env keeps runtime env access for dynamic keys.
|
|
6
|
+
return import.meta.env[varName] || process.env[varName] || '';
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
if (typeof input === 'object' && input !== null) {
|
|
11
|
+
return Object.fromEntries(Object.entries(input).map(([key, value]) => [key, resolveTemplateVariables(value)]));
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return input;
|
|
15
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export const SAFE_ENV_PREFIXES = ['EVENTCATALOG_', 'EC_'];
|
|
2
|
+
|
|
3
|
+
const isAllowedEnvVariable = (varName: string, allowAnyEnvInHeaders: boolean): boolean => {
|
|
4
|
+
if (allowAnyEnvInHeaders) return true;
|
|
5
|
+
return SAFE_ENV_PREFIXES.some((prefix) => varName.startsWith(prefix));
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export const resolveHeaderTemplates = (
|
|
9
|
+
value: string,
|
|
10
|
+
{
|
|
11
|
+
allowAnyEnvInHeaders = false,
|
|
12
|
+
}: {
|
|
13
|
+
allowAnyEnvInHeaders?: boolean;
|
|
14
|
+
} = {}
|
|
15
|
+
): string => {
|
|
16
|
+
return value.replace(/\$\{(\w+)\}/g, (_, varName) => {
|
|
17
|
+
if (!isAllowedEnvVariable(varName, allowAnyEnvInHeaders)) {
|
|
18
|
+
return '';
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// import.meta.env works in Vite contexts, process.env is the runtime fallback for SSR.
|
|
22
|
+
return import.meta.env[varName] || process.env[varName] || '';
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export const resolveHeaders = (
|
|
27
|
+
headers: Record<string, string>,
|
|
28
|
+
{
|
|
29
|
+
allowAnyEnvInHeaders = false,
|
|
30
|
+
}: {
|
|
31
|
+
allowAnyEnvInHeaders?: boolean;
|
|
32
|
+
} = {}
|
|
33
|
+
): Record<string, string> => {
|
|
34
|
+
return Object.fromEntries(
|
|
35
|
+
Object.entries(headers).map(([key, value]) => [key, resolveHeaderTemplates(String(value), { allowAnyEnvInHeaders })])
|
|
36
|
+
);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const isSameOrigin = (sourceUrl: string, targetUrl: string): boolean => {
|
|
40
|
+
try {
|
|
41
|
+
return new URL(sourceUrl).origin === new URL(targetUrl).origin;
|
|
42
|
+
} catch {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
};
|
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": "3.
|
|
9
|
+
"version": "3.14.0",
|
|
10
10
|
"publishConfig": {
|
|
11
11
|
"access": "public"
|
|
12
12
|
},
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"@ai-sdk/react": "^3.0.17",
|
|
24
24
|
"@astrojs/markdown-remark": "^6.3.10",
|
|
25
25
|
"@astrojs/mdx": "^4.3.13",
|
|
26
|
-
"@astrojs/node": "^9.5.
|
|
26
|
+
"@astrojs/node": "^9.5.3",
|
|
27
27
|
"@astrojs/react": "^4.4.2",
|
|
28
28
|
"@astrojs/rss": "^4.0.15",
|
|
29
29
|
"@astrojs/tailwind": "^6.0.2",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"@tanstack/react-table": "^8.17.3",
|
|
51
51
|
"@xyflow/react": "^12.3.6",
|
|
52
52
|
"ai": "^6.0.17",
|
|
53
|
-
"astro": "^5.17.
|
|
53
|
+
"astro": "^5.17.2",
|
|
54
54
|
"astro-compress": "^2.3.8",
|
|
55
55
|
"astro-expressive-code": "^0.41.3",
|
|
56
56
|
"astro-seo": "^0.8.4",
|
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
"zod": "^3.25.0",
|
|
104
104
|
"@eventcatalog/linter": "1.0.3",
|
|
105
105
|
"@eventcatalog/sdk": "2.13.2",
|
|
106
|
-
"@eventcatalog/visualiser": "^3.
|
|
106
|
+
"@eventcatalog/visualiser": "^3.14.0"
|
|
107
107
|
},
|
|
108
108
|
"devDependencies": {
|
|
109
109
|
"@astrojs/check": "^0.9.6",
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import type { APIRoute } from 'astro';
|
|
2
|
-
import utils from '@eventcatalog/sdk';
|
|
3
|
-
import config from '@config';
|
|
4
|
-
|
|
5
|
-
const isFullCatalogAPIEnabled = config.api?.fullCatalogAPIEnabled ?? true;
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Route that dumps the whole catalog as JSON (without markdown)
|
|
9
|
-
* Experimental API
|
|
10
|
-
*
|
|
11
|
-
* Can be disabled via eventcatalog.config.js:
|
|
12
|
-
* api: { fullCatalogAPIEnabled: false }
|
|
13
|
-
*/
|
|
14
|
-
export const GET: APIRoute = async () => {
|
|
15
|
-
if (!isFullCatalogAPIEnabled) {
|
|
16
|
-
return new Response(JSON.stringify({ error: 'Full catalog API is not enabled' }), {
|
|
17
|
-
status: 404,
|
|
18
|
-
headers: { 'Content-Type': 'application/json' },
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const { dumpCatalog } = utils(process.env.PROJECT_DIR || '');
|
|
23
|
-
const catalog = await dumpCatalog({ includeMarkdown: false });
|
|
24
|
-
|
|
25
|
-
return new Response(JSON.stringify(catalog), {
|
|
26
|
-
headers: {
|
|
27
|
-
'Content-Type': 'application/json',
|
|
28
|
-
},
|
|
29
|
-
});
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
// Only prerender if the API is enabled - this avoids loading all catalog data during build
|
|
33
|
-
// when the feature is disabled, saving memory for large catalogs
|
|
34
|
-
export const prerender = isFullCatalogAPIEnabled;
|