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