tinybase 5.0.0-beta.27 → 5.0.0-beta.28
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.
- package/@types/_internal/ui-react/with-schemas/index.d.cts +274 -0
- package/@types/_internal/ui-react/with-schemas/index.d.ts +274 -0
- package/@types/checkpoints/index.d.cts +30 -1
- package/@types/checkpoints/index.d.ts +30 -1
- package/@types/checkpoints/with-schemas/index.d.cts +30 -1
- package/@types/checkpoints/with-schemas/index.d.ts +30 -1
- package/@types/common/index.d.cts +9 -0
- package/@types/common/index.d.ts +9 -0
- package/@types/common/with-schemas/index.d.cts +9 -0
- package/@types/common/with-schemas/index.d.ts +9 -0
- package/@types/index.d.cts +1 -0
- package/@types/index.d.ts +1 -0
- package/@types/indexes/index.d.cts +32 -1
- package/@types/indexes/index.d.ts +32 -1
- package/@types/indexes/with-schemas/index.d.cts +32 -1
- package/@types/indexes/with-schemas/index.d.ts +32 -1
- package/@types/mergeable-store/index.d.cts +0 -2
- package/@types/mergeable-store/index.d.ts +0 -2
- package/@types/mergeable-store/with-schemas/index.d.cts +2 -2
- package/@types/mergeable-store/with-schemas/index.d.ts +2 -2
- package/@types/metrics/index.d.cts +30 -4
- package/@types/metrics/index.d.ts +30 -4
- package/@types/metrics/with-schemas/index.d.cts +30 -4
- package/@types/metrics/with-schemas/index.d.ts +30 -4
- package/@types/persisters/index.d.cts +87 -25
- package/@types/persisters/index.d.ts +87 -25
- package/@types/persisters/persister-automerge/index.d.cts +4 -4
- package/@types/persisters/persister-automerge/index.d.ts +4 -4
- package/@types/persisters/persister-automerge/with-schemas/index.d.cts +4 -4
- package/@types/persisters/persister-automerge/with-schemas/index.d.ts +4 -4
- package/@types/persisters/persister-browser/index.d.cts +7 -4
- package/@types/persisters/persister-browser/index.d.ts +7 -4
- package/@types/persisters/persister-browser/with-schemas/index.d.cts +7 -4
- package/@types/persisters/persister-browser/with-schemas/index.d.ts +7 -4
- package/@types/persisters/persister-cr-sqlite-wasm/index.d.cts +4 -4
- package/@types/persisters/persister-cr-sqlite-wasm/index.d.ts +4 -4
- package/@types/persisters/persister-cr-sqlite-wasm/with-schemas/index.d.cts +4 -4
- package/@types/persisters/persister-cr-sqlite-wasm/with-schemas/index.d.ts +4 -4
- package/@types/persisters/persister-electric-sql/index.d.cts +4 -4
- package/@types/persisters/persister-electric-sql/index.d.ts +4 -4
- package/@types/persisters/persister-electric-sql/with-schemas/index.d.cts +4 -4
- package/@types/persisters/persister-electric-sql/with-schemas/index.d.ts +4 -4
- package/@types/persisters/persister-expo-sqlite/index.d.cts +4 -4
- package/@types/persisters/persister-expo-sqlite/index.d.ts +4 -4
- package/@types/persisters/persister-expo-sqlite/with-schemas/index.d.cts +4 -4
- package/@types/persisters/persister-expo-sqlite/with-schemas/index.d.ts +4 -4
- package/@types/persisters/persister-file/index.d.cts +6 -4
- package/@types/persisters/persister-file/index.d.ts +6 -4
- package/@types/persisters/persister-file/with-schemas/index.d.cts +6 -4
- package/@types/persisters/persister-file/with-schemas/index.d.ts +6 -4
- package/@types/persisters/persister-indexed-db/index.d.cts +5 -4
- package/@types/persisters/persister-indexed-db/index.d.ts +5 -4
- package/@types/persisters/persister-indexed-db/with-schemas/index.d.cts +5 -4
- package/@types/persisters/persister-indexed-db/with-schemas/index.d.ts +5 -4
- package/@types/persisters/persister-libsql/index.d.cts +5 -4
- package/@types/persisters/persister-libsql/index.d.ts +5 -4
- package/@types/persisters/persister-libsql/with-schemas/index.d.cts +5 -4
- package/@types/persisters/persister-libsql/with-schemas/index.d.ts +5 -4
- package/@types/persisters/persister-partykit-client/index.d.cts +12 -6
- package/@types/persisters/persister-partykit-client/index.d.ts +12 -6
- package/@types/persisters/persister-partykit-client/with-schemas/index.d.cts +12 -6
- package/@types/persisters/persister-partykit-client/with-schemas/index.d.ts +12 -6
- package/@types/persisters/persister-partykit-server/index.d.cts +11 -3
- package/@types/persisters/persister-partykit-server/index.d.ts +11 -3
- package/@types/persisters/persister-partykit-server/with-schemas/index.d.cts +11 -3
- package/@types/persisters/persister-partykit-server/with-schemas/index.d.ts +11 -3
- package/@types/persisters/persister-powersync/index.d.cts +5 -4
- package/@types/persisters/persister-powersync/index.d.ts +5 -4
- package/@types/persisters/persister-powersync/with-schemas/index.d.cts +5 -4
- package/@types/persisters/persister-powersync/with-schemas/index.d.ts +5 -4
- package/@types/persisters/persister-remote/index.d.cts +6 -4
- package/@types/persisters/persister-remote/index.d.ts +6 -4
- package/@types/persisters/persister-remote/with-schemas/index.d.cts +6 -4
- package/@types/persisters/persister-remote/with-schemas/index.d.ts +6 -4
- package/@types/persisters/persister-sqlite-wasm/index.d.cts +4 -4
- package/@types/persisters/persister-sqlite-wasm/index.d.ts +4 -4
- package/@types/persisters/persister-sqlite-wasm/with-schemas/index.d.cts +4 -4
- package/@types/persisters/persister-sqlite-wasm/with-schemas/index.d.ts +4 -4
- package/@types/persisters/persister-sqlite3/index.d.cts +4 -4
- package/@types/persisters/persister-sqlite3/index.d.ts +4 -4
- package/@types/persisters/persister-sqlite3/with-schemas/index.d.cts +4 -4
- package/@types/persisters/persister-sqlite3/with-schemas/index.d.ts +4 -4
- package/@types/persisters/persister-yjs/index.d.cts +4 -4
- package/@types/persisters/persister-yjs/index.d.ts +4 -4
- package/@types/persisters/persister-yjs/with-schemas/index.d.cts +4 -4
- package/@types/persisters/persister-yjs/with-schemas/index.d.ts +4 -4
- package/@types/persisters/with-schemas/index.d.cts +87 -25
- package/@types/persisters/with-schemas/index.d.ts +87 -25
- package/@types/queries/index.d.cts +64 -4
- package/@types/queries/index.d.ts +64 -4
- package/@types/queries/with-schemas/index.d.cts +64 -4
- package/@types/queries/with-schemas/index.d.ts +64 -4
- package/@types/relationships/index.d.cts +34 -1
- package/@types/relationships/index.d.ts +34 -1
- package/@types/relationships/with-schemas/index.d.cts +34 -1
- package/@types/relationships/with-schemas/index.d.ts +34 -1
- package/@types/store/index.d.cts +125 -0
- package/@types/store/index.d.ts +125 -0
- package/@types/store/with-schemas/index.d.cts +125 -0
- package/@types/store/with-schemas/index.d.ts +125 -0
- package/@types/synchronizers/index.d.cts +32 -10
- package/@types/synchronizers/index.d.ts +32 -10
- package/@types/synchronizers/synchronizer-broadcast-channel/index.d.cts +114 -0
- package/@types/synchronizers/synchronizer-broadcast-channel/index.d.ts +114 -0
- package/@types/synchronizers/synchronizer-broadcast-channel/with-schemas/index.d.cts +128 -0
- package/@types/synchronizers/synchronizer-broadcast-channel/with-schemas/index.d.ts +128 -0
- package/@types/synchronizers/synchronizer-local/index.d.cts +16 -17
- package/@types/synchronizers/synchronizer-local/index.d.ts +16 -17
- package/@types/synchronizers/synchronizer-local/with-schemas/index.d.cts +16 -17
- package/@types/synchronizers/synchronizer-local/with-schemas/index.d.ts +16 -17
- package/@types/synchronizers/synchronizer-ws-client/index.d.cts +66 -6
- package/@types/synchronizers/synchronizer-ws-client/index.d.ts +66 -6
- package/@types/synchronizers/synchronizer-ws-client/with-schemas/index.d.cts +77 -6
- package/@types/synchronizers/synchronizer-ws-client/with-schemas/index.d.ts +77 -6
- package/@types/synchronizers/synchronizer-ws-server/index.d.cts +486 -7
- package/@types/synchronizers/synchronizer-ws-server/index.d.ts +486 -7
- package/@types/synchronizers/synchronizer-ws-server/with-schemas/index.d.cts +486 -7
- package/@types/synchronizers/synchronizer-ws-server/with-schemas/index.d.ts +486 -7
- package/@types/synchronizers/with-schemas/index.d.cts +29 -11
- package/@types/synchronizers/with-schemas/index.d.ts +29 -11
- package/@types/tools/index.d.cts +22 -0
- package/@types/tools/index.d.ts +22 -0
- package/@types/tools/with-schemas/index.d.cts +22 -0
- package/@types/tools/with-schemas/index.d.ts +22 -0
- package/@types/ui-react/index.d.cts +375 -1
- package/@types/ui-react/index.d.ts +375 -1
- package/@types/ui-react/with-schemas/index.d.cts +100 -1
- package/@types/ui-react/with-schemas/index.d.ts +100 -1
- package/@types/ui-react-dom/index.d.cts +112 -0
- package/@types/ui-react-dom/index.d.ts +112 -0
- package/@types/ui-react-dom/with-schemas/index.d.cts +112 -0
- package/@types/ui-react-dom/with-schemas/index.d.ts +112 -0
- package/@types/ui-react-inspector/index.d.cts +6 -2
- package/@types/ui-react-inspector/index.d.ts +6 -2
- package/@types/ui-react-inspector/with-schemas/index.d.cts +118 -2
- package/@types/ui-react-inspector/with-schemas/index.d.ts +118 -2
- package/@types/with-schemas/index.d.cts +1 -0
- package/@types/with-schemas/index.d.ts +1 -0
- package/cjs/es6/index.cjs +2 -2
- package/cjs/es6/min/synchronizers/synchronizer-broadcast-channel/index.cjs +1 -0
- package/cjs/es6/min/synchronizers/synchronizer-broadcast-channel/index.cjs.gz +0 -0
- package/cjs/es6/min/synchronizers/synchronizer-broadcast-channel/with-schemas/index.cjs +1 -0
- package/cjs/es6/min/synchronizers/synchronizer-broadcast-channel/with-schemas/index.cjs.gz +0 -0
- package/cjs/es6/min/synchronizers/synchronizer-ws-client/index.cjs +1 -1
- package/cjs/es6/min/synchronizers/synchronizer-ws-client/index.cjs.gz +0 -0
- package/cjs/es6/min/synchronizers/synchronizer-ws-client/with-schemas/index.cjs +1 -1
- package/cjs/es6/min/synchronizers/synchronizer-ws-client/with-schemas/index.cjs.gz +0 -0
- package/cjs/es6/synchronizers/index.cjs +2 -2
- package/cjs/es6/synchronizers/synchronizer-broadcast-channel/index.cjs +628 -0
- package/cjs/es6/synchronizers/synchronizer-broadcast-channel/with-schemas/index.cjs +628 -0
- package/cjs/es6/synchronizers/synchronizer-local/index.cjs +4 -4
- package/cjs/es6/synchronizers/synchronizer-local/with-schemas/index.cjs +4 -4
- package/cjs/es6/synchronizers/synchronizer-ws-client/index.cjs +15 -21
- package/cjs/es6/synchronizers/synchronizer-ws-client/with-schemas/index.cjs +15 -21
- package/cjs/es6/synchronizers/with-schemas/index.cjs +2 -2
- package/cjs/es6/with-schemas/index.cjs +2 -2
- package/cjs/index.cjs +2 -2
- package/cjs/min/synchronizers/synchronizer-broadcast-channel/index.cjs +1 -0
- package/cjs/min/synchronizers/synchronizer-broadcast-channel/index.cjs.gz +0 -0
- package/cjs/min/synchronizers/synchronizer-broadcast-channel/with-schemas/index.cjs +1 -0
- package/cjs/min/synchronizers/synchronizer-broadcast-channel/with-schemas/index.cjs.gz +0 -0
- package/cjs/min/synchronizers/synchronizer-ws-client/index.cjs +1 -1
- package/cjs/min/synchronizers/synchronizer-ws-client/index.cjs.gz +0 -0
- package/cjs/min/synchronizers/synchronizer-ws-client/with-schemas/index.cjs +1 -1
- package/cjs/min/synchronizers/synchronizer-ws-client/with-schemas/index.cjs.gz +0 -0
- package/cjs/synchronizers/index.cjs +2 -2
- package/cjs/synchronizers/synchronizer-broadcast-channel/index.cjs +500 -0
- package/cjs/synchronizers/synchronizer-broadcast-channel/with-schemas/index.cjs +500 -0
- package/cjs/synchronizers/synchronizer-local/index.cjs +4 -4
- package/cjs/synchronizers/synchronizer-local/with-schemas/index.cjs +4 -4
- package/cjs/synchronizers/synchronizer-ws-client/index.cjs +15 -21
- package/cjs/synchronizers/synchronizer-ws-client/with-schemas/index.cjs +15 -21
- package/cjs/synchronizers/with-schemas/index.cjs +2 -2
- package/cjs/with-schemas/index.cjs +2 -2
- package/es6/index.js +2 -2
- package/es6/min/synchronizers/synchronizer-broadcast-channel/index.js +1 -0
- package/es6/min/synchronizers/synchronizer-broadcast-channel/index.js.gz +0 -0
- package/es6/min/synchronizers/synchronizer-broadcast-channel/with-schemas/index.js +1 -0
- package/es6/min/synchronizers/synchronizer-broadcast-channel/with-schemas/index.js.gz +0 -0
- package/es6/min/synchronizers/synchronizer-ws-client/index.js +1 -1
- package/es6/min/synchronizers/synchronizer-ws-client/index.js.gz +0 -0
- package/es6/min/synchronizers/synchronizer-ws-client/with-schemas/index.js +1 -1
- package/es6/min/synchronizers/synchronizer-ws-client/with-schemas/index.js.gz +0 -0
- package/es6/synchronizers/index.js +2 -2
- package/es6/synchronizers/synchronizer-broadcast-channel/index.js +626 -0
- package/es6/synchronizers/synchronizer-broadcast-channel/with-schemas/index.js +626 -0
- package/es6/synchronizers/synchronizer-local/index.js +4 -4
- package/es6/synchronizers/synchronizer-local/with-schemas/index.js +4 -4
- package/es6/synchronizers/synchronizer-ws-client/index.js +15 -21
- package/es6/synchronizers/synchronizer-ws-client/with-schemas/index.js +15 -21
- package/es6/synchronizers/with-schemas/index.js +2 -2
- package/es6/with-schemas/index.js +2 -2
- package/index.js +2 -2
- package/min/synchronizers/synchronizer-broadcast-channel/index.js +1 -0
- package/min/synchronizers/synchronizer-broadcast-channel/index.js.gz +0 -0
- package/min/synchronizers/synchronizer-broadcast-channel/with-schemas/index.js +1 -0
- package/min/synchronizers/synchronizer-broadcast-channel/with-schemas/index.js.gz +0 -0
- package/min/synchronizers/synchronizer-ws-client/index.js +1 -1
- package/min/synchronizers/synchronizer-ws-client/index.js.gz +0 -0
- package/min/synchronizers/synchronizer-ws-client/with-schemas/index.js +1 -1
- package/min/synchronizers/synchronizer-ws-client/with-schemas/index.js.gz +0 -0
- package/package.json +105 -1
- package/readme.md +9 -9
- package/releases.md +4 -4
- package/synchronizers/index.js +2 -2
- package/synchronizers/synchronizer-broadcast-channel/index.js +498 -0
- package/synchronizers/synchronizer-broadcast-channel/with-schemas/index.js +498 -0
- package/synchronizers/synchronizer-local/index.js +4 -4
- package/synchronizers/synchronizer-local/with-schemas/index.js +4 -4
- package/synchronizers/synchronizer-ws-client/index.js +15 -21
- package/synchronizers/synchronizer-ws-client/with-schemas/index.js +15 -21
- package/synchronizers/with-schemas/index.js +2 -2
- package/umd/es6/index.js +2 -2
- package/umd/es6/min/synchronizers/synchronizer-broadcast-channel/index.js +1 -0
- package/umd/es6/min/synchronizers/synchronizer-broadcast-channel/index.js.gz +0 -0
- package/umd/es6/min/synchronizers/synchronizer-broadcast-channel/with-schemas/index.js +1 -0
- package/umd/es6/min/synchronizers/synchronizer-broadcast-channel/with-schemas/index.js.gz +0 -0
- package/umd/es6/min/synchronizers/synchronizer-ws-client/index.js +1 -1
- package/umd/es6/min/synchronizers/synchronizer-ws-client/index.js.gz +0 -0
- package/umd/es6/min/synchronizers/synchronizer-ws-client/with-schemas/index.js +1 -1
- package/umd/es6/min/synchronizers/synchronizer-ws-client/with-schemas/index.js.gz +0 -0
- package/umd/es6/synchronizers/index.js +2 -2
- package/umd/es6/synchronizers/synchronizer-broadcast-channel/index.js +654 -0
- package/umd/es6/synchronizers/synchronizer-broadcast-channel/with-schemas/index.js +654 -0
- package/umd/es6/synchronizers/synchronizer-local/index.js +4 -4
- package/umd/es6/synchronizers/synchronizer-local/with-schemas/index.js +4 -4
- package/umd/es6/synchronizers/synchronizer-ws-client/index.js +15 -21
- package/umd/es6/synchronizers/synchronizer-ws-client/with-schemas/index.js +15 -21
- package/umd/es6/synchronizers/with-schemas/index.js +2 -2
- package/umd/es6/with-schemas/index.js +2 -2
- package/umd/index.js +2 -2
- package/umd/min/synchronizers/synchronizer-broadcast-channel/index.js +1 -0
- package/umd/min/synchronizers/synchronizer-broadcast-channel/index.js.gz +0 -0
- package/umd/min/synchronizers/synchronizer-broadcast-channel/with-schemas/index.js +1 -0
- package/umd/min/synchronizers/synchronizer-broadcast-channel/with-schemas/index.js.gz +0 -0
- package/umd/min/synchronizers/synchronizer-ws-client/index.js +1 -1
- package/umd/min/synchronizers/synchronizer-ws-client/index.js.gz +0 -0
- package/umd/min/synchronizers/synchronizer-ws-client/with-schemas/index.js +1 -1
- package/umd/min/synchronizers/synchronizer-ws-client/with-schemas/index.js.gz +0 -0
- package/umd/synchronizers/index.js +2 -2
- package/umd/synchronizers/synchronizer-broadcast-channel/index.js +516 -0
- package/umd/synchronizers/synchronizer-broadcast-channel/with-schemas/index.js +516 -0
- package/umd/synchronizers/synchronizer-local/index.js +4 -4
- package/umd/synchronizers/synchronizer-local/with-schemas/index.js +4 -4
- package/umd/synchronizers/synchronizer-ws-client/index.js +15 -21
- package/umd/synchronizers/synchronizer-ws-client/with-schemas/index.js +15 -21
- package/umd/synchronizers/with-schemas/index.js +2 -2
- package/umd/with-schemas/index.js +2 -2
- package/with-schemas/index.js +2 -2
|
@@ -3,28 +3,29 @@
|
|
|
3
3
|
* saving and loading Store and MergeableStore data, to and from different
|
|
4
4
|
* destinations, or underlying storage types.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
* which returns
|
|
8
|
-
* them, these allow you to store your TinyBase data locally, remotely,
|
|
9
|
-
* SQLite databases, and across synchronization boundaries with CRDT
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* |
|
|
15
|
-
* |
|
|
16
|
-
* |
|
|
17
|
-
* |
|
|
18
|
-
* |
|
|
19
|
-
* |
|
|
20
|
-
* |
|
|
21
|
-
* |
|
|
22
|
-
* |
|
|
23
|
-
* |
|
|
24
|
-
* |
|
|
25
|
-
* |
|
|
26
|
-
* |
|
|
27
|
-
* |
|
|
6
|
+
* Many entry points are provided (in separately installed modules), each of
|
|
7
|
+
* which returns different types of Persister that can load and save a Store.
|
|
8
|
+
* Between them, these allow you to store your TinyBase data locally, remotely,
|
|
9
|
+
* to SQLite databases, and across synchronization boundaries with CRDT
|
|
10
|
+
* frameworks.
|
|
11
|
+
*
|
|
12
|
+
* |Persister|Storage|Store|MergeableStore
|
|
13
|
+
* |-|-|-|-|
|
|
14
|
+
* |SessionPersister|Browser session storage|Yes|Yes
|
|
15
|
+
* |LocalPersister|Browser local storage|Yes|Yes
|
|
16
|
+
* |FilePersister|Local file (where possible)|Yes|Yes
|
|
17
|
+
* |IndexedDbPersister|Browser IndexedDB|Yes|No
|
|
18
|
+
* |RemotePersister|Remote server|Yes|No
|
|
19
|
+
* |Sqlite3Persister|SQLite in Node, via [sqlite3](https://github.com/TryGhost/node-sqlite3)|Yes|Yes*
|
|
20
|
+
* |SqliteWasmPersister|SQLite in a browser, via [sqlite-wasm](https://github.com/tomayac/sqlite-wasm)|Yes|Yes*
|
|
21
|
+
* |ExpoSqlitePersister|SQLite in React Native, via [expo-sqlite](https://github.com/expo/expo/tree/main/packages/expo-sqlite)|Yes|Yes*
|
|
22
|
+
* |CrSqliteWasmPersister|SQLite CRDTs, via [cr-sqlite-wasm](https://github.com/vlcn-io/cr-sqlite)|Yes|No
|
|
23
|
+
* |ElectricSqlPersister|Electric SQL, via [electric-sql](https://github.com/electric-sql/electric)|Yes|No
|
|
24
|
+
* |LibSqlPersister|LibSQL for Turso, via [libsql-client](https://github.com/tursodatabase/libsql-client-ts)|Yes|No
|
|
25
|
+
* |PowerSyncPersister|PowerSync, via [powersync-sdk](https://github.com/powersync-ja/powersync-js)|Yes|No
|
|
26
|
+
* |YjsPersister|Yjs CRDTs, via [yjs](https://github.com/yjs/yjs)|Yes|No
|
|
27
|
+
* |SqliteWasmPersister|Automerge CRDTs, via [automerge-repo](https://github.com/automerge/automerge-repo)|Yes|No
|
|
28
|
+
* |PartyKitPersister|[PartyKit](https://www.partykit.io/), via the persister-partykit-server module|Yes|No|
|
|
28
29
|
*
|
|
29
30
|
* (*) Note that SQLite-based Persisters can currently only persist
|
|
30
31
|
* MergeableStore data when using the JSON-based DpcJson mode, and not in a
|
|
@@ -33,14 +34,13 @@
|
|
|
33
34
|
* Since persistence requirements can be different for every app, the
|
|
34
35
|
* createCustomPersister function in this module can also be used to easily
|
|
35
36
|
* create a fully customized way to save and load Store data.
|
|
36
|
-
* @see
|
|
37
|
-
* @see Database Persistence guide
|
|
38
|
-
* @see Synchronizing Data guide
|
|
37
|
+
* @see Persistence guides
|
|
39
38
|
* @see Countries demo
|
|
40
39
|
* @see Todo App demos
|
|
41
40
|
* @see Drawing demo
|
|
42
41
|
* @packageDocumentation
|
|
43
42
|
* @module persisters
|
|
43
|
+
* @since v1.0.0
|
|
44
44
|
*/
|
|
45
45
|
|
|
46
46
|
import type {
|
|
@@ -73,15 +73,21 @@ import type {TableIdFromSchema} from '../../_internal/store/with-schemas/index.d
|
|
|
73
73
|
export const enum Persists {
|
|
74
74
|
/**
|
|
75
75
|
* Indicates that only a regular Store can be supported by a Persister.
|
|
76
|
+
* @category Enum
|
|
77
|
+
* @since v5.0.0
|
|
76
78
|
*/
|
|
77
79
|
StoreOnly = 1,
|
|
78
80
|
/**
|
|
79
81
|
* Indicates that only a MergeableStore can be supported by a Persister.
|
|
82
|
+
* @category Enum
|
|
83
|
+
* @since v5.0.0
|
|
80
84
|
*/
|
|
81
85
|
MergeableStoreOnly = 2,
|
|
82
86
|
/**
|
|
83
87
|
* Indicates that either a regular Store or a MergeableStore can be supported
|
|
84
88
|
* by a Persister.
|
|
89
|
+
* @category Enum
|
|
90
|
+
* @since v5.0.0
|
|
85
91
|
*/
|
|
86
92
|
StoreOrMergeableStore = 3,
|
|
87
93
|
}
|
|
@@ -229,14 +235,19 @@ export type PersisterListener<
|
|
|
229
235
|
*
|
|
230
236
|
* A PersisterStats object is returned from the getStats method.
|
|
231
237
|
* @category Development
|
|
238
|
+
* @since v1.0.0
|
|
232
239
|
*/
|
|
233
240
|
export type PersisterStats = {
|
|
234
241
|
/**
|
|
235
242
|
* The number of times data has been loaded.
|
|
243
|
+
* @category Stat
|
|
244
|
+
* @since v1.0.0
|
|
236
245
|
*/
|
|
237
246
|
loads: number;
|
|
238
247
|
/**
|
|
239
248
|
* The number of times data has been saved.
|
|
249
|
+
* @category Stat
|
|
250
|
+
* @since v1.0.0
|
|
240
251
|
*/
|
|
241
252
|
saves: number;
|
|
242
253
|
};
|
|
@@ -356,27 +367,37 @@ export type DpcJson = {
|
|
|
356
367
|
* The mode to be used for persisting the Store to the database, in this case
|
|
357
368
|
* JSON serialization. See the DpcTabular type for the alternative tabular
|
|
358
369
|
* mapping mode.
|
|
370
|
+
* @category Configuration
|
|
371
|
+
* @since v4.0.0
|
|
359
372
|
*/
|
|
360
373
|
mode: 'json';
|
|
361
374
|
/**
|
|
362
375
|
* An optional string which indicates the name of a table in the database
|
|
363
376
|
* which will be used to serialize the Store content into. It defaults to
|
|
364
377
|
* `tinybase`.
|
|
378
|
+
* @category Configuration
|
|
379
|
+
* @since v4.0.0
|
|
365
380
|
*/
|
|
366
381
|
storeTableName?: string;
|
|
367
382
|
/**
|
|
368
383
|
* The optional name of the column in the database table that will be used as
|
|
369
384
|
* the Id for the Store, defaulting to '_id', since v5.0.
|
|
385
|
+
* @category Configuration
|
|
386
|
+
* @since v4.0.0
|
|
370
387
|
*/
|
|
371
388
|
storeIdColumnName?: string;
|
|
372
389
|
/**
|
|
373
390
|
* The optional name of the column in the database table that will be used for
|
|
374
391
|
* the JSON of the Store, defaulting to 'store', since v5.0.
|
|
392
|
+
* @category Configuration
|
|
393
|
+
* @since v4.0.0
|
|
375
394
|
*/
|
|
376
395
|
storeColumnName?: string;
|
|
377
396
|
/**
|
|
378
397
|
* How often the Persister should poll the database for any changes made to it
|
|
379
398
|
* by other clients, defaulting to 1 second.
|
|
399
|
+
* @category Configuration
|
|
400
|
+
* @since v4.0.0
|
|
380
401
|
*/
|
|
381
402
|
autoLoadIntervalSeconds?: number;
|
|
382
403
|
};
|
|
@@ -452,30 +473,42 @@ export type DpcTabular<Schema extends OptionalTablesSchema> = {
|
|
|
452
473
|
* The mode to be used for persisting the Store to the database, in this case
|
|
453
474
|
* tabular mapping. See the DpcJson type for the alternative JSON
|
|
454
475
|
* serialization mode.
|
|
476
|
+
* @category Configuration
|
|
477
|
+
* @since v4.0.0
|
|
455
478
|
*/
|
|
456
479
|
mode: 'tabular';
|
|
457
480
|
/**
|
|
458
481
|
* The settings for how the Store Tables are mapped to and from the database.
|
|
482
|
+
* @category Configuration
|
|
483
|
+
* @since v4.0.0
|
|
459
484
|
*/
|
|
460
485
|
tables?: {
|
|
461
486
|
/**
|
|
462
487
|
* The settings for how the database tables are mapped into the Store Tables
|
|
463
488
|
* when loading.
|
|
489
|
+
* @category Configuration
|
|
490
|
+
* @since v4.0.0
|
|
464
491
|
*/
|
|
465
492
|
load?: DpcTabularLoad<Schema>;
|
|
466
493
|
/**
|
|
467
494
|
* The settings for how the Store Tables are mapped out to the database
|
|
468
495
|
* tables when saving.
|
|
496
|
+
* @category Configuration
|
|
497
|
+
* @since v4.0.0
|
|
469
498
|
*/
|
|
470
499
|
save?: DpcTabularSave<Schema>;
|
|
471
500
|
};
|
|
472
501
|
/**
|
|
473
502
|
* The settings for how the Store Values are mapped to and from the database.
|
|
503
|
+
* @category Configuration
|
|
504
|
+
* @since v4.0.0
|
|
474
505
|
*/
|
|
475
506
|
values?: DpcTabularValues;
|
|
476
507
|
/**
|
|
477
508
|
* How often the Persister should poll the database for any changes made to it
|
|
478
509
|
* by other clients, defaulting to 1 second.
|
|
510
|
+
* @category Configuration
|
|
511
|
+
* @since v4.0.0
|
|
479
512
|
*/
|
|
480
513
|
autoLoadIntervalSeconds?: number;
|
|
481
514
|
};
|
|
@@ -562,11 +595,15 @@ export type DpcTabularLoad<Schema extends OptionalTablesSchema> = {
|
|
|
562
595
|
/**
|
|
563
596
|
* The Id of the Store Table into which data from this database table
|
|
564
597
|
* should be loaded.
|
|
598
|
+
* @category Configuration
|
|
599
|
+
* @since v4.0.0
|
|
565
600
|
*/
|
|
566
601
|
tableId: TableIdFromSchema<Schema>;
|
|
567
602
|
/**
|
|
568
603
|
* The optional name of the column in the database table that will be
|
|
569
604
|
* used as the Row Ids in the Store Table, defaulting to '_id'.
|
|
605
|
+
* @category Configuration
|
|
606
|
+
* @since v4.0.0
|
|
570
607
|
*/
|
|
571
608
|
rowIdColumnName?: string;
|
|
572
609
|
}
|
|
@@ -671,21 +708,29 @@ export type DpcTabularSave<Schema extends OptionalTablesSchema> = {
|
|
|
671
708
|
/**
|
|
672
709
|
* The name of the database table out to which the Store Table should be
|
|
673
710
|
* saved.
|
|
711
|
+
* @category Configuration
|
|
712
|
+
* @since v4.0.0
|
|
674
713
|
*/
|
|
675
714
|
tableName: string;
|
|
676
715
|
/**
|
|
677
716
|
* The optional name of the column in the database table that will be
|
|
678
717
|
* used to save the Row Ids from the Store Table, defaulting to '_id'.
|
|
718
|
+
* @category Configuration
|
|
719
|
+
* @since v4.0.0
|
|
679
720
|
*/
|
|
680
721
|
rowIdColumnName?: string;
|
|
681
722
|
/**
|
|
682
723
|
* Whether columns in the database table will be removed if they are
|
|
683
724
|
* empty in the Store Table, defaulting to false.
|
|
725
|
+
* @category Configuration
|
|
726
|
+
* @since v4.0.0
|
|
684
727
|
*/
|
|
685
728
|
deleteEmptyColumns?: boolean;
|
|
686
729
|
/**
|
|
687
730
|
* Whether tables in the database will be removed if the Store Table is
|
|
688
731
|
* empty, defaulting to false.
|
|
732
|
+
* @category Configuration
|
|
733
|
+
* @since v4.0.0
|
|
689
734
|
*/
|
|
690
735
|
deleteEmptyTable?: boolean;
|
|
691
736
|
}
|
|
@@ -724,15 +769,21 @@ export type DpcTabularSave<Schema extends OptionalTablesSchema> = {
|
|
|
724
769
|
export type DpcTabularValues = {
|
|
725
770
|
/**
|
|
726
771
|
* Whether Store Values will be loaded from a database table.
|
|
772
|
+
* @category Configuration
|
|
773
|
+
* @since v4.0.0
|
|
727
774
|
*/
|
|
728
775
|
load?: boolean;
|
|
729
776
|
/**
|
|
730
777
|
* Whether Store Values will be saved to a database table.
|
|
778
|
+
* @category Configuration
|
|
779
|
+
* @since v4.0.0
|
|
731
780
|
*/
|
|
732
781
|
save?: boolean;
|
|
733
782
|
/**
|
|
734
783
|
* The optional name of the database table from and to which the Store Values
|
|
735
784
|
* should be loaded or saved, defaulting to `tinybase_values`.
|
|
785
|
+
* @category Configuration
|
|
786
|
+
* @since v4.0.0
|
|
736
787
|
*/
|
|
737
788
|
tableName?: string;
|
|
738
789
|
};
|
|
@@ -851,6 +902,7 @@ export type DpcTabularValues = {
|
|
|
851
902
|
* sessionStorage.clear();
|
|
852
903
|
* ```
|
|
853
904
|
* @category Persister
|
|
905
|
+
* @since v1.0.0
|
|
854
906
|
*/
|
|
855
907
|
export interface Persister<
|
|
856
908
|
in out Schemas extends OptionalSchemas,
|
|
@@ -924,6 +976,7 @@ export interface Persister<
|
|
|
924
976
|
* sessionStorage.clear();
|
|
925
977
|
* ```
|
|
926
978
|
* @category Load
|
|
979
|
+
* @since v1.0.0
|
|
927
980
|
*/
|
|
928
981
|
load(initialContent?: Content<Schemas, true>): Promise<this>;
|
|
929
982
|
|
|
@@ -986,6 +1039,7 @@ export interface Persister<
|
|
|
986
1039
|
* sessionStorage.clear();
|
|
987
1040
|
* ```
|
|
988
1041
|
* @category Load
|
|
1042
|
+
* @since v1.0.0
|
|
989
1043
|
*/
|
|
990
1044
|
startAutoLoad(initialContent?: Content<Schemas, true>): Promise<this>;
|
|
991
1045
|
|
|
@@ -1033,6 +1087,7 @@ export interface Persister<
|
|
|
1033
1087
|
* sessionStorage.clear();
|
|
1034
1088
|
* ```
|
|
1035
1089
|
* @category Load
|
|
1090
|
+
* @since v1.0.0
|
|
1036
1091
|
*/
|
|
1037
1092
|
stopAutoLoad(): this;
|
|
1038
1093
|
|
|
@@ -1094,6 +1149,7 @@ export interface Persister<
|
|
|
1094
1149
|
* sessionStorage.clear();
|
|
1095
1150
|
* ```
|
|
1096
1151
|
* @category Save
|
|
1152
|
+
* @since v1.0.0
|
|
1097
1153
|
*/
|
|
1098
1154
|
save(): Promise<this>;
|
|
1099
1155
|
|
|
@@ -1134,6 +1190,7 @@ export interface Persister<
|
|
|
1134
1190
|
* sessionStorage.clear();
|
|
1135
1191
|
* ```
|
|
1136
1192
|
* @category Save
|
|
1193
|
+
* @since v1.0.0
|
|
1137
1194
|
*/
|
|
1138
1195
|
startAutoSave(): Promise<this>;
|
|
1139
1196
|
|
|
@@ -1174,6 +1231,7 @@ export interface Persister<
|
|
|
1174
1231
|
* sessionStorage.clear();
|
|
1175
1232
|
* ```
|
|
1176
1233
|
* @category Save
|
|
1234
|
+
* @since v1.0.0
|
|
1177
1235
|
*/
|
|
1178
1236
|
stopAutoSave(): this;
|
|
1179
1237
|
|
|
@@ -1286,6 +1344,7 @@ export interface Persister<
|
|
|
1286
1344
|
* sessionStorage.clear();
|
|
1287
1345
|
* ```
|
|
1288
1346
|
* @category Getter
|
|
1347
|
+
* @since v1.0.0
|
|
1289
1348
|
*/
|
|
1290
1349
|
getStore(): PersistedStore<Schemas, Persist>;
|
|
1291
1350
|
|
|
@@ -1319,6 +1378,7 @@ export interface Persister<
|
|
|
1319
1378
|
* // -> 0
|
|
1320
1379
|
* ```
|
|
1321
1380
|
* @category Lifecycle
|
|
1381
|
+
* @since v1.0.0
|
|
1322
1382
|
*/
|
|
1323
1383
|
destroy(): this;
|
|
1324
1384
|
|
|
@@ -1364,6 +1424,7 @@ export interface Persister<
|
|
|
1364
1424
|
* sessionStorage.clear();
|
|
1365
1425
|
* ```
|
|
1366
1426
|
* @category Development
|
|
1427
|
+
* @since v1.0.0
|
|
1367
1428
|
*/
|
|
1368
1429
|
getStats(): PersisterStats;
|
|
1369
1430
|
}
|
|
@@ -1543,6 +1604,7 @@ export interface Persister<
|
|
|
1543
1604
|
* mergeableStorePersister.destroy();
|
|
1544
1605
|
* ```
|
|
1545
1606
|
* @category Creation
|
|
1607
|
+
* @since v1.0.0
|
|
1546
1608
|
*/
|
|
1547
1609
|
export function createCustomPersister<
|
|
1548
1610
|
Schemas extends OptionalSchemas,
|
|
@@ -3,28 +3,29 @@
|
|
|
3
3
|
* saving and loading Store and MergeableStore data, to and from different
|
|
4
4
|
* destinations, or underlying storage types.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
* which returns
|
|
8
|
-
* them, these allow you to store your TinyBase data locally, remotely,
|
|
9
|
-
* SQLite databases, and across synchronization boundaries with CRDT
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* |
|
|
15
|
-
* |
|
|
16
|
-
* |
|
|
17
|
-
* |
|
|
18
|
-
* |
|
|
19
|
-
* |
|
|
20
|
-
* |
|
|
21
|
-
* |
|
|
22
|
-
* |
|
|
23
|
-
* |
|
|
24
|
-
* |
|
|
25
|
-
* |
|
|
26
|
-
* |
|
|
27
|
-
* |
|
|
6
|
+
* Many entry points are provided (in separately installed modules), each of
|
|
7
|
+
* which returns different types of Persister that can load and save a Store.
|
|
8
|
+
* Between them, these allow you to store your TinyBase data locally, remotely,
|
|
9
|
+
* to SQLite databases, and across synchronization boundaries with CRDT
|
|
10
|
+
* frameworks.
|
|
11
|
+
*
|
|
12
|
+
* |Persister|Storage|Store|MergeableStore
|
|
13
|
+
* |-|-|-|-|
|
|
14
|
+
* |SessionPersister|Browser session storage|Yes|Yes
|
|
15
|
+
* |LocalPersister|Browser local storage|Yes|Yes
|
|
16
|
+
* |FilePersister|Local file (where possible)|Yes|Yes
|
|
17
|
+
* |IndexedDbPersister|Browser IndexedDB|Yes|No
|
|
18
|
+
* |RemotePersister|Remote server|Yes|No
|
|
19
|
+
* |Sqlite3Persister|SQLite in Node, via [sqlite3](https://github.com/TryGhost/node-sqlite3)|Yes|Yes*
|
|
20
|
+
* |SqliteWasmPersister|SQLite in a browser, via [sqlite-wasm](https://github.com/tomayac/sqlite-wasm)|Yes|Yes*
|
|
21
|
+
* |ExpoSqlitePersister|SQLite in React Native, via [expo-sqlite](https://github.com/expo/expo/tree/main/packages/expo-sqlite)|Yes|Yes*
|
|
22
|
+
* |CrSqliteWasmPersister|SQLite CRDTs, via [cr-sqlite-wasm](https://github.com/vlcn-io/cr-sqlite)|Yes|No
|
|
23
|
+
* |ElectricSqlPersister|Electric SQL, via [electric-sql](https://github.com/electric-sql/electric)|Yes|No
|
|
24
|
+
* |LibSqlPersister|LibSQL for Turso, via [libsql-client](https://github.com/tursodatabase/libsql-client-ts)|Yes|No
|
|
25
|
+
* |PowerSyncPersister|PowerSync, via [powersync-sdk](https://github.com/powersync-ja/powersync-js)|Yes|No
|
|
26
|
+
* |YjsPersister|Yjs CRDTs, via [yjs](https://github.com/yjs/yjs)|Yes|No
|
|
27
|
+
* |SqliteWasmPersister|Automerge CRDTs, via [automerge-repo](https://github.com/automerge/automerge-repo)|Yes|No
|
|
28
|
+
* |PartyKitPersister|[PartyKit](https://www.partykit.io/), via the persister-partykit-server module|Yes|No|
|
|
28
29
|
*
|
|
29
30
|
* (*) Note that SQLite-based Persisters can currently only persist
|
|
30
31
|
* MergeableStore data when using the JSON-based DpcJson mode, and not in a
|
|
@@ -33,14 +34,13 @@
|
|
|
33
34
|
* Since persistence requirements can be different for every app, the
|
|
34
35
|
* createCustomPersister function in this module can also be used to easily
|
|
35
36
|
* create a fully customized way to save and load Store data.
|
|
36
|
-
* @see
|
|
37
|
-
* @see Database Persistence guide
|
|
38
|
-
* @see Synchronizing Data guide
|
|
37
|
+
* @see Persistence guides
|
|
39
38
|
* @see Countries demo
|
|
40
39
|
* @see Todo App demos
|
|
41
40
|
* @see Drawing demo
|
|
42
41
|
* @packageDocumentation
|
|
43
42
|
* @module persisters
|
|
43
|
+
* @since v1.0.0
|
|
44
44
|
*/
|
|
45
45
|
|
|
46
46
|
import type {
|
|
@@ -73,15 +73,21 @@ import type {TableIdFromSchema} from '../../_internal/store/with-schemas/index.d
|
|
|
73
73
|
export const enum Persists {
|
|
74
74
|
/**
|
|
75
75
|
* Indicates that only a regular Store can be supported by a Persister.
|
|
76
|
+
* @category Enum
|
|
77
|
+
* @since v5.0.0
|
|
76
78
|
*/
|
|
77
79
|
StoreOnly = 1,
|
|
78
80
|
/**
|
|
79
81
|
* Indicates that only a MergeableStore can be supported by a Persister.
|
|
82
|
+
* @category Enum
|
|
83
|
+
* @since v5.0.0
|
|
80
84
|
*/
|
|
81
85
|
MergeableStoreOnly = 2,
|
|
82
86
|
/**
|
|
83
87
|
* Indicates that either a regular Store or a MergeableStore can be supported
|
|
84
88
|
* by a Persister.
|
|
89
|
+
* @category Enum
|
|
90
|
+
* @since v5.0.0
|
|
85
91
|
*/
|
|
86
92
|
StoreOrMergeableStore = 3,
|
|
87
93
|
}
|
|
@@ -229,14 +235,19 @@ export type PersisterListener<
|
|
|
229
235
|
*
|
|
230
236
|
* A PersisterStats object is returned from the getStats method.
|
|
231
237
|
* @category Development
|
|
238
|
+
* @since v1.0.0
|
|
232
239
|
*/
|
|
233
240
|
export type PersisterStats = {
|
|
234
241
|
/**
|
|
235
242
|
* The number of times data has been loaded.
|
|
243
|
+
* @category Stat
|
|
244
|
+
* @since v1.0.0
|
|
236
245
|
*/
|
|
237
246
|
loads: number;
|
|
238
247
|
/**
|
|
239
248
|
* The number of times data has been saved.
|
|
249
|
+
* @category Stat
|
|
250
|
+
* @since v1.0.0
|
|
240
251
|
*/
|
|
241
252
|
saves: number;
|
|
242
253
|
};
|
|
@@ -356,27 +367,37 @@ export type DpcJson = {
|
|
|
356
367
|
* The mode to be used for persisting the Store to the database, in this case
|
|
357
368
|
* JSON serialization. See the DpcTabular type for the alternative tabular
|
|
358
369
|
* mapping mode.
|
|
370
|
+
* @category Configuration
|
|
371
|
+
* @since v4.0.0
|
|
359
372
|
*/
|
|
360
373
|
mode: 'json';
|
|
361
374
|
/**
|
|
362
375
|
* An optional string which indicates the name of a table in the database
|
|
363
376
|
* which will be used to serialize the Store content into. It defaults to
|
|
364
377
|
* `tinybase`.
|
|
378
|
+
* @category Configuration
|
|
379
|
+
* @since v4.0.0
|
|
365
380
|
*/
|
|
366
381
|
storeTableName?: string;
|
|
367
382
|
/**
|
|
368
383
|
* The optional name of the column in the database table that will be used as
|
|
369
384
|
* the Id for the Store, defaulting to '_id', since v5.0.
|
|
385
|
+
* @category Configuration
|
|
386
|
+
* @since v4.0.0
|
|
370
387
|
*/
|
|
371
388
|
storeIdColumnName?: string;
|
|
372
389
|
/**
|
|
373
390
|
* The optional name of the column in the database table that will be used for
|
|
374
391
|
* the JSON of the Store, defaulting to 'store', since v5.0.
|
|
392
|
+
* @category Configuration
|
|
393
|
+
* @since v4.0.0
|
|
375
394
|
*/
|
|
376
395
|
storeColumnName?: string;
|
|
377
396
|
/**
|
|
378
397
|
* How often the Persister should poll the database for any changes made to it
|
|
379
398
|
* by other clients, defaulting to 1 second.
|
|
399
|
+
* @category Configuration
|
|
400
|
+
* @since v4.0.0
|
|
380
401
|
*/
|
|
381
402
|
autoLoadIntervalSeconds?: number;
|
|
382
403
|
};
|
|
@@ -452,30 +473,42 @@ export type DpcTabular<Schema extends OptionalTablesSchema> = {
|
|
|
452
473
|
* The mode to be used for persisting the Store to the database, in this case
|
|
453
474
|
* tabular mapping. See the DpcJson type for the alternative JSON
|
|
454
475
|
* serialization mode.
|
|
476
|
+
* @category Configuration
|
|
477
|
+
* @since v4.0.0
|
|
455
478
|
*/
|
|
456
479
|
mode: 'tabular';
|
|
457
480
|
/**
|
|
458
481
|
* The settings for how the Store Tables are mapped to and from the database.
|
|
482
|
+
* @category Configuration
|
|
483
|
+
* @since v4.0.0
|
|
459
484
|
*/
|
|
460
485
|
tables?: {
|
|
461
486
|
/**
|
|
462
487
|
* The settings for how the database tables are mapped into the Store Tables
|
|
463
488
|
* when loading.
|
|
489
|
+
* @category Configuration
|
|
490
|
+
* @since v4.0.0
|
|
464
491
|
*/
|
|
465
492
|
load?: DpcTabularLoad<Schema>;
|
|
466
493
|
/**
|
|
467
494
|
* The settings for how the Store Tables are mapped out to the database
|
|
468
495
|
* tables when saving.
|
|
496
|
+
* @category Configuration
|
|
497
|
+
* @since v4.0.0
|
|
469
498
|
*/
|
|
470
499
|
save?: DpcTabularSave<Schema>;
|
|
471
500
|
};
|
|
472
501
|
/**
|
|
473
502
|
* The settings for how the Store Values are mapped to and from the database.
|
|
503
|
+
* @category Configuration
|
|
504
|
+
* @since v4.0.0
|
|
474
505
|
*/
|
|
475
506
|
values?: DpcTabularValues;
|
|
476
507
|
/**
|
|
477
508
|
* How often the Persister should poll the database for any changes made to it
|
|
478
509
|
* by other clients, defaulting to 1 second.
|
|
510
|
+
* @category Configuration
|
|
511
|
+
* @since v4.0.0
|
|
479
512
|
*/
|
|
480
513
|
autoLoadIntervalSeconds?: number;
|
|
481
514
|
};
|
|
@@ -562,11 +595,15 @@ export type DpcTabularLoad<Schema extends OptionalTablesSchema> = {
|
|
|
562
595
|
/**
|
|
563
596
|
* The Id of the Store Table into which data from this database table
|
|
564
597
|
* should be loaded.
|
|
598
|
+
* @category Configuration
|
|
599
|
+
* @since v4.0.0
|
|
565
600
|
*/
|
|
566
601
|
tableId: TableIdFromSchema<Schema>;
|
|
567
602
|
/**
|
|
568
603
|
* The optional name of the column in the database table that will be
|
|
569
604
|
* used as the Row Ids in the Store Table, defaulting to '_id'.
|
|
605
|
+
* @category Configuration
|
|
606
|
+
* @since v4.0.0
|
|
570
607
|
*/
|
|
571
608
|
rowIdColumnName?: string;
|
|
572
609
|
}
|
|
@@ -671,21 +708,29 @@ export type DpcTabularSave<Schema extends OptionalTablesSchema> = {
|
|
|
671
708
|
/**
|
|
672
709
|
* The name of the database table out to which the Store Table should be
|
|
673
710
|
* saved.
|
|
711
|
+
* @category Configuration
|
|
712
|
+
* @since v4.0.0
|
|
674
713
|
*/
|
|
675
714
|
tableName: string;
|
|
676
715
|
/**
|
|
677
716
|
* The optional name of the column in the database table that will be
|
|
678
717
|
* used to save the Row Ids from the Store Table, defaulting to '_id'.
|
|
718
|
+
* @category Configuration
|
|
719
|
+
* @since v4.0.0
|
|
679
720
|
*/
|
|
680
721
|
rowIdColumnName?: string;
|
|
681
722
|
/**
|
|
682
723
|
* Whether columns in the database table will be removed if they are
|
|
683
724
|
* empty in the Store Table, defaulting to false.
|
|
725
|
+
* @category Configuration
|
|
726
|
+
* @since v4.0.0
|
|
684
727
|
*/
|
|
685
728
|
deleteEmptyColumns?: boolean;
|
|
686
729
|
/**
|
|
687
730
|
* Whether tables in the database will be removed if the Store Table is
|
|
688
731
|
* empty, defaulting to false.
|
|
732
|
+
* @category Configuration
|
|
733
|
+
* @since v4.0.0
|
|
689
734
|
*/
|
|
690
735
|
deleteEmptyTable?: boolean;
|
|
691
736
|
}
|
|
@@ -724,15 +769,21 @@ export type DpcTabularSave<Schema extends OptionalTablesSchema> = {
|
|
|
724
769
|
export type DpcTabularValues = {
|
|
725
770
|
/**
|
|
726
771
|
* Whether Store Values will be loaded from a database table.
|
|
772
|
+
* @category Configuration
|
|
773
|
+
* @since v4.0.0
|
|
727
774
|
*/
|
|
728
775
|
load?: boolean;
|
|
729
776
|
/**
|
|
730
777
|
* Whether Store Values will be saved to a database table.
|
|
778
|
+
* @category Configuration
|
|
779
|
+
* @since v4.0.0
|
|
731
780
|
*/
|
|
732
781
|
save?: boolean;
|
|
733
782
|
/**
|
|
734
783
|
* The optional name of the database table from and to which the Store Values
|
|
735
784
|
* should be loaded or saved, defaulting to `tinybase_values`.
|
|
785
|
+
* @category Configuration
|
|
786
|
+
* @since v4.0.0
|
|
736
787
|
*/
|
|
737
788
|
tableName?: string;
|
|
738
789
|
};
|
|
@@ -851,6 +902,7 @@ export type DpcTabularValues = {
|
|
|
851
902
|
* sessionStorage.clear();
|
|
852
903
|
* ```
|
|
853
904
|
* @category Persister
|
|
905
|
+
* @since v1.0.0
|
|
854
906
|
*/
|
|
855
907
|
export interface Persister<
|
|
856
908
|
in out Schemas extends OptionalSchemas,
|
|
@@ -924,6 +976,7 @@ export interface Persister<
|
|
|
924
976
|
* sessionStorage.clear();
|
|
925
977
|
* ```
|
|
926
978
|
* @category Load
|
|
979
|
+
* @since v1.0.0
|
|
927
980
|
*/
|
|
928
981
|
load(initialContent?: Content<Schemas, true>): Promise<this>;
|
|
929
982
|
|
|
@@ -986,6 +1039,7 @@ export interface Persister<
|
|
|
986
1039
|
* sessionStorage.clear();
|
|
987
1040
|
* ```
|
|
988
1041
|
* @category Load
|
|
1042
|
+
* @since v1.0.0
|
|
989
1043
|
*/
|
|
990
1044
|
startAutoLoad(initialContent?: Content<Schemas, true>): Promise<this>;
|
|
991
1045
|
|
|
@@ -1033,6 +1087,7 @@ export interface Persister<
|
|
|
1033
1087
|
* sessionStorage.clear();
|
|
1034
1088
|
* ```
|
|
1035
1089
|
* @category Load
|
|
1090
|
+
* @since v1.0.0
|
|
1036
1091
|
*/
|
|
1037
1092
|
stopAutoLoad(): this;
|
|
1038
1093
|
|
|
@@ -1094,6 +1149,7 @@ export interface Persister<
|
|
|
1094
1149
|
* sessionStorage.clear();
|
|
1095
1150
|
* ```
|
|
1096
1151
|
* @category Save
|
|
1152
|
+
* @since v1.0.0
|
|
1097
1153
|
*/
|
|
1098
1154
|
save(): Promise<this>;
|
|
1099
1155
|
|
|
@@ -1134,6 +1190,7 @@ export interface Persister<
|
|
|
1134
1190
|
* sessionStorage.clear();
|
|
1135
1191
|
* ```
|
|
1136
1192
|
* @category Save
|
|
1193
|
+
* @since v1.0.0
|
|
1137
1194
|
*/
|
|
1138
1195
|
startAutoSave(): Promise<this>;
|
|
1139
1196
|
|
|
@@ -1174,6 +1231,7 @@ export interface Persister<
|
|
|
1174
1231
|
* sessionStorage.clear();
|
|
1175
1232
|
* ```
|
|
1176
1233
|
* @category Save
|
|
1234
|
+
* @since v1.0.0
|
|
1177
1235
|
*/
|
|
1178
1236
|
stopAutoSave(): this;
|
|
1179
1237
|
|
|
@@ -1286,6 +1344,7 @@ export interface Persister<
|
|
|
1286
1344
|
* sessionStorage.clear();
|
|
1287
1345
|
* ```
|
|
1288
1346
|
* @category Getter
|
|
1347
|
+
* @since v1.0.0
|
|
1289
1348
|
*/
|
|
1290
1349
|
getStore(): PersistedStore<Schemas, Persist>;
|
|
1291
1350
|
|
|
@@ -1319,6 +1378,7 @@ export interface Persister<
|
|
|
1319
1378
|
* // -> 0
|
|
1320
1379
|
* ```
|
|
1321
1380
|
* @category Lifecycle
|
|
1381
|
+
* @since v1.0.0
|
|
1322
1382
|
*/
|
|
1323
1383
|
destroy(): this;
|
|
1324
1384
|
|
|
@@ -1364,6 +1424,7 @@ export interface Persister<
|
|
|
1364
1424
|
* sessionStorage.clear();
|
|
1365
1425
|
* ```
|
|
1366
1426
|
* @category Development
|
|
1427
|
+
* @since v1.0.0
|
|
1367
1428
|
*/
|
|
1368
1429
|
getStats(): PersisterStats;
|
|
1369
1430
|
}
|
|
@@ -1543,6 +1604,7 @@ export interface Persister<
|
|
|
1543
1604
|
* mergeableStorePersister.destroy();
|
|
1544
1605
|
* ```
|
|
1545
1606
|
* @category Creation
|
|
1607
|
+
* @since v1.0.0
|
|
1546
1608
|
*/
|
|
1547
1609
|
export function createCustomPersister<
|
|
1548
1610
|
Schemas extends OptionalSchemas,
|