{"id":27416083,"url":"https://github.com/vcfvct/typescript-retry-decorator","last_synced_at":"2026-01-24T17:15:52.973Z","repository":{"id":39621408,"uuid":"158611256","full_name":"vcfvct/typescript-retry-decorator","owner":"vcfvct","description":"lightweight typescript retry decorator with 0 dependency.","archived":false,"fork":false,"pushed_at":"2026-01-20T02:21:55.000Z","size":361,"stargazers_count":95,"open_issues_count":1,"forks_count":16,"subscribers_count":3,"default_branch":"master","last_synced_at":"2026-01-20T08:51:46.154Z","etag":null,"topics":["annotation","decorator","retry","typescript"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vcfvct.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2018-11-21T22:02:15.000Z","updated_at":"2026-01-20T01:37:39.000Z","dependencies_parsed_at":"2024-06-02T20:20:20.852Z","dependency_job_id":"c3a65311-5e09-4380-a0b1-cb9d55ba38af","html_url":"https://github.com/vcfvct/typescript-retry-decorator","commit_stats":{"total_commits":38,"total_committers":6,"mean_commits":6.333333333333333,"dds":0.1578947368421053,"last_synced_commit":"29d9c35dd86e2ed8d7791b6fba0b1d0cef3477e2"},"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"purl":"pkg:github/vcfvct/typescript-retry-decorator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vcfvct%2Ftypescript-retry-decorator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vcfvct%2Ftypescript-retry-decorator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vcfvct%2Ftypescript-retry-decorator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vcfvct%2Ftypescript-retry-decorator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vcfvct","download_url":"https://codeload.github.com/vcfvct/typescript-retry-decorator/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vcfvct%2Ftypescript-retry-decorator/sbom","scorecard":{"id":917334,"data":{"date":"2025-08-11","repo":{"name":"github.com/vcfvct/typescript-retry-decorator","commit":"ef94209324e766770a34af06d2989ff5afc6a6dc"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.2,"checks":[{"name":"Code-Review","score":2,"reason":"Found 6/27 approved changesets -- score normalized to 2","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/ci.yml:1","Warn: no topLevel permission defined: .github/workflows/npm-publish.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/vcfvct/typescript-retry-decorator/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/vcfvct/typescript-retry-decorator/ci.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/vcfvct/typescript-retry-decorator/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:35: update your workflow using https://app.stepsecurity.io/secureworkflow/vcfvct/typescript-retry-decorator/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/npm-publish.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/vcfvct/typescript-retry-decorator/npm-publish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/npm-publish.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/vcfvct/typescript-retry-decorator/npm-publish.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/npm-publish.yml:21: update your workflow using https://app.stepsecurity.io/secureworkflow/vcfvct/typescript-retry-decorator/npm-publish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/npm-publish.yml:34: update your workflow using https://app.stepsecurity.io/secureworkflow/vcfvct/typescript-retry-decorator/npm-publish.yml/master?enable=pin","Info:   0 out of   6 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   2 third-party GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 20 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":2,"reason":"8 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-24T21:31:20.359Z","repository_id":39621408,"created_at":"2025-08-24T21:31:20.359Z","updated_at":"2025-08-24T21:31:20.359Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28732308,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-24T10:24:43.181Z","status":"ssl_error","status_checked_at":"2026-01-24T10:24:36.112Z","response_time":89,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["annotation","decorator","retry","typescript"],"created_at":"2025-04-14T09:46:31.324Z","updated_at":"2026-01-24T17:15:52.960Z","avatar_url":"https://github.com/vcfvct.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Retry](https://cdn.iconscout.com/icon/free/png-256/retry-1-386755.png)\n## A simple retry decorator for typescript with 0 dependency.\nThis is inspired by the [Spring-Retry project](https://github.com/spring-projects/spring-retry). Written in Typescript, *100%* Test Coverage.\n\nImport and use it. Retry for `Promise` is supported as long as the `runtime` has promise(nodejs/evergreen-browser).\n\n### Install\n\u003e npm install typescript-retry-decorator\n\nThis library supports both TypeScript's legacy (\"experimental\") decorators and TypeScript 5+ standard decorators.\n\n- If your project uses legacy decorators, enable [`experimentalDecorators`](https://www.typescriptlang.org/tsconfig#experimentalDecorators) in `tsconfig.json`.\n- If your project uses TypeScript 5+ standard decorators (no `experimentalDecorators`), it should work without extra config.\n\n\u003e TypeScript 5 note: this library also supports the new \"standard decorators\" call signature (`(value, context)`) at runtime. If you're using TS5+ standard decorators (without `experimentalDecorators`), it should work without extra config — see `ts5-decorator.md` for background.\n\n### Options\n| Option Name       |           Type           | Required? |                 Default                 |                                                    Description                                                    |\n|:-----------------:|:------------------------:|:---------:|:---------------------------------------:|:-----------------------------------------------------------------------------------------------------------------:|\n| maxAttempts       |          number          |    Yes    |                    -                    |                                              The max attempts to try                                              |\n| backOff           |          number          |    No     |                    0                    |                               number in `ms` to back off.  If not set, then no wait                               |\n| backOffPolicy     |           enum           |    No     |         FixedBackOffPolicy              |                                            can be fixed or exponential                                            |\n| exponentialOption |          object          |    No     | `{ maxInterval: 2000,  multiplier: 2 }` | This is for the `ExponentialBackOffPolicy` \u003cbr/\u003e The max interval each wait and the multiplier for the `backOff`. For `backoffStrategy`, more details below |\n| doRetry           |   (e: any) =\u003e boolean    |    No     |                    -                    |                        Function with error parameter to decide if repetition is necessary.                        |\n| value             |  Error/Exception class   |    No     |                   [ ]                   |                                  An array of Exception types that are retryable.                                  |\n| useConsoleLogger  |         boolean          |    No     |                  true                   |                                             Print errors on console.                                              |\n| useOriginalError  | throw original exception |    No     |                  false                  |    `MaxAttemptsError` by default. if this is set to *true*, the `original` exception would be thrown instead.     |\n\n#### Exponential options\n\nThe `exponentialOption` allows you to fine-tune the exponential backoff strategy using several options:\n- `maxInterval`: The maximum interval between two retries. The default value is 2000 ms.\n- `multiplier`: The multiplier to use to generate the next backoff interval from the last one. The default value is 2.\n- `backoffStrategy`: Optional.  If specified, determines the strategy used to introduce \"jitter\" between retry intervals.  For an explanation of the available strategies and why you might select one over the other, check out [this article](https://aws.amazon.com/blogs/architecture/exponential-backoff-and-jitter/).\n  - `ExponentialBackoffStrategy.FullJitter`: The base backoff interval is multiplied by a random number between 0 and 1.\n  - `ExponentialBackoffStrategy.EqualJitter`: The backoff interval is (base interval / 2) + (random value between 0 and base interval / 2).\n\n### Example\n```typescript\nimport { Retryable, BackOffPolicy } from 'typescript-retry-decorator';\n\nlet count: number = 1;\n\nclass RetryExample {\n  @Retryable({ maxAttempts: 3 })\n  static async noDelayRetry() {\n    console.info(`Calling noDelayRetry for the ${count++} time at ${new Date().toLocaleTimeString()}`);\n    throw new Error('I failed!');\n  }\n\n  @Retryable({ \n    maxAttempts: 3, \n    value: [SyntaxError, ReferenceError]\n  })\n  static async noDelaySpecificRetry(): Promise\u003cvoid\u003e {\n    console.info(`Calling noDelaySpecificRetry for the ${count++} time at ${new Date().toLocaleTimeString()}`);\n    throw new SyntaxError('I failed with SyntaxError!');\n  }\n\n  @Retryable({ \n    maxAttempts: 3,\n    backOff: 1000,\n    doRetry: (e: Error) =\u003e {\n      return e.message === 'Error: 429';\n    }\n   })\n  static async doRetry() {\n    console.info(`Calling doRetry for the ${count++} time at ${new Date().toLocaleTimeString()}`);\n    throw new Error('Error: 429');\n  }\n\n  @Retryable({ \n    maxAttempts: 3,\n    backOff: 1000,\n    doRetry: (e: Error) =\u003e {\n      return e.message === 'Error: 429';\n    }\n   })\n  static async doNotRetry() {\n    console.info(`Calling doNotRetry for the ${count++} time at ${new Date().toLocaleTimeString()}`);\n    throw new Error('Error: 404');\n  }\n\n  @Retryable({\n    maxAttempts: 3,\n    backOffPolicy: BackOffPolicy.FixedBackOffPolicy,\n    backOff: 1000\n  })\n  static async fixedBackOffRetry() {\n    console.info(`Calling fixedBackOffRetry 1s for the ${count++} time at ${new Date().toLocaleTimeString()}`);\n    throw new Error('I failed!');\n  }\n\n  @Retryable({\n    maxAttempts: 3,\n    backOffPolicy: BackOffPolicy.ExponentialBackOffPolicy,\n    backOff: 1000,\n    exponentialOption: { maxInterval: 4000, multiplier: 3 }\n  })\n  static async ExponentialBackOffRetry() {\n    console.info(`Calling ExponentialBackOffRetry backOff 1s, multiplier=3 for the ${count++} time at ${new Date().toLocaleTimeString()}`);\n    throw new Error('I failed!');\n  }\n\n  @Retryable({\n    maxAttempts: 3,\n    backOffPolicy: BackOffPolicy.ExponentialBackOffPolicy,\n    backOff: 1000,\n    exponentialOption: { maxInterval: 4000, multiplier: 2, backoffStrategy: ExponentialBackoffStrategy.EqualJitter }\n  })\n  static async ExponentialBackOffWithJitterRetry() {\n    console.info(`Calling ExponentialBackOffWithJitterRetry backOff 1s, multiplier=2 for the ${count++} time at ${new Date().toLocaleTimeString()}`);\n    throw new Error('I failed!');\n  }\n}\n\n(async () =\u003e {\n  try {\n    resetCount();\n    await RetryExample.noDelayRetry();\n  } catch (e) {\n    console.info(`All retry done as expected, final message: '${e.message}'`);\n  }\n\n  try {\n    resetCount();\n    await RetryExample.doRetry();\n  } catch (e) {\n    console.info(`All retry done as expected, final message: '${e.message}'`);\n  }\n\n  try {\n    resetCount();\n    await RetryExample.doNotRetry();\n  } catch (e) {\n    console.info(`All retry done as expected, final message: '${e.message}'`);\n  }\n\n  try {\n    resetCount();\n    await RetryExample.fixedBackOffRetry();\n  } catch (e) {\n    console.info(`All retry done as expected, final message: '${e.message}'`);\n  }\n\n  try {\n    resetCount();\n    await RetryExample.ExponentialBackOffRetry();\n  } catch (e) {\n    console.info(`All retry done as expected, final message: '${e.message}'`);\n  }\n\n  try {\n    resetCount();\n    await RetryExample.ExponentialBackOffWithJitterRetry();\n  } catch (e) {\n    console.info(`All retry done as expected, final message: '${e.message}'`);\n  }\n\n})();\n\nfunction resetCount() {\n  count = 1;\n}\n```\n\nRun the above code with `ts-node`, then output will be:\n```\nCalling noDelayRetry for the 1 time at 4:12:49 PM\nCalling noDelayRetry for the 2 time at 4:12:49 PM\nCalling noDelayRetry for the 3 time at 4:12:49 PM\nCalling noDelayRetry for the 4 time at 4:12:49 PM\nI failed!\nAll retry done as expected, final message: 'Failed for 'noDelayRetry' for 3 times.'\nCalling noDelayRetry for the 1 time at 4:12:49 PM\nCalling noDelayRetry for the 2 time at 4:12:49 PM\nCalling noDelayRetry for the 3 time at 4:12:49 PM\nCalling noDelayRetry for the 4 time at 4:12:49 PM\nI failed with SyntaxError!\nAll retry done as expected, final message: 'Failed for 'noDelaySpecificRetry' for 3 times.'\nCalling doRetry for the 1 time at 4:12:49 PM\nCalling doRetry for the 2 time at 4:12:50 PM\nCalling doRetry for the 3 time at 4:12:51 PM\nCalling doRetry for the 4 time at 4:12:52 PM\nError: 429\nAll retry done as expected, final message: 'Failed for 'doRetry' for 3 times.'\nCalling doNotRetry for the 1 time at 4:12:52 PM\nAll retry done as expected, final message: 'Error: 404'\nCalling fixedBackOffRetry 1s for the 1 time at 4:12:52 PM\nCalling fixedBackOffRetry 1s for the 2 time at 4:12:53 PM\nCalling fixedBackOffRetry 1s for the 3 time at 4:12:54 PM\nCalling fixedBackOffRetry 1s for the 4 time at 4:12:55 PM\nI failed!\nAll retry done as expected, final message: 'Failed for 'fixedBackOffRetry' for 3 times.'\nCalling ExponentialBackOffRetry backOff 1s, multiplier=3 for the 1 time at 4:12:55 PM\nCalling ExponentialBackOffRetry backOff 1s, multiplier=3 for the 2 time at 4:12:56 PM\nCalling ExponentialBackOffRetry backOff 1s, multiplier=3 for the 3 time at 4:12:59 PM\nCalling ExponentialBackOffRetry backOff 1s, multiplier=3 for the 4 time at 4:13:03 PM\nI failed!\nAll retry done as expected, final message: 'Failed for 'ExponentialBackOffRetry' for 3 times.'\nCalling ExponentialBackOffWithJitterRetry backOff 1s, multiplier=2 for the 1 time at 4:13:03 PM\nCalling ExponentialBackOffWithJitterRetry backOff 1s, multiplier=2 for the 2 time at 4:13:03 PM\nCalling ExponentialBackOffWithJitterRetry backOff 1s, multiplier=2 for the 3 time at 4:13:05 PM\nCalling ExponentialBackOffWithJitterRetry backOff 1s, multiplier=2 for the 4 time at 4:13:09 PM\nI failed!\nAll retry done as expected, final message: 'Failed for 'ExponentialBackOffWithJitterRetry' for 3 times.'\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvcfvct%2Ftypescript-retry-decorator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvcfvct%2Ftypescript-retry-decorator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvcfvct%2Ftypescript-retry-decorator/lists"}