Releases: MattCCC/fetchff
Releases · MattCCC/fetchff
v3.0.1
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 thefetchers
change
What's Changed
Full Changelog: v3.0.0...v3.0.1
v3.0.0
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 ofnever
- 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
andurlPathParams
arguments from request() function. Use requestConfigparams
orbody
instead. - If
flattenResponse
is set to true, only thedata
is affected by flattening. It means that the whole response is always returned which increases predictability. If you setflattenResponse
anywhere, in order to migrate replace allconst data =
withconst { 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
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 toErrorInterceptor
What's Changed
- Decrease bundle size + update readme by @MattCCC in #54
- Introduce polling by @MattCCC in #55
- Introduce cache by @MattCCC in #56
- Improve interceptors by @MattCCC in #57
- Update docs about Cache and Retries by @MattCCC in #58
Full Changelog: v2.8.0...v2.9.0
v2.8.0
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
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
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
Breaking:
- The package
axios-multi-api
has been renamed tofetchff
(to migrate reinstall the package:npm uninstall axios-multi-api && npm install fetchff
and then replace the package name in all imports fromaxios-multi-api
tofetchff
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
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
Full Changelog: v2.6.5...v2.6.6