generator-jhipster 8.0.0-rc.1 → 8.0.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/README.md +10 -1
- package/dist/cli/environment-builder.mjs +3 -3
- package/dist/cli/jhipster-command.mjs +7 -3
- package/dist/cli/program.mjs +1 -1
- package/dist/generators/angular/generator.mjs +8 -7
- package/dist/generators/angular/resources/package.json +10 -9
- package/dist/generators/angular/templates/package.json.ejs +4 -8
- package/dist/generators/angular/templates/src/main/webapp/app/entities/_entityFolder_/list/_entityFile_.component.html.ejs +6 -10
- package/dist/generators/angular/templates/src/main/webapp/app/entities/_entityFolder_/service/_entityFile_.service.ts.ejs +1 -1
- package/dist/generators/angular/templates/src/main/webapp/app/layouts/navbar/navbar.component.scss.ejs +1 -1
- package/dist/generators/angular/templates/webpack/webpack.microfrontend.js.ejs +48 -126
- package/dist/generators/app/support/config.mjs +3 -3
- package/dist/generators/base/generator.mjs +0 -3
- package/dist/generators/base/support/config.mjs +6 -6
- package/dist/generators/base/support/jhipster7-context.mjs +3 -3
- package/dist/generators/base-application/generator.mjs +2 -2
- package/dist/generators/base-application/support/enum.mjs +1 -1
- package/dist/generators/base-application/support/prepare-entity.mjs +14 -10
- package/dist/generators/base-application/support/prepare-field.mjs +11 -7
- package/dist/generators/base-application/support/prepare-relationship.mjs +12 -14
- package/dist/generators/base-workspaces/internal/docker-prompts.mjs +13 -12
- package/dist/generators/bootstrap/generator.mjs +64 -43
- package/dist/generators/bootstrap/support/auto-crlf-transform.mjs +34 -21
- package/dist/generators/bootstrap/support/eslint-transform.mjs +2 -5
- package/dist/generators/bootstrap/support/java-unused-imports-transform.mjs +2 -2
- package/dist/generators/bootstrap/support/multi-step-transform/index.mjs +17 -28
- package/dist/generators/bootstrap/support/multi-step-transform/template-file-fs.mjs +12 -6
- package/dist/generators/bootstrap/support/multi-step-transform/template-file.mjs +1 -0
- package/dist/generators/bootstrap/support/prettier-support.mjs +2 -2
- package/dist/generators/bootstrap-application/generator.mjs +10 -3
- package/dist/generators/bootstrap-application-base/generator.mjs +9 -6
- package/dist/generators/bootstrap-application-server/generator.mjs +2 -2
- package/dist/generators/client/resources/package.json +3 -3
- package/dist/generators/client/templates/src/main/webapp/content/css/loading.css.ejs +1 -1
- package/dist/generators/client/templates/webpack/webpack.microfrontend.js.jhi.ejs +14 -1
- package/dist/generators/common/files.mjs +1 -1
- package/dist/generators/common/generator.mjs +29 -7
- package/dist/generators/common/resources/package.json +3 -3
- package/dist/generators/common/templates/.lintstagedrc.cjs.ejs +21 -0
- package/dist/generators/common/templates/.prettierrc.ejs +1 -1
- package/dist/generators/common/templates/README.md.jhi.ejs +2 -0
- package/dist/generators/cypress/templates/src/test/javascript/cypress/e2e/account/settings-page.cy.ts.ejs +3 -0
- package/dist/generators/entity/prompts.mjs +123 -306
- package/dist/generators/generator-constants.mjs +5 -5
- package/dist/generators/heroku/generator.mjs +318 -595
- package/dist/generators/heroku/templates/Procfile.ejs +1 -1
- package/dist/generators/heroku/templates/application-heroku.yml.ejs +0 -12
- package/dist/generators/info/generator.mjs +6 -4
- package/dist/generators/init/generator.mjs +2 -2
- package/dist/generators/java/entity-files.mjs +1 -1
- package/dist/generators/java/generator.mjs +12 -13
- package/dist/generators/java/support/package-info-transform.mjs +20 -6
- package/dist/generators/java/templates/src/main/java/_package_/_entityPackage_/domain/_persistClass_.java.jhi.ejs +24 -28
- package/dist/generators/java/templates/src/main/java/_package_/_entityPackage_/domain/enumeration/_enumName_.java.ejs +3 -3
- package/dist/generators/java/templates/src/test/java/_package_/_entityPackage_/domain/_persistClass_Test.java.ejs +86 -8
- package/dist/generators/java/templates/src/test/java/_package_/_entityPackage_/domain/_persistClass_TestSamples.java.ejs +85 -0
- package/dist/generators/jdl/generator.mjs +14 -5
- package/dist/generators/kubernetes/templates/ingress.yml.ejs +0 -1
- package/dist/generators/languages/command.mjs +5 -0
- package/dist/generators/languages/generator.mjs +20 -13
- package/dist/generators/languages/translation-data.mjs +8 -13
- package/dist/generators/liquibase/generator.mjs +7 -3
- package/dist/generators/project-name/generator.mjs +1 -1
- package/dist/generators/react/generator.mjs +18 -10
- package/dist/generators/react/resources/package.json +19 -18
- package/dist/generators/react/templates/package.json.ejs +4 -5
- package/dist/generators/react/templates/src/main/webapp/app/config/icon-loader.ts.ejs +35 -33
- package/dist/generators/react/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_-update.tsx.ejs +7 -2
- package/dist/generators/react/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_.reducer.ts.ejs +1 -1
- package/dist/generators/react/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_.tsx.ejs +1 -1
- package/dist/generators/react/templates/src/main/webapp/app/modules/home/home.tsx.ejs +1 -1
- package/dist/generators/react/templates/src/main/webapp/app/routes.tsx.ejs +9 -2
- package/dist/generators/react/templates/src/main/webapp/app/shared/layout/header/header-components.tsx.ejs +1 -1
- package/dist/generators/react/templates/src/main/webapp/app/shared/layout/header/header.scss.ejs +5 -4
- package/dist/generators/react/templates/src/main/webapp/app/shared/layout/menus/entities.tsx.ejs +10 -1
- package/dist/generators/react/templates/tsconfig.test.json.ejs +1 -1
- package/dist/generators/react/templates/webpack/webpack.microfrontend.js.jhi.react.ejs +13 -58
- package/dist/generators/server/generator.mjs +13 -4
- package/dist/generators/server/resources/Dockerfile +7 -7
- package/dist/generators/server/resources/gradle/libs.versions.toml +1 -1
- package/dist/generators/server/resources/pom.xml +11 -11
- package/dist/generators/server/support/config.mjs +4 -4
- package/dist/generators/server/support/prepare-entity.mjs +5 -5
- package/dist/generators/server/support/prepare-field.mjs +20 -0
- package/dist/generators/server/support/relationship.mjs +2 -1
- package/dist/generators/server/support/templates/field-values.mjs +5 -2
- package/dist/generators/server/templates/README.md.jhi.spring-boot.ejs +0 -1
- package/dist/generators/server/templates/package.json.ejs +0 -5
- package/dist/generators/server/templates/pom.xml.ejs +1 -8
- package/dist/generators/server/templates/src/main/java/_package_/_entityPackage_/_partials_entity_/get_all_template.ejs +3 -3
- package/dist/generators/server/templates/src/main/java/_package_/_entityPackage_/service/dto/_dtoClass_.java.ejs +2 -2
- package/dist/generators/server/templates/src/main/java/_package_/_entityPackage_/web/rest/_entityClass_Resource.java.ejs +11 -11
- package/dist/generators/server/templates/src/main/java/_package_/config/JacksonConfiguration.java.ejs +2 -1
- package/dist/generators/server/templates/src/main/java/_package_/config/SecurityConfiguration_imperative.java.ejs +1 -1
- package/dist/generators/server/templates/src/main/java/_package_/config/SecurityConfiguration_reactive.java.ejs +2 -0
- package/dist/generators/server/templates/src/main/java/_package_/service/MailService.java.ejs +10 -4
- package/dist/generators/server/templates/src/main/java/_package_/web/rest/PublicUserResource.java.ejs +3 -4
- package/dist/generators/server/templates/src/main/java/_package_/web/rest/UserResource.java.ejs +0 -2
- package/dist/generators/server/templates/src/main/java/_package_/web/rest/errors/ExceptionTranslator.java.ejs +4 -7
- package/dist/generators/server/templates/src/test/java/_package_/_entityPackage_/web/rest/_entityClass_ResourceIT.java.ejs +3 -3
- package/dist/generators/server/templates/src/test/java/_package_/web/rest/AccountResourceIT.java.ejs +4 -4
- package/dist/generators/spring-data-elasticsearch/templates/src/main/java/_package_/_entityPackage_/repository/search/_entityClass_SearchRepository.java.ejs +0 -2
- package/dist/generators/spring-data-neo4j/templates/src/main/java/_package_/_entityPackage_/domain/_persistClass_.java.jhi.spring_data_neo4j.ejs +3 -37
- package/dist/generators/vue/generator.mjs +25 -16
- package/dist/generators/vue/resources/package.json +17 -16
- package/dist/generators/vue/templates/package.json.ejs +3 -5
- package/dist/generators/vue/templates/src/main/webapp/app/core/jhi-navbar/jhi-navbar.component.ts.ejs +10 -3
- package/dist/generators/vue/templates/src/main/webapp/app/core/jhi-navbar/jhi-navbar.vue.ejs +3 -4
- package/dist/generators/vue/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_.service.ts.ejs +1 -1
- package/dist/generators/vue/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_.vue.ejs +12 -0
- package/dist/generators/vue/templates/src/main/webapp/app/router/index.ts.ejs +8 -1
- package/dist/generators/vue/templates/webpack/webpack.microfrontend.js.jhi.vue.ejs +19 -34
- package/dist/jdl/converters/jdl-to-json/jdl-to-json-option-converter.js +2 -2
- package/dist/jdl/converters/jdl-to-json/jdl-to-json-relationship-converter.js +1 -1
- package/dist/jdl/converters/jdl-to-json/jdl-without-application-to-json-converter.js +1 -1
- package/dist/jdl/converters/parsed-jdl-to-jdl-object/application-converter.js +1 -17
- package/dist/jdl/exporters/applications/jhipster-application-formatter.js +17 -1
- package/dist/jdl/exporters/config.js +11 -0
- package/dist/jdl/exporters/export-utils.js +2 -13
- package/dist/jdl/index.js +1 -0
- package/dist/jdl/jdl-importer.js +6 -2
- package/dist/jdl/models/jdl-application-configuration-factory.js +34 -2
- package/dist/jdl/models/jdl-application-configuration.js +6 -3
- package/dist/jdl/models/jdl-application-factory.js +2 -2
- package/dist/jdl/models/jdl-application.js +12 -3
- package/dist/jdl/parsing/jdl-ast-builder-visitor.js +63 -7
- package/dist/jdl/parsing/jdl-parser.js +52 -6
- package/dist/jdl/parsing/lexer/application-tokens.js +1 -1
- package/dist/jdl/validators/entity-validator.js +4 -2
- package/dist/jdl/validators/enum-validator.js +4 -2
- package/dist/jdl/validators/jdl-with-application-validator.js +18 -8
- package/dist/jdl/validators/jdl-without-application-validator.js +30 -29
- package/dist/jdl/validators/validator.js +1 -1
- package/dist/types/generators/base/support/config.d.mts +3 -3
- package/dist/types/generators/base-application/support/prepare-entity.d.mts +6 -1
- package/dist/types/generators/bootstrap/support/auto-crlf-transform.d.mts +3 -2
- package/dist/types/generators/bootstrap/support/multi-step-transform/index.d.mts +3 -20
- package/dist/types/generators/bootstrap/support/multi-step-transform/template-file-fs.d.mts +15 -9
- package/dist/types/generators/bootstrap/support/multi-step-transform/template-file.d.mts +1 -0
- package/dist/types/generators/generator-constants.d.mts +3 -3
- package/dist/types/generators/java/support/package-info-transform.d.mts +1 -4
- package/dist/types/generators/server/support/templates/field-values.d.mts +1 -1
- package/dist/types/jdl/exporters/config.d.ts +1 -0
- package/dist/types/jdl/index.d.ts +1 -0
- package/dist/types/jdl/jdl-importer.d.ts +1 -0
- package/dist/types/jdl/models/jdl-application-configuration-factory.d.ts +1 -0
- package/dist/types/jdl/models/jdl-application-configuration-option.d.ts +2 -2
- package/dist/types/jdl/models/jdl-application-configuration.d.ts +8 -6
- package/dist/types/jdl/models/jdl-application-factory.d.ts +1 -1
- package/dist/types/jdl/models/jdl-application.d.ts +8 -4
- package/dist/types/jdl/models/jdl-object.d.ts +1 -1
- package/dist/types/jdl/models/list-jdl-application-configuration-option.d.ts +1 -1
- package/dist/types/jdl/parsing/jdl-ast-builder-visitor.d.ts +10 -0
- package/dist/types/jdl/parsing/jdl-parser.d.ts +3 -0
- package/dist/types/jdl/parsing/lexer/application-tokens.d.ts +1 -0
- package/dist/types/jdl/validators/entity-validator.d.ts +2 -2
- package/dist/types/jdl/validators/enum-validator.d.ts +2 -2
- package/dist/types/jdl/validators/validator.d.ts +4 -1
- package/package.json +31 -31
|
@@ -182,11 +182,8 @@ function askForFieldsToRemove() {
|
|
|
182
182
|
}
|
|
183
183
|
});
|
|
184
184
|
}
|
|
185
|
-
function askForRelationships() {
|
|
185
|
+
function askForRelationships(...args) {
|
|
186
186
|
const context = this.entityData;
|
|
187
|
-
if (this.options.defaults) {
|
|
188
|
-
return undefined;
|
|
189
|
-
}
|
|
190
187
|
// don't prompt if data is imported from a file
|
|
191
188
|
if (context.useConfigurationFile && context.updateEntity !== 'add') {
|
|
192
189
|
return undefined;
|
|
@@ -194,7 +191,7 @@ function askForRelationships() {
|
|
|
194
191
|
if (context.databaseType === CASSANDRA) {
|
|
195
192
|
return undefined;
|
|
196
193
|
}
|
|
197
|
-
return askForRelationship.call(this);
|
|
194
|
+
return askForRelationship.call(this, ...args);
|
|
198
195
|
}
|
|
199
196
|
function askForRelationsToRemove() {
|
|
200
197
|
const context = this.entityData;
|
|
@@ -384,22 +381,26 @@ function askForPagination() {
|
|
|
384
381
|
/**
|
|
385
382
|
* ask question for a field creation
|
|
386
383
|
*/
|
|
387
|
-
function askForField() {
|
|
384
|
+
async function askForField() {
|
|
388
385
|
const context = this.entityData;
|
|
389
386
|
this.log.log(chalk.green(`\nGenerating field #${this.entityConfig.fields.length + 1}\n`));
|
|
390
|
-
const skipServer = context.skipServer;
|
|
391
387
|
const databaseType = context.databaseType;
|
|
392
388
|
const clientFramework = context.clientFramework;
|
|
393
389
|
const possibleFiltering = databaseType === SQL && !context.reactive;
|
|
394
|
-
const
|
|
390
|
+
const fieldAddAnswer = await this.prompt([
|
|
395
391
|
{
|
|
396
392
|
type: 'confirm',
|
|
397
393
|
name: 'fieldAdd',
|
|
398
394
|
message: 'Do you want to add a field to your entity?',
|
|
399
395
|
default: true,
|
|
400
396
|
},
|
|
397
|
+
]);
|
|
398
|
+
if (!fieldAddAnswer.fieldAdd) {
|
|
399
|
+
logFieldsAndRelationships.call(this);
|
|
400
|
+
return;
|
|
401
|
+
}
|
|
402
|
+
const answers = await this.prompt([
|
|
401
403
|
{
|
|
402
|
-
when: response => response.fieldAdd === true,
|
|
403
404
|
type: 'input',
|
|
404
405
|
name: 'fieldName',
|
|
405
406
|
validate: input => {
|
|
@@ -430,67 +431,25 @@ function askForField() {
|
|
|
430
431
|
message: 'What is the name of your field?',
|
|
431
432
|
},
|
|
432
433
|
{
|
|
433
|
-
when: response => response.fieldAdd === true && (skipServer || ['sql', 'mongodb', 'neo4j', 'couchbase'].includes(databaseType)),
|
|
434
434
|
type: 'list',
|
|
435
435
|
name: 'fieldType',
|
|
436
436
|
message: 'What is the type of your field?',
|
|
437
|
-
choices: [
|
|
438
|
-
{
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
},
|
|
442
|
-
{
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
},
|
|
446
|
-
{
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
},
|
|
450
|
-
{
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
},
|
|
454
|
-
{
|
|
455
|
-
value: DOUBLE,
|
|
456
|
-
name: 'Double',
|
|
457
|
-
},
|
|
458
|
-
{
|
|
459
|
-
value: BIG_DECIMAL,
|
|
460
|
-
name: 'BigDecimal',
|
|
461
|
-
},
|
|
462
|
-
{
|
|
463
|
-
value: LOCAL_DATE,
|
|
464
|
-
name: 'LocalDate',
|
|
465
|
-
},
|
|
466
|
-
{
|
|
467
|
-
value: INSTANT,
|
|
468
|
-
name: 'Instant',
|
|
469
|
-
},
|
|
470
|
-
{
|
|
471
|
-
value: ZONED_DATE_TIME,
|
|
472
|
-
name: 'ZonedDateTime',
|
|
473
|
-
},
|
|
474
|
-
{
|
|
475
|
-
value: DURATION,
|
|
476
|
-
name: 'Duration',
|
|
477
|
-
},
|
|
478
|
-
{
|
|
479
|
-
value: BOOLEAN,
|
|
480
|
-
name: 'Boolean',
|
|
481
|
-
},
|
|
482
|
-
{
|
|
483
|
-
value: ENUM,
|
|
484
|
-
name: 'Enumeration (Java enum type)',
|
|
485
|
-
},
|
|
486
|
-
{
|
|
487
|
-
value: UUID,
|
|
488
|
-
name: 'UUID',
|
|
489
|
-
},
|
|
490
|
-
{
|
|
491
|
-
value: BYTES,
|
|
492
|
-
name: '[BETA] Blob',
|
|
493
|
-
},
|
|
437
|
+
choices: () => [
|
|
438
|
+
{ value: STRING, name: 'String' },
|
|
439
|
+
{ value: INTEGER, name: 'Integer' },
|
|
440
|
+
{ value: LONG, name: 'Long' },
|
|
441
|
+
{ value: FLOAT, name: 'Float' },
|
|
442
|
+
{ value: DOUBLE, name: 'Double' },
|
|
443
|
+
{ value: BIG_DECIMAL, name: 'BigDecimal' },
|
|
444
|
+
{ value: LOCAL_DATE, name: 'LocalDate' },
|
|
445
|
+
{ value: INSTANT, name: 'Instant' },
|
|
446
|
+
{ value: ZONED_DATE_TIME, name: 'ZonedDateTime' },
|
|
447
|
+
{ value: DURATION, name: 'Duration' },
|
|
448
|
+
{ value: BOOLEAN, name: 'Boolean' },
|
|
449
|
+
{ value: ENUM, name: 'Enumeration (Java enum type)' },
|
|
450
|
+
{ value: UUID, name: 'UUID' },
|
|
451
|
+
{ value: UUID, name: 'UUID' },
|
|
452
|
+
...(databaseType === CASSANDRA ? [{ value: BYTE_BUFFER, name: '[BETA] Blob' }] : [{ value: BYTES, name: '[BETA] Blob' }]),
|
|
494
453
|
],
|
|
495
454
|
default: 0,
|
|
496
455
|
},
|
|
@@ -566,117 +525,26 @@ function askForField() {
|
|
|
566
525
|
},
|
|
567
526
|
},
|
|
568
527
|
{
|
|
569
|
-
when: response => response.
|
|
570
|
-
type: 'list',
|
|
571
|
-
name: 'fieldType',
|
|
572
|
-
message: 'What is the type of your field?',
|
|
573
|
-
choices: [
|
|
574
|
-
{
|
|
575
|
-
value: UUID,
|
|
576
|
-
name: 'UUID',
|
|
577
|
-
},
|
|
578
|
-
{
|
|
579
|
-
value: STRING,
|
|
580
|
-
name: 'String',
|
|
581
|
-
},
|
|
582
|
-
{
|
|
583
|
-
value: INTEGER,
|
|
584
|
-
name: 'Integer',
|
|
585
|
-
},
|
|
586
|
-
{
|
|
587
|
-
value: LONG,
|
|
588
|
-
name: 'Long',
|
|
589
|
-
},
|
|
590
|
-
{
|
|
591
|
-
value: FLOAT,
|
|
592
|
-
name: 'Float',
|
|
593
|
-
},
|
|
594
|
-
{
|
|
595
|
-
value: DOUBLE,
|
|
596
|
-
name: 'Double',
|
|
597
|
-
},
|
|
598
|
-
{
|
|
599
|
-
value: BIG_DECIMAL,
|
|
600
|
-
name: 'BigDecimal',
|
|
601
|
-
},
|
|
602
|
-
{
|
|
603
|
-
value: LOCAL_DATE,
|
|
604
|
-
name: 'LocalDate',
|
|
605
|
-
},
|
|
606
|
-
{
|
|
607
|
-
value: INSTANT,
|
|
608
|
-
name: 'Instant',
|
|
609
|
-
},
|
|
610
|
-
{
|
|
611
|
-
value: ZONED_DATE_TIME,
|
|
612
|
-
name: 'ZonedDateTime',
|
|
613
|
-
},
|
|
614
|
-
{
|
|
615
|
-
value: DURATION,
|
|
616
|
-
name: 'Duration',
|
|
617
|
-
},
|
|
618
|
-
{
|
|
619
|
-
value: ENUM,
|
|
620
|
-
name: 'Enumeration (Java enum type)',
|
|
621
|
-
},
|
|
622
|
-
{
|
|
623
|
-
value: BOOLEAN,
|
|
624
|
-
name: 'Boolean',
|
|
625
|
-
},
|
|
626
|
-
{
|
|
627
|
-
value: BYTE_BUFFER,
|
|
628
|
-
name: '[BETA] blob',
|
|
629
|
-
},
|
|
630
|
-
],
|
|
631
|
-
default: 0,
|
|
632
|
-
},
|
|
633
|
-
{
|
|
634
|
-
when: response => response.fieldAdd === true && response.fieldType === BYTES,
|
|
635
|
-
type: 'list',
|
|
636
|
-
name: 'fieldTypeBlobContent',
|
|
637
|
-
message: 'What is the content of the Blob field?',
|
|
638
|
-
choices: [
|
|
639
|
-
{
|
|
640
|
-
value: IMAGE,
|
|
641
|
-
name: 'An image',
|
|
642
|
-
},
|
|
643
|
-
{
|
|
644
|
-
value: ANY,
|
|
645
|
-
name: 'A binary file',
|
|
646
|
-
},
|
|
647
|
-
{
|
|
648
|
-
value: TEXT,
|
|
649
|
-
name: 'A CLOB (Text field)',
|
|
650
|
-
},
|
|
651
|
-
],
|
|
652
|
-
default: 0,
|
|
653
|
-
},
|
|
654
|
-
{
|
|
655
|
-
when: response => response.fieldAdd === true && response.fieldType === BYTE_BUFFER,
|
|
528
|
+
when: response => response.fieldType === BYTES || response.fieldType === BYTE_BUFFER,
|
|
656
529
|
type: 'list',
|
|
657
530
|
name: 'fieldTypeBlobContent',
|
|
658
531
|
message: 'What is the content of the Blob field?',
|
|
659
|
-
choices: [
|
|
660
|
-
{
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
},
|
|
664
|
-
{
|
|
665
|
-
value: ANY,
|
|
666
|
-
name: 'A binary file',
|
|
667
|
-
},
|
|
532
|
+
choices: answers => [
|
|
533
|
+
{ value: IMAGE, name: 'An image' },
|
|
534
|
+
{ value: ANY, name: 'A binary file' },
|
|
535
|
+
...(answers.fieldType === BYTES ? [{ value: TEXT, name: 'A CLOB (Text field)' }] : []),
|
|
668
536
|
],
|
|
669
537
|
default: 0,
|
|
670
538
|
},
|
|
671
539
|
{
|
|
672
|
-
when: response => response.
|
|
540
|
+
when: response => response.fieldType !== BYTE_BUFFER,
|
|
673
541
|
type: 'confirm',
|
|
674
542
|
name: 'fieldValidate',
|
|
675
543
|
message: 'Do you want to add validation rules to your field?',
|
|
676
544
|
default: false,
|
|
677
545
|
},
|
|
678
546
|
{
|
|
679
|
-
when: response => response.
|
|
547
|
+
when: response => response.fieldValidate === true,
|
|
680
548
|
type: 'checkbox',
|
|
681
549
|
name: 'fieldValidateRules',
|
|
682
550
|
message: 'Which validation rules do you want to add?',
|
|
@@ -719,7 +587,7 @@ function askForField() {
|
|
|
719
587
|
default: 0,
|
|
720
588
|
},
|
|
721
589
|
{
|
|
722
|
-
when: response => response.
|
|
590
|
+
when: response => response.fieldValidate === true && response.fieldValidateRules.includes('minlength'),
|
|
723
591
|
type: 'input',
|
|
724
592
|
name: 'fieldValidateRulesMinlength',
|
|
725
593
|
validate: input => (inputIsNumber(input) ? true : 'Minimum length must be a positive number'),
|
|
@@ -727,7 +595,7 @@ function askForField() {
|
|
|
727
595
|
default: 0,
|
|
728
596
|
},
|
|
729
597
|
{
|
|
730
|
-
when: response => response.
|
|
598
|
+
when: response => response.fieldValidate === true && response.fieldValidateRules.includes('maxlength'),
|
|
731
599
|
type: 'input',
|
|
732
600
|
name: 'fieldValidateRulesMaxlength',
|
|
733
601
|
validate: input => (inputIsNumber(input) ? true : 'Maximum length must be a positive number'),
|
|
@@ -735,7 +603,7 @@ function askForField() {
|
|
|
735
603
|
default: 20,
|
|
736
604
|
},
|
|
737
605
|
{
|
|
738
|
-
when: response => response.
|
|
606
|
+
when: response => response.fieldValidate === true && response.fieldValidateRules.includes('min'),
|
|
739
607
|
type: 'input',
|
|
740
608
|
name: 'fieldValidateRulesMin',
|
|
741
609
|
message: 'What is the minimum of your field?',
|
|
@@ -748,7 +616,7 @@ function askForField() {
|
|
|
748
616
|
default: 0,
|
|
749
617
|
},
|
|
750
618
|
{
|
|
751
|
-
when: response => response.
|
|
619
|
+
when: response => response.fieldValidate === true && response.fieldValidateRules.includes('max'),
|
|
752
620
|
type: 'input',
|
|
753
621
|
name: 'fieldValidateRulesMax',
|
|
754
622
|
message: 'What is the maximum of your field?',
|
|
@@ -761,8 +629,7 @@ function askForField() {
|
|
|
761
629
|
default: 100,
|
|
762
630
|
},
|
|
763
631
|
{
|
|
764
|
-
when: response => response.
|
|
765
|
-
response.fieldValidate === true &&
|
|
632
|
+
when: response => response.fieldValidate === true &&
|
|
766
633
|
response.fieldValidateRules.includes(MINBYTES) &&
|
|
767
634
|
response.fieldType === BYTES &&
|
|
768
635
|
response.fieldTypeBlobContent !== TEXT,
|
|
@@ -773,8 +640,7 @@ function askForField() {
|
|
|
773
640
|
default: 0,
|
|
774
641
|
},
|
|
775
642
|
{
|
|
776
|
-
when: response => response.
|
|
777
|
-
response.fieldValidate === true &&
|
|
643
|
+
when: response => response.fieldValidate === true &&
|
|
778
644
|
response.fieldValidateRules.includes(MAXBYTES) &&
|
|
779
645
|
response.fieldType === BYTES &&
|
|
780
646
|
response.fieldTypeBlobContent !== TEXT,
|
|
@@ -785,79 +651,64 @@ function askForField() {
|
|
|
785
651
|
default: 5000000,
|
|
786
652
|
},
|
|
787
653
|
{
|
|
788
|
-
when: response => response.
|
|
654
|
+
when: response => response.fieldValidate === true && response.fieldValidateRules.includes('pattern'),
|
|
789
655
|
type: 'input',
|
|
790
656
|
name: 'fieldValidateRulesPattern',
|
|
791
657
|
message: 'What is the regular expression pattern you want to apply on your field?',
|
|
792
658
|
default: '^[a-zA-Z0-9]*$',
|
|
793
659
|
},
|
|
794
|
-
];
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
}
|
|
817
|
-
logFieldsAndRelationships.call(this);
|
|
818
|
-
if (props.fieldAdd) {
|
|
819
|
-
return askForField.call(this);
|
|
820
|
-
}
|
|
821
|
-
return undefined;
|
|
822
|
-
});
|
|
660
|
+
]);
|
|
661
|
+
if (answers.fieldIsEnum) {
|
|
662
|
+
answers.fieldType = _.upperFirst(answers.fieldType);
|
|
663
|
+
answers.fieldValues = answers.fieldValues.toUpperCase();
|
|
664
|
+
}
|
|
665
|
+
const field = {
|
|
666
|
+
fieldName: answers.fieldName,
|
|
667
|
+
fieldType: answers.enumType || answers.fieldType,
|
|
668
|
+
fieldTypeBlobContent: answers.fieldTypeBlobContent,
|
|
669
|
+
fieldValues: answers.fieldValues,
|
|
670
|
+
fieldValidateRules: answers.fieldValidateRules,
|
|
671
|
+
fieldValidateRulesMinlength: answers.fieldValidateRulesMinlength,
|
|
672
|
+
fieldValidateRulesMaxlength: answers.fieldValidateRulesMaxlength,
|
|
673
|
+
fieldValidateRulesPattern: answers.fieldValidateRulesPattern,
|
|
674
|
+
fieldValidateRulesMin: answers.fieldValidateRulesMin,
|
|
675
|
+
fieldValidateRulesMax: answers.fieldValidateRulesMax,
|
|
676
|
+
fieldValidateRulesMinbytes: answers.fieldValidateRulesMinbytes,
|
|
677
|
+
fieldValidateRulesMaxbytes: answers.fieldValidateRulesMaxbytes,
|
|
678
|
+
};
|
|
679
|
+
this.entityConfig.fields = this.entityConfig.fields.concat(field);
|
|
680
|
+
logFieldsAndRelationships.call(this);
|
|
681
|
+
await askForField.call(this);
|
|
823
682
|
}
|
|
824
683
|
/**
|
|
825
684
|
* ask question for a relationship creation
|
|
826
685
|
*/
|
|
827
|
-
function askForRelationship() {
|
|
686
|
+
async function askForRelationship(...args) {
|
|
687
|
+
const [{ application }] = args;
|
|
828
688
|
const context = this.entityData;
|
|
829
689
|
const name = context.name;
|
|
830
690
|
this.log.log(chalk.green('\nGenerating relationships to other entities\n'));
|
|
831
|
-
const
|
|
691
|
+
const addRelationshipAnswers = await this.prompt([
|
|
832
692
|
{
|
|
833
693
|
type: 'confirm',
|
|
834
694
|
name: 'relationshipAdd',
|
|
835
695
|
message: 'Do you want to add a relationship to another entity?',
|
|
836
696
|
default: true,
|
|
837
697
|
},
|
|
698
|
+
]);
|
|
699
|
+
if (!addRelationshipAnswers.relationshipAdd) {
|
|
700
|
+
logFieldsAndRelationships.call(this);
|
|
701
|
+
this.log.log('\n');
|
|
702
|
+
return;
|
|
703
|
+
}
|
|
704
|
+
const answers = await this.prompt([
|
|
838
705
|
{
|
|
839
|
-
|
|
840
|
-
type: 'input',
|
|
706
|
+
type: 'list',
|
|
841
707
|
name: 'otherEntityName',
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
return 'Your other entity name cannot contain special characters';
|
|
845
|
-
}
|
|
846
|
-
if (input === '') {
|
|
847
|
-
return 'Your other entity name cannot be empty';
|
|
848
|
-
}
|
|
849
|
-
if (isReservedTableName(input, 'JAVA')) {
|
|
850
|
-
return 'Your other entity name cannot contain a Java reserved keyword';
|
|
851
|
-
}
|
|
852
|
-
if (input.toLowerCase() === 'user' && context.applicationType === 'microservice') {
|
|
853
|
-
return "Your entity cannot have a relationship with User because it's a gateway entity";
|
|
854
|
-
}
|
|
855
|
-
return true;
|
|
856
|
-
},
|
|
857
|
-
message: 'What is the name of the other entity?',
|
|
708
|
+
message: 'What is the other entity?',
|
|
709
|
+
choices: () => [...this.getExistingEntityNames(), ...(application.generateBuiltInUserEntity ? ['User'] : [])],
|
|
858
710
|
},
|
|
859
711
|
{
|
|
860
|
-
when: response => response.relationshipAdd === true,
|
|
861
712
|
type: 'input',
|
|
862
713
|
name: 'relationshipName',
|
|
863
714
|
validate: input => {
|
|
@@ -882,83 +733,59 @@ function askForRelationship() {
|
|
|
882
733
|
default: response => _.lowerFirst(response.otherEntityName),
|
|
883
734
|
},
|
|
884
735
|
{
|
|
885
|
-
when: response => response.relationshipAdd === true,
|
|
886
736
|
type: 'list',
|
|
887
737
|
name: 'relationshipType',
|
|
888
738
|
message: 'What is the type of the relationship?',
|
|
889
|
-
choices: response =>
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
{
|
|
896
|
-
value: 'many-to-many',
|
|
897
|
-
name: 'many-to-many',
|
|
898
|
-
},
|
|
899
|
-
{
|
|
900
|
-
value: 'one-to-one',
|
|
901
|
-
name: 'one-to-one',
|
|
902
|
-
},
|
|
903
|
-
];
|
|
904
|
-
if (!this.isBuiltInUser(response.otherEntityName)) {
|
|
905
|
-
opts.unshift({
|
|
906
|
-
value: 'one-to-many',
|
|
907
|
-
name: 'one-to-many',
|
|
908
|
-
});
|
|
909
|
-
}
|
|
910
|
-
return opts;
|
|
911
|
-
},
|
|
739
|
+
choices: response => [
|
|
740
|
+
'many-to-one',
|
|
741
|
+
'many-to-many',
|
|
742
|
+
'one-to-one',
|
|
743
|
+
...(this.isBuiltInUser(response.otherEntityName) ? [] : ['one-to-many']),
|
|
744
|
+
],
|
|
912
745
|
default: 0,
|
|
913
746
|
},
|
|
914
747
|
{
|
|
915
|
-
when: response =>
|
|
916
|
-
response.otherEntityName.toLowerCase() !== 'user' &&
|
|
917
|
-
(response.relationshipType === 'many-to-many' || response.relationshipType === 'one-to-one'),
|
|
918
|
-
type: 'confirm',
|
|
919
|
-
name: 'ownerSide',
|
|
920
|
-
message: 'Is this entity the owner of the relationship?',
|
|
921
|
-
default: false,
|
|
922
|
-
},
|
|
923
|
-
{
|
|
924
|
-
when: response => context.databaseType === SQL &&
|
|
925
|
-
response.relationshipAdd === true &&
|
|
926
|
-
response.relationshipType === 'one-to-one' &&
|
|
927
|
-
(response.ownerSide === true || response.otherEntityName.toLowerCase() === 'user'),
|
|
748
|
+
when: response => application.databaseType === SQL && response.relationshipType === 'one-to-one',
|
|
928
749
|
type: 'confirm',
|
|
929
750
|
name: 'id',
|
|
930
751
|
message: 'Do you want to use JPA Derived Identifier - @MapsId?',
|
|
931
752
|
default: false,
|
|
932
753
|
},
|
|
933
754
|
{
|
|
934
|
-
when:
|
|
935
|
-
(
|
|
936
|
-
|
|
937
|
-
|
|
755
|
+
when: answers => {
|
|
756
|
+
if (this.isBuiltInUser(answers.otherEntityName)) {
|
|
757
|
+
answers.bidirectional = false;
|
|
758
|
+
return false;
|
|
759
|
+
}
|
|
760
|
+
if (!application.databaseTypeNeo4j && answers.relationshipType !== 'many-to-one') {
|
|
761
|
+
// Relationships requires bidirectional.
|
|
762
|
+
answers.bidirectional = true;
|
|
763
|
+
return false;
|
|
764
|
+
}
|
|
765
|
+
return true;
|
|
766
|
+
},
|
|
767
|
+
type: 'input',
|
|
768
|
+
name: 'bidirectional',
|
|
769
|
+
message: 'Do you want to generate a bidirectional relationship',
|
|
770
|
+
default: true,
|
|
771
|
+
},
|
|
772
|
+
{
|
|
773
|
+
when: response => response.bidirectional,
|
|
938
774
|
type: 'input',
|
|
939
775
|
name: 'otherEntityRelationshipName',
|
|
940
776
|
message: 'What is the name of this relationship in the other entity?',
|
|
941
777
|
default: () => _.lowerFirst(name),
|
|
942
778
|
},
|
|
943
779
|
{
|
|
944
|
-
when: response => response.relationshipAdd === true &&
|
|
945
|
-
response.otherEntityName.toLowerCase() !== 'user' &&
|
|
946
|
-
(response.relationshipType === 'many-to-one' ||
|
|
947
|
-
(response.relationshipType === 'many-to-many' && response.ownerSide === true) ||
|
|
948
|
-
(response.relationshipType === 'one-to-one' && response.ownerSide === true)),
|
|
949
780
|
type: 'input',
|
|
950
781
|
name: 'otherEntityField',
|
|
951
782
|
message: response => `When you display this relationship on client-side, which field from '${response.otherEntityName}' do you want to use? This field will be displayed as a String, so it cannot be a Blob`,
|
|
952
|
-
default: 'id',
|
|
783
|
+
default: answers => (answers.otherEntityName === 'User' ? 'login' : 'id'),
|
|
953
784
|
},
|
|
954
785
|
{
|
|
955
|
-
when: response => response.
|
|
956
|
-
response.
|
|
957
|
-
|
|
958
|
-
(response.relationshipType === 'many-to-many' &&
|
|
959
|
-
(response.ownerSide === true || response.otherEntityName.toLowerCase() === 'user')) ||
|
|
960
|
-
(response.relationshipType === 'one-to-one' &&
|
|
961
|
-
(response.ownerSide === true || response.otherEntityName.toLowerCase() === 'user'))),
|
|
786
|
+
when: response => (response.otherEntityName.toLowerCase() !== context.name.toLowerCase() && response.relationshipType === 'many-to-one') ||
|
|
787
|
+
response.relationshipType === 'many-to-many' ||
|
|
788
|
+
response.relationshipType === 'one-to-one',
|
|
962
789
|
type: 'confirm',
|
|
963
790
|
name: 'relationshipValidate',
|
|
964
791
|
message: 'Do you want to add any validation rules to this relationship?',
|
|
@@ -977,33 +804,23 @@ function askForRelationship() {
|
|
|
977
804
|
],
|
|
978
805
|
default: 0,
|
|
979
806
|
},
|
|
980
|
-
];
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
}
|
|
998
|
-
this.entityConfig.relationships = this.entityConfig.relationships.concat(relationship);
|
|
999
|
-
}
|
|
1000
|
-
logFieldsAndRelationships.call(this);
|
|
1001
|
-
if (props.relationshipAdd) {
|
|
1002
|
-
return askForRelationship.call(this);
|
|
1003
|
-
}
|
|
1004
|
-
this.log.log('\n');
|
|
1005
|
-
return undefined;
|
|
1006
|
-
});
|
|
807
|
+
]);
|
|
808
|
+
const relationship = {
|
|
809
|
+
relationshipSide: 'left',
|
|
810
|
+
relationshipName: answers.relationshipName,
|
|
811
|
+
otherEntityName: _.lowerFirst(answers.otherEntityName),
|
|
812
|
+
relationshipType: answers.relationshipType,
|
|
813
|
+
relationshipValidateRules: answers.relationshipValidateRules,
|
|
814
|
+
otherEntityField: answers.otherEntityField,
|
|
815
|
+
ownerSide: answers.ownerSide,
|
|
816
|
+
id: answers.id,
|
|
817
|
+
otherEntityRelationshipName: answers.otherEntityRelationshipName,
|
|
818
|
+
};
|
|
819
|
+
if (this.isBuiltInUser(answers.otherEntityName)) {
|
|
820
|
+
relationship.otherEntityRelationshipName = _.lowerFirst(name);
|
|
821
|
+
}
|
|
822
|
+
this.entityConfig.relationships = this.entityConfig.relationships.concat(relationship);
|
|
823
|
+
await askForRelationship.call(this, ...args);
|
|
1007
824
|
}
|
|
1008
825
|
/**
|
|
1009
826
|
* Show the entity and it's fields and relationships in console
|
|
@@ -1060,7 +877,7 @@ function logFieldsAndRelationships() {
|
|
|
1060
877
|
if (relationship.relationshipValidateRules && relationship.relationshipValidateRules.includes(REQUIRED)) {
|
|
1061
878
|
validationDetails.push(REQUIRED);
|
|
1062
879
|
}
|
|
1063
|
-
this.log.
|
|
880
|
+
this.log.log(`${chalk.red(relationship.relationshipName)} ${chalk.white(`(${_.upperFirst(relationship.otherEntityName)})`)} ${chalk.cyan(relationship.relationshipType)} ${chalk.cyan(validationDetails.join(' '))}`);
|
|
1064
881
|
});
|
|
1065
882
|
this.log.log();
|
|
1066
883
|
}
|
|
@@ -18,25 +18,25 @@
|
|
|
18
18
|
*/
|
|
19
19
|
export const BLUEPRINT_API_VERSION = 'jhipster-8';
|
|
20
20
|
// jhipster-bom version
|
|
21
|
-
export const JHIPSTER_DEPENDENCIES_VERSION = '8.0.0
|
|
21
|
+
export const JHIPSTER_DEPENDENCIES_VERSION = '8.0.0';
|
|
22
22
|
// Version of Java
|
|
23
23
|
export const JAVA_VERSION = '17';
|
|
24
24
|
export const JAVA_COMPATIBLE_VERSIONS = ['17', '18', '19', '20', '21'];
|
|
25
25
|
// Force spring milestone repository. Spring Boot milestones are detected.
|
|
26
26
|
export const ADD_SPRING_MILESTONE_REPOSITORY = false;
|
|
27
27
|
// Version of Node, NPM
|
|
28
|
-
export const NODE_VERSION = '18.18.
|
|
28
|
+
export const NODE_VERSION = '18.18.2';
|
|
29
29
|
export const OPENAPI_GENERATOR_CLI_VERSION = '2.7.0';
|
|
30
30
|
export const javaDependencies = {
|
|
31
31
|
/**
|
|
32
32
|
* spring-boot version should match the one managed by https://mvnrepository.com/artifact/tech.jhipster/jhipster-dependencies/JHIPSTER_DEPENDENCIES_VERSION
|
|
33
33
|
*/
|
|
34
|
-
'spring-boot': '3.1.
|
|
34
|
+
'spring-boot': '3.1.5',
|
|
35
35
|
/*
|
|
36
36
|
* hibernate version should match the one managed by https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-dependencies/SPRING_BOOT_VERSION
|
|
37
37
|
* Required due to hibernate-jpamodelgen annotation processor.
|
|
38
38
|
*/
|
|
39
|
-
hibernate: '6.2.
|
|
39
|
+
hibernate: '6.2.13.Final',
|
|
40
40
|
/*
|
|
41
41
|
* cassandra driver version should match the one managed by https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-dependencies/SPRING_BOOT_VERSION
|
|
42
42
|
* Required due to java-driver-mapper-processor annotation processor.
|
|
@@ -98,4 +98,4 @@ export const SERVER_MAIN_SRC_DIR = `${MAIN_DIR}java/`;
|
|
|
98
98
|
export const SERVER_MAIN_RES_DIR = `${MAIN_DIR}resources/`;
|
|
99
99
|
export const SERVER_TEST_SRC_DIR = `${TEST_DIR}java/`;
|
|
100
100
|
export const SERVER_TEST_RES_DIR = `${TEST_DIR}resources/`;
|
|
101
|
-
export const PRETTIER_EXTENSIONS = 'md,json,yml,html,cjs,mjs,js,ts,tsx,css,scss,vue,
|
|
101
|
+
export const PRETTIER_EXTENSIONS = 'md,json,yml,html,cjs,mjs,js,ts,tsx,css,scss,vue,java';
|