import { ServerRouteHandlerResources , ServerRouteRepository , ServerRouteCreateOptions , } from './typings' ; export function createServerRouteRepository < TRouteHandlerResources extends ServerRouteHandlerResources = never , TRouteCreateOptions extends ServerRouteCreateOptions = never > ( ) { let routes = { } ; return { add ( route ) { routes = { ... routes , [ route . endpoint ] : route , } ; return this as any ; } , merge ( repository ) { routes = { ... routes , ... Object . fromEntries ( repository . getRoutes ( ) . map ( ( route ) => [ route . endpoint , route ] ) ) , } ; return this as any ; } , getRoutes : ( ) => Object . values ( routes ) , } ; }