@eventcatalog/core 5.0.2 → 5.1.1

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 (33) 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-QS6PIAHG.js → chunk-BAUH53EV.js} +1 -1
  10. package/dist/{chunk-AI5SK4WP.js → chunk-BEBDEEDY.js} +3 -3
  11. package/dist/chunk-E6WTCJUL.js +32 -0
  12. package/dist/{chunk-MSRXEI5A.js → chunk-GKEHJQ5K.js} +1 -1
  13. package/dist/{chunk-D73WCJQD.js → chunk-NJTLAFFT.js} +1 -1
  14. package/dist/{chunk-OX6TSVHY.js → chunk-QJ7KKN2D.js} +1 -1
  15. package/dist/{chunk-A7AVNA6M.js → chunk-UCUZ44U2.js} +1 -1
  16. package/dist/constants.cjs +1 -1
  17. package/dist/constants.js +1 -1
  18. package/dist/docs/api/02-config.md +21 -0
  19. package/dist/docs/development/guides/96-architecture-reference.md +95 -0
  20. package/dist/eventcatalog.cjs +182 -133
  21. package/dist/eventcatalog.config.d.cts +12 -0
  22. package/dist/eventcatalog.config.d.ts +12 -0
  23. package/dist/eventcatalog.js +40 -12
  24. package/dist/federation/federate.js +3 -3
  25. package/dist/federation/source-provider.js +2 -2
  26. package/dist/generate.cjs +1 -1
  27. package/dist/generate.js +3 -3
  28. package/dist/runtime-dependencies/@eventcatalog__exporters.mjs +3 -0
  29. package/dist/runtime-dependencies/manifest.json +1 -0
  30. package/dist/utils/cli-logger.cjs +1 -1
  31. package/dist/utils/cli-logger.js +2 -2
  32. package/package.json +4 -3
  33. package/dist/{chunk-6K7XZAYI.js → chunk-A2RZR3U4.js} +3 -3
@@ -36,7 +36,7 @@ module.exports = __toCommonJS(analytics_exports);
36
36
  var import_os = __toESM(require("os"), 1);
37
37
 
38
38
  // package.json
39
- var version = "5.0.2";
39
+ var version = "5.1.1";
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-A7AVNA6M.js";
3
+ } from "../chunk-UCUZ44U2.js";
4
4
  import "../chunk-CPW6G62V.js";
5
- import "../chunk-MSRXEI5A.js";
5
+ import "../chunk-GKEHJQ5K.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.2";
172
+ var version = "5.1.1";
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-AI5SK4WP.js";
3
+ } from "../chunk-BEBDEEDY.js";
4
4
  import "../chunk-AD7CL772.js";
5
+ import "../chunk-UCUZ44U2.js";
5
6
  import "../chunk-ZAZHAVKB.js";
6
7
  import "../chunk-CA6WCQ2T.js";
7
- import "../chunk-A7AVNA6M.js";
8
8
  import "../chunk-CPW6G62V.js";
9
- import "../chunk-MSRXEI5A.js";
9
+ import "../chunk-GKEHJQ5K.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
+ };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  logger
3
- } from "./chunk-D73WCJQD.js";
3
+ } from "./chunk-NJTLAFFT.js";
4
4
  import {
5
5
  cleanup,
6
6
  getEventCatalogConfigFile
@@ -1,6 +1,9 @@
1
1
  import {
2
2
  getLicenseAnalytics
3
3
  } from "./chunk-AD7CL772.js";
4
+ import {
5
+ raiseEvent
6
+ } from "./chunk-UCUZ44U2.js";
4
7
  import {
5
8
  countResources,
6
9
  hashCatalogContent,
@@ -11,9 +14,6 @@ import {
11
14
  getStudioMode,
12
15
  serializeStudioUsage
13
16
  } from "./chunk-CA6WCQ2T.js";
14
- import {
15
- raiseEvent
16
- } from "./chunk-A7AVNA6M.js";
17
17
  import {
18
18
  TELEMETRY_REQUEST_TIMEOUT_MS,
19
19
  isTelemetryDisabled
@@ -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
+ };
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "5.0.2";
2
+ var version = "5.1.1";
3
3
 
4
4
  // src/constants.ts
5
5
  var VERSION = version;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VERSION
3
- } from "./chunk-MSRXEI5A.js";
3
+ } from "./chunk-GKEHJQ5K.js";
4
4
 
5
5
  // src/utils/cli-logger.ts
6
6
  import pc from "picocolors";
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-5EPNFDT5.js";
7
7
  import {
8
8
  createFederationSourceProvider
9
- } from "./chunk-6K7XZAYI.js";
9
+ } from "./chunk-A2RZR3U4.js";
10
10
  import {
11
11
  createFederationContentCache
12
12
  } from "./chunk-R7Z5ALYI.js";
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-CPW6G62V.js";
5
5
  import {
6
6
  VERSION
7
- } from "./chunk-MSRXEI5A.js";
7
+ } from "./chunk-GKEHJQ5K.js";
8
8
 
9
9
  // src/analytics/analytics.js
10
10
  import os from "os";
@@ -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.2";
28
+ var version = "5.1.1";
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-MSRXEI5A.js";
3
+ } from "./chunk-GKEHJQ5K.js";
4
4
  export {
5
5
  VERSION
6
6
  };
@@ -968,6 +968,27 @@ Enable tools like Claude, ChatGPT, GitHub Copilot, and Cursor to quickly underst
968
968
  See the [LLMs documentation](/docs/development/ask-your-architecture/llms.txt) for more information, how you can use it and examples.
969
969
 
970
970
 
971
+ ### `exports.html` {#exports.html}
972
+
973
+ <AddedIn version="5.1.0" />
974
+
975
+ - Type: `object`
976
+ - Default: `{ enabled: true }` (`false` when your catalog uses authentication)
977
+
978
+ Controls the [architecture reference](/docs/development/guides/architecture-reference): your whole catalog as one HTML file, written to `architecture.html` in your build output on every build.
979
+
980
+ ```js title="eventcatalog.config.js"
981
+ module.exports = {
982
+ exports: {
983
+ html: {
984
+ enabled: false, // default is true
985
+ },
986
+ },
987
+ };
988
+ ```
989
+
990
+ Catalogs with authentication only get the reference when `enabled` is `true`, because files in the build output are served without the authentication checks.
991
+
971
992
  ### `fullCatalogAPIEnabled` {#fullCatalogAPIEnabled}
972
993
 
973
994
  <AddedIn version="3.10.2" />
@@ -0,0 +1,95 @@
1
+ ---
2
+ sidebar_position: 96
3
+ keywords:
4
+ - EventCatalog architecture reference
5
+ - Export architecture documentation
6
+ - Single HTML file
7
+ - Share architecture
8
+ sidebar_label: Architecture Reference
9
+ title: Architecture reference
10
+ description: Export your whole catalog as one self-contained HTML file you can share, attach or host anywhere.
11
+ ---
12
+
13
+ import AddedIn from '@site/src/components/MDX/AddedIn';
14
+
15
+ <AddedIn version="5.1.0" />
16
+
17
+ The architecture reference is your whole catalog in **one self-contained HTML file**. Every domain, system, service, message, channel, data store, flow, entity and team gets its own section, linked to everything it relates to.
18
+
19
+ It doesn't need a server: everything is in the file, so you can attach it to an email, add it to a design review, keep it with an audit, or host it next to your catalog.
20
+
21
+ ![The overview of an architecture reference, listing the domains, systems and services in the sidebar and a summary of the catalog](./img/architecture-reference-overview.png)
22
+
23
+ [See demo architecture reference](https://demo.eventcatalog.dev/architecture.html)
24
+
25
+ ## What's in it
26
+
27
+ - **An overview of the catalog**, with how many of each resource it documents.
28
+ - **A section for every resource**, with its summary, owners, badges and documentation (including mermaid diagrams).
29
+ - **Relationships on every section**: who produces and consumes a message, what a service sends and receives, which services read and write a data store, what lives inside a domain or system. Every relationship is a link.
30
+ - **Message attributes** from your JSON Schema, Avro and Protobuf schemas, with an example payload, a TypeScript type and the raw schema.
31
+ - **Your specifications** (OpenAPI, AsyncAPI and GraphQL), which you can view and download from the page.
32
+ - **Flows**, step by step, with every resource each step touches.
33
+ - **Search** across the document (press `⌘K` or `Ctrl+K`), a sidebar filter, and light and dark themes.
34
+
35
+ Only the latest version of each resource is included. Resources marked as hidden are left out.
36
+
37
+ ![A message in the architecture reference, with its attributes, producers, consumers and an example payload](./img/architecture-reference-message.png)
38
+
39
+ ## Get it on every build
40
+
41
+ The reference is generated every time you build your catalog. You don't need to set anything up.
42
+
43
+ ```bash
44
+ npm run build
45
+ ```
46
+
47
+ It is written to `dist/architecture.html`, or to `dist/client/architecture.html` when your catalog [runs in server mode](/docs/development/deployment/build-ssr-mode). Wherever you host your catalog, the reference is available at `/architecture.html`.
48
+
49
+ ### Turn it off
50
+
51
+ Set `exports.html.enabled` to `false` in your `eventcatalog.config.js` file:
52
+
53
+ ```js title="eventcatalog.config.js"
54
+ module.exports = {
55
+ exports: {
56
+ html: {
57
+ enabled: false,
58
+ },
59
+ },
60
+ };
61
+ ```
62
+
63
+ ### Catalogs with authentication
64
+
65
+ If your catalog uses [authentication](/docs/development/authentication/introduction), the reference is **not** generated unless you turn it on. Files in the build output are served without the authentication checks, so anyone who knows the URL could read it.
66
+
67
+ To generate it anyway, set `exports.html.enabled` to `true`.
68
+
69
+ ## Export it with the CLI
70
+
71
+ Use the [`export` command](/docs/cli/cli-export) of the [EventCatalog CLI](/docs/cli) to export the reference on demand, without building the catalog. From the root of your catalog, run:
72
+
73
+ ```bash
74
+ npx @eventcatalog/cli export --format html
75
+ ```
76
+
77
+ This writes `architecture.html` and opens it in your browser.
78
+
79
+ | Option | Description |
80
+ | --- | --- |
81
+ | `--output <path>` | Where to write the file. Defaults to `architecture.html` |
82
+ | `--no-open` | Don't open the reference in your browser (useful in CI) |
83
+ | `--dir <path>` | Path to your catalog, if you aren't running the command from it |
84
+
85
+ For example, to export the reference in a CI pipeline and publish it as a build artifact:
86
+
87
+ ```bash
88
+ npx @eventcatalog/cli export --format html --output reports/architecture.html --no-open
89
+ ```
90
+
91
+ ## Sharing the reference
92
+
93
+ The reference uses the `title`, `organizationName` and `logo` from your `eventcatalog.config.js` file. When you share a link to a hosted reference in Slack, Teams or on social media, the preview shows the catalog's name and what it documents.
94
+
95
+ The file shows when it was generated, and the command to generate it again.