mirror of
https://github.com/dawidd6/action-send-mail.git
synced 2026-10-09 09:59:45 +07:00
node_modules: update (#338)
Co-authored-by: dawidd6 <9713907+dawidd6@users.noreply.github.com>
This commit is contained in:
1 parent
e1936242ed
commit
a9c5eb6c35
39 files changed
+799
-388
No files matched your search
+2
@@ -61,6 +61,8 @@ export interface XOAuth2Options {
|
||||
component?: string | undefined;
|
||||
/** Extra headers for the token request */
|
||||
customHeaders?: OutgoingHttpHeaders | undefined;
|
||||
/** Timeout for the token request in milliseconds, defaults to 60000, 0 disables it */
|
||||
requestTimeout?: number | undefined;
|
||||
/** Extra form fields for the token request */
|
||||
customParams?: {
|
||||
[key: string]: any;
|
||||
|
||||
+11
-3
@@ -74,12 +74,14 @@ class XOAuth2 extends node_stream_1.Stream {
|
||||
constructor(options, logger) {
|
||||
super();
|
||||
this.options = options || {};
|
||||
this.configError = false;
|
||||
if (options && options.serviceClient) {
|
||||
if (!options.privateKey || !options.user) {
|
||||
// reported through getToken() rather than an 'error' event: the transports forward
|
||||
// that event up to the Mail object, where nothing may be listening
|
||||
const err = new Error('Options "privateKey" and "user" are required for service account!');
|
||||
err.code = errors.EOAUTH2;
|
||||
setImmediate(() => this.emit('error', err));
|
||||
return;
|
||||
this.configError = err;
|
||||
}
|
||||
const serviceRequestTimeout = Math.min(Math.max(Number(this.options.serviceRequestTimeout) || 0, 0), 3600);
|
||||
this.options.serviceRequestTimeout = serviceRequestTimeout || 5 * 60;
|
||||
@@ -113,6 +115,9 @@ class XOAuth2 extends node_stream_1.Stream {
|
||||
getToken(renew, callback) {
|
||||
// the error paths hand over the error alone
|
||||
const done = callback;
|
||||
if (this.configError) {
|
||||
return done(this.configError);
|
||||
}
|
||||
if (!renew && this.accessToken && (!this.expires || this.expires > Date.now())) {
|
||||
this.logger.debug({
|
||||
tnx: 'OAUTH2',
|
||||
@@ -349,7 +354,10 @@ class XOAuth2 extends node_stream_1.Stream {
|
||||
method: 'post',
|
||||
headers: params.customHeaders,
|
||||
body: payload,
|
||||
allowErrorResponse: true
|
||||
allowErrorResponse: true,
|
||||
// unset falls back to the fetch default, a stalled token endpoint would otherwise keep
|
||||
// `renewing` set and queue every later request
|
||||
timeout: params.requestTimeout
|
||||
};
|
||||
// OAuth2 token endpoints are credential-bearing. src/fetch already
|
||||
// validates certs by default; pin rejectUnauthorized:true here so the
|
||||
|
||||
Reference in new issue
Block a user