import type { AnyMiddlewareChain } from 'alien-middleware'; import type { HttpAction, HttpResource, HttpRouteTree } from '../http.js'; import type { InferActionHandler } from './handler.js'; import type { Join } from './path.js'; /** * Handler map shape required by `createRouter().use(routes, handlers)`. * * @remarks The handler object mirrors the HTTP route tree. Resource nodes become * nested handler objects, while action nodes become direct handler functions. * Handler context is inferred from middleware plus accumulated path params, * query/body schemas, and header schemas. */ export type RouteRequestHandlerMap = { [K in keyof TRoutes]: TRoutes[K] extends HttpResource ? RouteRequestHandlerMap> : TRoutes[K] extends HttpAction ? InferActionHandler> : never; };