@nxtedition/deepstream.io-client-js 28.1.20 → 28.1.22

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": "28.1.20",
3
+ "version": "28.1.22",
4
4
  "description": "the javascript client for deepstream.io",
5
5
  "homepage": "http://deepstream.io",
6
6
  "type": "module",
@@ -257,12 +257,15 @@ class RecordHandler {
257
257
  this._stats.listeners += 1
258
258
  this._listeners.set(pattern, listener)
259
259
 
260
- return () => {
260
+ const disposer = () => {
261
261
  listener._$destroy()
262
262
 
263
263
  this._stats.listeners -= 1
264
264
  this._listeners.delete(pattern)
265
265
  }
266
+ disposer[Symbol.dispose] = disposer
267
+
268
+ return disposer
266
269
  }
267
270
 
268
271
  async sync(opts) {
@@ -447,7 +450,7 @@ class RecordHandler {
447
450
  }
448
451
  }
449
452
 
450
- put(name, version, data) {
453
+ put(name, version, data, parent) {
451
454
  if (typeof name !== 'string' || name.startsWith('_')) {
452
455
  throw new Error('invalid argument: name')
453
456
  }
@@ -460,7 +463,16 @@ class RecordHandler {
460
463
  throw new Error('invalid argument: data')
461
464
  }
462
465
 
466
+ if (parent != null && (typeof version !== 'string' || !/^\d+-/.test(version))) {
467
+ throw new Error('invalid argument: parent')
468
+ }
469
+
463
470
  const update = [name, version, jsonPath.stringify(data)]
471
+
472
+ if (parent) {
473
+ update.push(parent)
474
+ }
475
+
464
476
  this._connection.sendMsg(C.TOPIC.RECORD, C.ACTIONS.PUT, update)
465
477
 
466
478
  this._putting.set(update, [])
@@ -78,6 +78,10 @@ class Record {
78
78
  return this
79
79
  }
80
80
 
81
+ [Symbol.dispose]() {
82
+ this.unref()
83
+ }
84
+
81
85
  /**
82
86
  * @param {*} fn
83
87
  * @param {*} opaque