-
-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature Request] Custom RPC db operations #1387
Comments
Hi @Ataraxy , thanks for filing this and the proposal. First of all, since Prisma client extension is not part of the schema, ZenStack doesn't really have knowledge of it. Plugins like trpc generation are solely based on the schema today. Do you think what you need can be resolved by implementing a custom trpc route? Trpc allows flexible route merging. You can use ZenStack-enhanced prisma client inside the custom-implemented router, and merge it with ZenStack-generated ones. The benefit is that you have full control of the server-side and don't need to have multiple client-side queries. Trpc is mainly a server-side framework anyway. |
Would it be possible to allow for custom db ops so that they can be used with the RPC client? It seems that they're hard coded.
For example, If I want to create a prisma client extension that will do a findManyAndCount on a model, I would like to be able to also use it via RPC.
Though as an aside I'm unsure if this above extension would even work with an enhanced client but that's besides the point.
This example could of course be done with two separate queries client side or if something like a zenstack transactions api is put in such as this thread is discussing: #1203
Still such a feature could prove to be useful for other model related extensions.
Maybe it can be as simple as adding an options object that can be passed to the handler (perhaps a customOps property that is an array) and if the op exists in it then it will allow it through and not throw an error. It may also need to skip the part right after that validates the zodschema if this were the case.
zenstack/packages/server/src/api/rpc/index.ts
Lines 58 to 131 in 3291c6e
The text was updated successfully, but these errors were encountered: