@nxtedition/deepstream.io-client-js 23.4.49 → 23.4.50
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 +1 -1
- package/src/record/record.js +14 -9
package/package.json
CHANGED
package/src/record/record.js
CHANGED
|
@@ -22,7 +22,6 @@ class Record {
|
|
|
22
22
|
this._updating = null
|
|
23
23
|
this._patches = null
|
|
24
24
|
this._subscribed = false
|
|
25
|
-
this._connection = handler.connection
|
|
26
25
|
}
|
|
27
26
|
|
|
28
27
|
get name() {
|
|
@@ -51,7 +50,7 @@ class Record {
|
|
|
51
50
|
this._handler._onPruning(this, false)
|
|
52
51
|
}
|
|
53
52
|
|
|
54
|
-
if (this._refs === 1 && this._connection.connected && !this._subscribed) {
|
|
53
|
+
if (this._refs === 1 && this._handler._connection.connected && !this._subscribed) {
|
|
55
54
|
this._subscribe()
|
|
56
55
|
}
|
|
57
56
|
|
|
@@ -230,14 +229,14 @@ class Record {
|
|
|
230
229
|
}
|
|
231
230
|
|
|
232
231
|
_$onConnectionStateChange() {
|
|
233
|
-
if (this._connection.connected) {
|
|
232
|
+
if (this._handler._connection.connected) {
|
|
234
233
|
if (this._refs > 0) {
|
|
235
234
|
this._subscribe()
|
|
236
235
|
}
|
|
237
236
|
|
|
238
237
|
if (this._updating) {
|
|
239
238
|
for (const update of this._updating.values()) {
|
|
240
|
-
this._connection.connection.sendMsg(C.TOPIC.RECORD, C.ACTIONS.UPDATE, update)
|
|
239
|
+
this._handler._connection.connection.sendMsg(C.TOPIC.RECORD, C.ACTIONS.UPDATE, update)
|
|
241
240
|
}
|
|
242
241
|
}
|
|
243
242
|
} else {
|
|
@@ -251,9 +250,9 @@ class Record {
|
|
|
251
250
|
}
|
|
252
251
|
|
|
253
252
|
_subscribe() {
|
|
254
|
-
invariant(this._connection.connected, 'must be connected')
|
|
253
|
+
invariant(this._handler._connection.connected, 'must be connected')
|
|
255
254
|
|
|
256
|
-
this._connection.sendMsg1(C.TOPIC.RECORD, C.ACTIONS.SUBSCRIBE, this._name)
|
|
255
|
+
this._handler._connection.sendMsg1(C.TOPIC.RECORD, C.ACTIONS.SUBSCRIBE, this._name)
|
|
257
256
|
this._subscribed = true
|
|
258
257
|
|
|
259
258
|
this.ref()
|
|
@@ -265,10 +264,13 @@ class Record {
|
|
|
265
264
|
invariant(!this._patches, 'must not have patches')
|
|
266
265
|
invariant(!this._updating, 'must not have updates')
|
|
267
266
|
invariant(this.state >= C.RECORD_STATE.SERVER, 'must not be pending')
|
|
268
|
-
invariant(
|
|
267
|
+
invariant(
|
|
268
|
+
!this._subscribed || this._handler._connection.connected,
|
|
269
|
+
'must be unsubscribed or connected'
|
|
270
|
+
)
|
|
269
271
|
|
|
270
272
|
if (this._subscribed) {
|
|
271
|
-
this._connection.sendMsg1(C.TOPIC.RECORD, C.ACTIONS.UNSUBSCRIBE, this._name)
|
|
273
|
+
this._handler._connection.sendMsg1(C.TOPIC.RECORD, C.ACTIONS.UNSUBSCRIBE, this._name)
|
|
272
274
|
this._subscribed = false
|
|
273
275
|
}
|
|
274
276
|
|
|
@@ -398,7 +400,10 @@ class Record {
|
|
|
398
400
|
try {
|
|
399
401
|
fn(this)
|
|
400
402
|
} catch (err) {
|
|
401
|
-
this._error(
|
|
403
|
+
this._error(
|
|
404
|
+
C.EVENT.USER_ERROR,
|
|
405
|
+
Object.assign(new Error('user callback failed'), { cause: err })
|
|
406
|
+
)
|
|
402
407
|
}
|
|
403
408
|
}
|
|
404
409
|
} finally {
|