import { ConnectRouterOptions, ConnectRouter, ContextValues } from '@connectrpc/connect';

interface ConnectWorkersAdapterOptions<Env = unknown, CfHostMetadata = unknown> extends ConnectRouterOptions {
    /**
     * Route definitions. We recommend creating a function that defines all routes:
     *
     * ```ts
     * import {ConnectRouter} from "@connectrpc/connect"
     *
     * function routes(router: ConnectRouter) {
     *   router.service(ElizaService, {})
     * }
     * ```
     *
     * Then pass this function here.
     */
    routes: (router: ConnectRouter) => void;
    /**
     * If none of the handler request paths match, a 404 is served. This option
     * can provide a custom fallback for this case.
     */
    fallback?: ExportedHandlerFetchHandler;
    /**
     * Serve all handlers under this prefix. For example, the prefix `/something`
     * will serve the RPC `foo.FooService/Bar` under `/something/foo.FooService/Bar`.
     */
    requestPathPrefix?: string;
    /**
     * Context values to extract from the request. These values are passed to
     * the handlers.
     */
    contextValues?: (request: Request<CfHostMetadata>, env: Env, ctx: ExecutionContext) => ContextValues;
}
/**
 * Create a Cloudflare Workers fetch handler from a ConnectRouter.
 */
declare function connectWorkersAdapter<Env = unknown, CfHostMetadata = unknown>(options: ConnectWorkersAdapterOptions<Env, CfHostMetadata>): ExportedHandlerFetchHandler<Env, CfHostMetadata>;

export { type ConnectWorkersAdapterOptions, connectWorkersAdapter };
