@basictech/react 0.7.0 → 0.8.0-beta.1
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/.turbo/turbo-build.log +13 -12
- package/AUTH_IMPLEMENTATION_GUIDE.md +20 -18
- package/changelog.md +18 -2
- package/dist/index.d.mts +78 -21
- package/dist/index.d.ts +78 -21
- package/dist/index.js +1250 -779
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1246 -779
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/readme.md +17 -1
- package/src/AuthContext.tsx +202 -702
- package/src/config.ts +1 -19
- package/src/core/auth/AuthManager.ts +858 -0
- package/src/core/db/RemoteCollection.ts +30 -16
- package/src/core/db/index.ts +1 -1
- package/src/core/db/types.ts +13 -1
- package/src/index.ts +7 -1
- package/src/sync/index.ts +15 -29
- package/src/sync/syncProtocol.js +84 -22
- package/src/sync/tokenRegistry.ts +20 -0
- package/src/updater/updateMigrations.ts +3 -3
- package/src/updater/versionUpdater.ts +3 -10
- package/src/utils/normalizeClientId.ts +22 -0
- package/src/utils/resolveDid.ts +101 -0
- package/src/utils/schema.ts +3 -4
- package/src/utils/storage.ts +4 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@basictech/react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0-beta.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -24,11 +24,11 @@
|
|
|
24
24
|
"dexie-syncable": "^4.0.1-beta.13",
|
|
25
25
|
"jwt-decode": "^4.0.0",
|
|
26
26
|
"uuid": "^10.0.0",
|
|
27
|
-
"@basictech/schema": "0.
|
|
27
|
+
"@basictech/schema": "0.7.0-beta.0"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@repo/typescript-config": "*",
|
|
31
|
-
"tsup": "^
|
|
31
|
+
"tsup": "^8.0.0",
|
|
32
32
|
"typescript": "^5.0.0"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
package/readme.md
CHANGED
|
@@ -137,11 +137,27 @@ const {
|
|
|
137
137
|
|
|
138
138
|
// Database
|
|
139
139
|
db, // Database instance
|
|
140
|
-
dbStatus, //
|
|
140
|
+
dbStatus, // DBStatus - see below
|
|
141
141
|
dbMode, // "sync" | "remote"
|
|
142
142
|
} = useBasic()
|
|
143
143
|
```
|
|
144
144
|
|
|
145
|
+
#### `DBStatus` (sync connection state)
|
|
146
|
+
|
|
147
|
+
When `dbMode === "sync"`, `dbStatus` is one of:
|
|
148
|
+
|
|
149
|
+
| Value | Description |
|
|
150
|
+
|-------|-------------|
|
|
151
|
+
| `LOADING` | SDK initializing |
|
|
152
|
+
| `OFFLINE` | Not connected |
|
|
153
|
+
| `CONNECTING` | Connecting to sync server |
|
|
154
|
+
| `ONLINE` | Connected and idle |
|
|
155
|
+
| `SYNCING` | Syncing data |
|
|
156
|
+
| `ERROR` | Sync error |
|
|
157
|
+
| `ERROR_WILL_RETRY` | Sync error but client will retry (e.g. expired token). Use this to show "Reconnecting…" or trigger token refresh. |
|
|
158
|
+
|
|
159
|
+
Import the enum for comparisons: `import { useBasic, DBStatus } from '@basictech/react'`.
|
|
160
|
+
|
|
145
161
|
---
|
|
146
162
|
|
|
147
163
|
### `useQuery()`
|