{"_id":"@ash_rafhamid/crashlens-browser-sdk","name":"@ash_rafhamid/crashlens-browser-sdk","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@ash_rafhamid/crashlens-browser-sdk","version":"0.1.0","description":"Browser error reporting SDK for CrashLens","type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"build":"tsc -p tsconfig.json","test":"tsx --test src/**/*.test.ts","typecheck":"tsc -p tsconfig.json --noEmit"},"keywords":["error-monitoring","observability","typescript","sdk"],"repository":{"type":"git","url":"git+https://github.com/ash-rafhamid/crashlens.git","directory":"packages/browser-sdk"},"homepage":"https://github.com/ash-rafhamid/crashlens#readme","bugs":{"url":"https://github.com/ash-rafhamid/crashlens/issues"},"license":"MIT","publishConfig":{"access":"public"},"_id":"@ash_rafhamid/crashlens-browser-sdk@0.1.0","gitHead":"fe8c708582b7cf9659e05c82f0017c65af7f1616","_nodeVersion":"22.15.0","_npmVersion":"10.9.2","dist":{"integrity":"sha512-qQT0SldBdpdLdkexeM2hO3yRdXGLvjfF9CIn9yP2V1JchusXBfLKI7sXKXeFQHuc2TDEqEAl+FfdidLyt7kAZw==","shasum":"ef05f9cc2c25c7dfda8fc31be4d6c78f86da7e03","tarball":"https://registry.npmjs.org/@ash_rafhamid/crashlens-browser-sdk/-/crashlens-browser-sdk-0.1.0.tgz","fileCount":8,"unpackedSize":23844,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCcjCpf5Oz0LOmegXCRmQ6u3AEtYJd765hZieygrUnmcQIhALjjhQhBQV+I9ZMAYKfbBHuDRJ1p/OIAUHwD2t2b5NrG"}]},"_npmUser":{"name":"ash_rafhamid","email":"ashrafhamidmajumder@gmail.com"},"directories":{},"maintainers":[{"name":"ash_rafhamid","email":"ashrafhamidmajumder@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/crashlens-browser-sdk_0.1.0_1787583267648_0.6169376613266162"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-24T14:54:27.461Z","0.1.0":"2026-08-24T14:54:27.840Z","modified":"2026-08-24T14:54:28.101Z"},"maintainers":[{"name":"ash_rafhamid","email":"ashrafhamidmajumder@gmail.com"}],"description":"Browser error reporting SDK for CrashLens","homepage":"https://github.com/ash-rafhamid/crashlens#readme","keywords":["error-monitoring","observability","typescript","sdk"],"repository":{"type":"git","url":"git+https://github.com/ash-rafhamid/crashlens.git","directory":"packages/browser-sdk"},"bugs":{"url":"https://github.com/ash-rafhamid/crashlens/issues"},"license":"MIT","readme":"# CrashLens browser SDK\n\nThe CrashLens browser SDK watches a web application for JavaScript failures and sends structured error events to a CrashLens API.\n\nIt captures uncaught errors and unhandled promise rejections automatically. Applications can also report caught exceptions manually. Each event may contain the stack trace, current page, release, environment, browser information, user ID, custom context, and recent click breadcrumbs.\n\n## Installation\n\nInstall the public package with:\n\n```bash\nnpm install @ash_rafhamid/crashlens-browser-sdk\n```\n\n## Setup\n\n```ts\nimport CrashLens from \"@ash_rafhamid/crashlens-browser-sdk\";\n\nCrashLens.init({\n  apiKey: \"cl_live_project_key\",\n  dsn: \"https://your-crashlens-api.example\",\n  release: \"1.4.0\",\n  environment: \"production\"\n});\n```\n\n`dsn` may be the API origin or the complete `/api/v1/events` endpoint.\n\n## Add user and application context\n\n```ts\nCrashLens.setUser(\"customer-42\");\nCrashLens.setContext({ region: \"BD\", checkoutVersion: 3 });\nCrashLens.addBreadcrumb(\"checkout\", \"Customer selected bKash\");\n```\n\nAvoid sending passwords, access tokens, payment details, or other private data. The API redacts common sensitive key names, but applications should still collect only the context developers actually need.\n\n## Report a caught exception\n\n```ts\ntry {\n  await reserveInventory();\n} catch (error) {\n  const accepted = await CrashLens.captureException(error, {\n    extra: { sku: \"CLOUD-RUNNER-42\" }\n  });\n\n  if (!accepted) {\n    console.warn(\"CrashLens could not send the event\");\n  }\n}\n```\n\n`captureException` never throws because monitoring should not break the monitored application. It returns `true` when the API accepts the event and `false` when reporting is unavailable.\n\n## Publishing\n\nBuild and test the workspace, review the package files, and publish it publicly.\r\n\n```bash\ncd packages/browser-sdk\nnpm run build\nnpm test\nnpm pack --dry-run\nnpm publish --access public\n```\n\nNever include the private `CRASHLENS_ADMIN_KEY` in this package or in browser code. A browser application receives only its project SDK key, which permits event ingestion but cannot read or manage issues.\n","readmeFilename":"README.md","_rev":"1-4a6c99716778a4c1133fbf38d07f5cde"}