@smartbit4all/ng-client 7.0.0 → 7.0.2

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/MIGRATION-7.0.md CHANGED
@@ -24,6 +24,28 @@ Measured across the 12 hosts in scope on 2026-07-28, so you know what to expect:
24
24
  `Smart*Module` imports per host, 1–20 string-keyed providers, `.cssClass =` on an action
25
25
  entry at 72 sites in 7 hosts, `this.uiActionModels =` in 5 hosts, `UseUiAction` in 6.
26
26
 
27
+ **How big is this for *your* host?** Codemod dry-run counts for the five hosts in scope
28
+ (2026-07-30). The first column the codemod applies for you; the second is the list it refuses to
29
+ guess at, which is the real work:
30
+
31
+ | host | mechanical | needs a decision |
32
+ |---|---|---|
33
+ | p014 *(done — the reference)* | 121 | ~100 |
34
+ | p043 | 121 | 96 |
35
+ | app-tournament | 86 | 34 |
36
+ | app-finance-ai | 62 | 18 |
37
+ | app-fitnessmirror | 61 | 14 |
38
+
39
+ The spread is not about host size — all five are within 274–841 source files — but about which
40
+ APIs they happened to use. p043 is p014's twin and repeats its whole decision list; the other
41
+ three have **no `.cssClass =` sites at all**, and their lists are dominated by `smart-modules`,
42
+ the 3-line `moment-adapter` swap, and `zone-js` (which is **optional** — dropping zone.js is not
43
+ required). Take a small one first if you want the process shaken out cheaply.
44
+
45
+ **One number that is now zero: the library install.** p014 was migrated against an unpublished
46
+ build and paid for it in hand-copies, tarballs and `ERESOLVE`. 7.0.0 is on npm, so a host today
47
+ writes `"@smartbit4all/ng-client": "^7.0.0"` and runs `npm i`. None of that thread applies to you.
48
+
27
49
  ## Migrating a host: the codemod
28
50
 
29
51
  It lives in the `platform-angular2` repository — `tools/ng-client-7-codemod/` — and you run
@@ -281,7 +303,7 @@ The replacements, for what the hosts actually import:
281
303
  | `DialogService` | `MatDialog`. There is **no `header` option**: put `<h2 mat-dialog-title>` in the component |
282
304
  | `DynamicDialogRef` | `MatDialogRef` — `afterClosed()` replaces `onClose` |
283
305
  | `DynamicDialogConfig` | `MAT_DIALOG_DATA` for the data, `MatDialogRef` for the rest |
284
- | `PrimeNGConfig` | **delete it.** `setTranslation()` of day and month names is already covered by `MAT_DATE_LOCALE` + `SmartDateFnsAdapter` — the date-fns `hu` locale carries both the names and the Monday week start (see [Dates](#dates-moment--date-fns-and-the-timezone-contract-phase-38)) |
306
+ | `PrimeNGConfig` | **delete it.** `setTranslation()` of day and month names is already covered by `MAT_DATE_LOCALE` + `SmartDateFnsAdapter` — the date-fns `hu` locale carries both the names and the Monday week start. **Confirmed on a running host** (p014, 2026-07-29, against a live backend): the datepicker opens on `2026. JÚL.` with `H K Sz Cs P Sz V`, i.e. Hungarian and Monday-first, exactly what the deleted `firstDayOfWeek: 1` + `dayNamesMin` used to buy. See [Dates](#dates-moment--date-fns-and-the-timezone-contract-phase-38) |
285
307
  | `MessageService` | `MatSnackBar` |
286
308
  | `ConfirmationService` | the library's `UiActionConfirmDialogService` |
287
309
  | `MenuItem` | the library's `UiActionModel`, or a plain `<mat-menu>` item |
@@ -675,6 +697,36 @@ functioning in TypeScript 7.0"). Two ways out:
675
697
  strict, so nothing changed. If your host was not strict, the `ng update`
676
698
  migration adds `"strictTemplates": false` to keep it that way.
677
699
 
700
+ ### The third-party packages the library does *not* own (Phase 2)
701
+
702
+ Every hop section above lists the library's own peer dependencies. Your host almost
703
+ certainly carries packages the library never sees, and those have their own Angular
704
+ peer ceilings — each one can stop a hop dead. Measured on p014 (2026-07-29), which
705
+ went 17 → 22 with the library still installed:
706
+
707
+ - **`@swimlane/ngx-charts` needs a ladder of its own**: `20 → 22 → 22 → 23 → 24 → 25`
708
+ across the five hops. At the Angular 21 hop it peer-caps the CDK, and because
709
+ `ng update`'s own `npm` step is **not** `--force`d (even when you passed `--force`
710
+ to `ng update`), the install fails there while `package.json` has already been
711
+ written correctly. The fix both times was to redo the install by hand, not to
712
+ re-run the update. `p043` and `app-tournament` both carry ngx-charts `^20.4.1`
713
+ and will hit this; `app-fitnessmirror` and `app-finance-ai` do not.
714
+ - **`ngx-extended-pdf-viewer` moved to `.mjs`** at the 21 hop and stopped shipping
715
+ `pdf-3.10.560-es5.min.js`. If your `angular.json` names that file under `scripts`
716
+ or `assets`, the build fails on a missing file rather than on anything Angular.
717
+ - **`karma` and `@angular/build`**: `@angular/build` 22 declares
718
+ `peerOptional karma@^6.4.0`. A host pinned to `~6.3.0` gets a wall of
719
+ `npm warn ERESOLVE overriding peer dependency` — **warnings, exit code 0**, so it
720
+ is not blocking. It becomes a *hard* install failure the moment `@angular/build`
721
+ is a direct devDependency rather than a nested one, which is what happened in the
722
+ library workspace. `karma@~6.4.4` clears it.
723
+
724
+ The general shape: **`ng update` needs `--force` at every hop** (the library and
725
+ PrimeNG both peer-cap at Angular 17 until the very end), and `--force` covers the
726
+ Angular schematics but not the `npm install` they trigger. When that install fails,
727
+ check `package.json` before assuming the hop did nothing — it is usually already
728
+ correct.
729
+
678
730
  ### Housekeeping (Phase 3.0)
679
731
 
680
732
  #### The dialog's built-in Ok/Cancel buttons are gone
@@ -946,7 +998,7 @@ record behind it is ADR-0005 in the `platform-angular2` working copy.
946
998
  |---|---|
947
999
  | `this.useQueryLists = true;` | The property is gone. Its setter rejected anything but `true`, so every branch behind it was unreachable — this was a no-op that logged a warning. |
948
1000
  | `[parentSmartComponent]="this"` on `<smart-component-layout>` | The input is gone; the layout injects the client. `strictTemplates` reports leftovers as **NG8002**. |
949
- | `this.addForm(id, smartForm, formComponent)` | Gone. A `<smartform>` that displays the client's model registers itself. Two call styles existed; where the return value was used, it was the `smartForm` argument — use that. |
1001
+ | `this.addForm(id, smartForm, formComponent)` | Gone. A `<smartform>` that displays the client's model registers itself. Two call styles existed; where the return value was used, it was the `smartForm` argument — use that (which makes those lines self-assignments, so they just go). **Delete the scaffolding around the call too**: in p014 the 21 calls left behind 9 empty `if (this.formX) { }` guards and 3 `new Promise((r) => setTimeout(r, 500)).then(() => { })` wrappers whose only content had been the registration. The compiler does not complain about either. |
950
1002
  | `this.widgets.delete(…)` / `this.widgets.set(…)` / `this.formWidgets…` | The maps are gone (they were only written by the legacy path and read by nothing). |
951
1003
  | the 4th argument of `addGrid(smartGrid, options, useAsDefaultGrid, componentReference)` | `addGrid()` keeps the options and the default-grid role; the services it used to copy into the grid model (`uiActionService`, `uiActionDescriptorService`, `serviceToUse`, `viewContextService`) are the grid's own DI job now. |
952
1004
  | `override getSmartXxxQL()` (e.g. the two `throw new Error` overrides in a `FilterPageService`) | The eight abstract getters are gone from `SmartComponentApiClient`. |
@@ -1304,6 +1356,20 @@ npm install @angular/material-date-fns-adapter@^22.0.0 date-fns@^4
1304
1356
  If your own code imports moment for something unrelated, keep it — nothing here forces its
1305
1357
  removal, only the adapter's.
1306
1358
 
1359
+ **But check *how* it imports moment.** `import * as moment from 'moment'` stops being callable
1360
+ under `moduleResolution: "bundler"`, which the Angular 20 hop turns on: moment is an
1361
+ `export =` module, and a namespace import of one is not a callable value. The symptom is
1362
+ **`TS2349: This expression is not callable`** on every `moment(...)` call, and it arrives at the
1363
+ Angular 20 hop rather than at this step. Two ways out:
1364
+
1365
+ - `esModuleInterop: true` plus `import moment from 'moment'` — correct, but it changes how every
1366
+ CommonJS import in the app resolves, which is a wide blast radius for one file.
1367
+ - Replace the calls. Worth checking first how much moment is actually doing: in p014 the three
1368
+ surviving calls were `moment(new Date()).toDate()` (i.e. `new Date()`) and two moments compared
1369
+ with `<=` (`Date` compares through `valueOf()` identically). All three became plain `Date`s, and
1370
+ **nothing under `src/` imported moment any more** — so the `npm uninstall … moment` above was
1371
+ right for that host after all, just for a reason nobody predicted.
1372
+
1307
1373
  #### 2. Leave your `MAT_DATE_LOCALE` provider alone
1308
1374
 
1309
1375
  If you have this line — p014 and p043 both do — **keep it as it is**:
@@ -1399,6 +1465,21 @@ not less: `2026.07.28.`, `2026.07.28`, `2026.7.28.`, `2026.7.28` and ISO-8601 ar
1399
1465
  The month picker is unchanged (`07/2026`), and grid/table date columns were never affected —
1400
1466
  `SmartDatePipe` and friends extend Angular's own `DatePipe` and never used moment.
1401
1467
 
1468
+ **Verified on a running host** (p014, 2026-07-29, live backend, `Europe/Budapest`). Picking
1469
+ 2026-07-15 in a `Kezdődátum` field gave, end to end:
1470
+
1471
+ | | |
1472
+ |---|---|
1473
+ | input | `2026.07.15.` |
1474
+ | widget value | `instanceof Date` — not a moment, not a luxon `DateTime` |
1475
+ | `JSON.stringify` of that value | `"2026-07-14T22:00:00.000Z"` |
1476
+ | `getHours()` | `0` |
1477
+
1478
+ That third row is the whole contract in one line: the value's `toJSON()` **is** the wire format
1479
+ (see §4), and it is zulu, while the screen and `getHours()` stay local — 15 July 00:00 CEST is
1480
+ 14 July 22:00 UTC. A grid column on the same host rendered `2026.04.20 0:03`, confirming the
1481
+ untouched pipe path.
1482
+
1402
1483
  ### HTTP: the library no longer forces the XHR backend (Phase 3.8)
1403
1484
 
1404
1485
  `provideSmartNgClient()` used to pass `withXhr()` to its internal `provideHttpClient()` call,