-
Notifications
You must be signed in to change notification settings - Fork 19
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
New handlers: refactored, Web API and AWS Lambda support #380
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: 6712040 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
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.
It would be easier for me to review if I already see docs with examples. In case of SDK public API is more important than the code
@@ -0,0 +1,5 @@ | |||
--- | |||
"@saleor/app-sdk": minor |
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.
please make it major since it has breaking changes
"@saleor/app-sdk": minor | ||
--- | ||
|
||
Added `handlers/fetch-api` which adds support for frameworks that use [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) |
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.
please remember to add full changeset and docs
"./handlers/next-app-router": { | ||
"types": "./handlers/fetch-api/index.d.ts", | ||
"import": "./handlers/fetch-api/index.mjs", | ||
"require": "./handlers/fetch-api/index.js" | ||
}, |
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.
won't it have the same names as fetch api? It would be confusing, probably better to also add alias on export
so next-app-router
file can include export { FetchApi as NextAppRouterWebhook } from '../fetch-api'
or something like this
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.
would be easier if we see docs at this point
Description
This PR introduces new handlers for Fetch Web API and AWS Lambda and refactors existing code so that it can easily allow adding new platforms in the future.
After the change handlers code is splits them into 3 parts:
src/handlers/nextjs
- For handlers that use Next.js platform adaptersrc/handlers/fetch-api
- For handlers that use Fetch API platform adapterThis way we'll be able to easily add new platforms and handlers without changing existing code.
Currently in this PR:
Breaking changes
SaleorWebhook
acceptsonError
andformatErrorResponse
parameters callbacks, now they won't passres
object in Next.js runtime, since these methods weren't supposed to send responses