shopify-api-js
shopify-api-js copied to clipboard
Add generic interfaces from spike
WHY are these changes introduced?
The first step towards making this library isomorphic is to define an interface that allows all of the different runtime environments.
WHAT is this pull request doing?
Porting over the spike interfaces we were using, with a couple of minor tweaks to the public interface exposed by the node runtime.
This makes the following changes to the previous iteration:
- Changed the tests under
runtime
to be executed by being included in a runtime-specific test file (/src/adapters/node/__tests__
). This way, we can run the runtime tests on any runtimes we support for free, since the interface is generic - Changed the public interface of the adapter to only export
abstractFetch
to handle internal fetch requests, andabstractHandleRequest
to handle cases where we need to deal with the incoming requests and send a response
Checklist
- [x] I have added/updated tests for this change