Skip to content

Comments

remove built in webhook response builder#413

Merged
lkostrowski merged 2 commits intomainfrom
refactor-build-sync-response
Feb 27, 2025
Merged

remove built in webhook response builder#413
lkostrowski merged 2 commits intomainfrom
refactor-build-sync-response

Conversation

@lkostrowski
Copy link
Member

No description provided.

@lkostrowski lkostrowski requested a review from a team February 26, 2025 11:16
@changeset-bot
Copy link

changeset-bot bot commented Feb 26, 2025

🦋 Changeset detected

Latest commit: c04f993

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@saleor/app-sdk Major

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

@codecov
Copy link

codecov bot commented Feb 26, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.34%. Comparing base (5fb68e6) to head (c04f993).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #413      +/-   ##
==========================================
- Coverage   83.40%   83.34%   -0.07%     
==========================================
  Files          98       98              
  Lines        3441     3428      -13     
  Branches      588      585       -3     
==========================================
- Hits         2870     2857      -13     
  Misses        560      560              
  Partials       11       11              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

"@saleor/app-sdk": major
---

Removed `ctx` parameter from SyncWebhookHandler and replace with standalone `buildSyncWebhookResponsePayload` function
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: what about AsyncWebhookHandler? or it didn't have buildResponse?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it didnt, we do not expect anything specific to be returned from async

in another PR i will introduce a building utility to return errors but I will detach it from handler context

import { buildSyncWebhookResponsePayload } from "@saleor/app-sdk/handlers/shared";

new SaleorSyncWebhook(...).createHandler(
req, res, ctx
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: we are going to remove ctx or buildResponse from ctx? I'm asking as in the beginning of changeset it seems like we are going to remove ctx completely 🤔

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I intend to remove only buildResponse, ctx stays

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If yes - I would rephrase:

Removed `ctx` parameter from SyncWebhookHandler and replace with standalone `buildSyncWebhookResponsePayload` function

to

Removed `buildResponse` parameter from SyncWebhookHandler `ctx` and replace with standalone `buildSyncWebhookResponsePayload` function

});
expect(webhook.getWebhookManifest("https://aws-lambda.com/prod").targetUrl).toBe(
"https://aws-lambda.com/prod/api/webhooks/checkout-calculate-taxes"
"https://aws-lambda.com/prod/api/webhooks/checkout-calculate-taxes",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: maybe in the other PR we can run prettier through codebase to fix formatting issues like that? 🤔

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, dont know why it didnt work on pre-commit on previous prs

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I do know - I updated prettier and it's defaults changed

@lkostrowski lkostrowski force-pushed the refactor-build-sync-response branch from 679066d to c04f993 Compare February 27, 2025 08:38
@lkostrowski lkostrowski merged commit 5b0f7a8 into main Feb 27, 2025
9 checks passed
@lkostrowski lkostrowski deleted the refactor-build-sync-response branch February 27, 2025 09:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants