@eventcatalog/core 2.42.10 → 2.43.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 (56) 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.js +2 -2
  6. package/dist/{chunk-K7RD2O76.js → chunk-4DXH4NAT.js} +1 -1
  7. package/dist/{chunk-ZG2E6QCK.js → chunk-IZ7E57FH.js} +1 -1
  8. package/dist/{chunk-HDG7YSFG.js → chunk-LUUBKWYP.js} +8 -0
  9. package/dist/{chunk-QVBE3VN4.js → chunk-MXNHNGRS.js} +1 -1
  10. package/dist/constants.cjs +1 -1
  11. package/dist/constants.js +1 -1
  12. package/dist/eventcatalog.auth.cjs +18 -0
  13. package/dist/eventcatalog.auth.d.cts +18 -0
  14. package/dist/eventcatalog.auth.d.ts +18 -0
  15. package/dist/eventcatalog.auth.js +0 -0
  16. package/dist/eventcatalog.cjs +50 -23
  17. package/dist/eventcatalog.js +29 -8
  18. package/dist/features.cjs +9 -0
  19. package/dist/features.d.cts +2 -1
  20. package/dist/features.d.ts +2 -1
  21. package/dist/features.js +3 -1
  22. package/dist/watcher.js +1 -1
  23. package/eventcatalog/astro.config.mjs +7 -3
  24. package/eventcatalog/auth.config.ts +142 -0
  25. package/eventcatalog/src/components/Header.astro +125 -25
  26. package/eventcatalog/src/middleware.ts +62 -0
  27. package/eventcatalog/src/pages/auth/error.astro +55 -0
  28. package/eventcatalog/src/pages/auth/login.astro +231 -0
  29. package/eventcatalog/src/pages/directory/[type]/_index.data.ts +63 -0
  30. package/eventcatalog/src/pages/directory/[type]/index.astro +6 -23
  31. package/eventcatalog/src/pages/discover/[type]/_index.data.ts +62 -0
  32. package/eventcatalog/src/pages/discover/[type]/index.astro +7 -24
  33. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/_index.data.ts +62 -0
  34. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/asyncapi/[filename].astro +5 -37
  35. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/asyncapi/_[filename].data.ts +98 -0
  36. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/changelog/_index.data.ts +68 -0
  37. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/changelog/index.astro +5 -25
  38. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/index.astro +6 -25
  39. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/spec/[filename].astro +6 -35
  40. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/spec/_[filename].data.ts +99 -0
  41. package/eventcatalog/src/pages/docs/[type]/[id]/index.astro +1 -0
  42. package/eventcatalog/src/pages/docs/[type]/[id]/language/_index.data.ts +40 -0
  43. package/eventcatalog/src/pages/docs/[type]/[id]/{language.astro → language/index.astro} +6 -20
  44. package/eventcatalog/src/pages/docs/custom/[...path]/_index.data.ts +49 -0
  45. package/eventcatalog/src/pages/docs/custom/[...path]/index.astro +5 -11
  46. package/eventcatalog/src/pages/docs/teams/[id]/_index.data.ts +46 -0
  47. package/eventcatalog/src/pages/docs/teams/[id]/index.astro +6 -10
  48. package/eventcatalog/src/pages/docs/users/[id]/_index.data.ts +46 -0
  49. package/eventcatalog/src/pages/docs/users/[id]/index.astro +5 -9
  50. package/eventcatalog/src/pages/visualiser/[type]/[id]/[version]/_index.data.ts +99 -0
  51. package/eventcatalog/src/pages/visualiser/[type]/[id]/[version]/index.astro +5 -29
  52. package/eventcatalog/src/utils/feature.ts +10 -0
  53. package/eventcatalog/src/utils/page-loaders/hybrid-page.ts +68 -0
  54. package/eventcatalog/tsconfig.json +2 -1
  55. package/package.json +3 -1
  56. package/dist/{chunk-SLEMYHTU.js → chunk-SFA7F3CQ.js} +3 -3
@@ -37,7 +37,7 @@ var import_axios = __toESM(require("axios"), 1);
37
37
  var import_os = __toESM(require("os"), 1);
38
38
 
39
39
  // package.json
40
- var version = "2.42.10";
40
+ var version = "2.43.0";
41
41
 
42
42
  // src/constants.ts
43
43
  var VERSION = version;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  raiseEvent
3
- } from "../chunk-ZG2E6QCK.js";
4
- import "../chunk-QVBE3VN4.js";
3
+ } from "../chunk-IZ7E57FH.js";
4
+ import "../chunk-MXNHNGRS.js";
5
5
  export {
6
6
  raiseEvent
7
7
  };
@@ -106,7 +106,7 @@ var import_axios = __toESM(require("axios"), 1);
106
106
  var import_os = __toESM(require("os"), 1);
107
107
 
108
108
  // package.json
109
- var version = "2.42.10";
109
+ var version = "2.43.0";
110
110
 
111
111
  // src/constants.ts
112
112
  var VERSION = version;
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  log_build_default
3
- } from "../chunk-K7RD2O76.js";
4
- import "../chunk-ZG2E6QCK.js";
5
- import "../chunk-QVBE3VN4.js";
3
+ } from "../chunk-4DXH4NAT.js";
4
+ import "../chunk-IZ7E57FH.js";
5
+ import "../chunk-MXNHNGRS.js";
6
6
  import "../chunk-E7TXTI7G.js";
7
7
  export {
8
8
  log_build_default as default
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  catalogToAstro,
3
3
  checkAndConvertMdToMdx
4
- } from "./chunk-SLEMYHTU.js";
5
- import "./chunk-E7TXTI7G.js";
4
+ } from "./chunk-SFA7F3CQ.js";
6
5
  import "./chunk-EXAALOQA.js";
6
+ import "./chunk-E7TXTI7G.js";
7
7
  export {
8
8
  catalogToAstro,
9
9
  checkAndConvertMdToMdx
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  raiseEvent
3
- } from "./chunk-ZG2E6QCK.js";
3
+ } from "./chunk-IZ7E57FH.js";
4
4
  import {
5
5
  getEventCatalogConfigFile,
6
6
  verifyRequiredFieldsAreInCatalogConfigFile
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VERSION
3
- } from "./chunk-QVBE3VN4.js";
3
+ } from "./chunk-MXNHNGRS.js";
4
4
 
5
5
  // src/analytics/analytics.js
6
6
  import axios from "axios";
@@ -4,10 +4,17 @@ import {
4
4
 
5
5
  // src/features.ts
6
6
  import boxen from "boxen";
7
+ import { join } from "node:path";
8
+ import fs from "node:fs";
7
9
  var isOutputServer = async () => {
8
10
  const config = await getEventCatalogConfigFile(process.env.PROJECT_DIR || "");
9
11
  return config?.output === "server";
10
12
  };
13
+ var isAuthEnabled = async () => {
14
+ const directory = process.env.PROJECT_DIR || process.cwd();
15
+ const hasAuthConfig = fs.existsSync(join(directory, "eventcatalog.auth.js"));
16
+ return hasAuthConfig;
17
+ };
11
18
  var isBackstagePluginEnabled = async (licenseKey) => {
12
19
  const LICENSE_KEY = process.env.EVENTCATALOG_LICENSE_KEY_BACKSTAGE || process.env.EVENTCATALOG_SCALE_LICENSE_KEY || null;
13
20
  const acceptedPlugins = ["@eventcatalog/backstage-plugin-eventcatalog", "@eventcatalog/eventcatalog-scale"];
@@ -138,6 +145,7 @@ var isEventCatalogStarterEnabled = async (licenseKey) => {
138
145
 
139
146
  export {
140
147
  isOutputServer,
148
+ isAuthEnabled,
141
149
  isBackstagePluginEnabled,
142
150
  isEventCatalogScaleEnabled,
143
151
  isEventCatalogStarterEnabled
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "2.42.10";
2
+ var version = "2.43.0";
3
3
 
4
4
  // src/constants.ts
5
5
  var VERSION = version;
@@ -25,7 +25,7 @@ __export(constants_exports, {
25
25
  module.exports = __toCommonJS(constants_exports);
26
26
 
27
27
  // package.json
28
- var version = "2.42.10";
28
+ var version = "2.43.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-QVBE3VN4.js";
3
+ } from "./chunk-MXNHNGRS.js";
4
4
  export {
5
5
  VERSION
6
6
  };
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+
16
+ // src/eventcatalog.auth.ts
17
+ var eventcatalog_auth_exports = {};
18
+ module.exports = __toCommonJS(eventcatalog_auth_exports);
@@ -0,0 +1,18 @@
1
+ import { OAuthUserConfig } from '@auth/core/providers';
2
+ import { GitHubProfile } from '@auth/core/providers/github';
3
+ import { OktaProfile } from '@auth/core/providers/okta';
4
+
5
+ interface EventCatalogAuthConfig {
6
+ providers?: {
7
+ github?: OAuthUserConfig<GitHubProfile>;
8
+ okta?: OAuthUserConfig<OktaProfile>;
9
+ };
10
+ customAuthConfig?: string;
11
+ customMiddleware?: string;
12
+ session?: {
13
+ maxAge?: number;
14
+ updateAge?: number;
15
+ };
16
+ }
17
+
18
+ export type { EventCatalogAuthConfig };
@@ -0,0 +1,18 @@
1
+ import { OAuthUserConfig } from '@auth/core/providers';
2
+ import { GitHubProfile } from '@auth/core/providers/github';
3
+ import { OktaProfile } from '@auth/core/providers/okta';
4
+
5
+ interface EventCatalogAuthConfig {
6
+ providers?: {
7
+ github?: OAuthUserConfig<GitHubProfile>;
8
+ okta?: OAuthUserConfig<OktaProfile>;
9
+ };
10
+ customAuthConfig?: string;
11
+ customMiddleware?: string;
12
+ session?: {
13
+ maxAge?: number;
14
+ updateAge?: number;
15
+ };
16
+ }
17
+
18
+ export type { EventCatalogAuthConfig };
File without changes
@@ -29,9 +29,9 @@ var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
29
29
  // src/eventcatalog.ts
30
30
  var import_commander = require("commander");
31
31
  var import_node_child_process = require("child_process");
32
- var import_node_path6 = require("path");
32
+ var import_node_path7 = require("path");
33
33
  var import_fs2 = __toESM(require("fs"), 1);
34
- var import_node_path7 = __toESM(require("path"), 1);
34
+ var import_node_path8 = __toESM(require("path"), 1);
35
35
  var import_node_url = require("url");
36
36
  var import_concurrently = __toESM(require("concurrently"), 1);
37
37
 
@@ -157,7 +157,7 @@ var import_axios = __toESM(require("axios"), 1);
157
157
  var import_os = __toESM(require("os"), 1);
158
158
 
159
159
  // package.json
160
- var version = "2.42.10";
160
+ var version = "2.43.0";
161
161
 
162
162
  // src/constants.ts
163
163
  var VERSION = version;
@@ -480,10 +480,17 @@ var import_boxen2 = __toESM(require("boxen"), 1);
480
480
 
481
481
  // src/features.ts
482
482
  var import_boxen = __toESM(require("boxen"), 1);
483
+ var import_node_path6 = require("path");
484
+ var import_node_fs4 = __toESM(require("fs"), 1);
483
485
  var isOutputServer = async () => {
484
486
  const config = await getEventCatalogConfigFile(process.env.PROJECT_DIR || "");
485
487
  return config?.output === "server";
486
488
  };
489
+ var isAuthEnabled = async () => {
490
+ const directory = process.env.PROJECT_DIR || process.cwd();
491
+ const hasAuthConfig = import_node_fs4.default.existsSync((0, import_node_path6.join)(directory, "eventcatalog.auth.js"));
492
+ return hasAuthConfig;
493
+ };
487
494
  var isBackstagePluginEnabled = async (licenseKey) => {
488
495
  const LICENSE_KEY = process.env.EVENTCATALOG_LICENSE_KEY_BACKSTAGE || process.env.EVENTCATALOG_SCALE_LICENSE_KEY || null;
489
496
  const acceptedPlugins = ["@eventcatalog/backstage-plugin-eventcatalog", "@eventcatalog/eventcatalog-scale"];
@@ -615,14 +622,14 @@ var isEventCatalogStarterEnabled = async (licenseKey) => {
615
622
  // src/eventcatalog.ts
616
623
  var import_update_notifier = __toESM(require("update-notifier"), 1);
617
624
  var import_dotenv = __toESM(require("dotenv"), 1);
618
- var currentDir = import_node_path7.default.dirname((0, import_node_url.fileURLToPath)(importMetaUrl));
625
+ var currentDir = import_node_path8.default.dirname((0, import_node_url.fileURLToPath)(importMetaUrl));
619
626
  var program = new import_commander.Command().version(VERSION);
620
- var dir = import_node_path7.default.resolve(process.env.PROJECT_DIR || process.cwd());
621
- var core = import_node_path7.default.resolve(process.env.CATALOG_DIR || (0, import_node_path6.join)(dir, ".eventcatalog-core"));
622
- var eventCatalogDir = import_node_path7.default.resolve((0, import_node_path6.join)(currentDir, "../eventcatalog/"));
627
+ var dir = import_node_path8.default.resolve(process.env.PROJECT_DIR || process.cwd());
628
+ var core = import_node_path8.default.resolve(process.env.CATALOG_DIR || (0, import_node_path7.join)(dir, ".eventcatalog-core"));
629
+ var eventCatalogDir = import_node_path8.default.resolve((0, import_node_path7.join)(currentDir, "../eventcatalog/"));
623
630
  var getInstalledEventCatalogVersion = () => {
624
631
  try {
625
- const pkg = import_fs2.default.readFileSync((0, import_node_path6.join)(dir, "package.json"), "utf8");
632
+ const pkg = import_fs2.default.readFileSync((0, import_node_path7.join)(dir, "package.json"), "utf8");
626
633
  const json = JSON.parse(pkg);
627
634
  return json.dependencies["@eventcatalog/core"];
628
635
  } catch (error) {
@@ -649,16 +656,33 @@ var copyCore = () => {
649
656
  };
650
657
  var copyServerFiles = async () => {
651
658
  const isServerOutput = await isOutputServer();
652
- if (import_fs2.default.existsSync((0, import_node_path6.join)(core, "src/pages/api/server"))) {
653
- import_fs2.default.rmSync((0, import_node_path6.join)(core, "src/pages/api/server"), { recursive: true });
659
+ if (import_fs2.default.existsSync((0, import_node_path7.join)(core, "src/pages/api/server"))) {
660
+ import_fs2.default.rmSync((0, import_node_path7.join)(core, "src/pages/api/server"), { recursive: true });
654
661
  }
655
662
  if (!isServerOutput) {
656
663
  return;
657
664
  }
658
- import_fs2.default.cpSync((0, import_node_path6.join)(eventCatalogDir, "src/enterprise/eventcatalog-chat/pages/api"), (0, import_node_path6.join)(core, "src/pages/api/server"), {
665
+ import_fs2.default.cpSync((0, import_node_path7.join)(eventCatalogDir, "src/enterprise/eventcatalog-chat/pages/api"), (0, import_node_path7.join)(core, "src/pages/api/server"), {
659
666
  recursive: true
660
667
  });
661
668
  };
669
+ var createAuthFileIfNotExists = async (hasRequiredLicense) => {
670
+ const authEnabled = await isAuthEnabled();
671
+ const isSRR = await isOutputServer();
672
+ try {
673
+ if (authEnabled && hasRequiredLicense && isSRR) {
674
+ console.log("Creating auth file");
675
+ import_fs2.default.writeFileSync(
676
+ (0, import_node_path7.join)(core, "src/pages/api/[...auth].ts"),
677
+ `import { AstroAuth } from 'auth-astro/server';
678
+ export const prerender = false;
679
+ export const { GET, POST } = AstroAuth();
680
+ `
681
+ );
682
+ }
683
+ } catch (error) {
684
+ }
685
+ };
662
686
  var clearCore = () => {
663
687
  if (import_fs2.default.existsSync(core)) import_fs2.default.rmSync(core, { recursive: true });
664
688
  };
@@ -692,8 +716,8 @@ Run npm i @eventcatalog/core to update`;
692
716
  };
693
717
  program.command("dev").description("Run development server of EventCatalog").option("-d, --debug", "Output EventCatalog application information into your terminal").option("--force-recreate", "Recreate the eventcatalog-core directory", false).action(async (options, command) => {
694
718
  console.log("Setting up EventCatalog....");
695
- if (import_fs2.default.existsSync(import_node_path7.default.join(dir, ".env"))) {
696
- import_dotenv.default.config({ path: import_node_path7.default.join(dir, ".env") });
719
+ if (import_fs2.default.existsSync(import_node_path8.default.join(dir, ".env"))) {
720
+ import_dotenv.default.config({ path: import_node_path8.default.join(dir, ".env") });
697
721
  }
698
722
  if (options.debug) {
699
723
  console.log("Debug mode enabled");
@@ -709,6 +733,7 @@ program.command("dev").description("Run development server of EventCatalog").opt
709
733
  const canEmbedPages = await isBackstagePluginEnabled();
710
734
  const isEventCatalogStarter = await isEventCatalogStarterEnabled();
711
735
  const isEventCatalogScale = await isEventCatalogScaleEnabled();
736
+ await createAuthFileIfNotExists(isEventCatalogScale);
712
737
  checkForUpdate();
713
738
  let watchUnsub;
714
739
  try {
@@ -717,7 +742,7 @@ program.command("dev").description("Run development server of EventCatalog").opt
717
742
  [
718
743
  {
719
744
  name: "astro",
720
- command: process.platform === "win32" ? `npx astro dev ${command.args.join(" ").trim()} 2>&1 | findstr /V /C:"[glob-loader]" /C:"The collection"` : `npx astro dev ${command.args.join(" ").trim()} 2>&1 | grep -v -e "\\[glob-loader\\]" -e "The collection.*does not exist"`,
745
+ command: process.platform === "win32" ? `npx astro dev ${command.args.join(" ").trim()} 2>&1 | findstr /V /C:"[glob-loader]" /C:"The collection" /C:"[router]"` : `npx astro dev ${command.args.join(" ").trim()} 2>&1 | grep -v -e "\\[glob-loader\\]" -e "The collection.*does not exist" -e "\\[router\\]"`,
721
746
  cwd: core,
722
747
  env: {
723
748
  PROJECT_DIR: dir,
@@ -742,14 +767,15 @@ program.command("dev").description("Run development server of EventCatalog").opt
742
767
  });
743
768
  program.command("build").description("Run build of EventCatalog").action(async (options, command) => {
744
769
  console.log("Building EventCatalog...");
745
- if (import_fs2.default.existsSync(import_node_path7.default.join(dir, ".env"))) {
746
- import_dotenv.default.config({ path: import_node_path7.default.join(dir, ".env") });
770
+ if (import_fs2.default.existsSync(import_node_path8.default.join(dir, ".env"))) {
771
+ import_dotenv.default.config({ path: import_node_path8.default.join(dir, ".env") });
747
772
  }
748
773
  copyCore();
749
774
  await copyServerFiles();
750
775
  const canEmbedPages = await isBackstagePluginEnabled();
751
776
  const isEventCatalogStarter = await isEventCatalogStarterEnabled();
752
777
  const isEventCatalogScale = await isEventCatalogScaleEnabled();
778
+ await createAuthFileIfNotExists(isEventCatalogScale);
753
779
  await log_build_default(dir, {
754
780
  isEventCatalogStarterEnabled: isEventCatalogStarter,
755
781
  isEventCatalogScaleEnabled: isEventCatalogScale,
@@ -760,7 +786,7 @@ program.command("build").description("Run build of EventCatalog").action(async (
760
786
  await catalogToAstro(dir, core);
761
787
  checkForUpdate();
762
788
  const windowsCommand = `npx astro build ${command.args.join(" ").trim()} | findstr /V "The collection"`;
763
- const unixCommand = `bash -c "set -o pipefail; npx astro build ${command.args.join(" ").trim()} 2>&1 | grep -v \\"The collection.*does not exist\\""`;
789
+ const unixCommand = `bash -c "set -o pipefail; npx astro build ${command.args.join(" ").trim()} 2>&1 | grep -v -e \\"\\\\[router\\\\]\\" -e \\"The collection.*does not exist\\""`;
764
790
  const buildCommand = process.platform === "win32" ? windowsCommand : unixCommand;
765
791
  (0, import_node_child_process.execSync)(
766
792
  `cross-env PROJECT_DIR='${dir}' CATALOG_DIR='${core}' ENABLE_EMBED=${canEmbedPages} EVENTCATALOG_STARTER=${isEventCatalogStarter} EVENTCATALOG_SCALE=${isEventCatalogScale} ${buildCommand}`,
@@ -800,19 +826,20 @@ var startServerCatalog = ({
800
826
  };
801
827
  program.command("preview").description("Serves the contents of your eventcatalog build directory").action(async (options, command) => {
802
828
  console.log("Starting preview of your build...");
803
- if (import_fs2.default.existsSync(import_node_path7.default.join(dir, ".env"))) {
804
- import_dotenv.default.config({ path: import_node_path7.default.join(dir, ".env") });
829
+ if (import_fs2.default.existsSync(import_node_path8.default.join(dir, ".env"))) {
830
+ import_dotenv.default.config({ path: import_node_path8.default.join(dir, ".env") });
805
831
  }
806
832
  const canEmbedPages = await isBackstagePluginEnabled();
807
833
  const isEventCatalogStarter = await isEventCatalogStarterEnabled();
808
834
  const isEventCatalogScale = await isEventCatalogScaleEnabled();
809
835
  await copyServerFiles();
836
+ await createAuthFileIfNotExists(isEventCatalogScale);
810
837
  previewCatalog({ command, canEmbedPages, isEventCatalogStarter, isEventCatalogScale });
811
838
  });
812
839
  program.command("start").description("Serves the contents of your eventcatalog build directory").action(async (options, command) => {
813
840
  console.log("Starting preview of your build...");
814
- if (import_fs2.default.existsSync(import_node_path7.default.join(dir, ".env"))) {
815
- import_dotenv.default.config({ path: import_node_path7.default.join(dir, ".env") });
841
+ if (import_fs2.default.existsSync(import_node_path8.default.join(dir, ".env"))) {
842
+ import_dotenv.default.config({ path: import_node_path8.default.join(dir, ".env") });
816
843
  }
817
844
  const canEmbedPages = await isBackstagePluginEnabled();
818
845
  const isEventCatalogStarter = await isEventCatalogStarterEnabled();
@@ -825,8 +852,8 @@ program.command("start").description("Serves the contents of your eventcatalog b
825
852
  }
826
853
  });
827
854
  program.command("generate [siteDir]").description("Start the generator scripts.").action(async () => {
828
- if (import_fs2.default.existsSync(import_node_path7.default.join(dir, ".env"))) {
829
- import_dotenv.default.config({ path: import_node_path7.default.join(dir, ".env") });
855
+ if (import_fs2.default.existsSync(import_node_path8.default.join(dir, ".env"))) {
856
+ import_dotenv.default.config({ path: import_node_path8.default.join(dir, ".env") });
830
857
  }
831
858
  await generate(dir);
832
859
  });
@@ -6,26 +6,27 @@ import {
6
6
  } from "./chunk-DCLTVJDP.js";
7
7
  import {
8
8
  log_build_default
9
- } from "./chunk-K7RD2O76.js";
10
- import "./chunk-ZG2E6QCK.js";
9
+ } from "./chunk-4DXH4NAT.js";
10
+ import "./chunk-IZ7E57FH.js";
11
11
  import {
12
12
  catalogToAstro,
13
13
  checkAndConvertMdToMdx
14
- } from "./chunk-SLEMYHTU.js";
14
+ } from "./chunk-SFA7F3CQ.js";
15
+ import "./chunk-EXAALOQA.js";
15
16
  import {
16
17
  VERSION
17
- } from "./chunk-QVBE3VN4.js";
18
+ } from "./chunk-MXNHNGRS.js";
18
19
  import {
20
+ isAuthEnabled,
19
21
  isBackstagePluginEnabled,
20
22
  isEventCatalogScaleEnabled,
21
23
  isEventCatalogStarterEnabled,
22
24
  isOutputServer
23
- } from "./chunk-HDG7YSFG.js";
25
+ } from "./chunk-LUUBKWYP.js";
24
26
  import {
25
27
  generate
26
28
  } from "./chunk-YEQVKHST.js";
27
29
  import "./chunk-E7TXTI7G.js";
28
- import "./chunk-EXAALOQA.js";
29
30
 
30
31
  // src/eventcatalog.ts
31
32
  import { Command } from "commander";
@@ -82,6 +83,23 @@ var copyServerFiles = async () => {
82
83
  recursive: true
83
84
  });
84
85
  };
86
+ var createAuthFileIfNotExists = async (hasRequiredLicense) => {
87
+ const authEnabled = await isAuthEnabled();
88
+ const isSRR = await isOutputServer();
89
+ try {
90
+ if (authEnabled && hasRequiredLicense && isSRR) {
91
+ console.log("Creating auth file");
92
+ fs.writeFileSync(
93
+ join(core, "src/pages/api/[...auth].ts"),
94
+ `import { AstroAuth } from 'auth-astro/server';
95
+ export const prerender = false;
96
+ export const { GET, POST } = AstroAuth();
97
+ `
98
+ );
99
+ }
100
+ } catch (error) {
101
+ }
102
+ };
85
103
  var clearCore = () => {
86
104
  if (fs.existsSync(core)) fs.rmSync(core, { recursive: true });
87
105
  };
@@ -132,6 +150,7 @@ program.command("dev").description("Run development server of EventCatalog").opt
132
150
  const canEmbedPages = await isBackstagePluginEnabled();
133
151
  const isEventCatalogStarter = await isEventCatalogStarterEnabled();
134
152
  const isEventCatalogScale = await isEventCatalogScaleEnabled();
153
+ await createAuthFileIfNotExists(isEventCatalogScale);
135
154
  checkForUpdate();
136
155
  let watchUnsub;
137
156
  try {
@@ -140,7 +159,7 @@ program.command("dev").description("Run development server of EventCatalog").opt
140
159
  [
141
160
  {
142
161
  name: "astro",
143
- command: process.platform === "win32" ? `npx astro dev ${command.args.join(" ").trim()} 2>&1 | findstr /V /C:"[glob-loader]" /C:"The collection"` : `npx astro dev ${command.args.join(" ").trim()} 2>&1 | grep -v -e "\\[glob-loader\\]" -e "The collection.*does not exist"`,
162
+ command: process.platform === "win32" ? `npx astro dev ${command.args.join(" ").trim()} 2>&1 | findstr /V /C:"[glob-loader]" /C:"The collection" /C:"[router]"` : `npx astro dev ${command.args.join(" ").trim()} 2>&1 | grep -v -e "\\[glob-loader\\]" -e "The collection.*does not exist" -e "\\[router\\]"`,
144
163
  cwd: core,
145
164
  env: {
146
165
  PROJECT_DIR: dir,
@@ -173,6 +192,7 @@ program.command("build").description("Run build of EventCatalog").action(async (
173
192
  const canEmbedPages = await isBackstagePluginEnabled();
174
193
  const isEventCatalogStarter = await isEventCatalogStarterEnabled();
175
194
  const isEventCatalogScale = await isEventCatalogScaleEnabled();
195
+ await createAuthFileIfNotExists(isEventCatalogScale);
176
196
  await log_build_default(dir, {
177
197
  isEventCatalogStarterEnabled: isEventCatalogStarter,
178
198
  isEventCatalogScaleEnabled: isEventCatalogScale,
@@ -183,7 +203,7 @@ program.command("build").description("Run build of EventCatalog").action(async (
183
203
  await catalogToAstro(dir, core);
184
204
  checkForUpdate();
185
205
  const windowsCommand = `npx astro build ${command.args.join(" ").trim()} | findstr /V "The collection"`;
186
- const unixCommand = `bash -c "set -o pipefail; npx astro build ${command.args.join(" ").trim()} 2>&1 | grep -v \\"The collection.*does not exist\\""`;
206
+ const unixCommand = `bash -c "set -o pipefail; npx astro build ${command.args.join(" ").trim()} 2>&1 | grep -v -e \\"\\\\[router\\\\]\\" -e \\"The collection.*does not exist\\""`;
187
207
  const buildCommand = process.platform === "win32" ? windowsCommand : unixCommand;
188
208
  execSync(
189
209
  `cross-env PROJECT_DIR='${dir}' CATALOG_DIR='${core}' ENABLE_EMBED=${canEmbedPages} EVENTCATALOG_STARTER=${isEventCatalogStarter} EVENTCATALOG_SCALE=${isEventCatalogScale} ${buildCommand}`,
@@ -230,6 +250,7 @@ program.command("preview").description("Serves the contents of your eventcatalog
230
250
  const isEventCatalogStarter = await isEventCatalogStarterEnabled();
231
251
  const isEventCatalogScale = await isEventCatalogScaleEnabled();
232
252
  await copyServerFiles();
253
+ await createAuthFileIfNotExists(isEventCatalogScale);
233
254
  previewCatalog({ command, canEmbedPages, isEventCatalogStarter, isEventCatalogScale });
234
255
  });
235
256
  program.command("start").description("Serves the contents of your eventcatalog build directory").action(async (options, command) => {
package/dist/features.cjs CHANGED
@@ -30,6 +30,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // src/features.ts
31
31
  var features_exports = {};
32
32
  __export(features_exports, {
33
+ isAuthEnabled: () => isAuthEnabled,
33
34
  isBackstagePluginEnabled: () => isBackstagePluginEnabled,
34
35
  isEventCatalogScaleEnabled: () => isEventCatalogScaleEnabled,
35
36
  isEventCatalogStarterEnabled: () => isEventCatalogStarterEnabled,
@@ -73,10 +74,17 @@ var getEventCatalogConfigFile = async (projectDirectory) => {
73
74
  };
74
75
 
75
76
  // src/features.ts
77
+ var import_node_path2 = require("path");
78
+ var import_node_fs2 = __toESM(require("fs"), 1);
76
79
  var isOutputServer = async () => {
77
80
  const config = await getEventCatalogConfigFile(process.env.PROJECT_DIR || "");
78
81
  return config?.output === "server";
79
82
  };
83
+ var isAuthEnabled = async () => {
84
+ const directory = process.env.PROJECT_DIR || process.cwd();
85
+ const hasAuthConfig = import_node_fs2.default.existsSync((0, import_node_path2.join)(directory, "eventcatalog.auth.js"));
86
+ return hasAuthConfig;
87
+ };
80
88
  var isBackstagePluginEnabled = async (licenseKey) => {
81
89
  const LICENSE_KEY = process.env.EVENTCATALOG_LICENSE_KEY_BACKSTAGE || process.env.EVENTCATALOG_SCALE_LICENSE_KEY || null;
82
90
  const acceptedPlugins = ["@eventcatalog/backstage-plugin-eventcatalog", "@eventcatalog/eventcatalog-scale"];
@@ -206,6 +214,7 @@ var isEventCatalogStarterEnabled = async (licenseKey) => {
206
214
  };
207
215
  // Annotate the CommonJS export names for ESM import in node:
208
216
  0 && (module.exports = {
217
+ isAuthEnabled,
209
218
  isBackstagePluginEnabled,
210
219
  isEventCatalogScaleEnabled,
211
220
  isEventCatalogStarterEnabled,
@@ -1,6 +1,7 @@
1
1
  declare const isOutputServer: () => Promise<boolean>;
2
+ declare const isAuthEnabled: () => Promise<boolean>;
2
3
  declare const isBackstagePluginEnabled: (licenseKey?: string) => Promise<boolean>;
3
4
  declare const isEventCatalogScaleEnabled: (licenseKey?: string) => Promise<boolean>;
4
5
  declare const isEventCatalogStarterEnabled: (licenseKey?: string) => Promise<boolean>;
5
6
 
6
- export { isBackstagePluginEnabled, isEventCatalogScaleEnabled, isEventCatalogStarterEnabled, isOutputServer };
7
+ export { isAuthEnabled, isBackstagePluginEnabled, isEventCatalogScaleEnabled, isEventCatalogStarterEnabled, isOutputServer };
@@ -1,6 +1,7 @@
1
1
  declare const isOutputServer: () => Promise<boolean>;
2
+ declare const isAuthEnabled: () => Promise<boolean>;
2
3
  declare const isBackstagePluginEnabled: (licenseKey?: string) => Promise<boolean>;
3
4
  declare const isEventCatalogScaleEnabled: (licenseKey?: string) => Promise<boolean>;
4
5
  declare const isEventCatalogStarterEnabled: (licenseKey?: string) => Promise<boolean>;
5
6
 
6
- export { isBackstagePluginEnabled, isEventCatalogScaleEnabled, isEventCatalogStarterEnabled, isOutputServer };
7
+ export { isAuthEnabled, isBackstagePluginEnabled, isEventCatalogScaleEnabled, isEventCatalogStarterEnabled, isOutputServer };
package/dist/features.js CHANGED
@@ -1,11 +1,13 @@
1
1
  import {
2
+ isAuthEnabled,
2
3
  isBackstagePluginEnabled,
3
4
  isEventCatalogScaleEnabled,
4
5
  isEventCatalogStarterEnabled,
5
6
  isOutputServer
6
- } from "./chunk-HDG7YSFG.js";
7
+ } from "./chunk-LUUBKWYP.js";
7
8
  import "./chunk-E7TXTI7G.js";
8
9
  export {
10
+ isAuthEnabled,
9
11
  isBackstagePluginEnabled,
10
12
  isEventCatalogScaleEnabled,
11
13
  isEventCatalogStarterEnabled,
package/dist/watcher.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  watch
3
3
  } from "./chunk-DCLTVJDP.js";
4
- import "./chunk-E7TXTI7G.js";
5
4
  import "./chunk-EXAALOQA.js";
5
+ import "./chunk-E7TXTI7G.js";
6
6
  export {
7
7
  watch
8
8
  };
@@ -9,6 +9,7 @@ import remarkDirective from 'remark-directive';
9
9
  import { remarkDirectives } from "./src/remark-plugins/directives"
10
10
  import node from '@astrojs/node';
11
11
  import remarkComment from 'remark-comment'
12
+ import auth from 'auth-astro';
12
13
 
13
14
  /** @type {import('bin/eventcatalog.config').Config} */
14
15
  import config from './eventcatalog.config';
@@ -23,7 +24,7 @@ export default defineConfig({
23
24
  base,
24
25
  server: { port: config.port || 3000, host: host },
25
26
 
26
- // output: config.output || 'static',
27
+ output: config.output || 'static',
27
28
 
28
29
  adapter: config.output === 'server' ? node({
29
30
  mode: 'standalone'
@@ -61,8 +62,8 @@ export default defineConfig({
61
62
  remarkPlugins: [remarkDirective, remarkDirectives, remarkComment, mermaid],
62
63
  gfm: true,
63
64
  }),
64
- pagefind(),
65
- ],
65
+ config.output !== 'server' && pagefind(),
66
+ ].filter(Boolean),
66
67
  vite: {
67
68
  define: {
68
69
  /**
@@ -81,5 +82,8 @@ export default defineConfig({
81
82
  transformMixedEsModules: true,
82
83
  }
83
84
  },
85
+ ssr: {
86
+ external: ['eventcatalog.auth.js'],
87
+ }
84
88
  }
85
89
  });