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
package/README.md
CHANGED
|
@@ -12,7 +12,16 @@ Please read our [guidelines](/CONTRIBUTING.md#submitting-an-issue) before submit
|
|
|
12
12
|
|
|
13
13
|
## Contributing
|
|
14
14
|
|
|
15
|
-
We are
|
|
15
|
+
We are honored by any contributions you may have small or large. Please refer to our [contribution guidelines and instructions document](https://github.com/jhipster/generator-jhipster/blob/main/CONTRIBUTING.md) for any information about contributing to the project.
|
|
16
|
+
|
|
17
|
+
## Supported Java and Node versions
|
|
18
|
+
|
|
19
|
+
The following Java and Node combinations are tested and verified by GitHub Actions:
|
|
20
|
+
|
|
21
|
+
| Java | Node | Status |
|
|
22
|
+
| ---- | ---- | ------ |
|
|
23
|
+
| 21 | 20 | ✅ |
|
|
24
|
+
| 17 | 18 | ✅ |
|
|
16
25
|
|
|
17
26
|
## Sponsors
|
|
18
27
|
|
|
@@ -190,10 +190,10 @@ export default class EnvironmentBuilder {
|
|
|
190
190
|
* @return {EnvironmentBuilder} this for chaining.
|
|
191
191
|
*/
|
|
192
192
|
async _lookupBlueprints(options) {
|
|
193
|
-
const
|
|
194
|
-
if (
|
|
193
|
+
const missingBlueprints = Object.keys(this._blueprintsWithVersion).filter(blueprint => !this.env.isPackageRegistered(packageNameToNamespace(blueprint)));
|
|
194
|
+
if (missingBlueprints && missingBlueprints.length > 0) {
|
|
195
195
|
// Lookup for blueprints.
|
|
196
|
-
await this.env.lookup({ ...options, filterPaths: true, packagePatterns:
|
|
196
|
+
await this.env.lookup({ ...options, filterPaths: true, packagePatterns: missingBlueprints });
|
|
197
197
|
}
|
|
198
198
|
return this;
|
|
199
199
|
}
|
|
@@ -192,9 +192,13 @@ export default class JHipsterCommand extends Command {
|
|
|
192
192
|
else if (optionDefinition.type && optionDefinition.type !== Boolean) {
|
|
193
193
|
cmdString = optionDefinition.required !== false ? `${cmdString} <value>` : `${cmdString} [value]`;
|
|
194
194
|
}
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
195
|
+
// Passing default to `commander` (`.default(optionDefinition.default)`), will set at options passed to initial generator, so it's used in entire generation process.
|
|
196
|
+
// We want default value to be set on jhipster options parsing so ignore default at commander.
|
|
197
|
+
let defaultDescription = '';
|
|
198
|
+
if (optionDefinition.default !== undefined && (!Array.isArray(optionDefinition.default) || optionDefinition.default.length !== 0)) {
|
|
199
|
+
defaultDescription = ` (default: ${optionDefinition.default})`;
|
|
200
|
+
}
|
|
201
|
+
const option = new Option(cmdString, optionDefinition.description + defaultDescription + additionalDescription).hideHelp(optionDefinition.hide ?? false);
|
|
198
202
|
if (optionDefinition.env) {
|
|
199
203
|
option.env(optionDefinition.env);
|
|
200
204
|
}
|
package/dist/cli/program.mjs
CHANGED
|
@@ -199,7 +199,7 @@ export const buildCommands = async ({ program, commands = {}, envBuilder, env, l
|
|
|
199
199
|
const boostrapGen = ['bootstrap', generator];
|
|
200
200
|
const allDependencies = await buildAllDependencies(boostrapGen, {
|
|
201
201
|
env,
|
|
202
|
-
blueprintNamespaces:
|
|
202
|
+
blueprintNamespaces: envBuilder.getBlueprintsNamespaces(),
|
|
203
203
|
});
|
|
204
204
|
for (const [metaName, { meta: generatorMeta, blueprintNamespace }] of Object.entries(allDependencies)) {
|
|
205
205
|
if (blueprintNamespace) {
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
*/
|
|
19
19
|
import * as _ from 'lodash-es';
|
|
20
20
|
import chalk from 'chalk';
|
|
21
|
-
import {
|
|
21
|
+
import { isFileStateModified } from 'mem-fs-editor/state';
|
|
22
22
|
import BaseApplicationGenerator from '../base-application/index.mjs';
|
|
23
23
|
import { GENERATOR_ANGULAR, GENERATOR_CLIENT, GENERATOR_LANGUAGES } from '../generator-list.mjs';
|
|
24
24
|
import { defaultLanguage } from '../languages/support/index.mjs';
|
|
@@ -102,6 +102,13 @@ export default class AngularGenerator extends BaseApplicationGenerator {
|
|
|
102
102
|
const entities = this.sharedData.getEntities().map(({ entity }) => entity);
|
|
103
103
|
this.localEntities = entities.filter(entity => !entity.builtIn && !entity.skipClient);
|
|
104
104
|
},
|
|
105
|
+
queueTranslateTransform({ control, application }) {
|
|
106
|
+
this.queueTransformStream({
|
|
107
|
+
name: 'translating angular application',
|
|
108
|
+
filter: file => isFileStateModified(file) && file.path.startsWith(this.destinationPath()) && isTranslatedAngularFile(file),
|
|
109
|
+
refresh: false,
|
|
110
|
+
}, translateAngularFilesTransform(control.getWebappTranslation, application.enableTranslation));
|
|
111
|
+
},
|
|
105
112
|
});
|
|
106
113
|
}
|
|
107
114
|
get [BaseApplicationGenerator.DEFAULT]() {
|
|
@@ -111,12 +118,6 @@ export default class AngularGenerator extends BaseApplicationGenerator {
|
|
|
111
118
|
return this.asWritingTaskGroup({
|
|
112
119
|
cleanupOldFilesTask,
|
|
113
120
|
writeFiles,
|
|
114
|
-
queueTranslateTransform({ control, application }) {
|
|
115
|
-
this.queueTransformStream(translateAngularFilesTransform(control.getWebappTranslation, application.enableTranslation), {
|
|
116
|
-
name: 'translating webapp',
|
|
117
|
-
streamOptions: { filter: file => isFilePending(file) && isTranslatedAngularFile(file) },
|
|
118
|
-
});
|
|
119
|
-
},
|
|
120
121
|
});
|
|
121
122
|
}
|
|
122
123
|
get [BaseApplicationGenerator.WRITING]() {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"dependencies": {
|
|
3
|
-
"@angular/common": "16.2.
|
|
3
|
+
"@angular/common": "16.2.11",
|
|
4
4
|
"@fortawesome/angular-fontawesome": "0.13.0",
|
|
5
5
|
"@fortawesome/fontawesome-svg-core": "6.4.2",
|
|
6
6
|
"@fortawesome/free-solid-svg-icons": "6.4.2",
|
|
7
|
-
"@ng-bootstrap/ng-bootstrap": "15.1.
|
|
7
|
+
"@ng-bootstrap/ng-bootstrap": "15.1.2",
|
|
8
8
|
"@ngx-translate/core": "15.0.0",
|
|
9
9
|
"@ngx-translate/http-loader": "8.0.0",
|
|
10
10
|
"@popperjs/core": "2.11.8",
|
|
@@ -17,19 +17,20 @@
|
|
|
17
17
|
"zone.js": "0.13.3"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
|
+
"@angular-architects/module-federation": "16.0.4",
|
|
20
21
|
"@angular-architects/module-federation-runtime": "16.0.4",
|
|
21
22
|
"@angular-builders/custom-webpack": "16.0.1",
|
|
22
23
|
"@angular-builders/jest": "16.0.1",
|
|
23
24
|
"@angular-eslint/eslint-plugin": "16.2.0",
|
|
24
|
-
"@angular/cli": "16.2.
|
|
25
|
-
"@types/jest": "29.5.
|
|
26
|
-
"@types/node": "18.18.
|
|
27
|
-
"@typescript-eslint/eslint-plugin": "6.
|
|
25
|
+
"@angular/cli": "16.2.9",
|
|
26
|
+
"@types/jest": "29.5.7",
|
|
27
|
+
"@types/node": "18.18.8",
|
|
28
|
+
"@typescript-eslint/eslint-plugin": "6.9.1",
|
|
28
29
|
"browser-sync": "2.29.3",
|
|
29
30
|
"browser-sync-webpack-plugin": "2.3.0",
|
|
30
31
|
"buffer": "6.0.3",
|
|
31
32
|
"copy-webpack-plugin": "11.0.0",
|
|
32
|
-
"eslint": "8.
|
|
33
|
+
"eslint": "8.52.0",
|
|
33
34
|
"eslint-config-prettier": "9.0.0",
|
|
34
35
|
"eslint-webpack-plugin": "4.0.1",
|
|
35
36
|
"folder-hash": "4.0.4",
|
|
@@ -43,9 +44,9 @@
|
|
|
43
44
|
"rimraf": "5.0.5",
|
|
44
45
|
"ts-jest": "29.1.1",
|
|
45
46
|
"typescript": "5.1.6",
|
|
46
|
-
"webpack": "5.
|
|
47
|
+
"webpack": "5.89.0",
|
|
47
48
|
"webpack-bundle-analyzer": "4.9.1",
|
|
48
|
-
"webpack-merge": "5.
|
|
49
|
+
"webpack-merge": "5.10.0",
|
|
49
50
|
"webpack-notifier": "1.15.0"
|
|
50
51
|
}
|
|
51
52
|
}
|
|
@@ -57,16 +57,17 @@
|
|
|
57
57
|
<%_ if (communicationSpringWebsocket) { _%>
|
|
58
58
|
"sockjs-client": "1.6.1",
|
|
59
59
|
"@stomp/rx-stomp": "1.2.0",
|
|
60
|
-
<%_ } _%>
|
|
61
|
-
<%_ if (skipServer) { _%>
|
|
62
|
-
"sonar-scanner": "3.1.0",
|
|
63
60
|
<%_ } _%>
|
|
64
61
|
"tslib": "<%= nodeDependencies['tslib'] %>",
|
|
65
62
|
"zone.js": "<%= nodeDependencies['zone.js'] %>"
|
|
66
63
|
},
|
|
67
64
|
"devDependencies": {
|
|
65
|
+
<%_ if (skipServer) { _%>
|
|
66
|
+
"sonar-scanner": "3.1.0",
|
|
67
|
+
<%_ } _%>
|
|
68
68
|
<%_ if (microfrontend && applicationTypeGateway) { _%>
|
|
69
69
|
"@angular-architects/module-federation-runtime": "<%= nodeDependencies['@angular-architects/module-federation-runtime'] %>",
|
|
70
|
+
"@angular-architects/module-federation": "<%= nodeDependencies['@angular-architects/module-federation'] %>",
|
|
70
71
|
<%_ } _%>
|
|
71
72
|
<%_ if (communicationSpringWebsocket) { _%>
|
|
72
73
|
"@types/sockjs-client": "1.5.1",
|
|
@@ -77,9 +78,6 @@
|
|
|
77
78
|
<%_ if (enableTranslation) { _%>
|
|
78
79
|
"folder-hash": "<%= nodeDependencies['folder-hash'] %>",
|
|
79
80
|
"merge-jsons-webpack-plugin": "<%= nodeDependencies['merge-jsons-webpack-plugin'] %>",
|
|
80
|
-
<%_ } _%>
|
|
81
|
-
<%_ if (!skipServer) { _%>
|
|
82
|
-
"prettier-plugin-java": "<%= nodeDependencies['prettier-plugin-java'] %>",
|
|
83
81
|
<%_ } _%>
|
|
84
82
|
"@angular/cli": "<%= nodeDependencies['@angular/cli'] %>",
|
|
85
83
|
"@angular/compiler-cli": "<%= nodeDependencies['@angular/common'] %>",
|
|
@@ -105,8 +103,6 @@
|
|
|
105
103
|
"jest-date-mock": "<%= nodeDependencies['jest-date-mock'] %>",
|
|
106
104
|
"jest-junit": "<%= nodeDependencies['jest-junit'] %>",
|
|
107
105
|
"jest-sonar": "<%= nodeDependencies['jest-sonar'] %>",
|
|
108
|
-
"prettier": "<%= nodeDependencies['prettier'] %>",
|
|
109
|
-
"prettier-plugin-packagejson": "<%= nodeDependencies['prettier-plugin-packagejson'] %>",
|
|
110
106
|
<%_ if (enableI18nRTL) { _%>
|
|
111
107
|
"postcss-rtlcss": "<%= nodeDependencies['postcss-rtlcss'] %>",
|
|
112
108
|
<%_ } _%>
|
|
@@ -179,22 +179,18 @@ _%>
|
|
|
179
179
|
</button>
|
|
180
180
|
<%_ } _%>
|
|
181
181
|
<%_ } _%>
|
|
182
|
-
<
|
|
183
|
-
|
|
184
|
-
class="btn btn-info btn-sm"
|
|
185
|
-
data-cy="entityDetailsButton">
|
|
182
|
+
<a [routerLink]="['/<%= entityPage %>', <%= entityInstance %>.<%= primaryKey.name %>, 'view']"
|
|
183
|
+
class="btn btn-info btn-sm" data-cy="entityDetailsButton">
|
|
186
184
|
<fa-icon icon="eye"></fa-icon>
|
|
187
185
|
<span class="d-none d-md-inline" <%= jhiPrefix %>Translate="entity.action.view">__jhiTransformTranslate__('entity.action.view')</span>
|
|
188
|
-
</
|
|
186
|
+
</a>
|
|
189
187
|
<%_ if (!readOnly) { _%>
|
|
190
188
|
|
|
191
|
-
<
|
|
192
|
-
|
|
193
|
-
class="btn btn-primary btn-sm"
|
|
194
|
-
data-cy="entityEditButton">
|
|
189
|
+
<a [routerLink]="['/<%= entityPage %>', <%= entityInstance %>.<%= primaryKey.name %>, 'edit']"
|
|
190
|
+
class="btn btn-primary btn-sm" data-cy="entityEditButton">
|
|
195
191
|
<fa-icon icon="pencil-alt"></fa-icon>
|
|
196
192
|
<span class="d-none d-md-inline" <%= jhiPrefix %>Translate="entity.action.edit">__jhiTransformTranslate__('entity.action.edit')</span>
|
|
197
|
-
</
|
|
193
|
+
</a>
|
|
198
194
|
|
|
199
195
|
<button type="submit" (click)="delete(<%= entityInstance %>)"
|
|
200
196
|
class="btn btn-danger btn-sm"
|
|
@@ -77,7 +77,7 @@ export type EntityArrayResponseType = HttpResponse<I<%= entityAngularName %>[]>;
|
|
|
77
77
|
export class <%= entityAngularName %>Service {
|
|
78
78
|
protected resourceUrl = this.applicationConfigService.getEndpointFor('api/<%= entityApiUrl %>'<% if ((applicationTypeGateway || applicationTypeMicroservice) && locals.microserviceName) { %>, '<%= microserviceName.toLowerCase() %>'<% } %>);
|
|
79
79
|
<%_ if (searchEngineAny) { _%>
|
|
80
|
-
protected resourceSearchUrl = this.applicationConfigService.getEndpointFor('api
|
|
80
|
+
protected resourceSearchUrl = this.applicationConfigService.getEndpointFor('api/<%= entityApiUrl %>/_search'<% if ((applicationTypeGateway || applicationTypeMicroservice) && locals.microserviceName) { %>, '<%= microserviceName.toLowerCase() %>'<% } %>);
|
|
81
81
|
<%_ } _%>
|
|
82
82
|
|
|
83
83
|
constructor(protected http: HttpClient, protected applicationConfigService: ApplicationConfigService) {}
|
|
@@ -67,6 +67,6 @@ Logo styles
|
|
|
67
67
|
width: 45px;
|
|
68
68
|
display: inline-block;
|
|
69
69
|
vertical-align: middle;
|
|
70
|
-
background: url('
|
|
70
|
+
background: url('/content/images/logo-jhipster.png') no-repeat center center;
|
|
71
71
|
background-size: contain;
|
|
72
72
|
}
|
|
@@ -16,138 +16,60 @@
|
|
|
16
16
|
See the License for the specific language governing permissions and
|
|
17
17
|
limitations under the License.
|
|
18
18
|
-%>
|
|
19
|
-
const
|
|
19
|
+
const { withModuleFederationPlugin } = require('@angular-architects/module-federation/webpack');
|
|
20
20
|
const packageJson = require('../package.json');
|
|
21
|
-
|
|
21
|
+
// Microfrontend api, should match across gateway and microservices.
|
|
22
|
+
const apiVersion = '0.0.1';
|
|
23
|
+
|
|
24
|
+
const sharedDefaults = { singleton: true, strictVersion: true, requiredVersion: apiVersion };
|
|
25
|
+
const shareAllDefaults = { ...sharedDefaults, requiredVersion: 'auto' }
|
|
26
|
+
const shareMappings = (...mappings) => Object.fromEntries(mappings.map(map => [map, { ...sharedDefaults, version: apiVersion }]));
|
|
27
|
+
|
|
28
|
+
const shareDependencies = ({ skipList = [] } = {}) =>
|
|
29
|
+
Object.fromEntries(
|
|
30
|
+
Object.entries(packageJson.dependencies)
|
|
31
|
+
.filter(([dependency]) => !skipList.includes(dependency))
|
|
32
|
+
.map(([dependency, version]) => [dependency, { ...sharedDefaults, version, requiredVersion: version }]),
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
let sharedDependencies = shareDependencies({ skipList: ['@angular/localize'] });
|
|
36
|
+
sharedDependencies = {
|
|
37
|
+
...sharedDependencies,
|
|
38
|
+
'@angular/common/http': sharedDependencies['@angular/common'],
|
|
39
|
+
'rxjs/operators': sharedDependencies.rxjs,
|
|
40
|
+
};
|
|
22
41
|
|
|
23
42
|
module.exports = (config, options, targetOptions) => {
|
|
24
|
-
return {
|
|
25
|
-
|
|
26
|
-
outputModule: true,
|
|
27
|
-
},
|
|
28
|
-
plugins: [
|
|
29
|
-
new ModuleFederationPlugin({
|
|
30
|
-
library: {
|
|
31
|
-
type: 'module',
|
|
32
|
-
},
|
|
43
|
+
return withModuleFederationPlugin({
|
|
44
|
+
name: '<%= lowercaseBaseName %>',
|
|
33
45
|
<%_ if (applicationTypeMicroservice) { _%>
|
|
34
|
-
|
|
35
|
-
filename: 'remoteEntry.js',
|
|
36
|
-
exposes: {
|
|
46
|
+
exposes: {
|
|
37
47
|
<%_ if (enableTranslation) { _%>
|
|
38
|
-
|
|
48
|
+
'./translation-module': 'app/shared/language/translation.module.ts',
|
|
39
49
|
<%_ } _%>
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
},
|
|
43
|
-
<%_ } _%>
|
|
44
|
-
<%_ if (applicationTypeGateway) { _%>
|
|
45
|
-
remotes: {},
|
|
46
|
-
<%_ } _%>
|
|
47
|
-
shared: {
|
|
48
|
-
// { eager?, import?, packageName?, requiredVersion?, shareKey?, shareScope?, singleton?, strictVersion?, version? }
|
|
49
|
-
'@angular/core': { singleton: true, strictVersion: true, requiredVersion: '<%= nodeDependencies['@angular/common'] %>' },
|
|
50
|
-
'@angular/common': { singleton: true, strictVersion: true, requiredVersion: '<%= nodeDependencies['@angular/common'] %>' },
|
|
51
|
-
'@angular/common/http': { singleton: true, strictVersion: true, requiredVersion: '<%= nodeDependencies['@angular/common'] %>' },
|
|
52
|
-
'@angular/router': { singleton: true, strictVersion: true, requiredVersion: '<%= nodeDependencies['@angular/common'] %>' },
|
|
53
|
-
'@angular/forms': { singleton: true, strictVersion: true, requiredVersion: '<%= nodeDependencies['@angular/common'] %>' },
|
|
54
|
-
'@angular/platform-browser': { singleton: true, strictVersion: true, requiredVersion: '<%= nodeDependencies['@angular/common'] %>' },
|
|
55
|
-
'@fortawesome/angular-fontawesome': { singleton: true, strictVersion: true, requiredVersion: '<%= nodeDependencies['@fortawesome/angular-fontawesome'] %>' },
|
|
56
|
-
'@fortawesome/fontawesome-common-types': { singleton: true, strictVersion: true },
|
|
57
|
-
'@fortawesome/fontawesome-svg-core': { singleton: true, strictVersion: true, requiredVersion: '<%= nodeDependencies['@fortawesome/fontawesome-svg-core'] %>' },
|
|
58
|
-
'@fortawesome/free-solid-svg-icons': { singleton: true },
|
|
59
|
-
'@ng-bootstrap/ng-bootstrap': { singleton: true, strictVersion: true, requiredVersion: '<%= nodeDependencies['@ng-bootstrap/ng-bootstrap'] %>' },
|
|
60
|
-
'@ngx-translate/core': { singleton: true, strictVersion: true, requiredVersion: '<%= nodeDependencies['@ngx-translate/core'] %>' },
|
|
61
|
-
'@ngx-translate/http-loader': { singleton: true, strictVersion: true, requiredVersion: '<%= nodeDependencies['@ngx-translate/http-loader'] %>' },
|
|
62
|
-
dayjs: { singleton: true, strictVersion: true, requiredVersion: '<%= nodeDependencies['dayjs'] %>' },
|
|
63
|
-
'ngx-infinite-scroll': { singleton: true, strictVersion: true, requiredVersion: '<%= nodeDependencies['ngx-infinite-scroll'] %>' },
|
|
64
|
-
rxjs: { singleton: true, strictVersion: true, requiredVersion: '<%= nodeDependencies['rxjs'] %>' },
|
|
65
|
-
'rxjs/operators': { singleton: true, strictVersion: true, requiredVersion: '<%= nodeDependencies['rxjs'] %>' },
|
|
66
|
-
'zone.js': { singleton: true, strictVersion: true, requiredVersion: '<%= nodeDependencies['zone.js'] %>' },
|
|
67
|
-
'app/config/input.constants': {
|
|
68
|
-
singleton: true,
|
|
69
|
-
import: 'app/config/input.constants',
|
|
70
|
-
requiredVersion: appVersion,
|
|
71
|
-
},
|
|
72
|
-
'app/config/pagination.constants': {
|
|
73
|
-
singleton: true,
|
|
74
|
-
import: 'app/config/pagination.constants',
|
|
75
|
-
requiredVersion: appVersion,
|
|
76
|
-
},
|
|
77
|
-
'app/config/translation.config': {
|
|
78
|
-
singleton: true,
|
|
79
|
-
import: 'app/config/translation.config',
|
|
80
|
-
requiredVersion: appVersion,
|
|
81
|
-
},
|
|
82
|
-
'app/core/auth': {
|
|
83
|
-
singleton: true,
|
|
84
|
-
import: 'app/core/auth',
|
|
85
|
-
requiredVersion: appVersion,
|
|
86
|
-
},
|
|
87
|
-
'app/core/config': {
|
|
88
|
-
singleton: true,
|
|
89
|
-
import: 'app/core/config',
|
|
90
|
-
requiredVersion: appVersion,
|
|
91
|
-
},
|
|
92
|
-
'app/core/interceptor': {
|
|
93
|
-
singleton: true,
|
|
94
|
-
import: 'app/core/interceptor',
|
|
95
|
-
requiredVersion: appVersion,
|
|
96
|
-
},
|
|
97
|
-
'app/core/request': {
|
|
98
|
-
singleton: true,
|
|
99
|
-
import: 'app/core/request',
|
|
100
|
-
requiredVersion: appVersion,
|
|
101
|
-
},
|
|
102
|
-
'app/core/util': {
|
|
103
|
-
singleton: true,
|
|
104
|
-
import: 'app/core/util',
|
|
105
|
-
requiredVersion: appVersion,
|
|
106
|
-
},
|
|
107
|
-
'app/shared': {
|
|
108
|
-
singleton: true,
|
|
109
|
-
import: 'app/shared',
|
|
110
|
-
requiredVersion: appVersion,
|
|
111
|
-
},
|
|
112
|
-
'app/shared/alert': {
|
|
113
|
-
singleton: true,
|
|
114
|
-
import: 'app/shared/alert',
|
|
115
|
-
requiredVersion: appVersion,
|
|
116
|
-
},
|
|
117
|
-
'app/shared/auth': {
|
|
118
|
-
singleton: true,
|
|
119
|
-
import: 'app/shared/auth',
|
|
120
|
-
requiredVersion: appVersion,
|
|
121
|
-
},
|
|
122
|
-
'app/shared/date': {
|
|
123
|
-
singleton: true,
|
|
124
|
-
import: 'app/shared/date',
|
|
125
|
-
requiredVersion: appVersion,
|
|
126
|
-
},
|
|
127
|
-
'app/shared/language': {
|
|
128
|
-
singleton: true,
|
|
129
|
-
import: 'app/shared/language',
|
|
130
|
-
requiredVersion: appVersion,
|
|
131
|
-
},
|
|
132
|
-
'app/shared/pagination': {
|
|
133
|
-
singleton: true,
|
|
134
|
-
import: 'app/shared/pagination',
|
|
135
|
-
requiredVersion: appVersion,
|
|
136
|
-
},
|
|
137
|
-
'app/shared/sort': {
|
|
138
|
-
singleton: true,
|
|
139
|
-
import: 'app/shared/sort',
|
|
140
|
-
requiredVersion: appVersion,
|
|
141
|
-
},
|
|
142
|
-
},
|
|
143
|
-
}),
|
|
144
|
-
],
|
|
145
|
-
output: {
|
|
146
|
-
publicPath: 'auto',
|
|
147
|
-
uniqueName: '<%= lowercaseBaseName %>',
|
|
50
|
+
'./entity-navbar-items': 'app/entities/entity-navbar-items.ts',
|
|
51
|
+
'./entity-routing': 'app/entities/entity-routing.module.ts',
|
|
148
52
|
},
|
|
149
|
-
|
|
150
|
-
|
|
53
|
+
<%_ } _%>
|
|
54
|
+
shared: {
|
|
55
|
+
...sharedDependencies,
|
|
56
|
+
...shareMappings(
|
|
57
|
+
'app/config/input.constants',
|
|
58
|
+
'app/config/pagination.constants',
|
|
59
|
+
'app/config/translation.config',
|
|
60
|
+
'app/core/auth',
|
|
61
|
+
'app/core/config',
|
|
62
|
+
'app/core/interceptor',
|
|
63
|
+
'app/core/request',
|
|
64
|
+
'app/core/util',
|
|
65
|
+
'app/shared',
|
|
66
|
+
'app/shared/alert',
|
|
67
|
+
'app/shared/auth',
|
|
68
|
+
'app/shared/date',
|
|
69
|
+
'app/shared/language',
|
|
70
|
+
'app/shared/pagination',
|
|
71
|
+
'app/shared/sort',
|
|
72
|
+
),
|
|
151
73
|
},
|
|
152
|
-
};
|
|
74
|
+
});
|
|
153
75
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { camelCase, kebabCase, startCase, upperFirst } from 'lodash-es';
|
|
2
2
|
import { NODE_VERSION } from '../../generator-constants.mjs';
|
|
3
3
|
import { applicationTypes, authenticationTypes, databaseTypes, testFrameworkTypes } from '../../../jdl/index.js';
|
|
4
|
-
import { getHipster,
|
|
4
|
+
import { getHipster, mutateData, pickFields, upperFirstCamelCase } from '../../base/support/index.mjs';
|
|
5
5
|
import { getDBTypeFromDBValue } from '../../server/support/index.mjs';
|
|
6
6
|
import detectLanguage from '../../languages/support/detect-language.mjs';
|
|
7
7
|
import { loadConfig, loadDerivedConfig } from '../../../lib/internal/index.mjs';
|
|
@@ -72,7 +72,7 @@ export function loadStoredAppOptions({ options = this.options, jhipsterConfig =
|
|
|
72
72
|
*/
|
|
73
73
|
export const loadAppConfig = ({ config, application, useVersionPlaceholders, }) => {
|
|
74
74
|
loadConfig(serverCommand.configs, { config, application });
|
|
75
|
-
|
|
75
|
+
mutateData(application, {
|
|
76
76
|
nodeVersion: useVersionPlaceholders ? 'NODE_VERSION' : NODE_VERSION,
|
|
77
77
|
jhipsterVersion: useVersionPlaceholders ? 'JHIPSTER_VERSION' : undefined,
|
|
78
78
|
}, pickFields(config, [
|
|
@@ -116,7 +116,7 @@ export const loadAppConfig = ({ config, application, useVersionPlaceholders, })
|
|
|
116
116
|
*/
|
|
117
117
|
export const loadDerivedAppConfig = ({ application }) => {
|
|
118
118
|
loadDerivedConfig(serverCommand.configs, { application });
|
|
119
|
-
|
|
119
|
+
mutateData(application, {
|
|
120
120
|
jhiPrefixCapitalized: ({ jhiPrefix }) => upperFirst(jhiPrefix),
|
|
121
121
|
jhiPrefixDashed: ({ jhiPrefix }) => kebabCase(jhiPrefix),
|
|
122
122
|
camelizedBaseName: ({ baseName }) => camelCase(baseName),
|
|
@@ -462,9 +462,6 @@ export default class JHipsterBaseBlueprintGenerator extends CoreGenerator {
|
|
|
462
462
|
}
|
|
463
463
|
const generatorName = packageNameToNamespace(blueprint);
|
|
464
464
|
const generatorNamespace = `${generatorName}:${subGen}`;
|
|
465
|
-
if (!this.env.isPackageRegistered(generatorName)) {
|
|
466
|
-
await this.env.lookup({ filterPaths: true, packagePatterns: blueprint });
|
|
467
|
-
}
|
|
468
465
|
if (!(await this.env.get(generatorNamespace))) {
|
|
469
466
|
this.log.debug(`No blueprint found for blueprint ${chalk.yellow(blueprint)} and ${chalk.yellow(subGen)} with namespace ${chalk.yellow(generatorNamespace)} subgenerator: falling back to default generator`);
|
|
470
467
|
return undefined;
|
|
@@ -65,20 +65,20 @@ export const pickFields = (source, fields) => Object.fromEntries(fields.map(fiel
|
|
|
65
65
|
*
|
|
66
66
|
* @example
|
|
67
67
|
* // application = { prop: 'foo-bar', prop2: 'foo2' }
|
|
68
|
-
*
|
|
69
|
-
*
|
|
68
|
+
* mutateData(
|
|
69
|
+
* data,
|
|
70
70
|
* { prop: 'foo', prop2: ({ prop }) => prop + 2 },
|
|
71
71
|
* { prop: ({ prop }) => prop + '-bar', prop2: 'won\'t override' },
|
|
72
72
|
* );
|
|
73
73
|
*/
|
|
74
|
-
export const
|
|
74
|
+
export const mutateData = (context, ...mutations) => {
|
|
75
75
|
for (const mutation of mutations) {
|
|
76
76
|
for (const [key, value] of Object.entries(mutation)) {
|
|
77
77
|
if (typeof value === 'function') {
|
|
78
|
-
|
|
78
|
+
context[key] = value(context);
|
|
79
79
|
}
|
|
80
|
-
else if (
|
|
81
|
-
|
|
80
|
+
else if (context[key] === undefined) {
|
|
81
|
+
context[key] = value;
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
}
|
|
@@ -159,9 +159,9 @@ const deprecatedProperties = {
|
|
|
159
159
|
},
|
|
160
160
|
};
|
|
161
161
|
const ejsBuiltInProperties = ['__append', '__line', 'escapeFn', 'include', 'undefined'];
|
|
162
|
-
const javascriptBuiltInProperties = ['parseInt', 'Boolean', 'JSON', 'Object'];
|
|
162
|
+
const javascriptBuiltInProperties = ['parseInt', 'Boolean', 'JSON', 'Object', 'toString'];
|
|
163
163
|
const getProperty = (context, prop) => {
|
|
164
|
-
if (prop ===
|
|
164
|
+
if (typeof prop === 'symbol') {
|
|
165
165
|
return undefined;
|
|
166
166
|
}
|
|
167
167
|
if (prop in deprecatedProperties) {
|
|
@@ -170,7 +170,7 @@ const getProperty = (context, prop) => {
|
|
|
170
170
|
console.log(`Template data ${chalk.yellow(String(prop))} was removed and should be replaced with ${chalk.yellow(replacement)}. Value: ${value}`);
|
|
171
171
|
return value;
|
|
172
172
|
}
|
|
173
|
-
if (prop
|
|
173
|
+
if (prop?.startsWith?.('DOCKER_')) {
|
|
174
174
|
console.log(`Template data ${chalk.yellow(String(prop))} was removed and should be replaced with ${chalk.yellow(
|
|
175
175
|
// eslint-disable-next-line no-template-curly-in-string
|
|
176
176
|
'dockerContainers.${dockerImage}')}.`);
|
|
@@ -22,7 +22,7 @@ import { CUSTOM_PRIORITIES, PRIORITY_NAMES, QUEUES } from './priorities.mjs';
|
|
|
22
22
|
import { JHIPSTER_CONFIG_DIR } from '../generator-constants.mjs';
|
|
23
23
|
import { getEntitiesFromDir } from './support/index.mjs';
|
|
24
24
|
import command from './command.mjs';
|
|
25
|
-
import {
|
|
25
|
+
import { mutateData } from '../base/support/config.mjs';
|
|
26
26
|
const { LOADING, PREPARING, POST_PREPARING, CONFIGURING_EACH_ENTITY, LOADING_ENTITIES, PREPARING_EACH_ENTITY, PREPARING_EACH_ENTITY_FIELD, PREPARING_EACH_ENTITY_RELATIONSHIP, POST_PREPARING_EACH_ENTITY, DEFAULT, WRITING, POST_WRITING, WRITING_ENTITIES, POST_WRITING_ENTITIES, PRE_CONFLICTS, INSTALL, END, } = PRIORITY_NAMES;
|
|
27
27
|
const { CONFIGURING_EACH_ENTITY_QUEUE, LOADING_ENTITIES_QUEUE, PREPARING_EACH_ENTITY_QUEUE, PREPARING_EACH_ENTITY_FIELD_QUEUE, PREPARING_EACH_ENTITY_RELATIONSHIP_QUEUE, POST_PREPARING_EACH_ENTITY_QUEUE, WRITING_ENTITIES_QUEUE, POST_WRITING_ENTITIES_QUEUE, } = QUEUES;
|
|
28
28
|
const asPriority = BaseGenerator.asPriority;
|
|
@@ -259,7 +259,7 @@ export default class BaseApplicationGenerator extends BaseGenerator {
|
|
|
259
259
|
if ([PREPARING, LOADING].includes(priorityName)) {
|
|
260
260
|
return {
|
|
261
261
|
application,
|
|
262
|
-
applicationDefaults: data =>
|
|
262
|
+
applicationDefaults: data => mutateData(application, data),
|
|
263
263
|
};
|
|
264
264
|
}
|
|
265
265
|
if (LOADING_ENTITIES === priorityName) {
|
|
@@ -85,7 +85,7 @@ export const getEnumInfo = (field, clientRootFolder) => {
|
|
|
85
85
|
const customValuesState = getCustomValuesState(enums);
|
|
86
86
|
return {
|
|
87
87
|
enumName: field.fieldType,
|
|
88
|
-
|
|
88
|
+
enumJavadoc: field.fieldTypeDocumentation && formatDocAsJavaDoc(field.fieldTypeDocumentation),
|
|
89
89
|
enumInstance: field.enumInstance,
|
|
90
90
|
enums,
|
|
91
91
|
...customValuesState,
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
import * as _ from 'lodash-es';
|
|
20
20
|
import pluralize from 'pluralize';
|
|
21
21
|
import { getDatabaseTypeData, hibernateSnakeCase } from '../../server/support/index.mjs';
|
|
22
|
-
import { createFaker, parseChangelog, stringHashCode, upperFirstCamelCase, getMicroserviceAppName } from '../../base/support/index.mjs';
|
|
22
|
+
import { createFaker, parseChangelog, stringHashCode, upperFirstCamelCase, getMicroserviceAppName, mutateData, } from '../../base/support/index.mjs';
|
|
23
23
|
import { fieldToReference } from './prepare-field.mjs';
|
|
24
24
|
import { getTypescriptKeyType, getEntityParentPathAddition } from '../../client/support/index.mjs';
|
|
25
25
|
import { applicationTypes, authenticationTypes, binaryOptions, databaseTypes, entityOptions, fieldTypes, searchEngineTypes, } from '../../../jdl/jhipster/index.mjs';
|
|
@@ -113,7 +113,7 @@ export default function prepareEntity(entityWithConfig, generator, application)
|
|
|
113
113
|
const entityName = _.upperFirst(entityWithConfig.name);
|
|
114
114
|
_.defaults(entityWithConfig, entityDefaultConfig, BASE_TEMPLATE_DATA);
|
|
115
115
|
if (entityWithConfig.changelogDate) {
|
|
116
|
-
entityWithConfig.changelogDateForRecent = parseChangelog(entityWithConfig.changelogDate);
|
|
116
|
+
entityWithConfig.changelogDateForRecent = parseChangelog(String(entityWithConfig.changelogDate));
|
|
117
117
|
}
|
|
118
118
|
entityWithConfig.entityAngularJSSuffix = entityWithConfig.angularJSSuffix;
|
|
119
119
|
if (entityWithConfig.entityAngularJSSuffix && !entityWithConfig.entityAngularJSSuffix.startsWith('-')) {
|
|
@@ -228,7 +228,7 @@ export function derivedPrimaryKeyProperties(primaryKey) {
|
|
|
228
228
|
typeNumeric: !primaryKey.composite && primaryKey.fields[0].fieldTypeNumeric,
|
|
229
229
|
});
|
|
230
230
|
}
|
|
231
|
-
export function prepareEntityPrimaryKeyForTemplates(entityWithConfig,
|
|
231
|
+
export function prepareEntityPrimaryKeyForTemplates({ entity: entityWithConfig, enableCompositeId = true, application }) {
|
|
232
232
|
const idFields = entityWithConfig.fields.filter(field => field.id);
|
|
233
233
|
const idRelationships = entityWithConfig.relationships.filter(relationship => relationship.id);
|
|
234
234
|
let idCount = idFields.length + idRelationships.length;
|
|
@@ -236,8 +236,12 @@ export function prepareEntityPrimaryKeyForTemplates(entityWithConfig, generator,
|
|
|
236
236
|
let idField = entityWithConfig.fields.find(field => field.fieldName === 'id');
|
|
237
237
|
if (idField) {
|
|
238
238
|
idField.id = true;
|
|
239
|
+
idField.autoGenerate = idField.autoGenerate ?? true;
|
|
239
240
|
}
|
|
240
241
|
else {
|
|
242
|
+
if (entityWithConfig.microserviceName && !application?.microfrontend) {
|
|
243
|
+
this?.log.warn("Microservice entities should have the id field type specified (e.g., id String) to make sure gateway and microservice types don't conflict");
|
|
244
|
+
}
|
|
241
245
|
idField = {
|
|
242
246
|
fieldName: 'id',
|
|
243
247
|
id: true,
|
|
@@ -355,7 +359,7 @@ export function prepareEntityPrimaryKeyForTemplates(entityWithConfig, generator,
|
|
|
355
359
|
idField.dynamic = false;
|
|
356
360
|
// Allow ids type to be empty and fallback to default type for the database.
|
|
357
361
|
if (!idField.fieldType) {
|
|
358
|
-
idField.fieldType =
|
|
362
|
+
idField.fieldType = application?.pkType ?? getDatabaseTypeData(entityWithConfig.databaseType).defaultPrimaryKeyType;
|
|
359
363
|
}
|
|
360
364
|
primaryKeyName = idField.fieldName;
|
|
361
365
|
primaryKeyType = idField.fieldType;
|
|
@@ -546,14 +550,14 @@ function preparePostEntityCommonDerivedPropertiesNotTyped(entity) {
|
|
|
546
550
|
relationship.relationshipEagerLoad = false;
|
|
547
551
|
return;
|
|
548
552
|
}
|
|
549
|
-
relationship
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
+
mutateData(relationship, {
|
|
554
|
+
bagRelationship: relationship.ownerSide && relationship.collection,
|
|
555
|
+
relationshipEagerLoad: ({ relationshipEagerLoad, bagRelationship, ownerSide, otherEntity, otherEntityField }) => relationshipEagerLoad ??
|
|
556
|
+
(bagRelationship ||
|
|
553
557
|
entity.eagerLoad ||
|
|
554
558
|
// Fetch relationships if otherEntityField differs otherwise the id is enough
|
|
555
|
-
(
|
|
556
|
-
}
|
|
559
|
+
(ownerSide && otherEntity.primaryKey.name !== otherEntityField)),
|
|
560
|
+
});
|
|
557
561
|
});
|
|
558
562
|
entity.relationshipsContainEagerLoad = entity.relationships.some(relationship => relationship.relationshipEagerLoad);
|
|
559
563
|
entity.containsBagRelationships = entity.relationships.some(relationship => relationship.bagRelationship);
|