/// /// import "reflect-metadata"; import { Action } from "./Action"; import { ActionMetadata } from "./metadata/ActionMetadata"; import { TypeStackOptions } from "./TypeStackOptions"; import { Application } from "express"; import { Server } from "http"; import { Connection } from "typeorm"; /** * Bootstraps TypeStack framework. * Registers controllers and middlewares and creates http server. */ export declare class TypeStackFramework { /** * Framework options. */ options: TypeStackOptions; /** * Express application instance. */ application: Application; /** * Running http server instance. */ server: Server; /** * TypeORM connection. * Connection is setup only if typeorm connection settings are defined. */ ormConnection: Connection; /** * Used to check and handle controller action parameters. */ private parameterHandler; constructor(options: TypeStackOptions); /** * Starts express application and http server. * If port is not given then port from the framework options will be used. */ start(port?: number): Promise; /** * Stops express application and http server. */ stop(): Promise; /** * Registers action middlewares and a action route handler function. */ registerAction(actionMetadata: ActionMetadata): void; /** * Handles result of failed executed controller action. */ onError(action: Action, error: any): void; /** * Computes controller action parameters and executes this action. */ protected computeParamsAndExecuteAction(action: Action): void; /** * Setups container for the action and executes controller action. */ protected createContainerAndExecuteAction(action: Action, params: any[]): Promise | any; /** * Setups entity manager and transaction stuff and executes controller action. */ protected setupTransactionAndExecuteAction(action: Action, params: any[]): Promise | any; /** * Executes controller action. */ protected executeAction(action: Action, params: any[]): any; /** * Handles result of the action method execution and sends respond back if needed. */ protected handleActionExecutionResult(action: Action, result: any): Promise | any; /** * Handles result of successfully executed controller action. */ protected handleSuccess(action: Action, result: any): void; /** * Handles result of failed executed controller action. */ protected handleError(action: Action, error: any): any; /** * Checks if controller action execution result must be class-transformed */ protected isTransformationEnabled(result: any): boolean; }