@coolms/core-angular 2.0.0-alpha.6 → 2.0.0-alpha.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": "@coolms/core-angular",
3
- "version": "2.0.0-alpha.6",
3
+ "version": "2.0.0-alpha.7",
4
4
  "description": "The CoolMS client runtime for Angular: session and token refresh, boot manifest and app configuration, theme, user preferences, error handling, HTTP interceptors, and the wire types the CoolMS API emits.",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -1,9 +1,9 @@
1
- import { Observable, Subject } from "rxjs";
2
1
  import * as i0 from "@angular/core";
3
2
  import { EnvironmentProviders, InjectionToken, Provider, Type } from "@angular/core";
3
+ import { Observable, Subject } from "rxjs";
4
4
  import { StateContext } from "@ngxs/store";
5
5
  import { CanActivateFn, CanMatchFn, Routes } from "@angular/router";
6
- import { HttpContextToken, HttpInterceptorFn, HttpRequest } from "@angular/common/http";
6
+ import { HttpContextToken, HttpErrorResponse, HttpInterceptorFn, HttpRequest } from "@angular/common/http";
7
7
  export interface AuthApiManifest {
8
8
  readonly login: string;
9
9
  readonly logout: string;
@@ -159,6 +159,9 @@ export interface IdentityApiManifest {
159
159
  readonly userLegalHoldsUrl?: string;
160
160
  readonly holdsSettingsBlock?: string;
161
161
  readonly legalHoldFormId?: string | null;
162
+ readonly sessionsUrl?: string;
163
+ readonly sessionUrl?: string;
164
+ readonly userSessionsUrl?: string;
162
165
  }
163
166
  /**
164
167
  * Editor sub-manifest emitted by the backend's Editor module. The
@@ -219,7 +222,7 @@ export interface ViewerApiManifest {
219
222
  * fallback floor for anonymous / pre-login rendering: timezone, date /
220
223
  * time format (CLDR tokens) and week start come from the deployment's
221
224
  * config, not an FE-hardcoded Western default. `locale` is the default
222
- * locale, previously absent from the manifest.
225
+ * locale.
223
226
  */
224
227
  export interface PlatformDefaults {
225
228
  readonly locale: string;
@@ -253,6 +256,13 @@ export interface UiModuleEntryManifest {
253
256
  readonly range: string;
254
257
  readonly framework: string;
255
258
  }
259
+ /**
260
+ * The modules' own blocks of the manifest, by module name (`modules.section`):
261
+ * what a module names that the core entries above do not. Each block is the
262
+ * module's own shape; a client reads the keys it knows and treats a missing
263
+ * module or key as absent. Always an object, `{}` when no module has a block.
264
+ */
265
+ export type ModulesApiManifest = Readonly<Record<string, Readonly<Record<string, unknown>> | undefined>>;
256
266
  export interface ApiManifest {
257
267
  readonly apiBase: string;
258
268
  readonly ui?: UiApiManifest;
@@ -276,12 +286,12 @@ export interface ApiManifest {
276
286
  label: string;
277
287
  }>;
278
288
  readonly platformDefaults?: PlatformDefaults;
289
+ readonly modules?: ModulesApiManifest;
279
290
  }
280
291
  /**
281
292
  * GET /api/v1/admin/manifest -- the admin's endpoint map, answered to every signed-in account
282
- * since 2026-10-06 (no host groups: each call it names is decided by its own route). A server
283
- * from before that answers at /api/v1/console/manifest, to the console group only. Read once
284
- * signed in.
293
+ * (each call it names is decided by its own route). An older server answers at
294
+ * /api/v1/console/manifest, to the console group only. Read once signed in.
285
295
  */
286
296
  export interface ConsoleManifestResponse {
287
297
  readonly manifest: ApiManifest;
@@ -323,8 +333,7 @@ export type DataGridPreferences = Record<string, DataGridPreference>;
323
333
  *
324
334
  * They live in core because core runs the session: the NGXS auth state, the
325
335
  * refresh coordinator and the cross-tab sync are all here, and all three name
326
- * these shapes. They used to be declared inside the admin's `ApiService`, which
327
- * meant core imported a 2410-line client to read two interfaces.
336
+ * these shapes, so core needs no import of the admin's `ApiService` to read them.
328
337
  *
329
338
  * `ApiService` re-exports them from its own module, so the feature files that
330
339
  * import `UserDto` from there are untouched.
@@ -475,6 +484,16 @@ export interface HydraCollection<T> {
475
484
  'totalItems': number;
476
485
  'view'?: HydraView;
477
486
  }
487
+ /** The audiences the server knows: any other is refused at sign-in, so it is refused here, when the code compiles. */
488
+ export type AuthAudience = 'admin' | 'workspace';
489
+ /**
490
+ * The application a sign-in is for -- `admin`, `workspace` -- named by the application that provides it. A sign-in
491
+ * sends it, and the tokens it gets back carry it; a refresh keeps it. The server can then let a token into the
492
+ * surfaces of its own application only.
493
+ *
494
+ * None by default: an application that provides none signs in as before, naming no audience.
495
+ */
496
+ export declare const AUTH_AUDIENCE: InjectionToken<AuthAudience | null>;
478
497
  /**
479
498
  * The identity endpoints core owns: the session lifecycle, plus the settings
480
499
  * read at boot.
@@ -494,12 +513,21 @@ export interface HydraCollection<T> {
494
513
  export declare class IdentityApiClient {
495
514
  private readonly http;
496
515
  private readonly store;
516
+ private readonly audience;
517
+ /** The settings read while it is in flight, shared by every caller that asks meanwhile. */
518
+ private settingsRead$?;
497
519
  /** URLs come from the boot manifest, which core already owns. */
498
520
  private get manifest();
521
+ /** Signs in; names the application's audience ({@link AUTH_AUDIENCE}) when it provides one. */
499
522
  login(identifier: string, password: string): Observable<TokenResponse>;
500
523
  refresh(refreshToken: string): Observable<TokenResponse>;
501
524
  logout(): Observable<void>;
502
525
  me(): Observable<UserDto>;
526
+ /**
527
+ * The person's settings. Several services read them at start-up, each for its own section; callers that ask while
528
+ * a read is in flight share it, so the page makes one request. A call after it has answered reads again: nothing
529
+ * is kept past the answer, so a save is never hidden behind an old read.
530
+ */
503
531
  getSettings(): Observable<Record<string, Record<string, unknown>>>;
504
532
  static ɵfac: i0.ɵɵFactoryDeclaration<IdentityApiClient, never>;
505
533
  static ɵprov: i0.ɵɵInjectableDeclaration<any>;
@@ -517,7 +545,7 @@ export interface CentrifugoConnectionTokenDto {
517
545
  * The code the server closes this connection with when the caller's session
518
546
  * ended (a sign-out everywhere, a password change, a deactivation). On it the
519
547
  * client signs out and ends its calls at once, without reconnecting or waiting
520
- * for a 401 (2026-09-26). Absent from a server older than that.
548
+ * for a 401. Absent from an older server.
521
549
  */
522
550
  sessionEndedCode?: number;
523
551
  }
@@ -546,20 +574,17 @@ export interface CentrifugoSubscriptionTokenDto {
546
574
  * `ApiService` keeps its identical signatures and delegates here, so nothing
547
575
  * calling it had to change.
548
576
  *
549
- * !! Access first, then realtime (Dmitry, 2026-09-28): "The console opens a realtime
550
- * connection before the access check. Reverse the order ... A refused account opens no
551
- * socket." The socket cannot open without the connection token, and anything may ask for
552
- * one early -- the ring subscription is built at app init and asks as soon as a user is
577
+ * !! Access first, then realtime: a refused account opens no socket. The socket cannot
578
+ * open without the connection token, and anything may ask for one early -- the ring subscription is built at app init and asks as soon as a user is
553
579
  * set, before the guard's answer is in. So the token waits for the console's answer (the
554
580
  * guard's own request, not a second one) and a refused sign-in gets none: no request, no
555
581
  * socket. A failure to ask is not a refusal, as at the guard.
556
582
  *
557
- * Since 2026-10-06 the connection token is every signed-in account's (Dmitry: "The connection
558
- * token only opens a socket; each channel is authorized when it is subscribed to"), and a
559
- * current server answers the admin manifest to every signed-in account, so no
560
- * sign-in is refused and every one gets its token; each subscription is then decided by its
561
- * channel. The wait stays for a server from before that, where a refused sign-in still opens
562
- * no socket.
583
+ * The connection token is every signed-in account's (it only opens a socket; each channel is
584
+ * authorized when it is subscribed to), and a current server answers the admin manifest to
585
+ * every signed-in account, so no sign-in is refused and every one gets its token; each
586
+ * subscription is then decided by its channel. The wait stays for an older server, where a
587
+ * refused sign-in still opens no socket.
563
588
  */
564
589
  export declare class RealtimeTokenClient {
565
590
  /** The error a refused sign-in's connection-token request ends with. */
@@ -614,7 +639,7 @@ export declare class AuthState {
614
639
  static accessToken(state: AuthStateModel): string | null;
615
640
  static refreshToken(state: AuthStateModel): string | null;
616
641
  /**
617
- * Sub-phase Y -- expose the access-token expiry timestamp so
642
+ * The access token's expiry timestamp, so
618
643
  * preemptive-refresh callers (e.g., Centrifuge getToken
619
644
  * callbacks) can decide whether to rotate before issuing the
620
645
  * next protected request, instead of relying on the
@@ -642,6 +667,29 @@ export declare class AuthState {
642
667
  * makes is still decided by the server.
643
668
  */
644
669
  export declare const authGuard: CanActivateFn;
670
+ /** The account may not enter this interface (not a member of its group). Not a fault: an answer. */
671
+ export declare const AUDIENCE_NOT_GRANTED = "/errors/identity/audience-not-granted";
672
+ /**
673
+ * The token was issued for the other interface (a workspace sign-in sent to the admin, or the reverse). Not a
674
+ * refusal of the account: it never ends the session here.
675
+ */
676
+ export declare const WRONG_INTERFACE = "/errors/identity/wrong-interface";
677
+ /** The sign-in names no interface (a token from before audiences): signing in again mends it. */
678
+ export declare const AUDIENCE_REQUIRED = "/errors/identity/audience-required";
679
+ export type AudienceRefusal = 'not-granted' | 'required';
680
+ /**
681
+ * Which refusal of entry by audience an error is, or null for any other error. Read from the problem's `type` alone
682
+ * (403, `application/problem+json`): its `detail` is for logs, and says another interface's name as readily as this
683
+ * one's. The server answers neither while entry by audience is not checked.
684
+ */
685
+ export declare function audienceRefusalOf(error: unknown): AudienceRefusal | null;
686
+ /**
687
+ * Whether a refused session probe may mean the session is over, so the session is refreshed and, refused again,
688
+ * ended. A 403 is a refusal of this request, not of the session -- unless it is a refusal of entry by audience. So a
689
+ * token for the other interface (`wrong-interface`) or any other 403 keeps the person signed in; anything else (a
690
+ * 401, a failure to ask) goes on as before.
691
+ */
692
+ export declare function sessionEndsOn(error: unknown): boolean;
645
693
  /**
646
694
  * Guards the `/login` route -- redirects already-authenticated
647
695
  * callers to admin home so a stale tab parked on `/login` cannot
@@ -684,9 +732,9 @@ export declare const authInterceptor: HttpInterceptorFn;
684
732
  * CORS, timeouts) propagate without clearing the session so a
685
733
  * momentary refresh failure does not kill a valid login.
686
734
  *
687
- * A token the server REFUSED (2026-09-26). A caller answering a 401
688
- * passes the access token that was refused. Until then the lock body
689
- * handed back the cached token whenever its expiry looked fresh --
735
+ * A token the server REFUSED. A caller answering a 401 passes the
736
+ * access token that was refused. Without it the lock body would hand
737
+ * back the cached token whenever its expiry looked fresh --
690
738
  * which a revoked token's does: a session ended on the server (a
691
739
  * sign-out everywhere from another device, a password change) was
692
740
  * retried with the same dead token and never refreshed, so the client
@@ -973,10 +1021,21 @@ export declare const ELEVATION_REQUIRED_HEADER = "X-Elevation-Required";
973
1021
  * receives the 403 and decides what its own state shows.
974
1022
  */
975
1023
  export declare const BACKGROUND_REQUEST: HttpContextToken<boolean>;
1024
+ /**
1025
+ * The problem type of a 403 refused for want of elevation. The server writes it
1026
+ * where it writes {@link ELEVATION_REQUIRED_HEADER}, naming the check that refused in the
1027
+ * `elevationGate` member; a 403 for any other reason has another type.
1028
+ */
1029
+ export declare const ELEVATION_REQUIRED_PROBLEM_TYPE = "/errors/elevation-required";
1030
+ /** The elevation refusal that asks for the authenticator's code: the password was right. */
1031
+ export declare const ELEVATION_CODE_REQUIRED_TYPE = "/errors/elevation/code-required";
1032
+ /** The elevation refusals that let the person try once more: a wrong password, a wrong or already used code. */
1033
+ export declare const ELEVATION_RETRY_TYPES: readonly string[];
976
1034
  /**
977
1035
  * Whether a failed request was refused for want of elevation: a 403 carrying
978
- * the server's stamp. The one test every reader of a refusal uses -- the
979
- * interceptor, a page's inline state, the error text -- so they cannot disagree.
1036
+ * the server's stamp -- its problem type, or the header. The one test every
1037
+ * reader of a refusal uses -- the interceptor, a page's inline state, the error
1038
+ * text -- so they cannot disagree.
980
1039
  */
981
1040
  export declare function isElevationRefusal(err: unknown): boolean;
982
1041
  export declare class ElevationService {
@@ -1133,7 +1192,7 @@ export declare class ElevationService {
1133
1192
  * A refusal for want of elevation is a 403 the server stamps `X-Elevation-Required`
1134
1193
  * where its gate refused a member who has not elevated ({@link isElevationRefusal}).
1135
1194
  *
1136
- * What it does with a stamped 403 (decided 2026-10-20 for a person's write):
1195
+ * What it does with a stamped 403:
1137
1196
  * - On a write a person made (POST, PUT, PATCH, DELETE without {@link BACKGROUND_REQUEST}):
1138
1197
  * the prompt opens THERE, above whatever the person is in -- an edit dialog stays open
1139
1198
  * beneath it with its input -- and the request is HELD. If the person elevates, it is
@@ -1148,13 +1207,12 @@ export declare class ElevationService {
1148
1207
  * "needs an elevated session" with an Elevate button, or the feature hidden.
1149
1208
  * - On a background request: nothing. Nobody is waiting on it.
1150
1209
  *
1151
- * !! Why reads and background requests still open nothing. Until 2026-10-08 any stamped 403
1152
- * opened the prompt, so the setup reads of almost every console page, and a realtime token at
1153
- * every load, opened it for an administrator who had not elevated: 13 of 15 pages on a menu
1154
- * click, 15 of 15 on a reload (measured). From then until 2026-10-20 a person's write opened
1155
- * nothing either, only a toast -- which, with a dialog open, rendered under it, so the edit had
1156
- * to be thrown away to elevate (measured on the served admin, Edit Node). A person's write is
1157
- * the one refusal somebody is waiting on, which is why it is the one that asks.
1210
+ * !! Why reads and background requests open nothing. Were any stamped 403 to open the prompt,
1211
+ * the setup reads of almost every console page, and a realtime token at every load, would open
1212
+ * it for an administrator who has not elevated (13 of 15 pages on a menu click, 15 of 15 on a
1213
+ * reload, measured). Were a person's write to open nothing but a toast, the toast would render
1214
+ * under an open dialog, and the edit would have to be thrown away to elevate. A person's write
1215
+ * is the one refusal somebody is waiting on, which is why it is the one that asks.
1158
1216
  *
1159
1217
  * The elevation endpoint's own calls carry {@link BYPASS_ELEVATION}: a wrong password is a
1160
1218
  * 403 and is not a refused action. A stamped 403 from anywhere but this API is ignored:
@@ -1176,7 +1234,9 @@ export declare class LoginComponent {
1176
1234
  private readonly store;
1177
1235
  private readonly router;
1178
1236
  /** Shown when the guard signed an account out because the console is not granted to it. */
1179
- static readonly NO_CONSOLE_ACCESS = "This account has no access to the console.";
1237
+ static readonly NO_CONSOLE_ACCESS = "This account may not enter the admin.";
1238
+ /** Shown when a sign-in from before audiences was ended: it names no interface, and a new one will. */
1239
+ static readonly SIGN_IN_AGAIN = "Please sign in again.";
1180
1240
  constructor();
1181
1241
  submit(): void;
1182
1242
  static ɵfac: i0.ɵɵFactoryDeclaration<LoginComponent, never>;
@@ -1214,24 +1274,30 @@ export declare class AppInitService {
1214
1274
  * momentary blip never kills a valid session.
1215
1275
  */
1216
1276
  private validateSession;
1217
- /** GET an authed endpoint with an explicit Bearer header, bypassing the interceptor. */
1277
+ /**
1278
+ * GET /auth/me with an explicit Bearer header, bypassing the interceptor: true, or what refused it. The answer's
1279
+ * uiPrefs are the server's preferences as they are now, and win over the local ones for every entry they hold.
1280
+ */
1218
1281
  private probe;
1219
1282
  static ɵfac: i0.ɵɵFactoryDeclaration<AppInitService, never>;
1220
1283
  static ɵprov: i0.ɵɵInjectableDeclaration<any>;
1221
1284
  }
1222
1285
  /** What the server said about this sign-in and the console. */
1223
- export type ConsoleAccess = 'granted' | 'refused' | 'unknown';
1286
+ /**
1287
+ * `sign-in-again`: the sign-in names no interface (a token from before audiences); signing in again mends it.
1288
+ */
1289
+ export type ConsoleAccess = 'granted' | 'refused' | 'sign-in-again' | 'unknown';
1224
1290
  /**
1225
1291
  * Whether the signed-in account may use the console, and the console's endpoint
1226
1292
  * map when it may.
1227
1293
  *
1228
- * The server decides: `GET /api/v1/admin/manifest` answers the map. Since 2026-10-06
1229
- * (Dmitry: "no host groups"; access is decided by module groups alone) it answers every
1230
- * signed-in account: the map grants nothing, each call it names is decided by its own
1231
- * route, and an account in no group sees the admin with an empty menu. A server from
1232
- * before that answers only at `/api/v1/console/manifest`, to the `console` group, and
1233
- * 403 to anyone else -- there a refused sign-in is still signed out; this asks the new
1234
- * address first and the old one only on its 404. The public theme config
1294
+ * The server decides: `GET /api/v1/admin/manifest` answers the map to every signed-in
1295
+ * account (access is decided by module groups alone): the map grants nothing, each call it
1296
+ * names is decided by its own route, and an account in no group sees the admin with an
1297
+ * empty menu. An older server answers only at `/api/v1/console/manifest`, to the `console`
1298
+ * group, and 403 to anyone else -- there a refused sign-in is still signed out; this asks
1299
+ * the current address first and the older one only on its 404. Only a refusal by type (`audience-not-granted`) is a refusal: a
1300
+ * bare 403 from such a server, or a token for the other interface, is no answer. The public theme config
1235
1301
  * read before sign-in carries only what the sign-in page needs; the rest arrives
1236
1302
  * here, once per sign-in, and is merged into the app config key by key: a key the
1237
1303
  * console's map carries replaces the public one whole, so the console's copy of a
@@ -1253,10 +1319,12 @@ export type ConsoleAccess = 'granted' | 'refused' | 'unknown';
1253
1319
  export declare class ConsoleAccessService {
1254
1320
  /** The admin manifest's URL: fixed, like the theme config's, because nothing is known before it. */
1255
1321
  static readonly URL = "/api/v1/admin/manifest";
1256
- /** The address before 2026-10-06, asked only when a server older than that answers 404 at {@link URL}. */
1322
+ /** An older server's address, asked only when the server answers 404 at {@link URL}. */
1257
1323
  static readonly LEGACY_URL = "/api/v1/console/manifest";
1258
1324
  /** The login page's query parameter value for "signed out: no console access". */
1259
1325
  static readonly REFUSED_REASON = "no-console-access";
1326
+ /** The login page's query parameter value for "signed out: sign in again" (a sign-in that names no audience). */
1327
+ static readonly SIGN_IN_AGAIN_REASON = "sign-in-again";
1260
1328
  private readonly http;
1261
1329
  private readonly store;
1262
1330
  private answer;
@@ -1436,21 +1504,40 @@ export declare class AppConfigState {
1436
1504
  static ɵprov: i0.ɵɵInjectableDeclaration<any>;
1437
1505
  }
1438
1506
  /**
1439
- * Converts any caught error into a human-readable message.
1440
- *
1441
- * Priority order for backend errors:
1442
- * 1. error.detail (RFC 7807 problem detail)
1443
- * 2. error['hydra:description'] (Hydra validation errors)
1444
- * 3. error.message (generic)
1445
- * 4. error.violations[] (constraint violations)
1446
- * 5. Status-based fallback
1507
+ * Converts any caught error into the sentence a person reads: a declared problem's detail as the server gives it, a
1508
+ * validation refusal's first field message, and the one generic sentence for anything else (see refusalWords).
1447
1509
  */
1448
1510
  export declare class ErrorHandlerService {
1449
1511
  humanize(err: unknown): string;
1450
- private statusMessage;
1451
1512
  static ɵfac: i0.ɵɵFactoryDeclaration<ErrorHandlerService, never>;
1452
1513
  static ɵprov: i0.ɵɵInjectableDeclaration<any>;
1453
1514
  }
1515
+ /** What a declared problem says when the server gives no sentence for it (an older server). */
1516
+ export declare const NOT_AVAILABLE = "Not available right now";
1517
+ /** What an undeclared fault or a network failure says: never its own text, which may carry internals. */
1518
+ export declare const SOMETHING_WENT_WRONG = "Something went wrong. Try again.";
1519
+ /** The server's sentence, as given; null for none or a blank one. */
1520
+ export declare function sentenceOf(text: unknown): string | null;
1521
+ /** The problem body of an error answer, parsed when it came as text; null when it is not a plain JSON object. */
1522
+ export declare function problemOf(error: HttpErrorResponse): Record<string, unknown> | null;
1523
+ /**
1524
+ * The declared problem of a failure: its body when the type is set, not about:blank and not a framework's own type for
1525
+ * a server fault, else null.
1526
+ */
1527
+ export declare function declaredProblemOf(error: unknown): Record<string, unknown> | null;
1528
+ /** The declared type of a failure, for behaviour only; null when the problem is undeclared or there is none. */
1529
+ export declare function declaredTypeOf(error: unknown): string | null;
1530
+ /** Whether a failure is the server's refusal (4xx), as opposed to a fault (5xx), a network failure or anything else. */
1531
+ export declare function isRefusal(error: unknown): boolean;
1532
+ /**
1533
+ * What a failed call says, in whose words the components contract sets: a validation refusal (422 with violations) its
1534
+ * first field's message, declared or not, never the top-level detail (a form shows each message next to its field
1535
+ * instead); a declared problem (a type other than about:blank) its `detail` as the server gives it, whatever the
1536
+ * status, or NOT_AVAILABLE when it gives none; an undeclared problem, a network failure or anything else
1537
+ * SOMETHING_WENT_WRONG, never its own text. The type is for behaviour only and never turned into words here. The
1538
+ * result is plain text.
1539
+ */
1540
+ export declare function refusalWords(error: unknown): string;
1454
1541
  /** What the user PICKED. `system` defers to the OS. */
1455
1542
  export type ThemeChoice = 'light' | 'dark' | 'system';
1456
1543
  /** What that resolves to right now -- the only two the stylesheet knows. */
@@ -1540,47 +1627,34 @@ export declare class ThemeService {
1540
1627
  static ɵprov: i0.ɵɵInjectableDeclaration<any>;
1541
1628
  }
1542
1629
  /**
1543
- * The platform's loading indicator: the exclamation mark from Cool!MS,
1544
- * drawing itself.
1630
+ * The platform's loading indicator: the spinner of the UI contract's state component (`state` in design-tokens'
1631
+ * components.json), drawn from the tokens -- an arc turning on its track.
1545
1632
  *
1546
- * ## Why a mark and not a spinner
1547
- *
1548
- * A spinner says "something is happening" and nothing else; every product has
1549
- * one and none of them are yours. The bang is already the one glyph in the
1550
- * wordmark that carries the brand, so a loader built from it says whose
1551
- * software is thinking -- for free, in the place a user is already looking.
1633
+ * One spinner for every wait, the same one the state component turns, so a page does not show two kinds of
1634
+ * waiting. A whole read waiting in place of its content is the state component's
1635
+ * (`cms-state kind="loading"`, which also waits its delay before it shows); this is for the waits inside a row, a
1636
+ * status bar or a button, and for a cover over content not ready to be seen.
1552
1637
  *
1553
1638
  * ## Why one component rather than a snippet per surface
1554
1639
  *
1555
1640
  * It is meant for every wait long enough to notice: a dashboard assembling its
1556
1641
  * cards, an editor paginating a document, an explorer listing a folder. Those
1557
- * are different teams' files, and a copied SVG in each is how three loaders
1558
- * that no longer match each other happen.
1559
- *
1560
- * ## The animation
1642
+ * are different teams' files, and a copied indicator in each is how three
1643
+ * loaders that no longer match each other happen.
1561
1644
  *
1562
- * The stem wipes upward and the dot lands after it, on a loop -- the shape being
1563
- * WRITTEN rather than spun. It is deliberately calm: a loader is background
1564
- * furniture, and anything with a hard beat gets irritating on the third viewing.
1565
1645
  * Under `prefers-reduced-motion` it holds still and only breathes, because
1566
1646
  * motion sickness is not a stylistic preference.
1567
1647
  */
1568
1648
  export declare class CmsLoaderComponent {
1569
- /** Optional caption. Absent renders the mark alone, which suits a small inline wait. */
1649
+ /** Optional caption. Absent renders the spinner alone, which suits a small inline wait. */
1570
1650
  readonly label: import("@angular/core").InputSignal<string>;
1571
1651
  /** Cover the positioned ancestor rather than sitting in the flow. */
1572
1652
  readonly overlay: import("@angular/core").InputSignal<boolean>;
1573
1653
  /**
1574
1654
  * Row layout at text scale, for a wait inside a row, a status bar or a
1575
- * button. Override `--cms-loader-size` to tune the mark.
1655
+ * button. Override `--cms-loader-size` to tune the spinner.
1576
1656
  */
1577
1657
  readonly inline: import("@angular/core").InputSignal<boolean>;
1578
- /**
1579
- * A clip-path needs a document-unique id, and this component is used more
1580
- * than once per page -- two loaders sharing an id makes the second one clip
1581
- * against the first one's rectangle and stop animating.
1582
- */
1583
- protected readonly clipId: string;
1584
1658
  static ɵfac: i0.ɵɵFactoryDeclaration<CmsLoaderComponent, never>;
1585
1659
  static ɵcmp: i0.ɵɵComponentDeclaration<CmsLoaderComponent, "cms-loader", never, {
1586
1660
  "label": {
@@ -1600,68 +1674,80 @@ export declare class CmsLoaderComponent {
1600
1674
  };
1601
1675
  }, {}, never, never, true, never>;
1602
1676
  }
1677
+ /** The prefix of a grid's own entry: `datagrid:<gridId>`. */
1678
+ export declare const DATAGRID_ENTRY_PREFIX = "datagrid:";
1679
+ /** The entry a grid's preferences are kept in. */
1680
+ export declare function datagridEntry(gridId: string): string;
1603
1681
  /**
1604
- * Unified user preferences service -- all preference types share one
1605
- * localStorage key (`coolms_ui_prefs`) and one debounced server-sync pipeline.
1606
- *
1607
- * Key naming convention (stored as nested objects, referenced via dot-notation):
1608
- *
1609
- * // Grids
1610
- * grids.{gridId}.columns
1611
- * grids.{gridId}.columnWidths
1612
- *
1613
- * // Panels (ExplorerLayout persistKey values from YAML)
1614
- * panel.{persistKey}.width
1615
- * panel.{persistKey}.collapsed
1616
- *
1617
- * // Page navigation state
1618
- * page.vfs.lastPath
1619
- * page.vfs.viewMode
1620
- * page.media.lastDir
1621
- * page.media.viewMode
1622
- *
1623
- * // Global
1624
- * nav.lastRoute
1625
- * terminal.height
1626
- * terminal.open
1682
+ * The person's interface preferences: one localStorage key (`coolms_ui_prefs`) holding the entries the server keeps
1683
+ * (PATCH /auth/me/preferences, read back from GET /auth/me's uiPrefs), each an object of fields, by id:
1684
+ *
1685
+ * datagrid:{gridId} { columns, columnWidths } one entry per grid
1686
+ * panel { {persistKey}: { width, collapsed } }
1687
+ * page { vfs: {...}, media: {...}, nav: { lastRoute } }
1688
+ * terminal { height }
1689
+ *
1690
+ * A change is written locally at once and sent, debounced, as the entries that changed only; the server merges each
1691
+ * entry field by field and leaves every other entry as it was. A refusal (422) is shown to the person through
1692
+ * {@link PREFERENCES_NOTICE}; any other failure is tried again after 5 s, 30 s, then every 2 min, and at once when
1693
+ * the browser comes back online or the tab is shown again. On load the server's value wins for every entry it has.
1627
1694
  */
1628
1695
  export declare class UserPreferencesService {
1629
1696
  private readonly http;
1630
1697
  private readonly store;
1631
1698
  private readonly destroyRef;
1699
+ private readonly errors;
1700
+ private readonly notice;
1701
+ private readonly document;
1632
1702
  private readonly STORAGE_KEY;
1633
1703
  private readonly SYNC_DELAY;
1634
- private syncSubject;
1704
+ /** The waits before each try again after a failed send, in ms; the last one repeats. */
1705
+ private readonly RETRY_DELAYS;
1706
+ /** The entries changed since the last send, by id, with the value to send. */
1707
+ private readonly pending;
1708
+ private readonly syncSubject;
1709
+ /** Failed sends since the last one that succeeded; picks the wait before the next try. */
1710
+ private failures;
1711
+ /** The one try again scheduled after a failed send, if any. */
1712
+ private retryTimer;
1635
1713
  constructor();
1636
- /**
1637
- * Write all prefs to localStorage and schedule a debounced server sync.
1638
- */
1714
+ /** Writes all entries locally, and schedules a debounced send of the entries named. */
1639
1715
  private save;
1716
+ private write;
1717
+ private readLocal;
1640
1718
  /**
1641
1719
  * Read the entire prefs object from localStorage, applying legacy key
1642
1720
  * migration on the first read after an upgrade.
1643
1721
  */
1644
1722
  private load;
1645
1723
  /**
1646
- * One-time migration of legacy flat keys to the new nested naming convention.
1647
- * Mutates `all` in place and re-persists only when something changed.
1724
+ * Older shapes, moved to today's in place; true when something moved. Each grid gets its own `datagrid:<id>`
1725
+ * entry -- from the nested `grids` entry, or a flat grid key older still -- unless it already has one; a moved
1726
+ * grid's entry is queued to be sent, so the server keeps the same shape.
1648
1727
  */
1649
1728
  private migrate;
1650
1729
  /**
1651
- * Seed localStorage from server preferences.
1652
- * Called after login and on every session restore (page reload).
1653
- *
1654
- * Strategy:
1655
- * - No local prefs yet (new device / clean install) -> use server prefs as-is.
1656
- * - Local prefs already exist -> merge with local taking priority at each
1657
- * top-level namespace. This ensures that locally-persisted state
1658
- * (panel widths, last path, etc.) is never overwritten by the stale copy
1659
- * that was saved in the auth token at login time.
1730
+ * Takes the server's preferences (GET /auth/me's uiPrefs), after sign-in and on every load: for every entry the
1731
+ * server has, its value wins over the local one; an entry only this browser has is kept. An entry changed here
1732
+ * and not yet sent keeps its local value: it is newer, and on its way. The server's nested `grids` entry gives a
1733
+ * grid its own entry only where neither side has one.
1660
1734
  */
1661
1735
  loadFromServer(uiPrefs: Record<string, unknown>): void;
1736
+ /** Sends the entries changed since the last send, those only. */
1737
+ private flush;
1662
1738
  private syncToServer;
1739
+ /** Schedules the one try again of the pending entries, after the wait the failures so far call for. */
1740
+ private scheduleRetry;
1741
+ private cancelRetry;
1663
1742
  /**
1664
- * Get stored preferences for a specific grid.
1743
+ * A send that failed. A refusal (422) stored nothing and would be refused again: the person is told, in the
1744
+ * server's words. Any other failure keeps the entries (one changed since is newer) and schedules one try again; a
1745
+ * change made meanwhile goes with the next send.
1746
+ */
1747
+ private refused;
1748
+ /**
1749
+ * Get stored preferences for a specific grid: its `datagrid:<gridId>` entry, without the fields a reset left
1750
+ * empty; null when it has none.
1665
1751
  */
1666
1752
  getGridPref(gridId: string): DataGridPreference | null;
1667
1753
  /**
@@ -1675,7 +1761,8 @@ export declare class UserPreferencesService {
1675
1761
  */
1676
1762
  setColumnWidth(gridId: string, field: string, width: number): void;
1677
1763
  /**
1678
- * Remove all preferences for a specific grid and immediately sync to server.
1764
+ * Remove all preferences for a specific grid, and send at once: the server keeps an entry it was once sent,
1765
+ * so the grid's fields are sent empty (null), which it stores as they come.
1679
1766
  */
1680
1767
  resetGrid(gridId: string): void;
1681
1768
  private updateGrid;
@@ -1724,6 +1811,16 @@ export declare class UserPreferencesService {
1724
1811
  static ɵfac: i0.ɵɵFactoryDeclaration<UserPreferencesService, never>;
1725
1812
  static ɵprov: i0.ɵɵInjectableDeclaration<any>;
1726
1813
  }
1814
+ /**
1815
+ * Told when the server refused to store the person's interface preferences (a 422): the application shows the
1816
+ * sentence to the person, in its own toast or notice. `sentence` is whole, ready to show:
1817
+ * "Your preferences could not be saved: <the server's reason>".
1818
+ */
1819
+ export interface PreferencesNoticePort {
1820
+ refused(sentence: string): void;
1821
+ }
1822
+ /** Optional: with nothing bound, a refusal is only written to the console. */
1823
+ export declare const PREFERENCES_NOTICE: InjectionToken<PreferencesNoticePort>;
1727
1824
  /**
1728
1825
  * Sidebar collapse state -- two independent dimensions:
1729
1826
  *
@@ -2116,8 +2213,8 @@ export declare class ConsoleActivation {
2116
2213
  * recognises the URL while the initializer is still fetching `/theme/config`
2117
2214
  * (the two run as parallel initializers), and a synchronous read then found
2118
2215
  * no module installed, so every pasted module URL fell to the wildcard and
2119
- * landed on the dashboard (measured 2026-09-22: no chunk requested for the
2120
- * mount, the dashboard's instead). `ready$` is what the auth guard waits on
2216
+ * landed on the dashboard (no chunk requested for the mount, the dashboard's
2217
+ * instead). `ready$` is what the auth guard waits on
2121
2218
  * too, and it fires whether or not the config fetch succeeded.
2122
2219
  *
2123
2220
  * !! Then the console's own manifest, when someone is signed in: `ui.modules` is
@@ -2139,7 +2236,9 @@ export declare function consoleModuleInstalled(module: string): CanMatchFn;
2139
2236
  export declare function consoleChildren(entries: readonly ConsoleEntry[]): Routes;
2140
2237
  /**
2141
2238
  * The providers a theme adds for the assembled entries: the store with the
2142
- * host's states and every module state, the registry bindings (an
2239
+ * host's states and every module state -- in its strict-CSP mode, which reads
2240
+ * a selector's path without `new Function`, so the admin needs no `'unsafe-eval'`
2241
+ * (every eval its CSP reported was that getter) -- the registry bindings (an
2143
2242
  * initializer, so they exist before the first render), every module
2144
2243
  * provision, and {@link CONSOLE_ENTRIES} for the shell. Place it AFTER the
2145
2244
  * library providers a module's provisions extend (the editor bridge, the
@@ -2149,7 +2248,7 @@ export declare function provideConsole(entries: readonly ConsoleEntry[], options
2149
2248
  readonly hostStates: readonly Type<unknown>[];
2150
2249
  }): EnvironmentProviders;
2151
2250
  /**
2152
- * Phase H7 -- admin Site Selector.
2251
+ * The admin's Site Selector.
2153
2252
  *
2154
2253
  * Stamps `X-CoolMS-Section: <slug>` on outgoing `/api/v1/*` requests when
2155
2254
  * the admin has picked a section from the Site Selector dropdown. The backend