@molecule/app-auth 3.2.0 → 3.2.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-01T10:12:16.667Z
6
+ Generated: 2026-11-02T07:28:20.788Z
7
7
  -->
8
8
 
9
9
  # @molecule/app-auth
@@ -1635,6 +1635,25 @@ Peer dependencies:
1635
1635
  - `@molecule/app-i18n`
1636
1636
  - `@molecule/app-logger`
1637
1637
 
1638
+ **Synchronous getters for application integrations.** Read the shared client
1639
+ synchronously when an integration needs the raw token, auth state and current user.
1640
+ These reads create no second store: `getAccessToken()`
1641
+ returns the token, `getState().status` includes `unavailable`, and `getUser()` reads
1642
+ the mapped profile. The configured `tokenKey` also applies to these getters.
1643
+ Keep an integration's response shape local; do not persist another token or user.
1644
+
1645
+ ```typescript
1646
+ import { getClient } from '@molecule/app-auth'
1647
+ const readSession = () => {
1648
+ const client = getClient()
1649
+ return {
1650
+ status: client.getState().status,
1651
+ user: client.getUser(),
1652
+ accessToken: client.getAccessToken(),
1653
+ }
1654
+ }
1655
+ ```
1656
+
1638
1657
  - **An API with its own auth envelope keeps this client.** `requestBody` wraps the
1639
1658
  login/register payload (`(kind, p) => ({ user: p })`), `mapAuthResponse` reads the
1640
1659
  token and user out of the answer — keeping the wire bearer OUT of the profile,
package/dist/index.d.ts CHANGED
@@ -304,6 +304,25 @@
304
304
  * `RequestConfig.skipAuthGate` in `@molecule/app-http`.
305
305
  *
306
306
  * @remarks
307
+ * **Synchronous getters for application integrations.** Read the shared client
308
+ * synchronously when an integration needs the raw token, auth state and current user.
309
+ * These reads create no second store: `getAccessToken()`
310
+ * returns the token, `getState().status` includes `unavailable`, and `getUser()` reads
311
+ * the mapped profile. The configured `tokenKey` also applies to these getters.
312
+ * Keep an integration's response shape local; do not persist another token or user.
313
+ *
314
+ * ```typescript
315
+ * import { getClient } from '@molecule/app-auth'
316
+ * const readSession = () => {
317
+ * const client = getClient()
318
+ * return {
319
+ * status: client.getState().status,
320
+ * user: client.getUser(),
321
+ * accessToken: client.getAccessToken(),
322
+ * }
323
+ * }
324
+ * ```
325
+ *
307
326
  * - **An API with its own auth envelope keeps this client.** `requestBody` wraps the
308
327
  * login/register payload (`(kind, p) => ({ user: p })`), `mapAuthResponse` reads the
309
328
  * token and user out of the answer — keeping the wire bearer OUT of the profile,
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgbG;AAEH,cAAc,sBAAsB,CAAA;AACpC,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,gBAAgB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmcG;AAEH,cAAc,sBAAsB,CAAA;AACpC,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,gBAAgB,CAAA"}
package/dist/index.js CHANGED
@@ -304,6 +304,25 @@
304
304
  * `RequestConfig.skipAuthGate` in `@molecule/app-http`.
305
305
  *
306
306
  * @remarks
307
+ * **Synchronous getters for application integrations.** Read the shared client
308
+ * synchronously when an integration needs the raw token, auth state and current user.
309
+ * These reads create no second store: `getAccessToken()`
310
+ * returns the token, `getState().status` includes `unavailable`, and `getUser()` reads
311
+ * the mapped profile. The configured `tokenKey` also applies to these getters.
312
+ * Keep an integration's response shape local; do not persist another token or user.
313
+ *
314
+ * ```typescript
315
+ * import { getClient } from '@molecule/app-auth'
316
+ * const readSession = () => {
317
+ * const client = getClient()
318
+ * return {
319
+ * status: client.getState().status,
320
+ * user: client.getUser(),
321
+ * accessToken: client.getAccessToken(),
322
+ * }
323
+ * }
324
+ * ```
325
+ *
307
326
  * - **An API with its own auth envelope keeps this client.** `requestBody` wraps the
308
327
  * login/register payload (`(kind, p) => ({ user: p })`), `mapAuthResponse` reads the
309
328
  * token and user out of the answer — keeping the wire bearer OUT of the profile,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgbG;AAEH,cAAc,sBAAsB,CAAA;AACpC,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,gBAAgB,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmcG;AAEH,cAAc,sBAAsB,CAAA;AACpC,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,gBAAgB,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@molecule/app-auth",
3
- "version": "3.2.0",
3
+ "version": "3.2.1",
4
4
  "description": "Client-side authentication interface for molecule.dev",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",