@vielzeug/pulse 1.0.3

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.
Files changed (70) hide show
  1. package/README.md +68 -0
  2. package/dist/_dev.cjs +2 -0
  3. package/dist/_dev.cjs.map +1 -0
  4. package/dist/_dev.d.ts +2 -0
  5. package/dist/_dev.d.ts.map +1 -0
  6. package/dist/_dev.js +9 -0
  7. package/dist/_dev.js.map +1 -0
  8. package/dist/_utils.cjs +2 -0
  9. package/dist/_utils.cjs.map +1 -0
  10. package/dist/_utils.d.ts +2 -0
  11. package/dist/_utils.d.ts.map +1 -0
  12. package/dist/_utils.js +36 -0
  13. package/dist/_utils.js.map +1 -0
  14. package/dist/_wait.cjs +2 -0
  15. package/dist/_wait.cjs.map +1 -0
  16. package/dist/_wait.d.ts +2 -0
  17. package/dist/_wait.d.ts.map +1 -0
  18. package/dist/_wait.js +29 -0
  19. package/dist/_wait.js.map +1 -0
  20. package/dist/channel.cjs +2 -0
  21. package/dist/channel.cjs.map +1 -0
  22. package/dist/channel.d.ts +2 -0
  23. package/dist/channel.d.ts.map +1 -0
  24. package/dist/channel.js +58 -0
  25. package/dist/channel.js.map +1 -0
  26. package/dist/errors.cjs +2 -0
  27. package/dist/errors.cjs.map +1 -0
  28. package/dist/errors.d.ts +45 -0
  29. package/dist/errors.d.ts.map +1 -0
  30. package/dist/errors.js +36 -0
  31. package/dist/errors.js.map +1 -0
  32. package/dist/heartbeat.cjs +2 -0
  33. package/dist/heartbeat.cjs.map +1 -0
  34. package/dist/heartbeat.d.ts +9 -0
  35. package/dist/heartbeat.d.ts.map +1 -0
  36. package/dist/heartbeat.js +37 -0
  37. package/dist/heartbeat.js.map +1 -0
  38. package/dist/index.cjs +1 -0
  39. package/dist/index.d.ts +4 -0
  40. package/dist/index.d.ts.map +1 -0
  41. package/dist/index.js +3 -0
  42. package/dist/presence.cjs +2 -0
  43. package/dist/presence.cjs.map +1 -0
  44. package/dist/presence.d.ts +8 -0
  45. package/dist/presence.d.ts.map +1 -0
  46. package/dist/presence.js +71 -0
  47. package/dist/presence.js.map +1 -0
  48. package/dist/protocol.cjs +2 -0
  49. package/dist/protocol.cjs.map +1 -0
  50. package/dist/protocol.d.ts +81 -0
  51. package/dist/protocol.d.ts.map +1 -0
  52. package/dist/protocol.js +20 -0
  53. package/dist/protocol.js.map +1 -0
  54. package/dist/pulse.cjs +2 -0
  55. package/dist/pulse.cjs.map +1 -0
  56. package/dist/pulse.d.ts +16 -0
  57. package/dist/pulse.d.ts.map +1 -0
  58. package/dist/pulse.iife.js +2 -0
  59. package/dist/pulse.iife.js.map +1 -0
  60. package/dist/pulse.js +2 -0
  61. package/dist/pulse.js.map +1 -0
  62. package/dist/reconnect.cjs +2 -0
  63. package/dist/reconnect.cjs.map +1 -0
  64. package/dist/reconnect.d.ts +10 -0
  65. package/dist/reconnect.d.ts.map +1 -0
  66. package/dist/reconnect.js +29 -0
  67. package/dist/reconnect.js.map +1 -0
  68. package/dist/types.d.ts +243 -0
  69. package/dist/types.d.ts.map +1 -0
  70. package/package.json +43 -0
@@ -0,0 +1,243 @@
1
+ import type { Readable } from '@vielzeug/ripple';
2
+ /** A read-only view of a Map — callers cannot mutate the entries. */
3
+ export type ReadonlyMap<K, V> = Omit<Map<K, V>, 'clear' | 'delete' | 'set'>;
4
+ /** A map of event name → payload type. Use as the generic parameter for Pulse. */
5
+ export type MessageMap = Record<string, unknown>;
6
+ /** Extract valid event keys from a MessageMap. */
7
+ export type EventKey<T extends MessageMap> = keyof T & string;
8
+ /** A function that removes a listener subscription. */
9
+ export type Unsubscribe = () => void;
10
+ /** Lifecycle state of a Pulse connection. */
11
+ export type PulseStatus = 'connecting' | 'open' | 'reconnecting' | 'closed';
12
+ export type ReconnectOptions = {
13
+ /**
14
+ * Delay strategy between reconnect attempts (ms).
15
+ * - number: fixed delay
16
+ * - function: `attempt` is zero-based (0 = waiting before 2nd try).
17
+ * Defaults to full-jitter exponential backoff capped at 30 s.
18
+ */
19
+ delay?: number | ((attempt: number) => number);
20
+ /** Maximum number of reconnect attempts after initial failure. Default: 5. */
21
+ maxAttempts?: number;
22
+ };
23
+ export type HeartbeatOptions = {
24
+ /** Interval between pings in ms. Default: 30_000. */
25
+ interval?: number;
26
+ /** How long to wait for a pong before treating the connection as dead. Default: 5_000. */
27
+ timeout?: number;
28
+ };
29
+ /**
30
+ * Intercepts outgoing messages. Call `next()` to allow the message to be sent;
31
+ * omit to suppress it.
32
+ */
33
+ export type Middleware = (event: string, payload: unknown, next: () => void) => void;
34
+ export type BufferOptions = {
35
+ /**
36
+ * Maximum number of outgoing frames to buffer while disconnected.
37
+ * Oldest frames are evicted when the buffer is full. Default: 50.
38
+ */
39
+ maxSize?: number;
40
+ };
41
+ export type PulseOptions = {
42
+ /**
43
+ * Buffer outgoing messages while the connection is not open, then flush on
44
+ * reconnect. `true` uses defaults (`maxSize: 50`). `false` disables (default).
45
+ * Dropped messages are discarded with a dev warning when buffering is off.
46
+ */
47
+ buffer?: boolean | BufferOptions;
48
+ /**
49
+ * Heartbeat ping/pong keep-alive.
50
+ * `true` uses defaults. `false` disables. Default: `false`.
51
+ */
52
+ heartbeat?: boolean | HeartbeatOptions;
53
+ /**
54
+ * Defer the initial WebSocket connection until `connect()` is called explicitly.
55
+ * Default: `false` (connects immediately on creation).
56
+ */
57
+ lazy?: boolean;
58
+ /**
59
+ * Middleware functions run on every outgoing `send()`, before the message is
60
+ * written to the socket. Call `next()` to proceed or omit to suppress.
61
+ */
62
+ middleware?: readonly Middleware[];
63
+ /** Called when the connection is closed by either side. */
64
+ onClose?: (code: number, reason: string) => void;
65
+ /**
66
+ * Called on a WebSocket error event. Note: WebSocket errors almost always
67
+ * precede a close event — use `onClose` for recovery logic.
68
+ */
69
+ onError?: (error: Error) => void;
70
+ /**
71
+ * Called with every raw `MessageEvent` before any parsing occurs.
72
+ * Useful for low-level debugging.
73
+ */
74
+ onMessage?: (event: MessageEvent) => void;
75
+ /** Called when the connection is established (or re-established). */
76
+ onOpen?: () => void;
77
+ /**
78
+ * Called at the start of each reconnect attempt.
79
+ * `attempt` is 1-based (1 = first retry).
80
+ */
81
+ onReconnect?: (attempt: number) => void;
82
+ /** Sub-protocols to pass to the WebSocket constructor. */
83
+ protocols?: string | string[];
84
+ /**
85
+ * Auto-reconnect on unexpected close.
86
+ * `true` uses defaults. `false` disables. Default: `false`.
87
+ */
88
+ reconnect?: boolean | ReconnectOptions;
89
+ };
90
+ /**
91
+ * An isolated message namespace multiplexed over the shared WebSocket connection.
92
+ * Obtain one via `pulse.channel(name)`. Multiple calls with the same name return
93
+ * the **same** channel object — dispose it once to fully remove the subscription.
94
+ *
95
+ * @example
96
+ * const notif = pulse.channel<{ alert: string }>('notifications');
97
+ * notif.on('alert', (msg) => console.log(msg));
98
+ * notif.send('alert', 'Hello!');
99
+ */
100
+ export type PulseChannel<TServer extends MessageMap = MessageMap, TClient extends MessageMap = MessageMap> = {
101
+ /** Delegates to `dispose()`. Enables `using` declarations. */
102
+ [Symbol.dispose](): void;
103
+ /** `AbortSignal` aborted when `dispose()` is called. */
104
+ readonly disposalSignal: AbortSignal;
105
+ /** Permanently unsubscribes all listeners and prevents future sends. */
106
+ dispose(): void;
107
+ /** Whether this channel has been disposed. */
108
+ readonly disposed: boolean;
109
+ /** Channel name passed to `pulse.channel()`. */
110
+ readonly name: string;
111
+ /**
112
+ * Subscribe to a server event scoped to this channel.
113
+ * Returns an unsubscribe function. The handler is auto-removed on `dispose()`.
114
+ */
115
+ on<K extends EventKey<TServer>>(event: K, handler: (payload: TServer[K]) => void): Unsubscribe;
116
+ /** Subscribe once — auto-removes after first invocation. */
117
+ once<K extends EventKey<TServer>>(event: K, handler: (payload: TServer[K]) => void): Unsubscribe;
118
+ /**
119
+ * Send a typed message to the server, scoped to this channel.
120
+ * No-op if the pulse connection is not open and buffering is disabled.
121
+ */
122
+ send<K extends EventKey<TClient>>(event: K, payload: TClient[K]): void;
123
+ /**
124
+ * Resolve on the next emission of the given server event.
125
+ * Rejects when the signal aborts, the timeout elapses, or the channel is disposed.
126
+ */
127
+ wait<K extends EventKey<TServer>>(event: K, opts?: {
128
+ signal?: AbortSignal;
129
+ timeout?: number;
130
+ }): Promise<TServer[K]>;
131
+ };
132
+ /**
133
+ * A reactive presence channel that tracks members' state in a room.
134
+ * Obtain one via `pulse.presence(room)`.
135
+ *
136
+ * @example
137
+ * const lobby = pulse.presence<{ name: string; status: string }>('lobby');
138
+ * effect(() => console.log('Online:', [...lobby.state.value.keys()]));
139
+ * lobby.update({ name: 'Alice', status: 'online' });
140
+ */
141
+ export type PresenceChannel<T = unknown> = {
142
+ /** Delegates to `dispose()`. Enables `using` declarations. */
143
+ [Symbol.dispose](): void;
144
+ /** `AbortSignal` aborted when `dispose()` is called. */
145
+ readonly disposalSignal: AbortSignal;
146
+ /** Permanently stops tracking. Sends a leave frame to the server. */
147
+ dispose(): void;
148
+ /** Whether this presence channel has been disposed. */
149
+ readonly disposed: boolean;
150
+ /**
151
+ * Register a handler called whenever a new member joins with their initial state.
152
+ * Returns an unsubscribe function.
153
+ */
154
+ onJoin(handler: (memberId: string, state: T) => void): Unsubscribe;
155
+ /**
156
+ * Register a handler called whenever a member leaves.
157
+ * Returns an unsubscribe function.
158
+ */
159
+ onLeave(handler: (memberId: string) => void): Unsubscribe;
160
+ /** Room name passed to `pulse.presence()`. */
161
+ readonly room: string;
162
+ /** Reactive map of `memberId → state`. Updates whenever any member joins, leaves, or updates. */
163
+ readonly state: Readable<ReadonlyMap<string, T>>;
164
+ /**
165
+ * Broadcast this client's presence state to all room members.
166
+ * Calling this also implicitly joins the room if not already joined.
167
+ */
168
+ update(state: T): void;
169
+ };
170
+ export type Pulse<TServer extends MessageMap = MessageMap, TClient extends MessageMap = MessageMap> = {
171
+ /** Delegates to `dispose()`. Enables `using` declarations. */
172
+ [Symbol.dispose](): void;
173
+ /**
174
+ * Return an isolated message namespace over the shared connection.
175
+ * Multiple calls with the same name return the **same** channel object —
176
+ * dispose it once to remove the subscription.
177
+ */
178
+ channel<TChServer extends MessageMap = TServer, TChClient extends MessageMap = TClient>(name: string): PulseChannel<TChServer, TChClient>;
179
+ /**
180
+ * Explicitly open the connection. Resolves when `'open'` fires.
181
+ * Required when `lazy: true`; otherwise called automatically on creation.
182
+ * Rejects if the connection closes before opening.
183
+ */
184
+ connect(): Promise<void>;
185
+ /**
186
+ * Close the connection without triggering reconnection.
187
+ * @param code WebSocket close code (default: 1000).
188
+ * @param reason Human-readable close reason string.
189
+ */
190
+ disconnect(code?: number, reason?: string): void;
191
+ /** `AbortSignal` aborted when `dispose()` is called. */
192
+ readonly disposalSignal: AbortSignal;
193
+ /** Permanently closes the connection and releases all resources. Idempotent. */
194
+ dispose(): void;
195
+ /** Whether the instance has been permanently disposed. */
196
+ readonly disposed: boolean;
197
+ /**
198
+ * Request to join a room. Resolves when the server confirms with a `joined` frame.
199
+ * Rejects if the pulse is disposed, the signal aborts, or the timeout elapses.
200
+ */
201
+ join(room: string, opts?: {
202
+ signal?: AbortSignal;
203
+ timeout?: number;
204
+ }): Promise<void>;
205
+ /**
206
+ * Request to leave a room. Resolves when the server confirms with a `left` frame.
207
+ * Rejects if the pulse is disposed, the signal aborts, or the timeout elapses.
208
+ */
209
+ leave(room: string, opts?: {
210
+ signal?: AbortSignal;
211
+ timeout?: number;
212
+ }): Promise<void>;
213
+ /**
214
+ * Subscribe to a typed server event. Returns an unsubscribe function.
215
+ * The same handler can be registered multiple times independently.
216
+ */
217
+ on<K extends EventKey<TServer>>(event: K, handler: (payload: TServer[K]) => void): Unsubscribe;
218
+ /** Subscribe once — auto-removes after first invocation. */
219
+ once<K extends EventKey<TServer>>(event: K, handler: (payload: TServer[K]) => void): Unsubscribe;
220
+ /**
221
+ * Return a presence channel that tracks all members' state in a room.
222
+ * Calling `presence()` implicitly joins the room.
223
+ */
224
+ presence<T>(room: string): PresenceChannel<T>;
225
+ /** Reactive set of rooms the client is currently a member of. */
226
+ readonly rooms: Readable<ReadonlySet<string>>;
227
+ /**
228
+ * Send a typed event to the server. If buffering is enabled, the message is
229
+ * queued when the connection is not open and flushed on reconnect.
230
+ */
231
+ send<K extends EventKey<TClient>>(event: K, payload: TClient[K]): void;
232
+ /** Reactive connection status. */
233
+ readonly status: Readable<PulseStatus>;
234
+ /**
235
+ * Resolve on the next emission of the given server event.
236
+ * Rejects when `opts.signal` aborts or the instance is disposed.
237
+ */
238
+ wait<K extends EventKey<TServer>>(event: K, opts?: {
239
+ signal?: AbortSignal;
240
+ timeout?: number;
241
+ }): Promise<TServer[K]>;
242
+ };
243
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAIjD,qEAAqE;AACrE,MAAM,MAAM,WAAW,CAAC,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC,CAAC;AAI5E,kFAAkF;AAClF,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEjD,kDAAkD;AAClD,MAAM,MAAM,QAAQ,CAAC,CAAC,SAAS,UAAU,IAAI,MAAM,CAAC,GAAG,MAAM,CAAC;AAE9D,uDAAuD;AACvD,MAAM,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC;AAIrC,6CAA6C;AAC7C,MAAM,MAAM,WAAW,GAAG,YAAY,GAAG,MAAM,GAAG,cAAc,GAAG,QAAQ,CAAC;AAI5E,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,CAAC,CAAC;IAC/C,8EAA8E;IAC9E,WAAW,CAAC,EAAE,MAAM,CAAC;CAC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,GAAG,IAAI,CAAC;IACvE,kCAAkC;IAClC,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,WAAW,CAAC,CAAC;IACvC;;;OAGG;IACH,IAAI,CAAC,CAAC,SAAS,QAAQ,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,WAAW,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;CACrH,CAAC"}
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "@vielzeug/pulse",
3
+ "version": "1.0.3",
4
+ "description": "Typed WebSocket client with channel multiplexing, presence tracking, auto-reconnect, and heartbeat",
5
+ "type": "module",
6
+ "files": [
7
+ "dist"
8
+ ],
9
+ "main": "./dist/index.cjs",
10
+ "module": "./dist/index.js",
11
+ "types": "dist/index.d.ts",
12
+ "exports": {
13
+ ".": {
14
+ "source": "./src/index.ts",
15
+ "types": "./dist/index.d.ts",
16
+ "import": "./dist/index.js",
17
+ "require": "./dist/index.cjs"
18
+ }
19
+ },
20
+ "scripts": {
21
+ "build": "vite build && pnpm run build:bundle && pnpm run build:types",
22
+ "build:bundle": "vite build --config vite.bundle.config.ts",
23
+ "build:types": "tsc -p tsconfig.declarations.json",
24
+ "fix": "eslint --fix src",
25
+ "lint": "eslint src",
26
+ "prepublishOnly": "pnpm run build",
27
+ "preview": "vite preview",
28
+ "test": "vitest"
29
+ },
30
+ "publishConfig": {
31
+ "access": "public",
32
+ "registry": "https://registry.npmjs.org/"
33
+ },
34
+ "dependencies": {
35
+ "@vielzeug/ripple": "workspace:*"
36
+ },
37
+ "devDependencies": {
38
+ "@types/node": "^26.1.0",
39
+ "typescript": "~6.0.3",
40
+ "vite": "^8.1.3",
41
+ "vitest": "^4.1.9"
42
+ }
43
+ }