node-webpush 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,17 @@
1
+ import { GenerateRequestOptions, PushSubscription, WebPushConfig, WebPushRequestDetails } from './types';
2
+ export declare class WebPushError extends Error {
3
+ readonly response: Response;
4
+ constructor(message: string, response: Response);
5
+ }
6
+ export declare class WebPush {
7
+ readonly config: WebPushConfig;
8
+ constructor(config: WebPushConfig);
9
+ /**
10
+ * Generate the request details (endpoint + fetch init) to send a push message.
11
+ *
12
+ * - For `aes128gcm`, this produces an RFC8188 payload body (header block + encrypted records).
13
+ * - For Web Push, defaults to a single record per RFC8291; multi-record requires `allowMultipleRecords: true`.
14
+ */
15
+ generateRequestDetails(subscription: PushSubscription, payload?: string | Buffer | Uint8Array | null, options?: GenerateRequestOptions): WebPushRequestDetails;
16
+ sendNotification(subscription: PushSubscription, payload?: string | Buffer | Uint8Array | null, options?: GenerateRequestOptions): Promise<Response>;
17
+ }
package/package.json ADDED
@@ -0,0 +1,87 @@
1
+ {
2
+ "name": "node-webpush",
3
+ "version": "1.0.1",
4
+ "description": "A dependency-free Web Push implementation for Node.js",
5
+ "main": "./dist/index.es.js",
6
+ "module": "./dist/index.es.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.es.js",
12
+ "require": "./dist/index.cjs.js"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist"
17
+ ],
18
+ "scripts": {
19
+ "dev": "tsx examples/index.ts",
20
+ "build": "tsc && vite build",
21
+ "preview": "vite preview",
22
+ "test": "vitest",
23
+ "test:ui": "vitest --ui",
24
+ "test:coverage": "vitest run --coverage",
25
+ "docs:build": "typedoc src/index.ts --out generated/docs --name \"node-webpush 🔔\" --theme default --excludePrivate --excludeProtected"
26
+ },
27
+ "repository": {
28
+ "type": "git",
29
+ "url": "git+https://github.com/AlexanderSlaa/node-webpush.git"
30
+ },
31
+ "keywords": [
32
+ "webpush",
33
+ "web-push",
34
+ "webpush-notifications",
35
+ "gcm",
36
+ "rfc8188",
37
+ "rfc8291",
38
+ "rfc8292"
39
+ ],
40
+ "author": "Alexander Slaa",
41
+ "license": "Apache-2.0",
42
+ "type": "module",
43
+ "bugs": {
44
+ "url": "https://github.com/AlexanderSlaa/node-webpush/issues"
45
+ },
46
+ "homepage": "https://alexanderslaa.github.io/node-webpush/",
47
+ "publishConfig": {
48
+ "access": "public"
49
+ },
50
+ "devDependencies": {
51
+ "@semantic-release/changelog": "^6.0.3",
52
+ "@semantic-release/commit-analyzer": "^13.0.1",
53
+ "@semantic-release/git": "^10.0.1",
54
+ "@semantic-release/npm": "^13.1.3",
55
+ "@semantic-release/release-notes-generator": "^14.1.0",
56
+ "@types/node": "^24.3.0",
57
+ "@vitest/coverage-v8": "^4.0.16",
58
+ "@vitest/ui": "^4.0.16",
59
+ "tsx": "^4.20.4",
60
+ "typescript": "^5.9.3",
61
+ "vite": "^7.3.0",
62
+ "vite-plugin-dts": "^4.5.4",
63
+ "vitest": "^4.0.16",
64
+ "typedoc": "^0.28.15"
65
+ },
66
+ "release": {
67
+ "branches": [
68
+ "main"
69
+ ],
70
+ "plugins": [
71
+ "@semantic-release/commit-analyzer",
72
+ "@semantic-release/release-notes-generator",
73
+ "@semantic-release/changelog",
74
+ "@semantic-release/npm",
75
+ [
76
+ "@semantic-release/git",
77
+ {
78
+ "assets": [
79
+ "package.json",
80
+ "CHANGELOG.md"
81
+ ],
82
+ "message": "node-webpush(release): 🚀 ${nextRelease.version} \n\n${nextRelease.notes}"
83
+ }
84
+ ]
85
+ ]
86
+ }
87
+ }