pouchdb-replication
Advanced tools
Comparing version 6.3.4 to 6.4.0
@@ -246,2 +246,3 @@ import Promise from 'pouchdb-promise'; | ||
var session = uuid(); | ||
var seq_interval = opts.seq_interval; | ||
@@ -314,3 +315,5 @@ result = result || { | ||
result.errors.push(error); | ||
if (error.name === 'unauthorized' || error.name === 'forbidden') { | ||
// Normalize error name. i.e. 'Unauthorized' -> 'unauthorized' (eg Sync Gateway) | ||
var errorName = (error.name || '').toLowerCase(); | ||
if (errorName === 'unauthorized' || errorName === 'forbidden') { | ||
returnValue.emit('denied', clone(error)); | ||
@@ -339,2 +342,8 @@ } else { | ||
outResult.docs = changedDocs; | ||
// Attach 'pending' property if server supports it (CouchDB 2.0+) | ||
/* istanbul ignore if */ | ||
if (typeof currentBatch.pending === 'number') { | ||
outResult.pending = currentBatch.pending; | ||
delete currentBatch.pending; | ||
} | ||
returnValue.emit('change', outResult); | ||
@@ -486,3 +495,5 @@ } | ||
if (fatalError.name === 'unauthorized' || fatalError.name === 'forbidden') { | ||
// Normalize error name. i.e. 'Unauthorized' -> 'unauthorized' (eg Sync Gateway) | ||
var errorName = (fatalError.name || '').toLowerCase(); | ||
if (errorName === 'unauthorized' || errorName === 'forbidden') { | ||
returnValue.emit('error', fatalError); | ||
@@ -502,3 +513,3 @@ returnValue.removeAllListeners(); | ||
function onChange(change) { | ||
function onChange(change, pending, lastSeq) { | ||
/* istanbul ignore if */ | ||
@@ -508,2 +519,8 @@ if (returnValue.cancelled) { | ||
} | ||
// Attach 'pending' property if server supports it (CouchDB 2.0+) | ||
/* istanbul ignore if */ | ||
if (typeof pending === 'number') { | ||
pendingBatch.pending = pending; | ||
} | ||
var filter = filterChange(opts)(change); | ||
@@ -513,3 +530,3 @@ if (!filter) { | ||
} | ||
pendingBatch.seq = change.seq; | ||
pendingBatch.seq = change.seq || lastSeq; | ||
pendingBatch.changes.push(change); | ||
@@ -626,2 +643,5 @@ processPendingBatch(batches.length === 0 && changesOpts.live); | ||
}; | ||
if (seq_interval !== false) { | ||
changesOpts.seq_interval = seq_interval || batch_size; | ||
} | ||
if (opts.filter) { | ||
@@ -998,10 +1018,13 @@ if (typeof opts.filter !== 'string') { | ||
var self = this; | ||
return { | ||
from: function (other, opts, callback) { | ||
return self.constructor.replicate(other, self, opts, callback); | ||
}, | ||
to: function (other, opts, callback) { | ||
return self.constructor.replicate(self, other, opts, callback); | ||
} | ||
}; | ||
if (typeof this.replicateMethods === 'undefined') { | ||
this.replicateMethods = { | ||
from: function (other, opts, callback) { | ||
return self.constructor.replicate(other, self, opts, callback); | ||
}, | ||
to: function (other, opts, callback) { | ||
return self.constructor.replicate(self, other, opts, callback); | ||
} | ||
}; | ||
} | ||
return this.replicateMethods; | ||
} | ||
@@ -1008,0 +1031,0 @@ }); |
@@ -250,2 +250,3 @@ 'use strict'; | ||
var session = pouchdbUtils.uuid(); | ||
var seq_interval = opts.seq_interval; | ||
@@ -318,3 +319,5 @@ result = result || { | ||
result.errors.push(error); | ||
if (error.name === 'unauthorized' || error.name === 'forbidden') { | ||
// Normalize error name. i.e. 'Unauthorized' -> 'unauthorized' (eg Sync Gateway) | ||
var errorName = (error.name || '').toLowerCase(); | ||
if (errorName === 'unauthorized' || errorName === 'forbidden') { | ||
returnValue.emit('denied', pouchdbUtils.clone(error)); | ||
@@ -343,2 +346,8 @@ } else { | ||
outResult.docs = changedDocs; | ||
// Attach 'pending' property if server supports it (CouchDB 2.0+) | ||
/* istanbul ignore if */ | ||
if (typeof currentBatch.pending === 'number') { | ||
outResult.pending = currentBatch.pending; | ||
delete currentBatch.pending; | ||
} | ||
returnValue.emit('change', outResult); | ||
@@ -490,3 +499,5 @@ } | ||
if (fatalError.name === 'unauthorized' || fatalError.name === 'forbidden') { | ||
// Normalize error name. i.e. 'Unauthorized' -> 'unauthorized' (eg Sync Gateway) | ||
var errorName = (fatalError.name || '').toLowerCase(); | ||
if (errorName === 'unauthorized' || errorName === 'forbidden') { | ||
returnValue.emit('error', fatalError); | ||
@@ -506,3 +517,3 @@ returnValue.removeAllListeners(); | ||
function onChange(change) { | ||
function onChange(change, pending, lastSeq) { | ||
/* istanbul ignore if */ | ||
@@ -512,2 +523,8 @@ if (returnValue.cancelled) { | ||
} | ||
// Attach 'pending' property if server supports it (CouchDB 2.0+) | ||
/* istanbul ignore if */ | ||
if (typeof pending === 'number') { | ||
pendingBatch.pending = pending; | ||
} | ||
var filter = pouchdbUtils.filterChange(opts)(change); | ||
@@ -517,3 +534,3 @@ if (!filter) { | ||
} | ||
pendingBatch.seq = change.seq; | ||
pendingBatch.seq = change.seq || lastSeq; | ||
pendingBatch.changes.push(change); | ||
@@ -630,2 +647,5 @@ processPendingBatch(batches.length === 0 && changesOpts.live); | ||
}; | ||
if (seq_interval !== false) { | ||
changesOpts.seq_interval = seq_interval || batch_size; | ||
} | ||
if (opts.filter) { | ||
@@ -1002,10 +1022,13 @@ if (typeof opts.filter !== 'string') { | ||
var self = this; | ||
return { | ||
from: function (other, opts, callback) { | ||
return self.constructor.replicate(other, self, opts, callback); | ||
}, | ||
to: function (other, opts, callback) { | ||
return self.constructor.replicate(self, other, opts, callback); | ||
} | ||
}; | ||
if (typeof this.replicateMethods === 'undefined') { | ||
this.replicateMethods = { | ||
from: function (other, opts, callback) { | ||
return self.constructor.replicate(other, self, opts, callback); | ||
}, | ||
to: function (other, opts, callback) { | ||
return self.constructor.replicate(self, other, opts, callback); | ||
} | ||
}; | ||
} | ||
return this.replicateMethods; | ||
} | ||
@@ -1012,0 +1035,0 @@ }); |
{ | ||
"name": "pouchdb-replication", | ||
"version": "6.3.4", | ||
"version": "6.4.0", | ||
"description": "PouchDB's replication and sync algorithm, as a plugin.", | ||
@@ -13,7 +13,7 @@ "main": "./lib/index.js", | ||
"inherits": "2.0.3", | ||
"pouchdb-checkpointer": "6.3.4", | ||
"pouchdb-errors": "6.3.4", | ||
"pouchdb-generate-replication-id": "6.3.4", | ||
"pouchdb-promise": "6.3.4", | ||
"pouchdb-utils": "6.3.4" | ||
"pouchdb-checkpointer": "6.4.0", | ||
"pouchdb-errors": "6.4.0", | ||
"pouchdb-generate-replication-id": "6.4.0", | ||
"pouchdb-promise": "6.4.0", | ||
"pouchdb-utils": "6.4.0" | ||
}, | ||
@@ -20,0 +20,0 @@ "module": "./lib/index.es.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
71695
7297
1842
+ Addedpouchdb-binary-utils@6.4.0(transitive)
+ Addedpouchdb-checkpointer@6.4.0(transitive)
+ Addedpouchdb-collate@6.4.0(transitive)
+ Addedpouchdb-collections@6.4.0(transitive)
+ Addedpouchdb-errors@6.4.0(transitive)
+ Addedpouchdb-generate-replication-id@6.4.0(transitive)
+ Addedpouchdb-md5@6.4.0(transitive)
+ Addedpouchdb-promise@6.4.0(transitive)
+ Addedpouchdb-utils@6.4.0(transitive)
- Removedpouchdb-binary-utils@6.3.4(transitive)
- Removedpouchdb-checkpointer@6.3.4(transitive)
- Removedpouchdb-collate@6.3.4(transitive)
- Removedpouchdb-collections@6.3.4(transitive)
- Removedpouchdb-errors@6.3.4(transitive)
- Removedpouchdb-generate-replication-id@6.3.4(transitive)
- Removedpouchdb-md5@6.3.4(transitive)
- Removedpouchdb-promise@6.3.4(transitive)
- Removedpouchdb-utils@6.3.4(transitive)
Updatedpouchdb-checkpointer@6.4.0
Updatedpouchdb-errors@6.4.0
Updatedpouchdb-promise@6.4.0
Updatedpouchdb-utils@6.4.0