Skip to content

Releases: apollographql/datasource-rest

v6.3.0

11 Jun 14:31
a4932ef
Compare
Choose a tag to compare

Minor Changes

  • #332 8a4578d Thanks @nmrj! - Allow cache to be skipped on RestDataSource HTTP requests

v6.2.2

18 Oct 17:21
ac757db
Compare
Choose a tag to compare

Patch Changes

  • #270 f6cf377 Thanks @Sean-Y-X! - Use lodash's cloneDeep to clone parsed body instead of JSON.parse(JSON.stringify(...))

  • #268 870ba80 Thanks @HishamAli81! - * Fix RequestOptions.cacheOptions function return type to also return a non-promise value.

    • Fix propagation of the cache options generic type RequestOptions and AugmentedRequest.

v6.2.1

25 Sep 18:36
7111fbb
Compare
Choose a tag to compare

Patch Changes

v6.2.0

18 Sep 16:54
965e64e
Compare
Choose a tag to compare

Minor Changes

  • #185 147f820 Thanks @HishamAli81! - Added support to the RESTDatasource to be able to specify a custom cache set options type. The cache set options may need to be customized to include additional set options supported by the underlying key value cache implementation.

    For example, if the InMemoryLRUCache is being used to cache HTTP responses, then noDisposeOnSet, noUpdateTTL, etc cache options can be provided to the LRU cache:

    import { InMemoryLRUCache } from '@apollo/utils.keyvaluecache';
    
    interface CustomCacheOptions {
      ttl?: number;
      noDisposeOnSet?: boolean;
    }
    
    class ExampleDataSource extends RESTDataSource<CustomCacheOptions> {
      override baseURL = 'https://api.example.com';
    
      constructor() {
        super({ cache: new InMemoryLRUCache() });
      }
    
      getData(id: number) {
        return this.get(`data/${id}`, {
          cacheOptions: { ttl: 3600, noDisposeOnSet: true },
        });
      }
    }

v6.1.1

12 Sep 17:55
72ef05f
Compare
Choose a tag to compare

Patch Changes

  • #246 c6ac292 Thanks @lotmek! - Make request and url optional parameters in the errorFromResponse method and clean up the implementation.

v6.1.0

24 Aug 17:43
8070943
Compare
Choose a tag to compare

Minor Changes

  • #242 dfb8bcc Thanks @trevor-scheer! - Add optional url parameter to didEncounterErrors hook

    In previous versions of RESTDataSource, the URL of the request was available on the Request object passed in to the hook. The Request object is no longer passed as an argument, so this restores the availability of the url to the hook.

    This is optional for now in order to keep this change forward compatible for existing this.didEncounterErrors call sites in userland code. In the next major version, this might become a required parameter.

v6.0.1

07 Jun 20:20
fcfe7f9
Compare
Choose a tag to compare

Patch Changes

  • #214 c7b190a Thanks @trevor-scheer! - Fix bug in Cloudflare Worker usage where we try to call the .raw() method on its response headers object when it doesn't exist.

    For some reason, the Cloudflare Worker's global fetch HeadersList object is passing the instanceof check against node-fetch's Headers class, but it doesn't have the .raw() method we expect on it. To be sure, we can just make sure it's there before we call it.

v6.0.0

04 May 17:26
2766101
Compare
Choose a tag to compare

Major Changes

  • #196 f8f0805 Thanks @trevor-scheer! - Drop Node v14 support

    To take this major version, the only change necessary is to ensure your node runtime is using version 16.14.0 or later.

    Node v14 is EOL, so we should drop support for it and upgrade packages and testing accordingly. Note this package has a dependency on @apollo/utils.keyvaluecache which requires specifically node@>=16.14 due to its dependency on lru-cache.

v5.1.1

01 May 18:42
d8d5c0d
Compare
Choose a tag to compare

Patch Changes

v5.1.0

24 Apr 19:27
49a0bb9
Compare
Choose a tag to compare

Minor Changes

  • #186 5ac9b52 Thanks @js-lowes! - Customize the logger used by RESTDataSource.
    By default the RESTDataSource will use console.
    Common use cases would be to override the default logger with pino or winston.

    E.g.

    const pino = require('pino');
    const loggerPino = pino({});
    const dataSource = new (class extends RESTDataSource {})({
      logger: loggerPino,
    });

    In the example above, all logging calls made by the RESTDataSource will now use the pino logger instead of the console logger.