@rio-cloud/cdk-v2-constructs 7.14.0-alpha.2 → 7.14.1

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 (308) hide show
  1. package/.jsii +7 -7
  2. package/lib/contributions/team-transport-two/datadog-synthetics/datadog-synthetics-test-custom-resource/handler.cjs +2195 -1273
  3. package/lib/datadogv2/secret-locator-custom-resource/on-create.cjs +2363 -1441
  4. package/lib/datadogv2/service-catalog-custom-resource/on-create.cjs +2234 -1312
  5. package/lib/fargate/codedeploy-custom-resources/create-deployment-is-complete.cjs +2237 -1315
  6. package/lib/fargate/codedeploy-custom-resources/create-deployment-on-create.cjs +2237 -1315
  7. package/lib/fargate/codedeploy-custom-resources/run-monitoring-test-suite-runner.cjs +2242 -1319
  8. package/lib/fargate/datadog.js +3 -1
  9. package/node_modules/@aws-sdk/client-cloudformation/README.md +26 -46
  10. package/node_modules/@aws-sdk/client-cloudformation/node_modules/@smithy/util-retry/package.json +3 -3
  11. package/node_modules/@aws-sdk/client-cloudformation/package.json +39 -39
  12. package/node_modules/@aws-sdk/client-codedeploy/README.md +26 -46
  13. package/node_modules/@aws-sdk/client-codedeploy/node_modules/@smithy/util-retry/package.json +3 -3
  14. package/node_modules/@aws-sdk/client-codedeploy/package.json +39 -39
  15. package/node_modules/@aws-sdk/client-ecs/README.md +26 -46
  16. package/node_modules/@aws-sdk/client-ecs/dist-cjs/schemas/schemas_0.js +5 -4
  17. package/node_modules/@aws-sdk/client-ecs/dist-es/schemas/schemas_0.js +5 -4
  18. package/node_modules/@aws-sdk/client-ecs/dist-types/commands/CreateCapacityProviderCommand.d.ts +2 -0
  19. package/node_modules/@aws-sdk/client-ecs/dist-types/commands/DeleteCapacityProviderCommand.d.ts +1 -0
  20. package/node_modules/@aws-sdk/client-ecs/dist-types/commands/DescribeCapacityProvidersCommand.d.ts +1 -0
  21. package/node_modules/@aws-sdk/client-ecs/dist-types/commands/UpdateCapacityProviderCommand.d.ts +2 -0
  22. package/node_modules/@aws-sdk/client-ecs/dist-types/models/models_0.d.ts +10 -0
  23. package/node_modules/@aws-sdk/client-ecs/dist-types/ts3.4/models/models_0.d.ts +2 -0
  24. package/node_modules/@aws-sdk/client-ecs/node_modules/@smithy/util-retry/package.json +3 -3
  25. package/node_modules/@aws-sdk/client-ecs/package.json +39 -39
  26. package/node_modules/@aws-sdk/client-organizations/README.md +26 -46
  27. package/node_modules/@aws-sdk/client-organizations/node_modules/@smithy/util-retry/package.json +3 -3
  28. package/node_modules/@aws-sdk/client-organizations/package.json +38 -38
  29. package/node_modules/@aws-sdk/client-secrets-manager/README.md +26 -46
  30. package/node_modules/@aws-sdk/client-secrets-manager/node_modules/@smithy/util-retry/package.json +3 -3
  31. package/node_modules/@aws-sdk/client-secrets-manager/package.json +39 -39
  32. package/node_modules/@aws-sdk/client-ssm/README.md +26 -46
  33. package/node_modules/@aws-sdk/client-ssm/node_modules/@smithy/util-retry/package.json +3 -3
  34. package/node_modules/@aws-sdk/client-ssm/package.json +39 -39
  35. package/node_modules/@aws-sdk/core/dist-cjs/index.js +58 -21
  36. package/node_modules/@aws-sdk/core/dist-cjs/submodules/protocols/index.js +58 -21
  37. package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/ProtocolLib.js +24 -6
  38. package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/cbor/AwsSmithyRpcV2CborProtocol.js +6 -5
  39. package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/index.js +2 -0
  40. package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/AwsJson1_0Protocol.js +2 -1
  41. package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/AwsJson1_1Protocol.js +2 -1
  42. package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/AwsJsonRpcProtocol.js +6 -4
  43. package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/AwsRestJsonProtocol.js +6 -4
  44. package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/query/AwsEc2QueryProtocol.js +3 -0
  45. package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/query/AwsQueryProtocol.js +4 -2
  46. package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/xml/AwsRestXmlProtocol.js +9 -3
  47. package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/ProtocolLib.d.ts +13 -0
  48. package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/cbor/AwsSmithyRpcV2CborProtocol.d.ts +3 -1
  49. package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/index.d.ts +2 -0
  50. package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/AwsJson1_0Protocol.d.ts +3 -1
  51. package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/AwsJson1_1Protocol.d.ts +3 -1
  52. package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/AwsJsonRpcProtocol.d.ts +3 -1
  53. package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/AwsRestJsonProtocol.d.ts +3 -1
  54. package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/query/AwsEc2QueryProtocol.d.ts +7 -0
  55. package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/query/AwsQueryProtocol.d.ts +3 -0
  56. package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/query/QuerySerializerSettings.d.ts +3 -0
  57. package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/xml/AwsRestXmlProtocol.d.ts +2 -0
  58. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/ProtocolLib.d.ts +6 -0
  59. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/cbor/AwsSmithyRpcV2CborProtocol.d.ts +3 -0
  60. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/index.d.ts +2 -0
  61. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/AwsJson1_0Protocol.d.ts +3 -0
  62. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/AwsJson1_1Protocol.d.ts +3 -0
  63. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/AwsJsonRpcProtocol.d.ts +3 -0
  64. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/AwsRestJsonProtocol.d.ts +8 -1
  65. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/query/AwsEc2QueryProtocol.d.ts +4 -0
  66. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/query/AwsQueryProtocol.d.ts +3 -0
  67. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/xml/AwsRestXmlProtocol.d.ts +6 -1
  68. package/node_modules/@aws-sdk/core/package.json +14 -14
  69. package/node_modules/@aws-sdk/credential-provider-env/package.json +6 -6
  70. package/node_modules/@aws-sdk/credential-provider-http/package.json +11 -11
  71. package/node_modules/@aws-sdk/credential-provider-ini/package.json +15 -15
  72. package/node_modules/@aws-sdk/credential-provider-login/package.json +9 -9
  73. package/node_modules/@aws-sdk/credential-provider-node/package.json +13 -13
  74. package/node_modules/@aws-sdk/credential-provider-process/package.json +7 -7
  75. package/node_modules/@aws-sdk/credential-provider-sso/package.json +9 -9
  76. package/node_modules/@aws-sdk/credential-provider-web-identity/package.json +8 -8
  77. package/node_modules/@aws-sdk/middleware-host-header/package.json +5 -5
  78. package/node_modules/@aws-sdk/middleware-logger/package.json +4 -4
  79. package/node_modules/@aws-sdk/middleware-recursion-detection/package.json +5 -5
  80. package/node_modules/@aws-sdk/middleware-user-agent/dist-cjs/index.js +9 -9
  81. package/node_modules/@aws-sdk/middleware-user-agent/dist-es/check-features.js +9 -9
  82. package/node_modules/@aws-sdk/middleware-user-agent/dist-types/check-features.d.ts +4 -2
  83. package/node_modules/@aws-sdk/middleware-user-agent/dist-types/ts3.4/check-features.d.ts +3 -3
  84. package/node_modules/@aws-sdk/middleware-user-agent/node_modules/@smithy/util-retry/LICENSE +201 -0
  85. package/node_modules/@aws-sdk/middleware-user-agent/node_modules/@smithy/util-retry/README.md +78 -0
  86. package/node_modules/@aws-sdk/middleware-user-agent/node_modules/@smithy/util-retry/dist-cjs/index.js +278 -0
  87. package/node_modules/@aws-sdk/middleware-user-agent/node_modules/@smithy/util-retry/dist-es/AdaptiveRetryStrategy.js +27 -0
  88. package/node_modules/@aws-sdk/middleware-user-agent/node_modules/@smithy/util-retry/dist-es/ConfiguredRetryStrategy.js +19 -0
  89. package/node_modules/@aws-sdk/middleware-user-agent/node_modules/@smithy/util-retry/dist-es/DefaultRateLimiter.js +109 -0
  90. package/node_modules/@aws-sdk/middleware-user-agent/node_modules/@smithy/util-retry/dist-es/StandardRetryStrategy.js +67 -0
  91. package/node_modules/@aws-sdk/middleware-user-agent/node_modules/@smithy/util-retry/dist-es/config.js +7 -0
  92. package/node_modules/@aws-sdk/middleware-user-agent/node_modules/@smithy/util-retry/dist-es/constants.js +9 -0
  93. package/node_modules/@aws-sdk/middleware-user-agent/node_modules/@smithy/util-retry/dist-es/defaultRetryBackoffStrategy.js +14 -0
  94. package/node_modules/@aws-sdk/middleware-user-agent/node_modules/@smithy/util-retry/dist-es/defaultRetryToken.js +11 -0
  95. package/node_modules/@aws-sdk/middleware-user-agent/node_modules/@smithy/util-retry/dist-es/index.js +7 -0
  96. package/node_modules/@aws-sdk/middleware-user-agent/node_modules/@smithy/util-retry/dist-es/types.js +1 -0
  97. package/node_modules/@aws-sdk/middleware-user-agent/node_modules/@smithy/util-retry/dist-types/AdaptiveRetryStrategy.d.ts +33 -0
  98. package/node_modules/@aws-sdk/middleware-user-agent/node_modules/@smithy/util-retry/dist-types/ConfiguredRetryStrategy.d.ts +32 -0
  99. package/node_modules/@aws-sdk/middleware-user-agent/node_modules/@smithy/util-retry/dist-types/DefaultRateLimiter.d.ts +49 -0
  100. package/node_modules/@aws-sdk/middleware-user-agent/node_modules/@smithy/util-retry/dist-types/StandardRetryStrategy.d.ts +26 -0
  101. package/node_modules/@aws-sdk/middleware-user-agent/node_modules/@smithy/util-retry/dist-types/config.d.ts +20 -0
  102. package/node_modules/@aws-sdk/middleware-user-agent/node_modules/@smithy/util-retry/dist-types/constants.d.ts +59 -0
  103. package/node_modules/@aws-sdk/middleware-user-agent/node_modules/@smithy/util-retry/dist-types/defaultRetryBackoffStrategy.d.ts +5 -0
  104. package/node_modules/@aws-sdk/middleware-user-agent/node_modules/@smithy/util-retry/dist-types/defaultRetryToken.d.ts +9 -0
  105. package/node_modules/@aws-sdk/middleware-user-agent/node_modules/@smithy/util-retry/dist-types/index.d.ts +7 -0
  106. package/node_modules/@aws-sdk/middleware-user-agent/node_modules/@smithy/util-retry/dist-types/ts3.4/AdaptiveRetryStrategy.d.ts +33 -0
  107. package/node_modules/@aws-sdk/middleware-user-agent/node_modules/@smithy/util-retry/dist-types/ts3.4/ConfiguredRetryStrategy.d.ts +32 -0
  108. package/node_modules/@aws-sdk/middleware-user-agent/node_modules/@smithy/util-retry/dist-types/ts3.4/DefaultRateLimiter.d.ts +49 -0
  109. package/node_modules/@aws-sdk/middleware-user-agent/node_modules/@smithy/util-retry/dist-types/ts3.4/StandardRetryStrategy.d.ts +26 -0
  110. package/node_modules/@aws-sdk/middleware-user-agent/node_modules/@smithy/util-retry/dist-types/ts3.4/config.d.ts +20 -0
  111. package/node_modules/@aws-sdk/middleware-user-agent/node_modules/@smithy/util-retry/dist-types/ts3.4/constants.d.ts +59 -0
  112. package/node_modules/@aws-sdk/middleware-user-agent/node_modules/@smithy/util-retry/dist-types/ts3.4/defaultRetryBackoffStrategy.d.ts +5 -0
  113. package/node_modules/@aws-sdk/middleware-user-agent/node_modules/@smithy/util-retry/dist-types/ts3.4/defaultRetryToken.d.ts +9 -0
  114. package/node_modules/@aws-sdk/middleware-user-agent/node_modules/@smithy/util-retry/dist-types/ts3.4/index.d.ts +7 -0
  115. package/node_modules/@aws-sdk/middleware-user-agent/node_modules/@smithy/util-retry/dist-types/ts3.4/types.d.ts +19 -0
  116. package/node_modules/@aws-sdk/middleware-user-agent/node_modules/@smithy/util-retry/dist-types/types.d.ts +19 -0
  117. package/node_modules/@aws-sdk/middleware-user-agent/node_modules/@smithy/util-retry/package.json +71 -0
  118. package/node_modules/@aws-sdk/middleware-user-agent/package.json +9 -8
  119. package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/util-retry/package.json +3 -3
  120. package/node_modules/@aws-sdk/nested-clients/package.json +39 -37
  121. package/node_modules/@aws-sdk/region-config-resolver/package.json +6 -6
  122. package/node_modules/@aws-sdk/token-providers/package.json +8 -8
  123. package/node_modules/@aws-sdk/types/package.json +3 -3
  124. package/node_modules/@aws-sdk/util-endpoints/package.json +6 -6
  125. package/node_modules/@aws-sdk/util-user-agent-browser/package.json +4 -4
  126. package/node_modules/@aws-sdk/util-user-agent-node/dist-cjs/index.js +75 -19
  127. package/node_modules/@aws-sdk/util-user-agent-node/dist-es/getNodeModulesParentDirs.js +15 -0
  128. package/node_modules/@aws-sdk/util-user-agent-node/dist-es/getSanitizedDevTypeScriptVersion.js +14 -0
  129. package/node_modules/@aws-sdk/util-user-agent-node/dist-es/getTypeScriptUserAgentPair.js +53 -7
  130. package/node_modules/@aws-sdk/util-user-agent-node/dist-types/{getTypeScriptPackageJsonPaths.d.ts → getNodeModulesParentDirs.d.ts} +2 -2
  131. package/node_modules/@aws-sdk/util-user-agent-node/dist-types/getSanitizedDevTypeScriptVersion.d.ts +8 -0
  132. package/node_modules/@aws-sdk/util-user-agent-node/dist-types/ts3.4/getNodeModulesParentDirs.d.ts +1 -0
  133. package/node_modules/@aws-sdk/util-user-agent-node/dist-types/ts3.4/getSanitizedDevTypeScriptVersion.d.ts +3 -0
  134. package/node_modules/@aws-sdk/util-user-agent-node/package.json +7 -6
  135. package/node_modules/@aws-sdk/xml-builder/dist-cjs/index.js +21 -11
  136. package/node_modules/@aws-sdk/xml-builder/dist-cjs/xml-parser.js +5 -1
  137. package/node_modules/@aws-sdk/xml-builder/dist-es/escape-attribute.js +8 -1
  138. package/node_modules/@aws-sdk/xml-builder/dist-es/escape-element.js +13 -10
  139. package/node_modules/@aws-sdk/xml-builder/dist-es/xml-parser.js +5 -1
  140. package/node_modules/@aws-sdk/xml-builder/package.json +4 -4
  141. package/node_modules/@smithy/abort-controller/package.json +2 -2
  142. package/node_modules/@smithy/config-resolver/dist-cjs/index.js +12 -0
  143. package/node_modules/@smithy/config-resolver/dist-es/endpointsConfig/NodeUseDualstackEndpointConfigOptions.js +5 -0
  144. package/node_modules/@smithy/config-resolver/dist-es/endpointsConfig/NodeUseFipsEndpointConfigOptions.js +5 -0
  145. package/node_modules/@smithy/config-resolver/dist-types/endpointsConfig/NodeUseDualstackEndpointConfigOptions.d.ts +6 -0
  146. package/node_modules/@smithy/config-resolver/dist-types/endpointsConfig/NodeUseFipsEndpointConfigOptions.d.ts +6 -0
  147. package/node_modules/@smithy/config-resolver/dist-types/ts3.4/endpointsConfig/NodeUseDualstackEndpointConfigOptions.d.ts +6 -0
  148. package/node_modules/@smithy/config-resolver/dist-types/ts3.4/endpointsConfig/NodeUseFipsEndpointConfigOptions.d.ts +6 -0
  149. package/node_modules/@smithy/config-resolver/package.json +5 -5
  150. package/node_modules/@smithy/core/dist-cjs/index.js +1 -2
  151. package/node_modules/@smithy/core/dist-cjs/submodules/cbor/index.js +7 -1
  152. package/node_modules/@smithy/core/dist-cjs/submodules/endpoints/index.js +22 -0
  153. package/node_modules/@smithy/core/dist-cjs/submodules/event-streams/index.js +1 -1
  154. package/node_modules/@smithy/core/dist-cjs/submodules/protocols/index.js +11 -1
  155. package/node_modules/@smithy/core/dist-cjs/submodules/schema/index.js +42 -5
  156. package/node_modules/@smithy/core/dist-es/middleware-http-auth-scheme/getHttpAuthSchemePlugin.js +1 -2
  157. package/node_modules/@smithy/core/dist-es/submodules/cbor/parseCborBody.js +7 -1
  158. package/node_modules/@smithy/core/dist-es/submodules/endpoints/index.js +1 -0
  159. package/node_modules/@smithy/core/dist-es/submodules/endpoints/toEndpointV1.js +17 -0
  160. package/node_modules/@smithy/core/dist-es/submodules/event-streams/EventStreamSerde.js +1 -1
  161. package/node_modules/@smithy/core/dist-es/submodules/protocols/HttpProtocol.js +10 -0
  162. package/node_modules/@smithy/core/dist-es/submodules/protocols/RpcProtocol.js +1 -1
  163. package/node_modules/@smithy/core/dist-es/submodules/schema/middleware/schemaSerializationMiddleware.js +3 -2
  164. package/node_modules/@smithy/core/dist-es/submodules/schema/schemas/NormalizedSchema.js +31 -2
  165. package/node_modules/@smithy/core/dist-es/submodules/schema/schemas/translateTraits.js +5 -1
  166. package/node_modules/@smithy/core/dist-types/submodules/endpoints/index.d.ts +1 -0
  167. package/node_modules/@smithy/core/dist-types/submodules/endpoints/toEndpointV1.d.ts +6 -0
  168. package/node_modules/@smithy/core/dist-types/submodules/schema/schemas/NormalizedSchema.d.ts +11 -0
  169. package/node_modules/@smithy/core/dist-types/submodules/schema/schemas/translateTraits.d.ts +6 -0
  170. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/endpoints/index.d.ts +1 -0
  171. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/endpoints/toEndpointV1.d.ts +6 -0
  172. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/schema/schemas/NormalizedSchema.d.ts +11 -0
  173. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/schema/schemas/translateTraits.d.ts +6 -0
  174. package/node_modules/@smithy/core/endpoints.d.ts +7 -0
  175. package/node_modules/@smithy/core/endpoints.js +6 -0
  176. package/node_modules/@smithy/core/package.json +16 -7
  177. package/node_modules/@smithy/credential-provider-imds/package.json +5 -5
  178. package/node_modules/@smithy/fetch-http-handler/dist-cjs/index.js +4 -1
  179. package/node_modules/@smithy/fetch-http-handler/dist-es/fetch-http-handler.js +4 -1
  180. package/node_modules/@smithy/fetch-http-handler/package.json +5 -5
  181. package/node_modules/@smithy/hash-node/package.json +2 -2
  182. package/node_modules/@smithy/invalid-dependency/package.json +2 -2
  183. package/node_modules/@smithy/middleware-content-length/package.json +3 -3
  184. package/node_modules/@smithy/middleware-endpoint/dist-cjs/index.js +17 -1
  185. package/node_modules/@smithy/middleware-endpoint/dist-es/adaptors/getEndpointFromInstructions.js +9 -0
  186. package/node_modules/@smithy/middleware-endpoint/dist-es/adaptors/toEndpointV1.js +8 -1
  187. package/node_modules/@smithy/middleware-endpoint/dist-types/adaptors/toEndpointV1.d.ts +1 -0
  188. package/node_modules/@smithy/middleware-endpoint/dist-types/resolveEndpointConfig.d.ts +2 -2
  189. package/node_modules/@smithy/middleware-endpoint/dist-types/ts3.4/adaptors/toEndpointV1.d.ts +1 -0
  190. package/node_modules/@smithy/middleware-endpoint/dist-types/ts3.4/resolveEndpointConfig.d.ts +2 -2
  191. package/node_modules/@smithy/middleware-endpoint/package.json +8 -8
  192. package/node_modules/@smithy/middleware-retry/dist-cjs/index.js +9 -12
  193. package/node_modules/@smithy/middleware-retry/dist-es/configurations.js +9 -12
  194. package/node_modules/@smithy/middleware-retry/node_modules/@smithy/util-retry/package.json +3 -3
  195. package/node_modules/@smithy/middleware-retry/package.json +8 -8
  196. package/node_modules/@smithy/middleware-serde/dist-cjs/index.js +3 -2
  197. package/node_modules/@smithy/middleware-serde/dist-es/serializerMiddleware.js +3 -2
  198. package/node_modules/@smithy/middleware-serde/package.json +4 -3
  199. package/node_modules/@smithy/middleware-stack/package.json +2 -2
  200. package/node_modules/@smithy/node-config-provider/package.json +4 -4
  201. package/node_modules/@smithy/node-http-handler/dist-cjs/index.js +48 -38
  202. package/node_modules/@smithy/node-http-handler/dist-es/build-abort-error.js +4 -1
  203. package/node_modules/@smithy/node-http-handler/dist-es/node-http-handler.js +38 -31
  204. package/node_modules/@smithy/node-http-handler/dist-es/node-http2-connection-manager.js +1 -1
  205. package/node_modules/@smithy/node-http-handler/dist-es/node-http2-handler.js +1 -1
  206. package/node_modules/@smithy/node-http-handler/dist-es/readable.mock.js +1 -1
  207. package/node_modules/@smithy/node-http-handler/dist-es/server.mock.js +6 -6
  208. package/node_modules/@smithy/node-http-handler/dist-es/stream-collector/collector.js +1 -1
  209. package/node_modules/@smithy/node-http-handler/dist-es/stream-collector/readable.mock.js +1 -1
  210. package/node_modules/@smithy/node-http-handler/dist-es/write-request-body.js +1 -1
  211. package/node_modules/@smithy/node-http-handler/dist-types/build-abort-error.d.ts +4 -3
  212. package/node_modules/@smithy/node-http-handler/dist-types/get-transformed-headers.d.ts +1 -1
  213. package/node_modules/@smithy/node-http-handler/dist-types/node-http-handler.d.ts +4 -4
  214. package/node_modules/@smithy/node-http-handler/dist-types/node-http2-connection-manager.d.ts +1 -1
  215. package/node_modules/@smithy/node-http-handler/dist-types/node-http2-connection-pool.d.ts +1 -1
  216. package/node_modules/@smithy/node-http-handler/dist-types/readable.mock.d.ts +2 -2
  217. package/node_modules/@smithy/node-http-handler/dist-types/server.mock.d.ts +3 -3
  218. package/node_modules/@smithy/node-http-handler/dist-types/set-connection-timeout.d.ts +1 -1
  219. package/node_modules/@smithy/node-http-handler/dist-types/set-request-timeout.d.ts +1 -1
  220. package/node_modules/@smithy/node-http-handler/dist-types/set-socket-keep-alive.d.ts +1 -1
  221. package/node_modules/@smithy/node-http-handler/dist-types/set-socket-timeout.d.ts +1 -1
  222. package/node_modules/@smithy/node-http-handler/dist-types/stream-collector/collector.d.ts +1 -1
  223. package/node_modules/@smithy/node-http-handler/dist-types/stream-collector/readable.mock.d.ts +2 -2
  224. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/build-abort-error.d.ts +4 -3
  225. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/get-transformed-headers.d.ts +1 -1
  226. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/node-http-handler.d.ts +4 -4
  227. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/node-http2-connection-manager.d.ts +1 -1
  228. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/node-http2-connection-pool.d.ts +1 -1
  229. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/readable.mock.d.ts +2 -2
  230. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/server.mock.d.ts +3 -3
  231. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/set-connection-timeout.d.ts +1 -1
  232. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/set-request-timeout.d.ts +1 -1
  233. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/set-socket-keep-alive.d.ts +1 -1
  234. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/set-socket-timeout.d.ts +1 -1
  235. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/stream-collector/collector.d.ts +1 -1
  236. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/stream-collector/readable.mock.d.ts +2 -2
  237. package/node_modules/@smithy/node-http-handler/dist-types/ts3.4/write-request-body.d.ts +2 -2
  238. package/node_modules/@smithy/node-http-handler/dist-types/write-request-body.d.ts +2 -2
  239. package/node_modules/@smithy/node-http-handler/package.json +5 -5
  240. package/node_modules/@smithy/property-provider/package.json +2 -2
  241. package/node_modules/@smithy/protocol-http/package.json +2 -2
  242. package/node_modules/@smithy/querystring-builder/package.json +2 -2
  243. package/node_modules/@smithy/querystring-parser/package.json +2 -2
  244. package/node_modules/@smithy/service-error-classification/package.json +2 -2
  245. package/node_modules/@smithy/shared-ini-file-loader/package.json +2 -2
  246. package/node_modules/@smithy/signature-v4/package.json +4 -4
  247. package/node_modules/@smithy/smithy-client/package.json +7 -7
  248. package/node_modules/@smithy/types/dist-types/http.d.ts +1 -0
  249. package/node_modules/@smithy/types/dist-types/ts3.4/http.d.ts +1 -0
  250. package/node_modules/@smithy/types/package.json +1 -1
  251. package/node_modules/@smithy/url-parser/package.json +3 -3
  252. package/node_modules/@smithy/util-defaults-mode-browser/package.json +4 -4
  253. package/node_modules/@smithy/util-defaults-mode-node/package.json +7 -7
  254. package/node_modules/@smithy/util-endpoints/package.json +3 -3
  255. package/node_modules/@smithy/util-middleware/package.json +2 -2
  256. package/node_modules/@smithy/util-stream/package.json +4 -4
  257. package/node_modules/@smithy/util-waiter/dist-cjs/index.js +1 -1
  258. package/node_modules/@smithy/util-waiter/dist-es/poller.js +1 -1
  259. package/node_modules/@smithy/util-waiter/package.json +3 -3
  260. package/node_modules/fast-xml-builder/CHANGELOG.md +16 -0
  261. package/node_modules/fast-xml-builder/README.md +1 -1
  262. package/node_modules/fast-xml-builder/lib/fxb.cjs +1 -0
  263. package/node_modules/fast-xml-builder/lib/fxb.d.cts +22 -9
  264. package/node_modules/fast-xml-builder/lib/fxb.min.js +2 -0
  265. package/node_modules/fast-xml-builder/lib/fxb.min.js.map +1 -0
  266. package/node_modules/fast-xml-builder/package.json +7 -5
  267. package/node_modules/fast-xml-builder/src/fxb.d.ts +27 -3
  268. package/node_modules/fast-xml-builder/src/fxb.js +265 -21
  269. package/node_modules/fast-xml-builder/src/orderedJs2Xml.js +165 -18
  270. package/node_modules/fast-xml-parser/CHANGELOG.md +40 -4
  271. package/node_modules/fast-xml-parser/README.md +8 -7
  272. package/node_modules/fast-xml-parser/lib/fxbuilder.min.js +1 -1
  273. package/node_modules/fast-xml-parser/lib/fxbuilder.min.js.map +1 -1
  274. package/node_modules/fast-xml-parser/lib/fxp.cjs +1 -1
  275. package/node_modules/fast-xml-parser/lib/fxp.d.cts +82 -20
  276. package/node_modules/fast-xml-parser/lib/fxp.min.js +1 -1
  277. package/node_modules/fast-xml-parser/lib/fxp.min.js.map +1 -1
  278. package/node_modules/fast-xml-parser/lib/fxparser.min.js +1 -1
  279. package/node_modules/fast-xml-parser/lib/fxparser.min.js.map +1 -1
  280. package/node_modules/fast-xml-parser/lib/fxvalidator.min.js.map +1 -1
  281. package/node_modules/fast-xml-parser/lib/pem.d.cts +148 -0
  282. package/node_modules/fast-xml-parser/package.json +4 -3
  283. package/node_modules/fast-xml-parser/src/fxp.d.ts +75 -19
  284. package/node_modules/fast-xml-parser/src/pem.d.ts +135 -0
  285. package/node_modules/fast-xml-parser/src/util.js +18 -0
  286. package/node_modules/fast-xml-parser/src/xmlparser/DocTypeReader.js +37 -18
  287. package/node_modules/fast-xml-parser/src/xmlparser/OptionsBuilder.js +76 -5
  288. package/node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js +298 -116
  289. package/node_modules/fast-xml-parser/src/xmlparser/XMLParser.js +2 -2
  290. package/node_modules/fast-xml-parser/src/xmlparser/node2json.js +65 -15
  291. package/node_modules/path-expression-matcher/LICENSE +21 -0
  292. package/node_modules/path-expression-matcher/README.md +720 -0
  293. package/node_modules/path-expression-matcher/lib/pem.cjs +1 -0
  294. package/node_modules/path-expression-matcher/lib/pem.d.cts +523 -0
  295. package/node_modules/path-expression-matcher/lib/pem.min.js +2 -0
  296. package/node_modules/path-expression-matcher/lib/pem.min.js.map +1 -0
  297. package/node_modules/path-expression-matcher/package.json +78 -0
  298. package/node_modules/path-expression-matcher/src/Expression.js +232 -0
  299. package/node_modules/path-expression-matcher/src/Matcher.js +498 -0
  300. package/node_modules/path-expression-matcher/src/index.d.ts +518 -0
  301. package/node_modules/path-expression-matcher/src/index.js +28 -0
  302. package/package.json +7 -7
  303. package/version.json +1 -1
  304. package/node_modules/@aws-sdk/util-user-agent-node/dist-es/getTypeScriptPackageJsonPaths.js +0 -17
  305. package/node_modules/@aws-sdk/util-user-agent-node/dist-types/ts3.4/getTypeScriptPackageJsonPaths.d.ts +0 -3
  306. package/node_modules/fast-xml-builder/lib/builder.cjs +0 -1
  307. package/node_modules/fast-xml-builder/lib/builder.min.js +0 -2
  308. package/node_modules/fast-xml-builder/lib/builder.min.js.map +0 -1
@@ -0,0 +1,78 @@
1
+ # @smithy/util-retry
2
+
3
+ [![NPM version](https://img.shields.io/npm/v/@smithy/util-retry/latest.svg)](https://www.npmjs.com/package/@smithy/util-retry)
4
+ [![NPM downloads](https://img.shields.io/npm/dm/@smithy/util-retry.svg)](https://www.npmjs.com/package/@smithy/util-retry)
5
+
6
+ This package provides shared utilities for retries.
7
+
8
+ ## Usage
9
+
10
+ ### Default
11
+
12
+ By default, each client already has a default retry strategy. The default retry count is 3, and
13
+ only retryable errors will be retried.
14
+
15
+ [AWS Documentation: Retry behavior](https://docs.aws.amazon.com/sdkref/latest/guide/feature-retry-behavior.html).
16
+
17
+ ```js
18
+ import { S3Client } from "@aws-sdk/client-s3";
19
+
20
+ const client = new S3Client({}); // default retry strategy included.
21
+ ```
22
+
23
+ ### MaxAttempts
24
+
25
+ If you want to change the number of attempts, you can provide `maxAttempts` configuration during client creation.
26
+
27
+ ```js
28
+ import { S3Client } from "@aws-sdk/client-s3";
29
+
30
+ const client = new S3Client({ maxAttempts: 4 });
31
+ ```
32
+
33
+ This is recommended because the `StandardRetryStrategy` includes backoff calculation,
34
+ deciding whether an error should be retried, and a retry token counter.
35
+
36
+ ### MaxAttempts and BackoffComputation
37
+
38
+ If you want to change the number of attempts and use a custom delay
39
+ computation, you can use the `ConfiguredRetryStrategy` from `@smithy/util-retry`.
40
+
41
+ ```js
42
+ import { S3Client } from "@aws-sdk/client-s3";
43
+ import { ConfiguredRetryStrategy } from "@smithy/util-retry";
44
+
45
+ const client = new S3Client({
46
+ retryStrategy: new ConfiguredRetryStrategy(
47
+ 4, // max attempts.
48
+ (attempt: number) => 100 + attempt * 1000 // backoff function.
49
+ ),
50
+ });
51
+ ```
52
+
53
+ This example sets the backoff at 100ms plus 1s per attempt.
54
+
55
+ ### MaxAttempts and RetryStrategy
56
+
57
+ If you provide both `maxAttempts` and `retryStrategy`, the `retryStrategy` will
58
+ get precedence as it's more specific.
59
+
60
+ ```js
61
+ import { S3Client } from "@aws-sdk/client-s3";
62
+ import { ConfiguredRetryStrategy } from "@smithy/util-retry";
63
+
64
+ const client = new S3Client({
65
+ maxAttempts: 2, // ignored.
66
+ retryStrategy: new ConfiguredRetryStrategy(
67
+ 4, // used.
68
+ (attempt: number) => 100 + attempt * 1000 // backoff function.
69
+ ),
70
+ });
71
+ ```
72
+
73
+ ### Further customization
74
+
75
+ You can implement the `RetryStrategyV2` interface.
76
+
77
+ Source: https://github.com/smithy-lang/smithy-typescript/blob/main/packages/types/src/retry.ts
78
+ API Docs: https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-smithy-types/Interface/RetryStrategyV2/
@@ -0,0 +1,278 @@
1
+ 'use strict';
2
+
3
+ var serviceErrorClassification = require('@smithy/service-error-classification');
4
+
5
+ exports.RETRY_MODES = void 0;
6
+ (function (RETRY_MODES) {
7
+ RETRY_MODES["STANDARD"] = "standard";
8
+ RETRY_MODES["ADAPTIVE"] = "adaptive";
9
+ })(exports.RETRY_MODES || (exports.RETRY_MODES = {}));
10
+ const DEFAULT_MAX_ATTEMPTS = 3;
11
+ const DEFAULT_RETRY_MODE = exports.RETRY_MODES.STANDARD;
12
+
13
+ class DefaultRateLimiter {
14
+ static setTimeoutFn = setTimeout;
15
+ beta;
16
+ minCapacity;
17
+ minFillRate;
18
+ scaleConstant;
19
+ smooth;
20
+ currentCapacity = 0;
21
+ enabled = false;
22
+ lastMaxRate = 0;
23
+ measuredTxRate = 0;
24
+ requestCount = 0;
25
+ fillRate;
26
+ lastThrottleTime;
27
+ lastTimestamp = 0;
28
+ lastTxRateBucket;
29
+ maxCapacity;
30
+ timeWindow = 0;
31
+ constructor(options) {
32
+ this.beta = options?.beta ?? 0.7;
33
+ this.minCapacity = options?.minCapacity ?? 1;
34
+ this.minFillRate = options?.minFillRate ?? 0.5;
35
+ this.scaleConstant = options?.scaleConstant ?? 0.4;
36
+ this.smooth = options?.smooth ?? 0.8;
37
+ const currentTimeInSeconds = this.getCurrentTimeInSeconds();
38
+ this.lastThrottleTime = currentTimeInSeconds;
39
+ this.lastTxRateBucket = Math.floor(this.getCurrentTimeInSeconds());
40
+ this.fillRate = this.minFillRate;
41
+ this.maxCapacity = this.minCapacity;
42
+ }
43
+ getCurrentTimeInSeconds() {
44
+ return Date.now() / 1000;
45
+ }
46
+ async getSendToken() {
47
+ return this.acquireTokenBucket(1);
48
+ }
49
+ async acquireTokenBucket(amount) {
50
+ if (!this.enabled) {
51
+ return;
52
+ }
53
+ this.refillTokenBucket();
54
+ if (amount > this.currentCapacity) {
55
+ const delay = ((amount - this.currentCapacity) / this.fillRate) * 1000;
56
+ await new Promise((resolve) => DefaultRateLimiter.setTimeoutFn(resolve, delay));
57
+ }
58
+ this.currentCapacity = this.currentCapacity - amount;
59
+ }
60
+ refillTokenBucket() {
61
+ const timestamp = this.getCurrentTimeInSeconds();
62
+ if (!this.lastTimestamp) {
63
+ this.lastTimestamp = timestamp;
64
+ return;
65
+ }
66
+ const fillAmount = (timestamp - this.lastTimestamp) * this.fillRate;
67
+ this.currentCapacity = Math.min(this.maxCapacity, this.currentCapacity + fillAmount);
68
+ this.lastTimestamp = timestamp;
69
+ }
70
+ updateClientSendingRate(response) {
71
+ let calculatedRate;
72
+ this.updateMeasuredRate();
73
+ if (serviceErrorClassification.isThrottlingError(response)) {
74
+ const rateToUse = !this.enabled ? this.measuredTxRate : Math.min(this.measuredTxRate, this.fillRate);
75
+ this.lastMaxRate = rateToUse;
76
+ this.calculateTimeWindow();
77
+ this.lastThrottleTime = this.getCurrentTimeInSeconds();
78
+ calculatedRate = this.cubicThrottle(rateToUse);
79
+ this.enableTokenBucket();
80
+ }
81
+ else {
82
+ this.calculateTimeWindow();
83
+ calculatedRate = this.cubicSuccess(this.getCurrentTimeInSeconds());
84
+ }
85
+ const newRate = Math.min(calculatedRate, 2 * this.measuredTxRate);
86
+ this.updateTokenBucketRate(newRate);
87
+ }
88
+ calculateTimeWindow() {
89
+ this.timeWindow = this.getPrecise(Math.pow((this.lastMaxRate * (1 - this.beta)) / this.scaleConstant, 1 / 3));
90
+ }
91
+ cubicThrottle(rateToUse) {
92
+ return this.getPrecise(rateToUse * this.beta);
93
+ }
94
+ cubicSuccess(timestamp) {
95
+ return this.getPrecise(this.scaleConstant * Math.pow(timestamp - this.lastThrottleTime - this.timeWindow, 3) + this.lastMaxRate);
96
+ }
97
+ enableTokenBucket() {
98
+ this.enabled = true;
99
+ }
100
+ updateTokenBucketRate(newRate) {
101
+ this.refillTokenBucket();
102
+ this.fillRate = Math.max(newRate, this.minFillRate);
103
+ this.maxCapacity = Math.max(newRate, this.minCapacity);
104
+ this.currentCapacity = Math.min(this.currentCapacity, this.maxCapacity);
105
+ }
106
+ updateMeasuredRate() {
107
+ const t = this.getCurrentTimeInSeconds();
108
+ const timeBucket = Math.floor(t * 2) / 2;
109
+ this.requestCount++;
110
+ if (timeBucket > this.lastTxRateBucket) {
111
+ const currentRate = this.requestCount / (timeBucket - this.lastTxRateBucket);
112
+ this.measuredTxRate = this.getPrecise(currentRate * this.smooth + this.measuredTxRate * (1 - this.smooth));
113
+ this.requestCount = 0;
114
+ this.lastTxRateBucket = timeBucket;
115
+ }
116
+ }
117
+ getPrecise(num) {
118
+ return parseFloat(num.toFixed(8));
119
+ }
120
+ }
121
+
122
+ const DEFAULT_RETRY_DELAY_BASE = 100;
123
+ const MAXIMUM_RETRY_DELAY = 20 * 1000;
124
+ const THROTTLING_RETRY_DELAY_BASE = 500;
125
+ const INITIAL_RETRY_TOKENS = 500;
126
+ const RETRY_COST = 5;
127
+ const TIMEOUT_RETRY_COST = 10;
128
+ const NO_RETRY_INCREMENT = 1;
129
+ const INVOCATION_ID_HEADER = "amz-sdk-invocation-id";
130
+ const REQUEST_HEADER = "amz-sdk-request";
131
+
132
+ const getDefaultRetryBackoffStrategy = () => {
133
+ let delayBase = DEFAULT_RETRY_DELAY_BASE;
134
+ const computeNextBackoffDelay = (attempts) => {
135
+ return Math.floor(Math.min(MAXIMUM_RETRY_DELAY, Math.random() * 2 ** attempts * delayBase));
136
+ };
137
+ const setDelayBase = (delay) => {
138
+ delayBase = delay;
139
+ };
140
+ return {
141
+ computeNextBackoffDelay,
142
+ setDelayBase,
143
+ };
144
+ };
145
+
146
+ const createDefaultRetryToken = ({ retryDelay, retryCount, retryCost, }) => {
147
+ const getRetryCount = () => retryCount;
148
+ const getRetryDelay = () => Math.min(MAXIMUM_RETRY_DELAY, retryDelay);
149
+ const getRetryCost = () => retryCost;
150
+ return {
151
+ getRetryCount,
152
+ getRetryDelay,
153
+ getRetryCost,
154
+ };
155
+ };
156
+
157
+ class StandardRetryStrategy {
158
+ maxAttempts;
159
+ mode = exports.RETRY_MODES.STANDARD;
160
+ capacity = INITIAL_RETRY_TOKENS;
161
+ retryBackoffStrategy = getDefaultRetryBackoffStrategy();
162
+ maxAttemptsProvider;
163
+ constructor(maxAttempts) {
164
+ this.maxAttempts = maxAttempts;
165
+ this.maxAttemptsProvider = typeof maxAttempts === "function" ? maxAttempts : async () => maxAttempts;
166
+ }
167
+ async acquireInitialRetryToken(retryTokenScope) {
168
+ return createDefaultRetryToken({
169
+ retryDelay: DEFAULT_RETRY_DELAY_BASE,
170
+ retryCount: 0,
171
+ });
172
+ }
173
+ async refreshRetryTokenForRetry(token, errorInfo) {
174
+ const maxAttempts = await this.getMaxAttempts();
175
+ if (this.shouldRetry(token, errorInfo, maxAttempts)) {
176
+ const errorType = errorInfo.errorType;
177
+ this.retryBackoffStrategy.setDelayBase(errorType === "THROTTLING" ? THROTTLING_RETRY_DELAY_BASE : DEFAULT_RETRY_DELAY_BASE);
178
+ const delayFromErrorType = this.retryBackoffStrategy.computeNextBackoffDelay(token.getRetryCount());
179
+ const retryDelay = errorInfo.retryAfterHint
180
+ ? Math.max(errorInfo.retryAfterHint.getTime() - Date.now() || 0, delayFromErrorType)
181
+ : delayFromErrorType;
182
+ const capacityCost = this.getCapacityCost(errorType);
183
+ this.capacity -= capacityCost;
184
+ return createDefaultRetryToken({
185
+ retryDelay,
186
+ retryCount: token.getRetryCount() + 1,
187
+ retryCost: capacityCost,
188
+ });
189
+ }
190
+ throw new Error("No retry token available");
191
+ }
192
+ recordSuccess(token) {
193
+ this.capacity = Math.max(INITIAL_RETRY_TOKENS, this.capacity + (token.getRetryCost() ?? NO_RETRY_INCREMENT));
194
+ }
195
+ getCapacity() {
196
+ return this.capacity;
197
+ }
198
+ async getMaxAttempts() {
199
+ try {
200
+ return await this.maxAttemptsProvider();
201
+ }
202
+ catch (error) {
203
+ console.warn(`Max attempts provider could not resolve. Using default of ${DEFAULT_MAX_ATTEMPTS}`);
204
+ return DEFAULT_MAX_ATTEMPTS;
205
+ }
206
+ }
207
+ shouldRetry(tokenToRenew, errorInfo, maxAttempts) {
208
+ const attempts = tokenToRenew.getRetryCount() + 1;
209
+ return (attempts < maxAttempts &&
210
+ this.capacity >= this.getCapacityCost(errorInfo.errorType) &&
211
+ this.isRetryableError(errorInfo.errorType));
212
+ }
213
+ getCapacityCost(errorType) {
214
+ return errorType === "TRANSIENT" ? TIMEOUT_RETRY_COST : RETRY_COST;
215
+ }
216
+ isRetryableError(errorType) {
217
+ return errorType === "THROTTLING" || errorType === "TRANSIENT";
218
+ }
219
+ }
220
+
221
+ class AdaptiveRetryStrategy {
222
+ maxAttemptsProvider;
223
+ rateLimiter;
224
+ standardRetryStrategy;
225
+ mode = exports.RETRY_MODES.ADAPTIVE;
226
+ constructor(maxAttemptsProvider, options) {
227
+ this.maxAttemptsProvider = maxAttemptsProvider;
228
+ const { rateLimiter } = options ?? {};
229
+ this.rateLimiter = rateLimiter ?? new DefaultRateLimiter();
230
+ this.standardRetryStrategy = new StandardRetryStrategy(maxAttemptsProvider);
231
+ }
232
+ async acquireInitialRetryToken(retryTokenScope) {
233
+ await this.rateLimiter.getSendToken();
234
+ return this.standardRetryStrategy.acquireInitialRetryToken(retryTokenScope);
235
+ }
236
+ async refreshRetryTokenForRetry(tokenToRenew, errorInfo) {
237
+ this.rateLimiter.updateClientSendingRate(errorInfo);
238
+ return this.standardRetryStrategy.refreshRetryTokenForRetry(tokenToRenew, errorInfo);
239
+ }
240
+ recordSuccess(token) {
241
+ this.rateLimiter.updateClientSendingRate({});
242
+ this.standardRetryStrategy.recordSuccess(token);
243
+ }
244
+ }
245
+
246
+ class ConfiguredRetryStrategy extends StandardRetryStrategy {
247
+ computeNextBackoffDelay;
248
+ constructor(maxAttempts, computeNextBackoffDelay = DEFAULT_RETRY_DELAY_BASE) {
249
+ super(typeof maxAttempts === "function" ? maxAttempts : async () => maxAttempts);
250
+ if (typeof computeNextBackoffDelay === "number") {
251
+ this.computeNextBackoffDelay = () => computeNextBackoffDelay;
252
+ }
253
+ else {
254
+ this.computeNextBackoffDelay = computeNextBackoffDelay;
255
+ }
256
+ }
257
+ async refreshRetryTokenForRetry(tokenToRenew, errorInfo) {
258
+ const token = await super.refreshRetryTokenForRetry(tokenToRenew, errorInfo);
259
+ token.getRetryDelay = () => this.computeNextBackoffDelay(token.getRetryCount());
260
+ return token;
261
+ }
262
+ }
263
+
264
+ exports.AdaptiveRetryStrategy = AdaptiveRetryStrategy;
265
+ exports.ConfiguredRetryStrategy = ConfiguredRetryStrategy;
266
+ exports.DEFAULT_MAX_ATTEMPTS = DEFAULT_MAX_ATTEMPTS;
267
+ exports.DEFAULT_RETRY_DELAY_BASE = DEFAULT_RETRY_DELAY_BASE;
268
+ exports.DEFAULT_RETRY_MODE = DEFAULT_RETRY_MODE;
269
+ exports.DefaultRateLimiter = DefaultRateLimiter;
270
+ exports.INITIAL_RETRY_TOKENS = INITIAL_RETRY_TOKENS;
271
+ exports.INVOCATION_ID_HEADER = INVOCATION_ID_HEADER;
272
+ exports.MAXIMUM_RETRY_DELAY = MAXIMUM_RETRY_DELAY;
273
+ exports.NO_RETRY_INCREMENT = NO_RETRY_INCREMENT;
274
+ exports.REQUEST_HEADER = REQUEST_HEADER;
275
+ exports.RETRY_COST = RETRY_COST;
276
+ exports.StandardRetryStrategy = StandardRetryStrategy;
277
+ exports.THROTTLING_RETRY_DELAY_BASE = THROTTLING_RETRY_DELAY_BASE;
278
+ exports.TIMEOUT_RETRY_COST = TIMEOUT_RETRY_COST;
@@ -0,0 +1,27 @@
1
+ import { RETRY_MODES } from "./config";
2
+ import { DefaultRateLimiter } from "./DefaultRateLimiter";
3
+ import { StandardRetryStrategy } from "./StandardRetryStrategy";
4
+ export class AdaptiveRetryStrategy {
5
+ maxAttemptsProvider;
6
+ rateLimiter;
7
+ standardRetryStrategy;
8
+ mode = RETRY_MODES.ADAPTIVE;
9
+ constructor(maxAttemptsProvider, options) {
10
+ this.maxAttemptsProvider = maxAttemptsProvider;
11
+ const { rateLimiter } = options ?? {};
12
+ this.rateLimiter = rateLimiter ?? new DefaultRateLimiter();
13
+ this.standardRetryStrategy = new StandardRetryStrategy(maxAttemptsProvider);
14
+ }
15
+ async acquireInitialRetryToken(retryTokenScope) {
16
+ await this.rateLimiter.getSendToken();
17
+ return this.standardRetryStrategy.acquireInitialRetryToken(retryTokenScope);
18
+ }
19
+ async refreshRetryTokenForRetry(tokenToRenew, errorInfo) {
20
+ this.rateLimiter.updateClientSendingRate(errorInfo);
21
+ return this.standardRetryStrategy.refreshRetryTokenForRetry(tokenToRenew, errorInfo);
22
+ }
23
+ recordSuccess(token) {
24
+ this.rateLimiter.updateClientSendingRate({});
25
+ this.standardRetryStrategy.recordSuccess(token);
26
+ }
27
+ }
@@ -0,0 +1,19 @@
1
+ import { DEFAULT_RETRY_DELAY_BASE } from "./constants";
2
+ import { StandardRetryStrategy } from "./StandardRetryStrategy";
3
+ export class ConfiguredRetryStrategy extends StandardRetryStrategy {
4
+ computeNextBackoffDelay;
5
+ constructor(maxAttempts, computeNextBackoffDelay = DEFAULT_RETRY_DELAY_BASE) {
6
+ super(typeof maxAttempts === "function" ? maxAttempts : async () => maxAttempts);
7
+ if (typeof computeNextBackoffDelay === "number") {
8
+ this.computeNextBackoffDelay = () => computeNextBackoffDelay;
9
+ }
10
+ else {
11
+ this.computeNextBackoffDelay = computeNextBackoffDelay;
12
+ }
13
+ }
14
+ async refreshRetryTokenForRetry(tokenToRenew, errorInfo) {
15
+ const token = await super.refreshRetryTokenForRetry(tokenToRenew, errorInfo);
16
+ token.getRetryDelay = () => this.computeNextBackoffDelay(token.getRetryCount());
17
+ return token;
18
+ }
19
+ }
@@ -0,0 +1,109 @@
1
+ import { isThrottlingError } from "@smithy/service-error-classification";
2
+ export class DefaultRateLimiter {
3
+ static setTimeoutFn = setTimeout;
4
+ beta;
5
+ minCapacity;
6
+ minFillRate;
7
+ scaleConstant;
8
+ smooth;
9
+ currentCapacity = 0;
10
+ enabled = false;
11
+ lastMaxRate = 0;
12
+ measuredTxRate = 0;
13
+ requestCount = 0;
14
+ fillRate;
15
+ lastThrottleTime;
16
+ lastTimestamp = 0;
17
+ lastTxRateBucket;
18
+ maxCapacity;
19
+ timeWindow = 0;
20
+ constructor(options) {
21
+ this.beta = options?.beta ?? 0.7;
22
+ this.minCapacity = options?.minCapacity ?? 1;
23
+ this.minFillRate = options?.minFillRate ?? 0.5;
24
+ this.scaleConstant = options?.scaleConstant ?? 0.4;
25
+ this.smooth = options?.smooth ?? 0.8;
26
+ const currentTimeInSeconds = this.getCurrentTimeInSeconds();
27
+ this.lastThrottleTime = currentTimeInSeconds;
28
+ this.lastTxRateBucket = Math.floor(this.getCurrentTimeInSeconds());
29
+ this.fillRate = this.minFillRate;
30
+ this.maxCapacity = this.minCapacity;
31
+ }
32
+ getCurrentTimeInSeconds() {
33
+ return Date.now() / 1000;
34
+ }
35
+ async getSendToken() {
36
+ return this.acquireTokenBucket(1);
37
+ }
38
+ async acquireTokenBucket(amount) {
39
+ if (!this.enabled) {
40
+ return;
41
+ }
42
+ this.refillTokenBucket();
43
+ if (amount > this.currentCapacity) {
44
+ const delay = ((amount - this.currentCapacity) / this.fillRate) * 1000;
45
+ await new Promise((resolve) => DefaultRateLimiter.setTimeoutFn(resolve, delay));
46
+ }
47
+ this.currentCapacity = this.currentCapacity - amount;
48
+ }
49
+ refillTokenBucket() {
50
+ const timestamp = this.getCurrentTimeInSeconds();
51
+ if (!this.lastTimestamp) {
52
+ this.lastTimestamp = timestamp;
53
+ return;
54
+ }
55
+ const fillAmount = (timestamp - this.lastTimestamp) * this.fillRate;
56
+ this.currentCapacity = Math.min(this.maxCapacity, this.currentCapacity + fillAmount);
57
+ this.lastTimestamp = timestamp;
58
+ }
59
+ updateClientSendingRate(response) {
60
+ let calculatedRate;
61
+ this.updateMeasuredRate();
62
+ if (isThrottlingError(response)) {
63
+ const rateToUse = !this.enabled ? this.measuredTxRate : Math.min(this.measuredTxRate, this.fillRate);
64
+ this.lastMaxRate = rateToUse;
65
+ this.calculateTimeWindow();
66
+ this.lastThrottleTime = this.getCurrentTimeInSeconds();
67
+ calculatedRate = this.cubicThrottle(rateToUse);
68
+ this.enableTokenBucket();
69
+ }
70
+ else {
71
+ this.calculateTimeWindow();
72
+ calculatedRate = this.cubicSuccess(this.getCurrentTimeInSeconds());
73
+ }
74
+ const newRate = Math.min(calculatedRate, 2 * this.measuredTxRate);
75
+ this.updateTokenBucketRate(newRate);
76
+ }
77
+ calculateTimeWindow() {
78
+ this.timeWindow = this.getPrecise(Math.pow((this.lastMaxRate * (1 - this.beta)) / this.scaleConstant, 1 / 3));
79
+ }
80
+ cubicThrottle(rateToUse) {
81
+ return this.getPrecise(rateToUse * this.beta);
82
+ }
83
+ cubicSuccess(timestamp) {
84
+ return this.getPrecise(this.scaleConstant * Math.pow(timestamp - this.lastThrottleTime - this.timeWindow, 3) + this.lastMaxRate);
85
+ }
86
+ enableTokenBucket() {
87
+ this.enabled = true;
88
+ }
89
+ updateTokenBucketRate(newRate) {
90
+ this.refillTokenBucket();
91
+ this.fillRate = Math.max(newRate, this.minFillRate);
92
+ this.maxCapacity = Math.max(newRate, this.minCapacity);
93
+ this.currentCapacity = Math.min(this.currentCapacity, this.maxCapacity);
94
+ }
95
+ updateMeasuredRate() {
96
+ const t = this.getCurrentTimeInSeconds();
97
+ const timeBucket = Math.floor(t * 2) / 2;
98
+ this.requestCount++;
99
+ if (timeBucket > this.lastTxRateBucket) {
100
+ const currentRate = this.requestCount / (timeBucket - this.lastTxRateBucket);
101
+ this.measuredTxRate = this.getPrecise(currentRate * this.smooth + this.measuredTxRate * (1 - this.smooth));
102
+ this.requestCount = 0;
103
+ this.lastTxRateBucket = timeBucket;
104
+ }
105
+ }
106
+ getPrecise(num) {
107
+ return parseFloat(num.toFixed(8));
108
+ }
109
+ }
@@ -0,0 +1,67 @@
1
+ import { DEFAULT_MAX_ATTEMPTS, RETRY_MODES } from "./config";
2
+ import { DEFAULT_RETRY_DELAY_BASE, INITIAL_RETRY_TOKENS, NO_RETRY_INCREMENT, RETRY_COST, THROTTLING_RETRY_DELAY_BASE, TIMEOUT_RETRY_COST, } from "./constants";
3
+ import { getDefaultRetryBackoffStrategy } from "./defaultRetryBackoffStrategy";
4
+ import { createDefaultRetryToken } from "./defaultRetryToken";
5
+ export class StandardRetryStrategy {
6
+ maxAttempts;
7
+ mode = RETRY_MODES.STANDARD;
8
+ capacity = INITIAL_RETRY_TOKENS;
9
+ retryBackoffStrategy = getDefaultRetryBackoffStrategy();
10
+ maxAttemptsProvider;
11
+ constructor(maxAttempts) {
12
+ this.maxAttempts = maxAttempts;
13
+ this.maxAttemptsProvider = typeof maxAttempts === "function" ? maxAttempts : async () => maxAttempts;
14
+ }
15
+ async acquireInitialRetryToken(retryTokenScope) {
16
+ return createDefaultRetryToken({
17
+ retryDelay: DEFAULT_RETRY_DELAY_BASE,
18
+ retryCount: 0,
19
+ });
20
+ }
21
+ async refreshRetryTokenForRetry(token, errorInfo) {
22
+ const maxAttempts = await this.getMaxAttempts();
23
+ if (this.shouldRetry(token, errorInfo, maxAttempts)) {
24
+ const errorType = errorInfo.errorType;
25
+ this.retryBackoffStrategy.setDelayBase(errorType === "THROTTLING" ? THROTTLING_RETRY_DELAY_BASE : DEFAULT_RETRY_DELAY_BASE);
26
+ const delayFromErrorType = this.retryBackoffStrategy.computeNextBackoffDelay(token.getRetryCount());
27
+ const retryDelay = errorInfo.retryAfterHint
28
+ ? Math.max(errorInfo.retryAfterHint.getTime() - Date.now() || 0, delayFromErrorType)
29
+ : delayFromErrorType;
30
+ const capacityCost = this.getCapacityCost(errorType);
31
+ this.capacity -= capacityCost;
32
+ return createDefaultRetryToken({
33
+ retryDelay,
34
+ retryCount: token.getRetryCount() + 1,
35
+ retryCost: capacityCost,
36
+ });
37
+ }
38
+ throw new Error("No retry token available");
39
+ }
40
+ recordSuccess(token) {
41
+ this.capacity = Math.max(INITIAL_RETRY_TOKENS, this.capacity + (token.getRetryCost() ?? NO_RETRY_INCREMENT));
42
+ }
43
+ getCapacity() {
44
+ return this.capacity;
45
+ }
46
+ async getMaxAttempts() {
47
+ try {
48
+ return await this.maxAttemptsProvider();
49
+ }
50
+ catch (error) {
51
+ console.warn(`Max attempts provider could not resolve. Using default of ${DEFAULT_MAX_ATTEMPTS}`);
52
+ return DEFAULT_MAX_ATTEMPTS;
53
+ }
54
+ }
55
+ shouldRetry(tokenToRenew, errorInfo, maxAttempts) {
56
+ const attempts = tokenToRenew.getRetryCount() + 1;
57
+ return (attempts < maxAttempts &&
58
+ this.capacity >= this.getCapacityCost(errorInfo.errorType) &&
59
+ this.isRetryableError(errorInfo.errorType));
60
+ }
61
+ getCapacityCost(errorType) {
62
+ return errorType === "TRANSIENT" ? TIMEOUT_RETRY_COST : RETRY_COST;
63
+ }
64
+ isRetryableError(errorType) {
65
+ return errorType === "THROTTLING" || errorType === "TRANSIENT";
66
+ }
67
+ }
@@ -0,0 +1,7 @@
1
+ export var RETRY_MODES;
2
+ (function (RETRY_MODES) {
3
+ RETRY_MODES["STANDARD"] = "standard";
4
+ RETRY_MODES["ADAPTIVE"] = "adaptive";
5
+ })(RETRY_MODES || (RETRY_MODES = {}));
6
+ export const DEFAULT_MAX_ATTEMPTS = 3;
7
+ export const DEFAULT_RETRY_MODE = RETRY_MODES.STANDARD;
@@ -0,0 +1,9 @@
1
+ export const DEFAULT_RETRY_DELAY_BASE = 100;
2
+ export const MAXIMUM_RETRY_DELAY = 20 * 1000;
3
+ export const THROTTLING_RETRY_DELAY_BASE = 500;
4
+ export const INITIAL_RETRY_TOKENS = 500;
5
+ export const RETRY_COST = 5;
6
+ export const TIMEOUT_RETRY_COST = 10;
7
+ export const NO_RETRY_INCREMENT = 1;
8
+ export const INVOCATION_ID_HEADER = "amz-sdk-invocation-id";
9
+ export const REQUEST_HEADER = "amz-sdk-request";
@@ -0,0 +1,14 @@
1
+ import { DEFAULT_RETRY_DELAY_BASE, MAXIMUM_RETRY_DELAY } from "./constants";
2
+ export const getDefaultRetryBackoffStrategy = () => {
3
+ let delayBase = DEFAULT_RETRY_DELAY_BASE;
4
+ const computeNextBackoffDelay = (attempts) => {
5
+ return Math.floor(Math.min(MAXIMUM_RETRY_DELAY, Math.random() * 2 ** attempts * delayBase));
6
+ };
7
+ const setDelayBase = (delay) => {
8
+ delayBase = delay;
9
+ };
10
+ return {
11
+ computeNextBackoffDelay,
12
+ setDelayBase,
13
+ };
14
+ };
@@ -0,0 +1,11 @@
1
+ import { MAXIMUM_RETRY_DELAY } from "./constants";
2
+ export const createDefaultRetryToken = ({ retryDelay, retryCount, retryCost, }) => {
3
+ const getRetryCount = () => retryCount;
4
+ const getRetryDelay = () => Math.min(MAXIMUM_RETRY_DELAY, retryDelay);
5
+ const getRetryCost = () => retryCost;
6
+ return {
7
+ getRetryCount,
8
+ getRetryDelay,
9
+ getRetryCost,
10
+ };
11
+ };
@@ -0,0 +1,7 @@
1
+ export * from "./AdaptiveRetryStrategy";
2
+ export * from "./ConfiguredRetryStrategy";
3
+ export * from "./DefaultRateLimiter";
4
+ export * from "./StandardRetryStrategy";
5
+ export * from "./config";
6
+ export * from "./constants";
7
+ export * from "./types";
@@ -0,0 +1,33 @@
1
+ import type { Provider, RetryErrorInfo, RetryStrategyV2, RetryToken, StandardRetryToken } from "@smithy/types";
2
+ import type { RateLimiter } from "./types";
3
+ /**
4
+ * @public
5
+ *
6
+ * Strategy options to be passed to AdaptiveRetryStrategy
7
+ */
8
+ export interface AdaptiveRetryStrategyOptions {
9
+ rateLimiter?: RateLimiter;
10
+ }
11
+ /**
12
+ * @public
13
+ *
14
+ * The AdaptiveRetryStrategy is a retry strategy for executing against a very
15
+ * resource constrained set of resources. Care should be taken when using this
16
+ * retry strategy. By default, it uses a dynamic backoff delay based on load
17
+ * currently perceived against the downstream resource and performs circuit
18
+ * breaking to disable retries in the event of high downstream failures using
19
+ * the DefaultRateLimiter.
20
+ *
21
+ * @see {@link StandardRetryStrategy}
22
+ * @see {@link DefaultRateLimiter }
23
+ */
24
+ export declare class AdaptiveRetryStrategy implements RetryStrategyV2 {
25
+ private readonly maxAttemptsProvider;
26
+ private rateLimiter;
27
+ private standardRetryStrategy;
28
+ readonly mode: string;
29
+ constructor(maxAttemptsProvider: Provider<number>, options?: AdaptiveRetryStrategyOptions);
30
+ acquireInitialRetryToken(retryTokenScope: string): Promise<RetryToken>;
31
+ refreshRetryTokenForRetry(tokenToRenew: StandardRetryToken, errorInfo: RetryErrorInfo): Promise<RetryToken>;
32
+ recordSuccess(token: StandardRetryToken): void;
33
+ }