@cmmv/core
Version:
CMMV core module for contract and application management
80 lines (79 loc) • 3.62 kB
TypeScript
import { IHTTPSettings, ConfigSchema, IContract } from './interfaces';
import { AbstractHttpAdapter, AbstractWSAdapter } from './abstracts';
import { ITranspile, Logger, Module } from '.';
export interface IApplicationSettings {
wsAdapter?: new (appOrHttpServer: any) => AbstractWSAdapter;
httpAdapter?: new (instance?: any) => AbstractHttpAdapter;
httpOptions?: IHTTPSettings;
httpMiddlewares?: Array<any>;
transpilers?: Array<new () => ITranspile>;
modules?: Array<Module>;
contracts?: Array<new () => any>;
services?: Array<any>;
providers?: Array<any>;
resolvers?: Array<any>;
}
export declare class Application {
protected logger: Logger;
static instance: Application;
static appModule: {
controllers: any[];
providers: any[];
httpMiddlewares: any[];
httpInterceptors: any[];
httpAfterRender: any[];
};
protected settings: IApplicationSettings;
protected compile: boolean;
protected httpAdapter: AbstractHttpAdapter;
protected httpBind: string;
protected httpOptions: IHTTPSettings;
protected wsAdapter: AbstractWSAdapter;
protected wsServer: any;
wSConnections: Map<string, any>;
protected modules: Array<Module>;
protected transpilers: Array<new () => ITranspile>;
protected controllers: Array<any>;
protected submodules: Array<Module>;
protected contracts: Array<any>;
protected configs: Array<ConfigSchema>;
protected entities: Array<any>;
protected models: Array<any>;
protected resolvers: Array<any>;
providersMap: Map<string, any>;
static contractsCls: Array<new () => {}>;
static models: Map<string, new () => any>;
protected host: string;
protected port: number;
constructor(settings: IApplicationSettings, compile?: boolean);
protected preInitialize(): Promise<void>;
protected initialize(settings: IApplicationSettings, compile?: boolean): Promise<void>;
restart(): Promise<boolean>;
protected execProcess(settings: IApplicationSettings): Promise<void>;
protected createScriptBundle(): Promise<void>;
protected createCSSBundle(): Promise<void>;
protected loadModules(modules: Array<Module>): void;
protected processContracts(): void;
protected loadModels(contract: IContract): Promise<void>;
protected getRootPath(contract: any, context: string): string;
protected getGeneratedPath(contract: any, context: string): string;
protected getPublicContracts(): Promise<void>;
static awaitModule(moduleName: string, cb: Function, context: any): void;
static awaitService(serviceName: string, cb: Function, context: any): void;
static getModel(modelName: string): new () => any;
protected static generateModule(): Promise<Module>;
getHttpAdapter(): AbstractHttpAdapter;
getUnderlyingHttpServer(): void;
getWSServer(): AbstractWSAdapter;
static create(settings?: IApplicationSettings): Application;
static compile(settings?: IApplicationSettings): Application;
static exec(settings?: IApplicationSettings): Promise<void>;
static execAsyncFn(settings: IApplicationSettings, providerClass: new () => any, functionName: string): Promise<unknown>;
static setHTTPMiddleware(cb: Function): void;
static setHTTPInterceptor(cb: Function): void;
static setHTTPAfterRender(cb: Function): void;
static resolveProvider<T = undefined>(providerCls: new (...args: any) => T): T;
static getContract(contractName: string): new () => {} | null;
static getResolvers(): any[];
static getResolver(resolverName: string): any[];
}