open-index/open-npm huggingface dataset:
npm package: @nestjs-kitchen/connextion
Description: A module builder of generic instance management in NextJS.
Author: yikenman
Latest version: 2.0.7

# @nestjs-kitchen/connextion

[![NPM Version](https://img.shields.io/npm/v/%40nestjs-kitchen%2Fconnextion)
](https://www.npmjs.com/package/@nestjs-kitchen/connextion)
![NPM License](https://img.shields.io/npm/l/%40nestjs-kitchen%2Fconnextion)
[![codecov](https://codecov.io/gh/yikenman/nestjs-kitchen/graph/badge.svg?token=43EG2T8LKS&flag=@nestjs-kitchen/connextion)](https://codecov.io/gh/yikenman/nestjs-kitchen)

A module builder of generic instance management in NextJS.

---

## Install

```bash
$ npm install --save @nestjs-kitchen/connextion
```

## Usage

```typescript
import { defineConnextionBuilder, ConnextionInstance } from '@nestjs-kitchen/connextion';

class CustomInstance extends ConnextionInstance<{}> {
    // ...
}

const defineCustomInstanceManager = defineConnextionBuilder({
  connextionName: 'CustomInstanceManager',
  InstanceClass: CustomInstance,
});

const { 
  // Services for injection to manage CustomInstances.
  CustomInstanceManager, 
  // Module for registering instances .
  CustomInstanceManagerModule 
} = defineCustomInstanceManager();
```

## License

MIT License
npm package: @nestjs-kitchen/connextion-presto
Description: A flexible module to provide presto-client interface in NextJS.
Author: yikenman
Latest version: 2.0.9

# @nestjs-kitchen/connextion-presto

[![NPM Version](https://img.shields.io/npm/v/%40nestjs-kitchen%2Fconnextion-presto)
](https://www.npmjs.com/package/@nestjs-kitchen/connextion-presto)
![NPM License](https://img.shields.io/npm/l/%40nestjs-kitchen%2Fconnextion-presto)
[![codecov](https://codecov.io/gh/yikenman/nestjs-kitchen/graph/badge.svg?token=43EG2T8LKS&flag=@nestjs-kitchen/connextion-presto)](https://codecov.io/gh/yikenman/nestjs-kitchen)

A flexible module to provide [presto-client](https://www.npmjs.com/package/presto-client) interface in NextJS.

---

## Install

```bash
$ npm install --save @nestjs-kitchen/connextion @nestjs-kitchen/connextion-presto presto-client @types/presto-client
```

## Usage

### Apply `PrestoModule`

1. Export module, service & decorator. 

    ```typescript
    export const { Presto, PrestoModule } = definePresto();
    export type Presto = InstanceType<typeof Presto>;
    ```

2. Register presto connection instance with options.

    ```typescript
    @Module({
      imports: [
        // By default it will register a connection instance called `default`.
        PrestoModule.register({
          // default's options...
        })
      ],
      providers: [SampleService]
    })
    export class SampleModule {} 
    ```

3. Inject `Presto` service.

    ```typescript
    import { Presto } from './file-that-exported-presto';
    
    @Injectable()
    class SampleService {
      constructor(
        private readonly presto: Presto,
      ) {}
    
      async sampleMethod() {
        const result1 = await this.presto.default.execute({ query: `select 1=1;` });
      }
    }
    ```

### Register multiple presto instances

1. Define presto connection instance names and export module, service & decorator. 

    e.g.: `instance_1`,`instance_2`.

    ```typescript
    export const { Presto, PrestoModule } = definePresto<'instance_1' | 'instance_2'>();
    export type Presto = InstanceType<typeof Presto>;
    ```

2. Register presto connection instances with options.

    ```typescript
    @Module({
      imports: [
        PrestoModule.register({
          connections: [
            {
              name: 'instance1',
              // instance_1's options...
            },
            {
              name: 'instance2',
              // instance_2's options...
            }
          ]
        })
      ],
      providers: [SampleService]
    })
    export class SampleModule {} 
    ```

3. Inject `Presto` service.

    ```typescript
    import { Presto } from './file-that-exported-presto';
    
    @Injectable()
    class SampleService {
      constructor(
        private readonly presto: Presto,
      ) {}
    
      async sampleMethod() {
        const result1 = await this.presto.instance1.execute({ query: `select 1=1;` });
      }
    }
    ```


## License

MIT License
npm package: @nestjs-kitchen/headers
Description: An convenient way to add custom HTTP headers.
Author: yikenman
Latest version: 1.0.0

# @nestjs-kitchen/headers

[![NPM Version](https://img.shields.io/npm/v/%40nestjs-kitchen%2Fheaders)
](https://www.npmjs.com/package/@nestjs-kitchen/headers)
![NPM License](https://img.shields.io/npm/l/%40nestjs-kitchen%2Fheaders)
[![codecov](https://codecov.io/gh/yikenman/nestjs-kitchen/graph/badge.svg?token=43EG2T8LKS&flag=@nestjs-kitchen/headers)](https://codecov.io/gh/yikenman/nestjs-kitchen)

An convenient way to add custom HTTP headers.

---

## Install

```bash
$ npm install --save @nestjs-kitchen/headers
```

## Usage

### Example

Register module:

```ts
// in app.module.ts
@Module({
  imports: [
    // ...
    HeadersModule.register({
      headers: {
        'X-Custom-Header': 'custom-value'
      }
    }),
    // ...
  ],
})
export class AppModule {}
```

### Options

| Option      | Type                                                     | Default  | Description                                                                                                                 |
| ----------- | -------------------------------------------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------- |
| `headers`   | `Headers \| ((req: any) => Headers \| Promise<Headers>)` | required | HTTP headers to set. Can be a static object or a function that dynamically computes headers based on the request.           |
| `include`   | `(string \| RegExp)[]`                                   | —        | Optional path inclusion filter. Headers will only be applied to matching requests.                                          |
| `exclude`   | `(string \| RegExp)[]`                                   | —        | Path exclusion filter. Has higher priority than `include`. Requests matching any exclude pattern will skip setting headers. |
| `overwrite` | `boolean`                                                | `false`  | Whether to overwrite existing headers. If false, headers will only be set if they do not already exist.                     |
| `debug`     | `boolean`                                                | `false`  | Enable debug logging. When true, debug information will be logged to the configured logger.                                 |


## License

MIT License
npm package: @nestjs-kitchen/mybatis-mapper
Description: A mybatis mapper in NextJS.
Author: yikenman
Latest version: 2.0.4

# @nestjs-kitchen/mybatis-mapper

[![NPM Version](https://img.shields.io/npm/v/%40nestjs-kitchen%2Fmybatis-mapper)
](https://www.npmjs.com/package/@nestjs-kitchen/mybatis-mapper)
![NPM License](https://img.shields.io/npm/l/%40nestjs-kitchen%2Fmybatis-mapper)
[![codecov](https://codecov.io/gh/yikenman/nestjs-kitchen/graph/badge.svg?token=43EG2T8LKS&flag=@nestjs-kitchen/mybatis-mapper)](https://codecov.io/gh/yikenman/nestjs-kitchen)

A [mybatis mapper](https://www.npmjs.com/package/mybatis-mapper) in NextJS.

---

## Install

```bash
$ npm install --save @nestjs-kitchen/mybatis-mapper
```

## Usage

1. Auto load/watch mappers from specified folder:

    ```ts
    // app.module.ts
    import { MybatisMapperModule } from "mybatis";
    import { AppService } from "./app.service";

    @Module({
        // load and watch mappers from specified folder.
      imports: [MybatisMapperModule.register({ patterns: "./mapper", watchPatterns: "./mapper" })],
      controllers: [],
      providers: [AppService],
    })
    export class AppModule {}
    ```

2. get sql from mappers:

    ```ts
    // app.service.ts
    import { Injectable } from '@nestjs/common';
    import { MybatisMapper } from 'mybatis';

    @Injectable()
    export class AppService {
      constructor(private mapper: MybatisMapper){}

      getSql(): string {
        const param = {
          category : 'apple',
          price : 100
        }

        return this.mapper.getStatement('fruit', 'testIf', param, { language: 'sql', indent: '  ' }
      }
    }
    ```

## License

MIT License
npm package: @nestjs-kitchen/proxy
Description: Provides an HTTP proxy functionality in the NestJS style.
Author: yikenman
Latest version: 1.0.1

# @nestjs-kitchen/proxy

[![NPM Version](https://img.shields.io/npm/v/%40nestjs-kitchen%2Fproxy)
](https://www.npmjs.com/package/@nestjs-kitchen/proxy)
![NPM License](https://img.shields.io/npm/l/%40nestjs-kitchen%2Fproxy)
[![codecov](https://codecov.io/gh/yikenman/nestjs-kitchen/graph/badge.svg?token=43EG2T8LKS&flag=@nestjs-kitchen/proxy)](https://codecov.io/gh/yikenman/nestjs-kitchen)

Provides an HTTP proxy functionality in the NestJS style.

---

## Feature

- ✅ Provides a NestJS-style API.

- ✅ Built on top of [`http-proxy-middleware`](https://www.npmjs.com/package/http-proxy-middleware)

- ✅ Compatible with both `@nestjs/platform-express` and `@nestjs/platform-fastify`.

## Install

```bash
$ npm install --save @nestjs-kitchen/proxy
```

## Usage

> Note: `rawBody` option should be enabled first. See [`Raw body`](https://docs.nestjs.com/faq/raw-body#raw-body).

```ts
// express
const app = await NestFactory.create<NestExpressApplication>(AppModule, {
  rawBody: true,
});
```

or 

```ts
// fastify
const app = await NestFactory.create<NestFastifyApplication>(
  AppModule,
  new FastifyAdapter(),
  {
    rawBody: true,
  },
);
```

### Example

Register module:

```ts
// in app.module.ts
@Module({
  imports: [
    // ...
    ProxyModule.register({
      options: {
        target: 'https://you.com/target/api',
        changeOrigin: true,
        agent: new Agent({ keepAlive: true })
      }
    })
    // ...
  ],
  controllers: [AppController],
  providers: [],
})
export class AppModule {}
```

Apply Proxy in a Controller:

```ts
// in app.controller.ts
import { Controller, All, Post } from '@nestjs/common';
import { ProxyInterceptor } from '@nestjs-kitchen/proxy';

@UseInterceptors(ProxyInterceptor)
@Controller()
export class AppController {

  @ProxyInterceptor.Use({
    headers: { 'x-handler': 'ok' },
    pathRewrite: { '^/proxy-api': '' }
  })
  @All('/proxy-api/*')
  proxyApi() {
    return true;
  }
}
```

### Options

See [`http-proxy-middleware#options`](https://www.npmjs.com/package/http-proxy-middleware#options).

## License

MIT License