@eventcatalog/core 3.3.0 → 3.3.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.
@@ -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.3.0";
40
+ var version = "3.3.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-OAUYXPXT.js";
4
- import "../chunk-NGKYYZZP.js";
3
+ } from "../chunk-LZMHPUTE.js";
4
+ import "../chunk-B5CNGEHG.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.3.0";
109
+ var version = "3.3.1";
110
110
 
111
111
  // src/constants.ts
112
112
  var VERSION = version;
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  log_build_default
3
- } from "../chunk-UPSN5H7S.js";
4
- import "../chunk-OAUYXPXT.js";
5
- import "../chunk-NGKYYZZP.js";
3
+ } from "../chunk-AJ7F2ASU.js";
4
+ import "../chunk-LZMHPUTE.js";
5
+ import "../chunk-B5CNGEHG.js";
6
6
  import "../chunk-UPONRQSN.js";
7
7
  export {
8
8
  log_build_default as default
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  raiseEvent
3
- } from "./chunk-OAUYXPXT.js";
3
+ } from "./chunk-LZMHPUTE.js";
4
4
  import {
5
5
  getEventCatalogConfigFile,
6
6
  verifyRequiredFieldsAreInCatalogConfigFile
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "3.3.0";
2
+ var version = "3.3.1";
3
3
 
4
4
  // src/constants.ts
5
5
  var VERSION = version;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VERSION
3
- } from "./chunk-NGKYYZZP.js";
3
+ } from "./chunk-B5CNGEHG.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-I4CMEOEN.js";
3
+ } from "./chunk-DXXGEMLA.js";
4
4
  import {
5
5
  cleanup,
6
6
  getEventCatalogConfigFile
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VERSION
3
- } from "./chunk-NGKYYZZP.js";
3
+ } from "./chunk-B5CNGEHG.js";
4
4
 
5
5
  // src/analytics/analytics.js
6
6
  import axios from "axios";
@@ -25,7 +25,7 @@ __export(constants_exports, {
25
25
  module.exports = __toCommonJS(constants_exports);
26
26
 
27
27
  // package.json
28
- var version = "3.3.0";
28
+ var version = "3.3.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-NGKYYZZP.js";
3
+ } from "./chunk-B5CNGEHG.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.3.0";
112
+ var version = "3.3.1";
113
113
 
114
114
  // src/constants.ts
115
115
  var VERSION = version;
@@ -843,10 +843,11 @@ var startServerCatalog = ({
843
843
  isEventCatalogStarter = false,
844
844
  isEventCatalogScale = false
845
845
  }) => {
846
+ const serverEntryPath = import_node_path8.default.join(dir, "dist", "server", "entry.mjs");
846
847
  (0, import_node_child_process.execSync)(
847
- `cross-env PROJECT_DIR='${dir}' CATALOG_DIR='${core}' ENABLE_EMBED=${canEmbedPages} EVENTCATALOG_STARTER=${isEventCatalogStarter} EVENTCATALOG_SCALE=${isEventCatalogScale} node ./dist/server/entry.mjs`,
848
+ `cross-env PROJECT_DIR='${dir}' CATALOG_DIR='${core}' ENABLE_EMBED=${canEmbedPages} EVENTCATALOG_STARTER=${isEventCatalogStarter} EVENTCATALOG_SCALE=${isEventCatalogScale} node "${serverEntryPath}"`,
848
849
  {
849
- cwd: dir,
850
+ cwd: core,
850
851
  stdio: "inherit"
851
852
  }
852
853
  );
@@ -6,8 +6,8 @@ import {
6
6
  } from "./chunk-PLNJC7NZ.js";
7
7
  import {
8
8
  log_build_default
9
- } from "./chunk-UPSN5H7S.js";
10
- import "./chunk-OAUYXPXT.js";
9
+ } from "./chunk-AJ7F2ASU.js";
10
+ import "./chunk-LZMHPUTE.js";
11
11
  import {
12
12
  runMigrations
13
13
  } from "./chunk-BH3JMNAV.js";
@@ -21,13 +21,13 @@ import {
21
21
  } from "./chunk-5VBIXL6C.js";
22
22
  import {
23
23
  generate
24
- } from "./chunk-QZF5ZYJB.js";
24
+ } from "./chunk-IFELNUKH.js";
25
25
  import {
26
26
  logger
27
- } from "./chunk-I4CMEOEN.js";
27
+ } from "./chunk-DXXGEMLA.js";
28
28
  import {
29
29
  VERSION
30
- } from "./chunk-NGKYYZZP.js";
30
+ } from "./chunk-B5CNGEHG.js";
31
31
  import "./chunk-UPONRQSN.js";
32
32
 
33
33
  // src/eventcatalog.ts
@@ -235,10 +235,11 @@ var startServerCatalog = ({
235
235
  isEventCatalogStarter = false,
236
236
  isEventCatalogScale = false
237
237
  }) => {
238
+ const serverEntryPath = path.join(dir, "dist", "server", "entry.mjs");
238
239
  execSync(
239
- `cross-env PROJECT_DIR='${dir}' CATALOG_DIR='${core}' ENABLE_EMBED=${canEmbedPages} EVENTCATALOG_STARTER=${isEventCatalogStarter} EVENTCATALOG_SCALE=${isEventCatalogScale} node ./dist/server/entry.mjs`,
240
+ `cross-env PROJECT_DIR='${dir}' CATALOG_DIR='${core}' ENABLE_EMBED=${canEmbedPages} EVENTCATALOG_STARTER=${isEventCatalogStarter} EVENTCATALOG_SCALE=${isEventCatalogScale} node "${serverEntryPath}"`,
240
241
  {
241
- cwd: dir,
242
+ cwd: core,
242
243
  stdio: "inherit"
243
244
  }
244
245
  );
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.3.0";
76
+ var version = "3.3.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-QZF5ZYJB.js";
4
- import "./chunk-I4CMEOEN.js";
5
- import "./chunk-NGKYYZZP.js";
3
+ } from "./chunk-IFELNUKH.js";
4
+ import "./chunk-DXXGEMLA.js";
5
+ import "./chunk-B5CNGEHG.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.3.0";
39
+ var version = "3.3.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-I4CMEOEN.js";
4
- import "../chunk-NGKYYZZP.js";
3
+ } from "../chunk-DXXGEMLA.js";
4
+ import "../chunk-B5CNGEHG.js";
5
5
  export {
6
6
  logger
7
7
  };
@@ -698,12 +698,14 @@ const diagrams = defineCollection({
698
698
  base: projectDirBase,
699
699
  generateId: ({ data }) => `${data.id}-${data.version}`,
700
700
  }),
701
- schema: z.object({
702
- id: z.string(),
703
- name: z.string(),
704
- version: z.string(),
705
- summary: z.string().optional(),
706
- }),
701
+ schema: z
702
+ .object({
703
+ id: z.string(),
704
+ name: z.string(),
705
+ version: z.string(),
706
+ summary: z.string().optional(),
707
+ })
708
+ .merge(baseSchema),
707
709
  });
708
710
 
709
711
  export const collections = {
@@ -9,6 +9,8 @@ import '@asyncapi/react-component/styles/default.min.css';
9
9
  import js from '@asyncapi/react-component/browser/standalone/without-parser.js?url';
10
10
  import { AsyncApiComponentWP, type ConfigInterface } from '@asyncapi/react-component';
11
11
  import VerticalSideBarLayout from '@layouts/VerticalSideBarLayout.astro';
12
+ import CopyAsMarkdown from '@components/CopyAsMarkdown';
13
+ import { isEventCatalogChatEnabled } from '@utils/feature';
12
14
  import Config from '@utils/eventcatalog-config/catalog';
13
15
  import { Page } from './_[filename].data';
14
16
  import { getAbsoluteFilePathForAstroFile } from '@utils/files';
@@ -46,6 +48,10 @@ const renderedComponent = renderToString(component);
46
48
  // Capitalize the first letter of a string
47
49
  const pageTitle = `${collection} | ${data.name} | AsyncApi Spec`.replace(/^\w/, (c) => c.toUpperCase());
48
50
 
51
+ // Chat configuration
52
+ const chatEnabled = isEventCatalogChatEnabled();
53
+ const chatQuery = `Tell me about the AsyncAPI specification for "${data.name}" (version ${data.version})`;
54
+
49
55
  // Index only the latest version
50
56
  const pagefindAttributes =
51
57
  data.version === data.latestVersion
@@ -57,13 +63,30 @@ const pagefindAttributes =
57
63
  ---
58
64
 
59
65
  <VerticalSideBarLayout title={pageTitle}>
60
- <div {...pagefindAttributes}>
66
+ <div {...pagefindAttributes} class="relative">
61
67
  {
62
68
  // Currently, Pagefind does not index metadata (such as the title),
63
69
  // so we need to ensure it is included as text on the page.
64
70
  // https://github.com/CloudCannon/pagefind/issues/437
65
71
  }
66
72
  <h2 class="hidden">{pageTitle}</h2>
73
+ {
74
+ chatEnabled && (
75
+ <div class="absolute top-3 right-4 z-10">
76
+ <CopyAsMarkdown
77
+ client:only="react"
78
+ schemas={[]}
79
+ chatQuery={chatQuery}
80
+ chatEnabled={chatEnabled}
81
+ editUrl=""
82
+ markdownDownloadEnabled={false}
83
+ rssFeedEnabled={false}
84
+ preferChatAsDefault={true}
85
+ chatButtonText="Ask about this specification"
86
+ />
87
+ </div>
88
+ )
89
+ }
67
90
  <div id="asyncapi" class="md:pr-14" set:html={renderedComponent} />
68
91
  </div>
69
92
  </VerticalSideBarLayout>
@@ -4,6 +4,8 @@ import OpenAPISpec from './_OpenAPI.tsx';
4
4
 
5
5
  import { DocumentMinusIcon } from '@heroicons/react/24/outline';
6
6
  import VerticalSideBarLayout from '@layouts/VerticalSideBarLayout.astro';
7
+ import CopyAsMarkdown from '@components/CopyAsMarkdown';
8
+ import { isEventCatalogChatEnabled } from '@utils/feature';
7
9
  import './_styles.css';
8
10
  import { Page } from './_[filename].data.ts';
9
11
  import { getAbsoluteFilePathForAstroFile } from '@utils/files';
@@ -27,6 +29,10 @@ let content = '';
27
29
  // Capitalize the first letter of a string
28
30
  const pageTitle = `${collection} | ${data.name} | OpenAPI Spec`.replace(/^\w/, (c) => c.toUpperCase());
29
31
 
32
+ // Chat configuration
33
+ const chatEnabled = isEventCatalogChatEnabled();
34
+ const chatQuery = `Tell me about the OpenAPI specification for "${data.name}" (version ${data.version})`;
35
+
30
36
  // Index only the latest version
31
37
  const pagefindAttributes =
32
38
  data.version === data.latestVersion
@@ -57,13 +63,28 @@ if (isRemote) {
57
63
  </p>
58
64
  </div>
59
65
  ) : (
60
- <div {...pagefindAttributes}>
66
+ <div {...pagefindAttributes} class="relative">
61
67
  {
62
68
  // Currently, Pagefind does not index metadata (such as the title),
63
69
  // so we need to ensure it is included as text on the page.
64
70
  // https://github.com/CloudCannon/pagefind/issues/437
65
71
  }
66
72
  <h2 class="hidden">{pageTitle}</h2>
73
+ {chatEnabled && (
74
+ <div class="absolute top-3 right-14 z-10">
75
+ <CopyAsMarkdown
76
+ client:only="react"
77
+ schemas={[]}
78
+ chatQuery={chatQuery}
79
+ chatEnabled={chatEnabled}
80
+ editUrl=""
81
+ markdownDownloadEnabled={false}
82
+ rssFeedEnabled={false}
83
+ preferChatAsDefault={true}
84
+ chatButtonText="Ask about this specification"
85
+ />
86
+ </div>
87
+ )}
67
88
  <OpenAPISpec client:only="react" spec={content} />
68
89
  </div>
69
90
  )
@@ -1,13 +1,38 @@
1
- import { useState } from 'react';
1
+ import { useState, useEffect } from 'react';
2
2
  import { ApiReferenceReact } from '@scalar/api-reference-react';
3
3
  import '@scalar/api-reference-react/style.css';
4
4
  import './_styles.css';
5
+
5
6
  const OpenAPISpec = ({ spec }: { spec: string }) => {
6
7
  const [loaded, setLoaded] = useState(false);
8
+ const [isDarkMode, setIsDarkMode] = useState(() => {
9
+ return document.documentElement.getAttribute('data-theme') === 'dark';
10
+ });
11
+
12
+ useEffect(() => {
13
+ // Watch for theme changes
14
+ const observer = new MutationObserver((mutations) => {
15
+ mutations.forEach((mutation) => {
16
+ if (mutation.attributeName === 'data-theme') {
17
+ const theme = document.documentElement.getAttribute('data-theme');
18
+ setIsDarkMode(theme === 'dark');
19
+ }
20
+ });
21
+ });
22
+
23
+ observer.observe(document.documentElement, {
24
+ attributes: true,
25
+ attributeFilter: ['data-theme'],
26
+ });
27
+
28
+ return () => observer.disconnect();
29
+ }, []);
30
+
7
31
  return (
8
32
  <div>
9
33
  {!loaded && <div>Loading...</div>}
10
34
  <ApiReferenceReact
35
+ key={isDarkMode ? 'dark' : 'light'}
11
36
  configuration={{
12
37
  spec: {
13
38
  content: spec,
@@ -17,13 +42,12 @@ const OpenAPISpec = ({ spec }: { spec: string }) => {
17
42
  onLoaded: () => {
18
43
  setLoaded(true);
19
44
  },
20
- forceDarkModeState: 'light',
21
- darkMode: false,
45
+ forceDarkModeState: isDarkMode ? 'dark' : 'light',
46
+ darkMode: isDarkMode,
22
47
  defaultOpenAllTags: true,
23
48
  hideDarkModeToggle: true,
24
49
  searchHotKey: 'p',
25
50
  showSidebar: true,
26
- customCss: 'bg-red-500',
27
51
  }}
28
52
  />
29
53
  </div>
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.3.0",
9
+ "version": "3.3.1",
10
10
  "publishConfig": {
11
11
  "access": "public"
12
12
  },
@@ -54,7 +54,7 @@
54
54
  "@tanstack/react-table": "^8.17.3",
55
55
  "@xyflow/react": "^12.3.6",
56
56
  "ai": "^6.0.17",
57
- "astro": "^5.16.7",
57
+ "astro": "^5.16.8",
58
58
  "astro-compress": "^2.3.8",
59
59
  "astro-expressive-code": "^0.41.3",
60
60
  "astro-seo": "^0.8.4",