/// /// import { ErrorRequestHandler, Express, Handler, Request, Response } from 'express'; import * as http from 'http'; import { AuthenticatorPluginResult, IAuthenticator, IAuthenticatorConstructor, SakuraApiPlugin } from './plugins'; import { SakuraMongoDbConnection } from './sakura-mongo-db-connection'; export interface SakuraApiOptions { app?: Express; config?: any; configPath?: any; dbConfig?: SakuraMongoDbConnection; providers?: any[]; models: any[]; routables: any[]; plugins?: SakuraApiPlugin[]; baseUrl?: string; suppressAnonymousAuthenticatorInjection?: boolean; } export interface ServerConfig { address?: string; port?: number; bootMessage?: string; } export declare class SakuraApi { onAuthenticationError: (req: Request, res: Response, authResult?: AuthenticatorPluginResult, authenticatorName?: string) => Promise; onAuthenticationFatalError: (req: Request, res: Response, err: Error, authenticatorName?: string) => Promise<{ data: any; status: number; } | void | null>; onAuthenticationSuccess: (req: Request, res: Response, authResult?: AuthenticatorPluginResult, authenticatorName?: string) => Promise; private _address; private _app; private _baseUrl; private _config; private _dbConnections; private _port; private _server; private authenticators; private lastErrorHandlers; private listenCalled; private middlewareHandlers; private models; private providers; private routables; private routeQueue; readonly address: string; readonly app: Express; readonly baseUrl: string; config: any; readonly dbConnections: SakuraMongoDbConnection; readonly port: number; readonly server: http.Server; constructor(options: SakuraApiOptions); addMiddleware(fn: Handler, order?: number): void; addLastErrorHandlers(fn: ErrorRequestHandler): void; close(): Promise; listen(listenProperties?: ServerConfig): Promise; getAuthenticator(target: IAuthenticatorConstructor): IAuthenticator; getModelByName(name: string): any; getProvider(target: any): any; getRoutableByName(name: string): any; enqueueRoutes(target: any): void; private registerAuthenticators(options, sapiOptions); private registerModels(options); private registerPlugins(options); private registerProviders(options); private registerRoutables(options); }