@coolms/core-angular 2.0.0-alpha.10

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.
@@ -0,0 +1,2373 @@
1
+ import * as i0 from "@angular/core";
2
+ import { EnvironmentProviders, InjectionToken, Provider, Type } from "@angular/core";
3
+ import { Observable, Subject } from "rxjs";
4
+ import { StateContext } from "@ngxs/store";
5
+ import { CanActivateFn, CanMatchFn, Routes } from "@angular/router";
6
+ import { HttpContextToken, HttpErrorResponse, HttpInterceptorFn, HttpRequest } from "@angular/common/http";
7
+ export interface AuthApiManifest {
8
+ readonly login: string;
9
+ readonly logout: string;
10
+ readonly refresh: string;
11
+ readonly register: string;
12
+ readonly me: string;
13
+ readonly usersApi?: string;
14
+ readonly groupsApi?: string;
15
+ readonly preferencesUrl?: string;
16
+ readonly groupFormId?: string | null;
17
+ readonly userFormId?: string | null;
18
+ }
19
+ export interface SectionApiManifest {
20
+ readonly list: string;
21
+ readonly create: string;
22
+ readonly item: string;
23
+ readonly update: string;
24
+ readonly delete: string;
25
+ readonly formId?: string;
26
+ readonly apply?: string;
27
+ }
28
+ export interface NaviApiManifest {
29
+ readonly treesList: string;
30
+ readonly treesCreate: string;
31
+ readonly treesItem: string;
32
+ readonly nodesList: string;
33
+ readonly nodesCreate: string;
34
+ readonly nodesItem: string;
35
+ readonly nodesReorder: string;
36
+ readonly nodesMove: string;
37
+ readonly nodesByTree: string;
38
+ readonly treesFormId?: string;
39
+ readonly nodesFormId?: string;
40
+ readonly adminNavGraph?: string;
41
+ readonly topbarNavGraph?: string;
42
+ readonly toolbarVfsGraph?: string;
43
+ readonly graphBySlug?: string;
44
+ }
45
+ export interface ContentApiManifest {
46
+ readonly variantPublishUrl: string;
47
+ readonly pageSpacesUrl?: string;
48
+ readonly pageTypesUrl?: string;
49
+ }
50
+ export interface DataGridApiManifest {
51
+ readonly configBase: string;
52
+ }
53
+ export interface TerminalApiManifest {
54
+ readonly executeUrl: string;
55
+ readonly completeUrl: string;
56
+ }
57
+ export interface MediaApiManifest {
58
+ readonly listUrl: string;
59
+ readonly itemUrl: string;
60
+ readonly permissionsUrl: string;
61
+ readonly regenerateUrl: string;
62
+ readonly resizeUrl: string;
63
+ readonly collectionsUrl: string;
64
+ readonly collectionsCreateUrl: string;
65
+ readonly collectionPermissionsUrl: string;
66
+ readonly moveUrl?: string;
67
+ readonly spacesUrl?: string;
68
+ }
69
+ export interface VfsApiManifest {
70
+ readonly fileContentUrl: string;
71
+ readonly binaryWriteUrl: string;
72
+ }
73
+ /**
74
+ * Document module URL section. Today the only entry is `spacesUrl`;
75
+ * the struct is reserved so future Document-module URLs can land
76
+ * here without a new manifest section.
77
+ */
78
+ export interface DocumentApiManifest {
79
+ readonly spacesUrl?: string;
80
+ /**
81
+ * !! Carried here rather than derived from `spacesUrl`. Concatenating
82
+ * `/available` onto that would couple the client to a URL shape the router
83
+ * owns, and it would keep working until the route moved -- then fail as a
84
+ * 404 the UI reports as "no sites available", which is indistinguishable
85
+ * from the true empty answer.
86
+ *
87
+ * !! ABSENT ARRIVES AS `''`, NOT `undefined`. The producer declares these
88
+ * as non-nullable strings defaulting to empty, so an installation that has
89
+ * not set them sends an empty string and the `?` here never fires.
90
+ *
91
+ * Guard on FALSINESS -- `!url`, `Boolean(url)`. The dangerous rewrite is
92
+ * `url === undefined` (or `!== undefined`), which reads as more precise and
93
+ * treats `''` as present, handing a caller a request to the empty string.
94
+ *
95
+ * !! A `?? fallback` is NOT the hazard, though it looks like the obvious
96
+ * one: `'' ?? x` is `''`, so a fallback never fires on the value this
97
+ * producer actually sends. Measured by mutation -- adding one changed
98
+ * nothing, changing the guard broke three assertions.
99
+ */
100
+ readonly spacesAvailableUrl?: string;
101
+ readonly spaceEnablementUrl?: string;
102
+ /**
103
+ * FQCN of the entity a filter-mode audience can be built from.
104
+ *
105
+ * !! The SERVER owns this and the client must not know it. The generation
106
+ * wizard offers Filter mode only when a template's context schema
107
+ * references this type, and it used to compare against a constant compiled
108
+ * into this bundle -- which shipped the consuming application's class name
109
+ * inside a published package, and tied that package to an installation
110
+ * having that exact class.
111
+ *
112
+ * !! Absent arrives as `''`, like the urls above. Treat empty as **filter
113
+ * mode unavailable**, never as a reason to fall back to a remembered
114
+ * value: the server is the thing that rejects every other type, so a guess
115
+ * here offers a mode the server will refuse.
116
+ */
117
+ readonly filterAudienceEntity?: string;
118
+ }
119
+ export interface DynamicEntityApiManifest {
120
+ readonly typesUrl: string;
121
+ readonly fieldDefinitionsUrl: string;
122
+ readonly fieldDefinitionUrl: string;
123
+ readonly fieldDefinitionsReorderUrl: string;
124
+ readonly toolbarNaviGraphUrl: string;
125
+ readonly constraintsUrl: string;
126
+ readonly recordsUrl: string;
127
+ readonly recordUrl: string;
128
+ readonly recordsByTypeUrl: string;
129
+ readonly typeUrl: string;
130
+ readonly typesCreateUrl: string;
131
+ readonly formTypesUrl?: string;
132
+ readonly typeByAliasUrl?: string;
133
+ }
134
+ export interface DomainExplorerApiManifest {
135
+ readonly entitiesUrl: string;
136
+ readonly entityUrl: string;
137
+ readonly toolbarNaviGraphUrl: string;
138
+ readonly domainExplorerToolbarUrl: string;
139
+ readonly entityFieldsDataGridUrl?: string;
140
+ readonly typeFieldsDataGridUrl?: string;
141
+ }
142
+ export interface IdentityApiManifest {
143
+ readonly usersUrl: string;
144
+ readonly userUrl: string;
145
+ readonly groupsUrl: string;
146
+ readonly groupUrl: string;
147
+ readonly meUrl: string;
148
+ readonly assignGroupsUrl: string;
149
+ readonly avatarUploadUrl: string;
150
+ readonly settingsUrl: string;
151
+ readonly settingsSectionsUrl: string;
152
+ readonly settingsSectionUrl: string;
153
+ readonly colorUrl: string;
154
+ readonly rolesUrl?: string;
155
+ readonly elevationUrl?: string;
156
+ readonly deletionsUrl?: string;
157
+ readonly footprintsUrl?: string;
158
+ readonly userDeletionUrl?: string;
159
+ readonly userLegalHoldsUrl?: string;
160
+ readonly holdsSettingsBlock?: string;
161
+ readonly legalHoldFormId?: string | null;
162
+ readonly sessionsUrl?: string;
163
+ readonly sessionUrl?: string;
164
+ readonly userSessionsUrl?: string;
165
+ }
166
+ /**
167
+ * Editor sub-manifest emitted by the backend's Editor module. The
168
+ * frontend bridge (`@coolms/editor-angular`) consumes this through the
169
+ * `EDITOR_MANIFEST_PROVIDER` token.
170
+ *
171
+ * schemaVersion 2 (sub-prompt D) replaced the editorId axis with a profile
172
+ * axis: `manifest.editor.profiles[name]` returns a slice with the
173
+ * pre-resolved contributor list AND the storage allow-list a sanitizer
174
+ * enforces on save.
175
+ */
176
+ export interface EditorApiManifestEntry {
177
+ readonly id: string;
178
+ readonly group: string;
179
+ readonly priority: number;
180
+ readonly icon: string;
181
+ readonly label: string;
182
+ readonly actionType: string;
183
+ readonly actionParams: Readonly<Record<string, unknown>>;
184
+ readonly extensions: ReadonlyArray<string>;
185
+ readonly stateKeys: ReadonlyArray<string>;
186
+ readonly shortcut?: string | null;
187
+ readonly slashable?: boolean;
188
+ readonly keywords?: ReadonlyArray<string>;
189
+ }
190
+ export interface EditorApiManifestProfile {
191
+ readonly contributors: ReadonlyArray<EditorApiManifestEntry>;
192
+ readonly allowedWidgets: ReadonlyArray<string>;
193
+ }
194
+ export interface EditorApiManifest {
195
+ readonly schemaVersion: number;
196
+ readonly profiles: Readonly<Record<string, EditorApiManifestProfile>>;
197
+ }
198
+ /**
199
+ * Viewer manifest emitted by the backend's Document module.
200
+ * Each viewer declares the MIME types / extensions it handles, the
201
+ * Angular component selector to dispatch into, and one config blob per
202
+ * profile. Profile config is open-ended -- every viewer interprets the
203
+ * keys it understands and ignores the rest.
204
+ */
205
+ export interface ViewerProfileApiManifest {
206
+ readonly key: string;
207
+ readonly config: Readonly<Record<string, unknown>>;
208
+ }
209
+ export interface ViewerDefinitionApiManifest {
210
+ readonly key: string;
211
+ readonly mimeTypes: ReadonlyArray<string>;
212
+ readonly extensions: ReadonlyArray<string>;
213
+ readonly component: string;
214
+ readonly profiles: Readonly<Record<string, ViewerProfileApiManifest>>;
215
+ }
216
+ export interface ViewerApiManifest {
217
+ readonly schemaVersion: number;
218
+ readonly viewers: Readonly<Record<string, ViewerDefinitionApiManifest>>;
219
+ }
220
+ /**
221
+ * Platform-wide default user-facing settings. The
222
+ * fallback floor for anonymous / pre-login rendering: timezone, date /
223
+ * time format (CLDR tokens) and week start come from the deployment's
224
+ * config, not an FE-hardcoded Western default. `locale` is the default
225
+ * locale.
226
+ */
227
+ export interface PlatformDefaults {
228
+ readonly locale: string;
229
+ readonly timezone: string;
230
+ readonly dateFormat: string;
231
+ readonly timeFormat: '12h' | '24h';
232
+ readonly weekStart: 'monday' | 'sunday';
233
+ /**
234
+ * Deployment brand accent as `#rrggbb`, or null/absent to keep the
235
+ * stylesheet's own. Sits BELOW a user's personal accentColor.
236
+ */
237
+ readonly accentColor?: string | null;
238
+ }
239
+ /**
240
+ * The host contracts in force here (the platform rule: hosts implement
241
+ * contracts, modules offer entries): for each contract, what the one
242
+ * installed theme implementing it declares, and the installed modules whose
243
+ * entries the installer matched against it. A host mounts a module only when
244
+ * it is listed.
245
+ */
246
+ export interface UiApiManifest {
247
+ /** The contracts in force, name -> MAJOR.MINOR (`{ console: '1.0' }`): one installed theme implements each. */
248
+ readonly contracts: Readonly<Record<string, string>>;
249
+ /** Which installed theme implements each contract, name -> theme slug. */
250
+ readonly hosts?: Readonly<Record<string, string>>;
251
+ readonly modules: ReadonlyArray<UiModuleEntryManifest>;
252
+ }
253
+ export interface UiModuleEntryManifest {
254
+ readonly module: string;
255
+ readonly contract: string;
256
+ readonly range: string;
257
+ readonly framework: string;
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>>;
266
+ export interface ApiManifest {
267
+ readonly apiBase: string;
268
+ readonly ui?: UiApiManifest;
269
+ readonly configBase?: string;
270
+ readonly auth?: AuthApiManifest;
271
+ readonly identity?: IdentityApiManifest;
272
+ readonly sections?: SectionApiManifest;
273
+ readonly navi?: NaviApiManifest;
274
+ readonly content?: ContentApiManifest;
275
+ readonly dataGrid?: DataGridApiManifest;
276
+ readonly terminal?: TerminalApiManifest;
277
+ readonly media?: MediaApiManifest;
278
+ readonly document?: DocumentApiManifest;
279
+ readonly vfs?: VfsApiManifest;
280
+ readonly dynamicEntity?: DynamicEntityApiManifest;
281
+ readonly domainExplorer?: DomainExplorerApiManifest;
282
+ readonly editor?: EditorApiManifest;
283
+ readonly viewers?: ViewerApiManifest;
284
+ readonly supportedLocales?: Array<{
285
+ code: string;
286
+ label: string;
287
+ }>;
288
+ readonly platformDefaults?: PlatformDefaults;
289
+ readonly modules?: ModulesApiManifest;
290
+ }
291
+ /**
292
+ * GET /api/v1/admin/manifest -- the admin's endpoint map, answered to every signed-in account
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.
295
+ */
296
+ export interface ConsoleManifestResponse {
297
+ readonly manifest: ApiManifest;
298
+ }
299
+ export interface ThemeConfigResponse {
300
+ readonly slug?: string | null;
301
+ readonly feStack?: string | null;
302
+ readonly spaFramework?: string | null;
303
+ readonly assetsUrl?: string | null;
304
+ readonly manifest: ApiManifest;
305
+ }
306
+ /**
307
+ * Replaces {param} tokens in a URL pattern with encoded values.
308
+ *
309
+ * @example
310
+ * resolvePattern(manifest.sections!.item, { id: '123' })
311
+ * // -> '/api/v1/sections/123'
312
+ */
313
+ export declare function resolvePattern(pattern: string, params: Record<string, string>): string;
314
+ /**
315
+ * Shapes the user-preference store persists.
316
+ *
317
+ * {@link UserPreferencesService} owns ONE store (`coolms_ui_prefs`) with
318
+ * several namespaces -- grids, panels, page state, nav, terminal -- so these
319
+ * shapes are core's and the surfaces that read them are consumers. The datagrid
320
+ * is simply the namespace with the richest shape.
321
+ *
322
+ * `shared/datagrid/datagrid-preferences.types` re-exports them, so the kit
323
+ * keeps its own local path and nothing that reads a grid preference had to
324
+ * change.
325
+ */
326
+ export interface DataGridPreference {
327
+ columns?: string[];
328
+ columnWidths?: Record<string, number>;
329
+ /** field -> its share of the grid's width (the visible columns' shares sum to 1), so a resize keeps proportions. */
330
+ columnFractions?: Record<string, number>;
331
+ }
332
+ export type DataGridPreferences = Record<string, DataGridPreference>;
333
+ /**
334
+ * Session and current-user DTOs.
335
+ *
336
+ * They live in core because core runs the session: the NGXS auth state, the
337
+ * refresh coordinator and the cross-tab sync are all here, and all three name
338
+ * these shapes, so core needs no import of the admin's `ApiService` to read them.
339
+ *
340
+ * `ApiService` re-exports them from its own module, so the feature files that
341
+ * import `UserDto` from there are untouched.
342
+ */
343
+ export interface TokenResponse {
344
+ accessToken: string;
345
+ refreshToken: string;
346
+ expiresAt: string;
347
+ user?: UserDto;
348
+ }
349
+ export interface UserDto {
350
+ id: string;
351
+ email: string;
352
+ identifier?: string;
353
+ roles: string[];
354
+ uiPrefs?: DataGridPreferences;
355
+ avatarUrl?: string | null;
356
+ firstName?: string | null;
357
+ lastName?: string | null;
358
+ fullName?: string;
359
+ }
360
+ export type FieldType = 'text' | 'email' | 'password' | 'number' | 'textarea' | 'select' | 'toggle' | 'date' | 'time' | 'hidden' | 'relation' | 'subform' | 'token-pattern' | 'richtext' | 'localizedText' | 'localizedTextarea' | 'optionsEditor' | 'intlPhone' | 'color';
361
+ export type DataSourceType = 'static' | 'enum' | 'api' | 'repo';
362
+ export type VisibilityOperator = 'eq' | 'ne' | 'in' | 'notIn' | 'empty' | 'notEmpty';
363
+ export interface VisibilityCondition {
364
+ readonly field: string;
365
+ readonly operator: VisibilityOperator;
366
+ readonly value?: unknown;
367
+ }
368
+ export type DataSourceWidget = 'select' | 'select-search' | 'select-tree' | 'token-input' | 'media-picker';
369
+ export type DataSourceLoading = 'eager' | 'lazy';
370
+ export interface DataSourceOption {
371
+ readonly value: unknown;
372
+ readonly label: string;
373
+ readonly parentId?: string | null;
374
+ }
375
+ export interface DataSourceDefinition {
376
+ readonly type: DataSourceType;
377
+ readonly bindValue: string;
378
+ readonly bindLabel: string;
379
+ readonly multiple: boolean;
380
+ readonly maxItems?: number;
381
+ readonly options?: ReadonlyArray<DataSourceOption>;
382
+ readonly url?: string;
383
+ readonly widget: DataSourceWidget;
384
+ readonly loading: DataSourceLoading;
385
+ /** Free-form widget-specific configuration block populated from YAML
386
+ * `dataSource.widgetOptions`. Used by media-picker for bindTarget /
387
+ * display / accept / recentlyUsed / hoverPreview, and reserved for
388
+ * future custom widgets. Kept separate from `options` (which is the
389
+ * static-option list) to avoid key collisions. */
390
+ readonly widgetOptions?: Readonly<Record<string, unknown>>;
391
+ }
392
+ export interface ValidatorDefinition {
393
+ readonly type: string;
394
+ readonly value?: unknown;
395
+ readonly message?: string;
396
+ }
397
+ export interface RelationDefinition {
398
+ readonly cardinality: 'one' | 'many';
399
+ readonly maxItems?: number;
400
+ readonly targetFormId?: string;
401
+ readonly dataSource?: DataSourceDefinition;
402
+ }
403
+ export interface SubFormDefinition {
404
+ readonly formId: string;
405
+ readonly relation: 'one' | 'many';
406
+ readonly maxItems?: number;
407
+ }
408
+ export interface FieldSecurityPolicy {
409
+ readonly read: ReadonlyArray<string>;
410
+ readonly write: ReadonlyArray<string>;
411
+ }
412
+ export interface FieldItem {
413
+ readonly alias: string;
414
+ readonly type: FieldType;
415
+ readonly label: string;
416
+ readonly placeholder?: string;
417
+ readonly hint?: string;
418
+ readonly required: boolean;
419
+ readonly readonly: boolean;
420
+ readonly locked: boolean;
421
+ readonly private: boolean;
422
+ readonly validators: ReadonlyArray<ValidatorDefinition>;
423
+ readonly dataSource?: DataSourceDefinition;
424
+ readonly relation?: RelationDefinition;
425
+ readonly subForm?: SubFormDefinition;
426
+ readonly separators?: ReadonlyArray<string>;
427
+ readonly security?: FieldSecurityPolicy | null;
428
+ readonly autocomplete?: string;
429
+ }
430
+ export interface LayoutNode {
431
+ readonly type: 'group' | 'grid' | 'column' | 'tabs' | 'tab' | (string & {});
432
+ readonly name?: string;
433
+ readonly description?: string;
434
+ readonly compact?: boolean;
435
+ readonly width?: number;
436
+ readonly children?: ReadonlyArray<LayoutNode>;
437
+ readonly showWhen?: VisibilityCondition;
438
+ }
439
+ export type FormActionType = 'submit' | 'button' | 'reset';
440
+ export type FormActionVariant = 'primary' | 'secondary' | 'danger' | 'link';
441
+ /** Terminal form button (Submit / Cancel / ...) -- mirrors PHP FormAction.
442
+ * Resolved by the backend (declared `formOptions.actions`, else lifted from
443
+ * legacy submit fields, else a default Submit). `label` is already translated. */
444
+ export interface FormAction {
445
+ readonly type: FormActionType;
446
+ readonly label: string;
447
+ readonly name: string;
448
+ readonly variant: FormActionVariant;
449
+ }
450
+ export interface FormRenderDefinition {
451
+ readonly id: string;
452
+ readonly context: 'create' | 'edit';
453
+ readonly layout: ReadonlyArray<LayoutNode>;
454
+ readonly items: ReadonlyArray<FieldItem>;
455
+ readonly actions: ReadonlyArray<FormAction>;
456
+ readonly action?: string;
457
+ }
458
+ /**
459
+ * The collection envelope API Platform wraps every list response in.
460
+ *
461
+ * It belongs to the client runtime rather than to any one screen: it is the
462
+ * shape of EVERY paginated response the CoolMS API emits, so a feature that
463
+ * lists anything needs it, and a UI kit that lists anything must not have to
464
+ * reach into the application to describe it.
465
+ *
466
+ * **The keys arrive WITHOUT the `hydra:` prefix.** The vocabulary is mapped in
467
+ * `@context`, so the wire carries `member` and `totalItems` rather than
468
+ * `hydra:member` and `hydra:totalItems`.
469
+ *
470
+ * Three document services in the admin declare their own version of this
471
+ * interface accepting BOTH spellings, every field optional. That is a
472
+ * different claim about the same wire, not a duplicate of this one, and
473
+ * whichever is wrong is wrong silently -- an optional `member` makes every
474
+ * call site handle an absence that may never happen, and a required one
475
+ * crashes if it does. Settle it by calling the endpoint, not by merging the
476
+ * types.
477
+ */
478
+ export interface HydraView {
479
+ '@id': string;
480
+ 'next'?: string;
481
+ 'previous'?: string;
482
+ 'last'?: string;
483
+ }
484
+ export interface HydraCollection<T> {
485
+ 'member': T[];
486
+ 'totalItems': number;
487
+ 'view'?: HydraView;
488
+ }
489
+ /** The audiences the server knows: any other is refused at sign-in, so it is refused here, when the code compiles. */
490
+ export type AuthAudience = 'admin' | 'workspace';
491
+ /**
492
+ * The application a sign-in is for -- `admin`, `workspace` -- named by the application that provides it. A sign-in
493
+ * sends it, and the tokens it gets back carry it; a refresh keeps it. The server can then let a token into the
494
+ * surfaces of its own application only.
495
+ *
496
+ * None by default: an application that provides none signs in as before, naming no audience.
497
+ */
498
+ export declare const AUTH_AUDIENCE: InjectionToken<AuthAudience | null>;
499
+ /** One declared setting as the server reads it for the person: the value in force, and what they set themselves. */
500
+ export interface DeclaredSettingKey {
501
+ readonly key: string;
502
+ /** The value in force: the person's own, else the installation's. */
503
+ readonly value: unknown;
504
+ /** What the person set themselves; null when they set nothing and the installation's value applies. */
505
+ readonly own: unknown;
506
+ readonly locked: boolean;
507
+ }
508
+ /** One section of the person's declared settings. */
509
+ export interface DeclaredSettingsSection {
510
+ readonly section: string;
511
+ readonly keys: ReadonlyArray<DeclaredSettingKey>;
512
+ }
513
+ /**
514
+ * The identity endpoints core owns: the session lifecycle, plus the settings
515
+ * read at boot.
516
+ *
517
+ * Carved out of the admin's `ApiService` -- 2410 lines, 118 methods and 89 DTOs
518
+ * spanning calendars, documents, calls, VFS and the rest. Core cannot depend on
519
+ * that and still ship beneath the UI kit: it would drag every module's wire
520
+ * types down with it. Core called exactly FOUR of those methods.
521
+ *
522
+ * `logout` is the one addition, and not for symmetry: the auth lifecycle lives
523
+ * here (state, refresh coordinator, cross-tab sync), so a core package that
524
+ * could sign in but not out would be incomplete.
525
+ *
526
+ * `ApiService` keeps its own identical signatures and delegates here, so none
527
+ * of the 94 feature files calling it changed.
528
+ */
529
+ export declare class IdentityApiClient {
530
+ private readonly http;
531
+ private readonly store;
532
+ private readonly audience;
533
+ /** The settings read while it is in flight, shared by every caller that asks meanwhile. */
534
+ private settingsRead$?;
535
+ /** URLs come from the boot manifest, which core already owns. */
536
+ private get manifest();
537
+ /** Signs in; names the application's audience ({@link AUTH_AUDIENCE}) when it provides one. */
538
+ login(identifier: string, password: string): Observable<TokenResponse>;
539
+ refresh(refreshToken: string): Observable<TokenResponse>;
540
+ logout(): Observable<void>;
541
+ me(): Observable<UserDto>;
542
+ /**
543
+ * The person's settings. Several services read them at start-up, each for its own section; callers that ask while
544
+ * a read is in flight share it, so the page makes one request. A call after it has answered reads again: nothing
545
+ * is kept past the answer, so a save is never hidden behind an old read.
546
+ */
547
+ getSettings(): Observable<Record<string, Record<string, unknown>>>;
548
+ /**
549
+ * The person's settings as declared: each section's keys with the value in force and the person's own (null when
550
+ * they set none). `host` picks the sections a host reads (`console` for the admin); none gives every section.
551
+ */
552
+ getDeclaredSettings(host?: string): Observable<ReadonlyArray<DeclaredSettingsSection>>;
553
+ static ɵfac: i0.ɵɵFactoryDeclaration<IdentityApiClient, never>;
554
+ static ɵprov: i0.ɵɵInjectableDeclaration<any>;
555
+ }
556
+ /**
557
+ * Response of `POST /centrifugo/connection-token`: the JWT the realtime SDK
558
+ * opens its socket with, and what it needs to refresh before expiry.
559
+ */
560
+ export interface CentrifugoConnectionTokenDto {
561
+ token: string;
562
+ expiresAt: number;
563
+ ttl: number;
564
+ wsUrl: string;
565
+ /**
566
+ * The code the server closes this connection with when the caller's session
567
+ * ended (a sign-out everywhere, a password change, a deactivation). On it the
568
+ * client signs out and ends its calls at once, without reconnecting or waiting
569
+ * for a 401. Absent from an older server.
570
+ */
571
+ sessionEndedCode?: number;
572
+ }
573
+ /**
574
+ * Response of `POST /centrifugo/subscription-token`: a per-channel JWT. The
575
+ * SDK asks for one before subscribing to a private namespace, so this is
576
+ * fetched per subscription rather than once per connection.
577
+ */
578
+ export interface CentrifugoSubscriptionTokenDto {
579
+ channel: string;
580
+ token: string;
581
+ expiresAt: number;
582
+ ttl: number;
583
+ }
584
+ /**
585
+ * The two realtime endpoints, carved out for the same reason the identity ones
586
+ * were: the UI kit's realtime client needed exactly these two of `ApiService`'s
587
+ * 117 methods, and depending on the whole thing would have pulled the entire
588
+ * application's wire vocabulary underneath the kit.
589
+ *
590
+ * They belong in core rather than in the kit because both answers are derived
591
+ * from things core already owns -- the boot manifest for the URL, and the auth
592
+ * interceptor for the bearer token that authorises the request. A token is
593
+ * session state, not a widget.
594
+ *
595
+ * `ApiService` keeps its identical signatures and delegates here, so nothing
596
+ * calling it had to change.
597
+ *
598
+ * !! Access first, then realtime: a refused account opens no socket. The socket cannot
599
+ * 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
600
+ * set, before the guard's answer is in. So the token waits for the console's answer (the
601
+ * guard's own request, not a second one) and a refused sign-in gets none: no request, no
602
+ * socket. A failure to ask is not a refusal, as at the guard.
603
+ *
604
+ * The connection token is every signed-in account's (it only opens a socket; each channel is
605
+ * authorized when it is subscribed to), and a current server answers the admin manifest to
606
+ * every signed-in account, so no sign-in is refused and every one gets its token; each
607
+ * subscription is then decided by its channel. The wait stays for an older server, where a
608
+ * refused sign-in still opens no socket.
609
+ */
610
+ export declare class RealtimeTokenClient {
611
+ /** The error a refused sign-in's connection-token request ends with. */
612
+ static readonly REFUSED = "no console access: no realtime connection";
613
+ private readonly http;
614
+ private readonly store;
615
+ private readonly injector;
616
+ private get manifest();
617
+ connectionToken(): Observable<CentrifugoConnectionTokenDto>;
618
+ subscriptionToken(channel: string): Observable<CentrifugoSubscriptionTokenDto>;
619
+ static ɵfac: i0.ɵɵFactoryDeclaration<RealtimeTokenClient, never>;
620
+ static ɵprov: i0.ɵɵInjectableDeclaration<any>;
621
+ }
622
+ export declare class Login {
623
+ identifier: string;
624
+ password: string;
625
+ static readonly type = "[Auth] Login";
626
+ constructor(identifier: string, password: string);
627
+ }
628
+ export declare class Logout {
629
+ static readonly type = "[Auth] Logout";
630
+ }
631
+ export declare class RestoreSession {
632
+ static readonly type = "[Auth] Restore Session";
633
+ }
634
+ export declare class SetTokens {
635
+ readonly response: TokenResponse;
636
+ static readonly type = "[Auth] Set Tokens";
637
+ constructor(response: TokenResponse);
638
+ }
639
+ /** Merge a partial update into the currently-stored user (e.g. after avatar change). */
640
+ export declare class PatchCurrentUser {
641
+ readonly patch: Partial<UserDto>;
642
+ static readonly type = "[Auth] Patch Current User";
643
+ constructor(patch: Partial<UserDto>);
644
+ }
645
+ export interface AuthStateModel {
646
+ accessToken: string | null;
647
+ refreshToken: string | null;
648
+ expiresAt: string | null;
649
+ user: UserDto | null;
650
+ }
651
+ export declare class AuthState {
652
+ private readonly api;
653
+ private readonly prefs;
654
+ login(ctx: StateContext<AuthStateModel>, { identifier, password }: Login): import("rxjs").Observable<UserDto | null>;
655
+ logout(ctx: StateContext<AuthStateModel>): void;
656
+ restore(ctx: StateContext<AuthStateModel>): void;
657
+ setTokens(ctx: StateContext<AuthStateModel>, { response }: SetTokens): void;
658
+ patchCurrentUser(ctx: StateContext<AuthStateModel>, { patch }: PatchCurrentUser): void;
659
+ static isAuthenticated(state: AuthStateModel): boolean;
660
+ static accessToken(state: AuthStateModel): string | null;
661
+ static refreshToken(state: AuthStateModel): string | null;
662
+ /**
663
+ * The access token's expiry timestamp, so
664
+ * preemptive-refresh callers (e.g., Centrifuge getToken
665
+ * callbacks) can decide whether to rotate before issuing the
666
+ * next protected request, instead of relying on the
667
+ * interceptor's reactive 401-retry path.
668
+ */
669
+ static expiresAt(state: AuthStateModel): string | null;
670
+ static currentUser(state: AuthStateModel): UserDto | null;
671
+ static ɵfac: i0.ɵɵFactoryDeclaration<AuthState, never>;
672
+ static ɵprov: i0.ɵɵInjectableDeclaration<any>;
673
+ }
674
+ /**
675
+ * Protects routes that require authentication.
676
+ *
677
+ * The guard is intentionally ASYNC: it waits for AppInitService.ready$ before
678
+ * evaluating auth state. Without this, Angular's router can evaluate
679
+ * isAuthenticated while APP_INITIALIZER is still in-flight -- RestoreSession
680
+ * will have placed a non-null (but expired) token in state, causing the guard
681
+ * to pass even though the subsequent config/refresh requests will fail and
682
+ * dispatch Logout. Waiting for ready$ guarantees the auth state is settled.
683
+ *
684
+ * Signed in is not enough: the console is granted, and the server says to whom
685
+ * (ConsoleAccessService). An account it refuses -- a customer who registered on the
686
+ * public site -- is signed out of this sign-in, on the server as well as here, and
687
+ * sent to the login page, which says why. A failure to ask is not a refusal: the console opens, and every request it
688
+ * makes is still decided by the server.
689
+ */
690
+ export declare const authGuard: CanActivateFn;
691
+ /** The account may not enter this interface (not a member of its group). Not a fault: an answer. */
692
+ export declare const AUDIENCE_NOT_GRANTED = "/errors/identity/audience-not-granted";
693
+ /**
694
+ * The token was issued for the other interface (a workspace sign-in sent to the admin, or the reverse). Not a
695
+ * refusal of the account: it never ends the session here.
696
+ */
697
+ export declare const WRONG_INTERFACE = "/errors/identity/wrong-interface";
698
+ /** The sign-in names no interface (a token from before audiences): signing in again mends it. */
699
+ export declare const AUDIENCE_REQUIRED = "/errors/identity/audience-required";
700
+ export type AudienceRefusal = 'not-granted' | 'required';
701
+ /**
702
+ * Which refusal of entry by audience an error is, or null for any other error. Read from the problem's `type` alone
703
+ * (403, `application/problem+json`): its `detail` is for logs, and says another interface's name as readily as this
704
+ * one's. The server answers neither while entry by audience is not checked.
705
+ */
706
+ export declare function audienceRefusalOf(error: unknown): AudienceRefusal | null;
707
+ /**
708
+ * Whether a refused session probe may mean the session is over, so the session is refreshed and, refused again,
709
+ * ended. A 403 is a refusal of this request, not of the session -- unless it is a refusal of entry by audience. So a
710
+ * token for the other interface (`wrong-interface`) or any other 403 keeps the person signed in; anything else (a
711
+ * 401, a failure to ask) goes on as before.
712
+ */
713
+ export declare function sessionEndsOn(error: unknown): boolean;
714
+ /**
715
+ * Guards the `/login` route -- redirects already-authenticated
716
+ * callers to admin home so a stale tab parked on `/login` cannot
717
+ * remain mounted while another tab is logged in. When Tab A logs
718
+ * in fresh, Tab B's `RestoreSession` (driven by APP_INITIALIZER)
719
+ * reads the new token from shared `localStorage` and populates
720
+ * `AuthState`; this guard then sees `isAuthenticated === true`
721
+ * and routes Tab B to `/`.
722
+ *
723
+ * Same `ready$` wait as `authGuard` -- ensures `RestoreSession`
724
+ * has run before the snapshot is read; otherwise a fresh F5 on
725
+ * `/login` with a valid stored session would briefly evaluate
726
+ * as anonymous, allow `/login`, and only then have the token
727
+ * populated.
728
+ */
729
+ export declare const loginPageGuard: CanActivateFn;
730
+ export declare const BYPASS_AUTH: HttpContextToken<boolean>;
731
+ export declare const authInterceptor: HttpInterceptorFn;
732
+ /**
733
+ * Two-layer refresh coordinator: an intra-tab `shareReplay(1)`
734
+ * mutex dedupes concurrent callers within one tab, and a
735
+ * cross-tab `navigator.locks` wrapper ensures only one tab in
736
+ * the browser issues the actual `POST /auth/refresh` at a time.
737
+ *
738
+ * Without the cross-tab layer, two tabs racing the same expired
739
+ * refresh-token both POST `/auth/refresh`; the backend's
740
+ * `isUsed` replay branch revokes every token for the user on
741
+ * the second arrival and the operator is kicked to /login.
742
+ *
743
+ * The Web Lock body re-reads the current access-token expiry from
744
+ * `AuthState` before issuing the HTTP call. When this tab waited
745
+ * behind another tab's refresh, that tab's `SetTokens` dispatch
746
+ * has already published fresh values into shared `localStorage`,
747
+ * `CrossTabAuthSyncService` has mirrored them into this tab's
748
+ * NGXS state, and the lock body simply returns the cached access
749
+ * token without another network round-trip.
750
+ *
751
+ * `Logout` fires only when the refresh endpoint returns 401
752
+ * (real auth failure). Transient errors (network blips, 5xx,
753
+ * CORS, timeouts) propagate without clearing the session so a
754
+ * momentary refresh failure does not kill a valid login.
755
+ *
756
+ * A token the server REFUSED. A caller answering a 401 passes the
757
+ * access token that was refused. Without it the lock body would hand
758
+ * back the cached token whenever its expiry looked fresh --
759
+ * which a revoked token's does: a session ended on the server (a
760
+ * sign-out everywhere from another device, a password change) was
761
+ * retried with the same dead token and never refreshed, so the client
762
+ * stayed signed in, and in its calls, until the token neared expiry
763
+ * (measured: a 1:1 call kept for the whole 30 s window, every request
764
+ * answered 401). Now the lock body re-reads the SHARED copy
765
+ * (`localStorage`, which every tab's `SetTokens` writes synchronously;
766
+ * this tab's state only follows a sibling's write when its `storage`
767
+ * event arrives):
768
+ * - a different access token there -> another tab (or an earlier
769
+ * refresh here) already rotated past the refused one: use it, no
770
+ * request;
771
+ * - the same one -> the server refused this token: refresh, with the
772
+ * newest refresh token -- the shared one, so a rotation a sibling
773
+ * made is never replayed with the token it consumed. A 401 there
774
+ * is the session's end: `Logout`.
775
+ */
776
+ export declare class AuthRefreshCoordinator {
777
+ private readonly api;
778
+ private readonly store;
779
+ private readonly router;
780
+ private inFlight;
781
+ /**
782
+ * Return the in-flight refresh Observable, or spawn a new one
783
+ * with the supplied refresh-token value.
784
+ *
785
+ * `refusedAccessToken`: the access token the server just answered
786
+ * 401 to, when the caller is answering one. With it, the lock body
787
+ * refreshes unless the shared copy already holds another token;
788
+ * without it (a preemptive refresh), a fresh-looking cached token
789
+ * is handed back as before.
790
+ *
791
+ * Callers subscribe via `switchMap` / `firstValueFrom` to retry
792
+ * their original request with the resolved access token.
793
+ */
794
+ refresh(refreshToken: string, refusedAccessToken?: string | null): Observable<string>;
795
+ /**
796
+ * Run the refresh body inside `navigator.locks` when the API is
797
+ * available; degrade to direct invocation otherwise. The lock
798
+ * body checks for state already updated by a sibling tab before
799
+ * issuing its own HTTP call.
800
+ */
801
+ private refreshWithCrossTabLock;
802
+ /**
803
+ * Lock body. Re-reads the shared copy first (see the class note).
804
+ *
805
+ * Answering a refusal: a shared access token other than the refused
806
+ * one is a rotation already made -- taken, and mirrored into this
807
+ * tab's state if its `storage` event has not arrived yet. Otherwise,
808
+ * or for a preemptive caller whose cached token no longer looks
809
+ * fresh, the HTTP refresh, with the newest refresh token: shared,
810
+ * then state, then the caller's.
811
+ */
812
+ private executeRefresh;
813
+ /**
814
+ * The session as the tabs share it, or null when there is none to
815
+ * read: no storage, nothing stored (signed out), or a value that is
816
+ * not a complete token set.
817
+ */
818
+ private readShared;
819
+ /**
820
+ * For a preemptive caller only: return the current access token when
821
+ * its expiry is more than `FRESH_TOKEN_GRACE_MS` milliseconds away --
822
+ * signalling that some other tab refreshed for us. The shared copy
823
+ * first, which a sibling's rotation reaches before this tab's state
824
+ * does (mirrored here when it is newer); this tab's state when there
825
+ * is none. Null otherwise. Never asked for a token the server
826
+ * refused: a refused token's expiry looks just as fresh.
827
+ */
828
+ private tryConsumeFreshState;
829
+ static ɵfac: i0.ɵɵFactoryDeclaration<AuthRefreshCoordinator, never>;
830
+ static ɵprov: i0.ɵɵInjectableDeclaration<any>;
831
+ }
832
+ /**
833
+ * Bridges shared `localStorage` mutations into the NGXS auth
834
+ * state so a refresh executed in one tab silently propagates to
835
+ * every other open tab.
836
+ *
837
+ * The browser fires `storage` events in tabs OTHER than the one
838
+ * that mutated `localStorage`. So when Tab A's
839
+ * `AuthRefreshCoordinator` rotates the token pair and `SetTokens`
840
+ * persists the new values, every sibling tab receives an event
841
+ * here and dispatches `SetTokens` against its own NGXS state --
842
+ * no extra HTTP roundtrip, no extra refresh contention.
843
+ *
844
+ * Pairs with the `navigator.locks` cross-tab mutex in
845
+ * `AuthRefreshCoordinator`: locks ensure only one tab issues the
846
+ * refresh, this listener propagates the result to the rest.
847
+ *
848
+ * `Logout` from any tab clears `coolms_token` (newValue === null)
849
+ * and this listener mirrors that into the sibling tabs so the
850
+ * shell redirects to `/login` without waiting for the next
851
+ * protected request to 401.
852
+ *
853
+ * Started from `AppInitService.load()` so the listener is in
854
+ * place before any protected HTTP fires.
855
+ */
856
+ export declare class CrossTabAuthSyncService {
857
+ private readonly store;
858
+ private listenerAttached;
859
+ start(): void;
860
+ private readonly handleStorageEvent;
861
+ static ɵfac: i0.ɵɵFactoryDeclaration<CrossTabAuthSyncService, never>;
862
+ static ɵprov: i0.ɵɵInjectableDeclaration<any>;
863
+ }
864
+ /**
865
+ * The elevation state of the signed-in session: the wire shape of
866
+ * `GET /auth/elevation`, returned again by `POST` on a grant.
867
+ *
868
+ * Elevation is state, not a role. It lasts a fixed time from the grant, ends
869
+ * when the admin panel is closed or reloaded, and the client derives nothing
870
+ * about it from mode bits or membership: this record and the node resource's
871
+ * capability flags are the two readings of ONE server-side decision, and the
872
+ * client keeps no third.
873
+ */
874
+ export interface ElevationState {
875
+ /** Whether this session is elevated right now. */
876
+ elevated: boolean;
877
+ /** When the current elevation ends (ISO 8601); absent or null when not elevated. */
878
+ expiresAt?: string | null;
879
+ /** When the current elevation was granted (ISO 8601); absent or null when not elevated. */
880
+ grantedAt?: string | null;
881
+ /** How the LAST elevation of this session ended. Rendered by the prompt before it asks. */
882
+ ended: ElevationEnded;
883
+ /** The lifetime a grant made now would get, in seconds (the setting, clamped to the ceiling). */
884
+ lifetimeSeconds: number;
885
+ /** The most any elevation can last, fixed in code. */
886
+ lifetimeCeilingSeconds: number;
887
+ /** Whether the CURRENT elevation was confirmed by a second factor; absent or null when not elevated. */
888
+ factorConfirmed?: boolean | null;
889
+ /** Whether a grant made now must carry a code from the person's own authenticator. */
890
+ mfaRequired: boolean;
891
+ /** What the prompt shows before asking; two of the codes mean this account cannot elevate yet. */
892
+ warnings: ElevationWarning[];
893
+ /**
894
+ * Whether this account may elevate at all -- a member of the admin group, elevated or not. The one source a
895
+ * client offers "Elevate session" from; absent (an older server) reads as false.
896
+ */
897
+ mayElevate?: boolean;
898
+ }
899
+ /**
900
+ * `closed` is the beacon (the panel was closed or reloaded), `dropped_by_user`
901
+ * the explicit drop, `refresh_from_other_pair` the server's refresh tripwire,
902
+ * `factor_reset` the person's second factor reset on the server, which ends
903
+ * every live elevation they hold, `never` a session that has not elevated yet.
904
+ */
905
+ export type ElevationEndedReason = 'expired' | 'closed' | 'dropped_by_user' | 'refresh_from_other_pair' | 'factor_reset' | 'never';
906
+ export interface ElevationEnded {
907
+ reason: ElevationEndedReason;
908
+ /** ISO 8601, null for `never`. */
909
+ at: string | null;
910
+ }
911
+ /**
912
+ * `elevation.password_not_set` and `elevation.factor_missing` mean this
913
+ * account cannot elevate (it has no password, or no confirmed factor, of its
914
+ * own) and the message says which;
915
+ * `elevation.mfa_off` is the recommendation carried while the switch is off.
916
+ */
917
+ export interface ElevationWarning {
918
+ /** The three the server documents today; the client renders any it does not know as text. */
919
+ code: string;
920
+ message: string;
921
+ }
922
+ export declare const ELEVATION_WARNING_PASSWORD_NOT_SET = "elevation.password_not_set";
923
+ export declare const ELEVATION_WARNING_FACTOR_MISSING = "elevation.factor_missing";
924
+ export declare const ELEVATION_WARNING_MFA_OFF = "elevation.mfa_off";
925
+ /** Why the elevation of a session changed, for whoever refetches on it. */
926
+ export type ElevationChangeKind = 'granted' | 'dropped' | 'expired' | 'observed';
927
+ export interface ElevationChange {
928
+ kind: ElevationChangeKind;
929
+ state: ElevationState;
930
+ }
931
+ /** The two reasons the client sends when it drops an elevation itself. */
932
+ export type ElevationDropReason = 'dropped_by_user' | 'closed';
933
+ /**
934
+ * What the elevation prompt is told when it opens.
935
+ *
936
+ * `state` is the server's answer at the moment of asking -- `ended.reason` is
937
+ * rendered first (a person asked for a password again after F5
938
+ * with no explanation reads it as a fault), `warnings` may say this
939
+ * account cannot elevate yet, `mfaRequired` decides whether a code field
940
+ * shows from the start.
941
+ *
942
+ * `refusal` is the server's own sentence for the action that was refused
943
+ * ("Permission denied: cannot write '/docs/...'"), when a 403 opened the
944
+ * prompt; absent when a disabled control offered elevation instead.
945
+ */
946
+ export interface ElevationPromptRequest {
947
+ state: ElevationState;
948
+ refusal?: string;
949
+ /** The refused action in words ("Saving navi nodes"), when a refused request opened the prompt. */
950
+ action?: string;
951
+ }
952
+ /**
953
+ * The prompt itself is a dialog, and dialogs are the kit's -- a layer above
954
+ * this one. Core owns the state, the interceptor and the decision to ask; the
955
+ * application binds this port to whatever renders the question. Same shape as
956
+ * `CURRENT_SECTION`: core declares the little it needs, the composition root
957
+ * provides it.
958
+ *
959
+ * Resolves to true when the session is elevated by the time the dialog closes,
960
+ * false when the person declined or could not. The port does not retry the
961
+ * refused action; the interceptor does, on true.
962
+ */
963
+ export interface ElevationPromptPort {
964
+ open(request: ElevationPromptRequest): Observable<boolean>;
965
+ }
966
+ /**
967
+ * Optional by design: with nothing bound, a 403 stays a 403 and the state
968
+ * service still answers -- an application without an admin panel has no
969
+ * prompt to show and loses nothing.
970
+ */
971
+ export declare const ELEVATION_PROMPT: InjectionToken<ElevationPromptPort>;
972
+ /**
973
+ * Told when an action a person took was refused for want of elevation: a
974
+ * write (not a read, not a background request) answered by a stamped 403.
975
+ *
976
+ * It must not open the prompt. The prompt opens only when the person asks for
977
+ * it -- the application shows the refusal and offers elevation as something to
978
+ * click (a notice with an Elevate button), and the click is what calls
979
+ * {@link ElevationService.offerFor}. A refused action is not repeated by
980
+ * itself after a grant: the person repeats it.
981
+ *
982
+ * `refusal` is the server's sentence for the refused action, already made
983
+ * readable by the error service.
984
+ */
985
+ export interface ElevationNoticePort {
986
+ /** `action` names what the person did ("Saving navi nodes"); absent from older callers. */
987
+ refused(refusal: string, action?: string): void;
988
+ }
989
+ /**
990
+ * What a write IS, in the person's words, for the elevation prompt and notice when the server refuses it -- set by a
991
+ * caller that knows better than the URL ("Saving the menu entry"). Without it the interceptor names the method's verb
992
+ * and the resource the URL names.
993
+ */
994
+ export declare const ELEVATION_ACTION: HttpContextToken<string | null>;
995
+ /** Optional, like {@link ELEVATION_PROMPT}: with nothing bound, a refusal is only a 403. */
996
+ export declare const ELEVATION_NOTICE: InjectionToken<ElevationNoticePort>;
997
+ /**
998
+ * Set on a request that must never open the elevation prompt: the elevation
999
+ * endpoint's own calls (a wrong password is a 403 and is not a refused action),
1000
+ * and any caller that would rather receive its 403 and decide for itself.
1001
+ */
1002
+ export declare const BYPASS_ELEVATION: HttpContextToken<boolean>;
1003
+ /**
1004
+ * The elevation state of this session, read from ONE place: the server.
1005
+ *
1006
+ * The elevation client requirement, in one service. The state endpoint is the only
1007
+ * source -- `elevated`, `expiresAt`, how the last elevation ended -- and every
1008
+ * change of it is announced on `changes$` so the Explorer listing can refetch
1009
+ * (its capability flags are the server's reading of the same state, computed
1010
+ * when the listing was fetched, and a `write: true` fetched while elevated
1011
+ * must not outlive the elevation).
1012
+ *
1013
+ * **Expiry is driven by the READ, not by a timer.** An elevation ends because
1014
+ * time passed, and time is not an event; a client that waits to be told has
1015
+ * nothing to wait for when the machine was asleep at the moment. So `state()`
1016
+ * does the arithmetic every time it is asked, and an answer whose `expiresAt`
1017
+ * has gone by reports expired without a request. The timer below still fires
1018
+ * at `expiresAt` and the tab still re-asks when it comes back into view -- both
1019
+ * are how the SERVER's answer is refreshed, which is a different thing from
1020
+ * knowing this one has run out.
1021
+ *
1022
+ * This is not a second decider. The server said "elevated until T"; after T,
1023
+ * continuing to report `elevated: true` asserts something it never said.
1024
+ *
1025
+ * The prompt is not here: dialogs are the kit's, a layer above core. The
1026
+ * service asks the `ELEVATION_PROMPT` port and shares ONE in-flight prompt, so
1027
+ * a burst of refused requests (a multi-select delete is one 403 per node)
1028
+ * opens one dialog and every caller waits on the same answer.
1029
+ */
1030
+ /**
1031
+ * The header a 403 refused for want of elevation carries, with the gate's name
1032
+ * as its value. The server stamps it where the gate refused; the interceptor
1033
+ * prompts on it and on nothing else. There is no list of gated URLs on this
1034
+ * side any more: the one that stood here lagged the server by every route
1035
+ * whose refusal came from the VFS permission service under another module's
1036
+ * path (media, document and word templates, content distribution).
1037
+ */
1038
+ export declare const ELEVATION_REQUIRED_HEADER = "X-Elevation-Required";
1039
+ /**
1040
+ * Set on a request no person asked for: a realtime token, a preferences sync, a
1041
+ * poll. Its refusal is never announced -- not by a dialog and not by a notice --
1042
+ * because nobody is waiting on it and nobody can act on it. The caller still
1043
+ * receives the 403 and decides what its own state shows.
1044
+ */
1045
+ export declare const BACKGROUND_REQUEST: HttpContextToken<boolean>;
1046
+ /**
1047
+ * The problem type of a 403 refused for want of elevation. The server writes it
1048
+ * where it writes {@link ELEVATION_REQUIRED_HEADER}, naming the check that refused in the
1049
+ * `elevationGate` member; a 403 for any other reason has another type.
1050
+ */
1051
+ export declare const ELEVATION_REQUIRED_PROBLEM_TYPE = "/errors/elevation-required";
1052
+ /** The elevation refusal that asks for the authenticator's code: the password was right. */
1053
+ export declare const ELEVATION_CODE_REQUIRED_TYPE = "/errors/elevation/code-required";
1054
+ /** The elevation refusals that let the person try once more: a wrong password, a wrong or already used code. */
1055
+ export declare const ELEVATION_RETRY_TYPES: readonly string[];
1056
+ /**
1057
+ * Whether a failed request was refused for want of elevation: a 403 carrying
1058
+ * the server's stamp -- its problem type, or the header. The one test every
1059
+ * reader of a refusal uses -- the interceptor, a page's inline state, the error
1060
+ * text -- so they cannot disagree.
1061
+ */
1062
+ export declare function isElevationRefusal(err: unknown): boolean;
1063
+ export declare class ElevationService {
1064
+ private readonly http;
1065
+ private readonly store;
1066
+ private readonly prompt;
1067
+ private readonly destroyRef;
1068
+ /** The last answer the server gave, exactly as it gave it. */
1069
+ private readonly served;
1070
+ /**
1071
+ * The state as it stands NOW; null until the first read from the server.
1072
+ *
1073
+ * Deliberately NOT a `computed`. A cached derivation is only recomputed
1074
+ * when one of its dependencies changes, and nothing changes when an
1075
+ * elevation simply runs out -- so it would keep answering `elevated: true`
1076
+ * past the moment the server itself named, for as long as the machine
1077
+ * happened to be asleep.
1078
+ *
1079
+ * Reading past `expiresAt` also demotes the STORED answer. The value
1080
+ * returned here is already correct without that write; the write is only
1081
+ * how cached readers (a `computed`, an OnPush template) find out.
1082
+ */
1083
+ readonly state: () => ElevationState | null;
1084
+ /** Convenience over `state`: false until the server has said otherwise. */
1085
+ readonly elevated: () => boolean;
1086
+ /** Whether this account may elevate at all, as the server answered it: what "Elevate session" is offered from. */
1087
+ readonly mayElevate: () => boolean;
1088
+ /** `expiresAt` as a Date, null when not elevated. */
1089
+ readonly expiresAt: () => Date | null;
1090
+ /**
1091
+ * Every change of elevation state: a grant, a drop (by this person, by the
1092
+ * beacon, by the tripwire), an expiry, or an observed change of a live
1093
+ * grant's `expiresAt`. A refresh that reports the same state emits nothing,
1094
+ * so subscribers that refetch a listing on it never refetch for no reason.
1095
+ */
1096
+ readonly changes$: Subject<ElevationChange>;
1097
+ private readonly retriesWaiting;
1098
+ /**
1099
+ * How many refused writes wait to be sent again: each is counted from the moment its refusal is taken up, before
1100
+ * any prompt opens, until its repeat has answered or the person declined. A view that reloads after a grant waits
1101
+ * for 0, so the reload never cancels a repeat in flight.
1102
+ */
1103
+ readonly retriesPending: import("@angular/core").Signal<number>;
1104
+ /** Each time the last refused write waiting for its repeat stops waiting: `retriesPending` has come back to 0. */
1105
+ readonly retriesSettled$: Subject<void>;
1106
+ /** Counts one refused write as waiting for its repeat; the function returned ends that count, once. */
1107
+ holdForRetry(): () => void;
1108
+ private expiryTimer;
1109
+ private pendingPrompt;
1110
+ private expiryAnnouncePending;
1111
+ private lastReconcileAt;
1112
+ constructor();
1113
+ /** Whether a prompt can be opened at all: this install offers elevation and a prompt is bound. */
1114
+ get canPrompt(): boolean;
1115
+ /** The manifest's API base, as {@link isThisApi} reads it. */
1116
+ get apiBase(): string;
1117
+ /** The manifest carries the URL; without it the service is inert, not broken. */
1118
+ get available(): boolean;
1119
+ private get url();
1120
+ /**
1121
+ * Whether a URL belongs to THIS API: a relative one under the manifest's
1122
+ * `apiBase`, or an absolute one on this origin under it. The interceptor
1123
+ * acts on a stamped refusal from here and from nowhere else -- a third
1124
+ * party answering 403 with a header of the same name is not an invitation
1125
+ * to elevate this session.
1126
+ */
1127
+ isThisApi(url: string): boolean;
1128
+ /** Ask the server. Applies the answer and announces it when it differs. */
1129
+ refresh(): Observable<ElevationState>;
1130
+ /**
1131
+ * Elevate with the person's own password and, when the switch is on, a
1132
+ * code from their own authenticator. Errors are the dialog's to branch on:
1133
+ * 403 not a member of the admin group, wrong password, or wrong / replayed
1134
+ * code, 428 a code is required, 409 this account cannot elevate yet, 429
1135
+ * throttled. They pass through
1136
+ * untouched, and never open the prompt (BYPASS_ELEVATION).
1137
+ */
1138
+ elevate(password: string, code?: string): Observable<ElevationState>;
1139
+ /** Drop the elevation now. Idempotent on the server: nothing live is still a 204. */
1140
+ drop(reason?: ElevationDropReason): Observable<ElevationState>;
1141
+ /**
1142
+ * What a person's explicit request for elevation calls -- an Elevate button,
1143
+ * or a control that already knows its action needs elevation: ask the
1144
+ * server whether this session is elevated, and only when it is not, open
1145
+ * the prompt. Nothing calls it on a response by itself (the interceptor
1146
+ * only tells {@link ELEVATION_NOTICE}). Elevated already is false, no
1147
+ * prompt: elevation would change nothing.
1148
+ */
1149
+ offerFor(refusal?: string): Observable<boolean>;
1150
+ /**
1151
+ * Open the prompt, or join the one already open. Resolves to whether the
1152
+ * session is elevated once the dialog closes.
1153
+ */
1154
+ requestElevation(request: ElevationPromptRequest): Observable<boolean>;
1155
+ private options;
1156
+ private inert;
1157
+ /**
1158
+ * Store the answer, schedule the expiry read, announce a change.
1159
+ *
1160
+ * `explicit` names the change when the caller knows it (a grant). For a
1161
+ * plain refresh the kind is derived from the two states: elevated -> not
1162
+ * is `expired` when the server says so and `dropped` otherwise (the person,
1163
+ * another tab, the beacon, the tripwire); not -> elevated is a grant seen
1164
+ * from another tab; a live grant whose `expiresAt` moved is `observed`.
1165
+ *
1166
+ * `prev` is read RAW rather than through `state()`: the demotion is not
1167
+ * wanted here (this answer supersedes the stored one either way), and a
1168
+ * read that demoted would queue an expiry announcement the server's own
1169
+ * answer is about to make.
1170
+ */
1171
+ private apply;
1172
+ private kindOf;
1173
+ /**
1174
+ * Tell the listings that this session's elevation ran out, once, and NOT
1175
+ * from inside the read that noticed: a subscriber refetches on this, and a
1176
+ * refetch started in the middle of a change detection pass is a write
1177
+ * during a read. The microtask runs at the end of the current task, before
1178
+ * anything can paint.
1179
+ *
1180
+ * A server answer arriving first clears the flag, so the announcement is
1181
+ * made by whichever of the two got there first, never by both. Other tabs
1182
+ * are NOT told: each one reaches the same conclusion from the same
1183
+ * `expiresAt` on its own read, so the storage write would only buy a
1184
+ * thundering herd of GETs.
1185
+ */
1186
+ private announceExpiryLater;
1187
+ /**
1188
+ * Ask the server again at `expiresAt` -- an OPTIMISATION, not the
1189
+ * mechanism. `state()` already reports an elapsed grant as expired without
1190
+ * being told, so a timer that a sleeping machine swallows, or that a
1191
+ * background tab throttles to once a minute, now costs freshness rather
1192
+ * than correctness. What it buys is the listing refetch happening at the
1193
+ * moment of expiry instead of at the next read.
1194
+ *
1195
+ * Do not flip a local flag here: the lifetime counts from the grant on the
1196
+ * server's clock, and if the server still says elevated at that moment
1197
+ * (skew), the honest thing is to ask again shortly.
1198
+ */
1199
+ private schedule;
1200
+ /**
1201
+ * One more attempt, then stop. Giving up is affordable now and was not
1202
+ * before: the state a failed read leaves behind is still read through the
1203
+ * arithmetic above, so an unreachable server cannot leave this tab
1204
+ * believing it is elevated. What is lost is only news from elsewhere -- a
1205
+ * grant or a drop in another session -- and that is what the tab picks up
1206
+ * when it next comes into view.
1207
+ */
1208
+ private scheduleRetry;
1209
+ private clearTimer;
1210
+ private announceToOtherTabs;
1211
+ private readonly onStorage;
1212
+ private readonly onFocus;
1213
+ private readonly onVisibilityChange;
1214
+ /**
1215
+ * The tab is back. Read first -- that alone ends an elevation that ran out
1216
+ * while it was away, with no request and no network to depend on -- then
1217
+ * ask the server for what the read cannot know: a grant or a drop made
1218
+ * elsewhere, or a lifetime the server moved.
1219
+ */
1220
+ private reconcile;
1221
+ static ɵfac: i0.ɵɵFactoryDeclaration<ElevationService, never>;
1222
+ static ɵprov: i0.ɵɵInjectableDeclaration<any>;
1223
+ }
1224
+ /**
1225
+ * A refusal for want of elevation is a 403 the server stamps `X-Elevation-Required`
1226
+ * where its gate refused a member who has not elevated ({@link isElevationRefusal}).
1227
+ *
1228
+ * What it does with a stamped 403:
1229
+ * - On a write a person made (POST, PUT, PATCH, DELETE without {@link BACKGROUND_REQUEST}):
1230
+ * the prompt opens THERE, above whatever the person is in -- an edit dialog stays open
1231
+ * beneath it with its input -- and the request is HELD. If the person elevates, it is
1232
+ * sent once more and the caller receives that answer, as if the first had been accepted;
1233
+ * if the session turns out to be elevated already (another tab), it is sent once more
1234
+ * without asking. If the person declines, {@link ELEVATION_NOTICE} is told -- "Elevation
1235
+ * required", naming the action, with an Elevate button -- and the caller receives the 403.
1236
+ * The repeat is sent past this interceptor, so a second refusal is a 403, never a second
1237
+ * prompt.
1238
+ * - On a read: nothing. Reads are what a page makes as it loads and what polls make in
1239
+ * the background, and the page shows its own state for a refused one -- an inline
1240
+ * "needs an elevated session" with an Elevate button, or the feature hidden.
1241
+ * - On a background request: nothing. Nobody is waiting on it.
1242
+ *
1243
+ * !! Why reads and background requests open nothing. Were any stamped 403 to open the prompt,
1244
+ * the setup reads of almost every console page, and a realtime token at every load, would open
1245
+ * it for an administrator who has not elevated (13 of 15 pages on a menu click, 15 of 15 on a
1246
+ * reload, measured). Were a person's write to open nothing but a toast, the toast would render
1247
+ * under an open dialog, and the edit would have to be thrown away to elevate. A person's write
1248
+ * is the one refusal somebody is waiting on, which is why it is the one that asks.
1249
+ *
1250
+ * The elevation endpoint's own calls carry {@link BYPASS_ELEVATION}: a wrong password is a
1251
+ * 403 and is not a refused action. A stamped 403 from anywhere but this API is ignored:
1252
+ * the header is the server's word, and only this server's counts.
1253
+ */
1254
+ export declare const elevationInterceptor: HttpInterceptorFn;
1255
+ /**
1256
+ * The action a refused write was, in words for the person: what its caller said it is
1257
+ * ({@link ELEVATION_ACTION}), or else the method's verb and the resource the URL names --
1258
+ * "Saving navi nodes" for `PATCH /api/v1/navi/nodes/{id}`. Identifiers and the API base
1259
+ * are left out; they say nothing to the person who pressed the button.
1260
+ */
1261
+ export declare function actionOf(req: HttpRequest<unknown>, apiBase?: string): string;
1262
+ export declare class LoginComponent {
1263
+ identifier: string;
1264
+ password: string;
1265
+ readonly loading: import("@angular/core").WritableSignal<boolean>;
1266
+ readonly error: import("@angular/core").WritableSignal<string | null>;
1267
+ private readonly store;
1268
+ private readonly router;
1269
+ /** Shown when the guard signed an account out because the console is not granted to it. */
1270
+ static readonly NO_CONSOLE_ACCESS = "This account may not enter the admin.";
1271
+ /** Shown when a sign-in from before audiences was ended: it names no interface, and a new one will. */
1272
+ static readonly SIGN_IN_AGAIN = "Please sign in again.";
1273
+ constructor();
1274
+ submit(): void;
1275
+ static ɵfac: i0.ɵɵFactoryDeclaration<LoginComponent, never>;
1276
+ static ɵcmp: i0.ɵɵComponentDeclaration<LoginComponent, "coolms-admin-login", never, {}, {}, never, never, true, never>;
1277
+ }
1278
+ export declare class AppInitService {
1279
+ private readonly http;
1280
+ private readonly store;
1281
+ private readonly router;
1282
+ private readonly location;
1283
+ private readonly prefs;
1284
+ private readonly crossTabSync;
1285
+ private readonly refreshCoordinator;
1286
+ /** The only hardcoded URL -- everything else comes from the manifest. */
1287
+ private readonly configUrl;
1288
+ /**
1289
+ * Emits (once) when load() has fully completed -- tokens settled, manifest
1290
+ * set (or swallowed on error). authGuard subscribes to this so it never
1291
+ * evaluates isAuthenticated against a partially-restored stale token.
1292
+ */
1293
+ private readonly initComplete;
1294
+ readonly ready$: import("rxjs").Observable<void>;
1295
+ load(): Promise<void>;
1296
+ /**
1297
+ * Confirm the restored session is still alive, settling AuthState before the
1298
+ * app unblocks. Runs OUTSIDE the auth interceptor (BYPASS_AUTH) because the
1299
+ * interceptor queues behind ready$, which has not fired yet at this point.
1300
+ *
1301
+ * - access token accepted -> done, session alive;
1302
+ * - access token rejected -> attempt ONE refresh (access tokens are short-lived,
1303
+ * so an expired one with a valid refresh token must
1304
+ * stay logged in). The coordinator dispatches Logout
1305
+ * on a refresh 401 and SetTokens on success; a
1306
+ * transient failure (5xx/network) is swallowed so a
1307
+ * momentary blip never kills a valid session.
1308
+ */
1309
+ private validateSession;
1310
+ /**
1311
+ * GET /auth/me with an explicit Bearer header, bypassing the interceptor: true, or what refused it. The answer's
1312
+ * uiPrefs are the server's preferences as they are now, and win over the local ones for every entry they hold.
1313
+ */
1314
+ private probe;
1315
+ static ɵfac: i0.ɵɵFactoryDeclaration<AppInitService, never>;
1316
+ static ɵprov: i0.ɵɵInjectableDeclaration<any>;
1317
+ }
1318
+ /** What the server said about this sign-in and the console. */
1319
+ /**
1320
+ * `sign-in-again`: the sign-in names no interface (a token from before audiences); signing in again mends it.
1321
+ */
1322
+ export type ConsoleAccess = 'granted' | 'refused' | 'sign-in-again' | 'unknown';
1323
+ /**
1324
+ * Whether the signed-in account may use the console, and the console's endpoint
1325
+ * map when it may.
1326
+ *
1327
+ * The server decides: `GET /api/v1/admin/manifest` answers the map to every signed-in
1328
+ * account (access is decided by module groups alone): the map grants nothing, each call it
1329
+ * names is decided by its own route, and an account in no group sees the admin with an
1330
+ * empty menu. An older server answers only at `/api/v1/console/manifest`, to the `console`
1331
+ * group, and 403 to anyone else -- there a refused sign-in is still signed out; this asks
1332
+ * the current address first and the older one only on its 404. Only a refusal by type (`audience-not-granted`) is a refusal: a
1333
+ * bare 403 from such a server, or a token for the other interface, is no answer. The public theme config
1334
+ * read before sign-in carries only what the sign-in page needs; the rest arrives
1335
+ * here, once per sign-in, and is merged into the app config key by key: a key the
1336
+ * console's map carries replaces the public one whole, so the console's copy of a
1337
+ * section is always the complete one.
1338
+ *
1339
+ * `unknown` is a failure to ask (the network, a 5xx), not an answer: it is not kept,
1340
+ * so while the endpoint fails every navigation asks again.
1341
+ *
1342
+ * !! An answer belongs to the sign-in it was asked for. A sign-in, a sign-out or a
1343
+ * restored session starts a new generation; an answer that arrives for a generation
1344
+ * that is gone is kept for nobody -- A's late 403 must not sign B out -- and whoever
1345
+ * is waiting on it is answered for the sign-in there is now.
1346
+ *
1347
+ * !! With nobody signed in there is nothing to ask, and nothing is asked. Without
1348
+ * that, the re-ask after a sign-out went out with no token, its 401 made the
1349
+ * interceptor dispatch Logout, which started another generation, which re-asked:
1350
+ * a loop for as long as the tab lived (found in review).
1351
+ */
1352
+ export declare class ConsoleAccessService {
1353
+ /** The admin manifest's URL: fixed, like the theme config's, because nothing is known before it. */
1354
+ static readonly URL = "/api/v1/admin/manifest";
1355
+ /** An older server's address, asked only when the server answers 404 at {@link URL}. */
1356
+ static readonly LEGACY_URL = "/api/v1/console/manifest";
1357
+ /** The login page's query parameter value for "signed out: no console access". */
1358
+ static readonly REFUSED_REASON = "no-console-access";
1359
+ /** The login page's query parameter value for "signed out: sign in again" (a sign-in that names no audience). */
1360
+ static readonly SIGN_IN_AGAIN_REASON = "sign-in-again";
1361
+ private readonly http;
1362
+ private readonly store;
1363
+ private answer;
1364
+ private pending;
1365
+ private generation;
1366
+ constructor();
1367
+ /** Ask once per sign-in; the manifest is merged into the app config when granted. */
1368
+ ensure(): Promise<ConsoleAccess>;
1369
+ /**
1370
+ * Sign a refused account out: this sign-in ends on the server (its refresh token
1371
+ * with it), as the account menu's sign-out does, and then in this browser --
1372
+ * whatever the server answered, so a refused request cannot leave it signed in.
1373
+ */
1374
+ signOut(): Observable<void>;
1375
+ private merge;
1376
+ static ɵfac: i0.ɵɵFactoryDeclaration<ConsoleAccessService, never>;
1377
+ static ɵprov: i0.ɵɵInjectableDeclaration<any>;
1378
+ }
1379
+ /**
1380
+ * Layout config DTO -- the shape served from
1381
+ * `GET /api/v1/config/layout/{id}`. Mirrors the YAML at
1382
+ * `config/modules/{module}/layout/*.yaml`.
1383
+ *
1384
+ * The optional fields below are the page-level contract
1385
+ * every admin SPA page resolves through. The base contract (id /
1386
+ * template / title / icon / slots) is the legacy list shape and stays
1387
+ * untouched. Existing 17 list YAMLs render identically when the new
1388
+ * fields are absent.
1389
+ *
1390
+ * New optional fields:
1391
+ * - `subtitle` one-line page description rendered under the title
1392
+ * - `sections` ordered map of body sections, each with its own slot graph
1393
+ * (replaces single-slot `slots:` for multi-section pages)
1394
+ * - `headerActions` buttons displayed in the cms-page-header action bar
1395
+ * - `permissions` hint for clients about who this page targets; real gating
1396
+ * lives on the data APIs the slot components consume
1397
+ * (the layout endpoint itself is public by design --
1398
+ * layouts carry only structure, never data)
1399
+ *
1400
+ * `[key: string]: unknown` index signature stays so existing per-page
1401
+ * keys (e.g. `media:library`'s `naviGraph:` slot shorthand) keep working
1402
+ * without further interface changes.
1403
+ */
1404
+ export interface LayoutHeaderAction {
1405
+ id: string;
1406
+ label?: string;
1407
+ icon?: string;
1408
+ title?: string;
1409
+ primary?: boolean;
1410
+ danger?: boolean;
1411
+ disabled?: boolean;
1412
+ /**
1413
+ * Optional capability gate evaluated FE-side against runtime state
1414
+ * (e.g. `administer` / `delete`) -- the config declares WHICH actions
1415
+ * exist + their gate; the FE decides if THIS user/row qualifies. Absent
1416
+ * = always shown. Used by detail pages whose actions are config-driven
1417
+ * (see `web:section-detail`).
1418
+ *
1419
+ * For a gate that depends on the RECORD rather than the user, prefer
1420
+ * `showWhen` below: `requires` needs a page to interpret the token, so
1421
+ * every new value costs a branch in TypeScript.
1422
+ */
1423
+ requires?: string;
1424
+ /**
1425
+ * Conditions on the page's published context, same grammar and same
1426
+ * evaluator as a NaviGraph toolbar node, applied
1427
+ * by {@link LayoutActionsService}:
1428
+ *
1429
+ * showWhen -- the action does not APPLY, so it is absent.
1430
+ * disabledWhen -- temporarily UNAVAILABLE: stays put and greys out.
1431
+ * busyWhen -- the action is RUNNING: greys out too, and may relabel.
1432
+ * busyLabel -- label shown while `busyWhen` holds ("Saving...").
1433
+ * activeWhen -- pressed/active styling.
1434
+ *
1435
+ * Two carriers (a layout config and a NaviGraph tree) but ONE vocabulary:
1436
+ * a page that moves between them should not have to relearn how to say
1437
+ * "not now".
1438
+ */
1439
+ showWhen?: Record<string, unknown>;
1440
+ disabledWhen?: Record<string, unknown>;
1441
+ busyWhen?: Record<string, unknown>;
1442
+ busyLabel?: string;
1443
+ activeWhen?: Record<string, unknown>;
1444
+ }
1445
+ export interface LayoutSection {
1446
+ title?: string;
1447
+ /**
1448
+ * When true, the layout shell pins the section to the top of the
1449
+ * scroll container (CSS `position: sticky`). Used by inspector /
1450
+ * filter pages where an input form should stay visible while the
1451
+ * operator scrolls through results below. Currently honoured by
1452
+ * cms-inspector-layout; cms-detail-layout will follow when it
1453
+ * lands. Default false.
1454
+ */
1455
+ sticky?: boolean;
1456
+ slots?: Record<string, {
1457
+ component?: string;
1458
+ [key: string]: unknown;
1459
+ }>;
1460
+ [key: string]: unknown;
1461
+ }
1462
+ export interface LayoutConfig {
1463
+ id?: string;
1464
+ template?: string;
1465
+ title?: string;
1466
+ subtitle?: string;
1467
+ icon?: string;
1468
+ slots?: Record<string, unknown>;
1469
+ sections?: Record<string, LayoutSection>;
1470
+ headerActions?: LayoutHeaderAction[];
1471
+ /**
1472
+ * Actions rendered in the page's fixed bottom bar (`<cms-detail-footer>`)
1473
+ * -- primary / destructive actions kept out of the cramped header.
1474
+ * Same shape as `headerActions`; gated per-item via `requires`.
1475
+ */
1476
+ footerActions?: LayoutHeaderAction[];
1477
+ permissions?: string[];
1478
+ [key: string]: unknown;
1479
+ }
1480
+ export interface DialogConfig {
1481
+ [key: string]: unknown;
1482
+ }
1483
+ export interface NavigraphConfig {
1484
+ [key: string]: unknown;
1485
+ }
1486
+ export interface FormConfig {
1487
+ [key: string]: unknown;
1488
+ }
1489
+ export interface DatagridConfig {
1490
+ [key: string]: unknown;
1491
+ }
1492
+ /**
1493
+ * Fetches config YAMLs (served as JSON) from GET /api/v1/config/{type}/{id}.
1494
+ *
1495
+ * Responses are cached for the lifetime of the service (Map + shareReplay(1))
1496
+ * so repeated calls never re-fetch the same resource. A failed read is dropped
1497
+ * from the cache, so the next call asks the server again.
1498
+ *
1499
+ * configBase is read from the API manifest (manifest.configBase) and falls
1500
+ * back to '/api/v1/config' when the manifest is not yet loaded.
1501
+ */
1502
+ export declare class ConfigService {
1503
+ private readonly http;
1504
+ private readonly store;
1505
+ private readonly cache;
1506
+ layout(id: string): Observable<LayoutConfig>;
1507
+ dialog(id: string): Observable<DialogConfig>;
1508
+ navigraph(slug: string): Observable<NavigraphConfig>;
1509
+ form(id: string): Observable<FormConfig>;
1510
+ datagrid(id: string): Observable<DatagridConfig>;
1511
+ private fetch;
1512
+ static ɵfac: i0.ɵɵFactoryDeclaration<ConfigService, never>;
1513
+ static ɵprov: i0.ɵɵInjectableDeclaration<any>;
1514
+ }
1515
+ export declare class SetAppConfig {
1516
+ readonly config: ThemeConfigResponse;
1517
+ static readonly type = "[AppConfig] Set";
1518
+ constructor(config: ThemeConfigResponse);
1519
+ }
1520
+ export interface AppConfigStateModel {
1521
+ config: ThemeConfigResponse | null;
1522
+ loaded: boolean;
1523
+ }
1524
+ export declare class AppConfigState {
1525
+ set(ctx: StateContext<AppConfigStateModel>, { config }: SetAppConfig): void;
1526
+ /** The whole config as last set: the public theme config, with the console's manifest once granted. */
1527
+ static config(state: AppConfigStateModel): ThemeConfigResponse | null;
1528
+ static manifest(state: AppConfigStateModel): ApiManifest | null;
1529
+ /**
1530
+ * The viewer manifest. Null when the backend didn't ship a viewers
1531
+ * section (no tagged providers); consumers should fall back to a
1532
+ * "no preview" surface.
1533
+ */
1534
+ static viewers(state: AppConfigStateModel): ViewerApiManifest | null;
1535
+ static loaded(state: AppConfigStateModel): boolean;
1536
+ static ɵfac: i0.ɵɵFactoryDeclaration<AppConfigState, never>;
1537
+ static ɵprov: i0.ɵɵInjectableDeclaration<any>;
1538
+ }
1539
+ /**
1540
+ * Converts any caught error into the sentence a person reads: a declared problem's detail as the server gives it, a
1541
+ * validation refusal's first field message, and the one generic sentence for anything else (see refusalWords).
1542
+ */
1543
+ export declare class ErrorHandlerService {
1544
+ humanize(err: unknown): string;
1545
+ static ɵfac: i0.ɵɵFactoryDeclaration<ErrorHandlerService, never>;
1546
+ static ɵprov: i0.ɵɵInjectableDeclaration<any>;
1547
+ }
1548
+ /** What a declared problem says when the server gives no sentence for it (an older server). */
1549
+ export declare const NOT_AVAILABLE = "Not available right now";
1550
+ /** What an undeclared fault or a network failure says: never its own text, which may carry internals. */
1551
+ export declare const SOMETHING_WENT_WRONG = "Something went wrong. Try again.";
1552
+ /** The server's sentence, as given; null for none or a blank one. */
1553
+ export declare function sentenceOf(text: unknown): string | null;
1554
+ /** The problem body of an error answer, parsed when it came as text; null when it is not a plain JSON object. */
1555
+ export declare function problemOf(error: HttpErrorResponse): Record<string, unknown> | null;
1556
+ /**
1557
+ * The declared problem of a failure: its body when the type is set, not about:blank and not a framework's own type for
1558
+ * a server fault, else null.
1559
+ */
1560
+ export declare function declaredProblemOf(error: unknown): Record<string, unknown> | null;
1561
+ /** The declared type of a failure, for behaviour only; null when the problem is undeclared or there is none. */
1562
+ export declare function declaredTypeOf(error: unknown): string | null;
1563
+ /** Whether a failure is the server's refusal (4xx), as opposed to a fault (5xx), a network failure or anything else. */
1564
+ export declare function isRefusal(error: unknown): boolean;
1565
+ /**
1566
+ * What a failed call says, in whose words the components contract sets: a validation refusal (422 with violations) its
1567
+ * first field's message, declared or not, never the top-level detail (a form shows each message next to its field
1568
+ * instead); a declared problem (a type other than about:blank) its `detail` as the server gives it, whatever the
1569
+ * status, or NOT_AVAILABLE when it gives none; an undeclared problem, a network failure or anything else
1570
+ * SOMETHING_WENT_WRONG, never its own text. The type is for behaviour only and never turned into words here. The
1571
+ * result is plain text.
1572
+ */
1573
+ export declare function refusalWords(error: unknown): string;
1574
+ /** What the user PICKED. `system` defers to the OS. */
1575
+ export type ThemeChoice = 'light' | 'dark' | 'system';
1576
+ /** What that resolves to right now -- the only two the stylesheet knows. */
1577
+ export type ResolvedTheme = 'light' | 'dark';
1578
+ /**
1579
+ * Applies the user's theme by setting `data-theme` on the document element.
1580
+ *
1581
+ * The stylesheet does the rest: `:root[data-theme='dark']` re-points the
1582
+ * `--cms-*` palette and every colour in the admin arrives through those names.
1583
+ * Nothing here knows a single colour, which is the point -- a second
1584
+ * theme is a block of tokens, not a code change.
1585
+ *
1586
+ * Follows the shape of UserCalendarPreferencesService and
1587
+ * CallOverlayPreferencesService: lazy one-shot load of `/auth/me/settings`,
1588
+ * cached for the SPA lifetime, with `update()` called by the Profile page after
1589
+ * a save so the change lands without a refetch.
1590
+ */
1591
+ export declare class ThemeService {
1592
+ private readonly api;
1593
+ private readonly store;
1594
+ private readonly _choice;
1595
+ private readonly _systemDark;
1596
+ private readonly _userAccent;
1597
+ private readonly _platformAccent;
1598
+ private loadOnce$?;
1599
+ /** The user's stored choice, including `system`. */
1600
+ readonly choice: import("@angular/core").Signal<ThemeChoice>;
1601
+ /** This user's personal override, independent of the deployment's. */
1602
+ readonly userAccent: import("@angular/core").Signal<string | null>;
1603
+ /** The deployment's brand accent from the API manifest, if it set one. */
1604
+ readonly platformAccent: import("@angular/core").Signal<string | null>;
1605
+ /**
1606
+ * The colour actually painted: personal override, else the deployment's,
1607
+ * else null -- which leaves the stylesheet's own accent in place.
1608
+ *
1609
+ * Three rungs and each is a real state. A user who has chosen nothing is
1610
+ * NOT the same as one who chose the deployment's colour: clear the
1611
+ * deployment's brand and the first user follows it, the second does not.
1612
+ */
1613
+ readonly accent: import("@angular/core").Signal<string | null>;
1614
+ /** The choice with `system` resolved against the OS setting. */
1615
+ readonly resolved: import("@angular/core").Signal<ResolvedTheme>;
1616
+ constructor();
1617
+ /**
1618
+ * One-shot load of the stored preference. Safe to call more than once and
1619
+ * safe for anonymous users -- a failure leaves the cached/system value in
1620
+ * place rather than forcing light, so the login screen still matches the OS.
1621
+ */
1622
+ ensureLoaded(): Observable<ThemeChoice>;
1623
+ /**
1624
+ * Called by the Profile page after the Preferences tab saves, so the admin
1625
+ * re-themes on the spot. Ignores anything that is not a known choice --
1626
+ * the section PATCH returns the whole merged bag, not just this field.
1627
+ */
1628
+ update(value: unknown): void;
1629
+ /**
1630
+ * Companion to {@link update} for the accent field of the same save.
1631
+ * An explicit null clears the override; anything malformed is ignored
1632
+ * rather than applied, so a bad value can never blank the admin's accent.
1633
+ */
1634
+ updateAccent(value: unknown): void;
1635
+ private set;
1636
+ /**
1637
+ * The manifest is loaded at bootstrap, well before the authenticated shell
1638
+ * calls this, so a snapshot read is enough and no subscription is needed.
1639
+ * A malformed value is ignored rather than applied -- the container refuses
1640
+ * to build with one, but the manifest crosses the network all the same.
1641
+ */
1642
+ private readPlatformAccent;
1643
+ private setAccent;
1644
+ /**
1645
+ * Writes the override onto the document element, where an inline style
1646
+ * outranks every stylesheet rule -- including the dark block -- so one
1647
+ * declaration re-points the accent in both themes.
1648
+ *
1649
+ * Only --cms-accent is set, not the -hover/-light/-text members of the
1650
+ * family. Deriving those from an arbitrary user colour needs a colour model
1651
+ * the palette does not have yet, and guessing them would produce hover
1652
+ * states that clash with the very colour the user chose. Until then the
1653
+ * override moves the brand fill and leaves its supporting tones alone.
1654
+ */
1655
+ private applyAccent;
1656
+ private applyToDocument;
1657
+ private static readCache;
1658
+ private static readAccentCache;
1659
+ static ɵfac: i0.ɵɵFactoryDeclaration<ThemeService, never>;
1660
+ static ɵprov: i0.ɵɵInjectableDeclaration<any>;
1661
+ }
1662
+ /**
1663
+ * The platform's loading indicator: the spinner of the UI contract's state component (`state` in design-tokens'
1664
+ * components.json), drawn from the tokens -- an arc turning on its track.
1665
+ *
1666
+ * One spinner for every wait, the same one the state component turns, so a page does not show two kinds of
1667
+ * waiting. A whole read waiting in place of its content is the state component's
1668
+ * (`cms-state kind="loading"`, which also waits its delay before it shows); this is for the waits inside a row, a
1669
+ * status bar or a button, and for a cover over content not ready to be seen.
1670
+ *
1671
+ * ## Why one component rather than a snippet per surface
1672
+ *
1673
+ * It is meant for every wait long enough to notice: a dashboard assembling its
1674
+ * cards, an editor paginating a document, an explorer listing a folder. Those
1675
+ * are different teams' files, and a copied indicator in each is how three
1676
+ * loaders that no longer match each other happen.
1677
+ *
1678
+ * Under `prefers-reduced-motion` it holds still and only breathes, because
1679
+ * motion sickness is not a stylistic preference.
1680
+ */
1681
+ export declare class CmsLoaderComponent {
1682
+ /** Optional caption. Absent renders the spinner alone, which suits a small inline wait. */
1683
+ readonly label: import("@angular/core").InputSignal<string>;
1684
+ /** Cover the positioned ancestor rather than sitting in the flow. */
1685
+ readonly overlay: import("@angular/core").InputSignal<boolean>;
1686
+ /**
1687
+ * Row layout at text scale, for a wait inside a row, a status bar or a
1688
+ * button. Override `--cms-loader-size` to tune the spinner.
1689
+ */
1690
+ readonly inline: import("@angular/core").InputSignal<boolean>;
1691
+ static ɵfac: i0.ɵɵFactoryDeclaration<CmsLoaderComponent, never>;
1692
+ static ɵcmp: i0.ɵɵComponentDeclaration<CmsLoaderComponent, "cms-loader", never, {
1693
+ "label": {
1694
+ "alias": "label";
1695
+ "required": false;
1696
+ "isSignal": true;
1697
+ };
1698
+ "overlay": {
1699
+ "alias": "overlay";
1700
+ "required": false;
1701
+ "isSignal": true;
1702
+ };
1703
+ "inline": {
1704
+ "alias": "inline";
1705
+ "required": false;
1706
+ "isSignal": true;
1707
+ };
1708
+ }, {}, never, never, true, never>;
1709
+ }
1710
+ /** The prefix of a grid's own entry: `datagrid:<gridId>`. */
1711
+ export declare const DATAGRID_ENTRY_PREFIX = "datagrid:";
1712
+ /** The entry a grid's preferences are kept in. */
1713
+ export declare function datagridEntry(gridId: string): string;
1714
+ /**
1715
+ * The person's interface preferences: one localStorage key (`coolms_ui_prefs`) holding the entries the server keeps
1716
+ * (PATCH /auth/me/preferences, read back from GET /auth/me's uiPrefs), each an object of fields, by id:
1717
+ *
1718
+ * datagrid:{gridId} { columns, columnWidths, columnFractions } one entry per grid
1719
+ * panel { {persistKey}: { width, collapsed } }
1720
+ * page { vfs: {...}, media: {...}, nav: { lastRoute } }
1721
+ * terminal { height }
1722
+ *
1723
+ * A change is written locally at once and sent, debounced, as the entries that changed only; the server merges each
1724
+ * entry field by field and leaves every other entry as it was. A refusal (422) is shown to the person through
1725
+ * {@link PREFERENCES_NOTICE}; any other failure is tried again after 5 s, 30 s, then every 2 min, and at once when
1726
+ * the browser comes back online or the tab is shown again. On load the server's value wins for every entry it has.
1727
+ */
1728
+ export declare class UserPreferencesService {
1729
+ private readonly http;
1730
+ private readonly store;
1731
+ private readonly destroyRef;
1732
+ private readonly errors;
1733
+ private readonly notice;
1734
+ private readonly document;
1735
+ private readonly STORAGE_KEY;
1736
+ /** The entry that records when each other entry last changed (ms since the epoch), here and on the server. */
1737
+ private readonly CHANGED_AT;
1738
+ private readonly SYNC_DELAY;
1739
+ /** The waits before each try again after a failed send, in ms; the last one repeats. */
1740
+ private readonly RETRY_DELAYS;
1741
+ /** The entries changed since the last send, by id, with the value to send. */
1742
+ private readonly pending;
1743
+ private readonly syncSubject;
1744
+ /** Failed sends since the last one that succeeded; picks the wait before the next try. */
1745
+ private failures;
1746
+ /** The one try again scheduled after a failed send, if any. */
1747
+ private retryTimer;
1748
+ constructor();
1749
+ /** Sends the pending entries with fetch keepalive, which completes after the page is gone; best effort. */
1750
+ private flushOnLeave;
1751
+ /**
1752
+ * Writes all entries locally, stamped with when they changed, and schedules a debounced send of the entries
1753
+ * named (and their times). Sent sooner when the page is hidden or left.
1754
+ */
1755
+ private save;
1756
+ /** Adds times to the pending record of when entries changed; the times already pending stay. */
1757
+ private pendingAt;
1758
+ /** When each entry last changed, as recorded in the entries given. */
1759
+ private changedAt;
1760
+ private write;
1761
+ private readLocal;
1762
+ /**
1763
+ * Read the entire prefs object from localStorage, applying legacy key
1764
+ * migration on the first read after an upgrade.
1765
+ */
1766
+ private load;
1767
+ /**
1768
+ * Older shapes, moved to today's in place; true when something moved. Each grid gets its own `datagrid:<id>`
1769
+ * entry -- from the nested `grids` entry, or a flat grid key older still -- unless it already has one; a moved
1770
+ * grid's entry is queued to be sent, so the server keeps the same shape.
1771
+ */
1772
+ private migrate;
1773
+ /**
1774
+ * Takes the server's preferences (GET /auth/me's uiPrefs), after sign-in and on every load: for every entry the
1775
+ * server has, its value wins over the local one; an entry only this browser has is kept. An entry changed here
1776
+ * and not yet sent keeps its local value: it is newer, and on its way. The server's nested `grids` entry gives a
1777
+ * grid its own entry only where neither side has one.
1778
+ */
1779
+ loadFromServer(uiPrefs: Record<string, unknown>): void;
1780
+ /** Sends the entries changed since the last send, those only. */
1781
+ private flush;
1782
+ private syncToServer;
1783
+ /** Schedules the one try again of the pending entries, after the wait the failures so far call for. */
1784
+ private scheduleRetry;
1785
+ private cancelRetry;
1786
+ /**
1787
+ * A send that failed. A refusal (422) stored nothing and would be refused again: the person is told, in the
1788
+ * server's words. Any other failure keeps the entries (one changed since is newer) and schedules one try again; a
1789
+ * change made meanwhile goes with the next send.
1790
+ */
1791
+ private refused;
1792
+ /**
1793
+ * Get stored preferences for a specific grid: its `datagrid:<gridId>` entry, without the fields a reset left
1794
+ * empty; null when it has none.
1795
+ */
1796
+ getGridPref(gridId: string): DataGridPreference | null;
1797
+ /**
1798
+ * Set visible column order for a grid.
1799
+ * Applies to localStorage instantly; server sync is debounced.
1800
+ */
1801
+ setColumns(gridId: string, columns: string[]): void;
1802
+ /**
1803
+ * Record a column width for a grid column.
1804
+ * Applies to localStorage instantly; server sync is debounced.
1805
+ */
1806
+ setColumnWidth(gridId: string, field: string, width: number): void;
1807
+ /**
1808
+ * Record the visible columns' shares of a grid's width (each in (0, 1], summing to 1), replacing any pixel widths:
1809
+ * those were the older record, and a share keeps its proportion when the window changes.
1810
+ * Applies to localStorage instantly; server sync is debounced.
1811
+ */
1812
+ setColumnFractions(gridId: string, fractions: Record<string, number>): void;
1813
+ /**
1814
+ * Remove all preferences for a specific grid, and send at once: the server keeps an entry it was once sent,
1815
+ * so the grid's fields are sent empty (null), which it stores as they come.
1816
+ */
1817
+ resetGrid(gridId: string): void;
1818
+ private updateGrid;
1819
+ /**
1820
+ * Get persisted terminal panel height.
1821
+ */
1822
+ getTerminalHeight(): number | null;
1823
+ /**
1824
+ * Persist terminal panel height.
1825
+ */
1826
+ setTerminalHeight(height: number): void;
1827
+ /**
1828
+ * Get persisted state for a resizable panel identified by key.
1829
+ * Used by ExplorerLayoutComponent to persist panel widths across sessions.
1830
+ */
1831
+ getPanelState(key: string): {
1832
+ width: number;
1833
+ collapsed: boolean;
1834
+ } | null;
1835
+ /**
1836
+ * Persist generic panel state by key.
1837
+ * Applies to localStorage instantly; server sync is debounced.
1838
+ */
1839
+ setPanelState(key: string, width: number, collapsed: boolean): void;
1840
+ /**
1841
+ * Get all persisted state for a page namespace (e.g. 'vfs', 'media', 'nav').
1842
+ */
1843
+ getPageState<T>(pageKey: string): T | null;
1844
+ /**
1845
+ * Merge partial state into a page namespace.
1846
+ * Existing keys in the namespace are preserved; only provided keys are updated.
1847
+ * Applies to localStorage instantly; server sync is debounced.
1848
+ */
1849
+ setPageState(pageKey: string, state: Record<string, unknown>): void;
1850
+ /** @deprecated Use getPageState('media') instead */
1851
+ getMediaViewMode(): string | null;
1852
+ /** @deprecated Use setPageState('media', ...) instead */
1853
+ setMediaViewMode(mode: string): void;
1854
+ /** @deprecated Use getPanelState('media_panel_left') instead */
1855
+ getMediaCollectionsPanel(): {
1856
+ width: number;
1857
+ collapsed: boolean;
1858
+ } | null;
1859
+ /** @deprecated Use setPanelState('media_panel_left', ...) instead */
1860
+ setMediaCollectionsPanel(width: number, collapsed: boolean): void;
1861
+ static ɵfac: i0.ɵɵFactoryDeclaration<UserPreferencesService, never>;
1862
+ static ɵprov: i0.ɵɵInjectableDeclaration<any>;
1863
+ }
1864
+ /**
1865
+ * Told when the server refused to store the person's interface preferences (a 422): the application shows the
1866
+ * sentence to the person, in its own toast or notice. `sentence` is whole, ready to show:
1867
+ * "Your preferences could not be saved: <the server's reason>".
1868
+ */
1869
+ export interface PreferencesNoticePort {
1870
+ refused(sentence: string): void;
1871
+ }
1872
+ /** Optional: with nothing bound, a refusal is only written to the console. */
1873
+ export declare const PREFERENCES_NOTICE: InjectionToken<PreferencesNoticePort>;
1874
+ /**
1875
+ * Sidebar collapse state -- two independent dimensions:
1876
+ *
1877
+ * - `collapsed`: whole-sidebar icon-only rail toggle (the chevron at
1878
+ * the bottom of the sidebar). Per-device localStorage.
1879
+ * - `collapsedSections`: per-section collapse, keyed by the section
1880
+ * separator's node id. Used to fold a section's items under their
1881
+ * header so the nav doesn't endless-scroll once a tenant has lots
1882
+ * of modules. Per-device localStorage.
1883
+ * - `collapsedItems`: per-item inline-expand collapse, keyed by the
1884
+ * nav node's id. Mirrors `collapsedSections` but for sub-tree items
1885
+ * (a top-level item with children, e.g. Reports -> Process Report).
1886
+ * Absent id = expanded (children visible); present = collapsed.
1887
+ * Per-device localStorage.
1888
+ *
1889
+ * Storage failures (private mode, quota, disabled cookies) fall back
1890
+ * to defaulting un-collapsed -- the toggles still work for the session,
1891
+ * just don't persist.
1892
+ */
1893
+ export declare class SidebarStateService {
1894
+ private static readonly STORAGE_KEY;
1895
+ private static readonly STORAGE_KEY_SECTIONS;
1896
+ private static readonly STORAGE_KEY_ITEMS;
1897
+ readonly collapsed: import("@angular/core").WritableSignal<boolean>;
1898
+ readonly collapsedSections: import("@angular/core").WritableSignal<Set<string>>;
1899
+ readonly collapsedItems: import("@angular/core").WritableSignal<Set<string>>;
1900
+ toggle(): void;
1901
+ isSectionCollapsed(id: string): boolean;
1902
+ toggleSection(id: string): void;
1903
+ /**
1904
+ * Force a section to be expanded. Used when navigation lands on
1905
+ * a route inside a manually-collapsed section -- it would be
1906
+ * confusing to leave the active item hidden. The user can
1907
+ * collapse the section again afterwards.
1908
+ */
1909
+ ensureExpanded(id: string): void;
1910
+ isItemCollapsed(id: string): boolean;
1911
+ toggleItem(id: string): void;
1912
+ private readPersisted;
1913
+ private persist;
1914
+ private readSectionsPersisted;
1915
+ private persistSections;
1916
+ private readItemsPersisted;
1917
+ private persistItems;
1918
+ static ɵfac: i0.ɵɵFactoryDeclaration<SidebarStateService, never>;
1919
+ static ɵprov: i0.ɵɵInjectableDeclaration<any>;
1920
+ }
1921
+ /**
1922
+ * One row returned by the `/api/entity-search` endpoint. `id` is
1923
+ * what the picker emits via its `valueChange` output (and what the
1924
+ * template's persisted context carries). `label` is the primary
1925
+ * display line. `secondary` is an optional second line for
1926
+ * disambiguation (email, slug, etc.) -- the backend omits the key
1927
+ * when there is nothing to show; receiving `null` from a custom
1928
+ * resolver is normalized to `undefined` here.
1929
+ */
1930
+ export interface EntitySearchResult {
1931
+ readonly id: string | number;
1932
+ readonly label: string;
1933
+ readonly secondary?: string;
1934
+ }
1935
+ /**
1936
+ * HTTP client for the Phase 2a `/api/entity-search` endpoint.
1937
+ * Returns a stream of search results for the given entity FQCN.
1938
+ * Permission filtering happens at the backend resolver layer --
1939
+ * this service is a thin RPC.
1940
+ */
1941
+ export declare class EntitySearchService {
1942
+ private readonly http;
1943
+ /**
1944
+ * @param entityType Fully-qualified PHP class name of the entity
1945
+ * being searched (e.g. the backend's User entity).
1946
+ * @param query Free-text search input. Empty string is
1947
+ * valid -- the backend returns the default
1948
+ * listing for that entity type.
1949
+ * @param limit Max rows to return; clamped server-side to
1950
+ * [1, 100].
1951
+ */
1952
+ search(entityType: string, query: string, limit?: number): Observable<EntitySearchResult[]>;
1953
+ static ɵfac: i0.ɵɵFactoryDeclaration<EntitySearchService, never>;
1954
+ static ɵprov: i0.ɵɵInjectableDeclaration<any>;
1955
+ }
1956
+ /**
1957
+ * Well-known click target values embedded in meta.target.
1958
+ * 'action.logout' -- dispatch Logout action
1959
+ * 'route' -- navigate via routerLink (default when target absent)
1960
+ * '_blank' -- open in a new tab (hrefOverride must be set)
1961
+ */
1962
+ export type NaviGraphTarget = 'action.logout' | 'route' | '_blank' | (string & {});
1963
+ export interface NaviGraphMeta {
1964
+ readonly component?: string;
1965
+ readonly icon?: string;
1966
+ readonly routerLink?: string;
1967
+ readonly target?: NaviGraphTarget;
1968
+ readonly requiredRole?: string;
1969
+ readonly voterAttribute?: string;
1970
+ readonly contributor?: string;
1971
+ readonly [key: string]: unknown;
1972
+ }
1973
+ /**
1974
+ * What the server says this account may do with a node, as it answered the graph:
1975
+ * 'allowed' -- its own rights open it; shown as usual;
1976
+ * 'elevate' -- a member of admin, not elevated, whose own rights refuse it and whom elevation would let in;
1977
+ * shown with a lock, and opening it asks for elevation first.
1978
+ * A node anyone else may not open is not in the answer at all. Absent (an older server) reads as 'allowed'.
1979
+ */
1980
+ export type NaviAccess = 'allowed' | 'elevate';
1981
+ /** Flat node as returned from GET /navi/trees/{slug}/graph */
1982
+ export interface NaviGraphNodeFlat {
1983
+ readonly id: string;
1984
+ readonly path: string;
1985
+ readonly title: string;
1986
+ readonly parentId: string | null;
1987
+ readonly sortOrder: number;
1988
+ readonly isActive: boolean;
1989
+ readonly isVisible: boolean;
1990
+ readonly meta: NaviGraphMeta;
1991
+ readonly access?: NaviAccess;
1992
+ }
1993
+ /** The node's access as the server answered it; 'allowed' when the server said nothing (an older server). */
1994
+ export declare function naviAccessOf(node: Pick<NaviGraphNodeFlat, 'access'>): NaviAccess;
1995
+ /** Same node enriched with resolved children after client-side tree build */
1996
+ export interface NaviGraphNode extends NaviGraphNodeFlat {
1997
+ readonly children: NaviGraphNode[];
1998
+ }
1999
+ /**
2000
+ * Loads, caches, and drives admin NaviGraph trees.
2001
+ *
2002
+ * Usage:
2003
+ * naviGraphService.loadAdminNav(url).subscribe();
2004
+ * const items = naviGraphService.adminNav(); // signal<NaviGraphNode[]>
2005
+ * naviGraphService.handleClick(node);
2006
+ */
2007
+ export declare class NaviGraphService {
2008
+ private readonly http;
2009
+ private readonly router;
2010
+ private readonly store;
2011
+ private readonly errors;
2012
+ /** Resolved root nodes for navi.admin (sidebar). */
2013
+ readonly adminNav: import("@angular/core").WritableSignal<NaviGraphNode[]>;
2014
+ /** Resolved root nodes for navi.admin.topbar. */
2015
+ readonly topbarNav: import("@angular/core").WritableSignal<NaviGraphNode[]>;
2016
+ private readonly cache;
2017
+ /**
2018
+ * `fresh` asks the server again instead of answering from this service's cache: the answer is per account AND
2019
+ * per elevation state (a node is 'elevate' before a grant and 'allowed' after it), so a change of elevation must
2020
+ * re-ask, or a lock would outlive the grant -- or come back only after a reload.
2021
+ */
2022
+ loadAdminNav(url: string, options?: {
2023
+ fresh?: boolean;
2024
+ }): Observable<NaviGraphNode[]>;
2025
+ loadTopbarNav(url: string): Observable<NaviGraphNode[]>;
2026
+ /**
2027
+ * Handle a nav-node click.
2028
+ *
2029
+ * Routing logic based on meta.target:
2030
+ * 'action.logout' -- dispatch Logout
2031
+ * '_blank' -- window.open (uses node.path as href)
2032
+ * default -- router.navigate with meta.routerLink or node.path
2033
+ */
2034
+ handleClick(node: NaviGraphNode): void;
2035
+ /**
2036
+ * Evaluate `showWhen` meta condition against a record.
2037
+ * Nodes with no `showWhen` are always visible.
2038
+ * Supports nested AND/OR logic: { and: [...] } / { or: [...] }
2039
+ */
2040
+ isVisible(node: NaviGraphNode, record: Record<string, unknown>): boolean;
2041
+ /**
2042
+ * Standalone `showWhen` evaluator for callers that don't have a
2043
+ * full `NaviGraphNode` (e.g. a grid's row context menu -- a
2044
+ * `rowAction.showWhen` predicate is evaluated against the row's
2045
+ * own projection). `null`/`undefined` predicates default to
2046
+ * visible, mirroring `isVisible`'s "no rule = always shown"
2047
+ * semantics.
2048
+ */
2049
+ matchesShowWhen(showWhen: Record<string, unknown> | undefined | null, record: Record<string, unknown>): boolean;
2050
+ private isCondition;
2051
+ private evalCondition;
2052
+ /**
2053
+ * Fetch a graph endpoint and return a nested tree.
2054
+ * Handles both compact JSON-LD IRIs (`member`) and
2055
+ * the legacy Hydra key (`hydra:member`).
2056
+ * Results are cached by URL for the lifetime of the service instance.
2057
+ */
2058
+ loadTree(url: string, fresh?: boolean): Observable<NaviGraphNode[]>;
2059
+ /**
2060
+ * Build a nested tree from a flat array of nodes.
2061
+ * Nodes are sorted by sortOrder at each level.
2062
+ */
2063
+ private buildTree;
2064
+ static ɵfac: i0.ɵɵFactoryDeclaration<NaviGraphService, never>;
2065
+ static ɵprov: i0.ɵɵInjectableDeclaration<any>;
2066
+ }
2067
+ /**
2068
+ * Registry mapping string keys to Angular component classes.
2069
+ *
2070
+ * Backed by a static Map so components registered at module load time
2071
+ * (e.g. in app.config.ts) are visible to all injected instances.
2072
+ *
2073
+ * Usage -- static (app.config.ts / bootstrap time):
2074
+ * ComponentRegistry.register('MediaLibraryPage', MediaLibraryPage);
2075
+ *
2076
+ * Usage -- injected (SlotComponent / runtime):
2077
+ * private readonly registry = inject(ComponentRegistry);
2078
+ * const cls = this.registry.get('MediaLibraryPage');
2079
+ */
2080
+ export declare class ComponentRegistry {
2081
+ private static readonly map;
2082
+ static register(key: string, component: Type<unknown>): void;
2083
+ static get(key: string): Type<unknown> | undefined;
2084
+ static has(key: string): boolean;
2085
+ static keys(): string[];
2086
+ register(key: string, component: Type<unknown>): void;
2087
+ get(key: string): Type<unknown> | null;
2088
+ has(key: string): boolean;
2089
+ keys(): string[];
2090
+ static ɵfac: i0.ɵɵFactoryDeclaration<ComponentRegistry, never>;
2091
+ static ɵprov: i0.ɵɵInjectableDeclaration<any>;
2092
+ }
2093
+ /**
2094
+ * `console` -- the administration host contract (the platform rule: hosts implement contracts, modules offer entries).
2095
+ *
2096
+ * A module contributes to the console with ONE object, its entry: data the
2097
+ * host reads, never a call the module makes into the host. Six lists, each
2098
+ * optional; an absent list means "nothing here", never an error. The host
2099
+ * assembles the entries (build time today, install time under federation),
2100
+ * refuses collisions by name, and activates only the modules the backend's
2101
+ * manifest says are installed.
2102
+ *
2103
+ * The version is MAJOR.MINOR: a minor adds an optional list or field, a major
2104
+ * changes or removes one. An entry declares the range it was written for
2105
+ * (`^1.2` -- major 1, minor at least 2), checked at build against this
2106
+ * constant and at install against the theme's declaration.
2107
+ */
2108
+ export declare const CONSOLE_CONTRACT: {
2109
+ readonly name: "console";
2110
+ readonly version: "1.0";
2111
+ };
2112
+ export interface ConsoleEntry {
2113
+ /** The backend module id, as `config/modules/<id>`. Activation is by this id. */
2114
+ readonly module: string;
2115
+ readonly contract: 'console';
2116
+ /** The console versions this entry was written for: a caret range over MAJOR.MINOR, e.g. '^1.0'. */
2117
+ readonly range: string;
2118
+ readonly routes?: readonly ConsoleRouteMount[];
2119
+ readonly bindings?: readonly ConsoleBinding[];
2120
+ readonly topbar?: readonly ConsoleTopbarItem[];
2121
+ readonly overlays?: readonly ConsoleOverlay[];
2122
+ readonly panels?: readonly ConsolePanel[];
2123
+ readonly states?: readonly Type<unknown>[];
2124
+ readonly providers?: readonly ConsoleProvision[];
2125
+ }
2126
+ /** What a route's `data` carries for the shell: the sidebar item to light, and whether the page owns its height. */
2127
+ export interface ConsoleNavHint {
2128
+ readonly activeNav?: string;
2129
+ readonly fullHeight?: boolean;
2130
+ /** An intermediate crumb the top bar renders between Home and the page. */
2131
+ readonly breadcrumb?: {
2132
+ readonly label: string;
2133
+ readonly routerLink: string;
2134
+ };
2135
+ /** Which server layout the page renders, for the generic layout pages. */
2136
+ readonly layoutId?: string;
2137
+ }
2138
+ /**
2139
+ * A route mounted under the console's authenticated layout. The host adds
2140
+ * what a module may not decide: the layout component, `canActivate: [authGuard]`,
2141
+ * and a `canMatch` that answers whether the module is installed here. Routes
2142
+ * are lazy: a static component here would put every module's pages in `main`.
2143
+ */
2144
+ export type ConsoleRouteMount = {
2145
+ readonly path: string;
2146
+ readonly children: () => Promise<Routes>;
2147
+ readonly nav?: ConsoleNavHint;
2148
+ readonly providers?: readonly Provider[];
2149
+ } | {
2150
+ readonly path: string;
2151
+ readonly component: () => Promise<Type<unknown>>;
2152
+ readonly nav?: ConsoleNavHint;
2153
+ readonly providers?: readonly Provider[];
2154
+ } | {
2155
+ readonly path: string;
2156
+ readonly redirectTo: string;
2157
+ };
2158
+ /** A `ComponentRegistry` name -> class: names a module OWNS (its server layouts name them) and names it fills in another module's slot (`profile.tab:call`). */
2159
+ export interface ConsoleBinding {
2160
+ readonly name: string;
2161
+ readonly component: Type<unknown>;
2162
+ }
2163
+ /** A tile in the top bar's quick-access strip, rendered in ascending `order`. */
2164
+ export interface ConsoleTopbarItem {
2165
+ readonly id: string;
2166
+ readonly order: number;
2167
+ readonly component: Type<unknown>;
2168
+ }
2169
+ /** Mounted once, inside the authenticated layout, outside the router outlet. */
2170
+ export interface ConsoleOverlay {
2171
+ readonly id: string;
2172
+ readonly component: Type<unknown>;
2173
+ }
2174
+ /**
2175
+ * A dock panel the layout opens and closes: the host renders its toggle in
2176
+ * the top bar and the panel in the dock, and the panel talks back through
2177
+ * {@link ConsolePanelHost} -- not through outputs, which a slot cannot carry.
2178
+ */
2179
+ export interface ConsolePanel {
2180
+ readonly id: string;
2181
+ readonly dock: 'bottom';
2182
+ /** The top-bar toggle: a label (the title), an icon name or a short text, and a key the host binds with Ctrl. */
2183
+ readonly toggle: {
2184
+ readonly label: string;
2185
+ readonly icon?: string;
2186
+ readonly text?: string;
2187
+ readonly key?: string;
2188
+ };
2189
+ readonly component: Type<unknown>;
2190
+ }
2191
+ /**
2192
+ * What a `provide*` line is: environment providers from a library's registry
2193
+ * (editor extensions, viewers, field widgets, file editors), or the
2194
+ * implementation of a single-implementation port, listed as such so the
2195
+ * assembly can refuse two modules implementing one port by name.
2196
+ */
2197
+ export type ConsoleProvision = EnvironmentProviders | Provider | ConsolePortProvision;
2198
+ export interface ConsolePortProvision {
2199
+ readonly port: InjectionToken<unknown>;
2200
+ readonly useExisting: Type<unknown>;
2201
+ }
2202
+ export declare function isPortProvision(p: ConsoleProvision): p is ConsolePortProvision;
2203
+ /** The identity function with the type: an entry file exports data, nothing runs. */
2204
+ export declare function consoleEntry(entry: ConsoleEntry): ConsoleEntry;
2205
+ /**
2206
+ * Whether a caret range over MAJOR.MINOR admits a version: same major, minor
2207
+ * at least the range's. Malformed input admits nothing -- a range that cannot
2208
+ * be read must refuse, never pass.
2209
+ */
2210
+ export declare function satisfiesRange(range: string, version: string): boolean;
2211
+ /** The refusal an assembly raises: one message per collision, all of them, by name. */
2212
+ export declare class ConsoleAssemblyError extends Error {
2213
+ readonly problems: readonly string[];
2214
+ constructor(problems: readonly string[]);
2215
+ }
2216
+ /**
2217
+ * The checks every assembly runs, in one place so the build-time spec, the
2218
+ * bootstrap and a future install-time loader agree: entry ranges against
2219
+ * this contract, and the collision rules of the six lists. Returns the
2220
+ * entries unchanged when nothing is wrong.
2221
+ */
2222
+ export declare function assembleConsole(entries: readonly ConsoleEntry[]): readonly ConsoleEntry[];
2223
+ /**
2224
+ * The host side of `console@1`: what a theme calls to turn the assembled
2225
+ * entries into routes, providers and the lists its shell renders.
2226
+ *
2227
+ * Activation is the backend's: `GET /app-config` carries `ui.modules`, the
2228
+ * modules whose console entry the installer matched against the theme's
2229
+ * declaration. A module in the bundle but not in that list is dormant -- no
2230
+ * route matches, no tile, no overlay; a module in the list but not in the
2231
+ * bundle is reported by name ({@link ConsoleActivation.missing}), never
2232
+ * silently absent.
2233
+ */
2234
+ /** Every entry this build assembled, after {@link assembleConsole}'s checks. */
2235
+ export declare const CONSOLE_ENTRIES: InjectionToken<readonly ConsoleEntry[]>;
2236
+ /**
2237
+ * The port a dock panel talks back through: the layout provides one per
2238
+ * panel it mounts, so the panel never needs an output the slot cannot carry.
2239
+ */
2240
+ export declare abstract class ConsolePanelHost {
2241
+ abstract close(): void;
2242
+ abstract maximize(on: boolean): void;
2243
+ }
2244
+ /** The console modules the manifest says are installed here. */
2245
+ export declare function installedConsoleModules(manifest: ApiManifest | null): ReadonlySet<string>;
2246
+ export declare class ConsoleActivation {
2247
+ private readonly entries;
2248
+ private readonly manifest;
2249
+ readonly installed: import("@angular/core").Signal<ReadonlySet<string>>;
2250
+ /** The entries of installed modules, in assembly order. */
2251
+ readonly active: import("@angular/core").Signal<ConsoleEntry[]>;
2252
+ readonly topbar: import("@angular/core").Signal<readonly ConsoleTopbarItem[]>;
2253
+ readonly overlays: import("@angular/core").Signal<readonly ConsoleOverlay[]>;
2254
+ readonly panels: import("@angular/core").Signal<readonly ConsolePanel[]>;
2255
+ /** Modules the manifest names that this build has no entry for: what a diagnostics page shows by name. */
2256
+ readonly missing: import("@angular/core").Signal<string[]>;
2257
+ isInstalled(module: string): boolean;
2258
+ static ɵfac: i0.ɵɵFactoryDeclaration<ConsoleActivation, never>;
2259
+ static ɵprov: i0.ɵɵInjectableDeclaration<any>;
2260
+ }
2261
+ /**
2262
+ * `canMatch` for a module's mount: the route exists only where the module is
2263
+ * installed. Answered once the manifest is in: on a cold deep link the router
2264
+ * recognises the URL while the initializer is still fetching `/theme/config`
2265
+ * (the two run as parallel initializers), and a synchronous read then found
2266
+ * no module installed, so every pasted module URL fell to the wildcard and
2267
+ * landed on the dashboard (no chunk requested for the mount, the dashboard's
2268
+ * instead). `ready$` is what the auth guard waits on
2269
+ * too, and it fires whether or not the config fetch succeeded.
2270
+ *
2271
+ * !! Then the console's own manifest, when someone is signed in: `ui.modules` is
2272
+ * the console's, not the public config's, and arrives with it
2273
+ * ({@link ConsoleAccessService}). canMatch runs before the layout's auth guard,
2274
+ * which asks the same question, so answering from the public config alone said
2275
+ * "no" to every module once that config stopped carrying them. Nobody signed in:
2276
+ * nothing is asked, the answer is the public config's, and the layout's guard
2277
+ * sends the person to sign in. A refusal merges nothing, so the answer is no.
2278
+ */
2279
+ export declare function consoleModuleInstalled(module: string): CanMatchFn;
2280
+ /**
2281
+ * The children a theme mounts under its authenticated layout for the
2282
+ * assembled entries: one `Route` per mount, lazy as written, `data` from the
2283
+ * entry's nav hint, `canMatch` from the manifest. The theme keeps its own
2284
+ * shape around them (login, the layout, `canActivate: [authGuard]`, the
2285
+ * wildcard).
2286
+ */
2287
+ export declare function consoleChildren(entries: readonly ConsoleEntry[]): Routes;
2288
+ /**
2289
+ * The providers a theme adds for the assembled entries: the store with the
2290
+ * host's states and every module state -- in its strict-CSP mode, which reads
2291
+ * a selector's path without `new Function`, so the admin needs no `'unsafe-eval'`
2292
+ * (every eval its CSP reported was that getter) -- the registry bindings (an
2293
+ * initializer, so they exist before the first render), every module
2294
+ * provision, and {@link CONSOLE_ENTRIES} for the shell. Place it AFTER the
2295
+ * library providers a module's provisions extend (the editor bridge, the
2296
+ * PDF viewer), as the hand-written lines were.
2297
+ */
2298
+ export declare function provideConsole(entries: readonly ConsoleEntry[], options: {
2299
+ readonly hostStates: readonly Type<unknown>[];
2300
+ }): EnvironmentProviders;
2301
+ /**
2302
+ * The admin's Site Selector.
2303
+ *
2304
+ * Stamps `X-CoolMS-Section: <slug>` on outgoing `/api/v1/*` requests when
2305
+ * the admin has picked a section from the Site Selector dropdown. The backend
2306
+ * honours it for AUTHENTICATED requests only -- anonymous traffic cannot pivot
2307
+ * the active section.
2308
+ *
2309
+ * What the header actually reaches, counted rather than intended: exactly two
2310
+ * readers act on it, `CreatePageProcessor` and `CreateCollectionProcessor`,
2311
+ * each choosing WHICH SITE a newly created page or collection lands in -- and,
2312
+ * for a page, that section's default locale and slug-naming policy. Nothing
2313
+ * else is scoped by it. Media spaces list every active section regardless, and
2314
+ * every other reader of `_coolms_section` sits on the public SSR surface,
2315
+ * which resolves from host+path and never sees this header.
2316
+ *
2317
+ * This block used to say the backend "scopes site-specific API providers
2318
+ * (pages, media spaces, etc.)". That described where was heading --
2319
+ * H4/H5, multisite Document and Media, never landed -- not what it does. Left
2320
+ * recorded because a docstring naming an intended destination reads exactly
2321
+ * like one naming a shipped feature, and this one misdescribed the control for
2322
+ * three months.
2323
+ *
2324
+ * Skipped:
2325
+ * - non-API URLs (no section context needed for SSR/static)
2326
+ * - `/auth/*` endpoints (login/refresh are pre-session; the header would
2327
+ * be ignored by the backend anyway, but skipping keeps wire traffic clean)
2328
+ * - requests that already carry the header (programmatic overrides win)
2329
+ */
2330
+ export declare const sectionInterceptor: HttpInterceptorFn;
2331
+ /**
2332
+ * The one fact the section interceptor needs: which site the operator is
2333
+ * currently working in.
2334
+ *
2335
+ * `core` is auth, config, errors and interceptors -- the layer everything else
2336
+ * is built on -- so it must not import a feature. The obvious-looking fix,
2337
+ * moving `SectionState` into core, is the wrong one: sections are a CMS domain
2338
+ * concept, and hoisting domain state into the base layer trades one bad
2339
+ * direction for another. So core declares the little it needs and the module
2340
+ * that owns the state provides it, bound in the composition root.
2341
+ *
2342
+ * Read SYNCHRONOUSLY on purpose. An interceptor decides whether to stamp a
2343
+ * header while building the request; it cannot wait on a stream.
2344
+ */
2345
+ export interface CurrentSectionPort {
2346
+ /** Slug of the active section, or null when the operator picked none. */
2347
+ currentSlug(): string | null;
2348
+ }
2349
+ /**
2350
+ * Optional by design: an application assembled without a Sections module binds
2351
+ * nothing and simply sends no `X-CoolMS-Section` header, which is exactly what
2352
+ * a single-site install wants.
2353
+ */
2354
+ export declare const CURRENT_SECTION: InjectionToken<CurrentSectionPort>;
2355
+ /**
2356
+ * One floating menu open in the whole app at a time: a dropdown, a picker's results, a menu, a date picker. Opening one
2357
+ * closes the one open before it, without moving the focus, wherever the two were opened.
2358
+ */
2359
+ export declare class FloatingMenus {
2360
+ private current;
2361
+ /** This menu has opened: the one open before it, if another, closes. */
2362
+ claim(close: () => void): void;
2363
+ /** This menu has closed. */
2364
+ release(close: () => void): void;
2365
+ /**
2366
+ * Follow a menu's open state from an injection context (a component's or a service's field or constructor): when
2367
+ * it opens it claims the app's one floating menu, and `close` closes it when another opens. `close` must not move
2368
+ * the focus. Gives back the release, which the owner's destruction also runs.
2369
+ */
2370
+ track(open: () => boolean, close: () => void): () => void;
2371
+ static ɵfac: i0.ɵɵFactoryDeclaration<FloatingMenus, never>;
2372
+ static ɵprov: i0.ɵɵInjectableDeclaration<any>;
2373
+ }