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.
- package/dist/generators/angular/resources/package.json +10 -10
- package/dist/generators/angular/templates/src/main/webapp/app/account/password-reset/finish/password-reset-finish.component.spec.ts.ejs +2 -2
- package/dist/generators/angular/templates/src/main/webapp/app/account/password-reset/finish/password-reset-finish.component.ts.ejs +3 -6
- package/dist/generators/angular/templates/src/main/webapp/app/account/password-reset/init/password-reset-init.component.spec.ts.ejs +2 -2
- package/dist/generators/angular/templates/src/main/webapp/app/account/password-reset/init/password-reset-init.component.ts.ejs +3 -6
- package/dist/generators/angular/templates/src/main/webapp/app/account/register/register.component.ts.ejs +3 -6
- package/dist/generators/angular/templates/src/main/webapp/app/admin/metrics/blocks/metrics-modal-threads/metrics-modal-threads.component.html.ejs +11 -11
- package/dist/generators/angular/templates/src/main/webapp/app/admin/user-management/delete/user-management-delete-dialog.component.html.ejs +0 -2
- package/dist/generators/angular/templates/src/main/webapp/app/core/auth/user-route-access.service.ts.ejs +1 -1
- package/dist/generators/angular/templates/src/main/webapp/app/entities/_entityFolder_/delete/_entityFile_-delete-dialog.component.html.ejs +0 -3
- package/dist/generators/angular/templates/src/main/webapp/app/entities/_entityFolder_/detail/_entityFile_-detail.component.spec.ts.ejs +2 -2
- package/dist/generators/angular/templates/src/main/webapp/app/entities/_entityFolder_/route/_entityFile_-routing-resolve.service.spec.ts.ejs +2 -2
- package/dist/generators/angular/templates/src/main/webapp/app/entities/_entityFolder_/update/_entityFile_-update.component.spec.ts.ejs +3 -3
- package/dist/generators/angular/templates/src/main/webapp/app/entities/_entityFolder_/update/_entityFile_-update.component.ts.ejs +11 -17
- package/dist/generators/angular/templates/src/main/webapp/app/layouts/navbar/active-menu.directive.ts.ejs +3 -3
- package/dist/generators/angular/templates/src/main/webapp/app/login/login.component.spec.ts.ejs +2 -2
- package/dist/generators/angular/templates/src/main/webapp/app/login/login.component.ts.ejs +3 -4
- package/dist/generators/angular/templates/src/main/webapp/app/shared/alert/alert-error.component.spec.ts.ejs +2 -2
- package/dist/generators/angular/templates/src/main/webapp/app/shared/auth/has-any-authority.directive.spec.ts.ejs +10 -8
- package/dist/generators/angular/templates/src/main/webapp/app/shared/auth/has-any-authority.directive.ts.ejs +3 -8
- package/dist/generators/angular/templates/src/main/webapp/app/shared/filter/filter.component.html.ejs +6 -2
- package/dist/generators/app/generator.js +4 -13
- package/dist/generators/base/generator.js +15 -16
- package/dist/generators/base/priorities.js +12 -1
- package/dist/generators/base-application/generator.js +14 -2
- package/dist/generators/base-application/priorities.js +1 -0
- package/dist/generators/base-application/support/prepare-entity.js +7 -8
- package/dist/generators/base-application/support/prepare-relationship.js +3 -2
- package/dist/generators/base-core/generator.js +40 -9
- package/dist/generators/bootstrap-application-base/generator.js +7 -3
- package/dist/generators/bootstrap-application-server/generator.js +1 -0
- package/dist/generators/client/command.js +2 -2
- package/dist/generators/client/generators/common/command.js +5 -0
- package/dist/generators/client/generators/common/generator.js +79 -0
- package/dist/generators/client/generators/common/index.js +20 -0
- package/dist/generators/client/generators/common/templates/src/main/webapp/app/shared/jhipster/headers.ts.ejs +57 -0
- package/dist/generators/client/generators/common/templates/src/main/webapp/app/shared/jhipster/problem-details.ts.ejs +51 -0
- package/dist/generators/client/resources/package.json +4 -4
- package/dist/generators/common/generator.js +5 -0
- package/dist/generators/common/resources/package.json +2 -2
- package/dist/generators/cypress/templates/src/test/javascript/cypress/e2e/account/login-page.cy.ts.ejs +4 -4
- package/dist/generators/cypress/templates/src/test/javascript/cypress/e2e/account/password-page.cy.ts.ejs +2 -2
- package/dist/generators/cypress/templates/src/test/javascript/cypress/e2e/account/register-page.cy.ts.ejs +1 -1
- package/dist/generators/cypress/templates/src/test/javascript/cypress/e2e/account/reset-password-page.cy.ts.ejs +1 -1
- package/dist/generators/cypress/templates/src/test/javascript/cypress/e2e/entity/_entity_.cy.ts.ejs +10 -10
- package/dist/generators/docker/templates/docker/mysql.yml.ejs +1 -1
- package/dist/generators/docker/templates/docker/realm-config/jhipster-realm.json.ejs +14 -3
- package/dist/generators/docker-compose/templates/realm-config/jhipster-realm.json.ejs +14 -3
- package/dist/generators/entity/generator.js +2 -10
- package/dist/generators/entity/prompts.js +6 -11
- package/dist/generators/gatling/README.md +15 -0
- package/dist/generators/gatling/templates/src/test/java/gatling/simulations/_entityClass_GatlingTest.java.ejs +2 -10
- package/dist/generators/generate-blueprint/command.js +16 -0
- package/dist/generators/generate-blueprint/files.js +8 -0
- package/dist/generators/generate-blueprint/generator.js +17 -10
- package/dist/generators/generate-blueprint/resources/package.json +1 -1
- package/dist/generators/generate-blueprint/templates/.blueprint/cli/commands.mjs.ejs +6 -0
- package/dist/generators/generate-blueprint/templates/.blueprint/generate-sample/command.mjs.ejs +20 -0
- package/dist/generators/generate-blueprint/templates/.blueprint/generate-sample/generator.mjs.ejs +9 -13
- package/dist/generators/generate-blueprint/templates/.blueprint/github-build-matrix/build-matrix.mjs.ejs +22 -0
- package/dist/generators/generate-blueprint/templates/.blueprint/github-build-matrix/generator.mjs.ejs +24 -0
- package/dist/generators/generate-blueprint/templates/.blueprint/github-build-matrix/index.mjs.ejs +1 -0
- package/dist/generators/generate-blueprint/templates/.eslintrc.json.ejs +2 -2
- package/dist/generators/generate-blueprint/templates/README.md.ejs +16 -8
- package/dist/generators/generate-blueprint/templates/vitest.config.ts.ejs +1 -0
- package/dist/generators/generator-constants.js +1 -1
- package/dist/generators/info/generator.js +1 -3
- package/dist/generators/init/generator.js +2 -2
- package/dist/generators/init/resources/.node-version +1 -1
- package/dist/generators/java/generators/build-tool/command.js +4 -1
- package/dist/generators/java/generators/domain/templates/src/main/java/_package_/_entityPackage_/domain/_persistClass_.java.jhi.ejs +1 -5
- package/dist/generators/java/generators/domain/templates/src/test/java/_package_/_entityPackage_/domain/_persistClass_Asserts.java.ejs +3 -3
- package/dist/generators/java/generators/domain/templates/src/test/java/_package_/_entityPackage_/domain/_persistClass_Test.java.ejs +3 -3
- package/dist/generators/java/support/add-java-annotation.js +28 -7
- package/dist/generators/java/support/generated-annotation-transform.js +1 -1
- package/dist/generators/java/support/index.js +1 -1
- package/dist/generators/jdl/generator.js +1 -1
- package/dist/generators/kubernetes/files.js +1 -1
- package/dist/generators/kubernetes/templates/db/mysql.yml.ejs +0 -1
- package/dist/generators/kubernetes/templates/keycloak/keycloak-configmap.yml.ejs +14 -3
- package/dist/generators/languages/generator.js +4 -2
- package/dist/generators/maven/templates/.mvn/wrapper/maven-wrapper.properties +2 -2
- package/dist/generators/maven/templates/mvnw +185 -243
- package/dist/generators/maven/templates/mvnw.cmd +121 -180
- package/dist/generators/react/generator.js +10 -0
- package/dist/generators/react/resources/package.json +24 -24
- package/dist/generators/react/templates/src/main/webapp/app/config/axios-interceptor.spec.ts.ejs +1 -1
- package/dist/generators/react/templates/src/main/webapp/app/config/axios-interceptor.ts.ejs +1 -1
- package/dist/generators/react/templates/src/main/webapp/app/config/notification-middleware.spec.ts.ejs +1 -1
- package/dist/generators/react/templates/src/main/webapp/app/config/notification-middleware.ts.ejs +80 -87
- package/dist/generators/react/templates/src/main/webapp/app/config/store.ts.ejs +1 -1
- package/dist/generators/react/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_-update.tsx.ejs +3 -3
- package/dist/generators/react/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_.reducer.ts.ejs +12 -7
- package/dist/generators/react/templates/src/main/webapp/app/shared/reducers/reducer.utils.ts.ejs +2 -3
- package/dist/generators/server/command.js +0 -11
- package/dist/generators/server/generator.js +9 -70
- package/dist/generators/server/jdl/application-definition.js +3 -1
- package/dist/generators/server/resources/Dockerfile +12 -12
- package/dist/generators/server/resources/gradle/libs.versions.toml +7 -5
- package/dist/generators/server/resources/pom.xml +7 -7
- package/dist/generators/server/support/config.js +4 -8
- package/dist/generators/server/support/prepare-entity.js +5 -6
- package/dist/generators/server/support/relationship.js +5 -2
- package/dist/generators/server/templates/build.gradle.ejs +5 -3
- package/dist/generators/server/templates/gradle/profile_dev.gradle.ejs +1 -0
- package/dist/generators/server/templates/gradle/profile_prod.gradle.ejs +1 -0
- package/dist/generators/server/templates/gradle.properties.ejs +1 -1
- package/dist/generators/server/templates/pom.xml.ejs +7 -5
- package/dist/generators/server/templates/src/main/java/_package_/_entityPackage_/service/dto/_dtoClass_.java.ejs +1 -1
- package/dist/generators/server/templates/src/main/java/_package_/config/Constants.java.ejs +0 -2
- package/dist/generators/server/templates/src/main/java/_package_/config/SecurityConfiguration_imperative.java.ejs +1 -18
- package/dist/generators/server/templates/src/main/java/_package_/config/SecurityConfiguration_reactive.java.ejs +1 -15
- package/dist/generators/server/templates/src/main/java/_package_/config/SecurityJwtConfiguration.java.ejs +0 -20
- package/dist/generators/server/templates/src/main/java/_package_/security/SecurityUtils.java.ejs +65 -5
- package/dist/generators/server/templates/src/main/java/_package_/service/dto/UserDTO.java.ejs +23 -0
- package/dist/generators/server/templates/src/main/java/_package_/service/mapper/UserMapper.java.ejs +8 -4
- package/dist/generators/server/templates/src/main/java/_package_/web/rest/AccountResource_skipUserManagement.java.ejs +43 -9
- package/dist/generators/server/templates/src/main/resources/config/application.yml.ejs +59 -21
- package/dist/generators/server/templates/src/main/resources/swagger/api.yml.ejs +1 -1
- package/dist/generators/server/templates/src/test/java/_package_/security/DomainUserDetailsServiceIT.java.ejs +31 -13
- package/dist/generators/server/templates/src/test/java/_package_/service/mapper/UserMapperTest.java.ejs +84 -17
- package/dist/generators/server/templates/src/test/java/_package_/web/rest/AccountResourceIT.java.ejs +62 -6
- package/dist/generators/server/templates/src/test/java/_package_/web/rest/AccountResourceIT_oauth2.java.ejs +22 -0
- package/dist/generators/server/templates/src/test/resources/config/application.yml.ejs +20 -10
- package/dist/generators/spring-boot/command.js +117 -6
- package/dist/generators/spring-boot/files.js +0 -5
- package/dist/generators/spring-boot/generator.js +40 -7
- package/dist/generators/spring-boot/prompts.js +6 -70
- package/dist/generators/spring-boot/resources/spring-boot-dependencies.pom +368 -576
- package/dist/generators/spring-boot/templates/src/test/java/_package_/_entityPackage_/service/UserServiceIT.java.ejs +47 -11
- package/dist/generators/spring-boot/templates/src/test/java/_package_/_entityPackage_/web/rest/PublicUserResourceIT.java.ejs +60 -24
- package/dist/generators/spring-boot/templates/src/test/java/_package_/_entityPackage_/web/rest/UserResourceIT.java.ejs +195 -318
- package/dist/generators/spring-boot/templates/src/test/java/_package_/_entityPackage_/web/rest/_entityClass_ResourceIT.java.ejs +58 -51
- package/dist/generators/spring-cache/internal/dependencies.js +2 -2
- package/dist/generators/spring-cache/resources/gradle/libs.versions.toml +1 -1
- package/dist/generators/spring-cloud/generators/gateway/command.js +5 -1
- package/dist/generators/spring-cloud/generators/gateway/generator.js +13 -0
- package/dist/generators/spring-cloud/generators/gateway/jdl/jdl-routes-option.js +6 -0
- package/dist/generators/spring-data-cassandra/generator.js +2 -2
- package/dist/generators/spring-data-relational/templates/src/test/java/_package_/config/SqlTestContainersSpringContextCustomizerFactory.java.ejs +3 -1
- package/dist/generators/vue/resources/package.json +15 -15
- package/dist/generators/vue/templates/src/main/webapp/app/admin/tracker/tracker.service.spec.ts.ejs +1 -1
- package/dist/generators/vue/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_-details.vue.ejs +1 -1
- package/dist/generators/vue/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_-update.vue.ejs +1 -1
- package/dist/generators/vue/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_.vue.ejs +1 -1
- package/dist/generators/vue/templates/src/main/webapp/app/shared/alert/alert.service.spec.ts.ejs +8 -8
- package/dist/generators/vue/templates/src/main/webapp/app/shared/data/data-utils.service.spec.ts.ejs +1 -1
- package/dist/generators/vue/templates/tsconfig.app.json.ejs +1 -1
- package/dist/generators/vue/templates/vite.config.mts.ejs +5 -4
- package/dist/jdl/converters/jdl-to-json/jdl-to-json-basic-entity-converter.js +1 -1
- package/dist/jdl/converters/jdl-to-json/jdl-to-json-field-converter.js +4 -4
- package/dist/jdl/converters/jdl-to-json/jdl-with-applications-to-json-converter.js +9 -9
- package/dist/jdl/converters/jdl-to-json/jdl-without-application-to-json-converter.js +2 -2
- package/dist/jdl/converters/json-to-jdl-application-converter.js +1 -1
- package/dist/jdl/converters/json-to-jdl-converter.js +6 -5
- package/dist/jdl/converters/json-to-jdl-entity-converter.js +14 -14
- package/dist/jdl/converters/json-to-jdl-option-converter.js +1 -2
- package/dist/jdl/converters/parsed-jdl-to-jdl-object/application-converter.js +1 -1
- package/dist/jdl/converters/parsed-jdl-to-jdl-object/option-converter.js +2 -2
- package/dist/jdl/converters/parsed-jdl-to-jdl-object/parsed-jdl-to-jdl-object-converter.js +7 -6
- package/dist/jdl/converters/parsed-jdl-to-jdl-object/validation-converter.js +1 -1
- package/dist/jdl/exporters/applications/jhipster-application-formatter.js +16 -23
- package/dist/jdl/exporters/config.js +1 -0
- package/dist/jdl/exporters/jhipster-deployment-exporter.js +5 -5
- package/dist/jdl/exporters/jhipster-entity-exporter.js +1 -1
- package/dist/jdl/jdl-importer.js +22 -20
- package/dist/jdl/jhipster/binary-options.js +12 -8
- package/dist/jdl/jhipster/json-entity.js +1 -1
- package/dist/jdl/models/abstract-jdl-option.js +2 -2
- package/dist/jdl/models/jdl-application-configuration-factory.js +2 -0
- package/dist/jdl/models/jdl-binary-option.js +2 -2
- package/dist/jdl/models/jdl-deployment.js +11 -0
- package/dist/jdl/models/jdl-entity.js +1 -1
- package/dist/jdl/models/jdl-enum.js +1 -1
- package/dist/jdl/models/jdl-enums.js +0 -18
- package/dist/jdl/models/jdl-field.js +2 -2
- package/dist/jdl/models/jdl-object-wrapper.js +1 -0
- package/dist/jdl/models/jdl-object.js +23 -45
- package/dist/jdl/models/jdl-options.js +0 -18
- package/dist/jdl/models/jdl-relationships.js +8 -16
- package/dist/jdl/models/jdl-unary-option.js +1 -1
- package/dist/jdl/models/list-jdl-application-configuration-option.js +5 -2
- package/dist/jdl/parsing/jdl-ast-builder-visitor.js +12 -0
- package/dist/jdl/parsing/jdl-parser.js +14 -0
- package/dist/jdl/parsing/lexer/lexer.js +17 -11
- package/dist/jdl/parsing/validator.js +16 -2
- package/dist/jdl/readers/json-reader.js +1 -1
- package/dist/jdl/utils/array-utils.js +6 -0
- package/dist/jdl/utils/set-utils.js +3 -2
- package/dist/jdl/validators/jdl-without-application-validator.js +2 -2
- package/dist/testing/helpers.js +4 -0
- package/dist/types/generators/base/api.d.ts +5 -1
- package/dist/types/generators/base/generator.d.ts +10 -4
- package/dist/types/generators/base/priorities.d.ts +4 -0
- package/dist/types/generators/base/shared-data.d.ts +1 -1
- package/dist/types/generators/base-application/priorities.d.ts +2 -0
- package/dist/types/generators/base-application/support/entity.d.ts +2 -2
- package/dist/types/generators/base-application/support/prepare-entity.d.ts +3 -3
- package/dist/types/generators/base-application/support/relationship.d.ts +5 -5
- package/dist/types/generators/base-core/generator.d.ts +16 -1
- package/dist/types/generators/generator-constants.d.ts +1 -1
- package/dist/types/generators/java/support/add-java-annotation.d.ts +10 -20
- package/dist/types/generators/java/support/doc.d.ts +1 -1
- package/dist/types/generators/java/support/index.d.ts +1 -1
- package/dist/types/generators/server/support/relationship.d.ts +2 -2
- package/dist/types/generators/server/types.d.ts +5 -0
- package/dist/types/generators/spring-cloud/generators/gateway/jdl/jdl-routes-option.d.ts +2 -0
- package/dist/types/generators/spring-cloud/generators/gateway/types.d.ts +4 -0
- package/dist/types/jdl/converters/jdl-to-json/jdl-to-json-field-converter.d.ts +2 -2
- package/dist/types/jdl/converters/jdl-to-json/jdl-with-applications-to-json-converter.d.ts +2 -1
- package/dist/types/jdl/converters/jdl-to-json/jdl-without-application-to-json-converter.d.ts +3 -1
- package/dist/types/jdl/converters/json-to-jdl-application-converter.d.ts +9 -2
- package/dist/types/jdl/converters/json-to-jdl-converter.d.ts +3 -3
- package/dist/types/jdl/converters/json-to-jdl-entity-converter.d.ts +2 -4
- package/dist/types/jdl/converters/parsed-jdl-to-jdl-object/application-converter.d.ts +3 -1
- package/dist/types/jdl/converters/parsed-jdl-to-jdl-object/deployment-converter.d.ts +2 -1
- package/dist/types/jdl/converters/parsed-jdl-to-jdl-object/entity-converter.d.ts +3 -1
- package/dist/types/jdl/converters/parsed-jdl-to-jdl-object/enum-converter.d.ts +2 -1
- package/dist/types/jdl/converters/parsed-jdl-to-jdl-object/field-converter.d.ts +2 -1
- package/dist/types/jdl/converters/parsed-jdl-to-jdl-object/option-converter.d.ts +3 -3
- package/dist/types/jdl/converters/parsed-jdl-to-jdl-object/parsed-jdl-to-jdl-object-converter.d.ts +2 -1
- package/dist/types/jdl/converters/parsed-jdl-to-jdl-object/relationship-converter.d.ts +2 -1
- package/dist/types/jdl/converters/parsed-jdl-to-jdl-object/types.d.ts +110 -0
- package/dist/types/jdl/converters/parsed-jdl-to-jdl-object/validation-converter.d.ts +2 -1
- package/dist/types/jdl/converters/types.d.ts +102 -14
- package/dist/types/jdl/exporters/applications/jhipster-application-formatter.d.ts +4 -4
- package/dist/types/jdl/exporters/config.d.ts +2 -1
- package/dist/types/jdl/exporters/export-utils.d.ts +2 -1
- package/dist/types/jdl/exporters/jdl-exporter.d.ts +2 -1
- package/dist/types/jdl/exporters/jhipster-deployment-exporter.d.ts +3 -1
- package/dist/types/jdl/exporters/jhipster-entity-exporter.d.ts +3 -1
- package/dist/types/jdl/exporters/types.d.ts +61 -0
- package/dist/types/jdl/jhipster/binary-options.d.ts +8 -26
- package/dist/types/jdl/jhipster/field-types.d.ts +2 -2
- package/dist/types/jdl/jhipster/json-entity.d.ts +2 -2
- package/dist/types/jdl/models/abstract-jdl-option.d.ts +14 -9
- package/dist/types/jdl/models/boolean-jdl-application-configuration-option.d.ts +1 -1
- package/dist/types/jdl/models/integer-jdl-application-configuration-option.d.ts +1 -1
- package/dist/types/jdl/models/jdl-application-configuration-factory.d.ts +1 -1
- package/dist/types/jdl/models/jdl-application-configuration-option.d.ts +4 -4
- package/dist/types/jdl/models/jdl-application-configuration.d.ts +4 -4
- package/dist/types/jdl/models/jdl-application-definition.d.ts +4 -4
- package/dist/types/jdl/models/jdl-application-entities.d.ts +4 -4
- package/dist/types/jdl/models/jdl-application.d.ts +16 -13
- package/dist/types/jdl/models/jdl-binary-option.d.ts +5 -3
- package/dist/types/jdl/models/jdl-deployment.d.ts +13 -1
- package/dist/types/jdl/models/jdl-entity.d.ts +5 -5
- package/dist/types/jdl/models/jdl-enum-value.d.ts +4 -4
- package/dist/types/jdl/models/jdl-enum.d.ts +9 -5
- package/dist/types/jdl/models/jdl-enums.d.ts +6 -5
- package/dist/types/jdl/models/jdl-field.d.ts +10 -8
- package/dist/types/jdl/models/jdl-object-wrapper.d.ts +25 -0
- package/dist/types/jdl/models/jdl-object.d.ts +23 -19
- package/dist/types/jdl/models/jdl-options.d.ts +7 -24
- package/dist/types/jdl/models/jdl-relationship.d.ts +16 -10
- package/dist/types/jdl/models/jdl-relationships.d.ts +5 -5
- package/dist/types/jdl/models/jdl-validation.d.ts +3 -3
- package/dist/types/jdl/models/list-jdl-application-configuration-option.d.ts +4 -3
- package/dist/types/jdl/models/string-jdl-application-configuration-option.d.ts +2 -2
- package/dist/types/jdl/parsing/jdl-ast-builder-visitor.d.ts +1 -0
- package/dist/types/jdl/parsing/jdl-parser.d.ts +1 -0
- package/dist/types/jdl/parsing/jdl-parsing-types.d.ts +23 -0
- package/dist/types/jdl/parsing/lexer/lexer.d.ts +6 -2
- package/dist/types/jdl/parsing/validator.d.ts +1 -1
- package/dist/types/jdl/utils/array-utils.d.ts +1 -0
- package/dist/types/jdl/utils/set-utils.d.ts +1 -19
- package/dist/types/jdl/validators/deployment-validator.d.ts +2 -1
- package/dist/types/testing/helpers.d.ts +13 -3
- package/package.json +24 -23
- /package/dist/jdl/converters/{types.js → parsed-jdl-to-jdl-object/types.js} +0 -0
|
@@ -35,7 +35,7 @@ export function convert(jdlEntities) {
|
|
|
35
35
|
}
|
|
36
36
|
function createJSONEntities(jdlEntities) {
|
|
37
37
|
const convertedEntities = new Map();
|
|
38
|
-
jdlEntities.forEach(jdlEntity => {
|
|
38
|
+
jdlEntities.forEach((jdlEntity) => {
|
|
39
39
|
const entityName = jdlEntity.name;
|
|
40
40
|
convertedEntities.set(entityName, new JSONEntity({
|
|
41
41
|
entityName,
|
|
@@ -45,7 +45,7 @@ export function convert(jdlObject) {
|
|
|
45
45
|
}
|
|
46
46
|
function getConvertedFieldsForEntity(jdlEntity, jdlObject) {
|
|
47
47
|
const convertedEntityFields = [];
|
|
48
|
-
jdlEntity.forEachField(jdlField => {
|
|
48
|
+
jdlEntity.forEachField((jdlField) => {
|
|
49
49
|
let fieldData = {
|
|
50
50
|
fieldName: camelCase(jdlField.name),
|
|
51
51
|
fieldType: jdlField.type,
|
|
@@ -55,12 +55,12 @@ function getConvertedFieldsForEntity(jdlEntity, jdlObject) {
|
|
|
55
55
|
fieldData.documentation = comment;
|
|
56
56
|
}
|
|
57
57
|
if (jdlObject.hasEnum(jdlField.type)) {
|
|
58
|
-
fieldData.fieldValues = jdlObject.getEnum(fieldData.fieldType)
|
|
59
|
-
const fieldTypeComment = jdlObject.getEnum(fieldData.fieldType)
|
|
58
|
+
fieldData.fieldValues = jdlObject.getEnum(fieldData.fieldType)?.getValuesAsString();
|
|
59
|
+
const fieldTypeComment = jdlObject.getEnum(fieldData.fieldType)?.comment;
|
|
60
60
|
if (fieldTypeComment) {
|
|
61
61
|
fieldData.fieldTypeDocumentation = fieldTypeComment;
|
|
62
62
|
}
|
|
63
|
-
const fieldValuesJavadocs = jdlObject.getEnum(fieldData.fieldType)
|
|
63
|
+
const fieldValuesJavadocs = jdlObject.getEnum(fieldData.fieldType)?.getValueJavadocs();
|
|
64
64
|
if (fieldValuesJavadocs && Object.keys(fieldValuesJavadocs).length > 0) {
|
|
65
65
|
fieldData.fieldValuesJavadocs = fieldValuesJavadocs;
|
|
66
66
|
}
|
|
@@ -30,13 +30,13 @@ export default { convert };
|
|
|
30
30
|
* @param {JDLObject} args.jdlObject - the JDLObject to convert to JSON
|
|
31
31
|
* @returns {Map} entities that can be exported to JSON
|
|
32
32
|
*/
|
|
33
|
-
export function convert(args
|
|
34
|
-
if (!args
|
|
33
|
+
export function convert(args) {
|
|
34
|
+
if (!args?.jdlObject) {
|
|
35
35
|
throw new Error('The JDL object is mandatory.');
|
|
36
36
|
}
|
|
37
37
|
init(args);
|
|
38
38
|
setEntitiesPerApplication();
|
|
39
|
-
if (entitiesPerApplication.size === 0) {
|
|
39
|
+
if (entitiesPerApplication.size === 0 && jdlObject) {
|
|
40
40
|
const applicationNames = jdlObject.getApplications().map(jdlApplication => jdlApplication.getConfigurationOptionValue('baseName'));
|
|
41
41
|
return new Map(applicationNames.map(applicationName => [applicationName, []]));
|
|
42
42
|
}
|
|
@@ -63,7 +63,7 @@ function resetState() {
|
|
|
63
63
|
entities = null;
|
|
64
64
|
}
|
|
65
65
|
function setEntitiesPerApplication() {
|
|
66
|
-
jdlObject
|
|
66
|
+
jdlObject?.forEachApplication((jdlApplication) => {
|
|
67
67
|
const entityNames = jdlApplication.getEntityNames();
|
|
68
68
|
if (entityNames.length === 0) {
|
|
69
69
|
return;
|
|
@@ -85,15 +85,15 @@ function setFields() {
|
|
|
85
85
|
});
|
|
86
86
|
}
|
|
87
87
|
function setRelationships() {
|
|
88
|
-
const convertedRelationships = RelationshipConverter.convert(jdlObject
|
|
88
|
+
const convertedRelationships = RelationshipConverter.convert(jdlObject?.getRelationships(), jdlObject?.getEntityNames());
|
|
89
89
|
convertedRelationships.forEach((entityRelationships, entityName) => {
|
|
90
90
|
entities[entityName].addRelationships(entityRelationships);
|
|
91
91
|
});
|
|
92
92
|
}
|
|
93
93
|
function setApplicationToEntities() {
|
|
94
|
-
jdlObject
|
|
94
|
+
jdlObject?.forEachApplication((jdlApplication) => {
|
|
95
95
|
const baseName = jdlApplication.getConfigurationOptionValue('baseName');
|
|
96
|
-
jdlApplication.forEachEntityName(entityName => {
|
|
96
|
+
jdlApplication.forEachEntityName((entityName) => {
|
|
97
97
|
if (!entities[entityName]) {
|
|
98
98
|
return;
|
|
99
99
|
}
|
|
@@ -106,7 +106,7 @@ function setOptions(entitiesForEachApplication) {
|
|
|
106
106
|
convertedOptionContents.forEach((optionContent, entityName) => {
|
|
107
107
|
entities[entityName].setOptions(optionContent);
|
|
108
108
|
});
|
|
109
|
-
jdlObject
|
|
109
|
+
jdlObject?.forEachApplication(jdlApplication => {
|
|
110
110
|
const convertedOptionContentsForApplication = OptionConverter.convert(jdlApplication);
|
|
111
111
|
const applicationName = jdlApplication.getConfigurationOptionValue('baseName');
|
|
112
112
|
const applicationEntities = entitiesForEachApplication.get(applicationName);
|
|
@@ -140,7 +140,7 @@ function formatEntitiesForEachApplication(entitiesForEachApplication) {
|
|
|
140
140
|
});
|
|
141
141
|
}
|
|
142
142
|
function addApplicationsWithoutEntities(entitiesForEachApplication) {
|
|
143
|
-
jdlObject
|
|
143
|
+
jdlObject?.forEachApplication(jdlApplication => {
|
|
144
144
|
if (jdlApplication.getEntityNames().length === 0) {
|
|
145
145
|
entitiesForEachApplication.set(jdlApplication.getConfigurationOptionValue('baseName'), []);
|
|
146
146
|
}
|
|
@@ -34,8 +34,8 @@ export default {
|
|
|
34
34
|
* @param {string} args.applicationType - the application's type
|
|
35
35
|
* @returns {Map} entities that can be exported to JSON
|
|
36
36
|
*/
|
|
37
|
-
export function convert(args
|
|
38
|
-
if (!args
|
|
37
|
+
export function convert(args) {
|
|
38
|
+
if (!args?.jdlObject || !args.applicationName || !args.databaseType) {
|
|
39
39
|
throw new Error("The JDL object, the application's name, and its the database type are mandatory.");
|
|
40
40
|
}
|
|
41
41
|
init(args);
|
|
@@ -22,7 +22,7 @@ const GENERATOR_NAME = 'generator-jhipster';
|
|
|
22
22
|
export function convertApplicationsToJDL({ applications, jdl } = {}) {
|
|
23
23
|
const jsonApplications = applications || [];
|
|
24
24
|
const jdlObject = jdl || new JDLObject();
|
|
25
|
-
jsonApplications.forEach(application => {
|
|
25
|
+
jsonApplications.forEach((application) => {
|
|
26
26
|
const convertedApplication = convertApplicationToJDL({ application });
|
|
27
27
|
jdlObject.addApplication(convertedApplication);
|
|
28
28
|
});
|
|
@@ -87,7 +87,7 @@ export function getJDLObjectFromSingleApplication(yoRcFileContent, entities, exi
|
|
|
87
87
|
existingJDLObject.addApplication(jdlApplication);
|
|
88
88
|
return existingJDLObject;
|
|
89
89
|
}
|
|
90
|
-
const jdlObject = convertEntitiesToJDL(
|
|
90
|
+
const jdlObject = convertEntitiesToJDL(entities);
|
|
91
91
|
entities.forEach((entity, entityName) => jdlApplication.addEntityName(entityName));
|
|
92
92
|
jdlObject.addApplication(jdlApplication);
|
|
93
93
|
return mergeJDLObjects(existingJDLObject, jdlObject);
|
|
@@ -97,20 +97,21 @@ function cleanYoRcFileContent(yoRcFileContent) {
|
|
|
97
97
|
yoRcFileContent[key] = removeFieldsWithNullishValues(yoRcFileContent[key]);
|
|
98
98
|
}
|
|
99
99
|
delete yoRcFileContent[GENERATOR_JHIPSTER].promptValues;
|
|
100
|
+
const result = structuredClone(yoRcFileContent);
|
|
100
101
|
if (yoRcFileContent[GENERATOR_JHIPSTER].blueprints) {
|
|
101
|
-
|
|
102
|
+
result[GENERATOR_JHIPSTER].blueprints = yoRcFileContent[GENERATOR_JHIPSTER].blueprints.map(blueprint => blueprint.name);
|
|
102
103
|
}
|
|
103
104
|
if (yoRcFileContent[GENERATOR_JHIPSTER].microfrontends) {
|
|
104
|
-
|
|
105
|
+
result[GENERATOR_JHIPSTER].microfrontends = yoRcFileContent[GENERATOR_JHIPSTER].microfrontends.map(({ baseName }) => baseName);
|
|
105
106
|
}
|
|
106
|
-
return
|
|
107
|
+
return result;
|
|
107
108
|
}
|
|
108
109
|
function getJSONEntityFiles(applicationDirectory) {
|
|
109
110
|
const entities = new Map();
|
|
110
111
|
fs.readdirSync(path.join(applicationDirectory, '.jhipster')).forEach(file => {
|
|
112
|
+
const entityName = file.slice(0, file.indexOf('.json'));
|
|
111
113
|
const jsonFilePath = path.join(applicationDirectory, '.jhipster', file);
|
|
112
114
|
if (fs.statSync(jsonFilePath).isFile() && file.endsWith('.json')) {
|
|
113
|
-
const entityName = file.slice(0, file.indexOf('.json'));
|
|
114
115
|
entities.set(entityName, readJSONFile(jsonFilePath));
|
|
115
116
|
}
|
|
116
117
|
});
|
|
@@ -43,17 +43,17 @@ let jdlObject;
|
|
|
43
43
|
* @param params.entities - a Map having for keys the entity names and values the JSON entity files.
|
|
44
44
|
* @return the parsed entities in the JDL form.
|
|
45
45
|
*/
|
|
46
|
-
export function convertEntitiesToJDL(
|
|
47
|
-
if (!
|
|
46
|
+
export function convertEntitiesToJDL(entities) {
|
|
47
|
+
if (!entities) {
|
|
48
48
|
throw new Error('Entities have to be passed to be converted.');
|
|
49
49
|
}
|
|
50
|
-
init(
|
|
50
|
+
init(entities);
|
|
51
51
|
addEntities();
|
|
52
52
|
addRelationshipsToJDL();
|
|
53
53
|
return jdlObject;
|
|
54
54
|
}
|
|
55
|
-
function init(
|
|
56
|
-
entities =
|
|
55
|
+
function init(ents) {
|
|
56
|
+
entities = ents;
|
|
57
57
|
jdlObject = new JDLObject();
|
|
58
58
|
}
|
|
59
59
|
function addEntities() {
|
|
@@ -90,9 +90,7 @@ function convertJSONToJDLField(field) {
|
|
|
90
90
|
if (jdlField.type === BYTES) {
|
|
91
91
|
jdlField.type = getTypeForBlob(field.fieldTypeBlobContent);
|
|
92
92
|
}
|
|
93
|
-
|
|
94
|
-
addValidations(jdlField, field);
|
|
95
|
-
}
|
|
93
|
+
addValidations(jdlField, field);
|
|
96
94
|
return jdlField;
|
|
97
95
|
}
|
|
98
96
|
function getTypeForBlob(blobContentType) {
|
|
@@ -102,9 +100,11 @@ function getTypeForBlob(blobContentType) {
|
|
|
102
100
|
throw new Error(`Unrecognised blob type: '${blobContentType}'`);
|
|
103
101
|
}
|
|
104
102
|
function addValidations(jdlField, field) {
|
|
105
|
-
field.fieldValidateRules
|
|
106
|
-
|
|
107
|
-
|
|
103
|
+
if (field.fieldValidateRules) {
|
|
104
|
+
field.fieldValidateRules.forEach((rule) => {
|
|
105
|
+
jdlField.addValidation(convertJSONToJDLValidation(rule, field));
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
108
|
}
|
|
109
109
|
function convertJSONToJDLValidation(rule, field) {
|
|
110
110
|
return new JDLValidation({
|
|
@@ -113,7 +113,7 @@ function convertJSONToJDLValidation(rule, field) {
|
|
|
113
113
|
});
|
|
114
114
|
}
|
|
115
115
|
function addEnumsToJDL(entity) {
|
|
116
|
-
entity?.fields?.forEach(field => {
|
|
116
|
+
entity?.fields?.forEach((field) => {
|
|
117
117
|
if (field.fieldValues !== undefined) {
|
|
118
118
|
jdlObject.addEnum(new JDLEnum({
|
|
119
119
|
name: field.fieldType,
|
|
@@ -281,13 +281,13 @@ function addEntityOptionsToJDL(entity, entityName) {
|
|
|
281
281
|
function addUnaryOptionToJDL(unaryOption, entityName) {
|
|
282
282
|
jdlObject.addOption(new JDLUnaryOption({
|
|
283
283
|
name: unaryOption,
|
|
284
|
-
entityNames: [entityName],
|
|
284
|
+
entityNames: new Set([entityName]),
|
|
285
285
|
}));
|
|
286
286
|
}
|
|
287
287
|
function addBinaryOptionToJDL(binaryOption, value, entityName) {
|
|
288
288
|
jdlObject.addOption(new JDLBinaryOption({
|
|
289
289
|
name: binaryOption,
|
|
290
290
|
value,
|
|
291
|
-
entityNames: [entityName],
|
|
291
|
+
entityNames: new Set([entityName]),
|
|
292
292
|
}));
|
|
293
293
|
}
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
* limitations under the License.
|
|
18
18
|
*/
|
|
19
19
|
import JDLObject from '../models/jdl-object.js';
|
|
20
|
-
import JDLUnaryOption from '../models/jdl-unary-option.js';
|
|
21
20
|
import { unaryOptions } from '../jhipster/index.js';
|
|
21
|
+
import JDLUnaryOption from '../models/jdl-unary-option.js';
|
|
22
22
|
const { SKIP_CLIENT, SKIP_SERVER } = unaryOptions;
|
|
23
23
|
export default {
|
|
24
24
|
convertServerOptionsToJDL,
|
|
@@ -36,7 +36,6 @@ export function convertServerOptionsToJDL(config, jdl) {
|
|
|
36
36
|
if (jhipsterConfig[option] === true) {
|
|
37
37
|
jdlObject.addOption(new JDLUnaryOption({
|
|
38
38
|
name: option,
|
|
39
|
-
value: jhipsterConfig[option],
|
|
40
39
|
}));
|
|
41
40
|
}
|
|
42
41
|
});
|
|
@@ -40,7 +40,7 @@ export function convertApplications(parsedApplications) {
|
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
42
|
function getEntityOptionsInApplication(parsedApplication) {
|
|
43
|
-
return convertOptions(parsedApplication.options, parsedApplication.useOptions);
|
|
43
|
+
return convertOptions(parsedApplication.options, parsedApplication.useOptions || []);
|
|
44
44
|
}
|
|
45
45
|
/**
|
|
46
46
|
* Checks whether the entity names used in the options are present in the entity names declared for the application.
|
|
@@ -38,7 +38,7 @@ export function convertOptions(parsedOptions, useOptions) {
|
|
|
38
38
|
}
|
|
39
39
|
function convertUnaryOptions(parsedOptions) {
|
|
40
40
|
const convertedUnaryOptions = [];
|
|
41
|
-
unaryOptions.forEach(unaryOptionName => {
|
|
41
|
+
unaryOptions.forEach((unaryOptionName) => {
|
|
42
42
|
const parsedUnaryOption = parsedOptions[unaryOptionName];
|
|
43
43
|
if (!parsedUnaryOption || !parsedUnaryOption.list || parsedUnaryOption.list.length === 0) {
|
|
44
44
|
return;
|
|
@@ -53,7 +53,7 @@ function convertUnaryOptions(parsedOptions) {
|
|
|
53
53
|
}
|
|
54
54
|
function convertBinaryOptions(parsedOptions) {
|
|
55
55
|
const convertedBinaryOptions = [];
|
|
56
|
-
binaryOptions.forEach(binaryOptionName => {
|
|
56
|
+
binaryOptions.forEach((binaryOptionName) => {
|
|
57
57
|
if (!parsedOptions[binaryOptionName]) {
|
|
58
58
|
return;
|
|
59
59
|
}
|
|
@@ -61,20 +61,20 @@ function init(passedConfiguration) {
|
|
|
61
61
|
configuration = passedConfiguration;
|
|
62
62
|
jdlObject = new JDLObject();
|
|
63
63
|
entityNames = parsedContent.entities.map(entity => entity.name);
|
|
64
|
-
applicationsPerEntityName =
|
|
64
|
+
applicationsPerEntityName = new Map();
|
|
65
65
|
}
|
|
66
66
|
function fillApplications() {
|
|
67
67
|
// TODO: Function which expects two arguments is called with three.
|
|
68
68
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
69
69
|
// @ts-expect-error
|
|
70
70
|
const jdlApplications = convertApplications(parsedContent.applications, configuration, entityNames);
|
|
71
|
-
jdlApplications.forEach(jdlApplication => {
|
|
71
|
+
jdlApplications.forEach((jdlApplication) => {
|
|
72
72
|
jdlObject.addApplication(jdlApplication);
|
|
73
73
|
fillApplicationsPerEntityName(jdlApplication);
|
|
74
74
|
});
|
|
75
75
|
}
|
|
76
76
|
function fillApplicationsPerEntityName(application) {
|
|
77
|
-
application.forEachEntityName(entityName => {
|
|
77
|
+
application.forEachEntityName((entityName) => {
|
|
78
78
|
applicationsPerEntityName[entityName] = applicationsPerEntityName[entityName] || [];
|
|
79
79
|
applicationsPerEntityName[entityName].push(application);
|
|
80
80
|
});
|
|
@@ -99,11 +99,12 @@ function fillClassesAndFields() {
|
|
|
99
99
|
}
|
|
100
100
|
function getJDLFieldsFromParsedEntity(entity) {
|
|
101
101
|
const fields = [];
|
|
102
|
-
|
|
103
|
-
|
|
102
|
+
const arr = entity.body || [];
|
|
103
|
+
for (let i = 0; i < arr.length; i++) {
|
|
104
|
+
const field = arr[i];
|
|
104
105
|
const jdlField = convertField(field);
|
|
105
106
|
jdlField.validations = getValidations(field);
|
|
106
|
-
jdlField.options = convertAnnotationsToOptions(field.annotations);
|
|
107
|
+
jdlField.options = convertAnnotationsToOptions(field.annotations || []);
|
|
107
108
|
fields.push(jdlField);
|
|
108
109
|
}
|
|
109
110
|
return fields;
|
|
@@ -32,7 +32,7 @@ export function convertValidations(validations, constantValueGetter) {
|
|
|
32
32
|
}
|
|
33
33
|
return validations.reduce((jdlValidations, parsedValidation) => {
|
|
34
34
|
if (parsedValidation) {
|
|
35
|
-
jdlValidations
|
|
35
|
+
jdlValidations = [...jdlValidations, convertValidation(parsedValidation, constantValueGetter)];
|
|
36
36
|
}
|
|
37
37
|
return jdlValidations;
|
|
38
38
|
}, []);
|
|
@@ -20,34 +20,26 @@ import { GENERATOR_NAME } from '../export-utils.js';
|
|
|
20
20
|
/**
|
|
21
21
|
* Exports JDL applications to JDL files in separate folders (based on application base names).
|
|
22
22
|
* @param applications the applications to exporters (key: application name, value: a JDLApplication).
|
|
23
|
-
* @param {Object} [configuration]
|
|
24
23
|
* @return object[] exported applications in their final form.
|
|
25
24
|
*/
|
|
26
|
-
export function formatApplicationsToExport(applications
|
|
25
|
+
export function formatApplicationsToExport(applications) {
|
|
27
26
|
if (!applications) {
|
|
28
27
|
throw new Error('Applications have to be passed to be exported.');
|
|
29
28
|
}
|
|
30
29
|
return Object.values(applications).map(application => {
|
|
31
|
-
|
|
32
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
33
|
-
// @ts-expect-error
|
|
34
|
-
return setUpApplicationStructure(application, configuration);
|
|
30
|
+
return setUpApplicationStructure(application);
|
|
35
31
|
});
|
|
36
32
|
}
|
|
37
33
|
/**
|
|
38
34
|
* Exports JDL a application to a JDL file in the current directory.
|
|
39
35
|
* @param {Object} application - the JDL application to export.
|
|
40
|
-
* @param {Object} [configuration]
|
|
41
36
|
* @return {Object} the exported application in its final form.
|
|
42
37
|
*/
|
|
43
|
-
export function formatApplicationToExport(application
|
|
44
|
-
|
|
45
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
46
|
-
// @ts-expect-error
|
|
47
|
-
return setUpApplicationStructure(application, configuration);
|
|
38
|
+
export function formatApplicationToExport(application) {
|
|
39
|
+
return setUpApplicationStructure(application);
|
|
48
40
|
}
|
|
49
41
|
function setUpApplicationStructure(application) {
|
|
50
|
-
|
|
42
|
+
const applicationToExport = {
|
|
51
43
|
[GENERATOR_NAME]: {},
|
|
52
44
|
};
|
|
53
45
|
applicationToExport[GENERATOR_NAME] = getApplicationConfig(application);
|
|
@@ -58,12 +50,12 @@ function setUpApplicationStructure(application) {
|
|
|
58
50
|
if (application.hasConfigurationOption('creationTimestamp')) {
|
|
59
51
|
applicationToExport[GENERATOR_NAME].creationTimestamp = parseInt(application.getConfigurationOptionValue('creationTimestamp'), 10);
|
|
60
52
|
}
|
|
61
|
-
|
|
62
|
-
return
|
|
53
|
+
const postProcessedApplicationToExport = cleanUpOptions(applicationToExport);
|
|
54
|
+
return postProcessedApplicationToExport;
|
|
63
55
|
}
|
|
64
56
|
function getApplicationConfig(application) {
|
|
65
57
|
const result = {};
|
|
66
|
-
application.forEachConfigurationOption(option => {
|
|
58
|
+
application.forEachConfigurationOption((option) => {
|
|
67
59
|
result[option.name] = option.getValue();
|
|
68
60
|
});
|
|
69
61
|
return result;
|
|
@@ -73,7 +65,7 @@ function getApplicationNamespaceConfig(application) {
|
|
|
73
65
|
return undefined;
|
|
74
66
|
}
|
|
75
67
|
const result = {};
|
|
76
|
-
application.forEachNamespaceConfiguration(configurationOption => {
|
|
68
|
+
application.forEachNamespaceConfiguration((configurationOption) => {
|
|
77
69
|
result[configurationOption.namespace] = result[configurationOption.namespace] ?? {};
|
|
78
70
|
configurationOption.forEachOption(option => {
|
|
79
71
|
result[configurationOption.namespace][option.name] = option.getValue();
|
|
@@ -82,19 +74,20 @@ function getApplicationNamespaceConfig(application) {
|
|
|
82
74
|
return result;
|
|
83
75
|
}
|
|
84
76
|
function cleanUpOptions(application) {
|
|
85
|
-
|
|
86
|
-
|
|
77
|
+
const res = structuredClone(application);
|
|
78
|
+
if (res[GENERATOR_NAME].frontEndBuilder) {
|
|
79
|
+
delete res[GENERATOR_NAME].frontEndBuilder;
|
|
87
80
|
}
|
|
88
|
-
delete
|
|
81
|
+
delete res.entityNames;
|
|
89
82
|
if (application[GENERATOR_NAME].blueprints) {
|
|
90
|
-
|
|
83
|
+
res[GENERATOR_NAME].blueprints = application[GENERATOR_NAME].blueprints.map(blueprintName => ({
|
|
91
84
|
name: blueprintName,
|
|
92
85
|
}));
|
|
93
86
|
}
|
|
94
87
|
if (application[GENERATOR_NAME].microfrontends) {
|
|
95
|
-
|
|
88
|
+
res[GENERATOR_NAME].microfrontends = application[GENERATOR_NAME].microfrontends.map(baseName => ({
|
|
96
89
|
baseName,
|
|
97
90
|
}));
|
|
98
91
|
}
|
|
99
|
-
return
|
|
92
|
+
return res;
|
|
100
93
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { GENERATOR_NAME } from './export-utils.js';
|
|
2
2
|
export const mergeYoRcContent = (oldConfig, newConfig) => {
|
|
3
|
+
// @ts-expect-error partial assignment
|
|
3
4
|
const merged = { [GENERATOR_NAME]: {} };
|
|
4
5
|
for (const ns of new Set([...Object.keys(oldConfig), ...Object.keys(newConfig)])) {
|
|
5
6
|
merged[ns] = { ...oldConfig[ns], ...newConfig[ns] };
|
|
@@ -31,9 +31,9 @@ export default function exportDeployments(deployments) {
|
|
|
31
31
|
}
|
|
32
32
|
return Object.values(deployments).map(deployment => {
|
|
33
33
|
checkForErrors(deployment);
|
|
34
|
-
|
|
35
|
-
writeDeploymentConfigs(
|
|
36
|
-
return
|
|
34
|
+
const yoRcDeployment = setUpDeploymentStructure(deployment);
|
|
35
|
+
writeDeploymentConfigs(yoRcDeployment);
|
|
36
|
+
return yoRcDeployment;
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
39
|
function checkForErrors(deployment) {
|
|
@@ -49,8 +49,8 @@ function setUpDeploymentStructure(deployment) {
|
|
|
49
49
|
return deploymentToExport;
|
|
50
50
|
}
|
|
51
51
|
function setUpArrayOptions(deployment) {
|
|
52
|
-
deployment[GENERATOR_NAME].appsFolders = Array.from(deployment[GENERATOR_NAME]
|
|
53
|
-
deployment[GENERATOR_NAME].clusteredDbApps = Array.from(deployment[GENERATOR_NAME]
|
|
52
|
+
deployment[GENERATOR_NAME].appsFolders = Array.from(deployment[GENERATOR_NAME]?.appsFolders || []);
|
|
53
|
+
deployment[GENERATOR_NAME].clusteredDbApps = Array.from(deployment[GENERATOR_NAME]?.clusteredDbApps || []);
|
|
54
54
|
return deployment;
|
|
55
55
|
}
|
|
56
56
|
/**
|
|
@@ -55,7 +55,7 @@ function init(passedConfiguration) {
|
|
|
55
55
|
* @param subFolder the folder (to create) in which the JHipster entity folder will be.
|
|
56
56
|
*/
|
|
57
57
|
function updateEntities(subFolder) {
|
|
58
|
-
return configuration.entities.map(entity => {
|
|
58
|
+
return configuration.entities.map((entity) => {
|
|
59
59
|
const filePath = path.join(subFolder, toFilePath(entity.name));
|
|
60
60
|
return updateEntityToGenerateWithExistingOne(filePath, entity);
|
|
61
61
|
});
|
package/dist/jdl/jdl-importer.js
CHANGED
|
@@ -29,8 +29,10 @@ import exportEntities from './exporters/jhipster-entity-exporter.js';
|
|
|
29
29
|
import createWithApplicationValidator from './validators/jdl-with-application-validator.js';
|
|
30
30
|
import createWithoutApplicationValidator from './validators/jdl-without-application-validator.js';
|
|
31
31
|
import { applicationOptions } from './jhipster/index.js';
|
|
32
|
+
import { GENERATOR_NAME } from './exporters/export-utils.js';
|
|
32
33
|
const { OptionNames } = applicationOptions;
|
|
33
34
|
const { APPLICATION_TYPE, BASE_NAME } = OptionNames;
|
|
35
|
+
const GENERATOR_JHIPSTER = 'generator-jhipster'; // can't use the one of the generator as it circles
|
|
34
36
|
/**
|
|
35
37
|
* Creates a new JDL importer from files.
|
|
36
38
|
* There are two ways to create an importer:
|
|
@@ -99,10 +101,10 @@ function makeJDLImporter(content, configuration) {
|
|
|
99
101
|
importState.exportedEntities = importOnlyEntities(jdlObject, configuration);
|
|
100
102
|
}
|
|
101
103
|
else if (jdlObject.getApplicationQuantity() === 1) {
|
|
102
|
-
importState = importOneApplicationAndEntities(jdlObject
|
|
104
|
+
importState = importOneApplicationAndEntities(jdlObject);
|
|
103
105
|
}
|
|
104
106
|
else {
|
|
105
|
-
importState = importApplicationsAndEntities(jdlObject
|
|
107
|
+
importState = importApplicationsAndEntities(jdlObject);
|
|
106
108
|
}
|
|
107
109
|
if (jdlObject.getDeploymentQuantity()) {
|
|
108
110
|
importState.exportedDeployments = importDeployments(jdlObject.deployments);
|
|
@@ -119,9 +121,9 @@ function getJDLObject(parsedJDLContent, configuration) {
|
|
|
119
121
|
let applicationType = configuration.applicationType;
|
|
120
122
|
let databaseType = configuration.databaseType;
|
|
121
123
|
if (configuration.application) {
|
|
122
|
-
baseName = configuration.application[
|
|
123
|
-
applicationType = configuration.application[
|
|
124
|
-
databaseType = configuration.application[
|
|
124
|
+
baseName = configuration.application[GENERATOR_JHIPSTER].baseName;
|
|
125
|
+
applicationType = configuration.application[GENERATOR_JHIPSTER].applicationType;
|
|
126
|
+
databaseType = configuration.application[GENERATOR_JHIPSTER].databaseType;
|
|
125
127
|
}
|
|
126
128
|
return ParsedJDLToJDLObjectConverter.parseFromConfigurationObject({
|
|
127
129
|
parsedContent: parsedJDLContent,
|
|
@@ -140,15 +142,15 @@ function checkForErrors(jdlObject, configuration, logger = console) {
|
|
|
140
142
|
let applicationType = configuration.applicationType;
|
|
141
143
|
let databaseType = configuration.databaseType;
|
|
142
144
|
let blueprints = configuration.blueprints;
|
|
143
|
-
if (application && application[
|
|
145
|
+
if (application && application[GENERATOR_JHIPSTER]) {
|
|
144
146
|
if (applicationType === undefined) {
|
|
145
|
-
applicationType = application[
|
|
147
|
+
applicationType = application[GENERATOR_JHIPSTER].applicationType;
|
|
146
148
|
}
|
|
147
149
|
if (databaseType === undefined) {
|
|
148
|
-
databaseType = application[
|
|
150
|
+
databaseType = application[GENERATOR_JHIPSTER].databaseType;
|
|
149
151
|
}
|
|
150
152
|
if (blueprints === undefined) {
|
|
151
|
-
blueprints = application[
|
|
153
|
+
blueprints = application[GENERATOR_JHIPSTER].blueprints;
|
|
152
154
|
}
|
|
153
155
|
}
|
|
154
156
|
validator = createWithoutApplicationValidator(jdlObject, {
|
|
@@ -168,15 +170,15 @@ function importOnlyEntities(jdlObject, configuration) {
|
|
|
168
170
|
if (!configuration.application && doesFileExist('.yo-rc.json')) {
|
|
169
171
|
application = readJSONFile('.yo-rc.json');
|
|
170
172
|
}
|
|
171
|
-
if (application && application[
|
|
173
|
+
if (application && application[GENERATOR_JHIPSTER]) {
|
|
172
174
|
if (applicationType === undefined) {
|
|
173
|
-
applicationType = application[
|
|
175
|
+
applicationType = application[GENERATOR_JHIPSTER].applicationType;
|
|
174
176
|
}
|
|
175
177
|
if (applicationName === undefined) {
|
|
176
|
-
applicationName = application[
|
|
178
|
+
applicationName = application[GENERATOR_JHIPSTER].baseName;
|
|
177
179
|
}
|
|
178
180
|
if (databaseType === undefined) {
|
|
179
|
-
databaseType = application[
|
|
181
|
+
databaseType = application[GENERATOR_JHIPSTER].databaseType;
|
|
180
182
|
}
|
|
181
183
|
}
|
|
182
184
|
const entitiesPerApplicationMap = JDLWithoutApplicationToJSONConverter.convert({
|
|
@@ -188,14 +190,14 @@ function importOnlyEntities(jdlObject, configuration) {
|
|
|
188
190
|
const jsonEntities = entitiesPerApplicationMap.get(applicationName);
|
|
189
191
|
return exportJSONEntities(jsonEntities, configuration);
|
|
190
192
|
}
|
|
191
|
-
function importOneApplicationAndEntities(jdlObject
|
|
193
|
+
function importOneApplicationAndEntities(jdlObject) {
|
|
192
194
|
const importState = {
|
|
193
195
|
exportedApplications: [],
|
|
194
196
|
exportedApplicationsWithEntities: {},
|
|
195
197
|
exportedEntities: [],
|
|
196
198
|
exportedDeployments: [],
|
|
197
199
|
};
|
|
198
|
-
const formattedApplication = formatApplicationToExport(jdlObject.getApplications()[0]
|
|
200
|
+
const formattedApplication = formatApplicationToExport(jdlObject.getApplications()[0]);
|
|
199
201
|
importState.exportedApplications.push(formattedApplication);
|
|
200
202
|
const jdlApplication = jdlObject.getApplications()[0];
|
|
201
203
|
const applicationName = jdlApplication.getConfigurationOptionValue(BASE_NAME);
|
|
@@ -203,7 +205,7 @@ function importOneApplicationAndEntities(jdlObject, configuration) {
|
|
|
203
205
|
jdlObject,
|
|
204
206
|
});
|
|
205
207
|
const jsonEntities = entitiesPerApplicationMap.get(applicationName);
|
|
206
|
-
const {
|
|
208
|
+
const { [GENERATOR_NAME]: config, ...remaining } = formattedApplication;
|
|
207
209
|
importState.exportedApplicationsWithEntities[applicationName] = {
|
|
208
210
|
config,
|
|
209
211
|
...remaining,
|
|
@@ -220,14 +222,14 @@ function importOneApplicationAndEntities(jdlObject, configuration) {
|
|
|
220
222
|
}
|
|
221
223
|
return importState;
|
|
222
224
|
}
|
|
223
|
-
function importApplicationsAndEntities(jdlObject
|
|
225
|
+
function importApplicationsAndEntities(jdlObject) {
|
|
224
226
|
const importState = {
|
|
225
227
|
exportedApplications: [],
|
|
226
228
|
exportedApplicationsWithEntities: {},
|
|
227
229
|
exportedEntities: [],
|
|
228
230
|
exportedDeployments: [],
|
|
229
231
|
};
|
|
230
|
-
const formattedApplications = formatApplicationsToExport(jdlObject.applications
|
|
232
|
+
const formattedApplications = formatApplicationsToExport(jdlObject.applications);
|
|
231
233
|
importState.exportedApplications = formattedApplications;
|
|
232
234
|
const entitiesPerApplicationMap = convert({
|
|
233
235
|
jdlObject,
|
|
@@ -257,8 +259,8 @@ function exportJSONEntities(entities, configuration) {
|
|
|
257
259
|
let baseName = configuration.applicationName;
|
|
258
260
|
let applicationType = configuration.applicationType;
|
|
259
261
|
if (configuration.application) {
|
|
260
|
-
baseName = configuration.application[
|
|
261
|
-
applicationType = configuration.application[
|
|
262
|
+
baseName = configuration.application[GENERATOR_JHIPSTER].baseName;
|
|
263
|
+
applicationType = configuration.application[GENERATOR_JHIPSTER].applicationType;
|
|
262
264
|
}
|
|
263
265
|
return exportEntities({
|
|
264
266
|
entities,
|
|
@@ -33,15 +33,19 @@ const Options = {
|
|
|
33
33
|
CLIENT_ROOT_FOLDER: 'clientRootFolder',
|
|
34
34
|
};
|
|
35
35
|
const optionNames = Object.values(Options);
|
|
36
|
+
const dtoValues = { MAPSTRUCT, NO: NO_MAPPER };
|
|
37
|
+
const serviceValues = { SERVICE_CLASS, SERVICE_IMPL, NO: NO_SERVICE };
|
|
38
|
+
const paginationValues = {
|
|
39
|
+
PAGINATION: PaginationTypes.PAGINATION,
|
|
40
|
+
'INFINITE-SCROLL': PaginationTypes.INFINITE_SCROLL,
|
|
41
|
+
NO: PaginationTypes.NO,
|
|
42
|
+
};
|
|
43
|
+
const searchValues = { ELASTICSEARCH, COUCHBASE, NO: NO_SEARCH };
|
|
36
44
|
const Values = {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
'INFINITE-SCROLL': PaginationTypes.INFINITE_SCROLL,
|
|
42
|
-
NO: PaginationTypes.NO,
|
|
43
|
-
},
|
|
44
|
-
[Options.SEARCH]: { ELASTICSEARCH, COUCHBASE, NO: NO_SEARCH },
|
|
45
|
+
dto: dtoValues,
|
|
46
|
+
service: serviceValues,
|
|
47
|
+
pagination: paginationValues,
|
|
48
|
+
search: searchValues,
|
|
45
49
|
};
|
|
46
50
|
const DefaultValues = {
|
|
47
51
|
[Options.DTO]: Values[Options.DTO].NO,
|
|
@@ -47,7 +47,7 @@ class JSONEntity {
|
|
|
47
47
|
const merged = merge(getDefaults(args.entityName), args);
|
|
48
48
|
this.name = merged.name;
|
|
49
49
|
this.fields = merged.fields;
|
|
50
|
-
this.annotations = merged.annotations;
|
|
50
|
+
this.annotations = merged.annotations ?? {};
|
|
51
51
|
this.relationships = merged.relationships;
|
|
52
52
|
this.documentation = merged.documentation;
|
|
53
53
|
this.entityTableName = merged.entityTableName;
|
|
@@ -50,8 +50,8 @@ export default class AbstractJDLOption {
|
|
|
50
50
|
if (!option) {
|
|
51
51
|
return false;
|
|
52
52
|
}
|
|
53
|
-
addAll(this.entityNames, option.entityNames);
|
|
54
|
-
addAll(this.excludedNames, option.excludedNames);
|
|
53
|
+
addAll(this.entityNames, Array.from(option.entityNames.values()));
|
|
54
|
+
addAll(this.excludedNames, Array.from(option.excludedNames.values()));
|
|
55
55
|
return true;
|
|
56
56
|
}
|
|
57
57
|
excludeEntityName(entityName) {
|