@eventcatalog/core 5.0.1 → 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 (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-KTXSCPEK.js → chunk-A7AVNA6M.js} +1 -1
  6. package/dist/{chunk-YPWK5ITM.js → chunk-AI5SK4WP.js} +3 -3
  7. package/dist/{chunk-DVHJTQWQ.js → chunk-D73WCJQD.js} +1 -1
  8. package/dist/{chunk-UWAXRTAJ.js → chunk-MSRXEI5A.js} +1 -1
  9. package/dist/{chunk-46TBJZC3.js → chunk-OX6TSVHY.js} +5 -5
  10. package/dist/{chunk-HFR5OPHV.js → chunk-QS6PIAHG.js} +1 -1
  11. package/dist/constants.cjs +1 -1
  12. package/dist/constants.js +1 -1
  13. package/dist/eventcatalog.cjs +1 -1
  14. package/dist/eventcatalog.js +15 -15
  15. package/dist/federation/federate.js +4 -4
  16. package/dist/federation/source-provider.js +2 -2
  17. package/dist/generate.cjs +1 -1
  18. package/dist/generate.js +3 -3
  19. package/dist/utils/cli-logger.cjs +1 -1
  20. package/dist/utils/cli-logger.js +2 -2
  21. package/eventcatalog/src/components/NewVersionBanner.astro +31 -0
  22. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/[docType]/[docId]/[docVersion]/index.astro +10 -13
  23. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/[docType]/[docId]/index.astro +10 -13
  24. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/graphql/[filename].astro +13 -18
  25. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/index.astro +16 -19
  26. package/eventcatalog/src/utils/collections/resource-type-badge.ts +9 -0
  27. package/eventcatalog/src/utils/collections/util.ts +10 -0
  28. package/eventcatalog/src/utils/version-banner.ts +10 -0
  29. package/package.json +2 -2
  30. package/dist/{chunk-A2RZR3U4.js → chunk-6K7XZAYI.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.1";
39
+ var version = "5.0.2";
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-A7AVNA6M.js";
4
4
  import "../chunk-CPW6G62V.js";
5
- import "../chunk-UWAXRTAJ.js";
5
+ import "../chunk-MSRXEI5A.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.0.2";
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-AI5SK4WP.js";
4
4
  import "../chunk-AD7CL772.js";
5
- import "../chunk-KTXSCPEK.js";
6
5
  import "../chunk-ZAZHAVKB.js";
7
6
  import "../chunk-CA6WCQ2T.js";
7
+ import "../chunk-A7AVNA6M.js";
8
8
  import "../chunk-CPW6G62V.js";
9
- import "../chunk-UWAXRTAJ.js";
9
+ import "../chunk-MSRXEI5A.js";
10
10
  import "../chunk-4G7FSRPN.js";
11
11
  export {
12
12
  log_build_default as default
@@ -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-MSRXEI5A.js";
8
8
 
9
9
  // src/analytics/analytics.js
10
10
  import os from "os";
@@ -1,9 +1,6 @@
1
1
  import {
2
2
  getLicenseAnalytics
3
3
  } from "./chunk-AD7CL772.js";
4
- import {
5
- raiseEvent
6
- } from "./chunk-KTXSCPEK.js";
7
4
  import {
8
5
  countResources,
9
6
  hashCatalogContent,
@@ -14,6 +11,9 @@ import {
14
11
  getStudioMode,
15
12
  serializeStudioUsage
16
13
  } 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
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VERSION
3
- } from "./chunk-UWAXRTAJ.js";
3
+ } from "./chunk-MSRXEI5A.js";
4
4
 
5
5
  // src/utils/cli-logger.ts
6
6
  import pc from "picocolors";
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "5.0.1";
2
+ var version = "5.0.2";
3
3
 
4
4
  // src/constants.ts
5
5
  var VERSION = version;
@@ -1,7 +1,3 @@
1
- import {
2
- getFederationDiagnostics,
3
- resolveFederationRules
4
- } from "./chunk-JJPB6EOZ.js";
5
1
  import {
6
2
  withFederationOutputTransaction
7
3
  } from "./chunk-WRNH5C3U.js";
@@ -10,10 +6,14 @@ import {
10
6
  } from "./chunk-5EPNFDT5.js";
11
7
  import {
12
8
  createFederationSourceProvider
13
- } from "./chunk-A2RZR3U4.js";
9
+ } from "./chunk-6K7XZAYI.js";
14
10
  import {
15
11
  createFederationContentCache
16
12
  } from "./chunk-R7Z5ALYI.js";
13
+ import {
14
+ getFederationDiagnostics,
15
+ resolveFederationRules
16
+ } from "./chunk-JJPB6EOZ.js";
17
17
  import {
18
18
  getEventCatalogConfigFile
19
19
  } from "./chunk-4G7FSRPN.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  logger
3
- } from "./chunk-DVHJTQWQ.js";
3
+ } from "./chunk-D73WCJQD.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 = "5.0.1";
28
+ var version = "5.0.2";
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-MSRXEI5A.js";
4
4
  export {
5
5
  VERSION
6
6
  };
@@ -174,7 +174,7 @@ var verifyRequiredFieldsAreInCatalogConfigFile = async (projectDirectory) => {
174
174
  var import_picocolors = __toESM(require("picocolors"), 1);
175
175
 
176
176
  // package.json
177
- var version = "5.0.1";
177
+ var version = "5.0.2";
178
178
 
179
179
  // src/constants.ts
180
180
  var VERSION = version;
@@ -2,34 +2,33 @@ import {
2
2
  runMigrations
3
3
  } from "./chunk-XUAF2H54.js";
4
4
  import "./chunk-CA4U2JP7.js";
5
+ import {
6
+ stopChildWithParent
7
+ } from "./chunk-S5GWAUG5.js";
5
8
  import {
6
9
  log_build_default
7
- } from "./chunk-YPWK5ITM.js";
10
+ } from "./chunk-AI5SK4WP.js";
8
11
  import {
9
12
  getLicenseStatus,
10
13
  printLicenseStatus
11
14
  } from "./chunk-AD7CL772.js";
12
- import "./chunk-KTXSCPEK.js";
13
15
  import "./chunk-ZAZHAVKB.js";
14
16
  import "./chunk-CA6WCQ2T.js";
15
- import "./chunk-CPW6G62V.js";
16
- import {
17
- stopChildWithParent
18
- } from "./chunk-S5GWAUG5.js";
19
17
  import {
20
18
  FederationConflictError,
21
19
  FederationDiagnosticError,
22
20
  federateCatalog
23
- } from "./chunk-46TBJZC3.js";
21
+ } from "./chunk-OX6TSVHY.js";
22
+ import "./chunk-WRNH5C3U.js";
23
+ import "./chunk-5EPNFDT5.js";
24
+ import "./chunk-6K7XZAYI.js";
25
+ import "./chunk-352FGP6W.js";
26
+ import "./chunk-R7Z5ALYI.js";
24
27
  import {
25
28
  getFederationDiagnosticCounts,
26
29
  getVisibleFederationDiagnostics
27
30
  } from "./chunk-JJPB6EOZ.js";
28
- import "./chunk-WRNH5C3U.js";
29
- import "./chunk-5EPNFDT5.js";
30
- import "./chunk-A2RZR3U4.js";
31
31
  import "./chunk-SDZQJTJW.js";
32
- import "./chunk-352FGP6W.js";
33
32
  import {
34
33
  getProjectOutDir,
35
34
  isAuthEnabled,
@@ -38,10 +37,10 @@ import {
38
37
  } from "./chunk-NKNOXQ62.js";
39
38
  import {
40
39
  generate
41
- } from "./chunk-HFR5OPHV.js";
40
+ } from "./chunk-QS6PIAHG.js";
42
41
  import {
43
42
  logger
44
- } from "./chunk-DVHJTQWQ.js";
43
+ } from "./chunk-D73WCJQD.js";
45
44
  import {
46
45
  resolve_catalog_dependencies_default
47
46
  } from "./chunk-PD7KTSYN.js";
@@ -55,7 +54,8 @@ import {
55
54
  import {
56
55
  watch
57
56
  } from "./chunk-U63GDPPY.js";
58
- import "./chunk-R7Z5ALYI.js";
57
+ import "./chunk-A7AVNA6M.js";
58
+ import "./chunk-CPW6G62V.js";
59
59
  import {
60
60
  getAstroConfigPath
61
61
  } from "./chunk-VIJJ7JKH.js";
@@ -71,7 +71,7 @@ import {
71
71
  } from "./chunk-LFQJXLHG.js";
72
72
  import {
73
73
  VERSION
74
- } from "./chunk-UWAXRTAJ.js";
74
+ } from "./chunk-MSRXEI5A.js";
75
75
  import {
76
76
  getEventCatalogConfigFile,
77
77
  verifyRequiredFieldsAreInCatalogConfigFile
@@ -2,14 +2,14 @@ import {
2
2
  FederationConflictError,
3
3
  FederationDiagnosticError,
4
4
  federateCatalog
5
- } from "../chunk-46TBJZC3.js";
6
- import "../chunk-JJPB6EOZ.js";
5
+ } from "../chunk-OX6TSVHY.js";
7
6
  import "../chunk-WRNH5C3U.js";
8
7
  import "../chunk-5EPNFDT5.js";
9
- import "../chunk-A2RZR3U4.js";
10
- import "../chunk-SDZQJTJW.js";
8
+ import "../chunk-6K7XZAYI.js";
11
9
  import "../chunk-352FGP6W.js";
12
10
  import "../chunk-R7Z5ALYI.js";
11
+ import "../chunk-JJPB6EOZ.js";
12
+ import "../chunk-SDZQJTJW.js";
13
13
  import "../chunk-4G7FSRPN.js";
14
14
  export {
15
15
  FederationConflictError,
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  createFederationSourceProvider
3
- } from "../chunk-A2RZR3U4.js";
4
- import "../chunk-SDZQJTJW.js";
3
+ } from "../chunk-6K7XZAYI.js";
5
4
  import "../chunk-352FGP6W.js";
5
+ import "../chunk-SDZQJTJW.js";
6
6
  export {
7
7
  createFederationSourceProvider
8
8
  };
package/dist/generate.cjs CHANGED
@@ -105,7 +105,7 @@ var getEventCatalogConfigFile = async (projectDirectory) => {
105
105
  var import_picocolors = __toESM(require("picocolors"), 1);
106
106
 
107
107
  // package.json
108
- var version = "5.0.1";
108
+ var version = "5.0.2";
109
109
 
110
110
  // src/constants.ts
111
111
  var VERSION = version;
package/dist/generate.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  generate
3
- } from "./chunk-HFR5OPHV.js";
4
- import "./chunk-DVHJTQWQ.js";
5
- import "./chunk-UWAXRTAJ.js";
3
+ } from "./chunk-QS6PIAHG.js";
4
+ import "./chunk-D73WCJQD.js";
5
+ import "./chunk-MSRXEI5A.js";
6
6
  import "./chunk-4G7FSRPN.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 = "5.0.1";
39
+ var version = "5.0.2";
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-DVHJTQWQ.js";
4
- import "../chunk-UWAXRTAJ.js";
3
+ } from "../chunk-D73WCJQD.js";
4
+ import "../chunk-MSRXEI5A.js";
5
5
  export {
6
6
  logger
7
7
  };
@@ -0,0 +1,31 @@
1
+ ---
2
+ /**
3
+ * Shown on a previous version of a page: what you're looking at, and a link to its latest version.
4
+ * The sentences come from getVersionBannerText, so the spaces in them can't be lost when the markup is reformatted.
5
+ */
6
+ import Admonition from '@components/MDX/Admonition';
7
+ import { getVersionBannerText } from '@utils/version-banner';
8
+
9
+ interface Props {
10
+ /** What this page is a version of, e.g. "service" or "service doc" */
11
+ subject: string;
12
+ /** Its name */
13
+ name: string;
14
+ /** What the link goes to the latest version of, e.g. "service", "GraphQL schema" or "doc" */
15
+ latestOf: string;
16
+ latestVersion: string;
17
+ href: string;
18
+ }
19
+
20
+ const { subject, name, latestOf, latestVersion, href } = Astro.props;
21
+ const text = getVersionBannerText({ subject, latestOf });
22
+ ---
23
+
24
+ <Admonition type="warning" title="New version found">
25
+ <p>
26
+ {text.previous}<strong>{name}</strong>.{' '}
27
+ <a class="underline block pt-2" href={href}>
28
+ {text.latest}<span>v{latestVersion}</span> &rarr;
29
+ </a>
30
+ </p>
31
+ </Admonition>
@@ -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.1",
10
+ "version": "5.0.2",
11
11
  "publishConfig": {
12
12
  "access": "public"
13
13
  },
@@ -140,8 +140,8 @@
140
140
  "y-protocols": "^1.0.7",
141
141
  "yjs": "^13.6.33",
142
142
  "zod": "^4.6.6",
143
- "@eventcatalog/visualiser": "^5.0.0",
144
143
  "@eventcatalog/linter": "1.2.1",
144
+ "@eventcatalog/visualiser": "^5.0.0",
145
145
  "@eventcatalog/sdk": "2.30.0"
146
146
  },
147
147
  "devDependencies": {
@@ -1,9 +1,9 @@
1
- import {
2
- createFileSystemSourceProvider
3
- } from "./chunk-SDZQJTJW.js";
4
1
  import {
5
2
  createGitHubSourceProvider
6
3
  } from "./chunk-352FGP6W.js";
4
+ import {
5
+ createFileSystemSourceProvider
6
+ } from "./chunk-SDZQJTJW.js";
7
7
 
8
8
  // src/federation/source-provider.ts
9
9
  var createFederationSourceProvider = (projectDirectory, providers = {}) => {