diff --git a/generators/angular/generator.ts b/generators/angular/generator.ts index 37d3cff3c567..291244f2c578 100644 --- a/generators/angular/generator.ts +++ b/generators/angular/generator.ts @@ -22,12 +22,7 @@ import BaseApplicationGenerator from '../base-application/index.js'; import { GENERATOR_ANGULAR, GENERATOR_CLIENT, GENERATOR_LANGUAGES } from '../generator-list.js'; import { defaultLanguage } from '../languages/support/index.js'; import { clientFrameworkTypes } from '../../lib/jhipster/index.js'; -import { - generateTypescriptTestEntity as generateTestEntity, - generateEntityClientEnumImports as getClientEnumImportsFormat, - generateTestEntityId as getTestEntityId, - generateTestEntityPrimaryKey as getTestEntityPrimaryKey, -} from '../client/support/index.js'; +import { generateEntityClientEnumImports as getClientEnumImportsFormat } from '../client/support/index.js'; import { createNeedleCallback, mutateData } from '../base/support/index.js'; import { writeEslintClientRootConfigFile } from '../javascript/generators/eslint/support/tasks.js'; import type { TaskTypes as DefaultTaskTypes } from '../../lib/types/application/tasks.js'; @@ -41,7 +36,6 @@ import { addItemToAdminMenu, addRoute, addToEntitiesMenu, - buildAngularFormPath as angularFormPath, isTranslatedAngularFile, translateAngularFilesTransform, } from './support/index.js'; @@ -49,11 +43,7 @@ import type { AngularApplication, AngularEntity } from './types.js'; const { ANGULAR } = clientFrameworkTypes; -export default class AngularGenerator extends BaseApplicationGenerator< - AngularEntity, - AngularApplication, - DefaultTaskTypes -> { +export default class AngularGenerator extends BaseApplicationGenerator> { async beforeQueue() { if (!this.fromBlueprint) { await this.composeWithBlueprints(); @@ -182,22 +172,6 @@ export default class AngularGenerator extends BaseApplicationGenerator< entity.generateEntityClientEnumImports = fields => { return getClientEnumImportsFormat(fields, ANGULAR); }; - - entity.generateTestEntityPrimaryKey = (primaryKey, index) => { - return getTestEntityPrimaryKey(primaryKey, index); - }; - - entity.generateTypescriptTestEntity = (references, additionalFields) => { - return generateTestEntity(references, additionalFields); - }; - - entity.buildAngularFormPath = (reference, prefix = []) => { - return angularFormPath(reference, prefix); - }; - - entity.generateTestEntityId = (primaryKey, index: 0 | 1 | 'random' = 0, wrapped = true) => { - return getTestEntityId(primaryKey, index, wrapped); - }; }, }); } @@ -245,7 +219,7 @@ export default class AngularGenerator extends BaseApplicationGenerator< return this.asDefaultTaskGroup({ loadEntities({ application }) { const entities = this.sharedData.getEntities().map(({ entity }) => entity); - application.angularEntities = entities.filter(entity => !entity.builtIn && !entity.skipClient); + application.angularEntities = entities.filter(entity => !entity.builtIn && !entity.skipClient) as AngularEntity[]; }, queueTranslateTransform({ control, application }) { const { enableTranslation, jhiPrefix } = application; diff --git a/generators/angular/types.d.ts b/generators/angular/types.d.ts index d87d6d5b8f05..a9007d9d4956 100644 --- a/generators/angular/types.d.ts +++ b/generators/angular/types.d.ts @@ -16,35 +16,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import type { Entity } from '../../lib/types/application/entity.js'; import type { ApplicationType } from '../../lib/types/application/application.js'; +import type { Entity } from '../../lib/types/application/index.js'; export interface AngularEntity extends Entity { - /** - * generates a value for a primary key type - * @param primaryKey the primary key attribute (or its type) of the entity - * @param index an index to add salt to the value - * @param wrapped if the value should be within quotes - * @returns {string|number|string} - */ - generateTestEntityId: (primaryKey: any, index?: 0 | 1 | 'random', wrapped?: boolean) => any; - /** - * @private - * Create a angular form path getter method of reference. - * - * @param {object} reference - * @param {string[]} prefix - * @return {string} - */ - buildAngularFormPath: (reference: any, prefix?: never[]) => string; - /** - * @private - * Generate a test entity instance with faked values. - * - * @param {any} references - references to other entities. - * @param {any} additionalFields - additional fields to add to the entity or with default values that overrides generated values. - */ - generateTypescriptTestEntity: (references: any, additionalFields: any) => string; /** * @private * Generate a test entity, for the PK references (when the PK is a composite, derived key) diff --git a/lib/types/application/entity.d.ts b/lib/types/application/entity.d.ts index 7065b45a1c05..08e58a4660e0 100644 --- a/lib/types/application/entity.d.ts +++ b/lib/types/application/entity.d.ts @@ -45,8 +45,7 @@ type ClientSample = Record; export interface Entity extends Omit>, 'relationships'>, - ServerEntity, - AngularEntity { + ServerEntity { changelogDateForRecent: any; /** @experimental */ auditableEntity?: boolean;