@nxtedition/deepstream.io-client-js 23.4.10 → 23.4.12
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.4.
|
|
3
|
+
"version": "23.4.12",
|
|
4
4
|
"description": "the javascript client for deepstream.io",
|
|
5
5
|
"homepage": "http://deepstream.io",
|
|
6
6
|
"bugs": {
|
|
@@ -62,6 +62,7 @@
|
|
|
62
62
|
"bufferutil": "^4.0.7",
|
|
63
63
|
"component-emitter2": "^1.3.5",
|
|
64
64
|
"invariant": "^2.2.4",
|
|
65
|
+
"lodash.clonedeep": "^4.5.0",
|
|
65
66
|
"utf-8-validate": "^6.0.3",
|
|
66
67
|
"ws": "^8.13.0",
|
|
67
68
|
"xuid": "^4.1.2",
|
package/src/record/record.js
CHANGED
|
@@ -4,6 +4,7 @@ const C = require('../constants/constants')
|
|
|
4
4
|
const messageParser = require('../message/message-parser')
|
|
5
5
|
const xuid = require('xuid')
|
|
6
6
|
const invariant = require('invariant')
|
|
7
|
+
const cloneDeep = require('lodash.clonedeep')
|
|
7
8
|
|
|
8
9
|
class Record {
|
|
9
10
|
static STATE = C.RECORD_STATE
|
|
@@ -111,7 +112,7 @@ class Record {
|
|
|
111
112
|
|
|
112
113
|
if (!this._version) {
|
|
113
114
|
this._patches = path && this._patches ? this._patches : []
|
|
114
|
-
this._patches.push(path,
|
|
115
|
+
this._patches.push(path, cloneDeep(data))
|
|
115
116
|
this._handler._patch.add(this)
|
|
116
117
|
}
|
|
117
118
|
|
|
@@ -304,7 +305,7 @@ class Record {
|
|
|
304
305
|
if (this._version.charAt(0) !== 'I') {
|
|
305
306
|
let patchData = this._data
|
|
306
307
|
for (let n = 0; n < this._patches.length; n += 2) {
|
|
307
|
-
patchData = jsonPath.set(patchData, this._patches[n + 0], this._patches[n + 1],
|
|
308
|
+
patchData = jsonPath.set(patchData, this._patches[n + 0], this._patches[n + 1], false)
|
|
308
309
|
}
|
|
309
310
|
this._update(patchData)
|
|
310
311
|
}
|
|
@@ -11,8 +11,6 @@ class Listener {
|
|
|
11
11
|
this._connection = this._handler._connection
|
|
12
12
|
this._subscriptions = new Map()
|
|
13
13
|
this._stringify = stringify || JSON.stringify
|
|
14
|
-
this._data = ''
|
|
15
|
-
this._version = ''
|
|
16
14
|
|
|
17
15
|
this._$onConnectionStateChange()
|
|
18
16
|
|
|
@@ -76,21 +74,13 @@ class Listener {
|
|
|
76
74
|
}
|
|
77
75
|
|
|
78
76
|
return data
|
|
79
|
-
})
|
|
77
|
+
}),
|
|
78
|
+
rxjs.distinctUntilChanged()
|
|
80
79
|
)
|
|
81
80
|
.subscribe({
|
|
82
81
|
next: (data) => {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
this._data = data
|
|
88
|
-
this._version = `INF-${this._connection.hasher.h64ToString(data)}`
|
|
89
|
-
this._connection.sendMsg(this._topic, C.ACTIONS.UPDATE, [
|
|
90
|
-
name,
|
|
91
|
-
this._version,
|
|
92
|
-
this._data,
|
|
93
|
-
])
|
|
82
|
+
const version = `INF-${this._connection.hasher.h64ToString(data)}`
|
|
83
|
+
this._connection.sendMsg(this._topic, C.ACTIONS.UPDATE, [name, version, data])
|
|
94
84
|
},
|
|
95
85
|
error: (err) => {
|
|
96
86
|
this._error(name, err)
|