Tags: hoodiehq/hoodie-server
Tags
chore(package): @hoodie/store-server 3.0.0 BREAKING CHANGE: The store instance which `server.plugins.store.api.open(dbName)` resolves to has several breaking changes via [pouchdb-hoodie-api@2.0.0](https://github.com/hoodiehq/pouchdb-hoodie-api/releases/tag/v2.0.0) - Before, change events (incl. add, update, remove) have only been triggered when using the custom APIs like `.add()` or `.update()`. Now they get always triggered, including for changes replicated into the database. - the order of when the methods’ promises resolve and the events get triggered cannot be guaranteed as we rely on PouchDB’s `.changes()`. We would love to enforce promises to resolve after changes get emitted, but the required complexity to do that is not worth it. - We no longer map PouchDB’s ._id property to .id, instead we pass trough docs from PouchDB 1:1. Also the timestamps are now all namespaced with `.hoodie` (`doc.createdAt` becomes `doc.hoodie.createdAt`) Unless you use the `server.plugins.store.api.open(name)` API you are not affected by any of this.
refactor(store): use `server.plugins.store.api`
BREAKING CHANGE:
The API now keeps state of all databases and access in a dedicated
`hoodie-store` database. If your app uses CouchDB as its backend, there
is no migration required, it happens automatically on next restart.
If you don’t use CouchDB (which is the default), the simplest way to
"migrate" is to delete the `.hoodie/data` folder. It will loose all
data, so this is only an option for local development. If you don’t want
to loose all data, you manually have to create the `hoodie-store`
database with documents for each user database. The documents look
like this:
```json
{
"_id": "db_user/lsdlo55",
"_rev": "1-a01e6998fb10543ca0402e648dd1d048",
"access": {
"read": {
"role": [
"id:lsdlo55"
]
},
"write": {
"role": [
"id:lsdlo55"
]
}
}
}
```
Besides that, this release also updates to a new express-pouchdb version
which includes a bugfix for a faulty encoding of database folders. You
must rename all folders that look like `user%2Fabc4567` to
`user/abc4567` (nested directories). See pouchdb/express-pouchdb#377
PreviousNext