@eventcatalog/core 2.55.6 → 2.56.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.
@@ -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.55.6";
40
+ var version = "2.56.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-LXA7MV36.js";
4
- import "../chunk-IR245M5L.js";
3
+ } from "../chunk-KO6TU5OM.js";
4
+ import "../chunk-RMZ427FV.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.55.6";
109
+ var version = "2.56.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-TY7QVBPY.js";
4
- import "../chunk-LXA7MV36.js";
5
- import "../chunk-IR245M5L.js";
3
+ } from "../chunk-BN73V2HE.js";
4
+ import "../chunk-KO6TU5OM.js";
5
+ import "../chunk-RMZ427FV.js";
6
6
  import "../chunk-UPONRQSN.js";
7
7
  export {
8
8
  log_build_default as default
@@ -0,0 +1,26 @@
1
+ import {
2
+ getEventCatalogConfigFile
3
+ } from "./chunk-UPONRQSN.js";
4
+
5
+ // src/features.ts
6
+ import { join } from "path";
7
+ import fs from "fs";
8
+ var getProjectOutDir = async () => {
9
+ const config = await getEventCatalogConfigFile(process.env.PROJECT_DIR || "");
10
+ return config?.outDir || "dist";
11
+ };
12
+ var isOutputServer = async () => {
13
+ const config = await getEventCatalogConfigFile(process.env.PROJECT_DIR || "");
14
+ return config?.output === "server";
15
+ };
16
+ var isAuthEnabled = async () => {
17
+ const directory = process.env.PROJECT_DIR || process.cwd();
18
+ const hasAuthConfig = fs.existsSync(join(directory, "eventcatalog.auth.js"));
19
+ return hasAuthConfig;
20
+ };
21
+
22
+ export {
23
+ getProjectOutDir,
24
+ isOutputServer,
25
+ isAuthEnabled
26
+ };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  raiseEvent
3
- } from "./chunk-LXA7MV36.js";
3
+ } from "./chunk-KO6TU5OM.js";
4
4
  import {
5
5
  getEventCatalogConfigFile,
6
6
  verifyRequiredFieldsAreInCatalogConfigFile
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VERSION
3
- } from "./chunk-IR245M5L.js";
3
+ } from "./chunk-RMZ427FV.js";
4
4
 
5
5
  // src/analytics/analytics.js
6
6
  import axios from "axios";
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "2.55.6";
2
+ var version = "2.56.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.55.6";
28
+ var version = "2.56.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-IR245M5L.js";
3
+ } from "./chunk-RMZ427FV.js";
4
4
  export {
5
5
  VERSION
6
6
  };
@@ -157,7 +157,7 @@ var import_axios = __toESM(require("axios"), 1);
157
157
  var import_os = __toESM(require("os"), 1);
158
158
 
159
159
  // package.json
160
- var version = "2.55.6";
160
+ var version = "2.56.0";
161
161
 
162
162
  // src/constants.ts
163
163
  var VERSION = version;
@@ -195,7 +195,7 @@ var getFeatures = async (configFile) => {
195
195
  output: configFile.output || "static"
196
196
  };
197
197
  };
198
- var main = async (projectDir, { isEventCatalogStarterEnabled: isEventCatalogStarterEnabled2, isEventCatalogScaleEnabled: isEventCatalogScaleEnabled2, isBackstagePluginEnabled: isBackstagePluginEnabled2 }) => {
198
+ var main = async (projectDir, { isEventCatalogStarterEnabled: isEventCatalogStarterEnabled2, isEventCatalogScaleEnabled: isEventCatalogScaleEnabled2, isBackstagePluginEnabled }) => {
199
199
  if (process.env.NODE_ENV === "CI") return;
200
200
  try {
201
201
  await verifyRequiredFieldsAreInCatalogConfigFile(projectDir);
@@ -208,7 +208,7 @@ var main = async (projectDir, { isEventCatalogStarterEnabled: isEventCatalogStar
208
208
  if (isEventCatalogScaleEnabled2) {
209
209
  generatorNames.push("@eventcatalog/eventcatalog-scale");
210
210
  }
211
- if (isBackstagePluginEnabled2) {
211
+ if (isBackstagePluginEnabled) {
212
212
  generatorNames.push("@eventcatalog/backstage-plugin-eventcatalog");
213
213
  }
214
214
  const features = await getFeatures(configFile);
@@ -500,10 +500,9 @@ var resolve_catalog_dependencies_default = async (catalogDir, core2) => {
500
500
  };
501
501
 
502
502
  // src/eventcatalog.ts
503
- var import_boxen2 = __toESM(require("boxen"), 1);
503
+ var import_boxen = __toESM(require("boxen"), 1);
504
504
 
505
505
  // src/features.ts
506
- var import_boxen = __toESM(require("boxen"), 1);
507
506
  var import_node_path5 = require("path");
508
507
  var import_node_fs4 = __toESM(require("fs"), 1);
509
508
  var getProjectOutDir = async () => {
@@ -519,137 +518,11 @@ var isAuthEnabled = async () => {
519
518
  const hasAuthConfig = import_node_fs4.default.existsSync((0, import_node_path5.join)(directory, "eventcatalog.auth.js"));
520
519
  return hasAuthConfig;
521
520
  };
522
- var isBackstagePluginEnabled = async (licenseKey) => {
523
- const LICENSE_KEY = process.env.EVENTCATALOG_LICENSE_KEY_BACKSTAGE || process.env.EVENTCATALOG_SCALE_LICENSE_KEY || null;
524
- const acceptedPlugins = ["@eventcatalog/backstage-plugin-eventcatalog", "@eventcatalog/eventcatalog-scale"];
525
- if (!LICENSE_KEY) {
526
- return false;
527
- }
528
- const response = await fetch("https://api.eventcatalog.cloud/functions/v1/license", {
529
- method: "POST",
530
- headers: {
531
- Authorization: `Bearer ${LICENSE_KEY}`,
532
- "Content-Type": "application/json"
533
- }
534
- });
535
- if (response.status !== 200) {
536
- console.log(
537
- "\nTried to verify your backstage license but it is not valid. Please check your license key or purchase a license at https://eventcatalog.cloud/\n"
538
- );
539
- return false;
540
- }
541
- if (response.status === 200) {
542
- const data = await response.json();
543
- if (!acceptedPlugins.includes(data.plugin)) {
544
- console.log(
545
- "\nInvalid license key for backstage integration, please check your license key or purchase a license at https://eventcatalog.cloud/\n"
546
- );
547
- return false;
548
- }
549
- let message = "Backstage integration is enabled for EventCatalog";
550
- if (data.is_trial) {
551
- message += "\nYou are using a trial license for backstage integration.";
552
- }
553
- console.log(
554
- (0, import_boxen.default)(message, {
555
- padding: 1,
556
- margin: 1,
557
- borderColor: "green",
558
- title: data.plugin,
559
- titleAlignment: "center"
560
- })
561
- );
562
- }
563
- return true;
564
- };
565
- var isEventCatalogScaleEnabled = async (licenseKey) => {
566
- const LICENSE_KEY = process.env.EVENTCATALOG_SCALE_LICENSE_KEY || null;
567
- if (!LICENSE_KEY) {
568
- return false;
569
- }
570
- const response = await fetch("https://api.eventcatalog.cloud/functions/v1/license", {
571
- method: "POST",
572
- headers: {
573
- Authorization: `Bearer ${LICENSE_KEY}`,
574
- "Content-Type": "application/json"
575
- }
576
- });
577
- if (response.status !== 200) {
578
- console.log(
579
- "\nTried to verify your EventCatalog Scale plan, but your license key is not valid. Please check your license key or purchase a license at https://eventcatalog.cloud/\n"
580
- );
581
- return false;
582
- }
583
- if (response.status === 200) {
584
- const data = await response.json();
585
- if ("@eventcatalog/eventcatalog-scale" !== data.plugin) {
586
- console.log(
587
- "\nInvalid license key for EventCatalog Scale plan, please check your license key or purchase a license at https://eventcatalog.cloud/\n"
588
- );
589
- return false;
590
- }
591
- let message = "EventCatalog Scale plan is enabled for EventCatalog";
592
- if (data.is_trial) {
593
- message += "\nYou are using a trial license for EventCatalog Scale plan.";
594
- }
595
- console.log(
596
- (0, import_boxen.default)(message, {
597
- padding: 1,
598
- margin: 1,
599
- borderColor: "green",
600
- title: "@eventcatalog/eventcatalog-scale",
601
- titleAlignment: "center"
602
- })
603
- );
604
- }
605
- return true;
606
- };
607
- var isEventCatalogStarterEnabled = async (licenseKey) => {
608
- const LICENSE_KEY = process.env.EVENTCATALOG_STARTER_LICENSE_KEY || null;
609
- if (!LICENSE_KEY) {
610
- return false;
611
- }
612
- const response = await fetch("https://api.eventcatalog.cloud/functions/v1/license", {
613
- method: "POST",
614
- headers: {
615
- Authorization: `Bearer ${LICENSE_KEY}`,
616
- "Content-Type": "application/json"
617
- }
618
- });
619
- if (response.status !== 200) {
620
- console.log(
621
- "\nTried to verify your EventCatalog Starter plan, but your license key is not valid. Please check your license key or purchase a license at https://eventcatalog.cloud/\n"
622
- );
623
- return false;
624
- }
625
- if (response.status === 200) {
626
- const data = await response.json();
627
- if ("@eventcatalog/eventcatalog-starter" !== data.plugin) {
628
- console.log(
629
- "\nInvalid license key for EventCatalog Starter plan, please check your license key or purchase a license at https://eventcatalog.cloud/\n"
630
- );
631
- return false;
632
- }
633
- let message = "EventCatalog Starter plan is enabled for EventCatalog";
634
- if (data.is_trial) {
635
- message += "\nYou are using a trial license for EventCatalog Starter Plan.";
636
- }
637
- console.log(
638
- (0, import_boxen.default)(message, {
639
- padding: 1,
640
- margin: 1,
641
- borderColor: "green",
642
- title: "@eventcatalog/eventcatalog-starter",
643
- titleAlignment: "center"
644
- })
645
- );
646
- }
647
- return true;
648
- };
649
521
 
650
522
  // src/eventcatalog.ts
651
523
  var import_update_notifier = __toESM(require("update-notifier"), 1);
652
524
  var import_dotenv = __toESM(require("dotenv"), 1);
525
+ var import_license = require("@eventcatalog/license");
653
526
  var currentDir = import_node_path7.default.dirname((0, import_node_url.fileURLToPath)(importMetaUrl));
654
527
  var program = new import_commander.Command().version(VERSION);
655
528
  var dir = import_node_path7.default.resolve(process.env.PROJECT_DIR || process.cwd());
@@ -723,7 +596,7 @@ var checkForUpdate = () => {
723
596
  const message = `EventCatalog update available ${notifier.update.current} \u2192 ${notifier.update.latest}
724
597
  Run npm i @eventcatalog/core to update`;
725
598
  console.log(
726
- (0, import_boxen2.default)(message, {
599
+ (0, import_boxen.default)(message, {
727
600
  padding: 1,
728
601
  margin: 1,
729
602
  align: "center",
@@ -758,9 +631,12 @@ program.command("dev").description("Run development server of EventCatalog").opt
758
631
  await checkAndConvertMdToMdx(dir, core);
759
632
  await catalogToAstro(dir, core);
760
633
  await copyServerFiles();
761
- const canEmbedPages = await isBackstagePluginEnabled();
762
- const isEventCatalogStarter = await isEventCatalogStarterEnabled();
763
- const isEventCatalogScale = await isEventCatalogScaleEnabled();
634
+ const canEmbedPages = await (0, import_license.isFeatureEnabled)(
635
+ "@eventcatalog/backstage-plugin-eventcatalog",
636
+ process.env.EVENTCATALOG_LICENSE_KEY_BACKSTAGE
637
+ );
638
+ const isEventCatalogStarter = await (0, import_license.isEventCatalogStarterEnabled)();
639
+ const isEventCatalogScale = await (0, import_license.isEventCatalogScaleEnabled)();
764
640
  await createAuthFileIfNotExists(isEventCatalogScale);
765
641
  checkForUpdate();
766
642
  let watchUnsub;
@@ -775,7 +651,7 @@ program.command("dev").description("Run development server of EventCatalog").opt
775
651
  env: {
776
652
  PROJECT_DIR: dir,
777
653
  CATALOG_DIR: core,
778
- ENABLE_EMBED: canEmbedPages,
654
+ ENABLE_EMBED: canEmbedPages || isEventCatalogScale,
779
655
  EVENTCATALOG_STARTER: isEventCatalogStarter,
780
656
  EVENTCATALOG_SCALE: isEventCatalogScale,
781
657
  NODE_NO_WARNINGS: "1"
@@ -800,15 +676,18 @@ program.command("build").description("Run build of EventCatalog").action(async (
800
676
  }
801
677
  copyCore();
802
678
  await copyServerFiles();
803
- const canEmbedPages = await isBackstagePluginEnabled();
804
- const isEventCatalogStarter = await isEventCatalogStarterEnabled();
805
- const isEventCatalogScale = await isEventCatalogScaleEnabled();
679
+ const canEmbedPages = await (0, import_license.isFeatureEnabled)(
680
+ "@eventcatalog/backstage-plugin-eventcatalog",
681
+ process.env.EVENTCATALOG_LICENSE_KEY_BACKSTAGE
682
+ );
683
+ const isEventCatalogStarter = await (0, import_license.isEventCatalogStarterEnabled)();
684
+ const isEventCatalogScale = await (0, import_license.isEventCatalogScaleEnabled)();
806
685
  const isServerOutput = await isOutputServer();
807
686
  await createAuthFileIfNotExists(isEventCatalogScale);
808
687
  await log_build_default(dir, {
809
688
  isEventCatalogStarterEnabled: isEventCatalogStarter,
810
689
  isEventCatalogScaleEnabled: isEventCatalogScale,
811
- isBackstagePluginEnabled: canEmbedPages
690
+ isBackstagePluginEnabled: canEmbedPages || isEventCatalogScale
812
691
  });
813
692
  await resolve_catalog_dependencies_default(dir, core);
814
693
  await checkAndConvertMdToMdx(dir, core);
@@ -874,26 +753,42 @@ program.command("preview").description("Serves the contents of your eventcatalog
874
753
  if (import_fs2.default.existsSync(import_node_path7.default.join(dir, ".env"))) {
875
754
  import_dotenv.default.config({ path: import_node_path7.default.join(dir, ".env") });
876
755
  }
877
- const canEmbedPages = await isBackstagePluginEnabled();
878
- const isEventCatalogStarter = await isEventCatalogStarterEnabled();
879
- const isEventCatalogScale = await isEventCatalogScaleEnabled();
756
+ const canEmbedPages = await (0, import_license.isFeatureEnabled)(
757
+ "@eventcatalog/backstage-plugin-eventcatalog",
758
+ process.env.EVENTCATALOG_LICENSE_KEY_BACKSTAGE
759
+ );
760
+ const isEventCatalogStarter = await (0, import_license.isEventCatalogStarterEnabled)();
761
+ const isEventCatalogScale = await (0, import_license.isEventCatalogScaleEnabled)();
880
762
  await copyServerFiles();
881
763
  await createAuthFileIfNotExists(isEventCatalogScale);
882
- previewCatalog({ command, canEmbedPages, isEventCatalogStarter, isEventCatalogScale });
764
+ previewCatalog({ command, canEmbedPages: canEmbedPages || isEventCatalogScale, isEventCatalogStarter, isEventCatalogScale });
883
765
  });
884
766
  program.command("start").description("Serves the contents of your eventcatalog build directory").action(async (options, command) => {
885
767
  console.log("Starting preview of your build...");
886
768
  if (import_fs2.default.existsSync(import_node_path7.default.join(dir, ".env"))) {
887
769
  import_dotenv.default.config({ path: import_node_path7.default.join(dir, ".env") });
888
770
  }
889
- const canEmbedPages = await isBackstagePluginEnabled();
890
- const isEventCatalogStarter = await isEventCatalogStarterEnabled();
891
- const isEventCatalogScale = await isEventCatalogScaleEnabled();
771
+ const canEmbedPages = await (0, import_license.isFeatureEnabled)(
772
+ "@eventcatalog/backstage-plugin-eventcatalog",
773
+ process.env.EVENTCATALOG_LICENSE_KEY_BACKSTAGE
774
+ );
775
+ const isEventCatalogStarter = await (0, import_license.isEventCatalogStarterEnabled)();
776
+ const isEventCatalogScale = await (0, import_license.isEventCatalogScaleEnabled)();
892
777
  const isServerOutput = await isOutputServer();
893
778
  if (isServerOutput) {
894
- startServerCatalog({ command, canEmbedPages, isEventCatalogStarter, isEventCatalogScale });
779
+ startServerCatalog({
780
+ command,
781
+ canEmbedPages: canEmbedPages || isEventCatalogScale,
782
+ isEventCatalogStarter,
783
+ isEventCatalogScale
784
+ });
895
785
  } else {
896
- previewCatalog({ command, canEmbedPages, isEventCatalogStarter, isEventCatalogScale });
786
+ previewCatalog({
787
+ command,
788
+ canEmbedPages: canEmbedPages || isEventCatalogScale,
789
+ isEventCatalogStarter,
790
+ isEventCatalogScale
791
+ });
897
792
  }
898
793
  });
899
794
  program.command("generate [siteDir]").description("Start the generator scripts.").action(async () => {
@@ -6,8 +6,8 @@ import {
6
6
  } from "./chunk-PLNJC7NZ.js";
7
7
  import {
8
8
  log_build_default
9
- } from "./chunk-TY7QVBPY.js";
10
- import "./chunk-LXA7MV36.js";
9
+ } from "./chunk-BN73V2HE.js";
10
+ import "./chunk-KO6TU5OM.js";
11
11
  import {
12
12
  catalogToAstro,
13
13
  checkAndConvertMdToMdx
@@ -15,15 +15,12 @@ import {
15
15
  import "./chunk-55D645EH.js";
16
16
  import {
17
17
  VERSION
18
- } from "./chunk-IR245M5L.js";
18
+ } from "./chunk-RMZ427FV.js";
19
19
  import {
20
20
  getProjectOutDir,
21
21
  isAuthEnabled,
22
- isBackstagePluginEnabled,
23
- isEventCatalogScaleEnabled,
24
- isEventCatalogStarterEnabled,
25
22
  isOutputServer
26
- } from "./chunk-I23A46WZ.js";
23
+ } from "./chunk-5VBIXL6C.js";
27
24
  import {
28
25
  generate
29
26
  } from "./chunk-3W6JYTHP.js";
@@ -40,6 +37,7 @@ import concurrently from "concurrently";
40
37
  import boxen from "boxen";
41
38
  import updateNotifier from "update-notifier";
42
39
  import dotenv from "dotenv";
40
+ import { isEventCatalogStarterEnabled, isEventCatalogScaleEnabled, isFeatureEnabled } from "@eventcatalog/license";
43
41
  var currentDir = path.dirname(fileURLToPath(import.meta.url));
44
42
  var program = new Command().version(VERSION);
45
43
  var dir = path.resolve(process.env.PROJECT_DIR || process.cwd());
@@ -148,7 +146,10 @@ program.command("dev").description("Run development server of EventCatalog").opt
148
146
  await checkAndConvertMdToMdx(dir, core);
149
147
  await catalogToAstro(dir, core);
150
148
  await copyServerFiles();
151
- const canEmbedPages = await isBackstagePluginEnabled();
149
+ const canEmbedPages = await isFeatureEnabled(
150
+ "@eventcatalog/backstage-plugin-eventcatalog",
151
+ process.env.EVENTCATALOG_LICENSE_KEY_BACKSTAGE
152
+ );
152
153
  const isEventCatalogStarter = await isEventCatalogStarterEnabled();
153
154
  const isEventCatalogScale = await isEventCatalogScaleEnabled();
154
155
  await createAuthFileIfNotExists(isEventCatalogScale);
@@ -165,7 +166,7 @@ program.command("dev").description("Run development server of EventCatalog").opt
165
166
  env: {
166
167
  PROJECT_DIR: dir,
167
168
  CATALOG_DIR: core,
168
- ENABLE_EMBED: canEmbedPages,
169
+ ENABLE_EMBED: canEmbedPages || isEventCatalogScale,
169
170
  EVENTCATALOG_STARTER: isEventCatalogStarter,
170
171
  EVENTCATALOG_SCALE: isEventCatalogScale,
171
172
  NODE_NO_WARNINGS: "1"
@@ -190,7 +191,10 @@ program.command("build").description("Run build of EventCatalog").action(async (
190
191
  }
191
192
  copyCore();
192
193
  await copyServerFiles();
193
- const canEmbedPages = await isBackstagePluginEnabled();
194
+ const canEmbedPages = await isFeatureEnabled(
195
+ "@eventcatalog/backstage-plugin-eventcatalog",
196
+ process.env.EVENTCATALOG_LICENSE_KEY_BACKSTAGE
197
+ );
194
198
  const isEventCatalogStarter = await isEventCatalogStarterEnabled();
195
199
  const isEventCatalogScale = await isEventCatalogScaleEnabled();
196
200
  const isServerOutput = await isOutputServer();
@@ -198,7 +202,7 @@ program.command("build").description("Run build of EventCatalog").action(async (
198
202
  await log_build_default(dir, {
199
203
  isEventCatalogStarterEnabled: isEventCatalogStarter,
200
204
  isEventCatalogScaleEnabled: isEventCatalogScale,
201
- isBackstagePluginEnabled: canEmbedPages
205
+ isBackstagePluginEnabled: canEmbedPages || isEventCatalogScale
202
206
  });
203
207
  await resolve_catalog_dependencies_default(dir, core);
204
208
  await checkAndConvertMdToMdx(dir, core);
@@ -264,26 +268,42 @@ program.command("preview").description("Serves the contents of your eventcatalog
264
268
  if (fs.existsSync(path.join(dir, ".env"))) {
265
269
  dotenv.config({ path: path.join(dir, ".env") });
266
270
  }
267
- const canEmbedPages = await isBackstagePluginEnabled();
271
+ const canEmbedPages = await isFeatureEnabled(
272
+ "@eventcatalog/backstage-plugin-eventcatalog",
273
+ process.env.EVENTCATALOG_LICENSE_KEY_BACKSTAGE
274
+ );
268
275
  const isEventCatalogStarter = await isEventCatalogStarterEnabled();
269
276
  const isEventCatalogScale = await isEventCatalogScaleEnabled();
270
277
  await copyServerFiles();
271
278
  await createAuthFileIfNotExists(isEventCatalogScale);
272
- previewCatalog({ command, canEmbedPages, isEventCatalogStarter, isEventCatalogScale });
279
+ previewCatalog({ command, canEmbedPages: canEmbedPages || isEventCatalogScale, isEventCatalogStarter, isEventCatalogScale });
273
280
  });
274
281
  program.command("start").description("Serves the contents of your eventcatalog build directory").action(async (options, command) => {
275
282
  console.log("Starting preview of your build...");
276
283
  if (fs.existsSync(path.join(dir, ".env"))) {
277
284
  dotenv.config({ path: path.join(dir, ".env") });
278
285
  }
279
- const canEmbedPages = await isBackstagePluginEnabled();
286
+ const canEmbedPages = await isFeatureEnabled(
287
+ "@eventcatalog/backstage-plugin-eventcatalog",
288
+ process.env.EVENTCATALOG_LICENSE_KEY_BACKSTAGE
289
+ );
280
290
  const isEventCatalogStarter = await isEventCatalogStarterEnabled();
281
291
  const isEventCatalogScale = await isEventCatalogScaleEnabled();
282
292
  const isServerOutput = await isOutputServer();
283
293
  if (isServerOutput) {
284
- startServerCatalog({ command, canEmbedPages, isEventCatalogStarter, isEventCatalogScale });
294
+ startServerCatalog({
295
+ command,
296
+ canEmbedPages: canEmbedPages || isEventCatalogScale,
297
+ isEventCatalogStarter,
298
+ isEventCatalogScale
299
+ });
285
300
  } else {
286
- previewCatalog({ command, canEmbedPages, isEventCatalogStarter, isEventCatalogScale });
301
+ previewCatalog({
302
+ command,
303
+ canEmbedPages: canEmbedPages || isEventCatalogScale,
304
+ isEventCatalogStarter,
305
+ isEventCatalogScale
306
+ });
287
307
  }
288
308
  });
289
309
  program.command("generate [siteDir]").description("Start the generator scripts.").action(async () => {
package/dist/features.cjs CHANGED
@@ -32,13 +32,9 @@ var features_exports = {};
32
32
  __export(features_exports, {
33
33
  getProjectOutDir: () => getProjectOutDir,
34
34
  isAuthEnabled: () => isAuthEnabled,
35
- isBackstagePluginEnabled: () => isBackstagePluginEnabled,
36
- isEventCatalogScaleEnabled: () => isEventCatalogScaleEnabled,
37
- isEventCatalogStarterEnabled: () => isEventCatalogStarterEnabled,
38
35
  isOutputServer: () => isOutputServer
39
36
  });
40
37
  module.exports = __toCommonJS(features_exports);
41
- var import_boxen = __toESM(require("boxen"), 1);
42
38
 
43
39
  // src/eventcatalog-config-file-utils.js
44
40
  var import_promises = require("fs/promises");
@@ -90,139 +86,9 @@ var isAuthEnabled = async () => {
90
86
  const hasAuthConfig = import_node_fs2.default.existsSync((0, import_node_path2.join)(directory, "eventcatalog.auth.js"));
91
87
  return hasAuthConfig;
92
88
  };
93
- var isBackstagePluginEnabled = async (licenseKey) => {
94
- const LICENSE_KEY = process.env.EVENTCATALOG_LICENSE_KEY_BACKSTAGE || process.env.EVENTCATALOG_SCALE_LICENSE_KEY || null;
95
- const acceptedPlugins = ["@eventcatalog/backstage-plugin-eventcatalog", "@eventcatalog/eventcatalog-scale"];
96
- if (!LICENSE_KEY) {
97
- return false;
98
- }
99
- const response = await fetch("https://api.eventcatalog.cloud/functions/v1/license", {
100
- method: "POST",
101
- headers: {
102
- Authorization: `Bearer ${LICENSE_KEY}`,
103
- "Content-Type": "application/json"
104
- }
105
- });
106
- if (response.status !== 200) {
107
- console.log(
108
- "\nTried to verify your backstage license but it is not valid. Please check your license key or purchase a license at https://eventcatalog.cloud/\n"
109
- );
110
- return false;
111
- }
112
- if (response.status === 200) {
113
- const data = await response.json();
114
- if (!acceptedPlugins.includes(data.plugin)) {
115
- console.log(
116
- "\nInvalid license key for backstage integration, please check your license key or purchase a license at https://eventcatalog.cloud/\n"
117
- );
118
- return false;
119
- }
120
- let message = "Backstage integration is enabled for EventCatalog";
121
- if (data.is_trial) {
122
- message += "\nYou are using a trial license for backstage integration.";
123
- }
124
- console.log(
125
- (0, import_boxen.default)(message, {
126
- padding: 1,
127
- margin: 1,
128
- borderColor: "green",
129
- title: data.plugin,
130
- titleAlignment: "center"
131
- })
132
- );
133
- }
134
- return true;
135
- };
136
- var isEventCatalogScaleEnabled = async (licenseKey) => {
137
- const LICENSE_KEY = process.env.EVENTCATALOG_SCALE_LICENSE_KEY || null;
138
- if (!LICENSE_KEY) {
139
- return false;
140
- }
141
- const response = await fetch("https://api.eventcatalog.cloud/functions/v1/license", {
142
- method: "POST",
143
- headers: {
144
- Authorization: `Bearer ${LICENSE_KEY}`,
145
- "Content-Type": "application/json"
146
- }
147
- });
148
- if (response.status !== 200) {
149
- console.log(
150
- "\nTried to verify your EventCatalog Scale plan, but your license key is not valid. Please check your license key or purchase a license at https://eventcatalog.cloud/\n"
151
- );
152
- return false;
153
- }
154
- if (response.status === 200) {
155
- const data = await response.json();
156
- if ("@eventcatalog/eventcatalog-scale" !== data.plugin) {
157
- console.log(
158
- "\nInvalid license key for EventCatalog Scale plan, please check your license key or purchase a license at https://eventcatalog.cloud/\n"
159
- );
160
- return false;
161
- }
162
- let message = "EventCatalog Scale plan is enabled for EventCatalog";
163
- if (data.is_trial) {
164
- message += "\nYou are using a trial license for EventCatalog Scale plan.";
165
- }
166
- console.log(
167
- (0, import_boxen.default)(message, {
168
- padding: 1,
169
- margin: 1,
170
- borderColor: "green",
171
- title: "@eventcatalog/eventcatalog-scale",
172
- titleAlignment: "center"
173
- })
174
- );
175
- }
176
- return true;
177
- };
178
- var isEventCatalogStarterEnabled = async (licenseKey) => {
179
- const LICENSE_KEY = process.env.EVENTCATALOG_STARTER_LICENSE_KEY || null;
180
- if (!LICENSE_KEY) {
181
- return false;
182
- }
183
- const response = await fetch("https://api.eventcatalog.cloud/functions/v1/license", {
184
- method: "POST",
185
- headers: {
186
- Authorization: `Bearer ${LICENSE_KEY}`,
187
- "Content-Type": "application/json"
188
- }
189
- });
190
- if (response.status !== 200) {
191
- console.log(
192
- "\nTried to verify your EventCatalog Starter plan, but your license key is not valid. Please check your license key or purchase a license at https://eventcatalog.cloud/\n"
193
- );
194
- return false;
195
- }
196
- if (response.status === 200) {
197
- const data = await response.json();
198
- if ("@eventcatalog/eventcatalog-starter" !== data.plugin) {
199
- console.log(
200
- "\nInvalid license key for EventCatalog Starter plan, please check your license key or purchase a license at https://eventcatalog.cloud/\n"
201
- );
202
- return false;
203
- }
204
- let message = "EventCatalog Starter plan is enabled for EventCatalog";
205
- if (data.is_trial) {
206
- message += "\nYou are using a trial license for EventCatalog Starter Plan.";
207
- }
208
- console.log(
209
- (0, import_boxen.default)(message, {
210
- padding: 1,
211
- margin: 1,
212
- borderColor: "green",
213
- title: "@eventcatalog/eventcatalog-starter",
214
- titleAlignment: "center"
215
- })
216
- );
217
- }
218
- return true;
219
- };
220
89
  // Annotate the CommonJS export names for ESM import in node:
221
90
  0 && (module.exports = {
222
91
  getProjectOutDir,
223
92
  isAuthEnabled,
224
- isBackstagePluginEnabled,
225
- isEventCatalogScaleEnabled,
226
- isEventCatalogStarterEnabled,
227
93
  isOutputServer
228
94
  });
@@ -1,8 +1,5 @@
1
1
  declare const getProjectOutDir: () => Promise<any>;
2
2
  declare const isOutputServer: () => Promise<boolean>;
3
3
  declare const isAuthEnabled: () => Promise<boolean>;
4
- declare const isBackstagePluginEnabled: (licenseKey?: string) => Promise<boolean>;
5
- declare const isEventCatalogScaleEnabled: (licenseKey?: string) => Promise<boolean>;
6
- declare const isEventCatalogStarterEnabled: (licenseKey?: string) => Promise<boolean>;
7
4
 
8
- export { getProjectOutDir, isAuthEnabled, isBackstagePluginEnabled, isEventCatalogScaleEnabled, isEventCatalogStarterEnabled, isOutputServer };
5
+ export { getProjectOutDir, isAuthEnabled, isOutputServer };
@@ -1,8 +1,5 @@
1
1
  declare const getProjectOutDir: () => Promise<any>;
2
2
  declare const isOutputServer: () => Promise<boolean>;
3
3
  declare const isAuthEnabled: () => Promise<boolean>;
4
- declare const isBackstagePluginEnabled: (licenseKey?: string) => Promise<boolean>;
5
- declare const isEventCatalogScaleEnabled: (licenseKey?: string) => Promise<boolean>;
6
- declare const isEventCatalogStarterEnabled: (licenseKey?: string) => Promise<boolean>;
7
4
 
8
- export { getProjectOutDir, isAuthEnabled, isBackstagePluginEnabled, isEventCatalogScaleEnabled, isEventCatalogStarterEnabled, isOutputServer };
5
+ export { getProjectOutDir, isAuthEnabled, isOutputServer };
package/dist/features.js CHANGED
@@ -1,17 +1,11 @@
1
1
  import {
2
2
  getProjectOutDir,
3
3
  isAuthEnabled,
4
- isBackstagePluginEnabled,
5
- isEventCatalogScaleEnabled,
6
- isEventCatalogStarterEnabled,
7
4
  isOutputServer
8
- } from "./chunk-I23A46WZ.js";
5
+ } from "./chunk-5VBIXL6C.js";
9
6
  import "./chunk-UPONRQSN.js";
10
7
  export {
11
8
  getProjectOutDir,
12
9
  isAuthEnabled,
13
- isBackstagePluginEnabled,
14
- isEventCatalogScaleEnabled,
15
- isEventCatalogStarterEnabled,
16
10
  isOutputServer
17
11
  };
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "url": "https://github.com/event-catalog/eventcatalog.git"
7
7
  },
8
8
  "type": "module",
9
- "version": "2.55.6",
9
+ "version": "2.56.0",
10
10
  "publishConfig": {
11
11
  "access": "public"
12
12
  },
@@ -24,9 +24,9 @@
24
24
  "@ai-sdk/anthropic": "^1.2.11",
25
25
  "@ai-sdk/google": "^1.2.17",
26
26
  "@ai-sdk/openai": "^1.3.16",
27
- "@astrojs/markdown-remark": "^6.3.3",
28
- "@astrojs/mdx": "^4.3.1",
29
- "@astrojs/node": "^9.3.1",
27
+ "@astrojs/markdown-remark": "^6.3.6",
28
+ "@astrojs/mdx": "^4.3.4",
29
+ "@astrojs/node": "^9.4.3",
30
30
  "@astrojs/react": "^4.3.0",
31
31
  "@astrojs/rss": "^4.0.12",
32
32
  "@astrojs/tailwind": "^6.0.2",
@@ -35,6 +35,7 @@
35
35
  "@asyncapi/react-component": "^2.4.3",
36
36
  "@auth/core": "^0.37.4",
37
37
  "@eventcatalog/generator-ai": "^1.1.0",
38
+ "@eventcatalog/license": "^0.0.6",
38
39
  "@eventcatalog/linter": "^0.0.2",
39
40
  "@eventcatalog/sdk": "^2.2.7",
40
41
  "@eventcatalog/visualizer": "^0.0.5",
@@ -57,7 +58,7 @@
57
58
  "@tanstack/react-table": "^8.17.3",
58
59
  "@xyflow/react": "^12.3.6",
59
60
  "ai": "^4.3.9",
60
- "astro": "^5.12.5",
61
+ "astro": "^5.13.5",
61
62
  "astro-compress": "^2.3.8",
62
63
  "astro-expressive-code": "^0.40.1",
63
64
  "astro-seo": "^0.8.4",
@@ -1,157 +0,0 @@
1
- import {
2
- getEventCatalogConfigFile
3
- } from "./chunk-UPONRQSN.js";
4
-
5
- // src/features.ts
6
- import boxen from "boxen";
7
- import { join } from "path";
8
- import fs from "fs";
9
- var getProjectOutDir = async () => {
10
- const config = await getEventCatalogConfigFile(process.env.PROJECT_DIR || "");
11
- return config?.outDir || "dist";
12
- };
13
- var isOutputServer = async () => {
14
- const config = await getEventCatalogConfigFile(process.env.PROJECT_DIR || "");
15
- return config?.output === "server";
16
- };
17
- var isAuthEnabled = async () => {
18
- const directory = process.env.PROJECT_DIR || process.cwd();
19
- const hasAuthConfig = fs.existsSync(join(directory, "eventcatalog.auth.js"));
20
- return hasAuthConfig;
21
- };
22
- var isBackstagePluginEnabled = async (licenseKey) => {
23
- const LICENSE_KEY = process.env.EVENTCATALOG_LICENSE_KEY_BACKSTAGE || process.env.EVENTCATALOG_SCALE_LICENSE_KEY || null;
24
- const acceptedPlugins = ["@eventcatalog/backstage-plugin-eventcatalog", "@eventcatalog/eventcatalog-scale"];
25
- if (!LICENSE_KEY) {
26
- return false;
27
- }
28
- const response = await fetch("https://api.eventcatalog.cloud/functions/v1/license", {
29
- method: "POST",
30
- headers: {
31
- Authorization: `Bearer ${LICENSE_KEY}`,
32
- "Content-Type": "application/json"
33
- }
34
- });
35
- if (response.status !== 200) {
36
- console.log(
37
- "\nTried to verify your backstage license but it is not valid. Please check your license key or purchase a license at https://eventcatalog.cloud/\n"
38
- );
39
- return false;
40
- }
41
- if (response.status === 200) {
42
- const data = await response.json();
43
- if (!acceptedPlugins.includes(data.plugin)) {
44
- console.log(
45
- "\nInvalid license key for backstage integration, please check your license key or purchase a license at https://eventcatalog.cloud/\n"
46
- );
47
- return false;
48
- }
49
- let message = "Backstage integration is enabled for EventCatalog";
50
- if (data.is_trial) {
51
- message += "\nYou are using a trial license for backstage integration.";
52
- }
53
- console.log(
54
- boxen(message, {
55
- padding: 1,
56
- margin: 1,
57
- borderColor: "green",
58
- title: data.plugin,
59
- titleAlignment: "center"
60
- })
61
- );
62
- }
63
- return true;
64
- };
65
- var isEventCatalogScaleEnabled = async (licenseKey) => {
66
- const LICENSE_KEY = process.env.EVENTCATALOG_SCALE_LICENSE_KEY || null;
67
- if (!LICENSE_KEY) {
68
- return false;
69
- }
70
- const response = await fetch("https://api.eventcatalog.cloud/functions/v1/license", {
71
- method: "POST",
72
- headers: {
73
- Authorization: `Bearer ${LICENSE_KEY}`,
74
- "Content-Type": "application/json"
75
- }
76
- });
77
- if (response.status !== 200) {
78
- console.log(
79
- "\nTried to verify your EventCatalog Scale plan, but your license key is not valid. Please check your license key or purchase a license at https://eventcatalog.cloud/\n"
80
- );
81
- return false;
82
- }
83
- if (response.status === 200) {
84
- const data = await response.json();
85
- if ("@eventcatalog/eventcatalog-scale" !== data.plugin) {
86
- console.log(
87
- "\nInvalid license key for EventCatalog Scale plan, please check your license key or purchase a license at https://eventcatalog.cloud/\n"
88
- );
89
- return false;
90
- }
91
- let message = "EventCatalog Scale plan is enabled for EventCatalog";
92
- if (data.is_trial) {
93
- message += "\nYou are using a trial license for EventCatalog Scale plan.";
94
- }
95
- console.log(
96
- boxen(message, {
97
- padding: 1,
98
- margin: 1,
99
- borderColor: "green",
100
- title: "@eventcatalog/eventcatalog-scale",
101
- titleAlignment: "center"
102
- })
103
- );
104
- }
105
- return true;
106
- };
107
- var isEventCatalogStarterEnabled = async (licenseKey) => {
108
- const LICENSE_KEY = process.env.EVENTCATALOG_STARTER_LICENSE_KEY || null;
109
- if (!LICENSE_KEY) {
110
- return false;
111
- }
112
- const response = await fetch("https://api.eventcatalog.cloud/functions/v1/license", {
113
- method: "POST",
114
- headers: {
115
- Authorization: `Bearer ${LICENSE_KEY}`,
116
- "Content-Type": "application/json"
117
- }
118
- });
119
- if (response.status !== 200) {
120
- console.log(
121
- "\nTried to verify your EventCatalog Starter plan, but your license key is not valid. Please check your license key or purchase a license at https://eventcatalog.cloud/\n"
122
- );
123
- return false;
124
- }
125
- if (response.status === 200) {
126
- const data = await response.json();
127
- if ("@eventcatalog/eventcatalog-starter" !== data.plugin) {
128
- console.log(
129
- "\nInvalid license key for EventCatalog Starter plan, please check your license key or purchase a license at https://eventcatalog.cloud/\n"
130
- );
131
- return false;
132
- }
133
- let message = "EventCatalog Starter plan is enabled for EventCatalog";
134
- if (data.is_trial) {
135
- message += "\nYou are using a trial license for EventCatalog Starter Plan.";
136
- }
137
- console.log(
138
- boxen(message, {
139
- padding: 1,
140
- margin: 1,
141
- borderColor: "green",
142
- title: "@eventcatalog/eventcatalog-starter",
143
- titleAlignment: "center"
144
- })
145
- );
146
- }
147
- return true;
148
- };
149
-
150
- export {
151
- getProjectOutDir,
152
- isOutputServer,
153
- isAuthEnabled,
154
- isBackstagePluginEnabled,
155
- isEventCatalogScaleEnabled,
156
- isEventCatalogStarterEnabled
157
- };