npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@nest-extended/core

v0.0.2-beta-18

Published

This package provides the core building blocks for NestJS applications built with the **NestExtended** ecosystem. It includes generic controllers, a dynamic configuration module, interceptors, CLS helpers, and type interfaces designed to work seamlessly w

Readme

@nest-extended/core

This package provides the core building blocks for NestJS applications built with the NestExtended ecosystem. It includes generic controllers, a dynamic configuration module, interceptors, CLS helpers, and type interfaces designed to work seamlessly with @nest-extended/mongoose.

Key Features

  • Generic Controller (NestController): A base controller class that handles common CRUD operations (find, get, create, patch, delete) by delegating to a service implementing ServiceOptions. Auto-wires @Public(), @ModifyBody(setCreatedBy()), and @User() decorators.
  • Dynamic Module (NestExtendedModule): A global dynamic module configured via NestExtendedModule.forRoot(config) that provides app-wide soft delete configuration and automatic qs query parser setup. Injects NEST_EXTENDED_CONFIG token.
  • CLS Helpers: Utilities for nestjs-cls (Continuation Local Storage):
    • getCurrentUser<T>() — retrieve the authenticated user from CLS context (set by AuthGuard).
    • CLS_KEYS.USER — constant for the CLS user key.
  • Interceptors:
    • NullResponseInterceptor — throws NotFoundException on null/undefined GET responses.
  • Configuration Types:
    • NestExtendedConfig — root config with softDelete and queryParser settings.
    • SoftDeleteConfiggetQuery() and getData(user) for soft delete behavior.
    • QueryParserConfigdepth, arrayLimit, allowDots for qs query parser.
    • NEST_EXTENDED_CONFIG — injection token (Symbol).
  • Type Interfaces:
    • ServiceOptions<T> — interface for _find, _get, _create, _patch, _remove.
    • NestServiceOptions — options for multi, softDelete, pagination.
    • PaginatedResponse<D> — typed response with total, $limit, $skip, data.
    • RequestBody — re-export from @nest-extended/decorators.
  • Default Options: Configurable defaults for deleteKey ('deleted'), defaultPagination (true), defaultLimit (20), defaultSkip (0), multi (false).
  • Constants: WeekDays enum and EachSlotDurationInMinutes (30).
  • Decorators: Moved to @nest-extended/decorators — use @User(), @Public(), @ModifyBody(), setCreatedBy().

Usage

NestExtendedModule

Configure soft delete behavior and query parser globally:

import { NestExtendedModule } from '@nest-extended/core';

@Module({
  imports: [
    NestExtendedModule.forRoot({
      softDelete: {
        getQuery: () => ({ deleted: { $ne: true } }),
        getData: (user) => ({
          deleted: true,
          deletedBy: user?._id,
          deletedAt: new Date(),
        }),
      },
      // Query parser is enabled by default with qs (depth: 20, arrayLimit: 100)
      // Customize or disable:
      // queryParser: { depth: 10, arrayLimit: 50, allowDots: true },
      // queryParser: false, // disable qs, use Express default
    }),
  ],
})
export class AppModule {}

Query Parser

The module automatically configures qs as the Express query parser on application bootstrap. This enables proper parsing of deeply nested query objects and arrays (required by @nest-extended/mongoose query features like $populate, $sort, etc.).

| Option | Type | Default | Description | |---|---|---|---| | depth | number | 20 | Maximum nesting depth for query objects | | arrayLimit | number | 100 | Maximum number of array elements | | allowDots | boolean | false | Allow dot notation in query keys |

  • Enabled by default: No configuration needed — just use NestExtendedModule.forRoot().
  • Custom options: Pass a QueryParserConfig object to queryParser.
  • Disable: Set queryParser: false to use Express's default query parser.

NestController

Extend NestController to automatically expose standard CRUD endpoints.

import { NestController } from '@nest-extended/core';
import { MyService } from './my.service';

@Controller('my-resource')
export class MyController extends NestController<MyResource> {
  constructor(private readonly myService: MyService) {
      super(myService);
  }
}

NullResponseInterceptor

Register globally to auto-throw 404 on null GET responses:

import { NullResponseInterceptor } from '@nest-extended/core';
import { APP_INTERCEPTOR } from '@nestjs/core';

providers: [
  { provide: APP_INTERCEPTOR, useClass: NullResponseInterceptor },
]

CLS Helper

Retrieve the authenticated user from CLS context (useful in services):

import { getCurrentUser } from '@nest-extended/core';

const user = getCurrentUser();

Decorators

Decorators have been moved to their own package.

import { User, Public, ModifyBody, setCreatedBy } from '@nest-extended/decorators';

Exported API

| Export | Type | Description | |---|---|---| | NestController | Class | Generic CRUD controller base class | | NestExtendedModule | Module | Dynamic config module (.forRoot()) | | options | Object | Default options (deleteKey, pagination, limits) | | getCurrentUser | Function | Get user from CLS context | | CLS_KEYS | Const | CLS key constants | | NullResponseInterceptor | Interceptor | 404 on null GET responses | | NestExtendedConfig | Interface | Root configuration type | | SoftDeleteConfig | Interface | Soft delete config type | | QueryParserConfig | Interface | Query parser options (depth, arrayLimit, allowDots) | | NEST_EXTENDED_CONFIG | Symbol | DI injection token | | ServiceOptions<T> | Interface | Service method contract | | NestServiceOptions | Type | Service behavior options | | PaginatedResponse<D> | Interface | Paginated response type | | RequestBody | Type | Re-exported typed request body |