@eventcatalog/core 2.14.3 → 2.16.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 +2 -1
- package/bin/eventcatalog.js +2 -0
- package/default-files-for-collections/ubiquitousLanguages.md +7 -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 +286 -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-55YPRY5U.js +87 -0
- package/dist/chunk-5RNDOKYT.js +97 -0
- package/dist/chunk-6VJTKPOS.js +30 -0
- package/dist/chunk-BT6ILNB3.js +33 -0
- package/dist/chunk-DMGFALQN.js +9 -0
- package/dist/chunk-E7TXTI7G.js +78 -0
- package/{scripts/watcher.js → dist/chunk-NTCYOR4N.js} +29 -52
- 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 +35 -36
- 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 +131 -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 +231 -0
- package/dist/watcher.d.cts +21 -0
- package/dist/watcher.d.ts +21 -0
- package/dist/watcher.js +8 -0
- package/{src → eventcatalog/src}/components/MDX/NodeGraph/Edges/AnimatedMessageEdge.tsx +1 -1
- package/{src → eventcatalog/src}/components/MDX/NodeGraph/NodeGraph.tsx +28 -38
- package/{src → eventcatalog/src}/components/MDX/SchemaViewer/SchemaViewer.astro +6 -1
- package/{src → eventcatalog/src}/components/SideBars/CatalogResourcesSideBar/index.tsx +19 -1
- package/{src → eventcatalog/src}/components/SideBars/DomainSideBar.astro +23 -0
- package/eventcatalog/src/components/Tables/columns/ServiceTableColumns.tsx +196 -0
- package/{src → eventcatalog/src}/content/config.ts +18 -0
- package/eventcatalog/src/hooks/eventcatalog-visualizer.ts +89 -0
- package/eventcatalog/src/pages/docs/[type]/[id]/language.astro +301 -0
- package/{src → eventcatalog/src}/utils/collections/domains.ts +17 -2
- package/{src → eventcatalog/src}/utils/collections/icons.ts +3 -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 +12 -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 -1296
- 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/src/components/Tables/columns/ServiceTableColumns.tsx +0 -164
- /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/ms-teams.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/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.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/styles.css +0 -0
- /package/{src → eventcatalog/src}/components/SideBars/ChannelSideBar.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/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]/asyncapi/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/docs/teams/[id]/index.astro +0 -0
- /package/{src → eventcatalog/src}/pages/docs/users/[id]/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/file-diffs.ts +0 -0
- /package/{src → eventcatalog/src}/utils/collections/flows.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
|
@@ -0,0 +1,131 @@
|
|
|
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/map-catalog-to-astro.js
|
|
31
|
+
var map_catalog_to_astro_exports = {};
|
|
32
|
+
__export(map_catalog_to_astro_exports, {
|
|
33
|
+
mapCatalogToAstro: () => mapCatalogToAstro
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(map_catalog_to_astro_exports);
|
|
36
|
+
var import_node_path = __toESM(require("path"), 1);
|
|
37
|
+
var COLLECTION_KEYS = [
|
|
38
|
+
"events",
|
|
39
|
+
"commands",
|
|
40
|
+
"services",
|
|
41
|
+
"users",
|
|
42
|
+
"teams",
|
|
43
|
+
"domains",
|
|
44
|
+
"flows",
|
|
45
|
+
"pages",
|
|
46
|
+
"changelogs",
|
|
47
|
+
"queries",
|
|
48
|
+
"channels",
|
|
49
|
+
"ubiquitousLanguages"
|
|
50
|
+
];
|
|
51
|
+
function mapCatalogToAstro({ filePath, astroDir, projectDir }) {
|
|
52
|
+
const relativeFilePath = removeBasePath(filePath, projectDir);
|
|
53
|
+
if (!isCatalogRelated(relativeFilePath)) {
|
|
54
|
+
return [];
|
|
55
|
+
}
|
|
56
|
+
const baseTargetPaths = getBaseTargetPaths(relativeFilePath);
|
|
57
|
+
const relativeTargetPath = getRelativeTargetPath(relativeFilePath);
|
|
58
|
+
return baseTargetPaths.map(
|
|
59
|
+
(base) => import_node_path.default.join(
|
|
60
|
+
astroDir,
|
|
61
|
+
base,
|
|
62
|
+
relativeTargetPath.replace("index.md", "index.mdx").replace("changelog.md", "changelog.mdx").replace("ubiquitous-language.md", "ubiquitous-language.mdx")
|
|
63
|
+
)
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
function removeBasePath(fullPath, basePath) {
|
|
67
|
+
const relativePath = import_node_path.default.relative(basePath, fullPath);
|
|
68
|
+
return relativePath.startsWith("..") ? fullPath : relativePath;
|
|
69
|
+
}
|
|
70
|
+
function isCollectionKey(key) {
|
|
71
|
+
return COLLECTION_KEYS.includes(key);
|
|
72
|
+
}
|
|
73
|
+
function isCatalogRelated(filePath) {
|
|
74
|
+
const filePathArr = filePath.split(import_node_path.default.sep).filter(Boolean);
|
|
75
|
+
if ([
|
|
76
|
+
"eventcatalog.config.js",
|
|
77
|
+
// config file at root
|
|
78
|
+
"eventcatalog.styles.css",
|
|
79
|
+
// custom styles file at root
|
|
80
|
+
"components",
|
|
81
|
+
// custom components
|
|
82
|
+
"public",
|
|
83
|
+
// public assets
|
|
84
|
+
...COLLECTION_KEYS
|
|
85
|
+
].includes(filePathArr[0])) {
|
|
86
|
+
return true;
|
|
87
|
+
}
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
function getBaseTargetPaths(filePath) {
|
|
91
|
+
const filePathArr = filePath.split(import_node_path.default.sep).filter(Boolean);
|
|
92
|
+
if (isCollectionKey(filePathArr[0])) {
|
|
93
|
+
if (filePathArr[filePathArr.length - 1] == "changelog.md") {
|
|
94
|
+
return [import_node_path.default.join("src", "content", "changelogs")];
|
|
95
|
+
}
|
|
96
|
+
if (filePathArr[filePathArr.length - 1] == "ubiquitous-language.md") {
|
|
97
|
+
return [import_node_path.default.join("src", "content", "ubiquitousLanguages")];
|
|
98
|
+
}
|
|
99
|
+
if (filePathArr[filePathArr.length - 1].match(/\.md$/)) {
|
|
100
|
+
return [import_node_path.default.join("src", "content")];
|
|
101
|
+
}
|
|
102
|
+
const hasExtension = (str) => /\.[a-zA-Z0-9]{2,}$/.test(str);
|
|
103
|
+
if (hasExtension(filePath)) {
|
|
104
|
+
return [import_node_path.default.join("public", "generated"), import_node_path.default.join("src", "catalog-files")];
|
|
105
|
+
}
|
|
106
|
+
return [import_node_path.default.join("public", "generated"), import_node_path.default.join("src", "catalog-files"), import_node_path.default.join("src", "content")];
|
|
107
|
+
}
|
|
108
|
+
if (filePathArr[0] == "components") {
|
|
109
|
+
return [import_node_path.default.join("src", "custom-defined-components")];
|
|
110
|
+
}
|
|
111
|
+
if (filePathArr[0] == "public") {
|
|
112
|
+
return [import_node_path.default.join("public")];
|
|
113
|
+
}
|
|
114
|
+
return [import_node_path.default.join("/")];
|
|
115
|
+
}
|
|
116
|
+
function getRelativeTargetPath(filePath) {
|
|
117
|
+
const filePathArr = filePath.split(import_node_path.default.sep).filter(Boolean);
|
|
118
|
+
if (filePathArr[0] == "public" || filePathArr[0] == "components") {
|
|
119
|
+
filePathArr.shift();
|
|
120
|
+
}
|
|
121
|
+
const relativePath = [];
|
|
122
|
+
for (let i = filePathArr.length - 1; i >= 0; i--) {
|
|
123
|
+
relativePath.unshift(filePathArr[i]);
|
|
124
|
+
if (isCollectionKey(filePathArr[i])) break;
|
|
125
|
+
}
|
|
126
|
+
return import_node_path.default.join(...relativePath);
|
|
127
|
+
}
|
|
128
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
129
|
+
0 && (module.exports = {
|
|
130
|
+
mapCatalogToAstro
|
|
131
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {Object} MapCatalogToAstroParams
|
|
3
|
+
* @prop {string} filePath The catalog file path
|
|
4
|
+
* @prop {string} astroDir The astro directory
|
|
5
|
+
* @prop {string} projectDir The user's project directory
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
*
|
|
9
|
+
* @param {MapCatalogToAstroParams} params
|
|
10
|
+
* @returns {string[]} The astro file paths
|
|
11
|
+
*/
|
|
12
|
+
declare function mapCatalogToAstro({ filePath, astroDir, projectDir }: MapCatalogToAstroParams): string[];
|
|
13
|
+
type MapCatalogToAstroParams = {
|
|
14
|
+
/**
|
|
15
|
+
* The catalog file path
|
|
16
|
+
*/
|
|
17
|
+
filePath: string;
|
|
18
|
+
/**
|
|
19
|
+
* The astro directory
|
|
20
|
+
*/
|
|
21
|
+
astroDir: string;
|
|
22
|
+
/**
|
|
23
|
+
* The user's project directory
|
|
24
|
+
*/
|
|
25
|
+
projectDir: string;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export { type MapCatalogToAstroParams, mapCatalogToAstro };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {Object} MapCatalogToAstroParams
|
|
3
|
+
* @prop {string} filePath The catalog file path
|
|
4
|
+
* @prop {string} astroDir The astro directory
|
|
5
|
+
* @prop {string} projectDir The user's project directory
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
*
|
|
9
|
+
* @param {MapCatalogToAstroParams} params
|
|
10
|
+
* @returns {string[]} The astro file paths
|
|
11
|
+
*/
|
|
12
|
+
declare function mapCatalogToAstro({ filePath, astroDir, projectDir }: MapCatalogToAstroParams): string[];
|
|
13
|
+
type MapCatalogToAstroParams = {
|
|
14
|
+
/**
|
|
15
|
+
* The catalog file path
|
|
16
|
+
*/
|
|
17
|
+
filePath: string;
|
|
18
|
+
/**
|
|
19
|
+
* The astro directory
|
|
20
|
+
*/
|
|
21
|
+
astroDir: string;
|
|
22
|
+
/**
|
|
23
|
+
* The user's project directory
|
|
24
|
+
*/
|
|
25
|
+
projectDir: string;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export { type MapCatalogToAstroParams, mapCatalogToAstro };
|
package/dist/watcher.cjs
ADDED
|
@@ -0,0 +1,231 @@
|
|
|
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
|
+
"ubiquitousLanguages"
|
|
54
|
+
];
|
|
55
|
+
function mapCatalogToAstro({ filePath, astroDir, projectDir }) {
|
|
56
|
+
const relativeFilePath = removeBasePath(filePath, projectDir);
|
|
57
|
+
if (!isCatalogRelated(relativeFilePath)) {
|
|
58
|
+
return [];
|
|
59
|
+
}
|
|
60
|
+
const baseTargetPaths = getBaseTargetPaths(relativeFilePath);
|
|
61
|
+
const relativeTargetPath = getRelativeTargetPath(relativeFilePath);
|
|
62
|
+
return baseTargetPaths.map(
|
|
63
|
+
(base) => import_node_path.default.join(
|
|
64
|
+
astroDir,
|
|
65
|
+
base,
|
|
66
|
+
relativeTargetPath.replace("index.md", "index.mdx").replace("changelog.md", "changelog.mdx").replace("ubiquitous-language.md", "ubiquitous-language.mdx")
|
|
67
|
+
)
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
function removeBasePath(fullPath, basePath) {
|
|
71
|
+
const relativePath = import_node_path.default.relative(basePath, fullPath);
|
|
72
|
+
return relativePath.startsWith("..") ? fullPath : relativePath;
|
|
73
|
+
}
|
|
74
|
+
function isCollectionKey(key) {
|
|
75
|
+
return COLLECTION_KEYS.includes(key);
|
|
76
|
+
}
|
|
77
|
+
function isCatalogRelated(filePath) {
|
|
78
|
+
const filePathArr = filePath.split(import_node_path.default.sep).filter(Boolean);
|
|
79
|
+
if ([
|
|
80
|
+
"eventcatalog.config.js",
|
|
81
|
+
// config file at root
|
|
82
|
+
"eventcatalog.styles.css",
|
|
83
|
+
// custom styles file at root
|
|
84
|
+
"components",
|
|
85
|
+
// custom components
|
|
86
|
+
"public",
|
|
87
|
+
// public assets
|
|
88
|
+
...COLLECTION_KEYS
|
|
89
|
+
].includes(filePathArr[0])) {
|
|
90
|
+
return true;
|
|
91
|
+
}
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
function getBaseTargetPaths(filePath) {
|
|
95
|
+
const filePathArr = filePath.split(import_node_path.default.sep).filter(Boolean);
|
|
96
|
+
if (isCollectionKey(filePathArr[0])) {
|
|
97
|
+
if (filePathArr[filePathArr.length - 1] == "changelog.md") {
|
|
98
|
+
return [import_node_path.default.join("src", "content", "changelogs")];
|
|
99
|
+
}
|
|
100
|
+
if (filePathArr[filePathArr.length - 1] == "ubiquitous-language.md") {
|
|
101
|
+
return [import_node_path.default.join("src", "content", "ubiquitousLanguages")];
|
|
102
|
+
}
|
|
103
|
+
if (filePathArr[filePathArr.length - 1].match(/\.md$/)) {
|
|
104
|
+
return [import_node_path.default.join("src", "content")];
|
|
105
|
+
}
|
|
106
|
+
const hasExtension = (str) => /\.[a-zA-Z0-9]{2,}$/.test(str);
|
|
107
|
+
if (hasExtension(filePath)) {
|
|
108
|
+
return [import_node_path.default.join("public", "generated"), import_node_path.default.join("src", "catalog-files")];
|
|
109
|
+
}
|
|
110
|
+
return [import_node_path.default.join("public", "generated"), import_node_path.default.join("src", "catalog-files"), import_node_path.default.join("src", "content")];
|
|
111
|
+
}
|
|
112
|
+
if (filePathArr[0] == "components") {
|
|
113
|
+
return [import_node_path.default.join("src", "custom-defined-components")];
|
|
114
|
+
}
|
|
115
|
+
if (filePathArr[0] == "public") {
|
|
116
|
+
return [import_node_path.default.join("public")];
|
|
117
|
+
}
|
|
118
|
+
return [import_node_path.default.join("/")];
|
|
119
|
+
}
|
|
120
|
+
function getRelativeTargetPath(filePath) {
|
|
121
|
+
const filePathArr = filePath.split(import_node_path.default.sep).filter(Boolean);
|
|
122
|
+
if (filePathArr[0] == "public" || filePathArr[0] == "components") {
|
|
123
|
+
filePathArr.shift();
|
|
124
|
+
}
|
|
125
|
+
const relativePath = [];
|
|
126
|
+
for (let i = filePathArr.length - 1; i >= 0; i--) {
|
|
127
|
+
relativePath.unshift(filePathArr[i]);
|
|
128
|
+
if (isCollectionKey(filePathArr[i])) break;
|
|
129
|
+
}
|
|
130
|
+
return import_node_path.default.join(...relativePath);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// src/watcher.js
|
|
134
|
+
var import_rimraf = require("rimraf");
|
|
135
|
+
|
|
136
|
+
// src/eventcatalog-config-file-utils.js
|
|
137
|
+
var import_promises = require("fs/promises");
|
|
138
|
+
var import_node_fs = require("fs");
|
|
139
|
+
var import_promises2 = require("fs/promises");
|
|
140
|
+
var import_node_path2 = __toESM(require("path"), 1);
|
|
141
|
+
var import_uuid = require("uuid");
|
|
142
|
+
var import_gray_matter = __toESM(require("gray-matter"), 1);
|
|
143
|
+
function addPropertyToFrontMatter(input, newProperty, newValue) {
|
|
144
|
+
const file = (0, import_gray_matter.default)(input);
|
|
145
|
+
return import_gray_matter.default.stringify(file.content, { ...file.data, [newProperty]: newValue });
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// src/watcher.js
|
|
149
|
+
async function watch(projectDirectory, catalogDirectory, callback = void 0) {
|
|
150
|
+
const subscription = await import_watcher.default.subscribe(
|
|
151
|
+
projectDirectory,
|
|
152
|
+
compose(
|
|
153
|
+
/**
|
|
154
|
+
* @param {Error|null} err
|
|
155
|
+
* @param {Event[]} events
|
|
156
|
+
* @returns {unknown}
|
|
157
|
+
*/
|
|
158
|
+
(err, events) => {
|
|
159
|
+
if (err) {
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
for (let event of events) {
|
|
163
|
+
const { path: filePath, type } = event;
|
|
164
|
+
const astroPaths = mapCatalogToAstro({
|
|
165
|
+
filePath,
|
|
166
|
+
astroDir: catalogDirectory,
|
|
167
|
+
projectDir: projectDirectory
|
|
168
|
+
});
|
|
169
|
+
for (const astroPath of astroPaths) {
|
|
170
|
+
switch (type) {
|
|
171
|
+
case "create":
|
|
172
|
+
case "update":
|
|
173
|
+
try {
|
|
174
|
+
if (astroPath.endsWith(".mdx")) {
|
|
175
|
+
const content = import_node_fs2.default.readFileSync(astroPath, "utf-8");
|
|
176
|
+
const frontmatter = addPropertyToFrontMatter(content, "pathToFile", filePath);
|
|
177
|
+
import_node_fs2.default.writeFileSync(astroPath, frontmatter);
|
|
178
|
+
}
|
|
179
|
+
} catch (error) {
|
|
180
|
+
}
|
|
181
|
+
if (import_node_fs2.default.statSync(filePath).isDirectory()) import_node_fs2.default.mkdirSync(astroPath, { recursive: true });
|
|
182
|
+
else retryEPERM(import_node_fs2.default.cpSync)(filePath, astroPath);
|
|
183
|
+
break;
|
|
184
|
+
case "delete":
|
|
185
|
+
retryEPERM(import_rimraf.rimrafSync)(astroPath);
|
|
186
|
+
break;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
callback
|
|
192
|
+
),
|
|
193
|
+
{
|
|
194
|
+
ignore: [`**/${catalogDirectory}/!(${projectDirectory})**`]
|
|
195
|
+
}
|
|
196
|
+
);
|
|
197
|
+
return () => subscription.unsubscribe();
|
|
198
|
+
}
|
|
199
|
+
function compose(...fns) {
|
|
200
|
+
return function(err, events) {
|
|
201
|
+
fns.filter(Boolean).forEach((fn, i) => {
|
|
202
|
+
try {
|
|
203
|
+
fn(err, events);
|
|
204
|
+
} catch (error) {
|
|
205
|
+
console.error({ error });
|
|
206
|
+
throw error;
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
var MAX_RETRIES = 5;
|
|
212
|
+
var DELAY_MS = 100;
|
|
213
|
+
function retryEPERM(fn) {
|
|
214
|
+
return (...args) => {
|
|
215
|
+
let retries = 0;
|
|
216
|
+
while (retries < MAX_RETRIES) {
|
|
217
|
+
try {
|
|
218
|
+
return fn(...args);
|
|
219
|
+
} catch (err) {
|
|
220
|
+
if (err.code !== "EPERM") throw err;
|
|
221
|
+
setTimeout(() => {
|
|
222
|
+
}, DELAY_MS);
|
|
223
|
+
retries += 1;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
229
|
+
0 && (module.exports = {
|
|
230
|
+
watch
|
|
231
|
+
});
|
|
@@ -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
|
@@ -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();
|
|
@@ -261,6 +252,7 @@ const NodeGraphBuilder = ({
|
|
|
261
252
|
<ReactFlow
|
|
262
253
|
nodeTypes={nodeTypes}
|
|
263
254
|
edgeTypes={edgeTypes}
|
|
255
|
+
minZoom={0.07}
|
|
264
256
|
nodes={nodes}
|
|
265
257
|
edges={edges}
|
|
266
258
|
fitView
|
|
@@ -319,6 +311,27 @@ const NodeGraphBuilder = ({
|
|
|
319
311
|
</div>
|
|
320
312
|
<p className="text-[10px] text-gray-500">Animate events, queries and commands.</p>
|
|
321
313
|
</div>
|
|
314
|
+
<div>
|
|
315
|
+
<div className="flex items-center justify-between">
|
|
316
|
+
<label htmlFor="message-animation-toggle" className="text-sm font-medium text-gray-700">
|
|
317
|
+
Hide Channels
|
|
318
|
+
</label>
|
|
319
|
+
<button
|
|
320
|
+
id="message-animation-toggle"
|
|
321
|
+
onClick={toggleChannelsVisibility}
|
|
322
|
+
className={`${
|
|
323
|
+
hideChannels ? 'bg-purple-600' : 'bg-gray-200'
|
|
324
|
+
} 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`}
|
|
325
|
+
>
|
|
326
|
+
<span
|
|
327
|
+
className={`${
|
|
328
|
+
hideChannels ? 'translate-x-6' : 'translate-x-1'
|
|
329
|
+
} inline-block h-4 w-4 transform rounded-full bg-white transition-transform`}
|
|
330
|
+
/>
|
|
331
|
+
</button>
|
|
332
|
+
</div>
|
|
333
|
+
<p className="text-[10px] text-gray-500">Show or hide channels in the visualizer.</p>
|
|
334
|
+
</div>
|
|
322
335
|
</div>
|
|
323
336
|
</div>
|
|
324
337
|
)}
|
|
@@ -341,29 +354,6 @@ const NodeGraphBuilder = ({
|
|
|
341
354
|
</li>
|
|
342
355
|
))}
|
|
343
356
|
</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
357
|
</div>
|
|
368
358
|
</Panel>
|
|
369
359
|
)}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
const { catalog, id } = Astro.props;
|
|
3
3
|
import fs from 'node:fs/promises';
|
|
4
4
|
import { existsSync } from 'fs';
|
|
5
|
+
import yaml from 'js-yaml';
|
|
5
6
|
import path from 'path';
|
|
6
7
|
import SchemaViewerClient from './SchemaViewer';
|
|
7
8
|
import Admonition from '../Admonition';
|
|
@@ -48,7 +49,11 @@ try {
|
|
|
48
49
|
if (exists) {
|
|
49
50
|
// Load the schema for the component
|
|
50
51
|
schema = await fs.readFile(schemaPath, 'utf-8');
|
|
51
|
-
|
|
52
|
+
if (schemaPath.endsWith('.yml') || schemaPath.endsWith('.yaml')) {
|
|
53
|
+
schema = yaml.load(schema);
|
|
54
|
+
} else {
|
|
55
|
+
schema = JSON.parse(schema);
|
|
56
|
+
}
|
|
52
57
|
}
|
|
53
58
|
|
|
54
59
|
return {
|
|
@@ -4,12 +4,28 @@ import { ChevronDownIcon, ChevronUpIcon } from '@heroicons/react/24/outline';
|
|
|
4
4
|
import './styles.css';
|
|
5
5
|
import { getIconForCollection as getIconForCollectionOriginal } from '@utils/collections/icons';
|
|
6
6
|
|
|
7
|
+
const STORAGE_KEY = 'EventCatalog:catalogSidebarCollapsedGroups';
|
|
8
|
+
|
|
7
9
|
const CatalogResourcesSideBar = ({ resources, currentPath }: any) => {
|
|
8
10
|
const [data, setData] = useState(resources);
|
|
9
11
|
const [searchQuery, setSearchQuery] = useState('');
|
|
10
|
-
const [
|
|
12
|
+
const [isInitialized, setIsInitialized] = useState(false);
|
|
13
|
+
const [collapsedGroups, setCollapsedGroups] = useState<{ [key: string]: boolean }>(() => {
|
|
14
|
+
if (typeof window !== 'undefined') {
|
|
15
|
+
const saved = window.localStorage.getItem(STORAGE_KEY);
|
|
16
|
+
setIsInitialized(true);
|
|
17
|
+
return saved ? JSON.parse(saved) : {};
|
|
18
|
+
}
|
|
19
|
+
return {};
|
|
20
|
+
});
|
|
11
21
|
const decodedCurrentPath = decodeURIComponent(currentPath);
|
|
12
22
|
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
if (typeof window !== 'undefined') {
|
|
25
|
+
window.localStorage.setItem(STORAGE_KEY, JSON.stringify(collapsedGroups));
|
|
26
|
+
}
|
|
27
|
+
}, [collapsedGroups]);
|
|
28
|
+
|
|
13
29
|
const handleSearch = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
14
30
|
setSearchQuery(e.target.value);
|
|
15
31
|
};
|
|
@@ -47,6 +63,8 @@ const CatalogResourcesSideBar = ({ resources, currentPath }: any) => {
|
|
|
47
63
|
|
|
48
64
|
const getIconForCollection = useMemo(() => getIconForCollectionOriginal, []);
|
|
49
65
|
|
|
66
|
+
if (!isInitialized) return null;
|
|
67
|
+
|
|
50
68
|
return (
|
|
51
69
|
<nav className="space-y-6 text-black ">
|
|
52
70
|
<div className="space-y-2">
|