Skip to content

Releases: yahoo/fetchr

Promise Support and misc refactor

25 Sep 18:25
Compare
Choose a tag to compare

#115 - Add promise support to fetchr

// Before
fetcher
    .read('data_api_service')
    .params({id: ###})
    .end(function (err, data) {
        // data is returned by `data_api_service`
    });
//After
fetcher
    .read('data_api_service')
    .params({id: ###})
    .end()
    .then(function (result) {
        // result.data is returned by `data_api_service`
    });

#122 - Refactor service metadata

Metadata logic in fluxible-plugin-fetchr has been moved into fetchr itself. The usage is the same as before.

// callback
fetcher
    .read('data_api_service')
    .params({id: ###})
    .end(function (err, data, meta) {
        // meta will contain any headers returned by the `data_api_service`
    });
// promise
fetcher
    .read('data_api_service')
    .params({id: ###})
    .end()
    .then(function (result) {
        // result.meta will contain any headers returned by the `data_api_service`
    });

Context picker support

02 Sep 22:26
Compare
Choose a tag to compare

#121 - Provide additional options contextPicker to determine how to pick the context values as parts of uri queries

Bugfix: Don't cast big integers into Numbers

31 Aug 20:28
Compare
Choose a tag to compare
  • #120 Don't cast big integers into Number type

    Fetcher middleware receives all params as strings. It then, tries to cast these strings into their primitive types. However, numbers larger than MAX_SAFE_INTEGER were being rounded incorrectly introducing errors(See #119). The fix is to just leave these big integers as strings and let the user convert them as needed.

Added ability to return more information in error object

19 Aug 16:30
Compare
Choose a tag to compare

Thanks @KATT for the contribution!

An additional output property can be added to the error object to return addition information when an error occurs.

Provide function to update options

10 Aug 20:31
Compare
Choose a tag to compare

#114 - provide function to update options

Interface Changes

07 Aug 19:02
Compare
Choose a tag to compare

#110 - New CRUD interface

We're deprecating the old interface:

fetcher.read('resource', {id: ###}, {}, function (err, data, meta) {
    // handle err and/or data returned from data fetcher in this callback
});

in favor of a cleaner, chainable, interface:

fetcher
    .read('resource')
    .params({id: ###})
    .end(function (err, data, meta) {
     // handle err and/or data returned from data fetcher in this callback
    });

Few things to keep in mind:

  • Always start fetcher requests with one of the CRUD (create, read, update, or delete) methods.
  • Then chain with params, body, or clientConfig in any order.
  • Always end requests with the end method and provide a callback.

Note: This release does not affect how your data services are defined, it just provides a new way to access your services.

Remove X-Requested-With headers for CORS

07 Jul 21:28
Compare
Choose a tag to compare

#103 Remove X-Requested-With headers for CORS. Thanks @neilius.

Allow xhr timeout to be configured for all requests

07 Jul 00:41
Compare
Choose a tag to compare

New:
#107 - Allow xhr timeout to be configured for all fetchr requests. Thanks @escalona.

Misc:
#104 - Improve test coverage
#105 - Update devDeps

Backport: Parsing error JSON client side

19 Jun 18:46
Compare
Choose a tag to compare

Backporting #98, because #98 resolves a potential inconsistency introduced in #80(already backported).

Fix bug where isRegistered didn't handle sub-resources

19 Jun 18:44
Compare
Choose a tag to compare