@nxtedition/deepstream.io-client-js 28.1.1 → 28.1.2

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.1",
3
+ "version": "28.1.2",
4
4
  "description": "the javascript client for deepstream.io",
5
5
  "homepage": "http://deepstream.io",
6
6
  "type": "module",
@@ -39,27 +39,27 @@
39
39
  "component-emitter2": "^1.3.5",
40
40
  "invariant": "^2.2.4",
41
41
  "lodash.clonedeep": "^4.5.0",
42
- "utf-8-validate": "^6.0.4",
42
+ "utf-8-validate": "^6.0.5",
43
43
  "ws": "^8.18.0",
44
44
  "xuid": "^4.1.3",
45
45
  "xxhash-wasm": "^1.0.2"
46
46
  },
47
47
  "devDependencies": {
48
- "eslint": "^9.9.0",
48
+ "eslint": "^9.14.0",
49
49
  "eslint-config-prettier": "^9.1.0",
50
50
  "eslint-config-standard": "^17.1.0",
51
- "eslint-plugin-import": "^2.29.1",
52
- "eslint-plugin-n": "^17.10.2",
51
+ "eslint-plugin-import": "^2.31.0",
52
+ "eslint-plugin-n": "^17.12.0",
53
53
  "eslint-plugin-node": "^11.1.0",
54
54
  "eslint-plugin-promise": "^7.1.0",
55
- "husky": "^9.1.4",
56
- "lint-staged": "^15.2.8",
57
- "mitata": "^0.1.11",
55
+ "husky": "^9.1.6",
56
+ "lint-staged": "^15.2.10",
57
+ "mitata": "^1.0.10",
58
58
  "pinst": "^3.0.0",
59
59
  "prettier": "^3.3.3",
60
60
  "rxjs": "^7.8.1",
61
- "typescript": "^5.5.4",
62
- "typescript-eslint": "^8.0.1"
61
+ "typescript": "^5.6.3",
62
+ "typescript-eslint": "^8.12.2"
63
63
  },
64
64
  "peerDependencies": {
65
65
  "rxjs": ">=6.x"
@@ -100,6 +100,7 @@ class RecordHandler {
100
100
  this._pruning = new Set()
101
101
  this._patching = new Map()
102
102
  this._updating = new Map()
103
+ this._putting = new Set()
103
104
 
104
105
  this._connected = 0
105
106
  this._stats = {
@@ -398,13 +399,26 @@ class RecordHandler {
398
399
  }
399
400
  }
400
401
 
401
- put(name, ...args) {
402
- const record = this.getRecord(name)
403
- try {
404
- return record.put(...args)
405
- } finally {
406
- record.unref()
402
+ put(name, version, data) {
403
+ if (typeof name !== 'string' || name.startsWith('_')) {
404
+ throw new Error('invalid argument: name')
405
+ }
406
+
407
+ if (typeof version !== 'string' || !/^\d+-/.test(version)) {
408
+ throw new Error('invalid argument: verison')
407
409
  }
410
+
411
+ if (typeof data !== 'object' && data != null) {
412
+ throw new Error('invalid argument: data')
413
+ }
414
+
415
+ const update = [name, version, jsonPath.stringify(data)]
416
+ this._connection.sendMsg(C.TOPIC.RECORD, C.ACTIONS.PUT, update)
417
+
418
+ this._putting.add(update)
419
+ this._sync((update) => {
420
+ this._putting.delete(update)
421
+ }, update)
408
422
  }
409
423
 
410
424
  /**
@@ -665,6 +679,10 @@ class RecordHandler {
665
679
  for (const token of this._syncEmitter.eventNames()) {
666
680
  this._connection.sendMsg(C.TOPIC.RECORD, C.ACTIONS.SYNC, [token])
667
681
  }
682
+
683
+ for (const update of this._putting) {
684
+ this._connection.sendMsg(C.TOPIC.RECORD, C.ACTIONS.PUT, update)
685
+ }
668
686
  } else {
669
687
  this._connected = 0
670
688
  }
@@ -183,26 +183,6 @@ class Record {
183
183
  }
184
184
  }
185
185
 
186
- put(version, data) {
187
- const connection = this._handler._connection
188
-
189
- if (typeof version !== 'string' || !/^\d+-.+/.test(version)) {
190
- throw new Error('invalid argument: version')
191
- }
192
-
193
- if (!utils.isPlainObject(data)) {
194
- throw new Error('invalid argument: data')
195
- }
196
-
197
- connection.sendMsg(C.TOPIC.RECORD, C.ACTIONS.PUT, [
198
- this._name,
199
- version,
200
- jsonPath.stringify(data),
201
- ])
202
-
203
- this._onUpdate([this._name, version, jsonPath.stringify(data), 'F'])
204
- }
205
-
206
186
  when(stateOrNil, optionsOrNil) {
207
187
  invariant(this._refs > 0, 'missing refs')
208
188