@eventcatalog/core 2.40.0 → 2.41.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.
- 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-WJK67MSP.js → chunk-2VVCJWLQ.js} +1 -1
- package/dist/{chunk-VFV2YSLH.js → chunk-KSA77O7W.js} +1 -1
- package/dist/{chunk-4HQYTFYJ.js → chunk-RJR4RWGX.js} +1 -1
- package/dist/constants.cjs +1 -1
- package/dist/constants.js +1 -1
- package/dist/eventcatalog.cjs +5 -15
- package/dist/eventcatalog.js +7 -17
- package/eventcatalog/src/enterprise/eventcatalog-chat/EventCatalogVectorStore.ts +2 -0
- package/eventcatalog/src/enterprise/eventcatalog-chat/utils/ai.ts +6 -3
- package/eventcatalog/src/pages/docs/[type]/[id]/[version].mdx.ts +10 -2
- package/eventcatalog/src/pages/docs/llm/llms-full.txt.ts +13 -1
- package/eventcatalog/src/utils/llms.ts +35 -0
- package/package.json +2 -2
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
log_build_default
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
5
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-2VVCJWLQ.js";
|
|
4
|
+
import "../chunk-RJR4RWGX.js";
|
|
5
|
+
import "../chunk-KSA77O7W.js";
|
|
6
6
|
import "../chunk-E7TXTI7G.js";
|
|
7
7
|
export {
|
|
8
8
|
log_build_default as default
|
package/dist/constants.cjs
CHANGED
package/dist/constants.js
CHANGED
package/dist/eventcatalog.cjs
CHANGED
|
@@ -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.
|
|
160
|
+
var version = "2.41.0";
|
|
161
161
|
|
|
162
162
|
// src/constants.ts
|
|
163
163
|
var VERSION = version;
|
|
@@ -614,7 +614,6 @@ var isEventCatalogStarterEnabled = async (licenseKey) => {
|
|
|
614
614
|
|
|
615
615
|
// src/eventcatalog.ts
|
|
616
616
|
var import_update_notifier = __toESM(require("update-notifier"), 1);
|
|
617
|
-
var import_stream = __toESM(require("stream"), 1);
|
|
618
617
|
var import_dotenv = __toESM(require("dotenv"), 1);
|
|
619
618
|
var currentDir = import_node_path7.default.dirname((0, import_node_url.fileURLToPath)(importMetaUrl));
|
|
620
619
|
var program = new import_commander.Command().version(VERSION);
|
|
@@ -718,29 +717,20 @@ program.command("dev").description("Run development server of EventCatalog").opt
|
|
|
718
717
|
[
|
|
719
718
|
{
|
|
720
719
|
name: "astro",
|
|
721
|
-
|
|
722
|
-
command: process.platform === "win32" ? `npx astro dev ${command.args.join(" ").trim()} | findstr /V "The collection"` : `npx astro dev ${command.args.join(" ").trim()} 2>&1 | grep -v "The collection.*does not exist"`,
|
|
720
|
+
command: process.platform === "win32" ? `npx astro dev ${command.args.join(" ").trim()} 2>&1 | findstr /V /C:"[glob-loader]" /C:"The collection"` : `npx astro dev ${command.args.join(" ").trim()} 2>&1 | grep -v -e "\\[glob-loader\\]" -e "The collection.*does not exist"`,
|
|
723
721
|
cwd: core,
|
|
724
722
|
env: {
|
|
725
723
|
PROJECT_DIR: dir,
|
|
726
724
|
CATALOG_DIR: core,
|
|
727
725
|
ENABLE_EMBED: canEmbedPages,
|
|
728
726
|
EVENTCATALOG_STARTER: isEventCatalogStarter,
|
|
729
|
-
EVENTCATALOG_SCALE: isEventCatalogScale
|
|
727
|
+
EVENTCATALOG_SCALE: isEventCatalogScale,
|
|
728
|
+
NODE_NO_WARNINGS: "1"
|
|
730
729
|
}
|
|
731
730
|
}
|
|
732
731
|
],
|
|
733
732
|
{
|
|
734
|
-
raw: true
|
|
735
|
-
outputStream: new import_stream.default.Writable({
|
|
736
|
-
write(chunk, encoding, callback) {
|
|
737
|
-
const text = chunk.toString();
|
|
738
|
-
if (!(text.includes("The collection") && text.includes("does not exist"))) {
|
|
739
|
-
process.stdout.write(chunk);
|
|
740
|
-
}
|
|
741
|
-
callback();
|
|
742
|
-
}
|
|
743
|
-
})
|
|
733
|
+
raw: true
|
|
744
734
|
}
|
|
745
735
|
);
|
|
746
736
|
await result;
|
package/dist/eventcatalog.js
CHANGED
|
@@ -6,15 +6,15 @@ import {
|
|
|
6
6
|
} from "./chunk-DCLTVJDP.js";
|
|
7
7
|
import {
|
|
8
8
|
log_build_default
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-2VVCJWLQ.js";
|
|
10
|
+
import "./chunk-RJR4RWGX.js";
|
|
11
11
|
import {
|
|
12
12
|
catalogToAstro,
|
|
13
13
|
checkAndConvertMdToMdx
|
|
14
14
|
} from "./chunk-SLEMYHTU.js";
|
|
15
15
|
import {
|
|
16
16
|
VERSION
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-KSA77O7W.js";
|
|
18
18
|
import {
|
|
19
19
|
isBackstagePluginEnabled,
|
|
20
20
|
isEventCatalogScaleEnabled,
|
|
@@ -37,7 +37,6 @@ import { fileURLToPath } from "node:url";
|
|
|
37
37
|
import concurrently from "concurrently";
|
|
38
38
|
import boxen from "boxen";
|
|
39
39
|
import updateNotifier from "update-notifier";
|
|
40
|
-
import stream from "stream";
|
|
41
40
|
import dotenv from "dotenv";
|
|
42
41
|
var currentDir = path.dirname(fileURLToPath(import.meta.url));
|
|
43
42
|
var program = new Command().version(VERSION);
|
|
@@ -141,29 +140,20 @@ program.command("dev").description("Run development server of EventCatalog").opt
|
|
|
141
140
|
[
|
|
142
141
|
{
|
|
143
142
|
name: "astro",
|
|
144
|
-
|
|
145
|
-
command: process.platform === "win32" ? `npx astro dev ${command.args.join(" ").trim()} | findstr /V "The collection"` : `npx astro dev ${command.args.join(" ").trim()} 2>&1 | grep -v "The collection.*does not exist"`,
|
|
143
|
+
command: process.platform === "win32" ? `npx astro dev ${command.args.join(" ").trim()} 2>&1 | findstr /V /C:"[glob-loader]" /C:"The collection"` : `npx astro dev ${command.args.join(" ").trim()} 2>&1 | grep -v -e "\\[glob-loader\\]" -e "The collection.*does not exist"`,
|
|
146
144
|
cwd: core,
|
|
147
145
|
env: {
|
|
148
146
|
PROJECT_DIR: dir,
|
|
149
147
|
CATALOG_DIR: core,
|
|
150
148
|
ENABLE_EMBED: canEmbedPages,
|
|
151
149
|
EVENTCATALOG_STARTER: isEventCatalogStarter,
|
|
152
|
-
EVENTCATALOG_SCALE: isEventCatalogScale
|
|
150
|
+
EVENTCATALOG_SCALE: isEventCatalogScale,
|
|
151
|
+
NODE_NO_WARNINGS: "1"
|
|
153
152
|
}
|
|
154
153
|
}
|
|
155
154
|
],
|
|
156
155
|
{
|
|
157
|
-
raw: true
|
|
158
|
-
outputStream: new stream.Writable({
|
|
159
|
-
write(chunk, encoding, callback) {
|
|
160
|
-
const text = chunk.toString();
|
|
161
|
-
if (!(text.includes("The collection") && text.includes("does not exist"))) {
|
|
162
|
-
process.stdout.write(chunk);
|
|
163
|
-
}
|
|
164
|
-
callback();
|
|
165
|
-
}
|
|
166
|
-
})
|
|
156
|
+
raw: true
|
|
167
157
|
}
|
|
168
158
|
);
|
|
169
159
|
await result;
|
|
@@ -13,6 +13,7 @@ export interface Resource {
|
|
|
13
13
|
type: string;
|
|
14
14
|
url: string;
|
|
15
15
|
title?: string;
|
|
16
|
+
schema?: string;
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
export class EventCatalogVectorStore {
|
|
@@ -55,6 +56,7 @@ export class EventCatalogVectorStore {
|
|
|
55
56
|
type: metadata.type,
|
|
56
57
|
url: `/docs/${metadata.type}s/${metadata.id}`,
|
|
57
58
|
title: metadata.title || metadata.id,
|
|
59
|
+
...(metadata.schema && { schema: metadata.schema }),
|
|
58
60
|
};
|
|
59
61
|
return [metadata.id, resource]; // Use ID as key for Map
|
|
60
62
|
})
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type CoreMessage, type Message } from 'ai';
|
|
2
2
|
import { EventCatalogVectorStore, type Resource } from '@enterprise/eventcatalog-chat/EventCatalogVectorStore';
|
|
3
3
|
import fs from 'fs';
|
|
4
4
|
import path from 'path';
|
|
5
5
|
import config from '@config';
|
|
6
|
-
import { anthropic } from '@ai-sdk/anthropic';
|
|
7
6
|
import { getProvider } from '@enterprise/eventcatalog-chat/providers';
|
|
8
7
|
|
|
9
8
|
const AI_EMBEDDINGS_PATH = path.join(process.env.PROJECT_DIR || process.cwd(), 'public/ai');
|
|
@@ -61,7 +60,11 @@ If you have additional context, use it to answer the question.`;
|
|
|
61
60
|
const resourceStrings = resources.map((resource: Resource) => {
|
|
62
61
|
const attributes = Object.entries(resource)
|
|
63
62
|
.filter(([key, value]) => key !== 'markdown' && key !== 'loc' && value !== undefined && value !== null)
|
|
64
|
-
.map(([key, value]) =>
|
|
63
|
+
.map(([key, value]) => {
|
|
64
|
+
// value can be an object, so we need to convert it to a string
|
|
65
|
+
const valueString = typeof value === 'object' ? JSON.stringify(value) : String(value);
|
|
66
|
+
return `${key}="${valueString.replace(/"/g, '"')}"`; // Escape quotes in values
|
|
67
|
+
})
|
|
65
68
|
.join(' ');
|
|
66
69
|
return `<resource ${attributes} />`;
|
|
67
70
|
});
|
|
@@ -6,7 +6,8 @@ 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
|
-
|
|
9
|
+
import { dirname, join } from 'path';
|
|
10
|
+
import { addSchemaToMarkdown } from '@utils/llms';
|
|
10
11
|
const events = await getCollection('events');
|
|
11
12
|
const commands = await getCollection('commands');
|
|
12
13
|
const queries = await getCollection('queries');
|
|
@@ -49,7 +50,14 @@ export const GET: APIRoute = async ({ params, props }) => {
|
|
|
49
50
|
}
|
|
50
51
|
|
|
51
52
|
if (props?.content?.filePath) {
|
|
52
|
-
|
|
53
|
+
let file = fs.readFileSync(props.content.filePath, 'utf8');
|
|
54
|
+
|
|
55
|
+
try {
|
|
56
|
+
file = addSchemaToMarkdown(props.content, file);
|
|
57
|
+
} catch (error) {
|
|
58
|
+
console.log('Warning: Cant find the schema for', props.content.data.id, props.content.data.version);
|
|
59
|
+
}
|
|
60
|
+
|
|
53
61
|
return new Response(file, { status: 200 });
|
|
54
62
|
}
|
|
55
63
|
|
|
@@ -3,6 +3,7 @@ import config from '@config';
|
|
|
3
3
|
import type { APIRoute } from 'astro';
|
|
4
4
|
import fs from 'fs';
|
|
5
5
|
import { isCustomDocsEnabled } from '@utils/feature';
|
|
6
|
+
import { addSchemaToMarkdown } from '@utils/llms';
|
|
6
7
|
|
|
7
8
|
type AllowedCollections = 'events' | 'commands' | 'queries' | 'services' | 'domains' | 'teams' | 'users' | 'customPages';
|
|
8
9
|
|
|
@@ -38,7 +39,18 @@ export const GET: APIRoute = async ({ params, request }) => {
|
|
|
38
39
|
const content = resources
|
|
39
40
|
.map((item) => {
|
|
40
41
|
if (!item.filePath) return '';
|
|
41
|
-
|
|
42
|
+
|
|
43
|
+
let file = fs.readFileSync(item.filePath, 'utf8');
|
|
44
|
+
|
|
45
|
+
try {
|
|
46
|
+
// Try and add the schemas to the resource
|
|
47
|
+
// @ts-ignore
|
|
48
|
+
file = addSchemaToMarkdown(item, file);
|
|
49
|
+
} catch (error) {
|
|
50
|
+
// just skip the resource if it has no schema
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return file;
|
|
42
54
|
})
|
|
43
55
|
.join('\n');
|
|
44
56
|
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { CollectionTypes } from '@types';
|
|
2
|
+
import type { CollectionEntry } from 'astro:content';
|
|
3
|
+
import { dirname } from 'path';
|
|
4
|
+
import { join } from 'path';
|
|
5
|
+
import fs from 'fs';
|
|
6
|
+
|
|
7
|
+
export const addSchemaToMarkdown = (collection: CollectionEntry<CollectionTypes>, file: string) => {
|
|
8
|
+
const resourceData = collection?.data;
|
|
9
|
+
const fileToResource = collection.filePath ?? '';
|
|
10
|
+
let schemas: string[] = [];
|
|
11
|
+
|
|
12
|
+
if (!resourceData?.specifications && !resourceData?.schemaPath) {
|
|
13
|
+
return file;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
if (Array.isArray(resourceData?.specifications)) {
|
|
17
|
+
schemas = resourceData?.specifications.map((specification: any) => specification.path);
|
|
18
|
+
} else {
|
|
19
|
+
schemas = [resourceData?.schemaPath ?? ''];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const filteredSchemas = schemas.filter((schema: any) => schema !== undefined);
|
|
23
|
+
|
|
24
|
+
// attach the schema if it has it
|
|
25
|
+
if (filteredSchemas.length > 0) {
|
|
26
|
+
for (const pathToSchema of filteredSchemas) {
|
|
27
|
+
const directory = dirname(fileToResource);
|
|
28
|
+
const schemaPath = join(directory, pathToSchema);
|
|
29
|
+
const schemaFile = fs.readFileSync(schemaPath, 'utf8');
|
|
30
|
+
file = `${file}\n\n ## Raw Schema:${pathToSchema}\n\n${schemaFile}`;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return file;
|
|
35
|
+
};
|
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.
|
|
9
|
+
"version": "2.41.0",
|
|
10
10
|
"publishConfig": {
|
|
11
11
|
"access": "public"
|
|
12
12
|
},
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"@asyncapi/avro-schema-parser": "^3.0.24",
|
|
34
34
|
"@asyncapi/parser": "^3.4.0",
|
|
35
35
|
"@asyncapi/react-component": "^2.4.3",
|
|
36
|
-
"@eventcatalog/generator-ai": "^1.0
|
|
36
|
+
"@eventcatalog/generator-ai": "^1.1.0",
|
|
37
37
|
"@eventcatalog/sdk": "^2.2.7",
|
|
38
38
|
"@fontsource/inter": "^5.2.5",
|
|
39
39
|
"@headlessui/react": "^2.0.3",
|