pouchdb-core
Advanced tools
Comparing version 6.1.0 to 6.1.1
@@ -79,3 +79,3 @@ 'use strict'; | ||
/* istanbul ignore if */ | ||
if (opts.isCancelled) { | ||
if (self.isCancelled) { | ||
return; | ||
@@ -362,3 +362,3 @@ } | ||
return Promise.all(keys.map(function (key) { | ||
var subOpts = pouchdbUtils.jsExtend({key: key, deleted: 'ok'}, opts); | ||
var subOpts = pouchdbUtils.assign({key: key, deleted: 'ok'}, opts); | ||
['limit', 'skip', 'keys'].forEach(function (optKey) { | ||
@@ -1063,3 +1063,4 @@ delete subOpts[optKey]; | ||
if (!opts.new_edits && this.type() !== 'http') { | ||
var adapter = this; | ||
if (!opts.new_edits && adapter.type() !== 'http') { | ||
// ensure revisions of the same doc are sorted, so that | ||
@@ -1072,2 +1073,9 @@ // the local adapter processes them correctly (#2935) | ||
// in the case of conflicts, we want to return the _ids to the user | ||
// however, the underlying adapter may destroy the docs array, so | ||
// create a copy here | ||
var ids = req.docs.map(function (doc) { | ||
return doc._id; | ||
}); | ||
return this._bulkDocs(req, opts, function (err, res) { | ||
@@ -1083,2 +1091,9 @@ if (err) { | ||
} | ||
// add ids for error/conflict responses (not required for CouchDB) | ||
if (adapter.type() !== 'http') { | ||
for (var i = 0, l = res.length; i < l; i++) { | ||
res[i].id = res[i].id || ids[i]; | ||
} | ||
} | ||
callback(null, res); | ||
@@ -1157,3 +1172,3 @@ }); | ||
function TaskQueue() { | ||
function TaskQueue$1() { | ||
this.isReady = false; | ||
@@ -1164,3 +1179,3 @@ this.failed = false; | ||
TaskQueue.prototype.execute = function () { | ||
TaskQueue$1.prototype.execute = function () { | ||
var fun; | ||
@@ -1178,3 +1193,3 @@ if (this.failed) { | ||
TaskQueue.prototype.fail = function (err) { | ||
TaskQueue$1.prototype.fail = function (err) { | ||
this.failed = err; | ||
@@ -1184,3 +1199,3 @@ this.execute(); | ||
TaskQueue.prototype.ready = function (db) { | ||
TaskQueue$1.prototype.ready = function (db) { | ||
this.isReady = true; | ||
@@ -1191,3 +1206,3 @@ this.db = db; | ||
TaskQueue.prototype.addTask = function (fun) { | ||
TaskQueue$1.prototype.addTask = function (fun) { | ||
this.queue.push(fun); | ||
@@ -1209,5 +1224,5 @@ if (this.failed) { | ||
var adapters = PouchDB.adapters; | ||
var preferredAdapters = PouchDB.preferredAdapters; | ||
var prefix = PouchDB.prefix; | ||
var adapters = PouchDB$2.adapters; | ||
var preferredAdapters = PouchDB$2.preferredAdapters; | ||
var prefix = PouchDB$2.prefix; | ||
var adapterName = opts.adapter; | ||
@@ -1283,8 +1298,8 @@ | ||
inherits(PouchDB, AbstractPouchDB); | ||
function PouchDB(name, opts) { | ||
inherits(PouchDB$2, AbstractPouchDB); | ||
function PouchDB$2(name, opts) { | ||
// In Node our test suite only tests this for PouchAlt unfortunately | ||
/* istanbul ignore if */ | ||
if (!(this instanceof PouchDB)) { | ||
return new PouchDB(name, opts); | ||
if (!(this instanceof PouchDB$2)) { | ||
return new PouchDB$2(name, opts); | ||
} | ||
@@ -1304,3 +1319,3 @@ | ||
self.auto_compaction = opts.auto_compaction; | ||
self.prefix = PouchDB.prefix; | ||
self.prefix = PouchDB$2.prefix; | ||
@@ -1321,4 +1336,4 @@ if (typeof name !== 'string') { | ||
if (!PouchDB.adapters[opts.adapter] || | ||
!PouchDB.adapters[opts.adapter].valid()) { | ||
if (!PouchDB$2.adapters[opts.adapter] || | ||
!PouchDB$2.adapters[opts.adapter].valid()) { | ||
throw new Error('Invalid Adapter: ' + opts.adapter); | ||
@@ -1328,7 +1343,7 @@ } | ||
AbstractPouchDB.call(self); | ||
self.taskqueue = new TaskQueue(); | ||
self.taskqueue = new TaskQueue$1(); | ||
self.adapter = opts.adapter; | ||
PouchDB.adapters[opts.adapter].call(self, opts, function (err) { | ||
PouchDB$2.adapters[opts.adapter].call(self, opts, function (err) { | ||
if (err) { | ||
@@ -1340,3 +1355,3 @@ return self.taskqueue.fail(err); | ||
self.emit('created', self); | ||
PouchDB.emit('created', self.name); | ||
PouchDB$2.emit('created', self.name); | ||
self.taskqueue.ready(self); | ||
@@ -1347,8 +1362,8 @@ }); | ||
PouchDB.debug = debug; | ||
PouchDB$2.debug = debug; | ||
PouchDB.adapters = {}; | ||
PouchDB.preferredAdapters = []; | ||
PouchDB$2.adapters = {}; | ||
PouchDB$2.preferredAdapters = []; | ||
PouchDB.prefix = '_pouch_'; | ||
PouchDB$2.prefix = '_pouch_'; | ||
@@ -1375,10 +1390,10 @@ var eventEmitter = new events.EventEmitter(); | ||
setUpEventEmitter(PouchDB); | ||
setUpEventEmitter(PouchDB$2); | ||
PouchDB.adapter = function (id, obj, addToPreferredAdapters) { | ||
PouchDB$2.adapter = function (id, obj, addToPreferredAdapters) { | ||
/* istanbul ignore else */ | ||
if (obj.valid()) { | ||
PouchDB.adapters[id] = obj; | ||
PouchDB$2.adapters[id] = obj; | ||
if (addToPreferredAdapters) { | ||
PouchDB.preferredAdapters.push(id); | ||
PouchDB$2.preferredAdapters.push(id); | ||
} | ||
@@ -1388,5 +1403,5 @@ } | ||
PouchDB.plugin = function (obj) { | ||
PouchDB$2.plugin = function (obj) { | ||
if (typeof obj === 'function') { // function style for plugins | ||
obj(PouchDB); | ||
obj(PouchDB$2); | ||
} else if (typeof obj !== 'object' || Object.keys(obj).length === 0){ | ||
@@ -1396,9 +1411,9 @@ throw new Error('Invalid plugin: got \"' + obj + '\", expected an object or a function'); | ||
Object.keys(obj).forEach(function (id) { // object style for plugins | ||
PouchDB.prototype[id] = obj[id]; | ||
PouchDB$2.prototype[id] = obj[id]; | ||
}); | ||
} | ||
return PouchDB; | ||
return PouchDB$2; | ||
}; | ||
PouchDB.defaults = function (defaultOpts) { | ||
PouchDB$2.defaults = function (defaultOpts) { | ||
function PouchAlt(name, opts) { | ||
@@ -1417,12 +1432,12 @@ if (!(this instanceof PouchAlt)) { | ||
opts = pouchdbUtils.jsExtend({}, PouchAlt.__defaults, opts); | ||
PouchDB.call(this, name, opts); | ||
opts = pouchdbUtils.assign({}, PouchAlt.__defaults, opts); | ||
PouchDB$2.call(this, name, opts); | ||
} | ||
inherits(PouchAlt, PouchDB); | ||
inherits(PouchAlt, PouchDB$2); | ||
PouchAlt.preferredAdapters = PouchDB.preferredAdapters.slice(); | ||
Object.keys(PouchDB).forEach(function (key) { | ||
PouchAlt.preferredAdapters = PouchDB$2.preferredAdapters.slice(); | ||
Object.keys(PouchDB$2).forEach(function (key) { | ||
if (!(key in PouchAlt)) { | ||
PouchAlt[key] = PouchDB[key]; | ||
PouchAlt[key] = PouchDB$2[key]; | ||
} | ||
@@ -1433,3 +1448,3 @@ }); | ||
// https://github.com/pouchdb/pouchdb/issues/5922 | ||
PouchAlt.__defaults = pouchdbUtils.jsExtend({}, this.__defaults, defaultOpts); | ||
PouchAlt.__defaults = pouchdbUtils.assign({}, this.__defaults, defaultOpts); | ||
@@ -1440,6 +1455,6 @@ return PouchAlt; | ||
// managed automatically by set-version.js | ||
var version = "6.1.0"; | ||
var version = "6.1.1"; | ||
PouchDB.version = version; | ||
PouchDB$2.version = version; | ||
module.exports = PouchDB; | ||
module.exports = PouchDB$2; |
103
lib/index.js
@@ -79,3 +79,3 @@ 'use strict'; | ||
/* istanbul ignore if */ | ||
if (opts.isCancelled) { | ||
if (self.isCancelled) { | ||
return; | ||
@@ -362,3 +362,3 @@ } | ||
return Promise.all(keys.map(function (key) { | ||
var subOpts = pouchdbUtils.jsExtend({key: key, deleted: 'ok'}, opts); | ||
var subOpts = pouchdbUtils.assign({key: key, deleted: 'ok'}, opts); | ||
['limit', 'skip', 'keys'].forEach(function (optKey) { | ||
@@ -1063,3 +1063,4 @@ delete subOpts[optKey]; | ||
if (!opts.new_edits && this.type() !== 'http') { | ||
var adapter = this; | ||
if (!opts.new_edits && adapter.type() !== 'http') { | ||
// ensure revisions of the same doc are sorted, so that | ||
@@ -1072,2 +1073,9 @@ // the local adapter processes them correctly (#2935) | ||
// in the case of conflicts, we want to return the _ids to the user | ||
// however, the underlying adapter may destroy the docs array, so | ||
// create a copy here | ||
var ids = req.docs.map(function (doc) { | ||
return doc._id; | ||
}); | ||
return this._bulkDocs(req, opts, function (err, res) { | ||
@@ -1083,2 +1091,9 @@ if (err) { | ||
} | ||
// add ids for error/conflict responses (not required for CouchDB) | ||
if (adapter.type() !== 'http') { | ||
for (var i = 0, l = res.length; i < l; i++) { | ||
res[i].id = res[i].id || ids[i]; | ||
} | ||
} | ||
callback(null, res); | ||
@@ -1157,3 +1172,3 @@ }); | ||
function TaskQueue() { | ||
function TaskQueue$1() { | ||
this.isReady = false; | ||
@@ -1164,3 +1179,3 @@ this.failed = false; | ||
TaskQueue.prototype.execute = function () { | ||
TaskQueue$1.prototype.execute = function () { | ||
var fun; | ||
@@ -1178,3 +1193,3 @@ if (this.failed) { | ||
TaskQueue.prototype.fail = function (err) { | ||
TaskQueue$1.prototype.fail = function (err) { | ||
this.failed = err; | ||
@@ -1184,3 +1199,3 @@ this.execute(); | ||
TaskQueue.prototype.ready = function (db) { | ||
TaskQueue$1.prototype.ready = function (db) { | ||
this.isReady = true; | ||
@@ -1191,3 +1206,3 @@ this.db = db; | ||
TaskQueue.prototype.addTask = function (fun) { | ||
TaskQueue$1.prototype.addTask = function (fun) { | ||
this.queue.push(fun); | ||
@@ -1209,5 +1224,5 @@ if (this.failed) { | ||
var adapters = PouchDB.adapters; | ||
var preferredAdapters = PouchDB.preferredAdapters; | ||
var prefix = PouchDB.prefix; | ||
var adapters = PouchDB$2.adapters; | ||
var preferredAdapters = PouchDB$2.preferredAdapters; | ||
var prefix = PouchDB$2.prefix; | ||
var adapterName = opts.adapter; | ||
@@ -1283,8 +1298,8 @@ | ||
inherits(PouchDB, AbstractPouchDB); | ||
function PouchDB(name, opts) { | ||
inherits(PouchDB$2, AbstractPouchDB); | ||
function PouchDB$2(name, opts) { | ||
// In Node our test suite only tests this for PouchAlt unfortunately | ||
/* istanbul ignore if */ | ||
if (!(this instanceof PouchDB)) { | ||
return new PouchDB(name, opts); | ||
if (!(this instanceof PouchDB$2)) { | ||
return new PouchDB$2(name, opts); | ||
} | ||
@@ -1304,3 +1319,3 @@ | ||
self.auto_compaction = opts.auto_compaction; | ||
self.prefix = PouchDB.prefix; | ||
self.prefix = PouchDB$2.prefix; | ||
@@ -1321,4 +1336,4 @@ if (typeof name !== 'string') { | ||
if (!PouchDB.adapters[opts.adapter] || | ||
!PouchDB.adapters[opts.adapter].valid()) { | ||
if (!PouchDB$2.adapters[opts.adapter] || | ||
!PouchDB$2.adapters[opts.adapter].valid()) { | ||
throw new Error('Invalid Adapter: ' + opts.adapter); | ||
@@ -1328,7 +1343,7 @@ } | ||
AbstractPouchDB.call(self); | ||
self.taskqueue = new TaskQueue(); | ||
self.taskqueue = new TaskQueue$1(); | ||
self.adapter = opts.adapter; | ||
PouchDB.adapters[opts.adapter].call(self, opts, function (err) { | ||
PouchDB$2.adapters[opts.adapter].call(self, opts, function (err) { | ||
if (err) { | ||
@@ -1340,3 +1355,3 @@ return self.taskqueue.fail(err); | ||
self.emit('created', self); | ||
PouchDB.emit('created', self.name); | ||
PouchDB$2.emit('created', self.name); | ||
self.taskqueue.ready(self); | ||
@@ -1347,8 +1362,8 @@ }); | ||
PouchDB.debug = debug; | ||
PouchDB$2.debug = debug; | ||
PouchDB.adapters = {}; | ||
PouchDB.preferredAdapters = []; | ||
PouchDB$2.adapters = {}; | ||
PouchDB$2.preferredAdapters = []; | ||
PouchDB.prefix = '_pouch_'; | ||
PouchDB$2.prefix = '_pouch_'; | ||
@@ -1375,10 +1390,10 @@ var eventEmitter = new events.EventEmitter(); | ||
setUpEventEmitter(PouchDB); | ||
setUpEventEmitter(PouchDB$2); | ||
PouchDB.adapter = function (id, obj, addToPreferredAdapters) { | ||
PouchDB$2.adapter = function (id, obj, addToPreferredAdapters) { | ||
/* istanbul ignore else */ | ||
if (obj.valid()) { | ||
PouchDB.adapters[id] = obj; | ||
PouchDB$2.adapters[id] = obj; | ||
if (addToPreferredAdapters) { | ||
PouchDB.preferredAdapters.push(id); | ||
PouchDB$2.preferredAdapters.push(id); | ||
} | ||
@@ -1388,5 +1403,5 @@ } | ||
PouchDB.plugin = function (obj) { | ||
PouchDB$2.plugin = function (obj) { | ||
if (typeof obj === 'function') { // function style for plugins | ||
obj(PouchDB); | ||
obj(PouchDB$2); | ||
} else if (typeof obj !== 'object' || Object.keys(obj).length === 0){ | ||
@@ -1396,9 +1411,9 @@ throw new Error('Invalid plugin: got \"' + obj + '\", expected an object or a function'); | ||
Object.keys(obj).forEach(function (id) { // object style for plugins | ||
PouchDB.prototype[id] = obj[id]; | ||
PouchDB$2.prototype[id] = obj[id]; | ||
}); | ||
} | ||
return PouchDB; | ||
return PouchDB$2; | ||
}; | ||
PouchDB.defaults = function (defaultOpts) { | ||
PouchDB$2.defaults = function (defaultOpts) { | ||
function PouchAlt(name, opts) { | ||
@@ -1417,12 +1432,12 @@ if (!(this instanceof PouchAlt)) { | ||
opts = pouchdbUtils.jsExtend({}, PouchAlt.__defaults, opts); | ||
PouchDB.call(this, name, opts); | ||
opts = pouchdbUtils.assign({}, PouchAlt.__defaults, opts); | ||
PouchDB$2.call(this, name, opts); | ||
} | ||
inherits(PouchAlt, PouchDB); | ||
inherits(PouchAlt, PouchDB$2); | ||
PouchAlt.preferredAdapters = PouchDB.preferredAdapters.slice(); | ||
Object.keys(PouchDB).forEach(function (key) { | ||
PouchAlt.preferredAdapters = PouchDB$2.preferredAdapters.slice(); | ||
Object.keys(PouchDB$2).forEach(function (key) { | ||
if (!(key in PouchAlt)) { | ||
PouchAlt[key] = PouchDB[key]; | ||
PouchAlt[key] = PouchDB$2[key]; | ||
} | ||
@@ -1433,3 +1448,3 @@ }); | ||
// https://github.com/pouchdb/pouchdb/issues/5922 | ||
PouchAlt.__defaults = pouchdbUtils.jsExtend({}, this.__defaults, defaultOpts); | ||
PouchAlt.__defaults = pouchdbUtils.assign({}, this.__defaults, defaultOpts); | ||
@@ -1440,6 +1455,6 @@ return PouchAlt; | ||
// managed automatically by set-version.js | ||
var version = "6.1.0"; | ||
var version = "6.1.1"; | ||
PouchDB.version = version; | ||
PouchDB$2.version = version; | ||
module.exports = PouchDB; | ||
module.exports = PouchDB$2; |
{ | ||
"name": "pouchdb-core", | ||
"version": "6.1.0", | ||
"version": "6.1.1", | ||
"description": "The core of PouchDB as a standalone package.", | ||
@@ -22,11 +22,11 @@ "main": "./lib/index.js", | ||
"argsarray": "0.0.1", | ||
"debug": "2.3.2", | ||
"debug": "2.6.0", | ||
"inherits": "2.0.3", | ||
"pouchdb-collections": "6.1.0", | ||
"pouchdb-errors": "6.1.0", | ||
"pouchdb-merge": "6.1.0", | ||
"pouchdb-promise": "6.1.0", | ||
"pouchdb-utils": "6.1.0", | ||
"pouchdb-collections": "6.1.1", | ||
"pouchdb-errors": "6.1.1", | ||
"pouchdb-merge": "6.1.1", | ||
"pouchdb-promise": "6.1.1", | ||
"pouchdb-utils": "6.1.1", | ||
"scope-eval": "0.0.3" | ||
} | ||
} |
import { | ||
jsExtend as extend, | ||
assign, | ||
guardedConsole | ||
@@ -129,3 +129,3 @@ } from 'pouchdb-utils'; | ||
return Promise.all(keys.map(function (key) { | ||
var subOpts = extend({key: key, deleted: 'ok'}, opts); | ||
var subOpts = assign({key: key, deleted: 'ok'}, opts); | ||
['limit', 'skip', 'keys'].forEach(function (optKey) { | ||
@@ -830,3 +830,4 @@ delete subOpts[optKey]; | ||
if (!opts.new_edits && this.type() !== 'http') { | ||
var adapter = this; | ||
if (!opts.new_edits && adapter.type() !== 'http') { | ||
// ensure revisions of the same doc are sorted, so that | ||
@@ -839,2 +840,9 @@ // the local adapter processes them correctly (#2935) | ||
// in the case of conflicts, we want to return the _ids to the user | ||
// however, the underlying adapter may destroy the docs array, so | ||
// create a copy here | ||
var ids = req.docs.map(function (doc) { | ||
return doc._id; | ||
}); | ||
return this._bulkDocs(req, opts, function (err, res) { | ||
@@ -850,2 +858,9 @@ if (err) { | ||
} | ||
// add ids for error/conflict responses (not required for CouchDB) | ||
if (adapter.type() !== 'http') { | ||
for (var i = 0, l = res.length; i < l; i++) { | ||
res[i].id = res[i].id || ids[i]; | ||
} | ||
} | ||
callback(null, res); | ||
@@ -852,0 +867,0 @@ }); |
@@ -68,3 +68,3 @@ import Promise from 'pouchdb-promise'; | ||
/* istanbul ignore if */ | ||
if (opts.isCancelled) { | ||
if (self.isCancelled) { | ||
return; | ||
@@ -71,0 +71,0 @@ } |
@@ -1,2 +0,2 @@ | ||
import { jsExtend as extend } from 'pouchdb-utils'; | ||
import { assign } from 'pouchdb-utils'; | ||
@@ -72,3 +72,3 @@ import PouchDB from './constructor'; | ||
opts = extend({}, PouchAlt.__defaults, opts); | ||
opts = assign({}, PouchAlt.__defaults, opts); | ||
PouchDB.call(this, name, opts); | ||
@@ -88,3 +88,3 @@ } | ||
// https://github.com/pouchdb/pouchdb/issues/5922 | ||
PouchAlt.__defaults = extend({}, this.__defaults, defaultOpts); | ||
PouchAlt.__defaults = assign({}, this.__defaults, defaultOpts); | ||
@@ -91,0 +91,0 @@ return PouchAlt; |
// managed automatically by set-version.js | ||
export default "6.1.0"; | ||
export default "6.1.1"; |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
134700
3935
1
+ Addeddebug@2.6.0(transitive)
+ Addedpouchdb-collections@6.1.1(transitive)
+ Addedpouchdb-errors@6.1.1(transitive)
+ Addedpouchdb-merge@6.1.1(transitive)
+ Addedpouchdb-promise@6.1.1(transitive)
+ Addedpouchdb-utils@6.1.1(transitive)
- Removeddebug@2.3.2(transitive)
- Removedpouchdb-collections@6.1.0(transitive)
- Removedpouchdb-errors@6.1.0(transitive)
- Removedpouchdb-merge@6.1.0(transitive)
- Removedpouchdb-promise@6.1.0(transitive)
- Removedpouchdb-utils@6.1.0(transitive)
Updateddebug@2.6.0
Updatedpouchdb-collections@6.1.1
Updatedpouchdb-errors@6.1.1
Updatedpouchdb-merge@6.1.1
Updatedpouchdb-promise@6.1.1
Updatedpouchdb-utils@6.1.1