@eventcatalog/core 2.44.1 → 2.44.3

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.44.1";
40
+ var version = "2.44.3";
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-AUGREOCT.js";
4
- import "../chunk-HGLZ22GT.js";
3
+ } from "../chunk-SHFEPDUF.js";
4
+ import "../chunk-EJOD6TNE.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.44.1";
109
+ var version = "2.44.3";
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-ECUXDBJ7.js";
4
- import "../chunk-AUGREOCT.js";
5
- import "../chunk-HGLZ22GT.js";
3
+ } from "../chunk-CGPQJVQ3.js";
4
+ import "../chunk-SHFEPDUF.js";
5
+ import "../chunk-EJOD6TNE.js";
6
6
  import "../chunk-E7TXTI7G.js";
7
7
  export {
8
8
  log_build_default as default
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  raiseEvent
3
- } from "./chunk-AUGREOCT.js";
3
+ } from "./chunk-SHFEPDUF.js";
4
4
  import {
5
5
  getEventCatalogConfigFile,
6
6
  verifyRequiredFieldsAreInCatalogConfigFile
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "2.44.1";
2
+ var version = "2.44.3";
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-HGLZ22GT.js";
3
+ } from "./chunk-EJOD6TNE.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.44.1";
28
+ var version = "2.44.3";
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-HGLZ22GT.js";
3
+ } from "./chunk-EJOD6TNE.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.44.1";
160
+ var version = "2.44.3";
161
161
 
162
162
  // src/constants.ts
163
163
  var VERSION = version;
@@ -6,8 +6,8 @@ import {
6
6
  } from "./chunk-DCLTVJDP.js";
7
7
  import {
8
8
  log_build_default
9
- } from "./chunk-ECUXDBJ7.js";
10
- import "./chunk-AUGREOCT.js";
9
+ } from "./chunk-CGPQJVQ3.js";
10
+ import "./chunk-SHFEPDUF.js";
11
11
  import {
12
12
  catalogToAstro,
13
13
  checkAndConvertMdToMdx
@@ -15,7 +15,7 @@ import {
15
15
  import "./chunk-EXAALOQA.js";
16
16
  import {
17
17
  VERSION
18
- } from "./chunk-HGLZ22GT.js";
18
+ } from "./chunk-EJOD6TNE.js";
19
19
  import {
20
20
  isAuthEnabled,
21
21
  isBackstagePluginEnabled,
@@ -13,7 +13,13 @@ const { name, details, isRequired, level, isListItem = false } = Astro.props;
13
13
 
14
14
  const hasNestedProperties = details.type === 'object' && details.properties && Object.keys(details.properties).length > 0;
15
15
  const hasArrayItems = details.type === 'array' && details.items;
16
- const isCollapsible = hasNestedProperties || (hasArrayItems && details.items.type === 'object' && details.items.properties);
16
+ const hasArrayItemProperties =
17
+ hasArrayItems &&
18
+ ((details.items.type === 'object' && details.items.properties) ||
19
+ details.items.allOf ||
20
+ details.items.oneOf ||
21
+ details.items.$ref);
22
+ const isCollapsible = hasNestedProperties || hasArrayItemProperties;
17
23
 
18
24
  // Using template literal for class calculation remains safe
19
25
  const indentationClass = `pl-${level * 3}`;
@@ -48,12 +54,19 @@ const contentId = `prop-${name}-${level}-${Math.random().toString(36).substring(
48
54
  {details.type}
49
55
  {details.type === 'array' && details.items?.type ? `[${details.items.type}]` : ''}
50
56
  {details.format ? `<${details.format}>` : ''}
57
+ {details._refPath && <span class="text-blue-600 ml-1">→ {details._refName || details._refPath}</span>}
58
+ {details._refNotFound && <span class="text-red-600 ml-1">❌ ref not found</span>}
51
59
  </span>
52
60
  </div>
53
61
  {isRequired && <span class="text-red-600 text-xs ml-3 flex-shrink-0">required</span>}
54
62
  </div>
55
63
 
56
64
  {details.description && <p class="text-gray-500 text-xs mt-0.5">{details.description}</p>}
65
+ {
66
+ details.title && details.title !== details.description && (
67
+ <p class="text-gray-500 text-xs mt-0.5 italic">Title: {details.title}</p>
68
+ )
69
+ }
57
70
 
58
71
  {/* Reverted arbitrary text size to standard 'text-xs' */}
59
72
  <div class="text-xs text-gray-500 mt-0.5 space-y-0">
@@ -78,6 +91,20 @@ const contentId = `prop-${name}-${level}-${Math.random().toString(36).substring(
78
91
  </div>
79
92
  )
80
93
  }
94
+ {
95
+ details.minLength !== undefined && (
96
+ <div>
97
+ Min length: <code class="bg-gray-100 px-1 rounded text-gray-800 font-thin py-0.5">{details.minLength}</code>
98
+ </div>
99
+ )
100
+ }
101
+ {
102
+ details.maxLength !== undefined && (
103
+ <div>
104
+ Max length: <code class="bg-gray-100 px-1 rounded text-gray-800 font-thin py-0.5">{details.maxLength}</code>
105
+ </div>
106
+ )
107
+ }
81
108
  {
82
109
  details.enum && (
83
110
  <div>
@@ -110,18 +137,24 @@ const contentId = `prop-${name}-${level}-${Math.random().toString(36).substring(
110
137
  />
111
138
  ))}
112
139
 
113
- {hasArrayItems && details.items.type === 'object' && details.items.properties && (
140
+ {hasArrayItemProperties && (
114
141
  <div class="mt-1 border-l border-dashed border-gray-400 pl-3 ml-1.5">
115
142
  <span class="text-xs italic text-gray-500 block mb-1">Item Details:</span>
116
- {Object.entries(details.items.properties).map(([itemPropName, itemPropDetails]) => (
117
- <SchemaProp
118
- name={itemPropName}
119
- details={itemPropDetails}
120
- isRequired={details.items.required?.includes(itemPropName) ?? false}
121
- level={level + 1}
122
- isListItem={true}
123
- />
124
- ))}
143
+ {details.items.properties &&
144
+ Object.entries(details.items.properties).map(([itemPropName, itemPropDetails]) => (
145
+ <SchemaProp
146
+ name={itemPropName}
147
+ details={itemPropDetails}
148
+ isRequired={details.items.required?.includes(itemPropName) ?? false}
149
+ level={level + 1}
150
+ isListItem={true}
151
+ />
152
+ ))}
153
+ {(details.items.allOf || details.items.oneOf || details.items.$ref) && !details.items.properties && (
154
+ <div class="text-xs text-gray-500 mt-1">
155
+ Complex array item schema detected. The properties should be processed by the parent SchemaViewer.
156
+ </div>
157
+ )}
125
158
  </div>
126
159
  )}
127
160
  </div>
@@ -14,7 +14,8 @@ interface Props {
14
14
  const { id, file, title, maxHeight, schema } = Astro.props;
15
15
 
16
16
  // Function to merge allOf schemas
17
- function mergeAllOfSchemas(schema: any) {
17
+ function mergeAllOfSchemas(schemaWithProcessor: any): any {
18
+ const { processSchema: processor, ...schema } = schemaWithProcessor;
18
19
  if (!schema.allOf) return schema;
19
20
 
20
21
  const mergedSchema: {
@@ -22,63 +23,165 @@ function mergeAllOfSchemas(schema: any) {
22
23
  properties: Record<string, any>;
23
24
  required: string[];
24
25
  description?: string;
26
+ [key: string]: any;
25
27
  } = {
26
- type: 'object',
28
+ type: schema.type || 'object',
27
29
  properties: {},
28
30
  required: [],
29
31
  description: schema.description,
30
32
  };
31
33
 
34
+ // Copy base schema properties first (excluding allOf)
35
+ Object.keys(schema).forEach((key) => {
36
+ if (key !== 'allOf' && key !== 'properties' && key !== 'required' && key !== 'description') {
37
+ mergedSchema[key] = schema[key];
38
+ }
39
+ });
40
+
41
+ // Copy base properties if they exist
42
+ if (schema.properties) {
43
+ mergedSchema.properties = { ...schema.properties };
44
+ }
45
+ if (schema.required) {
46
+ mergedSchema.required = [...schema.required];
47
+ }
48
+
32
49
  schema.allOf.forEach((subSchema: any) => {
33
- if (subSchema.properties) {
50
+ // Recursively process each subSchema in case it has its own allOf, oneOf, or $ref
51
+ const processedSubSchema = processor ? processor(subSchema) : subSchema;
52
+
53
+ if (processedSubSchema.properties) {
34
54
  mergedSchema.properties = {
35
55
  ...mergedSchema.properties,
36
- ...subSchema.properties,
56
+ ...processedSubSchema.properties,
37
57
  };
38
58
  }
39
- if (subSchema.required) {
40
- mergedSchema.required = [...mergedSchema.required, ...subSchema.required];
59
+ if (processedSubSchema.required) {
60
+ mergedSchema.required = [...new Set([...mergedSchema.required, ...processedSubSchema.required])];
41
61
  }
42
- if (subSchema.description && !mergedSchema.description) {
43
- mergedSchema.description = subSchema.description;
62
+ if (processedSubSchema.description && !mergedSchema.description) {
63
+ mergedSchema.description = processedSubSchema.description;
44
64
  }
65
+
66
+ // Copy other properties from subSchema
67
+ Object.keys(processedSubSchema).forEach((key) => {
68
+ if (key !== 'properties' && key !== 'required' && key !== 'description' && key !== 'type') {
69
+ if (!mergedSchema[key]) {
70
+ mergedSchema[key] = processedSubSchema[key];
71
+ }
72
+ }
73
+ });
45
74
  });
46
75
 
47
76
  return mergedSchema;
48
77
  }
49
78
 
50
- function processSchema(schema: any) {
79
+ function processSchema(schema: any, rootSchema?: any): any {
80
+ if (!schema) return schema;
81
+
82
+ // Set rootSchema for $ref resolution
83
+ const root = rootSchema || schema;
84
+
51
85
  // Handle $ref
52
86
  if (schema.$ref) {
53
- // Only support local refs like "#/definitions/xyz"
54
87
  const refPath = schema.$ref;
88
+ let resolvedSchema = null;
89
+ let defName = '';
90
+
91
+ // Try draft-7 style first: #/definitions/
55
92
  if (refPath.startsWith('#/definitions/')) {
56
- const defName = refPath.replace('#/definitions/', '');
57
- const definitions = schema.definitions;
58
- if (definitions && definitions[defName]) {
59
- // Recursively process the referenced schema
60
- return processSchema(definitions[defName]);
93
+ defName = refPath.replace('#/definitions/', '');
94
+ if (root.definitions && root.definitions[defName]) {
95
+ resolvedSchema = root.definitions[defName];
96
+ }
97
+ }
98
+ // Try 2020-12 style: #/$defs/
99
+ else if (refPath.startsWith('#/$defs/')) {
100
+ defName = refPath.replace('#/$defs/', '');
101
+ if (root.$defs && root.$defs[defName]) {
102
+ resolvedSchema = root.$defs[defName];
61
103
  }
62
104
  }
63
- // If not found, return as is
64
- return schema;
105
+ // Try other common patterns
106
+ else if (refPath.startsWith('#/components/schemas/')) {
107
+ defName = refPath.replace('#/components/schemas/', '');
108
+ if (root.components && root.components.schemas && root.components.schemas[defName]) {
109
+ resolvedSchema = root.components.schemas[defName];
110
+ }
111
+ }
112
+
113
+ if (resolvedSchema) {
114
+ // Recursively process the referenced schema
115
+ const processedSchema = processSchema(resolvedSchema, root);
116
+ // Add reference info to the resolved schema
117
+ return {
118
+ ...processedSchema,
119
+ _refPath: refPath,
120
+ _refName: defName,
121
+ _originalRef: schema.$ref,
122
+ };
123
+ }
124
+
125
+ // If not found, create a placeholder schema showing the reference
126
+ return {
127
+ type: 'string',
128
+ description: `Reference to ${refPath} (definition not found in root schema)`,
129
+ title: defName || refPath.split('/').pop(),
130
+ _refPath: refPath,
131
+ _refName: defName,
132
+ _refNotFound: true,
133
+ };
65
134
  }
66
135
 
67
136
  if (schema.allOf) {
68
- return mergeAllOfSchemas(schema);
137
+ return mergeAllOfSchemas({ ...schema, processSchema: (s: any) => processSchema(s, root) });
69
138
  }
70
139
 
71
140
  if (schema.oneOf) {
72
- // For oneOf, we'll keep the base properties and handle variants in the UI
141
+ // Process each oneOf variant and create a combined schema
142
+ const processedVariants = schema.oneOf.map((variant: any) => {
143
+ const processedVariant = processSchema(variant, root);
144
+ return {
145
+ title: processedVariant.title || variant.title || 'Unnamed Variant',
146
+ required: processedVariant.required || variant.required || [],
147
+ properties: processedVariant.properties || {},
148
+ ...processedVariant,
149
+ };
150
+ });
151
+
152
+ // Merge all properties from variants for display
153
+ const allProperties: Record<string, any> = {};
154
+ processedVariants.forEach((variant) => {
155
+ if (variant.properties) {
156
+ Object.assign(allProperties, variant.properties);
157
+ }
158
+ });
159
+
73
160
  return {
74
161
  ...schema,
75
- variants: schema.oneOf.map((variant: any) => ({
76
- title: variant.title || 'Unnamed Variant',
77
- required: variant.required || [],
78
- })),
162
+ type: schema.type || 'object',
163
+ properties: {
164
+ ...(schema.properties || {}),
165
+ ...allProperties,
166
+ },
167
+ variants: processedVariants,
79
168
  };
80
169
  }
81
170
 
171
+ // Process nested schemas in properties
172
+ if (schema.properties) {
173
+ const processedProperties: Record<string, any> = {};
174
+ Object.entries(schema.properties).forEach(([key, prop]: [string, any]) => {
175
+ processedProperties[key] = processSchema(prop, root);
176
+ });
177
+ schema = { ...schema, properties: processedProperties };
178
+ }
179
+
180
+ // Process array items
181
+ if (schema.type === 'array' && schema.items) {
182
+ schema = { ...schema, items: processSchema(schema.items, root) };
183
+ }
184
+
82
185
  return schema;
83
186
  }
84
187
 
@@ -33,13 +33,21 @@ interface TypedLocals {
33
33
  }
34
34
 
35
35
  // Wildcard matching utilities
36
- export function matchesPattern(pattern: string, pathname: string): boolean {
37
- const regexPattern = pattern
38
- .replace(/\*/g, '[^/]+') // * matches any characters except /
39
- .replace(/\*\*/g, '.*'); // ** matches any characters including /
40
-
41
- const regex = new RegExp(`^${regexPattern}$`);
42
- return regex.test(pathname);
36
+ export function matchesPattern(pattern: string, path: string): boolean {
37
+ const escapeRegExp = (str: string) => str.replace(/[-/\\^$+?.()|[\]{}]/g, '\\$&');
38
+
39
+ // Convert the pattern to a regular expression
40
+ const regexStr = pattern
41
+ .split('/')
42
+ .map((part) => {
43
+ if (part === '**') return '.*';
44
+ if (part === '*') return '[^/]+';
45
+ return escapeRegExp(part);
46
+ })
47
+ .join('/');
48
+
49
+ const regex = new RegExp(`^${regexStr}$`);
50
+ return regex.test(path);
43
51
  }
44
52
 
45
53
  function calculateSpecificity(pattern: string): number {
@@ -21,7 +21,6 @@ try {
21
21
  console.log('✅ Loaded custom RBAC middleware');
22
22
  }
23
23
  } catch (error) {
24
- console.log('Error loading custom RBAC middleware:', error);
25
24
  // Just silently fail, we don't want to block the app
26
25
  }
27
26
 
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.44.1",
9
+ "version": "2.44.3",
10
10
  "publishConfig": {
11
11
  "access": "public"
12
12
  },