tsdf 17.0.0-alpha.6 → 17.0.0-alpha.8
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/LICENSE +140 -0
- package/README.md +3 -0
- package/dist/async-storage.d.ts +2 -0
- package/dist/async-storage.js +1 -0
- package/dist/asyncStorageAdapter-CgG3vm0t.js +1 -0
- package/dist/asyncStorageAdapter-kvAIhrBD.d.ts +6 -0
- package/dist/asyncStorageAdapters-eagaD77Y.js +1 -0
- package/dist/indexed-db-storage.d.ts +12 -0
- package/dist/indexed-db-storage.js +1 -0
- package/dist/indexedDbPersistentStorage-JYXvMjTG.js +1 -0
- package/dist/main.d.ts +192 -1676
- package/dist/main.js +1 -18927
- package/dist/opfs-storage.d.ts +2 -0
- package/dist/opfs-storage.js +1 -0
- package/dist/opfsPersistentStorage-DS-SWDSq.js +1 -0
- package/dist/opfsPersistentStorage-D_fecOJg.d.ts +6 -0
- package/dist/types-DkNgE_f9.d.ts +1406 -0
- package/docs/persistent-storage.md +12 -6
- package/package.json +19 -5
|
@@ -23,12 +23,18 @@ Exported from `tsdf`:
|
|
|
23
23
|
| `DocumentPersistentStorageConfig` / `CollectionPersistentStorageConfig` / `ListQueryPersistentStorageConfig` | Store-level persistence config types |
|
|
24
24
|
| `createStoreManager(options)` | Creates the shared store manager used by all stores |
|
|
25
25
|
| `PersistentStoragePreloadResult<Payload>` | Return shape for preload methods |
|
|
26
|
+
| `localPersistentStorage` | Built-in localStorage helper used by the `'local-sync'` adapter |
|
|
26
27
|
| `clearSessionStorage(sessionKey, adapter)` | Clears all TSDF entries for one session/adapter |
|
|
27
28
|
| `clearAllSessionStorage(sessionKey)` | Clears all TSDF entries for one session across built-in adapters |
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
|
29
|
+
|
|
30
|
+
Exported from async-storage subpaths:
|
|
31
|
+
|
|
32
|
+
| Export | Import From | Description |
|
|
33
|
+
| -------------------------------------------- | ------------------------- | ------------------------------------------------------------- |
|
|
34
|
+
| `opfsPersistentStorage` | `tsdf/opfs-storage` | Built-in OPFS async storage adapter |
|
|
35
|
+
| `indexedDbPersistentStorage` | `tsdf/indexed-db-storage` | Built-in IndexedDB async storage adapter |
|
|
36
|
+
| `createIndexedDbPersistentStorage(options?)` | `tsdf/indexed-db-storage` | Creates an IndexedDB adapter, optionally with a database name |
|
|
37
|
+
| `createAsyncStorageAdapter(driver)` | `tsdf/async-storage` | Wraps a custom async storage driver |
|
|
32
38
|
|
|
33
39
|
## Configuration
|
|
34
40
|
|
|
@@ -150,7 +156,7 @@ persistentStorage: {
|
|
|
150
156
|
- Stores one logical row per entry and uses native indexes for recency ordering, group lookups, and protected-key scans.
|
|
151
157
|
- Hydration is asynchronous, and can be triggered explicitly with preload APIs.
|
|
152
158
|
|
|
153
|
-
Use `createIndexedDbPersistentStorage({ databaseName })` when an app needs an isolated IndexedDB database.
|
|
159
|
+
Use `createIndexedDbPersistentStorage({ databaseName })` from `tsdf/indexed-db-storage` when an app needs an isolated IndexedDB database.
|
|
154
160
|
|
|
155
161
|
### Custom async adapters
|
|
156
162
|
|
|
@@ -159,7 +165,7 @@ Use `createAsyncStorageAdapter(driver)` only when the built-in OPFS and IndexedD
|
|
|
159
165
|
A driver is responsible for storing raw records by logical namespace:
|
|
160
166
|
|
|
161
167
|
```ts
|
|
162
|
-
import { createAsyncStorageAdapter } from 'tsdf';
|
|
168
|
+
import { createAsyncStorageAdapter } from 'tsdf/async-storage';
|
|
163
169
|
import type { AsyncStorageDriver } from 'tsdf';
|
|
164
170
|
|
|
165
171
|
const driver: AsyncStorageDriver = {
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tsdf",
|
|
3
|
-
"version": "17.0.0-alpha.
|
|
3
|
+
"version": "17.0.0-alpha.8",
|
|
4
4
|
"description": "A data fetching solution based on t-state",
|
|
5
|
-
"license": "
|
|
5
|
+
"license": "PolyForm-Noncommercial-1.0.0",
|
|
6
6
|
"author": "Lucas Santos",
|
|
7
7
|
"repository": "github:lucasols/tsdf",
|
|
8
8
|
"type": "module",
|
|
@@ -13,6 +13,21 @@
|
|
|
13
13
|
"types": "./dist/main.d.ts",
|
|
14
14
|
"import": "./dist/main.js",
|
|
15
15
|
"default": "./dist/main.js"
|
|
16
|
+
},
|
|
17
|
+
"./async-storage": {
|
|
18
|
+
"types": "./dist/async-storage.d.ts",
|
|
19
|
+
"import": "./dist/async-storage.js",
|
|
20
|
+
"default": "./dist/async-storage.js"
|
|
21
|
+
},
|
|
22
|
+
"./indexed-db-storage": {
|
|
23
|
+
"types": "./dist/indexed-db-storage.d.ts",
|
|
24
|
+
"import": "./dist/indexed-db-storage.js",
|
|
25
|
+
"default": "./dist/indexed-db-storage.js"
|
|
26
|
+
},
|
|
27
|
+
"./opfs-storage": {
|
|
28
|
+
"types": "./dist/opfs-storage.d.ts",
|
|
29
|
+
"import": "./dist/opfs-storage.js",
|
|
30
|
+
"default": "./dist/opfs-storage.js"
|
|
16
31
|
}
|
|
17
32
|
},
|
|
18
33
|
"files": [
|
|
@@ -25,6 +40,7 @@
|
|
|
25
40
|
},
|
|
26
41
|
"devDependencies": {
|
|
27
42
|
"@ls-stack/eslint-cfg": "^0.10.0",
|
|
43
|
+
"@ls-stack/extended-lint": "^0.89.3",
|
|
28
44
|
"@playwright/test": "^1.58.2",
|
|
29
45
|
"@testing-library/react": "^16.3.2",
|
|
30
46
|
"@types/node": "^25.0.3",
|
|
@@ -51,12 +67,10 @@
|
|
|
51
67
|
"dependencies": {
|
|
52
68
|
"@evtmitter/react": "^0.1.0",
|
|
53
69
|
"@ls-stack/browser-utils": "^0.3.0",
|
|
54
|
-
"@ls-stack/extended-lint": "^0.89.3",
|
|
55
70
|
"@ls-stack/react-utils": "^0.12.1",
|
|
56
71
|
"@ls-stack/utils": "^3.76.0",
|
|
57
72
|
"@standard-schema/spec": "^1.1.0",
|
|
58
73
|
"evtmitter": "^1.0.2",
|
|
59
|
-
"immer": "^11.1.3",
|
|
60
74
|
"klona": "^2.0.6",
|
|
61
75
|
"runcheck": "^1.15.0",
|
|
62
76
|
"t-result": "^0.6.1",
|
|
@@ -81,7 +95,7 @@
|
|
|
81
95
|
"lint": "pnpm tsc && pnpm tsc:isolated && pnpm eslint",
|
|
82
96
|
"eslint": "eslint src/ tests/ --fix",
|
|
83
97
|
"format": "oxfmt src/ tests/",
|
|
84
|
-
"tsc": "tsgo -p tsconfig.prod.json",
|
|
98
|
+
"tsc": "tsgo -p tsconfig.prod.json && tsgo -p tsconfig.playwright-fixture.json",
|
|
85
99
|
"tsc:isolated": "tsgo -p tsconfig.isolated.json",
|
|
86
100
|
"build": "pnpm lint && pnpm test:all && pnpm build:no-test",
|
|
87
101
|
"build:no-test": "tsdown",
|