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

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.7",
3
+ "version": "23.4.8",
4
4
  "description": "the javascript client for deepstream.io",
5
5
  "homepage": "http://deepstream.io",
6
6
  "bugs": {
@@ -60,37 +60,45 @@ class Listener {
60
60
  }
61
61
 
62
62
  if (value$) {
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}`)
63
+ const subscription = value$
64
+ .pipe(
65
+ rxjs.map((value) => {
66
+ let data
67
+ if (value && typeof value === 'string') {
68
+ if (value.charAt(0) !== '{' && value.charAt(0) !== '[') {
69
+ throw new Error(`invalid value: ${value}`)
70
+ }
71
+ data = value
72
+ } else if (value && typeof value === 'object') {
73
+ data = this._stringify(value)
69
74
  }
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
- ])
88
- },
89
- error: (err) => {
90
- this._error(name, err)
91
- this._connection.sendMsg(this._topic, C.ACTIONS.LISTEN_REJECT, [this._pattern, name])
92
- },
93
- })
75
+
76
+ return data
77
+ }),
78
+ rxjs.takeWhile(Boolean)
79
+ )
80
+ .subscribe({
81
+ next: (data) => {
82
+ if (data === this._data) {
83
+ return
84
+ }
85
+
86
+ this._data = data
87
+ this._version = `INF-${this._connection.hasher.h64ToString(data)}`
88
+ this._connection.sendMsg(this._topic, C.ACTIONS.UPDATE, [
89
+ name,
90
+ this._version,
91
+ this._data,
92
+ ])
93
+ },
94
+ error: (err) => {
95
+ this._error(name, err)
96
+ this._connection.sendMsg(this._topic, C.ACTIONS.LISTEN_REJECT, [this._pattern, name])
97
+ },
98
+ complete: () => {
99
+ this._connection.sendMsg(this._topic, C.ACTIONS.LISTEN_REJECT, [this._pattern, name])
100
+ },
101
+ })
94
102
  this._subscriptions.set(name, subscription)
95
103
  } else {
96
104
  this._connection.sendMsg(this._topic, C.ACTIONS.LISTEN_REJECT, [this._pattern, name])