Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pouchdb-core

Package Overview
Dependencies
Maintainers
5
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pouchdb-core - npm Package Compare versions

Comparing version 6.3.4 to 6.4.0

52

lib/index.es.js

@@ -14,6 +14,6 @@ import { adapterFun, assign, bulkGetShim, clone, guardedConsole, hasLocalStorage, invalidIdError, isRemote, listenerCount, nextTick, once, pick, rev, upsert } from 'pouchdb-utils';

function tryCatchInChangeListener(self, change) {
function tryCatchInChangeListener(self, change, pending, lastSeq) {
// isolate try/catches to avoid V8 deoptimizations
try {
self.emit('change', change);
self.emit('change', change, pending, lastSeq);
} catch (e) {

@@ -51,3 +51,3 @@ guardedConsole('error', 'Error in .on("change", function):', e);

opts.onChange = function (change) {
opts.onChange = function (change, pending, lastSeq) {
/* istanbul ignore if */

@@ -57,3 +57,3 @@ if (self.isCancelled) {

}
tryCatchInChangeListener(self, change);
tryCatchInChangeListener(self, change, pending, lastSeq);
};

@@ -286,34 +286,12 @@

function allDocsKeysQuery(api, opts, callback) {
function allDocsKeysParse(opts) {
var keys = ('limit' in opts) ?
opts.keys.slice(opts.skip, opts.limit + opts.skip) :
(opts.skip > 0) ? opts.keys.slice(opts.skip) : opts.keys;
opts.keys.slice(opts.skip, opts.limit + opts.skip) :
(opts.skip > 0) ? opts.keys.slice(opts.skip) : opts.keys;
opts.keys = keys;
opts.skip = 0;
if (opts.descending) {
keys.reverse();
opts.descending = false;
}
if (!keys.length) {
return api._allDocs({limit: 0}, callback);
}
var finalResults = {
offset: opts.skip
};
return Promise.all(keys.map(function (key) {
var subOpts = assign({key: key, deleted: 'ok'}, opts);
['limit', 'skip', 'keys'].forEach(function (optKey) {
delete subOpts[optKey];
});
return new Promise(function (resolve, reject) {
api._allDocs(subOpts, function (err, res) {
/* istanbul ignore if */
if (err) {
return reject(err);
}
finalResults.total_rows = res.total_rows;
resolve(res.rows[0] || {key: key, error: 'not_found'});
});
});
})).then(function (results) {
finalResults.rows = results;
return finalResults;
});
}

@@ -725,3 +703,4 @@

latest: opts.latest,
attachments: opts.attachments
attachments: opts.attachments,
binary: opts.binary
}, function (err, doc) {

@@ -938,3 +917,6 @@ if (!err) {

if (!isRemote(this)) {
return allDocsKeysQuery(this, opts, callback);
allDocsKeysParse(opts);
if (opts.keys.length === 0) {
return this._allDocs({limit: 0}, callback);
}
}

@@ -1425,3 +1407,3 @@ }

// managed automatically by set-version.js
var version = "6.3.4";
var version = "6.4.0";

@@ -1428,0 +1410,0 @@ // TODO: remove from pouchdb-core (breaking)

@@ -18,6 +18,6 @@ 'use strict';

function tryCatchInChangeListener(self, change) {
function tryCatchInChangeListener(self, change, pending, lastSeq) {
// isolate try/catches to avoid V8 deoptimizations
try {
self.emit('change', change);
self.emit('change', change, pending, lastSeq);
} catch (e) {

@@ -55,3 +55,3 @@ pouchdbUtils.guardedConsole('error', 'Error in .on("change", function):', e);

opts.onChange = function (change) {
opts.onChange = function (change, pending, lastSeq) {
/* istanbul ignore if */

@@ -61,3 +61,3 @@ if (self.isCancelled) {

}
tryCatchInChangeListener(self, change);
tryCatchInChangeListener(self, change, pending, lastSeq);
};

@@ -290,34 +290,12 @@

function allDocsKeysQuery(api, opts, callback) {
function allDocsKeysParse(opts) {
var keys = ('limit' in opts) ?
opts.keys.slice(opts.skip, opts.limit + opts.skip) :
(opts.skip > 0) ? opts.keys.slice(opts.skip) : opts.keys;
opts.keys.slice(opts.skip, opts.limit + opts.skip) :
(opts.skip > 0) ? opts.keys.slice(opts.skip) : opts.keys;
opts.keys = keys;
opts.skip = 0;
if (opts.descending) {
keys.reverse();
opts.descending = false;
}
if (!keys.length) {
return api._allDocs({limit: 0}, callback);
}
var finalResults = {
offset: opts.skip
};
return Promise.all(keys.map(function (key) {
var subOpts = pouchdbUtils.assign({key: key, deleted: 'ok'}, opts);
['limit', 'skip', 'keys'].forEach(function (optKey) {
delete subOpts[optKey];
});
return new Promise(function (resolve, reject) {
api._allDocs(subOpts, function (err, res) {
/* istanbul ignore if */
if (err) {
return reject(err);
}
finalResults.total_rows = res.total_rows;
resolve(res.rows[0] || {key: key, error: 'not_found'});
});
});
})).then(function (results) {
finalResults.rows = results;
return finalResults;
});
}

@@ -729,3 +707,4 @@

latest: opts.latest,
attachments: opts.attachments
attachments: opts.attachments,
binary: opts.binary
}, function (err, doc) {

@@ -942,3 +921,6 @@ if (!err) {

if (!pouchdbUtils.isRemote(this)) {
return allDocsKeysQuery(this, opts, callback);
allDocsKeysParse(opts);
if (opts.keys.length === 0) {
return this._allDocs({limit: 0}, callback);
}
}

@@ -1429,3 +1411,3 @@ }

// managed automatically by set-version.js
var version = "6.3.4";
var version = "6.4.0";

@@ -1432,0 +1414,0 @@ // TODO: remove from pouchdb-core (breaking)

{
"name": "pouchdb-core",
"version": "6.3.4",
"version": "6.4.0",
"description": "The core of PouchDB as a standalone package.",

@@ -14,9 +14,9 @@ "main": "./lib/index.js",

"inherits": "2.0.3",
"pouchdb-changes-filter": "6.3.4",
"pouchdb-collections": "6.3.4",
"pouchdb-debug": "6.3.4",
"pouchdb-errors": "6.3.4",
"pouchdb-merge": "6.3.4",
"pouchdb-promise": "6.3.4",
"pouchdb-utils": "6.3.4"
"pouchdb-changes-filter": "6.4.0",
"pouchdb-collections": "6.4.0",
"pouchdb-debug": "6.4.0",
"pouchdb-errors": "6.4.0",
"pouchdb-merge": "6.4.0",
"pouchdb-promise": "6.4.0",
"pouchdb-utils": "6.4.0"
},

@@ -23,0 +23,0 @@ "module": "./lib/index.es.js",

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc