@cdklabs/cdk-ecs-codedeploy 0.0.317 → 0.0.319

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 (145) 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/client-codedeploy/dist-cjs/endpoint/endpointResolver.js +6 -2
  7. package/node_modules/@aws-sdk/client-codedeploy/dist-types/runtimeConfig.browser.d.ts +2 -0
  8. package/node_modules/@aws-sdk/client-codedeploy/dist-types/runtimeConfig.d.ts +2 -0
  9. package/node_modules/@aws-sdk/client-codedeploy/dist-types/runtimeConfig.native.d.ts +2 -0
  10. package/node_modules/@aws-sdk/client-codedeploy/dist-types/ts3.4/runtimeConfig.browser.d.ts +2 -0
  11. package/node_modules/@aws-sdk/client-codedeploy/dist-types/ts3.4/runtimeConfig.d.ts +2 -0
  12. package/node_modules/@aws-sdk/client-codedeploy/dist-types/ts3.4/runtimeConfig.native.d.ts +2 -0
  13. package/node_modules/@aws-sdk/client-codedeploy/dist-types/tsdoc-metadata.json +11 -0
  14. package/node_modules/@aws-sdk/client-codedeploy/package.json +36 -36
  15. package/node_modules/@aws-sdk/client-sso/dist-cjs/endpoint/endpointResolver.js +6 -2
  16. package/node_modules/@aws-sdk/client-sso/dist-es/endpoint/endpointResolver.js +7 -3
  17. package/node_modules/@aws-sdk/client-sso/dist-types/runtimeConfig.browser.d.ts +2 -0
  18. package/node_modules/@aws-sdk/client-sso/dist-types/runtimeConfig.d.ts +2 -0
  19. package/node_modules/@aws-sdk/client-sso/dist-types/runtimeConfig.native.d.ts +2 -0
  20. package/node_modules/@aws-sdk/client-sso/dist-types/ts3.4/runtimeConfig.browser.d.ts +2 -0
  21. package/node_modules/@aws-sdk/client-sso/dist-types/ts3.4/runtimeConfig.d.ts +2 -0
  22. package/node_modules/@aws-sdk/client-sso/dist-types/ts3.4/runtimeConfig.native.d.ts +2 -0
  23. package/node_modules/@aws-sdk/client-sso/dist-types/tsdoc-metadata.json +11 -0
  24. package/node_modules/@aws-sdk/client-sso/package.json +32 -32
  25. package/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/endpoint/endpointResolver.js +6 -2
  26. package/node_modules/@aws-sdk/client-sso-oidc/dist-types/runtimeConfig.browser.d.ts +2 -0
  27. package/node_modules/@aws-sdk/client-sso-oidc/dist-types/runtimeConfig.d.ts +2 -0
  28. package/node_modules/@aws-sdk/client-sso-oidc/dist-types/runtimeConfig.native.d.ts +2 -0
  29. package/node_modules/@aws-sdk/client-sso-oidc/dist-types/ts3.4/runtimeConfig.browser.d.ts +2 -0
  30. package/node_modules/@aws-sdk/client-sso-oidc/dist-types/ts3.4/runtimeConfig.d.ts +2 -0
  31. package/node_modules/@aws-sdk/client-sso-oidc/dist-types/ts3.4/runtimeConfig.native.d.ts +2 -0
  32. package/node_modules/@aws-sdk/client-sso-oidc/dist-types/tsdoc-metadata.json +11 -0
  33. package/node_modules/@aws-sdk/client-sso-oidc/package.json +34 -34
  34. package/node_modules/@aws-sdk/client-sts/dist-cjs/endpoint/endpointResolver.js +6 -2
  35. package/node_modules/@aws-sdk/client-sts/dist-es/endpoint/endpointResolver.js +7 -3
  36. package/node_modules/@aws-sdk/client-sts/dist-types/runtimeConfig.browser.d.ts +2 -0
  37. package/node_modules/@aws-sdk/client-sts/dist-types/runtimeConfig.d.ts +2 -0
  38. package/node_modules/@aws-sdk/client-sts/dist-types/runtimeConfig.native.d.ts +2 -0
  39. package/node_modules/@aws-sdk/client-sts/dist-types/ts3.4/runtimeConfig.browser.d.ts +2 -0
  40. package/node_modules/@aws-sdk/client-sts/dist-types/ts3.4/runtimeConfig.d.ts +2 -0
  41. package/node_modules/@aws-sdk/client-sts/dist-types/ts3.4/runtimeConfig.native.d.ts +2 -0
  42. package/node_modules/@aws-sdk/client-sts/package.json +34 -34
  43. package/node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/aws_sdk/AwsSdkSigV4AConfigSelector.js +20 -0
  44. package/node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/aws_sdk/awsSdkSigV4AConfigSelector.js +20 -0
  45. package/node_modules/@aws-sdk/core/dist-types/submodules/httpAuthSchemes/aws_sdk/AwsSdkSigV4AConfigSelector.d.ts +5 -0
  46. package/node_modules/@aws-sdk/core/dist-types/submodules/httpAuthSchemes/aws_sdk/awsSdkSigV4AConfigSelector.d.ts +5 -0
  47. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/httpAuthSchemes/aws_sdk/AwsSdkSigV4AConfigSelector.d.ts +4 -0
  48. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/httpAuthSchemes/aws_sdk/awsSdkSigV4AConfigSelector.d.ts +4 -0
  49. package/node_modules/@aws-sdk/core/dist-types/tsdoc-metadata.json +11 -0
  50. package/node_modules/@aws-sdk/core/package.json +9 -9
  51. package/node_modules/@aws-sdk/credential-provider-env/package.json +4 -4
  52. package/node_modules/@aws-sdk/credential-provider-http/package.json +9 -9
  53. package/node_modules/@aws-sdk/credential-provider-ini/package.json +12 -12
  54. package/node_modules/@aws-sdk/credential-provider-node/package.json +12 -12
  55. package/node_modules/@aws-sdk/credential-provider-process/package.json +5 -5
  56. package/node_modules/@aws-sdk/credential-provider-sso/package.json +7 -7
  57. package/node_modules/@aws-sdk/credential-provider-web-identity/package.json +5 -5
  58. package/node_modules/@aws-sdk/middleware-host-header/package.json +4 -4
  59. package/node_modules/@aws-sdk/middleware-logger/package.json +3 -3
  60. package/node_modules/@aws-sdk/middleware-recursion-detection/package.json +4 -4
  61. package/node_modules/@aws-sdk/middleware-user-agent/dist-types/tsdoc-metadata.json +11 -0
  62. package/node_modules/@aws-sdk/middleware-user-agent/package.json +5 -5
  63. package/node_modules/@aws-sdk/region-config-resolver/dist-types/tsdoc-metadata.json +11 -0
  64. package/node_modules/@aws-sdk/region-config-resolver/package.json +5 -5
  65. package/node_modules/@aws-sdk/token-providers/package.json +6 -6
  66. package/node_modules/@aws-sdk/types/package.json +2 -2
  67. package/node_modules/@aws-sdk/util-endpoints/package.json +4 -4
  68. package/node_modules/@aws-sdk/util-user-agent-browser/package.json +3 -3
  69. package/node_modules/@aws-sdk/util-user-agent-node/package.json +4 -4
  70. package/node_modules/@smithy/abort-controller/package.json +2 -2
  71. package/node_modules/@smithy/config-resolver/package.json +4 -4
  72. package/node_modules/@smithy/core/package.json +8 -8
  73. package/node_modules/@smithy/credential-provider-imds/package.json +5 -5
  74. package/node_modules/@smithy/fetch-http-handler/package.json +5 -5
  75. package/node_modules/@smithy/hash-node/package.json +2 -2
  76. package/node_modules/@smithy/invalid-dependency/package.json +2 -2
  77. package/node_modules/@smithy/middleware-content-length/package.json +4 -4
  78. package/node_modules/@smithy/middleware-endpoint/dist-cjs/adaptors/getEndpointFromConfig.js +1 -1
  79. package/node_modules/@smithy/middleware-endpoint/dist-cjs/index.js +16 -2
  80. package/node_modules/@smithy/middleware-endpoint/dist-es/adaptors/getEndpointFromConfig.js +1 -1
  81. package/node_modules/@smithy/middleware-endpoint/dist-es/adaptors/getEndpointFromInstructions.js +7 -1
  82. package/node_modules/@smithy/middleware-endpoint/dist-es/resolveEndpointConfig.js +10 -1
  83. package/node_modules/@smithy/middleware-endpoint/dist-types/adaptors/getEndpointFromConfig.d.ts +4 -1
  84. package/node_modules/@smithy/middleware-endpoint/dist-types/resolveEndpointConfig.d.ts +11 -0
  85. package/node_modules/@smithy/middleware-endpoint/dist-types/ts3.4/adaptors/getEndpointFromConfig.d.ts +4 -1
  86. package/node_modules/@smithy/middleware-endpoint/dist-types/ts3.4/resolveEndpointConfig.d.ts +11 -0
  87. package/node_modules/@smithy/middleware-endpoint/package.json +7 -7
  88. package/node_modules/@smithy/middleware-retry/package.json +9 -9
  89. package/node_modules/@smithy/middleware-serde/package.json +3 -3
  90. package/node_modules/@smithy/middleware-stack/package.json +2 -2
  91. package/node_modules/@smithy/node-config-provider/package.json +4 -4
  92. package/node_modules/@smithy/node-http-handler/dist-cjs/index.js +86 -46
  93. package/node_modules/@smithy/node-http-handler/dist-es/node-http-handler.js +10 -10
  94. package/node_modules/@smithy/node-http-handler/dist-es/set-connection-timeout.js +27 -13
  95. package/node_modules/@smithy/node-http-handler/dist-es/set-socket-keep-alive.js +18 -5
  96. package/node_modules/@smithy/node-http-handler/dist-es/set-socket-timeout.js +12 -4
  97. package/node_modules/@smithy/node-http-handler/dist-types/set-connection-timeout.d.ts +6 -1
  98. package/node_modules/@smithy/node-http-handler/dist-types/set-socket-keep-alive.d.ts +6 -1
  99. package/node_modules/@smithy/node-http-handler/dist-types/set-socket-timeout.d.ts +6 -1
  100. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/set-connection-timeout.d.ts +2 -1
  101. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/set-socket-keep-alive.d.ts +2 -1
  102. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/set-socket-timeout.d.ts +2 -1
  103. package/node_modules/@smithy/node-http-handler/package.json +5 -5
  104. package/node_modules/@smithy/property-provider/package.json +2 -2
  105. package/node_modules/@smithy/protocol-http/package.json +2 -2
  106. package/node_modules/@smithy/querystring-builder/package.json +2 -2
  107. package/node_modules/@smithy/querystring-parser/package.json +2 -2
  108. package/node_modules/@smithy/service-error-classification/package.json +2 -2
  109. package/node_modules/@smithy/shared-ini-file-loader/package.json +2 -2
  110. package/node_modules/@smithy/signature-v4/package.json +4 -4
  111. package/node_modules/@smithy/smithy-client/dist-cjs/index.js +21 -4
  112. package/node_modules/@smithy/smithy-client/dist-es/client.js +22 -4
  113. package/node_modules/@smithy/smithy-client/dist-types/client.d.ts +22 -1
  114. package/node_modules/@smithy/smithy-client/dist-types/ts3.4/client.d.ts +22 -1
  115. package/node_modules/@smithy/smithy-client/package.json +6 -6
  116. package/node_modules/@smithy/types/README.md +36 -1
  117. package/node_modules/@smithy/types/dist-types/command.d.ts +14 -1
  118. package/node_modules/@smithy/types/dist-types/endpoint.d.ts +1 -1
  119. package/node_modules/@smithy/types/dist-types/transform/client-method-transforms.d.ts +6 -6
  120. package/node_modules/@smithy/types/dist-types/transform/client-payload-blob-type-narrow.d.ts +12 -6
  121. package/node_modules/@smithy/types/dist-types/transform/no-undefined.d.ts +8 -3
  122. package/node_modules/@smithy/types/dist-types/ts3.4/command.d.ts +14 -1
  123. package/node_modules/@smithy/types/dist-types/ts3.4/endpoint.d.ts +1 -1
  124. package/node_modules/@smithy/types/dist-types/ts3.4/transform/client-method-transforms.d.ts +6 -6
  125. package/node_modules/@smithy/types/dist-types/ts3.4/transform/client-payload-blob-type-narrow.d.ts +8 -10
  126. package/node_modules/@smithy/types/dist-types/ts3.4/transform/no-undefined.d.ts +6 -9
  127. package/node_modules/@smithy/types/package.json +1 -1
  128. package/node_modules/@smithy/url-parser/package.json +3 -3
  129. package/node_modules/@smithy/util-defaults-mode-browser/package.json +4 -4
  130. package/node_modules/@smithy/util-defaults-mode-node/package.json +7 -7
  131. package/node_modules/@smithy/util-endpoints/dist-cjs/cache/EndpointCache.js +1 -0
  132. package/node_modules/@smithy/util-endpoints/dist-cjs/index.js +73 -11
  133. package/node_modules/@smithy/util-endpoints/dist-es/cache/EndpointCache.js +49 -0
  134. package/node_modules/@smithy/util-endpoints/dist-es/index.js +1 -0
  135. package/node_modules/@smithy/util-endpoints/dist-es/resolveEndpoint.js +0 -10
  136. package/node_modules/@smithy/util-endpoints/dist-types/cache/EndpointCache.d.ts +34 -0
  137. package/node_modules/@smithy/util-endpoints/dist-types/index.d.ts +1 -0
  138. package/node_modules/@smithy/util-endpoints/dist-types/ts3.4/cache/EndpointCache.d.ts +34 -0
  139. package/node_modules/@smithy/util-endpoints/dist-types/ts3.4/index.d.ts +1 -0
  140. package/node_modules/@smithy/util-endpoints/package.json +3 -3
  141. package/node_modules/@smithy/util-middleware/package.json +2 -2
  142. package/node_modules/@smithy/util-retry/package.json +3 -3
  143. package/node_modules/@smithy/util-stream/package.json +5 -5
  144. package/node_modules/@smithy/util-waiter/package.json +3 -3
  145. package/package.json +4 -4
@@ -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
  }
@@ -10,6 +10,22 @@ export interface SmithyConfiguration<HandlerOptions> {
10
10
  * @internal
11
11
  */
12
12
  readonly apiVersion: string;
13
+ /**
14
+ * @public
15
+ *
16
+ * Default false.
17
+ *
18
+ * When true, the client will only resolve the middleware stack once per
19
+ * Command class. This means modifying the middlewareStack of the
20
+ * command or client after requests have been made will not be
21
+ * recognized.
22
+ *
23
+ * Calling client.destroy() also clears this cache.
24
+ *
25
+ * Enable this only if needing the additional time saved (0-1ms per request)
26
+ * and not needing middleware modifications between requests.
27
+ */
28
+ cacheMiddleware?: boolean;
13
29
  }
14
30
  /**
15
31
  * @internal
@@ -17,13 +33,18 @@ export interface SmithyConfiguration<HandlerOptions> {
17
33
  export type SmithyResolvedConfiguration<HandlerOptions> = {
18
34
  requestHandler: RequestHandler<any, any, HandlerOptions>;
19
35
  readonly apiVersion: string;
36
+ cacheMiddleware?: boolean;
20
37
  };
21
38
  /**
22
39
  * @public
23
40
  */
24
41
  export declare class Client<HandlerOptions, ClientInput extends object, ClientOutput extends MetadataBearer, ResolvedClientConfiguration extends SmithyResolvedConfiguration<HandlerOptions>> implements IClient<ClientInput, ClientOutput, ResolvedClientConfiguration> {
25
- middlewareStack: MiddlewareStack<ClientInput, ClientOutput>;
26
42
  readonly config: ResolvedClientConfiguration;
43
+ middlewareStack: MiddlewareStack<ClientInput, ClientOutput>;
44
+ /**
45
+ * May be used to cache the resolved handler function for a Command class.
46
+ */
47
+ private handlers?;
27
48
  constructor(config: ResolvedClientConfiguration);
28
49
  send<InputType extends ClientInput, OutputType extends ClientOutput>(command: Command<ClientInput, InputType, ClientOutput, OutputType, SmithyResolvedConfiguration<HandlerOptions>>, options?: HandlerOptions): Promise<OutputType>;
29
50
  send<InputType extends ClientInput, OutputType extends ClientOutput>(command: Command<ClientInput, InputType, ClientOutput, OutputType, SmithyResolvedConfiguration<HandlerOptions>>, cb: (err: any, data?: OutputType) => void): void;
@@ -10,6 +10,22 @@ export interface SmithyConfiguration<HandlerOptions> {
10
10
  * @internal
11
11
  */
12
12
  readonly apiVersion: string;
13
+ /**
14
+ * @public
15
+ *
16
+ * Default false.
17
+ *
18
+ * When true, the client will only resolve the middleware stack once per
19
+ * Command class. This means modifying the middlewareStack of the
20
+ * command or client after requests have been made will not be
21
+ * recognized.
22
+ *
23
+ * Calling client.destroy() also clears this cache.
24
+ *
25
+ * Enable this only if needing the additional time saved (0-1ms per request)
26
+ * and not needing middleware modifications between requests.
27
+ */
28
+ cacheMiddleware?: boolean;
13
29
  }
14
30
  /**
15
31
  * @internal
@@ -17,13 +33,18 @@ export interface SmithyConfiguration<HandlerOptions> {
17
33
  export type SmithyResolvedConfiguration<HandlerOptions> = {
18
34
  requestHandler: RequestHandler<any, any, HandlerOptions>;
19
35
  readonly apiVersion: string;
36
+ cacheMiddleware?: boolean;
20
37
  };
21
38
  /**
22
39
  * @public
23
40
  */
24
41
  export declare class Client<HandlerOptions, ClientInput extends object, ClientOutput extends MetadataBearer, ResolvedClientConfiguration extends SmithyResolvedConfiguration<HandlerOptions>> implements IClient<ClientInput, ClientOutput, ResolvedClientConfiguration> {
25
- middlewareStack: MiddlewareStack<ClientInput, ClientOutput>;
26
42
  readonly config: ResolvedClientConfiguration;
43
+ middlewareStack: MiddlewareStack<ClientInput, ClientOutput>;
44
+ /**
45
+ * May be used to cache the resolved handler function for a Command class.
46
+ */
47
+ private handlers?;
27
48
  constructor(config: ResolvedClientConfiguration);
28
49
  send<InputType extends ClientInput, OutputType extends ClientOutput>(command: Command<ClientInput, InputType, ClientOutput, OutputType, SmithyResolvedConfiguration<HandlerOptions>>, options?: HandlerOptions): Promise<OutputType>;
29
50
  send<InputType extends ClientInput, OutputType extends ClientOutput>(command: Command<ClientInput, InputType, ClientOutput, OutputType, SmithyResolvedConfiguration<HandlerOptions>>, cb: (err: any, data?: OutputType) => void): void;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smithy/smithy-client",
3
- "version": "3.2.0",
3
+ "version": "3.3.0",
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 smithy-client",
@@ -23,11 +23,11 @@
23
23
  },
24
24
  "license": "Apache-2.0",
25
25
  "dependencies": {
26
- "@smithy/middleware-endpoint": "^3.1.0",
27
- "@smithy/middleware-stack": "^3.0.3",
28
- "@smithy/protocol-http": "^4.1.0",
29
- "@smithy/types": "^3.3.0",
30
- "@smithy/util-stream": "^3.1.3",
26
+ "@smithy/middleware-endpoint": "^3.1.1",
27
+ "@smithy/middleware-stack": "^3.0.4",
28
+ "@smithy/protocol-http": "^4.1.1",
29
+ "@smithy/types": "^3.4.0",
30
+ "@smithy/util-stream": "^3.1.4",
31
31
  "tslib": "^2.6.2"
32
32
  },
33
33
  "engines": {
@@ -34,7 +34,8 @@ const s3b = new S3({}) as UncheckedClient<S3>;
34
34
  // and required outputs are not undefined.
35
35
  const get = await s3a.getObject({
36
36
  Bucket: "",
37
- Key: "",
37
+ // @ts-expect-error (undefined not assignable to string)
38
+ Key: undefined,
38
39
  });
39
40
 
40
41
  // UncheckedClient makes output fields non-nullable.
@@ -49,6 +50,40 @@ const body = await (
49
50
  ).Body.transformToString();
50
51
  ```
51
52
 
53
+ When using the transform on non-aggregated client with the `Command` syntax,
54
+ the input cannot be validated because it goes through another class.
55
+
56
+ ```ts
57
+ import { S3Client, ListBucketsCommand, GetObjectCommand, GetObjectCommandInput } from "@aws-sdk/client-s3";
58
+ import type { AssertiveClient, UncheckedClient, NoUndefined } from "@smithy/types";
59
+
60
+ const s3 = new S3Client({}) as UncheckedClient<S3Client>;
61
+
62
+ const list = await s3.send(
63
+ new ListBucketsCommand({
64
+ // command inputs are not validated by the type transform.
65
+ // because this is a separate class.
66
+ })
67
+ );
68
+
69
+ /**
70
+ * Although less ergonomic, you can use the NoUndefined<T>
71
+ * transform on the input type.
72
+ */
73
+ const getObjectInput: NoUndefined<GetObjectCommandInput> = {
74
+ Bucket: "undefined",
75
+ // @ts-expect-error (undefined not assignable to string)
76
+ Key: undefined,
77
+ // optional params can still be undefined.
78
+ SSECustomerAlgorithm: undefined,
79
+ };
80
+
81
+ const get = s3.send(new GetObjectCommand(getObjectInput));
82
+
83
+ // outputs are still transformed.
84
+ await get.Body.TransformToString();
85
+ ```
86
+
52
87
  ### Scenario: Narrowing a smithy-typescript generated client's output payload blob types
53
88
 
54
89
  This is mostly relevant to operations with streaming bodies such as within
@@ -3,8 +3,21 @@ import { MetadataBearer } from "./response";
3
3
  /**
4
4
  * @public
5
5
  */
6
- export interface Command<ClientInput extends object, InputType extends ClientInput, ClientOutput extends MetadataBearer, OutputType extends ClientOutput, ResolvedConfiguration> {
6
+ export interface Command<ClientInput extends object, InputType extends ClientInput, ClientOutput extends MetadataBearer, OutputType extends ClientOutput, ResolvedConfiguration> extends CommandIO<InputType, OutputType> {
7
7
  readonly input: InputType;
8
8
  readonly middlewareStack: MiddlewareStack<InputType, OutputType>;
9
9
  resolveMiddleware(stack: MiddlewareStack<ClientInput, ClientOutput>, configuration: ResolvedConfiguration, options: any): Handler<InputType, OutputType>;
10
10
  }
11
+ /**
12
+ * @internal
13
+ *
14
+ * This is a subset of the Command type used only to detect the i/o types.
15
+ */
16
+ export interface CommandIO<InputType extends object, OutputType extends MetadataBearer> {
17
+ readonly input: InputType;
18
+ resolveMiddleware(stack: any, configuration: any, options: any): Handler<InputType, OutputType>;
19
+ }
20
+ /**
21
+ * @internal
22
+ */
23
+ export type GetOutputType<Command> = Command extends CommandIO<any, infer O> ? O : never;
@@ -73,5 +73,5 @@ export interface EndpointV2 {
73
73
  * @public
74
74
  */
75
75
  export type EndpointParameters = {
76
- [name: string]: undefined | string | boolean;
76
+ [name: string]: undefined | boolean | string | string[];
77
77
  };
@@ -1,4 +1,4 @@
1
- import type { Command } from "../command";
1
+ import type { CommandIO } from "../command";
2
2
  import type { MetadataBearer } from "../response";
3
3
  import type { StreamingBlobPayloadOutputTypes } from "../streaming-payload/streaming-blob-payload-output-types";
4
4
  import type { Transform } from "./type-transform";
@@ -7,11 +7,11 @@ import type { Transform } from "./type-transform";
7
7
  *
8
8
  * Narrowed version of InvokeFunction used in Client::send.
9
9
  */
10
- export interface NarrowedInvokeFunction<NarrowType, HttpHandlerOptions, InputTypes extends object, OutputTypes extends MetadataBearer, ResolvedClientConfiguration> {
11
- <InputType extends InputTypes, OutputType extends OutputTypes>(command: Command<InputTypes, InputType, OutputTypes, OutputType, ResolvedClientConfiguration>, options?: HttpHandlerOptions): Promise<Transform<OutputType, StreamingBlobPayloadOutputTypes | undefined, NarrowType>>;
12
- <InputType extends InputTypes, OutputType extends OutputTypes>(command: Command<InputTypes, InputType, OutputTypes, OutputType, ResolvedClientConfiguration>, cb: (err: unknown, data?: Transform<OutputType, StreamingBlobPayloadOutputTypes | undefined, NarrowType>) => void): void;
13
- <InputType extends InputTypes, OutputType extends OutputTypes>(command: Command<InputTypes, InputType, OutputTypes, OutputType, ResolvedClientConfiguration>, options: HttpHandlerOptions, cb: (err: unknown, data?: Transform<OutputType, StreamingBlobPayloadOutputTypes | undefined, NarrowType>) => void): void;
14
- <InputType extends InputTypes, OutputType extends OutputTypes>(command: Command<InputTypes, InputType, OutputTypes, OutputType, ResolvedClientConfiguration>, options?: HttpHandlerOptions, cb?: (err: unknown, data?: Transform<OutputType, StreamingBlobPayloadOutputTypes | undefined, NarrowType>) => void): Promise<Transform<OutputType, StreamingBlobPayloadOutputTypes | undefined, NarrowType>> | void;
10
+ export interface NarrowedInvokeFunction<NarrowType, HttpHandlerOptions, InputTypes extends object, OutputTypes extends MetadataBearer> {
11
+ <InputType extends InputTypes, OutputType extends OutputTypes>(command: CommandIO<InputType, OutputType>, options?: HttpHandlerOptions): Promise<Transform<OutputType, StreamingBlobPayloadOutputTypes | undefined, NarrowType>>;
12
+ <InputType extends InputTypes, OutputType extends OutputTypes>(command: CommandIO<InputType, OutputType>, cb: (err: unknown, data?: Transform<OutputType, StreamingBlobPayloadOutputTypes | undefined, NarrowType>) => void): void;
13
+ <InputType extends InputTypes, OutputType extends OutputTypes>(command: CommandIO<InputType, OutputType>, options: HttpHandlerOptions, cb: (err: unknown, data?: Transform<OutputType, StreamingBlobPayloadOutputTypes | undefined, NarrowType>) => void): void;
14
+ <InputType extends InputTypes, OutputType extends OutputTypes>(command: CommandIO<InputType, OutputType>, options?: HttpHandlerOptions, cb?: (err: unknown, data?: Transform<OutputType, StreamingBlobPayloadOutputTypes | undefined, NarrowType>) => void): Promise<Transform<OutputType, StreamingBlobPayloadOutputTypes | undefined, NarrowType>> | void;
15
15
  }
16
16
  /**
17
17
  * @internal