@eventcatalog/core 2.33.10 → 2.33.11

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.33.10";
40
+ var version = "2.33.11";
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-N7V2JS3E.js";
4
- import "../chunk-KWYNYLOK.js";
3
+ } from "../chunk-WHJEWUMZ.js";
4
+ import "../chunk-2NTEYUNI.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.33.10";
109
+ var version = "2.33.11";
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-L2RGENDX.js";
4
- import "../chunk-N7V2JS3E.js";
5
- import "../chunk-KWYNYLOK.js";
3
+ } from "../chunk-FKC4UAA6.js";
4
+ import "../chunk-WHJEWUMZ.js";
5
+ import "../chunk-2NTEYUNI.js";
6
6
  import "../chunk-E7TXTI7G.js";
7
7
  export {
8
8
  log_build_default as default
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "2.33.10";
2
+ var version = "2.33.11";
3
3
 
4
4
  // src/constants.ts
5
5
  var VERSION = version;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  raiseEvent
3
- } from "./chunk-N7V2JS3E.js";
3
+ } from "./chunk-WHJEWUMZ.js";
4
4
  import {
5
5
  getEventCatalogConfigFile,
6
6
  verifyRequiredFieldsAreInCatalogConfigFile
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VERSION
3
- } from "./chunk-KWYNYLOK.js";
3
+ } from "./chunk-2NTEYUNI.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.33.10";
28
+ var version = "2.33.11";
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-KWYNYLOK.js";
3
+ } from "./chunk-2NTEYUNI.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.33.10";
160
+ var version = "2.33.11";
161
161
 
162
162
  // src/constants.ts
163
163
  var VERSION = version;
@@ -6,15 +6,15 @@ import {
6
6
  } from "./chunk-UKJ7F5WR.js";
7
7
  import {
8
8
  log_build_default
9
- } from "./chunk-L2RGENDX.js";
10
- import "./chunk-N7V2JS3E.js";
9
+ } from "./chunk-FKC4UAA6.js";
10
+ import "./chunk-WHJEWUMZ.js";
11
11
  import {
12
12
  catalogToAstro,
13
13
  checkAndConvertMdToMdx
14
14
  } from "./chunk-7SI5EVOX.js";
15
15
  import {
16
16
  VERSION
17
- } from "./chunk-KWYNYLOK.js";
17
+ } from "./chunk-2NTEYUNI.js";
18
18
  import {
19
19
  isBackstagePluginEnabled,
20
20
  isEventCatalogScaleEnabled,
@@ -12,7 +12,65 @@ interface Props {
12
12
  }
13
13
 
14
14
  const { id, file, title, maxHeight, schema } = Astro.props;
15
- const { description, properties, required = [] } = schema;
15
+
16
+ // Function to merge allOf schemas
17
+ function mergeAllOfSchemas(schema: any) {
18
+ if (!schema.allOf) return schema;
19
+
20
+ const mergedSchema: {
21
+ type: string;
22
+ properties: Record<string, any>;
23
+ required: string[];
24
+ description?: string;
25
+ } = {
26
+ type: 'object',
27
+ properties: {},
28
+ required: [],
29
+ description: schema.description,
30
+ };
31
+
32
+ schema.allOf.forEach((subSchema: any) => {
33
+ if (subSchema.properties) {
34
+ mergedSchema.properties = {
35
+ ...mergedSchema.properties,
36
+ ...subSchema.properties,
37
+ };
38
+ }
39
+ if (subSchema.required) {
40
+ mergedSchema.required = [...mergedSchema.required, ...subSchema.required];
41
+ }
42
+ if (subSchema.description && !mergedSchema.description) {
43
+ mergedSchema.description = subSchema.description;
44
+ }
45
+ });
46
+
47
+ return mergedSchema;
48
+ }
49
+
50
+ function processSchema(schema: any) {
51
+ if (schema.allOf) {
52
+ return mergeAllOfSchemas(schema);
53
+ }
54
+
55
+ if (schema.oneOf) {
56
+ // For oneOf, we'll keep the base properties and handle variants in the UI
57
+ return {
58
+ ...schema,
59
+ variants: schema.oneOf.map((variant: any) => ({
60
+ title: variant.title || 'Unnamed Variant',
61
+ required: variant.required || [],
62
+ })),
63
+ };
64
+ }
65
+
66
+ return schema;
67
+ }
68
+
69
+ const processedSchema = processSchema(schema);
70
+ const { description, properties, required = [], variants } = processedSchema;
71
+
72
+ // Generate a unique ID for this instance
73
+ const instanceId = `${id}-${file}-${Math.random().toString(36).substring(2, 9)}`;
16
74
  ---
17
75
 
18
76
  <div id={`${id}-${file}-SchemaViewer-client`} class="not-prose my-4">
@@ -24,19 +82,74 @@ const { description, properties, required = [] } = schema;
24
82
  }}
25
83
  >
26
84
  {description && <p class="text-gray-600 text-xs mb-5">{description}</p>}
27
- {/* Reduced size, adjusted margin */}
28
85
 
29
86
  {
30
- properties &&
31
- Object.entries(properties).map(([name, details]) => (
32
- <SchemaProperty name={name} details={details} isRequired={required.includes(name)} level={0} />
33
- ))
87
+ variants && (
88
+ <div class="mb-4">
89
+ <div class="flex items-center space-x-2">
90
+ <span class="text-sm text-gray-600">(one of)</span>
91
+ <select
92
+ id={`${instanceId}-variant-selector`}
93
+ class="form-select text-sm border-gray-300 rounded-md shadow-sm focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50"
94
+ >
95
+ {variants.map((variant: any, index: number) => (
96
+ <option value={index}>{variant.title}</option>
97
+ ))}
98
+ </select>
99
+ </div>
100
+ </div>
101
+ )
102
+ }
103
+
104
+ {
105
+ properties && (
106
+ <div id={`${instanceId}-properties`}>
107
+ {Object.entries(properties).map(([name, details]) => (
108
+ <SchemaProperty name={name} details={details} isRequired={variants ? false : required.includes(name)} level={0} />
109
+ ))}
110
+ </div>
111
+ )
34
112
  }
35
113
 
36
114
  {!properties && <p class="text-gray-500 text-sm">Schema does not contain any properties.</p>}
37
115
  </div>
38
116
  </div>
39
117
 
118
+ <script define:vars={{ instanceId, variants }}>
119
+ if (variants) {
120
+ const selector = document.getElementById(`${instanceId}-variant-selector`);
121
+ const propertiesContainer = document.getElementById(`${instanceId}-properties`);
122
+
123
+ function updateRequiredFields() {
124
+ const selectedVariant = variants[selector.value];
125
+ const properties = propertiesContainer.querySelectorAll('.property-container');
126
+
127
+ properties.forEach((prop) => {
128
+ const nameEl = prop.querySelector('.font-semibold');
129
+ if (!nameEl) return;
130
+
131
+ const name = nameEl.textContent;
132
+ const requiredBadge = prop.querySelector('.text-red-600');
133
+
134
+ if (selectedVariant.required.includes(name)) {
135
+ if (!requiredBadge) {
136
+ const badge = document.createElement('span');
137
+ badge.className = 'text-red-600 text-xs ml-3 flex-shrink-0';
138
+ badge.textContent = 'required';
139
+ nameEl.parentElement.appendChild(badge);
140
+ }
141
+ } else {
142
+ requiredBadge?.remove();
143
+ }
144
+ });
145
+ }
146
+
147
+ selector.addEventListener('change', updateRequiredFields);
148
+ // Initialize with first variant
149
+ updateRequiredFields();
150
+ }
151
+ </script>
152
+
40
153
  <style>
41
154
  .schema-viewer code {
42
155
  font-family: 'Courier New', Courier, monospace;
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.33.10",
9
+ "version": "2.33.11",
10
10
  "publishConfig": {
11
11
  "access": "public"
12
12
  },