import { Application, Response } from 'express'; import { BaseService, IBaseService } from './BaseService'; import { IBaseEndpoint } from './BaseEndpoint'; import { HTTPRequestVO, IError, TransferPacketVO } from './structures/Interfaces'; import Signal, { Req } from "badmfck-signal"; import http from 'http'; import { IDeployerServiceOptions } from './deployment/DeployerService'; import { IBlueGreenState, IBlueGreenStateOptions } from './deployment/BlueGreenState'; import { ILogFilesOptions } from './monitor/LogFiles'; export interface IMonitorUser { totpSecret?: string; role?: "admin" | "it" | "analytic"; login: string; password: string; } export interface IDocumentationUser extends IMonitorUser { endpoints?: string[]; } export interface IDeployerUser extends IMonitorUser { } export interface APIServiceNetworkLogItem { id: number; created: number; time: number; referer?: string; request: { [key: string]: any; }; response: { [key: string]: any; }; error?: string | null; } export interface IInterceptor { intercept(req: HTTPRequestVO, internalCallParams: any): Promise; } export interface APIServiceOptions { port: number; baseEndPoint: string; corsHostWhiteList: string[]; projectName: string; endpoints: IBaseEndpoint[]; keepAliveTimeout?: number; headersTimeout?: number; jsonLimit: string; isProductionEnvironment: boolean; interceptor?: IInterceptor; postproducer?: (req: HTTPRequestVO | undefined | null, res: Response, data: TransferPacketVO, requestTime: number, endpoint?: string, log?: APIServiceNetworkLogItem | null) => Promise; preproducer?: (req: HTTPRequestVO | undefined | null) => any; access: { monitor?: IMonitorUser[]; documentation?: IDocumentationUser[]; }; deployer?: IDeployerServiceOptions | null; appVersion?: string; fileTempDir: string; fileLimit: number; metricsDir?: string; blueGreenWatchMs?: number; logFiles?: ILogFilesOptions; monitorAuthDir?: string; monitorAuthFile?: string; threatMonitoring?: boolean; trustedProxies?: string[]; } type InferInterceptor = T extends IInterceptor ? U : unknown; export declare const getDefaultOptions: | undefined>(overrides?: Omit>>>, "interceptor"> & { interceptor?: I; }) => APIServiceOptions>>; export declare const REQ_HTTP_LOG: Req; export declare const REQ_HTTP_REQUESTS_COUNT: Req; export declare const REQ_HTTP_SERVER: Req; export declare const REQ_INTERNAL_CALL: Req; export declare const REQ_MONITOR_USERS: Req; export declare const REQ_DOC_USERS: Req; export declare const S_APP_STARTED: Signal; export declare function Initializer(services: IBaseService[]): Promise; export declare class APIService extends BaseService { static getBlueGreenActiveState(opts?: IBlueGreenStateOptions): Promise; static get blueGreenState(): IBlueGreenState | null; static get isLive(): boolean | null; static onLiveChange(cb: (live: boolean, state: IBlueGreenState) => void): () => void; private version; private options; private monitor; private deployer; private started; private requestsCount; private noCors; netLog: APIServiceNetworkLogItem[]; constructor(options: APIServiceOptions); init(): Promise; addNetlog(data: TransferPacketVO, req: HTTPRequestVO, created: number, time: number): void; sendResponse(ref: string, res: Response, data: TransferPacketVO, requestTime: number, endpoint?: string, req?: HTTPRequestVO): Promise; checkDataLength(data: any, result?: any, lvl?: number): any; } export {};