import { Container, UnpackFunction } from 'iti'; import * as Contracts from '../core/interfaces'; /** * 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; export type DependencyList = [ Contracts.Emitter, Contracts.ErrorHandling, Contracts.Logging | undefined, null, Contracts.Emitter, ]; export interface CoreDependencies { '@sern/client': () => Contracts.Emitter; '@sern/emitter': () => Contracts.Emitter; '@sern/errors': () => Contracts.ErrorHandling; '@sern/logger'?: () => Contracts.Logging; } export type DependencyFromKey = Dependencies[T]; export type IntoDependencies = { [Index in keyof Tuple]: UnpackFunction>>; //Unpack and make NonNullable } & { length: Tuple['length'] }; /** * @deprecated This old signature will be incompatible with future versions of sern. */ export interface DependencyConfiguration { /* * @deprecated. Loggers will be opt-in the future */ exclude?: Set<'@sern/logger'>; build: ( root: Container, {}>, ) => Container; }