@nxtedition/deepstream.io-client-js 32.0.21 → 32.0.23

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.21",
3
+ "version": "32.0.23",
4
4
  "description": "the javascript client for deepstream.io",
5
5
  "homepage": "http://deepstream.io",
6
6
  "type": "module",
@@ -79,7 +79,7 @@ EventHandler.prototype.on = function (name, callback) {
79
79
  EventHandler.prototype.once = function (name, callback) {
80
80
  const fn = (...args) => {
81
81
  this.unsubscribe(name, fn)
82
- callback(...args)
82
+ callback(name, ...args)
83
83
  }
84
84
  this.subscribe(name, fn)
85
85
  return this
@@ -3,7 +3,6 @@ import LegacyListener from '../utils/legacy-listener.js'
3
3
  import UnicastListener from '../utils/unicast-listener.js'
4
4
  import * as C from '../constants/constants.js'
5
5
  import * as rxjs from 'rxjs'
6
- import invariant from 'invariant'
7
6
  import jsonPath from '@nxtedition/json-path'
8
7
  import * as utils from '../utils/utils.js'
9
8
  import xuid from 'xuid'
@@ -121,10 +120,6 @@ class RecordHandler {
121
120
  this._stats = {
122
121
  updating: 0,
123
122
  created: 0,
124
- destroyed: 0,
125
- records: 0,
126
- pruning: 0,
127
- patching: 0,
128
123
  }
129
124
 
130
125
  this._syncQueue = []
@@ -161,12 +156,6 @@ class RecordHandler {
161
156
  }
162
157
 
163
158
  _onPruning(rec, value) {
164
- if (value) {
165
- this._stats.pruning += 1
166
- } else {
167
- this._stats.pruning -= 1
168
- }
169
-
170
159
  if (value) {
171
160
  this._pruning.add(rec)
172
161
  } else {
@@ -175,16 +164,10 @@ class RecordHandler {
175
164
  }
176
165
 
177
166
  _onUpdating(rec, value) {
178
- const callbacks = this._updating.get(rec)
179
-
180
167
  if (value) {
181
- invariant(!callbacks, 'updating callbacks must not exist')
182
- this._stats.updating += 1
183
168
  this._updating.set(rec, [])
184
169
  } else {
185
- invariant(callbacks, 'updating callbacks must exist')
186
-
187
- this._stats.updating -= 1
170
+ const callbacks = this._updating.get(rec)
188
171
  this._updating.delete(rec)
189
172
  for (const callback of callbacks) {
190
173
  callback()
@@ -194,11 +177,8 @@ class RecordHandler {
194
177
 
195
178
  _onPatching(rec, value) {
196
179
  if (value) {
197
- this._stats.patching += 1
198
180
  this._patching.set(rec, [])
199
181
  } else {
200
- this._stats.patching -= 1
201
-
202
182
  const callbacks = this._patching.get(rec)
203
183
  this._patching.delete(rec)
204
184
  for (const callback of callbacks) {
@@ -213,13 +193,18 @@ class RecordHandler {
213
193
 
214
194
  get stats() {
215
195
  let subscriptions = 0
216
- for (const listener of this._listeners.values()) {
217
- subscriptions += listener.subscriptions ?? 0
196
+ for (const { stats } of this._listeners.values()) {
197
+ subscriptions += stats.subscriptions ?? 0
218
198
  }
219
199
 
220
200
  return {
221
201
  ...this._stats,
222
202
  subscriptions,
203
+ patching: this._patching.size,
204
+ updating: this._updating.size,
205
+ putting: this._putting.size,
206
+ records: this._records.size,
207
+ listeners: this._listeners.size,
223
208
  }
224
209
  }
225
210