@google-cloud/common
Advanced tools
Comparing version 3.9.0 to 3.10.0
@@ -1,2 +0,2 @@ | ||
import { GoogleAuth, GoogleAuthOptions } from 'google-auth-library'; | ||
import { AuthClient, GoogleAuth, GoogleAuthOptions } from 'google-auth-library'; | ||
import * as r from 'teeny-request'; | ||
@@ -25,8 +25,8 @@ import { Interceptor } from './service-object'; | ||
/** | ||
* Reuse an existing GoogleAuth client instead of creating a new one. | ||
* Reuse an existing `AuthClient` or `GoogleAuth` client instead of creating a new one. | ||
*/ | ||
authClient?: GoogleAuth; | ||
authClient?: AuthClient | GoogleAuth; | ||
} | ||
export interface ServiceOptions extends GoogleAuthOptions { | ||
authClient?: GoogleAuth; | ||
export interface ServiceOptions extends Omit<GoogleAuthOptions, 'authClient'> { | ||
authClient?: AuthClient | GoogleAuth; | ||
interceptors_?: Interceptor[]; | ||
@@ -48,3 +48,3 @@ email?: string; | ||
makeAuthenticatedRequest: MakeAuthenticatedRequest; | ||
authClient: GoogleAuth; | ||
authClient: GoogleAuth<AuthClient>; | ||
private getCredentials; | ||
@@ -51,0 +51,0 @@ readonly apiEndpoint: string; |
/// <reference types="node" /> | ||
import { GoogleAuth, GoogleAuthOptions } from 'google-auth-library'; | ||
import { AuthClient, GoogleAuth, GoogleAuthOptions } from 'google-auth-library'; | ||
import { CredentialBody } from 'google-auth-library'; | ||
@@ -32,3 +32,3 @@ import * as r from 'teeny-request'; | ||
getCredentials: (callback: (err?: Error | null, credentials?: CredentialBody) => void) => void; | ||
authClient: GoogleAuth; | ||
authClient: GoogleAuth<AuthClient>; | ||
} | ||
@@ -43,3 +43,3 @@ export interface Abortable { | ||
} | ||
export interface MakeAuthenticatedRequestFactoryConfig extends GoogleAuthOptions { | ||
export interface MakeAuthenticatedRequestFactoryConfig extends Omit<GoogleAuthOptions, 'authClient'> { | ||
/** | ||
@@ -70,6 +70,6 @@ * Automatically retry requests if the response is related to rate limits or | ||
/** | ||
* A pre-instantiated GoogleAuth client that should be used. | ||
* A pre-instantiated `AuthClient` or `GoogleAuth` client that should be used. | ||
* A new will be created if this is not set. | ||
*/ | ||
authClient?: GoogleAuth; | ||
authClient?: AuthClient | GoogleAuth; | ||
} | ||
@@ -76,0 +76,0 @@ export interface MakeAuthenticatedRequestOptions { |
@@ -323,3 +323,15 @@ "use strict"; | ||
} | ||
const authClient = googleAutoAuthConfig.authClient || new google_auth_library_1.GoogleAuth(googleAutoAuthConfig); | ||
let authClient; | ||
if (googleAutoAuthConfig.authClient instanceof google_auth_library_1.GoogleAuth) { | ||
// Use an existing `GoogleAuth` | ||
authClient = googleAutoAuthConfig.authClient; | ||
} | ||
else { | ||
// Pass an `AuthClient` to `GoogleAuth`, if available | ||
const config = { | ||
...googleAutoAuthConfig, | ||
authClient: googleAutoAuthConfig.authClient, | ||
}; | ||
authClient = new google_auth_library_1.GoogleAuth(config); | ||
} | ||
function makeAuthenticatedRequest(reqOpts, optionsOrCallback) { | ||
@@ -326,0 +338,0 @@ let stream; |
@@ -7,2 +7,9 @@ # Changelog | ||
## [3.10.0](https://github.com/googleapis/nodejs-common/compare/v3.9.0...v3.10.0) (2022-02-22) | ||
### Features | ||
* Support `AuthClient` for `authClient` ([#732](https://github.com/googleapis/nodejs-common/issues/732)) ([d4c39f3](https://github.com/googleapis/nodejs-common/commit/d4c39f385ea715c79f9bae1853748700dc96c152)) | ||
## [3.9.0](https://github.com/googleapis/nodejs-common/compare/v3.8.1...v3.9.0) (2022-01-19) | ||
@@ -9,0 +16,0 @@ |
{ | ||
"name": "@google-cloud/common", | ||
"description": "Common components for Cloud APIs Node.js Client Libraries", | ||
"version": "3.9.0", | ||
"version": "3.10.0", | ||
"license": "Apache-2.0", | ||
@@ -41,3 +41,3 @@ "author": "Google Inc.", | ||
"extend": "^3.0.2", | ||
"google-auth-library": "^7.9.2", | ||
"google-auth-library": "^7.14.0", | ||
"retry-request": "^4.2.2", | ||
@@ -67,3 +67,3 @@ "teeny-request": "^7.0.0" | ||
"proxyquire": "^2.1.3", | ||
"sinon": "^12.0.0", | ||
"sinon": "^13.0.0", | ||
"tmp": "0.2.1", | ||
@@ -70,0 +70,0 @@ "typescript": "~3.8.3" |
@@ -61,18 +61,18 @@ [//]: # "This README.md file is auto-generated, all changes to this file will be lost." | ||
Node.js. | ||
If you are using an end-of-life version of Node.js, we recommend that you update | ||
as soon as possible to an actively supported LTS version. | ||
Google's client libraries support legacy versions of Node.js runtimes on a | ||
best-efforts basis with the following warnings: | ||
* Legacy versions are not tested in continuous integration. | ||
* Some security patches and features cannot be backported. | ||
* Dependencies cannot be kept up-to-date. | ||
Client libraries targeting some end-of-life versions of Node.js are available, and | ||
can be installed via npm [dist-tags](https://docs.npmjs.com/cli/dist-tag). | ||
can be installed through npm [dist-tags](https://docs.npmjs.com/cli/dist-tag). | ||
The dist-tags follow the naming convention `legacy-(version)`. | ||
For example, `npm install @google-cloud/common@legacy-8` installs client libraries | ||
for versions compatible with Node.js 8. | ||
_Legacy Node.js versions are supported as a best effort:_ | ||
* Legacy versions will not be tested in continuous integration. | ||
* Some security patches may not be able to be backported. | ||
* Dependencies will not be kept up-to-date, and features will not be backported. | ||
#### Legacy tags available | ||
* `legacy-8`: install client libraries from this dist-tag for versions | ||
compatible with Node.js 8. | ||
## Versioning | ||
@@ -79,0 +79,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
127569
1942
Updatedgoogle-auth-library@^7.14.0