@dsivd/prestations-ng 18.3.11-beta.3 → 18.3.12

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
@@ -6,6 +6,13 @@
6
6
 
7
7
  ---
8
8
 
9
+ ## [18.3.12]
10
+
11
+ ### Updated
12
+
13
+ - [foehn-remaining-alerts-summary.component.html](projects/prestations-ng/src/foehn-remaining-alerts-summary/foehn-remaining-alerts-summary.component.html)
14
+ - show debug infos that would be sent to the support form when not in prod
15
+
9
16
  ## [18.3.11]
10
17
 
11
18
  ### 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).
@@ -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
@@ -13935,17 +13935,19 @@ class FoehnRemainingAlertsSummaryComponent {
13935
13935
  this.applicationInfoService = applicationInfoService;
13936
13936
  this.dictionaryService = dictionaryService;
13937
13937
  this.remainingErrorNamesToIgnore = [];
13938
+ this.showDebugData = of(false);
13938
13939
  this.hasRemainingErrors = of(false);
13939
13940
  this.remainingErrorsLabelSubject = new BehaviorSubject(null);
13940
13941
  this.DEFAULT_REMAINING_ERRORS_MSG_KEY = 'foehn-remaining-alert-summary.default-error-message';
13941
- const remainingErrors = this.gesdemService.updateFormDataSubject.pipe(map(() => {
13942
+ this.remainingErrors = this.gesdemService.updateFormDataSubject.pipe(map(() => {
13942
13943
  this.reference = this.gesdemService.lastResponse.meta.reference;
13943
13944
  return this.gesdemService.lastResponse.errors.filter(e => !this.remainingErrorNamesToIgnore.includes(e.name));
13944
13945
  }), 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, {
13946
+ 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
13947
  supportLink: link
13947
13948
  })));
13948
- this.hasRemainingErrors = remainingErrors.pipe(map(errors => !!errors.length));
13949
+ this.hasRemainingErrors = this.remainingErrors.pipe(map(errors => !!errors.length));
13950
+ this.showDebugData = this.applicationInfoService.data.pipe(map(appInfo => appInfo.environment?.toUpperCase() !== 'PR'));
13949
13951
  this.remainingErrorsMessage = combineLatest([
13950
13952
  defaultRemainingErrorsMsg,
13951
13953
  this.remainingErrorsLabelSubject.asObservable()
@@ -13960,11 +13962,11 @@ class FoehnRemainingAlertsSummaryComponent {
13960
13962
  this.remainingErrorsLabelSubject.next(msg);
13961
13963
  }
13962
13964
  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\n class=\"alert alert-danger\"\n *ngIf=\"hasRemainingErrors | async\"\n [innerHTML]=\"remainingErrorsMessage | async\"\n></div>\n", styles: [""], dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i2.AsyncPipe, name: "async" }] }); }
13965
+ 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
13966
  }
13965
13967
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: FoehnRemainingAlertsSummaryComponent, decorators: [{
13966
13968
  type: Component,
13967
- args: [{ selector: 'foehn-remaining-alerts-summary', standalone: false, template: "<div\n class=\"alert alert-danger\"\n *ngIf=\"hasRemainingErrors | async\"\n [innerHTML]=\"remainingErrorsMessage | async\"\n></div>\n" }]
13969
+ 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
13970
  }], ctorParameters: () => [{ type: GesdemHandlerService }, { type: ApplicationInfoService }, { type: SdkDictionaryService }], propDecorators: { remainingErrorNamesToIgnore: [{
13969
13971
  type: Input
13970
13972
  }], remainingErrorsLabel: [{