@eventcatalog/core 2.34.6 → 2.35.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/dist/analytics/analytics.cjs +1 -1
  2. package/dist/analytics/analytics.js +2 -2
  3. package/dist/analytics/log-build.cjs +1 -1
  4. package/dist/analytics/log-build.js +3 -3
  5. package/dist/{chunk-KATU7H36.js → chunk-5XXPX5HQ.js} +1 -1
  6. package/dist/{chunk-PTBY5DEP.js → chunk-7LCJC7ER.js} +1 -1
  7. package/dist/{chunk-ZIZUBYNO.js → chunk-HDG7YSFG.js} +13 -3
  8. package/dist/{chunk-OSGQFZTR.js → chunk-TVAQVUFO.js} +1 -1
  9. package/dist/constants.cjs +1 -1
  10. package/dist/constants.js +1 -1
  11. package/dist/eventcatalog.cjs +24 -4
  12. package/dist/eventcatalog.config.d.cts +1 -0
  13. package/dist/eventcatalog.config.d.ts +1 -0
  14. package/dist/eventcatalog.js +21 -5
  15. package/dist/features.cjs +48 -5
  16. package/dist/features.d.cts +2 -1
  17. package/dist/features.d.ts +2 -1
  18. package/dist/features.js +6 -3
  19. package/eventcatalog/astro.config.mjs +8 -2
  20. package/eventcatalog/src/components/Tables/columns/DomainTableColumns.tsx +1 -2
  21. package/eventcatalog/src/content.config.ts +13 -2
  22. package/eventcatalog/src/enterprise/collections/chat-prompts.ts +32 -0
  23. package/eventcatalog/src/enterprise/collections/custom-pages.ts +12 -15
  24. package/eventcatalog/src/enterprise/collections/index.ts +2 -0
  25. package/eventcatalog/src/enterprise/custom-documentation/collection.ts +1 -1
  26. package/eventcatalog/src/enterprise/eventcatalog-chat/EventCatalogVectorStore.ts +50 -0
  27. package/eventcatalog/src/enterprise/eventcatalog-chat/components/Chat.tsx +50 -0
  28. package/eventcatalog/src/enterprise/eventcatalog-chat/components/ChatMessage.tsx +231 -0
  29. package/eventcatalog/src/enterprise/eventcatalog-chat/components/InputModal.tsx +233 -0
  30. package/eventcatalog/src/enterprise/eventcatalog-chat/components/MentionInput.tsx +211 -0
  31. package/eventcatalog/src/enterprise/eventcatalog-chat/components/WelcomePromptArea.tsx +88 -0
  32. package/eventcatalog/src/enterprise/{ai-assistant/components/ChatWindow.tsx → eventcatalog-chat/components/windows/ChatWindow.client.tsx} +3 -5
  33. package/eventcatalog/src/enterprise/eventcatalog-chat/components/windows/ChatWindow.server.tsx +499 -0
  34. package/eventcatalog/src/enterprise/eventcatalog-chat/pages/api/ai/chat.ts +56 -0
  35. package/eventcatalog/src/enterprise/eventcatalog-chat/pages/api/ai/resources.ts +42 -0
  36. package/eventcatalog/src/enterprise/eventcatalog-chat/pages/chat/index.astro +189 -0
  37. package/eventcatalog/src/enterprise/eventcatalog-chat/utils/ai.ts +151 -0
  38. package/eventcatalog/src/enterprise/eventcatalog-chat/utils/chat-prompts.ts +50 -0
  39. package/eventcatalog/src/pages/chat/index.astro +2 -168
  40. package/eventcatalog/src/types/react-syntax-highlighter.d.ts +1 -0
  41. package/package.json +8 -1
  42. package/eventcatalog/src/enterprise/ai-assistant/components/Chat.tsx +0 -16
  43. /package/eventcatalog/src/{shared-collections.ts → content.config-shared-collections.ts} +0 -0
  44. /package/eventcatalog/src/enterprise/{ai-assistant → eventcatalog-chat}/components/ChatSidebar.tsx +0 -0
  45. /package/eventcatalog/src/enterprise/{ai-assistant → eventcatalog-chat}/components/hooks/ChatProvider.tsx +0 -0
  46. /package/eventcatalog/src/enterprise/{ai-assistant → eventcatalog-chat}/components/workers/document-importer.ts +0 -0
  47. /package/eventcatalog/src/enterprise/{ai-assistant → eventcatalog-chat}/components/workers/engine.ts +0 -0
@@ -37,7 +37,7 @@ var import_axios = __toESM(require("axios"), 1);
37
37
  var import_os = __toESM(require("os"), 1);
38
38
 
39
39
  // package.json
40
- var version = "2.34.6";
40
+ var version = "2.35.0";
41
41
 
42
42
  // src/constants.ts
43
43
  var VERSION = version;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  raiseEvent
3
- } from "../chunk-KATU7H36.js";
4
- import "../chunk-OSGQFZTR.js";
3
+ } from "../chunk-5XXPX5HQ.js";
4
+ import "../chunk-TVAQVUFO.js";
5
5
  export {
6
6
  raiseEvent
7
7
  };
@@ -106,7 +106,7 @@ var import_axios = __toESM(require("axios"), 1);
106
106
  var import_os = __toESM(require("os"), 1);
107
107
 
108
108
  // package.json
109
- var version = "2.34.6";
109
+ var version = "2.35.0";
110
110
 
111
111
  // src/constants.ts
112
112
  var VERSION = version;
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  log_build_default
3
- } from "../chunk-PTBY5DEP.js";
4
- import "../chunk-KATU7H36.js";
5
- import "../chunk-OSGQFZTR.js";
3
+ } from "../chunk-7LCJC7ER.js";
4
+ import "../chunk-5XXPX5HQ.js";
5
+ import "../chunk-TVAQVUFO.js";
6
6
  import "../chunk-E7TXTI7G.js";
7
7
  export {
8
8
  log_build_default as default
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VERSION
3
- } from "./chunk-OSGQFZTR.js";
3
+ } from "./chunk-TVAQVUFO.js";
4
4
 
5
5
  // src/analytics/analytics.js
6
6
  import axios from "axios";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  raiseEvent
3
- } from "./chunk-KATU7H36.js";
3
+ } from "./chunk-5XXPX5HQ.js";
4
4
  import {
5
5
  getEventCatalogConfigFile,
6
6
  verifyRequiredFieldsAreInCatalogConfigFile
@@ -1,7 +1,16 @@
1
+ import {
2
+ getEventCatalogConfigFile
3
+ } from "./chunk-E7TXTI7G.js";
4
+
1
5
  // src/features.ts
2
6
  import boxen from "boxen";
7
+ var isOutputServer = async () => {
8
+ const config = await getEventCatalogConfigFile(process.env.PROJECT_DIR || "");
9
+ return config?.output === "server";
10
+ };
3
11
  var isBackstagePluginEnabled = async (licenseKey) => {
4
- const LICENSE_KEY = process.env.EVENTCATALOG_LICENSE_KEY_BACKSTAGE || null;
12
+ const LICENSE_KEY = process.env.EVENTCATALOG_LICENSE_KEY_BACKSTAGE || process.env.EVENTCATALOG_SCALE_LICENSE_KEY || null;
13
+ const acceptedPlugins = ["@eventcatalog/backstage-plugin-eventcatalog", "@eventcatalog/eventcatalog-scale"];
5
14
  if (!LICENSE_KEY) {
6
15
  return false;
7
16
  }
@@ -20,7 +29,7 @@ var isBackstagePluginEnabled = async (licenseKey) => {
20
29
  }
21
30
  if (response.status === 200) {
22
31
  const data = await response.json();
23
- if ("@eventcatalog/backstage-plugin-eventcatalog" !== data.plugin) {
32
+ if (!acceptedPlugins.includes(data.plugin)) {
24
33
  console.log(
25
34
  "\nInvalid license key for backstage integration, please check your license key or purchase a license at https://eventcatalog.cloud/\n"
26
35
  );
@@ -35,7 +44,7 @@ var isBackstagePluginEnabled = async (licenseKey) => {
35
44
  padding: 1,
36
45
  margin: 1,
37
46
  borderColor: "green",
38
- title: "@eventcatalog/backstage-plugin-eventcatalog",
47
+ title: data.plugin,
39
48
  titleAlignment: "center"
40
49
  })
41
50
  );
@@ -128,6 +137,7 @@ var isEventCatalogStarterEnabled = async (licenseKey) => {
128
137
  };
129
138
 
130
139
  export {
140
+ isOutputServer,
131
141
  isBackstagePluginEnabled,
132
142
  isEventCatalogScaleEnabled,
133
143
  isEventCatalogStarterEnabled
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "2.34.6";
2
+ var version = "2.35.0";
3
3
 
4
4
  // src/constants.ts
5
5
  var VERSION = version;
@@ -25,7 +25,7 @@ __export(constants_exports, {
25
25
  module.exports = __toCommonJS(constants_exports);
26
26
 
27
27
  // package.json
28
- var version = "2.34.6";
28
+ var version = "2.35.0";
29
29
 
30
30
  // src/constants.ts
31
31
  var VERSION = version;
package/dist/constants.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VERSION
3
- } from "./chunk-OSGQFZTR.js";
3
+ } from "./chunk-TVAQVUFO.js";
4
4
  export {
5
5
  VERSION
6
6
  };
@@ -157,7 +157,7 @@ var import_axios = __toESM(require("axios"), 1);
157
157
  var import_os = __toESM(require("os"), 1);
158
158
 
159
159
  // package.json
160
- var version = "2.34.6";
160
+ var version = "2.35.0";
161
161
 
162
162
  // src/constants.ts
163
163
  var VERSION = version;
@@ -473,8 +473,13 @@ var import_boxen2 = __toESM(require("boxen"), 1);
473
473
 
474
474
  // src/features.ts
475
475
  var import_boxen = __toESM(require("boxen"), 1);
476
+ var isOutputServer = async () => {
477
+ const config = await getEventCatalogConfigFile(process.env.PROJECT_DIR || "");
478
+ return config?.output === "server";
479
+ };
476
480
  var isBackstagePluginEnabled = async (licenseKey) => {
477
- const LICENSE_KEY = process.env.EVENTCATALOG_LICENSE_KEY_BACKSTAGE || null;
481
+ const LICENSE_KEY = process.env.EVENTCATALOG_LICENSE_KEY_BACKSTAGE || process.env.EVENTCATALOG_SCALE_LICENSE_KEY || null;
482
+ const acceptedPlugins = ["@eventcatalog/backstage-plugin-eventcatalog", "@eventcatalog/eventcatalog-scale"];
478
483
  if (!LICENSE_KEY) {
479
484
  return false;
480
485
  }
@@ -493,7 +498,7 @@ var isBackstagePluginEnabled = async (licenseKey) => {
493
498
  }
494
499
  if (response.status === 200) {
495
500
  const data = await response.json();
496
- if ("@eventcatalog/backstage-plugin-eventcatalog" !== data.plugin) {
501
+ if (!acceptedPlugins.includes(data.plugin)) {
497
502
  console.log(
498
503
  "\nInvalid license key for backstage integration, please check your license key or purchase a license at https://eventcatalog.cloud/\n"
499
504
  );
@@ -508,7 +513,7 @@ var isBackstagePluginEnabled = async (licenseKey) => {
508
513
  padding: 1,
509
514
  margin: 1,
510
515
  borderColor: "green",
511
- title: "@eventcatalog/backstage-plugin-eventcatalog",
516
+ title: data.plugin,
512
517
  titleAlignment: "center"
513
518
  })
514
519
  );
@@ -635,6 +640,18 @@ var copyCore = () => {
635
640
  }
636
641
  });
637
642
  };
643
+ var copyServerFiles = async () => {
644
+ const isServerOutput = await isOutputServer();
645
+ if (import_fs2.default.existsSync((0, import_node_path6.join)(core, "src/pages/api/server"))) {
646
+ import_fs2.default.rmSync((0, import_node_path6.join)(core, "src/pages/api/server"), { recursive: true });
647
+ }
648
+ if (!isServerOutput) {
649
+ return;
650
+ }
651
+ import_fs2.default.cpSync((0, import_node_path6.join)(eventCatalogDir, "src/enterprise/eventcatalog-chat/pages/api"), (0, import_node_path6.join)(core, "src/pages/api/server"), {
652
+ recursive: true
653
+ });
654
+ };
638
655
  var clearCore = () => {
639
656
  if (import_fs2.default.existsSync(core)) import_fs2.default.rmSync(core, { recursive: true });
640
657
  };
@@ -678,6 +695,7 @@ program.command("dev").description("Run development server of EventCatalog").opt
678
695
  await resolve_catalog_dependencies_default(dir, core);
679
696
  await checkAndConvertMdToMdx(dir, core);
680
697
  await catalogToAstro(dir, core);
698
+ await copyServerFiles();
681
699
  const canEmbedPages = await isBackstagePluginEnabled();
682
700
  const isEventCatalogStarter = await isEventCatalogStarterEnabled();
683
701
  const isEventCatalogScale = await isEventCatalogScaleEnabled();
@@ -724,6 +742,7 @@ program.command("dev").description("Run development server of EventCatalog").opt
724
742
  program.command("build").description("Run build of EventCatalog").action(async (options, command) => {
725
743
  console.log("Building EventCatalog...");
726
744
  copyCore();
745
+ await copyServerFiles();
727
746
  const canEmbedPages = await isBackstagePluginEnabled();
728
747
  const isEventCatalogStarter = await isEventCatalogStarterEnabled();
729
748
  const isEventCatalogScale = await isEventCatalogScaleEnabled();
@@ -766,6 +785,7 @@ program.command("preview").description("Serves the contents of your eventcatalog
766
785
  const canEmbedPages = await isBackstagePluginEnabled();
767
786
  const isEventCatalogStarter = await isEventCatalogStarterEnabled();
768
787
  const isEventCatalogScale = await isEventCatalogScaleEnabled();
788
+ await copyServerFiles();
769
789
  previewCatalog({ command, canEmbedPages, isEventCatalogStarter, isEventCatalogScale });
770
790
  });
771
791
  program.command("start").description("Serves the contents of your eventcatalog build directory").action(async (options, command) => {
@@ -41,6 +41,7 @@ interface Config {
41
41
  base?: string;
42
42
  port?: string;
43
43
  trailingSlash?: boolean;
44
+ output?: 'server' | 'static';
44
45
  rss?: {
45
46
  enabled: boolean;
46
47
  limit: number;
@@ -41,6 +41,7 @@ interface Config {
41
41
  base?: string;
42
42
  port?: string;
43
43
  trailingSlash?: boolean;
44
+ output?: 'server' | 'static';
44
45
  rss?: {
45
46
  enabled: boolean;
46
47
  limit: number;
@@ -6,20 +6,21 @@ import {
6
6
  } from "./chunk-UKJ7F5WR.js";
7
7
  import {
8
8
  log_build_default
9
- } from "./chunk-PTBY5DEP.js";
10
- import "./chunk-KATU7H36.js";
9
+ } from "./chunk-7LCJC7ER.js";
10
+ import "./chunk-5XXPX5HQ.js";
11
11
  import {
12
12
  catalogToAstro,
13
13
  checkAndConvertMdToMdx
14
14
  } from "./chunk-7SI5EVOX.js";
15
15
  import {
16
16
  VERSION
17
- } from "./chunk-OSGQFZTR.js";
17
+ } from "./chunk-TVAQVUFO.js";
18
18
  import {
19
19
  isBackstagePluginEnabled,
20
20
  isEventCatalogScaleEnabled,
21
- isEventCatalogStarterEnabled
22
- } from "./chunk-ZIZUBYNO.js";
21
+ isEventCatalogStarterEnabled,
22
+ isOutputServer
23
+ } from "./chunk-HDG7YSFG.js";
23
24
  import {
24
25
  generate
25
26
  } from "./chunk-YEQVKHST.js";
@@ -69,6 +70,18 @@ var copyCore = () => {
69
70
  }
70
71
  });
71
72
  };
73
+ var copyServerFiles = async () => {
74
+ const isServerOutput = await isOutputServer();
75
+ if (fs.existsSync(join(core, "src/pages/api/server"))) {
76
+ fs.rmSync(join(core, "src/pages/api/server"), { recursive: true });
77
+ }
78
+ if (!isServerOutput) {
79
+ return;
80
+ }
81
+ fs.cpSync(join(eventCatalogDir, "src/enterprise/eventcatalog-chat/pages/api"), join(core, "src/pages/api/server"), {
82
+ recursive: true
83
+ });
84
+ };
72
85
  var clearCore = () => {
73
86
  if (fs.existsSync(core)) fs.rmSync(core, { recursive: true });
74
87
  };
@@ -112,6 +125,7 @@ program.command("dev").description("Run development server of EventCatalog").opt
112
125
  await resolve_catalog_dependencies_default(dir, core);
113
126
  await checkAndConvertMdToMdx(dir, core);
114
127
  await catalogToAstro(dir, core);
128
+ await copyServerFiles();
115
129
  const canEmbedPages = await isBackstagePluginEnabled();
116
130
  const isEventCatalogStarter = await isEventCatalogStarterEnabled();
117
131
  const isEventCatalogScale = await isEventCatalogScaleEnabled();
@@ -158,6 +172,7 @@ program.command("dev").description("Run development server of EventCatalog").opt
158
172
  program.command("build").description("Run build of EventCatalog").action(async (options, command) => {
159
173
  console.log("Building EventCatalog...");
160
174
  copyCore();
175
+ await copyServerFiles();
161
176
  const canEmbedPages = await isBackstagePluginEnabled();
162
177
  const isEventCatalogStarter = await isEventCatalogStarterEnabled();
163
178
  const isEventCatalogScale = await isEventCatalogScaleEnabled();
@@ -200,6 +215,7 @@ program.command("preview").description("Serves the contents of your eventcatalog
200
215
  const canEmbedPages = await isBackstagePluginEnabled();
201
216
  const isEventCatalogStarter = await isEventCatalogStarterEnabled();
202
217
  const isEventCatalogScale = await isEventCatalogScaleEnabled();
218
+ await copyServerFiles();
203
219
  previewCatalog({ command, canEmbedPages, isEventCatalogStarter, isEventCatalogScale });
204
220
  });
205
221
  program.command("start").description("Serves the contents of your eventcatalog build directory").action(async (options, command) => {
package/dist/features.cjs CHANGED
@@ -32,12 +32,54 @@ var features_exports = {};
32
32
  __export(features_exports, {
33
33
  isBackstagePluginEnabled: () => isBackstagePluginEnabled,
34
34
  isEventCatalogScaleEnabled: () => isEventCatalogScaleEnabled,
35
- isEventCatalogStarterEnabled: () => isEventCatalogStarterEnabled
35
+ isEventCatalogStarterEnabled: () => isEventCatalogStarterEnabled,
36
+ isOutputServer: () => isOutputServer
36
37
  });
37
38
  module.exports = __toCommonJS(features_exports);
38
39
  var import_boxen = __toESM(require("boxen"), 1);
40
+
41
+ // src/eventcatalog-config-file-utils.js
42
+ var import_promises = require("fs/promises");
43
+ var import_node_fs = require("fs");
44
+ var import_promises2 = require("fs/promises");
45
+ var import_node_path = __toESM(require("path"), 1);
46
+ var import_uuid = require("uuid");
47
+ var import_url = require("url");
48
+ var import_gray_matter = __toESM(require("gray-matter"), 1);
49
+ async function cleanup(projectDirectory) {
50
+ const filePath = import_node_path.default.join(projectDirectory, "eventcatalog.config.mjs");
51
+ if ((0, import_node_fs.existsSync)(filePath)) {
52
+ await (0, import_promises.rm)(filePath);
53
+ }
54
+ }
55
+ var getEventCatalogConfigFile = async (projectDirectory) => {
56
+ try {
57
+ let configFilePath = import_node_path.default.join(projectDirectory, "eventcatalog.config.js");
58
+ const filePath = import_node_path.default.join(projectDirectory, "package.json");
59
+ const packageJson = JSON.parse(await (0, import_promises.readFile)(filePath, "utf-8"));
60
+ if (packageJson?.type !== "module") {
61
+ await (0, import_promises2.copyFile)(configFilePath, import_node_path.default.join(projectDirectory, "eventcatalog.config.mjs"));
62
+ configFilePath = import_node_path.default.join(projectDirectory, "eventcatalog.config.mjs");
63
+ }
64
+ const configFileURL = (0, import_url.pathToFileURL)(configFilePath).href;
65
+ const config = await import(
66
+ /* @vite-ignore */
67
+ configFileURL
68
+ );
69
+ return config.default;
70
+ } finally {
71
+ await cleanup(projectDirectory);
72
+ }
73
+ };
74
+
75
+ // src/features.ts
76
+ var isOutputServer = async () => {
77
+ const config = await getEventCatalogConfigFile(process.env.PROJECT_DIR || "");
78
+ return config?.output === "server";
79
+ };
39
80
  var isBackstagePluginEnabled = async (licenseKey) => {
40
- const LICENSE_KEY = process.env.EVENTCATALOG_LICENSE_KEY_BACKSTAGE || null;
81
+ const LICENSE_KEY = process.env.EVENTCATALOG_LICENSE_KEY_BACKSTAGE || process.env.EVENTCATALOG_SCALE_LICENSE_KEY || null;
82
+ const acceptedPlugins = ["@eventcatalog/backstage-plugin-eventcatalog", "@eventcatalog/eventcatalog-scale"];
41
83
  if (!LICENSE_KEY) {
42
84
  return false;
43
85
  }
@@ -56,7 +98,7 @@ var isBackstagePluginEnabled = async (licenseKey) => {
56
98
  }
57
99
  if (response.status === 200) {
58
100
  const data = await response.json();
59
- if ("@eventcatalog/backstage-plugin-eventcatalog" !== data.plugin) {
101
+ if (!acceptedPlugins.includes(data.plugin)) {
60
102
  console.log(
61
103
  "\nInvalid license key for backstage integration, please check your license key or purchase a license at https://eventcatalog.cloud/\n"
62
104
  );
@@ -71,7 +113,7 @@ var isBackstagePluginEnabled = async (licenseKey) => {
71
113
  padding: 1,
72
114
  margin: 1,
73
115
  borderColor: "green",
74
- title: "@eventcatalog/backstage-plugin-eventcatalog",
116
+ title: data.plugin,
75
117
  titleAlignment: "center"
76
118
  })
77
119
  );
@@ -166,5 +208,6 @@ var isEventCatalogStarterEnabled = async (licenseKey) => {
166
208
  0 && (module.exports = {
167
209
  isBackstagePluginEnabled,
168
210
  isEventCatalogScaleEnabled,
169
- isEventCatalogStarterEnabled
211
+ isEventCatalogStarterEnabled,
212
+ isOutputServer
170
213
  });
@@ -1,5 +1,6 @@
1
+ declare const isOutputServer: () => Promise<boolean>;
1
2
  declare const isBackstagePluginEnabled: (licenseKey?: string) => Promise<boolean>;
2
3
  declare const isEventCatalogScaleEnabled: (licenseKey?: string) => Promise<boolean>;
3
4
  declare const isEventCatalogStarterEnabled: (licenseKey?: string) => Promise<boolean>;
4
5
 
5
- export { isBackstagePluginEnabled, isEventCatalogScaleEnabled, isEventCatalogStarterEnabled };
6
+ export { isBackstagePluginEnabled, isEventCatalogScaleEnabled, isEventCatalogStarterEnabled, isOutputServer };
@@ -1,5 +1,6 @@
1
+ declare const isOutputServer: () => Promise<boolean>;
1
2
  declare const isBackstagePluginEnabled: (licenseKey?: string) => Promise<boolean>;
2
3
  declare const isEventCatalogScaleEnabled: (licenseKey?: string) => Promise<boolean>;
3
4
  declare const isEventCatalogStarterEnabled: (licenseKey?: string) => Promise<boolean>;
4
5
 
5
- export { isBackstagePluginEnabled, isEventCatalogScaleEnabled, isEventCatalogStarterEnabled };
6
+ export { isBackstagePluginEnabled, isEventCatalogScaleEnabled, isEventCatalogStarterEnabled, isOutputServer };
package/dist/features.js CHANGED
@@ -1,10 +1,13 @@
1
1
  import {
2
2
  isBackstagePluginEnabled,
3
3
  isEventCatalogScaleEnabled,
4
- isEventCatalogStarterEnabled
5
- } from "./chunk-ZIZUBYNO.js";
4
+ isEventCatalogStarterEnabled,
5
+ isOutputServer
6
+ } from "./chunk-HDG7YSFG.js";
7
+ import "./chunk-E7TXTI7G.js";
6
8
  export {
7
9
  isBackstagePluginEnabled,
8
10
  isEventCatalogScaleEnabled,
9
- isEventCatalogStarterEnabled
11
+ isEventCatalogStarterEnabled,
12
+ isOutputServer
10
13
  };
@@ -7,7 +7,7 @@ import { mermaid } from "./src/remark-plugins/mermaid"
7
7
  import { join } from 'node:path';
8
8
  import remarkDirective from 'remark-directive';
9
9
  import { remarkDirectives } from "./src/remark-plugins/directives"
10
-
10
+ import node from '@astrojs/node';
11
11
  import remarkComment from 'remark-comment'
12
12
 
13
13
  /** @type {import('bin/eventcatalog.config').Config} */
@@ -22,6 +22,12 @@ export default defineConfig({
22
22
  base,
23
23
  server: { port: config.port || 3000 },
24
24
 
25
+ // output: config.output || 'static',
26
+
27
+ adapter: config.output === 'server' ? node({
28
+ mode: 'standalone'
29
+ }) : undefined,
30
+
25
31
  outDir: config.outDir ? join(projectDirectory, config.outDir) : join(projectDirectory, 'dist'),
26
32
 
27
33
  // https://docs.astro.build/en/reference/configuration-reference/#site
@@ -47,7 +53,7 @@ export default defineConfig({
47
53
  wrap: true,
48
54
  },
49
55
  }),
50
-
56
+
51
57
  mdx({
52
58
  // https://docs.astro.build/en/guides/integrations-guide/mdx/#optimize
53
59
  optimize: config.mdxOptimize || false,
@@ -1,5 +1,4 @@
1
- import { ServerIcon } from '@heroicons/react/20/solid';
2
- import { RectangleGroupIcon } from '@heroicons/react/20/solid';
1
+ import { ServerIcon, RectangleGroupIcon } from '@heroicons/react/20/solid';
3
2
  import { createColumnHelper } from '@tanstack/react-table';
4
3
  import { filterByName, filterCollectionByName } from '../filters/custom-filters';
5
4
  import { buildUrl } from '@utils/url-builder';
@@ -1,8 +1,10 @@
1
1
  import { z, defineCollection, reference } from 'astro:content';
2
2
  import { glob } from 'astro/loaders';
3
3
  import { v4 as uuidv4 } from 'uuid';
4
- import { badge, ownerReference } from './shared-collections';
5
- import { customPagesSchema } from './enterprise/custom-documentation/collection';
4
+ import { badge, ownerReference } from './content.config-shared-collections';
5
+
6
+ // Enterprise Collections
7
+ import { chatPromptsSchema, customPagesSchema } from './enterprise/collections';
6
8
 
7
9
  export const projectDirBase = (() => {
8
10
  if (process.platform === 'win32') {
@@ -306,6 +308,14 @@ const customPages = defineCollection({
306
308
  schema: customPagesSchema,
307
309
  });
308
310
 
311
+ const chatPrompts = defineCollection({
312
+ loader: glob({
313
+ pattern: ['chat-prompts/*.(md|mdx)', 'chat-prompts/**/*.@(md|mdx)'],
314
+ base: projectDirBase,
315
+ }),
316
+ schema: chatPromptsSchema,
317
+ });
318
+
309
319
  const domains = defineCollection({
310
320
  loader: glob({
311
321
  pattern: [
@@ -432,4 +442,5 @@ export const collections = {
432
442
 
433
443
  // EventCatalog Pro Collections
434
444
  customPages,
445
+ chatPrompts,
435
446
  };
@@ -0,0 +1,32 @@
1
+ import { z } from 'astro:content';
2
+
3
+ export const chatPromptsSchema = z.object({
4
+ title: z.string(),
5
+ type: z.enum(['text', 'code']).default('text'),
6
+ inputs: z
7
+ .array(
8
+ z.object({
9
+ id: z.string(),
10
+ label: z.string(),
11
+ type: z
12
+ .enum([
13
+ 'text',
14
+ 'resource-list-events',
15
+ 'resource-list-services',
16
+ 'resource-list-commands',
17
+ 'resource-list-queries',
18
+ 'code',
19
+ 'text-area',
20
+ 'select',
21
+ ])
22
+ .default('text'),
23
+ options: z.array(z.string()).optional(),
24
+ })
25
+ )
26
+ .optional(),
27
+ category: z.object({
28
+ id: z.string(),
29
+ label: z.string(),
30
+ icon: z.string().optional(),
31
+ }),
32
+ });
@@ -1,19 +1,16 @@
1
- import { glob } from 'astro/loaders';
2
- import { z, defineCollection } from 'astro:content';
3
- import { projectDirBase } from '../../content.config';
1
+ import { z } from 'astro:content';
2
+ import { badge, ownerReference } from '../../content.config-shared-collections';
4
3
 
5
- export const customPages = defineCollection({
6
- loader: glob({
7
- pattern: ['docs/hello-world.mdx'],
8
- base: projectDirBase,
9
- }),
10
- schema: z.object({
11
- id: z.string(),
12
- title: z.string(),
13
- description: z.string(),
14
- sidebar: z.object({
4
+ export const customPagesSchema = z.object({
5
+ title: z.string(),
6
+ summary: z.string(),
7
+ slug: z.string().optional(),
8
+ sidebar: z
9
+ .object({
15
10
  label: z.string(),
16
11
  order: z.number(),
17
- }),
18
- }),
12
+ })
13
+ .optional(),
14
+ owners: z.array(ownerReference).optional(),
15
+ badges: z.array(badge).optional(),
19
16
  });
@@ -0,0 +1,2 @@
1
+ export { customPagesSchema } from './custom-pages';
2
+ export { chatPromptsSchema } from './chat-prompts';
@@ -1,5 +1,5 @@
1
1
  import { z } from 'astro:content';
2
- import { badge, ownerReference } from '../../shared-collections';
2
+ import { badge, ownerReference } from '../../content.config-shared-collections';
3
3
 
4
4
  export const customPagesSchema = z.object({
5
5
  title: z.string(),
@@ -0,0 +1,50 @@
1
+ import { HuggingFaceTransformersEmbeddings } from '@langchain/community/embeddings/huggingface_transformers';
2
+ import { MemoryVectorStore } from 'langchain/vectorstores/memory';
3
+ import { Document as LangChainDocument } from 'langchain/document';
4
+
5
+ const embeddingsInstance = new HuggingFaceTransformersEmbeddings({ model: 'Xenova/all-MiniLM-L6-v2' });
6
+
7
+ export interface Resource {
8
+ id: string;
9
+ type: string;
10
+ url: string;
11
+ title?: string;
12
+ }
13
+
14
+ export class EventCatalogVectorStore {
15
+ private vectorStore: MemoryVectorStore;
16
+
17
+ // Make the constructor private so it can only be called from within the class
18
+ private constructor(vectorStore: MemoryVectorStore) {
19
+ this.vectorStore = vectorStore;
20
+ }
21
+
22
+ // Static async factory method
23
+ public static async create(documents: LangChainDocument[], embeddings: number[][]): Promise<EventCatalogVectorStore> {
24
+ const vectorStore = new MemoryVectorStore(embeddingsInstance);
25
+ await vectorStore.addVectors(embeddings, documents);
26
+ return new EventCatalogVectorStore(vectorStore);
27
+ }
28
+
29
+ async search(query: string) {
30
+ return this.vectorStore.similaritySearch(query, 10);
31
+ }
32
+
33
+ async getEventCatalogResources(query: string): Promise<Resource[]> {
34
+ const results = await this.vectorStore.similaritySearchWithScore(query, 50);
35
+ return Array.from(
36
+ new Map(
37
+ results.map((result: any) => {
38
+ const metadata = result[0].metadata;
39
+ const resource: Resource = {
40
+ id: metadata.id,
41
+ type: metadata.type,
42
+ url: `/docs/${metadata.type}s/${metadata.id}`,
43
+ title: metadata.title || metadata.id,
44
+ };
45
+ return [metadata.id, resource]; // Use ID as key for Map
46
+ })
47
+ ).values()
48
+ );
49
+ }
50
+ }