@molecule/app-auth 3.3.0 → 3.3.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/README.md CHANGED
@@ -3,7 +3,7 @@ AUTO-GENERATED — DO NOT EDIT THIS FILE.
3
3
  Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
4
4
  Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
5
5
  To change this document, edit the module-level JSDoc in src/index.ts.
6
- Generated: 2026-11-07T05:06:43.040Z
6
+ Generated: 2026-11-08T00:30:10.378Z
7
7
  -->
8
8
 
9
9
  # @molecule/app-auth
@@ -121,6 +121,13 @@ guards read this same `status`: wait only while it is `'loading'` — that
121
121
  status means "no decision yet", so an auth request in flight
122
122
  (`state.loading`) keeps the decided status and does not unmount a
123
123
  Login/Register page mid-request.
124
+ Use the framework's shared route guard when available. For React Router,
125
+ `AuthGuard` from `@molecule/app-ui-react` wraps protected routes with
126
+ `<Route element={<AuthGuard />}>`. It restores lazily, waits only while
127
+ `status === 'loading'`, and redirects only on `'unauthenticated'`.
128
+ `'unavailable'` retains a session candidate and must not redirect to login.
129
+ Do not replace this guard with `!isAuthenticated` or
130
+ `status !== 'authenticated'`, or poll the session before painting the form.
124
131
  `validateSession()` is the background re-check that produces the last two: call
125
132
  it after the first render — a 401 or 403 clears the token (`'unauthenticated'`),
126
133
  while a network failure, a 5xx, or a 404 from a wrong `currentUserEndpoint`
@@ -1541,7 +1548,8 @@ by one. A box you can't check is an integration bug to fix — not a skip:
1541
1548
  `user: null`, tokens cleared); afterward every protected screen redirects
1542
1549
  back to login.
1543
1550
  - [ ] Visiting a protected route while logged OUT redirects to login (the
1544
- guard reads `isAuthenticated()`), and after authenticating you land back on
1551
+ guard redirects only on `status === 'unauthenticated'`, after the initial
1552
+ `'loading'` decision), and after authenticating you land back on
1545
1553
  the originally-requested screen rather than a generic home.
1546
1554
  - [ ] The session survives a FULL page reload: after login, hard-reload → you
1547
1555
  stay signed in (the profile/sign-out UI a signed-in visitor sees is still
package/dist/index.d.ts CHANGED
@@ -111,6 +111,13 @@
111
111
  * status means "no decision yet", so an auth request in flight
112
112
  * (`state.loading`) keeps the decided status and does not unmount a
113
113
  * Login/Register page mid-request.
114
+ * Use the framework's shared route guard when available. For React Router,
115
+ * `AuthGuard` from `@molecule/app-ui-react` wraps protected routes with
116
+ * `<Route element={<AuthGuard />}>`. It restores lazily, waits only while
117
+ * `status === 'loading'`, and redirects only on `'unauthenticated'`.
118
+ * `'unavailable'` retains a session candidate and must not redirect to login.
119
+ * Do not replace this guard with `!isAuthenticated` or
120
+ * `status !== 'authenticated'`, or poll the session before painting the form.
114
121
  * `validateSession()` is the background re-check that produces the last two: call
115
122
  * it after the first render — a 401 or 403 clears the token (`'unauthenticated'`),
116
123
  * while a network failure, a 5xx, or a 404 from a wrong `currentUserEndpoint`
@@ -434,7 +441,8 @@
434
441
  * `user: null`, tokens cleared); afterward every protected screen redirects
435
442
  * back to login.
436
443
  * - [ ] Visiting a protected route while logged OUT redirects to login (the
437
- * guard reads `isAuthenticated()`), and after authenticating you land back on
444
+ * guard redirects only on `status === 'unauthenticated'`, after the initial
445
+ * `'loading'` decision), and after authenticating you land back on
438
446
  * the originally-requested screen rather than a generic home.
439
447
  * - [ ] The session survives a FULL page reload: after login, hard-reload → you
440
448
  * stay signed in (the profile/sign-out UI a signed-in visitor sees is still
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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BAAgB,CAAA"}
package/dist/index.js CHANGED
@@ -111,6 +111,13 @@
111
111
  * status means "no decision yet", so an auth request in flight
112
112
  * (`state.loading`) keeps the decided status and does not unmount a
113
113
  * Login/Register page mid-request.
114
+ * Use the framework's shared route guard when available. For React Router,
115
+ * `AuthGuard` from `@molecule/app-ui-react` wraps protected routes with
116
+ * `<Route element={<AuthGuard />}>`. It restores lazily, waits only while
117
+ * `status === 'loading'`, and redirects only on `'unauthenticated'`.
118
+ * `'unavailable'` retains a session candidate and must not redirect to login.
119
+ * Do not replace this guard with `!isAuthenticated` or
120
+ * `status !== 'authenticated'`, or poll the session before painting the form.
114
121
  * `validateSession()` is the background re-check that produces the last two: call
115
122
  * it after the first render — a 401 or 403 clears the token (`'unauthenticated'`),
116
123
  * while a network failure, a 5xx, or a 404 from a wrong `currentUserEndpoint`
@@ -434,7 +441,8 @@
434
441
  * `user: null`, tokens cleared); afterward every protected screen redirects
435
442
  * back to login.
436
443
  * - [ ] Visiting a protected route while logged OUT redirects to login (the
437
- * guard reads `isAuthenticated()`), and after authenticating you land back on
444
+ * guard redirects only on `status === 'unauthenticated'`, after the initial
445
+ * `'loading'` decision), and after authenticating you land back on
438
446
  * the originally-requested screen rather than a generic home.
439
447
  * - [ ] The session survives a FULL page reload: after login, hard-reload → you
440
448
  * stay signed in (the profile/sign-out UI a signed-in visitor sees is still
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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HANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@molecule/app-auth",
3
- "version": "3.3.0",
3
+ "version": "3.3.1",
4
4
  "description": "Client-side authentication interface for molecule.dev",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -35,7 +35,7 @@
35
35
  },
36
36
  "devDependencies": {
37
37
  "@molecule/app-bond": "1.0.5",
38
- "@molecule/app-http": "1.5.6",
38
+ "@molecule/app-http": "1.5.7",
39
39
  "@molecule/app-i18n": "1.1.2",
40
40
  "@molecule/app-logger": "1.0.5",
41
41
  "@types/node": "26.6.5",