UNPKG

@weverson_na/prisma-generator-nestjs-dto

Version:

Advanced Prisma Generator with Smart Merge v2: Creates DTO and Entity classes with AST-based preservation, intelligent import management, and modular architecture for NestJS

34 lines (33 loc) 1.64 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.BaseModelParamsComputer = void 0; const import_manager_1 = require("./shared/import-manager"); const helpers_1 = require("../helpers/helpers"); const decorator_strategy_1 = require("../decorators/decorator-strategy"); const shared_1 = require("./shared"); class BaseModelParamsComputer { constructor(templateHelpers, customDecoratorConfigsPath) { this.templateHelpers = templateHelpers; this.customDecoratorConfigsPath = customDecoratorConfigsPath; this.fieldProcessor = new shared_1.FieldProcessor(templateHelpers, customDecoratorConfigsPath); this.helpers = new helpers_1.Helpers(new decorator_strategy_1.DecoratorStrategy(customDecoratorConfigsPath)); } hasApiPropertyDoc(fields) { const helperConstructor = this.templateHelpers.constructor; return helperConstructor.hasSomeApiPropertyDoc ? helperConstructor.hasSomeApiPropertyDoc(fields, this.customDecoratorConfigsPath) : false; } processModelFields(model, allModels, addExposePropertyDecorator = false) { const config = this.getFieldConfig(); return this.fieldProcessor.processFields(model, allModels, config, addExposePropertyDecorator); } finalizeImports(imports, fields, hasApiExtraModels, hasEnum) { return import_manager_1.ImportManager.finalizeImports(imports, fields, { hasApiExtraModels, hasEnum, hasApiPropertyDoc: this.hasApiPropertyDoc(fields), }); } } exports.BaseModelParamsComputer = BaseModelParamsComputer;