@songtonyli/dsh-cli 0.1.86 → 0.1.88
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/README.md +1 -1
- package/bin/dsh.mjs +1 -1
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/node-http-handler/LICENSE +201 -0
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/node-http-handler/README.md +9 -0
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/node-http-handler/dist-cjs/index.js +859 -0
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/node-http-handler/dist-es/build-abort-error.js +19 -0
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/node-http-handler/dist-es/constants.js +1 -0
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/node-http-handler/dist-es/get-transformed-headers.js +12 -0
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/node-http-handler/dist-es/http2/ClientHttp2SessionRef.js +51 -0
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/node-http-handler/dist-es/index.js +3 -0
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/node-http-handler/dist-es/node-http-handler.js +251 -0
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/node-http-handler/dist-es/node-http2-connection-manager.js +135 -0
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/node-http-handler/dist-es/node-http2-connection-pool.js +46 -0
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/node-http-handler/dist-es/node-http2-handler.js +180 -0
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/node-http-handler/dist-es/node-http2.js +2 -0
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/node-http-handler/dist-es/node-https.js +2 -0
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/node-http-handler/dist-es/set-connection-timeout.js +36 -0
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/node-http-handler/dist-es/set-request-timeout.js +21 -0
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/node-http-handler/dist-es/set-socket-keep-alive.js +22 -0
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/node-http-handler/dist-es/set-socket-timeout.js +23 -0
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/node-http-handler/dist-es/timing.js +4 -0
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/node-http-handler/dist-es/write-request-body.js +63 -0
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/node-http-handler/package.json +56 -0
- 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/eventstream-handler-node/package.json +2 -2
- package/node_modules/@aws-sdk/middleware-eventstream/package.json +2 -2
- package/node_modules/@aws-sdk/middleware-websocket/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/@deepseek-ai/dsh-client-modules/lib/index.js +1 -1
- package/node_modules/@deepseek-ai/dsh-client-ui-sidebar/lib/client.js +1 -1
- package/node_modules/@deepseek-ai/dsh-tui-app/README.i18n.yaml +6 -6
- package/node_modules/@deepseek-ai/dsh-tui-app/README.md +3 -2
- package/node_modules/@deepseek-ai/dsh-tui-app/README.zh.md +3 -2
- package/node_modules/@deepseek-ai/dsh-tui-app/lib/index.js +256 -32
- package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/LICENSE +201 -0
- package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/README.md +9 -0
- package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/dist-cjs/index.js +859 -0
- package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/dist-es/build-abort-error.js +19 -0
- package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/dist-es/constants.js +1 -0
- package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/dist-es/get-transformed-headers.js +12 -0
- package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/dist-es/http2/ClientHttp2SessionRef.js +51 -0
- package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/dist-es/index.js +3 -0
- package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/dist-es/node-http-handler.js +251 -0
- package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/dist-es/node-http2-connection-manager.js +135 -0
- package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/dist-es/node-http2-connection-pool.js +46 -0
- package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/dist-es/node-http2-handler.js +180 -0
- package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/dist-es/node-http2.js +2 -0
- package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/dist-es/node-https.js +2 -0
- package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/dist-es/set-connection-timeout.js +36 -0
- package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/dist-es/set-request-timeout.js +21 -0
- package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/dist-es/set-socket-keep-alive.js +22 -0
- package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/dist-es/set-socket-timeout.js +23 -0
- package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/dist-es/timing.js +4 -0
- package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/dist-es/write-request-body.js +63 -0
- package/node_modules/@earendil-works/pi-ai/node_modules/@smithy/node-http-handler/package.json +56 -0
- 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/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/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/package.json +84 -27
- 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 +18 -18
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { HttpResponse, buildQueryString } from "@smithy/core/protocols";
|
|
2
|
+
import { buildAbortError } from "./build-abort-error";
|
|
3
|
+
import { getTransformedHeaders } from "./get-transformed-headers";
|
|
4
|
+
import { node_http2 } from "./node-http2";
|
|
5
|
+
import { NodeHttp2ConnectionManager } from "./node-http2-connection-manager";
|
|
6
|
+
import { writeRequestBody } from "./write-request-body";
|
|
7
|
+
const { constants } = node_http2;
|
|
8
|
+
export class NodeHttp2Handler {
|
|
9
|
+
config;
|
|
10
|
+
configProvider;
|
|
11
|
+
metadata = { handlerProtocol: "h2" };
|
|
12
|
+
connectionManager = new NodeHttp2ConnectionManager({});
|
|
13
|
+
static create(instanceOrOptions) {
|
|
14
|
+
if (typeof instanceOrOptions?.handle === "function") {
|
|
15
|
+
return instanceOrOptions;
|
|
16
|
+
}
|
|
17
|
+
return new NodeHttp2Handler(instanceOrOptions);
|
|
18
|
+
}
|
|
19
|
+
constructor(options) {
|
|
20
|
+
this.configProvider = new Promise((resolve, reject) => {
|
|
21
|
+
if (typeof options === "function") {
|
|
22
|
+
options()
|
|
23
|
+
.then((opts) => {
|
|
24
|
+
resolve(opts || {});
|
|
25
|
+
})
|
|
26
|
+
.catch(reject);
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
resolve(options || {});
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
destroy() {
|
|
34
|
+
this.connectionManager.destroy();
|
|
35
|
+
}
|
|
36
|
+
async handle(request, { abortSignal, requestTimeout, isEventStream } = {}) {
|
|
37
|
+
if (!this.config) {
|
|
38
|
+
this.config = await this.configProvider;
|
|
39
|
+
const { disableConcurrentStreams, maxConcurrentStreams, nodeHttp2ConnectOptions } = this.config;
|
|
40
|
+
this.connectionManager.setDisableConcurrentStreams(disableConcurrentStreams ?? false);
|
|
41
|
+
if (maxConcurrentStreams) {
|
|
42
|
+
this.connectionManager.setMaxConcurrentStreams(maxConcurrentStreams);
|
|
43
|
+
}
|
|
44
|
+
if (nodeHttp2ConnectOptions) {
|
|
45
|
+
this.connectionManager.setNodeHttp2ConnectOptions(nodeHttp2ConnectOptions);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
const { requestTimeout: configRequestTimeout, disableConcurrentStreams } = this.config;
|
|
49
|
+
const useIsolatedSession = disableConcurrentStreams || isEventStream;
|
|
50
|
+
const effectiveRequestTimeout = requestTimeout ?? configRequestTimeout;
|
|
51
|
+
return new Promise((_resolve, _reject) => {
|
|
52
|
+
let fulfilled = false;
|
|
53
|
+
let writeRequestBodyPromise = undefined;
|
|
54
|
+
const resolve = async (arg) => {
|
|
55
|
+
await writeRequestBodyPromise;
|
|
56
|
+
_resolve(arg);
|
|
57
|
+
};
|
|
58
|
+
const reject = async (arg) => {
|
|
59
|
+
await writeRequestBodyPromise;
|
|
60
|
+
_reject(arg);
|
|
61
|
+
};
|
|
62
|
+
if (abortSignal?.aborted) {
|
|
63
|
+
fulfilled = true;
|
|
64
|
+
const abortError = buildAbortError(abortSignal);
|
|
65
|
+
reject(abortError);
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
const { hostname, method, port, protocol, query } = request;
|
|
69
|
+
let auth = "";
|
|
70
|
+
if (request.username != null || request.password != null) {
|
|
71
|
+
const username = request.username ?? "";
|
|
72
|
+
const password = request.password ?? "";
|
|
73
|
+
auth = `${username}:${password}@`;
|
|
74
|
+
}
|
|
75
|
+
const authority = `${protocol}//${auth}${hostname}${port ? `:${port}` : ""}`;
|
|
76
|
+
const requestContext = { destination: new URL(authority) };
|
|
77
|
+
const connectConfig = {
|
|
78
|
+
requestTimeout: this.config?.sessionTimeout,
|
|
79
|
+
isEventStream,
|
|
80
|
+
};
|
|
81
|
+
const ref = useIsolatedSession
|
|
82
|
+
? this.connectionManager.createIsolatedSession(requestContext, connectConfig)
|
|
83
|
+
: this.connectionManager.lease(requestContext, connectConfig);
|
|
84
|
+
const session = ref.deref();
|
|
85
|
+
const rejectWithDestroy = (err) => {
|
|
86
|
+
if (useIsolatedSession) {
|
|
87
|
+
ref.destroy();
|
|
88
|
+
}
|
|
89
|
+
fulfilled = true;
|
|
90
|
+
reject(err);
|
|
91
|
+
};
|
|
92
|
+
const queryString = query ? buildQueryString(query) : "";
|
|
93
|
+
let path = request.path;
|
|
94
|
+
if (queryString) {
|
|
95
|
+
path += `?${queryString}`;
|
|
96
|
+
}
|
|
97
|
+
if (request.fragment) {
|
|
98
|
+
path += `#${request.fragment}`;
|
|
99
|
+
}
|
|
100
|
+
const clientHttp2Stream = session.request({
|
|
101
|
+
...request.headers,
|
|
102
|
+
[constants.HTTP2_HEADER_PATH]: path,
|
|
103
|
+
[constants.HTTP2_HEADER_METHOD]: method,
|
|
104
|
+
});
|
|
105
|
+
if (effectiveRequestTimeout) {
|
|
106
|
+
clientHttp2Stream.setTimeout(effectiveRequestTimeout, () => {
|
|
107
|
+
clientHttp2Stream.close();
|
|
108
|
+
const timeoutError = new Error(`Stream timed out because of no activity for ${effectiveRequestTimeout} ms`);
|
|
109
|
+
timeoutError.name = "TimeoutError";
|
|
110
|
+
rejectWithDestroy(timeoutError);
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
if (abortSignal) {
|
|
114
|
+
const onAbort = () => {
|
|
115
|
+
clientHttp2Stream.close();
|
|
116
|
+
const abortError = buildAbortError(abortSignal);
|
|
117
|
+
rejectWithDestroy(abortError);
|
|
118
|
+
};
|
|
119
|
+
if (typeof abortSignal.addEventListener === "function") {
|
|
120
|
+
const signal = abortSignal;
|
|
121
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
122
|
+
clientHttp2Stream.once("close", () => signal.removeEventListener("abort", onAbort));
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
abortSignal.onabort = onAbort;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
clientHttp2Stream.on("frameError", (type, code, id) => {
|
|
129
|
+
rejectWithDestroy(new Error(`Frame type id ${type} in stream id ${id} has failed with code ${code}.`));
|
|
130
|
+
});
|
|
131
|
+
clientHttp2Stream.on("error", rejectWithDestroy);
|
|
132
|
+
clientHttp2Stream.on("aborted", () => {
|
|
133
|
+
rejectWithDestroy(new Error(`HTTP/2 stream is abnormally aborted in mid-communication with result code ${clientHttp2Stream.rstCode}.`));
|
|
134
|
+
});
|
|
135
|
+
clientHttp2Stream.on("response", (headers) => {
|
|
136
|
+
const httpResponse = new HttpResponse({
|
|
137
|
+
statusCode: headers[":status"] ?? -1,
|
|
138
|
+
headers: getTransformedHeaders(headers),
|
|
139
|
+
body: clientHttp2Stream,
|
|
140
|
+
});
|
|
141
|
+
fulfilled = true;
|
|
142
|
+
resolve({ response: httpResponse });
|
|
143
|
+
if (useIsolatedSession) {
|
|
144
|
+
session.close();
|
|
145
|
+
clientHttp2Stream.on("end", () => {
|
|
146
|
+
ref.destroy();
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
clientHttp2Stream.on("close", () => {
|
|
151
|
+
if (useIsolatedSession) {
|
|
152
|
+
ref.destroy();
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
this.connectionManager.release(requestContext, ref);
|
|
156
|
+
}
|
|
157
|
+
if (!fulfilled) {
|
|
158
|
+
const error = new Error("Unexpected error: http2 request did not get a response");
|
|
159
|
+
if (session.destroyed) {
|
|
160
|
+
error.name = "TimeoutError";
|
|
161
|
+
}
|
|
162
|
+
rejectWithDestroy(error);
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
writeRequestBodyPromise = writeRequestBody(clientHttp2Stream, request, effectiveRequestTimeout);
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
updateHttpClientConfig(key, value) {
|
|
169
|
+
this.config = undefined;
|
|
170
|
+
this.configProvider = this.configProvider.then((config) => {
|
|
171
|
+
return {
|
|
172
|
+
...config,
|
|
173
|
+
[key]: value,
|
|
174
|
+
};
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
httpHandlerConfigs() {
|
|
178
|
+
return this.config ?? {};
|
|
179
|
+
}
|
|
180
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { timing } from "./timing";
|
|
2
|
+
const DEFER_EVENT_LISTENER_TIME = 1000;
|
|
3
|
+
export const setConnectionTimeout = (request, reject, timeoutInMs = 0) => {
|
|
4
|
+
if (!timeoutInMs) {
|
|
5
|
+
return -1;
|
|
6
|
+
}
|
|
7
|
+
const registerTimeout = (offset) => {
|
|
8
|
+
const timeoutId = timing.setTimeout(() => {
|
|
9
|
+
request.destroy();
|
|
10
|
+
reject(Object.assign(new Error(`@smithy/node-http-handler - the request socket did not establish a connection with the server within the configured timeout of ${timeoutInMs} ms.`), {
|
|
11
|
+
name: "TimeoutError",
|
|
12
|
+
}));
|
|
13
|
+
}, timeoutInMs - offset);
|
|
14
|
+
const doWithSocket = (socket) => {
|
|
15
|
+
if (socket?.connecting) {
|
|
16
|
+
socket.on("connect", () => {
|
|
17
|
+
timing.clearTimeout(timeoutId);
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
timing.clearTimeout(timeoutId);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
if (request.socket) {
|
|
25
|
+
doWithSocket(request.socket);
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
request.on("socket", doWithSocket);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
if (timeoutInMs < 2000) {
|
|
32
|
+
registerTimeout(0);
|
|
33
|
+
return 0;
|
|
34
|
+
}
|
|
35
|
+
return timing.setTimeout(registerTimeout.bind(null, DEFER_EVENT_LISTENER_TIME), DEFER_EVENT_LISTENER_TIME);
|
|
36
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { timing } from "./timing";
|
|
2
|
+
export const setRequestTimeout = (req, reject, timeoutInMs = 0, throwOnRequestTimeout, logger) => {
|
|
3
|
+
if (timeoutInMs) {
|
|
4
|
+
return timing.setTimeout(() => {
|
|
5
|
+
let msg = `@smithy/node-http-handler - [${throwOnRequestTimeout ? "ERROR" : "WARN"}] a request has exceeded the configured ${timeoutInMs} ms requestTimeout.`;
|
|
6
|
+
if (throwOnRequestTimeout) {
|
|
7
|
+
const error = Object.assign(new Error(msg), {
|
|
8
|
+
name: "TimeoutError",
|
|
9
|
+
code: "ETIMEDOUT",
|
|
10
|
+
});
|
|
11
|
+
req.destroy(error);
|
|
12
|
+
reject(error);
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
msg += ` Init client requestHandler with throwOnRequestTimeout=true to turn this into an error.`;
|
|
16
|
+
logger?.warn?.(msg);
|
|
17
|
+
}
|
|
18
|
+
}, timeoutInMs);
|
|
19
|
+
}
|
|
20
|
+
return -1;
|
|
21
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { timing } from "./timing";
|
|
2
|
+
const DEFER_EVENT_LISTENER_TIME = 3000;
|
|
3
|
+
export const setSocketKeepAlive = (request, { keepAlive, keepAliveMsecs }, deferTimeMs = DEFER_EVENT_LISTENER_TIME) => {
|
|
4
|
+
if (keepAlive !== true) {
|
|
5
|
+
return -1;
|
|
6
|
+
}
|
|
7
|
+
const registerListener = () => {
|
|
8
|
+
if (request.socket) {
|
|
9
|
+
request.socket.setKeepAlive(keepAlive, keepAliveMsecs || 0);
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
request.on("socket", (socket) => {
|
|
13
|
+
socket.setKeepAlive(keepAlive, keepAliveMsecs || 0);
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
if (deferTimeMs === 0) {
|
|
18
|
+
registerListener();
|
|
19
|
+
return 0;
|
|
20
|
+
}
|
|
21
|
+
return timing.setTimeout(registerListener, deferTimeMs);
|
|
22
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { timing } from "./timing";
|
|
2
|
+
const DEFER_EVENT_LISTENER_TIME = 3000;
|
|
3
|
+
export const setSocketTimeout = (request, reject, timeoutInMs = 0) => {
|
|
4
|
+
const registerTimeout = (offset) => {
|
|
5
|
+
const timeout = timeoutInMs - offset;
|
|
6
|
+
const onTimeout = () => {
|
|
7
|
+
request.destroy();
|
|
8
|
+
reject(Object.assign(new Error(`@smithy/node-http-handler - the request socket timed out after ${timeoutInMs} ms of inactivity (configured by client requestHandler).`), { name: "TimeoutError" }));
|
|
9
|
+
};
|
|
10
|
+
if (request.socket) {
|
|
11
|
+
request.socket.setTimeout(timeout, onTimeout);
|
|
12
|
+
request.on("close", () => request.socket?.removeListener("timeout", onTimeout));
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
request.setTimeout(timeout, onTimeout);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
if (0 < timeoutInMs && timeoutInMs < 6000) {
|
|
19
|
+
registerTimeout(0);
|
|
20
|
+
return 0;
|
|
21
|
+
}
|
|
22
|
+
return timing.setTimeout(registerTimeout.bind(null, timeoutInMs === 0 ? 0 : DEFER_EVENT_LISTENER_TIME), DEFER_EVENT_LISTENER_TIME);
|
|
23
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { Readable } from "node:stream";
|
|
2
|
+
import { timing } from "./timing";
|
|
3
|
+
const MIN_WAIT_TIME = 6_000;
|
|
4
|
+
export async function writeRequestBody(httpRequest, request, maxContinueTimeoutMs = MIN_WAIT_TIME, externalAgent = false) {
|
|
5
|
+
const headers = request.headers;
|
|
6
|
+
const expect = headers ? headers.Expect || headers.expect : undefined;
|
|
7
|
+
let timeoutId = -1;
|
|
8
|
+
let sendBody = true;
|
|
9
|
+
if (!externalAgent && expect === "100-continue") {
|
|
10
|
+
sendBody = await Promise.race([
|
|
11
|
+
new Promise((resolve) => {
|
|
12
|
+
timeoutId = Number(timing.setTimeout(() => resolve(true), Math.max(MIN_WAIT_TIME, maxContinueTimeoutMs)));
|
|
13
|
+
}),
|
|
14
|
+
new Promise((resolve) => {
|
|
15
|
+
httpRequest.on("continue", () => {
|
|
16
|
+
timing.clearTimeout(timeoutId);
|
|
17
|
+
resolve(true);
|
|
18
|
+
});
|
|
19
|
+
httpRequest.on("response", () => {
|
|
20
|
+
timing.clearTimeout(timeoutId);
|
|
21
|
+
resolve(false);
|
|
22
|
+
});
|
|
23
|
+
httpRequest.on("error", () => {
|
|
24
|
+
timing.clearTimeout(timeoutId);
|
|
25
|
+
resolve(false);
|
|
26
|
+
});
|
|
27
|
+
}),
|
|
28
|
+
]);
|
|
29
|
+
}
|
|
30
|
+
if (sendBody) {
|
|
31
|
+
writeBody(httpRequest, request.body);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
function writeBody(httpRequest, body) {
|
|
35
|
+
if (body instanceof Readable) {
|
|
36
|
+
body.pipe(httpRequest);
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
if (body) {
|
|
40
|
+
const isBuffer = Buffer.isBuffer(body);
|
|
41
|
+
const isString = typeof body === "string";
|
|
42
|
+
if (isBuffer || isString) {
|
|
43
|
+
if (isBuffer && body.byteLength === 0) {
|
|
44
|
+
httpRequest.end();
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
httpRequest.end(body);
|
|
48
|
+
}
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
const uint8 = body;
|
|
52
|
+
if (typeof uint8 === "object" &&
|
|
53
|
+
uint8.buffer &&
|
|
54
|
+
typeof uint8.byteOffset === "number" &&
|
|
55
|
+
typeof uint8.byteLength === "number") {
|
|
56
|
+
httpRequest.end(Buffer.from(uint8.buffer, uint8.byteOffset, uint8.byteLength));
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
httpRequest.end(Buffer.from(body));
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
httpRequest.end();
|
|
63
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@smithy/node-http-handler",
|
|
3
|
+
"version": "4.12.1",
|
|
4
|
+
"description": "Provides a way to make requests",
|
|
5
|
+
"homepage": "https://github.com/smithy-lang/smithy-typescript/tree/main/packages/node-http-handler",
|
|
6
|
+
"license": "Apache-2.0",
|
|
7
|
+
"author": {
|
|
8
|
+
"name": "AWS SDK for JavaScript Team",
|
|
9
|
+
"email": "",
|
|
10
|
+
"url": "https://aws.amazon.com/sdk-for-javascript/"
|
|
11
|
+
},
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "https://github.com/smithy-lang/smithy-typescript.git",
|
|
15
|
+
"directory": "packages/node-http-handler"
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist-*/**"
|
|
19
|
+
],
|
|
20
|
+
"sideEffects": false,
|
|
21
|
+
"main": "./dist-cjs/index.js",
|
|
22
|
+
"module": "./dist-es/index.js",
|
|
23
|
+
"types": "./dist-types/index.d.ts",
|
|
24
|
+
"typesVersions": {
|
|
25
|
+
"<4.5": {
|
|
26
|
+
"dist-types/*": [
|
|
27
|
+
"dist-types/ts3.4/*"
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"scripts": {
|
|
32
|
+
"build": "concurrently 'yarn:build:types' 'yarn:build:es:cjs'",
|
|
33
|
+
"build:es:cjs": "node ../../scripts/compilation/es_cjs.js",
|
|
34
|
+
"build:types": "premove dist-types && yarn g:tsc -p tsconfig.types.json",
|
|
35
|
+
"build:types:downlevel": "premove dist-types/ts3.4 && downlevel-dts dist-types dist-types/ts3.4",
|
|
36
|
+
"clean": "premove dist-cjs dist-es dist-types",
|
|
37
|
+
"extract:docs": "api-extractor run --local",
|
|
38
|
+
"test": "yarn g:vitest run",
|
|
39
|
+
"test:watch": "yarn g:vitest watch"
|
|
40
|
+
},
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"@smithy/core": "^3.33.3",
|
|
43
|
+
"@smithy/types": "^4.18.0",
|
|
44
|
+
"tslib": "^2.6.2"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@smithy/abort-controller": "^4.4.2",
|
|
48
|
+
"@types/node": "^18.11.9",
|
|
49
|
+
"concurrently": "7.0.0",
|
|
50
|
+
"downlevel-dts": "0.10.1",
|
|
51
|
+
"premove": "4.0.0"
|
|
52
|
+
},
|
|
53
|
+
"engines": {
|
|
54
|
+
"node": ">=18.0.0"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/core",
|
|
3
|
-
"version": "3.978.
|
|
3
|
+
"version": "3.978.6",
|
|
4
4
|
"description": "Core functions & classes shared by multiple AWS SDK clients.",
|
|
5
5
|
"homepage": "https://github.com/aws/aws-sdk-js-v3/tree/main/packages-internal/core",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -109,7 +109,7 @@
|
|
|
109
109
|
"@aws-sdk/types": "^3.975.0",
|
|
110
110
|
"@aws-sdk/xml-builder": "^3.972.41",
|
|
111
111
|
"@aws/lambda-invoke-store": "^0.3.0",
|
|
112
|
-
"@smithy/core": "^3.
|
|
112
|
+
"@smithy/core": "^3.37.0",
|
|
113
113
|
"@smithy/signature-v4": "^5.7.4",
|
|
114
114
|
"@smithy/types": "^4.19.0",
|
|
115
115
|
"bowser": "^2.11.0",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/credential-provider-env",
|
|
3
|
-
"version": "3.972.
|
|
3
|
+
"version": "3.972.77",
|
|
4
4
|
"description": "AWS credential provider that sources credentials from known environment variables",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"aws",
|
|
@@ -32,9 +32,9 @@
|
|
|
32
32
|
}
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@aws-sdk/core": "^3.978.
|
|
35
|
+
"@aws-sdk/core": "^3.978.6",
|
|
36
36
|
"@aws-sdk/types": "^3.975.0",
|
|
37
|
-
"@smithy/core": "^3.
|
|
37
|
+
"@smithy/core": "^3.37.0",
|
|
38
38
|
"@smithy/types": "^4.19.0",
|
|
39
39
|
"tslib": "^2.6.2"
|
|
40
40
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/credential-provider-http",
|
|
3
|
-
"version": "3.972.
|
|
3
|
+
"version": "3.972.79",
|
|
4
4
|
"description": "AWS credential provider for containers and HTTP sources",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"aws",
|
|
@@ -40,11 +40,11 @@
|
|
|
40
40
|
"./dist-es/fromHttp/fromHttp": "./dist-es/fromHttp/fromHttp.browser"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@aws-sdk/core": "^3.978.
|
|
43
|
+
"@aws-sdk/core": "^3.978.6",
|
|
44
44
|
"@aws-sdk/types": "^3.975.0",
|
|
45
|
-
"@smithy/core": "^3.
|
|
45
|
+
"@smithy/core": "^3.37.0",
|
|
46
46
|
"@smithy/fetch-http-handler": "^5.8.0",
|
|
47
|
-
"@smithy/node-http-handler": "^4.
|
|
47
|
+
"@smithy/node-http-handler": "^4.13.0",
|
|
48
48
|
"@smithy/types": "^4.19.0",
|
|
49
49
|
"tslib": "^2.6.2"
|
|
50
50
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/credential-provider-ini",
|
|
3
|
-
"version": "3.973.
|
|
3
|
+
"version": "3.973.22",
|
|
4
4
|
"description": "AWS credential provider that sources credentials from ~/.aws/credentials and ~/.aws/config",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"aws",
|
|
@@ -32,16 +32,16 @@
|
|
|
32
32
|
}
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@aws-sdk/core": "^3.978.
|
|
36
|
-
"@aws-sdk/credential-provider-env": "^3.972.
|
|
37
|
-
"@aws-sdk/credential-provider-http": "^3.972.
|
|
38
|
-
"@aws-sdk/credential-provider-login": "^3.972.
|
|
39
|
-
"@aws-sdk/credential-provider-process": "^3.972.
|
|
40
|
-
"@aws-sdk/credential-provider-sso": "^3.973.
|
|
41
|
-
"@aws-sdk/credential-provider-web-identity": "^3.972.
|
|
42
|
-
"@aws-sdk/nested-clients": "^3.997.
|
|
35
|
+
"@aws-sdk/core": "^3.978.6",
|
|
36
|
+
"@aws-sdk/credential-provider-env": "^3.972.77",
|
|
37
|
+
"@aws-sdk/credential-provider-http": "^3.972.79",
|
|
38
|
+
"@aws-sdk/credential-provider-login": "^3.972.84",
|
|
39
|
+
"@aws-sdk/credential-provider-process": "^3.972.77",
|
|
40
|
+
"@aws-sdk/credential-provider-sso": "^3.973.21",
|
|
41
|
+
"@aws-sdk/credential-provider-web-identity": "^3.972.83",
|
|
42
|
+
"@aws-sdk/nested-clients": "^3.997.51",
|
|
43
43
|
"@aws-sdk/types": "^3.975.0",
|
|
44
|
-
"@smithy/core": "^3.
|
|
44
|
+
"@smithy/core": "^3.37.0",
|
|
45
45
|
"@smithy/credential-provider-imds": "^4.5.2",
|
|
46
46
|
"@smithy/types": "^4.19.0",
|
|
47
47
|
"tslib": "^2.6.2"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/credential-provider-login",
|
|
3
|
-
"version": "3.972.
|
|
3
|
+
"version": "3.972.84",
|
|
4
4
|
"description": "AWS credential provider that sources credentials from aws login cached tokens",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"aws",
|
|
@@ -34,10 +34,10 @@
|
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@aws-sdk/core": "^3.978.
|
|
38
|
-
"@aws-sdk/nested-clients": "^3.997.
|
|
37
|
+
"@aws-sdk/core": "^3.978.6",
|
|
38
|
+
"@aws-sdk/nested-clients": "^3.997.51",
|
|
39
39
|
"@aws-sdk/types": "^3.975.0",
|
|
40
|
-
"@smithy/core": "^3.
|
|
40
|
+
"@smithy/core": "^3.37.0",
|
|
41
41
|
"@smithy/types": "^4.19.0",
|
|
42
42
|
"tslib": "^2.6.2"
|
|
43
43
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/credential-provider-node",
|
|
3
|
-
"version": "3.972.
|
|
3
|
+
"version": "3.972.89",
|
|
4
4
|
"description": "AWS credential provider that sources credentials from a Node.JS environment. ",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"aws",
|
|
@@ -32,14 +32,14 @@
|
|
|
32
32
|
}
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@aws-sdk/credential-provider-env": "^3.972.
|
|
36
|
-
"@aws-sdk/credential-provider-http": "^3.972.
|
|
37
|
-
"@aws-sdk/credential-provider-ini": "^3.973.
|
|
38
|
-
"@aws-sdk/credential-provider-process": "^3.972.
|
|
39
|
-
"@aws-sdk/credential-provider-sso": "^3.973.
|
|
40
|
-
"@aws-sdk/credential-provider-web-identity": "^3.972.
|
|
35
|
+
"@aws-sdk/credential-provider-env": "^3.972.77",
|
|
36
|
+
"@aws-sdk/credential-provider-http": "^3.972.79",
|
|
37
|
+
"@aws-sdk/credential-provider-ini": "^3.973.22",
|
|
38
|
+
"@aws-sdk/credential-provider-process": "^3.972.77",
|
|
39
|
+
"@aws-sdk/credential-provider-sso": "^3.973.21",
|
|
40
|
+
"@aws-sdk/credential-provider-web-identity": "^3.972.83",
|
|
41
41
|
"@aws-sdk/types": "^3.975.0",
|
|
42
|
-
"@smithy/core": "^3.
|
|
42
|
+
"@smithy/core": "^3.37.0",
|
|
43
43
|
"@smithy/credential-provider-imds": "^4.5.2",
|
|
44
44
|
"@smithy/types": "^4.19.0",
|
|
45
45
|
"tslib": "^2.6.2"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/credential-provider-process",
|
|
3
|
-
"version": "3.972.
|
|
3
|
+
"version": "3.972.77",
|
|
4
4
|
"description": "AWS credential provider that sources credential_process from ~/.aws/credentials and ~/.aws/config",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"aws",
|
|
@@ -32,9 +32,9 @@
|
|
|
32
32
|
}
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@aws-sdk/core": "^3.978.
|
|
35
|
+
"@aws-sdk/core": "^3.978.6",
|
|
36
36
|
"@aws-sdk/types": "^3.975.0",
|
|
37
|
-
"@smithy/core": "^3.
|
|
37
|
+
"@smithy/core": "^3.37.0",
|
|
38
38
|
"@smithy/types": "^4.19.0",
|
|
39
39
|
"tslib": "^2.6.2"
|
|
40
40
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/credential-provider-sso",
|
|
3
|
-
"version": "3.973.
|
|
3
|
+
"version": "3.973.21",
|
|
4
4
|
"description": "AWS credential provider that exchanges a resolved SSO login token file for temporary AWS credentials",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"aws",
|
|
@@ -32,11 +32,11 @@
|
|
|
32
32
|
}
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@aws-sdk/core": "^3.978.
|
|
36
|
-
"@aws-sdk/nested-clients": "^3.997.
|
|
37
|
-
"@aws-sdk/token-providers": "3.
|
|
35
|
+
"@aws-sdk/core": "^3.978.6",
|
|
36
|
+
"@aws-sdk/nested-clients": "^3.997.51",
|
|
37
|
+
"@aws-sdk/token-providers": "3.1157.0",
|
|
38
38
|
"@aws-sdk/types": "^3.975.0",
|
|
39
|
-
"@smithy/core": "^3.
|
|
39
|
+
"@smithy/core": "^3.37.0",
|
|
40
40
|
"@smithy/types": "^4.19.0",
|
|
41
41
|
"tslib": "^2.6.2"
|
|
42
42
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/credential-provider-web-identity",
|
|
3
|
-
"version": "3.972.
|
|
3
|
+
"version": "3.972.83",
|
|
4
4
|
"description": "AWS credential provider that calls STS assumeRole for temporary AWS credentials",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"aws",
|
|
@@ -39,10 +39,10 @@
|
|
|
39
39
|
"./dist-es/fromTokenFile": false
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@aws-sdk/core": "^3.978.
|
|
43
|
-
"@aws-sdk/nested-clients": "^3.997.
|
|
42
|
+
"@aws-sdk/core": "^3.978.6",
|
|
43
|
+
"@aws-sdk/nested-clients": "^3.997.51",
|
|
44
44
|
"@aws-sdk/types": "^3.975.0",
|
|
45
|
-
"@smithy/core": "^3.
|
|
45
|
+
"@smithy/core": "^3.37.0",
|
|
46
46
|
"@smithy/types": "^4.19.0",
|
|
47
47
|
"tslib": "^2.6.2"
|
|
48
48
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/eventstream-handler-node",
|
|
3
|
-
"version": "3.972.
|
|
3
|
+
"version": "3.972.39",
|
|
4
4
|
"homepage": "https://github.com/aws/aws-sdk-js-v3/tree/main/packages-internal/eventstream-handler-node",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": {
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@aws-sdk/types": "^3.975.0",
|
|
31
|
-
"@smithy/core": "^3.
|
|
31
|
+
"@smithy/core": "^3.37.0",
|
|
32
32
|
"@smithy/types": "^4.19.0",
|
|
33
33
|
"tslib": "^2.6.2"
|
|
34
34
|
},
|