@nest-extended/core
The foundation every other package builds on — the generic CRUD controller, the dynamic configuration module, the null-response interceptor and the shared types.
$npm install @nest-extended/core nestjs-cls
Key exports
| Export | Type | Purpose |
|---|---|---|
NestController<T> | class | Base controller — find / get / create / patch / delete |
NestExtendedModule | module | Dynamic module configured via .forRoot(config) |
NullResponseInterceptor | interceptor | Throws 404 when a GET resolves to null |
getCurrentUser<T>() | function | Read the authenticated user from CLS |
NEST_EXTENDED_CONFIG | token | DI token for the resolved config |
NestExtendedConfig | type | Root config (soft delete, query parser) |
ServiceOptions<T> | interface | Service contract used by NestController |
PaginatedResponse<D> | type | { total, $limit, $skip, data } |
Generic controller
NestController wires the CRUD routes to any service implementing ServiceOptions:
import { Controller } from '@nestjs/common';
import { NestController } from '@nest-extended/core';
import { CatsService } from './cats.service';
@Controller('cats')
export class CatsController extends NestController<Cat> {
constructor(service: CatsService) {
super(service);
}
}Module configuration
NestExtendedModule.forRoot({
queryParser: { depth: 20, arrayLimit: 100 },
});