Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@google-cloud/common

Package Overview
Dependencies
Maintainers
13
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 0.13.6 to 0.14.0

2

package.json
{
"name": "@google-cloud/common",
"version": "0.13.6",
"version": "0.14.0",
"author": "Google Inc.",

@@ -5,0 +5,0 @@ "description": "Common components for Cloud APIs Node.js Client Libraries",

@@ -51,3 +51,13 @@ /*!

this.baseUrl = config.baseUrl;
this.globalInterceptors = arrify(options.interceptors_);
this.interceptors = [];
this.packageJson = config.packageJson;
this.projectId = options.projectId || PROJECT_ID_TOKEN;
this.projectIdRequired = config.projectIdRequired !== false;
this.Promise = options.promise || Promise;
var reqCfg = extend({}, config, {
projectIdRequired: this.projectIdRequired,
projectId: this.projectId,
credentials: options.credentials,

@@ -60,10 +70,3 @@ keyFile: options.keyFilename,

this.authClient = this.makeAuthenticatedRequest.authClient;
this.baseUrl = config.baseUrl;
this.getCredentials = this.makeAuthenticatedRequest.getCredentials;
this.globalInterceptors = arrify(options.interceptors_);
this.interceptors = [];
this.packageJson = config.packageJson;
this.projectId = options.projectId || PROJECT_ID_TOKEN;
this.projectIdRequired = config.projectIdRequired !== false;
this.Promise = options.promise || Promise;

@@ -70,0 +73,0 @@ var isCloudFunctionEnv = !!process.env.FUNCTION_NAME;

@@ -349,10 +349,29 @@ /**

function onAuthenticated(err, authenticatedReqOpts) {
if (!err) {
var autoAuthFailed =
err &&
err.message.indexOf('Could not load the default credentials') > -1;
if (autoAuthFailed) {
// Even though authentication failed, the API might not actually care.
authenticatedReqOpts = reqOpts;
}
if (!err || autoAuthFailed) {
var projectId = authClient.projectId;
if (config.projectId && config.projectId !== '{{projectId}}') {
projectId = config.projectId;
}
try {
authenticatedReqOpts = util.decorateRequest(
authenticatedReqOpts,
extend({ projectId: authClient.projectId }, config)
projectId
);
err = null;
} catch(e) {
err = e;
// A projectId was required, but we don't have one.
// Re-use the "Could not load the default credentials error" if auto
// auth failed.
err = err || e;
}

@@ -477,8 +496,6 @@ }

* @param {object} reqOpts - The options to be passed to `request`.
* @param {object} config - Service config.
* @param {string} projectId - The project ID.
* @return {object} reqOpts - The decorated reqOpts.
*/
function decorateRequest(reqOpts, config) {
config = config || {};
function decorateRequest(reqOpts, projectId) {
delete reqOpts.autoPaginate;

@@ -491,3 +508,3 @@ delete reqOpts.autoPaginateVal;

delete reqOpts.qs.autoPaginateVal;
reqOpts.qs = util.replaceProjectIdToken(reqOpts.qs, config.projectId);
reqOpts.qs = util.replaceProjectIdToken(reqOpts.qs, projectId);
}

@@ -498,6 +515,6 @@

delete reqOpts.json.autoPaginateVal;
reqOpts.json = util.replaceProjectIdToken(reqOpts.json, config.projectId);
reqOpts.json = util.replaceProjectIdToken(reqOpts.json, projectId);
}
reqOpts.uri = util.replaceProjectIdToken(reqOpts.uri, config.projectId);
reqOpts.uri = util.replaceProjectIdToken(reqOpts.uri, projectId);

@@ -535,3 +552,3 @@ return reqOpts;

if (is.string(value) && value.indexOf('{{projectId}}') > -1) {
if (!projectId) {
if (!projectId || projectId === '{{projectId}}') {
throw util.missingProjectIdError;

@@ -538,0 +555,0 @@ }

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