tinybase 7.0.0-beta.0 → 7.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.
- package/@types/mergeable-store/index.d.ts +1 -0
- package/@types/mergeable-store/with-schemas/index.d.ts +4 -2
- package/@types/omni/index.d.ts +3 -0
- package/@types/omni/with-schemas/index.d.ts +3 -0
- package/@types/persisters/index.d.ts +8 -2
- package/@types/persisters/persister-automerge/index.d.ts +4 -6
- package/@types/persisters/persister-automerge/with-schemas/index.d.ts +7 -8
- package/@types/persisters/persister-browser/index.d.ts +97 -6
- package/@types/persisters/persister-browser/with-schemas/index.d.ts +113 -6
- package/@types/persisters/persister-cr-sqlite-wasm/with-schemas/index.d.ts +3 -2
- package/@types/persisters/persister-durable-object-sql-storage/index.d.ts +348 -0
- package/@types/persisters/persister-durable-object-sql-storage/with-schemas/index.d.ts +382 -0
- package/@types/persisters/persister-durable-object-storage/index.d.ts +1 -2
- package/@types/persisters/persister-durable-object-storage/with-schemas/index.d.ts +3 -2
- package/@types/persisters/persister-electric-sql/with-schemas/index.d.ts +3 -2
- package/@types/persisters/persister-expo-sqlite/index.d.ts +1 -2
- package/@types/persisters/persister-expo-sqlite/with-schemas/index.d.ts +3 -2
- package/@types/persisters/persister-file/index.d.ts +1 -2
- package/@types/persisters/persister-file/with-schemas/index.d.ts +3 -2
- package/@types/persisters/persister-indexed-db/with-schemas/index.d.ts +3 -2
- package/@types/persisters/persister-libsql/with-schemas/index.d.ts +3 -2
- package/@types/persisters/persister-partykit-client/with-schemas/index.d.ts +3 -2
- package/@types/persisters/persister-pglite/index.d.ts +2 -2
- package/@types/persisters/persister-pglite/with-schemas/index.d.ts +4 -2
- package/@types/persisters/persister-postgres/index.d.ts +1 -2
- package/@types/persisters/persister-postgres/with-schemas/index.d.ts +3 -2
- package/@types/persisters/persister-powersync/with-schemas/index.d.ts +3 -2
- package/@types/persisters/persister-react-native-mmkv/index.d.ts +117 -0
- package/@types/persisters/persister-react-native-mmkv/with-schemas/index.d.ts +133 -0
- package/@types/persisters/persister-react-native-sqlite/index.d.ts +180 -0
- package/@types/persisters/persister-react-native-sqlite/with-schemas/index.d.ts +203 -0
- package/@types/persisters/persister-remote/with-schemas/index.d.ts +3 -2
- package/@types/persisters/persister-sqlite-bun/index.d.ts +1 -2
- package/@types/persisters/persister-sqlite-bun/with-schemas/index.d.ts +3 -2
- package/@types/persisters/persister-sqlite-wasm/index.d.ts +2 -2
- package/@types/persisters/persister-sqlite-wasm/with-schemas/index.d.ts +4 -2
- package/@types/persisters/persister-sqlite3/index.d.ts +1 -2
- package/@types/persisters/persister-sqlite3/with-schemas/index.d.ts +3 -2
- package/@types/persisters/persister-yjs/with-schemas/index.d.ts +3 -2
- package/@types/persisters/with-schemas/index.d.ts +8 -2
- package/@types/queries/index.d.ts +1 -1
- package/@types/queries/with-schemas/index.d.ts +5 -9
- package/@types/store/index.d.ts +13 -0
- package/@types/store/with-schemas/index.d.ts +13 -0
- package/@types/synchronizers/index.d.ts +1 -0
- package/@types/synchronizers/synchronizer-broadcast-channel/with-schemas/index.d.ts +3 -2
- package/@types/synchronizers/synchronizer-local/with-schemas/index.d.ts +3 -2
- package/@types/synchronizers/synchronizer-ws-client/index.d.ts +4 -2
- package/@types/synchronizers/synchronizer-ws-client/with-schemas/index.d.ts +1 -0
- package/@types/synchronizers/synchronizer-ws-server/index.d.ts +7 -7
- package/@types/synchronizers/synchronizer-ws-server/with-schemas/index.d.ts +7 -7
- package/@types/synchronizers/synchronizer-ws-server-durable-object/index.d.ts +1 -0
- package/@types/synchronizers/synchronizer-ws-server-durable-object/with-schemas/index.d.ts +1 -0
- package/@types/synchronizers/synchronizer-ws-server-simple/index.d.ts +1 -1
- package/@types/synchronizers/synchronizer-ws-server-simple/with-schemas/index.d.ts +1 -1
- package/@types/synchronizers/with-schemas/index.d.ts +4 -2
- package/@types/ui-react/index.d.ts +6 -1
- package/@types/ui-react/with-schemas/index.d.ts +6 -1
- package/@types/ui-react-dom/index.d.ts +153 -20
- package/@types/ui-react-dom/with-schemas/index.d.ts +72 -20
- package/@types/ui-react-inspector/index.d.ts +8 -0
- package/@types/ui-react-inspector/with-schemas/index.d.ts +27 -1925
- package/LICENSE +1 -1
- package/agents.md +281 -0
- package/common/index.js +1 -1
- package/common/with-schemas/index.js +1 -1
- package/index.js +1 -1
- package/mergeable-store/index.js +1 -1
- package/mergeable-store/with-schemas/index.js +1 -1
- package/min/checkpoints/index.js +1 -1
- package/min/checkpoints/index.js.gz +0 -0
- package/min/checkpoints/with-schemas/index.js +1 -1
- package/min/checkpoints/with-schemas/index.js.gz +0 -0
- package/min/common/index.js +1 -1
- package/min/common/index.js.gz +0 -0
- package/min/common/with-schemas/index.js +1 -1
- package/min/common/with-schemas/index.js.gz +0 -0
- package/min/index.js +1 -1
- package/min/index.js.gz +0 -0
- package/min/indexes/index.js +1 -1
- package/min/indexes/index.js.gz +0 -0
- package/min/indexes/with-schemas/index.js +1 -1
- package/min/indexes/with-schemas/index.js.gz +0 -0
- package/min/mergeable-store/index.js +1 -1
- package/min/mergeable-store/index.js.gz +0 -0
- package/min/mergeable-store/with-schemas/index.js +1 -1
- package/min/mergeable-store/with-schemas/index.js.gz +0 -0
- package/min/metrics/index.js +1 -1
- package/min/metrics/index.js.gz +0 -0
- package/min/metrics/with-schemas/index.js +1 -1
- package/min/metrics/with-schemas/index.js.gz +0 -0
- package/min/omni/index.js +1 -1
- package/min/omni/index.js.gz +0 -0
- package/min/omni/with-schemas/index.js +1 -1
- package/min/omni/with-schemas/index.js.gz +0 -0
- package/min/persisters/index.js +1 -1
- package/min/persisters/index.js.gz +0 -0
- package/min/persisters/persister-automerge/index.js +1 -1
- package/min/persisters/persister-automerge/index.js.gz +0 -0
- package/min/persisters/persister-automerge/with-schemas/index.js +1 -1
- package/min/persisters/persister-automerge/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-browser/index.js +1 -1
- package/min/persisters/persister-browser/index.js.gz +0 -0
- package/min/persisters/persister-browser/with-schemas/index.js +1 -1
- package/min/persisters/persister-browser/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-cr-sqlite-wasm/index.js +1 -1
- package/min/persisters/persister-cr-sqlite-wasm/index.js.gz +0 -0
- package/min/persisters/persister-cr-sqlite-wasm/with-schemas/index.js +1 -1
- package/min/persisters/persister-cr-sqlite-wasm/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-durable-object-sql-storage/index.js +1 -0
- package/min/persisters/persister-durable-object-sql-storage/index.js.gz +0 -0
- package/min/persisters/persister-durable-object-sql-storage/with-schemas/index.js +1 -0
- package/min/persisters/persister-durable-object-sql-storage/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-durable-object-storage/index.js +1 -1
- package/min/persisters/persister-durable-object-storage/index.js.gz +0 -0
- package/min/persisters/persister-durable-object-storage/with-schemas/index.js +1 -1
- package/min/persisters/persister-durable-object-storage/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-electric-sql/index.js +1 -1
- package/min/persisters/persister-electric-sql/index.js.gz +0 -0
- package/min/persisters/persister-electric-sql/with-schemas/index.js +1 -1
- package/min/persisters/persister-electric-sql/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-expo-sqlite/index.js +1 -1
- package/min/persisters/persister-expo-sqlite/index.js.gz +0 -0
- package/min/persisters/persister-expo-sqlite/with-schemas/index.js +1 -1
- package/min/persisters/persister-expo-sqlite/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-file/index.js +1 -1
- package/min/persisters/persister-file/index.js.gz +0 -0
- package/min/persisters/persister-file/with-schemas/index.js +1 -1
- package/min/persisters/persister-file/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-indexed-db/index.js +1 -1
- package/min/persisters/persister-indexed-db/index.js.gz +0 -0
- package/min/persisters/persister-indexed-db/with-schemas/index.js +1 -1
- package/min/persisters/persister-indexed-db/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-libsql/index.js +1 -1
- package/min/persisters/persister-libsql/index.js.gz +0 -0
- package/min/persisters/persister-libsql/with-schemas/index.js +1 -1
- package/min/persisters/persister-libsql/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-partykit-client/index.js +1 -1
- package/min/persisters/persister-partykit-client/index.js.gz +0 -0
- package/min/persisters/persister-partykit-client/with-schemas/index.js +1 -1
- package/min/persisters/persister-partykit-client/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-partykit-server/index.js +1 -1
- package/min/persisters/persister-partykit-server/index.js.gz +0 -0
- package/min/persisters/persister-partykit-server/with-schemas/index.js +1 -1
- package/min/persisters/persister-partykit-server/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-pglite/index.js +1 -1
- package/min/persisters/persister-pglite/index.js.gz +0 -0
- package/min/persisters/persister-pglite/with-schemas/index.js +1 -1
- package/min/persisters/persister-pglite/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-postgres/index.js +1 -1
- package/min/persisters/persister-postgres/index.js.gz +0 -0
- package/min/persisters/persister-postgres/with-schemas/index.js +1 -1
- package/min/persisters/persister-postgres/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-powersync/index.js +1 -1
- package/min/persisters/persister-powersync/index.js.gz +0 -0
- package/min/persisters/persister-powersync/with-schemas/index.js +1 -1
- package/min/persisters/persister-powersync/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-react-native-mmkv/index.js +1 -0
- package/min/persisters/persister-react-native-mmkv/index.js.gz +0 -0
- package/min/persisters/persister-react-native-mmkv/with-schemas/index.js +1 -0
- package/min/persisters/persister-react-native-mmkv/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-react-native-sqlite/index.js +1 -0
- package/min/persisters/persister-react-native-sqlite/index.js.gz +0 -0
- package/min/persisters/persister-react-native-sqlite/with-schemas/index.js +1 -0
- package/min/persisters/persister-react-native-sqlite/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-remote/index.js +1 -1
- package/min/persisters/persister-remote/index.js.gz +0 -0
- package/min/persisters/persister-remote/with-schemas/index.js +1 -1
- package/min/persisters/persister-remote/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-sqlite-bun/index.js +1 -1
- package/min/persisters/persister-sqlite-bun/index.js.gz +0 -0
- package/min/persisters/persister-sqlite-bun/with-schemas/index.js +1 -1
- package/min/persisters/persister-sqlite-bun/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-sqlite-wasm/index.js +1 -1
- package/min/persisters/persister-sqlite-wasm/index.js.gz +0 -0
- package/min/persisters/persister-sqlite-wasm/with-schemas/index.js +1 -1
- package/min/persisters/persister-sqlite-wasm/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-sqlite3/index.js +1 -1
- package/min/persisters/persister-sqlite3/index.js.gz +0 -0
- package/min/persisters/persister-sqlite3/with-schemas/index.js +1 -1
- package/min/persisters/persister-sqlite3/with-schemas/index.js.gz +0 -0
- package/min/persisters/persister-yjs/index.js +1 -1
- package/min/persisters/persister-yjs/index.js.gz +0 -0
- package/min/persisters/persister-yjs/with-schemas/index.js +1 -1
- package/min/persisters/persister-yjs/with-schemas/index.js.gz +0 -0
- package/min/persisters/with-schemas/index.js +1 -1
- package/min/persisters/with-schemas/index.js.gz +0 -0
- package/min/queries/index.js +1 -1
- package/min/queries/index.js.gz +0 -0
- package/min/queries/with-schemas/index.js +1 -1
- package/min/queries/with-schemas/index.js.gz +0 -0
- package/min/relationships/index.js +1 -1
- package/min/relationships/index.js.gz +0 -0
- package/min/relationships/with-schemas/index.js +1 -1
- package/min/relationships/with-schemas/index.js.gz +0 -0
- package/min/store/index.js +1 -1
- package/min/store/index.js.gz +0 -0
- package/min/store/with-schemas/index.js +1 -1
- package/min/store/with-schemas/index.js.gz +0 -0
- package/min/synchronizers/index.js +1 -1
- package/min/synchronizers/index.js.gz +0 -0
- package/min/synchronizers/synchronizer-broadcast-channel/index.js +1 -1
- package/min/synchronizers/synchronizer-broadcast-channel/index.js.gz +0 -0
- package/min/synchronizers/synchronizer-broadcast-channel/with-schemas/index.js +1 -1
- package/min/synchronizers/synchronizer-broadcast-channel/with-schemas/index.js.gz +0 -0
- package/min/synchronizers/synchronizer-local/index.js +1 -1
- package/min/synchronizers/synchronizer-local/index.js.gz +0 -0
- package/min/synchronizers/synchronizer-local/with-schemas/index.js +1 -1
- package/min/synchronizers/synchronizer-local/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/min/synchronizers/synchronizer-ws-server/index.js +1 -1
- package/min/synchronizers/synchronizer-ws-server/index.js.gz +0 -0
- package/min/synchronizers/synchronizer-ws-server/with-schemas/index.js +1 -1
- package/min/synchronizers/synchronizer-ws-server/with-schemas/index.js.gz +0 -0
- package/min/synchronizers/synchronizer-ws-server-durable-object/index.js +1 -1
- package/min/synchronizers/synchronizer-ws-server-durable-object/index.js.gz +0 -0
- package/min/synchronizers/synchronizer-ws-server-durable-object/with-schemas/index.js +1 -1
- package/min/synchronizers/synchronizer-ws-server-durable-object/with-schemas/index.js.gz +0 -0
- package/min/synchronizers/synchronizer-ws-server-simple/index.js +1 -1
- package/min/synchronizers/synchronizer-ws-server-simple/index.js.gz +0 -0
- package/min/synchronizers/synchronizer-ws-server-simple/with-schemas/index.js +1 -1
- package/min/synchronizers/synchronizer-ws-server-simple/with-schemas/index.js.gz +0 -0
- package/min/synchronizers/with-schemas/index.js +1 -1
- package/min/synchronizers/with-schemas/index.js.gz +0 -0
- package/min/ui-react/index.js +1 -1
- package/min/ui-react/index.js.gz +0 -0
- package/min/ui-react/with-schemas/index.js +1 -1
- package/min/ui-react/with-schemas/index.js.gz +0 -0
- package/min/ui-react-dom/index.js +1 -1
- package/min/ui-react-dom/index.js.gz +0 -0
- package/min/ui-react-dom/with-schemas/index.js +1 -1
- package/min/ui-react-dom/with-schemas/index.js.gz +0 -0
- package/min/ui-react-inspector/index.js +1 -1
- package/min/ui-react-inspector/index.js.gz +0 -0
- package/min/ui-react-inspector/with-schemas/index.js +1 -1
- package/min/ui-react-inspector/with-schemas/index.js.gz +0 -0
- package/min/with-schemas/index.js +1 -1
- package/min/with-schemas/index.js.gz +0 -0
- package/omni/index.js +2107 -1163
- package/omni/with-schemas/index.js +2107 -1163
- package/package.json +127 -11
- package/persisters/persister-automerge/index.js +1 -1
- package/persisters/persister-automerge/with-schemas/index.js +1 -1
- package/persisters/persister-browser/index.js +31 -2
- package/persisters/persister-browser/with-schemas/index.js +31 -2
- package/persisters/persister-durable-object-sql-storage/index.js +1391 -0
- package/persisters/persister-durable-object-sql-storage/with-schemas/index.js +1391 -0
- package/persisters/persister-react-native-mmkv/index.js +459 -0
- package/persisters/persister-react-native-mmkv/with-schemas/index.js +459 -0
- package/persisters/persister-react-native-sqlite/index.js +1189 -0
- package/persisters/persister-react-native-sqlite/with-schemas/index.js +1189 -0
- package/readme.md +13 -13
- package/releases.md +110 -35
- package/synchronizers/index.js +1 -1
- package/synchronizers/synchronizer-broadcast-channel/index.js +1 -1
- package/synchronizers/synchronizer-broadcast-channel/with-schemas/index.js +1 -1
- package/synchronizers/synchronizer-local/index.js +1 -1
- package/synchronizers/synchronizer-local/with-schemas/index.js +1 -1
- package/synchronizers/synchronizer-ws-client/index.js +1 -1
- package/synchronizers/synchronizer-ws-client/with-schemas/index.js +1 -1
- package/synchronizers/synchronizer-ws-server/index.js +1 -1
- package/synchronizers/synchronizer-ws-server/with-schemas/index.js +1 -1
- package/synchronizers/synchronizer-ws-server-durable-object/index.js +1 -1
- package/synchronizers/synchronizer-ws-server-durable-object/with-schemas/index.js +1 -1
- package/synchronizers/with-schemas/index.js +1 -1
- package/ui-react/index.js +397 -368
- package/ui-react/with-schemas/index.js +397 -368
- package/ui-react-dom/index.js +873 -436
- package/ui-react-dom/with-schemas/index.js +873 -436
- package/ui-react-inspector/index.js +1721 -545
- package/ui-react-inspector/with-schemas/index.js +1721 -545
- package/with-schemas/index.js +1 -1
|
@@ -0,0 +1,382 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The persister-durable-object-sql-storage module of the TinyBase project lets
|
|
3
|
+
* you save and load Store data to and from Cloudflare Durable Object SQLite
|
|
4
|
+
* storage (in an appropriate environment).
|
|
5
|
+
*
|
|
6
|
+
* Cloudflare's SQLite storage backend for Durable Objects offers significantly
|
|
7
|
+
* better pricing compared to the key-value storage backend. The SQLite storage
|
|
8
|
+
* backend is Cloudflare's recommended storage option for new Durable Object
|
|
9
|
+
* namespaces.
|
|
10
|
+
*
|
|
11
|
+
* **Important:** Before using this persister, you must configure your Durable
|
|
12
|
+
* Object class to use SQLite storage by adding a migration to your
|
|
13
|
+
* `wrangler.toml` or `wrangler.json` configuration file. Use
|
|
14
|
+
* `new_sqlite_classes` in your migration configuration to enable SQLite storage
|
|
15
|
+
* for your Durable Object class.
|
|
16
|
+
*
|
|
17
|
+
* See [Cloudflare's
|
|
18
|
+
* documentation](https://developers.cloudflare.com/durable-objects/reference/durable-objects-migrations/)
|
|
19
|
+
* for more details.
|
|
20
|
+
* @see Cloudflare Durable Objects guide
|
|
21
|
+
* @see Persistence guides
|
|
22
|
+
* @packageDocumentation
|
|
23
|
+
* @module persister-durable-object-sql-storage
|
|
24
|
+
* @since v6.3.0
|
|
25
|
+
*/
|
|
26
|
+
import type {MergeableStore} from '../../../mergeable-store/with-schemas/index.d.ts';
|
|
27
|
+
import type {
|
|
28
|
+
OptionalSchemas,
|
|
29
|
+
Store,
|
|
30
|
+
} from '../../../store/with-schemas/index.d.ts';
|
|
31
|
+
import type {
|
|
32
|
+
DatabasePersisterConfig,
|
|
33
|
+
Persister,
|
|
34
|
+
Persists,
|
|
35
|
+
} from '../../with-schemas/index.d.ts';
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* The DpcFragmented type represents the configuration for fragmented
|
|
39
|
+
* persistence mode in a DurableObjectSqlStoragePersister.
|
|
40
|
+
*
|
|
41
|
+
* This mode stores each table, row, cell, and value as separate database rows,
|
|
42
|
+
* avoiding Cloudflare's 2MB row limit that can be hit with large stores in JSON
|
|
43
|
+
* mode. While this creates more database writes, it provides better scalability
|
|
44
|
+
* for larger datasets.
|
|
45
|
+
* @example
|
|
46
|
+
* This example shows how to configure a DurableObjectSqlStoragePersister to use
|
|
47
|
+
* fragmented mode with a custom storage prefix.
|
|
48
|
+
*
|
|
49
|
+
* ```js yolo
|
|
50
|
+
* import {createMergeableStore} from 'tinybase';
|
|
51
|
+
* import {createDurableObjectSqlStoragePersister} from 'tinybase/persisters/persister-durable-object-sql-storage';
|
|
52
|
+
* import {WsServerDurableObject} from 'tinybase/synchronizers/synchronizer-ws-server-durable-object';
|
|
53
|
+
*
|
|
54
|
+
* const config = {
|
|
55
|
+
* mode: 'fragmented',
|
|
56
|
+
* storagePrefix: 'my_app_',
|
|
57
|
+
* };
|
|
58
|
+
*
|
|
59
|
+
* export class MyDurableObject extends WsServerDurableObject {
|
|
60
|
+
* createPersister() {
|
|
61
|
+
* const store = createMergeableStore();
|
|
62
|
+
* const persister = createDurableObjectSqlStoragePersister(
|
|
63
|
+
* store,
|
|
64
|
+
* this.ctx.storage.sql,
|
|
65
|
+
* config,
|
|
66
|
+
* );
|
|
67
|
+
* return persister;
|
|
68
|
+
* }
|
|
69
|
+
* }
|
|
70
|
+
* ```
|
|
71
|
+
* @category Configuration
|
|
72
|
+
* @since v6.3.0
|
|
73
|
+
*/
|
|
74
|
+
export type DpcFragmented = {
|
|
75
|
+
/**
|
|
76
|
+
* The mode property must be set to 'fragmented' to enable fragmented
|
|
77
|
+
* persistence mode.
|
|
78
|
+
* @category Configuration
|
|
79
|
+
* @since v6.3.0
|
|
80
|
+
*/
|
|
81
|
+
mode: 'fragmented';
|
|
82
|
+
/**
|
|
83
|
+
* The storagePrefix property lets you specify an optional prefix for the
|
|
84
|
+
* database table names used in fragmented mode.
|
|
85
|
+
*
|
|
86
|
+
* This is useful when you have multiple stores or applications sharing the
|
|
87
|
+
* same Durable Object SQL storage and want to avoid table name conflicts.
|
|
88
|
+
*
|
|
89
|
+
* The prefix will be sanitized to only include alphanumeric characters and
|
|
90
|
+
* underscores. For example, a prefix of 'my-app!' becomes 'my_app_'.
|
|
91
|
+
* @example
|
|
92
|
+
* This example shows a configuration using the storagePrefix setting. With a
|
|
93
|
+
* `storagePrefix` of 'user_data_', it creates `user_data_tinybase_tables` and
|
|
94
|
+
* `user_data_tinybase_values` tables.
|
|
95
|
+
* ```json
|
|
96
|
+
* {
|
|
97
|
+
* mode: 'fragmented',
|
|
98
|
+
* storagePrefix: 'user_data_',
|
|
99
|
+
* };
|
|
100
|
+
* ```
|
|
101
|
+
* @category Configuration
|
|
102
|
+
* @since v6.3.0
|
|
103
|
+
*/
|
|
104
|
+
storagePrefix?: string;
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* The DurableObjectSqlDatabasePersisterConfig type represents the union of all
|
|
109
|
+
* possible configuration types for a DurableObjectSqlStoragePersister.
|
|
110
|
+
*
|
|
111
|
+
* This has schema-based typing. The following is a simplified representation:
|
|
112
|
+
*
|
|
113
|
+
* ```ts override
|
|
114
|
+
* DpcJson | DpcFragmented;
|
|
115
|
+
* ```
|
|
116
|
+
*
|
|
117
|
+
* This allows the persister to support multiple persistence modes.
|
|
118
|
+
* - JSON mode (via DpcJson): Stores the entire Store as JSON in a single row.
|
|
119
|
+
* - Fragmented mode (via DpcFragmented): Stores each piece of data as separate
|
|
120
|
+
* rows.
|
|
121
|
+
* @example
|
|
122
|
+
* These examples show some different configuration options.
|
|
123
|
+
* ```json
|
|
124
|
+
* // JSON mode (default)
|
|
125
|
+
* {
|
|
126
|
+
* mode: 'json',
|
|
127
|
+
* storeTableName: 'my_store',
|
|
128
|
+
* };
|
|
129
|
+
*
|
|
130
|
+
* // Fragmented mode
|
|
131
|
+
* {
|
|
132
|
+
* mode: 'fragmented',
|
|
133
|
+
* storagePrefix: 'app_',
|
|
134
|
+
* };
|
|
135
|
+
* ```
|
|
136
|
+
* @category Configuration
|
|
137
|
+
* @since v6.3.0
|
|
138
|
+
*/
|
|
139
|
+
export type DurableObjectSqlDatabasePersisterConfig<
|
|
140
|
+
Schemas extends OptionalSchemas,
|
|
141
|
+
> = DatabasePersisterConfig<Schemas> | DpcFragmented;
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* The DurableObjectSqlStoragePersister interface represents a Persister that
|
|
145
|
+
* lets you save and load Store data to and from Cloudflare Durable Object SQL
|
|
146
|
+
* storage.
|
|
147
|
+
*
|
|
148
|
+
* You should use the createDurableObjectSqlStoragePersister function to create
|
|
149
|
+
* a DurableObjectSqlStoragePersister object, most likely within the
|
|
150
|
+
* createPersister method of a WsServerDurableObject.
|
|
151
|
+
*
|
|
152
|
+
* It is a minor extension to the Persister interface and simply provides an
|
|
153
|
+
* extra getSqlStorage method for accessing a reference to the SQL storage that
|
|
154
|
+
* the Store is being persisted to.
|
|
155
|
+
* @category Persister
|
|
156
|
+
* @since v6.3.0
|
|
157
|
+
*/
|
|
158
|
+
export interface DurableObjectSqlStoragePersister<
|
|
159
|
+
Schemas extends OptionalSchemas,
|
|
160
|
+
> extends Persister<Schemas, Persists.MergeableStoreOnly> {
|
|
161
|
+
/**
|
|
162
|
+
* The getSqlStorage method returns a reference to the SQL storage that the
|
|
163
|
+
* Store is being persisted to.
|
|
164
|
+
* @returns The reference to the SQL storage.
|
|
165
|
+
* @example
|
|
166
|
+
* This example creates a Persister object against a newly-created Store
|
|
167
|
+
* (within the createPersister method of a WsServerDurableObject instance) and
|
|
168
|
+
* then gets the SQL storage reference back out again.
|
|
169
|
+
*
|
|
170
|
+
* ```js yolo
|
|
171
|
+
* import {createMergeableStore} from 'tinybase';
|
|
172
|
+
* import {createDurableObjectSqlStoragePersister} from 'tinybase/persisters/persister-durable-object-sql-storage';
|
|
173
|
+
* import {WsServerDurableObject} from 'tinybase/synchronizers/synchronizer-ws-server-durable-object';
|
|
174
|
+
*
|
|
175
|
+
* export class MyDurableObject extends WsServerDurableObject {
|
|
176
|
+
* createPersister() {
|
|
177
|
+
* const store = createMergeableStore();
|
|
178
|
+
* const persister = createDurableObjectSqlStoragePersister(
|
|
179
|
+
* store,
|
|
180
|
+
* this.ctx.storage.sql,
|
|
181
|
+
* );
|
|
182
|
+
* console.log(persister.getSqlStorage() == this.ctx.storage.sql);
|
|
183
|
+
* // -> true
|
|
184
|
+
*
|
|
185
|
+
* return persister;
|
|
186
|
+
* }
|
|
187
|
+
* }
|
|
188
|
+
* ```
|
|
189
|
+
* @category Getter
|
|
190
|
+
* @since v6.3.0
|
|
191
|
+
*/
|
|
192
|
+
getSqlStorage(): SqlStorage;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* The createDurableObjectSqlStoragePersister function creates a
|
|
197
|
+
* DurableObjectSqlStoragePersister object that can persist the Store to and
|
|
198
|
+
* from Cloudflare Durable Object SQLite storage.
|
|
199
|
+
*
|
|
200
|
+
* This has schema-based typing. The following is a simplified representation:
|
|
201
|
+
*
|
|
202
|
+
* ```ts override
|
|
203
|
+
* createDurableObjectSqlStoragePersister(
|
|
204
|
+
* store: MergeableStore,
|
|
205
|
+
* sqlStorage: SqlStorage,
|
|
206
|
+
* configOrStoreTableName?: DurableObjectSqlDatabasePersisterConfig | string,
|
|
207
|
+
* onSqlCommand?: (sql: string, params?: any[]) => void,
|
|
208
|
+
* onIgnoredError?: (error: any) => void,
|
|
209
|
+
* ): DurableObjectSqlStoragePersister;
|
|
210
|
+
* ```
|
|
211
|
+
*
|
|
212
|
+
* You will mostly use this within the createPersister method of a
|
|
213
|
+
* WsServerDurableObject.
|
|
214
|
+
*
|
|
215
|
+
* This persister uses Cloudflare's SQLite storage backend, which provides
|
|
216
|
+
* better pricing and performance compared to the legacy Key-value storage
|
|
217
|
+
* backend.
|
|
218
|
+
*
|
|
219
|
+
* **Important Prerequisites:** Before using this persister, you must configure
|
|
220
|
+
* your Durable Object class to use SQLite storage by adding a migration to your
|
|
221
|
+
* Wrangler configuration file. In your `wrangler.toml`, add the following.
|
|
222
|
+
* ```toml
|
|
223
|
+
* [[migrations]]
|
|
224
|
+
* tag = "v1"
|
|
225
|
+
* new_sqlite_classes = ["YourDurableObjectClass"]
|
|
226
|
+
* ```
|
|
227
|
+
*
|
|
228
|
+
* Or in your `wrangler.json`, add:
|
|
229
|
+
*
|
|
230
|
+
* ```json
|
|
231
|
+
* {
|
|
232
|
+
* "migrations": [
|
|
233
|
+
* {
|
|
234
|
+
* "tag": "v1",
|
|
235
|
+
* "new_sqlite_classes": ["YourDurableObjectClass"]
|
|
236
|
+
* }
|
|
237
|
+
* ]
|
|
238
|
+
* }
|
|
239
|
+
* ```
|
|
240
|
+
*
|
|
241
|
+
* For more details on Durable Object migrations, see the [Cloudflare
|
|
242
|
+
* documentation](https://developers.cloudflare.com/durable-objects/reference/durable-objects-migrations/).
|
|
243
|
+
*
|
|
244
|
+
* A database Persister uses one of two modes: either a JSON serialization of
|
|
245
|
+
* the whole Store stored in a single row of a table (the default), a fragmented
|
|
246
|
+
* mode that stores each piece of data separately to avoid Cloudflare's 2MB row
|
|
247
|
+
* limit.
|
|
248
|
+
*
|
|
249
|
+
* - **JSON Mode (Default)**: Stores the entire Store as JSON in a single
|
|
250
|
+
* database row. This is efficient for smaller stores but may hit Cloudflare's
|
|
251
|
+
* 2MB row limit for very large stores and uses fewer database writes.
|
|
252
|
+
*
|
|
253
|
+
* - **Fragmented Mode**: Stores each table, row, cell, and value as separate
|
|
254
|
+
* database rows. Use this mode if you're concerned about hitting Cloudflare's
|
|
255
|
+
* 2MB row limit with large stores in JSON mode. This mode creates more
|
|
256
|
+
* database writes but avoids row size limitations.
|
|
257
|
+
*
|
|
258
|
+
* The third argument is a DatabasePersisterConfig object that configures which
|
|
259
|
+
* of those modes to use, and settings for each. If the third argument is simply
|
|
260
|
+
* a string, it is used as the `storeTableName` property of the JSON
|
|
261
|
+
* serialization. If it is the string 'fragmented', it enables fragmented mode.
|
|
262
|
+
*
|
|
263
|
+
* See the documentation for the DpcJson, DpcFragmented, and DpcTabular types
|
|
264
|
+
* for more information on how all of those modes can be configured.
|
|
265
|
+
*
|
|
266
|
+
* As well as providing a reference to the Store or MergeableStore to persist,
|
|
267
|
+
* you must provide a `sqlStorage` parameter which identifies the Durable Object
|
|
268
|
+
* SQLite storage to persist it to.
|
|
269
|
+
* @param store The Store or MergeableStore to persist.
|
|
270
|
+
* @param sqlStorage The Durable Object SQL storage to persist the Store to.
|
|
271
|
+
* @param configOrStoreTableName A DatabasePersisterConfig to configure the
|
|
272
|
+
* persistence mode (or a string to set the `storeTableName` property of the
|
|
273
|
+
* JSON serialization).
|
|
274
|
+
* @param onSqlCommand An optional handler called every time the Persister
|
|
275
|
+
* executes a SQL command or query. This is suitable for logging persistence
|
|
276
|
+
* behavior in a development environment.
|
|
277
|
+
* @param onIgnoredError An optional handler for the errors that the Persister
|
|
278
|
+
* would otherwise ignore when trying to save or load data. This is suitable for
|
|
279
|
+
* debugging persistence issues in a development environment.
|
|
280
|
+
* @returns A reference to the new DurableObjectSqlStoragePersister object.
|
|
281
|
+
* @example
|
|
282
|
+
* This example creates a DurableObjectSqlStoragePersister object and persists
|
|
283
|
+
* the Store to Durable Object SQLite storage as a JSON serialization into the
|
|
284
|
+
* default `tinybase` table. It uses this within the createPersister method of a
|
|
285
|
+
* WsServerDurableObject instance.
|
|
286
|
+
*
|
|
287
|
+
* ```js yolo
|
|
288
|
+
* import {createMergeableStore} from 'tinybase';
|
|
289
|
+
* import {createDurableObjectSqlStoragePersister} from 'tinybase/persisters/persister-durable-object-sql-storage';
|
|
290
|
+
* import {WsServerDurableObject} from 'tinybase/synchronizers/synchronizer-ws-server-durable-object';
|
|
291
|
+
*
|
|
292
|
+
* export class MyDurableObject extends WsServerDurableObject {
|
|
293
|
+
* createPersister() {
|
|
294
|
+
* const store = createMergeableStore();
|
|
295
|
+
* const persister = createDurableObjectSqlStoragePersister(
|
|
296
|
+
* store,
|
|
297
|
+
* this.ctx.storage.sql,
|
|
298
|
+
* );
|
|
299
|
+
* return persister;
|
|
300
|
+
* }
|
|
301
|
+
* }
|
|
302
|
+
* ```
|
|
303
|
+
* @example
|
|
304
|
+
* This example creates a DurableObjectSqlStoragePersister object with a custom
|
|
305
|
+
* table name and SQL command logging for debugging.
|
|
306
|
+
*
|
|
307
|
+
* ```js yolo
|
|
308
|
+
* import {createMergeableStore} from 'tinybase';
|
|
309
|
+
* import {createDurableObjectSqlStoragePersister} from 'tinybase/persisters/persister-durable-object-sql-storage';
|
|
310
|
+
* import {WsServerDurableObject} from 'tinybase/synchronizers/synchronizer-ws-server-durable-object';
|
|
311
|
+
*
|
|
312
|
+
* export class MyDurableObject extends WsServerDurableObject {
|
|
313
|
+
* createPersister() {
|
|
314
|
+
* const store = createMergeableStore();
|
|
315
|
+
* const persister = createDurableObjectSqlStoragePersister(
|
|
316
|
+
* store,
|
|
317
|
+
* this.ctx.storage.sql,
|
|
318
|
+
* 'my_app_store',
|
|
319
|
+
* (sql, params) => console.log('SQL:', sql, params),
|
|
320
|
+
* (error) => console.error('Persistence error:', error),
|
|
321
|
+
* );
|
|
322
|
+
* return persister;
|
|
323
|
+
* }
|
|
324
|
+
* }
|
|
325
|
+
* ```
|
|
326
|
+
* @example
|
|
327
|
+
* This example creates a DurableObjectSqlStoragePersister object using
|
|
328
|
+
* fragmented mode to avoid Cloudflare's 2MB row limit for large stores.
|
|
329
|
+
*
|
|
330
|
+
* ```js yolo
|
|
331
|
+
* import {createMergeableStore} from 'tinybase';
|
|
332
|
+
* import {createDurableObjectSqlStoragePersister} from 'tinybase/persisters/persister-durable-object-sql-storage';
|
|
333
|
+
* import {WsServerDurableObject} from 'tinybase/synchronizers/synchronizer-ws-server-durable-object';
|
|
334
|
+
*
|
|
335
|
+
* export class MyDurableObject extends WsServerDurableObject {
|
|
336
|
+
* createPersister() {
|
|
337
|
+
* const store = createMergeableStore();
|
|
338
|
+
* const persister = createDurableObjectSqlStoragePersister(
|
|
339
|
+
* store,
|
|
340
|
+
* this.ctx.storage.sql,
|
|
341
|
+
* {mode: 'fragmented'},
|
|
342
|
+
* );
|
|
343
|
+
* return persister;
|
|
344
|
+
* }
|
|
345
|
+
* }
|
|
346
|
+
* ```
|
|
347
|
+
* @example
|
|
348
|
+
* This example creates a DurableObjectSqlStoragePersister object using
|
|
349
|
+
* fragmented mode with a custom storage prefix.
|
|
350
|
+
*
|
|
351
|
+
* ```js yolo
|
|
352
|
+
* import {createMergeableStore} from 'tinybase';
|
|
353
|
+
* import {createDurableObjectSqlStoragePersister} from 'tinybase/persisters/persister-durable-object-sql-storage';
|
|
354
|
+
* import {WsServerDurableObject} from 'tinybase/synchronizers/synchronizer-ws-server-durable-object';
|
|
355
|
+
*
|
|
356
|
+
* export class MyDurableObject extends WsServerDurableObject {
|
|
357
|
+
* createPersister() {
|
|
358
|
+
* const store = createMergeableStore();
|
|
359
|
+
* const persister = createDurableObjectSqlStoragePersister(
|
|
360
|
+
* store,
|
|
361
|
+
* this.ctx.storage.sql,
|
|
362
|
+
* {mode: 'fragmented', storagePrefix: 'my_app_'},
|
|
363
|
+
* );
|
|
364
|
+
* return persister;
|
|
365
|
+
* }
|
|
366
|
+
* }
|
|
367
|
+
* ```
|
|
368
|
+
* @category Creation
|
|
369
|
+
* @essential Persisting stores
|
|
370
|
+
* @since v6.3.0
|
|
371
|
+
*/
|
|
372
|
+
export function createDurableObjectSqlStoragePersister<
|
|
373
|
+
Schemas extends OptionalSchemas,
|
|
374
|
+
>(
|
|
375
|
+
store: Store<Schemas> | MergeableStore<Schemas>,
|
|
376
|
+
sqlStorage: SqlStorage,
|
|
377
|
+
configOrStoreTableName?:
|
|
378
|
+
| DurableObjectSqlDatabasePersisterConfig<Schemas>
|
|
379
|
+
| string,
|
|
380
|
+
onSqlCommand?: (sql: string, params?: any[]) => void,
|
|
381
|
+
onIgnoredError?: (error: any) => void,
|
|
382
|
+
): DurableObjectSqlStoragePersister<Schemas>;
|
|
@@ -25,8 +25,7 @@ import type {Persister, Persists} from '../index.d.ts';
|
|
|
25
25
|
* @category Persister
|
|
26
26
|
* @since v5.4.0
|
|
27
27
|
*/
|
|
28
|
-
export interface DurableObjectStoragePersister
|
|
29
|
-
extends Persister<Persists.MergeableStoreOnly> {
|
|
28
|
+
export interface DurableObjectStoragePersister extends Persister<Persists.MergeableStoreOnly> {
|
|
30
29
|
/**
|
|
31
30
|
* The getStorage method returns a reference to the storage that the Store is
|
|
32
31
|
* being persisted to.
|
|
@@ -26,8 +26,9 @@ import type {Persister, Persists} from '../../with-schemas/index.d.ts';
|
|
|
26
26
|
* @category Persister
|
|
27
27
|
* @since v5.4.0
|
|
28
28
|
*/
|
|
29
|
-
export interface DurableObjectStoragePersister<
|
|
30
|
-
extends
|
|
29
|
+
export interface DurableObjectStoragePersister<
|
|
30
|
+
Schemas extends OptionalSchemas,
|
|
31
|
+
> extends Persister<Schemas, Persists.MergeableStoreOnly> {
|
|
31
32
|
/**
|
|
32
33
|
* The getStorage method returns a reference to the storage that the Store is
|
|
33
34
|
* being persisted to.
|
|
@@ -30,8 +30,9 @@ import type {
|
|
|
30
30
|
* @category Persister
|
|
31
31
|
* @since v4.6.0
|
|
32
32
|
*/
|
|
33
|
-
export interface ElectricSqlPersister<
|
|
34
|
-
extends
|
|
33
|
+
export interface ElectricSqlPersister<
|
|
34
|
+
Schemas extends OptionalSchemas,
|
|
35
|
+
> extends Persister<Schemas> {
|
|
35
36
|
/**
|
|
36
37
|
* The getElectricClient method returns a reference to the Electric client the
|
|
37
38
|
* Store is being persisted to.
|
|
@@ -32,8 +32,7 @@ import type {DatabasePersisterConfig, Persister, Persists} from '../index.d.ts';
|
|
|
32
32
|
* @category Persister
|
|
33
33
|
* @since v4.5.0
|
|
34
34
|
*/
|
|
35
|
-
export interface ExpoSqlitePersister
|
|
36
|
-
extends Persister<Persists.StoreOrMergeableStore> {
|
|
35
|
+
export interface ExpoSqlitePersister extends Persister<Persists.StoreOrMergeableStore> {
|
|
37
36
|
/**
|
|
38
37
|
* The getDb method returns a reference to the database instance the Store is
|
|
39
38
|
* being persisted to.
|
|
@@ -39,8 +39,9 @@ import type {
|
|
|
39
39
|
* @category Persister
|
|
40
40
|
* @since v4.5.0
|
|
41
41
|
*/
|
|
42
|
-
export interface ExpoSqlitePersister<
|
|
43
|
-
extends
|
|
42
|
+
export interface ExpoSqlitePersister<
|
|
43
|
+
Schemas extends OptionalSchemas,
|
|
44
|
+
> extends Persister<Schemas, Persists.StoreOrMergeableStore> {
|
|
44
45
|
/**
|
|
45
46
|
* The getDb method returns a reference to the database instance the Store is
|
|
46
47
|
* being persisted to.
|
|
@@ -23,8 +23,7 @@ import type {Persister, Persists} from '../index.d.ts';
|
|
|
23
23
|
* @category Persister
|
|
24
24
|
* @since v4.3.14
|
|
25
25
|
*/
|
|
26
|
-
export interface FilePersister
|
|
27
|
-
extends Persister<Persists.StoreOrMergeableStore> {
|
|
26
|
+
export interface FilePersister extends Persister<Persists.StoreOrMergeableStore> {
|
|
28
27
|
/**
|
|
29
28
|
* The getFilePath method returns the location of the local file the Store is
|
|
30
29
|
* being persisted to.
|
|
@@ -26,8 +26,9 @@ import type {Persister, Persists} from '../../with-schemas/index.d.ts';
|
|
|
26
26
|
* @category Persister
|
|
27
27
|
* @since v4.3.14
|
|
28
28
|
*/
|
|
29
|
-
export interface FilePersister<
|
|
30
|
-
extends
|
|
29
|
+
export interface FilePersister<
|
|
30
|
+
Schemas extends OptionalSchemas,
|
|
31
|
+
> extends Persister<Schemas, Persists.StoreOrMergeableStore> {
|
|
31
32
|
/**
|
|
32
33
|
* The getFilePath method returns the location of the local file the Store is
|
|
33
34
|
* being persisted to.
|
|
@@ -25,8 +25,9 @@ import type {Persister} from '../../with-schemas/index.d.ts';
|
|
|
25
25
|
* @category Persister
|
|
26
26
|
* @since v4.3.14
|
|
27
27
|
*/
|
|
28
|
-
export interface IndexedDbPersister<
|
|
29
|
-
extends
|
|
28
|
+
export interface IndexedDbPersister<
|
|
29
|
+
Schemas extends OptionalSchemas,
|
|
30
|
+
> extends Persister<Schemas> {
|
|
30
31
|
/**
|
|
31
32
|
* The getDbName method returns the unique key of the IndexedDB the Store is
|
|
32
33
|
* being persisted to.
|
|
@@ -30,8 +30,9 @@ import type {
|
|
|
30
30
|
* @category Persister
|
|
31
31
|
* @since v4.7.0
|
|
32
32
|
*/
|
|
33
|
-
export interface LibSqlPersister<
|
|
34
|
-
extends
|
|
33
|
+
export interface LibSqlPersister<
|
|
34
|
+
Schemas extends OptionalSchemas,
|
|
35
|
+
> extends Persister<Schemas> {
|
|
35
36
|
/**
|
|
36
37
|
* The getClient method returns a reference to the database client the Store
|
|
37
38
|
* is being persisted to.
|
|
@@ -38,8 +38,9 @@ import type {Persister} from '../../with-schemas/index.d.ts';
|
|
|
38
38
|
* @category Persister
|
|
39
39
|
* @since v4.3.14
|
|
40
40
|
*/
|
|
41
|
-
export interface PartyKitPersister<
|
|
42
|
-
extends
|
|
41
|
+
export interface PartyKitPersister<
|
|
42
|
+
Schemas extends OptionalSchemas,
|
|
43
|
+
> extends Persister<Schemas> {
|
|
43
44
|
/**
|
|
44
45
|
* The getConnection method returns the PartySocket the Store is being
|
|
45
46
|
* persisted to.
|
|
@@ -24,8 +24,7 @@ import type {DatabasePersisterConfig, Persister, Persists} from '../index.d.ts';
|
|
|
24
24
|
* @category Persister
|
|
25
25
|
* @since 5.2.0
|
|
26
26
|
*/
|
|
27
|
-
export interface PglitePersister
|
|
28
|
-
extends Persister<Persists.StoreOrMergeableStore> {
|
|
27
|
+
export interface PglitePersister extends Persister<Persists.StoreOrMergeableStore> {
|
|
29
28
|
/**
|
|
30
29
|
* The getPglite method returns a reference to the database connection the
|
|
31
30
|
* Store is being persisted to.
|
|
@@ -166,6 +165,7 @@ export interface PglitePersister
|
|
|
166
165
|
* await pglite.close();
|
|
167
166
|
* ```
|
|
168
167
|
* @category Creation
|
|
168
|
+
* @essential Persisting stores
|
|
169
169
|
* @since 5.2.0
|
|
170
170
|
*/
|
|
171
171
|
export function createPglitePersister(
|
|
@@ -31,8 +31,9 @@ import type {
|
|
|
31
31
|
* @category Persister
|
|
32
32
|
* @since 5.2.0
|
|
33
33
|
*/
|
|
34
|
-
export interface PglitePersister<
|
|
35
|
-
extends
|
|
34
|
+
export interface PglitePersister<
|
|
35
|
+
Schemas extends OptionalSchemas,
|
|
36
|
+
> extends Persister<Schemas, Persists.StoreOrMergeableStore> {
|
|
36
37
|
/**
|
|
37
38
|
* The getPglite method returns a reference to the database connection the
|
|
38
39
|
* Store is being persisted to.
|
|
@@ -185,6 +186,7 @@ export interface PglitePersister<Schemas extends OptionalSchemas>
|
|
|
185
186
|
* await pglite.close();
|
|
186
187
|
* ```
|
|
187
188
|
* @category Creation
|
|
189
|
+
* @essential Persisting stores
|
|
188
190
|
* @since 5.2.0
|
|
189
191
|
*/
|
|
190
192
|
export function createPglitePersister<Schemas extends OptionalSchemas>(
|
|
@@ -24,8 +24,7 @@ import type {DatabasePersisterConfig, Persister, Persists} from '../index.d.ts';
|
|
|
24
24
|
* @category Persister
|
|
25
25
|
* @since 5.2.0
|
|
26
26
|
*/
|
|
27
|
-
export interface PostgresPersister
|
|
28
|
-
extends Persister<Persists.StoreOrMergeableStore> {
|
|
27
|
+
export interface PostgresPersister extends Persister<Persists.StoreOrMergeableStore> {
|
|
29
28
|
/**
|
|
30
29
|
* The getSql method returns a reference to the database connection the Store
|
|
31
30
|
* is being persisted to.
|
|
@@ -31,8 +31,9 @@ import type {
|
|
|
31
31
|
* @category Persister
|
|
32
32
|
* @since 5.2.0
|
|
33
33
|
*/
|
|
34
|
-
export interface PostgresPersister<
|
|
35
|
-
extends
|
|
34
|
+
export interface PostgresPersister<
|
|
35
|
+
Schemas extends OptionalSchemas,
|
|
36
|
+
> extends Persister<Schemas, Persists.StoreOrMergeableStore> {
|
|
36
37
|
/**
|
|
37
38
|
* The getSql method returns a reference to the database connection the Store
|
|
38
39
|
* is being persisted to.
|
|
@@ -31,8 +31,9 @@ import type {
|
|
|
31
31
|
* @category Persister
|
|
32
32
|
* @since v4.8.0
|
|
33
33
|
*/
|
|
34
|
-
export interface PowerSyncPersister<
|
|
35
|
-
extends
|
|
34
|
+
export interface PowerSyncPersister<
|
|
35
|
+
Schemas extends OptionalSchemas,
|
|
36
|
+
> extends Persister<Schemas> {
|
|
36
37
|
/**
|
|
37
38
|
* The getPowerSync method returns a reference to the PowerSync instance the
|
|
38
39
|
* Store is being persisted to.
|