@cdk8s/awscdk-resolver 0.0.161 → 0.0.162

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.
Files changed (78) hide show
  1. package/.jsii +2 -2
  2. package/lib/resolve.js +1 -1
  3. package/node_modules/@smithy/abort-controller/package.json +2 -2
  4. package/node_modules/@smithy/config-resolver/package.json +4 -4
  5. package/node_modules/@smithy/core/package.json +8 -8
  6. package/node_modules/@smithy/credential-provider-imds/package.json +5 -5
  7. package/node_modules/@smithy/fetch-http-handler/package.json +5 -5
  8. package/node_modules/@smithy/hash-node/package.json +2 -2
  9. package/node_modules/@smithy/invalid-dependency/package.json +2 -2
  10. package/node_modules/@smithy/middleware-content-length/package.json +4 -4
  11. package/node_modules/@smithy/middleware-endpoint/dist-cjs/adaptors/getEndpointFromConfig.js +1 -1
  12. package/node_modules/@smithy/middleware-endpoint/dist-cjs/index.js +16 -2
  13. package/node_modules/@smithy/middleware-endpoint/dist-es/adaptors/getEndpointFromConfig.js +1 -1
  14. package/node_modules/@smithy/middleware-endpoint/dist-es/adaptors/getEndpointFromInstructions.js +7 -1
  15. package/node_modules/@smithy/middleware-endpoint/dist-es/resolveEndpointConfig.js +10 -1
  16. package/node_modules/@smithy/middleware-endpoint/dist-types/adaptors/getEndpointFromConfig.d.ts +4 -1
  17. package/node_modules/@smithy/middleware-endpoint/dist-types/resolveEndpointConfig.d.ts +11 -0
  18. package/node_modules/@smithy/middleware-endpoint/dist-types/ts3.4/adaptors/getEndpointFromConfig.d.ts +4 -1
  19. package/node_modules/@smithy/middleware-endpoint/dist-types/ts3.4/resolveEndpointConfig.d.ts +11 -0
  20. package/node_modules/@smithy/middleware-endpoint/package.json +7 -7
  21. package/node_modules/@smithy/middleware-retry/package.json +9 -9
  22. package/node_modules/@smithy/middleware-serde/package.json +3 -3
  23. package/node_modules/@smithy/middleware-stack/package.json +2 -2
  24. package/node_modules/@smithy/node-config-provider/package.json +4 -4
  25. package/node_modules/@smithy/node-http-handler/dist-cjs/index.js +86 -46
  26. package/node_modules/@smithy/node-http-handler/dist-es/node-http-handler.js +10 -10
  27. package/node_modules/@smithy/node-http-handler/dist-es/set-connection-timeout.js +27 -13
  28. package/node_modules/@smithy/node-http-handler/dist-es/set-socket-keep-alive.js +18 -5
  29. package/node_modules/@smithy/node-http-handler/dist-es/set-socket-timeout.js +12 -4
  30. package/node_modules/@smithy/node-http-handler/dist-types/set-connection-timeout.d.ts +6 -1
  31. package/node_modules/@smithy/node-http-handler/dist-types/set-socket-keep-alive.d.ts +6 -1
  32. package/node_modules/@smithy/node-http-handler/dist-types/set-socket-timeout.d.ts +6 -1
  33. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/set-connection-timeout.d.ts +2 -1
  34. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/set-socket-keep-alive.d.ts +2 -1
  35. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/set-socket-timeout.d.ts +2 -1
  36. package/node_modules/@smithy/node-http-handler/package.json +5 -5
  37. package/node_modules/@smithy/property-provider/package.json +2 -2
  38. package/node_modules/@smithy/protocol-http/package.json +2 -2
  39. package/node_modules/@smithy/querystring-builder/package.json +2 -2
  40. package/node_modules/@smithy/querystring-parser/package.json +2 -2
  41. package/node_modules/@smithy/service-error-classification/package.json +2 -2
  42. package/node_modules/@smithy/shared-ini-file-loader/package.json +2 -2
  43. package/node_modules/@smithy/signature-v4/package.json +4 -4
  44. package/node_modules/@smithy/smithy-client/dist-cjs/index.js +21 -4
  45. package/node_modules/@smithy/smithy-client/dist-es/client.js +22 -4
  46. package/node_modules/@smithy/smithy-client/dist-types/client.d.ts +22 -1
  47. package/node_modules/@smithy/smithy-client/dist-types/ts3.4/client.d.ts +22 -1
  48. package/node_modules/@smithy/smithy-client/package.json +6 -6
  49. package/node_modules/@smithy/types/README.md +36 -1
  50. package/node_modules/@smithy/types/dist-types/command.d.ts +14 -1
  51. package/node_modules/@smithy/types/dist-types/endpoint.d.ts +1 -1
  52. package/node_modules/@smithy/types/dist-types/transform/client-method-transforms.d.ts +6 -6
  53. package/node_modules/@smithy/types/dist-types/transform/client-payload-blob-type-narrow.d.ts +12 -6
  54. package/node_modules/@smithy/types/dist-types/transform/no-undefined.d.ts +8 -3
  55. package/node_modules/@smithy/types/dist-types/ts3.4/command.d.ts +14 -1
  56. package/node_modules/@smithy/types/dist-types/ts3.4/endpoint.d.ts +1 -1
  57. package/node_modules/@smithy/types/dist-types/ts3.4/transform/client-method-transforms.d.ts +6 -6
  58. package/node_modules/@smithy/types/dist-types/ts3.4/transform/client-payload-blob-type-narrow.d.ts +8 -10
  59. package/node_modules/@smithy/types/dist-types/ts3.4/transform/no-undefined.d.ts +6 -9
  60. package/node_modules/@smithy/types/package.json +1 -1
  61. package/node_modules/@smithy/url-parser/package.json +3 -3
  62. package/node_modules/@smithy/util-defaults-mode-browser/package.json +4 -4
  63. package/node_modules/@smithy/util-defaults-mode-node/package.json +7 -7
  64. package/node_modules/@smithy/util-endpoints/dist-cjs/cache/EndpointCache.js +1 -0
  65. package/node_modules/@smithy/util-endpoints/dist-cjs/index.js +73 -11
  66. package/node_modules/@smithy/util-endpoints/dist-es/cache/EndpointCache.js +49 -0
  67. package/node_modules/@smithy/util-endpoints/dist-es/index.js +1 -0
  68. package/node_modules/@smithy/util-endpoints/dist-es/resolveEndpoint.js +0 -10
  69. package/node_modules/@smithy/util-endpoints/dist-types/cache/EndpointCache.d.ts +34 -0
  70. package/node_modules/@smithy/util-endpoints/dist-types/index.d.ts +1 -0
  71. package/node_modules/@smithy/util-endpoints/dist-types/ts3.4/cache/EndpointCache.d.ts +34 -0
  72. package/node_modules/@smithy/util-endpoints/dist-types/ts3.4/index.d.ts +1 -0
  73. package/node_modules/@smithy/util-endpoints/package.json +3 -3
  74. package/node_modules/@smithy/util-middleware/package.json +2 -2
  75. package/node_modules/@smithy/util-retry/package.json +3 -3
  76. package/node_modules/@smithy/util-stream/package.json +5 -5
  77. package/node_modules/@smithy/util-waiter/package.json +3 -3
  78. package/package.json +2 -2
@@ -57,45 +57,81 @@ var getTransformedHeaders = /* @__PURE__ */ __name((headers) => {
57
57
  }, "getTransformedHeaders");
58
58
 
59
59
  // src/set-connection-timeout.ts
60
+ var DEFER_EVENT_LISTENER_TIME = 1e3;
60
61
  var setConnectionTimeout = /* @__PURE__ */ __name((request, reject, timeoutInMs = 0) => {
61
62
  if (!timeoutInMs) {
62
- return;
63
- }
64
- const timeoutId = setTimeout(() => {
65
- request.destroy();
66
- reject(
67
- Object.assign(new Error(`Socket timed out without establishing a connection within ${timeoutInMs} ms`), {
68
- name: "TimeoutError"
69
- })
70
- );
71
- }, timeoutInMs);
72
- request.on("socket", (socket) => {
73
- if (socket.connecting) {
74
- socket.on("connect", () => {
63
+ return -1;
64
+ }
65
+ const registerTimeout = /* @__PURE__ */ __name((offset) => {
66
+ const timeoutId = setTimeout(() => {
67
+ request.destroy();
68
+ reject(
69
+ Object.assign(new Error(`Socket timed out without establishing a connection within ${timeoutInMs} ms`), {
70
+ name: "TimeoutError"
71
+ })
72
+ );
73
+ }, timeoutInMs - offset);
74
+ const doWithSocket = /* @__PURE__ */ __name((socket) => {
75
+ if (socket == null ? void 0 : socket.connecting) {
76
+ socket.on("connect", () => {
77
+ clearTimeout(timeoutId);
78
+ });
79
+ } else {
75
80
  clearTimeout(timeoutId);
76
- });
81
+ }
82
+ }, "doWithSocket");
83
+ if (request.socket) {
84
+ doWithSocket(request.socket);
77
85
  } else {
78
- clearTimeout(timeoutId);
86
+ request.on("socket", doWithSocket);
79
87
  }
80
- });
88
+ }, "registerTimeout");
89
+ if (timeoutInMs < 2e3) {
90
+ registerTimeout(0);
91
+ return 0;
92
+ }
93
+ return setTimeout(registerTimeout.bind(null, DEFER_EVENT_LISTENER_TIME), DEFER_EVENT_LISTENER_TIME);
81
94
  }, "setConnectionTimeout");
82
95
 
83
96
  // src/set-socket-keep-alive.ts
84
- var setSocketKeepAlive = /* @__PURE__ */ __name((request, { keepAlive, keepAliveMsecs }) => {
97
+ var DEFER_EVENT_LISTENER_TIME2 = 3e3;
98
+ var setSocketKeepAlive = /* @__PURE__ */ __name((request, { keepAlive, keepAliveMsecs }, deferTimeMs = DEFER_EVENT_LISTENER_TIME2) => {
85
99
  if (keepAlive !== true) {
86
- return;
100
+ return -1;
87
101
  }
88
- request.on("socket", (socket) => {
89
- socket.setKeepAlive(keepAlive, keepAliveMsecs || 0);
90
- });
102
+ const registerListener = /* @__PURE__ */ __name(() => {
103
+ if (request.socket) {
104
+ request.socket.setKeepAlive(keepAlive, keepAliveMsecs || 0);
105
+ } else {
106
+ request.on("socket", (socket) => {
107
+ socket.setKeepAlive(keepAlive, keepAliveMsecs || 0);
108
+ });
109
+ }
110
+ }, "registerListener");
111
+ if (deferTimeMs === 0) {
112
+ registerListener();
113
+ return 0;
114
+ }
115
+ return setTimeout(registerListener, deferTimeMs);
91
116
  }, "setSocketKeepAlive");
92
117
 
93
118
  // src/set-socket-timeout.ts
119
+ var DEFER_EVENT_LISTENER_TIME3 = 3e3;
94
120
  var setSocketTimeout = /* @__PURE__ */ __name((request, reject, timeoutInMs = 0) => {
95
- request.setTimeout(timeoutInMs, () => {
96
- request.destroy();
97
- reject(Object.assign(new Error(`Connection timed out after ${timeoutInMs} ms`), { name: "TimeoutError" }));
98
- });
121
+ const registerTimeout = /* @__PURE__ */ __name((offset) => {
122
+ request.setTimeout(timeoutInMs - offset, () => {
123
+ request.destroy();
124
+ reject(Object.assign(new Error(`Connection timed out after ${timeoutInMs} ms`), { name: "TimeoutError" }));
125
+ });
126
+ }, "registerTimeout");
127
+ if (0 < timeoutInMs && timeoutInMs < 6e3) {
128
+ registerTimeout(0);
129
+ return 0;
130
+ }
131
+ return setTimeout(
132
+ registerTimeout.bind(null, timeoutInMs === 0 ? 0 : DEFER_EVENT_LISTENER_TIME3),
133
+ DEFER_EVENT_LISTENER_TIME3
134
+ );
99
135
  }, "setSocketTimeout");
100
136
 
101
137
  // src/write-request-body.ts
@@ -244,17 +280,17 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
244
280
  if (!this.config) {
245
281
  this.config = await this.configProvider;
246
282
  }
247
- let socketCheckTimeoutId;
248
283
  return new Promise((_resolve, _reject) => {
249
284
  let writeRequestBodyPromise = void 0;
285
+ const timeouts = [];
250
286
  const resolve = /* @__PURE__ */ __name(async (arg) => {
251
287
  await writeRequestBodyPromise;
252
- clearTimeout(socketCheckTimeoutId);
288
+ timeouts.forEach(clearTimeout);
253
289
  _resolve(arg);
254
290
  }, "resolve");
255
291
  const reject = /* @__PURE__ */ __name(async (arg) => {
256
292
  await writeRequestBodyPromise;
257
- clearTimeout(socketCheckTimeoutId);
293
+ timeouts.forEach(clearTimeout);
258
294
  _reject(arg);
259
295
  }, "reject");
260
296
  if (!this.config) {
@@ -268,15 +304,17 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
268
304
  }
269
305
  const isSSL = request.protocol === "https:";
270
306
  const agent = isSSL ? this.config.httpsAgent : this.config.httpAgent;
271
- socketCheckTimeoutId = setTimeout(
272
- () => {
273
- this.socketWarningTimestamp = _NodeHttpHandler.checkSocketUsage(
274
- agent,
275
- this.socketWarningTimestamp,
276
- this.config.logger
277
- );
278
- },
279
- this.config.socketAcquisitionWarningTimeout ?? (this.config.requestTimeout ?? 2e3) + (this.config.connectionTimeout ?? 1e3)
307
+ timeouts.push(
308
+ setTimeout(
309
+ () => {
310
+ this.socketWarningTimestamp = _NodeHttpHandler.checkSocketUsage(
311
+ agent,
312
+ this.socketWarningTimestamp,
313
+ this.config.logger
314
+ );
315
+ },
316
+ this.config.socketAcquisitionWarningTimeout ?? (this.config.requestTimeout ?? 2e3) + (this.config.connectionTimeout ?? 1e3)
317
+ )
280
318
  );
281
319
  const queryString = (0, import_querystring_builder.buildQueryString)(request.query || {});
282
320
  let auth = void 0;
@@ -318,8 +356,6 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
318
356
  reject(err);
319
357
  }
320
358
  });
321
- setConnectionTimeout(req, reject, this.config.connectionTimeout);
322
- setSocketTimeout(req, reject, this.config.requestTimeout);
323
359
  if (abortSignal) {
324
360
  const onAbort = /* @__PURE__ */ __name(() => {
325
361
  req.destroy();
@@ -335,17 +371,21 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
335
371
  abortSignal.onabort = onAbort;
336
372
  }
337
373
  }
374
+ timeouts.push(setConnectionTimeout(req, reject, this.config.connectionTimeout));
375
+ timeouts.push(setSocketTimeout(req, reject, this.config.requestTimeout));
338
376
  const httpAgent = nodeHttpsOptions.agent;
339
377
  if (typeof httpAgent === "object" && "keepAlive" in httpAgent) {
340
- setSocketKeepAlive(req, {
341
- // @ts-expect-error keepAlive is not public on httpAgent.
342
- keepAlive: httpAgent.keepAlive,
343
- // @ts-expect-error keepAliveMsecs is not public on httpAgent.
344
- keepAliveMsecs: httpAgent.keepAliveMsecs
345
- });
378
+ timeouts.push(
379
+ setSocketKeepAlive(req, {
380
+ // @ts-expect-error keepAlive is not public on httpAgent.
381
+ keepAlive: httpAgent.keepAlive,
382
+ // @ts-expect-error keepAliveMsecs is not public on httpAgent.
383
+ keepAliveMsecs: httpAgent.keepAliveMsecs
384
+ })
385
+ );
346
386
  }
347
387
  writeRequestBodyPromise = writeRequestBody(req, request, this.config.requestTimeout).catch((e) => {
348
- clearTimeout(socketCheckTimeoutId);
388
+ timeouts.forEach(clearTimeout);
349
389
  return _reject(e);
350
390
  });
351
391
  });
@@ -85,17 +85,17 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
85
85
  if (!this.config) {
86
86
  this.config = await this.configProvider;
87
87
  }
88
- let socketCheckTimeoutId;
89
88
  return new Promise((_resolve, _reject) => {
90
89
  let writeRequestBodyPromise = undefined;
90
+ const timeouts = [];
91
91
  const resolve = async (arg) => {
92
92
  await writeRequestBodyPromise;
93
- clearTimeout(socketCheckTimeoutId);
93
+ timeouts.forEach(clearTimeout);
94
94
  _resolve(arg);
95
95
  };
96
96
  const reject = async (arg) => {
97
97
  await writeRequestBodyPromise;
98
- clearTimeout(socketCheckTimeoutId);
98
+ timeouts.forEach(clearTimeout);
99
99
  _reject(arg);
100
100
  };
101
101
  if (!this.config) {
@@ -109,10 +109,10 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
109
109
  }
110
110
  const isSSL = request.protocol === "https:";
111
111
  const agent = isSSL ? this.config.httpsAgent : this.config.httpAgent;
112
- socketCheckTimeoutId = setTimeout(() => {
112
+ timeouts.push(setTimeout(() => {
113
113
  this.socketWarningTimestamp = NodeHttpHandler.checkSocketUsage(agent, this.socketWarningTimestamp, this.config.logger);
114
114
  }, this.config.socketAcquisitionWarningTimeout ??
115
- (this.config.requestTimeout ?? 2000) + (this.config.connectionTimeout ?? 1000));
115
+ (this.config.requestTimeout ?? 2000) + (this.config.connectionTimeout ?? 1000)));
116
116
  const queryString = buildQueryString(request.query || {});
117
117
  let auth = undefined;
118
118
  if (request.username != null || request.password != null) {
@@ -154,8 +154,6 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
154
154
  reject(err);
155
155
  }
156
156
  });
157
- setConnectionTimeout(req, reject, this.config.connectionTimeout);
158
- setSocketTimeout(req, reject, this.config.requestTimeout);
159
157
  if (abortSignal) {
160
158
  const onAbort = () => {
161
159
  req.destroy();
@@ -172,15 +170,17 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
172
170
  abortSignal.onabort = onAbort;
173
171
  }
174
172
  }
173
+ timeouts.push(setConnectionTimeout(req, reject, this.config.connectionTimeout));
174
+ timeouts.push(setSocketTimeout(req, reject, this.config.requestTimeout));
175
175
  const httpAgent = nodeHttpsOptions.agent;
176
176
  if (typeof httpAgent === "object" && "keepAlive" in httpAgent) {
177
- setSocketKeepAlive(req, {
177
+ timeouts.push(setSocketKeepAlive(req, {
178
178
  keepAlive: httpAgent.keepAlive,
179
179
  keepAliveMsecs: httpAgent.keepAliveMsecs,
180
- });
180
+ }));
181
181
  }
182
182
  writeRequestBodyPromise = writeRequestBody(req, request, this.config.requestTimeout).catch((e) => {
183
- clearTimeout(socketCheckTimeoutId);
183
+ timeouts.forEach(clearTimeout);
184
184
  return _reject(e);
185
185
  });
186
186
  });
@@ -1,21 +1,35 @@
1
+ const DEFER_EVENT_LISTENER_TIME = 1000;
1
2
  export const setConnectionTimeout = (request, reject, timeoutInMs = 0) => {
2
3
  if (!timeoutInMs) {
3
- return;
4
+ return -1;
4
5
  }
5
- const timeoutId = setTimeout(() => {
6
- request.destroy();
7
- reject(Object.assign(new Error(`Socket timed out without establishing a connection within ${timeoutInMs} ms`), {
8
- name: "TimeoutError",
9
- }));
10
- }, timeoutInMs);
11
- request.on("socket", (socket) => {
12
- if (socket.connecting) {
13
- socket.on("connect", () => {
6
+ const registerTimeout = (offset) => {
7
+ const timeoutId = setTimeout(() => {
8
+ request.destroy();
9
+ reject(Object.assign(new Error(`Socket timed out without establishing a connection within ${timeoutInMs} ms`), {
10
+ name: "TimeoutError",
11
+ }));
12
+ }, timeoutInMs - offset);
13
+ const doWithSocket = (socket) => {
14
+ if (socket?.connecting) {
15
+ socket.on("connect", () => {
16
+ clearTimeout(timeoutId);
17
+ });
18
+ }
19
+ else {
14
20
  clearTimeout(timeoutId);
15
- });
21
+ }
22
+ };
23
+ if (request.socket) {
24
+ doWithSocket(request.socket);
16
25
  }
17
26
  else {
18
- clearTimeout(timeoutId);
27
+ request.on("socket", doWithSocket);
19
28
  }
20
- });
29
+ };
30
+ if (timeoutInMs < 2000) {
31
+ registerTimeout(0);
32
+ return 0;
33
+ }
34
+ return setTimeout(registerTimeout.bind(null, DEFER_EVENT_LISTENER_TIME), DEFER_EVENT_LISTENER_TIME);
21
35
  };
@@ -1,8 +1,21 @@
1
- export const setSocketKeepAlive = (request, { keepAlive, keepAliveMsecs }) => {
1
+ const DEFER_EVENT_LISTENER_TIME = 3000;
2
+ export const setSocketKeepAlive = (request, { keepAlive, keepAliveMsecs }, deferTimeMs = DEFER_EVENT_LISTENER_TIME) => {
2
3
  if (keepAlive !== true) {
3
- return;
4
+ return -1;
4
5
  }
5
- request.on("socket", (socket) => {
6
- socket.setKeepAlive(keepAlive, keepAliveMsecs || 0);
7
- });
6
+ const registerListener = () => {
7
+ if (request.socket) {
8
+ request.socket.setKeepAlive(keepAlive, keepAliveMsecs || 0);
9
+ }
10
+ else {
11
+ request.on("socket", (socket) => {
12
+ socket.setKeepAlive(keepAlive, keepAliveMsecs || 0);
13
+ });
14
+ }
15
+ };
16
+ if (deferTimeMs === 0) {
17
+ registerListener();
18
+ return 0;
19
+ }
20
+ return setTimeout(registerListener, deferTimeMs);
8
21
  };
@@ -1,6 +1,14 @@
1
+ const DEFER_EVENT_LISTENER_TIME = 3000;
1
2
  export const setSocketTimeout = (request, reject, timeoutInMs = 0) => {
2
- request.setTimeout(timeoutInMs, () => {
3
- request.destroy();
4
- reject(Object.assign(new Error(`Connection timed out after ${timeoutInMs} ms`), { name: "TimeoutError" }));
5
- });
3
+ const registerTimeout = (offset) => {
4
+ request.setTimeout(timeoutInMs - offset, () => {
5
+ request.destroy();
6
+ reject(Object.assign(new Error(`Connection timed out after ${timeoutInMs} ms`), { name: "TimeoutError" }));
7
+ });
8
+ };
9
+ if (0 < timeoutInMs && timeoutInMs < 6000) {
10
+ registerTimeout(0);
11
+ return 0;
12
+ }
13
+ return setTimeout(registerTimeout.bind(null, timeoutInMs === 0 ? 0 : DEFER_EVENT_LISTENER_TIME), DEFER_EVENT_LISTENER_TIME);
6
14
  };
@@ -1,2 +1,7 @@
1
+ /// <reference types="node" />
2
+ /// <reference types="node" />
3
+ /// <reference types="node" />
4
+ /// <reference types="node" />
5
+ /// <reference types="node" />
1
6
  import { ClientRequest } from "http";
2
- export declare const setConnectionTimeout: (request: ClientRequest, reject: (err: Error) => void, timeoutInMs?: number) => void;
7
+ export declare const setConnectionTimeout: (request: ClientRequest, reject: (err: Error) => void, timeoutInMs?: number) => NodeJS.Timeout | number;
@@ -1,6 +1,11 @@
1
+ /// <reference types="node" />
2
+ /// <reference types="node" />
3
+ /// <reference types="node" />
4
+ /// <reference types="node" />
5
+ /// <reference types="node" />
1
6
  import { ClientRequest } from "http";
2
7
  export interface SocketKeepAliveOptions {
3
8
  keepAlive: boolean;
4
9
  keepAliveMsecs?: number;
5
10
  }
6
- export declare const setSocketKeepAlive: (request: ClientRequest, { keepAlive, keepAliveMsecs }: SocketKeepAliveOptions) => void;
11
+ export declare const setSocketKeepAlive: (request: ClientRequest, { keepAlive, keepAliveMsecs }: SocketKeepAliveOptions, deferTimeMs?: number) => NodeJS.Timeout | number;
@@ -1,2 +1,7 @@
1
+ /// <reference types="node" />
2
+ /// <reference types="node" />
3
+ /// <reference types="node" />
4
+ /// <reference types="node" />
5
+ /// <reference types="node" />
1
6
  import { ClientRequest } from "http";
2
- export declare const setSocketTimeout: (request: ClientRequest, reject: (err: Error) => void, timeoutInMs?: number) => void;
7
+ export declare const setSocketTimeout: (request: ClientRequest, reject: (err: Error) => void, timeoutInMs?: number) => NodeJS.Timeout | number;
@@ -1,2 +1,3 @@
1
+ /// <reference types="node" />
1
2
  import { ClientRequest } from "http";
2
- export declare const setConnectionTimeout: (request: ClientRequest, reject: (err: Error) => void, timeoutInMs?: number) => void;
3
+ export declare const setConnectionTimeout: (request: ClientRequest, reject: (err: Error) => void, timeoutInMs?: number) => NodeJS.Timeout | number;
@@ -1,6 +1,7 @@
1
+ /// <reference types="node" />
1
2
  import { ClientRequest } from "http";
2
3
  export interface SocketKeepAliveOptions {
3
4
  keepAlive: boolean;
4
5
  keepAliveMsecs?: number;
5
6
  }
6
- export declare const setSocketKeepAlive: (request: ClientRequest, { keepAlive, keepAliveMsecs }: SocketKeepAliveOptions) => void;
7
+ export declare const setSocketKeepAlive: (request: ClientRequest, { keepAlive, keepAliveMsecs }: SocketKeepAliveOptions, deferTimeMs?: number) => NodeJS.Timeout | number;
@@ -1,2 +1,3 @@
1
+ /// <reference types="node" />
1
2
  import { ClientRequest } from "http";
2
- export declare const setSocketTimeout: (request: ClientRequest, reject: (err: Error) => void, timeoutInMs?: number) => void;
3
+ export declare const setSocketTimeout: (request: ClientRequest, reject: (err: Error) => void, timeoutInMs?: number) => NodeJS.Timeout | number;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smithy/node-http-handler",
3
- "version": "3.1.4",
3
+ "version": "3.2.0",
4
4
  "description": "Provides a way to make requests",
5
5
  "scripts": {
6
6
  "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types && yarn build:types:downlevel'",
@@ -25,10 +25,10 @@
25
25
  "module": "./dist-es/index.js",
26
26
  "types": "./dist-types/index.d.ts",
27
27
  "dependencies": {
28
- "@smithy/abort-controller": "^3.1.1",
29
- "@smithy/protocol-http": "^4.1.0",
30
- "@smithy/querystring-builder": "^3.0.3",
31
- "@smithy/types": "^3.3.0",
28
+ "@smithy/abort-controller": "^3.1.2",
29
+ "@smithy/protocol-http": "^4.1.1",
30
+ "@smithy/querystring-builder": "^3.0.4",
31
+ "@smithy/types": "^3.4.0",
32
32
  "tslib": "^2.6.2"
33
33
  },
34
34
  "devDependencies": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smithy/property-provider",
3
- "version": "3.1.3",
3
+ "version": "3.1.4",
4
4
  "scripts": {
5
5
  "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types && yarn build:types:downlevel'",
6
6
  "build:cjs": "node ../../scripts/inline property-provider",
@@ -22,7 +22,7 @@
22
22
  },
23
23
  "license": "Apache-2.0",
24
24
  "dependencies": {
25
- "@smithy/types": "^3.3.0",
25
+ "@smithy/types": "^3.4.0",
26
26
  "tslib": "^2.6.2"
27
27
  },
28
28
  "engines": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smithy/protocol-http",
3
- "version": "4.1.0",
3
+ "version": "4.1.1",
4
4
  "scripts": {
5
5
  "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types && yarn build:types:downlevel'",
6
6
  "build:cjs": "node ../../scripts/inline protocol-http",
@@ -23,7 +23,7 @@
23
23
  },
24
24
  "license": "Apache-2.0",
25
25
  "dependencies": {
26
- "@smithy/types": "^3.3.0",
26
+ "@smithy/types": "^3.4.0",
27
27
  "tslib": "^2.6.2"
28
28
  },
29
29
  "engines": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smithy/querystring-builder",
3
- "version": "3.0.3",
3
+ "version": "3.0.4",
4
4
  "scripts": {
5
5
  "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types && yarn build:types:downlevel'",
6
6
  "build:cjs": "node ../../scripts/inline querystring-builder",
@@ -22,7 +22,7 @@
22
22
  },
23
23
  "license": "Apache-2.0",
24
24
  "dependencies": {
25
- "@smithy/types": "^3.3.0",
25
+ "@smithy/types": "^3.4.0",
26
26
  "@smithy/util-uri-escape": "^3.0.0",
27
27
  "tslib": "^2.6.2"
28
28
  },
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smithy/querystring-parser",
3
- "version": "3.0.3",
3
+ "version": "3.0.4",
4
4
  "scripts": {
5
5
  "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types && yarn build:types:downlevel'",
6
6
  "build:cjs": "node ../../scripts/inline querystring-parser",
@@ -22,7 +22,7 @@
22
22
  },
23
23
  "license": "Apache-2.0",
24
24
  "dependencies": {
25
- "@smithy/types": "^3.3.0",
25
+ "@smithy/types": "^3.4.0",
26
26
  "tslib": "^2.6.2"
27
27
  },
28
28
  "engines": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smithy/service-error-classification",
3
- "version": "3.0.3",
3
+ "version": "3.0.4",
4
4
  "scripts": {
5
5
  "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types && yarn build:types:downlevel'",
6
6
  "build:cjs": "node ../../scripts/inline service-error-classification",
@@ -53,6 +53,6 @@
53
53
  "directory": ".release/package"
54
54
  },
55
55
  "dependencies": {
56
- "@smithy/types": "^3.3.0"
56
+ "@smithy/types": "^3.4.0"
57
57
  }
58
58
  }
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@smithy/shared-ini-file-loader",
3
- "version": "3.1.4",
3
+ "version": "3.1.5",
4
4
  "dependencies": {
5
- "@smithy/types": "^3.3.0",
5
+ "@smithy/types": "^3.4.0",
6
6
  "tslib": "^2.6.2"
7
7
  },
8
8
  "devDependencies": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smithy/signature-v4",
3
- "version": "4.1.0",
3
+ "version": "4.1.1",
4
4
  "description": "A standalone implementation of the AWS Signature V4 request signing algorithm",
5
5
  "main": "./dist-cjs/index.js",
6
6
  "module": "./dist-es/index.js",
@@ -25,10 +25,10 @@
25
25
  "license": "Apache-2.0",
26
26
  "dependencies": {
27
27
  "@smithy/is-array-buffer": "^3.0.0",
28
- "@smithy/protocol-http": "^4.1.0",
29
- "@smithy/types": "^3.3.0",
28
+ "@smithy/protocol-http": "^4.1.1",
29
+ "@smithy/types": "^3.4.0",
30
30
  "@smithy/util-hex-encoding": "^3.0.0",
31
- "@smithy/util-middleware": "^3.0.3",
31
+ "@smithy/util-middleware": "^3.0.4",
32
32
  "@smithy/util-uri-escape": "^3.0.0",
33
33
  "@smithy/util-utf8": "^3.0.0",
34
34
  "tslib": "^2.6.2"
@@ -102,13 +102,29 @@ var NoOpLogger = _NoOpLogger;
102
102
  var import_middleware_stack = require("@smithy/middleware-stack");
103
103
  var _Client = class _Client {
104
104
  constructor(config) {
105
- this.middlewareStack = (0, import_middleware_stack.constructStack)();
106
105
  this.config = config;
106
+ this.middlewareStack = (0, import_middleware_stack.constructStack)();
107
107
  }
108
108
  send(command, optionsOrCb, cb) {
109
109
  const options = typeof optionsOrCb !== "function" ? optionsOrCb : void 0;
110
110
  const callback = typeof optionsOrCb === "function" ? optionsOrCb : cb;
111
- const handler = command.resolveMiddleware(this.middlewareStack, this.config, options);
111
+ const useHandlerCache = options === void 0 && this.config.cacheMiddleware === true;
112
+ let handler;
113
+ if (useHandlerCache) {
114
+ if (!this.handlers) {
115
+ this.handlers = /* @__PURE__ */ new WeakMap();
116
+ }
117
+ const handlers = this.handlers;
118
+ if (handlers.has(command.constructor)) {
119
+ handler = handlers.get(command.constructor);
120
+ } else {
121
+ handler = command.resolveMiddleware(this.middlewareStack, this.config, options);
122
+ handlers.set(command.constructor, handler);
123
+ }
124
+ } else {
125
+ delete this.handlers;
126
+ handler = command.resolveMiddleware(this.middlewareStack, this.config, options);
127
+ }
112
128
  if (callback) {
113
129
  handler(command).then(
114
130
  (result) => callback(null, result.output),
@@ -124,8 +140,9 @@ var _Client = class _Client {
124
140
  }
125
141
  }
126
142
  destroy() {
127
- if (this.config.requestHandler.destroy)
128
- this.config.requestHandler.destroy();
143
+ var _a, _b, _c;
144
+ (_c = (_b = (_a = this.config) == null ? void 0 : _a.requestHandler) == null ? void 0 : _b.destroy) == null ? void 0 : _c.call(_b);
145
+ delete this.handlers;
129
146
  }
130
147
  };
131
148
  __name(_Client, "Client");
@@ -1,13 +1,31 @@
1
1
  import { constructStack } from "@smithy/middleware-stack";
2
2
  export class Client {
3
3
  constructor(config) {
4
- this.middlewareStack = constructStack();
5
4
  this.config = config;
5
+ this.middlewareStack = constructStack();
6
6
  }
7
7
  send(command, optionsOrCb, cb) {
8
8
  const options = typeof optionsOrCb !== "function" ? optionsOrCb : undefined;
9
9
  const callback = typeof optionsOrCb === "function" ? optionsOrCb : cb;
10
- const handler = command.resolveMiddleware(this.middlewareStack, this.config, options);
10
+ const useHandlerCache = options === undefined && this.config.cacheMiddleware === true;
11
+ let handler;
12
+ if (useHandlerCache) {
13
+ if (!this.handlers) {
14
+ this.handlers = new WeakMap();
15
+ }
16
+ const handlers = this.handlers;
17
+ if (handlers.has(command.constructor)) {
18
+ handler = handlers.get(command.constructor);
19
+ }
20
+ else {
21
+ handler = command.resolveMiddleware(this.middlewareStack, this.config, options);
22
+ handlers.set(command.constructor, handler);
23
+ }
24
+ }
25
+ else {
26
+ delete this.handlers;
27
+ handler = command.resolveMiddleware(this.middlewareStack, this.config, options);
28
+ }
11
29
  if (callback) {
12
30
  handler(command)
13
31
  .then((result) => callback(null, result.output), (err) => callback(err))
@@ -18,7 +36,7 @@ export class Client {
18
36
  }
19
37
  }
20
38
  destroy() {
21
- if (this.config.requestHandler.destroy)
22
- this.config.requestHandler.destroy();
39
+ this.config?.requestHandler?.destroy?.();
40
+ delete this.handlers;
23
41
  }
24
42
  }