@nxtedition/deepstream.io-client-js 23.3.2 → 23.3.4

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": "23.3.2",
3
+ "version": "23.3.4",
4
4
  "description": "the javascript client for deepstream.io",
5
5
  "homepage": "http://deepstream.io",
6
6
  "bugs": {
package/src/client.js CHANGED
@@ -71,7 +71,11 @@ Client.prototype.getConnectionState = function () {
71
71
 
72
72
  Client.prototype._$onMessage = function (message) {
73
73
  if (this._messageCallbacks[message.topic]) {
74
- this._messageCallbacks[message.topic](message)
74
+ try {
75
+ this._messageCallbacks[message.topic](message)
76
+ } catch (err) {
77
+ this._$onError(message.topic, null, err, message.data.slice(0))
78
+ }
75
79
  } else {
76
80
  message.processedError = true
77
81
  this._$onError(
@@ -94,7 +98,9 @@ Client.prototype._$onError = function (topic, event, msgOrError, data) {
94
98
 
95
99
  if (this.hasListeners('error')) {
96
100
  this.emit('error', error)
97
- this.emit(event, error)
101
+ if (event) {
102
+ this.emit(event, error)
103
+ }
98
104
  } else {
99
105
  console.log('--- You can catch all deepstream errors by subscribing to the error event ---')
100
106
 
@@ -101,7 +101,7 @@ class Record {
101
101
 
102
102
  if (!this._version) {
103
103
  this._patches = path && this._patches ? this._patches : []
104
- this._patches.push(path, jsonPath.stringify(data))
104
+ this._patches.push(path, jsonPath.jsonClone(data))
105
105
  this._handler._patch.add(this)
106
106
  }
107
107
 
@@ -293,12 +293,7 @@ class Record {
293
293
  if (this._version.charAt(0) !== 'I') {
294
294
  let patchData = this._data
295
295
  for (let n = 0; n < this._patches.length; n += 2) {
296
- patchData = jsonPath.set(
297
- patchData,
298
- this._patches[n + 0],
299
- jsonPath.parse(this._patches[n + 1]),
300
- true
301
- )
296
+ patchData = jsonPath.set(patchData, this._patches[n + 0], this._patches[n + 1], true)
302
297
  }
303
298
  this._update(patchData)
304
299
  }