Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: MDSLKTR/pouch-vue
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 0.3.5
Choose a base ref
...
head repository: MDSLKTR/pouch-vue
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
  • 10 commits
  • 3 files changed
  • 7 contributors

Commits on Jan 3, 2020

  1. Update README.md

    fixed import statement
    
    The order of the parameters for `post` `put` and `remove` was wrong, it would cause an error.
    achim-t authored Jan 3, 2020
    Copy the full SHA
    d27a7a8 View commit details

Commits on Jan 6, 2020

  1. Update README.md (#42)

    Update README.md
    MDSLKTR authored Jan 6, 2020
    Copy the full SHA
    d6b8f1e View commit details

Commits on Mar 13, 2020

  1. Add LICENSE file (#43)

    Copyright info matches git history and current package.json entries:
    https://github.com/MDSLKTR/pouch-vue/blob/master/package.json#L36
    BigBlueHat authored Mar 13, 2020

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    addaleax Anna Henningsen
    Copy the full SHA
    bf77e3a View commit details
  2. Fix Documentation that results in an error when implemented (#45)

    Fixes documentation resulting in [this issue](colinskow/pouchdb-live-find#11):
    `PouchDB Find is a requirement for LiveFind and must be loaded first.`
    mholtzhausen authored Mar 13, 2020

    Verified

    This commit was signed with the committer’s verified signature.
    jasnell James M Snell
    Copy the full SHA
    3bda4d4 View commit details
  3. Update README.md

    MDSLKTR authored Mar 13, 2020

    Unverified

    The email in this signature doesn’t match the committer email.
    Copy the full SHA
    43a9572 View commit details
  4. Update README.md

    MDSLKTR authored Mar 13, 2020
    Copy the full SHA
    a51dfdd View commit details
  5. Update README.md

    MDSLKTR authored Mar 13, 2020

    Unverified

    The email in this signature doesn’t match the committer email.
    Copy the full SHA
    9637b04 View commit details

Commits on Nov 17, 2020

  1. Update README.md

    Simon Kunz authored Nov 17, 2020
    Copy the full SHA
    01efbf8 View commit details

Commits on Nov 24, 2023

  1. Update doc for "remove" (#48)

    NB: The existing code works even though it semantically could be updated (variables names).
    NB: The existing code does not follow the complete pouchdb API (optional second param)
    twitwi authored Nov 24, 2023
    Copy the full SHA
    740ad9c View commit details
  2. bump deps

    MDSLKTR committed Nov 24, 2023
    Copy the full SHA
    2815da1 View commit details
Showing with 64 additions and 39 deletions.
  1. +21 −0 LICENSE
  2. +27 −23 README.md
  3. +16 −16 package.json
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2017 Simon Kunz

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
50 changes: 27 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,38 @@
# Pouch Vue

## This Plugin is now under active development again thanks to @assemblethis
## This Plugin is not under active development anymore since none of the maintaining members are actively using it.

##### Basic structure copied from https://github.com/buhrmi/vue-pouch with a lot of api changes though. TypeScript support included too.

## Installation
Make sure to have `pouchdb-browser` (or `pouchdb` depending on what you need) `pouchdb-find` and `pouchdb-live-find` installed
````
````sh
npm i pouchdb-browser pouchdb-live-find pouchdb-find
````

Install via npm:
```
```sh
npm install --save pouch-vue
```

The only requirement is that `pouchdb-live-find` is installed:
```
```javascript
import PouchDB from 'pouchdb-browser'
PouchDB.plugin(require('pouchdb-find'));
PouchDB.plugin(require('pouchdb-live-find'));
import PouchFind from 'pouchdb-find'
import PouchLiveFind from 'pouchdb-live-find'

PouchDB.plugin(PouchFind)
PouchDB.plugin(PouchLiveFind)
```

If you want to use remote databases (CouchDB, Cloudant, etc.), you should also install the authentication plugin:
```
```javascript
PouchDB.plugin(require('pouchdb-authentication'));
```
Then, plug VuePouch into Vue:
```
```javascript
import Vue from 'vue';
import PouchVue from 'pouchVue';
import PouchVue from 'pouch-vue';

Vue.use(PouchVue, {
pouch: PouchDB, // optional if `PouchDB` is available on the global object
@@ -42,7 +45,8 @@ Then, plug VuePouch into Vue:

PouchDB v7.0 introduced [an issue with fetch using different defaults than XHR for cross-domain requests](https://github.com/pouchdb/pouchdb/issues/7391). The issue was fixed in PouchDB v7.1.1 so that fetch defaults now include 'credentials' just as XHR defaults come with credentials. If you are using PouchDB v7.0 you will get a 401 Unauthorized error. The workaround for PouchDB v7.0 is to override the fetch function in the defaults:

```Vue.use(pouchVue,{
```javascript
Vue.use(pouchVue,{
pouch: PouchDB,
defaultDB: 'todos',
optionsDB: {
@@ -77,7 +81,7 @@ ___
* `$pouch.sync(localDatabase, OPTIONAL remoteDatabase, OPTIONAL options)`: The optional remoteDatabase parameter will use the default db set in the pouch options initially. Basically the same as PouchDB.sync(local, remote, {live: true, retry: true}). Also, if the browser has an active session cookie, it will fetch session data (username, etc) from the remote server. **BONUS:** If your remote database runs CouchDB 2.0 or higher, you can also specify a Mango Selector that is used to filter documents coming from the remote server. Callback functions will be invoked with the name `pouchdb-[method]-[type]`. So in this case you can use `this.$on('pouchdb-sync-change', callback(data))` to listen when a change occurs. See https://pouchdb.com/api.html#sync for a full list of events you can use.

**default options (will be merged with the options passed in)**:
```
```javascript
{
live: true,
retry: true,
@@ -90,7 +94,7 @@ ___
}
```
**For example:**
```
```javascript
$pouch.sync('complaints', 'https:/42.233.1.44/complaints', {
selector: {
type: 'complaint',
@@ -104,7 +108,7 @@ ___
* `$pouch.changes(OPTIONAL options, OPTIONAL db)`: Listens for change on a db like: https://pouchdb.com/api.html#changes
* `$pouch.put(object, OPTIONAL options, OPTIONAL db)`: https://pouchdb.com/api.html#create_document
* `$pouch.post(object, OPTIONAL options, OPTIONAL db)`: https://pouchdb.com/api.html#create_document
* `$pouch.remove(object, OPTIONAL options, OPTIONAL db)`: https://pouchdb.com/api.html#create_document
* `$pouch.remove(id, rev, OPTIONAL db)`: https://pouchdb.com/api.html#delete_document
* `$pouch.get(object, OPTIONAL options, OPTIONAL db)`: https://pouchdb.com/api.html#create_document
* `$pouch.query('map/reduce function', OPTIONAL options, OPTIONAL db)`: like https://pouchdb.com/api.html#query_database
* `$pouch.allDocs(OPTIONAL options, OPTIONAL db)`: like https://pouchdb.com/api.html#batch_fetch but `include_docs` is set to true by default. You can however overwrite it of course.
@@ -128,10 +132,10 @@ ___
<template>
<div class="todos">
<input v-model="message" placeholder="New Todo">
<button @click="$pouch.post('todos', {message: message});message=''">Save Todo</button>
<button @click="$pouch.post({message: message},{},'todos');message=''">Save Todo</button>
<div v-for="todo in todos">
<input v-model="todo.message" @change="$pouch.put('todos', todo)">
<button @click="$pouch.remove('todos', todo)">Remove</button>
<input v-model="todo.message" @change="$pouch.put(todo,{},'todos')">
<button @click="$pouch.remove(todo,{},'todos')">Remove</button>
</div>
</div>
</template>
@@ -196,7 +200,7 @@ ___

If you only want to sync a single document that matches a selector, use `first: true`:

```vue
```javascript
module.exports = {
// ...
pouch: {
@@ -217,7 +221,7 @@ TypeScript example with a TypeScript file to include the pouch-vue plugin and a
using the plugin.

main.ts
```vue
```typescript

import { Component, Vue } from 'vue-property-decorator';
import PouchDB from 'pouchdb-browser';
@@ -251,10 +255,10 @@ Todos.vue
<template>
<div class="todos">
<input v-model="message" placeholder="New Todo">
<button @click="$pouch.post('todos', {message: message});message=''">Save Todo</button>
<button @click="$pouch.post({message: message},{},'todos');message=''">Save Todo</button>
<div v-for="todo in todos">
<input v-model="todo.message" @change="$pouch.put('todos', todo)">
<button @click="$pouch.remove('todos', todo)">Remove</button>
<input v-model="todo.message" @change="$pouch.put(todo,{},'todos')">
<button @click="$pouch.remove(todo,{},'todos')">Remove</button>
</div>
</div>
</template>
@@ -282,7 +286,7 @@ export default class Todos extends Vue {

### User Authentication

```vue
```javascript
this.$pouch.connect(this.credentials.username, this.credentials.password)
.then((res) => {
let isUnauthorized = res.error === 'unauthorized',
@@ -303,7 +307,7 @@ export default class Todos extends Vue {
```

### Handle Sessions
```
```javascript
this.$pouch.getSession().then((data) => {
if (data.status === 0) {
this.$router.push('/login');
32 changes: 16 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
@@ -52,33 +52,33 @@
],
"homepage": "https://github.com/MDSLKTR/pouch-vue",
"dependencies": {
"or": "^0.2.0",
"pouchdb-live-find": "^0.4.0",
"pouchdb-utils": "^7.0.0"
"pouchdb-utils": "^8.0.1"
},
"devDependencies": {
"@babel/core": "^7.4.3",
"@babel/preset-env": "^7.4.3",
"@vue/babel-preset-app": "^3.6.0",
"@vue/test-utils": "^1.0.0-beta.29",
"@babel/core": "^7.23.3",
"@babel/preset-env": "^7.23.3",
"@vue/babel-preset-app": "^5.0.8",
"@vue/test-utils": "^2.4.2",
"babel-core": "^7.0.0-bridge.0",
"babel-jest": "^24.7.1",
"babel-jest": "^29.7.0",
"babel-preset-env": "^1.7.0",
"cross-env": "^5.2.0",
"eslint": "^5.16.0",
"jest": "^24.7.1",
"node-fetch": "^2.3.0",
"cross-env": "^7.0.3",
"eslint": "^8.54.0",
"jest": "^29.7.0",
"node-fetch": "^3.3.2",
"pouchdb-authentication": "^1.1.3",
"pouchdb-find": "^7.0.0",
"pouchdb-node": "^7.0.0",
"rollup": "^1.7.4",
"pouchdb-node": "^8.0.1",
"rollup": "^4.5.2",
"rollup-plugin-babel": "^4.3.2",
"rollup-plugin-buble": "^0.19.6",
"rollup-plugin-commonjs": "^9.2.2",
"rollup-plugin-json": "^4.0.0",
"rollup-plugin-node-resolve": "^4.0.1",
"rollup-plugin-replace": "^2.1.1",
"vue": "^2.6.10",
"vue-jest": "^3.0.4",
"vue-template-compiler": "^2.6.10"
"vue": "^3.3.8",
"vue-jest": "^3.0.7",
"vue-template-compiler": "^2.7.15"
}
}