@eventcatalog/core 3.46.0 → 3.47.0
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-FNOYJEUK.js → chunk-ALXVETEP.js} +1 -1
- package/dist/{chunk-DOHA5HNJ.js → chunk-GBC637Z2.js} +1 -1
- package/dist/{chunk-JS6IYB55.js → chunk-XYCPSZ4V.js} +1 -1
- package/dist/{chunk-TLLUDBO4.js → chunk-ZM5P2252.js} +1 -1
- package/dist/{chunk-X4AESI6E.js → chunk-ZRLFPUCO.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 +10 -10
- 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/components/MDX/SchemaViewer/SchemaViewerRoot.astro +11 -1
- package/eventcatalog/src/components/MDX/SchemaViewer/schema-viewer-utils.spec.ts +63 -0
- package/eventcatalog/src/components/MDX/SchemaViewer/schema-viewer-utils.ts +20 -7
- package/eventcatalog/src/components/SchemaExplorer/ProtobufSchemaViewer.tsx +532 -0
- package/eventcatalog/src/components/SchemaExplorer/SchemaContentViewer.tsx +6 -0
- package/eventcatalog/src/components/SchemaExplorer/SchemaDetailsPanel.tsx +20 -2
- package/eventcatalog/src/components/SchemaExplorer/SchemaExplorer.tsx +14 -5
- package/eventcatalog/src/components/SchemaExplorer/SchemaViewerModal.tsx +8 -2
- package/eventcatalog/src/components/SchemaExplorer/utils.ts +4 -0
- package/eventcatalog/src/pages/docs/[type]/[id]/language/_index.data.ts +19 -4
- package/eventcatalog/src/pages/docs/[type]/[id]/language.mdx.ts +16 -5
- package/eventcatalog/src/stores/sidebar-store/builders/domain.ts +4 -2
- package/eventcatalog/src/stores/sidebar-store/builders/entity.ts +87 -0
- package/eventcatalog/src/stores/sidebar-store/builders/shared.ts +1 -0
- package/eventcatalog/src/stores/sidebar-store/state.ts +15 -14
- package/eventcatalog/src/styles/tailwind.css +18 -0
- package/eventcatalog/src/utils/collections/domains.ts +39 -0
- package/eventcatalog/src/utils/collections/entities.ts +3 -1
- package/eventcatalog/src/utils/files.ts +9 -0
- package/eventcatalog/src/utils/node-graphs/domain-entity-map.ts +24 -12
- package/eventcatalog/src/utils/protobuf-schema.ts +476 -0
- package/package.json +3 -4
|
@@ -140,7 +140,7 @@ var verifyRequiredFieldsAreInCatalogConfigFile = async (projectDirectory) => {
|
|
|
140
140
|
var import_os = __toESM(require("os"), 1);
|
|
141
141
|
|
|
142
142
|
// package.json
|
|
143
|
-
var version = "3.
|
|
143
|
+
var version = "3.47.0";
|
|
144
144
|
|
|
145
145
|
// src/constants.ts
|
|
146
146
|
var VERSION = version;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
log_build_default
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-ALXVETEP.js";
|
|
4
|
+
import "../chunk-XYCPSZ4V.js";
|
|
5
5
|
import "../chunk-DAOXTQVS.js";
|
|
6
|
-
import "../chunk-
|
|
6
|
+
import "../chunk-GBC637Z2.js";
|
|
7
7
|
import "../chunk-6QENHZZP.js";
|
|
8
8
|
export {
|
|
9
9
|
log_build_default as default
|
package/dist/constants.cjs
CHANGED
package/dist/constants.js
CHANGED
package/dist/eventcatalog.cjs
CHANGED
|
@@ -144,7 +144,7 @@ var verifyRequiredFieldsAreInCatalogConfigFile = async (projectDirectory) => {
|
|
|
144
144
|
var import_picocolors = __toESM(require("picocolors"), 1);
|
|
145
145
|
|
|
146
146
|
// package.json
|
|
147
|
-
var version = "3.
|
|
147
|
+
var version = "3.47.0";
|
|
148
148
|
|
|
149
149
|
// src/constants.ts
|
|
150
150
|
var VERSION = version;
|
package/dist/eventcatalog.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-DAOXTQVS.js";
|
|
2
|
+
runMigrations
|
|
3
|
+
} from "./chunk-XUAF2H54.js";
|
|
4
|
+
import "./chunk-CA4U2JP7.js";
|
|
6
5
|
import {
|
|
7
6
|
resolve_catalog_dependencies_default
|
|
8
7
|
} from "./chunk-LHR4G2UO.js";
|
|
@@ -13,9 +12,10 @@ import {
|
|
|
13
12
|
watch
|
|
14
13
|
} from "./chunk-3H2RT3CM.js";
|
|
15
14
|
import {
|
|
16
|
-
|
|
17
|
-
} from "./chunk-
|
|
18
|
-
import "./chunk-
|
|
15
|
+
log_build_default
|
|
16
|
+
} from "./chunk-ALXVETEP.js";
|
|
17
|
+
import "./chunk-XYCPSZ4V.js";
|
|
18
|
+
import "./chunk-DAOXTQVS.js";
|
|
19
19
|
import {
|
|
20
20
|
catalogToAstro
|
|
21
21
|
} from "./chunk-4SMA4HQ3.js";
|
|
@@ -28,13 +28,13 @@ import {
|
|
|
28
28
|
} from "./chunk-B7HCX5HM.js";
|
|
29
29
|
import {
|
|
30
30
|
generate
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-ZRLFPUCO.js";
|
|
32
32
|
import {
|
|
33
33
|
logger
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-ZM5P2252.js";
|
|
35
35
|
import {
|
|
36
36
|
VERSION
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-GBC637Z2.js";
|
|
38
38
|
import {
|
|
39
39
|
getEventCatalogConfigFile,
|
|
40
40
|
verifyRequiredFieldsAreInCatalogConfigFile
|
package/dist/generate.cjs
CHANGED
|
@@ -108,7 +108,7 @@ var getEventCatalogConfigFile = async (projectDirectory) => {
|
|
|
108
108
|
var import_picocolors = __toESM(require("picocolors"), 1);
|
|
109
109
|
|
|
110
110
|
// package.json
|
|
111
|
-
var version = "3.
|
|
111
|
+
var version = "3.47.0";
|
|
112
112
|
|
|
113
113
|
// src/constants.ts
|
|
114
114
|
var VERSION = version;
|
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-ZRLFPUCO.js";
|
|
4
|
+
import "./chunk-ZM5P2252.js";
|
|
5
|
+
import "./chunk-GBC637Z2.js";
|
|
6
6
|
import "./chunk-6QENHZZP.js";
|
|
7
7
|
export {
|
|
8
8
|
generate
|
package/dist/utils/cli-logger.js
CHANGED
|
@@ -4,6 +4,7 @@ import fs from 'node:fs/promises';
|
|
|
4
4
|
import { getCollection } from 'astro:content';
|
|
5
5
|
import JSONSchemaViewer from '@components/SchemaExplorer/JSONSchemaViewer';
|
|
6
6
|
import AvroSchemaViewer from '@components/SchemaExplorer/AvroSchemaViewer';
|
|
7
|
+
import ProtobufSchemaViewer from '@components/SchemaExplorer/ProtobufSchemaViewer';
|
|
7
8
|
import Admonition from '../Admonition';
|
|
8
9
|
import { getMDXComponentsByName } from '@utils/markdown';
|
|
9
10
|
import { resolveProjectPath } from '@utils/files';
|
|
@@ -46,7 +47,7 @@ try {
|
|
|
46
47
|
>
|
|
47
48
|
{schema.title && <h2 class="text-2xl font-bold mb-2 mt-0!">{schema.title}</h2>}
|
|
48
49
|
|
|
49
|
-
{/* Render
|
|
50
|
+
{/* Render the viewer matching the schema format */}
|
|
50
51
|
{schema.isAvroSchema ? (
|
|
51
52
|
<AvroSchemaViewer
|
|
52
53
|
client:load
|
|
@@ -56,6 +57,15 @@ try {
|
|
|
56
57
|
search={schema.search}
|
|
57
58
|
showRequired={schema.showRequired}
|
|
58
59
|
/>
|
|
60
|
+
) : schema.isProtobufSchema ? (
|
|
61
|
+
<ProtobufSchemaViewer
|
|
62
|
+
client:load
|
|
63
|
+
schema={schema.schema}
|
|
64
|
+
maxHeight={schema.maxHeight}
|
|
65
|
+
expand={schema.expand}
|
|
66
|
+
search={schema.search}
|
|
67
|
+
showRequired={schema.showRequired}
|
|
68
|
+
/>
|
|
59
69
|
) : (
|
|
60
70
|
<JSONSchemaViewer
|
|
61
71
|
client:load
|
|
@@ -33,6 +33,69 @@ describe('resolveSchemaViewer', () => {
|
|
|
33
33
|
expect(schema.schemaPath).toBe('git://contracts/events/OrderPlaced.schema.json');
|
|
34
34
|
});
|
|
35
35
|
|
|
36
|
+
it('parses protobuf schemas from the schema collection', async () => {
|
|
37
|
+
const protoSchema = {
|
|
38
|
+
id: 'schema:events:FraudCheckCompleted:1.0.0:git://contracts/events/FraudCheckCompleted.proto',
|
|
39
|
+
data: {
|
|
40
|
+
ref: 'git://contracts/events/FraudCheckCompleted.proto',
|
|
41
|
+
format: 'protobuf',
|
|
42
|
+
content: 'syntax = "proto3";\nmessage FraudCheckCompleted {\n string transaction_id = 1;\n}',
|
|
43
|
+
default: true,
|
|
44
|
+
message: {
|
|
45
|
+
collection: 'events',
|
|
46
|
+
id: 'FraudCheckCompleted',
|
|
47
|
+
version: '1.0.0',
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const schema = await resolveSchemaViewer({
|
|
53
|
+
id: 'FraudCheckCompleted',
|
|
54
|
+
version: '1.0.0',
|
|
55
|
+
collection: 'events',
|
|
56
|
+
filePath: 'events/FraudCheckCompleted/index.mdx',
|
|
57
|
+
schemaViewerProps: {},
|
|
58
|
+
collectionSchemas: [protoSchema],
|
|
59
|
+
index: 0,
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
expect(schema.exists).toBe(true);
|
|
63
|
+
expect(schema.isProtobufSchema).toBe(true);
|
|
64
|
+
expect(schema.schema.syntax).toBe('proto3');
|
|
65
|
+
expect(schema.schema.messages[0].name).toBe('FraudCheckCompleted');
|
|
66
|
+
expect(schema.schema.messages[0].fields[0].name).toBe('transaction_id');
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
it('captures parse errors for invalid protobuf schemas', async () => {
|
|
70
|
+
const protoSchema = {
|
|
71
|
+
id: 'schema:events:FraudCheckCompleted:1.0.0:git://contracts/events/FraudCheckCompleted.proto',
|
|
72
|
+
data: {
|
|
73
|
+
ref: 'git://contracts/events/FraudCheckCompleted.proto',
|
|
74
|
+
format: 'protobuf',
|
|
75
|
+
content: '{"this": "is not protobuf"}',
|
|
76
|
+
default: true,
|
|
77
|
+
message: {
|
|
78
|
+
collection: 'events',
|
|
79
|
+
id: 'FraudCheckCompleted',
|
|
80
|
+
version: '1.0.0',
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
const schema = await resolveSchemaViewer({
|
|
86
|
+
id: 'FraudCheckCompleted',
|
|
87
|
+
version: '1.0.0',
|
|
88
|
+
collection: 'events',
|
|
89
|
+
filePath: 'events/FraudCheckCompleted/index.mdx',
|
|
90
|
+
schemaViewerProps: {},
|
|
91
|
+
collectionSchemas: [protoSchema],
|
|
92
|
+
index: 0,
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
expect(schema.exists).toBe(false);
|
|
96
|
+
expect(schema.parseError).toBeDefined();
|
|
97
|
+
});
|
|
98
|
+
|
|
36
99
|
it('does not use the schema collection when a file is set and missing', async () => {
|
|
37
100
|
const schema = await resolveSchemaViewer({
|
|
38
101
|
id: 'OrderPlaced',
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { readFile } from 'node:fs/promises';
|
|
2
2
|
import { existsSync } from 'node:fs';
|
|
3
3
|
import { load as loadYaml } from 'js-yaml';
|
|
4
|
-
import { getAbsoluteFilePathForAstroFile, isAvroSchema } from '../../../utils/files';
|
|
4
|
+
import { getAbsoluteFilePathForAstroFile, isAvroSchema, isProtobufSchema } from '../../../utils/files';
|
|
5
|
+
import { parseProtobufSchema } from '../../../utils/protobuf-schema';
|
|
5
6
|
|
|
6
7
|
type SchemaViewerProps = {
|
|
7
8
|
id?: string;
|
|
@@ -48,13 +49,17 @@ const isYamlSchema = (schemaPath?: string, format?: string) =>
|
|
|
48
49
|
const isAvroSchemaReference = (schemaPath?: string, format?: string) =>
|
|
49
50
|
format === 'avro' || (schemaPath ? isAvroSchema(schemaPath) : false);
|
|
50
51
|
|
|
52
|
+
const isProtobufSchemaReference = (schemaPath?: string, format?: string) =>
|
|
53
|
+
format === 'protobuf' || format === 'proto' || (schemaPath ? isProtobufSchema(schemaPath) : false);
|
|
54
|
+
|
|
51
55
|
const parseSchemaContent = (content: string, schemaPath?: string, format?: string) => {
|
|
56
|
+
if (isProtobufSchemaReference(schemaPath, format)) return parseProtobufSchema(content);
|
|
52
57
|
if (isYamlSchema(schemaPath, format)) return loadYaml(content);
|
|
53
58
|
return JSON.parse(content);
|
|
54
59
|
};
|
|
55
60
|
|
|
56
|
-
const shouldRenderSchema = (schema: any,
|
|
57
|
-
if (
|
|
61
|
+
const shouldRenderSchema = (schema: any, alwaysRender: boolean) => {
|
|
62
|
+
if (alwaysRender) return true;
|
|
58
63
|
return schema?.['x-eventcatalog-render-schema-viewer'] !== undefined ? schema['x-eventcatalog-render-schema-viewer'] : true;
|
|
59
64
|
};
|
|
60
65
|
|
|
@@ -94,14 +99,20 @@ export const resolveSchemaViewer = async ({
|
|
|
94
99
|
let schema;
|
|
95
100
|
let render = true;
|
|
96
101
|
let isAvro = false;
|
|
102
|
+
let isProtobuf = false;
|
|
97
103
|
let schemaPath = localSchemaPath;
|
|
98
104
|
let parseError;
|
|
99
105
|
|
|
100
106
|
if (localSchemaExists && localSchemaPath) {
|
|
101
107
|
isAvro = isAvroSchema(localSchemaPath);
|
|
108
|
+
isProtobuf = isProtobufSchema(localSchemaPath);
|
|
102
109
|
const content = await readFile(localSchemaPath, 'utf-8');
|
|
103
|
-
|
|
104
|
-
|
|
110
|
+
try {
|
|
111
|
+
schema = parseSchemaContent(content, localSchemaPath);
|
|
112
|
+
render = shouldRenderSchema(schema, isAvro || isProtobuf);
|
|
113
|
+
} catch (error) {
|
|
114
|
+
parseError = error instanceof Error ? error.message : 'Unknown parsing error';
|
|
115
|
+
}
|
|
105
116
|
} else if (!schemaViewerProps.file) {
|
|
106
117
|
const collectionSchema = getCollectionSchemaForViewer({ collectionSchemas, collection, id, version });
|
|
107
118
|
const content = collectionSchema?.data.content;
|
|
@@ -110,8 +121,9 @@ export const resolveSchemaViewer = async ({
|
|
|
110
121
|
if (content) {
|
|
111
122
|
try {
|
|
112
123
|
isAvro = isAvroSchemaReference(schemaPath, collectionSchema?.data.format);
|
|
124
|
+
isProtobuf = isProtobufSchemaReference(schemaPath, collectionSchema?.data.format);
|
|
113
125
|
schema = parseSchemaContent(content, schemaPath, collectionSchema?.data.format);
|
|
114
|
-
render = shouldRenderSchema(schema, isAvro);
|
|
126
|
+
render = shouldRenderSchema(schema, isAvro || isProtobuf);
|
|
115
127
|
} catch (error) {
|
|
116
128
|
parseError = error instanceof Error ? error.message : 'Unknown parsing error';
|
|
117
129
|
}
|
|
@@ -120,11 +132,12 @@ export const resolveSchemaViewer = async ({
|
|
|
120
132
|
|
|
121
133
|
return {
|
|
122
134
|
id: schemaViewerProps.id || id,
|
|
123
|
-
exists:
|
|
135
|
+
exists: schema !== undefined,
|
|
124
136
|
schema,
|
|
125
137
|
schemaPath,
|
|
126
138
|
schemaKey,
|
|
127
139
|
isAvroSchema: isAvro,
|
|
140
|
+
isProtobufSchema: isProtobuf,
|
|
128
141
|
parseError,
|
|
129
142
|
...schemaViewerProps,
|
|
130
143
|
render,
|