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: webhooks #20129
feat: webhooks #20129
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Don't want to clutter this PR so I will be adding the following improvements in other prs:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, did you want to me to test it out too?
@markkaylor I will ask for QA in one of the following PRs where I improve a couple things |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code looks good! I just have one question if you can clarify
const emitWebhook = async ( | ||
uid: UID.Schema, | ||
eventName: WebhookEvent, | ||
entry: Modules.Documents.AnyDocument | ||
) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What I find odd about this function is that it's not webhook specific. What it technically does is just emit an event, which affects webhooks as much as audit logs or any potential other listener.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think we should prevent any type of event being userd in this function? it could easily be an if case
Is this PR implementing stable webhook payloads, or is that later? 👀🥺 |
Commenting before reviewing:
|
@alexandrebodin I am hesitant on the approach for keeping retrocompatibility, Assuming we don't want to trigger both "document.xxx" & "entry.xxx" at the same time (e.g document.create && entry.create):
wdyt? |
@joshuaellis it's implementing stable payload except for |
I think we want to trigger both. those are events or webhooks sent. up to the user to listen for them or not :) |
Alright :) will send them both |
#20136) * feat: refactor publication methods * fix: remove unnecessary chain op in db query
@@ -92,7 +92,10 @@ export default function createEventHub(): EventHub { | |||
}, | |||
|
|||
removeAllListeners() { | |||
return eventHub.destroy(); | |||
const destroy = eventHub.destroy(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hum I wonder if we should replace this with just a listeners.clear & add a removeAllSubscribers. & make destroy do
this.removeAllListeners();
this.removeAllSubscribers();
wdyt ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:cheff-kiss: sounds great to me, will do that
merged, nice! Any chance we can get a new beta with this? (despite releasing one about a day ago) |
@verdverm sorry missed this message! Probalby a bit late but just in case this was not released in the latest beta: |
What does it do?
Trigger webhooks on document service.
Only if using the document service, the webhooks will be triggered. So, using the query engine will not trigger them.
A schema of what triggers what: