@molecule/app-angular 1.0.4 → 2.0.0

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.
Files changed (2) hide show
  1. package/README.md +68 -9
  2. package/package.json +2 -2
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-10-23T15:23:09.411Z
6
+ Generated: 2026-10-25T19:20:31.065Z
7
7
  -->
8
8
 
9
9
  # @molecule/app-angular
@@ -230,9 +230,12 @@ interface AuthClient<T = UserProfile, TRegister extends RegisterExtraShape<TRegi
230
230
  confirmPasswordReset(data: PasswordResetConfirm): Promise<void>;
231
231
  /**
232
232
  * Updates the current user's profile.
233
- * Returns the saved response. If the session is explicitly replaced or ended
234
- * while the request is pending, that response does not replace the current
235
- * session's user or persisted cache.
233
+ * Returns the saved profile: the answer applied onto the signed-in user field
234
+ * by field, with or without an `id` — a field it carries replaces the value
235
+ * (`null` clears it), one it omits or leaves `undefined` is kept, so a field
236
+ * cleared by omission must arrive as `null`. A non-object answer is returned
237
+ * as it came. An answer for a replaced or ended session leaves the current one
238
+ * untouched.
236
239
  */
237
240
  updateProfile(data: Partial<T>): Promise<T>;
238
241
  /**
@@ -288,9 +291,6 @@ interface AuthClient<T = UserProfile, TRegister extends RegisterExtraShape<TRegi
288
291
  * Resolves when the session restore started by `initialize()` has settled — the point
289
292
  * after which the client knows whether this visitor is signed in.
290
293
  *
291
- * Resolves IMMEDIATELY when no restore is in flight: before `initialize()` is ever
292
- * called, and after it has finished. A restore that failed resolves too (it settled the
293
- * question), so an HTTP client can await this before every request without risking one
294
294
  // … truncated — the full declaration is in node_modules/@molecule/app-angular/dist
295
295
  ```
296
296
 
@@ -498,12 +498,50 @@ interface HttpClient {
498
498
  addErrorInterceptor(interceptor: ErrorInterceptor): () => void
499
499
  /**
500
500
  * Sets the authorization token.
501
+ *
502
+ * A static token: every request carries it until the next `setAuthToken` call. A client
503
+ * that has a {@link HttpClient.setAuthTokenResolver | resolver} (registered through
504
+ * `@molecule/app-http`'s `setAuthTokenSource`) ignores this value when it assembles a
505
+ * request — the resolver IS the session, and reading it per request is what keeps a
506
+ * session adopted without an auth event from sending the previous account's bearer. Once
507
+ * the resolver is removed, the static token is sent again.
501
508
  */
502
509
  setAuthToken(token: string | null): void
503
510
  /**
504
- * Returns the current authorization token, or `null` if not set.
511
+ * Returns the token the client applies to its next request: the resolver's answer when one
512
+ * is registered, else the static token from `setAuthToken`.
505
513
  */
506
514
  getAuthToken(): string | null
515
+ /**
516
+ * Registers the LIVE token resolver every request of this client reads, or clears it with
517
+ * `null`.
518
+ *
519
+ * `@molecule/app-http`'s `setAuthTokenSource()` calls this on every client it bonds, and the
520
+ * client MUST consult the resolver again each time it assembles a request (and report it from
521
+ * `getAuthToken()`). A session can change with no auth event and no observable state change —
522
+ * `authClient.setSession()` with the same profile data, or the OAuth callback's
523
+ * `setAccessToken()` — so a token pushed only at bond time or on `login`/`logout` events
524
+ * leaves every later request carrying the PREVIOUS session's bearer while the UI shows the
525
+ * new one.
526
+ *
527
+ * The resolved token takes the static token's place, with the same precedence: an
528
+ * `Authorization` header passed per request or in the client's default headers wins over it
529
+ * exactly where it won over a static token in this transport.
530
+ *
531
+ * A resolver that returns `null` (or `undefined`) means "this session has no body token": the
532
+ * request carries no `Authorization` header of the client's own. A cookie-session API issues
533
+ * no bearer, and the server prefers the header over the fresh cookie, so a kept bearer
534
+ * authenticates as the prior — possibly deleted — session.
535
+ *
536
+ * Optional, so an implementation written against the previous interface still conforms.
537
+ * `setAuthTokenSource()` follows such a client through a request interceptor instead, pushing
538
+ * the source with `setAuthToken` before each request: that request carries the change only
539
+ * when the transport applies its token after running its interceptors, so a transport that
540
+ * applies it earlier sends a session adopted mid-page from the following request on.
541
+ *
542
+ * @param resolver - Returns the current access token (or null/undefined), or `null` to clear.
543
+ */
544
+ setAuthTokenResolver?(resolver: AuthTokenResolver | null): void
507
545
  /**
508
546
  * Registers a handler for authentication errors (401).
509
547
  *
@@ -644,6 +682,27 @@ interface I18nProvider {
644
682
  * @returns An unsubscribe function.
645
683
  */
646
684
  onLocaleChange(listener: (locale: string) => void): () => void
685
+ /**
686
+ * Gets a counter that advances for every change `onLocaleChange` announces:
687
+ * a locale switch, a locale-list change, or translations added for a locale
688
+ * `t()` reads (the active locale and the locales it falls back to — English
689
+ * for `createSimpleI18nProvider`). It does NOT advance for a re-registration
690
+ * that leaves every rendered string identical.
691
+ *
692
+ * **Optional — read it only when present.** A consumer that observes the
693
+ * provider through `useSyncExternalStore` (the React hooks do) compares this
694
+ * value across renders, so it also sees a change that happened before its
695
+ * listener existed: a notification fired from a child's or an earlier
696
+ * sibling's layout effect, or while React kept the tree hidden with its
697
+ * effects unmounted. Providers written before this method existed keep the
698
+ * listener-only behaviour; consumers must fall back to counting
699
+ * notifications.
700
+ *
701
+ * Reads must be side-effect free, and the value must never decrease.
702
+ *
703
+ * @returns The provider's current revision.
704
+ */
705
+ getRevision?(): number
647
706
  /**
648
707
  * Gets the text direction for the current locale.
649
708
  *
@@ -2973,7 +3032,7 @@ const LOGGER_PROVIDER: InjectionToken<LoggerProvider>
2973
3032
  Peer dependencies:
2974
3033
 
2975
3034
  - `@angular/core` 22.0.0
2976
- - `@molecule/app-auth` ^1.0.1
3035
+ - `@molecule/app-auth` ^3.0.0
2977
3036
  - `@molecule/app-device` ^1.0.1
2978
3037
  - `@molecule/app-forms` ^1.0.1
2979
3038
  - `@molecule/app-http` ^1.0.1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@molecule/app-angular",
3
- "version": "1.0.4",
3
+ "version": "2.0.0",
4
4
  "description": "Angular framework bindings for molecule.dev",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -22,7 +22,7 @@
22
22
  },
23
23
  "peerDependencies": {
24
24
  "@angular/core": "22.0.0",
25
- "@molecule/app-auth": "^1.0.1",
25
+ "@molecule/app-auth": "^3.0.0",
26
26
  "@molecule/app-device": "^1.0.1",
27
27
  "@molecule/app-forms": "^1.0.1",
28
28
  "@molecule/app-http": "^1.0.1",