couchdb-worker
Advanced tools
Comparing version 3.0.0 to 3.1.0
@@ -148,3 +148,3 @@ /* | ||
options.process(doc, function(err) { | ||
options.process(doc, db, function(err) { | ||
if (err) { | ||
@@ -151,0 +151,0 @@ statusDiff.failed++; |
{ | ||
"name": "couchdb-worker", | ||
"description": "CouchDB worker module that manages state", | ||
"version": "3.0.0", | ||
"version": "3.1.0", | ||
"homepage": "https://github.com/jo/couchdb-worker", | ||
@@ -6,0 +6,0 @@ "author": { |
@@ -12,5 +12,5 @@ # couchdb-worker | ||
db: 'http://localhost:5984/mydb', | ||
process: function(doc, done) { | ||
// do something with the doc | ||
done(null); | ||
process: function(doc, db, done) { | ||
doc.computed_value = Math.random(); | ||
db.insert(doc, done); | ||
} | ||
@@ -91,5 +91,5 @@ }; | ||
} | ||
process: function(doc, done) { | ||
// do something with the doc | ||
done(null); | ||
process: function(doc, db, done) { | ||
doc.computed_value = Math.random(); | ||
db.insert(doc, done); | ||
} | ||
@@ -142,2 +142,3 @@ }); | ||
## Release History | ||
* `3.1.0`: process function receives db object | ||
* `3.0.0`: return function (`worker.listen(config)` -> `worker(config).listen()`) | ||
@@ -144,0 +145,0 @@ * `2.0.0`: do not store worker status in documents, store lock in extra documents |
@@ -100,5 +100,7 @@ 'use strict'; | ||
var w; | ||
function process(doc, next) { | ||
function process(doc, db, next) { | ||
test.equal(typeof doc, 'object', 'doc should be an object'); | ||
test.equal(doc._id, 'mydoc', 'doc _id should be `mydoc`'); | ||
test.equal(typeof db, 'object', 'db should be an object'); | ||
test.equal(typeof db.info, 'function', 'ducktyping: db should have info function'); | ||
test.equal(typeof next, 'function', 'next should be a function'); | ||
@@ -136,3 +138,3 @@ w.stop(); | ||
'complete': function(test) { | ||
function process(doc, next) { | ||
function process(doc, db, next) { | ||
next(null); | ||
@@ -153,3 +155,3 @@ } | ||
var error = 'this is an error'; | ||
function process(doc, next) { | ||
function process(doc, db, next) { | ||
next(error); | ||
@@ -175,3 +177,3 @@ } | ||
'worker status': function(test) { | ||
function process(doc, next) { | ||
function process(doc, db, next) { | ||
next(null); | ||
@@ -178,0 +180,0 @@ } |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
17330
341
151
0