{"id":28332052,"url":"https://github.com/causaly/fp-ts-timeout","last_synced_at":"2025-08-02T16:35:30.355Z","repository":{"id":257807222,"uuid":"866465057","full_name":"causaly/fp-ts-timeout","owner":"causaly","description":"Timeout functionality for fp-ts async structures","archived":false,"fork":false,"pushed_at":"2025-07-21T07:24:21.000Z","size":746,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":10,"default_branch":"main","last_synced_at":"2025-07-21T09:23:57.616Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/causaly.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"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}},"created_at":"2024-10-02T10:05:21.000Z","updated_at":"2025-07-21T07:24:25.000Z","dependencies_parsed_at":"2024-10-02T14:16:14.872Z","dependency_job_id":"cf824d7a-364f-4a98-8365-649ea63147a1","html_url":"https://github.com/causaly/fp-ts-timeout","commit_stats":null,"previous_names":["causaly/fp-ts-timeout"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/causaly/fp-ts-timeout","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/causaly%2Ffp-ts-timeout","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/causaly%2Ffp-ts-timeout/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/causaly%2Ffp-ts-timeout/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/causaly%2Ffp-ts-timeout/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/causaly","download_url":"https://codeload.github.com/causaly/fp-ts-timeout/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/causaly%2Ffp-ts-timeout/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268420677,"owners_count":24247758,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-02T02:00:12.353Z","response_time":74,"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":[],"created_at":"2025-05-26T19:26:58.933Z","updated_at":"2025-08-02T16:35:30.344Z","avatar_url":"https://github.com/causaly.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fp-ts-timeout\n\nTimeout functionality for fp-ts async structures.\n\n[![Build Status](https://github.com/causaly/fp-ts-timeout/actions/workflows/ci.yml/badge.svg)](https://github.com/causaly/fp-ts-timeout/actions/workflows/ci.yml) [![npm version](https://img.shields.io/npm/v/fp-ts-timeout.svg?color=0c0)](https://www.npmjs.com/package/fp-ts-timeout)\n\n## Installation\n\n```bash\nnpm install fp-ts-timeout\n```\n\n#### Requirements\n\n- Node.js v.18+\n- TypeScript v.4.5+\n\n## API\n\n- [withTaskEitherTimeout(number)](#withtaskeithertimeout)\n- [withReaderTaskEitherTimeout(number)](#withreadertaskeithertimeout)\n- [TimeoutError](#timeouterror)\n- [withTaskEitherRetry(options)](#withreadertaskeitherretry)\n- [withReaderTaskEitherRetry(options)](#withreadertaskeitherretry)\n\n### withTaskEitherTimeout\n\nA higher-order function for setting a timeout on asynchronous operations.\n\n#### Example\n\n```typescript\nimport * as Either from 'fp-ts/Either';\nimport * as TaskEither from 'fp-ts/TaskEither';\nimport { withTaskEitherTimeout, isTimeoutError } from 'fp-ts-timeout';\n\npipe(\n  TaskEither.tryCatch(\n    () =\u003e {\n      // some async operation\n    }),\n    Either.toError\n  ),\n  withTaskEitherTimeout(1000) // 1 second timeout\n  TaskEither.match(\n    (error) =\u003e {\n      if (isTimeoutError(error)) {\n        // handle timeout error\n      } else {\n        // handle other errors\n      }\n    },\n    (result) =\u003e {\n      // handle success\n    }\n)\n```\n\n### withReaderTaskEitherTimeout\n\nA higher-order function for setting a timeout on asynchronous operations.\n\n#### Example\n\n```typescript\nimport * as Either from 'fp-ts/Either';\nimport * as TaskEither from 'fp-ts/TaskEither';\nimport * as ReaderTaskEither from 'fp-ts/ReaderTaskEither';\nimport { withTaskEitherTimeout, isTimeoutError } from 'fp-ts-timeout';\n\npipe(\n  TaskEither.tryCatch(\n    () =\u003e {\n      // some async operation\n    }),\n    Either.toError\n  ),\n  ReaderTaskEither.fromTaskEither,\n  withReaderTaskEitherTimeout(1000), // 1 second timeout\n  TaskEither.match(\n    (error) =\u003e {\n      if (isTimeoutError(error)) {\n        // handle timeout error\n      } else {\n        // handle other errors\n      }\n    },\n    (result) =\u003e {\n      // handle success\n    }\n)\n```\n\n### TimeoutError\n\nCustom error thrown when an asynchronous operation exceeds the defined timeout limit.\n\n### withTaskEitherRetry\n\nA higher-order function for retrying asynchronous operations, utilizing [p-retry](https://www.npmjs.com/package/p-retry) under the hood. Refer to the package documentation for available [options](https://github.com/sindresorhus/p-retry?tab=readme-ov-file#options) and details.\n\n#### Example\n\n```typescript\nimport * as Either from 'fp-ts/Either';\nimport * as TaskEither from 'fp-ts/TaskEither';\nimport { withTaskEitherRetry } from 'fp-ts-timeout';\n\npipe(\n  TaskEither.tryCatch(\n    () =\u003e {\n      // some async operation\n    }),\n    Either.toError\n  ),\n  withTaskEitherRetry({ retries: 2 }),\n  TaskEither.match(\n    (error) =\u003e {\n      // handle errors\n    },\n    (result) =\u003e {\n      // handle success\n    }\n)\n```\n\n### withReaderTaskEitherRetry\n\nA higher-order function for retrying asynchronous operations, utilizing [p-retry](https://www.npmjs.com/package/p-retry) under the hood. Refer to the package documentation for available [options](https://github.com/sindresorhus/p-retry?tab=readme-ov-file#options) and details.\n\n#### Example\n\n```typescript\nimport * as Either from 'fp-ts/Either';\nimport * as TaskEither from 'fp-ts/TaskEither';\nimport * as ReaderTaskEither from 'fp-ts/ReaderTaskEither';\nimport { withReaderTaskEitherRetry } from 'fp-ts-timeout';\n\npipe(\n  TaskEither.tryCatch(\n    () =\u003e {\n      // some async operation\n    }),\n    Either.toError\n  ),\n  ReaderTaskEither.fromTaskEither,\n  withReaderTaskEitherRetry({ retries: 2 }),\n  TaskEither.match(\n    (error) =\u003e {\n      // handle errors\n    },\n    (result) =\u003e {\n      // handle success\n    }\n)\n```\n\n\n## Contribute\n\nSource code contributions are most welcome. Please open a PR, ensure the linter is satisfied and all tests pass.\n\n#### We are hiring\n\nCausaly is building the world's largest biomedical knowledge platform, using technologies such as TypeScript, React and Node.js. Find out more about our openings at https://apply.workable.com/causaly/.\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcausaly%2Ffp-ts-timeout","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcausaly%2Ffp-ts-timeout","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcausaly%2Ffp-ts-timeout/lists"}