google-cloud-bucket
Advanced tools
Comparing version 0.11.2 to 0.11.3
@@ -5,2 +5,12 @@ # Change Log | ||
<a name="0.11.3"></a> | ||
## [0.11.3](https://github.com/nicolasdao/google-cloud-bucket/compare/v0.11.2...v0.11.3) (2019-02-19) | ||
### Bug Fixes | ||
* Fail to add non truthy value to a file ([c16fe07](https://github.com/nicolasdao/google-cloud-bucket/commit/c16fe07)) | ||
<a name="0.11.2"></a> | ||
@@ -7,0 +17,0 @@ ## [0.11.2](https://github.com/nicolasdao/google-cloud-bucket/compare/v0.11.1...v0.11.2) (2019-02-12) |
20
index.js
@@ -36,2 +36,20 @@ /** | ||
const _retryPutFn = (fn, options={}) => retry( | ||
fn, | ||
res => { | ||
//console.log(`STATUS: ${res.status}`) | ||
if (res && res.status == 429) { | ||
//console.log('TOO MANY UPDATES') | ||
return false | ||
} else | ||
return true | ||
}, | ||
{ ignoreFailure: true, retryInterval: [800, 2000], timeOut: options.timeout || 10000 }) | ||
.catch(e => { | ||
if (options.retryCatch) | ||
return options.retryCatch(e) | ||
else | ||
throw e | ||
}) | ||
const _throwHttpErrorIfBadStatus = res => Promise.resolve(null).then(() => { | ||
@@ -85,3 +103,3 @@ if (res && res.status && res.status >= 400) { | ||
const putObject = (object, filePath, options) => getToken(auth).then(token => _retryFn(() => gcp.insert(object, filePath, token, options), options)) | ||
const putObject = (object, filePath, options) => getToken(auth).then(token => _retryPutFn(() => gcp.insert(object, filePath, token, options), options)) | ||
.then(_throwHttpErrorIfBadStatus) | ||
@@ -88,0 +106,0 @@ .then(({ data }) => data) |
{ | ||
"name": "google-cloud-bucket", | ||
"version": "0.11.2", | ||
"version": "0.11.3", | ||
"description": "Nodejs package to add objects to a Google Cloud Bucket.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -23,3 +23,3 @@ /** | ||
const _validateRequiredParams = (params={}) => Object.keys(params).forEach(p => { | ||
if (!params[p]) | ||
if (params[p] === null || params[p] === undefined) | ||
throw new Error(`Parameter '${p}' is required.`) | ||
@@ -26,0 +26,0 @@ }) |
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
88933
1426