chore: remove bad imports

This commit is contained in:
Jacob Nguyen
2023-05-06 02:01:27 -05:00
parent 098a440669
commit 8e9b3bbe04
7 changed files with 8 additions and 23 deletions

View File

@@ -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<CommandModule>(path)))
}
}

View File

@@ -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<T extends AnyDependencies>() {
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']),

View File

@@ -1,4 +1,3 @@
export * from './enums';
export * from './moduleStore';
export * from './context'
export * from './sernEmitter'

View File

@@ -1,11 +0,0 @@
/**
* @since 2.0.0
* Storing all command modules
* This dependency is usually injected into ModuleManager
*/
export class ModuleStore extends Map<string, string> {
}

View File

@@ -72,8 +72,6 @@ export function createMessageHandler(
const args = contextArgs(event, rest);
return result.map(module => dispatchCommand(module, args))
})
}
)
}

View File

@@ -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<EventModule | CommandModule>) => {

View File

@@ -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<string,string>
export type ServerlessDependencyList = [ SernEmitter,ErrorHandling, Logging | undefined, ModuleManager];
export type WebsocketDependencyList = [SernEmitter,ErrorHandling, Logging | undefined, ModuleManager, EventEmitter];
/**