Skip to content

v2.3.0

Compare
Choose a tag to compare
@MattCCC MattCCC released this 29 Jul 14:57
· 331 commits to master since this release

What's Changed

Features:

  • added retry mechanism
  • added global "rejectCancelled" setting
  • added global request "method" setting (default is GET)
  • added per-request "flattenResponse" setting
  • added per-request "defaultResponse" setting
  • added tiny fetch compatible fetchf(url, config) wrapper to directly make requests without initializing API Handler (useful for single calls)
  • api.config - exposed global config that can be easily adjusted dynamically
  • api.endpoints - exposed list of endpoints so they can be adjusted dynamically
  • added support for uppercase dynamic URI params
  • added uriParams setting to requestConfig (useful in the fetchf() wrapper)
  • performance: smaller bundle size due to lack of external plugins

Typings:

  • added automatic endpoints types inference even if types have not been specified

Fixes:

  • always trigger console error for non-specified endpoints, instead of custom logger

Docs:

  • more clear explanation of package and settings
  • global and per request settings are now merged as they are pretty much same
  • added more examples of per-request error handling with each and every strategy
  • added docs/examples/examples.ts file with more examples of usage

Breaking:

  • ApiHandler class converted to createApiFetcher (please replace all new ApiHandler with createApiFetcher). This helps us to remove last external dependency making the library dependency-free
  • RequestErrorHandler class is not re-exported now. It should not be used directly in code
  • Removed long deprecated throwError strategy so to reduce bundle size. Use reject instead. The behavior is the same
  • Renamed type: EndpointConfig to RequestConfig
  • Renamed "handleRequest" method to "request"
  • More strict TypeScript when generic for createApiFetcher() is defined by default. All endpoints need to be specified.

Full Changelog: v2.2.2...v2.3.0