@eventcatalog/core 2.65.0 → 3.0.0-beta.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 (130) hide show
  1. package/README.md +1 -26
  2. package/dist/analytics/analytics.cjs +1 -1
  3. package/dist/analytics/analytics.js +2 -2
  4. package/dist/analytics/log-build.cjs +1 -1
  5. package/dist/analytics/log-build.js +3 -3
  6. package/dist/{chunk-NK6OYMRD.js → chunk-JB4YT5JY.js} +1 -1
  7. package/dist/{chunk-BMDTX5IN.js → chunk-TQ4HZREX.js} +1 -1
  8. package/dist/{chunk-IJRFYF4B.js → chunk-X4W4YC3U.js} +1 -1
  9. package/dist/constants.cjs +1 -1
  10. package/dist/constants.js +1 -1
  11. package/dist/eventcatalog.cjs +1 -21
  12. package/dist/eventcatalog.config.d.cts +10 -0
  13. package/dist/eventcatalog.config.d.ts +10 -0
  14. package/dist/eventcatalog.js +3 -20
  15. package/eventcatalog/src/components/CopyAsMarkdown.tsx +19 -1
  16. package/eventcatalog/src/components/FavoriteButton.tsx +54 -0
  17. package/eventcatalog/src/components/Grids/DomainGrid.tsx +386 -362
  18. package/eventcatalog/src/components/Grids/MessageGrid.tsx +166 -518
  19. package/eventcatalog/src/components/Header.astro +48 -23
  20. package/eventcatalog/src/components/Lists/VersionList.astro +2 -2
  21. package/eventcatalog/src/components/MDX/Design/Design.astro +4 -1
  22. package/eventcatalog/src/components/MDX/Flow/Flow.astro +2 -1
  23. package/eventcatalog/src/components/MDX/NodeGraph/NodeGraph.astro +3 -3
  24. package/eventcatalog/src/components/SchemaExplorer/SchemaDetailsPanel.tsx +8 -2
  25. package/eventcatalog/src/components/SchemaExplorer/SchemaPageViewer.tsx +37 -0
  26. package/eventcatalog/src/components/Search/Search.astro +48 -28
  27. package/eventcatalog/src/components/Search/SearchModal.tsx +393 -702
  28. package/eventcatalog/src/components/SideNav/NestedSideBar/SearchBar.tsx +298 -0
  29. package/eventcatalog/src/components/SideNav/NestedSideBar/builders/container.ts +66 -0
  30. package/eventcatalog/src/components/SideNav/NestedSideBar/builders/domain.ts +101 -0
  31. package/eventcatalog/src/components/SideNav/NestedSideBar/builders/flow.ts +29 -0
  32. package/eventcatalog/src/components/SideNav/NestedSideBar/builders/message.ts +84 -0
  33. package/eventcatalog/src/components/SideNav/NestedSideBar/builders/service.ts +147 -0
  34. package/eventcatalog/src/components/SideNav/NestedSideBar/builders/shared.ts +146 -0
  35. package/eventcatalog/src/components/SideNav/NestedSideBar/index.tsx +1073 -0
  36. package/eventcatalog/src/components/SideNav/NestedSideBar/sidebar-builder.ts +365 -0
  37. package/eventcatalog/src/components/SideNav/NestedSideBar/storage.ts +90 -0
  38. package/eventcatalog/src/components/SideNav/SideNav.astro +18 -28
  39. package/eventcatalog/src/content.config.ts +2 -0
  40. package/eventcatalog/src/enterprise/custom-documentation/pages/docs/custom/index.astro +10 -4
  41. package/eventcatalog/src/enterprise/eventcatalog-chat/pages/chat/index.astro +3 -3
  42. package/eventcatalog/src/layouts/DirectoryLayout.astro +2 -2
  43. package/eventcatalog/src/layouts/DiscoverLayout.astro +3 -3
  44. package/eventcatalog/src/layouts/VerticalSideBarLayout.astro +85 -63
  45. package/eventcatalog/src/layouts/VisualiserLayout.astro +3 -3
  46. package/eventcatalog/src/pages/_index.astro +530 -110
  47. package/eventcatalog/src/pages/architecture/[type]/[id]/[version]/_index.data.ts +64 -0
  48. package/eventcatalog/src/pages/architecture/[type]/[id]/[version]/index.astro +29 -0
  49. package/eventcatalog/src/pages/directory/[type]/_index.data.ts +4 -4
  50. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/_index.data.ts +1 -4
  51. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/changelog/_index.data.ts +3 -3
  52. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/changelog/index.astro +1 -5
  53. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/index.astro +362 -190
  54. package/eventcatalog/src/pages/docs/[type]/[id]/[version].md.ts +1 -1
  55. package/eventcatalog/src/pages/docs/[type]/[id]/index.astro +4 -4
  56. package/eventcatalog/src/pages/docs/[type]/[id]/language/_index.data.ts +1 -4
  57. package/eventcatalog/src/pages/docs/[type]/[id]/language/index.astro +3 -27
  58. package/eventcatalog/src/pages/docs/teams/[id]/_index.data.ts +2 -2
  59. package/eventcatalog/src/pages/docs/users/[id]/_index.data.ts +2 -2
  60. package/eventcatalog/src/pages/index.astro +14 -5
  61. package/eventcatalog/src/pages/nav-index.json.ts +30 -0
  62. package/eventcatalog/src/pages/schemas/[type]/[id]/[version]/_index.data.ts +77 -0
  63. package/eventcatalog/src/pages/schemas/[type]/[id]/[version]/index.astro +90 -0
  64. package/eventcatalog/src/pages/schemas/{index.astro → explorer/index.astro} +3 -3
  65. package/eventcatalog/src/pages/studio.astro +3 -3
  66. package/eventcatalog/src/pages/visualiser/[type]/[id]/[version]/_index.data.ts +4 -3
  67. package/eventcatalog/src/pages/visualiser/[type]/[id]/index.astro +2 -2
  68. package/eventcatalog/src/pages/visualiser/domains/[id]/[version]/entity-map/_index.data.ts +4 -3
  69. package/eventcatalog/src/stores/favorites-store.ts +83 -0
  70. package/eventcatalog/src/stores/sidebar-store.ts +8 -0
  71. package/eventcatalog/src/utils/collections/changelogs.ts +7 -4
  72. package/eventcatalog/src/utils/{channels.ts → collections/channels.ts} +81 -31
  73. package/eventcatalog/src/utils/collections/commands.ts +134 -0
  74. package/eventcatalog/src/utils/collections/containers.ts +44 -33
  75. package/eventcatalog/src/utils/collections/domains.ts +204 -62
  76. package/eventcatalog/src/utils/{entities.ts → collections/entities.ts} +44 -24
  77. package/eventcatalog/src/utils/collections/events.ts +136 -0
  78. package/eventcatalog/src/utils/collections/flows.ts +59 -25
  79. package/eventcatalog/src/utils/{messages.ts → collections/messages.ts} +13 -4
  80. package/eventcatalog/src/utils/{queries.ts → collections/queries.ts} +49 -28
  81. package/eventcatalog/src/utils/collections/services.ts +100 -68
  82. package/eventcatalog/src/utils/collections/teams.ts +94 -0
  83. package/eventcatalog/src/utils/collections/users.ts +122 -0
  84. package/eventcatalog/src/utils/collections/util.ts +57 -1
  85. package/eventcatalog/src/utils/feature.ts +3 -1
  86. package/eventcatalog/src/utils/{collections/file-diffs.ts → file-diffs.ts} +1 -1
  87. package/eventcatalog/src/utils/node-graphs/container-node-graph.ts +2 -0
  88. package/eventcatalog/src/utils/node-graphs/domain-entity-map.ts +16 -6
  89. package/eventcatalog/src/utils/node-graphs/domains-canvas.ts +14 -10
  90. package/eventcatalog/src/utils/node-graphs/domains-node-graph.ts +36 -64
  91. package/eventcatalog/src/utils/node-graphs/flows-node-graph.ts +23 -19
  92. package/eventcatalog/src/utils/node-graphs/message-node-graph.ts +36 -49
  93. package/eventcatalog/src/utils/node-graphs/services-node-graph.ts +22 -18
  94. package/eventcatalog/src/utils/page-loaders/page-data-loader.ts +4 -4
  95. package/eventcatalog/tailwind.config.mjs +14 -0
  96. package/eventcatalog/tsconfig.json +2 -1
  97. package/package.json +7 -4
  98. package/eventcatalog/public/logo_old.png +0 -0
  99. package/eventcatalog/src/components/DiscoverInsight.astro +0 -61
  100. package/eventcatalog/src/components/Grids/ServiceGrid.tsx +0 -534
  101. package/eventcatalog/src/components/Lists/CustomSideBarSectionList.astro +0 -55
  102. package/eventcatalog/src/components/Lists/ProtocolList.tsx +0 -74
  103. package/eventcatalog/src/components/Lists/RepositoryList.astro +0 -37
  104. package/eventcatalog/src/components/Lists/SpecificationsList.astro +0 -67
  105. package/eventcatalog/src/components/SideBars/ChannelSideBar.astro +0 -204
  106. package/eventcatalog/src/components/SideBars/ContainerSideBar.astro +0 -180
  107. package/eventcatalog/src/components/SideBars/DomainSideBar.astro +0 -273
  108. package/eventcatalog/src/components/SideBars/EntitySideBar.astro +0 -139
  109. package/eventcatalog/src/components/SideBars/FlowSideBar.astro +0 -128
  110. package/eventcatalog/src/components/SideBars/MessageSideBar.astro +0 -248
  111. package/eventcatalog/src/components/SideBars/ServiceSideBar.astro +0 -294
  112. package/eventcatalog/src/components/SideNav/ListViewSideBar/components/CollapsibleGroup.tsx +0 -46
  113. package/eventcatalog/src/components/SideNav/ListViewSideBar/components/MessageList.tsx +0 -78
  114. package/eventcatalog/src/components/SideNav/ListViewSideBar/components/SpecificationList.tsx +0 -83
  115. package/eventcatalog/src/components/SideNav/ListViewSideBar/index.tsx +0 -1250
  116. package/eventcatalog/src/components/SideNav/ListViewSideBar/types.ts +0 -91
  117. package/eventcatalog/src/components/SideNav/ListViewSideBar/utils.ts +0 -201
  118. package/eventcatalog/src/components/SideNav/TreeView/getTreeView.ts +0 -190
  119. package/eventcatalog/src/components/SideNav/TreeView/index.tsx +0 -94
  120. package/eventcatalog/src/components/TreeView/index.tsx +0 -328
  121. package/eventcatalog/src/components/TreeView/styles.module.css +0 -264
  122. package/eventcatalog/src/components/TreeView/useSlots.ts +0 -95
  123. package/eventcatalog/src/pages/architecture/[type]/index.astro +0 -14
  124. package/eventcatalog/src/pages/architecture/architecture.astro +0 -101
  125. package/eventcatalog/src/pages/architecture/docs/[type]/index.astro +0 -14
  126. package/eventcatalog/src/utils/commands.ts +0 -112
  127. package/eventcatalog/src/utils/events.ts +0 -108
  128. package/eventcatalog/src/utils/generators/index.ts +0 -10
  129. package/eventcatalog/src/utils/teams.ts +0 -72
  130. package/eventcatalog/src/utils/users.ts +0 -72
@@ -1,37 +0,0 @@
1
- ---
2
- import { ScrollText, Workflow, FileDownIcon, Code, Link } from 'lucide-react';
3
-
4
- interface Props {
5
- repository?: string;
6
- language?: string;
7
- }
8
-
9
- const { repository, language } = Astro.props;
10
- ---
11
-
12
- <div class="mx-auto pb-4 w-full max-w-lg divide-y divide-white/5 rounded-xl bg-white/5 border-b border-gray-100 mb-4">
13
- <span class="text-sm text-black font-semibold group-data-[hover]:text-black/80 capitalize">Repository </span>
14
- <ul role="list" class="space-y-2 mt-2">
15
- {
16
- repository && (
17
- <li class="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 ">
18
- <a class={`flex items-center space-x-2`} target="_blank" href={repository}>
19
- <Link className="h-4 w-4 text-gray-800 group-hover:text-white" strokeWidth={1} />
20
- <span class="font-light text-sm truncate">{repository}</span>
21
- </a>
22
- </li>
23
- )
24
- }
25
- {
26
- language && (
27
- <li class=" rounded-md text-gray-600 group px-1 w-full ">
28
- <div class={`flex items-center space-x-2`}>
29
- <Code className="h-3 w-3 text-gray-800 " strokeWidth={1} />
30
- <span class="font-light text-sm truncate">{language}</span>
31
- </div>
32
- </li>
33
- )
34
- }
35
- </ul>
36
- <!-- <div class='border-b border-gray-100'></div> -->
37
- </div>
@@ -1,67 +0,0 @@
1
- ---
2
- import type { CollectionTypes } from '@types';
3
- import { buildUrl } from '@utils/url-builder';
4
- import type { CollectionEntry } from 'astro:content';
5
- import { getSpecificationsForService } from '@utils/collections/services';
6
- import type { Service } from '@utils/collections/services';
7
- interface Props {
8
- collectionItem: CollectionEntry<CollectionTypes>;
9
- }
10
-
11
- const { collectionItem } = Astro.props;
12
-
13
- const specVersions = collectionItem.data.specifications || {};
14
- const numberOfSpecifications = Object.keys(specVersions).length;
15
-
16
- const specs = getSpecificationsForService(collectionItem as Service);
17
-
18
- const openAPISpecifications = specs.filter((spec) => spec.type === 'openapi');
19
- const asyncAPISpecifications = specs.filter((spec) => spec.type === 'asyncapi');
20
- const graphQLSpecifications = specs.filter((spec) => spec.type === 'graphql');
21
- ---
22
-
23
- <div class="space-y-2 mb-8">
24
- <span class="text-sm text-black group-data-[hover]:text-black/80 capitalize">Specifications ({numberOfSpecifications})</span>
25
- {
26
- openAPISpecifications.length > 0 &&
27
- openAPISpecifications.map((spec) => (
28
- <a
29
- href={buildUrl(
30
- `/docs/${collectionItem.collection}/${collectionItem.data.id}/${collectionItem.data.version}/spec/${spec.filenameWithoutExtension}`
31
- )}
32
- class="px-1 text-sm font-light flex items-center space-x-1 hover:underline hover:text-primary rounded-md hover:bg-gradient-to-l hover:from-purple-500 hover:to-purple-700 hover:text-white"
33
- >
34
- <img src={buildUrl('/icons/openapi.svg', true)} class="h-4 w-4" />
35
- <span>{spec.name}</span>
36
- </a>
37
- ))
38
- }
39
- {
40
- asyncAPISpecifications.length > 0 &&
41
- asyncAPISpecifications.map((spec) => (
42
- <a
43
- href={buildUrl(
44
- `/docs/${collectionItem.collection}/${collectionItem.data.id}/${collectionItem.data.version}/asyncapi/${spec.filenameWithoutExtension}`
45
- )}
46
- class="px-1 text-sm font-light flex items-center space-x-1 hover:underline rounded-md hover:bg-gradient-to-l hover:from-purple-500 hover:to-purple-700 hover:text-white"
47
- >
48
- <img src={buildUrl('/icons/asyncapi.svg', true)} class="h-4 w-4" />
49
- <span>{spec.name}</span>
50
- </a>
51
- ))
52
- }
53
- {
54
- graphQLSpecifications.length > 0 &&
55
- graphQLSpecifications.map((spec) => (
56
- <a
57
- href={buildUrl(
58
- `/docs/${collectionItem.collection}/${collectionItem.data.id}/${collectionItem.data.version}/graphql/${spec.filenameWithoutExtension}`
59
- )}
60
- class="px-1 text-sm font-light flex items-center space-x-1 hover:underline rounded-md hover:bg-gradient-to-l hover:from-purple-500 hover:to-purple-700 hover:text-white"
61
- >
62
- <img src={buildUrl('/icons/graphql.svg', true)} class="h-4 w-4" />
63
- <span>{spec.name}</span>
64
- </a>
65
- ))
66
- }
67
- </div>
@@ -1,204 +0,0 @@
1
- ---
2
- import type { CollectionEntry } from 'astro:content';
3
- import PillListFlat from '@components/Lists/PillListFlat';
4
- import ProtocolList from '@components/Lists/ProtocolList';
5
- import OwnersList from '@components/Lists/OwnersList';
6
- import VersionList from '@components/Lists/VersionList.astro';
7
- import { buildUrl } from '@utils/url-builder';
8
- import { ScrollText } from 'lucide-react';
9
- import RepositoryList from '@components/Lists/RepositoryList.astro';
10
- import { getOwner } from '@utils/collections/owners';
11
- import { getProducersAndConsumersForChannel } from '@utils/collections/services';
12
- import { isChangelogEnabled } from '@utils/feature';
13
- interface Props {
14
- channel: CollectionEntry<'channels'>;
15
- }
16
-
17
- const { channel } = Astro.props;
18
-
19
- const ownersRaw = channel.data?.owners || [];
20
- const owners = await Promise.all<ReturnType<typeof getOwner>>(ownersRaw.map(getOwner));
21
- const filteredOwners = owners.filter((o) => o !== undefined);
22
- const { producers, consumers } = await getProducersAndConsumersForChannel(channel);
23
-
24
- const channelParameters: Record<string, { enum?: string[]; description?: string }> = channel.data.parameters || {};
25
- const parameters = Object.keys(channelParameters).map((key) => ({
26
- key,
27
- ...channelParameters[key],
28
- }));
29
-
30
- const attachments = channel.data.attachments || [];
31
-
32
- const attachmentsList = attachments.map((a) => {
33
- const attachmentIsURL = typeof a === 'string';
34
- return {
35
- label: attachmentIsURL ? a : (a.title ?? a.url),
36
- href: attachmentIsURL ? a : a.url,
37
- icon: attachmentIsURL ? 'ExternalLinkIcon' : (a.icon ?? 'ExternalLinkIcon'),
38
- target: '_blank' as const,
39
- subgroup: attachmentIsURL ? undefined : (a.type ?? ''),
40
- };
41
- });
42
-
43
- const paramsList = parameters.map((param) => ({
44
- label: param.key,
45
- description: param?.description,
46
- collection: 'channels-parameter',
47
- }));
48
-
49
- const protocols = channel.data.protocols || [];
50
- const protocolList = protocols.map((p) => ({
51
- label: p,
52
- collection: 'channels-protocol',
53
- // icon: p,
54
- icon: p,
55
- }));
56
-
57
- const ownersList = filteredOwners.map((o) => ({
58
- label: o.data.name,
59
- type: o.collection,
60
- badge: o.collection === 'users' ? o.data.role : 'Team',
61
- avatarUrl: o.collection === 'users' ? o.data.avatarUrl : '',
62
- href: buildUrl(`/docs/${o.collection}/${o.data.id}`),
63
- }));
64
-
65
- const messageList = (channel.data.messages ?? []).map((p) => ({
66
- label: p.name,
67
- badge: p.collection,
68
- color: p.collection === 'events' ? 'orange' : 'blue',
69
- collection: p.collection,
70
- tag: `v${p.version}`,
71
- href: buildUrl(`/docs/${p.collection}/${p.id}/${p.version}`),
72
- }));
73
-
74
- const producersList = producers.map((p) => ({
75
- label: p.data.name,
76
- badge: p.collection,
77
- color: 'pink',
78
- collection: p.collection,
79
- tag: `v${p.data.version}`,
80
- href: buildUrl(`/docs/${p.collection}/${p.data.id}/${p.data.version}`),
81
- }));
82
-
83
- const consumersList = consumers.map((c) => ({
84
- label: c.data.name,
85
- badge: c.collection,
86
- color: 'blue',
87
- collection: c.collection,
88
- tag: `v${c.data.version}`,
89
- href: buildUrl(`/docs/${c.collection}/${c.data.id}/${c.data.version}`),
90
- }));
91
-
92
- const shouldRenderSideBarSection = (section: string) => {
93
- if (!channel.data.detailsPanel) {
94
- return true;
95
- }
96
- // @ts-ignore
97
- return channel.data.detailsPanel[section]?.visible ?? true;
98
- };
99
- ---
100
-
101
- <aside class="sticky top-28 left-0 space-y-8 h-full overflow-y-auto py-4">
102
- <div class="">
103
- {
104
- producersList.length > 0 && shouldRenderSideBarSection('producers') && (
105
- <PillListFlat
106
- title={`Producers (${producersList.length})`}
107
- pills={producersList}
108
- emptyMessage={`This channel does not have any producers.`}
109
- color="pink"
110
- client:load
111
- />
112
- )
113
- }
114
-
115
- {
116
- consumersList.length > 0 && shouldRenderSideBarSection('consumers') && (
117
- <PillListFlat
118
- title={`Consumers (${consumersList.length})`}
119
- pills={consumersList}
120
- emptyMessage={`This channel does not have any consumers.`}
121
- color="blue"
122
- client:load
123
- />
124
- )
125
- }
126
-
127
- {
128
- messageList.length > 0 && shouldRenderSideBarSection('messages') && (
129
- <PillListFlat
130
- title={`Messages using channel (${messageList.length})`}
131
- pills={messageList}
132
- emptyMessage={`This channel does not have any messages.`}
133
- color="orange"
134
- client:load
135
- />
136
- )
137
- }
138
-
139
- {
140
- protocolList.length > 0 && shouldRenderSideBarSection('protocols') && (
141
- <ProtocolList color="pink" title={`Protocols (${protocolList.length})`} pills={protocolList} client:load />
142
- )
143
- }
144
-
145
- {
146
- channel.data.versions && shouldRenderSideBarSection('versions') && (
147
- <VersionList
148
- title={`Versions (${channel.data.versions?.length})`}
149
- versions={channel.data.versions}
150
- collectionItem={channel}
151
- />
152
- )
153
- }
154
-
155
- {
156
- channel.data.attachments && shouldRenderSideBarSection('attachments') && (
157
- <PillListFlat
158
- title={`Attachments (${attachmentsList.length})`}
159
- pills={attachmentsList}
160
- emptyMessage={`This channel does not have any attachments.`}
161
- color="pink"
162
- client:load
163
- />
164
- )
165
- }
166
-
167
- {
168
- ownersList.length > 0 && shouldRenderSideBarSection('owners') && (
169
- <OwnersList
170
- title={`Owners (${filteredOwners.length})`}
171
- owners={ownersList}
172
- emptyMessage={`This channel does not have any documented owners.`}
173
- client:load
174
- />
175
- )
176
- }
177
-
178
- {
179
- channel.data.repository && shouldRenderSideBarSection('repository') && (
180
- <RepositoryList repository={channel.data.repository?.url} language={channel.data.repository?.language} />
181
- )
182
- }
183
-
184
- {
185
- paramsList.length > 0 && shouldRenderSideBarSection('parameters') && (
186
- <PillListFlat color="pink" title={`Parameters (${paramsList.length})`} pills={paramsList} client:load />
187
- )
188
- }
189
-
190
- {
191
- isChangelogEnabled() && shouldRenderSideBarSection('changelog') && (
192
- <div class="space-y-2">
193
- <a
194
- href={buildUrl(`/docs/${channel.collection}/${channel.data.id}/${channel.data.latestVersion}/changelog`)}
195
- class="flex items-center space-x-2 justify-center text-center rounded-md w-full bg-white px-3.5 py-2.5 text-sm font-semibold text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 hover:bg-gray-100/60 hover:text-primary"
196
- >
197
- <ScrollText strokeWidth={2} size={16} />
198
- <span class="block">Read changelog</span>
199
- </a>
200
- </div>
201
- )
202
- }
203
- </div>
204
- </aside>
@@ -1,180 +0,0 @@
1
- ---
2
- import type { CollectionEntry } from 'astro:content';
3
- import PillListFlat from '@components/Lists/PillListFlat';
4
- import OwnersList from '@components/Lists/OwnersList';
5
- import VersionList from '@components/Lists/VersionList.astro';
6
- import { buildUrl } from '@utils/url-builder';
7
- import { ScrollText, Workflow, RssIcon } from 'lucide-react';
8
- import RepositoryList from '@components/Lists/RepositoryList.astro';
9
- import { getOwner } from '@utils/collections/owners';
10
- import CustomSideBarSectionList from '@components/Lists/CustomSideBarSectionList.astro';
11
- import { isChangelogEnabled } from '@utils/feature';
12
- import config from '@config';
13
-
14
- interface Props {
15
- container: CollectionEntry<'containers'>;
16
- }
17
-
18
- const { container } = Astro.props;
19
-
20
- const servicesThatWriteToContainer = (container.data.servicesThatWriteToContainer as CollectionEntry<'services'>[]) || [];
21
- const servicesThatReadFromContainer = (container.data.servicesThatReadFromContainer as CollectionEntry<'services'>[]) || [];
22
- const ownersRaw = container.data?.owners || [];
23
-
24
- const owners = await Promise.all<ReturnType<typeof getOwner>>(ownersRaw.map(getOwner));
25
- const filteredOwners = owners.filter((o) => o !== undefined);
26
- const resourceGroups = container.data?.resourceGroups || [];
27
- const attachments = container.data.attachments || [];
28
-
29
- const attachmentsList = attachments.map((a) => {
30
- const attachmentIsURL = typeof a === 'string';
31
- return {
32
- label: attachmentIsURL ? a : (a.title ?? a.url),
33
- href: attachmentIsURL ? a : a.url,
34
- icon: attachmentIsURL ? 'ExternalLinkIcon' : (a.icon ?? 'ExternalLinkIcon'),
35
- target: '_blank' as const,
36
- subgroup: attachmentIsURL ? undefined : (a.type ?? ''),
37
- };
38
- });
39
-
40
- const writesToList = servicesThatWriteToContainer?.map((p) => ({
41
- label: p.data.name,
42
- tag: `v${p.data.version}`,
43
- collection: p.collection,
44
- href: buildUrl(`/docs/services/${p.data.id}/${p.data.version}`),
45
- }));
46
-
47
- const readsFromList = servicesThatReadFromContainer?.map((p) => ({
48
- label: p.data.name,
49
- tag: `v${p.data.version}`,
50
- collection: p.collection,
51
- href: buildUrl(`/docs/services/${p.data.id}/${p.data.version}`),
52
- }));
53
-
54
- const ownersList = filteredOwners.map((o) => ({
55
- label: o.data.name,
56
- type: o.collection,
57
- badge: o.collection === 'users' ? o.data.role : 'Team',
58
- avatarUrl: o.collection === 'users' ? o.data.avatarUrl : '',
59
- href: buildUrl(`/docs/${o.collection}/${o.data.id}`),
60
- }));
61
-
62
- const shouldRenderSideBarSection = (section: string) => {
63
- if (!container.data.detailsPanel) {
64
- return true;
65
- }
66
- // @ts-ignore
67
- return container.data.detailsPanel[section]?.visible ?? true;
68
- };
69
-
70
- const isRSSEnabled = config.rss?.enabled;
71
- ---
72
-
73
- <aside class="sticky top-28 left-0 space-y-8 h-full overflow-y-auto py-4">
74
- <div class="">
75
- {
76
- resourceGroups
77
- .filter((section) => section.items.length > 0 && section.sidebar)
78
- .map((section) => <CustomSideBarSectionList section={section} />)
79
- }
80
- {
81
- writesToList.length > 0 && shouldRenderSideBarSection('services') && (
82
- <PillListFlat
83
- color="pink"
84
- title={`Services (writes) (${writesToList.length})`}
85
- pills={writesToList}
86
- emptyMessage={'No services are using this resource.'}
87
- client:load
88
- />
89
- )
90
- }
91
- {
92
- readsFromList.length > 0 && shouldRenderSideBarSection('services') && (
93
- <PillListFlat
94
- color="pink"
95
- title={`Services (reads) (${readsFromList.length})`}
96
- pills={readsFromList}
97
- emptyMessage={'No services are using this resource.'}
98
- client:load
99
- />
100
- )
101
- }
102
-
103
- {
104
- container.data.versions && shouldRenderSideBarSection('versions') && (
105
- <VersionList
106
- title={`Versions (${container.data.versions?.length})`}
107
- versions={container.data.versions}
108
- collectionItem={container}
109
- />
110
- )
111
- }
112
-
113
- {
114
- container.data.attachments && shouldRenderSideBarSection('attachments') && (
115
- <PillListFlat
116
- title={`Attachments (${attachmentsList.length})`}
117
- pills={attachmentsList}
118
- emptyMessage={`This resource does not have any attachments.`}
119
- color="pink"
120
- client:load
121
- />
122
- )
123
- }
124
-
125
- {
126
- ownersList.length > 0 && shouldRenderSideBarSection('owners') && (
127
- <OwnersList
128
- title={`Owners (${ownersList.length})`}
129
- owners={ownersList}
130
- emptyMessage={`This resource does not have any documented owners.`}
131
- client:load
132
- />
133
- )
134
- }
135
-
136
- {
137
- container.data.repository && shouldRenderSideBarSection('repository') && (
138
- <RepositoryList repository={container.data.repository?.url} language={container.data.repository?.language} />
139
- )
140
- }
141
-
142
- {
143
- isRSSEnabled && (
144
- <div class="mx-auto pb-8 w-full max-w-lg divide-y divide-white/5 rounded-xl bg-white/5">
145
- <span class="text-sm text-black font-semibold group-data-[hover]:text-black/80 capitalize">Container RSS Feed</span>
146
- <ul role="list" class="space-y-2 mt-2">
147
- <li class="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 ">
148
- <a class={`flex items-center space-x-2`} target="_blank" href={buildUrl(`/rss/${container.collection}/rss.xml`)}>
149
- <RssIcon className="h-4 w-4 text-gray-800 group-hover:text-white" strokeWidth={1} />
150
- <span class="font-light text-sm truncate">RSS Feed</span>
151
- </a>
152
- </li>
153
- </ul>
154
- </div>
155
- )
156
- }
157
-
158
- <div class="space-y-2">
159
- <a
160
- href={buildUrl(`/visualiser/${container.collection}/${container.data.id}/${container.data.version}`)}
161
- class="flex items-center justify-center space-x-2 text-center rounded-md w-full bg-white px-3.5 py-2.5 text-sm font-semibold text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 hover:bg-gray-100/60 hover:text-primary"
162
- >
163
- <Workflow strokeWidth={2} size={16} />
164
- <span class="block">View in visualiser</span>
165
- </a>
166
-
167
- {
168
- isChangelogEnabled() && shouldRenderSideBarSection('changelog') && (
169
- <a
170
- href={buildUrl(`/docs/${container.collection}/${container.data.id}/${container.data.latestVersion}/changelog`)}
171
- class="flex items-center space-x-2 justify-center text-center rounded-md w-full bg-white px-3.5 py-2.5 text-sm font-semibold text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 hover:bg-gray-100/60 hover:text-primary"
172
- >
173
- <ScrollText strokeWidth={2} size={16} />
174
- <span class="block">Read changelog</span>
175
- </a>
176
- )
177
- }
178
- </div>
179
- </div>
180
- </aside>