@cdklabs/cdk-ecs-codedeploy 0.0.102 → 0.0.103

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 (90) hide show
  1. package/.jsii +3 -3
  2. package/lib/api-canary/index.js +1 -1
  3. package/lib/ecs-appspec/index.js +1 -1
  4. package/lib/ecs-deployment/index.js +1 -1
  5. package/lib/ecs-patterns/application-load-balanced-codedeployed-fargate-service.js +1 -1
  6. package/node_modules/@aws-sdk/abort-controller/package.json +2 -2
  7. package/node_modules/@aws-sdk/client-codedeploy/package.json +30 -30
  8. package/node_modules/@aws-sdk/client-sso/package.json +26 -26
  9. package/node_modules/@aws-sdk/client-sso-oidc/package.json +26 -26
  10. package/node_modules/@aws-sdk/client-sts/package.json +29 -29
  11. package/node_modules/@aws-sdk/config-resolver/package.json +5 -5
  12. package/node_modules/@aws-sdk/credential-provider-env/package.json +3 -3
  13. package/node_modules/@aws-sdk/credential-provider-imds/package.json +5 -5
  14. package/node_modules/@aws-sdk/credential-provider-ini/dist-cjs/resolveProcessCredentials.js +1 -3
  15. package/node_modules/@aws-sdk/credential-provider-ini/dist-es/resolveProcessCredentials.js +1 -3
  16. package/node_modules/@aws-sdk/credential-provider-ini/package.json +9 -9
  17. package/node_modules/@aws-sdk/credential-provider-node/package.json +10 -10
  18. package/node_modules/@aws-sdk/credential-provider-process/package.json +4 -4
  19. package/node_modules/@aws-sdk/credential-provider-sso/package.json +6 -6
  20. package/node_modules/@aws-sdk/credential-provider-web-identity/package.json +3 -3
  21. package/node_modules/@aws-sdk/fetch-http-handler/package.json +5 -5
  22. package/node_modules/@aws-sdk/hash-node/package.json +2 -2
  23. package/node_modules/@aws-sdk/invalid-dependency/package.json +2 -2
  24. package/node_modules/@aws-sdk/middleware-content-length/package.json +3 -3
  25. package/node_modules/@aws-sdk/middleware-endpoint/package.json +7 -7
  26. package/node_modules/@aws-sdk/middleware-host-header/package.json +3 -3
  27. package/node_modules/@aws-sdk/middleware-logger/package.json +2 -2
  28. package/node_modules/@aws-sdk/middleware-recursion-detection/package.json +3 -3
  29. package/node_modules/@aws-sdk/middleware-retry/package.json +7 -7
  30. package/node_modules/@aws-sdk/middleware-sdk-sts/package.json +6 -6
  31. package/node_modules/@aws-sdk/middleware-serde/package.json +2 -2
  32. package/node_modules/@aws-sdk/middleware-signing/package.json +6 -6
  33. package/node_modules/@aws-sdk/middleware-stack/package.json +2 -2
  34. package/node_modules/@aws-sdk/middleware-user-agent/package.json +5 -5
  35. package/node_modules/@aws-sdk/node-config-provider/package.json +4 -4
  36. package/node_modules/@aws-sdk/node-http-handler/dist-cjs/node-http-handler.js +11 -6
  37. package/node_modules/@aws-sdk/node-http-handler/dist-cjs/node-http2-connection-manager.js +92 -0
  38. package/node_modules/@aws-sdk/node-http-handler/dist-cjs/node-http2-connection-pool.js +36 -0
  39. package/node_modules/@aws-sdk/node-http-handler/dist-cjs/node-http2-handler.js +14 -37
  40. package/node_modules/@aws-sdk/node-http-handler/dist-es/node-http-handler.js +8 -5
  41. package/node_modules/@aws-sdk/node-http-handler/dist-es/node-http2-connection-manager.js +86 -0
  42. package/node_modules/@aws-sdk/node-http-handler/dist-es/node-http2-connection-pool.js +32 -0
  43. package/node_modules/@aws-sdk/node-http-handler/dist-es/node-http2-handler.js +14 -37
  44. package/node_modules/@aws-sdk/node-http-handler/dist-types/node-http-handler.d.ts +16 -0
  45. package/node_modules/@aws-sdk/node-http-handler/dist-types/node-http2-connection-manager.d.ts +22 -0
  46. package/node_modules/@aws-sdk/node-http-handler/dist-types/node-http2-connection-pool.d.ts +13 -0
  47. package/node_modules/@aws-sdk/node-http-handler/dist-types/node-http2-handler.d.ts +9 -16
  48. package/node_modules/@aws-sdk/node-http-handler/dist-types/ts3.4/node-http-handler.d.ts +2 -0
  49. package/node_modules/@aws-sdk/node-http-handler/dist-types/ts3.4/node-http2-connection-manager.d.ts +24 -0
  50. package/node_modules/@aws-sdk/node-http-handler/dist-types/ts3.4/node-http2-connection-pool.d.ts +14 -0
  51. package/node_modules/@aws-sdk/node-http-handler/dist-types/ts3.4/node-http2-handler.d.ts +2 -3
  52. package/node_modules/@aws-sdk/node-http-handler/package.json +5 -5
  53. package/node_modules/@aws-sdk/property-provider/package.json +2 -2
  54. package/node_modules/@aws-sdk/protocol-http/package.json +2 -2
  55. package/node_modules/@aws-sdk/querystring-builder/package.json +2 -2
  56. package/node_modules/@aws-sdk/querystring-parser/package.json +2 -2
  57. package/node_modules/@aws-sdk/service-error-classification/package.json +2 -2
  58. package/node_modules/@aws-sdk/shared-ini-file-loader/package.json +2 -2
  59. package/node_modules/@aws-sdk/signature-v4/package.json +4 -4
  60. package/node_modules/@aws-sdk/smithy-client/package.json +3 -3
  61. package/node_modules/@aws-sdk/token-providers/package.json +5 -5
  62. package/node_modules/@aws-sdk/types/dist-cjs/connection/config.js +2 -0
  63. package/node_modules/@aws-sdk/types/dist-cjs/connection/manager.js +2 -0
  64. package/node_modules/@aws-sdk/types/dist-cjs/connection/pool.js +2 -0
  65. package/node_modules/@aws-sdk/types/dist-cjs/transfer.js +7 -0
  66. package/node_modules/@aws-sdk/types/dist-es/connection/config.js +1 -0
  67. package/node_modules/@aws-sdk/types/dist-es/connection/manager.js +1 -0
  68. package/node_modules/@aws-sdk/types/dist-es/connection/pool.js +1 -0
  69. package/node_modules/@aws-sdk/types/dist-es/transfer.js +6 -1
  70. package/node_modules/@aws-sdk/types/dist-types/connection/config.d.ts +7 -0
  71. package/node_modules/@aws-sdk/types/dist-types/connection/manager.d.ts +28 -0
  72. package/node_modules/@aws-sdk/types/dist-types/connection/pool.d.ts +24 -0
  73. package/node_modules/@aws-sdk/types/dist-types/http.d.ts +5 -0
  74. package/node_modules/@aws-sdk/types/dist-types/transfer.d.ts +9 -1
  75. package/node_modules/@aws-sdk/types/dist-types/ts3.4/connection/config.d.ts +3 -0
  76. package/node_modules/@aws-sdk/types/dist-types/ts3.4/connection/manager.d.ts +14 -0
  77. package/node_modules/@aws-sdk/types/dist-types/ts3.4/connection/pool.d.ts +9 -0
  78. package/node_modules/@aws-sdk/types/dist-types/ts3.4/http.d.ts +1 -0
  79. package/node_modules/@aws-sdk/types/dist-types/ts3.4/transfer.d.ts +9 -1
  80. package/node_modules/@aws-sdk/types/package.json +1 -1
  81. package/node_modules/@aws-sdk/url-parser/package.json +3 -3
  82. package/node_modules/@aws-sdk/util-defaults-mode-browser/package.json +4 -4
  83. package/node_modules/@aws-sdk/util-defaults-mode-node/package.json +7 -7
  84. package/node_modules/@aws-sdk/util-endpoints/package.json +2 -2
  85. package/node_modules/@aws-sdk/util-middleware/package.json +2 -2
  86. package/node_modules/@aws-sdk/util-retry/package.json +3 -3
  87. package/node_modules/@aws-sdk/util-user-agent-browser/package.json +3 -3
  88. package/node_modules/@aws-sdk/util-user-agent-node/package.json +4 -4
  89. package/node_modules/@aws-sdk/util-waiter/package.json +3 -3
  90. package/package.json +8 -8
@@ -5,10 +5,12 @@ const protocol_http_1 = require("@aws-sdk/protocol-http");
5
5
  const querystring_builder_1 = require("@aws-sdk/querystring-builder");
6
6
  const http2_1 = require("http2");
7
7
  const get_transformed_headers_1 = require("./get-transformed-headers");
8
+ const node_http2_connection_manager_1 = require("./node-http2-connection-manager");
8
9
  const write_request_body_1 = require("./write-request-body");
9
10
  class NodeHttp2Handler {
10
11
  constructor(options) {
11
12
  this.metadata = { handlerProtocol: "h2" };
13
+ this.connectionManager = new node_http2_connection_manager_1.NodeHttp2ConnectionManager({});
12
14
  this.configProvider = new Promise((resolve, reject) => {
13
15
  if (typeof options === "function") {
14
16
  options()
@@ -21,20 +23,21 @@ class NodeHttp2Handler {
21
23
  resolve(options || {});
22
24
  }
23
25
  });
24
- this.sessionCache = new Map();
25
26
  }
26
27
  destroy() {
27
- for (const sessions of this.sessionCache.values()) {
28
- sessions.forEach((session) => this.destroySession(session));
29
- }
30
- this.sessionCache.clear();
28
+ this.connectionManager.destroy();
31
29
  }
32
30
  async handle(request, { abortSignal } = {}) {
33
31
  if (!this.config) {
34
32
  this.config = await this.configProvider;
33
+ this.connectionManager.setDisableConcurrentStreams(this.config.disableConcurrentStreams || false);
34
+ if (this.config.maxConcurrentStreams) {
35
+ this.connectionManager.setMaxConcurrentStreams(this.config.maxConcurrentStreams);
36
+ }
35
37
  }
36
38
  const { requestTimeout, disableConcurrentStreams } = this.config;
37
39
  return new Promise((resolve, rejectOriginal) => {
40
+ var _a;
38
41
  let fulfilled = false;
39
42
  if (abortSignal === null || abortSignal === void 0 ? void 0 : abortSignal.aborted) {
40
43
  fulfilled = true;
@@ -45,7 +48,11 @@ class NodeHttp2Handler {
45
48
  }
46
49
  const { hostname, method, port, protocol, path, query } = request;
47
50
  const authority = `${protocol}//${hostname}${port ? `:${port}` : ""}`;
48
- const session = this.getSession(authority, disableConcurrentStreams || false);
51
+ const requestContext = { destination: new URL(authority) };
52
+ const session = this.connectionManager.lease(requestContext, {
53
+ requestTimeout: (_a = this.config) === null || _a === void 0 ? void 0 : _a.sessionTimeout,
54
+ disableConcurrentStreams: disableConcurrentStreams || false,
55
+ });
49
56
  const reject = (err) => {
50
57
  if (disableConcurrentStreams) {
51
58
  this.destroySession(session);
@@ -70,7 +77,7 @@ class NodeHttp2Handler {
70
77
  resolve({ response: httpResponse });
71
78
  if (disableConcurrentStreams) {
72
79
  session.close();
73
- this.deleteSessionFromCache(authority, session);
80
+ this.connectionManager.deleteSession(authority, session);
74
81
  }
75
82
  });
76
83
  if (requestTimeout) {
@@ -108,40 +115,10 @@ class NodeHttp2Handler {
108
115
  (0, write_request_body_1.writeRequestBody)(req, request);
109
116
  });
110
117
  }
111
- getSession(authority, disableConcurrentStreams) {
112
- var _a;
113
- const sessionCache = this.sessionCache;
114
- const existingSessions = sessionCache.get(authority) || [];
115
- if (existingSessions.length > 0 && !disableConcurrentStreams)
116
- return existingSessions[0];
117
- const newSession = (0, http2_1.connect)(authority);
118
- newSession.unref();
119
- const destroySessionCb = () => {
120
- this.destroySession(newSession);
121
- this.deleteSessionFromCache(authority, newSession);
122
- };
123
- newSession.on("goaway", destroySessionCb);
124
- newSession.on("error", destroySessionCb);
125
- newSession.on("frameError", destroySessionCb);
126
- newSession.on("close", () => this.deleteSessionFromCache(authority, newSession));
127
- if ((_a = this.config) === null || _a === void 0 ? void 0 : _a.sessionTimeout) {
128
- newSession.setTimeout(this.config.sessionTimeout, destroySessionCb);
129
- }
130
- existingSessions.push(newSession);
131
- sessionCache.set(authority, existingSessions);
132
- return newSession;
133
- }
134
118
  destroySession(session) {
135
119
  if (!session.destroyed) {
136
120
  session.destroy();
137
121
  }
138
122
  }
139
- deleteSessionFromCache(authority, session) {
140
- const existingSessions = this.sessionCache.get(authority) || [];
141
- if (!existingSessions.includes(session)) {
142
- return;
143
- }
144
- this.sessionCache.set(authority, existingSessions.filter((s) => s !== session));
145
- }
146
123
  }
147
124
  exports.NodeHttp2Handler = NodeHttp2Handler;
@@ -4,9 +4,8 @@ import { Agent as hAgent, request as hRequest } from "http";
4
4
  import { Agent as hsAgent, request as hsRequest } from "https";
5
5
  import { NODEJS_TIMEOUT_ERROR_CODES } from "./constants";
6
6
  import { getTransformedHeaders } from "./get-transformed-headers";
7
- import { setConnectionTimeout } from "./set-connection-timeout";
8
- import { setSocketTimeout } from "./set-socket-timeout";
9
7
  import { writeRequestBody } from "./write-request-body";
8
+ export const DEFAULT_REQUEST_TIMEOUT = 0;
10
9
  export class NodeHttpHandler {
11
10
  constructor(options) {
12
11
  this.metadata = { handlerProtocol: "http/1.1" };
@@ -24,12 +23,13 @@ export class NodeHttpHandler {
24
23
  });
25
24
  }
26
25
  resolveDefaultConfig(options) {
27
- const { connectionTimeout, socketTimeout, httpAgent, httpsAgent } = options || {};
26
+ const { requestTimeout, connectionTimeout, socketTimeout, httpAgent, httpsAgent } = options || {};
28
27
  const keepAlive = true;
29
28
  const maxSockets = 50;
30
29
  return {
31
30
  connectionTimeout,
32
31
  socketTimeout,
32
+ requestTimeout: requestTimeout ?? connectionTimeout ?? socketTimeout ?? DEFAULT_REQUEST_TIMEOUT,
33
33
  httpAgent: httpAgent || new hAgent({ keepAlive, maxSockets }),
34
34
  httpsAgent: httpsAgent || new hsAgent({ keepAlive, maxSockets }),
35
35
  };
@@ -79,8 +79,11 @@ export class NodeHttpHandler {
79
79
  reject(err);
80
80
  }
81
81
  });
82
- setConnectionTimeout(req, reject, this.config.connectionTimeout);
83
- setSocketTimeout(req, reject, this.config.socketTimeout);
82
+ const timeout = this.config?.requestTimeout ?? DEFAULT_REQUEST_TIMEOUT;
83
+ req.setTimeout(timeout, () => {
84
+ req.destroy();
85
+ reject(Object.assign(new Error(`Connection timed out after ${timeout} ms`), { name: "TimeoutError" }));
86
+ });
84
87
  if (abortSignal) {
85
88
  abortSignal.onabort = () => {
86
89
  req.abort();
@@ -0,0 +1,86 @@
1
+ import http2 from "http2";
2
+ import { NodeHttp2ConnectionPool } from "./node-http2-connection-pool";
3
+ export class NodeHttp2ConnectionManager {
4
+ constructor(config) {
5
+ this.sessionCache = new Map();
6
+ this.config = config;
7
+ if (this.config.maxConcurrency && this.config.maxConcurrency <= 0) {
8
+ throw new RangeError("maxConcurrency must be greater than zero.");
9
+ }
10
+ }
11
+ lease(requestContext, connectionConfiguration) {
12
+ const url = this.getUrlString(requestContext);
13
+ const existingPool = this.sessionCache.get(url);
14
+ if (existingPool) {
15
+ const existingSession = existingPool.poll();
16
+ if (existingSession && !this.config.disableConcurrency) {
17
+ return existingSession;
18
+ }
19
+ }
20
+ const session = http2.connect(url);
21
+ if (this.config.maxConcurrency) {
22
+ session.settings({ maxConcurrentStreams: this.config.maxConcurrency }, (err) => {
23
+ if (err) {
24
+ throw new Error("Fail to set maxConcurrentStreams to " +
25
+ this.config.maxConcurrency +
26
+ "when creating new session for " +
27
+ requestContext.destination.toString());
28
+ }
29
+ });
30
+ }
31
+ session.unref();
32
+ const destroySessionCb = () => {
33
+ session.destroy();
34
+ this.deleteSession(url, session);
35
+ };
36
+ session.on("goaway", destroySessionCb);
37
+ session.on("error", destroySessionCb);
38
+ session.on("frameError", destroySessionCb);
39
+ session.on("close", () => this.deleteSession(url, session));
40
+ if (connectionConfiguration.requestTimeout) {
41
+ session.setTimeout(connectionConfiguration.requestTimeout, destroySessionCb);
42
+ }
43
+ const connectionPool = this.sessionCache.get(url) || new NodeHttp2ConnectionPool();
44
+ connectionPool.offerLast(session);
45
+ this.sessionCache.set(url, connectionPool);
46
+ return session;
47
+ }
48
+ deleteSession(authority, session) {
49
+ const existingConnectionPool = this.sessionCache.get(authority);
50
+ if (!existingConnectionPool) {
51
+ return;
52
+ }
53
+ if (!existingConnectionPool.contains(session)) {
54
+ return;
55
+ }
56
+ existingConnectionPool.remove(session);
57
+ this.sessionCache.set(authority, existingConnectionPool);
58
+ }
59
+ release(requestContext, session) {
60
+ const cacheKey = this.getUrlString(requestContext);
61
+ this.sessionCache.get(cacheKey)?.offerLast(session);
62
+ }
63
+ destroy() {
64
+ for (const [key, connectionPool] of this.sessionCache) {
65
+ for (const session of connectionPool) {
66
+ if (!session.destroyed) {
67
+ session.destroy();
68
+ }
69
+ connectionPool.remove(session);
70
+ }
71
+ this.sessionCache.delete(key);
72
+ }
73
+ }
74
+ setMaxConcurrentStreams(maxConcurrentStreams) {
75
+ if (this.config.maxConcurrency && this.config.maxConcurrency <= 0) {
76
+ throw new RangeError("maxConcurrentStreams must be greater than zero.");
77
+ }
78
+ this.config.maxConcurrency = maxConcurrentStreams;
79
+ }
80
+ setDisableConcurrentStreams(disableConcurrentStreams) {
81
+ this.config.disableConcurrency = disableConcurrentStreams;
82
+ }
83
+ getUrlString(request) {
84
+ return request.destination.toString();
85
+ }
86
+ }
@@ -0,0 +1,32 @@
1
+ export class NodeHttp2ConnectionPool {
2
+ constructor(sessions) {
3
+ this.sessions = [];
4
+ this.sessions = sessions ?? [];
5
+ }
6
+ poll() {
7
+ if (this.sessions.length > 0) {
8
+ return this.sessions.shift();
9
+ }
10
+ }
11
+ offerLast(session) {
12
+ this.sessions.push(session);
13
+ }
14
+ contains(session) {
15
+ return this.sessions.includes(session);
16
+ }
17
+ remove(session) {
18
+ this.sessions = this.sessions.filter((s) => s !== session);
19
+ }
20
+ [Symbol.iterator]() {
21
+ return this.sessions[Symbol.iterator]();
22
+ }
23
+ destroy(connection) {
24
+ for (const session of this.sessions) {
25
+ if (session === connection) {
26
+ if (!session.destroyed) {
27
+ session.destroy();
28
+ }
29
+ }
30
+ }
31
+ }
32
+ }
@@ -1,11 +1,13 @@
1
1
  import { HttpResponse } from "@aws-sdk/protocol-http";
2
2
  import { buildQueryString } from "@aws-sdk/querystring-builder";
3
- import { connect, constants } from "http2";
3
+ import { constants } from "http2";
4
4
  import { getTransformedHeaders } from "./get-transformed-headers";
5
+ import { NodeHttp2ConnectionManager } from "./node-http2-connection-manager";
5
6
  import { writeRequestBody } from "./write-request-body";
6
7
  export class NodeHttp2Handler {
7
8
  constructor(options) {
8
9
  this.metadata = { handlerProtocol: "h2" };
10
+ this.connectionManager = new NodeHttp2ConnectionManager({});
9
11
  this.configProvider = new Promise((resolve, reject) => {
10
12
  if (typeof options === "function") {
11
13
  options()
@@ -18,17 +20,17 @@ export class NodeHttp2Handler {
18
20
  resolve(options || {});
19
21
  }
20
22
  });
21
- this.sessionCache = new Map();
22
23
  }
23
24
  destroy() {
24
- for (const sessions of this.sessionCache.values()) {
25
- sessions.forEach((session) => this.destroySession(session));
26
- }
27
- this.sessionCache.clear();
25
+ this.connectionManager.destroy();
28
26
  }
29
27
  async handle(request, { abortSignal } = {}) {
30
28
  if (!this.config) {
31
29
  this.config = await this.configProvider;
30
+ this.connectionManager.setDisableConcurrentStreams(this.config.disableConcurrentStreams || false);
31
+ if (this.config.maxConcurrentStreams) {
32
+ this.connectionManager.setMaxConcurrentStreams(this.config.maxConcurrentStreams);
33
+ }
32
34
  }
33
35
  const { requestTimeout, disableConcurrentStreams } = this.config;
34
36
  return new Promise((resolve, rejectOriginal) => {
@@ -42,7 +44,11 @@ export class NodeHttp2Handler {
42
44
  }
43
45
  const { hostname, method, port, protocol, path, query } = request;
44
46
  const authority = `${protocol}//${hostname}${port ? `:${port}` : ""}`;
45
- const session = this.getSession(authority, disableConcurrentStreams || false);
47
+ const requestContext = { destination: new URL(authority) };
48
+ const session = this.connectionManager.lease(requestContext, {
49
+ requestTimeout: this.config?.sessionTimeout,
50
+ disableConcurrentStreams: disableConcurrentStreams || false,
51
+ });
46
52
  const reject = (err) => {
47
53
  if (disableConcurrentStreams) {
48
54
  this.destroySession(session);
@@ -67,7 +73,7 @@ export class NodeHttp2Handler {
67
73
  resolve({ response: httpResponse });
68
74
  if (disableConcurrentStreams) {
69
75
  session.close();
70
- this.deleteSessionFromCache(authority, session);
76
+ this.connectionManager.deleteSession(authority, session);
71
77
  }
72
78
  });
73
79
  if (requestTimeout) {
@@ -105,38 +111,9 @@ export class NodeHttp2Handler {
105
111
  writeRequestBody(req, request);
106
112
  });
107
113
  }
108
- getSession(authority, disableConcurrentStreams) {
109
- const sessionCache = this.sessionCache;
110
- const existingSessions = sessionCache.get(authority) || [];
111
- if (existingSessions.length > 0 && !disableConcurrentStreams)
112
- return existingSessions[0];
113
- const newSession = connect(authority);
114
- newSession.unref();
115
- const destroySessionCb = () => {
116
- this.destroySession(newSession);
117
- this.deleteSessionFromCache(authority, newSession);
118
- };
119
- newSession.on("goaway", destroySessionCb);
120
- newSession.on("error", destroySessionCb);
121
- newSession.on("frameError", destroySessionCb);
122
- newSession.on("close", () => this.deleteSessionFromCache(authority, newSession));
123
- if (this.config?.sessionTimeout) {
124
- newSession.setTimeout(this.config.sessionTimeout, destroySessionCb);
125
- }
126
- existingSessions.push(newSession);
127
- sessionCache.set(authority, existingSessions);
128
- return newSession;
129
- }
130
114
  destroySession(session) {
131
115
  if (!session.destroyed) {
132
116
  session.destroy();
133
117
  }
134
118
  }
135
- deleteSessionFromCache(authority, session) {
136
- const existingSessions = this.sessionCache.get(authority) || [];
137
- if (!existingSessions.includes(session)) {
138
- return;
139
- }
140
- this.sessionCache.set(authority, existingSessions.filter((s) => s !== session));
141
- }
142
119
  }
@@ -9,11 +9,26 @@ import { Agent as hsAgent } from "https";
9
9
  */
10
10
  export interface NodeHttpHandlerOptions {
11
11
  /**
12
+ * @deprecated Use {@link requestTimeout}
13
+ *
14
+ * Note:{@link NodeHttpHandler} will resolve request timeout via nullish coalescing the following fields:
15
+ * {@link requestTimeout} ?? {@link connectionTimeout} ?? {@link socketTimeout} ?? {@link DEFAULT_REQUEST_TIMEOUT}
16
+ *
12
17
  * The maximum time in milliseconds that the connection phase of a request
13
18
  * may take before the connection attempt is abandoned.
14
19
  */
15
20
  connectionTimeout?: number;
16
21
  /**
22
+ * The maximum time in milliseconds that the connection phase of a request
23
+ * may take before the connection attempt is abandoned.
24
+ */
25
+ requestTimeout?: number;
26
+ /**
27
+ * @deprecated Use {@link requestTimeout}
28
+ *
29
+ * Note:{@link NodeHttpHandler} will resolve request timeout via nullish coalescing the following fields:
30
+ * {@link requestTimeout} ?? {@link connectionTimeout} ?? {@link socketTimeout} ?? {@link DEFAULT_REQUEST_TIMEOUT}
31
+ *
17
32
  * The maximum time in milliseconds that a socket may remain idle before it
18
33
  * is closed.
19
34
  */
@@ -21,6 +36,7 @@ export interface NodeHttpHandlerOptions {
21
36
  httpAgent?: hAgent;
22
37
  httpsAgent?: hsAgent;
23
38
  }
39
+ export declare const DEFAULT_REQUEST_TIMEOUT = 0;
24
40
  export declare class NodeHttpHandler implements HttpHandler {
25
41
  private config?;
26
42
  private readonly configProvider;
@@ -0,0 +1,22 @@
1
+ /// <reference types="node" />
2
+ import { RequestContext } from "@aws-sdk/types";
3
+ import { ConnectConfiguration } from "@aws-sdk/types/src/connection/config";
4
+ import { ConnectionManager, ConnectionManagerConfiguration } from "@aws-sdk/types/src/connection/manager";
5
+ import { ClientHttp2Session } from "http2";
6
+ export declare class NodeHttp2ConnectionManager implements ConnectionManager<ClientHttp2Session> {
7
+ constructor(config: ConnectionManagerConfiguration);
8
+ private config;
9
+ private readonly sessionCache;
10
+ lease(requestContext: RequestContext, connectionConfiguration: ConnectConfiguration): ClientHttp2Session;
11
+ /**
12
+ * Delete a session from the connection pool.
13
+ * @param authority The authority of the session to delete.
14
+ * @param session The session to delete.
15
+ */
16
+ deleteSession(authority: string, session: ClientHttp2Session): void;
17
+ release(requestContext: RequestContext, session: ClientHttp2Session): void;
18
+ destroy(): void;
19
+ setMaxConcurrentStreams(maxConcurrentStreams: number): void;
20
+ setDisableConcurrentStreams(disableConcurrentStreams: boolean): void;
21
+ private getUrlString;
22
+ }
@@ -0,0 +1,13 @@
1
+ /// <reference types="node" />
2
+ import { ConnectionPool } from "@aws-sdk/types/src/connection/pool";
3
+ import { ClientHttp2Session } from "http2";
4
+ export declare class NodeHttp2ConnectionPool implements ConnectionPool<ClientHttp2Session> {
5
+ private sessions;
6
+ constructor(sessions?: ClientHttp2Session[]);
7
+ poll(): ClientHttp2Session | void;
8
+ offerLast(session: ClientHttp2Session): void;
9
+ contains(session: ClientHttp2Session): boolean;
10
+ remove(session: ClientHttp2Session): void;
11
+ [Symbol.iterator](): IterableIterator<ClientHttp2Session>;
12
+ destroy(connection: ClientHttp2Session): void;
13
+ }
@@ -17,11 +17,18 @@ export interface NodeHttp2HandlerOptions {
17
17
  sessionTimeout?: number;
18
18
  /**
19
19
  * Disables processing concurrent streams on a ClientHttp2Session instance. When set
20
- * to true, the handler will create a new session instance for each request to a URL.
20
+ * to true, a new session instance is created for each request to a URL.
21
21
  * **Default:** false.
22
22
  * https://nodejs.org/api/http2.html#http2_class_clienthttp2session
23
23
  */
24
24
  disableConcurrentStreams?: boolean;
25
+ /**
26
+ * Maximum number of concurrent Http2Stream instances per ClientHttp2Session. Each session
27
+ * may have up to 2^31-1 Http2Stream instances over its lifetime.
28
+ * This value must be greater than or equal to 0.
29
+ * https://nodejs.org/api/http2.html#class-http2stream
30
+ */
31
+ maxConcurrentStreams?: number;
25
32
  }
26
33
  export declare class NodeHttp2Handler implements HttpHandler {
27
34
  private config?;
@@ -29,29 +36,15 @@ export declare class NodeHttp2Handler implements HttpHandler {
29
36
  readonly metadata: {
30
37
  handlerProtocol: string;
31
38
  };
32
- private sessionCache;
39
+ private readonly connectionManager;
33
40
  constructor(options?: NodeHttp2HandlerOptions | Provider<NodeHttp2HandlerOptions | void>);
34
41
  destroy(): void;
35
42
  handle(request: HttpRequest, { abortSignal }?: HttpHandlerOptions): Promise<{
36
43
  response: HttpResponse;
37
44
  }>;
38
- /**
39
- * Returns a session for the given URL.
40
- *
41
- * @param authority The URL to create a session for.
42
- * @param disableConcurrentStreams If true, a new session will be created for each request.
43
- * @returns A session for the given URL.
44
- */
45
- private getSession;
46
45
  /**
47
46
  * Destroys a session.
48
47
  * @param session The session to destroy.
49
48
  */
50
49
  private destroySession;
51
- /**
52
- * Delete a session from the connection pool.
53
- * @param authority The authority of the session to delete.
54
- * @param session The session to delete.
55
- */
56
- private deleteSessionFromCache;
57
50
  }
@@ -4,10 +4,12 @@ import { Agent as hAgent } from "http";
4
4
  import { Agent as hsAgent } from "https";
5
5
  export interface NodeHttpHandlerOptions {
6
6
  connectionTimeout?: number;
7
+ requestTimeout?: number;
7
8
  socketTimeout?: number;
8
9
  httpAgent?: hAgent;
9
10
  httpsAgent?: hsAgent;
10
11
  }
12
+ export declare const DEFAULT_REQUEST_TIMEOUT = 0;
11
13
  export declare class NodeHttpHandler implements HttpHandler {
12
14
  private config?;
13
15
  private readonly configProvider;
@@ -0,0 +1,24 @@
1
+ import { RequestContext } from "@aws-sdk/types";
2
+ import { ConnectConfiguration } from "@aws-sdk/types/src/connection/config";
3
+ import {
4
+ ConnectionManager,
5
+ ConnectionManagerConfiguration,
6
+ } from "@aws-sdk/types/src/connection/manager";
7
+ import { ClientHttp2Session } from "http2";
8
+ export declare class NodeHttp2ConnectionManager
9
+ implements ConnectionManager<ClientHttp2Session>
10
+ {
11
+ constructor(config: ConnectionManagerConfiguration);
12
+ private config;
13
+ private readonly sessionCache;
14
+ lease(
15
+ requestContext: RequestContext,
16
+ connectionConfiguration: ConnectConfiguration
17
+ ): ClientHttp2Session;
18
+ deleteSession(authority: string, session: ClientHttp2Session): void;
19
+ release(requestContext: RequestContext, session: ClientHttp2Session): void;
20
+ destroy(): void;
21
+ setMaxConcurrentStreams(maxConcurrentStreams: number): void;
22
+ setDisableConcurrentStreams(disableConcurrentStreams: boolean): void;
23
+ private getUrlString;
24
+ }
@@ -0,0 +1,14 @@
1
+ import { ConnectionPool } from "@aws-sdk/types/src/connection/pool";
2
+ import { ClientHttp2Session } from "http2";
3
+ export declare class NodeHttp2ConnectionPool
4
+ implements ConnectionPool<ClientHttp2Session>
5
+ {
6
+ private sessions;
7
+ constructor(sessions?: ClientHttp2Session[]);
8
+ poll(): ClientHttp2Session | void;
9
+ offerLast(session: ClientHttp2Session): void;
10
+ contains(session: ClientHttp2Session): boolean;
11
+ remove(session: ClientHttp2Session): void;
12
+ [Symbol.iterator](): IterableIterator<ClientHttp2Session>;
13
+ destroy(connection: ClientHttp2Session): void;
14
+ }
@@ -4,6 +4,7 @@ export interface NodeHttp2HandlerOptions {
4
4
  requestTimeout?: number;
5
5
  sessionTimeout?: number;
6
6
  disableConcurrentStreams?: boolean;
7
+ maxConcurrentStreams?: number;
7
8
  }
8
9
  export declare class NodeHttp2Handler implements HttpHandler {
9
10
  private config?;
@@ -11,7 +12,7 @@ export declare class NodeHttp2Handler implements HttpHandler {
11
12
  readonly metadata: {
12
13
  handlerProtocol: string;
13
14
  };
14
- private sessionCache;
15
+ private readonly connectionManager;
15
16
  constructor(
16
17
  options?: NodeHttp2HandlerOptions | Provider<NodeHttp2HandlerOptions | void>
17
18
  );
@@ -22,7 +23,5 @@ export declare class NodeHttp2Handler implements HttpHandler {
22
23
  ): Promise<{
23
24
  response: HttpResponse;
24
25
  }>;
25
- private getSession;
26
26
  private destroySession;
27
- private deleteSessionFromCache;
28
27
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-sdk/node-http-handler",
3
- "version": "3.295.0",
3
+ "version": "3.296.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'",
@@ -22,10 +22,10 @@
22
22
  "module": "./dist-es/index.js",
23
23
  "types": "./dist-types/index.d.ts",
24
24
  "dependencies": {
25
- "@aws-sdk/abort-controller": "3.295.0",
26
- "@aws-sdk/protocol-http": "3.295.0",
27
- "@aws-sdk/querystring-builder": "3.295.0",
28
- "@aws-sdk/types": "3.295.0",
25
+ "@aws-sdk/abort-controller": "3.296.0",
26
+ "@aws-sdk/protocol-http": "3.296.0",
27
+ "@aws-sdk/querystring-builder": "3.296.0",
28
+ "@aws-sdk/types": "3.296.0",
29
29
  "tslib": "^2.5.0"
30
30
  },
31
31
  "devDependencies": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-sdk/property-provider",
3
- "version": "3.295.0",
3
+ "version": "3.296.0",
4
4
  "scripts": {
5
5
  "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
6
6
  "build:cjs": "tsc -p tsconfig.cjs.json",
@@ -20,7 +20,7 @@
20
20
  },
21
21
  "license": "Apache-2.0",
22
22
  "dependencies": {
23
- "@aws-sdk/types": "3.295.0",
23
+ "@aws-sdk/types": "3.296.0",
24
24
  "tslib": "^2.5.0"
25
25
  },
26
26
  "engines": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-sdk/protocol-http",
3
- "version": "3.295.0",
3
+ "version": "3.296.0",
4
4
  "scripts": {
5
5
  "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
6
6
  "build:cjs": "tsc -p tsconfig.cjs.json",
@@ -21,7 +21,7 @@
21
21
  },
22
22
  "license": "Apache-2.0",
23
23
  "dependencies": {
24
- "@aws-sdk/types": "3.295.0",
24
+ "@aws-sdk/types": "3.296.0",
25
25
  "tslib": "^2.5.0"
26
26
  },
27
27
  "engines": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-sdk/querystring-builder",
3
- "version": "3.295.0",
3
+ "version": "3.296.0",
4
4
  "scripts": {
5
5
  "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
6
6
  "build:cjs": "tsc -p tsconfig.cjs.json",
@@ -20,7 +20,7 @@
20
20
  },
21
21
  "license": "Apache-2.0",
22
22
  "dependencies": {
23
- "@aws-sdk/types": "3.295.0",
23
+ "@aws-sdk/types": "3.296.0",
24
24
  "@aws-sdk/util-uri-escape": "3.295.0",
25
25
  "tslib": "^2.5.0"
26
26
  },
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-sdk/querystring-parser",
3
- "version": "3.295.0",
3
+ "version": "3.296.0",
4
4
  "scripts": {
5
5
  "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
6
6
  "build:cjs": "tsc -p tsconfig.cjs.json",
@@ -20,7 +20,7 @@
20
20
  },
21
21
  "license": "Apache-2.0",
22
22
  "dependencies": {
23
- "@aws-sdk/types": "3.295.0",
23
+ "@aws-sdk/types": "3.296.0",
24
24
  "tslib": "^2.5.0"
25
25
  },
26
26
  "engines": {