tinybase 10.0.0-beta.0 → 10.0.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (185) hide show
  1. package/@types/common/index.d.ts +1 -0
  2. package/@types/common/with-schemas/index.d.ts +1 -0
  3. package/@types/indexes/index.d.ts +4 -3
  4. package/@types/indexes/with-schemas/index.d.ts +4 -3
  5. package/@types/metrics/index.d.ts +1 -0
  6. package/@types/metrics/with-schemas/index.d.ts +1 -0
  7. package/@types/omni/index.d.ts +1 -0
  8. package/@types/omni/with-schemas/index.d.ts +1 -0
  9. package/@types/persisters/index.d.ts +1 -0
  10. package/@types/persisters/persister-partykit-server/index.d.ts +17 -0
  11. package/@types/persisters/persister-partykit-server/with-schemas/index.d.ts +17 -0
  12. package/@types/persisters/persister-tinyjoin/index.d.ts +197 -0
  13. package/@types/persisters/persister-tinyjoin/with-schemas/index.d.ts +221 -0
  14. package/@types/persisters/with-schemas/index.d.ts +1 -0
  15. package/@types/queries/index.d.ts +3 -0
  16. package/@types/queries/with-schemas/index.d.ts +3 -0
  17. package/@types/relationships/index.d.ts +1 -0
  18. package/@types/relationships/with-schemas/index.d.ts +1 -0
  19. package/@types/store/index.d.ts +4 -0
  20. package/@types/store/with-schemas/index.d.ts +4 -0
  21. package/@types/ui-react/index.d.ts +2 -0
  22. package/@types/ui-react/with-schemas/index.d.ts +1 -0
  23. package/@types/ui-react-dom-charts/index.d.ts +7 -0
  24. package/@types/ui-react-dom-charts/with-schemas/index.d.ts +7 -0
  25. package/@types/ui-solid/index.d.ts +2 -0
  26. package/@types/ui-solid/with-schemas/index.d.ts +1 -0
  27. package/@types/ui-svelte/index.d.ts +23 -0
  28. package/@types/ui-svelte/with-schemas/index.d.ts +23 -0
  29. package/@types/ui-svelte-dom/index.d.ts +10 -0
  30. package/@types/ui-svelte-dom/with-schemas/index.d.ts +10 -0
  31. package/@types/ui-svelte-inspector/index.d.ts +1 -0
  32. package/@types/ui-svelte-inspector/with-schemas/index.d.ts +1 -0
  33. package/checkpoints/index.js +4 -2
  34. package/checkpoints/with-schemas/index.js +4 -2
  35. package/index.js +37 -4
  36. package/metrics/index.js +2 -1
  37. package/metrics/with-schemas/index.js +2 -1
  38. package/min/checkpoints/index.js +1 -1
  39. package/min/checkpoints/index.js.gz +0 -0
  40. package/min/checkpoints/with-schemas/index.js +1 -1
  41. package/min/checkpoints/with-schemas/index.js.gz +0 -0
  42. package/min/index.js +1 -1
  43. package/min/index.js.gz +0 -0
  44. package/min/metrics/index.js +1 -1
  45. package/min/metrics/index.js.gz +0 -0
  46. package/min/metrics/with-schemas/index.js +1 -1
  47. package/min/metrics/with-schemas/index.js.gz +0 -0
  48. package/min/omni/index.js +1 -1
  49. package/min/omni/index.js.gz +0 -0
  50. package/min/omni/with-schemas/index.js +1 -1
  51. package/min/omni/with-schemas/index.js.gz +0 -0
  52. package/min/persisters/index.js +1 -1
  53. package/min/persisters/index.js.gz +0 -0
  54. package/min/persisters/persister-better-sqlite3/index.js +1 -1
  55. package/min/persisters/persister-better-sqlite3/index.js.gz +0 -0
  56. package/min/persisters/persister-better-sqlite3/with-schemas/index.js +1 -1
  57. package/min/persisters/persister-better-sqlite3/with-schemas/index.js.gz +0 -0
  58. package/min/persisters/persister-capacitor-sqlite/index.js +1 -1
  59. package/min/persisters/persister-capacitor-sqlite/index.js.gz +0 -0
  60. package/min/persisters/persister-capacitor-sqlite/with-schemas/index.js +1 -1
  61. package/min/persisters/persister-capacitor-sqlite/with-schemas/index.js.gz +0 -0
  62. package/min/persisters/persister-cr-sqlite-wasm/index.js +1 -1
  63. package/min/persisters/persister-cr-sqlite-wasm/index.js.gz +0 -0
  64. package/min/persisters/persister-cr-sqlite-wasm/with-schemas/index.js +1 -1
  65. package/min/persisters/persister-cr-sqlite-wasm/with-schemas/index.js.gz +0 -0
  66. package/min/persisters/persister-durable-object-sql-storage/index.js +1 -1
  67. package/min/persisters/persister-durable-object-sql-storage/index.js.gz +0 -0
  68. package/min/persisters/persister-durable-object-sql-storage/with-schemas/index.js +1 -1
  69. package/min/persisters/persister-durable-object-sql-storage/with-schemas/index.js.gz +0 -0
  70. package/min/persisters/persister-electric-sql/index.js +1 -1
  71. package/min/persisters/persister-electric-sql/index.js.gz +0 -0
  72. package/min/persisters/persister-electric-sql/with-schemas/index.js +1 -1
  73. package/min/persisters/persister-electric-sql/with-schemas/index.js.gz +0 -0
  74. package/min/persisters/persister-expo-sqlite/index.js +1 -1
  75. package/min/persisters/persister-expo-sqlite/index.js.gz +0 -0
  76. package/min/persisters/persister-expo-sqlite/with-schemas/index.js +1 -1
  77. package/min/persisters/persister-expo-sqlite/with-schemas/index.js.gz +0 -0
  78. package/min/persisters/persister-libsql/index.js +1 -1
  79. package/min/persisters/persister-libsql/index.js.gz +0 -0
  80. package/min/persisters/persister-libsql/with-schemas/index.js +1 -1
  81. package/min/persisters/persister-libsql/with-schemas/index.js.gz +0 -0
  82. package/min/persisters/persister-pg/index.js +1 -1
  83. package/min/persisters/persister-pg/index.js.gz +0 -0
  84. package/min/persisters/persister-pg/with-schemas/index.js +1 -1
  85. package/min/persisters/persister-pg/with-schemas/index.js.gz +0 -0
  86. package/min/persisters/persister-pglite/index.js +1 -1
  87. package/min/persisters/persister-pglite/index.js.gz +0 -0
  88. package/min/persisters/persister-pglite/with-schemas/index.js +1 -1
  89. package/min/persisters/persister-pglite/with-schemas/index.js.gz +0 -0
  90. package/min/persisters/persister-postgres/index.js +1 -1
  91. package/min/persisters/persister-postgres/index.js.gz +0 -0
  92. package/min/persisters/persister-postgres/with-schemas/index.js +1 -1
  93. package/min/persisters/persister-postgres/with-schemas/index.js.gz +0 -0
  94. package/min/persisters/persister-powersync/index.js +1 -1
  95. package/min/persisters/persister-powersync/index.js.gz +0 -0
  96. package/min/persisters/persister-powersync/with-schemas/index.js +1 -1
  97. package/min/persisters/persister-powersync/with-schemas/index.js.gz +0 -0
  98. package/min/persisters/persister-react-native-sqlite/index.js +1 -1
  99. package/min/persisters/persister-react-native-sqlite/index.js.gz +0 -0
  100. package/min/persisters/persister-react-native-sqlite/with-schemas/index.js +1 -1
  101. package/min/persisters/persister-react-native-sqlite/with-schemas/index.js.gz +0 -0
  102. package/min/persisters/persister-sqlite-bun/index.js +1 -1
  103. package/min/persisters/persister-sqlite-bun/index.js.gz +0 -0
  104. package/min/persisters/persister-sqlite-bun/with-schemas/index.js +1 -1
  105. package/min/persisters/persister-sqlite-bun/with-schemas/index.js.gz +0 -0
  106. package/min/persisters/persister-sqlite-node/index.js +1 -1
  107. package/min/persisters/persister-sqlite-node/index.js.gz +0 -0
  108. package/min/persisters/persister-sqlite-node/with-schemas/index.js +1 -1
  109. package/min/persisters/persister-sqlite-node/with-schemas/index.js.gz +0 -0
  110. package/min/persisters/persister-sqlite-wasm/index.js +1 -1
  111. package/min/persisters/persister-sqlite-wasm/index.js.gz +0 -0
  112. package/min/persisters/persister-sqlite-wasm/with-schemas/index.js +1 -1
  113. package/min/persisters/persister-sqlite-wasm/with-schemas/index.js.gz +0 -0
  114. package/min/persisters/persister-sqlite3/index.js +1 -1
  115. package/min/persisters/persister-sqlite3/index.js.gz +0 -0
  116. package/min/persisters/persister-sqlite3/with-schemas/index.js +1 -1
  117. package/min/persisters/persister-sqlite3/with-schemas/index.js.gz +0 -0
  118. package/min/persisters/persister-tinyjoin/index.js +1 -0
  119. package/min/persisters/persister-tinyjoin/index.js.gz +0 -0
  120. package/min/persisters/persister-tinyjoin/with-schemas/index.js +1 -0
  121. package/min/persisters/persister-tinyjoin/with-schemas/index.js.gz +0 -0
  122. package/min/persisters/with-schemas/index.js +1 -1
  123. package/min/persisters/with-schemas/index.js.gz +0 -0
  124. package/min/queries/index.js +1 -1
  125. package/min/queries/index.js.gz +0 -0
  126. package/min/queries/with-schemas/index.js +1 -1
  127. package/min/queries/with-schemas/index.js.gz +0 -0
  128. package/min/relationships/index.js +1 -1
  129. package/min/relationships/index.js.gz +0 -0
  130. package/min/relationships/with-schemas/index.js +1 -1
  131. package/min/relationships/with-schemas/index.js.gz +0 -0
  132. package/min/synchronizers/synchronizer-local/index.js +1 -1
  133. package/min/synchronizers/synchronizer-local/index.js.gz +0 -0
  134. package/min/synchronizers/synchronizer-local/with-schemas/index.js +1 -1
  135. package/min/synchronizers/synchronizer-local/with-schemas/index.js.gz +0 -0
  136. package/min/with-schemas/index.js +1 -1
  137. package/min/with-schemas/index.js.gz +0 -0
  138. package/omni/index.js +205 -94
  139. package/omni/with-schemas/index.js +205 -94
  140. package/package.json +54 -14
  141. package/persisters/index.js +28 -13
  142. package/persisters/persister-better-sqlite3/index.js +70 -55
  143. package/persisters/persister-better-sqlite3/with-schemas/index.js +70 -55
  144. package/persisters/persister-capacitor-sqlite/index.js +70 -55
  145. package/persisters/persister-capacitor-sqlite/with-schemas/index.js +70 -55
  146. package/persisters/persister-cr-sqlite-wasm/index.js +70 -55
  147. package/persisters/persister-cr-sqlite-wasm/with-schemas/index.js +70 -55
  148. package/persisters/persister-durable-object-sql-storage/index.js +28 -13
  149. package/persisters/persister-durable-object-sql-storage/with-schemas/index.js +28 -13
  150. package/persisters/persister-electric-sql/index.js +70 -55
  151. package/persisters/persister-electric-sql/with-schemas/index.js +70 -55
  152. package/persisters/persister-expo-sqlite/index.js +70 -55
  153. package/persisters/persister-expo-sqlite/with-schemas/index.js +70 -55
  154. package/persisters/persister-libsql/index.js +91 -78
  155. package/persisters/persister-libsql/with-schemas/index.js +91 -78
  156. package/persisters/persister-pg/index.js +77 -62
  157. package/persisters/persister-pg/with-schemas/index.js +77 -62
  158. package/persisters/persister-pglite/index.js +28 -13
  159. package/persisters/persister-pglite/with-schemas/index.js +28 -13
  160. package/persisters/persister-postgres/index.js +28 -13
  161. package/persisters/persister-postgres/with-schemas/index.js +28 -13
  162. package/persisters/persister-powersync/index.js +81 -66
  163. package/persisters/persister-powersync/with-schemas/index.js +81 -66
  164. package/persisters/persister-react-native-sqlite/index.js +70 -55
  165. package/persisters/persister-react-native-sqlite/with-schemas/index.js +70 -55
  166. package/persisters/persister-sqlite-bun/index.js +70 -55
  167. package/persisters/persister-sqlite-bun/with-schemas/index.js +70 -55
  168. package/persisters/persister-sqlite-node/index.js +70 -55
  169. package/persisters/persister-sqlite-node/with-schemas/index.js +70 -55
  170. package/persisters/persister-sqlite-wasm/index.js +70 -55
  171. package/persisters/persister-sqlite-wasm/with-schemas/index.js +70 -55
  172. package/persisters/persister-sqlite3/index.js +70 -55
  173. package/persisters/persister-sqlite3/with-schemas/index.js +70 -55
  174. package/persisters/persister-tinyjoin/index.js +1710 -0
  175. package/persisters/persister-tinyjoin/with-schemas/index.js +1710 -0
  176. package/persisters/with-schemas/index.js +28 -13
  177. package/queries/index.js +2 -1
  178. package/queries/with-schemas/index.js +2 -1
  179. package/readme.md +3 -3
  180. package/relationships/index.js +39 -9
  181. package/relationships/with-schemas/index.js +39 -9
  182. package/releases.md +20 -1
  183. package/synchronizers/synchronizer-local/index.js +1 -1
  184. package/synchronizers/synchronizer-local/with-schemas/index.js +1 -1
  185. package/with-schemas/index.js +37 -4
@@ -0,0 +1,221 @@
1
+ /**
2
+ * The persister-tinyjoin module of the TinyBase project lets you save and load
3
+ * Store data to and from a TinyJoin database in a browser.
4
+ * @see Database Persistence guide
5
+ * @packageDocumentation
6
+ * @module persister-tinyjoin
7
+ * @since 10.0.0
8
+ */
9
+ import type {Client} from 'tinyjoin';
10
+ import type {MergeableStore} from '../../../mergeable-store/with-schemas/index.d.ts';
11
+ import type {
12
+ OptionalSchemas,
13
+ Store,
14
+ } from '../../../store/with-schemas/index.d.ts';
15
+ import type {
16
+ DatabasePersisterConfig,
17
+ DpcJson,
18
+ Persister,
19
+ Persists,
20
+ } from '../../with-schemas/index.d.ts';
21
+
22
+ /**
23
+ * The TinyJoinPersister interface represents a Persister that lets you save and
24
+ * load Store data to and from a [TinyJoin](https://tinyjoin.org) database.
25
+ *
26
+ * You should use the createTinyJoinPersister function to create a
27
+ * TinyJoinPersister object.
28
+ *
29
+ * It is a minor extension to the Persister interface and simply provides an
30
+ * extra getTinyJoin method for accessing a reference to the TinyJoin client the
31
+ * Store is being persisted to.
32
+ * @category Persister
33
+ * @since 10.0.0
34
+ */
35
+ export interface TinyJoinPersister<
36
+ Schemas extends OptionalSchemas,
37
+ > extends Persister<Schemas, Persists.StoreOrMergeableStore> {
38
+ /**
39
+ * The getTinyJoin method returns a reference to the TinyJoin client the Store
40
+ * is being persisted to.
41
+ * @returns A reference to the TinyJoin client.
42
+ * @example
43
+ * This example creates a Persister object against a newly-created Store and
44
+ * then gets the TinyJoin client back out again.
45
+ *
46
+ * ```js ignore
47
+ * import {createStore} from 'tinybase';
48
+ * import {createTinyJoinPersister} from 'tinybase/persisters/persister-tinyjoin';
49
+ * import {create} from 'tinyjoin';
50
+ *
51
+ * const tinyJoin = await create();
52
+ * const store = createStore().setTables({pets: {fido: {species: 'dog'}}});
53
+ * const persister = createTinyJoinPersister(store, tinyJoin, 'my_tinybase');
54
+ *
55
+ * console.log(persister.getTinyJoin() == tinyJoin);
56
+ * // -> true
57
+ *
58
+ * await persister.destroy();
59
+ * await tinyJoin.close();
60
+ * ```
61
+ * @category Getter
62
+ * @since 10.0.0
63
+ */
64
+ getTinyJoin(): Client;
65
+ }
66
+
67
+ /**
68
+ * The createTinyJoinPersister function creates a TinyJoinPersister object that
69
+ * can persist the Store to a [TinyJoin](https://tinyjoin.org) database in a
70
+ * browser.
71
+ *
72
+ * This has schema-based typing. The following is a simplified representation:
73
+ *
74
+ * ```ts override
75
+ * createTinyJoinPersister<StoreType extends Store>(
76
+ * store: StoreType,
77
+ * tinyJoin: Client,
78
+ * configOrStoreTableName?:
79
+ * | (NoInfer<StoreType> extends MergeableStore
80
+ * ? DpcJson
81
+ * : DatabasePersisterConfig)
82
+ * | string,
83
+ * onSqlCommand?: (sql: string, params?: any[]) => void,
84
+ * onIgnoredError?: (error: any) => void,
85
+ * ): TinyJoinPersister;
86
+ * ```
87
+ *
88
+ * TinyJoin is a tiny, worker-first relational database that runs entirely in
89
+ * the browser, either in memory or - with an `opfs://` data directory - saved
90
+ * across reloads. This Persister therefore gives you a SQL-shaped local
91
+ * database to keep a Store in, without a server or a native dependency. Its
92
+ * `tinyjoin/node` entry point opens an ephemeral in-memory database in a Node
93
+ * worker thread, which makes this Persister testable outside a browser.
94
+ *
95
+ * A TinyJoinPersister supports regular Store objects, and can also be used to
96
+ * persist the metadata of a MergeableStore when using the JSON serialization
97
+ * mode, as described below.
98
+ *
99
+ * As well as providing a reference to the Store to persist, you must provide a
100
+ * `tinyJoin` parameter which identifies the TinyJoin client that was returned
101
+ * from its own `create` function.
102
+ *
103
+ * A database Persister uses one of two modes: either a JSON serialization of
104
+ * the whole Store stored in a single row of a table (the default), or a tabular
105
+ * mapping of Table Ids to database table names and vice-versa).
106
+ *
107
+ * The third argument is a DatabasePersisterConfig object that configures which
108
+ * of those modes to use, and settings for each. If the third argument is simply
109
+ * a string, it is used as the `storeTableName` property of the JSON
110
+ * serialization.
111
+ *
112
+ * See the documentation for the DpcJson and DpcTabular types for more
113
+ * information on how both of those modes can be configured.
114
+ *
115
+ * Note: When using tabular mode, SQL NULL values are loaded as TinyBase null
116
+ * values, making tables dense (every Row has every Cell). See the Database
117
+ * Persistence guide for details.
118
+ *
119
+ * TinyJoin implements a deliberately bounded SQL dialect, and two of its
120
+ * boundaries are worth knowing about. It has no `ALTER TABLE ... DROP COLUMN`,
121
+ * so the table used for the JSON serialization should not have columns beyond
122
+ * the two it manages, and tabular mode should be left with its default of not
123
+ * deleting empty columns. It also has no SQL transaction
124
+ * statements, and rejects schema changes inside its own callback transactions,
125
+ * so each of the Persister's commands is atomic on its own rather than a save
126
+ * being atomic as a whole.
127
+ * @param store The Store or MergeableStore to persist.
128
+ * @param tinyJoin The TinyJoin client that was returned from `create(...)`.
129
+ * @param configOrStoreTableName A DatabasePersisterConfig to configure the
130
+ * persistence mode (or a string to set the `storeTableName` property of the
131
+ * JSON serialization).
132
+ * @param onSqlCommand An optional handler called every time the Persister
133
+ * executes a SQL command or query. This is suitable for logging persistence
134
+ * behavior in a development environment.
135
+ * @param onIgnoredError An optional handler for the errors that the Persister
136
+ * would otherwise ignore when trying to save or load data. This is suitable for
137
+ * debugging persistence issues in a development environment.
138
+ * @returns A reference to the new TinyJoinPersister object.
139
+ * @example
140
+ * This example creates a TinyJoinPersister object and persists the Store to a
141
+ * TinyJoin database as a JSON serialization into the `my_tinybase` table. It
142
+ * makes a change to the database directly and then reloads it back into the
143
+ * Store.
144
+ *
145
+ * ```js ignore
146
+ * import {createStore} from 'tinybase';
147
+ * import {createTinyJoinPersister} from 'tinybase/persisters/persister-tinyjoin';
148
+ * import {create} from 'tinyjoin';
149
+ *
150
+ * const tinyJoin = await create();
151
+ * const store = createStore().setTables({pets: {fido: {species: 'dog'}}});
152
+ * const persister = createTinyJoinPersister(store, tinyJoin, 'my_tinybase');
153
+ *
154
+ * await persister.save();
155
+ * // Store will be saved to the database.
156
+ *
157
+ * console.log((await tinyJoin.query('SELECT * FROM my_tinybase')).rows);
158
+ * // -> [{_id: '_', store: '[{"pets":{"fido":{"species":"dog"}}},{}]'}]
159
+ *
160
+ * await tinyJoin.query('UPDATE my_tinybase SET store = $1 WHERE _id = $2', [
161
+ * '[{"pets":{"felix":{"species":"cat"}}},{}]',
162
+ * '_',
163
+ * ]);
164
+ *
165
+ * await persister.load();
166
+ * console.log(store.getTables());
167
+ * // -> {pets: {felix: {species: 'cat'}}}
168
+ *
169
+ * await persister.destroy();
170
+ * await tinyJoin.close();
171
+ * ```
172
+ * @example
173
+ * This example creates a TinyJoinPersister object and persists the Store to a
174
+ * TinyJoin database with tabular mapping.
175
+ *
176
+ * ```js ignore
177
+ * import {createStore} from 'tinybase';
178
+ * import {createTinyJoinPersister} from 'tinybase/persisters/persister-tinyjoin';
179
+ * import {create} from 'tinyjoin';
180
+ *
181
+ * const tinyJoin = await create();
182
+ * const store = createStore().setTables({pets: {fido: {species: 'dog'}}});
183
+ * const persister = createTinyJoinPersister(store, tinyJoin, {
184
+ * mode: 'tabular',
185
+ * tables: {load: {pets: 'pets'}, save: {pets: 'pets'}},
186
+ * });
187
+ *
188
+ * await persister.save();
189
+ * console.log((await tinyJoin.query('SELECT * FROM pets')).rows);
190
+ * // -> [{_id: 'fido', species: '"dog"'}]
191
+ * // Note that Cells and Values are JSON-encoded, as they are in PostgreSQL.
192
+ *
193
+ * await tinyJoin.query('INSERT INTO pets (_id, species) VALUES ($1, $2)', [
194
+ * 'felix',
195
+ * '"cat"',
196
+ * ]);
197
+ * await persister.load();
198
+ * console.log(store.getTables());
199
+ * // -> {pets: {fido: {species: 'dog'}, felix: {species: 'cat'}}}
200
+ *
201
+ * await persister.destroy();
202
+ * await tinyJoin.close();
203
+ * ```
204
+ * @category Creation
205
+ * @essential Persisting stores
206
+ * @since 10.0.0
207
+ */
208
+ export function createTinyJoinPersister<Schemas extends OptionalSchemas>(
209
+ store: MergeableStore<Schemas>,
210
+ tinyJoin: Client,
211
+ configOrStoreTableName?: DpcJson | string,
212
+ onSqlCommand?: (sql: string, params?: any[]) => void,
213
+ onIgnoredError?: (error: any) => void,
214
+ ): TinyJoinPersister<Schemas>;
215
+ export function createTinyJoinPersister<Schemas extends OptionalSchemas>(
216
+ store: Store<Schemas> & {getMergeableContent?: never},
217
+ tinyJoin: Client,
218
+ configOrStoreTableName?: DatabasePersisterConfig<Schemas> | string,
219
+ onSqlCommand?: (sql: string, params?: any[]) => void,
220
+ onIgnoredError?: (error: any) => void,
221
+ ): TinyJoinPersister<Schemas>;
@@ -27,6 +27,7 @@
27
27
  * |ReactNativeSqlitePersister|SQLite in React Native, via [react-native-sqlite-storage](https://github.com/andpor/react-native-sqlite-storage)|Yes|Yes*
28
28
  * |PostgresPersister|PostgreSQL, via [postgres](https://github.com/porsager/postgres)|Yes|Yes*
29
29
  * |PglitePersister|PostgreSQL, via [PGlite](https://github.com/electric-sql/pglite)|Yes|Yes*
30
+ * |TinyJoinPersister|PostgreSQL-shaped SQL in a browser, via [TinyJoin](https://tinyjoin.org)|Yes|Yes*
30
31
  * |CrSqliteWasmPersister|SQLite CRDTs, via [cr-sqlite-wasm](https://github.com/vlcn-io/cr-sqlite)|Yes|No
31
32
  * |ElectricSqlPersister|Electric SQL, via [electric-sql](https://github.com/electric-sql/electric)|Yes|No
32
33
  * |LibSqlPersister|LibSQL for Turso, via [libsql-client](https://github.com/tursodatabase/libsql-client-ts)|Yes|No
@@ -3272,6 +3272,7 @@ export interface Queries {
3272
3272
  * with a reference to the Queries object.
3273
3273
  * @param listener The function that will be called whenever a Query
3274
3274
  * definition is added or removed.
3275
+ * @returns A unique Id for the listener that can later be used to remove it.
3275
3276
  * @example
3276
3277
  * This example creates a Store, a Queries object, and then registers a
3277
3278
  * listener that responds to the addition and the removal of a Query
@@ -3321,6 +3322,7 @@ export interface Queries {
3321
3322
  * @param queryId The Id of the query to listen to, or `null` as a wildcard.
3322
3323
  * @param listener The function that will be called whenever the param values
3323
3324
  * of the query change.
3325
+ * @returns A unique Id for the listener that can later be used to remove it.
3324
3326
  * @example
3325
3327
  * This example registers two listeners that respond to changes to the param
3326
3328
  * values of a specific query, or any query respectively.
@@ -3392,6 +3394,7 @@ export interface Queries {
3392
3394
  * @param paramId The Id of the param to listen to, or `null` as a wildcard.
3393
3395
  * @param listener The function that will be called whenever the specific
3394
3396
  * param value of the query changes.
3397
+ * @returns A unique Id for the listener that can later be used to remove it.
3395
3398
  * @example
3396
3399
  * This example registers two listeners that respond to changes to a specific
3397
3400
  * param value of a specific query, or any param value of any query
@@ -3582,6 +3582,7 @@ export interface Queries<in out Schemas extends OptionalSchemas> {
3582
3582
  * with a reference to the Queries object.
3583
3583
  * @param listener The function that will be called whenever a Query
3584
3584
  * definition is added or removed.
3585
+ * @returns A unique Id for the listener that can later be used to remove it.
3585
3586
  * @example
3586
3587
  * This example creates a Store, a Queries object, and then registers a
3587
3588
  * listener that responds to the addition and the removal of a Query
@@ -3637,6 +3638,7 @@ export interface Queries<in out Schemas extends OptionalSchemas> {
3637
3638
  * @param queryId The Id of the query to listen to, or `null` as a wildcard.
3638
3639
  * @param listener The function that will be called whenever the param values
3639
3640
  * of the query change.
3641
+ * @returns A unique Id for the listener that can later be used to remove it.
3640
3642
  * @example
3641
3643
  * This example registers two listeners that respond to changes to the param
3642
3644
  * values of a specific query, or any query respectively.
@@ -3721,6 +3723,7 @@ export interface Queries<in out Schemas extends OptionalSchemas> {
3721
3723
  * @param paramId The Id of the param to listen to, or `null` as a wildcard.
3722
3724
  * @param listener The function that will be called whenever the specific
3723
3725
  * param value of the query changes.
3726
+ * @returns A unique Id for the listener that can later be used to remove it.
3724
3727
  * @example
3725
3728
  * This example registers two listeners that respond to changes to a specific
3726
3729
  * param value of a specific query, or any param value of any query
@@ -755,6 +755,7 @@ export interface Relationships {
755
755
  * called with a reference to the Relationships object.
756
756
  * @param listener The function that will be called whenever a Relationship
757
757
  * definition is added or removed.
758
+ * @returns A unique Id for the listener that can later be used to remove it.
758
759
  * @example
759
760
  * This example creates a Store, a Relationships object, and then registers a
760
761
  * listener that responds to the addition and the removal of a Relationship
@@ -866,6 +866,7 @@ export interface Relationships<in out Schemas extends OptionalSchemas> {
866
866
  * called with a reference to the Relationships object.
867
867
  * @param listener The function that will be called whenever a Relationship
868
868
  * definition is added or removed.
869
+ * @returns A unique Id for the listener that can later be used to remove it.
869
870
  * @example
870
871
  * This example creates a Store, a Relationships object, and then registers a
871
872
  * listener that responds to the addition and the removal of a Relationship
@@ -739,6 +739,7 @@ export type ValueCallback = (valueId: Id, value: Value) => void;
739
739
  * new one, such as when incrementing a number. See that method for specific
740
740
  * examples.
741
741
  * @param cell The current value of the Cell to map to a new value.
742
+ * @returns The new value of the Cell.
742
743
  * @category Callback
743
744
  * @since v1.0.0
744
745
  */
@@ -752,6 +753,7 @@ export type MapCell = (cell: CellOrUndefined) => Cell;
752
753
  * a new one, such as when incrementing a number. See that method for specific
753
754
  * examples.
754
755
  * @param value The current Value to map to a new Value.
756
+ * @returns The new Value.
755
757
  * @category Callback
756
758
  * @since v3.0.0
757
759
  */
@@ -765,6 +767,7 @@ export type MapValue = (value: ValueOrUndefined) => Value;
765
767
  * setMetricDefinition method of a Metrics object, or the setIndexDefinition
766
768
  * method of an Indexes object. See those methods for specific examples.
767
769
  * @param cellId The Id of the Cell to fetch the value for.
770
+ * @returns The value of the Cell, or `undefined`.
768
771
  * @category Callback
769
772
  * @since v1.0.0
770
773
  */
@@ -871,6 +874,7 @@ export type ChangedValueIds = {[valueId: Id]: IdAddedOrRemoved};
871
874
  * can use the getTransactionChanges method and getTransactionLog method of the
872
875
  * Store directly to decide whether to do the rollback.
873
876
  * @param store A reference to the Store that is completing a transaction.
877
+ * @returns Whether to rollback the transaction.
874
878
  * @category Callback
875
879
  * @since v1.0.0
876
880
  */
@@ -1000,6 +1000,7 @@ export type ValueCallback<
1000
1000
  * new one, such as when incrementing a number. See that method for specific
1001
1001
  * examples.
1002
1002
  * @param cell The current value of the Cell to map to a new value.
1003
+ * @returns The new value of the Cell.
1003
1004
  * @category Callback
1004
1005
  * @since v1.0.0
1005
1006
  */
@@ -1025,6 +1026,7 @@ export type MapCell<
1025
1026
  * a new one, such as when incrementing a number. See that method for specific
1026
1027
  * examples.
1027
1028
  * @param value The current Value to map to a new Value.
1029
+ * @returns The new Value.
1028
1030
  * @category Callback
1029
1031
  * @since v3.0.0
1030
1032
  */
@@ -1047,6 +1049,7 @@ export type MapValue<
1047
1049
  * setMetricDefinition method of a Metrics object, or the setIndexDefinition
1048
1050
  * method of an Indexes object. See those methods for specific examples.
1049
1051
  * @param cellId The Id of the Cell to fetch the value for.
1052
+ * @returns The value of the Cell, or `undefined`.
1050
1053
  * @category Callback
1051
1054
  * @since v1.0.0
1052
1055
  */
@@ -1200,6 +1203,7 @@ export type ChangedValueIds<Schema extends OptionalValuesSchema> = {
1200
1203
  * can use the getTransactionChanges method and getTransactionLog method of the
1201
1204
  * Store directly to decide whether to do the rollback.
1202
1205
  * @param store A reference to the Store that is completing a transaction.
1206
+ * @returns Whether to rollback the transaction.
1203
1207
  * @category Callback
1204
1208
  * @since v1.0.0
1205
1209
  */
@@ -288,6 +288,7 @@ export type UndoOrRedoInformation = [boolean, Callback, Id | undefined, string];
288
288
  * useSetTableCallback hook or useSetRowCallback hook - so that the Id arguments
289
289
  * of the object to set can also be dependent on the event or parameter provided
290
290
  * (as well as the object itself being set).
291
+ * @returns The Id, determined from the parameter and Store.
291
292
  * @category Identity
292
293
  * @since v1.0.0
293
294
  */
@@ -392,6 +393,7 @@ export function useCreateStore(
392
393
 
393
394
  /**
394
395
  * The useCreateMergeableStore hook.
396
+ * @returns A reference to the MergeableStore.
395
397
  * @category Store hooks
396
398
  * @since v1.0.0
397
399
  */
@@ -491,6 +491,7 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
491
491
 
492
492
  /**
493
493
  * The useCreateMergeableStore hook.
494
+ * @returns A reference to the MergeableStore.
494
495
  * @category Store hooks
495
496
  * @since v1.0.0
496
497
  */
@@ -489,6 +489,7 @@ export type YAxisProps = {
489
489
  * The series children declare their own xCellId and yCellId bindings. The
490
490
  * optional XAxis component and YAxis component children can be used to
491
491
  * configure axis titles, bounds, ticks, and tick formatting.
492
+ * @returns A rendering of the chart frame and its series.
492
493
  * @category Store components
493
494
  * @since v8.5.0
494
495
  * @example
@@ -544,6 +545,7 @@ export function CartesianChart(
544
545
  *
545
546
  * ![XAxis component example](https://beta.tinybase.org/shots/axis-overrides-react-demo.png
546
547
  * "XAxis component example")
548
+ * @returns Nothing, since this component only configures the x axis.
547
549
  * @category Store components
548
550
  * @since v8.5.0
549
551
  */
@@ -560,6 +562,7 @@ export function XAxis(props: XAxisProps): ComponentReturnType;
560
562
  *
561
563
  * ![YAxis component example](https://beta.tinybase.org/shots/axis-overrides-react-demo.png
562
564
  * "YAxis component example")
565
+ * @returns Nothing, since this component only configures the y axis.
563
566
  * @category Store components
564
567
  * @since v8.5.0
565
568
  */
@@ -576,6 +579,7 @@ export function YAxis(props: YAxisProps): ComponentReturnType;
576
579
  *
577
580
  * ![LineSeries component example](https://beta.tinybase.org/shots/composing-charts-react-demo.png
578
581
  * "LineSeries component example")
582
+ * @returns A rendering of the line series.
579
583
  * @category Store components
580
584
  * @since v8.5.0
581
585
  */
@@ -592,6 +596,7 @@ export function LineSeries(props: SeriesProps): ComponentReturnType;
592
596
  *
593
597
  * ![BarSeries component example](https://beta.tinybase.org/shots/composing-charts-react-demo.png
594
598
  * "BarSeries component example")
599
+ * @returns A rendering of the bar series.
595
600
  * @category Store components
596
601
  * @since v8.5.0
597
602
  */
@@ -609,6 +614,7 @@ export function BarSeries(props: SeriesProps): ComponentReturnType;
609
614
  *
610
615
  * ![LineChart component example](https://beta.tinybase.org/shots/basic-chart-react-demo.png "LineChart
611
616
  * component example")
617
+ * @returns A rendering of the line chart.
612
618
  * @category Store components
613
619
  * @since v8.5.0
614
620
  * @example
@@ -662,6 +668,7 @@ export function LineChart(
662
668
  *
663
669
  * ![BarChart component example](https://beta.tinybase.org/shots/sorting-and-types-react-demo.png
664
670
  * "BarChart component example")
671
+ * @returns A rendering of the bar chart.
665
672
  * @category Store components
666
673
  * @since v8.5.0
667
674
  * @example
@@ -550,6 +550,7 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
550
550
  * The series children declare their own xCellId and yCellId bindings. The
551
551
  * optional XAxis component and YAxis component children can be used to
552
552
  * configure axis titles, bounds, ticks, and tick formatting.
553
+ * @returns A rendering of the chart frame and its series.
553
554
  * @category Store components
554
555
  * @since v8.5.0
555
556
  * @example
@@ -611,6 +612,7 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
611
612
  *
612
613
  * ![XAxis component example](https://beta.tinybase.org/shots/axis-overrides-react-demo.png
613
614
  * "XAxis component example")
615
+ * @returns Nothing, since this component only configures the x axis.
614
616
  * @category Store components
615
617
  * @since v8.5.0
616
618
  */
@@ -627,6 +629,7 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
627
629
  *
628
630
  * ![YAxis component example](https://beta.tinybase.org/shots/axis-overrides-react-demo.png
629
631
  * "YAxis component example")
632
+ * @returns Nothing, since this component only configures the y axis.
630
633
  * @category Store components
631
634
  * @since v8.5.0
632
635
  */
@@ -643,6 +646,7 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
643
646
  *
644
647
  * ![LineSeries component example](https://beta.tinybase.org/shots/composing-charts-react-demo.png
645
648
  * "LineSeries component example")
649
+ * @returns A rendering of the line series.
646
650
  * @category Store components
647
651
  * @since v8.5.0
648
652
  */
@@ -659,6 +663,7 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
659
663
  *
660
664
  * ![BarSeries component example](https://beta.tinybase.org/shots/composing-charts-react-demo.png
661
665
  * "BarSeries component example")
666
+ * @returns A rendering of the bar series.
662
667
  * @category Store components
663
668
  * @since v8.5.0
664
669
  */
@@ -686,6 +691,7 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
686
691
  *
687
692
  * ![LineChart component example](https://beta.tinybase.org/shots/basic-chart-react-demo.png "LineChart
688
693
  * component example")
694
+ * @returns A rendering of the line chart.
689
695
  * @category Store components
690
696
  * @since v8.5.0
691
697
  * @example
@@ -752,6 +758,7 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
752
758
  *
753
759
  * ![BarChart component example](https://beta.tinybase.org/shots/sorting-and-types-react-demo.png
754
760
  * "BarChart component example")
761
+ * @returns A rendering of the bar chart.
755
762
  * @category Store components
756
763
  * @since v8.5.0
757
764
  * @example
@@ -315,6 +315,7 @@ export type UndoOrRedoInformation = [
315
315
  * useSetTableCallback primitive or useSetRowCallback primitive - so that the Id
316
316
  * arguments of the object to set can also be dependent on the event or
317
317
  * parameter provided (as well as the object itself being set).
318
+ * @returns The Id, determined from the parameter and Store.
318
319
  * @category Identity
319
320
  * @since v8.3.0
320
321
  */
@@ -357,6 +358,7 @@ export function useCreateStore(create: () => Store): Accessor<Store>;
357
358
 
358
359
  /**
359
360
  * The useCreateMergeableStore primitive.
361
+ * @returns A reference to the MergeableStore.
360
362
  * @category Store primitives
361
363
  * @since v8.3.0
362
364
  */
@@ -449,6 +449,7 @@ export type WithSchemas<Schemas extends OptionalSchemas> = {
449
449
 
450
450
  /**
451
451
  * The useCreateMergeableStore primitive.
452
+ * @returns A reference to the MergeableStore.
452
453
  * @category Store primitives
453
454
  * @since v8.3.0
454
455
  */