tinybase 5.1.0 → 5.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.
Files changed (387) hide show
  1. package/@types/persisters/persister-powersync/index.d.cts +4 -4
  2. package/@types/persisters/persister-powersync/index.d.ts +4 -4
  3. package/@types/persisters/persister-powersync/with-schemas/index.d.cts +4 -4
  4. package/@types/persisters/persister-powersync/with-schemas/index.d.ts +4 -4
  5. package/@types/synchronizers/synchronizer-ws-client/index.d.cts +6 -0
  6. package/@types/synchronizers/synchronizer-ws-client/index.d.ts +6 -0
  7. package/@types/synchronizers/synchronizer-ws-client/with-schemas/index.d.cts +6 -0
  8. package/@types/synchronizers/synchronizer-ws-client/with-schemas/index.d.ts +6 -0
  9. package/@types/synchronizers/synchronizer-ws-server/index.d.cts +66 -4
  10. package/@types/synchronizers/synchronizer-ws-server/index.d.ts +66 -4
  11. package/@types/synchronizers/synchronizer-ws-server/with-schemas/index.d.cts +72 -5
  12. package/@types/synchronizers/synchronizer-ws-server/with-schemas/index.d.ts +72 -5
  13. package/cjs/es6/min/checkpoints/index.cjs +1 -1
  14. package/cjs/es6/min/checkpoints/index.cjs.gz +0 -0
  15. package/cjs/es6/min/checkpoints/with-schemas/index.cjs +1 -1
  16. package/cjs/es6/min/checkpoints/with-schemas/index.cjs.gz +0 -0
  17. package/cjs/es6/min/index.cjs +1 -1
  18. package/cjs/es6/min/index.cjs.gz +0 -0
  19. package/cjs/es6/min/indexes/index.cjs +1 -1
  20. package/cjs/es6/min/indexes/index.cjs.gz +0 -0
  21. package/cjs/es6/min/indexes/with-schemas/index.cjs +1 -1
  22. package/cjs/es6/min/indexes/with-schemas/index.cjs.gz +0 -0
  23. package/cjs/es6/min/mergeable-store/index.cjs +1 -1
  24. package/cjs/es6/min/mergeable-store/index.cjs.gz +0 -0
  25. package/cjs/es6/min/mergeable-store/with-schemas/index.cjs +1 -1
  26. package/cjs/es6/min/mergeable-store/with-schemas/index.cjs.gz +0 -0
  27. package/cjs/es6/min/metrics/index.cjs +1 -1
  28. package/cjs/es6/min/metrics/index.cjs.gz +0 -0
  29. package/cjs/es6/min/metrics/with-schemas/index.cjs +1 -1
  30. package/cjs/es6/min/metrics/with-schemas/index.cjs.gz +0 -0
  31. package/cjs/es6/min/persisters/persister-automerge/index.cjs +1 -1
  32. package/cjs/es6/min/persisters/persister-automerge/index.cjs.gz +0 -0
  33. package/cjs/es6/min/persisters/persister-automerge/with-schemas/index.cjs +1 -1
  34. package/cjs/es6/min/persisters/persister-automerge/with-schemas/index.cjs.gz +0 -0
  35. package/cjs/es6/min/persisters/persister-indexed-db/index.cjs +1 -1
  36. package/cjs/es6/min/persisters/persister-indexed-db/index.cjs.gz +0 -0
  37. package/cjs/es6/min/persisters/persister-indexed-db/with-schemas/index.cjs +1 -1
  38. package/cjs/es6/min/persisters/persister-indexed-db/with-schemas/index.cjs.gz +0 -0
  39. package/cjs/es6/min/persisters/persister-partykit-client/index.cjs +1 -1
  40. package/cjs/es6/min/persisters/persister-partykit-client/index.cjs.gz +0 -0
  41. package/cjs/es6/min/persisters/persister-partykit-client/with-schemas/index.cjs +1 -1
  42. package/cjs/es6/min/persisters/persister-partykit-client/with-schemas/index.cjs.gz +0 -0
  43. package/cjs/es6/min/persisters/persister-yjs/index.cjs +1 -1
  44. package/cjs/es6/min/persisters/persister-yjs/index.cjs.gz +0 -0
  45. package/cjs/es6/min/persisters/persister-yjs/with-schemas/index.cjs +1 -1
  46. package/cjs/es6/min/persisters/persister-yjs/with-schemas/index.cjs.gz +0 -0
  47. package/cjs/es6/min/queries/index.cjs +1 -1
  48. package/cjs/es6/min/queries/index.cjs.gz +0 -0
  49. package/cjs/es6/min/queries/with-schemas/index.cjs +1 -1
  50. package/cjs/es6/min/queries/with-schemas/index.cjs.gz +0 -0
  51. package/cjs/es6/min/relationships/index.cjs +1 -1
  52. package/cjs/es6/min/relationships/index.cjs.gz +0 -0
  53. package/cjs/es6/min/relationships/with-schemas/index.cjs +1 -1
  54. package/cjs/es6/min/relationships/with-schemas/index.cjs.gz +0 -0
  55. package/cjs/es6/min/store/index.cjs +1 -1
  56. package/cjs/es6/min/store/index.cjs.gz +0 -0
  57. package/cjs/es6/min/store/with-schemas/index.cjs +1 -1
  58. package/cjs/es6/min/store/with-schemas/index.cjs.gz +0 -0
  59. package/cjs/es6/min/synchronizers/synchronizer-ws-client/index.cjs +1 -1
  60. package/cjs/es6/min/synchronizers/synchronizer-ws-client/index.cjs.gz +0 -0
  61. package/cjs/es6/min/synchronizers/synchronizer-ws-client/with-schemas/index.cjs +1 -1
  62. package/cjs/es6/min/synchronizers/synchronizer-ws-client/with-schemas/index.cjs.gz +0 -0
  63. package/cjs/es6/min/synchronizers/synchronizer-ws-server/index.cjs +1 -1
  64. package/cjs/es6/min/synchronizers/synchronizer-ws-server/index.cjs.gz +0 -0
  65. package/cjs/es6/min/synchronizers/synchronizer-ws-server/with-schemas/index.cjs +1 -1
  66. package/cjs/es6/min/synchronizers/synchronizer-ws-server/with-schemas/index.cjs.gz +0 -0
  67. package/cjs/es6/min/ui-react-inspector/index.cjs +1 -1
  68. package/cjs/es6/min/ui-react-inspector/index.cjs.gz +0 -0
  69. package/cjs/es6/min/ui-react-inspector/with-schemas/index.cjs +1 -1
  70. package/cjs/es6/min/ui-react-inspector/with-schemas/index.cjs.gz +0 -0
  71. package/cjs/es6/min/with-schemas/index.cjs +1 -1
  72. package/cjs/es6/min/with-schemas/index.cjs.gz +0 -0
  73. package/cjs/es6/synchronizers/synchronizer-ws-server/index.cjs +11 -4
  74. package/cjs/es6/synchronizers/synchronizer-ws-server/with-schemas/index.cjs +11 -4
  75. package/cjs/min/checkpoints/index.cjs +1 -1
  76. package/cjs/min/checkpoints/index.cjs.gz +0 -0
  77. package/cjs/min/checkpoints/with-schemas/index.cjs +1 -1
  78. package/cjs/min/checkpoints/with-schemas/index.cjs.gz +0 -0
  79. package/cjs/min/index.cjs +1 -1
  80. package/cjs/min/index.cjs.gz +0 -0
  81. package/cjs/min/indexes/index.cjs +1 -1
  82. package/cjs/min/indexes/index.cjs.gz +0 -0
  83. package/cjs/min/indexes/with-schemas/index.cjs +1 -1
  84. package/cjs/min/indexes/with-schemas/index.cjs.gz +0 -0
  85. package/cjs/min/mergeable-store/index.cjs +1 -1
  86. package/cjs/min/mergeable-store/index.cjs.gz +0 -0
  87. package/cjs/min/mergeable-store/with-schemas/index.cjs +1 -1
  88. package/cjs/min/mergeable-store/with-schemas/index.cjs.gz +0 -0
  89. package/cjs/min/metrics/index.cjs +1 -1
  90. package/cjs/min/metrics/index.cjs.gz +0 -0
  91. package/cjs/min/metrics/with-schemas/index.cjs +1 -1
  92. package/cjs/min/metrics/with-schemas/index.cjs.gz +0 -0
  93. package/cjs/min/persisters/persister-automerge/index.cjs +1 -1
  94. package/cjs/min/persisters/persister-automerge/index.cjs.gz +0 -0
  95. package/cjs/min/persisters/persister-automerge/with-schemas/index.cjs +1 -1
  96. package/cjs/min/persisters/persister-automerge/with-schemas/index.cjs.gz +0 -0
  97. package/cjs/min/persisters/persister-indexed-db/index.cjs +1 -1
  98. package/cjs/min/persisters/persister-indexed-db/index.cjs.gz +0 -0
  99. package/cjs/min/persisters/persister-indexed-db/with-schemas/index.cjs +1 -1
  100. package/cjs/min/persisters/persister-indexed-db/with-schemas/index.cjs.gz +0 -0
  101. package/cjs/min/persisters/persister-partykit-client/index.cjs +1 -1
  102. package/cjs/min/persisters/persister-partykit-client/index.cjs.gz +0 -0
  103. package/cjs/min/persisters/persister-partykit-client/with-schemas/index.cjs +1 -1
  104. package/cjs/min/persisters/persister-partykit-client/with-schemas/index.cjs.gz +0 -0
  105. package/cjs/min/persisters/persister-yjs/index.cjs +1 -1
  106. package/cjs/min/persisters/persister-yjs/index.cjs.gz +0 -0
  107. package/cjs/min/persisters/persister-yjs/with-schemas/index.cjs +1 -1
  108. package/cjs/min/persisters/persister-yjs/with-schemas/index.cjs.gz +0 -0
  109. package/cjs/min/queries/index.cjs +1 -1
  110. package/cjs/min/queries/index.cjs.gz +0 -0
  111. package/cjs/min/queries/with-schemas/index.cjs +1 -1
  112. package/cjs/min/queries/with-schemas/index.cjs.gz +0 -0
  113. package/cjs/min/relationships/index.cjs +1 -1
  114. package/cjs/min/relationships/index.cjs.gz +0 -0
  115. package/cjs/min/relationships/with-schemas/index.cjs +1 -1
  116. package/cjs/min/relationships/with-schemas/index.cjs.gz +0 -0
  117. package/cjs/min/store/index.cjs +1 -1
  118. package/cjs/min/store/index.cjs.gz +0 -0
  119. package/cjs/min/store/with-schemas/index.cjs +1 -1
  120. package/cjs/min/store/with-schemas/index.cjs.gz +0 -0
  121. package/cjs/min/synchronizers/synchronizer-ws-client/index.cjs +1 -1
  122. package/cjs/min/synchronizers/synchronizer-ws-client/index.cjs.gz +0 -0
  123. package/cjs/min/synchronizers/synchronizer-ws-client/with-schemas/index.cjs +1 -1
  124. package/cjs/min/synchronizers/synchronizer-ws-client/with-schemas/index.cjs.gz +0 -0
  125. package/cjs/min/synchronizers/synchronizer-ws-server/index.cjs +1 -1
  126. package/cjs/min/synchronizers/synchronizer-ws-server/index.cjs.gz +0 -0
  127. package/cjs/min/synchronizers/synchronizer-ws-server/with-schemas/index.cjs +1 -1
  128. package/cjs/min/synchronizers/synchronizer-ws-server/with-schemas/index.cjs.gz +0 -0
  129. package/cjs/min/ui-react-inspector/index.cjs +1 -1
  130. package/cjs/min/ui-react-inspector/index.cjs.gz +0 -0
  131. package/cjs/min/ui-react-inspector/with-schemas/index.cjs +1 -1
  132. package/cjs/min/ui-react-inspector/with-schemas/index.cjs.gz +0 -0
  133. package/cjs/min/with-schemas/index.cjs +1 -1
  134. package/cjs/min/with-schemas/index.cjs.gz +0 -0
  135. package/cjs/synchronizers/synchronizer-ws-server/index.cjs +11 -4
  136. package/cjs/synchronizers/synchronizer-ws-server/with-schemas/index.cjs +11 -4
  137. package/es6/min/checkpoints/index.js +1 -1
  138. package/es6/min/checkpoints/index.js.gz +0 -0
  139. package/es6/min/checkpoints/with-schemas/index.js +1 -1
  140. package/es6/min/checkpoints/with-schemas/index.js.gz +0 -0
  141. package/es6/min/index.js +1 -1
  142. package/es6/min/index.js.gz +0 -0
  143. package/es6/min/indexes/index.js +1 -1
  144. package/es6/min/indexes/index.js.gz +0 -0
  145. package/es6/min/indexes/with-schemas/index.js +1 -1
  146. package/es6/min/indexes/with-schemas/index.js.gz +0 -0
  147. package/es6/min/mergeable-store/index.js +1 -1
  148. package/es6/min/mergeable-store/index.js.gz +0 -0
  149. package/es6/min/mergeable-store/with-schemas/index.js +1 -1
  150. package/es6/min/mergeable-store/with-schemas/index.js.gz +0 -0
  151. package/es6/min/metrics/index.js +1 -1
  152. package/es6/min/metrics/index.js.gz +0 -0
  153. package/es6/min/metrics/with-schemas/index.js +1 -1
  154. package/es6/min/metrics/with-schemas/index.js.gz +0 -0
  155. package/es6/min/persisters/persister-automerge/index.js +1 -1
  156. package/es6/min/persisters/persister-automerge/index.js.gz +0 -0
  157. package/es6/min/persisters/persister-automerge/with-schemas/index.js +1 -1
  158. package/es6/min/persisters/persister-automerge/with-schemas/index.js.gz +0 -0
  159. package/es6/min/persisters/persister-indexed-db/index.js +1 -1
  160. package/es6/min/persisters/persister-indexed-db/index.js.gz +0 -0
  161. package/es6/min/persisters/persister-indexed-db/with-schemas/index.js +1 -1
  162. package/es6/min/persisters/persister-indexed-db/with-schemas/index.js.gz +0 -0
  163. package/es6/min/persisters/persister-partykit-client/index.js +1 -1
  164. package/es6/min/persisters/persister-partykit-client/index.js.gz +0 -0
  165. package/es6/min/persisters/persister-partykit-client/with-schemas/index.js +1 -1
  166. package/es6/min/persisters/persister-partykit-client/with-schemas/index.js.gz +0 -0
  167. package/es6/min/persisters/persister-yjs/index.js +1 -1
  168. package/es6/min/persisters/persister-yjs/index.js.gz +0 -0
  169. package/es6/min/persisters/persister-yjs/with-schemas/index.js +1 -1
  170. package/es6/min/persisters/persister-yjs/with-schemas/index.js.gz +0 -0
  171. package/es6/min/queries/index.js +1 -1
  172. package/es6/min/queries/index.js.gz +0 -0
  173. package/es6/min/queries/with-schemas/index.js +1 -1
  174. package/es6/min/queries/with-schemas/index.js.gz +0 -0
  175. package/es6/min/relationships/index.js +1 -1
  176. package/es6/min/relationships/index.js.gz +0 -0
  177. package/es6/min/relationships/with-schemas/index.js +1 -1
  178. package/es6/min/relationships/with-schemas/index.js.gz +0 -0
  179. package/es6/min/store/index.js +1 -1
  180. package/es6/min/store/index.js.gz +0 -0
  181. package/es6/min/store/with-schemas/index.js +1 -1
  182. package/es6/min/store/with-schemas/index.js.gz +0 -0
  183. package/es6/min/synchronizers/synchronizer-ws-client/index.js +1 -1
  184. package/es6/min/synchronizers/synchronizer-ws-client/index.js.gz +0 -0
  185. package/es6/min/synchronizers/synchronizer-ws-client/with-schemas/index.js +1 -1
  186. package/es6/min/synchronizers/synchronizer-ws-client/with-schemas/index.js.gz +0 -0
  187. package/es6/min/synchronizers/synchronizer-ws-server/index.js +1 -1
  188. package/es6/min/synchronizers/synchronizer-ws-server/index.js.gz +0 -0
  189. package/es6/min/synchronizers/synchronizer-ws-server/with-schemas/index.js +1 -1
  190. package/es6/min/synchronizers/synchronizer-ws-server/with-schemas/index.js.gz +0 -0
  191. package/es6/min/ui-react-inspector/index.js +1 -1
  192. package/es6/min/ui-react-inspector/index.js.gz +0 -0
  193. package/es6/min/ui-react-inspector/with-schemas/index.js +1 -1
  194. package/es6/min/ui-react-inspector/with-schemas/index.js.gz +0 -0
  195. package/es6/min/with-schemas/index.js +1 -1
  196. package/es6/min/with-schemas/index.js.gz +0 -0
  197. package/es6/synchronizers/synchronizer-ws-server/index.js +11 -4
  198. package/es6/synchronizers/synchronizer-ws-server/with-schemas/index.js +11 -4
  199. package/min/checkpoints/index.js +1 -1
  200. package/min/checkpoints/index.js.gz +0 -0
  201. package/min/checkpoints/with-schemas/index.js +1 -1
  202. package/min/checkpoints/with-schemas/index.js.gz +0 -0
  203. package/min/index.js +1 -1
  204. package/min/index.js.gz +0 -0
  205. package/min/indexes/index.js +1 -1
  206. package/min/indexes/index.js.gz +0 -0
  207. package/min/indexes/with-schemas/index.js +1 -1
  208. package/min/indexes/with-schemas/index.js.gz +0 -0
  209. package/min/mergeable-store/index.js +1 -1
  210. package/min/mergeable-store/index.js.gz +0 -0
  211. package/min/mergeable-store/with-schemas/index.js +1 -1
  212. package/min/mergeable-store/with-schemas/index.js.gz +0 -0
  213. package/min/metrics/index.js +1 -1
  214. package/min/metrics/index.js.gz +0 -0
  215. package/min/metrics/with-schemas/index.js +1 -1
  216. package/min/metrics/with-schemas/index.js.gz +0 -0
  217. package/min/persisters/persister-automerge/index.js +1 -1
  218. package/min/persisters/persister-automerge/index.js.gz +0 -0
  219. package/min/persisters/persister-automerge/with-schemas/index.js +1 -1
  220. package/min/persisters/persister-automerge/with-schemas/index.js.gz +0 -0
  221. package/min/persisters/persister-indexed-db/index.js +1 -1
  222. package/min/persisters/persister-indexed-db/index.js.gz +0 -0
  223. package/min/persisters/persister-indexed-db/with-schemas/index.js +1 -1
  224. package/min/persisters/persister-indexed-db/with-schemas/index.js.gz +0 -0
  225. package/min/persisters/persister-partykit-client/index.js +1 -1
  226. package/min/persisters/persister-partykit-client/index.js.gz +0 -0
  227. package/min/persisters/persister-partykit-client/with-schemas/index.js +1 -1
  228. package/min/persisters/persister-partykit-client/with-schemas/index.js.gz +0 -0
  229. package/min/persisters/persister-yjs/index.js +1 -1
  230. package/min/persisters/persister-yjs/index.js.gz +0 -0
  231. package/min/persisters/persister-yjs/with-schemas/index.js +1 -1
  232. package/min/persisters/persister-yjs/with-schemas/index.js.gz +0 -0
  233. package/min/queries/index.js +1 -1
  234. package/min/queries/index.js.gz +0 -0
  235. package/min/queries/with-schemas/index.js +1 -1
  236. package/min/queries/with-schemas/index.js.gz +0 -0
  237. package/min/relationships/index.js +1 -1
  238. package/min/relationships/index.js.gz +0 -0
  239. package/min/relationships/with-schemas/index.js +1 -1
  240. package/min/relationships/with-schemas/index.js.gz +0 -0
  241. package/min/store/index.js +1 -1
  242. package/min/store/index.js.gz +0 -0
  243. package/min/store/with-schemas/index.js +1 -1
  244. package/min/store/with-schemas/index.js.gz +0 -0
  245. package/min/synchronizers/synchronizer-ws-client/index.js +1 -1
  246. package/min/synchronizers/synchronizer-ws-client/index.js.gz +0 -0
  247. package/min/synchronizers/synchronizer-ws-client/with-schemas/index.js +1 -1
  248. package/min/synchronizers/synchronizer-ws-client/with-schemas/index.js.gz +0 -0
  249. package/min/synchronizers/synchronizer-ws-server/index.js +1 -1
  250. package/min/synchronizers/synchronizer-ws-server/index.js.gz +0 -0
  251. package/min/synchronizers/synchronizer-ws-server/with-schemas/index.js +1 -1
  252. package/min/synchronizers/synchronizer-ws-server/with-schemas/index.js.gz +0 -0
  253. package/min/ui-react-inspector/index.js +1 -1
  254. package/min/ui-react-inspector/index.js.gz +0 -0
  255. package/min/ui-react-inspector/with-schemas/index.js +1 -1
  256. package/min/ui-react-inspector/with-schemas/index.js.gz +0 -0
  257. package/min/with-schemas/index.js +1 -1
  258. package/min/with-schemas/index.js.gz +0 -0
  259. package/package.json +7 -7
  260. package/readme.md +2 -2
  261. package/releases.md +7 -1
  262. package/synchronizers/synchronizer-ws-server/index.js +11 -4
  263. package/synchronizers/synchronizer-ws-server/with-schemas/index.js +11 -4
  264. package/umd/es6/min/checkpoints/index.js +1 -1
  265. package/umd/es6/min/checkpoints/index.js.gz +0 -0
  266. package/umd/es6/min/checkpoints/with-schemas/index.js +1 -1
  267. package/umd/es6/min/checkpoints/with-schemas/index.js.gz +0 -0
  268. package/umd/es6/min/index.js +1 -1
  269. package/umd/es6/min/index.js.gz +0 -0
  270. package/umd/es6/min/indexes/index.js +1 -1
  271. package/umd/es6/min/indexes/index.js.gz +0 -0
  272. package/umd/es6/min/indexes/with-schemas/index.js +1 -1
  273. package/umd/es6/min/indexes/with-schemas/index.js.gz +0 -0
  274. package/umd/es6/min/mergeable-store/index.js +1 -1
  275. package/umd/es6/min/mergeable-store/index.js.gz +0 -0
  276. package/umd/es6/min/mergeable-store/with-schemas/index.js +1 -1
  277. package/umd/es6/min/mergeable-store/with-schemas/index.js.gz +0 -0
  278. package/umd/es6/min/metrics/index.js +1 -1
  279. package/umd/es6/min/metrics/index.js.gz +0 -0
  280. package/umd/es6/min/metrics/with-schemas/index.js +1 -1
  281. package/umd/es6/min/metrics/with-schemas/index.js.gz +0 -0
  282. package/umd/es6/min/persisters/persister-automerge/index.js +1 -1
  283. package/umd/es6/min/persisters/persister-automerge/index.js.gz +0 -0
  284. package/umd/es6/min/persisters/persister-automerge/with-schemas/index.js +1 -1
  285. package/umd/es6/min/persisters/persister-automerge/with-schemas/index.js.gz +0 -0
  286. package/umd/es6/min/persisters/persister-indexed-db/index.js +1 -1
  287. package/umd/es6/min/persisters/persister-indexed-db/index.js.gz +0 -0
  288. package/umd/es6/min/persisters/persister-indexed-db/with-schemas/index.js +1 -1
  289. package/umd/es6/min/persisters/persister-indexed-db/with-schemas/index.js.gz +0 -0
  290. package/umd/es6/min/persisters/persister-partykit-client/index.js +1 -1
  291. package/umd/es6/min/persisters/persister-partykit-client/index.js.gz +0 -0
  292. package/umd/es6/min/persisters/persister-partykit-client/with-schemas/index.js +1 -1
  293. package/umd/es6/min/persisters/persister-partykit-client/with-schemas/index.js.gz +0 -0
  294. package/umd/es6/min/persisters/persister-yjs/index.js +1 -1
  295. package/umd/es6/min/persisters/persister-yjs/index.js.gz +0 -0
  296. package/umd/es6/min/persisters/persister-yjs/with-schemas/index.js +1 -1
  297. package/umd/es6/min/persisters/persister-yjs/with-schemas/index.js.gz +0 -0
  298. package/umd/es6/min/queries/index.js +1 -1
  299. package/umd/es6/min/queries/index.js.gz +0 -0
  300. package/umd/es6/min/queries/with-schemas/index.js +1 -1
  301. package/umd/es6/min/queries/with-schemas/index.js.gz +0 -0
  302. package/umd/es6/min/relationships/index.js +1 -1
  303. package/umd/es6/min/relationships/index.js.gz +0 -0
  304. package/umd/es6/min/relationships/with-schemas/index.js +1 -1
  305. package/umd/es6/min/relationships/with-schemas/index.js.gz +0 -0
  306. package/umd/es6/min/store/index.js +1 -1
  307. package/umd/es6/min/store/index.js.gz +0 -0
  308. package/umd/es6/min/store/with-schemas/index.js +1 -1
  309. package/umd/es6/min/store/with-schemas/index.js.gz +0 -0
  310. package/umd/es6/min/synchronizers/synchronizer-ws-client/index.js +1 -1
  311. package/umd/es6/min/synchronizers/synchronizer-ws-client/index.js.gz +0 -0
  312. package/umd/es6/min/synchronizers/synchronizer-ws-client/with-schemas/index.js +1 -1
  313. package/umd/es6/min/synchronizers/synchronizer-ws-client/with-schemas/index.js.gz +0 -0
  314. package/umd/es6/min/synchronizers/synchronizer-ws-server/index.js +1 -1
  315. package/umd/es6/min/synchronizers/synchronizer-ws-server/index.js.gz +0 -0
  316. package/umd/es6/min/synchronizers/synchronizer-ws-server/with-schemas/index.js +1 -1
  317. package/umd/es6/min/synchronizers/synchronizer-ws-server/with-schemas/index.js.gz +0 -0
  318. package/umd/es6/min/ui-react-inspector/index.js +1 -1
  319. package/umd/es6/min/ui-react-inspector/index.js.gz +0 -0
  320. package/umd/es6/min/ui-react-inspector/with-schemas/index.js +1 -1
  321. package/umd/es6/min/ui-react-inspector/with-schemas/index.js.gz +0 -0
  322. package/umd/es6/min/with-schemas/index.js +1 -1
  323. package/umd/es6/min/with-schemas/index.js.gz +0 -0
  324. package/umd/es6/synchronizers/synchronizer-ws-server/index.js +11 -4
  325. package/umd/es6/synchronizers/synchronizer-ws-server/with-schemas/index.js +11 -4
  326. package/umd/min/checkpoints/index.js +1 -1
  327. package/umd/min/checkpoints/index.js.gz +0 -0
  328. package/umd/min/checkpoints/with-schemas/index.js +1 -1
  329. package/umd/min/checkpoints/with-schemas/index.js.gz +0 -0
  330. package/umd/min/index.js +1 -1
  331. package/umd/min/index.js.gz +0 -0
  332. package/umd/min/indexes/index.js +1 -1
  333. package/umd/min/indexes/index.js.gz +0 -0
  334. package/umd/min/indexes/with-schemas/index.js +1 -1
  335. package/umd/min/indexes/with-schemas/index.js.gz +0 -0
  336. package/umd/min/mergeable-store/index.js +1 -1
  337. package/umd/min/mergeable-store/index.js.gz +0 -0
  338. package/umd/min/mergeable-store/with-schemas/index.js +1 -1
  339. package/umd/min/mergeable-store/with-schemas/index.js.gz +0 -0
  340. package/umd/min/metrics/index.js +1 -1
  341. package/umd/min/metrics/index.js.gz +0 -0
  342. package/umd/min/metrics/with-schemas/index.js +1 -1
  343. package/umd/min/metrics/with-schemas/index.js.gz +0 -0
  344. package/umd/min/persisters/persister-automerge/index.js +1 -1
  345. package/umd/min/persisters/persister-automerge/index.js.gz +0 -0
  346. package/umd/min/persisters/persister-automerge/with-schemas/index.js +1 -1
  347. package/umd/min/persisters/persister-automerge/with-schemas/index.js.gz +0 -0
  348. package/umd/min/persisters/persister-indexed-db/index.js +1 -1
  349. package/umd/min/persisters/persister-indexed-db/index.js.gz +0 -0
  350. package/umd/min/persisters/persister-indexed-db/with-schemas/index.js +1 -1
  351. package/umd/min/persisters/persister-indexed-db/with-schemas/index.js.gz +0 -0
  352. package/umd/min/persisters/persister-partykit-client/index.js +1 -1
  353. package/umd/min/persisters/persister-partykit-client/index.js.gz +0 -0
  354. package/umd/min/persisters/persister-partykit-client/with-schemas/index.js +1 -1
  355. package/umd/min/persisters/persister-partykit-client/with-schemas/index.js.gz +0 -0
  356. package/umd/min/persisters/persister-yjs/index.js +1 -1
  357. package/umd/min/persisters/persister-yjs/index.js.gz +0 -0
  358. package/umd/min/persisters/persister-yjs/with-schemas/index.js +1 -1
  359. package/umd/min/persisters/persister-yjs/with-schemas/index.js.gz +0 -0
  360. package/umd/min/queries/index.js +1 -1
  361. package/umd/min/queries/index.js.gz +0 -0
  362. package/umd/min/queries/with-schemas/index.js +1 -1
  363. package/umd/min/queries/with-schemas/index.js.gz +0 -0
  364. package/umd/min/relationships/index.js +1 -1
  365. package/umd/min/relationships/index.js.gz +0 -0
  366. package/umd/min/relationships/with-schemas/index.js +1 -1
  367. package/umd/min/relationships/with-schemas/index.js.gz +0 -0
  368. package/umd/min/store/index.js +1 -1
  369. package/umd/min/store/index.js.gz +0 -0
  370. package/umd/min/store/with-schemas/index.js +1 -1
  371. package/umd/min/store/with-schemas/index.js.gz +0 -0
  372. package/umd/min/synchronizers/synchronizer-ws-client/index.js +1 -1
  373. package/umd/min/synchronizers/synchronizer-ws-client/index.js.gz +0 -0
  374. package/umd/min/synchronizers/synchronizer-ws-client/with-schemas/index.js +1 -1
  375. package/umd/min/synchronizers/synchronizer-ws-client/with-schemas/index.js.gz +0 -0
  376. package/umd/min/synchronizers/synchronizer-ws-server/index.js +1 -1
  377. package/umd/min/synchronizers/synchronizer-ws-server/index.js.gz +0 -0
  378. package/umd/min/synchronizers/synchronizer-ws-server/with-schemas/index.js +1 -1
  379. package/umd/min/synchronizers/synchronizer-ws-server/with-schemas/index.js.gz +0 -0
  380. package/umd/min/ui-react-inspector/index.js +1 -1
  381. package/umd/min/ui-react-inspector/index.js.gz +0 -0
  382. package/umd/min/ui-react-inspector/with-schemas/index.js +1 -1
  383. package/umd/min/ui-react-inspector/with-schemas/index.js.gz +0 -0
  384. package/umd/min/with-schemas/index.js +1 -1
  385. package/umd/min/with-schemas/index.js.gz +0 -0
  386. package/umd/synchronizers/synchronizer-ws-server/index.js +11 -4
  387. package/umd/synchronizers/synchronizer-ws-server/with-schemas/index.js +11 -4
@@ -9,7 +9,7 @@
9
9
  */
10
10
 
11
11
  import type {DatabasePersisterConfig, Persister} from '../index.d.cts';
12
- import type {AbstractPowerSyncDatabase} from '@journeyapps/powersync-sdk-common';
12
+ import type {AbstractPowerSyncDatabase} from '@powersync/common';
13
13
  import type {Store} from '../../store/index.d.cts';
14
14
 
15
15
  /**
@@ -38,7 +38,7 @@ export interface PowerSyncPersister extends Persister {
38
38
  * ```js yolo
39
39
  * import {createPowerSyncPersister} from 'tinybase/persisters/persister-powersync';
40
40
  * import {createStore} from 'tinybase';
41
- * import {usePowerSync} from '@journeyapps/powersync-react';
41
+ * import {usePowerSync} from '@powersync/react';
42
42
  *
43
43
  * const ps = usePowerSync();
44
44
  * const store = createStore().setTables({pets: {fido: {species: 'dog'}}});
@@ -98,7 +98,7 @@ export interface PowerSyncPersister extends Persister {
98
98
  * ```js yolo
99
99
  * import {createPowerSyncPersister} from 'tinybase/persisters/persister-powersync';
100
100
  * import {createStore} from 'tinybase';
101
- * import {usePowerSync} from '@journeyapps/powersync-react';
101
+ * import {usePowerSync} from '@powersync/react';
102
102
  *
103
103
  * const ps = usePowerSync();
104
104
  * const store = createStore().setTables({pets: {fido: {species: 'dog'}}});
@@ -134,7 +134,7 @@ export interface PowerSyncPersister extends Persister {
134
134
  * ```js yolo
135
135
  * import {createPowerSyncPersister} from 'tinybase/persisters/persister-powersync';
136
136
  * import {createStore} from 'tinybase';
137
- * import {usePowerSync} from '@journeyapps/powersync-react';
137
+ * import {usePowerSync} from '@powersync/react';
138
138
  *
139
139
  * const ps = usePowerSync();
140
140
  * const store = createStore().setTables({pets: {fido: {species: 'dog'}}});
@@ -9,7 +9,7 @@
9
9
  */
10
10
 
11
11
  import type {DatabasePersisterConfig, Persister} from '../index.d.ts';
12
- import type {AbstractPowerSyncDatabase} from '@journeyapps/powersync-sdk-common';
12
+ import type {AbstractPowerSyncDatabase} from '@powersync/common';
13
13
  import type {Store} from '../../store/index.d.ts';
14
14
 
15
15
  /**
@@ -38,7 +38,7 @@ export interface PowerSyncPersister extends Persister {
38
38
  * ```js yolo
39
39
  * import {createPowerSyncPersister} from 'tinybase/persisters/persister-powersync';
40
40
  * import {createStore} from 'tinybase';
41
- * import {usePowerSync} from '@journeyapps/powersync-react';
41
+ * import {usePowerSync} from '@powersync/react';
42
42
  *
43
43
  * const ps = usePowerSync();
44
44
  * const store = createStore().setTables({pets: {fido: {species: 'dog'}}});
@@ -98,7 +98,7 @@ export interface PowerSyncPersister extends Persister {
98
98
  * ```js yolo
99
99
  * import {createPowerSyncPersister} from 'tinybase/persisters/persister-powersync';
100
100
  * import {createStore} from 'tinybase';
101
- * import {usePowerSync} from '@journeyapps/powersync-react';
101
+ * import {usePowerSync} from '@powersync/react';
102
102
  *
103
103
  * const ps = usePowerSync();
104
104
  * const store = createStore().setTables({pets: {fido: {species: 'dog'}}});
@@ -134,7 +134,7 @@ export interface PowerSyncPersister extends Persister {
134
134
  * ```js yolo
135
135
  * import {createPowerSyncPersister} from 'tinybase/persisters/persister-powersync';
136
136
  * import {createStore} from 'tinybase';
137
- * import {usePowerSync} from '@journeyapps/powersync-react';
137
+ * import {usePowerSync} from '@powersync/react';
138
138
  *
139
139
  * const ps = usePowerSync();
140
140
  * const store = createStore().setTables({pets: {fido: {species: 'dog'}}});
@@ -16,7 +16,7 @@ import type {
16
16
  OptionalSchemas,
17
17
  Store,
18
18
  } from '../../../store/with-schemas/index.d.cts';
19
- import type {AbstractPowerSyncDatabase} from '@journeyapps/powersync-sdk-common';
19
+ import type {AbstractPowerSyncDatabase} from '@powersync/common';
20
20
 
21
21
  /**
22
22
  * The PowerSyncPersister interface represents a Persister that lets you save
@@ -45,7 +45,7 @@ export interface PowerSyncPersister<Schemas extends OptionalSchemas>
45
45
  * ```js yolo
46
46
  * import {createPowerSyncPersister} from 'tinybase/persisters/persister-powersync';
47
47
  * import {createStore} from 'tinybase';
48
- * import {usePowerSync} from '@journeyapps/powersync-react';
48
+ * import {usePowerSync} from '@powersync/react';
49
49
  *
50
50
  * const ps = usePowerSync();
51
51
  * const store = createStore().setTables({pets: {fido: {species: 'dog'}}});
@@ -117,7 +117,7 @@ export interface PowerSyncPersister<Schemas extends OptionalSchemas>
117
117
  * ```js yolo
118
118
  * import {createPowerSyncPersister} from 'tinybase/persisters/persister-powersync';
119
119
  * import {createStore} from 'tinybase';
120
- * import {usePowerSync} from '@journeyapps/powersync-react';
120
+ * import {usePowerSync} from '@powersync/react';
121
121
  *
122
122
  * const ps = usePowerSync();
123
123
  * const store = createStore().setTables({pets: {fido: {species: 'dog'}}});
@@ -153,7 +153,7 @@ export interface PowerSyncPersister<Schemas extends OptionalSchemas>
153
153
  * ```js yolo
154
154
  * import {createPowerSyncPersister} from 'tinybase/persisters/persister-powersync';
155
155
  * import {createStore} from 'tinybase';
156
- * import {usePowerSync} from '@journeyapps/powersync-react';
156
+ * import {usePowerSync} from '@powersync/react';
157
157
  *
158
158
  * const ps = usePowerSync();
159
159
  * const store = createStore().setTables({pets: {fido: {species: 'dog'}}});
@@ -16,7 +16,7 @@ import type {
16
16
  OptionalSchemas,
17
17
  Store,
18
18
  } from '../../../store/with-schemas/index.d.ts';
19
- import type {AbstractPowerSyncDatabase} from '@journeyapps/powersync-sdk-common';
19
+ import type {AbstractPowerSyncDatabase} from '@powersync/common';
20
20
 
21
21
  /**
22
22
  * The PowerSyncPersister interface represents a Persister that lets you save
@@ -45,7 +45,7 @@ export interface PowerSyncPersister<Schemas extends OptionalSchemas>
45
45
  * ```js yolo
46
46
  * import {createPowerSyncPersister} from 'tinybase/persisters/persister-powersync';
47
47
  * import {createStore} from 'tinybase';
48
- * import {usePowerSync} from '@journeyapps/powersync-react';
48
+ * import {usePowerSync} from '@powersync/react';
49
49
  *
50
50
  * const ps = usePowerSync();
51
51
  * const store = createStore().setTables({pets: {fido: {species: 'dog'}}});
@@ -117,7 +117,7 @@ export interface PowerSyncPersister<Schemas extends OptionalSchemas>
117
117
  * ```js yolo
118
118
  * import {createPowerSyncPersister} from 'tinybase/persisters/persister-powersync';
119
119
  * import {createStore} from 'tinybase';
120
- * import {usePowerSync} from '@journeyapps/powersync-react';
120
+ * import {usePowerSync} from '@powersync/react';
121
121
  *
122
122
  * const ps = usePowerSync();
123
123
  * const store = createStore().setTables({pets: {fido: {species: 'dog'}}});
@@ -153,7 +153,7 @@ export interface PowerSyncPersister<Schemas extends OptionalSchemas>
153
153
  * ```js yolo
154
154
  * import {createPowerSyncPersister} from 'tinybase/persisters/persister-powersync';
155
155
  * import {createStore} from 'tinybase';
156
- * import {usePowerSync} from '@journeyapps/powersync-react';
156
+ * import {usePowerSync} from '@powersync/react';
157
157
  *
158
158
  * const ps = usePowerSync();
159
159
  * const store = createStore().setTables({pets: {fido: {species: 'dog'}}});
@@ -81,6 +81,12 @@ export interface WsSynchronizer<WebSocketType extends WebSocketTypes>
81
81
  * As well as providing a reference to the MergeableStore to persist, you must
82
82
  * provide a configured WebSocket to send synchronization messages over.
83
83
  *
84
+ * Instead of the raw browser implementation of WebSocket You may prefer to use
85
+ * the [Reconnecting
86
+ * WebSocket](https://github.com/pladaria/reconnecting-websocket) wrapper so
87
+ * that if a client goes offline, it can easily re-establish a connection when
88
+ * it comes back online. Its API is compatible with this Synchronizer.
89
+ *
84
90
  * You can indicate how long the Synchronizer will wait for responses to message
85
91
  * requests before timing out. A final set of optional handlers can be provided
86
92
  * to help debug sends, receives, and errors respectively.
@@ -81,6 +81,12 @@ export interface WsSynchronizer<WebSocketType extends WebSocketTypes>
81
81
  * As well as providing a reference to the MergeableStore to persist, you must
82
82
  * provide a configured WebSocket to send synchronization messages over.
83
83
  *
84
+ * Instead of the raw browser implementation of WebSocket You may prefer to use
85
+ * the [Reconnecting
86
+ * WebSocket](https://github.com/pladaria/reconnecting-websocket) wrapper so
87
+ * that if a client goes offline, it can easily re-establish a connection when
88
+ * it comes back online. Its API is compatible with this Synchronizer.
89
+ *
84
90
  * You can indicate how long the Synchronizer will wait for responses to message
85
91
  * requests before timing out. A final set of optional handlers can be provided
86
92
  * to help debug sends, receives, and errors respectively.
@@ -97,6 +97,12 @@ export interface WsSynchronizer<
97
97
  * As well as providing a reference to the MergeableStore to persist, you must
98
98
  * provide a configured WebSocket to send synchronization messages over.
99
99
  *
100
+ * Instead of the raw browser implementation of WebSocket You may prefer to use
101
+ * the [Reconnecting
102
+ * WebSocket](https://github.com/pladaria/reconnecting-websocket) wrapper so
103
+ * that if a client goes offline, it can easily re-establish a connection when
104
+ * it comes back online. Its API is compatible with this Synchronizer.
105
+ *
100
106
  * You can indicate how long the Synchronizer will wait for responses to message
101
107
  * requests before timing out. A final set of optional handlers can be provided
102
108
  * to help debug sends, receives, and errors respectively.
@@ -97,6 +97,12 @@ export interface WsSynchronizer<
97
97
  * As well as providing a reference to the MergeableStore to persist, you must
98
98
  * provide a configured WebSocket to send synchronization messages over.
99
99
  *
100
+ * Instead of the raw browser implementation of WebSocket You may prefer to use
101
+ * the [Reconnecting
102
+ * WebSocket](https://github.com/pladaria/reconnecting-websocket) wrapper so
103
+ * that if a client goes offline, it can easily re-establish a connection when
104
+ * it comes back online. Its API is compatible with this Synchronizer.
105
+ *
100
106
  * You can indicate how long the Synchronizer will wait for responses to message
101
107
  * requests before timing out. A final set of optional handlers can be provided
102
108
  * to help debug sends, receives, and errors respectively.
@@ -11,6 +11,7 @@
11
11
  import type {Id, IdOrNull, Ids} from '../../common/index.d.cts';
12
12
  import type {Persister, Persists} from '../../persisters/index.d.cts';
13
13
  import type {IdAddedOrRemoved} from '../../store/index.d.cts';
14
+ import type {MergeableStore} from '../../mergeable-store/index.d.cts';
14
15
  import type {WebSocketServer} from 'ws';
15
16
 
16
17
  /**
@@ -509,10 +510,20 @@ export interface WsServer {
509
510
  * by the WsServer. As a result, the server MergeableStore will be kept in sync
510
511
  * with the clients on that path, and in turn with whatever persistence layer
511
512
  * you have configured. See the example below.
513
+ *
514
+ * It is not safe to add or manipulate data in the MergeableStore during the
515
+ * `createPersisterForPath` function, since changes will probably be overwritten
516
+ * when the Persister starts. If you wish to modify data - or upgrade a schema,
517
+ * for example - you can have that function instead return an array containing
518
+ * the Persister _and_ a callback that takes the MergeableStore. That callback
519
+ * will get called after the Persister has started, and is an appropriate place
520
+ * to manipulate data in a way that will be transmitted to clients. Again, see
521
+ * the example below.
512
522
  * @param webSocketServer A WebSocketServer object from your server environment.
513
523
  * @param createPersisterForPath An optional function that will create a
514
- * Persister (with a MergeableStore) to synchronize with the clients on a given
515
- * path.
524
+ * Persister to synchronize with the clients on a given path (or a two-item
525
+ * array of Persister and callback that lets you handle data after persistence
526
+ * has started).
516
527
  * @returns A reference to the new WsServer object.
517
528
  * @example
518
529
  * This example creates a WsServer that synchronizes two clients on a shared
@@ -574,7 +585,10 @@ export interface WsServer {
574
585
  * const server = createWsServer(
575
586
  * new WebSocketServer({port: 8047}),
576
587
  * (pathId) =>
577
- * createFilePersister(createMergeableStore(), pathId + '.json'),
588
+ * createFilePersister(
589
+ * createMergeableStore(),
590
+ * pathId.replace(/[^a-zA-Z0-9]/g, '-') + '.json',
591
+ * ),
578
592
  * );
579
593
  *
580
594
  * // Client 1
@@ -626,6 +640,49 @@ export interface WsServer {
626
640
  * rmSync('petShop.json');
627
641
  * ```
628
642
  * @example
643
+ * This example creates a WsServer that persists a MergeableStore to file that
644
+ * is synchronized with two clients on a shared path, but also which updates its
645
+ * data once synchronization has started.
646
+ *
647
+ * ```js
648
+ * import {WebSocketServer} from 'ws';
649
+ * import {createFilePersister} from 'tinybase/persisters/persister-file';
650
+ * import {createMergeableStore} from 'tinybase';
651
+ * import {createWsServer} from 'tinybase/synchronizers/synchronizer-ws-server';
652
+ * import {createWsSynchronizer} from 'tinybase/synchronizers/synchronizer-ws-client';
653
+ * import {rmSync} from 'fs';
654
+ *
655
+ * // Server
656
+ * const server = createWsServer(
657
+ * new WebSocketServer({port: 8047}),
658
+ * (pathId) => [
659
+ * createFilePersister(
660
+ * createMergeableStore(),
661
+ * pathId.replace(/[^a-zA-Z0-9]/g, '-') + '.json',
662
+ * ),
663
+ * (store) => store.setValue('pathId', pathId),
664
+ * ],
665
+ * );
666
+ *
667
+ * const clientStore = createMergeableStore();
668
+ * clientStore.setCell('pets', 'fido', 'species', 'dog');
669
+ * const synchronizer = await createWsSynchronizer(
670
+ * clientStore,
671
+ * new WebSocket('ws://localhost:8047/petShop'),
672
+ * );
673
+ * await synchronizer.startSync();
674
+ * // ...
675
+ *
676
+ * console.log(clientStore.getContent());
677
+ * // -> [{pets: {fido: {species: 'dog'}}}, {"pathId": "petShop"}]
678
+ *
679
+ * synchronizer.destroy();
680
+ * server.destroy();
681
+ *
682
+ * // Remove file for the purposes of this demo.
683
+ * rmSync('petShop.json');
684
+ * ```
685
+ * @example
629
686
  * This example creates a WsServer with a custom listener that displays
630
687
  * information about the address of the client that connects to it.
631
688
  *
@@ -661,5 +718,10 @@ export function createWsServer<
661
718
  >,
662
719
  >(
663
720
  webSocketServer: WebSocketServer,
664
- createPersisterForPath?: (pathId: Id) => PathPersister | undefined,
721
+ createPersisterForPath?: (
722
+ pathId: Id,
723
+ ) =>
724
+ | PathPersister
725
+ | [PathPersister, (store: MergeableStore) => void]
726
+ | undefined,
665
727
  ): WsServer;
@@ -11,6 +11,7 @@
11
11
  import type {Id, IdOrNull, Ids} from '../../common/index.d.ts';
12
12
  import type {Persister, Persists} from '../../persisters/index.d.ts';
13
13
  import type {IdAddedOrRemoved} from '../../store/index.d.ts';
14
+ import type {MergeableStore} from '../../mergeable-store/index.d.ts';
14
15
  import type {WebSocketServer} from 'ws';
15
16
 
16
17
  /**
@@ -509,10 +510,20 @@ export interface WsServer {
509
510
  * by the WsServer. As a result, the server MergeableStore will be kept in sync
510
511
  * with the clients on that path, and in turn with whatever persistence layer
511
512
  * you have configured. See the example below.
513
+ *
514
+ * It is not safe to add or manipulate data in the MergeableStore during the
515
+ * `createPersisterForPath` function, since changes will probably be overwritten
516
+ * when the Persister starts. If you wish to modify data - or upgrade a schema,
517
+ * for example - you can have that function instead return an array containing
518
+ * the Persister _and_ a callback that takes the MergeableStore. That callback
519
+ * will get called after the Persister has started, and is an appropriate place
520
+ * to manipulate data in a way that will be transmitted to clients. Again, see
521
+ * the example below.
512
522
  * @param webSocketServer A WebSocketServer object from your server environment.
513
523
  * @param createPersisterForPath An optional function that will create a
514
- * Persister (with a MergeableStore) to synchronize with the clients on a given
515
- * path.
524
+ * Persister to synchronize with the clients on a given path (or a two-item
525
+ * array of Persister and callback that lets you handle data after persistence
526
+ * has started).
516
527
  * @returns A reference to the new WsServer object.
517
528
  * @example
518
529
  * This example creates a WsServer that synchronizes two clients on a shared
@@ -574,7 +585,10 @@ export interface WsServer {
574
585
  * const server = createWsServer(
575
586
  * new WebSocketServer({port: 8047}),
576
587
  * (pathId) =>
577
- * createFilePersister(createMergeableStore(), pathId + '.json'),
588
+ * createFilePersister(
589
+ * createMergeableStore(),
590
+ * pathId.replace(/[^a-zA-Z0-9]/g, '-') + '.json',
591
+ * ),
578
592
  * );
579
593
  *
580
594
  * // Client 1
@@ -626,6 +640,49 @@ export interface WsServer {
626
640
  * rmSync('petShop.json');
627
641
  * ```
628
642
  * @example
643
+ * This example creates a WsServer that persists a MergeableStore to file that
644
+ * is synchronized with two clients on a shared path, but also which updates its
645
+ * data once synchronization has started.
646
+ *
647
+ * ```js
648
+ * import {WebSocketServer} from 'ws';
649
+ * import {createFilePersister} from 'tinybase/persisters/persister-file';
650
+ * import {createMergeableStore} from 'tinybase';
651
+ * import {createWsServer} from 'tinybase/synchronizers/synchronizer-ws-server';
652
+ * import {createWsSynchronizer} from 'tinybase/synchronizers/synchronizer-ws-client';
653
+ * import {rmSync} from 'fs';
654
+ *
655
+ * // Server
656
+ * const server = createWsServer(
657
+ * new WebSocketServer({port: 8047}),
658
+ * (pathId) => [
659
+ * createFilePersister(
660
+ * createMergeableStore(),
661
+ * pathId.replace(/[^a-zA-Z0-9]/g, '-') + '.json',
662
+ * ),
663
+ * (store) => store.setValue('pathId', pathId),
664
+ * ],
665
+ * );
666
+ *
667
+ * const clientStore = createMergeableStore();
668
+ * clientStore.setCell('pets', 'fido', 'species', 'dog');
669
+ * const synchronizer = await createWsSynchronizer(
670
+ * clientStore,
671
+ * new WebSocket('ws://localhost:8047/petShop'),
672
+ * );
673
+ * await synchronizer.startSync();
674
+ * // ...
675
+ *
676
+ * console.log(clientStore.getContent());
677
+ * // -> [{pets: {fido: {species: 'dog'}}}, {"pathId": "petShop"}]
678
+ *
679
+ * synchronizer.destroy();
680
+ * server.destroy();
681
+ *
682
+ * // Remove file for the purposes of this demo.
683
+ * rmSync('petShop.json');
684
+ * ```
685
+ * @example
629
686
  * This example creates a WsServer with a custom listener that displays
630
687
  * information about the address of the client that connects to it.
631
688
  *
@@ -661,5 +718,10 @@ export function createWsServer<
661
718
  >,
662
719
  >(
663
720
  webSocketServer: WebSocketServer,
664
- createPersisterForPath?: (pathId: Id) => PathPersister | undefined,
721
+ createPersisterForPath?: (
722
+ pathId: Id,
723
+ ) =>
724
+ | PathPersister
725
+ | [PathPersister, (store: MergeableStore) => void]
726
+ | undefined,
665
727
  ): WsServer;
@@ -17,6 +17,7 @@ import type {
17
17
  Persister,
18
18
  Persists,
19
19
  } from '../../../persisters/with-schemas/index.d.cts';
20
+ import type {MergeableStore} from '../../../mergeable-store/with-schemas/index.d.cts';
20
21
  import type {WebSocketServer} from 'ws';
21
22
 
22
23
  /**
@@ -511,7 +512,12 @@ export interface WsServer {
511
512
  * >,
512
513
  * >(
513
514
  * webSocketServer: WebSocketServer,
514
- * createPersisterForPath?: (pathId: Id) => PathPersister | undefined,
515
+ * createPersisterForPath?: (
516
+ * pathId: Id,
517
+ * ) =>
518
+ * | PathPersister
519
+ * | [PathPersister, (store: MergeableStore) => void]
520
+ * | undefined,
515
521
  * ): WsServer;
516
522
  * ```
517
523
  *
@@ -528,10 +534,20 @@ export interface WsServer {
528
534
  * by the WsServer. As a result, the server MergeableStore will be kept in sync
529
535
  * with the clients on that path, and in turn with whatever persistence layer
530
536
  * you have configured. See the example below.
537
+ *
538
+ * It is not safe to add or manipulate data in the MergeableStore during the
539
+ * `createPersisterForPath` function, since changes will probably be overwritten
540
+ * when the Persister starts. If you wish to modify data - or upgrade a schema,
541
+ * for example - you can have that function instead return an array containing
542
+ * the Persister _and_ a callback that takes the MergeableStore. That callback
543
+ * will get called after the Persister has started, and is an appropriate place
544
+ * to manipulate data in a way that will be transmitted to clients. Again, see
545
+ * the example below.
531
546
  * @param webSocketServer A WebSocketServer object from your server environment.
532
547
  * @param createPersisterForPath An optional function that will create a
533
- * Persister (with a MergeableStore) to synchronize with the clients on a given
534
- * path.
548
+ * Persister to synchronize with the clients on a given path (or a two-item
549
+ * array of Persister and callback that lets you handle data after persistence
550
+ * has started).
535
551
  * @returns A reference to the new WsServer object.
536
552
  * @example
537
553
  * This example creates a WsServer that synchronizes two clients on a shared
@@ -593,7 +609,10 @@ export interface WsServer {
593
609
  * const server = createWsServer(
594
610
  * new WebSocketServer({port: 8047}),
595
611
  * (pathId) =>
596
- * createFilePersister(createMergeableStore(), pathId + '.json'),
612
+ * createFilePersister(
613
+ * createMergeableStore(),
614
+ * pathId.replace(/[^a-zA-Z0-9]/g, '-') + '.json',
615
+ * ),
597
616
  * );
598
617
  *
599
618
  * // Client 1
@@ -645,6 +664,49 @@ export interface WsServer {
645
664
  * rmSync('petShop.json');
646
665
  * ```
647
666
  * @example
667
+ * This example creates a WsServer that persists a MergeableStore to file that
668
+ * is synchronized with two clients on a shared path, but also which updates its
669
+ * data once synchronization has started.
670
+ *
671
+ * ```js
672
+ * import {WebSocketServer} from 'ws';
673
+ * import {createFilePersister} from 'tinybase/persisters/persister-file';
674
+ * import {createMergeableStore} from 'tinybase';
675
+ * import {createWsServer} from 'tinybase/synchronizers/synchronizer-ws-server';
676
+ * import {createWsSynchronizer} from 'tinybase/synchronizers/synchronizer-ws-client';
677
+ * import {rmSync} from 'fs';
678
+ *
679
+ * // Server
680
+ * const server = createWsServer(
681
+ * new WebSocketServer({port: 8047}),
682
+ * (pathId) => [
683
+ * createFilePersister(
684
+ * createMergeableStore(),
685
+ * pathId.replace(/[^a-zA-Z0-9]/g, '-') + '.json',
686
+ * ),
687
+ * (store) => store.setValue('pathId', pathId),
688
+ * ],
689
+ * );
690
+ *
691
+ * const clientStore = createMergeableStore();
692
+ * clientStore.setCell('pets', 'fido', 'species', 'dog');
693
+ * const synchronizer = await createWsSynchronizer(
694
+ * clientStore,
695
+ * new WebSocket('ws://localhost:8047/petShop'),
696
+ * );
697
+ * await synchronizer.startSync();
698
+ * // ...
699
+ *
700
+ * console.log(clientStore.getContent());
701
+ * // -> [{pets: {fido: {species: 'dog'}}}, {"pathId": "petShop"}]
702
+ *
703
+ * synchronizer.destroy();
704
+ * server.destroy();
705
+ *
706
+ * // Remove file for the purposes of this demo.
707
+ * rmSync('petShop.json');
708
+ * ```
709
+ * @example
648
710
  * This example creates a WsServer with a custom listener that displays
649
711
  * information about the address of the client that connects to it.
650
712
  *
@@ -682,5 +744,10 @@ export function createWsServer<
682
744
  >,
683
745
  >(
684
746
  webSocketServer: WebSocketServer,
685
- createPersisterForPath?: (pathId: Id) => PathPersister | undefined,
747
+ createPersisterForPath?: (
748
+ pathId: Id,
749
+ ) =>
750
+ | PathPersister
751
+ | [PathPersister, (store: MergeableStore<Schemas>) => void]
752
+ | undefined,
686
753
  ): WsServer;
@@ -17,6 +17,7 @@ import type {
17
17
  Persister,
18
18
  Persists,
19
19
  } from '../../../persisters/with-schemas/index.d.ts';
20
+ import type {MergeableStore} from '../../../mergeable-store/with-schemas/index.d.ts';
20
21
  import type {WebSocketServer} from 'ws';
21
22
 
22
23
  /**
@@ -511,7 +512,12 @@ export interface WsServer {
511
512
  * >,
512
513
  * >(
513
514
  * webSocketServer: WebSocketServer,
514
- * createPersisterForPath?: (pathId: Id) => PathPersister | undefined,
515
+ * createPersisterForPath?: (
516
+ * pathId: Id,
517
+ * ) =>
518
+ * | PathPersister
519
+ * | [PathPersister, (store: MergeableStore) => void]
520
+ * | undefined,
515
521
  * ): WsServer;
516
522
  * ```
517
523
  *
@@ -528,10 +534,20 @@ export interface WsServer {
528
534
  * by the WsServer. As a result, the server MergeableStore will be kept in sync
529
535
  * with the clients on that path, and in turn with whatever persistence layer
530
536
  * you have configured. See the example below.
537
+ *
538
+ * It is not safe to add or manipulate data in the MergeableStore during the
539
+ * `createPersisterForPath` function, since changes will probably be overwritten
540
+ * when the Persister starts. If you wish to modify data - or upgrade a schema,
541
+ * for example - you can have that function instead return an array containing
542
+ * the Persister _and_ a callback that takes the MergeableStore. That callback
543
+ * will get called after the Persister has started, and is an appropriate place
544
+ * to manipulate data in a way that will be transmitted to clients. Again, see
545
+ * the example below.
531
546
  * @param webSocketServer A WebSocketServer object from your server environment.
532
547
  * @param createPersisterForPath An optional function that will create a
533
- * Persister (with a MergeableStore) to synchronize with the clients on a given
534
- * path.
548
+ * Persister to synchronize with the clients on a given path (or a two-item
549
+ * array of Persister and callback that lets you handle data after persistence
550
+ * has started).
535
551
  * @returns A reference to the new WsServer object.
536
552
  * @example
537
553
  * This example creates a WsServer that synchronizes two clients on a shared
@@ -593,7 +609,10 @@ export interface WsServer {
593
609
  * const server = createWsServer(
594
610
  * new WebSocketServer({port: 8047}),
595
611
  * (pathId) =>
596
- * createFilePersister(createMergeableStore(), pathId + '.json'),
612
+ * createFilePersister(
613
+ * createMergeableStore(),
614
+ * pathId.replace(/[^a-zA-Z0-9]/g, '-') + '.json',
615
+ * ),
597
616
  * );
598
617
  *
599
618
  * // Client 1
@@ -645,6 +664,49 @@ export interface WsServer {
645
664
  * rmSync('petShop.json');
646
665
  * ```
647
666
  * @example
667
+ * This example creates a WsServer that persists a MergeableStore to file that
668
+ * is synchronized with two clients on a shared path, but also which updates its
669
+ * data once synchronization has started.
670
+ *
671
+ * ```js
672
+ * import {WebSocketServer} from 'ws';
673
+ * import {createFilePersister} from 'tinybase/persisters/persister-file';
674
+ * import {createMergeableStore} from 'tinybase';
675
+ * import {createWsServer} from 'tinybase/synchronizers/synchronizer-ws-server';
676
+ * import {createWsSynchronizer} from 'tinybase/synchronizers/synchronizer-ws-client';
677
+ * import {rmSync} from 'fs';
678
+ *
679
+ * // Server
680
+ * const server = createWsServer(
681
+ * new WebSocketServer({port: 8047}),
682
+ * (pathId) => [
683
+ * createFilePersister(
684
+ * createMergeableStore(),
685
+ * pathId.replace(/[^a-zA-Z0-9]/g, '-') + '.json',
686
+ * ),
687
+ * (store) => store.setValue('pathId', pathId),
688
+ * ],
689
+ * );
690
+ *
691
+ * const clientStore = createMergeableStore();
692
+ * clientStore.setCell('pets', 'fido', 'species', 'dog');
693
+ * const synchronizer = await createWsSynchronizer(
694
+ * clientStore,
695
+ * new WebSocket('ws://localhost:8047/petShop'),
696
+ * );
697
+ * await synchronizer.startSync();
698
+ * // ...
699
+ *
700
+ * console.log(clientStore.getContent());
701
+ * // -> [{pets: {fido: {species: 'dog'}}}, {"pathId": "petShop"}]
702
+ *
703
+ * synchronizer.destroy();
704
+ * server.destroy();
705
+ *
706
+ * // Remove file for the purposes of this demo.
707
+ * rmSync('petShop.json');
708
+ * ```
709
+ * @example
648
710
  * This example creates a WsServer with a custom listener that displays
649
711
  * information about the address of the client that connects to it.
650
712
  *
@@ -682,5 +744,10 @@ export function createWsServer<
682
744
  >,
683
745
  >(
684
746
  webSocketServer: WebSocketServer,
685
- createPersisterForPath?: (pathId: Id) => PathPersister | undefined,
747
+ createPersisterForPath?: (
748
+ pathId: Id,
749
+ ) =>
750
+ | PathPersister
751
+ | [PathPersister, (store: MergeableStore<Schemas>) => void]
752
+ | undefined,
686
753
  ): WsServer;
@@ -1 +1 @@
1
- "use strict";const e=e=>null==e,n=(n,t,l)=>e(n)?void 0:t(n),t=e=>e.length,l=(e,n)=>e.includes(n),r=(e,n)=>e.forEach(n),s=e=>0==t(e),o=(e,...n)=>e.push(...n),u=e=>e.pop(),i=e=>e.shift(),c=Object.freeze,d=e=>{var n;return null!=(n=null==e?void 0:e.size)?n:0},a=(v=d,e=>{return n=(e,n)=>e+v(n),k(e).reduce(n,0);var n});var v;const h=(e,n)=>{var t;return null!=(t=null==e?void 0:e.has(n))&&t},p=n=>e(n)||0==d(n),k=e=>{var n;return[...null!=(n=null==e?void 0:e.values())?n:[]]},g=(e,n)=>null==e?void 0:e.forEach(n),C=(e,n)=>null==e?void 0:e.delete(n),f=e=>new Map(e),L=(e,n)=>null==e?void 0:e.get(n),w=(n,t,l)=>e(l)?(C(n,t),n):null==n?void 0:n.set(t,l),S=(e,n,t,l)=>(h(e,n)?null==l||l(L(e,n)):w(e,n,t()),L(e,n)),y=(e,l,r,s,o=0)=>n((r?S:L)(e,l[o],o>t(l)-2?r:f),(n=>{if(o>t(l)-2)return(null==s?void 0:s(n))&&w(e,l[o]),n;const u=y(n,l,r,s,o+1);return p(n)&&w(e,l[o]),u})),z=n=>new Set(Array.isArray(n)||e(n)?n:[n]),E=/^\d+$/,I=((d,v)=>{const k=new WeakMap;return d=>{k.has(d)||k.set(d,(d=>{let v,k,I,V=100,A=f(),F=f(),M=1;const _=f(),b=f(),[j,x,B]=(l=>{let s;const[u,c]=(()=>{const e=[];let n=0;return[t=>{var l;return null!=(l=t?i(e):null)?l:""+n++},n=>{E.test(n)&&t(e)<1e3&&o(e,n)}]})(),d=f();return[(e,n,t,l=[],r=(()=>[]))=>{null!=s||(s=ee);const o=u(1);var i,c;return w(d,o,[e,n,t,l,r]),c=o,null==(i=y(n,null!=t?t:[""],z))||i.add(c),o},(e,n,...l)=>r(((e,n=[""])=>{const l=[],s=(e,u)=>u==t(n)?o(l,e):null===n[u]?g(e,(e=>s(e,u+1))):r([n[u],null],(n=>s(L(e,n),u+1)));return s(e,0),l})(e,n),(e=>g(e,(e=>L(d,e)[0](s,...null!=n?n:[],...l))))),e=>n(L(d,e),(([,n,t])=>(y(n,null!=t?t:[""],void 0,(n=>(C(n,e),p(n)?1:0))),w(d,e),c(e),t))),l=>n(L(d,l),(([n,,l=[],o,u])=>{const i=(...c)=>{var d,a;const v=t(c);v==t(l)?n(s,...c,...u(c)):e(l[v])?r(null!=(a=null==(d=o[v])?void 0:d.call(o,...c))?a:[],(e=>i(...c,e))):i(...c,l[v])};i()}))]})(),O=f(),T=f(),W=[],$=[],m=(n,t)=>{M=0,d.transaction((()=>{const[l,r]=L(O,t);g(l,((t,l)=>g(t,((t,r)=>g(t,((t,s)=>((n,t,l,r,s)=>e(s)?n.delCell(t,l,r,!0):n.setCell(t,l,r,s))(d,l,r,s,t[n]))))))),g(r,((t,l)=>((n,t,l)=>e(l)?n.delValue(t):n.setValue(t,l))(d,l,t[n])))})),M=1},q=e=>{w(O,e),w(T,e),x(b,[e])},D=(e,n)=>r(((e,n)=>e.splice(0,n))(e,null!=n?n:t(e)),q),G=()=>D(W,t(W)-V),H=()=>n(v,(()=>{o(W,v),G(),D($),v=void 0,I=1})),J=()=>{v=u(W),I=1};let K,N;const P=(n="")=>(e(v)&&(v=""+k++,w(O,v,[A,F]),Y(v,n),A=f(),F=f(),I=1),v),Q=()=>{s(W)||(((e,...n)=>{e.unshift(...n)})($,P()),m(0,v),v=u(W),I=1)},R=()=>{s($)||(o(W,v),v=i($),m(1,v),I=1)},U=()=>{I&&(x(_),I=0)},X=e=>{const n=P(e);return U(),n},Y=(e,n)=>(Z(e)&&L(T,e)!==n&&(w(T,e,n),x(b,[e])),ee),Z=e=>h(O,e),ee={setSize:e=>(V=e,G(),ee),addCheckpoint:X,setCheckpoint:Y,getStore:()=>d,getCheckpointIds:()=>[[...W],v,[...$]],forEachCheckpoint:e=>{return n=e,g(T,((e,t)=>n(t,e)));var n},hasCheckpoint:Z,getCheckpoint:e=>L(T,e),goBackward:()=>(Q(),U(),ee),goForward:()=>(R(),U(),ee),goTo:n=>{const t=l(W,n)?Q:l($,n)?R:null;for(;!e(t)&&n!=v;)t();return U(),ee},addCheckpointIdsListener:e=>j(e,_),addCheckpointListener:(e,n)=>j(n,b,[e]),delListener:e=>(B(e),ee),clear:()=>(D(W),D($),e(v)||q(v),v=void 0,k=0,X(),ee),clearForward:()=>(s($)||(D($),x(_)),ee),destroy:()=>{d.delListener(K),d.delListener(N)},getListenerStats:()=>({checkpointIds:a(_),checkpoint:a(b)}),_registerListeners:()=>{K=d.addCellListener(null,null,null,((e,n,t,l,r,s)=>{if(M){H();const e=S(A,n,f),o=S(e,t,f),u=S(o,l,(()=>[s,void 0]));u[1]=r,u[0]===r&&p(w(o,l))&&p(w(e,t))&&p(w(A,n))&&J(),U()}})),N=d.addValueListener(null,((e,n,t,l)=>{if(M){H();const e=S(F,n,(()=>[l,void 0]));e[1]=t,e[0]===t&&p(w(F,n))&&J(),U()}}))}};return c(ee.clear())})(d));const I=k.get(d);return null==v||v(I),I}})(0,(e=>e._registerListeners()));exports.createCheckpoints=I;
1
+ "use strict";const e=e=>null==e,n=(n,t,l)=>e(n)?void 0:t(n),t=e=>e.length,l=(e,n)=>e.includes(n),r=(e,n)=>e.forEach(n),s=e=>0==t(e),o=(e,...n)=>e.push(...n),u=e=>e.pop(),i=e=>e.shift(),c=Object.freeze,d=e=>{var n;return null!=(n=null==e?void 0:e.size)?n:0},a=(v=d,e=>{return n=(e,n)=>e+v(n),k(e).reduce(n,0);var n});var v;const h=(e,n)=>{var t;return null!=(t=null==e?void 0:e.has(n))&&t},p=n=>e(n)||0==d(n),k=e=>{var n;return[...null!=(n=null==e?void 0:e.values())?n:[]]},g=(e,n)=>null==e?void 0:e.forEach(n),C=(e,n)=>null==e?void 0:e.delete(n),f=e=>new Map(e),L=(e,n)=>null==e?void 0:e.get(n),w=(n,t,l)=>e(l)?(C(n,t),n):null==n?void 0:n.set(t,l),S=(e,n,t,l)=>(h(e,n)?null==l||l(L(e,n)):w(e,n,t()),L(e,n)),y=(e,l,r,s,o=0)=>n((r?S:L)(e,l[o],o>t(l)-2?r:f),(n=>{if(o>t(l)-2)return(null==s?void 0:s(n))&&w(e,l[o]),n;const u=y(n,l,r,s,o+1);return p(n)&&w(e,l[o]),u})),z=n=>new Set(Array.isArray(n)||e(n)?n:[n]),E=/^\d+$/,I=((d,v)=>{const k=new WeakMap;return d=>{k.has(d)||k.set(d,(d=>{let v,k,I,V=100,A=f(),F=f(),M=1;const _=f(),b=f(),[j,x,B]=(()=>{let l;const[s,u]=(()=>{const e=[];let n=0;return[t=>{var l;return null!=(l=t?i(e):null)?l:""+n++},n=>{E.test(n)&&t(e)<1e3&&o(e,n)}]})(),c=f();return[(e,n,t,r=[],o=()=>[])=>{null!=l||(l=ee);const u=s(1);var i,d;return w(c,u,[e,n,t,r,o]),d=u,null==(i=y(n,null!=t?t:[""],z))||i.add(d),u},(e,n,...s)=>r(((e,n=[""])=>{const l=[],s=(e,u)=>u==t(n)?o(l,e):null===n[u]?g(e,(e=>s(e,u+1))):r([n[u],null],(n=>s(L(e,n),u+1)));return s(e,0),l})(e,n),(e=>g(e,(e=>L(c,e)[0](l,...null!=n?n:[],...s))))),e=>n(L(c,e),(([,n,t])=>(y(n,null!=t?t:[""],void 0,(n=>(C(n,e),p(n)?1:0))),w(c,e),u(e),t))),s=>n(L(c,s),(([n,,s=[],o,u])=>{const i=(...c)=>{var d,a;const v=t(c);v==t(s)?n(l,...c,...u(c)):e(s[v])?r(null!=(a=null==(d=o[v])?void 0:d.call(o,...c))?a:[],(e=>i(...c,e))):i(...c,s[v])};i()}))]})(),O=f(),T=f(),W=[],$=[],m=(n,t)=>{M=0,d.transaction((()=>{const[l,r]=L(O,t);g(l,((t,l)=>g(t,((t,r)=>g(t,((t,s)=>((n,t,l,r,s)=>e(s)?n.delCell(t,l,r,!0):n.setCell(t,l,r,s))(d,l,r,s,t[n]))))))),g(r,((t,l)=>((n,t,l)=>e(l)?n.delValue(t):n.setValue(t,l))(d,l,t[n])))})),M=1},q=e=>{w(O,e),w(T,e),x(b,[e])},D=(e,n)=>r(((e,n)=>e.splice(0,n))(e,null!=n?n:t(e)),q),G=()=>D(W,t(W)-V),H=()=>n(v,(()=>{o(W,v),G(),D($),v=void 0,I=1})),J=()=>{v=u(W),I=1};let K,N;const P=(n="")=>(e(v)&&(v=""+k++,w(O,v,[A,F]),Y(v,n),A=f(),F=f(),I=1),v),Q=()=>{s(W)||(((e,...n)=>{e.unshift(...n)})($,P()),m(0,v),v=u(W),I=1)},R=()=>{s($)||(o(W,v),v=i($),m(1,v),I=1)},U=()=>{I&&(x(_),I=0)},X=e=>{const n=P(e);return U(),n},Y=(e,n)=>(Z(e)&&L(T,e)!==n&&(w(T,e,n),x(b,[e])),ee),Z=e=>h(O,e),ee={setSize:e=>(V=e,G(),ee),addCheckpoint:X,setCheckpoint:Y,getStore:()=>d,getCheckpointIds:()=>[[...W],v,[...$]],forEachCheckpoint:e=>{return n=e,g(T,((e,t)=>n(t,e)));var n},hasCheckpoint:Z,getCheckpoint:e=>L(T,e),goBackward:()=>(Q(),U(),ee),goForward:()=>(R(),U(),ee),goTo:n=>{const t=l(W,n)?Q:l($,n)?R:null;for(;!e(t)&&n!=v;)t();return U(),ee},addCheckpointIdsListener:e=>j(e,_),addCheckpointListener:(e,n)=>j(n,b,[e]),delListener:e=>(B(e),ee),clear:()=>(D(W),D($),e(v)||q(v),v=void 0,k=0,X(),ee),clearForward:()=>(s($)||(D($),x(_)),ee),destroy:()=>{d.delListener(K),d.delListener(N)},getListenerStats:()=>({checkpointIds:a(_),checkpoint:a(b)}),_registerListeners:()=>{K=d.addCellListener(null,null,null,((e,n,t,l,r,s)=>{if(M){H();const e=S(A,n,f),o=S(e,t,f),u=S(o,l,(()=>[s,void 0]));u[1]=r,u[0]===r&&p(w(o,l))&&p(w(e,t))&&p(w(A,n))&&J(),U()}})),N=d.addValueListener(null,((e,n,t,l)=>{if(M){H();const e=S(F,n,(()=>[l,void 0]));e[1]=t,e[0]===t&&p(w(F,n))&&J(),U()}}))}};return c(ee.clear())})(d));const I=k.get(d);return null==v||v(I),I}})(0,(e=>e._registerListeners()));exports.createCheckpoints=I;