Proxy TRPC server to another client

IItsWendell11/27/2022
I've two TRPC servers, one essentially acts like a proxy, it validates auth and based on a specific property it forwards you to the destined server (with that one property removed).

Now I have to write all those queries and mutation twice, is there a simpeler way to do this? Is there any way to bind a specific TRPC client to a server?
IItsWendell11/27/2022
A little bit more context, the other server is a Cloudflare Workers Durable Object, which I managed to get to work with TRPC.

I can essentially do: const trpc = MyDurableObject.getClient(id) which will return a TRPC client instance.
A/Kalex / KATT11/27/2022
Unsure if it helps but here is an example how you can glue services in the client https://github.com/trpc/trpc/tree/main/examples/soa
IItsWendell11/27/2022
Hmh no I want to glue a specific client to a server, not a client to two servers or two routers into 1 server, I want a trpc router to act like a proxy.
IItsWendell11/27/2022
Since Durable Objects are not accessable outside of Workers, both of which can be viewed as servers. E.g. server A can only access server B, but I want the client to be able to access server B through server A.
A/Kalex / KATT11/27/2022
We don't have anything automatic for that but wouldn't be impossible to build
A/Kalex / KATT11/27/2022
Sounds like graphql federation but for trpc haha
IItsWendell11/27/2022
Yeah that would be awesome to have, especially in the serverless context