@eventcatalog/core 2.13.2 → 2.13.4
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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @eventcatalog/core
|
|
2
2
|
|
|
3
|
+
## 2.13.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 2ad9561: fix(core): fixed issues with node graphs for services and metadata in the nodes
|
|
8
|
+
|
|
9
|
+
## 2.13.3
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- b893559: fix(core): fixed issue with styling of schema files
|
|
14
|
+
|
|
3
15
|
## 2.13.2
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
---
|
|
2
|
+
import fs from 'fs';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import { Code } from 'astro-expressive-code/components';
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
file?: string;
|
|
8
|
+
catalog: {
|
|
9
|
+
filePath: string;
|
|
10
|
+
};
|
|
11
|
+
title?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const { file = 'schema.json', catalog, title } = Astro.props;
|
|
15
|
+
|
|
16
|
+
let code: string | null = null;
|
|
17
|
+
|
|
18
|
+
const exists = fs.existsSync(path.join(catalog.filePath, file));
|
|
19
|
+
if (exists) {
|
|
20
|
+
code = fs.readFileSync(path.join(catalog.filePath, file), 'utf-8');
|
|
21
|
+
}
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
{
|
|
25
|
+
code ? (
|
|
26
|
+
<div class="not-prose max-w-4xl overflow-x-auto">
|
|
27
|
+
<Code code={code} title={title || file} lang="json" />
|
|
28
|
+
</div>
|
|
29
|
+
) : (
|
|
30
|
+
<div class="italic">Tried to load schema from {path.join(catalog.filePath, file)}, but no schema can be found</div>
|
|
31
|
+
)
|
|
32
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// React components
|
|
2
|
-
import Schema from '@components/MDX/Schema';
|
|
2
|
+
import Schema from '@components/MDX/Schema.astro';
|
|
3
3
|
import File from '@components/MDX/File';
|
|
4
4
|
import Accordion from '@components/MDX/Accordion/Accordion.astro';
|
|
5
5
|
import AccordionGroup from '@components/MDX/Accordion/AccordionGroup.astro';
|
|
@@ -16,6 +16,7 @@ import ChannelInformation from '@components/MDX/ChannelInformation/ChannelInform
|
|
|
16
16
|
// Portals: required for server/client components
|
|
17
17
|
import NodeGraphPortal from '@components/MDX/NodeGraph/NodeGraphPortal';
|
|
18
18
|
import SchemaViewerPortal from '@components/MDX/SchemaViewer/SchemaViewerPortal';
|
|
19
|
+
import { jsx } from 'astro/jsx-runtime';
|
|
19
20
|
|
|
20
21
|
const components = (props: any) => {
|
|
21
22
|
return {
|
|
@@ -33,7 +34,7 @@ const components = (props: any) => {
|
|
|
33
34
|
NodeGraph: (mdxProp: any) => NodeGraphPortal({ ...props.data, ...mdxProp }),
|
|
34
35
|
ChannelInformation: (mdxProp: any) => ChannelInformation({ ...props.data, ...mdxProp }),
|
|
35
36
|
SchemaViewer: (mdxProp: any) => SchemaViewerPortal({ ...props.data, ...mdxProp }),
|
|
36
|
-
Schema: (mdxProp: any) => Schema
|
|
37
|
+
Schema: (mdxProp: any) => jsx(Schema, { ...props, ...mdxProp }),
|
|
37
38
|
};
|
|
38
39
|
};
|
|
39
40
|
|
|
@@ -11,6 +11,10 @@ import {
|
|
|
11
11
|
import { findMatchingNodes, getItemsFromCollectionByIdAndSemverOrLatest } from '@utils/collections/util';
|
|
12
12
|
import { MarkerType } from 'reactflow';
|
|
13
13
|
import type { CollectionMessageTypes } from '@types';
|
|
14
|
+
import { getCommands } from '@utils/commands';
|
|
15
|
+
import { getEvents } from '@utils/events';
|
|
16
|
+
import { getQueries } from '@utils/queries';
|
|
17
|
+
import { getChannels } from '@utils/channels';
|
|
14
18
|
|
|
15
19
|
type DagreGraph = any;
|
|
16
20
|
|
|
@@ -67,10 +71,10 @@ export const getNodesAndEdges = async ({ id, defaultFlow, version, mode = 'simpl
|
|
|
67
71
|
const receivesRaw = service?.data.receives || [];
|
|
68
72
|
const sendsRaw = service?.data.sends || [];
|
|
69
73
|
|
|
70
|
-
const events = await
|
|
71
|
-
const commands = await
|
|
72
|
-
const queries = await
|
|
73
|
-
const channels = await
|
|
74
|
+
const events = await getEvents();
|
|
75
|
+
const commands = await getCommands();
|
|
76
|
+
const queries = await getQueries();
|
|
77
|
+
const channels = await getChannels();
|
|
74
78
|
|
|
75
79
|
const messages = [...events, ...commands, ...queries];
|
|
76
80
|
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import fs from 'fs';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
|
|
4
|
-
const Schema = ({ file = 'schema.json', catalog, title }: any) => {
|
|
5
|
-
try {
|
|
6
|
-
const exists = fs.existsSync(path.join(catalog.filePath, file));
|
|
7
|
-
|
|
8
|
-
if (exists) {
|
|
9
|
-
const text = fs.readFileSync(path.join(catalog.filePath, file), 'utf-8');
|
|
10
|
-
return (
|
|
11
|
-
<div className="not-prose max-w-4xl overflow-x-auto">
|
|
12
|
-
<pre className="expressive-code" data-language="json">
|
|
13
|
-
<figure className="frame has-title">
|
|
14
|
-
<figcaption className="header">
|
|
15
|
-
{title && <span className="title">{title}</span>}
|
|
16
|
-
{!title && <span className="title">{file}</span>}
|
|
17
|
-
</figcaption>
|
|
18
|
-
<pre data-language="js">
|
|
19
|
-
<code>
|
|
20
|
-
<div className="ec-line">
|
|
21
|
-
<div className="code">{text}</div>
|
|
22
|
-
</div>
|
|
23
|
-
</code>
|
|
24
|
-
</pre>
|
|
25
|
-
<div className="copy">
|
|
26
|
-
<button title="Copy to clipboard" data-copied="Copied!" data-code={text}>
|
|
27
|
-
<div></div>
|
|
28
|
-
</button>
|
|
29
|
-
</div>
|
|
30
|
-
</figure>
|
|
31
|
-
</pre>
|
|
32
|
-
</div>
|
|
33
|
-
);
|
|
34
|
-
} else {
|
|
35
|
-
return (
|
|
36
|
-
<div className="italic">Tried to load schema from {path.join(catalog.filePath, file)}, but no schema can be found</div>
|
|
37
|
-
);
|
|
38
|
-
}
|
|
39
|
-
} catch (error) {
|
|
40
|
-
console.log('Failed to load schema file', error);
|
|
41
|
-
return null;
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
export default Schema;
|