{"_id":"@ali39/radar-client","_rev":"2-2fae40cfc13790b2da5fe488b3c30da2","name":"@ali39/radar-client","dist-tags":{"latest":"0.1.1"},"versions":{"0.1.0":{"name":"@ali39/radar-client","version":"0.1.0","keywords":["radar","logging","metrics","monitoring","observability","sdk","client"],"author":"","license":"MIT","_id":"@ali39/radar-client@0.1.0","maintainers":[{"name":"ali39","email":"aliafsordeh8@gmail.com"}],"dist":{"shasum":"b9dac871a1eeeed4b4406c674b69492471f3d18a","tarball":"https://registry.npmjs.org/@ali39/radar-client/-/radar-client-0.1.0.tgz","fileCount":14,"integrity":"sha512-nU4+/CAyQVCMonkwDXIw2SxZvf/Awb7yC43VaC+E85ezb17O1VSCZSY2FOCmPfAWcuuKldlZILP5QxSRTNKQ+Q==","signatures":[{"sig":"MEUCIHHISaD/bltlMCuKU9GfoPB6xUMBCMQD4y2CECtYWWAWAiEAhdfinmQPHvawonjOsOwVEqOClbWlRncAieJM0jivDio=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":29820},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"}},"scripts":{"build":"tsc","prepublishOnly":"npm run build"},"_npmUser":{"name":"ali39","email":"aliafsordeh8@gmail.com"},"_npmVersion":"10.8.2","description":"Client SDK for pushing logs and metrics to a Radar server over an access-key-authenticated socket.","directories":{},"_nodeVersion":"20.20.0","dependencies":{"socket.io-client":"^4.8.3"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.9.3","@types/node":"^22.10.0"},"_npmOperationalInternal":{"tmp":"tmp/radar-client_0.1.0_1787945773928_0.8726189740107675","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@ali39/radar-client","version":"0.1.1","description":"Client SDK for pushing logs and metrics to a Radar server over an access-key-authenticated socket.","type":"module","main":"./dist/index.js","module":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"}},"scripts":{"build":"tsc","prepublishOnly":"npm run build"},"keywords":["radar","logging","metrics","monitoring","observability","sdk","client"],"author":"","license":"MIT","dependencies":{"socket.io-client":"^4.8.3"},"devDependencies":{"@types/node":"^22.10.0","typescript":"^5.9.3"},"_id":"@ali39/radar-client@0.1.1","_nodeVersion":"20.20.0","_npmVersion":"10.8.2","dist":{"integrity":"sha512-7dOeZOBnWeIFpJV7BWg1HHV+9XGeAx8W1zVnMfoUBJQWDy7PDwUs8kCEPhw+9JZtp4l9z5qS3S3aZhqkb3cxYA==","shasum":"7d5fb84b67583dfb6351b5f2112b58f181893c1f","tarball":"https://registry.npmjs.org/@ali39/radar-client/-/radar-client-0.1.1.tgz","fileCount":14,"unpackedSize":29827,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDFveNEJnUrylgX7GaLQJCuZXjGyczdoNkhSPmC2ARokgIhAOoIKfxcEGbzh6HuPvYAt+CRWNZDkiU+lg7kcJMxcK0H"}]},"_npmUser":{"name":"ali39","email":"aliafsordeh8@gmail.com"},"directories":{},"maintainers":[{"name":"ali39","email":"aliafsordeh8@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/radar-client_0.1.1_1787946639236_0.5735966884934798"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-28T19:36:13.713Z","modified":"2026-08-28T19:50:39.583Z","0.1.0":"2026-08-28T19:36:14.071Z","0.1.1":"2026-08-28T19:50:39.407Z"},"license":"MIT","keywords":["radar","logging","metrics","monitoring","observability","sdk","client"],"description":"Client SDK for pushing logs and metrics to a Radar server over an access-key-authenticated socket.","maintainers":[{"name":"ali39","email":"aliafsordeh8@gmail.com"}],"readme":"# radar-client\n\nClient SDK for pushing logs and metrics to a Radar server over its\naccess-key-authenticated ingestion socket (`/socket/api/v1`).\n\n## Install\n\n```bash\nnpm install @ali39/radar-client\n```\n\n## Usage\n\n```ts\nimport { RadarClient } from \"radar-client\";\n\nconst radar = new RadarClient({\n    url: \"https://radar.example.com\",\n    accessKey: \"<plaintext access key>\",\n});\n\nradar.info(\"server started\", { pid: process.pid });\nradar.error(\"payment failed\", { orderId: \"abc123\" });\n\nradar.metric(\"cpu.usage\", 42.5, { host: \"web-1\" });\nradar.metric(\"requests.count\", 1);\n\nradar.on(\"error\", (err) => console.error(\"radar error:\", err));\n\n// on shutdown\nawait radar.close();\n```\n\n## Behavior\n\n- Entries are queued in memory and flushed in batches (default every 2s, up\n  to 500 entries per push - matching the server's own cap).\n- **Reconnection** is handled by socket.io itself, retried forever by default\n  with exponential backoff (tunable via `reconnectionDelay`,\n  `reconnectionDelayMax`, `reconnectionAttempts`). On every successful\n  (re)connect, whatever piled up while offline is drained automatically.\n- **Nothing is lost on disconnect.** Entries keep queuing while offline\n  (bounded by `maxQueueSize` per queue; beyond that the *oldest* entries are\n  dropped and a `\"drop\"` event fires). If a batch is in flight when the\n  socket drops, or the server never acknowledges it within `ackTimeout`, it\n  is put back on the front of the queue and retried later - it is not lost.\n- Only a batch the server *explicitly rejects* (e.g. malformed entries) is\n  dropped rather than retried, since retrying identical bad data would fail\n  forever. An `\"error\"` event fires either way so you can observe it.\n- `close()` flushes any remaining queued entries (best-effort, bounded by a\n  timeout) before disconnecting.\n\n## Options\n\n| Option                  | Default              | Description                                          |\n| ------------------------ | -------------------- | ----------------------------------------------------- |\n| `url`                    | *required*            | Radar server base URL                                  |\n| `accessKey`              | *required*            | Plaintext access key                                   |\n| `path`                   | `/socket/api/v1`      | Ingestion socket.io path                               |\n| `flushInterval`          | `2000`                | Flush interval in ms                                   |\n| `maxBatchSize`           | `500`                 | Max entries per push (capped at 500)                   |\n| `maxQueueSize`           | `10000`               | Max entries held per queue while disconnected          |\n| `minLevel`               | `debug`               | Discard logs below this level before queuing           |\n| `autoConnect`            | `true`                | Connect immediately on construction                    |\n| `reconnection`           | `true`                | Auto-reconnect on disconnect                           |\n| `reconnectionDelay`      | `1000`                | Delay before the first reconnection attempt (ms)       |\n| `reconnectionDelayMax`   | `5000`                | Upper bound for reconnection backoff (ms)               |\n| `reconnectionAttempts`   | `Infinity`            | Max reconnection attempts before giving up              |\n| `ackTimeout`             | `10000`               | How long to wait for a push ack before requeuing (ms)   |\n| `rejectUnauthorized`     | `true`                | Set `false` to accept self-signed TLS certificates      |\n\n## Events\n\n- `\"connect\"` - socket connected (fires again after every reconnect)\n- `\"disconnect\"` (reason) - socket disconnected\n- `\"reconnect_attempt\"` (attempt) - a reconnection attempt is starting\n- `\"reconnect_failed\"` - `reconnectionAttempts` was exhausted; giving up\n- `\"error\"` (Error) - connection error, an ack timeout/disconnect mid-push, or a rejected push batch\n- `\"flush\"` ({ kind, inserted }) - a batch was accepted by the server\n- `\"drop\"` (count) - entries dropped because the queue was full\n","readmeFilename":"README.md"}