{"_id":"@bounkhong/idempotency-nestjs","name":"@bounkhong/idempotency-nestjs","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@bounkhong/idempotency-nestjs","version":"0.1.0","description":"NestJS integration module for AIF idempotency core","license":"MIT","author":{"name":"Bounkhong","url":"AIF"},"repository":{"type":"git","url":"git+https://github.com/aif/idempotency-package.git"},"bugs":{"url":"https://github.com/aif/idempotency-package/issues"},"homepage":"https://github.com/aif/idempotency-package#readme","keywords":["idempotency","nestjs","nodejs","backend"],"type":"module","main":"dist/index.js","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"publishConfig":{"access":"public"},"dependencies":{"@nestjs/common":"^10.4.15","@nestjs/core":"^10.4.15","reflect-metadata":"^0.2.2","rxjs":"^7.8.1","@bounkhong/idempotency-core":"0.1.0"},"scripts":{"build":"tsc -p tsconfig.json","test":"vitest run --passWithNoTests","lint":"tsc -p tsconfig.json --noEmit","typecheck":"tsc -p tsconfig.json --noEmit"},"_id":"@bounkhong/idempotency-nestjs@0.1.0","_integrity":"sha512-laSltvn3lOJ61hvbv4y1HY54+RSmmXFAaHhUEZQZtRxPq/PeHrecnGIYxgcrY++hbfDwichC2hg222WMoieq1Q==","_resolved":"/tmp/cfc395621ea27466ba4ce3dc7e468bd2/bounkhong-idempotency-nestjs-0.1.0.tgz","_from":"file:bounkhong-idempotency-nestjs-0.1.0.tgz","_nodeVersion":"22.22.3","_npmVersion":"10.9.8","dist":{"integrity":"sha512-laSltvn3lOJ61hvbv4y1HY54+RSmmXFAaHhUEZQZtRxPq/PeHrecnGIYxgcrY++hbfDwichC2hg222WMoieq1Q==","shasum":"351b662c0eb0444cf26459f0399a9c083f276186","tarball":"https://registry.npmjs.org/@bounkhong/idempotency-nestjs/-/idempotency-nestjs-0.1.0.tgz","fileCount":6,"unpackedSize":14415,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIC68kENuWqrJY3v1lTjuLeq70xHiJBoOvaGCHU5/NEkJAiBUDILssHB8uCgsXzQihymLjMwJKGOmOxC47gxz7T9Q7Q=="}]},"_npmUser":{"name":"bounkhong","email":"bounkhong6655@gmail.com"},"directories":{},"maintainers":[{"name":"bounkhong","email":"bounkhong6655@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/idempotency-nestjs_0.1.0_1779338612140_0.7476568848124374"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-21T04:43:31.958Z","0.1.0":"2026-05-21T04:43:32.267Z","modified":"2026-05-21T04:43:32.552Z"},"maintainers":[{"name":"bounkhong","email":"bounkhong6655@gmail.com"}],"description":"NestJS integration module for AIF idempotency core","homepage":"https://github.com/aif/idempotency-package#readme","keywords":["idempotency","nestjs","nodejs","backend"],"repository":{"type":"git","url":"git+https://github.com/aif/idempotency-package.git"},"author":{"name":"Bounkhong","url":"AIF"},"bugs":{"url":"https://github.com/aif/idempotency-package/issues"},"license":"MIT","readme":"# @bounkhong/idempotency-nestjs\n\nNestJS integration for AIF idempotency: module setup, route decorator, and interceptor.\n\n## Install\n\n```bash\npnpm add @bounkhong/idempotency-nestjs @bounkhong/idempotency-core\npnpm add @nestjs/common @nestjs/core @nestjs/platform-express reflect-metadata rxjs\n```\n\n## Setup\n\n```ts\nimport { Module, UseInterceptors } from \"@nestjs/common\";\nimport { MemoryIdempotencyStore } from \"@bounkhong/idempotency-adapter-memory\";\nimport {\n  IdempotencyModule,\n  IdempotencyInterceptor,\n  UseIdempotency,\n  createDefaultPolicy\n} from \"@bounkhong/idempotency-nestjs\";\n\n@Module({\n  imports: [\n    IdempotencyModule.forRoot({\n      store: new MemoryIdempotencyStore(),\n      policies: {\n        default: createDefaultPolicy(300),\n        payments: createDefaultPolicy(900)\n      }\n    })\n  ]\n})\nexport class AppModule {}\n```\n\n## Route usage\n\n```ts\nimport { Controller, Post, Body, UseInterceptors } from \"@nestjs/common\";\nimport { IdempotencyInterceptor, UseIdempotency } from \"@bounkhong/idempotency-nestjs\";\n\n@Controller()\n@UseInterceptors(IdempotencyInterceptor)\nclass PaymentsController {\n  @Post(\"/payments\")\n  @UseIdempotency(\"payments\")\n  createPayment(@Body() body: any) {\n    return { id: `pay_${Date.now()}`, status: \"captured\", ...body };\n  }\n}\n```\n\n## Header contract\n\n- Reads `Idempotency-Key` from request headers\n- Replays previously completed response for identical key+payload\n- Returns `409` for same key with different payload\n","readmeFilename":"README.md","_rev":"1-776d06b8a3bb91d2c8c81930ef4c8cde"}