diff --git a/src/core/contracts/moduleManager.ts b/src/core/contracts/moduleManager.ts index 5a7296d..e7aad80 100644 --- a/src/core/contracts/moduleManager.ts +++ b/src/core/contracts/moduleManager.ts @@ -1,6 +1,6 @@ +import { ModuleStore } from '../../types/core'; import { CommandModule } from '../../types/module'; import { importModule } from '../module-loading'; -import type { ModuleStore } from '../structures'; /** * @since 2.0.0 */ @@ -29,6 +29,5 @@ export class DefaultModuleManager implements ModuleManager { .filter(([id,]) => (Number.parseInt(id.at(-1)!) & publishable) !== 0) .map(([, path]) => importModule(path))) } - } diff --git a/src/core/dependencies.ts b/src/core/dependencies.ts index d659e65..266eac1 100644 --- a/src/core/dependencies.ts +++ b/src/core/dependencies.ts @@ -1,10 +1,10 @@ import type { Container } from 'iti'; -import type { AnyDependencies, DependencyConfiguration, MapDeps, ServerlessDependencies, WebsocketDependencies, Wrapper } from '../types/core'; +import type { AnyDependencies, DependencyConfiguration, MapDeps, Wrapper } from '../types/core'; import { DefaultErrorHandling, DefaultLogging, DefaultModuleManager } from './contracts'; import { Result } from 'ts-results-es'; import { BehaviorSubject } from 'rxjs'; import { createContainer } from 'iti'; -import { ModuleStore, SernEmitter } from './structures'; +import { SernEmitter } from './structures'; export const containerSubject = new BehaviorSubject(defaultContainer()); @@ -81,7 +81,7 @@ export function useContainerRaw() { function defaultContainer() { return createContainer() .add({ '@sern/errors': () => new DefaultErrorHandling() }) - .add({ '@sern/store': () => new ModuleStore() }) + .add({ '@sern/store': () => new Map() }) .add(ctx => { return { '@sern/modules': () => new DefaultModuleManager(ctx['@sern/store']), diff --git a/src/core/structures/index.ts b/src/core/structures/index.ts index 93ab4a6..7984c53 100644 --- a/src/core/structures/index.ts +++ b/src/core/structures/index.ts @@ -1,4 +1,3 @@ export * from './enums'; -export * from './moduleStore'; export * from './context' export * from './sernEmitter' diff --git a/src/core/structures/moduleStore.ts b/src/core/structures/moduleStore.ts deleted file mode 100644 index 423e0c9..0000000 --- a/src/core/structures/moduleStore.ts +++ /dev/null @@ -1,11 +0,0 @@ - -/** - * @since 2.0.0 - * Storing all command modules - * This dependency is usually injected into ModuleManager - */ -export class ModuleStore extends Map { - -} - - diff --git a/src/handler/events/generic.ts b/src/handler/events/generic.ts index 440c828..d63fc88 100644 --- a/src/handler/events/generic.ts +++ b/src/handler/events/generic.ts @@ -72,8 +72,6 @@ export function createMessageHandler( const args = contextArgs(event, rest); return result.map(module => dispatchCommand(module, args)) }) - - } ) } diff --git a/src/handler/events/userDefined.ts b/src/handler/events/userDefined.ts index 5370467..bcc2df2 100644 --- a/src/handler/events/userDefined.ts +++ b/src/handler/events/userDefined.ts @@ -1,5 +1,5 @@ import { catchError, finalize, map, mergeAll, of } from 'rxjs'; -import type { Processed, WebsocketDependencies } from '../../types/core'; +import type { Processed, WebsocketDependencies, Wrapper } from '../../types/core'; import { callInitPlugins } from './observableHandling'; import type { CommandModule, EventModule } from '../../types/module'; import type { EventEmitter } from 'node:events'; @@ -10,13 +10,12 @@ import { SernError } from '../../core/structures/errors'; import { eventDispatcher } from './dispatchers'; import { handleError } from '../../core/contracts/errorHandling'; import { useContainerRaw } from '../../core/dependencies'; -import { AnyWrapper } from '../../core/structures/wrapper'; import { buildModules } from './generic'; export function makeEventsHandler( [s, err, log, client]: [SernEmitter, ErrorHandling, Logging | undefined, EventEmitter], eventsPath: string, - containerGetter: AnyWrapper['containerConfig'], + containerGetter: Wrapper['containerConfig'], ) { const lazy = (k: string) => containerGetter.get(k as keyof WebsocketDependencies)[0]; const intoDispatcher = (e: Processed) => { diff --git a/src/types/core.ts b/src/types/core.ts index c28ffe8..cf87d0e 100644 --- a/src/types/core.ts +++ b/src/types/core.ts @@ -1,7 +1,8 @@ import { type EventEmitter } from "node:events"; -import { ErrorHandling, Logging, ModuleManager, ModuleStore, SernEmitter } from "../core"; +import { ErrorHandling, Logging, ModuleManager, SernEmitter } from "../core"; import { Container, UnpackFunction } from "iti"; +export type ModuleStore = Map export type ServerlessDependencyList = [ SernEmitter,ErrorHandling, Logging | undefined, ModuleManager]; export type WebsocketDependencyList = [SernEmitter,ErrorHandling, Logging | undefined, ModuleManager, EventEmitter]; /**