@eventcatalog/core 3.26.8 → 3.26.10
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-677ZSR3F.js → chunk-36UOEJB6.js} +1 -1
- package/dist/{chunk-4YHMATES.js → chunk-3WNDAYNT.js} +1 -1
- package/dist/{chunk-5WB6S5GZ.js → chunk-MCI7EV4M.js} +1 -1
- package/dist/{chunk-TPK3LJWI.js → chunk-MWXKKEYC.js} +1 -1
- package/dist/{chunk-5S25RP7K.js → chunk-R2DZZEDF.js} +1 -1
- package/dist/constants.cjs +1 -1
- package/dist/constants.js +1 -1
- package/dist/eventcatalog.cjs +11 -8
- package/dist/eventcatalog.js +15 -12
- 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/FieldsExplorer/FieldsTable.tsx +5 -3
- package/eventcatalog/src/enterprise/fields/field-extractor.test.ts +56 -0
- package/eventcatalog/src/enterprise/fields/field-extractor.ts +9 -6
- package/eventcatalog/src/enterprise/fields/field-indexer.ts +3 -3
- package/package.json +3 -3
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
log_build_default
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-MWXKKEYC.js";
|
|
4
|
+
import "../chunk-MCI7EV4M.js";
|
|
5
5
|
import "../chunk-4UVFXLPI.js";
|
|
6
|
-
import "../chunk-
|
|
6
|
+
import "../chunk-R2DZZEDF.js";
|
|
7
7
|
import "../chunk-5T63CXKU.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
|
@@ -114,7 +114,7 @@ var verifyRequiredFieldsAreInCatalogConfigFile = async (projectDirectory) => {
|
|
|
114
114
|
var import_picocolors = __toESM(require("picocolors"), 1);
|
|
115
115
|
|
|
116
116
|
// package.json
|
|
117
|
-
var version = "3.26.
|
|
117
|
+
var version = "3.26.10";
|
|
118
118
|
|
|
119
119
|
// src/constants.ts
|
|
120
120
|
var VERSION = version;
|
|
@@ -1117,7 +1117,8 @@ function walkJsonSchema(node, prefix, requiredList, rootSchema, fields) {
|
|
|
1117
1117
|
if (prop.$ref) {
|
|
1118
1118
|
const resolved = resolveLocalRef(prop.$ref, rootSchema);
|
|
1119
1119
|
if (resolved) {
|
|
1120
|
-
const
|
|
1120
|
+
const rawRefType = resolved.type || "object";
|
|
1121
|
+
const type2 = Array.isArray(rawRefType) ? [...rawRefType].sort().join(" | ") : rawRefType;
|
|
1121
1122
|
fields.push({ path: path9, type: type2, description: resolved.description || "", required: isRequired });
|
|
1122
1123
|
if (resolved.properties) {
|
|
1123
1124
|
walkJsonSchema(resolved, path9, resolved.required || [], rootSchema, fields);
|
|
@@ -1127,12 +1128,14 @@ function walkJsonSchema(node, prefix, requiredList, rootSchema, fields) {
|
|
|
1127
1128
|
}
|
|
1128
1129
|
continue;
|
|
1129
1130
|
}
|
|
1130
|
-
const
|
|
1131
|
+
const rawType = prop.type || (prop.enum ? "enum" : prop.$ref ? "$ref" : "object");
|
|
1132
|
+
const typeList = Array.isArray(rawType) ? rawType : [rawType];
|
|
1133
|
+
const type = Array.isArray(rawType) ? [...rawType].sort().join(" | ") : rawType;
|
|
1131
1134
|
fields.push({ path: path9, type, description: prop.description || "", required: isRequired });
|
|
1132
|
-
if (
|
|
1135
|
+
if (typeList.includes("object") && prop.properties) {
|
|
1133
1136
|
walkJsonSchema(prop, path9, prop.required || [], rootSchema, fields);
|
|
1134
1137
|
}
|
|
1135
|
-
if (
|
|
1138
|
+
if (typeList.includes("array") && prop.items) {
|
|
1136
1139
|
if (prop.items.type === "object" && prop.items.properties) {
|
|
1137
1140
|
walkJsonSchema(prop.items, `${path9}[]`, prop.items.required || [], rootSchema, fields);
|
|
1138
1141
|
}
|
|
@@ -1174,9 +1177,9 @@ async function buildFieldsIndex(catalogDir, outputDir) {
|
|
|
1174
1177
|
sdk.getQueries({ latestOnly: true })
|
|
1175
1178
|
]);
|
|
1176
1179
|
const collections = [
|
|
1177
|
-
{ entries: events, type: "event" },
|
|
1178
|
-
{ entries: commands, type: "command" },
|
|
1179
|
-
{ entries: queries, type: "query" }
|
|
1180
|
+
{ entries: events || [], type: "event" },
|
|
1181
|
+
{ entries: commands || [], type: "command" },
|
|
1182
|
+
{ entries: queries || [], type: "query" }
|
|
1180
1183
|
];
|
|
1181
1184
|
for (const { entries, type } of collections) {
|
|
1182
1185
|
for (const entry of entries) {
|
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-MWXKKEYC.js";
|
|
10
|
+
import "./chunk-MCI7EV4M.js";
|
|
11
11
|
import "./chunk-4UVFXLPI.js";
|
|
12
12
|
import {
|
|
13
13
|
runMigrations
|
|
@@ -22,13 +22,13 @@ import {
|
|
|
22
22
|
} from "./chunk-3KXCGYET.js";
|
|
23
23
|
import {
|
|
24
24
|
generate
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-3WNDAYNT.js";
|
|
26
26
|
import {
|
|
27
27
|
logger
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-36UOEJB6.js";
|
|
29
29
|
import {
|
|
30
30
|
VERSION
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-R2DZZEDF.js";
|
|
32
32
|
import {
|
|
33
33
|
getEventCatalogConfigFile,
|
|
34
34
|
verifyRequiredFieldsAreInCatalogConfigFile
|
|
@@ -464,7 +464,8 @@ function walkJsonSchema(node, prefix, requiredList, rootSchema, fields) {
|
|
|
464
464
|
if (prop.$ref) {
|
|
465
465
|
const resolved = resolveLocalRef(prop.$ref, rootSchema);
|
|
466
466
|
if (resolved) {
|
|
467
|
-
const
|
|
467
|
+
const rawRefType = resolved.type || "object";
|
|
468
|
+
const type2 = Array.isArray(rawRefType) ? [...rawRefType].sort().join(" | ") : rawRefType;
|
|
468
469
|
fields.push({ path: path3, type: type2, description: resolved.description || "", required: isRequired });
|
|
469
470
|
if (resolved.properties) {
|
|
470
471
|
walkJsonSchema(resolved, path3, resolved.required || [], rootSchema, fields);
|
|
@@ -474,12 +475,14 @@ function walkJsonSchema(node, prefix, requiredList, rootSchema, fields) {
|
|
|
474
475
|
}
|
|
475
476
|
continue;
|
|
476
477
|
}
|
|
477
|
-
const
|
|
478
|
+
const rawType = prop.type || (prop.enum ? "enum" : prop.$ref ? "$ref" : "object");
|
|
479
|
+
const typeList = Array.isArray(rawType) ? rawType : [rawType];
|
|
480
|
+
const type = Array.isArray(rawType) ? [...rawType].sort().join(" | ") : rawType;
|
|
478
481
|
fields.push({ path: path3, type, description: prop.description || "", required: isRequired });
|
|
479
|
-
if (
|
|
482
|
+
if (typeList.includes("object") && prop.properties) {
|
|
480
483
|
walkJsonSchema(prop, path3, prop.required || [], rootSchema, fields);
|
|
481
484
|
}
|
|
482
|
-
if (
|
|
485
|
+
if (typeList.includes("array") && prop.items) {
|
|
483
486
|
if (prop.items.type === "object" && prop.items.properties) {
|
|
484
487
|
walkJsonSchema(prop.items, `${path3}[]`, prop.items.required || [], rootSchema, fields);
|
|
485
488
|
}
|
|
@@ -521,9 +524,9 @@ async function buildFieldsIndex(catalogDir, outputDir) {
|
|
|
521
524
|
sdk.getQueries({ latestOnly: true })
|
|
522
525
|
]);
|
|
523
526
|
const collections = [
|
|
524
|
-
{ entries: events, type: "event" },
|
|
525
|
-
{ entries: commands, type: "command" },
|
|
526
|
-
{ entries: queries, type: "query" }
|
|
527
|
+
{ entries: events || [], type: "event" },
|
|
528
|
+
{ entries: commands || [], type: "command" },
|
|
529
|
+
{ entries: queries || [], type: "query" }
|
|
527
530
|
];
|
|
528
531
|
for (const { entries, type } of collections) {
|
|
529
532
|
for (const entry of entries) {
|
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-3WNDAYNT.js";
|
|
4
|
+
import "./chunk-36UOEJB6.js";
|
|
5
|
+
import "./chunk-R2DZZEDF.js";
|
|
6
6
|
import "./chunk-5T63CXKU.js";
|
|
7
7
|
export {
|
|
8
8
|
generate
|
package/dist/utils/cli-logger.js
CHANGED
|
@@ -71,7 +71,7 @@ function FieldPathCell({ path }: { path: string }) {
|
|
|
71
71
|
const [copied, setCopied] = useState(false);
|
|
72
72
|
|
|
73
73
|
return (
|
|
74
|
-
<span className="inline-flex items-center gap-1 font-mono text-[rgb(var(--ec-page-text))]">
|
|
74
|
+
<span className="inline-flex items-center gap-1 font-mono text-[rgb(var(--ec-page-text))]" title={path}>
|
|
75
75
|
{path}
|
|
76
76
|
<button
|
|
77
77
|
className={`opacity-0 group-hover:opacity-100 transition-opacity p-0.5 rounded hover:bg-[rgb(var(--ec-content-hover))]`}
|
|
@@ -162,8 +162,10 @@ export default function FieldsTable({ fields, onSelectField, isLoading, isScaleE
|
|
|
162
162
|
className="group cursor-pointer transition-colors hover:bg-[rgb(var(--ec-content-hover))]"
|
|
163
163
|
onClick={() => onSelectField(field.path)}
|
|
164
164
|
>
|
|
165
|
-
<td className="px-4 py-3 text-sm">
|
|
166
|
-
<
|
|
165
|
+
<td className="px-4 py-3 text-sm max-w-[300px]">
|
|
166
|
+
<div className="overflow-x-auto">
|
|
167
|
+
<FieldPathCell path={field.path} />
|
|
168
|
+
</div>
|
|
167
169
|
</td>
|
|
168
170
|
<td className="px-4 py-3 text-sm font-mono text-[rgb(var(--ec-page-text-muted))]">{field.type}</td>
|
|
169
171
|
<td className="px-4 py-3 text-sm">
|
|
@@ -115,6 +115,62 @@ describe('extractSchemaFieldsDeep', () => {
|
|
|
115
115
|
expect(fields.map((f) => f.path)).toEqual(['id', 'name']);
|
|
116
116
|
});
|
|
117
117
|
|
|
118
|
+
it('converts array type values to a sorted pipe-separated string (e.g. nullable fields)', () => {
|
|
119
|
+
const schema = JSON.stringify({
|
|
120
|
+
type: 'object',
|
|
121
|
+
properties: {
|
|
122
|
+
userId: { type: 'string', description: 'identifier for a user' },
|
|
123
|
+
cancellationReason: { type: ['string', 'null'], description: 'optional reason' },
|
|
124
|
+
renewalDate: { type: ['null', 'integer'], description: 'unix timestamp or null' },
|
|
125
|
+
},
|
|
126
|
+
});
|
|
127
|
+
const fields = extractSchemaFieldsDeep(schema, 'json-schema');
|
|
128
|
+
expect(fields).toEqual([
|
|
129
|
+
{ path: 'userId', type: 'string', description: 'identifier for a user', required: false },
|
|
130
|
+
{ path: 'cancellationReason', type: 'null | string', description: 'optional reason', required: false },
|
|
131
|
+
{ path: 'renewalDate', type: 'integer | null', description: 'unix timestamp or null', required: false },
|
|
132
|
+
]);
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
it('recurses into nested properties when object type is nullable', () => {
|
|
136
|
+
const schema = JSON.stringify({
|
|
137
|
+
type: 'object',
|
|
138
|
+
properties: {
|
|
139
|
+
metadata: {
|
|
140
|
+
type: ['object', 'null'],
|
|
141
|
+
properties: {
|
|
142
|
+
source: { type: 'string' },
|
|
143
|
+
version: { type: 'integer' },
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
});
|
|
148
|
+
const fields = extractSchemaFieldsDeep(schema, 'json-schema');
|
|
149
|
+
expect(fields.map((f) => f.path)).toEqual(['metadata', 'metadata.source', 'metadata.version']);
|
|
150
|
+
expect(fields[0].type).toBe('null | object');
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
it('recurses into array items when array type is nullable', () => {
|
|
154
|
+
const schema = JSON.stringify({
|
|
155
|
+
type: 'object',
|
|
156
|
+
properties: {
|
|
157
|
+
tags: {
|
|
158
|
+
type: ['array', 'null'],
|
|
159
|
+
items: {
|
|
160
|
+
type: 'object',
|
|
161
|
+
properties: {
|
|
162
|
+
key: { type: 'string' },
|
|
163
|
+
value: { type: 'string' },
|
|
164
|
+
},
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
});
|
|
169
|
+
const fields = extractSchemaFieldsDeep(schema, 'json-schema');
|
|
170
|
+
expect(fields.map((f) => f.path)).toEqual(['tags', 'tags[].key', 'tags[].value']);
|
|
171
|
+
expect(fields[0].type).toBe('array | null'); // already sorted alphabetically
|
|
172
|
+
});
|
|
173
|
+
|
|
118
174
|
it('returns empty array when schema content is malformed JSON', () => {
|
|
119
175
|
const fields = extractSchemaFieldsDeep('not valid json{{{', 'json-schema');
|
|
120
176
|
expect(fields).toEqual([]);
|
|
@@ -142,7 +142,8 @@ function walkJsonSchema(node: any, prefix: string, requiredList: string[], rootS
|
|
|
142
142
|
if (prop.$ref) {
|
|
143
143
|
const resolved = resolveLocalRef(prop.$ref, rootSchema);
|
|
144
144
|
if (resolved) {
|
|
145
|
-
const
|
|
145
|
+
const rawRefType = resolved.type || 'object';
|
|
146
|
+
const type = Array.isArray(rawRefType) ? [...rawRefType].sort().join(' | ') : rawRefType;
|
|
146
147
|
fields.push({ path, type, description: resolved.description || '', required: isRequired });
|
|
147
148
|
if (resolved.properties) {
|
|
148
149
|
walkJsonSchema(resolved, path, resolved.required || [], rootSchema, fields);
|
|
@@ -154,16 +155,18 @@ function walkJsonSchema(node: any, prefix: string, requiredList: string[], rootS
|
|
|
154
155
|
continue;
|
|
155
156
|
}
|
|
156
157
|
|
|
157
|
-
const
|
|
158
|
+
const rawType = prop.type || (prop.enum ? 'enum' : prop.$ref ? '$ref' : 'object');
|
|
159
|
+
const typeList = Array.isArray(rawType) ? rawType : [rawType];
|
|
160
|
+
const type = Array.isArray(rawType) ? [...rawType].sort().join(' | ') : rawType;
|
|
158
161
|
fields.push({ path, type, description: prop.description || '', required: isRequired });
|
|
159
162
|
|
|
160
|
-
// Recurse into nested objects
|
|
161
|
-
if (
|
|
163
|
+
// Recurse into nested objects (handles both "type": "object" and "type": ["object", "null"])
|
|
164
|
+
if (typeList.includes('object') && prop.properties) {
|
|
162
165
|
walkJsonSchema(prop, path, prop.required || [], rootSchema, fields);
|
|
163
166
|
}
|
|
164
167
|
|
|
165
|
-
// Recurse into array items
|
|
166
|
-
if (
|
|
168
|
+
// Recurse into array items (handles both "type": "array" and "type": ["array", "null"])
|
|
169
|
+
if (typeList.includes('array') && prop.items) {
|
|
167
170
|
if (prop.items.type === 'object' && prop.items.properties) {
|
|
168
171
|
walkJsonSchema(prop.items, `${path}[]`, prop.items.required || [], rootSchema, fields);
|
|
169
172
|
}
|
|
@@ -47,9 +47,9 @@ export async function buildFieldsIndex(catalogDir: string, outputDir?: string):
|
|
|
47
47
|
]);
|
|
48
48
|
|
|
49
49
|
const collections = [
|
|
50
|
-
{ entries: events, type: 'event' as const },
|
|
51
|
-
{ entries: commands, type: 'command' as const },
|
|
52
|
-
{ entries: queries, type: 'query' as const },
|
|
50
|
+
{ entries: events || [], type: 'event' as const },
|
|
51
|
+
{ entries: commands || [], type: 'command' as const },
|
|
52
|
+
{ entries: queries || [], type: 'query' as const },
|
|
53
53
|
];
|
|
54
54
|
|
|
55
55
|
for (const { entries, type } of collections) {
|
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.26.
|
|
9
|
+
"version": "3.26.10",
|
|
10
10
|
"publishConfig": {
|
|
11
11
|
"access": "public"
|
|
12
12
|
},
|
|
@@ -102,9 +102,9 @@
|
|
|
102
102
|
"update-notifier": "^7.3.1",
|
|
103
103
|
"uuid": "^10.0.0",
|
|
104
104
|
"zod": "^4.3.6",
|
|
105
|
-
"@eventcatalog/linter": "1.0.17",
|
|
106
105
|
"@eventcatalog/sdk": "2.18.2",
|
|
107
|
-
"@eventcatalog/visualiser": "^3.16.1"
|
|
106
|
+
"@eventcatalog/visualiser": "^3.16.1",
|
|
107
|
+
"@eventcatalog/linter": "1.0.17"
|
|
108
108
|
},
|
|
109
109
|
"devDependencies": {
|
|
110
110
|
"@astrojs/check": "^0.9.8",
|