hoodiehq / hoodie-client

:dog: Client API for the Hoodie server
Apache License 2.0
34 stars 25 forks source link

Update @hoodie/account-client to the latest version 🚀 #116

Closed greenkeeper[bot] closed 7 years ago

greenkeeper[bot] commented 7 years ago

Version 5.0.0 of @hoodie/account-client just got published.

Dependency @hoodie/account-client
Current Version 4.4.0
Type dependency

The version 5.0.0 is not covered by your current version range.

Without accepting this pull request your project will work just like it did before. There might be a bunch of new features, fixes and perf improvements that the maintainers worked on for you though.

I recommend you look into these changes and try to get onto the latest version of @hoodie/account-client. Given that you have a decent test suite, a passing build is a strong indicator that you can take advantage of these changes by merging the proposed change into your project. Otherwise this branch is a great starting point for you to work on the update.


Release Notes v5.0.0

5.0.0 (2016-12-23)

Features

Breaking Changes

  • As part of our effort to make Hoodie Client compatible with Service Worker and other environments that do not have access to localStorage, we have to make the Account Client compatible with async store APIs. That means we can’t load the current account state synchronously, so this is no longer be possible:
var account = new Account({
  url: /api
})
if (account.isSignedIn()) {
  sayHi(account.username)
}

Starting with this release, you have to wrap the synchronous methods and properties into account.ready.then()

account.ready.then(function () {
  if (account.isSignedIn()) {
    sayHi(account.username)
  }
})

By default, the account will still use localStorage (via humble-localstorage) to persist its state, but it will now be made asynchronous. In order to use another storage a new options.cache argument can be passed to the Account constructor:

var account = new Account({
  url: /api,
  cache: {
    set: writeAccountState
    get: getAccountState,
    unset: clearAccountState,
  }
})

All three options.cache methods must return promises. options.cache.get must resolve with the persisted account properties or an empty object.

(962841a2)

This is not technically a breaking change as the pre:* and post:* events have not been documented, but as they are used by @hoodie/client we decided to make this a breaking change nevertheless

(72f79c20)

Commits

The new version differs by 15 commits .

  • 962841a feat: options.cache and account.ready
  • cdf00bb test: options.cache and account.ready
  • 7e4bb9b chore(package): async-get-set-store
  • d3c4b2d docs(README): options.cache and account.ready
  • fd4d3b7 refactor: replace separate get/clear/save utils with store
  • 72f79c2 feat: Hooks
  • 500b4bf test: Hooks
  • 5324cdc chore(package): before-after-hook
  • 5e582d4 docs(README): Hooks
  • c60f681 Merge pull request #128 from hoodiehq/127/refactor-store
  • 9678217 refactor: replace separate get/clear/save utils with store
  • 983c511 test: replace separate get/clear/save utils with store
  • 41076e5 docs(README): fix example for account.off
  • 8ce3b89 docs(README): new code coverage status URL (#122)
  • 81b9d93 chore(package): update dependencies

See the full diff.

Not sure how things should work exactly? There is a collection of [frequently asked questions](https://greenkeeper.io/faq.html) and of course you may always [ask my humans](https://github.com/greenkeeperio/greenkeeper/issues/new).

Your Greenkeeper Bot :palm_tree: