node_modules: update (#332)

Co-authored-by: dawidd6 <9713907+dawidd6@users.noreply.github.com>
This commit is contained in:
Dawid Dziurlaanddawidd6 authored and GitHub committed 2026-10-01 09:48:38 +02:00
1 parent c1dac70e3a
commit 6bf0a2f26a
95 files changed
+1102 -503

No files matched your search

+14 -10
View File
@@ -111,6 +111,8 @@ class XOAuth2 extends node_stream_1.Stream {
* @param callback Callback function with error object and token string
*/
getToken(renew, callback) {
// the error paths hand over the error alone
const done = callback;
if (!renew && this.accessToken && (!this.expires || this.expires > Date.now())) {
this.logger.debug({
tnx: 'OAUTH2',
@@ -136,11 +138,11 @@ class XOAuth2 extends node_stream_1.Stream {
}, 'Cannot renew access token for %s: No refresh mechanism available', this.options.user);
const err = new Error("Can't create new access token for user");
err.code = errors.EOAUTH2;
return callback(err);
return done(err);
}
// If renewal already in progress, queue this request instead of starting another
if (this.renewing) {
this.renewalQueue.push({ renew, callback });
this.renewalQueue.push({ renew, callback: done });
return;
}
this.renewing = true;
@@ -165,7 +167,7 @@ class XOAuth2 extends node_stream_1.Stream {
}, 'Generated new Access Token for %s', this.options.user);
}
// Complete original request
callback(err, accessToken);
done(err, accessToken);
};
if (this.provisionCallback) {
this.provisionCallback(this.options.user, !!renew, (err, accessToken, expires) => {
@@ -204,6 +206,8 @@ class XOAuth2 extends node_stream_1.Stream {
* @param callback Callback function with error object and token string
*/
generateToken(callback) {
// the error paths hand over the error alone
const done = callback;
let urlOptions;
let loggedUrlOptions;
if (this.options.serviceClient) {
@@ -224,7 +228,7 @@ class XOAuth2 extends node_stream_1.Stream {
catch (_err) {
const err = new Error("Can't generate token. Check your auth options");
err.code = errors.EOAUTH2;
return callback(err);
return done(err);
}
urlOptions = {
grant_type: 'urn:ietf:params:oauth:grant-type:jwt-bearer',
@@ -239,7 +243,7 @@ class XOAuth2 extends node_stream_1.Stream {
if (!this.options.refreshToken) {
const err = new Error("Can't create new access token for user");
err.code = errors.EOAUTH2;
return callback(err);
return done(err);
}
// web app - https://developers.google.com/identity/protocols/OAuth2WebServer
urlOptions = {
@@ -265,13 +269,13 @@ class XOAuth2 extends node_stream_1.Stream {
this.postRequest(this.options.accessUrl, urlOptions, this.options, (error, body) => {
let data;
if (error) {
return callback(error);
return done(error);
}
try {
data = JSON.parse(body.toString());
}
catch (E) {
return callback(E);
return done(E);
}
if (!data || typeof data !== 'object') {
this.logger.debug({
@@ -281,7 +285,7 @@ class XOAuth2 extends node_stream_1.Stream {
}, 'Response: %s', (body || '').toString());
const err = new Error('Invalid authentication response');
err.code = errors.EOAUTH2;
return callback(err);
return done(err);
}
const logData = Object.assign({}, data);
if (logData.access_token) {
@@ -303,7 +307,7 @@ class XOAuth2 extends node_stream_1.Stream {
}
const err = new Error(errorMessage);
err.code = errors.EOAUTH2;
return callback(err);
return done(err);
}
if (data.access_token) {
this.updateToken(data.access_token, data.expires_in);
@@ -311,7 +315,7 @@ class XOAuth2 extends node_stream_1.Stream {
}
const err = new Error('No access token');
err.code = errors.EOAUTH2;
return callback(err);
return done(err);
});
}
/**