@dsivd/prestations-ng 18.0.0-beta.2 → 18.0.0-beta.20

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 CHANGED
@@ -19,6 +19,21 @@
19
19
  - [foehn-table.component.ts](projects/prestations-ng/src/foehn-table/foehn-table.component.ts)
20
20
  - `[list]` attribut has been removed. Use `[model]` instead.
21
21
 
22
+ ## [17.10.10]
23
+
24
+ ### Fixed
25
+
26
+ - [redirect.component.ts](projects/prestations-ng/src/sdk-redirect/redirect.component.ts)
27
+ - fixed interval destruction
28
+ - now use `window.location.reload()` instead of `window.location.href = ''`
29
+
30
+ ## [17.10.9]
31
+
32
+ ### Fixed
33
+
34
+ - [foehn-autocomplete.component.ts](projects/prestations-ng/src/foehn-autocomplete/foehn-autocomplete.component.ts)
35
+ - Added a `setTimeout` to avoid having a value displayed on screen when NULL is set
36
+
22
37
  ## [17.10.8]
23
38
 
24
39
  ### Fixed
@@ -2936,18 +2951,17 @@ data: {
2936
2951
  - [foehn-input-address.component.html](projects/prestations-ng/src/foehn-address/foehn-input-address.component.html)
2937
2952
 
2938
2953
  - added some inputs to affect the presence of (facultatif) on every label :
2939
-
2940
- - `@Input() countryRequired = true`
2941
- - `@Input() swissNpaLocalityRequired = true`
2942
- - `@Input() streetRequired = true`
2943
- - `@Input() streetNumberRequired = false`
2944
- - `@Input() foreignZipCodeRequired = true`
2945
- - `@Input() foreignLocalityRequired = true`
2946
- - `@Input() foreignStreetRequired = true`
2947
- - `@Input() foreignStreetNumberRequired = false`
2948
- - `@Input() postOfficeBoxTextRequired = false`
2949
- - `@Input() addressLine1Required = false`
2950
- - `@Input() addressLine2Required = false
2954
+ - `@Input() countryRequired = true`
2955
+ - `@Input() swissNpaLocalityRequired = true`
2956
+ - `@Input() streetRequired = true`
2957
+ - `@Input() streetNumberRequired = false`
2958
+ - `@Input() foreignZipCodeRequired = true`
2959
+ - `@Input() foreignLocalityRequired = true`
2960
+ - `@Input() foreignStreetRequired = true`
2961
+ - `@Input() foreignStreetNumberRequired = false`
2962
+ - `@Input() postOfficeBoxTextRequired = false`
2963
+ - `@Input() addressLine1Required = false`
2964
+ - `@Input() addressLine2Required = false`
2951
2965
 
2952
2966
  ## [11.1.4]
2953
2967
 
@@ -3443,7 +3457,7 @@ not dead
3443
3457
 
3444
3458
  ### Updated
3445
3459
 
3446
- - [public_api.ts](projects/prestations-ng/src/public_api.ts)
3460
+ - [public-api.ts](projects/prestations-ng/src/public-api.ts)
3447
3461
  - Add FoehnPageCounterComponent export
3448
3462
  - `@fortawesome/free-solid-svg-icons` and `@fortawesome/fontawesome-free` libraries to 5.11.2
3449
3463
 
@@ -5167,8 +5181,8 @@ If you've added an "Obligatoire" label somewhere in your prestation, please chan
5167
5181
  </foehn-list>
5168
5182
  `
5169
5183
  ```
5170
- - itemsPerPage is 10, if none provided
5171
- - trackBy is done on index, if no trackBy function is provided
5184
+ - itemsPerPage is 10, if none provided
5185
+ - trackBy is done on index, if no trackBy function is provided
5172
5186
 
5173
5187
  ## [7.20.0] - 2018.08.29
5174
5188
 
@@ -92,7 +92,6 @@ You can replace the content of your `.eslintrc.json` with the following `json`.
92
92
  '/karma.conf.js',
93
93
  '/.eslintrc.json',
94
94
  '/tsconfig*.json',
95
- '/src/tsconfig*.json',
96
95
  '/src/main.ts',
97
96
  '/src/typings.d.ts'
98
97
  ],
@@ -371,7 +370,7 @@ You can replace the content of your `.eslintrc.json` with the following `json`.
371
370
  {
372
371
  files: ['src/**/*.spec.ts', 'src/**/*.d.ts'],
373
372
  parserOptions: {
374
- project: 'src/tsconfig.spec.json'
373
+ project: 'tsconfig.spec.json'
375
374
  },
376
375
  extends: ['plugin:jasmine/recommended'],
377
376
  plugins: ['jasmine'],
package/UPGRADING_V18.md CHANGED
@@ -22,6 +22,7 @@ Remove your `resolutions` in `package.json` before starting : if you have `resol
22
22
  In the next commands, commit before each ng update.
23
23
 
24
24
  ```bash
25
+ npm install
25
26
  ng update @angular/core@17 @angular/cli@17
26
27
  ng update @dsivd/prestations-ng@17
27
28
 
@@ -30,7 +31,10 @@ ng update @angular/core@18 @angular/cli@18
30
31
  ```
31
32
 
32
33
  When asked the question "Select the migrations that you'd like to run", accept "use-application-builder" by hitting "Space" key then "Enter".
33
- Then fix provideHttpClient withXsrfConfiguration by modifying your `app.module.ts` and adding:
34
+
35
+ #### Fix provideHttpClient withXsrfConfiguration
36
+
37
+ Modify your `app.module.ts` and add:
34
38
  `{
35
39
  cookieName: 'XSRF-TOKEN',
36
40
  headerName: 'X-XSRF-TOKEN'
@@ -48,10 +52,34 @@ providers: [
48
52
  ]
49
53
  ```
50
54
 
55
+ #### Add an empty "browser" to your output path in angular.json
56
+
57
+ ```diff
58
+ {
59
+ "projects": {
60
+ "[YOUR_PROJECT_NAME]": {
61
+ "architect": {
62
+ "build": {
63
+ "options": {
64
+ "outputPath": {
65
+ - "base": "dist"
66
+ + "base": "dist",
67
+ + "browser": ""
68
+ }
69
+ ```
70
+
71
+ Continue with your migration:
72
+
51
73
  ```bash
52
74
  ng update @fortawesome/angular-fontawesome@0.15 --force
53
75
  ```
54
76
 
77
+ **NB: When using `@angular/cdk` in your project**
78
+
79
+ ```bash
80
+ ng update @angular/cdk@18
81
+ ```
82
+
55
83
  ### Updating to Angular 19
56
84
 
57
85
  `prestations-ng` **v18+** now supports **Angular v19**.
@@ -78,7 +106,23 @@ When asked the question "Select the migrations that you'd like to run", accept "
78
106
 
79
107
  ```bash
80
108
  ng update @angular-eslint/builder@19
109
+ ```
110
+
111
+ **NB: When using `@angular/cdk` in your project**
112
+
113
+ ```bash
114
+ ng update @angular/cdk@19
115
+ ```
116
+
117
+ **NB: When using `ngx-matomo-client` in your project**
118
+
119
+ ```bash
120
+ ng update ngx-matomo-client@7
121
+ ```
122
+
123
+ Continue with your migration:
81
124
 
125
+ ```bash
82
126
  npm install --save-dev jasmine@5
83
127
 
84
128
  ng update karma@6.4 karma-chrome-launcher@3.2 karma-coverage@2.2 karma-jasmine@5.1 karma-jasmine-html-reporter@2.1
@@ -87,16 +131,38 @@ npm install --save-dev @typescript-eslint/utils@7 @typescript-eslint/types@7
87
131
 
88
132
  ng update @angular-eslint/eslint-plugin@19 @angular-eslint/eslint-plugin-template@19 @angular-eslint/template-parser@19
89
133
  ng update @typescript-eslint/eslint-plugin@7 @typescript-eslint/parser@7
90
- ng update eslint-plugin-import eslint-plugin-jasmine eslint-plugin-jsdoc eslint-plugin-rxjs-angular
134
+ ng update eslint-plugin-import eslint-plugin-jasmine eslint-plugin-rxjs-angular eslint-plugin-simple-import-sort
91
135
  ng update eslint@8
92
136
  ng update eslint-plugin-rxjs
93
137
  ng update @types/jasmine@5 @types/node@20 ts-node@10
94
138
 
95
139
  npm remove eslint-plugin-jsdoc
96
140
 
141
+ npm remove puppeteer
142
+ npm install --save-dev puppeteer
143
+
97
144
  npm update
98
145
  ```
99
146
 
147
+ #### Fix proxy.conf.json
148
+
149
+ In your `proxy.conf.json` file:
150
+
151
+ - remove `/*` at the end of your api url
152
+ - remove `"changeOrigin": true`
153
+
154
+ ```diff
155
+ - "/pub/101102/api/*": {
156
+ + "/pub/101102/api": {
157
+ "target": "http://localhost:16400",
158
+ - "changeOrigin": true,
159
+ "secure": false,
160
+ "pathRewrite": {
161
+ "^/api": ""
162
+ }
163
+ }
164
+ ```
165
+
100
166
  #### NgHttpLoader migration as standalone
101
167
 
102
168
  In your `app.module.ts` file:
@@ -104,19 +170,148 @@ In your `app.module.ts` file:
104
170
  - Remove `import { NgHttpLoaderModule } from 'ng-http-loader';`
105
171
  - Remove `NgHttpLoaderModule.forRoot()` from `imports` in `@NgModule(...)`
106
172
  - Add `NgHttpLoaderComponent` to `imports` in `@NgModule(...)`
173
+ - Add `withInterceptors([pendingRequestsInterceptor$])` to `providers` in `@NgModule(...)`
107
174
 
108
175
  ```diff
109
176
  - import { NgHttpLoaderModule } from 'ng-http-loader';
110
- + import { NgHttpLoaderComponent } from 'ng-http-loader';
177
+ + import { NgHttpLoaderComponent, pendingRequestsInterceptor$ } from 'ng-http-loader';
111
178
 
112
179
  @NgModule({
113
180
  imports: [
114
181
  - NgHttpLoaderModule.forRoot(),
115
182
  + NgHttpLoaderComponent,
116
- ],
183
+ ], providers: [
184
+ provideHttpClient(
185
+ + withInterceptors([pendingRequestsInterceptor$]),
186
+ ]
187
+ })
188
+ ```
189
+
190
+ #### ImageCropper migration as standalone (if you are using it in your project)
191
+
192
+ - Remove `import { ImageCropperModule } from 'ngx-image-cropper';`
193
+ - Remove `ImageCropperModule` from `imports` in `@NgModule(...)`
194
+ - Add `ImageCropperComponent` to `imports` in `@NgModule(...)`
195
+
196
+ ```diff
197
+ - import { ImageCropperModule } from 'ngx-image-cropper';
198
+ + import { ImageCropperComponent } from 'ngx-image-cropper';
199
+
200
+ @NgModule({
201
+ imports: [
202
+ - ImageCropperModule,
203
+ + ImageCropperComponent,
204
+ ]
205
+ })
206
+ ```
207
+
208
+ #### Matomo migration as standalone (if you are using it in your project)
209
+
210
+ In your `app.module.ts` file:
211
+
212
+ - Remove `import { MatomoInitializationMode, MatomoModule } from 'ngx-matomo-client';`
213
+ - Remove `MatomoModule.forRoot({mode: MatomoInitializationMode.AUTO_DEFERRED})` from `imports` in `@NgModule(...)`
214
+ - Add `provideMatomo` to `imports` in `@NgModule(...)`
215
+ - Add `provideMatomo({ mode: 'deferred' })` to `providers` in `@NgModule(...)`
216
+
217
+ ```diff
218
+ - import { MatomoInitializationMode, MatomoInitializerService, MatomoModule } from 'ngx-matomo-client';
219
+ + import { MatomoInitializerService, provideMatomo } from 'ngx-matomo-client';
220
+
221
+ @NgModule({
222
+ imports: [
223
+ - MatomoModule.forRoot({mode: MatomoInitializationMode.AUTO_DEFERRED}),
224
+ ], providers: [
225
+ + provideMatomo({ mode: 'deferred' })
226
+ ]
117
227
  })
118
228
  ```
119
229
 
230
+ #### Move and update your tsconfig\*.json files
231
+
232
+ - Move your `tsconfig.app.json` and `tsconfig.spec.json` from `src` to `front` (if not already done)
233
+ - Replace your `tsconfig.json` content with:
234
+
235
+ ```json
236
+ {
237
+ "compileOnSave": false,
238
+ "compilerOptions": {
239
+ "outDir": "./dist/out-tsc",
240
+ "noImplicitOverride": true,
241
+ "noPropertyAccessFromIndexSignature": false,
242
+ "noImplicitReturns": true,
243
+ "noFallthroughCasesInSwitch": true,
244
+ "skipLibCheck": true,
245
+ "esModuleInterop": true,
246
+ "sourceMap": true,
247
+ "declaration": false,
248
+ "experimentalDecorators": true,
249
+ "moduleResolution": "bundler",
250
+ "importHelpers": true,
251
+ "target": "ES2022",
252
+ "module": "ES2022",
253
+ "paths": {
254
+ "@dsivd/prestations-ng": ["./node_modules/@dsivd/prestations-ng"]
255
+ }
256
+ },
257
+ "include": ["src/**/*"],
258
+ "angularCompilerOptions": {
259
+ "enableI18nLegacyMessageIdFormat": false,
260
+ "strictInjectionParameters": true,
261
+ "strictInputAccessModifiers": true
262
+ }
263
+ }
264
+ ```
265
+
266
+ - Replace your `tsconfig.app.json` content with:
267
+
268
+ ```json
269
+ {
270
+ "extends": "./tsconfig.json",
271
+ "compilerOptions": {
272
+ "outDir": "./out-tsc/app",
273
+ "types": []
274
+ },
275
+ "files": ["src/main.ts"],
276
+ "include": ["src/**/*.d.ts"]
277
+ }
278
+ ```
279
+
280
+ - Replace your `tsconfig.spec.json` content with:
281
+
282
+ ```json
283
+ {
284
+ "extends": "./tsconfig.json",
285
+ "compilerOptions": {
286
+ "outDir": "./out-tsc/spec",
287
+ "types": ["jasmine", "node"]
288
+ },
289
+ "include": ["src/**/*.spec.ts", "src/**/*.d.ts"]
290
+ }
291
+ ```
292
+
293
+ #### Fix your angular.json file
294
+
295
+ Because your `tsconfig.app.json` and `tsconfig.spec.json` have been moved, you need to change the path in your `angular.json` file by removing `src/`
296
+
297
+ ```diff
298
+ "projects": {
299
+ "[YOUR_APPLICATION_NAME]": {
300
+ "architect": {
301
+ "build": {
302
+ "options": {
303
+ - "tsConfig": "src/tsconfig.app.json",
304
+ + "tsConfig": "tsconfig.app.json",
305
+ }
306
+ },
307
+ "test": {
308
+ "builder": "@angular-devkit/build-angular:karma",
309
+ "options": {
310
+ - "tsConfig": "src/tsconfig.spec.json",
311
+ + "tsConfig": "tsconfig.spec.json",
312
+ }
313
+ ```
314
+
120
315
  #### Browsers list update
121
316
 
122
317
  Run update schematic:
@@ -183,6 +378,8 @@ npm install
183
378
 
184
379
  #### Build and launch your application
185
380
 
381
+ **NB: You will most probably need to fix some compilation errors such as adding `override` when needed**
382
+
186
383
  ```bash
187
384
  npm run build
188
385
  npm start
@@ -195,6 +392,13 @@ Finally check if your tests run well :
195
392
  npm run test
196
393
  ```
197
394
 
395
+ **NB: If you are having trouble finding puppeteer ChromiumHeadless binary**
396
+
397
+ ```bash
398
+ npx puppeteer browsers install chrome
399
+ npm run test
400
+ ```
401
+
198
402
  If there is a message complaining about HttpErrorResponse & NG0205: Injector has already been destroyed,
199
403
  in your `app.component.spec.ts` file, add `HttpClientTestingModule` to `TestBed.configureTestingModule` in `beforeEach(waitForAsync` function
200
404
 
@@ -202,6 +406,145 @@ in your `app.component.spec.ts` file, add `HttpClientTestingModule` to `TestBed.
202
406
 
203
407
  From here on, we are back in the root folder of your project
204
408
 
409
+ ### Openshift
410
+
411
+ Since spring boot 3 has a minimal jdk version of 17, you now have to deploy you application in an openshift cluster.
412
+ see https://dsigit.etat-de-vaud.ch/outils/git/projects/PEE/repos/imt-charts/browse/README.MD
413
+
414
+ ### Spring boot 3
415
+
416
+ You can use this openrewrite recipe to simplify the migration (run with java 11)
417
+
418
+ ```bash
419
+ mvn -U org.openrewrite.maven:rewrite-maven-plugin:run -Drewrite.recipeArtifactCoordinates=org.openrewrite.recipe:rewrite-spring:RELEASE -Drewrite.activeRecipes=org.openrewrite.java.spring.boot3.UpgradeSpringBoot_3_4 -Drewrite.exportDatatables=true -Pnof,noft
420
+ ```
421
+
422
+ After that, you should continue based on your current parent :
423
+
424
+ ### SPRING-BOOT-STARTER-PARENT
425
+
426
+ - remove this profile `<id>devex.in</id>` and its properties (`<devex*`)
427
+ - set property `java.version` to `21`
428
+ - set property `build.nofront` to `false`
429
+ - set property `skipTests` to `false`
430
+ - set property `commons-lang3.version` to `3.17.0`
431
+ - set property `commons-io.version` to `2.19.0`
432
+ - set property `commons-text.version` to `1.13.1`
433
+ - set property `prestations-be.version` to `18.x.y`
434
+ - remove plugin `maven-assembly-plugin` and its properties (`<assembly.xxx`)
435
+ - remove dependency `spring-cloud-starter-netflix-eureka-client`
436
+ - remove dependency `javax.el` and its property (`<javax.el.version>`)
437
+
438
+ If you used `org.jvnet.jaxb2.maven2:maven-jaxb2-plugin`, you should replace it with `org.jvnet.jaxb:jaxb-maven-plugin`
439
+
440
+ ```
441
+ <plugin>
442
+ <groupId>org.jvnet.jaxb</groupId>
443
+ <artifactId>jaxb-maven-plugin</artifactId>
444
+ <version>${jaxb-maven-plugin.version}</version>
445
+ <configuration>
446
+ <strict>false</strict> <!-- see https://github.com/highsource/maven-jaxb2-plugin/wiki/Catalogs-in-Strict-Mode -->
447
+ <schemaDirectory>${basedir}/src/main/resources/xsd/</schemaDirectory>
448
+ <args>
449
+ <arg>-extension</arg>
450
+ <arg>-Xvalue-constructor</arg>
451
+ <arg>-XsimpleEquals</arg>
452
+ <arg>-XsimpleHashCode</arg>
453
+ <arg>-Xinheritance</arg>
454
+ </args>
455
+ </configuration>
456
+ <executions>
457
+ <execution>
458
+ <goals>
459
+ <goal>generate</goal>
460
+ </goals>
461
+ <configuration>
462
+ <schemaIncludes>
463
+ <include>backoffice.xsd</include>
464
+ </schemaIncludes>
465
+ </configuration>
466
+ </execution>
467
+ </executions>
468
+ <dependencies>
469
+ <dependency>
470
+ <groupId>org.jvnet.jaxb</groupId>
471
+ <artifactId>jaxb-plugins</artifactId>
472
+ <version>${jaxb-plugins.version}</version>
473
+ </dependency>
474
+ <dependency>
475
+ <groupId>org.jvnet.jaxb2_commons</groupId>
476
+ <artifactId>jaxb2-namespace-prefix</artifactId>
477
+ <version>${jaxb2-namespace-prefix.version}</version>
478
+ </dependency>
479
+ </dependencies>
480
+ </plugin>
481
+ ```
482
+
483
+ with these properties :
484
+
485
+ ```
486
+ <jaxb-maven-plugin.version>4.0.8</jaxb-maven-plugin.version>
487
+ <jaxb-plugins.version>3.0.0</jaxb-plugins.version>
488
+ <jaxb2-namespace-prefix.version>2.0</jaxb2-namespace-prefix.version>
489
+ ```
490
+
491
+ ### APPLICATION-PARENT
492
+
493
+ - remove property `java.version` (already set to `21` in the parent)
494
+ - if existing, remove exclusion `spring-cloud-starter-netflix-eureka-client` from `starter-prestation`
495
+ - remove dependency `spring-boot-starter-validation` (already in `starter-prestation`)
496
+ - remove devex properties
497
+
498
+ If you used `org.jvnet.jaxb2.maven2:maven-jaxb2-plugin`, you should replace it with `org.jvnet.jaxb:jaxb-maven-plugin`
499
+
500
+ ```
501
+ <plugin>
502
+ <groupId>org.jvnet.jaxb</groupId>
503
+ <artifactId>jaxb-maven-plugin</artifactId>
504
+ <executions>
505
+ <execution>
506
+ <goals>
507
+ <goal>generate</goal>
508
+ </goals>
509
+ <configuration>
510
+ <schemaIncludes>
511
+ <include>backoffice.xsd</include>
512
+ </schemaIncludes>
513
+ </configuration>
514
+ </execution>
515
+ </executions>
516
+ </plugin>
517
+ ```
518
+
519
+ ### clean / build your project
520
+
521
+ - remove the annotation `@EnableEurekaClient`
522
+ - remove the property `eureka.client.enabled`
523
+ - remove the property `eureka.client.serviceUrl.defaultZone` (in you configuration repository)
524
+ - replace deprecated annotation `@MockBean` with `@MockitoBean`
525
+ - remove deprecated field constructor `Validator validator` from `AbstractSdkController`
526
+ - use `SdkControllerTest.getValidator()` instead of creating a `LocalValidatorFactoryBean` to build your ``
527
+
528
+ build your project with java 21 :
529
+
530
+ ```
531
+ mvn -U clean install -Pnof,noft
532
+ ```
533
+
534
+ ### Property migration
535
+
536
+ run you application with this dependency :
537
+
538
+ ```
539
+ <dependency>
540
+ <groupId>org.springframework.boot</groupId>
541
+ <artifactId>spring-boot-properties-migrator</artifactId>
542
+ <scope>runtime</scope>
543
+ </dependency>
544
+ ```
545
+
546
+ look for logs that indicate property you should migrate, update them and remove the dependency
547
+
205
548
  ### Captcha configuration
206
549
 
207
550
  - As stated in the migration guide from v16 to v17, Cybercache is responsible of the captcha turnstile verify call.
@@ -216,3 +559,52 @@ From here on, we are back in the root folder of your project
216
559
  Cookie storage is kept as before, therefore you can keep cookie related properties that starts with `recaptcha.cookie.YYY` in your properties.
217
560
 
218
561
  See [Skeleton](https://dsigit.etat-de-vaud.ch/outils/git/projects/CYBSDK/repos/skeleton/pull-requests/708/overview) for a working example
562
+
563
+ ### HIBERNATE
564
+
565
+ ## Sequences
566
+
567
+ Hibernate doesn't use the default sequence anymore, you can keep using it by replacing
568
+
569
+ ```
570
+ @GeneratedValue(strategy = GenerationType.SEQUENCE)
571
+ ```
572
+
573
+ with
574
+
575
+ ```
576
+ @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "hibernate_sequence")
577
+ @SequenceGenerator(name = "hibernate_sequence", allocationSize = 1)
578
+ ```
579
+
580
+ ## Dates mapping
581
+
582
+ replace `@Type(LocalDateTimeUserType.class)` by `@Convert(converter = LocalDateTimeConverter.class)`
583
+ replace `@Type(LocalDateUserType.class)` by `@Convert(converter = LocalDateConverter.class)`
584
+
585
+ ## H2
586
+
587
+ If you had a fixe H2 version for testing, you should upgrade to the latest version by removing :
588
+
589
+ ```
590
+ <h2.version>1.4.200</h2.version>
591
+ ```
592
+
593
+ ### Jenkins files for Unit tests
594
+
595
+ buildPipeline is not supported anymore, replace the content of jenkins>UT>JenkinsFile with :
596
+
597
+ ```
598
+ @Library('devsup-library') _
599
+
600
+ buildAppPipelinePodmanUT([
601
+ name : 'the name of your application',
602
+ label : 'your slaves lable',
603
+ jdk : '21',
604
+ node : '20'
605
+ ])
606
+ ```
607
+
608
+ ### Debugging tips
609
+
610
+ Spring boot 3 doesn't support calling a controller with a trailing slash, fix the url called (/api/ping != /api/ping**/**)