@eventcatalog/core 5.0.1 → 5.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) 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/architecture-export.cjs +69 -0
  6. package/dist/architecture-export.d.cts +48 -0
  7. package/dist/architecture-export.d.ts +48 -0
  8. package/dist/architecture-export.js +12 -0
  9. package/dist/chunk-E6WTCJUL.js +32 -0
  10. package/dist/{chunk-KTXSCPEK.js → chunk-FHZXZWCY.js} +1 -1
  11. package/dist/{chunk-YPWK5ITM.js → chunk-G3CHTDAE.js} +1 -1
  12. package/dist/{chunk-UWAXRTAJ.js → chunk-OT57IOWN.js} +1 -1
  13. package/dist/{chunk-HFR5OPHV.js → chunk-TBXLUIJD.js} +1 -1
  14. package/dist/{chunk-DVHJTQWQ.js → chunk-WBUSFEBH.js} +1 -1
  15. package/dist/constants.cjs +1 -1
  16. package/dist/constants.js +1 -1
  17. package/dist/eventcatalog.cjs +182 -133
  18. package/dist/eventcatalog.config.d.cts +12 -0
  19. package/dist/eventcatalog.config.d.ts +12 -0
  20. package/dist/eventcatalog.js +42 -14
  21. package/dist/federation/federate.js +2 -2
  22. package/dist/generate.cjs +1 -1
  23. package/dist/generate.js +3 -3
  24. package/dist/runtime-dependencies/@eventcatalog__exporters.mjs +3 -0
  25. package/dist/runtime-dependencies/manifest.json +1 -0
  26. package/dist/utils/cli-logger.cjs +1 -1
  27. package/dist/utils/cli-logger.js +2 -2
  28. package/eventcatalog/src/components/NewVersionBanner.astro +31 -0
  29. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/[docType]/[docId]/[docVersion]/index.astro +10 -13
  30. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/[docType]/[docId]/index.astro +10 -13
  31. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/graphql/[filename].astro +13 -18
  32. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/index.astro +16 -19
  33. package/eventcatalog/src/utils/collections/resource-type-badge.ts +9 -0
  34. package/eventcatalog/src/utils/collections/util.ts +10 -0
  35. package/eventcatalog/src/utils/version-banner.ts +10 -0
  36. package/package.json +4 -3
  37. package/dist/{chunk-46TBJZC3.js → chunk-QJ7KKN2D.js} +4 -4
@@ -36,7 +36,7 @@ module.exports = __toCommonJS(analytics_exports);
36
36
  var import_os = __toESM(require("os"), 1);
37
37
 
38
38
  // package.json
39
- var version = "5.0.1";
39
+ var version = "5.1.0";
40
40
 
41
41
  // src/constants.ts
42
42
  var VERSION = version;
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  raiseEvent
3
- } from "../chunk-KTXSCPEK.js";
3
+ } from "../chunk-FHZXZWCY.js";
4
4
  import "../chunk-CPW6G62V.js";
5
- import "../chunk-UWAXRTAJ.js";
5
+ import "../chunk-OT57IOWN.js";
6
6
  export {
7
7
  raiseEvent
8
8
  };
@@ -169,7 +169,7 @@ var verifyRequiredFieldsAreInCatalogConfigFile = async (projectDirectory) => {
169
169
  var import_os = __toESM(require("os"), 1);
170
170
 
171
171
  // package.json
172
- var version = "5.0.1";
172
+ var version = "5.1.0";
173
173
 
174
174
  // src/constants.ts
175
175
  var VERSION = version;
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  log_build_default
3
- } from "../chunk-YPWK5ITM.js";
3
+ } from "../chunk-G3CHTDAE.js";
4
4
  import "../chunk-AD7CL772.js";
5
- import "../chunk-KTXSCPEK.js";
5
+ import "../chunk-FHZXZWCY.js";
6
6
  import "../chunk-ZAZHAVKB.js";
7
7
  import "../chunk-CA6WCQ2T.js";
8
8
  import "../chunk-CPW6G62V.js";
9
- import "../chunk-UWAXRTAJ.js";
9
+ import "../chunk-OT57IOWN.js";
10
10
  import "../chunk-4G7FSRPN.js";
11
11
  export {
12
12
  log_build_default as default
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/architecture-export.ts
31
+ var architecture_export_exports = {};
32
+ __export(architecture_export_exports, {
33
+ getArchitectureExportPath: () => getArchitectureExportPath,
34
+ isCatalogAuthEnabled: () => isCatalogAuthEnabled,
35
+ resolveArchitectureExport: () => resolveArchitectureExport,
36
+ writeArchitectureExport: () => writeArchitectureExport
37
+ });
38
+ module.exports = __toCommonJS(architecture_export_exports);
39
+ var import_node_fs = __toESM(require("fs"), 1);
40
+ var import_node_path = __toESM(require("path"), 1);
41
+ var import_exporters = require("@eventcatalog/exporters");
42
+ var isCatalogAuthEnabled = ({
43
+ config,
44
+ projectDir,
45
+ isServer
46
+ }) => Boolean(config?.auth?.enabled) && isServer && import_node_fs.default.existsSync(import_node_path.default.join(projectDir, "eventcatalog.auth.js"));
47
+ var resolveArchitectureExport = (config, { authEnabled }) => {
48
+ const enabled = config?.exports?.html?.enabled;
49
+ if (enabled === false) return { enabled: false, reason: "disabled" };
50
+ if (authEnabled && enabled !== true) return { enabled: false, reason: "auth" };
51
+ return { enabled: true };
52
+ };
53
+ var getArchitectureExportPath = ({ outDir, isServer }) => import_node_path.default.join(outDir, isServer ? "client" : "", "architecture.html");
54
+ var writeArchitectureExport = ({
55
+ projectDir,
56
+ outDir,
57
+ isServer
58
+ }) => (0, import_exporters.writeHtml)({
59
+ dir: projectDir,
60
+ outputPath: getArchitectureExportPath({ outDir, isServer }),
61
+ regenerateCommand: "npx eventcatalog build"
62
+ });
63
+ // Annotate the CommonJS export names for ESM import in node:
64
+ 0 && (module.exports = {
65
+ getArchitectureExportPath,
66
+ isCatalogAuthEnabled,
67
+ resolveArchitectureExport,
68
+ writeArchitectureExport
69
+ });
@@ -0,0 +1,48 @@
1
+ import * as _eventcatalog_exporters from '@eventcatalog/exporters';
2
+
3
+ /** The part of eventcatalog.config.js that controls the architecture reference. */
4
+ interface ArchitectureExportConfig {
5
+ exports?: {
6
+ html?: {
7
+ enabled?: boolean;
8
+ };
9
+ };
10
+ }
11
+ /**
12
+ * Auth is on only when it is configured, the auth file exists and the catalog runs as a server, the same rule the
13
+ * catalog uses at runtime. New catalogs ship a commented-out eventcatalog.auth.js, so the file alone means nothing.
14
+ */
15
+ declare const isCatalogAuthEnabled: ({ config, projectDir, isServer, }: {
16
+ config: {
17
+ auth?: {
18
+ enabled?: boolean;
19
+ };
20
+ } | null | undefined;
21
+ projectDir: string;
22
+ isServer: boolean;
23
+ }) => boolean;
24
+ type ArchitectureExportDecision = {
25
+ enabled: true;
26
+ } | {
27
+ enabled: false;
28
+ reason: 'disabled' | 'auth';
29
+ };
30
+ /**
31
+ * The architecture reference is written on every build unless the catalog turns it off. Catalogs with auth only
32
+ * get it when they opt in: build output is served as static files, outside the auth middleware.
33
+ */
34
+ declare const resolveArchitectureExport: (config: ArchitectureExportConfig | null | undefined, { authEnabled }: {
35
+ authEnabled: boolean;
36
+ }) => ArchitectureExportDecision;
37
+ /** Server builds serve static files from the client folder; static builds from the output folder itself. */
38
+ declare const getArchitectureExportPath: ({ outDir, isServer }: {
39
+ outDir: string;
40
+ isServer: boolean;
41
+ }) => string;
42
+ declare const writeArchitectureExport: ({ projectDir, outDir, isServer, }: {
43
+ projectDir: string;
44
+ outDir: string;
45
+ isServer: boolean;
46
+ }) => Promise<_eventcatalog_exporters.WriteHtmlResult>;
47
+
48
+ export { type ArchitectureExportConfig, type ArchitectureExportDecision, getArchitectureExportPath, isCatalogAuthEnabled, resolveArchitectureExport, writeArchitectureExport };
@@ -0,0 +1,48 @@
1
+ import * as _eventcatalog_exporters from '@eventcatalog/exporters';
2
+
3
+ /** The part of eventcatalog.config.js that controls the architecture reference. */
4
+ interface ArchitectureExportConfig {
5
+ exports?: {
6
+ html?: {
7
+ enabled?: boolean;
8
+ };
9
+ };
10
+ }
11
+ /**
12
+ * Auth is on only when it is configured, the auth file exists and the catalog runs as a server, the same rule the
13
+ * catalog uses at runtime. New catalogs ship a commented-out eventcatalog.auth.js, so the file alone means nothing.
14
+ */
15
+ declare const isCatalogAuthEnabled: ({ config, projectDir, isServer, }: {
16
+ config: {
17
+ auth?: {
18
+ enabled?: boolean;
19
+ };
20
+ } | null | undefined;
21
+ projectDir: string;
22
+ isServer: boolean;
23
+ }) => boolean;
24
+ type ArchitectureExportDecision = {
25
+ enabled: true;
26
+ } | {
27
+ enabled: false;
28
+ reason: 'disabled' | 'auth';
29
+ };
30
+ /**
31
+ * The architecture reference is written on every build unless the catalog turns it off. Catalogs with auth only
32
+ * get it when they opt in: build output is served as static files, outside the auth middleware.
33
+ */
34
+ declare const resolveArchitectureExport: (config: ArchitectureExportConfig | null | undefined, { authEnabled }: {
35
+ authEnabled: boolean;
36
+ }) => ArchitectureExportDecision;
37
+ /** Server builds serve static files from the client folder; static builds from the output folder itself. */
38
+ declare const getArchitectureExportPath: ({ outDir, isServer }: {
39
+ outDir: string;
40
+ isServer: boolean;
41
+ }) => string;
42
+ declare const writeArchitectureExport: ({ projectDir, outDir, isServer, }: {
43
+ projectDir: string;
44
+ outDir: string;
45
+ isServer: boolean;
46
+ }) => Promise<_eventcatalog_exporters.WriteHtmlResult>;
47
+
48
+ export { type ArchitectureExportConfig, type ArchitectureExportDecision, getArchitectureExportPath, isCatalogAuthEnabled, resolveArchitectureExport, writeArchitectureExport };
@@ -0,0 +1,12 @@
1
+ import {
2
+ getArchitectureExportPath,
3
+ isCatalogAuthEnabled,
4
+ resolveArchitectureExport,
5
+ writeArchitectureExport
6
+ } from "./chunk-E6WTCJUL.js";
7
+ export {
8
+ getArchitectureExportPath,
9
+ isCatalogAuthEnabled,
10
+ resolveArchitectureExport,
11
+ writeArchitectureExport
12
+ };
@@ -0,0 +1,32 @@
1
+ // src/architecture-export.ts
2
+ import fs from "fs";
3
+ import path from "path";
4
+ import { writeHtml } from "@eventcatalog/exporters";
5
+ var isCatalogAuthEnabled = ({
6
+ config,
7
+ projectDir,
8
+ isServer
9
+ }) => Boolean(config?.auth?.enabled) && isServer && fs.existsSync(path.join(projectDir, "eventcatalog.auth.js"));
10
+ var resolveArchitectureExport = (config, { authEnabled }) => {
11
+ const enabled = config?.exports?.html?.enabled;
12
+ if (enabled === false) return { enabled: false, reason: "disabled" };
13
+ if (authEnabled && enabled !== true) return { enabled: false, reason: "auth" };
14
+ return { enabled: true };
15
+ };
16
+ var getArchitectureExportPath = ({ outDir, isServer }) => path.join(outDir, isServer ? "client" : "", "architecture.html");
17
+ var writeArchitectureExport = ({
18
+ projectDir,
19
+ outDir,
20
+ isServer
21
+ }) => writeHtml({
22
+ dir: projectDir,
23
+ outputPath: getArchitectureExportPath({ outDir, isServer }),
24
+ regenerateCommand: "npx eventcatalog build"
25
+ });
26
+
27
+ export {
28
+ isCatalogAuthEnabled,
29
+ resolveArchitectureExport,
30
+ getArchitectureExportPath,
31
+ writeArchitectureExport
32
+ };
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-CPW6G62V.js";
5
5
  import {
6
6
  VERSION
7
- } from "./chunk-UWAXRTAJ.js";
7
+ } from "./chunk-OT57IOWN.js";
8
8
 
9
9
  // src/analytics/analytics.js
10
10
  import os from "os";
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-AD7CL772.js";
4
4
  import {
5
5
  raiseEvent
6
- } from "./chunk-KTXSCPEK.js";
6
+ } from "./chunk-FHZXZWCY.js";
7
7
  import {
8
8
  countResources,
9
9
  hashCatalogContent,
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "5.0.1";
2
+ var version = "5.1.0";
3
3
 
4
4
  // src/constants.ts
5
5
  var VERSION = version;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  logger
3
- } from "./chunk-DVHJTQWQ.js";
3
+ } from "./chunk-WBUSFEBH.js";
4
4
  import {
5
5
  cleanup,
6
6
  getEventCatalogConfigFile
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VERSION
3
- } from "./chunk-UWAXRTAJ.js";
3
+ } from "./chunk-OT57IOWN.js";
4
4
 
5
5
  // src/utils/cli-logger.ts
6
6
  import pc from "picocolors";
@@ -25,7 +25,7 @@ __export(constants_exports, {
25
25
  module.exports = __toCommonJS(constants_exports);
26
26
 
27
27
  // package.json
28
- var version = "5.0.1";
28
+ var version = "5.1.0";
29
29
 
30
30
  // src/constants.ts
31
31
  var VERSION = version;
package/dist/constants.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VERSION
3
- } from "./chunk-UWAXRTAJ.js";
3
+ } from "./chunk-OT57IOWN.js";
4
4
  export {
5
5
  VERSION
6
6
  };