Commit graph

31 commits

Author SHA1 Message Date
Lukasz Ostrowski
96ffb925bd
Fix Permission / AppPermission (#220) 2023-03-16 15:03:35 +01:00
Lukasz Ostrowski
dfd632bb14
Add EnvAPL (#213)
* Add EnvAPL

* Add extra check for api url matching

* Add EnvAPL in exported files

* Change Apl to APL

* Change configured to always true

* Add readme

* Replace console table with log
2023-03-14 11:34:53 +01:00
Lukasz Ostrowski
e35d9c7fc1 Add comment to typed payload 2023-03-07 12:21:54 +01:00
Lukasz Ostrowski
0f750657cf export SyncWebhookResponsesMap 2023-03-07 12:21:54 +01:00
Lukasz Ostrowski
f5643fba6b Update expected payloads 2023-03-07 11:02:37 +01:00
Lukasz Ostrowski
ff65b615a8 Fix debug message for SaleorWebhook 2023-03-07 10:52:23 +01:00
Lukasz Ostrowski
a17232632c Fix webhook legacy fields 2023-03-07 08:30:38 +01:00
Lukasz Ostrowski
4574178fff Export NextWebhookApiHandler 2023-03-06 16:36:32 +01:00
Lukasz Ostrowski
1f4bb64a3e Fix test 2023-03-06 15:06:10 +01:00
Lukasz Ostrowski
9420209a2d
Add sync webhook (#202)
* Change process-async-saleor-webhook to process-saleor-webhook and add better debug logs

* Change processWebhook name

* wip

* Add base class structure

* refactor

* add sync payload builder

* wip

* wip

* Add some missing webhook responses

* Fix tests for Async version

* Fix tests

* Add MockAPL test util

* Refactor tests to use MockAPL

* Add test to sync webhook

* Restore legacy subscriptionQueryAst field for compatibility

* CR Fixes - TS type & event -> eventType

* Changelog, docs and remove old payment webhooks

* Apply suggestions from code review

Co-authored-by: Krzysztof Wolski <krzysztof.k.wolski@gmail.com>

* Update src/handlers/next/saleor-webhooks/process-saleor-webhook.ts

Co-authored-by: Krzysztof Wolski <krzysztof.k.wolski@gmail.com>

---------

Co-authored-by: Krzysztof Wolski <krzysztof.k.wolski@gmail.com>
2023-03-06 15:01:22 +01:00
Lukasz Ostrowski
a939281e98
Improve register handler errors API (#201) 2023-02-28 13:54:58 +01:00
Lukasz Ostrowski
195f2d9127
Add hooks to createAppRegsiterHandler (#183)
* Add hooks to createAppRegsiterHandler

* Add error handling and flatten structure

* Add tests

* Add docs

* CR suggestions applied

* Update docs
2023-02-27 14:36:22 +01:00
Lukasz Ostrowski
4f9c9c2816
Add req and res to onError callback for AsyncWebhook (#180) 2023-02-15 11:08:09 +01:00
Lukasz Ostrowski
ea65d37474
Add better error handling for async webhook factory (#176)
* Add better error handling for async webhook factory

* Add docs, make formatter function async

* Add docs, make formatter function async
2023-02-14 16:19:07 +01:00
Lukasz Ostrowski
24778df592
Add strict type literal unions for Sync and Async Events enums (#174)
* Add strict type literal unions for Sync and Async Events enums

* Fix manifest structure
2023-02-14 12:46:29 +01:00
Krzysztof Wolski
bb3396dde6
Permission check for the protected handler (#161)
* Permission check for the protected handler

* Add tests
2023-01-25 12:00:22 +01:00
Lukasz Ostrowski
67cded2e2a
Add optional URL protection to createRegisterHandler (#148)
* validateAllowSaleorUrls impl

* Implement in handler and add test

* update codeowners

* Apply suggestions from code review

Co-authored-by: Krzysztof Wolski <krzysztof.k.wolski@gmail.com>

* Rename param

Co-authored-by: Krzysztof Wolski <krzysztof.k.wolski@gmail.com>
2023-01-13 17:29:38 +01:00
Krzysztof Wolski
8dccb00edd
Fix CloudAPL response parsing (#149)
* Fix CloudAPL response parsing

* Mock signature fetch
2023-01-13 16:35:16 +01:00
Krzysztof Wolski
c4fa6a1c05
Rename apiUrl to saleorApiUrl for consistency (#144) 2023-01-12 13:39:49 +01:00
Krzysztof Wolski
62bdb80385
Implement APL 2.0 (#143)
* Implement APL 2.0

* Rename RestAPL to SaleorCloud APL

* Add mapping helper

* Modify Saleor APL documentation

* Update rest of the docs

* Update the node version in actions

* Update fetch mock

* Remove node-fetch pkg

* Remove console log

* Update test after the rebase
2023-01-11 16:55:10 +01:00
Krzysztof Wolski
e73b792496
Check app id during the registration (#136)
* Check the App ID before saving the auth data

* Update the test
2022-12-06 18:26:14 +01:00
Krzysztof Wolski
a0a19550c2
Add protected handlers for next (#121)
* Add protected handlers for next

* Remove unneeded awaits
2022-11-28 10:04:26 +01:00
Lukasz Ostrowski
ddd65dabf1
Add saleorApiUrl state param to AppBridge (#114)
* Add saleorApiUrl state param to AppBridge

* Apply payload verification check based on full api endpoint url

* Remove deprecation info

* Check if either domain or saleorApiUrl is provided
2022-11-23 10:08:04 +01:00
Lukasz Ostrowski
6fbf692a44
Add doc about SaleorAsyncWebhook (#109)
* Add doc about SaleorAsyncWebhook

* Apply suggestions from code review

Co-authored-by: Krzysztof Wolski <krzysztof.k.wolski@gmail.com>

* Update docs/saleor-async-webhook.md

Co-authored-by: Krzysztof Wolski <krzysztof.k.wolski@gmail.com>

Co-authored-by: Krzysztof Wolski <krzysztof.k.wolski@gmail.com>
2022-11-22 11:46:05 +01:00
Krzysztof Wolski
83ed6719d5
subscriptionQueryAst or query argument has to be specified for the event subscription (#107) 2022-11-05 10:35:01 +01:00
Krzysztof Wolski
33d7666c7d
Improve debug messages for async webhook handler (#105) 2022-11-03 19:44:54 +01:00
Krzysztof Wolski
e439438d8f
Add functions to process the Saleor webhooks (#100)
* Add functions to process the saleor webhooks

Co-authored-by: Lukasz Ostrowski <lukasz.ostrowski@saleor.io>
2022-11-03 13:05:28 +01:00
Lukasz Ostrowski
bb0786a544
Fix checking APL configuration state (#79) 2022-10-12 10:08:32 +02:00
Lukasz Ostrowski
a839314f08
Add central SaleorApp instance (#71)
* Add SaleorApp class

* Add middleware and tests

* Move APL validation to APL

* Fix test

* Add prepush hook

* Add better error for missing vercel envs

* Add test
2022-10-11 09:40:08 +02:00
Lukasz Ostrowski
1504036698
Fix export. Add async manifest factory (#67) 2022-10-05 15:07:07 +02:00
Lukasz Ostrowski
0352356fd3
Add Handler factories (#61)
* Add createManifestHandler

* Add register handler factory

* Add docs to handlers factory

* Improve tsup configuration (select entry points)

* Reexport symbols from index

* Improve tests
2022-09-21 11:25:01 +02:00