@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.
- package/dist/analytics/analytics.cjs +1 -1
- package/dist/analytics/analytics.js +2 -2
- package/dist/analytics/log-build.cjs +1 -1
- package/dist/analytics/log-build.js +3 -3
- package/dist/{chunk-PV5ER42D.js → chunk-7CTNGTBB.js} +1 -1
- package/dist/{chunk-BVJJ3COQ.js → chunk-GQZVIS3Z.js} +1 -1
- package/dist/{chunk-B6NBNZGS.js → chunk-M7EPRGHR.js} +1 -1
- package/dist/{chunk-44EDP7IH.js → chunk-O6SRHGZ7.js} +1 -1
- package/dist/{chunk-MIHGWXCX.js → chunk-WAX3S32H.js} +1 -1
- package/dist/constants.cjs +1 -1
- package/dist/constants.js +1 -1
- package/dist/eventcatalog.cjs +1 -1
- package/dist/eventcatalog.js +5 -5
- package/dist/generate.cjs +1 -1
- package/dist/generate.js +3 -3
- package/dist/utils/cli-logger.cjs +1 -1
- package/dist/utils/cli-logger.js +2 -2
- package/eventcatalog/src/pages/schemas/explorer/_index.data.ts +53 -1
- package/eventcatalog/src/stores/sidebar-store/builders/domain.ts +40 -0
- package/eventcatalog/src/utils/collections/domains.ts +5 -1
- package/eventcatalog/src/utils/collections/services.ts +2 -26
- package/eventcatalog/src/utils/collections/util.ts +64 -0
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
log_build_default
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
5
|
-
import "../chunk-
|
|
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
|
package/dist/constants.cjs
CHANGED
package/dist/constants.js
CHANGED
package/dist/eventcatalog.cjs
CHANGED
|
@@ -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.
|
|
112
|
+
var version = "3.7.2";
|
|
113
113
|
|
|
114
114
|
// src/constants.ts
|
|
115
115
|
var VERSION = version;
|
package/dist/eventcatalog.js
CHANGED
|
@@ -6,8 +6,8 @@ import {
|
|
|
6
6
|
} from "./chunk-PLNJC7NZ.js";
|
|
7
7
|
import {
|
|
8
8
|
log_build_default
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
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-
|
|
24
|
+
} from "./chunk-O6SRHGZ7.js";
|
|
25
25
|
import {
|
|
26
26
|
logger
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-7CTNGTBB.js";
|
|
28
28
|
import {
|
|
29
29
|
VERSION
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-WAX3S32H.js";
|
|
31
31
|
import "./chunk-UPONRQSN.js";
|
|
32
32
|
|
|
33
33
|
// src/eventcatalog.ts
|
package/dist/generate.cjs
CHANGED
package/dist/generate.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
generate
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
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
|
package/dist/utils/cli-logger.js
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
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);
|