@eventcatalog/core 5.0.0-beta.3 → 5.0.0-beta.30

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 (277) hide show
  1. package/LICENSE +234 -134
  2. package/README.md +5 -5
  3. package/dist/analytics/analytics.cjs +18 -3
  4. package/dist/analytics/analytics.d.cts +1 -1
  5. package/dist/analytics/analytics.d.ts +1 -1
  6. package/dist/analytics/analytics.js +3 -2
  7. package/dist/analytics/log-build.cjs +160 -77
  8. package/dist/analytics/log-build.d.cts +2 -2
  9. package/dist/analytics/log-build.d.ts +2 -2
  10. package/dist/analytics/log-build.js +7 -5
  11. package/dist/analytics/studio-usage.cjs +90 -0
  12. package/dist/analytics/studio-usage.d.cts +5 -0
  13. package/dist/analytics/studio-usage.d.ts +5 -0
  14. package/dist/analytics/studio-usage.js +10 -0
  15. package/dist/analytics/telemetry.cjs +42 -0
  16. package/dist/analytics/telemetry.d.cts +20 -0
  17. package/dist/analytics/telemetry.d.ts +20 -0
  18. package/dist/analytics/telemetry.js +8 -0
  19. package/dist/catalog-runtime.cjs +1 -1
  20. package/dist/{chunk-RFIXKATC.js → chunk-4G7FSRPN.js} +35 -42
  21. package/dist/{chunk-6OC46WQJ.js → chunk-55QETQZ3.js} +66 -35
  22. package/dist/{chunk-TQLRG35T.js → chunk-AD7CL772.js} +78 -45
  23. package/dist/chunk-CA6WCQ2T.js +54 -0
  24. package/dist/chunk-CPW6G62V.js +17 -0
  25. package/dist/{chunk-423S2KHN.js → chunk-FLAZ2JVN.js} +4 -2
  26. package/dist/{chunk-BH2F5WPN.js → chunk-GQI5UYXZ.js} +1 -1
  27. package/dist/{chunk-GYIVJXOJ.js → chunk-NA7OTBWW.js} +1 -1
  28. package/dist/{chunk-MDWB5HLO.js → chunk-NKNOXQ62.js} +1 -1
  29. package/dist/{chunk-3PKS2IIP.js → chunk-OX6TSVHY.js} +1 -1
  30. package/dist/{chunk-36RYTYT5.js → chunk-PD7KTSYN.js} +1 -1
  31. package/dist/chunk-S5GWAUG5.js +29 -0
  32. package/dist/{chunk-NDJOAITI.js → chunk-T3OROMAU.js} +9 -3
  33. package/dist/constants.cjs +1 -1
  34. package/dist/constants.js +1 -1
  35. package/dist/eventcatalog-config-file-utils.cjs +34 -41
  36. package/dist/eventcatalog-config-file-utils.d.cts +56 -58
  37. package/dist/eventcatalog-config-file-utils.d.ts +56 -58
  38. package/dist/eventcatalog-config-file-utils.js +1 -1
  39. package/dist/eventcatalog.cjs +531 -356
  40. package/dist/eventcatalog.config.d.cts +59 -1
  41. package/dist/eventcatalog.config.d.ts +59 -1
  42. package/dist/eventcatalog.js +63 -25
  43. package/dist/features.cjs +34 -41
  44. package/dist/features.js +2 -2
  45. package/dist/federation/federate.cjs +37 -44
  46. package/dist/federation/federate.js +2 -2
  47. package/dist/generate.cjs +37 -42
  48. package/dist/generate.js +4 -4
  49. package/dist/resolve-catalog-dependencies.cjs +34 -41
  50. package/dist/resolve-catalog-dependencies.js +2 -2
  51. package/dist/runtime-dependencies/@eventcatalog__visualiser__studio-fonts.css.mjs +3 -0
  52. package/dist/runtime-dependencies/@eventcatalog__visualiser__studio.css.mjs +3 -0
  53. package/dist/runtime-dependencies/@eventcatalog__visualiser__studio.mjs +3 -0
  54. package/dist/runtime-dependencies/@hocuspocus__provider.mjs +3 -0
  55. package/dist/runtime-dependencies/@hocuspocus__server.mjs +3 -0
  56. package/dist/runtime-dependencies/@mcp-b__webmcp-local-relay.mjs +3 -0
  57. package/dist/runtime-dependencies/@mcp-b__webmcp-polyfill.mjs +3 -0
  58. package/dist/runtime-dependencies/htmlparser2.mjs +3 -0
  59. package/dist/runtime-dependencies/manifest.json +13 -1
  60. package/dist/runtime-dependencies/react-hotkeys-hook.mjs +3 -0
  61. package/dist/runtime-dependencies/react-syntax-highlighter__dist__cjs__create-element.js.mjs +3 -0
  62. package/dist/runtime-dependencies/y-protocols.mjs +3 -0
  63. package/dist/runtime-dependencies/y-protocols__awareness.mjs +3 -0
  64. package/dist/runtime-dependencies/yjs.mjs +3 -0
  65. package/dist/utils/child-process-signals.cjs +53 -0
  66. package/dist/utils/child-process-signals.d.cts +19 -0
  67. package/dist/utils/child-process-signals.d.ts +19 -0
  68. package/dist/utils/child-process-signals.js +6 -0
  69. package/dist/utils/cli-logger.cjs +1 -1
  70. package/dist/utils/cli-logger.js +2 -2
  71. package/dist/utils/license-status.cjs +78 -45
  72. package/dist/utils/license-status.d.cts +15 -5
  73. package/dist/utils/license-status.d.ts +15 -5
  74. package/dist/utils/license-status.js +1 -1
  75. package/eventcatalog/astro.config.mjs +23 -1
  76. package/eventcatalog/integrations/config-loader.mjs +56 -58
  77. package/eventcatalog/integrations/skip-startup-reload.mjs +31 -0
  78. package/eventcatalog/integrations/stable-dependency-order.mjs +29 -0
  79. package/eventcatalog/integrations/storage.mjs +20 -0
  80. package/eventcatalog/integrations/studio-server.mjs +32 -0
  81. package/eventcatalog/src/components/CatalogGraph/CatalogForceGraph.tsx +39 -0
  82. package/eventcatalog/src/components/ChatPanel/ChatPanel.tsx +2 -0
  83. package/eventcatalog/src/components/Header.astro +3 -3
  84. package/eventcatalog/src/components/Homepage/CatalogDashboard.astro +342 -0
  85. package/eventcatalog/src/components/MDX/NodeGraph/AstroNodeGraph.tsx +60 -4
  86. package/eventcatalog/src/components/MDX/NodeGraph/NodeGraph.astro +5 -1
  87. package/eventcatalog/src/components/NavigationProgress.astro +7 -0
  88. package/eventcatalog/src/components/SchemaExplorer/ApiContentViewer.tsx +2 -0
  89. package/eventcatalog/src/components/SchemaExplorer/ExamplesViewer.tsx +2 -0
  90. package/eventcatalog/src/components/SchemaExplorer/SchemaCodeModal.tsx +2 -0
  91. package/eventcatalog/src/components/SchemaExplorer/SchemaContentViewer.tsx +2 -0
  92. package/eventcatalog/src/components/Search/SearchDataLoader.astro +16 -28
  93. package/eventcatalog/src/components/Search/SearchModal.tsx +2 -10
  94. package/eventcatalog/src/components/Search/search-utils.ts +26 -0
  95. package/eventcatalog/src/components/Seo.astro +5 -1
  96. package/eventcatalog/src/components/Settings/AssistantSettingsForm.tsx +53 -48
  97. package/eventcatalog/src/components/Settings/GeneralSettingsForm.tsx +183 -178
  98. package/eventcatalog/src/components/Settings/LicenseSettings.tsx +140 -31
  99. package/eventcatalog/src/components/Settings/LlmAccessSettingsForm.tsx +40 -35
  100. package/eventcatalog/src/components/Settings/LogoUpload.tsx +1 -1
  101. package/eventcatalog/src/components/Settings/McpSettingsForm.tsx +9 -8
  102. package/eventcatalog/src/components/Settings/Row.tsx +7 -4
  103. package/eventcatalog/src/components/Settings/SettingsShared.tsx +3 -3
  104. package/eventcatalog/src/components/SideNav/NestedSideBar/index.tsx +53 -83
  105. package/eventcatalog/src/components/SideNav/NestedSideBar/storage.ts +2 -0
  106. package/eventcatalog/src/components/SideNav/NestedSideBar/utils.ts +131 -0
  107. package/eventcatalog/src/components/SideNav/SideNav.astro +9 -1
  108. package/eventcatalog/src/components/TrialBadge.astro +20 -9
  109. package/eventcatalog/src/content.config.ts +19 -2
  110. package/eventcatalog/src/features/auth/error.astro +4 -2
  111. package/eventcatalog/src/features/auth/login.astro +2 -1
  112. package/eventcatalog/src/features/auth/middleware/middleware-auth.ts +10 -0
  113. package/eventcatalog/src/features/auth/unauthorized.astro +1 -1
  114. package/eventcatalog/src/features/fields/pages/fields.astro +1 -1
  115. package/eventcatalog/src/features/integrations/eventcatalog-features.ts +34 -1
  116. package/eventcatalog/src/features/mcp/apps/architecture-diagram/node-chat.tsx +6 -45
  117. package/eventcatalog/src/features/mcp/apps/canvas/shared.ts +47 -0
  118. package/eventcatalog/src/features/mcp/apps/canvas/styles.css +24 -0
  119. package/eventcatalog/src/features/mcp/apps/canvas/view.tsx +278 -0
  120. package/eventcatalog/src/features/mcp/apps/generated/canvas.html +272 -0
  121. package/eventcatalog/src/features/mcp/apps/generated/viewer.html +65 -65
  122. package/eventcatalog/src/features/mcp/apps/shared/app-view.tsx +2 -1
  123. package/eventcatalog/src/features/mcp/mcp-apps.ts +6 -3
  124. package/eventcatalog/src/features/mcp/mcp-server.ts +36 -5
  125. package/eventcatalog/src/features/server/start.ts +25 -0
  126. package/eventcatalog/src/features/storage/database.ts +88 -0
  127. package/eventcatalog/src/features/storage/migrations.ts +85 -0
  128. package/eventcatalog/src/features/storage/sql/database.sql +5 -0
  129. package/eventcatalog/src/features/storage/sql/migrations/0001-studio-canvases.sql +12 -0
  130. package/eventcatalog/src/features/storage/sql/migrations.sql +15 -0
  131. package/eventcatalog/src/features/storage/sql.ts +28 -0
  132. package/eventcatalog/src/features/studio/agent-choreography.ts +384 -0
  133. package/eventcatalog/src/features/studio/agents.ts +28 -0
  134. package/eventcatalog/src/features/studio/api/canvases-api.ts +219 -0
  135. package/eventcatalog/src/features/studio/api/canvases.ts +25 -0
  136. package/eventcatalog/src/features/studio/api/client.ts +40 -0
  137. package/eventcatalog/src/features/studio/canvas-actions.ts +540 -0
  138. package/eventcatalog/src/features/studio/canvas-preview.ts +52 -0
  139. package/eventcatalog/src/features/studio/catalog-resources.ts +155 -0
  140. package/eventcatalog/src/features/studio/catalog.ts +173 -0
  141. package/eventcatalog/src/features/studio/components/CanvasHeader.tsx +518 -0
  142. package/eventcatalog/src/features/studio/components/CanvasStatusMenu.tsx +118 -0
  143. package/eventcatalog/src/features/studio/components/ConnectAgentDialog.tsx +434 -0
  144. package/eventcatalog/src/features/studio/components/ConnectionsChooser.tsx +143 -0
  145. package/eventcatalog/src/features/studio/components/DeleteCanvasDialog.tsx +65 -0
  146. package/eventcatalog/src/features/studio/components/Dialog.tsx +60 -0
  147. package/eventcatalog/src/features/studio/components/JoinForm.tsx +109 -0
  148. package/eventcatalog/src/features/studio/components/LeftPanel.tsx +206 -0
  149. package/eventcatalog/src/features/studio/components/NodeDetails.tsx +183 -0
  150. package/eventcatalog/src/features/studio/components/OpenInStudioDialog.tsx +79 -0
  151. package/eventcatalog/src/features/studio/components/Presence.tsx +293 -0
  152. package/eventcatalog/src/features/studio/components/ShareDialog.tsx +396 -0
  153. package/eventcatalog/src/features/studio/components/ShortcutsDialog.tsx +41 -0
  154. package/eventcatalog/src/features/studio/components/StudioDesigner.tsx +2091 -0
  155. package/eventcatalog/src/features/studio/components/StudioNotice.astro +24 -0
  156. package/eventcatalog/src/features/studio/document-name.ts +7 -0
  157. package/eventcatalog/src/features/studio/from-visualiser.ts +138 -0
  158. package/eventcatalog/src/features/studio/hooks/presence-sender.ts +63 -0
  159. package/eventcatalog/src/features/studio/hooks/presence-store.ts +119 -0
  160. package/eventcatalog/src/features/studio/hooks/use-canvas-webmcp.ts +353 -0
  161. package/eventcatalog/src/features/studio/hooks/use-comments.ts +54 -0
  162. package/eventcatalog/src/features/studio/hooks/use-follow-camera.ts +109 -0
  163. package/eventcatalog/src/features/studio/hooks/use-studio-flow.ts +782 -0
  164. package/eventcatalog/src/features/studio/identity.ts +59 -0
  165. package/eventcatalog/src/features/studio/limits.ts +2 -0
  166. package/eventcatalog/src/features/studio/pages/[id].astro +69 -0
  167. package/eventcatalog/src/features/studio/pages/index.astro +784 -0
  168. package/eventcatalog/src/features/studio/pages/webmcp-relay.ts +27 -0
  169. package/eventcatalog/src/features/studio/server/canvas-mcp.ts +495 -0
  170. package/eventcatalog/src/features/studio/server/runtime.ts +498 -0
  171. package/eventcatalog/src/features/studio/server/sign-in.ts +18 -0
  172. package/eventcatalog/src/features/studio/server/sql/storage.sql +18 -0
  173. package/eventcatalog/src/features/studio/server/storage.ts +90 -0
  174. package/eventcatalog/src/features/studio/server/tool-icons.ts +30 -0
  175. package/eventcatalog/src/features/studio/tool-sync.ts +75 -0
  176. package/eventcatalog/src/layouts/BaseLayout.astro +4 -4
  177. package/eventcatalog/src/layouts/SettingsLayout.astro +2 -2
  178. package/eventcatalog/src/layouts/VerticalSideBarLayout.astro +13 -5
  179. package/eventcatalog/src/pages/_index.astro +5 -342
  180. package/eventcatalog/src/pages/architecture/[type]/[id]/[version]/_index.data.spec.ts +2 -3
  181. package/eventcatalog/src/pages/architecture/[type]/[id]/[version]/_index.data.ts +0 -7
  182. package/eventcatalog/src/pages/architecture/[type]/[id]/[version]/index.astro +3 -1
  183. package/eventcatalog/src/pages/diagrams/[id]/[version]/_index.data.ts +0 -7
  184. package/eventcatalog/src/pages/diagrams/[id]/[version]/embed.astro +1 -0
  185. package/eventcatalog/src/pages/diagrams/[id]/[version]/index.astro +1 -0
  186. package/eventcatalog/src/pages/directory/[type]/_index.data.ts +5 -7
  187. package/eventcatalog/src/pages/directory/[type]/index.astro +3 -1
  188. package/eventcatalog/src/pages/discover/[type]/_index.data.ts +5 -7
  189. package/eventcatalog/src/pages/discover/[type]/index.astro +3 -1
  190. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/[docType]/[docId]/[docVersion]/_index.data.ts +0 -7
  191. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/[docType]/[docId]/[docVersion]/index.astro +1 -0
  192. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/[docType]/[docId]/_index.data.ts +0 -7
  193. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/[docType]/[docId]/index.astro +1 -0
  194. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/_index.data.ts +0 -7
  195. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/asyncapi/[filename].astro +3 -1
  196. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/asyncapi/_[filename].data.ts +0 -7
  197. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/changelog/_index.data.ts +0 -7
  198. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/changelog/index.astro +1 -0
  199. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/examples/[...filename].astro +1 -0
  200. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/examples/_[...filename].data.ts +0 -4
  201. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/field-lineage/_index.data.ts +0 -7
  202. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/field-lineage/index.astro +1 -0
  203. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/graphql/[filename].astro +3 -1
  204. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/graphql/_[filename].data.ts +0 -7
  205. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/index.astro +1 -0
  206. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/resources/_index.data.spec.ts +2 -3
  207. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/resources/_index.data.ts +0 -7
  208. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/resources/index.astro +1 -0
  209. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/spec/[filename].astro +1 -0
  210. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/spec/_[filename].data.ts +0 -7
  211. package/eventcatalog/src/pages/docs/[type]/[id]/_index.data.ts +0 -7
  212. package/eventcatalog/src/pages/docs/[type]/[id]/index.astro +2 -1
  213. package/eventcatalog/src/pages/docs/[type]/[id]/language/[dictionaryId]/_index.data.ts +0 -7
  214. package/eventcatalog/src/pages/docs/[type]/[id]/language/[dictionaryId]/index.astro +1 -0
  215. package/eventcatalog/src/pages/docs/[type]/[id]/language/_index.data.ts +0 -7
  216. package/eventcatalog/src/pages/docs/[type]/[id]/language/index.astro +1 -0
  217. package/eventcatalog/src/pages/docs/custom/[...path]/_index.data.ts +0 -7
  218. package/eventcatalog/src/pages/docs/custom/[...path]/index.astro +1 -0
  219. package/eventcatalog/src/pages/docs/services/[id]/[docType]/[docId]/index.astro +1 -1
  220. package/eventcatalog/src/pages/docs/services/[id]/[version]/resources/index.astro +1 -0
  221. package/eventcatalog/src/pages/docs/services/[id]/asyncapi/[filename].astro +1 -1
  222. package/eventcatalog/src/pages/docs/services/[id]/changelog/index.astro +1 -1
  223. package/eventcatalog/src/pages/docs/services/[id]/graphql/[filename].astro +1 -1
  224. package/eventcatalog/src/pages/docs/services/[id]/spec/[filename].astro +1 -1
  225. package/eventcatalog/src/pages/docs/teams/[id]/_index.data.ts +0 -7
  226. package/eventcatalog/src/pages/docs/teams/[id]/index.astro +1 -0
  227. package/eventcatalog/src/pages/docs/users/[id]/_index.data.ts +0 -7
  228. package/eventcatalog/src/pages/docs/users/[id]/index.astro +1 -0
  229. package/eventcatalog/src/pages/index.astro +4 -2
  230. package/eventcatalog/src/pages/schemas/[type]/[id]/[version]/_index.data.ts +0 -7
  231. package/eventcatalog/src/pages/schemas/[type]/[id]/[version]/index.astro +1 -0
  232. package/eventcatalog/src/pages/schemas/explorer/_index.data.ts +0 -7
  233. package/eventcatalog/src/pages/schemas/explorer/index.astro +4 -2
  234. package/eventcatalog/src/pages/settings/license.astro +9 -1
  235. package/eventcatalog/src/pages/triggers/[type]/[id]/[version]/_index.data.ts +0 -7
  236. package/eventcatalog/src/pages/triggers/[type]/[id]/[version]/index.astro +1 -0
  237. package/eventcatalog/src/pages/visualiser/[type]/[id]/[version]/_index.data.ts +0 -7
  238. package/eventcatalog/src/pages/visualiser/[type]/[id]/[version]/data/_index.data.ts +0 -7
  239. package/eventcatalog/src/pages/visualiser/[type]/[id]/[version]/data/index.astro +1 -0
  240. package/eventcatalog/src/pages/visualiser/[type]/[id]/[version]/entity-map/_index.data.ts +0 -7
  241. package/eventcatalog/src/pages/visualiser/[type]/[id]/[version]/entity-map/index.astro +1 -0
  242. package/eventcatalog/src/pages/visualiser/[type]/[id]/[version]/index.astro +1 -0
  243. package/eventcatalog/src/pages/visualiser/[type]/[id]/_index.data.ts +38 -0
  244. package/eventcatalog/src/pages/visualiser/[type]/[id]/index.astro +18 -41
  245. package/eventcatalog/src/pages/visualiser/designs/[id]/_index.data.ts +0 -7
  246. package/eventcatalog/src/pages/visualiser/designs/[id]/index.astro +2 -1
  247. package/eventcatalog/src/pages/visualiser/domains/[id]/[version]/entity-map/_index.data.ts +0 -7
  248. package/eventcatalog/src/pages/visualiser/domains/[id]/[version]/entity-map/index.astro +1 -0
  249. package/eventcatalog/src/pages/visualiser/domains/[id]/[version]/index.astro +1 -0
  250. package/eventcatalog/src/pages/visualiser/domains/[id]/[version]/systems-context/_index.data.ts +0 -7
  251. package/eventcatalog/src/pages/visualiser/domains/[id]/[version]/systems-context/index.astro +1 -0
  252. package/eventcatalog/src/pages/visualiser/systems/[id]/[version]/context/_index.data.ts +0 -7
  253. package/eventcatalog/src/pages/visualiser/systems/[id]/[version]/context/index.astro +1 -0
  254. package/eventcatalog/src/pages/visualiser/systems/[id]/[version]/index.astro +1 -0
  255. package/eventcatalog/src/types/react-syntax-highlighter.d.ts +10 -0
  256. package/eventcatalog/src/utils/collections/util.ts +8 -4
  257. package/eventcatalog/src/utils/feature.ts +8 -0
  258. package/eventcatalog/src/utils/git.ts +22 -5
  259. package/eventcatalog/src/utils/homepage-dashboard.ts +143 -0
  260. package/eventcatalog/src/utils/license.ts +1 -1
  261. package/eventcatalog/src/utils/link-validation.ts +25 -19
  262. package/eventcatalog/src/utils/node-graphs/domain-entity-map.ts +3 -1
  263. package/eventcatalog/src/utils/node-graphs/domain-levels-node-graph.ts +3 -3
  264. package/eventcatalog/src/utils/node-graphs/export-mermaid.ts +0 -2
  265. package/eventcatalog/src/utils/node-graphs/field-node-graph.ts +4 -2
  266. package/eventcatalog/src/utils/node-graphs/layout-node-graph.ts +20 -1
  267. package/eventcatalog/src/utils/node-graphs/node-resource.ts +67 -0
  268. package/eventcatalog/src/utils/node-graphs/systems-node-graph.ts +1 -1
  269. package/eventcatalog/src/utils/page-loaders/hybrid-page.ts +4 -15
  270. package/eventcatalog/src/utils/page-title.ts +15 -0
  271. package/eventcatalog/src/utils/syntax-highlighter-renderer.ts +64 -0
  272. package/eventcatalog/src/utils/trial.ts +14 -1
  273. package/package.json +19 -13
  274. package/dist/runtime-dependencies/shelljs.mjs +0 -3
  275. package/eventcatalog/public/studio-bg.png +0 -0
  276. package/eventcatalog/src/components/Studio/StudioPageModal.tsx +0 -150
  277. package/eventcatalog/src/pages/studio.astro +0 -316
@@ -21,56 +21,56 @@ import {
21
21
  type FavoriteItem,
22
22
  } from '@stores/favorites-store';
23
23
  import {
24
+ buildNodeLookup,
24
25
  canCollapseGroup,
25
26
  findNodeKeyByUrl,
26
27
  getBadgeClasses,
27
28
  getDefaultCollapsedState,
29
+ hidesDefaultItemIcon,
28
30
  isGroupCollapsed,
31
+ resolveNavRef,
32
+ rootLevel,
33
+ stripBasePath,
29
34
  toggleGroupCollapsed,
35
+ type NavigationLevel,
36
+ type SidebarSnapshot,
30
37
  } from './utils';
31
38
  import { resolveIconUrl } from '@utils/icon';
32
39
 
33
40
  const cn = (...classes: (string | false | undefined)[]) => classes.filter(Boolean).join(' ');
34
41
 
35
- /**
36
- * Strip the configured base path from a pathname so URL pattern matching works
37
- * regardless of the base path setting (e.g. `/eventcatalog/docs/...` → `/docs/...`).
38
- */
39
- const stripBasePath = (pathname: string): string => {
40
- const base = __EC_BASE__.replace(/\/$/, ''); // e.g. '/eventcatalog'
41
- if (base && pathname.startsWith(base)) {
42
- return pathname.slice(base.length) || '/';
43
- }
44
- return pathname;
45
- };
46
-
47
42
  // ============================================
48
43
  // Component
49
44
  // ============================================
50
45
 
51
- type NavigationLevel = {
52
- key: string | null; // The key of the node that was drilled into (null for root)
53
- entries: ChildRef[];
54
- title: string;
55
- badge?: string; // Category badge (e.g., "Domain", "Service")
46
+ type NestedSideBarProps = {
47
+ /**
48
+ * This page's level, built on the server. It renders the sidebar into the HTML and keeps
49
+ * the island showing it until the full navigation data (sidebar-data.json) is loaded.
50
+ */
51
+ snapshot?: SidebarSnapshot;
56
52
  };
57
53
 
58
- export default function NestedSideBar() {
59
- const data = useStore(sidebarStore);
54
+ export default function NestedSideBar({ snapshot }: NestedSideBarProps) {
55
+ const storeData = useStore(sidebarStore);
60
56
  const favorites = useStore(favoritesStore);
57
+ // Drill-down, restoring state and favorites need the whole catalog; until it loads the
58
+ // snapshot only shows this page's level
59
+ const hasFullData = storeData !== null;
60
+ const data = storeData ?? snapshot?.data ?? null;
61
61
 
62
62
  // Guard against undefined data (e.g., during hydration)
63
63
  // Use useMemo to ensure stable references for roots and nodes
64
64
  const roots = useMemo(() => data?.roots ?? [], [data?.roots]);
65
65
  const nodes = useMemo(() => data?.nodes ?? {}, [data?.nodes]);
66
66
 
67
- const [navigationStack, setNavigationStack] = useState<NavigationLevel[]>(() => [
68
- { key: null, entries: [], title: 'Documentation' },
69
- ]);
67
+ const [navigationStack, setNavigationStack] = useState<NavigationLevel[]>(
68
+ () => snapshot?.stack ?? [{ key: null, entries: [], title: 'Documentation' }]
69
+ );
70
70
  const [animationKey, setAnimationKey] = useState(0);
71
71
  const [slideDirection, setSlideDirection] = useState<'forward' | 'backward' | null>(null);
72
72
  const [isInitialized, setIsInitialized] = useState(false);
73
- const [currentPath, setCurrentPath] = useState<string>('');
73
+ const [currentPath, setCurrentPath] = useState<string>(snapshot?.url ?? '');
74
74
  const [sectionCollapsePreferences, setSectionCollapsePreferences] = useState(loadCollapsedSections);
75
75
  const [showPathPreview, setShowPathPreview] = useState(false);
76
76
  const [showFullPath, setShowFullPath] = useState(false);
@@ -78,33 +78,7 @@ export default function NestedSideBar() {
78
78
 
79
79
  // Build a lookup map for faster URL navigation
80
80
  // Map format: "type:id" -> "nodeKey"
81
- const nodeLookup = useMemo(() => {
82
- const lookup = new Map<string, string>();
83
-
84
- Object.entries(nodes).forEach(([key, value]) => {
85
- // Skip keys that are references (string values pointing to other keys)
86
- // These are unversioned aliases like "domain:E-Commerce" -> "domain:E-Commerce:1.0.0"
87
- if (typeof value === 'string') return;
88
-
89
- // Key formats:
90
- // - "type:id:version" (e.g., "service:OrdersService:0.0.3")
91
- // - "type:id" (e.g., "user:john", "team:backend") - non-versioned resources
92
- // - "list:name" (e.g., "list:domains") - skip these
93
- const parts = key.split(':');
94
-
95
- // Skip list items
96
- if (parts[0] === 'list') return;
97
-
98
- if (parts.length >= 2) {
99
- // Store as "type:id"
100
- const type = parts[0];
101
- const id = parts[1];
102
- lookup.set(`${type}:${id}`, key);
103
- }
104
- });
105
-
106
- return lookup;
107
- }, [nodes]);
81
+ const nodeLookup = useMemo(() => buildNodeLookup(nodes), [nodes]);
108
82
 
109
83
  /**
110
84
  * Toggle section collapse state
@@ -125,7 +99,7 @@ export default function NestedSideBar() {
125
99
  setNavigationStack((prevStack) => {
126
100
  // Only update if the current stack has no entries (initial state)
127
101
  if (prevStack.length === 1 && prevStack[0].entries.length === 0) {
128
- return [{ key: null, entries: roots, title: 'Documentation' }];
102
+ return [rootLevel(roots)];
129
103
  }
130
104
  return prevStack;
131
105
  });
@@ -145,21 +119,7 @@ export default function NestedSideBar() {
145
119
  * Resolve a child reference to a NavNode
146
120
  * Handles both direct keys and string references (unversioned aliases pointing to versioned keys)
147
121
  */
148
- const resolveRef = useCallback(
149
- (ref: ChildRef): NavNode | null => {
150
- if (typeof ref === 'string') {
151
- const node = nodes[ref];
152
- if (!node) return null;
153
- // If node is a string, it's a reference to another key (e.g., unversioned alias)
154
- if (typeof node === 'string') {
155
- return (nodes[node] as NavNode) ?? null;
156
- }
157
- return node;
158
- }
159
- return ref;
160
- },
161
- [nodes]
162
- );
122
+ const resolveRef = useCallback((ref: ChildRef): NavNode | null => resolveNavRef(nodes, ref), [nodes]);
163
123
 
164
124
  /**
165
125
  * Check if a node is visible (default: true)
@@ -174,7 +134,7 @@ export default function NestedSideBar() {
174
134
  */
175
135
  const buildStackFromPath = useCallback(
176
136
  (path: string[]): NavigationLevel[] => {
177
- const stack: NavigationLevel[] = [{ key: null, entries: roots, title: 'Documentation' }];
137
+ const stack: NavigationLevel[] = [rootLevel(roots)];
178
138
 
179
139
  for (const key of path) {
180
140
  const node = resolveRef(key);
@@ -280,7 +240,7 @@ export default function NestedSideBar() {
280
240
  if (foundNode && foundNode.pages && foundNode.pages.length > 0) {
281
241
  // Fallback: Flattened navigation
282
242
  return [
283
- { key: null, entries: roots, title: 'Documentation' },
243
+ rootLevel(roots),
284
244
  { key: foundNodeKey, entries: foundNode.pages, title: foundNode.title, badge: foundNode.badge },
285
245
  ];
286
246
  }
@@ -295,7 +255,7 @@ export default function NestedSideBar() {
295
255
  setSlideDirection('backward');
296
256
  setAnimationKey((prev) => prev + 1);
297
257
  }
298
- return [{ key: null, entries: roots, title: 'Documentation' }];
258
+ return [rootLevel(roots)];
299
259
  });
300
260
  return true;
301
261
  }
@@ -308,14 +268,14 @@ export default function NestedSideBar() {
308
268
  * Restore state from localStorage on mount, or navigate to URL
309
269
  */
310
270
  useEffect(() => {
311
- if (!data || roots.length === 0 || isInitialized) return;
271
+ if (!hasFullData || roots.length === 0 || isInitialized) return;
312
272
 
313
273
  const currentUrl = window.location.pathname;
314
274
  const normalizedCurrentUrl = stripBasePath(currentUrl);
315
275
 
316
276
  // Force root navigation on homepage
317
277
  if (normalizedCurrentUrl === '/' || normalizedCurrentUrl === '') {
318
- setNavigationStack([{ key: null, entries: roots, title: 'Documentation' }]);
278
+ setNavigationStack([rootLevel(roots)]);
319
279
  setIsInitialized(true);
320
280
  return;
321
281
  }
@@ -346,7 +306,7 @@ export default function NestedSideBar() {
346
306
  const targetNode = resolveRef(targetKey);
347
307
  if (targetNode && targetNode.pages && targetNode.pages.length > 0) {
348
308
  finalStack = [
349
- { key: null, entries: roots, title: 'Documentation' },
309
+ rootLevel(roots),
350
310
  { key: targetKey, entries: targetNode.pages, title: targetNode.title, badge: targetNode.badge },
351
311
  ];
352
312
  }
@@ -354,13 +314,13 @@ export default function NestedSideBar() {
354
314
 
355
315
  // 3. Fallback to root
356
316
  if (!finalStack) {
357
- setNavigationStack([{ key: null, entries: roots, title: 'Documentation' }]);
317
+ setNavigationStack([rootLevel(roots)]);
358
318
  } else {
359
319
  setNavigationStack(finalStack);
360
320
  }
361
321
 
362
322
  setIsInitialized(true);
363
- }, [data, roots, isInitialized, buildStackFromPath, findNodeKeyForUrl, tryConnectStack, resolveRef]);
323
+ }, [hasFullData, roots, isInitialized, buildStackFromPath, findNodeKeyForUrl, tryConnectStack, resolveRef]);
364
324
 
365
325
  /**
366
326
  * Save state whenever navigation changes
@@ -574,6 +534,7 @@ export default function NestedSideBar() {
574
534
  * Handle drilling down into an item with children
575
535
  */
576
536
  const handleDrillDown = (node: NavNode, nodeKey: string | null) => {
537
+ if (!hasFullData) return;
577
538
  if (node.pages && node.pages.length > 0) {
578
539
  setSlideDirection('forward');
579
540
  setAnimationKey((prev) => prev + 1);
@@ -589,7 +550,7 @@ export default function NestedSideBar() {
589
550
  * Navigate back one level
590
551
  */
591
552
  const navigateBack = () => {
592
- if (navigationStack.length > 1) {
553
+ if (hasFullData && navigationStack.length > 1) {
593
554
  setSlideDirection('backward');
594
555
  setAnimationKey((prev) => prev + 1);
595
556
  setNavigationStack(navigationStack.slice(0, -1));
@@ -603,7 +564,7 @@ export default function NestedSideBar() {
603
564
  * Navigate to a specific level in the stack
604
565
  */
605
566
  const navigateToLevel = (levelIndex: number) => {
606
- if (levelIndex < navigationStack.length - 1) {
567
+ if (hasFullData && levelIndex < navigationStack.length - 1) {
607
568
  setSlideDirection('backward');
608
569
  setAnimationKey((prev) => prev + 1);
609
570
  setNavigationStack(navigationStack.slice(0, levelIndex + 1));
@@ -633,6 +594,7 @@ export default function NestedSideBar() {
633
594
  * Navigate to a favorited item
634
595
  */
635
596
  const navigateToFavorite = (favorite: FavoriteItem) => {
597
+ if (!hasFullData) return;
636
598
  // If it has an href and no children, just navigate to the URL
637
599
  const node = resolveRef(favorite.nodeKey);
638
600
  if (favorite.href && (!node?.pages || node.pages.length === 0)) {
@@ -663,6 +625,11 @@ export default function NestedSideBar() {
663
625
 
664
626
  const isTopLevel = navigationStack.length === 1;
665
627
 
628
+ // The list drilled into (e.g. Channels): its items, even those in groups under it (e.g. ADRs
629
+ // grouped by status), drop a default icon that repeats the list's own
630
+ const levelNode = currentLevel.key ? resolveRef(currentLevel.key) : null;
631
+ const repeatsLevelIcon = (item: NavNode) => !!levelNode && hidesDefaultItemIcon(levelNode, item, false);
632
+
666
633
  /**
667
634
  * Render a list of child refs (resolving keys as needed)
668
635
  */
@@ -674,7 +641,7 @@ export default function NestedSideBar() {
674
641
  if (currentItemGroup.length > 0) {
675
642
  result.push(
676
643
  <div key={`items-${result.length}`} className="flex flex-col gap-0.5 mb-1.5">
677
- {currentItemGroup.map((item, idx) => renderItem(item.node, item.key, idx))}
644
+ {currentItemGroup.map((item, idx) => renderItem(item.node, item.key, idx, repeatsLevelIcon(item.node)))}
678
645
  </div>
679
646
  );
680
647
  currentItemGroup = [];
@@ -795,9 +762,12 @@ export default function NestedSideBar() {
795
762
  return renderGroup(child, childKey, childIndex, depth + 1);
796
763
  }
797
764
 
798
- // Under a nested group the header already conveys the resource type, so the
799
- // default per-collection glyph is dropped; custom icons still show.
800
- return renderItem(child, childKey, childIndex, isNested);
765
+ return renderItem(
766
+ child,
767
+ childKey,
768
+ childIndex,
769
+ hidesDefaultItemIcon(group, child, isNested) || repeatsLevelIcon(child)
770
+ );
801
771
  })}
802
772
  </div>
803
773
  )}
@@ -814,9 +784,9 @@ export default function NestedSideBar() {
814
784
  const isFav = isFavorited(itemKey);
815
785
  const canFavorite = itemKey !== null; // Only items with keys can be favorited
816
786
 
817
- // Get icon component from lucide-react. When suppressDefaultIcon is set (e.g. items
818
- // listed under a typed subtle subgroup) the default per-collection glyph is hidden;
819
- // a custom icon (item.leftIcon) is always still shown.
787
+ // Get icon component from lucide-react. When suppressDefaultIcon is set (the group heading
788
+ // already shows the item's type, see hidesDefaultItemIcon) the default per-collection glyph
789
+ // is hidden; a custom icon (item.leftIcon) is always still shown.
820
790
  const IconComponent =
821
791
  item.icon && !suppressDefaultIcon ? (LucideIcons as unknown as Record<string, LucideIcons.LucideIcon>)[item.icon] : null;
822
792
  const handleStarClick = (e: React.MouseEvent) => {
@@ -107,6 +107,8 @@ export const saveCollapsedSections = (preferences: SectionCollapsePreferences):
107
107
  };
108
108
 
109
109
  export const loadCollapsedSections = (): SectionCollapsePreferences => {
110
+ // Rendered on the server for the first paint, where there is nothing saved yet
111
+ if (typeof localStorage === 'undefined') return createSectionCollapsePreferences();
110
112
  try {
111
113
  const stored = localStorage.getItem(SECTION_PREFERENCES_KEY);
112
114
  if (stored) {
@@ -1,7 +1,130 @@
1
1
  // Shared utilities for NestedSideBar components
2
2
 
3
+ import type { ChildRef, NavigationData, NavNode } from '@stores/sidebar-store/state';
4
+
3
5
  export const SIDEBAR_GROUP_COLLAPSE_THRESHOLD = 5;
4
6
 
7
+ /**
8
+ * Strip the configured base path from a pathname so URL pattern matching works
9
+ * regardless of the base path setting (e.g. `/eventcatalog/docs/...` → `/docs/...`).
10
+ */
11
+ export const stripBasePath = (pathname: string): string => {
12
+ const base = __EC_BASE__.replace(/\/$/, ''); // e.g. '/eventcatalog'
13
+ if (base && pathname.startsWith(base)) {
14
+ return pathname.slice(base.length) || '/';
15
+ }
16
+ return pathname;
17
+ };
18
+
19
+ export type NavigationLevel = {
20
+ key: string | null; // The key of the node that was drilled into (null for root)
21
+ entries: ChildRef[];
22
+ title: string;
23
+ badge?: string; // Category badge (e.g., "Domain", "Service")
24
+ };
25
+
26
+ export const rootLevel = (roots: ChildRef[]): NavigationLevel => ({ key: null, entries: roots, title: 'Documentation' });
27
+
28
+ /** Resolve a child reference to a node, following unversioned aliases (string → key). */
29
+ export const resolveNavRef = (nodes: NavigationData['nodes'], ref: ChildRef): NavNode | null => {
30
+ if (typeof ref !== 'string') return ref;
31
+ const node = nodes[ref];
32
+ if (!node) return null;
33
+ if (typeof node === 'string') return (nodes[node] as NavNode) ?? null;
34
+ return node;
35
+ };
36
+
37
+ /** Map of "type:id" → versioned node key, used to match URLs to nodes. */
38
+ export const buildNodeLookup = (nodes: NavigationData['nodes']): Map<string, string> => {
39
+ const lookup = new Map<string, string>();
40
+
41
+ Object.entries(nodes).forEach(([key, value]) => {
42
+ // Skip keys that are references (string values pointing to other keys)
43
+ // These are unversioned aliases like "domain:E-Commerce" -> "domain:E-Commerce:1.0.0"
44
+ if (typeof value === 'string') return;
45
+
46
+ // Key formats:
47
+ // - "type:id:version" (e.g., "service:OrdersService:0.0.3")
48
+ // - "type:id" (e.g., "user:john", "team:backend") - non-versioned resources
49
+ // - "list:name" (e.g., "list:domains") - skip these
50
+ const parts = key.split(':');
51
+
52
+ // Skip list items
53
+ if (parts[0] === 'list') return;
54
+
55
+ if (parts.length >= 2) {
56
+ // Store as "type:id"
57
+ lookup.set(`${parts[0]}:${parts[1]}`, key);
58
+ }
59
+ });
60
+
61
+ return lookup;
62
+ };
63
+
64
+ /**
65
+ * What the sidebar shows for a URL before it knows the reader's saved drill-down path:
66
+ * the root level on the homepage or for pages without children, otherwise the matching
67
+ * resource's own level (the same "flattened" stack the client falls back to).
68
+ */
69
+ export const getStackForUrl = (
70
+ url: string,
71
+ data: NavigationData,
72
+ nodeLookup: ReadonlyMap<string, string> = buildNodeLookup(data.nodes)
73
+ ): NavigationLevel[] => {
74
+ const root = rootLevel(data.roots);
75
+ if (url === '/' || url === '') return [root];
76
+
77
+ const targetKey = findNodeKeyByUrl(url, data.nodes, nodeLookup);
78
+ const target = targetKey ? resolveNavRef(data.nodes, targetKey) : null;
79
+ if (!targetKey || !target?.pages?.length) return [root];
80
+
81
+ return [root, { key: targetKey, entries: target.pages, title: target.title, badge: target.badge }];
82
+ };
83
+
84
+ /**
85
+ * Everything the sidebar needs to render one page's level, without the whole catalog: the
86
+ * stack for the URL and only the nodes that level shows (its items, and the contents of its
87
+ * groups). Rendered on the server so the sidebar appears with the HTML, and handed to the
88
+ * island so it keeps showing it until the full navigation data loads.
89
+ */
90
+ export type SidebarSnapshot = {
91
+ url: string;
92
+ stack: NavigationLevel[];
93
+ data: NavigationData;
94
+ };
95
+
96
+ const nodeLookupCache = new WeakMap<NavigationData, Map<string, string>>();
97
+
98
+ export const buildSidebarSnapshot = (data: NavigationData, url: string): SidebarSnapshot => {
99
+ let nodeLookup = nodeLookupCache.get(data);
100
+ if (!nodeLookup) {
101
+ nodeLookup = buildNodeLookup(data.nodes);
102
+ nodeLookupCache.set(data, nodeLookup);
103
+ }
104
+
105
+ const stack = getStackForUrl(url, data, nodeLookup);
106
+ const level = stack[stack.length - 1];
107
+ const nodes: NavigationData['nodes'] = {};
108
+
109
+ const include = (ref: ChildRef) => {
110
+ if (typeof ref === 'string') {
111
+ if (ref in nodes) return;
112
+ const value = data.nodes[ref];
113
+ if (value === undefined) return;
114
+ nodes[ref] = value;
115
+ if (typeof value === 'string' && data.nodes[value] !== undefined) nodes[value] = data.nodes[value];
116
+ }
117
+ const node = resolveNavRef(data.nodes, ref);
118
+ // Groups render their children inline; items with children only need their own node
119
+ if (node?.type === 'group') node.pages?.forEach(include);
120
+ };
121
+
122
+ if (level.key) include(level.key);
123
+ level.entries.forEach(include);
124
+
125
+ return { url, stack, data: { roots: data.roots, nodes } };
126
+ };
127
+
5
128
  /**
6
129
  * The user's overrides of each group's default collapse state, keyed by group id.
7
130
  * A group is in at most one set; absence means "use the group's default".
@@ -67,6 +190,14 @@ export const toggleGroupCollapsed = (
67
190
  * Finds the sidebar node represented by a resource URL.
68
191
  * The URL must have its configured base path removed before it is passed in.
69
192
  */
193
+ /**
194
+ * Whether an item in a group drops its default per-collection icon because the group heading
195
+ * already conveys its type: every item under a nested group, and items whose icon is the
196
+ * group's own (e.g. events listed under Events). Custom icons (`leftIcon`) always show.
197
+ */
198
+ export const hidesDefaultItemIcon = (group: NavNode, item: NavNode, isNested: boolean): boolean =>
199
+ isNested || (!!group.icon && group.icon === item.icon);
200
+
70
201
  export const findNodeKeyByUrl = (
71
202
  url: string,
72
203
  nodes: Record<string, unknown>,
@@ -3,10 +3,18 @@ import type { HTMLAttributes } from 'astro/types';
3
3
 
4
4
  interface Props extends Omit<HTMLAttributes<'div'>, 'children'> {}
5
5
  import NestedSideBar from './NestedSideBar';
6
+ import { buildSidebarSnapshot, stripBasePath } from './NestedSideBar/utils';
7
+ import { getNestedSideBarData } from '@stores/sidebar-store/state';
6
8
  import { ClientRouter } from 'astro:transitions';
9
+
10
+ // Render this page's sidebar level into the HTML so it shows before any JavaScript runs;
11
+ // the full navigation still loads from /api/sidebar-data.json (see SearchDataLoader)
12
+ const snapshot = buildSidebarSnapshot(await getNestedSideBarData(), stripBasePath(Astro.url.pathname));
7
13
  ---
8
14
 
9
15
  <div {...Astro.props}>
10
16
  <ClientRouter />
11
- <NestedSideBar client:only="react" />
17
+ <NestedSideBar client:only="react" snapshot={snapshot}>
18
+ <NestedSideBar slot="fallback" snapshot={snapshot} />
19
+ </NestedSideBar>
12
20
  </div>
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  import catalog from '@utils/eventcatalog-config/catalog';
3
3
  import { isDevMode } from '@utils/feature';
4
- import { getLicenseDaysLeft, getTrialStatus, LICENSE_FAQ_URL, TRIAL_LENGTH_DAYS } from '@utils/trial';
4
+ import { BUY_BUSINESS_URL, getLicenseDaysLeft, getTrialStatus, TRIAL_LENGTH_DAYS } from '@utils/trial';
5
5
  import { getLicenseStatus } from '@utils/license';
6
6
  import { buildUrl } from '@utils/url-builder';
7
7
 
@@ -29,20 +29,17 @@ const title = licenseExpired
29
29
  : licenseDaysLeft !== undefined
30
30
  ? `Your EventCatalog commercial license expires on ${licensedUntil?.toLocaleDateString()}. Renew it to keep using EventCatalog commercially.`
31
31
  : trial?.ended
32
- ? `Your ${TRIAL_LENGTH_DAYS}-day EventCatalog trial ended on ${trial.endsAt.toLocaleDateString()}. Learn about licensing.`
33
- : `You're on a ${TRIAL_LENGTH_DAYS}-day EventCatalog trial, ending on ${trial?.endsAt.toLocaleDateString()}. Learn about licensing.`;
32
+ ? `Your ${TRIAL_LENGTH_DAYS}-day EventCatalog trial ended on ${trial.endsAt.toLocaleDateString()}. See your license settings.`
33
+ : `You're on a ${TRIAL_LENGTH_DAYS}-day EventCatalog trial, ending on ${trial?.endsAt.toLocaleDateString()}. See your license settings.`;
34
34
  const warning = licenseExpired || licenseDaysLeft !== undefined || trial?.ended;
35
- // An expiring or expired license opens the license settings (where it's renewed), the trial the license FAQ
36
- const isLicense = licenseExpired || licenseDaysLeft !== undefined;
37
- const href = isLicense ? buildUrl('/settings/license') : LICENSE_FAQ_URL;
35
+ // The badge opens Settings > License, where the license is renewed or bought
36
+ const href = buildUrl('/settings/license');
38
37
  ---
39
38
 
40
39
  {
41
40
  (licenseExpired || licenseDaysLeft !== undefined || trial) && (
42
41
  <a
43
42
  href={href}
44
- target={isLicense ? undefined : '_blank'}
45
- rel={isLicense ? undefined : 'noopener noreferrer'}
46
43
  title={title}
47
44
  data-trial-ended={trial?.ended ? 'true' : undefined}
48
45
  data-license-expired={licenseExpired ? 'true' : undefined}
@@ -50,7 +47,7 @@ const href = isLicense ? buildUrl('/settings/license') : LICENSE_FAQ_URL;
50
47
  'inline-flex items-center gap-1.5 whitespace-nowrap rounded-full border px-2.5 py-1 text-xs font-medium transition-colors',
51
48
  warning
52
49
  ? 'border-[rgb(var(--ec-badge-color-amber-text)/0.3)] bg-[rgb(var(--ec-badge-color-amber-background))] text-[rgb(var(--ec-badge-color-amber-text))] hover:opacity-90'
53
- : 'border-[rgb(var(--ec-accent)/0.3)] bg-[rgb(var(--ec-accent-subtle))] text-[rgb(var(--ec-accent))] hover:bg-[rgb(var(--ec-accent)/0.15)]',
50
+ : 'border-transparent bg-[rgb(var(--ec-page-text))] text-[rgb(var(--ec-page-bg))] hover:opacity-85',
54
51
  ]}
55
52
  >
56
53
  <svg
@@ -80,3 +77,17 @@ const href = isLicense ? buildUrl('/settings/license') : LICENSE_FAQ_URL;
80
77
  </a>
81
78
  )
82
79
  }
80
+ {
81
+ /* Once the trial has ended, a link to buy the Business plan sits next to the badge */
82
+ trial?.ended && (
83
+ <a
84
+ href={BUY_BUSINESS_URL}
85
+ target="_blank"
86
+ rel="noopener noreferrer"
87
+ data-buy-business="true"
88
+ class="inline-flex items-center whitespace-nowrap rounded-full border border-transparent bg-[rgb(var(--ec-page-text))] px-2.5 py-1 text-xs font-medium text-[rgb(var(--ec-page-bg))] transition-opacity hover:opacity-85"
89
+ >
90
+ Buy Business
91
+ </a>
92
+ )
93
+ }
@@ -502,7 +502,24 @@ const agents = defineCollection({
502
502
  ),
503
503
  });
504
504
 
505
- const adrStatus = z.enum(ADR_STATUS_VALUES);
505
+ // ADRs need a status and a date, and say so when they're missing or invalid. Astro's own message for
506
+ // a missing or unreadable date was "Expected type date, received object", with the field name garbled.
507
+ const adrStatus = z.enum(ADR_STATUS_VALUES, {
508
+ error: (issue) =>
509
+ issue.input === undefined ? `Required: one of ${ADR_STATUS_VALUES.map((value) => `"${value}"`).join(', ')}` : undefined,
510
+ });
511
+ const adrDate = z.preprocess(
512
+ // Converted to a date only when it's set: a missing date coerced first became an invalid date
513
+ (value) => (value == null ? value : new Date(value as string | number | Date)),
514
+ z.date({
515
+ error: (issue) =>
516
+ issue.input === undefined
517
+ ? 'Required: a date, e.g. 2026-06-01'
518
+ : issue.input instanceof Date
519
+ ? 'Invalid date: use a date, e.g. 2026-06-01'
520
+ : undefined,
521
+ })
522
+ );
506
523
 
507
524
  const adrPointer = z.object({
508
525
  id: z.string(),
@@ -539,7 +556,7 @@ const adrs = defineCollection({
539
556
  z
540
557
  .object({
541
558
  status: adrStatus,
542
- date: z.coerce.date(),
559
+ date: adrDate,
543
560
  decisionMakers: z.array(ownerReference).optional(),
544
561
  appliesTo: z.array(adrResourcePointer).optional(),
545
562
  supersedes: z.array(adrPointer).optional(),
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  import '../../styles/tailwind.css';
3
+ import { formatPageTitle } from '@utils/page-title';
3
4
  // src/pages/auth/error.astro
4
5
 
5
6
  const { searchParams } = new URL(Astro.request.url);
@@ -14,6 +15,7 @@ const errorMessages = {
14
15
 
15
16
  // @ts-ignore
16
17
  const errorMessage = errorMessages[error] || errorMessages.Default;
18
+ const pageTitle = formatPageTitle('Authentication Error');
17
19
  ---
18
20
 
19
21
  <!doctype html>
@@ -25,10 +27,10 @@ const errorMessage = errorMessages[error] || errorMessages.Default;
25
27
  <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
26
28
  <link rel="apple-touch-icon" href="/apple-touch-icon.png" />
27
29
  <meta name="generator" content={Astro.generator} />
28
- <title>Authentication Error - EventCatalog</title>
30
+ <title>{pageTitle}</title>
29
31
  </head>
30
32
  <body>
31
- <main title="Authentication Error - EventCatalog">
33
+ <main title={pageTitle}>
32
34
  <div class="min-h-screen flex items-center justify-center bg-gray-50 py-12 px-4 sm:px-6 lg:px-8">
33
35
  <div class="max-w-md w-full space-y-8 text-center">
34
36
  <div>
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  import '../../styles/tailwind.css';
3
3
  import config from '@config';
4
+ import { formatPageTitle } from '@utils/page-title';
4
5
  const { title, logo } = config;
5
6
  import { join } from 'node:path';
6
7
  import { isAuthEnabled, isSSR } from '@utils/feature';
@@ -106,7 +107,7 @@ const providerConfig = {
106
107
  <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
107
108
  <link rel="apple-touch-icon" href="/apple-touch-icon.png" />
108
109
  <meta name="generator" content={Astro.generator} />
109
- <title>Sign In | {title}</title>
110
+ <title>{formatPageTitle('Sign In')}</title>
110
111
  <link rel="preconnect" href="https://fonts.googleapis.com" />
111
112
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
112
113
  <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet" />
@@ -96,6 +96,14 @@ export function isMcpRoute(pathname: string) {
96
96
  return pathname === '/docs/mcp' || pathname.startsWith('/docs/mcp/');
97
97
  }
98
98
 
99
+ // The Studio API answers in JSON, rather than sending callers to the sign-in page
100
+ const isStudioApiRoute = (pathname: string) => pathname === '/api/studio' || pathname.startsWith('/api/studio/');
101
+ const signInRequired = () =>
102
+ new Response(JSON.stringify({ error: 'Sign in to use this API' }), {
103
+ status: 401,
104
+ headers: { 'Content-Type': 'application/json' },
105
+ });
106
+
99
107
  export const authMiddleware: MiddlewareHandler = async (context, next) => {
100
108
  const { request, redirect, locals } = context;
101
109
  const url = new URL(request.url);
@@ -131,6 +139,7 @@ export const authMiddleware: MiddlewareHandler = async (context, next) => {
131
139
  const session = await getSession(request);
132
140
 
133
141
  if (!session) {
142
+ if (isStudioApiRoute(pathname)) return signInRequired();
134
143
  const callbackUrl = encodeURIComponent(pathname + url.search);
135
144
  return redirect(`/auth/login?callbackUrl=${callbackUrl}`);
136
145
  }
@@ -157,6 +166,7 @@ export const authMiddleware: MiddlewareHandler = async (context, next) => {
157
166
  typedLocals.matchesPattern = matchesPattern;
158
167
  } catch (error) {
159
168
  console.error('Session error:', error);
169
+ if (isStudioApiRoute(pathname)) return signInRequired();
160
170
  const callbackUrl = encodeURIComponent(pathname + url.search);
161
171
  return redirect(`/auth/login?callbackUrl=${callbackUrl}`);
162
172
  }
@@ -2,7 +2,7 @@
2
2
  import VerticalSideBarLayout from '@layouts/VerticalSideBarLayout.astro';
3
3
  ---
4
4
 
5
- <VerticalSideBarLayout title="Unauthorized - EventCatalog" showNestedSideBar={false}>
5
+ <VerticalSideBarLayout title="Unauthorized" showNestedSideBar={false}>
6
6
  <div class="flex h-[calc(100vh-120px)] bg-white">
7
7
  <main class="flex w-full items-center justify-center bg-white text-center sm:p-12">
8
8
  <div class="w-full max-w-xl text-center">
@@ -7,7 +7,7 @@ import FieldsExplorer from '@components/FieldsExplorer/FieldsExplorer';
7
7
  export const prerender = false;
8
8
  ---
9
9
 
10
- <VerticalSideBarLayout title="Fields Explorer - EventCatalog" showNestedSideBar={false}>
10
+ <VerticalSideBarLayout title="Fields Explorer" showNestedSideBar={false}>
11
11
  <style is:global>
12
12
  #eventcatalog-header {
13
13
  left: calc(var(--ec-vertical-nav-width, 14rem) + var(--ec-fields-sidebar-width, 320px)) !important;