{"id":22986682,"url":"https://github.com/mkg0/promise-effects","last_synced_at":"2026-06-28T22:31:23.149Z","repository":{"id":42868472,"uuid":"139241175","full_name":"mkg0/promise-effects","owner":"mkg0","description":"Promise effects like retry, timeout, observation over promises for advanced use cases or test purposes.","archived":false,"fork":false,"pushed_at":"2023-01-06T04:23:08.000Z","size":1197,"stargazers_count":3,"open_issues_count":10,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-30T21:22:36.231Z","etag":null,"topics":["async","cancelablepromise","observe-promise","polling","promise","promise-retry","retry","timeout","wait"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mkg0.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-06-30T10:42:47.000Z","updated_at":"2023-08-19T17:59:36.000Z","dependencies_parsed_at":"2023-02-05T07:16:34.824Z","dependency_job_id":null,"html_url":"https://github.com/mkg0/promise-effects","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/mkg0/promise-effects","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkg0%2Fpromise-effects","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkg0%2Fpromise-effects/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkg0%2Fpromise-effects/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkg0%2Fpromise-effects/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mkg0","download_url":"https://codeload.github.com/mkg0/promise-effects/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkg0%2Fpromise-effects/sbom","scorecard":{"id":652370,"data":{"date":"2025-08-11","repo":{"name":"github.com/mkg0/promise-effects","commit":"be6dddaa8c1d4e1e6aae25450194e792c610f770"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.4,"checks":[{"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":"Code-Review","score":0,"reason":"Found 0/22 approved changesets -- score normalized to 0","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":"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":"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":"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":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/changelog.yml:1","Warn: no topLevel permission defined: .github/workflows/test.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":4,"reason":"dependency not pinned by hash detected -- score normalized to 4","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/changelog.yml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/mkg0/promise-effects/changelog.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/changelog.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/mkg0/promise-effects/changelog.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/mkg0/promise-effects/test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/mkg0/promise-effects/test.yml/master?enable=pin","Info:   0 out of   3 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 third-party GitHubAction dependencies pinned","Info:   1 out of   1 npmCommand 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":"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":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"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":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"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 4 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":0,"reason":"31 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-v88g-cgmw-v5xw","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","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-gxpj-cx7g-858c","Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-ww39-953v-wcq6","Warn: Project is vulnerable to: GHSA-896r-f27r-55mw","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-5fw9-fq32-wv5p","Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9","Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp","Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-44c6-4v22-4mhx","Warn: Project is vulnerable to: GHSA-4x5v-gmq8-25ch","Warn: Project is vulnerable to: GHSA-52f5-9888-hmc6","Warn: Project is vulnerable to: GHSA-jgrx-mgxx-jf9v","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3","Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7","Warn: Project is vulnerable to: GHSA-6fc8-4gx4-v693","Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q"],"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-21T13:48:42.940Z","repository_id":42868472,"created_at":"2025-08-21T13:48:42.940Z","updated_at":"2025-08-21T13:48:42.940Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34906700,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-28T02:00:05.809Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["async","cancelablepromise","observe-promise","polling","promise","promise-retry","retry","timeout","wait"],"created_at":"2024-12-15T03:51:16.702Z","updated_at":"2026-06-28T22:31:23.130Z","avatar_url":"https://github.com/mkg0.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"Promise Effects\n=================================\n\n[![npm](https://img.shields.io/npm/v/promise-effects)](https://www.npmjs.com/package/promise-effects)\n[![npm](https://img.shields.io/npm/l/promise-effects)]()\n\nFully typed promise effects to play with async handlers in a pleasent way.\n\n| Effect                            | Desc                                                  |\n|-----------------------------------|-------------------------------------------------------|\n| [retryPromise](#retryPromise)     | Converts a promise creator to repetitive              |\n| [wait](#wait)                     | Creates a promise to resolve for the given time long. |\n| [observePromise](#observePromise) | Creates observable promises from the given promise    |\n| [timeout](#timeout)               | Timeout example                                       |\n| Polling                           | ⏱ Polling example                                     |\n| Latest                            | ⏱                                                     |\n| CancelablePromise\u003cT\u003e              | ⏱                                                     |\n\n## Usage\n\nInstall package\n```sh\nnpm install promise-effects\n```\n\nImport module\n```js\nimport { retryPromise } from 'promise-effects'\n// or\nimport retryPromise from 'promise-effects/retryPromise'\n```\n\n## Effects\n\n### **RetryPromise**\n\nIt's a high-order function that gives the capabilify of retry to a function that creates promise.\n\n```js\nconst repetitiveFetch = retryPromise(fetch, {\n  retry: 3,\n  onReconnecting: ({ attemptNumber }) =\u003e console.log(`Fetching has failed(${attemptNumber})... Retrying...`),\n})\nrepetitiveFetch('https://www.mocky.io/v2/5185415ba171ea3a00704eed')\n  .then(resp=\u003e resp.json())\n  .then(console.log)\n  .catch(() =\u003e console.log('Failed!'))\n// \u003e Fetching has failed(1)... Retrying...\n// \u003e Fetching has failed(2)... Retrying...\n// \u003e Fetching has failed(3)... Retrying...\n// \u003e Failed!\n```\n\n#### Options\n\n| Option Name    | Type                                                                                        |\n|----------------|---------------------------------------------------------------------------------------------|\n| onReconnecting | `fn:({attemptNumber: number,  remainingTries: number,  error: Error})`                      |\n| delay          | `number`                                                                                    |\n| delay          | `{ delay: number, factor: number, max?: number, min?: number }`                             |\n| delay          | `fn: ({attemptNumber: number,  remainingTries: number,  error: Error}) =\u003e number | Promise` |\n| shouldRetry    | `fn: ({attemptNumber: number,  remainingTries: number,  error: Error}) =\u003e booleaan |Promise\u003cboolean\u003e`         |\n| retry          | `number`                                                                                    |\n\n\n\n### **observePromise**\n\nIt wraps promises to observe the status. You can get if the promise `fulfilled`, `rejected` or `pending`. It's beneficial on test purposes. \n\n```js\nconst observed = observePromise(fetch('http://google.com'))\nconsole.log(observed.isPending()) // \u003e true\nconsole.log(observed.isRejected()) // \u003e false\nconsole.log(observed.isFulfilled()) // \u003e false\nconsole.log(observed.status) // \u003e 'PENDING'\nobserved\n  .then(result=\u003e {\n    console.log(observed.status) // \u003e 'RESOLVED'\n    console.log(observed.isFulfilled()) // \u003e true\n  })\n  .catch(() =\u003e {\n    console.log(observed.status) // \u003e 'REJECTED'\n    console.log(observed.isRejected()) // \u003e true\n  })\n```\n\n### **wait**\n\nCreates a promise to resolve for the given time long.\n\n```js\nconst printMessage = (count=0) =\u003e\n  Promise.resolve()\n    .then(() =\u003e console.log(`You will see this message every second(${count})`))\n    .then(() =\u003e wait(1000).then(() =\u003e printMessage(count + 1)))\n\nprintMessage()\n// \u003e You will see this message every second(0)\n// \u003e You will see this message every second(1)\n// \u003e You will see this message every second(2)\n// \u003e You will see this message every second(3)\n// \u003e ...\n```\n\n\n### **timeout**\n\nYou don't need an exclusive timeout function for timeout. Use `wait` with [ES Promise.race](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/race) instead.\n\n\n```js\n  // fail in 1 sec\n  Promise.race([\n    fetch('https://www.mocky.io/v2/5185415ba171ea3a00704eed?mocky-delay=1200ms').then(res=\u003e resp.json()),\n    wait(1000).then(()=\u003e Promise.reject('Timeout!'))\n  ])\n  // \u003e Uncaught (in promise) Timeout!\n```\n\n```js\n  // will mock response if the first request doesn't resolve in 1 sec\n  const result = await Promise.race([\n    fetch('https://www.mocky.io/v2/5185415ba171ea3a00704eed?mocky-delay=1200ms').then(res=\u003e resp.json()),\n    wait(1000).then(()=\u003e ({ hello: 'mock' }))\n  ])\n  console.log(result)\n  // \u003e { hello: 'mock' }\n```\n\n## Changelog\n\nAll notable changes to this project will be documented in the [changelog file](https://github.com/mkg0/promise-effects/blob/master/CHANGELOG.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmkg0%2Fpromise-effects","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmkg0%2Fpromise-effects","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmkg0%2Fpromise-effects/lists"}