r2-notify-client 1.0.0
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.
- package/LICENSE +21 -0
- package/README.md +303 -0
- package/dist/index.cjs +407 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +78 -0
- package/dist/index.d.ts +78 -0
- package/dist/index.js +393 -0
- package/dist/index.js.map +1 -0
- package/package.json +54 -0
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,407 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
9
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
|
+
};
|
|
11
|
+
var __export = (target, all) => {
|
|
12
|
+
for (var name in all)
|
|
13
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
14
|
+
};
|
|
15
|
+
var __copyProps = (to, from, except, desc) => {
|
|
16
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
17
|
+
for (let key of __getOwnPropNames(from))
|
|
18
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
19
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
20
|
+
}
|
|
21
|
+
return to;
|
|
22
|
+
};
|
|
23
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
24
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
25
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
26
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
27
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
28
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
29
|
+
mod
|
|
30
|
+
));
|
|
31
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
32
|
+
|
|
33
|
+
// ../../node_modules/eventemitter3/index.js
|
|
34
|
+
var require_eventemitter3 = __commonJS({
|
|
35
|
+
"../../node_modules/eventemitter3/index.js"(exports2, module2) {
|
|
36
|
+
"use strict";
|
|
37
|
+
var has = Object.prototype.hasOwnProperty;
|
|
38
|
+
var prefix = "~";
|
|
39
|
+
function Events() {
|
|
40
|
+
}
|
|
41
|
+
if (Object.create) {
|
|
42
|
+
Events.prototype = /* @__PURE__ */ Object.create(null);
|
|
43
|
+
if (!new Events().__proto__) prefix = false;
|
|
44
|
+
}
|
|
45
|
+
function EE(fn, context, once) {
|
|
46
|
+
this.fn = fn;
|
|
47
|
+
this.context = context;
|
|
48
|
+
this.once = once || false;
|
|
49
|
+
}
|
|
50
|
+
function addListener(emitter, event, fn, context, once) {
|
|
51
|
+
if (typeof fn !== "function") {
|
|
52
|
+
throw new TypeError("The listener must be a function");
|
|
53
|
+
}
|
|
54
|
+
var listener = new EE(fn, context || emitter, once), evt = prefix ? prefix + event : event;
|
|
55
|
+
if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++;
|
|
56
|
+
else if (!emitter._events[evt].fn) emitter._events[evt].push(listener);
|
|
57
|
+
else emitter._events[evt] = [emitter._events[evt], listener];
|
|
58
|
+
return emitter;
|
|
59
|
+
}
|
|
60
|
+
function clearEvent(emitter, evt) {
|
|
61
|
+
if (--emitter._eventsCount === 0) emitter._events = new Events();
|
|
62
|
+
else delete emitter._events[evt];
|
|
63
|
+
}
|
|
64
|
+
function EventEmitter2() {
|
|
65
|
+
this._events = new Events();
|
|
66
|
+
this._eventsCount = 0;
|
|
67
|
+
}
|
|
68
|
+
EventEmitter2.prototype.eventNames = function eventNames() {
|
|
69
|
+
var names = [], events, name;
|
|
70
|
+
if (this._eventsCount === 0) return names;
|
|
71
|
+
for (name in events = this._events) {
|
|
72
|
+
if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);
|
|
73
|
+
}
|
|
74
|
+
if (Object.getOwnPropertySymbols) {
|
|
75
|
+
return names.concat(Object.getOwnPropertySymbols(events));
|
|
76
|
+
}
|
|
77
|
+
return names;
|
|
78
|
+
};
|
|
79
|
+
EventEmitter2.prototype.listeners = function listeners(event) {
|
|
80
|
+
var evt = prefix ? prefix + event : event, handlers = this._events[evt];
|
|
81
|
+
if (!handlers) return [];
|
|
82
|
+
if (handlers.fn) return [handlers.fn];
|
|
83
|
+
for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) {
|
|
84
|
+
ee[i] = handlers[i].fn;
|
|
85
|
+
}
|
|
86
|
+
return ee;
|
|
87
|
+
};
|
|
88
|
+
EventEmitter2.prototype.listenerCount = function listenerCount(event) {
|
|
89
|
+
var evt = prefix ? prefix + event : event, listeners = this._events[evt];
|
|
90
|
+
if (!listeners) return 0;
|
|
91
|
+
if (listeners.fn) return 1;
|
|
92
|
+
return listeners.length;
|
|
93
|
+
};
|
|
94
|
+
EventEmitter2.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {
|
|
95
|
+
var evt = prefix ? prefix + event : event;
|
|
96
|
+
if (!this._events[evt]) return false;
|
|
97
|
+
var listeners = this._events[evt], len = arguments.length, args, i;
|
|
98
|
+
if (listeners.fn) {
|
|
99
|
+
if (listeners.once) this.removeListener(event, listeners.fn, void 0, true);
|
|
100
|
+
switch (len) {
|
|
101
|
+
case 1:
|
|
102
|
+
return listeners.fn.call(listeners.context), true;
|
|
103
|
+
case 2:
|
|
104
|
+
return listeners.fn.call(listeners.context, a1), true;
|
|
105
|
+
case 3:
|
|
106
|
+
return listeners.fn.call(listeners.context, a1, a2), true;
|
|
107
|
+
case 4:
|
|
108
|
+
return listeners.fn.call(listeners.context, a1, a2, a3), true;
|
|
109
|
+
case 5:
|
|
110
|
+
return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;
|
|
111
|
+
case 6:
|
|
112
|
+
return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;
|
|
113
|
+
}
|
|
114
|
+
for (i = 1, args = new Array(len - 1); i < len; i++) {
|
|
115
|
+
args[i - 1] = arguments[i];
|
|
116
|
+
}
|
|
117
|
+
listeners.fn.apply(listeners.context, args);
|
|
118
|
+
} else {
|
|
119
|
+
var length = listeners.length, j;
|
|
120
|
+
for (i = 0; i < length; i++) {
|
|
121
|
+
if (listeners[i].once) this.removeListener(event, listeners[i].fn, void 0, true);
|
|
122
|
+
switch (len) {
|
|
123
|
+
case 1:
|
|
124
|
+
listeners[i].fn.call(listeners[i].context);
|
|
125
|
+
break;
|
|
126
|
+
case 2:
|
|
127
|
+
listeners[i].fn.call(listeners[i].context, a1);
|
|
128
|
+
break;
|
|
129
|
+
case 3:
|
|
130
|
+
listeners[i].fn.call(listeners[i].context, a1, a2);
|
|
131
|
+
break;
|
|
132
|
+
case 4:
|
|
133
|
+
listeners[i].fn.call(listeners[i].context, a1, a2, a3);
|
|
134
|
+
break;
|
|
135
|
+
default:
|
|
136
|
+
if (!args) for (j = 1, args = new Array(len - 1); j < len; j++) {
|
|
137
|
+
args[j - 1] = arguments[j];
|
|
138
|
+
}
|
|
139
|
+
listeners[i].fn.apply(listeners[i].context, args);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
return true;
|
|
144
|
+
};
|
|
145
|
+
EventEmitter2.prototype.on = function on(event, fn, context) {
|
|
146
|
+
return addListener(this, event, fn, context, false);
|
|
147
|
+
};
|
|
148
|
+
EventEmitter2.prototype.once = function once(event, fn, context) {
|
|
149
|
+
return addListener(this, event, fn, context, true);
|
|
150
|
+
};
|
|
151
|
+
EventEmitter2.prototype.removeListener = function removeListener(event, fn, context, once) {
|
|
152
|
+
var evt = prefix ? prefix + event : event;
|
|
153
|
+
if (!this._events[evt]) return this;
|
|
154
|
+
if (!fn) {
|
|
155
|
+
clearEvent(this, evt);
|
|
156
|
+
return this;
|
|
157
|
+
}
|
|
158
|
+
var listeners = this._events[evt];
|
|
159
|
+
if (listeners.fn) {
|
|
160
|
+
if (listeners.fn === fn && (!once || listeners.once) && (!context || listeners.context === context)) {
|
|
161
|
+
clearEvent(this, evt);
|
|
162
|
+
}
|
|
163
|
+
} else {
|
|
164
|
+
for (var i = 0, events = [], length = listeners.length; i < length; i++) {
|
|
165
|
+
if (listeners[i].fn !== fn || once && !listeners[i].once || context && listeners[i].context !== context) {
|
|
166
|
+
events.push(listeners[i]);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;
|
|
170
|
+
else clearEvent(this, evt);
|
|
171
|
+
}
|
|
172
|
+
return this;
|
|
173
|
+
};
|
|
174
|
+
EventEmitter2.prototype.removeAllListeners = function removeAllListeners(event) {
|
|
175
|
+
var evt;
|
|
176
|
+
if (event) {
|
|
177
|
+
evt = prefix ? prefix + event : event;
|
|
178
|
+
if (this._events[evt]) clearEvent(this, evt);
|
|
179
|
+
} else {
|
|
180
|
+
this._events = new Events();
|
|
181
|
+
this._eventsCount = 0;
|
|
182
|
+
}
|
|
183
|
+
return this;
|
|
184
|
+
};
|
|
185
|
+
EventEmitter2.prototype.off = EventEmitter2.prototype.removeListener;
|
|
186
|
+
EventEmitter2.prototype.addListener = EventEmitter2.prototype.on;
|
|
187
|
+
EventEmitter2.prefixed = prefix;
|
|
188
|
+
EventEmitter2.EventEmitter = EventEmitter2;
|
|
189
|
+
if ("undefined" !== typeof module2) {
|
|
190
|
+
module2.exports = EventEmitter2;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
// src/index.ts
|
|
196
|
+
var index_exports = {};
|
|
197
|
+
__export(index_exports, {
|
|
198
|
+
R2NotifyClient: () => R2NotifyClient
|
|
199
|
+
});
|
|
200
|
+
module.exports = __toCommonJS(index_exports);
|
|
201
|
+
|
|
202
|
+
// ../../node_modules/eventemitter3/index.mjs
|
|
203
|
+
var import_index = __toESM(require_eventemitter3(), 1);
|
|
204
|
+
var eventemitter3_default = import_index.default;
|
|
205
|
+
|
|
206
|
+
// src/connection.ts
|
|
207
|
+
var Connection = class {
|
|
208
|
+
/**
|
|
209
|
+
* Creates a new Connection instance.
|
|
210
|
+
*
|
|
211
|
+
* @param {string} url - The URL of the WebSocket endpoint.
|
|
212
|
+
* @param {string} clientId - The unique identification of the client
|
|
213
|
+
* @param {string} [token] - The authentication token to use for the connection. If not provided, the connection will not be authenticated.
|
|
214
|
+
* @param {boolean} [debug=false] - Whether to enable debug logging for the connection.
|
|
215
|
+
*/
|
|
216
|
+
constructor(url, clientId, token, debug = false) {
|
|
217
|
+
this.url = url;
|
|
218
|
+
this.clientId = clientId;
|
|
219
|
+
this.token = token;
|
|
220
|
+
this.debug = debug;
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Establishes a WebSocket connection to the specified URL.
|
|
224
|
+
*
|
|
225
|
+
* @param {((data: any) => void)} onMessage - A callback function to handle incoming messages from the WebSocket connection.
|
|
226
|
+
* @param {((ev: CloseEvent) => void)} onClose - A callback function to handle the WebSocket connection being closed.
|
|
227
|
+
* @param {(() => void)} [onOpen] - An optional callback function to handle the WebSocket connection being opened.
|
|
228
|
+
* @param {(() => void)} [onError] - An optional callback function to handle the WebSocket connection on error.
|
|
229
|
+
*/
|
|
230
|
+
connect(onMessage, onClose, onOpen, onError) {
|
|
231
|
+
const headersParam = this.token ? `&token=${encodeURIComponent(this.token)}` : "";
|
|
232
|
+
const ws = new WebSocket(`${this.url}?userId=${encodeURIComponent(this.clientId)}${headersParam}`);
|
|
233
|
+
this.ws = ws;
|
|
234
|
+
ws.onopen = () => {
|
|
235
|
+
if (this.debug) console.log("[r2 client] connected");
|
|
236
|
+
onOpen?.();
|
|
237
|
+
};
|
|
238
|
+
ws.onmessage = (ev) => {
|
|
239
|
+
try {
|
|
240
|
+
const data = JSON.parse(ev.data);
|
|
241
|
+
onMessage(data);
|
|
242
|
+
} catch (e) {
|
|
243
|
+
if (this.debug) console.warn("[r2 client] invalid json", e);
|
|
244
|
+
}
|
|
245
|
+
};
|
|
246
|
+
ws.onclose = (ev) => {
|
|
247
|
+
if (this.debug) console.log("[r2 client] closed", ev.code, ev.reason);
|
|
248
|
+
onClose(ev);
|
|
249
|
+
};
|
|
250
|
+
ws.onerror = (err) => {
|
|
251
|
+
if (this.debug) console.error("[r2 client] error", err);
|
|
252
|
+
onError?.(err);
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Sends a message to the WebSocket connection.
|
|
257
|
+
*
|
|
258
|
+
* @param {unknown} obj - The message to be sent. The object will be stringified with JSON.stringify() before being sent.
|
|
259
|
+
*
|
|
260
|
+
* @throws {Error} If the WebSocket connection is not open, throws an error.
|
|
261
|
+
*/
|
|
262
|
+
send(obj) {
|
|
263
|
+
if (!this.ws || this.ws.readyState !== WebSocket.OPEN) {
|
|
264
|
+
throw new Error("WebSocket is not open");
|
|
265
|
+
}
|
|
266
|
+
this.ws.send(JSON.stringify(obj));
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Closes the WebSocket connection.
|
|
270
|
+
*
|
|
271
|
+
* @param {number} [code] - The close event code to send to the server.
|
|
272
|
+
* @param {string} [reason] - The close event reason to send to the server.
|
|
273
|
+
*/
|
|
274
|
+
close(code, reason) {
|
|
275
|
+
this.ws?.close(code, reason);
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Checks if the WebSocket connection is currently open.
|
|
279
|
+
*
|
|
280
|
+
* @returns {boolean} True if the connection is open, false otherwise.
|
|
281
|
+
*/
|
|
282
|
+
isOpen() {
|
|
283
|
+
return this.ws?.readyState === WebSocket.OPEN;
|
|
284
|
+
}
|
|
285
|
+
};
|
|
286
|
+
|
|
287
|
+
// src/protocol.ts
|
|
288
|
+
function makeAction(action, data) {
|
|
289
|
+
return { event: action, data };
|
|
290
|
+
}
|
|
291
|
+
function isServerEventEnvelope(x) {
|
|
292
|
+
return !!x && typeof x === "object" && typeof x.event === "string" && ("payload" in x || "data" in x);
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
// src/R2NotifyClient.ts
|
|
296
|
+
var R2NotifyClient = class extends eventemitter3_default {
|
|
297
|
+
constructor(options) {
|
|
298
|
+
super();
|
|
299
|
+
this.closedByUser = false;
|
|
300
|
+
this.isConnected = false;
|
|
301
|
+
this.opts = {
|
|
302
|
+
url: options.url,
|
|
303
|
+
clientId: options.clientId,
|
|
304
|
+
token: options.token,
|
|
305
|
+
reconnect: options.reconnect ?? true,
|
|
306
|
+
reconnectDelayMs: options.reconnectDelayMs ?? 1500,
|
|
307
|
+
debug: options.debug ?? false
|
|
308
|
+
};
|
|
309
|
+
this.conn = new Connection(this.opts.url, this.opts.clientId, this.opts.token, this.opts.debug);
|
|
310
|
+
}
|
|
311
|
+
connect(handlers) {
|
|
312
|
+
if (this.isConnected) return this;
|
|
313
|
+
this.isConnected = true;
|
|
314
|
+
if (handlers) {
|
|
315
|
+
for (const [evt, fn] of Object.entries(handlers)) {
|
|
316
|
+
if (fn) {
|
|
317
|
+
this.on(evt, fn);
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
const onMessage = (data) => {
|
|
322
|
+
if (isServerEventEnvelope(data)) {
|
|
323
|
+
const { event } = data;
|
|
324
|
+
const payload = "payload" in data ? data.payload : data.data;
|
|
325
|
+
if (this.opts.debug) console.log("[r2 client] <-", event, payload);
|
|
326
|
+
this.emit(event, payload);
|
|
327
|
+
} else {
|
|
328
|
+
if (this.opts.debug) console.warn("[r2 client] unknown message", data);
|
|
329
|
+
}
|
|
330
|
+
};
|
|
331
|
+
const onOpen = () => {
|
|
332
|
+
if (this.opts.debug) console.log("[r2 client] connected");
|
|
333
|
+
this.emit("connected");
|
|
334
|
+
};
|
|
335
|
+
const onClose = (_ev) => {
|
|
336
|
+
if (this.opts.debug) console.log("[r2 client] disconnected");
|
|
337
|
+
this.emit("disconnected");
|
|
338
|
+
if (!this.closedByUser && this.opts.reconnect) {
|
|
339
|
+
this.scheduleReconnect();
|
|
340
|
+
}
|
|
341
|
+
this.isConnected = false;
|
|
342
|
+
};
|
|
343
|
+
const onError = (err) => {
|
|
344
|
+
const errorObj = err instanceof Error ? err : new Error(err?.type ? `WebSocket error: ${err.type}` : "WebSocket error");
|
|
345
|
+
if (this.opts.debug) console.error("[r2 client] ws error", errorObj);
|
|
346
|
+
this.emit("error", errorObj);
|
|
347
|
+
};
|
|
348
|
+
this.conn.connect(onMessage, onClose, onOpen, onError);
|
|
349
|
+
return this;
|
|
350
|
+
}
|
|
351
|
+
scheduleReconnect() {
|
|
352
|
+
if (this.reconnectTimer) return;
|
|
353
|
+
if (this.opts.debug) console.log("[r2 client] scheduling reconnect");
|
|
354
|
+
this.reconnectTimer = setTimeout(() => {
|
|
355
|
+
this.reconnectTimer = void 0;
|
|
356
|
+
if (this.closedByUser) return;
|
|
357
|
+
this.conn = new Connection(this.opts.url, this.opts.clientId, this.opts.token, this.opts.debug);
|
|
358
|
+
this.connect();
|
|
359
|
+
}, this.opts.reconnectDelayMs);
|
|
360
|
+
}
|
|
361
|
+
close() {
|
|
362
|
+
this.closedByUser = true;
|
|
363
|
+
this.conn.close(1e3, "client-close");
|
|
364
|
+
}
|
|
365
|
+
// ---- Action Emitters ----
|
|
366
|
+
emitAction(action, payload) {
|
|
367
|
+
const envelope = makeAction(action, payload);
|
|
368
|
+
if (this.opts.debug) console.log("[r2 client] ->", envelope);
|
|
369
|
+
this.conn.send(envelope);
|
|
370
|
+
}
|
|
371
|
+
// Convenience helpers...
|
|
372
|
+
markAsRead() {
|
|
373
|
+
this.emitAction("markAsRead");
|
|
374
|
+
}
|
|
375
|
+
markAppAsRead(appId) {
|
|
376
|
+
this.emitAction("markAppAsRead", { appId });
|
|
377
|
+
}
|
|
378
|
+
markGroupAsRead(appId, groupKey) {
|
|
379
|
+
this.emitAction("markGroupAsRead", { appId, groupKey });
|
|
380
|
+
}
|
|
381
|
+
markNotificationAsRead(id) {
|
|
382
|
+
this.emitAction("markNotificationAsRead", { id });
|
|
383
|
+
}
|
|
384
|
+
deleteNotifications() {
|
|
385
|
+
this.emitAction("deleteNotifications");
|
|
386
|
+
}
|
|
387
|
+
deleteAppNotifications(appId) {
|
|
388
|
+
this.emitAction("deleteAppNotifications", { appId });
|
|
389
|
+
}
|
|
390
|
+
deleteGroupNotifications(appId, groupKey) {
|
|
391
|
+
this.emitAction("deleteGroupNotifications", { appId, groupKey });
|
|
392
|
+
}
|
|
393
|
+
deleteNotification(id) {
|
|
394
|
+
this.emitAction("deleteNotification", { id });
|
|
395
|
+
}
|
|
396
|
+
reloadNotifications() {
|
|
397
|
+
this.emitAction("reloadNotifications");
|
|
398
|
+
}
|
|
399
|
+
setNotificationStatus(enableNotification) {
|
|
400
|
+
this.emitAction("setNotificationStatus", { enableNotification });
|
|
401
|
+
}
|
|
402
|
+
};
|
|
403
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
404
|
+
0 && (module.exports = {
|
|
405
|
+
R2NotifyClient
|
|
406
|
+
});
|
|
407
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../node_modules/eventemitter3/index.js","../src/index.ts","../../../node_modules/eventemitter3/index.mjs","../src/connection.ts","../src/protocol.ts","../src/R2NotifyClient.ts"],"sourcesContent":["'use strict';\n\nvar has = Object.prototype.hasOwnProperty\n , prefix = '~';\n\n/**\n * Constructor to create a storage for our `EE` objects.\n * An `Events` instance is a plain object whose properties are event names.\n *\n * @constructor\n * @private\n */\nfunction Events() {}\n\n//\n// We try to not inherit from `Object.prototype`. In some engines creating an\n// instance in this way is faster than calling `Object.create(null)` directly.\n// If `Object.create(null)` is not supported we prefix the event names with a\n// character to make sure that the built-in object properties are not\n// overridden or used as an attack vector.\n//\nif (Object.create) {\n Events.prototype = Object.create(null);\n\n //\n // This hack is needed because the `__proto__` property is still inherited in\n // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.\n //\n if (!new Events().__proto__) prefix = false;\n}\n\n/**\n * Representation of a single event listener.\n *\n * @param {Function} fn The listener function.\n * @param {*} context The context to invoke the listener with.\n * @param {Boolean} [once=false] Specify if the listener is a one-time listener.\n * @constructor\n * @private\n */\nfunction EE(fn, context, once) {\n this.fn = fn;\n this.context = context;\n this.once = once || false;\n}\n\n/**\n * Add a listener for a given event.\n *\n * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} context The context to invoke the listener with.\n * @param {Boolean} once Specify if the listener is a one-time listener.\n * @returns {EventEmitter}\n * @private\n */\nfunction addListener(emitter, event, fn, context, once) {\n if (typeof fn !== 'function') {\n throw new TypeError('The listener must be a function');\n }\n\n var listener = new EE(fn, context || emitter, once)\n , evt = prefix ? prefix + event : event;\n\n if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++;\n else if (!emitter._events[evt].fn) emitter._events[evt].push(listener);\n else emitter._events[evt] = [emitter._events[evt], listener];\n\n return emitter;\n}\n\n/**\n * Clear event by name.\n *\n * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.\n * @param {(String|Symbol)} evt The Event name.\n * @private\n */\nfunction clearEvent(emitter, evt) {\n if (--emitter._eventsCount === 0) emitter._events = new Events();\n else delete emitter._events[evt];\n}\n\n/**\n * Minimal `EventEmitter` interface that is molded against the Node.js\n * `EventEmitter` interface.\n *\n * @constructor\n * @public\n */\nfunction EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}\n\n/**\n * Return an array listing the events for which the emitter has registered\n * listeners.\n *\n * @returns {Array}\n * @public\n */\nEventEmitter.prototype.eventNames = function eventNames() {\n var names = []\n , events\n , name;\n\n if (this._eventsCount === 0) return names;\n\n for (name in (events = this._events)) {\n if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);\n }\n\n if (Object.getOwnPropertySymbols) {\n return names.concat(Object.getOwnPropertySymbols(events));\n }\n\n return names;\n};\n\n/**\n * Return the listeners registered for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Array} The registered listeners.\n * @public\n */\nEventEmitter.prototype.listeners = function listeners(event) {\n var evt = prefix ? prefix + event : event\n , handlers = this._events[evt];\n\n if (!handlers) return [];\n if (handlers.fn) return [handlers.fn];\n\n for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) {\n ee[i] = handlers[i].fn;\n }\n\n return ee;\n};\n\n/**\n * Return the number of listeners listening to a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Number} The number of listeners.\n * @public\n */\nEventEmitter.prototype.listenerCount = function listenerCount(event) {\n var evt = prefix ? prefix + event : event\n , listeners = this._events[evt];\n\n if (!listeners) return 0;\n if (listeners.fn) return 1;\n return listeners.length;\n};\n\n/**\n * Calls each of the listeners registered for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Boolean} `true` if the event had listeners, else `false`.\n * @public\n */\nEventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) return false;\n\n var listeners = this._events[evt]\n , len = arguments.length\n , args\n , i;\n\n if (listeners.fn) {\n if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);\n\n switch (len) {\n case 1: return listeners.fn.call(listeners.context), true;\n case 2: return listeners.fn.call(listeners.context, a1), true;\n case 3: return listeners.fn.call(listeners.context, a1, a2), true;\n case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;\n case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;\n case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;\n }\n\n for (i = 1, args = new Array(len -1); i < len; i++) {\n args[i - 1] = arguments[i];\n }\n\n listeners.fn.apply(listeners.context, args);\n } else {\n var length = listeners.length\n , j;\n\n for (i = 0; i < length; i++) {\n if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);\n\n switch (len) {\n case 1: listeners[i].fn.call(listeners[i].context); break;\n case 2: listeners[i].fn.call(listeners[i].context, a1); break;\n case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;\n case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;\n default:\n if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {\n args[j - 1] = arguments[j];\n }\n\n listeners[i].fn.apply(listeners[i].context, args);\n }\n }\n }\n\n return true;\n};\n\n/**\n * Add a listener for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.on = function on(event, fn, context) {\n return addListener(this, event, fn, context, false);\n};\n\n/**\n * Add a one-time listener for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.once = function once(event, fn, context) {\n return addListener(this, event, fn, context, true);\n};\n\n/**\n * Remove the listeners of a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn Only remove the listeners that match this function.\n * @param {*} context Only remove the listeners that have this context.\n * @param {Boolean} once Only remove one-time listeners.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) return this;\n if (!fn) {\n clearEvent(this, evt);\n return this;\n }\n\n var listeners = this._events[evt];\n\n if (listeners.fn) {\n if (\n listeners.fn === fn &&\n (!once || listeners.once) &&\n (!context || listeners.context === context)\n ) {\n clearEvent(this, evt);\n }\n } else {\n for (var i = 0, events = [], length = listeners.length; i < length; i++) {\n if (\n listeners[i].fn !== fn ||\n (once && !listeners[i].once) ||\n (context && listeners[i].context !== context)\n ) {\n events.push(listeners[i]);\n }\n }\n\n //\n // Reset the array, or remove it completely if we have no more listeners.\n //\n if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;\n else clearEvent(this, evt);\n }\n\n return this;\n};\n\n/**\n * Remove all listeners, or those of the specified event.\n *\n * @param {(String|Symbol)} [event] The event name.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {\n var evt;\n\n if (event) {\n evt = prefix ? prefix + event : event;\n if (this._events[evt]) clearEvent(this, evt);\n } else {\n this._events = new Events();\n this._eventsCount = 0;\n }\n\n return this;\n};\n\n//\n// Alias methods names because people roll like that.\n//\nEventEmitter.prototype.off = EventEmitter.prototype.removeListener;\nEventEmitter.prototype.addListener = EventEmitter.prototype.on;\n\n//\n// Expose the prefix.\n//\nEventEmitter.prefixed = prefix;\n\n//\n// Allow `EventEmitter` to be imported as module namespace.\n//\nEventEmitter.EventEmitter = EventEmitter;\n\n//\n// Expose the module.\n//\nif ('undefined' !== typeof module) {\n module.exports = EventEmitter;\n}\n","export * from \"./types\";\nexport * from \"./R2NotifyClient\";","import EventEmitter from './index.js'\n\nexport { EventEmitter }\nexport default EventEmitter\n","export type WSLike = WebSocket; // Browser WebSocket\n\nexport class Connection {\n private ws?: WSLike;\n private url: string;\n private clientId: string;\n private token?: string;\n private debug: boolean;\n\n /**\n * Creates a new Connection instance.\n *\n * @param {string} url - The URL of the WebSocket endpoint.\n * @param {string} clientId - The unique identification of the client\n * @param {string} [token] - The authentication token to use for the connection. If not provided, the connection will not be authenticated.\n * @param {boolean} [debug=false] - Whether to enable debug logging for the connection.\n */\n constructor(url: string, clientId: string, token?: string, debug: boolean = false) {\n this.url = url;\n this.clientId = clientId;\n this.token = token;\n this.debug = debug;\n }\n\n /**\n * Establishes a WebSocket connection to the specified URL.\n *\n * @param {((data: any) => void)} onMessage - A callback function to handle incoming messages from the WebSocket connection.\n * @param {((ev: CloseEvent) => void)} onClose - A callback function to handle the WebSocket connection being closed.\n * @param {(() => void)} [onOpen] - An optional callback function to handle the WebSocket connection being opened.\n * @param {(() => void)} [onError] - An optional callback function to handle the WebSocket connection on error.\n */\n connect(onMessage: (data: any) => void, onClose: (ev: CloseEvent) => void, onOpen?: () => void, onError?: (ev: Event) => void) {\n const headersParam = this.token ? `&token=${encodeURIComponent(this.token)}` : \"\";\n const ws = new WebSocket(`${this.url}?userId=${encodeURIComponent(this.clientId)}${headersParam}`);\n this.ws = ws;\n\n /**\n * Called when the WebSocket connection is opened.\n *\n * If `debug` is true, logs a message to the console indicating that the connection is open.\n * If `onOpen` is provided, calls it with no arguments.\n */\n ws.onopen = () => {\n if (this.debug) console.log(\"[r2 client] connected\");\n onOpen?.();\n };\n /**\n * Handles incoming messages from the WebSocket connection.\n *\n * Tries to parse the incoming message as JSON and calls the `onMessage` callback with the parsed data.\n * If the message is not valid JSON, logs a warning to the console if `debug` is true.\n */\n ws.onmessage = (ev) => {\n try {\n const data = JSON.parse(ev.data as string);\n onMessage(data);\n } catch (e) {\n if (this.debug) console.warn(\"[r2 client] invalid json\", e);\n }\n };\n /**\n * Called when the WebSocket connection is closed.\n *\n * If `debug` is true, logs a message to the console indicating that the connection is closed, including the close event code and reason.\n * Calls the `onClose` callback with the close event.\n */\n ws.onclose = (ev) => {\n if (this.debug) console.log(\"[r2 client] closed\", ev.code, ev.reason);\n onClose(ev);\n };\n /**\n * Called when an error occurs with the WebSocket connection.\n *\n * If `debug` is true, logs an error message to the console with the error object.\n */\n ws.onerror = (err) => {\n if (this.debug) console.error(\"[r2 client] error\", err);\n onError?.(err);\n };\n }\n\n /**\n * Sends a message to the WebSocket connection.\n *\n * @param {unknown} obj - The message to be sent. The object will be stringified with JSON.stringify() before being sent.\n *\n * @throws {Error} If the WebSocket connection is not open, throws an error.\n */\n send(obj: unknown) {\n if (!this.ws || this.ws.readyState !== WebSocket.OPEN) {\n throw new Error(\"WebSocket is not open\");\n }\n this.ws.send(JSON.stringify(obj));\n }\n\n /**\n * Closes the WebSocket connection.\n *\n * @param {number} [code] - The close event code to send to the server.\n * @param {string} [reason] - The close event reason to send to the server.\n */\n close(code?: number, reason?: string) {\n this.ws?.close(code, reason);\n }\n\n /**\n * Checks if the WebSocket connection is currently open.\n *\n * @returns {boolean} True if the connection is open, false otherwise.\n */\n isOpen(): boolean {\n return this.ws?.readyState === WebSocket.OPEN;\n }\n}\n","import type { ActionEnvelope, NotifyAction, NotifyEvent, ServerEventEnvelope } from \"./types\";\n\n/**\n * Creates an ActionEnvelope with the given action and optional payload.\n * @param action The action to include in the envelope.\n * @param payload Optional payload to include in the envelope.\n * @returns An ActionEnvelope with the given action and optional payload.\n * @template TPayload The type of the payload.\n */\nexport function makeAction<TPayload = unknown>(action: NotifyAction, data?: TPayload): ActionEnvelope<TPayload> {\n return { event: action, data };\n}\n\n/**\n * Checks if the given value is a ServerEventEnvelope.\n *\n * A ServerEventEnvelope is an object with an \"event\" property.\n * @param x The value to check.\n * @returns True if x is a ServerEventEnvelope, false otherwise.\n */\nexport function isServerEventEnvelope(x: any): x is ServerEventEnvelope {\n return !!x && typeof x === \"object\" && typeof x.event === \"string\" && (\"payload\" in x || \"data\" in x);\n}\n\nexport type EventHandlers = Partial<Record<NotifyEvent, (payload: any) => void>>;\n","import EventEmitter from \"eventemitter3\";\r\nimport { Connection } from \"./connection\";\r\nimport { makeAction, isServerEventEnvelope, type EventHandlers } from \"./protocol\";\r\nimport type { R2NotifyClientOptions, NotifyAction, NotifyEvent, R2NotifyClientEvent } from \"./types\";\r\n\r\nexport class R2NotifyClient extends EventEmitter<R2NotifyClientEvent> {\r\n private conn: Connection;\r\n private opts: Required<Pick<R2NotifyClientOptions, \"reconnect\" | \"reconnectDelayMs\" | \"debug\">> &\r\n Omit<R2NotifyClientOptions, \"reconnect\" | \"reconnectDelayMs\" | \"debug\"> & { clientId: string };\r\n private reconnectTimer?: number;\r\n private closedByUser = false;\r\n private isConnected = false;\r\n\r\n constructor(options: R2NotifyClientOptions) {\r\n super();\r\n this.opts = {\r\n url: options.url,\r\n clientId: options.clientId,\r\n token: options.token,\r\n reconnect: options.reconnect ?? true,\r\n reconnectDelayMs: options.reconnectDelayMs ?? 1500,\r\n debug: options.debug ?? false,\r\n };\r\n this.conn = new Connection(this.opts.url, this.opts.clientId, this.opts.token, this.opts.debug);\r\n }\r\n\r\n connect(handlers?: EventHandlers) {\r\n if (this.isConnected) return this;\r\n\r\n this.isConnected = true;\r\n\r\n if (handlers) {\r\n for (const [evt, fn] of Object.entries(handlers)) {\r\n if (fn) {\r\n this.on(evt as NotifyEvent, fn);\r\n }\r\n }\r\n }\r\n\r\n const onMessage = (data: unknown) => {\r\n if (isServerEventEnvelope(data)) {\r\n const { event } = data;\r\n const payload = \"payload\" in data ? data.payload : data.data;\r\n if (this.opts.debug) console.log(\"[r2 client] <-\", event, payload);\r\n this.emit(event as NotifyEvent, payload as unknown);\r\n } else {\r\n if (this.opts.debug) console.warn(\"[r2 client] unknown message\", data);\r\n }\r\n };\r\n\r\n const onOpen = () => {\r\n if (this.opts.debug) console.log(\"[r2 client] connected\");\r\n this.emit(\"connected\"); // payload: void\r\n };\r\n\r\n const onClose = (_ev: CloseEvent) => {\r\n if (this.opts.debug) console.log(\"[r2 client] disconnected\");\r\n this.emit(\"disconnected\"); // payload: void\r\n if (!this.closedByUser && this.opts.reconnect) {\r\n this.scheduleReconnect();\r\n }\r\n this.isConnected = false;\r\n };\r\n\r\n const onError = (err: Event | Error) => {\r\n const errorObj = err instanceof Error ? err : new Error((err as Event)?.type ? `WebSocket error: ${(err as Event).type}` : \"WebSocket error\");\r\n if (this.opts.debug) console.error(\"[r2 client] ws error\", errorObj);\r\n this.emit(\"error\", errorObj);\r\n };\r\n\r\n this.conn.connect(onMessage, onClose, onOpen, onError);\r\n return this;\r\n }\r\n\r\n private scheduleReconnect() {\r\n if (this.reconnectTimer) return;\r\n if (this.opts.debug) console.log(\"[r2 client] scheduling reconnect\");\r\n this.reconnectTimer = setTimeout(() => {\r\n this.reconnectTimer = undefined;\r\n if (this.closedByUser) return;\r\n this.conn = new Connection(this.opts.url, this.opts.clientId, this.opts.token, this.opts.debug);\r\n this.connect(); // emits \"connected\" on success\r\n }, this.opts.reconnectDelayMs) as unknown as number;\r\n }\r\n\r\n close() {\r\n this.closedByUser = true;\r\n this.conn.close(1000, \"client-close\");\r\n }\r\n\r\n // ---- Action Emitters ----\r\n emitAction<TPayload = unknown>(action: NotifyAction, payload?: TPayload) {\r\n const envelope = makeAction(action, payload);\r\n if (this.opts.debug) console.log(\"[r2 client] ->\", envelope);\r\n this.conn.send(envelope);\r\n }\r\n\r\n // Convenience helpers...\r\n markAsRead() {\r\n this.emitAction(\"markAsRead\");\r\n }\r\n markAppAsRead(appId: string) {\r\n this.emitAction(\"markAppAsRead\", { appId });\r\n }\r\n markGroupAsRead(appId: string, groupKey: string) {\r\n this.emitAction(\"markGroupAsRead\", { appId, groupKey });\r\n }\r\n markNotificationAsRead(id: string) {\r\n this.emitAction(\"markNotificationAsRead\", { id });\r\n }\r\n\r\n deleteNotifications() {\r\n this.emitAction(\"deleteNotifications\");\r\n }\r\n deleteAppNotifications(appId: string) {\r\n this.emitAction(\"deleteAppNotifications\", { appId });\r\n }\r\n deleteGroupNotifications(appId: string, groupKey: string) {\r\n this.emitAction(\"deleteGroupNotifications\", { appId, groupKey });\r\n }\r\n deleteNotification(id: string) {\r\n this.emitAction(\"deleteNotification\", { id });\r\n }\r\n\r\n reloadNotifications() {\r\n this.emitAction(\"reloadNotifications\");\r\n }\r\n setNotificationStatus(enableNotification: boolean) {\r\n this.emitAction(\"setNotificationStatus\", { enableNotification });\r\n }\r\n}\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA,8CAAAA,UAAAC,SAAA;AAAA;AAEA,QAAI,MAAM,OAAO,U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AAAA,EACvC;AAAA,EACA,uBAAuB,OAAe;AACpC,SAAK,WAAW,0BAA0B,EAAE,MAAM,CAAC;AAAA,EACrD;AAAA,EACA,yBAAyB,OAAe,UAAkB;AACxD,SAAK,WAAW,4BAA4B,EAAE,OAAO,SAAS,CAAC;AAAA,EACjE;AAAA,EACA,mBAAmB,IAAY;AAC7B,SAAK,WAAW,sBAAsB,EAAE,GAAG,CAAC;AAAA,EAC9C;AAAA,EAEA,sBAAsB;AACpB,SAAK,WAAW,qBAAqB;AAAA,EACvC;AAAA,EACA,sBAAsB,oBAA6B;AACjD,SAAK,WAAW,yBAAyB,EAAE,mBAAmB,CAAC;AAAA,EACjE;AACF;","names":["exports","module","EventEmitter","EventEmitter"]}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import EventEmitter from 'eventemitter3';
|
|
2
|
+
|
|
3
|
+
type NotifyEvent = "listNotifications" | "newNotification" | "listConfigurations";
|
|
4
|
+
type ClientLifecycleEvent = "connected" | "disconnected" | "error";
|
|
5
|
+
type R2NotifyClientEvent = NotifyEvent | ClientLifecycleEvent;
|
|
6
|
+
type NotifyAction = "markAsRead" | "markAppAsRead" | "markGroupAsRead" | "markNotificationAsRead" | "deleteNotifications" | "deleteAppNotifications" | "deleteGroupNotifications" | "deleteNotification" | "reloadNotifications" | "setNotificationStatus";
|
|
7
|
+
interface ActionEnvelope<TPayload = unknown> {
|
|
8
|
+
event: NotifyAction;
|
|
9
|
+
data?: TPayload;
|
|
10
|
+
}
|
|
11
|
+
interface ServerEventEnvelope<TEvent = NotifyEvent, TPayload = unknown> {
|
|
12
|
+
event: TEvent;
|
|
13
|
+
data: TPayload;
|
|
14
|
+
}
|
|
15
|
+
interface R2NotifyClientOptions {
|
|
16
|
+
url: string;
|
|
17
|
+
clientId: string;
|
|
18
|
+
token?: string;
|
|
19
|
+
reconnect?: boolean;
|
|
20
|
+
reconnectDelayMs?: number;
|
|
21
|
+
debug?: boolean;
|
|
22
|
+
}
|
|
23
|
+
interface NotificationMessage {
|
|
24
|
+
id: string;
|
|
25
|
+
appId: string;
|
|
26
|
+
userId: string;
|
|
27
|
+
groupKey: string;
|
|
28
|
+
message: string;
|
|
29
|
+
status: "success" | "error" | "warning" | "info";
|
|
30
|
+
readStatus: boolean;
|
|
31
|
+
createdAt: string;
|
|
32
|
+
updatedAt: string;
|
|
33
|
+
}
|
|
34
|
+
interface NotificationGroup {
|
|
35
|
+
groupKey: string;
|
|
36
|
+
latest: number;
|
|
37
|
+
unread: number;
|
|
38
|
+
items: NotificationMessage[];
|
|
39
|
+
}
|
|
40
|
+
interface NotificationApp {
|
|
41
|
+
appId: string;
|
|
42
|
+
latest: number;
|
|
43
|
+
unread: number;
|
|
44
|
+
groups: NotificationGroup[];
|
|
45
|
+
total: number;
|
|
46
|
+
}
|
|
47
|
+
type NotificationConfig = {
|
|
48
|
+
id: string;
|
|
49
|
+
userId: string;
|
|
50
|
+
enableNotification: boolean;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
type EventHandlers = Partial<Record<NotifyEvent, (payload: any) => void>>;
|
|
54
|
+
|
|
55
|
+
declare class R2NotifyClient extends EventEmitter<R2NotifyClientEvent> {
|
|
56
|
+
private conn;
|
|
57
|
+
private opts;
|
|
58
|
+
private reconnectTimer?;
|
|
59
|
+
private closedByUser;
|
|
60
|
+
private isConnected;
|
|
61
|
+
constructor(options: R2NotifyClientOptions);
|
|
62
|
+
connect(handlers?: EventHandlers): this;
|
|
63
|
+
private scheduleReconnect;
|
|
64
|
+
close(): void;
|
|
65
|
+
emitAction<TPayload = unknown>(action: NotifyAction, payload?: TPayload): void;
|
|
66
|
+
markAsRead(): void;
|
|
67
|
+
markAppAsRead(appId: string): void;
|
|
68
|
+
markGroupAsRead(appId: string, groupKey: string): void;
|
|
69
|
+
markNotificationAsRead(id: string): void;
|
|
70
|
+
deleteNotifications(): void;
|
|
71
|
+
deleteAppNotifications(appId: string): void;
|
|
72
|
+
deleteGroupNotifications(appId: string, groupKey: string): void;
|
|
73
|
+
deleteNotification(id: string): void;
|
|
74
|
+
reloadNotifications(): void;
|
|
75
|
+
setNotificationStatus(enableNotification: boolean): void;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export { type ActionEnvelope, type ClientLifecycleEvent, type NotificationApp, type NotificationConfig, type NotificationGroup, type NotificationMessage, type NotifyAction, type NotifyEvent, R2NotifyClient, type R2NotifyClientEvent, type R2NotifyClientOptions, type ServerEventEnvelope };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import EventEmitter from 'eventemitter3';
|
|
2
|
+
|
|
3
|
+
type NotifyEvent = "listNotifications" | "newNotification" | "listConfigurations";
|
|
4
|
+
type ClientLifecycleEvent = "connected" | "disconnected" | "error";
|
|
5
|
+
type R2NotifyClientEvent = NotifyEvent | ClientLifecycleEvent;
|
|
6
|
+
type NotifyAction = "markAsRead" | "markAppAsRead" | "markGroupAsRead" | "markNotificationAsRead" | "deleteNotifications" | "deleteAppNotifications" | "deleteGroupNotifications" | "deleteNotification" | "reloadNotifications" | "setNotificationStatus";
|
|
7
|
+
interface ActionEnvelope<TPayload = unknown> {
|
|
8
|
+
event: NotifyAction;
|
|
9
|
+
data?: TPayload;
|
|
10
|
+
}
|
|
11
|
+
interface ServerEventEnvelope<TEvent = NotifyEvent, TPayload = unknown> {
|
|
12
|
+
event: TEvent;
|
|
13
|
+
data: TPayload;
|
|
14
|
+
}
|
|
15
|
+
interface R2NotifyClientOptions {
|
|
16
|
+
url: string;
|
|
17
|
+
clientId: string;
|
|
18
|
+
token?: string;
|
|
19
|
+
reconnect?: boolean;
|
|
20
|
+
reconnectDelayMs?: number;
|
|
21
|
+
debug?: boolean;
|
|
22
|
+
}
|
|
23
|
+
interface NotificationMessage {
|
|
24
|
+
id: string;
|
|
25
|
+
appId: string;
|
|
26
|
+
userId: string;
|
|
27
|
+
groupKey: string;
|
|
28
|
+
message: string;
|
|
29
|
+
status: "success" | "error" | "warning" | "info";
|
|
30
|
+
readStatus: boolean;
|
|
31
|
+
createdAt: string;
|
|
32
|
+
updatedAt: string;
|
|
33
|
+
}
|
|
34
|
+
interface NotificationGroup {
|
|
35
|
+
groupKey: string;
|
|
36
|
+
latest: number;
|
|
37
|
+
unread: number;
|
|
38
|
+
items: NotificationMessage[];
|
|
39
|
+
}
|
|
40
|
+
interface NotificationApp {
|
|
41
|
+
appId: string;
|
|
42
|
+
latest: number;
|
|
43
|
+
unread: number;
|
|
44
|
+
groups: NotificationGroup[];
|
|
45
|
+
total: number;
|
|
46
|
+
}
|
|
47
|
+
type NotificationConfig = {
|
|
48
|
+
id: string;
|
|
49
|
+
userId: string;
|
|
50
|
+
enableNotification: boolean;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
type EventHandlers = Partial<Record<NotifyEvent, (payload: any) => void>>;
|
|
54
|
+
|
|
55
|
+
declare class R2NotifyClient extends EventEmitter<R2NotifyClientEvent> {
|
|
56
|
+
private conn;
|
|
57
|
+
private opts;
|
|
58
|
+
private reconnectTimer?;
|
|
59
|
+
private closedByUser;
|
|
60
|
+
private isConnected;
|
|
61
|
+
constructor(options: R2NotifyClientOptions);
|
|
62
|
+
connect(handlers?: EventHandlers): this;
|
|
63
|
+
private scheduleReconnect;
|
|
64
|
+
close(): void;
|
|
65
|
+
emitAction<TPayload = unknown>(action: NotifyAction, payload?: TPayload): void;
|
|
66
|
+
markAsRead(): void;
|
|
67
|
+
markAppAsRead(appId: string): void;
|
|
68
|
+
markGroupAsRead(appId: string, groupKey: string): void;
|
|
69
|
+
markNotificationAsRead(id: string): void;
|
|
70
|
+
deleteNotifications(): void;
|
|
71
|
+
deleteAppNotifications(appId: string): void;
|
|
72
|
+
deleteGroupNotifications(appId: string, groupKey: string): void;
|
|
73
|
+
deleteNotification(id: string): void;
|
|
74
|
+
reloadNotifications(): void;
|
|
75
|
+
setNotificationStatus(enableNotification: boolean): void;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export { type ActionEnvelope, type ClientLifecycleEvent, type NotificationApp, type NotificationConfig, type NotificationGroup, type NotificationMessage, type NotifyAction, type NotifyEvent, R2NotifyClient, type R2NotifyClientEvent, type R2NotifyClientOptions, type ServerEventEnvelope };
|