@eventcatalog/core 2.61.0 → 2.61.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.
@@ -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 = "2.61.0";
40
+ var version = "2.61.2";
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-I2B6B3XZ.js";
4
- import "../chunk-3CAAQQUB.js";
3
+ } from "../chunk-BYJ6RQTT.js";
4
+ import "../chunk-PN45L4LR.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 = "2.61.0";
109
+ var version = "2.61.2";
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-OEWPHKD6.js";
4
- import "../chunk-I2B6B3XZ.js";
5
- import "../chunk-3CAAQQUB.js";
3
+ } from "../chunk-RQJ7FPSK.js";
4
+ import "../chunk-BYJ6RQTT.js";
5
+ import "../chunk-PN45L4LR.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
  VERSION
3
- } from "./chunk-3CAAQQUB.js";
3
+ } from "./chunk-PN45L4LR.js";
4
4
 
5
5
  // src/analytics/analytics.js
6
6
  import axios from "axios";
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "2.61.0";
2
+ var version = "2.61.2";
3
3
 
4
4
  // src/constants.ts
5
5
  var VERSION = version;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  raiseEvent
3
- } from "./chunk-I2B6B3XZ.js";
3
+ } from "./chunk-BYJ6RQTT.js";
4
4
  import {
5
5
  getEventCatalogConfigFile,
6
6
  verifyRequiredFieldsAreInCatalogConfigFile
@@ -25,7 +25,7 @@ __export(constants_exports, {
25
25
  module.exports = __toCommonJS(constants_exports);
26
26
 
27
27
  // package.json
28
- var version = "2.61.0";
28
+ var version = "2.61.2";
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-3CAAQQUB.js";
3
+ } from "./chunk-PN45L4LR.js";
4
4
  export {
5
5
  VERSION
6
6
  };
@@ -157,7 +157,7 @@ var import_axios = __toESM(require("axios"), 1);
157
157
  var import_os = __toESM(require("os"), 1);
158
158
 
159
159
  // package.json
160
- var version = "2.61.0";
160
+ var version = "2.61.2";
161
161
 
162
162
  // src/constants.ts
163
163
  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-OEWPHKD6.js";
10
- import "./chunk-I2B6B3XZ.js";
9
+ } from "./chunk-RQJ7FPSK.js";
10
+ import "./chunk-BYJ6RQTT.js";
11
11
  import {
12
12
  catalogToAstro,
13
13
  checkAndConvertMdToMdx
@@ -15,7 +15,7 @@ import {
15
15
  import "./chunk-55D645EH.js";
16
16
  import {
17
17
  VERSION
18
- } from "./chunk-3CAAQQUB.js";
18
+ } from "./chunk-PN45L4LR.js";
19
19
  import {
20
20
  getProjectOutDir,
21
21
  isAuthEnabled,
@@ -3,32 +3,17 @@ import VerticalSideBarLayout from '@layouts/VerticalSideBarLayout.astro';
3
3
  import Chat from '@enterprise/eventcatalog-chat/components/Chat';
4
4
  import { getChatPromptsGroupedByCategory } from '@enterprise/eventcatalog-chat/utils/chat-prompts';
5
5
  import config from '@config';
6
- import path from 'node:path';
7
- import fs from 'node:fs';
8
6
  import { Code } from 'astro-expressive-code/components';
9
7
  import { getDomains } from '@utils/collections/domains';
10
8
  import { getEvents } from '@utils/events';
11
9
  import { getCommands } from '@utils/commands';
12
10
  import { getServices } from '@utils/collections/services';
13
11
  import { getQueries } from '@utils/queries';
14
- import { getConfigurationForGivenGenerator } from '@utils/generators';
15
12
 
16
13
  const isEnabled = config.chat?.enabled || false;
17
14
  const chatConfig = config.chat || {};
18
15
  const output = config.output || 'static';
19
16
 
20
- const aiGeneratorConfig = getConfigurationForGivenGenerator('@eventcatalog/generator-ai');
21
- let embeddingModel = aiGeneratorConfig?.embedding?.model || 'all-MiniLM-L6-v2';
22
-
23
- if (aiGeneratorConfig?.embedding?.provider === 'openai') {
24
- embeddingModel = aiGeneratorConfig?.embedding?.model || 'text-embedding-3-large';
25
- }
26
-
27
- const PROJECT_DIR = path.resolve(process.env.PROJECT_DIR || process.cwd());
28
- const GENERATED_AI_DIR = path.resolve(PROJECT_DIR, 'public/ai');
29
-
30
- const directoryExists = fs.existsSync(GENERATED_AI_DIR);
31
-
32
17
  // Get all information for the mention input
33
18
  const [events, commands, queries, services, domains] = await Promise.all([
34
19
  getEvents({ getAllVersions: false }),
@@ -42,73 +27,25 @@ const allItems = [...events, ...commands, ...queries, ...services, ...domains];
42
27
  const chatPrompts = await getChatPromptsGroupedByCategory();
43
28
 
44
29
  const resources = allItems.map((item) => ({ id: item.data.id, type: item.collection, name: item.data.name }));
45
-
46
- const generatorConfig = `
47
- generators: [
48
- [
49
- "@eventcatalog/generator-ai", {
50
- // If you want to chunk files into smaller chunks, set this to true
51
- splitMarkdownFiles: true
52
- }
53
- ],
54
- ],
55
- `;
56
30
  ---
57
31
 
58
32
  <VerticalSideBarLayout title="AI Chat">
59
33
  <div class="flex h-[calc(100vh-60px)] bg-white">
60
34
  {
61
35
  isEnabled ? (
62
- directoryExists ? (
63
- <>
64
- <div id="chatContainer" class="w-full">
65
- <Chat
66
- client:only="react"
67
- chatConfig={{
68
- ...chatConfig,
69
- embeddingModel,
70
- }}
71
- resources={resources}
72
- chatPrompts={chatPrompts}
73
- output={output as 'static' | 'server'}
74
- />
75
- </div>
76
- </>
77
- ) : (
78
- <div class="flex items-center justify-center w-full p-4 sm:p-8">
79
- <div class="max-w-2xl text-center">
80
- <h2 class="text-2xl font-bold text-gray-900 mb-4">EventCatalog AI Assistant Setup Required</h2>
81
- <p class="text-gray-600 mb-6">
82
- To use the AI Assistant, you need to generate the AI data first.
83
- <br />
84
- Please install the plugin and run the generator command to generate the AI data.
85
- </p>
86
-
87
- <div class="text-left space-y-4">
88
- <div class="space-y-2">
89
- <h2 class="text-lg font-semibold text-left">1. Install the generator</h2>
90
- <Code code={`npm i @eventcatalog/generator-ai`} lang="bash" frame="terminal" />
91
- </div>
92
-
93
- <div class="space-y-2">
94
- <h2 class="text-lg font-semibold text-left">2. Configure the generator</h2>
95
- <Code code={generatorConfig} lang="javascript" frame="terminal" title="eventcatalog.config.js" />
96
- </div>
97
-
98
- <div class="space-y-2">
99
- <h2 class="text-lg font-semibold text-left">3. Generate the AI data</h2>
100
- <Code code={`npm run generate`} lang="bash" frame="none" />
101
- </div>
102
- <p class="text-gray-600 text-sm mt-2">
103
- After running the generator, a new folder called <code class="bg-gray-100 p-1 rounded-md">generated-ai</code>{' '}
104
- will be created in your project.
105
- </p>
106
-
107
- <p class="text-gray-600 text-sm mt-2">Once done, refresh this page.</p>
108
- </div>
109
- </div>
36
+ <>
37
+ <div id="chatContainer" class="w-full">
38
+ <Chat
39
+ client:only="react"
40
+ chatConfig={{
41
+ ...chatConfig,
42
+ }}
43
+ resources={resources}
44
+ chatPrompts={chatPrompts}
45
+ output={output as 'static' | 'server'}
46
+ />
110
47
  </div>
111
- )
48
+ </>
112
49
  ) : (
113
50
  <div class="flex items-center justify-center w-full p-4 sm:p-8">
114
51
  <div class="max-w-6xl flex flex-col md:flex-row gap-8 md:gap-12 items-center">
@@ -1,5 +1,4 @@
1
1
  ---
2
- import path from 'path';
3
2
  import { createElement } from 'react';
4
3
  import { renderToString } from 'react-dom/server';
5
4
  import { Parser } from '@asyncapi/parser';
@@ -18,17 +17,23 @@ export const prerender = Page.prerender;
18
17
  export const getStaticPaths = Page.getStaticPaths;
19
18
 
20
19
  // Get data
21
- const { collection, data, filePath, filename } = await Page.getData(Astro);
20
+ const { collection, data, filePath, filename, path: relativeSpecPath } = await Page.getData(Astro);
22
21
 
23
22
  const fileName = filename || 'asyncapi.yaml';
24
23
  const pathToSpec = getAbsoluteFilePathForAstroFile(filePath, fileName);
25
24
  const fileExists = fs.existsSync(pathToSpec);
25
+ const isRemote = relativeSpecPath.includes('https://');
26
26
  let content = '';
27
27
 
28
- if (fileExists) {
28
+ if (fileExists && !isRemote) {
29
29
  content = fs.readFileSync(pathToSpec, 'utf8');
30
30
  }
31
31
 
32
+ if (isRemote) {
33
+ // Fetch the content from the remote path
34
+ content = await fetch(relativeSpecPath).then((res) => res.text());
35
+ }
36
+
32
37
  // AsyncAPI parser will parser schemas for users, they can turn this off.
33
38
  const parseSchemas = Config?.asyncAPI?.renderParsedSchemas ?? true;
34
39
  const parsed = await new Parser({ schemaParsers: [AvroSchemaParser()] }).parse(content, { parseSchemas });
@@ -43,6 +43,7 @@ export class Page extends HybridPage {
43
43
  type: itemTypes[index],
44
44
  filenameWithoutExtension: spec.filenameWithoutExtension || spec.type,
45
45
  filename: spec.filename || spec.type,
46
+ path: spec.path,
46
47
  ...item,
47
48
  },
48
49
  }));
@@ -15,17 +15,23 @@ export const prerender = Page.prerender;
15
15
  export const getStaticPaths = Page.getStaticPaths;
16
16
 
17
17
  // Get data
18
- const { collection, data, filePath, filename } = await Page.getData(Astro);
18
+ const { collection, data, filePath, filename, path: relativeSpecPath } = await Page.getData(Astro);
19
19
 
20
20
  const fileName = filename || 'schema.graphql';
21
21
  const pathToSpec = getAbsoluteFilePathForAstroFile(filePath, fileName);
22
22
  const fileExists = fs.existsSync(pathToSpec);
23
+ const isRemote = relativeSpecPath.includes('https://');
23
24
  let content = '';
24
25
 
25
- if (fileExists) {
26
+ if (fileExists && !isRemote) {
26
27
  content = fs.readFileSync(pathToSpec, 'utf8');
27
28
  }
28
29
 
30
+ if (isRemote) {
31
+ // Fetch the content from the remote path
32
+ content = await fetch(relativeSpecPath).then((res) => res.text());
33
+ }
34
+
29
35
  // Create comprehensive page title
30
36
  const pageTitle = `${collection} | ${data.name} | GraphQL Schema`.replace(/^\w/, (c) => c.toUpperCase());
31
37
 
@@ -43,6 +43,7 @@ export class Page extends HybridPage {
43
43
  type: itemTypes[index],
44
44
  filenameWithoutExtension: spec.filenameWithoutExtension || spec.type,
45
45
  filename: spec.filename || spec.type,
46
+ path: spec.path,
46
47
  ...item,
47
48
  },
48
49
  }));
@@ -15,11 +15,12 @@ export const getStaticPaths = Page.getStaticPaths;
15
15
  const props = await Page.getData(Astro);
16
16
 
17
17
  // @ts-ignore
18
- const { collection, data, catalog, filePath, filename } = props;
18
+ const { collection, data, catalog, filePath, filename, path: relativeSpecPath } = props;
19
19
  const fileName = filename || 'openapi.yml';
20
20
 
21
21
  const pathToSpec = getAbsoluteFilePathForAstroFile(filePath, fileName);
22
22
  const fileExists = fs.existsSync(pathToSpec);
23
+ const isRemote = relativeSpecPath.includes('https://');
23
24
 
24
25
  let content = '';
25
26
 
@@ -35,14 +36,19 @@ const pagefindAttributes =
35
36
  }
36
37
  : {};
37
38
 
38
- if (fileExists) {
39
+ if (fileExists && !isRemote) {
39
40
  content = fs.readFileSync(pathToSpec, 'utf8');
40
41
  }
42
+
43
+ if (isRemote) {
44
+ // Fetch the content from the remote path
45
+ content = await fetch(relativeSpecPath).then((res) => res.text());
46
+ }
41
47
  ---
42
48
 
43
49
  <VerticalSideBarLayout title={pageTitle}>
44
50
  {
45
- !fileExists ? (
51
+ !fileExists && !isRemote ? (
46
52
  <div class="text-center h-screen flex flex-col justify-center ">
47
53
  <DocumentMinusIcon className="mx-auto h-12 w-12 text-gray-400" />
48
54
  <h3 class="mt-2 text-sm font-semibold text-gray-900">No OpenAPI spec file found</h3>
@@ -44,6 +44,7 @@ export class Page extends HybridPage {
44
44
  type: itemTypes[index],
45
45
  filenameWithoutExtension: spec.filenameWithoutExtension || spec.type,
46
46
  filename: spec.filename || spec.type,
47
+ path: spec.path,
47
48
  ...item,
48
49
  },
49
50
  }));
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": "2.61.0",
9
+ "version": "2.61.2",
10
10
  "publishConfig": {
11
11
  "access": "public"
12
12
  },
@@ -26,10 +26,10 @@
26
26
  "@ai-sdk/openai": "^2.0.42",
27
27
  "@ai-sdk/react": "^2.0.60",
28
28
  "@ai-sdk/rsc": "^1.0.60",
29
- "@astrojs/markdown-remark": "^6.3.6",
30
- "@astrojs/mdx": "^4.3.5",
31
- "@astrojs/node": "^9.4.3",
32
- "@astrojs/react": "^4.3.1",
29
+ "@astrojs/markdown-remark": "^6.3.7",
30
+ "@astrojs/mdx": "^4.3.6",
31
+ "@astrojs/node": "^9.4.4",
32
+ "@astrojs/react": "^4.4.0",
33
33
  "@astrojs/rss": "^4.0.12",
34
34
  "@astrojs/tailwind": "^6.0.2",
35
35
  "@asyncapi/avro-schema-parser": "^3.0.24",
@@ -56,7 +56,7 @@
56
56
  "@tanstack/react-table": "^8.17.3",
57
57
  "@xyflow/react": "^12.3.6",
58
58
  "ai": "^5.0.60",
59
- "astro": "^5.13.8",
59
+ "astro": "^5.14.1",
60
60
  "astro-compress": "^2.3.8",
61
61
  "astro-expressive-code": "^0.41.3",
62
62
  "astro-seo": "^0.8.4",