pouchdb-core
Advanced tools
Comparing version 6.3.4 to 6.4.0
@@ -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", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
90642
2516
+ Addeddebug@3.0.1(transitive)
+ Addedms@2.0.0(transitive)
+ Addedpouchdb-changes-filter@6.4.0(transitive)
+ Addedpouchdb-collate@6.4.0(transitive)
+ Addedpouchdb-collections@6.4.0(transitive)
+ Addedpouchdb-debug@6.4.0(transitive)
+ Addedpouchdb-errors@6.4.0(transitive)
+ Addedpouchdb-merge@6.4.0(transitive)
+ Addedpouchdb-promise@6.4.0(transitive)
+ Addedpouchdb-selector-core@6.4.0(transitive)
+ Addedpouchdb-utils@6.4.0(transitive)
- Removeddebug@2.6.4(transitive)
- Removedms@0.7.3(transitive)
- Removedpouchdb-changes-filter@6.3.4(transitive)
- Removedpouchdb-collate@6.3.4(transitive)
- Removedpouchdb-collections@6.3.4(transitive)
- Removedpouchdb-debug@6.3.4(transitive)
- Removedpouchdb-errors@6.3.4(transitive)
- Removedpouchdb-merge@6.3.4(transitive)
- Removedpouchdb-promise@6.3.4(transitive)
- Removedpouchdb-selector-core@6.3.4(transitive)
- Removedpouchdb-utils@6.3.4(transitive)
Updatedpouchdb-changes-filter@6.4.0
Updatedpouchdb-collections@6.4.0
Updatedpouchdb-debug@6.4.0
Updatedpouchdb-errors@6.4.0
Updatedpouchdb-merge@6.4.0
Updatedpouchdb-promise@6.4.0
Updatedpouchdb-utils@6.4.0