UNPKG

@elsikora/nestjs-crud-automator

Version:

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

40 lines (39 loc) 3.29 kB
import { EApiRouteType } from '../../../../enum/decorator/api'; import { IApiBaseEntity } from '../../../../interface/api-base-entity.interface'; import { IApiControllerGetListQueryPlan } from '../../../../interface/class/api/controller/get-list/query'; import { IApiControllerIdentityPlan } from '../../../../interface/class/api/controller/identity-plan.interface'; import { IApiControllerReadPlan } from '../../../../interface/class/api/controller/read'; import { IApiControllerProperties } from '../../../../interface/decorator/api'; import { IApiEntity } from '../../../../interface/entity'; import { TApiControllerPropertiesRoute } from '../../../../type/decorator/api/controller'; /** * Applies metadata for NestJS controller methods to enable proper dependency injection. * Sets up parameter metadata for route arguments including DTOs, headers, IP, and authentication requests. * @param {object} target - The target controller class * @param {object} targetPrototype - The prototype of the target controller class * @param {IApiEntity<E>} entity - The entity metadata for the controller * @param {IApiControllerProperties<E>} properties - Controller configuration properties * @param {EApiRouteType} method - The type of route (CREATE, DELETE, GET, etc.) * @param {string} methodName - The name of the method being configured * @param {TApiControllerPropertiesRoute<E, typeof method>} routeConfig - Route-specific configuration * @param {IApiControllerGetListQueryPlan} [queryPlan] - Normalized plan used to resolve the route-scoped dynamic QUERY DTO. * @returns {void} * @template E - The entity type */ export declare function ApiControllerApplyMetadata<E extends IApiBaseEntity>(target: object, targetPrototype: object, entity: IApiEntity<E>, properties: IApiControllerProperties<E>, method: EApiRouteType, methodName: string, routeConfig: TApiControllerPropertiesRoute<E, typeof method>, queryPlan?: IApiControllerGetListQueryPlan): void; /** * Applies generated route metadata with an internal compiled read plan. * @template E - Entity type * @param {object} target - Controller class receiving Swagger metadata. * @param {object} targetPrototype - Controller prototype receiving Nest route arguments. * @param {IApiEntity<E>} entity - Entity metadata. * @param {IApiControllerProperties<E>} properties - Controller configuration. * @param {EApiRouteType} method - Generated route type. * @param {string} methodName - Generated controller method name. * @param {TApiControllerPropertiesRoute<E, typeof method>} routeConfig - Route configuration. * @param {IApiControllerGetListQueryPlan} [queryPlan] - Internal compiled QUERY plan. * @param {IApiControllerReadPlan} [readPlan] - Internal compiled PARAMETERS plan. * @param {IApiControllerIdentityPlan} [identityPlan] - Internal GET identity alias plan. * @returns {void} */ export declare function ApiControllerApplyMetadataWithReadPlan<E extends IApiBaseEntity>(target: object, targetPrototype: object, entity: IApiEntity<E>, properties: IApiControllerProperties<E>, method: EApiRouteType, methodName: string, routeConfig: TApiControllerPropertiesRoute<E, typeof method>, queryPlan?: IApiControllerGetListQueryPlan, readPlan?: IApiControllerReadPlan, identityPlan?: IApiControllerIdentityPlan): void;