pouchdb-adapter-http
Advanced tools
Comparing version 6.2.0 to 6.2.1-prerelease
@@ -62,2 +62,4 @@ import Promise from 'pouchdb-promise'; | ||
var MAX_SIMULTANEOUS_REVS = 50; | ||
var CHANGES_TIMEOUT_BUFFER = 5000; | ||
var DEFAULT_HEARTBEAT = 10000; | ||
@@ -535,3 +537,6 @@ var supportsBulkGetMap = {}; | ||
}); | ||
}).catch(callback); | ||
}).catch(function (e) { | ||
e.docId = id; | ||
callback(e); | ||
}); | ||
}); | ||
@@ -694,2 +699,3 @@ | ||
if (err) { | ||
err.docId = doc && doc._id; | ||
return callback(err); | ||
@@ -798,9 +804,27 @@ } | ||
opts = clone(opts); | ||
opts.timeout = ('timeout' in opts) ? opts.timeout : | ||
if (opts.continuous && !('heartbeat' in opts)) { | ||
opts.heartbeat = DEFAULT_HEARTBEAT; | ||
} | ||
var requestTimeout = ('timeout' in opts) ? opts.timeout : | ||
('timeout' in ajaxOpts) ? ajaxOpts.timeout : | ||
30 * 1000; | ||
// We give a 5 second buffer for CouchDB changes to respond with | ||
// an ok timeout (if a timeout it set) | ||
var params = opts.timeout ? {timeout: opts.timeout - (5 * 1000)} : {}; | ||
// ensure CHANGES_TIMEOUT_BUFFER applies | ||
if ('timeout' in opts && opts.timeout && | ||
(requestTimeout - opts.timeout) < CHANGES_TIMEOUT_BUFFER) { | ||
requestTimeout = opts.timeout + CHANGES_TIMEOUT_BUFFER; | ||
} | ||
if ('heartbeat' in opts && opts.heartbeat && | ||
(requestTimeout - opts.heartbeat) < CHANGES_TIMEOUT_BUFFER) { | ||
requestTimeout = opts.heartbeat + CHANGES_TIMEOUT_BUFFER; | ||
} | ||
var params = {}; | ||
if ('timeout' in opts && opts.timeout) { | ||
params.timeout = opts.timeout; | ||
} | ||
var limit = (typeof opts.limit !== 'undefined') ? opts.limit : false; | ||
@@ -848,5 +872,2 @@ var returnDocs; | ||
} | ||
} else if (opts.continuous) { | ||
// Default heartbeat to 10 seconds | ||
params.heartbeat = 10000; | ||
} | ||
@@ -921,3 +942,3 @@ | ||
url: genDBUrl(host, '_changes' + paramsToStr(params)), | ||
timeout: opts.timeout, | ||
timeout: requestTimeout, | ||
body: body | ||
@@ -924,0 +945,0 @@ }; |
@@ -66,2 +66,4 @@ 'use strict'; | ||
var MAX_SIMULTANEOUS_REVS = 50; | ||
var CHANGES_TIMEOUT_BUFFER = 5000; | ||
var DEFAULT_HEARTBEAT = 10000; | ||
@@ -539,3 +541,6 @@ var supportsBulkGetMap = {}; | ||
}); | ||
}).catch(callback); | ||
}).catch(function (e) { | ||
e.docId = id; | ||
callback(e); | ||
}); | ||
}); | ||
@@ -698,2 +703,3 @@ | ||
if (err) { | ||
err.docId = doc && doc._id; | ||
return callback(err); | ||
@@ -802,9 +808,27 @@ } | ||
opts = pouchdbUtils.clone(opts); | ||
opts.timeout = ('timeout' in opts) ? opts.timeout : | ||
if (opts.continuous && !('heartbeat' in opts)) { | ||
opts.heartbeat = DEFAULT_HEARTBEAT; | ||
} | ||
var requestTimeout = ('timeout' in opts) ? opts.timeout : | ||
('timeout' in ajaxOpts) ? ajaxOpts.timeout : | ||
30 * 1000; | ||
// We give a 5 second buffer for CouchDB changes to respond with | ||
// an ok timeout (if a timeout it set) | ||
var params = opts.timeout ? {timeout: opts.timeout - (5 * 1000)} : {}; | ||
// ensure CHANGES_TIMEOUT_BUFFER applies | ||
if ('timeout' in opts && opts.timeout && | ||
(requestTimeout - opts.timeout) < CHANGES_TIMEOUT_BUFFER) { | ||
requestTimeout = opts.timeout + CHANGES_TIMEOUT_BUFFER; | ||
} | ||
if ('heartbeat' in opts && opts.heartbeat && | ||
(requestTimeout - opts.heartbeat) < CHANGES_TIMEOUT_BUFFER) { | ||
requestTimeout = opts.heartbeat + CHANGES_TIMEOUT_BUFFER; | ||
} | ||
var params = {}; | ||
if ('timeout' in opts && opts.timeout) { | ||
params.timeout = opts.timeout; | ||
} | ||
var limit = (typeof opts.limit !== 'undefined') ? opts.limit : false; | ||
@@ -852,5 +876,2 @@ var returnDocs; | ||
} | ||
} else if (opts.continuous) { | ||
// Default heartbeat to 10 seconds | ||
params.heartbeat = 10000; | ||
} | ||
@@ -925,3 +946,3 @@ | ||
url: genDBUrl(host, '_changes' + paramsToStr(params)), | ||
timeout: opts.timeout, | ||
timeout: requestTimeout, | ||
body: body | ||
@@ -928,0 +949,0 @@ }; |
{ | ||
"name": "pouchdb-adapter-http", | ||
"version": "6.2.0", | ||
"version": "6.2.1-prerelease", | ||
"description": "PouchDB adapter using HTTP (e.g. a remote CouchDB) as its data store.", | ||
@@ -10,16 +10,3 @@ "main": "./lib/index.js", | ||
"repository": "https://github.com/pouchdb/pouchdb", | ||
"jsnext:main": "./lib/index.es.js", | ||
"dependencies": { | ||
"argsarray": "0.0.1", | ||
"pouchdb-ajax": "6.2.0", | ||
"pouchdb-binary-utils": "6.2.0", | ||
"pouchdb-errors": "6.2.0", | ||
"pouchdb-promise": "6.2.0", | ||
"pouchdb-utils": "6.2.0" | ||
}, | ||
"files": [ | ||
"lib", | ||
"dist", | ||
"tonic-example.js" | ||
] | ||
"jsnext:main": "./src/index.js" | ||
} |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
103112
0
7
2783
2
10
- Removedargsarray@0.0.1
- Removedpouchdb-ajax@6.2.0
- Removedpouchdb-binary-utils@6.2.0
- Removedpouchdb-errors@6.2.0
- Removedpouchdb-promise@6.2.0
- Removedpouchdb-utils@6.2.0
- Removedajv@4.11.8(transitive)
- Removedargsarray@0.0.1(transitive)
- Removedasn1@0.2.6(transitive)
- Removedassert-plus@0.2.01.0.0(transitive)
- Removedasynckit@0.4.0(transitive)
- Removedattempt-x@1.1.3(transitive)
- Removedaws-sign2@0.6.0(transitive)
- Removedaws4@1.13.2(transitive)
- Removedbcrypt-pbkdf@1.0.2(transitive)
- Removedboom@2.10.1(transitive)
- Removedbuffer-from@0.1.1(transitive)
- Removedcached-constructors-x@1.0.2(transitive)
- Removedcall-bind@1.0.8(transitive)
- Removedcall-bind-apply-helpers@1.0.1(transitive)
- Removedcall-bound@1.0.3(transitive)
- Removedcaseless@0.12.0(transitive)
- Removedclone-buffer@1.0.0(transitive)
- Removedco@4.6.0(transitive)
- Removedcombined-stream@1.0.8(transitive)
- Removedcore-util-is@1.0.2(transitive)
- Removedcryptiles@2.0.5(transitive)
- Removeddashdash@1.14.1(transitive)
- Removeddefine-data-property@1.1.4(transitive)
- Removeddelayed-stream@1.0.0(transitive)
- Removeddunder-proto@1.0.1(transitive)
- Removedecc-jsbn@0.1.2(transitive)
- Removedes-define-property@1.0.1(transitive)
- Removedes-errors@1.3.0(transitive)
- Removedes-object-atoms@1.1.1(transitive)
- Removedextend@3.0.2(transitive)
- Removedextsprintf@1.3.0(transitive)
- Removedforever-agent@0.6.1(transitive)
- Removedform-data@2.1.4(transitive)
- Removedfunction-bind@1.1.2(transitive)
- Removedget-intrinsic@1.2.7(transitive)
- Removedget-proto@1.0.1(transitive)
- Removedgetpass@0.1.7(transitive)
- Removedgopd@1.2.0(transitive)
- Removedhar-schema@1.0.5(transitive)
- Removedhar-validator@4.2.1(transitive)
- Removedhas-own-property-x@3.2.0(transitive)
- Removedhas-property-descriptors@1.0.2(transitive)
- Removedhas-symbol-support-x@1.4.2(transitive)
- Removedhas-symbols@1.1.0(transitive)
- Removedhas-to-string-tag-x@1.4.1(transitive)
- Removedhas-tostringtag@1.0.2(transitive)
- Removedhasown@2.0.2(transitive)
- Removedhawk@3.1.3(transitive)
- Removedhoek@2.16.3(transitive)
- Removedhttp-signature@1.1.1(transitive)
- Removedimmediate@3.0.6(transitive)
- Removedinfinity-x@1.0.2(transitive)
- Removedinherits@2.0.3(transitive)
- Removedis-array-buffer-x@1.7.0(transitive)
- Removedis-date-object@1.1.0(transitive)
- Removedis-falsey-x@1.0.3(transitive)
- Removedis-finite-x@3.0.4(transitive)
- Removedis-function-x@3.3.0(transitive)
- Removedis-index-x@1.1.0(transitive)
- Removedis-nan-x@1.0.3(transitive)
- Removedis-nil-x@1.4.2(transitive)
- Removedis-object-like-x@1.7.1(transitive)
- Removedis-primitive@2.0.03.0.1(transitive)
- Removedis-regex@1.2.1(transitive)
- Removedis-string@1.1.1(transitive)
- Removedis-symbol@1.1.1(transitive)
- Removedis-typedarray@1.0.0(transitive)
- Removedisarray@2.0.5(transitive)
- Removedisstream@0.1.2(transitive)
- Removedjsbn@0.1.1(transitive)
- Removedjson-schema@0.4.0(transitive)
- Removedjson-stable-stringify@1.2.1(transitive)
- Removedjson-stringify-safe@5.0.1(transitive)
- Removedjsonify@0.0.1(transitive)
- Removedjsprim@1.4.2(transitive)
- Removedlie@3.1.1(transitive)
- Removedlodash.isnull@3.0.0(transitive)
- Removedmath-clamp-x@1.2.0(transitive)
- Removedmath-intrinsics@1.1.0(transitive)
- Removedmath-sign-x@3.0.0(transitive)
- Removedmax-safe-integer@1.0.1(transitive)
- Removedmime-db@1.52.0(transitive)
- Removedmime-types@2.1.35(transitive)
- Removednan-x@1.0.2(transitive)
- Removednormalize-space-x@3.0.0(transitive)
- Removedoauth-sign@0.8.2(transitive)
- Removedobject-get-own-property-descriptor-x@3.2.0(transitive)
- Removedobject-keys@1.1.1(transitive)
- Removedparse-int-x@2.0.0(transitive)
- Removedperformance-now@0.2.0(transitive)
- Removedpouchdb-ajax@6.2.0(transitive)
- Removedpouchdb-binary-utils@6.2.0(transitive)
- Removedpouchdb-collections@6.2.0(transitive)
- Removedpouchdb-errors@6.2.0(transitive)
- Removedpouchdb-promise@6.2.0(transitive)
- Removedpouchdb-utils@6.2.0(transitive)
- Removedproperty-is-enumerable-x@1.1.0(transitive)
- Removedpunycode@1.4.1(transitive)
- Removedqs@6.3.3(transitive)
- Removedreplace-comments-x@2.0.0(transitive)
- Removedrequest@2.80.0(transitive)
- Removedrequire-coercible-to-string-x@1.0.2(transitive)
- Removedrequire-object-coercible-x@1.4.3(transitive)
- Removedsafe-regex-test@1.1.0(transitive)
- Removedsafer-buffer@2.1.2(transitive)
- Removedset-function-length@1.2.2(transitive)
- Removedsntp@1.0.9(transitive)
- Removedsshpk@1.18.0(transitive)
- Removedstringstream@0.0.6(transitive)
- Removedto-boolean-x@1.0.3(transitive)
- Removedto-integer-x@3.0.0(transitive)
- Removedto-number-x@2.0.0(transitive)
- Removedto-object-x@1.5.0(transitive)
- Removedto-primitive-x@1.1.0(transitive)
- Removedto-property-key-x@2.0.2(transitive)
- Removedto-string-symbols-supported-x@1.0.2(transitive)
- Removedto-string-tag-x@1.4.3(transitive)
- Removedto-string-x@1.4.5(transitive)
- Removedtough-cookie@2.3.4(transitive)
- Removedtrim-left-x@3.0.0(transitive)
- Removedtrim-right-x@3.0.0(transitive)
- Removedtrim-x@3.0.0(transitive)
- Removedtunnel-agent@0.4.3(transitive)
- Removedtweetnacl@0.14.5(transitive)
- Removeduuid@3.4.0(transitive)
- Removedvalidate.io-undefined@1.0.3(transitive)
- Removedverror@1.10.0(transitive)
- Removedwhite-space-x@3.0.1(transitive)