@google-cloud/common
Advanced tools
Comparing version 3.1.1 to 3.2.0
@@ -66,2 +66,6 @@ import { GoogleAuth, GoogleAuthOptions } from 'google-auth-library'; | ||
/** | ||
* Return the user's custom request interceptors. | ||
*/ | ||
getRequestInterceptors(): Function[]; | ||
/** | ||
* Get and update the Service's project ID. | ||
@@ -68,0 +72,0 @@ * |
@@ -70,2 +70,13 @@ "use strict"; | ||
} | ||
/** | ||
* Return the user's custom request interceptors. | ||
*/ | ||
getRequestInterceptors() { | ||
// Interceptors should be returned in the order they were assigned. | ||
return [].slice | ||
.call(this.globalInterceptors) | ||
.concat(this.interceptors) | ||
.filter(interceptor => typeof interceptor.request === 'function') | ||
.map(interceptor => interceptor.request); | ||
} | ||
getProjectId(callback) { | ||
@@ -106,14 +117,11 @@ if (!callback) { | ||
.replace(/\/:/g, ':'); | ||
// Interceptors should be called in the order they were assigned. | ||
const combinedInterceptors = [].slice | ||
.call(this.globalInterceptors) | ||
.concat(this.interceptors) | ||
.concat(arrify(reqOpts.interceptors_)); | ||
let interceptor; | ||
while ( | ||
// tslint:disable-next-line:no-conditional-assignment | ||
(interceptor = combinedInterceptors.shift()) && | ||
interceptor.request) { | ||
reqOpts = interceptor.request(reqOpts); | ||
} | ||
const requestInterceptors = this.getRequestInterceptors(); | ||
arrify(reqOpts.interceptors_).forEach(interceptor => { | ||
if (typeof interceptor.request === 'function') { | ||
requestInterceptors.push(interceptor.request); | ||
} | ||
}); | ||
requestInterceptors.forEach(requestInterceptor => { | ||
reqOpts = requestInterceptor(reqOpts); | ||
}); | ||
delete reqOpts.interceptors_; | ||
@@ -120,0 +128,0 @@ const pkg = this.packageJson; |
@@ -7,2 +7,14 @@ # Changelog | ||
## [3.2.0](https://www.github.com/googleapis/nodejs-common/compare/v3.1.1...v3.2.0) (2020-06-23) | ||
### Features | ||
* expose method to get request interceptors ([#589](https://www.github.com/googleapis/nodejs-common/issues/589)) ([d01507f](https://www.github.com/googleapis/nodejs-common/commit/d01507f3fae41ffdffa2056bfb1aa40d97ffb653)) | ||
### Bug Fixes | ||
* **deps:** update dependency teeny-request to v7 ([#581](https://www.github.com/googleapis/nodejs-common/issues/581)) ([8d12007](https://www.github.com/googleapis/nodejs-common/commit/8d12007c5b43b8b6a679b0a925c05cb665d850b7)) | ||
### [3.1.1](https://www.github.com/googleapis/nodejs-common/compare/v3.1.0...v3.1.1) (2020-05-29) | ||
@@ -9,0 +21,0 @@ |
{ | ||
"name": "@google-cloud/common", | ||
"description": "Common components for Cloud APIs Node.js Client Libraries", | ||
"version": "3.1.1", | ||
"version": "3.2.0", | ||
"license": "Apache-2.0", | ||
@@ -43,3 +43,3 @@ "author": "Google Inc.", | ||
"retry-request": "^4.1.1", | ||
"teeny-request": "^6.0.3" | ||
"teeny-request": "^7.0.0" | ||
}, | ||
@@ -62,3 +62,3 @@ "devDependencies": { | ||
"linkinator": "^2.0.4", | ||
"mocha": "^7.1.1", | ||
"mocha": "^8.0.0", | ||
"mv": "^2.1.1", | ||
@@ -65,0 +65,0 @@ "ncp": "^2.0.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
115736
1818
+ Added@tootallnate/once@2.0.0(transitive)
+ Addedhttp-proxy-agent@5.0.0(transitive)
+ Addedteeny-request@7.2.0(transitive)
+ Addeduuid@8.3.2(transitive)
- Removed@tootallnate/once@1.1.2(transitive)
- Removedhttp-proxy-agent@4.0.1(transitive)
- Removedteeny-request@6.0.3(transitive)
- Removeduuid@7.0.3(transitive)
Updatedteeny-request@^7.0.0