@nxtedition/deepstream.io-client-js 31.2.11 → 31.2.13

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/deepstream.io-client-js",
3
- "version": "31.2.11",
3
+ "version": "31.2.13",
4
4
  "description": "the javascript client for deepstream.io",
5
5
  "homepage": "http://deepstream.io",
6
6
  "type": "module",
@@ -282,7 +282,7 @@ class RecordHandler {
282
282
  // TODO (perf): Slow implementation...
283
283
 
284
284
  const signal = opts?.signal
285
- const timeout = opts?.timeout
285
+ const timeout = opts?.timeout ?? 60e3
286
286
 
287
287
  let disposers
288
288
  try {
@@ -298,18 +298,17 @@ class RecordHandler {
298
298
  signalPromise?.catch(noop)
299
299
 
300
300
  if (this._patching.size) {
301
- let promises
301
+ const promises = []
302
302
 
303
303
  {
304
304
  const patchingPromises = []
305
305
  for (const callbacks of this._patching.values()) {
306
306
  patchingPromises.push(new Promise((resolve) => callbacks.push(resolve)))
307
307
  }
308
- promises ??= []
309
308
  promises.push(Promise.all(patchingPromises))
310
309
  }
311
310
 
312
- if (timeout) {
311
+ if (timeout && promises.length) {
313
312
  promises.push(
314
313
  new Promise((resolve) => {
315
314
  const patchingTimeout = timers.setTimeout(() => {
@@ -326,30 +325,28 @@ class RecordHandler {
326
325
  )
327
326
  }
328
327
 
329
- if (signalPromise) {
330
- promises ??= []
328
+ if (signalPromise && promises.length) {
331
329
  promises.push(signalPromise)
332
330
  }
333
331
 
334
- if (promises) {
332
+ if (promises.length) {
335
333
  await Promise.race(promises)
334
+ signal?.throwIfAborted()
336
335
  }
337
336
  }
338
337
 
339
338
  if (this._updating.size) {
340
- let promises
339
+ const promises = []
341
340
 
342
341
  {
343
342
  const updatingPromises = []
344
343
  for (const callbacks of this._updating.values()) {
345
344
  updatingPromises.push(new Promise((resolve) => callbacks.push(resolve)))
346
345
  }
347
- promises ??= []
348
346
  promises.push(Promise.all(updatingPromises))
349
347
  }
350
348
 
351
- if (timeout) {
352
- promises ??= []
349
+ if (timeout && promises.length) {
353
350
  promises.push(
354
351
  new Promise((resolve) => {
355
352
  const updatingTimeout = timers.setTimeout(() => {
@@ -366,18 +363,22 @@ class RecordHandler {
366
363
  )
367
364
  }
368
365
 
369
- if (promises) {
366
+ if (signalPromise && promises.length) {
367
+ promises.push(signalPromise)
368
+ }
369
+
370
+ if (promises.length) {
370
371
  await Promise.race(promises)
372
+ signal?.throwIfAborted()
371
373
  }
372
374
  }
373
375
 
374
376
  {
375
- const syncPromise = new Promise((resolve) => this._sync(resolve))
377
+ const promises = []
376
378
 
377
- let promises
379
+ promises.push(new Promise((resolve) => this._sync(resolve)))
378
380
 
379
381
  if (timeout) {
380
- promises ??= []
381
382
  promises.push(
382
383
  new Promise((resolve, reject) => {
383
384
  const serverTimeout = timers.setTimeout(() => {
@@ -390,15 +391,12 @@ class RecordHandler {
390
391
  }
391
392
 
392
393
  if (signalPromise) {
393
- promises ??= []
394
394
  promises.push(signalPromise)
395
395
  }
396
396
 
397
- if (promises) {
398
- promises.push(syncPromise)
397
+ if (promises.length) {
399
398
  await Promise.race(promises)
400
- } else {
401
- await syncPromise
399
+ signal?.throwIfAborted()
402
400
  }
403
401
  }
404
402
  } finally {
@@ -1,9 +0,0 @@
1
- {
2
- "permissions": {
3
- "allow": [
4
- "Bash(npm run test:types:*)"
5
- ],
6
- "deny": [],
7
- "ask": []
8
- }
9
- }