@coolms/core-angular 2.0.0-alpha.6 → 2.0.0-alpha.8
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/CHANGELOG.md +61 -0
- package/LICENSE +1 -1
- package/fesm2022/coolms-core-angular.mjs +350 -189
- package/fesm2022/coolms-core-angular.mjs.map +1 -1
- package/package.json +1 -1
- package/types/coolms-core-angular.d.ts +249 -120
|
@@ -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
|
|
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
|
-
*
|
|
283
|
-
*
|
|
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
|
|
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,30 @@ 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>;
|
|
497
|
+
/** One declared setting as the server reads it for the person: the value in force, and what they set themselves. */
|
|
498
|
+
export interface DeclaredSettingKey {
|
|
499
|
+
readonly key: string;
|
|
500
|
+
/** The value in force: the person's own, else the installation's. */
|
|
501
|
+
readonly value: unknown;
|
|
502
|
+
/** What the person set themselves; null when they set nothing and the installation's value applies. */
|
|
503
|
+
readonly own: unknown;
|
|
504
|
+
readonly locked: boolean;
|
|
505
|
+
}
|
|
506
|
+
/** One section of the person's declared settings. */
|
|
507
|
+
export interface DeclaredSettingsSection {
|
|
508
|
+
readonly section: string;
|
|
509
|
+
readonly keys: ReadonlyArray<DeclaredSettingKey>;
|
|
510
|
+
}
|
|
478
511
|
/**
|
|
479
512
|
* The identity endpoints core owns: the session lifecycle, plus the settings
|
|
480
513
|
* read at boot.
|
|
@@ -494,13 +527,27 @@ export interface HydraCollection<T> {
|
|
|
494
527
|
export declare class IdentityApiClient {
|
|
495
528
|
private readonly http;
|
|
496
529
|
private readonly store;
|
|
530
|
+
private readonly audience;
|
|
531
|
+
/** The settings read while it is in flight, shared by every caller that asks meanwhile. */
|
|
532
|
+
private settingsRead$?;
|
|
497
533
|
/** URLs come from the boot manifest, which core already owns. */
|
|
498
534
|
private get manifest();
|
|
535
|
+
/** Signs in; names the application's audience ({@link AUTH_AUDIENCE}) when it provides one. */
|
|
499
536
|
login(identifier: string, password: string): Observable<TokenResponse>;
|
|
500
537
|
refresh(refreshToken: string): Observable<TokenResponse>;
|
|
501
538
|
logout(): Observable<void>;
|
|
502
539
|
me(): Observable<UserDto>;
|
|
540
|
+
/**
|
|
541
|
+
* The person's settings. Several services read them at start-up, each for its own section; callers that ask while
|
|
542
|
+
* a read is in flight share it, so the page makes one request. A call after it has answered reads again: nothing
|
|
543
|
+
* is kept past the answer, so a save is never hidden behind an old read.
|
|
544
|
+
*/
|
|
503
545
|
getSettings(): Observable<Record<string, Record<string, unknown>>>;
|
|
546
|
+
/**
|
|
547
|
+
* The person's settings as declared: each section's keys with the value in force and the person's own (null when
|
|
548
|
+
* they set none). `host` picks the sections a host reads (`console` for the admin); none gives every section.
|
|
549
|
+
*/
|
|
550
|
+
getDeclaredSettings(host?: string): Observable<ReadonlyArray<DeclaredSettingsSection>>;
|
|
504
551
|
static ɵfac: i0.ɵɵFactoryDeclaration<IdentityApiClient, never>;
|
|
505
552
|
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
506
553
|
}
|
|
@@ -517,7 +564,7 @@ export interface CentrifugoConnectionTokenDto {
|
|
|
517
564
|
* The code the server closes this connection with when the caller's session
|
|
518
565
|
* ended (a sign-out everywhere, a password change, a deactivation). On it the
|
|
519
566
|
* client signs out and ends its calls at once, without reconnecting or waiting
|
|
520
|
-
* for a 401
|
|
567
|
+
* for a 401. Absent from an older server.
|
|
521
568
|
*/
|
|
522
569
|
sessionEndedCode?: number;
|
|
523
570
|
}
|
|
@@ -546,20 +593,17 @@ export interface CentrifugoSubscriptionTokenDto {
|
|
|
546
593
|
* `ApiService` keeps its identical signatures and delegates here, so nothing
|
|
547
594
|
* calling it had to change.
|
|
548
595
|
*
|
|
549
|
-
* !! Access first, then realtime
|
|
550
|
-
*
|
|
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
|
|
596
|
+
* !! Access first, then realtime: a refused account opens no socket. The socket cannot
|
|
597
|
+
* 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
598
|
* set, before the guard's answer is in. So the token waits for the console's answer (the
|
|
554
599
|
* guard's own request, not a second one) and a refused sign-in gets none: no request, no
|
|
555
600
|
* socket. A failure to ask is not a refusal, as at the guard.
|
|
556
601
|
*
|
|
557
|
-
*
|
|
558
|
-
*
|
|
559
|
-
*
|
|
560
|
-
*
|
|
561
|
-
*
|
|
562
|
-
* no socket.
|
|
602
|
+
* The connection token is every signed-in account's (it only opens a socket; each channel is
|
|
603
|
+
* authorized when it is subscribed to), and a current server answers the admin manifest to
|
|
604
|
+
* every signed-in account, so no sign-in is refused and every one gets its token; each
|
|
605
|
+
* subscription is then decided by its channel. The wait stays for an older server, where a
|
|
606
|
+
* refused sign-in still opens no socket.
|
|
563
607
|
*/
|
|
564
608
|
export declare class RealtimeTokenClient {
|
|
565
609
|
/** The error a refused sign-in's connection-token request ends with. */
|
|
@@ -614,7 +658,7 @@ export declare class AuthState {
|
|
|
614
658
|
static accessToken(state: AuthStateModel): string | null;
|
|
615
659
|
static refreshToken(state: AuthStateModel): string | null;
|
|
616
660
|
/**
|
|
617
|
-
*
|
|
661
|
+
* The access token's expiry timestamp, so
|
|
618
662
|
* preemptive-refresh callers (e.g., Centrifuge getToken
|
|
619
663
|
* callbacks) can decide whether to rotate before issuing the
|
|
620
664
|
* next protected request, instead of relying on the
|
|
@@ -642,6 +686,29 @@ export declare class AuthState {
|
|
|
642
686
|
* makes is still decided by the server.
|
|
643
687
|
*/
|
|
644
688
|
export declare const authGuard: CanActivateFn;
|
|
689
|
+
/** The account may not enter this interface (not a member of its group). Not a fault: an answer. */
|
|
690
|
+
export declare const AUDIENCE_NOT_GRANTED = "/errors/identity/audience-not-granted";
|
|
691
|
+
/**
|
|
692
|
+
* The token was issued for the other interface (a workspace sign-in sent to the admin, or the reverse). Not a
|
|
693
|
+
* refusal of the account: it never ends the session here.
|
|
694
|
+
*/
|
|
695
|
+
export declare const WRONG_INTERFACE = "/errors/identity/wrong-interface";
|
|
696
|
+
/** The sign-in names no interface (a token from before audiences): signing in again mends it. */
|
|
697
|
+
export declare const AUDIENCE_REQUIRED = "/errors/identity/audience-required";
|
|
698
|
+
export type AudienceRefusal = 'not-granted' | 'required';
|
|
699
|
+
/**
|
|
700
|
+
* Which refusal of entry by audience an error is, or null for any other error. Read from the problem's `type` alone
|
|
701
|
+
* (403, `application/problem+json`): its `detail` is for logs, and says another interface's name as readily as this
|
|
702
|
+
* one's. The server answers neither while entry by audience is not checked.
|
|
703
|
+
*/
|
|
704
|
+
export declare function audienceRefusalOf(error: unknown): AudienceRefusal | null;
|
|
705
|
+
/**
|
|
706
|
+
* Whether a refused session probe may mean the session is over, so the session is refreshed and, refused again,
|
|
707
|
+
* ended. A 403 is a refusal of this request, not of the session -- unless it is a refusal of entry by audience. So a
|
|
708
|
+
* token for the other interface (`wrong-interface`) or any other 403 keeps the person signed in; anything else (a
|
|
709
|
+
* 401, a failure to ask) goes on as before.
|
|
710
|
+
*/
|
|
711
|
+
export declare function sessionEndsOn(error: unknown): boolean;
|
|
645
712
|
/**
|
|
646
713
|
* Guards the `/login` route -- redirects already-authenticated
|
|
647
714
|
* callers to admin home so a stale tab parked on `/login` cannot
|
|
@@ -684,9 +751,9 @@ export declare const authInterceptor: HttpInterceptorFn;
|
|
|
684
751
|
* CORS, timeouts) propagate without clearing the session so a
|
|
685
752
|
* momentary refresh failure does not kill a valid login.
|
|
686
753
|
*
|
|
687
|
-
* A token the server REFUSED
|
|
688
|
-
*
|
|
689
|
-
*
|
|
754
|
+
* A token the server REFUSED. A caller answering a 401 passes the
|
|
755
|
+
* access token that was refused. Without it the lock body would hand
|
|
756
|
+
* back the cached token whenever its expiry looked fresh --
|
|
690
757
|
* which a revoked token's does: a session ended on the server (a
|
|
691
758
|
* sign-out everywhere from another device, a password change) was
|
|
692
759
|
* retried with the same dead token and never refreshed, so the client
|
|
@@ -973,10 +1040,21 @@ export declare const ELEVATION_REQUIRED_HEADER = "X-Elevation-Required";
|
|
|
973
1040
|
* receives the 403 and decides what its own state shows.
|
|
974
1041
|
*/
|
|
975
1042
|
export declare const BACKGROUND_REQUEST: HttpContextToken<boolean>;
|
|
1043
|
+
/**
|
|
1044
|
+
* The problem type of a 403 refused for want of elevation. The server writes it
|
|
1045
|
+
* where it writes {@link ELEVATION_REQUIRED_HEADER}, naming the check that refused in the
|
|
1046
|
+
* `elevationGate` member; a 403 for any other reason has another type.
|
|
1047
|
+
*/
|
|
1048
|
+
export declare const ELEVATION_REQUIRED_PROBLEM_TYPE = "/errors/elevation-required";
|
|
1049
|
+
/** The elevation refusal that asks for the authenticator's code: the password was right. */
|
|
1050
|
+
export declare const ELEVATION_CODE_REQUIRED_TYPE = "/errors/elevation/code-required";
|
|
1051
|
+
/** The elevation refusals that let the person try once more: a wrong password, a wrong or already used code. */
|
|
1052
|
+
export declare const ELEVATION_RETRY_TYPES: readonly string[];
|
|
976
1053
|
/**
|
|
977
1054
|
* Whether a failed request was refused for want of elevation: a 403 carrying
|
|
978
|
-
* the server's stamp
|
|
979
|
-
* interceptor, a page's inline state, the error
|
|
1055
|
+
* the server's stamp -- its problem type, or the header. The one test every
|
|
1056
|
+
* reader of a refusal uses -- the interceptor, a page's inline state, the error
|
|
1057
|
+
* text -- so they cannot disagree.
|
|
980
1058
|
*/
|
|
981
1059
|
export declare function isElevationRefusal(err: unknown): boolean;
|
|
982
1060
|
export declare class ElevationService {
|
|
@@ -1013,6 +1091,17 @@ export declare class ElevationService {
|
|
|
1013
1091
|
* so subscribers that refetch a listing on it never refetch for no reason.
|
|
1014
1092
|
*/
|
|
1015
1093
|
readonly changes$: Subject<ElevationChange>;
|
|
1094
|
+
private readonly retriesWaiting;
|
|
1095
|
+
/**
|
|
1096
|
+
* How many refused writes wait to be sent again: each is counted from the moment its refusal is taken up, before
|
|
1097
|
+
* any prompt opens, until its repeat has answered or the person declined. A view that reloads after a grant waits
|
|
1098
|
+
* for 0, so the reload never cancels a repeat in flight.
|
|
1099
|
+
*/
|
|
1100
|
+
readonly retriesPending: import("@angular/core").Signal<number>;
|
|
1101
|
+
/** Each time the last refused write waiting for its repeat stops waiting: `retriesPending` has come back to 0. */
|
|
1102
|
+
readonly retriesSettled$: Subject<void>;
|
|
1103
|
+
/** Counts one refused write as waiting for its repeat; the function returned ends that count, once. */
|
|
1104
|
+
holdForRetry(): () => void;
|
|
1016
1105
|
private expiryTimer;
|
|
1017
1106
|
private pendingPrompt;
|
|
1018
1107
|
private expiryAnnouncePending;
|
|
@@ -1133,7 +1222,7 @@ export declare class ElevationService {
|
|
|
1133
1222
|
* A refusal for want of elevation is a 403 the server stamps `X-Elevation-Required`
|
|
1134
1223
|
* where its gate refused a member who has not elevated ({@link isElevationRefusal}).
|
|
1135
1224
|
*
|
|
1136
|
-
* What it does with a stamped 403
|
|
1225
|
+
* What it does with a stamped 403:
|
|
1137
1226
|
* - On a write a person made (POST, PUT, PATCH, DELETE without {@link BACKGROUND_REQUEST}):
|
|
1138
1227
|
* the prompt opens THERE, above whatever the person is in -- an edit dialog stays open
|
|
1139
1228
|
* beneath it with its input -- and the request is HELD. If the person elevates, it is
|
|
@@ -1148,13 +1237,12 @@ export declare class ElevationService {
|
|
|
1148
1237
|
* "needs an elevated session" with an Elevate button, or the feature hidden.
|
|
1149
1238
|
* - On a background request: nothing. Nobody is waiting on it.
|
|
1150
1239
|
*
|
|
1151
|
-
* !! Why reads and background requests
|
|
1152
|
-
*
|
|
1153
|
-
*
|
|
1154
|
-
*
|
|
1155
|
-
*
|
|
1156
|
-
*
|
|
1157
|
-
* the one refusal somebody is waiting on, which is why it is the one that asks.
|
|
1240
|
+
* !! Why reads and background requests open nothing. Were any stamped 403 to open the prompt,
|
|
1241
|
+
* the setup reads of almost every console page, and a realtime token at every load, would open
|
|
1242
|
+
* it for an administrator who has not elevated (13 of 15 pages on a menu click, 15 of 15 on a
|
|
1243
|
+
* reload, measured). Were a person's write to open nothing but a toast, the toast would render
|
|
1244
|
+
* under an open dialog, and the edit would have to be thrown away to elevate. A person's write
|
|
1245
|
+
* is the one refusal somebody is waiting on, which is why it is the one that asks.
|
|
1158
1246
|
*
|
|
1159
1247
|
* The elevation endpoint's own calls carry {@link BYPASS_ELEVATION}: a wrong password is a
|
|
1160
1248
|
* 403 and is not a refused action. A stamped 403 from anywhere but this API is ignored:
|
|
@@ -1176,7 +1264,9 @@ export declare class LoginComponent {
|
|
|
1176
1264
|
private readonly store;
|
|
1177
1265
|
private readonly router;
|
|
1178
1266
|
/** Shown when the guard signed an account out because the console is not granted to it. */
|
|
1179
|
-
static readonly NO_CONSOLE_ACCESS = "This account
|
|
1267
|
+
static readonly NO_CONSOLE_ACCESS = "This account may not enter the admin.";
|
|
1268
|
+
/** Shown when a sign-in from before audiences was ended: it names no interface, and a new one will. */
|
|
1269
|
+
static readonly SIGN_IN_AGAIN = "Please sign in again.";
|
|
1180
1270
|
constructor();
|
|
1181
1271
|
submit(): void;
|
|
1182
1272
|
static ɵfac: i0.ɵɵFactoryDeclaration<LoginComponent, never>;
|
|
@@ -1214,24 +1304,30 @@ export declare class AppInitService {
|
|
|
1214
1304
|
* momentary blip never kills a valid session.
|
|
1215
1305
|
*/
|
|
1216
1306
|
private validateSession;
|
|
1217
|
-
/**
|
|
1307
|
+
/**
|
|
1308
|
+
* GET /auth/me with an explicit Bearer header, bypassing the interceptor: true, or what refused it. The answer's
|
|
1309
|
+
* uiPrefs are the server's preferences as they are now, and win over the local ones for every entry they hold.
|
|
1310
|
+
*/
|
|
1218
1311
|
private probe;
|
|
1219
1312
|
static ɵfac: i0.ɵɵFactoryDeclaration<AppInitService, never>;
|
|
1220
1313
|
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
1221
1314
|
}
|
|
1222
1315
|
/** What the server said about this sign-in and the console. */
|
|
1223
|
-
|
|
1316
|
+
/**
|
|
1317
|
+
* `sign-in-again`: the sign-in names no interface (a token from before audiences); signing in again mends it.
|
|
1318
|
+
*/
|
|
1319
|
+
export type ConsoleAccess = 'granted' | 'refused' | 'sign-in-again' | 'unknown';
|
|
1224
1320
|
/**
|
|
1225
1321
|
* Whether the signed-in account may use the console, and the console's endpoint
|
|
1226
1322
|
* map when it may.
|
|
1227
1323
|
*
|
|
1228
|
-
* The server decides: `GET /api/v1/admin/manifest` answers the map
|
|
1229
|
-
* (
|
|
1230
|
-
*
|
|
1231
|
-
*
|
|
1232
|
-
*
|
|
1233
|
-
*
|
|
1234
|
-
*
|
|
1324
|
+
* The server decides: `GET /api/v1/admin/manifest` answers the map to every signed-in
|
|
1325
|
+
* account (access is decided by module groups alone): the map grants nothing, each call it
|
|
1326
|
+
* names is decided by its own route, and an account in no group sees the admin with an
|
|
1327
|
+
* empty menu. An older server answers only at `/api/v1/console/manifest`, to the `console`
|
|
1328
|
+
* group, and 403 to anyone else -- there a refused sign-in is still signed out; this asks
|
|
1329
|
+
* the current address first and the older one only on its 404. Only a refusal by type (`audience-not-granted`) is a refusal: a
|
|
1330
|
+
* bare 403 from such a server, or a token for the other interface, is no answer. The public theme config
|
|
1235
1331
|
* read before sign-in carries only what the sign-in page needs; the rest arrives
|
|
1236
1332
|
* here, once per sign-in, and is merged into the app config key by key: a key the
|
|
1237
1333
|
* console's map carries replaces the public one whole, so the console's copy of a
|
|
@@ -1253,10 +1349,12 @@ export type ConsoleAccess = 'granted' | 'refused' | 'unknown';
|
|
|
1253
1349
|
export declare class ConsoleAccessService {
|
|
1254
1350
|
/** The admin manifest's URL: fixed, like the theme config's, because nothing is known before it. */
|
|
1255
1351
|
static readonly URL = "/api/v1/admin/manifest";
|
|
1256
|
-
/**
|
|
1352
|
+
/** An older server's address, asked only when the server answers 404 at {@link URL}. */
|
|
1257
1353
|
static readonly LEGACY_URL = "/api/v1/console/manifest";
|
|
1258
1354
|
/** The login page's query parameter value for "signed out: no console access". */
|
|
1259
1355
|
static readonly REFUSED_REASON = "no-console-access";
|
|
1356
|
+
/** The login page's query parameter value for "signed out: sign in again" (a sign-in that names no audience). */
|
|
1357
|
+
static readonly SIGN_IN_AGAIN_REASON = "sign-in-again";
|
|
1260
1358
|
private readonly http;
|
|
1261
1359
|
private readonly store;
|
|
1262
1360
|
private answer;
|
|
@@ -1436,21 +1534,40 @@ export declare class AppConfigState {
|
|
|
1436
1534
|
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
1437
1535
|
}
|
|
1438
1536
|
/**
|
|
1439
|
-
* Converts any caught error into a
|
|
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
|
|
1537
|
+
* Converts any caught error into the sentence a person reads: a declared problem's detail as the server gives it, a
|
|
1538
|
+
* validation refusal's first field message, and the one generic sentence for anything else (see refusalWords).
|
|
1447
1539
|
*/
|
|
1448
1540
|
export declare class ErrorHandlerService {
|
|
1449
1541
|
humanize(err: unknown): string;
|
|
1450
|
-
private statusMessage;
|
|
1451
1542
|
static ɵfac: i0.ɵɵFactoryDeclaration<ErrorHandlerService, never>;
|
|
1452
1543
|
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
1453
1544
|
}
|
|
1545
|
+
/** What a declared problem says when the server gives no sentence for it (an older server). */
|
|
1546
|
+
export declare const NOT_AVAILABLE = "Not available right now";
|
|
1547
|
+
/** What an undeclared fault or a network failure says: never its own text, which may carry internals. */
|
|
1548
|
+
export declare const SOMETHING_WENT_WRONG = "Something went wrong. Try again.";
|
|
1549
|
+
/** The server's sentence, as given; null for none or a blank one. */
|
|
1550
|
+
export declare function sentenceOf(text: unknown): string | null;
|
|
1551
|
+
/** The problem body of an error answer, parsed when it came as text; null when it is not a plain JSON object. */
|
|
1552
|
+
export declare function problemOf(error: HttpErrorResponse): Record<string, unknown> | null;
|
|
1553
|
+
/**
|
|
1554
|
+
* The declared problem of a failure: its body when the type is set, not about:blank and not a framework's own type for
|
|
1555
|
+
* a server fault, else null.
|
|
1556
|
+
*/
|
|
1557
|
+
export declare function declaredProblemOf(error: unknown): Record<string, unknown> | null;
|
|
1558
|
+
/** The declared type of a failure, for behaviour only; null when the problem is undeclared or there is none. */
|
|
1559
|
+
export declare function declaredTypeOf(error: unknown): string | null;
|
|
1560
|
+
/** Whether a failure is the server's refusal (4xx), as opposed to a fault (5xx), a network failure or anything else. */
|
|
1561
|
+
export declare function isRefusal(error: unknown): boolean;
|
|
1562
|
+
/**
|
|
1563
|
+
* What a failed call says, in whose words the components contract sets: a validation refusal (422 with violations) its
|
|
1564
|
+
* first field's message, declared or not, never the top-level detail (a form shows each message next to its field
|
|
1565
|
+
* instead); a declared problem (a type other than about:blank) its `detail` as the server gives it, whatever the
|
|
1566
|
+
* status, or NOT_AVAILABLE when it gives none; an undeclared problem, a network failure or anything else
|
|
1567
|
+
* SOMETHING_WENT_WRONG, never its own text. The type is for behaviour only and never turned into words here. The
|
|
1568
|
+
* result is plain text.
|
|
1569
|
+
*/
|
|
1570
|
+
export declare function refusalWords(error: unknown): string;
|
|
1454
1571
|
/** What the user PICKED. `system` defers to the OS. */
|
|
1455
1572
|
export type ThemeChoice = 'light' | 'dark' | 'system';
|
|
1456
1573
|
/** What that resolves to right now -- the only two the stylesheet knows. */
|
|
@@ -1540,47 +1657,34 @@ export declare class ThemeService {
|
|
|
1540
1657
|
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
1541
1658
|
}
|
|
1542
1659
|
/**
|
|
1543
|
-
* The platform's loading indicator: the
|
|
1544
|
-
*
|
|
1545
|
-
*
|
|
1546
|
-
* ## Why a mark and not a spinner
|
|
1660
|
+
* The platform's loading indicator: the spinner of the UI contract's state component (`state` in design-tokens'
|
|
1661
|
+
* components.json), drawn from the tokens -- an arc turning on its track.
|
|
1547
1662
|
*
|
|
1548
|
-
*
|
|
1549
|
-
*
|
|
1550
|
-
*
|
|
1551
|
-
*
|
|
1663
|
+
* One spinner for every wait, the same one the state component turns, so a page does not show two kinds of
|
|
1664
|
+
* waiting. A whole read waiting in place of its content is the state component's
|
|
1665
|
+
* (`cms-state kind="loading"`, which also waits its delay before it shows); this is for the waits inside a row, a
|
|
1666
|
+
* status bar or a button, and for a cover over content not ready to be seen.
|
|
1552
1667
|
*
|
|
1553
1668
|
* ## Why one component rather than a snippet per surface
|
|
1554
1669
|
*
|
|
1555
1670
|
* It is meant for every wait long enough to notice: a dashboard assembling its
|
|
1556
1671
|
* cards, an editor paginating a document, an explorer listing a folder. Those
|
|
1557
|
-
* are different teams' files, and a copied
|
|
1558
|
-
* that no longer match each other happen.
|
|
1672
|
+
* are different teams' files, and a copied indicator in each is how three
|
|
1673
|
+
* loaders that no longer match each other happen.
|
|
1559
1674
|
*
|
|
1560
|
-
* ## The animation
|
|
1561
|
-
*
|
|
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
1675
|
* Under `prefers-reduced-motion` it holds still and only breathes, because
|
|
1566
1676
|
* motion sickness is not a stylistic preference.
|
|
1567
1677
|
*/
|
|
1568
1678
|
export declare class CmsLoaderComponent {
|
|
1569
|
-
/** Optional caption. Absent renders the
|
|
1679
|
+
/** Optional caption. Absent renders the spinner alone, which suits a small inline wait. */
|
|
1570
1680
|
readonly label: import("@angular/core").InputSignal<string>;
|
|
1571
1681
|
/** Cover the positioned ancestor rather than sitting in the flow. */
|
|
1572
1682
|
readonly overlay: import("@angular/core").InputSignal<boolean>;
|
|
1573
1683
|
/**
|
|
1574
1684
|
* 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
|
|
1685
|
+
* button. Override `--cms-loader-size` to tune the spinner.
|
|
1576
1686
|
*/
|
|
1577
1687
|
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
1688
|
static ɵfac: i0.ɵɵFactoryDeclaration<CmsLoaderComponent, never>;
|
|
1585
1689
|
static ɵcmp: i0.ɵɵComponentDeclaration<CmsLoaderComponent, "cms-loader", never, {
|
|
1586
1690
|
"label": {
|
|
@@ -1600,68 +1704,80 @@ export declare class CmsLoaderComponent {
|
|
|
1600
1704
|
};
|
|
1601
1705
|
}, {}, never, never, true, never>;
|
|
1602
1706
|
}
|
|
1707
|
+
/** The prefix of a grid's own entry: `datagrid:<gridId>`. */
|
|
1708
|
+
export declare const DATAGRID_ENTRY_PREFIX = "datagrid:";
|
|
1709
|
+
/** The entry a grid's preferences are kept in. */
|
|
1710
|
+
export declare function datagridEntry(gridId: string): string;
|
|
1603
1711
|
/**
|
|
1604
|
-
*
|
|
1605
|
-
*
|
|
1606
|
-
*
|
|
1607
|
-
*
|
|
1608
|
-
*
|
|
1609
|
-
*
|
|
1610
|
-
*
|
|
1611
|
-
*
|
|
1612
|
-
*
|
|
1613
|
-
*
|
|
1614
|
-
*
|
|
1615
|
-
*
|
|
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
|
|
1712
|
+
* The person's interface preferences: one localStorage key (`coolms_ui_prefs`) holding the entries the server keeps
|
|
1713
|
+
* (PATCH /auth/me/preferences, read back from GET /auth/me's uiPrefs), each an object of fields, by id:
|
|
1714
|
+
*
|
|
1715
|
+
* datagrid:{gridId} { columns, columnWidths } one entry per grid
|
|
1716
|
+
* panel { {persistKey}: { width, collapsed } }
|
|
1717
|
+
* page { vfs: {...}, media: {...}, nav: { lastRoute } }
|
|
1718
|
+
* terminal { height }
|
|
1719
|
+
*
|
|
1720
|
+
* A change is written locally at once and sent, debounced, as the entries that changed only; the server merges each
|
|
1721
|
+
* entry field by field and leaves every other entry as it was. A refusal (422) is shown to the person through
|
|
1722
|
+
* {@link PREFERENCES_NOTICE}; any other failure is tried again after 5 s, 30 s, then every 2 min, and at once when
|
|
1723
|
+
* the browser comes back online or the tab is shown again. On load the server's value wins for every entry it has.
|
|
1627
1724
|
*/
|
|
1628
1725
|
export declare class UserPreferencesService {
|
|
1629
1726
|
private readonly http;
|
|
1630
1727
|
private readonly store;
|
|
1631
1728
|
private readonly destroyRef;
|
|
1729
|
+
private readonly errors;
|
|
1730
|
+
private readonly notice;
|
|
1731
|
+
private readonly document;
|
|
1632
1732
|
private readonly STORAGE_KEY;
|
|
1633
1733
|
private readonly SYNC_DELAY;
|
|
1634
|
-
|
|
1734
|
+
/** The waits before each try again after a failed send, in ms; the last one repeats. */
|
|
1735
|
+
private readonly RETRY_DELAYS;
|
|
1736
|
+
/** The entries changed since the last send, by id, with the value to send. */
|
|
1737
|
+
private readonly pending;
|
|
1738
|
+
private readonly syncSubject;
|
|
1739
|
+
/** Failed sends since the last one that succeeded; picks the wait before the next try. */
|
|
1740
|
+
private failures;
|
|
1741
|
+
/** The one try again scheduled after a failed send, if any. */
|
|
1742
|
+
private retryTimer;
|
|
1635
1743
|
constructor();
|
|
1636
|
-
/**
|
|
1637
|
-
* Write all prefs to localStorage and schedule a debounced server sync.
|
|
1638
|
-
*/
|
|
1744
|
+
/** Writes all entries locally, and schedules a debounced send of the entries named. */
|
|
1639
1745
|
private save;
|
|
1746
|
+
private write;
|
|
1747
|
+
private readLocal;
|
|
1640
1748
|
/**
|
|
1641
1749
|
* Read the entire prefs object from localStorage, applying legacy key
|
|
1642
1750
|
* migration on the first read after an upgrade.
|
|
1643
1751
|
*/
|
|
1644
1752
|
private load;
|
|
1645
1753
|
/**
|
|
1646
|
-
*
|
|
1647
|
-
*
|
|
1754
|
+
* Older shapes, moved to today's in place; true when something moved. Each grid gets its own `datagrid:<id>`
|
|
1755
|
+
* entry -- from the nested `grids` entry, or a flat grid key older still -- unless it already has one; a moved
|
|
1756
|
+
* grid's entry is queued to be sent, so the server keeps the same shape.
|
|
1648
1757
|
*/
|
|
1649
1758
|
private migrate;
|
|
1650
1759
|
/**
|
|
1651
|
-
*
|
|
1652
|
-
*
|
|
1653
|
-
*
|
|
1654
|
-
*
|
|
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.
|
|
1760
|
+
* Takes the server's preferences (GET /auth/me's uiPrefs), after sign-in and on every load: for every entry the
|
|
1761
|
+
* server has, its value wins over the local one; an entry only this browser has is kept. An entry changed here
|
|
1762
|
+
* and not yet sent keeps its local value: it is newer, and on its way. The server's nested `grids` entry gives a
|
|
1763
|
+
* grid its own entry only where neither side has one.
|
|
1660
1764
|
*/
|
|
1661
1765
|
loadFromServer(uiPrefs: Record<string, unknown>): void;
|
|
1766
|
+
/** Sends the entries changed since the last send, those only. */
|
|
1767
|
+
private flush;
|
|
1662
1768
|
private syncToServer;
|
|
1769
|
+
/** Schedules the one try again of the pending entries, after the wait the failures so far call for. */
|
|
1770
|
+
private scheduleRetry;
|
|
1771
|
+
private cancelRetry;
|
|
1772
|
+
/**
|
|
1773
|
+
* A send that failed. A refusal (422) stored nothing and would be refused again: the person is told, in the
|
|
1774
|
+
* server's words. Any other failure keeps the entries (one changed since is newer) and schedules one try again; a
|
|
1775
|
+
* change made meanwhile goes with the next send.
|
|
1776
|
+
*/
|
|
1777
|
+
private refused;
|
|
1663
1778
|
/**
|
|
1664
|
-
* Get stored preferences for a specific grid
|
|
1779
|
+
* Get stored preferences for a specific grid: its `datagrid:<gridId>` entry, without the fields a reset left
|
|
1780
|
+
* empty; null when it has none.
|
|
1665
1781
|
*/
|
|
1666
1782
|
getGridPref(gridId: string): DataGridPreference | null;
|
|
1667
1783
|
/**
|
|
@@ -1675,7 +1791,8 @@ export declare class UserPreferencesService {
|
|
|
1675
1791
|
*/
|
|
1676
1792
|
setColumnWidth(gridId: string, field: string, width: number): void;
|
|
1677
1793
|
/**
|
|
1678
|
-
* Remove all preferences for a specific grid and
|
|
1794
|
+
* Remove all preferences for a specific grid, and send at once: the server keeps an entry it was once sent,
|
|
1795
|
+
* so the grid's fields are sent empty (null), which it stores as they come.
|
|
1679
1796
|
*/
|
|
1680
1797
|
resetGrid(gridId: string): void;
|
|
1681
1798
|
private updateGrid;
|
|
@@ -1724,6 +1841,16 @@ export declare class UserPreferencesService {
|
|
|
1724
1841
|
static ɵfac: i0.ɵɵFactoryDeclaration<UserPreferencesService, never>;
|
|
1725
1842
|
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
1726
1843
|
}
|
|
1844
|
+
/**
|
|
1845
|
+
* Told when the server refused to store the person's interface preferences (a 422): the application shows the
|
|
1846
|
+
* sentence to the person, in its own toast or notice. `sentence` is whole, ready to show:
|
|
1847
|
+
* "Your preferences could not be saved: <the server's reason>".
|
|
1848
|
+
*/
|
|
1849
|
+
export interface PreferencesNoticePort {
|
|
1850
|
+
refused(sentence: string): void;
|
|
1851
|
+
}
|
|
1852
|
+
/** Optional: with nothing bound, a refusal is only written to the console. */
|
|
1853
|
+
export declare const PREFERENCES_NOTICE: InjectionToken<PreferencesNoticePort>;
|
|
1727
1854
|
/**
|
|
1728
1855
|
* Sidebar collapse state -- two independent dimensions:
|
|
1729
1856
|
*
|
|
@@ -2116,8 +2243,8 @@ export declare class ConsoleActivation {
|
|
|
2116
2243
|
* recognises the URL while the initializer is still fetching `/theme/config`
|
|
2117
2244
|
* (the two run as parallel initializers), and a synchronous read then found
|
|
2118
2245
|
* no module installed, so every pasted module URL fell to the wildcard and
|
|
2119
|
-
* landed on the dashboard (
|
|
2120
|
-
*
|
|
2246
|
+
* landed on the dashboard (no chunk requested for the mount, the dashboard's
|
|
2247
|
+
* instead). `ready$` is what the auth guard waits on
|
|
2121
2248
|
* too, and it fires whether or not the config fetch succeeded.
|
|
2122
2249
|
*
|
|
2123
2250
|
* !! Then the console's own manifest, when someone is signed in: `ui.modules` is
|
|
@@ -2139,7 +2266,9 @@ export declare function consoleModuleInstalled(module: string): CanMatchFn;
|
|
|
2139
2266
|
export declare function consoleChildren(entries: readonly ConsoleEntry[]): Routes;
|
|
2140
2267
|
/**
|
|
2141
2268
|
* The providers a theme adds for the assembled entries: the store with the
|
|
2142
|
-
* host's states and every module state
|
|
2269
|
+
* host's states and every module state -- in its strict-CSP mode, which reads
|
|
2270
|
+
* a selector's path without `new Function`, so the admin needs no `'unsafe-eval'`
|
|
2271
|
+
* (every eval its CSP reported was that getter) -- the registry bindings (an
|
|
2143
2272
|
* initializer, so they exist before the first render), every module
|
|
2144
2273
|
* provision, and {@link CONSOLE_ENTRIES} for the shell. Place it AFTER the
|
|
2145
2274
|
* library providers a module's provisions extend (the editor bridge, the
|
|
@@ -2149,7 +2278,7 @@ export declare function provideConsole(entries: readonly ConsoleEntry[], options
|
|
|
2149
2278
|
readonly hostStates: readonly Type<unknown>[];
|
|
2150
2279
|
}): EnvironmentProviders;
|
|
2151
2280
|
/**
|
|
2152
|
-
*
|
|
2281
|
+
* The admin's Site Selector.
|
|
2153
2282
|
*
|
|
2154
2283
|
* Stamps `X-CoolMS-Section: <slug>` on outgoing `/api/v1/*` requests when
|
|
2155
2284
|
* the admin has picked a section from the Site Selector dropdown. The backend
|