UNPKG

@elsikora/nestjs-crud-automator

Version:

A library for automating the creation of CRUD operations in NestJS.

21 lines (20 loc) 1.36 kB
import { EApiDtoType, EApiRouteType } from '../../../enum/decorator/api'; import { Type } from '@nestjs/common'; /** * Generates a path-aware DTO wrapper for a nested manual DTO inside an auto-generated CRUD DTO. * The wrapper replays all original `ApiProperty*` decorators so Swagger, validation, and * class-transformer semantics remain intact while the schema name becomes context-specific. * @param {Type<unknown>} sourceDto - Source manual DTO class. * @param {EApiRouteType} method - Current auto DTO route method. * @param {EApiDtoType} dtoType - Current auto DTO type. * @param {string} parentDtoName - Parent generated DTO class name. * @param {string} propertyPathSegment - Current nested path segment to append. * @returns {Type<unknown>} Context-specific wrapper or the original class when replay metadata is unavailable. */ export declare function DtoGenerateContextualManualDto(sourceDto: Type<unknown>, method: EApiRouteType, dtoType: EApiDtoType, parentDtoName: string, propertyPathSegment: string): Type<unknown>; /** * Returns whether a class was materialized as a context-specific wrapper around a manual DTO. * @param {unknown} value - Constructor candidate. * @returns {boolean} Whether the candidate is a generated contextual manual DTO. */ export declare function IsContextualManualDto(value: unknown): value is Type<unknown>;