@eventcatalog/core 2.64.0 → 2.64.1

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.64.0";
40
+ var version = "2.64.1";
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-6AMZOBWI.js";
4
- import "../chunk-CWGFHLMX.js";
3
+ } from "../chunk-SH6FZS4K.js";
4
+ import "../chunk-LCBQ5JUR.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.64.0";
109
+ var version = "2.64.1";
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-PLMTJHGH.js";
4
- import "../chunk-6AMZOBWI.js";
5
- import "../chunk-CWGFHLMX.js";
3
+ } from "../chunk-AHJ4UE33.js";
4
+ import "../chunk-SH6FZS4K.js";
5
+ import "../chunk-LCBQ5JUR.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
  raiseEvent
3
- } from "./chunk-6AMZOBWI.js";
3
+ } from "./chunk-SH6FZS4K.js";
4
4
  import {
5
5
  getEventCatalogConfigFile,
6
6
  verifyRequiredFieldsAreInCatalogConfigFile
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "2.64.0";
2
+ var version = "2.64.1";
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-CWGFHLMX.js";
3
+ } from "./chunk-LCBQ5JUR.js";
4
4
 
5
5
  // src/analytics/analytics.js
6
6
  import axios from "axios";
@@ -25,7 +25,7 @@ __export(constants_exports, {
25
25
  module.exports = __toCommonJS(constants_exports);
26
26
 
27
27
  // package.json
28
- var version = "2.64.0";
28
+ var version = "2.64.1";
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-CWGFHLMX.js";
3
+ } from "./chunk-LCBQ5JUR.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.64.0";
160
+ var version = "2.64.1";
161
161
 
162
162
  // src/constants.ts
163
163
  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-PLMTJHGH.js";
10
- import "./chunk-6AMZOBWI.js";
9
+ } from "./chunk-AHJ4UE33.js";
10
+ import "./chunk-SH6FZS4K.js";
11
11
  import {
12
12
  catalogToAstro,
13
13
  checkAndConvertMdToMdx
@@ -15,7 +15,7 @@ import {
15
15
  import "./chunk-55D645EH.js";
16
16
  import {
17
17
  VERSION
18
- } from "./chunk-CWGFHLMX.js";
18
+ } from "./chunk-LCBQ5JUR.js";
19
19
  import {
20
20
  getProjectOutDir,
21
21
  isAuthEnabled,
@@ -6,6 +6,7 @@ interface AvroSchemaViewerProps {
6
6
  maxHeight?: string;
7
7
  expand?: boolean | string;
8
8
  search?: boolean | string;
9
+ showRequired?: boolean | string;
9
10
  onOpenFullscreen?: () => void;
10
11
  }
11
12
 
@@ -13,6 +14,7 @@ interface AvroFieldProps {
13
14
  field: any;
14
15
  level: number;
15
16
  expand: boolean;
17
+ showRequired?: boolean;
16
18
  }
17
19
 
18
20
  // Format Avro type for display
@@ -56,11 +58,38 @@ function hasNestedFields(type: any): boolean {
56
58
  return false;
57
59
  }
58
60
 
61
+ // Check if a field is required (not optional)
62
+ // A field is optional if:
63
+ // - It has a default value, OR
64
+ // - Its type is null or includes null in a union
65
+ function isFieldRequired(field: any): boolean {
66
+ // If field has a default value, it's optional
67
+ if ('default' in field) {
68
+ return false;
69
+ }
70
+
71
+ const fieldType = field.type;
72
+
73
+ // If type is null, field is optional
74
+ if (fieldType === 'null') {
75
+ return false;
76
+ }
77
+
78
+ // If type is a union (array), check if it includes null
79
+ if (Array.isArray(fieldType)) {
80
+ return !fieldType.includes('null');
81
+ }
82
+
83
+ // Otherwise, field is required
84
+ return true;
85
+ }
86
+
59
87
  // AvroField component - displays a single field with nested support
60
- const AvroField = ({ field, level, expand }: AvroFieldProps) => {
88
+ const AvroField = ({ field, level, expand, showRequired }: AvroFieldProps) => {
61
89
  const [isExpanded, setIsExpanded] = useState(expand);
62
90
  const hasNested = hasNestedFields(field.type);
63
91
  const indentClass = `pl-${level * 4}`;
92
+ const isRequired = showRequired ? isFieldRequired(field) : undefined;
64
93
 
65
94
  useEffect(() => {
66
95
  setIsExpanded(expand);
@@ -84,9 +113,12 @@ const AvroField = ({ field, level, expand }: AvroFieldProps) => {
84
113
 
85
114
  {/* Field details */}
86
115
  <div className="flex-grow">
87
- <div className="flex items-baseline gap-2 flex-wrap">
88
- <span className="avro-field-name font-semibold text-gray-800 text-sm">{field.name}</span>
89
- <span className="text-purple-600 font-mono text-xs">{formatAvroType(field.type)}</span>
116
+ <div className="flex justify-between items-baseline">
117
+ <div>
118
+ <span className="avro-field-name font-semibold text-gray-800 text-sm">{field.name}</span>
119
+ <span className="ml-1.5 text-purple-600 font-mono text-xs">{formatAvroType(field.type)}</span>
120
+ </div>
121
+ {showRequired && isRequired && <span className="text-red-600 text-xs ml-3 flex-shrink-0">required</span>}
90
122
  </div>
91
123
 
92
124
  {field.doc && <p className="text-gray-600 text-xs mt-1">{field.doc}</p>}
@@ -107,7 +139,13 @@ const AvroField = ({ field, level, expand }: AvroFieldProps) => {
107
139
  {hasNested && (
108
140
  <div className={`avro-nested-content mt-2 ${!isExpanded ? 'hidden' : ''}`}>
109
141
  {field.type.fields.map((nestedField: any) => (
110
- <AvroField key={nestedField.name} field={nestedField} level={level + 1} expand={expand} />
142
+ <AvroField
143
+ key={nestedField.name}
144
+ field={nestedField}
145
+ level={level + 1}
146
+ expand={expand}
147
+ showRequired={showRequired}
148
+ />
111
149
  ))}
112
150
  </div>
113
151
  )}
@@ -124,10 +162,12 @@ export default function AvroSchemaViewer({
124
162
  maxHeight,
125
163
  expand = false,
126
164
  search = true,
165
+ showRequired = false,
127
166
  onOpenFullscreen,
128
167
  }: AvroSchemaViewerProps) {
129
168
  const expandBool = expand === true || expand === 'true';
130
169
  const searchBool = search !== false && search !== 'false';
170
+ const showRequiredBool = showRequired === true || showRequired === 'true';
131
171
 
132
172
  const [searchQuery, setSearchQuery] = useState('');
133
173
  const [expandAll, setExpandAll] = useState(expandBool);
@@ -374,7 +414,9 @@ export default function AvroSchemaViewer({
374
414
  {/* Fields */}
375
415
  <div ref={fieldsContainerRef} className="flex-1 px-4 pb-4 overflow-auto">
376
416
  {schema.fields && schema.fields.length > 0 ? (
377
- schema.fields.map((field: any) => <AvroField key={field.name} field={field} level={0} expand={expandAll} />)
417
+ schema.fields.map((field: any) => (
418
+ <AvroField key={field.name} field={field} level={0} expand={expandAll} showRequired={showRequiredBool} />
419
+ ))
378
420
  ) : (
379
421
  <div className="text-center py-8 text-gray-400">
380
422
  <p className="text-sm">No fields defined</p>
@@ -15,6 +15,7 @@ interface SchemaContentViewerProps {
15
15
  parsedSchema: any;
16
16
  parsedAvroSchema?: any;
17
17
  onOpenFullscreen?: () => void;
18
+ showRequired?: boolean;
18
19
  }
19
20
 
20
21
  export default function SchemaContentViewer({
@@ -24,6 +25,7 @@ export default function SchemaContentViewer({
24
25
  viewMode,
25
26
  parsedSchema,
26
27
  parsedAvroSchema,
28
+ showRequired = false,
27
29
  onOpenFullscreen,
28
30
  }: SchemaContentViewerProps) {
29
31
  if (!message.schemaContent) {
@@ -37,7 +39,7 @@ export default function SchemaContentViewer({
37
39
  // Render schema viewer based on schema type
38
40
  if (viewMode === 'schema') {
39
41
  if (parsedAvroSchema) {
40
- return <AvroSchemaViewer schema={parsedAvroSchema} onOpenFullscreen={onOpenFullscreen} />;
42
+ return <AvroSchemaViewer schema={parsedAvroSchema} onOpenFullscreen={onOpenFullscreen} showRequired={showRequired} />;
41
43
  }
42
44
  if (parsedSchema) {
43
45
  return <JSONSchemaViewer schema={parsedSchema} onOpenFullscreen={onOpenFullscreen} />;
@@ -190,6 +190,7 @@ export default function SchemaDetailsPanel({
190
190
  viewMode={schemaViewMode}
191
191
  parsedSchema={parsedSchema}
192
192
  parsedAvroSchema={parsedAvroSchema}
193
+ showRequired={true}
193
194
  onOpenFullscreen={
194
195
  schemaViewMode === 'code'
195
196
  ? () => setIsCodeModalOpen(true)
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.64.0",
9
+ "version": "2.64.1",
10
10
  "publishConfig": {
11
11
  "access": "public"
12
12
  },