import { BonbonsConfigCollection as SourceConfigs, InjectableToken as IJTK, BonbonsDeptFactory as IJTFC, ImplementToken as IMPK, BonbonsEntry as Entry, BonbonsToken as Token, IBonbonsServer as IServer, BonbonsServerConfig as ServerConfig, BonbonsPipeEntry as PipeEntry, MiddlewaresFactory } from "@bonbons/contracts/dist/src/private-api"; import { Constructor } from "@bonbons/contracts"; import { ConfigsCollection } from "./di"; import { Logger } from "./plugins/public-api"; export declare abstract class BaseApp { protected readonly logger: Logger; protected readonly config: ConfigsCollection; start(): void; } export declare class BonbonsServer implements IServer { static Create(): BonbonsServer; static readonly New: BonbonsServer; /** * DI container * --- * could be change by set option DI_CONTAINER * * @description * @private * @type {SourceDI} * @memberof BonbonsServer */ private $di; private $rdi; private $configs; private $logger; private $app; private $confColls; private $port; private $is_dev; private _ctlrs; private _mwares; private _pipes; private _renews; private _scopeds; private _singletons; constructor(config?: ServerConfig); /** * Use koa middleware. * --- * use "factory" here , not "factory()", the params should be sent after factory as ...args * @description * @author Big Mogician * @param {MiddlewaresFactory} mfac middleware factory * @param {...any[]} params factory params * @returns {BonbonsServer} * @memberof BonbonsServer */ use(mfac: MiddlewaresFactory, ...params: any[]): BonbonsServer; pipe(pipe: PipeEntry): BonbonsServer; /** * Set an option * --- * Set an option with format entry{@BonbonsEntry}. * * @description * @author Big Mogician * @template T * @param {BonbonsEntry|T>} entry BonbonsEntry * @returns {BonbonsServer} * @memberof BonbonsServer */ option(entry: Entry | T>): BonbonsServer; /** * Set an option * --- * Set an option with token and provided value. * * @description * @author Big Mogician * @template T * @param {Token} token * @param {Partial} value * @returns {BonbonsServer} * @memberof BonbonsServer */ option(token: Token, value: Partial | T): BonbonsServer; /** * Set a controller * --- * * controller should be decorated by @Controller(...) * * @description * @author Big Mogician * @template T * @param {*} ctlr * @returns {BonbonsServer} * @memberof BonbonsServer */ controller(ctlr: Constructor): BonbonsServer; /** * Set a renew service * --- * * service should be decorated by @Injectable(...) * * Set a renew service with constructor. * All renew services will be created new instance anywhere and everytime. * * @description * @author Big Mogician * @template TInject * @param {Constructor} srv * @returns {BonbonsServer} * @memberof BonbonsServer */ renew(srv: Constructor): BonbonsServer; /** * Set a renew service * --- * * service should be decorated by @Injectable(...) * * Set a renew service with injectable token (such abstract class, * but not the typescript interface because there's no interface in * the javascript runtime) and implement service constructor. All * All renew services will be created new instance anywhere and everytime. * * @description * @author Big Mogician * @template TToken * @template TImplement * @param {InjectableToken} token * @param {ImplementToken} srv * @returns {BonbonsServer} * @memberof BonbonsServer */ renew(token: IJTK, srv: IMPK): BonbonsServer; /** * Set a renew service * --- * * service should be decorated by @Injectable(...) * * Set a renew service with injectable token (such abstract class, * but not the typescript interface because there's no interface in * the javascript runtime) and implement service instance factory * ( pure function with no side effects). * All renew services will be created new instance anywhere and everytime. * * @description * @author Big Mogician * @template TToken * @template TImplement * @param {InjectableToken} token * @param {InjectFactory} srv * @returns {BonbonsServer} * @memberof BonbonsServer */ renew(token: IJTK, srv: IJTFC): BonbonsServer; /** * Set a renew service * --- * * service should be decorated by @Injectable(...) * * Set a renew service with injectable token (such abstract class, * but not the typescript interface because there's no interface in * the javascript runtime) and a well-created implement service instance. * All renew services will be created new * instance everytime and anywhere (but injecting by instance means * the instance may be changed in runtime, so please be careful. If you * want to prevent this situation, use a service factory here). * * @description * @author Big Mogician * @template TInject * @template TImplement * @param {InjectableToken} token * @param {TImplement} srv * @returns {BonbonsServer} * @memberof BonbonsServer */ renew(token: IJTK, srv: TImplement): BonbonsServer; /** * Set a scoped service * --- * * service should be decorated by @Injectable(...) * * Set a scoped service with constructor. * All scoped services will be created new instance in different request pipe * * @description * @author Big Mogician * @template TInject * @param {Constructor} srv * @returns {BonbonsServer} * @memberof BonbonsServer */ scoped(srv: Constructor): BonbonsServer; /** * Set a scoped service * --- * * service should be decorated by @Injectable(...) * * Set a scoped service with injectable token (such abstract class, * but not the typescript interface because there's no interface in * the javascript runtime) and implement service constructor. All * scoped services will be created new instance in different request pipe. * * @description * @author Big Mogician * @template TToken * @template TImplement * @param {InjectableToken} token * @param {ImplementToken} srv * @returns {BonbonsServer} * @memberof BonbonsServer */ scoped(token: IJTK, srv: IMPK): BonbonsServer; /** * Set a scoped service * --- * * service should be decorated by @Injectable(...) * * Set a scoped service with injectable token (such abstract class, * but not the typescript interface because there's no interface in * the javascript runtime) and implement service instance factory * ( pure function with no side effects). * All scoped services will be created new instance in different request pipe. * * @description * @author Big Mogician * @template TToken * @template TImplement * @param {InjectableToken} token * @param {InjectFactory} srv * @returns {BonbonsServer} * @memberof BonbonsServer */ scoped(token: IJTK, srv: IJTFC): BonbonsServer; /** * Set a scoped service * --- * * service should be decorated by @Injectable(...) * * Set a scoped service with injectable token (such abstract class, * but not the typescript interface because there's no interface in * the javascript runtime) and a well-created implement service instance. * All scoped services will be created new * instance in different request pipe (but injecting by instance means * the instance may be changed in runtime, so please be careful. If you * want to prevent this situation, use a service factory here). * * @description * @author Big Mogician * @template TInject * @template TImplement * @param {InjectableToken} token * @param {TImplement} srv * @returns {BonbonsServer} * @memberof BonbonsServer */ scoped(token: IJTK, srv: TImplement): BonbonsServer; /** * Set a singleton service * --- * * service should be decorated by @Injectable(...) * * Set a singleton service with constructor. * All singleton services will use unique instance throught different request pipes. * * @description * @author Big Mogician * @template TInject * @param {Constructor} srv * @returns {BonbonsServer} * @memberof BonbonsServer */ singleton(srv: Constructor): BonbonsServer; /** * Set a singleton service * --- * * service should be decorated by @Injectable(...) * * Set a singleton service with injectable token (such abstract class, * but not the typescript interface because there's no interface in * the javascript runtime) and implement service constructor. * All singleton services will use unique * instance throught different request pipes. * * @description * @author Big Mogician * @template TToken * @template TImplement * @param {InjectableToken} token * @param {ImplementToken} srv * @returns {BonbonsServer} * @memberof BonbonsServer */ singleton(token: IJTK, srv: IMPK): BonbonsServer; /** * Set a singleton service * --- * * service should be decorated by @Injectable(...) * * Set a singleton service with injectable token (such abstract class, * but not the typescript interface because there's no interface in * the javascript runtime) and implement service factory ( pure function with no side effects). * All singleton services will use unique * instance throught different request pipes. * * @description * @author Big Mogician * @template TToken * @template TImplement * @param {InjectableToken} token * @param {InjectFactory} srv * @returns {BonbonsServer} * @memberof BonbonsServer */ singleton(token: IJTK, srv: IJTFC): BonbonsServer; /** * Set a singleton service * --- * * service should be decorated by @Injectable(...) * * Set a singleton service with injectable token (such abstract class, * but not the typescript interface because there's no interface in * the javascript runtime) and a well-created implement service instance. * All singleton services will use unique * instance throught different request pipes. * * @description * @author Big Mogician * @template TToken * @template TImplement * @param {InjectableToken} token * @param {TImplement} srv * @returns {BonbonsServer} * @memberof BonbonsServer */ singleton(token: IJTK, srv: TImplement): BonbonsServer; getConfigs(): SourceConfigs; /** * Start application * --- * @description * @author Big Mogician * @param {(configs: ReadonlyConfigs) => void} [run] * @memberof BonbonsServer */ start(run?: (configs: ConfigsCollection) => void): void; private $$afterRun; private _clearServer; private $$configsInitialization; private $$defaultOptionsInitialization; private $$useCommonOptions; private $$initLogger; private $$initDLookup; private $$initContextProvider; private $$initDIContainer; private $$preInject; private $$injectaFinally; private $$useRouters; private $$resolveControllerMethod; private $$preparePipes; private $$addPipeMiddlewares; private $$useMiddlewares; private $$selectFormParser; private $$decideFinalStep; private $$parseFuncParams; private $$selectFuncMethod; }