generator-jhipster 7.9.0 → 7.9.3

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.
Files changed (227) hide show
  1. package/cli/environment-builder.js +15 -1
  2. package/cli/jhipster.js +0 -0
  3. package/generators/app/index.js +12 -1
  4. package/generators/bootstrap/index.js +33 -1
  5. package/generators/ci-cd/templates/circle.yml.ejs +3 -13
  6. package/generators/client/files-angular.js +1 -1
  7. package/generators/client/files-react.js +5 -2
  8. package/generators/client/files-vue.js +3 -2
  9. package/generators/client/templates/angular/jest.conf.js.ejs +6 -3
  10. package/generators/client/templates/angular/package.json +18 -18
  11. package/generators/client/templates/angular/package.json.ejs +3 -7
  12. package/generators/client/templates/angular/src/main/webapp/app/admin/admin-routing.module.ts.ejs +1 -1
  13. package/generators/client/templates/angular/src/main/webapp/app/admin/health/health.model.ts.ejs +1 -1
  14. package/generators/client/templates/angular/src/main/webapp/app/admin/user-management/update/user-management-update.component.ts.ejs +17 -15
  15. package/generators/client/templates/angular/src/main/webapp/app/admin/user-management/user-management.model.ts.ejs +2 -2
  16. package/generators/client/templates/angular/src/main/webapp/app/admin/user-management/user-management.route.ts.ejs +4 -4
  17. package/generators/client/templates/angular/src/main/webapp/app/core/request/request-util.ts.ejs +4 -2
  18. package/generators/client/templates/angular/src/main/webapp/app/core/util/data-util.service.ts.ejs +1 -1
  19. package/generators/client/templates/angular/src/main/webapp/app/core/util/parse-links.service.ts.ejs +1 -1
  20. package/generators/client/templates/angular/src/main/webapp/app/layouts/navbar/navbar.component.html.ejs +1 -1
  21. package/generators/client/templates/angular/src/main/webapp/app/shared/filter/filter.component.html.ejs +8 -6
  22. package/generators/client/templates/angular/src/main/webapp/app/shared/filter/filter.component.ts.ejs +6 -11
  23. package/generators/client/templates/angular/src/main/webapp/app/shared/filter/filter.model.spec.ts.ejs +227 -25
  24. package/generators/client/templates/angular/src/main/webapp/app/shared/filter/filter.model.ts.ejs +104 -43
  25. package/generators/client/templates/angular/src/main/webapp/content/scss/global.scss.ejs +8 -0
  26. package/generators/client/templates/angular/tsconfig.json.ejs +0 -1
  27. package/generators/client/templates/angular/tsconfig.spec.json.ejs +2 -3
  28. package/generators/client/templates/angular/webpack/webpack.microfrontend.js.ejs +0 -3
  29. package/generators/client/templates/common/package.json +4 -4
  30. package/generators/client/templates/common/src/main/webapp/swagger-ui/index.html.ejs +1 -1
  31. package/generators/client/templates/react/jest.conf.js.ejs +2 -2
  32. package/generators/client/templates/react/package.json +24 -24
  33. package/generators/client/templates/react/package.json.ejs +3 -7
  34. package/generators/client/templates/react/src/main/webapp/app/config/store.ts.ejs +0 -6
  35. package/generators/client/templates/react/src/main/webapp/app/index.tsx.ejs +4 -5
  36. package/generators/client/templates/react/src/main/webapp/app/modules/administration/administration.reducer.spec.ts.ejs +7 -7
  37. package/generators/client/templates/react/src/main/webapp/app/modules/administration/administration.reducer.ts.ejs +6 -6
  38. package/generators/client/templates/react/src/main/webapp/app/modules/administration/index.tsx.ejs +2 -2
  39. package/generators/client/templates/react/src/main/webapp/app/shared/layout/menus/admin.tsx.ejs +1 -1
  40. package/generators/client/templates/react/src/main/webapp/app/shared/reducers/authentication.spec.ts.ejs +17 -8
  41. package/generators/client/templates/react/src/main/webapp/app/shared/reducers/authentication.ts.ejs +1 -1
  42. package/generators/client/templates/react/src/main/webapp/app/shared/reducers/locale.spec.ts.ejs +176 -19
  43. package/generators/client/templates/react/src/main/webapp/app/shared/reducers/locale.ts.ejs +46 -13
  44. package/generators/client/templates/react/webpack/webpack.microfrontend.js.jhi.react.ejs +1 -1
  45. package/generators/client/templates/vue/package.json +17 -17
  46. package/generators/client/templates/vue/package.json.ejs +3 -7
  47. package/generators/client/templates/vue/src/main/webapp/app/core/jhi-navbar/jhi-navbar.component.ts.ejs +2 -1
  48. package/generators/client/templates/vue/src/main/webapp/app/core/jhi-navbar/jhi-navbar.vue.ejs +1 -1
  49. package/generators/client/templates/vue/src/main/webapp/app/main.ts.ejs +2 -2
  50. package/generators/client/templates/vue/src/main/webapp/app/router/admin.ts.ejs +2 -2
  51. package/generators/client/templates/vue/src/test/javascript/e2e/modules/administration/administration.spec.ts.ejs +1 -1
  52. package/generators/client/templates/vue/src/test/javascript/e2e/page-objects/administration-page.ts.ejs +1 -1
  53. package/generators/client/templates/vue/src/test/javascript/e2e/page-objects/navbar-page.ts.ejs +2 -2
  54. package/generators/client/templates/vue/src/test/javascript/jest.conf.js.ejs +5 -6
  55. package/generators/client/templates/vue/src/test/javascript/spec/app/account/account.service.spec.ts.ejs +4 -0
  56. package/generators/client/templates/vue/src/test/javascript/spec/app/shared/alert/alert.service.spec.ts.ejs +106 -3
  57. package/generators/client/templates/vue/src/test/javascript/spec/app/shared/config/axios-interceptor.spec.ts.ejs +12 -0
  58. package/generators/client/templates/vue/src/test/javascript/spec/app/shared/config/formatter.spec.ts.ejs +6 -0
  59. package/generators/client/templates/vue/src/test/javascript/spec/app/shared/sort/sorts.spec.ts.ejs +10 -0
  60. package/generators/client/templates/vue/webpack/webpack.common.js.ejs +1 -1
  61. package/generators/client/templates/vue/webpack/webpack.dev.js.ejs +2 -2
  62. package/generators/common/files.js +5 -4
  63. package/generators/common/templates/.husky/pre-commit.ejs +0 -0
  64. package/generators/common/templates/package.json +1 -1
  65. package/generators/common/templates/sonar-project.properties.ejs +19 -11
  66. package/generators/cypress/index.js +1 -1
  67. package/generators/docker-compose/templates/README-DOCKER-COMPOSE.md.ejs +3 -3
  68. package/generators/docker-compose/templates/docker-compose.yml.ejs +1 -1
  69. package/generators/docker-compose/templates/realm-config/jhipster-realm.json.ejs +32 -14
  70. package/generators/entity/index.js +4 -3
  71. package/generators/entity-client/templates/angular/src/main/webapp/app/entities/detail/entity-management-detail.component.html.ejs +1 -1
  72. package/generators/entity-client/templates/angular/src/main/webapp/app/entities/list/entity-management.component.html.ejs +18 -6
  73. package/generators/entity-client/templates/angular/src/main/webapp/app/entities/list/entity-management.component.spec.ts.ejs +1 -1
  74. package/generators/entity-client/templates/angular/src/main/webapp/app/entities/list/entity-management.component.ts.ejs +23 -19
  75. package/generators/entity-client/templates/angular/src/main/webapp/app/entities/service/entity.service.spec.ts.ejs +3 -1
  76. package/generators/entity-client/templates/angular/src/main/webapp/app/entities/service/entity.service.ts.ejs +1 -1
  77. package/generators/entity-client/templates/angular/src/main/webapp/app/entities/update/entity-form.service.ts.ejs +1 -1
  78. package/generators/entity-client/templates/vue/src/main/webapp/app/entities/entity.component.ts.ejs +2 -2
  79. package/generators/entity-server/templates/src/main/java/package/common/delete_template.ejs +7 -3
  80. package/generators/entity-server/templates/src/main/java/package/common/get_all_template.ejs +2 -2
  81. package/generators/entity-server/templates/src/main/java/package/domain/Entity.java.jhi.ejs +15 -5
  82. package/generators/entity-server/templates/src/main/java/package/domain/Entity.java.jhi.spring_data_persistable.ejs +8 -1
  83. package/generators/entity-server/templates/src/main/java/package/repository/EntityRepositoryInternalImpl_reactive.java.ejs +5 -0
  84. package/generators/entity-server/templates/src/main/java/package/service/EntityQueryService.java.ejs +4 -4
  85. package/generators/entity-server/templates/src/main/java/package/service/EntityService.java.ejs +6 -4
  86. package/generators/entity-server/templates/src/main/java/package/service/criteria/EntityCriteria.java.ejs +3 -26
  87. package/generators/entity-server/templates/src/main/java/package/service/dto/EntityDTO.java.ejs +1 -0
  88. package/generators/entity-server/templates/src/main/java/package/service/impl/EntityServiceImpl.java.ejs +1 -1
  89. package/generators/entity-server/templates/src/test/java/package/web/rest/EntityResourceIT.java.ejs +33 -28
  90. package/generators/generate-blueprint/constants.mjs +46 -6
  91. package/generators/generate-blueprint/esm.mjs +0 -0
  92. package/generators/generate-blueprint/files.mjs +7 -5
  93. package/generators/generate-blueprint/generator.mjs +73 -19
  94. package/generators/generate-blueprint/templates/cli/cli.mjs.ejs +0 -0
  95. package/generators/generate-blueprint/templates/generators/generator/generator.spec.mjs.ejs +1 -1
  96. package/generators/generate-blueprint/templates/generators/generator/templates/template-file.ejs +0 -0
  97. package/generators/generator-base-blueprint.js +23 -1
  98. package/generators/generator-base-entities.cjs +5 -1
  99. package/generators/generator-base.js +82 -15
  100. package/generators/generator-constants.js +17 -23
  101. package/generators/init/templates/.husky/pre-commit +0 -0
  102. package/generators/kubernetes/templates/deployment.yml.ejs +1 -1
  103. package/generators/kubernetes/templates/ingress.yml.ejs +1 -1
  104. package/generators/kubernetes/templates/istio/gateway.yml.ejs +1 -1
  105. package/generators/kubernetes/templates/kubectl-apply.sh.ejs +0 -0
  106. package/generators/kubernetes/templates/kustomize/kustomization.yml.ejs +1 -1
  107. package/generators/kubernetes/templates/service.yml.ejs +1 -1
  108. package/generators/kubernetes-knative/templates/istio/gateway.yml.ejs +1 -1
  109. package/generators/kubernetes-knative/templates/kubectl-apply.sh.ejs +0 -0
  110. package/generators/kubernetes-knative/templates/service.yml.ejs +3 -3
  111. package/generators/languages/templates/src/main/webapp/i18n/al/health.json.ejs +1 -1
  112. package/generators/languages/templates/src/main/webapp/i18n/ar-ly/health.json.ejs +1 -1
  113. package/generators/languages/templates/src/main/webapp/i18n/bg/health.json.ejs +1 -1
  114. package/generators/languages/templates/src/main/webapp/i18n/bn/health.json.ejs +1 -1
  115. package/generators/languages/templates/src/main/webapp/i18n/by/health.json.ejs +1 -1
  116. package/generators/languages/templates/src/main/webapp/i18n/ca/health.json.ejs +1 -1
  117. package/generators/languages/templates/src/main/webapp/i18n/cs/health.json.ejs +1 -1
  118. package/generators/languages/templates/src/main/webapp/i18n/da/health.json.ejs +1 -1
  119. package/generators/languages/templates/src/main/webapp/i18n/de/health.json.ejs +1 -1
  120. package/generators/languages/templates/src/main/webapp/i18n/el/activate.json.ejs +1 -1
  121. package/generators/languages/templates/src/main/webapp/i18n/el/health.json.ejs +1 -1
  122. package/generators/languages/templates/src/main/webapp/i18n/el/password.json +1 -1
  123. package/generators/languages/templates/src/main/webapp/i18n/el/register.json +3 -3
  124. package/generators/languages/templates/src/main/webapp/i18n/el/tracker.json +1 -1
  125. package/generators/languages/templates/src/main/webapp/i18n/el/user-management.json +9 -9
  126. package/generators/languages/templates/src/main/webapp/i18n/en/health.json.ejs +1 -1
  127. package/generators/languages/templates/src/main/webapp/i18n/es/health.json.ejs +1 -1
  128. package/generators/languages/templates/src/main/webapp/i18n/et/health.json.ejs +1 -1
  129. package/generators/languages/templates/src/main/webapp/i18n/fa/health.json.ejs +1 -1
  130. package/generators/languages/templates/src/main/webapp/i18n/fi/health.json.ejs +1 -1
  131. package/generators/languages/templates/src/main/webapp/i18n/fr/health.json.ejs +1 -1
  132. package/generators/languages/templates/src/main/webapp/i18n/gl/health.json.ejs +1 -1
  133. package/generators/languages/templates/src/main/webapp/i18n/hi/health.json.ejs +1 -1
  134. package/generators/languages/templates/src/main/webapp/i18n/hr/health.json.ejs +1 -1
  135. package/generators/languages/templates/src/main/webapp/i18n/hu/health.json.ejs +1 -1
  136. package/generators/languages/templates/src/main/webapp/i18n/hy/health.json.ejs +1 -1
  137. package/generators/languages/templates/src/main/webapp/i18n/in/health.json.ejs +1 -1
  138. package/generators/languages/templates/src/main/webapp/i18n/it/health.json.ejs +1 -1
  139. package/generators/languages/templates/src/main/webapp/i18n/ja/health.json.ejs +1 -1
  140. package/generators/languages/templates/src/main/webapp/i18n/ko/health.json.ejs +1 -1
  141. package/generators/languages/templates/src/main/webapp/i18n/mr/health.json.ejs +1 -1
  142. package/generators/languages/templates/src/main/webapp/i18n/my/health.json.ejs +1 -1
  143. package/generators/languages/templates/src/main/webapp/i18n/nl/health.json.ejs +1 -1
  144. package/generators/languages/templates/src/main/webapp/i18n/pa/health.json.ejs +1 -1
  145. package/generators/languages/templates/src/main/webapp/i18n/pl/health.json.ejs +1 -1
  146. package/generators/languages/templates/src/main/webapp/i18n/pt-br/health.json.ejs +1 -1
  147. package/generators/languages/templates/src/main/webapp/i18n/pt-pt/health.json.ejs +1 -1
  148. package/generators/languages/templates/src/main/webapp/i18n/ro/health.json.ejs +1 -1
  149. package/generators/languages/templates/src/main/webapp/i18n/ru/health.json.ejs +1 -1
  150. package/generators/languages/templates/src/main/webapp/i18n/si/health.json.ejs +1 -1
  151. package/generators/languages/templates/src/main/webapp/i18n/sk/health.json.ejs +1 -1
  152. package/generators/languages/templates/src/main/webapp/i18n/sr/health.json.ejs +1 -1
  153. package/generators/languages/templates/src/main/webapp/i18n/sv/health.json.ejs +1 -1
  154. package/generators/languages/templates/src/main/webapp/i18n/ta/health.json.ejs +1 -1
  155. package/generators/languages/templates/src/main/webapp/i18n/te/health.json.ejs +1 -1
  156. package/generators/languages/templates/src/main/webapp/i18n/th/health.json.ejs +1 -1
  157. package/generators/languages/templates/src/main/webapp/i18n/tr/health.json.ejs +1 -1
  158. package/generators/languages/templates/src/main/webapp/i18n/ua/health.json.ejs +1 -1
  159. package/generators/languages/templates/src/main/webapp/i18n/uz-Latn-uz/health.json.ejs +1 -1
  160. package/generators/languages/templates/src/main/webapp/i18n/vi/health.json.ejs +1 -1
  161. package/generators/languages/templates/src/main/webapp/i18n/zh-cn/health.json.ejs +1 -1
  162. package/generators/languages/templates/src/main/webapp/i18n/zh-tw/health.json.ejs +1 -1
  163. package/generators/maven/templates/mvnw +0 -0
  164. package/generators/openshift/templates/deployment.yml.ejs +2 -2
  165. package/generators/server/cleanup-elasticsearch.js +5 -0
  166. package/generators/server/files.js +17 -8
  167. package/generators/server/index.js +0 -2
  168. package/generators/server/templates/build.gradle.ejs +6 -14
  169. package/generators/server/templates/gradle/profile_dev.gradle.ejs +1 -1
  170. package/generators/server/templates/gradle/profile_prod.gradle.ejs +1 -1
  171. package/generators/server/templates/gradle.properties.ejs +6 -4
  172. package/generators/server/templates/gradlew +0 -0
  173. package/generators/server/templates/mvnw +0 -0
  174. package/generators/server/templates/npmw +0 -0
  175. package/generators/server/templates/npmw.cmd +31 -29
  176. package/generators/server/templates/package.json.ejs +2 -2
  177. package/generators/server/templates/pom.xml.ejs +12 -23
  178. package/generators/server/templates/sql/common/src/test/java/package/config/MsSqlTestContainer.java.ejs +2 -3
  179. package/generators/server/templates/src/main/docker/app.yml.ejs +7 -1
  180. package/generators/server/templates/src/main/docker/config/realm-config/jhipster-realm.json.ejs +32 -14
  181. package/generators/server/templates/src/main/docker/jhipster-control-center.yml.ejs +1 -1
  182. package/generators/server/templates/src/main/docker/prometheus/prometheus.yml.ejs +1 -1
  183. package/generators/server/templates/src/main/java/package/Application.java.ejs +11 -4
  184. package/generators/server/templates/src/main/java/package/config/CRLFLogConverter.java.ejs +57 -0
  185. package/generators/server/templates/src/main/java/package/config/EurekaWorkaroundConfiguration.java.ejs +49 -0
  186. package/generators/server/templates/src/main/java/package/config/LoggingConfiguration.java.ejs +4 -4
  187. package/generators/server/templates/src/main/java/package/config/SecurityConfiguration.java.ejs +17 -18
  188. package/generators/server/templates/src/main/java/package/config/SecurityConfiguration_reactive.java.ejs +13 -5
  189. package/generators/server/templates/src/main/java/package/domain/AbstractAuditingEntity.java.ejs +5 -6
  190. package/generators/server/templates/src/main/java/package/domain/User.java.ejs +1 -1
  191. package/generators/server/templates/src/main/java/package/repository/UserRepository.java.ejs +1 -1
  192. package/generators/server/templates/src/main/java/package/security/oauth2/CustomClaimConverter.java.ejs +13 -6
  193. package/generators/server/templates/src/main/java/package/service/dto/AdminUserDTO.java.ejs +3 -1
  194. package/generators/server/templates/src/main/java/package/service/dto/PasswordChangeDTO.java.ejs +5 -1
  195. package/generators/server/templates/src/main/java/package/service/dto/UserDTO.java.ejs +3 -1
  196. package/generators/server/templates/src/main/java/package/web/rest/UserResource.java.ejs +15 -42
  197. package/generators/server/templates/src/main/java/package/web/rest/errors/BadRequestAlertException.java.ejs +1 -0
  198. package/generators/server/templates/src/main/java/package/web/rest/errors/EmailAlreadyUsedException.java.ejs +1 -0
  199. package/generators/server/templates/src/main/java/package/web/rest/errors/InvalidPasswordException.java.ejs +1 -0
  200. package/generators/server/templates/src/main/java/package/web/rest/errors/LoginAlreadyUsedException.java.ejs +1 -0
  201. package/generators/server/templates/src/main/resources/config/application-dev.yml.ejs +1 -1
  202. package/generators/server/templates/src/main/resources/config/application-prod.yml.ejs +3 -3
  203. package/generators/server/templates/src/main/resources/config/application.yml.ejs +4 -2
  204. package/generators/server/templates/src/main/resources/config/liquibase/master.xml.ejs +3 -8
  205. package/generators/server/templates/src/main/resources/logback-spring.xml.ejs +5 -0
  206. package/generators/server/templates/src/test/java/package/config/{ElasticsearchReactiveTestConfiguration.java.ejs → ElasticsearchTestConfiguration.java.ejs} +3 -3
  207. package/generators/server/templates/src/test/java/package/config/ElasticsearchTestContainer.java.ejs +1 -0
  208. package/generators/server/templates/src/test/java/package/config/JHipsterBlockHoundIntegration.java.ejs +3 -0
  209. package/generators/server/templates/src/test/java/package/config/TestContainersSpringContextCustomizerFactory.java.ejs +2 -2
  210. package/generators/sql-constants.js +5 -2
  211. package/generators/utils.js +43 -3
  212. package/generators/workspaces/index.js +2 -1
  213. package/jdl/exporters/jdl-exporter.js +6 -1
  214. package/jdl/jhipster/application-options.js +2 -1
  215. package/jdl/jhipster/binary-options.js +2 -2
  216. package/jdl/jhipster/default-application-options.js +11 -8
  217. package/jdl/jhipster/entity-options.js +1 -0
  218. package/jdl/jhipster/search-engine-types.js +1 -0
  219. package/lib/constants/priorities.cjs +16 -0
  220. package/lib/constants/priorities.mjs +1 -0
  221. package/lib/index.js +2 -0
  222. package/lib/support/base.cjs +2 -1
  223. package/package.json +7 -6
  224. package/utils/blueprint.js +10 -0
  225. package/utils/field.js +9 -9
  226. package/generators/client/templates/react/src/main/webapp/app/config/translation-middleware.ts.ejs +0 -58
  227. package/generators/server/templates/.npmrc.ejs +0 -1
@@ -19,25 +19,17 @@
19
19
  package <%= packageName %>.web.rest;
20
20
 
21
21
  import <%= packageName %>.config.Constants;
22
- <%_ if (!authenticationTypeOauth2) { _%>
23
22
  import <%= packageName %>.domain.<%= asEntity('User') %>;
24
- <%_ } _%>
25
- <%_ if (!authenticationTypeOauth2) { _%>
26
23
  import <%= packageName %>.repository.UserRepository;
27
- <%_ } _%>
28
24
  import <%= packageName %>.security.AuthoritiesConstants;
29
- <%_ if (!authenticationTypeOauth2) { _%>
30
25
  import <%= packageName %>.service.MailService;
31
26
  import org.springframework.data.domain.Sort;
32
27
  import java.util.Collections;
33
- <%_ } _%>
34
28
  import <%= packageName %>.service.UserService;
35
29
  import <%= packageName %>.service.dto.<%= asDto('AdminUser') %>;
36
- <%_ if (!authenticationTypeOauth2) { _%>
37
30
  import <%= packageName %>.web.rest.errors.BadRequestAlertException;
38
31
  import <%= packageName %>.web.rest.errors.EmailAlreadyUsedException;
39
32
  import <%= packageName %>.web.rest.errors.LoginAlreadyUsedException;
40
- <%_ } _%>
41
33
 
42
34
  import tech.jhipster.web.util.HeaderUtil;
43
35
  <%_ if (databaseTypeSql || databaseTypeMongodb || databaseTypeNeo4j || databaseTypeCouchbase) { _%>
@@ -78,18 +70,15 @@ import org.springframework.web.servlet.support.ServletUriComponentsBuilder;
78
70
  <%_ } _%>
79
71
 
80
72
  import javax.validation.constraints.Pattern;
81
- <%_ if (!authenticationTypeOauth2) { _%>
82
73
  import javax.validation.Valid;
83
74
  import java.net.URI;
84
75
  import java.net.URISyntaxException;
85
- <%_ } _%>
86
- <%_ if (!reactive) { _%>
87
- import java.util.*;
88
- <%_ } _%>
89
76
  <%_ if (reactive) { _%>
90
77
  import java.util.ArrayList;
91
78
  import java.util.List;
92
79
  import java.util.Arrays;
80
+ <%_ } else { _%>
81
+ import java.util.*;
93
82
  <%_ } _%>
94
83
  <%_ if (searchEngineElasticsearch && !reactive) { _%>
95
84
  import java.util.stream.Collectors;
@@ -101,7 +90,7 @@ import static org.elasticsearch.index.query.QueryBuilders.*;
101
90
  /**
102
91
  * REST controller for managing users.
103
92
  * <p>
104
- * This class accesses the {@link <% if (!(!authenticationTypeOauth2 || searchEngineElasticsearch)) { %><%= packageName %>.domain.<% } %><%= asEntity('User') %>} entity, and needs to fetch its collection of authorities.
93
+ * This class accesses the {@link <%= packageName %>.domain.<%= user.persistClass %>} entity, and needs to fetch its collection of authorities.
105
94
  * <p>
106
95
  * For a normal use-case, it would be better to have an eager relationship between User and Authority,
107
96
  * and send everything to the client side: there would be no View Model and DTO, a lot less code, and an outer-join
@@ -125,10 +114,8 @@ import static org.elasticsearch.index.query.QueryBuilders.*;
125
114
  @RestController
126
115
  @RequestMapping("/api/admin")
127
116
  public class UserResource {
128
- <%_ if (!authenticationTypeOauth2) { _%>
129
117
  private static final List<String> ALLOWED_ORDERED_PROPERTIES = Collections.unmodifiableList(Arrays.asList(
130
118
  "id", "login", "firstName", "lastName", "email", "activated", "langKey", "createdBy", "createdDate", "lastModifiedBy", "lastModifiedDate"));
131
- <%_ } _%>
132
119
 
133
120
  private final Logger log = LoggerFactory.getLogger(UserResource.class);
134
121
 
@@ -136,22 +123,17 @@ public class UserResource {
136
123
  private String applicationName;
137
124
 
138
125
  private final UserService userService;
139
- <%_ if (!authenticationTypeOauth2) { _%>
140
126
 
141
127
  private final UserRepository userRepository;
142
128
 
143
129
  private final MailService mailService;
144
- <%_ } _%>
145
130
 
146
- public UserResource(UserService userService<% if (!authenticationTypeOauth2) { %>, UserRepository userRepository, MailService mailService<% } %>) {
131
+ public UserResource(UserService userService, UserRepository userRepository, MailService mailService) {
147
132
  this.userService = userService;
148
- <%_ if (!authenticationTypeOauth2) { _%>
149
133
  this.userRepository = userRepository;
150
134
  this.mailService = mailService;
151
- <%_ } _%>
152
135
  }
153
136
 
154
- <%_ if (!authenticationTypeOauth2) { _%>
155
137
  /**
156
138
  * {@code POST /admin/users} : Creates a new user.
157
139
  * <p>
@@ -161,9 +143,9 @@ public class UserResource {
161
143
  *
162
144
  * @param userDTO the user to create.
163
145
  * @return the {@link ResponseEntity} with status {@code 201 (Created)} and with body the new user, or with status {@code 400 (Bad Request)} if the login or email is already in use.
164
- <%_ if (!reactive) { _%>
146
+ <%_ if (!reactive) { _%>
165
147
  * @throws URISyntaxException if the Location URI syntax is incorrect.
166
- <%_ } _%>
148
+ <%_ } _%>
167
149
  * @throws BadRequestAlertException {@code 400 (Bad Request)} if the login or email is already in use.
168
150
  */
169
151
  @PostMapping("/users")
@@ -174,7 +156,7 @@ public class UserResource {
174
156
  if (userDTO.getId() != null) {
175
157
  throw new BadRequestAlertException("A new user cannot already have an ID", "userManagement", "idexists");
176
158
  // Lowercase the user login before comparing with database
177
- <%_ if (reactive) { _%>
159
+ <%_ if (reactive) { _%>
178
160
  }
179
161
  return userRepository.findOneByLogin(userDTO.getLogin().toLowerCase())
180
162
  .hasElement()
@@ -201,7 +183,7 @@ public class UserResource {
201
183
  throw new RuntimeException(e);
202
184
  }
203
185
  });
204
- <%_ } else { _%>
186
+ <%_ } else { _%>
205
187
  } else if (userRepository.findOneByLogin(userDTO.getLogin().toLowerCase()).isPresent()) {
206
188
  throw new LoginAlreadyUsedException();
207
189
  } else if (userRepository.findOneByEmailIgnoreCase(userDTO.getEmail()).isPresent()) {
@@ -213,7 +195,7 @@ public class UserResource {
213
195
  .headers(HeaderUtil.createAlert(applicationName, <% if (enableTranslation) { %> "userManagement.created"<% } else { %> "A user is created with identifier " + newUser.getLogin()<% } %>, newUser.getLogin()))
214
196
  .body(newUser);
215
197
  }
216
- <%_ } _%>
198
+ <%_ } _%>
217
199
  }
218
200
 
219
201
  /**
@@ -226,7 +208,7 @@ public class UserResource {
226
208
  */
227
209
  @PutMapping("/users")
228
210
  @PreAuthorize("hasAuthority(\"" + AuthoritiesConstants.ADMIN + "\")")
229
- <%_ if (reactive) { _%>
211
+ <%_ if (reactive) { _%>
230
212
  public Mono<ResponseEntity<<%= asDto('AdminUser') %>>> updateUser(@Valid @RequestBody <%= asDto('AdminUser') %> userDTO) {
231
213
  log.debug("REST request to update User : {}", userDTO);
232
214
  return userRepository.findOneByEmailIgnoreCase(userDTO.getEmail())
@@ -251,7 +233,7 @@ public class UserResource {
251
233
  .headers(HeaderUtil.createAlert(applicationName, <% if (enableTranslation) { %>"userManagement.updated"<% } else { %>"A user is updated with identifier " + userDTO.getLogin()<% } %>, userDTO.getLogin()))
252
234
  .body(user)
253
235
  );
254
- <%_ } else { _%>
236
+ <%_ } else { _%>
255
237
  public ResponseEntity<<%= asDto('AdminUser') %>> updateUser(@Valid @RequestBody <%= asDto('AdminUser') %> userDTO) {
256
238
  log.debug("REST request to update User : {}", userDTO);
257
239
  Optional<<%= asEntity('User') %>> existingUser = userRepository.findOneByEmailIgnoreCase(userDTO.getEmail());
@@ -266,10 +248,9 @@ public class UserResource {
266
248
 
267
249
  return ResponseUtil.wrapOrNotFound(updatedUser,
268
250
  HeaderUtil.createAlert(applicationName, <% if (enableTranslation) { %>"userManagement.updated"<% } else { %>"A user is updated with identifier " + userDTO.getLogin()<% } %>, userDTO.getLogin()));
269
- <%_ } _%>
251
+ <%_ } _%>
270
252
  }
271
253
 
272
- <%_ } _%>
273
254
  /**
274
255
  * {@code GET /admin/users} : get all users with all the details - calling this are only allowed for the administrators.
275
256
  *<% if (databaseTypeSql || databaseTypeMongodb || databaseTypeNeo4j || databaseTypeCouchbase) { %>
@@ -285,11 +266,9 @@ public class UserResource {
285
266
  <%_ if (reactive) { _%>
286
267
  public Mono<ResponseEntity<Flux<<%= asDto('AdminUser') %>>>> getAllUsers(@org.springdoc.api.annotations.ParameterObject ServerHttpRequest request, @org.springdoc.api.annotations.ParameterObject Pageable pageable) {
287
268
  log.debug("REST request to get all User for an admin");
288
- <%_ if (!authenticationTypeOauth2) { _%>
289
269
  if (!onlyContainsAllowedProperties(pageable)) {
290
270
  return Mono.just(ResponseEntity.badRequest().build());
291
271
  }
292
- <%_ } _%>
293
272
 
294
273
  return userService.countManagedUsers()
295
274
  .map(total -> new PageImpl<>(new ArrayList<>(), pageable, total))
@@ -298,11 +277,9 @@ public class UserResource {
298
277
  <%_ } else { _%>
299
278
  public ResponseEntity<List<<%= asDto('AdminUser') %>>> getAllUsers(@org.springdoc.api.annotations.ParameterObject Pageable pageable) {
300
279
  log.debug("REST request to get all User for an admin");
301
- <%_ if (!authenticationTypeOauth2) { _%>
302
280
  if (!onlyContainsAllowedProperties(pageable)) {
303
281
  return ResponseEntity.badRequest().build();
304
282
  }
305
- <%_ } _%>
306
283
 
307
284
  final Page<<%= asDto('AdminUser') %>> page = userService.getAllManagedUsers(pageable);
308
285
  HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(ServletUriComponentsBuilder.fromCurrentRequest(), page);
@@ -310,11 +287,9 @@ public class UserResource {
310
287
  <%_ } _%>
311
288
  }
312
289
 
313
- <%_ if (!authenticationTypeOauth2) { _%>
314
290
  private boolean onlyContainsAllowedProperties(Pageable pageable) {
315
291
  return pageable.getSort().stream().map(Sort.Order::getProperty).allMatch(ALLOWED_ORDERED_PROPERTIES::contains);
316
292
  }
317
- <%_ } _%>
318
293
 
319
294
  <%_ } else { /* Cassandra */ _%>
320
295
  public <% if (reactive) { %>Flux<% } else { %>List<% } %><<%= asDto('AdminUser') %>> getAllUsers() {
@@ -346,7 +321,6 @@ public class UserResource {
346
321
  .map(<%= asDto('AdminUser') %>::new));
347
322
  <%_ } _%>
348
323
  }
349
- <%_ if (!authenticationTypeOauth2) { _%>
350
324
 
351
325
  /**
352
326
  * {@code DELETE /admin/users/:login} : delete the "login" User.
@@ -356,17 +330,16 @@ public class UserResource {
356
330
  */
357
331
  @DeleteMapping("/users/{login}")
358
332
  @PreAuthorize("hasAuthority(\"" + AuthoritiesConstants.ADMIN + "\")")
359
- <%_ if (reactive) { _%>
333
+ <%_ if (reactive) { _%>
360
334
  public Mono<ResponseEntity<Void>> deleteUser(@PathVariable @Pattern(regexp = Constants.LOGIN_REGEX) String login) {
361
335
  log.debug("REST request to delete User: {}", login);
362
336
  return userService.deleteUser(login)
363
337
  .then(Mono.just(ResponseEntity.noContent().headers(HeaderUtil.createAlert( applicationName, <% if (enableTranslation) { %> "userManagement.deleted"<% } else { %> "A user is deleted with identifier " + login<% } %>, login)).build()));
364
- <%_ } else { _%>
338
+ <%_ } else { _%>
365
339
  public ResponseEntity<Void> deleteUser(@PathVariable @Pattern(regexp = Constants.LOGIN_REGEX) String login) {
366
340
  log.debug("REST request to delete User: {}", login);
367
341
  userService.deleteUser(login);
368
342
  return ResponseEntity.noContent().headers(HeaderUtil.createAlert(applicationName, <% if (enableTranslation) { %> "userManagement.deleted"<% } else { %> "A user is deleted with identifier " + login<% } %>, login)).build();
369
- <%_ } _%>
370
- }
371
343
  <%_ } _%>
344
+ }
372
345
  }
@@ -25,6 +25,7 @@ import java.net.URI;
25
25
  import java.util.HashMap;
26
26
  import java.util.Map;
27
27
 
28
+ @SuppressWarnings("java:S110") // Inheritance tree of classes should not be too deep
28
29
  public class BadRequestAlertException extends AbstractThrowableProblem {
29
30
 
30
31
  private static final long serialVersionUID = 1L;
@@ -18,6 +18,7 @@
18
18
  -%>
19
19
  package <%= packageName %>.web.rest.errors;
20
20
 
21
+ @SuppressWarnings("java:S110") // Inheritance tree of classes should not be too deep
21
22
  public class EmailAlreadyUsedException extends BadRequestAlertException {
22
23
 
23
24
  private static final long serialVersionUID = 1L;
@@ -21,6 +21,7 @@ package <%= packageName %>.web.rest.errors;
21
21
  import org.zalando.problem.AbstractThrowableProblem;
22
22
  import org.zalando.problem.Status;
23
23
 
24
+ @SuppressWarnings("java:S110") // Inheritance tree of classes should not be too deep
24
25
  public class InvalidPasswordException extends AbstractThrowableProblem {
25
26
 
26
27
  private static final long serialVersionUID = 1L;
@@ -18,6 +18,7 @@
18
18
  -%>
19
19
  package <%= packageName %>.web.rest.errors;
20
20
 
21
+ @SuppressWarnings("java:S110") // Inheritance tree of classes should not be too deep
21
22
  public class LoginAlreadyUsedException extends BadRequestAlertException {
22
23
 
23
24
  private static final long serialVersionUID = 1L;
@@ -251,7 +251,7 @@ spring:
251
251
  <%_ } _%>
252
252
  thymeleaf:
253
253
  cache: false
254
- <%_ if (serviceDiscoveryType || applicationTypeGateway || applicationTypeMicroservice) { _%>
254
+ <%_ if (serviceDiscoveryAny || applicationTypeGateway || applicationTypeMicroservice) { _%>
255
255
  sleuth:
256
256
  # https://github.com/spring-projects/spring-framework/issues/27844#issuescomment-1002866885
257
257
  # https://github.com/spring-cloud/spring-cloud-sleuth/issues/2094
@@ -207,7 +207,7 @@ spring:
207
207
  <%_ } _%>
208
208
  thymeleaf:
209
209
  cache: true
210
- <%_ if (serviceDiscoveryType || applicationTypeGateway || applicationTypeMicroservice) { _%>
210
+ <%_ if (serviceDiscoveryAny || applicationTypeGateway || applicationTypeMicroservice) { _%>
211
211
  sleuth:
212
212
  # https://github.com/spring-projects/spring-framework/issues/27844#issuescomment-1002866885
213
213
  # https://github.com/spring-cloud/spring-cloud-sleuth/issues/2094
@@ -229,7 +229,7 @@ spring:
229
229
  # keytool -genkey -alias <%= baseName.toLowerCase() %> -storetype PKCS12 -keyalg RSA -keysize 2048 -keystore keystore.p12 -validity 3650
230
230
  #
231
231
  # You can also use Let's Encrypt:
232
- # https://maximilian-boehm.com/hp2121/Create-a-Java-Keystore-JKS-from-Let-s-Encrypt-Certificates.htm
232
+ # See details in topic "Create a Java Keystore (.JKS) from Let's Encrypt Certificates" on https://maximilian-boehm.com/en-gb/blog
233
233
  #
234
234
  # Then, modify the server.ssl properties so your "server" configuration looks like:
235
235
  #
@@ -258,7 +258,7 @@ server:
258
258
  # ===================================================================
259
259
 
260
260
  jhipster:
261
- <%_ if (applicationTypeGateway && cacheProviderHazelcast && serviceDiscoveryType) { _%>
261
+ <%_ if (applicationTypeGateway && cacheProviderHazelcast && serviceDiscoveryAny) { _%>
262
262
  gateway:
263
263
  rate-limiting:
264
264
  enabled: false
@@ -368,10 +368,12 @@ jhipster:
368
368
  license: unlicensed
369
369
  license-url:
370
370
  security:
371
- <%_ if (clientTheme !== 'none') { _%>
371
+ <%_ if(!skipClient) { _%>
372
+ <%_ if (clientTheme !== 'none') { _%>
372
373
  content-security-policy: "default-src 'self'; frame-src 'self' data:; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://storage.googleapis.com; style-src 'self' https://fonts.googleapis.com 'unsafe-inline'; img-src 'self' data:; font-src 'self' https://fonts.gstatic.com data:"
373
- <%_ } else { _%>
374
+ <%_ } else { _%>
374
375
  content-security-policy: "default-src 'self'; frame-src 'self' data:; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://storage.googleapis.com; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self' data:"
376
+ <%_ } _%>
375
377
  <%_ } _%>
376
378
  <%_ if (authenticationTypeOauth2) { _%>
377
379
  oauth2:
@@ -12,17 +12,12 @@
12
12
  <property name="uuidType" value="uuid" dbms="h2"/>
13
13
  <%_ } _%>
14
14
  <property name="datetimeType" value="datetime" dbms="h2"/>
15
- <%_ if (reactive) { _%>
16
- <property name="clobType" value="varchar(1000000)" dbms="h2"/>
17
- <property name="blobType" value="varchar(1000000)" dbms="h2"/>
18
- <%_ } else { _%>
19
- <%_ if (prodDatabaseTypePostgres) { _%>
15
+ <%_ if (prodDatabaseTypePostgres) { _%>
20
16
  <property name="clobType" value="longvarchar" dbms="h2"/>
21
- <%_ } else { _%>
17
+ <%_ } else { _%>
22
18
  <property name="clobType" value="clob" dbms="h2"/>
23
- <%_ } _%>
24
- <property name="blobType" value="blob" dbms="h2"/>
25
19
  <%_ } _%>
20
+ <property name="blobType" value="blob" dbms="h2"/>
26
21
  <%_ } _%>
27
22
  <%_ if (devDatabaseTypeMysql || prodDatabaseTypeMysql) { _%>
28
23
  <property name="now" value="now()" dbms="mysql"/>
@@ -20,6 +20,11 @@
20
20
  <!DOCTYPE configuration>
21
21
 
22
22
  <configuration scan="true">
23
+ <!-- Patterns based on https://github.com/spring-projects/spring-boot/blob/v2.7.2/spring-boot-project/spring-boot/src/main/resources/org/springframework/boot/logging/logback/defaults.xml -->
24
+ <conversionRule conversionWord="crlf" converterClass="<%= packageName %>.config.CRLFLogConverter" />
25
+ <property name="CONSOLE_LOG_PATTERN" value="${CONSOLE_LOG_PATTERN:-%clr(%d{${LOG_DATEFORMAT_PATTERN:-yyyy-MM-dd'T'HH:mm:ss.SSSXXX}}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %crlf(%m){red} %n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
26
+ <property name="FILE_LOG_PATTERN" value="${FILE_LOG_PATTERN:-%d{${LOG_DATEFORMAT_PATTERN:-yyyy-MM-dd HH:mm:ss.SSS}} ${LOG_LEVEL_PATTERN:-%5p} ${PID:- } --- [%t] %-40.40logger{39} : %crlf(%m) %n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
27
+
23
28
  <include resource="org/springframework/boot/logging/logback/base.xml"/>
24
29
 
25
30
  <!-- The FILE and ASYNC appenders are here as examples for a production configuration -->
@@ -22,13 +22,13 @@ import javax.annotation.PostConstruct;
22
22
 
23
23
  import org.springframework.beans.factory.annotation.Autowired;
24
24
  import org.springframework.context.annotation.Configuration;
25
- import org.springframework.data.elasticsearch.core.ReactiveElasticsearchTemplate;
25
+ import org.springframework.data.elasticsearch.core.<%= reactive ? 'ReactiveElasticsearchTemplate' : 'ElasticsearchRestTemplate' %>;
26
26
  import org.springframework.data.elasticsearch.core.RefreshPolicy;
27
27
 
28
28
  @Configuration
29
- public class ElasticsearchReactiveTestConfiguration {
29
+ public class ElasticsearchTestConfiguration {
30
30
  @Autowired
31
- ReactiveElasticsearchTemplate template;
31
+ <%= reactive ? 'ReactiveElasticsearchTemplate' : 'ElasticsearchRestTemplate' %> template;
32
32
 
33
33
  @PostConstruct
34
34
  public void configureTemplate() {
@@ -53,6 +53,7 @@ public class ElasticsearchTestContainer implements InitializingBean, DisposableB
53
53
  .withStartupTimeout(Duration.of(CONTAINER_STARTUP_TIMEOUT_MINUTES, ChronoUnit.MINUTES))
54
54
  .withSharedMemorySize(256000000L)
55
55
  .withEnv("ES_JAVA_OPTS", "-Xms256m -Xmx256m")
56
+ .withEnv("xpack.security.enabled", "false")
56
57
  .withLogConsumer(new Slf4jLogConsumer(log))
57
58
  .withReuse(true);
58
59
  }
@@ -39,6 +39,9 @@ public class JHipsterBlockHoundIntegration implements BlockHoundIntegration {
39
39
  builder.allowBlockingCallsInside("org.mariadb.r2dbc.message.client.HandshakeResponse", "writeConnectAttributes");
40
40
  builder.allowBlockingCallsInside("org.mariadb.r2dbc.client.MariadbPacketDecoder", "decode");
41
41
  <%_} _%>
42
+ <%_ if (devDatabaseTypeMssql || prodDatabaseTypeMssql) { _%>
43
+ builder.allowBlockingCallsInside("io.r2dbc.mssql.client.ssl.TdsSslHandler", "createSslHandler");
44
+ <%_} _%>
42
45
  <%_ if (searchEngineElasticsearch) { _%>
43
46
  builder.allowBlockingCallsInside("org.elasticsearch.client.indices.CreateIndexRequest", "settings");
44
47
  <%_} _%>
@@ -145,7 +145,7 @@ public class TestContainersSpringContextCustomizerFactory implements ContextCust
145
145
  }
146
146
  }
147
147
  <%_ if (reactive) { _%>
148
- testValues = testValues.and("spring.r2dbc.url=" + devTestContainer.getTestContainer().getJdbcUrl().replace("jdbc", "r2dbc")<% if (devDatabaseTypeMysql) { %>.replace("mysql", "mariadb")<% } %> + "<%- getDBCExtraOption(devDatabaseType) %>");
148
+ testValues = testValues.and("spring.r2dbc.url=" + devTestContainer.getTestContainer().getJdbcUrl().replace("jdbc", "r2dbc")<% if (devDatabaseTypeMysql) { %>.replace("mysql", "mariadb")<% } else if (devDatabaseTypeMssql) { %>.replace(";encrypt=false", "")<% } %> + "<%- getDBCExtraOption(devDatabaseType) %>");
149
149
  testValues = testValues.and("spring.r2dbc.username=" + devTestContainer.getTestContainer().getUsername());
150
150
  testValues = testValues.and("spring.r2dbc.password=" + devTestContainer.getTestContainer().getPassword());
151
151
  testValues = testValues.and("spring.liquibase.url=" + devTestContainer.getTestContainer().getJdbcUrl() + "<%- getDBCExtraOption(devDatabaseType) %>" );
@@ -169,7 +169,7 @@ public class TestContainersSpringContextCustomizerFactory implements ContextCust
169
169
  }
170
170
  }
171
171
  <%_ if (reactive) { _%>
172
- testValues = testValues.and("spring.r2dbc.url=" + prodTestContainer.getTestContainer().getJdbcUrl().replace("jdbc", "r2dbc")<% if (prodDatabaseTypeMysql) { %>.replace("mysql", "mariadb")<% } %> + "<%- getDBCExtraOption(prodDatabaseType) %>");
172
+ testValues = testValues.and("spring.r2dbc.url=" + prodTestContainer.getTestContainer().getJdbcUrl().replace("jdbc", "r2dbc")<% if (prodDatabaseTypeMysql) { %>.replace("mysql", "mariadb")<% } else if (prodDatabaseTypeMssql) { %>.replace(";encrypt=false", "")<% } %> + "<%- getDBCExtraOption(prodDatabaseType) %>");
173
173
  testValues = testValues.and("spring.r2dbc.username=" + prodTestContainer.getTestContainer().getUsername());
174
174
  testValues = testValues.and("spring.r2dbc.password=" + prodTestContainer.getTestContainer().getPassword());
175
175
  testValues = testValues.and("spring.liquibase.url=" + prodTestContainer.getTestContainer().getJdbcUrl() + "<%- getDBCExtraOption(prodDatabaseType) %>");
@@ -24,6 +24,9 @@ const databaseData = {
24
24
  [MSSQL]: {
25
25
  protocolSuffix: 'sqlserver://',
26
26
  port: ':1433;database=',
27
+ jdbc: {
28
+ extraOptions: ';encrypt=false',
29
+ },
27
30
  r2dbc: {
28
31
  protocolSuffix: 'mssql://',
29
32
  port: ':1433/',
@@ -66,14 +69,14 @@ const databaseData = {
66
69
  [H2_DISK]: {
67
70
  protocolSuffix: 'h2:file:',
68
71
  useDirectory: true,
69
- extraOptions: ';DB_CLOSE_DELAY=-1',
72
+ extraOptions: ';DB_CLOSE_DELAY=-1;MODE=LEGACY',
70
73
  r2dbc: {
71
74
  protocolSuffix: 'h2:file://',
72
75
  },
73
76
  },
74
77
  [H2_MEMORY]: {
75
78
  protocolSuffix: 'h2:mem:',
76
- extraOptions: ';DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE',
79
+ extraOptions: ';DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE;MODE=LEGACY',
77
80
  r2dbc: {
78
81
  protocolSuffix: 'h2:mem:///',
79
82
  },
@@ -32,6 +32,8 @@ const FileUtils = require('../jdl/utils/file-utils');
32
32
  const LANGUAGES_MAIN_SRC_DIR = `${__dirname}/languages/templates/${constants.CLIENT_MAIN_SRC_DIR}`;
33
33
 
34
34
  module.exports = {
35
+ detectCrLf,
36
+ normalizeLineEndings,
35
37
  rewrite,
36
38
  rewriteFile,
37
39
  replaceContent,
@@ -131,11 +133,49 @@ function escapeRegExp(str) {
131
133
  * @param {string} str string
132
134
  * @returns {string} string where CRLF is replaced with LF in Windows
133
135
  */
134
- function normalizeLineEndings(str) {
136
+ function normalizeWindowsLineEndings(str) {
135
137
  const isWin32 = os.platform() === 'win32';
136
138
  return isWin32 ? str.replace(/\r\n/g, '\n') : str;
137
139
  }
138
140
 
141
+ /**
142
+ * Replace line endings with the specified one.
143
+ *
144
+ * @param {string} str
145
+ * @param {string} lineEnding
146
+ * @returns {string} normalized line ending string
147
+ */
148
+ function normalizeLineEndings(str, lineEnding) {
149
+ return str.replace(/\r\n|\r|\n/g, lineEnding);
150
+ }
151
+
152
+ /**
153
+ * Detect the file first line endings
154
+ *
155
+ * @param {string} filePath
156
+ * @returns {boolean|undefined} true in case of crlf, false in case of lf, undefined for a single line file
157
+ */
158
+ function detectCrLf(filePath) {
159
+ return new Promise((resolve, reject) => {
160
+ let isCrlf;
161
+ const rs = fs.createReadStream(filePath, { encoding: 'utf8' });
162
+ rs.on('data', function (chunk) {
163
+ const n = chunk.indexOf('\n');
164
+ const r = chunk.indexOf('\r');
165
+ if (n !== -1 || r !== -1) {
166
+ isCrlf = n === -1 || (r !== -1 && r < n);
167
+ rs.close();
168
+ }
169
+ })
170
+ .on('close', function () {
171
+ resolve(isCrlf);
172
+ })
173
+ .on('error', function (err) {
174
+ reject(err);
175
+ });
176
+ });
177
+ }
178
+
139
179
  /**
140
180
  * Change spaces sequences and '>' to allow any number of spaces or new line prefix
141
181
  *
@@ -167,7 +207,7 @@ function rewrite(args) {
167
207
  re = escapeRegExp(re);
168
208
  }
169
209
  } else {
170
- re = args.splicable.map(line => `\\s*${escapeRegExp(normalizeLineEndings(line))}`).join('\n');
210
+ re = args.splicable.map(line => `\\s*${escapeRegExp(normalizeWindowsLineEndings(line))}`).join('\n');
171
211
  }
172
212
  if (!re.test) {
173
213
  if (args.prettierAware) {
@@ -176,7 +216,7 @@ function rewrite(args) {
176
216
  re = new RegExp(re);
177
217
  }
178
218
 
179
- if (re.test(normalizeLineEndings(args.haystack))) {
219
+ if (re.test(normalizeWindowsLineEndings(args.haystack))) {
180
220
  return args.haystack;
181
221
  }
182
222
 
@@ -238,7 +238,8 @@ module.exports = class extends BaseBlueprintGenerator {
238
238
  _getOtherScripts() {
239
239
  if (this.dockerCompose) {
240
240
  return {
241
- 'ci:e2e:prepare': 'docker-compose -f docker-compose/docker-compose.yml up -d',
241
+ 'docker-compose': 'docker-compose -f docker-compose/docker-compose.yml up -d',
242
+ 'ci:e2e:prepare': 'npm run docker-compose',
242
243
  'ci:e2e:teardown': 'docker-compose -f docker-compose/docker-compose.yml down -v',
243
244
  };
244
245
  }
@@ -27,10 +27,15 @@ module.exports = {
27
27
  * Writes down the given JDL to a file.
28
28
  * @param jdl the JDL to write.
29
29
  * @param path the path where the file will be written.
30
+ * @returns {string} file contents
30
31
  */
31
32
  function exportToJDL(jdl, path = 'app.jdl') {
32
33
  if (!jdl) {
33
34
  throw new Error('A JDLObject has to be passed to be exported.');
34
35
  }
35
- fs.writeFileSync(path, jdl.toString());
36
+ const fileContents = jdl.toString();
37
+ if (path) {
38
+ fs.writeFileSync(path, fileContents);
39
+ }
40
+ return fileContents;
36
41
  }
@@ -45,7 +45,7 @@ const cacheTypes = require('./cache-types');
45
45
  const NO_CACHE_PROVIDER = cacheTypes.NO;
46
46
 
47
47
  const { PROTRACTOR, CYPRESS, CUCUMBER, GATLING } = require('./test-framework-types');
48
- const { ANGULAR_X, ANGULAR, REACT, VUE, SVELTE } = require('./client-framework-types');
48
+ const { ANGULAR_X, ANGULAR, REACT, VUE, SVELTE, NO } = require('./client-framework-types');
49
49
  const { ELASTICSEARCH } = require('./search-engine-types');
50
50
  const searchEngines = require('./search-engine-types');
51
51
 
@@ -161,6 +161,7 @@ const optionValues = {
161
161
  [REACT]: REACT,
162
162
  [VUE]: VUE,
163
163
  [SVELTE]: SVELTE,
164
+ [NO]: NO,
164
165
  },
165
166
  [optionNames.CLIENT_PACKAGE_MANAGER]: {
166
167
  npm: 'npm',
@@ -27,7 +27,7 @@ const NO_SERVICE = ServiceTypes.NO;
27
27
  const { PAGINATION, INFINITE_SCROLL } = PaginationTypes;
28
28
  const NO_PAGINATION = PaginationTypes.NO;
29
29
 
30
- const { ELASTICSEARCH, COUCHBASE } = SearchTypes;
30
+ const { ELASTICSEARCH, COUCHBASE, NO: NO_SEARCH } = SearchTypes;
31
31
 
32
32
  const Options = {
33
33
  DTO: 'dto',
@@ -49,7 +49,7 @@ const Values = {
49
49
  'INFINITE-SCROLL': INFINITE_SCROLL,
50
50
  NO: NO_PAGINATION,
51
51
  },
52
- [Options.SEARCH]: { ELASTICSEARCH, COUCHBASE },
52
+ [Options.SEARCH]: { ELASTICSEARCH, COUCHBASE, NO: NO_SEARCH },
53
53
  };
54
54
 
55
55
  const DefaultValues = {
@@ -35,7 +35,7 @@ const serviceDiscoveryTypes = require('./service-discovery-types');
35
35
 
36
36
  const NO_SERVICE_DISCOVERY = serviceDiscoveryTypes.NO;
37
37
 
38
- const { ANGULAR, ANGULAR_X } = require('./client-framework-types');
38
+ const { ANGULAR, ANGULAR_X, NO: NO_CLIENT_FRAMEWORK } = require('./client-framework-types');
39
39
 
40
40
  const { MAVEN } = require('./build-tool-types');
41
41
 
@@ -118,7 +118,9 @@ function getConfigForMonolithApplication(customOptions = {}) {
118
118
  if (options[AUTHENTICATION_TYPE] === OAUTH2) {
119
119
  options[SKIP_USER_MANAGEMENT] = true;
120
120
  }
121
-
121
+ if (options[SKIP_CLIENT]) {
122
+ options[CLIENT_FRAMEWORK] = NO_CLIENT_FRAMEWORK;
123
+ }
122
124
  return {
123
125
  ...options,
124
126
  [APPLICATION_TYPE]: MONOLITH,
@@ -169,12 +171,11 @@ function getConfigForMicroserviceApplication(customOptions = {}) {
169
171
  [SKIP_USER_MANAGEMENT]: true,
170
172
  ...customOptions,
171
173
  };
172
- let skipClient = options[SKIP_CLIENT];
173
- if (skipClient === undefined) {
174
- skipClient = options[CLIENT_FRAMEWORK] === undefined;
174
+ if (options[SKIP_CLIENT] === undefined) {
175
+ options[SKIP_CLIENT] = options[CLIENT_FRAMEWORK] === undefined || options[CLIENT_FRAMEWORK] === NO_CLIENT_FRAMEWORK;
175
176
  }
176
- if (skipClient) {
177
- delete options[CLIENT_FRAMEWORK];
177
+ if (options[SKIP_CLIENT]) {
178
+ options[CLIENT_FRAMEWORK] = NO_CLIENT_FRAMEWORK;
178
179
  delete options[SKIP_SERVER];
179
180
  }
180
181
  delete options[CLIENT_THEME];
@@ -192,7 +193,6 @@ function getConfigForMicroserviceApplication(customOptions = {}) {
192
193
  return {
193
194
  ...options,
194
195
  [APPLICATION_TYPE]: MICROSERVICE,
195
- [SKIP_CLIENT]: skipClient,
196
196
  };
197
197
  }
198
198
 
@@ -227,6 +227,9 @@ function getDefaultConfigForNewApplication(customOptions = {}) {
227
227
  if (!options[PACKAGE_FOLDER] && options[PACKAGE_NAME]) {
228
228
  options[PACKAGE_FOLDER] = options[PACKAGE_NAME].replace(/\./g, '/');
229
229
  }
230
+ if (options[SKIP_CLIENT]) {
231
+ options[CLIENT_FRAMEWORK] = NO_CLIENT_FRAMEWORK;
232
+ }
230
233
  if (options[CLIENT_FRAMEWORK] === ANGULAR) {
231
234
  options[CLIENT_FRAMEWORK] = ANGULAR_X;
232
235
  }
@@ -36,6 +36,7 @@ const PaginationTypes = {
36
36
  const SearchTypes = {
37
37
  ELASTICSEARCH: 'elasticsearch',
38
38
  COUCHBASE: 'couchbase',
39
+ NO: 'no',
39
40
  };
40
41
 
41
42
  const FilteringTypes = {
@@ -20,6 +20,7 @@
20
20
  const Types = {
21
21
  ELASTICSEARCH: 'elasticsearch',
22
22
  COUCHBASE: 'couchbase',
23
+ NO: 'no',
23
24
  FALSE: false,
24
25
  };
25
26