Socket
Socket
Sign inDemoInstall

filter-pouch

Package Overview
Dependencies
28
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.1 to 0.1.2

2

bower.json
{
"name": "filter-pouch",
"main": "dist/pouchdb.filter-pouch.js",
"version": "0.1.1",
"version": "0.1.2",
"homepage": "https://github.com/nolanlawson/filter-pouch",

@@ -6,0 +6,0 @@ "authors": [

{
"name": "filter-pouch",
"version": "0.1.1",
"version": "0.1.2",
"description": "Filter Pouch - a PouchDB plugin for filtering documents",

@@ -58,5 +58,2 @@ "main": "index.js",

},
"peerDependencies": {
"pouchdb": ">= 2.2.0"
},
"browser": {

@@ -63,0 +60,0 @@ "crypto": false

@@ -67,3 +67,3 @@ Filter Pouch

* `incoming` functions apply to `put()`, `post()`, `bulkDocs()`, and incoming replications.
* `outgoing` functions apply to `get()`, `allDocs()`, `changes()`, and outgoing replications.
* `outgoing` functions apply to `get()`, `allDocs()`, `changes()`, `query()`, and outgoing replications.
* The `filter()` method is synchronous - no need for callbacks or promises.

@@ -139,2 +139,17 @@

Note on query()
---------
Since the remote CouchDB doesn't have accesss to the unfiltered document, map/reduce functions in CouchDB will be applies to the unfiltered version. PouchDB doesn't have this limitation, because everything is local.
So for instance, if you try to `emit()` an encrypted field:
```js
function (doc) {
emit(doc.secret, 'shhhhh');
}
```
... the emitted key will be encrypted when you `query()` a remote database but decrypted when you `query()` a local database. So be aware that the functionality is not exactly the same.
Building

@@ -141,0 +156,0 @@ ----

@@ -624,10 +624,33 @@ /*jshint expr:true */

}).then(function (res) {
res.results.should.have.length(1);
res.results[0].doc.secret.should.equal('my super secret text!');
return changesCompletePromise(new Pouch(dbName), {include_docs: true});
res.results.should.have.length(1);
res.results[0].doc.secret.should.equal('my super secret text!');
return changesCompletePromise(new Pouch(dbName), {include_docs: true});
}).then(function (res) {
res.results.should.have.length(1);
res.results[0].doc.secret.should.equal(encrypt('my super secret text!'));
});
});
// only works locally, since the remote Couch can't see the
// unencrypted field
if (dbType === 'local') {
it('test encryption/decryption with map/reduce', function () {
filter(db);
var mapFun = {
map: function (doc) {
emit(doc.secret);
}
};
return db.put({_id: 'doc', secret: 'my super secret text!'}).then(function () {
return db.query(mapFun);
}).then(function (res) {
res.results.should.have.length(1);
res.results[0].doc.secret.should.equal(encrypt('my super secret text!'));
res.rows.should.have.length(1);
res.rows[0].key.should.equal('my super secret text!');
return new Pouch(dbName).query(mapFun);
}).then(function (res) {
res.rows.should.have.length(1);
res.rows[0].key.should.equal(encrypt('my super secret text!'));
});
});
});
}
});

@@ -634,0 +657,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc