Skip to content
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

fix(client): middleware args consistency #15897

Merged
merged 6 commits into from Nov 9, 2022

Conversation

millsp
Copy link
Member

@millsp millsp commented Oct 20, 2022

Closes #15644

With this PR, we are fixing consistency issues in the shape of the arguments passed to middlewares.

To put it shortly, if you use an aggregate query like count, groupBy, or aggregate, the args you get in middleware are not exactly the ones you pass.

The reason for that is that we’ve added some “sugar” on top of the TS interfaces for aggregates to improve the DX, in turn it means we are transforming a nicer input into something that is understood by the Query Engine. That’s what ends up being passed to the middleware.

The solution is to pass the initial user input to the middlewares, not the one we have pre-transformed for the Query Engine (that should always be a hidden detail).

@millsp millsp requested review from a team and danstarns and removed request for a team October 20, 2022 00:47
@millsp millsp changed the title fix(client) middleware args consistency fix(client): middleware args consistency Oct 20, 2022
@millsp millsp requested a review from SevInf October 20, 2022 00:48
@millsp millsp added this to the 4.6.0 milestone Oct 20, 2022
@janpio janpio modified the milestones: 4.6.0, 4.7.0 Nov 8, 2022
@millsp millsp merged commit f25213b into main Nov 9, 2022
@millsp millsp deleted the correctness/fix/middleware-arg-types branch November 9, 2022 22:17
jkomyno pushed a commit that referenced this pull request Dec 21, 2022
Co-authored-by: Daniel Starns <danielstarns@hotmail.com>
jkomyno pushed a commit that referenced this pull request Dec 21, 2022
Co-authored-by: Daniel Starns <danielstarns@hotmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Args are out of sync with the action type for count when creating prisma middeware
3 participants