Comparing version 0.0.4 to 0.0.5
@@ -5,3 +5,3 @@ { | ||
"author": "Dale Harvey", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"main": "./src/pouch.js", | ||
@@ -8,0 +8,0 @@ "homepage": "https://github.com/daleharvey/pouchdb", |
@@ -953,3 +953,6 @@ // While most of the IDB behaviors match between implementations a | ||
IdbPouch.valid = function idb_valid() { | ||
return !!window.indexedDB; | ||
if (!document.location.host) { | ||
console.warn('indexedDB cannot be used in pages served from the filesystem'); | ||
} | ||
return !!window.indexedDB && !!document.location.host; | ||
}; | ||
@@ -956,0 +959,0 @@ |
@@ -93,2 +93,7 @@ var Pouch = this.Pouch = function Pouch(name, opts, callback) { | ||
}, | ||
RESERVED_ID: { | ||
status: 400, | ||
error: 'bad_request', | ||
reason: 'Only reserved document ids may start with underscore.' | ||
}, | ||
UNKNOWN_ERROR: { | ||
@@ -95,0 +100,0 @@ status: 500, |
@@ -42,2 +42,12 @@ // Pretty dumb name for a function, just wraps callback calls so we dont | ||
// Determine id an ID is valid | ||
// - invalid IDs begin with an underescore that does not begin '_design' or '_local' | ||
// - any other string value is a valid id | ||
var isValidId = function(id) { | ||
if (/^_/.test(id)) { | ||
return /^_(design|local)/.test(id); | ||
} | ||
return true; | ||
} | ||
// Preprocess documents, parse their revisions, assign an id and a | ||
@@ -118,2 +128,5 @@ // revision for new writes that are missing them, etc | ||
} | ||
else if (!isValidId(doc._id)) { | ||
error = Pouch.Errors.RESERVED_ID; | ||
} | ||
@@ -332,2 +345,6 @@ | ||
} | ||
if (options.auth) { | ||
var token = btoa(options.auth.username + ':' + options.auth.password); | ||
options.headers['Authorization'] = 'Basic ' + token; | ||
} | ||
@@ -334,0 +351,0 @@ return request(options, function(err, response, body) { |
Sorry, the diff of this file is not supported yet
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
241874
3664