@eventcatalog/core 4.10.14 → 4.10.15
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-HERAHLM2.js → chunk-7LWOCX4R.js} +1 -1
- package/dist/{chunk-LITOQH56.js → chunk-A4JRWRCV.js} +1 -1
- package/dist/{chunk-ONDFEA5R.js → chunk-HBVTU6ZP.js} +1 -1
- package/dist/{chunk-V2SKOQYF.js → chunk-I6HUOX4R.js} +1 -1
- package/dist/{chunk-LUW6RDA7.js → chunk-Q2ATWE7N.js} +1 -1
- package/dist/constants.cjs +1 -1
- package/dist/constants.js +1 -1
- package/dist/docs/api/02-config.md +6 -6
- package/dist/docs/development/ask-your-architecture/02-eventcatalog-assistant/02-configuration.md +18 -11
- package/dist/docs/development/components/components/13-mermaid-file-loader.md +12 -0
- package/dist/docs/development/components/diagram-syntax/06-mermaid.md +45 -6
- package/dist/docs/development/customization/05-resource-sidebar.md +1 -1
- package/dist/eventcatalog.cjs +1 -1
- package/dist/eventcatalog.js +5 -5
- 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/SchemaExplorer/JSONSchemaViewer.test.tsx +114 -0
- package/eventcatalog/src/components/SchemaExplorer/JSONSchemaViewer.tsx +28 -9
- package/eventcatalog/src/utils/collections/glob-loader.ts +2 -2
- package/package.json +8 -8
|
@@ -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 = "4.10.
|
|
143
|
+
var version = "4.10.15";
|
|
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-Q2ATWE7N.js";
|
|
4
|
+
import "../chunk-A4JRWRCV.js";
|
|
5
5
|
import "../chunk-ZAZHAVKB.js";
|
|
6
|
-
import "../chunk-
|
|
6
|
+
import "../chunk-I6HUOX4R.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
|
@@ -78,7 +78,7 @@ The output type for your EventCatalog, choose from `static` or `server`.
|
|
|
78
78
|
:::info "What is the difference between static and server?"
|
|
79
79
|
|
|
80
80
|
- `static` - The default output type for EventCatalog. This will output a static website that you can host anywhere.
|
|
81
|
-
- `server` - This will output a Node.js server that you can host anywhere. This is required for certain features like the [EventCatalog
|
|
81
|
+
- `server` - This will output a Node.js server that you can host anywhere. This is required for certain features like the [EventCatalog Assistant](/docs/development/ask-your-architecture/eventcatalog-assistant/what-is-eventcatalog-assistant) (bring your own keys). The easiest way to host this is with our [Docker image](/docs/development/deployment/hosting-options#hosting-as-a-server).
|
|
82
82
|
|
|
83
83
|
:::
|
|
84
84
|
|
|
@@ -584,17 +584,17 @@ docs: {
|
|
|
584
584
|
|
|
585
585
|
- Type: `object`
|
|
586
586
|
|
|
587
|
-
Configuration for
|
|
587
|
+
Configuration for [EventCatalog Assistant](/docs/development/ask-your-architecture/eventcatalog-assistant/what-is-eventcatalog-assistant).
|
|
588
588
|
|
|
589
589
|
:::info
|
|
590
|
-
The `chat` property requires a
|
|
590
|
+
The `chat` property requires a Scale plan and `output: 'server'` to take effect.
|
|
591
591
|
:::
|
|
592
592
|
|
|
593
593
|
```js title="eventcatalog.config.js"
|
|
594
594
|
module.exports = {
|
|
595
595
|
output: 'server',
|
|
596
596
|
chat: {
|
|
597
|
-
// Set to false to disable
|
|
597
|
+
// Set to false to disable EventCatalog Assistant entirely
|
|
598
598
|
enabled: false,
|
|
599
599
|
},
|
|
600
600
|
};
|
|
@@ -602,7 +602,7 @@ module.exports = {
|
|
|
602
602
|
|
|
603
603
|
| Option | Type | Default | Description |
|
|
604
604
|
| ------ | ---- | ------- | ----------- |
|
|
605
|
-
| `chat.enabled` | `boolean` | `true` | Enables or disables
|
|
605
|
+
| `chat.enabled` | `boolean` | `true` | Enables or disables EventCatalog Assistant. Set to `false` to hide the assistant UI and prevent chat requests even when all other prerequisites are met. |
|
|
606
606
|
|
|
607
607
|
### `mcp` {#mcp}
|
|
608
608
|
|
|
@@ -688,7 +688,7 @@ module.exports = {
|
|
|
688
688
|
- Type: `string`
|
|
689
689
|
|
|
690
690
|
:::tip
|
|
691
|
-
For
|
|
691
|
+
For Scale plans. This gives you the ability to show your own GitHub repository in EventCatalog (in the header bar).
|
|
692
692
|
:::
|
|
693
693
|
|
|
694
694
|
URL to your repository for EventCatalog.
|
package/dist/docs/development/ask-your-architecture/02-eventcatalog-assistant/02-configuration.md
CHANGED
|
@@ -12,25 +12,32 @@ import PlanBanner from '@site/src/components/MDX/PlanBanner';
|
|
|
12
12
|
|
|
13
13
|
<PlanBanner plan="Scale" />
|
|
14
14
|
|
|
15
|
-
**EventCatalog Assistant is
|
|
15
|
+
**EventCatalog Assistant is shown by default.**
|
|
16
16
|
|
|
17
|
-
To
|
|
17
|
+
To use the assistant, you need to:
|
|
18
18
|
|
|
19
|
-
1.
|
|
20
|
-
2. Add
|
|
19
|
+
1. Run EventCatalog with `output: 'server'` in your `eventcatalog.config.js` file
|
|
20
|
+
2. Add an `eventcatalog.chat.js` file to your catalog
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
```js title="eventcatalog.config.js"
|
|
23
|
+
module.exports = {
|
|
24
|
+
// AI integrations require you to run EventCatalog as a server
|
|
25
|
+
output: 'server'
|
|
26
|
+
};
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
You can hide the assistant by setting `chat.enabled` to `false`.
|
|
23
30
|
|
|
24
|
-
|
|
31
|
+
### Disabling the feature
|
|
32
|
+
|
|
33
|
+
EventCatalog Assistant is enabled by default. Set `chat.enabled` to `false` to hide the assistant UI and prevent chat requests:
|
|
25
34
|
|
|
26
35
|
```js title="eventcatalog.config.js"
|
|
27
36
|
module.exports = {
|
|
28
|
-
|
|
37
|
+
output: 'server',
|
|
29
38
|
chat: {
|
|
30
|
-
enabled:
|
|
39
|
+
enabled: false,
|
|
31
40
|
},
|
|
32
|
-
// AI integrations require you to run eventcatalog as as server
|
|
33
|
-
output: 'server'
|
|
34
41
|
};
|
|
35
42
|
```
|
|
36
43
|
|
|
@@ -70,4 +77,4 @@ export const configuration = {
|
|
|
70
77
|
}
|
|
71
78
|
```
|
|
72
79
|
|
|
73
|
-
Once you have
|
|
80
|
+
Once you have configured your model, restart EventCatalog and you can start asking questions about your architecture.
|
|
@@ -52,11 +52,23 @@ When you use the `<MermaidFileLoader />` component, it will render the diagram i
|
|
|
52
52
|
|
|
53
53
|

|
|
54
54
|
|
|
55
|
+
**Control options**
|
|
56
|
+
|
|
57
|
+
<AddedIn version="4.10.6" />
|
|
58
|
+
|
|
59
|
+
Use `placement` and `actions` to configure the [interactive controls](/docs/development/components/diagram-syntax/mermaid#control-options) on the diagram.
|
|
60
|
+
|
|
61
|
+
```jsx /events/MyEvent/index.mdx
|
|
62
|
+
<MermaidFileLoader file="mermaid.mmd" placement="top-left" actions={false} />
|
|
63
|
+
```
|
|
64
|
+
|
|
55
65
|
### Props
|
|
56
66
|
|
|
57
67
|
| Name | Type | Default | Description |
|
|
58
68
|
| ----------------------- | --------- | ----------------- | ----------------------------------------------------------------- |
|
|
59
69
|
| `file` (required) | `string` | (empty) | The `.mmd` or `.mermaid` file to load into the diagram block. Path is resolved by EventCatalog. |
|
|
70
|
+
| `placement` (optional) | `'top-left' \| 'top-right' \| 'bottom-left' \| 'bottom-right'` | `'top-right'` | Corner for the interactive controls. |
|
|
71
|
+
| `actions` (optional) | `boolean` | shown when the diagram is taller than 120px | `true` always shows the controls. `false` hides them. |
|
|
60
72
|
|
|
61
73
|
### Support
|
|
62
74
|
|
|
@@ -29,7 +29,7 @@ If you have large diagrams that fail to render, increase the `maxTextSize` confi
|
|
|
29
29
|
|
|
30
30
|
### Using the `mermaid` code block in any markdown file.
|
|
31
31
|
|
|
32
|
-
To use mermaid you need to use the `mermaid` code block in any markdown file.
|
|
32
|
+
To use mermaid you need to use the `mermaid` code block in any markdown file. You can pass `placement` and `actions` on the code fence to configure the [interactive controls](#control-options).
|
|
33
33
|
|
|
34
34
|
#### Example
|
|
35
35
|
|
|
@@ -74,6 +74,9 @@ Add your .mmd or .mermaid file to your folder (e.g `/events/MyEvent/mermaid.mmd`
|
|
|
74
74
|
|
|
75
75
|
<!-- Using the .mermaid file extension -->
|
|
76
76
|
<MermaidFileLoader file="my-second-mermaid-file.mermaid" />
|
|
77
|
+
|
|
78
|
+
<!-- Optional: configure interactive controls -->
|
|
79
|
+
<MermaidFileLoader file="mermaid.mmd" placement="top-left" actions={false} />
|
|
77
80
|
```
|
|
78
81
|
|
|
79
82
|
This example will load a mermaid file (.mmd or .mermaid) into your EventCatalog page.
|
|
@@ -180,22 +183,58 @@ All Mermaid diagrams include interactive controls for better viewing and explora
|
|
|
180
183
|
|
|
181
184
|

|
|
182
185
|
|
|
186
|
+
Pan, zoom, reset, fullscreen, and copy controls appear on hover. On touch devices the controls stay visible.
|
|
187
|
+
|
|
183
188
|
### Zoom and pan
|
|
184
189
|
|
|
185
|
-
Click and drag to pan around the diagram, or use the
|
|
190
|
+
Click and drag to pan around the diagram, or use the pan and zoom buttons to move around. Double-click the diagram to zoom in quickly. Use reset to fit the diagram back into view.
|
|
186
191
|
|
|
187
|
-
###
|
|
192
|
+
### Fullscreen
|
|
188
193
|
|
|
189
|
-
Click the
|
|
194
|
+
Click the fullscreen button to open the diagram in a modal. In fullscreen you can drag, scroll, or pinch to zoom.
|
|
190
195
|
|
|
191
|
-
|
|
196
|
+
Keyboard shortcuts in fullscreen:
|
|
197
|
+
- Arrow keys to pan
|
|
198
|
+
- `+` / `-` to zoom
|
|
199
|
+
- `0` to reset
|
|
200
|
+
- `Escape` to close
|
|
192
201
|
|
|
193
202
|
### Copy diagram code
|
|
194
203
|
|
|
195
|
-
Click the copy button
|
|
204
|
+
Click the copy button to copy the diagram code to your clipboard.
|
|
196
205
|
|
|
197
206
|
Useful for copying diagrams into LLM prompts.
|
|
198
207
|
|
|
208
|
+
### Control options
|
|
209
|
+
|
|
210
|
+
<AddedIn version="4.10.6" />
|
|
211
|
+
|
|
212
|
+
Code blocks and [`<MermaidFileLoader />`](/docs/development/components/components/mermaid-file-loader) accept `placement` and `actions` to configure the controls.
|
|
213
|
+
|
|
214
|
+
| Name | Type | Default | Description |
|
|
215
|
+
| ---- | ---- | ------- | ----------- |
|
|
216
|
+
| `placement` (optional) | `'top-left' \| 'top-right' \| 'bottom-left' \| 'bottom-right'` | `'top-right'` | Corner for the interactive controls. |
|
|
217
|
+
| `actions` (optional) | `boolean` | shown when the diagram is taller than 120px | `true` always shows the controls. `false` hides them. |
|
|
218
|
+
|
|
219
|
+
#### Code block
|
|
220
|
+
|
|
221
|
+
Pass the options on the `mermaid` code fence. `placement` accepts double or single quotes. `actions` accepts `{true}` / `{false}` or `true` / `false`.
|
|
222
|
+
|
|
223
|
+
```markdown
|
|
224
|
+
```mermaid placement="top-left" actions={false}
|
|
225
|
+
sequenceDiagram
|
|
226
|
+
participant Customer
|
|
227
|
+
participant OrdersService
|
|
228
|
+
Customer->>OrdersService: Place Order
|
|
229
|
+
```_
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
#### MermaidFileLoader
|
|
233
|
+
|
|
234
|
+
```md
|
|
235
|
+
<MermaidFileLoader file="mermaid.mmd" placement="top-left" actions={false} />
|
|
236
|
+
```
|
|
237
|
+
|
|
199
238
|
## Export NodeGraphs as Mermaid
|
|
200
239
|
|
|
201
240
|
<AddedIn version="3.9.0" />
|
|
@@ -17,7 +17,7 @@ Every resource in EventCatalog (domains, services, messages, flows, and more) ge
|
|
|
17
17
|
|
|
18
18
|

|
|
19
19
|
|
|
20
|
-
By default, EventCatalog will generate a
|
|
20
|
+
By default, EventCatalog will generate a sidebar for your resources, but sometimes you may want to customize what is shown here — for example runbooks, guides, external links, or your own grouping of events and services.
|
|
21
21
|
|
|
22
22
|
To do this, add a `sidebar.json` file next to the resource's `index.mdx`. This file becomes the sidebar for that resource.
|
|
23
23
|
|
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 = "4.10.
|
|
147
|
+
var version = "4.10.15";
|
|
148
148
|
|
|
149
149
|
// src/constants.ts
|
|
150
150
|
var VERSION = version;
|
package/dist/eventcatalog.js
CHANGED
|
@@ -4,8 +4,8 @@ import {
|
|
|
4
4
|
import "./chunk-CA4U2JP7.js";
|
|
5
5
|
import {
|
|
6
6
|
log_build_default
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-Q2ATWE7N.js";
|
|
8
|
+
import "./chunk-A4JRWRCV.js";
|
|
9
9
|
import "./chunk-ZAZHAVKB.js";
|
|
10
10
|
import {
|
|
11
11
|
FederationConflictError,
|
|
@@ -31,10 +31,10 @@ import {
|
|
|
31
31
|
} from "./chunk-B7HCX5HM.js";
|
|
32
32
|
import {
|
|
33
33
|
generate
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-7LWOCX4R.js";
|
|
35
35
|
import {
|
|
36
36
|
logger
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-HBVTU6ZP.js";
|
|
38
38
|
import {
|
|
39
39
|
resolve_catalog_dependencies_default
|
|
40
40
|
} from "./chunk-LHR4G2UO.js";
|
|
@@ -54,7 +54,7 @@ import {
|
|
|
54
54
|
import "./chunk-W5JQON7Z.js";
|
|
55
55
|
import {
|
|
56
56
|
VERSION
|
|
57
|
-
} from "./chunk-
|
|
57
|
+
} from "./chunk-I6HUOX4R.js";
|
|
58
58
|
import {
|
|
59
59
|
linkCoreNodeModules,
|
|
60
60
|
resolveInstalledCoreNodeModules
|
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 = "4.10.
|
|
111
|
+
var version = "4.10.15";
|
|
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-7LWOCX4R.js";
|
|
4
|
+
import "./chunk-HBVTU6ZP.js";
|
|
5
|
+
import "./chunk-I6HUOX4R.js";
|
|
6
6
|
import "./chunk-6QENHZZP.js";
|
|
7
7
|
export {
|
|
8
8
|
generate
|
package/dist/utils/cli-logger.js
CHANGED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
// @vitest-environment jsdom
|
|
2
|
+
import { act, createElement } from 'react';
|
|
3
|
+
import { createRoot, type Root } from 'react-dom/client';
|
|
4
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
|
5
|
+
import JSONSchemaViewer from './JSONSchemaViewer';
|
|
6
|
+
|
|
7
|
+
const constraintOnlyVariantSchema = {
|
|
8
|
+
type: 'object',
|
|
9
|
+
properties: {
|
|
10
|
+
detail: { $ref: '#/$defs/detail' },
|
|
11
|
+
},
|
|
12
|
+
$defs: {
|
|
13
|
+
detail: {
|
|
14
|
+
type: 'object',
|
|
15
|
+
properties: {
|
|
16
|
+
data: { $ref: '#/$defs/data' },
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
data: {
|
|
20
|
+
type: 'object',
|
|
21
|
+
properties: {
|
|
22
|
+
userId: { type: 'string' },
|
|
23
|
+
customerId: { type: 'string' },
|
|
24
|
+
correlationId: { type: 'string' },
|
|
25
|
+
},
|
|
26
|
+
required: ['correlationId'],
|
|
27
|
+
oneOf: [
|
|
28
|
+
{
|
|
29
|
+
title: 'Authenticated user',
|
|
30
|
+
required: ['userId'],
|
|
31
|
+
not: { required: ['customerId'] },
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
title: 'Customer account',
|
|
35
|
+
required: ['customerId'],
|
|
36
|
+
not: { required: ['userId'] },
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
describe('JSONSchemaViewer variants', () => {
|
|
44
|
+
let container: HTMLDivElement;
|
|
45
|
+
let root: Root;
|
|
46
|
+
|
|
47
|
+
beforeEach(() => {
|
|
48
|
+
vi.stubGlobal('IS_REACT_ACT_ENVIRONMENT', true);
|
|
49
|
+
container = document.createElement('div');
|
|
50
|
+
document.body.appendChild(container);
|
|
51
|
+
root = createRoot(container);
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
afterEach(() => {
|
|
55
|
+
act(() => root.unmount());
|
|
56
|
+
container.remove();
|
|
57
|
+
vi.unstubAllGlobals();
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
it('renders parent properties selected by constraint-only oneOf branches', () => {
|
|
61
|
+
act(() => {
|
|
62
|
+
root.render(createElement(JSONSchemaViewer, { schema: constraintOnlyVariantSchema, expand: true, search: false }));
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
expect(container.textContent).toContain('Authenticated user');
|
|
66
|
+
expect(container.textContent).toContain('userId');
|
|
67
|
+
expect(container.textContent).not.toContain('customerId');
|
|
68
|
+
expect(container.textContent).toContain('correlationId');
|
|
69
|
+
|
|
70
|
+
const selector = container.querySelector<HTMLSelectElement>('select');
|
|
71
|
+
expect(selector).not.toBeNull();
|
|
72
|
+
|
|
73
|
+
act(() => {
|
|
74
|
+
selector!.value = '1';
|
|
75
|
+
selector!.dispatchEvent(new Event('change', { bubbles: true }));
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
expect(container.textContent).toContain('customerId');
|
|
79
|
+
expect(container.textContent).not.toContain('userId');
|
|
80
|
+
expect(container.textContent).toContain('correlationId');
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
it('applies constraint-only oneOf branches at the schema root', () => {
|
|
84
|
+
const rootSchema = constraintOnlyVariantSchema.$defs.data;
|
|
85
|
+
|
|
86
|
+
act(() => {
|
|
87
|
+
root.render(createElement(JSONSchemaViewer, { schema: rootSchema, expand: true, search: false }));
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
expect(container.textContent).toContain('userId');
|
|
91
|
+
expect(container.textContent).not.toContain('customerId');
|
|
92
|
+
expect(container.textContent).toContain('correlationId');
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
it('does not render array item parent properties twice when variants are present', () => {
|
|
96
|
+
const arraySchema = {
|
|
97
|
+
type: 'object',
|
|
98
|
+
properties: {
|
|
99
|
+
identities: {
|
|
100
|
+
type: 'array',
|
|
101
|
+
items: constraintOnlyVariantSchema.$defs.data,
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
act(() => {
|
|
107
|
+
root.render(createElement(JSONSchemaViewer, { schema: arraySchema, expand: true, search: false }));
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
expect(container.textContent?.match(/userId/g)).toHaveLength(1);
|
|
111
|
+
expect(container.textContent).not.toContain('customerId');
|
|
112
|
+
expect(container.textContent?.match(/correlationId/g)).toHaveLength(1);
|
|
113
|
+
});
|
|
114
|
+
});
|
|
@@ -31,6 +31,15 @@ function formatType(type: any): string {
|
|
|
31
31
|
return type ?? '';
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
function getForbiddenVariantProperties(variant: any): string[] {
|
|
35
|
+
const forbiddenRequired = variant?.not?.required;
|
|
36
|
+
|
|
37
|
+
// `not: { required: ['field'] }` forbids that field from being present. When
|
|
38
|
+
// multiple fields are listed, JSON Schema only forbids them being present
|
|
39
|
+
// together, so none of them can safely be hidden individually.
|
|
40
|
+
return Array.isArray(forbiddenRequired) && forbiddenRequired.length === 1 ? forbiddenRequired : [];
|
|
41
|
+
}
|
|
42
|
+
|
|
34
43
|
// Helper function to count properties recursively
|
|
35
44
|
function countProperties(obj: any): number {
|
|
36
45
|
if (!obj || typeof obj !== 'object') return 0;
|
|
@@ -173,26 +182,35 @@ function processSchema(schema: any, rootSchema?: any): any {
|
|
|
173
182
|
const variantsArray = schema.oneOf || schema.anyOf;
|
|
174
183
|
const variantType = schema.oneOf ? 'oneOf' : 'anyOf';
|
|
175
184
|
|
|
185
|
+
const processedProperties = schema.properties
|
|
186
|
+
? Object.fromEntries(
|
|
187
|
+
Object.entries(schema.properties).map(([key, prop]: [string, any]) => [key, processSchema(prop, root)])
|
|
188
|
+
)
|
|
189
|
+
: {};
|
|
190
|
+
|
|
176
191
|
const processedVariants = variantsArray.map((variant: any, index: number) => {
|
|
177
192
|
const processedVariant = processSchema(variant, root);
|
|
193
|
+
const forbiddenProperties = new Set(getForbiddenVariantProperties(processedVariant));
|
|
194
|
+
const properties = Object.fromEntries(
|
|
195
|
+
Object.entries({ ...processedProperties, ...(processedVariant.properties || {}) }).filter(
|
|
196
|
+
([propertyName]) => !forbiddenProperties.has(propertyName)
|
|
197
|
+
)
|
|
198
|
+
);
|
|
199
|
+
|
|
178
200
|
return {
|
|
201
|
+
...processedVariant,
|
|
179
202
|
title: processedVariant.title || variant.title || processedVariant.$id || `Option ${index + 1}`,
|
|
180
203
|
description: processedVariant.description || variant.description,
|
|
181
|
-
required: processedVariant.required || variant.required || [],
|
|
182
|
-
properties
|
|
204
|
+
required: [...new Set([...(schema.required || []), ...(processedVariant.required || variant.required || [])])],
|
|
205
|
+
properties,
|
|
183
206
|
type: processedVariant.type || variant.type || 'object',
|
|
184
|
-
...processedVariant,
|
|
185
207
|
};
|
|
186
208
|
});
|
|
187
209
|
|
|
188
210
|
return {
|
|
189
211
|
...schema,
|
|
190
212
|
type: schema.type || 'object',
|
|
191
|
-
properties:
|
|
192
|
-
? Object.fromEntries(
|
|
193
|
-
Object.entries(schema.properties).map(([key, prop]: [string, any]) => [key, processSchema(prop, root)])
|
|
194
|
-
)
|
|
195
|
-
: {},
|
|
213
|
+
properties: processedProperties,
|
|
196
214
|
variants: processedVariants,
|
|
197
215
|
variantType,
|
|
198
216
|
};
|
|
@@ -462,6 +480,7 @@ const SchemaProperty = ({ name, details, isRequired, level, isListItem = false,
|
|
|
462
480
|
<div className="mt-1 border-l border-dashed border-[rgb(var(--ec-page-border))] pl-3 ml-1.5">
|
|
463
481
|
<span className="text-xs italic text-[rgb(var(--ec-page-text-muted))] block mb-1">Item Details:</span>
|
|
464
482
|
{details.items.properties &&
|
|
483
|
+
!details.items.variants &&
|
|
465
484
|
Object.entries(details.items.properties).map(([itemPropName, itemPropDetails]: [string, any]) => (
|
|
466
485
|
<SchemaProperty
|
|
467
486
|
key={itemPropName}
|
|
@@ -823,7 +842,7 @@ export default function JSONSchemaViewer({
|
|
|
823
842
|
// Determine which properties to display
|
|
824
843
|
const propsToDisplay =
|
|
825
844
|
variants && variants.length > 0 && variants[selectedVariantIndex]?.properties
|
|
826
|
-
?
|
|
845
|
+
? variants[selectedVariantIndex].properties
|
|
827
846
|
: properties;
|
|
828
847
|
const requiredProps = variants && variants.length > 0 ? variants[selectedVariantIndex]?.required || [] : required;
|
|
829
848
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { glob } from 'astro/loaders';
|
|
1
|
+
import { glob, type Loader } from 'astro/loaders';
|
|
2
2
|
import picomatch from 'picomatch';
|
|
3
3
|
import path from 'path';
|
|
4
4
|
import { fileURLToPath } from 'url';
|
|
@@ -36,7 +36,7 @@ const matchesGlobPattern = (entry: string, patterns: string | string[]) => {
|
|
|
36
36
|
return picomatch.isMatch(entry, positivePatterns) && !picomatch.isMatch(entry, negativePatterns);
|
|
37
37
|
};
|
|
38
38
|
|
|
39
|
-
export const globWithSafeWatcher = (options: GlobOptions) => {
|
|
39
|
+
export const globWithSafeWatcher = (options: GlobOptions): Loader => {
|
|
40
40
|
const loader = glob(options);
|
|
41
41
|
|
|
42
42
|
return {
|
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
},
|
|
8
8
|
"license": "SEE LICENSE IN LICENSE",
|
|
9
9
|
"type": "module",
|
|
10
|
-
"version": "4.10.
|
|
10
|
+
"version": "4.10.15",
|
|
11
11
|
"publishConfig": {
|
|
12
12
|
"access": "public"
|
|
13
13
|
},
|
|
@@ -32,10 +32,10 @@
|
|
|
32
32
|
],
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@ai-sdk/react": "^3.0.17",
|
|
35
|
-
"@astrojs/markdown-remark": "^7.
|
|
36
|
-
"@astrojs/mdx": "^
|
|
37
|
-
"@astrojs/node": "^11.1.
|
|
38
|
-
"@astrojs/react": "^6.0.
|
|
35
|
+
"@astrojs/markdown-remark": "^7.3.1",
|
|
36
|
+
"@astrojs/mdx": "^8.0.1",
|
|
37
|
+
"@astrojs/node": "^11.1.6",
|
|
38
|
+
"@astrojs/react": "^6.0.6",
|
|
39
39
|
"@astrojs/rss": "^4.0.19",
|
|
40
40
|
"@asyncapi/avro-schema-parser": "3.0.24",
|
|
41
41
|
"@asyncapi/parser": "^3.6.0",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"@tanstack/react-table": "^8.17.3",
|
|
62
62
|
"@xyflow/react": "^12.3.6",
|
|
63
63
|
"ai": "^6.0.17",
|
|
64
|
-
"astro": "7.
|
|
64
|
+
"astro": "7.3.3",
|
|
65
65
|
"astro-expressive-code": "^0.44.0",
|
|
66
66
|
"astro-seo": "^0.8.4",
|
|
67
67
|
"auth-astro": "^4.2.0",
|
|
@@ -119,9 +119,9 @@
|
|
|
119
119
|
"update-notifier": "^7.3.1",
|
|
120
120
|
"uuid": "^11.1.1",
|
|
121
121
|
"zod": "^4.3.6",
|
|
122
|
+
"@eventcatalog/linter": "1.1.19",
|
|
122
123
|
"@eventcatalog/sdk": "2.29.0",
|
|
123
|
-
"@eventcatalog/visualiser": "^4.1.4"
|
|
124
|
-
"@eventcatalog/linter": "1.1.19"
|
|
124
|
+
"@eventcatalog/visualiser": "^4.1.4"
|
|
125
125
|
},
|
|
126
126
|
"devDependencies": {
|
|
127
127
|
"@astrojs/check": "^0.9.10",
|