@eventcatalog/core 5.0.0-beta.27 → 5.0.0-beta.29

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 (48) 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 +57 -3
  4. package/dist/analytics/log-build.d.cts +2 -2
  5. package/dist/analytics/log-build.d.ts +2 -2
  6. package/dist/analytics/log-build.js +5 -4
  7. package/dist/analytics/studio-usage.cjs +90 -0
  8. package/dist/analytics/studio-usage.d.cts +5 -0
  9. package/dist/analytics/studio-usage.d.ts +5 -0
  10. package/dist/analytics/studio-usage.js +10 -0
  11. package/dist/{chunk-ILPH363P.js → chunk-34VU2X7H.js} +1 -1
  12. package/dist/{chunk-I6CBMGUM.js → chunk-3RDV4HXA.js} +1 -1
  13. package/dist/{chunk-P5IFIKG6.js → chunk-4IREUUHE.js} +12 -4
  14. package/dist/{chunk-AWOO63ME.js → chunk-AD7CL772.js} +11 -4
  15. package/dist/{chunk-EFBDR7JJ.js → chunk-B4OOUG5I.js} +1 -1
  16. package/dist/chunk-CA6WCQ2T.js +54 -0
  17. package/dist/{chunk-QJ7KKN2D.js → chunk-OX6TSVHY.js} +1 -1
  18. package/dist/{chunk-YGUOLT7F.js → chunk-ZK7Q7XDV.js} +1 -1
  19. package/dist/constants.cjs +1 -1
  20. package/dist/constants.js +1 -1
  21. package/dist/eventcatalog.cjs +246 -186
  22. package/dist/eventcatalog.js +12 -10
  23. package/dist/federation/federate.js +3 -3
  24. package/dist/federation/source-provider.js +2 -2
  25. package/dist/generate.cjs +1 -1
  26. package/dist/generate.js +3 -3
  27. package/dist/utils/cli-logger.cjs +1 -1
  28. package/dist/utils/cli-logger.js +2 -2
  29. package/dist/utils/license-status.cjs +11 -4
  30. package/dist/utils/license-status.d.cts +3 -2
  31. package/dist/utils/license-status.d.ts +3 -2
  32. package/dist/utils/license-status.js +1 -1
  33. package/eventcatalog/src/components/MDX/NodeGraph/AstroNodeGraph.tsx +19 -2
  34. package/eventcatalog/src/components/Settings/AssistantSettingsForm.tsx +53 -48
  35. package/eventcatalog/src/components/Settings/GeneralSettingsForm.tsx +183 -178
  36. package/eventcatalog/src/components/Settings/LicenseSettings.tsx +140 -31
  37. package/eventcatalog/src/components/Settings/LlmAccessSettingsForm.tsx +40 -35
  38. package/eventcatalog/src/components/Settings/LogoUpload.tsx +1 -1
  39. package/eventcatalog/src/components/Settings/McpSettingsForm.tsx +9 -8
  40. package/eventcatalog/src/components/Settings/Row.tsx +7 -4
  41. package/eventcatalog/src/components/Settings/SettingsShared.tsx +3 -3
  42. package/eventcatalog/src/components/TrialBadge.astro +20 -9
  43. package/eventcatalog/src/layouts/SettingsLayout.astro +2 -2
  44. package/eventcatalog/src/pages/settings/license.astro +9 -1
  45. package/eventcatalog/src/utils/license.ts +1 -1
  46. package/eventcatalog/src/utils/trial.ts +13 -0
  47. package/package.json +3 -3
  48. package/dist/{chunk-A2RZR3U4.js → chunk-6K7XZAYI.js} +3 -3
@@ -29,10 +29,10 @@ var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
29
29
  // src/eventcatalog.ts
30
30
  var import_commander = require("commander");
31
31
  var import_node_child_process2 = require("child_process");
32
- var import_node_path20 = require("path");
32
+ var import_node_path21 = require("path");
33
33
  var import_node_http = __toESM(require("http"), 1);
34
34
  var import_fs = __toESM(require("fs"), 1);
35
- var import_node_path21 = __toESM(require("path"), 1);
35
+ var import_node_path22 = __toESM(require("path"), 1);
36
36
  var import_node_url2 = require("url");
37
37
  var import_node_module3 = require("module");
38
38
 
@@ -174,7 +174,7 @@ var verifyRequiredFieldsAreInCatalogConfigFile = async (projectDirectory) => {
174
174
  var import_picocolors = __toESM(require("picocolors"), 1);
175
175
 
176
176
  // package.json
177
- var version = "5.0.0-beta.27";
177
+ var version = "5.0.0-beta.29";
178
178
 
179
179
  // src/constants.ts
180
180
  var VERSION = version;
@@ -422,6 +422,9 @@ var import_license2 = require("@eventcatalog/license");
422
422
  var TRIAL_LENGTH_DAYS = 60;
423
423
  var LICENSE_FAQ_URL = "https://www.eventcatalog.dev/license-faq";
424
424
  var LICENSE_RENEW_URL = "https://eventcatalog.cloud";
425
+ var BUY_BUSINESS_URL = "https://www.eventcatalog.dev/buy?source=cli";
426
+ var PRICING_URL = "https://www.eventcatalog.dev/pricing";
427
+ var FREE_USE_NOTE = "Under $10M revenue and $10M raised, an individual or an open-source project? You qualify for Free Use; get a free key at eventcatalog.cloud.";
425
428
  var DAY_IN_MS = 24 * 60 * 60 * 1e3;
426
429
  var getTrialStatus = (tsd, now = Date.now()) => {
427
430
  if (typeof tsd !== "number" || !Number.isFinite(tsd) || tsd <= 0) return;
@@ -540,15 +543,17 @@ var formatDate = (date) => date.toLocaleDateString(void 0, { dateStyle: "medium"
540
543
  var formatDays = (days) => `${days} ${days === 1 ? "day" : "days"}`;
541
544
  var PLAIN = { bold: (text) => text, dim: (text) => text, link: (text) => text };
542
545
  var COLOURS = { bold: import_picocolors2.default.bold, dim: import_picocolors2.default.dim, link: (text) => import_picocolors2.default.cyan(text) };
543
- var render = ({ headline, rows, links }, colours) => {
546
+ var render = ({ headline, rows, links, note }, colours) => {
544
547
  const width = Math.max(0, ...[...rows, ...links].map(([label]) => label.length));
545
548
  const row = ([label, value]) => `${colours.dim(label.padEnd(width))} ${value}`;
546
549
  return [
547
550
  colours.bold(headline),
548
551
  ...rows.length ? ["", ...rows.map(row)] : [],
549
- ...links.length ? ["", ...links.map(([label, url]) => row([label, colours.link(url)]))] : []
552
+ ...links.length ? ["", ...links.map(([label, url]) => row([label, colours.link(url)]))] : [],
553
+ ...note?.length ? ["", ...note.map(colours.dim)] : []
550
554
  ].join("\n");
551
555
  };
556
+ var FREE_USE_LINES = FREE_USE_NOTE.split(/(?<=\?) /);
552
557
  var message = (content) => ({
553
558
  ...content,
554
559
  text: render(content, PLAIN)
@@ -595,7 +600,8 @@ var getLicenseStatusMessage = (license, tsd, now = Date.now()) => {
595
600
  color: trial.ended ? "yellow" : "green",
596
601
  headline: trial.ended ? "Your EventCatalog trial has ended" : `You're on the ${TRIAL_LENGTH_DAYS}-day EventCatalog trial`,
597
602
  rows: trialRows,
598
- links: trial.ended ? [["Get a license", LICENSE_RENEW_URL], licensing] : [licensing]
603
+ links: trial.ended ? [["Get a license", LICENSE_RENEW_URL], ["Buy Business", BUY_BUSINESS_URL], licensing] : [["Buy a license", PRICING_URL], licensing],
604
+ note: trial.ended ? FREE_USE_LINES : void 0
599
605
  });
600
606
  }
601
607
  if (license.state === "expired") {
@@ -609,7 +615,8 @@ var getLicenseStatusMessage = (license, tsd, now = Date.now()) => {
609
615
  title: "EventCatalog license",
610
616
  color: "yellow",
611
617
  headline: "Your commercial license has expired",
612
- rows: [...licensedTo, ...expiredOn, ...trialRows],
618
+ // A catalog has a license or is on the trial: an expired license is renewed, not replaced by the trial
619
+ rows: [...licensedTo, ...expiredOn],
613
620
  links: [renew, licensing]
614
621
  });
615
622
  }
@@ -636,6 +643,55 @@ var printLicenseStatus = (license, tsd) => {
636
643
  );
637
644
  };
638
645
 
646
+ // src/analytics/studio-usage.js
647
+ var import_node_fs3 = __toESM(require("fs"), 1);
648
+ var import_node_path6 = __toESM(require("path"), 1);
649
+ var DAY_IN_MS3 = 24 * 60 * 60 * 1e3;
650
+ var DEFAULT_DATABASE_PATH = ".eventcatalog/eventcatalog.db";
651
+ var getStudioMode = (configFile) => {
652
+ const enabled = configFile.studio?.enabled;
653
+ if (enabled === false) return "off";
654
+ return configFile.output === "server" && enabled === true ? "server" : "dev";
655
+ };
656
+ var getStorageType = (configFile) => configFile.storage?.type || "memory";
657
+ var loadSqlite = () => {
658
+ const emitWarning = process.emitWarning;
659
+ process.emitWarning = function(warning, ...args) {
660
+ const type = typeof args[0] === "object" ? args[0]?.type : args[0];
661
+ const message2 = typeof warning === "string" ? warning : warning?.message;
662
+ if (type === "ExperimentalWarning" && message2?.startsWith("SQLite")) return;
663
+ return emitWarning.call(this, warning, ...args);
664
+ };
665
+ try {
666
+ return process.getBuiltinModule?.("node:sqlite");
667
+ } catch {
668
+ return void 0;
669
+ } finally {
670
+ process.emitWarning = emitWarning;
671
+ }
672
+ };
673
+ var UNKNOWN = "canvases:unknown";
674
+ var serializeStudioUsage = (projectDirectory, configFile, now = Date.now()) => {
675
+ if (getStudioMode(configFile) === "off" || getStorageType(configFile) !== "sqlite") return UNKNOWN;
676
+ const file = import_node_path6.default.resolve(projectDirectory, configFile.storage.path ?? DEFAULT_DATABASE_PATH);
677
+ if (!import_node_fs3.default.existsSync(file)) return "canvases:0,changed7d:0,changed30d:0,deleted:0";
678
+ let database;
679
+ try {
680
+ const sqlite = loadSqlite();
681
+ if (!sqlite?.DatabaseSync) return UNKNOWN;
682
+ database = new sqlite.DatabaseSync(file, { readOnly: true });
683
+ const canvases = database.prepare(
684
+ "SELECT COUNT(*) AS total, SUM(updated_at >= ?) AS changed7d, SUM(updated_at >= ?) AS changed30d FROM studio_canvases"
685
+ ).get(now - 7 * DAY_IN_MS3, now - 30 * DAY_IN_MS3);
686
+ const { deleted } = database.prepare("SELECT COUNT(*) AS deleted FROM studio_deleted_canvases").get();
687
+ return `canvases:${canvases.total},changed7d:${canvases.changed7d ?? 0},changed30d:${canvases.changed30d ?? 0},deleted:${deleted}`;
688
+ } catch {
689
+ return UNKNOWN;
690
+ } finally {
691
+ database?.close();
692
+ }
693
+ };
694
+
639
695
  // src/analytics/log-build.js
640
696
  var isMCPEnabled = (configFile) => configFile.output === "server" && (configFile.mcp?.enabled ?? true);
641
697
  var getFeatures = async (configFile) => {
@@ -649,7 +705,9 @@ var getFeatures = async (configFile) => {
649
705
  environments: Array.isArray(configFile.environments) && configFile.environments.length > 0,
650
706
  output: configFile.output || "static",
651
707
  mcp,
652
- mcpAuth: mcp && (configFile.mcp?.auth?.enabled ?? false)
708
+ mcpAuth: mcp && (configFile.mcp?.auth?.enabled ?? false),
709
+ studio: getStudioMode(configFile),
710
+ storage: getStorageType(configFile)
653
711
  };
654
712
  };
655
713
  var getDirectoryProvider = (source) => {
@@ -750,7 +808,8 @@ var main = async (projectDir, { command = "build", license } = {}) => {
750
808
  generators: generatorNames.toString(),
751
809
  features: Object.keys(features).map((feature) => `${feature}:${features[feature]}`).join(","),
752
810
  directorySources: serializeDirectorySources(configFile),
753
- resources: serializeCounts(resourceCounts)
811
+ resources: serializeCounts(resourceCounts),
812
+ studio: serializeStudioUsage(projectDir, configFile)
754
813
  },
755
814
  configFile
756
815
  );
@@ -771,8 +830,8 @@ async function watch(projectDirectory, catalogDirectory, callback = () => {
771
830
  }
772
831
 
773
832
  // src/resolve-catalog-dependencies.js
774
- var import_node_path6 = __toESM(require("path"), 1);
775
- var import_node_fs3 = __toESM(require("fs"), 1);
833
+ var import_node_path7 = __toESM(require("path"), 1);
834
+ var import_node_fs4 = __toESM(require("fs"), 1);
776
835
  var import_gray_matter2 = __toESM(require("gray-matter"), 1);
777
836
  var resolve_catalog_dependencies_default = async (catalogDir, core2) => {
778
837
  const catalogConfig = await getEventCatalogConfigFile(catalogDir);
@@ -780,11 +839,11 @@ var resolve_catalog_dependencies_default = async (catalogDir, core2) => {
780
839
  if (!dependencies) {
781
840
  return;
782
841
  }
783
- const dependenciesDir = import_node_path6.default.join(catalogDir, "dependencies");
784
- if (import_node_fs3.default.existsSync(dependenciesDir)) {
785
- import_node_fs3.default.rmSync(dependenciesDir, { recursive: true, force: true });
842
+ const dependenciesDir = import_node_path7.default.join(catalogDir, "dependencies");
843
+ if (import_node_fs4.default.existsSync(dependenciesDir)) {
844
+ import_node_fs4.default.rmSync(dependenciesDir, { recursive: true, force: true });
786
845
  }
787
- import_node_fs3.default.mkdirSync(dependenciesDir, { recursive: true });
846
+ import_node_fs4.default.mkdirSync(dependenciesDir, { recursive: true });
788
847
  const resourceTypes = Object.keys(dependencies);
789
848
  for (const resourceType of resourceTypes) {
790
849
  for (const dependency of dependencies[resourceType]) {
@@ -804,9 +863,9 @@ var resolve_catalog_dependencies_default = async (catalogDir, core2) => {
804
863
  },
805
864
  frontmatter
806
865
  );
807
- const resourceFile = import_node_path6.default.join(dependenciesDir, resourceType, dependency.id, `index.md`);
808
- import_node_fs3.default.mkdirSync(import_node_path6.default.dirname(resourceFile), { recursive: true });
809
- import_node_fs3.default.writeFileSync(resourceFile, markdown);
866
+ const resourceFile = import_node_path7.default.join(dependenciesDir, resourceType, dependency.id, `index.md`);
867
+ import_node_fs4.default.mkdirSync(import_node_path7.default.dirname(resourceFile), { recursive: true });
868
+ import_node_fs4.default.writeFileSync(resourceFile, markdown);
810
869
  }
811
870
  }
812
871
  return;
@@ -816,8 +875,8 @@ var resolve_catalog_dependencies_default = async (catalogDir, core2) => {
816
875
  var import_boxen2 = __toESM(require("boxen"), 1);
817
876
 
818
877
  // src/features.ts
819
- var import_node_path7 = require("path");
820
- var import_node_fs4 = __toESM(require("fs"), 1);
878
+ var import_node_path8 = require("path");
879
+ var import_node_fs5 = __toESM(require("fs"), 1);
821
880
  var getProjectOutDir = async () => {
822
881
  const config = await getEventCatalogConfigFile(process.env.PROJECT_DIR || "");
823
882
  return config?.outDir || "dist";
@@ -832,7 +891,7 @@ var isIndexedSearchEnabled = async () => {
832
891
  };
833
892
  var isAuthEnabled = async () => {
834
893
  const directory = process.env.PROJECT_DIR || process.cwd();
835
- const hasAuthConfig = import_node_fs4.default.existsSync((0, import_node_path7.join)(directory, "eventcatalog.auth.js"));
894
+ const hasAuthConfig = import_node_fs5.default.existsSync((0, import_node_path8.join)(directory, "eventcatalog.auth.js"));
836
895
  return hasAuthConfig;
837
896
  };
838
897
 
@@ -841,11 +900,11 @@ var import_update_notifier = __toESM(require("update-notifier"), 1);
841
900
  var import_dotenv = __toESM(require("dotenv"), 1);
842
901
 
843
902
  // src/migrations/message-channels-to-service-channels.ts
844
- var import_node_fs5 = __toESM(require("fs"), 1);
903
+ var import_node_fs6 = __toESM(require("fs"), 1);
845
904
  var import_glob2 = require("glob");
846
905
  var import_node_os = __toESM(require("os"), 1);
847
906
  var import_gray_matter3 = __toESM(require("gray-matter"), 1);
848
- var import_node_path8 = __toESM(require("path"), 1);
907
+ var import_node_path9 = __toESM(require("path"), 1);
849
908
  var DISABLE_CHANNEL_MIGRATION_ENV = "EVENTCATALOG_DISABLE_CHANNEL_MIGRATION";
850
909
  var isChannelMigrationDisabled = () => {
851
910
  return ["true", "1", "yes"].includes((process.env[DISABLE_CHANNEL_MIGRATION_ENV] ?? "").toLowerCase());
@@ -854,7 +913,7 @@ var message_channels_to_service_channels_default = async (dir2) => {
854
913
  if (isChannelMigrationDisabled()) {
855
914
  return { status: "skipped", message: `Channel migration disabled by ${DISABLE_CHANNEL_MIGRATION_ENV}` };
856
915
  }
857
- const PROJECT_DIR = import_node_path8.default.join(dir2 || process.env.PROJECT_DIR);
916
+ const PROJECT_DIR = import_node_path9.default.join(dir2 || process.env.PROJECT_DIR);
858
917
  const messages = await (0, import_glob2.glob)(
859
918
  [
860
919
  "**/events/*/index.mdx",
@@ -894,7 +953,7 @@ var message_channels_to_service_channels_default = async (dir2) => {
894
953
  }
895
954
  );
896
955
  const messagesWithChannels = messages.reduce((acc, message2) => {
897
- const file = import_node_fs5.default.readFileSync(message2, "utf8");
956
+ const file = import_node_fs6.default.readFileSync(message2, "utf8");
898
957
  const { data } = (0, import_gray_matter3.default)(file);
899
958
  if (data.channels?.length > 0) {
900
959
  acc.push({
@@ -908,7 +967,7 @@ var message_channels_to_service_channels_default = async (dir2) => {
908
967
  return { status: "success", message: "No messages with channels found in the catalog" };
909
968
  }
910
969
  const servicesWithChannels = services.reduce((acc, service) => {
911
- const file = import_node_fs5.default.readFileSync(service, "utf8");
970
+ const file = import_node_fs6.default.readFileSync(service, "utf8");
912
971
  const { data } = (0, import_gray_matter3.default)(file);
913
972
  const isSending = data.sends?.some((send) => messagesWithChannels.some((message2) => message2.id === send.id));
914
973
  const isReceiving = data.receives?.some(
@@ -923,7 +982,7 @@ var message_channels_to_service_channels_default = async (dir2) => {
923
982
  return acc;
924
983
  }, []);
925
984
  for (const service of servicesWithChannels) {
926
- const file = import_node_fs5.default.readFileSync(service.path, "utf8");
985
+ const file = import_node_fs6.default.readFileSync(service.path, "utf8");
927
986
  const { data } = (0, import_gray_matter3.default)(file);
928
987
  const messagesTheServiceSendsThatNeedUpdating = data.sends?.filter((send) => messagesWithChannels.some((message2) => message2.id === send.id)) ?? [];
929
988
  const messagesTheServiceReceivesThatNeedUpdating = data.receives?.filter((receive) => messagesWithChannels.some((message2) => message2.id === receive.id)) ?? [];
@@ -943,14 +1002,14 @@ var message_channels_to_service_channels_default = async (dir2) => {
943
1002
  ...newSends.length > 0 ? { sends: newSends } : {},
944
1003
  ...newReceives.length > 0 ? { receives: newReceives } : {}
945
1004
  };
946
- import_node_fs5.default.writeFileSync(service.path, import_gray_matter3.default.stringify(file, newData));
1005
+ import_node_fs6.default.writeFileSync(service.path, import_gray_matter3.default.stringify(file, newData));
947
1006
  }
948
1007
  }
949
1008
  for (const message2 of messagesWithChannels) {
950
- const file = import_node_fs5.default.readFileSync(message2.path, "utf8");
1009
+ const file = import_node_fs6.default.readFileSync(message2.path, "utf8");
951
1010
  const parsed = (0, import_gray_matter3.default)(file);
952
1011
  const { channels, ...newData } = parsed.data;
953
- import_node_fs5.default.writeFileSync(message2.path, import_gray_matter3.default.stringify(parsed.content, newData));
1012
+ import_node_fs6.default.writeFileSync(message2.path, import_gray_matter3.default.stringify(parsed.content, newData));
954
1013
  }
955
1014
  console.log("\u2714 Channels migrated to new services API");
956
1015
  };
@@ -987,12 +1046,12 @@ var stopChildWithParent = (child, parent = process) => {
987
1046
  };
988
1047
 
989
1048
  // eventcatalog/src/features/fields/field-indexer.ts
990
- var import_node_path10 = __toESM(require("path"), 1);
991
- var import_node_fs7 = __toESM(require("fs"), 1);
1049
+ var import_node_path11 = __toESM(require("path"), 1);
1050
+ var import_node_fs8 = __toESM(require("fs"), 1);
992
1051
 
993
1052
  // eventcatalog/src/features/fields/fields-db.ts
994
1053
  var import_sql = __toESM(require("sql.js"), 1);
995
- var import_node_fs6 = __toESM(require("fs"), 1);
1054
+ var import_node_fs7 = __toESM(require("fs"), 1);
996
1055
  var SCHEMA_SQL = `
997
1056
  CREATE TABLE IF NOT EXISTS fields (
998
1057
  id INTEGER PRIMARY KEY AUTOINCREMENT,
@@ -1061,13 +1120,13 @@ var FieldsDatabase = class _FieldsDatabase {
1061
1120
  this.dbPath = dbPath;
1062
1121
  }
1063
1122
  static async create(dbPath, options) {
1064
- if (options?.recreate && import_node_fs6.default.existsSync(dbPath)) {
1065
- import_node_fs6.default.unlinkSync(dbPath);
1123
+ if (options?.recreate && import_node_fs7.default.existsSync(dbPath)) {
1124
+ import_node_fs7.default.unlinkSync(dbPath);
1066
1125
  }
1067
1126
  const SQL = await (0, import_sql.default)();
1068
1127
  let db;
1069
- if (!options?.recreate && import_node_fs6.default.existsSync(dbPath)) {
1070
- const buffer = import_node_fs6.default.readFileSync(dbPath);
1128
+ if (!options?.recreate && import_node_fs7.default.existsSync(dbPath)) {
1129
+ const buffer = import_node_fs7.default.readFileSync(dbPath);
1071
1130
  db = new SQL.Database(buffer);
1072
1131
  } else {
1073
1132
  db = new SQL.Database();
@@ -1128,7 +1187,7 @@ var FieldsDatabase = class _FieldsDatabase {
1128
1187
  save() {
1129
1188
  const data = this.db.export();
1130
1189
  const buffer = Buffer.from(data);
1131
- import_node_fs6.default.writeFileSync(this.dbPath, buffer);
1190
+ import_node_fs7.default.writeFileSync(this.dbPath, buffer);
1132
1191
  }
1133
1192
  queryFields(params) {
1134
1193
  const {
@@ -1353,22 +1412,22 @@ function getAvroTypeName(type) {
1353
1412
  function walkAvroRecord(schema, prefix, fields) {
1354
1413
  if (!schema.fields || !Array.isArray(schema.fields)) return;
1355
1414
  for (const field of schema.fields) {
1356
- const path20 = prefix ? `${prefix}.${field.name}` : field.name;
1415
+ const path21 = prefix ? `${prefix}.${field.name}` : field.name;
1357
1416
  const isOptional = Array.isArray(field.type) && field.type.includes("null");
1358
1417
  const typeName = getAvroTypeName(field.type);
1359
1418
  fields.push({
1360
- path: path20,
1419
+ path: path21,
1361
1420
  type: typeName,
1362
1421
  description: field.doc || "",
1363
1422
  required: !isOptional
1364
1423
  });
1365
1424
  const innerType = Array.isArray(field.type) ? field.type.find((t) => typeof t === "object" && t.type === "record") : typeof field.type === "object" && field.type.type === "record" ? field.type : null;
1366
1425
  if (innerType) {
1367
- walkAvroRecord(innerType, path20, fields);
1426
+ walkAvroRecord(innerType, path21, fields);
1368
1427
  }
1369
1428
  const arrayType = Array.isArray(field.type) ? field.type.find((t) => typeof t === "object" && t.type === "array") : typeof field.type === "object" && field.type.type === "array" ? field.type : null;
1370
1429
  if (arrayType && typeof arrayType.items === "object" && arrayType.items.type === "record") {
1371
- walkAvroRecord(arrayType.items, `${path20}[]`, fields);
1430
+ walkAvroRecord(arrayType.items, `${path21}[]`, fields);
1372
1431
  }
1373
1432
  }
1374
1433
  }
@@ -1399,32 +1458,32 @@ function walkJsonSchema(node, prefix, requiredList, rootSchema, fields) {
1399
1458
  }
1400
1459
  if (!node.properties) return;
1401
1460
  for (const [name, prop] of Object.entries(node.properties)) {
1402
- const path20 = prefix ? `${prefix}.${name}` : name;
1461
+ const path21 = prefix ? `${prefix}.${name}` : name;
1403
1462
  const isRequired = requiredList.includes(name);
1404
1463
  if (prop.$ref) {
1405
1464
  const resolved = resolveLocalRef(prop.$ref, rootSchema);
1406
1465
  if (resolved) {
1407
1466
  const rawRefType = resolved.type || "object";
1408
1467
  const type2 = Array.isArray(rawRefType) ? [...rawRefType].sort().join(" | ") : rawRefType;
1409
- fields.push({ path: path20, type: type2, description: resolved.description || "", required: isRequired });
1468
+ fields.push({ path: path21, type: type2, description: resolved.description || "", required: isRequired });
1410
1469
  if (resolved.properties) {
1411
- walkJsonSchema(resolved, path20, resolved.required || [], rootSchema, fields);
1470
+ walkJsonSchema(resolved, path21, resolved.required || [], rootSchema, fields);
1412
1471
  }
1413
1472
  } else {
1414
- fields.push({ path: path20, type: "$ref", description: "", required: isRequired });
1473
+ fields.push({ path: path21, type: "$ref", description: "", required: isRequired });
1415
1474
  }
1416
1475
  continue;
1417
1476
  }
1418
1477
  const rawType = prop.type || (prop.enum ? "enum" : prop.$ref ? "$ref" : "object");
1419
1478
  const typeList = Array.isArray(rawType) ? rawType : [rawType];
1420
1479
  const type = Array.isArray(rawType) ? [...rawType].sort().join(" | ") : rawType;
1421
- fields.push({ path: path20, type, description: prop.description || "", required: isRequired });
1480
+ fields.push({ path: path21, type, description: prop.description || "", required: isRequired });
1422
1481
  if (typeList.includes("object") && prop.properties) {
1423
- walkJsonSchema(prop, path20, prop.required || [], rootSchema, fields);
1482
+ walkJsonSchema(prop, path21, prop.required || [], rootSchema, fields);
1424
1483
  }
1425
1484
  if (typeList.includes("array") && prop.items) {
1426
1485
  if (prop.items.type === "object" && prop.items.properties) {
1427
- walkJsonSchema(prop.items, `${path20}[]`, prop.items.required || [], rootSchema, fields);
1486
+ walkJsonSchema(prop.items, `${path21}[]`, prop.items.required || [], rootSchema, fields);
1428
1487
  }
1429
1488
  }
1430
1489
  }
@@ -1441,22 +1500,22 @@ function resolveLocalRef(ref, rootSchema) {
1441
1500
  }
1442
1501
 
1443
1502
  // eventcatalog/integrations/runtime-paths.mjs
1444
- var import_node_path9 = __toESM(require("path"), 1);
1503
+ var import_node_path10 = __toESM(require("path"), 1);
1445
1504
  function getRuntimePaths(projectDirectory, runtimeDirectory) {
1446
- const project = import_node_path9.default.resolve(projectDirectory);
1447
- const cacheDirectory = import_node_path9.default.join(project, ".astro");
1448
- const runtime = runtimeDirectory ? import_node_path9.default.resolve(runtimeDirectory) : import_node_path9.default.join(cacheDirectory, "eventcatalog");
1505
+ const project = import_node_path10.default.resolve(projectDirectory);
1506
+ const cacheDirectory = import_node_path10.default.join(project, ".astro");
1507
+ const runtime = runtimeDirectory ? import_node_path10.default.resolve(runtimeDirectory) : import_node_path10.default.join(cacheDirectory, "eventcatalog");
1449
1508
  return {
1450
1509
  projectDirectory: project,
1451
1510
  cacheDirectory,
1452
1511
  runtimeDirectory: runtime,
1453
- fieldsDatabasePath: import_node_path9.default.join(runtime, ".eventcatalog", "fields.db")
1512
+ fieldsDatabasePath: import_node_path10.default.join(runtime, ".eventcatalog", "fields.db")
1454
1513
  };
1455
1514
  }
1456
1515
 
1457
1516
  // eventcatalog/src/features/fields/field-indexer.ts
1458
1517
  function detectFormat(fileName) {
1459
- const ext = import_node_path10.default.extname(fileName).toLowerCase();
1518
+ const ext = import_node_path11.default.extname(fileName).toLowerCase();
1460
1519
  if (ext === ".proto") return "proto";
1461
1520
  if (ext === ".avro" || ext === ".avsc") return "avro";
1462
1521
  return "json-schema";
@@ -1465,9 +1524,9 @@ async function buildFieldsIndex(catalogDir, outputDir) {
1465
1524
  const sdkModule = await import("@eventcatalog/sdk");
1466
1525
  const sdk = sdkModule.default(catalogDir);
1467
1526
  const { fieldsDatabasePath: dbPath } = getRuntimePaths(catalogDir, outputDir || catalogDir);
1468
- const dbDir = import_node_path10.default.dirname(dbPath);
1469
- if (!import_node_fs7.default.existsSync(dbDir)) {
1470
- import_node_fs7.default.mkdirSync(dbDir, { recursive: true });
1527
+ const dbDir = import_node_path11.default.dirname(dbPath);
1528
+ if (!import_node_fs8.default.existsSync(dbDir)) {
1529
+ import_node_fs8.default.mkdirSync(dbDir, { recursive: true });
1471
1530
  }
1472
1531
  const db = await FieldsDatabase.create(dbPath, { recreate: true });
1473
1532
  const warnings = [];
@@ -1551,7 +1610,7 @@ async function buildFieldsIndex(catalogDir, outputDir) {
1551
1610
 
1552
1611
  // src/search-indexer.ts
1553
1612
  var import_promises4 = __toESM(require("fs/promises"), 1);
1554
- var import_node_path11 = __toESM(require("path"), 1);
1613
+ var import_node_path12 = __toESM(require("path"), 1);
1555
1614
  var import_glob3 = require("glob");
1556
1615
  var import_gray_matter4 = __toESM(require("gray-matter"), 1);
1557
1616
  var RESOURCE_COLLECTIONS = {
@@ -1615,9 +1674,9 @@ var markdownToSearchText = (content) => {
1615
1674
  };
1616
1675
  var inferDocIdFromFile = (relativePath, frontmatterId) => {
1617
1676
  if (frontmatterId) return frontmatterId;
1618
- const fileName = import_node_path11.default.posix.basename(removeExtension(relativePath));
1677
+ const fileName = import_node_path12.default.posix.basename(removeExtension(relativePath));
1619
1678
  if (fileName.toLowerCase() === "index") {
1620
- return import_node_path11.default.posix.basename(import_node_path11.default.posix.dirname(relativePath));
1679
+ return import_node_path12.default.posix.basename(import_node_path12.default.posix.dirname(relativePath));
1621
1680
  }
1622
1681
  return stripNumericPrefix(fileName);
1623
1682
  };
@@ -1635,7 +1694,7 @@ var findResourceSegment = (segments) => {
1635
1694
  return match;
1636
1695
  };
1637
1696
  var readResourceFrontmatter = async (projectDir, resourcePath) => {
1638
- const candidates = [import_node_path11.default.join(projectDir, resourcePath, "index.mdx"), import_node_path11.default.join(projectDir, resourcePath, "index.md")];
1697
+ const candidates = [import_node_path12.default.join(projectDir, resourcePath, "index.mdx"), import_node_path12.default.join(projectDir, resourcePath, "index.md")];
1639
1698
  for (const candidate of candidates) {
1640
1699
  try {
1641
1700
  const file = await import_promises4.default.readFile(candidate, "utf8");
@@ -1660,7 +1719,7 @@ var deriveRecordFromPath = async ({
1660
1719
  }
1661
1720
  if (segments[0] === "docs") {
1662
1721
  const customPath = normalizeUrlPath(removeExtension(segments.slice(1).join("/")));
1663
- const title = data.title || data.label || import_node_path11.default.posix.basename(customPath) || "Custom docs";
1722
+ const title = data.title || data.label || import_node_path12.default.posix.basename(customPath) || "Custom docs";
1664
1723
  return {
1665
1724
  url: buildUrl(`/docs/custom/${customPath}`, config),
1666
1725
  title,
@@ -1778,7 +1837,7 @@ var collectSearchRecords = async ({
1778
1837
  files.map(async (file) => {
1779
1838
  const raw = await import_promises4.default.readFile(file, "utf8");
1780
1839
  const parsed = (0, import_gray_matter4.default)(raw);
1781
- const relativePath = normalizePath(import_node_path11.default.relative(projectDir, file));
1840
+ const relativePath = normalizePath(import_node_path12.default.relative(projectDir, file));
1782
1841
  const baseRecord = await deriveRecordFromPath({
1783
1842
  projectDir,
1784
1843
  relativePath,
@@ -1826,7 +1885,7 @@ var getSearchOutputPath = ({
1826
1885
  if (searchOutputPath) {
1827
1886
  return searchOutputPath;
1828
1887
  }
1829
- return import_node_path11.default.join(outDir, isServer ? "client" : "", "pagefind");
1888
+ return import_node_path12.default.join(outDir, isServer ? "client" : "", "pagefind");
1830
1889
  };
1831
1890
  var buildSearchIndex = async ({ projectDir, outDir, config, isServer, searchOutputPath }) => {
1832
1891
  const records = await collectSearchRecords({ projectDir, config });
@@ -1880,74 +1939,74 @@ ${errors.join("\n")}`);
1880
1939
  };
1881
1940
 
1882
1941
  // src/catalog-runtime.ts
1883
- var import_node_fs8 = __toESM(require("fs"), 1);
1884
- var import_node_path12 = __toESM(require("path"), 1);
1942
+ var import_node_fs9 = __toESM(require("fs"), 1);
1943
+ var import_node_path13 = __toESM(require("path"), 1);
1885
1944
  var import_node_module2 = require("module");
1886
1945
  var require2 = (0, import_node_module2.createRequire)(importMetaUrl);
1887
1946
  var writeIfChanged = (file, content) => {
1888
- if (import_node_fs8.default.existsSync(file) && import_node_fs8.default.readFileSync(file, "utf8") === content) return;
1889
- import_node_fs8.default.mkdirSync(import_node_path12.default.dirname(file), { recursive: true });
1890
- import_node_fs8.default.writeFileSync(file, content);
1947
+ if (import_node_fs9.default.existsSync(file) && import_node_fs9.default.readFileSync(file, "utf8") === content) return;
1948
+ import_node_fs9.default.mkdirSync(import_node_path13.default.dirname(file), { recursive: true });
1949
+ import_node_fs9.default.writeFileSync(file, content);
1891
1950
  };
1892
1951
  var importPath = (file) => file.replace(/\\/g, "/");
1893
- var hasLegacyCatalogRuntime = (projectDirectory) => import_node_fs8.default.existsSync(import_node_path12.default.join(projectDirectory, ".eventcatalog-core"));
1952
+ var hasLegacyCatalogRuntime = (projectDirectory) => import_node_fs9.default.existsSync(import_node_path13.default.join(projectDirectory, ".eventcatalog-core"));
1894
1953
  var clearCatalogCache = (projectDirectory) => {
1895
1954
  const { cacheDirectory } = getRuntimePaths(projectDirectory);
1896
- import_node_fs8.default.rmSync(cacheDirectory, { recursive: true, force: true });
1955
+ import_node_fs9.default.rmSync(cacheDirectory, { recursive: true, force: true });
1897
1956
  };
1898
1957
  var prepareCatalogRuntime = ({ projectDirectory, catalogDirectory, packageDirectory }) => {
1899
- const runtime = import_node_path12.default.resolve(catalogDirectory);
1900
- const source = import_node_path12.default.resolve(packageDirectory);
1901
- const project = import_node_path12.default.resolve(projectDirectory);
1958
+ const runtime = import_node_path13.default.resolve(catalogDirectory);
1959
+ const source = import_node_path13.default.resolve(packageDirectory);
1960
+ const project = import_node_path13.default.resolve(projectDirectory);
1902
1961
  if (runtime === source || runtime === project) {
1903
1962
  throw new Error("The catalog runtime must be separate from the project and installed application directories.");
1904
1963
  }
1905
- import_node_fs8.default.mkdirSync(runtime, { recursive: true });
1964
+ import_node_fs9.default.mkdirSync(runtime, { recursive: true });
1906
1965
  writeIfChanged(
1907
- import_node_path12.default.join(runtime, "content.config.ts"),
1908
- `export { collections } from ${JSON.stringify(importPath(import_node_path12.default.join(source, "src/content.config.ts")))};
1966
+ import_node_path13.default.join(runtime, "content.config.ts"),
1967
+ `export { collections } from ${JSON.stringify(importPath(import_node_path13.default.join(source, "src/content.config.ts")))};
1909
1968
  `
1910
1969
  );
1911
- const packageTsconfig = JSON.parse(import_node_fs8.default.readFileSync(import_node_path12.default.join(source, "tsconfig.json"), "utf8"));
1970
+ const packageTsconfig = JSON.parse(import_node_fs9.default.readFileSync(import_node_path13.default.join(source, "tsconfig.json"), "utf8"));
1912
1971
  const paths = Object.fromEntries(
1913
1972
  Object.entries(packageTsconfig.compilerOptions.paths).map(([alias, targets]) => [
1914
1973
  alias,
1915
- targets.map((target) => importPath(import_node_path12.default.resolve(source, target)))
1974
+ targets.map((target) => importPath(import_node_path13.default.resolve(source, target)))
1916
1975
  ])
1917
1976
  );
1918
- paths["@config"] = [importPath(import_node_path12.default.join(project, "eventcatalog.config.js"))];
1919
- paths["@catalog/styles"] = [importPath(import_node_path12.default.join(project, "eventcatalog.styles.css"))];
1977
+ paths["@config"] = [importPath(import_node_path13.default.join(project, "eventcatalog.config.js"))];
1978
+ paths["@catalog/styles"] = [importPath(import_node_path13.default.join(project, "eventcatalog.styles.css"))];
1920
1979
  paths["@catalog/components/*"] = [
1921
- importPath(import_node_path12.default.join(project, "components/*")),
1922
- importPath(import_node_path12.default.join(project, "federated/components/*"))
1980
+ importPath(import_node_path13.default.join(project, "components/*")),
1981
+ importPath(import_node_path13.default.join(project, "federated/components/*"))
1923
1982
  ];
1924
- paths["@catalog/snippets/*"] = [importPath(import_node_path12.default.join(project, "snippets/*"))];
1983
+ paths["@catalog/snippets/*"] = [importPath(import_node_path13.default.join(project, "snippets/*"))];
1925
1984
  for (const specifier of ["astro", "astro/zod", "astro/loaders", "astro/runtime/server/index.js"]) {
1926
1985
  paths[specifier] = [importPath(require2.resolve(specifier).replace(/\.js$/, ".d.ts"))];
1927
1986
  }
1928
1987
  writeIfChanged(
1929
- import_node_path12.default.join(runtime, "tsconfig.json"),
1988
+ import_node_path13.default.join(runtime, "tsconfig.json"),
1930
1989
  JSON.stringify(
1931
1990
  {
1932
- extends: importPath(import_node_path12.default.join(source, "tsconfig.json")),
1991
+ extends: importPath(import_node_path13.default.join(source, "tsconfig.json")),
1933
1992
  compilerOptions: {
1934
1993
  baseUrl: ".",
1935
1994
  paths,
1936
1995
  typeRoots: [
1937
- importPath(import_node_path12.default.join(project, "node_modules/@types")),
1938
- importPath(import_node_path12.default.join(source, "../node_modules/@types")),
1939
- importPath(import_node_path12.default.join(source, "../node_modules")),
1940
- importPath(import_node_path12.default.join(project, "node_modules"))
1996
+ importPath(import_node_path13.default.join(project, "node_modules/@types")),
1997
+ importPath(import_node_path13.default.join(source, "../node_modules/@types")),
1998
+ importPath(import_node_path13.default.join(source, "../node_modules")),
1999
+ importPath(import_node_path13.default.join(project, "node_modules"))
1941
2000
  ]
1942
2001
  },
1943
2002
  include: [
1944
- importPath(import_node_path12.default.join(project, ".astro/types.d.ts")),
2003
+ importPath(import_node_path13.default.join(project, ".astro/types.d.ts")),
1945
2004
  "content.config.ts",
1946
- importPath(import_node_path12.default.join(project, "components/**/*")),
1947
- importPath(import_node_path12.default.join(source, "src/**/*"))
2005
+ importPath(import_node_path13.default.join(project, "components/**/*")),
2006
+ importPath(import_node_path13.default.join(source, "src/**/*"))
1948
2007
  ],
1949
2008
  // Keep legacy generated files out of checks on an existing checkout.
1950
- exclude: (packageTsconfig.exclude ?? []).map((entry) => importPath(import_node_path12.default.resolve(source, entry)))
2009
+ exclude: (packageTsconfig.exclude ?? []).map((entry) => importPath(import_node_path13.default.resolve(source, entry)))
1951
2010
  },
1952
2011
  null,
1953
2012
  2
@@ -2027,8 +2086,8 @@ var createAstroDevLineFilter = () => {
2027
2086
  };
2028
2087
 
2029
2088
  // src/astro-config-path.ts
2030
- var import_node_path13 = __toESM(require("path"), 1);
2031
- var getAstroConfigPath = (projectDirectory, configFile, paths = import_node_path13.default) => {
2089
+ var import_node_path14 = __toESM(require("path"), 1);
2090
+ var getAstroConfigPath = (projectDirectory, configFile, paths = import_node_path14.default) => {
2032
2091
  const relative = paths.relative(projectDirectory, configFile);
2033
2092
  const projectRoot = paths.parse(paths.resolve(projectDirectory)).root.toLowerCase();
2034
2093
  const configRoot = paths.parse(paths.resolve(configFile)).root.toLowerCase();
@@ -2043,18 +2102,18 @@ var getAstroConfigPath = (projectDirectory, configFile, paths = import_node_path
2043
2102
  // src/federation/federate.ts
2044
2103
  var import_node_crypto5 = require("crypto");
2045
2104
  var import_promises10 = __toESM(require("fs/promises"), 1);
2046
- var import_node_path19 = __toESM(require("path"), 1);
2105
+ var import_node_path20 = __toESM(require("path"), 1);
2047
2106
  var import_sdk3 = __toESM(require("@eventcatalog/sdk"), 1);
2048
2107
 
2049
2108
  // src/federation/content-cache.ts
2050
2109
  var import_node_crypto2 = require("crypto");
2051
2110
  var import_promises5 = __toESM(require("fs/promises"), 1);
2052
- var import_node_path14 = __toESM(require("path"), 1);
2111
+ var import_node_path15 = __toESM(require("path"), 1);
2053
2112
  var getContentHash = (content) => `sha256:${(0, import_node_crypto2.createHash)("sha256").update(content).digest("hex")}`;
2054
2113
  var isContentHash = (key) => /^sha256:[a-f0-9]{64}$/i.test(key);
2055
2114
  var createFederationContentCache = (projectDirectory, options = {}) => {
2056
- const cacheDirectory = import_node_path14.default.join(projectDirectory, ".eventcatalog-cache", "federation", "content");
2057
- const getCachePath = (key) => import_node_path14.default.join(cacheDirectory, encodeURIComponent(key));
2115
+ const cacheDirectory = import_node_path15.default.join(projectDirectory, ".eventcatalog-cache", "federation", "content");
2116
+ const getCachePath = (key) => import_node_path15.default.join(cacheDirectory, encodeURIComponent(key));
2058
2117
  return {
2059
2118
  async get(key) {
2060
2119
  if (options.read === false || !isContentHash(key)) return void 0;
@@ -2241,20 +2300,20 @@ var getVisibleFederationDiagnostics = (diagnostics, verbose) => diagnostics.filt
2241
2300
 
2242
2301
  // src/federation/output-transaction.ts
2243
2302
  var import_promises6 = __toESM(require("fs/promises"), 1);
2244
- var import_node_path15 = __toESM(require("path"), 1);
2303
+ var import_node_path16 = __toESM(require("path"), 1);
2245
2304
  var getSafePublicPath = (publicDirectory, relativePath) => {
2246
- const normalizedPath = import_node_path15.default.posix.normalize(relativePath);
2247
- const unsafe = relativePath.length === 0 || relativePath.includes("\0") || relativePath.includes("\\") || import_node_path15.default.posix.isAbsolute(relativePath) || /^[a-zA-Z]:\//.test(relativePath) || normalizedPath !== relativePath || normalizedPath === ".." || normalizedPath.startsWith("../");
2305
+ const normalizedPath = import_node_path16.default.posix.normalize(relativePath);
2306
+ const unsafe = relativePath.length === 0 || relativePath.includes("\0") || relativePath.includes("\\") || import_node_path16.default.posix.isAbsolute(relativePath) || /^[a-zA-Z]:\//.test(relativePath) || normalizedPath !== relativePath || normalizedPath === ".." || normalizedPath.startsWith("../");
2248
2307
  if (unsafe) return void 0;
2249
- const destinationPath = import_node_path15.default.resolve(publicDirectory, relativePath);
2250
- const relativeDestinationPath = import_node_path15.default.relative(publicDirectory, destinationPath);
2251
- return relativeDestinationPath !== "" && relativeDestinationPath !== ".." && !relativeDestinationPath.startsWith(`..${import_node_path15.default.sep}`) && !import_node_path15.default.isAbsolute(relativeDestinationPath) ? destinationPath : void 0;
2308
+ const destinationPath = import_node_path16.default.resolve(publicDirectory, relativePath);
2309
+ const relativeDestinationPath = import_node_path16.default.relative(publicDirectory, destinationPath);
2310
+ return relativeDestinationPath !== "" && relativeDestinationPath !== ".." && !relativeDestinationPath.startsWith(`..${import_node_path16.default.sep}`) && !import_node_path16.default.isAbsolute(relativeDestinationPath) ? destinationPath : void 0;
2252
2311
  };
2253
2312
  var beginFederationOutputTransaction = async (projectDirectory, outDir, relativePublicPaths) => {
2254
- const transactionDirectory = await import_promises6.default.mkdtemp(import_node_path15.default.join(projectDirectory, ".eventcatalog-federation-transaction-"));
2255
- const previousOutDir = import_node_path15.default.join(transactionDirectory, "federated");
2256
- const publicBackupDirectory = import_node_path15.default.join(transactionDirectory, "public");
2257
- const publicDirectory = import_node_path15.default.resolve(projectDirectory, "public");
2313
+ const transactionDirectory = await import_promises6.default.mkdtemp(import_node_path16.default.join(projectDirectory, ".eventcatalog-federation-transaction-"));
2314
+ const previousOutDir = import_node_path16.default.join(transactionDirectory, "federated");
2315
+ const publicBackupDirectory = import_node_path16.default.join(transactionDirectory, "public");
2316
+ const publicDirectory = import_node_path16.default.resolve(projectDirectory, "public");
2258
2317
  const publicSnapshots = [];
2259
2318
  const missingPublicDirectories = /* @__PURE__ */ new Set();
2260
2319
  let hadPreviousOutDir = false;
@@ -2265,8 +2324,8 @@ var beginFederationOutputTransaction = async (projectDirectory, outDir, relative
2265
2324
  try {
2266
2325
  const stat = await import_promises6.default.lstat(destinationPath);
2267
2326
  if (!stat.isFile()) continue;
2268
- const backupPath = import_node_path15.default.join(publicBackupDirectory, `${publicSnapshots.length}`);
2269
- await import_promises6.default.mkdir(import_node_path15.default.dirname(backupPath), { recursive: true });
2327
+ const backupPath = import_node_path16.default.join(publicBackupDirectory, `${publicSnapshots.length}`);
2328
+ await import_promises6.default.mkdir(import_node_path16.default.dirname(backupPath), { recursive: true });
2270
2329
  await import_promises6.default.copyFile(destinationPath, backupPath);
2271
2330
  publicSnapshots.push({ backupPath, destinationPath, state: "file" });
2272
2331
  } catch (error) {
@@ -2274,7 +2333,7 @@ var beginFederationOutputTransaction = async (projectDirectory, outDir, relative
2274
2333
  if (code === "ENOTDIR") continue;
2275
2334
  if (code !== "ENOENT") throw error;
2276
2335
  publicSnapshots.push({ destinationPath, state: "missing" });
2277
- let directory = import_node_path15.default.dirname(destinationPath);
2336
+ let directory = import_node_path16.default.dirname(destinationPath);
2278
2337
  while (directory !== publicDirectory) {
2279
2338
  try {
2280
2339
  await import_promises6.default.lstat(directory);
@@ -2284,7 +2343,7 @@ var beginFederationOutputTransaction = async (projectDirectory, outDir, relative
2284
2343
  if (directoryCode === "ENOTDIR") break;
2285
2344
  if (directoryCode !== "ENOENT") throw directoryError;
2286
2345
  missingPublicDirectories.add(directory);
2287
- directory = import_node_path15.default.dirname(directory);
2346
+ directory = import_node_path16.default.dirname(directory);
2288
2347
  }
2289
2348
  }
2290
2349
  }
@@ -2320,7 +2379,7 @@ var beginFederationOutputTransaction = async (projectDirectory, outDir, relative
2320
2379
  continue;
2321
2380
  }
2322
2381
  await attempt(async () => {
2323
- await import_promises6.default.mkdir(import_node_path15.default.dirname(snapshot.destinationPath), { recursive: true });
2382
+ await import_promises6.default.mkdir(import_node_path16.default.dirname(snapshot.destinationPath), { recursive: true });
2324
2383
  await import_promises6.default.copyFile(snapshot.backupPath, snapshot.destinationPath);
2325
2384
  });
2326
2385
  }
@@ -2357,7 +2416,7 @@ var withFederationOutputTransaction = async (projectDirectory, outDir, relativeP
2357
2416
  // src/federation/public-assets.ts
2358
2417
  var import_node_crypto3 = require("crypto");
2359
2418
  var import_promises7 = __toESM(require("fs/promises"), 1);
2360
- var import_node_path16 = __toESM(require("path"), 1);
2419
+ var import_node_path17 = __toESM(require("path"), 1);
2361
2420
  var getContentHash2 = (content) => `sha256:${(0, import_node_crypto3.createHash)("sha256").update(content).digest("hex")}`;
2362
2421
  var getFileHash = async (filePath) => {
2363
2422
  try {
@@ -2369,13 +2428,13 @@ var getFileHash = async (filePath) => {
2369
2428
  }
2370
2429
  };
2371
2430
  var getSafePath = (directory, relativePath) => {
2372
- const normalizedPath = import_node_path16.default.posix.normalize(relativePath);
2373
- const unsafe = relativePath.length === 0 || relativePath.includes("\0") || relativePath.includes("\\") || import_node_path16.default.posix.isAbsolute(relativePath) || /^[a-zA-Z]:\//.test(relativePath) || normalizedPath !== relativePath || normalizedPath === ".." || normalizedPath.startsWith("../");
2431
+ const normalizedPath = import_node_path17.default.posix.normalize(relativePath);
2432
+ const unsafe = relativePath.length === 0 || relativePath.includes("\0") || relativePath.includes("\\") || import_node_path17.default.posix.isAbsolute(relativePath) || /^[a-zA-Z]:\//.test(relativePath) || normalizedPath !== relativePath || normalizedPath === ".." || normalizedPath.startsWith("../");
2374
2433
  if (unsafe) return void 0;
2375
- const resolvedDirectory = import_node_path16.default.resolve(directory);
2376
- const resolvedPath = import_node_path16.default.resolve(resolvedDirectory, relativePath);
2377
- const relativeResolvedPath = import_node_path16.default.relative(resolvedDirectory, resolvedPath);
2378
- if (relativeResolvedPath === "" || relativeResolvedPath === ".." || relativeResolvedPath.startsWith(`..${import_node_path16.default.sep}`) || import_node_path16.default.isAbsolute(relativeResolvedPath)) {
2434
+ const resolvedDirectory = import_node_path17.default.resolve(directory);
2435
+ const resolvedPath = import_node_path17.default.resolve(resolvedDirectory, relativePath);
2436
+ const relativeResolvedPath = import_node_path17.default.relative(resolvedDirectory, resolvedPath);
2437
+ if (relativeResolvedPath === "" || relativeResolvedPath === ".." || relativeResolvedPath.startsWith(`..${import_node_path17.default.sep}`) || import_node_path17.default.isAbsolute(relativeResolvedPath)) {
2379
2438
  return void 0;
2380
2439
  }
2381
2440
  return resolvedPath;
@@ -2383,16 +2442,16 @@ var getSafePath = (directory, relativePath) => {
2383
2442
  var listFiles = async (directory, relativeDirectory = "") => {
2384
2443
  let entries;
2385
2444
  try {
2386
- entries = await import_promises7.default.readdir(import_node_path16.default.join(directory, relativeDirectory), { withFileTypes: true });
2445
+ entries = await import_promises7.default.readdir(import_node_path17.default.join(directory, relativeDirectory), { withFileTypes: true });
2387
2446
  } catch (error) {
2388
2447
  if (error.code === "ENOENT") return [];
2389
2448
  throw error;
2390
2449
  }
2391
2450
  const files = await Promise.all(
2392
2451
  entries.map(async (entry) => {
2393
- const relativePath = import_node_path16.default.join(relativeDirectory, entry.name);
2452
+ const relativePath = import_node_path17.default.join(relativeDirectory, entry.name);
2394
2453
  if (entry.isDirectory()) return listFiles(directory, relativePath);
2395
- return entry.isFile() ? [relativePath.split(import_node_path16.default.sep).join("/")] : [];
2454
+ return entry.isFile() ? [relativePath.split(import_node_path17.default.sep).join("/")] : [];
2396
2455
  })
2397
2456
  );
2398
2457
  return files.flat().sort();
@@ -2407,19 +2466,19 @@ var pathExists = async (filePath) => {
2407
2466
  }
2408
2467
  };
2409
2468
  var hasBlockingParent = async (publicDirectory, destinationPath) => {
2410
- let currentPath = import_node_path16.default.dirname(destinationPath);
2469
+ let currentPath = import_node_path17.default.dirname(destinationPath);
2411
2470
  while (currentPath !== publicDirectory) {
2412
2471
  try {
2413
2472
  if (!(await import_promises7.default.lstat(currentPath)).isDirectory()) return true;
2414
2473
  } catch (error) {
2415
2474
  if (error.code !== "ENOENT") throw error;
2416
2475
  }
2417
- currentPath = import_node_path16.default.dirname(currentPath);
2476
+ currentPath = import_node_path17.default.dirname(currentPath);
2418
2477
  }
2419
2478
  return false;
2420
2479
  };
2421
2480
  var pruneEmptyDirectories = async (publicDirectory, filePath) => {
2422
- let currentPath = import_node_path16.default.dirname(filePath);
2481
+ let currentPath = import_node_path17.default.dirname(filePath);
2423
2482
  while (currentPath !== publicDirectory) {
2424
2483
  try {
2425
2484
  await import_promises7.default.rmdir(currentPath);
@@ -2427,7 +2486,7 @@ var pruneEmptyDirectories = async (publicDirectory, filePath) => {
2427
2486
  if (!["ENOENT", "ENOTEMPTY"].includes(error.code ?? "")) throw error;
2428
2487
  if (error.code === "ENOTEMPTY") return;
2429
2488
  }
2430
- currentPath = import_node_path16.default.dirname(currentPath);
2489
+ currentPath = import_node_path17.default.dirname(currentPath);
2431
2490
  }
2432
2491
  };
2433
2492
  var composePublicAssets = async ({
@@ -2437,8 +2496,8 @@ var composePublicAssets = async ({
2437
2496
  previousFiles = {},
2438
2497
  collisionPaths = /* @__PURE__ */ new Set()
2439
2498
  }) => {
2440
- const publicDirectory = import_node_path16.default.resolve(projectDirectory, "public");
2441
- const federatedPublicDirectory = import_node_path16.default.resolve(federatedDirectory, "public");
2499
+ const publicDirectory = import_node_path17.default.resolve(projectDirectory, "public");
2500
+ const federatedPublicDirectory = import_node_path17.default.resolve(federatedDirectory, "public");
2442
2501
  const sourceFiles = await listFiles(federatedPublicDirectory);
2443
2502
  const sourceFileSet = new Set(sourceFiles);
2444
2503
  const managedFiles = /* @__PURE__ */ new Set();
@@ -2474,7 +2533,7 @@ var composePublicAssets = async ({
2474
2533
  const asset = publicAssetsByPath.get(relativePath);
2475
2534
  if (!asset) throw new Error(`Cannot identify the source of federated public asset "${relativePath}"`);
2476
2535
  const content = await import_promises7.default.readFile(sourcePath);
2477
- await import_promises7.default.mkdir(import_node_path16.default.dirname(destinationPath), { recursive: true });
2536
+ await import_promises7.default.mkdir(import_node_path17.default.dirname(destinationPath), { recursive: true });
2478
2537
  await import_promises7.default.writeFile(destinationPath, content);
2479
2538
  files[relativePath] = { source: asset.resolvedFrom.source, hash: getContentHash2(content) };
2480
2539
  copied += 1;
@@ -2487,17 +2546,17 @@ var composePublicAssets = async ({
2487
2546
  // src/federation/filesystem-source-provider.ts
2488
2547
  var import_node_crypto4 = require("crypto");
2489
2548
  var import_promises8 = __toESM(require("fs/promises"), 1);
2490
- var import_node_path17 = __toESM(require("path"), 1);
2549
+ var import_node_path18 = __toESM(require("path"), 1);
2491
2550
  var import_sdk = __toESM(require("@eventcatalog/sdk"), 1);
2492
2551
  var FILESYSTEM_SOURCE_PREFIX = "file:";
2493
2552
  var isWithinDirectory = (directory, target) => {
2494
- const relativePath = import_node_path17.default.relative(directory, target);
2495
- return relativePath === "" || !relativePath.startsWith(`..${import_node_path17.default.sep}`) && relativePath !== ".." && !import_node_path17.default.isAbsolute(relativePath);
2553
+ const relativePath = import_node_path18.default.relative(directory, target);
2554
+ return relativePath === "" || !relativePath.startsWith(`..${import_node_path18.default.sep}`) && relativePath !== ".." && !import_node_path18.default.isAbsolute(relativePath);
2496
2555
  };
2497
2556
  var assertPortableRelativePath = (filePath, label, allowRoot = true) => {
2498
2557
  const portablePath = filePath.replaceAll("\\", "/");
2499
- const normalizedPath = import_node_path17.default.posix.normalize(portablePath);
2500
- const isUnsafe = filePath.includes("\\") || filePath.includes("\0") || import_node_path17.default.posix.isAbsolute(normalizedPath) || /^[a-zA-Z]:\//.test(normalizedPath) || normalizedPath === ".." || normalizedPath.startsWith("../") || !allowRoot && (normalizedPath === "." || normalizedPath === "");
2558
+ const normalizedPath = import_node_path18.default.posix.normalize(portablePath);
2559
+ const isUnsafe = filePath.includes("\\") || filePath.includes("\0") || import_node_path18.default.posix.isAbsolute(normalizedPath) || /^[a-zA-Z]:\//.test(normalizedPath) || normalizedPath === ".." || normalizedPath.startsWith("../") || !allowRoot && (normalizedPath === "." || normalizedPath === "");
2501
2560
  if (isUnsafe) throw new Error(`${label} "${filePath}" escapes its filesystem source`);
2502
2561
  return normalizedPath;
2503
2562
  };
@@ -2507,13 +2566,13 @@ var getSourceRoot = (projectDirectory, source) => {
2507
2566
  }
2508
2567
  const locator = source.source.slice(FILESYSTEM_SOURCE_PREFIX.length);
2509
2568
  if (!locator.trim()) throw new Error(`Filesystem federation source "${source.id}" requires a path after "file:".`);
2510
- return import_node_path17.default.resolve(projectDirectory, locator);
2569
+ return import_node_path18.default.resolve(projectDirectory, locator);
2511
2570
  };
2512
2571
  var getCatalogDirectory = async (projectDirectory, source) => {
2513
2572
  if (source.ref) throw new Error(`Filesystem federation source "${source.id}" does not support "ref".`);
2514
2573
  const sourceRoot = getSourceRoot(projectDirectory, source);
2515
2574
  const catalogPath = assertPortableRelativePath(source.path ?? ".", "Catalog path");
2516
- const catalogDirectory = import_node_path17.default.resolve(sourceRoot, ...catalogPath.split("/"));
2575
+ const catalogDirectory = import_node_path18.default.resolve(sourceRoot, ...catalogPath.split("/"));
2517
2576
  if (!isWithinDirectory(sourceRoot, catalogDirectory)) {
2518
2577
  throw new Error(`Catalog path "${source.path}" escapes source "${source.id}"`);
2519
2578
  }
@@ -2535,7 +2594,7 @@ var getCatalogDirectory = async (projectDirectory, source) => {
2535
2594
  };
2536
2595
  var getArtifactPath = async (catalogDirectory, source, artifactPath) => {
2537
2596
  const normalizedPath = assertPortableRelativePath(artifactPath, "Federated artifact path", false);
2538
- const filePath = import_node_path17.default.resolve(catalogDirectory, ...normalizedPath.split("/"));
2597
+ const filePath = import_node_path18.default.resolve(catalogDirectory, ...normalizedPath.split("/"));
2539
2598
  if (!isWithinDirectory(catalogDirectory, filePath)) {
2540
2599
  throw new Error(`Federated artifact path "${artifactPath}" escapes source "${source.id}"`);
2541
2600
  }
@@ -2575,7 +2634,7 @@ var createFileSystemSourceProvider = (projectDirectory) => ({
2575
2634
  var import_node_child_process = require("child_process");
2576
2635
  var import_promises9 = __toESM(require("fs/promises"), 1);
2577
2636
  var import_node_os3 = __toESM(require("os"), 1);
2578
- var import_node_path18 = __toESM(require("path"), 1);
2637
+ var import_node_path19 = __toESM(require("path"), 1);
2579
2638
  var import_node_util = require("util");
2580
2639
  var import_sdk2 = __toESM(require("@eventcatalog/sdk"), 1);
2581
2640
  var execFileAsync = (0, import_node_util.promisify)(import_node_child_process.execFile);
@@ -2586,8 +2645,8 @@ var parseGitHubSource = (source) => {
2586
2645
  };
2587
2646
  var assertSafeCatalogPath = (source) => {
2588
2647
  const catalogPath = source.path ?? ".";
2589
- const normalized = import_node_path18.default.posix.normalize(catalogPath.replaceAll("\\", "/"));
2590
- if (catalogPath.includes("\\") || import_node_path18.default.posix.isAbsolute(normalized) || normalized === ".." || normalized.startsWith("../")) {
2648
+ const normalized = import_node_path19.default.posix.normalize(catalogPath.replaceAll("\\", "/"));
2649
+ if (catalogPath.includes("\\") || import_node_path19.default.posix.isAbsolute(normalized) || normalized === ".." || normalized.startsWith("../")) {
2591
2650
  throw new Error(`Catalog path "${catalogPath}" escapes source "${source.id}"`);
2592
2651
  }
2593
2652
  };
@@ -2630,8 +2689,8 @@ var getGitEnvironment = (token) => {
2630
2689
  };
2631
2690
  var createCheckout = (executeFile, token) => async (source, ref, callback) => {
2632
2691
  const { owner, repository } = parseGitHubSource(source);
2633
- const catalogPath = import_node_path18.default.posix.normalize(source.path ?? ".");
2634
- const directory = await import_promises9.default.mkdtemp(import_node_path18.default.join(import_node_os3.default.tmpdir(), "eventcatalog-federation-"));
2692
+ const catalogPath = import_node_path19.default.posix.normalize(source.path ?? ".");
2693
+ const directory = await import_promises9.default.mkdtemp(import_node_path19.default.join(import_node_os3.default.tmpdir(), "eventcatalog-federation-"));
2635
2694
  const env = getGitEnvironment(token);
2636
2695
  try {
2637
2696
  const git = (args) => executeFile("git", args, { cwd: directory, env, encoding: "utf8" });
@@ -2651,16 +2710,16 @@ var createCheckout = (executeFile, token) => async (source, ref, callback) => {
2651
2710
  var generateIndex = async (source, ref, checkout, executeFile) => checkout(source, ref, async (directory) => {
2652
2711
  const { stdout } = await executeFile("git", ["rev-parse", "HEAD"], { cwd: directory, encoding: "utf8" });
2653
2712
  const commit = stdout.trim();
2654
- const catalogDirectory = import_node_path18.default.resolve(directory, source.path ?? ".");
2655
- const relativeCatalogDirectory = import_node_path18.default.relative(directory, catalogDirectory);
2656
- if (relativeCatalogDirectory.startsWith("..") || import_node_path18.default.isAbsolute(relativeCatalogDirectory)) {
2713
+ const catalogDirectory = import_node_path19.default.resolve(directory, source.path ?? ".");
2714
+ const relativeCatalogDirectory = import_node_path19.default.relative(directory, catalogDirectory);
2715
+ if (relativeCatalogDirectory.startsWith("..") || import_node_path19.default.isAbsolute(relativeCatalogDirectory)) {
2657
2716
  throw new Error(`Catalog path "${source.path}" escapes source "${source.id}"`);
2658
2717
  }
2659
2718
  const index = await (0, import_sdk2.default)(catalogDirectory).buildIndex({ source: source.id, commit });
2660
2719
  return { bytes: Buffer.from(JSON.stringify(index)), index, commit, generated: true };
2661
2720
  });
2662
2721
  var fetchPublishedIndex = async (source, ref, fetcher, token) => {
2663
- const indexPath = import_node_path18.default.posix.join(source.path ?? ".", "catalog.index.json");
2722
+ const indexPath = import_node_path19.default.posix.join(source.path ?? ".", "catalog.index.json");
2664
2723
  const bytes = await fetchBytes(source, ref, indexPath, fetcher, token);
2665
2724
  if (!bytes) return void 0;
2666
2725
  const index = (0, import_sdk2.parseIndex)(JSON.parse(bytes.toString("utf8")));
@@ -2683,7 +2742,7 @@ var createGitHubSourceProvider = (options = {}) => {
2683
2742
  },
2684
2743
  async fetchContent({ source, commit, path: artifactPath }) {
2685
2744
  assertSafeCatalogPath(source);
2686
- const catalogPath = import_node_path18.default.posix.join(source.path ?? ".", artifactPath);
2745
+ const catalogPath = import_node_path19.default.posix.join(source.path ?? ".", artifactPath);
2687
2746
  const content = await fetchBytes(source, commit, catalogPath, fetcher, token);
2688
2747
  if (!content) throw new Error(`Federated artifact not found for "${source.id}": ${artifactPath}`);
2689
2748
  return content;
@@ -2794,8 +2853,8 @@ var pathExists2 = async (filePath) => {
2794
2853
  }
2795
2854
  };
2796
2855
  var cleanupPreviousFederation = async (projectDirectory, onProgress) => {
2797
- const outDir = import_node_path19.default.join(projectDirectory, "federated");
2798
- const lockPath = import_node_path19.default.join(projectDirectory, "eventcatalog.lock");
2856
+ const outDir = import_node_path20.default.join(projectDirectory, "federated");
2857
+ const lockPath = import_node_path20.default.join(projectDirectory, "eventcatalog.lock");
2799
2858
  const previousLock = await readLock(lockPath);
2800
2859
  const hadFederatedOutput = await pathExists2(outDir);
2801
2860
  const hadLock = previousLock !== void 0;
@@ -2855,8 +2914,8 @@ var federateCatalog = async (projectDirectory, options = {}) => {
2855
2914
  throw new Error(`Failed to federate source "${source.id}": ${message2}`, { cause: error });
2856
2915
  }
2857
2916
  }
2858
- const outDir = import_node_path19.default.join(projectDirectory, "federated");
2859
- const lockPath = import_node_path19.default.join(projectDirectory, "eventcatalog.lock");
2917
+ const outDir = import_node_path20.default.join(projectDirectory, "federated");
2918
+ const lockPath = import_node_path20.default.join(projectDirectory, "eventcatalog.lock");
2860
2919
  const previousLock = await readLock(lockPath);
2861
2920
  const resources = resolvedSources.reduce((total, source) => total + source.resolved.index.resources.length, 0);
2862
2921
  const remoteIndexes = resolvedSources.map(({ resolved }) => resolved.index);
@@ -2968,17 +3027,17 @@ Run npm i @eventcatalog/core to update`;
2968
3027
  };
2969
3028
 
2970
3029
  // src/eventcatalog.ts
2971
- var currentDir = import_node_path21.default.dirname((0, import_node_url2.fileURLToPath)(importMetaUrl));
2972
- var astroCli = import_node_path21.default.join(import_node_path21.default.dirname((0, import_node_module3.createRequire)(importMetaUrl).resolve("astro/package.json")), "bin/astro.mjs");
3030
+ var currentDir = import_node_path22.default.dirname((0, import_node_url2.fileURLToPath)(importMetaUrl));
3031
+ var astroCli = import_node_path22.default.join(import_node_path22.default.dirname((0, import_node_module3.createRequire)(importMetaUrl).resolve("astro/package.json")), "bin/astro.mjs");
2973
3032
  var ASTRO_IN_FOREGROUND = { ASTRO_DEV_BACKGROUND: "1", ASTRO_PREVIEW_BACKGROUND: "1" };
2974
3033
  var program = new import_commander.Command().version(VERSION);
2975
- var dir = import_node_path21.default.resolve(process.env.PROJECT_DIR || process.cwd());
2976
- var eventCatalogDir = import_node_path21.default.resolve((0, import_node_path20.join)(currentDir, "../eventcatalog/"));
2977
- var astroConfigPath = () => getAstroConfigPath(dir, (0, import_node_path20.join)(eventCatalogDir, "astro.config.mjs"));
3034
+ var dir = import_node_path22.default.resolve(process.env.PROJECT_DIR || process.cwd());
3035
+ var eventCatalogDir = import_node_path22.default.resolve((0, import_node_path21.join)(currentDir, "../eventcatalog/"));
3036
+ var astroConfigPath = () => getAstroConfigPath(dir, (0, import_node_path21.join)(eventCatalogDir, "astro.config.mjs"));
2978
3037
  var { runtimeDirectory: core } = getRuntimePaths(dir);
2979
3038
  var getInstalledEventCatalogVersion = () => {
2980
3039
  try {
2981
- const pkg = import_fs.default.readFileSync((0, import_node_path20.join)(dir, "package.json"), "utf8");
3040
+ const pkg = import_fs.default.readFileSync((0, import_node_path21.join)(dir, "package.json"), "utf8");
2982
3041
  const json = JSON.parse(pkg);
2983
3042
  return json.dependencies["@eventcatalog/core"];
2984
3043
  } catch (error) {
@@ -3047,12 +3106,12 @@ var startDevPrewarm = ({
3047
3106
  var buildDevSearchIndex = async ({ config }) => {
3048
3107
  const result = await buildSearchIndex({
3049
3108
  projectDir: dir,
3050
- outDir: import_node_path21.default.join(core, "public"),
3051
- searchOutputPath: import_node_path21.default.join(core, "public", "pagefind"),
3109
+ outDir: import_node_path22.default.join(core, "public"),
3110
+ searchOutputPath: import_node_path22.default.join(core, "public", "pagefind"),
3052
3111
  config,
3053
3112
  isServer: false
3054
3113
  });
3055
- logger.info(`Indexed ${result.records} page(s) into ${import_node_path21.default.relative(core, result.outputPath)}`, "search");
3114
+ logger.info(`Indexed ${result.records} page(s) into ${import_node_path22.default.relative(core, result.outputPath)}`, "search");
3056
3115
  };
3057
3116
  var warnIfIndexedSearchUsesAuth = async () => {
3058
3117
  if (!await isAuthEnabled()) {
@@ -3234,8 +3293,8 @@ program.command("dev").description("Run development server of EventCatalog").opt
3234
3293
  logger.info("Setting up EventCatalog...", "eventcatalog");
3235
3294
  const isServer = await isOutputServer();
3236
3295
  logger.info(isServer ? "EventCatalog is running in Server Mode" : "EventCatalog is running in Static Mode", "config");
3237
- if (import_fs.default.existsSync(import_node_path21.default.join(dir, ".env"))) {
3238
- import_dotenv.default.config({ path: import_node_path21.default.join(dir, ".env") });
3296
+ if (import_fs.default.existsSync(import_node_path22.default.join(dir, ".env"))) {
3297
+ import_dotenv.default.config({ path: import_node_path22.default.join(dir, ".env") });
3239
3298
  }
3240
3299
  if (options.debug) {
3241
3300
  logger.info("Debug mode enabled", "debug");
@@ -3313,8 +3372,8 @@ program.command("build").description("Run build of EventCatalog").action(async (
3313
3372
  logger.info("Building EventCatalog...", "build");
3314
3373
  const isServer = await isOutputServer();
3315
3374
  logger.info(isServer ? "EventCatalog is running in Server Mode" : "EventCatalog is running in Static Mode", "config");
3316
- if (import_fs.default.existsSync(import_node_path21.default.join(dir, ".env"))) {
3317
- import_dotenv.default.config({ path: import_node_path21.default.join(dir, ".env") });
3375
+ if (import_fs.default.existsSync(import_node_path22.default.join(dir, ".env"))) {
3376
+ import_dotenv.default.config({ path: import_node_path22.default.join(dir, ".env") });
3318
3377
  }
3319
3378
  await verifyRequiredFieldsAreInCatalogConfigFile(dir);
3320
3379
  const config = await getEventCatalogConfigFile(dir);
@@ -3351,7 +3410,7 @@ program.command("build").description("Run build of EventCatalog").action(async (
3351
3410
  });
3352
3411
  if (await isIndexedSearchEnabled()) {
3353
3412
  await warnIfIndexedSearchUsesAuth();
3354
- const outDir = import_node_path21.default.resolve(dir, await getProjectOutDir());
3413
+ const outDir = import_node_path22.default.resolve(dir, await getProjectOutDir());
3355
3414
  logger.info("Building indexed search...", "search");
3356
3415
  const result = await buildSearchIndex({
3357
3416
  projectDir: dir,
@@ -3359,7 +3418,7 @@ program.command("build").description("Run build of EventCatalog").action(async (
3359
3418
  config,
3360
3419
  isServer
3361
3420
  });
3362
- logger.info(`Indexed ${result.records} page(s) into ${import_node_path21.default.relative(dir, result.outputPath)}`, "search");
3421
+ logger.info(`Indexed ${result.records} page(s) into ${import_node_path22.default.relative(dir, result.outputPath)}`, "search");
3363
3422
  }
3364
3423
  });
3365
3424
  var previewCatalog = async ({ command }) => {
@@ -3390,7 +3449,7 @@ if (start) {
3390
3449
  }
3391
3450
  `;
3392
3451
  var startServerCatalog = async () => {
3393
- const serverEntryPath = import_node_path21.default.join(dir, "dist", "server", "entry.mjs");
3452
+ const serverEntryPath = import_node_path22.default.join(dir, "dist", "server", "entry.mjs");
3394
3453
  const config = await getEventCatalogConfigFile(dir);
3395
3454
  const base = (config?.base || "/").replace(/\/$/, "");
3396
3455
  await runCommandWithFilteredOutput({
@@ -3409,20 +3468,21 @@ var startServerCatalog = async () => {
3409
3468
  program.command("preview").description("Serves the contents of your eventcatalog build directory").action(async (options, command) => {
3410
3469
  logger.welcome();
3411
3470
  logger.info("Starting preview of your build...", "preview");
3412
- if (import_fs.default.existsSync(import_node_path21.default.join(dir, ".env"))) {
3413
- import_dotenv.default.config({ path: import_node_path21.default.join(dir, ".env") });
3471
+ if (import_fs.default.existsSync(import_node_path22.default.join(dir, ".env"))) {
3472
+ import_dotenv.default.config({ path: import_node_path22.default.join(dir, ".env") });
3414
3473
  }
3415
3474
  await previewCatalog({ command });
3416
3475
  });
3417
3476
  program.command("start").description("Serves the contents of your eventcatalog build directory").action(async (options, command) => {
3418
3477
  logger.welcome();
3419
3478
  logger.info("Starting preview of your build...", "preview");
3420
- if (import_fs.default.existsSync(import_node_path21.default.join(dir, ".env"))) {
3421
- import_dotenv.default.config({ path: import_node_path21.default.join(dir, ".env") });
3479
+ if (import_fs.default.existsSync(import_node_path22.default.join(dir, ".env"))) {
3480
+ import_dotenv.default.config({ path: import_node_path22.default.join(dir, ".env") });
3422
3481
  }
3423
3482
  const isServerOutput = await isOutputServer();
3424
3483
  if (isServerOutput) {
3425
- await getLicenseStatus2(dir);
3484
+ const license = await getLicenseStatus2(dir);
3485
+ void log_build_default(dir, { command: "start", license });
3426
3486
  await startServerCatalog();
3427
3487
  } else {
3428
3488
  await previewCatalog({ command });
@@ -3431,22 +3491,22 @@ program.command("start").description("Serves the contents of your eventcatalog b
3431
3491
  program.command("export").description("Export your EventCatalog using the SDK dumpCatalog function").option("--include-markdown", "Include markdown content in the export", false).action(async (options) => {
3432
3492
  logger.welcome();
3433
3493
  logger.info("Exporting EventCatalog...", "export");
3434
- if (import_fs.default.existsSync(import_node_path21.default.join(dir, ".env"))) {
3435
- import_dotenv.default.config({ path: import_node_path21.default.join(dir, ".env") });
3494
+ if (import_fs.default.existsSync(import_node_path22.default.join(dir, ".env"))) {
3495
+ import_dotenv.default.config({ path: import_node_path22.default.join(dir, ".env") });
3436
3496
  }
3437
3497
  const { default: initSDK } = await import("@eventcatalog/sdk");
3438
3498
  const sdk = initSDK(dir);
3439
3499
  const catalog = await sdk.dumpCatalog({ includeMarkdown: options.includeMarkdown });
3440
- const exportsDir = import_node_path21.default.join(dir, "exports");
3500
+ const exportsDir = import_node_path22.default.join(dir, "exports");
3441
3501
  ensureDir(exportsDir);
3442
3502
  const date = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
3443
- const exportFile = import_node_path21.default.join(exportsDir, `catalog-${date}.json`);
3503
+ const exportFile = import_node_path22.default.join(exportsDir, `catalog-${date}.json`);
3444
3504
  import_fs.default.writeFileSync(exportFile, JSON.stringify(catalog, null, 2), "utf-8");
3445
3505
  logger.info(`Catalog exported to ${exportFile}`, "export");
3446
3506
  });
3447
3507
  program.command("generate [siteDir]").description("Start the generator scripts.").action(async () => {
3448
- if (import_fs.default.existsSync(import_node_path21.default.join(dir, ".env"))) {
3449
- import_dotenv.default.config({ path: import_node_path21.default.join(dir, ".env") });
3508
+ if (import_fs.default.existsSync(import_node_path22.default.join(dir, ".env"))) {
3509
+ import_dotenv.default.config({ path: import_node_path22.default.join(dir, ".env") });
3450
3510
  }
3451
3511
  await generate(dir);
3452
3512
  });
@@ -3519,7 +3579,7 @@ var reportFederationProgress = (event, verbose = false) => {
3519
3579
  }
3520
3580
  return;
3521
3581
  case "hydrating":
3522
- logger.info(`Hydrating federated content into ${import_node_path21.default.relative(dir, event.outDir)}/...`, "federation");
3582
+ logger.info(`Hydrating federated content into ${import_node_path22.default.relative(dir, event.outDir)}/...`, "federation");
3523
3583
  return;
3524
3584
  case "hydrate:cache":
3525
3585
  if (event.files === 1 || event.files % 25 === 0) {
@@ -3542,13 +3602,13 @@ var reportFederationProgress = (event, verbose = false) => {
3542
3602
  `Federation complete: ${event.result.sources} sources, ${event.result.resources} remote resources, ${event.result.hydrate.written} files written (${event.result.hydrate.fetched} downloaded, ${event.result.hydrate.written - event.result.hydrate.fetched} cached)`,
3543
3603
  "federation"
3544
3604
  );
3545
- logger.info(`Recorded resolved source state in ${import_node_path21.default.relative(dir, event.result.lockPath)}`, "federation");
3605
+ logger.info(`Recorded resolved source state in ${import_node_path22.default.relative(dir, event.result.lockPath)}`, "federation");
3546
3606
  }
3547
3607
  };
3548
3608
  program.command("federate").description("Fetch, resolve, and hydrate the catalogs configured in federation.sources.").option("--no-cache", "Download all federation content and refresh the cache.").option("-v, --verbose", "Show detailed federation diagnostics.").action(async (commandOptions) => {
3549
3609
  logger.welcome();
3550
- if (import_fs.default.existsSync(import_node_path21.default.join(dir, ".env"))) {
3551
- import_dotenv.default.config({ path: import_node_path21.default.join(dir, ".env") });
3610
+ if (import_fs.default.existsSync(import_node_path22.default.join(dir, ".env"))) {
3611
+ import_dotenv.default.config({ path: import_node_path22.default.join(dir, ".env") });
3552
3612
  }
3553
3613
  logger.info("Starting federation...", "federation");
3554
3614
  let cleanedPreviousOutput = false;