@eventcatalog/core 2.12.2 → 2.13.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.
Files changed (78) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/package.json +1 -1
  3. package/public/icons/protocols/kafka.svg +1 -0
  4. package/scripts/catalog-to-astro-content-directory.js +13 -1
  5. package/scripts/default-files-for-collections/channels.md +8 -0
  6. package/scripts/map-catalog-to-astro.js +1 -0
  7. package/src/components/DocsNavigation.astro +4 -4
  8. package/src/components/Header.astro +3 -3
  9. package/src/components/Lists/PillListFlat.tsx +19 -12
  10. package/src/components/Lists/ProtocolList.tsx +88 -0
  11. package/src/components/MDX/ChannelInformation/ChannelInformation.tsx +79 -0
  12. package/src/components/MDX/Flow/Flow.astro +3 -3
  13. package/src/components/MDX/NodeGraph/DownloadButton.tsx +3 -3
  14. package/src/components/MDX/NodeGraph/Edges/AnimatedMessageEdge.tsx +82 -0
  15. package/src/components/MDX/NodeGraph/NodeGraph.astro +24 -67
  16. package/src/components/MDX/NodeGraph/NodeGraph.tsx +188 -17
  17. package/src/components/MDX/NodeGraph/Nodes/Channel.tsx +133 -0
  18. package/src/components/MDX/components.tsx +2 -0
  19. package/src/components/Seo.astro +0 -2
  20. package/src/components/SideBars/CatalogResourcesSideBar/index.tsx +4 -13
  21. package/src/components/SideBars/ChannelSideBar.astro +117 -0
  22. package/src/components/SideBars/MessageSideBar.astro +13 -0
  23. package/src/content/config.ts +37 -0
  24. package/src/icons/protocols/WebSocket.svg +1 -0
  25. package/src/icons/protocols/amqp.svg +1 -0
  26. package/src/icons/protocols/eventbridge.svg +6 -0
  27. package/src/icons/protocols/googlepubsub.svg +1 -0
  28. package/src/icons/protocols/http.svg +1 -0
  29. package/src/icons/protocols/index.ts +15 -0
  30. package/src/icons/protocols/jms.svg +1 -0
  31. package/src/icons/protocols/kafka.svg +1 -0
  32. package/src/icons/protocols/mercure.svg +20 -0
  33. package/src/icons/protocols/mqtt.svg +17 -0
  34. package/src/icons/protocols/nats.svg +13 -0
  35. package/src/icons/protocols/pulsar.svg +4 -0
  36. package/src/icons/protocols/redis.svg +1 -0
  37. package/src/icons/protocols/sns.svg +6 -0
  38. package/src/icons/protocols/solace.svg +1 -0
  39. package/src/icons/protocols/sqs.svg +7 -0
  40. package/src/icons/protocols/ws.svg +1 -0
  41. package/src/layouts/DiscoverLayout.astro +3 -3
  42. package/src/layouts/VerticalSideBarLayout.astro +10 -5
  43. package/src/layouts/VisualiserLayout.astro +3 -3
  44. package/src/pages/discover/[type]/index.astro +3 -3
  45. package/src/pages/docs/[type]/[id]/[version]/asyncapi/index.astro +2 -2
  46. package/src/pages/docs/[type]/[id]/[version]/changelog/index.astro +2 -2
  47. package/src/pages/docs/[type]/[id]/[version]/index.astro +11 -4
  48. package/src/pages/docs/[type]/[id]/[version]/spec/index.astro +2 -2
  49. package/src/pages/docs/[type]/[id]/index.astro +17 -4
  50. package/src/pages/index.astro +3 -3
  51. package/src/pages/visualiser/[type]/[id]/[version]/index.astro +2 -2
  52. package/src/pages/visualiser/[type]/[id]/index.astro +2 -2
  53. package/src/remark-plugins/mermaid.ts +0 -1
  54. package/src/types/index.ts +2 -2
  55. package/src/utils/channels.ts +64 -0
  56. package/src/utils/collections/icons.ts +6 -0
  57. package/src/utils/commands.ts +6 -0
  58. package/src/utils/{config → eventcatalog-config}/catalog.ts +1 -1
  59. package/src/utils/events.ts +5 -0
  60. package/src/utils/{domains/node-graph.ts → node-graphs/domains-node-graph.ts} +2 -2
  61. package/src/utils/{flows/node-graph.ts → node-graphs/flows-node-graph.ts} +2 -2
  62. package/src/utils/node-graphs/message-node-graph.ts +216 -0
  63. package/src/utils/{services/node-graph.ts → node-graphs/services-node-graph.ts} +79 -54
  64. package/src/utils/node-graphs/utils/utils.ts +128 -0
  65. package/src/utils/{pages/pages.ts → page-loaders/page-data-loader.ts} +4 -2
  66. package/src/utils/queries.ts +5 -0
  67. package/tsconfig.json +2 -1
  68. package/src/remark-plugins/remark-modified-time.mjs +0 -9
  69. package/src/utils/commands/node-graph.ts +0 -144
  70. package/src/utils/events/node-graph.ts +0 -145
  71. package/src/utils/node-graph-utils/utils.ts +0 -29
  72. package/src/utils/queries/node-graph.ts +0 -144
  73. /package/src/pages/docs/[type]/[id]/[version]/spec/{styles.css → _styles.css} +0 -0
  74. /package/src/utils/{changelogs → collections}/changelogs.ts +0 -0
  75. /package/src/utils/{domains → collections}/domains.ts +0 -0
  76. /package/src/utils/{flows → collections}/flows.ts +0 -0
  77. /package/src/utils/{services → collections}/services.ts +0 -0
  78. /package/src/utils/{versions → collections}/versions.ts +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @eventcatalog/core
2
2
 
3
+ ## 2.13.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 003c1f2: feat(core): adding channels to eventcatalog
8
+
9
+ ## 2.12.3
10
+
11
+ ### Patch Changes
12
+
13
+ - d0d13c9: chore(core): fixing z-index issue with the header nav and removing the max-width
14
+
3
15
  ## 2.12.2
4
16
 
5
17
  ### Patch Changes
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "url": "https://github.com/event-catalog/eventcatalog.git"
7
7
  },
8
8
  "type": "module",
9
- "version": "2.12.2",
9
+ "version": "2.13.0",
10
10
  "publishConfig": {
11
11
  "access": "public"
12
12
  },
@@ -0,0 +1 @@
1
+ <svg width="100%" height="100%" viewBox="-78.5 0 413 413" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" preserveAspectRatio="xMidYMid" fill="currentColor" stroke="currentColor" stroke-width="0.00413"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round" stroke="#CCCCCC" stroke-width="5.782000000000001"></g><g id="SVGRepo_iconCarrier"> <g> <path d="M87.9320692,36.714181 C83.382936,32.1427482 77.0364491,29.3196096 69.9808327,29.3196096 C62.9519759,29.3196096 56.6545483,32.1427482 52.1589343,36.714181 L52.0295962,36.714181 C47.4938428,41.2633143 44.6707042,47.614261 44.6707042,54.6431179 C44.6707042,61.6987343 47.4938428,67.9961618 52.0295962,72.5185355 L52.1589343,72.6211139 C56.6545483,77.1702472 62.9519759,79.9666261 69.9808327,79.9666261 C77.0364491,79.9666261 83.382936,77.1702472 87.9320692,72.6211139 L87.9989682,72.5185355 C92.5570213,67.9961618 95.3534002,61.6987343 95.3534002,54.6431179 C95.3534002,47.614261 92.5570213,41.2633143 87.9989682,36.714181 L87.9320692,36.714181 Z M69.9808327,383.353672 C77.0364491,383.353672 83.382936,380.481475 87.9320692,375.985861 L87.9989682,375.852063 C92.5570213,371.365368 95.3534002,365.014422 95.3534002,358.034624 C95.3534002,350.979008 92.5570213,344.654821 87.9989682,340.083388 L87.9320692,340.083388 C83.382936,335.458436 77.0364491,332.662057 69.9808327,332.662057 C62.9519759,332.662057 56.6545483,335.458436 52.1589343,340.083388 L52.0295962,340.083388 C47.4938428,344.654821 44.6707042,350.979008 44.6707042,358.034624 C44.6707042,365.014422 47.4938428,371.365368 52.0295962,375.852063 L52.1589343,375.985861 C56.6545483,380.481475 62.9519759,383.353672 69.9808327,383.353672 Z M207.953367,306.633879 C214.228495,304.988163 219.910452,300.960842 223.375821,294.873031 L223.844114,293.985504 C226.925929,288.209889 227.487881,281.546747 225.842165,275.641794 C224.183069,269.317607 220.106689,263.724849 214.032258,260.2238 L213.679923,259.987423 C207.76159,256.745051 201.018169,256.040381 194.82332,257.712857 C188.525893,259.282754 182.870696,263.488472 179.423166,269.527223 C175.931037,275.507996 175.199608,282.407514 176.872084,288.758461 C178.598078,295.002369 182.634319,300.648647 188.66861,304.176455 L188.70875,304.176455 C194.756421,307.650744 201.60688,308.279595 207.953367,306.633879 Z M95.9688712,180.386512 C89.3146489,173.750129 80.1450235,169.59347 69.9808327,169.59347 C59.8567813,169.59347 50.7094556,173.750129 44.0686131,180.386512 C37.4589901,187.000595 33.38261,196.147921 33.38261,206.285352 C33.38261,216.449543 37.4589901,225.623628 44.0686131,232.31353 C50.7094556,238.896393 59.8567813,243.026292 69.9808327,243.026292 C80.1450235,243.026292 89.3146489,238.896393 95.9688712,232.31353 C102.591874,225.623628 106.668254,216.449543 106.668254,206.285352 C106.668254,196.147921 102.591874,187.000595 95.9688712,180.386512 Z M81.3581257,137.223266 C96.0848295,139.64947 109.335295,146.705086 119.445967,156.896037 L119.526245,156.896037 C121.131822,158.514993 122.701719,160.267747 124.151198,162.042801 L149.434566,147.414216 C146.036096,137.142987 145.879999,126.403464 148.609478,116.341852 C152.217565,102.85501 160.959037,90.7819674 174.062325,83.2045386 L174.494938,82.9458624 C187.455508,75.6003502 202.191132,74.0839725 215.495117,77.6920595 C228.964119,81.2956866 241.11744,90.0772977 248.681489,103.171665 L248.681489,103.198425 C256.209859,116.212514 257.739616,131.157755 254.144909,144.591077 C250.563582,158.069 241.781971,170.222321 228.692063,177.746231 L225.240074,179.788881 L224.887739,179.788881 C212.779016,185.560036 199.461652,186.452023 187.232511,183.23641 C177.188739,180.569369 167.974514,174.976611 160.7628,167.006708 L135.519571,181.590694 C138.418528,189.270702 140.028564,197.55726 140.028564,206.285352 C140.028564,214.986684 138.418528,223.375821 135.519571,231.109347 L160.7628,245.639814 C167.974514,237.567333 177.188739,232.077153 187.232511,229.410112 C200.701514,225.726206 215.637835,227.296103 228.692063,234.900292 L229.526071,235.292766 L229.526071,235.346285 C242.138765,242.972773 250.603721,254.78714 254.144909,268.113424 C257.739616,281.466468 256.209859,296.416169 248.681489,309.457017 L248.226576,310.371304 L248.173057,310.291025 C240.609008,322.86358 228.692063,331.382055 215.535256,334.985683 C202.035034,338.54025 187.103173,337.023873 174.062325,329.526723 L174.062325,329.419684 C160.959037,321.842255 152.217565,309.742453 148.609478,296.286831 C145.879999,286.251978 146.036096,275.507996 149.434566,265.241226 L124.151198,250.65724 C122.701719,252.436754 121.131822,254.10923 119.526245,255.728186 L119.445967,255.804005 C109.335295,265.945896 96.0848295,273.001512 81.3581257,275.351898 L81.3581257,304.568929 C91.8523516,306.763217 101.258354,312.01702 108.630625,319.384832 L108.666305,319.46511 C118.54506,329.290346 124.65963,342.982345 124.65963,358.034624 C124.65963,373.037844 118.54506,386.645104 108.666305,396.523859 L108.630625,396.679957 C98.6849713,406.558712 85.0331117,412.673282 69.9808327,412.673282 C55.0088325,412.673282 41.3391332,406.558712 31.4202388,396.679957 L31.3845593,396.679957 L31.3845593,396.523859 C21.4924245,386.645104 15.3644745,373.037844 15.3644745,358.034624 C15.3644745,342.982345 21.4924245,329.290346 31.3845593,319.46511 L31.3845593,319.384832 L31.4202388,319.384832 C38.7791307,312.01702 48.1985125,306.763217 58.6659788,304.568929 L58.6659788,275.351898 C43.9258952,273.001512 30.7155691,265.945896 20.6182773,255.804005 L20.5112389,255.728186 C7.88962418,243.053052 0,225.623628 0,206.285352 C0,187.000595 7.88962418,169.571171 20.5112389,156.896037 L20.6182773,156.896037 C30.7155691,146.705086 43.9258952,139.64947 58.6659788,137.223266 L58.6659788,108.135573 C48.1985125,105.861006 38.7791307,100.611663 31.4202388,93.2929105 L31.3845593,93.2929105 L31.3845593,93.2126317 C21.4924245,83.2848174 15.3644745,69.6953969 15.3644745,54.6431179 C15.3644745,39.6666577 21.4924245,25.9478991 31.3845593,16.0691441 L31.4202388,16.0200848 C41.3391332,6.11457024 55.0088325,0 69.9808327,0 C85.0331117,0 98.6849713,6.11457024 108.630625,16.0200848 L108.630625,16.0691441 L108.666305,16.0691441 C118.54506,25.9478991 124.65963,39.6666577 124.65963,54.6431179 C124.65963,69.6953969 118.54506,83.2848174 108.666305,93.2126317 L108.630625,93.2929105 C101.258354,100.611663 91.8523516,105.861006 81.3581257,108.135573 L81.3581257,137.223266 Z M223.375821,117.83147 L223.166204,117.519275 C219.674075,111.636621 214.108077,107.716339 207.953367,106.017104 C201.60688,104.344628 194.756421,105.053758 188.66861,108.528047 L188.70875,108.528047 C182.634319,111.975576 178.571319,117.621853 176.872084,123.946041 C175.199608,130.216708 175.931037,137.142987 179.423166,143.177278 L179.539124,143.337836 C183.040173,149.291848 188.606171,153.28795 194.82332,154.906906 C201.071688,156.65966 208.033646,155.928231 214.032258,152.427182 L214.357833,152.271085 C220.262787,148.743276 224.196449,143.177278 225.842165,137.062708 C227.51464,130.76528 226.85011,123.865762 223.375821,117.83147 Z" fill="currentColor"> </path> </g> </g></svg>
@@ -41,7 +41,19 @@ const copyFiles = async (source, target) => {
41
41
 
42
42
  const ensureAstroCollectionNotEmpty = async (astroDir) => {
43
43
  // TODO: maybe import collections from `src/content/config.ts`...
44
- const COLLECTIONS = ['events', 'commands', 'services', 'users', 'teams', 'domains', 'flows', 'pages', 'changelogs', 'queries'];
44
+ const COLLECTIONS = [
45
+ 'events',
46
+ 'commands',
47
+ 'services',
48
+ 'users',
49
+ 'teams',
50
+ 'domains',
51
+ 'flows',
52
+ 'pages',
53
+ 'changelogs',
54
+ 'queries',
55
+ 'channels',
56
+ ];
45
57
 
46
58
  // Check empty collections
47
59
  const emptyCollections = [];
@@ -0,0 +1,8 @@
1
+ ---
2
+ id: empty
3
+ name: empty
4
+ version: 0.0.1
5
+ hidden: true
6
+ ---
7
+
8
+ <!-- Do not delete this file, required for EC, you an ignore this file -->
@@ -11,6 +11,7 @@ const COLLECTION_KEYS = [
11
11
  'pages',
12
12
  'changelogs',
13
13
  'queries',
14
+ 'channels',
14
15
  ];
15
16
 
16
17
  /**
@@ -1,12 +1,12 @@
1
1
  ---
2
2
  import { getCommands } from '@utils/commands';
3
- import { getDomains } from '@utils/domains/domains';
3
+ import { getDomains } from '@utils/collections/domains';
4
4
  import { getEvents } from '@utils/events';
5
- import { getServices } from '@utils/services/services';
6
- import { getFlows } from '@utils/flows/flows';
5
+ import { getServices } from '@utils/collections/services';
6
+ import { getFlows } from '@utils/collections/flows';
7
7
  import { getTeams } from '@utils/teams';
8
8
  import { getUsers } from '@utils/users';
9
- import config, { type CatalogConfig } from '@eventcatalog';
9
+ import config, { type CatalogConfig } from '@utils/eventcatalog-config/catalog';
10
10
  import { buildUrl } from '@utils/url-builder';
11
11
  import { getQueries } from '@utils/queries';
12
12
 
@@ -1,5 +1,5 @@
1
1
  ---
2
- import catalog from '@eventcatalog';
2
+ import catalog from '@utils/eventcatalog-config/catalog';
3
3
  import Search from '@components/Search.astro';
4
4
  import { buildUrl } from '@utils/url-builder';
5
5
 
@@ -12,9 +12,9 @@ const logo = {
12
12
 
13
13
  <nav
14
14
  id="eventcatalog-header"
15
- class="fixed top-0 left-0 right-0 bg-white border-b border-gray-100 py-3 font-bold text-xl bg-opacity-20 backdrop-blur-sm"
15
+ class="fixed top-0 left-0 right-0 bg-white border-b border-gray-100 py-3 font-bold text-xl bg-opacity-20 backdrop-blur-sm z-10"
16
16
  >
17
- <div class="max-w-[120em] mx-auto px-4 sm:px-4 lg:px-4 xxl:max-w-[96em]">
17
+ <div class="px-4 sm:px-4 lg:px-4">
18
18
  <div class="flex justify-between items-center">
19
19
  <div class="flex-shrink-0 flex items-center w-1/3">
20
20
  <a href={buildUrl(catalog.landingPage || '/')} class="flex space-x-2 items-center">
@@ -12,12 +12,14 @@ interface Props {
12
12
  pills: {
13
13
  label: string;
14
14
  badge?: string;
15
- href: string;
15
+ href?: string;
16
16
  tag?: string;
17
17
  color?: string;
18
18
  collection?: string;
19
+ description?: string;
20
+ icon?: string;
19
21
  }[];
20
- emptyMessage: string;
22
+ emptyMessage?: string;
21
23
  }
22
24
 
23
25
  const PillList = ({ title, pills, emptyMessage, color = 'gray', ...props }: Props) => {
@@ -33,27 +35,32 @@ const PillList = ({ title, pills, emptyMessage, color = 'gray', ...props }: Prop
33
35
  <DisclosurePanel className="mt-2 text-sm/5 text-black/50">
34
36
  <ul role="list" className="space-y-2">
35
37
  {pills.map((item) => {
38
+ const href = item.href ?? '#';
36
39
  const Icon = item.collection ? getIconForCollection(item.collection) : null;
40
+
37
41
  return (
38
42
  <li
39
43
  className=" has-tooltip rounded-md text-gray-600 group px-1 w-full hover:bg-gradient-to-l hover:from-purple-500 hover:to-purple-700 hover:text-white hover:font-normal "
40
44
  key={item.href}
41
45
  >
42
- <a className={`flex items-center space-x-2`} href={item.href}>
43
- {Icon && <Icon className={`h-4 w-4`} />}
44
- <span className="font-light text-sm truncate">
45
- {item.label} ({item.tag})
46
- </span>
47
- {item.label.length > 24 && (
48
- <span className="tooltip rounded relative shadow-lg p-1 font-normal text-xs bg-white text-black ml-[30px] mt-12">
49
- {item.label} ({item.tag})
46
+ <a className={`leading-3`} href={href}>
47
+ <span className="space-x-2 flex items-center">
48
+ {Icon && <Icon className={`h-4 w-4`} />}
49
+ <span className="font-light text-sm truncate">
50
+ {item.label} {item.tag && <>({item.tag})</>}
50
51
  </span>
51
- )}
52
+ {item.label.length > 24 && (
53
+ <span className="tooltip rounded relative shadow-lg p-1 font-normal text-xs bg-white text-black ml-[30px] mt-12">
54
+ {item.label} ({item.tag})
55
+ </span>
56
+ )}
57
+ </span>
58
+ {item.description && <span className="text-[9px] block ml-6 mt-1 leading-0">{item.description}</span>}
52
59
  </a>
53
60
  </li>
54
61
  );
55
62
  })}
56
- {pills.length === 0 && (
63
+ {pills.length === 0 && emptyMessage && (
57
64
  <li className="inline mr-2 leading-tight text-xs">
58
65
  <span className="text-gray-400">{emptyMessage}</span>
59
66
  </li>
@@ -0,0 +1,88 @@
1
+ import { Disclosure, DisclosureButton, DisclosurePanel } from '@headlessui/react';
2
+ import { ChevronDownIcon } from '@heroicons/react/20/solid';
3
+ import * as ProtocolIcons from '@icons/protocols';
4
+
5
+ import './PillListFlat.styles.css';
6
+
7
+ interface Props {
8
+ title: string;
9
+ color: string;
10
+ icon?: any;
11
+ pills: {
12
+ label: string;
13
+ badge?: string;
14
+ href?: string;
15
+ tag?: string;
16
+ color?: string;
17
+ collection?: string;
18
+ description?: string;
19
+ icon?: string;
20
+ }[];
21
+ emptyMessage?: string;
22
+ }
23
+
24
+ const protocolIcons = Object.keys(ProtocolIcons).reduce(
25
+ (icons, key) => {
26
+ const iconKey = key as keyof typeof ProtocolIcons;
27
+ icons[key.toLowerCase()] = ProtocolIcons[iconKey];
28
+ return icons;
29
+ },
30
+ {} as { [key: string]: string }
31
+ );
32
+
33
+ const getIconForProtocol = (icon: keyof typeof protocolIcons) => {
34
+ const Icon = protocolIcons[icon];
35
+ return Icon ? (props: any) => <span {...props} dangerouslySetInnerHTML={{ __html: Icon }} /> : null;
36
+ };
37
+
38
+ const ProtocolList = ({ title, pills, emptyMessage, color = 'gray', ...props }: Props) => {
39
+ return (
40
+ <div>
41
+ <div className="mx-auto w-full max-w-lg divide-y divide-white/5 rounded-xl bg-white/5">
42
+ <Disclosure as="div" className="pb-8" defaultOpen={pills.length <= 10}>
43
+ <DisclosureButton className="group flex w-full items-center justify-start space-x-4">
44
+ <span className="text-sm text-black group-data-[hover]:text-black/80 capitalize"> {title} </span>
45
+ <ChevronDownIcon className="size-5 ml-2 fill-black/60 group-data-[hover]:fill-black/50 group-data-[open]:rotate-180" />
46
+ </DisclosureButton>
47
+ <DisclosurePanel className="mt-2 text-sm/5 text-black/50">
48
+ <ul role="list" className="space-y-2">
49
+ {pills.map((item) => {
50
+ const href = item.href ?? '#';
51
+ const Icon = item.icon ? getIconForProtocol(item.icon) : null;
52
+
53
+ return (
54
+ <li
55
+ className=" has-tooltip rounded-md text-gray-600 group px-1 w-full hover:bg-gradient-to-l hover:from-purple-500 hover:to-purple-700 hover:text-white hover:font-normal "
56
+ key={item.href}
57
+ >
58
+ <a className={`leading-3`} href={href}>
59
+ <span className="space-x-2 flex items-center">
60
+ {Icon && <Icon className={`h-4 w-4`} />}
61
+ <span className="font-light text-sm truncate">
62
+ {item.label} {item.tag && <>({item.tag})</>}
63
+ </span>
64
+ {item.label.length > 24 && (
65
+ <span className="tooltip rounded relative shadow-lg p-1 font-normal text-xs bg-white text-black ml-[30px] mt-12">
66
+ {item.label} ({item.tag})
67
+ </span>
68
+ )}
69
+ </span>
70
+ {item.description && <span className="text-[9px] block ml-6 mt-1 leading-0">{item.description}</span>}
71
+ </a>
72
+ </li>
73
+ );
74
+ })}
75
+ {pills.length === 0 && emptyMessage && (
76
+ <li className="inline mr-2 leading-tight text-xs">
77
+ <span className="text-gray-400">{emptyMessage}</span>
78
+ </li>
79
+ )}
80
+ </ul>
81
+ </DisclosurePanel>
82
+ </Disclosure>
83
+ </div>
84
+ </div>
85
+ );
86
+ };
87
+
88
+ export default ProtocolList;
@@ -0,0 +1,79 @@
1
+ import type { CollectionEntry } from 'astro:content';
2
+ import * as ProtocolIcons from '@icons/protocols';
3
+
4
+ const protocolIcons = Object.keys(ProtocolIcons).reduce(
5
+ (icons, key) => {
6
+ const iconKey = key as keyof typeof ProtocolIcons;
7
+ icons[key.toLowerCase()] = ProtocolIcons[iconKey];
8
+ return icons;
9
+ },
10
+ {} as { [key: string]: string }
11
+ );
12
+
13
+ const getIconForProtocol = (icon: keyof typeof protocolIcons) => {
14
+ const Icon = protocolIcons[icon];
15
+ return Icon ? (props: any) => <span {...props} dangerouslySetInnerHTML={{ __html: Icon }} /> : null;
16
+ };
17
+
18
+ const ChannelParameters = (data: CollectionEntry<'channels'>['data']) => {
19
+ return (
20
+ <div className="container mx-auto py-4 not-prose space-y-4">
21
+ <div>
22
+ <h4 className="text-2xl font-bold">Channel information</h4>
23
+ </div>
24
+
25
+ <div>
26
+ <p className="text-md">
27
+ {data.address && (
28
+ <>
29
+ <span className="font-semibold">Address:</span> <code className="bg-gray-100 p-1 rounded">{data.address}</code>
30
+ </>
31
+ )}
32
+ {data.protocols && data.protocols.length > 0 && (
33
+ <div className="mt-2 flex items-center space-x-1">
34
+ <span className="font-semibold">{data.protocols.length > 1 ? 'Protocols:' : 'Protocol:'}</span>
35
+ <ul className="space-x-2 flex">
36
+ {data.protocols.map((protocol) => {
37
+ const IconComponent = getIconForProtocol(protocol.toLowerCase() as keyof typeof protocolIcons);
38
+ return (
39
+ <li key={protocol} className=" text-sm flex items-center space-x-1 bg-gray-100 rounded-md px-1">
40
+ {IconComponent && <IconComponent className="w-4 h-4" />}
41
+ <span>{protocol}</span>
42
+ </li>
43
+ );
44
+ })}
45
+ </ul>
46
+ </div>
47
+ )}
48
+ </p>
49
+ </div>
50
+
51
+ {data.parameters && Object.keys(data.parameters).length > 0 && (
52
+ <div className="overflow-x-auto">
53
+ <table className="min-w-full bg-white border border-gray-300">
54
+ <thead>
55
+ <tr className="bg-purple-500 text-white">
56
+ <th className="py-2 px-4 border-b text-left">Parameter</th>
57
+ <th className="py-2 px-4 border-b text-left">Options</th>
58
+ <th className="py-2 px-4 border-b text-left">Description</th>
59
+ <th className="py-2 px-4 border-b text-left">Default</th>
60
+ </tr>
61
+ </thead>
62
+ <tbody>
63
+ {Object.entries(data.parameters).map(([param, details]) => (
64
+ <tr className="hover:bg-gray-50" key={param}>
65
+ <td className="py-2 px-4 border-b">{param}</td>
66
+ <td className="py-2 px-4 border-b">{details.default || 'N/A'}</td>
67
+ <td className="py-2 px-4 border-b">{details.enum ? details.enum.join(', ') : 'N/A'}</td>
68
+ <td className="py-2 px-4 border-b">{details.description}</td>
69
+ </tr>
70
+ ))}
71
+ </tbody>
72
+ </table>
73
+ </div>
74
+ )}
75
+ </div>
76
+ );
77
+ };
78
+
79
+ export default ChannelParameters;
@@ -1,9 +1,9 @@
1
1
  ---
2
- import { getFlows } from '@utils/flows/flows';
3
- import { getNodesAndEdges } from '@utils/flows/node-graph';
2
+ import { getFlows } from '@utils/collections/flows';
3
+ import { getNodesAndEdges } from '@utils/node-graphs/flows-node-graph';
4
4
  import Admonition from '@components/MDX/Admonition';
5
5
  import NodeGraph from '../NodeGraph/NodeGraph';
6
- import { getVersionFromCollection } from '@utils/versions/versions';
6
+ import { getVersionFromCollection } from '@utils/collections/versions';
7
7
 
8
8
  const { id, version = 'latest', maxHeight, includeKey = true } = Astro.props;
9
9
 
@@ -47,15 +47,15 @@ function DownloadButton({ filename, addPadding = true }: { filename?: string; ad
47
47
  };
48
48
 
49
49
  return (
50
- <Panel position="top-right" id="download-visual">
50
+ <div id="download-visual">
51
51
  <button
52
52
  className={`hidden md:flex bg-white group download-btn items-center space-x-1 text-[14px] border border-gray-200 px-1 py-0.5 rounded-md hover:bg-gray-100/50 ${addPadding ? 'mt-14' : '-mt-1'}`}
53
53
  onClick={onClick}
54
54
  >
55
55
  <DocumentArrowDownIcon className="w-4 h-4 group-hover:text-primary" />
56
- <span className="group-hover:text-primary">Download visual </span>
56
+ <span className="group-hover:text-primary">Export visual </span>
57
57
  </button>
58
- </Panel>
58
+ </div>
59
59
  );
60
60
  }
61
61
 
@@ -0,0 +1,82 @@
1
+ import { useMemo } from 'react';
2
+ import { BaseEdge, getBezierPath } from 'reactflow';
3
+
4
+ const AnimatedMessageEdge = ({
5
+ id,
6
+ sourceX,
7
+ sourceY,
8
+ targetX,
9
+ targetY,
10
+ sourcePosition,
11
+ targetPosition,
12
+ data,
13
+ label,
14
+ markerEnd,
15
+ }: any) => {
16
+ const [edgePath, labelX, labelY] = getBezierPath({
17
+ sourceX,
18
+ sourceY,
19
+ sourcePosition,
20
+ targetX,
21
+ targetY,
22
+ targetPosition,
23
+ });
24
+
25
+ const collection = data?.message?.collection;
26
+ const opacity = data?.opacity ?? 1;
27
+
28
+ const messageColor = useMemo(
29
+ () => (collection: string) => {
30
+ switch (collection) {
31
+ case 'events':
32
+ return 'orange';
33
+ case 'commands':
34
+ return 'blue';
35
+ case 'queries':
36
+ return 'green';
37
+ default:
38
+ return 'gray';
39
+ }
40
+ },
41
+ []
42
+ );
43
+
44
+ const randomDelay = useMemo(() => Math.random() * 1, []);
45
+
46
+ return (
47
+ <>
48
+ <BaseEdge id={id} path={edgePath} markerEnd={markerEnd} />
49
+ {/* Circle Icon */}
50
+ <g className={`z-30 ${opacity === 1 ? 'opacity-100' : 'opacity-10'}`}>
51
+ <circle cx="0" cy="0" r="7" fill={messageColor(collection)}>
52
+ <animateMotion dur="2s" repeatCount="indefinite" path={edgePath} rotate="auto" begin={`${randomDelay}s`}>
53
+ <mpath href={`#${id}`} />
54
+ </animateMotion>
55
+ </circle>
56
+ </g>
57
+ <g>
58
+ {/* Background rectangle */}
59
+ <rect
60
+ x={labelX - label.length * 3} // Adjust based on text length
61
+ y={labelY - 15} // Position above the text
62
+ width={label.length * 6} // Width based on text length
63
+ height={20} // Fixed height
64
+ fill="white" // Background color
65
+ opacity={0.8} // Opacity
66
+ rx="4" // Rounded corners
67
+ />
68
+
69
+ {/* Text element */}
70
+ <text x={labelX} y={labelY} fill="black" fontSize="10" textAnchor="middle" dy="-2">
71
+ {label}
72
+ </text>
73
+ </g>
74
+ {/* Label */}
75
+ {/* <text x={labelX} y={labelY} fill="black" fontSize="12" textAnchor="middle" dy="-5">
76
+ {label}
77
+ </text> */}
78
+ </>
79
+ );
80
+ };
81
+
82
+ export default AnimatedMessageEdge;
@@ -1,11 +1,13 @@
1
1
  ---
2
2
  import NodeGraphNew from './NodeGraph';
3
- import { getNodesAndEdges as getNodesAndEdgesForService } from '@utils/services/node-graph';
4
- import { getNodesAndEdges as getNodesAndEdgesForEvent } from '@utils/events/node-graph';
5
- import { getNodesAndEdges as getNodesAndEdgesForCommand } from '@utils/commands/node-graph';
6
- import { getNodesAndEdges as getNodesAndEdgesForQueries } from '@utils/queries/node-graph';
7
- import { getNodesAndEdges as getNodesAndEdgesForDomain } from '@utils/domains/node-graph';
8
- import { getNodesAndEdges as getNodesAndEdgesForFlows } from '@utils/flows/node-graph';
3
+ import { getNodesAndEdges as getNodesAndEdgesForService } from '@utils/node-graphs/services-node-graph';
4
+ import {
5
+ getNodesAndEdgesForCommands,
6
+ getNodesAndEdgesForEvents,
7
+ getNodesAndEdgesForQueries,
8
+ } from '@utils/node-graphs/message-node-graph';
9
+ import { getNodesAndEdges as getNodesAndEdgesForDomain } from '@utils/node-graphs/domains-node-graph';
10
+ import { getNodesAndEdges as getNodesAndEdgesForFlows } from '@utils/node-graphs/flows-node-graph';
9
11
 
10
12
  interface Props {
11
13
  id: string;
@@ -24,71 +26,26 @@ interface Props {
24
26
  const { id, collection, title, mode = 'simple', linkTo = 'docs', version, href, linksToVisualiser } = Astro.props;
25
27
  let nodes = [],
26
28
  edges = [];
27
-
28
- if (collection === 'services') {
29
- const { nodes: serviceNodes, edges: serviceEdges } = await getNodesAndEdgesForService({
30
- id: id,
31
- version,
32
- mode,
33
- });
34
-
35
- nodes = serviceNodes;
36
- edges = serviceEdges;
37
- }
38
-
39
- if (collection === 'events') {
40
- const { nodes: eventNodes, edges: eventEdges } = await getNodesAndEdgesForEvent({
41
- id: id,
42
- version,
43
- mode,
44
- });
45
-
46
- nodes = eventNodes;
47
- edges = eventEdges;
48
- }
49
-
50
- if (collection === 'commands') {
51
- const { nodes: eventNodes, edges: eventEdges } = await getNodesAndEdgesForCommand({
52
- id: id,
53
- version,
54
- mode,
55
- });
56
-
57
- nodes = eventNodes;
58
- edges = eventEdges;
59
- }
60
-
61
- if (collection === 'queries') {
62
- const { nodes: eventNodes, edges: eventEdges } = await getNodesAndEdgesForQueries({
63
- id: id,
64
- version,
65
- mode,
66
- });
67
-
68
- nodes = eventNodes;
69
- edges = eventEdges;
70
- }
71
-
72
- if (collection === 'domains') {
73
- const { nodes: eventNodes, edges: eventEdges } = await getNodesAndEdgesForDomain({
74
- id: id,
75
- version,
76
- mode,
77
- });
78
-
79
- nodes = eventNodes;
80
- edges = eventEdges;
81
- }
82
-
83
- if (collection === 'flows') {
84
- const { nodes: eventNodes, edges: eventEdges } = await getNodesAndEdgesForFlows({
85
- id: id,
29
+ const getNodesAndEdgesFunctions = {
30
+ services: getNodesAndEdgesForService,
31
+ events: getNodesAndEdgesForEvents,
32
+ commands: getNodesAndEdgesForCommands,
33
+ queries: getNodesAndEdgesForQueries,
34
+ domains: getNodesAndEdgesForDomain,
35
+ flows: getNodesAndEdgesForFlows,
36
+ };
37
+
38
+ if (collection in getNodesAndEdgesFunctions) {
39
+ const { nodes: fetchedNodes, edges: fetchedEdges } = await getNodesAndEdgesFunctions[
40
+ collection as keyof typeof getNodesAndEdgesFunctions
41
+ ]({
42
+ id,
86
43
  version,
87
44
  mode,
88
45
  });
89
46
 
90
- nodes = eventNodes;
91
- edges = eventEdges;
47
+ nodes = fetchedNodes;
48
+ edges = fetchedEdges;
92
49
  }
93
50
  ---
94
51