import { A as AllServerSettingsType, k as Middleware, B as BaseRouter, M as MethodTypes, a4 as HandlerType, a5 as RouterOptionsType, S as ServerAdapter, i as ServerlessAdapter, a6 as HandlerForServerless } from '../index-CyBsO7TM.cjs';
import { S as ServerDomain } from '../index-BhaZjd65.cjs';
import '@palmares/core';
import '../status-RlKnv8eR.cjs';
import '../response/utils.cjs';
import '@palmares/core/dist/src/index-CkvPmDl3';

declare function loadServer(args: {
    settings: AllServerSettingsType;
    commandLineArgs: {
        keywordArgs: {
            port?: number;
        };
        positionalArgs: object;
    };
    domains: ServerDomain[];
}): Promise<void>;
/**
 * By default we don't know how to handle the routes by itself. Pretty much MethodsRouter does everything
 * that we need here during runtime. So we pretty much need to extract this data "for free".
 */
declare function getRootRouterCompletePaths(domains: ServerDomain[], settings: AllServerSettingsType['servers'][string], isDebugModeEnabled?: boolean): Promise<Map<string, {
    middlewares: Middleware[];
    urlParams: BaseRouter["__urlParamsAndPath"]["params"];
    queryPath: string;
    urlPath: string;
    queryParams: BaseRouter["__queryParamsAndPath"]["params"];
    partsOfPath: {
        part: string;
        isUrlParam: boolean;
    }[];
    router: BaseRouter;
    handlers: { [method in MethodTypes]?: {
        handler: HandlerType<string, Middleware[]>;
        options?: RouterOptionsType;
    }; };
}>>;
/**
 * Responsible for wrapping the handler and the middlewares into a single function that will be called when a
 * request is made to the server.
 *
 * The server adapter is responsible for passing the data it needs to be able to safely translate the request
 * and response during it's lifecycle.
 *
 * @param method - The method that was extracted from the router.
 * @param middlewares - The middlewares that will be applied to the request.
 * @param queryParams - The query params that were extracted from the router.
 * @param urlParams - The url params that were extracted from the router.
 * @param handler - The handler that will be called when the request is made.
 * @param server - The server adapter that was selected.
 * @param handler500 - The handler500 that was set on the settings so we can handle errors.
 */
declare function wrapHandlerAndMiddlewares(method: MethodTypes, middlewares: Middleware[], queryParams: BaseRouter['__queryParamsAndPath']['params'], urlParams: BaseRouter['__urlParamsAndPath']['params'], handler: HandlerType<string, any[]>, options: RouterOptionsType | undefined, server: ServerAdapter | ServerlessAdapter, customServerInstance: any, handler500?: AllServerSettingsType['servers'][string]['handler500'], validation?: AllServerSettingsType['servers'][string]['validation']): (serverRequestAndResponseData: any) => Promise<any>;
declare function generateServerlessHandler(settings: AllServerSettingsType['servers'][string], allSettings: AllServerSettingsType, serverName: string, domainName: string, method: MethodTypes | 'all', path: string, pathOfHandler: {
    pathOfHandler: string;
}): HandlerForServerless;
/**
 * A generator that will yield all of the routers that were extracted from the domains and the settings.
 * Used for {@link ServerRouterAdapter.parseHandlers} function.
 */
declare function getAllRouters(domains: ServerDomain[], settings: AllServerSettingsType['servers'][string], allSettings: AllServerSettingsType, serverAdapter: ServerAdapter | ServerlessAdapter, customServerInstance: any, options?: {
    serverless?: {
        generate: boolean;
        use: {
            method: MethodTypes;
            route: string;
        };
    };
}): AsyncGenerator<{
    translatedPath: string;
    handlers: Map<MethodTypes | "all", {
        handler: ReturnType<typeof generateServerlessHandler>;
        options?: RouterOptionsType["customOptions"];
    }>;
    queryParams: Map<string, {
        type: ("number" | "string" | "boolean")[];
        isOptional: boolean;
        isArray: boolean;
        regex: RegExp | undefined;
    }>;
} | {
    translatedPath: string;
    handlers: Map<MethodTypes | "all", {
        handler: ReturnType<typeof wrapHandlerAndMiddlewares>;
        options?: RouterOptionsType["customOptions"];
    }>;
    queryParams: Map<string, {
        type: ("number" | "string" | "boolean")[];
        isOptional: boolean;
        isArray: boolean;
        regex: RegExp | undefined;
    }>;
}, void, unknown>;
/**
 * A generator that will yield all of the routers that were extracted from the domains and the
 * settings. Used for {@link ServerRouterAdapter.parseHandler} function.
 */
declare function getAllHandlers(domains: ServerDomain[], settings: AllServerSettingsType['servers'][string], serverAdapter: ServerAdapter | ServerlessAdapter): AsyncGenerator<{
    path: string;
    method: string;
    options: undefined;
    handler: (serverRequestAndResponseData: any) => Promise<any>;
    partsOfPath: {
        part: string;
        isUrlParam: boolean;
    }[];
    queryParams: Map<string, {
        type: ("number" | "string" | "boolean")[];
        isOptional: boolean;
        isArray: boolean;
        regex: RegExp | undefined;
    }>;
    urlParams: Map<string, {
        type: ("number" | "string" | "boolean")[];
        regex: RegExp | undefined;
    }>;
}, void, unknown>;
declare function wrap404HandlerAndRootMiddlewares(serverAdapter: ServerAdapter | ServerlessAdapter, customServerInstance: any, middlewares: Middleware[], handler404: AllServerSettingsType['servers'][string]['handler404'], handler500: AllServerSettingsType['servers'][string]['handler500']): (serverRequestAndResponseData: any) => Promise<any>;
/**
 * This will initialize all of the routers in sequence, it'll extract all of the routes from all of
 * the domains and initialize them on the server.
 */
declare function initializeRouters(customServerInstance: any, domains: ServerDomain[], settings: AllServerSettingsType['servers'][string], allSettings: AllServerSettingsType, serverAdapter: ServerAdapter | ServerlessAdapter, options?: {
    serverless?: {
        generate?: boolean;
        /** An object that contains data for when running serverless functions */
        use?: {
            /** Gets the method from the request, should be lower cased */
            getMethod: () => string;
            /** Gets the path route from the request */
            getRoute: () => string;
            /** The data to send to the request during the request / response lifecycle */
            requestAndResponseData?: any;
        };
    };
}): Promise<any>;

export { getAllHandlers, getAllRouters, getRootRouterCompletePaths, initializeRouters, loadServer, wrap404HandlerAndRootMiddlewares };
