@eventcatalog/core 4.0.6 → 4.1.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 (44) 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/catalog-to-astro-content-directory.cjs +32 -1
  6. package/dist/catalog-to-astro-content-directory.js +2 -2
  7. package/dist/{chunk-7443A7LZ.js → chunk-2PPDVKNK.js} +1 -1
  8. package/dist/{chunk-ZYWUN3T3.js → chunk-2T6ESD3L.js} +1 -1
  9. package/dist/{chunk-O3Y2G6CY.js → chunk-CAJUIMDJ.js} +1 -1
  10. package/dist/{chunk-Z7BGWB5J.js → chunk-OQ36RUHT.js} +1 -1
  11. package/dist/{chunk-FHVBLKWN.js → chunk-PL4YZUAA.js} +1 -1
  12. package/dist/{chunk-ZXAF4JO7.js → chunk-RXZKZGDC.js} +1 -1
  13. package/dist/{chunk-WQNKHIDM.js → chunk-W3SAPOZU.js} +13 -1
  14. package/dist/{chunk-VC6VUJIX.js → chunk-W5JQON7Z.js} +20 -1
  15. package/dist/constants.cjs +1 -1
  16. package/dist/constants.js +1 -1
  17. package/dist/eventcatalog.cjs +33 -2
  18. package/dist/eventcatalog.config.d.cts +8 -0
  19. package/dist/eventcatalog.config.d.ts +8 -0
  20. package/dist/eventcatalog.js +8 -8
  21. package/dist/generate.cjs +1 -1
  22. package/dist/generate.js +3 -3
  23. package/dist/map-catalog-to-astro.cjs +20 -1
  24. package/dist/map-catalog-to-astro.js +1 -1
  25. package/dist/utils/cli-logger.cjs +1 -1
  26. package/dist/utils/cli-logger.js +2 -2
  27. package/dist/watcher.cjs +20 -1
  28. package/dist/watcher.js +2 -2
  29. package/eventcatalog/src/components/ChatPanel/ChatPanel.tsx +6 -2
  30. package/eventcatalog/src/components/MDX/RemoteFile.astro +5 -0
  31. package/eventcatalog/src/components/SchemaExplorer/DiffViewer.tsx +7 -9
  32. package/eventcatalog/src/components/SchemaExplorer/SchemaDetailsPanel.tsx +127 -41
  33. package/eventcatalog/src/components/SchemaExplorer/VersionHistoryModal.tsx +2 -2
  34. package/eventcatalog/src/components/SchemaExplorer/types.ts +4 -4
  35. package/eventcatalog/src/enterprise/custom-pages/routes.ts +142 -0
  36. package/eventcatalog/src/enterprise/feature.ts +3 -0
  37. package/eventcatalog/src/enterprise/integrations/eventcatalog-features.ts +84 -1
  38. package/eventcatalog/src/pages/index.astro +1 -1
  39. package/eventcatalog/src/toolkit/layouts/Layout.astro +25 -0
  40. package/eventcatalog/src/toolkit/utils/index.ts +26 -0
  41. package/eventcatalog/src/utils/feature.ts +1 -0
  42. package/eventcatalog/src/utils/json-schema-refs.ts +158 -0
  43. package/eventcatalog/tsconfig.json +5 -1
  44. package/package.json +3 -3
@@ -36,7 +36,7 @@ module.exports = __toCommonJS(analytics_exports);
36
36
  var import_os = __toESM(require("os"), 1);
37
37
 
38
38
  // package.json
39
- var version = "4.0.6";
39
+ var version = "4.1.0";
40
40
 
41
41
  // src/constants.ts
42
42
  var VERSION = version;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  raiseEvent
3
- } from "../chunk-FHVBLKWN.js";
4
- import "../chunk-Z7BGWB5J.js";
3
+ } from "../chunk-PL4YZUAA.js";
4
+ import "../chunk-OQ36RUHT.js";
5
5
  export {
6
6
  raiseEvent
7
7
  };
@@ -140,7 +140,7 @@ var verifyRequiredFieldsAreInCatalogConfigFile = async (projectDirectory) => {
140
140
  var import_os = __toESM(require("os"), 1);
141
141
 
142
142
  // package.json
143
- var version = "4.0.6";
143
+ var version = "4.1.0";
144
144
 
145
145
  // src/constants.ts
146
146
  var VERSION = version;
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  log_build_default
3
- } from "../chunk-ZYWUN3T3.js";
4
- import "../chunk-FHVBLKWN.js";
3
+ } from "../chunk-2T6ESD3L.js";
4
+ import "../chunk-PL4YZUAA.js";
5
5
  import "../chunk-DAOXTQVS.js";
6
- import "../chunk-Z7BGWB5J.js";
6
+ import "../chunk-OQ36RUHT.js";
7
7
  import "../chunk-6QENHZZP.js";
8
8
  export {
9
9
  log_build_default as default
@@ -149,6 +149,7 @@ var verifyRequiredFieldsAreInCatalogConfigFile = async (projectDirectory) => {
149
149
 
150
150
  // src/map-catalog-to-astro.js
151
151
  var import_node_path2 = __toESM(require("path"), 1);
152
+ var CUSTOM_PAGE_EXTENSIONS = [".astro", ".ts", ".js", ".mjs"];
152
153
  var COLLECTION_KEYS = [
153
154
  "agents",
154
155
  "events",
@@ -171,6 +172,10 @@ function mapCatalogToAstro({ filePath, astroDir, projectDir }) {
171
172
  if (!isCatalogRelated(relativeFilePath)) {
172
173
  return [];
173
174
  }
175
+ const customPageTargetPaths = getCustomPageTargetPaths(relativeFilePath, astroDir);
176
+ if (customPageTargetPaths) {
177
+ return customPageTargetPaths;
178
+ }
174
179
  const baseTargetPaths = getBaseTargetPaths(relativeFilePath);
175
180
  const relativeTargetPath = getRelativeTargetPath(relativeFilePath);
176
181
  return baseTargetPaths.map((base) => import_node_path2.default.join(astroDir, base, relativeTargetPath));
@@ -185,6 +190,21 @@ function isCollectionKey(key) {
185
190
  function isLikeC4Source(filePath) {
186
191
  return filePath.endsWith(".c4") || filePath.endsWith(".likec4");
187
192
  }
193
+ var hasExtension = (str) => /\.[a-zA-Z0-9]{2,}$/.test(str);
194
+ function getCustomPageTargetPaths(filePath, astroDir) {
195
+ const filePathArr = filePath.split(import_node_path2.default.sep).filter(Boolean);
196
+ if (filePathArr[0] !== "pages") {
197
+ return null;
198
+ }
199
+ const customPagePath = import_node_path2.default.join(astroDir, "src", "custom-pages", ...filePathArr.slice(1));
200
+ if (CUSTOM_PAGE_EXTENSIONS.includes(import_node_path2.default.extname(filePath).toLowerCase())) {
201
+ return [customPagePath];
202
+ }
203
+ if (!hasExtension(filePath)) {
204
+ return [customPagePath, import_node_path2.default.join(astroDir, "public", "generated", ...filePathArr)];
205
+ }
206
+ return [import_node_path2.default.join(astroDir, "public", "generated", ...filePathArr)];
207
+ }
188
208
  function isCatalogRelated(filePath) {
189
209
  const filePathArr = filePath.split(import_node_path2.default.sep).filter(Boolean);
190
210
  if ([
@@ -209,7 +229,6 @@ function isCatalogRelated(filePath) {
209
229
  function getBaseTargetPaths(filePath) {
210
230
  const filePathArr = filePath.split(import_node_path2.default.sep).filter(Boolean);
211
231
  if (isCollectionKey(filePathArr[0])) {
212
- const hasExtension = (str) => /\.[a-zA-Z0-9]{2,}$/.test(str);
213
232
  if (hasExtension(filePath)) {
214
233
  return [import_node_path2.default.join("public", "generated")];
215
234
  }
@@ -272,6 +291,17 @@ var copyFiles = async (source, target) => {
272
291
  });
273
292
  }
274
293
  };
294
+ var clearCustomPages = async (target) => {
295
+ const customPagesDir = path3.join(target, "src", "custom-pages");
296
+ if (import_fs.default.existsSync(customPagesDir)) import_fs.default.rmSync(customPagesDir, { recursive: true });
297
+ const staleCodeFiles = await (0, import_glob.glob)(path3.join(target, "public", "generated", "pages", "**/*.{astro,ts,js,mjs}"), {
298
+ nodir: true,
299
+ windowsPathsNoEscape: import_node_os2.default.platform() == "win32"
300
+ });
301
+ for (const file of staleCodeFiles) {
302
+ import_fs.default.rmSync(file);
303
+ }
304
+ };
275
305
  var removeGeneratedLikeC4Sources = async (target) => {
276
306
  const generatedDir = path3.join(target, "public", "generated");
277
307
  const files = await (0, import_glob.glob)(path3.join(generatedDir, "**/*.{c4,likec4}"), {
@@ -290,6 +320,7 @@ var catalogToAstro = async (source, astroDir) => {
290
320
  if (!import_fs.default.existsSync(path3.join(source, "eventcatalog.styles.css"))) {
291
321
  import_fs.default.writeFileSync(path3.join(source, "eventcatalog.styles.css"), "");
292
322
  }
323
+ await clearCustomPages(astroDir);
293
324
  await removeGeneratedLikeC4Sources(astroDir);
294
325
  await copyFiles(source, astroDir);
295
326
  };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  catalogToAstro
3
- } from "./chunk-WQNKHIDM.js";
4
- import "./chunk-VC6VUJIX.js";
3
+ } from "./chunk-W3SAPOZU.js";
4
+ import "./chunk-W5JQON7Z.js";
5
5
  import "./chunk-6QENHZZP.js";
6
6
  export {
7
7
  catalogToAstro
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  logger
3
- } from "./chunk-ZXAF4JO7.js";
3
+ } from "./chunk-RXZKZGDC.js";
4
4
  import {
5
5
  cleanup,
6
6
  getEventCatalogConfigFile
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  raiseEvent
3
- } from "./chunk-FHVBLKWN.js";
3
+ } from "./chunk-PL4YZUAA.js";
4
4
  import {
5
5
  countResources,
6
6
  serializeCounts
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  mapCatalogToAstro
3
- } from "./chunk-VC6VUJIX.js";
3
+ } from "./chunk-W5JQON7Z.js";
4
4
 
5
5
  // src/watcher.js
6
6
  import watcher from "@parcel/watcher";
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "4.0.6";
2
+ var version = "4.1.0";
3
3
 
4
4
  // src/constants.ts
5
5
  var VERSION = version;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VERSION
3
- } from "./chunk-Z7BGWB5J.js";
3
+ } from "./chunk-OQ36RUHT.js";
4
4
 
5
5
  // src/analytics/analytics.js
6
6
  import os from "os";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VERSION
3
- } from "./chunk-Z7BGWB5J.js";
3
+ } from "./chunk-OQ36RUHT.js";
4
4
 
5
5
  // src/utils/cli-logger.ts
6
6
  import pc from "picocolors";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  mapCatalogToAstro
3
- } from "./chunk-VC6VUJIX.js";
3
+ } from "./chunk-W5JQON7Z.js";
4
4
  import {
5
5
  verifyRequiredFieldsAreInCatalogConfigFile
6
6
  } from "./chunk-6QENHZZP.js";
@@ -40,6 +40,17 @@ var copyFiles = async (source, target) => {
40
40
  });
41
41
  }
42
42
  };
43
+ var clearCustomPages = async (target) => {
44
+ const customPagesDir = path.join(target, "src", "custom-pages");
45
+ if (fs.existsSync(customPagesDir)) fs.rmSync(customPagesDir, { recursive: true });
46
+ const staleCodeFiles = await glob(path.join(target, "public", "generated", "pages", "**/*.{astro,ts,js,mjs}"), {
47
+ nodir: true,
48
+ windowsPathsNoEscape: os.platform() == "win32"
49
+ });
50
+ for (const file of staleCodeFiles) {
51
+ fs.rmSync(file);
52
+ }
53
+ };
43
54
  var removeGeneratedLikeC4Sources = async (target) => {
44
55
  const generatedDir = path.join(target, "public", "generated");
45
56
  const files = await glob(path.join(generatedDir, "**/*.{c4,likec4}"), {
@@ -58,6 +69,7 @@ var catalogToAstro = async (source, astroDir) => {
58
69
  if (!fs.existsSync(path.join(source, "eventcatalog.styles.css"))) {
59
70
  fs.writeFileSync(path.join(source, "eventcatalog.styles.css"), "");
60
71
  }
72
+ await clearCustomPages(astroDir);
61
73
  await removeGeneratedLikeC4Sources(astroDir);
62
74
  await copyFiles(source, astroDir);
63
75
  };
@@ -1,5 +1,6 @@
1
1
  // src/map-catalog-to-astro.js
2
2
  import path from "path";
3
+ var CUSTOM_PAGE_EXTENSIONS = [".astro", ".ts", ".js", ".mjs"];
3
4
  var COLLECTION_KEYS = [
4
5
  "agents",
5
6
  "events",
@@ -22,6 +23,10 @@ function mapCatalogToAstro({ filePath, astroDir, projectDir }) {
22
23
  if (!isCatalogRelated(relativeFilePath)) {
23
24
  return [];
24
25
  }
26
+ const customPageTargetPaths = getCustomPageTargetPaths(relativeFilePath, astroDir);
27
+ if (customPageTargetPaths) {
28
+ return customPageTargetPaths;
29
+ }
25
30
  const baseTargetPaths = getBaseTargetPaths(relativeFilePath);
26
31
  const relativeTargetPath = getRelativeTargetPath(relativeFilePath);
27
32
  return baseTargetPaths.map((base) => path.join(astroDir, base, relativeTargetPath));
@@ -36,6 +41,21 @@ function isCollectionKey(key) {
36
41
  function isLikeC4Source(filePath) {
37
42
  return filePath.endsWith(".c4") || filePath.endsWith(".likec4");
38
43
  }
44
+ var hasExtension = (str) => /\.[a-zA-Z0-9]{2,}$/.test(str);
45
+ function getCustomPageTargetPaths(filePath, astroDir) {
46
+ const filePathArr = filePath.split(path.sep).filter(Boolean);
47
+ if (filePathArr[0] !== "pages") {
48
+ return null;
49
+ }
50
+ const customPagePath = path.join(astroDir, "src", "custom-pages", ...filePathArr.slice(1));
51
+ if (CUSTOM_PAGE_EXTENSIONS.includes(path.extname(filePath).toLowerCase())) {
52
+ return [customPagePath];
53
+ }
54
+ if (!hasExtension(filePath)) {
55
+ return [customPagePath, path.join(astroDir, "public", "generated", ...filePathArr)];
56
+ }
57
+ return [path.join(astroDir, "public", "generated", ...filePathArr)];
58
+ }
39
59
  function isCatalogRelated(filePath) {
40
60
  const filePathArr = filePath.split(path.sep).filter(Boolean);
41
61
  if ([
@@ -60,7 +80,6 @@ function isCatalogRelated(filePath) {
60
80
  function getBaseTargetPaths(filePath) {
61
81
  const filePathArr = filePath.split(path.sep).filter(Boolean);
62
82
  if (isCollectionKey(filePathArr[0])) {
63
- const hasExtension = (str) => /\.[a-zA-Z0-9]{2,}$/.test(str);
64
83
  if (hasExtension(filePath)) {
65
84
  return [path.join("public", "generated")];
66
85
  }
@@ -25,7 +25,7 @@ __export(constants_exports, {
25
25
  module.exports = __toCommonJS(constants_exports);
26
26
 
27
27
  // package.json
28
- var version = "4.0.6";
28
+ var version = "4.1.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-Z7BGWB5J.js";
3
+ } from "./chunk-OQ36RUHT.js";
4
4
  export {
5
5
  VERSION
6
6
  };
@@ -144,7 +144,7 @@ var verifyRequiredFieldsAreInCatalogConfigFile = async (projectDirectory) => {
144
144
  var import_picocolors = __toESM(require("picocolors"), 1);
145
145
 
146
146
  // package.json
147
- var version = "4.0.6";
147
+ var version = "4.1.0";
148
148
 
149
149
  // src/constants.ts
150
150
  var VERSION = version;
@@ -416,6 +416,7 @@ var import_node_fs2 = __toESM(require("fs"), 1);
416
416
 
417
417
  // src/map-catalog-to-astro.js
418
418
  var import_node_path3 = __toESM(require("path"), 1);
419
+ var CUSTOM_PAGE_EXTENSIONS = [".astro", ".ts", ".js", ".mjs"];
419
420
  var COLLECTION_KEYS = [
420
421
  "agents",
421
422
  "events",
@@ -438,6 +439,10 @@ function mapCatalogToAstro({ filePath, astroDir, projectDir }) {
438
439
  if (!isCatalogRelated(relativeFilePath)) {
439
440
  return [];
440
441
  }
442
+ const customPageTargetPaths = getCustomPageTargetPaths(relativeFilePath, astroDir);
443
+ if (customPageTargetPaths) {
444
+ return customPageTargetPaths;
445
+ }
441
446
  const baseTargetPaths = getBaseTargetPaths(relativeFilePath);
442
447
  const relativeTargetPath = getRelativeTargetPath(relativeFilePath);
443
448
  return baseTargetPaths.map((base) => import_node_path3.default.join(astroDir, base, relativeTargetPath));
@@ -452,6 +457,21 @@ function isCollectionKey(key) {
452
457
  function isLikeC4Source(filePath) {
453
458
  return filePath.endsWith(".c4") || filePath.endsWith(".likec4");
454
459
  }
460
+ var hasExtension = (str) => /\.[a-zA-Z0-9]{2,}$/.test(str);
461
+ function getCustomPageTargetPaths(filePath, astroDir) {
462
+ const filePathArr = filePath.split(import_node_path3.default.sep).filter(Boolean);
463
+ if (filePathArr[0] !== "pages") {
464
+ return null;
465
+ }
466
+ const customPagePath = import_node_path3.default.join(astroDir, "src", "custom-pages", ...filePathArr.slice(1));
467
+ if (CUSTOM_PAGE_EXTENSIONS.includes(import_node_path3.default.extname(filePath).toLowerCase())) {
468
+ return [customPagePath];
469
+ }
470
+ if (!hasExtension(filePath)) {
471
+ return [customPagePath, import_node_path3.default.join(astroDir, "public", "generated", ...filePathArr)];
472
+ }
473
+ return [import_node_path3.default.join(astroDir, "public", "generated", ...filePathArr)];
474
+ }
455
475
  function isCatalogRelated(filePath) {
456
476
  const filePathArr = filePath.split(import_node_path3.default.sep).filter(Boolean);
457
477
  if ([
@@ -476,7 +496,6 @@ function isCatalogRelated(filePath) {
476
496
  function getBaseTargetPaths(filePath) {
477
497
  const filePathArr = filePath.split(import_node_path3.default.sep).filter(Boolean);
478
498
  if (isCollectionKey(filePathArr[0])) {
479
- const hasExtension = (str) => /\.[a-zA-Z0-9]{2,}$/.test(str);
480
499
  if (hasExtension(filePath)) {
481
500
  return [import_node_path3.default.join("public", "generated")];
482
501
  }
@@ -635,6 +654,17 @@ var copyFiles = async (source, target) => {
635
654
  });
636
655
  }
637
656
  };
657
+ var clearCustomPages = async (target) => {
658
+ const customPagesDir = path4.join(target, "src", "custom-pages");
659
+ if (import_fs.default.existsSync(customPagesDir)) import_fs.default.rmSync(customPagesDir, { recursive: true });
660
+ const staleCodeFiles = await (0, import_glob2.glob)(path4.join(target, "public", "generated", "pages", "**/*.{astro,ts,js,mjs}"), {
661
+ nodir: true,
662
+ windowsPathsNoEscape: import_node_os2.default.platform() == "win32"
663
+ });
664
+ for (const file of staleCodeFiles) {
665
+ import_fs.default.rmSync(file);
666
+ }
667
+ };
638
668
  var removeGeneratedLikeC4Sources = async (target) => {
639
669
  const generatedDir = path4.join(target, "public", "generated");
640
670
  const files = await (0, import_glob2.glob)(path4.join(generatedDir, "**/*.{c4,likec4}"), {
@@ -653,6 +683,7 @@ var catalogToAstro = async (source, astroDir) => {
653
683
  if (!import_fs.default.existsSync(path4.join(source, "eventcatalog.styles.css"))) {
654
684
  import_fs.default.writeFileSync(path4.join(source, "eventcatalog.styles.css"), "");
655
685
  }
686
+ await clearCustomPages(astroDir);
656
687
  await removeGeneratedLikeC4Sources(astroDir);
657
688
  await copyFiles(source, astroDir);
658
689
  };
@@ -260,6 +260,14 @@ interface Config {
260
260
  };
261
261
  mdxOptimize?: boolean;
262
262
  compress?: boolean;
263
+ pages?: {
264
+ /**
265
+ * URL prefix that user-defined pages (pages/*.astro, pages/api/*.ts) are served under,
266
+ * e.g. pages/reports.astro is served at /custom/reports.
267
+ * @default 'custom'
268
+ */
269
+ prefix?: string;
270
+ };
263
271
  navigation?: {
264
272
  pages?: NavigationPage[];
265
273
  /**
@@ -260,6 +260,14 @@ interface Config {
260
260
  };
261
261
  mdxOptimize?: boolean;
262
262
  compress?: boolean;
263
+ pages?: {
264
+ /**
265
+ * URL prefix that user-defined pages (pages/*.astro, pages/api/*.ts) are served under,
266
+ * e.g. pages/reports.astro is served at /custom/reports.
267
+ * @default 'custom'
268
+ */
269
+ prefix?: string;
270
+ };
263
271
  navigation?: {
264
272
  pages?: NavigationPage[];
265
273
  /**
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  log_build_default
3
- } from "./chunk-ZYWUN3T3.js";
3
+ } from "./chunk-2T6ESD3L.js";
4
4
  import {
5
5
  runMigrations
6
6
  } from "./chunk-XUAF2H54.js";
7
7
  import "./chunk-CA4U2JP7.js";
8
8
  import {
9
9
  generate
10
- } from "./chunk-7443A7LZ.js";
10
+ } from "./chunk-2PPDVKNK.js";
11
11
  import {
12
12
  logger
13
- } from "./chunk-ZXAF4JO7.js";
13
+ } from "./chunk-RXZKZGDC.js";
14
14
  import {
15
15
  resolve_catalog_dependencies_default
16
16
  } from "./chunk-LHR4G2UO.js";
@@ -19,16 +19,16 @@ import {
19
19
  } from "./chunk-ZONBICNH.js";
20
20
  import {
21
21
  watch
22
- } from "./chunk-O3Y2G6CY.js";
23
- import "./chunk-FHVBLKWN.js";
22
+ } from "./chunk-CAJUIMDJ.js";
23
+ import "./chunk-PL4YZUAA.js";
24
24
  import "./chunk-DAOXTQVS.js";
25
25
  import {
26
26
  catalogToAstro
27
- } from "./chunk-WQNKHIDM.js";
28
- import "./chunk-VC6VUJIX.js";
27
+ } from "./chunk-W3SAPOZU.js";
28
+ import "./chunk-W5JQON7Z.js";
29
29
  import {
30
30
  VERSION
31
- } from "./chunk-Z7BGWB5J.js";
31
+ } from "./chunk-OQ36RUHT.js";
32
32
  import {
33
33
  linkCoreNodeModules,
34
34
  resolveInstalledCoreNodeModules
package/dist/generate.cjs CHANGED
@@ -108,7 +108,7 @@ var getEventCatalogConfigFile = async (projectDirectory) => {
108
108
  var import_picocolors = __toESM(require("picocolors"), 1);
109
109
 
110
110
  // package.json
111
- var version = "4.0.6";
111
+ var version = "4.1.0";
112
112
 
113
113
  // src/constants.ts
114
114
  var VERSION = version;
package/dist/generate.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  generate
3
- } from "./chunk-7443A7LZ.js";
4
- import "./chunk-ZXAF4JO7.js";
5
- import "./chunk-Z7BGWB5J.js";
3
+ } from "./chunk-2PPDVKNK.js";
4
+ import "./chunk-RXZKZGDC.js";
5
+ import "./chunk-OQ36RUHT.js";
6
6
  import "./chunk-6QENHZZP.js";
7
7
  export {
8
8
  generate
@@ -34,6 +34,7 @@ __export(map_catalog_to_astro_exports, {
34
34
  });
35
35
  module.exports = __toCommonJS(map_catalog_to_astro_exports);
36
36
  var import_node_path = __toESM(require("path"), 1);
37
+ var CUSTOM_PAGE_EXTENSIONS = [".astro", ".ts", ".js", ".mjs"];
37
38
  var COLLECTION_KEYS = [
38
39
  "agents",
39
40
  "events",
@@ -56,6 +57,10 @@ function mapCatalogToAstro({ filePath, astroDir, projectDir }) {
56
57
  if (!isCatalogRelated(relativeFilePath)) {
57
58
  return [];
58
59
  }
60
+ const customPageTargetPaths = getCustomPageTargetPaths(relativeFilePath, astroDir);
61
+ if (customPageTargetPaths) {
62
+ return customPageTargetPaths;
63
+ }
59
64
  const baseTargetPaths = getBaseTargetPaths(relativeFilePath);
60
65
  const relativeTargetPath = getRelativeTargetPath(relativeFilePath);
61
66
  return baseTargetPaths.map((base) => import_node_path.default.join(astroDir, base, relativeTargetPath));
@@ -70,6 +75,21 @@ function isCollectionKey(key) {
70
75
  function isLikeC4Source(filePath) {
71
76
  return filePath.endsWith(".c4") || filePath.endsWith(".likec4");
72
77
  }
78
+ var hasExtension = (str) => /\.[a-zA-Z0-9]{2,}$/.test(str);
79
+ function getCustomPageTargetPaths(filePath, astroDir) {
80
+ const filePathArr = filePath.split(import_node_path.default.sep).filter(Boolean);
81
+ if (filePathArr[0] !== "pages") {
82
+ return null;
83
+ }
84
+ const customPagePath = import_node_path.default.join(astroDir, "src", "custom-pages", ...filePathArr.slice(1));
85
+ if (CUSTOM_PAGE_EXTENSIONS.includes(import_node_path.default.extname(filePath).toLowerCase())) {
86
+ return [customPagePath];
87
+ }
88
+ if (!hasExtension(filePath)) {
89
+ return [customPagePath, import_node_path.default.join(astroDir, "public", "generated", ...filePathArr)];
90
+ }
91
+ return [import_node_path.default.join(astroDir, "public", "generated", ...filePathArr)];
92
+ }
73
93
  function isCatalogRelated(filePath) {
74
94
  const filePathArr = filePath.split(import_node_path.default.sep).filter(Boolean);
75
95
  if ([
@@ -94,7 +114,6 @@ function isCatalogRelated(filePath) {
94
114
  function getBaseTargetPaths(filePath) {
95
115
  const filePathArr = filePath.split(import_node_path.default.sep).filter(Boolean);
96
116
  if (isCollectionKey(filePathArr[0])) {
97
- const hasExtension = (str) => /\.[a-zA-Z0-9]{2,}$/.test(str);
98
117
  if (hasExtension(filePath)) {
99
118
  return [import_node_path.default.join("public", "generated")];
100
119
  }
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  mapCatalogToAstro
3
- } from "./chunk-VC6VUJIX.js";
3
+ } from "./chunk-W5JQON7Z.js";
4
4
  export {
5
5
  mapCatalogToAstro
6
6
  };
@@ -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 = "4.0.6";
39
+ var version = "4.1.0";
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-ZXAF4JO7.js";
4
- import "../chunk-Z7BGWB5J.js";
3
+ } from "../chunk-RXZKZGDC.js";
4
+ import "../chunk-OQ36RUHT.js";
5
5
  export {
6
6
  logger
7
7
  };
package/dist/watcher.cjs CHANGED
@@ -38,6 +38,7 @@ var import_node_fs = __toESM(require("fs"), 1);
38
38
 
39
39
  // src/map-catalog-to-astro.js
40
40
  var import_node_path = __toESM(require("path"), 1);
41
+ var CUSTOM_PAGE_EXTENSIONS = [".astro", ".ts", ".js", ".mjs"];
41
42
  var COLLECTION_KEYS = [
42
43
  "agents",
43
44
  "events",
@@ -60,6 +61,10 @@ function mapCatalogToAstro({ filePath, astroDir, projectDir }) {
60
61
  if (!isCatalogRelated(relativeFilePath)) {
61
62
  return [];
62
63
  }
64
+ const customPageTargetPaths = getCustomPageTargetPaths(relativeFilePath, astroDir);
65
+ if (customPageTargetPaths) {
66
+ return customPageTargetPaths;
67
+ }
63
68
  const baseTargetPaths = getBaseTargetPaths(relativeFilePath);
64
69
  const relativeTargetPath = getRelativeTargetPath(relativeFilePath);
65
70
  return baseTargetPaths.map((base) => import_node_path.default.join(astroDir, base, relativeTargetPath));
@@ -74,6 +79,21 @@ function isCollectionKey(key) {
74
79
  function isLikeC4Source(filePath) {
75
80
  return filePath.endsWith(".c4") || filePath.endsWith(".likec4");
76
81
  }
82
+ var hasExtension = (str) => /\.[a-zA-Z0-9]{2,}$/.test(str);
83
+ function getCustomPageTargetPaths(filePath, astroDir) {
84
+ const filePathArr = filePath.split(import_node_path.default.sep).filter(Boolean);
85
+ if (filePathArr[0] !== "pages") {
86
+ return null;
87
+ }
88
+ const customPagePath = import_node_path.default.join(astroDir, "src", "custom-pages", ...filePathArr.slice(1));
89
+ if (CUSTOM_PAGE_EXTENSIONS.includes(import_node_path.default.extname(filePath).toLowerCase())) {
90
+ return [customPagePath];
91
+ }
92
+ if (!hasExtension(filePath)) {
93
+ return [customPagePath, import_node_path.default.join(astroDir, "public", "generated", ...filePathArr)];
94
+ }
95
+ return [import_node_path.default.join(astroDir, "public", "generated", ...filePathArr)];
96
+ }
77
97
  function isCatalogRelated(filePath) {
78
98
  const filePathArr = filePath.split(import_node_path.default.sep).filter(Boolean);
79
99
  if ([
@@ -98,7 +118,6 @@ function isCatalogRelated(filePath) {
98
118
  function getBaseTargetPaths(filePath) {
99
119
  const filePathArr = filePath.split(import_node_path.default.sep).filter(Boolean);
100
120
  if (isCollectionKey(filePathArr[0])) {
101
- const hasExtension = (str) => /\.[a-zA-Z0-9]{2,}$/.test(str);
102
121
  if (hasExtension(filePath)) {
103
122
  return [import_node_path.default.join("public", "generated")];
104
123
  }
package/dist/watcher.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  watch
3
- } from "./chunk-O3Y2G6CY.js";
4
- import "./chunk-VC6VUJIX.js";
3
+ } from "./chunk-CAJUIMDJ.js";
4
+ import "./chunk-W5JQON7Z.js";
5
5
  export {
6
6
  watch
7
7
  };
@@ -1,12 +1,14 @@
1
1
  import { useEffect, useRef, useCallback, useState, useMemo, memo } from 'react';
2
2
  import { X, Square, Trash2, BookOpen, Copy, Check, Maximize2, Minimize2, Wrench, ChevronDown, MessageSquare } from 'lucide-react';
3
3
  import { useChat } from '@ai-sdk/react';
4
+ import { DefaultChatTransport } from 'ai';
4
5
  import ReactMarkdown from 'react-markdown';
5
6
  import remarkGfm from 'remark-gfm';
6
7
  import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter';
7
8
  import { oneDark } from 'react-syntax-highlighter/dist/cjs/styles/prism';
8
9
  import * as Dialog from '@radix-ui/react-dialog';
9
10
  import * as Popover from '@radix-ui/react-popover';
11
+ import { buildUrl } from '@utils/url-builder';
10
12
 
11
13
  interface ToolMetadata {
12
14
  name: string;
@@ -527,6 +529,8 @@ const ChatPanel = ({ isOpen, onClose }: ChatPanelProps) => {
527
529
  const [isFullscreen, setIsFullscreen] = useState(false);
528
530
  const [tools, setTools] = useState<ToolMetadata[]>([]);
529
531
  const [showScrollButton, setShowScrollButton] = useState(false);
532
+ const chatApiUrl = useMemo(() => buildUrl('/api/chat', true), []);
533
+ const chatTransport = useMemo(() => new DefaultChatTransport({ api: chatApiUrl }), [chatApiUrl]);
530
534
 
531
535
  // Sort tools with custom ones first
532
536
  const sortedTools = useMemo(() => {
@@ -540,7 +544,7 @@ const ChatPanel = ({ isOpen, onClose }: ChatPanelProps) => {
540
544
  // Fetch available tools when panel opens
541
545
  useEffect(() => {
542
546
  if (isOpen && tools.length === 0) {
543
- fetch('/api/chat')
547
+ fetch(chatApiUrl)
544
548
  .then((res) => res.json())
545
549
  .then((data) => {
546
550
  if (data.tools) {
@@ -597,7 +601,7 @@ const ChatPanel = ({ isOpen, onClose }: ChatPanelProps) => {
597
601
  setShowScrollButton(!isNearBottom);
598
602
  }, []);
599
603
 
600
- const { messages, sendMessage, stop, status, setMessages, error } = useChat();
604
+ const { messages, sendMessage, stop, status, setMessages, error } = useChat({ transport: chatTransport });
601
605
 
602
606
  // Extract user-friendly error message
603
607
  const errorMessage = error?.message || 'Something went wrong. Please try again.';