tinybase 5.0.0-beta.22 → 5.0.0-beta.23

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 (271) hide show
  1. package/@types/mergeable-store/index.d.cts +77 -11
  2. package/@types/mergeable-store/index.d.ts +77 -11
  3. package/@types/mergeable-store/with-schemas/index.d.cts +96 -11
  4. package/@types/mergeable-store/with-schemas/index.d.ts +96 -11
  5. package/@types/persisters/index.d.cts +0 -1
  6. package/@types/persisters/index.d.ts +0 -1
  7. package/@types/persisters/persister-expo-sqlite/index.d.cts +36 -40
  8. package/@types/persisters/persister-expo-sqlite/index.d.ts +36 -40
  9. package/@types/persisters/persister-expo-sqlite/with-schemas/index.d.cts +36 -40
  10. package/@types/persisters/persister-expo-sqlite/with-schemas/index.d.ts +36 -40
  11. package/@types/persisters/with-schemas/index.d.cts +0 -1
  12. package/@types/persisters/with-schemas/index.d.ts +0 -1
  13. package/cjs/es6/index.cjs +3 -3
  14. package/cjs/es6/mergeable-store/index.cjs +2 -2
  15. package/cjs/es6/mergeable-store/with-schemas/index.cjs +2 -2
  16. package/cjs/es6/min/index.cjs +1 -1
  17. package/cjs/es6/min/index.cjs.gz +0 -0
  18. package/cjs/es6/min/mergeable-store/index.cjs +1 -1
  19. package/cjs/es6/min/mergeable-store/index.cjs.gz +0 -0
  20. package/cjs/es6/min/mergeable-store/with-schemas/index.cjs +1 -1
  21. package/cjs/es6/min/mergeable-store/with-schemas/index.cjs.gz +0 -0
  22. package/cjs/es6/min/persisters/persister-expo-sqlite/index.cjs +1 -1
  23. package/cjs/es6/min/persisters/persister-expo-sqlite/index.cjs.gz +0 -0
  24. package/cjs/es6/min/persisters/persister-expo-sqlite/with-schemas/index.cjs +1 -1
  25. package/cjs/es6/min/persisters/persister-expo-sqlite/with-schemas/index.cjs.gz +0 -0
  26. package/cjs/es6/min/synchronizers/index.cjs +1 -1
  27. package/cjs/es6/min/synchronizers/index.cjs.gz +0 -0
  28. package/cjs/es6/min/synchronizers/synchronizer-local/index.cjs +1 -1
  29. package/cjs/es6/min/synchronizers/synchronizer-local/index.cjs.gz +0 -0
  30. package/cjs/es6/min/synchronizers/synchronizer-local/with-schemas/index.cjs +1 -1
  31. package/cjs/es6/min/synchronizers/synchronizer-local/with-schemas/index.cjs.gz +0 -0
  32. package/cjs/es6/min/synchronizers/synchronizer-ws-client/index.cjs +1 -1
  33. package/cjs/es6/min/synchronizers/synchronizer-ws-client/index.cjs.gz +0 -0
  34. package/cjs/es6/min/synchronizers/synchronizer-ws-client/with-schemas/index.cjs +1 -1
  35. package/cjs/es6/min/synchronizers/synchronizer-ws-client/with-schemas/index.cjs.gz +0 -0
  36. package/cjs/es6/min/synchronizers/with-schemas/index.cjs +1 -1
  37. package/cjs/es6/min/synchronizers/with-schemas/index.cjs.gz +0 -0
  38. package/cjs/es6/min/with-schemas/index.cjs +1 -1
  39. package/cjs/es6/min/with-schemas/index.cjs.gz +0 -0
  40. package/cjs/es6/persisters/persister-expo-sqlite/index.cjs +7 -2
  41. package/cjs/es6/persisters/persister-expo-sqlite/with-schemas/index.cjs +7 -2
  42. package/cjs/es6/synchronizers/index.cjs +1 -1
  43. package/cjs/es6/synchronizers/synchronizer-local/index.cjs +1 -1
  44. package/cjs/es6/synchronizers/synchronizer-local/with-schemas/index.cjs +1 -1
  45. package/cjs/es6/synchronizers/synchronizer-ws-client/index.cjs +1 -1
  46. package/cjs/es6/synchronizers/synchronizer-ws-client/with-schemas/index.cjs +1 -1
  47. package/cjs/es6/synchronizers/with-schemas/index.cjs +1 -1
  48. package/cjs/es6/with-schemas/index.cjs +3 -3
  49. package/cjs/index.cjs +3 -3
  50. package/cjs/mergeable-store/index.cjs +2 -2
  51. package/cjs/mergeable-store/with-schemas/index.cjs +2 -2
  52. package/cjs/min/index.cjs +1 -1
  53. package/cjs/min/index.cjs.gz +0 -0
  54. package/cjs/min/mergeable-store/index.cjs +1 -1
  55. package/cjs/min/mergeable-store/index.cjs.gz +0 -0
  56. package/cjs/min/mergeable-store/with-schemas/index.cjs +1 -1
  57. package/cjs/min/mergeable-store/with-schemas/index.cjs.gz +0 -0
  58. package/cjs/min/persisters/persister-expo-sqlite/index.cjs +1 -1
  59. package/cjs/min/persisters/persister-expo-sqlite/index.cjs.gz +0 -0
  60. package/cjs/min/persisters/persister-expo-sqlite/with-schemas/index.cjs +1 -1
  61. package/cjs/min/persisters/persister-expo-sqlite/with-schemas/index.cjs.gz +0 -0
  62. package/cjs/min/synchronizers/index.cjs +1 -1
  63. package/cjs/min/synchronizers/index.cjs.gz +0 -0
  64. package/cjs/min/synchronizers/synchronizer-local/index.cjs +1 -1
  65. package/cjs/min/synchronizers/synchronizer-local/index.cjs.gz +0 -0
  66. package/cjs/min/synchronizers/synchronizer-local/with-schemas/index.cjs +1 -1
  67. package/cjs/min/synchronizers/synchronizer-local/with-schemas/index.cjs.gz +0 -0
  68. package/cjs/min/synchronizers/synchronizer-ws-client/index.cjs +1 -1
  69. package/cjs/min/synchronizers/synchronizer-ws-client/index.cjs.gz +0 -0
  70. package/cjs/min/synchronizers/synchronizer-ws-client/with-schemas/index.cjs +1 -1
  71. package/cjs/min/synchronizers/synchronizer-ws-client/with-schemas/index.cjs.gz +0 -0
  72. package/cjs/min/synchronizers/with-schemas/index.cjs +1 -1
  73. package/cjs/min/synchronizers/with-schemas/index.cjs.gz +0 -0
  74. package/cjs/min/with-schemas/index.cjs +1 -1
  75. package/cjs/min/with-schemas/index.cjs.gz +0 -0
  76. package/cjs/persisters/persister-expo-sqlite/index.cjs +7 -3
  77. package/cjs/persisters/persister-expo-sqlite/with-schemas/index.cjs +7 -3
  78. package/cjs/synchronizers/index.cjs +1 -1
  79. package/cjs/synchronizers/synchronizer-local/index.cjs +1 -1
  80. package/cjs/synchronizers/synchronizer-local/with-schemas/index.cjs +1 -1
  81. package/cjs/synchronizers/synchronizer-ws-client/index.cjs +1 -1
  82. package/cjs/synchronizers/synchronizer-ws-client/with-schemas/index.cjs +1 -1
  83. package/cjs/synchronizers/with-schemas/index.cjs +1 -1
  84. package/cjs/with-schemas/index.cjs +3 -3
  85. package/es6/index.js +3 -3
  86. package/es6/mergeable-store/index.js +2 -2
  87. package/es6/mergeable-store/with-schemas/index.js +2 -2
  88. package/es6/min/index.js +1 -1
  89. package/es6/min/index.js.gz +0 -0
  90. package/es6/min/mergeable-store/index.js +1 -1
  91. package/es6/min/mergeable-store/index.js.gz +0 -0
  92. package/es6/min/mergeable-store/with-schemas/index.js +1 -1
  93. package/es6/min/mergeable-store/with-schemas/index.js.gz +0 -0
  94. package/es6/min/persisters/persister-expo-sqlite/index.js +1 -1
  95. package/es6/min/persisters/persister-expo-sqlite/index.js.gz +0 -0
  96. package/es6/min/persisters/persister-expo-sqlite/with-schemas/index.js +1 -1
  97. package/es6/min/persisters/persister-expo-sqlite/with-schemas/index.js.gz +0 -0
  98. package/es6/min/synchronizers/index.js +1 -1
  99. package/es6/min/synchronizers/index.js.gz +0 -0
  100. package/es6/min/synchronizers/synchronizer-local/index.js +1 -1
  101. package/es6/min/synchronizers/synchronizer-local/index.js.gz +0 -0
  102. package/es6/min/synchronizers/synchronizer-local/with-schemas/index.js +1 -1
  103. package/es6/min/synchronizers/synchronizer-local/with-schemas/index.js.gz +0 -0
  104. package/es6/min/synchronizers/synchronizer-ws-client/index.js +1 -1
  105. package/es6/min/synchronizers/synchronizer-ws-client/index.js.gz +0 -0
  106. package/es6/min/synchronizers/synchronizer-ws-client/with-schemas/index.js +1 -1
  107. package/es6/min/synchronizers/synchronizer-ws-client/with-schemas/index.js.gz +0 -0
  108. package/es6/min/synchronizers/with-schemas/index.js +1 -1
  109. package/es6/min/synchronizers/with-schemas/index.js.gz +0 -0
  110. package/es6/min/with-schemas/index.js +1 -1
  111. package/es6/min/with-schemas/index.js.gz +0 -0
  112. package/es6/persisters/persister-expo-sqlite/index.js +5 -2
  113. package/es6/persisters/persister-expo-sqlite/with-schemas/index.js +5 -2
  114. package/es6/synchronizers/index.js +1 -1
  115. package/es6/synchronizers/synchronizer-local/index.js +1 -1
  116. package/es6/synchronizers/synchronizer-local/with-schemas/index.js +1 -1
  117. package/es6/synchronizers/synchronizer-ws-client/index.js +1 -1
  118. package/es6/synchronizers/synchronizer-ws-client/with-schemas/index.js +1 -1
  119. package/es6/synchronizers/with-schemas/index.js +1 -1
  120. package/es6/with-schemas/index.js +3 -3
  121. package/index.js +3 -3
  122. package/mergeable-store/index.js +2 -2
  123. package/mergeable-store/with-schemas/index.js +2 -2
  124. package/min/index.js +1 -1
  125. package/min/index.js.gz +0 -0
  126. package/min/mergeable-store/index.js +1 -1
  127. package/min/mergeable-store/index.js.gz +0 -0
  128. package/min/mergeable-store/with-schemas/index.js +1 -1
  129. package/min/mergeable-store/with-schemas/index.js.gz +0 -0
  130. package/min/persisters/persister-expo-sqlite/index.js +1 -1
  131. package/min/persisters/persister-expo-sqlite/index.js.gz +0 -0
  132. package/min/persisters/persister-expo-sqlite/with-schemas/index.js +1 -1
  133. package/min/persisters/persister-expo-sqlite/with-schemas/index.js.gz +0 -0
  134. package/min/synchronizers/index.js +1 -1
  135. package/min/synchronizers/index.js.gz +0 -0
  136. package/min/synchronizers/synchronizer-local/index.js +1 -1
  137. package/min/synchronizers/synchronizer-local/index.js.gz +0 -0
  138. package/min/synchronizers/synchronizer-local/with-schemas/index.js +1 -1
  139. package/min/synchronizers/synchronizer-local/with-schemas/index.js.gz +0 -0
  140. package/min/synchronizers/synchronizer-ws-client/index.js +1 -1
  141. package/min/synchronizers/synchronizer-ws-client/index.js.gz +0 -0
  142. package/min/synchronizers/synchronizer-ws-client/with-schemas/index.js +1 -1
  143. package/min/synchronizers/synchronizer-ws-client/with-schemas/index.js.gz +0 -0
  144. package/min/synchronizers/with-schemas/index.js +1 -1
  145. package/min/synchronizers/with-schemas/index.js.gz +0 -0
  146. package/min/with-schemas/index.js +1 -1
  147. package/min/with-schemas/index.js.gz +0 -0
  148. package/package.json +3 -107
  149. package/persisters/persister-expo-sqlite/index.js +5 -3
  150. package/persisters/persister-expo-sqlite/with-schemas/index.js +5 -3
  151. package/readme.md +2 -2
  152. package/releases.md +1 -1
  153. package/synchronizers/index.js +1 -1
  154. package/synchronizers/synchronizer-local/index.js +1 -1
  155. package/synchronizers/synchronizer-local/with-schemas/index.js +1 -1
  156. package/synchronizers/synchronizer-ws-client/index.js +1 -1
  157. package/synchronizers/synchronizer-ws-client/with-schemas/index.js +1 -1
  158. package/synchronizers/with-schemas/index.js +1 -1
  159. package/umd/es6/index.js +3 -3
  160. package/umd/es6/mergeable-store/index.js +2 -2
  161. package/umd/es6/mergeable-store/with-schemas/index.js +2 -2
  162. package/umd/es6/min/index.js +1 -1
  163. package/umd/es6/min/index.js.gz +0 -0
  164. package/umd/es6/min/mergeable-store/index.js +1 -1
  165. package/umd/es6/min/mergeable-store/index.js.gz +0 -0
  166. package/umd/es6/min/mergeable-store/with-schemas/index.js +1 -1
  167. package/umd/es6/min/mergeable-store/with-schemas/index.js.gz +0 -0
  168. package/umd/es6/min/persisters/persister-expo-sqlite/index.js +1 -1
  169. package/umd/es6/min/persisters/persister-expo-sqlite/index.js.gz +0 -0
  170. package/umd/es6/min/persisters/persister-expo-sqlite/with-schemas/index.js +1 -1
  171. package/umd/es6/min/persisters/persister-expo-sqlite/with-schemas/index.js.gz +0 -0
  172. package/umd/es6/min/synchronizers/index.js +1 -1
  173. package/umd/es6/min/synchronizers/index.js.gz +0 -0
  174. package/umd/es6/min/synchronizers/synchronizer-local/index.js +1 -1
  175. package/umd/es6/min/synchronizers/synchronizer-local/index.js.gz +0 -0
  176. package/umd/es6/min/synchronizers/synchronizer-local/with-schemas/index.js +1 -1
  177. package/umd/es6/min/synchronizers/synchronizer-local/with-schemas/index.js.gz +0 -0
  178. package/umd/es6/min/synchronizers/synchronizer-ws-client/index.js +1 -1
  179. package/umd/es6/min/synchronizers/synchronizer-ws-client/index.js.gz +0 -0
  180. package/umd/es6/min/synchronizers/synchronizer-ws-client/with-schemas/index.js +1 -1
  181. package/umd/es6/min/synchronizers/synchronizer-ws-client/with-schemas/index.js.gz +0 -0
  182. package/umd/es6/min/synchronizers/with-schemas/index.js +1 -1
  183. package/umd/es6/min/synchronizers/with-schemas/index.js.gz +0 -0
  184. package/umd/es6/min/with-schemas/index.js +1 -1
  185. package/umd/es6/min/with-schemas/index.js.gz +0 -0
  186. package/umd/es6/persisters/persister-expo-sqlite/index.js +9 -6
  187. package/umd/es6/persisters/persister-expo-sqlite/with-schemas/index.js +9 -6
  188. package/umd/es6/synchronizers/index.js +1 -1
  189. package/umd/es6/synchronizers/synchronizer-local/index.js +1 -1
  190. package/umd/es6/synchronizers/synchronizer-local/with-schemas/index.js +1 -1
  191. package/umd/es6/synchronizers/synchronizer-ws-client/index.js +1 -1
  192. package/umd/es6/synchronizers/synchronizer-ws-client/with-schemas/index.js +1 -1
  193. package/umd/es6/synchronizers/with-schemas/index.js +1 -1
  194. package/umd/es6/with-schemas/index.js +3 -3
  195. package/umd/index.js +3 -3
  196. package/umd/mergeable-store/index.js +2 -2
  197. package/umd/mergeable-store/with-schemas/index.js +2 -2
  198. package/umd/min/index.js +1 -1
  199. package/umd/min/index.js.gz +0 -0
  200. package/umd/min/mergeable-store/index.js +1 -1
  201. package/umd/min/mergeable-store/index.js.gz +0 -0
  202. package/umd/min/mergeable-store/with-schemas/index.js +1 -1
  203. package/umd/min/mergeable-store/with-schemas/index.js.gz +0 -0
  204. package/umd/min/persisters/persister-expo-sqlite/index.js +1 -1
  205. package/umd/min/persisters/persister-expo-sqlite/index.js.gz +0 -0
  206. package/umd/min/persisters/persister-expo-sqlite/with-schemas/index.js +1 -1
  207. package/umd/min/persisters/persister-expo-sqlite/with-schemas/index.js.gz +0 -0
  208. package/umd/min/synchronizers/index.js +1 -1
  209. package/umd/min/synchronizers/index.js.gz +0 -0
  210. package/umd/min/synchronizers/synchronizer-local/index.js +1 -1
  211. package/umd/min/synchronizers/synchronizer-local/index.js.gz +0 -0
  212. package/umd/min/synchronizers/synchronizer-local/with-schemas/index.js +1 -1
  213. package/umd/min/synchronizers/synchronizer-local/with-schemas/index.js.gz +0 -0
  214. package/umd/min/synchronizers/synchronizer-ws-client/index.js +1 -1
  215. package/umd/min/synchronizers/synchronizer-ws-client/index.js.gz +0 -0
  216. package/umd/min/synchronizers/synchronizer-ws-client/with-schemas/index.js +1 -1
  217. package/umd/min/synchronizers/synchronizer-ws-client/with-schemas/index.js.gz +0 -0
  218. package/umd/min/synchronizers/with-schemas/index.js +1 -1
  219. package/umd/min/synchronizers/with-schemas/index.js.gz +0 -0
  220. package/umd/min/with-schemas/index.js +1 -1
  221. package/umd/min/with-schemas/index.js.gz +0 -0
  222. package/umd/persisters/persister-expo-sqlite/index.js +9 -7
  223. package/umd/persisters/persister-expo-sqlite/with-schemas/index.js +9 -7
  224. package/umd/synchronizers/index.js +1 -1
  225. package/umd/synchronizers/synchronizer-local/index.js +1 -1
  226. package/umd/synchronizers/synchronizer-local/with-schemas/index.js +1 -1
  227. package/umd/synchronizers/synchronizer-ws-client/index.js +1 -1
  228. package/umd/synchronizers/synchronizer-ws-client/with-schemas/index.js +1 -1
  229. package/umd/synchronizers/with-schemas/index.js +1 -1
  230. package/umd/with-schemas/index.js +3 -3
  231. package/with-schemas/index.js +3 -3
  232. package/@types/persisters/persister-expo-sqlite-next/index.d.cts +0 -187
  233. package/@types/persisters/persister-expo-sqlite-next/index.d.ts +0 -187
  234. package/@types/persisters/persister-expo-sqlite-next/with-schemas/index.d.cts +0 -206
  235. package/@types/persisters/persister-expo-sqlite-next/with-schemas/index.d.ts +0 -206
  236. package/cjs/es6/min/persisters/persister-expo-sqlite-next/index.cjs +0 -1
  237. package/cjs/es6/min/persisters/persister-expo-sqlite-next/index.cjs.gz +0 -0
  238. package/cjs/es6/min/persisters/persister-expo-sqlite-next/with-schemas/index.cjs +0 -1
  239. package/cjs/es6/min/persisters/persister-expo-sqlite-next/with-schemas/index.cjs.gz +0 -0
  240. package/cjs/es6/persisters/persister-expo-sqlite-next/index.cjs +0 -1253
  241. package/cjs/es6/persisters/persister-expo-sqlite-next/with-schemas/index.cjs +0 -1253
  242. package/cjs/min/persisters/persister-expo-sqlite-next/index.cjs +0 -1
  243. package/cjs/min/persisters/persister-expo-sqlite-next/index.cjs.gz +0 -0
  244. package/cjs/min/persisters/persister-expo-sqlite-next/with-schemas/index.cjs +0 -1
  245. package/cjs/min/persisters/persister-expo-sqlite-next/with-schemas/index.cjs.gz +0 -0
  246. package/cjs/persisters/persister-expo-sqlite-next/index.cjs +0 -926
  247. package/cjs/persisters/persister-expo-sqlite-next/with-schemas/index.cjs +0 -926
  248. package/es6/min/persisters/persister-expo-sqlite-next/index.js +0 -1
  249. package/es6/min/persisters/persister-expo-sqlite-next/index.js.gz +0 -0
  250. package/es6/min/persisters/persister-expo-sqlite-next/with-schemas/index.js +0 -1
  251. package/es6/min/persisters/persister-expo-sqlite-next/with-schemas/index.js.gz +0 -0
  252. package/es6/persisters/persister-expo-sqlite-next/index.js +0 -1251
  253. package/es6/persisters/persister-expo-sqlite-next/with-schemas/index.js +0 -1251
  254. package/min/persisters/persister-expo-sqlite-next/index.js +0 -1
  255. package/min/persisters/persister-expo-sqlite-next/index.js.gz +0 -0
  256. package/min/persisters/persister-expo-sqlite-next/with-schemas/index.js +0 -1
  257. package/min/persisters/persister-expo-sqlite-next/with-schemas/index.js.gz +0 -0
  258. package/persisters/persister-expo-sqlite-next/index.js +0 -924
  259. package/persisters/persister-expo-sqlite-next/with-schemas/index.js +0 -924
  260. package/umd/es6/min/persisters/persister-expo-sqlite-next/index.js +0 -1
  261. package/umd/es6/min/persisters/persister-expo-sqlite-next/index.js.gz +0 -0
  262. package/umd/es6/min/persisters/persister-expo-sqlite-next/with-schemas/index.js +0 -1
  263. package/umd/es6/min/persisters/persister-expo-sqlite-next/with-schemas/index.js.gz +0 -0
  264. package/umd/es6/persisters/persister-expo-sqlite-next/index.js +0 -1293
  265. package/umd/es6/persisters/persister-expo-sqlite-next/with-schemas/index.js +0 -1293
  266. package/umd/min/persisters/persister-expo-sqlite-next/index.js +0 -1
  267. package/umd/min/persisters/persister-expo-sqlite-next/index.js.gz +0 -0
  268. package/umd/min/persisters/persister-expo-sqlite-next/with-schemas/index.js +0 -1
  269. package/umd/min/persisters/persister-expo-sqlite-next/with-schemas/index.js.gz +0 -0
  270. package/umd/persisters/persister-expo-sqlite-next/index.js +0 -957
  271. package/umd/persisters/persister-expo-sqlite-next/with-schemas/index.js +0 -957
@@ -1,187 +0,0 @@
1
- /**
2
- * The persister-expo-sqlite-next module of the TinyBase project lets you save
3
- * and load Store data to and from a local Expo-SQLite 'next' database (in an
4
- * appropriate React Native environment).
5
- *
6
- * This module provides a Persister for the modern version of Expo's
7
- * [SQLite](https://docs.expo.dev/versions/latest/sdk/sqlite)
8
- * library, designated 'next' as of November 2023. This API should be used if
9
- * you are installing the `expo-sqlite/next` module. In the future we expect
10
- * this module to become the default.
11
- *
12
- * Note that TinyBase support for the legacy version of Expo-SQLite
13
- * (`expo-sqlite`) is still available in the persister-expo-sqlite module.
14
- *
15
- * Note that this Persister is currently experimental as Expo themselves iterate
16
- * on the underlying database library API.
17
- * @see Persisting Data guide
18
- * @packageDocumentation
19
- * @module persister-expo-sqlite-next
20
- * @since v4.5.0
21
- */
22
-
23
- import type {DatabasePersisterConfig, Persister} from '../index.d.cts';
24
- import type {MergeableStore} from '../../mergeable-store/index.d.cts';
25
- import type {SQLiteDatabase} from 'expo-sqlite/next.d.cts';
26
- import type {Store} from '../../store/index.d.cts';
27
-
28
- /**
29
- * The ExpoSqliteNextPersister interface is a minor extension to the Persister
30
- * interface.
31
- *
32
- * It simply provides an extra getDb method for accessing a reference to the
33
- * database instance the Store is being persisted to.
34
- *
35
- * You should use the createExpoSqliteNextPersister function to create an
36
- * ExpoSqliteNextPersister object.
37
- * @category Persister
38
- * @since v4.5.0
39
- */
40
- export interface ExpoSqliteNextPersister extends Persister<3> {
41
- /**
42
- * The getDb method returns a reference to the database instance the Store is
43
- * being persisted to.
44
- * @returns A reference to the database instance.
45
- * @example
46
- * This example creates a Persister object against a newly-created Store and
47
- * then gets the database instance back out again.
48
- *
49
- * ```js yolo
50
- * import {createExpoSqliteNextPersister} from 'tinybase/persisters/persister-expo-sqlite-next';
51
- * import {createStore} from 'tinybase';
52
- * import {openDatabaseSync} from 'expo-sqlite';
53
- *
54
- * const db = openDatabaseSync('my.db');
55
- * const store = createStore().setTables({pets: {fido: {species: 'dog'}}});
56
- * const persister = createExpoSqliteNextPersister(store, db, 'my_tinybase');
57
- *
58
- * console.log(persister.getDb() == db);
59
- * // -> true
60
- *
61
- * persister.destroy();
62
- * ```
63
- * @category Getter
64
- * @since v4.5.0
65
- */
66
- getDb(): SQLiteDatabase;
67
- }
68
-
69
- /**
70
- * The createExpoSqliteNextPersister function creates a Persister object that
71
- * can persist the Store to a local Expo-SQLite database (in an appropriate
72
- * React Native environment).
73
- *
74
- * Note that this Persister is currently experimental as Expo themselves iterate
75
- * on the underlying database library API.
76
- *
77
- * As well as providing a reference to the Store to persist, you must provide a
78
- * `db` parameter which identifies the database instance.
79
- *
80
- * A database Persister uses one of two modes: either a JSON serialization of
81
- * the whole Store stored in a single row of a table (the default), or a tabular
82
- * mapping of Table Ids to database table names and vice-versa).
83
- *
84
- * The third argument is a DatabasePersisterConfig object that configures which
85
- * of those modes to use, and settings for each. If the third argument is simply
86
- * a string, it is used as the `storeTableName` property of the JSON
87
- * serialization.
88
- *
89
- * See the documentation for the DpcJson and DpcTabular types for more
90
- * information on how both of those modes can be configured.
91
- * @param store The Store to persist.
92
- * @param db The database instance that was returned from
93
- * `SQLite.openDatabase(...)`.
94
- * @param configOrStoreTableName A DatabasePersisterConfig to configure the
95
- * persistence mode (or a string to set the `storeTableName` property of the
96
- * JSON serialization).
97
- * @param onSqlCommand An optional handler called every time the Persister
98
- * executes a SQL command or query. This is suitable for logging persistence
99
- * behavior in a development environment.
100
- * @param onIgnoredError An optional handler for the errors that the Persister
101
- * would otherwise ignore when trying to save or load data. This is suitable for
102
- * debugging persistence issues in a development environment.
103
- * @returns A reference to the new ExpoSqliteNextPersister object.
104
- * @example
105
- * This example creates a ExpoSqliteNextPersister object and persists the Store
106
- * to a local SQLite database as a JSON serialization into the `my_tinybase`
107
- * table. It makes a change to the database directly and then reloads it back
108
- * into the Store.
109
- *
110
- * ```js yolo
111
- * import {createExpoSqliteNextPersister} from 'tinybase/persisters/persister-expo-sqlite-next';
112
- * import {createStore} from 'tinybase';
113
- * import {openDatabaseSync} from 'expo-sqlite';
114
- *
115
- * const db = openDatabaseSync('my.db');
116
- * const store = createStore().setTables({pets: {fido: {species: 'dog'}}});
117
- * const persister = createExpoSqliteNextPersister(store, db, 'my_tinybase');
118
- *
119
- * await persister.save();
120
- * // Store will be saved to the database.
121
- *
122
- * console.log(
123
- * await new Promise((resolve) =>
124
- * db.allAsync('SELECT * FROM my_tinybase;').then(resolve),
125
- * ),
126
- * );
127
- * // -> [{_id: '_', store: '[{"pets":{"fido":{"species":"dog"}}},{}]'}]
128
- *
129
- * await new Promise((resolve) =>
130
- * db
131
- * .allAsync(
132
- * 'UPDATE my_tinybase SET store = ' +
133
- * `'[{"pets":{"felix":{"species":"cat"}}},{}]' WHERE _id = '_';`,
134
- * )
135
- * .then(resolve),
136
- * );
137
- * await persister.load();
138
- * console.log(store.getTables());
139
- * // -> {pets: {felix: {species: 'cat'}}}
140
- *
141
- * persister.destroy();
142
- * ```
143
- * @example
144
- * This example creates a ExpoSqliteNextPersister object and persists the Store
145
- * to a local SQLite database with tabular mapping.
146
- *
147
- * ```js yolo
148
- * import {createExpoSqliteNextPersister} from 'tinybase/persisters/persister-expo-sqlite-next';
149
- * import {createStore} from 'tinybase';
150
- * import {openDatabaseSync} from 'expo-sqlite';
151
- *
152
- * const db = openDatabaseSync('my.db');
153
- * const store = createStore().setTables({pets: {fido: {species: 'dog'}}});
154
- * const persister = createExpoSqliteNextPersister(store, db, {
155
- * mode: 'tabular',
156
- * tables: {load: {pets: 'pets'}, save: {pets: 'pets'}},
157
- * });
158
- *
159
- * await persister.save();
160
- * console.log(
161
- * await new Promise((resolve) =>
162
- * db.allAsync('SELECT * FROM pets;').then(resolve),
163
- * ),
164
- * );
165
- * // -> [{_id: 'fido', species: 'dog'}]
166
- *
167
- * await new Promise((resolve) =>
168
- * db
169
- * .allAsync(`INSERT INTO pets (_id, species) VALUES ('felix', 'cat')`)
170
- * .then(resolve),
171
- * );
172
- * await persister.load();
173
- * console.log(store.getTables());
174
- * // -> {pets: {fido: {species: 'dog'}, felix: {species: 'cat'}}}
175
- *
176
- * persister.destroy();
177
- * ```
178
- * @category Creation
179
- * @since v4.5.0
180
- */
181
- export function createExpoSqliteNextPersister(
182
- store: Store | MergeableStore,
183
- db: SQLiteDatabase,
184
- configOrStoreTableName?: DatabasePersisterConfig | string,
185
- onSqlCommand?: (sql: string, args?: any[]) => void,
186
- onIgnoredError?: (error: any) => void,
187
- ): ExpoSqliteNextPersister;
@@ -1,187 +0,0 @@
1
- /**
2
- * The persister-expo-sqlite-next module of the TinyBase project lets you save
3
- * and load Store data to and from a local Expo-SQLite 'next' database (in an
4
- * appropriate React Native environment).
5
- *
6
- * This module provides a Persister for the modern version of Expo's
7
- * [SQLite](https://docs.expo.dev/versions/latest/sdk/sqlite)
8
- * library, designated 'next' as of November 2023. This API should be used if
9
- * you are installing the `expo-sqlite/next` module. In the future we expect
10
- * this module to become the default.
11
- *
12
- * Note that TinyBase support for the legacy version of Expo-SQLite
13
- * (`expo-sqlite`) is still available in the persister-expo-sqlite module.
14
- *
15
- * Note that this Persister is currently experimental as Expo themselves iterate
16
- * on the underlying database library API.
17
- * @see Persisting Data guide
18
- * @packageDocumentation
19
- * @module persister-expo-sqlite-next
20
- * @since v4.5.0
21
- */
22
-
23
- import type {DatabasePersisterConfig, Persister} from '../index.d.ts';
24
- import type {MergeableStore} from '../../mergeable-store/index.d.ts';
25
- import type {SQLiteDatabase} from 'expo-sqlite/next.d.ts';
26
- import type {Store} from '../../store/index.d.ts';
27
-
28
- /**
29
- * The ExpoSqliteNextPersister interface is a minor extension to the Persister
30
- * interface.
31
- *
32
- * It simply provides an extra getDb method for accessing a reference to the
33
- * database instance the Store is being persisted to.
34
- *
35
- * You should use the createExpoSqliteNextPersister function to create an
36
- * ExpoSqliteNextPersister object.
37
- * @category Persister
38
- * @since v4.5.0
39
- */
40
- export interface ExpoSqliteNextPersister extends Persister<3> {
41
- /**
42
- * The getDb method returns a reference to the database instance the Store is
43
- * being persisted to.
44
- * @returns A reference to the database instance.
45
- * @example
46
- * This example creates a Persister object against a newly-created Store and
47
- * then gets the database instance back out again.
48
- *
49
- * ```js yolo
50
- * import {createExpoSqliteNextPersister} from 'tinybase/persisters/persister-expo-sqlite-next';
51
- * import {createStore} from 'tinybase';
52
- * import {openDatabaseSync} from 'expo-sqlite';
53
- *
54
- * const db = openDatabaseSync('my.db');
55
- * const store = createStore().setTables({pets: {fido: {species: 'dog'}}});
56
- * const persister = createExpoSqliteNextPersister(store, db, 'my_tinybase');
57
- *
58
- * console.log(persister.getDb() == db);
59
- * // -> true
60
- *
61
- * persister.destroy();
62
- * ```
63
- * @category Getter
64
- * @since v4.5.0
65
- */
66
- getDb(): SQLiteDatabase;
67
- }
68
-
69
- /**
70
- * The createExpoSqliteNextPersister function creates a Persister object that
71
- * can persist the Store to a local Expo-SQLite database (in an appropriate
72
- * React Native environment).
73
- *
74
- * Note that this Persister is currently experimental as Expo themselves iterate
75
- * on the underlying database library API.
76
- *
77
- * As well as providing a reference to the Store to persist, you must provide a
78
- * `db` parameter which identifies the database instance.
79
- *
80
- * A database Persister uses one of two modes: either a JSON serialization of
81
- * the whole Store stored in a single row of a table (the default), or a tabular
82
- * mapping of Table Ids to database table names and vice-versa).
83
- *
84
- * The third argument is a DatabasePersisterConfig object that configures which
85
- * of those modes to use, and settings for each. If the third argument is simply
86
- * a string, it is used as the `storeTableName` property of the JSON
87
- * serialization.
88
- *
89
- * See the documentation for the DpcJson and DpcTabular types for more
90
- * information on how both of those modes can be configured.
91
- * @param store The Store to persist.
92
- * @param db The database instance that was returned from
93
- * `SQLite.openDatabase(...)`.
94
- * @param configOrStoreTableName A DatabasePersisterConfig to configure the
95
- * persistence mode (or a string to set the `storeTableName` property of the
96
- * JSON serialization).
97
- * @param onSqlCommand An optional handler called every time the Persister
98
- * executes a SQL command or query. This is suitable for logging persistence
99
- * behavior in a development environment.
100
- * @param onIgnoredError An optional handler for the errors that the Persister
101
- * would otherwise ignore when trying to save or load data. This is suitable for
102
- * debugging persistence issues in a development environment.
103
- * @returns A reference to the new ExpoSqliteNextPersister object.
104
- * @example
105
- * This example creates a ExpoSqliteNextPersister object and persists the Store
106
- * to a local SQLite database as a JSON serialization into the `my_tinybase`
107
- * table. It makes a change to the database directly and then reloads it back
108
- * into the Store.
109
- *
110
- * ```js yolo
111
- * import {createExpoSqliteNextPersister} from 'tinybase/persisters/persister-expo-sqlite-next';
112
- * import {createStore} from 'tinybase';
113
- * import {openDatabaseSync} from 'expo-sqlite';
114
- *
115
- * const db = openDatabaseSync('my.db');
116
- * const store = createStore().setTables({pets: {fido: {species: 'dog'}}});
117
- * const persister = createExpoSqliteNextPersister(store, db, 'my_tinybase');
118
- *
119
- * await persister.save();
120
- * // Store will be saved to the database.
121
- *
122
- * console.log(
123
- * await new Promise((resolve) =>
124
- * db.allAsync('SELECT * FROM my_tinybase;').then(resolve),
125
- * ),
126
- * );
127
- * // -> [{_id: '_', store: '[{"pets":{"fido":{"species":"dog"}}},{}]'}]
128
- *
129
- * await new Promise((resolve) =>
130
- * db
131
- * .allAsync(
132
- * 'UPDATE my_tinybase SET store = ' +
133
- * `'[{"pets":{"felix":{"species":"cat"}}},{}]' WHERE _id = '_';`,
134
- * )
135
- * .then(resolve),
136
- * );
137
- * await persister.load();
138
- * console.log(store.getTables());
139
- * // -> {pets: {felix: {species: 'cat'}}}
140
- *
141
- * persister.destroy();
142
- * ```
143
- * @example
144
- * This example creates a ExpoSqliteNextPersister object and persists the Store
145
- * to a local SQLite database with tabular mapping.
146
- *
147
- * ```js yolo
148
- * import {createExpoSqliteNextPersister} from 'tinybase/persisters/persister-expo-sqlite-next';
149
- * import {createStore} from 'tinybase';
150
- * import {openDatabaseSync} from 'expo-sqlite';
151
- *
152
- * const db = openDatabaseSync('my.db');
153
- * const store = createStore().setTables({pets: {fido: {species: 'dog'}}});
154
- * const persister = createExpoSqliteNextPersister(store, db, {
155
- * mode: 'tabular',
156
- * tables: {load: {pets: 'pets'}, save: {pets: 'pets'}},
157
- * });
158
- *
159
- * await persister.save();
160
- * console.log(
161
- * await new Promise((resolve) =>
162
- * db.allAsync('SELECT * FROM pets;').then(resolve),
163
- * ),
164
- * );
165
- * // -> [{_id: 'fido', species: 'dog'}]
166
- *
167
- * await new Promise((resolve) =>
168
- * db
169
- * .allAsync(`INSERT INTO pets (_id, species) VALUES ('felix', 'cat')`)
170
- * .then(resolve),
171
- * );
172
- * await persister.load();
173
- * console.log(store.getTables());
174
- * // -> {pets: {fido: {species: 'dog'}, felix: {species: 'cat'}}}
175
- *
176
- * persister.destroy();
177
- * ```
178
- * @category Creation
179
- * @since v4.5.0
180
- */
181
- export function createExpoSqliteNextPersister(
182
- store: Store | MergeableStore,
183
- db: SQLiteDatabase,
184
- configOrStoreTableName?: DatabasePersisterConfig | string,
185
- onSqlCommand?: (sql: string, args?: any[]) => void,
186
- onIgnoredError?: (error: any) => void,
187
- ): ExpoSqliteNextPersister;
@@ -1,206 +0,0 @@
1
- /**
2
- * The persister-expo-sqlite-next module of the TinyBase project lets you save
3
- * and load Store data to and from a local Expo-SQLite 'next' database (in an
4
- * appropriate React Native environment).
5
- *
6
- * This module provides a Persister for the modern version of Expo's
7
- * [SQLite](https://docs.expo.dev/versions/latest/sdk/sqlite)
8
- * library, designated 'next' as of November 2023. This API should be used if
9
- * you are installing the `expo-sqlite/next` module. In the future we expect
10
- * this module to become the default.
11
- *
12
- * Note that TinyBase support for the legacy version of Expo-SQLite
13
- * (`expo-sqlite`) is still available in the persister-expo-sqlite module.
14
- *
15
- * Note that this Persister is currently experimental as Expo themselves iterate
16
- * on the underlying database library API.
17
- * @see Persisting Data guide
18
- * @packageDocumentation
19
- * @module persister-expo-sqlite-next
20
- * @since v4.5.0
21
- */
22
-
23
- import type {
24
- DatabasePersisterConfig,
25
- Persister,
26
- } from '../../with-schemas/index.d.cts';
27
- import type {
28
- OptionalSchemas,
29
- Store,
30
- } from '../../../store/with-schemas/index.d.cts';
31
- import type {MergeableStore} from '../../../mergeable-store/with-schemas/index.d.cts';
32
- import type {SQLiteDatabase} from 'expo-sqlite/next.d.cts';
33
-
34
- /**
35
- * The ExpoSqliteNextPersister interface is a minor extension to the Persister
36
- * interface.
37
- *
38
- * It simply provides an extra getDb method for accessing a reference to the
39
- * database instance the Store is being persisted to.
40
- *
41
- * You should use the createExpoSqliteNextPersister function to create an
42
- * ExpoSqliteNextPersister object.
43
- * @category Persister
44
- * @since v4.5.0
45
- */
46
- export interface ExpoSqliteNextPersister<Schemas extends OptionalSchemas>
47
- extends Persister<Schemas, 3> {
48
- /**
49
- * The getDb method returns a reference to the database instance the Store is
50
- * being persisted to.
51
- * @returns A reference to the database instance.
52
- * @example
53
- * This example creates a Persister object against a newly-created Store and
54
- * then gets the database instance back out again.
55
- *
56
- * ```js yolo
57
- * import {createExpoSqliteNextPersister} from 'tinybase/persisters/persister-expo-sqlite-next';
58
- * import {createStore} from 'tinybase';
59
- * import {openDatabaseSync} from 'expo-sqlite';
60
- *
61
- * const db = openDatabaseSync('my.db');
62
- * const store = createStore().setTables({pets: {fido: {species: 'dog'}}});
63
- * const persister = createExpoSqliteNextPersister(store, db, 'my_tinybase');
64
- *
65
- * console.log(persister.getDb() == db);
66
- * // -> true
67
- *
68
- * persister.destroy();
69
- * ```
70
- * @category Getter
71
- * @since v4.5.0
72
- */
73
- getDb(): SQLiteDatabase;
74
- }
75
-
76
- /**
77
- * The createExpoSqliteNextPersister function creates a Persister object that
78
- * can persist the Store to a local Expo-SQLite database (in an appropriate
79
- * React Native environment).
80
- *
81
- * This has schema-based typing. The following is a simplified representation:
82
- *
83
- * ```ts override
84
- * createExpoSqliteNextPersister(
85
- * store: Store | MergeableStore,
86
- * db: SQLiteDatabase,
87
- * configOrStoreTableName?: DatabasePersisterConfig | string,
88
- * onSqlCommand?: (sql: string, args?: any[]) => void,
89
- * onIgnoredError?: (error: any) => void,
90
- * ): ExpoSqliteNextPersister;
91
- * ```
92
- *
93
- * Note that this Persister is currently experimental as Expo themselves iterate
94
- * on the underlying database library API.
95
- *
96
- * As well as providing a reference to the Store to persist, you must provide a
97
- * `db` parameter which identifies the database instance.
98
- *
99
- * A database Persister uses one of two modes: either a JSON serialization of
100
- * the whole Store stored in a single row of a table (the default), or a tabular
101
- * mapping of Table Ids to database table names and vice-versa).
102
- *
103
- * The third argument is a DatabasePersisterConfig object that configures which
104
- * of those modes to use, and settings for each. If the third argument is simply
105
- * a string, it is used as the `storeTableName` property of the JSON
106
- * serialization.
107
- *
108
- * See the documentation for the DpcJson and DpcTabular types for more
109
- * information on how both of those modes can be configured.
110
- * @param store The Store to persist.
111
- * @param db The database instance that was returned from
112
- * `SQLite.openDatabase(...)`.
113
- * @param configOrStoreTableName A DatabasePersisterConfig to configure the
114
- * persistence mode (or a string to set the `storeTableName` property of the
115
- * JSON serialization).
116
- * @param onSqlCommand An optional handler called every time the Persister
117
- * executes a SQL command or query. This is suitable for logging persistence
118
- * behavior in a development environment.
119
- * @param onIgnoredError An optional handler for the errors that the Persister
120
- * would otherwise ignore when trying to save or load data. This is suitable for
121
- * debugging persistence issues in a development environment.
122
- * @returns A reference to the new ExpoSqliteNextPersister object.
123
- * @example
124
- * This example creates a ExpoSqliteNextPersister object and persists the Store
125
- * to a local SQLite database as a JSON serialization into the `my_tinybase`
126
- * table. It makes a change to the database directly and then reloads it back
127
- * into the Store.
128
- *
129
- * ```js yolo
130
- * import {createExpoSqliteNextPersister} from 'tinybase/persisters/persister-expo-sqlite-next';
131
- * import {createStore} from 'tinybase';
132
- * import {openDatabaseSync} from 'expo-sqlite';
133
- *
134
- * const db = openDatabaseSync('my.db');
135
- * const store = createStore().setTables({pets: {fido: {species: 'dog'}}});
136
- * const persister = createExpoSqliteNextPersister(store, db, 'my_tinybase');
137
- *
138
- * await persister.save();
139
- * // Store will be saved to the database.
140
- *
141
- * console.log(
142
- * await new Promise((resolve) =>
143
- * db.allAsync('SELECT * FROM my_tinybase;').then(resolve),
144
- * ),
145
- * );
146
- * // -> [{_id: '_', store: '[{"pets":{"fido":{"species":"dog"}}},{}]'}]
147
- *
148
- * await new Promise((resolve) =>
149
- * db
150
- * .allAsync(
151
- * 'UPDATE my_tinybase SET store = ' +
152
- * `'[{"pets":{"felix":{"species":"cat"}}},{}]' WHERE _id = '_';`,
153
- * )
154
- * .then(resolve),
155
- * );
156
- * await persister.load();
157
- * console.log(store.getTables());
158
- * // -> {pets: {felix: {species: 'cat'}}}
159
- *
160
- * persister.destroy();
161
- * ```
162
- * @example
163
- * This example creates a ExpoSqliteNextPersister object and persists the Store
164
- * to a local SQLite database with tabular mapping.
165
- *
166
- * ```js yolo
167
- * import {createExpoSqliteNextPersister} from 'tinybase/persisters/persister-expo-sqlite-next';
168
- * import {createStore} from 'tinybase';
169
- * import {openDatabaseSync} from 'expo-sqlite';
170
- *
171
- * const db = openDatabaseSync('my.db');
172
- * const store = createStore().setTables({pets: {fido: {species: 'dog'}}});
173
- * const persister = createExpoSqliteNextPersister(store, db, {
174
- * mode: 'tabular',
175
- * tables: {load: {pets: 'pets'}, save: {pets: 'pets'}},
176
- * });
177
- *
178
- * await persister.save();
179
- * console.log(
180
- * await new Promise((resolve) =>
181
- * db.allAsync('SELECT * FROM pets;').then(resolve),
182
- * ),
183
- * );
184
- * // -> [{_id: 'fido', species: 'dog'}]
185
- *
186
- * await new Promise((resolve) =>
187
- * db
188
- * .allAsync(`INSERT INTO pets (_id, species) VALUES ('felix', 'cat')`)
189
- * .then(resolve),
190
- * );
191
- * await persister.load();
192
- * console.log(store.getTables());
193
- * // -> {pets: {fido: {species: 'dog'}, felix: {species: 'cat'}}}
194
- *
195
- * persister.destroy();
196
- * ```
197
- * @category Creation
198
- * @since v4.5.0
199
- */
200
- export function createExpoSqliteNextPersister<Schemas extends OptionalSchemas>(
201
- store: Store<Schemas> | MergeableStore<Schemas>,
202
- db: SQLiteDatabase,
203
- configOrStoreTableName?: DatabasePersisterConfig<Schemas> | string,
204
- onSqlCommand?: (sql: string, args?: any[]) => void,
205
- onIgnoredError?: (error: any) => void,
206
- ): ExpoSqliteNextPersister<Schemas>;