/// <reference types="node" />
import type { AddressInfo } from "net";
import type { Server as SecureServer } from "https";
import { Server } from "http";
import { Server as GrpcServer } from "@grpc/grpc-js";
import type { RequestHandler } from "express";
import express from "express";
import { OpenApiValidator } from "express-openapi-validator";
import { Server as SocketIoServer } from "socket.io";
import type { ServerOptions as SocketIoServerOptions } from "socket.io";
import { PluginRegistry } from "@hyperledger/cactus-core";
import { ICactusApiServerOptions } from "./config/config-service";
import { PrometheusExporter } from "./prometheus-exporter/prometheus-exporter";
export interface IApiServerConstructorOptions {
    readonly pluginManagerOptions?: {
        pluginsPath: string;
    };
    readonly pluginRegistry?: PluginRegistry;
    readonly httpServerApi?: Server | SecureServer;
    readonly wsServerApi?: SocketIoServer;
    readonly grpcServer?: GrpcServer;
    readonly wsOptions?: SocketIoServerOptions;
    readonly httpServerCockpit?: Server | SecureServer;
    readonly config: ICactusApiServerOptions;
    readonly prometheusExporter?: PrometheusExporter;
}
export declare class ApiServer {
    readonly options: IApiServerConstructorOptions;
    static readonly CLASS_NAME = "ApiServer";
    static readonly E_POST_CRASH_SHUTDOWN = "API server failed to shut itself down, will ignore this because we were already crashing anyway...";
    static readonly E_NON_EXEMPT_UNPROTECTED_ENDPOINTS: string;
    private readonly log;
    private pluginRegistry;
    private readonly httpServerApi;
    private readonly httpServerCockpit;
    private readonly wsApi;
    private readonly grpcServer;
    private readonly expressApi;
    private readonly expressCockpit;
    private readonly pluginsPath;
    prometheusExporter: PrometheusExporter;
    get className(): string;
    constructor(options: IApiServerConstructorOptions);
    getPrometheusExporter(): PrometheusExporter;
    getPrometheusExporterMetrics(): Promise<string>;
    getPluginImportsCount(): number;
    start(): Promise<{
        addressInfoCockpit: AddressInfo;
        addressInfoApi: AddressInfo;
        addressInfoGrpc: AddressInfo;
    }>;
    /**
     * Verifies that the currently running NodeJS process is at least of a certain
     * NodeJS version as specified by the configuration.
     *
     * @throws {Error} if the version contraint is not satisfied by the runtime.
     */
    checkNodeVersion(currentVersion?: string): void;
    getHttpServerApi(): Server | SecureServer;
    getHttpServerCockpit(): Server | SecureServer;
    getOrInitPluginRegistry(): Promise<PluginRegistry>;
    initPluginRegistry(): Promise<PluginRegistry>;
    private instantiatePlugin;
    private installPluginPackage;
    shutdown(): Promise<void>;
    startCockpitFileServer(): Promise<AddressInfo>;
    /**
     * Installs the own endpoints of the API server such as the ones providing
     * healthcheck and monitoring information.
     * @param app
     */
    getOrCreateWebServices(app: express.Application): Promise<void>;
    startGrpcServer(): Promise<AddressInfo>;
    startApiServer(): Promise<AddressInfo>;
    private checkNonExemptUnprotectedEps;
    createOpenApiValidator(): OpenApiValidator;
    createCorsMiddleware(allowedDomains: string[]): RequestHandler;
}
