tinybase 5.0.0-beta.19 → 5.0.0-beta.20

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 (987) hide show
  1. package/@types/_internal/queries/with-schemas/index.d.cts +22 -0
  2. package/@types/_internal/store/index.d.cts +3 -0
  3. package/@types/_internal/store/with-schemas/index.d.cts +106 -0
  4. package/@types/_internal/ui-react/with-schemas/index.d.cts +813 -0
  5. package/@types/checkpoints/index.d.cts +1033 -0
  6. package/@types/checkpoints/with-schemas/index.d.cts +1125 -0
  7. package/@types/index.d.cts +18 -0
  8. package/@types/indexes/index.d.cts +1037 -0
  9. package/@types/indexes/with-schemas/index.d.cts +1183 -0
  10. package/@types/mergeable-store/index.d.cts +222 -0
  11. package/@types/mergeable-store/with-schemas/index.d.cts +509 -0
  12. package/@types/metrics/index.d.cts +895 -0
  13. package/@types/metrics/with-schemas/index.d.cts +982 -0
  14. package/@types/persisters/index.d.cts +1319 -0
  15. package/@types/persisters/persister-automerge/index.d.cts +162 -0
  16. package/@types/persisters/persister-automerge/with-schemas/index.d.cts +177 -0
  17. package/@types/persisters/persister-browser/index.d.cts +174 -0
  18. package/@types/persisters/persister-browser/with-schemas/index.d.cts +199 -0
  19. package/@types/persisters/persister-cr-sqlite-wasm/index.d.cts +157 -0
  20. package/@types/persisters/persister-cr-sqlite-wasm/with-schemas/index.d.cts +176 -0
  21. package/@types/persisters/persister-electric-sql/index.d.cts +183 -0
  22. package/@types/persisters/persister-electric-sql/with-schemas/index.d.cts +202 -0
  23. package/@types/persisters/persister-expo-sqlite/index.d.cts +186 -0
  24. package/@types/persisters/persister-expo-sqlite/with-schemas/index.d.cts +205 -0
  25. package/@types/persisters/persister-expo-sqlite-next/index.d.cts +187 -0
  26. package/@types/persisters/persister-expo-sqlite-next/with-schemas/index.d.cts +206 -0
  27. package/@types/persisters/persister-file/index.d.cts +88 -0
  28. package/@types/persisters/persister-file/with-schemas/index.d.cts +102 -0
  29. package/@types/persisters/persister-indexed-db/index.d.cts +116 -0
  30. package/@types/persisters/persister-indexed-db/with-schemas/index.d.cts +131 -0
  31. package/@types/persisters/persister-libsql/index.d.cts +154 -0
  32. package/@types/persisters/persister-libsql/with-schemas/index.d.cts +173 -0
  33. package/@types/persisters/persister-partykit-client/index.d.cts +185 -0
  34. package/@types/persisters/persister-partykit-client/with-schemas/index.d.cts +200 -0
  35. package/@types/persisters/persister-partykit-server/index.d.cts +631 -0
  36. package/@types/persisters/persister-partykit-server/with-schemas/index.d.cts +673 -0
  37. package/@types/persisters/persister-powersync/index.d.cts +169 -0
  38. package/@types/persisters/persister-powersync/with-schemas/index.d.cts +188 -0
  39. package/@types/persisters/persister-remote/index.d.cts +113 -0
  40. package/@types/persisters/persister-remote/with-schemas/index.d.cts +129 -0
  41. package/@types/persisters/persister-sqlite-wasm/index.d.cts +170 -0
  42. package/@types/persisters/persister-sqlite-wasm/with-schemas/index.d.cts +190 -0
  43. package/@types/persisters/persister-sqlite3/index.d.cts +171 -0
  44. package/@types/persisters/persister-sqlite3/with-schemas/index.d.cts +190 -0
  45. package/@types/persisters/persister-yjs/index.d.cts +157 -0
  46. package/@types/persisters/persister-yjs/with-schemas/index.d.cts +172 -0
  47. package/@types/persisters/with-schemas/index.d.cts +1393 -0
  48. package/@types/queries/index.d.cts +3640 -0
  49. package/@types/queries/with-schemas/index.d.cts +3961 -0
  50. package/@types/relationships/index.d.cts +1266 -0
  51. package/@types/relationships/with-schemas/index.d.cts +1420 -0
  52. package/@types/store/index.d.cts +7453 -0
  53. package/@types/store/with-schemas/index.d.cts +9131 -0
  54. package/@types/synchronizers/index.d.cts +139 -0
  55. package/@types/synchronizers/synchronizer-local/index.d.cts +27 -0
  56. package/@types/synchronizers/synchronizer-local/with-schemas/index.d.cts +29 -0
  57. package/@types/synchronizers/synchronizer-ws-client/index.d.cts +36 -0
  58. package/@types/synchronizers/synchronizer-ws-client/with-schemas/index.d.cts +42 -0
  59. package/@types/synchronizers/synchronizer-ws-server/index.d.cts +58 -0
  60. package/@types/synchronizers/synchronizer-ws-server/with-schemas/index.d.cts +58 -0
  61. package/@types/synchronizers/with-schemas/index.d.cts +156 -0
  62. package/@types/tools/index.d.cts +556 -0
  63. package/@types/tools/with-schemas/index.d.cts +567 -0
  64. package/@types/ui-react/index.d.cts +15318 -0
  65. package/@types/ui-react/with-schemas/index.d.cts +16235 -0
  66. package/@types/ui-react-dom/index.d.cts +1751 -0
  67. package/@types/ui-react-dom/with-schemas/index.d.cts +1883 -0
  68. package/@types/ui-react-inspector/index.d.cts +77 -0
  69. package/@types/ui-react-inspector/with-schemas/index.d.cts +1871 -0
  70. package/@types/with-schemas/index.d.cts +18 -0
  71. package/cjs/debug/checkpoints/index.cjs +433 -0
  72. package/cjs/debug/checkpoints/with-schemas/index.cjs +433 -0
  73. package/cjs/debug/common/index.cjs +28 -0
  74. package/cjs/debug/common/with-schemas/index.cjs +28 -0
  75. package/cjs/debug/index.cjs +4102 -0
  76. package/cjs/debug/indexes/index.cjs +555 -0
  77. package/cjs/debug/indexes/with-schemas/index.cjs +555 -0
  78. package/cjs/debug/mergeable-store/index.cjs +2249 -0
  79. package/cjs/debug/mergeable-store/with-schemas/index.cjs +2249 -0
  80. package/cjs/debug/metrics/index.cjs +521 -0
  81. package/cjs/debug/metrics/with-schemas/index.cjs +521 -0
  82. package/cjs/debug/persisters/index.cjs +230 -0
  83. package/cjs/debug/persisters/persister-automerge/index.cjs +378 -0
  84. package/cjs/debug/persisters/persister-automerge/with-schemas/index.cjs +378 -0
  85. package/cjs/debug/persisters/persister-browser/index.cjs +282 -0
  86. package/cjs/debug/persisters/persister-browser/with-schemas/index.cjs +282 -0
  87. package/cjs/debug/persisters/persister-cr-sqlite-wasm/index.cjs +929 -0
  88. package/cjs/debug/persisters/persister-cr-sqlite-wasm/with-schemas/index.cjs +929 -0
  89. package/cjs/debug/persisters/persister-electric-sql/index.cjs +937 -0
  90. package/cjs/debug/persisters/persister-electric-sql/with-schemas/index.cjs +937 -0
  91. package/cjs/debug/persisters/persister-expo-sqlite/index.cjs +930 -0
  92. package/cjs/debug/persisters/persister-expo-sqlite/with-schemas/index.cjs +930 -0
  93. package/cjs/debug/persisters/persister-expo-sqlite-next/index.cjs +932 -0
  94. package/cjs/debug/persisters/persister-expo-sqlite-next/with-schemas/index.cjs +932 -0
  95. package/cjs/debug/persisters/persister-file/index.cjs +265 -0
  96. package/cjs/debug/persisters/persister-file/with-schemas/index.cjs +265 -0
  97. package/cjs/debug/persisters/persister-indexed-db/index.cjs +342 -0
  98. package/cjs/debug/persisters/persister-indexed-db/with-schemas/index.cjs +342 -0
  99. package/cjs/debug/persisters/persister-libsql/index.cjs +930 -0
  100. package/cjs/debug/persisters/persister-libsql/with-schemas/index.cjs +930 -0
  101. package/cjs/debug/persisters/persister-partykit-client/index.cjs +329 -0
  102. package/cjs/debug/persisters/persister-partykit-client/with-schemas/index.cjs +329 -0
  103. package/cjs/debug/persisters/persister-partykit-server/index.cjs +284 -0
  104. package/cjs/debug/persisters/persister-partykit-server/with-schemas/index.cjs +284 -0
  105. package/cjs/debug/persisters/persister-powersync/index.cjs +945 -0
  106. package/cjs/debug/persisters/persister-powersync/with-schemas/index.cjs +945 -0
  107. package/cjs/debug/persisters/persister-remote/index.cjs +287 -0
  108. package/cjs/debug/persisters/persister-remote/with-schemas/index.cjs +287 -0
  109. package/cjs/debug/persisters/persister-sqlite-wasm/index.cjs +938 -0
  110. package/cjs/debug/persisters/persister-sqlite-wasm/with-schemas/index.cjs +938 -0
  111. package/cjs/debug/persisters/persister-sqlite3/index.cjs +940 -0
  112. package/cjs/debug/persisters/persister-sqlite3/with-schemas/index.cjs +940 -0
  113. package/cjs/debug/persisters/persister-yjs/index.cjs +427 -0
  114. package/cjs/debug/persisters/persister-yjs/with-schemas/index.cjs +427 -0
  115. package/cjs/debug/persisters/with-schemas/index.cjs +230 -0
  116. package/cjs/debug/queries/index.cjs +814 -0
  117. package/cjs/debug/queries/with-schemas/index.cjs +814 -0
  118. package/cjs/debug/relationships/index.cjs +531 -0
  119. package/cjs/debug/relationships/with-schemas/index.cjs +531 -0
  120. package/cjs/debug/store/index.cjs +1636 -0
  121. package/cjs/debug/store/with-schemas/index.cjs +1636 -0
  122. package/cjs/debug/synchronizers/index.cjs +466 -0
  123. package/cjs/debug/synchronizers/synchronizer-local/index.cjs +506 -0
  124. package/cjs/debug/synchronizers/synchronizer-local/with-schemas/index.cjs +506 -0
  125. package/cjs/debug/synchronizers/synchronizer-ws-client/index.cjs +529 -0
  126. package/cjs/debug/synchronizers/synchronizer-ws-client/with-schemas/index.cjs +529 -0
  127. package/cjs/debug/synchronizers/synchronizer-ws-server/index.cjs +243 -0
  128. package/cjs/debug/synchronizers/synchronizer-ws-server/with-schemas/index.cjs +243 -0
  129. package/cjs/debug/synchronizers/with-schemas/index.cjs +466 -0
  130. package/cjs/debug/tools/index.cjs +3300 -0
  131. package/cjs/debug/tools/with-schemas/index.cjs +3300 -0
  132. package/cjs/debug/ui-react/index.cjs +1985 -0
  133. package/cjs/debug/ui-react/with-schemas/index.cjs +1985 -0
  134. package/cjs/debug/ui-react-dom/index.cjs +779 -0
  135. package/cjs/debug/ui-react-dom/with-schemas/index.cjs +779 -0
  136. package/cjs/debug/ui-react-inspector/index.cjs +3263 -0
  137. package/cjs/debug/ui-react-inspector/with-schemas/index.cjs +3263 -0
  138. package/cjs/debug/with-schemas/index.cjs +4102 -0
  139. package/cjs/es6/debug/checkpoints/index.cjs +473 -0
  140. package/cjs/es6/debug/checkpoints/with-schemas/index.cjs +473 -0
  141. package/cjs/es6/debug/common/index.cjs +30 -0
  142. package/cjs/es6/debug/common/with-schemas/index.cjs +30 -0
  143. package/cjs/es6/debug/index.cjs +4358 -0
  144. package/cjs/es6/debug/indexes/index.cjs +602 -0
  145. package/cjs/es6/debug/indexes/with-schemas/index.cjs +602 -0
  146. package/cjs/es6/debug/mergeable-store/index.cjs +2349 -0
  147. package/cjs/es6/debug/mergeable-store/with-schemas/index.cjs +2349 -0
  148. package/cjs/es6/debug/metrics/index.cjs +574 -0
  149. package/cjs/es6/debug/metrics/with-schemas/index.cjs +574 -0
  150. package/cjs/es6/debug/persisters/index.cjs +302 -0
  151. package/cjs/es6/debug/persisters/persister-automerge/index.cjs +476 -0
  152. package/cjs/es6/debug/persisters/persister-automerge/with-schemas/index.cjs +476 -0
  153. package/cjs/es6/debug/persisters/persister-browser/index.cjs +384 -0
  154. package/cjs/es6/debug/persisters/persister-browser/with-schemas/index.cjs +384 -0
  155. package/cjs/es6/debug/persisters/persister-cr-sqlite-wasm/index.cjs +1256 -0
  156. package/cjs/es6/debug/persisters/persister-cr-sqlite-wasm/with-schemas/index.cjs +1256 -0
  157. package/cjs/es6/debug/persisters/persister-electric-sql/index.cjs +1264 -0
  158. package/cjs/es6/debug/persisters/persister-electric-sql/with-schemas/index.cjs +1264 -0
  159. package/cjs/es6/debug/persisters/persister-expo-sqlite/index.cjs +1256 -0
  160. package/cjs/es6/debug/persisters/persister-expo-sqlite/with-schemas/index.cjs +1256 -0
  161. package/cjs/es6/debug/persisters/persister-expo-sqlite-next/index.cjs +1259 -0
  162. package/cjs/es6/debug/persisters/persister-expo-sqlite-next/with-schemas/index.cjs +1259 -0
  163. package/cjs/es6/debug/persisters/persister-file/index.cjs +365 -0
  164. package/cjs/es6/debug/persisters/persister-file/with-schemas/index.cjs +365 -0
  165. package/cjs/es6/debug/persisters/persister-indexed-db/index.cjs +481 -0
  166. package/cjs/es6/debug/persisters/persister-indexed-db/with-schemas/index.cjs +481 -0
  167. package/cjs/es6/debug/persisters/persister-libsql/index.cjs +1257 -0
  168. package/cjs/es6/debug/persisters/persister-libsql/with-schemas/index.cjs +1257 -0
  169. package/cjs/es6/debug/persisters/persister-partykit-client/index.cjs +459 -0
  170. package/cjs/es6/debug/persisters/persister-partykit-client/with-schemas/index.cjs +459 -0
  171. package/cjs/es6/debug/persisters/persister-partykit-server/index.cjs +411 -0
  172. package/cjs/es6/debug/persisters/persister-partykit-server/with-schemas/index.cjs +411 -0
  173. package/cjs/es6/debug/persisters/persister-powersync/index.cjs +1312 -0
  174. package/cjs/es6/debug/persisters/persister-powersync/with-schemas/index.cjs +1312 -0
  175. package/cjs/es6/debug/persisters/persister-remote/index.cjs +389 -0
  176. package/cjs/es6/debug/persisters/persister-remote/with-schemas/index.cjs +389 -0
  177. package/cjs/es6/debug/persisters/persister-sqlite-wasm/index.cjs +1286 -0
  178. package/cjs/es6/debug/persisters/persister-sqlite-wasm/with-schemas/index.cjs +1286 -0
  179. package/cjs/es6/debug/persisters/persister-sqlite3/index.cjs +1266 -0
  180. package/cjs/es6/debug/persisters/persister-sqlite3/with-schemas/index.cjs +1266 -0
  181. package/cjs/es6/debug/persisters/persister-yjs/index.cjs +536 -0
  182. package/cjs/es6/debug/persisters/persister-yjs/with-schemas/index.cjs +536 -0
  183. package/cjs/es6/debug/persisters/with-schemas/index.cjs +302 -0
  184. package/cjs/es6/debug/queries/index.cjs +859 -0
  185. package/cjs/es6/debug/queries/with-schemas/index.cjs +859 -0
  186. package/cjs/es6/debug/relationships/index.cjs +591 -0
  187. package/cjs/es6/debug/relationships/with-schemas/index.cjs +591 -0
  188. package/cjs/es6/debug/store/index.cjs +1716 -0
  189. package/cjs/es6/debug/store/with-schemas/index.cjs +1716 -0
  190. package/cjs/es6/debug/synchronizers/index.cjs +594 -0
  191. package/cjs/es6/debug/synchronizers/synchronizer-local/index.cjs +630 -0
  192. package/cjs/es6/debug/synchronizers/synchronizer-local/with-schemas/index.cjs +630 -0
  193. package/cjs/es6/debug/synchronizers/synchronizer-ws-client/index.cjs +681 -0
  194. package/cjs/es6/debug/synchronizers/synchronizer-ws-client/with-schemas/index.cjs +681 -0
  195. package/cjs/es6/debug/synchronizers/synchronizer-ws-server/index.cjs +292 -0
  196. package/cjs/es6/debug/synchronizers/synchronizer-ws-server/with-schemas/index.cjs +292 -0
  197. package/cjs/es6/debug/synchronizers/with-schemas/index.cjs +594 -0
  198. package/cjs/es6/debug/tools/index.cjs +3423 -0
  199. package/cjs/es6/debug/tools/with-schemas/index.cjs +3423 -0
  200. package/cjs/es6/debug/ui-react/index.cjs +2189 -0
  201. package/cjs/es6/debug/ui-react/with-schemas/index.cjs +2189 -0
  202. package/cjs/es6/debug/ui-react-dom/index.cjs +906 -0
  203. package/cjs/es6/debug/ui-react-dom/with-schemas/index.cjs +906 -0
  204. package/cjs/es6/debug/ui-react-inspector/index.cjs +3654 -0
  205. package/cjs/es6/debug/ui-react-inspector/with-schemas/index.cjs +3654 -0
  206. package/cjs/es6/debug/with-schemas/index.cjs +4358 -0
  207. package/es6/debug/checkpoints/index.js +471 -0
  208. package/es6/debug/checkpoints/with-schemas/index.js +471 -0
  209. package/es6/debug/common/index.js +27 -0
  210. package/es6/debug/common/with-schemas/index.js +27 -0
  211. package/es6/debug/index.js +4358 -0
  212. package/es6/debug/indexes/index.js +600 -0
  213. package/es6/debug/indexes/with-schemas/index.js +600 -0
  214. package/es6/debug/mergeable-store/index.js +2347 -0
  215. package/es6/debug/mergeable-store/with-schemas/index.js +2347 -0
  216. package/es6/debug/metrics/index.js +572 -0
  217. package/es6/debug/metrics/with-schemas/index.js +572 -0
  218. package/es6/debug/persisters/index.js +300 -0
  219. package/es6/debug/persisters/persister-automerge/index.js +474 -0
  220. package/es6/debug/persisters/persister-automerge/with-schemas/index.js +474 -0
  221. package/es6/debug/persisters/persister-browser/index.js +381 -0
  222. package/es6/debug/persisters/persister-browser/with-schemas/index.js +381 -0
  223. package/es6/debug/persisters/persister-cr-sqlite-wasm/index.js +1254 -0
  224. package/es6/debug/persisters/persister-cr-sqlite-wasm/with-schemas/index.js +1254 -0
  225. package/es6/debug/persisters/persister-electric-sql/index.js +1262 -0
  226. package/es6/debug/persisters/persister-electric-sql/with-schemas/index.js +1262 -0
  227. package/es6/debug/persisters/persister-expo-sqlite/index.js +1254 -0
  228. package/es6/debug/persisters/persister-expo-sqlite/with-schemas/index.js +1254 -0
  229. package/es6/debug/persisters/persister-expo-sqlite-next/index.js +1257 -0
  230. package/es6/debug/persisters/persister-expo-sqlite-next/with-schemas/index.js +1257 -0
  231. package/es6/debug/persisters/persister-file/index.js +362 -0
  232. package/es6/debug/persisters/persister-file/with-schemas/index.js +362 -0
  233. package/es6/debug/persisters/persister-indexed-db/index.js +478 -0
  234. package/es6/debug/persisters/persister-indexed-db/with-schemas/index.js +478 -0
  235. package/es6/debug/persisters/persister-libsql/index.js +1255 -0
  236. package/es6/debug/persisters/persister-libsql/with-schemas/index.js +1255 -0
  237. package/es6/debug/persisters/persister-partykit-client/index.js +457 -0
  238. package/es6/debug/persisters/persister-partykit-client/with-schemas/index.js +457 -0
  239. package/es6/debug/persisters/persister-partykit-server/index.js +411 -0
  240. package/es6/debug/persisters/persister-partykit-server/with-schemas/index.js +411 -0
  241. package/es6/debug/persisters/persister-powersync/index.js +1310 -0
  242. package/es6/debug/persisters/persister-powersync/with-schemas/index.js +1310 -0
  243. package/es6/debug/persisters/persister-remote/index.js +387 -0
  244. package/es6/debug/persisters/persister-remote/with-schemas/index.js +387 -0
  245. package/es6/debug/persisters/persister-sqlite-wasm/index.js +1284 -0
  246. package/es6/debug/persisters/persister-sqlite-wasm/with-schemas/index.js +1284 -0
  247. package/es6/debug/persisters/persister-sqlite3/index.js +1264 -0
  248. package/es6/debug/persisters/persister-sqlite3/with-schemas/index.js +1264 -0
  249. package/es6/debug/persisters/persister-yjs/index.js +534 -0
  250. package/es6/debug/persisters/persister-yjs/with-schemas/index.js +534 -0
  251. package/es6/debug/persisters/with-schemas/index.js +300 -0
  252. package/es6/debug/queries/index.js +857 -0
  253. package/es6/debug/queries/with-schemas/index.js +857 -0
  254. package/es6/debug/relationships/index.js +589 -0
  255. package/es6/debug/relationships/with-schemas/index.js +589 -0
  256. package/es6/debug/store/index.js +1714 -0
  257. package/es6/debug/store/with-schemas/index.js +1714 -0
  258. package/es6/debug/synchronizers/index.js +592 -0
  259. package/es6/debug/synchronizers/synchronizer-local/index.js +628 -0
  260. package/es6/debug/synchronizers/synchronizer-local/with-schemas/index.js +628 -0
  261. package/es6/debug/synchronizers/synchronizer-ws-client/index.js +679 -0
  262. package/es6/debug/synchronizers/synchronizer-ws-client/with-schemas/index.js +679 -0
  263. package/es6/debug/synchronizers/synchronizer-ws-server/index.js +290 -0
  264. package/es6/debug/synchronizers/synchronizer-ws-server/with-schemas/index.js +290 -0
  265. package/es6/debug/synchronizers/with-schemas/index.js +592 -0
  266. package/es6/debug/tools/index.js +3421 -0
  267. package/es6/debug/tools/with-schemas/index.js +3421 -0
  268. package/es6/debug/ui-react/index.js +2188 -0
  269. package/es6/debug/ui-react/with-schemas/index.js +2188 -0
  270. package/es6/debug/ui-react-dom/index.js +907 -0
  271. package/es6/debug/ui-react-dom/with-schemas/index.js +907 -0
  272. package/es6/debug/ui-react-inspector/index.js +3659 -0
  273. package/es6/debug/ui-react-inspector/with-schemas/index.js +3659 -0
  274. package/es6/debug/with-schemas/index.js +4358 -0
  275. package/package.json +3526 -40
  276. package/readme.md +3 -3
  277. package/releases.md +2 -2
  278. package/umd/debug/checkpoints/index.js +450 -0
  279. package/umd/debug/checkpoints/with-schemas/index.js +450 -0
  280. package/umd/debug/common/index.js +38 -0
  281. package/umd/debug/common/with-schemas/index.js +38 -0
  282. package/umd/debug/index.js +4192 -0
  283. package/umd/debug/indexes/index.js +578 -0
  284. package/umd/debug/indexes/with-schemas/index.js +578 -0
  285. package/umd/debug/mergeable-store/index.js +2312 -0
  286. package/umd/debug/mergeable-store/with-schemas/index.js +2312 -0
  287. package/umd/debug/metrics/index.js +544 -0
  288. package/umd/debug/metrics/with-schemas/index.js +544 -0
  289. package/umd/debug/persisters/index.js +242 -0
  290. package/umd/debug/persisters/persister-automerge/index.js +390 -0
  291. package/umd/debug/persisters/persister-automerge/with-schemas/index.js +390 -0
  292. package/umd/debug/persisters/persister-browser/index.js +296 -0
  293. package/umd/debug/persisters/persister-browser/with-schemas/index.js +296 -0
  294. package/umd/debug/persisters/persister-cr-sqlite-wasm/index.js +959 -0
  295. package/umd/debug/persisters/persister-cr-sqlite-wasm/with-schemas/index.js +959 -0
  296. package/umd/debug/persisters/persister-electric-sql/index.js +967 -0
  297. package/umd/debug/persisters/persister-electric-sql/with-schemas/index.js +967 -0
  298. package/umd/debug/persisters/persister-expo-sqlite/index.js +960 -0
  299. package/umd/debug/persisters/persister-expo-sqlite/with-schemas/index.js +960 -0
  300. package/umd/debug/persisters/persister-expo-sqlite-next/index.js +963 -0
  301. package/umd/debug/persisters/persister-expo-sqlite-next/with-schemas/index.js +963 -0
  302. package/umd/debug/persisters/persister-file/index.js +280 -0
  303. package/umd/debug/persisters/persister-file/with-schemas/index.js +280 -0
  304. package/umd/debug/persisters/persister-indexed-db/index.js +354 -0
  305. package/umd/debug/persisters/persister-indexed-db/with-schemas/index.js +354 -0
  306. package/umd/debug/persisters/persister-libsql/index.js +960 -0
  307. package/umd/debug/persisters/persister-libsql/with-schemas/index.js +960 -0
  308. package/umd/debug/persisters/persister-partykit-client/index.js +341 -0
  309. package/umd/debug/persisters/persister-partykit-client/with-schemas/index.js +341 -0
  310. package/umd/debug/persisters/persister-partykit-server/index.js +312 -0
  311. package/umd/debug/persisters/persister-partykit-server/with-schemas/index.js +312 -0
  312. package/umd/debug/persisters/persister-powersync/index.js +977 -0
  313. package/umd/debug/persisters/persister-powersync/with-schemas/index.js +977 -0
  314. package/umd/debug/persisters/persister-remote/index.js +299 -0
  315. package/umd/debug/persisters/persister-remote/with-schemas/index.js +299 -0
  316. package/umd/debug/persisters/persister-sqlite-wasm/index.js +968 -0
  317. package/umd/debug/persisters/persister-sqlite-wasm/with-schemas/index.js +968 -0
  318. package/umd/debug/persisters/persister-sqlite3/index.js +970 -0
  319. package/umd/debug/persisters/persister-sqlite3/with-schemas/index.js +970 -0
  320. package/umd/debug/persisters/persister-yjs/index.js +439 -0
  321. package/umd/debug/persisters/persister-yjs/with-schemas/index.js +439 -0
  322. package/umd/debug/persisters/with-schemas/index.js +242 -0
  323. package/umd/debug/queries/index.js +828 -0
  324. package/umd/debug/queries/with-schemas/index.js +828 -0
  325. package/umd/debug/relationships/index.js +551 -0
  326. package/umd/debug/relationships/with-schemas/index.js +551 -0
  327. package/umd/debug/store/index.js +1686 -0
  328. package/umd/debug/store/with-schemas/index.js +1686 -0
  329. package/umd/debug/synchronizers/index.js +482 -0
  330. package/umd/debug/synchronizers/synchronizer-local/index.js +522 -0
  331. package/umd/debug/synchronizers/synchronizer-local/with-schemas/index.js +522 -0
  332. package/umd/debug/synchronizers/synchronizer-ws-client/index.js +547 -0
  333. package/umd/debug/synchronizers/synchronizer-ws-client/with-schemas/index.js +547 -0
  334. package/umd/debug/synchronizers/synchronizer-ws-server/index.js +261 -0
  335. package/umd/debug/synchronizers/synchronizer-ws-server/with-schemas/index.js +261 -0
  336. package/umd/debug/synchronizers/with-schemas/index.js +482 -0
  337. package/umd/debug/tools/index.js +3351 -0
  338. package/umd/debug/tools/with-schemas/index.js +3351 -0
  339. package/umd/debug/ui-react/index.js +2036 -0
  340. package/umd/debug/ui-react/with-schemas/index.js +2036 -0
  341. package/umd/debug/ui-react-dom/index.js +802 -0
  342. package/umd/debug/ui-react-dom/with-schemas/index.js +802 -0
  343. package/umd/debug/ui-react-inspector/index.js +3342 -0
  344. package/umd/debug/ui-react-inspector/with-schemas/index.js +3342 -0
  345. package/umd/debug/with-schemas/index.js +4192 -0
  346. package/umd/es6/debug/checkpoints/index.js +492 -0
  347. package/umd/es6/debug/checkpoints/with-schemas/index.js +492 -0
  348. package/umd/es6/debug/common/index.js +40 -0
  349. package/umd/es6/debug/common/with-schemas/index.js +40 -0
  350. package/umd/es6/debug/index.js +4456 -0
  351. package/umd/es6/debug/indexes/index.js +627 -0
  352. package/umd/es6/debug/indexes/with-schemas/index.js +627 -0
  353. package/umd/es6/debug/mergeable-store/index.js +2418 -0
  354. package/umd/es6/debug/mergeable-store/with-schemas/index.js +2418 -0
  355. package/umd/es6/debug/metrics/index.js +599 -0
  356. package/umd/es6/debug/metrics/with-schemas/index.js +599 -0
  357. package/umd/es6/debug/persisters/index.js +316 -0
  358. package/umd/es6/debug/persisters/persister-automerge/index.js +490 -0
  359. package/umd/es6/debug/persisters/persister-automerge/with-schemas/index.js +490 -0
  360. package/umd/es6/debug/persisters/persister-browser/index.js +400 -0
  361. package/umd/es6/debug/persisters/persister-browser/with-schemas/index.js +400 -0
  362. package/umd/es6/debug/persisters/persister-cr-sqlite-wasm/index.js +1295 -0
  363. package/umd/es6/debug/persisters/persister-cr-sqlite-wasm/with-schemas/index.js +1295 -0
  364. package/umd/es6/debug/persisters/persister-electric-sql/index.js +1303 -0
  365. package/umd/es6/debug/persisters/persister-electric-sql/with-schemas/index.js +1303 -0
  366. package/umd/es6/debug/persisters/persister-expo-sqlite/index.js +1295 -0
  367. package/umd/es6/debug/persisters/persister-expo-sqlite/with-schemas/index.js +1295 -0
  368. package/umd/es6/debug/persisters/persister-expo-sqlite-next/index.js +1299 -0
  369. package/umd/es6/debug/persisters/persister-expo-sqlite-next/with-schemas/index.js +1299 -0
  370. package/umd/es6/debug/persisters/persister-file/index.js +382 -0
  371. package/umd/es6/debug/persisters/persister-file/with-schemas/index.js +382 -0
  372. package/umd/es6/debug/persisters/persister-indexed-db/index.js +495 -0
  373. package/umd/es6/debug/persisters/persister-indexed-db/with-schemas/index.js +495 -0
  374. package/umd/es6/debug/persisters/persister-libsql/index.js +1296 -0
  375. package/umd/es6/debug/persisters/persister-libsql/with-schemas/index.js +1296 -0
  376. package/umd/es6/debug/persisters/persister-partykit-client/index.js +473 -0
  377. package/umd/es6/debug/persisters/persister-partykit-client/with-schemas/index.js +473 -0
  378. package/umd/es6/debug/persisters/persister-partykit-server/index.js +432 -0
  379. package/umd/es6/debug/persisters/persister-partykit-server/with-schemas/index.js +432 -0
  380. package/umd/es6/debug/persisters/persister-powersync/index.js +1355 -0
  381. package/umd/es6/debug/persisters/persister-powersync/with-schemas/index.js +1355 -0
  382. package/umd/es6/debug/persisters/persister-remote/index.js +403 -0
  383. package/umd/es6/debug/persisters/persister-remote/with-schemas/index.js +403 -0
  384. package/umd/es6/debug/persisters/persister-sqlite-wasm/index.js +1329 -0
  385. package/umd/es6/debug/persisters/persister-sqlite-wasm/with-schemas/index.js +1329 -0
  386. package/umd/es6/debug/persisters/persister-sqlite3/index.js +1305 -0
  387. package/umd/es6/debug/persisters/persister-sqlite3/with-schemas/index.js +1305 -0
  388. package/umd/es6/debug/persisters/persister-yjs/index.js +550 -0
  389. package/umd/es6/debug/persisters/persister-yjs/with-schemas/index.js +550 -0
  390. package/umd/es6/debug/persisters/with-schemas/index.js +316 -0
  391. package/umd/es6/debug/queries/index.js +875 -0
  392. package/umd/es6/debug/queries/with-schemas/index.js +875 -0
  393. package/umd/es6/debug/relationships/index.js +613 -0
  394. package/umd/es6/debug/relationships/with-schemas/index.js +613 -0
  395. package/umd/es6/debug/store/index.js +1770 -0
  396. package/umd/es6/debug/store/with-schemas/index.js +1770 -0
  397. package/umd/es6/debug/synchronizers/index.js +616 -0
  398. package/umd/es6/debug/synchronizers/synchronizer-local/index.js +652 -0
  399. package/umd/es6/debug/synchronizers/synchronizer-local/with-schemas/index.js +652 -0
  400. package/umd/es6/debug/synchronizers/synchronizer-ws-client/index.js +705 -0
  401. package/umd/es6/debug/synchronizers/synchronizer-ws-client/with-schemas/index.js +705 -0
  402. package/umd/es6/debug/synchronizers/synchronizer-ws-server/index.js +314 -0
  403. package/umd/es6/debug/synchronizers/synchronizer-ws-server/with-schemas/index.js +314 -0
  404. package/umd/es6/debug/synchronizers/with-schemas/index.js +616 -0
  405. package/umd/es6/debug/tools/index.js +3481 -0
  406. package/umd/es6/debug/tools/with-schemas/index.js +3481 -0
  407. package/umd/es6/debug/ui-react/index.js +2248 -0
  408. package/umd/es6/debug/ui-react/with-schemas/index.js +2248 -0
  409. package/umd/es6/debug/ui-react-dom/index.js +921 -0
  410. package/umd/es6/debug/ui-react-dom/with-schemas/index.js +921 -0
  411. package/umd/es6/debug/ui-react-inspector/index.js +3735 -0
  412. package/umd/es6/debug/ui-react-inspector/with-schemas/index.js +3735 -0
  413. package/umd/es6/debug/with-schemas/index.js +4456 -0
  414. package/cjs/@types/_internal/queries/index.d.ts +0 -0
  415. package/cjs/@types/_internal/queries/with-schemas/index.d.ts +0 -22
  416. package/cjs/@types/_internal/store/index.d.ts +0 -3
  417. package/cjs/@types/_internal/store/with-schemas/index.d.ts +0 -106
  418. package/cjs/@types/_internal/ui-react/index.d.ts +0 -0
  419. package/cjs/@types/_internal/ui-react/with-schemas/index.d.ts +0 -813
  420. package/cjs/@types/checkpoints/index.d.ts +0 -1033
  421. package/cjs/@types/checkpoints/with-schemas/index.d.ts +0 -1125
  422. package/cjs/@types/common/index.d.ts +0 -117
  423. package/cjs/@types/common/with-schemas/index.d.ts +0 -117
  424. package/cjs/@types/index.d.ts +0 -18
  425. package/cjs/@types/indexes/index.d.ts +0 -1037
  426. package/cjs/@types/indexes/with-schemas/index.d.ts +0 -1183
  427. package/cjs/@types/mergeable-store/index.d.ts +0 -222
  428. package/cjs/@types/mergeable-store/with-schemas/index.d.ts +0 -509
  429. package/cjs/@types/metrics/index.d.ts +0 -895
  430. package/cjs/@types/metrics/with-schemas/index.d.ts +0 -982
  431. package/cjs/@types/persisters/index.d.ts +0 -1319
  432. package/cjs/@types/persisters/persister-automerge/index.d.ts +0 -162
  433. package/cjs/@types/persisters/persister-automerge/with-schemas/index.d.ts +0 -177
  434. package/cjs/@types/persisters/persister-browser/index.d.ts +0 -174
  435. package/cjs/@types/persisters/persister-browser/with-schemas/index.d.ts +0 -199
  436. package/cjs/@types/persisters/persister-cr-sqlite-wasm/index.d.ts +0 -157
  437. package/cjs/@types/persisters/persister-cr-sqlite-wasm/with-schemas/index.d.ts +0 -176
  438. package/cjs/@types/persisters/persister-electric-sql/index.d.ts +0 -183
  439. package/cjs/@types/persisters/persister-electric-sql/with-schemas/index.d.ts +0 -202
  440. package/cjs/@types/persisters/persister-expo-sqlite/index.d.ts +0 -186
  441. package/cjs/@types/persisters/persister-expo-sqlite/with-schemas/index.d.ts +0 -205
  442. package/cjs/@types/persisters/persister-expo-sqlite-next/index.d.ts +0 -187
  443. package/cjs/@types/persisters/persister-expo-sqlite-next/with-schemas/index.d.ts +0 -206
  444. package/cjs/@types/persisters/persister-file/index.d.ts +0 -88
  445. package/cjs/@types/persisters/persister-file/with-schemas/index.d.ts +0 -102
  446. package/cjs/@types/persisters/persister-indexed-db/index.d.ts +0 -116
  447. package/cjs/@types/persisters/persister-indexed-db/with-schemas/index.d.ts +0 -131
  448. package/cjs/@types/persisters/persister-libsql/index.d.ts +0 -154
  449. package/cjs/@types/persisters/persister-libsql/with-schemas/index.d.ts +0 -173
  450. package/cjs/@types/persisters/persister-partykit-client/index.d.ts +0 -185
  451. package/cjs/@types/persisters/persister-partykit-client/with-schemas/index.d.ts +0 -200
  452. package/cjs/@types/persisters/persister-partykit-server/index.d.ts +0 -631
  453. package/cjs/@types/persisters/persister-partykit-server/with-schemas/index.d.ts +0 -673
  454. package/cjs/@types/persisters/persister-powersync/index.d.ts +0 -169
  455. package/cjs/@types/persisters/persister-powersync/with-schemas/index.d.ts +0 -188
  456. package/cjs/@types/persisters/persister-remote/index.d.ts +0 -113
  457. package/cjs/@types/persisters/persister-remote/with-schemas/index.d.ts +0 -129
  458. package/cjs/@types/persisters/persister-sqlite-wasm/index.d.ts +0 -170
  459. package/cjs/@types/persisters/persister-sqlite-wasm/with-schemas/index.d.ts +0 -190
  460. package/cjs/@types/persisters/persister-sqlite3/index.d.ts +0 -171
  461. package/cjs/@types/persisters/persister-sqlite3/with-schemas/index.d.ts +0 -190
  462. package/cjs/@types/persisters/persister-yjs/index.d.ts +0 -157
  463. package/cjs/@types/persisters/persister-yjs/with-schemas/index.d.ts +0 -172
  464. package/cjs/@types/persisters/with-schemas/index.d.ts +0 -1393
  465. package/cjs/@types/queries/index.d.ts +0 -3640
  466. package/cjs/@types/queries/with-schemas/index.d.ts +0 -3961
  467. package/cjs/@types/relationships/index.d.ts +0 -1266
  468. package/cjs/@types/relationships/with-schemas/index.d.ts +0 -1420
  469. package/cjs/@types/store/index.d.ts +0 -7453
  470. package/cjs/@types/store/with-schemas/index.d.ts +0 -9131
  471. package/cjs/@types/synchronizers/index.d.ts +0 -139
  472. package/cjs/@types/synchronizers/synchronizer-local/index.d.ts +0 -27
  473. package/cjs/@types/synchronizers/synchronizer-local/with-schemas/index.d.ts +0 -29
  474. package/cjs/@types/synchronizers/synchronizer-ws-client/index.d.ts +0 -36
  475. package/cjs/@types/synchronizers/synchronizer-ws-client/with-schemas/index.d.ts +0 -42
  476. package/cjs/@types/synchronizers/synchronizer-ws-server/index.d.ts +0 -58
  477. package/cjs/@types/synchronizers/synchronizer-ws-server/with-schemas/index.d.ts +0 -58
  478. package/cjs/@types/synchronizers/with-schemas/index.d.ts +0 -156
  479. package/cjs/@types/tools/index.d.ts +0 -556
  480. package/cjs/@types/tools/with-schemas/index.d.ts +0 -567
  481. package/cjs/@types/ui-react/index.d.ts +0 -15318
  482. package/cjs/@types/ui-react/with-schemas/index.d.ts +0 -16235
  483. package/cjs/@types/ui-react-dom/index.d.ts +0 -1751
  484. package/cjs/@types/ui-react-dom/with-schemas/index.d.ts +0 -1883
  485. package/cjs/@types/ui-react-inspector/index.d.ts +0 -77
  486. package/cjs/@types/ui-react-inspector/with-schemas/index.d.ts +0 -1871
  487. package/cjs/@types/with-schemas/index.d.ts +0 -18
  488. package/cjs-es6/@types/_internal/queries/with-schemas/index.d.ts +0 -22
  489. package/cjs-es6/@types/_internal/store/index.d.ts +0 -3
  490. package/cjs-es6/@types/_internal/store/with-schemas/index.d.ts +0 -106
  491. package/cjs-es6/@types/_internal/ui-react/with-schemas/index.d.ts +0 -813
  492. package/cjs-es6/@types/checkpoints/index.d.ts +0 -1033
  493. package/cjs-es6/@types/checkpoints/with-schemas/index.d.ts +0 -1125
  494. package/cjs-es6/@types/index.d.ts +0 -18
  495. package/cjs-es6/@types/indexes/index.d.ts +0 -1037
  496. package/cjs-es6/@types/indexes/with-schemas/index.d.ts +0 -1183
  497. package/cjs-es6/@types/mergeable-store/index.d.ts +0 -222
  498. package/cjs-es6/@types/mergeable-store/with-schemas/index.d.ts +0 -509
  499. package/cjs-es6/@types/metrics/index.d.ts +0 -895
  500. package/cjs-es6/@types/metrics/with-schemas/index.d.ts +0 -982
  501. package/cjs-es6/@types/persisters/index.d.ts +0 -1319
  502. package/cjs-es6/@types/persisters/persister-automerge/index.d.ts +0 -162
  503. package/cjs-es6/@types/persisters/persister-automerge/with-schemas/index.d.ts +0 -177
  504. package/cjs-es6/@types/persisters/persister-browser/index.d.ts +0 -174
  505. package/cjs-es6/@types/persisters/persister-browser/with-schemas/index.d.ts +0 -199
  506. package/cjs-es6/@types/persisters/persister-cr-sqlite-wasm/index.d.ts +0 -157
  507. package/cjs-es6/@types/persisters/persister-cr-sqlite-wasm/with-schemas/index.d.ts +0 -176
  508. package/cjs-es6/@types/persisters/persister-electric-sql/index.d.ts +0 -183
  509. package/cjs-es6/@types/persisters/persister-electric-sql/with-schemas/index.d.ts +0 -202
  510. package/cjs-es6/@types/persisters/persister-expo-sqlite/index.d.ts +0 -186
  511. package/cjs-es6/@types/persisters/persister-expo-sqlite/with-schemas/index.d.ts +0 -205
  512. package/cjs-es6/@types/persisters/persister-expo-sqlite-next/index.d.ts +0 -187
  513. package/cjs-es6/@types/persisters/persister-expo-sqlite-next/with-schemas/index.d.ts +0 -206
  514. package/cjs-es6/@types/persisters/persister-file/index.d.ts +0 -88
  515. package/cjs-es6/@types/persisters/persister-file/with-schemas/index.d.ts +0 -102
  516. package/cjs-es6/@types/persisters/persister-indexed-db/index.d.ts +0 -116
  517. package/cjs-es6/@types/persisters/persister-indexed-db/with-schemas/index.d.ts +0 -131
  518. package/cjs-es6/@types/persisters/persister-libsql/index.d.ts +0 -154
  519. package/cjs-es6/@types/persisters/persister-libsql/with-schemas/index.d.ts +0 -173
  520. package/cjs-es6/@types/persisters/persister-partykit-client/index.d.ts +0 -185
  521. package/cjs-es6/@types/persisters/persister-partykit-client/with-schemas/index.d.ts +0 -200
  522. package/cjs-es6/@types/persisters/persister-partykit-server/index.d.ts +0 -631
  523. package/cjs-es6/@types/persisters/persister-partykit-server/with-schemas/index.d.ts +0 -673
  524. package/cjs-es6/@types/persisters/persister-powersync/index.d.ts +0 -169
  525. package/cjs-es6/@types/persisters/persister-powersync/with-schemas/index.d.ts +0 -188
  526. package/cjs-es6/@types/persisters/persister-remote/index.d.ts +0 -113
  527. package/cjs-es6/@types/persisters/persister-remote/with-schemas/index.d.ts +0 -129
  528. package/cjs-es6/@types/persisters/persister-sqlite-wasm/index.d.ts +0 -170
  529. package/cjs-es6/@types/persisters/persister-sqlite-wasm/with-schemas/index.d.ts +0 -190
  530. package/cjs-es6/@types/persisters/persister-sqlite3/index.d.ts +0 -171
  531. package/cjs-es6/@types/persisters/persister-sqlite3/with-schemas/index.d.ts +0 -190
  532. package/cjs-es6/@types/persisters/persister-yjs/index.d.ts +0 -157
  533. package/cjs-es6/@types/persisters/persister-yjs/with-schemas/index.d.ts +0 -172
  534. package/cjs-es6/@types/persisters/with-schemas/index.d.ts +0 -1393
  535. package/cjs-es6/@types/queries/index.d.ts +0 -3640
  536. package/cjs-es6/@types/queries/with-schemas/index.d.ts +0 -3961
  537. package/cjs-es6/@types/relationships/index.d.ts +0 -1266
  538. package/cjs-es6/@types/relationships/with-schemas/index.d.ts +0 -1420
  539. package/cjs-es6/@types/store/index.d.ts +0 -7453
  540. package/cjs-es6/@types/store/with-schemas/index.d.ts +0 -9131
  541. package/cjs-es6/@types/synchronizers/index.d.ts +0 -139
  542. package/cjs-es6/@types/synchronizers/synchronizer-local/index.d.ts +0 -27
  543. package/cjs-es6/@types/synchronizers/synchronizer-local/with-schemas/index.d.ts +0 -29
  544. package/cjs-es6/@types/synchronizers/synchronizer-ws-client/index.d.ts +0 -36
  545. package/cjs-es6/@types/synchronizers/synchronizer-ws-client/with-schemas/index.d.ts +0 -42
  546. package/cjs-es6/@types/synchronizers/synchronizer-ws-server/index.d.ts +0 -58
  547. package/cjs-es6/@types/synchronizers/synchronizer-ws-server/with-schemas/index.d.ts +0 -58
  548. package/cjs-es6/@types/synchronizers/with-schemas/index.d.ts +0 -156
  549. package/cjs-es6/@types/tools/index.d.ts +0 -556
  550. package/cjs-es6/@types/tools/with-schemas/index.d.ts +0 -567
  551. package/cjs-es6/@types/ui-react/index.d.ts +0 -15318
  552. package/cjs-es6/@types/ui-react/with-schemas/index.d.ts +0 -16235
  553. package/cjs-es6/@types/ui-react-dom/index.d.ts +0 -1751
  554. package/cjs-es6/@types/ui-react-dom/with-schemas/index.d.ts +0 -1883
  555. package/cjs-es6/@types/ui-react-inspector/index.d.ts +0 -77
  556. package/cjs-es6/@types/ui-react-inspector/with-schemas/index.d.ts +0 -1871
  557. package/cjs-es6/@types/with-schemas/index.d.ts +0 -18
  558. package/es6/@types/_internal/queries/index.d.ts +0 -0
  559. package/es6/@types/_internal/queries/with-schemas/index.d.ts +0 -22
  560. package/es6/@types/_internal/store/index.d.ts +0 -3
  561. package/es6/@types/_internal/store/with-schemas/index.d.ts +0 -106
  562. package/es6/@types/_internal/ui-react/index.d.ts +0 -0
  563. package/es6/@types/_internal/ui-react/with-schemas/index.d.ts +0 -813
  564. package/es6/@types/checkpoints/index.d.ts +0 -1033
  565. package/es6/@types/checkpoints/with-schemas/index.d.ts +0 -1125
  566. package/es6/@types/common/index.d.ts +0 -117
  567. package/es6/@types/common/with-schemas/index.d.ts +0 -117
  568. package/es6/@types/index.d.ts +0 -18
  569. package/es6/@types/indexes/index.d.ts +0 -1037
  570. package/es6/@types/indexes/with-schemas/index.d.ts +0 -1183
  571. package/es6/@types/mergeable-store/index.d.ts +0 -222
  572. package/es6/@types/mergeable-store/with-schemas/index.d.ts +0 -509
  573. package/es6/@types/metrics/index.d.ts +0 -895
  574. package/es6/@types/metrics/with-schemas/index.d.ts +0 -982
  575. package/es6/@types/persisters/index.d.ts +0 -1319
  576. package/es6/@types/persisters/persister-automerge/index.d.ts +0 -162
  577. package/es6/@types/persisters/persister-automerge/with-schemas/index.d.ts +0 -177
  578. package/es6/@types/persisters/persister-browser/index.d.ts +0 -174
  579. package/es6/@types/persisters/persister-browser/with-schemas/index.d.ts +0 -199
  580. package/es6/@types/persisters/persister-cr-sqlite-wasm/index.d.ts +0 -157
  581. package/es6/@types/persisters/persister-cr-sqlite-wasm/with-schemas/index.d.ts +0 -176
  582. package/es6/@types/persisters/persister-electric-sql/index.d.ts +0 -183
  583. package/es6/@types/persisters/persister-electric-sql/with-schemas/index.d.ts +0 -202
  584. package/es6/@types/persisters/persister-expo-sqlite/index.d.ts +0 -186
  585. package/es6/@types/persisters/persister-expo-sqlite/with-schemas/index.d.ts +0 -205
  586. package/es6/@types/persisters/persister-expo-sqlite-next/index.d.ts +0 -187
  587. package/es6/@types/persisters/persister-expo-sqlite-next/with-schemas/index.d.ts +0 -206
  588. package/es6/@types/persisters/persister-file/index.d.ts +0 -88
  589. package/es6/@types/persisters/persister-file/with-schemas/index.d.ts +0 -102
  590. package/es6/@types/persisters/persister-indexed-db/index.d.ts +0 -116
  591. package/es6/@types/persisters/persister-indexed-db/with-schemas/index.d.ts +0 -131
  592. package/es6/@types/persisters/persister-libsql/index.d.ts +0 -154
  593. package/es6/@types/persisters/persister-libsql/with-schemas/index.d.ts +0 -173
  594. package/es6/@types/persisters/persister-partykit-client/index.d.ts +0 -185
  595. package/es6/@types/persisters/persister-partykit-client/with-schemas/index.d.ts +0 -200
  596. package/es6/@types/persisters/persister-partykit-server/index.d.ts +0 -631
  597. package/es6/@types/persisters/persister-partykit-server/with-schemas/index.d.ts +0 -673
  598. package/es6/@types/persisters/persister-powersync/index.d.ts +0 -169
  599. package/es6/@types/persisters/persister-powersync/with-schemas/index.d.ts +0 -188
  600. package/es6/@types/persisters/persister-remote/index.d.ts +0 -113
  601. package/es6/@types/persisters/persister-remote/with-schemas/index.d.ts +0 -129
  602. package/es6/@types/persisters/persister-sqlite-wasm/index.d.ts +0 -170
  603. package/es6/@types/persisters/persister-sqlite-wasm/with-schemas/index.d.ts +0 -190
  604. package/es6/@types/persisters/persister-sqlite3/index.d.ts +0 -171
  605. package/es6/@types/persisters/persister-sqlite3/with-schemas/index.d.ts +0 -190
  606. package/es6/@types/persisters/persister-yjs/index.d.ts +0 -157
  607. package/es6/@types/persisters/persister-yjs/with-schemas/index.d.ts +0 -172
  608. package/es6/@types/persisters/with-schemas/index.d.ts +0 -1393
  609. package/es6/@types/queries/index.d.ts +0 -3640
  610. package/es6/@types/queries/with-schemas/index.d.ts +0 -3961
  611. package/es6/@types/relationships/index.d.ts +0 -1266
  612. package/es6/@types/relationships/with-schemas/index.d.ts +0 -1420
  613. package/es6/@types/store/index.d.ts +0 -7453
  614. package/es6/@types/store/with-schemas/index.d.ts +0 -9131
  615. package/es6/@types/synchronizers/index.d.ts +0 -139
  616. package/es6/@types/synchronizers/synchronizer-local/index.d.ts +0 -27
  617. package/es6/@types/synchronizers/synchronizer-local/with-schemas/index.d.ts +0 -29
  618. package/es6/@types/synchronizers/synchronizer-ws-client/index.d.ts +0 -36
  619. package/es6/@types/synchronizers/synchronizer-ws-client/with-schemas/index.d.ts +0 -42
  620. package/es6/@types/synchronizers/synchronizer-ws-server/index.d.ts +0 -58
  621. package/es6/@types/synchronizers/synchronizer-ws-server/with-schemas/index.d.ts +0 -58
  622. package/es6/@types/synchronizers/with-schemas/index.d.ts +0 -156
  623. package/es6/@types/tools/index.d.ts +0 -556
  624. package/es6/@types/tools/with-schemas/index.d.ts +0 -567
  625. package/es6/@types/ui-react/index.d.ts +0 -15318
  626. package/es6/@types/ui-react/with-schemas/index.d.ts +0 -16235
  627. package/es6/@types/ui-react-dom/index.d.ts +0 -1751
  628. package/es6/@types/ui-react-dom/with-schemas/index.d.ts +0 -1883
  629. package/es6/@types/ui-react-inspector/index.d.ts +0 -77
  630. package/es6/@types/ui-react-inspector/with-schemas/index.d.ts +0 -1871
  631. package/es6/@types/with-schemas/index.d.ts +0 -18
  632. package/umd/@types/_internal/queries/index.d.ts +0 -0
  633. package/umd/@types/_internal/queries/with-schemas/index.d.ts +0 -22
  634. package/umd/@types/_internal/store/index.d.ts +0 -3
  635. package/umd/@types/_internal/store/with-schemas/index.d.ts +0 -106
  636. package/umd/@types/_internal/ui-react/index.d.ts +0 -0
  637. package/umd/@types/_internal/ui-react/with-schemas/index.d.ts +0 -813
  638. package/umd/@types/checkpoints/index.d.ts +0 -1033
  639. package/umd/@types/checkpoints/with-schemas/index.d.ts +0 -1125
  640. package/umd/@types/common/index.d.ts +0 -117
  641. package/umd/@types/common/with-schemas/index.d.ts +0 -117
  642. package/umd/@types/index.d.ts +0 -18
  643. package/umd/@types/indexes/index.d.ts +0 -1037
  644. package/umd/@types/indexes/with-schemas/index.d.ts +0 -1183
  645. package/umd/@types/mergeable-store/index.d.ts +0 -222
  646. package/umd/@types/mergeable-store/with-schemas/index.d.ts +0 -509
  647. package/umd/@types/metrics/index.d.ts +0 -895
  648. package/umd/@types/metrics/with-schemas/index.d.ts +0 -982
  649. package/umd/@types/persisters/index.d.ts +0 -1319
  650. package/umd/@types/persisters/persister-automerge/index.d.ts +0 -162
  651. package/umd/@types/persisters/persister-automerge/with-schemas/index.d.ts +0 -177
  652. package/umd/@types/persisters/persister-browser/index.d.ts +0 -174
  653. package/umd/@types/persisters/persister-browser/with-schemas/index.d.ts +0 -199
  654. package/umd/@types/persisters/persister-cr-sqlite-wasm/index.d.ts +0 -157
  655. package/umd/@types/persisters/persister-cr-sqlite-wasm/with-schemas/index.d.ts +0 -176
  656. package/umd/@types/persisters/persister-electric-sql/index.d.ts +0 -183
  657. package/umd/@types/persisters/persister-electric-sql/with-schemas/index.d.ts +0 -202
  658. package/umd/@types/persisters/persister-expo-sqlite/index.d.ts +0 -186
  659. package/umd/@types/persisters/persister-expo-sqlite/with-schemas/index.d.ts +0 -205
  660. package/umd/@types/persisters/persister-expo-sqlite-next/index.d.ts +0 -187
  661. package/umd/@types/persisters/persister-expo-sqlite-next/with-schemas/index.d.ts +0 -206
  662. package/umd/@types/persisters/persister-file/index.d.ts +0 -88
  663. package/umd/@types/persisters/persister-file/with-schemas/index.d.ts +0 -102
  664. package/umd/@types/persisters/persister-indexed-db/index.d.ts +0 -116
  665. package/umd/@types/persisters/persister-indexed-db/with-schemas/index.d.ts +0 -131
  666. package/umd/@types/persisters/persister-libsql/index.d.ts +0 -154
  667. package/umd/@types/persisters/persister-libsql/with-schemas/index.d.ts +0 -173
  668. package/umd/@types/persisters/persister-partykit-client/index.d.ts +0 -185
  669. package/umd/@types/persisters/persister-partykit-client/with-schemas/index.d.ts +0 -200
  670. package/umd/@types/persisters/persister-partykit-server/index.d.ts +0 -631
  671. package/umd/@types/persisters/persister-partykit-server/with-schemas/index.d.ts +0 -673
  672. package/umd/@types/persisters/persister-powersync/index.d.ts +0 -169
  673. package/umd/@types/persisters/persister-powersync/with-schemas/index.d.ts +0 -188
  674. package/umd/@types/persisters/persister-remote/index.d.ts +0 -113
  675. package/umd/@types/persisters/persister-remote/with-schemas/index.d.ts +0 -129
  676. package/umd/@types/persisters/persister-sqlite-wasm/index.d.ts +0 -170
  677. package/umd/@types/persisters/persister-sqlite-wasm/with-schemas/index.d.ts +0 -190
  678. package/umd/@types/persisters/persister-sqlite3/index.d.ts +0 -171
  679. package/umd/@types/persisters/persister-sqlite3/with-schemas/index.d.ts +0 -190
  680. package/umd/@types/persisters/persister-yjs/index.d.ts +0 -157
  681. package/umd/@types/persisters/persister-yjs/with-schemas/index.d.ts +0 -172
  682. package/umd/@types/persisters/with-schemas/index.d.ts +0 -1393
  683. package/umd/@types/queries/index.d.ts +0 -3640
  684. package/umd/@types/queries/with-schemas/index.d.ts +0 -3961
  685. package/umd/@types/relationships/index.d.ts +0 -1266
  686. package/umd/@types/relationships/with-schemas/index.d.ts +0 -1420
  687. package/umd/@types/store/index.d.ts +0 -7453
  688. package/umd/@types/store/with-schemas/index.d.ts +0 -9131
  689. package/umd/@types/synchronizers/index.d.ts +0 -139
  690. package/umd/@types/synchronizers/synchronizer-local/index.d.ts +0 -27
  691. package/umd/@types/synchronizers/synchronizer-local/with-schemas/index.d.ts +0 -29
  692. package/umd/@types/synchronizers/synchronizer-ws-client/index.d.ts +0 -36
  693. package/umd/@types/synchronizers/synchronizer-ws-client/with-schemas/index.d.ts +0 -42
  694. package/umd/@types/synchronizers/synchronizer-ws-server/index.d.ts +0 -58
  695. package/umd/@types/synchronizers/synchronizer-ws-server/with-schemas/index.d.ts +0 -58
  696. package/umd/@types/synchronizers/with-schemas/index.d.ts +0 -156
  697. package/umd/@types/tools/index.d.ts +0 -556
  698. package/umd/@types/tools/with-schemas/index.d.ts +0 -567
  699. package/umd/@types/ui-react/index.d.ts +0 -15318
  700. package/umd/@types/ui-react/with-schemas/index.d.ts +0 -16235
  701. package/umd/@types/ui-react-dom/index.d.ts +0 -1751
  702. package/umd/@types/ui-react-dom/with-schemas/index.d.ts +0 -1883
  703. package/umd/@types/ui-react-inspector/index.d.ts +0 -77
  704. package/umd/@types/ui-react-inspector/with-schemas/index.d.ts +0 -1871
  705. package/umd/@types/with-schemas/index.d.ts +0 -18
  706. package/umd-es6/@types/_internal/queries/index.d.ts +0 -0
  707. package/umd-es6/@types/_internal/queries/with-schemas/index.d.ts +0 -22
  708. package/umd-es6/@types/_internal/store/index.d.ts +0 -3
  709. package/umd-es6/@types/_internal/store/with-schemas/index.d.ts +0 -106
  710. package/umd-es6/@types/_internal/ui-react/index.d.ts +0 -0
  711. package/umd-es6/@types/_internal/ui-react/with-schemas/index.d.ts +0 -813
  712. package/umd-es6/@types/checkpoints/index.d.ts +0 -1033
  713. package/umd-es6/@types/checkpoints/with-schemas/index.d.ts +0 -1125
  714. package/umd-es6/@types/common/index.d.ts +0 -117
  715. package/umd-es6/@types/common/with-schemas/index.d.ts +0 -117
  716. package/umd-es6/@types/index.d.ts +0 -18
  717. package/umd-es6/@types/indexes/index.d.ts +0 -1037
  718. package/umd-es6/@types/indexes/with-schemas/index.d.ts +0 -1183
  719. package/umd-es6/@types/mergeable-store/index.d.ts +0 -222
  720. package/umd-es6/@types/mergeable-store/with-schemas/index.d.ts +0 -509
  721. package/umd-es6/@types/metrics/index.d.ts +0 -895
  722. package/umd-es6/@types/metrics/with-schemas/index.d.ts +0 -982
  723. package/umd-es6/@types/persisters/index.d.ts +0 -1319
  724. package/umd-es6/@types/persisters/persister-automerge/index.d.ts +0 -162
  725. package/umd-es6/@types/persisters/persister-automerge/with-schemas/index.d.ts +0 -177
  726. package/umd-es6/@types/persisters/persister-browser/index.d.ts +0 -174
  727. package/umd-es6/@types/persisters/persister-browser/with-schemas/index.d.ts +0 -199
  728. package/umd-es6/@types/persisters/persister-cr-sqlite-wasm/index.d.ts +0 -157
  729. package/umd-es6/@types/persisters/persister-cr-sqlite-wasm/with-schemas/index.d.ts +0 -176
  730. package/umd-es6/@types/persisters/persister-electric-sql/index.d.ts +0 -183
  731. package/umd-es6/@types/persisters/persister-electric-sql/with-schemas/index.d.ts +0 -202
  732. package/umd-es6/@types/persisters/persister-expo-sqlite/index.d.ts +0 -186
  733. package/umd-es6/@types/persisters/persister-expo-sqlite/with-schemas/index.d.ts +0 -205
  734. package/umd-es6/@types/persisters/persister-expo-sqlite-next/index.d.ts +0 -187
  735. package/umd-es6/@types/persisters/persister-expo-sqlite-next/with-schemas/index.d.ts +0 -206
  736. package/umd-es6/@types/persisters/persister-file/index.d.ts +0 -88
  737. package/umd-es6/@types/persisters/persister-file/with-schemas/index.d.ts +0 -102
  738. package/umd-es6/@types/persisters/persister-indexed-db/index.d.ts +0 -116
  739. package/umd-es6/@types/persisters/persister-indexed-db/with-schemas/index.d.ts +0 -131
  740. package/umd-es6/@types/persisters/persister-libsql/index.d.ts +0 -154
  741. package/umd-es6/@types/persisters/persister-libsql/with-schemas/index.d.ts +0 -173
  742. package/umd-es6/@types/persisters/persister-partykit-client/index.d.ts +0 -185
  743. package/umd-es6/@types/persisters/persister-partykit-client/with-schemas/index.d.ts +0 -200
  744. package/umd-es6/@types/persisters/persister-partykit-server/index.d.ts +0 -631
  745. package/umd-es6/@types/persisters/persister-partykit-server/with-schemas/index.d.ts +0 -673
  746. package/umd-es6/@types/persisters/persister-powersync/index.d.ts +0 -169
  747. package/umd-es6/@types/persisters/persister-powersync/with-schemas/index.d.ts +0 -188
  748. package/umd-es6/@types/persisters/persister-remote/index.d.ts +0 -113
  749. package/umd-es6/@types/persisters/persister-remote/with-schemas/index.d.ts +0 -129
  750. package/umd-es6/@types/persisters/persister-sqlite-wasm/index.d.ts +0 -170
  751. package/umd-es6/@types/persisters/persister-sqlite-wasm/with-schemas/index.d.ts +0 -190
  752. package/umd-es6/@types/persisters/persister-sqlite3/index.d.ts +0 -171
  753. package/umd-es6/@types/persisters/persister-sqlite3/with-schemas/index.d.ts +0 -190
  754. package/umd-es6/@types/persisters/persister-yjs/index.d.ts +0 -157
  755. package/umd-es6/@types/persisters/persister-yjs/with-schemas/index.d.ts +0 -172
  756. package/umd-es6/@types/persisters/with-schemas/index.d.ts +0 -1393
  757. package/umd-es6/@types/queries/index.d.ts +0 -3640
  758. package/umd-es6/@types/queries/with-schemas/index.d.ts +0 -3961
  759. package/umd-es6/@types/relationships/index.d.ts +0 -1266
  760. package/umd-es6/@types/relationships/with-schemas/index.d.ts +0 -1420
  761. package/umd-es6/@types/store/index.d.ts +0 -7453
  762. package/umd-es6/@types/store/with-schemas/index.d.ts +0 -9131
  763. package/umd-es6/@types/synchronizers/index.d.ts +0 -139
  764. package/umd-es6/@types/synchronizers/synchronizer-local/index.d.ts +0 -27
  765. package/umd-es6/@types/synchronizers/synchronizer-local/with-schemas/index.d.ts +0 -29
  766. package/umd-es6/@types/synchronizers/synchronizer-ws-client/index.d.ts +0 -36
  767. package/umd-es6/@types/synchronizers/synchronizer-ws-client/with-schemas/index.d.ts +0 -42
  768. package/umd-es6/@types/synchronizers/synchronizer-ws-server/index.d.ts +0 -58
  769. package/umd-es6/@types/synchronizers/synchronizer-ws-server/with-schemas/index.d.ts +0 -58
  770. package/umd-es6/@types/synchronizers/with-schemas/index.d.ts +0 -156
  771. package/umd-es6/@types/tools/index.d.ts +0 -556
  772. package/umd-es6/@types/tools/with-schemas/index.d.ts +0 -567
  773. package/umd-es6/@types/ui-react/index.d.ts +0 -15318
  774. package/umd-es6/@types/ui-react/with-schemas/index.d.ts +0 -16235
  775. package/umd-es6/@types/ui-react-dom/index.d.ts +0 -1751
  776. package/umd-es6/@types/ui-react-dom/with-schemas/index.d.ts +0 -1883
  777. package/umd-es6/@types/ui-react-inspector/index.d.ts +0 -77
  778. package/umd-es6/@types/ui-react-inspector/with-schemas/index.d.ts +0 -1871
  779. package/umd-es6/@types/with-schemas/index.d.ts +0 -18
  780. /package/{cjs-es6/@types/_internal/queries/index.d.ts → @types/_internal/queries/index.d.cts} +0 -0
  781. /package/{cjs-es6/@types/_internal/ui-react/index.d.ts → @types/_internal/ui-react/index.d.cts} +0 -0
  782. /package/{cjs-es6/@types/common/index.d.ts → @types/common/index.d.cts} +0 -0
  783. /package/{cjs-es6/@types/common/with-schemas/index.d.ts → @types/common/with-schemas/index.d.cts} +0 -0
  784. /package/{cjs-es6 → cjs/es6}/checkpoints/index.cjs +0 -0
  785. /package/{cjs-es6 → cjs/es6}/checkpoints/index.cjs.gz +0 -0
  786. /package/{cjs-es6 → cjs/es6}/checkpoints/with-schemas/index.cjs +0 -0
  787. /package/{cjs-es6 → cjs/es6}/common/index.cjs +0 -0
  788. /package/{cjs-es6 → cjs/es6}/common/index.cjs.gz +0 -0
  789. /package/{cjs-es6 → cjs/es6}/common/with-schemas/index.cjs +0 -0
  790. /package/{cjs-es6 → cjs/es6}/index.cjs +0 -0
  791. /package/{cjs-es6 → cjs/es6}/index.cjs.gz +0 -0
  792. /package/{cjs-es6 → cjs/es6}/indexes/index.cjs +0 -0
  793. /package/{cjs-es6 → cjs/es6}/indexes/index.cjs.gz +0 -0
  794. /package/{cjs-es6 → cjs/es6}/indexes/with-schemas/index.cjs +0 -0
  795. /package/{cjs-es6 → cjs/es6}/mergeable-store/index.cjs +0 -0
  796. /package/{cjs-es6 → cjs/es6}/mergeable-store/index.cjs.gz +0 -0
  797. /package/{cjs-es6 → cjs/es6}/mergeable-store/with-schemas/index.cjs +0 -0
  798. /package/{cjs-es6 → cjs/es6}/metrics/index.cjs +0 -0
  799. /package/{cjs-es6 → cjs/es6}/metrics/index.cjs.gz +0 -0
  800. /package/{cjs-es6 → cjs/es6}/metrics/with-schemas/index.cjs +0 -0
  801. /package/{cjs-es6 → cjs/es6}/persisters/index.cjs +0 -0
  802. /package/{cjs-es6 → cjs/es6}/persisters/index.cjs.gz +0 -0
  803. /package/{cjs-es6 → cjs/es6}/persisters/persister-automerge/index.cjs +0 -0
  804. /package/{cjs-es6 → cjs/es6}/persisters/persister-automerge/index.cjs.gz +0 -0
  805. /package/{cjs-es6 → cjs/es6}/persisters/persister-automerge/with-schemas/index.cjs +0 -0
  806. /package/{cjs-es6 → cjs/es6}/persisters/persister-browser/index.cjs +0 -0
  807. /package/{cjs-es6 → cjs/es6}/persisters/persister-browser/index.cjs.gz +0 -0
  808. /package/{cjs-es6 → cjs/es6}/persisters/persister-browser/with-schemas/index.cjs +0 -0
  809. /package/{cjs-es6 → cjs/es6}/persisters/persister-cr-sqlite-wasm/index.cjs +0 -0
  810. /package/{cjs-es6 → cjs/es6}/persisters/persister-cr-sqlite-wasm/index.cjs.gz +0 -0
  811. /package/{cjs-es6 → cjs/es6}/persisters/persister-cr-sqlite-wasm/with-schemas/index.cjs +0 -0
  812. /package/{cjs-es6 → cjs/es6}/persisters/persister-electric-sql/index.cjs +0 -0
  813. /package/{cjs-es6 → cjs/es6}/persisters/persister-electric-sql/index.cjs.gz +0 -0
  814. /package/{cjs-es6 → cjs/es6}/persisters/persister-electric-sql/with-schemas/index.cjs +0 -0
  815. /package/{cjs-es6 → cjs/es6}/persisters/persister-expo-sqlite/index.cjs +0 -0
  816. /package/{cjs-es6 → cjs/es6}/persisters/persister-expo-sqlite/index.cjs.gz +0 -0
  817. /package/{cjs-es6 → cjs/es6}/persisters/persister-expo-sqlite/with-schemas/index.cjs +0 -0
  818. /package/{cjs-es6 → cjs/es6}/persisters/persister-expo-sqlite-next/index.cjs +0 -0
  819. /package/{cjs-es6 → cjs/es6}/persisters/persister-expo-sqlite-next/index.cjs.gz +0 -0
  820. /package/{cjs-es6 → cjs/es6}/persisters/persister-expo-sqlite-next/with-schemas/index.cjs +0 -0
  821. /package/{cjs-es6 → cjs/es6}/persisters/persister-file/index.cjs +0 -0
  822. /package/{cjs-es6 → cjs/es6}/persisters/persister-file/index.cjs.gz +0 -0
  823. /package/{cjs-es6 → cjs/es6}/persisters/persister-file/with-schemas/index.cjs +0 -0
  824. /package/{cjs-es6 → cjs/es6}/persisters/persister-indexed-db/index.cjs +0 -0
  825. /package/{cjs-es6 → cjs/es6}/persisters/persister-indexed-db/index.cjs.gz +0 -0
  826. /package/{cjs-es6 → cjs/es6}/persisters/persister-indexed-db/with-schemas/index.cjs +0 -0
  827. /package/{cjs-es6 → cjs/es6}/persisters/persister-libsql/index.cjs +0 -0
  828. /package/{cjs-es6 → cjs/es6}/persisters/persister-libsql/index.cjs.gz +0 -0
  829. /package/{cjs-es6 → cjs/es6}/persisters/persister-libsql/with-schemas/index.cjs +0 -0
  830. /package/{cjs-es6 → cjs/es6}/persisters/persister-partykit-client/index.cjs +0 -0
  831. /package/{cjs-es6 → cjs/es6}/persisters/persister-partykit-client/index.cjs.gz +0 -0
  832. /package/{cjs-es6 → cjs/es6}/persisters/persister-partykit-client/with-schemas/index.cjs +0 -0
  833. /package/{cjs-es6 → cjs/es6}/persisters/persister-partykit-server/index.cjs +0 -0
  834. /package/{cjs-es6 → cjs/es6}/persisters/persister-partykit-server/index.cjs.gz +0 -0
  835. /package/{cjs-es6 → cjs/es6}/persisters/persister-partykit-server/with-schemas/index.cjs +0 -0
  836. /package/{cjs-es6 → cjs/es6}/persisters/persister-powersync/index.cjs +0 -0
  837. /package/{cjs-es6 → cjs/es6}/persisters/persister-powersync/index.cjs.gz +0 -0
  838. /package/{cjs-es6 → cjs/es6}/persisters/persister-powersync/with-schemas/index.cjs +0 -0
  839. /package/{cjs-es6 → cjs/es6}/persisters/persister-remote/index.cjs +0 -0
  840. /package/{cjs-es6 → cjs/es6}/persisters/persister-remote/index.cjs.gz +0 -0
  841. /package/{cjs-es6 → cjs/es6}/persisters/persister-remote/with-schemas/index.cjs +0 -0
  842. /package/{cjs-es6 → cjs/es6}/persisters/persister-sqlite-wasm/index.cjs +0 -0
  843. /package/{cjs-es6 → cjs/es6}/persisters/persister-sqlite-wasm/index.cjs.gz +0 -0
  844. /package/{cjs-es6 → cjs/es6}/persisters/persister-sqlite-wasm/with-schemas/index.cjs +0 -0
  845. /package/{cjs-es6 → cjs/es6}/persisters/persister-sqlite3/index.cjs +0 -0
  846. /package/{cjs-es6 → cjs/es6}/persisters/persister-sqlite3/index.cjs.gz +0 -0
  847. /package/{cjs-es6 → cjs/es6}/persisters/persister-sqlite3/with-schemas/index.cjs +0 -0
  848. /package/{cjs-es6 → cjs/es6}/persisters/persister-yjs/index.cjs +0 -0
  849. /package/{cjs-es6 → cjs/es6}/persisters/persister-yjs/index.cjs.gz +0 -0
  850. /package/{cjs-es6 → cjs/es6}/persisters/persister-yjs/with-schemas/index.cjs +0 -0
  851. /package/{cjs-es6 → cjs/es6}/persisters/with-schemas/index.cjs +0 -0
  852. /package/{cjs-es6 → cjs/es6}/queries/index.cjs +0 -0
  853. /package/{cjs-es6 → cjs/es6}/queries/index.cjs.gz +0 -0
  854. /package/{cjs-es6 → cjs/es6}/queries/with-schemas/index.cjs +0 -0
  855. /package/{cjs-es6 → cjs/es6}/relationships/index.cjs +0 -0
  856. /package/{cjs-es6 → cjs/es6}/relationships/index.cjs.gz +0 -0
  857. /package/{cjs-es6 → cjs/es6}/relationships/with-schemas/index.cjs +0 -0
  858. /package/{cjs-es6 → cjs/es6}/store/index.cjs +0 -0
  859. /package/{cjs-es6 → cjs/es6}/store/index.cjs.gz +0 -0
  860. /package/{cjs-es6 → cjs/es6}/store/with-schemas/index.cjs +0 -0
  861. /package/{cjs-es6 → cjs/es6}/synchronizers/index.cjs +0 -0
  862. /package/{cjs-es6 → cjs/es6}/synchronizers/index.cjs.gz +0 -0
  863. /package/{cjs-es6 → cjs/es6}/synchronizers/synchronizer-local/index.cjs +0 -0
  864. /package/{cjs-es6 → cjs/es6}/synchronizers/synchronizer-local/index.cjs.gz +0 -0
  865. /package/{cjs-es6 → cjs/es6}/synchronizers/synchronizer-local/with-schemas/index.cjs +0 -0
  866. /package/{cjs-es6 → cjs/es6}/synchronizers/synchronizer-ws-client/index.cjs +0 -0
  867. /package/{cjs-es6 → cjs/es6}/synchronizers/synchronizer-ws-client/index.cjs.gz +0 -0
  868. /package/{cjs-es6 → cjs/es6}/synchronizers/synchronizer-ws-client/with-schemas/index.cjs +0 -0
  869. /package/{cjs-es6 → cjs/es6}/synchronizers/synchronizer-ws-server/index.cjs +0 -0
  870. /package/{cjs-es6 → cjs/es6}/synchronizers/synchronizer-ws-server/index.cjs.gz +0 -0
  871. /package/{cjs-es6 → cjs/es6}/synchronizers/synchronizer-ws-server/with-schemas/index.cjs +0 -0
  872. /package/{cjs-es6 → cjs/es6}/synchronizers/with-schemas/index.cjs +0 -0
  873. /package/{cjs-es6 → cjs/es6}/tools/index.cjs +0 -0
  874. /package/{cjs-es6 → cjs/es6}/tools/index.cjs.gz +0 -0
  875. /package/{cjs-es6 → cjs/es6}/tools/with-schemas/index.cjs +0 -0
  876. /package/{cjs-es6 → cjs/es6}/ui-react/index.cjs +0 -0
  877. /package/{cjs-es6 → cjs/es6}/ui-react/index.cjs.gz +0 -0
  878. /package/{cjs-es6 → cjs/es6}/ui-react/with-schemas/index.cjs +0 -0
  879. /package/{cjs-es6 → cjs/es6}/ui-react-dom/index.cjs +0 -0
  880. /package/{cjs-es6 → cjs/es6}/ui-react-dom/index.cjs.gz +0 -0
  881. /package/{cjs-es6 → cjs/es6}/ui-react-dom/with-schemas/index.cjs +0 -0
  882. /package/{cjs-es6 → cjs/es6}/ui-react-inspector/index.cjs +0 -0
  883. /package/{cjs-es6 → cjs/es6}/ui-react-inspector/index.cjs.gz +0 -0
  884. /package/{cjs-es6 → cjs/es6}/ui-react-inspector/with-schemas/index.cjs +0 -0
  885. /package/{cjs-es6 → cjs/es6}/with-schemas/index.cjs +0 -0
  886. /package/{umd-es6 → umd/es6}/checkpoints/index.js +0 -0
  887. /package/{umd-es6 → umd/es6}/checkpoints/index.js.gz +0 -0
  888. /package/{umd-es6 → umd/es6}/checkpoints/with-schemas/index.js +0 -0
  889. /package/{umd-es6 → umd/es6}/common/index.js +0 -0
  890. /package/{umd-es6 → umd/es6}/common/index.js.gz +0 -0
  891. /package/{umd-es6 → umd/es6}/common/with-schemas/index.js +0 -0
  892. /package/{umd-es6 → umd/es6}/index.js +0 -0
  893. /package/{umd-es6 → umd/es6}/index.js.gz +0 -0
  894. /package/{umd-es6 → umd/es6}/indexes/index.js +0 -0
  895. /package/{umd-es6 → umd/es6}/indexes/index.js.gz +0 -0
  896. /package/{umd-es6 → umd/es6}/indexes/with-schemas/index.js +0 -0
  897. /package/{umd-es6 → umd/es6}/mergeable-store/index.js +0 -0
  898. /package/{umd-es6 → umd/es6}/mergeable-store/index.js.gz +0 -0
  899. /package/{umd-es6 → umd/es6}/mergeable-store/with-schemas/index.js +0 -0
  900. /package/{umd-es6 → umd/es6}/metrics/index.js +0 -0
  901. /package/{umd-es6 → umd/es6}/metrics/index.js.gz +0 -0
  902. /package/{umd-es6 → umd/es6}/metrics/with-schemas/index.js +0 -0
  903. /package/{umd-es6 → umd/es6}/persisters/index.js +0 -0
  904. /package/{umd-es6 → umd/es6}/persisters/index.js.gz +0 -0
  905. /package/{umd-es6 → umd/es6}/persisters/persister-automerge/index.js +0 -0
  906. /package/{umd-es6 → umd/es6}/persisters/persister-automerge/index.js.gz +0 -0
  907. /package/{umd-es6 → umd/es6}/persisters/persister-automerge/with-schemas/index.js +0 -0
  908. /package/{umd-es6 → umd/es6}/persisters/persister-browser/index.js +0 -0
  909. /package/{umd-es6 → umd/es6}/persisters/persister-browser/index.js.gz +0 -0
  910. /package/{umd-es6 → umd/es6}/persisters/persister-browser/with-schemas/index.js +0 -0
  911. /package/{umd-es6 → umd/es6}/persisters/persister-cr-sqlite-wasm/index.js +0 -0
  912. /package/{umd-es6 → umd/es6}/persisters/persister-cr-sqlite-wasm/index.js.gz +0 -0
  913. /package/{umd-es6 → umd/es6}/persisters/persister-cr-sqlite-wasm/with-schemas/index.js +0 -0
  914. /package/{umd-es6 → umd/es6}/persisters/persister-electric-sql/index.js +0 -0
  915. /package/{umd-es6 → umd/es6}/persisters/persister-electric-sql/index.js.gz +0 -0
  916. /package/{umd-es6 → umd/es6}/persisters/persister-electric-sql/with-schemas/index.js +0 -0
  917. /package/{umd-es6 → umd/es6}/persisters/persister-expo-sqlite/index.js +0 -0
  918. /package/{umd-es6 → umd/es6}/persisters/persister-expo-sqlite/index.js.gz +0 -0
  919. /package/{umd-es6 → umd/es6}/persisters/persister-expo-sqlite/with-schemas/index.js +0 -0
  920. /package/{umd-es6 → umd/es6}/persisters/persister-expo-sqlite-next/index.js +0 -0
  921. /package/{umd-es6 → umd/es6}/persisters/persister-expo-sqlite-next/index.js.gz +0 -0
  922. /package/{umd-es6 → umd/es6}/persisters/persister-expo-sqlite-next/with-schemas/index.js +0 -0
  923. /package/{umd-es6 → umd/es6}/persisters/persister-file/index.js +0 -0
  924. /package/{umd-es6 → umd/es6}/persisters/persister-file/index.js.gz +0 -0
  925. /package/{umd-es6 → umd/es6}/persisters/persister-file/with-schemas/index.js +0 -0
  926. /package/{umd-es6 → umd/es6}/persisters/persister-indexed-db/index.js +0 -0
  927. /package/{umd-es6 → umd/es6}/persisters/persister-indexed-db/index.js.gz +0 -0
  928. /package/{umd-es6 → umd/es6}/persisters/persister-indexed-db/with-schemas/index.js +0 -0
  929. /package/{umd-es6 → umd/es6}/persisters/persister-libsql/index.js +0 -0
  930. /package/{umd-es6 → umd/es6}/persisters/persister-libsql/index.js.gz +0 -0
  931. /package/{umd-es6 → umd/es6}/persisters/persister-libsql/with-schemas/index.js +0 -0
  932. /package/{umd-es6 → umd/es6}/persisters/persister-partykit-client/index.js +0 -0
  933. /package/{umd-es6 → umd/es6}/persisters/persister-partykit-client/index.js.gz +0 -0
  934. /package/{umd-es6 → umd/es6}/persisters/persister-partykit-client/with-schemas/index.js +0 -0
  935. /package/{umd-es6 → umd/es6}/persisters/persister-partykit-server/index.js +0 -0
  936. /package/{umd-es6 → umd/es6}/persisters/persister-partykit-server/index.js.gz +0 -0
  937. /package/{umd-es6 → umd/es6}/persisters/persister-partykit-server/with-schemas/index.js +0 -0
  938. /package/{umd-es6 → umd/es6}/persisters/persister-powersync/index.js +0 -0
  939. /package/{umd-es6 → umd/es6}/persisters/persister-powersync/index.js.gz +0 -0
  940. /package/{umd-es6 → umd/es6}/persisters/persister-powersync/with-schemas/index.js +0 -0
  941. /package/{umd-es6 → umd/es6}/persisters/persister-remote/index.js +0 -0
  942. /package/{umd-es6 → umd/es6}/persisters/persister-remote/index.js.gz +0 -0
  943. /package/{umd-es6 → umd/es6}/persisters/persister-remote/with-schemas/index.js +0 -0
  944. /package/{umd-es6 → umd/es6}/persisters/persister-sqlite-wasm/index.js +0 -0
  945. /package/{umd-es6 → umd/es6}/persisters/persister-sqlite-wasm/index.js.gz +0 -0
  946. /package/{umd-es6 → umd/es6}/persisters/persister-sqlite-wasm/with-schemas/index.js +0 -0
  947. /package/{umd-es6 → umd/es6}/persisters/persister-sqlite3/index.js +0 -0
  948. /package/{umd-es6 → umd/es6}/persisters/persister-sqlite3/index.js.gz +0 -0
  949. /package/{umd-es6 → umd/es6}/persisters/persister-sqlite3/with-schemas/index.js +0 -0
  950. /package/{umd-es6 → umd/es6}/persisters/persister-yjs/index.js +0 -0
  951. /package/{umd-es6 → umd/es6}/persisters/persister-yjs/index.js.gz +0 -0
  952. /package/{umd-es6 → umd/es6}/persisters/persister-yjs/with-schemas/index.js +0 -0
  953. /package/{umd-es6 → umd/es6}/persisters/with-schemas/index.js +0 -0
  954. /package/{umd-es6 → umd/es6}/queries/index.js +0 -0
  955. /package/{umd-es6 → umd/es6}/queries/index.js.gz +0 -0
  956. /package/{umd-es6 → umd/es6}/queries/with-schemas/index.js +0 -0
  957. /package/{umd-es6 → umd/es6}/relationships/index.js +0 -0
  958. /package/{umd-es6 → umd/es6}/relationships/index.js.gz +0 -0
  959. /package/{umd-es6 → umd/es6}/relationships/with-schemas/index.js +0 -0
  960. /package/{umd-es6 → umd/es6}/store/index.js +0 -0
  961. /package/{umd-es6 → umd/es6}/store/index.js.gz +0 -0
  962. /package/{umd-es6 → umd/es6}/store/with-schemas/index.js +0 -0
  963. /package/{umd-es6 → umd/es6}/synchronizers/index.js +0 -0
  964. /package/{umd-es6 → umd/es6}/synchronizers/index.js.gz +0 -0
  965. /package/{umd-es6 → umd/es6}/synchronizers/synchronizer-local/index.js +0 -0
  966. /package/{umd-es6 → umd/es6}/synchronizers/synchronizer-local/index.js.gz +0 -0
  967. /package/{umd-es6 → umd/es6}/synchronizers/synchronizer-local/with-schemas/index.js +0 -0
  968. /package/{umd-es6 → umd/es6}/synchronizers/synchronizer-ws-client/index.js +0 -0
  969. /package/{umd-es6 → umd/es6}/synchronizers/synchronizer-ws-client/index.js.gz +0 -0
  970. /package/{umd-es6 → umd/es6}/synchronizers/synchronizer-ws-client/with-schemas/index.js +0 -0
  971. /package/{umd-es6 → umd/es6}/synchronizers/synchronizer-ws-server/index.js +0 -0
  972. /package/{umd-es6 → umd/es6}/synchronizers/synchronizer-ws-server/index.js.gz +0 -0
  973. /package/{umd-es6 → umd/es6}/synchronizers/synchronizer-ws-server/with-schemas/index.js +0 -0
  974. /package/{umd-es6 → umd/es6}/synchronizers/with-schemas/index.js +0 -0
  975. /package/{umd-es6 → umd/es6}/tools/index.js +0 -0
  976. /package/{umd-es6 → umd/es6}/tools/index.js.gz +0 -0
  977. /package/{umd-es6 → umd/es6}/tools/with-schemas/index.js +0 -0
  978. /package/{umd-es6 → umd/es6}/ui-react/index.js +0 -0
  979. /package/{umd-es6 → umd/es6}/ui-react/index.js.gz +0 -0
  980. /package/{umd-es6 → umd/es6}/ui-react/with-schemas/index.js +0 -0
  981. /package/{umd-es6 → umd/es6}/ui-react-dom/index.js +0 -0
  982. /package/{umd-es6 → umd/es6}/ui-react-dom/index.js.gz +0 -0
  983. /package/{umd-es6 → umd/es6}/ui-react-dom/with-schemas/index.js +0 -0
  984. /package/{umd-es6 → umd/es6}/ui-react-inspector/index.js +0 -0
  985. /package/{umd-es6 → umd/es6}/ui-react-inspector/index.js.gz +0 -0
  986. /package/{umd-es6 → umd/es6}/ui-react-inspector/with-schemas/index.js +0 -0
  987. /package/{umd-es6 → umd/es6}/with-schemas/index.js +0 -0
@@ -0,0 +1,3421 @@
1
+ const getTypeOf = (thing) => typeof thing;
2
+ const TINYBASE = 'tinybase';
3
+ const EMPTY_STRING = '';
4
+ const COMMA = ',';
5
+ const STRING = getTypeOf(EMPTY_STRING);
6
+ const BOOLEAN = getTypeOf(true);
7
+ const NUMBER = getTypeOf(0);
8
+ const TYPE = 'type';
9
+ const DEFAULT = 'default';
10
+ const LISTENER = 'Listener';
11
+ const GET = 'get';
12
+ const ADD = 'add';
13
+ const HAS = 'Has';
14
+ const IDS = 'Ids';
15
+ const TABLE = 'Table';
16
+ const TABLES = TABLE + 's';
17
+ const TABLE_IDS = TABLE + IDS;
18
+ const ROW = 'Row';
19
+ const ROW_IDS = ROW + IDS;
20
+ const SORTED_ROW_IDS = 'Sorted' + ROW + IDS;
21
+ const CELL = 'Cell';
22
+ const CELL_IDS = CELL + IDS;
23
+ const VALUE = 'Value';
24
+ const VALUES = VALUE + 's';
25
+ const VALUE_IDS = VALUE + IDS;
26
+
27
+ var __async$1 = (__this, __arguments, generator) => {
28
+ return new Promise((resolve, reject) => {
29
+ var fulfilled = (value) => {
30
+ try {
31
+ step(generator.next(value));
32
+ } catch (e) {
33
+ reject(e);
34
+ }
35
+ };
36
+ var rejected = (value) => {
37
+ try {
38
+ step(generator.throw(value));
39
+ } catch (e) {
40
+ reject(e);
41
+ }
42
+ };
43
+ var step = (x) =>
44
+ x.done
45
+ ? resolve(x.value)
46
+ : Promise.resolve(x.value).then(fulfilled, rejected);
47
+ step((generator = generator.apply(__this, __arguments)).next());
48
+ });
49
+ };
50
+ const promise = Promise;
51
+ const isFiniteNumber = isFinite;
52
+ const isUndefined = (thing) => thing == void 0;
53
+ const ifNotUndefined = (value, then, otherwise) =>
54
+ isUndefined(value) ? (otherwise == null ? void 0 : otherwise()) : then(value);
55
+ const isTypeStringOrBoolean = (type) => type == STRING || type == BOOLEAN;
56
+ const isString = (thing) => getTypeOf(thing) == STRING;
57
+ const isArray = (thing) => Array.isArray(thing);
58
+ const slice = (arrayOrString, start, end) => arrayOrString.slice(start, end);
59
+ const size = (arrayOrString) => arrayOrString.length;
60
+ const promiseAll = (promises) =>
61
+ __async$1(void 0, null, function* () {
62
+ return promise.all(promises);
63
+ });
64
+
65
+ const getCellOrValueType = (cellOrValue) => {
66
+ const type = getTypeOf(cellOrValue);
67
+ return isTypeStringOrBoolean(type) ||
68
+ (type == NUMBER && isFiniteNumber(cellOrValue))
69
+ ? type
70
+ : void 0;
71
+ };
72
+
73
+ const arrayEvery = (array, cb) => array.every(cb);
74
+ const arraySort = (array, sorter) => array.sort(sorter);
75
+ const arrayForEach = (array, cb) => array.forEach(cb);
76
+ const arrayJoin = (array, sep = EMPTY_STRING) => array.join(sep);
77
+ const arrayMap = (array, cb) => array.map(cb);
78
+ const arrayFilter = (array, cb) => array.filter(cb);
79
+ const arrayPush = (array, ...values) => array.push(...values);
80
+ const arrayPop = (array) => array.pop();
81
+ const arrayUnshift = (array, ...values) => array.unshift(...values);
82
+ const arrayShift = (array) => array.shift();
83
+
84
+ const object = Object;
85
+ const getPrototypeOf = (obj) => object.getPrototypeOf(obj);
86
+ const objEntries = object.entries;
87
+ const isObject = (obj) =>
88
+ !isUndefined(obj) &&
89
+ ifNotUndefined(
90
+ getPrototypeOf(obj),
91
+ (objPrototype) =>
92
+ objPrototype == object.prototype ||
93
+ isUndefined(getPrototypeOf(objPrototype)),
94
+
95
+ /* istanbul ignore next */
96
+ () => true,
97
+ );
98
+ const objIds = object.keys;
99
+ const objFreeze = object.freeze;
100
+ const objToArray = (obj, cb) =>
101
+ arrayMap(objEntries(obj), ([id, value]) => cb(value, id));
102
+ const objSize = (obj) => size(objIds(obj));
103
+ const objIsEmpty = (obj) => isObject(obj) && objSize(obj) == 0;
104
+
105
+ const collHas = (coll, keyOrValue) => {
106
+ var _a;
107
+ return (_a = coll == null ? void 0 : coll.has(keyOrValue)) != null
108
+ ? _a
109
+ : false;
110
+ };
111
+ const collValues = (coll) => {
112
+ var _a;
113
+ return [...((_a = coll == null ? void 0 : coll.values()) != null ? _a : [])];
114
+ };
115
+ const collForEach = (coll, cb) => (coll == null ? void 0 : coll.forEach(cb));
116
+ const collDel = (coll, keyOrValue) =>
117
+ coll == null ? void 0 : coll.delete(keyOrValue);
118
+
119
+ const mapNew = (entries) => new Map(entries);
120
+ const mapGet = (map, key) => (map == null ? void 0 : map.get(key));
121
+ const mapForEach = (map, cb) =>
122
+ collForEach(map, (value, key) => cb(key, value));
123
+ const mapMap = (coll, cb) => {
124
+ var _a;
125
+ return arrayMap(
126
+ [...((_a = coll == null ? void 0 : coll.entries()) != null ? _a : [])],
127
+ ([key, value]) => cb(value, key),
128
+ );
129
+ };
130
+ const mapSet = (map, key, value) =>
131
+ isUndefined(value)
132
+ ? (collDel(map, key), map)
133
+ : map == null
134
+ ? void 0
135
+ : map.set(key, value);
136
+ const mapEnsure = (map, key, getDefaultValue, hadExistingValue) => {
137
+ if (!collHas(map, key)) {
138
+ mapSet(map, key, getDefaultValue());
139
+ }
140
+ return mapGet(map, key);
141
+ };
142
+
143
+ const upper = (str) => str.toUpperCase();
144
+ const lower = (str) => str.toLowerCase();
145
+ const A = 'a ';
146
+ const A_FUNCTION_FOR = 'A function for';
147
+ const AND_REGISTERS =
148
+ ', and registers a listener so that any changes to that result will cause a re-render';
149
+ const CALLBACK = 'Callback';
150
+ const CHANGES = 'Changes';
151
+ const COUNT = 'Count';
152
+ const DEL = 'Del';
153
+ const DEPS = 'Deps';
154
+ const DEPS_SUFFIX = DEPS + '?: React.DependencyList';
155
+ const DO_ROLLBACK_PARAM = 'doRollback?: DoRollback';
156
+ const DO_ACTIONS_AND_ROLLBACK_PARAMS =
157
+ 'actions: () => Return, ' + DO_ROLLBACK_PARAM;
158
+ const EXPORT = 'export';
159
+ const ID = 'Id';
160
+ const INVALID = 'Invalid';
161
+ const JSON$1 = 'Json';
162
+ const LISTENER_ = lower(LISTENER);
163
+ const OPTIONAL_COLON = '?: ';
164
+ const OR_UNDEFINED = ' | undefined';
165
+ const NON_NULLABLE = 'NonNullable';
166
+ const PARTIAL = 'Partial';
167
+ const PROPS = 'Props';
168
+ const PROVIDER = 'Provider';
169
+ const REGISTERS_A_LISTENER = `Registers a ${LISTENER_} that will be called`;
170
+ const REPRESENTS = 'Represents';
171
+ const ROW_ID_PARAM = 'rowId: ' + ID;
172
+ const SCHEMA = 'Schema';
173
+ const SET = 'Set';
174
+ const SORTED_ARGS = ', descending?: boolean, offset?: number, limit?: number';
175
+ const SQUARE_BRACKETS = '[]';
176
+ const THE_STORE = 'the Store';
177
+ const TRANSACTION = 'Transaction';
178
+ const TRANSACTION_ = lower(TRANSACTION);
179
+ const TRANSACTION_DOC =
180
+ 'Execute a ' + TRANSACTION_ + ' to make multiple mutations';
181
+ const START_TRANSACTION_DOC = 'Explicitly starts a ' + TRANSACTION_;
182
+ const FINISH_TRANSACTION_DOC = 'Explicitly finishes a ' + TRANSACTION_;
183
+ const THE_END_OF_THE_TRANSACTION = 'the end of the ' + TRANSACTION_;
184
+ const VOID = 'void';
185
+ const RETURNS_VOID = ' => ' + VOID;
186
+ const WHEN_SET = 'WhenSet';
187
+ const WHEN_SETTING_IT = ' when setting it';
188
+ const A_STRING_SERIALIZATION_OF = A + 'string serialization of';
189
+ const SPACE = ' ';
190
+ const GETS_A_CALLBACK_THAT_CAN = 'Gets a callback that can ';
191
+ const THE = 'the ';
192
+ const THE_SCHEMA_FOR = ' the schema for';
193
+ const getHasDoc = (has = 0) => (has ? 'the existence of ' : '');
194
+ const getTheContentOfDoc = (content = 0, theStore = 0, has = 0) =>
195
+ getHasDoc(has) +
196
+ `the ${CONTENT[content]}content of` +
197
+ (theStore ? SPACE + THE_STORE : EMPTY_STRING);
198
+ const getTheContentOfTheStoreDoc = (content = 0, verb, set = 0, has = 0) =>
199
+ VERBS[verb] +
200
+ SPACE +
201
+ getHasDoc(has) +
202
+ getTheContentOfDoc(content, 1) +
203
+ (set ? ' when setting it' : EMPTY_STRING);
204
+ const getRowTypeDoc = (tableId, set = 0) =>
205
+ REPRESENTS +
206
+ ` a Row when ${set ? 's' : 'g'}etting ${getTheContentOfDoc()} the '${tableId}' ` +
207
+ TABLE;
208
+ const getIdsDoc = (idsNoun, parentNoun, sorted = 0) =>
209
+ `Gets ${sorted ? 'sorted, paginated' : 'the'} Ids of the ${idsNoun}s in ` +
210
+ parentNoun;
211
+ const getForEachDoc = (childNoun, parentNoun) =>
212
+ `Calls a function for each ${childNoun} in ` + parentNoun;
213
+ const getPropsDoc = (childNoun) =>
214
+ 'The props passed to a component that renders ' + childNoun;
215
+ const getCallbackDoc = (takes) => 'A function that takes ' + takes;
216
+ const getListenerTypeDoc = (childNoun, parentNoun = 0, has = 0) =>
217
+ A_FUNCTION_FOR +
218
+ ' listening to changes to ' +
219
+ getHasDoc(has) +
220
+ NOUNS[childNoun] +
221
+ ' in ' +
222
+ NOUNS[parentNoun];
223
+ const getListenerDoc = (childNoun, parentNoun, pluralChild = 0, has = 0) =>
224
+ REGISTERS_A_LISTENER +
225
+ ' whenever ' +
226
+ getHasDoc(has) +
227
+ NOUNS[childNoun] +
228
+ ' in ' +
229
+ NOUNS[parentNoun] +
230
+ ' change' +
231
+ (pluralChild ? EMPTY_STRING : 's');
232
+ const getTableDoc = (tableId) => `the '${tableId}' ` + TABLE;
233
+ const getRowDoc = (tableId) => 'the specified Row in ' + getTableDoc(tableId);
234
+ const getTableContentDoc = (tableId, verb = 0, has = 0) =>
235
+ VERBS[verb] +
236
+ SPACE +
237
+ getTheContentOfDoc(0, 0, has) +
238
+ SPACE +
239
+ getTableDoc(tableId);
240
+ const getRowContentDoc = (tableId, verb = 0, has = 0) =>
241
+ VERBS[verb] + ` ${getTheContentOfDoc(0, 0, has)} ` + getRowDoc(tableId);
242
+ const getCellContentDoc = (tableId, cellId, verb = 0, has = 0) =>
243
+ VERBS[verb] +
244
+ SPACE +
245
+ getHasDoc(has) +
246
+ `the '${cellId}' Cell for ` +
247
+ getRowDoc(tableId);
248
+ const getValueContentDoc = (valueId, verb = 0, has = 0) =>
249
+ VERBS[verb] + SPACE + getHasDoc(has) + `the '${valueId}' Value`;
250
+ const VERBS = [
251
+ 'Gets',
252
+ 'Checks existence of',
253
+ 'Sets',
254
+ 'Deletes',
255
+ 'Sets part of',
256
+ REPRESENTS,
257
+ 'Gets ' + A_STRING_SERIALIZATION_OF,
258
+ 'Sets ' + A_STRING_SERIALIZATION_OF,
259
+ REGISTERS_A_LISTENER + ' whenever',
260
+ GETS_A_CALLBACK_THAT_CAN + 'set',
261
+ GETS_A_CALLBACK_THAT_CAN + 'add',
262
+ GETS_A_CALLBACK_THAT_CAN + 'set part of',
263
+ GETS_A_CALLBACK_THAT_CAN + 'delete',
264
+ 'Renders',
265
+ 'Gets ' + A_STRING_SERIALIZATION_OF + THE_SCHEMA_FOR,
266
+ 'Sets' + THE_SCHEMA_FOR,
267
+ 'Deletes' + THE_SCHEMA_FOR,
268
+ ];
269
+ const METHOD_PREFIX_VERBS = [
270
+ GET,
271
+ 'has',
272
+ 'set',
273
+ 'del',
274
+ 'set',
275
+ // partial
276
+ 'forEach',
277
+ ADD,
278
+ EMPTY_STRING,
279
+ ];
280
+ const NOUNS = [
281
+ THE_STORE,
282
+ TABLES,
283
+ THE + TABLE + SPACE + IDS,
284
+ A + TABLE,
285
+ THE + ROW + SPACE + IDS,
286
+ A + ROW,
287
+ THE + CELL + SPACE + IDS,
288
+ A + CELL,
289
+ 'invalid Cell changes',
290
+ VALUES,
291
+ THE + VALUE + SPACE + IDS,
292
+ A + VALUE,
293
+ 'invalid Value changes',
294
+ THE + 'sorted ' + ROW + SPACE + IDS,
295
+ THE + CELL + SPACE + IDS + ' anywhere',
296
+ THE + 'number of Rows',
297
+ A + CELL + ' anywhere',
298
+ ];
299
+ const CONTENT = [EMPTY_STRING, 'tabular ', 'keyed value '];
300
+
301
+ const setNew = (entryOrEntries) =>
302
+ new Set(
303
+ isArray(entryOrEntries) || isUndefined(entryOrEntries)
304
+ ? entryOrEntries
305
+ : [entryOrEntries],
306
+ );
307
+ const setAdd = (set, value) => (set == null ? void 0 : set.add(value));
308
+
309
+ const NON_ALPHA = /[^A-Za-z]+/;
310
+ const NON_ALPHANUMERIC = /[^A-Za-z0-9]+/;
311
+ const JSDOC = /^( *)\/\*\* *(.*?) *\*\/$/gm;
312
+ const stringHasComma = (str) => str.includes(COMMA);
313
+ const mapUnique = (map, id, value, index = 1) => {
314
+ const uniqueId = `${id}${index == 1 ? '' : index}`;
315
+ if (collHas(map, uniqueId)) {
316
+ return mapUnique(map, id, value, index + 1);
317
+ } else {
318
+ mapSet(map, uniqueId, value);
319
+ return uniqueId;
320
+ }
321
+ };
322
+ const formatJsDoc = (file) =>
323
+ file.replace(JSDOC, (_, indent, text) => {
324
+ const lineLength = 77 - size(indent);
325
+ return `${indent}/**
326
+ ${text.replace(
327
+ new RegExp(`([^\\n]{1,${lineLength}})(\\s|$)`, 'g'),
328
+ `${indent} * $1
329
+ `,
330
+ )}${indent} */`;
331
+ });
332
+ const flat = (array) => array.flat(1e3);
333
+ const camel = (str, firstCap = 0) =>
334
+ arrayJoin(
335
+ arrayMap(
336
+ str.split(NON_ALPHANUMERIC),
337
+ (word, w) =>
338
+ (w > 0 || firstCap ? upper : lower)(slice(word, 0, 1)) + slice(word, 1),
339
+ ),
340
+ );
341
+ const snake = (str) =>
342
+ upper(
343
+ arrayJoin(
344
+ (str && !NON_ALPHA.test(str[0]) ? str : ' ' + str).split(
345
+ NON_ALPHANUMERIC,
346
+ ),
347
+ '_',
348
+ ),
349
+ );
350
+ const comment = (doc) => `/** ${doc}. */`;
351
+ const getParameterList = (...params) =>
352
+ arrayJoin(
353
+ arrayFilter(params, (param) => param),
354
+ ', ',
355
+ );
356
+ const getFieldTypeList = (...props) => '{' + arrayJoin(props, '; ') + '}';
357
+ const getPropTypeList = (...props) =>
358
+ getFieldTypeList(...arrayMap(props, (prop) => 'readonly ' + prop));
359
+ const getCodeFunctions = () => {
360
+ const allImports = [mapNew(), mapNew(), mapNew(), mapNew()];
361
+ const types = mapNew();
362
+ const constants = mapNew();
363
+ const build = (...lines) => arrayJoin(flat(lines), '\n');
364
+ const addImport = (location, source, ...items) =>
365
+ arrayForEach(items, (item) =>
366
+ arrayForEach([0, 1], (eachLocation) =>
367
+ (location != null ? location : eachLocation) == eachLocation
368
+ ? setAdd(mapEnsure(allImports[eachLocation], source, setNew), item)
369
+ : 0,
370
+ ),
371
+ );
372
+ const addType = (name, body, doc, generic = EMPTY_STRING, exported = 1) =>
373
+ mapUnique(types, name, [body, doc, generic, exported]);
374
+ const addInternalFunction = (name, parameters, body) =>
375
+ mapUnique(
376
+ constants,
377
+ name,
378
+ isArray(body)
379
+ ? [`(${parameters}) => {`, body, '}']
380
+ : [`(${parameters}) => ${body}`],
381
+ );
382
+ const addConstant = (name, body) =>
383
+ mapGet(constants, name) === body ? name : mapUnique(constants, name, body);
384
+ const getSortableImport = (importMaybeAs) => {
385
+ const as = importMaybeAs.indexOf(' as ');
386
+ return as != -1 ? slice(importMaybeAs, as + 4) : importMaybeAs;
387
+ };
388
+ const getImports = (location = 0) =>
389
+ arrayMap(
390
+ [
391
+ ...arraySort(
392
+ mapMap(
393
+ allImports[location],
394
+ (items, source) =>
395
+ `import {${arrayJoin(
396
+ arraySort(collValues(items), (import1, import2) =>
397
+ getSortableImport(import1) > getSortableImport(import2)
398
+ ? 1
399
+ : -1,
400
+ ),
401
+ ', ',
402
+ )}} from '${source}';`,
403
+ ),
404
+ (import1, import2) =>
405
+ stringHasComma(import1) != stringHasComma(import2)
406
+ ? stringHasComma(import1)
407
+ ? -1
408
+ : 1
409
+ : import1 > import2
410
+ ? 1
411
+ : -1,
412
+ ),
413
+ EMPTY_STRING,
414
+ ],
415
+ (line) => line.replace('{React}', 'React'),
416
+ // sigh
417
+ );
418
+ const getTypes = () =>
419
+ mapMap(types, ([body, doc, generic, exported], name) => [
420
+ comment(doc),
421
+ `${exported ? EXPORT + ' ' : EMPTY_STRING}type ${name}${generic} = ${body};`,
422
+ EMPTY_STRING,
423
+ ]);
424
+ const getConstants = () =>
425
+ mapMap(constants, (body, name) => {
426
+ body = isArray(body) ? body : [body];
427
+ arrayPush(body, `${arrayPop(body)};`);
428
+ return [`const ${name} = ${arrayShift(body)}`, body, EMPTY_STRING];
429
+ });
430
+ return [
431
+ build,
432
+ addImport,
433
+ addType,
434
+ addInternalFunction,
435
+ addConstant,
436
+ getImports,
437
+ getTypes,
438
+ getConstants,
439
+ ];
440
+ };
441
+
442
+ const getCreateFunction = (getFunction, initFunction) => {
443
+ const thingsByStore = /* @__PURE__ */ new WeakMap();
444
+ return (store) => {
445
+ if (!thingsByStore.has(store)) {
446
+ thingsByStore.set(store, getFunction(store));
447
+ }
448
+ const thing = thingsByStore.get(store);
449
+ return thing;
450
+ };
451
+ };
452
+
453
+ const getSchemaFunctions = (tablesSchema, valuesSchema, addConstant) => {
454
+ const mapTablesSchema = (callback) =>
455
+ objToArray(tablesSchema, (_, tableId) => {
456
+ return callback(
457
+ tableId,
458
+ camel(tableId, 1),
459
+ addConstant(snake(tableId), `'${tableId}'`),
460
+ );
461
+ });
462
+ const mapCellSchema = (tableId, callback) =>
463
+ objToArray(tablesSchema[tableId], (cellSchema, cellId) =>
464
+ callback(
465
+ cellId,
466
+ cellSchema[TYPE],
467
+ cellSchema[DEFAULT],
468
+ addConstant(snake(cellId), `'${cellId}'`),
469
+ camel(cellId, 1),
470
+ ),
471
+ );
472
+ const mapValuesSchema = (callback) =>
473
+ objToArray(valuesSchema, (valueSchema, valueId) =>
474
+ callback(
475
+ valueId,
476
+ valueSchema[TYPE],
477
+ valueSchema[DEFAULT],
478
+ addConstant(snake(valueId), `'${valueId}'`),
479
+ camel(valueId, 1),
480
+ ),
481
+ );
482
+ return [mapTablesSchema, mapCellSchema, mapValuesSchema];
483
+ };
484
+
485
+ const getTypeFunctions = (
486
+ addType,
487
+ mapTablesSchema,
488
+ mapCellSchema,
489
+ mapValuesSchema,
490
+ ) => {
491
+ const getTablesTypes = (storeInstance, storeType) => {
492
+ const storeParam = storeInstance + ': ' + storeType;
493
+ const tablesType = addType(
494
+ TABLES,
495
+ getFieldTypeList(
496
+ ...mapTablesSchema(
497
+ (tableId) =>
498
+ `'${tableId}'?: {[rowId: Id]: ` +
499
+ getFieldTypeList(
500
+ ...mapCellSchema(
501
+ tableId,
502
+ (cellId, type, defaultValue) =>
503
+ `'${cellId}'${isUndefined(defaultValue) ? '?' : EMPTY_STRING}: ${type}`,
504
+ ),
505
+ ) +
506
+ '}',
507
+ ),
508
+ ),
509
+ getTheContentOfTheStoreDoc(1, 5),
510
+ );
511
+ const tablesWhenSetType = addType(
512
+ TABLES + WHEN_SET,
513
+ getFieldTypeList(
514
+ ...mapTablesSchema(
515
+ (tableId) =>
516
+ `'${tableId}'?: {[rowId: Id]: ` +
517
+ getFieldTypeList(
518
+ ...mapCellSchema(
519
+ tableId,
520
+ (cellId, type) => `'${cellId}'?: ${type}`,
521
+ ),
522
+ ) +
523
+ '}',
524
+ ),
525
+ ),
526
+ getTheContentOfTheStoreDoc(1, 5, 1),
527
+ );
528
+ const tableIdType = addType(
529
+ TABLE + ID,
530
+ 'keyof ' + tablesType,
531
+ 'A ' + TABLE + ' Id in ' + THE_STORE,
532
+ );
533
+ const tIdGeneric = `<TId extends ${tableIdType}>`;
534
+ const tableType = addType(
535
+ TABLE,
536
+ NON_NULLABLE + `<${tablesType}[TId]>`,
537
+ 'A ' + TABLE + ' in ' + THE_STORE,
538
+ tIdGeneric,
539
+ );
540
+ const tableWhenSetType = addType(
541
+ TABLE + WHEN_SET,
542
+ NON_NULLABLE + `<${tablesWhenSetType}[TId]>`,
543
+ 'A ' + TABLE + ' in ' + THE_STORE + WHEN_SETTING_IT,
544
+ tIdGeneric,
545
+ );
546
+ const rowType = addType(
547
+ ROW,
548
+ tableType + '<TId>[Id]',
549
+ 'A ' + ROW + ' in a ' + TABLE,
550
+ tIdGeneric,
551
+ );
552
+ const rowWhenSetType = addType(
553
+ ROW + WHEN_SET,
554
+ tableWhenSetType + '<TId>[Id]',
555
+ 'A ' + ROW + ' in a ' + TABLE + WHEN_SETTING_IT,
556
+ tIdGeneric,
557
+ );
558
+ const cellIdType = addType(
559
+ CELL + ID,
560
+ `Extract<keyof ${rowType}<TId>, Id>`,
561
+ 'A ' + CELL + ' Id in a ' + ROW,
562
+ tIdGeneric,
563
+ );
564
+ const cellType = addType(
565
+ CELL,
566
+ NON_NULLABLE + `<${tablesType}[TId]>[Id][CId]`,
567
+ 'A ' + CELL + ' in a ' + ROW,
568
+ `<TId extends ${tableIdType}, CId extends ${cellIdType}<TId>>`,
569
+ );
570
+ const cellIdCellArrayType = addType(
571
+ 'CellIdCellArray',
572
+ `CId extends ${cellIdType}<TId> ? [cellId: CId, cell: ${cellType}<TId, CId>] : never`,
573
+ CELL + ' Ids and types in a ' + ROW,
574
+ `<TId extends ${tableIdType}, CId = ${cellIdType}<TId>>`,
575
+ 0,
576
+ );
577
+ const cellCallbackType = addType(
578
+ CELL + CALLBACK,
579
+ `(...[cellId, cell]: ${cellIdCellArrayType}<TId>)` + RETURNS_VOID,
580
+ getCallbackDoc(A + CELL + ' Id, and ' + CELL),
581
+ tIdGeneric,
582
+ );
583
+ const rowCallbackType = addType(
584
+ ROW + CALLBACK,
585
+ '(rowId: Id, forEachCell: (cellCallback: CellCallback<TId>) ' +
586
+ RETURNS_VOID +
587
+ ') ' +
588
+ RETURNS_VOID,
589
+ getCallbackDoc(A + ROW + ' Id, and a ' + CELL + ' iterator'),
590
+ tIdGeneric,
591
+ );
592
+ const tableCellCallbackType = addType(
593
+ TABLE + CELL + CALLBACK,
594
+ `(cellId: ${cellIdType}<TId>, count: number) ` + RETURNS_VOID,
595
+ getCallbackDoc(A + CELL + ' Id, and count of how many times it appears'),
596
+ tIdGeneric,
597
+ );
598
+ const tableIdForEachRowArrayType = addType(
599
+ 'TableIdForEachRowArray',
600
+ `TId extends ${tableIdType} ? [tableId: TId, forEachRow: (rowCallback: ${rowCallbackType}<TId>)${RETURNS_VOID}] : never`,
601
+ TABLE + ' Ids and callback types',
602
+ `<TId = ${tableIdType}>`,
603
+ 0,
604
+ );
605
+ const tableCallbackType = addType(
606
+ TABLE + CALLBACK,
607
+ `(...[tableId, forEachRow]: ${tableIdForEachRowArrayType})` +
608
+ RETURNS_VOID,
609
+ getCallbackDoc(A + TABLE + ' Id, and a ' + ROW + ' iterator'),
610
+ EMPTY_STRING,
611
+ );
612
+ const tableIdRowIdCellIdArrayType = addType(
613
+ 'TableIdRowIdCellIdArray',
614
+ `TId extends ${tableIdType} ? [tableId: TId, rowId: Id, cellId: ${cellIdType}<TId>] : never`,
615
+ 'Ids for GetCellChange',
616
+ `<TId = ${tableIdType}>`,
617
+ 0,
618
+ );
619
+ const getCellChangeType = addType(
620
+ 'GetCellChange',
621
+ `(...[tableId, rowId, cellId]: ${tableIdRowIdCellIdArrayType}) => CellChange`,
622
+ A_FUNCTION_FOR +
623
+ ` returning information about any Cell's changes during a ` +
624
+ TRANSACTION_,
625
+ );
626
+ const hasTablesListenerType = addType(
627
+ HAS + TABLES + LISTENER,
628
+ `(${storeParam}, hasTables: boolean)` + RETURNS_VOID,
629
+ getListenerTypeDoc(1, 0, 1),
630
+ );
631
+ const tablesListenerType = addType(
632
+ TABLES + LISTENER,
633
+ `(${storeParam}, getCellChange: ${getCellChangeType}${OR_UNDEFINED})` +
634
+ RETURNS_VOID,
635
+ getListenerTypeDoc(1),
636
+ );
637
+ const tableIdsListenerType = addType(
638
+ TABLE_IDS + LISTENER,
639
+ `(${storeParam})` + RETURNS_VOID,
640
+ getListenerTypeDoc(2),
641
+ );
642
+ const hasTableListenerType = addType(
643
+ HAS + TABLE + LISTENER,
644
+ `(${storeParam}, tableId: ${tableIdType}, hasTable: boolean)` +
645
+ RETURNS_VOID,
646
+ getListenerTypeDoc(3, 0, 1),
647
+ );
648
+ const tableListenerType = addType(
649
+ TABLE + LISTENER,
650
+ `(${storeParam}, tableId: ${tableIdType}, getCellChange: ${getCellChangeType}${OR_UNDEFINED})` +
651
+ RETURNS_VOID,
652
+ getListenerTypeDoc(3),
653
+ );
654
+ const tableCellIdsListenerType = addType(
655
+ TABLE + CELL_IDS + LISTENER,
656
+ `(${storeParam}, tableId: ${tableIdType})` + RETURNS_VOID,
657
+ getListenerTypeDoc(14, 3),
658
+ );
659
+ const hasTableCellListenerArgsArrayInnerType = addType(
660
+ 'HasTableCellListenerArgsArrayInner',
661
+ `CId extends ${cellIdType}<TId> ? [${storeParam}, tableId: TId, cellId: CId, hasTableCell: boolean] : never`,
662
+ 'Cell args for HasTableCellListener',
663
+ `<TId extends ${tableIdType}, CId = ${cellIdType}<TId>>`,
664
+ 0,
665
+ );
666
+ const hasTableCellListenerArgsArrayOuterType = addType(
667
+ 'HasTableCellListenerArgsArrayOuter',
668
+ `TId extends ${tableIdType} ? ` +
669
+ hasTableCellListenerArgsArrayInnerType +
670
+ '<TId> : never',
671
+ 'Table args for HasTableCellListener',
672
+ `<TId = ${tableIdType}>`,
673
+ 0,
674
+ );
675
+ const hasTableCellListenerType = addType(
676
+ HAS + TABLE + CELL + LISTENER,
677
+ `(...[${storeInstance}, tableId, cellId, hasTableCell]: ` +
678
+ hasTableCellListenerArgsArrayOuterType +
679
+ ')' +
680
+ RETURNS_VOID,
681
+ getListenerTypeDoc(16, 3, 1),
682
+ );
683
+ const rowCountListenerType = addType(
684
+ ROW + 'Count' + LISTENER,
685
+ `(${storeParam}, tableId: ${tableIdType})` + RETURNS_VOID,
686
+ getListenerTypeDoc(15, 3),
687
+ );
688
+ const rowIdsListenerType = addType(
689
+ ROW_IDS + LISTENER,
690
+ `(${storeParam}, tableId: ${tableIdType})` + RETURNS_VOID,
691
+ getListenerTypeDoc(4, 3),
692
+ );
693
+ const sortedRowIdsListenerType = addType(
694
+ SORTED_ROW_IDS + LISTENER,
695
+ '(' +
696
+ getParameterList(
697
+ storeParam,
698
+ 'tableId: ' + tableIdType,
699
+ 'cellId: Id' + OR_UNDEFINED,
700
+ 'descending: boolean',
701
+ 'offset: number',
702
+ 'limit: number' + OR_UNDEFINED,
703
+ 'sortedRowIds: Ids',
704
+ ) +
705
+ ')' +
706
+ RETURNS_VOID,
707
+ getListenerTypeDoc(13, 3),
708
+ );
709
+ const hasRowListenerType = addType(
710
+ HAS + ROW + LISTENER,
711
+ '(' +
712
+ getParameterList(
713
+ `${storeParam}`,
714
+ 'tableId: ' + tableIdType,
715
+ ROW_ID_PARAM,
716
+ `hasRow: boolean`,
717
+ ) +
718
+ ')' +
719
+ RETURNS_VOID,
720
+ getListenerTypeDoc(5, 3, 1),
721
+ );
722
+ const rowListenerType = addType(
723
+ ROW + LISTENER,
724
+ '(' +
725
+ getParameterList(
726
+ `${storeParam}`,
727
+ 'tableId: ' + tableIdType,
728
+ ROW_ID_PARAM,
729
+ `getCellChange: ${getCellChangeType}${OR_UNDEFINED}`,
730
+ ) +
731
+ ')' +
732
+ RETURNS_VOID,
733
+ getListenerTypeDoc(5, 3),
734
+ );
735
+ const cellIdsListenerType = addType(
736
+ CELL_IDS + LISTENER,
737
+ '(' +
738
+ getParameterList(
739
+ `${storeParam}`,
740
+ 'tableId: ' + tableIdType,
741
+ ROW_ID_PARAM,
742
+ ) +
743
+ ')' +
744
+ RETURNS_VOID,
745
+ getListenerTypeDoc(6, 5),
746
+ );
747
+ const hasCellListenerArgsArrayInnerType = addType(
748
+ 'HasCellListenerArgsArrayInner',
749
+ `CId extends ${cellIdType}<TId> ? [${storeParam}, tableId: TId, ${ROW_ID_PARAM}, cellId: CId, hasCell: boolean] : never`,
750
+ 'Cell args for HasCellListener',
751
+ `<TId extends ${tableIdType}, CId = ${cellIdType}<TId>>`,
752
+ 0,
753
+ );
754
+ const hasCellListenerArgsArrayOuterType = addType(
755
+ 'HasCellListenerArgsArrayOuter',
756
+ `TId extends ${tableIdType} ? ` +
757
+ hasCellListenerArgsArrayInnerType +
758
+ '<TId> : never',
759
+ 'Table args for HasCellListener',
760
+ `<TId = ${tableIdType}>`,
761
+ 0,
762
+ );
763
+ const hasCellListenerType = addType(
764
+ HAS + CELL + LISTENER,
765
+ `(...[${storeInstance}, tableId, rowId, cellId, hasCell]: ` +
766
+ hasCellListenerArgsArrayOuterType +
767
+ ')' +
768
+ RETURNS_VOID,
769
+ getListenerTypeDoc(7, 5, 1),
770
+ );
771
+ const cellListenerArgsArrayInnerType = addType(
772
+ 'CellListenerArgsArrayInner',
773
+ `CId extends ${cellIdType}<TId> ? [${storeParam}, tableId: TId, ${ROW_ID_PARAM}, cellId: CId, newCell: ${cellType}<TId, CId> ${OR_UNDEFINED}, oldCell: ${cellType}<TId, CId> ${OR_UNDEFINED}, getCellChange: ${getCellChangeType} ${OR_UNDEFINED}] : never`,
774
+ 'Cell args for CellListener',
775
+ `<TId extends ${tableIdType}, CId = ${cellIdType}<TId>>`,
776
+ 0,
777
+ );
778
+ const cellListenerArgsArrayOuterType = addType(
779
+ 'CellListenerArgsArrayOuter',
780
+ `TId extends ${tableIdType} ? ` +
781
+ cellListenerArgsArrayInnerType +
782
+ '<TId> : never',
783
+ 'Table args for CellListener',
784
+ `<TId = ${tableIdType}>`,
785
+ 0,
786
+ );
787
+ const cellListenerType = addType(
788
+ CELL + LISTENER,
789
+ `(...[${storeInstance}, tableId, rowId, cellId, newCell, oldCell, getCellChange]: ${cellListenerArgsArrayOuterType})` +
790
+ RETURNS_VOID,
791
+ getListenerTypeDoc(7, 5),
792
+ );
793
+ const invalidCellListenerType = addType(
794
+ INVALID + CELL + LISTENER,
795
+ `(${storeParam}, tableId: Id, ${ROW_ID_PARAM}, cellId: Id, invalidCells: any[])` +
796
+ RETURNS_VOID,
797
+ getListenerTypeDoc(8),
798
+ );
799
+ return [
800
+ tablesType,
801
+ tablesWhenSetType,
802
+ tableIdType,
803
+ tableType,
804
+ tableWhenSetType,
805
+ rowType,
806
+ rowWhenSetType,
807
+ cellIdType,
808
+ cellType,
809
+ cellCallbackType,
810
+ rowCallbackType,
811
+ tableCellCallbackType,
812
+ tableCallbackType,
813
+ hasTablesListenerType,
814
+ tablesListenerType,
815
+ tableIdsListenerType,
816
+ hasTableListenerType,
817
+ tableListenerType,
818
+ tableCellIdsListenerType,
819
+ hasTableCellListenerType,
820
+ rowCountListenerType,
821
+ rowIdsListenerType,
822
+ sortedRowIdsListenerType,
823
+ hasRowListenerType,
824
+ rowListenerType,
825
+ cellIdsListenerType,
826
+ hasCellListenerType,
827
+ cellListenerType,
828
+ invalidCellListenerType,
829
+ ];
830
+ };
831
+ const getValuesTypes = (storeInstance, storeType) => {
832
+ const storeParam = storeInstance + ': ' + storeType;
833
+ const valuesType = addType(
834
+ VALUES,
835
+ getFieldTypeList(
836
+ ...mapValuesSchema(
837
+ (valueId, type, defaultValue) =>
838
+ `'${valueId}'${isUndefined(defaultValue) ? '?' : EMPTY_STRING}: ${type}`,
839
+ ),
840
+ ),
841
+ getTheContentOfTheStoreDoc(2, 5),
842
+ );
843
+ const valuesWhenSetType = addType(
844
+ VALUES + WHEN_SET,
845
+ getFieldTypeList(
846
+ ...mapValuesSchema((valueId, type) => `'${valueId}'?: ${type}`),
847
+ ),
848
+ getTheContentOfTheStoreDoc(2, 5, 1),
849
+ );
850
+ const valueIdType = addType(
851
+ VALUE + ID,
852
+ 'keyof ' + valuesType,
853
+ 'A ' + VALUE + ' Id in ' + THE_STORE,
854
+ );
855
+ const valueType = addType(
856
+ VALUE,
857
+ NON_NULLABLE + `<${valuesType}[VId]>`,
858
+ 'A ' + VALUE + ' Id in ' + THE_STORE,
859
+ `<VId extends ${valueIdType}>`,
860
+ );
861
+ const valueIdValueArrayType = addType(
862
+ 'ValueIdValueArray',
863
+ `VId extends ${valueIdType} ? [valueId: VId, value: ${valueType}<VId>] : never`,
864
+ VALUE + ' Ids and types in ' + THE_STORE,
865
+ `<VId = ${valueIdType}>`,
866
+ 0,
867
+ );
868
+ const valueCallbackType = addType(
869
+ VALUE + CALLBACK,
870
+ `(...[valueId, value]: ${valueIdValueArrayType})` + RETURNS_VOID,
871
+ getCallbackDoc(A + VALUE + ' Id, and ' + VALUE),
872
+ );
873
+ const getValueChangeType = addType(
874
+ 'GetValueChange',
875
+ `(valueId: ${valueIdType}) => ValueChange`,
876
+ A_FUNCTION_FOR +
877
+ ` returning information about any Value's changes during a ` +
878
+ TRANSACTION_,
879
+ );
880
+ const hasValuesListenerType = addType(
881
+ HAS + VALUES + LISTENER,
882
+ `(${storeParam}, hasValues: boolean)` + RETURNS_VOID,
883
+ getListenerTypeDoc(9, 0, 1),
884
+ );
885
+ const valuesListenerType = addType(
886
+ VALUES + LISTENER,
887
+ `(${storeParam}, getValueChange: ${getValueChangeType}${OR_UNDEFINED})` +
888
+ RETURNS_VOID,
889
+ getListenerTypeDoc(9),
890
+ );
891
+ const valueIdsListenerType = addType(
892
+ VALUE_IDS + LISTENER,
893
+ `(${storeParam})` + RETURNS_VOID,
894
+ getListenerTypeDoc(10),
895
+ );
896
+ const hasValueListenerType = addType(
897
+ HAS + VALUE + LISTENER,
898
+ `(${storeParam}, valueId: ValueId, hasValue: boolean)` + RETURNS_VOID,
899
+ getListenerTypeDoc(11, 0, 1),
900
+ );
901
+ const valueListenerArgsArrayType = addType(
902
+ 'ValueListenerArgsArray',
903
+ `VId extends ${valueIdType} ? [${storeParam}, valueId: VId, newValue: ${valueType}<VId> ${OR_UNDEFINED}, oldValue: ${valueType}<VId> ${OR_UNDEFINED}, getValueChange: ${getValueChangeType} ${OR_UNDEFINED}] : never`,
904
+ 'Value args for ValueListener',
905
+ `<VId = ${valueIdType}>`,
906
+ 0,
907
+ );
908
+ const valueListenerType = addType(
909
+ VALUE + LISTENER,
910
+ `(...[${storeInstance}, valueId, newValue, oldValue, getValueChange]: ` +
911
+ valueListenerArgsArrayType +
912
+ ')' +
913
+ RETURNS_VOID,
914
+ getListenerTypeDoc(11),
915
+ );
916
+ const invalidValueListenerType = addType(
917
+ INVALID + VALUE + LISTENER,
918
+ `(${storeParam}, valueId: Id, invalidValues: any[])` + RETURNS_VOID,
919
+ getListenerTypeDoc(12),
920
+ );
921
+ return [
922
+ valuesType,
923
+ valuesWhenSetType,
924
+ valueIdType,
925
+ valueType,
926
+ valueCallbackType,
927
+ hasValuesListenerType,
928
+ valuesListenerType,
929
+ valueIdsListenerType,
930
+ hasValueListenerType,
931
+ valueListenerType,
932
+ invalidValueListenerType,
933
+ ];
934
+ };
935
+ const getTransactionListenerType = (storeInstance, storeType) =>
936
+ addType(
937
+ TRANSACTION + LISTENER,
938
+ `(${storeInstance}: ${storeType})` + RETURNS_VOID,
939
+ A_FUNCTION_FOR + ' listening to the completion of a ' + TRANSACTION_,
940
+ );
941
+ return [getTablesTypes, getValuesTypes, getTransactionListenerType];
942
+ };
943
+
944
+ const storeMethod = (method, parameters = EMPTY_STRING, cast = EMPTY_STRING) =>
945
+ `store.${method}(${parameters})` + (cast ? ' as ' + cast : EMPTY_STRING);
946
+ const fluentStoreMethod = (method, parameters = EMPTY_STRING) =>
947
+ `fluent(() => ${storeMethod(method, parameters)})`;
948
+ const storeListener = (
949
+ method,
950
+ beforeParameters = EMPTY_STRING,
951
+ afterParameters = EMPTY_STRING,
952
+ ) =>
953
+ `store.${method}(${beforeParameters ? beforeParameters + ', ' : EMPTY_STRING}proxy(listener)${afterParameters ? ', ' + afterParameters : EMPTY_STRING})`;
954
+ const getStoreCoreApi = (tablesSchema, valuesSchema, module) => {
955
+ const [
956
+ build,
957
+ addImport,
958
+ addType,
959
+ addInternalFunction,
960
+ addConstant,
961
+ getImports,
962
+ getTypes,
963
+ getConstants,
964
+ ] = getCodeFunctions();
965
+ const [mapTablesSchema, mapCellSchema, mapValuesSchema] = getSchemaFunctions(
966
+ tablesSchema,
967
+ valuesSchema,
968
+ addConstant,
969
+ );
970
+ const [getTablesTypes, getValuesTypes, getTransactionListenerType] =
971
+ getTypeFunctions(addType, mapTablesSchema, mapCellSchema, mapValuesSchema);
972
+ const methods = mapNew();
973
+ const getMethods = (location = 0) =>
974
+ mapMap(methods, ([parameters, returnType, body, doc, generic], name) => {
975
+ const lines = location
976
+ ? [name + `: ${generic}(${parameters}): ${returnType} => ${body},`]
977
+ : [name + generic + `(${parameters}): ${returnType};`];
978
+ if (!location) {
979
+ arrayUnshift(lines, comment(doc));
980
+ }
981
+ arrayPush(lines, EMPTY_STRING);
982
+ return lines;
983
+ });
984
+ const addMethod = (
985
+ name,
986
+ parameters,
987
+ returnType,
988
+ body,
989
+ doc,
990
+ generic = EMPTY_STRING,
991
+ ) => mapUnique(methods, name, [parameters, returnType, body, doc, generic]);
992
+ const addProxyMethod = (
993
+ prefixVerb,
994
+ prefix,
995
+ underlyingName,
996
+ returnType,
997
+ doc,
998
+ params = EMPTY_STRING,
999
+ paramsInCall = EMPTY_STRING,
1000
+ generic = EMPTY_STRING,
1001
+ ) =>
1002
+ addMethod(
1003
+ METHOD_PREFIX_VERBS[prefixVerb] +
1004
+ prefix +
1005
+ (prefixVerb == 4 ? PARTIAL : EMPTY_STRING) +
1006
+ underlyingName,
1007
+ params,
1008
+ returnType,
1009
+ (returnType == storeType ? fluentStoreMethod : storeMethod)(
1010
+ METHOD_PREFIX_VERBS[prefixVerb] +
1011
+ (prefixVerb == 4 ? PARTIAL : EMPTY_STRING) +
1012
+ underlyingName,
1013
+ paramsInCall,
1014
+ prefixVerb ? void 0 : returnType,
1015
+ ),
1016
+ doc,
1017
+ generic,
1018
+ );
1019
+ const addProxyListener = (
1020
+ underlyingName,
1021
+ listenerType,
1022
+ doc,
1023
+ params = EMPTY_STRING,
1024
+ paramsInCall = EMPTY_STRING,
1025
+ mutator = 1,
1026
+ generic = EMPTY_STRING,
1027
+ ) =>
1028
+ addMethod(
1029
+ ADD + underlyingName + LISTENER,
1030
+ (params ? params + ', ' : EMPTY_STRING) +
1031
+ LISTENER_ +
1032
+ ': ' +
1033
+ listenerType +
1034
+ (mutator ? ', mutator?: boolean' : EMPTY_STRING),
1035
+ ID,
1036
+ storeListener(
1037
+ ADD + underlyingName + LISTENER,
1038
+ paramsInCall,
1039
+ mutator ? 'mutator' : EMPTY_STRING,
1040
+ ),
1041
+ doc,
1042
+ generic,
1043
+ );
1044
+ const moduleDefinition = `./${camel(module)}.d`;
1045
+ const storeType = camel(module, 1);
1046
+ const storeInstance = camel(storeType);
1047
+ const createSteps = [];
1048
+ const mapCellOrValueTypes = mapNew();
1049
+ let sharedTableTypes = [];
1050
+ let sharedValueTypes = [];
1051
+ addImport(
1052
+ 1,
1053
+ moduleDefinition,
1054
+ storeType,
1055
+ `create${storeType} as create${storeType}Decl`,
1056
+ );
1057
+ if (!objIsEmpty(tablesSchema)) {
1058
+ addImport(0, TINYBASE, 'CellChange');
1059
+ addImport(null, TINYBASE, IDS);
1060
+ const [
1061
+ tablesType,
1062
+ tablesWhenSetType,
1063
+ tableIdType,
1064
+ tableType,
1065
+ tableWhenSetType,
1066
+ rowType,
1067
+ rowWhenSetType,
1068
+ cellIdType,
1069
+ _cellType,
1070
+ cellCallbackType,
1071
+ rowCallbackType,
1072
+ tableCellCallbackType,
1073
+ tableCallbackType,
1074
+ hasTablesListenerType,
1075
+ tablesListenerType,
1076
+ tableIdsListenerType,
1077
+ hasTableListenerType,
1078
+ tableListenerType,
1079
+ tableCellIdsListenerType,
1080
+ hasTableCellListenerType,
1081
+ rowCountListenerType,
1082
+ rowIdsListenerType,
1083
+ sortedRowIdsListenerType,
1084
+ hasRowListenerType,
1085
+ rowListenerType,
1086
+ cellIdsListenerType,
1087
+ hasCellListenerType,
1088
+ cellListenerType,
1089
+ invalidCellListenerType,
1090
+ ] = getTablesTypes(storeInstance, storeType);
1091
+ const tablesTypes = mapNew();
1092
+ mapTablesSchema((tableId, tableName) => {
1093
+ const tableIdGeneric = `<'${tableId}'>`;
1094
+ const tableTypes = [
1095
+ // Table
1096
+ addType(
1097
+ tableName + TABLE,
1098
+ tableType + tableIdGeneric,
1099
+ REPRESENTS + ` the '${tableId}' ` + TABLE,
1100
+ ),
1101
+ // TableWhenSet
1102
+ addType(
1103
+ tableName + TABLE + WHEN_SET,
1104
+ tableWhenSetType + tableIdGeneric,
1105
+ REPRESENTS + ` the '${tableId}' ` + TABLE + WHEN_SETTING_IT,
1106
+ ),
1107
+ // Row
1108
+ addType(
1109
+ tableName + ROW,
1110
+ rowType + tableIdGeneric,
1111
+ getRowTypeDoc(tableId),
1112
+ ),
1113
+ // RowWhenSet
1114
+ addType(
1115
+ tableName + ROW + WHEN_SET,
1116
+ rowWhenSetType + tableIdGeneric,
1117
+ getRowTypeDoc(tableId, 1),
1118
+ ),
1119
+ // CellId
1120
+ addType(
1121
+ tableName + CELL + ID,
1122
+ cellIdType + tableIdGeneric,
1123
+ `A Cell Id for the '${tableId}' ` + TABLE,
1124
+ ),
1125
+ // CellCallback
1126
+ addType(
1127
+ tableName + CELL + CALLBACK,
1128
+ cellCallbackType + tableIdGeneric,
1129
+ getCallbackDoc(
1130
+ `a Cell Id and value from a Row in the '${tableId}' ` + TABLE,
1131
+ ),
1132
+ ),
1133
+ // RowCallback
1134
+ addType(
1135
+ tableName + ROW + CALLBACK,
1136
+ rowCallbackType + tableIdGeneric,
1137
+ getCallbackDoc(
1138
+ `a Row Id from the '${tableId}' Table, and a Cell iterator`,
1139
+ ),
1140
+ ),
1141
+ // TableCellCallbackType
1142
+ addType(
1143
+ tableName + TABLE + CELL + CALLBACK,
1144
+ tableCellCallbackType + tableIdGeneric,
1145
+ getCallbackDoc(
1146
+ `a Cell Id from anywhere in the '${tableId}' Table, and a count of how many times it appears`,
1147
+ ),
1148
+ ),
1149
+ ];
1150
+ mapSet(tablesTypes, tableId, tableTypes);
1151
+ addImport(1, moduleDefinition, ...tableTypes);
1152
+ });
1153
+ addImport(
1154
+ 1,
1155
+ moduleDefinition,
1156
+ tablesType,
1157
+ tablesWhenSetType,
1158
+ tableIdType,
1159
+ cellIdType,
1160
+ tableCallbackType,
1161
+ hasTablesListenerType,
1162
+ tablesListenerType,
1163
+ tableIdsListenerType,
1164
+ hasTableListenerType,
1165
+ tableListenerType,
1166
+ tableCellIdsListenerType,
1167
+ hasTableCellListenerType,
1168
+ rowCountListenerType,
1169
+ rowIdsListenerType,
1170
+ sortedRowIdsListenerType,
1171
+ hasRowListenerType,
1172
+ rowListenerType,
1173
+ cellIdsListenerType,
1174
+ hasCellListenerType,
1175
+ cellListenerType,
1176
+ invalidCellListenerType,
1177
+ );
1178
+ sharedTableTypes = [
1179
+ tablesType,
1180
+ tablesWhenSetType,
1181
+ tableIdType,
1182
+ cellIdType,
1183
+ hasTablesListenerType,
1184
+ tablesListenerType,
1185
+ tableIdsListenerType,
1186
+ hasTableListenerType,
1187
+ tableListenerType,
1188
+ tableCellIdsListenerType,
1189
+ hasTableCellListenerType,
1190
+ rowCountListenerType,
1191
+ rowIdsListenerType,
1192
+ sortedRowIdsListenerType,
1193
+ hasRowListenerType,
1194
+ rowListenerType,
1195
+ cellIdsListenerType,
1196
+ hasCellListenerType,
1197
+ cellListenerType,
1198
+ tablesTypes,
1199
+ ];
1200
+ arrayForEach(
1201
+ [
1202
+ [tablesType],
1203
+ [BOOLEAN],
1204
+ [storeType, 'tables: ' + tablesWhenSetType, 'tables'],
1205
+ [storeType],
1206
+ ],
1207
+ ([returnType, params, paramsInCall], verb) =>
1208
+ addProxyMethod(
1209
+ verb,
1210
+ EMPTY_STRING,
1211
+ TABLES,
1212
+ returnType,
1213
+ getTheContentOfTheStoreDoc(1, verb),
1214
+ params,
1215
+ paramsInCall,
1216
+ ),
1217
+ );
1218
+ addProxyMethod(
1219
+ 0,
1220
+ EMPTY_STRING,
1221
+ TABLE_IDS,
1222
+ tableIdType + SQUARE_BRACKETS,
1223
+ getIdsDoc(TABLE, THE_STORE),
1224
+ );
1225
+ addProxyMethod(
1226
+ 5,
1227
+ EMPTY_STRING,
1228
+ TABLE,
1229
+ VOID,
1230
+ getForEachDoc(TABLE, THE_STORE),
1231
+ 'tableCallback: ' + tableCallbackType,
1232
+ 'tableCallback as any',
1233
+ );
1234
+ mapTablesSchema((tableId, tableName, TABLE_ID) => {
1235
+ const [
1236
+ tableType2,
1237
+ tableWhenSetType2,
1238
+ rowType2,
1239
+ rowWhenSetType2,
1240
+ cellIdType2,
1241
+ cellCallbackType2,
1242
+ rowCallbackType2,
1243
+ tableCellCallbackType2,
1244
+ ] = mapGet(tablesTypes, tableId);
1245
+ arrayForEach(
1246
+ [
1247
+ [tableType2],
1248
+ [BOOLEAN],
1249
+ [storeType, 'table: ' + tableWhenSetType2, ', table'],
1250
+ [storeType],
1251
+ ],
1252
+ ([returnType, params, paramsInCall = EMPTY_STRING], verb) =>
1253
+ addProxyMethod(
1254
+ verb,
1255
+ tableName,
1256
+ TABLE,
1257
+ returnType,
1258
+ getTableContentDoc(tableId, verb),
1259
+ params,
1260
+ TABLE_ID + paramsInCall,
1261
+ ),
1262
+ );
1263
+ addProxyMethod(
1264
+ 0,
1265
+ tableName,
1266
+ TABLE + CELL_IDS,
1267
+ IDS,
1268
+ getIdsDoc(CELL, 'the whole of ' + getTableDoc(tableId)),
1269
+ EMPTY_STRING,
1270
+ TABLE_ID,
1271
+ );
1272
+ addProxyMethod(
1273
+ 5,
1274
+ tableName,
1275
+ TABLE + CELL,
1276
+ VOID,
1277
+ getForEachDoc(TABLE + CELL, 'the whole of ' + getTableDoc(tableId)),
1278
+ 'tableCellCallback: ' + tableCellCallbackType2,
1279
+ TABLE_ID + ', tableCellCallback as any',
1280
+ );
1281
+ addProxyMethod(
1282
+ 0,
1283
+ tableName,
1284
+ ROW + COUNT,
1285
+ 'number',
1286
+ 'Gets the number of Rows in the ' + getTableDoc(tableId),
1287
+ EMPTY_STRING,
1288
+ TABLE_ID,
1289
+ );
1290
+ addProxyMethod(
1291
+ 0,
1292
+ tableName,
1293
+ ROW_IDS,
1294
+ IDS,
1295
+ getIdsDoc(ROW, getTableDoc(tableId)),
1296
+ EMPTY_STRING,
1297
+ TABLE_ID,
1298
+ );
1299
+ addProxyMethod(
1300
+ 0,
1301
+ tableName,
1302
+ SORTED_ROW_IDS,
1303
+ IDS,
1304
+ getIdsDoc(ROW, getTableDoc(tableId), 1),
1305
+ 'cellId?: ' + cellIdType2 + SORTED_ARGS,
1306
+ TABLE_ID + ', cellId, descending, offset, limit',
1307
+ );
1308
+ addProxyMethod(
1309
+ 5,
1310
+ tableName,
1311
+ ROW,
1312
+ VOID,
1313
+ getForEachDoc(ROW, getTableDoc(tableId)),
1314
+ 'rowCallback: ' + rowCallbackType2,
1315
+ TABLE_ID + ', rowCallback as any',
1316
+ );
1317
+ arrayForEach(
1318
+ [
1319
+ [rowType2],
1320
+ [BOOLEAN],
1321
+ [storeType, ', row: ' + rowWhenSetType2, ', row'],
1322
+ [storeType],
1323
+ [storeType, ', partialRow: ' + rowWhenSetType2, ', partialRow'],
1324
+ ],
1325
+ (
1326
+ [returnType, params = EMPTY_STRING, paramsInCall = EMPTY_STRING],
1327
+ verb,
1328
+ ) =>
1329
+ addProxyMethod(
1330
+ verb,
1331
+ tableName,
1332
+ ROW,
1333
+ returnType,
1334
+ getRowContentDoc(tableId, verb),
1335
+ ROW_ID_PARAM + params,
1336
+ TABLE_ID + ', rowId' + paramsInCall,
1337
+ ),
1338
+ );
1339
+ addProxyMethod(
1340
+ 6,
1341
+ tableName,
1342
+ ROW,
1343
+ ID + OR_UNDEFINED,
1344
+ 'Add a new Row to ' + getTableDoc(tableId),
1345
+ 'row: ' + rowWhenSetType2 + ', reuseIds?: boolean',
1346
+ TABLE_ID + ', row, reuseIds',
1347
+ );
1348
+ addProxyMethod(
1349
+ 0,
1350
+ tableName,
1351
+ CELL_IDS,
1352
+ cellIdType2 + SQUARE_BRACKETS,
1353
+ getIdsDoc(CELL, getRowDoc(tableId)),
1354
+ ROW_ID_PARAM,
1355
+ TABLE_ID + ', rowId',
1356
+ );
1357
+ addProxyMethod(
1358
+ 5,
1359
+ tableName,
1360
+ CELL,
1361
+ VOID,
1362
+ getForEachDoc(CELL, getRowDoc(tableId)),
1363
+ ROW_ID_PARAM + ', cellCallback: ' + cellCallbackType2,
1364
+ TABLE_ID + ', rowId, cellCallback as any',
1365
+ );
1366
+ mapCellSchema(
1367
+ tableId,
1368
+ (cellId, type, defaultValue, CELL_ID, cellName) => {
1369
+ const mapCellType = 'Map' + camel(type, 1);
1370
+ mapSet(mapCellOrValueTypes, type, mapCellType);
1371
+ const returnCellType =
1372
+ type + (isUndefined(defaultValue) ? OR_UNDEFINED : EMPTY_STRING);
1373
+ arrayForEach(
1374
+ [
1375
+ [returnCellType],
1376
+ [BOOLEAN],
1377
+ [storeType, `, cell: ${type} | ` + mapCellType, ', cell as any'],
1378
+ [storeType],
1379
+ ],
1380
+ (
1381
+ [returnType, params = EMPTY_STRING, paramsInCall = EMPTY_STRING],
1382
+ verb,
1383
+ ) =>
1384
+ addProxyMethod(
1385
+ verb,
1386
+ tableName + cellName,
1387
+ CELL,
1388
+ returnType,
1389
+ getCellContentDoc(tableId, cellId, verb),
1390
+ ROW_ID_PARAM + params,
1391
+ TABLE_ID + ', rowId, ' + CELL_ID + paramsInCall,
1392
+ ),
1393
+ );
1394
+ addProxyMethod(
1395
+ 1,
1396
+ tableName + cellName,
1397
+ TABLE + CELL,
1398
+ BOOLEAN,
1399
+ VERBS[1] +
1400
+ ` the '${cellId}' Cell anywhere in ` +
1401
+ getTableDoc(tableId),
1402
+ EMPTY_STRING,
1403
+ TABLE_ID + ', ' + CELL_ID,
1404
+ );
1405
+ },
1406
+ );
1407
+ });
1408
+ addProxyMethod(
1409
+ 0,
1410
+ EMPTY_STRING,
1411
+ TABLES + JSON$1,
1412
+ JSON$1,
1413
+ getTheContentOfTheStoreDoc(1, 6),
1414
+ );
1415
+ addProxyMethod(
1416
+ 2,
1417
+ EMPTY_STRING,
1418
+ TABLES + JSON$1,
1419
+ storeType,
1420
+ getTheContentOfTheStoreDoc(1, 7),
1421
+ 'tablesJson: ' + JSON$1,
1422
+ 'tables' + JSON$1,
1423
+ );
1424
+ addProxyListener(
1425
+ HAS + TABLES,
1426
+ hasTablesListenerType,
1427
+ getTheContentOfTheStoreDoc(1, 8, 0, 1) + ' changes',
1428
+ );
1429
+ addProxyListener(
1430
+ TABLES,
1431
+ tablesListenerType,
1432
+ getTheContentOfTheStoreDoc(1, 8) + ' changes',
1433
+ );
1434
+ addProxyListener(TABLE_IDS, tableIdsListenerType, getListenerDoc(2, 0, 1));
1435
+ addProxyListener(
1436
+ HAS + TABLE,
1437
+ hasTableListenerType,
1438
+ getListenerDoc(3, 0, 0, 1),
1439
+ `tableId: ${tableIdType} | null`,
1440
+ 'tableId',
1441
+ );
1442
+ addProxyListener(
1443
+ TABLE,
1444
+ tableListenerType,
1445
+ getListenerDoc(3, 0),
1446
+ `tableId: ${tableIdType} | null`,
1447
+ 'tableId',
1448
+ );
1449
+ addProxyListener(
1450
+ TABLE + CELL_IDS,
1451
+ tableCellIdsListenerType,
1452
+ getListenerDoc(14, 3, 1),
1453
+ `tableId: ${tableIdType} | null`,
1454
+ 'tableId',
1455
+ );
1456
+ addProxyListener(
1457
+ HAS + TABLE + CELL,
1458
+ hasTableCellListenerType,
1459
+ getListenerDoc(16, 3, 0, 1),
1460
+ `tableId: ${tableIdType} | null, cellId: ${arrayJoin(
1461
+ mapTablesSchema((tableId) => {
1462
+ var _a, _b;
1463
+ return (_b =
1464
+ (_a = mapGet(tablesTypes, tableId)) == null ? void 0 : _a[4]) !=
1465
+ null
1466
+ ? _b
1467
+ : EMPTY_STRING;
1468
+ }),
1469
+ ' | ',
1470
+ )} | null`,
1471
+ 'tableId, cellId',
1472
+ );
1473
+ addProxyListener(
1474
+ ROW + COUNT,
1475
+ rowCountListenerType,
1476
+ getListenerDoc(15, 3),
1477
+ `tableId: ${tableIdType} | null`,
1478
+ 'tableId',
1479
+ );
1480
+ addProxyListener(
1481
+ ROW_IDS,
1482
+ rowIdsListenerType,
1483
+ getListenerDoc(4, 3, 1),
1484
+ `tableId: ${tableIdType} | null`,
1485
+ 'tableId',
1486
+ );
1487
+ addProxyListener(
1488
+ SORTED_ROW_IDS,
1489
+ sortedRowIdsListenerType,
1490
+ getListenerDoc(13, 3, 1),
1491
+ getParameterList(
1492
+ 'tableId: TId',
1493
+ `cellId: ${cellIdType}<TId>` + OR_UNDEFINED,
1494
+ 'descending: boolean',
1495
+ 'offset: number',
1496
+ 'limit: number' + OR_UNDEFINED,
1497
+ ),
1498
+ getParameterList('tableId', 'cellId', 'descending', 'offset', 'limit'),
1499
+ 1,
1500
+ '<TId extends TableId>',
1501
+ );
1502
+ addProxyListener(
1503
+ HAS + ROW,
1504
+ hasRowListenerType,
1505
+ getListenerDoc(5, 3, 0, 1),
1506
+ `tableId: ${tableIdType} | null, rowId: IdOrNull`,
1507
+ 'tableId, rowId',
1508
+ );
1509
+ addProxyListener(
1510
+ ROW,
1511
+ rowListenerType,
1512
+ getListenerDoc(5, 3),
1513
+ `tableId: ${tableIdType} | null, rowId: IdOrNull`,
1514
+ 'tableId, rowId',
1515
+ );
1516
+ addProxyListener(
1517
+ CELL_IDS,
1518
+ cellIdsListenerType,
1519
+ getListenerDoc(6, 5, 1),
1520
+ `tableId: ${tableIdType} | null, rowId: IdOrNull`,
1521
+ 'tableId, rowId',
1522
+ );
1523
+ addProxyListener(
1524
+ HAS + CELL,
1525
+ hasCellListenerType,
1526
+ getListenerDoc(7, 5, 0, 1),
1527
+ `tableId: ${tableIdType} | null, rowId: IdOrNull, cellId: ${arrayJoin(
1528
+ mapTablesSchema((tableId) => {
1529
+ var _a, _b;
1530
+ return (_b =
1531
+ (_a = mapGet(tablesTypes, tableId)) == null ? void 0 : _a[4]) !=
1532
+ null
1533
+ ? _b
1534
+ : EMPTY_STRING;
1535
+ }),
1536
+ ' | ',
1537
+ )} | null`,
1538
+ 'tableId, rowId, cellId',
1539
+ );
1540
+ addProxyListener(
1541
+ CELL,
1542
+ cellListenerType,
1543
+ getListenerDoc(7, 5),
1544
+ `tableId: ${tableIdType} | null, rowId: IdOrNull, cellId: ${arrayJoin(
1545
+ mapTablesSchema((tableId) => {
1546
+ var _a, _b;
1547
+ return (_b =
1548
+ (_a = mapGet(tablesTypes, tableId)) == null ? void 0 : _a[4]) !=
1549
+ null
1550
+ ? _b
1551
+ : EMPTY_STRING;
1552
+ }),
1553
+ ' | ',
1554
+ )} | null`,
1555
+ 'tableId, rowId, cellId',
1556
+ );
1557
+ addProxyListener(
1558
+ INVALID + CELL,
1559
+ invalidCellListenerType,
1560
+ REGISTERS_A_LISTENER + ' whenever an invalid Cell change was attempted',
1561
+ `tableId: IdOrNull, rowId: IdOrNull, cellId: IdOrNull`,
1562
+ 'tableId, rowId, cellId',
1563
+ );
1564
+ addImport(1, moduleDefinition, ...collValues(mapCellOrValueTypes));
1565
+ arrayPush(
1566
+ createSteps,
1567
+ '.set' + TABLES + SCHEMA + '({',
1568
+ flat(
1569
+ mapTablesSchema((tableId, _, TABLE_ID) => [
1570
+ `[${TABLE_ID}]: {`,
1571
+ ...mapCellSchema(
1572
+ tableId,
1573
+ (_2, type, defaultValue, CELL_ID) =>
1574
+ `[${CELL_ID}]: {[${addConstant(
1575
+ snake(TYPE),
1576
+ `'${TYPE}'`,
1577
+ )}]: ${addConstant(snake(type), `'${type}'`)}${isUndefined(defaultValue) ? EMPTY_STRING : `, [${addConstant(snake(DEFAULT), `'${DEFAULT}'`)}]: ` + (isString(defaultValue) ? addConstant(snake(defaultValue), `'${defaultValue}'`) : defaultValue)}},`,
1578
+ ),
1579
+ `},`,
1580
+ ]),
1581
+ ),
1582
+ '})',
1583
+ );
1584
+ } else {
1585
+ addImport(null, TINYBASE, TABLES);
1586
+ }
1587
+ if (!objIsEmpty(valuesSchema)) {
1588
+ const [
1589
+ valuesType,
1590
+ valuesWhenSetType,
1591
+ valueIdType,
1592
+ _valueType,
1593
+ valueCallbackType,
1594
+ hasValuesListenerType,
1595
+ valuesListenerType,
1596
+ valueIdsListenerType,
1597
+ hasValueListenerType,
1598
+ valueListenerType,
1599
+ invalidValueListenerType,
1600
+ ] = getValuesTypes(storeInstance, storeType);
1601
+ addImport(
1602
+ 1,
1603
+ moduleDefinition,
1604
+ valuesType,
1605
+ valuesWhenSetType,
1606
+ valueIdType,
1607
+ valueCallbackType,
1608
+ hasValuesListenerType,
1609
+ valuesListenerType,
1610
+ valueIdsListenerType,
1611
+ hasValueListenerType,
1612
+ valueListenerType,
1613
+ invalidValueListenerType,
1614
+ );
1615
+ sharedValueTypes = [
1616
+ valuesType,
1617
+ valuesWhenSetType,
1618
+ valueIdType,
1619
+ hasValuesListenerType,
1620
+ valuesListenerType,
1621
+ valueIdsListenerType,
1622
+ hasValueListenerType,
1623
+ valueListenerType,
1624
+ ];
1625
+ arrayForEach(
1626
+ [
1627
+ [valuesType],
1628
+ [BOOLEAN],
1629
+ [storeType, 'values: ' + valuesWhenSetType, 'values'],
1630
+ [storeType],
1631
+ [storeType, 'partialValues: ' + valuesWhenSetType, 'partialValues'],
1632
+ ],
1633
+ ([returnType, params, paramsInCall], verb) =>
1634
+ addProxyMethod(
1635
+ verb,
1636
+ EMPTY_STRING,
1637
+ VALUES,
1638
+ returnType,
1639
+ getTheContentOfTheStoreDoc(2, verb),
1640
+ params,
1641
+ paramsInCall,
1642
+ ),
1643
+ );
1644
+ addProxyMethod(
1645
+ 0,
1646
+ EMPTY_STRING,
1647
+ VALUE_IDS,
1648
+ valueIdType + SQUARE_BRACKETS,
1649
+ getIdsDoc(VALUE, THE_STORE),
1650
+ );
1651
+ addProxyMethod(
1652
+ 5,
1653
+ EMPTY_STRING,
1654
+ VALUE,
1655
+ `void`,
1656
+ getForEachDoc(VALUE, THE_STORE),
1657
+ `valueCallback: ${valueCallbackType}`,
1658
+ 'valueCallback as any',
1659
+ );
1660
+ mapValuesSchema((valueId, type, _, VALUE_ID, valueName) => {
1661
+ const mapValueType = 'Map' + camel(type, 1);
1662
+ mapSet(mapCellOrValueTypes, type, mapValueType);
1663
+ arrayForEach(
1664
+ [
1665
+ [type],
1666
+ [BOOLEAN],
1667
+ [storeType, `value: ${type} | ` + mapValueType, ', value as any'],
1668
+ [storeType],
1669
+ ],
1670
+ ([returnType, params, paramsInCall = EMPTY_STRING], verb) =>
1671
+ addProxyMethod(
1672
+ verb,
1673
+ valueName,
1674
+ VALUE,
1675
+ returnType,
1676
+ getValueContentDoc(valueId, verb),
1677
+ params,
1678
+ VALUE_ID + paramsInCall,
1679
+ ),
1680
+ );
1681
+ });
1682
+ addProxyMethod(
1683
+ 0,
1684
+ EMPTY_STRING,
1685
+ VALUES + JSON$1,
1686
+ JSON$1,
1687
+ getTheContentOfTheStoreDoc(2, 6),
1688
+ );
1689
+ addProxyMethod(
1690
+ 2,
1691
+ EMPTY_STRING,
1692
+ VALUES + JSON$1,
1693
+ storeType,
1694
+ getTheContentOfTheStoreDoc(2, 7),
1695
+ 'valuesJson: ' + JSON$1,
1696
+ 'values' + JSON$1,
1697
+ );
1698
+ addProxyListener(
1699
+ HAS + VALUES,
1700
+ hasValuesListenerType,
1701
+ getTheContentOfTheStoreDoc(2, 8, 0, 1) + ' changes',
1702
+ );
1703
+ addProxyListener(
1704
+ VALUES,
1705
+ valuesListenerType,
1706
+ getTheContentOfTheStoreDoc(2, 8) + ' changes',
1707
+ );
1708
+ addProxyListener(VALUE_IDS, valueIdsListenerType, getListenerDoc(10, 0, 1));
1709
+ addProxyListener(
1710
+ HAS + VALUE,
1711
+ hasValueListenerType,
1712
+ getListenerDoc(11, 0, 0, 1),
1713
+ `valueId: ${valueIdType} | null`,
1714
+ 'valueId',
1715
+ );
1716
+ addProxyListener(
1717
+ VALUE,
1718
+ valueListenerType,
1719
+ getListenerDoc(11, 0),
1720
+ `valueId: ${valueIdType} | null`,
1721
+ 'valueId',
1722
+ );
1723
+ addProxyListener(
1724
+ INVALID + VALUE,
1725
+ invalidValueListenerType,
1726
+ REGISTERS_A_LISTENER + ' whenever an invalid Value change was attempted',
1727
+ `valueId: IdOrNull`,
1728
+ 'valueId',
1729
+ );
1730
+ addImport(1, moduleDefinition, ...collValues(mapCellOrValueTypes));
1731
+ addImport(0, TINYBASE, 'ValueChange');
1732
+ arrayPush(
1733
+ createSteps,
1734
+ '.set' + VALUES + SCHEMA + '({',
1735
+ mapValuesSchema((_, type, defaultValue, VALUE_ID) => [
1736
+ `[${VALUE_ID}]: {[${addConstant(
1737
+ snake(TYPE),
1738
+ `'${TYPE}'`,
1739
+ )}]: ${addConstant(snake(type), `'${type}'`)}${isUndefined(defaultValue) ? EMPTY_STRING : `, [${addConstant(snake(DEFAULT), `'${DEFAULT}'`)}]: ` + (isString(defaultValue) ? addConstant(snake(defaultValue), `'${defaultValue}'`) : defaultValue)}},`,
1740
+ ]),
1741
+ '})',
1742
+ );
1743
+ } else {
1744
+ addImport(null, TINYBASE, VALUES);
1745
+ }
1746
+ addProxyMethod(
1747
+ 0,
1748
+ EMPTY_STRING,
1749
+ 'Content',
1750
+ `[${TABLES}, ${VALUES}]`,
1751
+ getTheContentOfTheStoreDoc(0, 0),
1752
+ );
1753
+ addProxyMethod(
1754
+ 2,
1755
+ EMPTY_STRING,
1756
+ 'Content',
1757
+ storeType,
1758
+ getTheContentOfTheStoreDoc(0, 2),
1759
+ `[tables, values]: [${TABLES}, ${VALUES}]`,
1760
+ '[tables, values]',
1761
+ );
1762
+ addProxyMethod(
1763
+ 7,
1764
+ EMPTY_STRING,
1765
+ 'applyChanges',
1766
+ storeType,
1767
+ `Applies a set of ${CHANGES} to the Store`,
1768
+ 'changes: ' + CHANGES,
1769
+ 'changes',
1770
+ );
1771
+ mapForEach(mapCellOrValueTypes, (type, mapCellType) =>
1772
+ addType(
1773
+ mapCellType,
1774
+ `(cell: ${type}${OR_UNDEFINED}) => ` + type,
1775
+ `Takes a ${type} Cell value and returns another`,
1776
+ ),
1777
+ );
1778
+ addImport(
1779
+ null,
1780
+ TINYBASE,
1781
+ 'DoRollback',
1782
+ ID,
1783
+ 'IdOrNull',
1784
+ JSON$1,
1785
+ 'Store',
1786
+ CHANGES,
1787
+ );
1788
+ addProxyMethod(
1789
+ 0,
1790
+ EMPTY_STRING,
1791
+ JSON$1,
1792
+ JSON$1,
1793
+ getTheContentOfTheStoreDoc(0, 6),
1794
+ );
1795
+ addProxyMethod(
1796
+ 2,
1797
+ EMPTY_STRING,
1798
+ JSON$1,
1799
+ storeType,
1800
+ getTheContentOfTheStoreDoc(0, 7),
1801
+ 'tablesAndValuesJson: ' + JSON$1,
1802
+ 'tablesAndValuesJson',
1803
+ );
1804
+ addProxyMethod(
1805
+ 7,
1806
+ EMPTY_STRING,
1807
+ TRANSACTION_,
1808
+ 'Return',
1809
+ TRANSACTION_DOC,
1810
+ DO_ACTIONS_AND_ROLLBACK_PARAMS,
1811
+ 'actions, doRollback',
1812
+ '<Return>',
1813
+ );
1814
+ addProxyMethod(
1815
+ 7,
1816
+ EMPTY_STRING,
1817
+ 'start' + TRANSACTION,
1818
+ storeType,
1819
+ START_TRANSACTION_DOC,
1820
+ );
1821
+ addProxyMethod(
1822
+ 7,
1823
+ EMPTY_STRING,
1824
+ 'finish' + TRANSACTION,
1825
+ storeType,
1826
+ FINISH_TRANSACTION_DOC,
1827
+ DO_ROLLBACK_PARAM,
1828
+ 'doRollback',
1829
+ );
1830
+ const transactionListenerType = getTransactionListenerType(
1831
+ storeInstance,
1832
+ storeType,
1833
+ );
1834
+ addProxyListener(
1835
+ 'Start' + TRANSACTION,
1836
+ transactionListenerType,
1837
+ REGISTERS_A_LISTENER + ' just before the start of the ' + TRANSACTION_,
1838
+ EMPTY_STRING,
1839
+ EMPTY_STRING,
1840
+ 0,
1841
+ );
1842
+ addProxyListener(
1843
+ 'WillFinish' + TRANSACTION,
1844
+ transactionListenerType,
1845
+ REGISTERS_A_LISTENER + ' just before ' + THE_END_OF_THE_TRANSACTION,
1846
+ EMPTY_STRING,
1847
+ EMPTY_STRING,
1848
+ 0,
1849
+ );
1850
+ addProxyListener(
1851
+ 'DidFinish' + TRANSACTION,
1852
+ transactionListenerType,
1853
+ REGISTERS_A_LISTENER + ' just after ' + THE_END_OF_THE_TRANSACTION,
1854
+ EMPTY_STRING,
1855
+ EMPTY_STRING,
1856
+ 0,
1857
+ );
1858
+ addProxyMethod(
1859
+ 7,
1860
+ EMPTY_STRING,
1861
+ 'call' + LISTENER,
1862
+ storeType,
1863
+ 'Manually provoke a listener to be called',
1864
+ 'listenerId: Id',
1865
+ 'listenerId',
1866
+ );
1867
+ addProxyMethod(
1868
+ 3,
1869
+ EMPTY_STRING,
1870
+ LISTENER,
1871
+ storeType,
1872
+ 'Remove a listener that was previously added to ' + THE_STORE,
1873
+ 'listenerId: Id',
1874
+ 'listenerId',
1875
+ );
1876
+ addMethod(
1877
+ 'getStore',
1878
+ EMPTY_STRING,
1879
+ 'Store',
1880
+ 'store',
1881
+ VERBS[0] + ' the underlying Store object',
1882
+ );
1883
+ addImport(1, TINYBASE, 'createStore');
1884
+ addImport(
1885
+ 1,
1886
+ moduleDefinition,
1887
+ storeType,
1888
+ `create${storeType} as create${storeType}Decl`,
1889
+ transactionListenerType,
1890
+ );
1891
+ addConstant('store', ['createStore()', ...createSteps]);
1892
+ addInternalFunction('fluent', 'actions: () => Store', [
1893
+ 'actions();',
1894
+ `return ${storeInstance};`,
1895
+ ]);
1896
+ addInternalFunction(
1897
+ 'proxy',
1898
+ `listener: any`,
1899
+ `(_: Store, ...params: any[]) => listener(${storeInstance}, ...params)`,
1900
+ );
1901
+ addConstant(storeInstance, ['{', ...getMethods(1), '}']);
1902
+ return [
1903
+ build(
1904
+ ...getImports(0),
1905
+ ...getTypes(),
1906
+ EXPORT + ' interface ' + storeType + ' {',
1907
+ ...getMethods(0),
1908
+ '}',
1909
+ EMPTY_STRING,
1910
+ comment(`Creates a ${storeType} object`),
1911
+ EXPORT + ' function create' + storeType + '(): ' + storeType + ';',
1912
+ ),
1913
+ build(
1914
+ ...getImports(1),
1915
+ EXPORT +
1916
+ ' const create' +
1917
+ storeType +
1918
+ ': typeof create' +
1919
+ storeType +
1920
+ 'Decl = () => {',
1921
+ ...getConstants(),
1922
+ `return Object.freeze(${storeInstance});`,
1923
+ '};',
1924
+ ),
1925
+ sharedTableTypes,
1926
+ sharedValueTypes,
1927
+ ];
1928
+ };
1929
+
1930
+ const getGet = (noun) => GET + noun;
1931
+ const getGetAndGetDeps = (noun) =>
1932
+ getParameterList(getGet(noun), getGet(noun) + DEPS);
1933
+ const DEBUG_IDS_PROP_TYPE = 'debugIds?: boolean';
1934
+ const DEBUG_IDS_PROP = 'debugIds={debugIds}';
1935
+ const THEN_DEPS = 'then' + DEPS_SUFFIX;
1936
+ const PARAMETER = 'Parameter';
1937
+ const GETTER_ARGS = ': (parameter: ' + PARAMETER + ', store: Store) => ';
1938
+ const USE_CONTEXT = 'const contextValue = useContext(Context);';
1939
+ const BASED_ON_A_PARAMETER = ', based on a parameter';
1940
+ const COLON_SPACE = ': ';
1941
+ const GENERIC_PARAMETER = '<' + PARAMETER + ',>';
1942
+ const PARAMETERIZED_CALLBACK =
1943
+ PARAMETER + 'ized' + CALLBACK + '<' + PARAMETER + '>';
1944
+ const ROW_ID = 'rowId';
1945
+ const ROW_ID_PROP = 'rowId={rowId}';
1946
+ const SEPARATOR_AND_DEBUG_IDS = ', separator, debugIds';
1947
+ const SEPARATOR_PROP_TYPE = 'separator?: ReactElement | string';
1948
+ const THEN_PREFIX = 'then?: (store: Store';
1949
+ const THEN_AND_THEN_DEPS = getParameterList(
1950
+ THEN_PREFIX + ')' + RETURNS_VOID,
1951
+ THEN_DEPS,
1952
+ );
1953
+ const THEN_AND_THEN_DEPS_IN_CALL = 'then, then' + DEPS;
1954
+ const TYPED_ROW_ID = ROW_ID + COLON_SPACE + ID;
1955
+ const VIEW = 'View';
1956
+ const getListenerHookParams = (listenerType, ...extraParams) =>
1957
+ getParameterList(
1958
+ ...extraParams,
1959
+ LISTENER_ + ': ' + listenerType,
1960
+ LISTENER_ + DEPS_SUFFIX,
1961
+ 'mutator?: boolean',
1962
+ );
1963
+ const getListenerHookParamsInCall = (...extraParams) =>
1964
+ getParameterList(...extraParams, LISTENER_, LISTENER_ + DEPS, 'mutator');
1965
+ const getStoreUiReactApi = (
1966
+ tablesSchema,
1967
+ valuesSchema,
1968
+ module,
1969
+ sharedTableTypes,
1970
+ sharedValueTypes,
1971
+ ) => {
1972
+ const [
1973
+ build,
1974
+ addImport,
1975
+ addType,
1976
+ addInternalFunction,
1977
+ addConstant,
1978
+ getImports,
1979
+ getTypes,
1980
+ getConstants,
1981
+ ] = getCodeFunctions();
1982
+ const [mapTablesSchema, mapCellSchema, mapValuesSchema] = getSchemaFunctions(
1983
+ tablesSchema,
1984
+ valuesSchema,
1985
+ addConstant,
1986
+ );
1987
+ const moduleDefinition = `./${camel(module)}.d`;
1988
+ const uiReactModuleDefinition = `./${camel(module)}-ui-react.d`;
1989
+ const tinyBaseUiReact = 'tinybase/ui-react';
1990
+ const storeType = camel(module, 1);
1991
+ const storeInstance = camel(storeType);
1992
+ const StoreOrStoreId = storeType + 'Or' + storeType + ID;
1993
+ const storeOrStoreId = storeInstance + 'Or' + storeType + ID;
1994
+ const storeProp = storeInstance + `={${storeInstance}}`;
1995
+ const functions = mapNew();
1996
+ const addFunction = (
1997
+ name,
1998
+ parameters,
1999
+ returnType,
2000
+ body,
2001
+ doc,
2002
+ generic = EMPTY_STRING,
2003
+ ) => {
2004
+ addImport(1, uiReactModuleDefinition, name + ' as ' + name + 'Decl');
2005
+ return mapUnique(functions, name, [
2006
+ parameters,
2007
+ returnType,
2008
+ body,
2009
+ doc,
2010
+ generic,
2011
+ ]);
2012
+ };
2013
+ const addHook = (
2014
+ name,
2015
+ parameters,
2016
+ returnType,
2017
+ body,
2018
+ doc,
2019
+ generic = EMPTY_STRING,
2020
+ ) => addFunction(`use${name}`, parameters, returnType, body, doc, generic);
2021
+ const addProxyHook = (
2022
+ name,
2023
+ underlyingName,
2024
+ returnType,
2025
+ doc,
2026
+ preParameters = EMPTY_STRING,
2027
+ preParametersInCall = EMPTY_STRING,
2028
+ generic = EMPTY_STRING,
2029
+ postParameters = EMPTY_STRING,
2030
+ postParametersInCall = EMPTY_STRING,
2031
+ ) => {
2032
+ addImport(
2033
+ 1,
2034
+ tinyBaseUiReact,
2035
+ `use${underlyingName} as use${underlyingName}Core`,
2036
+ );
2037
+ return addHook(
2038
+ name,
2039
+ getParameterList(preParameters, storeOrStoreIdParameter, postParameters),
2040
+ returnType,
2041
+ useHook +
2042
+ `(${storeOrStoreId}, use${underlyingName}Core, [` +
2043
+ (preParametersInCall ? preParametersInCall : EMPTY_STRING) +
2044
+ (postParametersInCall ? '], [' + postParametersInCall : EMPTY_STRING) +
2045
+ ']);',
2046
+ doc,
2047
+ generic,
2048
+ );
2049
+ };
2050
+ const addComponent = (name, parameters, body, doc) =>
2051
+ addFunction(name, parameters, 1, body, doc);
2052
+ const getFunctions = (location = 0) =>
2053
+ mapMap(functions, ([parameters, returnType, body, doc, generic], name) => {
2054
+ const lines = location
2055
+ ? [
2056
+ EXPORT +
2057
+ ` const ${name}: typeof ${name}Decl = ${generic}(${parameters}): ${returnType == 1 ? 'any' : returnType} =>`,
2058
+ body,
2059
+ ]
2060
+ : [
2061
+ EXPORT +
2062
+ ` function ${name}${generic}(${parameters}): ${returnType == 1 ? 'ComponentReturnType' : returnType};`,
2063
+ ];
2064
+ if (!location) {
2065
+ arrayUnshift(lines, comment(doc));
2066
+ }
2067
+ arrayPush(lines, EMPTY_STRING);
2068
+ return lines;
2069
+ });
2070
+ addImport(
2071
+ null,
2072
+ TINYBASE,
2073
+ ID,
2074
+ 'Store',
2075
+ CALLBACK,
2076
+ PARAMETER + 'ized' + CALLBACK,
2077
+ );
2078
+ addImport(0, tinyBaseUiReact, 'ComponentReturnType');
2079
+ addImport(1, tinyBaseUiReact, 'useCellIds');
2080
+ addImport(null, tinyBaseUiReact, 'ExtraProps');
2081
+ addImport(0, moduleDefinition, storeType);
2082
+ const storeOrStoreIdType = addType(
2083
+ StoreOrStoreId,
2084
+ storeType + ' | ' + ID,
2085
+ `Used when you need to refer to a ${storeType} in a React hook or component`,
2086
+ );
2087
+ const providerPropsType = addType(
2088
+ PROVIDER + PROPS,
2089
+ getPropTypeList(
2090
+ storeInstance + OPTIONAL_COLON + storeType,
2091
+ storeInstance + `ById?: {[${storeInstance}Id: Id]: ${storeType}}`,
2092
+ ),
2093
+ `Used with the ${PROVIDER} component, so that a ` +
2094
+ storeType +
2095
+ ' can be passed into the context of an application',
2096
+ );
2097
+ addImport(0, 'react', 'ReactElement', 'ComponentType');
2098
+ addImport(1, 'react', 'React');
2099
+ addImport(1, uiReactModuleDefinition, storeOrStoreIdType, providerPropsType);
2100
+ const storeOrStoreIdParameter =
2101
+ storeOrStoreId + OPTIONAL_COLON + storeOrStoreIdType;
2102
+ addConstant('{createContext, useContext, useMemo}', 'React');
2103
+ addConstant(
2104
+ 'Context',
2105
+ `createContext<[${storeType}?, {[${storeInstance}Id: Id]: ${storeType}}?]>([])`,
2106
+ );
2107
+ addHook(
2108
+ `Create${storeType}`,
2109
+ `create: () => ${storeType}, create` + DEPS_SUFFIX,
2110
+ storeType,
2111
+ '\n// eslint-disable-next-line react-hooks/exhaustive-deps\nuseMemo(create, createDeps)',
2112
+ `Create a ${storeType} within a React application with convenient memoization`,
2113
+ );
2114
+ const getStoreHook = addHook(
2115
+ storeType,
2116
+ `id?: Id`,
2117
+ storeType + OR_UNDEFINED,
2118
+ [
2119
+ '{',
2120
+ USE_CONTEXT,
2121
+ 'return id == null ? contextValue[0] : contextValue[1]?.[id];',
2122
+ '}',
2123
+ ],
2124
+ `Get a reference to a ${storeType} from within a ${PROVIDER} component context`,
2125
+ );
2126
+ const useHook = addInternalFunction(
2127
+ `useHook`,
2128
+ storeOrStoreId +
2129
+ `: ${storeOrStoreIdType} | undefined, hook: (...params: any[]) => any, preParams: any[], postParams: any[] = []`,
2130
+ [
2131
+ `const ${storeInstance} = ${getStoreHook}(${storeOrStoreId} as Id);`,
2132
+ `return hook(...preParams, ((${storeOrStoreId} == null || typeof ${storeOrStoreId} == 'string')`,
2133
+ `? ${storeInstance} : ${storeOrStoreId})?.getStore(), ...postParams)`,
2134
+ ],
2135
+ );
2136
+ const getProps = addInternalFunction(
2137
+ 'getProps',
2138
+ 'getProps: ((id: any) => ExtraProps) | undefined, id: Id',
2139
+ '(getProps == null) ? ({} as ExtraProps) : getProps(id)',
2140
+ );
2141
+ const wrap = addInternalFunction(
2142
+ 'wrap',
2143
+ getParameterList(
2144
+ 'children: any',
2145
+ 'separator?: any',
2146
+ 'encloseWithId?: boolean',
2147
+ 'id?: Id',
2148
+ ),
2149
+ [
2150
+ 'const separated = separator==null || !Array.isArray(children)',
2151
+ ' ? children',
2152
+ ' : children.map((child, c) => (c > 0 ? [separator, child] : child));',
2153
+ `return encloseWithId ? [id, ':{', separated, '}'] : separated;`,
2154
+ ],
2155
+ );
2156
+ const useCustomOrDefaultCellIds = addInternalFunction(
2157
+ 'useCustomOrDefaultCellIds',
2158
+ getParameterList(
2159
+ 'customCellIds: Ids | undefined',
2160
+ 'tableId: Id',
2161
+ 'rowId: Id',
2162
+ `${storeOrStoreId}?: ${storeOrStoreIdType} | undefined`,
2163
+ ),
2164
+ [
2165
+ `const defaultCellIds = ${useHook}(${storeOrStoreId}, useCellIds, [tableId, rowId]);`,
2166
+ 'return customCellIds ?? defaultCellIds;',
2167
+ ],
2168
+ );
2169
+ const NullComponent = addConstant('NullComponent', `() => null`);
2170
+ if (!objIsEmpty(tablesSchema)) {
2171
+ const [
2172
+ tablesType,
2173
+ tablesWhenSetType,
2174
+ tableIdType,
2175
+ cellIdType,
2176
+ hasTablesListenerType,
2177
+ tablesListenerType,
2178
+ tableIdsListenerType,
2179
+ hasTableListenerType,
2180
+ tableListenerType,
2181
+ tableCellIdsListenerType,
2182
+ hasTableCellListenerType,
2183
+ rowCountListenerType,
2184
+ rowIdsListenerType,
2185
+ sortedRowIdsListenerType,
2186
+ hasRowListenerType,
2187
+ rowListenerType,
2188
+ cellIdsListenerType,
2189
+ hasCellListenerType,
2190
+ cellListenerType,
2191
+ tablesTypes,
2192
+ ] = sharedTableTypes;
2193
+ addImport(
2194
+ null,
2195
+ moduleDefinition,
2196
+ tablesType,
2197
+ tablesWhenSetType,
2198
+ tableIdType,
2199
+ hasTablesListenerType,
2200
+ tablesListenerType,
2201
+ tableIdsListenerType,
2202
+ hasTableListenerType,
2203
+ tableListenerType,
2204
+ tableCellIdsListenerType,
2205
+ hasTableCellListenerType,
2206
+ rowCountListenerType,
2207
+ rowIdsListenerType,
2208
+ sortedRowIdsListenerType,
2209
+ hasRowListenerType,
2210
+ rowListenerType,
2211
+ cellIdsListenerType,
2212
+ cellListenerType,
2213
+ hasCellListenerType,
2214
+ );
2215
+ addImport(0, moduleDefinition, cellIdType);
2216
+ addImport(1, moduleDefinition, storeType);
2217
+ addImport(null, TINYBASE, IDS, 'IdOrNull');
2218
+ const tableView = addInternalFunction(
2219
+ 'tableView',
2220
+ `{${storeInstance}, rowComponent, getRowComponentProps, customCellIds` +
2221
+ SEPARATOR_AND_DEBUG_IDS +
2222
+ '}: any, rowIds: Ids, tableId: Id, defaultRowComponent: React.ComponentType<any>',
2223
+ [
2224
+ 'const Row = rowComponent ?? defaultRowComponent;',
2225
+ `return ${wrap}(rowIds.map((rowId) => (`,
2226
+ '<Row',
2227
+ '{...' + getProps + '(getRowComponentProps, rowId)}',
2228
+ 'key={rowId}',
2229
+ 'tableId={tableId}',
2230
+ ROW_ID_PROP,
2231
+ 'customCellIds={customCellIds}',
2232
+ storeProp,
2233
+ DEBUG_IDS_PROP,
2234
+ '/>',
2235
+ '))',
2236
+ SEPARATOR_AND_DEBUG_IDS,
2237
+ ', tableId,',
2238
+ ');',
2239
+ ],
2240
+ );
2241
+ const getDefaultTableComponent = addInternalFunction(
2242
+ 'getDefaultTableComponent',
2243
+ 'tableId: Id',
2244
+ arrayJoin(
2245
+ mapTablesSchema(
2246
+ (_, tableName, TABLE_ID) =>
2247
+ `tableId == ${TABLE_ID} ? ${tableName}TableView : `,
2248
+ ),
2249
+ ) + NullComponent,
2250
+ );
2251
+ const getDefaultCellComponent = addInternalFunction(
2252
+ 'getDefaultCellComponent',
2253
+ 'tableId: Id, cellId: Id',
2254
+ arrayJoin(
2255
+ mapTablesSchema(
2256
+ (tableId, tableName, TABLE_ID) =>
2257
+ `tableId == ${TABLE_ID} ? ${
2258
+ arrayJoin(
2259
+ mapCellSchema(
2260
+ tableId,
2261
+ (_, _2, _3, CELL_ID, cellName) =>
2262
+ `cellId == ${CELL_ID} ? ` +
2263
+ tableName +
2264
+ cellName +
2265
+ 'CellView : ',
2266
+ ),
2267
+ ) + NullComponent
2268
+ } : `,
2269
+ ),
2270
+ ) + NullComponent,
2271
+ );
2272
+ addProxyHook(
2273
+ HAS + TABLES,
2274
+ HAS + TABLES,
2275
+ BOOLEAN,
2276
+ getTheContentOfTheStoreDoc(1, 0, 0, 1) + AND_REGISTERS,
2277
+ );
2278
+ addProxyHook(
2279
+ TABLES,
2280
+ TABLES,
2281
+ tablesType,
2282
+ getTheContentOfTheStoreDoc(1, 0) + AND_REGISTERS,
2283
+ );
2284
+ const useTableIds = addProxyHook(
2285
+ TABLE_IDS,
2286
+ TABLE_IDS,
2287
+ tableIdType + SQUARE_BRACKETS,
2288
+ getIdsDoc(TABLE, THE_STORE) + AND_REGISTERS,
2289
+ );
2290
+ addProxyHook(
2291
+ SET + TABLES + CALLBACK,
2292
+ SET + TABLES + CALLBACK,
2293
+ PARAMETERIZED_CALLBACK,
2294
+ getTheContentOfTheStoreDoc(1, 9) + BASED_ON_A_PARAMETER,
2295
+ getParameterList(
2296
+ getGet(TABLES) + GETTER_ARGS + tablesWhenSetType,
2297
+ getGet(TABLES) + DEPS_SUFFIX,
2298
+ ),
2299
+ getGetAndGetDeps(TABLES),
2300
+ GENERIC_PARAMETER,
2301
+ getParameterList(
2302
+ THEN_PREFIX,
2303
+ `tables: ${tablesWhenSetType})` + RETURNS_VOID,
2304
+ THEN_DEPS,
2305
+ ),
2306
+ THEN_AND_THEN_DEPS_IN_CALL,
2307
+ );
2308
+ addProxyHook(
2309
+ DEL + TABLES + CALLBACK,
2310
+ DEL + TABLES + CALLBACK,
2311
+ CALLBACK,
2312
+ getTheContentOfTheStoreDoc(1, 12),
2313
+ EMPTY_STRING,
2314
+ EMPTY_STRING,
2315
+ EMPTY_STRING,
2316
+ THEN_AND_THEN_DEPS,
2317
+ THEN_AND_THEN_DEPS_IN_CALL,
2318
+ );
2319
+ const cellPropsType = addType(
2320
+ CELL + PROPS,
2321
+ getPropTypeList(
2322
+ 'tableId?: TId',
2323
+ 'rowId: Id',
2324
+ 'cellId?: CId',
2325
+ storeInstance + OPTIONAL_COLON + storeType,
2326
+ DEBUG_IDS_PROP_TYPE,
2327
+ ),
2328
+ getPropsDoc(A + CELL),
2329
+ `<TId extends ${tableIdType}, CId extends ${cellIdType}<TId>>`,
2330
+ );
2331
+ const rowPropsType = addType(
2332
+ ROW + PROPS,
2333
+ getPropTypeList(
2334
+ `tableId?: TId`,
2335
+ 'rowId: Id',
2336
+ storeInstance + OPTIONAL_COLON + storeType,
2337
+ 'cellComponents?: {readonly [CId in ' +
2338
+ cellIdType +
2339
+ `<TId>]?: ComponentType<${cellPropsType}<TId, CId>>;}`,
2340
+ `getCellComponentProps?: (cellId: ${cellIdType}<TId>) => ExtraProps`,
2341
+ `customCellIds?: ${cellIdType}<TId>[]`,
2342
+ SEPARATOR_PROP_TYPE,
2343
+ DEBUG_IDS_PROP_TYPE,
2344
+ ),
2345
+ getPropsDoc(A + ROW),
2346
+ `<TId extends ${tableIdType}>`,
2347
+ );
2348
+ const tablePropsType = addType(
2349
+ TABLE + PROPS,
2350
+ getPropTypeList(
2351
+ `tableId?: TId`,
2352
+ storeInstance + OPTIONAL_COLON + storeType,
2353
+ `rowComponent?: ComponentType<${rowPropsType}<TId>>`,
2354
+ `getRowComponentProps?: (rowId: Id) => ExtraProps`,
2355
+ `customCellIds?: CellId<TId>[]`,
2356
+ SEPARATOR_PROP_TYPE,
2357
+ DEBUG_IDS_PROP_TYPE,
2358
+ ),
2359
+ getPropsDoc(A + TABLE),
2360
+ `<TId extends ${tableIdType}>`,
2361
+ );
2362
+ const sortedTablePropsType = addType(
2363
+ 'Sorted' + TABLE + PROPS,
2364
+ getPropTypeList(
2365
+ `tableId?: TId`,
2366
+ 'cellId?: ' + cellIdType + '<TId>',
2367
+ 'descending?: boolean',
2368
+ 'offset?: number',
2369
+ 'limit?: number',
2370
+ storeInstance + OPTIONAL_COLON + storeType,
2371
+ `rowComponent?: ComponentType<${rowPropsType}<TId>>`,
2372
+ `getRowComponentProps?: (rowId: Id) => ExtraProps`,
2373
+ `customCellIds?: CellId<TId>[]`,
2374
+ SEPARATOR_PROP_TYPE,
2375
+ DEBUG_IDS_PROP_TYPE,
2376
+ ),
2377
+ getPropsDoc(A + 'sorted ' + TABLE),
2378
+ `<TId extends ${tableIdType}>`,
2379
+ );
2380
+ const tablesPropsType = addType(
2381
+ TABLES + PROPS,
2382
+ getPropTypeList(
2383
+ storeInstance + OPTIONAL_COLON + storeType,
2384
+ 'tableComponents?: {readonly [TId in ' +
2385
+ tableIdType +
2386
+ `]?: ComponentType<${tablePropsType}<TId>>;}`,
2387
+ `getTableComponentProps?: (tableId: ${tableIdType}) => ExtraProps`,
2388
+ SEPARATOR_PROP_TYPE,
2389
+ DEBUG_IDS_PROP_TYPE,
2390
+ ),
2391
+ getPropsDoc(getTheContentOfDoc(1, 1)),
2392
+ );
2393
+ addImport(
2394
+ 1,
2395
+ uiReactModuleDefinition,
2396
+ tablesPropsType,
2397
+ tablePropsType,
2398
+ sortedTablePropsType,
2399
+ rowPropsType,
2400
+ cellPropsType,
2401
+ );
2402
+ addComponent(
2403
+ TABLES + VIEW,
2404
+ '{' +
2405
+ storeInstance +
2406
+ ', tableComponents, getTableComponentProps' +
2407
+ SEPARATOR_AND_DEBUG_IDS +
2408
+ '}: ' +
2409
+ tablesPropsType,
2410
+ [
2411
+ wrap + `(${useTableIds}(${storeInstance}).map((tableId) => {`,
2412
+ 'const Table = (tableComponents?.[tableId] ?? ' +
2413
+ getDefaultTableComponent +
2414
+ `(tableId)) as React.ComponentType<TableProps<typeof tableId>>;`,
2415
+ 'return <Table',
2416
+ `{...${getProps}(getTableComponentProps, tableId)}`,
2417
+ 'tableId={tableId}',
2418
+ 'key={tableId}',
2419
+ storeProp,
2420
+ DEBUG_IDS_PROP,
2421
+ '/>;',
2422
+ '}), separator)',
2423
+ ],
2424
+ getTheContentOfTheStoreDoc(1, 13) + AND_REGISTERS,
2425
+ );
2426
+ mapTablesSchema((tableId, tableName, TABLE_ID) => {
2427
+ const [
2428
+ tableType,
2429
+ tableWhenSetType,
2430
+ rowType,
2431
+ rowWhenSetType,
2432
+ cellIdType2,
2433
+ ] = mapGet(tablesTypes, tableId);
2434
+ addImport(
2435
+ null,
2436
+ moduleDefinition,
2437
+ tableType,
2438
+ tableWhenSetType,
2439
+ rowType,
2440
+ rowWhenSetType,
2441
+ cellIdType2,
2442
+ );
2443
+ addProxyHook(
2444
+ HAS + tableName + TABLE,
2445
+ HAS + TABLE,
2446
+ BOOLEAN,
2447
+ getTableContentDoc(tableId, 0, 1) + AND_REGISTERS,
2448
+ EMPTY_STRING,
2449
+ TABLE_ID,
2450
+ );
2451
+ addProxyHook(
2452
+ tableName + TABLE,
2453
+ TABLE,
2454
+ tableType,
2455
+ getTableContentDoc(tableId) + AND_REGISTERS,
2456
+ EMPTY_STRING,
2457
+ TABLE_ID,
2458
+ );
2459
+ addProxyHook(
2460
+ tableName + TABLE + CELL_IDS,
2461
+ TABLE + CELL_IDS,
2462
+ IDS,
2463
+ getIdsDoc(CELL, 'the whole of ' + getTableDoc(tableId)) + AND_REGISTERS,
2464
+ EMPTY_STRING,
2465
+ TABLE_ID,
2466
+ );
2467
+ addProxyHook(
2468
+ tableName + ROW + COUNT,
2469
+ ROW + COUNT,
2470
+ NUMBER,
2471
+ 'Gets the number of Rows in ' + getTableDoc(tableId) + AND_REGISTERS,
2472
+ EMPTY_STRING,
2473
+ TABLE_ID,
2474
+ );
2475
+ const useRowIds = addProxyHook(
2476
+ tableName + ROW_IDS,
2477
+ ROW_IDS,
2478
+ IDS,
2479
+ getIdsDoc(ROW, getTableDoc(tableId)) + AND_REGISTERS,
2480
+ EMPTY_STRING,
2481
+ TABLE_ID,
2482
+ );
2483
+ const useSortedRowIds = addProxyHook(
2484
+ tableName + SORTED_ROW_IDS,
2485
+ SORTED_ROW_IDS,
2486
+ IDS,
2487
+ getIdsDoc(ROW, getTableDoc(tableId), 1) + AND_REGISTERS,
2488
+ 'cellId?: ' +
2489
+ cellIdType2 +
2490
+ ', descending?: boolean, offset?: number, limit?: number',
2491
+ TABLE_ID + ', cellId, descending, offset, limit',
2492
+ );
2493
+ addProxyHook(
2494
+ HAS + tableName + ROW,
2495
+ HAS + ROW,
2496
+ BOOLEAN,
2497
+ getRowContentDoc(tableId, 0, 1) + AND_REGISTERS,
2498
+ TYPED_ROW_ID,
2499
+ getParameterList(TABLE_ID, ROW_ID),
2500
+ );
2501
+ addProxyHook(
2502
+ tableName + ROW,
2503
+ ROW,
2504
+ rowType,
2505
+ getRowContentDoc(tableId) + AND_REGISTERS,
2506
+ TYPED_ROW_ID,
2507
+ getParameterList(TABLE_ID, ROW_ID),
2508
+ );
2509
+ addProxyHook(
2510
+ tableName + CELL_IDS,
2511
+ CELL_IDS,
2512
+ cellIdType2 + SQUARE_BRACKETS,
2513
+ getIdsDoc(CELL, getRowDoc(tableId)) + AND_REGISTERS,
2514
+ TYPED_ROW_ID,
2515
+ getParameterList(TABLE_ID, ROW_ID),
2516
+ );
2517
+ addProxyHook(
2518
+ SET + tableName + TABLE + CALLBACK,
2519
+ SET + TABLE + CALLBACK,
2520
+ PARAMETERIZED_CALLBACK,
2521
+ getTableContentDoc(tableId, 9) + BASED_ON_A_PARAMETER,
2522
+ getParameterList(
2523
+ getGet(TABLE) + GETTER_ARGS + tableWhenSetType,
2524
+ getGet(TABLE) + DEPS_SUFFIX,
2525
+ ),
2526
+ getParameterList(TABLE_ID, getGetAndGetDeps(TABLE)),
2527
+ GENERIC_PARAMETER,
2528
+ getParameterList(
2529
+ THEN_PREFIX,
2530
+ `table: ${tableWhenSetType})` + RETURNS_VOID,
2531
+ THEN_DEPS,
2532
+ ),
2533
+ THEN_AND_THEN_DEPS_IN_CALL,
2534
+ );
2535
+ addProxyHook(
2536
+ DEL + tableName + TABLE + CALLBACK,
2537
+ DEL + TABLE + CALLBACK,
2538
+ CALLBACK,
2539
+ getTableContentDoc(tableId, 12),
2540
+ EMPTY_STRING,
2541
+ TABLE_ID,
2542
+ EMPTY_STRING,
2543
+ THEN_AND_THEN_DEPS,
2544
+ THEN_AND_THEN_DEPS_IN_CALL,
2545
+ );
2546
+ addProxyHook(
2547
+ SET + tableName + ROW + CALLBACK,
2548
+ SET + ROW + CALLBACK,
2549
+ PARAMETERIZED_CALLBACK,
2550
+ getRowContentDoc(tableId, 9) + BASED_ON_A_PARAMETER,
2551
+ getParameterList(
2552
+ TYPED_ROW_ID,
2553
+ getGet(ROW) + GETTER_ARGS + rowWhenSetType,
2554
+ getGet(ROW) + DEPS_SUFFIX,
2555
+ ),
2556
+ getParameterList(TABLE_ID, ROW_ID, getGetAndGetDeps(ROW)),
2557
+ GENERIC_PARAMETER,
2558
+ getParameterList(
2559
+ THEN_PREFIX,
2560
+ `row: ${rowWhenSetType})` + RETURNS_VOID,
2561
+ THEN_DEPS,
2562
+ ),
2563
+ THEN_AND_THEN_DEPS_IN_CALL,
2564
+ );
2565
+ addProxyHook(
2566
+ 'Add' + tableName + ROW + CALLBACK,
2567
+ 'Add' + ROW + CALLBACK,
2568
+ PARAMETERIZED_CALLBACK,
2569
+ getRowContentDoc(tableId, 10) + BASED_ON_A_PARAMETER,
2570
+ getParameterList(
2571
+ getGet(ROW) + GETTER_ARGS + rowWhenSetType,
2572
+ getGet(ROW) + DEPS_SUFFIX,
2573
+ ),
2574
+ getParameterList(TABLE_ID, getGetAndGetDeps(ROW)),
2575
+ GENERIC_PARAMETER,
2576
+ 'then?: (' +
2577
+ getParameterList(
2578
+ TYPED_ROW_ID + OR_UNDEFINED,
2579
+ 'store: Store',
2580
+ 'row: ' + rowWhenSetType + ')' + RETURNS_VOID,
2581
+ 'then' + DEPS_SUFFIX,
2582
+ ) +
2583
+ ', reuseRowIds?: boolean',
2584
+ THEN_AND_THEN_DEPS_IN_CALL + ', reuseRowIds',
2585
+ );
2586
+ addProxyHook(
2587
+ SET + tableName + PARTIAL + ROW + CALLBACK,
2588
+ SET + PARTIAL + ROW + CALLBACK,
2589
+ PARAMETERIZED_CALLBACK,
2590
+ getRowContentDoc(tableId, 11) + BASED_ON_A_PARAMETER,
2591
+ getParameterList(
2592
+ TYPED_ROW_ID,
2593
+ getGet(PARTIAL + ROW) + GETTER_ARGS + rowWhenSetType,
2594
+ getGet(PARTIAL + ROW) + DEPS_SUFFIX,
2595
+ ),
2596
+ getParameterList(TABLE_ID, ROW_ID, getGetAndGetDeps(PARTIAL + ROW)),
2597
+ GENERIC_PARAMETER,
2598
+ getParameterList(
2599
+ THEN_PREFIX,
2600
+ `partialRow: ${rowWhenSetType})` + RETURNS_VOID,
2601
+ THEN_DEPS,
2602
+ ),
2603
+ THEN_AND_THEN_DEPS_IN_CALL,
2604
+ );
2605
+ addProxyHook(
2606
+ DEL + tableName + ROW + CALLBACK,
2607
+ DEL + ROW + CALLBACK,
2608
+ CALLBACK,
2609
+ getRowContentDoc(tableId, 12),
2610
+ TYPED_ROW_ID,
2611
+ getParameterList(TABLE_ID, ROW_ID),
2612
+ EMPTY_STRING,
2613
+ THEN_AND_THEN_DEPS,
2614
+ THEN_AND_THEN_DEPS_IN_CALL,
2615
+ );
2616
+ const rowView = addComponent(
2617
+ tableName + ROW + VIEW,
2618
+ '{rowId, ' +
2619
+ storeInstance +
2620
+ ', cellComponents, getCellComponentProps, customCellIds' +
2621
+ SEPARATOR_AND_DEBUG_IDS +
2622
+ `}: ${rowPropsType}<'${tableId}'>`,
2623
+ [
2624
+ wrap +
2625
+ `(${useCustomOrDefaultCellIds}(customCellIds, ` +
2626
+ TABLE_ID +
2627
+ `, rowId, ${storeInstance}).map((cellId: ${cellIdType2}) => {`,
2628
+ 'const Cell = (cellComponents?.[cellId] ?? ' +
2629
+ getDefaultCellComponent +
2630
+ `(${TABLE_ID}, cellId)) as React.ComponentType<CellProps<typeof ` +
2631
+ TABLE_ID +
2632
+ ', typeof cellId>>;',
2633
+ 'return <Cell',
2634
+ `{...${getProps}(getCellComponentProps, cellId)} `,
2635
+ 'key={cellId}',
2636
+ `tableId={${TABLE_ID}}`,
2637
+ ROW_ID_PROP,
2638
+ 'cellId={cellId}',
2639
+ storeProp,
2640
+ DEBUG_IDS_PROP,
2641
+ '/>;',
2642
+ '})' + SEPARATOR_AND_DEBUG_IDS + ', rowId)',
2643
+ ],
2644
+ getRowContentDoc(tableId, 13) + AND_REGISTERS,
2645
+ );
2646
+ addComponent(
2647
+ tableName + 'Sorted' + TABLE + VIEW,
2648
+ '{cellId, descending, offset, limit, ...props}: ' +
2649
+ sortedTablePropsType +
2650
+ `<'${tableId}'>`,
2651
+ tableView +
2652
+ '(props, ' +
2653
+ useSortedRowIds +
2654
+ `(cellId, descending, offset, limit, props.${storeInstance}), ${TABLE_ID}, ${rowView});`,
2655
+ getTableContentDoc(tableId, 13) + ', sorted' + AND_REGISTERS,
2656
+ );
2657
+ addComponent(
2658
+ tableName + TABLE + VIEW,
2659
+ `props: ${tablePropsType}<'${tableId}'>`,
2660
+ tableView +
2661
+ '(props, ' +
2662
+ useRowIds +
2663
+ `(props.${storeInstance}), ${TABLE_ID}, ${rowView});`,
2664
+ getTableContentDoc(tableId, 13) + AND_REGISTERS,
2665
+ );
2666
+ mapCellSchema(
2667
+ tableId,
2668
+ (cellId, type, defaultValue, CELL_ID, cellName) => {
2669
+ const mapCellType = 'Map' + camel(type, 1);
2670
+ addImport(0, moduleDefinition, mapCellType);
2671
+ addImport(1, moduleDefinition, mapCellType);
2672
+ addProxyHook(
2673
+ HAS + tableName + cellName + TABLE + CELL,
2674
+ HAS + TABLE + CELL,
2675
+ BOOLEAN,
2676
+ `Gets ${getHasDoc(1)}the '${cellId}' Cell anywhere in ` +
2677
+ getTableDoc(tableId) +
2678
+ AND_REGISTERS,
2679
+ EMPTY_STRING,
2680
+ getParameterList(TABLE_ID, CELL_ID),
2681
+ );
2682
+ addProxyHook(
2683
+ HAS + tableName + cellName + CELL,
2684
+ HAS + CELL,
2685
+ BOOLEAN,
2686
+ getCellContentDoc(tableId, cellId, 0, 1) + AND_REGISTERS,
2687
+ TYPED_ROW_ID,
2688
+ getParameterList(TABLE_ID, ROW_ID, CELL_ID),
2689
+ );
2690
+ const useCell = addProxyHook(
2691
+ tableName + cellName + CELL,
2692
+ CELL,
2693
+ type + (isUndefined(defaultValue) ? OR_UNDEFINED : EMPTY_STRING),
2694
+ getCellContentDoc(tableId, cellId) + AND_REGISTERS,
2695
+ TYPED_ROW_ID,
2696
+ getParameterList(TABLE_ID, ROW_ID, CELL_ID),
2697
+ );
2698
+ addProxyHook(
2699
+ SET + tableName + cellName + CELL + CALLBACK,
2700
+ SET + CELL + CALLBACK,
2701
+ PARAMETERIZED_CALLBACK,
2702
+ getCellContentDoc(tableId, cellId, 9) + BASED_ON_A_PARAMETER,
2703
+ getParameterList(
2704
+ TYPED_ROW_ID,
2705
+ getGet(CELL) + GETTER_ARGS + type + ' | ' + mapCellType,
2706
+ getGet(CELL) + DEPS_SUFFIX,
2707
+ ),
2708
+ getParameterList(TABLE_ID, ROW_ID, CELL_ID, getGetAndGetDeps(CELL)),
2709
+ GENERIC_PARAMETER,
2710
+ getParameterList(
2711
+ THEN_PREFIX,
2712
+ `cell: ${type} | ${mapCellType})` + RETURNS_VOID,
2713
+ THEN_DEPS,
2714
+ ),
2715
+ THEN_AND_THEN_DEPS_IN_CALL,
2716
+ );
2717
+ addProxyHook(
2718
+ DEL + tableName + cellName + CELL + CALLBACK,
2719
+ DEL + CELL + CALLBACK,
2720
+ CALLBACK,
2721
+ getCellContentDoc(tableId, cellId, 12),
2722
+ getParameterList(TYPED_ROW_ID, 'forceDel?: boolean'),
2723
+ getParameterList(TABLE_ID, ROW_ID, CELL_ID, 'forceDel'),
2724
+ EMPTY_STRING,
2725
+ THEN_AND_THEN_DEPS,
2726
+ THEN_AND_THEN_DEPS_IN_CALL,
2727
+ );
2728
+ addComponent(
2729
+ tableName + cellName + CELL + VIEW,
2730
+ `{rowId, ${storeInstance}, debugIds}: ` +
2731
+ cellPropsType +
2732
+ `<'${tableId}', '${cellId}'>`,
2733
+ [
2734
+ wrap +
2735
+ `('' + ${useCell}(rowId, ` +
2736
+ storeInstance +
2737
+ `) ?? '', undefined, debugIds, ${CELL_ID})`,
2738
+ ],
2739
+ getCellContentDoc(tableId, cellId, 13) + AND_REGISTERS,
2740
+ );
2741
+ },
2742
+ );
2743
+ });
2744
+ const cellIdsType = arrayJoin(
2745
+ mapTablesSchema((tableId) => {
2746
+ var _a, _b;
2747
+ return (_b =
2748
+ (_a = mapGet(tablesTypes, tableId)) == null ? void 0 : _a[4]) != null
2749
+ ? _b
2750
+ : EMPTY_STRING;
2751
+ }),
2752
+ ' | ',
2753
+ );
2754
+ addProxyHook(
2755
+ HAS + TABLES + LISTENER,
2756
+ HAS + TABLES + LISTENER,
2757
+ VOID,
2758
+ getTheContentOfTheStoreDoc(1, 8, 0, 1) + ' changes',
2759
+ getListenerHookParams(hasTablesListenerType),
2760
+ getListenerHookParamsInCall(),
2761
+ );
2762
+ addProxyHook(
2763
+ TABLES + LISTENER,
2764
+ TABLES + LISTENER,
2765
+ VOID,
2766
+ getTheContentOfTheStoreDoc(1, 8) + ' changes',
2767
+ getListenerHookParams(tablesListenerType),
2768
+ getListenerHookParamsInCall(),
2769
+ );
2770
+ addProxyHook(
2771
+ TABLE_IDS + LISTENER,
2772
+ TABLE_IDS + LISTENER,
2773
+ VOID,
2774
+ getListenerDoc(2, 0, 1),
2775
+ getListenerHookParams(tableIdsListenerType),
2776
+ getListenerHookParamsInCall(),
2777
+ );
2778
+ addProxyHook(
2779
+ HAS + TABLE + LISTENER,
2780
+ HAS + TABLE + LISTENER,
2781
+ VOID,
2782
+ getListenerDoc(3, 0, 0, 1),
2783
+ getListenerHookParams(
2784
+ hasTableListenerType,
2785
+ `tableId: ${tableIdType} | null`,
2786
+ ),
2787
+ getListenerHookParamsInCall('tableId'),
2788
+ );
2789
+ addProxyHook(
2790
+ TABLE + LISTENER,
2791
+ TABLE + LISTENER,
2792
+ VOID,
2793
+ getListenerDoc(3, 0),
2794
+ getListenerHookParams(
2795
+ tableListenerType,
2796
+ `tableId: ${tableIdType} | null`,
2797
+ ),
2798
+ getListenerHookParamsInCall('tableId'),
2799
+ );
2800
+ addProxyHook(
2801
+ TABLE + CELL_IDS + LISTENER,
2802
+ TABLE + CELL_IDS + LISTENER,
2803
+ VOID,
2804
+ getListenerDoc(14, 3, 1),
2805
+ getListenerHookParams(
2806
+ tableCellIdsListenerType,
2807
+ `tableId: ${tableIdType} | null`,
2808
+ ),
2809
+ getListenerHookParamsInCall('tableId'),
2810
+ );
2811
+ addProxyHook(
2812
+ HAS + TABLE + CELL + LISTENER,
2813
+ HAS + TABLE + CELL + LISTENER,
2814
+ VOID,
2815
+ getListenerDoc(16, 3, 0, 1),
2816
+ getListenerHookParams(
2817
+ hasTableCellListenerType,
2818
+ `tableId: ${tableIdType} | null`,
2819
+ `cellId: ${cellIdsType} | null`,
2820
+ ),
2821
+ getListenerHookParamsInCall('tableId', 'cellId'),
2822
+ );
2823
+ addProxyHook(
2824
+ ROW + COUNT + LISTENER,
2825
+ ROW + COUNT + LISTENER,
2826
+ VOID,
2827
+ getListenerDoc(15, 3),
2828
+ getListenerHookParams(
2829
+ rowCountListenerType,
2830
+ `tableId: ${tableIdType} | null`,
2831
+ ),
2832
+ getListenerHookParamsInCall('tableId'),
2833
+ );
2834
+ addProxyHook(
2835
+ ROW_IDS + LISTENER,
2836
+ ROW_IDS + LISTENER,
2837
+ VOID,
2838
+ getListenerDoc(4, 3, 1),
2839
+ getListenerHookParams(
2840
+ rowIdsListenerType,
2841
+ `tableId: ${tableIdType} | null`,
2842
+ ),
2843
+ getListenerHookParamsInCall('tableId'),
2844
+ );
2845
+ addProxyHook(
2846
+ SORTED_ROW_IDS + LISTENER,
2847
+ SORTED_ROW_IDS + LISTENER,
2848
+ VOID,
2849
+ getListenerDoc(13, 3, 1),
2850
+ getListenerHookParams(
2851
+ sortedRowIdsListenerType,
2852
+ `tableId: ${tableIdType} | null`,
2853
+ 'cellId: ' + cellIdsType + OR_UNDEFINED,
2854
+ 'descending: boolean',
2855
+ 'offset: number',
2856
+ 'limit: number' + OR_UNDEFINED,
2857
+ ),
2858
+ getListenerHookParamsInCall(
2859
+ 'tableId',
2860
+ 'cellId',
2861
+ 'descending',
2862
+ 'offset',
2863
+ 'limit',
2864
+ ),
2865
+ );
2866
+ addProxyHook(
2867
+ HAS + ROW + LISTENER,
2868
+ HAS + ROW + LISTENER,
2869
+ VOID,
2870
+ getListenerDoc(5, 3, 0, 1),
2871
+ getListenerHookParams(
2872
+ hasRowListenerType,
2873
+ `tableId: ${tableIdType} | null`,
2874
+ ROW_ID + `: IdOrNull`,
2875
+ ),
2876
+ getListenerHookParamsInCall('tableId', ROW_ID),
2877
+ );
2878
+ addProxyHook(
2879
+ ROW + LISTENER,
2880
+ ROW + LISTENER,
2881
+ VOID,
2882
+ getListenerDoc(5, 3),
2883
+ getListenerHookParams(
2884
+ rowListenerType,
2885
+ `tableId: ${tableIdType} | null`,
2886
+ ROW_ID + `: IdOrNull`,
2887
+ ),
2888
+ getListenerHookParamsInCall('tableId', ROW_ID),
2889
+ );
2890
+ addProxyHook(
2891
+ CELL_IDS + LISTENER,
2892
+ CELL_IDS + LISTENER,
2893
+ VOID,
2894
+ getListenerDoc(6, 5, 1),
2895
+ getListenerHookParams(
2896
+ cellIdsListenerType,
2897
+ `tableId: ${tableIdType} | null`,
2898
+ ROW_ID + `: IdOrNull`,
2899
+ ),
2900
+ getListenerHookParamsInCall('tableId', ROW_ID),
2901
+ );
2902
+ addProxyHook(
2903
+ HAS + CELL + LISTENER,
2904
+ HAS + CELL + LISTENER,
2905
+ VOID,
2906
+ getListenerDoc(7, 5, 0, 1),
2907
+ getListenerHookParams(
2908
+ hasCellListenerType,
2909
+ `tableId: ${tableIdType} | null`,
2910
+ ROW_ID + `: IdOrNull`,
2911
+ `cellId: ${cellIdsType} | null`,
2912
+ ),
2913
+ getListenerHookParamsInCall('tableId', ROW_ID, 'cellId'),
2914
+ );
2915
+ addProxyHook(
2916
+ CELL + LISTENER,
2917
+ CELL + LISTENER,
2918
+ VOID,
2919
+ getListenerDoc(7, 5),
2920
+ getListenerHookParams(
2921
+ cellListenerType,
2922
+ `tableId: ${tableIdType} | null`,
2923
+ ROW_ID + `: IdOrNull`,
2924
+ `cellId: ${cellIdsType} | null`,
2925
+ ),
2926
+ getListenerHookParamsInCall('tableId', ROW_ID, 'cellId'),
2927
+ );
2928
+ }
2929
+ if (!objIsEmpty(valuesSchema)) {
2930
+ const [
2931
+ valuesType,
2932
+ valuesWhenSetType,
2933
+ valueIdType,
2934
+ hasValuesListenerType,
2935
+ valuesListenerType,
2936
+ valueIdsListenerType,
2937
+ hasValueListenerType,
2938
+ valueListenerType,
2939
+ ] = sharedValueTypes;
2940
+ addImport(null, moduleDefinition, ...sharedValueTypes);
2941
+ addImport(1, moduleDefinition, storeType);
2942
+ const getDefaultValueComponent = addInternalFunction(
2943
+ 'getDefaultValueComponent',
2944
+ 'valueId: Id',
2945
+ arrayJoin(
2946
+ mapValuesSchema(
2947
+ (_, _2, _3, VALUE_ID, valueName) =>
2948
+ `valueId == ${VALUE_ID} ? ` + valueName + 'ValueView : ',
2949
+ ),
2950
+ ) + NullComponent,
2951
+ );
2952
+ addProxyHook(
2953
+ HAS + VALUES,
2954
+ HAS + VALUES,
2955
+ BOOLEAN,
2956
+ getTheContentOfTheStoreDoc(2, 0, 0, 1) + AND_REGISTERS,
2957
+ );
2958
+ addProxyHook(
2959
+ VALUES,
2960
+ VALUES,
2961
+ valuesType,
2962
+ getTheContentOfTheStoreDoc(2, 0) + AND_REGISTERS,
2963
+ );
2964
+ const useValueIds = addProxyHook(
2965
+ VALUE_IDS,
2966
+ VALUE_IDS,
2967
+ valueIdType + SQUARE_BRACKETS,
2968
+ getIdsDoc(VALUE, THE_STORE) + AND_REGISTERS,
2969
+ );
2970
+ addProxyHook(
2971
+ SET + VALUES + CALLBACK,
2972
+ SET + VALUES + CALLBACK,
2973
+ PARAMETERIZED_CALLBACK,
2974
+ getTheContentOfTheStoreDoc(2, 9) + BASED_ON_A_PARAMETER,
2975
+ getParameterList(
2976
+ getGet(VALUES) + GETTER_ARGS + valuesWhenSetType,
2977
+ getGet(VALUES) + DEPS_SUFFIX,
2978
+ ),
2979
+ getGetAndGetDeps(VALUES),
2980
+ GENERIC_PARAMETER,
2981
+ getParameterList(
2982
+ THEN_PREFIX,
2983
+ `values: ${valuesWhenSetType})` + RETURNS_VOID,
2984
+ THEN_DEPS,
2985
+ ),
2986
+ THEN_AND_THEN_DEPS_IN_CALL,
2987
+ );
2988
+ addProxyHook(
2989
+ SET + PARTIAL + VALUES + CALLBACK,
2990
+ SET + PARTIAL + VALUES + CALLBACK,
2991
+ PARAMETERIZED_CALLBACK,
2992
+ getTheContentOfTheStoreDoc(2, 11) + BASED_ON_A_PARAMETER,
2993
+ getParameterList(
2994
+ getGet(PARTIAL + VALUES) + GETTER_ARGS + valuesWhenSetType,
2995
+ getGet(PARTIAL + VALUES) + DEPS_SUFFIX,
2996
+ ),
2997
+ getGetAndGetDeps(PARTIAL + VALUES),
2998
+ GENERIC_PARAMETER,
2999
+ getParameterList(
3000
+ THEN_PREFIX,
3001
+ `partialValues: ${valuesWhenSetType})` + RETURNS_VOID,
3002
+ THEN_DEPS,
3003
+ ),
3004
+ THEN_AND_THEN_DEPS_IN_CALL,
3005
+ );
3006
+ addProxyHook(
3007
+ DEL + VALUES + CALLBACK,
3008
+ DEL + VALUES + CALLBACK,
3009
+ CALLBACK,
3010
+ getTheContentOfTheStoreDoc(2, 12),
3011
+ EMPTY_STRING,
3012
+ EMPTY_STRING,
3013
+ EMPTY_STRING,
3014
+ THEN_AND_THEN_DEPS,
3015
+ THEN_AND_THEN_DEPS_IN_CALL,
3016
+ );
3017
+ const valuePropsType = addType(
3018
+ VALUE + PROPS,
3019
+ getPropTypeList(
3020
+ `valueId?: VId`,
3021
+ storeInstance + OPTIONAL_COLON + storeType,
3022
+ DEBUG_IDS_PROP_TYPE,
3023
+ ),
3024
+ getPropsDoc('a Value'),
3025
+ `<VId extends ${valueIdType}>`,
3026
+ );
3027
+ const valuesPropsType = addType(
3028
+ VALUES + PROPS,
3029
+ getPropTypeList(
3030
+ storeInstance + OPTIONAL_COLON + storeType,
3031
+ 'valueComponents?: {readonly [VId in ' +
3032
+ valueIdType +
3033
+ `]?: ComponentType<${valuePropsType}<VId>>;}`,
3034
+ `getValueComponentProps?: (valueId: ${valueIdType}) => ExtraProps`,
3035
+ SEPARATOR_PROP_TYPE,
3036
+ DEBUG_IDS_PROP_TYPE,
3037
+ ),
3038
+ getPropsDoc(getTheContentOfDoc(2, 1)),
3039
+ );
3040
+ addImport(1, uiReactModuleDefinition, valuesPropsType, valuePropsType);
3041
+ addComponent(
3042
+ VALUES + VIEW,
3043
+ '{' +
3044
+ storeInstance +
3045
+ ', valueComponents, getValueComponentProps' +
3046
+ SEPARATOR_AND_DEBUG_IDS +
3047
+ '}: ' +
3048
+ valuesPropsType,
3049
+ [
3050
+ wrap + `(${useValueIds}(${storeInstance}).map((valueId) => {`,
3051
+ 'const Value = valueComponents?.[valueId] ?? ' +
3052
+ getDefaultValueComponent +
3053
+ '(valueId);',
3054
+ 'return <Value',
3055
+ `{...${getProps}(getValueComponentProps, valueId)}`,
3056
+ 'key={valueId}',
3057
+ storeProp,
3058
+ DEBUG_IDS_PROP,
3059
+ '/>;',
3060
+ '}), separator)',
3061
+ ],
3062
+ getTheContentOfTheStoreDoc(2, 13) + AND_REGISTERS,
3063
+ );
3064
+ mapValuesSchema((valueId, type, _, VALUE_ID, valueName) => {
3065
+ const mapValueType = 'Map' + camel(type, 1);
3066
+ addImport(0, moduleDefinition, mapValueType);
3067
+ addImport(1, moduleDefinition, mapValueType);
3068
+ addProxyHook(
3069
+ HAS + valueName + VALUE,
3070
+ HAS + VALUE,
3071
+ BOOLEAN,
3072
+ getValueContentDoc(valueId, 0, 1) + AND_REGISTERS,
3073
+ EMPTY_STRING,
3074
+ VALUE_ID,
3075
+ );
3076
+ const useValue = addProxyHook(
3077
+ valueName + VALUE,
3078
+ VALUE,
3079
+ type,
3080
+ getValueContentDoc(valueId) + AND_REGISTERS,
3081
+ EMPTY_STRING,
3082
+ VALUE_ID,
3083
+ );
3084
+ addProxyHook(
3085
+ SET + valueName + VALUE + CALLBACK,
3086
+ SET + VALUE + CALLBACK,
3087
+ PARAMETERIZED_CALLBACK,
3088
+ getValueContentDoc(valueId, 9) + BASED_ON_A_PARAMETER,
3089
+ getParameterList(
3090
+ getGet(VALUE) + GETTER_ARGS + type + ' | ' + mapValueType,
3091
+ getGet(VALUE) + DEPS_SUFFIX,
3092
+ ),
3093
+ getParameterList(VALUE_ID, getGetAndGetDeps(VALUE)),
3094
+ GENERIC_PARAMETER,
3095
+ getParameterList(
3096
+ THEN_PREFIX,
3097
+ `value: ${type} | ${mapValueType})` + RETURNS_VOID,
3098
+ THEN_DEPS,
3099
+ ),
3100
+ THEN_AND_THEN_DEPS_IN_CALL,
3101
+ );
3102
+ addProxyHook(
3103
+ DEL + valueName + VALUE + CALLBACK,
3104
+ DEL + VALUE + CALLBACK,
3105
+ CALLBACK,
3106
+ getValueContentDoc(valueId, 12),
3107
+ EMPTY_STRING,
3108
+ VALUE_ID,
3109
+ EMPTY_STRING,
3110
+ THEN_AND_THEN_DEPS,
3111
+ THEN_AND_THEN_DEPS_IN_CALL,
3112
+ );
3113
+ addComponent(
3114
+ valueName + VALUE + VIEW,
3115
+ `{${storeInstance}, debugIds}: ${valuePropsType}<'${valueId}'>`,
3116
+ [
3117
+ wrap +
3118
+ `('' + ${useValue}(` +
3119
+ storeInstance +
3120
+ `) ?? '', undefined, debugIds, ${VALUE_ID})`,
3121
+ ],
3122
+ getValueContentDoc(valueId, 13) + AND_REGISTERS,
3123
+ );
3124
+ });
3125
+ addProxyHook(
3126
+ HAS + VALUES + LISTENER,
3127
+ HAS + VALUES + LISTENER,
3128
+ VOID,
3129
+ getTheContentOfTheStoreDoc(2, 8, 0, 1) + ' changes',
3130
+ getListenerHookParams(hasValuesListenerType),
3131
+ getListenerHookParamsInCall(),
3132
+ );
3133
+ addProxyHook(
3134
+ VALUES + LISTENER,
3135
+ VALUES + LISTENER,
3136
+ VOID,
3137
+ getTheContentOfTheStoreDoc(2, 8) + ' changes',
3138
+ getListenerHookParams(valuesListenerType),
3139
+ getListenerHookParamsInCall(),
3140
+ );
3141
+ addProxyHook(
3142
+ VALUE_IDS + LISTENER,
3143
+ VALUE_IDS + LISTENER,
3144
+ VOID,
3145
+ getListenerDoc(10, 0, 1),
3146
+ getListenerHookParams(valueIdsListenerType),
3147
+ getListenerHookParamsInCall(),
3148
+ );
3149
+ addProxyHook(
3150
+ HAS + VALUE + LISTENER,
3151
+ HAS + VALUE + LISTENER,
3152
+ VOID,
3153
+ getListenerDoc(11, 0, 0, 1),
3154
+ getListenerHookParams(
3155
+ hasValueListenerType,
3156
+ `valueId: ${valueIdType} | null`,
3157
+ ),
3158
+ getListenerHookParamsInCall('valueId'),
3159
+ );
3160
+ addProxyHook(
3161
+ VALUE + LISTENER,
3162
+ VALUE + LISTENER,
3163
+ VOID,
3164
+ getListenerDoc(11, 0),
3165
+ getListenerHookParams(
3166
+ valueListenerType,
3167
+ `valueId: ${valueIdType} | null`,
3168
+ ),
3169
+ getListenerHookParamsInCall('valueId'),
3170
+ );
3171
+ }
3172
+ addComponent(
3173
+ PROVIDER,
3174
+ `{${storeInstance}, ${storeInstance}ById, children}: ` +
3175
+ providerPropsType +
3176
+ ' & {readonly children: React.ReactNode}',
3177
+ [
3178
+ '{',
3179
+ USE_CONTEXT,
3180
+ 'return (',
3181
+ '<Context.' + PROVIDER,
3182
+ 'value={useMemo(',
3183
+ `() => [${storeInstance} ?? contextValue[0], {...contextValue[1], ...${storeInstance}ById}],`,
3184
+ `[${storeInstance}, ${storeInstance}ById, contextValue],`,
3185
+ ')}>',
3186
+ '{children}',
3187
+ `</Context.${PROVIDER}>`,
3188
+ ');',
3189
+ '}',
3190
+ ],
3191
+ 'Wraps part of an application in a context that provides default objects to be used by hooks and components within',
3192
+ );
3193
+ return [
3194
+ build(...getImports(0), ...getTypes(), ...getFunctions(0)),
3195
+ build(...getImports(1), ...getConstants(), ...getFunctions(1)),
3196
+ ];
3197
+ };
3198
+
3199
+ const getStoreApi = (tablesSchema, valuesSchema, module) => {
3200
+ if (objIsEmpty(tablesSchema) && objIsEmpty(valuesSchema)) {
3201
+ return [EMPTY_STRING, EMPTY_STRING, EMPTY_STRING, EMPTY_STRING];
3202
+ }
3203
+ const [dTsCore, tsCore, sharedTableTypes, sharedValueTypes] = getStoreCoreApi(
3204
+ tablesSchema,
3205
+ valuesSchema,
3206
+ module,
3207
+ );
3208
+ return [
3209
+ dTsCore,
3210
+ tsCore,
3211
+ ...getStoreUiReactApi(
3212
+ tablesSchema,
3213
+ valuesSchema,
3214
+ module,
3215
+ sharedTableTypes,
3216
+ sharedValueTypes,
3217
+ ),
3218
+ ];
3219
+ };
3220
+
3221
+ const jsonParse = JSON.parse;
3222
+
3223
+ var __defProp = Object.defineProperty;
3224
+ var __defProps = Object.defineProperties;
3225
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
3226
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
3227
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
3228
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
3229
+ var __defNormalProp = (obj, key, value) =>
3230
+ key in obj
3231
+ ? __defProp(obj, key, {
3232
+ enumerable: true,
3233
+ configurable: true,
3234
+ writable: true,
3235
+ value,
3236
+ })
3237
+ : (obj[key] = value);
3238
+ var __spreadValues = (a, b) => {
3239
+ for (var prop in b || (b = {}))
3240
+ if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]);
3241
+ if (__getOwnPropSymbols)
3242
+ for (var prop of __getOwnPropSymbols(b)) {
3243
+ if (__propIsEnum.call(b, prop)) __defNormalProp(a, prop, b[prop]);
3244
+ }
3245
+ return a;
3246
+ };
3247
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
3248
+ var __async = (__this, __arguments, generator) => {
3249
+ return new Promise((resolve, reject) => {
3250
+ var fulfilled = (value) => {
3251
+ try {
3252
+ step(generator.next(value));
3253
+ } catch (e) {
3254
+ reject(e);
3255
+ }
3256
+ };
3257
+ var rejected = (value) => {
3258
+ try {
3259
+ step(generator.throw(value));
3260
+ } catch (e) {
3261
+ reject(e);
3262
+ }
3263
+ };
3264
+ var step = (x) =>
3265
+ x.done
3266
+ ? resolve(x.value)
3267
+ : Promise.resolve(x.value).then(fulfilled, rejected);
3268
+ step((generator = generator.apply(__this, __arguments)).next());
3269
+ });
3270
+ };
3271
+ const PRETTIER = 'prettier/';
3272
+ const PRETTIER_PLUGINS = PRETTIER + 'plugins/';
3273
+ const prettierConfig = {
3274
+ parser: 'typescript',
3275
+ singleQuote: true,
3276
+ trailingComma: 'all',
3277
+ bracketSpacing: false,
3278
+ jsdocSingleLineComment: false,
3279
+ };
3280
+ const createTools = getCreateFunction((store) => {
3281
+ const getStoreStats = (detail) => {
3282
+ let totalTables = 0;
3283
+ let totalRows = 0;
3284
+ let totalCells = 0;
3285
+ const tables = {};
3286
+ store.forEachTable((tableId, forEachRow) => {
3287
+ totalTables++;
3288
+ let tableRows = 0;
3289
+ let tableCells = 0;
3290
+ const rows = {};
3291
+ forEachRow((rowId, forEachCell) => {
3292
+ tableRows++;
3293
+ let rowCells = 0;
3294
+ forEachCell(() => rowCells++);
3295
+ tableCells += rowCells;
3296
+ if (detail) {
3297
+ rows[rowId] = {rowCells};
3298
+ }
3299
+ });
3300
+ totalRows += tableRows;
3301
+ totalCells += tableCells;
3302
+ if (detail) {
3303
+ tables[tableId] = {tableRows, tableCells, rows};
3304
+ }
3305
+ });
3306
+ return __spreadValues(
3307
+ {
3308
+ totalTables,
3309
+ totalRows,
3310
+ totalCells,
3311
+ totalValues: size(store.getValueIds()),
3312
+ jsonLength: size(store.getJson()),
3313
+ },
3314
+ detail ? {detail: {tables}} : {},
3315
+ );
3316
+ };
3317
+ const getStoreTablesSchema = () => {
3318
+ const tablesSchema = jsonParse(store.getTablesSchemaJson());
3319
+ if (
3320
+ !objIsEmpty(tablesSchema) ||
3321
+ arrayEvery(store.getTableIds(), (tableId) => {
3322
+ const rowIds = store.getRowIds(tableId);
3323
+ const cellsMeta = mapNew();
3324
+ if (
3325
+ arrayEvery(rowIds, (rowId) =>
3326
+ arrayEvery(store.getCellIds(tableId, rowId), (cellId) => {
3327
+ const value = store.getCell(tableId, rowId, cellId);
3328
+ const cellMeta = mapEnsure(cellsMeta, cellId, () => [
3329
+ getCellOrValueType(value),
3330
+ mapNew(),
3331
+ [0],
3332
+ 0,
3333
+ ]);
3334
+ const [type, values, [maxCount]] = cellMeta;
3335
+ const count = mapEnsure(values, value, () => 0) + 1;
3336
+ if (count > maxCount) {
3337
+ cellMeta[2] = [count, value];
3338
+ }
3339
+ mapSet(values, value, count);
3340
+ cellMeta[3]++;
3341
+ return type == getCellOrValueType(value);
3342
+ }),
3343
+ )
3344
+ ) {
3345
+ tablesSchema[tableId] = {};
3346
+ collForEach(cellsMeta, ([type, , [, maxValue], count], cellId) => {
3347
+ tablesSchema[tableId][cellId] = __spreadValues(
3348
+ {
3349
+ [TYPE]: type,
3350
+ },
3351
+ count == size(rowIds) ? {[DEFAULT]: maxValue} : {},
3352
+ );
3353
+ });
3354
+ return 1;
3355
+ }
3356
+ })
3357
+ ) {
3358
+ return tablesSchema;
3359
+ }
3360
+ return {};
3361
+ };
3362
+ const getStoreValuesSchema = () => {
3363
+ const valuesSchema = jsonParse(store.getValuesSchemaJson());
3364
+ if (objIsEmpty(valuesSchema)) {
3365
+ store.forEachValue((valueId, value) => {
3366
+ valuesSchema[valueId] = {
3367
+ [TYPE]: getCellOrValueType(value),
3368
+ };
3369
+ });
3370
+ }
3371
+ return valuesSchema;
3372
+ };
3373
+ const getStoreApi$1 = (module) =>
3374
+ getStoreApi(getStoreTablesSchema(), getStoreValuesSchema(), module);
3375
+ const getPrettyStoreApi = (module) =>
3376
+ __async(void 0, null, function* () {
3377
+ const extensions = ['d.ts', 'ts', 'd.ts', 'tsx'];
3378
+ const plugins = [];
3379
+ let format;
3380
+ try {
3381
+ format = (yield import(PRETTIER + 'standalone')).format;
3382
+ arrayPush(
3383
+ plugins,
3384
+ yield import(PRETTIER_PLUGINS + 'estree'),
3385
+ yield import(PRETTIER_PLUGINS + 'typescript'),
3386
+ );
3387
+ } catch (e) {
3388
+ format = (str) =>
3389
+ __async(void 0, null, function* () {
3390
+ return str;
3391
+ });
3392
+ }
3393
+ return yield promiseAll(
3394
+ arrayMap(getStoreApi$1(module), (file, f) =>
3395
+ __async(void 0, null, function* () {
3396
+ return formatJsDoc(
3397
+ yield format(
3398
+ file,
3399
+ __spreadProps(__spreadValues({}, prettierConfig), {
3400
+ plugins,
3401
+ filepath: `_.${extensions[f]}`,
3402
+ }),
3403
+ ),
3404
+ );
3405
+ }),
3406
+ ),
3407
+ );
3408
+ });
3409
+ const getStore = () => store;
3410
+ const tools = {
3411
+ getStoreStats,
3412
+ getStoreTablesSchema,
3413
+ getStoreValuesSchema,
3414
+ getStoreApi: getStoreApi$1,
3415
+ getPrettyStoreApi,
3416
+ getStore,
3417
+ };
3418
+ return objFreeze(tools);
3419
+ });
3420
+
3421
+ export {createTools};