tinybase 4.4.0-beta.0 → 4.4.0-beta.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.
Files changed (347) hide show
  1. package/lib/checkpoints.js +1 -1
  2. package/lib/checkpoints.js.gz +0 -0
  3. package/lib/cjs/checkpoints.cjs +1 -1
  4. package/lib/cjs/checkpoints.cjs.gz +0 -0
  5. package/lib/cjs/indexes.cjs +1 -1
  6. package/lib/cjs/indexes.cjs.gz +0 -0
  7. package/lib/cjs/metrics.cjs +1 -1
  8. package/lib/cjs/metrics.cjs.gz +0 -0
  9. package/lib/cjs/persisters/persister-automerge.cjs +1 -1
  10. package/lib/cjs/persisters/persister-automerge.cjs.gz +0 -0
  11. package/lib/cjs/persisters/persister-browser.cjs +1 -1
  12. package/lib/cjs/persisters/persister-browser.cjs.gz +0 -0
  13. package/lib/cjs/persisters/persister-cr-sqlite-wasm.cjs +1 -1
  14. package/lib/cjs/persisters/persister-cr-sqlite-wasm.cjs.gz +0 -0
  15. package/lib/cjs/persisters/persister-expo-sqlite.cjs +1 -1
  16. package/lib/cjs/persisters/persister-expo-sqlite.cjs.gz +0 -0
  17. package/lib/cjs/persisters/persister-file.cjs +1 -1
  18. package/lib/cjs/persisters/persister-file.cjs.gz +0 -0
  19. package/lib/cjs/persisters/persister-indexed-db.cjs +1 -1
  20. package/lib/cjs/persisters/persister-indexed-db.cjs.gz +0 -0
  21. package/lib/cjs/persisters/persister-partykit-client.cjs +1 -1
  22. package/lib/cjs/persisters/persister-partykit-client.cjs.gz +0 -0
  23. package/lib/cjs/persisters/persister-partykit-server.cjs +1 -1
  24. package/lib/cjs/persisters/persister-partykit-server.cjs.gz +0 -0
  25. package/lib/cjs/persisters/persister-remote.cjs +1 -1
  26. package/lib/cjs/persisters/persister-remote.cjs.gz +0 -0
  27. package/lib/cjs/persisters/persister-sqlite-wasm.cjs +1 -1
  28. package/lib/cjs/persisters/persister-sqlite-wasm.cjs.gz +0 -0
  29. package/lib/cjs/persisters/persister-sqlite3.cjs +1 -1
  30. package/lib/cjs/persisters/persister-sqlite3.cjs.gz +0 -0
  31. package/lib/cjs/persisters/persister-yjs.cjs +1 -1
  32. package/lib/cjs/persisters/persister-yjs.cjs.gz +0 -0
  33. package/lib/cjs/persisters.cjs +1 -1
  34. package/lib/cjs/persisters.cjs.gz +0 -0
  35. package/lib/cjs/queries.cjs +1 -1
  36. package/lib/cjs/queries.cjs.gz +0 -0
  37. package/lib/cjs/relationships.cjs +1 -1
  38. package/lib/cjs/relationships.cjs.gz +0 -0
  39. package/lib/cjs/store.cjs +1 -1
  40. package/lib/cjs/store.cjs.gz +0 -0
  41. package/lib/cjs/tinybase.cjs +1 -1
  42. package/lib/cjs/tinybase.cjs.gz +0 -0
  43. package/lib/cjs/tools.cjs +1 -1
  44. package/lib/cjs/tools.cjs.gz +0 -0
  45. package/lib/cjs/ui-react-dom-debug.cjs +1 -1
  46. package/lib/cjs/ui-react-dom-debug.cjs.gz +0 -0
  47. package/lib/cjs/ui-react-dom.cjs +1 -1
  48. package/lib/cjs/ui-react-dom.cjs.gz +0 -0
  49. package/lib/cjs/ui-react.cjs +1 -1
  50. package/lib/cjs/ui-react.cjs.gz +0 -0
  51. package/lib/cjs-es6/checkpoints.cjs +1 -1
  52. package/lib/cjs-es6/checkpoints.cjs.gz +0 -0
  53. package/lib/cjs-es6/indexes.cjs +1 -1
  54. package/lib/cjs-es6/indexes.cjs.gz +0 -0
  55. package/lib/cjs-es6/metrics.cjs +1 -1
  56. package/lib/cjs-es6/metrics.cjs.gz +0 -0
  57. package/lib/cjs-es6/persisters/persister-automerge.cjs +1 -1
  58. package/lib/cjs-es6/persisters/persister-automerge.cjs.gz +0 -0
  59. package/lib/cjs-es6/persisters/persister-browser.cjs +1 -1
  60. package/lib/cjs-es6/persisters/persister-browser.cjs.gz +0 -0
  61. package/lib/cjs-es6/persisters/persister-cr-sqlite-wasm.cjs +1 -1
  62. package/lib/cjs-es6/persisters/persister-cr-sqlite-wasm.cjs.gz +0 -0
  63. package/lib/cjs-es6/persisters/persister-expo-sqlite.cjs +1 -1
  64. package/lib/cjs-es6/persisters/persister-expo-sqlite.cjs.gz +0 -0
  65. package/lib/cjs-es6/persisters/persister-file.cjs +1 -1
  66. package/lib/cjs-es6/persisters/persister-file.cjs.gz +0 -0
  67. package/lib/cjs-es6/persisters/persister-indexed-db.cjs +1 -1
  68. package/lib/cjs-es6/persisters/persister-indexed-db.cjs.gz +0 -0
  69. package/lib/cjs-es6/persisters/persister-partykit-client.cjs +1 -1
  70. package/lib/cjs-es6/persisters/persister-partykit-client.cjs.gz +0 -0
  71. package/lib/cjs-es6/persisters/persister-partykit-server.cjs +1 -1
  72. package/lib/cjs-es6/persisters/persister-partykit-server.cjs.gz +0 -0
  73. package/lib/cjs-es6/persisters/persister-remote.cjs +1 -1
  74. package/lib/cjs-es6/persisters/persister-remote.cjs.gz +0 -0
  75. package/lib/cjs-es6/persisters/persister-sqlite-wasm.cjs +1 -1
  76. package/lib/cjs-es6/persisters/persister-sqlite-wasm.cjs.gz +0 -0
  77. package/lib/cjs-es6/persisters/persister-sqlite3.cjs +1 -1
  78. package/lib/cjs-es6/persisters/persister-sqlite3.cjs.gz +0 -0
  79. package/lib/cjs-es6/persisters/persister-yjs.cjs +1 -1
  80. package/lib/cjs-es6/persisters/persister-yjs.cjs.gz +0 -0
  81. package/lib/cjs-es6/persisters.cjs +1 -1
  82. package/lib/cjs-es6/persisters.cjs.gz +0 -0
  83. package/lib/cjs-es6/queries.cjs +1 -1
  84. package/lib/cjs-es6/queries.cjs.gz +0 -0
  85. package/lib/cjs-es6/relationships.cjs +1 -1
  86. package/lib/cjs-es6/relationships.cjs.gz +0 -0
  87. package/lib/cjs-es6/store.cjs +1 -1
  88. package/lib/cjs-es6/store.cjs.gz +0 -0
  89. package/lib/cjs-es6/tinybase.cjs +1 -1
  90. package/lib/cjs-es6/tinybase.cjs.gz +0 -0
  91. package/lib/cjs-es6/tools.cjs +1 -1
  92. package/lib/cjs-es6/tools.cjs.gz +0 -0
  93. package/lib/cjs-es6/ui-react-dom-debug.cjs +1 -1
  94. package/lib/cjs-es6/ui-react-dom-debug.cjs.gz +0 -0
  95. package/lib/cjs-es6/ui-react-dom.cjs +1 -1
  96. package/lib/cjs-es6/ui-react-dom.cjs.gz +0 -0
  97. package/lib/cjs-es6/ui-react.cjs +1 -1
  98. package/lib/cjs-es6/ui-react.cjs.gz +0 -0
  99. package/lib/debug/checkpoints.js +12 -12
  100. package/lib/debug/indexes.js +9 -9
  101. package/lib/debug/metrics.js +9 -9
  102. package/lib/debug/persisters/persister-automerge.js +21 -8
  103. package/lib/debug/persisters/persister-browser.js +17 -3
  104. package/lib/debug/persisters/persister-cr-sqlite-wasm.js +27 -12
  105. package/lib/debug/persisters/persister-expo-sqlite.js +27 -12
  106. package/lib/debug/persisters/persister-file.js +17 -3
  107. package/lib/debug/persisters/persister-indexed-db.js +21 -8
  108. package/lib/debug/persisters/persister-partykit-client.js +54 -20
  109. package/lib/debug/persisters/persister-partykit-server.js +173 -77
  110. package/lib/debug/persisters/persister-remote.js +17 -3
  111. package/lib/debug/persisters/persister-sqlite-wasm.js +27 -12
  112. package/lib/debug/persisters/persister-sqlite3.js +28 -13
  113. package/lib/debug/persisters/persister-yjs.js +23 -10
  114. package/lib/debug/persisters.js +16 -4
  115. package/lib/debug/queries.js +16 -15
  116. package/lib/debug/relationships.js +9 -9
  117. package/lib/debug/store.js +130 -35
  118. package/lib/debug/tinybase.js +142 -41
  119. package/lib/debug/tools.js +17 -9
  120. package/lib/debug/ui-react-dom.js +262 -150
  121. package/lib/debug/ui-react.js +26 -18
  122. package/lib/es6/checkpoints.js +1 -1
  123. package/lib/es6/checkpoints.js.gz +0 -0
  124. package/lib/es6/indexes.js +1 -1
  125. package/lib/es6/indexes.js.gz +0 -0
  126. package/lib/es6/metrics.js +1 -1
  127. package/lib/es6/metrics.js.gz +0 -0
  128. package/lib/es6/persisters/persister-automerge.js +1 -1
  129. package/lib/es6/persisters/persister-automerge.js.gz +0 -0
  130. package/lib/es6/persisters/persister-browser.js +1 -1
  131. package/lib/es6/persisters/persister-browser.js.gz +0 -0
  132. package/lib/es6/persisters/persister-cr-sqlite-wasm.js +1 -1
  133. package/lib/es6/persisters/persister-cr-sqlite-wasm.js.gz +0 -0
  134. package/lib/es6/persisters/persister-expo-sqlite.js +1 -1
  135. package/lib/es6/persisters/persister-expo-sqlite.js.gz +0 -0
  136. package/lib/es6/persisters/persister-file.js +1 -1
  137. package/lib/es6/persisters/persister-file.js.gz +0 -0
  138. package/lib/es6/persisters/persister-indexed-db.js +1 -1
  139. package/lib/es6/persisters/persister-indexed-db.js.gz +0 -0
  140. package/lib/es6/persisters/persister-partykit-client.js +1 -1
  141. package/lib/es6/persisters/persister-partykit-client.js.gz +0 -0
  142. package/lib/es6/persisters/persister-partykit-server.js +1 -1
  143. package/lib/es6/persisters/persister-partykit-server.js.gz +0 -0
  144. package/lib/es6/persisters/persister-remote.js +1 -1
  145. package/lib/es6/persisters/persister-remote.js.gz +0 -0
  146. package/lib/es6/persisters/persister-sqlite-wasm.js +1 -1
  147. package/lib/es6/persisters/persister-sqlite-wasm.js.gz +0 -0
  148. package/lib/es6/persisters/persister-sqlite3.js +1 -1
  149. package/lib/es6/persisters/persister-sqlite3.js.gz +0 -0
  150. package/lib/es6/persisters/persister-yjs.js +1 -1
  151. package/lib/es6/persisters/persister-yjs.js.gz +0 -0
  152. package/lib/es6/persisters.js +1 -1
  153. package/lib/es6/persisters.js.gz +0 -0
  154. package/lib/es6/queries.js +1 -1
  155. package/lib/es6/queries.js.gz +0 -0
  156. package/lib/es6/relationships.js +1 -1
  157. package/lib/es6/relationships.js.gz +0 -0
  158. package/lib/es6/store.js +1 -1
  159. package/lib/es6/store.js.gz +0 -0
  160. package/lib/es6/tinybase.js +1 -1
  161. package/lib/es6/tinybase.js.gz +0 -0
  162. package/lib/es6/tools.js +1 -1
  163. package/lib/es6/tools.js.gz +0 -0
  164. package/lib/es6/ui-react-dom-debug.js +1 -1
  165. package/lib/es6/ui-react-dom-debug.js.gz +0 -0
  166. package/lib/es6/ui-react-dom.js +1 -1
  167. package/lib/es6/ui-react-dom.js.gz +0 -0
  168. package/lib/es6/ui-react.js +1 -1
  169. package/lib/es6/ui-react.js.gz +0 -0
  170. package/lib/indexes.js +1 -1
  171. package/lib/indexes.js.gz +0 -0
  172. package/lib/metrics.js +1 -1
  173. package/lib/metrics.js.gz +0 -0
  174. package/lib/persisters/persister-automerge.js +1 -1
  175. package/lib/persisters/persister-automerge.js.gz +0 -0
  176. package/lib/persisters/persister-browser.js +1 -1
  177. package/lib/persisters/persister-browser.js.gz +0 -0
  178. package/lib/persisters/persister-cr-sqlite-wasm.js +1 -1
  179. package/lib/persisters/persister-cr-sqlite-wasm.js.gz +0 -0
  180. package/lib/persisters/persister-expo-sqlite.js +1 -1
  181. package/lib/persisters/persister-expo-sqlite.js.gz +0 -0
  182. package/lib/persisters/persister-file.js +1 -1
  183. package/lib/persisters/persister-file.js.gz +0 -0
  184. package/lib/persisters/persister-indexed-db.js +1 -1
  185. package/lib/persisters/persister-indexed-db.js.gz +0 -0
  186. package/lib/persisters/persister-partykit-client.js +1 -1
  187. package/lib/persisters/persister-partykit-client.js.gz +0 -0
  188. package/lib/persisters/persister-partykit-server.js +1 -1
  189. package/lib/persisters/persister-partykit-server.js.gz +0 -0
  190. package/lib/persisters/persister-remote.js +1 -1
  191. package/lib/persisters/persister-remote.js.gz +0 -0
  192. package/lib/persisters/persister-sqlite-wasm.js +1 -1
  193. package/lib/persisters/persister-sqlite-wasm.js.gz +0 -0
  194. package/lib/persisters/persister-sqlite3.js +1 -1
  195. package/lib/persisters/persister-sqlite3.js.gz +0 -0
  196. package/lib/persisters/persister-yjs.js +1 -1
  197. package/lib/persisters/persister-yjs.js.gz +0 -0
  198. package/lib/persisters.js +1 -1
  199. package/lib/persisters.js.gz +0 -0
  200. package/lib/queries.js +1 -1
  201. package/lib/queries.js.gz +0 -0
  202. package/lib/relationships.js +1 -1
  203. package/lib/relationships.js.gz +0 -0
  204. package/lib/store.js +1 -1
  205. package/lib/store.js.gz +0 -0
  206. package/lib/tinybase.js +1 -1
  207. package/lib/tinybase.js.gz +0 -0
  208. package/lib/tools.js +1 -1
  209. package/lib/tools.js.gz +0 -0
  210. package/lib/types/persisters/persister-automerge.d.ts +36 -3
  211. package/lib/types/persisters/persister-browser.d.ts +71 -8
  212. package/lib/types/persisters/persister-cr-sqlite-wasm.d.ts +42 -8
  213. package/lib/types/persisters/persister-expo-sqlite.d.ts +40 -7
  214. package/lib/types/persisters/persister-file.d.ts +34 -3
  215. package/lib/types/persisters/persister-indexed-db.d.ts +40 -9
  216. package/lib/types/persisters/persister-partykit-client.d.ts +99 -13
  217. package/lib/types/persisters/persister-partykit-server.d.ts +414 -9
  218. package/lib/types/persisters/persister-remote.d.ts +40 -4
  219. package/lib/types/persisters/persister-sqlite-wasm.d.ts +46 -7
  220. package/lib/types/persisters/persister-sqlite3.d.ts +40 -7
  221. package/lib/types/persisters/persister-yjs.d.ts +37 -5
  222. package/lib/types/persisters.d.ts +10 -10
  223. package/lib/types/queries.d.ts +24 -0
  224. package/lib/types/store.d.ts +911 -31
  225. package/lib/types/tools.d.ts +4 -6
  226. package/lib/types/ui-react-dom.d.ts +13 -2
  227. package/lib/types/ui-react.d.ts +27 -6
  228. package/lib/types/with-schemas/persisters/persister-automerge.d.ts +38 -4
  229. package/lib/types/with-schemas/persisters/persister-browser.d.ts +75 -10
  230. package/lib/types/with-schemas/persisters/persister-cr-sqlite-wasm.d.ts +44 -9
  231. package/lib/types/with-schemas/persisters/persister-expo-sqlite.d.ts +42 -8
  232. package/lib/types/with-schemas/persisters/persister-file.d.ts +36 -4
  233. package/lib/types/with-schemas/persisters/persister-indexed-db.d.ts +42 -10
  234. package/lib/types/with-schemas/persisters/persister-partykit-client.d.ts +102 -15
  235. package/lib/types/with-schemas/persisters/persister-partykit-server.d.ts +447 -9
  236. package/lib/types/with-schemas/persisters/persister-remote.d.ts +42 -5
  237. package/lib/types/with-schemas/persisters/persister-sqlite-wasm.d.ts +48 -8
  238. package/lib/types/with-schemas/persisters/persister-sqlite3.d.ts +41 -7
  239. package/lib/types/with-schemas/persisters/persister-yjs.d.ts +39 -6
  240. package/lib/types/with-schemas/persisters.d.ts +10 -10
  241. package/lib/types/with-schemas/queries.d.ts +24 -0
  242. package/lib/types/with-schemas/store.d.ts +1179 -35
  243. package/lib/types/with-schemas/tools.d.ts +4 -6
  244. package/lib/types/with-schemas/ui-react-dom.d.ts +21 -4
  245. package/lib/types/with-schemas/ui-react.d.ts +29 -6
  246. package/lib/ui-react-dom.js +1 -1
  247. package/lib/ui-react-dom.js.gz +0 -0
  248. package/lib/ui-react.js +1 -1
  249. package/lib/ui-react.js.gz +0 -0
  250. package/lib/umd/checkpoints.js +1 -1
  251. package/lib/umd/checkpoints.js.gz +0 -0
  252. package/lib/umd/indexes.js +1 -1
  253. package/lib/umd/indexes.js.gz +0 -0
  254. package/lib/umd/metrics.js +1 -1
  255. package/lib/umd/metrics.js.gz +0 -0
  256. package/lib/umd/persisters/persister-automerge.js +1 -1
  257. package/lib/umd/persisters/persister-automerge.js.gz +0 -0
  258. package/lib/umd/persisters/persister-browser.js +1 -1
  259. package/lib/umd/persisters/persister-browser.js.gz +0 -0
  260. package/lib/umd/persisters/persister-cr-sqlite-wasm.js +1 -1
  261. package/lib/umd/persisters/persister-cr-sqlite-wasm.js.gz +0 -0
  262. package/lib/umd/persisters/persister-expo-sqlite.js +1 -1
  263. package/lib/umd/persisters/persister-expo-sqlite.js.gz +0 -0
  264. package/lib/umd/persisters/persister-file.js +1 -1
  265. package/lib/umd/persisters/persister-file.js.gz +0 -0
  266. package/lib/umd/persisters/persister-indexed-db.js +1 -1
  267. package/lib/umd/persisters/persister-indexed-db.js.gz +0 -0
  268. package/lib/umd/persisters/persister-partykit-client.js +1 -1
  269. package/lib/umd/persisters/persister-partykit-client.js.gz +0 -0
  270. package/lib/umd/persisters/persister-partykit-server.js +1 -1
  271. package/lib/umd/persisters/persister-partykit-server.js.gz +0 -0
  272. package/lib/umd/persisters/persister-remote.js +1 -1
  273. package/lib/umd/persisters/persister-remote.js.gz +0 -0
  274. package/lib/umd/persisters/persister-sqlite-wasm.js +1 -1
  275. package/lib/umd/persisters/persister-sqlite-wasm.js.gz +0 -0
  276. package/lib/umd/persisters/persister-sqlite3.js +1 -1
  277. package/lib/umd/persisters/persister-sqlite3.js.gz +0 -0
  278. package/lib/umd/persisters/persister-yjs.js +1 -1
  279. package/lib/umd/persisters/persister-yjs.js.gz +0 -0
  280. package/lib/umd/persisters.js +1 -1
  281. package/lib/umd/persisters.js.gz +0 -0
  282. package/lib/umd/queries.js +1 -1
  283. package/lib/umd/queries.js.gz +0 -0
  284. package/lib/umd/relationships.js +1 -1
  285. package/lib/umd/relationships.js.gz +0 -0
  286. package/lib/umd/store.js +1 -1
  287. package/lib/umd/store.js.gz +0 -0
  288. package/lib/umd/tinybase.js +1 -1
  289. package/lib/umd/tinybase.js.gz +0 -0
  290. package/lib/umd/tools.js +1 -1
  291. package/lib/umd/tools.js.gz +0 -0
  292. package/lib/umd/ui-react-dom-debug.js +1 -1
  293. package/lib/umd/ui-react-dom-debug.js.gz +0 -0
  294. package/lib/umd/ui-react-dom.js +1 -1
  295. package/lib/umd/ui-react-dom.js.gz +0 -0
  296. package/lib/umd/ui-react.js +1 -1
  297. package/lib/umd/ui-react.js.gz +0 -0
  298. package/lib/umd-es6/checkpoints.js +1 -1
  299. package/lib/umd-es6/checkpoints.js.gz +0 -0
  300. package/lib/umd-es6/indexes.js +1 -1
  301. package/lib/umd-es6/indexes.js.gz +0 -0
  302. package/lib/umd-es6/metrics.js +1 -1
  303. package/lib/umd-es6/metrics.js.gz +0 -0
  304. package/lib/umd-es6/persisters/persister-automerge.js +1 -1
  305. package/lib/umd-es6/persisters/persister-automerge.js.gz +0 -0
  306. package/lib/umd-es6/persisters/persister-browser.js +1 -1
  307. package/lib/umd-es6/persisters/persister-browser.js.gz +0 -0
  308. package/lib/umd-es6/persisters/persister-cr-sqlite-wasm.js +1 -1
  309. package/lib/umd-es6/persisters/persister-cr-sqlite-wasm.js.gz +0 -0
  310. package/lib/umd-es6/persisters/persister-expo-sqlite.js +1 -1
  311. package/lib/umd-es6/persisters/persister-expo-sqlite.js.gz +0 -0
  312. package/lib/umd-es6/persisters/persister-file.js +1 -1
  313. package/lib/umd-es6/persisters/persister-file.js.gz +0 -0
  314. package/lib/umd-es6/persisters/persister-indexed-db.js +1 -1
  315. package/lib/umd-es6/persisters/persister-indexed-db.js.gz +0 -0
  316. package/lib/umd-es6/persisters/persister-partykit-client.js +1 -1
  317. package/lib/umd-es6/persisters/persister-partykit-client.js.gz +0 -0
  318. package/lib/umd-es6/persisters/persister-partykit-server.js +1 -1
  319. package/lib/umd-es6/persisters/persister-partykit-server.js.gz +0 -0
  320. package/lib/umd-es6/persisters/persister-remote.js +1 -1
  321. package/lib/umd-es6/persisters/persister-remote.js.gz +0 -0
  322. package/lib/umd-es6/persisters/persister-sqlite-wasm.js +1 -1
  323. package/lib/umd-es6/persisters/persister-sqlite-wasm.js.gz +0 -0
  324. package/lib/umd-es6/persisters/persister-sqlite3.js +1 -1
  325. package/lib/umd-es6/persisters/persister-sqlite3.js.gz +0 -0
  326. package/lib/umd-es6/persisters/persister-yjs.js +1 -1
  327. package/lib/umd-es6/persisters/persister-yjs.js.gz +0 -0
  328. package/lib/umd-es6/persisters.js +1 -1
  329. package/lib/umd-es6/persisters.js.gz +0 -0
  330. package/lib/umd-es6/queries.js +1 -1
  331. package/lib/umd-es6/queries.js.gz +0 -0
  332. package/lib/umd-es6/relationships.js +1 -1
  333. package/lib/umd-es6/relationships.js.gz +0 -0
  334. package/lib/umd-es6/store.js +1 -1
  335. package/lib/umd-es6/store.js.gz +0 -0
  336. package/lib/umd-es6/tinybase.js +1 -1
  337. package/lib/umd-es6/tinybase.js.gz +0 -0
  338. package/lib/umd-es6/tools.js +1 -1
  339. package/lib/umd-es6/tools.js.gz +0 -0
  340. package/lib/umd-es6/ui-react-dom-debug.js +1 -1
  341. package/lib/umd-es6/ui-react-dom-debug.js.gz +0 -0
  342. package/lib/umd-es6/ui-react-dom.js +1 -1
  343. package/lib/umd-es6/ui-react-dom.js.gz +0 -0
  344. package/lib/umd-es6/ui-react.js +1 -1
  345. package/lib/umd-es6/ui-react.js.gz +0 -0
  346. package/package.json +42 -40
  347. package/readme.md +2 -2
@@ -23,6 +23,91 @@ import {OptionalSchemas, Store} from '../store';
23
23
  import PartySocket from 'partysocket';
24
24
  import {Persister} from '../persisters';
25
25
 
26
+ /**
27
+ * The PartyKitPersister interface is a minor extension to the Persister
28
+ * interface.
29
+ *
30
+ * It simply provides an extra getConnection method for accessing the
31
+ * PartySocket the Store is being persisted to.
32
+ * @since v4.3.14
33
+ */
34
+ export interface PartyKitPersister<Schemas extends OptionalSchemas>
35
+ extends Persister<Schemas> {
36
+ /**
37
+ * The getConnection method returns the PartySocket the Store is being
38
+ * persisted to.
39
+ * @returns The PartySocket.
40
+ * @example
41
+ * This example creates a Persister object against a newly-created Store and
42
+ * then gets the PartySocket back out again.
43
+ *
44
+ * ```js yolo
45
+ * const partySocket = new PartySocket({
46
+ * host: PARTYKIT_HOST,
47
+ * room: 'my_room',
48
+ * });
49
+ * const store = createStore().setTables({pets: {fido: {species: 'dog'}}});
50
+ * const persister = createPartyKitPersister(store, partySocket);
51
+ *
52
+ * console.log(persister.getConnection() == partySocket);
53
+ * // -> true
54
+ *
55
+ * persister.destroy();
56
+ * ```
57
+ * @category Getter
58
+ * @since v4.3.14
59
+ */
60
+ getConnection: () => PartySocket;
61
+ }
62
+
63
+ /**
64
+ * The PartyKitPersisterConfig type describes the configuration of a PartyKit
65
+ * Persister on the client side.
66
+ *
67
+ * The defaults (if used on both the server and client) will work fine, but if
68
+ * you are building more complex PartyKit apps and you need to configure path
69
+ * names, for example, then this is the thing to use.
70
+ * @example
71
+ * When applied to a PartyKit Persister, this PartyKitPersisterConfig will load
72
+ * and save a JSON serialization from and to an end point in your room called
73
+ * `/my_tinybase`, and use HTTP (rather than the default HTTPS) as the protocol.
74
+ *
75
+ * Note that this would require you to also add the matching storePath setting
76
+ * to the TinyBasePartyKitServerConfig on the server side.
77
+ *
78
+ * ```js
79
+ * const partyKitPersisterConfig = {
80
+ * storeProtocol: 'http',
81
+ * storePath: '/my_tinybase',
82
+ * };
83
+ * ```
84
+ * @category Configuration
85
+ * @since v4.3.9
86
+ */
87
+ export type PartyKitPersisterConfig = {
88
+ /**
89
+ * The HTTP protocol to use (in addition to the websocket channel). This
90
+ * defaults to 'https' but you may wish to use 'http' for local PartyKit
91
+ * development.
92
+ */
93
+ storeProtocol?: 'http' | 'https';
94
+ /**
95
+ * The path used to set and get the whole Store over HTTP(S) on the server.
96
+ * This must match the storePath property of the TinyBasePartyKitServerConfig
97
+ * object used on the server. Both default to '/store'.
98
+ */
99
+ storePath?: string;
100
+ /**
101
+ * The prefix at the beginning of the web socket messages sent between the
102
+ * client and the server when synchronizing the Store. Use this to make sure
103
+ * they do not collide with any other message syntax that your room is using.
104
+ * This must match the messagePrefix property of the
105
+ * TinyBasePartyKitServerConfig object used on the server. Both default to an
106
+ * empty string.
107
+ */
108
+ messagePrefix?: string;
109
+ };
110
+
26
111
  /**
27
112
  * The createPartyKitPersister function creates a Persister object that can
28
113
  * persist the Store to durable PartyKit storage, enabling synchronization of
@@ -34,9 +119,9 @@ import {Persister} from '../persisters';
34
119
  * createPartyKitPersister(
35
120
  * store: Store,
36
121
  * connection: PartySocket,
37
- * storeUrlProtocol?: 'http' | 'https',
122
+ * configOrStoreProtocol?: PartyKitPersisterConfig | 'http' | 'https',
38
123
  * onIgnoredError?: (error: any) => void,
39
- * ): Persister;
124
+ * ): PartyKitPersister;
40
125
  * ```
41
126
  *
42
127
  * As well as providing a reference to the Store to persist, you must provide a
@@ -63,24 +148,26 @@ import {Persister} from '../persisters';
63
148
  * @param store The Store to persist.
64
149
  * @param connection The PartySocket to use for participating in the PartyKit
65
150
  * room.
66
- * @param storeUrlProtocol The HTTP protocol to use (in addition to the
67
- * websocket channel). This defaults to 'https' but you may wish to use 'http'
68
- * for local PartyKit development.
151
+ * @param configOrStoreProtocol The PartyKitPersisterConfig configuration for
152
+ * the Persister, (or a string to specify a HTTP protocol to use, defaulting to
153
+ * 'https').
69
154
  * @param onIgnoredError An optional handler for the errors that the Persister
70
155
  * would otherwise ignore when trying to save or load data. This is suitable for
71
156
  * debugging persistence issues in a development environment.
72
- * @returns A reference to the new Persister object.
157
+ * @returns A reference to the new PartyKitPersister object.
73
158
  * @example
74
- * This example creates a Persister object and persists the Store to the
159
+ * This example creates a PartyKitPersister object and persists the Store to the
75
160
  * browser's IndexedDB storage.
76
161
  *
77
162
  * ```js yolo
78
- * const store =
79
- * createStore()
80
- * .setTable('pets', {fido: {species: 'dog'}})
81
- * .setTable('species', {dog: {price: 5}})
82
- * .setValues({open: true});
83
- * const partySocket = new PartySocket({host: PARTYKIT_HOST, room: 'my_room'});
163
+ * const store = createStore()
164
+ * .setTable('pets', {fido: {species: 'dog'}})
165
+ * .setTable('species', {dog: {price: 5}})
166
+ * .setValues({open: true});
167
+ * const partySocket = new PartySocket({
168
+ * host: PARTYKIT_HOST,
169
+ * room: 'my_room',
170
+ * });
84
171
  * const persister = createPartyKitPersister(store, partySocket);
85
172
  * await persister.startAutoLoad();
86
173
  * await persister.startAutoSave();
@@ -94,6 +181,6 @@ import {Persister} from '../persisters';
94
181
  export function createPartyKitPersister<Schemas extends OptionalSchemas>(
95
182
  store: Store<Schemas>,
96
183
  connection: PartySocket,
97
- storeUrlProtocol?: 'http' | 'https',
184
+ configOrStoreProtocol?: PartyKitPersisterConfig | 'http' | 'https',
98
185
  onIgnoredError?: (error: any) => void,
99
- ): Persister<Schemas>;
186
+ ): PartyKitPersister<Schemas>;
@@ -18,7 +18,83 @@
18
18
  * @since 4.3.0
19
19
  */
20
20
 
21
- import {Connection, Request, Server} from 'partykit/server';
21
+ import {
22
+ Cell,
23
+ CellOrUndefined,
24
+ NoTablesSchema,
25
+ NoValuesSchema,
26
+ Value,
27
+ ValueOrUndefined,
28
+ } from '../store';
29
+ import {Connection, Party, Request, Server} from 'partykit/server';
30
+ import {Id} from '../common';
31
+
32
+ /**
33
+ * The TinyBasePartyKitServerConfig type describes the configuration of a
34
+ * PartyKit Persister on the server side.
35
+ *
36
+ * The defaults (if used on both the server and client) will work fine, but if
37
+ * you are building more complex PartyKit apps and you need to configure path
38
+ * names, for example, then this is the type to use.
39
+ * @example
40
+ * When set as the config in a TinyBasePartyKitServer, this
41
+ * TinyBasePartyKitServerConfig will expect clients to load and save their JSON
42
+ * serialization from and to an end point in the room called `/my_tinybase`.
43
+ * Note that this would require you to also add the matching storePath setting
44
+ * to the PartyKitPersisterConfig on the client side.
45
+ *
46
+ * It will also store the data in the durable storage with a prefix of
47
+ * 'tinybase_' in case you are worried about colliding with other data stored
48
+ * in the room.
49
+ *
50
+ * ```js
51
+ * class MyServer extends TinyBasePartyKitServer {
52
+ * readonly config = {
53
+ * storePath: '/my_tinybase',
54
+ * storagePrefix: 'tinybase_',
55
+ * };
56
+ * }
57
+ * ```
58
+ * @category Configuration
59
+ * @since v4.3.9
60
+ */
61
+ export type TinyBasePartyKitServerConfig = {
62
+ /**
63
+ * The path used to set and get the whole Store over HTTP(S) on the server.
64
+ * This must match the storePath property of the PartyKitPersisterConfig used
65
+ * on the client. Both default to '/store'.
66
+ */
67
+ storePath?: string;
68
+ /**
69
+ * The prefix at the beginning of the web socket messages between the client
70
+ * and the server when synchronizing the Store. Use this to make sure they do
71
+ * not collide with any other message syntax that your room is using. This
72
+ * must match the messagePrefix property of the PartyKitPersisterConfig object
73
+ * used on the client. Both default to an empty string.
74
+ */
75
+ messagePrefix?: string;
76
+ /**
77
+ * The prefix used before all the keys in the server's durable storage. Use
78
+ * this in case you are worried about the Store data colliding with other data
79
+ * stored in the room. Defaults to an empty string.
80
+ */
81
+ storagePrefix?: string;
82
+ /**
83
+ * An object containing the extra HTTP(S) headers returned to the client from
84
+ * this server. This defaults to the following three headers to allow CORS:
85
+ *
86
+ * ```
87
+ * Access-Control-Allow-Origin: *
88
+ * Access-Control-Allow-Methods: *
89
+ * Access-Control-Allow-Headers: *
90
+ * ```
91
+ *
92
+ * If you set this field, it will override the default completely. So, for
93
+ * example, if you add another header but still want the CORS defaults, you
94
+ * will need to explicitly set the Access-Control-Allow headers above again.
95
+ */
96
+ responseHeaders?: HeadersInit;
97
+ };
22
98
 
23
99
  /**
24
100
  * A TinyBasePartyKitServer is the server component for persisting the Store to
@@ -39,7 +115,7 @@ import {Connection, Request, Server} from 'partykit/server';
39
115
  * ```js
40
116
  * // This is your PartyKit server entry point.
41
117
  *
42
- * export default class extends TinyBasePartyServer {
118
+ * class MyServer extends TinyBasePartyKitServer {
43
119
  * constructor(party) {
44
120
  * super(party);
45
121
  * // custom constructor code
@@ -50,8 +126,8 @@ import {Connection, Request, Server} from 'partykit/server';
50
126
  * console.log('Server started');
51
127
  * }
52
128
  *
53
- * async onMessage(message, client) {
54
- * await super.onMessage(message, client);
129
+ * async onMessage(message, connection) {
130
+ * await super.onMessage(message, connection);
55
131
  * // custom onMessage code
56
132
  * }
57
133
  *
@@ -65,8 +141,20 @@ import {Connection, Request, Server} from 'partykit/server';
65
141
  * See the [PartyKit server API
66
142
  * documentation](https://docs.partykit.io/reference/partyserver-api/) for
67
143
  * more details.
144
+ * @category Creation
145
+ * @since v4.3.0
68
146
  */
69
147
  export class TinyBasePartyKitServer implements Server {
148
+ constructor(party: Party);
149
+ /**
150
+ * The config property is used to optionally configure the server, using an
151
+ * object of the TinyBasePartyKitServerConfig type.
152
+ *
153
+ * See the documentation for that type for more details.
154
+ * @category Configuration
155
+ * @since v4.3.9
156
+ */
157
+ readonly config: TinyBasePartyKitServerConfig;
70
158
  /**
71
159
  * The onRequest method is called when a HTTP request is made to the party
72
160
  * URL.
@@ -76,7 +164,7 @@ export class TinyBasePartyKitServer implements Server {
76
164
  * synchronization stays supported:
77
165
  *
78
166
  * ```js
79
- * export default class extends TinyBasePartyServer {
167
+ * class MyServer extends TinyBasePartyKitServer {
80
168
  * async onRequest(request) {
81
169
  * // custom onRequest code, else:
82
170
  * return await super.onRequest(request);
@@ -87,6 +175,8 @@ export class TinyBasePartyKitServer implements Server {
87
175
  * See the [PartyKit server API
88
176
  * documentation](https://docs.partykit.io/reference/partyserver-api/) for
89
177
  * more details.
178
+ * @category Connection
179
+ * @since v4.3.0
90
180
  */
91
181
  onRequest(request: Request): Promise<Response>;
92
182
  /**
@@ -98,9 +188,9 @@ export class TinyBasePartyKitServer implements Server {
98
188
  * synchronization stays supported:
99
189
  *
100
190
  * ```js
101
- * export default class extends TinyBasePartyServer {
102
- * async onMessage(message, client) {
103
- * await super.onMessage(message, client);
191
+ * class MyServer extends TinyBasePartyKitServer {
192
+ * async onMessage(message, connection) {
193
+ * await super.onMessage(message, connection);
104
194
  * // custom onMessage code
105
195
  * }
106
196
  * }
@@ -109,6 +199,354 @@ export class TinyBasePartyKitServer implements Server {
109
199
  * See the [PartyKit server API
110
200
  * documentation](https://docs.partykit.io/reference/partyserver-api/) for
111
201
  * more details.
202
+ * @category Connection
203
+ * @since v4.3.0
204
+ */
205
+ onMessage(message: string, connection: Connection): Promise<void>;
206
+ /**
207
+ * The canSetTable method lets you allow or disallow any changes to a Table
208
+ * stored on the server, as sent from a client.
209
+ *
210
+ * This is one of the functions use to sanitize the data that is being sent
211
+ * from a client. Perhaps you might want to make sure the server-stored data
212
+ * adheres to a particular schema, or you might want to make certain data
213
+ * read-only. Remember that you cannot trust the client to only send data that
214
+ * the server considers valid or safe.
215
+ *
216
+ * This method is passed the Table Id that the client is trying to change. The
217
+ * `initialSave` parameter distinguishes between the first bulk save of the
218
+ * Store to the PartyKit room over HTTP (`true`), and subsequent incremental
219
+ * updates over a web sockets (`false`).
220
+ *
221
+ * The `requestOrConnection` parameter will either be the HTTP(S) request or
222
+ * the web socket connection, in those two cases respectively. You can, for
223
+ * instance, use this to distinguish between different users.
224
+ *
225
+ * Since v4.3.13, the final parameter is the Cell previously stored on the
226
+ * server, if any. Use this to distinguish between the addition of a new Cell
227
+ * (in which case it will be undefined) and the updating of an existing one.
228
+ *
229
+ * Return `false` from this method to disallow changes to this Table on the
230
+ * server, or `true` to allow them (subject to subsequent canSetRow method,
231
+ * canDelRow method, canSetCell method, and canSetCell method checks). The
232
+ * default implementation returns `true` to allow all changes.
233
+ * @example
234
+ * The following implementation will strip out any attempts by the client to
235
+ * update any 'user' tabular data after the initial save:
236
+ *
237
+ * ```js
238
+ * class MyServer extends TinyBasePartyKitServer {
239
+ * canSetTable(tableId, initialSave) {
240
+ * return initialSave || tableId != 'user';
241
+ * }
242
+ * }
243
+ * ```
244
+ * @category Sanitization
245
+ * @since v4.3.12
246
+ */
247
+ canSetTable(
248
+ tableId: Id,
249
+ initialSave: boolean,
250
+ requestOrConnection: Request | Connection,
251
+ ): boolean;
252
+ /**
253
+ * The canDelTable method lets you allow or disallow deletions of a Table
254
+ * stored on the server, as sent from a client.
255
+ *
256
+ * This is one of the functions use to sanitize the data that is being sent
257
+ * from a client. Perhaps you might want to make sure the server-stored data
258
+ * adheres to a particular schema, or you might want to make certain data
259
+ * read-only. Remember that you cannot trust the client to only send data that
260
+ * the server considers valid or safe.
261
+ *
262
+ * This method is passed the Table Id that the client is trying to delete. The
263
+ * `connection` parameter will be the web socket connection of that client.
264
+ * You can, for instance, use this to distinguish between different users.
265
+ *
266
+ * Return `false` from this method to disallow this Table from being deleted
267
+ * on the server, or `true` to allow it. The default implementation returns
268
+ * `true` to allow deletion.
269
+ * @example
270
+ * The following implementation will strip out any attempts by the client to
271
+ * delete the 'user' Table:
272
+ *
273
+ * ```js
274
+ * class MyServer extends TinyBasePartyKitServer {
275
+ * canDelTable(tableId) {
276
+ * return tableId != 'user';
277
+ * }
278
+ * }
279
+ * ```
280
+ * @category Sanitization
281
+ * @since v4.3.12
282
+ */
283
+ canDelTable(tableId: Id, connection: Connection): boolean;
284
+ /**
285
+ * The canSetRow method lets you allow or disallow any changes to a Row stored
286
+ * on the server, as sent from a client.
287
+ *
288
+ * This is one of the functions use to sanitize the data that is being sent
289
+ * from a client. Perhaps you might want to make sure the server-stored data
290
+ * adheres to a particular schema, or you might want to make certain data
291
+ * read-only. Remember that you cannot trust the client to only send data that
292
+ * the server considers valid or safe.
293
+ *
294
+ * This method is passed the Table Id and Row Id that the client is trying to
295
+ * change. The `initialSave` parameter distinguishes between the first bulk
296
+ * save of the Store to the PartyKit room over HTTP (`true`), and subsequent
297
+ * incremental updates over a web sockets (`false`).
298
+ *
299
+ * The final `requestOrConnection` parameter will either be the HTTP(S)
300
+ * request or the web socket connection, in those two cases respectively. You
301
+ * can, for instance, use this to distinguish between different users.
302
+ *
303
+ * Return `false` from this method to disallow changes to this Row on the
304
+ * server, or `true` to allow them (subject to subsequent canSetCell method
305
+ * and canSetCell method checks). The default implementation returns `true` to
306
+ * allow all changes.
307
+ * @example
308
+ * The following implementation will strip out any attempts by the client to
309
+ * update the 'me' Row of the 'user' Table after the initial save:
310
+ *
311
+ * ```js
312
+ * class MyServer extends TinyBasePartyKitServer {
313
+ * canSetRow(tableId, rowId, initialSave) {
314
+ * return initialSave || tableId != 'user' || rowId != 'me';
315
+ * }
316
+ * }
317
+ * ```
318
+ * @category Sanitization
319
+ * @since v4.3.12
320
+ */
321
+ canSetRow(
322
+ tableId: Id,
323
+ rowId: Id,
324
+ initialSave: boolean,
325
+ requestOrConnection: Request | Connection,
326
+ ): boolean;
327
+ /**
328
+ * The canDelRow method lets you allow or disallow deletions of a Row stored
329
+ * on the server, as sent from a client.
330
+ *
331
+ * This is one of the functions use to sanitize the data that is being sent
332
+ * from a client. Perhaps you might want to make sure the server-stored data
333
+ * adheres to a particular schema, or you might want to make certain data
334
+ * read-only. Remember that you cannot trust the client to only send data that
335
+ * the server considers valid or safe.
336
+ *
337
+ * This method is passed the Table Id and Row Id that the client is trying to
338
+ * delete. The `connection` parameter will be the web socket connection of
339
+ * that client. You can, for instance, use this to distinguish between
340
+ * different users.
341
+ *
342
+ * Return `false` from this method to disallow this Row from being deleted
343
+ * on the server, or `true` to allow it. The default implementation returns
344
+ * `true` to allow deletion.
345
+ * @example
346
+ * The following implementation will strip out any attempts by the client to
347
+ * delete the 'me' Row of the 'user' Table:
348
+ *
349
+ * ```js
350
+ * class MyServer extends TinyBasePartyKitServer {
351
+ * canDelRow(tableId, rowId) {
352
+ * return tableId != 'user' || rowId != 'me';
353
+ * }
354
+ * }
355
+ * ```
356
+ * @category Sanitization
357
+ * @since v4.3.12
358
+ */
359
+ canDelRow(tableId: Id, rowId: Id, connection: Connection): boolean;
360
+ /**
361
+ * The canSetCell method lets you allow or disallow any changes to a Cell
362
+ * stored on the server, as sent from a client.
363
+ *
364
+ * This has schema-based typing. The following is a simplified representation:
365
+ *
366
+ * ```ts override
367
+ * canSetCell(
368
+ * tableId: Id,
369
+ * rowId: Id,
370
+ * cellId: Id,
371
+ * cell: Cell,
372
+ * initialSave: boolean,
373
+ * requestOrConnection: Request | Connection,
374
+ * oldCell: CellOrUndefined,
375
+ * ): boolean;
376
+ * ```
377
+ *
378
+ * This is one of the functions use to sanitize the data that is being sent
379
+ * from a client. Perhaps you might want to make sure the server-stored data
380
+ * adheres to a particular schema, or you might want to make certain data
381
+ * read-only. Remember that you cannot trust the client to only send data that
382
+ * the server considers valid or safe.
383
+ *
384
+ * This method is passed the Table Id, Row Id, and Cell Id that the client is
385
+ * trying to change - as well as the Cell value itself. The `initialSave`
386
+ * parameter distinguishes between the first bulk save of the Store to the
387
+ * PartyKit room over HTTP (`true`), and subsequent incremental updates over a
388
+ * web sockets (`false`).
389
+ *
390
+ * The final `requestOrConnection` parameter will either be the HTTP(S)
391
+ * request or the web socket connection, in those two cases respectively. You
392
+ * can, for instance, use this to distinguish between different users.
393
+ *
394
+ * Return `false` from this method to disallow changes to this Cell on the
395
+ * server, or `true` to allow them. The default implementation returns `true`
396
+ * to allow all changes.
397
+ * @example
398
+ * The following implementation will strip out any attempts by the client to
399
+ * update the 'name' Cell of the 'me' Row of the 'user' Table after the
400
+ * initial save:
401
+ *
402
+ * ```js
403
+ * class MyServer extends TinyBasePartyKitServer {
404
+ * canSetCell(tableId, rowId, cellId, cell, initialSave) {
405
+ * return (
406
+ * initialSave || tableId != 'user' || rowId != 'me' || cellId != 'name'
407
+ * );
408
+ * }
409
+ * }
410
+ * ```
411
+ * @category Sanitization
412
+ * @since v4.3.12
413
+ */
414
+ canSetCell(
415
+ tableId: Id,
416
+ rowId: Id,
417
+ cellId: Id,
418
+ cell: Cell<NoTablesSchema, Id, Id>,
419
+ initialSave: boolean,
420
+ requestOrConnection: Request | Connection,
421
+ oldCell: CellOrUndefined<NoTablesSchema, Id, Id>,
422
+ ): boolean;
423
+ /**
424
+ * The canDelCell method lets you allow or disallow deletions of a Cell stored
425
+ * on the server, as sent from a client.
426
+ *
427
+ * This is one of the functions use to sanitize the data that is being sent
428
+ * from a client. Perhaps you might want to make sure the server-stored data
429
+ * adheres to a particular schema, or you might want to make certain data
430
+ * read-only. Remember that you cannot trust the client to only send data that
431
+ * the server considers valid or safe.
432
+ *
433
+ * This method is passed the Table Id, Row Id, and Cell Id that the client is
434
+ * trying to delete. The `connection` parameter will be the web socket
435
+ * connection of that client. You can, for instance, use this to distinguish
436
+ * between different users.
437
+ *
438
+ * Return `false` from this method to disallow this Cell from being deleted on
439
+ * the server, or `true` to allow it. The default implementation returns
440
+ * `true` to allow deletion.
441
+ * @example
442
+ * The following implementation will strip out any attempts by the client to
443
+ * delete the 'name' Cell of the 'me' Row of the 'user' Table:
444
+ *
445
+ * ```js
446
+ * class MyServer extends TinyBasePartyKitServer {
447
+ * canDelCell(tableId, rowId, cellId) {
448
+ * return tableId != 'user' || rowId != 'me' || cellId != 'name';
449
+ * }
450
+ * }
451
+ * ```
452
+ * @category Sanitization
453
+ * @since v4.3.12
454
+ */
455
+ canDelCell(
456
+ tableId: Id,
457
+ rowId: Id,
458
+ cellId: Id,
459
+ connection: Connection,
460
+ ): boolean;
461
+ /**
462
+ * The canSetValue method lets you allow or disallow any changes to a Value
463
+ * stored on the server, as sent from a client.
464
+ *
465
+ * This has schema-based typing. The following is a simplified representation:
466
+ *
467
+ * ```ts override
468
+ * canSetValue(
469
+ * valueId: Id,
470
+ * value: Value,
471
+ * initialSave: boolean,
472
+ * requestOrConnection: Request | Connection,
473
+ * oldValue: ValueOrUndefined,
474
+ * ): boolean;
475
+ * ```
476
+ *
477
+ * This is one of the functions use to sanitize the data that is being sent
478
+ * from a client. Perhaps you might want to make sure the server-stored data
479
+ * adheres to a particular schema, or you might want to make certain data
480
+ * read-only. Remember that you cannot trust the client to only send data that
481
+ * the server considers valid or safe.
482
+ *
483
+ * This method is passed the Value Id that the client is trying to change - as
484
+ * well as the Value itself. The `initialSave` parameter distinguishes between
485
+ * the first bulk save of the Store to the PartyKit room over HTTP (`true`),
486
+ * and subsequent incremental updates over a web sockets (`false`).
487
+ *
488
+ * The `requestOrConnection` parameter will either be the HTTP(S) request or
489
+ * the web socket connection, in those two cases respectively. You can, for
490
+ * instance, use this to distinguish between different users.
491
+ *
492
+ * Since v4.3.13, the final parameter is the Value previously stored on the
493
+ * server, if any. Use this to distinguish between the addition of a new Value
494
+ * (in which case it will be undefined) and the updating of an existing one.
495
+ *
496
+ * Return `false` from this method to disallow changes to this Value on the
497
+ * server, or `true` to allow them. The default implementation returns `true`
498
+ * to allow all changes.
499
+ * @example
500
+ * The following implementation will strip out any attempts by the client to
501
+ * update the 'userId' Value after the initial save:
502
+ *
503
+ * ```js
504
+ * class MyServer extends TinyBasePartyKitServer {
505
+ * canSetValue(valueId, value, initialSave) {
506
+ * return initialSave || userId != 'userId';
507
+ * }
508
+ * }
509
+ * ```
510
+ * @category Sanitization
511
+ * @since v4.3.12
512
+ */
513
+ canSetValue(
514
+ valueId: Id,
515
+ value: Value<NoValuesSchema, Id>,
516
+ initialSave: boolean,
517
+ requestOrConnection: Request | Connection,
518
+ oldValue: ValueOrUndefined<NoValuesSchema, Id>,
519
+ ): boolean;
520
+ /**
521
+ * The canDelValue method lets you allow or disallow deletions of a Value
522
+ * stored on the server, as sent from a client.
523
+ *
524
+ * This is one of the functions use to sanitize the data that is being sent
525
+ * from a client. Perhaps you might want to make sure the server-stored data
526
+ * adheres to a particular schema, or you might want to make certain data
527
+ * read-only. Remember that you cannot trust the client to only send data that
528
+ * the server considers valid or safe.
529
+ *
530
+ * This method is passed the Value Id that the client is trying to delete. The
531
+ * `connection` parameter will be the web socket connection of that client.
532
+ * You can, for instance, use this to distinguish between different users.
533
+ *
534
+ * Return `false` from this method to disallow this Value from being deleted
535
+ * on the server, or `true` to allow it. The default implementation returns
536
+ * `true` to allow deletion.
537
+ * @example
538
+ * The following implementation will strip out any attempts by the client to
539
+ * delete the 'userId' Value:
540
+ *
541
+ * ```js
542
+ * class MyServer extends TinyBasePartyKitServer {
543
+ * canDelValue(valueId) {
544
+ * return valueId != 'userId';
545
+ * }
546
+ * }
547
+ * ```
548
+ * @category Sanitization
549
+ * @since v4.3.12
112
550
  */
113
- onMessage(message: string, client: Connection): void;
551
+ canDelValue(valueId: Id, connection: Connection): boolean;
114
552
  }