{"_id":"@bilalhasson/push-relay","_rev":"2-5917bebc997199f83e26ac1f4b9a676a","name":"@bilalhasson/push-relay","dist-tags":{"latest":"0.1.2"},"versions":{"0.1.1":{"name":"@bilalhasson/push-relay","version":"0.1.1","keywords":["web-push","notifications","push-relay"],"_id":"@bilalhasson/push-relay@0.1.1","maintainers":[{"name":"bilalhasson","email":"bilalnageeb@hotmail.co.uk"}],"homepage":"https://github.com/bilalhasson/push-relay#readme","bugs":{"url":"https://github.com/bilalhasson/push-relay/issues"},"dist":{"shasum":"45abfcdfb7a14a48e761a2e948bc341977bdfebe","tarball":"https://registry.npmjs.org/@bilalhasson/push-relay/-/push-relay-0.1.1.tgz","fileCount":10,"integrity":"sha512-qs30Q2SBXVzYDtzErgKBL1eMGUZDmxN1BNAxsCe5SgtPe9zKoSp2q+nUNhDFMyfWjjzRJRS/ES2wPfJTOBRrLg==","signatures":[{"sig":"MEQCIGtliuKny+wiqp0CWhJlfJZjD3eEywDts6ea5OJrvhJyAiBMJYUT8ty1FlcibHeRY0iUbBUIGhbox4hypBeyotc+qQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":13542},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"7805f34f5f6f878bf85e45cc7e976a82abfd63d7","scripts":{"test":"vitest run","build":"tsc -p tsconfig.json","prepare":"npm run build","typecheck":"tsc --noEmit"},"_npmUser":{"name":"bilalhasson","email":"bilalnageeb@hotmail.co.uk"},"repository":{"url":"git+https://github.com/bilalhasson/push-relay.git","type":"git"},"_npmVersion":"11.6.2","description":"Node/TypeScript client for the Push Relay Web Push send API.","directories":{},"_nodeVersion":"20.19.5","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^2.1.8","typescript":"^5.6.3","@types/node":"^20.14.0"},"_npmOperationalInternal":{"tmp":"tmp/push-relay_0.1.1_1783865359088_0.4377385765950652","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@bilalhasson/push-relay","version":"0.1.2","description":"Node/TypeScript client for the Push Relay Web Push send API.","license":"MIT","repository":{"type":"git","url":"git+https://github.com/bilalhasson/push-relay.git"},"publishConfig":{"access":"public"},"type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"engines":{"node":">=18"},"keywords":["web-push","notifications","push-relay"],"scripts":{"build":"tsc -p tsconfig.json","prepare":"npm run build","typecheck":"tsc --noEmit","test":"vitest run"},"devDependencies":{"@types/node":"^20.14.0","typescript":"^5.6.3","vitest":"^2.1.8"},"gitHead":"0fd8b36806bfe48a1d9e6137c0bb3feaa3a4b875","_id":"@bilalhasson/push-relay@0.1.2","bugs":{"url":"https://github.com/bilalhasson/push-relay/issues"},"homepage":"https://github.com/bilalhasson/push-relay#readme","_nodeVersion":"20.19.5","_npmVersion":"11.6.2","dist":{"integrity":"sha512-LXcvP5MvVt3hwi91iscHg/Uzv2GCGGk0d1c/apxuJrBmBQmg1wV05LohrqEzfTC71m7kNNf4j3GE9PTmI4gwrw==","shasum":"eab4a2923f53f9b82795acd60087dbb001514c32","tarball":"https://registry.npmjs.org/@bilalhasson/push-relay/-/push-relay-0.1.2.tgz","fileCount":11,"unpackedSize":14631,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCnVHVQJJnqgRaCifLMkA0hwT2CShVQkHesaGqKDYxVRgIgAZJIzZi9O8cda7/HrPBYhn6Xhl6g6JGHjFlFfETmK0k="}]},"_npmUser":{"name":"bilalhasson","email":"bilalnageeb@hotmail.co.uk"},"directories":{},"maintainers":[{"name":"bilalhasson","email":"bilalnageeb@hotmail.co.uk"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/push-relay_0.1.2_1783867382136_0.9757085160143963"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-12T14:09:18.904Z","modified":"2026-07-12T14:43:02.375Z","0.1.1":"2026-07-12T14:09:19.220Z","0.1.2":"2026-07-12T14:43:02.265Z"},"bugs":{"url":"https://github.com/bilalhasson/push-relay/issues"},"homepage":"https://github.com/bilalhasson/push-relay#readme","keywords":["web-push","notifications","push-relay"],"repository":{"type":"git","url":"git+https://github.com/bilalhasson/push-relay.git"},"description":"Node/TypeScript client for the Push Relay Web Push send API.","maintainers":[{"name":"bilalhasson","email":"bilalnageeb@hotmail.co.uk"}],"readme":"# @bilalhasson/push-relay\n\nTiny, typed **Node/TypeScript** client for the [Push Relay](https://push-relay.demo.bilalhasson.com)\nWeb Push send API. Zero runtime dependencies — uses the global `fetch` (Node 18+).\n\n- Interactive API reference: **https://push-relay.demo.bilalhasson.com/docs**\n- Source & issues: **https://github.com/bilalhasson/push-relay** (`clients/node`)\n- Browser subscribe SDK: [`@bilalhasson/push-relay-browser`](https://github.com/bilalhasson/push-relay/tree/main/clients/browser)\n\n## Install\n\n```bash\nnpm install @bilalhasson/push-relay\n```\n\n## Quick start\n\n```ts\nimport { PushRelay } from \"@bilalhasson/push-relay\";\n\nconst pr = new PushRelay(\"https://push-relay.demo.bilalhasson.com\", \"psk_…\"); // secret key\n\n// send now\nconst result = await pr.send(\n  \"alerts\",\n  { title: \"Site down\", body: \"api.example.com is not responding\", url: \"https://status.example.com\" },\n  { urgency: \"high\" },\n);\nconsole.log(result.sent, result.removed, result.failed);\n\n// rich payload — icon/badge/image, action buttons + per-button URLs, app-icon badge count\nawait pr.send(\"alerts\", {\n  title: \"Deploy finished\",\n  body: \"web @ v1.4.2 is live\",\n  icon: \"https://example.com/icon-192.png\",\n  actions: [{ action: \"view\", title: \"View\" }],\n  actionUrls: { view: \"https://example.com/deploys/1421\" },\n  badgeCount: 3,\n});\n\n// schedule (provide at most one)\nawait pr.send(\"alerts\", { title: \"Stand-up\" }, { delaySeconds: 300 });\nawait pr.send(\"alerts\", { title: \"Report\" }, { sendAt: new Date(\"2026-07-11T09:00:00Z\") });\n```\n\nThe **key** is your app's secret key (`psk_…`) or the owner key. Never ship it to the browser — see\n[`@bilalhasson/push-relay-browser`](https://github.com/bilalhasson/push-relay/tree/main/clients/browser)\nfor the subscribe half.\n\n## API\n\n| | |\n| --- | --- |\n| `new PushRelay(baseUrl, key?, opts?)` | `opts`: `{ timeoutMs = 10000, retries = 2, fetch? }` |\n| `pr.send(label, notification, opts?)` | `opts`: `{ ttl?, urgency?, sendAt?, delaySeconds? }` → `Promise<SendResult>` |\n| `PushRelay.generateKey(baseUrl, opts?)` | static, no auth → mints a self-serve demo key |\n\n- **`SendResult`** — immediate sends fill `sent` / `removed` / `failed`; a scheduled send sets\n  `scheduled: true` (`raw` holds the full response).\n- **Errors** — `PushRelayAuthError` (401), `PushRelayValidationError` (400, carries the server\n  message), `PushRelayError` (base / other).\n- Notification fields are already the wire (camelCase) shape: `title` (required), `body`, `url`,\n  `icon`, `badge`, `image`, `tag`, `actions`, `actionUrls`, `badgeCount`.\n- Transient failures (network / 5xx) are retried with backoff; inject `fetch` for testing.\n","readmeFilename":"README.md","license":"MIT"}