open-index/open-npm huggingface dataset:
npm package: @nest-extended/core
Description: This package provides the core building blocks for NestJS applications built with the **NestExtended** ecosystem. It includes generic controllers, decorators, and configuration interfaces designed to work seamlessly with `@nest-extended/mongoose`.
Latest version: 0.0.2-beta-14

# @nest-extended/core

This package provides the core building blocks for NestJS applications built with the **NestExtended** ecosystem. It includes generic controllers, decorators, and configuration 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`.
- **Decorators**: Moved to `@nest-extended/decorators`.
    - `@User()`
    - `@Public()`
    - `@ModifyBody()`

## Usage

### NestController

Extend `NestController` to automatically expose standard CRUD endpoints.

```typescript
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);
  }
}
```

### Decorators

Decorators have been moved to their own package.

```typescript
import { User, Public, ModifyBody, setCreatedBy } from '@nest-extended/decorators';
```
npm package: @nest-extended/decorators
Description: This package provides useful decorators for NestJS applications.
Latest version: 0.0.2-beta-14

# @nest-extended/decorators

This package provides useful decorators for NestJS applications.

## Key Features

- **`@User()`**: Retrieves the current user from the request (integrates with `nestjs-cls` or request object).
- **`@Public()`**: Marks a route as public (useful for authentication guards).
- **`@ModifyBody()`**: Allows modification of the request body before validation (e.g., setting `createdBy`).

## Installation

```bash
npm install @nest-extended/decorators
```

## Usage

```typescript
import { User, Public, ModifyBody, setCreatedBy } from '@nest-extended/decorators';
import { Controller, Get, Post } from '@nestjs/common';

@Controller('cats')
export class CatsController {
  @Public()
  @Get()
  findAll() { ... }

  @Post()
  create(@ModifyBody(setCreatedBy()) body: CreateDto) { ... }

  @Get('profile')
  getProfile(@User() user: any) { ... }
}
```
npm package: @nest-extended/mongoose
Description: This package provides powerful Mongoose integrations for the **NestExtended** ecosystem, offering a robust service layer with built-in pagination, filtering, and soft delete capabilities.
Latest version: 0.0.2-beta-14

# @nest-extended/mongoose

This package provides powerful Mongoose integrations for the **NestExtended** ecosystem, offering a robust service layer with built-in pagination, filtering, and soft delete capabilities.

## Key Features

- **NestService**: A generic service class (`NestService<DTO, Document>`) that provides:
    - **CRUD Operations**: `_find`, `_get`, `_create`, `_patch`, `_remove`.
    - **Advanced Querying**: Support for `$regex`, `$or`, and standard MongoDB operators.
    - **Pagination**: Built-in pagination logic using `skip` and `limit`.
    - **Soft Delete**: Configurable soft delete support (requires `@nest-extended/core` integration).
- **Utilities**:
    - `ensureObjectId`: Helper to validate and convert strings to MongoDB ObjectIds.
    - `nestify`: Query helper for applying filters, sorting, and pagination.

## Usage

### NestService

Extend `NestService` to create a service with full CRUD capabilities.

```typescript
import { NestService } from '@nest-extended/mongoose';
import { InjectModel } from '@nestjs/mongoose';
import { Model } from 'mongoose';
import { Cat, CatDocument } from './schemas/cat.schema';

@Injectable()
export class CatsService extends NestService<Cat, CatDocument> {
  constructor(@InjectModel(Cat.name) catModel: Model<CatDocument>) {
    super(catModel);
  }
}
```

### Querying

You can use the `_find` method with query objects:

```typescript
const results = await this.catsService._find({
  name: { $regex: 'kitty', $options: 'i' },
  age: { $gt: 5 },
  $sort: { createdAt: -1 },
  $limit: 10
});
```