Commit graph

156 commits

Author SHA1 Message Date
Lukasz Ostrowski
450a3ce741
Remove inferWebhooks (#168) 2023-02-07 08:04:39 +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
6ffaba2dab
Allow setting initial theme from constructor in AppBridge (#162)
* Allow passing initial theme value, change initial notifyOnReady

* Update doc
2023-01-24 19:21:05 +01:00
Krzysztof Wolski
51284efa00
Handle missing encryption key for the EncryptedMetadataManager (#159)
* Handle missing encryption key for the EncryptedMetadataManager

* Fancy up the documentation

* Throw an error instead of process exit
2023-01-23 15:39:42 +01:00
Krzysztof Wolski
b84049246b
Use b64url and fix incoming data validation (#156) 2023-01-23 09:35:31 +01:00
Adrian Pilarczyk
db1cd13919
feat: 🏷️ add handle_taxes permission type (#153) 2023-01-19 12:02:46 +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
bc622dd3e1
Rename api url field in the Cloud APL (#146) 2023-01-12 16:13:27 +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
58244a465f
Restrict VercelAPL reinstallations to the same domain (#141) 2022-12-19 13:44:08 +01:00
Lukasz Ostrowski
f612da9035
Add authenticated fetch (#138)
* Add authenticated fetch

* Add tests

* Update vitest

* setup node-fetch

* update lockfle

* change to global.fetch

* add mock fetch

* Change window.fetch to global.fetch
2022-12-12 11:47:23 +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
Lukasz Ostrowski
95eac760ca
Add action that informs Dashboard that AppBridge is ready (#129)
* Add action that informs Dashboard that AppBridge is ready

* Allow AppBridge to disable automated notifyReady event

* Remove unused strategy field from RoutePropagator

* Apply suggestions from code review

Co-authored-by: Dawid <tarasiukdawid@gmail.com>

Co-authored-by: Dawid <tarasiukdawid@gmail.com>
2022-12-05 17:17:17 +01:00
Lukasz Ostrowski
b39081ed9a
Change AppBridge interval to timeout (#128) 2022-12-02 16:08:39 +01:00
Lukasz Ostrowski
063e56f345
Update app-bridge.ts (#127) 2022-12-01 10:17:02 +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
Lukasz Ostrowski
607fe73569
Update build config (#118)
* Ensure peer deps are excluded

* Release 0.20.1-0

* Change next router import to fix the build

* Release 0.20.1-1

* Restore releaseit config
2022-11-22 09:52:21 +01:00
Lukasz Ostrowski
b9aa9008e7
Add REST APL (#115)
* Add RestAPL

* Add docs
2022-11-21 11:32:36 +01:00
Lukasz Ostrowski
b4e0a053cb
Add routing changing actions and RoutePropagator (#110) 2022-11-21 11:32:18 +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
Krzysztof Wolski
6e389db9be
Remove variables from the env if are already existing (#103) 2022-11-02 14:18:27 +01:00
Lukasz Ostrowski
ff49281123
Change behavior when FileAPL reads file that doesnt exist to fallback value (#96) 2022-10-24 16:11:15 +02:00
Krzysztof Wolski
6fb103cb07
Add encrypted metadata manager (#84) 2022-10-18 13:38:00 +02:00
Krzysztof Żuraw
d7ccde30ee
feat: add getLayout to return type of withAuthorization (#82) 2022-10-13 09:22:49 +02:00
Krzysztof Wolski
bec148e696
Add Upstash APL (#78) 2022-10-12 15:13:57 +02:00
Krzysztof Wolski
be79af2d63
Add metadata manager (#73)
* Add metadata manager
2022-10-12 13:28:00 +02:00
Lukasz Ostrowski
bb0786a544
Fix checking APL configuration state (#79) 2022-10-12 10:08:32 +02:00
Lukasz Ostrowski
aa4d55b83d
Disable token iss validation (#75)
* Disable token iss validation

* Disable VercelApl constructor validation
2022-10-11 16:09:29 +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
ff0e25f8dd
Fix importing graphQL printer which failed inferWebhooks (#72) 2022-10-10 11:56:23 +02:00
Lukasz Ostrowski
1504036698
Fix export. Add async manifest factory (#67) 2022-10-05 15:07:07 +02:00
Lukasz Ostrowski
864ca16f78
Auth features (#64)
* Add useDashboardToken to app bridge module

* Add authorization HOC

* Fixes
2022-10-05 13:12:19 +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
Lukasz Ostrowski
126e949366
Detect locale param from URL in AppBridge (#58)
* Detect locale param from URL in AppBridge

* Add docs
2022-09-14 14:21:53 +02:00
Lukasz Ostrowski
d4670b048c
Fix tests and strong-type locales (#57)
* Add new event type

* Add state handling for locale change

* Add strongly typed language codes

* fix tests
2022-09-13 15:15:52 +02:00
Lukasz Ostrowski
cc18c3deac
Add AppBridgeProvider and events factory (#51)
* Add events factory

* Add AppBridgeProvider

* Rewrite useAppBridge, add tests
2022-09-13 12:00:02 +02:00
Lukasz Ostrowski
ac6900f35f
Add support for locale change (#55)
* Add new event type

* Add state handling for locale change
2022-09-13 11:59:30 +02:00
Krzysztof Wolski
a50b055c7c
Fix Vercel APL set method + add tests for it (#52)
* Fix Vercel APL set method + add tests for it
2022-09-07 17:33:48 +02:00
Lukasz Ostrowski
423495970b Add additional test and fix debug message 2022-09-06 16:02:24 +02:00
Krzysztof Wolski
027b239114 Use APL debug util 2022-09-05 11:09:06 +02:00
Krzysztof Wolski
668b96ac4c Update names to kebab case 2022-09-05 10:31:31 +02:00
Krzysztof Wolski
2fc57718a6 Code review changes 2022-09-05 10:18:12 +02:00
Krzysztof Wolski
3b81151cca Rename helper function 2022-09-05 10:18:12 +02:00
Krzysztof Wolski
ace6efbdba Change default file name for FileAPL 2022-09-05 10:18:12 +02:00
Krzysztof Wolski
6adabd1cba Introduce debug namespaces 2022-09-05 10:18:12 +02:00
Krzysztof Wolski
5b7bb5d878 Add util function docstring 2022-09-05 10:18:12 +02:00
Krzysztof Wolski
b2f84b51c8 Reduce duplication in the test code 2022-09-05 10:18:12 +02:00
Krzysztof Wolski
10b3171b9d Fix delete test 2022-09-05 10:18:12 +02:00
Krzysztof Wolski
b41f54ad4c Split APL into single purpose ones, fix module export issue 2022-09-05 10:18:12 +02:00
Krzysztof Wolski
18bdeff68b Add localEnv apl 2022-09-05 10:18:12 +02:00
Lukasz Ostrowski
47e7865dc5 Add debug messages to middlewares
Add debug messages to middlewares

Apply suggestions from code review

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

better debug messages

Add experimental debug middleware
2022-09-05 10:13:46 +02:00
Krzysztof Wolski
c745de5a2c Ignore type warning on log message 2022-09-02 16:55:14 +02:00
Krzysztof Wolski
14b5fb6460 Mark event type as unknown 2022-09-02 16:53:40 +02:00
Krzysztof Wolski
eb062c6b10 Update types on headers util 2022-09-02 16:52:44 +02:00
Lukasz Ostrowski
69c985bdc1
Merge pull request #39 from saleor/change-debug-import
Change "debug" package import to use default
2022-08-30 11:56:57 +02:00
Krzysztof Wolski
9b541cf318
Merge pull request #36 from saleor/fix-manifest-type
Fix manifest type to use `asyncEvents` and `syncEvents`
2022-08-30 11:02:25 +02:00
Krzysztof Wolski
ff0a03c215 Fix export from new modules 2022-08-30 09:17:11 +02:00
Lukasz Ostrowski
d6366e2ef1 Change "debug" package import to use default
This is rquired because app-template broke when using app-sdk with previous
named import
2022-08-30 09:15:11 +02:00
Jonatan Witoszek
8ae80269ea
Fix manifest type to use asyncEvents and syncEvents 2022-08-29 14:53:20 +02:00
Lukasz Ostrowski
d087bbf2ed
Merge pull request #25 from saleor/merge-bridge
Include app-bridge package into app-sdk
2022-08-29 11:52:44 +02:00
Lukasz Ostrowski
915f6496f1 Fix legacy createApp factory to not override targetDomain 2022-08-29 09:01:16 +02:00
Krzysztof Wolski
4a514103b6
Merge pull request #32 from saleor/refactor-middlewares
Refactor and test middleware
2022-08-26 12:29:19 +02:00
Lukasz Ostrowski
6de0675784 Install debug package and add debug messages to AppBridge 2022-08-26 09:24:56 +02:00
Lukasz Ostrowski
710210cdf5 Merge branch 'main' into merge-bridge 2022-08-26 08:46:11 +02:00
Krzysztof Wolski
f84d53465f
Merge pull request #28 from saleor/apl-interface
Introduce APL interface
2022-08-25 19:45:40 +02:00
Krzysztof Wolski
e1dc4c0344 Test withAuthTokenRequired 2022-08-25 17:29:32 +02:00
Krzysztof Wolski
0882c7e408 Test withSaleorEventMatch 2022-08-25 17:22:53 +02:00
Krzysztof Wolski
d90abdceac Test withSaleorDomainPresent 2022-08-25 17:10:49 +02:00
Krzysztof Wolski
158a40203e Split middleware into separate files 2022-08-25 16:56:51 +02:00
Krzysztof Wolski
43f81f1af6 Introduce APL interface 2022-08-25 16:49:54 +02:00
Jonatan Witoszek
4ce0cd8d56
Add app manifest types 2022-08-25 15:40:59 +02:00
Lukasz Ostrowski
53561452d4 Fix constructuring url with missing referrer 2022-08-23 09:22:40 +02:00
Lukasz Ostrowski
ef5ad07c1e Fix test 2022-08-22 15:53:03 +02:00
Lukasz Ostrowski
683f19b5c0 Add docs and test 2022-08-22 15:47:40 +02:00
Lukasz Ostrowski
c4d672683c Fix exports 2022-08-22 11:37:42 +02:00
Lukasz Ostrowski
d445653c2d Refactors and tests 2022-08-11 23:14:41 +02:00
Lukasz Ostrowski
983dba1126 Refactor app bridge state container 2022-08-11 22:19:11 +02:00
Lukasz Ostrowski
af68bedfb3 Tests for actions 2022-08-11 20:51:02 +02:00
Lukasz Ostrowski
8110818251 move app-bridge code and tests to app-sdk 2022-08-11 14:03:51 +02:00
Lukasz Ostrowski
c15caef702 Adds middleware test 2022-08-08 17:10:42 +02:00
Lukasz Ostrowski
cba596c910 Add test for urls 2022-08-08 16:55:57 +02:00
Krzysztof Wolski
9a76281d22 Unify error message for the middleware 2022-08-08 11:01:02 +02:00
Krzysztof Wolski
3d4c513be9 Handle missing webhook signature header 2022-08-08 10:43:26 +02:00
Krzysztof Wolski
fe2921dcdc Migrate to Jose and better error messages 2022-08-04 18:37:31 +02:00
Krzysztof Wolski
e203803505 Add saleor headers util 2022-08-04 18:36:59 +02:00
Krzysztof Wolski
345238e9ee Add withJWTVerified middleware 2022-08-03 20:51:37 +02:00
Krzysztof Wolski
6972dbd562
Merge pull request #9 from saleor/add-linting
Add code formatting, git hooks and improved CI
2022-07-25 09:29:58 +02:00
Krzysztof Wolski
6540dc8001 Apply code formatting 2022-07-20 16:19:49 +02:00
Krzysztof Wolski
bd41853696 Remove unused variable 2022-07-20 16:05:00 +02:00
Krzysztof Wolski
b3008c6a5a Rename variables to camelCase 2022-07-20 16:04:38 +02:00
Jonatan Witoszek
0d93b14e16
Replace string type with generic in withSaleorEventMatch middleware 2022-07-14 16:30:04 +02:00
Jonatan Witoszek
8e1e100a02
Fix unhandled exception when JWS is malformed 2022-07-14 14:04:27 +02:00
Tomasz Magulski
0e1eb8f1e1 Fixing JWKS remove key resolving logic 2022-07-07 13:17:19 +02:00
Tomasz Magulski
cc13260ef6 Webhooks signature verification middleware 2022-07-06 16:05:36 +02:00