@mblaney/holster 2.1.0 → 2.1.1

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": "@mblaney/holster",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "description": "Holster is a service that allows synchronising data between devices using Node, Deno, Bun or the browser.",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -24,7 +24,6 @@
24
24
  "author": "Malcolm Blaney",
25
25
  "license": "Zlib, MIT, Apache-2.0",
26
26
  "dependencies": {
27
- "express": "^5.1.0",
28
27
  "fs": "^0.0.1-security",
29
28
  "ws": "^8.18.0",
30
29
  "zod": "^4.1.13"
@@ -33,6 +32,7 @@
33
32
  "@types/node": "^24.10.1",
34
33
  "@types/ws": "^8.18.1",
35
34
  "esbuild": "0.25.3",
35
+ "express": "^5.1.0",
36
36
  "mock-socket": "^9.3.1",
37
37
  "prettier": "^3.4.2",
38
38
  "tsx": "^4.0.0",
package/src/wire.js CHANGED
@@ -441,7 +441,7 @@ const Wire = opt => {
441
441
  if ((userStorage.get(pub) ?? 0) >= limit) continue
442
442
  toStore[soul] = node
443
443
  const oldBytes = oldGraphBytes[soul] ?? 0
444
- const newBytes = JSON.stringify(node).length
444
+ const newBytes = graph[soul] ? JSON.stringify(graph[soul]).length : 0
445
445
  userStorage.set(
446
446
  pub,
447
447
  Math.max(0, (userStorage.get(pub) ?? 0) - oldBytes + newBytes),
@@ -664,7 +664,9 @@ const Wire = opt => {
664
664
  }
665
665
 
666
666
  const oldBytes = oldGraphBytes[soul] ?? 0
667
- const newBytes = JSON.stringify(node).length
667
+ const newBytes = graph[soul]
668
+ ? JSON.stringify(graph[soul]).length
669
+ : 0
668
670
  userStorage.set(pub, Math.max(0, current - oldBytes + newBytes))
669
671
  saveUserStorage()
670
672
  }
package/ts/src/wire.ts CHANGED
@@ -493,7 +493,7 @@ const Wire = (opt: HolsterOptions): WireAPI => {
493
493
  if ((userStorage.get(pub) ?? 0) >= limit) continue
494
494
  toStore[soul] = node
495
495
  const oldBytes = oldGraphBytes[soul] ?? 0
496
- const newBytes = JSON.stringify(node).length
496
+ const newBytes = graph[soul] ? JSON.stringify(graph[soul]).length : 0
497
497
  userStorage.set(
498
498
  pub,
499
499
  Math.max(0, (userStorage.get(pub) ?? 0) - oldBytes + newBytes),
@@ -705,7 +705,9 @@ const Wire = (opt: HolsterOptions): WireAPI => {
705
705
  return
706
706
  }
707
707
  const oldBytes = oldGraphBytes[soul] ?? 0
708
- const newBytes = JSON.stringify(node).length
708
+ const newBytes = graph[soul]
709
+ ? JSON.stringify(graph[soul]).length
710
+ : 0
709
711
  userStorage.set(pub, Math.max(0, current - oldBytes + newBytes))
710
712
  saveUserStorage()
711
713
  }