import { Expando } from "../expando"; import { AbstractType } from "../type"; import { AppServiceMetadata } from "./appServiceMetadata"; /** * Enumerates the lifetime values for application services. * * @export * @enum {number} */ export declare enum AppServiceLifetime { /** * The application service is shared (default). */ Singleton = 0, /** * The application service in instantiated with every request. */ Transient = 1, /** * The application service is shared within a scope. */ Scoped = 2 } /** * Provides information about the application service. * * @export * @class AppServiceInfo */ export declare class AppServiceInfo implements Expando { /** * Gets a value indicating whether multiple services for this contract are allowed. * * @type {boolean} * @memberof AppServiceInfo */ readonly allowMultiple: boolean; /** * Gets the application service lifetime. * * @type {AppServiceLifetime} * @memberof AppServiceInfo */ readonly lifetime: AppServiceLifetime; /** * Gets the contract type of the service. * * @type {AbstractType} * @memberof AppServiceInfo */ readonly contractType: AbstractType; /** * Gets the contract token of the service. * * @type {*} * @memberof AppServiceInfo */ readonly contractToken: any; /** * Gets an iteration of registered services. * * @readonly * @type {IterableIterator} * @memberof AppServiceInfo */ get services(): IterableIterator>; private _services; /** * Creates an instance of AppServiceInfo. * @param {Type} contractType The contract type. * @param {*} contractToken The contract token. * @param {boolean} [allowMultiple=false] Indicates whether multiple instances of the provided * @param {AppServiceLifetime} [lifetime=AppServiceLifetime.Singleton] The application service lifetime. * @memberof AppServiceInfo */ constructor({ contractType, contractToken, allowMultiple, lifetime, ...args }: { contractType: AbstractType; contractToken?: any; allowMultiple?: boolean; lifetime?: AppServiceLifetime; [key: string]: any; }); /** * Registers a service implementation for this contract. * * @template T The service implementation type. * @param {AppServiceMetadata} service * @returns {(boolean | ServiceError | AppServiceMetadata)} * True, if the service was registered successfully. * False, if the service was not registered due to a higher override priority service already registered. * ServiceError, if a service is already registered with the same override priority. * AppServiceMetadata, if the service to register overrid an existing one. The overridden service is returned. * @memberof AppServiceInfo */ private registerService; }