shopify-api-js icon indicating copy to clipboard operation
shopify-api-js copied to clipboard

Add generic interfaces from spike

Open paulomarg opened this issue 2 years ago • 0 comments

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, and abstractHandleRequest 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

paulomarg avatar Aug 10 '22 20:08 paulomarg