Add EventNotificationHandler#2498
Conversation
13a8395 to
9d84340
Compare
| 'no-restricted-properties': 'error', | ||
| 'no-restricted-syntax': 'error', | ||
| 'no-return-assign': 'error', | ||
| 'no-return-await': 'error', |
There was a problem hiding this comment.
this rule is no longer recommended: https://eslint.org/docs/latest/rules/no-return-await
| data: RequestData, | ||
| options: RequestOptions | ||
| ) => Promise<any>; | ||
| parseEventNotification: ( |
There was a problem hiding this comment.
this is internal, it's just used for places in the codebase we call this method
| details: UnhandledNotificationDetails | ||
| ) => Promise<void>; | ||
|
|
||
| class EventRouter { |
There was a problem hiding this comment.
this type is user-facing
| /** | ||
| * TODO: docs | ||
| */ | ||
| router: ( |
There was a problem hiding this comment.
this is user facing on the client
|
|
||
| return eventNotification; | ||
| }, | ||
| router(webhookSecret: string, onUnhandledHandler: any) { |
There was a problem hiding this comment.
these types are internal, only used for our runtime code
|
@prathmesh-stripe this is ready for a final review! |
| ) => Promise<void> | ||
| ) {} | ||
|
|
||
| // these types are duplicated in the manual types |
There was a problem hiding this comment.
What was the reason for the duplicating the manual types for this function?
There was a problem hiding this comment.
iirc because these types were ignored and everything in types is what users actually saw. So I wanted to remind myself that any updates had to be made in two places
Why?
We've been designing a streamlined approach to handling incoming events that is easy to get right and hard to get wrong. This PR has the initial implementation of this new system.
The only other pending item is to add a method to allow handling a webhook without verifying the signature. This is good for testing and for Event Bridge, which doesn't use the signature-based verification. Otherwise, this is ready for review.
What?
EventHandlerclassStripeClientExample usage
See Also