vulcain-corejs
Version:
Vulcain micro-service framework
109 lines (108 loc) • 3.16 kB
TypeScript
import { Domain } from './schemas/schema';
import 'reflect-metadata';
import { IContainer } from "./di/resolvers";
import { AbstractAdapter } from './servers/abstractAdapter';
import { UserContext } from './servers/requestContext';
import './defaults/serviceExplorer';
import './defaults/dependencyExplorer';
import './pipeline/scopeDescriptors';
import { ScopesDescriptor } from './pipeline/scopeDescriptors';
/**
* Application base class
*
* @export
* @abstract
* @class Application
*/
export declare class Application {
private _executablePath;
private _container;
private _domain;
enableHystrixStream: boolean;
private _basePath;
adapter: AbstractAdapter;
/**
* Enable api key authentication
*
* @param {string} apiKeyServiceName Vulcain service name
* @param {string} [version="1.0"] Service version
*
* @memberOf Application
*/
enableApiKeyAuthentication(apiKeyServiceName: string, version?: string): void;
/**
* Set the user to use in local development
*
* @param {UserContext} user
* @returns
*/
setTestUser(user?: UserContext): void;
/**
* Called when the server adapter is started
*
* @param {*} server
*/
onServerStarted(server: any, adapter: any): void;
/**
* Current component container
* @returns {Container}
*/
readonly container: IContainer;
/**
* Get the current domain model
* @returns {Domain}
*/
readonly domain: Domain;
private findBasePath();
/**
* Create new application
* @param path Files base path for components discovery
* @param container Global component container
* @param app (optional)Server adapter
*/
constructor(domainName?: string, container?: IContainer);
private startHystrixStream();
protected defineScopes(scopes: ScopesDescriptor): void;
/**
* Override this method to initialize default containers
*
* @protected
* @param {IContainer} container
*/
protected initializeDefaultServices(container: IContainer): void;
/**
* Override this method to add your custom services
*
* @protected
* @param {IContainer} container
*/
protected initializeServices(container: IContainer): void;
/**
* Called before the server adapter is started
*
* @protected
* @param {AbstractAdapter} abstractAdapter
*/
protected initializeServerAdapter(abstractAdapter: AbstractAdapter): void;
/**
* Initialize and start application
*
* @param {number} port
*/
start(port: number): Promise<void>;
private registerComponents();
/**
* Discover models components
* @param path Where to find models component relative to base path (default=/api/models)
* @returns {Container}
*/
private registerRecursive(path);
/**
* Inject all components from a specific folder (relative to the current folder)
*
* @protected
* @param {string} path Folder path
* @returns The current container
*/
protected injectFrom(path: string): IContainer;
}