pouchdb-checkpointer
Advanced tools
Comparing version
@@ -8,3 +8,3 @@ import { explainError } from 'pouchdb-utils'; | ||
// amount of replication history we save in the checkpoint. | ||
// If we save too much, the checkpoing docs will become very big, | ||
// If we save too much, the checkpoint docs will become very big, | ||
// if we save fewer, we'll run a greater risk of having to | ||
@@ -77,3 +77,6 @@ // read all the changes from 0 when checkpoint PUTs fail | ||
class CheckpointerInternal { | ||
constructor(src, target, id, returnValue, opts) { | ||
constructor(src, target, id, returnValue, opts = { | ||
writeSourceCheckpoint: true, | ||
writeTargetCheckpoint: true, | ||
}) { | ||
this.src = src; | ||
@@ -83,3 +86,11 @@ this.target = target; | ||
this.returnValue = returnValue; | ||
this.opts = opts || {}; | ||
this.opts = opts; | ||
if (typeof opts.writeSourceCheckpoint === "undefined") { | ||
opts.writeSourceCheckpoint = true; | ||
} | ||
if (typeof opts.writeTargetCheckpoint === "undefined") { | ||
opts.writeTargetCheckpoint = true; | ||
} | ||
} | ||
@@ -122,3 +133,7 @@ | ||
var self = this; | ||
if (!self.opts.writeSourceCheckpoint && !self.opts.writeTargetCheckpoint) { | ||
return Promise.resolve(LOWEST_SEQ); | ||
} | ||
if (self.opts && self.opts.writeSourceCheckpoint && !self.opts.writeTargetCheckpoint) { | ||
@@ -135,3 +150,3 @@ return self.src.get(self.id).then(function (sourceDoc) { | ||
} | ||
return self.target.get(self.id).then(function (targetDoc) { | ||
@@ -141,3 +156,3 @@ if (self.opts && self.opts.writeTargetCheckpoint && !self.opts.writeSourceCheckpoint) { | ||
} | ||
return self.src.get(self.id).then(function (sourceDoc) { | ||
@@ -150,3 +165,3 @@ // Since we can't migrate an old version doc to a new one | ||
} | ||
var version; | ||
@@ -158,3 +173,3 @@ if (targetDoc.version) { | ||
} | ||
if (version in comparisons) { | ||
@@ -161,0 +176,0 @@ return comparisons[version](targetDoc, sourceDoc); |
@@ -10,3 +10,3 @@ 'use strict'; | ||
// amount of replication history we save in the checkpoint. | ||
// If we save too much, the checkpoing docs will become very big, | ||
// If we save too much, the checkpoint docs will become very big, | ||
// if we save fewer, we'll run a greater risk of having to | ||
@@ -79,3 +79,6 @@ // read all the changes from 0 when checkpoint PUTs fail | ||
class CheckpointerInternal { | ||
constructor(src, target, id, returnValue, opts) { | ||
constructor(src, target, id, returnValue, opts = { | ||
writeSourceCheckpoint: true, | ||
writeTargetCheckpoint: true, | ||
}) { | ||
this.src = src; | ||
@@ -85,3 +88,11 @@ this.target = target; | ||
this.returnValue = returnValue; | ||
this.opts = opts || {}; | ||
this.opts = opts; | ||
if (typeof opts.writeSourceCheckpoint === "undefined") { | ||
opts.writeSourceCheckpoint = true; | ||
} | ||
if (typeof opts.writeTargetCheckpoint === "undefined") { | ||
opts.writeTargetCheckpoint = true; | ||
} | ||
} | ||
@@ -124,3 +135,7 @@ | ||
var self = this; | ||
if (!self.opts.writeSourceCheckpoint && !self.opts.writeTargetCheckpoint) { | ||
return Promise.resolve(LOWEST_SEQ); | ||
} | ||
if (self.opts && self.opts.writeSourceCheckpoint && !self.opts.writeTargetCheckpoint) { | ||
@@ -137,3 +152,3 @@ return self.src.get(self.id).then(function (sourceDoc) { | ||
} | ||
return self.target.get(self.id).then(function (targetDoc) { | ||
@@ -143,3 +158,3 @@ if (self.opts && self.opts.writeTargetCheckpoint && !self.opts.writeSourceCheckpoint) { | ||
} | ||
return self.src.get(self.id).then(function (sourceDoc) { | ||
@@ -152,3 +167,3 @@ // Since we can't migrate an old version doc to a new one | ||
} | ||
var version; | ||
@@ -160,3 +175,3 @@ if (targetDoc.version) { | ||
} | ||
if (version in comparisons) { | ||
@@ -163,0 +178,0 @@ return comparisons[version](targetDoc, sourceDoc); |
{ | ||
"name": "pouchdb-checkpointer", | ||
"version": "8.0.1", | ||
"version": "9.0.0", | ||
"description": "PouchDB tool to write a checkpoint, e.g. during replication.", | ||
@@ -14,13 +14,11 @@ "main": "./lib/index.js", | ||
}, | ||
"jsnext:main": "./lib/index.es.js", | ||
"module": "./lib/index.es.js", | ||
"dependencies": { | ||
"pouchdb-collate": "8.0.1", | ||
"pouchdb-utils": "8.0.1" | ||
"pouchdb-collate": "9.0.0", | ||
"pouchdb-utils": "9.0.0" | ||
}, | ||
"module": "./lib/index.es.js", | ||
"files": [ | ||
"lib", | ||
"dist", | ||
"tonic-example.js" | ||
"dist" | ||
] | ||
} |
28848
2.66%505
4.99%+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
Updated
Updated