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 {Changes, Content, Store} from '../store/index.d.cts';
|
|
@@ -67,15 +67,21 @@ import type {Id} from '../common/index.d.cts';
|
|
|
67
67
|
export const enum Persists {
|
|
68
68
|
/**
|
|
69
69
|
* Indicates that only a regular Store can be supported by a Persister.
|
|
70
|
+
* @category Enum
|
|
71
|
+
* @since v5.0.0
|
|
70
72
|
*/
|
|
71
73
|
StoreOnly = 1,
|
|
72
74
|
/**
|
|
73
75
|
* Indicates that only a MergeableStore can be supported by a Persister.
|
|
76
|
+
* @category Enum
|
|
77
|
+
* @since v5.0.0
|
|
74
78
|
*/
|
|
75
79
|
MergeableStoreOnly = 2,
|
|
76
80
|
/**
|
|
77
81
|
* Indicates that either a regular Store or a MergeableStore can be supported
|
|
78
82
|
* by a Persister.
|
|
83
|
+
* @category Enum
|
|
84
|
+
* @since v5.0.0
|
|
79
85
|
*/
|
|
80
86
|
StoreOrMergeableStore = 3,
|
|
81
87
|
}
|
|
@@ -172,14 +178,19 @@ export type PersisterListener<Persist extends Persists = Persists.StoreOnly> = (
|
|
|
172
178
|
*
|
|
173
179
|
* A PersisterStats object is returned from the getStats method.
|
|
174
180
|
* @category Development
|
|
181
|
+
* @since v1.0.0
|
|
175
182
|
*/
|
|
176
183
|
export type PersisterStats = {
|
|
177
184
|
/**
|
|
178
185
|
* The number of times data has been loaded.
|
|
186
|
+
* @category Stat
|
|
187
|
+
* @since v1.0.0
|
|
179
188
|
*/
|
|
180
189
|
loads: number;
|
|
181
190
|
/**
|
|
182
191
|
* The number of times data has been saved.
|
|
192
|
+
* @category Stat
|
|
193
|
+
* @since v1.0.0
|
|
183
194
|
*/
|
|
184
195
|
saves: number;
|
|
185
196
|
};
|
|
@@ -291,27 +302,37 @@ export type DpcJson = {
|
|
|
291
302
|
* The mode to be used for persisting the Store to the database, in this case
|
|
292
303
|
* JSON serialization. See the DpcTabular type for the alternative tabular
|
|
293
304
|
* mapping mode.
|
|
305
|
+
* @category Configuration
|
|
306
|
+
* @since v4.0.0
|
|
294
307
|
*/
|
|
295
308
|
mode: 'json';
|
|
296
309
|
/**
|
|
297
310
|
* An optional string which indicates the name of a table in the database
|
|
298
311
|
* which will be used to serialize the Store content into. It defaults to
|
|
299
312
|
* `tinybase`.
|
|
313
|
+
* @category Configuration
|
|
314
|
+
* @since v4.0.0
|
|
300
315
|
*/
|
|
301
316
|
storeTableName?: string;
|
|
302
317
|
/**
|
|
303
318
|
* The optional name of the column in the database table that will be used as
|
|
304
319
|
* the Id for the Store, defaulting to '_id', since v5.0.
|
|
320
|
+
* @category Configuration
|
|
321
|
+
* @since v4.0.0
|
|
305
322
|
*/
|
|
306
323
|
storeIdColumnName?: string;
|
|
307
324
|
/**
|
|
308
325
|
* The optional name of the column in the database table that will be used for
|
|
309
326
|
* the JSON of the Store, defaulting to 'store', since v5.0.
|
|
327
|
+
* @category Configuration
|
|
328
|
+
* @since v4.0.0
|
|
310
329
|
*/
|
|
311
330
|
storeColumnName?: string;
|
|
312
331
|
/**
|
|
313
332
|
* How often the Persister should poll the database for any changes made to it
|
|
314
333
|
* by other clients, defaulting to 1 second.
|
|
334
|
+
* @category Configuration
|
|
335
|
+
* @since v4.0.0
|
|
315
336
|
*/
|
|
316
337
|
autoLoadIntervalSeconds?: number;
|
|
317
338
|
};
|
|
@@ -387,30 +408,42 @@ export type DpcTabular = {
|
|
|
387
408
|
* The mode to be used for persisting the Store to the database, in this case
|
|
388
409
|
* tabular mapping. See the DpcJson type for the alternative JSON
|
|
389
410
|
* serialization mode.
|
|
411
|
+
* @category Configuration
|
|
412
|
+
* @since v4.0.0
|
|
390
413
|
*/
|
|
391
414
|
mode: 'tabular';
|
|
392
415
|
/**
|
|
393
416
|
* The settings for how the Store Tables are mapped to and from the database.
|
|
417
|
+
* @category Configuration
|
|
418
|
+
* @since v4.0.0
|
|
394
419
|
*/
|
|
395
420
|
tables?: {
|
|
396
421
|
/**
|
|
397
422
|
* The settings for how the database tables are mapped into the Store Tables
|
|
398
423
|
* when loading.
|
|
424
|
+
* @category Configuration
|
|
425
|
+
* @since v4.0.0
|
|
399
426
|
*/
|
|
400
427
|
load?: DpcTabularLoad;
|
|
401
428
|
/**
|
|
402
429
|
* The settings for how the Store Tables are mapped out to the database
|
|
403
430
|
* tables when saving.
|
|
431
|
+
* @category Configuration
|
|
432
|
+
* @since v4.0.0
|
|
404
433
|
*/
|
|
405
434
|
save?: DpcTabularSave;
|
|
406
435
|
};
|
|
407
436
|
/**
|
|
408
437
|
* The settings for how the Store Values are mapped to and from the database.
|
|
438
|
+
* @category Configuration
|
|
439
|
+
* @since v4.0.0
|
|
409
440
|
*/
|
|
410
441
|
values?: DpcTabularValues;
|
|
411
442
|
/**
|
|
412
443
|
* How often the Persister should poll the database for any changes made to it
|
|
413
444
|
* by other clients, defaulting to 1 second.
|
|
445
|
+
* @category Configuration
|
|
446
|
+
* @since v4.0.0
|
|
414
447
|
*/
|
|
415
448
|
autoLoadIntervalSeconds?: number;
|
|
416
449
|
};
|
|
@@ -497,11 +530,15 @@ export type DpcTabularLoad = {
|
|
|
497
530
|
/**
|
|
498
531
|
* The Id of the Store Table into which data from this database table
|
|
499
532
|
* should be loaded.
|
|
533
|
+
* @category Configuration
|
|
534
|
+
* @since v4.0.0
|
|
500
535
|
*/
|
|
501
536
|
tableId: Id;
|
|
502
537
|
/**
|
|
503
538
|
* The optional name of the column in the database table that will be
|
|
504
539
|
* used as the Row Ids in the Store Table, defaulting to '_id'.
|
|
540
|
+
* @category Configuration
|
|
541
|
+
* @since v4.0.0
|
|
505
542
|
*/
|
|
506
543
|
rowIdColumnName?: string;
|
|
507
544
|
}
|
|
@@ -606,21 +643,29 @@ export type DpcTabularSave = {
|
|
|
606
643
|
/**
|
|
607
644
|
* The name of the database table out to which the Store Table should be
|
|
608
645
|
* saved.
|
|
646
|
+
* @category Configuration
|
|
647
|
+
* @since v4.0.0
|
|
609
648
|
*/
|
|
610
649
|
tableName: string;
|
|
611
650
|
/**
|
|
612
651
|
* The optional name of the column in the database table that will be
|
|
613
652
|
* used to save the Row Ids from the Store Table, defaulting to '_id'.
|
|
653
|
+
* @category Configuration
|
|
654
|
+
* @since v4.0.0
|
|
614
655
|
*/
|
|
615
656
|
rowIdColumnName?: string;
|
|
616
657
|
/**
|
|
617
658
|
* Whether columns in the database table will be removed if they are
|
|
618
659
|
* empty in the Store Table, defaulting to false.
|
|
660
|
+
* @category Configuration
|
|
661
|
+
* @since v4.0.0
|
|
619
662
|
*/
|
|
620
663
|
deleteEmptyColumns?: boolean;
|
|
621
664
|
/**
|
|
622
665
|
* Whether tables in the database will be removed if the Store Table is
|
|
623
666
|
* empty, defaulting to false.
|
|
667
|
+
* @category Configuration
|
|
668
|
+
* @since v4.0.0
|
|
624
669
|
*/
|
|
625
670
|
deleteEmptyTable?: boolean;
|
|
626
671
|
}
|
|
@@ -659,15 +704,21 @@ export type DpcTabularSave = {
|
|
|
659
704
|
export type DpcTabularValues = {
|
|
660
705
|
/**
|
|
661
706
|
* Whether Store Values will be loaded from a database table.
|
|
707
|
+
* @category Configuration
|
|
708
|
+
* @since v4.0.0
|
|
662
709
|
*/
|
|
663
710
|
load?: boolean;
|
|
664
711
|
/**
|
|
665
712
|
* Whether Store Values will be saved to a database table.
|
|
713
|
+
* @category Configuration
|
|
714
|
+
* @since v4.0.0
|
|
666
715
|
*/
|
|
667
716
|
save?: boolean;
|
|
668
717
|
/**
|
|
669
718
|
* The optional name of the database table from and to which the Store Values
|
|
670
719
|
* should be loaded or saved, defaulting to `tinybase_values`.
|
|
720
|
+
* @category Configuration
|
|
721
|
+
* @since v4.0.0
|
|
671
722
|
*/
|
|
672
723
|
tableName?: string;
|
|
673
724
|
};
|
|
@@ -786,6 +837,7 @@ export type DpcTabularValues = {
|
|
|
786
837
|
* sessionStorage.clear();
|
|
787
838
|
* ```
|
|
788
839
|
* @category Persister
|
|
840
|
+
* @since v1.0.0
|
|
789
841
|
*/
|
|
790
842
|
export interface Persister<Persist extends Persists = Persists.StoreOnly> {
|
|
791
843
|
//
|
|
@@ -851,6 +903,7 @@ export interface Persister<Persist extends Persists = Persists.StoreOnly> {
|
|
|
851
903
|
* sessionStorage.clear();
|
|
852
904
|
* ```
|
|
853
905
|
* @category Load
|
|
906
|
+
* @since v1.0.0
|
|
854
907
|
*/
|
|
855
908
|
load(initialContent?: Content): Promise<this>;
|
|
856
909
|
|
|
@@ -907,6 +960,7 @@ export interface Persister<Persist extends Persists = Persists.StoreOnly> {
|
|
|
907
960
|
* sessionStorage.clear();
|
|
908
961
|
* ```
|
|
909
962
|
* @category Load
|
|
963
|
+
* @since v1.0.0
|
|
910
964
|
*/
|
|
911
965
|
startAutoLoad(initialContent?: Content): Promise<this>;
|
|
912
966
|
|
|
@@ -954,6 +1008,7 @@ export interface Persister<Persist extends Persists = Persists.StoreOnly> {
|
|
|
954
1008
|
* sessionStorage.clear();
|
|
955
1009
|
* ```
|
|
956
1010
|
* @category Load
|
|
1011
|
+
* @since v1.0.0
|
|
957
1012
|
*/
|
|
958
1013
|
stopAutoLoad(): this;
|
|
959
1014
|
|
|
@@ -1015,6 +1070,7 @@ export interface Persister<Persist extends Persists = Persists.StoreOnly> {
|
|
|
1015
1070
|
* sessionStorage.clear();
|
|
1016
1071
|
* ```
|
|
1017
1072
|
* @category Save
|
|
1073
|
+
* @since v1.0.0
|
|
1018
1074
|
*/
|
|
1019
1075
|
save(): Promise<this>;
|
|
1020
1076
|
|
|
@@ -1055,6 +1111,7 @@ export interface Persister<Persist extends Persists = Persists.StoreOnly> {
|
|
|
1055
1111
|
* sessionStorage.clear();
|
|
1056
1112
|
* ```
|
|
1057
1113
|
* @category Save
|
|
1114
|
+
* @since v1.0.0
|
|
1058
1115
|
*/
|
|
1059
1116
|
startAutoSave(): Promise<this>;
|
|
1060
1117
|
|
|
@@ -1095,6 +1152,7 @@ export interface Persister<Persist extends Persists = Persists.StoreOnly> {
|
|
|
1095
1152
|
* sessionStorage.clear();
|
|
1096
1153
|
* ```
|
|
1097
1154
|
* @category Save
|
|
1155
|
+
* @since v1.0.0
|
|
1098
1156
|
*/
|
|
1099
1157
|
stopAutoSave(): this;
|
|
1100
1158
|
|
|
@@ -1201,6 +1259,7 @@ export interface Persister<Persist extends Persists = Persists.StoreOnly> {
|
|
|
1201
1259
|
* sessionStorage.clear();
|
|
1202
1260
|
* ```
|
|
1203
1261
|
* @category Getter
|
|
1262
|
+
* @since v1.0.0
|
|
1204
1263
|
*/
|
|
1205
1264
|
getStore(): PersistedStore<Persist>;
|
|
1206
1265
|
|
|
@@ -1234,6 +1293,7 @@ export interface Persister<Persist extends Persists = Persists.StoreOnly> {
|
|
|
1234
1293
|
* // -> 0
|
|
1235
1294
|
* ```
|
|
1236
1295
|
* @category Lifecycle
|
|
1296
|
+
* @since v1.0.0
|
|
1237
1297
|
*/
|
|
1238
1298
|
destroy(): this;
|
|
1239
1299
|
|
|
@@ -1279,6 +1339,7 @@ export interface Persister<Persist extends Persists = Persists.StoreOnly> {
|
|
|
1279
1339
|
* sessionStorage.clear();
|
|
1280
1340
|
* ```
|
|
1281
1341
|
* @category Development
|
|
1342
|
+
* @since v1.0.0
|
|
1282
1343
|
*/
|
|
1283
1344
|
getStats(): PersisterStats;
|
|
1284
1345
|
//
|
|
@@ -1437,6 +1498,7 @@ export interface Persister<Persist extends Persists = Persists.StoreOnly> {
|
|
|
1437
1498
|
* mergeableStorePersister.destroy();
|
|
1438
1499
|
* ```
|
|
1439
1500
|
* @category Creation
|
|
1501
|
+
* @since v1.0.0
|
|
1440
1502
|
*/
|
|
1441
1503
|
export function createCustomPersister<
|
|
1442
1504
|
ListeningHandle,
|
|
@@ -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 {Changes, Content, Store} from '../store/index.d.ts';
|
|
@@ -67,15 +67,21 @@ import type {Id} from '../common/index.d.ts';
|
|
|
67
67
|
export const enum Persists {
|
|
68
68
|
/**
|
|
69
69
|
* Indicates that only a regular Store can be supported by a Persister.
|
|
70
|
+
* @category Enum
|
|
71
|
+
* @since v5.0.0
|
|
70
72
|
*/
|
|
71
73
|
StoreOnly = 1,
|
|
72
74
|
/**
|
|
73
75
|
* Indicates that only a MergeableStore can be supported by a Persister.
|
|
76
|
+
* @category Enum
|
|
77
|
+
* @since v5.0.0
|
|
74
78
|
*/
|
|
75
79
|
MergeableStoreOnly = 2,
|
|
76
80
|
/**
|
|
77
81
|
* Indicates that either a regular Store or a MergeableStore can be supported
|
|
78
82
|
* by a Persister.
|
|
83
|
+
* @category Enum
|
|
84
|
+
* @since v5.0.0
|
|
79
85
|
*/
|
|
80
86
|
StoreOrMergeableStore = 3,
|
|
81
87
|
}
|
|
@@ -172,14 +178,19 @@ export type PersisterListener<Persist extends Persists = Persists.StoreOnly> = (
|
|
|
172
178
|
*
|
|
173
179
|
* A PersisterStats object is returned from the getStats method.
|
|
174
180
|
* @category Development
|
|
181
|
+
* @since v1.0.0
|
|
175
182
|
*/
|
|
176
183
|
export type PersisterStats = {
|
|
177
184
|
/**
|
|
178
185
|
* The number of times data has been loaded.
|
|
186
|
+
* @category Stat
|
|
187
|
+
* @since v1.0.0
|
|
179
188
|
*/
|
|
180
189
|
loads: number;
|
|
181
190
|
/**
|
|
182
191
|
* The number of times data has been saved.
|
|
192
|
+
* @category Stat
|
|
193
|
+
* @since v1.0.0
|
|
183
194
|
*/
|
|
184
195
|
saves: number;
|
|
185
196
|
};
|
|
@@ -291,27 +302,37 @@ export type DpcJson = {
|
|
|
291
302
|
* The mode to be used for persisting the Store to the database, in this case
|
|
292
303
|
* JSON serialization. See the DpcTabular type for the alternative tabular
|
|
293
304
|
* mapping mode.
|
|
305
|
+
* @category Configuration
|
|
306
|
+
* @since v4.0.0
|
|
294
307
|
*/
|
|
295
308
|
mode: 'json';
|
|
296
309
|
/**
|
|
297
310
|
* An optional string which indicates the name of a table in the database
|
|
298
311
|
* which will be used to serialize the Store content into. It defaults to
|
|
299
312
|
* `tinybase`.
|
|
313
|
+
* @category Configuration
|
|
314
|
+
* @since v4.0.0
|
|
300
315
|
*/
|
|
301
316
|
storeTableName?: string;
|
|
302
317
|
/**
|
|
303
318
|
* The optional name of the column in the database table that will be used as
|
|
304
319
|
* the Id for the Store, defaulting to '_id', since v5.0.
|
|
320
|
+
* @category Configuration
|
|
321
|
+
* @since v4.0.0
|
|
305
322
|
*/
|
|
306
323
|
storeIdColumnName?: string;
|
|
307
324
|
/**
|
|
308
325
|
* The optional name of the column in the database table that will be used for
|
|
309
326
|
* the JSON of the Store, defaulting to 'store', since v5.0.
|
|
327
|
+
* @category Configuration
|
|
328
|
+
* @since v4.0.0
|
|
310
329
|
*/
|
|
311
330
|
storeColumnName?: string;
|
|
312
331
|
/**
|
|
313
332
|
* How often the Persister should poll the database for any changes made to it
|
|
314
333
|
* by other clients, defaulting to 1 second.
|
|
334
|
+
* @category Configuration
|
|
335
|
+
* @since v4.0.0
|
|
315
336
|
*/
|
|
316
337
|
autoLoadIntervalSeconds?: number;
|
|
317
338
|
};
|
|
@@ -387,30 +408,42 @@ export type DpcTabular = {
|
|
|
387
408
|
* The mode to be used for persisting the Store to the database, in this case
|
|
388
409
|
* tabular mapping. See the DpcJson type for the alternative JSON
|
|
389
410
|
* serialization mode.
|
|
411
|
+
* @category Configuration
|
|
412
|
+
* @since v4.0.0
|
|
390
413
|
*/
|
|
391
414
|
mode: 'tabular';
|
|
392
415
|
/**
|
|
393
416
|
* The settings for how the Store Tables are mapped to and from the database.
|
|
417
|
+
* @category Configuration
|
|
418
|
+
* @since v4.0.0
|
|
394
419
|
*/
|
|
395
420
|
tables?: {
|
|
396
421
|
/**
|
|
397
422
|
* The settings for how the database tables are mapped into the Store Tables
|
|
398
423
|
* when loading.
|
|
424
|
+
* @category Configuration
|
|
425
|
+
* @since v4.0.0
|
|
399
426
|
*/
|
|
400
427
|
load?: DpcTabularLoad;
|
|
401
428
|
/**
|
|
402
429
|
* The settings for how the Store Tables are mapped out to the database
|
|
403
430
|
* tables when saving.
|
|
431
|
+
* @category Configuration
|
|
432
|
+
* @since v4.0.0
|
|
404
433
|
*/
|
|
405
434
|
save?: DpcTabularSave;
|
|
406
435
|
};
|
|
407
436
|
/**
|
|
408
437
|
* The settings for how the Store Values are mapped to and from the database.
|
|
438
|
+
* @category Configuration
|
|
439
|
+
* @since v4.0.0
|
|
409
440
|
*/
|
|
410
441
|
values?: DpcTabularValues;
|
|
411
442
|
/**
|
|
412
443
|
* How often the Persister should poll the database for any changes made to it
|
|
413
444
|
* by other clients, defaulting to 1 second.
|
|
445
|
+
* @category Configuration
|
|
446
|
+
* @since v4.0.0
|
|
414
447
|
*/
|
|
415
448
|
autoLoadIntervalSeconds?: number;
|
|
416
449
|
};
|
|
@@ -497,11 +530,15 @@ export type DpcTabularLoad = {
|
|
|
497
530
|
/**
|
|
498
531
|
* The Id of the Store Table into which data from this database table
|
|
499
532
|
* should be loaded.
|
|
533
|
+
* @category Configuration
|
|
534
|
+
* @since v4.0.0
|
|
500
535
|
*/
|
|
501
536
|
tableId: Id;
|
|
502
537
|
/**
|
|
503
538
|
* The optional name of the column in the database table that will be
|
|
504
539
|
* used as the Row Ids in the Store Table, defaulting to '_id'.
|
|
540
|
+
* @category Configuration
|
|
541
|
+
* @since v4.0.0
|
|
505
542
|
*/
|
|
506
543
|
rowIdColumnName?: string;
|
|
507
544
|
}
|
|
@@ -606,21 +643,29 @@ export type DpcTabularSave = {
|
|
|
606
643
|
/**
|
|
607
644
|
* The name of the database table out to which the Store Table should be
|
|
608
645
|
* saved.
|
|
646
|
+
* @category Configuration
|
|
647
|
+
* @since v4.0.0
|
|
609
648
|
*/
|
|
610
649
|
tableName: string;
|
|
611
650
|
/**
|
|
612
651
|
* The optional name of the column in the database table that will be
|
|
613
652
|
* used to save the Row Ids from the Store Table, defaulting to '_id'.
|
|
653
|
+
* @category Configuration
|
|
654
|
+
* @since v4.0.0
|
|
614
655
|
*/
|
|
615
656
|
rowIdColumnName?: string;
|
|
616
657
|
/**
|
|
617
658
|
* Whether columns in the database table will be removed if they are
|
|
618
659
|
* empty in the Store Table, defaulting to false.
|
|
660
|
+
* @category Configuration
|
|
661
|
+
* @since v4.0.0
|
|
619
662
|
*/
|
|
620
663
|
deleteEmptyColumns?: boolean;
|
|
621
664
|
/**
|
|
622
665
|
* Whether tables in the database will be removed if the Store Table is
|
|
623
666
|
* empty, defaulting to false.
|
|
667
|
+
* @category Configuration
|
|
668
|
+
* @since v4.0.0
|
|
624
669
|
*/
|
|
625
670
|
deleteEmptyTable?: boolean;
|
|
626
671
|
}
|
|
@@ -659,15 +704,21 @@ export type DpcTabularSave = {
|
|
|
659
704
|
export type DpcTabularValues = {
|
|
660
705
|
/**
|
|
661
706
|
* Whether Store Values will be loaded from a database table.
|
|
707
|
+
* @category Configuration
|
|
708
|
+
* @since v4.0.0
|
|
662
709
|
*/
|
|
663
710
|
load?: boolean;
|
|
664
711
|
/**
|
|
665
712
|
* Whether Store Values will be saved to a database table.
|
|
713
|
+
* @category Configuration
|
|
714
|
+
* @since v4.0.0
|
|
666
715
|
*/
|
|
667
716
|
save?: boolean;
|
|
668
717
|
/**
|
|
669
718
|
* The optional name of the database table from and to which the Store Values
|
|
670
719
|
* should be loaded or saved, defaulting to `tinybase_values`.
|
|
720
|
+
* @category Configuration
|
|
721
|
+
* @since v4.0.0
|
|
671
722
|
*/
|
|
672
723
|
tableName?: string;
|
|
673
724
|
};
|
|
@@ -786,6 +837,7 @@ export type DpcTabularValues = {
|
|
|
786
837
|
* sessionStorage.clear();
|
|
787
838
|
* ```
|
|
788
839
|
* @category Persister
|
|
840
|
+
* @since v1.0.0
|
|
789
841
|
*/
|
|
790
842
|
export interface Persister<Persist extends Persists = Persists.StoreOnly> {
|
|
791
843
|
//
|
|
@@ -851,6 +903,7 @@ export interface Persister<Persist extends Persists = Persists.StoreOnly> {
|
|
|
851
903
|
* sessionStorage.clear();
|
|
852
904
|
* ```
|
|
853
905
|
* @category Load
|
|
906
|
+
* @since v1.0.0
|
|
854
907
|
*/
|
|
855
908
|
load(initialContent?: Content): Promise<this>;
|
|
856
909
|
|
|
@@ -907,6 +960,7 @@ export interface Persister<Persist extends Persists = Persists.StoreOnly> {
|
|
|
907
960
|
* sessionStorage.clear();
|
|
908
961
|
* ```
|
|
909
962
|
* @category Load
|
|
963
|
+
* @since v1.0.0
|
|
910
964
|
*/
|
|
911
965
|
startAutoLoad(initialContent?: Content): Promise<this>;
|
|
912
966
|
|
|
@@ -954,6 +1008,7 @@ export interface Persister<Persist extends Persists = Persists.StoreOnly> {
|
|
|
954
1008
|
* sessionStorage.clear();
|
|
955
1009
|
* ```
|
|
956
1010
|
* @category Load
|
|
1011
|
+
* @since v1.0.0
|
|
957
1012
|
*/
|
|
958
1013
|
stopAutoLoad(): this;
|
|
959
1014
|
|
|
@@ -1015,6 +1070,7 @@ export interface Persister<Persist extends Persists = Persists.StoreOnly> {
|
|
|
1015
1070
|
* sessionStorage.clear();
|
|
1016
1071
|
* ```
|
|
1017
1072
|
* @category Save
|
|
1073
|
+
* @since v1.0.0
|
|
1018
1074
|
*/
|
|
1019
1075
|
save(): Promise<this>;
|
|
1020
1076
|
|
|
@@ -1055,6 +1111,7 @@ export interface Persister<Persist extends Persists = Persists.StoreOnly> {
|
|
|
1055
1111
|
* sessionStorage.clear();
|
|
1056
1112
|
* ```
|
|
1057
1113
|
* @category Save
|
|
1114
|
+
* @since v1.0.0
|
|
1058
1115
|
*/
|
|
1059
1116
|
startAutoSave(): Promise<this>;
|
|
1060
1117
|
|
|
@@ -1095,6 +1152,7 @@ export interface Persister<Persist extends Persists = Persists.StoreOnly> {
|
|
|
1095
1152
|
* sessionStorage.clear();
|
|
1096
1153
|
* ```
|
|
1097
1154
|
* @category Save
|
|
1155
|
+
* @since v1.0.0
|
|
1098
1156
|
*/
|
|
1099
1157
|
stopAutoSave(): this;
|
|
1100
1158
|
|
|
@@ -1201,6 +1259,7 @@ export interface Persister<Persist extends Persists = Persists.StoreOnly> {
|
|
|
1201
1259
|
* sessionStorage.clear();
|
|
1202
1260
|
* ```
|
|
1203
1261
|
* @category Getter
|
|
1262
|
+
* @since v1.0.0
|
|
1204
1263
|
*/
|
|
1205
1264
|
getStore(): PersistedStore<Persist>;
|
|
1206
1265
|
|
|
@@ -1234,6 +1293,7 @@ export interface Persister<Persist extends Persists = Persists.StoreOnly> {
|
|
|
1234
1293
|
* // -> 0
|
|
1235
1294
|
* ```
|
|
1236
1295
|
* @category Lifecycle
|
|
1296
|
+
* @since v1.0.0
|
|
1237
1297
|
*/
|
|
1238
1298
|
destroy(): this;
|
|
1239
1299
|
|
|
@@ -1279,6 +1339,7 @@ export interface Persister<Persist extends Persists = Persists.StoreOnly> {
|
|
|
1279
1339
|
* sessionStorage.clear();
|
|
1280
1340
|
* ```
|
|
1281
1341
|
* @category Development
|
|
1342
|
+
* @since v1.0.0
|
|
1282
1343
|
*/
|
|
1283
1344
|
getStats(): PersisterStats;
|
|
1284
1345
|
//
|
|
@@ -1437,6 +1498,7 @@ export interface Persister<Persist extends Persists = Persists.StoreOnly> {
|
|
|
1437
1498
|
* mergeableStorePersister.destroy();
|
|
1438
1499
|
* ```
|
|
1439
1500
|
* @category Creation
|
|
1501
|
+
* @since v1.0.0
|
|
1440
1502
|
*/
|
|
1441
1503
|
export function createCustomPersister<
|
|
1442
1504
|
ListeningHandle,
|