mirror of
https://github.com/nestjs/nest.git
synced 2026-02-21 23:11:44 +00:00
Compare commits
110 Commits
v4.6.6
...
v5.0.0-bet
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
195ae2726d | ||
|
|
484a2eb4ec | ||
|
|
6630313ece | ||
|
|
c7a8caacef | ||
|
|
021b96eaa0 | ||
|
|
fb53ba2b1a | ||
|
|
bf2fcb7aa1 | ||
|
|
518ea8d33f | ||
|
|
3ad570e62e | ||
|
|
5cfb0bfc85 | ||
|
|
59fb9c71e2 | ||
|
|
8e2c957833 | ||
|
|
944921f2e9 | ||
|
|
59f5d68df5 | ||
|
|
91c879d922 | ||
|
|
f918e2b774 | ||
|
|
6cac4b7e1e | ||
|
|
8117cfb10b | ||
|
|
4b926da0d6 | ||
|
|
77d4ea7513 | ||
|
|
3160245145 | ||
|
|
6e19f3554a | ||
|
|
ae6eb8fa7d | ||
|
|
5d28b98a8c | ||
|
|
52acfe4ea2 | ||
|
|
01a4f64a2e | ||
|
|
b47a384621 | ||
|
|
e842768bb1 | ||
|
|
998a24d62f | ||
|
|
64d072d8bb | ||
|
|
6835dd9819 | ||
|
|
5f735b11c9 | ||
|
|
4fad0ae2bc | ||
|
|
45da5db11b | ||
|
|
0b9baf8588 | ||
|
|
cef628f314 | ||
|
|
421c2f69f7 | ||
|
|
69cd3ab5f9 | ||
|
|
b144dbef8c | ||
|
|
eff9942466 | ||
|
|
525a5969bc | ||
|
|
b49366fd31 | ||
|
|
354277ba6e | ||
|
|
658391fe85 | ||
|
|
b574bb3f4c | ||
|
|
7b760c645f | ||
|
|
32445dcf55 | ||
|
|
e45fd1aa12 | ||
|
|
3855b3a710 | ||
|
|
1ca812abbf | ||
|
|
7470911bd7 | ||
|
|
adf72acf63 | ||
|
|
0e9f8f5e7e | ||
|
|
eb05d237af | ||
|
|
fa8b4ecef4 | ||
|
|
707b3efea4 | ||
|
|
5f37fadd24 | ||
|
|
eefbece0e1 | ||
|
|
a54102a660 | ||
|
|
b5de592eee | ||
|
|
20493377af | ||
|
|
f91a16268f | ||
|
|
34b3e77d47 | ||
|
|
557009c11e | ||
|
|
32bf174b5c | ||
|
|
6a6d3d4805 | ||
|
|
91b4974d2c | ||
|
|
e50ddf9cb9 | ||
|
|
fdbf364087 | ||
|
|
0eb3354344 | ||
|
|
a798714f21 | ||
|
|
574830796f | ||
|
|
fb26c4ab60 | ||
|
|
614de27310 | ||
|
|
3b6981918a | ||
|
|
84f531ca34 | ||
|
|
11b397a348 | ||
|
|
9fe8c98a42 | ||
|
|
852ce08bf3 | ||
|
|
a18e4c69ee | ||
|
|
43da706a61 | ||
|
|
81691afb46 | ||
|
|
9258229fdb | ||
|
|
e481a71b5c | ||
|
|
fc092ae0b3 | ||
|
|
6c70f9c777 | ||
|
|
15a8225ec1 | ||
|
|
7bb35c0b38 | ||
|
|
cc8c3ddc95 | ||
|
|
10781a7a8e | ||
|
|
2f26e3a1dc | ||
|
|
531b2fe018 | ||
|
|
2ebfca2f07 | ||
|
|
1746fb452a | ||
|
|
9d85f8a29a | ||
|
|
a66537a2ff | ||
|
|
df9fe07d26 | ||
|
|
5b7b4c73f4 | ||
|
|
c262b7caf6 | ||
|
|
559e919636 | ||
|
|
5c7f9fa5a7 | ||
|
|
9b834871ea | ||
|
|
23c46abd53 | ||
|
|
3029e3c65a | ||
|
|
7e5d6a1f07 | ||
|
|
d84f5adcad | ||
|
|
294bc5d053 | ||
|
|
f67c876c0d | ||
|
|
05c44f66b8 | ||
|
|
ad3f679c5a |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -8,6 +8,7 @@ package-lock.json
|
||||
/.vscode
|
||||
|
||||
# misc
|
||||
.DS_Store
|
||||
lerna-debug.log
|
||||
npm-debug.log
|
||||
yarn-error.log
|
||||
@@ -24,6 +25,6 @@ yarn-error.log
|
||||
|
||||
# tests
|
||||
/test
|
||||
/integration
|
||||
/coverage
|
||||
/.nyc_output
|
||||
build/config\.gypi
|
||||
1
.prettierignore
Normal file
1
.prettierignore
Normal file
@@ -0,0 +1 @@
|
||||
/bundle
|
||||
66
CHANGELOG.md
66
CHANGELOG.md
@@ -1,3 +1,55 @@
|
||||
## 5.0.0-beta.4
|
||||
### Bug Fixes
|
||||
- **core**: param pipes aren't working correctly [#592](https://github.com/nestjs/nest/issues/592)
|
||||
- **microservices**: unnecessary modules required [#594](https://github.com/nestjs/nest/issues/594)
|
||||
|
||||
### Improvements
|
||||
- **all**: upgrade RxJS version (`v6.0.0`)
|
||||
|
||||
## 5.0.0-beta.3
|
||||
### Bug Fixes
|
||||
- **core**: incorrect `ExpressAdapter` method wrappers [#585](https://github.com/nestjs/nest/issues/585)
|
||||
- **core**: the `fastify-formbody` is no longer a required dependency [#575](https://github.com/nestjs/nest/issues/575)
|
||||
- **core**: incorrect `createApplication()` typings (unable to pass express instance directly) [#575](https://github.com/nestjs/nest/issues/575)
|
||||
|
||||
## 5.0.0-beta.0
|
||||
### Features
|
||||
- **core**: support async lifecycle hooks (`OnModuleInit` and `OnModuleDestroy`) [#569](https://github.com/nestjs/nest/issues/569)
|
||||
- **core**: HTTP server independence, [fastify](https://github.com/fastify/fastify) integration (`FastifyAdapter`)
|
||||
- **core**: allow binding global interceptors, filters, pipes, and guards from any module. Example:
|
||||
```typescript
|
||||
{
|
||||
provide: APP_INTERCEPTOR,
|
||||
useClass: LoggerInterceptor,
|
||||
}
|
||||
```
|
||||
- **core**: `@UseGuards()`, `@UsePipes()`, `@UseFilters()`, and `@UseInterceptors()` extend metadata, instead of overriding existing one
|
||||
- **core**: dependency injection everywhere (pipes, filters, interceptors, and guards)
|
||||
- **core**: pass `ArgumentsHost` to exception filters (ability to access each argument)
|
||||
- **core**: pass enhanced `ExecutionContext` to both interceptors and guards (ability to access each argument and execution context)
|
||||
- **microservices**: improve existing transporters (TCP, Redis), provide new strategies: Nats, MQTT, gRPC
|
||||
|
||||
### Bug Fixes
|
||||
- **common**: incorrent `multer` dependency [#532](https://github.com/nestjs/nest/issues/532)
|
||||
- **core**: hanging `NestApplicationContext` process [#503](https://github.com/nestjs/nest/issues/503)
|
||||
- **microservices**: concurrency issues (both TCP and Redis transporters) [#505](https://github.com/nestjs/nest/issues/505)
|
||||
|
||||
### Improvements
|
||||
- **all**: remove `reflect-metadata` peer dependency [#563](https://github.com/nestjs/nest/issues/563)
|
||||
- **all**: upgrade RxJS (make use of pipeable operators)
|
||||
- **core**: more descriptive exceptions (circular dependency) [#493](https://github.com/nestjs/nest/issues/493)
|
||||
- **core**: Nest container compatible with `useContainer()` (`class-validator` and `typeorm` packages) [#528](https://github.com/nestjs/nest/issues/528)
|
||||
- **core**: remove static dependencies (webpack compatibility)
|
||||
- **websockets**: `@WebSocketGateway()` takes options argument that is passed to socket.io instance [#508](https://github.com/nestjs/nest/issues/508)
|
||||
|
||||
### Deprecations
|
||||
- **common**: deprecate `@Component()`, `@Middleware()`, `@Interceptor()`, `@Pipe()`, and `@Guard()` decorators (use `@Injectable()` instead)
|
||||
- **core**: deprecate `modules: []` property (use `imports: []` instead)
|
||||
- **core**: deprecate `components: []` property (use `providers: []` instead)
|
||||
|
||||
### Notes
|
||||
- move from traditional express middleware model: each middleware is solely bounded to a particular path, regardless of the request method
|
||||
|
||||
## 4.6.6
|
||||
### Bug Fixes:
|
||||
- **common**: `File(s)Interceptor` throws http status code 500 [#465](https://github.com/nestjs/nest/issues/437)
|
||||
@@ -130,10 +182,10 @@
|
||||
|
||||
## 4.3.0
|
||||
- **common**: `ValidationPipe` is now available out-of-the-box (`@nestjs/common`)
|
||||
- **core**: `json` and `urlencoded` (`body-parser`) middlewares are applied by default now, bugfix #252
|
||||
- **core**: `json` and `urlencoded` (`body-parser`) middleware are applied by default now, bugfix #252
|
||||
- **core** more informative error message (injector) #223
|
||||
example: `[ExceptionHandler] Nest can't resolve dependencies of the UsersService (+, +, ?, +, +, +). Please verify whether [2] argument is available in the current context.`
|
||||
- **core**: bugfix #240 - middlewares container state
|
||||
- **core**: bugfix #240 - middleware container state
|
||||
- **core**: bugifx #257 - `@Next()` issue
|
||||
- **testing**: testing module is now independent from `@nestjs/microservices`
|
||||
|
||||
@@ -183,7 +235,7 @@ example: `[ExceptionHandler] Nest can't resolve dependencies of the UsersService
|
||||
- `@Shared()` deprecated (modules are singletons by default) [read more](http://www.docs.nestjs.com/modules)
|
||||
- `@SingleScope()` decorator [read more](http://www.docs.nestjs.com/modules)
|
||||
- Modules re-exporting [read more](http://www.docs.nestjs.com/modules)
|
||||
- Deffered & functional middlewares [read more](http://www.docs.nestjs.com/middlewares)
|
||||
- Deffered & functional middleware [read more](http://www.docs.nestjs.com/middleware)
|
||||
- Guards feature [read more](http://www.docs.nestjs.com/guards)
|
||||
- Async components [read more](http://www.docs.nestjs.com/advanced/async-components)
|
||||
- Hierarchical injector improvements [read more](http://www.docs.nestjs.com/advanced/hierarchical-injector)
|
||||
@@ -206,7 +258,7 @@ example: `[ExceptionHandler] Nest can't resolve dependencies of the UsersService
|
||||
## 3.0.1 (24.06.2017)
|
||||
**@nestjs/core**
|
||||
- Hierarchical injector bugfix,
|
||||
- Middlewares `@UseFilters()` bugfix (#95).
|
||||
- Middleware `@UseFilters()` bugfix (#95).
|
||||
|
||||
**@nestjs/microservices**
|
||||
- TCP server / client bugfix (#91)
|
||||
@@ -271,12 +323,12 @@ example: `[ExceptionHandler] Nest can't resolve dependencies of the UsersService
|
||||
|
||||
## 1.0.0 (Final - 01.05.2017)
|
||||
|
||||
- Added **Gateway Middlewares** support:
|
||||
- Added **Gateway Middleware** support:
|
||||
|
||||
```
|
||||
@WebSocketGateway({
|
||||
port: 2000,
|
||||
middlewares: [ChatMiddleware],
|
||||
middleware: [ChatMiddleware],
|
||||
})
|
||||
```
|
||||
Gateway Middleware example:
|
||||
@@ -319,7 +371,7 @@ Session: () => ParameterDecorator
|
||||
Headers: (property?: string) => ParameterDecorator
|
||||
```
|
||||
|
||||
- `MiddlewaresBuilder` -> `MiddlewaresConsumer`
|
||||
- `MiddlewareBuilder` -> `MiddlewareConsumer`
|
||||
- **Exception Filters** support
|
||||
|
||||
```
|
||||
|
||||
28
Readme.md
28
Readme.md
@@ -1,12 +1,12 @@
|
||||
<p align="center">
|
||||
<a href="http://nestjs.com/" target="blank"><img src="http://kamilmysliwiec.com/public/nest-logo.png#1" alt="Nest Logo" /></a>
|
||||
<a href="http://nestjs.com/" target="blank"><img src="https://nestjs.com/img/logo_text.svg" width="320" alt="Nest Logo" /></a>
|
||||
</p>
|
||||
|
||||
[travis-image]: https://api.travis-ci.org/nestjs/nest.svg?branch=master
|
||||
[travis-url]: https://travis-ci.org/nestjs/nest
|
||||
[linux-image]: https://img.shields.io/travis/nestjs/nest/master.svg?label=linux
|
||||
[linux-url]: https://travis-ci.org/nestjs/nest
|
||||
|
||||
|
||||
<p align="center">A progressive <a href="http://nodejs.org" target="blank">Node.js</a> framework for building efficient and scalable server-side applications, heavily inspired by <a href="https://angular.io" target="blank">Angular</a>.</p>
|
||||
<p align="center">
|
||||
<a href="https://www.npmjs.com/~nestjscore"><img src="https://img.shields.io/npm/v/@nestjs/core.svg" alt="NPM Version" /></a>
|
||||
@@ -14,10 +14,12 @@
|
||||
<a href="https://www.npmjs.com/~nestjscore"><img src="https://img.shields.io/npm/dm/@nestjs/core.svg" alt="NPM Downloads" /></a>
|
||||
<a href="https://travis-ci.org/nestjs/nest"><img src="https://api.travis-ci.org/nestjs/nest.svg?branch=master" alt="Travis" /></a>
|
||||
<a href="https://travis-ci.org/nestjs/nest"><img src="https://img.shields.io/travis/nestjs/nest/master.svg?label=linux" alt="Linux" /></a>
|
||||
<a href="https://coveralls.io/github/nestjs/nest?branch=master"><img src="https://coveralls.io/repos/github/nestjs/nest/badge.svg?branch=master#5" alt="Coverage" /></a>
|
||||
<a href="https://coveralls.io/github/nestjs/nest?branch=master"><img src="https://coveralls.io/repos/github/nestjs/nest/badge.svg?branch=master#6" alt="Coverage" /></a>
|
||||
<a href="https://gitter.im/nestjs/nestjs?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=body_badge"><img src="https://badges.gitter.im/nestjs/nestjs.svg" alt="Gitter" /></a>
|
||||
<a href="https://opencollective.com/nest#backer"><img src="https://opencollective.com/nest/backers/badge.svg" alt="Backers on Open Collective" /></a>
|
||||
<a href="https://opencollective.com/nest#sponsor"><img src="https://opencollective.com/nest/sponsors/badge.svg" alt="Sponsors on Open Collective" /></a>
|
||||
<a href="https://paypal.me/kamilmysliwiec"><img src="https://img.shields.io/badge/Donate-PayPal-ff3f59.svg"/></a>
|
||||
<a href="https://twitter.com/nestframework"><img src="https://img.shields.io/twitter/follow/nestframework.svg?style=social&label=Follow"></a>
|
||||
</p>
|
||||
<!--[](https://opencollective.com/nest#backer)
|
||||
[](https://opencollective.com/nest#sponsor)-->
|
||||
@@ -25,7 +27,8 @@
|
||||
## Description
|
||||
|
||||
<p>Nest is a framework for building efficient, scalable <a href="http://nodejs.org" target="_blank">Node.js</a> server-side applications. It uses modern JavaScript, is built with <a href="http://www.typescriptlang.org" target="_blank">TypeScript</a> (preserves compatibility with pure JavaScript) and combines elements of OOP (Object Oriented Programming), FP (Functional Programming), and FRP (Functional Reactive Programming).</p>
|
||||
<p>Under the hood, Nest makes use of <a href="https://expressjs.com/" target="_blank">Express</a>, allowing for easy use of the myriad third-party plugins which are available.</p>
|
||||
|
||||
<p>Under the hood, Nest makes use of <a href="https://expressjs.com/" target="_blank">Express</a>, but also, provides compatibility with a wide range of other libraries, like e.g. <a href="https://github.com/fastify/fastify" target="blank">Fastify</a>, allowing for easy use of the myriad third-party plugins which are available.</p>
|
||||
|
||||
## Philosophy
|
||||
|
||||
@@ -38,16 +41,17 @@ To check out the [guide](https://docs.nestjs.com), visit [docs.nestjs.com](https
|
||||
|
||||
## Support
|
||||
|
||||
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://opencollective.com/nest).
|
||||
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support).
|
||||
|
||||
#### Principal Sponsor
|
||||
|
||||
<a href="https://valor-software.com/"><img src="https://docs.nestjs.com/assets/sponsors/valor-software.png" width="210" /></a>
|
||||
<a href="https://valor-software.com/"><img src="https://docs.nestjs.com/assets/sponsors/valor-software.png" width="300" /></a>
|
||||
|
||||
#### Sponsors
|
||||
<a href="https://scal.io"><img src="https://nestjs.com/img/scalio-logo.svg" width="160" /></a> <a href="https://www.swingdev.io"><img src="https://nestjs.com/img/swingdev-logo.svg#1" width="160" /></a>
|
||||
|
||||
## Backers
|
||||
<a href="https://scal.io"><img src="https://nestjs.com/img/scalio-logo.svg" width="150" /></a> <a href="https://www.swingdev.io"><img src="https://nestjs.com/img/swingdev-logo.svg#1" width="150" /></a>
|
||||
|
||||
## Backers
|
||||
|
||||
<a href="https://opencollective.com/nest/backer/0/website" target="_blank"><img src="https://opencollective.com/nest/backer/0/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/1/website" target="_blank"><img src="https://opencollective.com/nest/backer/1/avatar.svg"></a>
|
||||
@@ -96,12 +100,12 @@ Nest is an MIT-licensed open source project. It can grow thanks to the sponsors
|
||||
|
||||
## Stay in touch
|
||||
|
||||
- Author - [Kamil Myśliwiec](https://kamilmysliwiec.com)
|
||||
- Website - [https://nestjs.com](https://nestjs.com/)
|
||||
- Twitter - [@nestframework](https://twitter.com/nestframework)
|
||||
* Author - [Kamil Myśliwiec](https://kamilmysliwiec.com)
|
||||
* Website - [https://nestjs.com](https://nestjs.com/)
|
||||
* Twitter - [@nestframework](https://twitter.com/nestframework)
|
||||
|
||||
## License
|
||||
|
||||
Nest is [MIT licensed](LICENSE).
|
||||
Nest is [MIT licensed](LICENSE).
|
||||
|
||||
<h4 align="center"> <a href="readme_zh.md">中文说明</a></h4>
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<p align="center">
|
||||
<a href="http://nestjs.com/" target="blank"><img src="http://kamilmysliwiec.com/public/nest-logo.png#1" alt="Nest Logo" /></a>
|
||||
<a href="http://nestjs.com/" target="blank"><img src="https://nestjs.com/img/logo_text.svg" width="320" alt="Nest Logo" /></a>
|
||||
</p>
|
||||
|
||||
[travis-image]: https://api.travis-ci.org/nestjs/nest.svg?branch=master
|
||||
[travis-url]: https://travis-ci.org/nestjs/nest
|
||||
[linux-image]: https://img.shields.io/travis/nestjs/nest/master.svg?label=linux
|
||||
[linux-url]: https://travis-ci.org/nestjs/nest
|
||||
|
||||
|
||||
<p align="center">A progressive <a href="http://nodejs.org" target="blank">Node.js</a> framework for building efficient and scalable server-side applications, heavily inspired by <a href="https://angular.io" target="blank">Angular</a>.</p>
|
||||
<p align="center">
|
||||
<a href="https://www.npmjs.com/~nestjscore"><img src="https://img.shields.io/npm/v/@nestjs/core.svg" alt="NPM Version" /></a>
|
||||
@@ -18,6 +18,8 @@
|
||||
<a href="https://gitter.im/nestjs/nestjs?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=body_badge"><img src="https://badges.gitter.im/nestjs/nestjs.svg" alt="Gitter" /></a>
|
||||
<a href="https://opencollective.com/nest#backer"><img src="https://opencollective.com/nest/backers/badge.svg" alt="Backers on Open Collective" /></a>
|
||||
<a href="https://opencollective.com/nest#sponsor"><img src="https://opencollective.com/nest/sponsors/badge.svg" alt="Sponsors on Open Collective" /></a>
|
||||
<a href="https://paypal.me/kamilmysliwiec"><img src="https://img.shields.io/badge/Donate-PayPal-ff3f59.svg"/></a>
|
||||
<a href="https://twitter.com/nestframework"><img src="https://img.shields.io/twitter/follow/nestframework.svg?style=social&label=Follow"></a>
|
||||
</p>
|
||||
<!--[](https://opencollective.com/nest#backer)
|
||||
[](https://opencollective.com/nest#sponsor)-->
|
||||
@@ -25,7 +27,8 @@
|
||||
## Description
|
||||
|
||||
<p>Nest is a framework for building efficient, scalable <a href="http://nodejs.org" target="_blank">Node.js</a> server-side applications. It uses modern JavaScript, is built with <a href="http://www.typescriptlang.org" target="_blank">TypeScript</a> (preserves compatibility with pure JavaScript) and combines elements of OOP (Object Oriented Programming), FP (Functional Programming), and FRP (Functional Reactive Programming).</p>
|
||||
<p>Under the hood, Nest makes use of <a href="https://expressjs.com/" target="_blank">Express</a>, allowing for easy use of the myriad third-party plugins which are available.</p>
|
||||
|
||||
<p>Under the hood, Nest makes use of <a href="https://expressjs.com/" target="_blank">Express</a>, but also, provides compatibility with a wide range of other libraries, like e.g. <a href="https://github.com/fastify/fastify" target="blank">Fastify</a>, allowing for easy use of the myriad third-party plugins which are available.</p>
|
||||
|
||||
## Philosophy
|
||||
|
||||
@@ -38,16 +41,17 @@ To check out the [guide](https://docs.nestjs.com), visit [docs.nestjs.com](https
|
||||
|
||||
## Support
|
||||
|
||||
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://opencollective.com/nest).
|
||||
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support).
|
||||
|
||||
#### Principal Sponsor
|
||||
|
||||
<a href="https://valor-software.com/"><img src="https://docs.nestjs.com/assets/sponsors/valor-software.png" width="210" /></a>
|
||||
<a href="https://valor-software.com/"><img src="https://docs.nestjs.com/assets/sponsors/valor-software.png" width="300" /></a>
|
||||
|
||||
#### Sponsors
|
||||
<a href="https://scal.io"><img src="https://nestjs.com/img/scalio-logo.svg" width="160" /></a> <a href="https://www.swingdev.io"><img src="https://nestjs.com/img/swingdev-logo.svg#1" width="160" /></a>
|
||||
|
||||
## Backers
|
||||
<a href="https://scal.io"><img src="https://nestjs.com/img/scalio-logo.svg" width="150" /></a> <a href="https://www.swingdev.io"><img src="https://nestjs.com/img/swingdev-logo.svg#1" width="150" /></a>
|
||||
|
||||
## Backers
|
||||
|
||||
<a href="https://opencollective.com/nest/backer/0/website" target="_blank"><img src="https://opencollective.com/nest/backer/0/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/1/website" target="_blank"><img src="https://opencollective.com/nest/backer/1/avatar.svg"></a>
|
||||
@@ -96,12 +100,12 @@ Nest is an MIT-licensed open source project. It can grow thanks to the sponsors
|
||||
|
||||
## Stay in touch
|
||||
|
||||
- Author - [Kamil Myśliwiec](https://kamilmysliwiec.com)
|
||||
- Website - [https://nestjs.com](https://nestjs.com/)
|
||||
- Twitter - [@nestframework](https://twitter.com/nestframework)
|
||||
* Author - [Kamil Myśliwiec](https://kamilmysliwiec.com)
|
||||
* Website - [https://nestjs.com](https://nestjs.com/)
|
||||
* Twitter - [@nestframework](https://twitter.com/nestframework)
|
||||
|
||||
## License
|
||||
|
||||
Nest is [MIT licensed](LICENSE).
|
||||
Nest is [MIT licensed](LICENSE).
|
||||
|
||||
<h4 align="center"> <a href="readme_zh.md">中文说明</a></h4>
|
||||
27
bundle/common/constants.d.ts
vendored
Normal file
27
bundle/common/constants.d.ts
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
export declare const metadata: {
|
||||
MODULES: string;
|
||||
IMPORTS: string;
|
||||
COMPONENTS: string;
|
||||
PROVIDERS: string;
|
||||
CONTROLLERS: string;
|
||||
EXPORTS: string;
|
||||
};
|
||||
export declare const SHARED_MODULE_METADATA = "__sharedModule__";
|
||||
export declare const GLOBAL_MODULE_METADATA = "__globalModule__";
|
||||
export declare const PATH_METADATA = "path";
|
||||
export declare const PARAMTYPES_METADATA = "design:paramtypes";
|
||||
export declare const SELF_DECLARED_DEPS_METADATA = "self:paramtypes";
|
||||
export declare const METHOD_METADATA = "method";
|
||||
export declare const ROUTE_ARGS_METADATA = "__routeArguments__";
|
||||
export declare const CUSTOM_ROUTE_AGRS_METADATA = "__customRouteArgs__";
|
||||
export declare const EXCEPTION_FILTERS_METADATA = "__exceptionFilters__";
|
||||
export declare const FILTER_CATCH_EXCEPTIONS = "__filterCatchExceptions__";
|
||||
export declare const PIPES_METADATA = "__pipes__";
|
||||
export declare const GUARDS_METADATA = "__guards__";
|
||||
export declare const RENDER_METADATA = "__renderTemplate__";
|
||||
export declare const INTERCEPTORS_METADATA = "__interceptors__";
|
||||
export declare const HTTP_CODE_METADATA = "__httpCode__";
|
||||
export declare const GATEWAY_MIDDLEWARES = "__gatewayMiddleware";
|
||||
export declare const MODULE_PATH = "__module_path__";
|
||||
export declare const HEADERS_METADATA = "__headers__";
|
||||
export declare const REDIRECT_METADATA = "__redirect__";
|
||||
@@ -4,6 +4,7 @@ exports.metadata = {
|
||||
MODULES: 'modules',
|
||||
IMPORTS: 'imports',
|
||||
COMPONENTS: 'components',
|
||||
PROVIDERS: 'providers',
|
||||
CONTROLLERS: 'controllers',
|
||||
EXPORTS: 'exports',
|
||||
};
|
||||
@@ -22,5 +23,7 @@ exports.GUARDS_METADATA = '__guards__';
|
||||
exports.RENDER_METADATA = '__renderTemplate__';
|
||||
exports.INTERCEPTORS_METADATA = '__interceptors__';
|
||||
exports.HTTP_CODE_METADATA = '__httpCode__';
|
||||
exports.GATEWAY_MIDDLEWARES = '__gatewayMiddlewares';
|
||||
exports.GATEWAY_MIDDLEWARES = '__gatewayMiddleware';
|
||||
exports.MODULE_PATH = '__module_path__';
|
||||
exports.HEADERS_METADATA = '__headers__';
|
||||
exports.REDIRECT_METADATA = '__redirect__';
|
||||
6
bundle/common/decorators/core/bind.decorator.d.ts
vendored
Normal file
6
bundle/common/decorators/core/bind.decorator.d.ts
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* Binds parameters decorators to the particular method
|
||||
* Useful when the language doesn't provide a 'Parameter Decorators' feature (vanilla JavaScript)
|
||||
* @param {} ...decorators
|
||||
*/
|
||||
export declare function Bind(...decorators: any[]): (target: object, key: any, descriptor: any) => any;
|
||||
@@ -1,8 +1,8 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
/**
|
||||
* Binds parameters decorators to the method
|
||||
* Useful when the language doesn't provide a 'Parameter Decorators' feature
|
||||
* Binds parameters decorators to the particular method
|
||||
* Useful when the language doesn't provide a 'Parameter Decorators' feature (vanilla JavaScript)
|
||||
* @param {} ...decorators
|
||||
*/
|
||||
function Bind(...decorators) {
|
||||
@@ -1,6 +1,6 @@
|
||||
import 'reflect-metadata';
|
||||
/**
|
||||
* Defines the Exceptions Filter. Takes set of exception types as an argument, which has to be catched by this Filter.
|
||||
* The class should implements the `ExceptionFilter` interface.
|
||||
* Defines the Exceptions Filter. Takes set of exception types as an argument which has to be caught by this Filter.
|
||||
* The class should implement the `ExceptionFilter` interface.
|
||||
*/
|
||||
export declare function Catch(...exceptions: any[]): ClassDecorator;
|
||||
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||
require("reflect-metadata");
|
||||
const constants_1 = require("../../constants");
|
||||
/**
|
||||
* Defines the Exceptions Filter. Takes set of exception types as an argument, which has to be catched by this Filter.
|
||||
* The class should implements the `ExceptionFilter` interface.
|
||||
* Defines the Exceptions Filter. Takes set of exception types as an argument which has to be caught by this Filter.
|
||||
* The class should implement the `ExceptionFilter` interface.
|
||||
*/
|
||||
function Catch(...exceptions) {
|
||||
return (target) => {
|
||||
@@ -1,21 +1,31 @@
|
||||
/**
|
||||
* Defines the injectable class. This class can inject dependencies through constructor.
|
||||
* Those dependencies have to belong to the same module.
|
||||
*/
|
||||
export declare function Injectable(): ClassDecorator;
|
||||
/**
|
||||
* @deprecated
|
||||
* Defines the Component. The component can inject dependencies through constructor.
|
||||
* Those dependencies should belongs to the same module.
|
||||
* Those dependencies have to belong to the same module.
|
||||
*/
|
||||
export declare function Component(): ClassDecorator;
|
||||
/**
|
||||
* Defines the Pipe. The Pipe should implements the `PipeTransform` interface.
|
||||
* @deprecated
|
||||
* Defines the Pipe. The Pipe should implement the `PipeTransform` interface.
|
||||
*/
|
||||
export declare function Pipe(): ClassDecorator;
|
||||
/**
|
||||
* @deprecated
|
||||
* Defines the Guard. The Guard should implement the `CanActivate` interface.
|
||||
*/
|
||||
export declare function Guard(): ClassDecorator;
|
||||
/**
|
||||
* @deprecated
|
||||
* Defines the Middleware. The Middleware should implement the `NestMiddleware` interface.
|
||||
*/
|
||||
export declare function Middleware(): ClassDecorator;
|
||||
/**
|
||||
* @deprecated
|
||||
* Defines the Interceptor. The Interceptor should implement `HttpInterceptor`, `RpcInterceptor` or `WsInterceptor` interface.
|
||||
*/
|
||||
export declare function Interceptor(): ClassDecorator;
|
||||
66
bundle/common/decorators/core/component.decorator.js
Normal file
66
bundle/common/decorators/core/component.decorator.js
Normal file
@@ -0,0 +1,66 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const deprecate = require("deprecate");
|
||||
/**
|
||||
* Defines the injectable class. This class can inject dependencies through constructor.
|
||||
* Those dependencies have to belong to the same module.
|
||||
*/
|
||||
function Injectable() {
|
||||
return (target) => { };
|
||||
}
|
||||
exports.Injectable = Injectable;
|
||||
/**
|
||||
* @deprecated
|
||||
* Defines the Component. The component can inject dependencies through constructor.
|
||||
* Those dependencies have to belong to the same module.
|
||||
*/
|
||||
function Component() {
|
||||
deprecate('The @Component() decorator is deprecated and will be removed within next major release. Use @Injectable() instead.');
|
||||
return (target) => { };
|
||||
}
|
||||
exports.Component = Component;
|
||||
/**
|
||||
* @deprecated
|
||||
* Defines the Pipe. The Pipe should implement the `PipeTransform` interface.
|
||||
*/
|
||||
function Pipe() {
|
||||
deprecate('The @Pipe() decorator is deprecated and will be removed within next major release. Use @Injectable() instead.');
|
||||
return (target) => { };
|
||||
}
|
||||
exports.Pipe = Pipe;
|
||||
/**
|
||||
* @deprecated
|
||||
* Defines the Guard. The Guard should implement the `CanActivate` interface.
|
||||
*/
|
||||
function Guard() {
|
||||
deprecate('The @Guard() decorator is deprecated and will be removed within next major release. Use @Injectable() instead.');
|
||||
return (target) => { };
|
||||
}
|
||||
exports.Guard = Guard;
|
||||
/**
|
||||
* @deprecated
|
||||
* Defines the Middleware. The Middleware should implement the `NestMiddleware` interface.
|
||||
*/
|
||||
function Middleware() {
|
||||
deprecate('The @Middleware() decorator is deprecated and will be removed within next major release. Use @Injectable() instead.');
|
||||
return (target) => { };
|
||||
}
|
||||
exports.Middleware = Middleware;
|
||||
/**
|
||||
* @deprecated
|
||||
* Defines the Interceptor. The Interceptor should implement `HttpInterceptor`, `RpcInterceptor` or `WsInterceptor` interface.
|
||||
*/
|
||||
function Interceptor() {
|
||||
deprecate('The @Interceptor() decorator is deprecated and will be removed within next major release. Use @Injectable() instead.');
|
||||
return (target) => { };
|
||||
}
|
||||
exports.Interceptor = Interceptor;
|
||||
function mixin(mixinClass) {
|
||||
this.offset = this.offset ? ++this.offset : Math.random() * 100;
|
||||
Object.defineProperty(mixinClass, 'name', {
|
||||
value: JSON.stringify(this.offset),
|
||||
});
|
||||
Injectable()(mixinClass);
|
||||
return mixinClass;
|
||||
}
|
||||
exports.mixin = mixin;
|
||||
@@ -1,6 +1,6 @@
|
||||
import 'reflect-metadata';
|
||||
/**
|
||||
* Defines the Controller. The controller can inject dependencies through constructor.
|
||||
* Those dependencies should belongs to the same module.
|
||||
* Those dependencies have to belong to the same module.
|
||||
*/
|
||||
export declare function Controller(prefix?: string): ClassDecorator;
|
||||
@@ -5,7 +5,7 @@ const shared_utils_1 = require("../../utils/shared.utils");
|
||||
const constants_1 = require("../../constants");
|
||||
/**
|
||||
* Defines the Controller. The controller can inject dependencies through constructor.
|
||||
* Those dependencies should belongs to the same module.
|
||||
* Those dependencies have to belong to the same module.
|
||||
*/
|
||||
function Controller(prefix) {
|
||||
const path = shared_utils_1.isUndefined(prefix) ? '/' : prefix;
|
||||
@@ -1,2 +1,3 @@
|
||||
import 'reflect-metadata';
|
||||
export declare function flatten(arr: any[]): any;
|
||||
export declare const Dependencies: (...dependencies: any[]) => ClassDecorator;
|
||||
@@ -2,10 +2,11 @@
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
require("reflect-metadata");
|
||||
const constants_1 = require("../../constants");
|
||||
const flatten = arr => {
|
||||
function flatten(arr) {
|
||||
const flat = [].concat(...arr);
|
||||
return flat.some(Array.isArray) ? flatten(flat) : flat;
|
||||
};
|
||||
}
|
||||
exports.flatten = flatten;
|
||||
exports.Dependencies = (...dependencies) => {
|
||||
const flattenDeps = flatten(dependencies);
|
||||
return (target) => {
|
||||
@@ -8,8 +8,6 @@ import { ExceptionFilter } from '../../index';
|
||||
* When the `@UseFilters()` is used on the handle level:
|
||||
* - Exception Filter will be set up only to specified method
|
||||
*
|
||||
* @param {ExceptionFilter[]} ...filters (instances)
|
||||
* @param {ExceptionFilter[]} ...filters
|
||||
*/
|
||||
export declare const UseFilters: (
|
||||
...filters: ExceptionFilter[]
|
||||
) => (target: object, key?: any, descriptor?: any) => any;
|
||||
export declare const UseFilters: (...filters: (Function | ExceptionFilter<any>)[]) => (target: any, key?: any, descriptor?: any) => any;
|
||||
31
bundle/common/decorators/core/exception-filters.decorator.js
Normal file
31
bundle/common/decorators/core/exception-filters.decorator.js
Normal file
@@ -0,0 +1,31 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
require("reflect-metadata");
|
||||
const constants_1 = require("../../constants");
|
||||
const extend_metadata_util_1 = require("../../utils/extend-metadata.util");
|
||||
const shared_utils_1 = require("../../utils/shared.utils");
|
||||
const validate_each_util_1 = require("../../utils/validate-each.util");
|
||||
const defineFiltersMetadata = (...filters) => {
|
||||
return (target, key, descriptor) => {
|
||||
const isFilterValid = filter => filter && (shared_utils_1.isFunction(filter) || shared_utils_1.isFunction(filter.catch));
|
||||
if (descriptor) {
|
||||
validate_each_util_1.validateEach(target.constructor, filters, isFilterValid, '@UseFilters', 'filter');
|
||||
extend_metadata_util_1.extendArrayMetadata(constants_1.EXCEPTION_FILTERS_METADATA, filters, descriptor.value);
|
||||
return descriptor;
|
||||
}
|
||||
validate_each_util_1.validateEach(target, filters, isFilterValid, '@UseFilters', 'filter');
|
||||
extend_metadata_util_1.extendArrayMetadata(constants_1.EXCEPTION_FILTERS_METADATA, filters, target);
|
||||
return target;
|
||||
};
|
||||
};
|
||||
/**
|
||||
* Setups exception filters to the chosen context.
|
||||
* When the `@UseFilters()` is used on the controller level:
|
||||
* - Exception Filter will be set up to every handler (every method)
|
||||
*
|
||||
* When the `@UseFilters()` is used on the handle level:
|
||||
* - Exception Filter will be set up only to specified method
|
||||
*
|
||||
* @param {ExceptionFilter[]} ...filters
|
||||
*/
|
||||
exports.UseFilters = (...filters) => defineFiltersMetadata(...filters);
|
||||
6
bundle/common/decorators/core/inject.decorator.d.ts
vendored
Normal file
6
bundle/common/decorators/core/inject.decorator.d.ts
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import 'reflect-metadata';
|
||||
/**
|
||||
* Injects provider which has to be available in the current injector (module) scope.
|
||||
* Providers are recognized by types or tokens.
|
||||
*/
|
||||
export declare function Inject(token: any): ParameterDecorator;
|
||||
@@ -4,8 +4,8 @@ require("reflect-metadata");
|
||||
const constants_1 = require("../../constants");
|
||||
const shared_utils_1 = require("../../utils/shared.utils");
|
||||
/**
|
||||
* Injects component, which has to be available in the current injector (module) scope.
|
||||
* Components are recognized by types / or tokens.
|
||||
* Injects provider which has to be available in the current injector (module) scope.
|
||||
* Providers are recognized by types or tokens.
|
||||
*/
|
||||
function Inject(token) {
|
||||
return (target, key, index) => {
|
||||
5
bundle/common/decorators/core/reflect-metadata.decorator.d.ts
vendored
Normal file
5
bundle/common/decorators/core/reflect-metadata.decorator.d.ts
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
/**
|
||||
* Assigns the metadata to the class / function under specified `key`.
|
||||
* This metadata can be reflected using `Reflector` class.
|
||||
*/
|
||||
export declare const ReflectMetadata: (metadataKey: any, metadataValue: any) => (target: object, key?: any, descriptor?: any) => any;
|
||||
12
bundle/common/decorators/core/use-guards.decorator.d.ts
vendored
Normal file
12
bundle/common/decorators/core/use-guards.decorator.d.ts
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
import { CanActivate } from '../../interfaces';
|
||||
/**
|
||||
* Binds guards to the particular context.
|
||||
* When the `@UseGuards()` is used on the controller level:
|
||||
* - Guard will be register to each handler (every method)
|
||||
*
|
||||
* When the `@UseGuards()` is used on the handler level:
|
||||
* - Guard will be registered only to specified method
|
||||
*
|
||||
* @param {} ...guards
|
||||
*/
|
||||
export declare function UseGuards(...guards: (CanActivate | Function)[]): (target: any, key?: any, descriptor?: any) => any;
|
||||
30
bundle/common/decorators/core/use-guards.decorator.js
Normal file
30
bundle/common/decorators/core/use-guards.decorator.js
Normal file
@@ -0,0 +1,30 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const constants_1 = require("../../constants");
|
||||
const extend_metadata_util_1 = require("../../utils/extend-metadata.util");
|
||||
const validate_each_util_1 = require("../../utils/validate-each.util");
|
||||
const shared_utils_1 = require("../../utils/shared.utils");
|
||||
/**
|
||||
* Binds guards to the particular context.
|
||||
* When the `@UseGuards()` is used on the controller level:
|
||||
* - Guard will be register to each handler (every method)
|
||||
*
|
||||
* When the `@UseGuards()` is used on the handler level:
|
||||
* - Guard will be registered only to specified method
|
||||
*
|
||||
* @param {} ...guards
|
||||
*/
|
||||
function UseGuards(...guards) {
|
||||
return (target, key, descriptor) => {
|
||||
const isValidGuard = guard => guard && (shared_utils_1.isFunction(guard) || shared_utils_1.isFunction(guard.canActivate));
|
||||
if (descriptor) {
|
||||
validate_each_util_1.validateEach(target.constructor, guards, isValidGuard, '@UseGuards', 'guard');
|
||||
extend_metadata_util_1.extendArrayMetadata(constants_1.GUARDS_METADATA, guards, descriptor.value);
|
||||
return descriptor;
|
||||
}
|
||||
validate_each_util_1.validateEach(target, guards, isValidGuard, '@UseGuards', 'guard');
|
||||
extend_metadata_util_1.extendArrayMetadata(constants_1.GUARDS_METADATA, guards, target);
|
||||
return target;
|
||||
};
|
||||
}
|
||||
exports.UseGuards = UseGuards;
|
||||
12
bundle/common/decorators/core/use-interceptors.decorator.d.ts
vendored
Normal file
12
bundle/common/decorators/core/use-interceptors.decorator.d.ts
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
import { NestInterceptor } from '../../interfaces';
|
||||
/**
|
||||
* Binds interceptors to the particular context.
|
||||
* When the `@UseInterceptors()` is used on the controller level:
|
||||
* - Interceptor will be register to each handler (every method)
|
||||
*
|
||||
* When the `@UseInterceptors()` is used on the handle level:
|
||||
* - Interceptor will be registered only to specified method
|
||||
*
|
||||
* @param {} ...interceptors
|
||||
*/
|
||||
export declare function UseInterceptors(...interceptors: (NestInterceptor | Function)[]): (target: any, key?: any, descriptor?: any) => any;
|
||||
31
bundle/common/decorators/core/use-interceptors.decorator.js
Normal file
31
bundle/common/decorators/core/use-interceptors.decorator.js
Normal file
@@ -0,0 +1,31 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const constants_1 = require("../../constants");
|
||||
const extend_metadata_util_1 = require("../../utils/extend-metadata.util");
|
||||
const shared_utils_1 = require("../../utils/shared.utils");
|
||||
const validate_each_util_1 = require("../../utils/validate-each.util");
|
||||
/**
|
||||
* Binds interceptors to the particular context.
|
||||
* When the `@UseInterceptors()` is used on the controller level:
|
||||
* - Interceptor will be register to each handler (every method)
|
||||
*
|
||||
* When the `@UseInterceptors()` is used on the handle level:
|
||||
* - Interceptor will be registered only to specified method
|
||||
*
|
||||
* @param {} ...interceptors
|
||||
*/
|
||||
function UseInterceptors(...interceptors) {
|
||||
return (target, key, descriptor) => {
|
||||
const isValidInterceptor = interceptor => interceptor &&
|
||||
(shared_utils_1.isFunction(interceptor) || shared_utils_1.isFunction(interceptor.intercept));
|
||||
if (descriptor) {
|
||||
validate_each_util_1.validateEach(target.constructor, interceptors, isValidInterceptor, '@UseInterceptors', 'interceptor');
|
||||
extend_metadata_util_1.extendArrayMetadata(constants_1.INTERCEPTORS_METADATA, interceptors, descriptor.value);
|
||||
return descriptor;
|
||||
}
|
||||
validate_each_util_1.validateEach(target, interceptors, isValidInterceptor, '@UseInterceptors', 'interceptor');
|
||||
extend_metadata_util_1.extendArrayMetadata(constants_1.INTERCEPTORS_METADATA, interceptors, target);
|
||||
return target;
|
||||
};
|
||||
}
|
||||
exports.UseInterceptors = UseInterceptors;
|
||||
12
bundle/common/decorators/core/use-pipes.decorator.d.ts
vendored
Normal file
12
bundle/common/decorators/core/use-pipes.decorator.d.ts
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
import { PipeTransform } from '../../interfaces/index';
|
||||
/**
|
||||
* Binds pipes to the particular context.
|
||||
* When the `@UsePipes()` is used on the controller level:
|
||||
* - Pipe will be register to each handler (every method)
|
||||
*
|
||||
* When the `@UsePipes()` is used on the handle level:
|
||||
* - Pipe will be registered only to specified method
|
||||
*
|
||||
* @param {PipeTransform[]} ...pipes
|
||||
*/
|
||||
export declare function UsePipes(...pipes: (PipeTransform | Function)[]): (target: any, key?: any, descriptor?: any) => any;
|
||||
29
bundle/common/decorators/core/use-pipes.decorator.js
Normal file
29
bundle/common/decorators/core/use-pipes.decorator.js
Normal file
@@ -0,0 +1,29 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const constants_1 = require("../../constants");
|
||||
const extend_metadata_util_1 = require("../../utils/extend-metadata.util");
|
||||
const validate_each_util_1 = require("../../utils/validate-each.util");
|
||||
const shared_utils_1 = require("../../utils/shared.utils");
|
||||
/**
|
||||
* Binds pipes to the particular context.
|
||||
* When the `@UsePipes()` is used on the controller level:
|
||||
* - Pipe will be register to each handler (every method)
|
||||
*
|
||||
* When the `@UsePipes()` is used on the handle level:
|
||||
* - Pipe will be registered only to specified method
|
||||
*
|
||||
* @param {PipeTransform[]} ...pipes
|
||||
*/
|
||||
function UsePipes(...pipes) {
|
||||
return (target, key, descriptor) => {
|
||||
const isPipeValid = pipe => pipe && (shared_utils_1.isFunction(pipe) || shared_utils_1.isFunction(pipe.transform));
|
||||
if (descriptor) {
|
||||
extend_metadata_util_1.extendArrayMetadata(constants_1.PIPES_METADATA, pipes, descriptor.value);
|
||||
return descriptor;
|
||||
}
|
||||
validate_each_util_1.validateEach(target, pipes, isPipeValid, '@UsePipes', 'pipe');
|
||||
extend_metadata_util_1.extendArrayMetadata(constants_1.PIPES_METADATA, pipes, target);
|
||||
return target;
|
||||
};
|
||||
}
|
||||
exports.UsePipes = UsePipes;
|
||||
13
bundle/common/decorators/http/create-route-param-metadata.decorator.d.ts
vendored
Normal file
13
bundle/common/decorators/http/create-route-param-metadata.decorator.d.ts
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
import { CustomParamFactory } from '../../interfaces/features/custom-route-param-factory.interface';
|
||||
import { PipeTransform } from '../../index';
|
||||
/**
|
||||
* Creates HTTP route param decorator
|
||||
* @param factory
|
||||
*/
|
||||
export declare function createParamDecorator(factory: CustomParamFactory): (data?: any, ...pipes: PipeTransform<any>[]) => ParameterDecorator;
|
||||
/**
|
||||
* Creates HTTP route param decorator
|
||||
* @deprecated
|
||||
* @param factory
|
||||
*/
|
||||
export declare function createRouteParamDecorator(factory: CustomParamFactory): (data?: any, ...pipes: PipeTransform<any>[]) => ParameterDecorator;
|
||||
@@ -1,5 +1,6 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const deprecate = require("deprecate");
|
||||
const constants_1 = require("../../constants");
|
||||
const assignCustomMetadata = (args, paramtype, index, factory, data, ...pipes) => (Object.assign({}, args, { [`${paramtype}${constants_1.CUSTOM_ROUTE_AGRS_METADATA}:${index}`]: {
|
||||
index,
|
||||
@@ -11,14 +12,24 @@ const randomString = () => Math.random()
|
||||
.toString(36)
|
||||
.substring(2, 15);
|
||||
/**
|
||||
* Create route params custom decorator
|
||||
* Creates HTTP route param decorator
|
||||
* @param factory
|
||||
*/
|
||||
function createParamDecorator(factory) {
|
||||
const paramtype = randomString() + randomString();
|
||||
return (data, ...pipes) => (target, key, index) => {
|
||||
const args = Reflect.getMetadata(constants_1.ROUTE_ARGS_METADATA, target.constructor, key) || {};
|
||||
Reflect.defineMetadata(constants_1.ROUTE_ARGS_METADATA, assignCustomMetadata(args, paramtype, index, factory, data, ...pipes), target.constructor, key);
|
||||
};
|
||||
}
|
||||
exports.createParamDecorator = createParamDecorator;
|
||||
/**
|
||||
* Creates HTTP route param decorator
|
||||
* @deprecated
|
||||
* @param factory
|
||||
*/
|
||||
function createRouteParamDecorator(factory) {
|
||||
const paramtype = randomString() + randomString();
|
||||
return (data, ...pipes) => (target, key, index) => {
|
||||
const args = Reflect.getMetadata(constants_1.ROUTE_ARGS_METADATA, target, key) || {};
|
||||
Reflect.defineMetadata(constants_1.ROUTE_ARGS_METADATA, assignCustomMetadata(args, paramtype, index, factory, data, ...pipes), target, key);
|
||||
};
|
||||
deprecate('The "createRouteParamDecorator" function is deprecated and will be removed within next major release. Use "createParamDecorator" instead.');
|
||||
return createParamDecorator(factory);
|
||||
}
|
||||
exports.createRouteParamDecorator = createRouteParamDecorator;
|
||||
5
bundle/common/decorators/http/header.decorator.d.ts
vendored
Normal file
5
bundle/common/decorators/http/header.decorator.d.ts
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import 'reflect-metadata';
|
||||
/**
|
||||
* Sets a response header.
|
||||
*/
|
||||
export declare function Header(name: string, value: string): MethodDecorator;
|
||||
15
bundle/common/decorators/http/header.decorator.js
Normal file
15
bundle/common/decorators/http/header.decorator.js
Normal file
@@ -0,0 +1,15 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
require("reflect-metadata");
|
||||
const constants_1 = require("../../constants");
|
||||
const extend_metadata_util_1 = require("../../utils/extend-metadata.util");
|
||||
/**
|
||||
* Sets a response header.
|
||||
*/
|
||||
function Header(name, value) {
|
||||
return (target, key, descriptor) => {
|
||||
extend_metadata_util_1.extendArrayMetadata(constants_1.HEADERS_METADATA, [{ name, value }], descriptor.value);
|
||||
return descriptor;
|
||||
};
|
||||
}
|
||||
exports.Header = Header;
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Defines the HTTP status code, which should be sent with response.
|
||||
* Defines the HTTP response status code.
|
||||
* It overrides default status code for the given request method.
|
||||
*
|
||||
* @param {number} statusCode
|
||||
@@ -2,7 +2,7 @@
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const constants_1 = require("../../constants");
|
||||
/**
|
||||
* Defines the HTTP status code, which should be sent with response.
|
||||
* Defines the HTTP response status code.
|
||||
* It overrides default status code for the given request method.
|
||||
*
|
||||
* @param {number} statusCode
|
||||
@@ -3,3 +3,4 @@ export * from './route-params.decorator';
|
||||
export * from './http-code.decorator';
|
||||
export * from './create-route-param-metadata.decorator';
|
||||
export * from './render.decorator';
|
||||
export * from './header.decorator';
|
||||
@@ -8,3 +8,4 @@ __export(require("./route-params.decorator"));
|
||||
__export(require("./http-code.decorator"));
|
||||
__export(require("./create-route-param-metadata.decorator"));
|
||||
__export(require("./render.decorator"));
|
||||
__export(require("./header.decorator"));
|
||||
6
bundle/common/decorators/http/redirect.decorator.d.ts
vendored
Normal file
6
bundle/common/decorators/http/redirect.decorator.d.ts
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import 'reflect-metadata';
|
||||
|
||||
/**
|
||||
* Redirects request.
|
||||
*/
|
||||
export declare function Redirect(url: string): MethodDecorator;
|
||||
14
bundle/common/decorators/http/redirect.decorator.js
Normal file
14
bundle/common/decorators/http/redirect.decorator.js
Normal file
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
require("reflect-metadata");
|
||||
const constants_1 = require("../../constants");
|
||||
/**
|
||||
* Redirects request.
|
||||
*/
|
||||
function Redirect(url) {
|
||||
return (target, key, descriptor) => {
|
||||
Reflect.defineMetadata(constants_1.REDIRECT_METADATA, url, descriptor.value);
|
||||
return descriptor;
|
||||
};
|
||||
}
|
||||
exports.Redirect = Redirect;
|
||||
@@ -1,5 +1,5 @@
|
||||
import 'reflect-metadata';
|
||||
/**
|
||||
* Defines a template that should be rendered by a controller.
|
||||
* Defines a template to be rendered by the controller.
|
||||
*/
|
||||
export declare function Render(template: string): MethodDecorator;
|
||||
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||
require("reflect-metadata");
|
||||
const constants_1 = require("../../constants");
|
||||
/**
|
||||
* Defines a template that should be rendered by a controller.
|
||||
* Defines a template to be rendered by the controller.
|
||||
*/
|
||||
function Render(template) {
|
||||
return (target, key, descriptor) => {
|
||||
@@ -1,8 +1,6 @@
|
||||
import 'reflect-metadata';
|
||||
import { RequestMappingMetadata } from '../../interfaces/request-mapping-metadata.interface';
|
||||
export declare const RequestMapping: (
|
||||
metadata?: RequestMappingMetadata,
|
||||
) => MethodDecorator;
|
||||
export declare const RequestMapping: (metadata?: RequestMappingMetadata) => MethodDecorator;
|
||||
/**
|
||||
* Routes HTTP POST requests to the specified path.
|
||||
*/
|
||||
@@ -1,11 +1,12 @@
|
||||
import 'reflect-metadata';
|
||||
import { PipeTransform } from '../../index';
|
||||
import { Type } from '../../interfaces';
|
||||
export declare type ParamData = object | string | number;
|
||||
export interface RouteParamsMetadata {
|
||||
[prop: number]: {
|
||||
index: number;
|
||||
data?: ParamData;
|
||||
};
|
||||
[prop: number]: {
|
||||
index: number;
|
||||
data?: ParamData;
|
||||
};
|
||||
}
|
||||
export declare const Request: () => ParameterDecorator;
|
||||
export declare const Response: () => ParameterDecorator;
|
||||
@@ -15,22 +16,13 @@ export declare const UploadedFile: () => ParameterDecorator;
|
||||
export declare const UploadedFiles: () => ParameterDecorator;
|
||||
export declare const Headers: (property?: string) => ParameterDecorator;
|
||||
export declare function Query(): any;
|
||||
export declare function Query(...pipes: PipeTransform<any>[]): any;
|
||||
export declare function Query(
|
||||
property: string,
|
||||
...pipes: PipeTransform<any>[]
|
||||
): any;
|
||||
export declare function Query(...pipes: (Type<PipeTransform> | PipeTransform)[]): any;
|
||||
export declare function Query(property: string, ...pipes: (Type<PipeTransform> | PipeTransform)[]): any;
|
||||
export declare function Body(): any;
|
||||
export declare function Body(...pipes: PipeTransform<any>[]): any;
|
||||
export declare function Body(
|
||||
property: string,
|
||||
...pipes: PipeTransform<any>[]
|
||||
): any;
|
||||
export declare function Body(...pipes: (Type<PipeTransform> | PipeTransform)[]): any;
|
||||
export declare function Body(property: string, ...pipes: (Type<PipeTransform> | PipeTransform)[]): any;
|
||||
export declare function Param(): any;
|
||||
export declare function Param(...pipes: PipeTransform<any>[]): any;
|
||||
export declare function Param(
|
||||
property: string,
|
||||
...pipes: PipeTransform<any>[]
|
||||
): any;
|
||||
export declare function Param(...pipes: (Type<PipeTransform> | PipeTransform)[]): any;
|
||||
export declare function Param(property: string, ...pipes: (Type<PipeTransform> | PipeTransform)[]): any;
|
||||
export declare const Req: () => ParameterDecorator;
|
||||
export declare const Res: () => ParameterDecorator;
|
||||
@@ -11,16 +11,16 @@ const assignMetadata = (args, paramtype, index, data, ...pipes) => (Object.assig
|
||||
} }));
|
||||
const createRouteParamDecorator = (paramtype) => {
|
||||
return (data) => (target, key, index) => {
|
||||
const args = Reflect.getMetadata(constants_1.ROUTE_ARGS_METADATA, target, key) || {};
|
||||
Reflect.defineMetadata(constants_1.ROUTE_ARGS_METADATA, assignMetadata(args, paramtype, index, data), target, key);
|
||||
const args = Reflect.getMetadata(constants_1.ROUTE_ARGS_METADATA, target.constructor, key) || {};
|
||||
Reflect.defineMetadata(constants_1.ROUTE_ARGS_METADATA, assignMetadata(args, paramtype, index, data), target.constructor, key);
|
||||
};
|
||||
};
|
||||
const createPipesRouteParamDecorator = (paramtype) => (data, ...pipes) => (target, key, index) => {
|
||||
const args = Reflect.getMetadata(constants_1.ROUTE_ARGS_METADATA, target, key) || {};
|
||||
const args = Reflect.getMetadata(constants_1.ROUTE_ARGS_METADATA, target.constructor, key) || {};
|
||||
const hasParamData = shared_utils_1.isNil(data) || shared_utils_1.isString(data);
|
||||
const paramData = hasParamData ? data : undefined;
|
||||
const paramPipes = hasParamData ? pipes : [data, ...pipes];
|
||||
Reflect.defineMetadata(constants_1.ROUTE_ARGS_METADATA, assignMetadata(args, paramtype, index, paramData, ...paramPipes), target, key);
|
||||
Reflect.defineMetadata(constants_1.ROUTE_ARGS_METADATA, assignMetadata(args, paramtype, index, paramData, ...paramPipes), target.constructor, key);
|
||||
};
|
||||
exports.Request = createRouteParamDecorator(route_paramtypes_enum_1.RouteParamtypes.REQUEST);
|
||||
exports.Response = createRouteParamDecorator(route_paramtypes_enum_1.RouteParamtypes.RESPONSE);
|
||||
@@ -1,3 +1,3 @@
|
||||
export declare class InvalidModuleConfigException extends Error {
|
||||
constructor(property: string);
|
||||
constructor(property: string);
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
import 'reflect-metadata';
|
||||
/**
|
||||
* Makes the module global-scoped.
|
||||
* Once imported will be available for all of the existing modules.
|
||||
* Once imported will be available for all existing modules.
|
||||
*/
|
||||
export declare function Global(): ClassDecorator;
|
||||
@@ -4,7 +4,7 @@ require("reflect-metadata");
|
||||
const constants_1 = require("../../constants");
|
||||
/**
|
||||
* Makes the module global-scoped.
|
||||
* Once imported will be available for all of the existing modules.
|
||||
* Once imported will be available for all existing modules.
|
||||
*/
|
||||
function Global() {
|
||||
return (target) => {
|
||||
@@ -1,4 +1,3 @@
|
||||
export * from './module.decorator';
|
||||
export * from './shared.decorator';
|
||||
export * from './single-scope.decorator';
|
||||
export * from './global.decorator';
|
||||
@@ -4,6 +4,5 @@ function __export(m) {
|
||||
}
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
__export(require("./module.decorator"));
|
||||
__export(require("./shared.decorator"));
|
||||
__export(require("./single-scope.decorator"));
|
||||
__export(require("./global.decorator"));
|
||||
@@ -4,9 +4,9 @@ import { ModuleMetadata } from '../../interfaces/modules/module-metadata.interfa
|
||||
* Defines the module
|
||||
* - `imports` - the set of the 'imported' modules
|
||||
* - `controllers` - the list of controllers (e.g. HTTP controllers)
|
||||
* - `components` - the list of components that belong to this module. They can be injected between themselves.
|
||||
* - `providers` - the list of providers that belong to this module. They can be injected between themselves.
|
||||
* - `exports` - the set of components, which should be available for modules, which imports this module
|
||||
* - `modules` - @deprecated the set of the 'imported' modules
|
||||
* @param obj {ModuleMetadata} Module metadata
|
||||
* - `components` - @deprecated the list of components that belong to this module. They can be injected between themselves.
|
||||
* @param options {ModuleMetadata} Module metadata
|
||||
*/
|
||||
export declare function Module(obj: ModuleMetadata): ClassDecorator;
|
||||
export declare function Module(metadata: ModuleMetadata): ClassDecorator;
|
||||
61
bundle/common/decorators/modules/module.decorator.js
Normal file
61
bundle/common/decorators/modules/module.decorator.js
Normal file
@@ -0,0 +1,61 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
require("reflect-metadata");
|
||||
const deprecate = require("deprecate");
|
||||
const constants_1 = require("../../constants");
|
||||
const invalid_module_config_exception_1 = require("./exceptions/invalid-module-config.exception");
|
||||
const metadataKeys = [
|
||||
constants_1.metadata.MODULES,
|
||||
constants_1.metadata.IMPORTS,
|
||||
constants_1.metadata.EXPORTS,
|
||||
constants_1.metadata.COMPONENTS,
|
||||
constants_1.metadata.CONTROLLERS,
|
||||
constants_1.metadata.PROVIDERS,
|
||||
];
|
||||
const validateKeys = (keys) => {
|
||||
const isKeyInvalid = key => metadataKeys.findIndex(k => k === key) < 0;
|
||||
const validateKey = key => {
|
||||
if (!isKeyInvalid(key)) {
|
||||
return;
|
||||
}
|
||||
throw new invalid_module_config_exception_1.InvalidModuleConfigException(key);
|
||||
};
|
||||
keys.forEach(validateKey);
|
||||
};
|
||||
/**
|
||||
* Defines the module
|
||||
* - `imports` - the set of the 'imported' modules
|
||||
* - `controllers` - the list of controllers (e.g. HTTP controllers)
|
||||
* - `providers` - the list of providers that belong to this module. They can be injected between themselves.
|
||||
* - `exports` - the set of components, which should be available for modules, which imports this module
|
||||
* - `components` - @deprecated the list of components that belong to this module. They can be injected between themselves.
|
||||
* @param options {ModuleMetadata} Module metadata
|
||||
*/
|
||||
function Module(metadata) {
|
||||
const propsKeys = Object.keys(metadata);
|
||||
validateKeys(propsKeys);
|
||||
showDeprecatedWarnings(metadata);
|
||||
overrideModuleMetadata(metadata);
|
||||
return (target) => {
|
||||
for (const property in metadata) {
|
||||
if (metadata.hasOwnProperty(property)) {
|
||||
Reflect.defineMetadata(property, metadata[property], target);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
exports.Module = Module;
|
||||
function overrideModuleMetadata(moduleMetadata) {
|
||||
moduleMetadata.modules = moduleMetadata.imports
|
||||
? moduleMetadata.imports
|
||||
: moduleMetadata.modules;
|
||||
moduleMetadata.components = moduleMetadata.providers
|
||||
? moduleMetadata.providers
|
||||
: moduleMetadata.components;
|
||||
}
|
||||
function showDeprecatedWarnings(moduleMetadata) {
|
||||
const modulesDeprecatedWarning = 'The "modules" key in the @Module() decorator is deprecated and will be removed within next major release. Use the "imports" key instead.';
|
||||
const componentsDeprecatetWarning = 'The "components" key in the @Module() decorator is deprecated and will be removed within next major release. Use the "providers" key instead.';
|
||||
moduleMetadata.modules && deprecate(modulesDeprecatedWarning);
|
||||
moduleMetadata.components && deprecate(componentsDeprecatetWarning);
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
import 'reflect-metadata';
|
||||
/**
|
||||
* Makes the module single-scoped (not singleton).
|
||||
* Nest will always create the new instance of the module, when it's imported by another one.
|
||||
* In this case, Nest will always create a new instance of this particular module when it's imported by another one.
|
||||
*/
|
||||
export declare function SingleScope(): ClassDecorator;
|
||||
@@ -4,7 +4,7 @@ require("reflect-metadata");
|
||||
const constants_1 = require("../../constants");
|
||||
/**
|
||||
* Makes the module single-scoped (not singleton).
|
||||
* Nest will always create the new instance of the module, when it's imported by another one.
|
||||
* In this case, Nest will always create a new instance of this particular module when it's imported by another one.
|
||||
*/
|
||||
function SingleScope() {
|
||||
return (target) => {
|
||||
46
bundle/common/enums/http-status.enum.d.ts
vendored
Normal file
46
bundle/common/enums/http-status.enum.d.ts
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
export declare enum HttpStatus {
|
||||
CONTINUE = 100,
|
||||
SWITCHING_PROTOCOLS = 101,
|
||||
PROCESSING = 102,
|
||||
OK = 200,
|
||||
CREATED = 201,
|
||||
ACCEPTED = 202,
|
||||
NON_AUTHORITATIVE_INFORMATION = 203,
|
||||
NO_CONTENT = 204,
|
||||
RESET_CONTENT = 205,
|
||||
PARTIAL_CONTENT = 206,
|
||||
AMBIGUOUS = 300,
|
||||
MOVED_PERMANENTLY = 301,
|
||||
FOUND = 302,
|
||||
SEE_OTHER = 303,
|
||||
NOT_MODIFIED = 304,
|
||||
TEMPORARY_REDIRECT = 307,
|
||||
PERMANENT_REDIRECT = 308,
|
||||
BAD_REQUEST = 400,
|
||||
UNAUTHORIZED = 401,
|
||||
PAYMENT_REQUIRED = 402,
|
||||
FORBIDDEN = 403,
|
||||
NOT_FOUND = 404,
|
||||
METHOD_NOT_ALLOWED = 405,
|
||||
NOT_ACCEPTABLE = 406,
|
||||
PROXY_AUTHENTICATION_REQUIRED = 407,
|
||||
REQUEST_TIMEOUT = 408,
|
||||
CONFLICT = 409,
|
||||
GONE = 410,
|
||||
LENGTH_REQUIRED = 411,
|
||||
PRECONDITION_FAILED = 412,
|
||||
PAYLOAD_TOO_LARGE = 413,
|
||||
URI_TOO_LONG = 414,
|
||||
UNSUPPORTED_MEDIA_TYPE = 415,
|
||||
REQUESTED_RANGE_NOT_SATISFIABLE = 416,
|
||||
EXPECTATION_FAILED = 417,
|
||||
I_AM_A_TEAPOT = 418,
|
||||
UNPROCESSABLE_ENTITY = 422,
|
||||
TOO_MANY_REQUESTS = 429,
|
||||
INTERNAL_SERVER_ERROR = 500,
|
||||
NOT_IMPLEMENTED = 501,
|
||||
BAD_GATEWAY = 502,
|
||||
SERVICE_UNAVAILABLE = 503,
|
||||
GATEWAY_TIMEOUT = 504,
|
||||
HTTP_VERSION_NOT_SUPPORTED = 505,
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
export declare enum NestEnvironment {
|
||||
RUN = 0,
|
||||
TEST = 1,
|
||||
RUN = 0,
|
||||
TEST = 1,
|
||||
}
|
||||
10
bundle/common/enums/request-method.enum.d.ts
vendored
Normal file
10
bundle/common/enums/request-method.enum.d.ts
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
export declare enum RequestMethod {
|
||||
GET = 0,
|
||||
POST = 1,
|
||||
PUT = 2,
|
||||
DELETE = 3,
|
||||
PATCH = 4,
|
||||
ALL = 5,
|
||||
OPTIONS = 6,
|
||||
HEAD = 7,
|
||||
}
|
||||
12
bundle/common/enums/route-paramtypes.enum.d.ts
vendored
Normal file
12
bundle/common/enums/route-paramtypes.enum.d.ts
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
export declare enum RouteParamtypes {
|
||||
REQUEST = 0,
|
||||
RESPONSE = 1,
|
||||
NEXT = 2,
|
||||
BODY = 3,
|
||||
QUERY = 4,
|
||||
PARAM = 5,
|
||||
HEADERS = 6,
|
||||
SESSION = 7,
|
||||
FILE = 8,
|
||||
FILES = 9,
|
||||
}
|
||||
7
bundle/common/enums/transport.enum.d.ts
vendored
Normal file
7
bundle/common/enums/transport.enum.d.ts
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
export declare enum Transport {
|
||||
TCP = 0,
|
||||
REDIS = 1,
|
||||
NATS = 2,
|
||||
MQTT = 3,
|
||||
GRPC = 4,
|
||||
}
|
||||
@@ -4,4 +4,7 @@ var Transport;
|
||||
(function (Transport) {
|
||||
Transport[Transport["TCP"] = 0] = "TCP";
|
||||
Transport[Transport["REDIS"] = 1] = "REDIS";
|
||||
Transport[Transport["NATS"] = 2] = "NATS";
|
||||
Transport[Transport["MQTT"] = 3] = "MQTT";
|
||||
Transport[Transport["GRPC"] = 4] = "GRPC";
|
||||
})(Transport = exports.Transport || (exports.Transport = {}));
|
||||
@@ -1,4 +1,4 @@
|
||||
import { HttpException } from './http.exception';
|
||||
export declare class BadGatewayException extends HttpException {
|
||||
constructor(message?: string | object | any, error?: string);
|
||||
constructor(message?: string | object | any, error?: string);
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { HttpException } from './http.exception';
|
||||
export declare class BadRequestException extends HttpException {
|
||||
constructor(message?: string | object | any, error?: string);
|
||||
constructor(message?: string | object | any, error?: string);
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { HttpException } from './http.exception';
|
||||
export declare class ConflictException extends HttpException {
|
||||
constructor(message?: string | object | any, error?: string);
|
||||
constructor(message?: string | object | any, error?: string);
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { HttpException } from './http.exception';
|
||||
export declare class ForbiddenException extends HttpException {
|
||||
constructor(message?: string | object | any, error?: string);
|
||||
constructor(message?: string | object | any, error?: string);
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { HttpException } from './http.exception';
|
||||
export declare class GatewayTimeoutException extends HttpException {
|
||||
constructor(message?: string | object | any, error?: string);
|
||||
constructor(message?: string | object | any, error?: string);
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { HttpException } from './http.exception';
|
||||
export declare class GoneException extends HttpException {
|
||||
constructor(message?: string | object | any, error?: string);
|
||||
constructor(message?: string | object | any, error?: string);
|
||||
}
|
||||
22
bundle/common/exceptions/http.exception.d.ts
vendored
Normal file
22
bundle/common/exceptions/http.exception.d.ts
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
export declare class HttpException extends Error {
|
||||
private readonly response;
|
||||
private readonly status;
|
||||
readonly message: any;
|
||||
/**
|
||||
* The base Nest Application exception, which is handled by the default Exceptions Handler.
|
||||
* If you throw an exception from your HTTP route handlers, Nest will map them to the appropriate HTTP response and send to the client.
|
||||
*
|
||||
* When `response` is an object:
|
||||
* - object will be stringified and returned to the user as a JSON response,
|
||||
*
|
||||
* When `response` is a string:
|
||||
* - Nest will create a response with two properties:
|
||||
* ```
|
||||
* message: response,
|
||||
* statusCode: X
|
||||
* ```
|
||||
*/
|
||||
constructor(response: string | object, status: number);
|
||||
getResponse(): string | object;
|
||||
getStatus(): number;
|
||||
}
|
||||
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||
class HttpException extends Error {
|
||||
/**
|
||||
* The base Nest Application exception, which is handled by the default Exceptions Handler.
|
||||
* If you throw an exception from your HTTP route handler, Nest will map them to the appropriate HTTP response and send to the client.
|
||||
* If you throw an exception from your HTTP route handlers, Nest will map them to the appropriate HTTP response and send to the client.
|
||||
*
|
||||
* When `response` is an object:
|
||||
* - object will be stringified and returned to the user as a JSON response,
|
||||
@@ -1,4 +1,4 @@
|
||||
import { HttpException } from './http.exception';
|
||||
export declare class InternalServerErrorException extends HttpException {
|
||||
constructor(message?: string | object | any, error?: string);
|
||||
constructor(message?: string | object | any, error?: string);
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { HttpException } from './http.exception';
|
||||
export declare class MethodNotAllowedException extends HttpException {
|
||||
constructor(message?: string | object | any, error?: string);
|
||||
constructor(message?: string | object | any, error?: string);
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user