{"_id":"@bandhannova07/sentinel-js","name":"@bandhannova07/sentinel-js","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@bandhannova07/sentinel-js","version":"1.0.0","description":"BandhanNova Sentinel SDK for Frontend and Node.js APM Monitoring","main":"dist/index.js","module":"dist/index.mjs","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js","default":"./dist/index.js"}},"scripts":{"build":"tsup","dev":"tsup --watch","test":"vitest","prepublishOnly":"npm run build"},"engines":{"node":">=18.0.0"},"repository":{"type":"git","url":"git+https://github.com/bandhannova07/bdn-sntnl.git"},"publishConfig":{"access":"public"},"keywords":["apm","bandhannova","monitoring","sentinel","error-tracking","web-vitals"],"author":{"name":"BandhanNova Platforms"},"license":"MIT","devDependencies":{"@types/node":"^20.0.0","jsdom":"^24.1.0","tsup":"^8.0.2","typescript":"^5.4.5","vitest":"^1.6.0"},"gitHead":"0e80c745fb8526cda46b43df8a824356f758ae2a","bugs":{"url":"https://github.com/bandhannova07/bdn-sntnl/issues"},"homepage":"https://github.com/bandhannova07/bdn-sntnl#readme","_id":"@bandhannova07/sentinel-js@1.0.0","_nodeVersion":"20.19.5","_npmVersion":"9.2.0","dist":{"integrity":"sha512-JLjlS4zS8WO772SdTuqFk3EEK88mg2FQpoc4G9pBCaS7IfTtmHW8DrNQ8hSb9FGCMheGTgyZTZL+RxAdt8VvZw==","shasum":"23886d34de8297a7b864198cc684362dcb6ca4ed","tarball":"https://registry.npmjs.org/@bandhannova07/sentinel-js/-/sentinel-js-1.0.0.tgz","fileCount":11,"unpackedSize":74491,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDdr8PPJqrnclEldPuD3rLjcwGcPRGF6AO6Ad20mtKqeAIhAIhiaQiDpXUuNpvhEc75trYSfB0NdaeULkZ69lMP3qGl"}]},"_npmUser":{"name":"lordbandhan07","email":"admin@bandhannova.in"},"directories":{},"maintainers":[{"name":"lordbandhan07","email":"admin@bandhannova.in"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/sentinel-js_1.0.0_1782936192669_0.2952099545554292"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-01T20:03:12.543Z","1.0.0":"2026-07-01T20:03:12.807Z","modified":"2026-07-01T20:03:12.992Z"},"maintainers":[{"name":"lordbandhan07","email":"admin@bandhannova.in"}],"description":"BandhanNova Sentinel SDK for Frontend and Node.js APM Monitoring","homepage":"https://github.com/bandhannova07/bdn-sntnl#readme","keywords":["apm","bandhannova","monitoring","sentinel","error-tracking","web-vitals"],"repository":{"type":"git","url":"git+https://github.com/bandhannova07/bdn-sntnl.git"},"author":{"name":"BandhanNova Platforms"},"bugs":{"url":"https://github.com/bandhannova07/bdn-sntnl/issues"},"license":"MIT","readme":"# @bandhannova07/sentinel-js\n\n![npm version](https://badge.fury.io/js/%40bandhannova07%2Fsentinel-js.svg)\n![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)\n![Node.js Version](https://img.shields.io/node/v/%40bandhannova07%2Fsentinel-js.svg)\n\nThe official JavaScript & TypeScript SDK for **BandhanNova Sentinel** APM and Error Monitoring.\n\nSentinel is a lightweight, AI-powered observability and error-tracking platform. This SDK seamlessly captures unhandled exceptions, unhandled promise rejections, and Core Web Vitals across **Browser** and **Node.js** environments.\n\n## Features\n\n- ✅ **Automatic Error Capture** - Unhandled exceptions and promise rejections\n- ✅ **Core Web Vitals** - LCP, FID, CLS, FCP tracking\n- ✅ **API Key Authentication** - Secure data ingestion\n- ✅ **Retry Logic** - Exponential backoff for network failures\n- ✅ **Offline Support** - Request queueing with localStorage persistence\n- ✅ **Sampling** - Reduce data volume with configurable sampling rate\n- ✅ **PII Masking** - Automatic email masking in error messages\n- ✅ **User Context** - Track user sessions with userId\n- ✅ **Multi-Runtime** - Works in Browser and Node.js\n- ✅ **TypeScript** - Full type definitions included\n\n## Installation\n\nUsing NPM:\n```bash\nnpm install @bandhannova07/sentinel-js\n```\n\nUsing Yarn:\n```bash\nyarn add @bandhannova07/sentinel-js\n```\n\nUsing pnpm:\n```bash\npnpm add @bandhannova07/sentinel-js\n```\n\n## Quick Start\n\nThe SDK automatically detects your runtime environment. You only need one integration code for Browser or Node.js.\n\n### ES Modules (Frontend or Node.js)\n\n```javascript\nimport { Sentinel } from '@bandhannova07/sentinel-js';\n\nconst sentinel = new Sentinel({\n  projectId: 'your_project_id_here',\n  apiKey: 'your_api_key_here'\n});\n\n// That's it! Sentinel is now tracking errors and vitals.\n```\n\n### CommonJS (Legacy Node.js)\n\n```javascript\nconst { Sentinel } = require('@bandhannova07/sentinel-js');\n\nconst sentinel = new Sentinel({\n  projectId: 'your_project_id_here',\n  apiKey: 'your_api_key_here'\n});\n```\n\n### HTML `<script>` CDN\n\nYou can inject the SDK directly via CDN in your HTML `<head>`:\n\n```html\n<script src=\"https://unpkg.com/@bandhannova07/sentinel-js/dist/index.global.js\"></script>\n<script>\n  Sentinel.init({\n    projectId: 'your_project_id_here',\n    apiKey: 'your_api_key_here'\n  });\n</script>\n```\n\n## Configuration Options\n\n| Option            | Type       | Required | Default | Description |\n|-------------------|------------|----------|---------|-------------|\n| `projectId`       | `string`   | **Yes**  | - | Your Sentinel Project ID (found in Dashboard settings). |\n| `apiKey`          | `string`   | **Yes**  | - | Your Sentinel API Key (found in Dashboard settings). |\n| `endpoint`        | `string`   | No       | `https://sentinel.bandhannova.in/api/ingest/error` | Custom Error Ingest URL. |\n| `vitalsEndpoint`  | `string`   | No       | Auto-derived from endpoint | Custom Web Vitals Ingest URL. |\n| `userId`          | `string`   | No       | `null` | Unique Identifier for the active user session. |\n| `samplingRate`    | `number`   | No       | `1.0` | Sampling rate (0.0 to 1.0). Use to reduce data volume. |\n| `enableWebVitals` | `boolean`  | No       | `true` | Enable/disable Core Web Vitals tracking. |\n| `maxRetries`      | `number`   | No       | `3` | Maximum retry attempts for failed requests. |\n| `enableQueueing`  | `boolean`  | No       | `true` | Enable offline queueing with localStorage persistence. |\n| `maxQueueSize`    | `number`   | No       | `100` | Maximum number of items to store in the offline queue. |\n\n## Manual Reporting\n\nIf you want to manually report a caught exception or an arbitrary message:\n\n### Capture Errors\n```javascript\ntry {\n  throw new Error(\"Payment failed!\");\n} catch (error) {\n  sentinel.captureError(error);\n}\n```\n\n### Capture Messages\n```javascript\nsentinel.captureMessage(\"User completed checkout\", \"info\");\n// Available levels: 'info', 'warning', 'error'\n```\n\n## Queue Management\n\nWhen queueing is enabled, failed requests are stored in localStorage and retried when the connection is restored.\n\n```javascript\n// Manually flush the queue\nsentinel.flushQueue();\n\n// Clear all queued items\nsentinel.clearQueue();\n```\n\n## Advanced Configuration\n\n### High-Traffic Applications\n\nFor high-traffic applications, use sampling to reduce costs:\n\n```javascript\nconst sentinel = new Sentinel({\n  projectId: 'your_project_id',\n  apiKey: 'your_api_key',\n  samplingRate: 0.1 // Capture only 10% of errors\n});\n```\n\n### Custom Endpoint\n\nIf you're self-hosting Sentinel:\n\n```javascript\nconst sentinel = new Sentinel({\n  projectId: 'your_project_id',\n  apiKey: 'your_api_key',\n  endpoint: 'https://your-sentinel-instance.com/api/ingest/error'\n});\n```\n\nThe Web Vitals endpoint is automatically derived from the error endpoint. If you need a custom vitals endpoint:\n\n```javascript\nconst sentinel = new Sentinel({\n  projectId: 'your_project_id',\n  apiKey: 'your_api_key',\n  endpoint: 'https://your-sentinel-instance.com/api/ingest/error',\n  vitalsEndpoint: 'https://your-sentinel-instance.com/api/vitals'\n});\n```\n\n## Security\n\n- API keys are sent via the `X-API-Key` header\n- Email addresses in error messages are automatically masked\n- All data is transmitted over HTTPS\n- No sensitive data is stored in the SDK\n\n## License\n\nMIT © BandhanNova Platforms\n","readmeFilename":"README.md","_rev":"1-747db5d7393eb48a6c804a10869539c9"}