@dsivd/prestations-ng 18.3.11 → 18.3.13
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 +14 -0
- package/README.md +1 -0
- package/UPGRADING_V19.md +117 -0
- package/dsivd-prestations-ng-18.3.13.tgz +0 -0
- package/fesm2022/dsivd-prestations-ng.mjs +17 -6
- package/fesm2022/dsivd-prestations-ng.mjs.map +1 -1
- package/foehn-remaining-alerts-summary/foehn-remaining-alerts-summary.component.d.ts +3 -0
- package/package.json +1 -1
- package/sdk-recaptcha/recaptcha.service.d.ts +1 -0
- package/dsivd-prestations-ng-18.3.11.tgz +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,20 @@
|
|
|
6
6
|
|
|
7
7
|
---
|
|
8
8
|
|
|
9
|
+
## [18.3.13]
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
|
|
13
|
+
- [recaptcha.service.ts](projects/prestations-ng/src/sdk-recaptcha/recaptcha.service.ts)
|
|
14
|
+
- fixed recaptcha called infinitely when backend says that it must be revalidated
|
|
15
|
+
|
|
16
|
+
## [18.3.12]
|
|
17
|
+
|
|
18
|
+
### Updated
|
|
19
|
+
|
|
20
|
+
- [foehn-remaining-alerts-summary.component.html](projects/prestations-ng/src/foehn-remaining-alerts-summary/foehn-remaining-alerts-summary.component.html)
|
|
21
|
+
- show debug infos that would be sent to the support form when not in prod
|
|
22
|
+
|
|
9
23
|
## [18.3.11]
|
|
10
24
|
|
|
11
25
|
### Updated
|
package/README.md
CHANGED
|
@@ -21,6 +21,7 @@ The documentation is available online at [https://dsi-vd.github.io/prestations-n
|
|
|
21
21
|
|
|
22
22
|
Migration guides are available to provide an upgrade path from one major version to another.
|
|
23
23
|
|
|
24
|
+
- If you need to upgrade to version `19+`, please refer to [the V19 upgrade guide](UPGRADING_V19.md).
|
|
24
25
|
- If you need to upgrade to version `18+`, please refer to [the V18 upgrade guide](UPGRADING_V18.md).
|
|
25
26
|
- If you need to upgrade to version `17+`, please refer to [the V17 upgrade guide](UPGRADING_V17.md).
|
|
26
27
|
- If you need to upgrade to version `16+`, please refer to [the V16 upgrade guide](UPGRADING_V16.md).
|
package/UPGRADING_V19.md
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# PRESTAKIT : Upgrading from v18 to v19
|
|
2
|
+
|
|
3
|
+
To migrate your project from `prestakit` v18 to v19, you need to migrate prestations-ng and prestations-be, as usual.
|
|
4
|
+
But to migrate to prestations-be v19, you need to migrate your project to Spring Boot 4 / Java 25.
|
|
5
|
+
|
|
6
|
+
Let's start by migrating to Spring Boot 4 / prestations-be v19.
|
|
7
|
+
|
|
8
|
+
## PRESTATIONS-BE (via parent - Spring boot 4 / java 25)
|
|
9
|
+
|
|
10
|
+
From here on, we are in the root folder of your project, for example ~/git/cybsdk/skeleton.
|
|
11
|
+
|
|
12
|
+
### Spring Boot 4
|
|
13
|
+
|
|
14
|
+
You can switch to Java 25 `jdk25` + change in IntelliJ: right-click on your project > Open Module Settings > Project > set "SDK" to `jdk25` from devtools and "Language
|
|
15
|
+
level" to `25` in "Modules"
|
|
16
|
+
|
|
17
|
+
Use the latest application-parent v15+ in your `pom.xml`.
|
|
18
|
+
|
|
19
|
+
You can use this OpenRewrite recipe to simplify the migration (run with java 25).
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
source ~/devtools/fordev.sh 25 20
|
|
23
|
+
mvn -U org.openrewrite.maven:rewrite-maven-plugin:run -Drewrite.recipeArtifactCoordinates=org.openrewrite.recipe:rewrite-spring:RELEASE -Drewrite.activeRecipes=org.openrewrite.java.spring.boot4.UpgradeSpringBoot_4_0 -Pnof,noft
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
#### Fixes
|
|
27
|
+
|
|
28
|
+
Fix application.properties :
|
|
29
|
+
|
|
30
|
+
```diff
|
|
31
|
+
# Remove the following properties if it was added by the recipe
|
|
32
|
+
spring.liquibase.password=${spring.datasource.password}
|
|
33
|
+
spring.liquibase.username=${spring.datasource.username}
|
|
34
|
+
Replace the spring.jackson.serialization.WRITE_DATES_AS_TIMESTAMPS property by spring.jackson.datatype.datetime.write-dates-as-timestamps if it was not done by the recipe
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
If the following plugin with Lombok path was added by the recipe, remove this plugin:
|
|
38
|
+
|
|
39
|
+
```xml
|
|
40
|
+
<plugin>
|
|
41
|
+
<groupId>org.apache.maven.plugins</groupId>
|
|
42
|
+
<artifactId>maven-compiler-plugin</artifactId>
|
|
43
|
+
<configuration>
|
|
44
|
+
<annotationProcessorPaths>
|
|
45
|
+
<path>
|
|
46
|
+
<groupId>org.projectlombok</groupId>
|
|
47
|
+
<artifactId>lombok</artifactId>
|
|
48
|
+
<version>1.18.40</version>
|
|
49
|
+
</path>
|
|
50
|
+
</annotationProcessorPaths>
|
|
51
|
+
</configuration>
|
|
52
|
+
</plugin>
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
If the code uses `AutoConfigureMockMvc`, add:
|
|
56
|
+
```xml
|
|
57
|
+
<dependency>
|
|
58
|
+
<groupId>org.springframework.boot</groupId>
|
|
59
|
+
<artifactId>spring-boot-starter-webmvc-test</artifactId>
|
|
60
|
+
<scope>test</scope>
|
|
61
|
+
</dependency>
|
|
62
|
+
```
|
|
63
|
+
And replace the old `AutoConfigureMockMvc` import which is not recognized anymore by the new one.
|
|
64
|
+
|
|
65
|
+
If we use in pom.xml Spring/Hibernate dependencies (like hibernate-jpamodelgen), check the Spring Boot 4 migration
|
|
66
|
+
guide to see if it has been replaced by another library: https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-4.0-Migration-Guide
|
|
67
|
+
|
|
68
|
+
### Jackson migration
|
|
69
|
+
|
|
70
|
+
With Spring Boot 4, Jackson 3 is now used instead of Jackson 2, so we need to replace the previous Jackson 2 classes.
|
|
71
|
+
Replace `com.fasterxml.jackson.databind.ObjectMapper` with `tools.jackson.databind.json.JsonMapper`.
|
|
72
|
+
|
|
73
|
+
### Brave Tracer
|
|
74
|
+
|
|
75
|
+
If you are using Brave Tracer (search `brace.Tracer` in the code, usually in backoffices), you need to replace it with
|
|
76
|
+
OpenTelemetry by adding the following dependency:
|
|
77
|
+
```xml
|
|
78
|
+
<dependency>
|
|
79
|
+
<groupId>org.springframework.boot</groupId>
|
|
80
|
+
<artifactId>spring-boot-micrometer-tracing-brave</artifactId>
|
|
81
|
+
</dependency>
|
|
82
|
+
```
|
|
83
|
+
And replace `brave.Tracer` imports by `io.micrometer.tracing.Tracer`;
|
|
84
|
+
|
|
85
|
+
### Property migration
|
|
86
|
+
|
|
87
|
+
Run your application with this dependency :
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
<dependency>
|
|
91
|
+
<groupId>org.springframework.boot</groupId>
|
|
92
|
+
<artifactId>spring-boot-properties-migrator</artifactId>
|
|
93
|
+
<scope>runtime</scope>
|
|
94
|
+
</dependency>
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Look for logs that indicate property you should migrate (watch for WARN logs of class PropertiesMigrationListener), update them and remove the dependency
|
|
98
|
+
|
|
99
|
+
### Debugging tips
|
|
100
|
+
|
|
101
|
+
Spring boot 4 doesn't support calling a controller with a trailing slash, fix the url called (/api/ping != /api/ping**/**)
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
### Clean Sonar code smells
|
|
105
|
+
You can use the following OpenRewrite recipes to clean Sonar code smells. It is recommended to do it after the migration to avoid mixing the migration changes with code cleaning changes, and to make it easier to review.
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
mvn -U org.openrewrite.maven:rewrite-maven-plugin:run -Drewrite.recipeArtifactCoordinates=org.openrewrite.recipe:rewrite-testing-frameworks:RELEASE -Drewrite.activeRecipes=org.openrewrite.java.testing.junit.JUnit6BestPractices, -Pnof,noft
|
|
109
|
+
|
|
110
|
+
mvn -U org.openrewrite.maven:rewrite-maven-plugin:run -Drewrite.recipeArtifactCoordinates=org.openrewrite.recipe:rewrite-static-analysis:RELEASE -Drewrite.activeRecipes=org.openrewrite.staticanalysis.CommonStaticAnalysis -Pnof,noft
|
|
111
|
+
|
|
112
|
+
mvn -U org.openrewrite.maven:rewrite-maven-plugin:run --define rewrite.recipeArtifactCoordinates=org.openrewrite.recipe:rewrite-testing-frameworks:RELEASE --define rewrite.activeRecipes=org.openrewrite.java.testing.mockito.MockitoBestPractices --define rewrite.exportDatatables=true -Pnof,noft
|
|
113
|
+
|
|
114
|
+
mvn -U org.openrewrite.maven:rewrite-maven-plugin:run -Drewrite.activeRecipes=org.openrewrite.java.RemoveUnusedImports -Pnof,noft
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Take a look at Sonar to see other things that you can improve or ignore.
|
|
Binary file
|
|
@@ -4367,6 +4367,7 @@ class RecaptchaService {
|
|
|
4367
4367
|
this.applicationInfoService = applicationInfoService;
|
|
4368
4368
|
this.sdkLogsService = sdkLogsService;
|
|
4369
4369
|
this.errorsSubject = new BehaviorSubject([]);
|
|
4370
|
+
this.gesdemFormErrors = [];
|
|
4370
4371
|
this.errors = this.initErrorObservable(); // has to be first since it is used in initShouldDisplayObservable !
|
|
4371
4372
|
this.shouldDisplay = this.initShouldDisplayObservable();
|
|
4372
4373
|
this.publicKey = this.initPublicKeyObservable();
|
|
@@ -4409,6 +4410,9 @@ class RecaptchaService {
|
|
|
4409
4410
|
this.errorsSubject.next([newError, ...existingErrors]);
|
|
4410
4411
|
}
|
|
4411
4412
|
clearErrors() {
|
|
4413
|
+
// Remove recaptcha errors so it won't reset infinitely
|
|
4414
|
+
this.validationHandlerService.updateErrors(this.gesdemFormErrors.filter(error => error.code !== CAPTCHA_ERROR_NAME &&
|
|
4415
|
+
error.name !== CAPTCHA_ERROR_NAME));
|
|
4412
4416
|
this.errorsSubject.next([]);
|
|
4413
4417
|
}
|
|
4414
4418
|
getErrors() {
|
|
@@ -4432,8 +4436,13 @@ class RecaptchaService {
|
|
|
4432
4436
|
of([]),
|
|
4433
4437
|
// Read from the gesdem service all errors.
|
|
4434
4438
|
this.validationHandlerService.validationErrorsSubject).pipe(
|
|
4439
|
+
// Store all validation errors before filtering
|
|
4440
|
+
tap(errors => {
|
|
4441
|
+
this.gesdemFormErrors = errors;
|
|
4442
|
+
}),
|
|
4435
4443
|
// Errors from GesDem, or nothing
|
|
4436
|
-
map(errors => errors.filter(ex => CAPTCHA_ERROR_NAME === ex.code
|
|
4444
|
+
map(errors => errors.filter(ex => CAPTCHA_ERROR_NAME === ex.code ||
|
|
4445
|
+
CAPTCHA_ERROR_NAME === ex.name)));
|
|
4437
4446
|
// Bind errors to the component, either from the backend of from this component
|
|
4438
4447
|
return combineLatest([
|
|
4439
4448
|
// Errors from gesdem matching the name of the captcha.
|
|
@@ -13935,17 +13944,19 @@ class FoehnRemainingAlertsSummaryComponent {
|
|
|
13935
13944
|
this.applicationInfoService = applicationInfoService;
|
|
13936
13945
|
this.dictionaryService = dictionaryService;
|
|
13937
13946
|
this.remainingErrorNamesToIgnore = [];
|
|
13947
|
+
this.showDebugData = of(false);
|
|
13938
13948
|
this.hasRemainingErrors = of(false);
|
|
13939
13949
|
this.remainingErrorsLabelSubject = new BehaviorSubject(null);
|
|
13940
13950
|
this.DEFAULT_REMAINING_ERRORS_MSG_KEY = 'foehn-remaining-alert-summary.default-error-message';
|
|
13941
|
-
|
|
13951
|
+
this.remainingErrors = this.gesdemService.updateFormDataSubject.pipe(map(() => {
|
|
13942
13952
|
this.reference = this.gesdemService.lastResponse.meta.reference;
|
|
13943
13953
|
return this.gesdemService.lastResponse.errors.filter(e => !this.remainingErrorNamesToIgnore.includes(e.name));
|
|
13944
13954
|
}), shareReplay(1));
|
|
13945
|
-
const defaultRemainingErrorsMsg = remainingErrors.pipe(filter(errors => !!errors.length), switchMap(errors => this.applicationInfoService.getSafeSupportFormUrl(this.reference, errors)), map(link => this.dictionaryService.getKeySync(this.DEFAULT_REMAINING_ERRORS_MSG_KEY, {
|
|
13955
|
+
const defaultRemainingErrorsMsg = this.remainingErrors.pipe(filter(errors => !!errors.length), switchMap(errors => this.applicationInfoService.getSafeSupportFormUrl(this.reference, errors)), map(link => this.dictionaryService.getKeySync(this.DEFAULT_REMAINING_ERRORS_MSG_KEY, {
|
|
13946
13956
|
supportLink: link
|
|
13947
13957
|
})));
|
|
13948
|
-
this.hasRemainingErrors = remainingErrors.pipe(map(errors => !!errors.length));
|
|
13958
|
+
this.hasRemainingErrors = this.remainingErrors.pipe(map(errors => !!errors.length));
|
|
13959
|
+
this.showDebugData = this.applicationInfoService.data.pipe(map(appInfo => appInfo.environment?.toUpperCase() !== 'PR'));
|
|
13949
13960
|
this.remainingErrorsMessage = combineLatest([
|
|
13950
13961
|
defaultRemainingErrorsMsg,
|
|
13951
13962
|
this.remainingErrorsLabelSubject.asObservable()
|
|
@@ -13960,11 +13971,11 @@ class FoehnRemainingAlertsSummaryComponent {
|
|
|
13960
13971
|
this.remainingErrorsLabelSubject.next(msg);
|
|
13961
13972
|
}
|
|
13962
13973
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: FoehnRemainingAlertsSummaryComponent, deps: [{ token: GesdemHandlerService }, { token: ApplicationInfoService }, { token: SdkDictionaryService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
13963
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.17", type: FoehnRemainingAlertsSummaryComponent, isStandalone: false, selector: "foehn-remaining-alerts-summary", inputs: { remainingErrorNamesToIgnore: "remainingErrorNamesToIgnore", remainingErrorsLabel: "remainingErrorsLabel" }, ngImport: i0, template: "<div
|
|
13974
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.17", type: FoehnRemainingAlertsSummaryComponent, isStandalone: false, selector: "foehn-remaining-alerts-summary", inputs: { remainingErrorNamesToIgnore: "remainingErrorNamesToIgnore", remainingErrorsLabel: "remainingErrorsLabel" }, ngImport: i0, template: "<div class=\"alert alert-danger\" *ngIf=\"hasRemainingErrors | async\">\n <span [innerHTML]=\"remainingErrorsMessage | async\"></span>\n\n <ng-container *ngIf=\"!!(showDebugData | async)\">\n <div\n class=\"alert alert-warning\"\n *ngIf=\"remainingErrors | async as errors\"\n id=\"remaining-errors-for-debug\"\n >\n DEBUG (ne s'affiche pas en production) :\n <ul class=\"mt-3\">\n <li *ngFor=\"let error of errors\">\n {{ error.name }} ({{ error.code }}) : {{ error.message }}\n </li>\n </ul>\n </div>\n </ng-container>\n</div>\n", styles: [""], dependencies: [{ kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i2.AsyncPipe, name: "async" }] }); }
|
|
13964
13975
|
}
|
|
13965
13976
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: FoehnRemainingAlertsSummaryComponent, decorators: [{
|
|
13966
13977
|
type: Component,
|
|
13967
|
-
args: [{ selector: 'foehn-remaining-alerts-summary', standalone: false, template: "<div
|
|
13978
|
+
args: [{ selector: 'foehn-remaining-alerts-summary', standalone: false, template: "<div class=\"alert alert-danger\" *ngIf=\"hasRemainingErrors | async\">\n <span [innerHTML]=\"remainingErrorsMessage | async\"></span>\n\n <ng-container *ngIf=\"!!(showDebugData | async)\">\n <div\n class=\"alert alert-warning\"\n *ngIf=\"remainingErrors | async as errors\"\n id=\"remaining-errors-for-debug\"\n >\n DEBUG (ne s'affiche pas en production) :\n <ul class=\"mt-3\">\n <li *ngFor=\"let error of errors\">\n {{ error.name }} ({{ error.code }}) : {{ error.message }}\n </li>\n </ul>\n </div>\n </ng-container>\n</div>\n" }]
|
|
13968
13979
|
}], ctorParameters: () => [{ type: GesdemHandlerService }, { type: ApplicationInfoService }, { type: SdkDictionaryService }], propDecorators: { remainingErrorNamesToIgnore: [{
|
|
13969
13980
|
type: Input
|
|
13970
13981
|
}], remainingErrorsLabel: [{
|