Skip to Content

Interfaces

This page details the core interfaces used throughout the library.

Core Component Interfaces

IContainer

Defines the contract for a dependency injection container. Defined in: src/domain/interface/container.interface.ts

NameTypeDefault
clear() => void

Clear all dependencies from the container.

get<T>(token: symbol) => T | undefined

Get a dependency from the container.

getAll() => unknown[]

Get all dependencies from the container.

getMany<T>(tokens: symbol[]) => T[]

Get multiple dependencies from the container.

has(token: symbol) => boolean

Check if a dependency exists in the container.

register<T>(token: symbol, implementation: T) => void

Register a dependency in the container.

registerMany<T>(tokens: symbol[], implementations: Record<symbol, T>) => void

Register a dependency in the container.

unregister(token: symbol) => void

Unregister a dependency from the container.

unregisterMany(tokens: symbol[]) => void

Unregister multiple dependencies from the container.

(See Core Concepts: Container Pattern)

IRegistry<T>

Defines the contract for a registry storing items of type T, where T must have a name: string property. Defined in: src/domain/interface/registry.interface.ts

NameTypeDefault
clear() => void

Clear the registry.

get(name: string) => T | undefined

Get a single item from the registry by name.

getAll() => T[]

Get all items from the registry.

getMany(names: string[]) => T[]

Get multiple items from the registry by their names.

has(name: string) => boolean

Check if an item exists in the registry by name.

register(item: T) => void

Register a single item in the registry.

registerMany(items: T[]) => void

Register multiple items in the registry.

unregister(name: string) => void

Unregister a single item from the registry by name.

unregisterMany(names: string[]) => void

Unregister multiple items from the registry by their names.

(See Core Concepts: Registry Pattern)

IFactory<T>

Defines the contract for a factory creating items of type T. Defined in: src/domain/interface/factory.interface.ts

NameTypeDefault
create(name: string) => T

Create an item by name.

getRegistry() => IRegistry<T>

Get the registry associated with this factory.

(See Core Concepts: Factory Pattern)

ILogger

Defines the contract for a logging service. Defined in: src/domain/interface/logger/interface.ts

NameTypeDefault
debug(message: string, options?: ILoggerMethodOptions | undefined) => void

Log a debug message.

error(message: string, options?: ILoggerMethodOptions | undefined) => void

Log an error message.

info(message: string, options?: ILoggerMethodOptions | undefined) => void

Log an info message.

trace(message: string, options?: ILoggerMethodOptions | undefined) => void

Log a trace message.

warn(message: string, options?: ILoggerMethodOptions | undefined) => void

Log a warning message.

(See Services: Logging Service)

IError

Extends the standard Error interface with additional structured properties. Defined in: src/domain/interface/error.interface.ts

NameTypeDefault
CAUSEError

Original error that caused this error, if any.

CODEstring

Error code to uniquely identify error types.

contextRecord<string, unknown>

Additional context about the error.

namestring
messagestring
stackstring
causeunknown

(See Core Concepts: Error Handling)

Last updated on