Skip to content

Releases: MattCCC/fetchff

v3.0.1

02 Oct 20:22
Compare
Choose a tag to compare

Improvements:

  • added missing interface for Logger
  • 'fetcher' and 'logger' settings can be used on per-request basis as well

Fixes:

  • Default Content Type was not applicable

Docs:

  • Update createApiFetcher() section and reflect the fetchers change

What's Changed

Full Changelog: v3.0.0...v3.0.1

v3.0.0

30 Sep 22:29
Compare
Choose a tag to compare

Features:

  • Typings: Added Query Params, Path Params and Request Body generics to endpoints API, request() and fetchf() functions

Improvements:

  • Added sideEffects false for more aggressive minification in bundlers
  • Pointed default entry point to unpkg as ESM
  • Size monitoring for Node.js build output when building
  • Typings: Custom fetcher options typings - should infer Response Data
  • Typings: Polling error object typings - should infer Response Data
  • Typings: Infer response data in request config when using createApiFetcher()
  • Typings: Updated ApiHandlerMethods -> ApiHandlerDefaultMethods and ApiHandlerReturnType -> ApiHandlerMethods
  • Performance: Don't remove withCredentials and data properties from final fetch object

Fixes:

  • Typings: Set default response type to any instead of never
  • Typings: Response Data when error is returned
  • Typings: Query Params, Url Path Params and Body Payload can infer whole generic interfaces instead of only values
  • Typings: Properly infer TS generics in Endpoint type
  • api.request() was not accepting custom URLs

Docs:

  • Added more information about Compatibility and Polyfills
  • Added section about Headers together with default headers being injected
  • Added section about Response Data Transformation
  • Added section about Automatic Request Cancellation
  • "Multiple API Specific Settings" info regarding general settings moved to the Basic Settings section
  • Updated JSDoc of API Handler interfaces
  • Update generic Typings sections
  • Add Plugin API Architecture section

Breaking changes:

  • Simplified endpoints API in createApiFetcher() - removed queryParamsOrBody and urlPathParams arguments from request() function. Use requestConfig params or body instead.
  • If flattenResponse is set to true, only the data is affected by flattening. It means that the whole response is always returned which increases predictability. If you set flattenResponse anywhere, in order to migrate replace all const data = with const { data } =
  • Locked down build to minimum version of Node.js 18+ as per docs (smaller bundle)
  • Builds should be in ES2018+ mode (smaller bundle; use transpiler if you need older versions)

What's Changed

Full Changelog: v2.9.0...v3.0.0

v2.9.0

22 Sep 00:34
Compare
Choose a tag to compare

Features:

  • Introduce Request Caching (see Settings in the Readme file for more information)
  • Introduce Request Polling (see Settings in the Readme file for more information)
  • Support for array of multiple different error interceptors
  • Docs revamp for easier access to Settings and Examples

Improvements:

  • Decrease bundle size by up to 5% for previous functionality (excluding caching)
  • Improve config checks and prioritization of per-request settings
  • Add custom fetcher typings
  • urlPathParams can now accept numbers and underscores
  • typings for config and responses within interceptors
  • interceptors do not need to return any value anymore

Fixes:

  • Properly bind response instance to fetch responses
  • apiUrl alias should be accepted in per-request configs
  • Global interceptors for requests and responses were called twice
  • Fixed typings for interceptors
  • Allow empty objects in Query Params, Body and URL Path Params

Docs:

  • Update readme with latest values in the Plugin Comparison Table
  • Mark baseURL (apiUrl) as safe to use on per-request basis
  • Improve documentation of all existing settings
  • Add example of direct fetchf() call with interceptor
  • Add example using custom fetcher

Potentially breaking:

  • ErrorHandlerInterceptor renamed to ErrorInterceptor

What's Changed

Full Changelog: v2.8.0...v2.9.0

v2.8.0

16 Sep 22:56
Compare
Choose a tag to compare

Features:

  • Added Request Deduplication - "dedupeTime" setting to control request deduplication (1 second by default) - requests with same configuration are treated as one request if fired within particular interval
  • Requests Queue can now properly handle high concurrency environments thanks to better locking
  • Add Accept-Encoding headers with brotli compression enabled by default

Improvements & fixes:

  • iife builds can be properly utilized through fetchff namespace
  • urls in endpoints should be required in TypeScript interface
  • set minimum target to es2017 instead of esnext for better browser support
  • properly replace global headers with per-request headers
  • consistent default response when request is cancelled
  • Properly consider request "credentials" passed through

What's Changed

  • Introduce Queue Manager with Request Deduplication by @MattCCC in #52
  • Build process and queue improvements by @MattCCC in #53

Full Changelog: v2.7.3...v2.8.0

v2.7.3

04 Sep 01:34
Compare
Choose a tag to compare

Improvements:

  • Recursively flatten data only when requested

Fixes:

  • Return non-flattened response in case of errors, if requested
  • Set abort signal for every request
  • Response checks when error during soft fail is output

What's Changed

  • fix: Set abort signal for every request by @MattCCC in #50
  • fix: Response checks when error during soft fail is output by @MattCCC in #51

Full Changelog: v2.7.2...v2.7.3

v2.7.2

03 Sep 22:24
Compare
Choose a tag to compare

Improvements:

  • New setting "resetTimeout" so to reset the timeout when retrying requests
  • Improve typings of passed body/data in request config
  • Enhance typing experience by providing descriptions of request configurations

Docs:

  • Add more information about Query Params and Body Payload passed to endpoints
  • Add "withCredentials" setting

Fixes:

  • Request timeout should work not only for cancellable requests
  • Reset timeout when retrying requests
  • Remove unused typings
  • Improve checks for settings that are not passed to fetcher directly

Other changes:

  • Shorter timeout error messages
  • Old package "axios-multi-api" is now marked as deprecated in NPM
  • Keep optional logger silent by default instead of defaulting to global console

What's Changed

Full Changelog: v2.7.1...v2.7.2

v2.7.1

23 Aug 02:07
Compare
Choose a tag to compare

Breaking:

  • The package axios-multi-api has been renamed to fetchff (to migrate reinstall the package: npm uninstall axios-multi-api && npm install fetchff and then replace the package name in all imports from axios-multi-api to fetchff

Fixes:

  • Smaller package bundle size on NPM

Objective:
The goal of renaming a package is to update its identity to better align with its purpose, functionality, or brand. In this case, renaming axios-multi-api to fetchf signifies a shift or refinement in the package's focus from Axios-based implementations to standalone one, that utilizes the Fetch API.

Full Changelog: v2.6.6...v2.7.1

v2.6.6

23 Aug 00:45
Compare
Choose a tag to compare

Features:

  • more strongly typed query params in fetchf() requests by default
  • passed params can handle array of objects with "name" and "value" properties

Fixes:

  • don't attempt to serialize body payload if URLSearchParams are passed
  • correctly parse "params" property passed in Request Config
  • fetchf() wrapper should not make assumptions regarding request data/params
  • more predictable body/data parsing inline with native fetch()
  • correctly append query params to POST requests, if data/body are specified
  • correctly handle charset in the content type headers when parsing response data
  • bail parsing data early if there is no response body
  • correctly parse text/ responses and streams
  • normalize headers keys to lowercase as per IETF RFC 2616 4.2
  • distingiush versions loaded by node and browsers

What's Changed

  • Improve Request and Response handling by @MattCCC in #46

Full Changelog: v2.6.5...v2.6.6

v2.6.5

22 Aug 01:18
Compare
Choose a tag to compare

Features:

  • Add handling for native URLSearchParams passed as Query Params

What's Changed

  • feat: Handle native URLSearchParams passed as Query Params by @MattCCC in #45

Full Changelog: v2.6.4...v2.6.5

v2.6.4

22 Aug 00:49
Compare
Choose a tag to compare

Improvements:

  • ensure that query params parser can handle nested objects

Fixes:

  • handle edge cases of invalid json responses

Docs:

  • License changed to UNLINCENSED

What's Changed

Full Changelog: v2.6.3...v2.6.4