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

pouchdb-core

Package Overview
Dependencies
Maintainers
3
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 5.4.5 to 6.0.0

src/parseAdapter.js

393

lib/index-browser.js

@@ -10,4 +10,4 @@ 'use strict';

var pouchdbCollections = require('pouchdb-collections');
var events = require('events');
var getArguments = _interopDefault(require('argsarray'));
var events = require('events');
var pouchdbUtils = require('pouchdb-utils');

@@ -81,5 +81,2 @@ var pouchdbMerge = require('pouchdb-merge');

tryCatchInChangeListener(self, change);
if (self.startSeq && self.startSeq <= change.seq) {
self.startSeq = false;
}
};

@@ -109,4 +106,6 @@

if (!db.taskqueue.isReady) {
db.taskqueue.addTask(function () {
if (self.isCancelled) {
db.taskqueue.addTask(function (failed) {
if (failed) {
opts.complete(failed);
} else if (self.isCancelled) {
self.emit('cancel');

@@ -180,14 +179,2 @@ } else {

if (opts.continuous && opts.since !== 'now') {
this.db.info().then(function (info) {
self.startSeq = info.update_seq;
/* istanbul ignore next */
}, function (err) {
if (err.id === 'idbNull') {
// db closed before this returned thats ok
return;
}
throw err;
});
}

@@ -218,2 +205,3 @@ if (opts.view && !opts.filter) {

var newPromise = this.db._changes(opts);
/* istanbul ignore else */
if (newPromise && typeof newPromise.cancel === 'function') {

@@ -459,54 +447,24 @@ var cancel = self.cancel;

AbstractPouchDB.prototype.put =
pouchdbUtils.adapterFun('put', getArguments(function (args) {
var temp, temptype, opts, callback;
var warned = false;
var doc = args.shift();
var id = '_id' in doc;
AbstractPouchDB.prototype.put = pouchdbUtils.adapterFun('put', function (doc, opts, cb) {
if (typeof opts === 'function') {
cb = opts;
opts = {};
}
if (typeof doc !== 'object' || Array.isArray(doc)) {
callback = args.pop();
return callback(pouchdbErrors.createError(pouchdbErrors.NOT_AN_OBJECT));
return cb(pouchdbErrors.createError(pouchdbErrors.NOT_AN_OBJECT));
}
function warn() {
if (warned) {
return;
}
pouchdbUtils.guardedConsole('warn', 'db.put(doc, id, rev) has been deprecated and will be ' +
'removed in a future release, please use ' +
'db.put({_id: id, _rev: rev}) instead');
warned = true;
}
/* eslint no-constant-condition: 0 */
while (true) {
temp = args.shift();
temptype = typeof temp;
if (temptype === "string" && !id) {
warn();
doc._id = temp;
id = true;
} else if (temptype === "string" && id && !('_rev' in doc)) {
warn();
doc._rev = temp;
} else if (temptype === "object") {
opts = temp;
} else if (temptype === "function") {
callback = temp;
}
if (!args.length) {
break;
}
}
opts = opts || {};
pouchdbUtils.invalidIdError(doc._id);
if (pouchdbMerge.isLocalId(doc._id) && typeof this._putLocal === 'function') {
if (doc._deleted) {
return this._removeLocal(doc, callback);
return this._removeLocal(doc, cb);
} else {
return this._putLocal(doc, callback);
return this._putLocal(doc, cb);
}
}
this.bulkDocs({docs: [doc]}, opts, yankError(callback));
}));
if (typeof this._put === 'function' && opts.new_edits !== false) {
this._put(doc, opts, cb);
} else {
this.bulkDocs({docs: [doc]}, opts, yankError(cb));
}
});

@@ -778,15 +736,15 @@ AbstractPouchDB.prototype.putAttachment =

};
/* Begin api wrappers. Specific functionality to storage belongs in the
_[method] */
AbstractPouchDB.prototype.get =
pouchdbUtils.adapterFun('get', function (id, opts, callback) {
AbstractPouchDB.prototype.get = pouchdbUtils.adapterFun('get', function (id, opts, cb) {
if (typeof opts === 'function') {
callback = opts;
cb = opts;
opts = {};
}
if (typeof id !== 'string') {
return callback(pouchdbErrors.createError(pouchdbErrors.INVALID_ID));
return cb(pouchdbErrors.createError(pouchdbErrors.INVALID_ID));
}
if (pouchdbMerge.isLocalId(id) && typeof this._getLocal === 'function') {
return this._getLocal(id, callback);
return this._getLocal(id, cb);
}

@@ -800,3 +758,3 @@ var leaves = [], self = this;

if (!count) {
return callback(null, result);
return cb(null, result);
}

@@ -817,3 +775,3 @@ // order with open_revs is unspecified

if (!count) {
callback(null, result);
cb(null, result);
}

@@ -828,3 +786,3 @@ });

if (err) {
return callback(err);
return cb(err);
}

@@ -843,3 +801,3 @@ leaves = pouchdbMerge.collectLeaves(rev_tree).map(function (leaf) {

if (!(typeof (l) === "string" && /^\d+-/.test(l))) {
return callback(pouchdbErrors.createError(pouchdbErrors.INVALID_REV));
return cb(pouchdbErrors.createError(pouchdbErrors.INVALID_REV));
}

@@ -849,4 +807,3 @@ }

} else {
return callback(pouchdbErrors.createError(pouchdbErrors.UNKNOWN_ERROR,
'function_clause'));
return cb(pouchdbErrors.createError(pouchdbErrors.UNKNOWN_ERROR, 'function_clause'));
}

@@ -859,3 +816,3 @@ }

if (err) {
return callback(err);
return cb(err);
}

@@ -915,3 +872,3 @@

if (count === 0) {
return callback(null, doc);
return cb(null, doc);
}

@@ -932,3 +889,3 @@ Object.keys(attachments).forEach(function (key) {

if (!--count) {
callback(null, doc);
cb(null, doc);
}

@@ -946,3 +903,3 @@ });

}
callback(null, doc);
cb(null, doc);
}

@@ -956,4 +913,3 @@ });

AbstractPouchDB.prototype.getAttachment =
pouchdbUtils.adapterFun('getAttachment', function (docId, attachmentId, opts,
callback) {
pouchdbUtils.adapterFun('getAttachment', function (docId, attachmentId, opts, callback) {
var self = this;

@@ -1023,4 +979,3 @@ if (opts instanceof Function) {

AbstractPouchDB.prototype.close =
pouchdbUtils.adapterFun('close', function (callback) {
AbstractPouchDB.prototype.close = pouchdbUtils.adapterFun('close', function (callback) {
this._closed = true;

@@ -1037,3 +992,3 @@ return this._close(callback);

// assume we know better than the adapter, unless it informs us
info.db_name = info.db_name || self._db_name;
info.db_name = info.db_name || self.name;
info.auto_compaction = !!(self.auto_compaction && self.type() !== 'http');

@@ -1049,4 +1004,4 @@ info.adapter = self.type();

/* istanbul ignore next */
AbstractPouchDB.prototype.type = function () {
/* istanbul ignore next */
return (typeof this._type === 'function') ? this._type() : this.adapter;

@@ -1229,7 +1184,45 @@ };

function defaultCallback(err) {
/* istanbul ignore next */
if (err && global.debug) {
pouchdbUtils.guardedConsole('error', err);
function parseAdapter(name, opts) {
var match = name.match(/([a-z\-]*):\/\/(.*)/);
if (match) {
// the http adapter expects the fully qualified name
name = /http(s?)/.test(match[1]) ? match[1] + '://' + match[2] : match[2];
return {name: name, adapter: match[1]};
}
// check for browsers that have been upgraded from websql-only to websql+idb
var skipIdb = 'idb' in PouchDB.adapters && 'websql' in PouchDB.adapters &&
pouchdbUtils.hasLocalStorage() &&
localStorage['_pouch__websqldb_' + PouchDB.prefix + name];
var adapterName;
if (opts.adapter) {
adapterName = opts.adapter;
} else if (typeof opts !== 'undefined' && opts.db) {
adapterName = 'leveldb';
} else { // automatically determine adapter
for (var i = 0; i < PouchDB.preferredAdapters.length; ++i) {
adapterName = PouchDB.preferredAdapters[i];
/* istanbul ignore if */
if (skipIdb && adapterName === 'idb') {
// log it, because this can be confusing during development
pouchdbUtils.guardedConsole('log', 'PouchDB is downgrading "' + name + '" to WebSQL to' +
' avoid data loss, because it was already opened with WebSQL.');
continue; // keep using websql to avoid user data loss
}
break;
}
}
var adapter = PouchDB.adapters[adapterName];
// if adapter is invalid, then an error will be thrown later
var usePrefix = (adapter && 'use_prefix' in adapter) ?
adapter.use_prefix : true;
return {
name: usePrefix ? (PouchDB.prefix + name) : name,
adapter: adapterName
};
}

@@ -1247,9 +1240,8 @@

// that may have been created with the same name.
function prepareForDestruction(self, opts) {
var name = opts.originalName;
var ctor = self.constructor;
var destructionListeners = ctor._destructionListeners;
function prepareForDestruction(self) {
var destructionListeners = self.constructor._destructionListeners;
function onDestroyed() {
ctor.emit('destroyed', name);
self.constructor.emit('destroyed', self.name);
}

@@ -1265,138 +1257,65 @@

// in setup.js, the constructor is primed to listen for destroy events
if (!destructionListeners.has(name)) {
destructionListeners.set(name, []);
if (!destructionListeners.has(self.name)) {
destructionListeners.set(self.name, []);
}
destructionListeners.get(name).push(onConstructorDestroyed);
destructionListeners.get(self.name).push(onConstructorDestroyed);
}
inherits(PouchDB, AbstractPouchDB);
function PouchDB(name, opts, callback) {
function PouchDB(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, callback);
return new PouchDB(name, opts);
}
var self = this;
if (typeof opts === 'function' || typeof opts === 'undefined') {
callback = opts;
opts = {};
}
opts = opts || {};
if (name && typeof name === 'object') {
opts = name;
name = undefined;
name = opts.name;
delete opts.name;
}
if (typeof callback === 'undefined') {
callback = defaultCallback;
} else {
var oldCallback = callback;
callback = function () {
pouchdbUtils.guardedConsole('warn', 'Using a callback for new PouchDB()' +
'is deprecated.');
return oldCallback.apply(null, arguments);
};
}
this.__opts = opts = pouchdbUtils.clone(opts);
name = name || opts.name;
opts = pouchdbUtils.clone(opts);
// if name was specified via opts, ignore for the sake of dependentDbs
delete opts.name;
this.__opts = opts;
var oldCB = callback;
self.auto_compaction = opts.auto_compaction;
self.prefix = PouchDB.prefix;
AbstractPouchDB.call(self);
self.taskqueue = new TaskQueue();
var promise = new Promise(function (fulfill, reject) {
callback = function (err, resp) {
/* istanbul ignore if */
if (err) {
return reject(err);
}
delete resp.then;
fulfill(resp);
};
opts = pouchdbUtils.clone(opts);
var backend, error;
(function () {
try {
if (typeof name !== 'string') {
throw new Error('Missing/invalid DB name');
}
if (typeof name !== 'string') {
error = new Error('Missing/invalid DB name');
error.code = 400;
throw error;
}
var prefixedName = (opts.prefix || '') + name;
var backend = parseAdapter(prefixedName, opts);
var prefixedName = (opts.prefix || '') + name;
backend = PouchDB.parseAdapter(prefixedName, opts);
opts.name = backend.name;
opts.adapter = opts.adapter || backend.adapter;
opts.originalName = name;
opts.name = backend.name;
opts.adapter = opts.adapter || backend.adapter;
self._adapter = opts.adapter;
debug('pouchdb:adapter')('Picked adapter: ' + opts.adapter);
self.name = name;
self._adapter = opts.adapter;
debug('pouchdb:adapter')('Picked adapter: ' + opts.adapter);
self._db_name = name;
if (!PouchDB.adapters[opts.adapter]) {
error = new Error('Adapter is missing');
error.code = 404;
throw error;
}
if (!PouchDB.adapters[opts.adapter] ||
!PouchDB.adapters[opts.adapter].valid()) {
throw new Error('Invalid Adapter: ' + opts.adapter);
}
/* istanbul ignore if */
if (!PouchDB.adapters[opts.adapter].valid()) {
error = new Error('Invalid Adapter');
error.code = 404;
throw error;
}
} catch (err) {
self.taskqueue.fail(err);
}
}());
if (error) {
return reject(error); // constructor error, see above
}
self.adapter = opts.adapter;
AbstractPouchDB.call(self);
self.taskqueue = new TaskQueue();
// needs access to PouchDB;
self.replicate = {};
self.adapter = opts.adapter;
self.replicate.from = function (url, opts, callback) {
return self.constructor.replicate(url, self, opts, callback);
};
PouchDB.adapters[opts.adapter].call(self, opts, function (err) {
if (err) {
return self.taskqueue.fail(err);
}
prepareForDestruction(self);
self.replicate.to = function (url, opts, callback) {
return self.constructor.replicate(self, url, opts, callback);
};
self.emit('created', self);
PouchDB.emit('created', self.name);
self.taskqueue.ready(self);
});
self.sync = function (dbName, opts, callback) {
return self.constructor.sync(self, dbName, opts, callback);
};
self.replicate.sync = self.sync;
PouchDB.adapters[opts.adapter].call(self, opts, function (err) {
/* istanbul ignore if */
if (err) {
self.taskqueue.fail(err);
callback(err);
return;
}
prepareForDestruction(self, opts);
self.emit('created', self);
PouchDB.emit('created', opts.originalName);
self.taskqueue.ready(self);
callback(null, self);
});
});
promise.then(function (resp) {
oldCB(null, resp);
}, oldCB);
self.then = promise.then.bind(promise);
self.catch = promise.catch.bind(promise);
}

@@ -1433,55 +1352,4 @@

PouchDB.parseAdapter = function (name, opts) {
var match = name.match(/([a-z\-]*):\/\/(.*)/);
var adapter, adapterName;
if (match) {
// the http adapter expects the fully qualified name
name = /http(s?)/.test(match[1]) ? match[1] + '://' + match[2] : match[2];
adapter = match[1];
/* istanbul ignore if */
if (!PouchDB.adapters[adapter].valid()) {
throw 'Invalid adapter';
}
return {name: name, adapter: match[1]};
}
// check for browsers that have been upgraded from websql-only to websql+idb
var skipIdb = 'idb' in PouchDB.adapters && 'websql' in PouchDB.adapters &&
pouchdbUtils.hasLocalStorage() &&
localStorage['_pouch__websqldb_' + PouchDB.prefix + name];
if (opts.adapter) {
adapterName = opts.adapter;
} else if (typeof opts !== 'undefined' && opts.db) {
adapterName = 'leveldb';
} else { // automatically determine adapter
for (var i = 0; i < PouchDB.preferredAdapters.length; ++i) {
adapterName = PouchDB.preferredAdapters[i];
if (adapterName in PouchDB.adapters) {
/* istanbul ignore if */
if (skipIdb && adapterName === 'idb') {
// log it, because this can be confusing during development
pouchdbUtils.guardedConsole('log', 'PouchDB is downgrading "' + name + '" to WebSQL to' +
' avoid data loss, because it was already opened with WebSQL.');
continue; // keep using websql to avoid user data loss
}
break;
}
}
}
adapter = PouchDB.adapters[adapterName];
// if adapter is invalid, then an error will be thrown later
var usePrefix = (adapter && 'use_prefix' in adapter) ?
adapter.use_prefix : true;
return {
name: usePrefix ? (PouchDB.prefix + name) : name,
adapter: adapterName
};
};
PouchDB.adapter = function (id, obj, addToPreferredAdapters) {
/* istanbul ignore else */
if (obj.valid()) {

@@ -1498,2 +1366,4 @@ PouchDB.adapters[id] = obj;

obj(PouchDB);
} else if (typeof obj !== 'object' || Object.keys(obj).length === 0){
throw new Error('Invalid plugin: object passed in is empty or not an object');
} else {

@@ -1508,18 +1378,17 @@ Object.keys(obj).forEach(function (id) { // object style for plugins

PouchDB.defaults = function (defaultOpts) {
function PouchAlt(name, opts, callback) {
function PouchAlt(name, opts) {
if (!(this instanceof PouchAlt)) {
return new PouchAlt(name, opts, callback);
return new PouchAlt(name, opts);
}
if (typeof opts === 'function' || typeof opts === 'undefined') {
callback = opts;
opts = {};
}
opts = opts || {};
if (name && typeof name === 'object') {
opts = name;
name = undefined;
name = opts.name;
delete opts.name;
}
opts = jsExtend.extend({}, defaultOpts, opts);
PouchDB.call(this, name, opts, callback);
PouchDB.call(this, name, opts);
}

@@ -1540,3 +1409,3 @@

// managed automatically by set-version.js
var version = "5.4.5";
var version = "6.0.0";

@@ -1543,0 +1412,0 @@ PouchDB.version = version;

@@ -10,4 +10,4 @@ 'use strict';

var pouchdbCollections = require('pouchdb-collections');
var events = require('events');
var getArguments = _interopDefault(require('argsarray'));
var events = require('events');
var pouchdbUtils = require('pouchdb-utils');

@@ -81,5 +81,2 @@ var pouchdbMerge = require('pouchdb-merge');

tryCatchInChangeListener(self, change);
if (self.startSeq && self.startSeq <= change.seq) {
self.startSeq = false;
}
};

@@ -109,4 +106,6 @@

if (!db.taskqueue.isReady) {
db.taskqueue.addTask(function () {
if (self.isCancelled) {
db.taskqueue.addTask(function (failed) {
if (failed) {
opts.complete(failed);
} else if (self.isCancelled) {
self.emit('cancel');

@@ -180,14 +179,2 @@ } else {

if (opts.continuous && opts.since !== 'now') {
this.db.info().then(function (info) {
self.startSeq = info.update_seq;
/* istanbul ignore next */
}, function (err) {
if (err.id === 'idbNull') {
// db closed before this returned thats ok
return;
}
throw err;
});
}

@@ -218,2 +205,3 @@ if (opts.view && !opts.filter) {

var newPromise = this.db._changes(opts);
/* istanbul ignore else */
if (newPromise && typeof newPromise.cancel === 'function') {

@@ -459,54 +447,24 @@ var cancel = self.cancel;

AbstractPouchDB.prototype.put =
pouchdbUtils.adapterFun('put', getArguments(function (args) {
var temp, temptype, opts, callback;
var warned = false;
var doc = args.shift();
var id = '_id' in doc;
AbstractPouchDB.prototype.put = pouchdbUtils.adapterFun('put', function (doc, opts, cb) {
if (typeof opts === 'function') {
cb = opts;
opts = {};
}
if (typeof doc !== 'object' || Array.isArray(doc)) {
callback = args.pop();
return callback(pouchdbErrors.createError(pouchdbErrors.NOT_AN_OBJECT));
return cb(pouchdbErrors.createError(pouchdbErrors.NOT_AN_OBJECT));
}
function warn() {
if (warned) {
return;
}
pouchdbUtils.guardedConsole('warn', 'db.put(doc, id, rev) has been deprecated and will be ' +
'removed in a future release, please use ' +
'db.put({_id: id, _rev: rev}) instead');
warned = true;
}
/* eslint no-constant-condition: 0 */
while (true) {
temp = args.shift();
temptype = typeof temp;
if (temptype === "string" && !id) {
warn();
doc._id = temp;
id = true;
} else if (temptype === "string" && id && !('_rev' in doc)) {
warn();
doc._rev = temp;
} else if (temptype === "object") {
opts = temp;
} else if (temptype === "function") {
callback = temp;
}
if (!args.length) {
break;
}
}
opts = opts || {};
pouchdbUtils.invalidIdError(doc._id);
if (pouchdbMerge.isLocalId(doc._id) && typeof this._putLocal === 'function') {
if (doc._deleted) {
return this._removeLocal(doc, callback);
return this._removeLocal(doc, cb);
} else {
return this._putLocal(doc, callback);
return this._putLocal(doc, cb);
}
}
this.bulkDocs({docs: [doc]}, opts, yankError(callback));
}));
if (typeof this._put === 'function' && opts.new_edits !== false) {
this._put(doc, opts, cb);
} else {
this.bulkDocs({docs: [doc]}, opts, yankError(cb));
}
});

@@ -778,15 +736,15 @@ AbstractPouchDB.prototype.putAttachment =

};
/* Begin api wrappers. Specific functionality to storage belongs in the
_[method] */
AbstractPouchDB.prototype.get =
pouchdbUtils.adapterFun('get', function (id, opts, callback) {
AbstractPouchDB.prototype.get = pouchdbUtils.adapterFun('get', function (id, opts, cb) {
if (typeof opts === 'function') {
callback = opts;
cb = opts;
opts = {};
}
if (typeof id !== 'string') {
return callback(pouchdbErrors.createError(pouchdbErrors.INVALID_ID));
return cb(pouchdbErrors.createError(pouchdbErrors.INVALID_ID));
}
if (pouchdbMerge.isLocalId(id) && typeof this._getLocal === 'function') {
return this._getLocal(id, callback);
return this._getLocal(id, cb);
}

@@ -800,3 +758,3 @@ var leaves = [], self = this;

if (!count) {
return callback(null, result);
return cb(null, result);
}

@@ -817,3 +775,3 @@ // order with open_revs is unspecified

if (!count) {
callback(null, result);
cb(null, result);
}

@@ -828,3 +786,3 @@ });

if (err) {
return callback(err);
return cb(err);
}

@@ -843,3 +801,3 @@ leaves = pouchdbMerge.collectLeaves(rev_tree).map(function (leaf) {

if (!(typeof (l) === "string" && /^\d+-/.test(l))) {
return callback(pouchdbErrors.createError(pouchdbErrors.INVALID_REV));
return cb(pouchdbErrors.createError(pouchdbErrors.INVALID_REV));
}

@@ -849,4 +807,3 @@ }

} else {
return callback(pouchdbErrors.createError(pouchdbErrors.UNKNOWN_ERROR,
'function_clause'));
return cb(pouchdbErrors.createError(pouchdbErrors.UNKNOWN_ERROR, 'function_clause'));
}

@@ -859,3 +816,3 @@ }

if (err) {
return callback(err);
return cb(err);
}

@@ -915,3 +872,3 @@

if (count === 0) {
return callback(null, doc);
return cb(null, doc);
}

@@ -932,3 +889,3 @@ Object.keys(attachments).forEach(function (key) {

if (!--count) {
callback(null, doc);
cb(null, doc);
}

@@ -946,3 +903,3 @@ });

}
callback(null, doc);
cb(null, doc);
}

@@ -956,4 +913,3 @@ });

AbstractPouchDB.prototype.getAttachment =
pouchdbUtils.adapterFun('getAttachment', function (docId, attachmentId, opts,
callback) {
pouchdbUtils.adapterFun('getAttachment', function (docId, attachmentId, opts, callback) {
var self = this;

@@ -1023,4 +979,3 @@ if (opts instanceof Function) {

AbstractPouchDB.prototype.close =
pouchdbUtils.adapterFun('close', function (callback) {
AbstractPouchDB.prototype.close = pouchdbUtils.adapterFun('close', function (callback) {
this._closed = true;

@@ -1037,3 +992,3 @@ return this._close(callback);

// assume we know better than the adapter, unless it informs us
info.db_name = info.db_name || self._db_name;
info.db_name = info.db_name || self.name;
info.auto_compaction = !!(self.auto_compaction && self.type() !== 'http');

@@ -1049,4 +1004,4 @@ info.adapter = self.type();

/* istanbul ignore next */
AbstractPouchDB.prototype.type = function () {
/* istanbul ignore next */
return (typeof this._type === 'function') ? this._type() : this.adapter;

@@ -1229,7 +1184,45 @@ };

function defaultCallback(err) {
/* istanbul ignore next */
if (err && global.debug) {
pouchdbUtils.guardedConsole('error', err);
function parseAdapter(name, opts) {
var match = name.match(/([a-z\-]*):\/\/(.*)/);
if (match) {
// the http adapter expects the fully qualified name
name = /http(s?)/.test(match[1]) ? match[1] + '://' + match[2] : match[2];
return {name: name, adapter: match[1]};
}
// check for browsers that have been upgraded from websql-only to websql+idb
var skipIdb = 'idb' in PouchDB.adapters && 'websql' in PouchDB.adapters &&
pouchdbUtils.hasLocalStorage() &&
localStorage['_pouch__websqldb_' + PouchDB.prefix + name];
var adapterName;
if (opts.adapter) {
adapterName = opts.adapter;
} else if (typeof opts !== 'undefined' && opts.db) {
adapterName = 'leveldb';
} else { // automatically determine adapter
for (var i = 0; i < PouchDB.preferredAdapters.length; ++i) {
adapterName = PouchDB.preferredAdapters[i];
/* istanbul ignore if */
if (skipIdb && adapterName === 'idb') {
// log it, because this can be confusing during development
pouchdbUtils.guardedConsole('log', 'PouchDB is downgrading "' + name + '" to WebSQL to' +
' avoid data loss, because it was already opened with WebSQL.');
continue; // keep using websql to avoid user data loss
}
break;
}
}
var adapter = PouchDB.adapters[adapterName];
// if adapter is invalid, then an error will be thrown later
var usePrefix = (adapter && 'use_prefix' in adapter) ?
adapter.use_prefix : true;
return {
name: usePrefix ? (PouchDB.prefix + name) : name,
adapter: adapterName
};
}

@@ -1247,9 +1240,8 @@

// that may have been created with the same name.
function prepareForDestruction(self, opts) {
var name = opts.originalName;
var ctor = self.constructor;
var destructionListeners = ctor._destructionListeners;
function prepareForDestruction(self) {
var destructionListeners = self.constructor._destructionListeners;
function onDestroyed() {
ctor.emit('destroyed', name);
self.constructor.emit('destroyed', self.name);
}

@@ -1265,138 +1257,65 @@

// in setup.js, the constructor is primed to listen for destroy events
if (!destructionListeners.has(name)) {
destructionListeners.set(name, []);
if (!destructionListeners.has(self.name)) {
destructionListeners.set(self.name, []);
}
destructionListeners.get(name).push(onConstructorDestroyed);
destructionListeners.get(self.name).push(onConstructorDestroyed);
}
inherits(PouchDB, AbstractPouchDB);
function PouchDB(name, opts, callback) {
function PouchDB(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, callback);
return new PouchDB(name, opts);
}
var self = this;
if (typeof opts === 'function' || typeof opts === 'undefined') {
callback = opts;
opts = {};
}
opts = opts || {};
if (name && typeof name === 'object') {
opts = name;
name = undefined;
name = opts.name;
delete opts.name;
}
if (typeof callback === 'undefined') {
callback = defaultCallback;
} else {
var oldCallback = callback;
callback = function () {
pouchdbUtils.guardedConsole('warn', 'Using a callback for new PouchDB()' +
'is deprecated.');
return oldCallback.apply(null, arguments);
};
}
this.__opts = opts = pouchdbUtils.clone(opts);
name = name || opts.name;
opts = pouchdbUtils.clone(opts);
// if name was specified via opts, ignore for the sake of dependentDbs
delete opts.name;
this.__opts = opts;
var oldCB = callback;
self.auto_compaction = opts.auto_compaction;
self.prefix = PouchDB.prefix;
AbstractPouchDB.call(self);
self.taskqueue = new TaskQueue();
var promise = new Promise(function (fulfill, reject) {
callback = function (err, resp) {
/* istanbul ignore if */
if (err) {
return reject(err);
}
delete resp.then;
fulfill(resp);
};
opts = pouchdbUtils.clone(opts);
var backend, error;
(function () {
try {
if (typeof name !== 'string') {
throw new Error('Missing/invalid DB name');
}
if (typeof name !== 'string') {
error = new Error('Missing/invalid DB name');
error.code = 400;
throw error;
}
var prefixedName = (opts.prefix || '') + name;
var backend = parseAdapter(prefixedName, opts);
var prefixedName = (opts.prefix || '') + name;
backend = PouchDB.parseAdapter(prefixedName, opts);
opts.name = backend.name;
opts.adapter = opts.adapter || backend.adapter;
opts.originalName = name;
opts.name = backend.name;
opts.adapter = opts.adapter || backend.adapter;
self._adapter = opts.adapter;
debug('pouchdb:adapter')('Picked adapter: ' + opts.adapter);
self.name = name;
self._adapter = opts.adapter;
debug('pouchdb:adapter')('Picked adapter: ' + opts.adapter);
self._db_name = name;
if (!PouchDB.adapters[opts.adapter]) {
error = new Error('Adapter is missing');
error.code = 404;
throw error;
}
if (!PouchDB.adapters[opts.adapter] ||
!PouchDB.adapters[opts.adapter].valid()) {
throw new Error('Invalid Adapter: ' + opts.adapter);
}
/* istanbul ignore if */
if (!PouchDB.adapters[opts.adapter].valid()) {
error = new Error('Invalid Adapter');
error.code = 404;
throw error;
}
} catch (err) {
self.taskqueue.fail(err);
}
}());
if (error) {
return reject(error); // constructor error, see above
}
self.adapter = opts.adapter;
AbstractPouchDB.call(self);
self.taskqueue = new TaskQueue();
// needs access to PouchDB;
self.replicate = {};
self.adapter = opts.adapter;
self.replicate.from = function (url, opts, callback) {
return self.constructor.replicate(url, self, opts, callback);
};
PouchDB.adapters[opts.adapter].call(self, opts, function (err) {
if (err) {
return self.taskqueue.fail(err);
}
prepareForDestruction(self);
self.replicate.to = function (url, opts, callback) {
return self.constructor.replicate(self, url, opts, callback);
};
self.emit('created', self);
PouchDB.emit('created', self.name);
self.taskqueue.ready(self);
});
self.sync = function (dbName, opts, callback) {
return self.constructor.sync(self, dbName, opts, callback);
};
self.replicate.sync = self.sync;
PouchDB.adapters[opts.adapter].call(self, opts, function (err) {
/* istanbul ignore if */
if (err) {
self.taskqueue.fail(err);
callback(err);
return;
}
prepareForDestruction(self, opts);
self.emit('created', self);
PouchDB.emit('created', opts.originalName);
self.taskqueue.ready(self);
callback(null, self);
});
});
promise.then(function (resp) {
oldCB(null, resp);
}, oldCB);
self.then = promise.then.bind(promise);
self.catch = promise.catch.bind(promise);
}

@@ -1433,55 +1352,4 @@

PouchDB.parseAdapter = function (name, opts) {
var match = name.match(/([a-z\-]*):\/\/(.*)/);
var adapter, adapterName;
if (match) {
// the http adapter expects the fully qualified name
name = /http(s?)/.test(match[1]) ? match[1] + '://' + match[2] : match[2];
adapter = match[1];
/* istanbul ignore if */
if (!PouchDB.adapters[adapter].valid()) {
throw 'Invalid adapter';
}
return {name: name, adapter: match[1]};
}
// check for browsers that have been upgraded from websql-only to websql+idb
var skipIdb = 'idb' in PouchDB.adapters && 'websql' in PouchDB.adapters &&
pouchdbUtils.hasLocalStorage() &&
localStorage['_pouch__websqldb_' + PouchDB.prefix + name];
if (opts.adapter) {
adapterName = opts.adapter;
} else if (typeof opts !== 'undefined' && opts.db) {
adapterName = 'leveldb';
} else { // automatically determine adapter
for (var i = 0; i < PouchDB.preferredAdapters.length; ++i) {
adapterName = PouchDB.preferredAdapters[i];
if (adapterName in PouchDB.adapters) {
/* istanbul ignore if */
if (skipIdb && adapterName === 'idb') {
// log it, because this can be confusing during development
pouchdbUtils.guardedConsole('log', 'PouchDB is downgrading "' + name + '" to WebSQL to' +
' avoid data loss, because it was already opened with WebSQL.');
continue; // keep using websql to avoid user data loss
}
break;
}
}
}
adapter = PouchDB.adapters[adapterName];
// if adapter is invalid, then an error will be thrown later
var usePrefix = (adapter && 'use_prefix' in adapter) ?
adapter.use_prefix : true;
return {
name: usePrefix ? (PouchDB.prefix + name) : name,
adapter: adapterName
};
};
PouchDB.adapter = function (id, obj, addToPreferredAdapters) {
/* istanbul ignore else */
if (obj.valid()) {

@@ -1498,2 +1366,4 @@ PouchDB.adapters[id] = obj;

obj(PouchDB);
} else if (typeof obj !== 'object' || Object.keys(obj).length === 0){
throw new Error('Invalid plugin: object passed in is empty or not an object');
} else {

@@ -1508,18 +1378,17 @@ Object.keys(obj).forEach(function (id) { // object style for plugins

PouchDB.defaults = function (defaultOpts) {
function PouchAlt(name, opts, callback) {
function PouchAlt(name, opts) {
if (!(this instanceof PouchAlt)) {
return new PouchAlt(name, opts, callback);
return new PouchAlt(name, opts);
}
if (typeof opts === 'function' || typeof opts === 'undefined') {
callback = opts;
opts = {};
}
opts = opts || {};
if (name && typeof name === 'object') {
opts = name;
name = undefined;
name = opts.name;
delete opts.name;
}
opts = jsExtend.extend({}, defaultOpts, opts);
PouchDB.call(this, name, opts, callback);
PouchDB.call(this, name, opts);
}

@@ -1540,3 +1409,3 @@

// managed automatically by set-version.js
var version = "5.4.5";
var version = "6.0.0";

@@ -1543,0 +1412,0 @@ PouchDB.version = version;

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

@@ -21,7 +21,7 @@ "main": "./lib/index.js",

"js-extend": "1.0.1",
"pouchdb-collections": "1.0.1",
"pouchdb-errors": "5.4.5",
"pouchdb-merge": "5.4.5",
"pouchdb-promise": "5.4.5",
"pouchdb-utils": "5.4.5",
"pouchdb-collections": "6.0.0",
"pouchdb-errors": "6.0.0",
"pouchdb-merge": "6.0.0",
"pouchdb-promise": "6.0.0",
"pouchdb-utils": "6.0.0",
"scope-eval": "0.0.3"

@@ -28,0 +28,0 @@ },

import { extend } from 'js-extend';
import Promise from 'pouchdb-promise';
import { Map } from 'pouchdb-collections';
import getArguments from 'argsarray';
import { EventEmitter } from 'events';

@@ -9,3 +8,2 @@ import inherits from 'inherits';

import {
guardedConsole,
pick,

@@ -212,54 +210,24 @@ adapterFun,

AbstractPouchDB.prototype.put =
adapterFun('put', getArguments(function (args) {
var temp, temptype, opts, callback;
var warned = false;
var doc = args.shift();
var id = '_id' in doc;
AbstractPouchDB.prototype.put = adapterFun('put', function (doc, opts, cb) {
if (typeof opts === 'function') {
cb = opts;
opts = {};
}
if (typeof doc !== 'object' || Array.isArray(doc)) {
callback = args.pop();
return callback(createError(NOT_AN_OBJECT));
return cb(createError(NOT_AN_OBJECT));
}
function warn() {
if (warned) {
return;
}
guardedConsole('warn', 'db.put(doc, id, rev) has been deprecated and will be ' +
'removed in a future release, please use ' +
'db.put({_id: id, _rev: rev}) instead');
warned = true;
}
/* eslint no-constant-condition: 0 */
while (true) {
temp = args.shift();
temptype = typeof temp;
if (temptype === "string" && !id) {
warn();
doc._id = temp;
id = true;
} else if (temptype === "string" && id && !('_rev' in doc)) {
warn();
doc._rev = temp;
} else if (temptype === "object") {
opts = temp;
} else if (temptype === "function") {
callback = temp;
}
if (!args.length) {
break;
}
}
opts = opts || {};
invalidIdError(doc._id);
if (isLocalId(doc._id) && typeof this._putLocal === 'function') {
if (doc._deleted) {
return this._removeLocal(doc, callback);
return this._removeLocal(doc, cb);
} else {
return this._putLocal(doc, callback);
return this._putLocal(doc, cb);
}
}
this.bulkDocs({docs: [doc]}, opts, yankError(callback));
}));
if (typeof this._put === 'function' && opts.new_edits !== false) {
this._put(doc, opts, cb);
} else {
this.bulkDocs({docs: [doc]}, opts, yankError(cb));
}
});

@@ -531,15 +499,15 @@ AbstractPouchDB.prototype.putAttachment =

};
/* Begin api wrappers. Specific functionality to storage belongs in the
_[method] */
AbstractPouchDB.prototype.get =
adapterFun('get', function (id, opts, callback) {
AbstractPouchDB.prototype.get = adapterFun('get', function (id, opts, cb) {
if (typeof opts === 'function') {
callback = opts;
cb = opts;
opts = {};
}
if (typeof id !== 'string') {
return callback(createError(INVALID_ID));
return cb(createError(INVALID_ID));
}
if (isLocalId(id) && typeof this._getLocal === 'function') {
return this._getLocal(id, callback);
return this._getLocal(id, cb);
}

@@ -553,3 +521,3 @@ var leaves = [], self = this;

if (!count) {
return callback(null, result);
return cb(null, result);
}

@@ -570,3 +538,3 @@ // order with open_revs is unspecified

if (!count) {
callback(null, result);
cb(null, result);
}

@@ -581,3 +549,3 @@ });

if (err) {
return callback(err);
return cb(err);
}

@@ -596,3 +564,3 @@ leaves = collectLeaves(rev_tree).map(function (leaf) {

if (!(typeof (l) === "string" && /^\d+-/.test(l))) {
return callback(createError(INVALID_REV));
return cb(createError(INVALID_REV));
}

@@ -602,4 +570,3 @@ }

} else {
return callback(createError(UNKNOWN_ERROR,
'function_clause'));
return cb(createError(UNKNOWN_ERROR, 'function_clause'));
}

@@ -612,3 +579,3 @@ }

if (err) {
return callback(err);
return cb(err);
}

@@ -668,3 +635,3 @@

if (count === 0) {
return callback(null, doc);
return cb(null, doc);
}

@@ -685,3 +652,3 @@ Object.keys(attachments).forEach(function (key) {

if (!--count) {
callback(null, doc);
cb(null, doc);
}

@@ -699,3 +666,3 @@ });

}
callback(null, doc);
cb(null, doc);
}

@@ -709,4 +676,3 @@ });

AbstractPouchDB.prototype.getAttachment =
adapterFun('getAttachment', function (docId, attachmentId, opts,
callback) {
adapterFun('getAttachment', function (docId, attachmentId, opts, callback) {
var self = this;

@@ -776,4 +742,3 @@ if (opts instanceof Function) {

AbstractPouchDB.prototype.close =
adapterFun('close', function (callback) {
AbstractPouchDB.prototype.close = adapterFun('close', function (callback) {
this._closed = true;

@@ -790,3 +755,3 @@ return this._close(callback);

// assume we know better than the adapter, unless it informs us
info.db_name = info.db_name || self._db_name;
info.db_name = info.db_name || self.name;
info.auto_compaction = !!(self.auto_compaction && self.type() !== 'http');

@@ -802,4 +767,4 @@ info.adapter = self.type();

/* istanbul ignore next */
AbstractPouchDB.prototype.type = function () {
/* istanbul ignore next */
return (typeof this._type === 'function') ? this._type() : this.adapter;

@@ -806,0 +771,0 @@ };

@@ -72,5 +72,2 @@ import Promise from 'pouchdb-promise';

tryCatchInChangeListener(self, change);
if (self.startSeq && self.startSeq <= change.seq) {
self.startSeq = false;
}
};

@@ -100,4 +97,6 @@

if (!db.taskqueue.isReady) {
db.taskqueue.addTask(function () {
if (self.isCancelled) {
db.taskqueue.addTask(function (failed) {
if (failed) {
opts.complete(failed);
} else if (self.isCancelled) {
self.emit('cancel');

@@ -171,14 +170,2 @@ } else {

if (opts.continuous && opts.since !== 'now') {
this.db.info().then(function (info) {
self.startSeq = info.update_seq;
/* istanbul ignore next */
}, function (err) {
if (err.id === 'idbNull') {
// db closed before this returned thats ok
return;
}
throw err;
});
}

@@ -209,2 +196,3 @@ if (opts.view && !opts.filter) {

var newPromise = this.db._changes(opts);
/* istanbul ignore else */
if (newPromise && typeof newPromise.cancel === 'function') {

@@ -211,0 +199,0 @@ var cancel = self.cancel;

@@ -5,12 +5,5 @@ import debug from 'debug';

import TaskQueue from './taskqueue';
import Promise from 'pouchdb-promise';
import { clone, guardedConsole } from 'pouchdb-utils';
import { clone } from 'pouchdb-utils';
import parseAdapter from './parseAdapter';
function defaultCallback(err) {
/* istanbul ignore next */
if (err && global.debug) {
guardedConsole('error', err);
}
}
// OK, so here's the deal. Consider this code:

@@ -26,9 +19,8 @@ // var db1 = new PouchDB('foo');

// that may have been created with the same name.
function prepareForDestruction(self, opts) {
var name = opts.originalName;
var ctor = self.constructor;
var destructionListeners = ctor._destructionListeners;
function prepareForDestruction(self) {
var destructionListeners = self.constructor._destructionListeners;
function onDestroyed() {
ctor.emit('destroyed', name);
self.constructor.emit('destroyed', self.name);
}

@@ -44,138 +36,65 @@

// in setup.js, the constructor is primed to listen for destroy events
if (!destructionListeners.has(name)) {
destructionListeners.set(name, []);
if (!destructionListeners.has(self.name)) {
destructionListeners.set(self.name, []);
}
destructionListeners.get(name).push(onConstructorDestroyed);
destructionListeners.get(self.name).push(onConstructorDestroyed);
}
inherits(PouchDB, Adapter);
function PouchDB(name, opts, callback) {
function PouchDB(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, callback);
return new PouchDB(name, opts);
}
var self = this;
if (typeof opts === 'function' || typeof opts === 'undefined') {
callback = opts;
opts = {};
}
opts = opts || {};
if (name && typeof name === 'object') {
opts = name;
name = undefined;
name = opts.name;
delete opts.name;
}
if (typeof callback === 'undefined') {
callback = defaultCallback;
} else {
var oldCallback = callback;
callback = function () {
guardedConsole('warn', 'Using a callback for new PouchDB()' +
'is deprecated.');
return oldCallback.apply(null, arguments);
};
}
this.__opts = opts = clone(opts);
name = name || opts.name;
opts = clone(opts);
// if name was specified via opts, ignore for the sake of dependentDbs
delete opts.name;
this.__opts = opts;
var oldCB = callback;
self.auto_compaction = opts.auto_compaction;
self.prefix = PouchDB.prefix;
Adapter.call(self);
self.taskqueue = new TaskQueue();
var promise = new Promise(function (fulfill, reject) {
callback = function (err, resp) {
/* istanbul ignore if */
if (err) {
return reject(err);
}
delete resp.then;
fulfill(resp);
};
opts = clone(opts);
var backend, error;
(function () {
try {
if (typeof name !== 'string') {
throw new Error('Missing/invalid DB name');
}
if (typeof name !== 'string') {
error = new Error('Missing/invalid DB name');
error.code = 400;
throw error;
}
var prefixedName = (opts.prefix || '') + name;
var backend = parseAdapter(prefixedName, opts);
var prefixedName = (opts.prefix || '') + name;
backend = PouchDB.parseAdapter(prefixedName, opts);
opts.name = backend.name;
opts.adapter = opts.adapter || backend.adapter;
opts.originalName = name;
opts.name = backend.name;
opts.adapter = opts.adapter || backend.adapter;
self._adapter = opts.adapter;
debug('pouchdb:adapter')('Picked adapter: ' + opts.adapter);
self.name = name;
self._adapter = opts.adapter;
debug('pouchdb:adapter')('Picked adapter: ' + opts.adapter);
self._db_name = name;
if (!PouchDB.adapters[opts.adapter]) {
error = new Error('Adapter is missing');
error.code = 404;
throw error;
}
if (!PouchDB.adapters[opts.adapter] ||
!PouchDB.adapters[opts.adapter].valid()) {
throw new Error('Invalid Adapter: ' + opts.adapter);
}
/* istanbul ignore if */
if (!PouchDB.adapters[opts.adapter].valid()) {
error = new Error('Invalid Adapter');
error.code = 404;
throw error;
}
} catch (err) {
self.taskqueue.fail(err);
}
}());
if (error) {
return reject(error); // constructor error, see above
}
self.adapter = opts.adapter;
Adapter.call(self);
self.taskqueue = new TaskQueue();
// needs access to PouchDB;
self.replicate = {};
self.adapter = opts.adapter;
self.replicate.from = function (url, opts, callback) {
return self.constructor.replicate(url, self, opts, callback);
};
PouchDB.adapters[opts.adapter].call(self, opts, function (err) {
if (err) {
return self.taskqueue.fail(err);
}
prepareForDestruction(self);
self.replicate.to = function (url, opts, callback) {
return self.constructor.replicate(self, url, opts, callback);
};
self.emit('created', self);
PouchDB.emit('created', self.name);
self.taskqueue.ready(self);
});
self.sync = function (dbName, opts, callback) {
return self.constructor.sync(self, dbName, opts, callback);
};
self.replicate.sync = self.sync;
PouchDB.adapters[opts.adapter].call(self, opts, function (err) {
/* istanbul ignore if */
if (err) {
self.taskqueue.fail(err);
callback(err);
return;
}
prepareForDestruction(self, opts);
self.emit('created', self);
PouchDB.emit('created', opts.originalName);
self.taskqueue.ready(self);
callback(null, self);
});
});
promise.then(function (resp) {
oldCB(null, resp);
}, oldCB);
self.then = promise.then.bind(promise);
self.catch = promise.catch.bind(promise);
}

@@ -182,0 +101,0 @@

@@ -7,3 +7,2 @@ import { extend } from 'js-extend';

import { EventEmitter as EE } from 'events';
import { guardedConsole, hasLocalStorage } from 'pouchdb-utils';

@@ -37,55 +36,4 @@ PouchDB.adapters = {};

PouchDB.parseAdapter = function (name, opts) {
var match = name.match(/([a-z\-]*):\/\/(.*)/);
var adapter, adapterName;
if (match) {
// the http adapter expects the fully qualified name
name = /http(s?)/.test(match[1]) ? match[1] + '://' + match[2] : match[2];
adapter = match[1];
/* istanbul ignore if */
if (!PouchDB.adapters[adapter].valid()) {
throw 'Invalid adapter';
}
return {name: name, adapter: match[1]};
}
// check for browsers that have been upgraded from websql-only to websql+idb
var skipIdb = 'idb' in PouchDB.adapters && 'websql' in PouchDB.adapters &&
hasLocalStorage() &&
localStorage['_pouch__websqldb_' + PouchDB.prefix + name];
if (opts.adapter) {
adapterName = opts.adapter;
} else if (typeof opts !== 'undefined' && opts.db) {
adapterName = 'leveldb';
} else { // automatically determine adapter
for (var i = 0; i < PouchDB.preferredAdapters.length; ++i) {
adapterName = PouchDB.preferredAdapters[i];
if (adapterName in PouchDB.adapters) {
/* istanbul ignore if */
if (skipIdb && adapterName === 'idb') {
// log it, because this can be confusing during development
guardedConsole('log', 'PouchDB is downgrading "' + name + '" to WebSQL to' +
' avoid data loss, because it was already opened with WebSQL.');
continue; // keep using websql to avoid user data loss
}
break;
}
}
}
adapter = PouchDB.adapters[adapterName];
// if adapter is invalid, then an error will be thrown later
var usePrefix = (adapter && 'use_prefix' in adapter) ?
adapter.use_prefix : true;
return {
name: usePrefix ? (PouchDB.prefix + name) : name,
adapter: adapterName
};
};
PouchDB.adapter = function (id, obj, addToPreferredAdapters) {
/* istanbul ignore else */
if (obj.valid()) {

@@ -102,2 +50,4 @@ PouchDB.adapters[id] = obj;

obj(PouchDB);
} else if (typeof obj !== 'object' || Object.keys(obj).length === 0){
throw new Error('Invalid plugin: object passed in is empty or not an object');
} else {

@@ -112,18 +62,17 @@ Object.keys(obj).forEach(function (id) { // object style for plugins

PouchDB.defaults = function (defaultOpts) {
function PouchAlt(name, opts, callback) {
function PouchAlt(name, opts) {
if (!(this instanceof PouchAlt)) {
return new PouchAlt(name, opts, callback);
return new PouchAlt(name, opts);
}
if (typeof opts === 'function' || typeof opts === 'undefined') {
callback = opts;
opts = {};
}
opts = opts || {};
if (name && typeof name === 'object') {
opts = name;
name = undefined;
name = opts.name;
delete opts.name;
}
opts = extend({}, defaultOpts, opts);
PouchDB.call(this, name, opts, callback);
PouchDB.call(this, name, opts);
}

@@ -130,0 +79,0 @@

// managed automatically by set-version.js
export default "5.4.5";
export default "6.0.0";
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