@nxtedition/deepstream.io-client-js 32.0.16 → 32.0.18

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": "32.0.16",
3
+ "version": "32.0.18",
4
4
  "description": "the javascript client for deepstream.io",
5
5
  "homepage": "http://deepstream.io",
6
6
  "type": "module",
@@ -78,7 +78,7 @@ EventHandler.on = function (name, callback) {
78
78
 
79
79
  EventHandler.once = function (name, callback) {
80
80
  const fn = (...args) => {
81
- this.unsubscribe(name, fn)
81
+ this.unsubscribe(fn)
82
82
  callback(...args)
83
83
  }
84
84
  this.subscribe(name, fn)
@@ -119,8 +119,12 @@ class RecordHandler {
119
119
 
120
120
  this._connected = 0
121
121
  this._stats = {
122
+ updating: 0,
122
123
  created: 0,
123
124
  destroyed: 0,
125
+ records: 0,
126
+ pruning: 0,
127
+ patching: 0,
124
128
  }
125
129
 
126
130
  this._syncQueue = []
@@ -146,6 +150,8 @@ class RecordHandler {
146
150
  this._records.delete(rec.name)
147
151
  }
148
152
 
153
+ this._stats.pruning -= pruning.size
154
+ this._stats.records -= pruning.size
149
155
  this._stats.destroyed += pruning.size
150
156
 
151
157
  this._pruningTimeout.refresh()
@@ -155,6 +161,12 @@ class RecordHandler {
155
161
  }
156
162
 
157
163
  _onPruning(rec, value) {
164
+ if (value) {
165
+ this._stats.pruning += 1
166
+ } else {
167
+ this._stats.pruning -= 1
168
+ }
169
+
158
170
  if (value) {
159
171
  this._pruning.add(rec)
160
172
  } else {
@@ -167,9 +179,12 @@ class RecordHandler {
167
179
 
168
180
  if (value) {
169
181
  invariant(!callbacks, 'updating callbacks must not exist')
182
+ this._stats.updating += 1
170
183
  this._updating.set(rec, [])
171
184
  } else {
172
185
  invariant(callbacks, 'updating callbacks must exist')
186
+
187
+ this._stats.updating -= 1
173
188
  this._updating.delete(rec)
174
189
  for (const callback of callbacks) {
175
190
  callback()
@@ -179,8 +194,11 @@ class RecordHandler {
179
194
 
180
195
  _onPatching(rec, value) {
181
196
  if (value) {
197
+ this._stats.patching += 1
182
198
  this._patching.set(rec, [])
183
199
  } else {
200
+ this._stats.patching -= 1
201
+
184
202
  const callbacks = this._patching.get(rec)
185
203
  this._patching.delete(rec)
186
204
  for (const callback of callbacks) {
@@ -202,10 +220,6 @@ class RecordHandler {
202
220
  return {
203
221
  ...this._stats,
204
222
  subscriptions,
205
- updating: this._updating.size,
206
- patching: this._patching.size,
207
- putting: this._putting.size,
208
- pruning: this._pruning.size,
209
223
  }
210
224
  }
211
225
 
@@ -231,6 +245,7 @@ class RecordHandler {
231
245
 
232
246
  if (!record) {
233
247
  record = new Record(name, this)
248
+ this._stats.records += 1
234
249
  this._stats.created += 1
235
250
  this._records.set(name, record)
236
251
  }
@@ -575,7 +590,7 @@ class RecordHandler {
575
590
  }
576
591
 
577
592
  if (idx < args.length && (args[idx] == null || typeof args[idx] === 'object')) {
578
- const options = args[idx] ?? {}
593
+ const options = args[idx++] || {}
579
594
 
580
595
  if (options.signal !== undefined) {
581
596
  signal = options.signal
@@ -623,11 +638,6 @@ class RecordHandler {
623
638
  }
624
639
 
625
640
  return new rxjs.Observable((subscriber) => {
626
- if (signal?.aborted) {
627
- subscriber.error(new utils.AbortError())
628
- return
629
- }
630
-
631
641
  // TODO (perf): Make a class
632
642
  const subscription = {
633
643
  /** @readonly @type {unknown} */
@@ -16,7 +16,7 @@ class Record {
16
16
  this._handler = handler
17
17
  this._name = name
18
18
  this._version = ''
19
- this._data = jsonPath.EMPTY_OBJ
19
+ this._data = jsonPath.EMPTY
20
20
  this._state = C.RECORD_STATE.VOID
21
21
  this._refs = 0
22
22
  this._subscriptions = []
@@ -229,7 +229,7 @@ class Record {
229
229
  when(stateOrNil, optionsOrNil) {
230
230
  invariant(this._refs > 0, 'missing refs')
231
231
 
232
- if (stateOrNil != null && typeof stateOrNil === 'object') {
232
+ if (stateOrNil != null && stateOrNil === 'object') {
233
233
  optionsOrNil = stateOrNil
234
234
  stateOrNil = optionsOrNil?.state
235
235
  }
@@ -253,14 +253,8 @@ class Record {
253
253
  }
254
254
 
255
255
  let timeoutHandle
256
- let done = false
257
256
 
258
257
  const onDone = (err) => {
259
- if (done) {
260
- return
261
- }
262
- done = true
263
-
264
258
  if (err) {
265
259
  reject(err)
266
260
  } else {
@@ -83,14 +83,6 @@ export function setTimeout(callback, timeoutDuration) {
83
83
  }
84
84
  }
85
85
 
86
- export function setInterval(callback, intervalDuration) {
87
- if (intervalDuration !== null) {
88
- return globalThis.setInterval(callback, intervalDuration)
89
- } else {
90
- return -1
91
- }
92
- }
93
-
94
86
  export function compareRev(a, b) {
95
87
  if (!a) {
96
88
  return b ? -1 : 0