@eventcatalog/core 4.3.2 → 4.3.3

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 (46) 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-T6UEDS2J.js → chunk-2IGBU3PN.js} +1 -1
  6. package/dist/{chunk-YBNWZEFQ.js → chunk-HR6KK56F.js} +1 -1
  7. package/dist/{chunk-25RQCO2H.js → chunk-OWE74ZHY.js} +3 -3
  8. package/dist/{chunk-W4UBACYZ.js → chunk-PXBG5QKU.js} +1 -1
  9. package/dist/{chunk-BYH34SOZ.js → chunk-UW52WRSH.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 +24 -0
  13. package/dist/docs/cli/governance.md +1 -1
  14. package/dist/docs/cli/snapshots.md +1 -1
  15. package/dist/docs/development/ask-your-architecture/03-mcp-server/getting-started.md +56 -7
  16. package/dist/docs/development/ask-your-architecture/03-mcp-server/introduction.md +8 -3
  17. package/dist/docs/development/deployment/build-ssr-mode.md +1 -9
  18. package/dist/docs/development/developer-tools/api-catalog.md +1 -1
  19. package/dist/docs/development/guides/98-versioning-resources.md +15 -0
  20. package/dist/docs/development/guides/resources/entities/03-model-entity-relationships.md +26 -6
  21. package/dist/docs/development/guides/resources/entities/05-entity-maps.md +2 -0
  22. package/dist/docs/development/guides/resources/entities/06-reference.md +25 -2
  23. package/dist/docs/development/guides/resources/services/07-versioning-and-lifecycle/01-version-services.md +2 -0
  24. package/dist/docs/plugins/asyncapi/02-plugin-configuration.md +30 -2
  25. package/dist/docs/plugins/asyncapi/03-features.md +39 -26
  26. package/dist/docs/plugins/asyncapi/03a-workflows.md +61 -2
  27. package/dist/docs/plugins/openapi/02-plugin-configuration.md +1 -2
  28. package/dist/docs/plugins/openapi/03-features.md +8 -6
  29. package/dist/docs/plugins/openapi/03a-workflows.md +79 -18
  30. package/dist/eventcatalog.cjs +1 -1
  31. package/dist/eventcatalog.js +9 -9
  32. package/dist/generate.cjs +1 -1
  33. package/dist/generate.js +3 -3
  34. package/dist/utils/cli-logger.cjs +1 -1
  35. package/dist/utils/cli-logger.js +2 -2
  36. package/eventcatalog/src/components/LatestVersionRedirect.astro +26 -0
  37. package/eventcatalog/src/pages/docs/services/[id]/[docType]/[docId]/index.astro +25 -0
  38. package/eventcatalog/src/pages/docs/services/[id]/asyncapi/[filename].astro +25 -0
  39. package/eventcatalog/src/pages/docs/services/[id]/changelog/index.astro +25 -0
  40. package/eventcatalog/src/pages/docs/services/[id]/graphql/[filename].astro +25 -0
  41. package/eventcatalog/src/pages/docs/services/[id]/spec/[filename].astro +25 -0
  42. package/eventcatalog/src/pages/docs/services/_latest-version-route.ts +42 -0
  43. package/eventcatalog/src/stores/sidebar-store/builders/service.ts +9 -12
  44. package/eventcatalog/src/stores/sidebar-store/builders/shared.ts +4 -2
  45. package/package.json +3 -3
  46. package/dist/docs/cli/import.md +0 -26
@@ -0,0 +1,25 @@
1
+ ---
2
+ import LatestVersionRedirect from '@components/LatestVersionRedirect.astro';
3
+ import { isSSR } from '@utils/feature';
4
+ import { buildUrl } from '@utils/url-builder';
5
+ import { Page as VersionedPage } from '../../../[type]/[id]/[version]/spec/_[filename].data';
6
+ import { getLatestServicePaths, getLatestServiceVersion } from '../../_latest-version-route';
7
+
8
+ export const prerender = !isSSR();
9
+ export const getStaticPaths = async () => getLatestServicePaths(await VersionedPage.getStaticPaths());
10
+
11
+ const { id, filename } = Astro.params;
12
+ const version = Astro.props.redirectVersion ?? (id ? await getLatestServiceVersion(id) : undefined);
13
+
14
+ if (!id || !filename || !version) {
15
+ throw new Response(null, { status: 404, statusText: 'OpenAPI specification not found' });
16
+ }
17
+
18
+ const redirectUrl = buildUrl(`/docs/services/${id}/${version}/spec/${filename}`);
19
+
20
+ if (isSSR()) {
21
+ return Astro.redirect(`${redirectUrl}${Astro.url.search}${Astro.url.hash}`);
22
+ }
23
+ ---
24
+
25
+ <LatestVersionRedirect title="Latest OpenAPI specification" redirectUrl={redirectUrl} />
@@ -0,0 +1,42 @@
1
+ import type { CollectionEntry } from 'astro:content';
2
+
3
+ type StaticPath = {
4
+ params: Record<string, string | undefined>;
5
+ props?: Record<string, unknown>;
6
+ };
7
+
8
+ type LatestService = CollectionEntry<'services'>;
9
+
10
+ export const toLatestServicePaths = (paths: StaticPath[], latestServices: LatestService[]): StaticPath[] => {
11
+ const latestVersions = new Map(latestServices.map((service) => [service.data.id, service.data.version]));
12
+
13
+ return paths.flatMap(({ params, props = {} }) => {
14
+ const { type, version, ...aliasParams } = params;
15
+
16
+ if (type !== 'services' || !params.id || latestVersions.get(params.id) !== version) {
17
+ return [];
18
+ }
19
+
20
+ return [
21
+ {
22
+ params: aliasParams,
23
+ props: {
24
+ ...props,
25
+ redirectVersion: version,
26
+ },
27
+ },
28
+ ];
29
+ });
30
+ };
31
+
32
+ export const getLatestServicePaths = async (paths: StaticPath[]): Promise<StaticPath[]> => {
33
+ const { getServices } = await import('@utils/collections/services');
34
+ const latestServices = await getServices({ getAllVersions: false });
35
+ return toLatestServicePaths(paths, latestServices);
36
+ };
37
+
38
+ export const getLatestServiceVersion = async (id: string): Promise<string | undefined> => {
39
+ const { getServices } = await import('@utils/collections/services');
40
+ const latestServices = await getServices({ getAllVersions: false });
41
+ return latestServices.find((service) => service.data.id === id)?.data.version;
42
+ };
@@ -58,12 +58,15 @@ export const buildServiceNode = (
58
58
  const renderEntities = serviceEntities.length > 0 && shouldRenderSideBarSection(service, 'entities');
59
59
  const renderOwners = owners.length > 0 && shouldRenderSideBarSection(service, 'owners');
60
60
  const renderRepository = service.data.repository && shouldRenderSideBarSection(service, 'repository');
61
+ const isLatestVersion = service.data.version === service.data.latestVersion;
62
+ const docsBasePath = `/docs/services/${service.data.id}${isLatestVersion ? '' : `/${service.data.version}`}`;
61
63
  const docsSection = buildResourceDocsSection(
62
64
  'services',
63
65
  service.data.id,
64
66
  service.data.version,
65
67
  context.resourceDocs,
66
- context.resourceDocCategories
68
+ context.resourceDocCategories,
69
+ { includeVersionInUrl: !isLatestVersion }
67
70
  );
68
71
 
69
72
  // Diagrams
@@ -82,11 +85,11 @@ export const buildServiceNode = (
82
85
  pages: [
83
86
  buildQuickReferenceSection(
84
87
  [
85
- { title: 'Overview', href: buildUrl(`/docs/services/${service.data.id}/${service.data.version}`) },
88
+ { title: 'Overview', href: buildUrl(docsBasePath) },
86
89
  isChangelogEnabled() &&
87
90
  shouldRenderSideBarSection(service, 'changelog') && {
88
91
  title: 'Changelog',
89
- href: buildUrl(`/docs/services/${service.data.id}/${service.data.version}/changelog`),
92
+ href: buildUrl(`${docsBasePath}/changelog`),
90
93
  },
91
94
  ].filter(Boolean) as { title: string; href: string }[]
92
95
  ),
@@ -135,25 +138,19 @@ export const buildServiceNode = (
135
138
  type: 'item',
136
139
  title: `${specification.name}`,
137
140
  leftIcon: '/icons/openapi-black.svg',
138
- href: buildUrl(
139
- `/docs/services/${service.data.id}/${service.data.version}/spec/${specification.filenameWithoutExtension}`
140
- ),
141
+ href: buildUrl(`${docsBasePath}/spec/${specification.filenameWithoutExtension}`),
141
142
  })),
142
143
  ...asyncAPISpecifications.map((specification) => ({
143
144
  type: 'item',
144
145
  title: `${specification.name}`,
145
146
  leftIcon: '/icons/asyncapi-black.svg',
146
- href: buildUrl(
147
- `/docs/services/${service.data.id}/${service.data.version}/asyncapi/${specification.filenameWithoutExtension}`
148
- ),
147
+ href: buildUrl(`${docsBasePath}/asyncapi/${specification.filenameWithoutExtension}`),
149
148
  })),
150
149
  ...graphQLSpecifications.map((specification) => ({
151
150
  type: 'item',
152
151
  title: `${specification.name}`,
153
152
  leftIcon: '/icons/graphql-black.svg',
154
- href: buildUrl(
155
- `/docs/services/${service.data.id}/${service.data.version}/graphql/${specification.filenameWithoutExtension}`
156
- ),
153
+ href: buildUrl(`${docsBasePath}/graphql/${specification.filenameWithoutExtension}`),
157
154
  })),
158
155
  ],
159
156
  },
@@ -189,8 +189,10 @@ export const buildResourceDocsSection = (
189
189
  id: string,
190
190
  version: string,
191
191
  resourceDocs: ResourceDocEntry[],
192
- resourceDocCategories: ResourceDocCategoryEntry[]
192
+ resourceDocCategories: ResourceDocCategoryEntry[],
193
+ options: { includeVersionInUrl?: boolean } = {}
193
194
  ): NavNode | null => {
195
+ const { includeVersionInUrl = true } = options;
194
196
  const docsForResource = resourceDocs.filter(
195
197
  (doc) => doc.data.resourceCollection === collection && doc.data.resourceId === id && doc.data.resourceVersion === version
196
198
  );
@@ -249,7 +251,7 @@ export const buildResourceDocsSection = (
249
251
  type: 'item',
250
252
  title: doc.data.title || doc.data.id,
251
253
  href: buildUrl(
252
- `/docs/${collection}/${id}/${version}/${encodeURIComponent(doc.data.type)}/${encodeURIComponent(doc.data.id)}`
254
+ `/docs/${collection}/${id}${includeVersionInUrl ? `/${version}` : ''}/${encodeURIComponent(doc.data.type)}/${encodeURIComponent(doc.data.id)}`
253
255
  ),
254
256
  })),
255
257
  })),
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.2",
10
+ "version": "4.3.3",
11
11
  "publishConfig": {
12
12
  "access": "public"
13
13
  },
@@ -117,8 +117,8 @@
117
117
  "uuid": "^10.0.0",
118
118
  "zod": "^4.3.6",
119
119
  "@eventcatalog/linter": "1.1.8",
120
- "@eventcatalog/visualiser": "^4.1.1",
121
- "@eventcatalog/sdk": "2.26.3"
120
+ "@eventcatalog/sdk": "2.26.3",
121
+ "@eventcatalog/visualiser": "^4.1.1"
122
122
  },
123
123
  "devDependencies": {
124
124
  "@astrojs/check": "^0.9.9",
@@ -1,26 +0,0 @@
1
- ---
2
- id: cli-import
3
- title: Import
4
- sidebar_label: Import
5
- sidebar_position: 18
6
- ---
7
-
8
- # Import CLI Commands
9
-
10
- Manage import in your EventCatalog from the command line.
11
-
12
- ## import
13
-
14
- Import EventCatalog DSL (.ec) files into catalog markdown files. Existing resources with the same version are overridden. Importing a newer version automatically moves the old version into the versioned/ folder.
15
-
16
- **Arguments:**
17
- | Name | Type | Required | Description |
18
- |------|------|----------|-------------|
19
- | files | string | No | One or more .ec file paths to import |
20
- | stdin | boolean | No | Read DSL from stdin |
21
- | dry-run | boolean | No | Preview resources without writing |
22
- | no-init | boolean | No | Skip catalog initialization prompt |
23
-
24
-
25
-
26
- ---