Skip to content

Releases: jaredwray/cacheable

v10.2.6

02 Feb 16:56
Compare
Choose a tag to compare

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

Full Changelog: v10.2.5...v10.2.6

v10.2.5

05 Jan 22:16
Compare
Choose a tag to compare

Types definition issue with http-cache-sematics as that type definition needs to be in dependencies. Thanks @Maxim-Mazurok

What's Changed

Full Changelog: v10.2.4...v10.2.5

v10.2.4

23 Dec 01:11
Compare
Choose a tag to compare

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

Full Changelog: v10.2.3...v10.2.4

v10.2.3

22 Nov 17:32
Compare
Choose a tag to compare

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

Full Changelog: v10.2.2...v10.2.3

v10.2.2

19 Oct 17:47
Compare
Choose a tag to compare

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

Full Changelog: v10.2.1...v10.2.2

v10.2.1

26 Sep 14:35
Compare
Choose a tag to compare

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

New Contributors

Full Changelog: v10.2.0...v10.2.1

v10.2.0

23 Sep 02:14
Compare
Choose a tag to compare

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

Full Changelog: v10.1.2...v10.2.0

v10.1.2

16 Sep 12:41
f2d7bdc
Compare
Choose a tag to compare

⚠️ Breaking Change

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

14 Sep 14:16
Compare
Choose a tag to compare

Change to support got by exporting types enabling better integration with upstream packages.

What's Changed

  • fixed types by @alphmth in #187

Full Changelog: v10.0.1...v10.0.2

v10.0.1

11 Sep 20:05
Compare
Choose a tag to compare

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

Full Changelog: v10.0.0...v10.0.1