import { AnyRouter } from '@trpc/server' ; import { TRPCLink , Operation } from './core' ; export function splitLink < TRouter extends AnyRouter = AnyRouter > ( opts ) { return ( rt ) => { const links = 'left' in opts ? { true : opts . left , false : opts . right } : opts ; const yes = links . true ( rt ) ; const no = links . false ( rt ) ; return ( props ) => { opts . condition ( props . op ) ? yes ( props ) : no ( props ) ; } ; } ; }