chore: Update dist

This commit is contained in:
GitHub Actions
2024-09-10 03:58:46 +00:00
parent 21013c6ea2
commit 2ecdac5a31
Generated Vendored
+56 -16
View File
@@ -16656,10 +16656,12 @@ var getTransformedHeaders = /* @__PURE__ */ __name((headers) => {
}, "getTransformedHeaders"); }, "getTransformedHeaders");
// src/set-connection-timeout.ts // src/set-connection-timeout.ts
var DEFER_EVENT_LISTENER_TIME = 1e3;
var setConnectionTimeout = /* @__PURE__ */ __name((request, reject, timeoutInMs = 0) => { var setConnectionTimeout = /* @__PURE__ */ __name((request, reject, timeoutInMs = 0) => {
if (!timeoutInMs) { if (!timeoutInMs) {
return; return -1;
} }
const registerTimeout = /* @__PURE__ */ __name((offset) => {
const timeoutId = setTimeout(() => { const timeoutId = setTimeout(() => {
request.destroy(); request.destroy();
reject( reject(
@@ -16667,34 +16669,68 @@ var setConnectionTimeout = /* @__PURE__ */ __name((request, reject, timeoutInMs
name: "TimeoutError" name: "TimeoutError"
}) })
); );
}, timeoutInMs); }, timeoutInMs - offset);
request.on("socket", (socket) => { const doWithSocket = /* @__PURE__ */ __name((socket) => {
if (socket.connecting) { if (socket == null ? void 0 : socket.connecting) {
socket.on("connect", () => { socket.on("connect", () => {
clearTimeout(timeoutId); clearTimeout(timeoutId);
}); });
} else { } else {
clearTimeout(timeoutId); clearTimeout(timeoutId);
} }
}); }, "doWithSocket");
if (request.socket) {
doWithSocket(request.socket);
} else {
request.on("socket", doWithSocket);
}
}, "registerTimeout");
if (timeoutInMs < 2e3) {
registerTimeout(0);
return 0;
}
return setTimeout(registerTimeout.bind(null, DEFER_EVENT_LISTENER_TIME), DEFER_EVENT_LISTENER_TIME);
}, "setConnectionTimeout"); }, "setConnectionTimeout");
// src/set-socket-keep-alive.ts // src/set-socket-keep-alive.ts
var setSocketKeepAlive = /* @__PURE__ */ __name((request, { keepAlive, keepAliveMsecs }) => { var DEFER_EVENT_LISTENER_TIME2 = 3e3;
var setSocketKeepAlive = /* @__PURE__ */ __name((request, { keepAlive, keepAliveMsecs }, deferTimeMs = DEFER_EVENT_LISTENER_TIME2) => {
if (keepAlive !== true) { if (keepAlive !== true) {
return; return -1;
} }
const registerListener = /* @__PURE__ */ __name(() => {
if (request.socket) {
request.socket.setKeepAlive(keepAlive, keepAliveMsecs || 0);
} else {
request.on("socket", (socket) => { request.on("socket", (socket) => {
socket.setKeepAlive(keepAlive, keepAliveMsecs || 0); socket.setKeepAlive(keepAlive, keepAliveMsecs || 0);
}); });
}
}, "registerListener");
if (deferTimeMs === 0) {
registerListener();
return 0;
}
return setTimeout(registerListener, deferTimeMs);
}, "setSocketKeepAlive"); }, "setSocketKeepAlive");
// src/set-socket-timeout.ts // src/set-socket-timeout.ts
var DEFER_EVENT_LISTENER_TIME3 = 3e3;
var setSocketTimeout = /* @__PURE__ */ __name((request, reject, timeoutInMs = 0) => { var setSocketTimeout = /* @__PURE__ */ __name((request, reject, timeoutInMs = 0) => {
request.setTimeout(timeoutInMs, () => { const registerTimeout = /* @__PURE__ */ __name((offset) => {
request.setTimeout(timeoutInMs - offset, () => {
request.destroy(); request.destroy();
reject(Object.assign(new Error(`Connection timed out after ${timeoutInMs} ms`), { name: "TimeoutError" })); reject(Object.assign(new Error(`Connection timed out after ${timeoutInMs} ms`), { name: "TimeoutError" }));
}); });
}, "registerTimeout");
if (0 < timeoutInMs && timeoutInMs < 6e3) {
registerTimeout(0);
return 0;
}
return setTimeout(
registerTimeout.bind(null, timeoutInMs === 0 ? 0 : DEFER_EVENT_LISTENER_TIME3),
DEFER_EVENT_LISTENER_TIME3
);
}, "setSocketTimeout"); }, "setSocketTimeout");
// src/write-request-body.ts // src/write-request-body.ts
@@ -16843,17 +16879,17 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
if (!this.config) { if (!this.config) {
this.config = await this.configProvider; this.config = await this.configProvider;
} }
let socketCheckTimeoutId;
return new Promise((_resolve, _reject) => { return new Promise((_resolve, _reject) => {
let writeRequestBodyPromise = void 0; let writeRequestBodyPromise = void 0;
const timeouts = [];
const resolve = /* @__PURE__ */ __name(async (arg) => { const resolve = /* @__PURE__ */ __name(async (arg) => {
await writeRequestBodyPromise; await writeRequestBodyPromise;
clearTimeout(socketCheckTimeoutId); timeouts.forEach(clearTimeout);
_resolve(arg); _resolve(arg);
}, "resolve"); }, "resolve");
const reject = /* @__PURE__ */ __name(async (arg) => { const reject = /* @__PURE__ */ __name(async (arg) => {
await writeRequestBodyPromise; await writeRequestBodyPromise;
clearTimeout(socketCheckTimeoutId); timeouts.forEach(clearTimeout);
_reject(arg); _reject(arg);
}, "reject"); }, "reject");
if (!this.config) { if (!this.config) {
@@ -16867,7 +16903,8 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
} }
const isSSL = request.protocol === "https:"; const isSSL = request.protocol === "https:";
const agent = isSSL ? this.config.httpsAgent : this.config.httpAgent; const agent = isSSL ? this.config.httpsAgent : this.config.httpAgent;
socketCheckTimeoutId = setTimeout( timeouts.push(
setTimeout(
() => { () => {
this.socketWarningTimestamp = _NodeHttpHandler.checkSocketUsage( this.socketWarningTimestamp = _NodeHttpHandler.checkSocketUsage(
agent, agent,
@@ -16876,6 +16913,7 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
); );
}, },
this.config.socketAcquisitionWarningTimeout ?? (this.config.requestTimeout ?? 2e3) + (this.config.connectionTimeout ?? 1e3) this.config.socketAcquisitionWarningTimeout ?? (this.config.requestTimeout ?? 2e3) + (this.config.connectionTimeout ?? 1e3)
)
); );
const queryString = (0, import_querystring_builder.buildQueryString)(request.query || {}); const queryString = (0, import_querystring_builder.buildQueryString)(request.query || {});
let auth = void 0; let auth = void 0;
@@ -16917,8 +16955,6 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
reject(err); reject(err);
} }
}); });
setConnectionTimeout(req, reject, this.config.connectionTimeout);
setSocketTimeout(req, reject, this.config.requestTimeout);
if (abortSignal) { if (abortSignal) {
const onAbort = /* @__PURE__ */ __name(() => { const onAbort = /* @__PURE__ */ __name(() => {
req.destroy(); req.destroy();
@@ -16934,17 +16970,21 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
abortSignal.onabort = onAbort; abortSignal.onabort = onAbort;
} }
} }
timeouts.push(setConnectionTimeout(req, reject, this.config.connectionTimeout));
timeouts.push(setSocketTimeout(req, reject, this.config.requestTimeout));
const httpAgent = nodeHttpsOptions.agent; const httpAgent = nodeHttpsOptions.agent;
if (typeof httpAgent === "object" && "keepAlive" in httpAgent) { if (typeof httpAgent === "object" && "keepAlive" in httpAgent) {
timeouts.push(
setSocketKeepAlive(req, { setSocketKeepAlive(req, {
// @ts-expect-error keepAlive is not public on httpAgent. // @ts-expect-error keepAlive is not public on httpAgent.
keepAlive: httpAgent.keepAlive, keepAlive: httpAgent.keepAlive,
// @ts-expect-error keepAliveMsecs is not public on httpAgent. // @ts-expect-error keepAliveMsecs is not public on httpAgent.
keepAliveMsecs: httpAgent.keepAliveMsecs keepAliveMsecs: httpAgent.keepAliveMsecs
}); })
);
} }
writeRequestBodyPromise = writeRequestBody(req, request, this.config.requestTimeout).catch((e) => { writeRequestBodyPromise = writeRequestBody(req, request, this.config.requestTimeout).catch((e) => {
clearTimeout(socketCheckTimeoutId); timeouts.forEach(clearTimeout);
return _reject(e); return _reject(e);
}); });
}); });