@eventcatalog/core 2.61.1 → 2.61.3

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.1";
40
+ var version = "2.61.3";
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-RPWUOJ3F.js";
4
- import "../chunk-CMVDQ42N.js";
3
+ } from "../chunk-BMTNHR7C.js";
4
+ import "../chunk-LLJZTUOG.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.1";
109
+ var version = "2.61.3";
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-MDWG55PH.js";
4
- import "../chunk-RPWUOJ3F.js";
5
- import "../chunk-CMVDQ42N.js";
3
+ } from "../chunk-EICO7E3X.js";
4
+ import "../chunk-BMTNHR7C.js";
5
+ import "../chunk-LLJZTUOG.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-CMVDQ42N.js";
3
+ } from "./chunk-LLJZTUOG.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-RPWUOJ3F.js";
3
+ } from "./chunk-BMTNHR7C.js";
4
4
  import {
5
5
  getEventCatalogConfigFile,
6
6
  verifyRequiredFieldsAreInCatalogConfigFile
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "2.61.1";
2
+ var version = "2.61.3";
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 = "2.61.1";
28
+ var version = "2.61.3";
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-CMVDQ42N.js";
3
+ } from "./chunk-LLJZTUOG.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.1";
160
+ var version = "2.61.3";
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-MDWG55PH.js";
10
- import "./chunk-RPWUOJ3F.js";
9
+ } from "./chunk-EICO7E3X.js";
10
+ import "./chunk-BMTNHR7C.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-CMVDQ42N.js";
18
+ } from "./chunk-LLJZTUOG.js";
19
19
  import {
20
20
  getProjectOutDir,
21
21
  isAuthEnabled,
@@ -1,6 +1,13 @@
1
- import { getBaseURL } from '@utils/url-builder';
2
1
  import { streamText, tool, type LanguageModel, type UIMessage, stepCountIs, convertToModelMessages } from 'ai';
3
2
  import { z } from 'astro/zod';
3
+ import config from '@config';
4
+
5
+ const getBaseURL = () => {
6
+ if (import.meta.env.MODE === 'development') {
7
+ return `http://localhost:${config.port || 3000}`;
8
+ }
9
+ return config.homepageLink || 'https://eventcatalog.dev/';
10
+ };
4
11
 
5
12
  export const getEventCatalogResources = async () => {
6
13
  const baseUrl = process.env.EVENTCATALOG_URL || getBaseURL();
@@ -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
  }));
@@ -1,4 +1,4 @@
1
- import config from '@config';
1
+ // Don't import config here, as it breaks in the client, as path cannot be resolved.
2
2
 
3
3
  const cleanUrl = (url: string) => {
4
4
  return url.replace(/\/+/g, '/');
@@ -62,10 +62,3 @@ export const toMarkdownUrl = (url: string) => {
62
62
 
63
63
  return url + '.mdx';
64
64
  };
65
-
66
- export const getBaseURL = () => {
67
- if (import.meta.env.MODE === 'development') {
68
- return `http://localhost:${config.port || 3000}`;
69
- }
70
- return config.homepageLink || 'https://eventcatalog.dev/';
71
- };
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.1",
9
+ "version": "2.61.3",
10
10
  "publishConfig": {
11
11
  "access": "public"
12
12
  },