Skip to Content

Interfaces

Complete reference for key interfaces used in NestJS CRUD Automator.

Core Interfaces

IApiBaseEntity

Base interface for all entities.

interface IApiBaseEntity { [key: string]: unknown; }

All entities must implement this interface (implicitly through TypeScript’s structural typing).

IApiGetListResponseResult<E>

Response structure for paginated list operations.

interface IApiGetListResponseResult<E> { items: E[]; total: number; page: number; limit: number; totalPages: number; hasNextPage: boolean; hasPreviousPage: boolean; }

Related:

Controller Interfaces

IApiControllerProperties<E>

Configuration options for @ApiController.

interface IApiControllerProperties<E> { entity: Type<E>; name?: string; path?: string; routes: { [K in EApiRouteType]?: TApiControllerPropertiesRoute<E, K>; }; }

IApiControllerAuthentication

Authentication configuration for routes.

interface IApiControllerAuthentication { guard: Type<CanActivate>; bearerStrategies: string[]; }

Subscriber Interfaces

IApiSubscriberRouteExecutionContext<E, Result>

Execution context for route subscribers.

interface IApiSubscriberRouteExecutionContext<E, Result> { readonly ENTITY: E; readonly DATA: { readonly method: string; readonly methodName: string; readonly properties: IApiControllerProperties<E>; readonly entityMetadata: IApiEntity<E>; readonly authenticationRequest?: IApiAuthenticationRequest; readonly headers: Record<string, string>; readonly ip: string; }; readonly ROUTE_TYPE: EApiRouteType; result: Result; }

Related:

IApiSubscriberFunctionExecutionContext<E, Result>

Execution context for function subscribers.

interface IApiSubscriberFunctionExecutionContext<E, Result> { readonly ENTITY: E; readonly DATA: { readonly method: string; readonly entityMetadata: IApiEntity<E>; readonly transactionManager?: EntityManager; }; result: Result; }

Related:

IApiSubscriberRoute<E>

Interface for route subscribers.

interface IApiSubscriberRoute<E> { onBeforeCreate?(context: IApiSubscriberRouteExecutionContext<E, any>): Promise<any>; onAfterCreate?(context: IApiSubscriberRouteExecutionContext<E, E>): Promise<E | undefined>; onBeforeErrorCreate?(context: IApiSubscriberRouteErrorExecutionContext<E>, error: Error): Promise<void>; onAfterErrorCreate?(context: IApiSubscriberRouteErrorExecutionContext<E>, error: Error): Promise<void>; // ... similar methods for update, get, getList, getMany, delete }

IApiSubscriberFunction<E>

Interface for function subscribers.

interface IApiSubscriberFunction<E> { onBeforeCreate?(context: IApiSubscriberFunctionExecutionContext<E, any>): Promise<any>; onAfterCreate?(context: IApiSubscriberFunctionExecutionContext<E, E>): Promise<E | undefined>; onBeforeErrorCreate?(context: IApiSubscriberFunctionErrorExecutionContext<E>, error: Error): Promise<void>; onAfterErrorCreate?(context: IApiSubscriberFunctionErrorExecutionContext<E>, error: Error): Promise<void>; // ... similar methods for update, get, getList, getMany, delete }

Authentication Interface

IApiAuthenticationRequest

Authentication request data available in subscribers.

interface IApiAuthenticationRequest { user?: { id: string; [key: string]: unknown; }; [key: string]: unknown; }

Entity Metadata Interface

IApiEntity<E>

Entity metadata information.

interface IApiEntity<E> { name: string; primaryKey: string | null; columns: string[]; relations: string[]; [key: string]: unknown; }

Property Validation Interfaces

IApiDtoValidator

Custom validator configuration.

interface IApiDtoValidator { constraintClass: Type<ValidatorConstraintInterface>; options?: any[]; }

Related:

Request Transformer Interfaces

IApiControllerRequestTransformer

Request transformer configuration.

interface IApiControllerRequestTransformer { key: string; type: EApiControllerRequestTransformerType; value: any; shouldSetValueEvenIfMissing?: boolean; }

Related:

Next Steps

Last updated on