{"id":34624036,"url":"https://github.com/sushichan044/universal-idempotent-request","last_synced_at":"2026-05-26T00:31:23.985Z","repository":{"id":283485084,"uuid":"951921106","full_name":"sushichan044/universal-idempotent-request","owner":"sushichan044","description":"A framework-agnosticmiddleware implementing the HTTP Idempotency-Key draft.","archived":false,"fork":false,"pushed_at":"2025-10-20T13:24:37.000Z","size":922,"stargazers_count":1,"open_issues_count":17,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-25T12:42:21.753Z","etag":null,"topics":["idempotency-key","middleware-library","typescript","universal-middleware"],"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/sushichan044.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,"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},"funding":{"github":"sushichan044"}},"created_at":"2025-03-20T13:01:05.000Z","updated_at":"2025-07-21T14:23:08.000Z","dependencies_parsed_at":"2025-04-07T16:24:22.508Z","dependency_job_id":"1e5cc265-0e66-4c32-8766-d3924ab314af","html_url":"https://github.com/sushichan044/universal-idempotent-request","commit_stats":null,"previous_names":["sushichan044/hono-idempotent-request","sushichan044/universal-idempotent-request"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/sushichan044/universal-idempotent-request","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sushichan044%2Funiversal-idempotent-request","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sushichan044%2Funiversal-idempotent-request/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sushichan044%2Funiversal-idempotent-request/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sushichan044%2Funiversal-idempotent-request/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sushichan044","download_url":"https://codeload.github.com/sushichan044/universal-idempotent-request/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sushichan044%2Funiversal-idempotent-request/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33498777,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-25T14:31:05.219Z","status":"ssl_error","status_checked_at":"2026-05-25T14:31:02.878Z","response_time":57,"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":["idempotency-key","middleware-library","typescript","universal-middleware"],"created_at":"2025-12-24T15:43:44.531Z","updated_at":"2026-05-26T00:31:23.795Z","avatar_url":"https://github.com/sushichan044.png","language":"TypeScript","funding_links":["https://github.com/sponsors/sushichan044"],"categories":[],"sub_categories":[],"readme":"# universal-idempotent-request\n\n[![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/sushichan044/universal-idempotent-request)\n\nA framework-agnostic library implementing the HTTP Idempotency-Key draft ([draft-ietf-httpapi-idempotency-key-header-06](https://datatracker.ietf.org/doc/html/draft-ietf-httpapi-idempotency-key-header-06)) for server-side request handling.\n\nSee [examples](./examples) for sample implementations.\n\n\u003c!-- TOC --\u003e\n\n- [universal-idempotent-request](#universal-idempotent-request)\n  - [Core Concepts](#core-concepts)\n  - [Installation](#installation)\n    - [Framework Integration](#framework-integration)\n  - [Important Point](#important-point)\n    - [Endpoint implementations that should not use this middleware](#endpoint-implementations-that-should-not-use-this-middleware)\n  - [Build your own implementation](#build-your-own-implementation)\n  - [Contribution Guide](#contribution-guide)\n\n\u003c!-- /TOC --\u003e\n\n## Core Concepts\n\n- **Framework Agnostic**: powered by [universal-middleware](https://github.com/magne4000/universal-middleware)\n- **Easy Installation**: Integrate into existing applications in a minute.\n- **Bring your own implementation**: Customizable conditions for enabling idempotency, request identity conditions, etc.\n\n## Installation\n\nInstall core package from npm:\n\n```bash\npnpm add universal-idempotent-request\n# or\nnpm install universal-idempotent-request\n# or\nyarn add universal-idempotent-request\n```\n\n### Framework Integration\n\nYou must install additional adapters to integrate with frameworks.\n\nSee [integration-tests](./integration-tests/) for minimal framework integration.\n\nFramework support status:\n\n- [x] hono\n- [x] h3 (only v1 support)\n- [x] elysia\n- [x] hattip\n- [ ] express (May work, but unverified)\n- [ ] fastify (May work, but unverified)\n\nAs an example, you can start using this middleware in Hono like this:\n\n```ts\nimport { createMiddleware } from \"@universal-middleware/hono\";\nimport { Hono } from \"hono\";\nimport { idempotentRequestUniversalMiddleware } from \"universal-idempotent-request\";\n\nconst app = new Hono();\n\nconst idempotentRequestMiddleware = createMiddleware(\n  idempotentRequestUniversalMiddleware,\n);\n\napp.on([\"POST\", \"PATCH\"], \"/api/*\", idempotentRequestMiddleware(\n  activationStrategy: \"always\", // Default behavior\n  server: {\n    specification: // Bring your own specification\n  },\n  storage: {\n    adapter: // Bring your own specification\n  }\n  // Hooks are optional. Useful for customizing response.\n  hooks: {\n    modifyResponse: (response, type) =\u003e {\n      response.headers.set(\"X-Idempotency-Status\", type);\n      return response;\n    },\n  }\n))\n```\n\n## Important Point\n\n### Endpoint implementations that should not use this middleware\n\nThis middleware may not work correctly with endpoints that use HTTP Streaming, Server-Sent Events (SSE), or WebSocket connections.\nThese protocols establish long-lived connections that may prevent proper response capturing and storage for idempotent requests.\nIt is recommended to disable this middleware for such endpoints.\n\n## Build your own implementation\n\nThis middleware implements only abstract processing according to Draft.\n\nTherefore, it is necessary to implement and inject the connection to storage, request identity determination, etc.\n\nSee `IdempotentRequestImplementation` in [middleware.ts](./src/middleware.ts) for acceptable implementations.\n\nSee [examples](./examples/) for sample implementations.\n\n## Contribution Guide\n\nWIP\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsushichan044%2Funiversal-idempotent-request","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsushichan044%2Funiversal-idempotent-request","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsushichan044%2Funiversal-idempotent-request/lists"}