@nxtedition/deepstream.io-client-js 23.4.5 → 23.4.7

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.5",
3
+ "version": "23.4.7",
4
4
  "description": "the javascript client for deepstream.io",
5
5
  "homepage": "http://deepstream.io",
6
6
  "bugs": {
@@ -1,5 +1,4 @@
1
1
  const C = require('../constants/constants')
2
- const rx = require('rxjs/operators')
3
2
  const rxjs = require('rxjs')
4
3
 
5
4
  class Listener {
@@ -12,26 +11,8 @@ class Listener {
12
11
  this._connection = this._handler._connection
13
12
  this._subscriptions = new Map()
14
13
  this._stringify = stringify || JSON.stringify
15
- this._pipe = rxjs.pipe(
16
- rx.map((value) => {
17
- let data
18
- if (value && typeof value === 'string') {
19
- if (value.charAt(0) !== '{' && value.charAt(0) !== '[') {
20
- throw new Error(`invalid value: ${value}`)
21
- }
22
- data = value
23
- } else if (value && typeof value === 'object') {
24
- data = this._stringify(value)
25
- } else {
26
- throw new Error(`invalid value: ${value}`)
27
- }
28
-
29
- const hash = this._connection.hasher.h64ToString(data)
30
-
31
- return { data, hash }
32
- }),
33
- rx.distinctUntilKeyChanged('hash')
34
- )
14
+ this._data = ''
15
+ this._version = ''
35
16
 
36
17
  this._$onConnectionStateChange()
37
18
 
@@ -79,9 +60,31 @@ class Listener {
79
60
  }
80
61
 
81
62
  if (value$) {
82
- const subscription = value$.pipe(this._pipe).subscribe({
83
- next: ({ data, hash }) => {
84
- this._connection.sendMsg(this._topic, C.ACTIONS.UPDATE, [name, `INF-${hash}`, data])
63
+ const subscription = value$.subscribe({
64
+ next: (value) => {
65
+ let data
66
+ if (value && typeof value === 'string') {
67
+ if (value.charAt(0) !== '{' && value.charAt(0) !== '[') {
68
+ throw new Error(`invalid value: ${value}`)
69
+ }
70
+ data = value
71
+ } else if (value && typeof value === 'object') {
72
+ data = this._stringify(value)
73
+ } else {
74
+ throw new Error(`invalid value: ${value}`)
75
+ }
76
+
77
+ if (data === this._data) {
78
+ return
79
+ }
80
+
81
+ this._data = data
82
+ this._version = `INF-${this._connection.hasher.h64ToString(data)}`
83
+ this._connection.sendMsg(this._topic, C.ACTIONS.UPDATE, [
84
+ name,
85
+ this._version,
86
+ this._data,
87
+ ])
85
88
  },
86
89
  error: (err) => {
87
90
  this._error(name, err)