@google-cloud/common
Advanced tools
Comparing version 0.16.2 to 0.17.0
{ | ||
"name": "@google-cloud/common", | ||
"description": "Common components for Cloud APIs Node.js Client Libraries", | ||
"version": "0.16.2", | ||
"version": "0.17.0", | ||
"license": "Apache-2.0", | ||
@@ -55,3 +55,3 @@ "author": "Google Inc.", | ||
"extend": "^3.0.1", | ||
"google-auto-auth": "^0.9.0", | ||
"google-auto-auth": "^0.10.0", | ||
"is": "^3.2.0", | ||
@@ -58,0 +58,0 @@ "log-driver": "1.2.7", |
@@ -66,11 +66,11 @@ /*! | ||
this.metadata = {}; | ||
util.privatize(this, 'metadata', {}); | ||
this.baseUrl = config.baseUrl; | ||
this.parent = config.parent; // Parent class. | ||
this.id = config.id; // Name or ID (e.g. dataset ID, bucket name, etc.) | ||
this.createMethod = config.createMethod; | ||
this.methods = config.methods || {}; | ||
this.interceptors = []; | ||
this.Promise = this.parent.Promise; | ||
util.privatize(this, 'baseUrl', config.baseUrl); | ||
util.privatize(this, 'parent', config.parent); // Parent class. | ||
util.privatize(this, 'id', config.id); // Name or ID (e.g. dataset ID, bucket name, etc.) | ||
util.privatize(this, 'createMethod', config.createMethod); | ||
util.privatize(this, 'methods', config.methods || {}); | ||
util.privatize(this, 'interceptors', []); | ||
util.privatize(this, 'Promise', this.parent.Promise); | ||
@@ -77,0 +77,0 @@ if (config.methods) { |
@@ -51,9 +51,9 @@ /*! | ||
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; | ||
util.privatize(this, 'baseUrl', config.baseUrl); | ||
util.privatize(this, 'globalInterceptors', arrify(options.interceptors_)); | ||
util.privatize(this, 'interceptors', []); | ||
util.privatize(this, 'packageJson', config.packageJson); | ||
util.privatize(this, 'projectId', options.projectId || PROJECT_ID_TOKEN); | ||
util.privatize(this, 'projectIdRequired', config.projectIdRequired !== false); | ||
util.privatize(this, 'Promise', options.promise || Promise); | ||
@@ -66,7 +66,16 @@ const reqCfg = extend({}, config, { | ||
email: options.email, | ||
token: options.token, | ||
}); | ||
this.makeAuthenticatedRequest = util.makeAuthenticatedRequestFactory(reqCfg); | ||
this.authClient = this.makeAuthenticatedRequest.authClient; | ||
this.getCredentials = this.makeAuthenticatedRequest.getCredentials; | ||
util.privatize( | ||
this, | ||
'makeAuthenticatedRequest', | ||
util.makeAuthenticatedRequestFactory(reqCfg) | ||
); | ||
util.privatize(this, 'authClient', this.makeAuthenticatedRequest.authClient); | ||
util.privatize( | ||
this, | ||
'getCredentials', | ||
this.makeAuthenticatedRequest.getCredentials | ||
); | ||
@@ -73,0 +82,0 @@ const isCloudFunctionEnv = !!process.env.FUNCTION_NAME; |
@@ -27,3 +27,2 @@ /** | ||
const extend = require('extend'); | ||
const format = require('string-format-obj'); | ||
const googleAuth = require('google-auto-auth'); | ||
@@ -46,19 +45,14 @@ const is = require('is'); | ||
const errorMessage = format( | ||
[ | ||
'Sorry, we cannot connect to Cloud Services without a project ID.', | ||
'You may specify one with an environment variable named "GCLOUD_PROJECT".', | ||
'See {baseUrl}/{path} for a detailed guide on creating an authenticated', | ||
'connection.', | ||
].join(' '), | ||
{ | ||
baseUrl: 'https://googlecloudplatform.github.io/google-cloud-node/#', | ||
path: 'docs/guides/authentication', | ||
/** | ||
* Custom error type for missing project ID errors. | ||
*/ | ||
util.MissingProjectIdError = createErrorClass( | ||
'MissingProjectIdError', | ||
function() { | ||
this.message = `Sorry, we cannot connect to Cloud Services without a project | ||
ID. You may specify one with an environment variable named | ||
"GOOGLE_CLOUD_PROJECT".`.replace(/ +/g, ' '); | ||
} | ||
); | ||
const missingProjectIdError = new Error(errorMessage); | ||
util.missingProjectIdError = missingProjectIdError; | ||
/** | ||
@@ -569,3 +563,3 @@ * No op. | ||
if (!projectId || projectId === '{{projectId}}') { | ||
throw util.missingProjectIdError; | ||
throw new util.MissingProjectIdError(); | ||
} | ||
@@ -827,1 +821,14 @@ value = value.replace(/{{projectId}}/g, projectId); | ||
util.promisifyAll = promisifyAll; | ||
/** | ||
* This will mask properties of an object from console.log. | ||
* | ||
* @param {object} object - The object to assign the property to. | ||
* @param {string} propName - Property name. | ||
* @param {*} value - Value. | ||
*/ | ||
function privatize(object, propName, value) { | ||
Object.defineProperty(object, propName, {value, writable: true}); | ||
} | ||
util.privatize = privatize; |
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
73882
1689
+ Addedgoogle-auto-auth@0.10.1(transitive)
- Removedgoogle-auto-auth@0.9.7(transitive)
Updatedgoogle-auto-auth@^0.10.0