@nxtedition/deepstream.io-client-js 31.0.12 → 31.0.14

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": "31.0.12",
3
+ "version": "31.0.14",
4
4
  "description": "the javascript client for deepstream.io",
5
5
  "homepage": "http://deepstream.io",
6
6
  "type": "module",
@@ -5,7 +5,7 @@ const SEP = C.MESSAGE_PART_SEPERATOR
5
5
 
6
6
  let poolBuf
7
7
  let poolPos = 0
8
- let poolSize = 2 * 1024 * 1024
8
+ let poolLen = 2 * 1024 * 1024
9
9
 
10
10
  export function getMsg(topic, action, data, binary) {
11
11
  if (data && !(data instanceof Array)) {
@@ -33,7 +33,8 @@ export function getMsg(topic, action, data, binary) {
33
33
  }
34
34
 
35
35
  if (!poolBuf || poolBuf.byteLength - poolPos < estimatedSize * 2) {
36
- poolBuf = Buffer.allocUnsafeSlow(poolSize)
36
+ poolLen = Math.max(poolLen, estimatedSize * 2)
37
+ poolBuf = Buffer.allocUnsafeSlow(poolLen)
37
38
  poolPos = 0
38
39
  }
39
40
 
@@ -78,7 +79,7 @@ export function getMsg(topic, action, data, binary) {
78
79
  dataPos += len
79
80
 
80
81
  if (dataPos >= poolPos + poolBuf.byteLength) {
81
- poolSize *= poolPos === 0 ? 2 : 1
82
+ poolLen *= poolPos === 0 ? 2 : 1
82
83
  poolBuf = null
83
84
  poolPos = 0
84
85
  return getMsg(topic, action, data, binary)
@@ -215,7 +215,10 @@ class RecordHandler {
215
215
  */
216
216
  getRecord(name) {
217
217
  invariant(
218
- typeof name === 'string' && name.length > 0 && name !== '[object Object]',
218
+ typeof name === 'string' &&
219
+ name.length > 0 &&
220
+ name !== '[object Object]' &&
221
+ name.length <= 4096,
219
222
  `invalid name ${name}`,
220
223
  )
221
224