@cdklabs/cdk-ecs-codedeploy 0.0.461 → 0.0.462

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 (144) 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/index.js +49 -11
  7. package/node_modules/@aws-sdk/client-codedeploy/dist-es/models/enums.js +6 -0
  8. package/node_modules/@aws-sdk/client-codedeploy/dist-es/models/errors.js +13 -0
  9. package/node_modules/@aws-sdk/client-codedeploy/dist-es/schemas/schemas_0.js +27 -11
  10. package/node_modules/@aws-sdk/client-codedeploy/dist-types/CodeDeployClient.d.ts +2 -1
  11. package/node_modules/@aws-sdk/client-codedeploy/dist-types/commands/BatchGetDeploymentGroupsCommand.d.ts +5 -0
  12. package/node_modules/@aws-sdk/client-codedeploy/dist-types/commands/BatchGetDeploymentsCommand.d.ts +5 -0
  13. package/node_modules/@aws-sdk/client-codedeploy/dist-types/commands/CreateDeploymentCommand.d.ts +11 -0
  14. package/node_modules/@aws-sdk/client-codedeploy/dist-types/commands/CreateDeploymentGroupCommand.d.ts +11 -0
  15. package/node_modules/@aws-sdk/client-codedeploy/dist-types/commands/GetDeploymentCommand.d.ts +5 -0
  16. package/node_modules/@aws-sdk/client-codedeploy/dist-types/commands/GetDeploymentGroupCommand.d.ts +5 -0
  17. package/node_modules/@aws-sdk/client-codedeploy/dist-types/commands/UpdateDeploymentGroupCommand.d.ts +11 -0
  18. package/node_modules/@aws-sdk/client-codedeploy/dist-types/models/enums.d.ts +14 -0
  19. package/node_modules/@aws-sdk/client-codedeploy/dist-types/models/errors.d.ts +16 -0
  20. package/node_modules/@aws-sdk/client-codedeploy/dist-types/models/models_0.d.ts +64 -1
  21. package/node_modules/@aws-sdk/client-codedeploy/dist-types/schemas/schemas_0.d.ts +2 -0
  22. package/node_modules/@aws-sdk/client-codedeploy/dist-types/ts3.4/models/enums.d.ts +8 -0
  23. package/node_modules/@aws-sdk/client-codedeploy/dist-types/ts3.4/models/errors.d.ts +8 -0
  24. package/node_modules/@aws-sdk/client-codedeploy/dist-types/ts3.4/models/models_0.d.ts +9 -0
  25. package/node_modules/@aws-sdk/client-codedeploy/dist-types/ts3.4/schemas/schemas_0.d.ts +2 -0
  26. package/node_modules/@aws-sdk/client-codedeploy/package.json +5 -5
  27. package/node_modules/@aws-sdk/core/dist-cjs/submodules/protocols/index.js +94 -1589
  28. package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/index.js +1 -7
  29. package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/AwsJsonRpcProtocol.js +1 -3
  30. package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/AwsRestJsonProtocol.js +1 -3
  31. package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/index.d.ts +2 -8
  32. package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/AwsJson1_0Protocol.d.ts +1 -2
  33. package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/AwsJson1_1Protocol.d.ts +1 -2
  34. package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/AwsJsonRpcProtocol.d.ts +2 -3
  35. package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/AwsRestJsonProtocol.d.ts +2 -3
  36. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/index.d.ts +10 -10
  37. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/AwsJson1_0Protocol.d.ts +1 -2
  38. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/AwsJson1_1Protocol.d.ts +1 -2
  39. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/AwsJsonRpcProtocol.d.ts +2 -3
  40. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/AwsRestJsonProtocol.d.ts +2 -3
  41. package/node_modules/@aws-sdk/core/package.json +3 -3
  42. package/node_modules/@aws-sdk/credential-provider-env/package.json +4 -4
  43. package/node_modules/@aws-sdk/credential-provider-http/package.json +4 -4
  44. package/node_modules/@aws-sdk/credential-provider-ini/package.json +11 -11
  45. package/node_modules/@aws-sdk/credential-provider-login/package.json +5 -5
  46. package/node_modules/@aws-sdk/credential-provider-node/package.json +9 -9
  47. package/node_modules/@aws-sdk/credential-provider-process/package.json +4 -4
  48. package/node_modules/@aws-sdk/credential-provider-sso/package.json +6 -6
  49. package/node_modules/@aws-sdk/credential-provider-web-identity/package.json +5 -5
  50. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/cognito-identity/index.js +1 -1
  51. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/signin/index.js +1 -1
  52. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso/index.js +1 -1
  53. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso-oidc/index.js +1 -1
  54. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/index.js +1 -1
  55. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/cognito-identity/CognitoIdentityClient.d.ts +2 -1
  56. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/signin/SigninClient.d.ts +2 -1
  57. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sso/SSOClient.d.ts +2 -1
  58. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sso-oidc/SSOOIDCClient.d.ts +2 -1
  59. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sts/STSClient.d.ts +2 -1
  60. package/node_modules/@aws-sdk/nested-clients/package.json +5 -5
  61. package/node_modules/@aws-sdk/signature-v4-multi-region/package.json +2 -2
  62. package/node_modules/@aws-sdk/token-providers/dist-cjs/index.js +37 -19
  63. package/node_modules/@aws-sdk/token-providers/dist-es/fromSso.js +37 -19
  64. package/node_modules/@aws-sdk/token-providers/package.json +5 -5
  65. package/node_modules/@aws-sdk/types/dist-types/feature-ids.d.ts +3 -0
  66. package/node_modules/@aws-sdk/types/dist-types/ts3.4/feature-ids.d.ts +3 -0
  67. package/node_modules/@aws-sdk/types/package.json +1 -1
  68. package/node_modules/@smithy/core/dist-cjs/submodules/cbor/index.js +13 -37
  69. package/node_modules/@smithy/core/dist-cjs/submodules/client/index.js +15 -2
  70. package/node_modules/@smithy/core/dist-cjs/submodules/event-streams/index.browser.js +10 -0
  71. package/node_modules/@smithy/core/dist-cjs/submodules/event-streams/index.js +10 -0
  72. package/node_modules/@smithy/core/dist-cjs/submodules/protocols/index.js +49 -34
  73. package/node_modules/@smithy/core/dist-es/submodules/cbor/SmithyRpcV2CborProtocol.js +12 -37
  74. package/node_modules/@smithy/core/dist-es/submodules/client/smithy-client/command.js +16 -2
  75. package/node_modules/@smithy/core/dist-es/submodules/event-streams/eventstream-codec/HeaderMarshaller.js +10 -0
  76. package/node_modules/@smithy/core/dist-es/submodules/protocols/AbstractRpcV2Protocol.js +35 -0
  77. package/node_modules/@smithy/core/dist-es/submodules/protocols/RpcProtocol.js +4 -1
  78. package/node_modules/@smithy/core/dist-es/submodules/protocols/index.js +1 -0
  79. package/node_modules/@smithy/core/dist-es/submodules/protocols/json/SmithyRpcV2JsonProtocol.js +8 -31
  80. package/node_modules/@smithy/core/dist-es/submodules/protocols/json/codec-v2/JsonShapeSerializer2.js +5 -5
  81. package/node_modules/@smithy/core/dist-types/submodules/cbor/SmithyRpcV2CborProtocol.d.ts +5 -14
  82. package/node_modules/@smithy/core/dist-types/submodules/protocols/AbstractRpcV2Protocol.d.ts +45 -0
  83. package/node_modules/@smithy/core/dist-types/submodules/protocols/RpcProtocol.d.ts +12 -0
  84. package/node_modules/@smithy/core/dist-types/submodules/protocols/index.d.ts +1 -0
  85. package/node_modules/@smithy/core/dist-types/submodules/protocols/json/SmithyRpcV2JsonProtocol.d.ts +5 -14
  86. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/cbor/SmithyRpcV2CborProtocol.d.ts +5 -14
  87. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/AbstractRpcV2Protocol.d.ts +45 -0
  88. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/RpcProtocol.d.ts +12 -0
  89. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/index.d.ts +1 -0
  90. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/json/SmithyRpcV2JsonProtocol.d.ts +5 -14
  91. package/node_modules/@smithy/core/package.json +1 -1
  92. package/node_modules/@smithy/node-http-handler/dist-cjs/index.js +48 -6
  93. package/node_modules/@smithy/node-http-handler/dist-es/node-http-handler.js +9 -1
  94. package/node_modules/@smithy/node-http-handler/dist-es/node-http2-handler.js +20 -2
  95. package/node_modules/@smithy/node-http-handler/dist-es/resolve-default-socket-timeout.js +4 -0
  96. package/node_modules/@smithy/node-http-handler/dist-es/set-socket-timeout.js +16 -3
  97. package/node_modules/@smithy/node-http-handler/dist-types/resolve-default-socket-timeout.d.ts +4 -0
  98. package/node_modules/@smithy/node-http-handler/dist-types/set-socket-timeout.d.ts +6 -1
  99. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/resolve-default-socket-timeout.d.ts +4 -0
  100. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/set-socket-timeout.d.ts +6 -1
  101. package/node_modules/@smithy/node-http-handler/package.json +3 -3
  102. package/package.json +2 -2
  103. package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/JsonSettings.js +0 -1
  104. package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/codec-v1/JsonCodec.js +0 -20
  105. package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/codec-v1/JsonSettings.js +0 -1
  106. package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/codec-v1/JsonShapeDeserializer.js +0 -160
  107. package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/codec-v1/JsonShapeSerializer.js +0 -193
  108. package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/codec-v2/JsonBytesStringAdapter.js +0 -103
  109. package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/codec-v2/JsonCodec2.js +0 -20
  110. package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/codec-v2/JsonShapeDeserializer2.js +0 -200
  111. package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/codec-v2/JsonShapeSerializer2.js +0 -519
  112. package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/detectBufferParsing.js +0 -18
  113. package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/jsonReplacer.js +0 -46
  114. package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/jsonReviver.js +0 -121
  115. package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/needsReviver.js +0 -41
  116. package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/parseJsonBody.js +0 -89
  117. package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/JsonSettings.d.ts +0 -7
  118. package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/codec-v1/JsonCodec.d.ts +0 -15
  119. package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/codec-v1/JsonSettings.d.ts +0 -7
  120. package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/codec-v1/JsonShapeDeserializer.d.ts +0 -14
  121. package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/codec-v1/JsonShapeSerializer.d.ts +0 -29
  122. package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/codec-v2/JsonBytesStringAdapter.d.ts +0 -51
  123. package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/codec-v2/JsonCodec2.d.ts +0 -13
  124. package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/codec-v2/JsonShapeDeserializer2.d.ts +0 -30
  125. package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/codec-v2/JsonShapeSerializer2.d.ts +0 -60
  126. package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/detectBufferParsing.d.ts +0 -1
  127. package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/jsonReplacer.d.ts +0 -21
  128. package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/jsonReviver.d.ts +0 -15
  129. package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/needsReviver.d.ts +0 -11
  130. package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/parseJsonBody.d.ts +0 -22
  131. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/JsonSettings.d.ts +0 -4
  132. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/codec-v1/JsonCodec.d.ts +0 -11
  133. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/codec-v1/JsonSettings.d.ts +0 -4
  134. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/codec-v1/JsonShapeDeserializer.d.ts +0 -13
  135. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/codec-v1/JsonShapeSerializer.d.ts +0 -18
  136. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/codec-v2/JsonBytesStringAdapter.d.ts +0 -27
  137. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/codec-v2/JsonCodec2.d.ts +0 -9
  138. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/codec-v2/JsonShapeDeserializer2.d.ts +0 -15
  139. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/codec-v2/JsonShapeSerializer2.d.ts +0 -39
  140. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/detectBufferParsing.d.ts +0 -1
  141. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/jsonReplacer.d.ts +0 -7
  142. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/jsonReviver.d.ts +0 -7
  143. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/needsReviver.d.ts +0 -2
  144. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/parseJsonBody.d.ts +0 -14
@@ -62,6 +62,7 @@ const writeSSOTokenToFile = (id, ssoToken) => {
62
62
  };
63
63
 
64
64
  const lastRefreshAttemptTimes = new Map();
65
+ const inFlightRefreshes = new Map();
65
66
  const fromSso = (init = {}) => async ({ callerClientConfig } = {}) => {
66
67
  init.logger?.debug("@aws-sdk/token-providers - fromSso");
67
68
  const profiles = await parseKnownFiles(init);
@@ -76,6 +77,10 @@ const fromSso = (init = {}) => async ({ callerClientConfig } = {}) => {
76
77
  throw new TokenProviderError(`Profile '${profileName}' is missing required property 'sso_session'.`);
77
78
  }
78
79
  const ssoSessionName = profile["sso_session"];
80
+ const inFlightRefresh = inFlightRefreshes.get(ssoSessionName);
81
+ if (inFlightRefresh) {
82
+ return await inFlightRefresh;
83
+ }
79
84
  const ssoSessions = await loadSsoSessionData(init);
80
85
  const ssoSession = ssoSessions[ssoSessionName];
81
86
  if (!ssoSession) {
@@ -105,6 +110,10 @@ const fromSso = (init = {}) => async ({ callerClientConfig } = {}) => {
105
110
  if (existingToken.expiration.getTime() - Date.now() > EXPIRE_WINDOW_MS) {
106
111
  return existingToken;
107
112
  }
113
+ const inFlightRefreshAfterReadingToken = inFlightRefreshes.get(ssoSessionName);
114
+ if (inFlightRefreshAfterReadingToken) {
115
+ return await inFlightRefreshAfterReadingToken;
116
+ }
108
117
  const lastRefreshAttemptTime = lastRefreshAttemptTimes.get(ssoSessionName) ?? 0;
109
118
  if (Date.now() - lastRefreshAttemptTime < 30 * 1000) {
110
119
  validateTokenExpiry(existingToken);
@@ -113,30 +122,39 @@ const fromSso = (init = {}) => async ({ callerClientConfig } = {}) => {
113
122
  validateTokenKey("clientId", ssoToken.clientId, true);
114
123
  validateTokenKey("clientSecret", ssoToken.clientSecret, true);
115
124
  validateTokenKey("refreshToken", ssoToken.refreshToken, true);
116
- try {
117
- lastRefreshAttemptTimes.set(ssoSessionName, Date.now());
118
- const newSsoOidcToken = await getNewSsoOidcToken(ssoToken, ssoRegion, init, callerClientConfig);
119
- validateTokenKey("accessToken", newSsoOidcToken.accessToken);
120
- validateTokenKey("expiresIn", newSsoOidcToken.expiresIn);
121
- const newTokenExpiration = new Date(Date.now() + newSsoOidcToken.expiresIn * 1000);
125
+ const refresh = (async () => {
122
126
  try {
123
- await writeSSOTokenToFile(ssoSessionName, {
124
- ...ssoToken,
125
- accessToken: newSsoOidcToken.accessToken,
126
- expiresAt: newTokenExpiration.toISOString(),
127
- refreshToken: newSsoOidcToken.refreshToken,
128
- });
127
+ lastRefreshAttemptTimes.set(ssoSessionName, Date.now());
128
+ const newSsoOidcToken = await getNewSsoOidcToken(ssoToken, ssoRegion, init, callerClientConfig);
129
+ validateTokenKey("accessToken", newSsoOidcToken.accessToken);
130
+ validateTokenKey("expiresIn", newSsoOidcToken.expiresIn);
131
+ const newTokenExpiration = new Date(Date.now() + newSsoOidcToken.expiresIn * 1000);
132
+ try {
133
+ await writeSSOTokenToFile(ssoSessionName, {
134
+ ...ssoToken,
135
+ accessToken: newSsoOidcToken.accessToken,
136
+ expiresAt: newTokenExpiration.toISOString(),
137
+ refreshToken: newSsoOidcToken.refreshToken,
138
+ });
139
+ }
140
+ catch (error) {
141
+ }
142
+ return {
143
+ token: newSsoOidcToken.accessToken,
144
+ expiration: newTokenExpiration,
145
+ };
129
146
  }
130
147
  catch (error) {
148
+ validateTokenExpiry(existingToken);
149
+ return existingToken;
131
150
  }
132
- return {
133
- token: newSsoOidcToken.accessToken,
134
- expiration: newTokenExpiration,
135
- };
151
+ })();
152
+ inFlightRefreshes.set(ssoSessionName, refresh);
153
+ try {
154
+ return await refresh;
136
155
  }
137
- catch (error) {
138
- validateTokenExpiry(existingToken);
139
- return existingToken;
156
+ finally {
157
+ inFlightRefreshes.delete(ssoSessionName);
140
158
  }
141
159
  };
142
160
 
@@ -5,6 +5,7 @@ import { validateTokenExpiry } from "./validateTokenExpiry";
5
5
  import { validateTokenKey } from "./validateTokenKey";
6
6
  import { writeSSOTokenToFile } from "./writeSSOTokenToFile";
7
7
  const lastRefreshAttemptTimes = new Map();
8
+ const inFlightRefreshes = new Map();
8
9
  export const fromSso = (init = {}) => async ({ callerClientConfig } = {}) => {
9
10
  init.logger?.debug("@aws-sdk/token-providers - fromSso");
10
11
  const profiles = await parseKnownFiles(init);
@@ -19,6 +20,10 @@ export const fromSso = (init = {}) => async ({ callerClientConfig } = {}) => {
19
20
  throw new TokenProviderError(`Profile '${profileName}' is missing required property 'sso_session'.`);
20
21
  }
21
22
  const ssoSessionName = profile["sso_session"];
23
+ const inFlightRefresh = inFlightRefreshes.get(ssoSessionName);
24
+ if (inFlightRefresh) {
25
+ return await inFlightRefresh;
26
+ }
22
27
  const ssoSessions = await loadSsoSessionData(init);
23
28
  const ssoSession = ssoSessions[ssoSessionName];
24
29
  if (!ssoSession) {
@@ -48,6 +53,10 @@ export const fromSso = (init = {}) => async ({ callerClientConfig } = {}) => {
48
53
  if (existingToken.expiration.getTime() - Date.now() > EXPIRE_WINDOW_MS) {
49
54
  return existingToken;
50
55
  }
56
+ const inFlightRefreshAfterReadingToken = inFlightRefreshes.get(ssoSessionName);
57
+ if (inFlightRefreshAfterReadingToken) {
58
+ return await inFlightRefreshAfterReadingToken;
59
+ }
51
60
  const lastRefreshAttemptTime = lastRefreshAttemptTimes.get(ssoSessionName) ?? 0;
52
61
  if (Date.now() - lastRefreshAttemptTime < 30 * 1000) {
53
62
  validateTokenExpiry(existingToken);
@@ -56,29 +65,38 @@ export const fromSso = (init = {}) => async ({ callerClientConfig } = {}) => {
56
65
  validateTokenKey("clientId", ssoToken.clientId, true);
57
66
  validateTokenKey("clientSecret", ssoToken.clientSecret, true);
58
67
  validateTokenKey("refreshToken", ssoToken.refreshToken, true);
59
- try {
60
- lastRefreshAttemptTimes.set(ssoSessionName, Date.now());
61
- const newSsoOidcToken = await getNewSsoOidcToken(ssoToken, ssoRegion, init, callerClientConfig);
62
- validateTokenKey("accessToken", newSsoOidcToken.accessToken);
63
- validateTokenKey("expiresIn", newSsoOidcToken.expiresIn);
64
- const newTokenExpiration = new Date(Date.now() + newSsoOidcToken.expiresIn * 1000);
68
+ const refresh = (async () => {
65
69
  try {
66
- await writeSSOTokenToFile(ssoSessionName, {
67
- ...ssoToken,
68
- accessToken: newSsoOidcToken.accessToken,
69
- expiresAt: newTokenExpiration.toISOString(),
70
- refreshToken: newSsoOidcToken.refreshToken,
71
- });
70
+ lastRefreshAttemptTimes.set(ssoSessionName, Date.now());
71
+ const newSsoOidcToken = await getNewSsoOidcToken(ssoToken, ssoRegion, init, callerClientConfig);
72
+ validateTokenKey("accessToken", newSsoOidcToken.accessToken);
73
+ validateTokenKey("expiresIn", newSsoOidcToken.expiresIn);
74
+ const newTokenExpiration = new Date(Date.now() + newSsoOidcToken.expiresIn * 1000);
75
+ try {
76
+ await writeSSOTokenToFile(ssoSessionName, {
77
+ ...ssoToken,
78
+ accessToken: newSsoOidcToken.accessToken,
79
+ expiresAt: newTokenExpiration.toISOString(),
80
+ refreshToken: newSsoOidcToken.refreshToken,
81
+ });
82
+ }
83
+ catch (error) {
84
+ }
85
+ return {
86
+ token: newSsoOidcToken.accessToken,
87
+ expiration: newTokenExpiration,
88
+ };
72
89
  }
73
90
  catch (error) {
91
+ validateTokenExpiry(existingToken);
92
+ return existingToken;
74
93
  }
75
- return {
76
- token: newSsoOidcToken.accessToken,
77
- expiration: newTokenExpiration,
78
- };
94
+ })();
95
+ inFlightRefreshes.set(ssoSessionName, refresh);
96
+ try {
97
+ return await refresh;
79
98
  }
80
- catch (error) {
81
- validateTokenExpiry(existingToken);
82
- return existingToken;
99
+ finally {
100
+ inFlightRefreshes.delete(ssoSessionName);
83
101
  }
84
102
  };
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-sdk/token-providers",
3
- "version": "3.1150.0",
3
+ "version": "3.1155.0",
4
4
  "description": "A collection of token providers",
5
5
  "keywords": [
6
6
  "aws",
@@ -48,10 +48,10 @@
48
48
  "test:integration:watch": "yarn g:vitest watch -c vitest.config.integ.mts"
49
49
  },
50
50
  "dependencies": {
51
- "@aws-sdk/core": "^3.978.3",
52
- "@aws-sdk/nested-clients": "^3.997.48",
53
- "@aws-sdk/types": "^3.974.6",
54
- "@smithy/core": "^3.35.2",
51
+ "@aws-sdk/core": "^3.978.5",
52
+ "@aws-sdk/nested-clients": "^3.997.50",
53
+ "@aws-sdk/types": "^3.975.0",
54
+ "@smithy/core": "^3.36.1",
55
55
  "@smithy/types": "^4.19.0",
56
56
  "tslib": "^2.6.2"
57
57
  },
@@ -8,6 +8,9 @@ export type AwsSdkFeatures = Partial<{
8
8
  RETRY_MODE_LEGACY: "D";
9
9
  RETRY_MODE_STANDARD: "E";
10
10
  RETRY_MODE_ADAPTIVE: "F";
11
+ S3_TRANSFER: "G";
12
+ S3_TRANSFER_UPLOAD_DIRECTORY: "9";
13
+ S3_TRANSFER_DOWNLOAD_DIRECTORY: "+";
11
14
  S3_EXPRESS_BUCKET: "J";
12
15
  S3_ACCESS_GRANTS: "K";
13
16
  GZIP_REQUEST_COMPRESSION: "L";
@@ -5,6 +5,9 @@ export type AwsSdkFeatures = Partial<{
5
5
  RETRY_MODE_LEGACY: "D";
6
6
  RETRY_MODE_STANDARD: "E";
7
7
  RETRY_MODE_ADAPTIVE: "F";
8
+ S3_TRANSFER: "G";
9
+ S3_TRANSFER_UPLOAD_DIRECTORY: "9";
10
+ S3_TRANSFER_DOWNLOAD_DIRECTORY: "+";
8
11
  S3_EXPRESS_BUCKET: "J";
9
12
  S3_ACCESS_GRANTS: "K";
10
13
  GZIP_REQUEST_COMPRESSION: "L";
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-sdk/types",
3
- "version": "3.974.6",
3
+ "version": "3.975.0",
4
4
  "description": "Types for the AWS SDK",
5
5
  "homepage": "https://github.com/aws/aws-sdk-js-v3/tree/main/packages-internal/types",
6
6
  "license": "Apache-2.0",
@@ -1,7 +1,7 @@
1
1
  const { nv, NumericValue, calculateBodyLength, generateIdempotencyToken, fromBase64, _parseEpochTimestamp } = require("@smithy/core/serde");
2
- const { hasOwn, getSmithyContext } = require("@smithy/core/transport");
3
- const { HttpRequest, collectBody, SerdeContext, RpcProtocol } = require("@smithy/core/protocols");
4
- const { NormalizedSchema, deref, TypeRegistry } = require("@smithy/core/schema");
2
+ const { hasOwn } = require("@smithy/core/transport");
3
+ const { HttpRequest, collectBody, SerdeContext, AbstractRpcV2Protocol } = require("@smithy/core/protocols");
4
+ const { NormalizedSchema, TypeRegistry } = require("@smithy/core/schema");
5
5
 
6
6
  const majorUint64 = 0;
7
7
  const majorNegativeInt64 = 1;
@@ -2216,51 +2216,27 @@ class CborCodec extends SerdeContext {
2216
2216
  }
2217
2217
  }
2218
2218
 
2219
- class SmithyRpcV2CborProtocol extends RpcProtocol {
2219
+ class SmithyRpcV2CborProtocol extends AbstractRpcV2Protocol {
2220
2220
  codec = new CborCodec();
2221
2221
  serializer = this.codec.createSerializer();
2222
2222
  deserializer = this.codec.createDeserializer();
2223
- constructor({ defaultNamespace, errorTypeRegistries, }) {
2224
- super({ defaultNamespace, errorTypeRegistries });
2225
- }
2226
2223
  getShapeId() {
2227
2224
  return "smithy.protocols#rpcv2Cbor";
2228
2225
  }
2229
2226
  getPayloadCodec() {
2230
2227
  return this.codec;
2231
2228
  }
2232
- async serializeRequest(operationSchema, input, context) {
2233
- const request = await super.serializeRequest(operationSchema, input, context);
2234
- Object.assign(request.headers, {
2235
- "content-type": this.getDefaultContentType(),
2236
- "smithy-protocol": "rpc-v2-cbor",
2237
- accept: this.getDefaultContentType(),
2238
- });
2239
- if (deref(operationSchema.input) === "unit") {
2240
- delete request.body;
2241
- delete request.headers["content-type"];
2242
- }
2243
- else {
2244
- if (!request.body) {
2245
- this.serializer.write(15, {});
2246
- request.body = this.serializer.flush();
2247
- }
2248
- if (request.body instanceof Uint8Array) {
2249
- request.headers["content-length"] = String(request.body.byteLength);
2250
- }
2251
- }
2252
- const { service, operation } = getSmithyContext(context);
2253
- const path = `/service/${service}/operation/${operation}`;
2254
- if (request.path.endsWith("/")) {
2255
- request.path += path.slice(1);
2229
+ getSmithyProtocolHeaderValue() {
2230
+ return "rpc-v2-cbor";
2231
+ }
2232
+ applyEmptyBody(request) {
2233
+ if (!request.body) {
2234
+ this.serializer.write(15, {});
2235
+ request.body = this.serializer.flush();
2256
2236
  }
2257
- else {
2258
- request.path += path;
2237
+ if (request.body instanceof Uint8Array) {
2238
+ request.headers["content-length"] = String(request.body.byteLength);
2259
2239
  }
2260
- return request;
2261
- }
2262
- async deserializeResponse(operationSchema, context, response) {
2263
- return super.deserializeResponse(operationSchema, context, response);
2264
2240
  }
2265
2241
  async handleError(operationSchema, context, response, dataObject, metadata) {
2266
2242
  const errorIdentifier = loadSmithyRpcV2CborErrorCode(response, dataObject) ?? "Unknown";
@@ -578,6 +578,7 @@ function schemaLogFilter(schema, data) {
578
578
  return data;
579
579
  }
580
580
 
581
+ const operationEventStreamMarker = Symbol.for("@smithy/op-event-stream");
581
582
  class Command {
582
583
  middlewareStack = constructStack();
583
584
  schema;
@@ -611,9 +612,21 @@ class Command {
611
612
  requestOptions = { ...requestOptions };
612
613
  delete requestOptions.metricsRecorder;
613
614
  }
614
- if (smithyContext.eventStream) {
615
+ let isEventStream;
616
+ const schema = this.schema;
617
+ const marker = schema?.[operationEventStreamMarker];
618
+ if (marker !== undefined) {
619
+ isEventStream = marker;
620
+ }
621
+ else if (schema) {
622
+ if (Array.isArray(schema) && schema[0] === 9) {
623
+ const [, , , , input$, output$] = schema;
624
+ isEventStream = schema[operationEventStreamMarker] = Boolean(NormalizedSchema.of(input$).getEventStreamMember() || NormalizedSchema.of(output$).getEventStreamMember());
625
+ }
626
+ }
627
+ if (isEventStream) {
615
628
  requestOptions = {
616
- isEventStream: true,
629
+ isEventStream,
617
630
  ...requestOptions,
618
631
  };
619
632
  }
@@ -60,6 +60,9 @@ class HeaderMarshaller {
60
60
  if (!hasOwn(headers, headerName))
61
61
  continue;
62
62
  const bytes = this.fromUtf8(headerName);
63
+ if (bytes.byteLength > 255) {
64
+ throw new Error(`@smithy/core/event-streams - header name exceeds 255 bytes: ${bytes.byteLength}`);
65
+ }
63
66
  chunks.push(Uint8Array.from([bytes.byteLength]), bytes, this.formatHeaderValue(headers[headerName]));
64
67
  }
65
68
  const out = new Uint8Array(chunks.reduce((carry, bytes) => carry + bytes.byteLength, 0));
@@ -92,6 +95,9 @@ class HeaderMarshaller {
92
95
  longBytes.set(header.value.bytes, 1);
93
96
  return longBytes;
94
97
  case "binary":
98
+ if (header.value.byteLength > MAX_HEADER_VALUE_BYTES) {
99
+ throw new Error(`@smithy/core/event-streams - header value (binary) exceeds ${MAX_HEADER_VALUE_BYTES} bytes: ${header.value.byteLength}`);
100
+ }
95
101
  const binView = new DataView(new ArrayBuffer(3 + header.value.byteLength));
96
102
  binView.setUint8(0, 6);
97
103
  binView.setUint16(1, header.value.byteLength, false);
@@ -100,6 +106,9 @@ class HeaderMarshaller {
100
106
  return binBytes;
101
107
  case "string":
102
108
  const utf8Bytes = this.fromUtf8(header.value);
109
+ if (utf8Bytes.byteLength > MAX_HEADER_VALUE_BYTES) {
110
+ throw new Error(`@smithy/core/event-streams - header value (string) exceeds ${MAX_HEADER_VALUE_BYTES} bytes: ${utf8Bytes.byteLength}`);
111
+ }
103
112
  const strView = new DataView(new ArrayBuffer(3 + utf8Bytes.byteLength));
104
113
  strView.setUint8(0, 7);
105
114
  strView.setUint16(1, utf8Bytes.byteLength, false);
@@ -231,6 +240,7 @@ const STRING_TAG = "string";
231
240
  const TIMESTAMP_TAG = "timestamp";
232
241
  const UUID_TAG = "uuid";
233
242
  const UUID_PATTERN = /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;
243
+ const MAX_HEADER_VALUE_BYTES = 32767;
234
244
 
235
245
  const PRELUDE_MEMBER_LENGTH = 4;
236
246
  const PRELUDE_LENGTH = PRELUDE_MEMBER_LENGTH * 2;
@@ -61,6 +61,9 @@ class HeaderMarshaller {
61
61
  if (!hasOwn(headers, headerName))
62
62
  continue;
63
63
  const bytes = this.fromUtf8(headerName);
64
+ if (bytes.byteLength > 255) {
65
+ throw new Error(`@smithy/core/event-streams - header name exceeds 255 bytes: ${bytes.byteLength}`);
66
+ }
64
67
  chunks.push(Uint8Array.from([bytes.byteLength]), bytes, this.formatHeaderValue(headers[headerName]));
65
68
  }
66
69
  const out = new Uint8Array(chunks.reduce((carry, bytes) => carry + bytes.byteLength, 0));
@@ -93,6 +96,9 @@ class HeaderMarshaller {
93
96
  longBytes.set(header.value.bytes, 1);
94
97
  return longBytes;
95
98
  case "binary":
99
+ if (header.value.byteLength > MAX_HEADER_VALUE_BYTES) {
100
+ throw new Error(`@smithy/core/event-streams - header value (binary) exceeds ${MAX_HEADER_VALUE_BYTES} bytes: ${header.value.byteLength}`);
101
+ }
96
102
  const binView = new DataView(new ArrayBuffer(3 + header.value.byteLength));
97
103
  binView.setUint8(0, 6);
98
104
  binView.setUint16(1, header.value.byteLength, false);
@@ -101,6 +107,9 @@ class HeaderMarshaller {
101
107
  return binBytes;
102
108
  case "string":
103
109
  const utf8Bytes = this.fromUtf8(header.value);
110
+ if (utf8Bytes.byteLength > MAX_HEADER_VALUE_BYTES) {
111
+ throw new Error(`@smithy/core/event-streams - header value (string) exceeds ${MAX_HEADER_VALUE_BYTES} bytes: ${utf8Bytes.byteLength}`);
112
+ }
104
113
  const strView = new DataView(new ArrayBuffer(3 + utf8Bytes.byteLength));
105
114
  strView.setUint8(0, 7);
106
115
  strView.setUint16(1, utf8Bytes.byteLength, false);
@@ -232,6 +241,7 @@ const STRING_TAG = "string";
232
241
  const TIMESTAMP_TAG = "timestamp";
233
242
  const UUID_TAG = "uuid";
234
243
  const UUID_PATTERN = /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;
244
+ const MAX_HEADER_VALUE_BYTES = 32767;
235
245
 
236
246
  const PRELUDE_MEMBER_LENGTH = 4;
237
247
  const PRELUDE_LENGTH = PRELUDE_MEMBER_LENGTH * 2;
@@ -574,7 +574,7 @@ class RpcProtocol extends HttpProtocol {
574
574
  const deserializer = this.deserializer;
575
575
  const ns = NormalizedSchema.of(operationSchema.output);
576
576
  const dataObject = {};
577
- if (response.statusCode >= 300) {
577
+ if (this.isErrorResponse(response.statusCode)) {
578
578
  const bytes = await collectBody(response.body, context);
579
579
  if (bytes.byteLength > 0) {
580
580
  Object.assign(dataObject, await deserializer.read(15, bytes));
@@ -606,6 +606,42 @@ class RpcProtocol extends HttpProtocol {
606
606
  dataObject.$metadata = this.deserializeMetadata(response);
607
607
  return dataObject;
608
608
  }
609
+ isErrorResponse(statusCode) {
610
+ return statusCode >= 300;
611
+ }
612
+ }
613
+
614
+ class AbstractRpcV2Protocol extends RpcProtocol {
615
+ constructor({ defaultNamespace, errorTypeRegistries, }) {
616
+ super({ defaultNamespace, errorTypeRegistries });
617
+ }
618
+ async serializeRequest(operationSchema, input, context) {
619
+ const request = await super.serializeRequest(operationSchema, input, context);
620
+ Object.assign(request.headers, {
621
+ "content-type": this.getDefaultContentType(),
622
+ "smithy-protocol": this.getSmithyProtocolHeaderValue(),
623
+ accept: this.getDefaultContentType(),
624
+ });
625
+ if (deref(operationSchema.input) === "unit") {
626
+ delete request.body;
627
+ delete request.headers["content-type"];
628
+ }
629
+ else {
630
+ this.applyEmptyBody(request);
631
+ }
632
+ const { service, operation } = getSmithyContext(context);
633
+ const path = `/service/${service}/operation/${operation}`;
634
+ if (request.path.endsWith("/")) {
635
+ request.path += path.slice(1);
636
+ }
637
+ else {
638
+ request.path += path;
639
+ }
640
+ return request;
641
+ }
642
+ isErrorResponse(statusCode) {
643
+ return statusCode !== 200;
644
+ }
609
645
  }
610
646
 
611
647
  const resolvedPath = (resolvedPath, input, memberName, labelValueProvider, uriLabel, isGreedyLabel) => {
@@ -1812,9 +1848,9 @@ class JsonShapeSerializer2 extends SerdeContextConfig {
1812
1848
  this.i = i;
1813
1849
  }
1814
1850
  writeJsonString(s) {
1815
- this.ensure(s.length * 3 + 2);
1816
- this.json[this.i++] = QUOTE;
1817
1851
  const z = s.length;
1852
+ this.ensure(z * 3 + 2);
1853
+ this.json[this.i++] = QUOTE;
1818
1854
  for (let j = 0; j < z; ++j) {
1819
1855
  const c = s.charCodeAt(j);
1820
1856
  if (c > 0x22 && c < 0x5c) {
@@ -1823,7 +1859,7 @@ class JsonShapeSerializer2 extends SerdeContextConfig {
1823
1859
  else if (c < 0x80) {
1824
1860
  const esc = ESCAPE_TABLE[c];
1825
1861
  if (esc !== null) {
1826
- this.ensure(esc.length + 1);
1862
+ this.ensure(esc.length + 1 + (z - j - 1) * 3 + 1);
1827
1863
  this.json[this.i++] = BACKSLASH;
1828
1864
  for (let k = 0; k < esc.length; k++) {
1829
1865
  this.json[this.i++] = esc.charCodeAt(k);
@@ -1842,12 +1878,12 @@ class JsonShapeSerializer2 extends SerdeContextConfig {
1842
1878
  ++j;
1843
1879
  }
1844
1880
  else {
1845
- this.ensure(6);
1881
+ this.ensure(6 + (z - j - 1) * 3 + 1);
1846
1882
  this.writeUnicodeEscape(c);
1847
1883
  }
1848
1884
  }
1849
1885
  else if (c >= 0xdc00 && c <= 0xdfff) {
1850
- this.ensure(6);
1886
+ this.ensure(6 + (z - j - 1) * 3 + 1);
1851
1887
  this.writeUnicodeEscape(c);
1852
1888
  }
1853
1889
  else {
@@ -2240,7 +2276,7 @@ class JsonCodec2 extends SerdeContextConfig {
2240
2276
  }
2241
2277
  }
2242
2278
 
2243
- class SmithyRpcV2JsonProtocol extends RpcProtocol {
2279
+ class SmithyRpcV2JsonProtocol extends AbstractRpcV2Protocol {
2244
2280
  codec = new JsonCodec2({
2245
2281
  timestampFormat: {
2246
2282
  useTrait: false,
@@ -2251,41 +2287,19 @@ class SmithyRpcV2JsonProtocol extends RpcProtocol {
2251
2287
  });
2252
2288
  serializer = this.codec.createSerializer();
2253
2289
  deserializer = this.codec.createDeserializer();
2254
- constructor({ defaultNamespace, errorTypeRegistries, }) {
2255
- super({ defaultNamespace, errorTypeRegistries });
2256
- }
2257
2290
  getShapeId() {
2258
2291
  return "smithy.protocols#rpcv2Json";
2259
2292
  }
2260
2293
  getPayloadCodec() {
2261
2294
  return this.codec;
2262
2295
  }
2263
- async serializeRequest(operationSchema, input, context) {
2264
- const request = await super.serializeRequest(operationSchema, input, context);
2265
- Object.assign(request.headers, {
2266
- "content-type": this.getDefaultContentType(),
2267
- "smithy-protocol": "rpc-v2-json",
2268
- accept: this.getDefaultContentType(),
2269
- });
2270
- if (deref(operationSchema.input) === "unit") {
2271
- delete request.body;
2272
- delete request.headers["content-type"];
2273
- }
2274
- else if (!request.body) {
2296
+ getSmithyProtocolHeaderValue() {
2297
+ return "rpc-v2-json";
2298
+ }
2299
+ applyEmptyBody(request) {
2300
+ if (!request.body) {
2275
2301
  request.body = "{}";
2276
2302
  }
2277
- const { service, operation } = getSmithyContext(context);
2278
- const path = `/service/${service}/operation/${operation}`;
2279
- if (request.path.endsWith("/")) {
2280
- request.path += path.slice(1);
2281
- }
2282
- else {
2283
- request.path += path;
2284
- }
2285
- return request;
2286
- }
2287
- async deserializeResponse(operationSchema, context, response) {
2288
- return super.deserializeResponse(operationSchema, context, response);
2289
2303
  }
2290
2304
  async handleError(operationSchema, context, response, dataObject, metadata) {
2291
2305
  const errorName = loadSmithyRpcV2JsonErrorCode(response, dataObject) ?? "Unknown";
@@ -2753,6 +2767,7 @@ class JsonCodec extends SerdeContextConfig {
2753
2767
  }
2754
2768
  }
2755
2769
 
2770
+ exports.AbstractRpcV2Protocol = AbstractRpcV2Protocol;
2756
2771
  exports.Field = Field;
2757
2772
  exports.Fields = Fields;
2758
2773
  exports.FromStringShapeDeserializer = FromStringShapeDeserializer;
@@ -1,53 +1,28 @@
1
- import { RpcProtocol } from "@smithy/core/protocols";
2
- import { NormalizedSchema, TypeRegistry, deref } from "@smithy/core/schema";
3
- import { getSmithyContext } from "@smithy/core/transport";
1
+ import { AbstractRpcV2Protocol } from "@smithy/core/protocols";
2
+ import { NormalizedSchema, TypeRegistry } from "@smithy/core/schema";
4
3
  import { CborCodec } from "./CborCodec";
5
4
  import { loadSmithyRpcV2CborErrorCode } from "./parseCborBody";
6
- export class SmithyRpcV2CborProtocol extends RpcProtocol {
5
+ export class SmithyRpcV2CborProtocol extends AbstractRpcV2Protocol {
7
6
  codec = new CborCodec();
8
7
  serializer = this.codec.createSerializer();
9
8
  deserializer = this.codec.createDeserializer();
10
- constructor({ defaultNamespace, errorTypeRegistries, }) {
11
- super({ defaultNamespace, errorTypeRegistries });
12
- }
13
9
  getShapeId() {
14
10
  return "smithy.protocols#rpcv2Cbor";
15
11
  }
16
12
  getPayloadCodec() {
17
13
  return this.codec;
18
14
  }
19
- async serializeRequest(operationSchema, input, context) {
20
- const request = await super.serializeRequest(operationSchema, input, context);
21
- Object.assign(request.headers, {
22
- "content-type": this.getDefaultContentType(),
23
- "smithy-protocol": "rpc-v2-cbor",
24
- accept: this.getDefaultContentType(),
25
- });
26
- if (deref(operationSchema.input) === "unit") {
27
- delete request.body;
28
- delete request.headers["content-type"];
29
- }
30
- else {
31
- if (!request.body) {
32
- this.serializer.write(15, {});
33
- request.body = this.serializer.flush();
34
- }
35
- if (request.body instanceof Uint8Array) {
36
- request.headers["content-length"] = String(request.body.byteLength);
37
- }
38
- }
39
- const { service, operation } = getSmithyContext(context);
40
- const path = `/service/${service}/operation/${operation}`;
41
- if (request.path.endsWith("/")) {
42
- request.path += path.slice(1);
15
+ getSmithyProtocolHeaderValue() {
16
+ return "rpc-v2-cbor";
17
+ }
18
+ applyEmptyBody(request) {
19
+ if (!request.body) {
20
+ this.serializer.write(15, {});
21
+ request.body = this.serializer.flush();
43
22
  }
44
- else {
45
- request.path += path;
23
+ if (request.body instanceof Uint8Array) {
24
+ request.headers["content-length"] = String(request.body.byteLength);
46
25
  }
47
- return request;
48
- }
49
- async deserializeResponse(operationSchema, context, response) {
50
- return super.deserializeResponse(operationSchema, context, response);
51
26
  }
52
27
  async handleError(operationSchema, context, response, dataObject, metadata) {
53
28
  const errorIdentifier = loadSmithyRpcV2CborErrorCode(response, dataObject) ?? "Unknown";
@@ -1,6 +1,8 @@
1
1
  import { SMITHY_CONTEXT_KEY, } from "@smithy/types";
2
2
  import { constructStack } from "../middleware-stack/MiddlewareStack";
3
3
  import { schemaLogFilter } from "./schemaLogFilter";
4
+ import { NormalizedSchema } from "@smithy/core/schema";
5
+ const operationEventStreamMarker = Symbol.for("@smithy/op-event-stream");
4
6
  export class Command {
5
7
  middlewareStack = constructStack();
6
8
  schema;
@@ -34,9 +36,21 @@ export class Command {
34
36
  requestOptions = { ...requestOptions };
35
37
  delete requestOptions.metricsRecorder;
36
38
  }
37
- if (smithyContext.eventStream) {
39
+ let isEventStream;
40
+ const schema = this.schema;
41
+ const marker = schema?.[operationEventStreamMarker];
42
+ if (marker !== undefined) {
43
+ isEventStream = marker;
44
+ }
45
+ else if (schema) {
46
+ if (Array.isArray(schema) && schema[0] === 9) {
47
+ const [, , , , input$, output$] = schema;
48
+ isEventStream = schema[operationEventStreamMarker] = Boolean(NormalizedSchema.of(input$).getEventStreamMember() || NormalizedSchema.of(output$).getEventStreamMember());
49
+ }
50
+ }
51
+ if (isEventStream) {
38
52
  requestOptions = {
39
- isEventStream: true,
53
+ isEventStream,
40
54
  ...requestOptions,
41
55
  };
42
56
  }