pouchdb-replication
Advanced tools
Comparing version 8.0.1 to 9.0.0
import Checkpointer from 'pouchdb-checkpointer'; | ||
import generateReplicationId from 'pouchdb-generate-replication-id'; | ||
import { createError, BAD_REQUEST } from 'pouchdb-errors'; | ||
import { clone, flatten, isRemote, defaultBackOff, filterChange, nextTick, uuid, assign } from 'pouchdb-utils'; | ||
import EE from 'events'; | ||
import { clone, isRemote, defaultBackOff, filterChange, nextTick, uuid } from 'pouchdb-utils'; | ||
@@ -52,3 +52,3 @@ function fileHasChanged(localDoc, remoteDoc, filename) { | ||
requests.push({ | ||
id: id, | ||
id, | ||
rev: missingRev | ||
@@ -105,15 +105,13 @@ }); | ||
return getDocAttachmentsFromTargetOrSource(target, src, remoteDoc) | ||
.then(function (attachments) { | ||
var filenames = Object.keys(remoteDoc._attachments); | ||
attachments | ||
.forEach(function (attachment, i) { | ||
var att = remoteDoc._attachments[filenames[i]]; | ||
delete att.stub; | ||
delete att.length; | ||
att.data = attachment; | ||
}); | ||
return getDocAttachmentsFromTargetOrSource(target, src, remoteDoc).then((attachments) => { | ||
var filenames = Object.keys(remoteDoc._attachments); | ||
attachments.forEach(function (attachment, i) { | ||
var att = remoteDoc._attachments[filenames[i]]; | ||
delete att.stub; | ||
delete att.length; | ||
att.data = attachment; | ||
}); | ||
return remoteDoc; | ||
}); | ||
return remoteDoc; | ||
}); | ||
})); | ||
@@ -123,3 +121,3 @@ })) | ||
.then(function (results) { | ||
resultDocs = resultDocs.concat(flatten(results).filter(Boolean)); | ||
resultDocs = resultDocs.concat(results.flat().filter(Boolean)); | ||
}); | ||
@@ -130,3 +128,3 @@ }); | ||
function returnResult() { | ||
return { ok:ok, docs:resultDocs }; | ||
return { ok, docs:resultDocs }; | ||
} | ||
@@ -242,3 +240,3 @@ | ||
var bulkOpts = {timeout: opts.timeout}; | ||
return target.bulkDocs({docs: docs, new_edits: false}, bulkOpts).then(function (res) { | ||
return target.bulkDocs({docs, new_edits: false}, bulkOpts).then(function (res) { | ||
/* istanbul ignore if */ | ||
@@ -632,6 +630,6 @@ if (returnValue.cancelled) { | ||
limit: batch_size, | ||
batch_size: batch_size, | ||
style: style, | ||
doc_ids: doc_ids, | ||
selector: selector, | ||
batch_size, | ||
style, | ||
doc_ids, | ||
selector, | ||
return_docs: true // required so we know when we're done | ||
@@ -742,3 +740,3 @@ }; | ||
this._readyCalled = true; | ||
const onDestroy = () => { | ||
@@ -786,3 +784,2 @@ this.cancel(); | ||
opts.retry = ('retry' in opts) ? opts.retry : false; | ||
/*jshint validthis:true */ | ||
opts.PouchConstructor = opts.PouchConstructor || this; | ||
@@ -805,3 +802,2 @@ var replicateRet = new Replication(opts); | ||
opts = clone(opts); | ||
/*jshint validthis:true */ | ||
opts.PouchConstructor = opts.PouchConstructor || this; | ||
@@ -818,4 +814,4 @@ src = toPouch(src, opts); | ||
const optsPush = opts.push ? assign({}, opts, opts.push) : opts; | ||
const optsPull = opts.pull ? assign({}, opts, opts.pull) : opts; | ||
const optsPush = opts.push ? Object.assign({}, opts, opts.push) : opts; | ||
const optsPull = opts.pull ? Object.assign({}, opts, opts.pull) : opts; | ||
@@ -831,3 +827,3 @@ this.push = replicateWrapper(src, target, optsPush); | ||
direction: 'pull', | ||
change: change | ||
change | ||
}); | ||
@@ -838,3 +834,3 @@ }; | ||
direction: 'push', | ||
change: change | ||
change | ||
}); | ||
@@ -845,3 +841,3 @@ }; | ||
direction: 'push', | ||
doc: doc | ||
doc | ||
}); | ||
@@ -852,3 +848,3 @@ }; | ||
direction: 'pull', | ||
doc: doc | ||
doc | ||
}); | ||
@@ -855,0 +851,0 @@ }; |
@@ -8,4 +8,4 @@ 'use strict'; | ||
var pouchdbErrors = require('pouchdb-errors'); | ||
var EE = _interopDefault(require('events')); | ||
var pouchdbUtils = require('pouchdb-utils'); | ||
var EE = _interopDefault(require('events')); | ||
@@ -57,3 +57,3 @@ function fileHasChanged(localDoc, remoteDoc, filename) { | ||
requests.push({ | ||
id: id, | ||
id, | ||
rev: missingRev | ||
@@ -110,15 +110,13 @@ }); | ||
return getDocAttachmentsFromTargetOrSource(target, src, remoteDoc) | ||
.then(function (attachments) { | ||
var filenames = Object.keys(remoteDoc._attachments); | ||
attachments | ||
.forEach(function (attachment, i) { | ||
var att = remoteDoc._attachments[filenames[i]]; | ||
delete att.stub; | ||
delete att.length; | ||
att.data = attachment; | ||
}); | ||
return getDocAttachmentsFromTargetOrSource(target, src, remoteDoc).then((attachments) => { | ||
var filenames = Object.keys(remoteDoc._attachments); | ||
attachments.forEach(function (attachment, i) { | ||
var att = remoteDoc._attachments[filenames[i]]; | ||
delete att.stub; | ||
delete att.length; | ||
att.data = attachment; | ||
}); | ||
return remoteDoc; | ||
}); | ||
return remoteDoc; | ||
}); | ||
})); | ||
@@ -128,3 +126,3 @@ })) | ||
.then(function (results) { | ||
resultDocs = resultDocs.concat(pouchdbUtils.flatten(results).filter(Boolean)); | ||
resultDocs = resultDocs.concat(results.flat().filter(Boolean)); | ||
}); | ||
@@ -135,3 +133,3 @@ }); | ||
function returnResult() { | ||
return { ok:ok, docs:resultDocs }; | ||
return { ok, docs:resultDocs }; | ||
} | ||
@@ -247,3 +245,3 @@ | ||
var bulkOpts = {timeout: opts.timeout}; | ||
return target.bulkDocs({docs: docs, new_edits: false}, bulkOpts).then(function (res) { | ||
return target.bulkDocs({docs, new_edits: false}, bulkOpts).then(function (res) { | ||
/* istanbul ignore if */ | ||
@@ -637,6 +635,6 @@ if (returnValue.cancelled) { | ||
limit: batch_size, | ||
batch_size: batch_size, | ||
style: style, | ||
doc_ids: doc_ids, | ||
selector: selector, | ||
batch_size, | ||
style, | ||
doc_ids, | ||
selector, | ||
return_docs: true // required so we know when we're done | ||
@@ -747,3 +745,3 @@ }; | ||
this._readyCalled = true; | ||
const onDestroy = () => { | ||
@@ -791,3 +789,2 @@ this.cancel(); | ||
opts.retry = ('retry' in opts) ? opts.retry : false; | ||
/*jshint validthis:true */ | ||
opts.PouchConstructor = opts.PouchConstructor || this; | ||
@@ -810,3 +807,2 @@ var replicateRet = new Replication(opts); | ||
opts = pouchdbUtils.clone(opts); | ||
/*jshint validthis:true */ | ||
opts.PouchConstructor = opts.PouchConstructor || this; | ||
@@ -823,4 +819,4 @@ src = toPouch(src, opts); | ||
const optsPush = opts.push ? pouchdbUtils.assign({}, opts, opts.push) : opts; | ||
const optsPull = opts.pull ? pouchdbUtils.assign({}, opts, opts.pull) : opts; | ||
const optsPush = opts.push ? Object.assign({}, opts, opts.push) : opts; | ||
const optsPull = opts.pull ? Object.assign({}, opts, opts.pull) : opts; | ||
@@ -836,3 +832,3 @@ this.push = replicateWrapper(src, target, optsPush); | ||
direction: 'pull', | ||
change: change | ||
change | ||
}); | ||
@@ -843,3 +839,3 @@ }; | ||
direction: 'push', | ||
change: change | ||
change | ||
}); | ||
@@ -850,3 +846,3 @@ }; | ||
direction: 'push', | ||
doc: doc | ||
doc | ||
}); | ||
@@ -857,3 +853,3 @@ }; | ||
direction: 'pull', | ||
doc: doc | ||
doc | ||
}); | ||
@@ -860,0 +856,0 @@ }; |
{ | ||
"name": "pouchdb-replication", | ||
"version": "8.0.1", | ||
"version": "9.0.0", | ||
"description": "PouchDB's replication and sync algorithm, as a plugin.", | ||
@@ -14,15 +14,13 @@ "main": "./lib/index.js", | ||
}, | ||
"jsnext:main": "./lib/index.es.js", | ||
"module": "./lib/index.es.js", | ||
"dependencies": { | ||
"pouchdb-checkpointer": "8.0.1", | ||
"pouchdb-errors": "8.0.1", | ||
"pouchdb-generate-replication-id": "8.0.1", | ||
"pouchdb-utils": "8.0.1" | ||
"pouchdb-checkpointer": "9.0.0", | ||
"pouchdb-errors": "9.0.0", | ||
"pouchdb-generate-replication-id": "9.0.0", | ||
"pouchdb-utils": "9.0.0" | ||
}, | ||
"module": "./lib/index.es.js", | ||
"files": [ | ||
"lib", | ||
"dist", | ||
"tonic-example.js" | ||
"dist" | ||
] | ||
} |
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
71979
1828
+ Addedpouchdb-binary-utils@9.0.0(transitive)
+ Addedpouchdb-checkpointer@9.0.0(transitive)
+ Addedpouchdb-collate@9.0.0(transitive)
+ Addedpouchdb-errors@9.0.0(transitive)
+ Addedpouchdb-generate-replication-id@9.0.0(transitive)
+ Addedpouchdb-md5@9.0.0(transitive)
+ Addedpouchdb-utils@9.0.0(transitive)
- Removedbuffer-from@1.1.2(transitive)
- Removedclone-buffer@1.0.0(transitive)
- Removedimmediate@3.3.0(transitive)
- Removedpouchdb-binary-utils@8.0.1(transitive)
- Removedpouchdb-checkpointer@8.0.1(transitive)
- Removedpouchdb-collate@8.0.1(transitive)
- Removedpouchdb-collections@8.0.1(transitive)
- Removedpouchdb-errors@8.0.1(transitive)
- Removedpouchdb-generate-replication-id@8.0.1(transitive)
- Removedpouchdb-md5@8.0.1(transitive)
- Removedpouchdb-utils@8.0.1(transitive)
Updatedpouchdb-checkpointer@9.0.0
Updatedpouchdb-errors@9.0.0
Updatedpouchdb-utils@9.0.0