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.4.1 to 6.4.2

153

lib/index.es.js

@@ -1,9 +0,9 @@

import { adapterFun, assign, bulkGetShim, clone, guardedConsole, hasLocalStorage, invalidIdError, isRemote, listenerCount, nextTick, once, pick, rev, upsert } from 'pouchdb-utils';
import { Map } from 'pouchdb-collections';
import Promise from 'pouchdb-promise';
import getArguments from 'argsarray';
import { clone, listenerCount, once, guardedConsole, rev, isRemote, pick, adapterFun, upsert, bulkGetShim, invalidIdError, nextTick, hasLocalStorage, assign } from 'pouchdb-utils';
import { isDeleted, collectLeaves, collectConflicts, traverseRevTree, rootToLeaf, isLocalId } from 'pouchdb-merge';
import inherits from 'inherits';
import Promise from 'pouchdb-promise';
import { EventEmitter } from 'events';
import getArguments from 'argsarray';
import { collectConflicts, collectLeaves, isDeleted, isLocalId, rootToLeaf, traverseRevTree } from 'pouchdb-merge';
import { BAD_REQUEST, INVALID_ID, INVALID_REV, MISSING_BULK_DOCS, MISSING_DOC, NOT_AN_OBJECT, QUERY_PARSE_ERROR, REV_CONFLICT, UNKNOWN_ERROR, createError } from 'pouchdb-errors';
import { Map } from 'pouchdb-collections';
import { MISSING_BULK_DOCS, MISSING_DOC, REV_CONFLICT, INVALID_ID, UNKNOWN_ERROR, QUERY_PARSE_ERROR, BAD_REQUEST, NOT_AN_OBJECT, INVALID_REV, createError } from 'pouchdb-errors';
import pouchDebug from 'pouchdb-debug';

@@ -128,4 +128,4 @@ import pouchChangesFilter from 'pouchdb-changes-filter';

/* istanbul ignore else */
if (PouchDB$2._changesFilterPlugin) {
PouchDB$2._changesFilterPlugin.validate(opts, function (err) {
if (PouchDB._changesFilterPlugin) {
PouchDB._changesFilterPlugin.validate(opts, function (err) {
if (err) {

@@ -171,6 +171,6 @@ return callback(err);

/* istanbul ignore else */
if (PouchDB$2._changesFilterPlugin) {
PouchDB$2._changesFilterPlugin.normalize(opts);
if (PouchDB$2._changesFilterPlugin.shouldFilter(this, opts)) {
return PouchDB$2._changesFilterPlugin.filter(this, opts);
if (PouchDB._changesFilterPlugin) {
PouchDB._changesFilterPlugin.normalize(opts);
if (PouchDB._changesFilterPlugin.shouldFilter(this, opts)) {
return PouchDB._changesFilterPlugin.filter(this, opts);
}

@@ -264,10 +264,10 @@ } else {

traverseRevTree(revs, function (isLeaf, pos, id, prnt) {
var rev$$1 = pos + "-" + id;
var rev = pos + "-" + id;
if (isLeaf) {
height[rev$$1] = 0;
height[rev] = 0;
}
if (prnt !== undefined) {
edges.push({from: prnt, to: rev$$1});
edges.push({from: prnt, to: rev});
}
return rev$$1;
return rev;
});

@@ -292,2 +292,3 @@

opts.skip = 0;
delete opts.limit;
if (opts.descending) {

@@ -406,3 +407,3 @@ keys.reverse();

AbstractPouchDB.prototype.putAttachment =
adapterFun('putAttachment', function (docId, attachmentId, rev$$1,
adapterFun('putAttachment', function (docId, attachmentId, rev,
blob, type) {

@@ -412,4 +413,4 @@ var api = this;

type = blob;
blob = rev$$1;
rev$$1 = null;
blob = rev;
rev = null;
}

@@ -420,4 +421,4 @@ // Lets fix in https://github.com/pouchdb/pouchdb/issues/3267

type = blob;
blob = rev$$1;
rev$$1 = null;
blob = rev;
rev = null;
}

@@ -440,3 +441,3 @@ if (!type) {

return api.get(docId).then(function (doc) {
if (doc._rev !== rev$$1) {
if (doc._rev !== rev) {
throw createError(REV_CONFLICT);

@@ -458,3 +459,3 @@ }

AbstractPouchDB.prototype.removeAttachment =
adapterFun('removeAttachment', function (docId, attachmentId, rev$$1,
adapterFun('removeAttachment', function (docId, attachmentId, rev,
callback) {

@@ -468,3 +469,3 @@ var self = this;

}
if (obj._rev !== rev$$1) {
if (obj._rev !== rev) {
callback(createError(REV_CONFLICT));

@@ -546,4 +547,4 @@ return;

opts) {
var rev$$1 = pos + '-' + revHash;
var idx = missingForId.indexOf(rev$$1);
var rev = pos + '-' + revHash;
var idx = missingForId.indexOf(rev);
if (idx === -1) {

@@ -556,3 +557,3 @@ return;

if (opts.status !== 'available') {
addToMissing(id, rev$$1);
addToMissing(id, rev);
}

@@ -563,4 +564,4 @@ });

// revisions that were not found in the tree
missingForId.forEach(function (rev$$1) {
addToMissing(id, rev$$1);
missingForId.forEach(function (rev) {
addToMissing(id, rev);
});

@@ -618,5 +619,5 @@ }

var revs = [];
Object.keys(height).forEach(function (rev$$1) {
if (height[rev$$1] > maxHeight) {
candidates.push(rev$$1);
Object.keys(height).forEach(function (rev) {
if (height[rev] > maxHeight) {
candidates.push(rev);
}

@@ -626,5 +627,5 @@ });

traverseRevTree(revTree, function (isLeaf, pos, revHash, ctx, opts) {
var rev$$1 = pos + '-' + revHash;
if (opts.status === 'available' && candidates.indexOf(rev$$1) !== -1) {
revs.push(rev$$1);
var rev = pos + '-' + revHash;
if (opts.status === 'available' && candidates.indexOf(rev) !== -1) {
revs.push(rev);
}

@@ -818,4 +819,4 @@ });

start: (path.pos + path.ids.length) - 1,
ids: path.ids.map(function (rev$$1) {
return rev$$1.id;
ids: path.ids.map(function (rev) {
return rev.id;
})

@@ -826,7 +827,7 @@ };

var pos = path.pos + path.ids.length;
doc._revs_info = path.ids.map(function (rev$$1) {
doc._revs_info = path.ids.map(function (rev) {
pos--;
return {
rev: pos + '-' + rev$$1.id,
status: rev$$1.opts.status
rev: pos + '-' + rev.id,
status: rev.opts.status
};

@@ -1178,5 +1179,5 @@ });

var adapters = PouchDB$2.adapters;
var preferredAdapters = PouchDB$2.preferredAdapters;
var prefix = PouchDB$2.prefix;
var adapters = PouchDB.adapters;
var preferredAdapters = PouchDB.preferredAdapters;
var prefix = PouchDB.prefix;
var adapterName = opts.adapter;

@@ -1241,8 +1242,8 @@

inherits(PouchDB$2, AbstractPouchDB);
function PouchDB$2(name, opts) {
inherits(PouchDB, AbstractPouchDB);
function PouchDB(name, opts) {
// In Node our test suite only tests this for PouchAlt unfortunately
/* istanbul ignore if */
if (!(this instanceof PouchDB$2)) {
return new PouchDB$2(name, opts);
if (!(this instanceof PouchDB)) {
return new PouchDB(name, opts);
}

@@ -1262,3 +1263,3 @@

self.auto_compaction = opts.auto_compaction;
self.prefix = PouchDB$2.prefix;
self.prefix = PouchDB.prefix;

@@ -1277,6 +1278,6 @@ if (typeof name !== 'string') {

self._adapter = opts.adapter;
PouchDB$2.emit('debug', ['adapter', 'Picked adapter: ', opts.adapter]);
PouchDB.emit('debug', ['adapter', 'Picked adapter: ', opts.adapter]);
if (!PouchDB$2.adapters[opts.adapter] ||
!PouchDB$2.adapters[opts.adapter].valid()) {
if (!PouchDB.adapters[opts.adapter] ||
!PouchDB.adapters[opts.adapter].valid()) {
throw new Error('Invalid Adapter: ' + opts.adapter);

@@ -1290,3 +1291,3 @@ }

PouchDB$2.adapters[opts.adapter].call(self, opts, function (err) {
PouchDB.adapters[opts.adapter].call(self, opts, function (err) {
if (err) {

@@ -1298,3 +1299,3 @@ return self.taskqueue.fail(err);

self.emit('created', self);
PouchDB$2.emit('created', self.name);
PouchDB.emit('created', self.name);
self.taskqueue.ready(self);

@@ -1305,6 +1306,6 @@ });

PouchDB$2.adapters = {};
PouchDB$2.preferredAdapters = [];
PouchDB.adapters = {};
PouchDB.preferredAdapters = [];
PouchDB$2.prefix = '_pouch_';
PouchDB.prefix = '_pouch_';

@@ -1362,10 +1363,10 @@ var eventEmitter = new EventEmitter();

setUpEventEmitter(PouchDB$2);
setUpEventEmitter(PouchDB);
PouchDB$2.adapter = function (id, obj, addToPreferredAdapters) {
PouchDB.adapter = function (id, obj, addToPreferredAdapters) {
/* istanbul ignore else */
if (obj.valid()) {
PouchDB$2.adapters[id] = obj;
PouchDB.adapters[id] = obj;
if (addToPreferredAdapters) {
PouchDB$2.preferredAdapters.push(id);
PouchDB.preferredAdapters.push(id);
}

@@ -1375,5 +1376,5 @@ }

PouchDB$2.plugin = function (obj) {
PouchDB.plugin = function (obj) {
if (typeof obj === 'function') { // function style for plugins
obj(PouchDB$2);
obj(PouchDB);
} else if (typeof obj !== 'object' || Object.keys(obj).length === 0) {

@@ -1383,12 +1384,12 @@ throw new Error('Invalid plugin: got "' + obj + '", expected an object or a function');

Object.keys(obj).forEach(function (id) { // object style for plugins
PouchDB$2.prototype[id] = obj[id];
PouchDB.prototype[id] = obj[id];
});
}
if (this.__defaults) {
PouchDB$2.__defaults = assign({}, this.__defaults);
PouchDB.__defaults = assign({}, this.__defaults);
}
return PouchDB$2;
return PouchDB;
};
PouchDB$2.defaults = function (defaultOpts) {
PouchDB.defaults = function (defaultOpts) {
function PouchAlt(name, opts) {

@@ -1408,11 +1409,11 @@ if (!(this instanceof PouchAlt)) {

opts = assign({}, PouchAlt.__defaults, opts);
PouchDB$2.call(this, name, opts);
PouchDB.call(this, name, opts);
}
inherits(PouchAlt, PouchDB$2);
inherits(PouchAlt, PouchDB);
PouchAlt.preferredAdapters = PouchDB$2.preferredAdapters.slice();
Object.keys(PouchDB$2).forEach(function (key) {
PouchAlt.preferredAdapters = PouchDB.preferredAdapters.slice();
Object.keys(PouchDB).forEach(function (key) {
if (!(key in PouchAlt)) {
PouchAlt[key] = PouchDB$2[key];
PouchAlt[key] = PouchDB[key];
}

@@ -1429,12 +1430,12 @@ });

// managed automatically by set-version.js
var version = "6.4.1";
var version = "6.4.2";
// TODO: remove from pouchdb-core (breaking)
PouchDB$2.plugin(pouchDebug);
PouchDB.plugin(pouchDebug);
// TODO: remove from pouchdb-core (breaking)
PouchDB$2.plugin(pouchChangesFilter);
PouchDB.plugin(pouchChangesFilter);
PouchDB$2.version = version;
PouchDB.version = version;
export default PouchDB$2;
export default PouchDB;

@@ -5,9 +5,9 @@ 'use strict';

var Promise = _interopDefault(require('pouchdb-promise'));
var getArguments = _interopDefault(require('argsarray'));
var pouchdbUtils = require('pouchdb-utils');
var pouchdbCollections = require('pouchdb-collections');
var pouchdbMerge = require('pouchdb-merge');
var inherits = _interopDefault(require('inherits'));
var Promise = _interopDefault(require('pouchdb-promise'));
var events = require('events');
var getArguments = _interopDefault(require('argsarray'));
var pouchdbMerge = require('pouchdb-merge');
var pouchdbCollections = require('pouchdb-collections');
var pouchdbErrors = require('pouchdb-errors');

@@ -133,4 +133,4 @@ var pouchDebug = _interopDefault(require('pouchdb-debug'));

/* istanbul ignore else */
if (PouchDB$2._changesFilterPlugin) {
PouchDB$2._changesFilterPlugin.validate(opts, function (err) {
if (PouchDB._changesFilterPlugin) {
PouchDB._changesFilterPlugin.validate(opts, function (err) {
if (err) {

@@ -176,6 +176,6 @@ return callback(err);

/* istanbul ignore else */
if (PouchDB$2._changesFilterPlugin) {
PouchDB$2._changesFilterPlugin.normalize(opts);
if (PouchDB$2._changesFilterPlugin.shouldFilter(this, opts)) {
return PouchDB$2._changesFilterPlugin.filter(this, opts);
if (PouchDB._changesFilterPlugin) {
PouchDB._changesFilterPlugin.normalize(opts);
if (PouchDB._changesFilterPlugin.shouldFilter(this, opts)) {
return PouchDB._changesFilterPlugin.filter(this, opts);
}

@@ -269,10 +269,10 @@ } else {

pouchdbMerge.traverseRevTree(revs, function (isLeaf, pos, id, prnt) {
var rev$$1 = pos + "-" + id;
var rev = pos + "-" + id;
if (isLeaf) {
height[rev$$1] = 0;
height[rev] = 0;
}
if (prnt !== undefined) {
edges.push({from: prnt, to: rev$$1});
edges.push({from: prnt, to: rev});
}
return rev$$1;
return rev;
});

@@ -297,2 +297,3 @@

opts.skip = 0;
delete opts.limit;
if (opts.descending) {

@@ -411,3 +412,3 @@ keys.reverse();

AbstractPouchDB.prototype.putAttachment =
pouchdbUtils.adapterFun('putAttachment', function (docId, attachmentId, rev$$1,
pouchdbUtils.adapterFun('putAttachment', function (docId, attachmentId, rev,
blob, type) {

@@ -417,4 +418,4 @@ var api = this;

type = blob;
blob = rev$$1;
rev$$1 = null;
blob = rev;
rev = null;
}

@@ -425,4 +426,4 @@ // Lets fix in https://github.com/pouchdb/pouchdb/issues/3267

type = blob;
blob = rev$$1;
rev$$1 = null;
blob = rev;
rev = null;
}

@@ -445,3 +446,3 @@ if (!type) {

return api.get(docId).then(function (doc) {
if (doc._rev !== rev$$1) {
if (doc._rev !== rev) {
throw pouchdbErrors.createError(pouchdbErrors.REV_CONFLICT);

@@ -463,3 +464,3 @@ }

AbstractPouchDB.prototype.removeAttachment =
pouchdbUtils.adapterFun('removeAttachment', function (docId, attachmentId, rev$$1,
pouchdbUtils.adapterFun('removeAttachment', function (docId, attachmentId, rev,
callback) {

@@ -473,3 +474,3 @@ var self = this;

}
if (obj._rev !== rev$$1) {
if (obj._rev !== rev) {
callback(pouchdbErrors.createError(pouchdbErrors.REV_CONFLICT));

@@ -551,4 +552,4 @@ return;

opts) {
var rev$$1 = pos + '-' + revHash;
var idx = missingForId.indexOf(rev$$1);
var rev = pos + '-' + revHash;
var idx = missingForId.indexOf(rev);
if (idx === -1) {

@@ -561,3 +562,3 @@ return;

if (opts.status !== 'available') {
addToMissing(id, rev$$1);
addToMissing(id, rev);
}

@@ -568,4 +569,4 @@ });

// revisions that were not found in the tree
missingForId.forEach(function (rev$$1) {
addToMissing(id, rev$$1);
missingForId.forEach(function (rev) {
addToMissing(id, rev);
});

@@ -623,5 +624,5 @@ }

var revs = [];
Object.keys(height).forEach(function (rev$$1) {
if (height[rev$$1] > maxHeight) {
candidates.push(rev$$1);
Object.keys(height).forEach(function (rev) {
if (height[rev] > maxHeight) {
candidates.push(rev);
}

@@ -631,5 +632,5 @@ });

pouchdbMerge.traverseRevTree(revTree, function (isLeaf, pos, revHash, ctx, opts) {
var rev$$1 = pos + '-' + revHash;
if (opts.status === 'available' && candidates.indexOf(rev$$1) !== -1) {
revs.push(rev$$1);
var rev = pos + '-' + revHash;
if (opts.status === 'available' && candidates.indexOf(rev) !== -1) {
revs.push(rev);
}

@@ -823,4 +824,4 @@ });

start: (path.pos + path.ids.length) - 1,
ids: path.ids.map(function (rev$$1) {
return rev$$1.id;
ids: path.ids.map(function (rev) {
return rev.id;
})

@@ -831,7 +832,7 @@ };

var pos = path.pos + path.ids.length;
doc._revs_info = path.ids.map(function (rev$$1) {
doc._revs_info = path.ids.map(function (rev) {
pos--;
return {
rev: pos + '-' + rev$$1.id,
status: rev$$1.opts.status
rev: pos + '-' + rev.id,
status: rev.opts.status
};

@@ -1183,5 +1184,5 @@ });

var adapters = PouchDB$2.adapters;
var preferredAdapters = PouchDB$2.preferredAdapters;
var prefix = PouchDB$2.prefix;
var adapters = PouchDB.adapters;
var preferredAdapters = PouchDB.preferredAdapters;
var prefix = PouchDB.prefix;
var adapterName = opts.adapter;

@@ -1246,8 +1247,8 @@

inherits(PouchDB$2, AbstractPouchDB);
function PouchDB$2(name, opts) {
inherits(PouchDB, AbstractPouchDB);
function PouchDB(name, opts) {
// In Node our test suite only tests this for PouchAlt unfortunately
/* istanbul ignore if */
if (!(this instanceof PouchDB$2)) {
return new PouchDB$2(name, opts);
if (!(this instanceof PouchDB)) {
return new PouchDB(name, opts);
}

@@ -1267,3 +1268,3 @@

self.auto_compaction = opts.auto_compaction;
self.prefix = PouchDB$2.prefix;
self.prefix = PouchDB.prefix;

@@ -1282,6 +1283,6 @@ if (typeof name !== 'string') {

self._adapter = opts.adapter;
PouchDB$2.emit('debug', ['adapter', 'Picked adapter: ', opts.adapter]);
PouchDB.emit('debug', ['adapter', 'Picked adapter: ', opts.adapter]);
if (!PouchDB$2.adapters[opts.adapter] ||
!PouchDB$2.adapters[opts.adapter].valid()) {
if (!PouchDB.adapters[opts.adapter] ||
!PouchDB.adapters[opts.adapter].valid()) {
throw new Error('Invalid Adapter: ' + opts.adapter);

@@ -1295,3 +1296,3 @@ }

PouchDB$2.adapters[opts.adapter].call(self, opts, function (err) {
PouchDB.adapters[opts.adapter].call(self, opts, function (err) {
if (err) {

@@ -1303,3 +1304,3 @@ return self.taskqueue.fail(err);

self.emit('created', self);
PouchDB$2.emit('created', self.name);
PouchDB.emit('created', self.name);
self.taskqueue.ready(self);

@@ -1310,6 +1311,6 @@ });

PouchDB$2.adapters = {};
PouchDB$2.preferredAdapters = [];
PouchDB.adapters = {};
PouchDB.preferredAdapters = [];
PouchDB$2.prefix = '_pouch_';
PouchDB.prefix = '_pouch_';

@@ -1367,10 +1368,10 @@ var eventEmitter = new events.EventEmitter();

setUpEventEmitter(PouchDB$2);
setUpEventEmitter(PouchDB);
PouchDB$2.adapter = function (id, obj, addToPreferredAdapters) {
PouchDB.adapter = function (id, obj, addToPreferredAdapters) {
/* istanbul ignore else */
if (obj.valid()) {
PouchDB$2.adapters[id] = obj;
PouchDB.adapters[id] = obj;
if (addToPreferredAdapters) {
PouchDB$2.preferredAdapters.push(id);
PouchDB.preferredAdapters.push(id);
}

@@ -1380,5 +1381,5 @@ }

PouchDB$2.plugin = function (obj) {
PouchDB.plugin = function (obj) {
if (typeof obj === 'function') { // function style for plugins
obj(PouchDB$2);
obj(PouchDB);
} else if (typeof obj !== 'object' || Object.keys(obj).length === 0) {

@@ -1388,12 +1389,12 @@ throw new Error('Invalid plugin: got "' + obj + '", expected an object or a function');

Object.keys(obj).forEach(function (id) { // object style for plugins
PouchDB$2.prototype[id] = obj[id];
PouchDB.prototype[id] = obj[id];
});
}
if (this.__defaults) {
PouchDB$2.__defaults = pouchdbUtils.assign({}, this.__defaults);
PouchDB.__defaults = pouchdbUtils.assign({}, this.__defaults);
}
return PouchDB$2;
return PouchDB;
};
PouchDB$2.defaults = function (defaultOpts) {
PouchDB.defaults = function (defaultOpts) {
function PouchAlt(name, opts) {

@@ -1413,11 +1414,11 @@ if (!(this instanceof PouchAlt)) {

opts = pouchdbUtils.assign({}, PouchAlt.__defaults, opts);
PouchDB$2.call(this, name, opts);
PouchDB.call(this, name, opts);
}
inherits(PouchAlt, PouchDB$2);
inherits(PouchAlt, PouchDB);
PouchAlt.preferredAdapters = PouchDB$2.preferredAdapters.slice();
Object.keys(PouchDB$2).forEach(function (key) {
PouchAlt.preferredAdapters = PouchDB.preferredAdapters.slice();
Object.keys(PouchDB).forEach(function (key) {
if (!(key in PouchAlt)) {
PouchAlt[key] = PouchDB$2[key];
PouchAlt[key] = PouchDB[key];
}

@@ -1434,12 +1435,12 @@ });

// managed automatically by set-version.js
var version = "6.4.1";
var version = "6.4.2";
// TODO: remove from pouchdb-core (breaking)
PouchDB$2.plugin(pouchDebug);
PouchDB.plugin(pouchDebug);
// TODO: remove from pouchdb-core (breaking)
PouchDB$2.plugin(pouchChangesFilter);
PouchDB.plugin(pouchChangesFilter);
PouchDB$2.version = version;
PouchDB.version = version;
module.exports = PouchDB$2;
module.exports = PouchDB;
{
"name": "pouchdb-core",
"version": "6.4.1",
"version": "6.4.2",
"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.4.1",
"pouchdb-collections": "6.4.1",
"pouchdb-debug": "6.4.1",
"pouchdb-errors": "6.4.1",
"pouchdb-merge": "6.4.1",
"pouchdb-promise": "6.4.1",
"pouchdb-utils": "6.4.1"
"pouchdb-changes-filter": "6.4.2",
"pouchdb-collections": "6.4.2",
"pouchdb-debug": "6.4.2",
"pouchdb-errors": "6.4.2",
"pouchdb-merge": "6.4.2",
"pouchdb-promise": "6.4.2",
"pouchdb-utils": "6.4.2"
},

@@ -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