{"name":"@smithy/util-retry","version":"4.0.1","description":"Shared retry utilities to be used in middleware packages.","main":"./dist-cjs/index.js","module":"./dist-es/index.js","scripts":{"build":"concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types && yarn build:types:downlevel'","build:cjs":"node ../../scripts/inline util-retry","build:es":"yarn g:tsc -p tsconfig.es.json","build:types":"yarn g:tsc -p tsconfig.types.json","build:types:downlevel":"rimraf dist-types/ts3.4 && downlevel-dts dist-types dist-types/ts3.4","stage-release":"rimraf ./.release && yarn pack && mkdir ./.release && tar zxvf ./package.tgz --directory ./.release && rm ./package.tgz","clean":"rimraf ./dist-* && rimraf *.tsbuildinfo || exit 0","lint":"eslint -c ../../.eslintrc.js \"src/**/*.ts\"","format":"prettier --config ../../prettier.config.js --ignore-path ../.prettierignore --write \"**/*.{ts,md,json}\"","extract:docs":"api-extractor run --local","test":"yarn g:vitest run","test:watch":"yarn g:vitest watch"},"keywords":["aws","retry"],"author":{"name":"AWS SDK for JavaScript Team","url":"https://aws.amazon.com/javascript/"},"license":"Apache-2.0","dependencies":{"@smithy/service-error-classification":"^4.0.1","@smithy/types":"^4.1.0","tslib":"^2.6.2"},"devDependencies":{"@types/node":"^18.11.9","concurrently":"7.0.0","downlevel-dts":"0.10.1","rimraf":"3.0.2","typedoc":"0.23.23"},"types":"./dist-types/index.d.ts","engines":{"node":">=18.0.0"},"typesVersions":{"<4.0":{"types/*":["types/ts3.4/*"]}},"homepage":"https://github.com/awslabs/smithy-typescript/tree/master/packages/util-retry","repository":{"type":"git","url":"git+https://github.com/awslabs/smithy-typescript.git","directory":"packages/util-retry"},"typedoc":{"entryPoint":"src/index.ts"},"publishConfig":{"directory":".release/package"},"_id":"@smithy/util-retry@4.0.1","gitHead":"c3c05d50e61d501a7e310c17d4fed996d3546fbb","bugs":{"url":"https://github.com/awslabs/smithy-typescript/issues"},"_nodeVersion":"18.20.5","_npmVersion":"10.8.2","dist":{"integrity":"sha512-WmRHqNVwn3kI3rKk1LsKcVgPBG6iLTBGC1iYOV3GQegwJ3E8yjzHytPt26VNzOWr1qu0xE03nK0Ug8S7T7oufw==","shasum":"fb5f26492383dcb9a09cc4aee23a10f839cd0769","tarball":"http://registry-npm.ywwl.com/@smithy/util-retry/download/@smithy/util-retry-4.0.1.tgz","fileCount":43,"unpackedSize":57177,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCz65xWfNWy9cSJo8qCfBbLMEd0aJZ1lrS/SQRj/ETilwIgVJFj9L6mTHgO+bHdevC3XjhVo2Rba8Cm2jDjAQSbEvo="}],"size":13818,"noattachment":false,"key":"/@smithy/util-retry/-/@smithy/util-retry-4.0.1.tgz"},"_npmUser":{"name":"smithy-team","email":"aws-smithy-team+npm@amazon.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/util-retry_4.0.1_1736445174263_0.9109465217354837"},"_hasShrinkwrap":false,"readme":"# @smithy/util-retry\n\n[![NPM version](https://img.shields.io/npm/v/@smithy/util-retry/latest.svg)](https://www.npmjs.com/package/@smithy/util-retry)\n[![NPM downloads](https://img.shields.io/npm/dm/@smithy/util-retry.svg)](https://www.npmjs.com/package/@smithy/util-retry)\n\nThis package provides shared utilities for retries.\n\n## Usage\n\n### Default\n\nBy default, each client already has a default retry strategy. The default retry count is 3, and\nonly retryable errors will be retried.\n\n[AWS Documentation: Retry behavior](https://docs.aws.amazon.com/sdkref/latest/guide/feature-retry-behavior.html).\n\n```js\nimport { S3Client } from \"@aws-sdk/client-s3\";\n\nconst client = new S3Client({}); // default retry strategy included.\n```\n\n### MaxAttempts\n\nIf you want to change the number of attempts, you can provide `maxAttempts` configuration during client creation.\n\n```js\nimport { S3Client } from \"@aws-sdk/client-s3\";\n\nconst client = new S3Client({ maxAttempts: 4 });\n```\n\nThis is recommended because the `StandardRetryStrategy` includes backoff calculation,\ndeciding whether an error should be retried, and a retry token counter.\n\n### MaxAttempts and BackoffComputation\n\nIf you want to change the number of attempts and use a custom delay\ncomputation, you can use the `ConfiguredRetryStrategy` from `@smithy/util-retry`.\n\n```js\nimport { S3Client } from \"@aws-sdk/client-s3\";\nimport { ConfiguredRetryStrategy } from \"@smithy/util-retry\";\n\nconst client = new S3Client({\n  retryStrategy: new ConfiguredRetryStrategy(\n    4, // max attempts.\n    (attempt: number) => 100 + attempt * 1000 // backoff function.\n  ),\n});\n```\n\nThis example sets the backoff at 100ms plus 1s per attempt.\n\n### MaxAttempts and RetryStrategy\n\nIf you provide both `maxAttempts` and `retryStrategy`, the `retryStrategy` will\nget precedence as it's more specific.\n\n```js\nimport { S3Client } from \"@aws-sdk/client-s3\";\nimport { ConfiguredRetryStrategy } from \"@smithy/util-retry\";\n\nconst client = new S3Client({\n  maxAttempts: 2, // ignored.\n  retryStrategy: new ConfiguredRetryStrategy(\n    4, // used.\n    (attempt: number) => 100 + attempt * 1000 // backoff function.\n  ),\n});\n```\n\n### Further customization\n\nYou can implement the `RetryStrategyV2` interface.\n\nSource: https://github.com/awslabs/smithy-typescript/blob/main/packages/types/src/retry.ts\nAPI Docs: https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-smithy-types/Interface/RetryStrategyV2/\n","publish_time":1736445174436,"maintainers":[{"name":"trivikr-aws","email":"trivikr@amazon.com"},{"name":"smithy-team","email":"aws-smithy-team+npm@amazon.com"},{"name":"aws-sdk-bot","email":"aws-sdk-js-automation@amazon.com"}],"_cnpm_publish_time":1736445174436,"dist-tags":{"latest":"4.6.2"}}