@mavogel/awscdk-rootmail 0.1.40 → 0.1.42
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 +8 -8
- package/lib/rootmail.js +1 -1
- package/lib/ses-receive.js +1 -1
- package/node_modules/@aws-sdk/checksums/package.json +5 -5
- package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-cjs/index.js +1 -1
- package/node_modules/@aws-sdk/client-cloudwatch-logs/package.json +8 -8
- package/node_modules/@aws-sdk/client-route-53/dist-cjs/index.js +1 -1
- package/node_modules/@aws-sdk/client-route-53/package.json +9 -9
- package/node_modules/@aws-sdk/client-s3/dist-cjs/index.js +1 -1
- package/node_modules/@aws-sdk/client-s3/package.json +12 -12
- package/node_modules/@aws-sdk/client-ses/dist-cjs/index.js +1 -1
- package/node_modules/@aws-sdk/client-ses/package.json +8 -8
- package/node_modules/@aws-sdk/client-ssm/README.md +14 -0
- package/node_modules/@aws-sdk/client-ssm/dist-cjs/index.js +55 -1
- package/node_modules/@aws-sdk/client-ssm/dist-es/SSM.js +4 -0
- package/node_modules/@aws-sdk/client-ssm/dist-es/commands/DeregisterDefaultHostManagementConfigurationCommand.js +4 -0
- package/node_modules/@aws-sdk/client-ssm/dist-es/commands/RegisterDefaultHostManagementConfigurationCommand.js +4 -0
- package/node_modules/@aws-sdk/client-ssm/dist-es/commands/index.js +2 -0
- package/node_modules/@aws-sdk/client-ssm/dist-es/models/enums.js +4 -0
- package/node_modules/@aws-sdk/client-ssm/dist-es/schemas/schemas_0.js +33 -0
- package/node_modules/@aws-sdk/client-ssm/dist-types/SSM.d.ts +15 -0
- package/node_modules/@aws-sdk/client-ssm/dist-types/SSMClient.d.ts +4 -2
- package/node_modules/@aws-sdk/client-ssm/dist-types/commands/DeleteParameterCommand.d.ts +6 -0
- package/node_modules/@aws-sdk/client-ssm/dist-types/commands/DeleteParametersCommand.d.ts +7 -0
- package/node_modules/@aws-sdk/client-ssm/dist-types/commands/DeregisterDefaultHostManagementConfigurationCommand.d.ts +82 -0
- package/node_modules/@aws-sdk/client-ssm/dist-types/commands/GetParameterCommand.d.ts +6 -0
- package/node_modules/@aws-sdk/client-ssm/dist-types/commands/GetParameterHistoryCommand.d.ts +11 -0
- package/node_modules/@aws-sdk/client-ssm/dist-types/commands/GetParametersByPathCommand.d.ts +12 -0
- package/node_modules/@aws-sdk/client-ssm/dist-types/commands/GetParametersCommand.d.ts +8 -1
- package/node_modules/@aws-sdk/client-ssm/dist-types/commands/RegisterDefaultHostManagementConfigurationCommand.d.ts +93 -0
- package/node_modules/@aws-sdk/client-ssm/dist-types/commands/index.d.ts +2 -0
- package/node_modules/@aws-sdk/client-ssm/dist-types/models/enums.d.ts +12 -0
- package/node_modules/@aws-sdk/client-ssm/dist-types/models/models_0.d.ts +10 -41
- package/node_modules/@aws-sdk/client-ssm/dist-types/models/models_1.d.ts +111 -8
- package/node_modules/@aws-sdk/client-ssm/dist-types/schemas/schemas_0.d.ts +6 -0
- package/node_modules/@aws-sdk/client-ssm/dist-types/ts3.4/SSM.d.ts +35 -0
- package/node_modules/@aws-sdk/client-ssm/dist-types/ts3.4/SSMClient.d.ts +12 -0
- package/node_modules/@aws-sdk/client-ssm/dist-types/ts3.4/commands/DeregisterDefaultHostManagementConfigurationCommand.d.ts +42 -0
- package/node_modules/@aws-sdk/client-ssm/dist-types/ts3.4/commands/GetParametersCommand.d.ts +1 -1
- package/node_modules/@aws-sdk/client-ssm/dist-types/ts3.4/commands/RegisterDefaultHostManagementConfigurationCommand.d.ts +42 -0
- package/node_modules/@aws-sdk/client-ssm/dist-types/ts3.4/commands/index.d.ts +2 -0
- package/node_modules/@aws-sdk/client-ssm/dist-types/ts3.4/models/enums.d.ts +5 -0
- package/node_modules/@aws-sdk/client-ssm/dist-types/ts3.4/models/models_0.d.ts +2 -8
- package/node_modules/@aws-sdk/client-ssm/dist-types/ts3.4/models/models_1.d.ts +17 -0
- package/node_modules/@aws-sdk/client-ssm/dist-types/ts3.4/schemas/schemas_0.d.ts +6 -0
- package/node_modules/@aws-sdk/client-ssm/package.json +8 -8
- package/node_modules/@aws-sdk/core/dist-cjs/submodules/client/index.js +6 -0
- package/node_modules/@aws-sdk/core/dist-cjs/submodules/httpAuthSchemes/index.js +3 -0
- package/node_modules/@aws-sdk/core/dist-es/submodules/client/util-endpoints/lib/aws/partitions.js +6 -0
- package/node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/utils/getUpdatedSystemClockOffset.js +3 -0
- package/node_modules/@aws-sdk/core/dist-types/submodules/client/util-endpoints/lib/aws/partitions.d.ts +20 -0
- package/node_modules/@aws-sdk/core/dist-types/submodules/httpAuthSchemes/utils/getUpdatedSystemClockOffset.d.ts +1 -0
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/util-endpoints/lib/aws/partitions.d.ts +20 -0
- package/node_modules/@aws-sdk/core/package.json +5 -5
- package/node_modules/@aws-sdk/credential-provider-env/package.json +5 -5
- package/node_modules/@aws-sdk/credential-provider-http/package.json +7 -7
- package/node_modules/@aws-sdk/credential-provider-ini/package.json +12 -12
- package/node_modules/@aws-sdk/credential-provider-login/package.json +6 -6
- package/node_modules/@aws-sdk/credential-provider-node/package.json +10 -10
- package/node_modules/@aws-sdk/credential-provider-process/package.json +5 -5
- package/node_modules/@aws-sdk/credential-provider-sso/package.json +7 -7
- package/node_modules/@aws-sdk/credential-provider-web-identity/package.json +6 -6
- package/node_modules/@aws-sdk/middleware-sdk-route53/package.json +3 -3
- package/node_modules/@aws-sdk/middleware-sdk-s3/package.json +6 -6
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/cognito-identity/index.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/signin/index.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso/index.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso-oidc/index.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/index.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/package.json +8 -8
- package/node_modules/@aws-sdk/signature-v4-multi-region/package.json +3 -3
- package/node_modules/@aws-sdk/token-providers/package.json +6 -6
- package/node_modules/@aws-sdk/types/package.json +2 -2
- package/node_modules/@aws-sdk/xml-builder/package.json +2 -2
- package/node_modules/@smithy/core/dist-cjs/submodules/client/index.js +1 -0
- 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/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/fetch-http-handler/dist-cjs/index.js +10 -4
- package/node_modules/@smithy/fetch-http-handler/dist-es/fetch-http-handler.js +6 -2
- package/node_modules/@smithy/fetch-http-handler/dist-es/request-timeout.js +4 -2
- package/node_modules/@smithy/fetch-http-handler/dist-types/request-timeout.d.ts +12 -1
- package/node_modules/@smithy/fetch-http-handler/dist-types/ts3.4/request-timeout.d.ts +12 -1
- package/node_modules/@smithy/fetch-http-handler/package.json +3 -3
- package/node_modules/@smithy/node-http-handler/dist-cjs/index.js +31 -31
- package/node_modules/@smithy/node-http-handler/dist-es/node-http-handler.js +2 -4
- 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/package.json +9 -9
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": {
|
|
@@ -7,15 +7,17 @@ function createRequest(url, requestOptions) {
|
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
function requestTimeout(timeoutInMs = 0) {
|
|
10
|
-
|
|
10
|
+
let timeoutId;
|
|
11
|
+
const promise = new Promise((resolve, reject) => {
|
|
11
12
|
if (timeoutInMs) {
|
|
12
|
-
setTimeout(() => {
|
|
13
|
+
timeoutId = setTimeout(() => {
|
|
13
14
|
const timeoutError = new Error(`Request did not complete within ${timeoutInMs} ms`);
|
|
14
15
|
timeoutError.name = "TimeoutError";
|
|
15
16
|
reject(timeoutError);
|
|
16
17
|
}, timeoutInMs);
|
|
17
18
|
}
|
|
18
19
|
});
|
|
20
|
+
return { promise, cancel: () => clearTimeout(timeoutId) };
|
|
19
21
|
}
|
|
20
22
|
|
|
21
23
|
const keepAliveSupport = {
|
|
@@ -95,6 +97,7 @@ class FetchHttpHandler {
|
|
|
95
97
|
Object.assign(requestOptions, this.config.requestInit(request));
|
|
96
98
|
}
|
|
97
99
|
let removeSignalEventListener = () => { };
|
|
100
|
+
const timeout = requestTimeout(requestTimeoutInMs);
|
|
98
101
|
const fetchRequest = createRequest(url, requestOptions);
|
|
99
102
|
const raceOfPromises = [
|
|
100
103
|
fetchFn(fetchRequest).then((response) => {
|
|
@@ -123,7 +126,7 @@ class FetchHttpHandler {
|
|
|
123
126
|
}),
|
|
124
127
|
};
|
|
125
128
|
}),
|
|
126
|
-
|
|
129
|
+
timeout.promise,
|
|
127
130
|
];
|
|
128
131
|
if (abortSignal) {
|
|
129
132
|
raceOfPromises.push(new Promise((resolve, reject) => {
|
|
@@ -141,7 +144,10 @@ class FetchHttpHandler {
|
|
|
141
144
|
}
|
|
142
145
|
}));
|
|
143
146
|
}
|
|
144
|
-
return Promise.race(raceOfPromises).finally(
|
|
147
|
+
return Promise.race(raceOfPromises).finally(() => {
|
|
148
|
+
timeout.cancel();
|
|
149
|
+
removeSignalEventListener();
|
|
150
|
+
});
|
|
145
151
|
}
|
|
146
152
|
updateHttpClientConfig(key, value) {
|
|
147
153
|
this.config = undefined;
|
|
@@ -78,6 +78,7 @@ export class FetchHttpHandler {
|
|
|
78
78
|
Object.assign(requestOptions, this.config.requestInit(request));
|
|
79
79
|
}
|
|
80
80
|
let removeSignalEventListener = () => { };
|
|
81
|
+
const timeout = requestTimeoutFn(requestTimeoutInMs);
|
|
81
82
|
const fetchRequest = createRequest(url, requestOptions);
|
|
82
83
|
const raceOfPromises = [
|
|
83
84
|
fetchFn(fetchRequest).then((response) => {
|
|
@@ -106,7 +107,7 @@ export class FetchHttpHandler {
|
|
|
106
107
|
}),
|
|
107
108
|
};
|
|
108
109
|
}),
|
|
109
|
-
|
|
110
|
+
timeout.promise,
|
|
110
111
|
];
|
|
111
112
|
if (abortSignal) {
|
|
112
113
|
raceOfPromises.push(new Promise((resolve, reject) => {
|
|
@@ -124,7 +125,10 @@ export class FetchHttpHandler {
|
|
|
124
125
|
}
|
|
125
126
|
}));
|
|
126
127
|
}
|
|
127
|
-
return Promise.race(raceOfPromises).finally(
|
|
128
|
+
return Promise.race(raceOfPromises).finally(() => {
|
|
129
|
+
timeout.cancel();
|
|
130
|
+
removeSignalEventListener();
|
|
131
|
+
});
|
|
128
132
|
}
|
|
129
133
|
updateHttpClientConfig(key, value) {
|
|
130
134
|
this.config = undefined;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
export function requestTimeout(timeoutInMs = 0) {
|
|
2
|
-
|
|
2
|
+
let timeoutId;
|
|
3
|
+
const promise = new Promise((resolve, reject) => {
|
|
3
4
|
if (timeoutInMs) {
|
|
4
|
-
setTimeout(() => {
|
|
5
|
+
timeoutId = setTimeout(() => {
|
|
5
6
|
const timeoutError = new Error(`Request did not complete within ${timeoutInMs} ms`);
|
|
6
7
|
timeoutError.name = "TimeoutError";
|
|
7
8
|
reject(timeoutError);
|
|
8
9
|
}, timeoutInMs);
|
|
9
10
|
}
|
|
10
11
|
});
|
|
12
|
+
return { promise, cancel: () => clearTimeout(timeoutId) };
|
|
11
13
|
}
|
|
@@ -1 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Rejects with a TimeoutError after `timeoutInMs` (never, for 0).
|
|
3
|
+
*
|
|
4
|
+
* Call `cancel` once the request settles: a pending timer keeps the request
|
|
5
|
+
* race, and the response it settled with, reachable until the timer fires.
|
|
6
|
+
*
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
export declare function requestTimeout(timeoutInMs?: number): {
|
|
10
|
+
promise: Promise<never>;
|
|
11
|
+
cancel: () => void;
|
|
12
|
+
};
|
|
@@ -1 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Rejects with a TimeoutError after `timeoutInMs` (never, for 0).
|
|
3
|
+
*
|
|
4
|
+
* Call `cancel` once the request settles: a pending timer keeps the request
|
|
5
|
+
* race, and the response it settled with, reachable until the timer fires.
|
|
6
|
+
*
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
export declare function requestTimeout(timeoutInMs?: number): {
|
|
10
|
+
promise: Promise<never>;
|
|
11
|
+
cancel: () => void;
|
|
12
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@smithy/fetch-http-handler",
|
|
3
|
-
"version": "5.8.
|
|
3
|
+
"version": "5.8.1",
|
|
4
4
|
"description": "Provides a way to make requests",
|
|
5
5
|
"homepage": "https://github.com/smithy-lang/smithy-typescript/tree/main/packages/fetch-http-handler",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"test:browser:watch": "yarn g:vitest watch -c vitest.config.browser.mts"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@smithy/core": "^3.
|
|
44
|
-
"@smithy/types": "^4.
|
|
43
|
+
"@smithy/core": "^3.39.0",
|
|
44
|
+
"@smithy/types": "^4.20.0",
|
|
45
45
|
"tslib": "^2.6.2"
|
|
46
46
|
},
|
|
47
47
|
"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) {
|
|
@@ -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) {
|
|
@@ -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,
|
package/package.json
CHANGED
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"organization": true
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@aws-cdk/integ-runner": "2.206.
|
|
43
|
+
"@aws-cdk/integ-runner": "2.206.1",
|
|
44
44
|
"@aws-cdk/integ-tests-alpha": "2.263.0-alpha.0",
|
|
45
45
|
"@commitlint/cli": "^20.1.0",
|
|
46
46
|
"@commitlint/config-conventional": "^20.0.0",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"jsii-pacmak": "^1.142.0",
|
|
70
70
|
"jsii-rosetta": "~5.9.0",
|
|
71
71
|
"jsonfile": "^6.2.1",
|
|
72
|
-
"projen": "^0.104.
|
|
72
|
+
"projen": "^0.104.27",
|
|
73
73
|
"ts-jest": "^29.4.15",
|
|
74
74
|
"ts-node": "^10.9.2",
|
|
75
75
|
"typescript": "^6.0.2"
|
|
@@ -79,12 +79,12 @@
|
|
|
79
79
|
"constructs": "^10.5.1"
|
|
80
80
|
},
|
|
81
81
|
"dependencies": {
|
|
82
|
-
"@aws-sdk/client-cloudwatch-logs": "^3.
|
|
83
|
-
"@aws-sdk/client-route-53": "^3.
|
|
84
|
-
"@aws-sdk/client-s3": "^3.
|
|
85
|
-
"@aws-sdk/client-ses": "^3.
|
|
86
|
-
"@aws-sdk/client-ssm": "^3.
|
|
87
|
-
"@mavogel/mvc-projen": "^0.0.
|
|
82
|
+
"@aws-sdk/client-cloudwatch-logs": "^3.1165.0",
|
|
83
|
+
"@aws-sdk/client-route-53": "^3.1165.0",
|
|
84
|
+
"@aws-sdk/client-s3": "^3.1165.0",
|
|
85
|
+
"@aws-sdk/client-ses": "^3.1165.0",
|
|
86
|
+
"@aws-sdk/client-ssm": "^3.1165.0",
|
|
87
|
+
"@mavogel/mvc-projen": "^0.0.75",
|
|
88
88
|
"cdk-nag": "^3.0.1",
|
|
89
89
|
"constructs": "^10.5.1",
|
|
90
90
|
"mailparser": "^3.14.2",
|
|
@@ -122,7 +122,7 @@
|
|
|
122
122
|
"publishConfig": {
|
|
123
123
|
"access": "public"
|
|
124
124
|
},
|
|
125
|
-
"version": "0.1.
|
|
125
|
+
"version": "0.1.42",
|
|
126
126
|
"jest": {
|
|
127
127
|
"coverageProvider": "v8",
|
|
128
128
|
"transformIgnorePatterns": [
|