@eventcatalog/core 2.39.0 → 2.39.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.
@@ -37,7 +37,7 @@ var import_axios = __toESM(require("axios"), 1);
37
37
  var import_os = __toESM(require("os"), 1);
38
38
 
39
39
  // package.json
40
- var version = "2.39.0";
40
+ var version = "2.39.2";
41
41
 
42
42
  // src/constants.ts
43
43
  var VERSION = version;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  raiseEvent
3
- } from "../chunk-7TGRVLSE.js";
4
- import "../chunk-PG6VTEEI.js";
3
+ } from "../chunk-UMDTA3ST.js";
4
+ import "../chunk-MYIRODAL.js";
5
5
  export {
6
6
  raiseEvent
7
7
  };
@@ -106,7 +106,7 @@ var import_axios = __toESM(require("axios"), 1);
106
106
  var import_os = __toESM(require("os"), 1);
107
107
 
108
108
  // package.json
109
- var version = "2.39.0";
109
+ var version = "2.39.2";
110
110
 
111
111
  // src/constants.ts
112
112
  var VERSION = version;
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  log_build_default
3
- } from "../chunk-YFIADR2I.js";
4
- import "../chunk-7TGRVLSE.js";
5
- import "../chunk-PG6VTEEI.js";
3
+ } from "../chunk-ZCL3ECGU.js";
4
+ import "../chunk-UMDTA3ST.js";
5
+ import "../chunk-MYIRODAL.js";
6
6
  import "../chunk-E7TXTI7G.js";
7
7
  export {
8
8
  log_build_default as default
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "2.39.0";
2
+ var version = "2.39.2";
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-PG6VTEEI.js";
3
+ } from "./chunk-MYIRODAL.js";
4
4
 
5
5
  // src/analytics/analytics.js
6
6
  import axios from "axios";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  raiseEvent
3
- } from "./chunk-7TGRVLSE.js";
3
+ } from "./chunk-UMDTA3ST.js";
4
4
  import {
5
5
  getEventCatalogConfigFile,
6
6
  verifyRequiredFieldsAreInCatalogConfigFile
@@ -25,7 +25,7 @@ __export(constants_exports, {
25
25
  module.exports = __toCommonJS(constants_exports);
26
26
 
27
27
  // package.json
28
- var version = "2.39.0";
28
+ var version = "2.39.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-PG6VTEEI.js";
3
+ } from "./chunk-MYIRODAL.js";
4
4
  export {
5
5
  VERSION
6
6
  };
@@ -157,7 +157,7 @@ var import_axios = __toESM(require("axios"), 1);
157
157
  var import_os = __toESM(require("os"), 1);
158
158
 
159
159
  // package.json
160
- var version = "2.39.0";
160
+ var version = "2.39.2";
161
161
 
162
162
  // src/constants.ts
163
163
  var VERSION = version;
@@ -6,15 +6,15 @@ import {
6
6
  } from "./chunk-DCLTVJDP.js";
7
7
  import {
8
8
  log_build_default
9
- } from "./chunk-YFIADR2I.js";
10
- import "./chunk-7TGRVLSE.js";
9
+ } from "./chunk-ZCL3ECGU.js";
10
+ import "./chunk-UMDTA3ST.js";
11
11
  import {
12
12
  catalogToAstro,
13
13
  checkAndConvertMdToMdx
14
14
  } from "./chunk-SLEMYHTU.js";
15
15
  import {
16
16
  VERSION
17
- } from "./chunk-PG6VTEEI.js";
17
+ } from "./chunk-MYIRODAL.js";
18
18
  import {
19
19
  isBackstagePluginEnabled,
20
20
  isEventCatalogScaleEnabled,
@@ -29,8 +29,8 @@ export default function ServiceNode({ data, sourcePosition, targetPosition }: an
29
29
  const nodeLabel = label || service?.data?.sidebar?.badge || 'Service';
30
30
  const fontSize = nodeLabel.length > 10 ? '7px' : '9px';
31
31
 
32
- let asyncApiFiles = Array.isArray(specifications) ? specifications?.filter((spec) => spec.type === 'asyncapi') : [];
33
- let openApiFiles = Array.isArray(specifications) ? specifications?.filter((spec) => spec.type === 'openapi') : [];
32
+ let asyncApiFiles = Array.isArray(specifications) ? specifications?.filter((spec) => spec.type === 'asyncapi') : ([] as any);
33
+ let openApiFiles = Array.isArray(specifications) ? specifications?.filter((spec) => spec.type === 'openapi') : ([] as any);
34
34
 
35
35
  if (!Array.isArray(specifications) && specifications?.asyncapiPath) {
36
36
  asyncApiFiles.push({ path: specifications.asyncapiPath, type: 'asyncapi', name: 'AsyncAPI' });
@@ -41,13 +41,13 @@ export default function ServiceNode({ data, sourcePosition, targetPosition }: an
41
41
  }
42
42
 
43
43
  // Add filename on asyncApiFiles and openApiFiles
44
- asyncApiFiles = asyncApiFiles.map((file) => {
44
+ asyncApiFiles = asyncApiFiles.map((file: any) => {
45
45
  return {
46
46
  ...file,
47
47
  filename: file.path.split('/').pop()?.split('.').shift(),
48
48
  };
49
49
  });
50
- openApiFiles = openApiFiles.map((file) => {
50
+ openApiFiles = openApiFiles.map((file: any) => {
51
51
  return {
52
52
  ...file,
53
53
  filename: file.path.split('/').pop()?.split('.').shift(),
@@ -120,7 +120,7 @@ export default function ServiceNode({ data, sourcePosition, targetPosition }: an
120
120
  </ContextMenu.Item>
121
121
  <ContextMenu.Separator className="h-[1px] bg-gray-200 m-1" />
122
122
  {asyncApiFiles.length > 0 &&
123
- asyncApiFiles.map((file) => (
123
+ asyncApiFiles.map((file: any) => (
124
124
  <ContextMenu.Item asChild key={file.path}>
125
125
  <a
126
126
  href={buildUrl(`/docs/services/${id}/${version}/asyncapi/${file.filename}`)}
@@ -133,7 +133,7 @@ export default function ServiceNode({ data, sourcePosition, targetPosition }: an
133
133
  </ContextMenu.Item>
134
134
  ))}
135
135
  {openApiFiles.length > 0 &&
136
- openApiFiles.map((file) => (
136
+ openApiFiles.map((file: any) => (
137
137
  <ContextMenu.Item asChild key={file.path}>
138
138
  <a
139
139
  href={buildUrl(`/docs/services/${id}/${version}/spec/${file.filename}`)}
@@ -57,6 +57,11 @@ export async function getResourcesForNavigation({ currentPath }: { currentPath:
57
57
  href: buildUrl(`/${route}/${entity.collection}/${entity.data.id}/${entity.data.version}`),
58
58
  }));
59
59
 
60
+ // don't render items if we are in the visualiser and the item has visualiser set to false
61
+ if (currentPath.includes('visualiser') && item.data.visualiser === false) {
62
+ return acc;
63
+ }
64
+
60
65
  const navigationItem = {
61
66
  label: item.data.name,
62
67
  version: item.data.version,
@@ -78,6 +83,7 @@ export async function getResourcesForNavigation({ currentPath }: { currentPath:
78
83
  entities: entitiesWithHref,
79
84
  specifications: isCollectionService ? getSpecificationsForService(item) : null,
80
85
  sidebar: item.data?.sidebar,
86
+ renderInVisualiser: item.data?.visualiser ?? true,
81
87
  };
82
88
 
83
89
  group.push(navigationItem);
@@ -135,6 +135,7 @@ const baseSchema = z.object({
135
135
  z.boolean().optional(),
136
136
  ])
137
137
  .optional(),
138
+ visualiser: z.boolean().optional(),
138
139
  // Used by eventcatalog
139
140
  versions: z.array(z.string()).optional(),
140
141
  latestVersion: z.string().optional(),
@@ -70,8 +70,13 @@ const getDefaultUrl = (route: string, defaultValue: string) => {
70
70
 
71
71
  for (const { data, key } of collections) {
72
72
  if (data.length > 0 && isCollectionVisibleInCatalog(key)) {
73
- const item = data[0];
74
- return buildUrl(`/${route}/${key}/${item.data.id}/${item.data.latestVersion}`);
73
+ // find the first item that has visualiser set to true
74
+ const item = data.find((item) => item.data.visualiser !== false);
75
+ if (item) {
76
+ return buildUrl(`/${route}/${key}/${item.data.id}/${item.data.latestVersion}`);
77
+ } else {
78
+ continue;
79
+ }
75
80
  }
76
81
  }
77
82
 
@@ -8,6 +8,8 @@ import NodeGraph from '@components/MDX/NodeGraph/NodeGraph.astro';
8
8
  import SchemaViewer from '@components/MDX/SchemaViewer/SchemaViewerRoot.astro';
9
9
  import Admonition from '@components/MDX/Admonition';
10
10
 
11
+ import { getSpecificationsForService } from '@utils/collections/services';
12
+
11
13
  import { resourceToCollectionMap, collectionToResourceMap } from '@utils/collections/util';
12
14
 
13
15
  // SideBars
@@ -136,31 +138,40 @@ const getBadge = () => {
136
138
 
137
139
  const getSpecificationBadges = () => {
138
140
  const badges = [];
139
- const hasOpenAPISpec = !!props.data.specifications?.openapiPath;
140
- const hasAsyncAPISpec = !!props.data.specifications?.asyncapiPath;
141
-
142
- if (hasOpenAPISpec) {
143
- badges.push({
144
- backgroundColor: 'white',
145
- textColor: 'gray',
146
- content: 'OpenAPI Spec',
147
- iconURL: buildUrl('/icons/openapi.svg', true),
148
- class: 'text-black hover:underline',
149
- id: 'open-api-badge',
150
- url: buildUrl(`/docs/${props.collection}/${props.data.id}/${props.data.version}/spec`),
151
- });
141
+
142
+ const specifications = getSpecificationsForService(props);
143
+
144
+ const asyncapiSpecs = specifications.filter((spec) => spec.type === 'asyncapi');
145
+ const openapiSpecs = specifications.filter((spec) => spec.type === 'openapi');
146
+
147
+ if (openapiSpecs.length > 0) {
148
+ for (const spec of openapiSpecs) {
149
+ badges.push({
150
+ backgroundColor: 'white',
151
+ textColor: 'gray',
152
+ content: spec.name || 'OpenAPI Spec',
153
+ iconURL: buildUrl('/icons/openapi.svg', true),
154
+ class: 'text-black hover:underline',
155
+ id: 'open-api-badge',
156
+ url: buildUrl(`/docs/${props.collection}/${props.data.id}/${props.data.version}/spec/${spec.filenameWithoutExtension}`),
157
+ });
158
+ }
152
159
  }
153
160
 
154
- if (hasAsyncAPISpec) {
155
- badges.push({
156
- backgroundColor: 'white',
157
- textColor: 'gray',
158
- content: 'AsyncAPI Spec',
159
- iconURL: buildUrl('/icons/asyncapi.svg', true),
160
- class: 'text-black hover:underline',
161
- id: 'asyncapi-badge',
162
- url: buildUrl(`/docs/${props.collection}/${props.data.id}/${props.data.version}/asyncapi`),
163
- });
161
+ if (asyncapiSpecs.length > 0) {
162
+ for (const spec of asyncapiSpecs) {
163
+ badges.push({
164
+ backgroundColor: 'white',
165
+ textColor: 'gray',
166
+ content: spec.name || 'AsyncAPI Spec',
167
+ iconURL: buildUrl('/icons/asyncapi.svg', true),
168
+ class: 'text-black hover:underline',
169
+ id: 'asyncapi-badge',
170
+ url: buildUrl(
171
+ `/docs/${props.collection}/${props.data.id}/${props.data.version}/asyncapi/${spec.filenameWithoutExtension}`
172
+ ),
173
+ });
174
+ }
164
175
  }
165
176
 
166
177
  return badges;
@@ -19,17 +19,19 @@ export async function getStaticPaths() {
19
19
  const allItems = await Promise.all(itemTypes.map((type) => loaders[type]()));
20
20
 
21
21
  return allItems.flatMap((items, index) =>
22
- items.map((item) => ({
23
- params: {
24
- type: itemTypes[index],
25
- id: item.data.id,
26
- version: item.data.version,
27
- },
28
- props: {
29
- type: itemTypes[index],
30
- ...item,
31
- },
32
- }))
22
+ items
23
+ .filter((item) => item.data.visualiser !== false)
24
+ .map((item) => ({
25
+ params: {
26
+ type: itemTypes[index],
27
+ id: item.data.id,
28
+ version: item.data.version,
29
+ },
30
+ props: {
31
+ type: itemTypes[index],
32
+ ...item,
33
+ },
34
+ }))
33
35
  );
34
36
  }
35
37
 
@@ -11,6 +11,9 @@ import type { CollectionTypes } from '@types';
11
11
  export async function getStaticPaths() {
12
12
  const [events, commands, services, domains] = await Promise.all([getEvents(), getCommands(), getServices(), getDomains()]);
13
13
 
14
+ const resources = [...domains, ...events, ...services, ...commands];
15
+ const resourcesWithVisualiserEnabled = resources.filter((resource) => resource.data.visualiser !== false);
16
+
14
17
  const buildPages = (collection: CollectionEntry<CollectionTypes>[]) => {
15
18
  return collection.map((item) => ({
16
19
  params: {
@@ -24,7 +27,7 @@ export async function getStaticPaths() {
24
27
  }));
25
28
  };
26
29
 
27
- return [...buildPages(domains), ...buildPages(events), ...buildPages(services), ...buildPages(commands)];
30
+ return [...buildPages(resourcesWithVisualiserEnabled)];
28
31
  }
29
32
 
30
33
  const props = Astro.props;
@@ -35,8 +35,13 @@ export const getSchemasFromResource = (resource: CollectionEntry<PageTypes>): Sc
35
35
  }
36
36
 
37
37
  if (resource.collection === 'services') {
38
- const asyncapiPath = resource?.data?.specifications?.asyncapiPath;
39
- const openapiPath = resource?.data?.specifications?.openapiPath;
38
+ const specifications = resource?.data?.specifications;
39
+ const asyncapiPath = Array.isArray(specifications)
40
+ ? specifications.find((spec) => spec.type === 'asyncapi')?.path
41
+ : specifications?.asyncapiPath;
42
+ const openapiPath = Array.isArray(specifications)
43
+ ? specifications.find((spec) => spec.type === 'openapi')?.path
44
+ : specifications?.openapiPath;
40
45
  // @ts-ignore
41
46
  const publicPath = resource?.catalog?.publicPath;
42
47
  const schemas = [];
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "url": "https://github.com/event-catalog/eventcatalog.git"
7
7
  },
8
8
  "type": "module",
9
- "version": "2.39.0",
9
+ "version": "2.39.2",
10
10
  "publishConfig": {
11
11
  "access": "public"
12
12
  },