{"_id":"@allmightypush/push-webpush","name":"@allmightypush/push-webpush","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@allmightypush/push-webpush","version":"1.0.0","description":"Web Push (VAPID) provider adapter for push notification library","main":"dist/cjs/index.js","module":"dist/esm/index.js","types":"dist/types/index.d.ts","exports":{".":{"require":"./dist/cjs/index.js","import":"./dist/esm/index.js","types":"./dist/types/index.d.ts"}},"scripts":{"build":"npm run build:cjs && npm run build:esm && npm run build:types","build:cjs":"tsc -p tsconfig.cjs.json","build:esm":"tsc -p tsconfig.esm.json","build:types":"tsc -p tsconfig.types.json","test":"jest --passWithNoTests","test:watch":"jest --watch","test:coverage":"jest --coverage --passWithNoTests","clean":"rm -rf dist"},"keywords":["push","notification","webpush","vapid"],"author":{"name":"Samtes64"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/Samtes64/all-mighty-push.git","directory":"packages/push-webpush"},"bugs":{"url":"https://github.com/Samtes64/all-mighty-push/issues"},"homepage":"https://github.com/Samtes64/all-mighty-push/tree/main/packages/push-webpush#readme","dependencies":{"@allmightypush/push-core":"^1.0.0","web-push":"^3.6.6"},"devDependencies":{"@types/web-push":"^3.6.3"},"engines":{"node":">=16.0.0"},"_id":"@allmightypush/push-webpush@1.0.0","gitHead":"8d7b012f519f95515344d9b5c96d4ba42039046b","_nodeVersion":"22.19.0","_npmVersion":"10.9.3","dist":{"integrity":"sha512-fIfYm8qGw6p/FE8GgBqJVfPBBy7rn8+IwVT/p2CTZtXA32h/5crzeFMhKX9iDHldDQ4Y4B5vtP/eAjBvCBKllw==","shasum":"957e0a9170041ecb480058725784ee4601b99ac2","tarball":"https://registry.npmjs.org/@allmightypush/push-webpush/-/push-webpush-1.0.0.tgz","fileCount":14,"unpackedSize":19156,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDNhdCeOhnsINCWBba/TMs41bI5EzOSWYMC9M8v387AwQIgZPnT0Szx9EeyJuU4qeXu2kDg5Y9rVgGTVH1Ke0OYclk="}]},"_npmUser":{"name":"samtes64","email":"samtes64@gmail.com"},"directories":{},"maintainers":[{"name":"samtes64","email":"samtes64@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/push-webpush_1.0.0_1768561503745_0.9471120379277791"},"_hasShrinkwrap":false}},"time":{"created":"2026-01-16T11:05:03.687Z","1.0.0":"2026-01-16T11:05:03.912Z","modified":"2026-01-16T11:05:04.160Z"},"maintainers":[{"name":"samtes64","email":"samtes64@gmail.com"}],"description":"Web Push (VAPID) provider adapter for push notification library","homepage":"https://github.com/Samtes64/all-mighty-push/tree/main/packages/push-webpush#readme","keywords":["push","notification","webpush","vapid"],"repository":{"type":"git","url":"git+https://github.com/Samtes64/all-mighty-push.git","directory":"packages/push-webpush"},"author":{"name":"Samtes64"},"bugs":{"url":"https://github.com/Samtes64/all-mighty-push/issues"},"license":"MIT","readme":"# @allmightypush/push-webpush\n\nWeb Push (VAPID) provider adapter for the push notification library.\n\n## Installation\n\n```bash\nnpm install @allmightypush/push-webpush @allmightypush/push-core\n```\n\n## Usage\n\n```typescript\nimport { WebPushProvider } from '@allmightypush/push-webpush';\n\n// Create a Web Push provider with VAPID credentials\nconst provider = new WebPushProvider({\n  vapidPublicKey: 'YOUR_VAPID_PUBLIC_KEY',\n  vapidPrivateKey: 'YOUR_VAPID_PRIVATE_KEY',\n  vapidSubject: 'mailto:your-email@example.com',\n});\n\n// Use with the push core runtime\nimport { PushCore } from '@allmightypush/push-core';\n\nconst pushCore = new PushCore();\npushCore.configure({\n  providerAdapter: provider,\n  // ... other configuration\n});\n```\n\n## Features\n\n- **VAPID Authentication**: Secure authentication using Voluntary Application Server Identification\n- **Status Code Mapping**: Intelligent handling of HTTP status codes with appropriate retry decisions\n- **Retry-After Support**: Respects `Retry-After` headers from push services\n- **Full Options Support**: Supports TTL, urgency, and topic options\n\n## Status Code Handling\n\nThe provider maps HTTP status codes to appropriate actions:\n\n| Status Code | Description | Retry? |\n|------------|-------------|--------|\n| 201 | Success | No |\n| 410 | Subscription expired | No |\n| 429 | Rate limited | Yes (with backoff) |\n| 5xx | Server error | Yes (with backoff) |\n| 4xx (other) | Client error | No |\n\n## Send Options\n\nThe provider supports the following send options:\n\n- **ttl**: Time-to-live in seconds (how long the push service should queue the message)\n- **urgency**: Priority hint for the push service (`'very-low'`, `'low'`, `'normal'`, `'high'`)\n- **topic**: Topic for replacing previous notifications\n\nExample:\n\n```typescript\nawait pushCore.sendNotification(\n  subscription,\n  {\n    title: 'Breaking News',\n    body: 'Important update',\n  },\n  {\n    ttl: 3600, // 1 hour\n    urgency: 'high',\n    topic: 'news-alerts',\n  }\n);\n```\n\n## VAPID Keys\n\nTo generate VAPID keys, you can use the web-push library:\n\n```bash\nnpx web-push generate-vapid-keys\n```\n\nOr use the CLI tool from `@allmightypush/push-cli`:\n\n```bash\nnpx @allmightypush/push-cli generate-keys\n```\n\n## Error Handling\n\nThe provider handles various error scenarios:\n\n- **Network Errors**: Automatically retried\n- **Expired Subscriptions (410)**: Marked as expired, not retried\n- **Rate Limiting (429)**: Retried with exponential backoff, respects `Retry-After` header\n- **Server Errors (5xx)**: Retried with exponential backoff\n- **Client Errors (4xx)**: Not retried (except 429)\n\n## TypeScript Support\n\nThis package is written in TypeScript and includes full type definitions.\n\n## License\n\nMIT\n","readmeFilename":"README.md","_rev":"1-4204a9e9793eb6de18d61f3a0ca6f06c"}