Socket
Socket
Sign inDemoInstall

@google-cloud/common

Package Overview
Dependencies
Maintainers
1
Versions
118
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@google-cloud/common - npm Package Compare versions

Comparing version 3.2.0 to 3.3.0

6

build/src/service-object.d.ts

@@ -7,2 +7,4 @@ /// <reference types="node" />

export interface ServiceObjectParent {
interceptors: Interceptor[];
getRequestInterceptors(): Function[];
requestStream(reqOpts: DecorateRequestOptions): r.Request;

@@ -162,2 +164,6 @@ request(reqOpts: DecorateRequestOptions, callback: BodyResponseCallback): void;

/**
* Return the user's custom request interceptors.
*/
getRequestInterceptors(): Function[];
/**
* Set the metadata for this object.

@@ -164,0 +170,0 @@ *

18

build/src/service-object.js

@@ -66,8 +66,12 @@ "use strict";

if (config.methods) {
// This filters the ServiceObject instance (e.g. a "File") to only have
// the configured methods. We make a couple of exceptions for core-
// functionality ("request()" and "getRequestInterceptors()")
Object.getOwnPropertyNames(ServiceObject.prototype)
.filter(methodName => {
return (
// All ServiceObjects need `request`.
// All ServiceObjects need `request` and `getRequestInterceptors`.
// clang-format off
!/^request/.test(methodName) &&
!/^getRequestInterceptors/.test(methodName) &&
// clang-format on

@@ -193,2 +197,12 @@ // The ServiceObject didn't redefine the method.

}
/**
* Return the user's custom request interceptors.
*/
getRequestInterceptors() {
// Interceptors should be returned in the order they were assigned.
const localInterceptors = this.interceptors
.filter(interceptor => typeof interceptor.request === 'function')
.map(interceptor => interceptor.request);
return this.parent.getRequestInterceptors().concat(localInterceptors);
}
setMetadata(metadata, optionsOrCallback, cb) {

@@ -250,3 +264,3 @@ const [options, callback] = util_1.util.maybeOptionsOrCallback(optionsOrCallback, cb);

exports.ServiceObject = ServiceObject;
promisify_1.promisifyAll(ServiceObject);
promisify_1.promisifyAll(ServiceObject, { exclude: ['getRequestInterceptors'] });
//# sourceMappingURL=service-object.js.map

@@ -7,2 +7,9 @@ # Changelog

## [3.3.0](https://www.github.com/googleapis/nodejs-common/compare/v3.2.0...v3.3.0) (2020-06-29)
### Features
* add ServiceObject#getRequestInterceptors() ([#591](https://www.github.com/googleapis/nodejs-common/issues/591)) ([ade7e50](https://www.github.com/googleapis/nodejs-common/commit/ade7e50558e87b514adf48940f6e4413b2160b37))
## [3.2.0](https://www.github.com/googleapis/nodejs-common/compare/v3.1.1...v3.2.0) (2020-06-23)

@@ -9,0 +16,0 @@

4

package.json
{
"name": "@google-cloud/common",
"description": "Common components for Cloud APIs Node.js Client Libraries",
"version": "3.2.0",
"version": "3.3.0",
"license": "Apache-2.0",

@@ -64,3 +64,3 @@ "author": "Google Inc.",

"ncp": "^2.0.0",
"nock": "^12.0.3",
"nock": "^13.0.0",
"proxyquire": "^2.1.3",

@@ -67,0 +67,0 @@ "sinon": "^9.0.1",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc