@eventcatalog/core 0.0.0 → 0.0.4

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/CHANGELOG.md CHANGED
@@ -1 +1,19 @@
1
- # @eventcatalog/core
1
+ # @eventcatalog/core
2
+
3
+ ## 0.0.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [`1eb4572`](https://github.com/boyney123/eventcatalog/commit/1eb4572918ac06afb64554fef2fc1a3877fbf06d) [#44](https://github.com/boyney123/eventcatalog/pull/44) Thanks [@boyney123](https://github.com/boyney123)! - feat: added more customise options and documentation for them
8
+
9
+ ## 0.0.3
10
+
11
+ ### Patch Changes
12
+
13
+ - [`23a96fc`](https://github.com/boyney123/eventcatalog/commit/23a96fc651907517cee937657be14cbf9fe95fb9) [#42](https://github.com/boyney123/eventcatalog/pull/42) Thanks [@boyney123](https://github.com/boyney123)! - fix: now remove the .next folder before we start the dev server foric…
14
+
15
+ ## 0.0.2
16
+
17
+ ### Patch Changes
18
+
19
+ - [`53b27cb`](https://github.com/boyney123/eventcatalog/commit/53b27cb5bb5ab7fa8d526309c6dd50e1f17f3db1) [#39](https://github.com/boyney123/eventcatalog/pull/39) Thanks [@boyney123](https://github.com/boyney123)! - feat: removed ids from services
@@ -69,9 +69,10 @@ cli
69
69
  .command('dev [siteDir]')
70
70
  .description('Start the development server.')
71
71
  .action(() => {
72
- if (!fs.existsSync(eventCatalogLibDir)) {
73
- copyCoreApplicationCodeIntoUsersProjectDir();
74
- }
72
+ // Fix for https://github.com/boyney123/eventcatalog/issues/41, not the best but will do for now
73
+ fs.rmSync(eventCatalogLibDir, { recursive: true, force: true });
74
+
75
+ copyCoreApplicationCodeIntoUsersProjectDir();
75
76
 
76
77
  // copy any public assets over (from users to the lib itself)
77
78
  fs.copySync(path.join(projectDIR, 'public'), path.join(eventCatalogLibDir, 'public'));
@@ -79,16 +79,19 @@ export default function ContentView({
79
79
  )}
80
80
  </div>
81
81
  <div className="mt-4 flex space-x-3 md:mt-0">
82
- <button
82
+ <a
83
+ href={editUrl}
84
+ target="_blank"
83
85
  type="button"
84
86
  className="hidden md:inline-flex h-10 justify-center px-4 py-2 border border-gray-300 shadow-sm text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-900"
87
+ rel="noreferrer"
85
88
  >
86
89
  <PencilIcon
87
90
  className="-ml-1 mr-2 h-5 w-5 text-gray-400"
88
91
  aria-hidden="true"
89
92
  />
90
93
  <span>Edit</span>
91
- </button>
94
+ </a>
92
95
  </div>
93
96
  </div>
94
97
  <div className="py-3 xl:pt-6 xl:pb-0">
@@ -2,30 +2,23 @@ import React from 'react';
2
2
  import { useConfig } from '@/hooks/EventCatalog';
3
3
 
4
4
  export default function Footer() {
5
- const { organizationName, editUrl } = useConfig();
5
+ const { organizationName, footerLinks: navigation = [] } = useConfig();
6
6
  const year = new Date().getFullYear();
7
7
 
8
- const navigation = {
9
- main: [
10
- { name: 'Events', href: '/events' },
11
- { name: 'Services', href: '/services' },
12
- { name: '3D Node Graph', href: '/overview' },
13
- { name: 'GitHub', href: editUrl },
14
- ],
15
- };
16
-
17
8
  return (
18
9
  <footer className="bg-gray-800">
19
10
  <div className="max-w-7xl mx-auto py-12 px-4 overflow-hidden sm:px-6 lg:px-8">
20
- <nav className="-mx-5 -my-2 flex flex-wrap justify-center" aria-label="Footer">
21
- {navigation.main.map((item) => (
22
- <div key={item.name} className="px-5 py-2">
23
- <a href={item.href} className="text-base text-gray-500 hover:text-gray-900">
24
- {item.name}
25
- </a>
26
- </div>
27
- ))}
28
- </nav>
11
+ {navigation && (
12
+ <nav className="-mx-5 -my-2 flex flex-wrap justify-center" aria-label="Footer">
13
+ {navigation.map((item) => (
14
+ <div key={item.label} className="px-5 py-2">
15
+ <a href={item.href} className="text-base text-gray-500 hover:text-gray-900">
16
+ {item.label}
17
+ </a>
18
+ </div>
19
+ ))}
20
+ </nav>
21
+ )}
29
22
  <p className="mt-8 text-center text-base text-gray-400">
30
23
  Copyright © {year} {organizationName}. Built with{' '}
31
24
  <a className="underline" href="https://eventcatalog.dev" target="_blank" rel="noreferrer">
@@ -19,8 +19,8 @@ function EventSideBar({ event, loadedVersion }: EventSideBarProps) {
19
19
  try {
20
20
  const res = await fetch(`/api/event/${event.name}/download`);
21
21
  if (res.status === 404) throw new Error('Failed to find file');
22
- const data = await res.text();
23
- fileDownload(data, event.name);
22
+ const { schema, fileName } = await res.json();
23
+ fileDownload(schema, fileName);
24
24
  } catch (error) {
25
25
  // TODO: Maybe better error experince
26
26
  console.error(error);
@@ -19,7 +19,6 @@ describe('services', () => {
19
19
 
20
20
  expect(services).toEqual([
21
21
  {
22
- id: 'Email Platform',
23
22
  name: 'Email Platform',
24
23
  summary:
25
24
  'Internal Email system. Used to send emails to 1000s of customers. Hosted in AWS\n',
@@ -65,7 +64,6 @@ describe('services', () => {
65
64
 
66
65
  expect(services).toEqual([
67
66
  {
68
- id: 'Email Platform',
69
67
  name: 'Email Platform',
70
68
  summary:
71
69
  'Internal Email system. Used to send emails to 1000s of customers. Hosted in AWS\n',
@@ -105,7 +103,6 @@ describe('services', () => {
105
103
  const { service, markdown } = await getServiceByName('Email Platform');
106
104
 
107
105
  expect(service).toEqual({
108
- id: 'Email Platform',
109
106
  name: 'Email Platform',
110
107
  summary:
111
108
  'Internal Email system. Used to send emails to 1000s of customers. Hosted in AWS\n',
package/lib/events.ts CHANGED
@@ -206,8 +206,8 @@ export const getAllEventsThatHaveRelationshipWithService = (
206
206
  ): { publishes: Event[]; subscribes: Event[] } => {
207
207
  const relationshipsBetweenEvents = events.reduce(
208
208
  (data, event) => {
209
- const serviceSubscribesToEvent = event.consumers.some((id) => id === service.id);
210
- const servicePublishesEvent = event.producers.some((id) => id === service.id);
209
+ const serviceSubscribesToEvent = event.consumers.some((id) => id === service.name);
210
+ const servicePublishesEvent = event.producers.some((id) => id === service.name);
211
211
 
212
212
  return {
213
213
  publishes: servicePublishesEvent ? data.publishes.concat(event) : data.publishes,
package/lib/services.ts CHANGED
@@ -8,8 +8,8 @@ import { MarkdownFile } from '../types/index';
8
8
  import { getAllEvents, getAllEventsThatHaveRelationshipWithService } from '@/lib/events';
9
9
 
10
10
  const buildService = (eventFrontMatter: any): Service => {
11
- const { id, name, summary, owners = [], repository = {}, tags = [] } = eventFrontMatter;
12
- return { id, name, summary, owners, repository, tags };
11
+ const { name, summary, owners = [], repository = {}, tags = [] } = eventFrontMatter;
12
+ return { name, summary, owners, repository, tags };
13
13
  };
14
14
 
15
15
  export const getAllServices = (): Service[] => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eventcatalog/core",
3
- "version": "0.0.0",
3
+ "version": "0.0.4",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -37,7 +37,7 @@
37
37
  "react-syntax-highlighter": "^15.4.5"
38
38
  },
39
39
  "devDependencies": {
40
- "@eventcatalog/types": "0.0.0",
40
+ "@eventcatalog/types": "0.0.2",
41
41
  "@types/react": "^17.0.36",
42
42
  "autoprefixer": "^10.4.0",
43
43
  "commander": "^8.3.0",
@@ -8,16 +8,19 @@ export default function (req, res) {
8
8
  const eventDir = path.join(process.env.PROJECT_DIR, 'events', eventName);
9
9
 
10
10
  try {
11
- // Find the schema file
12
11
  const filesInEventDir = fs.readdirSync(eventDir);
13
12
  const schemaFileName = filesInEventDir.find((fileName) => fileName.indexOf('schema.') > -1);
14
13
 
15
14
  if (schemaFileName) {
15
+ const extension = schemaFileName.split('.').pop();
16
16
  const schemaFile = fs.readFileSync(path.join(eventDir, schemaFileName));
17
- res.send(schemaFile).end();
18
- } else {
19
- res.status(404).end();
17
+
18
+ res.send({
19
+ schema: schemaFile.toString(),
20
+ fileName: `${eventName}.${extension}`,
21
+ });
20
22
  }
23
+ res.status(404).end();
21
24
  } catch (error) {
22
25
  console.log(error);
23
26
  res.status(404).end();