Comparing version 6.0.1 to 6.1.0
@@ -0,1 +1,5 @@ | ||
import { GaxiosOptions, GaxiosPromise } from 'gaxios'; | ||
export interface Transporter { | ||
request<T>(opts: GaxiosOptions): GaxiosPromise<T>; | ||
} | ||
export declare type GetTokenCallback = (err: Error | null, token?: TokenData) => void; | ||
@@ -22,2 +26,3 @@ export interface Credentials { | ||
eagerRefreshThresholdMillis?: number; | ||
transporter?: Transporter; | ||
} | ||
@@ -43,2 +48,3 @@ export interface GetTokenOptions { | ||
eagerRefreshThresholdMillis?: number; | ||
transporter: Transporter; | ||
private inFlightRequest?; | ||
@@ -45,0 +51,0 @@ /** |
@@ -44,2 +44,5 @@ "use strict"; | ||
constructor(options) { | ||
this.transporter = { | ||
request: opts => (0, gaxios_1.request)(opts), | ||
}; | ||
this.configure(options); | ||
@@ -190,3 +193,3 @@ } | ||
const url = GOOGLE_REVOKE_TOKEN_URL + this.accessToken; | ||
await (0, gaxios_1.request)({ url }); | ||
await this.transporter.request({ url }); | ||
this.configure({ | ||
@@ -219,2 +222,5 @@ email: this.iss, | ||
this.eagerRefreshThresholdMillis = options.eagerRefreshThresholdMillis; | ||
if (options.transporter) { | ||
this.transporter = options.transporter; | ||
} | ||
} | ||
@@ -242,3 +248,3 @@ /** | ||
try { | ||
const r = await (0, gaxios_1.request)({ | ||
const r = await this.transporter.request({ | ||
method: 'POST', | ||
@@ -245,0 +251,0 @@ url: GOOGLE_TOKEN_URL, |
@@ -7,2 +7,9 @@ # Changelog | ||
## [6.1.0](https://github.com/googleapis/node-gtoken/compare/v6.0.1...v6.1.0) (2022-06-28) | ||
### Features | ||
* allow customizing the http client ([#426](https://github.com/googleapis/node-gtoken/issues/426)) ([408ad04](https://github.com/googleapis/node-gtoken/commit/408ad048a2595313717bf427fc34aa29a6e7fb3c)) | ||
## [6.0.1](https://github.com/googleapis/node-gtoken/compare/v6.0.0...v6.0.1) (2022-06-07) | ||
@@ -9,0 +16,0 @@ |
{ | ||
"name": "gtoken", | ||
"version": "6.0.1", | ||
"version": "6.1.0", | ||
"description": "Node.js Google Authentication Service Account Tokens", | ||
@@ -5,0 +5,0 @@ "main": "./build/src/index.js", |
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
38297
378