consolidate default services in single file

This commit is contained in:
Jacob Nguyen
2024-04-28 20:36:50 -05:00
parent f5136ba1ca
commit 9faae7eca7
7 changed files with 24 additions and 38 deletions

View File

@@ -5,7 +5,7 @@ export * from './operators';
export * as Files from './module-loading';
export * from './functions';
export { SernError } from './structures/enums';
export * as __Services from './structures/services';
export { __Services } from './structures';
export { useContainerRaw } from './ioc/base';
export type _Module = {

View File

@@ -1,4 +1,24 @@
import { LogPayload, Logging } from '../../interfaces';
import type { LogPayload, Logging, ErrorHandling } from '../interfaces';
/**
* @internal
* @since 2.0.0
* Version 4.0.0 will internalize this api. Please refrain from using the defaults!
*/
export class DefaultErrorHandling implements ErrorHandling {
crash(err: Error): never {
throw err;
}
#keepAlive = 1;
updateAlive(err: Error) {
this.#keepAlive--;
if (this.#keepAlive === 0) {
throw err;
}
}
}
/**
* @internal

View File

@@ -1,4 +1,4 @@
export { CommandType, PluginType, PayloadType, EventType } from './enums';
export * from './context';
export * from './services';
export * as __Services from './default-services';

View File

@@ -1,21 +0,0 @@
import { ErrorHandling } from '../../interfaces';
/**
* @internal
* @since 2.0.0
* Version 4.0.0 will internalize this api. Please refrain from using the defaults!
*/
export class DefaultErrorHandling implements ErrorHandling {
crash(err: Error): never {
throw err;
}
#keepAlive = 1;
updateAlive(err: Error) {
this.#keepAlive--;
if (this.#keepAlive === 0) {
throw err;
}
}
}

View File

@@ -1,2 +0,0 @@
export * from './error-handling';
export * from './logger';

View File

@@ -11,7 +11,7 @@
* Plugins are reminiscent of middleware in express.
*/
import type { Err, Ok, Result } from 'ts-results-es';
import type { Err, Ok } from 'ts-results-es';
import type {
BothCommand,
ButtonCommand,

View File

@@ -9,15 +9,4 @@ export interface Wrapper {
commands: string;
defaultPrefix?: string;
events?: string;
/**
* Overload to enable mode in case developer does not use a .env file.
* @deprecated - https://github.com/sern-handler/handler/pull/325
*/
mode?: string
/*
* @deprecated
*/
containerConfig?: {
get: (...keys: (keyof Dependencies)[]) => unknown[];
};
}