import { Container, UnpackFunction } from 'iti'; import * as Contracts from '../core/contracts'; /** * Type to annotate that something is a singleton. * T is created once and lazily. */ export type Singleton = () => T; /** * Type to annotate that something is transient. * Every time this is called, a new object is created */ export type Transient = () => () => T; /** * Type to annotate that something is initializable. * If T has an init method, this will be called. */ export type Initializable = T export type DependencyList = [ Contracts.Emitter, Contracts.ErrorHandling, Contracts.Logging | undefined, Contracts.ModuleManager, Contracts.Emitter, ]; export interface CoreDependencies { '@sern/client': () => Contracts.Emitter; '@sern/logger'?: () => Contracts.Logging; '@sern/emitter': () => Contracts.Emitter; '@sern/store': () => Contracts.CoreModuleStore; '@sern/modules': () => Contracts.ModuleManager; '@sern/errors': () => Contracts.ErrorHandling; } export type DependencyFromKey = Dependencies[T]; export type IntoDependencies = { [Index in keyof Tuple]: UnpackFunction>>; //Unpack and make NonNullable } & { length: Tuple['length'] }; export interface DependencyConfiguration { //@deprecated. Loggers will always be included in the future exclude?: Set<'@sern/logger'>; build: ( root: Container, {}>, ) => Container; }