@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.
package/CHANGELOG.md ADDED
@@ -0,0 +1,274 @@
1
+ # Changelog
2
+
3
+ All notable changes to `@coolms/core-angular` are recorded here.
4
+
5
+ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
6
+
7
+ This file starts at the version named below, which is what the registry
8
+ currently serves. Earlier alphas are deliberately not reconstructed: entries are written
9
+ in the same commit as the work they describe, and inventing the ones that
10
+ predate this file would be a worse record than not having them.
11
+
12
+ ## 2.0.0-alpha.10 - 2026-12-05
13
+
14
+ ### Added
15
+
16
+ - A grid's column layout kept as shares of its width: `UserPreferencesService.setColumnFractions(gridId, fractions)`
17
+ stores each column's share of the grid's width (`columnFractions`, the visible columns' shares summing to 1), so
18
+ another window size keeps the proportions. It replaces the older pixel widths (`columnWidths`, sent empty, as a reset
19
+ does); a reset clears the shares too.
20
+
21
+ ### Fixed
22
+
23
+ - A preference change survives a reload within the send delay: each entry carries when it changed, kept locally and
24
+ sent with the change. Pending changes also go when the page is hidden or left (fetch with keepalive and the sign-in
25
+ token). On load, an entry changed here after the server's copy keeps its local value and is sent; otherwise the
26
+ server's value wins.
27
+ - A change made while a retry waits no longer replaces the change times already pending, and a failed send puts its
28
+ times back with its entries.
29
+
30
+ ### Security
31
+
32
+ - cross-spawn 7.1.2 in the lockfile (a development dependency), clearing a new critical advisory.
33
+ - minimatch 11.0.10 in the lockfile (a development dependency), clearing a new low advisory.
34
+
35
+ ## 2.0.0-alpha.9 - 2026-11-30
36
+
37
+ ### Added
38
+
39
+ - `FloatingMenus`: one floating menu open in the whole app at a time. A floating element (a dropdown, a picker's
40
+ results, a menu) claims it while open, and opening another closes it without moving the focus. `track(open, close)`
41
+ follows an open state from an injection context and releases on destroy; `claim(close)` and `release(close)` serve
42
+ code without one.
43
+
44
+ ### Changed
45
+
46
+ - The elevation state's ended reasons include `factor_reset`: the person's second factor was reset on the server, which ends every live elevation they hold (`ElevationEndedReason`).
47
+ - `NaviGraphService` runs the shared condition cases (design tokens' `contract/conditions.json` at v0.28.0, pinned beside its spec with its origin): every case through the evaluator, unchanged. The `cn` operator (a list holding the value, strictly equal, never a substring); an `and` or `or` whose value is not a list never holds, as an unknown operator does not.
48
+
49
+ ## 2.0.0-alpha.8 - 2026-11-21
50
+
51
+ ### Added
52
+
53
+ - `IdentityApiClient.getDeclaredSettings(host?)`: the person's settings as declared, each key with the value in force and
54
+ the person's own (null when they set none), so a reader can tell a chosen value from the installation's.
55
+
56
+ ## 2.0.0-alpha.7 - 2026-11-17
57
+
58
+ ### Changed
59
+
60
+ - **A failure says the server's words only when the server declared the problem.** `ErrorHandlerService.humanize()`
61
+ now follows the components contract's rule: a problem with a declared type (anything but `about:blank` or a
62
+ framework's own `/errors/5NN`) says its `detail` as given, whatever the status, or "Not available right now" when it
63
+ gives none; a validation refusal (422 with `violations`) says its first field message; anything else, an undeclared
64
+ problem, a network failure or a thrown error, says "Something went wrong. Try again." It no longer words a status
65
+ ("Resource not found.", "Session expired. Please sign in again." and the others are gone) and no longer reads
66
+ `hydra:description` or `message`. A caller that showed those sentences now shows the server's or the generic one.
67
+ - **Interface preferences are saved one entry at a time.** `UserPreferencesService` sends each changed entry with all
68
+ of its fields, as the server now keeps them, and reads the server's 422 (`/errors/identity/preferences-refused`)
69
+ for an entry it cannot store. A save that failed for any other reason (offline, a 5xx, a timeout) is sent again,
70
+ instead of waiting for the next change.
71
+
72
+ - **Only a refusal of entry signs out.** The server answers a token sent to the other interface with 403
73
+ `/errors/identity/wrong-interface` (`WRONG_INTERFACE`), and keeps `/errors/identity/audience-not-granted` for an
74
+ account that may no longer enter. `ConsoleAccessService` read every 403 on the admin manifest as a refusal, and the
75
+ guard signed the person out; now only `audience-not-granted` is `refused` (`audience-required` still asks for a new
76
+ sign-in), and a token for the other interface, or any other 403, is no answer: not kept, nobody signed out. The
77
+ start-up session check (`AppInitService`) no longer refreshes and ends a session on such a 403 either:
78
+ `sessionEndsOn(error)` says which refusals may. An older server's bare 403 at the legacy manifest address is no
79
+ longer a refusal.
80
+
81
+ - **The theme and the accent are read from the person's `appearance` settings.** `ThemeService` reads
82
+ `appearance.theme` and `appearance.accentColor` from `GET /auth/me/settings`, the section the server declares for
83
+ them; it no longer reads them from `preferences`.
84
+ - **One settings read for the callers that ask together.** `IdentityApiClient.getSettings()` shares a read in flight with every caller that asks meanwhile: the services reading their own section of the person's settings at start-up (calendar, calls) made one request each. A call after the read has answered reads again, and a failed read is not kept.
85
+ - **`cms-loader` turns the state component's spinner** (design-tokens' `--cms-spinner-*`, each with its value as the
86
+ fallback) in place of the drawn exclamation mark, so every wait shows the one spinner `cms-state` turns. Its inputs
87
+ (`label`, `inline`, `overlay`) and `--cms-loader-size` are unchanged; under reduced motion it breathes. A spec now
88
+ covers it.
89
+
90
+ - **A person's refused write opens the elevation prompt, and is sent again
91
+ once they elevate.** A write refused for want of elevation (a stamped 403)
92
+ holds the request and opens the prompt above whatever the person is in. An
93
+ edit dialog stays open beneath it, with its input. On a grant, the write is
94
+ sent once more and the caller receives that answer. If the session is
95
+ already elevated, it is sent once more without asking. A decline tells
96
+ `ELEVATION_NOTICE`, naming the action, and hands back the 403. The repeat
97
+ passes no prompt a second time. Reads and background requests still open
98
+ nothing.
99
+
100
+ ### Added
101
+
102
+ - **The shared rule for a failure's words**, exported from `errors/problem-words`: `refusalWords(error)`,
103
+ `declaredProblemOf`, `declaredTypeOf`, `problemOf`, `isRefusal`, `sentenceOf`, and the two sentences
104
+ `SOMETHING_WENT_WRONG` and `NOT_AVAILABLE`, so a host reads the rule from one place. The elevation service names the
105
+ refusal types a prompt acts on: `ELEVATION_CODE_REQUIRED_TYPE` and `ELEVATION_RETRY_TYPES`.
106
+ - **`ApiManifest.modules`**: the modules' own blocks of the manifest, by module name, each a record the client reads
107
+ by the keys it knows; `{}` when no module has a block.
108
+ - **A sign-in can name its application's audience.** `AUTH_AUDIENCE` (default `null`) is the application a sign-in is
109
+ for, typed `AuthAudience` (`'admin' | 'workspace'`); when provided, `IdentityApiClient.login()` sends it as
110
+ `audience`. The admin reads the two refusals of entry by audience, `/errors/identity/audience-not-granted` and
111
+ `/errors/identity/audience-required`.
112
+ - **The identity manifest names the signed-in sessions' addresses.**
113
+ `sessionsUrl` lists the live sign-ins; `sessionUrl` (`{sessionId}`) ends
114
+ one; `userSessionsUrl` (`{id}`) ends every sign-in of one account. All
115
+ three are optional: a server that does not send them has no sessions page.
116
+
117
+ ### Fixed
118
+
119
+ - **The store needs no `'unsafe-eval'`.** `provideConsole` sets up NGXS with `strictContentSecurityPolicy`, so a
120
+ selector's path is read with its plain getter, not one built with `new Function`.
121
+
122
+ ## 2.0.0-alpha.6 - 2026-10-22
123
+
124
+ ### Changed
125
+
126
+ - **Breaking: `engines.node` names exactly the Node lines CI runs.** It moves from
127
+ `^22.22.3 || ^24.15.0 || >=26` to `^22.22.3 || ^24.15.0 || ^26.0.0`: Node 27
128
+ and later are not declared until CI runs them. Within each line the floor is
129
+ the highest one any package in the lockfile declares. CI checks both, from
130
+ the matrix and the lockfile. The published code does not change.
131
+
132
+ ### Added
133
+
134
+ - **`ELEVATION_ACTION`, `ElevationService.canPrompt` and `apiBase`.** A caller
135
+ can name a write in the person's words ("Saving the menu entry") for the
136
+ elevation prompt and notice. `ElevationPromptRequest.action` and the notice's
137
+ optional second argument carry it. Without it, the action is the method's
138
+ verb and the resource the URL names ("Saving navi nodes").
139
+
140
+ - **Navigation nodes carry the server's access state.** `NaviGraphNodeFlat.access`
141
+ is `'allowed'` or `'elevate'`. `'elevate'` marks a node that a member of admin
142
+ can open once the session is elevated; the admin shows it with a lock instead
143
+ of hiding it. A server that does not send the field is read as `'allowed'`
144
+ (`naviAccessOf`), so nothing changes against it.
145
+ - `NaviGraphService.loadAdminNav(url, { fresh: true })` asks the server again
146
+ instead of answering from the per-URL cache: the answer differs before and
147
+ after a grant, so a change of elevation must re-ask.
148
+ - **`ElevationState.mayElevate`** and `ElevationService.mayElevate()`: whether
149
+ this account may elevate at all, as the server answered it. Absent reads as
150
+ false.
151
+
152
+ ## 2.0.0-alpha.5 - 2026-10-09
153
+
154
+ ### Changed
155
+
156
+ - **The elevation prompt opens only when a person asks for it.** A 403 that
157
+ the server stamps `X-Elevation-Required` no longer opens the prompt by
158
+ itself. `elevationInterceptor` now:
159
+ - leaves a refused read (`GET`, `HEAD`, `OPTIONS`: a page loading, a poll)
160
+ to its caller, which shows its own state;
161
+ - leaves a refused background request alone (see `BACKGROUND_REQUEST`);
162
+ - tells `ELEVATION_NOTICE` when a write a person made is refused, and hands
163
+ the 403 back at once. The application shows the refusal with an Elevate
164
+ button, and only that click opens the prompt (`ElevationService.offerFor`).
165
+ The refused action is not repeated by itself.
166
+ - `ErrorHandlerService.humanize()` says "This needs an elevated session." for
167
+ a stamped refusal, and "You don't have access to this." in place of the
168
+ framework's bare "Access Denied." for any other 403. A sentence the server
169
+ wrote for the refused action is kept.
170
+ - `ConfigService` no longer caches a failed read, so a page that was refused
171
+ reads again after the person elevates.
172
+ - **The console opens for an account the server grants it to.** Once the
173
+ session is settled, the auth guard asks for the admin's endpoint map: a 200
174
+ merges it into the app config, and a 403 signs this sign-in out (on the
175
+ server too) and returns to the sign-in page, which says the account has no
176
+ access to the console. A failure to ask is not an answer: the console opens,
177
+ and each of its requests is still decided by the server.
178
+ - The map is read at `/api/v1/admin/manifest`, and at the older
179
+ `/api/v1/console/manifest` only when the server answers 404 there.
180
+ - An answer is kept only for the sign-in that asked. Nothing is asked while
181
+ nobody is signed in.
182
+ - A module route waits for the map when someone is signed in.
183
+ - The realtime connection opens after this check, and a refused sign-in
184
+ opens none.
185
+ - The sign-in page shows its answer (a wrong password, or the console's
186
+ refusal) as soon as it arrives, without waiting for the person to type.
187
+
188
+ ### Added
189
+
190
+ - `BACKGROUND_REQUEST`: an `HttpContextToken` marking a request no person
191
+ made. The realtime connection and subscription tokens and the preferences
192
+ sync carry it.
193
+ - `ELEVATION_NOTICE` and `ElevationNoticePort`: how an application is told
194
+ that a person's write was refused for want of elevation.
195
+ - `isElevationRefusal(err)`: the one test for a stamped 403.
196
+ - `ConsoleAccessService` in the public API.
197
+
198
+ ## 2.0.0-alpha.4 - 2026-09-27
199
+
200
+ ### Changed
201
+
202
+ - `ElevationService`: an elevation whose `expiresAt` is already past is
203
+ reported as expired **when its state is read** -- `state()` and
204
+ `elevated()` are plain accessors that compare against the clock and demote
205
+ the stored state on the spot -- rather than when a timer fires. A timer only
206
+ reschedules the announcement; the read does the work, which is what a
207
+ suspended tab, a moved clock or a missed tick could never defeat. The
208
+ service also reconciles on `visibilitychange` and `focus`, coalesced to one
209
+ refresh per two seconds.
210
+
211
+ ### Added
212
+
213
+ - `ElevationService` and the rest of the elevation client in the public API:
214
+ `elevationInterceptor`, `BYPASS_ELEVATION`, `ELEVATION_REQUIRED_HEADER`,
215
+ `ELEVATION_PROMPT` and the three `ELEVATION_WARNING_*` reasons. 2.0.0-alpha.3
216
+ did not export them, so a package importing `ElevationService` from the
217
+ published build failed to compile (TS2305) -- the reason this release was cut.
218
+ Measured on the bundles: 30 runtime exports in alpha.3, 51 here, none removed.
219
+ - `console@1`, the administration host contract (the platform rule: hosts implement contracts, modules offer entries):
220
+ `ConsoleEntry` and the six lists a module contributes as data (`routes`,
221
+ `bindings`, `topbar`, `overlays`, `panels`, `states`, `providers`),
222
+ `consoleEntry()` for an entry file that exports one object and runs nothing,
223
+ `assembleConsole()` which refuses a range this contract does not meet and
224
+ every collision (a path, a binding name, a top-bar id, a port claimed by two
225
+ modules) by name, and the host side a theme calls: `consoleChildren()` (one
226
+ lazy child per mount, `canMatch` from the manifest), `provideConsole()` (the
227
+ store with the host's and the modules' states, the registry bindings as an
228
+ initializer, every provision), `ConsoleActivation` (what the backend's
229
+ `ui.modules` says is installed: the tiles, overlays and panels to render,
230
+ and the modules named but missing from the build), and `ConsolePanelHost`,
231
+ the port a dock panel talks back through. `ApiManifest.ui` mirrors the
232
+ backend's section. The mount's `canMatch` answers once `AppInitService`
233
+ signals ready: the router recognises a pasted module URL while the
234
+ initializer is still fetching the manifest, and a synchronous read there
235
+ sent every cold deep link to the dashboard.
236
+ - Declares `bugs` so a page imported from this package, and the catalogue,
237
+ know where a correction is filed. The registry filled the gap from GitHub when
238
+ the manifest was silent; the declared field is the one that holds on any
239
+ registry.
240
+
241
+ **`DocumentApiManifest` gained `spacesAvailableUrl` and `spaceEnablementUrl`.**
242
+ Optional, mirroring the backend manifest DTO. They let the Documents space
243
+ accordion offer an *Add space* control instead of only ever losing entries when
244
+ a site is not enabled for documents.
245
+
246
+ Both optional, so a client built against an older backend simply hides the
247
+ control rather than showing one that cannot work.
248
+
249
+ ### Fixed
250
+
251
+ - The README named a package that does not exist (`@coolms/admin-ui-angular`),
252
+ said the package installs no toolchain of its own (it does, from its lockfile,
253
+ outside the workspace), said it was built against Angular 19 (it is built with
254
+ 22 and peers on ^22), listed `@angular/cdk` as a peer (it is not one), and said
255
+ `latest` waits for a stable release (npm points it at the newest alpha).
256
+
257
+ ## 2.0.0-alpha.3 -- 2026-09-03
258
+
259
+ **A pre-release, carrying no compatibility promise.** Published under the
260
+ `alpha` dist-tag.
261
+
262
+ The client runtime the other CoolMS Angular packages sit on: session and token
263
+ refresh with a single-flight coordinator, the boot manifest and application
264
+ config state, theme and user preferences, the error handler, the HTTP
265
+ interceptors, and the wire types the CoolMS API emits.
266
+
267
+ It is the bottom of the layer graph -- it has no `@coolms` peers of its own, and
268
+ no runtime dependencies at all. Angular, NGXS and RxJS are peers.
269
+
270
+ ### Fixed
271
+
272
+ - The Status section told readers the package was not published to npm, which
273
+ it served from its own npm page. It now states what does not change when a
274
+ version is tagged.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Dmitry Popov
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,80 @@
1
+ # @coolms/core-angular
2
+
3
+ The CoolMS client runtime for Angular — everything a CoolMS front end needs
4
+ before it has any UI:
5
+
6
+ - **Session** — login, token refresh with a single-flight coordinator,
7
+ cross-tab sync, route guards, and a sign-in page.
8
+ - **Boot and configuration** — the API manifest, app config state, and the
9
+ `ConfigService` that reads layout/dialog/form/datagrid configuration.
10
+ - **Theme and user preferences** — one preference store (`coolms_ui_prefs`)
11
+ covering grids, panels, page state, navigation and the terminal.
12
+ - **Cross-cutting** — the error handler, the auth and section HTTP
13
+ interceptors, the navigation graph, and entity search.
14
+ - **Wire types** — the shapes the CoolMS API emits, including the
15
+ `form-render` contract.
16
+
17
+ It is not admin-specific: nothing here is admin chrome. It is also not a
18
+ general-purpose Angular library — every endpoint it speaks is a CoolMS one, so
19
+ it is only useful against a CoolMS backend.
20
+
21
+ ## Layering
22
+
23
+ The bottom of the CoolMS Angular packages: it has no `@coolms` peers of its own.
24
+ The UI kit (`@coolms/ui-angular`) and the feature packages -- the editors, the
25
+ viewers and the rest of `@coolms/*-angular` -- build on it; nothing here depends
26
+ on them.
27
+
28
+ The reason this is a package rather than application code is federation. The UI
29
+ kit and every federated remote need the session, config, error handling and
30
+ preferences **at runtime**, resolved to a single `singleton` instance — and a
31
+ remote cannot import from its host.
32
+
33
+ ## Public surface
34
+
35
+ `src/public-api.ts` is the whole API. Nothing outside the package may deep-link
36
+ past it, and the consuming application enforces that with a lint rule, so the
37
+ barrel is a real contract rather than a convenience re-export. A symbol that is
38
+ not exported there is internal; exporting one is a deliberate decision about the
39
+ package API.
40
+
41
+ ## Building
42
+
43
+ ```
44
+ npm run build
45
+ ```
46
+
47
+ Produces `dist/` — FESM 2022 bundles plus type definitions, compiled in Angular's
48
+ *partial* mode so the consuming application's own compiler finishes the job. That
49
+ is what keeps a build made with one Angular 22 release working in an application
50
+ on a later one within the peer range. `@angular/*`, `@ngxs/store` and `rxjs` stay external, as peers.
51
+
52
+ On its own -- a clone, or CI -- it installs its toolchain (`ng-packagr`, the
53
+ Angular compiler, TypeScript) from its committed lockfile, and that is how a
54
+ published build is made. Inside the CoolMS workspace its `node_modules` is instead
55
+ a relative symlink to the admin application's, so exactly one `@angular` tree is
56
+ in play while the admin consumes this package from source: a second copy would
57
+ give two type identities for the same class.
58
+
59
+ ## Tests
60
+
61
+ This package has no test runner of its own, so CI finds no tests in it: only typecheck, lint and build guard it here, and a check of "the same number of tests before and after" proves nothing for it. Its 13 spec files run in the admin suite of [coolms/theme-admin](https://github.com/coolms/theme-admin), which compiles this package from source. A change here is tested there, not by this repository's CI.
62
+
63
+ ## Status
64
+
65
+ A pre-release: the shape is still moving and it carries no compatibility
66
+ promise. Published under the `alpha` dist-tag. Until a stable release exists, `latest`
67
+ points at the newest alpha as well -- npm set it on the first publish -- so a bare
68
+ `npm install @coolms/core-angular` gets a pre-release.
69
+
70
+ The CoolMS admin application consumes it from source via a TypeScript path
71
+ mapping rather than from the registry, so the published build and the one the
72
+ admin runs are produced the same way but resolved differently.
73
+
74
+ ## Requirements
75
+
76
+ Angular (`common`, `core`, `forms`, `router`), NGXS and RxJS are peers; the supported ranges are declared in `package.json`, which is what an install actually checks.
77
+
78
+ ## Licence
79
+
80
+ MIT — see [LICENSE](LICENSE).