@basictech/react 0.8.0-beta.4 → 0.9.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/changelog.md CHANGED
@@ -1,5 +1,70 @@
1
1
  # 1.3.4
2
2
 
3
+ ## 0.9.0-beta.1
4
+
5
+ ### Minor Changes
6
+
7
+ Local-first startup, anonymous mode, and multiple users.
8
+
9
+ - **Anonymous mode (default on):** the local database works without a
10
+ session — writes queue as ordinary ops in a local-only workspace (sync
11
+ status `local`) and merge into the account automatically on sign-in via
12
+ the normal bootstrap+flush path (deferred identity — no copy step). Set
13
+ `anonymous={false}` on the provider for classic sign-in-required behavior.
14
+ - **Offline cold start fixed:** the engine opens the local keyspace with no
15
+ token and no network (`openLocal()`), so reloading offline serves all data
16
+ from the replica; the connection acquires tokens with retry on its own.
17
+ `reauth_required` now *pauses* the connection instead of stopping the
18
+ engine — local reads/writes keep working while the user re-authenticates.
19
+ - **Multiple users:** several local users (anonymous or signed-in) side by
20
+ side with per-tab switching. New `useUsers()` hook
21
+ (`users`, `activeUser`, `switchUser`, `addUser`, `removeUser`), profile
22
+ registry in localStorage, per-user auth storage namespacing and isolated
23
+ sync keyspaces (`basic-sync:{project}:{userId}`). Existing single-user
24
+ sessions are adopted as the first profile automatically.
25
+ - **Owner guard:** keyspaces are stamped with the account DID at bootstrap;
26
+ local data from one account can never merge into another (a mismatched
27
+ keyspace is wiped before bootstrap). Also fixes a latent leak where
28
+ unpushed ops could survive an account change.
29
+ - **User-aware `useQuery`:** the active user id is appended to query deps
30
+ automatically so live queries re-attach on user switches; in-flight
31
+ queries hitting a closing store during the switch return undefined and
32
+ re-run.
33
+ - `signOut()` now wipes the active user's data and falls through to the next
34
+ local user (or a fresh anonymous workspace); `useAuth()` exposes
35
+ `isAnonymous`; sync status gains `local`.
36
+
37
+ ## 0.9.0-beta.0
38
+
39
+ ### Major Changes (breaking)
40
+
41
+ Ground-up rewrite for the server's Sync/2 sync engine and Step 2 auth upgrade.
42
+ The legacy dexie-syncable `/ws` protocol was removed server-side (clean
43
+ break), so 0.8.x sync no longer works against production.
44
+
45
+ - **New sync engine** (`core/sync/`): implements the Sync/2 client contract
46
+ (SYNC_V2.md) — snapshot bootstrap, multiplexed WebSocket subscriptions,
47
+ client-minted idempotent ops (`put`/`patch`/`delete`), persisted pending
48
+ queue with optimistic rebase, ordered apply with echo confirmation,
49
+ poison-op handling for terminal rejections, and re-bootstrap recovery
50
+ (`SNAPSHOT_REQUIRED`/`RESET_REQUIRED`). Local persistence is plain Dexie
51
+ (dexie-syncable/dexie-observable removed).
52
+ - **New public API**: `db.table(name)` with `create/put/patch/delete/get/
53
+ getAll/find`; `useAuth`, `useDb`, `useSyncStatus`, `useShares`, `useShare`;
54
+ `useBasic` remains the umbrella hook. `useQuery` still provides live reads.
55
+ - **Shares v1**: list shares and mount shared data via `useShare(shareId)` —
56
+ separate local keyspace per mount, guest writes when permitted, revocation
57
+ handling.
58
+ - **Auth updates**: `signOut()` revokes server-side via `POST /auth/logout`;
59
+ sign-out (incl. cross-tab) tears down local data without page reloads;
60
+ token-endpoint 429s are treated as transient; `CONNECTION_REVOKED` from
61
+ sync triggers session reconciliation.
62
+ - **REST mode**: `mode="rest"` replaces `dbMode="remote"`, backed by the
63
+ REST v2 surface (`/account/:project_id/db/...`), including
64
+ snapshot/changes endpoints.
65
+ - Tests: vitest unit suite + integration suite against the Sync/2 reference
66
+ server (`basic-server/sync-playground`).
67
+
3
68
  ## 0.8.0-beta.4
4
69
 
5
70
  ### Patch Changes