vulcain-corejs
Version:
Vulcain micro-service framework
87 lines (86 loc) • 2.4 kB
TypeScript
import 'reflect-metadata';
import { IRequestContext } from "../pipeline/common";
/**
* List of default service names
*
* @export
* @class DefaultServiceNames
*/
export declare class DefaultServiceNames {
static Serializer: string;
static AuthenticationStrategy: string;
static AuthorizationPolicy: string;
static TenantPolicy: string;
static TaskManager: string;
static ScopesDescriptor: string;
static ServiceDescriptors: string;
static SwaggerServiceDescriptor: string;
static SecurityManager: string;
static Logger: string;
static EventBusAdapter: string;
static ActionBusAdapter: string;
static Domain: string;
static Application: string;
static ServerAdapter: string;
static Container: string;
static ProviderFactory: string;
static Metrics: string;
static StubManager: string;
static RequestTracker: string;
static ServiceResolver: string;
static BearerTokenService: string;
static HandlerProcessor: string;
static GraphQLAdapter: string;
}
/**
* Component life time
*
* @export
* @enum {number}
*/
export declare enum LifeTime {
/**
* Only one instance
*/
Singleton = 1,
/**
* Create a new instance every time
*/
Transient = 2,
/**
* Create one instance per request
*/
Scoped = 4,
}
/**
* Interface implemented by every scoped component
*
* @export
* @interface IScopedComponent
*/
export interface IScopedComponent {
/**
* Current request context (scope)
*
* @type {IRequestContext}
*/
context: IRequestContext;
}
/**
* Used to initialize a constructor parameter with a component
*
* @export
* @param {string} component name
* @param {boolean} [optional] True to not raise an exception if component doesn't exist
*/
export declare function Inject(optional?: boolean): any;
export declare function Inject(name: string, optional?: boolean): any;
/**
* Used to declare a component.
*
* @export
* @param {LifeTime} lifeTime of the component
* @param {string} [name] - By default this is the class name
* @param {enableOnTestOnly} Active this component only in an test environment
*/
export declare function Injectable(lifeTime: LifeTime, name?: string, enableOnTestOnly?: boolean): (target: any) => void;