@eventcatalog/core 3.2.1 → 3.3.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 (49) hide show
  1. package/dist/analytics/analytics.cjs +1 -1
  2. package/dist/analytics/analytics.js +2 -2
  3. package/dist/analytics/log-build.cjs +1 -1
  4. package/dist/analytics/log-build.js +3 -3
  5. package/dist/{chunk-VBEYXPR5.js → chunk-I4CMEOEN.js} +1 -1
  6. package/dist/{chunk-SYOF3QEG.js → chunk-NGKYYZZP.js} +1 -1
  7. package/dist/{chunk-SFQ3BU4M.js → chunk-OAUYXPXT.js} +1 -1
  8. package/dist/{chunk-7PHTRC72.js → chunk-QZF5ZYJB.js} +1 -1
  9. package/dist/{chunk-LWUJQOCC.js → chunk-UPSN5H7S.js} +1 -1
  10. package/dist/constants.cjs +1 -1
  11. package/dist/constants.js +1 -1
  12. package/dist/eventcatalog.cjs +1 -1
  13. package/dist/eventcatalog.js +5 -5
  14. package/dist/generate.cjs +1 -1
  15. package/dist/generate.js +3 -3
  16. package/dist/utils/cli-logger.cjs +1 -1
  17. package/dist/utils/cli-logger.js +2 -2
  18. package/eventcatalog/src/components/ChatPanel/ChatPanel.tsx +9 -0
  19. package/eventcatalog/src/components/ChatPanel/ChatPanelButton.tsx +11 -1
  20. package/eventcatalog/src/components/CopyAsMarkdown.tsx +47 -28
  21. package/eventcatalog/src/content.config.ts +18 -0
  22. package/eventcatalog/src/enterprise/ai/chat-api.ts +24 -2
  23. package/eventcatalog/src/pages/diagrams/[id]/[version]/_index.data.ts +57 -0
  24. package/eventcatalog/src/pages/diagrams/[id]/[version]/embed.astro +267 -0
  25. package/eventcatalog/src/pages/diagrams/[id]/[version]/index.astro +411 -0
  26. package/eventcatalog/src/pages/diagrams/[id]/[version].mdx.ts +47 -0
  27. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/changelog/index.astro +28 -33
  28. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/index.astro +1 -0
  29. package/eventcatalog/src/pages/docs/[type]/[id]/[version].md.ts +3 -2
  30. package/eventcatalog/src/pages/docs/[type]/[id]/[version].mdx.ts +5 -1
  31. package/eventcatalog/src/pages/docs/[type]/[id]/language.mdx.ts +2 -1
  32. package/eventcatalog/src/pages/docs/custom/[...path].mdx.ts +2 -2
  33. package/eventcatalog/src/pages/docs/teams/[id].md.ts +3 -2
  34. package/eventcatalog/src/pages/docs/teams/[id].mdx.ts +3 -3
  35. package/eventcatalog/src/pages/docs/users/[id].md.ts +3 -2
  36. package/eventcatalog/src/pages/docs/users/[id].mdx.ts +3 -3
  37. package/eventcatalog/src/stores/sidebar-store/builders/container.ts +20 -4
  38. package/eventcatalog/src/stores/sidebar-store/builders/domain.ts +20 -12
  39. package/eventcatalog/src/stores/sidebar-store/builders/flow.ts +1 -1
  40. package/eventcatalog/src/stores/sidebar-store/builders/message.ts +20 -4
  41. package/eventcatalog/src/stores/sidebar-store/builders/service.ts +18 -6
  42. package/eventcatalog/src/stores/sidebar-store/builders/shared.ts +20 -0
  43. package/eventcatalog/src/stores/sidebar-store/state.ts +34 -6
  44. package/eventcatalog/src/types/index.ts +4 -2
  45. package/eventcatalog/src/utils/collections/diagrams.ts +64 -0
  46. package/eventcatalog/src/utils/collections/util.ts +2 -0
  47. package/eventcatalog/src/utils/feature.ts +4 -2
  48. package/eventcatalog/src/utils/page-loaders/page-data-loader.ts +2 -0
  49. package/package.json +2 -2
@@ -0,0 +1,47 @@
1
+ // This file exposes the markdown for diagrams in the URL
2
+ // For example http://localhost:3000/diagrams/target-architecture/1.0.0 loads the Page
3
+ // and http://localhost:3000/diagrams/target-architecture/1.0.0.mdx loads the markdown
4
+ // This is used for LLMs to load the markdown for diagrams (llms.txt)
5
+
6
+ import type { APIRoute } from 'astro';
7
+ import { getCollection } from 'astro:content';
8
+ import fs from 'fs';
9
+ import { isLLMSTxtEnabled, isSSR } from '@utils/feature';
10
+
11
+ const diagrams = await getCollection('diagrams');
12
+
13
+ export async function getStaticPaths() {
14
+ // Just return empty array if LLMs are not enabled
15
+ if (!isLLMSTxtEnabled()) {
16
+ return [];
17
+ }
18
+
19
+ return diagrams.map((diagram) => ({
20
+ params: { id: diagram.data.id, version: diagram.data.version },
21
+ props: { content: diagram },
22
+ }));
23
+ }
24
+
25
+ export const GET: APIRoute = async ({ params, props }) => {
26
+ // Just return empty array if LLMs are not enabled
27
+ if (!isLLMSTxtEnabled()) {
28
+ return new Response('llms.txt is not enabled for this Catalog.', { status: 404 });
29
+ }
30
+
31
+ if (isSSR()) {
32
+ // For SSR mode, find the diagram and read its file
33
+ const diagram = diagrams.find((d) => d.data.id === params.id && d.data.version === params.version);
34
+ if (!diagram?.filePath) {
35
+ return new Response('Not found', { status: 404 });
36
+ }
37
+ const file = fs.readFileSync(diagram.filePath, 'utf8');
38
+ return new Response(file, { status: 200 });
39
+ } else {
40
+ if (props?.content?.filePath) {
41
+ const file = fs.readFileSync(props.content.filePath, 'utf8');
42
+ return new Response(file, { status: 200 });
43
+ }
44
+ }
45
+
46
+ return new Response('Not found', { status: 404 });
47
+ };
@@ -73,31 +73,25 @@ const logList = await Promise.all(logListPromise);
73
73
 
74
74
  const getBadge = () => {
75
75
  if (props.collection === 'services') {
76
- return { backgroundColor: 'pink', textColor: 'pink', content: 'Service', icon: ServerIcon, class: 'text-pink-600' };
76
+ return { badgeType: 'service', content: 'Service', icon: ServerIcon };
77
77
  }
78
78
  if (props.collection === 'events') {
79
- return { backgroundColor: 'orange', textColor: 'orange', content: 'Event', icon: BoltIcon, class: 'text-orange-600' };
79
+ return { badgeType: 'event', content: 'Event', icon: BoltIcon };
80
80
  }
81
81
  if (props.collection === 'commands') {
82
- return { backgroundColor: 'blue', textColor: 'blue', content: 'Command', icon: ChatBubbleLeftIcon, class: 'text-blue-600' };
82
+ return { badgeType: 'command', content: 'Command', icon: ChatBubbleLeftIcon };
83
83
  }
84
84
  if (props.collection === 'queries') {
85
- return { backgroundColor: 'green', textColor: 'green', content: 'Query', icon: MagnifyingGlassIcon, class: 'text-green-600' };
85
+ return { badgeType: 'query', content: 'Query', icon: MagnifyingGlassIcon };
86
86
  }
87
87
  if (props.collection === 'domains') {
88
- return {
89
- backgroundColor: 'yellow',
90
- textColor: 'yellow',
91
- content: 'Domain',
92
- icon: RectangleGroupIcon,
93
- class: 'text-yellow-600',
94
- };
88
+ return { badgeType: 'domain', content: 'Domain', icon: RectangleGroupIcon };
95
89
  }
96
90
  if (props.collection === 'containers') {
97
- return { backgroundColor: 'blue', textColor: 'blue', content: 'Container', icon: DatabaseIcon, class: 'text-blue-600' };
91
+ return { badgeType: 'default', content: 'Container', icon: DatabaseIcon };
98
92
  }
99
93
  if (props.collection === 'flows') {
100
- return { backgroundColor: 'teal', textColor: 'teal', content: 'Flow', icon: QueueListIcon, class: 'text-teal-600' };
94
+ return { badgeType: 'design', content: 'Flow', icon: QueueListIcon };
101
95
  }
102
96
  };
103
97
 
@@ -112,7 +106,7 @@ const badges = [getBadge()];
112
106
  <div>
113
107
  <a
114
108
  href={buildUrl(`/docs/${props.collection}/${props.data.id}/${props.data.version}`)}
115
- class="text-sm font-medium text-gray-500 hover:text-gray-700"
109
+ class="text-sm font-medium text-[rgb(var(--ec-page-text-muted))] hover:text-[rgb(var(--ec-page-text))]"
116
110
  >
117
111
  {props.data.name}
118
112
  </a>
@@ -120,12 +114,17 @@ const badges = [getBadge()];
120
114
  </li>
121
115
  <li>
122
116
  <div class="flex items-center">
123
- <svg fill="currentColor" viewBox="0 0 20 20" aria-hidden="true" class="h-5 w-5 flex-shrink-0 text-gray-300">
117
+ <svg
118
+ fill="currentColor"
119
+ viewBox="0 0 20 20"
120
+ aria-hidden="true"
121
+ class="h-5 w-5 flex-shrink-0 text-[rgb(var(--ec-page-border))]"
122
+ >
124
123
  <path d="M5.555 17.776l8-16 .894.448-8 16-.894-.448z"></path>
125
124
  </svg>
126
125
  <a
127
126
  href={buildUrl(`/docs/${props.collection}/${props.data.id}/${props.data.version}`)}
128
- class="text-sm font-medium text-gray-500 hover:text-gray-700"
127
+ class="text-sm font-medium text-[rgb(var(--ec-page-text-muted))] hover:text-[rgb(var(--ec-page-text))]"
129
128
  >
130
129
  Changelog
131
130
  </a>
@@ -133,18 +132,19 @@ const badges = [getBadge()];
133
132
  </li>
134
133
  </ol>
135
134
  </nav>
136
- <div class="border-b border-gray-200 flex justify-between items-start py-4 w-full">
135
+ <div class="border-b border-[rgb(var(--ec-page-border))] flex justify-between items-start py-4 w-full">
137
136
  <div>
138
- <h2 class="text-2xl md:text-4xl font-bold">{props.data.name} (Changelog)</h2>
139
- <h2 class="text-lg pt-2 text-gray-500 font-light">{props.data.summary}</h2>
137
+ <h2 class="text-2xl md:text-4xl font-bold text-[rgb(var(--ec-page-text))]">{props.data.name} (Changelog)</h2>
138
+ <h2 class="text-lg pt-2 text-[rgb(var(--ec-page-text-muted))] font-light">{props.data.summary}</h2>
140
139
  {
141
140
  badges && (
142
141
  <div class="flex flex-wrap py-2 pt-4">
143
142
  {badges.map((badge: any) => (
144
143
  <span
145
- class={`text-sm font-light text-gray-500 px-2 py-1 rounded-md mr-2 bg-${badge.backgroundColor}-100 space-x-1 border border-${badge.backgroundColor}-200 text-${badge.textColor}-800 flex items-center ${badge.class ? badge.class : ''} `}
144
+ class="text-sm font-medium px-2 py-1 rounded-md mr-2 space-x-1 flex items-center"
145
+ style={`background-color: rgb(var(--ec-badge-${badge.badgeType}-bg)); color: rgb(var(--ec-badge-${badge.badgeType}-text));`}
146
146
  >
147
- {badge.icon && <badge.icon className="w-4 h-4 inline-block mr-1 " />}
147
+ {badge.icon && <badge.icon className="w-4 h-4 inline-block mr-1" />}
148
148
  <span>{badge.content}</span>
149
149
  </span>
150
150
  ))}
@@ -155,7 +155,7 @@ const badges = [getBadge()];
155
155
  </div>
156
156
  {
157
157
  logList.length === 0 && (
158
- <div class="py-4 text-gray-400 prose prose-md">
158
+ <div class="py-4 text-[rgb(var(--ec-page-text-muted))] prose prose-md">
159
159
  <p>No changelogs found.</p>
160
160
  </div>
161
161
  )
@@ -167,25 +167,22 @@ const badges = [getBadge()];
167
167
  <li>
168
168
  <div class="relative pb-8">
169
169
  {index !== logList.length - 1 ? (
170
- <span aria-hidden="true" class="absolute left-6 top-4 -ml-px h-full w-0.5 bg-gray-200" />
170
+ <span aria-hidden="true" class="absolute left-6 top-4 -ml-px h-full w-0.5 bg-[rgb(var(--ec-page-border))]" />
171
171
  ) : null}
172
172
  <div class="relative flex space-x-3">
173
173
  <div>
174
174
  <a
175
175
  href={buildUrl(`${log.url}/${log.version}`)}
176
- class={
177
- 'bg-primary hover:bg-primary/80 text-white flex h-8 w-14 items-center justify-center rounded-full ring-8 ring-white'
178
- }
176
+ class="bg-primary hover:bg-primary/80 text-white flex h-8 w-14 items-center justify-center rounded-full ring-8 ring-[rgb(var(--ec-page-bg))]"
179
177
  >
180
178
  {log.version}
181
- {/* <DocumentTextIcon aria-hidden="true" className="h-5 w-5 text-white" /> */}
182
179
  </a>
183
180
  </div>
184
181
  </div>
185
182
  <div class="pl-[70px] py-2 -mt-10">
186
183
  {log.createdAt && (
187
184
  <div class="pb-2">
188
- <h3 class="text-2xl text-gray-800 font-bold">
185
+ <h3 class="text-2xl text-[rgb(var(--ec-page-text))] font-bold">
189
186
  <span>
190
187
  {log.createdAt.toISOString().split('T')[0]} {`${log.isLatest ? '(latest)' : ''}`}
191
188
  </span>
@@ -195,10 +192,8 @@ const badges = [getBadge()];
195
192
  {log.badges && (
196
193
  <div class="flex flex-wrap">
197
194
  {log.badges.map((badge: any) => (
198
- <span
199
- class={`text-sm font-light text-gray-500 px-2 py-1 rounded-md mr-2 bg-${badge.backgroundColor}-100 space-x-1 border border-${badge.backgroundColor}-200 text-${badge.textColor}-800 flex items-center ${badge.class ? badge.class : ''} `}
200
- >
201
- {badge.icon && <badge.icon className="w-4 h-4 inline-block mr-1 " />}
195
+ <span class="text-sm font-medium px-2 py-1 rounded-md mr-2 space-x-1 flex items-center bg-[rgb(var(--ec-badge-default-bg))] text-[rgb(var(--ec-badge-default-text))]">
196
+ {badge.icon && <badge.icon className="w-4 h-4 inline-block mr-1" />}
202
197
  <span>{badge.content}</span>
203
198
  </span>
204
199
  ))}
@@ -207,7 +202,7 @@ const badges = [getBadge()];
207
202
  <div class="prose prose-md !max-w-none py-2">
208
203
  <log.Content components={mdxComponents(props)} />
209
204
  </div>
210
- {log.diffs && log.diffs.map((diff) => <div id="diff-container" set:html={diff} />)}
205
+ {log.diffs && log.diffs.map((diff) => <div class="bg-white rounded-lg p-2 my-2" set:html={diff} />)}
211
206
  </div>
212
207
  </div>
213
208
  </li>
@@ -305,6 +305,7 @@ nodeGraphs.push({
305
305
  markdownDownloadEnabled={isMarkdownDownloadEnabled()}
306
306
  rssFeedEnabled={isRSSEnabled()}
307
307
  editUrl={editUrl}
308
+ preferChatAsDefault={isEventCatalogChatEnabled()}
308
309
  />
309
310
  </div>
310
311
  </div>
@@ -7,6 +7,7 @@ import { getCollection } from 'astro:content';
7
7
  import { getEntities } from '@utils/collections/entities';
8
8
  import config from '@config';
9
9
  import fs from 'fs';
10
+ import { isLLMSTxtEnabled } from '@utils/feature';
10
11
 
11
12
  const events = await getCollection('events');
12
13
  const commands = await getCollection('commands');
@@ -19,7 +20,7 @@ const containers = await getCollection('containers');
19
20
  const entities = await getEntities();
20
21
  export async function getStaticPaths() {
21
22
  // Just return empty array if LLMs are not enabled
22
- if (!config.llmsTxt?.enabled) {
23
+ if (!isLLMSTxtEnabled()) {
23
24
  return [];
24
25
  }
25
26
 
@@ -46,7 +47,7 @@ export async function getStaticPaths() {
46
47
 
47
48
  export const GET: APIRoute = async ({ params, props }) => {
48
49
  // Just return empty array if LLMs are not enabled
49
- if (!config.llmsTxt?.enabled) {
50
+ if (!isLLMSTxtEnabled()) {
50
51
  return new Response('llms.txt is not enabled for this Catalog.', { status: 404 });
51
52
  }
52
53
 
@@ -21,7 +21,7 @@ import utils from '@eventcatalog/sdk';
21
21
 
22
22
  export async function getStaticPaths() {
23
23
  // Just return empty array if LLMs are not enabled
24
- if (!config.llmsTxt?.enabled) {
24
+ if (!isLLMSTxtEnabled()) {
25
25
  return [];
26
26
  }
27
27
  const collections = {
@@ -45,11 +45,15 @@ export async function getStaticPaths() {
45
45
  }
46
46
 
47
47
  export const GET: APIRoute = async ({ params, props }) => {
48
+ console.log('props', props);
49
+
48
50
  // Just return empty array if LLMs are not enabled
49
51
  if (!isLLMSTxtEnabled()) {
50
52
  return new Response('llms.txt is not enabled for this Catalog.', { status: 404 });
51
53
  }
52
54
 
55
+ console.log('params', params);
56
+
53
57
  if (isSSR()) {
54
58
  const { getResourcePath } = utils(process.env.PROJECT_DIR ?? '');
55
59
  const filePath = await getResourcePath(process.env.PROJECT_DIR ?? '', params.id ?? '', params.version ?? '');
@@ -3,6 +3,7 @@ import type { CollectionEntry } from 'astro:content';
3
3
  import type { APIRoute } from 'astro';
4
4
  import config from '@config';
5
5
  import fs from 'fs';
6
+ import { isLLMSTxtEnabled } from '@utils/feature';
6
7
 
7
8
  export async function getStaticPaths() {
8
9
  const domains = await getDomains({ getAllVersions: false });
@@ -25,7 +26,7 @@ export async function getStaticPaths() {
25
26
 
26
27
  export const GET: APIRoute = async ({ params, props }) => {
27
28
  // Just return empty array if LLMs are not enabled
28
- if (!config.llmsTxt?.enabled) {
29
+ if (!isLLMSTxtEnabled()) {
29
30
  return new Response('llms.txt is not enabled for this Catalog.', { status: 404 });
30
31
  }
31
32
 
@@ -4,8 +4,8 @@
4
4
 
5
5
  import type { APIRoute, GetStaticPaths } from 'astro';
6
6
  import { getCollection } from 'astro:content';
7
- import config from '@config';
8
7
  import fs from 'fs';
8
+ import { isLLMSTxtEnabled } from '@utils/feature';
9
9
 
10
10
  export const getStaticPaths = (async () => {
11
11
  const docs = await getCollection('customPages');
@@ -19,7 +19,7 @@ export const getStaticPaths = (async () => {
19
19
 
20
20
  export const GET: APIRoute = async ({ params, props }) => {
21
21
  // Just return empty array if LLMs are not enabled
22
- if (!config.llmsTxt?.enabled) {
22
+ if (!isLLMSTxtEnabled()) {
23
23
  return new Response('llms.txt is not enabled for this Catalog.', { status: 404 });
24
24
  }
25
25
 
@@ -6,12 +6,13 @@ import type { APIRoute } from 'astro';
6
6
  import { getCollection } from 'astro:content';
7
7
  import config from '@config';
8
8
  import fs from 'fs';
9
+ import { isLLMSTxtEnabled } from '@utils/feature';
9
10
 
10
11
  const teams = await getCollection('teams');
11
12
 
12
13
  export async function getStaticPaths() {
13
14
  // Just return empty array if LLMs are not enabled
14
- if (!config.llmsTxt?.enabled) {
15
+ if (!isLLMSTxtEnabled()) {
15
16
  return [];
16
17
  }
17
18
 
@@ -23,7 +24,7 @@ export async function getStaticPaths() {
23
24
 
24
25
  export const GET: APIRoute = async ({ params, props }) => {
25
26
  // Just return empty array if LLMs are not enabled
26
- if (!config.llmsTxt?.enabled) {
27
+ if (!isLLMSTxtEnabled()) {
27
28
  return new Response('llms.txt is not enabled for this Catalog.', { status: 404 });
28
29
  }
29
30
 
@@ -4,14 +4,14 @@
4
4
 
5
5
  import type { APIRoute } from 'astro';
6
6
  import { getCollection } from 'astro:content';
7
- import config from '@config';
7
+ import { isLLMSTxtEnabled } from '@utils/feature';
8
8
  import fs from 'fs';
9
9
 
10
10
  const teams = await getCollection('teams');
11
11
 
12
12
  export async function getStaticPaths() {
13
13
  // Just return empty array if LLMs are not enabled
14
- if (!config.llmsTxt?.enabled) {
14
+ if (!isLLMSTxtEnabled()) {
15
15
  return [];
16
16
  }
17
17
 
@@ -23,7 +23,7 @@ export async function getStaticPaths() {
23
23
 
24
24
  export const GET: APIRoute = async ({ params, props }) => {
25
25
  // Just return empty array if LLMs are not enabled
26
- if (!config.llmsTxt?.enabled) {
26
+ if (!isLLMSTxtEnabled()) {
27
27
  return new Response('llms.txt is not enabled for this Catalog.', { status: 404 });
28
28
  }
29
29
 
@@ -6,12 +6,13 @@ import type { APIRoute } from 'astro';
6
6
  import { getCollection } from 'astro:content';
7
7
  import config from '@config';
8
8
  import fs from 'fs';
9
+ import { isLLMSTxtEnabled } from '@utils/feature';
9
10
 
10
11
  const users = await getCollection('users');
11
12
 
12
13
  export async function getStaticPaths() {
13
14
  // Just return empty array if LLMs are not enabled
14
- if (!config.llmsTxt?.enabled) {
15
+ if (!isLLMSTxtEnabled()) {
15
16
  return [];
16
17
  }
17
18
 
@@ -23,7 +24,7 @@ export async function getStaticPaths() {
23
24
 
24
25
  export const GET: APIRoute = async ({ params, props }) => {
25
26
  // Just return empty array if LLMs are not enabled
26
- if (!config.llmsTxt?.enabled) {
27
+ if (!isLLMSTxtEnabled()) {
27
28
  return new Response('llms.txt is not enabled for this Catalog.', { status: 404 });
28
29
  }
29
30
 
@@ -4,14 +4,14 @@
4
4
 
5
5
  import type { APIRoute } from 'astro';
6
6
  import { getCollection } from 'astro:content';
7
- import config from '@config';
7
+ import { isLLMSTxtEnabled } from '@utils/feature';
8
8
  import fs from 'fs';
9
9
 
10
10
  const users = await getCollection('users');
11
11
 
12
12
  export async function getStaticPaths() {
13
13
  // Just return empty array if LLMs are not enabled
14
- if (!config.llmsTxt?.enabled) {
14
+ if (!isLLMSTxtEnabled()) {
15
15
  return [];
16
16
  }
17
17
 
@@ -23,7 +23,7 @@ export async function getStaticPaths() {
23
23
 
24
24
  export const GET: APIRoute = async ({ params, props }) => {
25
25
  // Just return empty array if LLMs are not enabled
26
- if (!config.llmsTxt?.enabled) {
26
+ if (!isLLMSTxtEnabled()) {
27
27
  return new Response('llms.txt is not enabled for this Catalog.', { status: 404 });
28
28
  }
29
29
 
@@ -1,16 +1,21 @@
1
1
  import type { CollectionEntry } from 'astro:content';
2
2
  import { buildUrl } from '@utils/url-builder';
3
- import type { NavNode, ChildRef } from './shared';
3
+ import type { NavNode, ChildRef, ResourceGroupContext } from './shared';
4
4
  import {
5
5
  buildQuickReferenceSection,
6
6
  buildOwnersSection,
7
7
  shouldRenderSideBarSection,
8
8
  buildRepositorySection,
9
9
  buildAttachmentsSection,
10
+ buildDiagramNavItems,
10
11
  } from './shared';
11
12
  import { isVisualiserEnabled } from '@utils/feature';
12
13
 
13
- export const buildContainerNode = (container: CollectionEntry<'containers'>, owners: any[]): NavNode => {
14
+ export const buildContainerNode = (
15
+ container: CollectionEntry<'containers'>,
16
+ owners: any[],
17
+ context: ResourceGroupContext
18
+ ): NavNode => {
14
19
  const servicesWritingToContainer = container.data.servicesThatWriteToContainer || [];
15
20
  const servicesReadingFromContainer = container.data.servicesThatReadFromContainer || [];
16
21
 
@@ -27,6 +32,11 @@ export const buildContainerNode = (container: CollectionEntry<'containers'>, own
27
32
 
28
33
  const renderRepository = container.data.repository && shouldRenderSideBarSection(container, 'repository');
29
34
 
35
+ // Diagrams
36
+ const containerDiagrams = container.data.diagrams || [];
37
+ const diagramNavItems = buildDiagramNavItems(containerDiagrams, context.diagrams);
38
+ const hasDiagrams = diagramNavItems.length > 0;
39
+
30
40
  return {
31
41
  type: 'item',
32
42
  title: container.data.name,
@@ -41,16 +51,22 @@ export const buildContainerNode = (container: CollectionEntry<'containers'>, own
41
51
  ]),
42
52
  renderVisualiser && {
43
53
  type: 'group',
44
- title: 'Architecture & Design',
54
+ title: 'Architecture',
45
55
  icon: 'Workflow',
46
56
  pages: [
47
57
  {
48
58
  type: 'item',
49
- title: 'Interaction Map',
59
+ title: 'Map',
50
60
  href: buildUrl(`/visualiser/containers/${container.data.id}/${container.data.version}`),
51
61
  },
52
62
  ],
53
63
  },
64
+ hasDiagrams && {
65
+ type: 'group',
66
+ title: 'Diagrams',
67
+ icon: 'FileImage',
68
+ pages: diagramNavItems,
69
+ },
54
70
  renderServicesWritingToContainer && {
55
71
  type: 'group',
56
72
  title: 'Services (Writes)',
@@ -8,6 +8,7 @@ import {
8
8
  shouldRenderSideBarSection,
9
9
  buildRepositorySection,
10
10
  buildAttachmentsSection,
11
+ buildDiagramNavItems,
11
12
  } from './shared';
12
13
  import { isVisualiserEnabled } from '@utils/feature';
13
14
 
@@ -35,6 +36,12 @@ export const buildDomainNode = (domain: CollectionEntry<'domains'>, owners: any[
35
36
  const hasAttachments = domain.data.attachments && domain.data.attachments.length > 0;
36
37
 
37
38
  const renderRepository = domain.data.repository && shouldRenderSideBarSection(domain, 'repository');
39
+
40
+ // Diagrams
41
+ const domainDiagrams = domain.data.diagrams || [];
42
+ const diagramNavItems = buildDiagramNavItems(domainDiagrams, context.diagrams);
43
+ const hasDiagrams = diagramNavItems.length > 0;
44
+
38
45
  return {
39
46
  type: 'item',
40
47
  title: domain.data.name,
@@ -47,32 +54,33 @@ export const buildDomainNode = (domain: CollectionEntry<'domains'>, owners: any[
47
54
  ]),
48
55
  {
49
56
  type: 'group',
50
- title: 'Architecture & Design',
57
+ title: 'Architecture',
51
58
  icon: 'Workflow',
52
59
  pages: [
53
60
  {
54
61
  type: 'item',
55
- title: 'Architecture Overview',
62
+ title: 'Overview',
56
63
  href: buildUrl(`/architecture/domains/${domain.data.id}/${domain.data.version}`),
57
64
  },
65
+ renderVisualiser && {
66
+ type: 'item',
67
+ title: 'Map',
68
+ href: buildUrl(`/visualiser/domains/${domain.data.id}/${domain.data.version}`),
69
+ },
58
70
  renderEntities &&
59
71
  renderVisualiser && {
60
72
  type: 'item',
61
73
  title: 'Entity Map',
62
74
  href: buildUrl(`/visualiser/domains/${domain.data.id}/${domain.data.version}/entity-map`),
63
75
  },
64
- renderVisualiser && {
65
- type: 'item',
66
- title: 'Interaction Map',
67
- href: buildUrl(`/visualiser/domains/${domain.data.id}/${domain.data.version}`),
68
- },
69
- renderVisualiser && {
70
- type: 'item',
71
- title: 'Global Domain Map',
72
- href: buildUrl(`/visualiser/domain-integrations`),
73
- },
74
76
  ].filter(Boolean) as ChildRef[],
75
77
  },
78
+ hasDiagrams && {
79
+ type: 'group',
80
+ title: 'Diagrams',
81
+ icon: 'FileImage',
82
+ pages: diagramNavItems,
83
+ },
76
84
  renderSubDomains && {
77
85
  type: 'group',
78
86
  title: 'Subdomains',
@@ -14,7 +14,7 @@ export const buildFlowNode = (flow: CollectionEntry<'flows'>): NavNode => {
14
14
  buildQuickReferenceSection([{ title: 'Overview', href: buildUrl(`/docs/flows/${flow.data.id}/${flow.data.version}`) }]),
15
15
  {
16
16
  type: 'group',
17
- title: 'Architecture & Design',
17
+ title: 'Architecture',
18
18
  icon: 'Workflow',
19
19
  pages: [
20
20
  {
@@ -1,17 +1,22 @@
1
1
  import type { CollectionEntry } from 'astro:content';
2
2
  import { buildUrl } from '@utils/url-builder';
3
3
  import { getSchemaFormatFromURL } from '@utils/collections/schemas';
4
- import type { NavNode, ChildRef } from './shared';
4
+ import type { NavNode, ChildRef, ResourceGroupContext } from './shared';
5
5
  import {
6
6
  buildQuickReferenceSection,
7
7
  buildOwnersSection,
8
8
  shouldRenderSideBarSection,
9
9
  buildRepositorySection,
10
10
  buildAttachmentsSection,
11
+ buildDiagramNavItems,
11
12
  } from './shared';
12
13
  import { isVisualiserEnabled } from '@utils/feature';
13
14
 
14
- export const buildMessageNode = (message: CollectionEntry<'events' | 'commands' | 'queries'>, owners: any[]): NavNode => {
15
+ export const buildMessageNode = (
16
+ message: CollectionEntry<'events' | 'commands' | 'queries'>,
17
+ owners: any[],
18
+ context: ResourceGroupContext
19
+ ): NavNode => {
15
20
  const producers = message.data.producers || [];
16
21
  const consumers = message.data.consumers || [];
17
22
  const collection = message.collection;
@@ -35,6 +40,11 @@ export const buildMessageNode = (message: CollectionEntry<'events' | 'commands'
35
40
 
36
41
  const renderOwners = owners.length > 0 && shouldRenderSideBarSection(message, 'owners');
37
42
 
43
+ // Diagrams
44
+ const messageDiagrams = message.data.diagrams || [];
45
+ const diagramNavItems = buildDiagramNavItems(messageDiagrams, context.diagrams);
46
+ const hasDiagrams = diagramNavItems.length > 0;
47
+
38
48
  return {
39
49
  type: 'item',
40
50
  title: message.data.name,
@@ -49,16 +59,22 @@ export const buildMessageNode = (message: CollectionEntry<'events' | 'commands'
49
59
  ]),
50
60
  renderVisualiser && {
51
61
  type: 'group',
52
- title: 'Architecture & Design',
62
+ title: 'Architecture',
53
63
  icon: 'Workflow',
54
64
  pages: [
55
65
  {
56
66
  type: 'item',
57
- title: 'Interaction Map',
67
+ title: 'Map',
58
68
  href: buildUrl(`/visualiser/${collection}/${message.data.id}/${message.data.version}`),
59
69
  },
60
70
  ],
61
71
  },
72
+ hasDiagrams && {
73
+ type: 'group',
74
+ title: 'Diagrams',
75
+ icon: 'FileImage',
76
+ pages: diagramNavItems,
77
+ },
62
78
  hasSchema && {
63
79
  type: 'group',
64
80
  title: `API & Contracts`,