diff --git a/src/domain/auth.service.ts b/src/domain/auth.service.ts index b760a297..91a8fc29 100644 --- a/src/domain/auth.service.ts +++ b/src/domain/auth.service.ts @@ -1,6 +1,6 @@ import type AuthRepository from '@/domain/auth.repository.interface'; import type EventBus from '@/domain/event-bus'; -import AuthCompletedEvent from './event-bus/events/AuthCompleted'; +import { AuthCompletedEvent } from './event-bus/events/AuthCompleted'; import UnauthorizedError from './entities/errors/Unauthorized'; /** diff --git a/src/domain/event-bus/events/AuthCompleted.ts b/src/domain/event-bus/events/AuthCompleted.ts index d2f4553f..91c996d5 100644 --- a/src/domain/event-bus/events/AuthCompleted.ts +++ b/src/domain/event-bus/events/AuthCompleted.ts @@ -8,7 +8,7 @@ export const AUTH_COMPLETED_EVENT_NAME = 'auth-completed'; /** * Use cross domain events to explicitly implement side effects of changes within of a domain */ -export default class AuthCompletedEvent extends CustomEvent { +export class AuthCompletedEvent extends CustomEvent { /** * Constructor options * diff --git a/src/domain/event-bus/index.ts b/src/domain/event-bus/index.ts index 6867595e..e85c85e7 100644 --- a/src/domain/event-bus/index.ts +++ b/src/domain/event-bus/index.ts @@ -1,6 +1,24 @@ +import type { AUTH_COMPLETED_EVENT_NAME, AuthCompletedEvent } from './events/AuthCompleted'; + /** * Event Bus provides a loosely coupled communication way between Domain and some other layers * * Extends native event emitter called EventTarget */ export default class EventBus extends EventTarget {}; + +/** + * All cross domain events map + */ +export type CrossDomainEventMap = { + [AUTH_COMPLETED_EVENT_NAME]: AuthCompletedEvent; +}; + +/** + * Augment EventTarget's addEventListener method to accept CustomEvent + */ +declare global { + interface EventTarget { + addEventListener(type: T, listener: (event: CrossDomainEventMap[T]) => void): void; + } +} diff --git a/src/infrastructure/index.ts b/src/infrastructure/index.ts index 8bfd42dd..8dcc186a 100644 --- a/src/infrastructure/index.ts +++ b/src/infrastructure/index.ts @@ -7,8 +7,7 @@ import AuthStore from '@/infrastructure/storage/auth'; import UserRepository from '@/infrastructure/user.repository'; import { UserStore } from '@/infrastructure/storage/user'; import type EventBus from '@/domain/event-bus'; -import type AuthCompletedEvent from '@/domain/event-bus/events/AuthCompleted'; -import { AUTH_COMPLETED_EVENT_NAME } from '@/domain/event-bus/events/AuthCompleted'; +import { AUTH_COMPLETED_EVENT_NAME, type AuthCompletedEvent } from '@/domain/event-bus/events/AuthCompleted'; /** * Repositories diff --git a/src/presentation/components/editor/Editor.vue b/src/presentation/components/editor/Editor.vue index 9be4fa98..3e2d7418 100644 --- a/src/presentation/components/editor/Editor.vue +++ b/src/presentation/components/editor/Editor.vue @@ -6,19 +6,31 @@ import { onBeforeUnmount, onMounted, ref, watch } from 'vue'; import Editor, { type OutputData, type API } from '@editorjs/editorjs'; - +// @ts-expect-error: we need to rewrite plugins to TS to get their types import Header from '@editorjs/header'; +// @ts-expect-error: we need to rewrite plugins to TS to get their types import Image from '@editorjs/image'; +// @ts-expect-error: we need to rewrite plugins to TS to get their types import CodeTool from '@editorjs/code'; +// @ts-expect-error: we need to rewrite plugins to TS to get their types import List from '@editorjs/list'; +// @ts-expect-error: we need to rewrite plugins to TS to get their types import Delimiter from '@editorjs/delimiter'; +// @ts-expect-error: we need to rewrite plugins to TS to get their types import Table from '@editorjs/table'; +// @ts-expect-error: we need to rewrite plugins to TS to get their types import Warning from '@editorjs/warning'; +// @ts-expect-error: we need to rewrite plugins to TS to get their types import Checklist from '@editorjs/checklist'; +// @ts-expect-error: we need to rewrite plugins to TS to get their types import LinkTool from '@editorjs/link'; +// @ts-expect-error: we need to rewrite plugins to TS to get their types import RawTool from '@editorjs/raw'; +// @ts-expect-error: we need to rewrite plugins to TS to get their types import Embed from '@editorjs/embed'; +// @ts-expect-error: we need to rewrite plugins to TS to get their types import InlineCode from '@editorjs/inline-code'; +// @ts-expect-error: we need to rewrite plugins to TS to get their types import Marker from '@editorjs/marker'; diff --git a/src/presentation/pages/Landing.vue b/src/presentation/pages/Landing.vue index cabedb2e..d3923488 100644 --- a/src/presentation/pages/Landing.vue +++ b/src/presentation/pages/Landing.vue @@ -1,6 +1,6 @@