Releases: jaredwray/cacheable
v10.2.6
Fix for memory leak on Listeners
The listener was not being removed on response
and just error but new handlers were being added causing a memory leak.
line 220 in src/index.ts was modified to remove the listener on response also
if (this.cache instanceof Keyv) {
const cachek = this.cache;
cachek.once('error', errorHandler);
ee.on('error', () => cachek.removeListener('error', errorHandler));
ee.on('response', () => cachek.removeListener('error', errorHandler));
}
What's Changed
- upgrading jest and components to latest by @jaredwray in #220
- upgrading @types/jest to 29.2.6 by @jaredwray in #221
- fixing listener memory leak - issue #222 by @jaredwray in #223
Full Changelog: v10.2.5...v10.2.6
v10.2.5
Types definition issue with http-cache-sematics as that type definition needs to be in dependencies. Thanks @Maxim-Mazurok
What's Changed
- Move @types/http-cache-semantics from dev to deps by @Maxim-Mazurok in #219
Full Changelog: v10.2.4...v10.2.5
v10.2.4
v10.2.4
Minor updates with one exception is that we removed @types/http-cache-semantics
from the main dependencies as it does not look to be needed.
What's Changed
- upgrading typescript to 4.9.4 by @jaredwray in #214
- upgrading jest types and eslint for jest to latest by @jaredwray in #215
- upgrading sqlite3 to 5.1.4 by @jaredwray in #216
- removing @types/http-cache-semantics from the dependencies and moving… by @jaredwray in #217
Full Changelog: v10.2.3...v10.2.4
v10.2.3
v10.2.3 Maintenance Release
Upgrading core modules in the system such as keyv and also a minor fix to an uncaught exception that we were seeing referenced here: sindresorhus/got#1925
Additional update is moving normalize-url
to 8.0.0
which after testing it looks to not affect anything but will post the release notes here: https://github.com/sindresorhus/normalize-url/releases/tag/v8.0.0
What's Changed
- fixed uncaught exception issue by @alphmth in #206
- upgrading xo to 0.53.1 by @jaredwray in #208
- upgrading typescript to 4.9.3 by @jaredwray in #209
- upgrading jest (29.3.1) and components to latest by @jaredwray in #210
- upgrading keyv to 4.5.2 by @jaredwray in #211
- upgrading normalize-url to 8.0.0 by @jaredwray in #212
Full Changelog: v10.2.2...v10.2.3
v10.2.2
Maintenance Release 10.2.2 🛠️
This is a monthly maintenance release which focused mostly on development toolset and should not have any big changes. The only package that was updated is normalize-url
with a version bump to 7.2.0
.
What's Changed
- upgrading xo to 0.52.4 by @jaredwray in #197
- upgrading typescript to 4.8.4 by @jaredwray in #198
- upgrading sqlite3 to 5.1.2 by @jaredwray in #199
- upgrading jest to 29.2.1 by @jaredwray in #200
- upgrading ts-jest to 29.0.3 by @jaredwray in #201
- upgrading eslint-plugin-jest to 27.1.3 by @jaredwray in #202
- upgrading jest and node types to latest by @jaredwray in #203
- upgrading normalize-url to 7.2.0 by @jaredwray in #204
- upgrading @keyv/sqlite to 3.6.2 by @jaredwray in #205
Full Changelog: v10.2.1...v10.2.2
v10.2.1
10.2.1 Bug fixes and Changes
Biggest change has been that when an agent is KeepAlive: true
we are now sending a response end
which will close the socket instead of an error.
What's Changed
- Moved @types/http-cache-semantics to dependencies by @Maxim-Mazurok in #195
- fix dangling response on cache revalidation by @zkx5xkt in #196
New Contributors
- @Maxim-Mazurok made their first contribution in #195
- @zkx5xkt made their first contribution in #196
Full Changelog: v10.2.0...v10.2.1
v10.2.0
Hooks onResponse
replacing response
hook
response
will still work but will be deprecated as we expand this functionality. onResponse
will be the name moving forward. Here are examples of how to use it.
How to decompress
import http from 'http';
import CacheableRequest from 'cacheable-request';
const cacheableRequest = new CacheableRequest(request, cache).request();
// adding a hook to decompress response
cacheableRequest.addHook('onResponse', async (value: CacheValue, response: any) => {
const buffer = await pm(gunzip)(value.body);
value.body = buffer.toString();
return value;
});
how to add a remote address
import CacheableRequest, {CacheValue} from 'cacheable-request';
const cacheableRequest = new CacheableRequest(request, cache).request();
cacheableRequest.addHook('onResponse', (value: CacheValue, response: any) => {
if (response.connection) {
value.remoteAddress = response.connection.remoteAddress;
}
return value;
});
In addition to that we have also updated some of the packages to their lates which you can read below 👇
What's Changed
- upgrading xo to 0.52.3 and updating types.ts with type definitions by @jaredwray in #190
- upgrading ts-jest to 29.0.1 by @jaredwray in #191
- upgrading sqlite3 to 5.1.1 by @jaredwray in #192
- added remote address by @alphmth in #189
- moving to onResponse for hooks by @jaredwray in #193
Full Changelog: v10.1.2...v10.2.0
v10.1.2
Based on feedback (thanks @szmarczak!) we have renamed the function createCacheableRequest
to just request
.
- const cacheableRequest = new CacheableRequest(https.request).createCacheableRequest();
+ const cacheableRequest = new CacheableRequest(https.request).request();
v10 code with createCacheableRequest
import CacheableRequest from 'cacheable-request';
// Now You can do
const cacheableRequest = new CacheableRequest(http.request).request();
const cacheReq = cacheableRequest('http://example.com', cb);
cacheReq.on('request', req => req.end());
// Future requests to 'example.com' will be returned from cache if still valid
// You pass in any other http.request API compatible method to be wrapped with cache support:
const cacheableRequest = new CacheableRequest(https.request).createCacheableRequest();
const cacheableRequest = new CacheableRequest(electron.net).createCacheableRequest();
v10.1.2 code with request
import CacheableRequest from 'cacheable-request';
// Now You can do
const cacheableRequest = new CacheableRequest(http.request).request();
const cacheReq = cacheableRequest('http://example.com', cb);
cacheReq.on('request', req => req.end());
// Future requests to 'example.com' will be returned from cache if still valid
// You pass in any other http.request API compatible method to be wrapped with cache support:
const cacheableRequest = new CacheableRequest(https.request).request();
const cacheableRequest = new CacheableRequest(electron.net).request();
What's Changed
- refactor code by @alphmth in #188
Full Changelog: v10.0.2...v10.1.2
v10.0.2
v10.0.1
Minor maintenance release with some primary packages updated such as:
- @types/node to 18.7.16
- keyv to 4.5.0
- normalize-url to 7.10
Changelog
- upgrading jest and ts-jest to version 29 by @jaredwray in #177
- upgrading @types/node to 18.7.16 by @jaredwray in #178
- upgrading eslint-plugin-jest to 27.0.4 by @jaredwray in #179
- updating documentation to on contribution by @jaredwray in #180
- adding in table of contents by @jaredwray in #181
- upgrading keyv to 4.5.0 by @jaredwray in #182
- adding a warning to security document on v8 support by @jaredwray in #183
- upgrading typescript to 4.8.3 by @jaredwray in #184
- upgrading normalize-url to 7.1.0 by @jaredwray in #185
- updating docs and prepare when publishing by @jaredwray in #186
Full Changelog: v10.0.0...v10.0.1