kitcn 0.33.6 → 0.33.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kitcn",
3
- "version": "0.33.6",
3
+ "version": "0.33.7",
4
4
  "description": "kitcn - React Query integration and CLI tools for Convex",
5
5
  "keywords": [
6
6
  "convex",
@@ -363,7 +363,7 @@ All from `kitcn/react`:
363
363
  |------|---------|-------------|
364
364
  | `useAuth()` | `{ hasSession, isAuthenticated, isLoading }` | Full auth state |
365
365
  | `useMaybeAuth()` | `boolean` | Has token (optimistic, may not be verified) |
366
- | `useIsAuth()` | `boolean` | Server-verified authentication |
366
+ | `useIsAuth()` | `boolean` | Server-verified authentication (with `optimisticAuth`, also during the optimistic window) |
367
367
  | `useAuthGuard()` | `() => boolean` | Guard mutations, returns true if blocked |
368
368
  | `useConvexAuthRecovery()` | `{ recover, status, error }` | Rebind Convex auth after a transient token failure |
369
369
 
@@ -389,7 +389,7 @@ All from `kitcn/react`:
389
389
  | Component | Renders when |
390
390
  |-----------|-------------|
391
391
  | `MaybeAuthenticated` | Has session token (optimistic) |
392
- | `Authenticated` | Server-verified authenticated |
392
+ | `Authenticated` | Server-verified authenticated (with `optimisticAuth`, also during the optimistic window) |
393
393
  | `MaybeUnauthenticated` | No session token (optimistic) |
394
394
  | `Unauthenticated` | Server-verified not authenticated |
395
395
 
@@ -414,16 +414,34 @@ All from `kitcn/react`:
414
414
  ```
415
415
 
416
416
  `optimisticAuth` only opens auth-bound query gates for a held, unexpired JWT;
417
- expired, opaque, and refused tokens stay closed. Enable
417
+ expired, opaque, and refused tokens stay closed. The window ends at the Convex
418
+ client's first auth result; use one `optimisticAuth` setting per client; no
419
+ optimism over a client the Start loader authenticated. Enable
418
420
  `onTokenIdentityChange` to refuse a JWT whose `sub` or `sessionId` differs from
419
- the document identity before Convex or HTTP sees it. The client closes before
420
- the callback runs, so reload the document there.
421
+ the document identity (whatever its `exp`) before Convex, HTTP or the Start
422
+ loader sees it. On a trip, every mounted provider hands out no token and
423
+ publishes unauthenticated; each guarded one closes its client, then calls the
424
+ callback once, so reload the document there. Browser only, page-wide: later
425
+ providers start tripped, and a guarded one that mounts or shows again on a
426
+ tripped page also closes its client and calls the callback once. Enabling the
427
+ guard on a tripped page delivers that close and callback once too; sign-in
428
+ mutations fail with `TOKEN_IDENTITY_CHANGED`.
421
429
 
422
430
  For multiple provider mounts, pass `tokenIdentityBaseline` as
423
- `sub|sessionId`, or a getter returning the document's current identity. The
424
- getter is checked for every admission, cached tokens included.
431
+ `sub|sessionId`, or a getter returning the document's current identity. Every
432
+ admission (SSR, fresh and cached tokens, sign-in, HTTP, Start loader) binds a
433
+ token to the page identity, the provider's own baseline and every mounted
434
+ provider's current getter answer; an opaque session token is only exchanged,
435
+ never handed to Convex. Held tokens are reconciled when a provider joins the
436
+ page and at every admission. A page that never enables the guard is
437
+ unchanged; once a guarded provider establishes the page identity it persists
438
+ until reload, binding every provider and the Start loader, even after that
439
+ provider unmounts. Two kitcn versions or revisions on one page (dev HMR
440
+ across revisions included) are unsupported: no shared page identity until
441
+ reload.
425
442
  `onTokenIdentityAdmitted(token)` observes admitted JWTs so the app can update
426
- that shared baseline. All three identity options require
443
+ that shared baseline. Admission rechecks the baseline after the callback before
444
+ publishing or handing out the token. All three identity options require
427
445
  `onTokenIdentityChange`.
428
446
 
429
447
  For `@convex-dev/auth` (React Native):