@eventcatalog/core 3.12.9-beta.0 → 3.13.0-beta.2
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/dist/analytics/analytics.cjs +1 -1
- package/dist/analytics/analytics.js +2 -2
- package/dist/analytics/log-build.cjs +1 -1
- package/dist/analytics/log-build.js +3 -3
- package/dist/{chunk-WTCJKTEF.js → chunk-GC6XBLGZ.js} +1 -1
- package/dist/{chunk-RJOB6XEC.js → chunk-PBMJ6OIP.js} +1 -1
- package/dist/{chunk-V7YMKA4P.js → chunk-QCHSOWJP.js} +1 -1
- package/dist/{chunk-EDX2LGRV.js → chunk-VQJRAI3N.js} +1 -1
- package/dist/{chunk-2UUS3AQ2.js → chunk-XIZQ27W3.js} +1 -1
- package/dist/constants.cjs +1 -1
- package/dist/constants.js +1 -1
- package/dist/eventcatalog.cjs +1 -1
- package/dist/eventcatalog.js +5 -5
- package/dist/generate.cjs +1 -1
- package/dist/generate.js +3 -3
- package/dist/utils/cli-logger.cjs +1 -1
- package/dist/utils/cli-logger.js +2 -2
- package/eventcatalog/src/components/Header.astro +51 -37
- package/eventcatalog/src/components/MDX/File.tsx +7 -7
- package/eventcatalog/src/components/MDX/Schema.astro +3 -6
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/index.astro +1 -6
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/spec/[filename].astro +2 -2
- package/eventcatalog/src/utils/collections/channels.ts +1 -26
- package/eventcatalog/src/utils/collections/commands.ts +20 -34
- package/eventcatalog/src/utils/collections/containers.ts +1 -32
- package/eventcatalog/src/utils/collections/data-products.ts +1 -19
- package/eventcatalog/src/utils/collections/diagrams.ts +0 -7
- package/eventcatalog/src/utils/collections/domains.ts +0 -18
- package/eventcatalog/src/utils/collections/entities.ts +1 -27
- package/eventcatalog/src/utils/collections/events.ts +20 -36
- package/eventcatalog/src/utils/collections/flows.ts +0 -8
- package/eventcatalog/src/utils/collections/messages.ts +102 -0
- package/eventcatalog/src/utils/collections/queries.ts +20 -30
- package/eventcatalog/src/utils/collections/schemas.ts +9 -4
- package/eventcatalog/src/utils/collections/services.ts +0 -20
- package/eventcatalog/src/utils/collections/teams.ts +0 -6
- package/eventcatalog/src/utils/collections/users.ts +0 -6
- package/eventcatalog/src/utils/collections/util.ts +10 -1
- package/package.json +3 -3
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
log_build_default
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-QCHSOWJP.js";
|
|
4
|
+
import "../chunk-GC6XBLGZ.js";
|
|
5
5
|
import "../chunk-4UVFXLPI.js";
|
|
6
|
-
import "../chunk-
|
|
6
|
+
import "../chunk-XIZQ27W3.js";
|
|
7
7
|
import "../chunk-UPONRQSN.js";
|
|
8
8
|
export {
|
|
9
9
|
log_build_default as default
|
package/dist/constants.cjs
CHANGED
package/dist/constants.js
CHANGED
package/dist/eventcatalog.cjs
CHANGED
|
@@ -109,7 +109,7 @@ var verifyRequiredFieldsAreInCatalogConfigFile = async (projectDirectory) => {
|
|
|
109
109
|
var import_picocolors = __toESM(require("picocolors"), 1);
|
|
110
110
|
|
|
111
111
|
// package.json
|
|
112
|
-
var version = "3.
|
|
112
|
+
var version = "3.13.0-beta.2";
|
|
113
113
|
|
|
114
114
|
// src/constants.ts
|
|
115
115
|
var VERSION = version;
|
package/dist/eventcatalog.js
CHANGED
|
@@ -6,8 +6,8 @@ import {
|
|
|
6
6
|
} from "./chunk-PLNJC7NZ.js";
|
|
7
7
|
import {
|
|
8
8
|
log_build_default
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-QCHSOWJP.js";
|
|
10
|
+
import "./chunk-GC6XBLGZ.js";
|
|
11
11
|
import "./chunk-4UVFXLPI.js";
|
|
12
12
|
import {
|
|
13
13
|
runMigrations
|
|
@@ -22,13 +22,13 @@ import {
|
|
|
22
22
|
} from "./chunk-5VBIXL6C.js";
|
|
23
23
|
import {
|
|
24
24
|
generate
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-PBMJ6OIP.js";
|
|
26
26
|
import {
|
|
27
27
|
logger
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-VQJRAI3N.js";
|
|
29
29
|
import {
|
|
30
30
|
VERSION
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-XIZQ27W3.js";
|
|
32
32
|
import {
|
|
33
33
|
verifyRequiredFieldsAreInCatalogConfigFile
|
|
34
34
|
} from "./chunk-UPONRQSN.js";
|
package/dist/generate.cjs
CHANGED
|
@@ -73,7 +73,7 @@ var getEventCatalogConfigFile = async (projectDirectory) => {
|
|
|
73
73
|
var import_picocolors = __toESM(require("picocolors"), 1);
|
|
74
74
|
|
|
75
75
|
// package.json
|
|
76
|
-
var version = "3.
|
|
76
|
+
var version = "3.13.0-beta.2";
|
|
77
77
|
|
|
78
78
|
// src/constants.ts
|
|
79
79
|
var VERSION = version;
|
package/dist/generate.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
generate
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-PBMJ6OIP.js";
|
|
4
|
+
import "./chunk-VQJRAI3N.js";
|
|
5
|
+
import "./chunk-XIZQ27W3.js";
|
|
6
6
|
import "./chunk-UPONRQSN.js";
|
|
7
7
|
export {
|
|
8
8
|
generate
|
package/dist/utils/cli-logger.js
CHANGED
|
@@ -89,7 +89,7 @@ const repositoryUrl = catalog?.repositoryUrl || 'https://github.com/event-catalo
|
|
|
89
89
|
</button>
|
|
90
90
|
<div
|
|
91
91
|
id="profile-dropdown"
|
|
92
|
-
class="hidden absolute right-0 mt-2 w-48 bg-[rgb(var(--ec-dropdown-bg))] rounded-lg shadow-md py-1 z-50 border-2 border-[rgb(var(--ec-dropdown-border))] overflow-hidden"
|
|
92
|
+
class="ec-hidden absolute right-0 mt-2 w-48 bg-[rgb(var(--ec-dropdown-bg))] rounded-lg shadow-md py-1 z-50 border-2 border-[rgb(var(--ec-dropdown-border))] overflow-hidden"
|
|
93
93
|
>
|
|
94
94
|
<div class="px-4 py-2 text-sm text-[rgb(var(--ec-dropdown-text))] border-b border-[rgb(var(--ec-dropdown-border))]">
|
|
95
95
|
<div class="font-semibold">{session.user?.name || 'User'}</div>
|
|
@@ -194,7 +194,7 @@ const repositoryUrl = catalog?.repositoryUrl || 'https://github.com/event-catalo
|
|
|
194
194
|
</div>
|
|
195
195
|
</div>
|
|
196
196
|
|
|
197
|
-
<div id="mobile-menu" class="md:hidden hidden mt-4">
|
|
197
|
+
<div id="mobile-menu" class="md:hidden ec-hidden mt-4">
|
|
198
198
|
<ul class="flex flex-col space-y-8 my-4 mb-8">
|
|
199
199
|
<!-- {
|
|
200
200
|
navItems.map((item) => {
|
|
@@ -215,51 +215,65 @@ const repositoryUrl = catalog?.repositoryUrl || 'https://github.com/event-catalo
|
|
|
215
215
|
<!-- Spacer to prevent content from being hidden under the fixed header -->
|
|
216
216
|
|
|
217
217
|
<script>
|
|
218
|
-
const menuToggle = document.getElementById('menu-toggle');
|
|
219
|
-
const mobileMenu = document.getElementById('mobile-menu');
|
|
220
218
|
import { signOut } from 'auth-astro/client';
|
|
221
219
|
|
|
222
|
-
|
|
223
|
-
menuToggle.
|
|
224
|
-
|
|
225
|
-
});
|
|
226
|
-
}
|
|
220
|
+
function initializeHeader() {
|
|
221
|
+
const menuToggle = document.getElementById('menu-toggle');
|
|
222
|
+
const mobileMenu = document.getElementById('mobile-menu');
|
|
227
223
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
224
|
+
if (menuToggle && mobileMenu) {
|
|
225
|
+
menuToggle.addEventListener('click', () => {
|
|
226
|
+
mobileMenu.classList.toggle('ec-hidden');
|
|
227
|
+
});
|
|
228
|
+
}
|
|
231
229
|
|
|
232
|
-
|
|
233
|
-
profileButton.
|
|
234
|
-
|
|
235
|
-
profileDropdown.classList.toggle('hidden');
|
|
236
|
-
profileButton.setAttribute('aria-expanded', !profileDropdown.classList.contains('hidden') ? 'true' : 'false');
|
|
237
|
-
});
|
|
230
|
+
// Profile dropdown functionality
|
|
231
|
+
const profileButton = document.getElementById('profile-menu-button');
|
|
232
|
+
const profileDropdown = document.getElementById('profile-dropdown');
|
|
238
233
|
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
profileDropdown.classList.
|
|
243
|
-
profileButton.setAttribute('aria-expanded', 'false');
|
|
244
|
-
}
|
|
245
|
-
});
|
|
234
|
+
if (profileButton && profileDropdown) {
|
|
235
|
+
profileButton.addEventListener('click', (e) => {
|
|
236
|
+
e.stopPropagation();
|
|
237
|
+
profileDropdown.classList.toggle('ec-hidden');
|
|
238
|
+
profileButton.setAttribute('aria-expanded', !profileDropdown.classList.contains('ec-hidden') ? 'true' : 'false');
|
|
239
|
+
});
|
|
246
240
|
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
}
|
|
254
|
-
|
|
241
|
+
// Close dropdown when clicking outside
|
|
242
|
+
document.addEventListener('click', (e) => {
|
|
243
|
+
if (!profileButton.contains(e.target as Node) && !profileDropdown.contains(e.target as Node)) {
|
|
244
|
+
profileDropdown.classList.add('ec-hidden');
|
|
245
|
+
profileButton.setAttribute('aria-expanded', 'false');
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
|
|
249
|
+
// Close dropdown on escape key
|
|
250
|
+
document.addEventListener('keydown', (e) => {
|
|
251
|
+
if (e.key === 'Escape' && !profileDropdown.classList.contains('ec-hidden')) {
|
|
252
|
+
profileDropdown.classList.add('ec-hidden');
|
|
253
|
+
profileButton.setAttribute('aria-expanded', 'false');
|
|
254
|
+
profileButton.focus();
|
|
255
|
+
}
|
|
256
|
+
});
|
|
255
257
|
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
258
|
+
document.getElementById('signout-btn')?.addEventListener('click', async () => {
|
|
259
|
+
await signOut();
|
|
260
|
+
});
|
|
261
|
+
}
|
|
259
262
|
}
|
|
263
|
+
|
|
264
|
+
// Initialize on first load
|
|
265
|
+
initializeHeader();
|
|
266
|
+
|
|
267
|
+
// Re-initialize after Astro view transitions (needed because of transition:persist on header)
|
|
268
|
+
document.addEventListener('astro:page-load', initializeHeader);
|
|
260
269
|
</script>
|
|
261
270
|
|
|
262
271
|
<style>
|
|
272
|
+
/* Custom class for toggling dropdowns/menus */
|
|
273
|
+
.ec-hidden {
|
|
274
|
+
display: none !important;
|
|
275
|
+
}
|
|
276
|
+
|
|
263
277
|
@media (max-width: 768px) {
|
|
264
278
|
nav {
|
|
265
279
|
transition: all 0.3s ease-out;
|
|
@@ -271,7 +285,7 @@ const repositoryUrl = catalog?.repositoryUrl || 'https://github.com/event-catalo
|
|
|
271
285
|
overflow: hidden;
|
|
272
286
|
}
|
|
273
287
|
|
|
274
|
-
#mobile-menu:not(.hidden) {
|
|
288
|
+
#mobile-menu:not(.ec-hidden) {
|
|
275
289
|
max-height: 500px; /* Adjust this value as needed */
|
|
276
290
|
}
|
|
277
291
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
import path from 'path';
|
|
1
|
+
import { resourceFileExists, readResourceFile, getResourceFilePath } from '@utils/resource-files';
|
|
3
2
|
|
|
4
|
-
const File = ({ file,
|
|
3
|
+
const File = ({ file, filePath, title }: any) => {
|
|
5
4
|
try {
|
|
6
|
-
const
|
|
5
|
+
const item = { filePath };
|
|
6
|
+
const exists = resourceFileExists(item, file);
|
|
7
7
|
|
|
8
8
|
if (exists) {
|
|
9
|
-
const text =
|
|
9
|
+
const text = readResourceFile(item, file);
|
|
10
10
|
return (
|
|
11
11
|
<div className="not-prose">
|
|
12
12
|
<pre className="expressive-code" data-language="json">
|
|
@@ -23,7 +23,7 @@ const File = ({ file, catalog, title }: any) => {
|
|
|
23
23
|
</code>
|
|
24
24
|
</pre>
|
|
25
25
|
<div className="copy">
|
|
26
|
-
<button title="Copy to clipboard" data-copied="Copied!" data-code={text}>
|
|
26
|
+
<button title="Copy to clipboard" data-copied="Copied!" data-code={text ?? ''}>
|
|
27
27
|
<div></div>
|
|
28
28
|
</button>
|
|
29
29
|
</div>
|
|
@@ -32,7 +32,7 @@ const File = ({ file, catalog, title }: any) => {
|
|
|
32
32
|
</div>
|
|
33
33
|
);
|
|
34
34
|
} else {
|
|
35
|
-
return <div className="italic">Tried to load file from {
|
|
35
|
+
return <div className="italic">Tried to load file from {getResourceFilePath(item, file)}, but no file can be found</div>;
|
|
36
36
|
}
|
|
37
37
|
} catch (error) {
|
|
38
38
|
console.log('Failed to load file', error);
|
|
@@ -1,20 +1,17 @@
|
|
|
1
1
|
---
|
|
2
2
|
import fs from 'fs';
|
|
3
|
-
import path from 'path';
|
|
4
3
|
import { Code } from 'astro-expressive-code/components';
|
|
5
4
|
import { getAbsoluteFilePathForAstroFile } from '@utils/files';
|
|
5
|
+
import { getResourceFilePath } from '@utils/resource-files';
|
|
6
6
|
|
|
7
7
|
interface Props {
|
|
8
8
|
file?: string;
|
|
9
|
-
catalog: {
|
|
10
|
-
filePath: string;
|
|
11
|
-
};
|
|
12
9
|
title?: string;
|
|
13
10
|
filePath: string;
|
|
14
11
|
lang?: string;
|
|
15
12
|
}
|
|
16
13
|
|
|
17
|
-
const { file = 'schema.json',
|
|
14
|
+
const { file = 'schema.json', title, filePath, lang = 'json' } = Astro.props;
|
|
18
15
|
|
|
19
16
|
let code: string | null = null;
|
|
20
17
|
|
|
@@ -32,6 +29,6 @@ if (exists) {
|
|
|
32
29
|
<Code code={code} title={title || file} lang={lang} />
|
|
33
30
|
</div>
|
|
34
31
|
) : (
|
|
35
|
-
<div class="italic">Tried to load schema from {
|
|
32
|
+
<div class="italic">Tried to load schema from {getResourceFilePath({ filePath }, file)}, but no schema can be found</div>
|
|
36
33
|
)
|
|
37
34
|
}
|
|
@@ -564,13 +564,8 @@ nodeGraphs.push({
|
|
|
564
564
|
}
|
|
565
565
|
</style>
|
|
566
566
|
|
|
567
|
-
<script define:vars={{
|
|
568
|
-
// Fix to pass information to componets that are client side only
|
|
569
|
-
// and require catalog information
|
|
567
|
+
<script define:vars={{ config }}>
|
|
570
568
|
window.eventcatalog = {};
|
|
571
|
-
// @ts-ignore
|
|
572
|
-
window.eventcatalog[`${props.collection}-${props.data.id}`] = props.catalog;
|
|
573
|
-
|
|
574
569
|
window.eventcatalog.mermaid = config.mermaid;
|
|
575
570
|
</script>
|
|
576
571
|
|
|
@@ -17,7 +17,7 @@ export const getStaticPaths = Page.getStaticPaths;
|
|
|
17
17
|
const props = await Page.getData(Astro);
|
|
18
18
|
|
|
19
19
|
// @ts-ignore
|
|
20
|
-
const { collection, data,
|
|
20
|
+
const { collection, data, filePath, filename, path: relativeSpecPath } = props;
|
|
21
21
|
const fileName = filename || 'openapi.yml';
|
|
22
22
|
|
|
23
23
|
const pathToSpec = getAbsoluteFilePathForAstroFile(filePath, fileName);
|
|
@@ -59,7 +59,7 @@ if (isRemote) {
|
|
|
59
59
|
<DocumentMinusIcon className="mx-auto h-12 w-12 text-gray-400" />
|
|
60
60
|
<h3 class="mt-2 text-sm font-semibold text-gray-900">No OpenAPI spec file found</h3>
|
|
61
61
|
<p class="mt-1 text-xs text-gray-400">
|
|
62
|
-
Could not find OpenAPI file for {data.name} in {`/${
|
|
62
|
+
Could not find OpenAPI file for {data.name} in {`/${collection}/${data.id}`}
|
|
63
63
|
</p>
|
|
64
64
|
</div>
|
|
65
65
|
) : (
|
|
@@ -1,21 +1,11 @@
|
|
|
1
1
|
import { getCollection } from 'astro:content';
|
|
2
2
|
import type { CollectionEntry } from 'astro:content';
|
|
3
|
-
import path from 'path';
|
|
4
3
|
import { getItemsFromCollectionByIdAndSemverOrLatest, createVersionedMap, satisfies } from './util';
|
|
5
4
|
import type { CollectionMessageTypes } from '@types';
|
|
6
|
-
import utils from '@eventcatalog/sdk';
|
|
7
5
|
|
|
8
|
-
const PROJECT_DIR = process.env.PROJECT_DIR || process.cwd();
|
|
9
6
|
const CACHE_ENABLED = process.env.DISABLE_EVENTCATALOG_CACHE !== 'true';
|
|
10
7
|
|
|
11
|
-
type Channel = CollectionEntry<'channels'
|
|
12
|
-
catalog: {
|
|
13
|
-
path: string;
|
|
14
|
-
filePath: string;
|
|
15
|
-
type: string;
|
|
16
|
-
publicPath: string;
|
|
17
|
-
};
|
|
18
|
-
};
|
|
8
|
+
type Channel = CollectionEntry<'channels'>;
|
|
19
9
|
|
|
20
10
|
interface Props {
|
|
21
11
|
getAllVersions?: boolean;
|
|
@@ -74,8 +64,6 @@ export const getChannels = async ({ getAllVersions = true }: Props = {}): Promis
|
|
|
74
64
|
return true;
|
|
75
65
|
});
|
|
76
66
|
|
|
77
|
-
const { getResourceFolderName } = utils(process.env.PROJECT_DIR ?? '');
|
|
78
|
-
|
|
79
67
|
// 5. Enrich channels
|
|
80
68
|
const processedChannels = await Promise.all(
|
|
81
69
|
targetChannels.map(async (channel) => {
|
|
@@ -105,13 +93,6 @@ export const getChannels = async ({ getAllVersions = true }: Props = {}): Promis
|
|
|
105
93
|
};
|
|
106
94
|
});
|
|
107
95
|
|
|
108
|
-
const folderName = await getResourceFolderName(
|
|
109
|
-
process.env.PROJECT_DIR ?? '',
|
|
110
|
-
channel.data.id,
|
|
111
|
-
channel.data.version.toString()
|
|
112
|
-
);
|
|
113
|
-
const channelFolderName = folderName ?? channel.id.replace(`-${channel.data.version}`, '');
|
|
114
|
-
|
|
115
96
|
return {
|
|
116
97
|
...channel,
|
|
117
98
|
data: {
|
|
@@ -120,12 +101,6 @@ export const getChannels = async ({ getAllVersions = true }: Props = {}): Promis
|
|
|
120
101
|
latestVersion,
|
|
121
102
|
messages,
|
|
122
103
|
},
|
|
123
|
-
catalog: {
|
|
124
|
-
path: path.join(channel.collection, channel.id.replace('/index.mdx', '')),
|
|
125
|
-
filePath: path.join(process.cwd(), 'src', 'catalog-files', channel.collection, channel.id.replace('/index.mdx', '')),
|
|
126
|
-
publicPath: path.join('/generated', channel.collection, channelFolderName),
|
|
127
|
-
type: 'event',
|
|
128
|
-
},
|
|
129
104
|
};
|
|
130
105
|
})
|
|
131
106
|
);
|
|
@@ -1,21 +1,11 @@
|
|
|
1
1
|
import { getCollection } from 'astro:content';
|
|
2
2
|
import type { CollectionEntry } from 'astro:content';
|
|
3
|
-
import path from 'path';
|
|
4
3
|
import { createVersionedMap } from './util';
|
|
5
|
-
import {
|
|
6
|
-
import utils from '@eventcatalog/sdk';
|
|
4
|
+
import { buildProducerConsumerIndex, lookupProducersAndConsumers } from './messages';
|
|
7
5
|
|
|
8
|
-
const PROJECT_DIR = process.env.PROJECT_DIR || process.cwd();
|
|
9
6
|
const CACHE_ENABLED = process.env.DISABLE_EVENTCATALOG_CACHE !== 'true';
|
|
10
7
|
|
|
11
|
-
type Command = CollectionEntry<'commands'
|
|
12
|
-
catalog: {
|
|
13
|
-
path: string;
|
|
14
|
-
filePath: string;
|
|
15
|
-
type: string;
|
|
16
|
-
publicPath: string;
|
|
17
|
-
};
|
|
18
|
-
};
|
|
8
|
+
type Command = CollectionEntry<'commands'>;
|
|
19
9
|
|
|
20
10
|
interface Props {
|
|
21
11
|
getAllVersions?: boolean;
|
|
@@ -45,6 +35,18 @@ export const getCommands = async ({ getAllVersions = true, hydrateServices = tru
|
|
|
45
35
|
|
|
46
36
|
// 2. Build optimized maps
|
|
47
37
|
const commandMap = createVersionedMap(allCommands);
|
|
38
|
+
const pcIndex = buildProducerConsumerIndex(allServices, allDataProducts);
|
|
39
|
+
|
|
40
|
+
// Build channel lookup map: channelId → channel entries
|
|
41
|
+
const channelById = new Map<string, typeof allChannels>();
|
|
42
|
+
for (const ch of allChannels) {
|
|
43
|
+
let list = channelById.get(ch.data.id);
|
|
44
|
+
if (!list) {
|
|
45
|
+
list = [];
|
|
46
|
+
channelById.set(ch.data.id, list);
|
|
47
|
+
}
|
|
48
|
+
list.push(ch);
|
|
49
|
+
}
|
|
48
50
|
|
|
49
51
|
// 3. Filter commands
|
|
50
52
|
const targetCommands = allCommands.filter((command) => {
|
|
@@ -53,8 +55,6 @@ export const getCommands = async ({ getAllVersions = true, hydrateServices = tru
|
|
|
53
55
|
return true;
|
|
54
56
|
});
|
|
55
57
|
|
|
56
|
-
const { getResourceFolderName } = utils(process.env.PROJECT_DIR ?? '');
|
|
57
|
-
|
|
58
58
|
// 4. Enrich commands
|
|
59
59
|
const processedCommands = await Promise.all(
|
|
60
60
|
targetCommands.map(async (command) => {
|
|
@@ -63,41 +63,27 @@ export const getCommands = async ({ getAllVersions = true, hydrateServices = tru
|
|
|
63
63
|
const latestVersion = commandVersions[0]?.data.version || command.data.version;
|
|
64
64
|
const versions = commandVersions.map((e) => e.data.version);
|
|
65
65
|
|
|
66
|
-
// Find producers and consumers
|
|
67
|
-
const { producers, consumers } =
|
|
66
|
+
// Find producers and consumers via reverse index
|
|
67
|
+
const { producers, consumers } = lookupProducersAndConsumers({
|
|
68
68
|
message: { data: { ...command.data, latestVersion } },
|
|
69
|
-
|
|
70
|
-
dataProducts: allDataProducts,
|
|
69
|
+
index: pcIndex,
|
|
71
70
|
hydrate: hydrateServices,
|
|
72
71
|
});
|
|
73
72
|
|
|
74
|
-
// Find Channels
|
|
73
|
+
// Find Channels via map lookup
|
|
75
74
|
const messageChannels = command.data.channels || [];
|
|
76
|
-
const channelsForCommand =
|
|
77
|
-
|
|
78
|
-
const folderName = await getResourceFolderName(
|
|
79
|
-
process.env.PROJECT_DIR ?? '',
|
|
80
|
-
command.data.id,
|
|
81
|
-
command.data.version.toString()
|
|
82
|
-
);
|
|
83
|
-
const commandFolderName = folderName ?? command.id.replace(`-${command.data.version}`, '');
|
|
75
|
+
const channelsForCommand = messageChannels.flatMap((channel) => channelById.get(channel.id) || []);
|
|
84
76
|
|
|
85
77
|
return {
|
|
86
78
|
...command,
|
|
87
79
|
data: {
|
|
88
80
|
...command.data,
|
|
89
81
|
messageChannels: channelsForCommand,
|
|
90
|
-
producers: producers as any,
|
|
82
|
+
producers: producers as any,
|
|
91
83
|
consumers: consumers as any,
|
|
92
84
|
versions,
|
|
93
85
|
latestVersion,
|
|
94
86
|
},
|
|
95
|
-
catalog: {
|
|
96
|
-
path: path.join(command.collection, command.id.replace('/index.mdx', '')),
|
|
97
|
-
filePath: path.join(process.cwd(), 'src', 'catalog-files', command.collection, command.id.replace('/index.mdx', '')),
|
|
98
|
-
publicPath: path.join('/generated', command.collection, commandFolderName),
|
|
99
|
-
type: 'command',
|
|
100
|
-
},
|
|
101
87
|
};
|
|
102
88
|
})
|
|
103
89
|
);
|
|
@@ -1,19 +1,9 @@
|
|
|
1
1
|
import { getCollection } from 'astro:content';
|
|
2
2
|
import type { CollectionEntry } from 'astro:content';
|
|
3
|
-
import path from 'path';
|
|
4
3
|
import { createVersionedMap, satisfies } from './util';
|
|
5
|
-
import utils from '@eventcatalog/sdk';
|
|
6
4
|
|
|
7
|
-
const PROJECT_DIR = process.env.PROJECT_DIR || process.cwd();
|
|
8
5
|
const CACHE_ENABLED = process.env.DISABLE_EVENTCATALOG_CACHE !== 'true';
|
|
9
|
-
export type Entity = CollectionEntry<'containers'
|
|
10
|
-
catalog: {
|
|
11
|
-
path: string;
|
|
12
|
-
filePath: string;
|
|
13
|
-
type: string;
|
|
14
|
-
publicPath: string;
|
|
15
|
-
};
|
|
16
|
-
};
|
|
6
|
+
export type Entity = CollectionEntry<'containers'>;
|
|
17
7
|
|
|
18
8
|
interface Props {
|
|
19
9
|
getAllVersions?: boolean;
|
|
@@ -48,8 +38,6 @@ export const getContainers = async ({ getAllVersions = true }: Props = {}): Prom
|
|
|
48
38
|
return true;
|
|
49
39
|
});
|
|
50
40
|
|
|
51
|
-
const { getResourceFolderName } = utils(process.env.PROJECT_DIR ?? '');
|
|
52
|
-
|
|
53
41
|
// 4. Enrich containers
|
|
54
42
|
const processedContainers = await Promise.all(
|
|
55
43
|
targetContainers.map(async (container) => {
|
|
@@ -97,13 +85,6 @@ export const getContainers = async ({ getAllVersions = true }: Props = {}): Prom
|
|
|
97
85
|
// Combine references
|
|
98
86
|
const servicesThatReferenceContainer = [...new Set([...servicesThatWriteToContainer, ...servicesThatReadFromContainer])];
|
|
99
87
|
|
|
100
|
-
const folderName = await getResourceFolderName(
|
|
101
|
-
process.env.PROJECT_DIR ?? '',
|
|
102
|
-
container.data.id,
|
|
103
|
-
container.data.version.toString()
|
|
104
|
-
);
|
|
105
|
-
const containerFolderName = folderName ?? container.id.replace(`-${container.data.version}`, '');
|
|
106
|
-
|
|
107
88
|
return {
|
|
108
89
|
...container,
|
|
109
90
|
data: {
|
|
@@ -116,18 +97,6 @@ export const getContainers = async ({ getAllVersions = true }: Props = {}): Prom
|
|
|
116
97
|
dataProductsThatWriteToContainer,
|
|
117
98
|
dataProductsThatReadFromContainer,
|
|
118
99
|
},
|
|
119
|
-
catalog: {
|
|
120
|
-
path: path.join(container.collection, container.id.replace('/index.mdx', '')),
|
|
121
|
-
filePath: path.join(
|
|
122
|
-
process.cwd(),
|
|
123
|
-
'src',
|
|
124
|
-
'catalog-files',
|
|
125
|
-
container.collection,
|
|
126
|
-
container.id.replace('/index.mdx', '')
|
|
127
|
-
),
|
|
128
|
-
publicPath: path.join('/generated', container.collection, containerFolderName),
|
|
129
|
-
type: 'container',
|
|
130
|
-
},
|
|
131
100
|
};
|
|
132
101
|
})
|
|
133
102
|
);
|