import { Container } from '../di';
import type { ModuleDefinition, Token } from '../di';
import { EventBus, EventToken } from '../events';
import { HttpRequest, HttpResponse, HttpServerRuntime, HttpRouter, type HttpCorsConfig, type HttpFallbackController, type HttpRequestLoggingOptions, type RouteParameterResolverRegistry, type StaticFilesOptions } from '../http';
import { type ClassType } from '../types';
import { BaseAppConfig } from './config';
export { getCurrentApp, setCurrentApp } from './current';
export interface CreateAppOptions<C extends BaseAppConfig = BaseAppConfig> extends ModuleDefinition<C> {
    config?: ClassType<C>;
    defaultConfig?: Partial<C>;
    envPassthrough?: readonly RegExp[];
    db?: ClassType;
    frameworkConfig?: Record<string, unknown>;
    serverConfig?: Record<string, unknown>;
    cors?: HttpCorsConfig<C>;
    staticFiles?: boolean | StaticFilesOptions;
    requestLogging?: HttpRequestLoggingOptions;
    httpResolvers?: RouteParameterResolverRegistry;
    fallbackController?: ClassType<HttpFallbackController>;
    enableHealthcheck?: boolean;
    enableWorker?: boolean;
    enableDkRpc?: boolean;
}
export type AppCleanup = () => void | Promise<void>;
export declare class App<C extends BaseAppConfig = BaseAppConfig> {
    readonly options: CreateAppOptions<C>;
    readonly container: Container;
    readonly events: EventBus;
    readonly config: C;
    readonly router: HttpRouter;
    readonly http: HttpServerRuntime<C>;
    private readonly listenerClasses;
    private readonly commandClasses;
    private readonly commandModuleIds;
    private started;
    private starting?;
    private signalHandlers?;
    private forceWorkerRunner;
    private readonly devConsole?;
    private openApiDumpTimer?;
    private readonly registeredCleanups;
    private cliServiceMode;
    private replMode;
    constructor(options: CreateAppOptions<C>);
    get<T>(token: Token<T>): T;
    getInjectorContext(): Container;
    on<TEvent>(token: EventToken<TEvent>, handler: (event: TEvent) => void | Promise<void>, order?: number): () => void;
    /**
     * Register cleanup for a resource acquired by this application.
     *
     * Cleanups run once in reverse registration order after the normal shutdown event. They also run
     * when `stop()` is called after a partial/failed startup, where lifecycle listeners are not safe to
     * dispatch. The returned function unregisters cleanup for resources released early.
     */
    registerCleanup(cleanup: AppCleanup): () => void;
    start(): Promise<void>;
    private startInternal;
    stop(): Promise<void>;
    run(port?: number, host?: string): Promise<void>;
    configureForCliService(): void;
    configureForRepl(): void;
    private runEntrypointCommand;
    private printEntrypointUsage;
    private findCommand;
    private invokeCommand;
    private runWorkerEntrypoint;
    private runMigrationEntrypoint;
    private runOpenApiGenerationFromEntrypoint;
    request(request: HttpRequest, response?: HttpResponse): Promise<HttpResponse>;
    private shouldStartWorkerRunner;
    private createAutoConstructInstances;
    private scheduleOpenApiSchemaDump;
    private clearOpenApiDumpTimer;
    private registerDatabaseHealthcheck;
    private getControllerModuleIds;
    private getCommandModuleIds;
    private registerDecoratedListeners;
    private shutdownTelemetryIfInstalled;
    private runRegisteredCleanups;
    private installSignalHandlers;
    private removeSignalHandlers;
}
export declare function createApp<C extends BaseAppConfig = BaseAppConfig>(options: CreateAppOptions<C>): App<C>;
//# sourceMappingURL=base.d.ts.map