generator-jhipster 8.4.0 → 8.5.0

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 (270) hide show
  1. package/dist/generators/angular/resources/package.json +10 -10
  2. package/dist/generators/angular/templates/src/main/webapp/app/account/password-reset/finish/password-reset-finish.component.spec.ts.ejs +2 -2
  3. package/dist/generators/angular/templates/src/main/webapp/app/account/password-reset/finish/password-reset-finish.component.ts.ejs +3 -6
  4. package/dist/generators/angular/templates/src/main/webapp/app/account/password-reset/init/password-reset-init.component.spec.ts.ejs +2 -2
  5. package/dist/generators/angular/templates/src/main/webapp/app/account/password-reset/init/password-reset-init.component.ts.ejs +3 -6
  6. package/dist/generators/angular/templates/src/main/webapp/app/account/register/register.component.ts.ejs +3 -6
  7. package/dist/generators/angular/templates/src/main/webapp/app/admin/metrics/blocks/metrics-modal-threads/metrics-modal-threads.component.html.ejs +11 -11
  8. package/dist/generators/angular/templates/src/main/webapp/app/admin/user-management/delete/user-management-delete-dialog.component.html.ejs +0 -2
  9. package/dist/generators/angular/templates/src/main/webapp/app/core/auth/user-route-access.service.ts.ejs +1 -1
  10. package/dist/generators/angular/templates/src/main/webapp/app/entities/_entityFolder_/delete/_entityFile_-delete-dialog.component.html.ejs +0 -3
  11. package/dist/generators/angular/templates/src/main/webapp/app/entities/_entityFolder_/detail/_entityFile_-detail.component.spec.ts.ejs +2 -2
  12. package/dist/generators/angular/templates/src/main/webapp/app/entities/_entityFolder_/route/_entityFile_-routing-resolve.service.spec.ts.ejs +2 -2
  13. package/dist/generators/angular/templates/src/main/webapp/app/entities/_entityFolder_/update/_entityFile_-update.component.spec.ts.ejs +3 -3
  14. package/dist/generators/angular/templates/src/main/webapp/app/entities/_entityFolder_/update/_entityFile_-update.component.ts.ejs +11 -17
  15. package/dist/generators/angular/templates/src/main/webapp/app/layouts/navbar/active-menu.directive.ts.ejs +3 -3
  16. package/dist/generators/angular/templates/src/main/webapp/app/login/login.component.spec.ts.ejs +2 -2
  17. package/dist/generators/angular/templates/src/main/webapp/app/login/login.component.ts.ejs +3 -4
  18. package/dist/generators/angular/templates/src/main/webapp/app/shared/alert/alert-error.component.spec.ts.ejs +2 -2
  19. package/dist/generators/angular/templates/src/main/webapp/app/shared/auth/has-any-authority.directive.spec.ts.ejs +10 -8
  20. package/dist/generators/angular/templates/src/main/webapp/app/shared/auth/has-any-authority.directive.ts.ejs +3 -8
  21. package/dist/generators/angular/templates/src/main/webapp/app/shared/filter/filter.component.html.ejs +6 -2
  22. package/dist/generators/app/generator.js +4 -13
  23. package/dist/generators/base/generator.js +15 -16
  24. package/dist/generators/base/priorities.js +12 -1
  25. package/dist/generators/base-application/generator.js +14 -2
  26. package/dist/generators/base-application/priorities.js +1 -0
  27. package/dist/generators/base-application/support/prepare-entity.js +7 -8
  28. package/dist/generators/base-application/support/prepare-relationship.js +3 -2
  29. package/dist/generators/base-core/generator.js +40 -9
  30. package/dist/generators/bootstrap-application-base/generator.js +7 -3
  31. package/dist/generators/bootstrap-application-server/generator.js +1 -0
  32. package/dist/generators/client/command.js +2 -2
  33. package/dist/generators/client/generators/common/command.js +5 -0
  34. package/dist/generators/client/generators/common/generator.js +79 -0
  35. package/dist/generators/client/generators/common/index.js +20 -0
  36. package/dist/generators/client/generators/common/templates/src/main/webapp/app/shared/jhipster/headers.ts.ejs +57 -0
  37. package/dist/generators/client/generators/common/templates/src/main/webapp/app/shared/jhipster/problem-details.ts.ejs +51 -0
  38. package/dist/generators/client/resources/package.json +4 -4
  39. package/dist/generators/common/generator.js +5 -0
  40. package/dist/generators/common/resources/package.json +2 -2
  41. package/dist/generators/cypress/templates/src/test/javascript/cypress/e2e/account/login-page.cy.ts.ejs +4 -4
  42. package/dist/generators/cypress/templates/src/test/javascript/cypress/e2e/account/password-page.cy.ts.ejs +2 -2
  43. package/dist/generators/cypress/templates/src/test/javascript/cypress/e2e/account/register-page.cy.ts.ejs +1 -1
  44. package/dist/generators/cypress/templates/src/test/javascript/cypress/e2e/account/reset-password-page.cy.ts.ejs +1 -1
  45. package/dist/generators/cypress/templates/src/test/javascript/cypress/e2e/entity/_entity_.cy.ts.ejs +10 -10
  46. package/dist/generators/docker/templates/docker/mysql.yml.ejs +1 -1
  47. package/dist/generators/docker/templates/docker/realm-config/jhipster-realm.json.ejs +14 -3
  48. package/dist/generators/docker-compose/templates/realm-config/jhipster-realm.json.ejs +14 -3
  49. package/dist/generators/entity/generator.js +2 -10
  50. package/dist/generators/entity/prompts.js +6 -11
  51. package/dist/generators/gatling/README.md +15 -0
  52. package/dist/generators/gatling/templates/src/test/java/gatling/simulations/_entityClass_GatlingTest.java.ejs +2 -10
  53. package/dist/generators/generate-blueprint/command.js +16 -0
  54. package/dist/generators/generate-blueprint/files.js +8 -0
  55. package/dist/generators/generate-blueprint/generator.js +17 -10
  56. package/dist/generators/generate-blueprint/resources/package.json +1 -1
  57. package/dist/generators/generate-blueprint/templates/.blueprint/cli/commands.mjs.ejs +6 -0
  58. package/dist/generators/generate-blueprint/templates/.blueprint/generate-sample/command.mjs.ejs +20 -0
  59. package/dist/generators/generate-blueprint/templates/.blueprint/generate-sample/generator.mjs.ejs +9 -13
  60. package/dist/generators/generate-blueprint/templates/.blueprint/github-build-matrix/build-matrix.mjs.ejs +22 -0
  61. package/dist/generators/generate-blueprint/templates/.blueprint/github-build-matrix/generator.mjs.ejs +24 -0
  62. package/dist/generators/generate-blueprint/templates/.blueprint/github-build-matrix/index.mjs.ejs +1 -0
  63. package/dist/generators/generate-blueprint/templates/.eslintrc.json.ejs +2 -2
  64. package/dist/generators/generate-blueprint/templates/README.md.ejs +16 -8
  65. package/dist/generators/generate-blueprint/templates/vitest.config.ts.ejs +1 -0
  66. package/dist/generators/generator-constants.js +1 -1
  67. package/dist/generators/info/generator.js +1 -3
  68. package/dist/generators/init/generator.js +2 -2
  69. package/dist/generators/init/resources/.node-version +1 -1
  70. package/dist/generators/java/generators/build-tool/command.js +4 -1
  71. package/dist/generators/java/generators/domain/templates/src/main/java/_package_/_entityPackage_/domain/_persistClass_.java.jhi.ejs +1 -5
  72. package/dist/generators/java/generators/domain/templates/src/test/java/_package_/_entityPackage_/domain/_persistClass_Asserts.java.ejs +3 -3
  73. package/dist/generators/java/generators/domain/templates/src/test/java/_package_/_entityPackage_/domain/_persistClass_Test.java.ejs +3 -3
  74. package/dist/generators/java/support/add-java-annotation.js +28 -7
  75. package/dist/generators/java/support/generated-annotation-transform.js +1 -1
  76. package/dist/generators/java/support/index.js +1 -1
  77. package/dist/generators/jdl/generator.js +1 -1
  78. package/dist/generators/kubernetes/files.js +1 -1
  79. package/dist/generators/kubernetes/templates/db/mysql.yml.ejs +0 -1
  80. package/dist/generators/kubernetes/templates/keycloak/keycloak-configmap.yml.ejs +14 -3
  81. package/dist/generators/languages/generator.js +4 -2
  82. package/dist/generators/maven/templates/.mvn/wrapper/maven-wrapper.properties +2 -2
  83. package/dist/generators/maven/templates/mvnw +185 -243
  84. package/dist/generators/maven/templates/mvnw.cmd +121 -180
  85. package/dist/generators/react/generator.js +10 -0
  86. package/dist/generators/react/resources/package.json +24 -24
  87. package/dist/generators/react/templates/src/main/webapp/app/config/axios-interceptor.spec.ts.ejs +1 -1
  88. package/dist/generators/react/templates/src/main/webapp/app/config/axios-interceptor.ts.ejs +1 -1
  89. package/dist/generators/react/templates/src/main/webapp/app/config/notification-middleware.spec.ts.ejs +1 -1
  90. package/dist/generators/react/templates/src/main/webapp/app/config/notification-middleware.ts.ejs +80 -87
  91. package/dist/generators/react/templates/src/main/webapp/app/config/store.ts.ejs +1 -1
  92. package/dist/generators/react/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_-update.tsx.ejs +3 -3
  93. package/dist/generators/react/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_.reducer.ts.ejs +12 -7
  94. package/dist/generators/react/templates/src/main/webapp/app/shared/reducers/reducer.utils.ts.ejs +2 -3
  95. package/dist/generators/server/command.js +0 -11
  96. package/dist/generators/server/generator.js +9 -70
  97. package/dist/generators/server/jdl/application-definition.js +3 -1
  98. package/dist/generators/server/resources/Dockerfile +12 -12
  99. package/dist/generators/server/resources/gradle/libs.versions.toml +7 -5
  100. package/dist/generators/server/resources/pom.xml +7 -7
  101. package/dist/generators/server/support/config.js +4 -8
  102. package/dist/generators/server/support/prepare-entity.js +5 -6
  103. package/dist/generators/server/support/relationship.js +5 -2
  104. package/dist/generators/server/templates/build.gradle.ejs +5 -3
  105. package/dist/generators/server/templates/gradle/profile_dev.gradle.ejs +1 -0
  106. package/dist/generators/server/templates/gradle/profile_prod.gradle.ejs +1 -0
  107. package/dist/generators/server/templates/gradle.properties.ejs +1 -1
  108. package/dist/generators/server/templates/pom.xml.ejs +7 -5
  109. package/dist/generators/server/templates/src/main/java/_package_/_entityPackage_/service/dto/_dtoClass_.java.ejs +1 -1
  110. package/dist/generators/server/templates/src/main/java/_package_/config/Constants.java.ejs +0 -2
  111. package/dist/generators/server/templates/src/main/java/_package_/config/SecurityConfiguration_imperative.java.ejs +1 -18
  112. package/dist/generators/server/templates/src/main/java/_package_/config/SecurityConfiguration_reactive.java.ejs +1 -15
  113. package/dist/generators/server/templates/src/main/java/_package_/config/SecurityJwtConfiguration.java.ejs +0 -20
  114. package/dist/generators/server/templates/src/main/java/_package_/security/SecurityUtils.java.ejs +65 -5
  115. package/dist/generators/server/templates/src/main/java/_package_/service/dto/UserDTO.java.ejs +23 -0
  116. package/dist/generators/server/templates/src/main/java/_package_/service/mapper/UserMapper.java.ejs +8 -4
  117. package/dist/generators/server/templates/src/main/java/_package_/web/rest/AccountResource_skipUserManagement.java.ejs +43 -9
  118. package/dist/generators/server/templates/src/main/resources/config/application.yml.ejs +59 -21
  119. package/dist/generators/server/templates/src/main/resources/swagger/api.yml.ejs +1 -1
  120. package/dist/generators/server/templates/src/test/java/_package_/security/DomainUserDetailsServiceIT.java.ejs +31 -13
  121. package/dist/generators/server/templates/src/test/java/_package_/service/mapper/UserMapperTest.java.ejs +84 -17
  122. package/dist/generators/server/templates/src/test/java/_package_/web/rest/AccountResourceIT.java.ejs +62 -6
  123. package/dist/generators/server/templates/src/test/java/_package_/web/rest/AccountResourceIT_oauth2.java.ejs +22 -0
  124. package/dist/generators/server/templates/src/test/resources/config/application.yml.ejs +20 -10
  125. package/dist/generators/spring-boot/command.js +117 -6
  126. package/dist/generators/spring-boot/files.js +0 -5
  127. package/dist/generators/spring-boot/generator.js +40 -7
  128. package/dist/generators/spring-boot/prompts.js +6 -70
  129. package/dist/generators/spring-boot/resources/spring-boot-dependencies.pom +368 -576
  130. package/dist/generators/spring-boot/templates/src/test/java/_package_/_entityPackage_/service/UserServiceIT.java.ejs +47 -11
  131. package/dist/generators/spring-boot/templates/src/test/java/_package_/_entityPackage_/web/rest/PublicUserResourceIT.java.ejs +60 -24
  132. package/dist/generators/spring-boot/templates/src/test/java/_package_/_entityPackage_/web/rest/UserResourceIT.java.ejs +195 -318
  133. package/dist/generators/spring-boot/templates/src/test/java/_package_/_entityPackage_/web/rest/_entityClass_ResourceIT.java.ejs +58 -51
  134. package/dist/generators/spring-cache/internal/dependencies.js +2 -2
  135. package/dist/generators/spring-cache/resources/gradle/libs.versions.toml +1 -1
  136. package/dist/generators/spring-cloud/generators/gateway/command.js +5 -1
  137. package/dist/generators/spring-cloud/generators/gateway/generator.js +13 -0
  138. package/dist/generators/spring-cloud/generators/gateway/jdl/jdl-routes-option.js +6 -0
  139. package/dist/generators/spring-data-cassandra/generator.js +2 -2
  140. package/dist/generators/spring-data-relational/templates/src/test/java/_package_/config/SqlTestContainersSpringContextCustomizerFactory.java.ejs +3 -1
  141. package/dist/generators/vue/resources/package.json +15 -15
  142. package/dist/generators/vue/templates/src/main/webapp/app/admin/tracker/tracker.service.spec.ts.ejs +1 -1
  143. package/dist/generators/vue/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_-details.vue.ejs +1 -1
  144. package/dist/generators/vue/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_-update.vue.ejs +1 -1
  145. package/dist/generators/vue/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_.vue.ejs +1 -1
  146. package/dist/generators/vue/templates/src/main/webapp/app/shared/alert/alert.service.spec.ts.ejs +8 -8
  147. package/dist/generators/vue/templates/src/main/webapp/app/shared/data/data-utils.service.spec.ts.ejs +1 -1
  148. package/dist/generators/vue/templates/tsconfig.app.json.ejs +1 -1
  149. package/dist/generators/vue/templates/vite.config.mts.ejs +5 -4
  150. package/dist/jdl/converters/jdl-to-json/jdl-to-json-basic-entity-converter.js +1 -1
  151. package/dist/jdl/converters/jdl-to-json/jdl-to-json-field-converter.js +4 -4
  152. package/dist/jdl/converters/jdl-to-json/jdl-with-applications-to-json-converter.js +9 -9
  153. package/dist/jdl/converters/jdl-to-json/jdl-without-application-to-json-converter.js +2 -2
  154. package/dist/jdl/converters/json-to-jdl-application-converter.js +1 -1
  155. package/dist/jdl/converters/json-to-jdl-converter.js +6 -5
  156. package/dist/jdl/converters/json-to-jdl-entity-converter.js +14 -14
  157. package/dist/jdl/converters/json-to-jdl-option-converter.js +1 -2
  158. package/dist/jdl/converters/parsed-jdl-to-jdl-object/application-converter.js +1 -1
  159. package/dist/jdl/converters/parsed-jdl-to-jdl-object/option-converter.js +2 -2
  160. package/dist/jdl/converters/parsed-jdl-to-jdl-object/parsed-jdl-to-jdl-object-converter.js +7 -6
  161. package/dist/jdl/converters/parsed-jdl-to-jdl-object/validation-converter.js +1 -1
  162. package/dist/jdl/exporters/applications/jhipster-application-formatter.js +16 -23
  163. package/dist/jdl/exporters/config.js +1 -0
  164. package/dist/jdl/exporters/jhipster-deployment-exporter.js +5 -5
  165. package/dist/jdl/exporters/jhipster-entity-exporter.js +1 -1
  166. package/dist/jdl/jdl-importer.js +22 -20
  167. package/dist/jdl/jhipster/binary-options.js +12 -8
  168. package/dist/jdl/jhipster/json-entity.js +1 -1
  169. package/dist/jdl/models/abstract-jdl-option.js +2 -2
  170. package/dist/jdl/models/jdl-application-configuration-factory.js +2 -0
  171. package/dist/jdl/models/jdl-binary-option.js +2 -2
  172. package/dist/jdl/models/jdl-deployment.js +11 -0
  173. package/dist/jdl/models/jdl-entity.js +1 -1
  174. package/dist/jdl/models/jdl-enum.js +1 -1
  175. package/dist/jdl/models/jdl-enums.js +0 -18
  176. package/dist/jdl/models/jdl-field.js +2 -2
  177. package/dist/jdl/models/jdl-object-wrapper.js +1 -0
  178. package/dist/jdl/models/jdl-object.js +23 -45
  179. package/dist/jdl/models/jdl-options.js +0 -18
  180. package/dist/jdl/models/jdl-relationships.js +8 -16
  181. package/dist/jdl/models/jdl-unary-option.js +1 -1
  182. package/dist/jdl/models/list-jdl-application-configuration-option.js +5 -2
  183. package/dist/jdl/parsing/jdl-ast-builder-visitor.js +12 -0
  184. package/dist/jdl/parsing/jdl-parser.js +14 -0
  185. package/dist/jdl/parsing/lexer/lexer.js +17 -11
  186. package/dist/jdl/parsing/validator.js +16 -2
  187. package/dist/jdl/readers/json-reader.js +1 -1
  188. package/dist/jdl/utils/array-utils.js +6 -0
  189. package/dist/jdl/utils/set-utils.js +3 -2
  190. package/dist/jdl/validators/jdl-without-application-validator.js +2 -2
  191. package/dist/testing/helpers.js +4 -0
  192. package/dist/types/generators/base/api.d.ts +5 -1
  193. package/dist/types/generators/base/generator.d.ts +10 -4
  194. package/dist/types/generators/base/priorities.d.ts +4 -0
  195. package/dist/types/generators/base/shared-data.d.ts +1 -1
  196. package/dist/types/generators/base-application/priorities.d.ts +2 -0
  197. package/dist/types/generators/base-application/support/entity.d.ts +2 -2
  198. package/dist/types/generators/base-application/support/prepare-entity.d.ts +3 -3
  199. package/dist/types/generators/base-application/support/relationship.d.ts +5 -5
  200. package/dist/types/generators/base-core/generator.d.ts +16 -1
  201. package/dist/types/generators/generator-constants.d.ts +1 -1
  202. package/dist/types/generators/java/support/add-java-annotation.d.ts +10 -20
  203. package/dist/types/generators/java/support/doc.d.ts +1 -1
  204. package/dist/types/generators/java/support/index.d.ts +1 -1
  205. package/dist/types/generators/server/support/relationship.d.ts +2 -2
  206. package/dist/types/generators/server/types.d.ts +5 -0
  207. package/dist/types/generators/spring-cloud/generators/gateway/jdl/jdl-routes-option.d.ts +2 -0
  208. package/dist/types/generators/spring-cloud/generators/gateway/types.d.ts +4 -0
  209. package/dist/types/jdl/converters/jdl-to-json/jdl-to-json-field-converter.d.ts +2 -2
  210. package/dist/types/jdl/converters/jdl-to-json/jdl-with-applications-to-json-converter.d.ts +2 -1
  211. package/dist/types/jdl/converters/jdl-to-json/jdl-without-application-to-json-converter.d.ts +3 -1
  212. package/dist/types/jdl/converters/json-to-jdl-application-converter.d.ts +9 -2
  213. package/dist/types/jdl/converters/json-to-jdl-converter.d.ts +3 -3
  214. package/dist/types/jdl/converters/json-to-jdl-entity-converter.d.ts +2 -4
  215. package/dist/types/jdl/converters/parsed-jdl-to-jdl-object/application-converter.d.ts +3 -1
  216. package/dist/types/jdl/converters/parsed-jdl-to-jdl-object/deployment-converter.d.ts +2 -1
  217. package/dist/types/jdl/converters/parsed-jdl-to-jdl-object/entity-converter.d.ts +3 -1
  218. package/dist/types/jdl/converters/parsed-jdl-to-jdl-object/enum-converter.d.ts +2 -1
  219. package/dist/types/jdl/converters/parsed-jdl-to-jdl-object/field-converter.d.ts +2 -1
  220. package/dist/types/jdl/converters/parsed-jdl-to-jdl-object/option-converter.d.ts +3 -3
  221. package/dist/types/jdl/converters/parsed-jdl-to-jdl-object/parsed-jdl-to-jdl-object-converter.d.ts +2 -1
  222. package/dist/types/jdl/converters/parsed-jdl-to-jdl-object/relationship-converter.d.ts +2 -1
  223. package/dist/types/jdl/converters/parsed-jdl-to-jdl-object/types.d.ts +110 -0
  224. package/dist/types/jdl/converters/parsed-jdl-to-jdl-object/validation-converter.d.ts +2 -1
  225. package/dist/types/jdl/converters/types.d.ts +102 -14
  226. package/dist/types/jdl/exporters/applications/jhipster-application-formatter.d.ts +4 -4
  227. package/dist/types/jdl/exporters/config.d.ts +2 -1
  228. package/dist/types/jdl/exporters/export-utils.d.ts +2 -1
  229. package/dist/types/jdl/exporters/jdl-exporter.d.ts +2 -1
  230. package/dist/types/jdl/exporters/jhipster-deployment-exporter.d.ts +3 -1
  231. package/dist/types/jdl/exporters/jhipster-entity-exporter.d.ts +3 -1
  232. package/dist/types/jdl/exporters/types.d.ts +61 -0
  233. package/dist/types/jdl/jhipster/binary-options.d.ts +8 -26
  234. package/dist/types/jdl/jhipster/field-types.d.ts +2 -2
  235. package/dist/types/jdl/jhipster/json-entity.d.ts +2 -2
  236. package/dist/types/jdl/models/abstract-jdl-option.d.ts +14 -9
  237. package/dist/types/jdl/models/boolean-jdl-application-configuration-option.d.ts +1 -1
  238. package/dist/types/jdl/models/integer-jdl-application-configuration-option.d.ts +1 -1
  239. package/dist/types/jdl/models/jdl-application-configuration-factory.d.ts +1 -1
  240. package/dist/types/jdl/models/jdl-application-configuration-option.d.ts +4 -4
  241. package/dist/types/jdl/models/jdl-application-configuration.d.ts +4 -4
  242. package/dist/types/jdl/models/jdl-application-definition.d.ts +4 -4
  243. package/dist/types/jdl/models/jdl-application-entities.d.ts +4 -4
  244. package/dist/types/jdl/models/jdl-application.d.ts +16 -13
  245. package/dist/types/jdl/models/jdl-binary-option.d.ts +5 -3
  246. package/dist/types/jdl/models/jdl-deployment.d.ts +13 -1
  247. package/dist/types/jdl/models/jdl-entity.d.ts +5 -5
  248. package/dist/types/jdl/models/jdl-enum-value.d.ts +4 -4
  249. package/dist/types/jdl/models/jdl-enum.d.ts +9 -5
  250. package/dist/types/jdl/models/jdl-enums.d.ts +6 -5
  251. package/dist/types/jdl/models/jdl-field.d.ts +10 -8
  252. package/dist/types/jdl/models/jdl-object-wrapper.d.ts +25 -0
  253. package/dist/types/jdl/models/jdl-object.d.ts +23 -19
  254. package/dist/types/jdl/models/jdl-options.d.ts +7 -24
  255. package/dist/types/jdl/models/jdl-relationship.d.ts +16 -10
  256. package/dist/types/jdl/models/jdl-relationships.d.ts +5 -5
  257. package/dist/types/jdl/models/jdl-validation.d.ts +3 -3
  258. package/dist/types/jdl/models/list-jdl-application-configuration-option.d.ts +4 -3
  259. package/dist/types/jdl/models/string-jdl-application-configuration-option.d.ts +2 -2
  260. package/dist/types/jdl/parsing/jdl-ast-builder-visitor.d.ts +1 -0
  261. package/dist/types/jdl/parsing/jdl-parser.d.ts +1 -0
  262. package/dist/types/jdl/parsing/jdl-parsing-types.d.ts +23 -0
  263. package/dist/types/jdl/parsing/lexer/lexer.d.ts +6 -2
  264. package/dist/types/jdl/parsing/validator.d.ts +1 -1
  265. package/dist/types/jdl/utils/array-utils.d.ts +1 -0
  266. package/dist/types/jdl/utils/set-utils.d.ts +1 -19
  267. package/dist/types/jdl/validators/deployment-validator.d.ts +2 -1
  268. package/dist/types/testing/helpers.d.ts +13 -3
  269. package/package.json +24 -23
  270. /package/dist/jdl/converters/{types.js → parsed-jdl-to-jdl-object/types.js} +0 -0
@@ -114,8 +114,8 @@ export default class JHipsterAppGenerator extends BaseApplicationGenerator {
114
114
  get [BaseApplicationGenerator.CONFIGURING]() {
115
115
  return this.delegateTasksToBlueprint(() => this.configuring);
116
116
  }
117
- get composing() {
118
- return this.asComposingTaskGroup({
117
+ get composingComponent() {
118
+ return this.asComposingComponentTaskGroup({
119
119
  /**
120
120
  * Composing with others generators, must be executed after `configuring` priority to let others
121
121
  * generators `configuring` priority to run.
@@ -138,19 +138,10 @@ export default class JHipsterAppGenerator extends BaseApplicationGenerator {
138
138
  await this.composeWithJHipster(GENERATOR_CLIENT);
139
139
  }
140
140
  },
141
- /**
142
- * At this point every other generator should already be configured, so, enforce defaults fallback.
143
- */
144
- saveConfigWithDefaults() {
145
- const config = this.jhipsterConfigWithDefaults;
146
- if (config.entitySuffix === config.dtoSuffix) {
147
- throw new Error('Entities cannot be generated as the entity suffix and DTO suffix are equals !');
148
- }
149
- },
150
141
  });
151
142
  }
152
- get [BaseApplicationGenerator.COMPOSING]() {
153
- return this.delegateTasksToBlueprint(() => this.composing);
143
+ get [BaseApplicationGenerator.COMPOSING_COMPONENT]() {
144
+ return this.delegateTasksToBlueprint(() => this.composingComponent);
154
145
  }
155
146
  get writing() {
156
147
  return this.asWritingTaskGroup({
@@ -20,14 +20,12 @@ import fs from 'fs';
20
20
  import path from 'path';
21
21
  import chalk from 'chalk';
22
22
  import semver from 'semver';
23
- import { defaults } from 'lodash-es';
24
23
  import { packageJson } from '../../lib/index.js';
25
- import { packageNameToNamespace, removeFieldsWithNullishValues } from './support/index.js';
24
+ import { packageNameToNamespace } from './support/index.js';
26
25
  import { mergeBlueprints, parseBluePrints, loadBlueprintsFromConfiguration, normalizeBlueprintName } from './internal/index.js';
27
26
  import { PRIORITY_NAMES } from './priorities.js';
28
27
  import CoreGenerator from '../base-core/index.js';
29
28
  import { LOCAL_BLUEPRINT_PACKAGE_NAMESPACE } from './support/constants.js';
30
- import { getConfigWithDefaults } from '../../jdl/index.js';
31
29
  import { loadStoredAppOptions } from '../app/support/index.js';
32
30
  /**
33
31
  * Base class that contains blueprints support.
@@ -160,6 +158,20 @@ export default class JHipsterBaseBlueprintGenerator extends CoreGenerator {
160
158
  asComposingTaskGroup(taskGroup) {
161
159
  return taskGroup;
162
160
  }
161
+ /**
162
+ * Priority API stub for blueprints.
163
+ *
164
+ * ComposingComponent priority should be used to handle component configuration order.
165
+ */
166
+ get composingComponent() {
167
+ return {};
168
+ }
169
+ /**
170
+ * Utility method to get typed objects for autocomplete.
171
+ */
172
+ asComposingComponentTaskGroup(taskGroup) {
173
+ return taskGroup;
174
+ }
163
175
  /**
164
176
  * Priority API stub for blueprints.
165
177
  *
@@ -343,19 +355,6 @@ export default class JHipsterBaseBlueprintGenerator extends CoreGenerator {
343
355
  asEndTaskGroup(taskGroup) {
344
356
  return taskGroup;
345
357
  }
346
- /**
347
- * JHipster config with default values fallback
348
- */
349
- get jhipsterConfigWithDefaults() {
350
- const configWithDefaults = getConfigWithDefaults(removeFieldsWithNullishValues(this.config.getAll()));
351
- defaults(configWithDefaults, {
352
- skipFakeData: false,
353
- skipCheckLengthOfIdentifier: false,
354
- enableGradleEnterprise: false,
355
- pages: [],
356
- });
357
- return configWithDefaults;
358
- }
359
358
  /**
360
359
  * @protected
361
360
  * Composes with blueprint generators, if any.
@@ -32,6 +32,8 @@ const END = 'end';
32
32
  /** Custom priorities */
33
33
  const COMPOSING = 'composing';
34
34
  const COMPOSING_QUEUE = `${QUEUE_PREFIX}${COMPOSING}`;
35
+ const COMPOSING_COMPONENT = 'composingComponent';
36
+ const COMPOSING_COMPONENT_QUEUE = `${QUEUE_PREFIX}${COMPOSING_COMPONENT}`;
35
37
  const LOADING = 'loading';
36
38
  const LOADING_QUEUE = `${QUEUE_PREFIX}${LOADING}`;
37
39
  const PREPARING = 'preparing';
@@ -70,9 +72,15 @@ export const CUSTOM_PRIORITIES = [
70
72
  {
71
73
  priorityName: COMPOSING,
72
74
  queueName: COMPOSING_QUEUE,
73
- before: LOADING,
75
+ before: COMPOSING_COMPONENT,
74
76
  args: generator => generator.getArgsForPriority(COMPOSING),
75
77
  },
78
+ {
79
+ priorityName: COMPOSING_COMPONENT,
80
+ queueName: COMPOSING_COMPONENT_QUEUE,
81
+ before: LOADING,
82
+ args: generator => generator.getArgsForPriority(COMPOSING_COMPONENT),
83
+ },
76
84
  {
77
85
  priorityName: LOADING,
78
86
  queueName: LOADING_QUEUE,
@@ -140,6 +148,7 @@ export const PRIORITY_NAMES = {
140
148
  PROMPTING,
141
149
  CONFIGURING,
142
150
  COMPOSING,
151
+ COMPOSING_COMPONENT,
143
152
  LOADING,
144
153
  PREPARING,
145
154
  POST_PREPARING,
@@ -158,6 +167,7 @@ export const PRIORITY_NAMES_LIST = [
158
167
  PROMPTING,
159
168
  CONFIGURING,
160
169
  COMPOSING,
170
+ COMPOSING_COMPONENT,
161
171
  LOADING,
162
172
  PREPARING,
163
173
  POST_PREPARING,
@@ -175,6 +185,7 @@ export const QUEUES = {
175
185
  PROMPTING_QUEUE: PROMPTING,
176
186
  CONFIGURING_QUEUE: CONFIGURING,
177
187
  COMPOSING_QUEUE,
188
+ COMPOSING_COMPONENT_QUEUE,
178
189
  LOADING_QUEUE,
179
190
  PREPARING_QUEUE,
180
191
  POST_PREPARING_QUEUE,
@@ -448,6 +448,8 @@ export default class BaseApplicationGenerator extends BaseGenerator {
448
448
  taskName: 'queueConfiguringEachEntity',
449
449
  cancellable: true,
450
450
  method: () => {
451
+ if (this.options.skipPriorities?.includes(CONFIGURING_EACH_ENTITY))
452
+ return;
451
453
  this.log.debug(`Queueing entity tasks ${CONFIGURING_EACH_ENTITY}`);
452
454
  const tasks = this.extractTasksFromPriority(CONFIGURING_EACH_ENTITY, { skip: false });
453
455
  this.getEntitiesDataToConfigure().forEach(({ entityName, entityStorage, entityConfig }) => {
@@ -467,6 +469,8 @@ export default class BaseApplicationGenerator extends BaseGenerator {
467
469
  taskName: 'queueLoadingEntities',
468
470
  cancellable: true,
469
471
  method: () => {
472
+ if (this.options.skipPriorities?.includes(LOADING_ENTITIES))
473
+ return;
470
474
  this.log.debug(`Queueing entity tasks ${LOADING_ENTITIES}`);
471
475
  const tasks = this.extractTasksFromPriority(LOADING_ENTITIES, { skip: false });
472
476
  this.log.debug(`Queueing entity tasks ${LOADING_ENTITIES}`);
@@ -484,6 +488,8 @@ export default class BaseApplicationGenerator extends BaseGenerator {
484
488
  taskName: 'queuePreparingEachEntity',
485
489
  cancellable: true,
486
490
  method: () => {
491
+ if (this.options.skipPriorities?.includes(PREPARING_EACH_ENTITY))
492
+ return;
487
493
  this.log.debug(`Queueing entity tasks ${PREPARING_EACH_ENTITY}`);
488
494
  const tasks = this.extractTasksFromPriority(PREPARING_EACH_ENTITY, { skip: false });
489
495
  this.getEntitiesDataToPrepare().forEach(({ description, ...data }) => {
@@ -503,6 +509,8 @@ export default class BaseApplicationGenerator extends BaseGenerator {
503
509
  taskName: 'queuePreparingEachEntityField',
504
510
  cancellable: true,
505
511
  method: () => {
512
+ if (this.options.skipPriorities?.includes(PREPARING_EACH_ENTITY_FIELD))
513
+ return;
506
514
  const tasks = this.extractTasksFromPriority(PREPARING_EACH_ENTITY_FIELD, { skip: false });
507
515
  this.getEntitiesFieldsDataToPrepare().forEach(({ description, ...data }) => {
508
516
  this.log.debug(`Queueing entity tasks ${PREPARING_EACH_ENTITY_FIELD} for ${description}`);
@@ -521,6 +529,8 @@ export default class BaseApplicationGenerator extends BaseGenerator {
521
529
  taskName: 'queuePreparingEachEntityRelationship',
522
530
  cancellable: true,
523
531
  method: () => {
532
+ if (this.options.skipPriorities?.includes(PREPARING_EACH_ENTITY_RELATIONSHIP))
533
+ return;
524
534
  const tasks = this.extractTasksFromPriority(PREPARING_EACH_ENTITY_RELATIONSHIP, { skip: false });
525
535
  this.getEntitiesRelationshipsDataToPrepare().forEach(({ description, ...data }) => {
526
536
  this.log.debug(`Queueing entity tasks ${PREPARING_EACH_ENTITY_RELATIONSHIP} for ${description}`);
@@ -539,6 +549,8 @@ export default class BaseApplicationGenerator extends BaseGenerator {
539
549
  taskName: 'queuePostPreparingEachEntity',
540
550
  cancellable: true,
541
551
  method: () => {
552
+ if (this.options.skipPriorities?.includes(POST_PREPARING_EACH_ENTITY))
553
+ return;
542
554
  const tasks = this.extractTasksFromPriority(POST_PREPARING_EACH_ENTITY, { skip: false });
543
555
  this.getEntitiesDataToPostPrepare().forEach(({ description, ...data }) => {
544
556
  this.log.debug(`Queueing entity tasks ${POST_PREPARING_EACH_ENTITY} for ${description}`);
@@ -557,7 +569,7 @@ export default class BaseApplicationGenerator extends BaseGenerator {
557
569
  taskName: 'queueWritingEachEntity',
558
570
  cancellable: true,
559
571
  method: () => {
560
- if (this.options.skipWriting)
572
+ if (this.options.skipWriting || this.options.skipPriorities?.includes(WRITING_ENTITIES))
561
573
  return;
562
574
  const tasks = this.extractTasksFromPriority(WRITING_ENTITIES, { skip: false });
563
575
  const args = this.getArgsForPriority(WRITING_ENTITIES);
@@ -574,7 +586,7 @@ export default class BaseApplicationGenerator extends BaseGenerator {
574
586
  taskName: 'queuePostWritingEachEntity',
575
587
  cancellable: true,
576
588
  method: () => {
577
- if (this.options.skipWriting)
589
+ if (this.options.skipWriting || this.options.skipPriorities?.includes(POST_WRITING_ENTITIES))
578
590
  return;
579
591
  const tasks = this.extractTasksFromPriority(POST_WRITING_ENTITIES, { skip: false });
580
592
  const args = this.getArgsForPriority(POST_WRITING_ENTITIES);
@@ -126,6 +126,7 @@ export const PRIORITY_NAMES_LIST = [
126
126
  PRIORITY_NAMES.PROMPTING,
127
127
  PRIORITY_NAMES.CONFIGURING,
128
128
  PRIORITY_NAMES.COMPOSING,
129
+ PRIORITY_NAMES.COMPOSING_COMPONENT,
129
130
  PRIORITY_NAMES.LOADING,
130
131
  PRIORITY_NAMES.PREPARING,
131
132
  CONFIGURING_EACH_ENTITY,
@@ -22,12 +22,11 @@ import { getDatabaseTypeData, hibernateSnakeCase } from '../../server/support/in
22
22
  import { createFaker, parseChangelog, stringHashCode, upperFirstCamelCase, getMicroserviceAppName, mutateData, } from '../../base/support/index.js';
23
23
  import { fieldToReference } from './prepare-field.js';
24
24
  import { getTypescriptKeyType, getEntityParentPathAddition } from '../../client/support/index.js';
25
- import { applicationTypes, authenticationTypes, binaryOptions, databaseTypes, entityOptions, fieldTypes, searchEngineTypes, } from '../../../jdl/jhipster/index.js';
25
+ import { applicationTypes, binaryOptions, databaseTypes, entityOptions, fieldTypes, searchEngineTypes, } from '../../../jdl/jhipster/index.js';
26
26
  import { fieldIsEnum } from './field-utils.js';
27
27
  const NO_SEARCH_ENGINE = searchEngineTypes.NO;
28
28
  const { PaginationTypes, ServiceTypes, MapperTypes } = entityOptions;
29
29
  const { GATEWAY, MICROSERVICE } = applicationTypes;
30
- const { OAUTH2 } = authenticationTypes;
31
30
  const { CommonDBTypes } = fieldTypes;
32
31
  const { BOOLEAN, LONG, STRING, UUID, INTEGER } = CommonDBTypes;
33
32
  const { NO: NO_DTO, MAPSTRUCT } = MapperTypes;
@@ -191,10 +190,16 @@ export default function prepareEntity(entityWithConfig, generator, application)
191
190
  ? `${entityWithConfig.clientRootFolder}-${entityWithConfig.entityStateName}`
192
191
  : entityWithConfig.entityStateName);
193
192
  mutateData(entityWithConfig, {
193
+ __override__: false,
194
194
  i18nKeyPrefix: data => data.i18nKeyPrefix ?? `${data.frontendAppName}.${data.entityTranslationKey}`,
195
195
  i18nAlertHeaderPrefix: data => data.i18nAlertHeaderPrefix ?? data.microserviceAppName
196
196
  ? `${data.microserviceAppName}.${data.entityTranslationKey}`
197
197
  : data.i18nKeyPrefix,
198
+ hasRelationshipWithBuiltInUser: ({ relationships }) => relationships.some(relationship => relationship.otherEntity.builtInUser),
199
+ saveUserSnapshot: ({ hasRelationshipWithBuiltInUser, dto }) => application.applicationTypeMicroservice &&
200
+ application.authenticationTypeOauth2 &&
201
+ hasRelationshipWithBuiltInUser &&
202
+ dto === NO_MAPPER,
198
203
  });
199
204
  const { microserviceName, entityFileName, microfrontend } = entityWithConfig;
200
205
  entityWithConfig.entityApi = microserviceName ? `services/${microserviceName.toLowerCase()}/` : '';
@@ -203,12 +208,6 @@ export default function prepareEntity(entityWithConfig, generator, application)
203
208
  (microfrontend && microserviceName && entityWithConfig.applicationType === MICROSERVICE
204
209
  ? `${microserviceName.toLowerCase()}/${entityFileName}`
205
210
  : `${entityFileName}`);
206
- const hasBuiltInUserField = entityWithConfig.relationships.some(relationship => relationship.otherEntity.builtInUser);
207
- entityWithConfig.saveUserSnapshot =
208
- application.applicationType === MICROSERVICE &&
209
- application.authenticationType === OAUTH2 &&
210
- hasBuiltInUserField &&
211
- entityWithConfig.dto === NO_MAPPER;
212
211
  entityWithConfig.generateFakeData = type => {
213
212
  const fieldsToGenerate = type === 'cypress' ? entityWithConfig.fields.filter(field => !field.id || !field.autoGenerate) : entityWithConfig.fields;
214
213
  const fieldEntries = fieldsToGenerate.map(field => {
@@ -71,9 +71,9 @@ export default function prepareRelationship(entityWithConfig, relationship, gene
71
71
  otherEntityNameCapitalized: upperFirst(otherEntityName),
72
72
  // let ownerSide true when type is 'many-to-one' for convenience.
73
73
  // means that this side should control the reference.
74
- ownerSide: relationshipManyToOne || (relationshipLeftSide && !relationshipOneToMany),
74
+ ownerSide: relationship.otherEntity.embedded || relationshipManyToOne || (relationshipLeftSide && !relationshipOneToMany),
75
75
  persistableRelationship: ({ ownerSide }) => ownerSide,
76
- relationshipUpdateBackReference: ({ ownerSide, relationshipRightSide }) => entityWithConfig.databaseType === 'neo4j' ? relationshipRightSide : !ownerSide,
76
+ relationshipUpdateBackReference: ({ ownerSide, relationshipRightSide, otherEntity }) => !otherEntity.embedded && (entityWithConfig.databaseType === NEO4J ? relationshipRightSide : !ownerSide),
77
77
  // DB properties
78
78
  columnName: hibernateSnakeCase(relationshipName),
79
79
  columnNamePrefix: relationship.id && relationshipOneToOne ? '' : `${hibernateSnakeCase(relationshipName)}_`,
@@ -94,6 +94,7 @@ export default function prepareRelationship(entityWithConfig, relationship, gene
94
94
  relationship.otherSideReferenceExists = true;
95
95
  }
96
96
  else if (!ignoreMissingRequiredRelationship &&
97
+ !relationship.otherEntity.embedded &&
97
98
  !relationship.relationshipIgnoreBackReference &&
98
99
  entityWithConfig.databaseType !== NEO4J &&
99
100
  entityWithConfig.databaseType !== DATABASE_NO &&
@@ -25,14 +25,14 @@ import assert from 'assert';
25
25
  import { requireNamespace } from '@yeoman/namespace';
26
26
  import chalk from 'chalk';
27
27
  import { parse as parseYaml, stringify as stringifyYaml } from 'yaml';
28
- import { kebabCase, snakeCase, merge, get, set } from 'lodash-es';
28
+ import { kebabCase, snakeCase, merge, get, set, defaults } from 'lodash-es';
29
29
  import { simpleGit } from 'simple-git';
30
30
  import semver, { lt as semverLessThan } from 'semver';
31
31
  import YeomanGenerator from 'yeoman-generator';
32
32
  import latestVersion from 'latest-version';
33
33
  import SharedData from '../base/shared-data.js';
34
34
  import { CUSTOM_PRIORITIES, PRIORITY_NAMES, PRIORITY_PREFIX } from '../base/priorities.js';
35
- import { createJHipster7Context, formatDateForChangelog, joinCallbacks } from '../base/support/index.js';
35
+ import { createJHipster7Context, formatDateForChangelog, joinCallbacks, removeFieldsWithNullishValues, } from '../base/support/index.js';
36
36
  import { packageJson } from '../../lib/index.js';
37
37
  import { GENERATOR_BOOTSTRAP } from '../generator-list.js';
38
38
  import NeedleApi from '../needle-api.js';
@@ -41,7 +41,8 @@ import { GENERATOR_JHIPSTER, YO_RC_FILE } from '../generator-constants.js';
41
41
  import { convertConfigToOption } from '../../lib/internal/index.js';
42
42
  import { getGradleLibsVersionsProperties } from '../gradle/support/dependabot-gradle.js';
43
43
  import { dockerPlaceholderGenerator } from '../docker/utils.js';
44
- const { INITIALIZING, PROMPTING, CONFIGURING, COMPOSING, LOADING, PREPARING, POST_PREPARING, DEFAULT, WRITING, POST_WRITING, INSTALL, POST_INSTALL, END, } = PRIORITY_NAMES;
44
+ import { getConfigWithDefaults } from '../../jdl/index.js';
45
+ const { INITIALIZING, PROMPTING, CONFIGURING, COMPOSING, COMPOSING_COMPONENT, LOADING, PREPARING, POST_PREPARING, DEFAULT, WRITING, POST_WRITING, INSTALL, POST_INSTALL, END, } = PRIORITY_NAMES;
45
46
  const __filename = fileURLToPath(import.meta.url);
46
47
  const __dirname = dirname(__filename);
47
48
  const asPriority = (priorityName) => `${PRIORITY_PREFIX}${priorityName}`;
@@ -58,6 +59,7 @@ export default class CoreGenerator extends YeomanGenerator {
58
59
  static PROMPTING = asPriority(PROMPTING);
59
60
  static CONFIGURING = asPriority(CONFIGURING);
60
61
  static COMPOSING = asPriority(COMPOSING);
62
+ static COMPOSING_COMPONENT = asPriority(COMPOSING_COMPONENT);
61
63
  static LOADING = asPriority(LOADING);
62
64
  static PREPARING = asPriority(PREPARING);
63
65
  static POST_PREPARING = asPriority(POST_PREPARING);
@@ -149,6 +151,19 @@ export default class CoreGenerator extends YeomanGenerator {
149
151
  }
150
152
  return this._needleApi;
151
153
  }
154
+ /**
155
+ * JHipster config with default values fallback
156
+ */
157
+ get jhipsterConfigWithDefaults() {
158
+ const configWithDefaults = getConfigWithDefaults(removeFieldsWithNullishValues(this.config.getAll()));
159
+ defaults(configWithDefaults, {
160
+ skipFakeData: false,
161
+ skipCheckLengthOfIdentifier: false,
162
+ enableGradleEnterprise: false,
163
+ pages: [],
164
+ });
165
+ return configWithDefaults;
166
+ }
152
167
  /**
153
168
  * Warn or throws check failure based on current skipChecks option.
154
169
  * @param message
@@ -169,11 +184,14 @@ You can ignore this error by passing '--skip-checks' to jhipster command.`);
169
184
  */
170
185
  isJhipsterVersionLessThan(version) {
171
186
  const jhipsterOldVersion = this.sharedData.getControl().jhipsterOldVersion;
172
- if (!jhipsterOldVersion) {
173
- // if old version is unknown then can't compare (the project may be null) and return false
174
- return false;
175
- }
176
- return semverLessThan(jhipsterOldVersion, version);
187
+ return this.isVersionLessThan(jhipsterOldVersion, version);
188
+ }
189
+ /**
190
+ * Wrapper for `semver.lt` to check if the oldVersion exists and is less than the newVersion.
191
+ * Can be used by blueprints.
192
+ */
193
+ isVersionLessThan(oldVersion, newVersion) {
194
+ return oldVersion ? semverLessThan(oldVersion, newVersion) : false;
177
195
  }
178
196
  /**
179
197
  * Get arguments for the priority
@@ -251,6 +269,19 @@ You can ignore this error by passing '--skip-checks' to jhipster command.`);
251
269
  }
252
270
  return this.prompt(this.prepareQuestions(generatorCommand.configs));
253
271
  }
272
+ /**
273
+ * Configure the current JHipster command.
274
+ * Blueprints with command override takes precedence.
275
+ */
276
+ async configureCurrentJHipsterCommandConfig() {
277
+ const generatorCommand = await this.getCurrentJHipsterCommand();
278
+ if (!generatorCommand.configs) {
279
+ throw new Error(`Configs not found for generator ${this.options.namespace}`);
280
+ }
281
+ for (const def of Object.values(generatorCommand.configs)) {
282
+ def.configure?.(this);
283
+ }
284
+ }
254
285
  /**
255
286
  * Load the current JHipster command storage configuration into the context.
256
287
  * Blueprints with command override takes precedence.
@@ -395,7 +426,7 @@ You can ignore this error by passing '--skip-checks' to jhipster command.`);
395
426
  return Object.entries(configs)
396
427
  .filter(([_name, def]) => def?.prompt)
397
428
  .map(([name, def]) => {
398
- const promptSpec = typeof def.prompt === 'function' ? def.prompt(this) : { ...def.prompt };
429
+ const promptSpec = typeof def.prompt === 'function' ? def.prompt(this, def) : { ...def.prompt };
399
430
  let storage;
400
431
  if ((def.scope ?? 'storage') === 'storage') {
401
432
  storage = this.config;
@@ -140,15 +140,19 @@ export default class BootstrapApplicationBase extends BaseApplicationGenerator {
140
140
  backendTypeJavaAny: ({ backendTypeSpringBoot }) => backendTypeSpringBoot,
141
141
  });
142
142
  },
143
+ userRelationship({ applicationDefaults }) {
144
+ applicationDefaults({
145
+ __override__: false,
146
+ anyEntityHasRelationshipWithUser: this.getExistingEntities().some(entity => (entity.definition.relationships ?? []).some(relationship => relationship.otherEntityName.toLowerCase() === 'user')),
147
+ });
148
+ },
143
149
  syncUserWithIdp({ application, applicationDefaults }) {
144
150
  if (!application.backendTypeSpringBoot)
145
151
  return;
146
152
  if (application.syncUserWithIdp === undefined && application.authenticationType === 'oauth2') {
147
153
  applicationDefaults({
148
154
  __override__: false,
149
- syncUserWithIdp: data => data.databaseType !== 'no' &&
150
- (data.applicationType === 'gateway' ||
151
- this.getExistingEntities().some(entity => (entity.definition.relationships ?? []).some(relationship => relationship.otherEntityName.toLowerCase() === 'user'))),
155
+ syncUserWithIdp: data => data.databaseType !== 'no' && (data.applicationType === 'gateway' || data.anyEntityHasRelationshipWithUser),
152
156
  });
153
157
  }
154
158
  else if (application.syncUserWithIdp && application.authenticationType !== 'oauth2') {
@@ -71,6 +71,7 @@ export default class BoostrapApplicationServer extends BaseApplicationGenerator
71
71
  ...applicationDockerContainers,
72
72
  ...currentDockerContainers,
73
73
  }),
74
+ gatewayRoutes: undefined,
74
75
  });
75
76
  },
76
77
  });
@@ -42,8 +42,8 @@ const command = {
42
42
  prompt: generator => ({
43
43
  type: 'list',
44
44
  message: () => generator.jhipsterConfigWithDefaults.applicationType === APPLICATION_TYPE_MICROSERVICE
45
- ? `Which ${chalk.yellow('*Framework*')} would you like to use as microfrontend?`
46
- : `Which ${chalk.yellow('*Framework*')} would you like to use for the client?`,
45
+ ? `Which ${chalk.yellow('*framework*')} would you like to use as microfrontend?`
46
+ : `Which ${chalk.yellow('*framework*')} would you like to use for the client?`,
47
47
  }),
48
48
  choices: [
49
49
  { value: ANGULAR, name: 'Angular' },
@@ -0,0 +1,5 @@
1
+ const command = {
2
+ configs: {},
3
+ import: [],
4
+ };
5
+ export default command;
@@ -0,0 +1,79 @@
1
+ /**
2
+ * Copyright 2013-2024 the original author or authors from the JHipster project.
3
+ *
4
+ * This file is part of the JHipster project, see https://www.jhipster.tech/
5
+ * for more information.
6
+ *
7
+ * Licensed under the Apache License, Version 2.0 (the "License");
8
+ * you may not use this file except in compliance with the License.
9
+ * You may obtain a copy of the License at
10
+ *
11
+ * https://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ */
19
+ import BaseApplicationGenerator from '../../../base-application/index.js';
20
+ import { clientApplicationTemplatesBlock } from '../../support/index.js';
21
+ export default class CommonGenerator extends BaseApplicationGenerator {
22
+ async beforeQueue() {
23
+ if (!this.fromBlueprint) {
24
+ await this.composeWithBlueprints();
25
+ }
26
+ if (!this.delegateToBlueprint) {
27
+ await this.dependsOnBootstrapApplication();
28
+ }
29
+ }
30
+ get initializing() {
31
+ return this.asInitializingTaskGroup({
32
+ async parseCommand() {
33
+ await this.parseCurrentJHipsterCommand();
34
+ },
35
+ });
36
+ }
37
+ get [BaseApplicationGenerator.INITIALIZING]() {
38
+ return this.delegateTasksToBlueprint(() => this.initializing);
39
+ }
40
+ get prompting() {
41
+ return this.asPromptingTaskGroup({
42
+ async promptCommand({ control }) {
43
+ if (control.existingProject && this.options.askAnswered !== true)
44
+ return;
45
+ await this.promptCurrentJHipsterCommand();
46
+ },
47
+ });
48
+ }
49
+ get [BaseApplicationGenerator.PROMPTING]() {
50
+ return this.delegateTasksToBlueprint(() => this.prompting);
51
+ }
52
+ get loading() {
53
+ return this.asLoadingTaskGroup({
54
+ async loadConfig({ application }) {
55
+ await this.loadCurrentJHipsterCommandConfig(application);
56
+ },
57
+ });
58
+ }
59
+ get [BaseApplicationGenerator.LOADING]() {
60
+ return this.delegateTasksToBlueprint(() => this.loading);
61
+ }
62
+ get writing() {
63
+ return this.asWritingTaskGroup({
64
+ async writing({ application }) {
65
+ await this.writeFiles({
66
+ blocks: [
67
+ clientApplicationTemplatesBlock({
68
+ templates: ['shared/jhipster/problem-details.ts', 'shared/jhipster/headers.ts'],
69
+ }),
70
+ ],
71
+ context: application,
72
+ });
73
+ },
74
+ });
75
+ }
76
+ get [BaseApplicationGenerator.WRITING]() {
77
+ return this.delegateTasksToBlueprint(() => this.writing);
78
+ }
79
+ }
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Copyright 2013-2024 the original author or authors from the JHipster project.
3
+ *
4
+ * This file is part of the JHipster project, see https://www.jhipster.tech/
5
+ * for more information.
6
+ *
7
+ * Licensed under the Apache License, Version 2.0 (the "License");
8
+ * you may not use this file except in compliance with the License.
9
+ * You may obtain a copy of the License at
10
+ *
11
+ * https://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ */
19
+ export { default } from './generator.js';
20
+ export { default as command } from './command.js';
@@ -0,0 +1,57 @@
1
+ <%#
2
+ Copyright 2013-2024 the original author or authors from the JHipster project.
3
+
4
+ This file is part of the JHipster project, see https://www.jhipster.tech/
5
+ for more information.
6
+
7
+ Licensed under the Apache License, Version 2.0 (the "License");
8
+ you may not use this file except in compliance with the License.
9
+ You may obtain a copy of the License at
10
+
11
+ https://www.apache.org/licenses/LICENSE-2.0
12
+
13
+ Unless required by applicable law or agreed to in writing, software
14
+ distributed under the License is distributed on an "AS IS" BASIS,
15
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ See the License for the specific language governing permissions and
17
+ limitations under the License.
18
+ -%>
19
+ export type HeaderMessage = {
20
+ /** Success message */
21
+ alert?: string;
22
+ /** Error message */
23
+ error?: string;
24
+ /** Entity id for success messages. Entity name for error messages. */
25
+ param?: string;
26
+ };
27
+
28
+ const headerToString = (headerValue: any): string => {
29
+ if (Array.isArray(headerValue)) {
30
+ if (headerValue.length > 1) {
31
+ throw new Error('Multiple header values found');
32
+ }
33
+ headerValue = headerValue[0];
34
+ }
35
+ if (typeof headerValue !== 'string') {
36
+ throw new Error('Header value is not a string');
37
+ }
38
+ return headerValue;
39
+ }
40
+
41
+ const decodeHeaderValue = (headerValue: string): string => decodeURIComponent(headerValue.replace(/\+/g, ' '));
42
+
43
+ export const getMessageFromHeaders = (headers: Record<string, any>): HeaderMessage => {
44
+ let alert: string | undefined = undefined;
45
+ let param: string | undefined = undefined;
46
+ let error: string | undefined = undefined;
47
+ for (const [key, value] of Object.entries(headers)) {
48
+ if (key.toLowerCase().endsWith('-alert')) {
49
+ alert = headerToString(value);
50
+ } else if (key.toLowerCase().endsWith('-error')) {
51
+ error = headerToString(value);
52
+ } else if (key.toLowerCase().endsWith('-params')) {
53
+ param = decodeHeaderValue(headerToString(value));
54
+ }
55
+ }
56
+ return { alert, error, param };
57
+ };
@@ -0,0 +1,51 @@
1
+ <%#
2
+ Copyright 2013-2024 the original author or authors from the JHipster project.
3
+
4
+ This file is part of the JHipster project, see https://www.jhipster.tech/
5
+ for more information.
6
+
7
+ Licensed under the Apache License, Version 2.0 (the "License");
8
+ you may not use this file except in compliance with the License.
9
+ You may obtain a copy of the License at
10
+
11
+ https://www.apache.org/licenses/LICENSE-2.0
12
+
13
+ Unless required by applicable law or agreed to in writing, software
14
+ distributed under the License is distributed on an "AS IS" BASIS,
15
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ See the License for the specific language governing permissions and
17
+ limitations under the License.
18
+ -%>
19
+ /**
20
+ * Problem details defined in RFC 7807.
21
+ * @see https://datatracker.ietf.org/doc/html/rfc7807#section-3.1
22
+ */
23
+ export type ProblemDetails = {
24
+ /** A URI reference that identifies the problem type */
25
+ type: string;
26
+ /** A short, human-readable summary of the problem type */
27
+ title: string;
28
+ /** The HTTP status code */
29
+ status: number;
30
+ /** A human-readable explanation specific to this occurrence of the problem */
31
+ detail: string;
32
+ /** A URI reference that identifies the specific occurrence of the problem */
33
+ instance: string;
34
+ }
35
+
36
+ export const ProblemWithMessageType = 'https://www.jhipster.tech/problem/problem-with-message';
37
+
38
+ export type FieldErrorVM = { message: string; objectName: string; field: string };
39
+
40
+ export type ProblemWithMessage = ProblemDetails & {
41
+ type: typeof ProblemWithMessageType;
42
+
43
+ /** Translation message key */
44
+ message?: string;
45
+ /** Request path */
46
+ path?: string;
47
+ /** Field errors */
48
+ fieldErrors?: FieldErrorVM[];
49
+ };
50
+
51
+ export const isProblemWithMessage = (data: any): data is ProblemWithMessage => data?.type === ProblemWithMessageType;