@eventcatalog/core 5.0.0 → 5.0.2

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 (28) 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-NIVST4WY.js → chunk-A7AVNA6M.js} +1 -1
  6. package/dist/{chunk-NEAVAFSJ.js → chunk-AI5SK4WP.js} +1 -1
  7. package/dist/{chunk-JZN4RSMF.js → chunk-D73WCJQD.js} +1 -1
  8. package/dist/{chunk-RE7UTPWH.js → chunk-MSRXEI5A.js} +1 -1
  9. package/dist/{chunk-YQGRMDRB.js → chunk-QS6PIAHG.js} +1 -1
  10. package/dist/constants.cjs +1 -1
  11. package/dist/constants.js +1 -1
  12. package/dist/eventcatalog.cjs +1 -1
  13. package/dist/eventcatalog.js +5 -5
  14. package/dist/generate.cjs +1 -1
  15. package/dist/generate.js +3 -3
  16. package/dist/utils/cli-logger.cjs +1 -1
  17. package/dist/utils/cli-logger.js +2 -2
  18. package/eventcatalog/src/components/NewVersionBanner.astro +31 -0
  19. package/eventcatalog/src/features/mcp/apps/generated/canvas.html +1 -1
  20. package/eventcatalog/src/features/mcp/apps/generated/viewer.html +1 -1
  21. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/[docType]/[docId]/[docVersion]/index.astro +10 -13
  22. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/[docType]/[docId]/index.astro +10 -13
  23. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/graphql/[filename].astro +13 -18
  24. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/index.astro +16 -19
  25. package/eventcatalog/src/utils/collections/resource-type-badge.ts +9 -0
  26. package/eventcatalog/src/utils/collections/util.ts +10 -0
  27. package/eventcatalog/src/utils/version-banner.ts +10 -0
  28. package/package.json +5 -5
@@ -2,7 +2,7 @@
2
2
  import { render } from 'astro:content';
3
3
 
4
4
  import VerticalSideBarLayout from '@layouts/VerticalSideBarLayout.astro';
5
- import Admonition from '@components/MDX/Admonition';
5
+ import NewVersionBanner from '@components/NewVersionBanner.astro';
6
6
  import components from '@components/MDX/components';
7
7
  import CopyAsMarkdown from '@components/CopyAsMarkdown';
8
8
  import Badge from '@components/Badge.astro';
@@ -11,7 +11,7 @@ import { AlignLeftIcon, HistoryIcon } from 'lucide-react';
11
11
  import { isEventCatalogChatVisible, isMarkdownDownloadEnabled } from '@utils/feature';
12
12
  import { getResourceDocTypeLabel } from '@utils/collections/resource-docs';
13
13
  import { getIcon } from '@utils/badges';
14
- import { collectionToResourceMap } from '@utils/collections/util';
14
+ import { getResourceNoun } from '@utils/collections/util';
15
15
 
16
16
  import { Page } from './_index.data';
17
17
 
@@ -31,9 +31,7 @@ const badges = (props.data.badges || []).map((badge: any) => ({
31
31
  }));
32
32
 
33
33
  const docsBasePath = `/docs/${props.data.resourceCollection}/${props.data.resourceId}/${props.data.resourceVersion}/${encodeURIComponent(props.data.type)}/${encodeURIComponent(props.data.id)}`;
34
- const singularResourceName =
35
- collectionToResourceMap[props.data.resourceCollection as keyof typeof collectionToResourceMap] ??
36
- props.data.resourceCollection.slice(0, props.data.resourceCollection.length - 1);
34
+ const singularResourceName = getResourceNoun(props.data.resourceCollection);
37
35
  const chatEnabled = isEventCatalogChatVisible();
38
36
  const chatQuery = `Tell me about the ${props.data.type} doc "${title}" for ${props.data.resourceId} (version ${props.data.version})`;
39
37
 
@@ -89,14 +87,13 @@ const pagefindAttributes =
89
87
  <div data-pagefind-ignore>
90
88
  {
91
89
  props.data.version !== props.data.latestVersion && (
92
- <Admonition type="warning" title="New version found">
93
- <p>
94
- You are looking at a previous version of the {singularResourceName} doc <strong>{title}</strong>.{' '}
95
- <a class="underline block pt-2" href={buildUrl(`${docsBasePath}/${props.data.latestVersion}`)}>
96
- The latest version of this doc is <span>v{props.data.latestVersion}</span> &rarr;
97
- </a>
98
- </p>
99
- </Admonition>
90
+ <NewVersionBanner
91
+ subject={`${singularResourceName} doc`}
92
+ name={title}
93
+ latestOf="doc"
94
+ latestVersion={props.data.latestVersion}
95
+ href={buildUrl(`${docsBasePath}/${props.data.latestVersion}`)}
96
+ />
100
97
  )
101
98
  }
102
99
  </div>
@@ -2,7 +2,7 @@
2
2
  import { render } from 'astro:content';
3
3
 
4
4
  import VerticalSideBarLayout from '@layouts/VerticalSideBarLayout.astro';
5
- import Admonition from '@components/MDX/Admonition';
5
+ import NewVersionBanner from '@components/NewVersionBanner.astro';
6
6
  import components from '@components/MDX/components';
7
7
  import CopyAsMarkdown from '@components/CopyAsMarkdown';
8
8
  import Badge from '@components/Badge.astro';
@@ -10,7 +10,7 @@ import { buildUrl } from '@utils/url-builder';
10
10
  import { AlignLeftIcon, HistoryIcon } from 'lucide-react';
11
11
  import { isEventCatalogChatVisible, isMarkdownDownloadEnabled } from '@utils/feature';
12
12
  import { getIcon } from '@utils/badges';
13
- import { collectionToResourceMap } from '@utils/collections/util';
13
+ import { getResourceNoun } from '@utils/collections/util';
14
14
  import { getResourceDocTypeLabel } from '@utils/collections/resource-docs';
15
15
 
16
16
  import { Page } from './_index.data';
@@ -31,9 +31,7 @@ const badges = (props.data.badges || []).map((badge: any) => ({
31
31
  }));
32
32
 
33
33
  const docsBasePath = `/docs/${props.data.resourceCollection}/${props.data.resourceId}/${props.data.resourceVersion}/${encodeURIComponent(props.data.type)}/${encodeURIComponent(props.data.id)}`;
34
- const singularResourceName =
35
- collectionToResourceMap[props.data.resourceCollection as keyof typeof collectionToResourceMap] ??
36
- props.data.resourceCollection.slice(0, props.data.resourceCollection.length - 1);
34
+ const singularResourceName = getResourceNoun(props.data.resourceCollection);
37
35
  const typeLabel = getResourceDocTypeLabel(props.data.type);
38
36
  const chatEnabled = isEventCatalogChatVisible();
39
37
  const chatQuery = `Tell me about the ${props.data.type} doc "${title}" for ${props.data.resourceId} (version ${props.data.version})`;
@@ -88,14 +86,13 @@ const pagefindAttributes =
88
86
  <div data-pagefind-ignore>
89
87
  {
90
88
  props.data.version !== props.data.latestVersion && (
91
- <Admonition type="warning" title="New version found">
92
- <p>
93
- You are looking at a previous version of the {singularResourceName} doc <strong>{title}</strong>.{' '}
94
- <a class="underline block pt-2" href={buildUrl(`${docsBasePath}/${props.data.latestVersion}`)}>
95
- The latest version of this doc is <span>v{props.data.latestVersion}</span> &rarr;
96
- </a>
97
- </p>
98
- </Admonition>
89
+ <NewVersionBanner
90
+ subject={`${singularResourceName} doc`}
91
+ name={title}
92
+ latestOf="doc"
93
+ latestVersion={props.data.latestVersion}
94
+ href={buildUrl(`${docsBasePath}/${props.data.latestVersion}`)}
95
+ />
99
96
  )
100
97
  }
101
98
  </div>
@@ -8,9 +8,10 @@ import { Page } from './_[filename].data';
8
8
  import { getAbsoluteFilePathForAstroFile } from '@utils/files';
9
9
  import { buildUrl, buildEditUrlForResource } from '@utils/url-builder';
10
10
  import Admonition from '@components/MDX/Admonition';
11
+ import NewVersionBanner from '@components/NewVersionBanner.astro';
11
12
  import Badge from '@components/Badge.astro';
12
-
13
- import { ServerIcon } from '@heroicons/react/24/outline';
13
+ import { getResourceTypeBadge } from '@utils/collections/resource-type-badge';
14
+ import { getResourceNoun } from '@utils/collections/util';
14
15
 
15
16
  export const prerender = Page.prerender;
16
17
  export const getStaticPaths = Page.getStaticPaths;
@@ -38,9 +39,8 @@ if (isRemote) {
38
39
  // Create comprehensive page title
39
40
  const pageTitle = `${collection} | ${data.name} | GraphQL Schema`.replace(/^\w/, (c) => c.toUpperCase());
40
41
 
41
- const getServiceBadge = () => {
42
- return [{ textColor: 'gray', content: 'Service', icon: ServerIcon }];
43
- };
42
+ // The schema belongs to a service, event, command, query or domain
43
+ const getResourceBadge = () => [getResourceTypeBadge(collection)];
44
44
 
45
45
  const getGraphQLBadge = () => {
46
46
  return [
@@ -53,7 +53,7 @@ const getGraphQLBadge = () => {
53
53
  ];
54
54
  };
55
55
 
56
- const badges = [...getServiceBadge(), ...getGraphQLBadge()];
56
+ const badges = [...getResourceBadge(), ...getGraphQLBadge()];
57
57
 
58
58
  // Index only the latest version
59
59
  const pagefindAttributes =
@@ -96,18 +96,13 @@ const pagefindAttributes =
96
96
  <div data-pagefind-ignore>
97
97
  {
98
98
  data.version !== data.latestVersion && (
99
- <Admonition type="warning" title="New version found">
100
- <p>
101
- You are looking at a previous version of the service <strong>{data.name}</strong>.{' '}
102
- <a
103
- class="underline block pt-2"
104
- href={buildUrl(`/docs/${collection}/${data.id}/${data.latestVersion}/graphql/${filename}`)}
105
- >
106
- The latest version of this GraphQL schema is
107
- <span>v{data.latestVersion}</span> &rarr;
108
- </a>
109
- </p>
110
- </Admonition>
99
+ <NewVersionBanner
100
+ subject={getResourceNoun(collection)}
101
+ name={data.name}
102
+ latestOf="GraphQL schema"
103
+ latestVersion={data.latestVersion}
104
+ href={buildUrl(`/docs/${collection}/${data.id}/${data.latestVersion}/graphql/${filename}`)}
105
+ />
111
106
  )
112
107
  }
113
108
  </div>
@@ -13,6 +13,7 @@ import NodeGraph from '@components/MDX/NodeGraph/NodeGraph.astro';
13
13
  import ArchitectureGraph from '@components/MDX/ArchitectureGraph/ArchitectureGraph.astro';
14
14
  import SchemaViewer from '@components/MDX/SchemaViewer/SchemaViewerRoot.astro';
15
15
  import Admonition from '@components/MDX/Admonition';
16
+ import NewVersionBanner from '@components/NewVersionBanner.astro';
16
17
  import VersionList from '@components/Lists/VersionList.astro';
17
18
  import CopyAsMarkdown from '@components/CopyAsMarkdown';
18
19
  import FavoriteButton from '@components/FavoriteButton';
@@ -46,7 +47,12 @@ import {
46
47
  } from 'lucide-react';
47
48
 
48
49
  import { getSpecificationsForService } from '@utils/collections/services';
49
- import { resourceToCollectionMap, collectionToResourceMap, getDeprecatedDetails } from '@utils/collections/util';
50
+ import {
51
+ resourceToCollectionMap,
52
+ collectionToResourceMap,
53
+ getDeprecatedDetails,
54
+ getResourceNoun,
55
+ } from '@utils/collections/util';
50
56
  import {
51
57
  createAdrStatusBadge,
52
58
  formatAdrDate,
@@ -305,16 +311,13 @@ const {
305
311
  deprecatedDate: formattedDate,
306
312
  } = getDeprecatedDetails(props as unknown as CollectionEntry<CollectionTypes>);
307
313
 
308
- let friendlyCollectionName = props.collection.slice(0, props.collection.length - 1);
309
- friendlyCollectionName = friendlyCollectionName === 'querie' ? 'query' : friendlyCollectionName;
310
- friendlyCollectionName = friendlyCollectionName === 'entitie' ? 'entity' : friendlyCollectionName;
311
- friendlyCollectionName = friendlyCollectionName === 'adr' ? 'architecture decision' : friendlyCollectionName;
314
+ const friendlyCollectionName = getResourceNoun(props.collection);
312
315
 
313
316
  const schemasForResource = getSchemasFromResource(props);
314
317
 
315
318
  const generatePromptForResource = (props: any) => {
316
319
  return `
317
- Please tell me more about the ${props.collection.slice(0, props.collection.length - 1)} - ${props.data.name} v${props.data.version} in this catalog.
320
+ Please tell me more about the ${friendlyCollectionName} - ${props.data.name} v${props.data.version} in this catalog.
318
321
  `;
319
322
  };
320
323
 
@@ -596,19 +599,13 @@ if (!isAdrPage && !hasCurrentFlowEmbed && !hasCurrentPageNodeGraph) {
596
599
  <div data-pagefind-ignore>
597
600
  {
598
601
  props.data.version !== props.data.latestVersion && (
599
- <Admonition type="warning" title="New version found">
600
- <p>
601
- You are looking at a previous version of the {props.collection.slice(0, props.collection.length - 1)}{' '}
602
- <strong>{props.data.name}</strong>.{' '}
603
- <a
604
- class="underline block pt-2"
605
- href={buildUrl(`/docs/${props.collection}/${props.data.id}/${props.data.latestVersion}`)}
606
- >
607
- The latest version of this {props.collection.slice(0, props.collection.length - 1)} is
608
- <span>v{props.data.latestVersion}</span> &rarr;
609
- </a>
610
- </p>
611
- </Admonition>
602
+ <NewVersionBanner
603
+ subject={friendlyCollectionName}
604
+ name={props.data.name}
605
+ latestOf={friendlyCollectionName}
606
+ latestVersion={props.data.latestVersion}
607
+ href={buildUrl(`/docs/${props.collection}/${props.data.id}/${props.data.latestVersion}`)}
608
+ />
612
609
  )
613
610
  }
614
611
  </div>
@@ -0,0 +1,9 @@
1
+ import { getIconForCollection } from '@utils/collections/icons';
2
+ import { getResourceTypeLabel } from '@utils/collections/util';
3
+
4
+ /** A badge naming a resource's type, with its icon (e.g. on a GraphQL schema page, the resource it belongs to) */
5
+ export const getResourceTypeBadge = (collection: string) => ({
6
+ textColor: 'gray',
7
+ content: getResourceTypeLabel(collection),
8
+ icon: getIconForCollection(collection),
9
+ });
@@ -227,6 +227,16 @@ export const getResourceTypeLabel = (collection: string): string => {
227
227
  .join(' ');
228
228
  };
229
229
 
230
+ /**
231
+ * What a resource in a collection is called in a sentence, e.g. "a previous version of the query".
232
+ * e.g. 'queries' → 'query', 'data-products' → 'data product', 'adrs' → 'architecture decision'
233
+ */
234
+ export const getResourceNoun = (collection: string): string => {
235
+ if (collection === 'adrs') return 'architecture decision';
236
+ const raw = (collectionToResourceMap as Record<string, string>)[collection] || collection;
237
+ return raw.replace(/-/g, ' ');
238
+ };
239
+
230
240
  /**
231
241
  * Returns the correct pointer field name for a collection and direction.
232
242
  * Data-products use 'outputs'/'inputs' instead of 'sends'/'receives'.
@@ -0,0 +1,10 @@
1
+ /**
2
+ * The sentences on the "New version found" banner (components/NewVersionBanner.astro), shown on a previous version of a
3
+ * page. Each ends with the space before what follows it (the name, then the version), so the markup can't lose it.
4
+ */
5
+ export const getVersionBannerText = ({ subject, latestOf }: { subject: string; latestOf: string }) => ({
6
+ /** Followed by the name of what this page is a version of, e.g. "...of the query " Get Orders */
7
+ previous: `You are looking at a previous version of the ${subject} `,
8
+ /** Followed by the latest version, e.g. "...of this query is " v2.0.0 */
9
+ latest: `The latest version of this ${latestOf} is `,
10
+ });
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  },
8
8
  "license": "BUSL-1.1",
9
9
  "type": "module",
10
- "version": "5.0.0",
10
+ "version": "5.0.2",
11
11
  "publishConfig": {
12
12
  "access": "public"
13
13
  },
@@ -66,7 +66,7 @@
66
66
  "@mcp-b/webmcp-polyfill": "5.1.0",
67
67
  "@mermaid-js/layout-elk": "^0.2.0",
68
68
  "@modelcontextprotocol/ext-apps": "^1.7.5",
69
- "@modelcontextprotocol/sdk": "^1.30.0",
69
+ "@modelcontextprotocol/sdk": "^1.32.0",
70
70
  "@nanostores/react": "^1.0.0",
71
71
  "@parcel/watcher": "^2.4.1",
72
72
  "@radix-ui/react-context-menu": "^2.2.6",
@@ -140,9 +140,9 @@
140
140
  "y-protocols": "^1.0.7",
141
141
  "yjs": "^13.6.33",
142
142
  "zod": "^4.6.6",
143
- "@eventcatalog/linter": "1.2.0",
144
- "@eventcatalog/sdk": "2.30.0",
145
- "@eventcatalog/visualiser": "^5.0.0"
143
+ "@eventcatalog/linter": "1.2.1",
144
+ "@eventcatalog/visualiser": "^5.0.0",
145
+ "@eventcatalog/sdk": "2.30.0"
146
146
  },
147
147
  "devDependencies": {
148
148
  "@astrojs/check": "^0.9.10",