tinybase 7.0.0-beta.2 → 7.0.0

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 (292) hide show
  1. package/@types/common/index.d.ts +1 -1
  2. package/@types/mergeable-store/index.d.ts +1 -1
  3. package/@types/mergeable-store/with-schemas/index.d.ts +1 -1
  4. package/@types/persisters/persister-cr-sqlite-wasm/index.d.ts +4 -0
  5. package/@types/persisters/persister-cr-sqlite-wasm/with-schemas/index.d.ts +4 -0
  6. package/@types/persisters/persister-durable-object-sql-storage/index.d.ts +4 -0
  7. package/@types/persisters/persister-durable-object-sql-storage/with-schemas/index.d.ts +4 -0
  8. package/@types/persisters/persister-electric-sql/index.d.ts +4 -0
  9. package/@types/persisters/persister-electric-sql/with-schemas/index.d.ts +4 -0
  10. package/@types/persisters/persister-expo-sqlite/index.d.ts +4 -0
  11. package/@types/persisters/persister-expo-sqlite/with-schemas/index.d.ts +4 -0
  12. package/@types/persisters/persister-libsql/index.d.ts +4 -0
  13. package/@types/persisters/persister-libsql/with-schemas/index.d.ts +4 -0
  14. package/@types/persisters/persister-pglite/index.d.ts +5 -1
  15. package/@types/persisters/persister-pglite/with-schemas/index.d.ts +5 -1
  16. package/@types/persisters/persister-postgres/index.d.ts +4 -0
  17. package/@types/persisters/persister-postgres/with-schemas/index.d.ts +4 -0
  18. package/@types/persisters/persister-powersync/index.d.ts +4 -0
  19. package/@types/persisters/persister-powersync/with-schemas/index.d.ts +4 -0
  20. package/@types/persisters/persister-react-native-sqlite/index.d.ts +4 -0
  21. package/@types/persisters/persister-react-native-sqlite/with-schemas/index.d.ts +4 -0
  22. package/@types/persisters/persister-sqlite-bun/index.d.ts +4 -0
  23. package/@types/persisters/persister-sqlite-bun/with-schemas/index.d.ts +4 -0
  24. package/@types/persisters/persister-sqlite-wasm/index.d.ts +4 -0
  25. package/@types/persisters/persister-sqlite-wasm/with-schemas/index.d.ts +4 -0
  26. package/@types/persisters/persister-sqlite3/index.d.ts +4 -0
  27. package/@types/persisters/persister-sqlite3/with-schemas/index.d.ts +4 -0
  28. package/@types/queries/index.d.ts +1 -1
  29. package/@types/store/index.d.ts +21 -19
  30. package/@types/store/with-schemas/index.d.ts +15 -13
  31. package/agents.md +62 -0
  32. package/checkpoints/index.js +8 -6
  33. package/checkpoints/with-schemas/index.js +8 -6
  34. package/common/index.js +4 -3
  35. package/common/with-schemas/index.js +4 -3
  36. package/index.js +60 -30
  37. package/indexes/index.js +7 -5
  38. package/indexes/with-schemas/index.js +7 -5
  39. package/mergeable-store/index.js +51 -21
  40. package/mergeable-store/with-schemas/index.js +51 -21
  41. package/metrics/index.js +7 -5
  42. package/metrics/with-schemas/index.js +7 -5
  43. package/min/checkpoints/index.js +1 -1
  44. package/min/checkpoints/index.js.gz +0 -0
  45. package/min/checkpoints/with-schemas/index.js +1 -1
  46. package/min/checkpoints/with-schemas/index.js.gz +0 -0
  47. package/min/common/index.js +1 -1
  48. package/min/common/index.js.gz +0 -0
  49. package/min/common/with-schemas/index.js +1 -1
  50. package/min/common/with-schemas/index.js.gz +0 -0
  51. package/min/index.js +1 -1
  52. package/min/index.js.gz +0 -0
  53. package/min/indexes/index.js +1 -1
  54. package/min/indexes/index.js.gz +0 -0
  55. package/min/indexes/with-schemas/index.js +1 -1
  56. package/min/indexes/with-schemas/index.js.gz +0 -0
  57. package/min/mergeable-store/index.js +1 -1
  58. package/min/mergeable-store/index.js.gz +0 -0
  59. package/min/mergeable-store/with-schemas/index.js +1 -1
  60. package/min/mergeable-store/with-schemas/index.js.gz +0 -0
  61. package/min/metrics/index.js +1 -1
  62. package/min/metrics/index.js.gz +0 -0
  63. package/min/metrics/with-schemas/index.js +1 -1
  64. package/min/metrics/with-schemas/index.js.gz +0 -0
  65. package/min/omni/index.js +1 -1
  66. package/min/omni/index.js.gz +0 -0
  67. package/min/omni/with-schemas/index.js +1 -1
  68. package/min/omni/with-schemas/index.js.gz +0 -0
  69. package/min/persisters/index.js +1 -1
  70. package/min/persisters/index.js.gz +0 -0
  71. package/min/persisters/persister-automerge/index.js +1 -1
  72. package/min/persisters/persister-automerge/index.js.gz +0 -0
  73. package/min/persisters/persister-automerge/with-schemas/index.js +1 -1
  74. package/min/persisters/persister-automerge/with-schemas/index.js.gz +0 -0
  75. package/min/persisters/persister-browser/index.js +1 -1
  76. package/min/persisters/persister-browser/index.js.gz +0 -0
  77. package/min/persisters/persister-browser/with-schemas/index.js +1 -1
  78. package/min/persisters/persister-browser/with-schemas/index.js.gz +0 -0
  79. package/min/persisters/persister-cr-sqlite-wasm/index.js +1 -1
  80. package/min/persisters/persister-cr-sqlite-wasm/index.js.gz +0 -0
  81. package/min/persisters/persister-cr-sqlite-wasm/with-schemas/index.js +1 -1
  82. package/min/persisters/persister-cr-sqlite-wasm/with-schemas/index.js.gz +0 -0
  83. package/min/persisters/persister-durable-object-sql-storage/index.js +1 -1
  84. package/min/persisters/persister-durable-object-sql-storage/index.js.gz +0 -0
  85. package/min/persisters/persister-durable-object-sql-storage/with-schemas/index.js +1 -1
  86. package/min/persisters/persister-durable-object-sql-storage/with-schemas/index.js.gz +0 -0
  87. package/min/persisters/persister-durable-object-storage/index.js +1 -1
  88. package/min/persisters/persister-durable-object-storage/index.js.gz +0 -0
  89. package/min/persisters/persister-durable-object-storage/with-schemas/index.js +1 -1
  90. package/min/persisters/persister-durable-object-storage/with-schemas/index.js.gz +0 -0
  91. package/min/persisters/persister-electric-sql/index.js +1 -1
  92. package/min/persisters/persister-electric-sql/index.js.gz +0 -0
  93. package/min/persisters/persister-electric-sql/with-schemas/index.js +1 -1
  94. package/min/persisters/persister-electric-sql/with-schemas/index.js.gz +0 -0
  95. package/min/persisters/persister-expo-sqlite/index.js +1 -1
  96. package/min/persisters/persister-expo-sqlite/index.js.gz +0 -0
  97. package/min/persisters/persister-expo-sqlite/with-schemas/index.js +1 -1
  98. package/min/persisters/persister-expo-sqlite/with-schemas/index.js.gz +0 -0
  99. package/min/persisters/persister-file/index.js +1 -1
  100. package/min/persisters/persister-file/index.js.gz +0 -0
  101. package/min/persisters/persister-file/with-schemas/index.js +1 -1
  102. package/min/persisters/persister-file/with-schemas/index.js.gz +0 -0
  103. package/min/persisters/persister-indexed-db/index.js +1 -1
  104. package/min/persisters/persister-indexed-db/index.js.gz +0 -0
  105. package/min/persisters/persister-indexed-db/with-schemas/index.js +1 -1
  106. package/min/persisters/persister-indexed-db/with-schemas/index.js.gz +0 -0
  107. package/min/persisters/persister-libsql/index.js +1 -1
  108. package/min/persisters/persister-libsql/index.js.gz +0 -0
  109. package/min/persisters/persister-libsql/with-schemas/index.js +1 -1
  110. package/min/persisters/persister-libsql/with-schemas/index.js.gz +0 -0
  111. package/min/persisters/persister-partykit-client/index.js +1 -1
  112. package/min/persisters/persister-partykit-client/index.js.gz +0 -0
  113. package/min/persisters/persister-partykit-client/with-schemas/index.js +1 -1
  114. package/min/persisters/persister-partykit-client/with-schemas/index.js.gz +0 -0
  115. package/min/persisters/persister-partykit-server/index.js +1 -1
  116. package/min/persisters/persister-partykit-server/index.js.gz +0 -0
  117. package/min/persisters/persister-partykit-server/with-schemas/index.js +1 -1
  118. package/min/persisters/persister-partykit-server/with-schemas/index.js.gz +0 -0
  119. package/min/persisters/persister-pglite/index.js +1 -1
  120. package/min/persisters/persister-pglite/index.js.gz +0 -0
  121. package/min/persisters/persister-pglite/with-schemas/index.js +1 -1
  122. package/min/persisters/persister-pglite/with-schemas/index.js.gz +0 -0
  123. package/min/persisters/persister-postgres/index.js +1 -1
  124. package/min/persisters/persister-postgres/index.js.gz +0 -0
  125. package/min/persisters/persister-postgres/with-schemas/index.js +1 -1
  126. package/min/persisters/persister-postgres/with-schemas/index.js.gz +0 -0
  127. package/min/persisters/persister-powersync/index.js +1 -1
  128. package/min/persisters/persister-powersync/index.js.gz +0 -0
  129. package/min/persisters/persister-powersync/with-schemas/index.js +1 -1
  130. package/min/persisters/persister-powersync/with-schemas/index.js.gz +0 -0
  131. package/min/persisters/persister-react-native-mmkv/index.js +1 -1
  132. package/min/persisters/persister-react-native-mmkv/index.js.gz +0 -0
  133. package/min/persisters/persister-react-native-mmkv/with-schemas/index.js +1 -1
  134. package/min/persisters/persister-react-native-mmkv/with-schemas/index.js.gz +0 -0
  135. package/min/persisters/persister-react-native-sqlite/index.js +1 -1
  136. package/min/persisters/persister-react-native-sqlite/index.js.gz +0 -0
  137. package/min/persisters/persister-react-native-sqlite/with-schemas/index.js +1 -1
  138. package/min/persisters/persister-react-native-sqlite/with-schemas/index.js.gz +0 -0
  139. package/min/persisters/persister-remote/index.js +1 -1
  140. package/min/persisters/persister-remote/index.js.gz +0 -0
  141. package/min/persisters/persister-remote/with-schemas/index.js +1 -1
  142. package/min/persisters/persister-remote/with-schemas/index.js.gz +0 -0
  143. package/min/persisters/persister-sqlite-bun/index.js +1 -1
  144. package/min/persisters/persister-sqlite-bun/index.js.gz +0 -0
  145. package/min/persisters/persister-sqlite-bun/with-schemas/index.js +1 -1
  146. package/min/persisters/persister-sqlite-bun/with-schemas/index.js.gz +0 -0
  147. package/min/persisters/persister-sqlite-wasm/index.js +1 -1
  148. package/min/persisters/persister-sqlite-wasm/index.js.gz +0 -0
  149. package/min/persisters/persister-sqlite-wasm/with-schemas/index.js +1 -1
  150. package/min/persisters/persister-sqlite-wasm/with-schemas/index.js.gz +0 -0
  151. package/min/persisters/persister-sqlite3/index.js +1 -1
  152. package/min/persisters/persister-sqlite3/index.js.gz +0 -0
  153. package/min/persisters/persister-sqlite3/with-schemas/index.js +1 -1
  154. package/min/persisters/persister-sqlite3/with-schemas/index.js.gz +0 -0
  155. package/min/persisters/persister-yjs/index.js +1 -1
  156. package/min/persisters/persister-yjs/index.js.gz +0 -0
  157. package/min/persisters/persister-yjs/with-schemas/index.js +1 -1
  158. package/min/persisters/persister-yjs/with-schemas/index.js.gz +0 -0
  159. package/min/persisters/with-schemas/index.js +1 -1
  160. package/min/persisters/with-schemas/index.js.gz +0 -0
  161. package/min/queries/index.js +1 -1
  162. package/min/queries/index.js.gz +0 -0
  163. package/min/queries/with-schemas/index.js +1 -1
  164. package/min/queries/with-schemas/index.js.gz +0 -0
  165. package/min/relationships/index.js +1 -1
  166. package/min/relationships/index.js.gz +0 -0
  167. package/min/relationships/with-schemas/index.js +1 -1
  168. package/min/relationships/with-schemas/index.js.gz +0 -0
  169. package/min/store/index.js +1 -1
  170. package/min/store/index.js.gz +0 -0
  171. package/min/store/with-schemas/index.js +1 -1
  172. package/min/store/with-schemas/index.js.gz +0 -0
  173. package/min/synchronizers/index.js +1 -1
  174. package/min/synchronizers/index.js.gz +0 -0
  175. package/min/synchronizers/synchronizer-broadcast-channel/index.js +1 -1
  176. package/min/synchronizers/synchronizer-broadcast-channel/index.js.gz +0 -0
  177. package/min/synchronizers/synchronizer-broadcast-channel/with-schemas/index.js +1 -1
  178. package/min/synchronizers/synchronizer-broadcast-channel/with-schemas/index.js.gz +0 -0
  179. package/min/synchronizers/synchronizer-local/index.js +1 -1
  180. package/min/synchronizers/synchronizer-local/index.js.gz +0 -0
  181. package/min/synchronizers/synchronizer-local/with-schemas/index.js +1 -1
  182. package/min/synchronizers/synchronizer-local/with-schemas/index.js.gz +0 -0
  183. package/min/synchronizers/synchronizer-ws-client/index.js +1 -1
  184. package/min/synchronizers/synchronizer-ws-client/index.js.gz +0 -0
  185. package/min/synchronizers/synchronizer-ws-client/with-schemas/index.js +1 -1
  186. package/min/synchronizers/synchronizer-ws-client/with-schemas/index.js.gz +0 -0
  187. package/min/synchronizers/synchronizer-ws-server/index.js +1 -1
  188. package/min/synchronizers/synchronizer-ws-server/index.js.gz +0 -0
  189. package/min/synchronizers/synchronizer-ws-server/with-schemas/index.js +1 -1
  190. package/min/synchronizers/synchronizer-ws-server/with-schemas/index.js.gz +0 -0
  191. package/min/synchronizers/synchronizer-ws-server-durable-object/index.js +1 -1
  192. package/min/synchronizers/synchronizer-ws-server-durable-object/index.js.gz +0 -0
  193. package/min/synchronizers/synchronizer-ws-server-durable-object/with-schemas/index.js +1 -1
  194. package/min/synchronizers/synchronizer-ws-server-durable-object/with-schemas/index.js.gz +0 -0
  195. package/min/synchronizers/synchronizer-ws-server-simple/index.js +1 -1
  196. package/min/synchronizers/synchronizer-ws-server-simple/index.js.gz +0 -0
  197. package/min/synchronizers/synchronizer-ws-server-simple/with-schemas/index.js +1 -1
  198. package/min/synchronizers/synchronizer-ws-server-simple/with-schemas/index.js.gz +0 -0
  199. package/min/synchronizers/with-schemas/index.js +1 -1
  200. package/min/synchronizers/with-schemas/index.js.gz +0 -0
  201. package/min/ui-react/index.js +1 -1
  202. package/min/ui-react/index.js.gz +0 -0
  203. package/min/ui-react/with-schemas/index.js +1 -1
  204. package/min/ui-react/with-schemas/index.js.gz +0 -0
  205. package/min/ui-react-dom/index.js +1 -1
  206. package/min/ui-react-dom/index.js.gz +0 -0
  207. package/min/ui-react-dom/with-schemas/index.js +1 -1
  208. package/min/ui-react-dom/with-schemas/index.js.gz +0 -0
  209. package/min/ui-react-inspector/index.js +1 -1
  210. package/min/ui-react-inspector/index.js.gz +0 -0
  211. package/min/ui-react-inspector/with-schemas/index.js +1 -1
  212. package/min/ui-react-inspector/with-schemas/index.js.gz +0 -0
  213. package/min/with-schemas/index.js +1 -1
  214. package/min/with-schemas/index.js.gz +0 -0
  215. package/omni/index.js +78 -46
  216. package/omni/with-schemas/index.js +78 -46
  217. package/package.json +3 -3
  218. package/persisters/index.js +14 -10
  219. package/persisters/persister-automerge/index.js +12 -8
  220. package/persisters/persister-automerge/with-schemas/index.js +12 -8
  221. package/persisters/persister-browser/index.js +12 -8
  222. package/persisters/persister-browser/with-schemas/index.js +12 -8
  223. package/persisters/persister-cr-sqlite-wasm/index.js +14 -10
  224. package/persisters/persister-cr-sqlite-wasm/with-schemas/index.js +14 -10
  225. package/persisters/persister-durable-object-sql-storage/index.js +14 -10
  226. package/persisters/persister-durable-object-sql-storage/with-schemas/index.js +14 -10
  227. package/persisters/persister-durable-object-storage/index.js +12 -8
  228. package/persisters/persister-durable-object-storage/with-schemas/index.js +12 -8
  229. package/persisters/persister-electric-sql/index.js +14 -10
  230. package/persisters/persister-electric-sql/with-schemas/index.js +14 -10
  231. package/persisters/persister-expo-sqlite/index.js +14 -10
  232. package/persisters/persister-expo-sqlite/with-schemas/index.js +14 -10
  233. package/persisters/persister-file/index.js +12 -8
  234. package/persisters/persister-file/with-schemas/index.js +12 -8
  235. package/persisters/persister-indexed-db/index.js +12 -8
  236. package/persisters/persister-indexed-db/with-schemas/index.js +12 -8
  237. package/persisters/persister-libsql/index.js +14 -10
  238. package/persisters/persister-libsql/with-schemas/index.js +14 -10
  239. package/persisters/persister-partykit-client/index.js +12 -8
  240. package/persisters/persister-partykit-client/with-schemas/index.js +12 -8
  241. package/persisters/persister-partykit-server/index.js +4 -3
  242. package/persisters/persister-partykit-server/with-schemas/index.js +4 -3
  243. package/persisters/persister-pglite/index.js +13 -9
  244. package/persisters/persister-pglite/with-schemas/index.js +13 -9
  245. package/persisters/persister-postgres/index.js +13 -9
  246. package/persisters/persister-postgres/with-schemas/index.js +13 -9
  247. package/persisters/persister-powersync/index.js +14 -10
  248. package/persisters/persister-powersync/with-schemas/index.js +14 -10
  249. package/persisters/persister-react-native-mmkv/index.js +12 -8
  250. package/persisters/persister-react-native-mmkv/with-schemas/index.js +12 -8
  251. package/persisters/persister-react-native-sqlite/index.js +14 -10
  252. package/persisters/persister-react-native-sqlite/with-schemas/index.js +14 -10
  253. package/persisters/persister-remote/index.js +14 -10
  254. package/persisters/persister-remote/with-schemas/index.js +14 -10
  255. package/persisters/persister-sqlite-bun/index.js +14 -10
  256. package/persisters/persister-sqlite-bun/with-schemas/index.js +14 -10
  257. package/persisters/persister-sqlite-wasm/index.js +14 -10
  258. package/persisters/persister-sqlite-wasm/with-schemas/index.js +14 -10
  259. package/persisters/persister-sqlite3/index.js +14 -10
  260. package/persisters/persister-sqlite3/with-schemas/index.js +14 -10
  261. package/persisters/persister-yjs/index.js +18 -12
  262. package/persisters/persister-yjs/with-schemas/index.js +18 -12
  263. package/persisters/with-schemas/index.js +14 -10
  264. package/queries/index.js +17 -12
  265. package/queries/with-schemas/index.js +17 -12
  266. package/readme.md +2 -2
  267. package/relationships/index.js +7 -5
  268. package/relationships/with-schemas/index.js +7 -5
  269. package/releases.md +100 -12
  270. package/store/index.js +48 -18
  271. package/store/with-schemas/index.js +48 -18
  272. package/synchronizers/index.js +13 -9
  273. package/synchronizers/synchronizer-broadcast-channel/index.js +14 -10
  274. package/synchronizers/synchronizer-broadcast-channel/with-schemas/index.js +14 -10
  275. package/synchronizers/synchronizer-local/index.js +14 -10
  276. package/synchronizers/synchronizer-local/with-schemas/index.js +14 -10
  277. package/synchronizers/synchronizer-ws-client/index.js +13 -9
  278. package/synchronizers/synchronizer-ws-client/with-schemas/index.js +13 -9
  279. package/synchronizers/synchronizer-ws-server/index.js +13 -9
  280. package/synchronizers/synchronizer-ws-server/with-schemas/index.js +13 -9
  281. package/synchronizers/synchronizer-ws-server-durable-object/index.js +13 -9
  282. package/synchronizers/synchronizer-ws-server-durable-object/with-schemas/index.js +13 -9
  283. package/synchronizers/synchronizer-ws-server-simple/index.js +5 -4
  284. package/synchronizers/synchronizer-ws-server-simple/with-schemas/index.js +5 -4
  285. package/synchronizers/with-schemas/index.js +13 -9
  286. package/ui-react/index.js +9 -6
  287. package/ui-react/with-schemas/index.js +9 -6
  288. package/ui-react-dom/index.js +14 -7
  289. package/ui-react-dom/with-schemas/index.js +14 -7
  290. package/ui-react-inspector/index.js +53 -23
  291. package/ui-react-inspector/with-schemas/index.js +53 -23
  292. package/with-schemas/index.js +60 -30
@@ -65,7 +65,7 @@ export type Callback = () => void;
65
65
  * @category Parameter
66
66
  * @since v1.0.0
67
67
  */
68
- export type SortKey = string | number | boolean;
68
+ export type SortKey = string | number | boolean | null;
69
69
 
70
70
  /**
71
71
  * The GetNow type is used to represent a function that returns the current time
@@ -887,7 +887,7 @@ export interface MergeableStore extends Store {
887
887
  *
888
888
  * store.applyMergeableChanges([
889
889
  * [{pets: [{fido: [{color: ['black', 'Nn1JUF----2FnHIC']}]}]}],
890
- * [{open: [null, 'Nn1JUF----3FnHIC']}],
890
+ * [{open: [undefined, 'Nn1JUF----3FnHIC']}],
891
891
  * 1,
892
892
  * ]);
893
893
  * console.log(store.getTables());
@@ -1149,7 +1149,7 @@ export interface MergeableStore<
1149
1149
  *
1150
1150
  * store.applyMergeableChanges([
1151
1151
  * [{pets: [{fido: [{color: ['black', 'Nn1JUF----2FnHIC']}]}]}],
1152
- * [{open: [null, 'Nn1JUF----3FnHIC']}],
1152
+ * [{open: [undefined, 'Nn1JUF----3FnHIC']}],
1153
1153
  * 1,
1154
1154
  * ]);
1155
1155
  * console.log(store.getTables());
@@ -75,6 +75,10 @@ export interface CrSqliteWasmPersister extends Persister {
75
75
  *
76
76
  * See the documentation for the DpcJson and DpcTabular types for more
77
77
  * information on how both of those modes can be configured.
78
+ *
79
+ * Note: When using tabular mode, SQL NULL values are loaded as TinyBase null
80
+ * values, making tables dense (every Row has every Cell). See the Database
81
+ * Persistence guide for details.
78
82
  * @param store The Store to persist.
79
83
  * @param db The database instance that was returned from `crSqlite3.open(...)`.
80
84
  * @param configOrStoreTableName A DatabasePersisterConfig to configure the
@@ -95,6 +95,10 @@ export interface CrSqliteWasmPersister<
95
95
  *
96
96
  * See the documentation for the DpcJson and DpcTabular types for more
97
97
  * information on how both of those modes can be configured.
98
+ *
99
+ * Note: When using tabular mode, SQL NULL values are loaded as TinyBase null
100
+ * values, making tables dense (every Row has every Cell). See the Database
101
+ * Persistence guide for details.
98
102
  * @param store The Store to persist.
99
103
  * @param db The database instance that was returned from `crSqlite3.open(...)`.
100
104
  * @param configOrStoreTableName A DatabasePersisterConfig to configure the
@@ -233,6 +233,10 @@ export interface DurableObjectSqlStoragePersister extends Persister<Persists.Mer
233
233
  * See the documentation for the DpcJson, DpcFragmented, and DpcTabular types
234
234
  * for more information on how all of those modes can be configured.
235
235
  *
236
+ * Note: When using tabular mode, SQL NULL values are loaded as TinyBase null
237
+ * values, making tables dense (every Row has every Cell). See the Database
238
+ * Persistence guide for details.
239
+ *
236
240
  * As well as providing a reference to the Store or MergeableStore to persist,
237
241
  * you must provide a `sqlStorage` parameter which identifies the Durable Object
238
242
  * SQLite storage to persist it to.
@@ -263,6 +263,10 @@ export interface DurableObjectSqlStoragePersister<
263
263
  * See the documentation for the DpcJson, DpcFragmented, and DpcTabular types
264
264
  * for more information on how all of those modes can be configured.
265
265
  *
266
+ * Note: When using tabular mode, SQL NULL values are loaded as TinyBase null
267
+ * values, making tables dense (every Row has every Cell). See the Database
268
+ * Persistence guide for details.
269
+ *
266
270
  * As well as providing a reference to the Store or MergeableStore to persist,
267
271
  * you must provide a `sqlStorage` parameter which identifies the Durable Object
268
272
  * SQLite storage to persist it to.
@@ -83,6 +83,10 @@ export interface ElectricSqlPersister extends Persister {
83
83
  *
84
84
  * See the documentation for the DpcJson and DpcTabular types for more
85
85
  * information on how both of those modes can be configured.
86
+ *
87
+ * Note: When using tabular mode, SQL NULL values are loaded as TinyBase null
88
+ * values, making tables dense (every Row has every Cell). See the Database
89
+ * Persistence guide for details.
86
90
  * @param store The Store to persist.
87
91
  * @param electricClient The Electric client that was returned from `await
88
92
  * electrify(...)`.
@@ -103,6 +103,10 @@ export interface ElectricSqlPersister<
103
103
  *
104
104
  * See the documentation for the DpcJson and DpcTabular types for more
105
105
  * information on how both of those modes can be configured.
106
+ *
107
+ * Note: When using tabular mode, SQL NULL values are loaded as TinyBase null
108
+ * values, making tables dense (every Row has every Cell). See the Database
109
+ * Persistence guide for details.
106
110
  * @param store The Store to persist.
107
111
  * @param electricClient The Electric client that was returned from `await
108
112
  * electrify(...)`.
@@ -86,6 +86,10 @@ export interface ExpoSqlitePersister extends Persister<Persists.StoreOrMergeable
86
86
  *
87
87
  * See the documentation for the DpcJson and DpcTabular types for more
88
88
  * information on how both of those modes can be configured.
89
+ *
90
+ * Note: When using tabular mode, SQL NULL values are loaded as TinyBase null
91
+ * values, making tables dense (every Row has every Cell). See the Database
92
+ * Persistence guide for details.
89
93
  * @param store The Store or MergeableStore to persist.
90
94
  * @param db The database instance that was returned from
91
95
  * `SQLite.openDatabase(...)`.
@@ -107,6 +107,10 @@ export interface ExpoSqlitePersister<
107
107
  *
108
108
  * See the documentation for the DpcJson and DpcTabular types for more
109
109
  * information on how both of those modes can be configured.
110
+ *
111
+ * Note: When using tabular mode, SQL NULL values are loaded as TinyBase null
112
+ * values, making tables dense (every Row has every Cell). See the Database
113
+ * Persistence guide for details.
110
114
  * @param store The Store or MergeableStore to persist.
111
115
  * @param db The database instance that was returned from
112
116
  * `SQLite.openDatabase(...)`.
@@ -74,6 +74,10 @@ export interface LibSqlPersister extends Persister {
74
74
  *
75
75
  * See the documentation for the DpcJson and DpcTabular types for more
76
76
  * information on how both of those modes can be configured.
77
+ *
78
+ * Note: When using tabular mode, SQL NULL values are loaded as TinyBase null
79
+ * values, making tables dense (every Row has every Cell). See the Database
80
+ * Persistence guide for details.
77
81
  * @param store The Store to persist.
78
82
  * @param client The database client that was returned from `createClient(...)`.
79
83
  * @param configOrStoreTableName A DatabasePersisterConfig to configure the
@@ -94,6 +94,10 @@ export interface LibSqlPersister<
94
94
  *
95
95
  * See the documentation for the DpcJson and DpcTabular types for more
96
96
  * information on how both of those modes can be configured.
97
+ *
98
+ * Note: When using tabular mode, SQL NULL values are loaded as TinyBase null
99
+ * values, making tables dense (every Row has every Cell). See the Database
100
+ * Persistence guide for details.
97
101
  * @param store The Store to persist.
98
102
  * @param client The database client that was returned from `createClient(...)`.
99
103
  * @param configOrStoreTableName A DatabasePersisterConfig to configure the
@@ -81,7 +81,11 @@ export interface PglitePersister extends Persister<Persists.StoreOrMergeableStor
81
81
  * See the documentation for the DpcJson and DpcTabular types for more
82
82
  * information on how both of those modes can be configured.
83
83
  *
84
- * This method is asynchronous because it will await the creation of dedicated
84
+ * Note: When using tabular mode, SQL NULL values are loaded as TinyBase null
85
+ * values, making tables dense (every Row has every Cell). See the Database
86
+ * Persistence guide for details.
87
+ *
88
+ * This method is asynchronous because it will await the completion of the
85
89
  * new connections to the database. You will need to `await` a call to this
86
90
  * function or handle the return type natively as a Promise.
87
91
  * @param store The Store or MergeableStore to persist.
@@ -102,7 +102,11 @@ export interface PglitePersister<
102
102
  * See the documentation for the DpcJson and DpcTabular types for more
103
103
  * information on how both of those modes can be configured.
104
104
  *
105
- * This method is asynchronous because it will await the creation of dedicated
105
+ * Note: When using tabular mode, SQL NULL values are loaded as TinyBase null
106
+ * values, making tables dense (every Row has every Cell). See the Database
107
+ * Persistence guide for details.
108
+ *
109
+ * This method is asynchronous because it will await the completion of the
106
110
  * new connections to the database. You will need to `await` a call to this
107
111
  * function or handle the return type natively as a Promise.
108
112
  * @param store The Store or MergeableStore to persist.
@@ -77,6 +77,10 @@ export interface PostgresPersister extends Persister<Persists.StoreOrMergeableSt
77
77
  * See the documentation for the DpcJson and DpcTabular types for more
78
78
  * information on how both of those modes can be configured.
79
79
  *
80
+ * Note: When using tabular mode, SQL NULL values are loaded as TinyBase null
81
+ * values, making tables dense (every Row has every Cell). See the Database
82
+ * Persistence guide for details.
83
+ *
80
84
  * This method is asynchronous because it will await the creation of dedicated
81
85
  * new connections to the database. You will need to `await` a call to this
82
86
  * function or handle the return type natively as a Promise.
@@ -98,6 +98,10 @@ export interface PostgresPersister<
98
98
  * See the documentation for the DpcJson and DpcTabular types for more
99
99
  * information on how both of those modes can be configured.
100
100
  *
101
+ * Note: When using tabular mode, SQL NULL values are loaded as TinyBase null
102
+ * values, making tables dense (every Row has every Cell). See the Database
103
+ * Persistence guide for details.
104
+ *
101
105
  * This method is asynchronous because it will await the creation of dedicated
102
106
  * new connections to the database. You will need to `await` a call to this
103
107
  * function or handle the return type natively as a Promise.
@@ -76,6 +76,10 @@ export interface PowerSyncPersister extends Persister {
76
76
  *
77
77
  * See the documentation for the DpcJson and DpcTabular types for more
78
78
  * information on how both of those modes can be configured.
79
+ *
80
+ * Note: When using tabular mode, SQL NULL values are loaded as TinyBase null
81
+ * values, making tables dense (every Row has every Cell). See the Database
82
+ * Persistence guide for details.
79
83
  * @param store The Store to persist.
80
84
  * @param powerSync The PowerSync instance.
81
85
  * @param configOrStoreTableName A DatabasePersisterConfig to configure the
@@ -96,6 +96,10 @@ export interface PowerSyncPersister<
96
96
  *
97
97
  * See the documentation for the DpcJson and DpcTabular types for more
98
98
  * information on how both of those modes can be configured.
99
+ *
100
+ * Note: When using tabular mode, SQL NULL values are loaded as TinyBase null
101
+ * values, making tables dense (every Row has every Cell). See the Database
102
+ * Persistence guide for details.
99
103
  * @param store The Store to persist.
100
104
  * @param powerSync The PowerSync instance.
101
105
  * @param configOrStoreTableName A DatabasePersisterConfig to configure the
@@ -87,6 +87,10 @@ export interface ReactNativeSqlitePersister extends Persister<Persists.StoreOrMe
87
87
  *
88
88
  * See the documentation for the DpcJson and DpcTabular types for more
89
89
  * information on how both of those modes can be configured.
90
+ *
91
+ * Note: When using tabular mode, SQL NULL values are loaded as TinyBase null
92
+ * values, making tables dense (every Row has every Cell). See the Database
93
+ * Persistence guide for details.
90
94
  * @param store The Store or MergeableStore to persist.
91
95
  * @param db The database instance that was returned from
92
96
  * `await SQLite.openDatabase(...)`.
@@ -108,6 +108,10 @@ export interface ReactNativeSqlitePersister<
108
108
  *
109
109
  * See the documentation for the DpcJson and DpcTabular types for more
110
110
  * information on how both of those modes can be configured.
111
+ *
112
+ * Note: When using tabular mode, SQL NULL values are loaded as TinyBase null
113
+ * values, making tables dense (every Row has every Cell). See the Database
114
+ * Persistence guide for details.
111
115
  * @param store The Store or MergeableStore to persist.
112
116
  * @param db The database instance that was returned from
113
117
  * `await SQLite.openDatabase(...)`.
@@ -76,6 +76,10 @@ export interface SqliteBunPersister extends Persister<Persists.StoreOrMergeableS
76
76
  *
77
77
  * See the documentation for the DpcJson and DpcTabular types for more
78
78
  * information on how both of those modes can be configured.
79
+ *
80
+ * Note: When using tabular mode, SQL NULL values are loaded as TinyBase null
81
+ * values, making tables dense (every Row has every Cell). See the Database
82
+ * Persistence guide for details.
79
83
  * @param store The Store or MergeableStore to persist.
80
84
  * @param db The database instance that was returned from `new Database(...)`.
81
85
  * @param configOrStoreTableName A DatabasePersisterConfig to configure the
@@ -97,6 +97,10 @@ export interface SqliteBunPersister<
97
97
  *
98
98
  * See the documentation for the DpcJson and DpcTabular types for more
99
99
  * information on how both of those modes can be configured.
100
+ *
101
+ * Note: When using tabular mode, SQL NULL values are loaded as TinyBase null
102
+ * values, making tables dense (every Row has every Cell). See the Database
103
+ * Persistence guide for details.
100
104
  * @param store The Store or MergeableStore to persist.
101
105
  * @param db The database instance that was returned from `new Database(...)`.
102
106
  * @param configOrStoreTableName A DatabasePersisterConfig to configure the
@@ -82,6 +82,10 @@ export interface SqliteWasmPersister extends Persister<Persists.StoreOrMergeable
82
82
  *
83
83
  * See the documentation for the DpcJson and DpcTabular types for more
84
84
  * information on how both of those modes can be configured.
85
+ *
86
+ * Note: When using tabular mode, SQL NULL values are loaded as TinyBase null
87
+ * values, making tables dense (every Row has every Cell). See the Database
88
+ * Persistence guide for details.
85
89
  * @param store The Store or MergeableStore to persist.
86
90
  * @param sqlite3 The WASM module that was returned from `sqlite3InitModule`.
87
91
  * @param db The database instance that was returned from `new
@@ -104,6 +104,10 @@ export interface SqliteWasmPersister<
104
104
  *
105
105
  * See the documentation for the DpcJson and DpcTabular types for more
106
106
  * information on how both of those modes can be configured.
107
+ *
108
+ * Note: When using tabular mode, SQL NULL values are loaded as TinyBase null
109
+ * values, making tables dense (every Row has every Cell). See the Database
110
+ * Persistence guide for details.
107
111
  * @param store The Store or MergeableStore to persist.
108
112
  * @param sqlite3 The WASM module that was returned from `sqlite3InitModule`.
109
113
  * @param db The database instance that was returned from `new
@@ -76,6 +76,10 @@ export interface Sqlite3Persister extends Persister<Persists.StoreOrMergeableSto
76
76
  *
77
77
  * See the documentation for the DpcJson and DpcTabular types for more
78
78
  * information on how both of those modes can be configured.
79
+ *
80
+ * Note: When using tabular mode, SQL NULL values are loaded as TinyBase null
81
+ * values, making tables dense (every Row has every Cell). See the Database
82
+ * Persistence guide for details.
79
83
  * @param store The Store or MergeableStore to persist.
80
84
  * @param db The database instance that was returned from `new
81
85
  * sqlite3.Database(...)`.
@@ -97,6 +97,10 @@ export interface Sqlite3Persister<
97
97
  *
98
98
  * See the documentation for the DpcJson and DpcTabular types for more
99
99
  * information on how both of those modes can be configured.
100
+ *
101
+ * Note: When using tabular mode, SQL NULL values are loaded as TinyBase null
102
+ * values, making tables dense (every Row has every Cell). See the Database
103
+ * Persistence guide for details.
100
104
  * @param store The Store or MergeableStore to persist.
101
105
  * @param db The database instance that was returned from `new
102
106
  * sqlite3.Database(...)`.
@@ -77,7 +77,7 @@ export type ResultRow = {[cellId: Id]: ResultCell};
77
77
  * @category Result
78
78
  * @since v2.0.0
79
79
  */
80
- export type ResultCell = string | number | boolean;
80
+ export type ResultCell = string | number | boolean | null;
81
81
 
82
82
  /**
83
83
  * The ResultCellOrUndefined type is the data structure representing a single
@@ -44,9 +44,9 @@ export type TablesSchema = {[tableId: Id]: {[cellId: Id]: CellSchema}};
44
44
  * The CellSchema type describes what values are allowed for each Cell in a
45
45
  * Table.
46
46
  *
47
- * A CellSchema specifies the type of the Cell (`string`, `boolean`, or
48
- * `number`), and what the default value can be when an explicit value is not
49
- * specified.
47
+ * A CellSchema specifies the type of the Cell (`string`, `boolean`, `number`;
48
+ * or `null`, since v7.0), and what the default value can be when an explicit
49
+ * value is not specified.
50
50
  *
51
51
  * If a default value is provided (and its type is correct), you can be certain
52
52
  * that that Cell will always be present in a Row.
@@ -70,9 +70,9 @@ export type TablesSchema = {[tableId: Id]: {[cellId: Id]: CellSchema}};
70
70
  * @since v1.0.0
71
71
  */
72
72
  export type CellSchema =
73
- | {type: 'string'; default?: string}
74
- | {type: 'number'; default?: number}
75
- | {type: 'boolean'; default?: boolean};
73
+ | {type: 'string'; default?: string | null; allowNull?: boolean}
74
+ | {type: 'number'; default?: number | null; allowNull?: boolean}
75
+ | {type: 'boolean'; default?: boolean | null; allowNull?: boolean};
76
76
 
77
77
  /**
78
78
  * The ValuesSchema type describes the keyed Values that can be set in a Store
@@ -100,9 +100,9 @@ export type ValuesSchema = {[valueId: Id]: ValueSchema};
100
100
  * The ValueSchema type describes what values are allowed for keyed Values in a
101
101
  * Store.
102
102
  *
103
- * A ValueSchema specifies the type of the Value (`string`, `boolean`, or
104
- * `number`), and what the default value can be when an explicit value is not
105
- * specified.
103
+ * A ValueSchema specifies the type of the Value (`string`, `boolean`, `number`;
104
+ * or `null` since v7.0), and what the default value can be when an explicit
105
+ * value is not specified.
106
106
  *
107
107
  * If a default value is provided (and its type is correct), you can be certain
108
108
  * that the Value will always be present in a Store.
@@ -126,9 +126,9 @@ export type ValuesSchema = {[valueId: Id]: ValueSchema};
126
126
  * @since v3.0.0
127
127
  */
128
128
  export type ValueSchema =
129
- | {type: 'string'; default?: string}
130
- | {type: 'number'; default?: number}
131
- | {type: 'boolean'; default?: boolean};
129
+ | {type: 'string'; default?: string | null; allowNull?: boolean}
130
+ | {type: 'number'; default?: number | null; allowNull?: boolean}
131
+ | {type: 'boolean'; default?: boolean | null; allowNull?: boolean};
132
132
 
133
133
  /**
134
134
  * The NoTablesSchema type is a TablesSchema-like type for when one has not been
@@ -280,7 +280,7 @@ export type Row = {[cellId: Id]: Cell};
280
280
  *
281
281
  * A Cell is used when setting a cell with the setCell method, and when getting
282
282
  * it back out again with the getCell method. A Cell is a JavaScript string,
283
- * number, or boolean.
283
+ * number, boolean; or null since v7.0.
284
284
  * @example
285
285
  * ```js
286
286
  * import type {Cell} from 'tinybase';
@@ -290,7 +290,7 @@ export type Row = {[cellId: Id]: Cell};
290
290
  * @category Store
291
291
  * @since v1.0.0
292
292
  */
293
- export type Cell = string | number | boolean;
293
+ export type Cell = string | number | boolean | null;
294
294
 
295
295
  /**
296
296
  * The CellOrUndefined type is a data structure representing the data in a
@@ -329,7 +329,7 @@ export type Values = {[valueId: Id]: Value};
329
329
  *
330
330
  * A Value is used when setting a value with the setValue method, and when
331
331
  * getting it back out again with the getValue method. A Value is a JavaScript
332
- * string, number, or boolean.
332
+ * string, number, boolean; or null since v7.0.
333
333
  * @example
334
334
  * ```js
335
335
  * import type {Value} from 'tinybase';
@@ -339,7 +339,7 @@ export type Values = {[valueId: Id]: Value};
339
339
  * @category Store
340
340
  * @since v3.0.0
341
341
  */
342
- export type Value = string | number | boolean;
342
+ export type Value = string | number | boolean | null;
343
343
 
344
344
  /**
345
345
  * The ValueOrUndefined type is a data structure representing the data in a
@@ -1704,13 +1704,14 @@ export type StoreListenerStats = {
1704
1704
  *
1705
1705
  * The keyed value support is best thought of as a flat JavaScript object. The
1706
1706
  * Store contains a number of Value objects, each with a unique ID, and which is
1707
- * a string, boolean, or number.
1707
+ * a string, boolean, number; or null since v7.0.
1708
1708
  *
1709
1709
  * ```json
1710
1710
  * { // Store
1711
1711
  * "value1": "one", // Value (string)
1712
1712
  * "value2": true, // Value (boolean)
1713
1713
  * "value3": 3, // Value (number)
1714
+ * "value4": null, // Value (null since v7.0)
1714
1715
  * ...
1715
1716
  * }
1716
1717
  * ```
@@ -1727,7 +1728,7 @@ export type StoreListenerStats = {
1727
1728
  * - Each Table contains a number of Row objects.
1728
1729
  * - Each Row contains a number of Cell objects.
1729
1730
  *
1730
- * A Cell is a string, boolean, or number value.
1731
+ * A Cell is a string, boolean, number; or null since v7.0.
1731
1732
  *
1732
1733
  * The members of each level of this hierarchy are identified with a unique Id
1733
1734
  * (which is a string). In other words you can naively think of a Store as a
@@ -1740,6 +1741,7 @@ export type StoreListenerStats = {
1740
1741
  * "cell1": "one", // Cell (string)
1741
1742
  * "cell2": true, // Cell (boolean)
1742
1743
  * "cell3": 3, // Cell (number)
1744
+ * "cell4": null, // Cell (null since v7.0)
1743
1745
  * ...
1744
1746
  * },
1745
1747
  * ...
@@ -3547,7 +3549,7 @@ export interface Store {
3547
3549
  * .setTables({pets: {fido: {species: 'dog', color: 'brown'}}})
3548
3550
  * .setValues({open: true});
3549
3551
  *
3550
- * store.applyChanges([{pets: {fido: {color: 'black'}}}, {open: null}]);
3552
+ * store.applyChanges([{pets: {fido: {color: 'black'}}}, {open: undefined}]);
3551
3553
  * console.log(store.getTables());
3552
3554
  * // -> {pets: {fido: {species: 'dog', color: 'black'}}}
3553
3555
  * console.log(store.getValues());
@@ -60,9 +60,9 @@ export type TablesSchema = {[tableId: Id]: {[cellId: Id]: CellSchema}};
60
60
  * The CellSchema type describes what values are allowed for each Cell in a
61
61
  * Table.
62
62
  *
63
- * A CellSchema specifies the type of the Cell (`string`, `boolean`, or
64
- * `number`), and what the default value can be when an explicit value is not
65
- * specified.
63
+ * A CellSchema specifies the type of the Cell (`string`, `boolean`, `number`;
64
+ * or `null`, since v7.0), and what the default value can be when an explicit
65
+ * value is not specified.
66
66
  *
67
67
  * If a default value is provided (and its type is correct), you can be certain
68
68
  * that that Cell will always be present in a Row.
@@ -116,9 +116,9 @@ export type ValuesSchema = {[valueId: Id]: ValueSchema};
116
116
  * The ValueSchema type describes what values are allowed for keyed Values in a
117
117
  * Store.
118
118
  *
119
- * A ValueSchema specifies the type of the Value (`string`, `boolean`, or
120
- * `number`), and what the default value can be when an explicit value is not
121
- * specified.
119
+ * A ValueSchema specifies the type of the Value (`string`, `boolean`, `number`;
120
+ * or `null` since v7.0), and what the default value can be when an explicit
121
+ * value is not specified.
122
122
  *
123
123
  * If a default value is provided (and its type is correct), you can be certain
124
124
  * that the Value will always be present in a Store.
@@ -361,12 +361,12 @@ export type Row<
361
361
  * This has schema-based typing. The following is a simplified representation:
362
362
  *
363
363
  * ```ts override
364
- * string | number | boolean;
364
+ * string | number | boolean | null;
365
365
  * ```
366
366
  *
367
367
  * A Cell is used when setting a cell with the setCell method, and when getting
368
368
  * it back out again with the getCell method. A Cell is a JavaScript string,
369
- * number, or boolean.
369
+ * number, boolean; or null since v7.0.
370
370
  * @example
371
371
  * ```js
372
372
  * import type {Cell} from 'tinybase';
@@ -463,12 +463,12 @@ export type Values<
463
463
  * This has schema-based typing. The following is a simplified representation:
464
464
  *
465
465
  * ```ts override
466
- * string | number | boolean;
466
+ * string | number | boolean | null;
467
467
  * ```
468
468
  *
469
469
  * A Value is used when setting a value with the setValue method, and when
470
470
  * getting it back out again with the getValue method. A Value is a JavaScript
471
- * string, number, or boolean.
471
+ * string, number, boolean; or null since v7.0.
472
472
  * @example
473
473
  * ```js
474
474
  * import type {Value} from 'tinybase';
@@ -2675,13 +2675,14 @@ export type StoreListenerStats = {
2675
2675
  *
2676
2676
  * The keyed value support is best thought of as a flat JavaScript object. The
2677
2677
  * Store contains a number of Value objects, each with a unique ID, and which is
2678
- * a string, boolean, or number.
2678
+ * a string, boolean, number; or null since v7.0.
2679
2679
  *
2680
2680
  * ```json
2681
2681
  * { // Store
2682
2682
  * "value1": "one", // Value (string)
2683
2683
  * "value2": true, // Value (boolean)
2684
2684
  * "value3": 3, // Value (number)
2685
+ * "value4": null, // Value (null since v7.0)
2685
2686
  * ...
2686
2687
  * }
2687
2688
  * ```
@@ -2698,7 +2699,7 @@ export type StoreListenerStats = {
2698
2699
  * - Each Table contains a number of Row objects.
2699
2700
  * - Each Row contains a number of Cell objects.
2700
2701
  *
2701
- * A Cell is a string, boolean, or number value.
2702
+ * A Cell is a string, boolean, number; or null since v7.0.
2702
2703
  *
2703
2704
  * The members of each level of this hierarchy are identified with a unique Id
2704
2705
  * (which is a string). In other words you can naively think of a Store as a
@@ -2711,6 +2712,7 @@ export type StoreListenerStats = {
2711
2712
  * "cell1": "one", // Cell (string)
2712
2713
  * "cell2": true, // Cell (boolean)
2713
2714
  * "cell3": 3, // Cell (number)
2715
+ * "cell4": null, // Cell (null since v7.0)
2714
2716
  * ...
2715
2717
  * },
2716
2718
  * ...
@@ -4767,7 +4769,7 @@ export interface Store<in out Schemas extends OptionalSchemas> {
4767
4769
  * .setTables({pets: {fido: {species: 'dog', color: 'brown'}}})
4768
4770
  * .setValues({open: true});
4769
4771
  *
4770
- * store.applyChanges([{pets: {fido: {color: 'black'}}}, {open: null}]);
4772
+ * store.applyChanges([{pets: {fido: {color: 'black'}}}, {open: undefined}]);
4771
4773
  * console.log(store.getTables());
4772
4774
  * // -> {pets: {fido: {species: 'dog', color: 'black'}}}
4773
4775
  * console.log(store.getValues());
package/agents.md CHANGED
@@ -279,3 +279,65 @@ for consistency and tree-shaking. Always use factory functions (`createStore`,
279
279
  `createIndexes`, etc.) with builder pattern chaining. Maintain 100% test
280
280
  coverage and follow the strict 80-character line length. See
281
281
  `.github/copilot-instructions.md` for detailed coding patterns.
282
+
283
+ ## Documentation System
284
+
285
+ TinyBase has a sophisticated documentation system that generates the website
286
+ from source code and markdown files.
287
+
288
+ ### Documentation Structure
289
+
290
+ 1. **Type Definitions (`src/@types/*/`)**: TypeScript `.d.ts` files contain the
291
+ API type definitions. **Never add comments directly to `.d.ts` files**.
292
+
293
+ 2. **Documentation Files (`src/@types/*/docs.js`)**: Companion `docs.js` files
294
+ sit alongside `.d.ts` files. Use `///` convention to document types and
295
+ functions. These are stitched together at build time to generate
296
+ documentation.
297
+
298
+ 3. **Guide Files (`site/guides/*/*.md`)**: Markdown files in the `site/guides/`
299
+ directory, organized by topic (basics, schemas, persistence, etc.). These are
300
+ source files for guides on the website.
301
+
302
+ 4. **Generated Files**: `/releases.md` and `/readme.md` in the root are
303
+ **GENERATED** from `/site/guides/16_releases.md` and `/site/home/index.md`.
304
+ **Never edit the generated files directly**.
305
+
306
+ ### Documentation Testing
307
+
308
+ TinyBase has automated tests that validate all inline code examples in
309
+ documentation:
310
+
311
+ ```bash
312
+ npx vitest run ./test/unit/documentation.test.ts --retry=0
313
+ ```
314
+
315
+ **How it works**:
316
+
317
+ - Extracts all code blocks from markdown files and `docs.js` files
318
+ - Concatenates all examples from each file together
319
+ - Parses and executes them to ensure they work
320
+ - This means examples in the same file share scope
321
+
322
+ **Critical constraints**:
323
+
324
+ - Don't redeclare variables across examples in the same file
325
+ - First example can declare `const store = createStore()`, subsequent examples
326
+ reuse it
327
+ - Include necessary imports in examples that use them
328
+ - Avoid async operations in examples unless necessary
329
+ - Keep examples simple and focused
330
+
331
+ **Common pitfalls**:
332
+
333
+ - ❌ Declaring `const store` multiple times in the same file
334
+ - ❌ Using undefined functions (forgot import statement)
335
+ - ✅ First example: `const store = createStore()`
336
+ - ✅ Later examples: `store.setCell(...)` (reuses existing store)
337
+
338
+ ### Adding New Documentation
339
+
340
+ 1. **API Documentation**: Edit `docs.js` file next to the type definition
341
+ 2. **Guide Content**: Edit markdown files in `/site/guides/`
342
+ 3. **Release Notes**: Edit `/site/guides/16_releases.md` (not `/releases.md`)
343
+ 4. **Always run documentation tests** after changes to verify examples work