hamish
hamish3w ago

Extending "Meta" with downstream concat usage?

Is there a way to extend the meta when using concat and creating plugins and middleware? e.g having a plugin called permission and then requiring the meta data to extend the existing base Meta to contain a new required field e.g permission In my attempts I've just been getting "meta mismatch"
6 Replies
hamish
hamishOP3w ago
Usage could be something like this?
type PermissionPluginMeta = {
permissions: string;
} & Meta;
type PermissionPluginMeta = {
permissions: string;
} & Meta;
Alex / KATT 🐱
GitHub
Procedure with parametes ? · trpc trpc · Discussion #5196
Is there something in trpc, that we can do to get role based procedures, something like this ping: publicProcedure.meta({ description: "Returns a Pong" }).query(() => { return "Po...
Alex / KATT 🐱
If the concat isn't flexible enough for you to make something like that a plugin, we'd love to improve it
hamish
hamishOP3w ago
I think that's a pretty good way around what I had in mind but the plugin system where you could extend the "base" meta with whatever the plugin required would be ideal Is there something that you had in mind long-term?
Alex / KATT 🐱
we don't have an exact plan but we want it to be flexible so would love a feature request describe what you're trying to do, why and what you think is missing
hamish
hamishOP2w ago
GitHub
Extending Meta with middlewares / concat / plugins · trpc trpc · Di...
Context Let's set the scene of the problem and some ideas of what could be done. Let's say we have a base product that is just for authenticating users and we have multiple contexts that ca...