Socket
Socket
Sign inDemoInstall

pouchdb-utils

Package Overview
Dependencies
Maintainers
9
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pouchdb-utils - npm Package Compare versions

Comparing version 7.3.1 to 8.0.0

154

lib/index-browser.es.js

@@ -1,4 +0,2 @@

import getArguments from 'argsarray';
import { Map } from 'pouchdb-collections';
import inherits from 'inherits';
import immediate from 'immediate';

@@ -106,3 +104,3 @@ import { createError, BAD_REQUEST, INVALID_ID, MISSING_ID, RESERVED_ID } from 'pouchdb-errors';

var called = false;
return getArguments(function (args) {
return function (...args) {
/* istanbul ignore if */

@@ -116,3 +114,3 @@ if (called) {

}
});
};
}

@@ -122,3 +120,3 @@

//create the function we will be returning
return getArguments(function (args) {
return function (...args) {
// Clone arguments

@@ -157,3 +155,3 @@ args = clone(args);

return promise;
});
};
}

@@ -184,3 +182,3 @@

function adapterFun(name, callback) {
return toPromise(getArguments(function (args) {
return toPromise(function (...args) {
if (this._closed) {

@@ -206,3 +204,3 @@ return Promise.reject(new Error('database is closed'));

return callback.apply(this, args);
}));
});
}

@@ -368,87 +366,77 @@

inherits(Changes, EventEmitter);
/* istanbul ignore next */
function attachBrowserEvents(self) {
if (hasLocalStorage()) {
addEventListener("storage", function (e) {
self.emit(e.key);
});
class Changes extends EventEmitter {
constructor() {
super();
this._listeners = {};
if (hasLocalStorage()) {
addEventListener("storage", function (e) {
this.emit(e.key);
});
}
}
}
function Changes() {
EventEmitter.call(this);
this._listeners = {};
attachBrowserEvents(this);
}
Changes.prototype.addListener = function (dbName, id, db, opts) {
/* istanbul ignore if */
if (this._listeners[id]) {
return;
}
var self = this;
var inprogress = false;
function eventFunction() {
/* istanbul ignore if */
if (!self._listeners[id]) {
addListener(dbName, id, db, opts) {
if (this._listeners[id]) {
return;
}
if (inprogress) {
inprogress = 'waiting';
var inprogress = false;
var self = this;
function eventFunction() {
if (!self._listeners[id]) {
return;
}
if (inprogress) {
inprogress = 'waiting';
return;
}
inprogress = true;
var changesOpts = pick(opts, [
'style', 'include_docs', 'attachments', 'conflicts', 'filter',
'doc_ids', 'view', 'since', 'query_params', 'binary', 'return_docs'
]);
function onError() {
inprogress = false;
}
db.changes(changesOpts).on('change', function (c) {
if (c.seq > opts.since && !opts.cancelled) {
opts.since = c.seq;
opts.onChange(c);
}
}).on('complete', function () {
if (inprogress === 'waiting') {
immediate(eventFunction);
}
inprogress = false;
}).on('error', onError);
}
this._listeners[id] = eventFunction;
this.on(dbName, eventFunction);
}
removeListener(dbName, id) {
if (!(id in this._listeners)) {
return;
}
inprogress = true;
var changesOpts = pick(opts, [
'style', 'include_docs', 'attachments', 'conflicts', 'filter',
'doc_ids', 'view', 'since', 'query_params', 'binary', 'return_docs'
]);
/* istanbul ignore next */
function onError() {
inprogress = false;
super.removeListener(dbName, this._listeners[id]);
delete this._listeners[id];
}
notifyLocalWindows(dbName) {
//do a useless change on a storage thing
//in order to get other windows's listeners to activate
if (hasLocalStorage()) {
localStorage[dbName] = (localStorage[dbName] === "a") ? "b" : "a";
}
db.changes(changesOpts).on('change', function (c) {
if (c.seq > opts.since && !opts.cancelled) {
opts.since = c.seq;
opts.onChange(c);
}
}).on('complete', function () {
if (inprogress === 'waiting') {
immediate(eventFunction);
}
inprogress = false;
}).on('error', onError);
}
this._listeners[id] = eventFunction;
this.on(dbName, eventFunction);
};
Changes.prototype.removeListener = function (dbName, id) {
/* istanbul ignore if */
if (!(id in this._listeners)) {
return;
notify(dbName) {
this.emit(dbName);
this.notifyLocalWindows(dbName);
}
EventEmitter.prototype.removeListener.call(this, dbName,
this._listeners[id]);
delete this._listeners[id];
};
}
/* istanbul ignore next */
Changes.prototype.notifyLocalWindows = function (dbName) {
//do a useless change on a storage thing
//in order to get other windows's listeners to activate
if (hasLocalStorage()) {
localStorage[dbName] = (localStorage[dbName] === "a") ? "b" : "a";
}
};
Changes.prototype.notify = function (dbName) {
this.emit(dbName);
this.notifyLocalWindows(dbName);
};
function guardedConsole(method) {

@@ -455,0 +443,0 @@ /* istanbul ignore else */

@@ -7,5 +7,3 @@ 'use strict';

var getArguments = _interopDefault(require('argsarray'));
var pouchdbCollections = require('pouchdb-collections');
var inherits = _interopDefault(require('inherits'));
var immediate = _interopDefault(require('immediate'));

@@ -113,3 +111,3 @@ var pouchdbErrors = require('pouchdb-errors');

var called = false;
return getArguments(function (args) {
return function (...args) {
/* istanbul ignore if */

@@ -123,3 +121,3 @@ if (called) {

}
});
};
}

@@ -129,3 +127,3 @@

//create the function we will be returning
return getArguments(function (args) {
return function (...args) {
// Clone arguments

@@ -164,3 +162,3 @@ args = clone(args);

return promise;
});
};
}

@@ -191,3 +189,3 @@

function adapterFun(name, callback) {
return toPromise(getArguments(function (args) {
return toPromise(function (...args) {
if (this._closed) {

@@ -213,3 +211,3 @@ return Promise.reject(new Error('database is closed'));

return callback.apply(this, args);
}));
});
}

@@ -375,87 +373,77 @@

inherits(Changes, EventEmitter);
/* istanbul ignore next */
function attachBrowserEvents(self) {
if (hasLocalStorage()) {
addEventListener("storage", function (e) {
self.emit(e.key);
});
class Changes extends EventEmitter {
constructor() {
super();
this._listeners = {};
if (hasLocalStorage()) {
addEventListener("storage", function (e) {
this.emit(e.key);
});
}
}
}
function Changes() {
EventEmitter.call(this);
this._listeners = {};
attachBrowserEvents(this);
}
Changes.prototype.addListener = function (dbName, id, db, opts) {
/* istanbul ignore if */
if (this._listeners[id]) {
return;
}
var self = this;
var inprogress = false;
function eventFunction() {
/* istanbul ignore if */
if (!self._listeners[id]) {
addListener(dbName, id, db, opts) {
if (this._listeners[id]) {
return;
}
if (inprogress) {
inprogress = 'waiting';
var inprogress = false;
var self = this;
function eventFunction() {
if (!self._listeners[id]) {
return;
}
if (inprogress) {
inprogress = 'waiting';
return;
}
inprogress = true;
var changesOpts = pick(opts, [
'style', 'include_docs', 'attachments', 'conflicts', 'filter',
'doc_ids', 'view', 'since', 'query_params', 'binary', 'return_docs'
]);
function onError() {
inprogress = false;
}
db.changes(changesOpts).on('change', function (c) {
if (c.seq > opts.since && !opts.cancelled) {
opts.since = c.seq;
opts.onChange(c);
}
}).on('complete', function () {
if (inprogress === 'waiting') {
immediate(eventFunction);
}
inprogress = false;
}).on('error', onError);
}
this._listeners[id] = eventFunction;
this.on(dbName, eventFunction);
}
removeListener(dbName, id) {
if (!(id in this._listeners)) {
return;
}
inprogress = true;
var changesOpts = pick(opts, [
'style', 'include_docs', 'attachments', 'conflicts', 'filter',
'doc_ids', 'view', 'since', 'query_params', 'binary', 'return_docs'
]);
/* istanbul ignore next */
function onError() {
inprogress = false;
super.removeListener(dbName, this._listeners[id]);
delete this._listeners[id];
}
notifyLocalWindows(dbName) {
//do a useless change on a storage thing
//in order to get other windows's listeners to activate
if (hasLocalStorage()) {
localStorage[dbName] = (localStorage[dbName] === "a") ? "b" : "a";
}
db.changes(changesOpts).on('change', function (c) {
if (c.seq > opts.since && !opts.cancelled) {
opts.since = c.seq;
opts.onChange(c);
}
}).on('complete', function () {
if (inprogress === 'waiting') {
immediate(eventFunction);
}
inprogress = false;
}).on('error', onError);
}
this._listeners[id] = eventFunction;
this.on(dbName, eventFunction);
};
Changes.prototype.removeListener = function (dbName, id) {
/* istanbul ignore if */
if (!(id in this._listeners)) {
return;
notify(dbName) {
this.emit(dbName);
this.notifyLocalWindows(dbName);
}
EventEmitter.prototype.removeListener.call(this, dbName,
this._listeners[id]);
delete this._listeners[id];
};
}
/* istanbul ignore next */
Changes.prototype.notifyLocalWindows = function (dbName) {
//do a useless change on a storage thing
//in order to get other windows's listeners to activate
if (hasLocalStorage()) {
localStorage[dbName] = (localStorage[dbName] === "a") ? "b" : "a";
}
};
Changes.prototype.notify = function (dbName) {
this.emit(dbName);
this.notifyLocalWindows(dbName);
};
function guardedConsole(method) {

@@ -462,0 +450,0 @@ /* istanbul ignore else */

import cloneBuffer from 'clone-buffer';
import getArguments from 'argsarray';
import { Map } from 'pouchdb-collections';
import inherits from 'inherits';
import { createError, BAD_REQUEST, INVALID_ID, MISSING_ID, RESERVED_ID } from 'pouchdb-errors';

@@ -79,3 +77,3 @@ import EventEmitter from 'events';

var called = false;
return getArguments(function (args) {
return function (...args) {
/* istanbul ignore if */

@@ -89,3 +87,3 @@ if (called) {

}
});
};
}

@@ -95,3 +93,3 @@

//create the function we will be returning
return getArguments(function (args) {
return function (...args) {
// Clone arguments

@@ -130,3 +128,3 @@ args = clone(args);

return promise;
});
};
}

@@ -157,3 +155,3 @@

function adapterFun(name, callback) {
return toPromise(getArguments(function (args) {
return toPromise(function (...args) {
if (this._closed) {

@@ -179,3 +177,3 @@ return Promise.reject(new Error('database is closed'));

return callback.apply(this, args);
}));
});
}

@@ -335,87 +333,77 @@

inherits(Changes, EventEmitter);
/* istanbul ignore next */
function attachBrowserEvents(self) {
if (hasLocalStorage()) {
addEventListener("storage", function (e) {
self.emit(e.key);
});
class Changes extends EventEmitter {
constructor() {
super();
this._listeners = {};
if (hasLocalStorage()) {
addEventListener("storage", function (e) {
this.emit(e.key);
});
}
}
}
function Changes() {
EventEmitter.call(this);
this._listeners = {};
attachBrowserEvents(this);
}
Changes.prototype.addListener = function (dbName, id, db, opts) {
/* istanbul ignore if */
if (this._listeners[id]) {
return;
}
var self = this;
var inprogress = false;
function eventFunction() {
/* istanbul ignore if */
if (!self._listeners[id]) {
addListener(dbName, id, db, opts) {
if (this._listeners[id]) {
return;
}
if (inprogress) {
inprogress = 'waiting';
var inprogress = false;
var self = this;
function eventFunction() {
if (!self._listeners[id]) {
return;
}
if (inprogress) {
inprogress = 'waiting';
return;
}
inprogress = true;
var changesOpts = pick(opts, [
'style', 'include_docs', 'attachments', 'conflicts', 'filter',
'doc_ids', 'view', 'since', 'query_params', 'binary', 'return_docs'
]);
function onError() {
inprogress = false;
}
db.changes(changesOpts).on('change', function (c) {
if (c.seq > opts.since && !opts.cancelled) {
opts.since = c.seq;
opts.onChange(c);
}
}).on('complete', function () {
if (inprogress === 'waiting') {
nextTick(eventFunction);
}
inprogress = false;
}).on('error', onError);
}
this._listeners[id] = eventFunction;
this.on(dbName, eventFunction);
}
removeListener(dbName, id) {
if (!(id in this._listeners)) {
return;
}
inprogress = true;
var changesOpts = pick(opts, [
'style', 'include_docs', 'attachments', 'conflicts', 'filter',
'doc_ids', 'view', 'since', 'query_params', 'binary', 'return_docs'
]);
/* istanbul ignore next */
function onError() {
inprogress = false;
super.removeListener(dbName, this._listeners[id]);
delete this._listeners[id];
}
notifyLocalWindows(dbName) {
//do a useless change on a storage thing
//in order to get other windows's listeners to activate
if (hasLocalStorage()) {
localStorage[dbName] = (localStorage[dbName] === "a") ? "b" : "a";
}
db.changes(changesOpts).on('change', function (c) {
if (c.seq > opts.since && !opts.cancelled) {
opts.since = c.seq;
opts.onChange(c);
}
}).on('complete', function () {
if (inprogress === 'waiting') {
nextTick(eventFunction);
}
inprogress = false;
}).on('error', onError);
}
this._listeners[id] = eventFunction;
this.on(dbName, eventFunction);
};
Changes.prototype.removeListener = function (dbName, id) {
/* istanbul ignore if */
if (!(id in this._listeners)) {
return;
notify(dbName) {
this.emit(dbName);
this.notifyLocalWindows(dbName);
}
EventEmitter.prototype.removeListener.call(this, dbName,
this._listeners[id]);
delete this._listeners[id];
};
}
/* istanbul ignore next */
Changes.prototype.notifyLocalWindows = function (dbName) {
//do a useless change on a storage thing
//in order to get other windows's listeners to activate
if (hasLocalStorage()) {
localStorage[dbName] = (localStorage[dbName] === "a") ? "b" : "a";
}
};
Changes.prototype.notify = function (dbName) {
this.emit(dbName);
this.notifyLocalWindows(dbName);
};
function guardedConsole(method) {

@@ -422,0 +410,0 @@ /* istanbul ignore else */

@@ -8,5 +8,3 @@ 'use strict';

var cloneBuffer = _interopDefault(require('clone-buffer'));
var getArguments = _interopDefault(require('argsarray'));
var pouchdbCollections = require('pouchdb-collections');
var inherits = _interopDefault(require('inherits'));
var pouchdbErrors = require('pouchdb-errors');

@@ -86,3 +84,3 @@ var EventEmitter = _interopDefault(require('events'));

var called = false;
return getArguments(function (args) {
return function (...args) {
/* istanbul ignore if */

@@ -96,3 +94,3 @@ if (called) {

}
});
};
}

@@ -102,3 +100,3 @@

//create the function we will be returning
return getArguments(function (args) {
return function (...args) {
// Clone arguments

@@ -137,3 +135,3 @@ args = clone(args);

return promise;
});
};
}

@@ -164,3 +162,3 @@

function adapterFun(name, callback) {
return toPromise(getArguments(function (args) {
return toPromise(function (...args) {
if (this._closed) {

@@ -186,3 +184,3 @@ return Promise.reject(new Error('database is closed'));

return callback.apply(this, args);
}));
});
}

@@ -342,87 +340,77 @@

inherits(Changes, EventEmitter);
/* istanbul ignore next */
function attachBrowserEvents(self) {
if (hasLocalStorage()) {
addEventListener("storage", function (e) {
self.emit(e.key);
});
class Changes extends EventEmitter {
constructor() {
super();
this._listeners = {};
if (hasLocalStorage()) {
addEventListener("storage", function (e) {
this.emit(e.key);
});
}
}
}
function Changes() {
EventEmitter.call(this);
this._listeners = {};
attachBrowserEvents(this);
}
Changes.prototype.addListener = function (dbName, id, db, opts) {
/* istanbul ignore if */
if (this._listeners[id]) {
return;
}
var self = this;
var inprogress = false;
function eventFunction() {
/* istanbul ignore if */
if (!self._listeners[id]) {
addListener(dbName, id, db, opts) {
if (this._listeners[id]) {
return;
}
if (inprogress) {
inprogress = 'waiting';
var inprogress = false;
var self = this;
function eventFunction() {
if (!self._listeners[id]) {
return;
}
if (inprogress) {
inprogress = 'waiting';
return;
}
inprogress = true;
var changesOpts = pick(opts, [
'style', 'include_docs', 'attachments', 'conflicts', 'filter',
'doc_ids', 'view', 'since', 'query_params', 'binary', 'return_docs'
]);
function onError() {
inprogress = false;
}
db.changes(changesOpts).on('change', function (c) {
if (c.seq > opts.since && !opts.cancelled) {
opts.since = c.seq;
opts.onChange(c);
}
}).on('complete', function () {
if (inprogress === 'waiting') {
nextTick(eventFunction);
}
inprogress = false;
}).on('error', onError);
}
this._listeners[id] = eventFunction;
this.on(dbName, eventFunction);
}
removeListener(dbName, id) {
if (!(id in this._listeners)) {
return;
}
inprogress = true;
var changesOpts = pick(opts, [
'style', 'include_docs', 'attachments', 'conflicts', 'filter',
'doc_ids', 'view', 'since', 'query_params', 'binary', 'return_docs'
]);
/* istanbul ignore next */
function onError() {
inprogress = false;
super.removeListener(dbName, this._listeners[id]);
delete this._listeners[id];
}
notifyLocalWindows(dbName) {
//do a useless change on a storage thing
//in order to get other windows's listeners to activate
if (hasLocalStorage()) {
localStorage[dbName] = (localStorage[dbName] === "a") ? "b" : "a";
}
db.changes(changesOpts).on('change', function (c) {
if (c.seq > opts.since && !opts.cancelled) {
opts.since = c.seq;
opts.onChange(c);
}
}).on('complete', function () {
if (inprogress === 'waiting') {
nextTick(eventFunction);
}
inprogress = false;
}).on('error', onError);
}
this._listeners[id] = eventFunction;
this.on(dbName, eventFunction);
};
Changes.prototype.removeListener = function (dbName, id) {
/* istanbul ignore if */
if (!(id in this._listeners)) {
return;
notify(dbName) {
this.emit(dbName);
this.notifyLocalWindows(dbName);
}
EventEmitter.prototype.removeListener.call(this, dbName,
this._listeners[id]);
delete this._listeners[id];
};
}
/* istanbul ignore next */
Changes.prototype.notifyLocalWindows = function (dbName) {
//do a useless change on a storage thing
//in order to get other windows's listeners to activate
if (hasLocalStorage()) {
localStorage[dbName] = (localStorage[dbName] === "a") ? "b" : "a";
}
};
Changes.prototype.notify = function (dbName) {
this.emit(dbName);
this.notifyLocalWindows(dbName);
};
function guardedConsole(method) {

@@ -429,0 +417,0 @@ /* istanbul ignore else */

{
"name": "pouchdb-utils",
"version": "7.3.1",
"version": "8.0.0",
"description": "Unassorted utilities used by PouchDB.",

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

"dependencies": {
"argsarray": "0.0.1",
"clone-buffer": "1.0.0",
"immediate": "3.3.0",
"inherits": "2.0.4",
"pouchdb-collections": "7.3.1",
"pouchdb-errors": "7.3.1",
"pouchdb-md5": "7.3.1",
"pouchdb-collections": "8.0.0",
"pouchdb-errors": "8.0.0",
"pouchdb-md5": "8.0.0",
"uuid": "8.3.2"

@@ -29,0 +27,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