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

feat: support middleware chaining #89

Merged
merged 16 commits into from
Apr 3, 2024
Merged

feat: support middleware chaining #89

merged 16 commits into from
Apr 3, 2024

Conversation

TheEdoRan
Copy link
Owner

See #88

This commit adds `use()` and `define()` methods to the action client, in order to support chaining
of middlewares, with type safe context.

BREAKING CHANGE: Before, you would pass a single middleware function to the action client. Now, you
can chain middlewares using `use()` method and then define your action with the `define()` method.
…nctions

Improve middleware implementation and add `metadata` method to pass metadata to middleware
functions. For now, just `actionName` property is supported, but this may be expanded in the future.
Before, input schemas were passed to the `define` method as the first argument. From now on, they'll
be passed to `schema` method instead, which returns the `define` function with type safe arguments.
Copy link

vercel bot commented Mar 27, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
next-safe-action-example-app ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 3, 2024 0:04am
next-safe-action-website ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 3, 2024 0:04am

@rwieruch
Copy link
Sponsor

I love tRPC, so I am really looking forward to this. Is there a general issue/discussion where everything related to v7 gets tracked?

@TheEdoRan TheEdoRan linked an issue Mar 28, 2024 that may be closed by this pull request
@TheEdoRan
Copy link
Owner Author

Hey @rwieruch,

I love tRPC, so I am really looking forward to this.

Great, me too!

Is there a general issue/discussion where everything related to v7 gets tracked?

You can check out the v7 milestone for that. The main feature to implement I'd say is Form Actions support.

@TheEdoRan TheEdoRan merged commit 714554d into next Apr 3, 2024
5 checks passed
@TheEdoRan TheEdoRan deleted the middleware-chaining branch April 3, 2024 00:07
Copy link

github-actions bot commented Apr 3, 2024

🎉 This PR is included in version 7.0.0-next.12 🎉

The release is available on:

Your semantic-release bot 📦🚀

Copy link

🎉 This PR is included in version 7.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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.

[FEATURE] [v7] Support middleware chaining
2 participants