qws-browser 1.1.1 → 2.1.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.
Files changed (42) hide show
  1. package/README.md +21 -0
  2. package/dist/browser/messageencode.d.ts +2 -1
  3. package/dist/browser/messageencode.d.ts.map +1 -0
  4. package/dist/browser/messageencode.js +32 -25
  5. package/dist/browser/messageencode.js.map +1 -0
  6. package/dist/browser/wrappedws.d.ts +25 -2
  7. package/dist/browser/wrappedws.d.ts.map +1 -0
  8. package/dist/browser/wrappedws.js +57 -20
  9. package/dist/browser/wrappedws.js.map +1 -0
  10. package/dist/common/discriminator.d.ts +2 -1
  11. package/dist/common/discriminator.d.ts.map +1 -0
  12. package/dist/common/discriminator.js +2 -2
  13. package/dist/common/discriminator.js.map +1 -0
  14. package/dist/common/logger.d.ts +11 -10
  15. package/dist/common/logger.d.ts.map +1 -0
  16. package/dist/common/logger.js +8 -13
  17. package/dist/common/logger.js.map +1 -0
  18. package/dist/common/message.d.ts +31 -27
  19. package/dist/common/message.d.ts.map +1 -0
  20. package/dist/common/message.js +2 -2
  21. package/dist/common/message.js.map +1 -0
  22. package/dist/common/queryparser.d.ts +1 -4
  23. package/dist/common/queryparser.d.ts.map +1 -0
  24. package/dist/common/queryparser.js +6 -82
  25. package/dist/common/queryparser.js.map +1 -0
  26. package/dist/common/queue.d.ts +4 -3
  27. package/dist/common/queue.d.ts.map +1 -0
  28. package/dist/common/queue.js +10 -12
  29. package/dist/common/queue.js.map +1 -0
  30. package/dist/common/queuews.d.ts +41 -12
  31. package/dist/common/queuews.d.ts.map +1 -0
  32. package/dist/common/queuews.js +153 -83
  33. package/dist/common/queuews.js.map +1 -0
  34. package/dist/common/router.d.ts +9 -0
  35. package/dist/common/router.d.ts.map +1 -0
  36. package/dist/common/router.js +8 -0
  37. package/dist/common/router.js.map +1 -0
  38. package/dist/index.d.ts +6 -6
  39. package/dist/index.d.ts.map +1 -0
  40. package/dist/index.js +6 -25
  41. package/dist/index.js.map +1 -0
  42. package/package.json +29 -30
@@ -1,33 +1,29 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const auto_bind_1 = __importDefault(require("auto-bind"));
7
- const route_recognizer_1 = __importDefault(require("route-recognizer"));
8
- const queue_1 = __importDefault(require("./queue"));
9
- const wrappedws_1 = __importDefault(require("../browser/wrappedws"));
10
- const queryparser_1 = require("./queryparser");
11
- const logger_1 = __importDefault(require("./logger"));
1
+ import autoBind from 'auto-bind';
2
+ import RouteRecognizer from './router.js';
3
+ import WebSocketMessageQueue from './queue.js';
4
+ import WrappedWebSocket from '../browser/wrappedws.js';
5
+ import { addQueryParamsToUrl } from './queryparser.js';
6
+ import logger from './logger.js';
12
7
  const decodeErrorMessage = (event) => {
13
- if (event === null || event === void 0 ? void 0 : event.message) {
14
- return event.message;
15
- }
16
- if (event) {
17
- return event.toString();
8
+ const { message } = (event ?? {});
9
+ if (message) {
10
+ return message;
18
11
  }
19
- return 'Unknown error';
12
+ // best-effort description of arbitrary error values
13
+ // eslint-disable-next-line @typescript-eslint/no-base-to-string
14
+ return event ? String(event) : 'Unknown error';
20
15
  };
21
16
  const defaultOpts = {
22
17
  extraConnectArgs: {},
23
18
  reconnect: true,
24
19
  reconnectNumTries: 12,
25
20
  reconnectIntervalMillis: 5000,
21
+ heartbeatIntervalMillis: 25_000,
26
22
  };
27
23
  /**
28
24
  * Actual queued WebSocket
29
25
  */
30
- class QWebSocket {
26
+ export default class QWebSocket {
31
27
  constructor(wsOrUrl, options = {}) {
32
28
  this.wsOrUrl = wsOrUrl;
33
29
  this.options = {
@@ -36,15 +32,18 @@ class QWebSocket {
36
32
  };
37
33
  this.name = options.name || 'websocket';
38
34
  this.callbacks = {
39
- onBin: new route_recognizer_1.default(),
40
- onJson: new route_recognizer_1.default(),
35
+ onBin: new RouteRecognizer(),
36
+ onJson: new RouteRecognizer(),
41
37
  };
42
- this.queue = new queue_1.default();
38
+ this.queue = new WebSocketMessageQueue();
43
39
  this.reconnectionAttempts = 0;
44
40
  this.needed = true;
45
- this.wws = null;
46
41
  this.ready = false;
47
- (0, auto_bind_1.default)(this);
42
+ this.closed = false;
43
+ this.heartbeatSentAt = 0;
44
+ this.heartbeatConfirmed = false;
45
+ this.pendingAcks = new Map();
46
+ autoBind(this);
48
47
  this.setUp();
49
48
  }
50
49
  /**
@@ -82,7 +81,6 @@ class QWebSocket {
82
81
  */
83
82
  // eslint-disable-next-line max-lines-per-function
84
83
  setUp() {
85
- var _a, _b, _c, _d;
86
84
  if (this.wws && this.wws.readyState <= 1) {
87
85
  return;
88
86
  }
@@ -90,49 +88,53 @@ class QWebSocket {
90
88
  const { reconnect, reconnectNumTries, reconnectIntervalMillis, extraConnectArgs } = this.options;
91
89
  // timeout for too many reconnection attempts
92
90
  if (reconnect && this.reconnectionAttempts > reconnectNumTries) {
93
- logger_1.default.error(`${this.name}: Connection timed out, should re-connect entirely`);
94
- (_b = (_a = this.callbacks).onError) === null || _b === void 0 ? void 0 : _b.call(_a, `WS connection timeout, max tries (${reconnectNumTries}) exceeded`);
91
+ logger.error(`${this.name}: Connection timed out, should re-connect entirely`);
92
+ void this.callbacks.onError?.(`WS connection timeout, max tries (${reconnectNumTries}) exceeded`);
93
+ this.rejectPendingAcks();
95
94
  return;
96
95
  }
97
96
  /**
98
97
  * Actual WebSocket opening
99
98
  */
100
- if (this.wsOrUrl instanceof WebSocket || ((_d = (_c = this.wsOrUrl) === null || _c === void 0 ? void 0 : _c.constructor) === null || _d === void 0 ? void 0 : _d.name) === 'WebSocket') {
99
+ if (this.wsOrUrl instanceof WebSocket || this.wsOrUrl?.constructor?.name === 'WebSocket') {
101
100
  const ws = this.wsOrUrl;
102
- this.wws = new wrappedws_1.default(ws);
101
+ this.wws = new WrappedWebSocket(ws);
103
102
  // TODO what if this is a reconnect? No reconnection was attempted, it's just the old reference
104
103
  }
105
104
  else {
106
- const connectUrl = (0, queryparser_1.addQueryParamsToUrl)(this.wsOrUrl, {
105
+ const connectUrl = addQueryParamsToUrl(this.wsOrUrl, {
107
106
  ...extraConnectArgs,
108
107
  idx: this.queue.ackIdx,
109
108
  });
110
- this.wws = new wrappedws_1.default(connectUrl);
109
+ this.wws = new WrappedWebSocket(connectUrl);
111
110
  }
111
+ this.wws.onPing(() => {
112
+ this.wws.send({ headers: { type: 'pong' } });
113
+ });
114
+ this.wws.onPong(() => {
115
+ // peer knows qws heartbeats, missing answers may now be treated as a dead connection
116
+ this.heartbeatConfirmed = true;
117
+ });
112
118
  this.wws.onWsError(async (event) => {
113
- var _a, _b, _c, _d;
114
119
  // ws error will prompt reconnection which can time out, don't reject instantly
115
120
  const message = decodeErrorMessage(event);
116
- logger_1.default.error(`${this.name}: WS error occurred: ${message}`);
121
+ logger.error(`${this.name}: WS error occurred: ${message}`);
117
122
  if (reconnect) {
118
- await ((_b = (_a = this.callbacks).onErroneousDisconnect) === null || _b === void 0 ? void 0 : _b.call(_a, message));
123
+ await this.callbacks.onErroneousDisconnect?.(message);
119
124
  }
120
125
  else {
121
- await ((_d = (_c = this.callbacks).onError) === null || _d === void 0 ? void 0 : _d.call(_c, message));
126
+ await this.callbacks.onError?.(message);
122
127
  }
123
128
  });
124
129
  this.wws.onWsOpen(async () => {
125
- var _a, _b;
126
130
  this.reconnectionAttempts = 0;
127
- if (reconnect) {
128
- logger_1.default.info(`${this.name}: Connection established after ${this.reconnectionAttempts} tries`);
129
- }
130
- else {
131
- logger_1.default.info(`${this.name}: Connection established`);
132
- }
131
+ this.startHeartbeat();
132
+ logger.info(reconnect
133
+ ? `${this.name}: Connection established after ${this.reconnectionAttempts} tries`
134
+ : `${this.name}: Connection established`);
133
135
  try {
134
136
  // call post-connect method, this may give previously acked messages
135
- const readyIdx = await ((_b = (_a = this.callbacks).onConnect) === null || _b === void 0 ? void 0 : _b.call(_a));
137
+ const readyIdx = await this.callbacks.onConnect?.();
136
138
  // send back readiness ack
137
139
  this.wws.send({
138
140
  headers: {
@@ -141,24 +143,23 @@ class QWebSocket {
141
143
  },
142
144
  });
143
145
  }
144
- catch (err) {
146
+ catch (error) {
145
147
  // error occurred during initialization phase, send error right away, no "ready" message
146
148
  this.wws.send({
147
149
  headers: {
148
150
  type: 'err',
149
- error: decodeErrorMessage(err),
151
+ error: decodeErrorMessage(error),
150
152
  },
151
153
  });
152
154
  }
153
155
  });
154
156
  this.wws.onReady(async (message) => {
155
- var _a, _b;
156
157
  // ready to send messages from given message index
157
158
  const { readyIdx } = message.headers;
158
- logger_1.default.info(`${this.name}: Socket ready to send${readyIdx ? `from chunk ${readyIdx}` : ''}`);
159
+ logger.info(`${this.name}: Socket ready to send${readyIdx ? `from chunk ${readyIdx}` : ''}`);
159
160
  // if server sent chunk index to resume from, move queue cursors appropriately
160
161
  if (readyIdx !== undefined) {
161
- this.queue.acknowledge(readyIdx - 1);
162
+ this.acknowledge(readyIdx - 1);
162
163
  this.queue.revert(readyIdx);
163
164
  }
164
165
  this.ready = true;
@@ -166,14 +167,14 @@ class QWebSocket {
166
167
  this.flush();
167
168
  try {
168
169
  // call post-ready method
169
- await ((_b = (_a = this.callbacks).onReady) === null || _b === void 0 ? void 0 : _b.call(_a, message.headers));
170
+ await this.callbacks.onReady?.(message.headers);
170
171
  }
171
- catch (err) {
172
+ catch (error) {
172
173
  // error occurred during initialization phase, send error right away, no "ready" message
173
174
  this.wws.send({
174
175
  headers: {
175
176
  type: 'err',
176
- error: decodeErrorMessage(err),
177
+ error: decodeErrorMessage(error),
177
178
  },
178
179
  });
179
180
  }
@@ -184,10 +185,11 @@ class QWebSocket {
184
185
  try {
185
186
  // check callback
186
187
  const routeResults = this.callbacks.onBin.recognize(headers.route || '');
187
- if (routeResults) {
188
- const handler = routeResults[0].handler;
189
- const params = routeResults[0].params;
190
- await (handler === null || handler === void 0 ? void 0 : handler(body, headers, params));
188
+ const route = routeResults?.[0];
189
+ if (route) {
190
+ const handler = route.handler;
191
+ const params = route.params;
192
+ await handler?.(body, headers, params);
191
193
  }
192
194
  // send back acknowledgment
193
195
  this.wws.send({
@@ -197,12 +199,12 @@ class QWebSocket {
197
199
  },
198
200
  });
199
201
  }
200
- catch (err) {
202
+ catch (error) {
201
203
  // error occurred during processing binary message, send error
202
204
  this.wws.send({
203
205
  headers: {
204
206
  type: 'err',
205
- error: decodeErrorMessage(err),
207
+ error: decodeErrorMessage(error),
206
208
  },
207
209
  });
208
210
  }
@@ -213,10 +215,11 @@ class QWebSocket {
213
215
  try {
214
216
  // check callback
215
217
  const routeResults = this.callbacks.onJson.recognize(headers.route || '');
216
- if (routeResults) {
217
- const handler = routeResults[0].handler;
218
- const params = routeResults[0].params;
219
- await (handler === null || handler === void 0 ? void 0 : handler(body, headers, params));
218
+ const route = routeResults?.[0];
219
+ if (route) {
220
+ const handler = route.handler;
221
+ const params = route.params;
222
+ await handler?.(body, headers, params);
220
223
  }
221
224
  // send back acknowledgment
222
225
  this.wws.send({
@@ -226,57 +229,124 @@ class QWebSocket {
226
229
  },
227
230
  });
228
231
  }
229
- catch (err) {
232
+ catch (error) {
230
233
  // error occurred during processing json message, send error
231
234
  this.wws.send({
232
235
  headers: {
233
236
  type: 'err',
234
- error: decodeErrorMessage(err),
237
+ error: decodeErrorMessage(error),
235
238
  },
236
239
  });
237
240
  }
238
241
  });
239
242
  this.wws.onAck((message) => {
240
243
  // acknowledgment received
241
- this.queue.acknowledge(message.headers.ackIdx);
244
+ this.acknowledge(message.headers.ackIdx);
242
245
  if (!this.queue.numUnackMessages && !this.needed) {
243
246
  this.wws.close();
244
247
  }
245
248
  });
246
249
  this.wws.onErr(async (message) => {
247
- var _a, _b;
248
250
  // handle error
249
- logger_1.default.error(`${this.name}: Error occurred: ${message.headers.error}`);
250
- await ((_b = (_a = this.callbacks).onError) === null || _b === void 0 ? void 0 : _b.call(_a, message.headers.error));
251
+ logger.error(`${this.name}: Error occurred: ${message.headers.error}`);
252
+ await this.callbacks.onError?.(message.headers.error);
251
253
  });
252
254
  this.wws.onWsClose(async () => {
253
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
255
+ this.stopHeartbeat();
254
256
  if (reconnect && this.needed) {
255
257
  // if locally closed, needed should be false
256
258
  // if it's true, it means we lost the connection and should try to re-connect
257
- logger_1.default.info(`${this.name}: Closed pre-maturely, trying to reconnect after ${reconnectIntervalMillis}ms...`);
259
+ logger.info(`${this.name}: Closed pre-maturely, trying to reconnect after ${reconnectIntervalMillis}ms...`);
258
260
  setTimeout(() => this.setUp(), reconnectIntervalMillis);
259
- await ((_b = (_a = this.callbacks).onErroneousDisconnect) === null || _b === void 0 ? void 0 : _b.call(_a, 'Closed pre-maturely'));
261
+ await this.callbacks.onErroneousDisconnect?.('Closed pre-maturely');
260
262
  }
261
263
  else if (reconnect && this.queue.numUnackMessages) {
262
264
  // if there are still messages left to be sent and we should reconnect
263
- logger_1.default.info(`${this.name}: Closed with messages still in queue, reconnecting in ${reconnectIntervalMillis}ms...`);
265
+ logger.info(`${this.name}: Closed with messages still in queue, reconnecting in ${reconnectIntervalMillis}ms...`);
264
266
  setTimeout(() => this.setUp(), reconnectIntervalMillis);
265
- await ((_d = (_c = this.callbacks).onErroneousDisconnect) === null || _d === void 0 ? void 0 : _d.call(_c, 'Closed with messages still in queue'));
267
+ await this.callbacks.onErroneousDisconnect?.('Closed with messages still in queue');
266
268
  }
267
269
  else if (this.queue.numUnackMessages) {
268
270
  // if there are still messages left to be sent, but we should not reconnect
269
- logger_1.default.info(`${this.name}: Closed with messages still in queue`);
270
- await ((_f = (_e = this.callbacks).onError) === null || _f === void 0 ? void 0 : _f.call(_e, 'Closed with messages still in queue'));
271
- await ((_h = (_g = this.callbacks).onClose) === null || _h === void 0 ? void 0 : _h.call(_g));
271
+ logger.info(`${this.name}: Closed with messages still in queue`);
272
+ await this.callbacks.onError?.('Closed with messages still in queue');
273
+ await this.callbacks.onClose?.();
274
+ this.rejectPendingAcks();
272
275
  }
273
276
  else {
274
277
  // all is well
275
- logger_1.default.info(`${this.name}: Closed correctly`);
276
- await ((_k = (_j = this.callbacks).onClose) === null || _k === void 0 ? void 0 : _k.call(_j));
278
+ logger.info(`${this.name}: Closed correctly`);
279
+ await this.callbacks.onClose?.();
280
+ this.rejectPendingAcks();
281
+ }
282
+ });
283
+ }
284
+ /**
285
+ * Heartbeat: if nothing (not even its answer) arrived since the previous heartbeat,
286
+ * the connection is dead and is terminated, which triggers the usual close/reconnect logic.
287
+ * Checking per tick instead of measuring time since the last message
288
+ * tolerates throttled timers in background browser tabs.
289
+ */
290
+ startHeartbeat() {
291
+ this.stopHeartbeat();
292
+ const { heartbeatIntervalMillis } = this.options;
293
+ if (!heartbeatIntervalMillis) {
294
+ return;
295
+ }
296
+ const { wws } = this;
297
+ this.heartbeatConfirmed = wws.heartbeatAnsweredByProtocol;
298
+ this.heartbeatSentAt = 0;
299
+ this.heartbeatTimer = setInterval(() => {
300
+ if (wws.readyState !== WebSocket.OPEN) {
301
+ return;
302
+ }
303
+ if (this.heartbeatConfirmed && this.heartbeatSentAt && wws.lastActivity < this.heartbeatSentAt) {
304
+ logger.warn(`${this.name}: No answer to heartbeat in ${heartbeatIntervalMillis}ms, terminating connection`);
305
+ this.stopHeartbeat();
306
+ wws.terminate();
307
+ return;
277
308
  }
309
+ this.heartbeatSentAt = Date.now();
310
+ wws.sendHeartbeat();
311
+ }, heartbeatIntervalMillis);
312
+ }
313
+ stopHeartbeat() {
314
+ clearInterval(this.heartbeatTimer);
315
+ this.heartbeatTimer = undefined;
316
+ }
317
+ /**
318
+ * Resolves once the other side acknowledged the message with the given index (returned by send/sendToRoute).
319
+ * Rejects if the connection is closed for good before that.
320
+ * Reconnecting connections keep and resend their unacknowledged messages, so they don't reject on reconnect.
321
+ */
322
+ waitForAck(idx) {
323
+ if (idx < this.queue.ackIdx) {
324
+ return Promise.resolve();
325
+ }
326
+ if (this.closed) {
327
+ return Promise.reject(new Error(`${this.name}: Connection closed, message ${idx} will not be acknowledged`));
328
+ }
329
+ return new Promise((resolve, reject) => {
330
+ this.pendingAcks.set(idx, { resolve, reject });
278
331
  });
279
332
  }
333
+ acknowledge(idx) {
334
+ this.queue.acknowledge(idx);
335
+ for (const [pendingIdx, { resolve }] of this.pendingAcks) {
336
+ if (pendingIdx > idx) {
337
+ continue;
338
+ }
339
+ this.pendingAcks.delete(pendingIdx);
340
+ resolve();
341
+ }
342
+ }
343
+ rejectPendingAcks() {
344
+ this.closed = true;
345
+ for (const [idx, { reject }] of this.pendingAcks) {
346
+ reject(new Error(`${this.name}: Connection closed, message ${idx} will not be acknowledged`));
347
+ }
348
+ this.pendingAcks.clear();
349
+ }
280
350
  flush() {
281
351
  // connection is not open
282
352
  if (this.wws.readyState !== WebSocket.OPEN || !this.ready) {
@@ -286,13 +356,13 @@ class QWebSocket {
286
356
  if (this.queue.numUnsentMessages) {
287
357
  // pop a message
288
358
  const [idx, data] = this.queue.consume();
289
- logger_1.default.debug(`${this.name}: Sending chunk ${idx} of size ${data.size}`);
359
+ logger.debug(`${this.name}: Sending chunk ${idx} of size ${data.size}`);
290
360
  this.wws.sendRaw(data);
291
- logger_1.default.debug(`${this.name}: MQ decreased to size ${this.queue.numUnsentMessages} messages / ${this.queue.numUnsentBytes} bytes`);
361
+ logger.debug(`${this.name}: MQ decreased to size ${this.queue.numUnsentMessages} messages / ${this.queue.numUnsentBytes} bytes`);
292
362
  this.flush();
293
363
  }
294
364
  else {
295
- logger_1.default.debug(`${this.name}: Flushing complete, no ws messages backed up`);
365
+ logger.debug(`${this.name}: Flushing complete, no ws messages backed up`);
296
366
  // if not needed anymore after flush, close it
297
367
  // send close event to ws, don't de-cache yet, wait for event
298
368
  if (!this.queue.numUnackMessages && !this.needed) {
@@ -330,8 +400,8 @@ class QWebSocket {
330
400
  const { numUnsentMessages } = this.queue;
331
401
  const idx = this.queue.produce(message);
332
402
  // ready state should either be CONNECTING or OPEN at this point to flush instantly
333
- if (this.wws.readyState === WebSocket.OPEN && this.ready && !numUnsentMessages) {
334
- this.flush();
403
+ if (!numUnsentMessages && this.ready && this.wws.readyState === WebSocket.OPEN) {
404
+ void this.flush();
335
405
  }
336
406
  return idx;
337
407
  }
@@ -345,7 +415,7 @@ class QWebSocket {
345
415
  // wrap original onClose to resolve this promise
346
416
  const { onClose } = this.callbacks;
347
417
  this.callbacks.onClose = async () => {
348
- await (onClose === null || onClose === void 0 ? void 0 : onClose());
418
+ await onClose?.();
349
419
  resolve();
350
420
  };
351
421
  // flush if any messages in queue
@@ -353,4 +423,4 @@ class QWebSocket {
353
423
  });
354
424
  }
355
425
  }
356
- exports.default = QWebSocket;
426
+ //# sourceMappingURL=queuews.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queuews.js","sourceRoot":"","sources":["../../src/common/queuews.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,WAAW,CAAC;AACjC,OAAO,eAAe,MAAM,aAAa,CAAC;AAe1C,OAAO,qBAAqB,MAAM,YAAY,CAAC;AAC/C,OAAO,gBAAgB,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,MAAM,MAAM,aAAa,CAAC;AAEjC,MAAM,kBAAkB,GAAG,CAAC,KAAc,EAAU,EAAE;IACpD,MAAM,EAAE,OAAO,EAAE,GAAG,CAAC,KAAK,IAAI,EAAE,CAAyB,CAAC;IAC1D,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,oDAAoD;IACpD,gEAAgE;IAChE,OAAO,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC;AACjD,CAAC,CAAC;AA2BF,MAAM,WAAW,GAA+B;IAC9C,gBAAgB,EAAE,EAAE;IACpB,SAAS,EAAE,IAAI;IACf,iBAAiB,EAAE,EAAE;IACrB,uBAAuB,EAAE,IAAI;IAC7B,uBAAuB,EAAE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AAO,CAAC,OAAO,CAAC,CAAC;QAExC,mFAAmF;QACnF,IAAI,CAAC,iBAAiB,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,GAAG,CAAC,UAAU,KAAK,SAAS,CAAC,IAAI,EAAE,CAAC;YAC/E,KAAK,IAAI,CAAC,KAAK,EAAE,CAAC;QACpB,CAAC;QAED,OAAO,GAAG,CAAC;IACb,CAAC;IAED;;;OAGG;IACH,KAAK;QACH,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YAC7B,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;YAEpB,gDAAgD;YAChD,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC;YACnC,IAAI,CAAC,SAAS,CAAC,OAAO,GAAG,KAAK,IAAI,EAAE;gBAClC,MAAM,OAAO,EAAE,EAAE,CAAC;gBAClB,OAAO,EAAE,CAAC;YACZ,CAAC,CAAC;YAEF,iCAAiC;YACjC,IAAI,CAAC,KAAK,EAAE,CAAC;QACf,CAAC,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -0,0 +1,9 @@
1
+ import RouteRecognizerModule from 'route-recognizer';
2
+ /**
3
+ * route-recognizer is a UMD bundle: under Node.js ESM its default import is the class itself,
4
+ * while its typings declare an ES default export. Re-expose it with correct typing.
5
+ */
6
+ declare const RouteRecognizer: typeof RouteRecognizerModule.default;
7
+ type RouteRecognizer = InstanceType<typeof RouteRecognizer>;
8
+ export default RouteRecognizer;
9
+ //# sourceMappingURL=router.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../src/common/router.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,MAAM,kBAAkB,CAAC;AAErD;;;GAGG;AACH,QAAA,MAAM,eAAe,EAAuC,OAAO,qBAAqB,CAAC,OAAO,CAAC;AACjG,KAAK,eAAe,GAAG,YAAY,CAAC,OAAO,eAAe,CAAC,CAAC;AAE5D,eAAe,eAAe,CAAC"}
@@ -0,0 +1,8 @@
1
+ import RouteRecognizerModule from 'route-recognizer';
2
+ /**
3
+ * route-recognizer is a UMD bundle: under Node.js ESM its default import is the class itself,
4
+ * while its typings declare an ES default export. Re-expose it with correct typing.
5
+ */
6
+ const RouteRecognizer = RouteRecognizerModule;
7
+ export default RouteRecognizer;
8
+ //# sourceMappingURL=router.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"router.js","sourceRoot":"","sources":["../../src/common/router.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,MAAM,kBAAkB,CAAC;AAErD;;;GAGG;AACH,MAAM,eAAe,GAAG,qBAAwE,CAAC;AAGjG,eAAe,eAAe,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import QWebSocket from './common/queuews';
2
- export * from './common/logger';
3
- export * from './common/message';
4
- export * from './common/queuews';
5
- export * from './browser/messageencode';
6
- export default QWebSocket;
1
+ export * from './common/logger.js';
2
+ export * from './common/message.js';
3
+ export * from './common/queuews.js';
4
+ export * from './browser/messageencode.js';
5
+ export { default } from './common/queuews.js';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC;AAE3C,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC"}
package/dist/index.js CHANGED
@@ -1,25 +1,6 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- var __importDefault = (this && this.__importDefault) || function (mod) {
17
- return (mod && mod.__esModule) ? mod : { "default": mod };
18
- };
19
- Object.defineProperty(exports, "__esModule", { value: true });
20
- const queuews_1 = __importDefault(require("./common/queuews"));
21
- __exportStar(require("./common/logger"), exports);
22
- __exportStar(require("./common/message"), exports);
23
- __exportStar(require("./common/queuews"), exports);
24
- __exportStar(require("./browser/messageencode"), exports);
25
- exports.default = queuews_1.default;
1
+ export * from './common/logger.js';
2
+ export * from './common/message.js';
3
+ export * from './common/queuews.js';
4
+ export * from './browser/messageencode.js';
5
+ export { default } from './common/queuews.js';
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC;AAE3C,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC"}
package/package.json CHANGED
@@ -1,11 +1,18 @@
1
1
  {
2
2
  "name": "qws-browser",
3
- "version": "1.1.1",
3
+ "version": "2.1.0",
4
+ "type": "module",
4
5
  "description": "Safe queueing with auto-reconnect for WebSockets",
5
6
  "author": "Csaba Sulyok <csaba.sulyok@gmail.com>",
6
7
  "license": "ISC",
7
8
  "main": "./dist/index.js",
8
9
  "types": "./dist/index.d.ts",
10
+ "exports": {
11
+ ".": {
12
+ "import": "./dist/index.js",
13
+ "types": "./dist/index.d.ts"
14
+ }
15
+ },
9
16
  "files": [
10
17
  "dist"
11
18
  ],
@@ -14,42 +21,34 @@
14
21
  "url": "git+https://github.com/csabasulyok/qws-browser.git"
15
22
  },
16
23
  "dependencies": {
17
- "auto-bind": "4.0.0",
24
+ "auto-bind": "5.0.1",
18
25
  "route-recognizer": "0.3.4"
19
26
  },
20
27
  "devDependencies": {
21
- "@typescript-eslint/eslint-plugin": "5.38.0",
22
- "@typescript-eslint/parser": "5.38.0",
23
- "eslint": "8.23.1",
24
- "eslint-config-airbnb-base": "15.0.0",
25
- "eslint-config-airbnb-typescript": "17.0.0",
26
- "eslint-config-prettier": "8.5.0",
27
- "eslint-import-resolver-typescript": "3.5.1",
28
- "eslint-plugin-import": "2.26.0",
29
- "eslint-plugin-prettier": "4.2.1",
30
- "prettier": "2.7.1",
31
- "rimraf": "3.0.2",
32
- "typescript": "4.8.3"
33
- },
34
- "lint-staged": {
35
- "*.{js,ts,jsx,tsx}": [
36
- "npm run lint",
37
- "git add"
38
- ]
39
- },
40
- "husky": {
41
- "hooks": {
42
- "pre-commit": "lint-staged"
43
- }
28
+ "@eslint/js": "10.0.1",
29
+ "eslint": "10.13.0",
30
+ "eslint-config-prettier": "10.1.8",
31
+ "eslint-import-resolver-typescript": "4.4.5",
32
+ "eslint-plugin-import-x": "4.17.1",
33
+ "eslint-plugin-prettier": "5.5.7",
34
+ "eslint-plugin-unicorn": "78.0.0",
35
+ "globals": "17.13.0",
36
+ "npm-check-updates": "23.1.1",
37
+ "prettier": "3.9.10",
38
+ "rimraf": "6.1.3",
39
+ "typescript": "6.0.3",
40
+ "typescript-eslint": "8.72.0"
44
41
  },
45
42
  "scripts": {
46
43
  "clean": "rimraf dist *.tsbuildinfo",
47
44
  "build": "tsc -p tsconfig.build.json",
48
45
  "cb": "pnpm clean && pnpm build",
49
- "lint": "eslint 'src/**/*.ts' --quiet --fix",
50
- "format": "prettier --write '**/*.ts' --config ./.prettierrc.yml",
51
- "ci": "pnpm lint && pnpm format && pnpm build",
52
- "publish:local": "pnpm publish --verbose --registry=http://localhost:8081/repository/npm-releases/",
53
- "publish:npmjs": "pnpm publish --verbose --registry=https://registry.npmjs.org/"
46
+ "lint": "eslint .",
47
+ "lint:fix": "eslint . --fix",
48
+ "format": "prettier --write .",
49
+ "format:check": "prettier --check .",
50
+ "ci": "pnpm lint && pnpm format:check && pnpm build",
51
+ "publish:local": "pnpm publish --loglevel info --registry=http://localhost:8081/repository/npm-releases/",
52
+ "publish:npmjs": "pnpm publish --loglevel info --registry=https://registry.npmjs.org/"
54
53
  }
55
54
  }