@nxtedition/deepstream.io-client-js 28.1.13 → 28.1.15

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": "28.1.13",
3
+ "version": "28.1.15",
4
4
  "description": "the javascript client for deepstream.io",
5
5
  "homepage": "http://deepstream.io",
6
6
  "type": "module",
@@ -101,7 +101,6 @@ class RecordHandler {
101
101
  this._patching = new Map()
102
102
  this._updating = new Map()
103
103
  this._putting = new Set()
104
- this._syncing = new Set()
105
104
 
106
105
  this._connected = 0
107
106
  this._stats = {
@@ -270,7 +269,7 @@ class RecordHandler {
270
269
  let onAbort
271
270
 
272
271
  const signal = opts?.signal
273
- const timeout = opts?.timeout
272
+ const timeout = opts?.timeout || 2 * 60e3
274
273
 
275
274
  const signalPromise = signal
276
275
  ? new Promise((resolve, reject) => {
@@ -282,23 +281,11 @@ class RecordHandler {
282
281
  : Promise.resolve()
283
282
  signalPromise?.catch(() => {})
284
283
 
285
- const sync = {
286
- status: 'pending',
287
- data: undefined,
288
- timeout: timeout || 2 * 60e3,
289
- timestamp: Date.now(),
290
- }
291
-
292
- this._syncing.add(sync)
293
284
  try {
294
285
  if (this._patching.size) {
295
286
  let patchingTimeout
296
287
  const patching = [...this._patching.values()]
297
288
 
298
- sync.status = 'patching'
299
- sync.data = patching
300
- sync.timestamp = Date.now()
301
-
302
289
  await Promise.race([
303
290
  Promise.all(
304
291
  patching.map((callbacks) => new Promise((resolve) => callbacks.push(resolve))),
@@ -308,12 +295,10 @@ class RecordHandler {
308
295
  this._client._$onError(
309
296
  C.TOPIC.RECORD,
310
297
  C.EVENT.TIMEOUT,
311
- Object.assign(new Error('sync patching timeout'), {
312
- data: sync,
313
- }),
298
+ new Error('sync patching timeout'),
314
299
  )
315
300
  resolve(null)
316
- }, sync.timeout)
301
+ }, timeout)
317
302
  }),
318
303
  signalPromise,
319
304
  ]).finally(() => {
@@ -325,10 +310,6 @@ class RecordHandler {
325
310
  let updatingTimeout
326
311
  const updating = [...this._updating.values()]
327
312
 
328
- sync.status = 'updating'
329
- sync.data = updating
330
- sync.timestamp = Date.now()
331
-
332
313
  await Promise.race([
333
314
  Promise.all(
334
315
  updating.map((callbacks) => new Promise((resolve) => callbacks.push(resolve))),
@@ -338,12 +319,10 @@ class RecordHandler {
338
319
  this._client._$onError(
339
320
  C.TOPIC.RECORD,
340
321
  C.EVENT.TIMEOUT,
341
- Object.assign(new Error('sync updating timeout'), {
342
- data: sync,
343
- }),
322
+ new Error('sync updating timeout'),
344
323
  )
345
324
  resolve(null)
346
- }, sync.timeout)
325
+ }, timeout)
347
326
  }),
348
327
  signalPromise,
349
328
  ]).finally(() => {
@@ -354,12 +333,8 @@ class RecordHandler {
354
333
  let serverTimeout
355
334
  const token = xuid()
356
335
 
357
- sync.status = 'token'
358
- sync.data = token
359
- sync.timestamp = Date.now()
360
-
361
336
  return await Promise.race([
362
- await new Promise((resolve) => {
337
+ new Promise((resolve) => {
363
338
  this._syncEmitter.once(token, resolve)
364
339
  this._connection.sendMsg(C.TOPIC.RECORD, C.ACTIONS.SYNC, [token])
365
340
  }),
@@ -368,18 +343,16 @@ class RecordHandler {
368
343
  this._client._$onError(
369
344
  C.TOPIC.RECORD,
370
345
  C.EVENT.TIMEOUT,
371
- Object.assign(new Error('sync server timeout'), { data: { token, timeout } }),
346
+ new Error('sync server timeout'),
372
347
  )
373
348
  resolve(null)
374
- }, sync.timeout)
349
+ }, timeout)
375
350
  }),
376
351
  signalPromise,
377
352
  ]).finally(() => {
378
353
  timers.clearTimeout(serverTimeout)
379
354
  })
380
355
  } finally {
381
- this._syncing.delete(sync)
382
-
383
356
  if (onAbort) {
384
357
  signal?.removeEventListener('abort', onAbort)
385
358
  }