@eventcatalog/core 5.0.0-beta.0 → 5.0.0-beta.10

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 (171) hide show
  1. package/LICENSE +227 -128
  2. package/dist/analytics/analytics.cjs +19 -3
  3. package/dist/analytics/analytics.d.cts +1 -1
  4. package/dist/analytics/analytics.d.ts +1 -1
  5. package/dist/analytics/analytics.js +3 -2
  6. package/dist/analytics/log-build.cjs +72 -35
  7. package/dist/analytics/log-build.js +5 -4
  8. package/dist/analytics/telemetry.cjs +42 -0
  9. package/dist/analytics/telemetry.d.cts +20 -0
  10. package/dist/analytics/telemetry.d.ts +20 -0
  11. package/dist/analytics/telemetry.js +8 -0
  12. package/dist/{chunk-ZHKEARLJ.js → chunk-2LBDRHE4.js} +1 -1
  13. package/dist/{chunk-TQLRG35T.js → chunk-AWOO63ME.js} +71 -45
  14. package/dist/chunk-CPW6G62V.js +17 -0
  15. package/dist/{chunk-LR7AGRHN.js → chunk-CRKJBDN7.js} +56 -33
  16. package/dist/{chunk-CR6AK5LR.js → chunk-EM36OL6A.js} +1 -1
  17. package/dist/{chunk-TWN43V4T.js → chunk-IONYKKOY.js} +1 -1
  18. package/dist/{chunk-WAIADKQE.js → chunk-LJMXOEEC.js} +10 -3
  19. package/dist/constants.cjs +1 -1
  20. package/dist/constants.js +1 -1
  21. package/dist/eventcatalog.cjs +205 -124
  22. package/dist/eventcatalog.config.d.cts +59 -1
  23. package/dist/eventcatalog.config.d.ts +59 -1
  24. package/dist/eventcatalog.js +30 -11
  25. package/dist/federation/federate.js +2 -2
  26. package/dist/generate.cjs +1 -1
  27. package/dist/generate.js +3 -3
  28. package/dist/runtime-dependencies/@hocuspocus__provider.mjs +3 -0
  29. package/dist/runtime-dependencies/@hocuspocus__server.mjs +3 -0
  30. package/dist/runtime-dependencies/@mcp-b__webmcp-local-relay.mjs +3 -0
  31. package/dist/runtime-dependencies/@mcp-b__webmcp-polyfill.mjs +3 -0
  32. package/dist/runtime-dependencies/manifest.json +8 -1
  33. package/dist/runtime-dependencies/react-hotkeys-hook.mjs +3 -0
  34. package/dist/runtime-dependencies/y-protocols.mjs +3 -0
  35. package/dist/runtime-dependencies/y-protocols__awareness.mjs +3 -0
  36. package/dist/runtime-dependencies/yjs.mjs +3 -0
  37. package/dist/utils/cli-logger.cjs +1 -1
  38. package/dist/utils/cli-logger.js +2 -2
  39. package/dist/utils/license-status.cjs +71 -45
  40. package/dist/utils/license-status.d.cts +14 -5
  41. package/dist/utils/license-status.d.ts +14 -5
  42. package/dist/utils/license-status.js +1 -1
  43. package/eventcatalog/astro.config.mjs +5 -0
  44. package/eventcatalog/integrations/storage.mjs +20 -0
  45. package/eventcatalog/integrations/studio-server.mjs +32 -0
  46. package/eventcatalog/src/components/Grids/utils.tsx +0 -23
  47. package/eventcatalog/src/components/Header.astro +3 -3
  48. package/eventcatalog/src/components/MDX/CodeGroup/CodeGroup.tsx +6 -1
  49. package/eventcatalog/src/components/SchemaExplorer/SchemaDetailsPanel.tsx +12 -4
  50. package/eventcatalog/src/components/SideNav/NestedSideBar/index.tsx +16 -7
  51. package/eventcatalog/src/components/SideNav/NestedSideBar/utils.ts +10 -0
  52. package/eventcatalog/src/components/Tables/Discover/DiscoverTable.tsx +4 -62
  53. package/eventcatalog/src/components/Tables/Discover/columns.tsx +17 -150
  54. package/eventcatalog/src/components/Tables/Resources/ResourcesTable.tsx +425 -0
  55. package/eventcatalog/src/components/Tables/RowActionsMenu.tsx +157 -0
  56. package/eventcatalog/src/components/Tables/TablePagination.tsx +82 -0
  57. package/eventcatalog/src/features/ai/chat-api.ts +3 -3
  58. package/eventcatalog/src/features/auth/middleware/middleware-auth.ts +10 -0
  59. package/eventcatalog/src/features/integrations/eventcatalog-features.ts +34 -1
  60. package/eventcatalog/src/features/mcp/apps/canvas/shared.ts +47 -0
  61. package/eventcatalog/src/features/mcp/apps/canvas/styles.css +22 -0
  62. package/eventcatalog/src/features/mcp/apps/canvas/view.tsx +276 -0
  63. package/eventcatalog/src/features/mcp/apps/generated/canvas.html +210 -0
  64. package/eventcatalog/src/features/mcp/apps/generated/viewer.html +75 -74
  65. package/eventcatalog/src/features/mcp/apps/shared/app-view.tsx +2 -1
  66. package/eventcatalog/src/features/mcp/mcp-apps.ts +6 -3
  67. package/eventcatalog/src/features/mcp/mcp-server.ts +36 -5
  68. package/eventcatalog/src/features/server/start.ts +25 -0
  69. package/eventcatalog/src/features/storage/database.ts +88 -0
  70. package/eventcatalog/src/features/storage/migrations.ts +85 -0
  71. package/eventcatalog/src/features/storage/sql/database.sql +5 -0
  72. package/eventcatalog/src/features/storage/sql/migrations/0001-studio-canvases.sql +12 -0
  73. package/eventcatalog/src/features/storage/sql/migrations.sql +15 -0
  74. package/eventcatalog/src/features/storage/sql.ts +28 -0
  75. package/eventcatalog/src/features/studio/agent-choreography.ts +381 -0
  76. package/eventcatalog/src/features/studio/api/canvases-api.ts +170 -0
  77. package/eventcatalog/src/features/studio/api/canvases.ts +25 -0
  78. package/eventcatalog/src/features/studio/api/client.ts +35 -0
  79. package/eventcatalog/src/features/studio/canvas-actions.ts +414 -0
  80. package/eventcatalog/src/features/studio/canvas-doc.ts +414 -0
  81. package/eventcatalog/src/features/studio/canvas-preview.ts +53 -0
  82. package/eventcatalog/src/features/studio/catalog-resources.ts +155 -0
  83. package/eventcatalog/src/features/studio/catalog.ts +171 -0
  84. package/eventcatalog/src/features/studio/clipboard.ts +97 -0
  85. package/eventcatalog/src/features/studio/components/CanvasControls.tsx +154 -0
  86. package/eventcatalog/src/features/studio/components/CanvasHeader.tsx +370 -0
  87. package/eventcatalog/src/features/studio/components/CanvasStatusMenu.tsx +117 -0
  88. package/eventcatalog/src/features/studio/components/Comments.tsx +770 -0
  89. package/eventcatalog/src/features/studio/components/ConnectAgentDialog.tsx +281 -0
  90. package/eventcatalog/src/features/studio/components/ConnectionsChooser.tsx +144 -0
  91. package/eventcatalog/src/features/studio/components/ContainerChooser.tsx +145 -0
  92. package/eventcatalog/src/features/studio/components/DeleteCanvasDialog.tsx +81 -0
  93. package/eventcatalog/src/features/studio/components/DragGhost.tsx +115 -0
  94. package/eventcatalog/src/features/studio/components/JoinForm.tsx +34 -0
  95. package/eventcatalog/src/features/studio/components/LeftPanel.tsx +314 -0
  96. package/eventcatalog/src/features/studio/components/Picture.tsx +21 -0
  97. package/eventcatalog/src/features/studio/components/Presence.tsx +286 -0
  98. package/eventcatalog/src/features/studio/components/PropertiesPanel.tsx +212 -0
  99. package/eventcatalog/src/features/studio/components/ShareDialog.tsx +260 -0
  100. package/eventcatalog/src/features/studio/components/StudioDesigner.tsx +1216 -0
  101. package/eventcatalog/src/features/studio/components/StudioNotice.astro +24 -0
  102. package/eventcatalog/src/features/studio/components/canvas-nodes.tsx +255 -0
  103. package/eventcatalog/src/features/studio/components/icons.ts +53 -0
  104. package/eventcatalog/src/features/studio/components/status.ts +53 -0
  105. package/eventcatalog/src/features/studio/edges.ts +56 -0
  106. package/eventcatalog/src/features/studio/flow-state.ts +92 -0
  107. package/eventcatalog/src/features/studio/grouping.ts +226 -0
  108. package/eventcatalog/src/features/studio/hooks/presence-sender.ts +46 -0
  109. package/eventcatalog/src/features/studio/hooks/presence-store.ts +119 -0
  110. package/eventcatalog/src/features/studio/hooks/use-canvas-webmcp.ts +347 -0
  111. package/eventcatalog/src/features/studio/hooks/use-comments.ts +54 -0
  112. package/eventcatalog/src/features/studio/hooks/use-follow-camera.ts +104 -0
  113. package/eventcatalog/src/features/studio/hooks/use-studio-flow.ts +589 -0
  114. package/eventcatalog/src/features/studio/identity.ts +37 -0
  115. package/eventcatalog/src/features/studio/layout.ts +42 -0
  116. package/eventcatalog/src/features/studio/levels.ts +282 -0
  117. package/eventcatalog/src/features/studio/node-types.ts +205 -0
  118. package/eventcatalog/src/features/studio/pages/[id].astro +68 -0
  119. package/eventcatalog/src/features/studio/pages/index.astro +784 -0
  120. package/eventcatalog/src/features/studio/pages/webmcp-relay.ts +27 -0
  121. package/eventcatalog/src/features/studio/placement.ts +197 -0
  122. package/eventcatalog/src/features/studio/server/canvas-mcp.ts +510 -0
  123. package/eventcatalog/src/features/studio/server/runtime.ts +491 -0
  124. package/eventcatalog/src/features/studio/server/sign-in.ts +18 -0
  125. package/eventcatalog/src/features/studio/server/sql/storage.sql +18 -0
  126. package/eventcatalog/src/features/studio/server/storage.ts +90 -0
  127. package/eventcatalog/src/features/studio/server/tool-icons.ts +30 -0
  128. package/eventcatalog/src/features/studio/studio.css +273 -0
  129. package/eventcatalog/src/features/studio/tool-sync.ts +75 -0
  130. package/eventcatalog/src/layouts/VerticalSideBarLayout.astro +10 -5
  131. package/eventcatalog/src/pages/architecture/[type]/[id]/[version]/_index.data.spec.ts +52 -63
  132. package/eventcatalog/src/pages/architecture/[type]/[id]/[version]/_index.data.ts +34 -46
  133. package/eventcatalog/src/pages/architecture/[type]/[id]/[version]/index.astro +11 -29
  134. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/resources/_ResourcesPage.astro +79 -0
  135. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/resources/_index.data.spec.ts +32 -14
  136. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/resources/_index.data.ts +63 -58
  137. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/resources/index.astro +2 -62
  138. package/eventcatalog/src/pages/docs/services/[id]/[version]/resources/index.astro +13 -0
  139. package/eventcatalog/src/stores/sidebar-store/builders/domain.ts +24 -42
  140. package/eventcatalog/src/stores/sidebar-store/builders/flow.ts +2 -0
  141. package/eventcatalog/src/stores/sidebar-store/builders/message.ts +2 -0
  142. package/eventcatalog/src/stores/sidebar-store/builders/service.ts +23 -23
  143. package/eventcatalog/src/stores/sidebar-store/builders/shared.ts +13 -0
  144. package/eventcatalog/src/stores/sidebar-store/builders/system.ts +18 -27
  145. package/eventcatalog/src/stores/sidebar-store/state.ts +5 -0
  146. package/eventcatalog/src/styles/tailwind.css +2 -2
  147. package/eventcatalog/src/utils/collections/channels.ts +56 -1
  148. package/eventcatalog/src/utils/collections/flows.ts +50 -1
  149. package/eventcatalog/src/utils/collections/message-connections.ts +60 -0
  150. package/eventcatalog/src/utils/collections/message-triggers.ts +2 -1
  151. package/eventcatalog/src/utils/collections/resource-owners.ts +193 -0
  152. package/eventcatalog/src/utils/collections/resources.ts +310 -0
  153. package/eventcatalog/src/utils/collections/util.ts +31 -0
  154. package/eventcatalog/src/utils/feature.ts +8 -0
  155. package/eventcatalog/src/utils/git.ts +11 -5
  156. package/eventcatalog/src/utils/node-graphs/export-mermaid.ts +0 -2
  157. package/eventcatalog/src/utils/trial.ts +1 -1
  158. package/package.json +17 -12
  159. package/dist/runtime-dependencies/shelljs.mjs +0 -3
  160. package/eventcatalog/public/studio-bg.png +0 -0
  161. package/eventcatalog/src/components/Grids/DomainGrid.tsx +0 -838
  162. package/eventcatalog/src/components/Grids/MessageGrid.tsx +0 -344
  163. package/eventcatalog/src/components/Grids/SystemGrid.tsx +0 -185
  164. package/eventcatalog/src/components/Grids/components.tsx +0 -170
  165. package/eventcatalog/src/components/Grids/message-link.ts +0 -38
  166. package/eventcatalog/src/components/Studio/StudioPageModal.tsx +0 -150
  167. package/eventcatalog/src/components/Tables/SystemResources/SystemResourcesTable.tsx +0 -294
  168. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/resources/_resources.spec.ts +0 -65
  169. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/resources/_resources.ts +0 -46
  170. package/eventcatalog/src/pages/studio.astro +0 -316
  171. package/dist/{chunk-AYNZXUB5.js → chunk-KHACCTW2.js} +3 -3
@@ -197,6 +197,38 @@ type McpConfig = {
197
197
  enabled?: boolean;
198
198
  auth?: McpAuthConfig;
199
199
  };
200
+ /**
201
+ * The state EventCatalog keeps for features that need it (today, Studio's canvases). Features always work on a copy
202
+ * held in memory by the server, so storage doesn't slow them down: it's read when the server starts and written a
203
+ * moment after something changes (and as the server stops).
204
+ */
205
+ type StorageConfig =
206
+ /** Kept only while the server runs: lost when it restarts or redeploys (the default) */
207
+ {
208
+ type: 'memory';
209
+ }
210
+ /**
211
+ * One SQLite database file for the whole catalog, brought up to date (migrated) as `eventcatalog dev` and
212
+ * `eventcatalog start` start. Uses Node.js's built-in SQLite, so needs Node.js 22.13 or later.
213
+ */
214
+ | {
215
+ type: 'sqlite';
216
+ /**
217
+ * The database file, relative to the catalog. In a container, put it on a volume (e.g. `/data/eventcatalog.db`)
218
+ * so it survives redeploys.
219
+ * @default '.eventcatalog/eventcatalog.db'
220
+ */
221
+ path?: string;
222
+ };
223
+ type StudioConfig = {
224
+ /**
225
+ * Turns Studio on in production (`output: 'server'`, served with `eventcatalog start`). It's on in the dev server
226
+ * unless this is `false`, which turns it off everywhere. Experimental. With authentication on, only signed-in people
227
+ * can open canvases, and they're shown by the name and picture they signed in with.
228
+ * @default false
229
+ */
230
+ enabled?: boolean;
231
+ };
200
232
  type GA4Config = {
201
233
  measurementId: string;
202
234
  };
@@ -257,6 +289,17 @@ interface Config {
257
289
  };
258
290
  security?: {
259
291
  checkOrigin?: boolean;
292
+ /**
293
+ * Hosts to trust in a proxy's X-Forwarded-Host and X-Forwarded-Proto headers (server output), e.g. when deployed
294
+ * behind Fly.io, Railway or a load balancer that serves HTTPS. Without it, form posts (like starting a canvas in
295
+ * Studio) fail the origin check. Passed to Astro's `security.allowedDomains`.
296
+ * @example [{ hostname: 'catalog.example.com', protocol: 'https' }]
297
+ */
298
+ allowedDomains?: {
299
+ hostname?: string;
300
+ protocol?: string;
301
+ port?: string;
302
+ }[];
260
303
  };
261
304
  /**
262
305
  * Theme for the catalog UI.
@@ -270,6 +313,13 @@ interface Config {
270
313
  theme?: CatalogTheme;
271
314
  auth?: AuthConfig;
272
315
  mcp?: McpConfig;
316
+ /** EventCatalog Studio: collaborative canvases (experimental) */
317
+ studio?: StudioConfig;
318
+ /**
319
+ * Where EventCatalog keeps state between restarts (e.g. Studio's canvases), for every feature that has some.
320
+ * @default { type: 'memory' }
321
+ */
322
+ storage?: StorageConfig;
273
323
  rss?: {
274
324
  enabled?: boolean;
275
325
  limit?: number;
@@ -410,6 +460,14 @@ interface Config {
410
460
  queries?: {
411
461
  tableConfiguration?: TableConfiguration;
412
462
  };
463
+ /**
464
+ * Anonymous telemetry for `eventcatalog dev` and `eventcatalog build`.
465
+ * On by default. Set to false to opt out.
466
+ * `EVENTCATALOG_TELEMETRY_DISABLED` or `DO_NOT_TRACK` set to `1` or `true` also opts out.
467
+ * `cloud.analytics` stays its own opt-in for EventCatalog Cloud.
468
+ * @default true
469
+ */
470
+ telemetry?: boolean;
413
471
  cloud?: EventCatalogCloudConfig;
414
472
  integrations?: IntegrationsConfig;
415
473
  scalarConfiguration?: ScalarConfiguration;
@@ -418,4 +476,4 @@ interface Config {
418
476
  federation?: FederationConfig;
419
477
  }
420
478
 
421
- export type { Config, FederationRuleId, FederationRuleLevel, FederationRulesConfig, FederationSourceConfig };
479
+ export type { Config, FederationRuleId, FederationRuleLevel, FederationRulesConfig, FederationSourceConfig, StorageConfig };
@@ -4,17 +4,18 @@ import {
4
4
  import "./chunk-CA4U2JP7.js";
5
5
  import {
6
6
  log_build_default
7
- } from "./chunk-LR7AGRHN.js";
7
+ } from "./chunk-CRKJBDN7.js";
8
8
  import {
9
9
  getLicenseStatus,
10
10
  printLicenseStatus
11
- } from "./chunk-TQLRG35T.js";
11
+ } from "./chunk-AWOO63ME.js";
12
12
  import "./chunk-ZAZHAVKB.js";
13
13
  import {
14
14
  FederationConflictError,
15
15
  FederationDiagnosticError,
16
16
  federateCatalog
17
- } from "./chunk-AYNZXUB5.js";
17
+ } from "./chunk-KHACCTW2.js";
18
+ import "./chunk-WRNH5C3U.js";
18
19
  import "./chunk-5EPNFDT5.js";
19
20
  import "./chunk-A2RZR3U4.js";
20
21
  import "./chunk-R7Z5ALYI.js";
@@ -24,7 +25,6 @@ import {
24
25
  } from "./chunk-JJPB6EOZ.js";
25
26
  import "./chunk-SDZQJTJW.js";
26
27
  import "./chunk-352FGP6W.js";
27
- import "./chunk-WRNH5C3U.js";
28
28
  import {
29
29
  getProjectOutDir,
30
30
  isAuthEnabled,
@@ -33,10 +33,10 @@ import {
33
33
  } from "./chunk-MDWB5HLO.js";
34
34
  import {
35
35
  generate
36
- } from "./chunk-CR6AK5LR.js";
36
+ } from "./chunk-EM36OL6A.js";
37
37
  import {
38
38
  logger
39
- } from "./chunk-ZHKEARLJ.js";
39
+ } from "./chunk-2LBDRHE4.js";
40
40
  import {
41
41
  resolve_catalog_dependencies_default
42
42
  } from "./chunk-36RYTYT5.js";
@@ -50,7 +50,8 @@ import {
50
50
  import {
51
51
  watch
52
52
  } from "./chunk-U63GDPPY.js";
53
- import "./chunk-WAIADKQE.js";
53
+ import "./chunk-LJMXOEEC.js";
54
+ import "./chunk-CPW6G62V.js";
54
55
  import {
55
56
  getAstroConfigPath
56
57
  } from "./chunk-VIJJ7JKH.js";
@@ -66,7 +67,7 @@ import {
66
67
  } from "./chunk-LFQJXLHG.js";
67
68
  import {
68
69
  VERSION
69
- } from "./chunk-TWN43V4T.js";
70
+ } from "./chunk-IONYKKOY.js";
70
71
  import {
71
72
  getEventCatalogConfigFile,
72
73
  verifyRequiredFieldsAreInCatalogConfigFile
@@ -79,7 +80,7 @@ import { join } from "path";
79
80
  import http from "http";
80
81
  import fs3 from "fs";
81
82
  import path2 from "path";
82
- import { fileURLToPath } from "url";
83
+ import { fileURLToPath, pathToFileURL } from "url";
83
84
  import { createRequire } from "module";
84
85
  import boxen from "boxen";
85
86
  import updateNotifier from "update-notifier";
@@ -1028,15 +1029,33 @@ var previewCatalog = async ({ command }) => {
1028
1029
  shouldFilterLine: createAstroLineFilter()
1029
1030
  });
1030
1031
  };
1032
+ var SERVER_BOOTSTRAP = `
1033
+ const entry = await import(process.argv[1]);
1034
+ const { server } = entry.startServer();
1035
+ globalThis[Symbol.for('eventcatalog.http-server')] = server.server;
1036
+ const start = process.env.EVENTCATALOG_START_PATH;
1037
+ if (start) {
1038
+ server.server.once('listening', () => {
1039
+ // Where the server listens (HOST can be one address only); loopback when it listens on every address
1040
+ const { address, port } = server.server.address();
1041
+ const host = ['0.0.0.0', '::'].includes(address) ? '127.0.0.1' : address.includes(':') ? '[' + address + ']' : address;
1042
+ fetch('http://' + host + ':' + port + start).catch((error) => console.error('[eventcatalog] Could not start the server:', error.message));
1043
+ });
1044
+ }
1045
+ `;
1031
1046
  var startServerCatalog = async () => {
1032
1047
  const serverEntryPath = path2.join(dir, "dist", "server", "entry.mjs");
1048
+ const config = await getEventCatalogConfigFile(dir);
1049
+ const base = (config?.base || "/").replace(/\/$/, "");
1033
1050
  await runCommandWithFilteredOutput({
1034
1051
  command: process.execPath,
1035
- args: [serverEntryPath],
1052
+ args: ["--input-type=module", "-e", SERVER_BOOTSTRAP, pathToFileURL(serverEntryPath).href],
1036
1053
  cwd: dir,
1037
1054
  env: {
1038
1055
  PROJECT_DIR: dir,
1039
- CATALOG_DIR: core
1056
+ CATALOG_DIR: core,
1057
+ ASTRO_NODE_AUTOSTART: "disabled",
1058
+ EVENTCATALOG_START_PATH: `${base}/_eventcatalog/start`
1040
1059
  },
1041
1060
  shouldFilterLine: createAstroLineFilter()
1042
1061
  });
@@ -2,14 +2,14 @@ import {
2
2
  FederationConflictError,
3
3
  FederationDiagnosticError,
4
4
  federateCatalog
5
- } from "../chunk-AYNZXUB5.js";
5
+ } from "../chunk-KHACCTW2.js";
6
+ import "../chunk-WRNH5C3U.js";
6
7
  import "../chunk-5EPNFDT5.js";
7
8
  import "../chunk-A2RZR3U4.js";
8
9
  import "../chunk-R7Z5ALYI.js";
9
10
  import "../chunk-JJPB6EOZ.js";
10
11
  import "../chunk-SDZQJTJW.js";
11
12
  import "../chunk-352FGP6W.js";
12
- import "../chunk-WRNH5C3U.js";
13
13
  import "../chunk-RFIXKATC.js";
14
14
  export {
15
15
  FederationConflictError,
package/dist/generate.cjs CHANGED
@@ -112,7 +112,7 @@ var getEventCatalogConfigFile = async (projectDirectory) => {
112
112
  var import_picocolors = __toESM(require("picocolors"), 1);
113
113
 
114
114
  // package.json
115
- var version = "5.0.0-beta.0";
115
+ var version = "5.0.0-beta.10";
116
116
 
117
117
  // src/constants.ts
118
118
  var VERSION = version;
package/dist/generate.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  generate
3
- } from "./chunk-CR6AK5LR.js";
4
- import "./chunk-ZHKEARLJ.js";
5
- import "./chunk-TWN43V4T.js";
3
+ } from "./chunk-EM36OL6A.js";
4
+ import "./chunk-2LBDRHE4.js";
5
+ import "./chunk-IONYKKOY.js";
6
6
  import "./chunk-RFIXKATC.js";
7
7
  export {
8
8
  generate
@@ -0,0 +1,3 @@
1
+ export * from "@hocuspocus/provider";
2
+ import * as dependency from "@hocuspocus/provider";
3
+ export default dependency.default;
@@ -0,0 +1,3 @@
1
+ export * from "@hocuspocus/server";
2
+ import * as dependency from "@hocuspocus/server";
3
+ export default dependency.default;
@@ -0,0 +1,3 @@
1
+ export * from "@mcp-b/webmcp-local-relay";
2
+ import * as dependency from "@mcp-b/webmcp-local-relay";
3
+ export default dependency.default;
@@ -0,0 +1,3 @@
1
+ export * from "@mcp-b/webmcp-polyfill";
2
+ import * as dependency from "@mcp-b/webmcp-polyfill";
3
+ export default dependency.default;
@@ -34,7 +34,11 @@
34
34
  "@heroicons/react/24/outline/RectangleGroupIcon": "@heroicons__react__24__outline__RectangleGroupIcon.mjs",
35
35
  "@heroicons/react/24/outline/ServerIcon": "@heroicons__react__24__outline__ServerIcon.mjs",
36
36
  "@heroicons/react/24/solid": "@heroicons__react__24__solid.mjs",
37
+ "@hocuspocus/provider": "@hocuspocus__provider.mjs",
38
+ "@hocuspocus/server": "@hocuspocus__server.mjs",
37
39
  "@iconify-json/logos": "@iconify-json__logos.mjs",
40
+ "@mcp-b/webmcp-local-relay": "@mcp-b__webmcp-local-relay.mjs",
41
+ "@mcp-b/webmcp-polyfill": "@mcp-b__webmcp-polyfill.mjs",
38
42
  "@mermaid-js/layout-elk": "@mermaid-js__layout-elk.mjs",
39
43
  "@mermaid-js/layout-elk/dist/mermaid-layout-elk.core.mjs": "@mermaid-js__layout-elk__dist__mermaid-layout-elk.core.mjs.mjs",
40
44
  "@modelcontextprotocol/ext-apps": "@modelcontextprotocol__ext-apps.mjs",
@@ -107,6 +111,7 @@
107
111
  "react-dom": "react-dom.mjs",
108
112
  "react-dom/client": "react-dom__client.mjs",
109
113
  "react-dom/server": "react-dom__server.mjs",
114
+ "react-hotkeys-hook": "react-hotkeys-hook.mjs",
110
115
  "react-markdown": "react-markdown.mjs",
111
116
  "react-syntax-highlighter": "react-syntax-highlighter.mjs",
112
117
  "react-syntax-highlighter/dist/cjs/styles/prism": "react-syntax-highlighter__dist__cjs__styles__prism.mjs",
@@ -132,7 +137,6 @@
132
137
  "rimraf": "rimraf.mjs",
133
138
  "semver": "semver.mjs",
134
139
  "set-cookie-parser": "set-cookie-parser.mjs",
135
- "shelljs": "shelljs.mjs",
136
140
  "sonner": "sonner.mjs",
137
141
  "sql.js": "sql.js.mjs",
138
142
  "tailwindcss": "tailwindcss.mjs",
@@ -140,6 +144,9 @@
140
144
  "unist-util-visit": "unist-util-visit.mjs",
141
145
  "update-notifier": "update-notifier.mjs",
142
146
  "uuid": "uuid.mjs",
147
+ "y-protocols": "y-protocols.mjs",
148
+ "y-protocols/awareness": "y-protocols__awareness.mjs",
149
+ "yjs": "yjs.mjs",
143
150
  "zod": "zod.mjs",
144
151
  "zod/v4": "zod__v4.mjs"
145
152
  }
@@ -0,0 +1,3 @@
1
+ export * from "react-hotkeys-hook";
2
+ import * as dependency from "react-hotkeys-hook";
3
+ export default dependency.default;
@@ -0,0 +1,3 @@
1
+ export * from "y-protocols";
2
+ import * as dependency from "y-protocols";
3
+ export default dependency.default;
@@ -0,0 +1,3 @@
1
+ export * from "y-protocols/awareness";
2
+ import * as dependency from "y-protocols/awareness";
3
+ export default dependency.default;
@@ -0,0 +1,3 @@
1
+ export * from "yjs";
2
+ import * as dependency from "yjs";
3
+ export default dependency.default;
@@ -36,7 +36,7 @@ module.exports = __toCommonJS(cli_logger_exports);
36
36
  var import_picocolors = __toESM(require("picocolors"), 1);
37
37
 
38
38
  // package.json
39
- var version = "5.0.0-beta.0";
39
+ var version = "5.0.0-beta.10";
40
40
 
41
41
  // src/constants.ts
42
42
  var VERSION = version;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  logger
3
- } from "../chunk-ZHKEARLJ.js";
4
- import "../chunk-TWN43V4T.js";
3
+ } from "../chunk-2LBDRHE4.js";
4
+ import "../chunk-IONYKKOY.js";
5
5
  export {
6
6
  logger
7
7
  };
@@ -37,10 +37,11 @@ __export(license_status_exports, {
37
37
  });
38
38
  module.exports = __toCommonJS(license_status_exports);
39
39
  var import_boxen = __toESM(require("boxen"), 1);
40
+ var import_picocolors = __toESM(require("picocolors"), 1);
40
41
  var import_license2 = require("@eventcatalog/license");
41
42
 
42
43
  // eventcatalog/src/utils/trial.ts
43
- var TRIAL_LENGTH_DAYS = 90;
44
+ var TRIAL_LENGTH_DAYS = 60;
44
45
  var LICENSE_FAQ_URL = "https://www.eventcatalog.dev/license-faq";
45
46
  var LICENSE_RENEW_URL = "https://eventcatalog.cloud";
46
47
  var DAY_IN_MS = 24 * 60 * 60 * 1e3;
@@ -159,75 +160,100 @@ var getLicenseAnalytics = (license = { state: "none" }, tsd) => ({
159
160
  });
160
161
  var formatDate = (date) => date.toLocaleDateString(void 0, { dateStyle: "medium" });
161
162
  var formatDays = (days) => `${days} ${days === 1 ? "day" : "days"}`;
162
- var getTrialLine = (tsd, now) => {
163
+ var PLAIN = { bold: (text) => text, dim: (text) => text, link: (text) => text };
164
+ var COLOURS = { bold: import_picocolors.default.bold, dim: import_picocolors.default.dim, link: (text) => import_picocolors.default.cyan(text) };
165
+ var render = ({ headline, rows, links }, colours) => {
166
+ const width = Math.max(0, ...[...rows, ...links].map(([label]) => label.length));
167
+ const row = ([label, value]) => `${colours.dim(label.padEnd(width))} ${value}`;
168
+ return [
169
+ colours.bold(headline),
170
+ ...rows.length ? ["", ...rows.map(row)] : [],
171
+ ...links.length ? ["", ...links.map(([label, url]) => row([label, colours.link(url)]))] : []
172
+ ].join("\n");
173
+ };
174
+ var message = (content) => ({
175
+ ...content,
176
+ text: render(content, PLAIN)
177
+ });
178
+ var getTrialRow = (tsd, now) => {
163
179
  const trial = getTrialStatus(tsd, now);
164
180
  if (!trial) return;
165
- 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)}).`;
181
+ return [
182
+ "Trial",
183
+ trial.ended ? `Ended ${formatDate(trial.endsAt)}` : `${formatDays(trial.daysLeft)} left of ${TRIAL_LENGTH_DAYS} (ends ${formatDate(trial.endsAt)})`
184
+ ];
166
185
  };
167
186
  var getLicenseStatusMessage = (license, tsd, now = Date.now()) => {
187
+ const licensing = ["Licensing", LICENSE_FAQ_URL];
188
+ const renew = ["Renew", LICENSE_RENEW_URL];
189
+ const licensedTo = "org" in license && license.org ? [["Licensed to", license.org]] : [];
168
190
  if (license.state === "licensed") {
169
191
  const daysLeft = Math.max(0, Math.ceil((license.expiresAt.getTime() - now) / DAY_IN_MS2));
170
- const licensedTo = license.org ? `Licensed to ${license.org}` : "Licensed";
171
192
  if (daysLeft < LICENSE_REMINDER_DAYS) {
172
- return {
173
- title: "EventCatalog Commercial License",
193
+ return message({
194
+ title: "EventCatalog license",
174
195
  color: "yellow",
175
- text: [
176
- licensedTo,
177
- `Your license expires in ${formatDays(daysLeft)}, on ${formatDate(license.expiresAt)}.`,
178
- `Renew it to keep using EventCatalog commercially: ${LICENSE_RENEW_URL}`
179
- ].join("\n")
180
- };
196
+ headline: `Your commercial license expires in ${formatDays(daysLeft)}`,
197
+ rows: [...licensedTo, ["Expires", formatDate(license.expiresAt)]],
198
+ links: [renew]
199
+ });
181
200
  }
182
- return {
183
- title: "EventCatalog Commercial License",
201
+ return message({
202
+ title: "EventCatalog license",
184
203
  color: "green",
185
- text: `${licensedTo}
186
- Valid until ${formatDate(license.expiresAt)} (${formatDays(daysLeft)} left)`
187
- };
204
+ headline: "Commercial license active",
205
+ rows: [...licensedTo, ["Valid until", `${formatDate(license.expiresAt)} (${formatDays(daysLeft)} left)`]],
206
+ links: []
207
+ });
188
208
  }
189
209
  if (license.state === "plan") return;
190
- const trialLine = getTrialLine(tsd, now);
210
+ const trialRow = getTrialRow(tsd, now);
211
+ const trialRows = trialRow ? [trialRow] : [];
191
212
  if (license.state === "none") {
192
- if (!trialLine) return;
193
- const ended = getTrialStatus(tsd, now)?.ended;
194
- return {
213
+ const trial = getTrialStatus(tsd, now);
214
+ if (!trial || !trialRow) return;
215
+ return message({
195
216
  title: "EventCatalog trial",
196
- color: ended ? "yellow" : "green",
197
- text: `${trialLine}
198
- Learn about licensing: ${LICENSE_FAQ_URL}`
199
- };
217
+ color: trial.ended ? "yellow" : "green",
218
+ headline: trial.ended ? "Your EventCatalog trial has ended" : `You're on the ${TRIAL_LENGTH_DAYS}-day EventCatalog trial`,
219
+ rows: trialRows,
220
+ links: trial.ended ? [["Get a license", LICENSE_RENEW_URL], licensing] : [licensing]
221
+ });
200
222
  }
201
223
  if (license.state === "expired") {
202
- const expiredOn = license.expiresAt ? `expired on ${formatDate(license.expiresAt)} (${formatDays(Math.floor((now - license.expiresAt.getTime()) / DAY_IN_MS2))} ago)` : "has expired";
203
- return {
204
- title: "EventCatalog License Expired",
224
+ const expiredOn = license.expiresAt ? [
225
+ [
226
+ "Expired",
227
+ `${formatDate(license.expiresAt)} (${formatDays(Math.floor((now - license.expiresAt.getTime()) / DAY_IN_MS2))} ago)`
228
+ ]
229
+ ] : [];
230
+ return message({
231
+ title: "EventCatalog license",
205
232
  color: "yellow",
206
- text: [
207
- `Your EventCatalog commercial license${license.org ? ` for ${license.org}` : ""} ${expiredOn}.`,
208
- `Renew it to keep using EventCatalog commercially: ${LICENSE_RENEW_URL}`,
209
- trialLine,
210
- `Learn about licensing: ${LICENSE_FAQ_URL}`
211
- ].filter(Boolean).join("\n")
212
- };
233
+ headline: "Your commercial license has expired",
234
+ rows: [...licensedTo, ...expiredOn, ...trialRows],
235
+ links: [renew, licensing]
236
+ });
213
237
  }
214
- return {
238
+ return message({
215
239
  title: "EventCatalog license",
216
240
  color: "yellow",
217
- text: [`Your license.jwt could not be verified: ${license.reason}.`, trialLine, `Learn about licensing: ${LICENSE_FAQ_URL}`].filter(Boolean).join("\n")
218
- };
241
+ headline: "Your license.jwt couldn't be verified",
242
+ rows: [["Reason", license.reason.charAt(0).toUpperCase() + license.reason.slice(1)], ...trialRows],
243
+ links: [licensing]
244
+ });
219
245
  };
220
246
  var printLicenseStatus = (license, tsd) => {
221
- const message = getLicenseStatusMessage(license, tsd);
222
- if (!message) return;
247
+ const status = getLicenseStatusMessage(license, tsd);
248
+ if (!status) return;
223
249
  console.log(
224
- (0, import_boxen.default)(message.text, {
225
- padding: 1,
250
+ (0, import_boxen.default)(render(status, COLOURS), {
251
+ padding: { top: 1, bottom: 1, left: 2, right: 2 },
226
252
  margin: 1,
227
253
  borderStyle: "round",
228
- borderColor: message.color,
229
- title: message.title,
230
- titleAlignment: "center"
254
+ borderColor: status.color,
255
+ title: status.title,
256
+ titleAlignment: "left"
231
257
  })
232
258
  );
233
259
  };
@@ -15,14 +15,23 @@ declare const getLicenseAnalytics: (license?: LicenseStatus, tsd?: unknown) => {
15
15
  licenseExpiry: number | undefined;
16
16
  trialExpiry: number | undefined;
17
17
  };
18
+ type Row = [label: string, value: string];
18
19
  /**
19
- * The license (or trial) box for the terminal. Undefined when there's nothing to show.
20
+ * What the license box says: a headline, the facts as aligned rows ("Licensed to acme"), and links on their own
21
+ * rows, so it can be read at a glance. `text` is the box's content without colours.
20
22
  */
21
- declare const getLicenseStatusMessage: (license: LicenseStatus, tsd: unknown, now?: number) => {
23
+ type LicenseStatusMessage = {
22
24
  title: string;
23
- color: string;
25
+ color: 'green' | 'yellow';
26
+ headline: string;
27
+ rows: Row[];
28
+ links: Row[];
24
29
  text: string;
25
- } | undefined;
30
+ };
31
+ /**
32
+ * The license (or trial) box for the terminal. Undefined when there's nothing to show.
33
+ */
34
+ declare const getLicenseStatusMessage: (license: LicenseStatus, tsd: unknown, now?: number) => LicenseStatusMessage | undefined;
26
35
  declare const printLicenseStatus: (license: LicenseStatus, tsd: unknown) => void;
27
36
 
28
- export { LicenseStatus, getLicenseAnalytics, getLicenseStatus, getLicenseStatusMessage, printLicenseStatus };
37
+ export { LicenseStatus, type LicenseStatusMessage, getLicenseAnalytics, getLicenseStatus, getLicenseStatusMessage, printLicenseStatus };
@@ -15,14 +15,23 @@ declare const getLicenseAnalytics: (license?: LicenseStatus, tsd?: unknown) => {
15
15
  licenseExpiry: number | undefined;
16
16
  trialExpiry: number | undefined;
17
17
  };
18
+ type Row = [label: string, value: string];
18
19
  /**
19
- * The license (or trial) box for the terminal. Undefined when there's nothing to show.
20
+ * What the license box says: a headline, the facts as aligned rows ("Licensed to acme"), and links on their own
21
+ * rows, so it can be read at a glance. `text` is the box's content without colours.
20
22
  */
21
- declare const getLicenseStatusMessage: (license: LicenseStatus, tsd: unknown, now?: number) => {
23
+ type LicenseStatusMessage = {
22
24
  title: string;
23
- color: string;
25
+ color: 'green' | 'yellow';
26
+ headline: string;
27
+ rows: Row[];
28
+ links: Row[];
24
29
  text: string;
25
- } | undefined;
30
+ };
31
+ /**
32
+ * The license (or trial) box for the terminal. Undefined when there's nothing to show.
33
+ */
34
+ declare const getLicenseStatusMessage: (license: LicenseStatus, tsd: unknown, now?: number) => LicenseStatusMessage | undefined;
26
35
  declare const printLicenseStatus: (license: LicenseStatus, tsd: unknown) => void;
27
36
 
28
- export { LicenseStatus, getLicenseAnalytics, getLicenseStatus, getLicenseStatusMessage, printLicenseStatus };
37
+ export { LicenseStatus, type LicenseStatusMessage, getLicenseAnalytics, getLicenseStatus, getLicenseStatusMessage, printLicenseStatus };
@@ -3,7 +3,7 @@ import {
3
3
  getLicenseStatus,
4
4
  getLicenseStatusMessage,
5
5
  printLicenseStatus
6
- } from "../chunk-TQLRG35T.js";
6
+ } from "../chunk-AWOO63ME.js";
7
7
  export {
8
8
  getLicenseAnalytics,
9
9
  getLicenseStatus,
@@ -27,6 +27,8 @@ import expressiveCode from 'astro-expressive-code';
27
27
  // preprocessors and the rehype plugin below load those same package defaults.
28
28
  import expressiveCodeConfig from './ec.config.mjs';
29
29
  import ecstudioWatcher from './integrations/ecstudio-watcher.mjs';
30
+ import storage from './integrations/storage.mjs';
31
+ import studioServer from './integrations/studio-server.mjs';
30
32
  import eventCatalogIntegration from './src/features/integrations/eventcatalog-features.ts';
31
33
  import eventCatalogRuntime, { getDevServerFileSystem, packageDirectory } from './integrations/eventcatalog-runtime.mjs';
32
34
  import config from './src/utils/eventcatalog-config/source.ts';
@@ -139,6 +141,9 @@ export default defineConfig({
139
141
  catalogAssets({ projectDirectory, generatedDirectory: join(runtimeDirectory, 'public') }),
140
142
  effectiveOutput !== 'server' && compress && (await loadAstroCompressIntegration(projectDirectory)),
141
143
  ecstudioWatcher(),
144
+ // Before Studio: its database is opened and migrated first
145
+ storage(),
146
+ studioServer(),
142
147
  eventCatalogIntegration(),
143
148
  linkValidation(config.linkValidation),
144
149
  ].filter(Boolean),
@@ -0,0 +1,20 @@
1
+ import { startStorage } from '../src/features/storage/database.ts';
2
+
3
+ // The state EventCatalog keeps (`storage` in eventcatalog.config.js): as the dev server starts, its database is opened
4
+ // and brought up to date (migrated), whether or not a feature that uses it is opened. `eventcatalog start` does the
5
+ // same through /_eventcatalog/start.
6
+ export default function storage() {
7
+ return {
8
+ name: 'eventcatalog-storage',
9
+ hooks: {
10
+ 'astro:server:setup': async ({ logger }) => {
11
+ try {
12
+ const file = await startStorage();
13
+ if (file) logger.info(`Database ready (${file})`);
14
+ } catch (error) {
15
+ logger.error(`Could not open the database: ${error.message}`);
16
+ }
17
+ },
18
+ },
19
+ };
20
+ }
@@ -0,0 +1,32 @@
1
+ import { getStudioRuntime } from '../src/features/studio/server/runtime.ts';
2
+ import { isDatabaseTooNew } from '../src/features/storage/migrations.ts';
3
+ import config from '../src/utils/eventcatalog-config/source.ts';
4
+ import { isCanvasEnabled } from '../src/utils/feature.ts';
5
+
6
+ // Collaborative canvases: the collaboration WebSocket (Yjs over Hocuspocus), on the dev server's port.
7
+ // The runtime is shared with server code (e.g. MCP tools) through globalThis.
8
+ export default function studioServer() {
9
+ return {
10
+ name: 'eventcatalog-studio-server',
11
+ hooks: {
12
+ 'astro:server:setup': async ({ server, logger }) => {
13
+ if (!isCanvasEnabled() || !server.httpServer) return;
14
+ const runtime = getStudioRuntime();
15
+ const projectDirectory = process.env.PROJECT_DIR || process.cwd();
16
+ // Canvases are loaded from storage before anyone can open one
17
+ try {
18
+ await runtime.useStorage(config.storage, projectDirectory);
19
+ } catch (error) {
20
+ // Not kept in memory instead (changes would quietly stop being saved): Studio's pages say why
21
+ if (isDatabaseTooNew(error)) return logger.error(`Studio isn't available: ${error.message}`);
22
+ logger.error(`Could not use the Studio storage configured, keeping canvases in memory: ${error.message}`);
23
+ await runtime.useStorage({ type: 'memory' }, projectDirectory);
24
+ }
25
+ runtime.attach(server.httpServer);
26
+ const { type, location } = runtime.storage;
27
+ const kept = type === 'memory' ? 'kept in memory until the server restarts' : `stored in ${location}`;
28
+ logger.info(`Collaboration server ready at /_eventcatalog/studio (canvases ${kept})`);
29
+ },
30
+ },
31
+ };
32
+ }