@eventcatalog/core 0.1.13 → 0.1.17
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/.next/BUILD_ID +1 -1
- package/.next/build-manifest.json +58 -44
- package/.next/cache/.tsbuildinfo +1 -1
- package/.next/cache/config.json +3 -3
- package/.next/cache/eslint/.cache_1bay4w0 +1 -1
- package/.next/cache/next-server.js.nft.json +1 -1
- package/.next/cache/webpack/client-production/0.pack +0 -0
- package/.next/cache/webpack/client-production/index.pack +0 -0
- package/.next/cache/webpack/server-production/0.pack +0 -0
- package/.next/cache/webpack/server-production/index.pack +0 -0
- package/.next/next-server.js.nft.json +1 -1
- package/.next/prerender-manifest.json +1 -1
- package/.next/routes-manifest.json +1 -1
- package/.next/server/chunks/484.js +572 -0
- package/.next/server/chunks/{685.js → 730.js} +2 -411
- package/.next/server/chunks/944.js +65 -52
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/server/pages/_app.js +16 -5
- package/.next/server/pages/events/AddedItemToCart/logs.html +1 -1
- package/.next/server/pages/events/AddedItemToCart/v/0.0.1.html +3 -3
- package/.next/server/pages/events/AddedItemToCart/v/0.0.1.json +1 -1
- package/.next/server/pages/events/AddedItemToCart/v/0.0.2.html +3 -3
- package/.next/server/pages/events/AddedItemToCart/v/0.0.2.json +1 -1
- package/.next/server/pages/events/AddedItemToCart.html +4 -22
- package/.next/server/pages/events/AddedItemToCart.json +1 -1
- package/.next/server/pages/events/OrderComplete/logs.html +1 -1
- package/.next/server/pages/events/OrderComplete.html +3 -21
- package/.next/server/pages/events/OrderComplete.json +1 -1
- package/.next/server/pages/events/OrderConfirmed/logs.html +1 -1
- package/.next/server/pages/events/OrderConfirmed.html +3 -3
- package/.next/server/pages/events/OrderConfirmed.json +1 -1
- package/.next/server/pages/events/OrderRequested/logs.html +1 -1
- package/.next/server/pages/events/OrderRequested.html +3 -21
- package/.next/server/pages/events/OrderRequested.json +1 -1
- package/.next/server/pages/events/PaymentProcessed/logs.html +1 -1
- package/.next/server/pages/events/PaymentProcessed.html +3 -21
- package/.next/server/pages/events/PaymentProcessed.json +1 -1
- package/.next/server/pages/events/RemovedItemFromCart/logs.html +1 -1
- package/.next/server/pages/events/RemovedItemFromCart.html +3 -21
- package/.next/server/pages/events/RemovedItemFromCart.json +1 -1
- package/.next/server/pages/events/ShipmentDelivered/logs.html +1 -1
- package/.next/server/pages/events/ShipmentDelivered.html +3 -3
- package/.next/server/pages/events/ShipmentDelivered.json +1 -1
- package/.next/server/pages/events/ShipmentDispatched/logs.html +1 -1
- package/.next/server/pages/events/ShipmentDispatched.html +3 -21
- package/.next/server/pages/events/ShipmentDispatched.json +1 -1
- package/.next/server/pages/events/ShipmentPrepared/logs.html +1 -1
- package/.next/server/pages/events/ShipmentPrepared.html +2 -2
- package/.next/server/pages/events/ShipmentPrepared.json +1 -1
- package/.next/server/pages/events/[name]/v/[version].js +15 -1
- package/.next/server/pages/events/[name]/v/[version].js.nft.json +1 -1
- package/.next/server/pages/events/[name].js +15 -1
- package/.next/server/pages/events/[name].js.nft.json +1 -1
- package/.next/server/pages/events.html +2 -2
- package/.next/server/pages/events.js.nft.json +1 -1
- package/.next/server/pages/index.html +1 -1
- package/.next/server/pages/overview.html +1 -1
- package/.next/server/pages/services/Basket Service.html +2 -22
- package/.next/server/pages/services/Basket Service.json +1 -1
- package/.next/server/pages/services/Data Lake.html +2 -24
- package/.next/server/pages/services/Data Lake.json +1 -1
- package/.next/server/pages/services/Payment Service.html +2 -20
- package/.next/server/pages/services/Payment Service.json +1 -1
- package/.next/server/pages/services/Shipping Service.html +2 -2
- package/.next/server/pages/services/Shipping Service.json +1 -1
- package/.next/server/pages/services/[name].js +26 -3
- package/.next/server/pages/services/[name].js.nft.json +1 -1
- package/.next/server/pages/services.html +2 -2
- package/.next/server/pages/services.js.nft.json +1 -1
- package/.next/server/pages/users/[id].js.nft.json +1 -1
- package/.next/server/pages/users/dboyne.html +2 -2
- package/.next/server/pages/users/mSmith.html +2 -2
- package/.next/server/pages/visualiser.html +14 -0
- package/.next/server/pages/visualiser.js +627 -0
- package/.next/server/pages/visualiser.js.nft.json +1 -0
- package/.next/server/pages/visualiser.json +1 -0
- package/.next/server/pages-manifest.json +1 -0
- package/.next/static/R1JBWbiD3Q61grTfkBBSU/_buildManifest.js +1 -0
- package/.next/static/{Wp8i1_b29rcfszKFNI7O4 → R1JBWbiD3Q61grTfkBBSU}/_middlewareManifest.js +0 -0
- package/.next/static/R1JBWbiD3Q61grTfkBBSU/_ssgManifest.js +1 -0
- package/.next/static/chunks/109-a08539311d3d6672.js +1 -0
- package/.next/static/chunks/178-87f01d17ab32dd4f.js +1 -0
- package/.next/static/chunks/252-08ab418f9b6821dd.js +1 -0
- package/.next/static/chunks/506-12764fcf4b5d93b0.js +1 -0
- package/.next/static/chunks/519-2ec6fc3cdbaa4dc2.js +1 -0
- package/.next/static/chunks/650-343888e13f994a09.js +1 -0
- package/.next/static/chunks/962-20c87db3880df896.js +1 -0
- package/.next/static/chunks/b744740b-229c238b25b9eeac.js +1 -0
- package/.next/static/chunks/pages/_app-6eba1099469a6889.js +1 -0
- package/.next/static/chunks/pages/events/[name]/v/{[version]-d8d4d12f05da9c8a.js → [version]-33051dbc32f5fe4e.js} +1 -1
- package/.next/static/chunks/pages/events/{[name]-89e1edc81aa51fc3.js → [name]-813780e7042af288.js} +1 -1
- package/.next/static/chunks/pages/services/[name]-142d7fa515cfc532.js +1 -0
- package/.next/static/chunks/pages/visualiser-e4e3757e74f19df7.js +1 -0
- package/.next/static/chunks/{webpack-edf0c365e149f010.js → webpack-49abfa9a972ed5a3.js} +1 -1
- package/.next/static/css/6774df2af1f71309.css +3 -0
- package/.next/trace +56 -56
- package/CHANGELOG.md +26 -0
- package/components/Header.tsx +1 -0
- package/components/Mdx/Examples.tsx +27 -27
- package/components/Mdx/NodeGraph/{GraphElements.ts → GraphElements.tsx} +72 -17
- package/components/Mdx/NodeGraph/Node.tsx +15 -0
- package/components/Mdx/NodeGraph/NodeGraph.tsx +62 -12
- package/components/Mdx/NodeGraph/__tests__/__snapshots__/GraphElements.spec.ts.snap +360 -26
- package/components/Sidebars/EventSidebar.tsx +7 -0
- package/components/Sidebars/ServiceSidebar.tsx +8 -1
- package/components/SyntaxHighlighter.tsx +18 -10
- package/out/404/index.html +1 -1
- package/out/_next/data/{Wp8i1_b29rcfszKFNI7O4 → R1JBWbiD3Q61grTfkBBSU}/events/AddedItemToCart/logs.json +0 -0
- package/out/_next/data/{Wp8i1_b29rcfszKFNI7O4 → R1JBWbiD3Q61grTfkBBSU}/events/AddedItemToCart/v/0.0.1.json +1 -1
- package/out/_next/data/{Wp8i1_b29rcfszKFNI7O4 → R1JBWbiD3Q61grTfkBBSU}/events/AddedItemToCart/v/0.0.2.json +1 -1
- package/out/_next/data/R1JBWbiD3Q61grTfkBBSU/events/AddedItemToCart.json +1 -0
- package/out/_next/data/{Wp8i1_b29rcfszKFNI7O4 → R1JBWbiD3Q61grTfkBBSU}/events/OrderComplete/logs.json +0 -0
- package/out/_next/data/R1JBWbiD3Q61grTfkBBSU/events/OrderComplete.json +1 -0
- package/out/_next/data/{Wp8i1_b29rcfszKFNI7O4 → R1JBWbiD3Q61grTfkBBSU}/events/OrderConfirmed/logs.json +0 -0
- package/out/_next/data/{Wp8i1_b29rcfszKFNI7O4 → R1JBWbiD3Q61grTfkBBSU}/events/OrderConfirmed.json +1 -1
- package/out/_next/data/{Wp8i1_b29rcfszKFNI7O4 → R1JBWbiD3Q61grTfkBBSU}/events/OrderRequested/logs.json +0 -0
- package/out/_next/data/R1JBWbiD3Q61grTfkBBSU/events/OrderRequested.json +1 -0
- package/out/_next/data/{Wp8i1_b29rcfszKFNI7O4 → R1JBWbiD3Q61grTfkBBSU}/events/PaymentProcessed/logs.json +0 -0
- package/out/_next/data/{Wp8i1_b29rcfszKFNI7O4 → R1JBWbiD3Q61grTfkBBSU}/events/PaymentProcessed.json +1 -1
- package/out/_next/data/{Wp8i1_b29rcfszKFNI7O4 → R1JBWbiD3Q61grTfkBBSU}/events/RemovedItemFromCart/logs.json +0 -0
- package/out/_next/data/{Wp8i1_b29rcfszKFNI7O4 → R1JBWbiD3Q61grTfkBBSU}/events/RemovedItemFromCart.json +1 -1
- package/out/_next/data/{Wp8i1_b29rcfszKFNI7O4 → R1JBWbiD3Q61grTfkBBSU}/events/ShipmentDelivered/logs.json +0 -0
- package/out/_next/data/{Wp8i1_b29rcfszKFNI7O4 → R1JBWbiD3Q61grTfkBBSU}/events/ShipmentDelivered.json +1 -1
- package/out/_next/data/{Wp8i1_b29rcfszKFNI7O4 → R1JBWbiD3Q61grTfkBBSU}/events/ShipmentDispatched/logs.json +0 -0
- package/out/_next/data/{Wp8i1_b29rcfszKFNI7O4 → R1JBWbiD3Q61grTfkBBSU}/events/ShipmentDispatched.json +1 -1
- package/out/_next/data/{Wp8i1_b29rcfszKFNI7O4 → R1JBWbiD3Q61grTfkBBSU}/events/ShipmentPrepared/logs.json +0 -0
- package/out/_next/data/R1JBWbiD3Q61grTfkBBSU/events/ShipmentPrepared.json +1 -0
- package/out/_next/data/{Wp8i1_b29rcfszKFNI7O4 → R1JBWbiD3Q61grTfkBBSU}/events.json +0 -0
- package/out/_next/data/{Wp8i1_b29rcfszKFNI7O4 → R1JBWbiD3Q61grTfkBBSU}/overview.json +0 -0
- package/out/_next/data/{Wp8i1_b29rcfszKFNI7O4 → R1JBWbiD3Q61grTfkBBSU}/services/Basket Service.json +1 -1
- package/out/_next/data/{Wp8i1_b29rcfszKFNI7O4 → R1JBWbiD3Q61grTfkBBSU}/services/Data Lake.json +1 -1
- package/out/_next/data/R1JBWbiD3Q61grTfkBBSU/services/Payment Service.json +1 -0
- package/out/_next/data/{Wp8i1_b29rcfszKFNI7O4 → R1JBWbiD3Q61grTfkBBSU}/services/Shipping Service.json +1 -1
- package/out/_next/data/{Wp8i1_b29rcfszKFNI7O4 → R1JBWbiD3Q61grTfkBBSU}/services.json +0 -0
- package/out/_next/data/{Wp8i1_b29rcfszKFNI7O4 → R1JBWbiD3Q61grTfkBBSU}/users/dboyne.json +0 -0
- package/out/_next/data/{Wp8i1_b29rcfszKFNI7O4 → R1JBWbiD3Q61grTfkBBSU}/users/mSmith.json +0 -0
- package/out/_next/data/R1JBWbiD3Q61grTfkBBSU/visualiser.json +1 -0
- package/out/_next/static/R1JBWbiD3Q61grTfkBBSU/_buildManifest.js +1 -0
- package/out/_next/static/{Wp8i1_b29rcfszKFNI7O4 → R1JBWbiD3Q61grTfkBBSU}/_middlewareManifest.js +0 -0
- package/out/_next/static/R1JBWbiD3Q61grTfkBBSU/_ssgManifest.js +1 -0
- package/out/_next/static/chunks/109-a08539311d3d6672.js +1 -0
- package/out/_next/static/chunks/178-87f01d17ab32dd4f.js +1 -0
- package/out/_next/static/chunks/252-08ab418f9b6821dd.js +1 -0
- package/out/_next/static/chunks/506-12764fcf4b5d93b0.js +1 -0
- package/out/_next/static/chunks/519-2ec6fc3cdbaa4dc2.js +1 -0
- package/out/_next/static/chunks/650-343888e13f994a09.js +1 -0
- package/out/_next/static/chunks/962-20c87db3880df896.js +1 -0
- package/out/_next/static/chunks/b744740b-229c238b25b9eeac.js +1 -0
- package/out/_next/static/chunks/pages/_app-6eba1099469a6889.js +1 -0
- package/out/_next/static/chunks/pages/events/[name]/v/{[version]-d8d4d12f05da9c8a.js → [version]-33051dbc32f5fe4e.js} +1 -1
- package/out/_next/static/chunks/pages/events/{[name]-89e1edc81aa51fc3.js → [name]-813780e7042af288.js} +1 -1
- package/out/_next/static/chunks/pages/services/[name]-142d7fa515cfc532.js +1 -0
- package/out/_next/static/chunks/pages/visualiser-e4e3757e74f19df7.js +1 -0
- package/out/_next/static/chunks/{webpack-edf0c365e149f010.js → webpack-49abfa9a972ed5a3.js} +1 -1
- package/out/_next/static/css/6774df2af1f71309.css +3 -0
- package/out/events/AddedItemToCart/index.html +4 -22
- package/out/events/AddedItemToCart/logs/index.html +1 -1
- package/out/events/AddedItemToCart/v/0.0.1/index.html +3 -3
- package/out/events/AddedItemToCart/v/0.0.2/index.html +3 -3
- package/out/events/OrderComplete/index.html +3 -21
- package/out/events/OrderComplete/logs/index.html +1 -1
- package/out/events/OrderConfirmed/index.html +3 -3
- package/out/events/OrderConfirmed/logs/index.html +1 -1
- package/out/events/OrderRequested/index.html +3 -21
- package/out/events/OrderRequested/logs/index.html +1 -1
- package/out/events/PaymentProcessed/index.html +3 -21
- package/out/events/PaymentProcessed/logs/index.html +1 -1
- package/out/events/RemovedItemFromCart/index.html +3 -21
- package/out/events/RemovedItemFromCart/logs/index.html +1 -1
- package/out/events/ShipmentDelivered/index.html +3 -3
- package/out/events/ShipmentDelivered/logs/index.html +1 -1
- package/out/events/ShipmentDispatched/index.html +3 -21
- package/out/events/ShipmentDispatched/logs/index.html +1 -1
- package/out/events/ShipmentPrepared/index.html +2 -2
- package/out/events/ShipmentPrepared/logs/index.html +1 -1
- package/out/events/index.html +2 -2
- package/out/index.html +1 -1
- package/out/overview/index.html +1 -1
- package/out/services/Basket Service/index.html +2 -22
- package/out/services/Data Lake/index.html +2 -24
- package/out/services/Payment Service/index.html +2 -20
- package/out/services/Shipping Service/index.html +2 -2
- package/out/services/index.html +2 -2
- package/out/users/dboyne/index.html +2 -2
- package/out/users/mSmith/index.html +2 -2
- package/out/visualiser/index.html +14 -0
- package/package.json +1 -1
- package/pages/events/[name].tsx +11 -9
- package/pages/services/[name].tsx +2 -2
- package/pages/visualiser.tsx +248 -0
- package/styles/globals.css +4 -0
- package/.next/static/Wp8i1_b29rcfszKFNI7O4/_buildManifest.js +0 -1
- package/.next/static/Wp8i1_b29rcfszKFNI7O4/_ssgManifest.js +0 -1
- package/.next/static/chunks/178-bc36881df28d1bab.js +0 -1
- package/.next/static/chunks/280-06401c009983574c.js +0 -1
- package/.next/static/chunks/519-7c428c1e49c8e614.js +0 -1
- package/.next/static/chunks/620-d80b0351ea428525.js +0 -1
- package/.next/static/chunks/651-7a25d8468f22423c.js +0 -1
- package/.next/static/chunks/962-d5070461f6d4a478.js +0 -1
- package/.next/static/chunks/b744740b-94e91620ba96ccbf.js +0 -1
- package/.next/static/chunks/pages/_app-46c2e0f1ff3b4efb.js +0 -1
- package/.next/static/chunks/pages/services/[name]-204382bfbc48b1b4.js +0 -1
- package/.next/static/css/f756e2a0d8f4db27.css +0 -3
- package/out/_next/data/Wp8i1_b29rcfszKFNI7O4/events/AddedItemToCart.json +0 -1
- package/out/_next/data/Wp8i1_b29rcfszKFNI7O4/events/OrderComplete.json +0 -1
- package/out/_next/data/Wp8i1_b29rcfszKFNI7O4/events/OrderRequested.json +0 -1
- package/out/_next/data/Wp8i1_b29rcfszKFNI7O4/events/ShipmentPrepared.json +0 -1
- package/out/_next/data/Wp8i1_b29rcfszKFNI7O4/services/Payment Service.json +0 -1
- package/out/_next/static/Wp8i1_b29rcfszKFNI7O4/_buildManifest.js +0 -1
- package/out/_next/static/Wp8i1_b29rcfszKFNI7O4/_ssgManifest.js +0 -1
- package/out/_next/static/chunks/178-bc36881df28d1bab.js +0 -1
- package/out/_next/static/chunks/280-06401c009983574c.js +0 -1
- package/out/_next/static/chunks/519-7c428c1e49c8e614.js +0 -1
- package/out/_next/static/chunks/620-d80b0351ea428525.js +0 -1
- package/out/_next/static/chunks/651-7a25d8468f22423c.js +0 -1
- package/out/_next/static/chunks/962-d5070461f6d4a478.js +0 -1
- package/out/_next/static/chunks/b744740b-94e91620ba96ccbf.js +0 -1
- package/out/_next/static/chunks/pages/_app-46c2e0f1ff3b4efb.js +0 -1
- package/out/_next/static/chunks/pages/services/[name]-204382bfbc48b1b4.js +0 -1
- package/out/_next/static/css/f756e2a0d8f4db27.css +0 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# @eventcatalog/core
|
|
2
2
|
|
|
3
|
+
## 0.1.17
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`d57e67b`](https://github.com/boyney123/eventcatalog/commit/d57e67bf38be9391841b3c6dee6ab360b2eb1325) [#188](https://github.com/boyney123/eventcatalog/pull/188) Thanks [@boyney123](https://github.com/boyney123)! - fixing visualiser for mobile devices
|
|
8
|
+
|
|
9
|
+
## 0.1.16
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`2d10847`](https://github.com/boyney123/eventcatalog/commit/2d108470af945e1cec59c114627878c56d7385dd) [#186](https://github.com/boyney123/eventcatalog/pull/186) Thanks [@boyney123](https://github.com/boyney123)! - feat: added new visualiser feature
|
|
14
|
+
|
|
15
|
+
## 0.1.15
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- [`60bea4d`](https://github.com/boyney123/eventcatalog/commit/60bea4db471bf3c63a936b86ce7ee549e73972a6) [#182](https://github.com/boyney123/eventcatalog/pull/182) Thanks [@thim81](https://github.com/thim81)! - fix: optional title for all MDX components
|
|
20
|
+
|
|
21
|
+
* [`bf5bab4`](https://github.com/boyney123/eventcatalog/commit/bf5bab44b9be92c5888c6548694c42d1fa83a678) [#184](https://github.com/boyney123/eventcatalog/pull/184) Thanks [@thim81](https://github.com/thim81)! - fix: increase node width for NodeGraph
|
|
22
|
+
|
|
23
|
+
## 0.1.14
|
|
24
|
+
|
|
25
|
+
### Patch Changes
|
|
26
|
+
|
|
27
|
+
- [`1558d17`](https://github.com/boyney123/eventcatalog/commit/1558d17b1c9f925c8e74d22b57edbfc4195a73a6) [#178](https://github.com/boyney123/eventcatalog/pull/178) Thanks [@boyney123](https://github.com/boyney123)! - feat: added better code example component
|
|
28
|
+
|
|
3
29
|
## 0.1.13
|
|
4
30
|
|
|
5
31
|
### Patch Changes
|
package/components/Header.tsx
CHANGED
|
@@ -33,33 +33,33 @@ function Examples({ title = 'Examples', description, examples = [], showLineNumb
|
|
|
33
33
|
{description && <p className="text-md font-medium text-gray-700">{description}</p>}
|
|
34
34
|
|
|
35
35
|
<div>
|
|
36
|
-
<
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
36
|
+
<div className="col-span-5">
|
|
37
|
+
<nav className="-mb-2 flex bg-gray-900" aria-label="Tabs">
|
|
38
|
+
{tabs.map((tab) => {
|
|
39
|
+
const isSelected = tab.name === selectedTab.name;
|
|
40
|
+
return (
|
|
41
|
+
<button
|
|
42
|
+
type="button"
|
|
43
|
+
key={tab.name}
|
|
44
|
+
onClick={() => handleTabSelection(tab)}
|
|
45
|
+
className={classNames(
|
|
46
|
+
isSelected
|
|
47
|
+
? 'border-yellow-300 text-yellow-300 selected bg-gray-700'
|
|
48
|
+
: 'border-transparent text-gray-500 hover:text-gray-400 bg-gray-800 ',
|
|
49
|
+
'whitespace-nowrap py-3 border-b-2 font-medium important:no-underline px-6 text-xs transition '
|
|
50
|
+
)}
|
|
51
|
+
aria-current={isSelected ? 'page' : undefined}
|
|
52
|
+
>
|
|
53
|
+
{tab.name}
|
|
54
|
+
</button>
|
|
55
|
+
);
|
|
56
|
+
})}
|
|
57
|
+
</nav>
|
|
58
|
+
<div>
|
|
59
|
+
<SyntaxHighlighter language={selectedTab.langugage} showLineNumbers={showLineNumbers}>
|
|
60
|
+
{selectedTab.content}
|
|
61
|
+
</SyntaxHighlighter>
|
|
62
|
+
</div>
|
|
63
63
|
</div>
|
|
64
64
|
</div>
|
|
65
65
|
</div>
|
|
@@ -1,29 +1,42 @@
|
|
|
1
1
|
import { ArrowHeadType, XYPosition, Node, Edge } from 'react-flow-renderer';
|
|
2
2
|
import getConfig from 'next/config';
|
|
3
3
|
import type { Event, Service } from '@eventcatalog/types';
|
|
4
|
+
import CustomNode from './Node';
|
|
4
5
|
|
|
5
6
|
const { publicRuntimeConfig: { basePath = '' } = {} } = getConfig();
|
|
6
7
|
|
|
7
8
|
const MIN_NODE_WIDTH = 150;
|
|
9
|
+
type NODE_TYPES = 'service' | 'event';
|
|
10
|
+
|
|
8
11
|
const generateLink = (value, type) => (basePath !== '' ? `${basePath}/${type}/${value}` : `/${type}/${value}`);
|
|
9
|
-
const calcWidth = (value) => (value.length *
|
|
12
|
+
const calcWidth = (value) => (value.length * 8 > MIN_NODE_WIDTH ? value.length * 8 : MIN_NODE_WIDTH);
|
|
10
13
|
|
|
11
|
-
const buildNodeEdge = ({ id, target, source, isAnimated = true }) => ({
|
|
14
|
+
const buildNodeEdge = ({ id, target, source, label, isAnimated = true }): Edge => ({
|
|
12
15
|
id,
|
|
13
16
|
target,
|
|
14
17
|
source,
|
|
15
18
|
type: 'smoothstep',
|
|
16
19
|
arrowHeadType: ArrowHeadType.ArrowClosed,
|
|
17
20
|
animated: isAnimated,
|
|
21
|
+
label,
|
|
22
|
+
labelBgPadding: [8, 4],
|
|
23
|
+
labelBgBorderRadius: 4,
|
|
24
|
+
labelStyle: { fontSize: '6px' },
|
|
25
|
+
labelBgStyle: { fill: 'white', color: '#fff', fillOpacity: 0.5 },
|
|
18
26
|
});
|
|
19
27
|
|
|
20
|
-
const buildNodeData = ({ label, type, maxWidth }: { label: string; type:
|
|
28
|
+
const buildNodeData = ({ name, label, type, maxWidth }: { name: string; label: string; type: NODE_TYPES; maxWidth?: number }) => {
|
|
21
29
|
const width = calcWidth(label);
|
|
22
30
|
const linkType = type === 'service' ? 'services' : 'events';
|
|
23
|
-
const link = generateLink(
|
|
31
|
+
const link = generateLink(name, linkType);
|
|
24
32
|
return { label, link, width, maxWidth };
|
|
25
33
|
};
|
|
26
34
|
|
|
35
|
+
const getNodeLabel = ({ type, label, includeIcon }: { type: NODE_TYPES; label: any; includeIcon: boolean }) => {
|
|
36
|
+
if (!includeIcon) return label;
|
|
37
|
+
return <CustomNode type={type} label={label} />;
|
|
38
|
+
};
|
|
39
|
+
|
|
27
40
|
/**
|
|
28
41
|
* Builds a graph for a given event
|
|
29
42
|
* @param {Event} - event
|
|
@@ -33,12 +46,17 @@ const buildNodeData = ({ label, type, maxWidth }: { label: string; type: 'servic
|
|
|
33
46
|
export const getEventElements = (
|
|
34
47
|
{ name: eventName, producers: eventProducers, consumers: eventConsumers }: Event,
|
|
35
48
|
rootNodeColor = '#2563eb',
|
|
36
|
-
isAnimated = true
|
|
49
|
+
isAnimated = true,
|
|
50
|
+
includeLabels = false,
|
|
51
|
+
includeNodeIcons = false
|
|
37
52
|
) => {
|
|
38
53
|
const position: XYPosition = { x: 0, y: 0 };
|
|
39
54
|
|
|
40
55
|
const consumerColor = '#818cf8';
|
|
41
56
|
const producerColor = '#75d7b6';
|
|
57
|
+
const nodeStyles = {
|
|
58
|
+
fontSize: includeNodeIcons ? '8px' : 'auto',
|
|
59
|
+
};
|
|
42
60
|
|
|
43
61
|
const producersNames = eventProducers.map((s) => calcWidth(s));
|
|
44
62
|
const maxProducersWidth = Math.max(...producersNames);
|
|
@@ -56,40 +74,61 @@ export const getEventElements = (
|
|
|
56
74
|
const nodeWidth = calcWidth(label);
|
|
57
75
|
const diff = maxProducersWidth - nodeWidth;
|
|
58
76
|
const nodeMaxWidth = diff !== 0 ? nodeWidth - diff : maxProducersWidth;
|
|
77
|
+
const labelToRender = getNodeLabel({ type: 'service', label, includeIcon: includeNodeIcons });
|
|
59
78
|
return {
|
|
60
79
|
id,
|
|
61
|
-
data: buildNodeData({ label, type: 'service', maxWidth: nodeMaxWidth }),
|
|
62
|
-
style: { border: `2px solid ${producerColor}`, width: nodeWidth },
|
|
80
|
+
data: buildNodeData({ name: label, label: labelToRender, type: 'service', maxWidth: nodeMaxWidth }),
|
|
81
|
+
style: { border: `2px solid ${producerColor}`, width: nodeWidth, ...nodeStyles },
|
|
63
82
|
type: 'input',
|
|
64
83
|
position,
|
|
65
84
|
};
|
|
66
85
|
});
|
|
67
86
|
const consumersNodes: Node[] = consumers.map(({ id, label }) => {
|
|
68
87
|
const width = calcWidth(label);
|
|
88
|
+
const labelToRender = getNodeLabel({ type: 'service', label, includeIcon: includeNodeIcons });
|
|
69
89
|
return {
|
|
70
90
|
id,
|
|
71
|
-
data: buildNodeData({ label, type: 'service', maxWidth: maxConsumersWidth }),
|
|
72
|
-
style: { border: `2px solid ${consumerColor}`, width },
|
|
91
|
+
data: buildNodeData({ name: label, label: labelToRender, type: 'service', maxWidth: maxConsumersWidth }),
|
|
92
|
+
style: { border: `2px solid ${consumerColor}`, width, ...nodeStyles },
|
|
73
93
|
type: 'output',
|
|
74
94
|
position,
|
|
75
95
|
};
|
|
76
96
|
});
|
|
97
|
+
|
|
77
98
|
const eventNode: Node = {
|
|
78
99
|
id: eventNameAsNodeID,
|
|
79
|
-
data: buildNodeData({
|
|
100
|
+
data: buildNodeData({
|
|
101
|
+
name: eventName,
|
|
102
|
+
label: getNodeLabel({ type: 'event', label: eventName, includeIcon: includeNodeIcons }),
|
|
103
|
+
type: 'event',
|
|
104
|
+
maxWidth: eventNodeWidth,
|
|
105
|
+
}),
|
|
80
106
|
style: {
|
|
81
107
|
border: `2px solid ${rootNodeColor}`,
|
|
82
108
|
width: eventNodeWidth,
|
|
109
|
+
...nodeStyles,
|
|
83
110
|
},
|
|
84
111
|
position,
|
|
85
112
|
};
|
|
86
113
|
|
|
87
114
|
// Build connections
|
|
88
115
|
const producersEdges: Edge[] = producers.map(({ id, label }) =>
|
|
89
|
-
buildNodeEdge({
|
|
116
|
+
buildNodeEdge({
|
|
117
|
+
id: `epe-${label.replace(/ /g, '_')}`,
|
|
118
|
+
source: id,
|
|
119
|
+
target: eventNameAsNodeID,
|
|
120
|
+
isAnimated,
|
|
121
|
+
label: includeLabels ? 'publishes' : '',
|
|
122
|
+
})
|
|
90
123
|
);
|
|
91
124
|
const consumersEdges: Edge[] = consumers.map(({ id, label }) =>
|
|
92
|
-
buildNodeEdge({
|
|
125
|
+
buildNodeEdge({
|
|
126
|
+
id: `ece-${label.replace(/ /g, '_')}`,
|
|
127
|
+
target: id,
|
|
128
|
+
source: eventNameAsNodeID,
|
|
129
|
+
isAnimated,
|
|
130
|
+
label: includeLabels ? 'subscribed by' : '',
|
|
131
|
+
})
|
|
93
132
|
);
|
|
94
133
|
|
|
95
134
|
// Merge nodes in order
|
|
@@ -107,12 +146,17 @@ export const getEventElements = (
|
|
|
107
146
|
export const getServiceElements = (
|
|
108
147
|
{ publishes, subscribes, name: serviceName }: Service,
|
|
109
148
|
rootNodeColor = '#2563eb',
|
|
110
|
-
isAnimated = true
|
|
149
|
+
isAnimated = true,
|
|
150
|
+
includeEdgeLabels = false,
|
|
151
|
+
includeNodeIcons = false
|
|
111
152
|
) => {
|
|
112
153
|
const position: XYPosition = { x: 0, y: 0 };
|
|
113
154
|
|
|
114
155
|
const publishColor = '#818cf8';
|
|
115
156
|
const subscribeColor = '#75d7b6';
|
|
157
|
+
const nodeStyles = {
|
|
158
|
+
fontSize: includeNodeIcons ? '8px' : 'auto',
|
|
159
|
+
};
|
|
116
160
|
|
|
117
161
|
const publishesNames = publishes.map((e) => calcWidth(e.name));
|
|
118
162
|
const maxPublishesWidth = Math.max(...publishesNames);
|
|
@@ -124,10 +168,11 @@ export const getServiceElements = (
|
|
|
124
168
|
// Transforms services & event into a graph model
|
|
125
169
|
const publishesNodes: Node[] = publishes.map((node) => {
|
|
126
170
|
const nodeWidth = calcWidth(node.name);
|
|
171
|
+
const labelToRender = getNodeLabel({ type: 'event', label: node.name, includeIcon: includeNodeIcons });
|
|
127
172
|
return {
|
|
128
173
|
id: `pub-${node.name.replace(/ /g, '_')}`,
|
|
129
|
-
data: buildNodeData({
|
|
130
|
-
style: { border: `2px solid ${publishColor}`, width: nodeWidth },
|
|
174
|
+
data: buildNodeData({ name: node.name, label: labelToRender, type: 'event', maxWidth: maxPublishesWidth }),
|
|
175
|
+
style: { border: `2px solid ${publishColor}`, width: nodeWidth, ...nodeStyles },
|
|
131
176
|
type: 'output',
|
|
132
177
|
position,
|
|
133
178
|
};
|
|
@@ -136,12 +181,14 @@ export const getServiceElements = (
|
|
|
136
181
|
const nodeWidth = calcWidth(node.name);
|
|
137
182
|
const diff = maxSubscribesWidth - nodeWidth;
|
|
138
183
|
const nodeMaxWidth = diff !== 0 ? nodeWidth - diff : maxSubscribesWidth;
|
|
184
|
+
const labelToRender = getNodeLabel({ type: 'event', label: node.name, includeIcon: includeNodeIcons });
|
|
139
185
|
return {
|
|
140
186
|
id: `sub-${node.name.replace(/ /g, '_')}`,
|
|
141
|
-
data: buildNodeData({
|
|
187
|
+
data: buildNodeData({ name: node.name, label: labelToRender, type: 'event', maxWidth: nodeMaxWidth, ...nodeStyles }),
|
|
142
188
|
style: {
|
|
143
189
|
border: `2px solid ${subscribeColor}`,
|
|
144
190
|
width: nodeWidth,
|
|
191
|
+
...nodeStyles,
|
|
145
192
|
},
|
|
146
193
|
type: 'input',
|
|
147
194
|
position,
|
|
@@ -150,10 +197,16 @@ export const getServiceElements = (
|
|
|
150
197
|
|
|
151
198
|
const serviceNode: Node = {
|
|
152
199
|
id: serviceNameAsNodeID,
|
|
153
|
-
data: buildNodeData({
|
|
200
|
+
data: buildNodeData({
|
|
201
|
+
name: serviceName,
|
|
202
|
+
label: getNodeLabel({ type: 'service', label: serviceName, includeIcon: includeNodeIcons }),
|
|
203
|
+
type: 'service',
|
|
204
|
+
maxWidth: calcWidth(serviceName),
|
|
205
|
+
}),
|
|
154
206
|
style: {
|
|
155
207
|
border: `2px solid ${rootNodeColor}`,
|
|
156
208
|
width: calcWidth(serviceName),
|
|
209
|
+
...nodeStyles,
|
|
157
210
|
},
|
|
158
211
|
position,
|
|
159
212
|
};
|
|
@@ -165,6 +218,7 @@ export const getServiceElements = (
|
|
|
165
218
|
source: serviceNameAsNodeID,
|
|
166
219
|
target: `pub-${node.name.replace(/ /g, '_')}`,
|
|
167
220
|
isAnimated,
|
|
221
|
+
label: includeEdgeLabels ? 'publishes' : '',
|
|
168
222
|
})
|
|
169
223
|
);
|
|
170
224
|
|
|
@@ -174,6 +228,7 @@ export const getServiceElements = (
|
|
|
174
228
|
target: serviceNameAsNodeID,
|
|
175
229
|
source: `sub-${node.name.replace(/ /g, '_')}`,
|
|
176
230
|
isAnimated,
|
|
231
|
+
label: includeEdgeLabels ? 'subscribed by' : '',
|
|
177
232
|
})
|
|
178
233
|
);
|
|
179
234
|
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ServerIcon } from '@heroicons/react/outline/';
|
|
3
|
+
import { MailIcon } from '@heroicons/react/solid/';
|
|
4
|
+
|
|
5
|
+
function Node({ type, label }: any) {
|
|
6
|
+
const Icon = type === 'event' ? MailIcon : ServerIcon;
|
|
7
|
+
return (
|
|
8
|
+
<div>
|
|
9
|
+
<Icon className="h-3 w-3 text-gray-700 inline-block mr-1 -mt-0.5" />
|
|
10
|
+
<span className="text-gray-700">{label}</span>
|
|
11
|
+
</div>
|
|
12
|
+
);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default Node;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
2
|
-
import
|
|
2
|
+
import Link from 'next/link';
|
|
3
|
+
import ReactFlow, { Controls, ReactFlowProvider, useStoreState, Background, useZoomPanHelper } from 'react-flow-renderer';
|
|
3
4
|
import { Event, Service } from '@eventcatalog/types';
|
|
4
5
|
import { getEventElements, getServiceElements } from './GraphElements';
|
|
5
6
|
import createGraphLayout, { calcCanvasHeight } from './GraphLayout';
|
|
@@ -7,6 +8,8 @@ import createGraphLayout, { calcCanvasHeight } from './GraphLayout';
|
|
|
7
8
|
interface NodeGraphBuilderProps {
|
|
8
9
|
data: Event | Service;
|
|
9
10
|
source: 'event' | 'service';
|
|
11
|
+
title?: string;
|
|
12
|
+
subtitle?: string;
|
|
10
13
|
rootNodeColor?: string;
|
|
11
14
|
maxZoom?: number;
|
|
12
15
|
fitView?: boolean;
|
|
@@ -14,10 +17,14 @@ interface NodeGraphBuilderProps {
|
|
|
14
17
|
isAnimated?: boolean;
|
|
15
18
|
isDraggable?: boolean;
|
|
16
19
|
isHorizontal?: boolean;
|
|
20
|
+
includeBackground?: boolean;
|
|
21
|
+
includeEdgeLabels?: boolean;
|
|
22
|
+
includeNodeIcons?: boolean;
|
|
17
23
|
}
|
|
18
24
|
|
|
19
25
|
interface NodeGraphProps extends NodeGraphBuilderProps {
|
|
20
|
-
maxHeight?: number;
|
|
26
|
+
maxHeight?: number | string;
|
|
27
|
+
renderWithBorder?: boolean;
|
|
21
28
|
}
|
|
22
29
|
|
|
23
30
|
// NodeGraphBuilder component wrapping ReactFlow
|
|
@@ -31,24 +38,39 @@ function NodeGraphBuilder({
|
|
|
31
38
|
zoomOnScroll = false,
|
|
32
39
|
isDraggable = false,
|
|
33
40
|
isHorizontal = true,
|
|
41
|
+
includeBackground = false,
|
|
42
|
+
includeEdgeLabels = false,
|
|
43
|
+
includeNodeIcons,
|
|
44
|
+
title,
|
|
45
|
+
subtitle,
|
|
34
46
|
}: NodeGraphBuilderProps) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
47
|
+
const getElements = () => {
|
|
48
|
+
if (source === 'event') {
|
|
49
|
+
return getEventElements(data as Event, rootNodeColor, isAnimated, includeEdgeLabels, includeNodeIcons);
|
|
50
|
+
}
|
|
51
|
+
return getServiceElements(data as Service, rootNodeColor, isAnimated, includeEdgeLabels, includeNodeIcons);
|
|
52
|
+
};
|
|
42
53
|
|
|
43
54
|
// Initialize graph layout
|
|
44
55
|
const isInitializedRef = useRef(false);
|
|
45
56
|
const nodes = useStoreState((state) => state.nodes);
|
|
46
57
|
const edges = useStoreState((state) => state.edges);
|
|
58
|
+
const { fitView: resetView } = useZoomPanHelper();
|
|
47
59
|
|
|
48
60
|
// Calculate initial element layout
|
|
49
|
-
const graphElements = createGraphLayout(
|
|
61
|
+
const graphElements = createGraphLayout(getElements(), isHorizontal);
|
|
50
62
|
const [elements, setElements] = useState(graphElements);
|
|
51
63
|
|
|
64
|
+
// if data changes, reset the elements
|
|
65
|
+
useEffect(() => {
|
|
66
|
+
const updatedElements = createGraphLayout(getElements(), isHorizontal);
|
|
67
|
+
setElements(updatedElements);
|
|
68
|
+
setTimeout(() => {
|
|
69
|
+
resetView();
|
|
70
|
+
}, 1);
|
|
71
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
72
|
+
}, [data]);
|
|
73
|
+
|
|
52
74
|
// Rerender graph layout to get rendered width/height for nodes/edges
|
|
53
75
|
useEffect(() => {
|
|
54
76
|
if (
|
|
@@ -87,7 +109,19 @@ function NodeGraphBuilder({
|
|
|
87
109
|
zoomOnScroll={zoomOnScroll}
|
|
88
110
|
maxZoom={maxZoom}
|
|
89
111
|
>
|
|
90
|
-
|
|
112
|
+
{title && (
|
|
113
|
+
<div className="absolute top-4 right-4 bg-white z-10 text-lg px-4 py-2 space-x-2">
|
|
114
|
+
<span className=" font-bold">{title}</span>
|
|
115
|
+
{subtitle && (
|
|
116
|
+
<>
|
|
117
|
+
<span className="text-gray-200">|</span>
|
|
118
|
+
<span className="font-light">{subtitle}</span>
|
|
119
|
+
</>
|
|
120
|
+
)}
|
|
121
|
+
</div>
|
|
122
|
+
)}
|
|
123
|
+
<Controls className="block absolute top-5 react-flow__controls-no-shadow" />
|
|
124
|
+
{includeBackground && <Background color="#c1c1c1" gap={8} />}
|
|
91
125
|
</ReactFlow>
|
|
92
126
|
);
|
|
93
127
|
}
|
|
@@ -104,12 +138,20 @@ function NodeGraph({
|
|
|
104
138
|
isAnimated,
|
|
105
139
|
isDraggable,
|
|
106
140
|
isHorizontal,
|
|
141
|
+
includeBackground,
|
|
142
|
+
renderWithBorder = true,
|
|
143
|
+
title,
|
|
144
|
+
subtitle,
|
|
145
|
+
includeEdgeLabels,
|
|
146
|
+
includeNodeIcons,
|
|
107
147
|
}: NodeGraphProps) {
|
|
108
148
|
// Set dynamic height of node graph
|
|
109
149
|
const dynamicHeight = maxHeight || calcCanvasHeight(data, source);
|
|
110
150
|
|
|
151
|
+
const borderClasses = `border-dashed border-2 border-slate-300`;
|
|
152
|
+
|
|
111
153
|
return (
|
|
112
|
-
<div className=
|
|
154
|
+
<div className={`node-graph w-full h-screen ${renderWithBorder ? borderClasses : ''}`} style={{ height: dynamicHeight }}>
|
|
113
155
|
<ReactFlowProvider>
|
|
114
156
|
<NodeGraphBuilder
|
|
115
157
|
source={source}
|
|
@@ -117,12 +159,20 @@ function NodeGraph({
|
|
|
117
159
|
rootNodeColor={rootNodeColor}
|
|
118
160
|
maxZoom={maxZoom}
|
|
119
161
|
fitView={fitView}
|
|
162
|
+
includeBackground={includeBackground}
|
|
120
163
|
zoomOnScroll={zoomOnScroll}
|
|
121
164
|
isAnimated={isAnimated}
|
|
122
165
|
isDraggable={isDraggable}
|
|
123
166
|
isHorizontal={isHorizontal}
|
|
167
|
+
includeEdgeLabels={includeEdgeLabels}
|
|
168
|
+
includeNodeIcons={includeNodeIcons}
|
|
169
|
+
title={title}
|
|
170
|
+
subtitle={subtitle}
|
|
124
171
|
/>
|
|
125
172
|
</ReactFlowProvider>
|
|
173
|
+
<Link href={`/visualiser?type=${source}&name=${data.name}`}>
|
|
174
|
+
<a className="block text-right underline text-xs mt-4">Open in Visualiser →</a>
|
|
175
|
+
</Link>
|
|
126
176
|
</div>
|
|
127
177
|
);
|
|
128
178
|
}
|