@eventcatalog/core 3.7.1 → 3.7.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 = "3.7.1";
40
+ var version = "3.7.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-BVJJ3COQ.js";
4
- import "../chunk-MIHGWXCX.js";
3
+ } from "../chunk-GQZVIS3Z.js";
4
+ import "../chunk-WAX3S32H.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 = "3.7.1";
109
+ var version = "3.7.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-B6NBNZGS.js";
4
- import "../chunk-BVJJ3COQ.js";
5
- import "../chunk-MIHGWXCX.js";
3
+ } from "../chunk-M7EPRGHR.js";
4
+ import "../chunk-GQZVIS3Z.js";
5
+ import "../chunk-WAX3S32H.js";
6
6
  import "../chunk-UPONRQSN.js";
7
7
  export {
8
8
  log_build_default as default
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VERSION
3
- } from "./chunk-MIHGWXCX.js";
3
+ } from "./chunk-WAX3S32H.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-MIHGWXCX.js";
3
+ } from "./chunk-WAX3S32H.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-BVJJ3COQ.js";
3
+ } from "./chunk-GQZVIS3Z.js";
4
4
  import {
5
5
  getEventCatalogConfigFile,
6
6
  verifyRequiredFieldsAreInCatalogConfigFile
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  logger
3
- } from "./chunk-PV5ER42D.js";
3
+ } from "./chunk-7CTNGTBB.js";
4
4
  import {
5
5
  cleanup,
6
6
  getEventCatalogConfigFile
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "3.7.1";
2
+ var version = "3.7.2";
3
3
 
4
4
  // src/constants.ts
5
5
  var VERSION = version;
@@ -25,7 +25,7 @@ __export(constants_exports, {
25
25
  module.exports = __toCommonJS(constants_exports);
26
26
 
27
27
  // package.json
28
- var version = "3.7.1";
28
+ var version = "3.7.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-MIHGWXCX.js";
3
+ } from "./chunk-WAX3S32H.js";
4
4
  export {
5
5
  VERSION
6
6
  };
@@ -109,7 +109,7 @@ var verifyRequiredFieldsAreInCatalogConfigFile = async (projectDirectory) => {
109
109
  var import_picocolors = __toESM(require("picocolors"), 1);
110
110
 
111
111
  // package.json
112
- var version = "3.7.1";
112
+ var version = "3.7.2";
113
113
 
114
114
  // src/constants.ts
115
115
  var VERSION = version;
@@ -6,8 +6,8 @@ import {
6
6
  } from "./chunk-PLNJC7NZ.js";
7
7
  import {
8
8
  log_build_default
9
- } from "./chunk-B6NBNZGS.js";
10
- import "./chunk-BVJJ3COQ.js";
9
+ } from "./chunk-M7EPRGHR.js";
10
+ import "./chunk-GQZVIS3Z.js";
11
11
  import {
12
12
  runMigrations
13
13
  } from "./chunk-BH3JMNAV.js";
@@ -21,13 +21,13 @@ import {
21
21
  } from "./chunk-5VBIXL6C.js";
22
22
  import {
23
23
  generate
24
- } from "./chunk-44EDP7IH.js";
24
+ } from "./chunk-O6SRHGZ7.js";
25
25
  import {
26
26
  logger
27
- } from "./chunk-PV5ER42D.js";
27
+ } from "./chunk-7CTNGTBB.js";
28
28
  import {
29
29
  VERSION
30
- } from "./chunk-MIHGWXCX.js";
30
+ } from "./chunk-WAX3S32H.js";
31
31
  import "./chunk-UPONRQSN.js";
32
32
 
33
33
  // src/eventcatalog.ts
package/dist/generate.cjs CHANGED
@@ -73,7 +73,7 @@ var getEventCatalogConfigFile = async (projectDirectory) => {
73
73
  var import_picocolors = __toESM(require("picocolors"), 1);
74
74
 
75
75
  // package.json
76
- var version = "3.7.1";
76
+ var version = "3.7.2";
77
77
 
78
78
  // src/constants.ts
79
79
  var VERSION = version;
package/dist/generate.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  generate
3
- } from "./chunk-44EDP7IH.js";
4
- import "./chunk-PV5ER42D.js";
5
- import "./chunk-MIHGWXCX.js";
3
+ } from "./chunk-O6SRHGZ7.js";
4
+ import "./chunk-7CTNGTBB.js";
5
+ import "./chunk-WAX3S32H.js";
6
6
  import "./chunk-UPONRQSN.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 = "3.7.1";
39
+ var version = "3.7.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-PV5ER42D.js";
4
- import "../chunk-MIHGWXCX.js";
3
+ } from "../chunk-7CTNGTBB.js";
4
+ import "../chunk-WAX3S32H.js";
5
5
  export {
6
6
  logger
7
7
  };
@@ -4,6 +4,7 @@ import { getEvents } from '@utils/collections/events';
4
4
  import { getCommands } from '@utils/collections/commands';
5
5
  import { getQueries } from '@utils/collections/queries';
6
6
  import { getServices, getSpecificationsForService } from '@utils/collections/services';
7
+ import { getDomains, getSpecificationsForDomain } from '@utils/collections/domains';
7
8
  import { getOwner } from '@utils/collections/owners';
8
9
  import { buildUrl } from '@utils/url-builder';
9
10
  import { resourceFileExists, readResourceFile } from '@utils/resource-files';
@@ -133,7 +134,58 @@ async function fetchAllSchemas() {
133
134
  // Flatten and filter out null values
134
135
  const flatServicesWithSpecs = servicesWithSpecs.flat().filter((service) => service !== null);
135
136
 
136
- return [...messagesWithSchemas, ...flatServicesWithSpecs];
137
+ // Fetch all domains
138
+ const domains = await getDomains({ getAllVersions: true });
139
+
140
+ // Filter domains with specifications and read spec content - only keep essential data
141
+ const domainsWithSpecs = await Promise.all(
142
+ domains.map(async (domain) => {
143
+ try {
144
+ const specifications = getSpecificationsForDomain(domain);
145
+
146
+ if (specifications.length === 0) {
147
+ return null;
148
+ }
149
+
150
+ return await Promise.all(
151
+ specifications.map(async (spec) => {
152
+ if (!resourceFileExists(domain, spec.path)) {
153
+ return null;
154
+ }
155
+
156
+ const schemaContent = readResourceFile(domain, spec.path) ?? '';
157
+ const schemaExtension = spec.type;
158
+ const enrichedOwners = await enrichOwners(domain.data.owners || []);
159
+
160
+ return {
161
+ collection: 'domains',
162
+ data: {
163
+ id: `${domain.data.id}`,
164
+ name: `${domain.data.name} - ${spec.name}`,
165
+ version: domain.data.version,
166
+ summary: domain.data.summary,
167
+ schemaPath: spec.path,
168
+ owners: enrichedOwners,
169
+ },
170
+ schemaContent,
171
+ schemaExtension,
172
+ specType: spec.type,
173
+ specName: spec.name,
174
+ specFilenameWithoutExtension: spec.filenameWithoutExtension,
175
+ };
176
+ })
177
+ );
178
+ } catch (error) {
179
+ console.error(`Error reading specifications for domain ${domain.data.id}:`, error);
180
+ return null;
181
+ }
182
+ })
183
+ );
184
+
185
+ // Flatten and filter out null values for domains
186
+ const flatDomainsWithSpecs = domainsWithSpecs.flat().filter((domain) => domain !== null);
187
+
188
+ return [...messagesWithSchemas, ...flatServicesWithSpecs, ...flatDomainsWithSpecs];
137
189
  }
138
190
 
139
191
  export class Page extends HybridPage {
@@ -12,6 +12,7 @@ import {
12
12
  } from './shared';
13
13
  import { isVisualiserEnabled } from '@utils/feature';
14
14
  import { pluralizeMessageType } from '@utils/collections/messages';
15
+ import { getSpecificationsForDomain } from '@utils/collections/domains';
15
16
 
16
17
  export const buildDomainNode = (domain: CollectionEntry<'domains'>, owners: any[], context: ResourceGroupContext): NavNode => {
17
18
  const servicesInDomain = domain.data.services || [];
@@ -48,6 +49,14 @@ export const buildDomainNode = (domain: CollectionEntry<'domains'>, owners: any[
48
49
  const diagramNavItems = buildDiagramNavItems(domainDiagrams, context.diagrams);
49
50
  const hasDiagrams = diagramNavItems.length > 0;
50
51
 
52
+ // Specifications
53
+ const specifications = getSpecificationsForDomain(domain);
54
+ const hasSpecifications = specifications.length > 0;
55
+ const openAPISpecifications = specifications.filter((specification) => specification.type === 'openapi');
56
+ const asyncAPISpecifications = specifications.filter((specification) => specification.type === 'asyncapi');
57
+ const graphQLSpecifications = specifications.filter((specification) => specification.type === 'graphql');
58
+ const renderSpecifications = hasSpecifications && shouldRenderSideBarSection(domain, 'specifications');
59
+
51
60
  return {
52
61
  type: 'item',
53
62
  title: domain.data.name,
@@ -87,6 +96,37 @@ export const buildDomainNode = (domain: CollectionEntry<'domains'>, owners: any[
87
96
  icon: 'FileImage',
88
97
  pages: diagramNavItems,
89
98
  },
99
+ renderSpecifications && {
100
+ type: 'group',
101
+ title: 'API & Contracts',
102
+ icon: 'FileCode',
103
+ pages: [
104
+ ...openAPISpecifications.map((specification) => ({
105
+ type: 'item',
106
+ title: specification.name,
107
+ leftIcon: '/icons/openapi-black.svg',
108
+ href: buildUrl(
109
+ `/docs/domains/${domain.data.id}/${domain.data.version}/spec/${specification.filenameWithoutExtension}`
110
+ ),
111
+ })),
112
+ ...asyncAPISpecifications.map((specification) => ({
113
+ type: 'item',
114
+ title: specification.name,
115
+ leftIcon: '/icons/asyncapi-black.svg',
116
+ href: buildUrl(
117
+ `/docs/domains/${domain.data.id}/${domain.data.version}/asyncapi/${specification.filenameWithoutExtension}`
118
+ ),
119
+ })),
120
+ ...graphQLSpecifications.map((specification) => ({
121
+ type: 'item',
122
+ title: specification.name,
123
+ leftIcon: '/icons/graphql-black.svg',
124
+ href: buildUrl(
125
+ `/docs/domains/${domain.data.id}/${domain.data.version}/graphql/${specification.filenameWithoutExtension}`
126
+ ),
127
+ })),
128
+ ],
129
+ },
90
130
  renderSubDomains && {
91
131
  type: 'group',
92
132
  title: 'Subdomains',
@@ -4,7 +4,7 @@ import path from 'path';
4
4
  import type { CollectionMessageTypes } from '@types';
5
5
  import type { Service } from './types';
6
6
  import utils from '@eventcatalog/sdk';
7
- import { createVersionedMap, findInMap } from '@utils/collections/util';
7
+ import { createVersionedMap, findInMap, processSpecifications } from '@utils/collections/util';
8
8
 
9
9
  const PROJECT_DIR = process.env.PROJECT_DIR || process.cwd();
10
10
  const CACHE_ENABLED = process.env.DISABLE_EVENTCATALOG_CACHE !== 'true';
@@ -383,3 +383,7 @@ export const getDomainsForService = async (service: Service): Promise<Domain[]>
383
383
  export const domainHasEntities = (domain: Domain): boolean => {
384
384
  return (domain.data.entities && domain.data.entities.length > 0) || false;
385
385
  };
386
+
387
+ export const getSpecificationsForDomain = (domain: Domain) => {
388
+ return processSpecifications(domain.data.specifications as any);
389
+ };
@@ -6,7 +6,7 @@ import type { CollectionMessageTypes, CollectionTypes } from '@types';
6
6
  const PROJECT_DIR = process.env.PROJECT_DIR || process.cwd();
7
7
  import utils, { type Domain } from '@eventcatalog/sdk';
8
8
  import { getDomains, getDomainsForService } from './domains';
9
- import { createVersionedMap, findInMap } from '@utils/collections/util';
9
+ import { createVersionedMap, findInMap, processSpecifications } from '@utils/collections/util';
10
10
 
11
11
  export type Service = CollectionEntry<'services'>;
12
12
 
@@ -174,31 +174,7 @@ export const getConsumersOfMessage = (services: Service[], message: CollectionEn
174
174
  };
175
175
 
176
176
  export const getSpecificationsForService = (service: CollectionEntry<CollectionTypes>) => {
177
- const specifications = Array.isArray(service.data.specifications) ? service.data.specifications : [];
178
-
179
- if (service.data.specifications && !Array.isArray(service.data.specifications)) {
180
- if (service.data.specifications.asyncapiPath) {
181
- specifications.push({
182
- type: 'asyncapi',
183
- path: service.data.specifications.asyncapiPath,
184
- name: 'AsyncAPI',
185
- });
186
- }
187
- if (service.data.specifications.openapiPath) {
188
- specifications.push({
189
- type: 'openapi',
190
- path: service.data.specifications.openapiPath,
191
- name: 'OpenAPI',
192
- });
193
- }
194
- }
195
-
196
- return specifications.map((spec) => ({
197
- ...spec,
198
- name: spec.name || (spec.type === 'asyncapi' ? 'AsyncAPI' : 'OpenAPI'),
199
- filename: path.basename(spec.path),
200
- filenameWithoutExtension: path.basename(spec.path, path.extname(spec.path)),
201
- }));
177
+ return processSpecifications(service.data.specifications as any);
202
178
  };
203
179
  // Get services for channel
204
180
  export const getProducersAndConsumersForChannel = async (channel: CollectionEntry<'channels'>) => {
@@ -1,6 +1,70 @@
1
1
  import type { CollectionTypes } from '@types';
2
2
  import type { CollectionEntry } from 'astro:content';
3
3
  import semver, { coerce, compare, eq, satisfies as satisfiesRange } from 'semver';
4
+ import path from 'node:path';
5
+
6
+ // --- SPECIFICATION HELPERS ---
7
+
8
+ export type SpecificationType = 'asyncapi' | 'openapi' | 'graphql';
9
+
10
+ export interface SpecificationInput {
11
+ type: SpecificationType;
12
+ path: string;
13
+ name?: string;
14
+ }
15
+
16
+ export interface ProcessedSpecification {
17
+ type: SpecificationType;
18
+ path: string;
19
+ name: string;
20
+ filename: string;
21
+ filenameWithoutExtension: string;
22
+ }
23
+
24
+ export const getDefaultSpecificationName = (type: string): string => {
25
+ switch (type) {
26
+ case 'asyncapi':
27
+ return 'AsyncAPI';
28
+ case 'openapi':
29
+ return 'OpenAPI';
30
+ case 'graphql':
31
+ return 'GraphQL';
32
+ default:
33
+ return 'Specification';
34
+ }
35
+ };
36
+
37
+ interface LegacySpecificationFormat {
38
+ asyncapiPath?: string;
39
+ openapiPath?: string;
40
+ graphqlPath?: string;
41
+ }
42
+
43
+ export const processSpecifications = (
44
+ specifications: SpecificationInput[] | LegacySpecificationFormat | undefined
45
+ ): ProcessedSpecification[] => {
46
+ const specs: SpecificationInput[] = Array.isArray(specifications) ? [...specifications] : [];
47
+
48
+ // Handle legacy object format
49
+ if (specifications && !Array.isArray(specifications)) {
50
+ if (specifications.asyncapiPath) {
51
+ specs.push({ type: 'asyncapi', path: specifications.asyncapiPath, name: 'AsyncAPI' });
52
+ }
53
+ if (specifications.openapiPath) {
54
+ specs.push({ type: 'openapi', path: specifications.openapiPath, name: 'OpenAPI' });
55
+ }
56
+ if (specifications.graphqlPath) {
57
+ specs.push({ type: 'graphql', path: specifications.graphqlPath, name: 'GraphQL' });
58
+ }
59
+ }
60
+
61
+ return specs.map((spec) => ({
62
+ ...spec,
63
+ name: spec.name || getDefaultSpecificationName(spec.type),
64
+ filename: path.basename(spec.path),
65
+ filenameWithoutExtension: path.basename(spec.path, path.extname(spec.path)),
66
+ }));
67
+ };
4
68
 
5
69
  export const getPreviousVersion = (version: string, versions: string[]) => {
6
70
  const index = versions.indexOf(version);
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": "3.7.1",
9
+ "version": "3.7.2",
10
10
  "publishConfig": {
11
11
  "access": "public"
12
12
  },