@eventcatalog/core 4.3.4 → 4.4.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 (30) 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/{chunk-QFXV3GDK.js → chunk-57CTITPR.js} +1 -1
  6. package/dist/{chunk-OPFRJOPV.js → chunk-JSOK4BIG.js} +1 -1
  7. package/dist/{chunk-CQQE7NTL.js → chunk-LNOQKTI4.js} +1 -1
  8. package/dist/{chunk-5L4FYIAY.js → chunk-P7BFML7F.js} +1 -1
  9. package/dist/{chunk-XTC5VFLE.js → chunk-UWBPGWUW.js} +1 -1
  10. package/dist/constants.cjs +1 -1
  11. package/dist/constants.js +1 -1
  12. package/dist/docs/api/02-config.md +9 -1
  13. package/dist/docs/development/deployment/build-and-deploy.md +7 -1
  14. package/dist/docs/development/guides/98-versioning-resources.md +0 -15
  15. package/dist/docs/development/guides/resources/services/07-versioning-and-lifecycle/01-version-services.md +0 -2
  16. package/dist/docs/plugins/openapi/03-features.md +6 -2
  17. package/dist/eventcatalog.cjs +1 -1
  18. package/dist/eventcatalog.config.d.cts +4 -0
  19. package/dist/eventcatalog.config.d.ts +4 -0
  20. package/dist/eventcatalog.js +5 -5
  21. package/dist/generate.cjs +1 -1
  22. package/dist/generate.js +3 -3
  23. package/dist/utils/cli-logger.cjs +1 -1
  24. package/dist/utils/cli-logger.js +2 -2
  25. package/eventcatalog/astro.config.mjs +2 -6
  26. package/eventcatalog/src/components/SideNav/NestedSideBar/index.tsx +1 -1
  27. package/eventcatalog/src/components/SideNav/NestedSideBar/utils.spec.ts +7 -3
  28. package/eventcatalog/src/components/SideNav/NestedSideBar/utils.ts +2 -1
  29. package/eventcatalog/src/plugins/astro-compress.ts +36 -0
  30. package/package.json +1 -2
@@ -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 = "4.3.4";
39
+ var version = "4.4.0";
40
40
 
41
41
  // src/constants.ts
42
42
  var VERSION = version;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  raiseEvent
3
- } from "../chunk-5L4FYIAY.js";
4
- import "../chunk-OPFRJOPV.js";
3
+ } from "../chunk-P7BFML7F.js";
4
+ import "../chunk-JSOK4BIG.js";
5
5
  export {
6
6
  raiseEvent
7
7
  };
@@ -140,7 +140,7 @@ var verifyRequiredFieldsAreInCatalogConfigFile = async (projectDirectory) => {
140
140
  var import_os = __toESM(require("os"), 1);
141
141
 
142
142
  // package.json
143
- var version = "4.3.4";
143
+ var version = "4.4.0";
144
144
 
145
145
  // src/constants.ts
146
146
  var VERSION = version;
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  log_build_default
3
- } from "../chunk-QFXV3GDK.js";
3
+ } from "../chunk-57CTITPR.js";
4
4
  import "../chunk-K2XIENVT.js";
5
- import "../chunk-5L4FYIAY.js";
6
- import "../chunk-OPFRJOPV.js";
5
+ import "../chunk-P7BFML7F.js";
6
+ import "../chunk-JSOK4BIG.js";
7
7
  import "../chunk-6QENHZZP.js";
8
8
  export {
9
9
  log_build_default as default
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-K2XIENVT.js";
5
5
  import {
6
6
  raiseEvent
7
- } from "./chunk-5L4FYIAY.js";
7
+ } from "./chunk-P7BFML7F.js";
8
8
  import {
9
9
  getEventCatalogConfigFile,
10
10
  verifyRequiredFieldsAreInCatalogConfigFile
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "4.3.4";
2
+ var version = "4.4.0";
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-OPFRJOPV.js";
3
+ } from "./chunk-JSOK4BIG.js";
4
4
 
5
5
  // src/utils/cli-logger.ts
6
6
  import pc from "picocolors";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VERSION
3
- } from "./chunk-OPFRJOPV.js";
3
+ } from "./chunk-JSOK4BIG.js";
4
4
 
5
5
  // src/analytics/analytics.js
6
6
  import os from "os";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  logger
3
- } from "./chunk-CQQE7NTL.js";
3
+ } from "./chunk-LNOQKTI4.js";
4
4
  import {
5
5
  cleanup,
6
6
  getEventCatalogConfigFile
@@ -25,7 +25,7 @@ __export(constants_exports, {
25
25
  module.exports = __toCommonJS(constants_exports);
26
26
 
27
27
  // package.json
28
- var version = "4.3.4";
28
+ var version = "4.4.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-OPFRJOPV.js";
3
+ } from "./chunk-JSOK4BIG.js";
4
4
  export {
5
5
  VERSION
6
6
  };
@@ -704,12 +704,20 @@ module.exports = {
704
704
 
705
705
  - Type: `boolean`
706
706
 
707
- Setting this to true will automatically compress all your CSS, HTML, SVG, JavaScript, JSON and image files in the Astro outDir folder.
707
+ Setting this to true will automatically compress your HTML, SVG, JavaScript, JSON and image files in the Astro outDir folder.
708
708
 
709
709
  This is disabled by default from EventCatalog v2.61.9.
710
710
 
711
711
  **This only works for static builds.**
712
712
 
713
+ <AddedIn version="4.4.0" />
714
+
715
+ `astro-compress` is no longer bundled with EventCatalog. Install it in your EventCatalog project before enabling compression:
716
+
717
+ ```bash
718
+ npm install --save-dev astro-compress
719
+ ```
720
+
713
721
  ```js title="eventcatalog.config.js"
714
722
  module.exports = {
715
723
  compress: true
@@ -46,7 +46,13 @@ npx eventcatalog dev --debug -- --env=production --port=3000
46
46
 
47
47
  You can opt into our build step which will compress your static assets.
48
48
 
49
- You can enable this by setting the [compress option](/docs/api/config#compress) to `true` in your `eventcatalog.config.js` file.
49
+ First install the compression integration in your EventCatalog project:
50
+
51
+ ```bash
52
+ npm install --save-dev astro-compress
53
+ ```
54
+
55
+ Then set the [compress option](/docs/api/config#compress) to `true` in your `eventcatalog.config.js` file.
50
56
 
51
57
  :::info "Why is compression disabled by default?"
52
58
  Compression can increase your build time and the amount of memory required to build your catalog.
@@ -10,7 +10,6 @@ description: Learn how versioning works for EventCatalog resources.
10
10
  ---
11
11
 
12
12
  import ProjectTree from '@site/src/components/MDX/ProjectTree';
13
- import AddedIn from '@site/src/components/MDX/AddedIn';
14
13
 
15
14
  EventCatalog resources can be versioned when you want to preserve how a resource looked at a point in time.
16
15
 
@@ -111,20 +110,6 @@ For example:
111
110
 
112
111
  This lets users compare the current resource with previous versions when they need historical context.
113
112
 
114
- ### Stable URLs for the latest version
115
-
116
- <AddedIn version="4.3.3" />
117
-
118
- For services, the URLs for the latest version and its sub-pages (changelog, specifications, and attached documentation) stay versionless and never change as the service is versioned up.
119
-
120
- | Page | URL |
121
- |------|-----|
122
- | Overview | `/docs/services/Orders` |
123
- | Changelog | `/docs/services/Orders/changelog` |
124
- | OpenAPI spec | `/docs/services/Orders/spec/openapi` |
125
-
126
- Share these links freely. When `Orders` moves from `1.0.0` to `2.0.0`, the versionless URLs keep resolving to whatever is latest, so the link never rots. Historical versions keep their versioned URLs, for example `/docs/services/Orders/1.0.0/changelog`.
127
-
128
113
  ## Referencing versions
129
114
 
130
115
  When one resource references another resource, you can include a `version` field when you want to point to a specific version.
@@ -8,8 +8,6 @@ title: Version services
8
8
  description: Learn how to version services
9
9
  ---
10
10
 
11
- import AddedIn from '@site/src/components/MDX/AddedIn';
12
-
13
11
  All content in EventCatalog can be versioned. This allows you to keep historic versions of content which can give context to users why things are changing.
14
12
 
15
13
  ## How to version a service
@@ -99,12 +99,16 @@ routes: [{ prefix: '/api', suffix: '/events' }]
99
99
  routes: [{ match: '/api/*/track' }]
100
100
  ```
101
101
 
102
- #### How consumers are created and updated
102
+ #### How consumers are looked up and updated
103
103
 
104
- When the generator runs, each consumer service is looked up by `id` and `version`. If a consumer service does not yet exist, it is created automatically with a basic `<NodeGraph />` page. New consumers are placed inside the configured `domain` if one is defined.
104
+ When the generator runs, each consumer service is looked up by `id` and `version`. The consumer service must already exist in the catalog. If it cannot be found, the consumer entry is skipped; the generator does not create a service page or add the consumer to the configured `domain`.
105
105
 
106
106
  If the consumer already exists in the catalog, it is updated in-place so its existing markdown, location, and metadata are preserved. The `sends` list on the consumer is merged with the incoming messages, with deduplication applied. If a consumer entry already tracks a versioned message, its version is updated to the latest value from the spec.
107
107
 
108
+ :::note
109
+ If another generator creates the consumer service, place that generator before the OpenAPI generator that references it. Otherwise, the consumer relationship is skipped for that generation run.
110
+ :::
111
+
108
112
  ---
109
113
 
110
114
  ### Mapping messages as commands, queries or events
@@ -144,7 +144,7 @@ var verifyRequiredFieldsAreInCatalogConfigFile = async (projectDirectory) => {
144
144
  var import_picocolors = __toESM(require("picocolors"), 1);
145
145
 
146
146
  // package.json
147
- var version = "4.3.4";
147
+ var version = "4.4.0";
148
148
 
149
149
  // src/constants.ts
150
150
  var VERSION = version;
@@ -264,6 +264,10 @@ interface Config {
264
264
  allowAnyEnvInSpecHeaders?: boolean;
265
265
  };
266
266
  mdxOptimize?: boolean;
267
+ /**
268
+ * Compress static build output using astro-compress installed in the EventCatalog project.
269
+ * @default false
270
+ */
267
271
  compress?: boolean;
268
272
  pages?: {
269
273
  /**
@@ -264,6 +264,10 @@ interface Config {
264
264
  allowAnyEnvInSpecHeaders?: boolean;
265
265
  };
266
266
  mdxOptimize?: boolean;
267
+ /**
268
+ * Compress static build output using astro-compress installed in the EventCatalog project.
269
+ * @default false
270
+ */
267
271
  compress?: boolean;
268
272
  pages?: {
269
273
  /**
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  log_build_default
3
- } from "./chunk-QFXV3GDK.js";
3
+ } from "./chunk-57CTITPR.js";
4
4
  import "./chunk-K2XIENVT.js";
5
5
  import {
6
6
  runMigrations
@@ -14,10 +14,10 @@ import {
14
14
  } from "./chunk-B7HCX5HM.js";
15
15
  import {
16
16
  generate
17
- } from "./chunk-XTC5VFLE.js";
17
+ } from "./chunk-UWBPGWUW.js";
18
18
  import {
19
19
  logger
20
- } from "./chunk-CQQE7NTL.js";
20
+ } from "./chunk-LNOQKTI4.js";
21
21
  import {
22
22
  resolve_catalog_dependencies_default
23
23
  } from "./chunk-LHR4G2UO.js";
@@ -27,7 +27,7 @@ import {
27
27
  import {
28
28
  watch
29
29
  } from "./chunk-CAJUIMDJ.js";
30
- import "./chunk-5L4FYIAY.js";
30
+ import "./chunk-P7BFML7F.js";
31
31
  import {
32
32
  createAstroDevLineFilter,
33
33
  createAstroLineFilter
@@ -38,7 +38,7 @@ import {
38
38
  import "./chunk-W5JQON7Z.js";
39
39
  import {
40
40
  VERSION
41
- } from "./chunk-OPFRJOPV.js";
41
+ } from "./chunk-JSOK4BIG.js";
42
42
  import {
43
43
  linkCoreNodeModules,
44
44
  resolveInstalledCoreNodeModules
package/dist/generate.cjs CHANGED
@@ -108,7 +108,7 @@ var getEventCatalogConfigFile = async (projectDirectory) => {
108
108
  var import_picocolors = __toESM(require("picocolors"), 1);
109
109
 
110
110
  // package.json
111
- var version = "4.3.4";
111
+ var version = "4.4.0";
112
112
 
113
113
  // src/constants.ts
114
114
  var VERSION = version;
package/dist/generate.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  generate
3
- } from "./chunk-XTC5VFLE.js";
4
- import "./chunk-CQQE7NTL.js";
5
- import "./chunk-OPFRJOPV.js";
3
+ } from "./chunk-UWBPGWUW.js";
4
+ import "./chunk-LNOQKTI4.js";
5
+ import "./chunk-JSOK4BIG.js";
6
6
  import "./chunk-6QENHZZP.js";
7
7
  export {
8
8
  generate
@@ -36,7 +36,7 @@ module.exports = __toCommonJS(cli_logger_exports);
36
36
  var import_picocolors = __toESM(require("picocolors"), 1);
37
37
 
38
38
  // package.json
39
- var version = "4.3.4";
39
+ var version = "4.4.0";
40
40
 
41
41
  // src/constants.ts
42
42
  var VERSION = version;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  logger
3
- } from "../chunk-CQQE7NTL.js";
4
- import "../chunk-OPFRJOPV.js";
3
+ } from "../chunk-LNOQKTI4.js";
4
+ import "../chunk-JSOK4BIG.js";
5
5
  export {
6
6
  logger
7
7
  };
@@ -15,6 +15,7 @@ import remarkComment from 'remark-comment';
15
15
  import rehypeSlug from 'rehype-slug';
16
16
  import rehypeAutolinkHeadings from 'rehype-autolink-headings';
17
17
  import { eventCatalogLikeC4 } from './src/plugins/likec4';
18
+ import { loadAstroCompressIntegration } from './src/plugins/astro-compress';
18
19
  import { astroTrailingSlashEndpointFix } from './src/plugins/astro-trailing-slash-endpoint-fix';
19
20
 
20
21
  import rehypeExpressiveCode from 'rehype-expressive-code';
@@ -107,12 +108,7 @@ export default defineConfig({
107
108
  rehypePlugins: mdxRehypePlugins,
108
109
  }),
109
110
  }),
110
- effectiveOutput !== 'server' &&
111
- compress &&
112
- (await import('astro-compress')).default({
113
- Logger: 0,
114
- CSS: false,
115
- }),
111
+ effectiveOutput !== 'server' && compress && (await loadAstroCompressIntegration(projectDirectory)),
116
112
  ecstudioWatcher(),
117
113
  eventCatalogIntegration(),
118
114
  ].filter(Boolean),
@@ -749,7 +749,7 @@ export default function NestedSideBar() {
749
749
  }) ?? [];
750
750
 
751
751
  const groupId = groupKey || group.collapseKey || `${currentLevel.key ?? 'root'}:group:${group.title}`;
752
- const canCollapse = canCollapseGroup(visibleChildren.length);
752
+ const canCollapse = canCollapseGroup(visibleChildren.length, isTopLevel);
753
753
  const isCollapsed = isGroupCollapsed(canCollapse, groupId, sectionCollapsePreferences);
754
754
 
755
755
  // When a group's children are subtle subgroups (e.g. Resources > Services/Flows/Data Stores),
@@ -14,9 +14,13 @@ describe('sidebar group presentation', () => {
14
14
  expect(getGroupLabel(title, 10)).toBe(title);
15
15
  });
16
16
 
17
- it('only allows groups with more than five children to collapse', () => {
18
- expect(canCollapseGroup(5)).toBe(false);
19
- expect(canCollapseGroup(6)).toBe(true);
17
+ it('keeps top-level groups expanded', () => {
18
+ expect(canCollapseGroup(6, true)).toBe(false);
19
+ });
20
+
21
+ it('only allows nested groups with more than five children to collapse', () => {
22
+ expect(canCollapseGroup(5, false)).toBe(false);
23
+ expect(canCollapseGroup(6, false)).toBe(true);
20
24
  });
21
25
  });
22
26
 
@@ -7,7 +7,8 @@ export type SectionCollapsePreferences = {
7
7
  expanded: Set<string>;
8
8
  };
9
9
 
10
- export const canCollapseGroup = (childCount: number): boolean => childCount > SIDEBAR_GROUP_COLLAPSE_THRESHOLD;
10
+ export const canCollapseGroup = (childCount: number, isTopLevel: boolean): boolean =>
11
+ !isTopLevel && childCount > SIDEBAR_GROUP_COLLAPSE_THRESHOLD;
11
12
 
12
13
  export const getGroupLabel = (title: string, childCount: number): string =>
13
14
  GROUP_TITLES_WITHOUT_COUNT.has(title) ? title : `${title} (${childCount})`;
@@ -0,0 +1,36 @@
1
+ import type { AstroIntegration } from 'astro';
2
+ import { createRequire } from 'node:module';
3
+ import { join } from 'node:path';
4
+ import { pathToFileURL } from 'node:url';
5
+
6
+ const astroCompressInstallMessage = `Compression is enabled, but astro-compress is not installed.
7
+
8
+ Install it in your EventCatalog project:
9
+
10
+ npm install --save-dev astro-compress`;
11
+
12
+ type AstroCompressModule = {
13
+ default?: (options: { Logger: number; CSS: boolean }) => AstroIntegration;
14
+ };
15
+
16
+ export const loadAstroCompressIntegration = async (projectDirectory: string): Promise<AstroIntegration> => {
17
+ let astroCompressPath: string;
18
+
19
+ try {
20
+ const requireFromCatalog = createRequire(join(projectDirectory, 'package.json'));
21
+ astroCompressPath = requireFromCatalog.resolve('astro-compress');
22
+ } catch (error) {
23
+ throw new Error(`${astroCompressInstallMessage}\n\n${error instanceof Error ? error.message : String(error)}`);
24
+ }
25
+
26
+ const astroCompress = (await import(/* @vite-ignore */ pathToFileURL(astroCompressPath).href)) as AstroCompressModule;
27
+
28
+ if (typeof astroCompress.default !== 'function') {
29
+ throw new Error('The installed astro-compress package does not have a default integration export.');
30
+ }
31
+
32
+ return astroCompress.default({
33
+ Logger: 0,
34
+ CSS: false,
35
+ });
36
+ };
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  },
8
8
  "license": "SEE LICENSE IN LICENSE",
9
9
  "type": "module",
10
- "version": "4.3.4",
10
+ "version": "4.4.0",
11
11
  "publishConfig": {
12
12
  "access": "public"
13
13
  },
@@ -62,7 +62,6 @@
62
62
  "@xyflow/react": "^12.3.6",
63
63
  "ai": "^6.0.17",
64
64
  "astro": "^7.1.1",
65
- "astro-compress": "^2.4.0",
66
65
  "astro-expressive-code": "^0.44.0",
67
66
  "astro-seo": "^0.8.4",
68
67
  "auth-astro": "^4.2.0",