@mavogel/awscdk-rootmail 0.1.28 → 0.1.30
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 +9 -9
- package/lib/rootmail.js +1 -1
- package/lib/ses-receive.js +1 -1
- package/node_modules/@aws-sdk/checksums/package.json +3 -3
- package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-cjs/index.js +1 -1
- package/node_modules/@aws-sdk/client-cloudwatch-logs/package.json +6 -6
- package/node_modules/@aws-sdk/client-route-53/dist-cjs/index.js +1 -1
- package/node_modules/@aws-sdk/client-route-53/package.json +6 -6
- package/node_modules/@aws-sdk/client-s3/dist-cjs/index.js +1 -1
- package/node_modules/@aws-sdk/client-s3/package.json +9 -9
- package/node_modules/@aws-sdk/client-ses/dist-cjs/index.js +1 -1
- package/node_modules/@aws-sdk/client-ses/package.json +6 -6
- package/node_modules/@aws-sdk/client-ssm/dist-cjs/index.js +1 -1
- package/node_modules/@aws-sdk/client-ssm/package.json +5 -5
- package/node_modules/@aws-sdk/core/package.json +2 -2
- 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/middleware-sdk-s3/package.json +3 -3
- 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 +4 -4
- package/node_modules/@aws-sdk/token-providers/package.json +4 -4
- package/node_modules/@smithy/core/dist-cjs/submodules/cbor/index.js +13 -37
- package/node_modules/@smithy/core/dist-cjs/submodules/protocols/index.js +44 -29
- package/node_modules/@smithy/core/dist-es/submodules/cbor/SmithyRpcV2CborProtocol.js +12 -37
- package/node_modules/@smithy/core/dist-es/submodules/protocols/AbstractRpcV2Protocol.js +35 -0
- package/node_modules/@smithy/core/dist-es/submodules/protocols/RpcProtocol.js +4 -1
- package/node_modules/@smithy/core/dist-es/submodules/protocols/index.js +1 -0
- package/node_modules/@smithy/core/dist-es/submodules/protocols/json/SmithyRpcV2JsonProtocol.js +8 -31
- package/node_modules/@smithy/core/dist-types/submodules/cbor/SmithyRpcV2CborProtocol.d.ts +5 -14
- package/node_modules/@smithy/core/dist-types/submodules/protocols/AbstractRpcV2Protocol.d.ts +45 -0
- package/node_modules/@smithy/core/dist-types/submodules/protocols/RpcProtocol.d.ts +12 -0
- package/node_modules/@smithy/core/dist-types/submodules/protocols/index.d.ts +1 -0
- package/node_modules/@smithy/core/dist-types/submodules/protocols/json/SmithyRpcV2JsonProtocol.d.ts +5 -14
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/cbor/SmithyRpcV2CborProtocol.d.ts +5 -14
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/AbstractRpcV2Protocol.d.ts +45 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/RpcProtocol.d.ts +12 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/index.d.ts +1 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/json/SmithyRpcV2JsonProtocol.d.ts +5 -14
- package/node_modules/@smithy/core/package.json +1 -1
- package/node_modules/@smithy/node-http-handler/dist-cjs/index.js +48 -6
- package/node_modules/@smithy/node-http-handler/dist-es/node-http-handler.js +9 -1
- package/node_modules/@smithy/node-http-handler/dist-es/node-http2-handler.js +20 -2
- package/node_modules/@smithy/node-http-handler/dist-es/resolve-default-socket-timeout.js +4 -0
- package/node_modules/@smithy/node-http-handler/dist-es/set-socket-timeout.js +16 -3
- package/node_modules/@smithy/node-http-handler/dist-types/resolve-default-socket-timeout.d.ts +4 -0
- package/node_modules/@smithy/node-http-handler/dist-types/set-socket-timeout.d.ts +6 -1
- package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/resolve-default-socket-timeout.d.ts +4 -0
- package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/set-socket-timeout.d.ts +6 -1
- package/node_modules/@smithy/node-http-handler/package.json +3 -3
- package/node_modules/bowser/README.md +26 -3
- package/node_modules/bowser/bowser.mjs +2225 -0
- package/node_modules/bowser/bundled.js +14 -1
- package/node_modules/bowser/es5.js +14 -1
- package/node_modules/bowser/index.d.mts +45 -0
- package/node_modules/bowser/package.json +90 -31
- package/node_modules/bowser/src/bowser.js +9 -1
- package/node_modules/bowser/src/constants.js +7 -0
- package/node_modules/bowser/src/parser-browsers.js +73 -7
- package/node_modules/bowser/src/parser-engines.js +12 -0
- package/node_modules/bowser/src/parser-os.js +3 -1
- package/node_modules/bowser/src/parser-platforms.js +3 -1
- package/node_modules/bowser/src/parser.js +22 -5
- package/node_modules/bowser/src/utils.js +16 -0
- package/package.json +9 -9
|
@@ -1,28 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { EndpointBearer, HandlerExecutionContext, HttpRequest as IHttpRequest, HttpResponse as IHttpResponse, MetadataBearer, OperationSchema, ResponseMetadata, SerdeFunctions, ShapeDeserializer, ShapeSerializer } from "@smithy/types";
|
|
1
|
+
import { AbstractRpcV2Protocol } from "../AbstractRpcV2Protocol";
|
|
2
|
+
import { HandlerExecutionContext, HttpRequest as IHttpRequest, HttpResponse as IHttpResponse, OperationSchema, ResponseMetadata, SerdeFunctions, ShapeDeserializer, ShapeSerializer } from "@smithy/types";
|
|
4
3
|
import { JsonCodec2 } from "./codec-v2/JsonCodec2";
|
|
5
4
|
/**
|
|
6
5
|
* Client protocol for Smithy RPCv2 JSON.
|
|
7
6
|
*
|
|
8
7
|
* @public
|
|
9
8
|
*/
|
|
10
|
-
export declare class SmithyRpcV2JsonProtocol extends
|
|
11
|
-
/**
|
|
12
|
-
* @override
|
|
13
|
-
*/
|
|
14
|
-
protected compositeErrorRegistry: TypeRegistry;
|
|
9
|
+
export declare class SmithyRpcV2JsonProtocol extends AbstractRpcV2Protocol {
|
|
15
10
|
private codec;
|
|
16
11
|
protected serializer: ShapeSerializer<string | Uint8Array>;
|
|
17
12
|
protected deserializer: ShapeDeserializer<string | Uint8Array>;
|
|
18
|
-
constructor({ defaultNamespace, errorTypeRegistries, }: {
|
|
19
|
-
defaultNamespace: string;
|
|
20
|
-
errorTypeRegistries?: TypeRegistry[];
|
|
21
|
-
});
|
|
22
13
|
getShapeId(): string;
|
|
23
14
|
getPayloadCodec(): JsonCodec2;
|
|
24
|
-
|
|
25
|
-
|
|
15
|
+
protected getSmithyProtocolHeaderValue(): string;
|
|
16
|
+
protected applyEmptyBody(request: IHttpRequest): void;
|
|
26
17
|
protected handleError(operationSchema: OperationSchema, context: HandlerExecutionContext & SerdeFunctions, response: IHttpResponse, dataObject: any, metadata: ResponseMetadata): Promise<never>;
|
|
27
18
|
protected getDefaultContentType(): string;
|
|
28
19
|
}
|
|
@@ -123,13 +123,26 @@ const setSocketKeepAlive = (request, { keepAlive, keepAliveMsecs }, deferTimeMs
|
|
|
123
123
|
return timing.setTimeout(registerListener, deferTimeMs);
|
|
124
124
|
};
|
|
125
125
|
|
|
126
|
+
const resolveDefaultSocketTimeout = (config) => {
|
|
127
|
+
const value = config?.defaultSocketTimeout;
|
|
128
|
+
return typeof value === "number" && Number.isFinite(value) && value > 0 ? value : undefined;
|
|
129
|
+
};
|
|
130
|
+
|
|
126
131
|
const DEFER_EVENT_LISTENER_TIME = 3000;
|
|
127
|
-
const setSocketTimeout = (request, reject, timeoutInMs = 0) => {
|
|
132
|
+
const setSocketTimeout = (request, reject, timeoutInMs = 0, destroyResponseBodyOnTimeout = false) => {
|
|
133
|
+
let response;
|
|
134
|
+
if (destroyResponseBodyOnTimeout) {
|
|
135
|
+
request.once("response", (res) => (response = res));
|
|
136
|
+
}
|
|
128
137
|
const registerTimeout = (offset) => {
|
|
129
138
|
const timeout = timeoutInMs - offset;
|
|
130
139
|
const onTimeout = () => {
|
|
140
|
+
const error = Object.assign(new Error(`@smithy/node-http-handler - the request socket timed out after ${timeoutInMs} ms of inactivity (${destroyResponseBodyOnTimeout ? "service default socket timeout" : "configured by client requestHandler"}).`), { name: "TimeoutError" });
|
|
141
|
+
if (destroyResponseBodyOnTimeout) {
|
|
142
|
+
response?.destroy(error);
|
|
143
|
+
}
|
|
131
144
|
request.destroy();
|
|
132
|
-
reject(
|
|
145
|
+
reject(error);
|
|
133
146
|
};
|
|
134
147
|
if (request.socket) {
|
|
135
148
|
request.socket.setTimeout(timeout, onTimeout);
|
|
@@ -143,7 +156,12 @@ const setSocketTimeout = (request, reject, timeoutInMs = 0) => {
|
|
|
143
156
|
registerTimeout(0);
|
|
144
157
|
return 0;
|
|
145
158
|
}
|
|
146
|
-
|
|
159
|
+
const deferralId = timing.setTimeout(registerTimeout.bind(null, timeoutInMs === 0 ? 0 : DEFER_EVENT_LISTENER_TIME), DEFER_EVENT_LISTENER_TIME);
|
|
160
|
+
if (destroyResponseBodyOnTimeout) {
|
|
161
|
+
request.once("close", () => timing.clearTimeout(deferralId));
|
|
162
|
+
return 0;
|
|
163
|
+
}
|
|
164
|
+
return deferralId;
|
|
147
165
|
};
|
|
148
166
|
|
|
149
167
|
const MIN_WAIT_TIME = 6_000;
|
|
@@ -383,7 +401,13 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
|
|
|
383
401
|
const effectiveRequestTimeout = requestTimeout ?? config.requestTimeout;
|
|
384
402
|
connectionTimeoutId = setConnectionTimeout(req, reject, config.connectionTimeout);
|
|
385
403
|
requestTimeoutId = setRequestTimeout(req, reject, effectiveRequestTimeout, config.throwOnRequestTimeout, logger ?? console);
|
|
386
|
-
|
|
404
|
+
const defaultSocketTimeout = config.socketTimeout === undefined ? resolveDefaultSocketTimeout(config) : undefined;
|
|
405
|
+
if (defaultSocketTimeout) {
|
|
406
|
+
socketTimeoutId = setSocketTimeout(req, reject, defaultSocketTimeout, true);
|
|
407
|
+
}
|
|
408
|
+
else {
|
|
409
|
+
socketTimeoutId = setSocketTimeout(req, reject, config.socketTimeout);
|
|
410
|
+
}
|
|
387
411
|
const httpAgent = nodeHttpsOptions.agent;
|
|
388
412
|
if (typeof httpAgent === "object" && "keepAlive" in httpAgent) {
|
|
389
413
|
keepAliveTimeoutId = setSocketKeepAlive(req, {
|
|
@@ -423,6 +447,7 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
|
|
|
423
447
|
connectionTimeout,
|
|
424
448
|
requestTimeout,
|
|
425
449
|
socketTimeout,
|
|
450
|
+
defaultSocketTimeout: resolveDefaultSocketTimeout(options),
|
|
426
451
|
socketAcquisitionWarningTimeout,
|
|
427
452
|
throwOnRequestTimeout,
|
|
428
453
|
httpAgentProvider: async () => {
|
|
@@ -710,7 +735,8 @@ class NodeHttp2Handler {
|
|
|
710
735
|
}
|
|
711
736
|
async handle(request, { abortSignal, requestTimeout, isEventStream } = {}) {
|
|
712
737
|
if (!this.config) {
|
|
713
|
-
|
|
738
|
+
const config = await this.configProvider;
|
|
739
|
+
this.config = { ...config, defaultSocketTimeout: resolveDefaultSocketTimeout(config) };
|
|
714
740
|
const { disableConcurrentStreams, maxConcurrentStreams, nodeHttp2ConnectOptions } = this.config;
|
|
715
741
|
this.connectionManager.setDisableConcurrentStreams(disableConcurrentStreams ?? false);
|
|
716
742
|
if (maxConcurrentStreams) {
|
|
@@ -720,9 +746,12 @@ class NodeHttp2Handler {
|
|
|
720
746
|
this.connectionManager.setNodeHttp2ConnectOptions(nodeHttp2ConnectOptions);
|
|
721
747
|
}
|
|
722
748
|
}
|
|
723
|
-
const { requestTimeout: configRequestTimeout, disableConcurrentStreams } = this.config;
|
|
749
|
+
const { requestTimeout: configRequestTimeout, disableConcurrentStreams, sessionTimeout } = this.config;
|
|
724
750
|
const useIsolatedSession = disableConcurrentStreams || isEventStream;
|
|
725
751
|
const effectiveRequestTimeout = requestTimeout ?? configRequestTimeout;
|
|
752
|
+
const defaultSocketTimeout = effectiveRequestTimeout === undefined && sessionTimeout === undefined
|
|
753
|
+
? this.config.defaultSocketTimeout
|
|
754
|
+
: undefined;
|
|
726
755
|
return new Promise((_resolve, _reject) => {
|
|
727
756
|
let fulfilled = false;
|
|
728
757
|
let writeRequestBodyPromise = undefined;
|
|
@@ -785,6 +814,19 @@ class NodeHttp2Handler {
|
|
|
785
814
|
rejectWithDestroy(timeoutError);
|
|
786
815
|
});
|
|
787
816
|
}
|
|
817
|
+
else if (defaultSocketTimeout) {
|
|
818
|
+
clientHttp2Stream.setTimeout(defaultSocketTimeout, () => {
|
|
819
|
+
const timeoutError = new Error(`Stream timed out because of no activity for ${defaultSocketTimeout} ms`);
|
|
820
|
+
timeoutError.name = "TimeoutError";
|
|
821
|
+
fulfilled = true;
|
|
822
|
+
reject(timeoutError);
|
|
823
|
+
clientHttp2Stream.destroy(timeoutError);
|
|
824
|
+
if (useIsolatedSession) {
|
|
825
|
+
ref.destroy();
|
|
826
|
+
}
|
|
827
|
+
});
|
|
828
|
+
clientHttp2Stream.once("response", () => clientHttp2Stream.setTimeout(defaultSocketTimeout));
|
|
829
|
+
}
|
|
788
830
|
if (abortSignal) {
|
|
789
831
|
const onAbort = () => {
|
|
790
832
|
clientHttp2Stream.close();
|
|
@@ -7,6 +7,7 @@ import { node_https } from "./node-https";
|
|
|
7
7
|
import { setConnectionTimeout } from "./set-connection-timeout";
|
|
8
8
|
import { setRequestTimeout } from "./set-request-timeout";
|
|
9
9
|
import { setSocketKeepAlive } from "./set-socket-keep-alive";
|
|
10
|
+
import { resolveDefaultSocketTimeout } from "./resolve-default-socket-timeout";
|
|
10
11
|
import { setSocketTimeout } from "./set-socket-timeout";
|
|
11
12
|
import { timing } from "./timing";
|
|
12
13
|
import { writeRequestBody } from "./write-request-body";
|
|
@@ -185,7 +186,13 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
|
|
|
185
186
|
const effectiveRequestTimeout = requestTimeout ?? config.requestTimeout;
|
|
186
187
|
connectionTimeoutId = setConnectionTimeout(req, reject, config.connectionTimeout);
|
|
187
188
|
requestTimeoutId = setRequestTimeout(req, reject, effectiveRequestTimeout, config.throwOnRequestTimeout, logger ?? console);
|
|
188
|
-
|
|
189
|
+
const defaultSocketTimeout = config.socketTimeout === undefined ? resolveDefaultSocketTimeout(config) : undefined;
|
|
190
|
+
if (defaultSocketTimeout) {
|
|
191
|
+
socketTimeoutId = setSocketTimeout(req, reject, defaultSocketTimeout, true);
|
|
192
|
+
}
|
|
193
|
+
else {
|
|
194
|
+
socketTimeoutId = setSocketTimeout(req, reject, config.socketTimeout);
|
|
195
|
+
}
|
|
189
196
|
const httpAgent = nodeHttpsOptions.agent;
|
|
190
197
|
if (typeof httpAgent === "object" && "keepAlive" in httpAgent) {
|
|
191
198
|
keepAliveTimeoutId = setSocketKeepAlive(req, {
|
|
@@ -225,6 +232,7 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
|
|
|
225
232
|
connectionTimeout,
|
|
226
233
|
requestTimeout,
|
|
227
234
|
socketTimeout,
|
|
235
|
+
defaultSocketTimeout: resolveDefaultSocketTimeout(options),
|
|
228
236
|
socketAcquisitionWarningTimeout,
|
|
229
237
|
throwOnRequestTimeout,
|
|
230
238
|
httpAgentProvider: async () => {
|
|
@@ -3,6 +3,7 @@ import { buildAbortError } from "./build-abort-error";
|
|
|
3
3
|
import { getTransformedHeaders } from "./get-transformed-headers";
|
|
4
4
|
import { node_http2 } from "./node-http2";
|
|
5
5
|
import { NodeHttp2ConnectionManager } from "./node-http2-connection-manager";
|
|
6
|
+
import { resolveDefaultSocketTimeout } from "./resolve-default-socket-timeout";
|
|
6
7
|
import { writeRequestBody } from "./write-request-body";
|
|
7
8
|
const { constants } = node_http2;
|
|
8
9
|
export class NodeHttp2Handler {
|
|
@@ -35,7 +36,8 @@ export class NodeHttp2Handler {
|
|
|
35
36
|
}
|
|
36
37
|
async handle(request, { abortSignal, requestTimeout, isEventStream } = {}) {
|
|
37
38
|
if (!this.config) {
|
|
38
|
-
|
|
39
|
+
const config = await this.configProvider;
|
|
40
|
+
this.config = { ...config, defaultSocketTimeout: resolveDefaultSocketTimeout(config) };
|
|
39
41
|
const { disableConcurrentStreams, maxConcurrentStreams, nodeHttp2ConnectOptions } = this.config;
|
|
40
42
|
this.connectionManager.setDisableConcurrentStreams(disableConcurrentStreams ?? false);
|
|
41
43
|
if (maxConcurrentStreams) {
|
|
@@ -45,9 +47,12 @@ export class NodeHttp2Handler {
|
|
|
45
47
|
this.connectionManager.setNodeHttp2ConnectOptions(nodeHttp2ConnectOptions);
|
|
46
48
|
}
|
|
47
49
|
}
|
|
48
|
-
const { requestTimeout: configRequestTimeout, disableConcurrentStreams } = this.config;
|
|
50
|
+
const { requestTimeout: configRequestTimeout, disableConcurrentStreams, sessionTimeout } = this.config;
|
|
49
51
|
const useIsolatedSession = disableConcurrentStreams || isEventStream;
|
|
50
52
|
const effectiveRequestTimeout = requestTimeout ?? configRequestTimeout;
|
|
53
|
+
const defaultSocketTimeout = effectiveRequestTimeout === undefined && sessionTimeout === undefined
|
|
54
|
+
? this.config.defaultSocketTimeout
|
|
55
|
+
: undefined;
|
|
51
56
|
return new Promise((_resolve, _reject) => {
|
|
52
57
|
let fulfilled = false;
|
|
53
58
|
let writeRequestBodyPromise = undefined;
|
|
@@ -110,6 +115,19 @@ export class NodeHttp2Handler {
|
|
|
110
115
|
rejectWithDestroy(timeoutError);
|
|
111
116
|
});
|
|
112
117
|
}
|
|
118
|
+
else if (defaultSocketTimeout) {
|
|
119
|
+
clientHttp2Stream.setTimeout(defaultSocketTimeout, () => {
|
|
120
|
+
const timeoutError = new Error(`Stream timed out because of no activity for ${defaultSocketTimeout} ms`);
|
|
121
|
+
timeoutError.name = "TimeoutError";
|
|
122
|
+
fulfilled = true;
|
|
123
|
+
reject(timeoutError);
|
|
124
|
+
clientHttp2Stream.destroy(timeoutError);
|
|
125
|
+
if (useIsolatedSession) {
|
|
126
|
+
ref.destroy();
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
clientHttp2Stream.once("response", () => clientHttp2Stream.setTimeout(defaultSocketTimeout));
|
|
130
|
+
}
|
|
113
131
|
if (abortSignal) {
|
|
114
132
|
const onAbort = () => {
|
|
115
133
|
clientHttp2Stream.close();
|
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
import { timing } from "./timing";
|
|
2
2
|
const DEFER_EVENT_LISTENER_TIME = 3000;
|
|
3
|
-
export const setSocketTimeout = (request, reject, timeoutInMs = 0) => {
|
|
3
|
+
export const setSocketTimeout = (request, reject, timeoutInMs = 0, destroyResponseBodyOnTimeout = false) => {
|
|
4
|
+
let response;
|
|
5
|
+
if (destroyResponseBodyOnTimeout) {
|
|
6
|
+
request.once("response", (res) => (response = res));
|
|
7
|
+
}
|
|
4
8
|
const registerTimeout = (offset) => {
|
|
5
9
|
const timeout = timeoutInMs - offset;
|
|
6
10
|
const onTimeout = () => {
|
|
11
|
+
const error = Object.assign(new Error(`@smithy/node-http-handler - the request socket timed out after ${timeoutInMs} ms of inactivity (${destroyResponseBodyOnTimeout ? "service default socket timeout" : "configured by client requestHandler"}).`), { name: "TimeoutError" });
|
|
12
|
+
if (destroyResponseBodyOnTimeout) {
|
|
13
|
+
response?.destroy(error);
|
|
14
|
+
}
|
|
7
15
|
request.destroy();
|
|
8
|
-
reject(
|
|
16
|
+
reject(error);
|
|
9
17
|
};
|
|
10
18
|
if (request.socket) {
|
|
11
19
|
request.socket.setTimeout(timeout, onTimeout);
|
|
@@ -19,5 +27,10 @@ export const setSocketTimeout = (request, reject, timeoutInMs = 0) => {
|
|
|
19
27
|
registerTimeout(0);
|
|
20
28
|
return 0;
|
|
21
29
|
}
|
|
22
|
-
|
|
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;
|
|
34
|
+
}
|
|
35
|
+
return deferralId;
|
|
23
36
|
};
|
|
@@ -1,2 +1,7 @@
|
|
|
1
1
|
import type { ClientRequest } from "node:http";
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
* @param destroyResponseBodyOnTimeout - set by the service default. On timeout the response
|
|
5
|
+
* body is destroyed with the TimeoutError, and the timeout stays armed through the body.
|
|
6
|
+
*/
|
|
7
|
+
export declare const setSocketTimeout: (request: ClientRequest, reject: (err: Error) => void, timeoutInMs?: number, destroyResponseBodyOnTimeout?: boolean) => NodeJS.Timeout | number;
|
|
@@ -1,2 +1,7 @@
|
|
|
1
1
|
import { ClientRequest } from "node:http";
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
* @param destroyResponseBodyOnTimeout - set by the service default. On timeout the response
|
|
5
|
+
* body is destroyed with the TimeoutError, and the timeout stays armed through the body.
|
|
6
|
+
*/
|
|
7
|
+
export declare const setSocketTimeout: (request: ClientRequest, reject: (err: Error) => void, timeoutInMs?: number, destroyResponseBodyOnTimeout?: boolean) => NodeJS.Timeout | number;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@smithy/node-http-handler",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.13.0",
|
|
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.37.0",
|
|
43
|
+
"@smithy/types": "^4.19.0",
|
|
44
44
|
"tslib": "^2.6.2"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
@@ -27,7 +27,9 @@ _For legacy code, check out the [1.x](https://github.com/bowser-js/bowser/tree/v
|
|
|
27
27
|
|
|
28
28
|
# Use cases
|
|
29
29
|
|
|
30
|
-
First of all, require the library.
|
|
30
|
+
First of all, require the library. Bowser is a dual package: `require` resolves
|
|
31
|
+
to a UMD build (which also works for AMD and as a plain `<script>` tag), and
|
|
32
|
+
`import` resolves to a real ES module.
|
|
31
33
|
|
|
32
34
|
```javascript
|
|
33
35
|
const Bowser = require("bowser"); // CommonJS
|
|
@@ -37,11 +39,32 @@ import * as Bowser from "bowser"; // TypeScript
|
|
|
37
39
|
import Bowser from "bowser"; // ES6 (and TypeScript with --esModuleInterop enabled)
|
|
38
40
|
```
|
|
39
41
|
|
|
42
|
+
The ES module build also exposes `parse`, `getParser`, `BROWSER_MAP`,
|
|
43
|
+
`ENGINE_MAP`, `OS_MAP` and `PLATFORMS_MAP` as named exports. Detection needs
|
|
44
|
+
every parser either way, so named imports are a matter of style, not bundle
|
|
45
|
+
size — but an import that ends up unused is dropped entirely:
|
|
46
|
+
|
|
47
|
+
```javascript
|
|
48
|
+
import { getParser, parse } from "bowser";
|
|
49
|
+
|
|
50
|
+
const browser = getParser(window.navigator.userAgent);
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Loaded from a CDN or a `<script>` tag, Bowser attaches itself to the global as
|
|
54
|
+
`bowser` (lowercase):
|
|
55
|
+
|
|
56
|
+
```html
|
|
57
|
+
<script src="https://unpkg.com/bowser@2/es5.js"></script>
|
|
58
|
+
<script>
|
|
59
|
+
console.log(bowser.parse(window.navigator.userAgent));
|
|
60
|
+
</script>
|
|
61
|
+
```
|
|
62
|
+
|
|
40
63
|
By default, the exported version is the *ES5 transpiled version*, which **do not** include any polyfills.
|
|
41
64
|
|
|
42
|
-
In case you don't use your own
|
|
65
|
+
In case you don't use your own polyfills you may need to have pre-built bundle with all needed polyfills.
|
|
43
66
|
So, for you it's suitable to require bowser like this: `require('bowser/bundled')`.
|
|
44
|
-
As the result, you get a ES5 version of bowser with `
|
|
67
|
+
As the result, you get a ES5 version of bowser with `core-js` polyfills bundled together.
|
|
45
68
|
|
|
46
69
|
You may need to use the source files, so they will be available in the package as well.
|
|
47
70
|
|