Coder Social home page Coder Social logo

app-pouchdb's People

Contributors

cdata avatar dfreedm avatar e111077 avatar mkazlauskas avatar notwaldorf avatar raydaly avatar tedium-bot avatar timvdlippe avatar valdrinkoshi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

app-pouchdb's Issues

Error with url in local databases

I'm using app-pouchdb-sync to upload documents from local database to remote couchdb using this code in src/my-app.html :

    <app-pouchdb-sync src="localdb" target="http://username:[email protected]/remotedb" bidirectional="">
    </app-pouchdb-sync>

and in the web console keeps appearing this errors:

https://site.example.com/src/localdb/ 404 ()

like if src were a "remote database"

I'm using pouchdb-5.3.2 and app-pouchdb-0.9.1

Need more examples or demo

I am working with this element and i'm confuse with how we can interact with a specified DB.
Like to properly insert/delete document from JS code or to set DB documents if empty.
A working demo or some more examples in documentation would be great.

app-pouchdb-index doesn't work, throws TypeError in console

Description

app-pouchdb-index gives exception: TypeError: this.db.createIndex is not a function when attempting to use it.

Expected outcome

app-pouchdb-index element is working and PouchDB indexes created.

Actual outcome

No indexes are created and element throws error:

TypeError: this.db.createIndex is not a function

.__createIndex()
 app-pouchdb-index.html.js:56
._complexObserverEffect()
 polymer.html.js:1634
Polymer.Bind._modelApi._effectEffects()
 polymer.html.js:1469
Polymer.Bind._modelApi._propertySetter()
 polymer.html.js:1453
Polymer.Bind._modelApi.__setProperty()
 polymer.html.js:1462
._computeEffect()
 polymer.html.js:1647
Polymer.Bind._modelApi._effectEffects()
 polymer.html.js:1469
Polymer.Bind._modelApi._propertySetter()
 polymer.html.js:1453
Polymer.Bind._modelApi.__setProperty()
 polymer.html.js:1462
._applyConfig()
 polymer.html.js:2072
._afterClientsReady()
 polymer.html.js:2066
._ready()
 polymer-mini.html.js:62
._readyClients()
 polymer-mini.html.js:70
._ready()
 polymer-mini.html.js:58
._readyClients()
 polymer-mini.html.js:70
._ready()
 polymer-mini.html.js:58
._tryReady()
 polymer-mini.html.js:48
._initFeatures()
 polymer.html.js:4090
Polymer.Base.createdCallback()
 polymer-micro.html.js:190
created()
 webcomponents-lite.js:2217
upgradeWithDefinition()
 webcomponents-lite.js:2185
upgrade()
 webcomponents-lite.js:2173
added()
 webcomponents-lite.js:1978
addedSubtree/<()
 webcomponents-lite.js:1987
forSubtree/<()
 webcomponents-lite.js:1919
findAllElements()
 webcomponents-lite.js:1935
findAllElements()
 webcomponents-lite.js:1936
findAllElements()
 webcomponents-lite.js:1936
forSubtree()
 webcomponents-lite.js:1918
addedSubtree()
 webcomponents-lite.js:1986
addedNode()
 webcomponents-lite.js:1975
upgradeDocument()
 webcomponents-lite.js:2136
_forDocumentTree()
 webcomponents-lite.js:1964
forDocumentTree()
 webcomponents-lite.js:1950
upgradeDocumentTree()
 webcomponents-lite.js:2141
bootstrap()
 webcomponents-lite.js:2473
<anonimowa>
 webcomponents-lite.js:1293
checkDone()
 webcomponents-lite.js:1212
loadedImport()
 webcomponents-lite.js:1223
importParser.parseImport()
 webcomponents-lite.js:1577
importParser.parseLink()
 webcomponents-lite.js:1600
importParser.parse()
 webcomponents-lite.js:1538
importParser.parseNext()
 webcomponents-lite.js:1527
importParser.trackElement/done() 
 webcomponents-lite.js:1637

Live Demo

I attempted to create one at https://jsbin.com/giyuyeyera/edit?html,console,output but it seems app-pouchdb elements there don't have their PouchDB dependency installed.

Steps to reproduce

  1. Add app-pouchdb-index and app-pouchdb-query elements according to https://elements.polymer-project.org/elements/app-pouchdb?active=app-pouchdb-query.
  2. Open js console in browser.
  3. Load a page.

Browsers Affected

Firefox 45.5.1

error app-pouchdb elements with pouchdb-5.4.4

I have downloaded app-puchdb components through bower. It install pouchdb-5.4.4.
When I import a app-pouchdb-query I got an error in JavaScript Console:

 Uncaught TypeError: Cannot read property 'Promise' of undefined(anonymous function)  pouchdb.find.js:4493

The same application works fine when I revert back to pouchdb-5.3.2

<app-pouchdb-sync> 's src property is converted to a URL string

Description

Putting the name of the local database in the src, converts the string into a URL.
<app-pouchdb-sync src="localDbName" target="http://ip:port/remoteDb" bidirectional > tries to create
Pouch.sync('http://localhost:8080/src/localDbName', http://ip:port/remoteDb") which results in the synchronisation not working.

Expected outcome

<app-pouchdb-sync src="localDbName" target="http://ip:port/remoteDb" bidirectional > is expected to launch
Pouch.sync('localDbName', http://ip:port/remoteDb")

Actual outcome

The element converts src into a URL, namely, 'http://localhost:8080/src/localDbName' and thus tries to launch
Pouch.sync('http://localhost:8080/src/localDbName', http://ip:port/remoteDb")

Live Demo

Steps to reproduce

  1. open /bower_components/app-pouchdb/app-pouchdb-sync.html
  2. Add a log the value of src in the function __computeSync, i.e add: console.log("src= " + src);
  3. Use it from another element:
<app-pouchdb-sync
        src="localDbName"
        target="thisNameCanAlsoBeLocal"
        bidirectional>
</app-pouchdb-sync>

Alternatively, create a new element

<script>
  (function() {
    Polymer({
      is: 'my-element',
      properties: {
        src: {
          type: String
        }
      },
      ready: function() {
        console.log(this.src);
      }
    });
  })();
</script>

And use it from another element

The console should display

http://localhost:8080/src/mystring

Browsers Affected

  • [-] Chrome
  • [ ?] Firefox
  • [ ?] Safari 9
  • [ ?] Safari 8
  • [ ?] Safari 7
  • [-] Edge
  • [ ? ] IE 11
  • [ ? ] IE 10

Is the sw-import.js symlink necessary?

Checking in symlinks seems like a potentially tricky thing.

First, tools need to make sure they understand symlinks. Tedium already has to be updated.

Second, I've heard of problems with checking out symlinks on Windows I'm not sure if they're still problematic, but it'd be nice to confirm that the symlinks work on windows.

Third, the symlink will be invalid when this package is Bower installed, because there won't be a ./bower_components directory.

Are there viable alternate approaches to symlinks?

pouchdb/dist/pouchdb.js not found.

I was trying to build the catalog, but it failed because ../pouchdb/dist/pouchdb.js isn't found. I did a quick look at the pouchdb dependency and it doesn't have a dist folder anymore. version: 6.1.1

app-pouchdb-sync should emmit change and error events

Description

It would be nice for app-pouchdb-sync element to emit events on change and error. We'd be able to perform tasks as query refresh, in case of change, or toast a message in case of error.

Expected outcome

On each change or error, element should emit events.

Actual outcome

No event emited, only log of events is available.

Call to reset function in the destroy function in `app-pouchdb-document` out of scope

Description

In app-pouchdb-document there's a fragment where clearly call to this.reset(); is out of scope:

destroy: function() {
  this.set('data._deleted', true);
  return this.transactionsComplete.then(function() {
    return this.reset();
  });
},

This causes calls to this function to always fail. Though, the item is deleted from the store.

Expected outcome

Not fail :)

Actual outcome

Promise rejection due the error.

Live Demo

https://jsbin.com/wiroqef/4/edit?html,js,output

Steps to reproduce

See demo.

Browsers Affected

Browser independent. It will always fail.

revsLimit and adapter variables switched in __computeDb

Description

In the AppPouchDBDatabaseBehavior function __computeDb has switched arduments. According to db attribute definition this is computed by __computeDb(dbName, adapter, revsLimit) however, actual function body is __computeDb: function(name, revsLimit, adapter).
It causes error when trying to put anything to the data store:

Uncaught TypeError: Cannot read property '2' of undefined
at traverseRevTree (VM4319 pouchdb.js:3619)
at stem (VM4319 pouchdb.js:3914)
at merge (VM4319 pouchdb.js:3927)
at nextDoc (VM4319 pouchdb.js:5953)
at VM4319 pouchdb.js:5959
at _Map.15._Map.forEach (VM4319 pouchdb.js:2574)
at processDocs (VM4319 pouchdb.js:5933)
at idbProcessDocs (VM4319 pouchdb.js:6331)
at checkDone (VM4319 pouchdb.js:6345)
at IDBRequest.readMetadata (VM4319 pouchdb.js:6355)

This error is caused because of the switch. At this point PouchDB is expecting different parameter. After I switch back this parameters in by bower_components folder my test cases started working.

Trying to install on Polymer 3.0

Description

Install package on Polymer 3.0

Expected outcome

Package installed

Actual outcome

The package not found:

npm ERR! code ETARGET
npm ERR! notarget No matching version found for @polymer/app-pouchdb@next
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2018-06-01T22_07_13_684Z-debug.log

Steps to reproduce

  • npm i @polymer/pouchdb@next

Is app-pouchdb-sync functional?

Description

app-pouchdb-sync element appears in the README but is not present in the polymer.elements catalog.

Trying to sync a local pouch with a working coucdb doesn't work. No errors are shown but no replication happens.

Expected outcome

app-pouchdb-sync element appears in the polymer.elements catalog and is properly documented.

It correctly syncs two databases.

Actual outcome

Nothing happens when I add app-pouchdb-sync to a polymer project.

Live Demo

Steps to reproduce

Browsers Affected

  • Chrome
  • Firefox
  • Safari 9
  • Safari 8
  • Safari 7
  • Edge
  • IE 11
  • IE 10

Hydrolysis issues

Behavior Polymer.AppPouchDBDatabaseBehavior not found when mixing properties into app-pouchdb-index!

Behavior Polymer.AppPouchDBDatabaseBehavior not found when mixing properties into app-pouchdb-query!

Behavior Polymer.AppPouchDBDatabaseBehavior not found when mixing properties into app-pouchdb-document!

CORS error using app-pouchdb-query on remote CouchDB

Description

After setting up a remote CouchDB and activating CORS I still get a "Referer header must match host." error when using app-pouchdb-query

<app-pouchdb-query
        db-name="http://localhost:5984/kittens"
        selector="_id $gt null"
        data="{{data}}">
  </app-pouchdb-query>

Expected outcome

The documents in the database are loaded in data

Actual outcome

POST http://localhost:5984/kittens/_find 400 (Bad Request)
Object {error: "bad_request", reason: "Referer header must match host.", status: 400, name: "bad_request", message: "Referer header must match host."}

Live Demo

Steps to reproduce

  1. Install and configure a remote CouchDB running in localhost:5984
  2. Put a app-pouchdb-query element as defined above in the page.
  3. Open the page in a web browser.
  4. See the console

Browsers Affected

  • Chrome
  • Firefox
  • Safari 9
  • Safari 8
  • Safari 7
  • Edge
  • IE 11
  • IE 10

How to create multiple documents using a single app-puchdb element?

I am trying to save a list of products to the local database, coming from my server in the form of a json array using the app-pouchdb element.

What I need is to create a document for each product so I can query the local database later, using the document _id, but as I see the element asks for a doc-id (ie.: parsip) right at the start:

<app-pouchdb-document
    db-name="cats"
    doc-id="parsnip"
    data="{{cat}}">
</app-pouchdb-document>

Using the same _id, rows are overwritten and I end up with only one document in the end. I have read the docs a few times, but I can't find any hint on achieving separate document for each product from my array.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.