@eventcatalog/core 3.0.0-beta.8 → 3.0.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.
Files changed (148) hide show
  1. package/README.md +41 -98
  2. package/dist/__mocks__/astro-content.cjs +32 -0
  3. package/dist/__mocks__/astro-content.d.cts +13 -0
  4. package/dist/__mocks__/astro-content.d.ts +13 -0
  5. package/dist/__mocks__/astro-content.js +7 -0
  6. package/dist/analytics/analytics.cjs +1 -1
  7. package/dist/analytics/analytics.js +2 -2
  8. package/dist/analytics/log-build.cjs +1 -1
  9. package/dist/analytics/log-build.js +3 -3
  10. package/dist/catalog-to-astro-content-directory.cjs +2 -19
  11. package/dist/catalog-to-astro-content-directory.d.cts +1 -2
  12. package/dist/catalog-to-astro-content-directory.d.ts +1 -2
  13. package/dist/catalog-to-astro-content-directory.js +3 -5
  14. package/dist/{chunk-R2BJ7MJG.js → chunk-6Z6ARMQS.js} +1 -17
  15. package/dist/{chunk-LQUXA3NB.js → chunk-BYP43AAT.js} +1 -1
  16. package/dist/{chunk-UTHNQFM7.js → chunk-E5Q7TZYT.js} +1 -1
  17. package/dist/{chunk-KEYJ3FB3.js → chunk-EKGR533N.js} +1 -1
  18. package/dist/{chunk-7MCE4J6I.js → chunk-KF5PARQK.js} +1 -1
  19. package/dist/{chunk-I3QUYHIK.js → chunk-VO5WYA44.js} +1 -1
  20. package/dist/constants.cjs +1 -1
  21. package/dist/constants.js +1 -1
  22. package/dist/eventcatalog.cjs +20 -64
  23. package/dist/eventcatalog.config.d.cts +4 -0
  24. package/dist/eventcatalog.config.d.ts +4 -0
  25. package/dist/eventcatalog.js +26 -52
  26. package/dist/generate.cjs +1 -1
  27. package/dist/generate.js +3 -3
  28. package/dist/utils/cli-logger.cjs +1 -1
  29. package/dist/utils/cli-logger.js +2 -2
  30. package/eventcatalog/astro.config.mjs +4 -1
  31. package/eventcatalog/integrations/eventcatalog-features.ts +69 -0
  32. package/eventcatalog/public/icons/asyncapi-black.svg +2 -0
  33. package/eventcatalog/public/icons/graphql-black.svg +1 -0
  34. package/eventcatalog/public/icons/openapi-black.svg +1 -0
  35. package/eventcatalog/src/components/ChatPanel/ChatPanel.tsx +994 -0
  36. package/eventcatalog/src/components/ChatPanel/ChatPanelButton.tsx +24 -0
  37. package/eventcatalog/src/components/Grids/DomainGrid.tsx +310 -173
  38. package/eventcatalog/src/components/Grids/MessageGrid.tsx +299 -180
  39. package/eventcatalog/src/components/Grids/specification-utils.ts +106 -0
  40. package/eventcatalog/src/components/Header.astro +25 -5
  41. package/eventcatalog/src/components/MDX/NodeGraph/NodeGraph.tsx +14 -3
  42. package/eventcatalog/src/components/SchemaExplorer/ApiAccessSection.tsx +95 -90
  43. package/eventcatalog/src/components/SchemaExplorer/ApiContentViewer.tsx +144 -0
  44. package/eventcatalog/src/components/SchemaExplorer/Pagination.tsx +34 -8
  45. package/eventcatalog/src/components/SchemaExplorer/SchemaContentViewer.tsx +2 -2
  46. package/eventcatalog/src/components/SchemaExplorer/SchemaDetailsHeader.tsx +140 -109
  47. package/eventcatalog/src/components/SchemaExplorer/SchemaDetailsPanel.tsx +5 -14
  48. package/eventcatalog/src/components/SchemaExplorer/SchemaExplorer.tsx +247 -59
  49. package/eventcatalog/src/components/SchemaExplorer/SchemaFilters.tsx +64 -126
  50. package/eventcatalog/src/components/SchemaExplorer/SchemaListItem.tsx +41 -43
  51. package/eventcatalog/src/components/Search/Search.astro +2 -2
  52. package/eventcatalog/src/components/Search/SearchDataLoader.astro +25 -0
  53. package/eventcatalog/src/components/SideNav/NestedSideBar/SearchBar.tsx +6 -3
  54. package/eventcatalog/src/components/SideNav/NestedSideBar/index.tsx +44 -16
  55. package/eventcatalog/src/components/SideNav/SideNav.astro +0 -15
  56. package/eventcatalog/src/components/Tables/Table.tsx +96 -77
  57. package/eventcatalog/src/components/Tables/columns/ContainersTableColumns.tsx +108 -74
  58. package/eventcatalog/src/components/Tables/columns/DomainTableColumns.tsx +74 -55
  59. package/eventcatalog/src/components/Tables/columns/FlowTableColumns.tsx +36 -36
  60. package/eventcatalog/src/components/Tables/columns/MessageTableColumns.tsx +110 -77
  61. package/eventcatalog/src/components/Tables/columns/ServiceTableColumns.tsx +105 -94
  62. package/eventcatalog/src/components/Tables/columns/SharedColumns.tsx +31 -26
  63. package/eventcatalog/src/components/Tables/columns/TeamsTableColumns.tsx +115 -215
  64. package/eventcatalog/src/components/Tables/columns/UserTableColumns.tsx +145 -243
  65. package/eventcatalog/src/content.config.ts +1 -13
  66. package/eventcatalog/src/enterprise/ai/chat-api.ts +360 -0
  67. package/eventcatalog/src/enterprise/auth/[...auth].ts +3 -0
  68. package/eventcatalog/src/enterprise/auth/login.astro +420 -0
  69. package/eventcatalog/src/enterprise/collections/index.ts +0 -1
  70. package/eventcatalog/src/layouts/Footer.astro +8 -5
  71. package/eventcatalog/src/layouts/VerticalSideBarLayout.astro +133 -117
  72. package/eventcatalog/src/pages/_index.astro +243 -559
  73. package/eventcatalog/src/pages/architecture/[type]/[id]/[version]/_index.data.ts +8 -2
  74. package/eventcatalog/src/pages/architecture/[type]/[id]/[version]/index.astro +9 -5
  75. package/eventcatalog/src/pages/directory/[type]/index.astro +6 -0
  76. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/asyncapi/[filename].astro +19 -3
  77. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/changelog/index.astro +7 -7
  78. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/graphql/[filename].astro +1 -1
  79. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/index.astro +10 -7
  80. package/eventcatalog/src/pages/docs/[type]/[id]/language/index.astro +194 -121
  81. package/eventcatalog/src/pages/docs/teams/[id]/index.astro +94 -70
  82. package/eventcatalog/src/pages/docs/teams/[id].mdx.ts +36 -0
  83. package/eventcatalog/src/pages/docs/users/[id]/index.astro +56 -45
  84. package/eventcatalog/src/pages/docs/users/[id].mdx.ts +36 -0
  85. package/eventcatalog/src/pages/schemas/explorer/_index.data.ts +178 -0
  86. package/eventcatalog/src/pages/schemas/explorer/index.astro +7 -157
  87. package/eventcatalog/src/pages/studio.astro +124 -72
  88. package/eventcatalog/src/remark-plugins/directives.ts +30 -9
  89. package/eventcatalog/src/{components/SideNav/NestedSideBar → stores/sidebar-store}/builders/container.ts +10 -1
  90. package/eventcatalog/src/{components/SideNav/NestedSideBar → stores/sidebar-store}/builders/domain.ts +17 -7
  91. package/eventcatalog/src/{components/SideNav/NestedSideBar → stores/sidebar-store}/builders/message.ts +10 -1
  92. package/eventcatalog/src/{components/SideNav/NestedSideBar → stores/sidebar-store}/builders/service.ts +11 -4
  93. package/eventcatalog/src/{components/SideNav/NestedSideBar → stores/sidebar-store}/builders/shared.ts +14 -0
  94. package/eventcatalog/src/stores/{sidebar-store.ts → sidebar-store/index.ts} +1 -1
  95. package/eventcatalog/src/utils/collections/channels.ts +0 -2
  96. package/eventcatalog/src/utils/collections/commands.ts +0 -2
  97. package/eventcatalog/src/utils/collections/containers.ts +0 -2
  98. package/eventcatalog/src/utils/collections/domains.ts +0 -2
  99. package/eventcatalog/src/utils/collections/entities.ts +0 -2
  100. package/eventcatalog/src/utils/collections/events.ts +0 -2
  101. package/eventcatalog/src/utils/collections/flows.ts +0 -2
  102. package/eventcatalog/src/utils/collections/queries.ts +0 -2
  103. package/eventcatalog/src/utils/collections/schemas.ts +45 -7
  104. package/eventcatalog/src/utils/collections/services.ts +0 -2
  105. package/eventcatalog/src/utils/feature.ts +9 -5
  106. package/eventcatalog/src/utils/node-graphs/services-node-graph.ts +1 -1
  107. package/eventcatalog/src/utils/resource-files.ts +86 -0
  108. package/package.json +12 -15
  109. package/default-files-for-collections/changelogs.md +0 -5
  110. package/default-files-for-collections/channels.md +0 -8
  111. package/default-files-for-collections/commands.md +0 -8
  112. package/default-files-for-collections/domains.md +0 -8
  113. package/default-files-for-collections/events.md +0 -8
  114. package/default-files-for-collections/flows.md +0 -11
  115. package/default-files-for-collections/queries.md +0 -8
  116. package/default-files-for-collections/services.md +0 -8
  117. package/default-files-for-collections/ubiquitousLanguages.md +0 -7
  118. package/eventcatalog/src/enterprise/collections/chat-prompts.ts +0 -32
  119. package/eventcatalog/src/enterprise/eventcatalog-chat/components/Chat.tsx +0 -60
  120. package/eventcatalog/src/enterprise/eventcatalog-chat/components/ChatMessage.tsx +0 -414
  121. package/eventcatalog/src/enterprise/eventcatalog-chat/components/ChatSidebar.tsx +0 -169
  122. package/eventcatalog/src/enterprise/eventcatalog-chat/components/InputModal.tsx +0 -244
  123. package/eventcatalog/src/enterprise/eventcatalog-chat/components/MentionInput.tsx +0 -211
  124. package/eventcatalog/src/enterprise/eventcatalog-chat/components/WelcomePromptArea.tsx +0 -176
  125. package/eventcatalog/src/enterprise/eventcatalog-chat/components/default-prompts.ts +0 -93
  126. package/eventcatalog/src/enterprise/eventcatalog-chat/components/hooks/ChatProvider.tsx +0 -143
  127. package/eventcatalog/src/enterprise/eventcatalog-chat/components/windows/ChatWindow.server.tsx +0 -387
  128. package/eventcatalog/src/enterprise/eventcatalog-chat/pages/api/chat.ts +0 -59
  129. package/eventcatalog/src/enterprise/eventcatalog-chat/pages/chat/index.astro +0 -104
  130. package/eventcatalog/src/enterprise/eventcatalog-chat/providers/ai-provider.ts +0 -140
  131. package/eventcatalog/src/enterprise/eventcatalog-chat/providers/anthropic.ts +0 -28
  132. package/eventcatalog/src/enterprise/eventcatalog-chat/providers/google.ts +0 -41
  133. package/eventcatalog/src/enterprise/eventcatalog-chat/providers/index.ts +0 -26
  134. package/eventcatalog/src/enterprise/eventcatalog-chat/providers/openai.ts +0 -61
  135. package/eventcatalog/src/enterprise/eventcatalog-chat/utils/chat-prompts.ts +0 -50
  136. package/eventcatalog/src/pages/auth/login.astro +0 -280
  137. package/eventcatalog/src/pages/chat/feature.astro +0 -179
  138. package/eventcatalog/src/pages/chat/index.astro +0 -10
  139. package/eventcatalog/src/pages/docs/_default-docs.mdx +0 -25
  140. package/eventcatalog/src/pages/docs/index.astro +0 -33
  141. package/eventcatalog/src/pages/nav-index.json.ts +0 -30
  142. /package/eventcatalog/src/{pages → enterprise}/auth/error.astro +0 -0
  143. /package/eventcatalog/src/{middleware-auth.ts → enterprise/auth/middleware/middleware-auth.ts} +0 -0
  144. /package/eventcatalog/src/{middleware.ts → enterprise/auth/middleware/middleware.ts} +0 -0
  145. /package/eventcatalog/src/{pages/unauthorized/index.astro → enterprise/auth/unauthorized.astro} +0 -0
  146. /package/eventcatalog/src/{pages → enterprise}/plans/index.astro +0 -0
  147. /package/eventcatalog/src/{components/SideNav/NestedSideBar → stores/sidebar-store}/builders/flow.ts +0 -0
  148. /package/eventcatalog/src/{components/SideNav/NestedSideBar/sidebar-builder.ts → stores/sidebar-store/state.ts} +0 -0
@@ -1,4 +1,12 @@
1
- import { ClipboardDocumentIcon, ArrowDownTrayIcon, CodeBracketIcon, TableCellsIcon } from '@heroicons/react/24/outline';
1
+ import {
2
+ ClipboardDocumentIcon,
3
+ ArrowDownTrayIcon,
4
+ CodeBracketIcon,
5
+ TableCellsIcon,
6
+ ArrowTopRightOnSquareIcon,
7
+ ClockIcon,
8
+ } from '@heroicons/react/24/outline';
9
+ import { CheckIcon, CommandLineIcon } from '@heroicons/react/24/solid';
2
10
  import { buildUrl } from '@utils/url-builder';
3
11
  import { getCollectionStyles } from '@components/Grids/utils';
4
12
  import { getSchemaTypeLabel } from './utils';
@@ -12,8 +20,8 @@ interface SchemaDetailsHeaderProps {
12
20
  onCopy: () => void;
13
21
  onDownload: () => void;
14
22
  isCopied: boolean;
15
- schemaViewMode: 'code' | 'schema' | 'diff';
16
- onViewModeChange: (mode: 'code' | 'schema' | 'diff') => void;
23
+ schemaViewMode: 'code' | 'schema' | 'diff' | 'api';
24
+ onViewModeChange: (mode: 'code' | 'schema' | 'diff' | 'api') => void;
17
25
  hasParsedSchema: boolean;
18
26
  hasDiffs: boolean;
19
27
  diffCount: number;
@@ -36,79 +44,89 @@ export default function SchemaDetailsHeader({
36
44
  const { color, Icon } = getCollectionStyles(message.collection);
37
45
  const hasMultipleVersions = availableVersions.length > 1;
38
46
 
47
+ // Get schema icon
48
+ const ext = message.schemaExtension?.toLowerCase();
49
+ const hasSchemaIcon = ['openapi', 'asyncapi', 'graphql', 'avro', 'json', 'proto'].includes(ext || '');
50
+ const iconName = ext === 'json' ? 'json-schema' : ext;
51
+
39
52
  return (
40
- <div className="flex-shrink-0 border-b border-gray-200 p-3">
41
- <div className="flex items-start justify-between mb-3">
42
- <div className="flex-1 min-w-0">
43
- <div className="flex items-center gap-2 mb-1.5">
44
- <Icon className={`h-5 w-5 text-${color}-500 flex-shrink-0`} />
45
- <a
46
- href={buildUrl(`/docs/${message.collection}/${message.data.id}/${message.data.version}`)}
47
- className={`text-lg font-semibold text-gray-900 hover:text-${color}-600 hover:underline truncate`}
48
- >
49
- {message.data.name}
50
- </a>
51
- {hasMultipleVersions ? (
52
- <select
53
- value={selectedVersion || message.data.version}
54
- onChange={(e) => onVersionChange(e.target.value)}
55
- className="text-xs text-gray-700 bg-white border border-gray-300 rounded px-2 py-1 focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent"
53
+ <div className="flex-shrink-0 border-b border-gray-200 bg-white">
54
+ {/* Main Header */}
55
+ <div className="px-4 py-3">
56
+ <div className="flex items-start justify-between gap-4">
57
+ <div className="flex-1 min-w-0">
58
+ {/* Title Row */}
59
+ <div className="flex items-start gap-3">
60
+ <div
61
+ className={`flex-shrink-0 flex items-center justify-center w-9 h-9 rounded-lg bg-${color}-50 border border-${color}-100 mt-0.5`}
56
62
  >
57
- {availableVersions.map((v) => (
58
- <option key={v.data.version} value={v.data.version}>
59
- v{v.data.version}
60
- </option>
61
- ))}
62
- </select>
63
- ) : (
64
- <span className="text-xs text-gray-500 flex-shrink-0">v{message.data.version}</span>
65
- )}
66
- </div>
67
- <div className="flex items-center gap-1 mb-2">
68
- <span
69
- className={`inline-flex items-center rounded-full bg-${color}-100 px-1.5 py-0.5 text-xs font-medium text-${color}-800`}
70
- >
71
- {message.collection}
72
- </span>
73
- <span className="inline-flex items-center gap-1 rounded-full bg-gray-100 px-1.5 py-0.5 text-xs font-medium text-gray-800">
74
- {(() => {
75
- const ext = message.schemaExtension?.toLowerCase();
76
- if (
77
- ext === 'openapi' ||
78
- ext === 'asyncapi' ||
79
- ext === 'graphql' ||
80
- ext === 'avro' ||
81
- ext === 'json' ||
82
- ext === 'proto'
83
- ) {
84
- // Map json extension to json-schema icon
85
- const iconName = ext === 'json' ? 'json-schema' : ext;
86
- const iconPath = buildUrl(`/icons/${iconName}.svg`, true);
87
- return (
88
- <>
89
- <img src={iconPath} alt={`${ext} icon`} className="h-3 w-3" />
90
- {getSchemaTypeLabel(message.schemaExtension)}
91
- </>
92
- );
93
- }
94
- return getSchemaTypeLabel(message.schemaExtension);
95
- })()}
96
- </span>
63
+ <Icon className={`h-4.5 w-4.5 text-${color}-600`} />
64
+ </div>
65
+ <div className="min-w-0 flex-1">
66
+ <div className="flex items-center gap-2">
67
+ <h2 className="text-base font-semibold text-gray-900 truncate">{message.data.name}</h2>
68
+ {hasMultipleVersions ? (
69
+ <div className="relative flex-shrink-0">
70
+ <select
71
+ value={selectedVersion || message.data.version}
72
+ onChange={(e) => onVersionChange(e.target.value)}
73
+ className="appearance-none text-xs font-medium text-gray-600 bg-gray-50 border border-gray-200 rounded-md pl-2.5 pr-7 py-1 focus:outline-none focus:ring-1 focus:ring-gray-300 focus:border-gray-300 cursor-pointer hover:bg-gray-100 transition-colors"
74
+ >
75
+ {availableVersions.map((v) => (
76
+ <option key={v.data.version} value={v.data.version}>
77
+ v{v.data.version}
78
+ </option>
79
+ ))}
80
+ </select>
81
+ <ClockIcon className="absolute right-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-gray-400 pointer-events-none" />
82
+ </div>
83
+ ) : (
84
+ <span className="text-xs text-gray-500 flex-shrink-0 font-medium bg-gray-50 px-2 py-1 rounded-md border border-gray-200">
85
+ v{message.data.version}
86
+ </span>
87
+ )}
88
+ </div>
89
+ {/* Tags */}
90
+ <div className="flex items-center gap-1.5 mt-1">
91
+ <span
92
+ className={`inline-flex items-center px-1.5 py-0.5 rounded text-[11px] font-medium bg-${color}-50 text-${color}-700 border border-${color}-100`}
93
+ >
94
+ {message.collection}
95
+ </span>
96
+ <span className="inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[11px] font-medium bg-gray-50 text-gray-600 border border-gray-100">
97
+ {hasSchemaIcon && (
98
+ <img src={buildUrl(`/icons/${iconName}.svg`, true)} alt={`${ext} icon`} className="h-3 w-3 opacity-70" />
99
+ )}
100
+ {getSchemaTypeLabel(message.schemaExtension)}
101
+ </span>
102
+ </div>
103
+ {/* Summary */}
104
+ {message.data.summary && <p className="text-xs text-gray-500 mt-1.5 line-clamp-1">{message.data.summary}</p>}
105
+ </div>
106
+ </div>
97
107
  </div>
98
- {message.data.summary && <p className="text-xs text-gray-600 line-clamp-2">{message.data.summary}</p>}
108
+
109
+ {/* View Docs Button */}
110
+ <a
111
+ href={buildUrl(`/docs/${message.collection}/${message.data.id}/${message.data.version}`)}
112
+ className="flex-shrink-0 inline-flex items-center gap-1.5 px-2.5 py-1.5 text-xs font-medium text-gray-600 bg-white border border-gray-200 rounded-md hover:bg-gray-50 hover:text-gray-900 transition-colors"
113
+ >
114
+ View docs
115
+ <ArrowTopRightOnSquareIcon className="h-3.5 w-3.5" />
116
+ </a>
99
117
  </div>
100
118
  </div>
101
119
 
102
- {/* Action Buttons */}
103
- <div className="flex items-center gap-2">
120
+ {/* Action Bar */}
121
+ <div className="px-4 py-2 bg-gray-50/50 border-t border-gray-100 flex items-center justify-between">
104
122
  {/* View Mode Toggle */}
105
- <div className="flex items-center gap-1 mr-2 border-r border-gray-300 pr-2">
123
+ <div className="flex items-center gap-0.5 p-0.5 bg-gray-100/80 rounded-md">
106
124
  <button
107
125
  onClick={() => onViewModeChange('code')}
108
- className={`inline-flex items-center gap-1 px-2 py-1 text-xs font-medium rounded transition-colors ${
109
- schemaViewMode === 'code' ? 'bg-primary text-white' : 'text-gray-600 hover:bg-gray-100'
126
+ className={`inline-flex items-center gap-1.5 px-2.5 py-1 text-xs font-medium rounded transition-all ${
127
+ schemaViewMode === 'code' ? 'bg-white text-gray-900 shadow-sm' : 'text-gray-500 hover:text-gray-700'
110
128
  }`}
111
- title="Code view"
129
+ title="View raw code"
112
130
  >
113
131
  <CodeBracketIcon className="h-3.5 w-3.5" />
114
132
  Code
@@ -116,10 +134,10 @@ export default function SchemaDetailsHeader({
116
134
  {hasParsedSchema && (
117
135
  <button
118
136
  onClick={() => onViewModeChange('schema')}
119
- className={`inline-flex items-center gap-1 px-2 py-1 text-xs font-medium rounded transition-colors ${
120
- schemaViewMode === 'schema' ? 'bg-primary text-white' : 'text-gray-600 hover:bg-gray-100'
137
+ className={`inline-flex items-center gap-1.5 px-2.5 py-1 text-xs font-medium rounded transition-all ${
138
+ schemaViewMode === 'schema' ? 'bg-white text-gray-900 shadow-sm' : 'text-gray-500 hover:text-gray-700'
121
139
  }`}
122
- title="Schema view"
140
+ title="View as schema"
123
141
  >
124
142
  <TableCellsIcon className="h-3.5 w-3.5" />
125
143
  Schema
@@ -128,53 +146,66 @@ export default function SchemaDetailsHeader({
128
146
  {hasDiffs && (
129
147
  <button
130
148
  onClick={() => onViewModeChange('diff')}
131
- className={`inline-flex items-center gap-1 px-2 py-1 text-xs font-medium rounded transition-colors ${
132
- schemaViewMode === 'diff' ? 'bg-primary text-white' : 'text-gray-600 hover:bg-gray-100'
149
+ className={`inline-flex items-center gap-1.5 px-2.5 py-1 text-xs font-medium rounded transition-all ${
150
+ schemaViewMode === 'diff' ? 'bg-white text-gray-900 shadow-sm' : 'text-gray-500 hover:text-gray-700'
133
151
  }`}
134
- title="View version history diffs"
152
+ title="View version diffs"
135
153
  >
136
- <svg
137
- xmlns="http://www.w3.org/2000/svg"
138
- className="h-3.5 w-3.5"
139
- fill="none"
140
- viewBox="0 0 24 24"
141
- stroke="currentColor"
154
+ <ClockIcon className="h-3.5 w-3.5" />
155
+ History
156
+ <span
157
+ className={`ml-0.5 px-1 py-0.5 rounded text-[10px] tabular-nums ${
158
+ schemaViewMode === 'diff' ? 'bg-gray-100 text-gray-600' : 'bg-gray-200/60 text-gray-500'
159
+ }`}
142
160
  >
143
- <path
144
- strokeLinecap="round"
145
- strokeLinejoin="round"
146
- strokeWidth={2}
147
- d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"
148
- />
149
- </svg>
150
- Diff ({diffCount})
161
+ {diffCount}
162
+ </span>
151
163
  </button>
152
164
  )}
165
+ <button
166
+ onClick={() => onViewModeChange('api')}
167
+ className={`inline-flex items-center gap-1.5 px-2.5 py-1 text-xs font-medium rounded transition-all ${
168
+ schemaViewMode === 'api' ? 'bg-white text-gray-900 shadow-sm' : 'text-gray-500 hover:text-gray-700'
169
+ }`}
170
+ title="API access"
171
+ >
172
+ <CommandLineIcon className="h-3.5 w-3.5" />
173
+ API
174
+ </button>
153
175
  </div>
154
176
 
155
- <button
156
- onClick={onCopy}
157
- className="inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium text-gray-700 bg-white border border-gray-300 rounded-md hover:bg-gray-50 transition-colors"
158
- title="Copy schema to clipboard"
159
- >
160
- <ClipboardDocumentIcon className="h-4 w-4" />
161
- {isCopied ? 'Copied!' : 'Copy'}
162
- </button>
163
- <button
164
- onClick={onDownload}
165
- className="inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium text-gray-700 bg-white border border-gray-300 rounded-md hover:bg-gray-50 transition-colors"
166
- title="Download schema file"
167
- >
168
- <ArrowDownTrayIcon className="h-4 w-4" />
169
- Download
170
- </button>
171
- <a
172
- href={buildUrl(`/docs/${message.collection}/${message.data.id}/${message.data.version}`)}
173
- className="inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium text-gray-700 bg-white border border-gray-300 rounded-md hover:bg-gray-50 transition-colors ml-auto"
174
- title="View full documentation"
175
- >
176
- View Docs →
177
- </a>
177
+ {/* Action Buttons */}
178
+ <div className="flex items-center gap-1.5">
179
+ <button
180
+ onClick={onCopy}
181
+ className={`inline-flex items-center gap-1 px-2 py-1 text-xs font-medium rounded-md transition-all ${
182
+ isCopied
183
+ ? 'bg-green-50 text-green-600 border border-green-200'
184
+ : 'text-gray-500 bg-white border border-gray-200 hover:bg-gray-50 hover:text-gray-700'
185
+ }`}
186
+ title="Copy schema to clipboard"
187
+ >
188
+ {isCopied ? (
189
+ <>
190
+ <CheckIcon className="h-3.5 w-3.5" />
191
+ Copied
192
+ </>
193
+ ) : (
194
+ <>
195
+ <ClipboardDocumentIcon className="h-3.5 w-3.5" />
196
+ Copy
197
+ </>
198
+ )}
199
+ </button>
200
+ <button
201
+ onClick={onDownload}
202
+ className="inline-flex items-center gap-1 px-2 py-1 text-xs font-medium text-gray-500 bg-white border border-gray-200 rounded-md hover:bg-gray-50 hover:text-gray-700 transition-all"
203
+ title="Download schema file"
204
+ >
205
+ <ArrowDownTrayIcon className="h-3.5 w-3.5" />
206
+ Download
207
+ </button>
208
+ </div>
178
209
  </div>
179
210
  </div>
180
211
  );
@@ -3,11 +3,11 @@ import * as Diff from 'diff';
3
3
  import { html } from 'diff2html';
4
4
  import 'diff2html/bundles/css/diff2html.min.css';
5
5
  import SchemaDetailsHeader from './SchemaDetailsHeader';
6
- import ApiAccessSection from './ApiAccessSection';
7
6
  import OwnersSection from './OwnersSection';
8
7
  import ProducersConsumersSection from './ProducersConsumersSection';
9
8
  import SchemaContentViewer from './SchemaContentViewer';
10
9
  import DiffViewer from './DiffViewer';
10
+ import ApiContentViewer from './ApiContentViewer';
11
11
  import VersionHistoryModal from './VersionHistoryModal';
12
12
  import SchemaCodeModal from './SchemaCodeModal';
13
13
  import SchemaViewerModal from './SchemaViewerModal';
@@ -34,8 +34,7 @@ export default function SchemaDetailsPanel({
34
34
  showProducersConsumers = true,
35
35
  }: SchemaDetailsPanelProps) {
36
36
  const [copiedId, setCopiedId] = useState<string | null>(null);
37
- const [schemaViewMode, setSchemaViewMode] = useState<'code' | 'schema' | 'diff'>('code');
38
- const [apiAccessExpanded, setApiAccessExpanded] = useState(false);
37
+ const [schemaViewMode, setSchemaViewMode] = useState<'code' | 'schema' | 'diff' | 'api'>('code');
39
38
  const [ownersExpanded, setOwnersExpanded] = useState(false);
40
39
  const [producersConsumersExpanded, setProducersConsumersExpanded] = useState(false);
41
40
  const [isDiffModalOpen, setIsDiffModalOpen] = useState(false);
@@ -160,16 +159,6 @@ export default function SchemaDetailsPanel({
160
159
  diffCount={allDiffs.length}
161
160
  />
162
161
 
163
- {/* API Access Section - Always show, but content changes based on Scale access */}
164
- <ApiAccessSection
165
- message={message}
166
- isExpanded={apiAccessExpanded}
167
- onToggle={() => setApiAccessExpanded(!apiAccessExpanded)}
168
- onCopy={handleCopyCustom}
169
- copiedId={copiedId}
170
- apiAccessEnabled={apiAccessEnabled}
171
- />
172
-
173
162
  {/* Producers and Consumers Section - Only show for messages (not services) */}
174
163
  {message.collection !== 'services' && showProducersConsumers && (
175
164
  <ProducersConsumersSection
@@ -186,7 +175,9 @@ export default function SchemaDetailsPanel({
186
175
 
187
176
  {/* Schema Content - Takes full remaining height */}
188
177
  <div className="flex-1 overflow-hidden">
189
- {schemaViewMode === 'diff' && allDiffs.length > 0 ? (
178
+ {schemaViewMode === 'api' ? (
179
+ <ApiContentViewer message={message} onCopy={handleCopyCustom} copiedId={copiedId} apiAccessEnabled={apiAccessEnabled} />
180
+ ) : schemaViewMode === 'diff' && allDiffs.length > 0 ? (
190
181
  <DiffViewer diffs={allDiffs} onOpenFullscreen={() => setIsDiffModalOpen(true)} apiAccessEnabled={apiAccessEnabled} />
191
182
  ) : (
192
183
  <SchemaContentViewer