@decaf-ts/core
Version:
Core persistence module for the decaf framework
24 lines (23 loc) • 1.12 kB
TypeScript
import { InjectableRegistryImp } from "@decaf-ts/injectable-decorators";
/**
* @description Registry for injectable repositories.
* @summary Extends the base injectable registry to provide automatic repository resolution for models.
* @param {void} - No constructor parameters required.
* @class InjectablesRegistry
* @example
* const registry = new InjectablesRegistry();
* const userRepo = registry.get<UserRepository>('User');
* // If UserRepository exists, it will be returned
* // If not, but User model exists, a repository will be created for it
*/
export declare class InjectablesRegistry extends InjectableRegistryImp {
constructor();
/**
* @description Gets an injectable by name with repository auto-resolution.
* @summary Extends the base get method to automatically resolve repositories for models when not found directly.
* @template T - The type of injectable to return.
* @param {string} name - The name of the injectable to retrieve.
* @return {T | undefined} - The injectable instance or undefined if not found.
*/
get<T>(name: string): T | undefined;
}