@nxtedition/deepstream.io-client-js 24.3.3 → 24.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
|
@@ -207,7 +207,7 @@ class RecordHandler {
|
|
|
207
207
|
}
|
|
208
208
|
}
|
|
209
209
|
|
|
210
|
-
|
|
210
|
+
getKey(name) {
|
|
211
211
|
return name.length <= 8 && this._encoder.encode(name).byteLength === 8
|
|
212
212
|
? name
|
|
213
213
|
: this._connection.hasher.h64(name)
|
|
@@ -226,7 +226,7 @@ class RecordHandler {
|
|
|
226
226
|
let record = this._records.get(name)
|
|
227
227
|
|
|
228
228
|
if (!record) {
|
|
229
|
-
record = new Record(this.
|
|
229
|
+
record = new Record(this.getKey(name), name, this)
|
|
230
230
|
this._stats.records += 1
|
|
231
231
|
this._stats.created += 1
|
|
232
232
|
this._records.set(name, record)
|
package/src/record/record.js
CHANGED
|
@@ -13,10 +13,7 @@ class Record {
|
|
|
13
13
|
static STATE = C.RECORD_STATE
|
|
14
14
|
|
|
15
15
|
constructor(key, name, handler) {
|
|
16
|
-
const connection = handler._connection
|
|
17
|
-
|
|
18
16
|
this._handler = handler
|
|
19
|
-
|
|
20
17
|
this._name = name
|
|
21
18
|
this._key = key
|
|
22
19
|
this._version = ''
|
|
@@ -28,10 +25,7 @@ class Record {
|
|
|
28
25
|
|
|
29
26
|
/** @type Map? */ this._updating = null
|
|
30
27
|
/** @type Array? */ this._patching = null
|
|
31
|
-
this._subscribed =
|
|
32
|
-
this._name,
|
|
33
|
-
this._key,
|
|
34
|
-
])
|
|
28
|
+
this._subscribed = false
|
|
35
29
|
}
|
|
36
30
|
|
|
37
31
|
/** @type {string} */
|
|
@@ -56,6 +56,7 @@ class Listener {
|
|
|
56
56
|
// TODO (refactor): Move to class
|
|
57
57
|
const provider = {
|
|
58
58
|
name,
|
|
59
|
+
key: this._handler.getKey(name),
|
|
59
60
|
value$: null,
|
|
60
61
|
sending: false,
|
|
61
62
|
accepted: false,
|
|
@@ -68,7 +69,7 @@ class Listener {
|
|
|
68
69
|
if (this.connected && provider.accepted) {
|
|
69
70
|
this._connection.sendMsg(this._topic, C.ACTIONS.LISTEN_REJECT, [
|
|
70
71
|
this._pattern,
|
|
71
|
-
provider.
|
|
72
|
+
provider.key,
|
|
72
73
|
])
|
|
73
74
|
}
|
|
74
75
|
|
|
@@ -101,7 +102,7 @@ class Listener {
|
|
|
101
102
|
this._connection.sendMsg(
|
|
102
103
|
this._topic,
|
|
103
104
|
accepted ? C.ACTIONS.LISTEN_ACCEPT : C.ACTIONS.LISTEN_REJECT,
|
|
104
|
-
[this._pattern, provider.
|
|
105
|
+
[this._pattern, provider.key]
|
|
105
106
|
)
|
|
106
107
|
|
|
107
108
|
provider.version = null
|
|
@@ -157,7 +158,7 @@ class Listener {
|
|
|
157
158
|
if (provider.version !== version) {
|
|
158
159
|
provider.version = version
|
|
159
160
|
this._connection.sendMsg(C.TOPIC.RECORD, C.ACTIONS.UPDATE, [
|
|
160
|
-
provider.
|
|
161
|
+
provider.key,
|
|
161
162
|
version,
|
|
162
163
|
body,
|
|
163
164
|
])
|
|
@@ -218,7 +219,11 @@ class Listener {
|
|
|
218
219
|
}
|
|
219
220
|
|
|
220
221
|
_error(name, err) {
|
|
221
|
-
this._client._$onError(this._topic, C.EVENT.LISTENER_ERROR, err, [
|
|
222
|
+
this._client._$onError(this._topic, C.EVENT.LISTENER_ERROR, err, [
|
|
223
|
+
this._pattern,
|
|
224
|
+
name,
|
|
225
|
+
this._handler.getKey(name),
|
|
226
|
+
])
|
|
222
227
|
}
|
|
223
228
|
|
|
224
229
|
_reset() {
|
|
@@ -68,27 +68,29 @@ class Listener {
|
|
|
68
68
|
value$ = rxjs.throwError(() => err)
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
+
const key = this._handler.getKey(name)
|
|
72
|
+
|
|
71
73
|
if (value$) {
|
|
72
74
|
const subscription = value$.pipe(PIPE).subscribe({
|
|
73
75
|
next: (data) => {
|
|
74
76
|
if (data == null) {
|
|
75
|
-
this._connection.sendMsg(this._topic, C.ACTIONS.LISTEN_REJECT, [this._pattern,
|
|
77
|
+
this._connection.sendMsg(this._topic, C.ACTIONS.LISTEN_REJECT, [this._pattern, key])
|
|
76
78
|
this._subscriptions.delete(name)
|
|
77
79
|
subscription.unsubscribe()
|
|
78
80
|
} else {
|
|
79
81
|
const version = `INF-${this._connection.hasher.h64ToString(data)}`
|
|
80
|
-
this._connection.sendMsg(this._topic, C.ACTIONS.UPDATE, [
|
|
82
|
+
this._connection.sendMsg(this._topic, C.ACTIONS.UPDATE, [key, version, data])
|
|
81
83
|
}
|
|
82
84
|
},
|
|
83
85
|
error: (err) => {
|
|
84
86
|
this._error(name, err)
|
|
85
|
-
this._connection.sendMsg(this._topic, C.ACTIONS.LISTEN_REJECT, [this._pattern,
|
|
87
|
+
this._connection.sendMsg(this._topic, C.ACTIONS.LISTEN_REJECT, [this._pattern, key])
|
|
86
88
|
this._subscriptions.delete(name)
|
|
87
89
|
},
|
|
88
90
|
})
|
|
89
91
|
this._subscriptions.set(name, subscription)
|
|
90
92
|
} else {
|
|
91
|
-
this._connection.sendMsg(this._topic, C.ACTIONS.LISTEN_REJECT, [this._pattern,
|
|
93
|
+
this._connection.sendMsg(this._topic, C.ACTIONS.LISTEN_REJECT, [this._pattern, key])
|
|
92
94
|
}
|
|
93
95
|
} else if (message.action === C.ACTIONS.LISTEN_REJECT) {
|
|
94
96
|
const subscription = this._subscriptions.get(name)
|