Socket
Socket
Sign inDemoInstall

pouchdb

Package Overview
Dependencies
234
Maintainers
6
Versions
93
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 5.4.5 to 6.0.0

dist/pouchdb-next.js

28

lib/extras/ajax-browser.js

@@ -56,2 +56,4 @@ 'use strict';

/* global fetch */
/* global Headers */
function wrappedFetch() {

@@ -164,2 +166,3 @@ var wrappedPromise = {};

xhr.abort();
cleanUp();
};

@@ -170,4 +173,20 @@

xhr.abort();
cleanUp();
};
var ret = {abort: abortReq};
var cleanUp = function () {
clearTimeout(timer);
ret.abort = function () {};
if (xhr) {
xhr.onprogress = undefined;
if (xhr.upload) {
xhr.upload.onprogress = undefined;
}
xhr.onreadystatechange = undefined;
xhr = undefined;
}
};
if (options.xhr) {

@@ -252,3 +271,3 @@ xhr = new options.xhr();

err.code = 'ETIMEDOUT';
} else {
} else if (typeof xhr.response === 'string') {
try {

@@ -261,2 +280,3 @@ err = JSON.parse(xhr.response);

}
cleanUp();
};

@@ -272,3 +292,3 @@

return {abort: abortReq};
return ret;
}

@@ -486,3 +506,3 @@

function isBinaryObject(object) {
return object instanceof ArrayBuffer ||
return (typeof ArrayBuffer !== 'undefined' && object instanceof ArrayBuffer) ||
(typeof Blob !== 'undefined' && object instanceof Blob);

@@ -568,2 +588,3 @@ }

for (i in object) {
/* istanbul ignore else */
if (Object.prototype.hasOwnProperty.call(object, i)) {

@@ -699,2 +720,3 @@ var value = clone(object[i]);

this._listeners[id]);
delete this._listeners[id];
};

@@ -701,0 +723,0 @@

@@ -267,2 +267,3 @@ 'use strict';

for (i in object) {
/* istanbul ignore else */
if (Object.prototype.hasOwnProperty.call(object, i)) {

@@ -385,2 +386,3 @@ var value = clone(object[i]);

this._listeners[id]);
delete this._listeners[id];
};

@@ -387,0 +389,0 @@

@@ -10,3 +10,2 @@ 'use strict';

var inherits = _interopDefault(require('inherits'));
var pouchdbCollate = require('pouchdb-collate');

@@ -143,2 +142,3 @@ /* istanbul ignore next */

this._listeners[id]);
delete this._listeners[id];
};

@@ -164,2 +164,3 @@

function guardedConsole(method) {
/* istanbul ignore else */
if (console !== 'undefined' && method in console) {

@@ -380,2 +381,128 @@ var args = Array.prototype.slice.call(arguments, 1);

// set to '_' for easier debugging
function collate(a, b) {
if (a === b) {
return 0;
}
a = normalizeKey(a);
b = normalizeKey(b);
var ai = collationIndex(a);
var bi = collationIndex(b);
if ((ai - bi) !== 0) {
return ai - bi;
}
if (a === null) {
return 0;
}
switch (typeof a) {
case 'number':
return a - b;
case 'boolean':
return a === b ? 0 : (a < b ? -1 : 1);
case 'string':
return stringCollate(a, b);
}
return Array.isArray(a) ? arrayCollate(a, b) : objectCollate(a, b);
}
// couch considers null/NaN/Infinity/-Infinity === undefined,
// for the purposes of mapreduce indexes. also, dates get stringified.
function normalizeKey(key) {
switch (typeof key) {
case 'undefined':
return null;
case 'number':
if (key === Infinity || key === -Infinity || isNaN(key)) {
return null;
}
return key;
case 'object':
var origKey = key;
if (Array.isArray(key)) {
var len = key.length;
key = new Array(len);
for (var i = 0; i < len; i++) {
key[i] = normalizeKey(origKey[i]);
}
/* istanbul ignore next */
} else if (key instanceof Date) {
return key.toJSON();
} else if (key !== null) { // generic object
key = {};
for (var k in origKey) {
if (origKey.hasOwnProperty(k)) {
var val = origKey[k];
if (typeof val !== 'undefined') {
key[k] = normalizeKey(val);
}
}
}
}
}
return key;
}
function arrayCollate(a, b) {
var len = Math.min(a.length, b.length);
for (var i = 0; i < len; i++) {
var sort = collate(a[i], b[i]);
if (sort !== 0) {
return sort;
}
}
return (a.length === b.length) ? 0 :
(a.length > b.length) ? 1 : -1;
}
function stringCollate(a, b) {
// See: https://github.com/daleharvey/pouchdb/issues/40
// This is incompatible with the CouchDB implementation, but its the
// best we can do for now
return (a === b) ? 0 : ((a > b) ? 1 : -1);
}
function objectCollate(a, b) {
var ak = Object.keys(a), bk = Object.keys(b);
var len = Math.min(ak.length, bk.length);
for (var i = 0; i < len; i++) {
// First sort the keys
var sort = collate(ak[i], bk[i]);
if (sort !== 0) {
return sort;
}
// if the keys are equal sort the values
sort = collate(a[ak[i]], b[bk[i]]);
if (sort !== 0) {
return sort;
}
}
return (ak.length === bk.length) ? 0 :
(ak.length > bk.length) ? 1 : -1;
}
// The collation is defined by erlangs ordered terms
// the atoms null, true, false come first, then numbers, strings,
// arrays, then objects
// null/undefined/NaN/Infinity/-Infinity are all considered null
function collationIndex(x) {
var id = ['boolean', 'number', 'string', 'object'];
var idx = id.indexOf(typeof x);
//false if -1 otherwise true, but fast!!!!1
if (~idx) {
if (x === null) {
return 1;
}
if (Array.isArray(x)) {
return 5;
}
return idx < 3 ? (idx + 2) : (idx + 3);
}
/* istanbul ignore next */
if (Array.isArray(x)) {
return 5;
}
}
var CHECKPOINT_VERSION = 1;

@@ -414,2 +541,8 @@ var REPLICATOR = "pouchdb";

}
// if the checkpoint has not changed, do not update
if (doc.last_seq === checkpoint) {
return;
}
// Filter out current entry for this replication

@@ -485,3 +618,3 @@ doc.history = (doc.history || []).filter(function (item) {

// This is the previous comparison function
if (pouchdbCollate.collate(targetDoc.last_seq, sourceDoc.last_seq) === 0) {
if (collate(targetDoc.last_seq, sourceDoc.last_seq) === 0) {
return sourceDoc.last_seq;

@@ -488,0 +621,0 @@ }

@@ -10,3 +10,2 @@ 'use strict';

var inherits = _interopDefault(require('inherits'));
var pouchdbCollate = require('pouchdb-collate');

@@ -130,2 +129,3 @@ /* istanbul ignore next */

this._listeners[id]);
delete this._listeners[id];
};

@@ -356,2 +356,128 @@

// set to '_' for easier debugging
function collate(a, b) {
if (a === b) {
return 0;
}
a = normalizeKey(a);
b = normalizeKey(b);
var ai = collationIndex(a);
var bi = collationIndex(b);
if ((ai - bi) !== 0) {
return ai - bi;
}
if (a === null) {
return 0;
}
switch (typeof a) {
case 'number':
return a - b;
case 'boolean':
return a === b ? 0 : (a < b ? -1 : 1);
case 'string':
return stringCollate(a, b);
}
return Array.isArray(a) ? arrayCollate(a, b) : objectCollate(a, b);
}
// couch considers null/NaN/Infinity/-Infinity === undefined,
// for the purposes of mapreduce indexes. also, dates get stringified.
function normalizeKey(key) {
switch (typeof key) {
case 'undefined':
return null;
case 'number':
if (key === Infinity || key === -Infinity || isNaN(key)) {
return null;
}
return key;
case 'object':
var origKey = key;
if (Array.isArray(key)) {
var len = key.length;
key = new Array(len);
for (var i = 0; i < len; i++) {
key[i] = normalizeKey(origKey[i]);
}
/* istanbul ignore next */
} else if (key instanceof Date) {
return key.toJSON();
} else if (key !== null) { // generic object
key = {};
for (var k in origKey) {
if (origKey.hasOwnProperty(k)) {
var val = origKey[k];
if (typeof val !== 'undefined') {
key[k] = normalizeKey(val);
}
}
}
}
}
return key;
}
function arrayCollate(a, b) {
var len = Math.min(a.length, b.length);
for (var i = 0; i < len; i++) {
var sort = collate(a[i], b[i]);
if (sort !== 0) {
return sort;
}
}
return (a.length === b.length) ? 0 :
(a.length > b.length) ? 1 : -1;
}
function stringCollate(a, b) {
// See: https://github.com/daleharvey/pouchdb/issues/40
// This is incompatible with the CouchDB implementation, but its the
// best we can do for now
return (a === b) ? 0 : ((a > b) ? 1 : -1);
}
function objectCollate(a, b) {
var ak = Object.keys(a), bk = Object.keys(b);
var len = Math.min(ak.length, bk.length);
for (var i = 0; i < len; i++) {
// First sort the keys
var sort = collate(ak[i], bk[i]);
if (sort !== 0) {
return sort;
}
// if the keys are equal sort the values
sort = collate(a[ak[i]], b[bk[i]]);
if (sort !== 0) {
return sort;
}
}
return (ak.length === bk.length) ? 0 :
(ak.length > bk.length) ? 1 : -1;
}
// The collation is defined by erlangs ordered terms
// the atoms null, true, false come first, then numbers, strings,
// arrays, then objects
// null/undefined/NaN/Infinity/-Infinity are all considered null
function collationIndex(x) {
var id = ['boolean', 'number', 'string', 'object'];
var idx = id.indexOf(typeof x);
//false if -1 otherwise true, but fast!!!!1
if (~idx) {
if (x === null) {
return 1;
}
if (Array.isArray(x)) {
return 5;
}
return idx < 3 ? (idx + 2) : (idx + 3);
}
/* istanbul ignore next */
if (Array.isArray(x)) {
return 5;
}
}
var CHECKPOINT_VERSION = 1;

@@ -390,2 +516,8 @@ var REPLICATOR = "pouchdb";

}
// if the checkpoint has not changed, do not update
if (doc.last_seq === checkpoint) {
return;
}
// Filter out current entry for this replication

@@ -461,3 +593,3 @@ doc.history = (doc.history || []).filter(function (item) {

// This is the previous comparison function
if (pouchdbCollate.collate(targetDoc.last_seq, sourceDoc.last_seq) === 0) {
if (collate(targetDoc.last_seq, sourceDoc.last_seq) === 0) {
return sourceDoc.last_seq;

@@ -464,0 +596,0 @@ }

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

var Md5 = _interopDefault(require('spark-md5'));
var pouchdbCollate = require('pouchdb-collate');

@@ -101,4 +100,130 @@ /* istanbul ignore next */

// set to '_' for easier debugging
function collate(a, b) {
if (a === b) {
return 0;
}
a = normalizeKey(a);
b = normalizeKey(b);
var ai = collationIndex(a);
var bi = collationIndex(b);
if ((ai - bi) !== 0) {
return ai - bi;
}
if (a === null) {
return 0;
}
switch (typeof a) {
case 'number':
return a - b;
case 'boolean':
return a === b ? 0 : (a < b ? -1 : 1);
case 'string':
return stringCollate(a, b);
}
return Array.isArray(a) ? arrayCollate(a, b) : objectCollate(a, b);
}
// couch considers null/NaN/Infinity/-Infinity === undefined,
// for the purposes of mapreduce indexes. also, dates get stringified.
function normalizeKey(key) {
switch (typeof key) {
case 'undefined':
return null;
case 'number':
if (key === Infinity || key === -Infinity || isNaN(key)) {
return null;
}
return key;
case 'object':
var origKey = key;
if (Array.isArray(key)) {
var len = key.length;
key = new Array(len);
for (var i = 0; i < len; i++) {
key[i] = normalizeKey(origKey[i]);
}
/* istanbul ignore next */
} else if (key instanceof Date) {
return key.toJSON();
} else if (key !== null) { // generic object
key = {};
for (var k in origKey) {
if (origKey.hasOwnProperty(k)) {
var val = origKey[k];
if (typeof val !== 'undefined') {
key[k] = normalizeKey(val);
}
}
}
}
}
return key;
}
function arrayCollate(a, b) {
var len = Math.min(a.length, b.length);
for (var i = 0; i < len; i++) {
var sort = collate(a[i], b[i]);
if (sort !== 0) {
return sort;
}
}
return (a.length === b.length) ? 0 :
(a.length > b.length) ? 1 : -1;
}
function stringCollate(a, b) {
// See: https://github.com/daleharvey/pouchdb/issues/40
// This is incompatible with the CouchDB implementation, but its the
// best we can do for now
return (a === b) ? 0 : ((a > b) ? 1 : -1);
}
function objectCollate(a, b) {
var ak = Object.keys(a), bk = Object.keys(b);
var len = Math.min(ak.length, bk.length);
for (var i = 0; i < len; i++) {
// First sort the keys
var sort = collate(ak[i], bk[i]);
if (sort !== 0) {
return sort;
}
// if the keys are equal sort the values
sort = collate(a[ak[i]], b[bk[i]]);
if (sort !== 0) {
return sort;
}
}
return (ak.length === bk.length) ? 0 :
(ak.length > bk.length) ? 1 : -1;
}
// The collation is defined by erlangs ordered terms
// the atoms null, true, false come first, then numbers, strings,
// arrays, then objects
// null/undefined/NaN/Infinity/-Infinity are all considered null
function collationIndex(x) {
var id = ['boolean', 'number', 'string', 'object'];
var idx = id.indexOf(typeof x);
//false if -1 otherwise true, but fast!!!!1
if (~idx) {
if (x === null) {
return 1;
}
if (Array.isArray(x)) {
return 5;
}
return idx < 3 ? (idx + 2) : (idx + 3);
}
/* istanbul ignore next */
if (Array.isArray(x)) {
return 5;
}
}
function sortObjectPropertiesByKey(queryParams) {
return Object.keys(queryParams).sort(pouchdbCollate.collate).reduce(function (result, key) {
return Object.keys(queryParams).sort(collate).reduce(function (result, key) {
result[key] = queryParams[key];

@@ -112,3 +237,3 @@ return result;

function generateReplicationId(src, target, opts) {
var docIds = opts.doc_ids ? opts.doc_ids.sort(pouchdbCollate.collate) : '';
var docIds = opts.doc_ids ? opts.doc_ids.sort(collate) : '';
var filterFun = opts.filter ? opts.filter.toString() : '';

@@ -115,0 +240,0 @@ var queryParams = '';

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

var crypto = _interopDefault(require('crypto'));
var pouchdbCollate = require('pouchdb-collate');

@@ -18,4 +17,130 @@ /* istanbul ignore next */

// set to '_' for easier debugging
function collate(a, b) {
if (a === b) {
return 0;
}
a = normalizeKey(a);
b = normalizeKey(b);
var ai = collationIndex(a);
var bi = collationIndex(b);
if ((ai - bi) !== 0) {
return ai - bi;
}
if (a === null) {
return 0;
}
switch (typeof a) {
case 'number':
return a - b;
case 'boolean':
return a === b ? 0 : (a < b ? -1 : 1);
case 'string':
return stringCollate(a, b);
}
return Array.isArray(a) ? arrayCollate(a, b) : objectCollate(a, b);
}
// couch considers null/NaN/Infinity/-Infinity === undefined,
// for the purposes of mapreduce indexes. also, dates get stringified.
function normalizeKey(key) {
switch (typeof key) {
case 'undefined':
return null;
case 'number':
if (key === Infinity || key === -Infinity || isNaN(key)) {
return null;
}
return key;
case 'object':
var origKey = key;
if (Array.isArray(key)) {
var len = key.length;
key = new Array(len);
for (var i = 0; i < len; i++) {
key[i] = normalizeKey(origKey[i]);
}
/* istanbul ignore next */
} else if (key instanceof Date) {
return key.toJSON();
} else if (key !== null) { // generic object
key = {};
for (var k in origKey) {
if (origKey.hasOwnProperty(k)) {
var val = origKey[k];
if (typeof val !== 'undefined') {
key[k] = normalizeKey(val);
}
}
}
}
}
return key;
}
function arrayCollate(a, b) {
var len = Math.min(a.length, b.length);
for (var i = 0; i < len; i++) {
var sort = collate(a[i], b[i]);
if (sort !== 0) {
return sort;
}
}
return (a.length === b.length) ? 0 :
(a.length > b.length) ? 1 : -1;
}
function stringCollate(a, b) {
// See: https://github.com/daleharvey/pouchdb/issues/40
// This is incompatible with the CouchDB implementation, but its the
// best we can do for now
return (a === b) ? 0 : ((a > b) ? 1 : -1);
}
function objectCollate(a, b) {
var ak = Object.keys(a), bk = Object.keys(b);
var len = Math.min(ak.length, bk.length);
for (var i = 0; i < len; i++) {
// First sort the keys
var sort = collate(ak[i], bk[i]);
if (sort !== 0) {
return sort;
}
// if the keys are equal sort the values
sort = collate(a[ak[i]], b[bk[i]]);
if (sort !== 0) {
return sort;
}
}
return (ak.length === bk.length) ? 0 :
(ak.length > bk.length) ? 1 : -1;
}
// The collation is defined by erlangs ordered terms
// the atoms null, true, false come first, then numbers, strings,
// arrays, then objects
// null/undefined/NaN/Infinity/-Infinity are all considered null
function collationIndex(x) {
var id = ['boolean', 'number', 'string', 'object'];
var idx = id.indexOf(typeof x);
//false if -1 otherwise true, but fast!!!!1
if (~idx) {
if (x === null) {
return 1;
}
if (Array.isArray(x)) {
return 5;
}
return idx < 3 ? (idx + 2) : (idx + 3);
}
/* istanbul ignore next */
if (Array.isArray(x)) {
return 5;
}
}
function sortObjectPropertiesByKey(queryParams) {
return Object.keys(queryParams).sort(pouchdbCollate.collate).reduce(function (result, key) {
return Object.keys(queryParams).sort(collate).reduce(function (result, key) {
result[key] = queryParams[key];

@@ -29,3 +154,3 @@ return result;

function generateReplicationId(src, target, opts) {
var docIds = opts.doc_ids ? opts.doc_ids.sort(pouchdbCollate.collate) : '';
var docIds = opts.doc_ids ? opts.doc_ids.sort(collate) : '';
var filterFun = opts.filter ? opts.filter.toString() : '';

@@ -32,0 +157,0 @@ var queryParams = '';

32

package.json
{
"name": "pouchdb",
"version": "5.4.5",
"version": "6.0.0",
"description": "PouchDB is a pocket-sized database",

@@ -24,34 +24,20 @@ "main": "./lib/index.js",

"inherits": "2.0.1",
"js-extend": "0.0.1",
"js-extend": "1.0.1",
"level-codec": "6.1.0",
"level-write-stream": "1.0.0",
"leveldown": "1.4.6",
"levelup": "1.3.2",
"lie": "3.0.4",
"lie": "3.1.0",
"localstorage-down": "0.6.6",
"ltgt": "2.1.2",
"memdown": "1.1.2",
"pouchdb-collate": "1.2.0",
"pouchdb-collections": "1.0.1",
"pull-stream": "3.4.4",
"readable-stream": "1.0.33",
"request": "2.72.0",
"scope-eval": "0.0.3",
"spark-md5": "2.0.2",
"sublevel-pouchdb": "1.0.1",
"through2": "2.0.1",
"vuvuzela": "1.0.3"
},
"optionalDependencies": {
"leveldown": "1.4.6",
"vuvuzela": "1.0.3",
"websql": "0.4.4"
},
"devDependencies": {
"pouchdb-adapter-fruitdown": "5.4.5",
"pouchdb-adapter-localstorage": "5.4.5",
"pouchdb-adapter-memory": "5.4.5",
"pouchdb-adapter-node-websql": "5.4.5",
"pouchdb-ajax": "5.4.5",
"pouchdb-browser": "5.4.5",
"pouchdb-checkpointer": "5.4.5",
"pouchdb-generate-replication-id": "5.4.5",
"pouchdb-node": "5.4.5",
"pouchdb-promise": "5.4.5",
"pouchdb-utils": "5.4.5"
},
"browser": {

@@ -58,0 +44,0 @@ "./lib/index.js": "./lib/index-browser.js",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc