import 'reflect-metadata'; import { Class, ClassOrAbstractClass } from './class.interface'; export interface IDependency { propertyKey: string; serviceClassOrID: string | Class; } /** * Decorator injecting a service inside a controller or another service. * * @param id {string} - The service ID. */ export declare function Dependency(id: string): (target: any, propertyKey: string) => void; /** * Decorator injecting a service inside a controller or another service. * * @export */ export declare function dependency(target: any, propertyKey: string): void; /** * Create a new service with its dependencies. * * @export * @template Service * @param {ClassOrAbstractClass} serviceClass - The service class. * @param {object} [dependencies] - An object which key/values are the service properties/instances. * @returns {Service} - The created service. */ export declare function createService(serviceClass: ClassOrAbstractClass, dependencies?: object): Service; export declare function createControllerOrService(serviceClass: ClassOrAbstractClass, dependencies?: object): T; /** * Identity Mapper that instantiates and returns service singletons. * * @export * @class ServiceManager */ export declare class ServiceManager { private readonly map; /** * Boot all services : call the method "boot" of each service if it exists. * * If a service identifier is provided, only this service will be booted. * * Services are only booted once. * * @param {(string|ClassOrAbstractClass)} [identifier] - The service ID or the service class. * @returns {Promise} * @memberof ServiceManager */ boot(identifier?: string | ClassOrAbstractClass): Promise; /** * Add manually a service to the identity mapper. * * @param {string|ClassOrAbstractClass} identifier - The service ID or the service class. * @param {*} service - The service object (or mock). * @param {{ boot: boolean }} [options={ boot: false }] If `boot` is true, the service method "boot" * will be executed when calling `ServiceManager.boot` is called. * @returns {this} The service manager. * @memberof ServiceManager */ set(identifier: string | ClassOrAbstractClass, service: any, options?: { boot: boolean; }): this; /** * Get (and create if necessary) the service singleton. * * @param {string|ClassOrAbstractClass} identifier - The service ID or the service class. * @returns {*} - The service instance. * @memberof ServiceManager */ get(identifier: ClassOrAbstractClass): T; get(identifier: string): any; private bootService; private getConcreteClassFromConfig; private getProperty; }