pouchdb-validation
Advanced tools
Comparing version 1.0.1 to 1.0.2
13
index.js
@@ -23,2 +23,5 @@ /* | ||
var uuid = require("node-uuid"); | ||
var Promise = require("pouchdb-promise"); | ||
function oldDoc(db, id) { | ||
@@ -60,4 +63,2 @@ return db.get(id, {revs: true}).catch(function () { | ||
function doValidation(db, newDoc, options, callback) { | ||
var Promise = db.constructor.utils.Promise; | ||
var isHttp = ["http", "https"].indexOf(db.type()) !== -1; | ||
@@ -96,3 +97,2 @@ if (isHttp && !options.checkHttp) { | ||
var Promise = db.constructor.utils.Promise; | ||
var userCtxPromise; | ||
@@ -159,5 +159,4 @@ if (options.userCtx) { | ||
var args = processArgs(this, callback, options); | ||
var PouchDB = args.db.constructor; | ||
doc._id = doc._id || PouchDB.utils.uuid(); | ||
doc._id = doc._id || uuid.v4(); | ||
var promise = doValidation(args.db, doc, args.options).then(function () { | ||
@@ -186,4 +185,2 @@ return args.db.post(doc, args.options); | ||
var args = processArgs(this, callback, options); | ||
var PouchDB = args.db.constructor; | ||
var Promise = PouchDB.utils.Promise; | ||
@@ -194,3 +191,3 @@ var done = []; | ||
var validations = bulkDocs.docs.map(function (doc) { | ||
doc._id = doc._id || PouchDB.utils.uuid(); | ||
doc._id = doc._id || uuid.v4(); | ||
var validationPromise = doValidation(args.db, doc, args.options); | ||
@@ -197,0 +194,0 @@ |
{ | ||
"name": "pouchdb-validation", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"main": "index.js", | ||
@@ -12,3 +12,11 @@ "description": "A PouchDB plug-in that allows you to re-use your CouchDB validate_doc_update functions on the client side.", | ||
"bugs": "https://bugs.launchpad.net/python-pouchdb", | ||
"keywords": ["pouch", "pouchdb", "couch", "couchdb", "validation", "validate", "validate_doc_update"], | ||
"keywords": [ | ||
"pouch", | ||
"pouchdb", | ||
"couch", | ||
"couchdb", | ||
"validation", | ||
"validate", | ||
"validate_doc_update" | ||
], | ||
"license": "Apache-2.0", | ||
@@ -19,3 +27,5 @@ "author": "Marten de Vries", | ||
"couchdb-eval": "^1.0.0", | ||
"promise-nodify": "^1.0.0" | ||
"promise-nodify": "^1.0.0", | ||
"pouchdb-promise": "^0.0.0", | ||
"node-uuid": "^1.4.1" | ||
}, | ||
@@ -22,0 +32,0 @@ "devDependencies": { |
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
8807
5
214
+ Addednode-uuid@^1.4.1
+ Addedpouchdb-promise@^0.0.0