@cdk8s/awscdk-resolver 0.0.724 → 0.0.726
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.jsii +3 -3
- package/lib/resolve.js +1 -1
- package/node_modules/@aws-sdk/client-cloudformation/dist-cjs/index.js +3 -2
- package/node_modules/@aws-sdk/client-cloudformation/dist-es/runtimeConfig.js +2 -1
- package/node_modules/@aws-sdk/client-cloudformation/dist-types/runtimeConfig.d.ts +1 -0
- package/node_modules/@aws-sdk/client-cloudformation/dist-types/ts3.4/runtimeConfig.d.ts +1 -0
- package/node_modules/@aws-sdk/client-cloudformation/package.json +5 -5
- package/node_modules/@aws-sdk/core/dist-cjs/submodules/client/index.js +12 -0
- package/node_modules/@aws-sdk/core/dist-cjs/submodules/httpAuthSchemes/index.js +1 -4
- package/node_modules/@aws-sdk/core/dist-es/submodules/client/getDefaultSocketTimeout.js +10 -0
- package/node_modules/@aws-sdk/core/dist-es/submodules/client/index.browser.js +1 -0
- package/node_modules/@aws-sdk/core/dist-es/submodules/client/index.js +1 -0
- package/node_modules/@aws-sdk/core/dist-es/submodules/client/index.native.js +1 -0
- package/node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/utils/getUpdatedSystemClockOffset.js +1 -4
- package/node_modules/@aws-sdk/core/dist-types/submodules/client/getDefaultSocketTimeout.d.ts +11 -0
- package/node_modules/@aws-sdk/core/dist-types/submodules/client/index.browser.d.ts +1 -0
- package/node_modules/@aws-sdk/core/dist-types/submodules/client/index.d.ts +1 -0
- package/node_modules/@aws-sdk/core/dist-types/submodules/client/index.native.d.ts +1 -0
- package/node_modules/@aws-sdk/core/dist-types/submodules/httpAuthSchemes/utils/getUpdatedSystemClockOffset.d.ts +3 -7
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/getDefaultSocketTimeout.d.ts +4 -0
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/index.browser.d.ts +1 -0
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/index.d.ts +1 -0
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/index.native.d.ts +1 -0
- package/node_modules/@aws-sdk/core/package.json +3 -3
- package/node_modules/@aws-sdk/credential-provider-env/package.json +3 -3
- package/node_modules/@aws-sdk/credential-provider-http/package.json +4 -4
- package/node_modules/@aws-sdk/credential-provider-ini/package.json +10 -10
- package/node_modules/@aws-sdk/credential-provider-login/package.json +4 -4
- package/node_modules/@aws-sdk/credential-provider-node/package.json +8 -8
- package/node_modules/@aws-sdk/credential-provider-process/package.json +3 -3
- package/node_modules/@aws-sdk/credential-provider-sso/package.json +5 -5
- package/node_modules/@aws-sdk/credential-provider-web-identity/package.json +4 -4
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/cognito-identity/index.js +3 -2
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/signin/index.js +10 -2
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso/index.js +3 -2
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso-oidc/index.js +3 -2
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/index.js +3 -2
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/cognito-identity/runtimeConfig.js +2 -1
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/signin/models/enums.js +7 -0
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/signin/runtimeConfig.js +2 -1
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso/runtimeConfig.js +2 -1
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso-oidc/runtimeConfig.js +2 -1
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sts/runtimeConfig.js +2 -1
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/cognito-identity/runtimeConfig.d.ts +1 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/signin/Signin.d.ts +1 -2
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/signin/SigninClient.d.ts +1 -2
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/signin/commands/CreateOAuth2TokenCommand.d.ts +5 -59
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/signin/commands/CreateOAuth2TokenWithIAMCommand.d.ts +5 -33
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/signin/index.d.ts +1 -2
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/signin/models/enums.d.ts +16 -9
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/signin/models/errors.d.ts +8 -39
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/signin/models/models_0.d.ts +36 -48
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/signin/runtimeConfig.d.ts +1 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sso/runtimeConfig.d.ts +1 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sso-oidc/runtimeConfig.d.ts +1 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sts/runtimeConfig.d.ts +1 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/cognito-identity/runtimeConfig.d.ts +1 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/signin/models/enums.d.ts +7 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/signin/runtimeConfig.d.ts +1 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sso/runtimeConfig.d.ts +1 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sso-oidc/runtimeConfig.d.ts +1 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sts/runtimeConfig.d.ts +1 -0
- package/node_modules/@aws-sdk/nested-clients/package.json +5 -5
- package/node_modules/@aws-sdk/signature-v4-multi-region/package.json +2 -2
- package/node_modules/@aws-sdk/token-providers/package.json +4 -4
- package/node_modules/@smithy/core/dist-cjs/submodules/client/index.js +11 -4
- package/node_modules/@smithy/core/dist-cjs/submodules/retry/index.browser.js +33 -5
- package/node_modules/@smithy/core/dist-cjs/submodules/retry/index.js +33 -5
- package/node_modules/@smithy/core/dist-es/submodules/client/smithy-client/command.js +1 -0
- package/node_modules/@smithy/core/dist-es/submodules/client/smithy-client/schemaLogFilter.js +10 -4
- package/node_modules/@smithy/core/dist-es/submodules/retry/middleware-retry/retryMiddleware.js +11 -5
- package/node_modules/@smithy/core/dist-es/submodules/retry/util-retry/race.js +22 -0
- package/node_modules/@smithy/core/dist-types/submodules/retry/util-retry/race.d.ts +3 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/retry/util-retry/race.d.ts +3 -0
- package/node_modules/@smithy/core/package.json +2 -2
- package/node_modules/@smithy/node-http-handler/dist-cjs/index.js +34 -33
- package/node_modules/@smithy/node-http-handler/dist-es/node-http-handler.js +5 -6
- package/node_modules/@smithy/node-http-handler/dist-es/set-socket-timeout.js +29 -27
- package/node_modules/@smithy/node-http-handler/dist-types/set-socket-timeout.d.ts +7 -3
- package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/set-socket-timeout.d.ts +7 -3
- package/node_modules/@smithy/node-http-handler/package.json +3 -3
- package/node_modules/@smithy/types/dist-types/middleware.d.ts +6 -0
- package/node_modules/@smithy/types/dist-types/ts3.4/middleware.d.ts +6 -0
- package/node_modules/@smithy/types/package.json +1 -1
- package/node_modules/tslib/README.md +3 -8
- package/node_modules/tslib/package.json +1 -1
- package/node_modules/tslib/tslib.d.ts +4 -2
- package/node_modules/tslib/tslib.es6.js +10 -1
- package/node_modules/tslib/tslib.es6.mjs +10 -1
- package/node_modules/tslib/tslib.js +10 -1
- package/package.json +6 -6
package/node_modules/@smithy/core/dist-es/submodules/retry/middleware-retry/retryMiddleware.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { NoOpLogger } from "@smithy/core/client";
|
|
2
2
|
import { HttpRequest } from "@smithy/core/protocols";
|
|
3
3
|
import { v4 } from "@smithy/core/serde";
|
|
4
|
+
import { SMITHY_CONTEXT_KEY } from "@smithy/types";
|
|
4
5
|
import { isServerError, isThrottlingError, isTransientError, } from "../service-error-classification/service-error-classification";
|
|
6
|
+
import { isAbortError, race } from "../util-retry/race";
|
|
5
7
|
import { INVOCATION_ID_HEADER, REQUEST_HEADER } from "../util-retry/constants";
|
|
6
8
|
import { parseRetryAfterHeader } from "./parseRetryAfterHeader";
|
|
7
9
|
import { asSdkError } from "./util";
|
|
@@ -9,9 +11,11 @@ export function bindRetryMiddleware(isStreamingPayload) {
|
|
|
9
11
|
return (options) => (next, context) => async (args) => {
|
|
10
12
|
let retryStrategy = await options.retryStrategy();
|
|
11
13
|
const maxAttempts = await options.maxAttempts();
|
|
14
|
+
const abortSignal = context[SMITHY_CONTEXT_KEY]?.abortSignal;
|
|
12
15
|
if (isRetryStrategyV2(retryStrategy)) {
|
|
13
16
|
retryStrategy = retryStrategy;
|
|
14
|
-
|
|
17
|
+
const retryTokenScope = (context["partition_id"] ?? "") + (context.__retryLongPoll ? ":longpoll" : "");
|
|
18
|
+
let retryToken = await race(retryStrategy.acquireInitialRetryToken(retryTokenScope), abortSignal);
|
|
15
19
|
let lastError = new Error();
|
|
16
20
|
let attempts = 0;
|
|
17
21
|
let totalRetryDelay = 0;
|
|
@@ -39,9 +43,12 @@ export function bindRetryMiddleware(isStreamingPayload) {
|
|
|
39
43
|
throw lastError;
|
|
40
44
|
}
|
|
41
45
|
try {
|
|
42
|
-
retryToken = await retryStrategy.refreshRetryTokenForRetry(retryToken, retryErrorInfo);
|
|
46
|
+
retryToken = await race(retryStrategy.refreshRetryTokenForRetry(retryToken, retryErrorInfo), abortSignal);
|
|
43
47
|
}
|
|
44
|
-
catch (
|
|
48
|
+
catch (refreshError) {
|
|
49
|
+
if (abortSignal?.aborted && isAbortError(refreshError)) {
|
|
50
|
+
throw refreshError;
|
|
51
|
+
}
|
|
45
52
|
if (!lastError.$metadata) {
|
|
46
53
|
lastError.$metadata = {};
|
|
47
54
|
}
|
|
@@ -53,7 +60,7 @@ export function bindRetryMiddleware(isStreamingPayload) {
|
|
|
53
60
|
const delay = retryToken.getRetryDelay();
|
|
54
61
|
totalRetryDelay += (retryToken?.$retryLog?.acquisitionDelay ?? 0) + delay;
|
|
55
62
|
if (delay > 0) {
|
|
56
|
-
await
|
|
63
|
+
await race(new Promise((resolve) => setTimeout(resolve, delay)), abortSignal);
|
|
57
64
|
}
|
|
58
65
|
}
|
|
59
66
|
}
|
|
@@ -67,7 +74,6 @@ export function bindRetryMiddleware(isStreamingPayload) {
|
|
|
67
74
|
}
|
|
68
75
|
};
|
|
69
76
|
}
|
|
70
|
-
const cooldown = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
71
77
|
const isRetryStrategyV2 = (retryStrategy) => typeof retryStrategy.acquireInitialRetryToken !== "undefined" &&
|
|
72
78
|
typeof retryStrategy.refreshRetryTokenForRetry !== "undefined" &&
|
|
73
79
|
typeof retryStrategy.recordSuccess !== "undefined";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export const race = (promise, signal) => {
|
|
2
|
+
if (!signal) {
|
|
3
|
+
return promise;
|
|
4
|
+
}
|
|
5
|
+
let cleanup = () => { };
|
|
6
|
+
const aborted = new Promise((_, reject) => {
|
|
7
|
+
const handler = () => reject(createAbortError());
|
|
8
|
+
if (signal.aborted) {
|
|
9
|
+
handler();
|
|
10
|
+
}
|
|
11
|
+
else if (typeof signal.addEventListener === "function") {
|
|
12
|
+
signal.addEventListener("abort", handler, { once: true });
|
|
13
|
+
cleanup = () => signal.removeEventListener("abort", handler);
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
signal.onabort = handler;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
return Promise.race([promise, aborted]).finally(cleanup);
|
|
20
|
+
};
|
|
21
|
+
const createAbortError = () => Object.assign(new Error("Request aborted"), { name: "AbortError" });
|
|
22
|
+
export const isAbortError = (error) => typeof error === "object" && error !== null && "name" in error && error.name === "AbortError";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@smithy/core",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.39.0",
|
|
4
4
|
"homepage": "https://github.com/smithy-lang/smithy-typescript/tree/main/packages/core",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": {
|
|
@@ -242,7 +242,7 @@
|
|
|
242
242
|
"test:integration:watch": "yarn g:vitest watch -c vitest.config.integ.mts"
|
|
243
243
|
},
|
|
244
244
|
"dependencies": {
|
|
245
|
-
"@smithy/types": "^4.
|
|
245
|
+
"@smithy/types": "^4.20.0",
|
|
246
246
|
"tslib": "^2.6.2"
|
|
247
247
|
},
|
|
248
248
|
"devDependencies": {
|
|
@@ -130,39 +130,41 @@ const resolveDefaultSocketTimeout = (config) => {
|
|
|
130
130
|
};
|
|
131
131
|
|
|
132
132
|
const DEFER_EVENT_LISTENER_TIME = 3000;
|
|
133
|
-
const setSocketTimeout = (request, reject, timeoutInMs = 0,
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
request.once("response", (res) => (response = res));
|
|
133
|
+
const setSocketTimeout = (request, reject, timeoutInMs = 0, isServiceDefault = false) => {
|
|
134
|
+
if (!Number.isFinite(timeoutInMs) || timeoutInMs <= 0) {
|
|
135
|
+
return;
|
|
137
136
|
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
137
|
+
let response;
|
|
138
|
+
request.once("response", (res) => (response = res));
|
|
139
|
+
const onTimeout = () => {
|
|
140
|
+
if (response?.complete) {
|
|
141
|
+
request.socket?.destroy();
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
const error = Object.assign(new Error(`@smithy/node-http-handler - the request socket timed out after ${timeoutInMs} ms of inactivity (${isServiceDefault ? "service default socket timeout" : "configured by client requestHandler"}).`), { name: "TimeoutError" });
|
|
145
|
+
response?.destroy(error);
|
|
146
|
+
request.destroy();
|
|
147
|
+
reject(error);
|
|
148
|
+
};
|
|
149
|
+
const registerTimeout = () => {
|
|
150
|
+
const { socket } = request;
|
|
151
|
+
if (!socket) {
|
|
152
|
+
request.once("socket", registerTimeout);
|
|
153
|
+
}
|
|
154
|
+
else if (socket.connecting) {
|
|
155
|
+
socket.once("connect", registerTimeout);
|
|
151
156
|
}
|
|
152
157
|
else {
|
|
153
|
-
|
|
158
|
+
socket.setTimeout(timeoutInMs, onTimeout);
|
|
159
|
+
request.on("close", () => socket.removeListener("timeout", onTimeout));
|
|
154
160
|
}
|
|
155
161
|
};
|
|
156
|
-
if (
|
|
157
|
-
registerTimeout(
|
|
158
|
-
return
|
|
159
|
-
}
|
|
160
|
-
const deferralId = timing.setTimeout(registerTimeout.bind(null, timeoutInMs === 0 ? 0 : DEFER_EVENT_LISTENER_TIME), DEFER_EVENT_LISTENER_TIME);
|
|
161
|
-
if (destroyResponseBodyOnTimeout) {
|
|
162
|
-
request.once("close", () => timing.clearTimeout(deferralId));
|
|
163
|
-
return 0;
|
|
162
|
+
if (timeoutInMs < 6000) {
|
|
163
|
+
registerTimeout();
|
|
164
|
+
return;
|
|
164
165
|
}
|
|
165
|
-
|
|
166
|
+
const deferralId = timing.setTimeout(registerTimeout, DEFER_EVENT_LISTENER_TIME);
|
|
167
|
+
request.once("close", () => timing.clearTimeout(deferralId));
|
|
166
168
|
};
|
|
167
169
|
|
|
168
170
|
const MIN_WAIT_TIME = 6_000;
|
|
@@ -301,13 +303,11 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
|
|
|
301
303
|
let socketWarningTimeoutId = -1;
|
|
302
304
|
let connectionTimeoutId = -1;
|
|
303
305
|
let requestTimeoutId = -1;
|
|
304
|
-
let socketTimeoutId = -1;
|
|
305
306
|
let keepAliveTimeoutId = -1;
|
|
306
307
|
const clearTimeouts = () => {
|
|
307
308
|
timing.clearTimeout(socketWarningTimeoutId);
|
|
308
309
|
timing.clearTimeout(connectionTimeoutId);
|
|
309
310
|
timing.clearTimeout(requestTimeoutId);
|
|
310
|
-
timing.clearTimeout(socketTimeoutId);
|
|
311
311
|
timing.clearTimeout(keepAliveTimeoutId);
|
|
312
312
|
};
|
|
313
313
|
const resolve = async (arg) => {
|
|
@@ -405,10 +405,10 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
|
|
|
405
405
|
requestTimeoutId = setRequestTimeout(req, reject, effectiveRequestTimeout, config.throwOnRequestTimeout, logger ?? console);
|
|
406
406
|
const defaultSocketTimeout = config.socketTimeout === undefined ? resolveDefaultSocketTimeout(config) : undefined;
|
|
407
407
|
if (defaultSocketTimeout) {
|
|
408
|
-
|
|
408
|
+
setSocketTimeout(req, reject, defaultSocketTimeout, true);
|
|
409
409
|
}
|
|
410
410
|
else {
|
|
411
|
-
|
|
411
|
+
setSocketTimeout(req, reject, config.socketTimeout);
|
|
412
412
|
}
|
|
413
413
|
const httpAgent = nodeHttpsOptions.agent;
|
|
414
414
|
if (typeof httpAgent === "object" && "keepAlive" in httpAgent) {
|
|
@@ -449,6 +449,7 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
|
|
|
449
449
|
const { requestTimeout, connectionTimeout, socketTimeout, socketAcquisitionWarningTimeout, httpAgent, httpsAgent, throwOnRequestTimeout, logger, } = options || {};
|
|
450
450
|
const keepAlive = true;
|
|
451
451
|
const maxSockets = 50;
|
|
452
|
+
let httpAgentPromise;
|
|
452
453
|
return {
|
|
453
454
|
connectionTimeout,
|
|
454
455
|
requestTimeout,
|
|
@@ -456,7 +457,7 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
|
|
|
456
457
|
defaultSocketTimeout: resolveDefaultSocketTimeout(options),
|
|
457
458
|
socketAcquisitionWarningTimeout,
|
|
458
459
|
throwOnRequestTimeout,
|
|
459
|
-
httpAgentProvider: async () => {
|
|
460
|
+
httpAgentProvider: () => (httpAgentPromise ??= (async () => {
|
|
460
461
|
const node_http = require('node:http');
|
|
461
462
|
const { Agent, request } = node_http.default ?? node_http;
|
|
462
463
|
hRequest = request;
|
|
@@ -466,7 +467,7 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
|
|
|
466
467
|
return httpAgent;
|
|
467
468
|
}
|
|
468
469
|
return new hAgent({ keepAlive, maxSockets, ...httpAgent });
|
|
469
|
-
},
|
|
470
|
+
})()),
|
|
470
471
|
httpsAgent: (() => {
|
|
471
472
|
if (httpsAgent instanceof node_https.Agent || typeof httpsAgent?.destroy === "function") {
|
|
472
473
|
this.externalAgent = true;
|
|
@@ -85,13 +85,11 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
|
|
|
85
85
|
let socketWarningTimeoutId = -1;
|
|
86
86
|
let connectionTimeoutId = -1;
|
|
87
87
|
let requestTimeoutId = -1;
|
|
88
|
-
let socketTimeoutId = -1;
|
|
89
88
|
let keepAliveTimeoutId = -1;
|
|
90
89
|
const clearTimeouts = () => {
|
|
91
90
|
timing.clearTimeout(socketWarningTimeoutId);
|
|
92
91
|
timing.clearTimeout(connectionTimeoutId);
|
|
93
92
|
timing.clearTimeout(requestTimeoutId);
|
|
94
|
-
timing.clearTimeout(socketTimeoutId);
|
|
95
93
|
timing.clearTimeout(keepAliveTimeoutId);
|
|
96
94
|
};
|
|
97
95
|
const resolve = async (arg) => {
|
|
@@ -189,10 +187,10 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
|
|
|
189
187
|
requestTimeoutId = setRequestTimeout(req, reject, effectiveRequestTimeout, config.throwOnRequestTimeout, logger ?? console);
|
|
190
188
|
const defaultSocketTimeout = config.socketTimeout === undefined ? resolveDefaultSocketTimeout(config) : undefined;
|
|
191
189
|
if (defaultSocketTimeout) {
|
|
192
|
-
|
|
190
|
+
setSocketTimeout(req, reject, defaultSocketTimeout, true);
|
|
193
191
|
}
|
|
194
192
|
else {
|
|
195
|
-
|
|
193
|
+
setSocketTimeout(req, reject, config.socketTimeout);
|
|
196
194
|
}
|
|
197
195
|
const httpAgent = nodeHttpsOptions.agent;
|
|
198
196
|
if (typeof httpAgent === "object" && "keepAlive" in httpAgent) {
|
|
@@ -233,6 +231,7 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
|
|
|
233
231
|
const { requestTimeout, connectionTimeout, socketTimeout, socketAcquisitionWarningTimeout, httpAgent, httpsAgent, throwOnRequestTimeout, logger, } = options || {};
|
|
234
232
|
const keepAlive = true;
|
|
235
233
|
const maxSockets = 50;
|
|
234
|
+
let httpAgentPromise;
|
|
236
235
|
return {
|
|
237
236
|
connectionTimeout,
|
|
238
237
|
requestTimeout,
|
|
@@ -240,7 +239,7 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
|
|
|
240
239
|
defaultSocketTimeout: resolveDefaultSocketTimeout(options),
|
|
241
240
|
socketAcquisitionWarningTimeout,
|
|
242
241
|
throwOnRequestTimeout,
|
|
243
|
-
httpAgentProvider: async () => {
|
|
242
|
+
httpAgentProvider: () => (httpAgentPromise ??= (async () => {
|
|
244
243
|
const node_http = await import("node:http");
|
|
245
244
|
const { Agent, request } = node_http.default ?? node_http;
|
|
246
245
|
hRequest = request;
|
|
@@ -250,7 +249,7 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
|
|
|
250
249
|
return httpAgent;
|
|
251
250
|
}
|
|
252
251
|
return new hAgent({ keepAlive, maxSockets, ...httpAgent });
|
|
253
|
-
},
|
|
252
|
+
})()),
|
|
254
253
|
httpsAgent: (() => {
|
|
255
254
|
if (httpsAgent instanceof node_https.Agent || typeof httpsAgent?.destroy === "function") {
|
|
256
255
|
this.externalAgent = true;
|
|
@@ -1,36 +1,38 @@
|
|
|
1
1
|
import { timing } from "./timing";
|
|
2
2
|
const DEFER_EVENT_LISTENER_TIME = 3000;
|
|
3
|
-
export const setSocketTimeout = (request, reject, timeoutInMs = 0,
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
request.once("response", (res) => (response = res));
|
|
3
|
+
export const setSocketTimeout = (request, reject, timeoutInMs = 0, isServiceDefault = false) => {
|
|
4
|
+
if (!Number.isFinite(timeoutInMs) || timeoutInMs <= 0) {
|
|
5
|
+
return;
|
|
7
6
|
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
7
|
+
let response;
|
|
8
|
+
request.once("response", (res) => (response = res));
|
|
9
|
+
const onTimeout = () => {
|
|
10
|
+
if (response?.complete) {
|
|
11
|
+
request.socket?.destroy();
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
const error = Object.assign(new Error(`@smithy/node-http-handler - the request socket timed out after ${timeoutInMs} ms of inactivity (${isServiceDefault ? "service default socket timeout" : "configured by client requestHandler"}).`), { name: "TimeoutError" });
|
|
15
|
+
response?.destroy(error);
|
|
16
|
+
request.destroy();
|
|
17
|
+
reject(error);
|
|
18
|
+
};
|
|
19
|
+
const registerTimeout = () => {
|
|
20
|
+
const { socket } = request;
|
|
21
|
+
if (!socket) {
|
|
22
|
+
request.once("socket", registerTimeout);
|
|
23
|
+
}
|
|
24
|
+
else if (socket.connecting) {
|
|
25
|
+
socket.once("connect", registerTimeout);
|
|
21
26
|
}
|
|
22
27
|
else {
|
|
23
|
-
|
|
28
|
+
socket.setTimeout(timeoutInMs, onTimeout);
|
|
29
|
+
request.on("close", () => socket.removeListener("timeout", onTimeout));
|
|
24
30
|
}
|
|
25
31
|
};
|
|
26
|
-
if (
|
|
27
|
-
registerTimeout(
|
|
28
|
-
return
|
|
29
|
-
}
|
|
30
|
-
const deferralId = timing.setTimeout(registerTimeout.bind(null, timeoutInMs === 0 ? 0 : DEFER_EVENT_LISTENER_TIME), DEFER_EVENT_LISTENER_TIME);
|
|
31
|
-
if (destroyResponseBodyOnTimeout) {
|
|
32
|
-
request.once("close", () => timing.clearTimeout(deferralId));
|
|
33
|
-
return 0;
|
|
32
|
+
if (timeoutInMs < 6000) {
|
|
33
|
+
registerTimeout();
|
|
34
|
+
return;
|
|
34
35
|
}
|
|
35
|
-
|
|
36
|
+
const deferralId = timing.setTimeout(registerTimeout, DEFER_EVENT_LISTENER_TIME);
|
|
37
|
+
request.once("close", () => timing.clearTimeout(deferralId));
|
|
36
38
|
};
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import type { ClientRequest } from "node:http";
|
|
2
2
|
/**
|
|
3
|
+
* Sets a rolling socket idle timeout that stays armed through the response body. Timeouts of
|
|
4
|
+
* 6000 ms or more register after 3000 ms, so requests that finish sooner skip the socket
|
|
5
|
+
* listener, and may fire up to 3000 ms late. The timeout is not cancelled on headers. It is
|
|
6
|
+
* removed, or its deferral cleared, when the request closes.
|
|
7
|
+
*
|
|
3
8
|
* @internal
|
|
4
|
-
* @param
|
|
5
|
-
* body is destroyed with the TimeoutError, and the timeout stays armed through the body.
|
|
9
|
+
* @param isServiceDefault - whether timeoutInMs is the service default, which labels the error.
|
|
6
10
|
*/
|
|
7
|
-
export declare const setSocketTimeout: (request: ClientRequest, reject: (err: Error) => void, timeoutInMs?: number,
|
|
11
|
+
export declare const setSocketTimeout: (request: ClientRequest, reject: (err: Error) => void, timeoutInMs?: number, isServiceDefault?: boolean) => void;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { ClientRequest } from "node:http";
|
|
2
2
|
/**
|
|
3
|
+
* Sets a rolling socket idle timeout that stays armed through the response body. Timeouts of
|
|
4
|
+
* 6000 ms or more register after 3000 ms, so requests that finish sooner skip the socket
|
|
5
|
+
* listener, and may fire up to 3000 ms late. The timeout is not cancelled on headers. It is
|
|
6
|
+
* removed, or its deferral cleared, when the request closes.
|
|
7
|
+
*
|
|
3
8
|
* @internal
|
|
4
|
-
* @param
|
|
5
|
-
* body is destroyed with the TimeoutError, and the timeout stays armed through the body.
|
|
9
|
+
* @param isServiceDefault - whether timeoutInMs is the service default, which labels the error.
|
|
6
10
|
*/
|
|
7
|
-
export declare const setSocketTimeout: (request: ClientRequest, reject: (err: Error) => void, timeoutInMs?: number,
|
|
11
|
+
export declare const setSocketTimeout: (request: ClientRequest, reject: (err: Error) => void, timeoutInMs?: number, isServiceDefault?: boolean) => void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@smithy/node-http-handler",
|
|
3
|
-
"version": "4.14.
|
|
3
|
+
"version": "4.14.2",
|
|
4
4
|
"description": "Provides a way to make requests",
|
|
5
5
|
"homepage": "https://github.com/smithy-lang/smithy-typescript/tree/main/packages/node-http-handler",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
"test:watch": "yarn g:vitest watch"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@smithy/core": "^3.
|
|
43
|
-
"@smithy/types": "^4.
|
|
42
|
+
"@smithy/core": "^3.39.0",
|
|
43
|
+
"@smithy/types": "^4.20.0",
|
|
44
44
|
"tslib": "^2.6.2"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { AbortSignal as DeprecatedAbortSignal } from "./abort";
|
|
1
2
|
import type { SelectedHttpAuthScheme } from "./auth/HttpAuthScheme";
|
|
2
3
|
import type { AuthScheme, HttpAuthDefinition } from "./auth/auth";
|
|
3
4
|
import type { Command } from "./command";
|
|
@@ -510,6 +511,11 @@ export interface HandlerExecutionContext {
|
|
|
510
511
|
* Transferred from request options to the Smithy context.
|
|
511
512
|
*/
|
|
512
513
|
metricsRecorder?: MetricsRecorder<unknown>;
|
|
514
|
+
/**
|
|
515
|
+
* Transferred from request options to allow middleware to cancel
|
|
516
|
+
* asynchronous work outside of the request handler.
|
|
517
|
+
*/
|
|
518
|
+
abortSignal?: AbortSignal | DeprecatedAbortSignal;
|
|
513
519
|
/**
|
|
514
520
|
* @deprecated
|
|
515
521
|
* Do not assign arbitrary members to the Smithy Context,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { AbortSignal as DeprecatedAbortSignal } from "./abort";
|
|
1
2
|
import { SelectedHttpAuthScheme } from "./auth/HttpAuthScheme";
|
|
2
3
|
import { AuthScheme, HttpAuthDefinition } from "./auth/auth";
|
|
3
4
|
import { Command } from "./command";
|
|
@@ -510,6 +511,11 @@ export interface HandlerExecutionContext {
|
|
|
510
511
|
* Transferred from request options to the Smithy context.
|
|
511
512
|
*/
|
|
512
513
|
metricsRecorder?: MetricsRecorder<unknown>;
|
|
514
|
+
/**
|
|
515
|
+
* Transferred from request options to allow middleware to cancel
|
|
516
|
+
* asynchronous work outside of the request handler.
|
|
517
|
+
*/
|
|
518
|
+
abortSignal?: AbortSignal | DeprecatedAbortSignal;
|
|
513
519
|
/**
|
|
514
520
|
* @deprecated
|
|
515
521
|
* Do not assign arbitrary members to the Smithy Context,
|
|
@@ -138,14 +138,9 @@ For JSPM users:
|
|
|
138
138
|
|
|
139
139
|
## Deployment
|
|
140
140
|
|
|
141
|
-
-
|
|
142
|
-
-
|
|
143
|
-
-
|
|
144
|
-
- Push the tag: `git push --tags`
|
|
145
|
-
- Create a [release in GitHub](https://github.com/microsoft/tslib/releases)
|
|
146
|
-
- Run the [publish to npm](https://github.com/microsoft/tslib/actions?query=workflow%3A%22Publish+to+NPM%22) workflow
|
|
147
|
-
|
|
148
|
-
Done.
|
|
141
|
+
- Run the **Bump tslib** GitHub workflow and choose patch, minor, or major
|
|
142
|
+
- Review and squash-merge the generated version-bump PR
|
|
143
|
+
- The release runs automatically: tag, build, publish to npm, and create a GitHub release with generated notes
|
|
149
144
|
|
|
150
145
|
# Contribute
|
|
151
146
|
|
|
@@ -453,8 +453,10 @@ export declare function __addDisposableResource<T>(env: { stack: { value?: unkno
|
|
|
453
453
|
export declare function __disposeResources(env: { stack: { value?: unknown, dispose?: Function, async: boolean }[]; error: unknown; hasError: boolean; }): any;
|
|
454
454
|
|
|
455
455
|
/**
|
|
456
|
-
* Transforms a relative import specifier
|
|
456
|
+
* Transforms a relative import specifier using additional extension mappings, falling back to rewriting non-declaration TypeScript file extensions to their JavaScript counterparts.
|
|
457
457
|
* @param path The import specifier.
|
|
458
458
|
* @param preserveJsx Causes '*.tsx' to transform to '*.jsx' instead of '*.js'. Should be true when `--jsx` is set to `preserve`.
|
|
459
|
+
* @param extraExtensions Additional file extension mappings, including leading dots, checked in enumeration order before the built-in rewrites.
|
|
460
|
+
* @param ignoreCase Whether to ignore case when matching additional file extensions.
|
|
459
461
|
*/
|
|
460
|
-
export declare function __rewriteRelativeImportExtension(path: string, preserveJsx?: boolean): string;
|
|
462
|
+
export declare function __rewriteRelativeImportExtension(path: string, preserveJsx?: boolean, extraExtensions?: { [extension: string]: string }, ignoreCase?: boolean): string;
|
|
@@ -357,8 +357,17 @@ export function __disposeResources(env) {
|
|
|
357
357
|
return next();
|
|
358
358
|
}
|
|
359
359
|
|
|
360
|
-
export function __rewriteRelativeImportExtension(path, preserveJsx) {
|
|
360
|
+
export function __rewriteRelativeImportExtension(path, preserveJsx, extraExtensions, ignoreCase) {
|
|
361
361
|
if (typeof path === "string" && /^\.\.?\//.test(path)) {
|
|
362
|
+
if (extraExtensions) {
|
|
363
|
+
for (var extension in extraExtensions) {
|
|
364
|
+
var suffix = path.slice(-extension.length);
|
|
365
|
+
if (suffix === extension || ignoreCase && suffix.toLowerCase() === extension.toLowerCase()) {
|
|
366
|
+
var output = extraExtensions[extension];
|
|
367
|
+
return output === extension ? path : path.slice(0, -extension.length) + output;
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
}
|
|
362
371
|
return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
|
|
363
372
|
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
|
|
364
373
|
});
|
|
@@ -356,8 +356,17 @@ export function __disposeResources(env) {
|
|
|
356
356
|
return next();
|
|
357
357
|
}
|
|
358
358
|
|
|
359
|
-
export function __rewriteRelativeImportExtension(path, preserveJsx) {
|
|
359
|
+
export function __rewriteRelativeImportExtension(path, preserveJsx, extraExtensions, ignoreCase) {
|
|
360
360
|
if (typeof path === "string" && /^\.\.?\//.test(path)) {
|
|
361
|
+
if (extraExtensions) {
|
|
362
|
+
for (var extension in extraExtensions) {
|
|
363
|
+
var suffix = path.slice(-extension.length);
|
|
364
|
+
if (suffix === extension || ignoreCase && suffix.toLowerCase() === extension.toLowerCase()) {
|
|
365
|
+
var output = extraExtensions[extension];
|
|
366
|
+
return output === extension ? path : path.slice(0, -extension.length) + output;
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
}
|
|
361
370
|
return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
|
|
362
371
|
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
|
|
363
372
|
});
|
|
@@ -405,8 +405,17 @@ var __rewriteRelativeImportExtension;
|
|
|
405
405
|
return next();
|
|
406
406
|
};
|
|
407
407
|
|
|
408
|
-
__rewriteRelativeImportExtension = function (path, preserveJsx) {
|
|
408
|
+
__rewriteRelativeImportExtension = function (path, preserveJsx, extraExtensions, ignoreCase) {
|
|
409
409
|
if (typeof path === "string" && /^\.\.?\//.test(path)) {
|
|
410
|
+
if (extraExtensions) {
|
|
411
|
+
for (var extension in extraExtensions) {
|
|
412
|
+
var suffix = path.slice(-extension.length);
|
|
413
|
+
if (suffix === extension || ignoreCase && suffix.toLowerCase() === extension.toLowerCase()) {
|
|
414
|
+
var output = extraExtensions[extension];
|
|
415
|
+
return output === extension ? path : path.slice(0, -extension.length) + output;
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
}
|
|
410
419
|
return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
|
|
411
420
|
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
|
|
412
421
|
});
|
package/package.json
CHANGED
|
@@ -43,17 +43,17 @@
|
|
|
43
43
|
"organization": false
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@cdk8s/projen-common": "0.1.
|
|
46
|
+
"@cdk8s/projen-common": "0.1.44",
|
|
47
47
|
"@stylistic/eslint-plugin": "^2",
|
|
48
48
|
"@types/fs-extra": "^11.0.4",
|
|
49
49
|
"@types/jest": "^27",
|
|
50
50
|
"@types/node": "^18",
|
|
51
51
|
"@typescript-eslint/eslint-plugin": "^8",
|
|
52
52
|
"@typescript-eslint/parser": "^8",
|
|
53
|
-
"aws-cdk": "^2.
|
|
53
|
+
"aws-cdk": "^2.1147.0",
|
|
54
54
|
"aws-cdk-lib": "2.195.0",
|
|
55
55
|
"cdk8s": "2.68.91",
|
|
56
|
-
"cdk8s-cli": "^2.207.
|
|
56
|
+
"cdk8s-cli": "^2.207.77",
|
|
57
57
|
"commit-and-tag-version": "^13",
|
|
58
58
|
"constructs": "10.3.0",
|
|
59
59
|
"eslint": "^9",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"jsii-docgen": "^10.5.0",
|
|
68
68
|
"jsii-pacmak": "^1.142.0",
|
|
69
69
|
"jsii-rosetta": "^5",
|
|
70
|
-
"projen": "^0.104.
|
|
70
|
+
"projen": "^0.104.25",
|
|
71
71
|
"ts-jest": "^27",
|
|
72
72
|
"ts-node": "^10.9.2",
|
|
73
73
|
"typescript": "^5.9.3"
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"constructs": "^10.3.0"
|
|
79
79
|
},
|
|
80
80
|
"dependencies": {
|
|
81
|
-
"@aws-sdk/client-cloudformation": "^3.
|
|
81
|
+
"@aws-sdk/client-cloudformation": "^3.1162.0"
|
|
82
82
|
},
|
|
83
83
|
"bundledDependencies": [
|
|
84
84
|
"@aws-sdk/client-cloudformation"
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
"publishConfig": {
|
|
93
93
|
"access": "public"
|
|
94
94
|
},
|
|
95
|
-
"version": "0.0.
|
|
95
|
+
"version": "0.0.726",
|
|
96
96
|
"jest": {
|
|
97
97
|
"coverageProvider": "v8",
|
|
98
98
|
"testMatch": [
|