@eventcatalog/core 4.12.3 → 5.0.0-beta.1

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 (267) hide show
  1. package/LICENSE +226 -95
  2. package/NOTICE +30 -0
  3. package/README.md +3 -2
  4. package/dist/analytics/analytics.cjs +2 -1
  5. package/dist/analytics/analytics.js +2 -2
  6. package/dist/analytics/log-build.cjs +44 -16
  7. package/dist/analytics/log-build.d.cts +6 -5
  8. package/dist/analytics/log-build.d.ts +6 -5
  9. package/dist/analytics/log-build.js +4 -3
  10. package/dist/{chunk-U4YJSTGV.js → chunk-AYNZXUB5.js} +2 -10
  11. package/dist/{chunk-5BPN6QEC.js → chunk-K2ACDO7Y.js} +1 -1
  12. package/dist/{chunk-ZYTCBNB3.js → chunk-KYJZJLBD.js} +2 -1
  13. package/dist/{chunk-TV3YAWKQ.js → chunk-Q6SD5SNQ.js} +1 -1
  14. package/dist/{chunk-HPC6KUDQ.js → chunk-S2QGT7ZF.js} +1 -1
  15. package/dist/chunk-TQLRG35T.js +203 -0
  16. package/dist/{chunk-M577VUOX.js → chunk-UDS3SYLZ.js} +13 -16
  17. package/dist/constants.cjs +1 -1
  18. package/dist/constants.js +1 -1
  19. package/dist/eventcatalog.cjs +408 -291
  20. package/dist/eventcatalog.config.d.cts +2 -3
  21. package/dist/eventcatalog.config.d.ts +2 -3
  22. package/dist/eventcatalog.js +35 -98
  23. package/dist/federation/content-cache.d.cts +0 -5
  24. package/dist/federation/content-cache.d.ts +0 -5
  25. package/dist/federation/diagnostics.d.cts +0 -5
  26. package/dist/federation/diagnostics.d.ts +0 -5
  27. package/dist/federation/federate.cjs +0 -9
  28. package/dist/federation/federate.d.cts +0 -5
  29. package/dist/federation/federate.d.ts +0 -5
  30. package/dist/federation/federate.js +4 -5
  31. package/dist/federation/filesystem-source-provider.d.cts +0 -5
  32. package/dist/federation/filesystem-source-provider.d.ts +0 -5
  33. package/dist/federation/github-source-provider.d.cts +0 -5
  34. package/dist/federation/github-source-provider.d.ts +0 -5
  35. package/dist/federation/output-transaction.d.cts +0 -4
  36. package/dist/federation/output-transaction.d.ts +0 -4
  37. package/dist/federation/public-assets.d.cts +0 -5
  38. package/dist/federation/public-assets.d.ts +0 -5
  39. package/dist/federation/source-provider.d.cts +0 -5
  40. package/dist/federation/source-provider.d.ts +0 -5
  41. package/dist/federation/types.d.cts +0 -5
  42. package/dist/federation/types.d.ts +0 -5
  43. package/dist/generate.cjs +1 -1
  44. package/dist/generate.js +3 -3
  45. package/dist/license-C1y-56bb.d.cts +23 -0
  46. package/dist/license-C1y-56bb.d.ts +23 -0
  47. package/dist/runtime-dependencies/@eventcatalog__visualiser__layout.mjs +3 -0
  48. package/dist/runtime-dependencies/@modelcontextprotocol__ext-apps.mjs +3 -0
  49. package/dist/runtime-dependencies/@modelcontextprotocol__ext-apps__react.mjs +3 -0
  50. package/dist/runtime-dependencies/@modelcontextprotocol__ext-apps__server.mjs +3 -0
  51. package/dist/runtime-dependencies/@modelcontextprotocol__sdk__types.js.mjs +3 -0
  52. package/dist/runtime-dependencies/manifest.json +12 -1
  53. package/dist/runtime-dependencies/react-syntax-highlighter__dist__esm__languages__prism__graphql.mjs +3 -0
  54. package/dist/runtime-dependencies/react-syntax-highlighter__dist__esm__languages__prism__json.mjs +3 -0
  55. package/dist/runtime-dependencies/react-syntax-highlighter__dist__esm__languages__prism__markup.mjs +3 -0
  56. package/dist/runtime-dependencies/react-syntax-highlighter__dist__esm__languages__prism__protobuf.mjs +3 -0
  57. package/dist/runtime-dependencies/react-syntax-highlighter__dist__esm__languages__prism__yaml.mjs +3 -0
  58. package/dist/runtime-dependencies/react-syntax-highlighter__dist__esm__styles__prism__one-dark.mjs +3 -0
  59. package/dist/runtime-dependencies/react-syntax-highlighter__dist__esm__styles__prism__one-light.mjs +3 -0
  60. package/dist/utils/cli-logger.cjs +1 -1
  61. package/dist/utils/cli-logger.js +2 -2
  62. package/dist/utils/license-status.cjs +240 -0
  63. package/dist/utils/license-status.d.cts +28 -0
  64. package/dist/utils/license-status.d.ts +28 -0
  65. package/dist/utils/license-status.js +12 -0
  66. package/eventcatalog/astro.config.mjs +1 -1
  67. package/eventcatalog/integrations/eventcatalog-runtime.mjs +1 -1
  68. package/eventcatalog/src/components/ChatPanel/ChatPanel.tsx +29 -19
  69. package/eventcatalog/src/components/ChatPanel/OfflineReply.tsx +74 -0
  70. package/eventcatalog/src/components/FieldsExplorer/FieldFilters.tsx +24 -28
  71. package/eventcatalog/src/components/FieldsExplorer/FieldNodeGraph.tsx +16 -11
  72. package/eventcatalog/src/components/FieldsExplorer/FieldsExplorer.tsx +4 -218
  73. package/eventcatalog/src/components/FieldsExplorer/FieldsTable.tsx +27 -36
  74. package/eventcatalog/src/components/Header.astro +43 -58
  75. package/eventcatalog/src/components/Lists/PillListFlat.styles.css +17 -17
  76. package/eventcatalog/src/components/MDX/EntityMap/EntityMap.astro +1 -1
  77. package/eventcatalog/src/components/MDX/Flow/Flow.astro +4 -0
  78. package/eventcatalog/src/components/MDX/NodeGraph/AstroNodeGraph.tsx +14 -0
  79. package/eventcatalog/src/components/MDX/NodeGraph/NodeGraph.astro +49 -18
  80. package/eventcatalog/src/components/MDX/RemoteFile.astro +2 -24
  81. package/eventcatalog/src/components/SchemaExplorer/ApiAccessSection.tsx +59 -93
  82. package/eventcatalog/src/components/SchemaExplorer/ApiContentViewer.tsx +1 -32
  83. package/eventcatalog/src/components/SchemaExplorer/DiffViewer.tsx +20 -67
  84. package/eventcatalog/src/components/SchemaExplorer/SchemaContentViewer.tsx +2 -11
  85. package/eventcatalog/src/components/SchemaExplorer/SchemaDetailsPanel.tsx +11 -60
  86. package/eventcatalog/src/components/SchemaExplorer/SchemaExplorer.tsx +1 -3
  87. package/eventcatalog/src/components/SchemaExplorer/SchemaPageViewer.tsx +0 -3
  88. package/eventcatalog/src/components/SchemaExplorer/VersionHistoryModal.tsx +2 -9
  89. package/eventcatalog/src/components/SchemaExplorer/parse-schema.ts +46 -0
  90. package/eventcatalog/src/components/SchemaExplorer/utils.ts +11 -0
  91. package/eventcatalog/src/components/Settings/AssistantSettingsForm.tsx +2 -9
  92. package/eventcatalog/src/components/Settings/LicenseSettings.tsx +288 -0
  93. package/eventcatalog/src/components/Settings/LlmAccessSettingsForm.tsx +3 -19
  94. package/eventcatalog/src/components/Settings/McpSettingsForm.tsx +85 -30
  95. package/eventcatalog/src/components/Settings/SettingsShared.tsx +7 -75
  96. package/eventcatalog/src/components/SideNav/CustomDocsNav.astro +2 -2
  97. package/eventcatalog/src/components/TrialBadge.astro +82 -0
  98. package/eventcatalog/src/content.config.ts +9 -96
  99. package/eventcatalog/src/{enterprise → features}/ai/chat-api.ts +22 -34
  100. package/eventcatalog/src/{enterprise → features}/analytics/adapters/ga4.ts +0 -5
  101. package/eventcatalog/src/{enterprise → features}/analytics/adapters/gtm.ts +0 -5
  102. package/eventcatalog/src/{enterprise → features}/analytics/adapters/posthog.ts +0 -5
  103. package/eventcatalog/src/{enterprise → features}/analytics/components/AnalyticsHead.astro +2 -4
  104. package/eventcatalog/src/{enterprise → features}/analytics/components/AnalyticsTracker.astro +2 -4
  105. package/eventcatalog/src/{enterprise → features}/analytics/tracker.ts +0 -5
  106. package/eventcatalog/src/{enterprise → features}/api/catalog.ts +0 -5
  107. package/eventcatalog/src/{enterprise → features}/auth/[...auth].ts +0 -5
  108. package/eventcatalog/src/{enterprise → features}/auth/middleware/middleware-auth.ts +0 -5
  109. package/eventcatalog/src/{enterprise → features}/auth/middleware/middleware.ts +0 -5
  110. package/eventcatalog/src/{enterprise → features}/collections/custom-pages.ts +0 -5
  111. package/eventcatalog/src/{enterprise → features}/collections/index.ts +0 -5
  112. package/eventcatalog/src/{enterprise → features}/collections/resource-docs.ts +0 -5
  113. package/eventcatalog/src/{enterprise → features}/custom-documentation/collection.ts +0 -5
  114. package/eventcatalog/src/features/custom-documentation/components/CustomDocsNav/CustomDocsNav.astro +9 -0
  115. package/eventcatalog/src/{enterprise → features}/custom-documentation/components/CustomDocsNav/CustomDocsNavWrapper.tsx +0 -5
  116. package/eventcatalog/src/{enterprise → features}/custom-documentation/components/CustomDocsNav/components/NestedItem.tsx +1 -6
  117. package/eventcatalog/src/{enterprise → features}/custom-documentation/components/CustomDocsNav/components/NoResultsFound.tsx +0 -5
  118. package/eventcatalog/src/{enterprise → features}/custom-documentation/components/CustomDocsNav/index.tsx +1 -6
  119. package/eventcatalog/src/{enterprise → features}/custom-documentation/components/CustomDocsNav/types.ts +0 -5
  120. package/eventcatalog/src/{enterprise/custom-documentation/pages/docs/custom/index.astro → features/custom-documentation/components/CustomDocumentationPage.astro} +5 -5
  121. package/eventcatalog/src/{enterprise → features}/custom-documentation/utils/badge-styles.ts +0 -5
  122. package/eventcatalog/src/{enterprise → features}/custom-documentation/utils/custom-docs.ts +1 -6
  123. package/eventcatalog/src/{enterprise → features}/custom-documentation/utils/docs-search.ts +0 -5
  124. package/eventcatalog/src/{enterprise → features}/custom-pages/routes.ts +0 -5
  125. package/eventcatalog/src/{enterprise → features}/directory/user-team-directory.ts +0 -5
  126. package/eventcatalog/src/{enterprise → features}/fields/field-extractor.ts +0 -5
  127. package/eventcatalog/src/{enterprise → features}/fields/field-indexer.ts +0 -5
  128. package/eventcatalog/src/{enterprise → features}/fields/fields-db.ts +0 -5
  129. package/eventcatalog/src/{enterprise → features}/fields/pages/api/fields.ts +1 -6
  130. package/eventcatalog/src/{enterprise → features}/fields/pages/fields.astro +1 -2
  131. package/eventcatalog/src/{enterprise → features}/integrations/eventcatalog-features.ts +17 -75
  132. package/eventcatalog/src/features/mcp/apps/architecture-diagram/links.ts +59 -0
  133. package/eventcatalog/src/features/mcp/apps/architecture-diagram/node-chat.tsx +299 -0
  134. package/eventcatalog/src/features/mcp/apps/architecture-diagram/shared.ts +14 -0
  135. package/eventcatalog/src/features/mcp/apps/architecture-diagram/view.tsx +454 -0
  136. package/eventcatalog/src/features/mcp/apps/generated/viewer.html +432 -0
  137. package/eventcatalog/src/features/mcp/apps/mermaid-stub.ts +10 -0
  138. package/eventcatalog/src/features/mcp/apps/schema-viewer/schema-code.tsx +65 -0
  139. package/eventcatalog/src/features/mcp/apps/schema-viewer/shared.ts +23 -0
  140. package/eventcatalog/src/features/mcp/apps/schema-viewer/view.tsx +170 -0
  141. package/eventcatalog/src/features/mcp/apps/shared/app-view.tsx +98 -0
  142. package/eventcatalog/src/features/mcp/apps/shared/resource-types.ts +15 -0
  143. package/eventcatalog/src/features/mcp/apps/viewer/shared.ts +24 -0
  144. package/eventcatalog/src/features/mcp/apps/viewer/styles.css +25 -0
  145. package/eventcatalog/src/features/mcp/apps/viewer/view.tsx +59 -0
  146. package/eventcatalog/src/features/mcp/mcp-app-icons.ts +63 -0
  147. package/eventcatalog/src/features/mcp/mcp-apps.ts +160 -0
  148. package/eventcatalog/src/{enterprise → features}/mcp/mcp-auth.ts +0 -5
  149. package/eventcatalog/src/{enterprise → features}/mcp/mcp-scope.ts +7 -7
  150. package/eventcatalog/src/{enterprise → features}/mcp/mcp-scoped-tools.ts +47 -40
  151. package/eventcatalog/src/{enterprise → features}/mcp/mcp-server.ts +347 -34
  152. package/eventcatalog/src/{enterprise → features}/mcp/oauth-protected-resource.ts +0 -5
  153. package/eventcatalog/src/features/mcp/schema-viewer.ts +24 -0
  154. package/eventcatalog/src/{enterprise → features}/tools/catalog-tools.ts +133 -102
  155. package/eventcatalog/src/features/tools/index.ts +5 -0
  156. package/eventcatalog/src/{enterprise → features}/visualizer-layout/reset.ts +0 -5
  157. package/eventcatalog/src/{enterprise → features}/visualizer-layout/save.ts +0 -5
  158. package/eventcatalog/src/layouts/BaseLayout.astro +2 -2
  159. package/eventcatalog/src/layouts/Footer.astro +31 -39
  160. package/eventcatalog/src/layouts/SettingsLayout.astro +6 -6
  161. package/eventcatalog/src/layouts/VerticalSideBarLayout.astro +7 -37
  162. package/eventcatalog/src/{enterprise → pages}/api/schemas/[collection]/[id]/[version]/index.ts +0 -22
  163. package/eventcatalog/src/{enterprise → pages}/api/schemas/services/[id]/[version]/[specification]/index.ts +0 -19
  164. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/[docType]/[docId]/[docVersion]/_index.data.ts +2 -6
  165. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/[docType]/[docId]/[docVersion]/index.astro +1 -5
  166. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/[docType]/[docId]/_index.data.ts +2 -6
  167. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/[docType]/[docId]/index.astro +1 -5
  168. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/[docType]/[docId].md.ts +2 -6
  169. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/[docType]/[docId].mdx.ts +2 -6
  170. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/index.astro +9 -5
  171. package/eventcatalog/src/pages/docs/custom/[...path]/index.astro +12 -0
  172. package/eventcatalog/src/{enterprise/custom-documentation/pages/docs/custom/root-index.astro → pages/docs/custom/index.astro} +1 -23
  173. package/eventcatalog/src/pages/docs/llm/llms-full.txt.ts +4 -9
  174. package/eventcatalog/src/pages/docs/llm/llms.txt.ts +4 -4
  175. package/eventcatalog/src/pages/docs/llm/schemas.txt.ts +0 -11
  176. package/eventcatalog/src/pages/docs/services/[id]/[docType]/[docId]/index.astro +2 -2
  177. package/eventcatalog/src/pages/index.astro +2 -2
  178. package/eventcatalog/src/pages/schemas/[type]/[id]/[version]/index.astro +0 -3
  179. package/eventcatalog/src/pages/schemas/explorer/index.astro +1 -4
  180. package/eventcatalog/src/pages/settings/assistant.astro +2 -4
  181. package/eventcatalog/src/pages/settings/license.astro +18 -0
  182. package/eventcatalog/src/pages/settings/llm-access.astro +1 -4
  183. package/eventcatalog/src/pages/settings/mcp.astro +33 -4
  184. package/eventcatalog/src/pages/visualiser/[type]/[id]/[version]/_index.data.ts +1 -2
  185. package/eventcatalog/src/pages/visualiser/[type]/[id]/[version]/data/index.astro +2 -45
  186. package/eventcatalog/src/pages/visualiser/[type]/[id]/[version]/entity-map/index.astro +1 -1
  187. package/eventcatalog/src/pages/visualiser/[type]/[id]/[version].mermaid.ts +7 -109
  188. package/eventcatalog/src/pages/visualiser/_mermaid-route.ts +78 -0
  189. package/eventcatalog/src/pages/visualiser/domains/[id]/[version]/_index.data.ts +44 -0
  190. package/eventcatalog/src/pages/visualiser/domains/[id]/[version]/entity-map/index.astro +1 -1
  191. package/eventcatalog/src/pages/visualiser/domains/[id]/[version]/index.astro +56 -0
  192. package/eventcatalog/src/pages/visualiser/domains/[id]/[version]/systems-context/index.astro +3 -40
  193. package/eventcatalog/src/pages/visualiser/domains/[id]/[version].mermaid.ts +20 -0
  194. package/eventcatalog/src/pages/visualiser/systems/[id]/[version]/_index.data.ts +29 -0
  195. package/eventcatalog/src/pages/visualiser/systems/[id]/[version]/context/index.astro +3 -38
  196. package/eventcatalog/src/pages/visualiser/systems/[id]/[version]/index.astro +56 -0
  197. package/eventcatalog/src/pages/visualiser/systems/[id]/[version].mermaid.ts +20 -0
  198. package/eventcatalog/src/stores/sidebar-store/builders/agent.ts +1 -1
  199. package/eventcatalog/src/stores/sidebar-store/builders/container.ts +1 -1
  200. package/eventcatalog/src/stores/sidebar-store/builders/data-product.ts +1 -1
  201. package/eventcatalog/src/stores/sidebar-store/builders/domain.ts +7 -32
  202. package/eventcatalog/src/stores/sidebar-store/builders/entity.ts +1 -1
  203. package/eventcatalog/src/stores/sidebar-store/builders/message.ts +1 -1
  204. package/eventcatalog/src/stores/sidebar-store/builders/service.ts +2 -8
  205. package/eventcatalog/src/stores/sidebar-store/builders/system.ts +2 -12
  206. package/eventcatalog/src/stores/sidebar-store/custom-sidebar.ts +0 -10
  207. package/eventcatalog/src/stores/sidebar-store/state.ts +4 -6
  208. package/eventcatalog/src/styles/theme.css +22 -18
  209. package/eventcatalog/src/styles/themes/forest.css +8 -8
  210. package/eventcatalog/src/styles/themes/ocean.css +8 -8
  211. package/eventcatalog/src/styles/themes/sapphire.css +8 -8
  212. package/eventcatalog/src/styles/themes/sunset.css +8 -8
  213. package/eventcatalog/src/utils/clipboard.ts +4 -4
  214. package/eventcatalog/src/utils/collections/flow-step-schema.ts +117 -0
  215. package/eventcatalog/src/utils/collections/pointer-schema.ts +7 -0
  216. package/eventcatalog/src/utils/collections/resource-docs.ts +677 -14
  217. package/eventcatalog/src/utils/collections/schema-loader.ts +0 -5
  218. package/eventcatalog/src/utils/feature.ts +14 -23
  219. package/eventcatalog/src/utils/license.ts +114 -0
  220. package/eventcatalog/src/utils/node-graphs/architecture-diagram-types.ts +32 -0
  221. package/eventcatalog/src/utils/node-graphs/architecture-diagram.ts +84 -0
  222. package/eventcatalog/src/utils/node-graphs/channel-node-graph.ts +4 -25
  223. package/eventcatalog/src/utils/node-graphs/container-node-graph.ts +12 -39
  224. package/eventcatalog/src/utils/node-graphs/data-products-node-graph.ts +11 -27
  225. package/eventcatalog/src/utils/node-graphs/domain-levels-node-graph.ts +679 -0
  226. package/eventcatalog/src/utils/node-graphs/domains-node-graph.ts +3 -20
  227. package/eventcatalog/src/utils/node-graphs/export-mermaid.ts +51 -4
  228. package/eventcatalog/src/utils/node-graphs/field-node-graph.ts +8 -23
  229. package/eventcatalog/src/utils/node-graphs/flow-lanes.ts +119 -0
  230. package/eventcatalog/src/utils/node-graphs/flows-node-graph.ts +133 -47
  231. package/eventcatalog/src/utils/node-graphs/layout-node-graph.ts +28 -0
  232. package/eventcatalog/src/utils/node-graphs/layout-persistence.ts +3 -3
  233. package/eventcatalog/src/utils/node-graphs/message-node-graph.ts +16 -34
  234. package/eventcatalog/src/utils/node-graphs/services-node-graph.ts +11 -25
  235. package/eventcatalog/src/utils/node-graphs/system-context-node-graph.ts +18 -54
  236. package/eventcatalog/src/utils/node-graphs/system-levels-node-graph.ts +59 -0
  237. package/eventcatalog/src/utils/node-graphs/systems-node-graph.ts +20 -80
  238. package/eventcatalog/src/utils/node-graphs/utils/utils.ts +1 -78
  239. package/eventcatalog/src/utils/trial.ts +36 -0
  240. package/eventcatalog/tsconfig.json +1 -1
  241. package/package.json +11 -11
  242. package/dist/chunk-FV56YFM4.js +0 -7
  243. package/dist/federation/entitlement.cjs +0 -31
  244. package/dist/federation/entitlement.d.cts +0 -12
  245. package/dist/federation/entitlement.d.ts +0 -12
  246. package/dist/federation/entitlement.js +0 -6
  247. package/dist/runtime-dependencies/dagre.mjs +0 -3
  248. package/eventcatalog/src/components/Settings/BillingSettingsForm.tsx +0 -265
  249. package/eventcatalog/src/enterprise/LICENSE +0 -57
  250. package/eventcatalog/src/enterprise/README.md +0 -5
  251. package/eventcatalog/src/enterprise/collections/resource-docs-utils.ts +0 -691
  252. package/eventcatalog/src/enterprise/custom-documentation/components/CustomDocsNav/CustomDocsNav.astro +0 -9
  253. package/eventcatalog/src/enterprise/custom-documentation/pages/docs/custom/[...path]/index.astro +0 -18
  254. package/eventcatalog/src/enterprise/custom-documentation/pages/docs/custom/feature.astro +0 -171
  255. package/eventcatalog/src/enterprise/feature.ts +0 -75
  256. package/eventcatalog/src/enterprise/tools/index.ts +0 -10
  257. package/eventcatalog/src/hooks/eventcatalog-visualizer.ts +0 -126
  258. package/eventcatalog/src/pages/settings/billing.astro +0 -17
  259. package/eventcatalog/src/pages/visualiser/domain-integrations/index.astro +0 -26
  260. package/eventcatalog/src/types/mcp-modules.d.ts +0 -67
  261. package/eventcatalog/src/utils/node-graphs/domains-canvas.ts +0 -261
  262. package/eventcatalog/src/utils/node-graphs/export-node-graph.ts +0 -91
  263. /package/eventcatalog/src/{enterprise → features}/auth/error.astro +0 -0
  264. /package/eventcatalog/src/{enterprise → features}/auth/login.astro +0 -0
  265. /package/eventcatalog/src/{enterprise → features}/auth/unauthorized.astro +0 -0
  266. /package/eventcatalog/src/{enterprise/custom-documentation/pages → pages}/docs/custom/[...path]/_index.data.ts +0 -0
  267. /package/eventcatalog/src/{enterprise/custom-documentation/pages → pages}/docs/custom/[...path].mdx.ts +0 -0
@@ -29,10 +29,10 @@ var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
29
29
  // src/eventcatalog.ts
30
30
  var import_commander = require("commander");
31
31
  var import_node_child_process2 = require("child_process");
32
- var import_node_path19 = require("path");
32
+ var import_node_path20 = require("path");
33
33
  var import_node_http = __toESM(require("http"), 1);
34
34
  var import_fs = __toESM(require("fs"), 1);
35
- var import_node_path20 = __toESM(require("path"), 1);
35
+ var import_node_path21 = __toESM(require("path"), 1);
36
36
  var import_node_url2 = require("url");
37
37
  var import_node_module2 = require("module");
38
38
 
@@ -181,7 +181,7 @@ var verifyRequiredFieldsAreInCatalogConfigFile = async (projectDirectory) => {
181
181
  var import_picocolors = __toESM(require("picocolors"), 1);
182
182
 
183
183
  // package.json
184
- var version = "4.12.3";
184
+ var version = "5.0.0-beta.1";
185
185
 
186
186
  // src/constants.ts
187
187
  var VERSION = version;
@@ -305,6 +305,7 @@ var generate = async (PROJECT_DIRECTORY) => {
305
305
  // src/analytics/analytics.js
306
306
  var import_os = __toESM(require("os"), 1);
307
307
  async function raiseEvent(eventData) {
308
+ if (typeof eventData?.command !== "string" || typeof eventData?.cId !== "string") return;
308
309
  const url = "https://queue.simpleanalyticscdn.com/events";
309
310
  const userAgent = `@eventcatalog/eventcatalog@${VERSION} (${import_os.default.platform()}; ${import_os.default.arch()}; Node/${process.version})`;
310
311
  const headers = {
@@ -400,8 +401,207 @@ function serializeCounts(counts) {
400
401
  return Object.entries(counts).map(([k, v]) => `${k}:${v}`).join(",");
401
402
  }
402
403
 
404
+ // src/utils/license-status.ts
405
+ var import_boxen = __toESM(require("boxen"), 1);
406
+ var import_license2 = require("@eventcatalog/license");
407
+
408
+ // eventcatalog/src/utils/trial.ts
409
+ var TRIAL_LENGTH_DAYS = 90;
410
+ var LICENSE_FAQ_URL = "https://www.eventcatalog.dev/license-faq";
411
+ var LICENSE_RENEW_URL = "https://eventcatalog.cloud";
412
+ var DAY_IN_MS = 24 * 60 * 60 * 1e3;
413
+ var getTrialStatus = (tsd, now = Date.now()) => {
414
+ if (typeof tsd !== "number" || !Number.isFinite(tsd) || tsd <= 0) return;
415
+ const endsAt = tsd + TRIAL_LENGTH_DAYS * DAY_IN_MS;
416
+ const daysLeft = Math.max(0, Math.ceil((endsAt - now) / DAY_IN_MS));
417
+ return { daysLeft, ended: daysLeft === 0, endsAt: new Date(endsAt) };
418
+ };
419
+ var LICENSE_REMINDER_DAYS = 30;
420
+
421
+ // eventcatalog/src/utils/license.ts
422
+ var import_node_fs2 = __toESM(require("fs"), 1);
423
+ var import_node_path5 = __toESM(require("path"), 1);
424
+ var import_license = require("@eventcatalog/license");
425
+ var toDate = (seconds) => typeof seconds === "number" ? new Date(seconds * 1e3) : void 0;
426
+ var getDetails = (claims) => ({
427
+ org: typeof claims.org === "string" ? claims.org : void 0,
428
+ licenseId: typeof claims.licenseId === "string" ? claims.licenseId : void 0,
429
+ issuedAt: toDate(claims.iat)
430
+ });
431
+ var INVALID_REASONS = {
432
+ LICENSE_FILE_EMPTY: "the file is empty",
433
+ LICENSE_NOT_YET_VALID: "it is not valid yet",
434
+ LICENSE_SIGNATURE_INVALID: "its signature is invalid",
435
+ LICENSE_VALIDATION_FAILED: "it was not issued by EventCatalog"
436
+ };
437
+ var getLicenseFilePath = (projectDirectory) => process.env.EC_LICENSE || import_node_path5.default.join(projectDirectory, "license.jwt");
438
+ var readClaims = (licenseFilePath) => {
439
+ try {
440
+ const payload = import_node_fs2.default.readFileSync(licenseFilePath, "utf8").trim().split(".")[1];
441
+ return JSON.parse(Buffer.from(payload, "base64url").toString("utf8"));
442
+ } catch {
443
+ return {};
444
+ }
445
+ };
446
+ var statusCache = /* @__PURE__ */ new Map();
447
+ var getLicensePlan = () => {
448
+ if (process.env.EVENTCATALOG_SCALE === "true") return "scale";
449
+ if (process.env.EVENTCATALOG_STARTER === "true") return "starter";
450
+ };
451
+ var getCommercialLicenseStatus = (projectDirectory = process.env.PROJECT_DIR || process.cwd()) => {
452
+ const licensePath = getLicenseFilePath(projectDirectory);
453
+ const modifiedAt = import_node_fs2.default.statSync(licensePath, { throwIfNoEntry: false })?.mtimeMs;
454
+ if (modifiedAt === void 0) return Promise.resolve({ state: "none" });
455
+ const key = `${licensePath}:${modifiedAt}`;
456
+ if (!statusCache.has(key)) statusCache.set(key, verifyLicense(licensePath));
457
+ return statusCache.get(key);
458
+ };
459
+ var getLicenseStatus = async (projectDirectory) => {
460
+ const license = await getCommercialLicenseStatus(projectDirectory);
461
+ if (license.state === "licensed") return license;
462
+ const plan = getLicensePlan();
463
+ return plan ? { state: "plan", plan } : license;
464
+ };
465
+ var verifyLicense = async (licensePath) => {
466
+ const consoleError = console.error;
467
+ console.error = () => {
468
+ };
469
+ try {
470
+ (0, import_license.clearCache)();
471
+ if (await (0, import_license.hasCommercialLicense)()) {
472
+ const entitlements2 = await (0, import_license.verifyOfflineLicense)({ licensePath });
473
+ return { state: "licensed", ...getDetails(entitlements2), expiresAt: new Date(entitlements2.exp * 1e3) };
474
+ }
475
+ (0, import_license.clearCache)();
476
+ const entitlements = await (0, import_license.verifyOfflineLicense)({ licensePath });
477
+ if (typeof entitlements.exp !== "number") return { state: "invalid", reason: "it has no expiry date" };
478
+ return { state: "expired", ...getDetails(entitlements), expiresAt: new Date(entitlements.exp * 1e3) };
479
+ } catch (error) {
480
+ if (error?.code === "LICENSE_EXPIRED") {
481
+ const claims = readClaims(licensePath);
482
+ return { state: "expired", ...getDetails(claims), expiresAt: toDate(claims.exp) };
483
+ }
484
+ return { state: "invalid", reason: INVALID_REASONS[error?.code] || error?.message || String(error) };
485
+ } finally {
486
+ console.error = consoleError;
487
+ }
488
+ };
489
+
490
+ // src/utils/license-status.ts
491
+ var isPlanEnabled = async (check) => {
492
+ const consoleError = console.error;
493
+ console.error = () => {
494
+ };
495
+ try {
496
+ return await check();
497
+ } catch {
498
+ return false;
499
+ } finally {
500
+ console.error = consoleError;
501
+ }
502
+ };
503
+ var checkPlanLicense = async () => {
504
+ if (await isPlanEnabled(import_license2.isEventCatalogScaleEnabled)) return "scale";
505
+ if (await isPlanEnabled(import_license2.isEventCatalogStarterEnabled)) return "starter";
506
+ };
507
+ var getLicenseStatus2 = async (projectDirectory) => {
508
+ const license = await getCommercialLicenseStatus(projectDirectory);
509
+ const plan = license.state === "licensed" ? void 0 : await checkPlanLicense();
510
+ process.env.EVENTCATALOG_SCALE = String(plan === "scale");
511
+ process.env.EVENTCATALOG_STARTER = String(plan === "starter");
512
+ return getLicenseStatus(projectDirectory);
513
+ };
514
+ var DAY_IN_MS2 = 24 * 60 * 60 * 1e3;
515
+ var getLicenseType = (license) => {
516
+ if (license.state === "licensed") return "commercial";
517
+ if (license.state === "plan") return license.plan;
518
+ return "trial";
519
+ };
520
+ var getLicenseAnalytics = (license = { state: "none" }, tsd) => ({
521
+ license: getLicenseType(license),
522
+ licenseState: license.state === "licensed" || license.state === "plan" ? "valid" : license.state,
523
+ licenseExpiry: "expiresAt" in license ? license.expiresAt?.getTime() : void 0,
524
+ trialExpiry: getTrialStatus(tsd)?.endsAt.getTime()
525
+ });
526
+ var formatDate = (date) => date.toLocaleDateString(void 0, { dateStyle: "medium" });
527
+ var formatDays = (days) => `${days} ${days === 1 ? "day" : "days"}`;
528
+ var getTrialLine = (tsd, now) => {
529
+ const trial = getTrialStatus(tsd, now);
530
+ if (!trial) return;
531
+ return trial.ended ? `Your ${TRIAL_LENGTH_DAYS}-day EventCatalog trial ended on ${formatDate(trial.endsAt)}.` : `${formatDays(trial.daysLeft)} left of your ${TRIAL_LENGTH_DAYS}-day EventCatalog trial (ends ${formatDate(trial.endsAt)}).`;
532
+ };
533
+ var getLicenseStatusMessage = (license, tsd, now = Date.now()) => {
534
+ if (license.state === "licensed") {
535
+ const daysLeft = Math.max(0, Math.ceil((license.expiresAt.getTime() - now) / DAY_IN_MS2));
536
+ const licensedTo = license.org ? `Licensed to ${license.org}` : "Licensed";
537
+ if (daysLeft < LICENSE_REMINDER_DAYS) {
538
+ return {
539
+ title: "EventCatalog Commercial License",
540
+ color: "yellow",
541
+ text: [
542
+ licensedTo,
543
+ `Your license expires in ${formatDays(daysLeft)}, on ${formatDate(license.expiresAt)}.`,
544
+ `Renew it to keep using EventCatalog commercially: ${LICENSE_RENEW_URL}`
545
+ ].join("\n")
546
+ };
547
+ }
548
+ return {
549
+ title: "EventCatalog Commercial License",
550
+ color: "green",
551
+ text: `${licensedTo}
552
+ Valid until ${formatDate(license.expiresAt)} (${formatDays(daysLeft)} left)`
553
+ };
554
+ }
555
+ if (license.state === "plan") return;
556
+ const trialLine = getTrialLine(tsd, now);
557
+ if (license.state === "none") {
558
+ if (!trialLine) return;
559
+ const ended = getTrialStatus(tsd, now)?.ended;
560
+ return {
561
+ title: "EventCatalog trial",
562
+ color: ended ? "yellow" : "green",
563
+ text: `${trialLine}
564
+ Learn about licensing: ${LICENSE_FAQ_URL}`
565
+ };
566
+ }
567
+ if (license.state === "expired") {
568
+ const expiredOn = license.expiresAt ? `expired on ${formatDate(license.expiresAt)} (${formatDays(Math.floor((now - license.expiresAt.getTime()) / DAY_IN_MS2))} ago)` : "has expired";
569
+ return {
570
+ title: "EventCatalog License Expired",
571
+ color: "yellow",
572
+ text: [
573
+ `Your EventCatalog commercial license${license.org ? ` for ${license.org}` : ""} ${expiredOn}.`,
574
+ `Renew it to keep using EventCatalog commercially: ${LICENSE_RENEW_URL}`,
575
+ trialLine,
576
+ `Learn about licensing: ${LICENSE_FAQ_URL}`
577
+ ].filter(Boolean).join("\n")
578
+ };
579
+ }
580
+ return {
581
+ title: "EventCatalog license",
582
+ color: "yellow",
583
+ text: [`Your license.jwt could not be verified: ${license.reason}.`, trialLine, `Learn about licensing: ${LICENSE_FAQ_URL}`].filter(Boolean).join("\n")
584
+ };
585
+ };
586
+ var printLicenseStatus = (license, tsd) => {
587
+ const message = getLicenseStatusMessage(license, tsd);
588
+ if (!message) return;
589
+ console.log(
590
+ (0, import_boxen.default)(message.text, {
591
+ padding: 1,
592
+ margin: 1,
593
+ borderStyle: "round",
594
+ borderColor: message.color,
595
+ title: message.title,
596
+ titleAlignment: "center"
597
+ })
598
+ );
599
+ };
600
+
403
601
  // src/analytics/log-build.js
602
+ var isMCPEnabled = (configFile) => configFile.output === "server" && (configFile.mcp?.enabled ?? true);
404
603
  var getFeatures = async (configFile) => {
604
+ const mcp = isMCPEnabled(configFile);
405
605
  return {
406
606
  llmsTxt: configFile.llmsTxt?.enabled || false,
407
607
  rss: configFile.rss?.enabled || false,
@@ -409,7 +609,9 @@ var getFeatures = async (configFile) => {
409
609
  changelog: configFile.changelog?.enabled || false,
410
610
  auth: configFile.auth?.enabled || false,
411
611
  environments: Array.isArray(configFile.environments) && configFile.environments.length > 0,
412
- output: configFile.output || "static"
612
+ output: configFile.output || "static",
613
+ mcp,
614
+ mcpAuth: mcp && (configFile.mcp?.auth?.enabled ?? false)
413
615
  };
414
616
  };
415
617
  var getDirectoryProvider = (source) => {
@@ -469,21 +671,12 @@ var reportCloudResourceInventory = async (configFile, resourceCounts) => {
469
671
  })
470
672
  });
471
673
  };
472
- var main = async (projectDir, { isEventCatalogStarterEnabled: isEventCatalogStarterEnabled2, isEventCatalogScaleEnabled: isEventCatalogScaleEnabled2, isBackstagePluginEnabled, command = "build" }) => {
674
+ var main = async (projectDir, { command = "build", license } = {}) => {
473
675
  try {
474
676
  await verifyRequiredFieldsAreInCatalogConfigFile(projectDir);
475
677
  const configFile = await getEventCatalogConfigFile(projectDir);
476
678
  const { cId, tsd, organizationName, generators = [] } = configFile;
477
- let generatorNames = generators.length > 0 ? generators.map((generator) => generator[0]) : ["none"];
478
- if (isEventCatalogStarterEnabled2) {
479
- generatorNames.push("@eventcatalog/eventcatalog-starter");
480
- }
481
- if (isEventCatalogScaleEnabled2) {
482
- generatorNames.push("@eventcatalog/eventcatalog-scale");
483
- }
484
- if (isBackstagePluginEnabled) {
485
- generatorNames.push("@eventcatalog/backstage-plugin-eventcatalog");
486
- }
679
+ const generatorNames = generators.length > 0 ? generators.map((generator) => generator[0]) : ["none"];
487
680
  const features = await getFeatures(configFile);
488
681
  const resourceCounts = await countResources(projectDir);
489
682
  const contentHash = await hashCatalogContent(projectDir);
@@ -494,11 +687,10 @@ var main = async (projectDir, { isEventCatalogStarterEnabled: isEventCatalogStar
494
687
  cId,
495
688
  // Trial start date (unix ms) from eventcatalog.config.js
496
689
  tsd,
690
+ // Commercial license or trial, and when each expires (unix ms)
691
+ ...getLicenseAnalytics(license, tsd),
497
692
  // CI redeploys and human-run builds are different signals; tag rather than suppress
498
693
  ci: process.env.CI ? "true" : "false",
499
- // The commercial plan, separate from the generators list, so telemetry joins cleanly to licensing
500
- plan: isEventCatalogScaleEnabled2 ? "scale" : isEventCatalogStarterEnabled2 ? "starter" : "none",
501
- backstage: isBackstagePluginEnabled ? "true" : "false",
502
694
  contentHash,
503
695
  generators: generatorNames.toString(),
504
696
  features: Object.keys(features).map((feature) => `${feature}:${features[feature]}`).join(","),
@@ -522,8 +714,8 @@ async function watch(projectDirectory, catalogDirectory, callback = () => {
522
714
  }
523
715
 
524
716
  // src/resolve-catalog-dependencies.js
525
- var import_node_path5 = __toESM(require("path"), 1);
526
- var import_node_fs2 = __toESM(require("fs"), 1);
717
+ var import_node_path6 = __toESM(require("path"), 1);
718
+ var import_node_fs3 = __toESM(require("fs"), 1);
527
719
  var import_gray_matter2 = __toESM(require("gray-matter"), 1);
528
720
  var resolve_catalog_dependencies_default = async (catalogDir, core2) => {
529
721
  const catalogConfig = await getEventCatalogConfigFile(catalogDir);
@@ -531,11 +723,11 @@ var resolve_catalog_dependencies_default = async (catalogDir, core2) => {
531
723
  if (!dependencies) {
532
724
  return;
533
725
  }
534
- const dependenciesDir = import_node_path5.default.join(catalogDir, "dependencies");
535
- if (import_node_fs2.default.existsSync(dependenciesDir)) {
536
- import_node_fs2.default.rmSync(dependenciesDir, { recursive: true, force: true });
726
+ const dependenciesDir = import_node_path6.default.join(catalogDir, "dependencies");
727
+ if (import_node_fs3.default.existsSync(dependenciesDir)) {
728
+ import_node_fs3.default.rmSync(dependenciesDir, { recursive: true, force: true });
537
729
  }
538
- import_node_fs2.default.mkdirSync(dependenciesDir, { recursive: true });
730
+ import_node_fs3.default.mkdirSync(dependenciesDir, { recursive: true });
539
731
  const resourceTypes = Object.keys(dependencies);
540
732
  for (const resourceType of resourceTypes) {
541
733
  for (const dependency of dependencies[resourceType]) {
@@ -555,20 +747,20 @@ var resolve_catalog_dependencies_default = async (catalogDir, core2) => {
555
747
  },
556
748
  frontmatter
557
749
  );
558
- const resourceFile = import_node_path5.default.join(dependenciesDir, resourceType, dependency.id, `index.md`);
559
- import_node_fs2.default.mkdirSync(import_node_path5.default.dirname(resourceFile), { recursive: true });
560
- import_node_fs2.default.writeFileSync(resourceFile, markdown);
750
+ const resourceFile = import_node_path6.default.join(dependenciesDir, resourceType, dependency.id, `index.md`);
751
+ import_node_fs3.default.mkdirSync(import_node_path6.default.dirname(resourceFile), { recursive: true });
752
+ import_node_fs3.default.writeFileSync(resourceFile, markdown);
561
753
  }
562
754
  }
563
755
  return;
564
756
  };
565
757
 
566
758
  // src/eventcatalog.ts
567
- var import_boxen = __toESM(require("boxen"), 1);
759
+ var import_boxen2 = __toESM(require("boxen"), 1);
568
760
 
569
761
  // src/features.ts
570
- var import_node_path6 = require("path");
571
- var import_node_fs3 = __toESM(require("fs"), 1);
762
+ var import_node_path7 = require("path");
763
+ var import_node_fs4 = __toESM(require("fs"), 1);
572
764
  var getProjectOutDir = async () => {
573
765
  const config = await getEventCatalogConfigFile(process.env.PROJECT_DIR || "");
574
766
  return config?.outDir || "dist";
@@ -583,7 +775,7 @@ var isIndexedSearchEnabled = async () => {
583
775
  };
584
776
  var isAuthEnabled = async () => {
585
777
  const directory = process.env.PROJECT_DIR || process.cwd();
586
- const hasAuthConfig = import_node_fs3.default.existsSync((0, import_node_path6.join)(directory, "eventcatalog.auth.js"));
778
+ const hasAuthConfig = import_node_fs4.default.existsSync((0, import_node_path7.join)(directory, "eventcatalog.auth.js"));
587
779
  return hasAuthConfig;
588
780
  };
589
781
 
@@ -592,11 +784,11 @@ var import_update_notifier = __toESM(require("update-notifier"), 1);
592
784
  var import_dotenv = __toESM(require("dotenv"), 1);
593
785
 
594
786
  // src/migrations/message-channels-to-service-channels.ts
595
- var import_node_fs4 = __toESM(require("fs"), 1);
787
+ var import_node_fs5 = __toESM(require("fs"), 1);
596
788
  var import_glob2 = require("glob");
597
789
  var import_node_os2 = __toESM(require("os"), 1);
598
790
  var import_gray_matter3 = __toESM(require("gray-matter"), 1);
599
- var import_node_path7 = __toESM(require("path"), 1);
791
+ var import_node_path8 = __toESM(require("path"), 1);
600
792
  var DISABLE_CHANNEL_MIGRATION_ENV = "EVENTCATALOG_DISABLE_CHANNEL_MIGRATION";
601
793
  var isChannelMigrationDisabled = () => {
602
794
  return ["true", "1", "yes"].includes((process.env[DISABLE_CHANNEL_MIGRATION_ENV] ?? "").toLowerCase());
@@ -605,7 +797,7 @@ var message_channels_to_service_channels_default = async (dir2) => {
605
797
  if (isChannelMigrationDisabled()) {
606
798
  return { status: "skipped", message: `Channel migration disabled by ${DISABLE_CHANNEL_MIGRATION_ENV}` };
607
799
  }
608
- const PROJECT_DIR = import_node_path7.default.join(dir2 || process.env.PROJECT_DIR);
800
+ const PROJECT_DIR = import_node_path8.default.join(dir2 || process.env.PROJECT_DIR);
609
801
  const messages = await (0, import_glob2.glob)(
610
802
  [
611
803
  "**/events/*/index.mdx",
@@ -645,7 +837,7 @@ var message_channels_to_service_channels_default = async (dir2) => {
645
837
  }
646
838
  );
647
839
  const messagesWithChannels = messages.reduce((acc, message) => {
648
- const file = import_node_fs4.default.readFileSync(message, "utf8");
840
+ const file = import_node_fs5.default.readFileSync(message, "utf8");
649
841
  const { data } = (0, import_gray_matter3.default)(file);
650
842
  if (data.channels?.length > 0) {
651
843
  acc.push({
@@ -659,7 +851,7 @@ var message_channels_to_service_channels_default = async (dir2) => {
659
851
  return { status: "success", message: "No messages with channels found in the catalog" };
660
852
  }
661
853
  const servicesWithChannels = services.reduce((acc, service) => {
662
- const file = import_node_fs4.default.readFileSync(service, "utf8");
854
+ const file = import_node_fs5.default.readFileSync(service, "utf8");
663
855
  const { data } = (0, import_gray_matter3.default)(file);
664
856
  const isSending = data.sends?.some((send) => messagesWithChannels.some((message) => message.id === send.id));
665
857
  const isReceiving = data.receives?.some(
@@ -674,7 +866,7 @@ var message_channels_to_service_channels_default = async (dir2) => {
674
866
  return acc;
675
867
  }, []);
676
868
  for (const service of servicesWithChannels) {
677
- const file = import_node_fs4.default.readFileSync(service.path, "utf8");
869
+ const file = import_node_fs5.default.readFileSync(service.path, "utf8");
678
870
  const { data } = (0, import_gray_matter3.default)(file);
679
871
  const messagesTheServiceSendsThatNeedUpdating = data.sends?.filter((send) => messagesWithChannels.some((message) => message.id === send.id)) ?? [];
680
872
  const messagesTheServiceReceivesThatNeedUpdating = data.receives?.filter((receive) => messagesWithChannels.some((message) => message.id === receive.id)) ?? [];
@@ -694,14 +886,14 @@ var message_channels_to_service_channels_default = async (dir2) => {
694
886
  ...newSends.length > 0 ? { sends: newSends } : {},
695
887
  ...newReceives.length > 0 ? { receives: newReceives } : {}
696
888
  };
697
- import_node_fs4.default.writeFileSync(service.path, import_gray_matter3.default.stringify(file, newData));
889
+ import_node_fs5.default.writeFileSync(service.path, import_gray_matter3.default.stringify(file, newData));
698
890
  }
699
891
  }
700
892
  for (const message of messagesWithChannels) {
701
- const file = import_node_fs4.default.readFileSync(message.path, "utf8");
893
+ const file = import_node_fs5.default.readFileSync(message.path, "utf8");
702
894
  const parsed = (0, import_gray_matter3.default)(file);
703
895
  const { channels, ...newData } = parsed.data;
704
- import_node_fs4.default.writeFileSync(message.path, import_gray_matter3.default.stringify(parsed.content, newData));
896
+ import_node_fs5.default.writeFileSync(message.path, import_gray_matter3.default.stringify(parsed.content, newData));
705
897
  }
706
898
  console.log("\u2714 Channels migrated to new services API");
707
899
  };
@@ -711,13 +903,13 @@ var runMigrations = async (dir2) => {
711
903
  await message_channels_to_service_channels_default(dir2);
712
904
  };
713
905
 
714
- // eventcatalog/src/enterprise/fields/field-indexer.ts
715
- var import_node_path9 = __toESM(require("path"), 1);
716
- var import_node_fs6 = __toESM(require("fs"), 1);
906
+ // eventcatalog/src/features/fields/field-indexer.ts
907
+ var import_node_path10 = __toESM(require("path"), 1);
908
+ var import_node_fs7 = __toESM(require("fs"), 1);
717
909
 
718
- // eventcatalog/src/enterprise/fields/fields-db.ts
910
+ // eventcatalog/src/features/fields/fields-db.ts
719
911
  var import_sql = __toESM(require("sql.js"), 1);
720
- var import_node_fs5 = __toESM(require("fs"), 1);
912
+ var import_node_fs6 = __toESM(require("fs"), 1);
721
913
  var SCHEMA_SQL = `
722
914
  CREATE TABLE IF NOT EXISTS fields (
723
915
  id INTEGER PRIMARY KEY AUTOINCREMENT,
@@ -786,13 +978,13 @@ var FieldsDatabase = class _FieldsDatabase {
786
978
  this.dbPath = dbPath;
787
979
  }
788
980
  static async create(dbPath, options) {
789
- if (options?.recreate && import_node_fs5.default.existsSync(dbPath)) {
790
- import_node_fs5.default.unlinkSync(dbPath);
981
+ if (options?.recreate && import_node_fs6.default.existsSync(dbPath)) {
982
+ import_node_fs6.default.unlinkSync(dbPath);
791
983
  }
792
984
  const SQL = await (0, import_sql.default)();
793
985
  let db;
794
- if (!options?.recreate && import_node_fs5.default.existsSync(dbPath)) {
795
- const buffer = import_node_fs5.default.readFileSync(dbPath);
986
+ if (!options?.recreate && import_node_fs6.default.existsSync(dbPath)) {
987
+ const buffer = import_node_fs6.default.readFileSync(dbPath);
796
988
  db = new SQL.Database(buffer);
797
989
  } else {
798
990
  db = new SQL.Database();
@@ -853,7 +1045,7 @@ var FieldsDatabase = class _FieldsDatabase {
853
1045
  save() {
854
1046
  const data = this.db.export();
855
1047
  const buffer = Buffer.from(data);
856
- import_node_fs5.default.writeFileSync(this.dbPath, buffer);
1048
+ import_node_fs6.default.writeFileSync(this.dbPath, buffer);
857
1049
  }
858
1050
  queryFields(params) {
859
1051
  const {
@@ -1022,7 +1214,7 @@ function decodeCursor(cursor) {
1022
1214
  return parseInt(Buffer.from(cursor, "base64url").toString(), 10);
1023
1215
  }
1024
1216
 
1025
- // eventcatalog/src/enterprise/fields/field-extractor.ts
1217
+ // eventcatalog/src/features/fields/field-extractor.ts
1026
1218
  function extractSchemaFieldsDeep(content, format) {
1027
1219
  if (!content) return [];
1028
1220
  if (format === "json-schema") {
@@ -1078,22 +1270,22 @@ function getAvroTypeName(type) {
1078
1270
  function walkAvroRecord(schema, prefix, fields) {
1079
1271
  if (!schema.fields || !Array.isArray(schema.fields)) return;
1080
1272
  for (const field of schema.fields) {
1081
- const path19 = prefix ? `${prefix}.${field.name}` : field.name;
1273
+ const path20 = prefix ? `${prefix}.${field.name}` : field.name;
1082
1274
  const isOptional = Array.isArray(field.type) && field.type.includes("null");
1083
1275
  const typeName = getAvroTypeName(field.type);
1084
1276
  fields.push({
1085
- path: path19,
1277
+ path: path20,
1086
1278
  type: typeName,
1087
1279
  description: field.doc || "",
1088
1280
  required: !isOptional
1089
1281
  });
1090
1282
  const innerType = Array.isArray(field.type) ? field.type.find((t) => typeof t === "object" && t.type === "record") : typeof field.type === "object" && field.type.type === "record" ? field.type : null;
1091
1283
  if (innerType) {
1092
- walkAvroRecord(innerType, path19, fields);
1284
+ walkAvroRecord(innerType, path20, fields);
1093
1285
  }
1094
1286
  const arrayType = Array.isArray(field.type) ? field.type.find((t) => typeof t === "object" && t.type === "array") : typeof field.type === "object" && field.type.type === "array" ? field.type : null;
1095
1287
  if (arrayType && typeof arrayType.items === "object" && arrayType.items.type === "record") {
1096
- walkAvroRecord(arrayType.items, `${path19}[]`, fields);
1288
+ walkAvroRecord(arrayType.items, `${path20}[]`, fields);
1097
1289
  }
1098
1290
  }
1099
1291
  }
@@ -1124,32 +1316,32 @@ function walkJsonSchema(node, prefix, requiredList, rootSchema, fields) {
1124
1316
  }
1125
1317
  if (!node.properties) return;
1126
1318
  for (const [name, prop] of Object.entries(node.properties)) {
1127
- const path19 = prefix ? `${prefix}.${name}` : name;
1319
+ const path20 = prefix ? `${prefix}.${name}` : name;
1128
1320
  const isRequired = requiredList.includes(name);
1129
1321
  if (prop.$ref) {
1130
1322
  const resolved = resolveLocalRef(prop.$ref, rootSchema);
1131
1323
  if (resolved) {
1132
1324
  const rawRefType = resolved.type || "object";
1133
1325
  const type2 = Array.isArray(rawRefType) ? [...rawRefType].sort().join(" | ") : rawRefType;
1134
- fields.push({ path: path19, type: type2, description: resolved.description || "", required: isRequired });
1326
+ fields.push({ path: path20, type: type2, description: resolved.description || "", required: isRequired });
1135
1327
  if (resolved.properties) {
1136
- walkJsonSchema(resolved, path19, resolved.required || [], rootSchema, fields);
1328
+ walkJsonSchema(resolved, path20, resolved.required || [], rootSchema, fields);
1137
1329
  }
1138
1330
  } else {
1139
- fields.push({ path: path19, type: "$ref", description: "", required: isRequired });
1331
+ fields.push({ path: path20, type: "$ref", description: "", required: isRequired });
1140
1332
  }
1141
1333
  continue;
1142
1334
  }
1143
1335
  const rawType = prop.type || (prop.enum ? "enum" : prop.$ref ? "$ref" : "object");
1144
1336
  const typeList = Array.isArray(rawType) ? rawType : [rawType];
1145
1337
  const type = Array.isArray(rawType) ? [...rawType].sort().join(" | ") : rawType;
1146
- fields.push({ path: path19, type, description: prop.description || "", required: isRequired });
1338
+ fields.push({ path: path20, type, description: prop.description || "", required: isRequired });
1147
1339
  if (typeList.includes("object") && prop.properties) {
1148
- walkJsonSchema(prop, path19, prop.required || [], rootSchema, fields);
1340
+ walkJsonSchema(prop, path20, prop.required || [], rootSchema, fields);
1149
1341
  }
1150
1342
  if (typeList.includes("array") && prop.items) {
1151
1343
  if (prop.items.type === "object" && prop.items.properties) {
1152
- walkJsonSchema(prop.items, `${path19}[]`, prop.items.required || [], rootSchema, fields);
1344
+ walkJsonSchema(prop.items, `${path20}[]`, prop.items.required || [], rootSchema, fields);
1153
1345
  }
1154
1346
  }
1155
1347
  }
@@ -1166,22 +1358,22 @@ function resolveLocalRef(ref, rootSchema) {
1166
1358
  }
1167
1359
 
1168
1360
  // eventcatalog/integrations/runtime-paths.mjs
1169
- var import_node_path8 = __toESM(require("path"), 1);
1361
+ var import_node_path9 = __toESM(require("path"), 1);
1170
1362
  function getRuntimePaths(projectDirectory, runtimeDirectory) {
1171
- const project = import_node_path8.default.resolve(projectDirectory);
1172
- const cacheDirectory = import_node_path8.default.join(project, ".astro");
1173
- const runtime = runtimeDirectory ? import_node_path8.default.resolve(runtimeDirectory) : import_node_path8.default.join(cacheDirectory, "eventcatalog");
1363
+ const project = import_node_path9.default.resolve(projectDirectory);
1364
+ const cacheDirectory = import_node_path9.default.join(project, ".astro");
1365
+ const runtime = runtimeDirectory ? import_node_path9.default.resolve(runtimeDirectory) : import_node_path9.default.join(cacheDirectory, "eventcatalog");
1174
1366
  return {
1175
1367
  projectDirectory: project,
1176
1368
  cacheDirectory,
1177
1369
  runtimeDirectory: runtime,
1178
- fieldsDatabasePath: import_node_path8.default.join(runtime, ".eventcatalog", "fields.db")
1370
+ fieldsDatabasePath: import_node_path9.default.join(runtime, ".eventcatalog", "fields.db")
1179
1371
  };
1180
1372
  }
1181
1373
 
1182
- // eventcatalog/src/enterprise/fields/field-indexer.ts
1374
+ // eventcatalog/src/features/fields/field-indexer.ts
1183
1375
  function detectFormat(fileName) {
1184
- const ext = import_node_path9.default.extname(fileName).toLowerCase();
1376
+ const ext = import_node_path10.default.extname(fileName).toLowerCase();
1185
1377
  if (ext === ".proto") return "proto";
1186
1378
  if (ext === ".avro" || ext === ".avsc") return "avro";
1187
1379
  return "json-schema";
@@ -1190,9 +1382,9 @@ async function buildFieldsIndex(catalogDir, outputDir) {
1190
1382
  const sdkModule = await import("@eventcatalog/sdk");
1191
1383
  const sdk = sdkModule.default(catalogDir);
1192
1384
  const { fieldsDatabasePath: dbPath } = getRuntimePaths(catalogDir, outputDir || catalogDir);
1193
- const dbDir = import_node_path9.default.dirname(dbPath);
1194
- if (!import_node_fs6.default.existsSync(dbDir)) {
1195
- import_node_fs6.default.mkdirSync(dbDir, { recursive: true });
1385
+ const dbDir = import_node_path10.default.dirname(dbPath);
1386
+ if (!import_node_fs7.default.existsSync(dbDir)) {
1387
+ import_node_fs7.default.mkdirSync(dbDir, { recursive: true });
1196
1388
  }
1197
1389
  const db = await FieldsDatabase.create(dbPath, { recreate: true });
1198
1390
  const warnings = [];
@@ -1276,7 +1468,7 @@ async function buildFieldsIndex(catalogDir, outputDir) {
1276
1468
 
1277
1469
  // src/search-indexer.ts
1278
1470
  var import_promises4 = __toESM(require("fs/promises"), 1);
1279
- var import_node_path10 = __toESM(require("path"), 1);
1471
+ var import_node_path11 = __toESM(require("path"), 1);
1280
1472
  var import_glob3 = require("glob");
1281
1473
  var import_gray_matter4 = __toESM(require("gray-matter"), 1);
1282
1474
  var RESOURCE_COLLECTIONS = {
@@ -1340,9 +1532,9 @@ var markdownToSearchText = (content) => {
1340
1532
  };
1341
1533
  var inferDocIdFromFile = (relativePath, frontmatterId) => {
1342
1534
  if (frontmatterId) return frontmatterId;
1343
- const fileName = import_node_path10.default.posix.basename(removeExtension(relativePath));
1535
+ const fileName = import_node_path11.default.posix.basename(removeExtension(relativePath));
1344
1536
  if (fileName.toLowerCase() === "index") {
1345
- return import_node_path10.default.posix.basename(import_node_path10.default.posix.dirname(relativePath));
1537
+ return import_node_path11.default.posix.basename(import_node_path11.default.posix.dirname(relativePath));
1346
1538
  }
1347
1539
  return stripNumericPrefix(fileName);
1348
1540
  };
@@ -1360,7 +1552,7 @@ var findResourceSegment = (segments) => {
1360
1552
  return match;
1361
1553
  };
1362
1554
  var readResourceFrontmatter = async (projectDir, resourcePath) => {
1363
- const candidates = [import_node_path10.default.join(projectDir, resourcePath, "index.mdx"), import_node_path10.default.join(projectDir, resourcePath, "index.md")];
1555
+ const candidates = [import_node_path11.default.join(projectDir, resourcePath, "index.mdx"), import_node_path11.default.join(projectDir, resourcePath, "index.md")];
1364
1556
  for (const candidate of candidates) {
1365
1557
  try {
1366
1558
  const file = await import_promises4.default.readFile(candidate, "utf8");
@@ -1385,7 +1577,7 @@ var deriveRecordFromPath = async ({
1385
1577
  }
1386
1578
  if (segments[0] === "docs") {
1387
1579
  const customPath = normalizeUrlPath(removeExtension(segments.slice(1).join("/")));
1388
- const title = data.title || data.label || import_node_path10.default.posix.basename(customPath) || "Custom docs";
1580
+ const title = data.title || data.label || import_node_path11.default.posix.basename(customPath) || "Custom docs";
1389
1581
  return {
1390
1582
  url: buildUrl(`/docs/custom/${customPath}`, config),
1391
1583
  title,
@@ -1503,7 +1695,7 @@ var collectSearchRecords = async ({
1503
1695
  files.map(async (file) => {
1504
1696
  const raw = await import_promises4.default.readFile(file, "utf8");
1505
1697
  const parsed = (0, import_gray_matter4.default)(raw);
1506
- const relativePath = normalizePath(import_node_path10.default.relative(projectDir, file));
1698
+ const relativePath = normalizePath(import_node_path11.default.relative(projectDir, file));
1507
1699
  const baseRecord = await deriveRecordFromPath({
1508
1700
  projectDir,
1509
1701
  relativePath,
@@ -1551,7 +1743,7 @@ var getSearchOutputPath = ({
1551
1743
  if (searchOutputPath) {
1552
1744
  return searchOutputPath;
1553
1745
  }
1554
- return import_node_path10.default.join(outDir, isServer ? "client" : "", "pagefind");
1746
+ return import_node_path11.default.join(outDir, isServer ? "client" : "", "pagefind");
1555
1747
  };
1556
1748
  var buildSearchIndex = async ({ projectDir, outDir, config, isServer, searchOutputPath }) => {
1557
1749
  const records = await collectSearchRecords({ projectDir, config });
@@ -1605,74 +1797,74 @@ ${errors.join("\n")}`);
1605
1797
  };
1606
1798
 
1607
1799
  // src/catalog-runtime.ts
1608
- var import_node_fs7 = __toESM(require("fs"), 1);
1609
- var import_node_path11 = __toESM(require("path"), 1);
1800
+ var import_node_fs8 = __toESM(require("fs"), 1);
1801
+ var import_node_path12 = __toESM(require("path"), 1);
1610
1802
  var import_node_module = require("module");
1611
1803
  var require2 = (0, import_node_module.createRequire)(importMetaUrl);
1612
1804
  var writeIfChanged = (file, content) => {
1613
- if (import_node_fs7.default.existsSync(file) && import_node_fs7.default.readFileSync(file, "utf8") === content) return;
1614
- import_node_fs7.default.mkdirSync(import_node_path11.default.dirname(file), { recursive: true });
1615
- import_node_fs7.default.writeFileSync(file, content);
1805
+ if (import_node_fs8.default.existsSync(file) && import_node_fs8.default.readFileSync(file, "utf8") === content) return;
1806
+ import_node_fs8.default.mkdirSync(import_node_path12.default.dirname(file), { recursive: true });
1807
+ import_node_fs8.default.writeFileSync(file, content);
1616
1808
  };
1617
1809
  var importPath = (file) => file.replace(/\\/g, "/");
1618
- var hasLegacyCatalogRuntime = (projectDirectory) => import_node_fs7.default.existsSync(import_node_path11.default.join(projectDirectory, ".eventcatalog-core"));
1810
+ var hasLegacyCatalogRuntime = (projectDirectory) => import_node_fs8.default.existsSync(import_node_path12.default.join(projectDirectory, ".eventcatalog-core"));
1619
1811
  var clearCatalogCache = (projectDirectory) => {
1620
1812
  const { cacheDirectory } = getRuntimePaths(projectDirectory);
1621
- import_node_fs7.default.rmSync(cacheDirectory, { recursive: true, force: true });
1813
+ import_node_fs8.default.rmSync(cacheDirectory, { recursive: true, force: true });
1622
1814
  };
1623
1815
  var prepareCatalogRuntime = ({ projectDirectory, catalogDirectory, packageDirectory }) => {
1624
- const runtime = import_node_path11.default.resolve(catalogDirectory);
1625
- const source = import_node_path11.default.resolve(packageDirectory);
1626
- const project = import_node_path11.default.resolve(projectDirectory);
1816
+ const runtime = import_node_path12.default.resolve(catalogDirectory);
1817
+ const source = import_node_path12.default.resolve(packageDirectory);
1818
+ const project = import_node_path12.default.resolve(projectDirectory);
1627
1819
  if (runtime === source || runtime === project) {
1628
1820
  throw new Error("The catalog runtime must be separate from the project and installed application directories.");
1629
1821
  }
1630
- import_node_fs7.default.mkdirSync(runtime, { recursive: true });
1822
+ import_node_fs8.default.mkdirSync(runtime, { recursive: true });
1631
1823
  writeIfChanged(
1632
- import_node_path11.default.join(runtime, "content.config.ts"),
1633
- `export { collections } from ${JSON.stringify(importPath(import_node_path11.default.join(source, "src/content.config.ts")))};
1824
+ import_node_path12.default.join(runtime, "content.config.ts"),
1825
+ `export { collections } from ${JSON.stringify(importPath(import_node_path12.default.join(source, "src/content.config.ts")))};
1634
1826
  `
1635
1827
  );
1636
- const packageTsconfig = JSON.parse(import_node_fs7.default.readFileSync(import_node_path11.default.join(source, "tsconfig.json"), "utf8"));
1828
+ const packageTsconfig = JSON.parse(import_node_fs8.default.readFileSync(import_node_path12.default.join(source, "tsconfig.json"), "utf8"));
1637
1829
  const paths = Object.fromEntries(
1638
1830
  Object.entries(packageTsconfig.compilerOptions.paths).map(([alias, targets]) => [
1639
1831
  alias,
1640
- targets.map((target) => importPath(import_node_path11.default.resolve(source, target)))
1832
+ targets.map((target) => importPath(import_node_path12.default.resolve(source, target)))
1641
1833
  ])
1642
1834
  );
1643
- paths["@config"] = [importPath(import_node_path11.default.join(project, "eventcatalog.config.js"))];
1644
- paths["@catalog/styles"] = [importPath(import_node_path11.default.join(project, "eventcatalog.styles.css"))];
1835
+ paths["@config"] = [importPath(import_node_path12.default.join(project, "eventcatalog.config.js"))];
1836
+ paths["@catalog/styles"] = [importPath(import_node_path12.default.join(project, "eventcatalog.styles.css"))];
1645
1837
  paths["@catalog/components/*"] = [
1646
- importPath(import_node_path11.default.join(project, "components/*")),
1647
- importPath(import_node_path11.default.join(project, "federated/components/*"))
1838
+ importPath(import_node_path12.default.join(project, "components/*")),
1839
+ importPath(import_node_path12.default.join(project, "federated/components/*"))
1648
1840
  ];
1649
- paths["@catalog/snippets/*"] = [importPath(import_node_path11.default.join(project, "snippets/*"))];
1841
+ paths["@catalog/snippets/*"] = [importPath(import_node_path12.default.join(project, "snippets/*"))];
1650
1842
  for (const specifier of ["astro", "astro/zod", "astro/loaders", "astro/runtime/server/index.js"]) {
1651
1843
  paths[specifier] = [importPath(require2.resolve(specifier).replace(/\.js$/, ".d.ts"))];
1652
1844
  }
1653
1845
  writeIfChanged(
1654
- import_node_path11.default.join(runtime, "tsconfig.json"),
1846
+ import_node_path12.default.join(runtime, "tsconfig.json"),
1655
1847
  JSON.stringify(
1656
1848
  {
1657
- extends: importPath(import_node_path11.default.join(source, "tsconfig.json")),
1849
+ extends: importPath(import_node_path12.default.join(source, "tsconfig.json")),
1658
1850
  compilerOptions: {
1659
1851
  baseUrl: ".",
1660
1852
  paths,
1661
1853
  typeRoots: [
1662
- importPath(import_node_path11.default.join(project, "node_modules/@types")),
1663
- importPath(import_node_path11.default.join(source, "../node_modules/@types")),
1664
- importPath(import_node_path11.default.join(source, "../node_modules")),
1665
- importPath(import_node_path11.default.join(project, "node_modules"))
1854
+ importPath(import_node_path12.default.join(project, "node_modules/@types")),
1855
+ importPath(import_node_path12.default.join(source, "../node_modules/@types")),
1856
+ importPath(import_node_path12.default.join(source, "../node_modules")),
1857
+ importPath(import_node_path12.default.join(project, "node_modules"))
1666
1858
  ]
1667
1859
  },
1668
1860
  include: [
1669
- importPath(import_node_path11.default.join(project, ".astro/types.d.ts")),
1861
+ importPath(import_node_path12.default.join(project, ".astro/types.d.ts")),
1670
1862
  "content.config.ts",
1671
- importPath(import_node_path11.default.join(project, "components/**/*")),
1672
- importPath(import_node_path11.default.join(source, "src/**/*"))
1863
+ importPath(import_node_path12.default.join(project, "components/**/*")),
1864
+ importPath(import_node_path12.default.join(source, "src/**/*"))
1673
1865
  ],
1674
1866
  // Keep legacy generated files out of checks on an existing checkout.
1675
- exclude: (packageTsconfig.exclude ?? []).map((entry) => importPath(import_node_path11.default.resolve(source, entry)))
1867
+ exclude: (packageTsconfig.exclude ?? []).map((entry) => importPath(import_node_path12.default.resolve(source, entry)))
1676
1868
  },
1677
1869
  null,
1678
1870
  2
@@ -1752,8 +1944,8 @@ var createAstroDevLineFilter = () => {
1752
1944
  };
1753
1945
 
1754
1946
  // src/astro-config-path.ts
1755
- var import_node_path12 = __toESM(require("path"), 1);
1756
- var getAstroConfigPath = (projectDirectory, configFile, paths = import_node_path12.default) => {
1947
+ var import_node_path13 = __toESM(require("path"), 1);
1948
+ var getAstroConfigPath = (projectDirectory, configFile, paths = import_node_path13.default) => {
1757
1949
  const relative = paths.relative(projectDirectory, configFile);
1758
1950
  const projectRoot = paths.parse(paths.resolve(projectDirectory)).root.toLowerCase();
1759
1951
  const configRoot = paths.parse(paths.resolve(configFile)).root.toLowerCase();
@@ -1768,18 +1960,18 @@ var getAstroConfigPath = (projectDirectory, configFile, paths = import_node_path
1768
1960
  // src/federation/federate.ts
1769
1961
  var import_node_crypto5 = require("crypto");
1770
1962
  var import_promises10 = __toESM(require("fs/promises"), 1);
1771
- var import_node_path18 = __toESM(require("path"), 1);
1963
+ var import_node_path19 = __toESM(require("path"), 1);
1772
1964
  var import_sdk3 = __toESM(require("@eventcatalog/sdk"), 1);
1773
1965
 
1774
1966
  // src/federation/content-cache.ts
1775
1967
  var import_node_crypto2 = require("crypto");
1776
1968
  var import_promises5 = __toESM(require("fs/promises"), 1);
1777
- var import_node_path13 = __toESM(require("path"), 1);
1969
+ var import_node_path14 = __toESM(require("path"), 1);
1778
1970
  var getContentHash = (content) => `sha256:${(0, import_node_crypto2.createHash)("sha256").update(content).digest("hex")}`;
1779
1971
  var isContentHash = (key) => /^sha256:[a-f0-9]{64}$/i.test(key);
1780
1972
  var createFederationContentCache = (projectDirectory, options = {}) => {
1781
- const cacheDirectory = import_node_path13.default.join(projectDirectory, ".eventcatalog-cache", "federation", "content");
1782
- const getCachePath = (key) => import_node_path13.default.join(cacheDirectory, encodeURIComponent(key));
1973
+ const cacheDirectory = import_node_path14.default.join(projectDirectory, ".eventcatalog-cache", "federation", "content");
1974
+ const getCachePath = (key) => import_node_path14.default.join(cacheDirectory, encodeURIComponent(key));
1783
1975
  return {
1784
1976
  async get(key) {
1785
1977
  if (options.read === false || !isContentHash(key)) return void 0;
@@ -1964,26 +2156,22 @@ var getFederationDiagnosticCounts = (diagnostics) => diagnostics.reduce(
1964
2156
  );
1965
2157
  var getVisibleFederationDiagnostics = (diagnostics, verbose) => diagnostics.filter((diagnostic) => verbose || diagnostic.severity === "error");
1966
2158
 
1967
- // src/federation/entitlement.ts
1968
- var import_license = require("@eventcatalog/license");
1969
- var isFederationEnabled = () => (0, import_license.isEventCatalogEnterpriseEnabled)();
1970
-
1971
2159
  // src/federation/output-transaction.ts
1972
2160
  var import_promises6 = __toESM(require("fs/promises"), 1);
1973
- var import_node_path14 = __toESM(require("path"), 1);
2161
+ var import_node_path15 = __toESM(require("path"), 1);
1974
2162
  var getSafePublicPath = (publicDirectory, relativePath) => {
1975
- const normalizedPath = import_node_path14.default.posix.normalize(relativePath);
1976
- const unsafe = relativePath.length === 0 || relativePath.includes("\0") || relativePath.includes("\\") || import_node_path14.default.posix.isAbsolute(relativePath) || /^[a-zA-Z]:\//.test(relativePath) || normalizedPath !== relativePath || normalizedPath === ".." || normalizedPath.startsWith("../");
2163
+ const normalizedPath = import_node_path15.default.posix.normalize(relativePath);
2164
+ const unsafe = relativePath.length === 0 || relativePath.includes("\0") || relativePath.includes("\\") || import_node_path15.default.posix.isAbsolute(relativePath) || /^[a-zA-Z]:\//.test(relativePath) || normalizedPath !== relativePath || normalizedPath === ".." || normalizedPath.startsWith("../");
1977
2165
  if (unsafe) return void 0;
1978
- const destinationPath = import_node_path14.default.resolve(publicDirectory, relativePath);
1979
- const relativeDestinationPath = import_node_path14.default.relative(publicDirectory, destinationPath);
1980
- return relativeDestinationPath !== "" && relativeDestinationPath !== ".." && !relativeDestinationPath.startsWith(`..${import_node_path14.default.sep}`) && !import_node_path14.default.isAbsolute(relativeDestinationPath) ? destinationPath : void 0;
2166
+ const destinationPath = import_node_path15.default.resolve(publicDirectory, relativePath);
2167
+ const relativeDestinationPath = import_node_path15.default.relative(publicDirectory, destinationPath);
2168
+ return relativeDestinationPath !== "" && relativeDestinationPath !== ".." && !relativeDestinationPath.startsWith(`..${import_node_path15.default.sep}`) && !import_node_path15.default.isAbsolute(relativeDestinationPath) ? destinationPath : void 0;
1981
2169
  };
1982
2170
  var beginFederationOutputTransaction = async (projectDirectory, outDir, relativePublicPaths) => {
1983
- const transactionDirectory = await import_promises6.default.mkdtemp(import_node_path14.default.join(projectDirectory, ".eventcatalog-federation-transaction-"));
1984
- const previousOutDir = import_node_path14.default.join(transactionDirectory, "federated");
1985
- const publicBackupDirectory = import_node_path14.default.join(transactionDirectory, "public");
1986
- const publicDirectory = import_node_path14.default.resolve(projectDirectory, "public");
2171
+ const transactionDirectory = await import_promises6.default.mkdtemp(import_node_path15.default.join(projectDirectory, ".eventcatalog-federation-transaction-"));
2172
+ const previousOutDir = import_node_path15.default.join(transactionDirectory, "federated");
2173
+ const publicBackupDirectory = import_node_path15.default.join(transactionDirectory, "public");
2174
+ const publicDirectory = import_node_path15.default.resolve(projectDirectory, "public");
1987
2175
  const publicSnapshots = [];
1988
2176
  const missingPublicDirectories = /* @__PURE__ */ new Set();
1989
2177
  let hadPreviousOutDir = false;
@@ -1994,8 +2182,8 @@ var beginFederationOutputTransaction = async (projectDirectory, outDir, relative
1994
2182
  try {
1995
2183
  const stat = await import_promises6.default.lstat(destinationPath);
1996
2184
  if (!stat.isFile()) continue;
1997
- const backupPath = import_node_path14.default.join(publicBackupDirectory, `${publicSnapshots.length}`);
1998
- await import_promises6.default.mkdir(import_node_path14.default.dirname(backupPath), { recursive: true });
2185
+ const backupPath = import_node_path15.default.join(publicBackupDirectory, `${publicSnapshots.length}`);
2186
+ await import_promises6.default.mkdir(import_node_path15.default.dirname(backupPath), { recursive: true });
1999
2187
  await import_promises6.default.copyFile(destinationPath, backupPath);
2000
2188
  publicSnapshots.push({ backupPath, destinationPath, state: "file" });
2001
2189
  } catch (error) {
@@ -2003,7 +2191,7 @@ var beginFederationOutputTransaction = async (projectDirectory, outDir, relative
2003
2191
  if (code === "ENOTDIR") continue;
2004
2192
  if (code !== "ENOENT") throw error;
2005
2193
  publicSnapshots.push({ destinationPath, state: "missing" });
2006
- let directory = import_node_path14.default.dirname(destinationPath);
2194
+ let directory = import_node_path15.default.dirname(destinationPath);
2007
2195
  while (directory !== publicDirectory) {
2008
2196
  try {
2009
2197
  await import_promises6.default.lstat(directory);
@@ -2013,7 +2201,7 @@ var beginFederationOutputTransaction = async (projectDirectory, outDir, relative
2013
2201
  if (directoryCode === "ENOTDIR") break;
2014
2202
  if (directoryCode !== "ENOENT") throw directoryError;
2015
2203
  missingPublicDirectories.add(directory);
2016
- directory = import_node_path14.default.dirname(directory);
2204
+ directory = import_node_path15.default.dirname(directory);
2017
2205
  }
2018
2206
  }
2019
2207
  }
@@ -2049,7 +2237,7 @@ var beginFederationOutputTransaction = async (projectDirectory, outDir, relative
2049
2237
  continue;
2050
2238
  }
2051
2239
  await attempt(async () => {
2052
- await import_promises6.default.mkdir(import_node_path14.default.dirname(snapshot.destinationPath), { recursive: true });
2240
+ await import_promises6.default.mkdir(import_node_path15.default.dirname(snapshot.destinationPath), { recursive: true });
2053
2241
  await import_promises6.default.copyFile(snapshot.backupPath, snapshot.destinationPath);
2054
2242
  });
2055
2243
  }
@@ -2086,7 +2274,7 @@ var withFederationOutputTransaction = async (projectDirectory, outDir, relativeP
2086
2274
  // src/federation/public-assets.ts
2087
2275
  var import_node_crypto3 = require("crypto");
2088
2276
  var import_promises7 = __toESM(require("fs/promises"), 1);
2089
- var import_node_path15 = __toESM(require("path"), 1);
2277
+ var import_node_path16 = __toESM(require("path"), 1);
2090
2278
  var getContentHash2 = (content) => `sha256:${(0, import_node_crypto3.createHash)("sha256").update(content).digest("hex")}`;
2091
2279
  var getFileHash = async (filePath) => {
2092
2280
  try {
@@ -2098,13 +2286,13 @@ var getFileHash = async (filePath) => {
2098
2286
  }
2099
2287
  };
2100
2288
  var getSafePath = (directory, relativePath) => {
2101
- const normalizedPath = import_node_path15.default.posix.normalize(relativePath);
2102
- const unsafe = relativePath.length === 0 || relativePath.includes("\0") || relativePath.includes("\\") || import_node_path15.default.posix.isAbsolute(relativePath) || /^[a-zA-Z]:\//.test(relativePath) || normalizedPath !== relativePath || normalizedPath === ".." || normalizedPath.startsWith("../");
2289
+ const normalizedPath = import_node_path16.default.posix.normalize(relativePath);
2290
+ const unsafe = relativePath.length === 0 || relativePath.includes("\0") || relativePath.includes("\\") || import_node_path16.default.posix.isAbsolute(relativePath) || /^[a-zA-Z]:\//.test(relativePath) || normalizedPath !== relativePath || normalizedPath === ".." || normalizedPath.startsWith("../");
2103
2291
  if (unsafe) return void 0;
2104
- const resolvedDirectory = import_node_path15.default.resolve(directory);
2105
- const resolvedPath = import_node_path15.default.resolve(resolvedDirectory, relativePath);
2106
- const relativeResolvedPath = import_node_path15.default.relative(resolvedDirectory, resolvedPath);
2107
- if (relativeResolvedPath === "" || relativeResolvedPath === ".." || relativeResolvedPath.startsWith(`..${import_node_path15.default.sep}`) || import_node_path15.default.isAbsolute(relativeResolvedPath)) {
2292
+ const resolvedDirectory = import_node_path16.default.resolve(directory);
2293
+ const resolvedPath = import_node_path16.default.resolve(resolvedDirectory, relativePath);
2294
+ const relativeResolvedPath = import_node_path16.default.relative(resolvedDirectory, resolvedPath);
2295
+ if (relativeResolvedPath === "" || relativeResolvedPath === ".." || relativeResolvedPath.startsWith(`..${import_node_path16.default.sep}`) || import_node_path16.default.isAbsolute(relativeResolvedPath)) {
2108
2296
  return void 0;
2109
2297
  }
2110
2298
  return resolvedPath;
@@ -2112,16 +2300,16 @@ var getSafePath = (directory, relativePath) => {
2112
2300
  var listFiles = async (directory, relativeDirectory = "") => {
2113
2301
  let entries;
2114
2302
  try {
2115
- entries = await import_promises7.default.readdir(import_node_path15.default.join(directory, relativeDirectory), { withFileTypes: true });
2303
+ entries = await import_promises7.default.readdir(import_node_path16.default.join(directory, relativeDirectory), { withFileTypes: true });
2116
2304
  } catch (error) {
2117
2305
  if (error.code === "ENOENT") return [];
2118
2306
  throw error;
2119
2307
  }
2120
2308
  const files = await Promise.all(
2121
2309
  entries.map(async (entry) => {
2122
- const relativePath = import_node_path15.default.join(relativeDirectory, entry.name);
2310
+ const relativePath = import_node_path16.default.join(relativeDirectory, entry.name);
2123
2311
  if (entry.isDirectory()) return listFiles(directory, relativePath);
2124
- return entry.isFile() ? [relativePath.split(import_node_path15.default.sep).join("/")] : [];
2312
+ return entry.isFile() ? [relativePath.split(import_node_path16.default.sep).join("/")] : [];
2125
2313
  })
2126
2314
  );
2127
2315
  return files.flat().sort();
@@ -2136,19 +2324,19 @@ var pathExists = async (filePath) => {
2136
2324
  }
2137
2325
  };
2138
2326
  var hasBlockingParent = async (publicDirectory, destinationPath) => {
2139
- let currentPath = import_node_path15.default.dirname(destinationPath);
2327
+ let currentPath = import_node_path16.default.dirname(destinationPath);
2140
2328
  while (currentPath !== publicDirectory) {
2141
2329
  try {
2142
2330
  if (!(await import_promises7.default.lstat(currentPath)).isDirectory()) return true;
2143
2331
  } catch (error) {
2144
2332
  if (error.code !== "ENOENT") throw error;
2145
2333
  }
2146
- currentPath = import_node_path15.default.dirname(currentPath);
2334
+ currentPath = import_node_path16.default.dirname(currentPath);
2147
2335
  }
2148
2336
  return false;
2149
2337
  };
2150
2338
  var pruneEmptyDirectories = async (publicDirectory, filePath) => {
2151
- let currentPath = import_node_path15.default.dirname(filePath);
2339
+ let currentPath = import_node_path16.default.dirname(filePath);
2152
2340
  while (currentPath !== publicDirectory) {
2153
2341
  try {
2154
2342
  await import_promises7.default.rmdir(currentPath);
@@ -2156,7 +2344,7 @@ var pruneEmptyDirectories = async (publicDirectory, filePath) => {
2156
2344
  if (!["ENOENT", "ENOTEMPTY"].includes(error.code ?? "")) throw error;
2157
2345
  if (error.code === "ENOTEMPTY") return;
2158
2346
  }
2159
- currentPath = import_node_path15.default.dirname(currentPath);
2347
+ currentPath = import_node_path16.default.dirname(currentPath);
2160
2348
  }
2161
2349
  };
2162
2350
  var composePublicAssets = async ({
@@ -2166,8 +2354,8 @@ var composePublicAssets = async ({
2166
2354
  previousFiles = {},
2167
2355
  collisionPaths = /* @__PURE__ */ new Set()
2168
2356
  }) => {
2169
- const publicDirectory = import_node_path15.default.resolve(projectDirectory, "public");
2170
- const federatedPublicDirectory = import_node_path15.default.resolve(federatedDirectory, "public");
2357
+ const publicDirectory = import_node_path16.default.resolve(projectDirectory, "public");
2358
+ const federatedPublicDirectory = import_node_path16.default.resolve(federatedDirectory, "public");
2171
2359
  const sourceFiles = await listFiles(federatedPublicDirectory);
2172
2360
  const sourceFileSet = new Set(sourceFiles);
2173
2361
  const managedFiles = /* @__PURE__ */ new Set();
@@ -2203,7 +2391,7 @@ var composePublicAssets = async ({
2203
2391
  const asset = publicAssetsByPath.get(relativePath);
2204
2392
  if (!asset) throw new Error(`Cannot identify the source of federated public asset "${relativePath}"`);
2205
2393
  const content = await import_promises7.default.readFile(sourcePath);
2206
- await import_promises7.default.mkdir(import_node_path15.default.dirname(destinationPath), { recursive: true });
2394
+ await import_promises7.default.mkdir(import_node_path16.default.dirname(destinationPath), { recursive: true });
2207
2395
  await import_promises7.default.writeFile(destinationPath, content);
2208
2396
  files[relativePath] = { source: asset.resolvedFrom.source, hash: getContentHash2(content) };
2209
2397
  copied += 1;
@@ -2216,17 +2404,17 @@ var composePublicAssets = async ({
2216
2404
  // src/federation/filesystem-source-provider.ts
2217
2405
  var import_node_crypto4 = require("crypto");
2218
2406
  var import_promises8 = __toESM(require("fs/promises"), 1);
2219
- var import_node_path16 = __toESM(require("path"), 1);
2407
+ var import_node_path17 = __toESM(require("path"), 1);
2220
2408
  var import_sdk = __toESM(require("@eventcatalog/sdk"), 1);
2221
2409
  var FILESYSTEM_SOURCE_PREFIX = "file:";
2222
2410
  var isWithinDirectory = (directory, target) => {
2223
- const relativePath = import_node_path16.default.relative(directory, target);
2224
- return relativePath === "" || !relativePath.startsWith(`..${import_node_path16.default.sep}`) && relativePath !== ".." && !import_node_path16.default.isAbsolute(relativePath);
2411
+ const relativePath = import_node_path17.default.relative(directory, target);
2412
+ return relativePath === "" || !relativePath.startsWith(`..${import_node_path17.default.sep}`) && relativePath !== ".." && !import_node_path17.default.isAbsolute(relativePath);
2225
2413
  };
2226
2414
  var assertPortableRelativePath = (filePath, label, allowRoot = true) => {
2227
2415
  const portablePath = filePath.replaceAll("\\", "/");
2228
- const normalizedPath = import_node_path16.default.posix.normalize(portablePath);
2229
- const isUnsafe = filePath.includes("\\") || filePath.includes("\0") || import_node_path16.default.posix.isAbsolute(normalizedPath) || /^[a-zA-Z]:\//.test(normalizedPath) || normalizedPath === ".." || normalizedPath.startsWith("../") || !allowRoot && (normalizedPath === "." || normalizedPath === "");
2416
+ const normalizedPath = import_node_path17.default.posix.normalize(portablePath);
2417
+ const isUnsafe = filePath.includes("\\") || filePath.includes("\0") || import_node_path17.default.posix.isAbsolute(normalizedPath) || /^[a-zA-Z]:\//.test(normalizedPath) || normalizedPath === ".." || normalizedPath.startsWith("../") || !allowRoot && (normalizedPath === "." || normalizedPath === "");
2230
2418
  if (isUnsafe) throw new Error(`${label} "${filePath}" escapes its filesystem source`);
2231
2419
  return normalizedPath;
2232
2420
  };
@@ -2236,13 +2424,13 @@ var getSourceRoot = (projectDirectory, source) => {
2236
2424
  }
2237
2425
  const locator = source.source.slice(FILESYSTEM_SOURCE_PREFIX.length);
2238
2426
  if (!locator.trim()) throw new Error(`Filesystem federation source "${source.id}" requires a path after "file:".`);
2239
- return import_node_path16.default.resolve(projectDirectory, locator);
2427
+ return import_node_path17.default.resolve(projectDirectory, locator);
2240
2428
  };
2241
2429
  var getCatalogDirectory = async (projectDirectory, source) => {
2242
2430
  if (source.ref) throw new Error(`Filesystem federation source "${source.id}" does not support "ref".`);
2243
2431
  const sourceRoot = getSourceRoot(projectDirectory, source);
2244
2432
  const catalogPath = assertPortableRelativePath(source.path ?? ".", "Catalog path");
2245
- const catalogDirectory = import_node_path16.default.resolve(sourceRoot, ...catalogPath.split("/"));
2433
+ const catalogDirectory = import_node_path17.default.resolve(sourceRoot, ...catalogPath.split("/"));
2246
2434
  if (!isWithinDirectory(sourceRoot, catalogDirectory)) {
2247
2435
  throw new Error(`Catalog path "${source.path}" escapes source "${source.id}"`);
2248
2436
  }
@@ -2264,7 +2452,7 @@ var getCatalogDirectory = async (projectDirectory, source) => {
2264
2452
  };
2265
2453
  var getArtifactPath = async (catalogDirectory, source, artifactPath) => {
2266
2454
  const normalizedPath = assertPortableRelativePath(artifactPath, "Federated artifact path", false);
2267
- const filePath = import_node_path16.default.resolve(catalogDirectory, ...normalizedPath.split("/"));
2455
+ const filePath = import_node_path17.default.resolve(catalogDirectory, ...normalizedPath.split("/"));
2268
2456
  if (!isWithinDirectory(catalogDirectory, filePath)) {
2269
2457
  throw new Error(`Federated artifact path "${artifactPath}" escapes source "${source.id}"`);
2270
2458
  }
@@ -2304,7 +2492,7 @@ var createFileSystemSourceProvider = (projectDirectory) => ({
2304
2492
  var import_node_child_process = require("child_process");
2305
2493
  var import_promises9 = __toESM(require("fs/promises"), 1);
2306
2494
  var import_node_os3 = __toESM(require("os"), 1);
2307
- var import_node_path17 = __toESM(require("path"), 1);
2495
+ var import_node_path18 = __toESM(require("path"), 1);
2308
2496
  var import_node_util = require("util");
2309
2497
  var import_sdk2 = __toESM(require("@eventcatalog/sdk"), 1);
2310
2498
  var execFileAsync = (0, import_node_util.promisify)(import_node_child_process.execFile);
@@ -2315,8 +2503,8 @@ var parseGitHubSource = (source) => {
2315
2503
  };
2316
2504
  var assertSafeCatalogPath = (source) => {
2317
2505
  const catalogPath = source.path ?? ".";
2318
- const normalized = import_node_path17.default.posix.normalize(catalogPath.replaceAll("\\", "/"));
2319
- if (catalogPath.includes("\\") || import_node_path17.default.posix.isAbsolute(normalized) || normalized === ".." || normalized.startsWith("../")) {
2506
+ const normalized = import_node_path18.default.posix.normalize(catalogPath.replaceAll("\\", "/"));
2507
+ if (catalogPath.includes("\\") || import_node_path18.default.posix.isAbsolute(normalized) || normalized === ".." || normalized.startsWith("../")) {
2320
2508
  throw new Error(`Catalog path "${catalogPath}" escapes source "${source.id}"`);
2321
2509
  }
2322
2510
  };
@@ -2359,8 +2547,8 @@ var getGitEnvironment = (token) => {
2359
2547
  };
2360
2548
  var createCheckout = (executeFile, token) => async (source, ref, callback) => {
2361
2549
  const { owner, repository } = parseGitHubSource(source);
2362
- const catalogPath = import_node_path17.default.posix.normalize(source.path ?? ".");
2363
- const directory = await import_promises9.default.mkdtemp(import_node_path17.default.join(import_node_os3.default.tmpdir(), "eventcatalog-federation-"));
2550
+ const catalogPath = import_node_path18.default.posix.normalize(source.path ?? ".");
2551
+ const directory = await import_promises9.default.mkdtemp(import_node_path18.default.join(import_node_os3.default.tmpdir(), "eventcatalog-federation-"));
2364
2552
  const env = getGitEnvironment(token);
2365
2553
  try {
2366
2554
  const git = (args) => executeFile("git", args, { cwd: directory, env, encoding: "utf8" });
@@ -2380,16 +2568,16 @@ var createCheckout = (executeFile, token) => async (source, ref, callback) => {
2380
2568
  var generateIndex = async (source, ref, checkout, executeFile) => checkout(source, ref, async (directory) => {
2381
2569
  const { stdout } = await executeFile("git", ["rev-parse", "HEAD"], { cwd: directory, encoding: "utf8" });
2382
2570
  const commit = stdout.trim();
2383
- const catalogDirectory = import_node_path17.default.resolve(directory, source.path ?? ".");
2384
- const relativeCatalogDirectory = import_node_path17.default.relative(directory, catalogDirectory);
2385
- if (relativeCatalogDirectory.startsWith("..") || import_node_path17.default.isAbsolute(relativeCatalogDirectory)) {
2571
+ const catalogDirectory = import_node_path18.default.resolve(directory, source.path ?? ".");
2572
+ const relativeCatalogDirectory = import_node_path18.default.relative(directory, catalogDirectory);
2573
+ if (relativeCatalogDirectory.startsWith("..") || import_node_path18.default.isAbsolute(relativeCatalogDirectory)) {
2386
2574
  throw new Error(`Catalog path "${source.path}" escapes source "${source.id}"`);
2387
2575
  }
2388
2576
  const index = await (0, import_sdk2.default)(catalogDirectory).buildIndex({ source: source.id, commit });
2389
2577
  return { bytes: Buffer.from(JSON.stringify(index)), index, commit, generated: true };
2390
2578
  });
2391
2579
  var fetchPublishedIndex = async (source, ref, fetcher, token) => {
2392
- const indexPath = import_node_path17.default.posix.join(source.path ?? ".", "catalog.index.json");
2580
+ const indexPath = import_node_path18.default.posix.join(source.path ?? ".", "catalog.index.json");
2393
2581
  const bytes = await fetchBytes(source, ref, indexPath, fetcher, token);
2394
2582
  if (!bytes) return void 0;
2395
2583
  const index = (0, import_sdk2.parseIndex)(JSON.parse(bytes.toString("utf8")));
@@ -2412,7 +2600,7 @@ var createGitHubSourceProvider = (options = {}) => {
2412
2600
  },
2413
2601
  async fetchContent({ source, commit, path: artifactPath }) {
2414
2602
  assertSafeCatalogPath(source);
2415
- const catalogPath = import_node_path17.default.posix.join(source.path ?? ".", artifactPath);
2603
+ const catalogPath = import_node_path18.default.posix.join(source.path ?? ".", artifactPath);
2416
2604
  const content = await fetchBytes(source, commit, catalogPath, fetcher, token);
2417
2605
  if (!content) throw new Error(`Federated artifact not found for "${source.id}": ${artifactPath}`);
2418
2606
  return content;
@@ -2523,8 +2711,8 @@ var pathExists2 = async (filePath) => {
2523
2711
  }
2524
2712
  };
2525
2713
  var cleanupPreviousFederation = async (projectDirectory, onProgress) => {
2526
- const outDir = import_node_path18.default.join(projectDirectory, "federated");
2527
- const lockPath = import_node_path18.default.join(projectDirectory, "eventcatalog.lock");
2714
+ const outDir = import_node_path19.default.join(projectDirectory, "federated");
2715
+ const lockPath = import_node_path19.default.join(projectDirectory, "eventcatalog.lock");
2528
2716
  const previousLock = await readLock(lockPath);
2529
2717
  const hadFederatedOutput = await pathExists2(outDir);
2530
2718
  const hadLock = previousLock !== void 0;
@@ -2559,11 +2747,6 @@ var federateCatalog = async (projectDirectory, options = {}) => {
2559
2747
  await cleanupPreviousFederation(projectDirectory, options.onProgress);
2560
2748
  return null;
2561
2749
  }
2562
- if (!await isFederationEnabled()) {
2563
- throw new Error(
2564
- "Cannot federate catalogs: EventCatalog federation is an Enterprise feature. Visit https://www.eventcatalog.dev/pricing to enable federation."
2565
- );
2566
- }
2567
2750
  validateSources(sources);
2568
2751
  const rules = resolveFederationRules(config.federation?.rules);
2569
2752
  if (options.useCache === false) options.onProgress?.({ type: "cache:disabled" });
@@ -2589,8 +2772,8 @@ var federateCatalog = async (projectDirectory, options = {}) => {
2589
2772
  throw new Error(`Failed to federate source "${source.id}": ${message}`, { cause: error });
2590
2773
  }
2591
2774
  }
2592
- const outDir = import_node_path18.default.join(projectDirectory, "federated");
2593
- const lockPath = import_node_path18.default.join(projectDirectory, "eventcatalog.lock");
2775
+ const outDir = import_node_path19.default.join(projectDirectory, "federated");
2776
+ const lockPath = import_node_path19.default.join(projectDirectory, "eventcatalog.lock");
2594
2777
  const previousLock = await readLock(lockPath);
2595
2778
  const resources = resolvedSources.reduce((total, source) => total + source.resolved.index.resources.length, 0);
2596
2779
  const remoteIndexes = resolvedSources.map(({ resolved }) => resolved.index);
@@ -2702,17 +2885,16 @@ Run npm i @eventcatalog/core to update`;
2702
2885
  };
2703
2886
 
2704
2887
  // src/eventcatalog.ts
2705
- var import_license2 = require("@eventcatalog/license");
2706
- var currentDir = import_node_path20.default.dirname((0, import_node_url2.fileURLToPath)(importMetaUrl));
2707
- var astroCli = import_node_path20.default.join(import_node_path20.default.dirname((0, import_node_module2.createRequire)(importMetaUrl).resolve("astro/package.json")), "bin/astro.mjs");
2888
+ var currentDir = import_node_path21.default.dirname((0, import_node_url2.fileURLToPath)(importMetaUrl));
2889
+ var astroCli = import_node_path21.default.join(import_node_path21.default.dirname((0, import_node_module2.createRequire)(importMetaUrl).resolve("astro/package.json")), "bin/astro.mjs");
2708
2890
  var program = new import_commander.Command().version(VERSION);
2709
- var dir = import_node_path20.default.resolve(process.env.PROJECT_DIR || process.cwd());
2710
- var eventCatalogDir = import_node_path20.default.resolve((0, import_node_path19.join)(currentDir, "../eventcatalog/"));
2711
- var astroConfigPath = () => getAstroConfigPath(dir, (0, import_node_path19.join)(eventCatalogDir, "astro.config.mjs"));
2891
+ var dir = import_node_path21.default.resolve(process.env.PROJECT_DIR || process.cwd());
2892
+ var eventCatalogDir = import_node_path21.default.resolve((0, import_node_path20.join)(currentDir, "../eventcatalog/"));
2893
+ var astroConfigPath = () => getAstroConfigPath(dir, (0, import_node_path20.join)(eventCatalogDir, "astro.config.mjs"));
2712
2894
  var { runtimeDirectory: core } = getRuntimePaths(dir);
2713
2895
  var getInstalledEventCatalogVersion = () => {
2714
2896
  try {
2715
- const pkg = import_fs.default.readFileSync((0, import_node_path19.join)(dir, "package.json"), "utf8");
2897
+ const pkg = import_fs.default.readFileSync((0, import_node_path20.join)(dir, "package.json"), "utf8");
2716
2898
  const json = JSON.parse(pkg);
2717
2899
  return json.dependencies["@eventcatalog/core"];
2718
2900
  } catch (error) {
@@ -2778,12 +2960,12 @@ var startDevPrewarm = ({
2778
2960
  var buildDevSearchIndex = async ({ config }) => {
2779
2961
  const result = await buildSearchIndex({
2780
2962
  projectDir: dir,
2781
- outDir: import_node_path20.default.join(core, "public"),
2782
- searchOutputPath: import_node_path20.default.join(core, "public", "pagefind"),
2963
+ outDir: import_node_path21.default.join(core, "public"),
2964
+ searchOutputPath: import_node_path21.default.join(core, "public", "pagefind"),
2783
2965
  config,
2784
2966
  isServer: false
2785
2967
  });
2786
- logger.info(`Indexed ${result.records} page(s) into ${import_node_path20.default.relative(core, result.outputPath)}`, "search");
2968
+ logger.info(`Indexed ${result.records} page(s) into ${import_node_path21.default.relative(core, result.outputPath)}`, "search");
2787
2969
  };
2788
2970
  var warnIfIndexedSearchUsesAuth = async () => {
2789
2971
  if (!await isAuthEnabled()) {
@@ -2918,7 +3100,7 @@ V3 brings exciting new features and improvements.
2918
3100
 
2919
3101
  Upgrade now: npm i @eventcatalog/core@beta`;
2920
3102
  console.log(
2921
- (0, import_boxen.default)(v3Message, {
3103
+ (0, import_boxen2.default)(v3Message, {
2922
3104
  padding: 1,
2923
3105
  margin: 1,
2924
3106
  align: "center",
@@ -2935,7 +3117,7 @@ Upgrade now: npm i @eventcatalog/core@beta`;
2935
3117
  const message = getEventCatalogUpdateMessage(installedVersion, notifier.update?.latest);
2936
3118
  if (message) {
2937
3119
  console.log(
2938
- (0, import_boxen.default)(message, {
3120
+ (0, import_boxen2.default)(message, {
2939
3121
  padding: 1,
2940
3122
  margin: 1,
2941
3123
  align: "center",
@@ -2959,8 +3141,8 @@ program.command("dev").description("Run development server of EventCatalog").opt
2959
3141
  logger.info("Setting up EventCatalog...", "eventcatalog");
2960
3142
  const isServer = await isOutputServer();
2961
3143
  logger.info(isServer ? "EventCatalog is running in Server Mode" : "EventCatalog is running in Static Mode", "config");
2962
- if (import_fs.default.existsSync(import_node_path20.default.join(dir, ".env"))) {
2963
- import_dotenv.default.config({ path: import_node_path20.default.join(dir, ".env") });
3144
+ if (import_fs.default.existsSync(import_node_path21.default.join(dir, ".env"))) {
3145
+ import_dotenv.default.config({ path: import_node_path21.default.join(dir, ".env") });
2964
3146
  }
2965
3147
  if (options.debug) {
2966
3148
  logger.info("Debug mode enabled", "debug");
@@ -2973,18 +3155,9 @@ program.command("dev").description("Run development server of EventCatalog").opt
2973
3155
  await resolve_catalog_dependencies_default(dir, core);
2974
3156
  await runMigrations(dir);
2975
3157
  const config = await getEventCatalogConfigFile(dir);
2976
- const canEmbedPages = await (0, import_license2.isFeatureEnabled)(
2977
- "@eventcatalog/backstage-plugin-eventcatalog",
2978
- process.env.EVENTCATALOG_LICENSE_KEY_BACKSTAGE
2979
- );
2980
- const isEventCatalogStarter = await (0, import_license2.isEventCatalogStarterEnabled)();
2981
- const isEventCatalogScale = await (0, import_license2.isEventCatalogScaleEnabled)();
2982
- void log_build_default(dir, {
2983
- isEventCatalogStarterEnabled: isEventCatalogStarter,
2984
- isEventCatalogScaleEnabled: isEventCatalogScale,
2985
- isBackstagePluginEnabled: canEmbedPages || isEventCatalogScale,
2986
- command: "dev"
2987
- });
3158
+ const license = await getLicenseStatus2(dir);
3159
+ printLicenseStatus(license, config?.tsd);
3160
+ void log_build_default(dir, { command: "dev", license });
2988
3161
  if (isServer) {
2989
3162
  try {
2990
3163
  logger.info("Building fields index...", "fields");
@@ -3026,9 +3199,6 @@ program.command("dev").description("Run development server of EventCatalog").opt
3026
3199
  env: {
3027
3200
  PROJECT_DIR: dir,
3028
3201
  CATALOG_DIR: core,
3029
- ENABLE_EMBED: String(canEmbedPages || isEventCatalogScale),
3030
- EVENTCATALOG_STARTER: String(isEventCatalogStarter),
3031
- EVENTCATALOG_SCALE: String(isEventCatalogScale),
3032
3202
  EVENTCATALOG_DEV_MODE: "true",
3033
3203
  IGNORE_BUILD_ARTIFACTS: "true",
3034
3204
  NODE_NO_WARNINGS: "1"
@@ -3047,24 +3217,15 @@ program.command("build").description("Run build of EventCatalog").action(async (
3047
3217
  logger.info("Building EventCatalog...", "build");
3048
3218
  const isServer = await isOutputServer();
3049
3219
  logger.info(isServer ? "EventCatalog is running in Server Mode" : "EventCatalog is running in Static Mode", "config");
3050
- if (import_fs.default.existsSync(import_node_path20.default.join(dir, ".env"))) {
3051
- import_dotenv.default.config({ path: import_node_path20.default.join(dir, ".env") });
3220
+ if (import_fs.default.existsSync(import_node_path21.default.join(dir, ".env"))) {
3221
+ import_dotenv.default.config({ path: import_node_path21.default.join(dir, ".env") });
3052
3222
  }
3053
3223
  await verifyRequiredFieldsAreInCatalogConfigFile(dir);
3224
+ const config = await getEventCatalogConfigFile(dir);
3225
+ const license = await getLicenseStatus2(dir);
3226
+ printLicenseStatus(license, config?.tsd);
3054
3227
  prepareCore();
3055
- const isBackstagePluginEnabled = await (0, import_license2.isFeatureEnabled)(
3056
- "@eventcatalog/backstage-plugin-eventcatalog",
3057
- process.env.EVENTCATALOG_LICENSE_KEY_BACKSTAGE
3058
- );
3059
- const isEventCatalogStarter = await (0, import_license2.isEventCatalogStarterEnabled)();
3060
- const isEventCatalogScale = await (0, import_license2.isEventCatalogScaleEnabled)();
3061
- const canEmbedPages = isBackstagePluginEnabled || isEventCatalogScale;
3062
- await log_build_default(dir, {
3063
- isEventCatalogStarterEnabled: isEventCatalogStarter,
3064
- isEventCatalogScaleEnabled: isEventCatalogScale,
3065
- isBackstagePluginEnabled: canEmbedPages || isEventCatalogScale,
3066
- command: "build"
3067
- });
3228
+ await log_build_default(dir, { command: "build", license });
3068
3229
  await resolve_catalog_dependencies_default(dir, core);
3069
3230
  await runMigrations(dir);
3070
3231
  if (isServer) {
@@ -3088,17 +3249,13 @@ program.command("build").description("Run build of EventCatalog").action(async (
3088
3249
  env: {
3089
3250
  PROJECT_DIR: dir,
3090
3251
  CATALOG_DIR: core,
3091
- ENABLE_EMBED: String(canEmbedPages),
3092
- EVENTCATALOG_STARTER: String(isEventCatalogStarter),
3093
- EVENTCATALOG_SCALE: String(isEventCatalogScale),
3094
3252
  IGNORE_BUILD_ARTIFACTS: "true"
3095
3253
  },
3096
3254
  shouldFilterLine: createAstroLineFilter()
3097
3255
  });
3098
3256
  if (await isIndexedSearchEnabled()) {
3099
3257
  await warnIfIndexedSearchUsesAuth();
3100
- const config = await getEventCatalogConfigFile(dir);
3101
- const outDir = import_node_path20.default.resolve(dir, await getProjectOutDir());
3258
+ const outDir = import_node_path21.default.resolve(dir, await getProjectOutDir());
3102
3259
  logger.info("Building indexed search...", "search");
3103
3260
  const result = await buildSearchIndex({
3104
3261
  projectDir: dir,
@@ -3106,45 +3263,30 @@ program.command("build").description("Run build of EventCatalog").action(async (
3106
3263
  config,
3107
3264
  isServer
3108
3265
  });
3109
- logger.info(`Indexed ${result.records} page(s) into ${import_node_path20.default.relative(dir, result.outputPath)}`, "search");
3266
+ logger.info(`Indexed ${result.records} page(s) into ${import_node_path21.default.relative(dir, result.outputPath)}`, "search");
3110
3267
  }
3111
3268
  });
3112
- var previewCatalog = async ({
3113
- command,
3114
- canEmbedPages = false,
3115
- isEventCatalogStarter = false,
3116
- isEventCatalogScale = false
3117
- }) => {
3269
+ var previewCatalog = async ({ command }) => {
3118
3270
  await runCommandWithFilteredOutput({
3119
3271
  command: process.execPath,
3120
3272
  args: [astroCli, "preview", "--config", astroConfigPath(), ...command.args],
3121
3273
  cwd: dir,
3122
3274
  env: {
3123
3275
  PROJECT_DIR: dir,
3124
- CATALOG_DIR: core,
3125
- ENABLE_EMBED: String(canEmbedPages),
3126
- EVENTCATALOG_STARTER: String(isEventCatalogStarter),
3127
- EVENTCATALOG_SCALE: String(isEventCatalogScale)
3276
+ CATALOG_DIR: core
3128
3277
  },
3129
3278
  shouldFilterLine: createAstroLineFilter()
3130
3279
  });
3131
3280
  };
3132
- var startServerCatalog = async ({
3133
- canEmbedPages = false,
3134
- isEventCatalogStarter = false,
3135
- isEventCatalogScale = false
3136
- }) => {
3137
- const serverEntryPath = import_node_path20.default.join(dir, "dist", "server", "entry.mjs");
3281
+ var startServerCatalog = async () => {
3282
+ const serverEntryPath = import_node_path21.default.join(dir, "dist", "server", "entry.mjs");
3138
3283
  await runCommandWithFilteredOutput({
3139
3284
  command: process.execPath,
3140
3285
  args: [serverEntryPath],
3141
3286
  cwd: dir,
3142
3287
  env: {
3143
3288
  PROJECT_DIR: dir,
3144
- CATALOG_DIR: core,
3145
- ENABLE_EMBED: String(canEmbedPages),
3146
- EVENTCATALOG_STARTER: String(isEventCatalogStarter),
3147
- EVENTCATALOG_SCALE: String(isEventCatalogScale)
3289
+ CATALOG_DIR: core
3148
3290
  },
3149
3291
  shouldFilterLine: createAstroLineFilter()
3150
3292
  });
@@ -3152,69 +3294,44 @@ var startServerCatalog = async ({
3152
3294
  program.command("preview").description("Serves the contents of your eventcatalog build directory").action(async (options, command) => {
3153
3295
  logger.welcome();
3154
3296
  logger.info("Starting preview of your build...", "preview");
3155
- if (import_fs.default.existsSync(import_node_path20.default.join(dir, ".env"))) {
3156
- import_dotenv.default.config({ path: import_node_path20.default.join(dir, ".env") });
3297
+ if (import_fs.default.existsSync(import_node_path21.default.join(dir, ".env"))) {
3298
+ import_dotenv.default.config({ path: import_node_path21.default.join(dir, ".env") });
3157
3299
  }
3158
- const canEmbedPages = await (0, import_license2.isFeatureEnabled)(
3159
- "@eventcatalog/backstage-plugin-eventcatalog",
3160
- process.env.EVENTCATALOG_LICENSE_KEY_BACKSTAGE
3161
- );
3162
- const isEventCatalogStarter = await (0, import_license2.isEventCatalogStarterEnabled)();
3163
- const isEventCatalogScale = await (0, import_license2.isEventCatalogScaleEnabled)();
3164
- await previewCatalog({
3165
- command,
3166
- canEmbedPages: canEmbedPages || isEventCatalogScale,
3167
- isEventCatalogStarter,
3168
- isEventCatalogScale
3169
- });
3300
+ await previewCatalog({ command });
3170
3301
  });
3171
3302
  program.command("start").description("Serves the contents of your eventcatalog build directory").action(async (options, command) => {
3172
3303
  logger.welcome();
3173
3304
  logger.info("Starting preview of your build...", "preview");
3174
- if (import_fs.default.existsSync(import_node_path20.default.join(dir, ".env"))) {
3175
- import_dotenv.default.config({ path: import_node_path20.default.join(dir, ".env") });
3305
+ if (import_fs.default.existsSync(import_node_path21.default.join(dir, ".env"))) {
3306
+ import_dotenv.default.config({ path: import_node_path21.default.join(dir, ".env") });
3176
3307
  }
3177
- const canEmbedPages = await (0, import_license2.isFeatureEnabled)(
3178
- "@eventcatalog/backstage-plugin-eventcatalog",
3179
- process.env.EVENTCATALOG_LICENSE_KEY_BACKSTAGE
3180
- );
3181
- const isEventCatalogStarter = await (0, import_license2.isEventCatalogStarterEnabled)();
3182
- const isEventCatalogScale = await (0, import_license2.isEventCatalogScaleEnabled)();
3183
3308
  const isServerOutput = await isOutputServer();
3184
3309
  if (isServerOutput) {
3185
- await startServerCatalog({
3186
- canEmbedPages: canEmbedPages || isEventCatalogScale,
3187
- isEventCatalogStarter,
3188
- isEventCatalogScale
3189
- });
3310
+ await getLicenseStatus2(dir);
3311
+ await startServerCatalog();
3190
3312
  } else {
3191
- await previewCatalog({
3192
- command,
3193
- canEmbedPages: canEmbedPages || isEventCatalogScale,
3194
- isEventCatalogStarter,
3195
- isEventCatalogScale
3196
- });
3313
+ await previewCatalog({ command });
3197
3314
  }
3198
3315
  });
3199
3316
  program.command("export").description("Export your EventCatalog using the SDK dumpCatalog function").option("--include-markdown", "Include markdown content in the export", false).action(async (options) => {
3200
3317
  logger.welcome();
3201
3318
  logger.info("Exporting EventCatalog...", "export");
3202
- if (import_fs.default.existsSync(import_node_path20.default.join(dir, ".env"))) {
3203
- import_dotenv.default.config({ path: import_node_path20.default.join(dir, ".env") });
3319
+ if (import_fs.default.existsSync(import_node_path21.default.join(dir, ".env"))) {
3320
+ import_dotenv.default.config({ path: import_node_path21.default.join(dir, ".env") });
3204
3321
  }
3205
3322
  const { default: initSDK } = await import("@eventcatalog/sdk");
3206
3323
  const sdk = initSDK(dir);
3207
3324
  const catalog = await sdk.dumpCatalog({ includeMarkdown: options.includeMarkdown });
3208
- const exportsDir = import_node_path20.default.join(dir, "exports");
3325
+ const exportsDir = import_node_path21.default.join(dir, "exports");
3209
3326
  ensureDir(exportsDir);
3210
3327
  const date = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
3211
- const exportFile = import_node_path20.default.join(exportsDir, `catalog-${date}.json`);
3328
+ const exportFile = import_node_path21.default.join(exportsDir, `catalog-${date}.json`);
3212
3329
  import_fs.default.writeFileSync(exportFile, JSON.stringify(catalog, null, 2), "utf-8");
3213
3330
  logger.info(`Catalog exported to ${exportFile}`, "export");
3214
3331
  });
3215
3332
  program.command("generate [siteDir]").description("Start the generator scripts.").action(async () => {
3216
- if (import_fs.default.existsSync(import_node_path20.default.join(dir, ".env"))) {
3217
- import_dotenv.default.config({ path: import_node_path20.default.join(dir, ".env") });
3333
+ if (import_fs.default.existsSync(import_node_path21.default.join(dir, ".env"))) {
3334
+ import_dotenv.default.config({ path: import_node_path21.default.join(dir, ".env") });
3218
3335
  }
3219
3336
  await generate(dir);
3220
3337
  });
@@ -3287,7 +3404,7 @@ var reportFederationProgress = (event, verbose = false) => {
3287
3404
  }
3288
3405
  return;
3289
3406
  case "hydrating":
3290
- logger.info(`Hydrating federated content into ${import_node_path20.default.relative(dir, event.outDir)}/...`, "federation");
3407
+ logger.info(`Hydrating federated content into ${import_node_path21.default.relative(dir, event.outDir)}/...`, "federation");
3291
3408
  return;
3292
3409
  case "hydrate:cache":
3293
3410
  if (event.files === 1 || event.files % 25 === 0) {
@@ -3310,13 +3427,13 @@ var reportFederationProgress = (event, verbose = false) => {
3310
3427
  `Federation complete: ${event.result.sources} sources, ${event.result.resources} remote resources, ${event.result.hydrate.written} files written (${event.result.hydrate.fetched} downloaded, ${event.result.hydrate.written - event.result.hydrate.fetched} cached)`,
3311
3428
  "federation"
3312
3429
  );
3313
- logger.info(`Recorded resolved source state in ${import_node_path20.default.relative(dir, event.result.lockPath)}`, "federation");
3430
+ logger.info(`Recorded resolved source state in ${import_node_path21.default.relative(dir, event.result.lockPath)}`, "federation");
3314
3431
  }
3315
3432
  };
3316
3433
  program.command("federate").description("Fetch, resolve, and hydrate the catalogs configured in federation.sources.").option("--no-cache", "Download all federation content and refresh the cache.").option("-v, --verbose", "Show detailed federation diagnostics.").action(async (commandOptions) => {
3317
3434
  logger.welcome();
3318
- if (import_fs.default.existsSync(import_node_path20.default.join(dir, ".env"))) {
3319
- import_dotenv.default.config({ path: import_node_path20.default.join(dir, ".env") });
3435
+ if (import_fs.default.existsSync(import_node_path21.default.join(dir, ".env"))) {
3436
+ import_dotenv.default.config({ path: import_node_path21.default.join(dir, ".env") });
3320
3437
  }
3321
3438
  logger.info("Starting federation...", "federation");
3322
3439
  let cleanedPreviousOutput = false;