open-index/open-npm huggingface dataset:
npm package: @huguenots-dev/nestjs-cqrs-nats-jetstream
Description: NestJS CQRS module for NATS JetStream
Latest version: 1.1.0

<h1  align="center">
NestJS CQRS NATS Jetstream
</h1>

<p  align="center">
NestJS CQRS module for NATS JetStream. It requires @nestjs/cqrs.
</p>


## Installation
```bash
$ npm i @huguenots-dev/nestjs-cqrs-nats-jetstream
```


## Description
This module enable NestJS CQRS to work with [NATS JetStream]([https://github.com/nats-io/jetstream](https://github.com/nats-io/jetstream)).


## Setup root app module
```typescript
import { Module } from  '@nestjs/common';
import { JetstreamModule } from  '@huguenots-dev/nestjs-cqrs-nats-jetstream';

@Module({
	imports: [
		JetstreamModule.register()
	]
})

export  class  AppModule {}
```

## Setup

### Setup NATS JetStream

Create a stream by configuring the subject with a wildcard. Your events will be published with the ```featureSubjectPrefix```, something like ```USER.UserLoggedInEvent```. Thus, all events published by the module will be sent to that stream.
```bash
$ nats stream add
? Stream Name USER
? Subjects to consume USER.*
? ...
```

You now need to create one or more consumers. The module can subscribe to one or more, do as you see fit. The name of the consumer makes no difference to the handlers, we only need the delivery target to subscribe.
```bash
$ nats consumer add
? Consumer name USER-SERVICE
? Delivery target CONSUMER-user-service
? ...
```

### Setup feature module

```typescript
import { Module } from '@nestjs/common';
import { CqrsModule } from '@nestjs/cqrs';
import { JetstreamModule } from 'nestjs-cqrs-nats-jetstream';
import {
  UserCommandHandlers,
  UserCreatedEvent,
  UserEventHandlers,
  UserQueryHandlers,
} from  '../cqrs';

@Module({
  imports: [
    CqrsModule,
    JetstreamModule.registerFeature({
      featureSubjectPrefix: 'USER', // Events will be published with this prefix.
      subscriptions: [
        {
          name: "CONSUMER-user-service" // Insert the consumer delivery target
        },
      ],
      eventHandlers: {
        "USER.UserLoggedInEvent": (data, ack, raw) => new UserLoggedInEvent(data, ack, raw),
        "USER.UserRegisteredEvent": (data, ack, raw) => new UserRegisteredEvent(data, ack, raw),
        "USER.EmailVerifiedEvent": (data, ack, raw) => new EmailVerifiedEvent(data, ack, raw),
      },
    }),
  ],
  providers: [
    ...UserQueryHandlers,
    ...UserCommandHandlers,
    ...UserEventHandlers,
  ],
})

export  class  UserModule {}
```

## License

This project is [MIT licensed](LICENSE).
This project is forked from https://github.com/brunonunes/nestjs-cqrs-nats-jetstream
npm package: @huhm/openapi-gen
Description: [![GitHub Repo stars](https://img.shields.io/github/stars/chenshuai2144/openapi2typescript?style=social)](https://github.com/chenshuai2144/openapi2typescript) [![npm (scoped)](https://img.shields.io/npm/v/@umijs/openapi)](https://www.npmjs.com/package/@um
Author: chenshuai2144
Latest version: 1.9.2

## 介绍
[![GitHub Repo stars](https://img.shields.io/github/stars/chenshuai2144/openapi2typescript?style=social)](https://github.com/chenshuai2144/openapi2typescript)
[![npm (scoped)](https://img.shields.io/npm/v/@umijs/openapi)](https://www.npmjs.com/package/@umijs/openapi)
![GitHub tag (latest SemVer pre-release)](https://img.shields.io/github/v/tag/chenshuai2144/openapi2typescript?include_prereleases)

根据 [OpenApi3](https://swagger.io/blog/news/whats-new-in-openapi-3-0/) 文档生成 request 请求代码。

如果你使用 [umi](https://umijs.org) ,你可以使用[@umijs/plugin-openapi](https://www.npmjs.com/package/@umijs/plugin-openapi) 插件。
## 使用
```node
npm i --save-dev @umijs/openapi
```
在项目根目录新建 ```openapi.config.ts```
```ts
const { generateService } = require('@umijs/openapi')

generateService({
  schemaPath: 'http://petstore.swagger.io/v2/swagger.json',
  serversPath: './servers',
})

```
在 ```package.json``` 的 ```script``` 中添加 api: ```"openapi": "ts-node openapi.config.ts",```

生成api
```node
npm run openapi
```
## 参数
|  属性   | 必填  | 备注 | 类型 | 默认值 |
|  ----  | ----  |  ----  |  ----  | - |
| requestLibPath  | 否 | 自定义请求方法路径 | string | - |
| requestImportStatement  | 否 | 自定义请求方法表达式 | string | - |
| apiPrefix  | 否 | api 的前缀 | string | - |
| serversPath  | 否 | 生成的文件夹的路径 | string | - |
| schemaPath  | 否 | Swagger 2.0 或 OpenAPI 3.0 的地址 | string | - |
| projectName  | 否 | 项目名称 | string | - |
| namespace  | 否 | 命名空间名称 | string | API |
| mockFolder  | 否 | mock目录 | string | - |
| enumStyle  | 否 | 枚举样式 | string-literal \| enum | string-literal |
| nullable | 否 | 使用null代替可选 | boolean | false |
| dataFields | 否 | response中数据字段 | string[] | - |