@aws-sdk/middleware-websocket 3.518.0 → 3.523.0
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/dist-cjs/index.js
CHANGED
|
@@ -241,9 +241,11 @@ var _WebSocketFetchHandler = class _WebSocketFetchHandler {
|
|
|
241
241
|
this.sockets = {};
|
|
242
242
|
this.httpHandler = httpHandler;
|
|
243
243
|
if (typeof options === "function") {
|
|
244
|
-
this.
|
|
244
|
+
this.config = {};
|
|
245
|
+
this.configPromise = options().then((opts) => this.config = opts ?? {});
|
|
245
246
|
} else {
|
|
246
|
-
this.
|
|
247
|
+
this.config = options ?? {};
|
|
248
|
+
this.configPromise = Promise.resolve(this.config);
|
|
247
249
|
}
|
|
248
250
|
}
|
|
249
251
|
/**
|
|
@@ -282,7 +284,8 @@ var _WebSocketFetchHandler = class _WebSocketFetchHandler {
|
|
|
282
284
|
}
|
|
283
285
|
this.sockets[url].push(socket);
|
|
284
286
|
socket.binaryType = "arraybuffer";
|
|
285
|
-
|
|
287
|
+
this.config = await this.configPromise;
|
|
288
|
+
const { connectionTimeout = DEFAULT_WS_CONNECTION_TIMEOUT_MS } = this.config;
|
|
286
289
|
await this.waitForReady(socket, connectionTimeout);
|
|
287
290
|
const { body } = request;
|
|
288
291
|
const bodyStream = getIterator(body);
|
|
@@ -296,6 +299,15 @@ var _WebSocketFetchHandler = class _WebSocketFetchHandler {
|
|
|
296
299
|
})
|
|
297
300
|
};
|
|
298
301
|
}
|
|
302
|
+
updateHttpClientConfig(key, value) {
|
|
303
|
+
this.configPromise = this.configPromise.then((config) => {
|
|
304
|
+
config[key] = value;
|
|
305
|
+
return config;
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
httpHandlerConfigs() {
|
|
309
|
+
return this.config ?? {};
|
|
310
|
+
}
|
|
299
311
|
/**
|
|
300
312
|
* Removes all closing/closed sockets from the socket pool for URL.
|
|
301
313
|
*/
|
|
@@ -18,10 +18,12 @@ export class WebSocketFetchHandler {
|
|
|
18
18
|
this.sockets = {};
|
|
19
19
|
this.httpHandler = httpHandler;
|
|
20
20
|
if (typeof options === "function") {
|
|
21
|
-
this.
|
|
21
|
+
this.config = {};
|
|
22
|
+
this.configPromise = options().then((opts) => (this.config = opts ?? {}));
|
|
22
23
|
}
|
|
23
24
|
else {
|
|
24
|
-
this.
|
|
25
|
+
this.config = options ?? {};
|
|
26
|
+
this.configPromise = Promise.resolve(this.config);
|
|
25
27
|
}
|
|
26
28
|
}
|
|
27
29
|
destroy() {
|
|
@@ -43,7 +45,8 @@ export class WebSocketFetchHandler {
|
|
|
43
45
|
}
|
|
44
46
|
this.sockets[url].push(socket);
|
|
45
47
|
socket.binaryType = "arraybuffer";
|
|
46
|
-
|
|
48
|
+
this.config = await this.configPromise;
|
|
49
|
+
const { connectionTimeout = DEFAULT_WS_CONNECTION_TIMEOUT_MS } = this.config;
|
|
47
50
|
await this.waitForReady(socket, connectionTimeout);
|
|
48
51
|
const { body } = request;
|
|
49
52
|
const bodyStream = getIterator(body);
|
|
@@ -56,6 +59,15 @@ export class WebSocketFetchHandler {
|
|
|
56
59
|
}),
|
|
57
60
|
};
|
|
58
61
|
}
|
|
62
|
+
updateHttpClientConfig(key, value) {
|
|
63
|
+
this.configPromise = this.configPromise.then((config) => {
|
|
64
|
+
config[key] = value;
|
|
65
|
+
return config;
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
httpHandlerConfigs() {
|
|
69
|
+
return this.config ?? {};
|
|
70
|
+
}
|
|
59
71
|
removeNotUsableSockets(url) {
|
|
60
72
|
this.sockets[url] = (this.sockets[url] ?? []).filter((socket) => ![WebSocket.CLOSING, WebSocket.CLOSED].includes(socket.readyState));
|
|
61
73
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { HttpRequest, HttpResponse } from "@smithy/protocol-http";
|
|
2
2
|
import {
|
|
3
3
|
Provider,
|
|
4
4
|
RequestHandler,
|
|
@@ -9,16 +9,17 @@ export interface WebSocketFetchHandlerOptions {
|
|
|
9
9
|
}
|
|
10
10
|
export declare class WebSocketFetchHandler {
|
|
11
11
|
readonly metadata: RequestHandlerMetadata;
|
|
12
|
-
private
|
|
12
|
+
private config;
|
|
13
|
+
private configPromise;
|
|
13
14
|
private readonly httpHandler;
|
|
14
15
|
private readonly sockets;
|
|
15
16
|
static create(
|
|
16
17
|
instanceOrOptions?:
|
|
17
|
-
|
|
|
18
|
+
| WebSocketFetchHandler
|
|
18
19
|
| WebSocketFetchHandlerOptions
|
|
19
20
|
| Provider<WebSocketFetchHandlerOptions | void>,
|
|
20
21
|
httpHandler?: RequestHandler<any, any>
|
|
21
|
-
):
|
|
22
|
+
): WebSocketFetchHandler;
|
|
22
23
|
constructor(
|
|
23
24
|
options?:
|
|
24
25
|
| WebSocketFetchHandlerOptions
|
|
@@ -29,6 +30,11 @@ export declare class WebSocketFetchHandler {
|
|
|
29
30
|
handle(request: HttpRequest): Promise<{
|
|
30
31
|
response: HttpResponse;
|
|
31
32
|
}>;
|
|
33
|
+
updateHttpClientConfig(
|
|
34
|
+
key: keyof WebSocketFetchHandlerOptions,
|
|
35
|
+
value: WebSocketFetchHandlerOptions[typeof key]
|
|
36
|
+
): void;
|
|
37
|
+
httpHandlerConfigs(): WebSocketFetchHandlerOptions;
|
|
32
38
|
private removeNotUsableSockets;
|
|
33
39
|
private waitForReady;
|
|
34
40
|
private connect;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { HttpRequest, HttpResponse } from "@smithy/protocol-http";
|
|
2
2
|
import { Provider, RequestHandler, RequestHandlerMetadata } from "@smithy/types";
|
|
3
3
|
export interface WebSocketFetchHandlerOptions {
|
|
4
4
|
/**
|
|
@@ -15,14 +15,15 @@ export interface WebSocketFetchHandlerOptions {
|
|
|
15
15
|
*/
|
|
16
16
|
export declare class WebSocketFetchHandler {
|
|
17
17
|
readonly metadata: RequestHandlerMetadata;
|
|
18
|
-
private
|
|
18
|
+
private config;
|
|
19
|
+
private configPromise;
|
|
19
20
|
private readonly httpHandler;
|
|
20
21
|
private readonly sockets;
|
|
21
22
|
/**
|
|
22
23
|
* @returns the input if it is an HttpHandler of any class,
|
|
23
24
|
* or instantiates a new instance of this handler.
|
|
24
25
|
*/
|
|
25
|
-
static create(instanceOrOptions?:
|
|
26
|
+
static create(instanceOrOptions?: WebSocketFetchHandler | WebSocketFetchHandlerOptions | Provider<WebSocketFetchHandlerOptions | void>, httpHandler?: RequestHandler<any, any>): WebSocketFetchHandler;
|
|
26
27
|
constructor(options?: WebSocketFetchHandlerOptions | Provider<WebSocketFetchHandlerOptions>, httpHandler?: RequestHandler<any, any>);
|
|
27
28
|
/**
|
|
28
29
|
* Destroys the WebSocketHandler.
|
|
@@ -32,6 +33,8 @@ export declare class WebSocketFetchHandler {
|
|
|
32
33
|
handle(request: HttpRequest): Promise<{
|
|
33
34
|
response: HttpResponse;
|
|
34
35
|
}>;
|
|
36
|
+
updateHttpClientConfig(key: keyof WebSocketFetchHandlerOptions, value: WebSocketFetchHandlerOptions[typeof key]): void;
|
|
37
|
+
httpHandlerConfigs(): WebSocketFetchHandlerOptions;
|
|
35
38
|
/**
|
|
36
39
|
* Removes all closing/closed sockets from the socket pool for URL.
|
|
37
40
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/middleware-websocket",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.523.0",
|
|
4
4
|
"main": "./dist-cjs/index.js",
|
|
5
5
|
"module": "./dist-es/index.js",
|
|
6
6
|
"types": "./dist-types/index.d.ts",
|
|
@@ -21,15 +21,15 @@
|
|
|
21
21
|
},
|
|
22
22
|
"license": "Apache-2.0",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@aws-sdk/middleware-signing": "3.
|
|
25
|
-
"@aws-sdk/types": "3.
|
|
26
|
-
"@aws-sdk/util-format-url": "3.
|
|
27
|
-
"@smithy/eventstream-codec": "^2.1.
|
|
28
|
-
"@smithy/eventstream-serde-browser": "^2.1.
|
|
29
|
-
"@smithy/fetch-http-handler": "^2.4.
|
|
30
|
-
"@smithy/protocol-http": "^3.
|
|
31
|
-
"@smithy/signature-v4": "^2.1.
|
|
32
|
-
"@smithy/types": "^2.
|
|
24
|
+
"@aws-sdk/middleware-signing": "3.523.0",
|
|
25
|
+
"@aws-sdk/types": "3.523.0",
|
|
26
|
+
"@aws-sdk/util-format-url": "3.523.0",
|
|
27
|
+
"@smithy/eventstream-codec": "^2.1.3",
|
|
28
|
+
"@smithy/eventstream-serde-browser": "^2.1.3",
|
|
29
|
+
"@smithy/fetch-http-handler": "^2.4.3",
|
|
30
|
+
"@smithy/protocol-http": "^3.2.1",
|
|
31
|
+
"@smithy/signature-v4": "^2.1.3",
|
|
32
|
+
"@smithy/types": "^2.10.1",
|
|
33
33
|
"@smithy/util-hex-encoding": "^2.1.1",
|
|
34
34
|
"tslib": "^2.5.0"
|
|
35
35
|
},
|