@eventcatalog/core 4.10.9 → 4.10.11
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-3EEFSHHW.js → chunk-3XTFNVGA.js} +1 -1
- package/dist/{chunk-ONRJA5DX.js → chunk-N6U5CNT7.js} +1 -1
- package/dist/{chunk-BYPWHDX6.js → chunk-RLGMIZSH.js} +1 -1
- package/dist/{chunk-5WB6CXZH.js → chunk-TWZKZIRW.js} +1 -1
- package/dist/{chunk-EG62NTWS.js → chunk-U52FCZQ6.js} +7 -7
- package/dist/{chunk-WD5UW4A4.js → chunk-VFRR3M72.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 +13 -13
- package/dist/federation/federate.js +5 -5
- package/dist/federation/source-provider.js +2 -2
- 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/src/components/Grids/DomainGrid.tsx +20 -12
- package/eventcatalog/src/components/Grids/message-link.spec.ts +59 -0
- package/eventcatalog/src/components/Grids/message-link.ts +38 -0
- package/eventcatalog/src/components/SchemaExplorer/SchemaDetailsPanel.tsx +58 -12
- package/eventcatalog/src/components/SchemaExplorer/SchemaExplorer.tsx +5 -5
- package/eventcatalog/src/components/SchemaExplorer/SchemaListItem.tsx +2 -0
- package/eventcatalog/src/components/SchemaExplorer/types.ts +10 -1
- package/eventcatalog/src/components/SchemaExplorer/useSchemaDetails.ts +69 -0
- package/eventcatalog/src/components/SchemaExplorer/utils.ts +12 -0
- package/eventcatalog/src/pages/architecture/[type]/[id]/[version]/_index.data.spec.ts +88 -0
- package/eventcatalog/src/pages/architecture/[type]/[id]/[version]/_index.data.ts +19 -8
- package/eventcatalog/src/pages/schemas/explorer/_index.data.ts +3 -269
- package/eventcatalog/src/pages/schemas/explorer/content/[key].json.ts +17 -0
- package/eventcatalog/src/utils/collections/domains.ts +1 -80
- package/eventcatalog/src/utils/collections/hydrate-services.ts +51 -0
- package/eventcatalog/src/utils/collections/systems.ts +17 -7
- package/eventcatalog/src/utils/schema-explorer.ts +276 -0
- package/package.json +3 -3
- package/dist/{chunk-A2RZR3U4.js → chunk-6K7XZAYI.js} +3 -3
|
@@ -140,7 +140,7 @@ var verifyRequiredFieldsAreInCatalogConfigFile = async (projectDirectory) => {
|
|
|
140
140
|
var import_os = __toESM(require("os"), 1);
|
|
141
141
|
|
|
142
142
|
// package.json
|
|
143
|
-
var version = "4.10.
|
|
143
|
+
var version = "4.10.11";
|
|
144
144
|
|
|
145
145
|
// src/constants.ts
|
|
146
146
|
var VERSION = version;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
log_build_default
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-N6U5CNT7.js";
|
|
4
|
+
import "../chunk-TWZKZIRW.js";
|
|
5
5
|
import "../chunk-ZAZHAVKB.js";
|
|
6
|
-
import "../chunk-
|
|
6
|
+
import "../chunk-3XTFNVGA.js";
|
|
7
7
|
import "../chunk-6QENHZZP.js";
|
|
8
8
|
export {
|
|
9
9
|
log_build_default as default
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
withFederationOutputTransaction
|
|
3
|
+
} from "./chunk-WRNH5C3U.js";
|
|
4
|
+
import {
|
|
5
|
+
composePublicAssets
|
|
6
|
+
} from "./chunk-5EPNFDT5.js";
|
|
1
7
|
import {
|
|
2
8
|
createFederationSourceProvider
|
|
3
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-6K7XZAYI.js";
|
|
4
10
|
import {
|
|
5
11
|
createFederationContentCache
|
|
6
12
|
} from "./chunk-R7Z5ALYI.js";
|
|
@@ -11,12 +17,6 @@ import {
|
|
|
11
17
|
import {
|
|
12
18
|
isFederationEnabled
|
|
13
19
|
} from "./chunk-FV56YFM4.js";
|
|
14
|
-
import {
|
|
15
|
-
withFederationOutputTransaction
|
|
16
|
-
} from "./chunk-WRNH5C3U.js";
|
|
17
|
-
import {
|
|
18
|
-
composePublicAssets
|
|
19
|
-
} from "./chunk-5EPNFDT5.js";
|
|
20
20
|
import {
|
|
21
21
|
getEventCatalogConfigFile
|
|
22
22
|
} from "./chunk-6QENHZZP.js";
|
package/dist/constants.cjs
CHANGED
package/dist/constants.js
CHANGED
package/dist/eventcatalog.cjs
CHANGED
|
@@ -144,7 +144,7 @@ var verifyRequiredFieldsAreInCatalogConfigFile = async (projectDirectory) => {
|
|
|
144
144
|
var import_picocolors = __toESM(require("picocolors"), 1);
|
|
145
145
|
|
|
146
146
|
// package.json
|
|
147
|
-
var version = "4.10.
|
|
147
|
+
var version = "4.10.11";
|
|
148
148
|
|
|
149
149
|
// src/constants.ts
|
|
150
150
|
var VERSION = version;
|
package/dist/eventcatalog.js
CHANGED
|
@@ -1,18 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
log_build_default
|
|
3
|
-
} from "./chunk-ONRJA5DX.js";
|
|
4
|
-
import "./chunk-5WB6CXZH.js";
|
|
5
|
-
import "./chunk-ZAZHAVKB.js";
|
|
6
1
|
import {
|
|
7
2
|
runMigrations
|
|
8
3
|
} from "./chunk-XUAF2H54.js";
|
|
9
4
|
import "./chunk-CA4U2JP7.js";
|
|
5
|
+
import {
|
|
6
|
+
log_build_default
|
|
7
|
+
} from "./chunk-N6U5CNT7.js";
|
|
8
|
+
import "./chunk-TWZKZIRW.js";
|
|
9
|
+
import "./chunk-ZAZHAVKB.js";
|
|
10
10
|
import {
|
|
11
11
|
FederationConflictError,
|
|
12
12
|
FederationDiagnosticError,
|
|
13
13
|
federateCatalog
|
|
14
|
-
} from "./chunk-
|
|
15
|
-
import "./chunk-
|
|
14
|
+
} from "./chunk-U52FCZQ6.js";
|
|
15
|
+
import "./chunk-WRNH5C3U.js";
|
|
16
|
+
import "./chunk-5EPNFDT5.js";
|
|
17
|
+
import "./chunk-6K7XZAYI.js";
|
|
18
|
+
import "./chunk-352FGP6W.js";
|
|
16
19
|
import "./chunk-R7Z5ALYI.js";
|
|
17
20
|
import {
|
|
18
21
|
getFederationDiagnosticCounts,
|
|
@@ -20,9 +23,6 @@ import {
|
|
|
20
23
|
} from "./chunk-JJPB6EOZ.js";
|
|
21
24
|
import "./chunk-FV56YFM4.js";
|
|
22
25
|
import "./chunk-SDZQJTJW.js";
|
|
23
|
-
import "./chunk-352FGP6W.js";
|
|
24
|
-
import "./chunk-WRNH5C3U.js";
|
|
25
|
-
import "./chunk-5EPNFDT5.js";
|
|
26
26
|
import {
|
|
27
27
|
getProjectOutDir,
|
|
28
28
|
isAuthEnabled,
|
|
@@ -31,10 +31,10 @@ import {
|
|
|
31
31
|
} from "./chunk-B7HCX5HM.js";
|
|
32
32
|
import {
|
|
33
33
|
generate
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-VFRR3M72.js";
|
|
35
35
|
import {
|
|
36
36
|
logger
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-RLGMIZSH.js";
|
|
38
38
|
import {
|
|
39
39
|
resolve_catalog_dependencies_default
|
|
40
40
|
} from "./chunk-LHR4G2UO.js";
|
|
@@ -54,7 +54,7 @@ import {
|
|
|
54
54
|
import "./chunk-W5JQON7Z.js";
|
|
55
55
|
import {
|
|
56
56
|
VERSION
|
|
57
|
-
} from "./chunk-
|
|
57
|
+
} from "./chunk-3XTFNVGA.js";
|
|
58
58
|
import {
|
|
59
59
|
linkCoreNodeModules,
|
|
60
60
|
resolveInstalledCoreNodeModules
|
|
@@ -2,15 +2,15 @@ import {
|
|
|
2
2
|
FederationConflictError,
|
|
3
3
|
FederationDiagnosticError,
|
|
4
4
|
federateCatalog
|
|
5
|
-
} from "../chunk-
|
|
6
|
-
import "../chunk-
|
|
5
|
+
} from "../chunk-U52FCZQ6.js";
|
|
6
|
+
import "../chunk-WRNH5C3U.js";
|
|
7
|
+
import "../chunk-5EPNFDT5.js";
|
|
8
|
+
import "../chunk-6K7XZAYI.js";
|
|
9
|
+
import "../chunk-352FGP6W.js";
|
|
7
10
|
import "../chunk-R7Z5ALYI.js";
|
|
8
11
|
import "../chunk-JJPB6EOZ.js";
|
|
9
12
|
import "../chunk-FV56YFM4.js";
|
|
10
13
|
import "../chunk-SDZQJTJW.js";
|
|
11
|
-
import "../chunk-352FGP6W.js";
|
|
12
|
-
import "../chunk-WRNH5C3U.js";
|
|
13
|
-
import "../chunk-5EPNFDT5.js";
|
|
14
14
|
import "../chunk-6QENHZZP.js";
|
|
15
15
|
export {
|
|
16
16
|
FederationConflictError,
|
package/dist/generate.cjs
CHANGED
|
@@ -108,7 +108,7 @@ var getEventCatalogConfigFile = async (projectDirectory) => {
|
|
|
108
108
|
var import_picocolors = __toESM(require("picocolors"), 1);
|
|
109
109
|
|
|
110
110
|
// package.json
|
|
111
|
-
var version = "4.10.
|
|
111
|
+
var version = "4.10.11";
|
|
112
112
|
|
|
113
113
|
// src/constants.ts
|
|
114
114
|
var VERSION = version;
|
package/dist/generate.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
generate
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-VFRR3M72.js";
|
|
4
|
+
import "./chunk-RLGMIZSH.js";
|
|
5
|
+
import "./chunk-3XTFNVGA.js";
|
|
6
6
|
import "./chunk-6QENHZZP.js";
|
|
7
7
|
export {
|
|
8
8
|
generate
|
package/dist/utils/cli-logger.js
CHANGED
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
import { buildUrl } from '@utils/url-builder';
|
|
18
18
|
import { BoxIcon, Group as GroupIcon } from 'lucide-react';
|
|
19
19
|
import { getSpecUrl, getSpecIcon, getSpecLabel, getServiceSpecifications } from './specification-utils';
|
|
20
|
+
import { getMessageLinkProps } from './message-link';
|
|
20
21
|
|
|
21
22
|
// ============================================
|
|
22
23
|
// Types
|
|
@@ -64,12 +65,8 @@ export const EntityBadge = memo(({ entity }: { entity: any }) => {
|
|
|
64
65
|
});
|
|
65
66
|
|
|
66
67
|
const MessageLink = memo(({ message }: { message: any }) => {
|
|
67
|
-
const
|
|
68
|
-
const
|
|
69
|
-
const { Icon, color } = getMessageIcon(collection);
|
|
70
|
-
const id = data?.id || message?.id;
|
|
71
|
-
const name = data?.name || data?.id || id;
|
|
72
|
-
const version = data?.version || message?.data?.version || 'latest';
|
|
68
|
+
const { collection, name, version, href } = getMessageLinkProps(message);
|
|
69
|
+
const { Icon, color } = getMessageIcon(collection || '');
|
|
73
70
|
|
|
74
71
|
const iconStyles: Record<string, string> = {
|
|
75
72
|
orange: 'text-orange-500',
|
|
@@ -78,14 +75,25 @@ const MessageLink = memo(({ message }: { message: any }) => {
|
|
|
78
75
|
gray: 'text-gray-500',
|
|
79
76
|
};
|
|
80
77
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
href={buildUrl(`/docs/${collection}/${id}/${version}`)}
|
|
84
|
-
className="flex items-center gap-2 py-1.5 text-sm text-[rgb(var(--ec-page-text-muted))] hover:text-[rgb(var(--ec-page-text))] transition-colors group"
|
|
85
|
-
>
|
|
78
|
+
const content = (
|
|
79
|
+
<>
|
|
86
80
|
<Icon className={`h-4 w-4 flex-shrink-0 ${iconStyles[color]}`} />
|
|
87
|
-
<span className=
|
|
81
|
+
<span className={href ? 'group-hover:underline' : undefined}>{name}</span>
|
|
88
82
|
<span className="text-xs text-[rgb(var(--ec-icon-color))]">v{version}</span>
|
|
83
|
+
</>
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
const className =
|
|
87
|
+
'flex items-center gap-2 py-1.5 text-sm text-[rgb(var(--ec-page-text-muted))] hover:text-[rgb(var(--ec-page-text))] transition-colors group';
|
|
88
|
+
|
|
89
|
+
// Missing collection means an unhydrated pointer — do not guess `/docs/events/...`.
|
|
90
|
+
if (!href) {
|
|
91
|
+
return <span className={className}>{content}</span>;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return (
|
|
95
|
+
<a href={buildUrl(href)} className={className}>
|
|
96
|
+
{content}
|
|
89
97
|
</a>
|
|
90
98
|
);
|
|
91
99
|
});
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { getMessageLinkProps } from './message-link';
|
|
3
|
+
|
|
4
|
+
describe('getMessageLinkProps', () => {
|
|
5
|
+
it('builds a command docs url and prefers the resource name over the id', () => {
|
|
6
|
+
expect(
|
|
7
|
+
getMessageLinkProps({
|
|
8
|
+
collection: 'commands',
|
|
9
|
+
data: { id: 'order-create', name: 'Create Order', version: '0.0.1' },
|
|
10
|
+
})
|
|
11
|
+
).toEqual({
|
|
12
|
+
collection: 'commands',
|
|
13
|
+
id: 'order-create',
|
|
14
|
+
name: 'Create Order',
|
|
15
|
+
version: '0.0.1',
|
|
16
|
+
href: '/docs/commands/order-create/0.0.1',
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('builds a query docs url from a hydrated collection entry', () => {
|
|
21
|
+
expect(
|
|
22
|
+
getMessageLinkProps({
|
|
23
|
+
collection: 'queries',
|
|
24
|
+
data: { id: 'get-stock-level', name: 'Get Stock Level', version: '1.0.0' },
|
|
25
|
+
})
|
|
26
|
+
).toEqual({
|
|
27
|
+
collection: 'queries',
|
|
28
|
+
id: 'get-stock-level',
|
|
29
|
+
name: 'Get Stock Level',
|
|
30
|
+
version: '1.0.0',
|
|
31
|
+
href: '/docs/queries/get-stock-level/1.0.0',
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it('does not default a missing collection to events', () => {
|
|
36
|
+
expect(getMessageLinkProps({ id: 'order-create', version: '0.0.1' })).toEqual({
|
|
37
|
+
collection: undefined,
|
|
38
|
+
id: 'order-create',
|
|
39
|
+
name: 'order-create',
|
|
40
|
+
version: '0.0.1',
|
|
41
|
+
href: undefined,
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
it('ignores unknown collection values instead of linking to events', () => {
|
|
46
|
+
expect(
|
|
47
|
+
getMessageLinkProps({
|
|
48
|
+
collection: 'services',
|
|
49
|
+
data: { id: 'order-service', name: 'Order Service', version: '1.0.0' },
|
|
50
|
+
})
|
|
51
|
+
).toEqual({
|
|
52
|
+
collection: undefined,
|
|
53
|
+
id: 'order-service',
|
|
54
|
+
name: 'Order Service',
|
|
55
|
+
version: '1.0.0',
|
|
56
|
+
href: undefined,
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
});
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { CollectionMessageTypes } from '@types';
|
|
2
|
+
|
|
3
|
+
export const MESSAGE_COLLECTIONS: readonly CollectionMessageTypes[] = ['events', 'commands', 'queries'];
|
|
4
|
+
|
|
5
|
+
export function isMessageCollection(value: unknown): value is CollectionMessageTypes {
|
|
6
|
+
return value === 'events' || value === 'commands' || value === 'queries';
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface MessageLinkProps {
|
|
10
|
+
collection?: CollectionMessageTypes;
|
|
11
|
+
id?: string;
|
|
12
|
+
name?: string;
|
|
13
|
+
version: string;
|
|
14
|
+
href?: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Resolve a DomainGrid/SystemGrid receives/sends item into a docs link.
|
|
19
|
+
*
|
|
20
|
+
* Hydrated collection entries carry `collection` + `data.name`. Bare `{id, version}`
|
|
21
|
+
* pointers do not — never guess `events` for those, or commands/queries get the wrong URL.
|
|
22
|
+
*/
|
|
23
|
+
export function getMessageLinkProps(message: any): MessageLinkProps {
|
|
24
|
+
const data = message?.data ?? message;
|
|
25
|
+
const collectionCandidate = message?.collection ?? data?.collection;
|
|
26
|
+
const collection = isMessageCollection(collectionCandidate) ? collectionCandidate : undefined;
|
|
27
|
+
const id = data?.id ?? message?.id;
|
|
28
|
+
const name = data?.name || message?.name || id;
|
|
29
|
+
const version = data?.version ?? message?.version ?? 'latest';
|
|
30
|
+
|
|
31
|
+
return {
|
|
32
|
+
collection,
|
|
33
|
+
id,
|
|
34
|
+
name,
|
|
35
|
+
version,
|
|
36
|
+
href: collection && id ? `/docs/${collection}/${id}/${version}` : undefined,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
@@ -24,7 +24,8 @@ import ExamplesViewer from './ExamplesViewer';
|
|
|
24
24
|
import VersionHistoryModal from './VersionHistoryModal';
|
|
25
25
|
import SchemaCodeModal from './SchemaCodeModal';
|
|
26
26
|
import SchemaViewerModal from './SchemaViewerModal';
|
|
27
|
-
import { copyToClipboard, downloadSchema, getSchemaTypeLabel, ICON_SPECS,
|
|
27
|
+
import { copyToClipboard, downloadSchema, getSchemaTypeLabel, ICON_SPECS, getSchemaRelationshipReference } from './utils';
|
|
28
|
+
import { createSchemaDetailsLoader, useSchemaDetails } from './useSchemaDetails';
|
|
28
29
|
import { parseProtobufSchema } from '@utils/protobuf-schema';
|
|
29
30
|
import type { SchemaItem, VersionDiff, Owner, Producer, Consumer } from './types';
|
|
30
31
|
|
|
@@ -39,7 +40,7 @@ interface SchemaDetailsPanelProps {
|
|
|
39
40
|
}
|
|
40
41
|
|
|
41
42
|
export default function SchemaDetailsPanel({
|
|
42
|
-
message,
|
|
43
|
+
message: metadataMessage,
|
|
43
44
|
availableVersions,
|
|
44
45
|
selectedVersion,
|
|
45
46
|
onVersionChange,
|
|
@@ -47,6 +48,9 @@ export default function SchemaDetailsPanel({
|
|
|
47
48
|
showOwners = true,
|
|
48
49
|
showProducersConsumers = true,
|
|
49
50
|
}: SchemaDetailsPanelProps) {
|
|
51
|
+
const [loadDetails] = useState(createSchemaDetailsLoader);
|
|
52
|
+
const content = useSchemaDetails(metadataMessage, loadDetails);
|
|
53
|
+
const message = content.message!;
|
|
50
54
|
const [copiedId, setCopiedId] = useState<string | null>(null);
|
|
51
55
|
const [activeTab, setActiveTab] = useState<'code' | 'schema' | 'diff' | 'api' | 'examples'>('code');
|
|
52
56
|
const [isDiffModalOpen, setIsDiffModalOpen] = useState(false);
|
|
@@ -88,18 +92,23 @@ export default function SchemaDetailsPanel({
|
|
|
88
92
|
setIsDiffModalOpen(false);
|
|
89
93
|
}, [schemaResourceKey, defaultFromVersion, defaultToVersion]);
|
|
90
94
|
|
|
91
|
-
const
|
|
95
|
+
const diffFromMetadata = useMemo(
|
|
92
96
|
() => uniqueAvailableVersions.find((version) => version.data.version === diffFromVersion),
|
|
93
97
|
[diffFromVersion, uniqueAvailableVersions]
|
|
94
98
|
);
|
|
95
|
-
const
|
|
99
|
+
const diffToMetadata = useMemo(
|
|
96
100
|
() => uniqueAvailableVersions.find((version) => version.data.version === diffToVersion),
|
|
97
101
|
[diffToVersion, uniqueAvailableVersions]
|
|
98
102
|
);
|
|
103
|
+
const comparing = activeTab === 'diff' || isDiffModalOpen;
|
|
104
|
+
const fromContent = useSchemaDetails(diffFromMetadata, loadDetails, comparing);
|
|
105
|
+
const toContent = useSchemaDetails(diffToMetadata, loadDetails, comparing);
|
|
106
|
+
const diffFromItem = fromContent.message;
|
|
107
|
+
const diffToItem = toContent.message;
|
|
99
108
|
const hasDiffFromContent = !!diffFromItem?.schemaContent?.trim();
|
|
100
109
|
const hasDiffToContent = !!diffToItem?.schemaContent?.trim();
|
|
101
110
|
const selectedDiff: VersionDiff | null = useMemo(() => {
|
|
102
|
-
if (!diffFromItem || !diffToItem) return null;
|
|
111
|
+
if (!comparing || !diffFromItem || !diffToItem) return null;
|
|
103
112
|
if (diffFromItem.data.version === diffToItem.data.version) return null;
|
|
104
113
|
if (!diffFromItem.schemaContent?.trim() || !diffToItem.schemaContent?.trim()) return null;
|
|
105
114
|
|
|
@@ -126,7 +135,7 @@ export default function SchemaDetailsPanel({
|
|
|
126
135
|
fromContent: diffFromItem.schemaContent,
|
|
127
136
|
toContent: diffToItem.schemaContent,
|
|
128
137
|
};
|
|
129
|
-
}, [diffFromItem, diffToItem]);
|
|
138
|
+
}, [comparing, diffFromItem, diffToItem]);
|
|
130
139
|
const selectedDiffs = selectedDiff ? [selectedDiff] : [];
|
|
131
140
|
|
|
132
141
|
// Check if this is a JSON schema
|
|
@@ -359,7 +368,9 @@ export default function SchemaDetailsPanel({
|
|
|
359
368
|
|
|
360
369
|
{/* Tab content */}
|
|
361
370
|
<div className="flex-1 min-h-0 overflow-hidden p-6">
|
|
362
|
-
{
|
|
371
|
+
{content.loading || content.error ? (
|
|
372
|
+
<SchemaLoadingState loading={content.loading} error={content.error} retry={content.retry} />
|
|
373
|
+
) : activeTab === 'examples' && examples.length > 0 ? (
|
|
363
374
|
<ExamplesViewer examples={examples} />
|
|
364
375
|
) : activeTab === 'api' ? (
|
|
365
376
|
<ApiContentViewer
|
|
@@ -416,7 +427,16 @@ export default function SchemaDetailsPanel({
|
|
|
416
427
|
</button>
|
|
417
428
|
</div>
|
|
418
429
|
<div className="min-h-0 flex-1 overflow-hidden">
|
|
419
|
-
{
|
|
430
|
+
{fromContent.loading || toContent.loading || fromContent.error || toContent.error ? (
|
|
431
|
+
<SchemaLoadingState
|
|
432
|
+
loading={fromContent.loading || toContent.loading}
|
|
433
|
+
error={fromContent.error || toContent.error}
|
|
434
|
+
retry={() => {
|
|
435
|
+
fromContent.retry();
|
|
436
|
+
toContent.retry();
|
|
437
|
+
}}
|
|
438
|
+
/>
|
|
439
|
+
) : diffFromVersion === diffToVersion ? (
|
|
420
440
|
<div className="flex h-full items-center justify-center text-[rgb(var(--ec-page-text-muted))]">
|
|
421
441
|
<p className="text-sm">Select two different versions</p>
|
|
422
442
|
</div>
|
|
@@ -525,11 +545,11 @@ export default function SchemaDetailsPanel({
|
|
|
525
545
|
</div>
|
|
526
546
|
<div className="space-y-1">
|
|
527
547
|
{producers.map((producer: Producer, idx: number) => {
|
|
528
|
-
const serviceName =
|
|
548
|
+
const { id: serviceName, version } = getSchemaRelationshipReference(producer);
|
|
529
549
|
return (
|
|
530
550
|
<a
|
|
531
551
|
key={`${producer.id}-${idx}`}
|
|
532
|
-
href={buildUrl(`/docs/services/${serviceName}/${
|
|
552
|
+
href={buildUrl(`/docs/services/${serviceName}/${version}`)}
|
|
533
553
|
className="flex items-center gap-2 rounded-lg px-2 py-1.5 text-xs font-medium text-[rgb(var(--ec-page-text-muted))] transition-colors hover:bg-[rgb(var(--ec-page-bg)/0.55)] hover:text-[rgb(var(--ec-accent))]"
|
|
534
554
|
>
|
|
535
555
|
<ServerIcon className="h-3.5 w-3.5 flex-shrink-0 text-[rgb(var(--ec-page-text-muted))]" />
|
|
@@ -551,11 +571,11 @@ export default function SchemaDetailsPanel({
|
|
|
551
571
|
</div>
|
|
552
572
|
<div className="space-y-1">
|
|
553
573
|
{consumers.map((consumer: Consumer, idx: number) => {
|
|
554
|
-
const serviceName =
|
|
574
|
+
const { id: serviceName, version } = getSchemaRelationshipReference(consumer);
|
|
555
575
|
return (
|
|
556
576
|
<a
|
|
557
577
|
key={`${consumer.id}-${idx}`}
|
|
558
|
-
href={buildUrl(`/docs/services/${serviceName}/${
|
|
578
|
+
href={buildUrl(`/docs/services/${serviceName}/${version}`)}
|
|
559
579
|
className="flex items-center gap-2 rounded-lg px-2 py-1.5 text-xs font-medium text-[rgb(var(--ec-page-text-muted))] transition-colors hover:bg-[rgb(var(--ec-page-bg)/0.55)] hover:text-[rgb(var(--ec-accent))]"
|
|
560
580
|
>
|
|
561
581
|
<ServerIcon className="h-3.5 w-3.5 flex-shrink-0 text-[rgb(var(--ec-page-text-muted))]" />
|
|
@@ -615,3 +635,29 @@ export default function SchemaDetailsPanel({
|
|
|
615
635
|
</div>
|
|
616
636
|
);
|
|
617
637
|
}
|
|
638
|
+
|
|
639
|
+
function SchemaLoadingState({ loading, error, retry }: { loading: boolean; error?: string; retry: () => void }) {
|
|
640
|
+
if (!error) {
|
|
641
|
+
if (!loading) return null;
|
|
642
|
+
return (
|
|
643
|
+
<div role="status" className="flex h-full items-center justify-center gap-2 text-sm text-[rgb(var(--ec-page-text-muted))]">
|
|
644
|
+
<span
|
|
645
|
+
aria-hidden="true"
|
|
646
|
+
className="h-4 w-4 rounded-full border-2 border-[rgb(var(--ec-page-border))] border-t-[rgb(var(--ec-page-text-muted))] motion-safe:animate-spin"
|
|
647
|
+
/>
|
|
648
|
+
<span>Loading schema…</span>
|
|
649
|
+
</div>
|
|
650
|
+
);
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
return (
|
|
654
|
+
<div className="flex h-full flex-col items-center justify-center gap-3 text-[rgb(var(--ec-page-text-muted))]" role="alert">
|
|
655
|
+
<p>{error}</p>
|
|
656
|
+
{error && (
|
|
657
|
+
<button type="button" onClick={retry} className="text-[rgb(var(--ec-accent))] hover:underline">
|
|
658
|
+
Try again
|
|
659
|
+
</button>
|
|
660
|
+
)}
|
|
661
|
+
</div>
|
|
662
|
+
);
|
|
663
|
+
}
|
|
@@ -36,10 +36,10 @@ function getSpecFile(item: SchemaItem): string {
|
|
|
36
36
|
* multiple specs of the same type (e.g. two OpenAPI specs).
|
|
37
37
|
*/
|
|
38
38
|
function getGroupKey(item: SchemaItem): string {
|
|
39
|
-
if (item.collection === 'services') {
|
|
40
|
-
return `${item.data.id}__${item.specType || 'unknown'}__${getSpecFile(item)}`;
|
|
39
|
+
if (item.collection === 'services' || item.collection === 'domains') {
|
|
40
|
+
return `${item.collection}__${item.data.id}__${item.specType || 'unknown'}__${getSpecFile(item)}`;
|
|
41
41
|
}
|
|
42
|
-
return item.data.id
|
|
42
|
+
return `${item.collection}__${item.data.id}`;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
interface SchemaExplorerProps {
|
|
@@ -110,7 +110,7 @@ export default function SchemaExplorer({ schemas, apiAccessEnabled = false }: Sc
|
|
|
110
110
|
params.set('version', message.data.version);
|
|
111
111
|
params.set('collection', message.collection);
|
|
112
112
|
|
|
113
|
-
if (message.collection === 'services') {
|
|
113
|
+
if (message.collection === 'services' || message.collection === 'domains') {
|
|
114
114
|
params.set('specType', message.specType || 'unknown');
|
|
115
115
|
const specFile = getSpecFile(message);
|
|
116
116
|
if (specFile) {
|
|
@@ -242,7 +242,7 @@ export default function SchemaExplorer({ schemas, apiAccessEnabled = false }: Sc
|
|
|
242
242
|
const versionMatch = msg.data.version === version;
|
|
243
243
|
const collectionMatch = !collection || msg.collection === collection;
|
|
244
244
|
|
|
245
|
-
if (msg.collection === 'services') {
|
|
245
|
+
if (msg.collection === 'services' || msg.collection === 'domains') {
|
|
246
246
|
const specTypeMatch = !specType || msg.specType === specType;
|
|
247
247
|
const msgSpecFile = getSpecFile(msg);
|
|
248
248
|
const specFilenameMatch = !specFilename || msgSpecFile === specFilename;
|
|
@@ -11,6 +11,8 @@ interface SchemaListItemProps {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
function getNamespace(message: SchemaItem): string | null {
|
|
14
|
+
if (message.data.producerName) return message.data.producerName;
|
|
15
|
+
|
|
14
16
|
const producers = message.data.producers || [];
|
|
15
17
|
const firstProducer = producers[0];
|
|
16
18
|
|