@eventcatalog/core 3.12.9-beta.0 → 3.13.0-beta.1

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 (37) 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-EDX2LGRV.js → chunk-7RCUF3VG.js} +1 -1
  6. package/dist/{chunk-RJOB6XEC.js → chunk-AY2OEUWV.js} +1 -1
  7. package/dist/{chunk-WTCJKTEF.js → chunk-NXATPLVB.js} +1 -1
  8. package/dist/{chunk-V7YMKA4P.js → chunk-V3GX7FC3.js} +1 -1
  9. package/dist/{chunk-2UUS3AQ2.js → chunk-VXTATPGX.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/MDX/File.tsx +7 -7
  19. package/eventcatalog/src/components/MDX/Schema.astro +3 -6
  20. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/index.astro +1 -6
  21. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/spec/[filename].astro +2 -2
  22. package/eventcatalog/src/utils/collections/channels.ts +1 -26
  23. package/eventcatalog/src/utils/collections/commands.ts +1 -26
  24. package/eventcatalog/src/utils/collections/containers.ts +1 -32
  25. package/eventcatalog/src/utils/collections/data-products.ts +1 -19
  26. package/eventcatalog/src/utils/collections/diagrams.ts +0 -7
  27. package/eventcatalog/src/utils/collections/domains.ts +0 -18
  28. package/eventcatalog/src/utils/collections/entities.ts +1 -27
  29. package/eventcatalog/src/utils/collections/events.ts +1 -22
  30. package/eventcatalog/src/utils/collections/flows.ts +0 -8
  31. package/eventcatalog/src/utils/collections/queries.ts +1 -22
  32. package/eventcatalog/src/utils/collections/schemas.ts +9 -4
  33. package/eventcatalog/src/utils/collections/services.ts +0 -20
  34. package/eventcatalog/src/utils/collections/teams.ts +0 -6
  35. package/eventcatalog/src/utils/collections/users.ts +0 -6
  36. package/eventcatalog/src/utils/collections/util.ts +10 -1
  37. package/package.json +4 -4
@@ -37,7 +37,7 @@ var import_axios = __toESM(require("axios"), 1);
37
37
  var import_os = __toESM(require("os"), 1);
38
38
 
39
39
  // package.json
40
- var version = "3.12.9-beta.0";
40
+ var version = "3.13.0-beta.1";
41
41
 
42
42
  // src/constants.ts
43
43
  var VERSION = version;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  raiseEvent
3
- } from "../chunk-WTCJKTEF.js";
4
- import "../chunk-2UUS3AQ2.js";
3
+ } from "../chunk-NXATPLVB.js";
4
+ import "../chunk-VXTATPGX.js";
5
5
  export {
6
6
  raiseEvent
7
7
  };
@@ -106,7 +106,7 @@ var import_axios = __toESM(require("axios"), 1);
106
106
  var import_os = __toESM(require("os"), 1);
107
107
 
108
108
  // package.json
109
- var version = "3.12.9-beta.0";
109
+ var version = "3.13.0-beta.1";
110
110
 
111
111
  // src/constants.ts
112
112
  var VERSION = version;
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  log_build_default
3
- } from "../chunk-V7YMKA4P.js";
4
- import "../chunk-WTCJKTEF.js";
3
+ } from "../chunk-V3GX7FC3.js";
4
+ import "../chunk-NXATPLVB.js";
5
5
  import "../chunk-4UVFXLPI.js";
6
- import "../chunk-2UUS3AQ2.js";
6
+ import "../chunk-VXTATPGX.js";
7
7
  import "../chunk-UPONRQSN.js";
8
8
  export {
9
9
  log_build_default as default
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VERSION
3
- } from "./chunk-2UUS3AQ2.js";
3
+ } from "./chunk-VXTATPGX.js";
4
4
 
5
5
  // src/utils/cli-logger.ts
6
6
  import pc from "picocolors";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  logger
3
- } from "./chunk-EDX2LGRV.js";
3
+ } from "./chunk-7RCUF3VG.js";
4
4
  import {
5
5
  cleanup,
6
6
  getEventCatalogConfigFile
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VERSION
3
- } from "./chunk-2UUS3AQ2.js";
3
+ } from "./chunk-VXTATPGX.js";
4
4
 
5
5
  // src/analytics/analytics.js
6
6
  import axios from "axios";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  raiseEvent
3
- } from "./chunk-WTCJKTEF.js";
3
+ } from "./chunk-NXATPLVB.js";
4
4
  import {
5
5
  countResources,
6
6
  serializeCounts
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "3.12.9-beta.0";
2
+ var version = "3.13.0-beta.1";
3
3
 
4
4
  // src/constants.ts
5
5
  var VERSION = version;
@@ -25,7 +25,7 @@ __export(constants_exports, {
25
25
  module.exports = __toCommonJS(constants_exports);
26
26
 
27
27
  // package.json
28
- var version = "3.12.9-beta.0";
28
+ var version = "3.13.0-beta.1";
29
29
 
30
30
  // src/constants.ts
31
31
  var VERSION = version;
package/dist/constants.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VERSION
3
- } from "./chunk-2UUS3AQ2.js";
3
+ } from "./chunk-VXTATPGX.js";
4
4
  export {
5
5
  VERSION
6
6
  };
@@ -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.12.9-beta.0";
112
+ var version = "3.13.0-beta.1";
113
113
 
114
114
  // src/constants.ts
115
115
  var VERSION = version;
@@ -6,8 +6,8 @@ import {
6
6
  } from "./chunk-PLNJC7NZ.js";
7
7
  import {
8
8
  log_build_default
9
- } from "./chunk-V7YMKA4P.js";
10
- import "./chunk-WTCJKTEF.js";
9
+ } from "./chunk-V3GX7FC3.js";
10
+ import "./chunk-NXATPLVB.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-RJOB6XEC.js";
25
+ } from "./chunk-AY2OEUWV.js";
26
26
  import {
27
27
  logger
28
- } from "./chunk-EDX2LGRV.js";
28
+ } from "./chunk-7RCUF3VG.js";
29
29
  import {
30
30
  VERSION
31
- } from "./chunk-2UUS3AQ2.js";
31
+ } from "./chunk-VXTATPGX.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.12.9-beta.0";
76
+ var version = "3.13.0-beta.1";
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-RJOB6XEC.js";
4
- import "./chunk-EDX2LGRV.js";
5
- import "./chunk-2UUS3AQ2.js";
3
+ } from "./chunk-AY2OEUWV.js";
4
+ import "./chunk-7RCUF3VG.js";
5
+ import "./chunk-VXTATPGX.js";
6
6
  import "./chunk-UPONRQSN.js";
7
7
  export {
8
8
  generate
@@ -36,7 +36,7 @@ module.exports = __toCommonJS(cli_logger_exports);
36
36
  var import_picocolors = __toESM(require("picocolors"), 1);
37
37
 
38
38
  // package.json
39
- var version = "3.12.9-beta.0";
39
+ var version = "3.13.0-beta.1";
40
40
 
41
41
  // src/constants.ts
42
42
  var VERSION = version;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  logger
3
- } from "../chunk-EDX2LGRV.js";
4
- import "../chunk-2UUS3AQ2.js";
3
+ } from "../chunk-7RCUF3VG.js";
4
+ import "../chunk-VXTATPGX.js";
5
5
  export {
6
6
  logger
7
7
  };
@@ -1,12 +1,12 @@
1
- import fs from 'fs';
2
- import path from 'path';
1
+ import { resourceFileExists, readResourceFile, getResourceFilePath } from '@utils/resource-files';
3
2
 
4
- const File = ({ file, catalog, title }: any) => {
3
+ const File = ({ file, filePath, title }: any) => {
5
4
  try {
6
- const exists = fs.existsSync(path.join(catalog.filePath, file));
5
+ const item = { filePath };
6
+ const exists = resourceFileExists(item, file);
7
7
 
8
8
  if (exists) {
9
- const text = fs.readFileSync(path.join(catalog.filePath, file), 'utf-8');
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 {path.join(catalog.filePath, file)}, but no file can be found</div>;
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', catalog, title, filePath, lang = 'json' } = Astro.props;
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 {path.join(catalog.filePath, file)}, but no schema can be found</div>
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={{ props, config }}>
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, catalog, filePath, filename, path: relativeSpecPath } = props;
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 {`/${catalog.path}`}
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
4
  import { hydrateProducersAndConsumers } from './messages';
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 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;
@@ -53,8 +43,6 @@ export const getCommands = async ({ getAllVersions = true, hydrateServices = tru
53
43
  return true;
54
44
  });
55
45
 
56
- const { getResourceFolderName } = utils(process.env.PROJECT_DIR ?? '');
57
-
58
46
  // 4. Enrich commands
59
47
  const processedCommands = await Promise.all(
60
48
  targetCommands.map(async (command) => {
@@ -75,13 +63,6 @@ export const getCommands = async ({ getAllVersions = true, hydrateServices = tru
75
63
  const messageChannels = command.data.channels || [];
76
64
  const channelsForCommand = allChannels.filter((c) => messageChannels.some((channel) => c.data.id === channel.id));
77
65
 
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}`, '');
84
-
85
66
  return {
86
67
  ...command,
87
68
  data: {
@@ -92,12 +73,6 @@ export const getCommands = async ({ getAllVersions = true, hydrateServices = tru
92
73
  versions,
93
74
  latestVersion,
94
75
  },
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
76
  };
102
77
  })
103
78
  );
@@ -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
  );
@@ -1,18 +1,8 @@
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
4
 
6
- const PROJECT_DIR = process.env.PROJECT_DIR || process.cwd();
7
-
8
- export type DataProduct = CollectionEntry<'data-products'> & {
9
- catalog: {
10
- path: string;
11
- filePath: string;
12
- type: string;
13
- publicPath: string;
14
- };
15
- };
5
+ export type DataProduct = CollectionEntry<'data-products'>;
16
6
 
17
7
  interface Props {
18
8
  getAllVersions?: boolean;
@@ -53,8 +43,6 @@ export const getDataProducts = async ({ getAllVersions = true }: Props = {}): Pr
53
43
  })
54
44
  );
55
45
 
56
- const dataProductFolderName = dataProduct.id.replace('/index.mdx', '');
57
-
58
46
  return {
59
47
  ...dataProduct,
60
48
  data: {
@@ -63,12 +51,6 @@ export const getDataProducts = async ({ getAllVersions = true }: Props = {}): Pr
63
51
  latestVersion,
64
52
  domains: domainsThatReferenceDataProduct,
65
53
  },
66
- catalog: {
67
- path: path.join(dataProduct.collection, dataProductFolderName),
68
- filePath: path.join(process.cwd(), 'src', 'catalog-files', dataProduct.collection, dataProductFolderName),
69
- publicPath: path.join('/generated', dataProduct.collection, dataProductFolderName),
70
- type: 'dataProduct',
71
- },
72
54
  };
73
55
  })
74
56
  );
@@ -1,6 +1,5 @@
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 '@utils/collections/util';
5
4
 
6
5
  const CACHE_ENABLED = process.env.DISABLE_EVENTCATALOG_CACHE !== 'true';
@@ -44,12 +43,6 @@ export const getDiagrams = async ({ getAllVersions = true }: Props = {}): Promis
44
43
  versions,
45
44
  latestVersion,
46
45
  },
47
- catalog: {
48
- path: path.join(diagram.collection, diagram.id.replace('/index.mdx', '')),
49
- filePath: path.join(process.cwd(), 'src', 'catalog-files', diagram.collection, diagram.id.replace('/index.mdx', '')),
50
- publicPath: path.join('/generated', diagram.collection),
51
- type: 'diagram',
52
- },
53
46
  };
54
47
  });
55
48
 
@@ -3,10 +3,8 @@ import type { CollectionEntry } from 'astro:content';
3
3
  import path from 'path';
4
4
  import type { CollectionMessageTypes } from '@types';
5
5
  import type { Service } from './types';
6
- import utils from '@eventcatalog/sdk';
7
6
  import { createVersionedMap, findInMap, processSpecifications } from '@utils/collections/util';
8
7
 
9
- const PROJECT_DIR = process.env.PROJECT_DIR || process.cwd();
10
8
  const CACHE_ENABLED = process.env.DISABLE_EVENTCATALOG_CACHE !== 'true';
11
9
 
12
10
  export type Domain = CollectionEntry<'domains'>;
@@ -113,8 +111,6 @@ export const getDomains = async ({
113
111
  return true;
114
112
  });
115
113
 
116
- const { getResourceFolderName } = utils(process.env.PROJECT_DIR ?? '');
117
-
118
114
  // 4. Process domains using Map lookups (O(1))
119
115
  const processedDomains = await Promise.all(
120
116
  targetDomains.map(async (domain: Domain) => {
@@ -204,14 +200,6 @@ export const getDomains = async ({
204
200
  .map((m: { id: string; version: string | undefined }) => findInMap(messageMap, m.id, m.version))
205
201
  .filter((e): e is CollectionEntry<CollectionMessageTypes> => !!e);
206
202
 
207
- // Calculate folder paths
208
- const folderName = await getResourceFolderName(
209
- process.env.PROJECT_DIR ?? '',
210
- domain.data.id,
211
- domain.data.version?.toString()
212
- );
213
- const domainFolderName = folderName ?? domain.id.replace(`-${domain.data.version}`, '');
214
-
215
203
  return {
216
204
  ...domain,
217
205
  data: {
@@ -226,12 +214,6 @@ export const getDomains = async ({
226
214
  latestVersion,
227
215
  versions,
228
216
  },
229
- catalog: {
230
- path: path.join(domain.collection, domain.id.replace('/index.mdx', '')),
231
- filePath: path.join(process.cwd(), 'src', 'catalog-files', domain.collection, domain.id.replace('/index.mdx', '')),
232
- publicPath: path.join('/generated', domain.collection, domainFolderName),
233
- type: 'service',
234
- },
235
217
  };
236
218
  })
237
219
  );
@@ -1,19 +1,8 @@
1
1
  import { getCollection } from 'astro:content';
2
2
  import type { CollectionEntry } from 'astro:content';
3
- import path from 'path';
4
- import utils from '@eventcatalog/sdk';
5
3
  import { createVersionedMap, satisfies } from './util';
6
4
 
7
- const PROJECT_DIR = process.env.PROJECT_DIR || process.cwd();
8
-
9
- export type Entity = CollectionEntry<'entities'> & {
10
- catalog: {
11
- path: string;
12
- filePath: string;
13
- type: string;
14
- publicPath: string;
15
- };
16
- };
5
+ export type Entity = CollectionEntry<'entities'>;
17
6
 
18
7
  interface Props {
19
8
  getAllVersions?: boolean;
@@ -48,8 +37,6 @@ export const getEntities = async ({ getAllVersions = true }: Props = {}): Promis
48
37
  return true;
49
38
  });
50
39
 
51
- const { getResourceFolderName } = utils(process.env.PROJECT_DIR ?? '');
52
-
53
40
  // 4. Enrich entities
54
41
  const processedEntities = await Promise.all(
55
42
  targetEntities.map(async (entity) => {
@@ -76,13 +63,6 @@ export const getEntities = async ({ getAllVersions = true }: Props = {}): Promis
76
63
  })
77
64
  );
78
65
 
79
- const folderName = await getResourceFolderName(
80
- process.env.PROJECT_DIR ?? '',
81
- entity.data.id,
82
- entity.data.version.toString()
83
- );
84
- const entityFolderName = folderName ?? entity.id.replace(`-${entity.data.version}`, '');
85
-
86
66
  return {
87
67
  ...entity,
88
68
  data: {
@@ -92,12 +72,6 @@ export const getEntities = async ({ getAllVersions = true }: Props = {}): Promis
92
72
  services: servicesThatReferenceEntity,
93
73
  domains: domainsThatReferenceEntity,
94
74
  },
95
- catalog: {
96
- path: path.join(entity.collection, entity.id.replace('/index.mdx', '')),
97
- filePath: path.join(process.cwd(), 'src', 'catalog-files', entity.collection, entity.id.replace('/index.mdx', '')),
98
- publicPath: path.join('/generated', entity.collection, entityFolderName),
99
- type: 'entity',
100
- },
101
75
  };
102
76
  })
103
77
  );
@@ -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
4
  import { hydrateProducersAndConsumers } from './messages';
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 Event = CollectionEntry<'events'> & {
12
- catalog: {
13
- path: string;
14
- filePath: string;
15
- type: string;
16
- publicPath: string;
17
- };
18
- };
8
+ type Event = CollectionEntry<'events'>;
19
9
 
20
10
  interface Props {
21
11
  getAllVersions?: boolean;
@@ -56,8 +46,6 @@ export const getEvents = async ({ getAllVersions = true, hydrateServices = true
56
46
  return true;
57
47
  });
58
48
 
59
- const { getResourceFolderName } = utils(process.env.PROJECT_DIR ?? '');
60
-
61
49
  // 4. Enrich events
62
50
  const processedEvents = await Promise.all(
63
51
  targetEvents.map(async (event) => {
@@ -81,9 +69,6 @@ export const getEvents = async ({ getAllVersions = true, hydrateServices = true
81
69
  // Given the logic is simply ID match, we can use a Set or Map if needed, but array filter is likely fine for now unless M is huge.
82
70
  const channelsForEvent = allChannels.filter((c) => messageChannels.some((channel) => c.data.id === channel.id));
83
71
 
84
- const folderName = await getResourceFolderName(process.env.PROJECT_DIR ?? '', event.data.id, event.data.version.toString());
85
- const eventFolderName = folderName ?? event.id.replace(`-${event.data.version}`, '');
86
-
87
72
  return {
88
73
  ...event,
89
74
  data: {
@@ -94,12 +79,6 @@ export const getEvents = async ({ getAllVersions = true, hydrateServices = true
94
79
  versions,
95
80
  latestVersion,
96
81
  },
97
- catalog: {
98
- path: path.join(event.collection, event.id.replace('/index.mdx', '')),
99
- filePath: path.join(process.cwd(), 'src', 'catalog-files', event.collection, event.id.replace('/index.mdx', '')),
100
- publicPath: path.join('/generated', event.collection, eventFolderName),
101
- type: 'event',
102
- },
103
82
  };
104
83
  })
105
84
  );
@@ -1,11 +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, findInMap } from '@utils/collections/util';
5
4
  import { getDomains } from './domains';
6
5
  import { getServices } from './services';
7
6
 
8
- const PROJECT_DIR = process.env.PROJECT_DIR || process.cwd();
9
7
  const CACHE_ENABLED = process.env.DISABLE_EVENTCATALOG_CACHE !== 'true';
10
8
  export type Flow = CollectionEntry<'flows'>;
11
9
 
@@ -74,12 +72,6 @@ export const getFlows = async ({ getAllVersions = true }: Props = {}): Promise<F
74
72
  versions,
75
73
  latestVersion,
76
74
  },
77
- catalog: {
78
- path: path.join(flow.collection, flow.id.replace('/index.mdx', '')),
79
- filePath: path.join(process.cwd(), 'src', 'catalog-files', flow.collection, flow.id.replace('/index.mdx', '')),
80
- publicPath: path.join('/generated', flow.collection),
81
- type: 'flow',
82
- },
83
75
  };
84
76
  });
85
77
 
@@ -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
- import utils from '@eventcatalog/sdk';
5
3
  import { createVersionedMap } from './util';
6
4
  import { hydrateProducersAndConsumers } 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 Query = CollectionEntry<'queries'> & {
12
- catalog: {
13
- path: string;
14
- filePath: string;
15
- type: string;
16
- publicPath: string;
17
- };
18
- };
8
+ type Query = CollectionEntry<'queries'>;
19
9
 
20
10
  interface Props {
21
11
  getAllVersions?: boolean;
@@ -52,8 +42,6 @@ export const getQueries = async ({ getAllVersions = true, hydrateServices = true
52
42
  return true;
53
43
  });
54
44
 
55
- const { getResourceFolderName } = utils(process.env.PROJECT_DIR ?? '');
56
-
57
45
  // 4. Enrich queries
58
46
  const processedQueries = await Promise.all(
59
47
  targetQueries.map(async (query) => {
@@ -74,9 +62,6 @@ export const getQueries = async ({ getAllVersions = true, hydrateServices = true
74
62
  const messageChannels = query.data.channels || [];
75
63
  const channelsForQuery = allChannels.filter((c) => messageChannels.some((channel) => c.data.id === channel.id));
76
64
 
77
- const folderName = await getResourceFolderName(process.env.PROJECT_DIR ?? '', query.data.id, query.data.version.toString());
78
- const queryFolderName = folderName ?? query.id.replace(`-${query.data.version}`, '');
79
-
80
65
  return {
81
66
  ...query,
82
67
  data: {
@@ -87,12 +72,6 @@ export const getQueries = async ({ getAllVersions = true, hydrateServices = true
87
72
  versions,
88
73
  latestVersion,
89
74
  },
90
- catalog: {
91
- path: path.join(query.collection, query.id.replace('/index.mdx', '')),
92
- filePath: path.join(process.cwd(), 'src', 'catalog-files', query.collection, query.id.replace('/index.mdx', '')),
93
- publicPath: path.join('/generated', query.collection, queryFolderName),
94
- type: 'event', // Kept as 'event' to match original file, though likely should be 'query'
95
- },
96
75
  };
97
76
  })
98
77
  );
@@ -3,15 +3,21 @@ import type { PageTypes } from '@types';
3
3
  import path from 'path';
4
4
  import { buildUrl } from '@utils/url-builder';
5
5
  import { getAbsoluteFilePathForAstroFile } from '@utils/files';
6
+ import { getFolderNameFromFilePath } from './util';
6
7
 
7
8
  export type Schema = {
8
9
  url: string;
9
10
  format: string;
10
11
  };
11
12
 
13
+ const getPublicPath = (resource: CollectionEntry<PageTypes>): string | undefined => {
14
+ if (!resource.filePath) return undefined;
15
+ const folderName = getFolderNameFromFilePath(resource.filePath);
16
+ return path.join('/generated', resource.collection, folderName);
17
+ };
18
+
12
19
  export const getSchemaURL = (resource: CollectionEntry<PageTypes>) => {
13
- // @ts-ignore
14
- const publicPath = resource?.catalog?.publicPath;
20
+ const publicPath = getPublicPath(resource);
15
21
  const schemaFilePath = resource?.data?.schemaPath;
16
22
 
17
23
  // No schema file path, return an empty string
@@ -57,8 +63,7 @@ export const getSchemasFromResource = (resource: CollectionEntry<PageTypes>): Sc
57
63
  const graphqlPath = Array.isArray(specifications)
58
64
  ? specifications.find((spec) => spec.type === 'graphql')?.path
59
65
  : specifications?.graphqlPath;
60
- // @ts-ignore
61
- let publicPath = resource?.catalog?.publicPath;
66
+ let publicPath = getPublicPath(resource);
62
67
  const schemas = [];
63
68
 
64
69
  if (asyncapiPath) {
@@ -1,10 +1,7 @@
1
1
  import { getCollection } from 'astro:content';
2
2
  import type { CollectionEntry } from 'astro:content';
3
- import path from 'path';
4
3
  import semver from 'semver';
5
4
  import type { CollectionMessageTypes, CollectionTypes } from '@types';
6
- const PROJECT_DIR = process.env.PROJECT_DIR || process.cwd();
7
- import utils, { type Domain } from '@eventcatalog/sdk';
8
5
  import { getDomains, getDomainsForService } from './domains';
9
6
  import { createVersionedMap, findInMap, processSpecifications } from '@utils/collections/util';
10
7
 
@@ -56,8 +53,6 @@ export const getServices = async ({ getAllVersions = true, returnBody = false }:
56
53
  return true;
57
54
  });
58
55
 
59
- const { getResourceFolderName } = utils(process.env.PROJECT_DIR ?? '');
60
-
61
56
  // 4. Enrich services using Map lookups (O(1))
62
57
  const processedServices = await Promise.all(
63
58
  targetServices.map(async (service) => {
@@ -90,13 +85,6 @@ export const getServices = async ({ getAllVersions = true, returnBody = false }:
90
85
  .map((f) => findInMap(flowMap, f.id, f.version))
91
86
  .filter((f): f is CollectionEntry<'flows'> => !!f);
92
87
 
93
- const folderName = await getResourceFolderName(
94
- process.env.PROJECT_DIR ?? '',
95
- service.data.id,
96
- service.data.version.toString()
97
- );
98
- const serviceFolderName = folderName ?? service.id.replace(`-${service.data.version}`, '');
99
-
100
88
  return {
101
89
  ...service,
102
90
  data: {
@@ -115,14 +103,6 @@ export const getServices = async ({ getAllVersions = true, returnBody = false }:
115
103
  receives: receives as any,
116
104
  sends: sends as any,
117
105
  },
118
- catalog: {
119
- // TODO: avoid use string replace at path due to win32
120
- path: path.join(service.collection, service.id.replace('/index.mdx', '')),
121
- filePath: path.join(process.cwd(), 'src', 'catalog-files', service.collection, service.id.replace('/index.mdx', '')),
122
- // service will be MySerive-0.0.1 remove the version
123
- publicPath: path.join('/generated', service.collection, serviceFolderName),
124
- type: 'service',
125
- },
126
106
  body: returnBody ? service.body : undefined,
127
107
  };
128
108
  })
@@ -1,7 +1,6 @@
1
1
  import type { CollectionTypes } from '@types';
2
2
  import { getCollection } from 'astro:content';
3
3
  import type { CollectionEntry } from 'astro:content';
4
- import path from 'path';
5
4
 
6
5
  export type Team = CollectionEntry<'teams'>;
7
6
  const CACHE_ENABLED = process.env.DISABLE_EVENTCATALOG_CACHE !== 'true';
@@ -74,11 +73,6 @@ export const getTeams = async (): Promise<Team[]> => {
74
73
  ownedQueries,
75
74
  ownedEvents,
76
75
  },
77
- catalog: {
78
- path: path.join(team.collection, team.id.replace('/index.mdx', '')),
79
- filePath: path.join(process.cwd(), 'src', 'catalog-files', team.collection, team.id.replace('/index.mdx', '')),
80
- type: 'team',
81
- },
82
76
  };
83
77
  });
84
78
 
@@ -1,7 +1,6 @@
1
1
  import type { CollectionTypes } from '@types';
2
2
  import { getCollection } from 'astro:content';
3
3
  import type { CollectionEntry } from 'astro:content';
4
- import path from 'path';
5
4
 
6
5
  export type User = CollectionEntry<'users'>;
7
6
 
@@ -102,11 +101,6 @@ export const getUsers = async (): Promise<User[]> => {
102
101
  ownedQueries,
103
102
  associatedTeams,
104
103
  },
105
- catalog: {
106
- path: path.join(user.collection, user.id.replace('/index.mdx', '')),
107
- filePath: path.join(process.cwd(), 'src', 'catalog-files', user.collection, user.id.replace('/index.mdx', '')),
108
- type: 'user',
109
- },
110
104
  };
111
105
  });
112
106
 
@@ -3,6 +3,16 @@ import type { CollectionEntry } from 'astro:content';
3
3
  import semver, { coerce, compare, eq, satisfies as satisfiesRange } from 'semver';
4
4
  import path from 'node:path';
5
5
 
6
+ // --- FILE PATH HELPERS ---
7
+
8
+ /**
9
+ * Extract the folder name from an Astro collection entry's filePath.
10
+ * Replaces the expensive SDK getResourceFolderName which globs + reads every file.
11
+ */
12
+ export const getFolderNameFromFilePath = (filePath: string): string => {
13
+ return path.basename(path.dirname(filePath));
14
+ };
15
+
6
16
  // --- SPECIFICATION HELPERS ---
7
17
 
8
18
  export type SpecificationType = 'asyncapi' | 'openapi' | 'graphql';
@@ -232,7 +242,6 @@ export const removeContentFromCollection = (collection: CollectionEntry<Collecti
232
242
  return collection.map((item) => ({
233
243
  ...item,
234
244
  body: undefined,
235
- catalog: undefined,
236
245
  }));
237
246
  };
238
247
 
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": "3.12.9-beta.0",
9
+ "version": "3.13.0-beta.1",
10
10
  "publishConfig": {
11
11
  "access": "public"
12
12
  },
@@ -101,9 +101,9 @@
101
101
  "update-notifier": "^7.3.1",
102
102
  "uuid": "^10.0.0",
103
103
  "zod": "^3.25.0",
104
- "@eventcatalog/linter": "1.0.3",
105
- "@eventcatalog/visualiser": "^0.0.2-beta.0",
106
- "@eventcatalog/sdk": "2.13.2"
104
+ "@eventcatalog/sdk": "2.13.2",
105
+ "@eventcatalog/visualiser": "^3.12.9-beta.1",
106
+ "@eventcatalog/linter": "1.0.3"
107
107
  },
108
108
  "devDependencies": {
109
109
  "@astrojs/check": "^0.9.6",