Feature-rich and pluggable offline-first API wrapper for all your javascript environements ! Easily wire-up your API and make your app work offline in minutes.
ℹ️ The plugin has been renamed and is now APipeline. This version works almost exactly like the previous one, except for minor breaking changes. This plugin can now be used on the browser, in node.js and on react-native !
fetchMethod
option in your API options. This is required since the plugin can now be used in any javascript project.setCacheDriver
method.📖 Take a look at the documentation for some pointers about how to set these values depending on where you intend to use the plugin.
encodeParameters
: this automatically encodes your utf8 characters in your queryParameters
and pathParameters
multiRemove
method is not required anymore when creating your own cache drivercachePrefix
option.responseMiddleware
option, letting you alter your API responses. Just like your regular middlewares
option, you can configure this at the API / services / fetch level.api.get
, api.post
...). api.fetch
is still available.💡 The SQLite driver's performances are significantly better than
AsyncStorage
's. Its usage is recommended for more complex apps that need faster caching. Moreover, it bypassesAsyncStorage
's 6mb limitation on android, which might be important if you need to store large amount of data.
This implementation is still in its early form, feel free to build on it and submit PR to improve it.
ignoreHeadersWhenCaching
option. This is available at API, service and fetch options level.Enabling this will make sure you'll use your cached data when you're firing the same request but with different headers. This is useful if you need to sign all your API calls with the current date for example.
The third argument supplied to the middleware is now an object with both the fullPath as it used to be and your path without its query parameters. This can be useful in some cases, when generating authentication headers, for instance.
queryParameters
and pathParameters.
They will simply be ignored during the parsing of your paths. This is is much easier than having to create an intermediate var with your fetch options since you don’t have to care whether your variable is defined or not.
cachePrefix
optionfullPath
to the middlewares' signature