UNPKG

vulcain-corejs

Version:
78 lines (77 loc) 2.4 kB
import 'reflect-metadata'; import './defaults/dependencyExplorer'; import { ScopesDescriptor } from './defaults/scopeDescriptors'; import './defaults/serviceExplorer'; import { LifeTime } from './di/annotations'; import { IContainer } from "./di/resolvers"; import './graphql/graphQLHandler'; import { Domain } from './schemas/domain'; /** * Application base class * * @export * @abstract * @class Application */ export declare class Application { private domainName; private _container; private _domain; private _initialized; useMongoProvider(address: string): this; useMemoryProvider(folder: string): this; useRabbitmqBus(address: string): this; useService(name: string, service: Function, lifeTime?: LifeTime): this; enableGraphQL(responseType?: "vulcain" | "graphql"): this; /** * Current component container * @returns {Container} */ readonly container: IContainer; /** * Get the current domain model * @returns {Domain} */ readonly domain: Domain; /** * 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); /** * Only use it for testing. Used start instead */ init(): Promise<void>; /** * Define all scopes used in this service * * @protected * @param {ScopesDescriptor} scopes Scope definitions manager - Use scopes.defineScope for each scope * * @memberOf Application */ protected defineScopeDescriptions(scopes: ScopesDescriptor): this; /** * 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 application */ injectFrom(path: string): this; }