{"_id":"@agwnl/bedlam","name":"@agwnl/bedlam","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@agwnl/bedlam","version":"1.0.0","description":"A chaos engineering library that randomly rejects API fetch requests to test site reliability","main":"./dist/index.js","module":"./dist/index.mjs","types":"./dist/index.d.ts","exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.mjs"},"require":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"./browser":{"types":"./dist/index.d.ts","default":"./dist/index.global.js"}},"scripts":{"build":"tsup","dev":"tsup --watch","type-check":"tsc --noEmit","type-check:watch":"tsc --noEmit --watch","prepublishOnly":"pnpm build"},"keywords":["chaos-engineering","fetch","api","testing","reliability","network-error"],"author":{"name":"Agnideep Ghosh"},"license":"MIT","packageManager":"pnpm@10.4.1","devDependencies":{"@types/node":"^25.0.2","tsup":"^8.5.1","typescript":"^5.9.3"},"_id":"@agwnl/bedlam@1.0.0","gitHead":"5f199262590a27920e1e4baf287636805a77101c","_nodeVersion":"24.5.0","_npmVersion":"11.5.1","dist":{"integrity":"sha512-gAPMZ12Thc1mmJ7Pi+jF00OvsqCjvH8m14xCMcQiww0eEs6uc9ASUcPKN6QfEr4wfExGflPa1VCMOKm7mP9FcQ==","shasum":"c83b74708901feac8494909eee9c51ea52ad4347","tarball":"https://registry.npmjs.org/@agwnl/bedlam/-/bedlam-1.0.0.tgz","fileCount":11,"unpackedSize":15938,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCakXaA7KbmMfnZkixyIC/korUoZWuUdudk5gJNryNoUgIhANGpliJFxKtOEymPajGdEqb1J1cOTA4e22+UCGvydodZ"}]},"_npmUser":{"name":"agwnl","email":"agnideep22@gmail.com"},"directories":{},"maintainers":[{"name":"agwnl","email":"agnideep22@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/bedlam_1.0.0_1765701362074_0.36331959754472654"},"_hasShrinkwrap":false}},"time":{"created":"2025-12-14T08:36:01.903Z","1.0.0":"2025-12-14T08:36:02.219Z","modified":"2025-12-14T08:36:02.622Z"},"maintainers":[{"name":"agwnl","email":"agnideep22@gmail.com"}],"description":"A chaos engineering library that randomly rejects API fetch requests to test site reliability","keywords":["chaos-engineering","fetch","api","testing","reliability","network-error"],"author":{"name":"Agnideep Ghosh"},"license":"MIT","readme":"# Bedlam\n\nA chaos engineering library that randomly rejects API fetch requests to test your site's reliability.\n\n## Installation\n\n```bash\nnpm install @agwnl/bedlam\n# or\npnpm add @agwnl/bedlam\n# or\nyarn add @agwnl/bedlam\n```\n\n## Usage\n\n```typescript\nimport { enableChaos, disableChaos } from \"@agwnl/bedlam\";\n\n// Enable chaos mode\nenableChaos({\n  failRate: 0.3, // 30% of requests will fail (default: 0.2)\n  delayMs: 1000, // Add 1s delay to all requests (default: 0)\n  mode: \"reject\", // 'reject' or 'http-500' (default: 'reject')\n  include: [\"/api/\"], // Only affect URLs containing these strings (default: [])\n  exclude: [\"/health\"], // Never affect URLs containing these strings (default: [])\n});\n\n// Disable chaos mode\ndisableChaos();\n```\n\n## Error Modes\n\n- **`reject`**: Simulates network failures (promise rejection)\n- **`http-500`**: Simulates server errors (returns HTTP 500 response)\n\n## Example\n\n```typescript\nimport { enableChaos } from \"@agwnl/bedlam\";\n\n// Enable chaos in development\nif (process.env.NODE_ENV === 'development') {\n  enableChaos({ failRate: 0.2 });\n}\n\n// Your app will now randomly fail 20% of fetch requests\nfetch('/api/users').then(...).catch(...);\n```\n","readmeFilename":"README.md","_rev":"1-74dc80163ff9b8730138f26dc6399fba"}