@eventcatalog/core 2.14.2 → 2.15.0
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/README.md +4 -3
- package/bin/eventcatalog.js +2 -0
- package/dist/analytics/analytics.cjs +71 -0
- package/dist/analytics/analytics.d.cts +3 -0
- package/dist/analytics/analytics.d.ts +3 -0
- package/dist/analytics/analytics.js +7 -0
- package/dist/analytics/log-build.cjs +155 -0
- package/dist/analytics/log-build.d.cts +7 -0
- package/dist/analytics/log-build.d.ts +7 -0
- package/dist/analytics/log-build.js +9 -0
- package/dist/catalog-to-astro-content-directory.cjs +277 -0
- package/dist/catalog-to-astro-content-directory.d.cts +3 -0
- package/dist/catalog-to-astro-content-directory.d.ts +3 -0
- package/dist/catalog-to-astro-content-directory.js +8 -0
- package/dist/chunk-65VQIGAP.js +33 -0
- package/{scripts/watcher.js → dist/chunk-7HYM3M5I.js} +29 -52
- package/dist/chunk-E7TXTI7G.js +78 -0
- package/dist/chunk-KI4KAUWW.js +30 -0
- package/dist/chunk-O6BGVVOW.js +86 -0
- package/dist/chunk-PK2EQVPD.js +89 -0
- package/dist/chunk-TGOUSS6C.js +9 -0
- package/dist/chunk-YEQVKHST.js +56 -0
- package/dist/constants.cjs +35 -0
- package/dist/constants.d.cts +3 -0
- package/dist/constants.d.ts +3 -0
- package/dist/constants.js +6 -0
- package/dist/eventcatalog-config-file-utils.cjs +116 -0
- package/dist/eventcatalog-config-file-utils.d.cts +7 -0
- package/dist/eventcatalog-config-file-utils.d.ts +7 -0
- package/dist/eventcatalog-config-file-utils.js +14 -0
- package/{bin/dist → dist}/eventcatalog.cjs +23 -33
- package/{bin/dist → dist}/eventcatalog.config.cjs +1 -1
- package/dist/eventcatalog.config.js +0 -0
- package/dist/eventcatalog.d.cts +2 -0
- package/dist/eventcatalog.d.ts +2 -0
- package/dist/eventcatalog.js +116 -0
- package/dist/generate.cjs +121 -0
- package/dist/generate.d.cts +3 -0
- package/dist/generate.d.ts +3 -0
- package/dist/generate.js +7 -0
- package/dist/map-catalog-to-astro.cjs +123 -0
- package/dist/map-catalog-to-astro.d.cts +28 -0
- package/dist/map-catalog-to-astro.d.ts +28 -0
- package/dist/map-catalog-to-astro.js +6 -0
- package/dist/watcher.cjs +223 -0
- package/dist/watcher.d.cts +21 -0
- package/dist/watcher.d.ts +21 -0
- package/dist/watcher.js +8 -0
- package/eventcatalog/public/icons/ms-teams.svg +2 -0
- package/{src → eventcatalog/src}/components/MDX/NodeGraph/NodeGraph.tsx +27 -38
- package/{src → eventcatalog/src}/content/config.ts +2 -0
- package/eventcatalog/src/hooks/eventcatalog-visualizer.ts +89 -0
- package/{src → eventcatalog/src}/pages/docs/[type]/[id]/[version]/asyncapi/index.astro +2 -1
- package/{src → eventcatalog/src}/pages/docs/teams/[id]/index.astro +10 -0
- package/{src → eventcatalog/src}/pages/docs/users/[id]/index.astro +10 -0
- package/{src → eventcatalog/src}/utils/node-graphs/message-node-graph.ts +2 -27
- package/{src → eventcatalog/src}/utils/node-graphs/utils/utils.ts +60 -3
- package/package.json +11 -3
- package/.all-contributorsrc +0 -436
- package/.changeset/config.json +0 -11
- package/.github/CODEOWNERS +0 -3
- package/.github/ISSUE_TEMPLATE/bug.yml +0 -84
- package/.github/ISSUE_TEMPLATE/config.yml +0 -5
- package/.github/ISSUE_TEMPLATE/feature.yml +0 -48
- package/.github/PULL_REQUEST_TEMPLATE.md +0 -14
- package/.github/funding.yml +0 -1
- package/.github/workflows/lint.yml +0 -22
- package/.github/workflows/release.yml +0 -34
- package/.github/workflows/test-bin.yml +0 -29
- package/.github/workflows/test-e2e.yml +0 -27
- package/.github/workflows/verify-build.yml +0 -28
- package/.prettierignore +0 -7
- package/.prettierrc +0 -18
- package/CHANGELOG.md +0 -1289
- package/bin/dist/eventcatalog.d.cts +0 -1
- package/bin/dist/eventcatalog.d.ts +0 -1
- package/bin/dist/eventcatalog.js +0 -531
- package/bin/eventcatalog.config.ts +0 -34
- package/images/example.png +0 -0
- package/images/sponsors/gravitee-logo-black.svg +0 -54
- package/images/sponsors/hookdeck.svg +0 -11
- package/images/sponsors/oso-logo-green.png +0 -0
- package/scripts/analytics/analytics.js +0 -31
- package/scripts/analytics/log-build.js +0 -26
- package/scripts/build-ci.js +0 -27
- package/scripts/catalog-to-astro-content-directory.js +0 -115
- package/scripts/ci/test.js +0 -24
- package/scripts/constants.ts +0 -3
- package/scripts/eventcatalog-config-file-utils.js +0 -89
- package/scripts/generate.js +0 -65
- package/scripts/map-catalog-to-astro.js +0 -174
- package/scripts/start-catalog-locally.js +0 -26
- /package/{bin/dist → dist}/eventcatalog.config.d.cts +0 -0
- /package/{bin/dist → dist}/eventcatalog.config.d.ts +0 -0
- /package/{astro.config.mjs → eventcatalog/astro.config.mjs} +0 -0
- /package/{global.d.ts → eventcatalog/global.d.ts} +0 -0
- /package/{public → eventcatalog/public}/favicon.ico +0 -0
- /package/{public → eventcatalog/public}/icons/asyncapi.svg +0 -0
- /package/{public → eventcatalog/public}/icons/discord.svg +0 -0
- /package/{public → eventcatalog/public}/icons/github-purple.svg +0 -0
- /package/{public → eventcatalog/public}/icons/github.svg +0 -0
- /package/{public → eventcatalog/public}/icons/openapi.svg +0 -0
- /package/{public → eventcatalog/public}/icons/protocols/kafka.svg +0 -0
- /package/{public → eventcatalog/public}/icons/x-twitter.svg +0 -0
- /package/{public → eventcatalog/public}/icons/youtube.svg +0 -0
- /package/{public → eventcatalog/public}/logo.png +0 -0
- /package/{public → eventcatalog/public}/openapi.yml +0 -0
- /package/{public → eventcatalog/public}/opengraph.png +0 -0
- /package/{public → eventcatalog/public}/slack-icon.svg +0 -0
- /package/{src → eventcatalog/src}/components/DiscoverInsight.astro +0 -0
- /package/{src → eventcatalog/src}/components/DocsNavigation.astro +0 -0
- /package/{src → eventcatalog/src}/components/Header.astro +0 -0
- /package/{src → eventcatalog/src}/components/Lists/OwnersList.tsx +0 -0
- /package/{src → eventcatalog/src}/components/Lists/PillList.tsx +0 -0
- /package/{src → eventcatalog/src}/components/Lists/PillListFlat.styles.css +0 -0
- /package/{src → eventcatalog/src}/components/Lists/PillListFlat.tsx +0 -0
- /package/{src → eventcatalog/src}/components/Lists/ProtocolList.tsx +0 -0
- /package/{src → eventcatalog/src}/components/Lists/RepositoryList.astro +0 -0
- /package/{src → eventcatalog/src}/components/Lists/SpecificationsList.astro +0 -0
- /package/{src → eventcatalog/src}/components/Lists/VersionList.astro +0 -0
- /package/{src → eventcatalog/src}/components/MDX/Accordion/Accordion.astro +0 -0
- /package/{src → eventcatalog/src}/components/MDX/Accordion/Accordion.tsx +0 -0
- /package/{src → eventcatalog/src}/components/MDX/Accordion/AccordionGroup.astro +0 -0
- /package/{src → eventcatalog/src}/components/MDX/Admonition.tsx +0 -0
- /package/{src → eventcatalog/src}/components/MDX/AsyncAPI/AsyncAPI.astro +0 -0
- /package/{src → eventcatalog/src}/components/MDX/ChannelInformation/ChannelInformation.tsx +0 -0
- /package/{src → eventcatalog/src}/components/MDX/File.tsx +0 -0
- /package/{src → eventcatalog/src}/components/MDX/Flow/Flow.astro +0 -0
- /package/{src → eventcatalog/src}/components/MDX/NodeGraph/DownloadButton.tsx +0 -0
- /package/{src → eventcatalog/src}/components/MDX/NodeGraph/Edges/AnimatedMessageEdge.tsx +0 -0
- /package/{src → eventcatalog/src}/components/MDX/NodeGraph/NodeGraph.astro +0 -0
- /package/{src → eventcatalog/src}/components/MDX/NodeGraph/NodeGraphPortal.tsx +0 -0
- /package/{src → eventcatalog/src}/components/MDX/NodeGraph/Nodes/Channel.tsx +0 -0
- /package/{src → eventcatalog/src}/components/MDX/NodeGraph/Nodes/Command.tsx +0 -0
- /package/{src → eventcatalog/src}/components/MDX/NodeGraph/Nodes/Event.tsx +0 -0
- /package/{src → eventcatalog/src}/components/MDX/NodeGraph/Nodes/ExternalSystem.tsx +0 -0
- /package/{src → eventcatalog/src}/components/MDX/NodeGraph/Nodes/Query.tsx +0 -0
- /package/{src → eventcatalog/src}/components/MDX/NodeGraph/Nodes/Service.tsx +0 -0
- /package/{src → eventcatalog/src}/components/MDX/NodeGraph/Nodes/Step.tsx +0 -0
- /package/{src → eventcatalog/src}/components/MDX/NodeGraph/Nodes/User.tsx +0 -0
- /package/{src → eventcatalog/src}/components/MDX/OpenAPI/OpenAPI.astro +0 -0
- /package/{src → eventcatalog/src}/components/MDX/Schema.astro +0 -0
- /package/{src → eventcatalog/src}/components/MDX/SchemaViewer/SchemaViewer.astro +0 -0
- /package/{src → eventcatalog/src}/components/MDX/SchemaViewer/SchemaViewer.tsx +0 -0
- /package/{src → eventcatalog/src}/components/MDX/SchemaViewer/SchemaViewerPortal.tsx +0 -0
- /package/{src → eventcatalog/src}/components/MDX/Steps/Step.astro +0 -0
- /package/{src → eventcatalog/src}/components/MDX/Steps/Steps.astro +0 -0
- /package/{src → eventcatalog/src}/components/MDX/Tiles/Tile.astro +0 -0
- /package/{src → eventcatalog/src}/components/MDX/Tiles/Tiles.astro +0 -0
- /package/{src → eventcatalog/src}/components/MDX/components.tsx +0 -0
- /package/{src → eventcatalog/src}/components/MDX/page-components.tsx +0 -0
- /package/{src → eventcatalog/src}/components/Search.astro +0 -0
- /package/{src → eventcatalog/src}/components/Seo.astro +0 -0
- /package/{src → eventcatalog/src}/components/SideBars/CatalogResourcesSideBar/index.tsx +0 -0
- /package/{src → eventcatalog/src}/components/SideBars/CatalogResourcesSideBar/styles.css +0 -0
- /package/{src → eventcatalog/src}/components/SideBars/ChannelSideBar.astro +0 -0
- /package/{src → eventcatalog/src}/components/SideBars/DomainSideBar.astro +0 -0
- /package/{src → eventcatalog/src}/components/SideBars/MessageSideBar.astro +0 -0
- /package/{src → eventcatalog/src}/components/SideBars/ServiceSideBar.astro +0 -0
- /package/{src → eventcatalog/src}/components/Tables/DebouncedInput.tsx +0 -0
- /package/{src → eventcatalog/src}/components/Tables/Table.tsx +0 -0
- /package/{src → eventcatalog/src}/components/Tables/columns/DomainTableColumns.tsx +0 -0
- /package/{src → eventcatalog/src}/components/Tables/columns/FlowTableColumns.tsx +0 -0
- /package/{src → eventcatalog/src}/components/Tables/columns/MessageTableColumns.tsx +0 -0
- /package/{src → eventcatalog/src}/components/Tables/columns/ServiceTableColumns.tsx +0 -0
- /package/{src → eventcatalog/src}/components/Tables/columns/index.tsx +0 -0
- /package/{src → eventcatalog/src}/components/Tables/filters/custom-filters.ts +0 -0
- /package/{src → eventcatalog/src}/env.d.ts +0 -0
- /package/{src → eventcatalog/src}/icons/protocols/WebSocket.svg +0 -0
- /package/{src → eventcatalog/src}/icons/protocols/amqp.svg +0 -0
- /package/{src → eventcatalog/src}/icons/protocols/eventbridge.svg +0 -0
- /package/{src → eventcatalog/src}/icons/protocols/googlepubsub.svg +0 -0
- /package/{src → eventcatalog/src}/icons/protocols/http.svg +0 -0
- /package/{src → eventcatalog/src}/icons/protocols/index.ts +0 -0
- /package/{src → eventcatalog/src}/icons/protocols/jms.svg +0 -0
- /package/{src → eventcatalog/src}/icons/protocols/kafka.svg +0 -0
- /package/{src → eventcatalog/src}/icons/protocols/mercure.svg +0 -0
- /package/{src → eventcatalog/src}/icons/protocols/mqtt.svg +0 -0
- /package/{src → eventcatalog/src}/icons/protocols/nats.svg +0 -0
- /package/{src → eventcatalog/src}/icons/protocols/pulsar.svg +0 -0
- /package/{src → eventcatalog/src}/icons/protocols/redis.svg +0 -0
- /package/{src → eventcatalog/src}/icons/protocols/sns.svg +0 -0
- /package/{src → eventcatalog/src}/icons/protocols/solace.svg +0 -0
- /package/{src → eventcatalog/src}/icons/protocols/sqs.svg +0 -0
- /package/{src → eventcatalog/src}/icons/protocols/ws.svg +0 -0
- /package/{src → eventcatalog/src}/layouts/CustomDocsPageLayout.astro +0 -0
- /package/{src → eventcatalog/src}/layouts/DiscoverLayout.astro +0 -0
- /package/{src → eventcatalog/src}/layouts/Footer.astro +0 -0
- /package/{src → eventcatalog/src}/layouts/PlainPage.astro +0 -0
- /package/{src → eventcatalog/src}/layouts/VerticalSideBarLayout.astro +0 -0
- /package/{src → eventcatalog/src}/layouts/VisualiserLayout.astro +0 -0
- /package/{src → eventcatalog/src}/pages/discover/[type]/index.astro +0 -0
- /package/{src → eventcatalog/src}/pages/docs/[type]/[id]/[version]/changelog/index.astro +0 -0
- /package/{src → eventcatalog/src}/pages/docs/[type]/[id]/[version]/index.astro +0 -0
- /package/{src → eventcatalog/src}/pages/docs/[type]/[id]/[version]/spec/_styles.css +0 -0
- /package/{src → eventcatalog/src}/pages/docs/[type]/[id]/[version]/spec/index.astro +0 -0
- /package/{src → eventcatalog/src}/pages/docs/[type]/[id]/index.astro +0 -0
- /package/{src → eventcatalog/src}/pages/docs/index.astro +0 -0
- /package/{src → eventcatalog/src}/pages/index.astro +0 -0
- /package/{src → eventcatalog/src}/pages/visualiser/[type]/[id]/[version]/index.astro +0 -0
- /package/{src → eventcatalog/src}/pages/visualiser/[type]/[id]/index.astro +0 -0
- /package/{src → eventcatalog/src}/remark-plugins/mermaid.ts +0 -0
- /package/{src → eventcatalog/src}/types/index.ts +0 -0
- /package/{src → eventcatalog/src}/utils/channels.ts +0 -0
- /package/{src → eventcatalog/src}/utils/collections/changelogs.ts +0 -0
- /package/{src → eventcatalog/src}/utils/collections/domains.ts +0 -0
- /package/{src → eventcatalog/src}/utils/collections/file-diffs.ts +0 -0
- /package/{src → eventcatalog/src}/utils/collections/flows.ts +0 -0
- /package/{src → eventcatalog/src}/utils/collections/icons.ts +0 -0
- /package/{src → eventcatalog/src}/utils/collections/services.ts +0 -0
- /package/{src → eventcatalog/src}/utils/collections/util.ts +0 -0
- /package/{src → eventcatalog/src}/utils/collections/versions.ts +0 -0
- /package/{src → eventcatalog/src}/utils/colors.ts +0 -0
- /package/{src → eventcatalog/src}/utils/commands.ts +0 -0
- /package/{src → eventcatalog/src}/utils/eventcatalog-config/catalog.ts +0 -0
- /package/{src → eventcatalog/src}/utils/events.ts +0 -0
- /package/{src → eventcatalog/src}/utils/example-remark-plugin.mjs +0 -0
- /package/{src → eventcatalog/src}/utils/messages.ts +0 -0
- /package/{src → eventcatalog/src}/utils/node-graphs/domains-node-graph.ts +0 -0
- /package/{src → eventcatalog/src}/utils/node-graphs/flows-node-graph.ts +0 -0
- /package/{src → eventcatalog/src}/utils/node-graphs/services-node-graph.ts +0 -0
- /package/{src → eventcatalog/src}/utils/page-loaders/page-data-loader.ts +0 -0
- /package/{src → eventcatalog/src}/utils/pages.ts +0 -0
- /package/{src → eventcatalog/src}/utils/queries.ts +0 -0
- /package/{src → eventcatalog/src}/utils/teams.ts +0 -0
- /package/{src → eventcatalog/src}/utils/url-builder.ts +0 -0
- /package/{src → eventcatalog/src}/utils/users.ts +0 -0
- /package/{tailwind.config.mjs → eventcatalog/tailwind.config.mjs} +0 -0
- /package/{tsconfig.json → eventcatalog/tsconfig.json} +0 -0
package/dist/watcher.cjs
ADDED
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/watcher.js
|
|
31
|
+
var watcher_exports = {};
|
|
32
|
+
__export(watcher_exports, {
|
|
33
|
+
watch: () => watch
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(watcher_exports);
|
|
36
|
+
var import_watcher = __toESM(require("@parcel/watcher"), 1);
|
|
37
|
+
var import_node_fs2 = __toESM(require("fs"), 1);
|
|
38
|
+
|
|
39
|
+
// src/map-catalog-to-astro.js
|
|
40
|
+
var import_node_path = __toESM(require("path"), 1);
|
|
41
|
+
var COLLECTION_KEYS = [
|
|
42
|
+
"events",
|
|
43
|
+
"commands",
|
|
44
|
+
"services",
|
|
45
|
+
"users",
|
|
46
|
+
"teams",
|
|
47
|
+
"domains",
|
|
48
|
+
"flows",
|
|
49
|
+
"pages",
|
|
50
|
+
"changelogs",
|
|
51
|
+
"queries",
|
|
52
|
+
"channels"
|
|
53
|
+
];
|
|
54
|
+
function mapCatalogToAstro({ filePath, astroDir, projectDir }) {
|
|
55
|
+
const relativeFilePath = removeBasePath(filePath, projectDir);
|
|
56
|
+
if (!isCatalogRelated(relativeFilePath)) {
|
|
57
|
+
return [];
|
|
58
|
+
}
|
|
59
|
+
const baseTargetPaths = getBaseTargetPaths(relativeFilePath);
|
|
60
|
+
const relativeTargetPath = getRelativeTargetPath(relativeFilePath);
|
|
61
|
+
return baseTargetPaths.map(
|
|
62
|
+
(base) => import_node_path.default.join(astroDir, base, relativeTargetPath.replace("index.md", "index.mdx").replace("changelog.md", "changelog.mdx"))
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
function removeBasePath(fullPath, basePath) {
|
|
66
|
+
const relativePath = import_node_path.default.relative(basePath, fullPath);
|
|
67
|
+
return relativePath.startsWith("..") ? fullPath : relativePath;
|
|
68
|
+
}
|
|
69
|
+
function isCollectionKey(key) {
|
|
70
|
+
return COLLECTION_KEYS.includes(key);
|
|
71
|
+
}
|
|
72
|
+
function isCatalogRelated(filePath) {
|
|
73
|
+
const filePathArr = filePath.split(import_node_path.default.sep).filter(Boolean);
|
|
74
|
+
if ([
|
|
75
|
+
"eventcatalog.config.js",
|
|
76
|
+
// config file at root
|
|
77
|
+
"eventcatalog.styles.css",
|
|
78
|
+
// custom styles file at root
|
|
79
|
+
"components",
|
|
80
|
+
// custom components
|
|
81
|
+
"public",
|
|
82
|
+
// public assets
|
|
83
|
+
...COLLECTION_KEYS
|
|
84
|
+
].includes(filePathArr[0])) {
|
|
85
|
+
return true;
|
|
86
|
+
}
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
function getBaseTargetPaths(filePath) {
|
|
90
|
+
const filePathArr = filePath.split(import_node_path.default.sep).filter(Boolean);
|
|
91
|
+
if (isCollectionKey(filePathArr[0])) {
|
|
92
|
+
if (filePathArr[filePathArr.length - 1] == "changelog.md") {
|
|
93
|
+
return [import_node_path.default.join("src", "content", "changelogs")];
|
|
94
|
+
}
|
|
95
|
+
if (filePathArr[filePathArr.length - 1].match(/\.md$/)) {
|
|
96
|
+
return [import_node_path.default.join("src", "content")];
|
|
97
|
+
}
|
|
98
|
+
const hasExtension = (str) => /\.[a-zA-Z0-9]{2,}$/.test(str);
|
|
99
|
+
if (hasExtension(filePath)) {
|
|
100
|
+
return [import_node_path.default.join("public", "generated"), import_node_path.default.join("src", "catalog-files")];
|
|
101
|
+
}
|
|
102
|
+
return [import_node_path.default.join("public", "generated"), import_node_path.default.join("src", "catalog-files"), import_node_path.default.join("src", "content")];
|
|
103
|
+
}
|
|
104
|
+
if (filePathArr[0] == "components") {
|
|
105
|
+
return [import_node_path.default.join("src", "custom-defined-components")];
|
|
106
|
+
}
|
|
107
|
+
if (filePathArr[0] == "public") {
|
|
108
|
+
return [import_node_path.default.join("public")];
|
|
109
|
+
}
|
|
110
|
+
return [import_node_path.default.join("/")];
|
|
111
|
+
}
|
|
112
|
+
function getRelativeTargetPath(filePath) {
|
|
113
|
+
const filePathArr = filePath.split(import_node_path.default.sep).filter(Boolean);
|
|
114
|
+
if (filePathArr[0] == "public" || filePathArr[0] == "components") {
|
|
115
|
+
filePathArr.shift();
|
|
116
|
+
}
|
|
117
|
+
const relativePath = [];
|
|
118
|
+
for (let i = filePathArr.length - 1; i >= 0; i--) {
|
|
119
|
+
relativePath.unshift(filePathArr[i]);
|
|
120
|
+
if (isCollectionKey(filePathArr[i])) break;
|
|
121
|
+
}
|
|
122
|
+
return import_node_path.default.join(...relativePath);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// src/watcher.js
|
|
126
|
+
var import_rimraf = require("rimraf");
|
|
127
|
+
|
|
128
|
+
// src/eventcatalog-config-file-utils.js
|
|
129
|
+
var import_promises = require("fs/promises");
|
|
130
|
+
var import_node_fs = require("fs");
|
|
131
|
+
var import_promises2 = require("fs/promises");
|
|
132
|
+
var import_node_path2 = __toESM(require("path"), 1);
|
|
133
|
+
var import_uuid = require("uuid");
|
|
134
|
+
var import_gray_matter = __toESM(require("gray-matter"), 1);
|
|
135
|
+
function addPropertyToFrontMatter(input, newProperty, newValue) {
|
|
136
|
+
const file = (0, import_gray_matter.default)(input);
|
|
137
|
+
return import_gray_matter.default.stringify(file.content, { ...file.data, [newProperty]: newValue });
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// src/watcher.js
|
|
141
|
+
async function watch(projectDirectory, catalogDirectory, callback = void 0) {
|
|
142
|
+
const subscription = await import_watcher.default.subscribe(
|
|
143
|
+
projectDirectory,
|
|
144
|
+
compose(
|
|
145
|
+
/**
|
|
146
|
+
* @param {Error|null} err
|
|
147
|
+
* @param {Event[]} events
|
|
148
|
+
* @returns {unknown}
|
|
149
|
+
*/
|
|
150
|
+
(err, events) => {
|
|
151
|
+
if (err) {
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
for (let event of events) {
|
|
155
|
+
const { path: filePath, type } = event;
|
|
156
|
+
const astroPaths = mapCatalogToAstro({
|
|
157
|
+
filePath,
|
|
158
|
+
astroDir: catalogDirectory,
|
|
159
|
+
projectDir: projectDirectory
|
|
160
|
+
});
|
|
161
|
+
for (const astroPath of astroPaths) {
|
|
162
|
+
switch (type) {
|
|
163
|
+
case "create":
|
|
164
|
+
case "update":
|
|
165
|
+
try {
|
|
166
|
+
if (astroPath.endsWith(".mdx")) {
|
|
167
|
+
const content = import_node_fs2.default.readFileSync(astroPath, "utf-8");
|
|
168
|
+
const frontmatter = addPropertyToFrontMatter(content, "pathToFile", filePath);
|
|
169
|
+
import_node_fs2.default.writeFileSync(astroPath, frontmatter);
|
|
170
|
+
}
|
|
171
|
+
} catch (error) {
|
|
172
|
+
}
|
|
173
|
+
if (import_node_fs2.default.statSync(filePath).isDirectory()) import_node_fs2.default.mkdirSync(astroPath, { recursive: true });
|
|
174
|
+
else retryEPERM(import_node_fs2.default.cpSync)(filePath, astroPath);
|
|
175
|
+
break;
|
|
176
|
+
case "delete":
|
|
177
|
+
retryEPERM(import_rimraf.rimrafSync)(astroPath);
|
|
178
|
+
break;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
callback
|
|
184
|
+
),
|
|
185
|
+
{
|
|
186
|
+
ignore: [`**/${catalogDirectory}/!(${projectDirectory})**`]
|
|
187
|
+
}
|
|
188
|
+
);
|
|
189
|
+
return () => subscription.unsubscribe();
|
|
190
|
+
}
|
|
191
|
+
function compose(...fns) {
|
|
192
|
+
return function(err, events) {
|
|
193
|
+
fns.filter(Boolean).forEach((fn, i) => {
|
|
194
|
+
try {
|
|
195
|
+
fn(err, events);
|
|
196
|
+
} catch (error) {
|
|
197
|
+
console.error({ error });
|
|
198
|
+
throw error;
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
var MAX_RETRIES = 5;
|
|
204
|
+
var DELAY_MS = 100;
|
|
205
|
+
function retryEPERM(fn) {
|
|
206
|
+
return (...args) => {
|
|
207
|
+
let retries = 0;
|
|
208
|
+
while (retries < MAX_RETRIES) {
|
|
209
|
+
try {
|
|
210
|
+
return fn(...args);
|
|
211
|
+
} catch (err) {
|
|
212
|
+
if (err.code !== "EPERM") throw err;
|
|
213
|
+
setTimeout(() => {
|
|
214
|
+
}, DELAY_MS);
|
|
215
|
+
retries += 1;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
221
|
+
0 && (module.exports = {
|
|
222
|
+
watch
|
|
223
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {Object} Event
|
|
3
|
+
* @property {string} path
|
|
4
|
+
* @property {"create"|"update"|"delete"} type
|
|
5
|
+
*
|
|
6
|
+
* @typedef {(err: Error | null, events: Event[]) => unknown} SubscribeCallback
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
*
|
|
10
|
+
* @param {string} projectDirectory
|
|
11
|
+
* @param {string} catalogDirectory
|
|
12
|
+
* @param {SubscribeCallback|undefined} callback
|
|
13
|
+
*/
|
|
14
|
+
declare function watch(projectDirectory: string, catalogDirectory: string, callback?: SubscribeCallback | undefined): Promise<() => Promise<void>>;
|
|
15
|
+
type Event = {
|
|
16
|
+
path: string;
|
|
17
|
+
type: "create" | "update" | "delete";
|
|
18
|
+
};
|
|
19
|
+
type SubscribeCallback = (err: Error | null, events: Event[]) => unknown;
|
|
20
|
+
|
|
21
|
+
export { type Event, type SubscribeCallback, watch };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {Object} Event
|
|
3
|
+
* @property {string} path
|
|
4
|
+
* @property {"create"|"update"|"delete"} type
|
|
5
|
+
*
|
|
6
|
+
* @typedef {(err: Error | null, events: Event[]) => unknown} SubscribeCallback
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
*
|
|
10
|
+
* @param {string} projectDirectory
|
|
11
|
+
* @param {string} catalogDirectory
|
|
12
|
+
* @param {SubscribeCallback|undefined} callback
|
|
13
|
+
*/
|
|
14
|
+
declare function watch(projectDirectory: string, catalogDirectory: string, callback?: SubscribeCallback | undefined): Promise<() => Promise<void>>;
|
|
15
|
+
type Event = {
|
|
16
|
+
path: string;
|
|
17
|
+
type: "create" | "update" | "delete";
|
|
18
|
+
};
|
|
19
|
+
type SubscribeCallback = (err: Error | null, events: Event[]) => unknown;
|
|
20
|
+
|
|
21
|
+
export { type Event, type SubscribeCallback, watch };
|
package/dist/watcher.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
|
|
2
|
+
<svg width="800px" height="800px" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" fill="none"><path fill="#5059C9" d="M10.765 6.875h3.616c.342 0 .619.276.619.617v3.288a2.272 2.272 0 01-2.274 2.27h-.01a2.272 2.272 0 01-2.274-2.27V7.199c0-.179.145-.323.323-.323zM13.21 6.225c.808 0 1.464-.655 1.464-1.462 0-.808-.656-1.463-1.465-1.463s-1.465.655-1.465 1.463c0 .807.656 1.462 1.465 1.462z"/><path fill="#7B83EB" d="M8.651 6.225a2.114 2.114 0 002.117-2.112A2.114 2.114 0 008.65 2a2.114 2.114 0 00-2.116 2.112c0 1.167.947 2.113 2.116 2.113zM11.473 6.875h-5.97a.611.611 0 00-.596.625v3.75A3.669 3.669 0 008.488 15a3.669 3.669 0 003.582-3.75V7.5a.611.611 0 00-.597-.625z"/><path fill="#000000" d="M8.814 6.875v5.255a.598.598 0 01-.596.595H5.193a3.951 3.951 0 01-.287-1.476V7.5a.61.61 0 01.597-.624h3.31z" opacity=".1"/><path fill="#000000" d="M8.488 6.875v5.58a.6.6 0 01-.596.595H5.347a3.22 3.22 0 01-.267-.65 3.951 3.951 0 01-.172-1.15V7.498a.61.61 0 01.596-.624h2.985z" opacity=".2"/><path fill="#000000" d="M8.488 6.875v4.93a.6.6 0 01-.596.595H5.08a3.951 3.951 0 01-.172-1.15V7.498a.61.61 0 01.596-.624h2.985z" opacity=".2"/><path fill="#000000" d="M8.163 6.875v4.93a.6.6 0 01-.596.595H5.079a3.951 3.951 0 01-.172-1.15V7.498a.61.61 0 01.596-.624h2.66z" opacity=".2"/><path fill="#000000" d="M8.814 5.195v1.024c-.055.003-.107.006-.163.006-.055 0-.107-.003-.163-.006A2.115 2.115 0 016.593 4.6h1.625a.598.598 0 01.596.594z" opacity=".1"/><path fill="#000000" d="M8.488 5.52v.699a2.115 2.115 0 01-1.79-1.293h1.195a.598.598 0 01.595.594z" opacity=".2"/><path fill="#000000" d="M8.488 5.52v.699a2.115 2.115 0 01-1.79-1.293h1.195a.598.598 0 01.595.594z" opacity=".2"/><path fill="#000000" d="M8.163 5.52v.647a2.115 2.115 0 01-1.465-1.242h.87a.598.598 0 01.595.595z" opacity=".2"/><path fill="url(#microsoft-teams-color-16__paint0_linear_2372_494)" d="M1.597 4.925h5.969c.33 0 .597.267.597.596v5.958a.596.596 0 01-.597.596h-5.97A.596.596 0 011 11.479V5.521c0-.33.267-.596.597-.596z"/><path fill="#ffffff" d="M6.152 7.193H4.959v3.243h-.76V7.193H3.01v-.63h3.141v.63z"/><defs><linearGradient id="microsoft-teams-color-16__paint0_linear_2372_494" x1="2.244" x2="6.906" y1="4.46" y2="12.548" gradientUnits="userSpaceOnUse"><stop stop-color="#5A62C3"/><stop offset=".5" stop-color="#4D55BD"/><stop offset="1" stop-color="#3940AB"/></linearGradient></defs></svg>
|
|
@@ -11,9 +11,6 @@ import ReactFlow, {
|
|
|
11
11
|
type Edge,
|
|
12
12
|
type Node,
|
|
13
13
|
useReactFlow,
|
|
14
|
-
getBezierPath,
|
|
15
|
-
BaseEdge,
|
|
16
|
-
SmoothStepEdge,
|
|
17
14
|
} from 'reactflow';
|
|
18
15
|
import 'reactflow/dist/style.css';
|
|
19
16
|
|
|
@@ -34,7 +31,7 @@ import DownloadButton from './DownloadButton';
|
|
|
34
31
|
import { buildUrl } from '@utils/url-builder';
|
|
35
32
|
import ChannelNode from './Nodes/Channel';
|
|
36
33
|
import { CogIcon } from '@heroicons/react/20/solid';
|
|
37
|
-
|
|
34
|
+
import { useEventCatalogVisualiser } from 'src/hooks/eventcatalog-visualizer';
|
|
38
35
|
interface Props {
|
|
39
36
|
nodes: any;
|
|
40
37
|
edges: any;
|
|
@@ -85,7 +82,7 @@ const NodeGraphBuilder = ({
|
|
|
85
82
|
const [isSettingsOpen, setIsSettingsOpen] = useState(false);
|
|
86
83
|
const [isAnimated, setIsAnimated] = useState(false);
|
|
87
84
|
const [animateMessages, setAnimateMessages] = useState(false);
|
|
88
|
-
|
|
85
|
+
const { hideChannels, toggleChannelsVisibility } = useEventCatalogVisualiser({ nodes, edges, setNodes, setEdges });
|
|
89
86
|
const { fitView } = useReactFlow();
|
|
90
87
|
|
|
91
88
|
const resetNodesAndEdges = useCallback(() => {
|
|
@@ -162,16 +159,6 @@ const NodeGraphBuilder = ({
|
|
|
162
159
|
[nodes, edges, setNodes, setEdges, resetNodesAndEdges, fitView]
|
|
163
160
|
);
|
|
164
161
|
|
|
165
|
-
const toggleAnimation = () => {
|
|
166
|
-
setIsAnimated(!isAnimated);
|
|
167
|
-
setEdges((eds) =>
|
|
168
|
-
eds.map((edge) => ({
|
|
169
|
-
...edge,
|
|
170
|
-
animated: !isAnimated,
|
|
171
|
-
}))
|
|
172
|
-
);
|
|
173
|
-
};
|
|
174
|
-
|
|
175
162
|
const toggleAnimateMessages = () => {
|
|
176
163
|
setAnimateMessages(!animateMessages);
|
|
177
164
|
localStorage.setItem('EventCatalog:animateMessages', JSON.stringify(!animateMessages));
|
|
@@ -196,6 +183,10 @@ const NodeGraphBuilder = ({
|
|
|
196
183
|
);
|
|
197
184
|
}, [animateMessages]);
|
|
198
185
|
|
|
186
|
+
useEffect(() => {
|
|
187
|
+
fitView({ duration: 800 });
|
|
188
|
+
}, [nodes, edges]);
|
|
189
|
+
|
|
199
190
|
const handlePaneClick = useCallback(() => {
|
|
200
191
|
setIsSettingsOpen(false);
|
|
201
192
|
resetNodesAndEdges();
|
|
@@ -319,6 +310,27 @@ const NodeGraphBuilder = ({
|
|
|
319
310
|
</div>
|
|
320
311
|
<p className="text-[10px] text-gray-500">Animate events, queries and commands.</p>
|
|
321
312
|
</div>
|
|
313
|
+
<div>
|
|
314
|
+
<div className="flex items-center justify-between">
|
|
315
|
+
<label htmlFor="message-animation-toggle" className="text-sm font-medium text-gray-700">
|
|
316
|
+
Hide Channels
|
|
317
|
+
</label>
|
|
318
|
+
<button
|
|
319
|
+
id="message-animation-toggle"
|
|
320
|
+
onClick={toggleChannelsVisibility}
|
|
321
|
+
className={`${
|
|
322
|
+
hideChannels ? 'bg-purple-600' : 'bg-gray-200'
|
|
323
|
+
} relative inline-flex h-6 w-11 items-center rounded-full transition-colors focus:outline-none focus:ring-2 focus:ring-purple-500 focus:ring-offset-2`}
|
|
324
|
+
>
|
|
325
|
+
<span
|
|
326
|
+
className={`${
|
|
327
|
+
hideChannels ? 'translate-x-6' : 'translate-x-1'
|
|
328
|
+
} inline-block h-4 w-4 transform rounded-full bg-white transition-transform`}
|
|
329
|
+
/>
|
|
330
|
+
</button>
|
|
331
|
+
</div>
|
|
332
|
+
<p className="text-[10px] text-gray-500">Show or hide channels in the visualizer.</p>
|
|
333
|
+
</div>
|
|
322
334
|
</div>
|
|
323
335
|
</div>
|
|
324
336
|
)}
|
|
@@ -341,29 +353,6 @@ const NodeGraphBuilder = ({
|
|
|
341
353
|
</li>
|
|
342
354
|
))}
|
|
343
355
|
</ul>
|
|
344
|
-
{/* <span className="font-bold">Key</span> */}
|
|
345
|
-
{/* <ul className="m-0 p-0">
|
|
346
|
-
<li className="flex space-x-2 items-center text-[10px]">
|
|
347
|
-
<span className="w-2 h-2 bg-orange-500 block" />
|
|
348
|
-
<span className="block">Events</span>
|
|
349
|
-
</li>
|
|
350
|
-
<li className="flex space-x-2 items-center text-[10px]">
|
|
351
|
-
<span className="w-2 h-2 bg-pink-500 block" />
|
|
352
|
-
<span className="block">Service</span>
|
|
353
|
-
</li>
|
|
354
|
-
<li className="flex space-x-2 items-center text-[10px]">
|
|
355
|
-
<span className="w-2 h-2 bg-blue-500 block" />
|
|
356
|
-
<span className="block">Command</span>
|
|
357
|
-
</li>
|
|
358
|
-
<li className="flex space-x-2 items-center text-[10px]">
|
|
359
|
-
<span className="w-2 h-2 bg-green-500 block" />
|
|
360
|
-
<span className="block">Query</span>
|
|
361
|
-
</li>
|
|
362
|
-
<li className="flex space-x-2 items-center text-[10px]">
|
|
363
|
-
<span className="w-2 h-2 bg-gray-500 block" />
|
|
364
|
-
<span className="block">Channel</span>
|
|
365
|
-
</li>
|
|
366
|
-
</ul> */}
|
|
367
356
|
</div>
|
|
368
357
|
</Panel>
|
|
369
358
|
)}
|
|
@@ -231,6 +231,7 @@ const users = defineCollection({
|
|
|
231
231
|
hidden: z.boolean().optional(),
|
|
232
232
|
email: z.string().optional(),
|
|
233
233
|
slackDirectMessageUrl: z.string().optional(),
|
|
234
|
+
msTeamsDirectMessageUrl: z.string().optional(),
|
|
234
235
|
ownedDomains: z.array(reference('domains')).optional(),
|
|
235
236
|
ownedServices: z.array(reference('services')).optional(),
|
|
236
237
|
ownedEvents: z.array(reference('events')).optional(),
|
|
@@ -248,6 +249,7 @@ const teams = defineCollection({
|
|
|
248
249
|
email: z.string().optional(),
|
|
249
250
|
hidden: z.boolean().optional(),
|
|
250
251
|
slackDirectMessageUrl: z.string().optional(),
|
|
252
|
+
msTeamsDirectMessageUrl: z.string().optional(),
|
|
251
253
|
members: z.array(reference('users')).optional(),
|
|
252
254
|
ownedCommands: z.array(reference('commands')).optional(),
|
|
253
255
|
ownedDomains: z.array(reference('domains')).optional(),
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { useCallback, useMemo, useState, useEffect } from 'react';
|
|
2
|
+
import { type Edge, type Node } from 'reactflow';
|
|
3
|
+
import {
|
|
4
|
+
createEdge,
|
|
5
|
+
generatedIdForEdge,
|
|
6
|
+
generateIdForNode,
|
|
7
|
+
getEdgeLabelForMessageAsSource,
|
|
8
|
+
getEdgeLabelForServiceAsTarget,
|
|
9
|
+
getNodesAndEdgesFromDagre,
|
|
10
|
+
} from '@utils/node-graphs/utils/utils';
|
|
11
|
+
|
|
12
|
+
interface EventCatalogVisualizerProps {
|
|
13
|
+
nodes: Node[];
|
|
14
|
+
edges: Edge[];
|
|
15
|
+
setNodes: (nodes: Node[]) => void;
|
|
16
|
+
setEdges: (edges: Edge[]) => void;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const useEventCatalogVisualiser = ({ nodes, edges, setNodes, setEdges }: EventCatalogVisualizerProps) => {
|
|
20
|
+
const [hideChannels, setHideChannels] = useState(false);
|
|
21
|
+
const [initialNodes] = useState(nodes);
|
|
22
|
+
const [initialEdges] = useState(edges);
|
|
23
|
+
|
|
24
|
+
// Initialize hideChannels from localStorage
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
const storedHideChannels = localStorage.getItem('EventCatalog:hideChannels');
|
|
27
|
+
if (storedHideChannels !== null) {
|
|
28
|
+
setHideChannels(storedHideChannels === 'true');
|
|
29
|
+
}
|
|
30
|
+
}, []);
|
|
31
|
+
|
|
32
|
+
const toggleChannelsVisibility = useCallback(() => {
|
|
33
|
+
setHideChannels((prev) => {
|
|
34
|
+
const newValue = !prev;
|
|
35
|
+
localStorage.setItem('EventCatalog:hideChannels', JSON.stringify(newValue));
|
|
36
|
+
return newValue;
|
|
37
|
+
});
|
|
38
|
+
}, []);
|
|
39
|
+
|
|
40
|
+
const channels = useMemo(() => nodes.filter((node) => node.type === 'channels'), [nodes]);
|
|
41
|
+
const updatedNodes = useMemo(() => nodes.filter((node) => node.type !== 'channels'), [nodes]);
|
|
42
|
+
|
|
43
|
+
const updatedEdges = useMemo(() => {
|
|
44
|
+
return edges.reduce<Edge[]>((acc, edge) => {
|
|
45
|
+
const { source, target, data } = edge;
|
|
46
|
+
const targetIsChannel = channels.some((channel) => channel.id === target);
|
|
47
|
+
const sourceIsChannel = channels.some((channel) => channel.id === source);
|
|
48
|
+
|
|
49
|
+
if (!sourceIsChannel && !targetIsChannel) {
|
|
50
|
+
return [...acc, edge];
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (sourceIsChannel) {
|
|
54
|
+
const edgeLabel =
|
|
55
|
+
data.target.collection === 'services'
|
|
56
|
+
? getEdgeLabelForMessageAsSource(data.source)
|
|
57
|
+
: getEdgeLabelForServiceAsTarget(data.target);
|
|
58
|
+
|
|
59
|
+
return [
|
|
60
|
+
...acc,
|
|
61
|
+
createEdge({
|
|
62
|
+
id: generatedIdForEdge(data.source, data.target),
|
|
63
|
+
source: generateIdForNode(data.source),
|
|
64
|
+
target: generateIdForNode(data.target),
|
|
65
|
+
label: edgeLabel,
|
|
66
|
+
}),
|
|
67
|
+
];
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return [...acc, edge];
|
|
71
|
+
}, []);
|
|
72
|
+
}, [edges, channels]);
|
|
73
|
+
|
|
74
|
+
useEffect(() => {
|
|
75
|
+
if (hideChannels) {
|
|
76
|
+
const { nodes: newNodes, edges: newEdges } = getNodesAndEdgesFromDagre({ nodes: updatedNodes, edges: updatedEdges });
|
|
77
|
+
setNodes(newNodes);
|
|
78
|
+
setEdges(newEdges);
|
|
79
|
+
} else {
|
|
80
|
+
setNodes(initialNodes);
|
|
81
|
+
setEdges(initialEdges);
|
|
82
|
+
}
|
|
83
|
+
}, [hideChannels]);
|
|
84
|
+
|
|
85
|
+
return {
|
|
86
|
+
hideChannels,
|
|
87
|
+
toggleChannelsVisibility,
|
|
88
|
+
};
|
|
89
|
+
};
|
|
@@ -4,6 +4,7 @@ import { readFileSync } from 'fs';
|
|
|
4
4
|
import { createElement } from 'react';
|
|
5
5
|
import { renderToString } from 'react-dom/server';
|
|
6
6
|
import { Parser } from '@asyncapi/parser';
|
|
7
|
+
import { AvroSchemaParser } from '@asyncapi/avro-schema-parser';
|
|
7
8
|
|
|
8
9
|
import type { CollectionTypes, PageTypes } from '@types';
|
|
9
10
|
|
|
@@ -46,7 +47,7 @@ const fileContent = readFileSync(pathOnDisk, 'utf-8');
|
|
|
46
47
|
|
|
47
48
|
// AsyncAPI parser will parser schemas for users, they can turn this off.
|
|
48
49
|
const parseSchemas = Config?.asyncAPI?.renderParsedSchemas ?? true;
|
|
49
|
-
const parsed = await new Parser().parse(fileContent, { parseSchemas });
|
|
50
|
+
const parsed = await new Parser({ schemaParsers: [AvroSchemaParser()] }).parse(fileContent, { parseSchemas });
|
|
50
51
|
const stringified = parsed.document?.json();
|
|
51
52
|
const config: ConfigInterface = { show: { sidebar: true, errors: true } };
|
|
52
53
|
|
|
@@ -99,6 +99,16 @@ const ownedEventsList = [...events, ...commands].map((p) => ({
|
|
|
99
99
|
</div>
|
|
100
100
|
)
|
|
101
101
|
}
|
|
102
|
+
{
|
|
103
|
+
props.data.msTeamsDirectMessageUrl && (
|
|
104
|
+
<div class="flex space-x-1 items-center text-xs text-gray-500 font-bold hover:underline hover:text-primary">
|
|
105
|
+
<img src="/icons/ms-teams.svg" class="w-4 h-4" />
|
|
106
|
+
<a href={`${props.data.msTeamsDirectMessageUrl}`} target="_blank" rel="noopener noreferrer">
|
|
107
|
+
Send DM on Teams
|
|
108
|
+
</a>
|
|
109
|
+
</div>
|
|
110
|
+
)
|
|
111
|
+
}
|
|
102
112
|
</div>
|
|
103
113
|
</div>
|
|
104
114
|
</div>
|
|
@@ -96,6 +96,16 @@ const associatedTeams = teams.map((o) => ({
|
|
|
96
96
|
</div>
|
|
97
97
|
)
|
|
98
98
|
}
|
|
99
|
+
{
|
|
100
|
+
props.data.msTeamsDirectMessageUrl && (
|
|
101
|
+
<div class="flex space-x-1 items-center text-xs text-gray-500 font-bold hover:underline hover:text-primary">
|
|
102
|
+
<img src="/icons/ms-teams.svg" class="w-4 h-4" />
|
|
103
|
+
<a href={`${props.data.msTeamsDirectMessageUrl}`} target="_blank" rel="noopener noreferrer">
|
|
104
|
+
Send DM on Teams
|
|
105
|
+
</a>
|
|
106
|
+
</div>
|
|
107
|
+
)
|
|
108
|
+
}
|
|
99
109
|
</div>
|
|
100
110
|
</div>
|
|
101
111
|
</div>
|
|
@@ -9,6 +9,8 @@ import {
|
|
|
9
9
|
generatedIdForEdge,
|
|
10
10
|
generateIdForNode,
|
|
11
11
|
getChannelNodesAndEdges,
|
|
12
|
+
getEdgeLabelForMessageAsSource,
|
|
13
|
+
getEdgeLabelForServiceAsTarget,
|
|
12
14
|
} from './utils/utils';
|
|
13
15
|
import { MarkerType } from 'reactflow';
|
|
14
16
|
import { findMatchingNodes } from '@utils/collections/util';
|
|
@@ -26,33 +28,6 @@ interface Props {
|
|
|
26
28
|
collection?: CollectionEntry<CollectionMessageTypes>[];
|
|
27
29
|
}
|
|
28
30
|
|
|
29
|
-
const getEdgeLabelForServiceAsTarget = (data: CollectionEntry<CollectionMessageTypes>) => {
|
|
30
|
-
const type = data.collection;
|
|
31
|
-
switch (type) {
|
|
32
|
-
case 'commands':
|
|
33
|
-
return 'invokes';
|
|
34
|
-
case 'events':
|
|
35
|
-
return 'publishes event';
|
|
36
|
-
case 'queries':
|
|
37
|
-
return 'requests';
|
|
38
|
-
default:
|
|
39
|
-
return 'sends to';
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
const getEdgeLabelForMessageAsSource = (data: CollectionEntry<CollectionMessageTypes>) => {
|
|
43
|
-
const type = data.collection;
|
|
44
|
-
switch (type) {
|
|
45
|
-
case 'commands':
|
|
46
|
-
return 'accepts';
|
|
47
|
-
case 'events':
|
|
48
|
-
return 'subscribed by';
|
|
49
|
-
case 'queries':
|
|
50
|
-
return 'accepts';
|
|
51
|
-
default:
|
|
52
|
-
return 'sends to';
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
|
|
56
31
|
const getNodesAndEdges = async ({ id, version, defaultFlow, mode = 'simple', collection = [] }: Props) => {
|
|
57
32
|
const flow = defaultFlow || createDagreGraph({ ranksep: 300, nodesep: 50 });
|
|
58
33
|
const nodes = [] as any,
|