google-auth-library
Advanced tools
Comparing version 8.9.0 to 9.0.0
/// <reference types="node" /> | ||
import { EventEmitter } from 'events'; | ||
import { GaxiosOptions, GaxiosPromise, GaxiosResponse } from 'gaxios'; | ||
import { DefaultTransporter } from '../transporters'; | ||
import { Transporter } from '../transporters'; | ||
import { Credentials } from './credentials'; | ||
@@ -69,3 +69,3 @@ import { Headers } from './oauth2client'; | ||
quotaProjectId?: string; | ||
transporter: DefaultTransporter; | ||
transporter: Transporter; | ||
credentials: Credentials; | ||
@@ -72,0 +72,0 @@ projectId?: string | null; |
@@ -17,3 +17,2 @@ "use strict"; | ||
exports.Compute = void 0; | ||
const arrify = require("arrify"); | ||
const gaxios_1 = require("gaxios"); | ||
@@ -35,3 +34,7 @@ const gcpMetadata = require("gcp-metadata"); | ||
this.serviceAccountEmail = options.serviceAccountEmail || 'default'; | ||
this.scopes = arrify(options.scopes); | ||
this.scopes = Array.isArray(options.scopes) | ||
? options.scopes | ||
: options.scopes | ||
? [options.scopes] | ||
: []; | ||
} | ||
@@ -98,3 +101,3 @@ /** | ||
if (res && res.status) { | ||
e.code = res.status.toString(); | ||
e.status = res.status; | ||
if (res.status === 403) { | ||
@@ -101,0 +104,0 @@ e.message = |
@@ -26,3 +26,3 @@ "use strict"; | ||
GCPEnv["NONE"] = "NONE"; | ||
})(GCPEnv = exports.GCPEnv || (exports.GCPEnv = {})); | ||
})(GCPEnv || (exports.GCPEnv = GCPEnv = {})); | ||
let envPromise; | ||
@@ -29,0 +29,0 @@ function clear() { |
@@ -28,3 +28,3 @@ "use strict"; | ||
CodeChallengeMethod["S256"] = "S256"; | ||
})(CodeChallengeMethod = exports.CodeChallengeMethod || (exports.CodeChallengeMethod = {})); | ||
})(CodeChallengeMethod || (exports.CodeChallengeMethod = CodeChallengeMethod = {})); | ||
var CertificateFormat; | ||
@@ -34,3 +34,3 @@ (function (CertificateFormat) { | ||
CertificateFormat["JWK"] = "JWK"; | ||
})(CertificateFormat = exports.CertificateFormat || (exports.CertificateFormat = {})); | ||
})(CertificateFormat || (exports.CertificateFormat = CertificateFormat = {})); | ||
class OAuth2Client extends authclient_1.AuthClient { | ||
@@ -37,0 +37,0 @@ constructor(optionsOrClientId, clientSecret, redirectUri) { |
@@ -21,9 +21,2 @@ "use strict"; | ||
const base64js = require("base64-js"); | ||
// Not all browsers support `TextEncoder`. The following `require` will | ||
// provide a fast UTF8-only replacement for those browsers that don't support | ||
// text encoding natively. | ||
// eslint-disable-next-line node/no-unsupported-features/node-builtins | ||
if (typeof process === 'undefined' && typeof TextEncoder === 'undefined') { | ||
require('fast-text-encoding'); | ||
} | ||
const crypto_1 = require("../crypto"); | ||
@@ -30,0 +23,0 @@ class BrowserCrypto { |
@@ -21,3 +21,3 @@ "use strict"; | ||
WarningTypes["DEPRECATION"] = "DeprecationWarning"; | ||
})(WarningTypes = exports.WarningTypes || (exports.WarningTypes = {})); | ||
})(WarningTypes || (exports.WarningTypes = WarningTypes = {})); | ||
function warn(warning) { | ||
@@ -24,0 +24,0 @@ // Only show a given warning once |
import { GaxiosError, GaxiosOptions, GaxiosPromise, GaxiosResponse } from 'gaxios'; | ||
export interface Transporter { | ||
request<T>(opts: GaxiosOptions): GaxiosPromise<T>; | ||
request<T>(opts: GaxiosOptions, callback?: BodyResponseCallback<T>): void; | ||
request<T>(opts: GaxiosOptions, callback?: BodyResponseCallback<T>): GaxiosPromise | void; | ||
} | ||
@@ -31,3 +29,2 @@ export interface BodyResponseCallback<T> { | ||
request<T>(opts: GaxiosOptions): GaxiosPromise<T>; | ||
request<T>(opts: GaxiosOptions, callback?: BodyResponseCallback<T>): void; | ||
/** | ||
@@ -34,0 +31,0 @@ * Changes the error to include details from the body. |
@@ -47,28 +47,15 @@ "use strict"; | ||
} | ||
request(opts, callback) { | ||
/** | ||
* Makes a request using Gaxios with given options. | ||
* @param opts GaxiosOptions options. | ||
* @param callback optional callback that contains GaxiosResponse object. | ||
* @return GaxiosPromise, assuming no callback is passed. | ||
*/ | ||
request(opts) { | ||
// ensure the user isn't passing in request-style options | ||
opts = this.configure(opts); | ||
try { | ||
(0, options_1.validate)(opts); | ||
} | ||
catch (e) { | ||
if (callback) { | ||
return callback(e); | ||
} | ||
else { | ||
throw e; | ||
} | ||
} | ||
if (callback) { | ||
(0, gaxios_1.request)(opts).then(r => { | ||
callback(null, r); | ||
}, e => { | ||
callback(this.processError(e)); | ||
}); | ||
} | ||
else { | ||
return (0, gaxios_1.request)(opts).catch(e => { | ||
throw this.processError(e); | ||
}); | ||
} | ||
(0, options_1.validate)(opts); | ||
return (0, gaxios_1.request)(opts).catch(e => { | ||
throw this.processError(e); | ||
}); | ||
} | ||
@@ -85,3 +72,3 @@ /** | ||
err.message = body.error; | ||
err.code = res.status.toString(); | ||
err.status = res.status; | ||
} | ||
@@ -97,3 +84,3 @@ else if (Array.isArray(body.error.errors)) { | ||
err.message = body.error.message; | ||
err.code = body.error.code || res.status; | ||
err.code = body.error.code; | ||
} | ||
@@ -104,3 +91,3 @@ } | ||
err.message = body; | ||
err.code = res.status.toString(); | ||
err.status = res.status; | ||
} | ||
@@ -107,0 +94,0 @@ return err; |
{ | ||
"name": "google-auth-library", | ||
"version": "8.9.0", | ||
"version": "9.0.0", | ||
"author": "Google Inc.", | ||
"description": "Google APIs Authentication Client Library for Node.js", | ||
"engines": { | ||
"node": ">=12" | ||
"node": ">=14" | ||
}, | ||
@@ -20,9 +20,7 @@ "main": "./build/src/index.js", | ||
"dependencies": { | ||
"arrify": "^2.0.0", | ||
"base64-js": "^1.3.0", | ||
"ecdsa-sig-formatter": "^1.0.11", | ||
"fast-text-encoding": "^1.0.0", | ||
"gaxios": "^5.0.0", | ||
"gcp-metadata": "^5.3.0", | ||
"gtoken": "^6.1.0", | ||
"gaxios": "^6.0.0", | ||
"gcp-metadata": "^6.0.0", | ||
"gtoken": "^7.0.0", | ||
"jws": "^4.0.0", | ||
@@ -40,3 +38,3 @@ "lru-cache": "^6.0.0" | ||
"@types/ncp": "^2.0.1", | ||
"@types/node": "^16.0.0", | ||
"@types/node": "^20.4.2", | ||
"@types/sinon": "^10.0.0", | ||
@@ -48,3 +46,3 @@ "assert-rejects": "^1.0.0", | ||
"execa": "^5.0.0", | ||
"gts": "^3.1.0", | ||
"gts": "^3.1.1", | ||
"is-docker": "^2.0.0", | ||
@@ -65,6 +63,6 @@ "karma": "^6.0.0", | ||
"null-loader": "^4.0.0", | ||
"puppeteer": "^20.0.0", | ||
"puppeteer": "^19.0.0", | ||
"sinon": "^15.0.0", | ||
"ts-loader": "^8.0.0", | ||
"typescript": "^4.6.3", | ||
"typescript": "^5.1.6", | ||
"webpack": "^5.21.2", | ||
@@ -71,0 +69,0 @@ "webpack-cli": "^4.0.0" |
Sorry, the diff of this file is too big to display
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
517025
7
8471
+ Addedagent-base@7.1.1(transitive)
+ Addedgaxios@6.7.1(transitive)
+ Addedgcp-metadata@6.1.0(transitive)
+ Addedgtoken@7.1.0(transitive)
+ Addedhttps-proxy-agent@7.0.5(transitive)
+ Addeduuid@9.0.1(transitive)
- Removedarrify@^2.0.0
- Removedfast-text-encoding@^1.0.0
- Removedagent-base@6.0.2(transitive)
- Removedarrify@2.0.1(transitive)
- Removedfast-text-encoding@1.0.6(transitive)
- Removedgaxios@5.1.3(transitive)
- Removedgcp-metadata@5.3.0(transitive)
- Removedgoogle-p12-pem@4.0.1(transitive)
- Removedgtoken@6.1.2(transitive)
- Removedhttps-proxy-agent@5.0.1(transitive)
- Removednode-forge@1.3.1(transitive)
Updatedgaxios@^6.0.0
Updatedgcp-metadata@^6.0.0
Updatedgtoken@^7.0.0