Rename TSInjex to TSinjex and Add Jest Setup in README
Renamed all instances of 'TSInjex' to 'TSinjex' for consistency across the codebase, including interfaces, classes, and test files. Updated the version in `package.json` from 0.0.5 to 0.0.6. Added Jest setup example to the `README.md` to guide developers on initial configuration for testing.
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
import { ITSInjex } from './ITSInjex';
|
||||
import { ITSinjex } from './ITSinjex';
|
||||
|
||||
/**
|
||||
* General error class for {@link ITSInjex} interface.
|
||||
* General error class for {@link ITSinjex} interface.
|
||||
*/
|
||||
export class TSInjexError extends Error {
|
||||
export class TSinjexError extends Error {
|
||||
/**
|
||||
* Creates a new instance of {@link TSInjexError}
|
||||
* Creates a new instance of {@link TSinjexError}
|
||||
* @param message **The error message**
|
||||
*/
|
||||
constructor(message: string) {
|
||||
@@ -15,10 +15,10 @@ export class TSInjexError extends Error {
|
||||
}
|
||||
|
||||
/**
|
||||
* Error class for dependency resolution errors in {@link ITSInjex}.
|
||||
* @see {@link ITSInjex.resolve}
|
||||
* Error class for dependency resolution errors in {@link ITSinjex}.
|
||||
* @see {@link ITSinjex.resolve}
|
||||
*/
|
||||
export class DependencyResolutionError extends TSInjexError {
|
||||
export class DependencyResolutionError extends TSinjexError {
|
||||
/**
|
||||
* Creates a new instance of {@link DependencyResolutionError}
|
||||
* @param identifier **The identifier of the dependency**
|
||||
|
@@ -1,70 +1,70 @@
|
||||
/**
|
||||
* Static TSInjex Interface
|
||||
*/
|
||||
export interface ITSInjex_ extends ITSInjexRegister, ITSInjexResolve {
|
||||
/**
|
||||
* Get the **singleton** TSInjex instance.
|
||||
*/
|
||||
getInstance(): ITSInjex;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register method for static and instance Dependency Injection Container.
|
||||
*/
|
||||
export interface ITSInjexRegister {
|
||||
/**
|
||||
* Register a dependency.
|
||||
* @param identifier The identifier of the dependency.
|
||||
* @param dependency The dependency to register.
|
||||
* @param deprecated If true, the dependency is deprecated => a warning
|
||||
* is logged when the dependency is resolved.
|
||||
*/
|
||||
register<T>(identifier: string, dependency: T, deprecated?: boolean): void;
|
||||
/**
|
||||
* Register a deprecated dependency.
|
||||
* @param identifier The identifier of the dependency.
|
||||
* @param dependency The dependency to register.
|
||||
* @param deprecated A warning is logged when the dependency is resolved.
|
||||
*/
|
||||
register<T>(identifier: string, dependency: T, deprecated?: true): void;
|
||||
/**
|
||||
* Register a dependency.
|
||||
* @param identifier The identifier of the dependency.
|
||||
* @param dependency The dependency to register.
|
||||
* @param deprecated No warning is logged when the dependency is resolved.
|
||||
*/
|
||||
register<T>(identifier: string, dependency: T, deprecated?: false): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve method for static and instance Dependency Injection Container.
|
||||
*/
|
||||
export interface ITSInjexResolve {
|
||||
/**
|
||||
* Resolve a dependency
|
||||
* @param identifier The identifier of the dependency
|
||||
* @param necessary If true, throws an error if the dependency is not found
|
||||
* @returns The resolved dependency or undefined if the dependency is not found
|
||||
*/
|
||||
resolve<T>(identifier: string, necessary?: boolean): T | undefined;
|
||||
/**
|
||||
* Resolve a necessary dependency.
|
||||
* @param identifier The identifier of the dependency.
|
||||
* @param necessary If true, throws an error if the dependency is not found.
|
||||
* @returns The resolved dependency.
|
||||
* @throws Error if the dependency is not found.
|
||||
*/
|
||||
resolve<T>(identifier: string, necessary?: true): T;
|
||||
/**
|
||||
* Resolve a non necessary dependency
|
||||
* @param identifier The identifier of the dependency
|
||||
* @param necessary Not necessary, does not throw an error if the dependency is not found.
|
||||
* @returns The resolved dependency or undefined if the dependency is not found
|
||||
*/
|
||||
resolve<T>(identifier: string, necessary?: false): T | undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* TSInjex Interface
|
||||
*/
|
||||
export interface ITSInjex extends ITSInjexRegister, ITSInjexResolve {}
|
||||
/**
|
||||
* Static TSInjex Interface
|
||||
*/
|
||||
export interface ITSinjex_ extends ITSinjexRegister, ITSinjexResolve {
|
||||
/**
|
||||
* Get the **singleton** TSInjex instance.
|
||||
*/
|
||||
getInstance(): ITSinjex;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register method for static and instance Dependency Injection Container.
|
||||
*/
|
||||
export interface ITSinjexRegister {
|
||||
/**
|
||||
* Register a dependency.
|
||||
* @param identifier The identifier of the dependency.
|
||||
* @param dependency The dependency to register.
|
||||
* @param deprecated If true, the dependency is deprecated => a warning
|
||||
* is logged when the dependency is resolved.
|
||||
*/
|
||||
register<T>(identifier: string, dependency: T, deprecated?: boolean): void;
|
||||
/**
|
||||
* Register a deprecated dependency.
|
||||
* @param identifier The identifier of the dependency.
|
||||
* @param dependency The dependency to register.
|
||||
* @param deprecated A warning is logged when the dependency is resolved.
|
||||
*/
|
||||
register<T>(identifier: string, dependency: T, deprecated?: true): void;
|
||||
/**
|
||||
* Register a dependency.
|
||||
* @param identifier The identifier of the dependency.
|
||||
* @param dependency The dependency to register.
|
||||
* @param deprecated No warning is logged when the dependency is resolved.
|
||||
*/
|
||||
register<T>(identifier: string, dependency: T, deprecated?: false): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve method for static and instance Dependency Injection Container.
|
||||
*/
|
||||
export interface ITSinjexResolve {
|
||||
/**
|
||||
* Resolve a dependency
|
||||
* @param identifier The identifier of the dependency
|
||||
* @param necessary If true, throws an error if the dependency is not found
|
||||
* @returns The resolved dependency or undefined if the dependency is not found
|
||||
*/
|
||||
resolve<T>(identifier: string, necessary?: boolean): T | undefined;
|
||||
/**
|
||||
* Resolve a necessary dependency.
|
||||
* @param identifier The identifier of the dependency.
|
||||
* @param necessary If true, throws an error if the dependency is not found.
|
||||
* @returns The resolved dependency.
|
||||
* @throws Error if the dependency is not found.
|
||||
*/
|
||||
resolve<T>(identifier: string, necessary?: true): T;
|
||||
/**
|
||||
* Resolve a non necessary dependency
|
||||
* @param identifier The identifier of the dependency
|
||||
* @param necessary Not necessary, does not throw an error if the dependency is not found.
|
||||
* @returns The resolved dependency or undefined if the dependency is not found
|
||||
*/
|
||||
resolve<T>(identifier: string, necessary?: false): T | undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* TSInjex Interface
|
||||
*/
|
||||
export interface ITSinjex extends ITSinjexRegister, ITSinjexResolve {}
|
Reference in New Issue
Block a user