mirror of
https://github.com/nestjs/nest.git
synced 2026-02-22 07:21:39 +00:00
Compare commits
242 Commits
v5.0.0-bet
...
v5.2.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cd30d7a4a5 | ||
|
|
a6d837e64a | ||
|
|
0904b0ba56 | ||
|
|
150c81e397 | ||
|
|
1717f35717 | ||
|
|
61b6b346da | ||
|
|
b02fb57d8f | ||
|
|
cb302e6719 | ||
|
|
1f9030c504 | ||
|
|
af5a4af675 | ||
|
|
664321465c | ||
|
|
f6d4b5e82a | ||
|
|
09c9f704e5 | ||
|
|
8a8b780273 | ||
|
|
1f0de4923e | ||
|
|
d5833e3e4b | ||
|
|
deffcdcd84 | ||
|
|
36b94b37d0 | ||
|
|
85b93260e2 | ||
|
|
94f74a485b | ||
|
|
b4253525fe | ||
|
|
c38c91217c | ||
|
|
f024af4912 | ||
|
|
6976ffe079 | ||
|
|
2812c3863d | ||
|
|
9ad7927c4c | ||
|
|
afae462b6e | ||
|
|
62e733c018 | ||
|
|
d446a56381 | ||
|
|
2bdf47a572 | ||
|
|
caf99c6cf8 | ||
|
|
5415659fb9 | ||
|
|
e967ba15cf | ||
|
|
0b191fbd17 | ||
|
|
2ea58acc70 | ||
|
|
1f59a81c28 | ||
|
|
fbcb18c978 | ||
|
|
dd7bb313f4 | ||
|
|
946ed2e339 | ||
|
|
96da5bd9c5 | ||
|
|
9f77d5f550 | ||
|
|
9e6cf1f1aa | ||
|
|
d92fa0dee1 | ||
|
|
63109f5717 | ||
|
|
dc33ea57ef | ||
|
|
780bd9c0f9 | ||
|
|
a79041d211 | ||
|
|
eda8e293c3 | ||
|
|
fd797b1a69 | ||
|
|
fd098fc3f7 | ||
|
|
1be2ccdb0b | ||
|
|
cb46174bae | ||
|
|
ac1578793f | ||
|
|
525922ee69 | ||
|
|
5327979745 | ||
|
|
3a0e404832 | ||
|
|
55b1f1e08e | ||
|
|
a05383c635 | ||
|
|
86abc0001c | ||
|
|
c4ff2e736a | ||
|
|
d00d5f2996 | ||
|
|
5f0f6e5b61 | ||
|
|
f39573007c | ||
|
|
f7a367e895 | ||
|
|
dcba92190f | ||
|
|
614d57f130 | ||
|
|
9e170c4ae4 | ||
|
|
85070a5c9c | ||
|
|
f86fc35fa7 | ||
|
|
53184b8df0 | ||
|
|
f385d5c47d | ||
|
|
1527e12013 | ||
|
|
58800f69b1 | ||
|
|
049da42d4a | ||
|
|
21f2e8a9f7 | ||
|
|
432b777f2c | ||
|
|
e39c9d920d | ||
|
|
b84c2b0884 | ||
|
|
e4d0118e9d | ||
|
|
0bf98c46cb | ||
|
|
442b08fdb9 | ||
|
|
9c2a9d76d2 | ||
|
|
a354741c31 | ||
|
|
8d62307987 | ||
|
|
e2de979081 | ||
|
|
0f62bcd41f | ||
|
|
d4c9644368 | ||
|
|
0c4fe26c21 | ||
|
|
3cf8607b20 | ||
|
|
3d2d838bd1 | ||
|
|
a9204cb399 | ||
|
|
bd3b102c2f | ||
|
|
9cf27a35dd | ||
|
|
c1c5b15859 | ||
|
|
3e55de545f | ||
|
|
ced6729157 | ||
|
|
a57eb17640 | ||
|
|
6c2863d709 | ||
|
|
fc05b244a8 | ||
|
|
c80fd77416 | ||
|
|
e2d15db3f4 | ||
|
|
8057a5cf19 | ||
|
|
a6ab849df2 | ||
|
|
7143d3b8ac | ||
|
|
be6d90ace2 | ||
|
|
7023905b53 | ||
|
|
f4817ee4eb | ||
|
|
a87eee0849 | ||
|
|
a8803fd166 | ||
|
|
18f68d96b7 | ||
|
|
ecd61e3777 | ||
|
|
10eeac9ae7 | ||
|
|
59e6a3d262 | ||
|
|
292fe2136c | ||
|
|
f80cd9edd1 | ||
|
|
adbfae2b71 | ||
|
|
4cfda07b2a | ||
|
|
3ac7802315 | ||
|
|
1813e5a09c | ||
|
|
c9184acee1 | ||
|
|
1c98d6b18c | ||
|
|
7172671dcc | ||
|
|
294e269ede | ||
|
|
00c98501ff | ||
|
|
51d5be4e9d | ||
|
|
f86c0e33c4 | ||
|
|
3888d8ee8b | ||
|
|
8029796193 | ||
|
|
f3c28f57ac | ||
|
|
03db0d357a | ||
|
|
7ad6095e16 | ||
|
|
617bc70944 | ||
|
|
f2d2d56111 | ||
|
|
84d31f9449 | ||
|
|
da3745f386 | ||
|
|
7e47100d3e | ||
|
|
0c8e8fb4f7 | ||
|
|
f337206785 | ||
|
|
3984bc92f2 | ||
|
|
89fe60a213 | ||
|
|
3ebec419fe | ||
|
|
fed2459677 | ||
|
|
33c7049d71 | ||
|
|
e44f51d647 | ||
|
|
31aa2f09c5 | ||
|
|
3fffc01890 | ||
|
|
e1abf80569 | ||
|
|
a7fde9b6cc | ||
|
|
92d3ed48db | ||
|
|
c5455de9d1 | ||
|
|
7b5b054818 | ||
|
|
17a609cd9c | ||
|
|
ae128f6e91 | ||
|
|
cb24ca9ee5 | ||
|
|
e37b9f7d81 | ||
|
|
55600edb2d | ||
|
|
033068b5d7 | ||
|
|
9ea7db9160 | ||
|
|
1801bf86b6 | ||
|
|
ba5c59bc34 | ||
|
|
bf30a304d8 | ||
|
|
310d530308 | ||
|
|
75775d6ea1 | ||
|
|
f9e02b60fa | ||
|
|
c5a3385156 | ||
|
|
403a137847 | ||
|
|
c7bd1afc39 | ||
|
|
fcf24d32c9 | ||
|
|
53bcbefb63 | ||
|
|
e010ebd09e | ||
|
|
663ca6981e | ||
|
|
e41c4d806f | ||
|
|
6ad5ae6a67 | ||
|
|
0da348045f | ||
|
|
64629cfb4d | ||
|
|
4a589d52d5 | ||
|
|
8f30e6769b | ||
|
|
6016f8d175 | ||
|
|
7b950ffa6e | ||
|
|
f037edad14 | ||
|
|
9c404cddea | ||
|
|
3900cadbd9 | ||
|
|
8b04584ca9 | ||
|
|
c5e560d1cf | ||
|
|
bae969c601 | ||
|
|
0fcdf4ee2c | ||
|
|
4a744d1c1b | ||
|
|
c9daccda3a | ||
|
|
72aad1d90e | ||
|
|
cb9896ed7f | ||
|
|
f81f14364a | ||
|
|
8a77bfab55 | ||
|
|
04cd077426 | ||
|
|
e84979d04a | ||
|
|
f9cdb6168d | ||
|
|
bc1eab1b3d | ||
|
|
aba394f742 | ||
|
|
6a49b833ca | ||
|
|
2c9a07b64a | ||
|
|
7e022be24a | ||
|
|
8bf9cecd10 | ||
|
|
fb860c70e3 | ||
|
|
eb639de347 | ||
|
|
5bd3a83cb2 | ||
|
|
382d99986b | ||
|
|
154b865d7b | ||
|
|
d001a2f34a | ||
|
|
4cfdbe2220 | ||
|
|
0266ffdb97 | ||
|
|
1f7ae5ef3a | ||
|
|
aeda614c5c | ||
|
|
181d8c6585 | ||
|
|
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 |
41
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
41
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
## PR Checklist
|
||||
Please check if your PR fulfills the following requirements:
|
||||
|
||||
- [ ] The commit message follows our guidelines: https://github.com/nestjs/nest/blob/master/CONTRIBUTING.md
|
||||
- [ ] Tests for the changes have been added (for bug fixes / features)
|
||||
- [ ] Docs have been added / updated (for bug fixes / features)
|
||||
|
||||
|
||||
## PR Type
|
||||
What kind of change does this PR introduce?
|
||||
|
||||
<!-- Please check the one that applies to this PR using "x". -->
|
||||
```
|
||||
[ ] Bugfix
|
||||
[ ] Feature
|
||||
[ ] Code style update (formatting, local variables)
|
||||
[ ] Refactoring (no functional changes, no api changes)
|
||||
[ ] Build related changes
|
||||
[ ] CI related changes
|
||||
[ ] Other... Please describe:
|
||||
```
|
||||
|
||||
## What is the current behavior?
|
||||
<!-- Please describe the current behavior that you are modifying, or link to a relevant issue. -->
|
||||
|
||||
Issue Number: N/A
|
||||
|
||||
|
||||
## What is the new behavior?
|
||||
|
||||
|
||||
## Does this PR introduce a breaking change?
|
||||
```
|
||||
[ ] Yes
|
||||
[ ] No
|
||||
```
|
||||
|
||||
<!-- If this PR contains a breaking change, please describe the impact and migration path for existing applications below. -->
|
||||
|
||||
|
||||
## Other information
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,6 +1,5 @@
|
||||
# dependencies
|
||||
node_modules/
|
||||
package-lock.json
|
||||
|
||||
# IDE
|
||||
/.idea
|
||||
|
||||
1
.prettierignore
Normal file
1
.prettierignore
Normal file
@@ -0,0 +1 @@
|
||||
/bundle
|
||||
23
.travis.yml
23
.travis.yml
@@ -1,14 +1,23 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "7"
|
||||
- "8"
|
||||
- "9"
|
||||
- "10"
|
||||
cache:
|
||||
directories:
|
||||
- "node_modules"
|
||||
git:
|
||||
depth: 5
|
||||
addons:
|
||||
firefox: "latest"
|
||||
firefox: "latest"
|
||||
before_script:
|
||||
- export DISPLAY=:99.0
|
||||
- sh -e /etc/init.d/xvfb start
|
||||
- export DISPLAY=:99.0
|
||||
- sh -e /etc/init.d/xvfb start
|
||||
before_install:
|
||||
- npm i -g npm@latest
|
||||
install:
|
||||
- npm install
|
||||
- gulp build
|
||||
- npm ci
|
||||
- gulp build
|
||||
script:
|
||||
- npm test
|
||||
- npm test
|
||||
after_success: npm run coverage
|
||||
377
CHANGELOG.md
377
CHANGELOG.md
@@ -1,377 +0,0 @@
|
||||
## 4.6.6
|
||||
### Bug Fixes:
|
||||
- **common**: `File(s)Interceptor` throws http status code 500 [#465](https://github.com/nestjs/nest/issues/437)
|
||||
- **core**: e2e testing, `EXPRESS_REF` injector issue [#484](https://github.com/nestjs/nest/issues/484)
|
||||
- **microservices**: `NO_PATTERN_MESSAGE` bugfix [#491](https://github.com/nestjs/nest/issues/491)
|
||||
|
||||
### Improvements:
|
||||
- **common**: `class-transformer` update [#483](https://github.com/nestjs/nest/pull/483/)
|
||||
- **common**: `HttpService` improvements, remove duplicated `axios` interfaces [#470](https://github.com/nestjs/nest/pull/470)
|
||||
- **core**: far more meaningful exception when not available component is exported (module inconsistency) [#479](https://github.com/nestjs/nest/issues/479)
|
||||
|
||||
## 4.6.5
|
||||
### Bug Fixes
|
||||
- **common**: `File(s)Interceptor` does not populate thrown exception [#437](https://github.com/nestjs/nest/issues/437)
|
||||
- **core**: `NestFactory.create()` returns `any`
|
||||
- **core**: use `ApplicationConfig` within `ExternalContextCreator` [#434](https://github.com/nestjs/nest/issues/434)
|
||||
|
||||
### Improvements
|
||||
- **common**: `HttpException` extends `Error`
|
||||
- **core**: make `cors` middleware customizable (`enableCors()`, `{ cors }`) [#457](https://github.com/nestjs/nest/issues/437)
|
||||
- **microservices**: `RpcException` extends `Error`
|
||||
- **websockets**: `WsException` extends `Error`
|
||||
|
||||
## 4.6.4
|
||||
### Bug Fixes
|
||||
- **common**: logger overrides custom logger scope [#435](https://github.com/nestjs/nest/issues/435)
|
||||
- **common**: `FileInterceptor` supports only one options at once [#429](https://github.com/nestjs/nest/issues/429)
|
||||
- **common**: support `symbol` as a token (`NestApplicationContext`)
|
||||
- **core**: fix exception handler (exceception thrown in the `done()` callback) [#431](https://github.com/nestjs/nest/issues/431)
|
||||
- **core**: incorrect HTTP response on `SyntaxError` [#430](https://github.com/nestjs/nest/issues/430)
|
||||
- **microservices**: can't select/get from context when using `NestFactory.createMicroservice` [#398](https://github.com/nestjs/nest/issues/398)
|
||||
|
||||
## 4.6.3
|
||||
### Bug Fixes
|
||||
- **core**: error thrown when connecting to microservice (hybrid applicaton) [#425](https://github.com/nestjs/nest/issues/425)
|
||||
|
||||
## 4.6.2
|
||||
### Improvements
|
||||
- **core**: simplify `NestFactory.create(...args)` signature
|
||||
|
||||
## 4.6.1
|
||||
### Improvements
|
||||
- **common**: create `ModuleMetadata` interface
|
||||
- **core**: majority of methods (`INestApplication`, `INestMicroservice`, and `INestApplicationContext`) return `this` instead of `void`
|
||||
- **core**: remove static dependencies & relationships inside `NestFactory`
|
||||
|
||||
### Features
|
||||
- **core**: [feature] add `appOptions` property to `create[..]` methods of `NestFactory`
|
||||
|
||||
### Bug Fixes
|
||||
- **common**: [bugfix] update `class-validator` [#417](https://github.com/nestjs/nest/issues/417)
|
||||
- **core**: [bugfix] catch error thrown by `bodyParser` in exception filter [#422](https://github.com/nestjs/nest/issues/422)
|
||||
|
||||
## 4.6.0
|
||||
### Features
|
||||
- **common**: `ValidationPipe` improvements [#383](https://github.com/nestjs/nest/pull/383)
|
||||
- **common**: `ParseIntPipe` improvements [#385](https://github.com/nestjs/nest/pull/385)
|
||||
- **common**: add `FileInterceptor`, `FilesInterceptor`, `@UploadedFile()` and `@UploadedFiles()` (`multer` integration)
|
||||
- **common**: add `HttpModule` that exposes `HttpService` (`axios` integration)
|
||||
- **core**: add `app.disable()` and `app.enable()` wrappers around `express` app
|
||||
- **core**: add ability to inject `express` reference (`EXPRESS_REF` token)
|
||||
- **core**: enable possibility to extend metadata (inheritance support) [#228](https://github.com/nestjs/nest/issues/228)
|
||||
- **core**: `NestFactory.create()` now accepts third argument `HttpsOptions`
|
||||
- **core**: add `app.enableCors()` to `INestApplication` (`cors` integration)
|
||||
- **core**: add `@Render()` decorator (MVC applications)
|
||||
- **core**: provide `Logger.overrideLogger()` [#247](https://github.com/nestjs/nest/issues/247)
|
||||
- **microservices**: add `listenAsync()` to `INestMicroservice` instance
|
||||
|
||||
### Bug Fixes
|
||||
- **core**: simplify HTTPS protocol usage
|
||||
- **core**: custom transport strategy - thrown exceptions issue [#290](https://github.com/nestjs/nest/issues/290)
|
||||
- **core**: injector fails silently [#287](https://github.com/nestjs/nest/issues/287)
|
||||
- **core**: secure websockets (`wss://`) [#384](https://github.com/nestjs/nest/issues/384)
|
||||
- **core**: can't select/get from context when using `NestFactory.createMicroservice()` [#398](https://github.com/nestjs/nest/issues/398)
|
||||
- **core**: interceptor `$stream` observable returns another observable instead of the response object [#376](https://github.com/nestjs/nest/issues/376)
|
||||
- **core**: `Observable.throw` from controller results in unhandled rejection promise [#373](https://github.com/nestjs/nest/issues/373)
|
||||
|
||||
## 4.5.10
|
||||
- **core**: [bugfix] #343
|
||||
- **core**: [bugfix] #337
|
||||
|
||||
## 4.5.6
|
||||
- **core**: [bugfix] dynamic modules `exports`
|
||||
|
||||
## 4.5.5
|
||||
- **core**: [bugfix] add missing `app.engine()` wrapper
|
||||
|
||||
## 4.5.4
|
||||
- **core**: [bugfix] dynamic modules recurrent imports fix
|
||||
|
||||
## 4.5.3
|
||||
- **testing**: [bugfix] issue #326
|
||||
|
||||
## 4.5.2
|
||||
- **common**: [feature] rename `modules` to `imports` (`@Module()` decorator)
|
||||
- **core**: [feature] exception filters with empty `@Catch()` metadata handle each occurred exception
|
||||
- **core**: [improvement] increase performance
|
||||
|
||||
## 4.5.1
|
||||
- **common**: [feature] `INestAplication` provides a `getHttpServer()` method now
|
||||
- **websockets**: [bugfix] `IoAdapter` bugfix
|
||||
|
||||
## 4.5.0
|
||||
- **common**: bugfix #286
|
||||
- **core**: dynamic modules feature
|
||||
- **core**: global scope feature
|
||||
- **core**: `ExternalContextCreator` & `ModulesContainer`
|
||||
- **core**: merge `NestApplicationContext` with `NestApplication`
|
||||
- **core**: `NotFoundException` is thrown when route is not available #298
|
||||
- **core**: add `set()` wrapper around native express methods
|
||||
- **core**: bugfix #281
|
||||
- **websockets**: bugfix #271
|
||||
- **microservices**: log RPC exceptions #303
|
||||
- **microservices**: merge `NestApplicationContext` with `NestMicroservice`
|
||||
- **microservices**: handle ECONNREFUSED #288
|
||||
|
||||
## 4.4.1
|
||||
- **common**: `ValidationPipe` improvement
|
||||
- **common**: custom route params decorators accepts pipes now
|
||||
- **core**: bugfix #268
|
||||
|
||||
## 4.4.0
|
||||
- **core**: possibility to create the `NestApplicationContext` using `NestFactory.createApplicationContext()` (Nest application without HTTP server / microservice in the background)
|
||||
- **core**: create custom params decorators feature (`createRouteParamDecorator()`)
|
||||
|
||||
## 4.3.3
|
||||
- **common**: `ParseIntPipe` is now available out-of-the-box (`@nestjs/common`)
|
||||
- **common**: package contains a set of useful HTTP exceptions now, such as `ForbiddenException`, `UnauthorizedException`, `BadRequestException` etc
|
||||
- **core**: `HttpException` was moved to `@nestjs/common`. This one from `core` packages is now DEPRECATED and will be removed in the next MAJOR release
|
||||
|
||||
## 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** 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**: bugifx #257 - `@Next()` issue
|
||||
- **testing**: testing module is now independent from `@nestjs/microservices`
|
||||
|
||||
## 4.2.2
|
||||
- **websockets**: bugfix #242
|
||||
|
||||
## 4.2.1
|
||||
- **core**: IoAdapter bugfix
|
||||
|
||||
## 4.2.0
|
||||
- **core**: log controller prefix #153
|
||||
- **websockets**: gateway listen the same port as the app #126
|
||||
|
||||
## 4.1.4
|
||||
- **common**: remove deprecated `@ExceptionFilters()` decorator
|
||||
- **core**: update to latest **express* version (4.16.2)
|
||||
- **core**: bugfix #187
|
||||
- **core**: bugfix #185
|
||||
- **all**: packages codependency refactor
|
||||
- **all**: add *lerna* package
|
||||
|
||||
## 4.1.3
|
||||
- **core**: forward reference bugfixes & security updates
|
||||
|
||||
## 4.1.1
|
||||
- **common**: add `forwardRef()` util
|
||||
- **core**: improve injector & dependencies scanner
|
||||
|
||||
## 4.1.0
|
||||
- **common**: add `@Bind()` and `@Dependencies()` decorators to fix route parameters decorators (pure JavaScript compatibility issue)
|
||||
- **core**: improve performance
|
||||
|
||||
## 4.0.1
|
||||
- **core**: add possibility to setup global guards and global interceptors
|
||||
- **common**: `INestApplication` has `useGlobalInterceptors()` and `useGlobalGuards()` now
|
||||
- **microservices**: add possibility to setup global guards, interceptors, filters and pipes
|
||||
- **core**: add timestamp to log output
|
||||
- **core**: improve pipes performance
|
||||
- **core**: add ability to omit param name when passing param-scoped pipe/s
|
||||
- **websockets**: fix disconnect event issue (pass client instead of socket.io instance)
|
||||
|
||||
## 4.0.0
|
||||
**@nestjs/core**
|
||||
- Asynchronous `NestFactory` [read more](http://www.docs.nestjs.com/first-steps)
|
||||
- New response handling approach [read more](http://www.docs.nestjs.com/controllers)
|
||||
- Interceptors feature [read more](http://www.docs.nestjs.com/interceptors)
|
||||
- `@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)
|
||||
- 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)
|
||||
- Mixin classes [read more](http://www.docs.nestjs.com/advanced/mixins)
|
||||
- New `INestApplication` API
|
||||
|
||||
**@nestjs/microservices**
|
||||
- Possibility to return Promise / Observable / plain value [read more](http://www.docs.nestjs.com/microservices/basics)
|
||||
- Guards & Interceptors & Pipes & Exception Filters integration
|
||||
|
||||
|
||||
**@nestjs/websockets**
|
||||
- Possibility to return Promise / Observable / plain value [read more](http://www.docs.nestjs.com/websockets/gateways)
|
||||
- Guards & Interceptors & Pipes & Exception Filters integration
|
||||
- New `WebSocketAdapter` API
|
||||
|
||||
**@nestjs/testing**
|
||||
- Completely rewritten testing package
|
||||
|
||||
## 3.0.1 (24.06.2017)
|
||||
**@nestjs/core**
|
||||
- Hierarchical injector bugfix,
|
||||
- Middlewares `@UseFilters()` bugfix (#95).
|
||||
|
||||
**@nestjs/microservices**
|
||||
- TCP server / client bugfix (#91)
|
||||
|
||||
## 3.0.0 (03.06.2017)
|
||||
**@nestjs/common - BREAKING CHANGE**
|
||||
- You should now pass objects into `@UseFilters()` decorator instead of metatypes,
|
||||
- Exception Filters can't inject dependencies (they're not coupled with modules),
|
||||
- `@ExceptionFilters()` is deprecated, use `@UseFilters()` instead.
|
||||
- `INestApplication` has new methods - `useGlobalFilters()` and `useGlobalPipes()`,
|
||||
- New lifecycle hook - `OnModuleDestroy` interface.
|
||||
|
||||
**@nestjs/core**
|
||||
- `@Pipe()` feature (async & sync),
|
||||
- Exception Filters can have global, controller and method scope.
|
||||
|
||||
**@nestjs/websockets - BREAKING CHANGE**
|
||||
- Use `useWebSocketAdapter()` instead of `setIoAdapter()`,
|
||||
- You can port any WS library - just implement `WebSocketAdapter` (@nestjs/common).
|
||||
|
||||
**@nestjs/microservices - BREAKING CHANGE**
|
||||
- Now methods have to return `Observable`, and they receive only one argument `data`,
|
||||
- Microservices can return multiple values, but after emitting `Observable` has to be COMPLETED!
|
||||
- You can port any transport strategy instead of built-in Redis/TCP, just implement `CustomTransportStrategy`.
|
||||
|
||||
## 2.1.3 (27.05.2017)
|
||||
**@nestjs/common**, **@nestjs/websockets**
|
||||
- `INestApplication` and `INestMicroservice` has new method now - `setIoAdapter()`,
|
||||
- Ability to use custom `IoAdapter`
|
||||
|
||||
## 2.1.1 (24.05.2017)
|
||||
**@nestjs/common**, **@nestjs/websockets**, **@nestjs/microservices**
|
||||
- `INestApplication` and `INestMicroservice` has new method now - `setIoAdapter()`,
|
||||
- Ability to use custom `IoAdapter`
|
||||
|
||||
## 2.1.0 (22.05.2017)
|
||||
**@nestjs/common**, **@nestjs/core**
|
||||
- `INestApplication` has new methods now - `init()`, `setGlobalPrefix()`, `connectMicroservice()`, `close()`, `startAllMicroservices()`,
|
||||
- `INestMicroservice` has new method - `close()`
|
||||
|
||||
## 2.0.3 (15.05.2017)
|
||||
**@nestjs/common**
|
||||
- `Req()` (`Request()`) and `Res()` (`Response()`) aliases to avoid conflicts with express typings
|
||||
|
||||
## 2.0.0 (14.05.2017)
|
||||
|
||||
- **Hierarchical injector** improvements
|
||||
- `@Shared(token?: string)` decorator for **scoped**, shared Modules
|
||||
- Modules **are not singletons** anymore
|
||||
- Added `iterare` library for applying multiple transformations to a collection
|
||||
- `Logger` service is public,
|
||||
- Nest is now splitted into feature packages:
|
||||
```typescript
|
||||
@nestjs/core
|
||||
@nestjs/common
|
||||
@nestjs/microservices
|
||||
@nestjs/testing
|
||||
@nestjs/websockets
|
||||
```
|
||||
- `rxjs`, `redis` and `reflect-metadata` moved into `peerDependencies`
|
||||
- `@Patch()` support
|
||||
|
||||
## 1.0.0 (Final - 01.05.2017)
|
||||
|
||||
- Added **Gateway Middlewares** support:
|
||||
|
||||
```
|
||||
@WebSocketGateway({
|
||||
port: 2000,
|
||||
middlewares: [ChatMiddleware],
|
||||
})
|
||||
```
|
||||
Gateway Middleware example:
|
||||
```
|
||||
@Middleware()
|
||||
export class ChatMiddleware implements GatewayMiddleware {
|
||||
public resolve(): (socket, next) => void {
|
||||
return (socket, next) => {
|
||||
console.log('Authorization...');
|
||||
next();
|
||||
};
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
- New Gateway lifecycle interfaces `OnGatewayInit`, `OnGatewayConnection`, `OnGatewayDisconnect`
|
||||
- `@SubscribeMessage()` now accepts also plain strings:
|
||||
|
||||
```
|
||||
@SubscribeMessage('event')
|
||||
```
|
||||
|
||||
- `@Controller()` now accepts also plain strings:
|
||||
|
||||
```
|
||||
@Controller('users')
|
||||
```
|
||||
|
||||
- `HttpStatus` (`HttpStatus.OK` etc.) enumerator
|
||||
- **Route params decorators** support
|
||||
|
||||
```
|
||||
Request: () => ParameterDecorator
|
||||
Response: () => ParameterDecorator
|
||||
Next: () => ParameterDecorator
|
||||
Query: (property?: string) => ParameterDecorator
|
||||
Body: (property?: string) => ParameterDecorator
|
||||
Param: (property?: string) => ParameterDecorator
|
||||
Session: () => ParameterDecorator
|
||||
Headers: (property?: string) => ParameterDecorator
|
||||
```
|
||||
|
||||
- `MiddlewaresBuilder` -> `MiddlewaresConsumer`
|
||||
- **Exception Filters** support
|
||||
|
||||
```
|
||||
@ExceptionFilters(CustomExceptionFilter, NextExceptionFilter)
|
||||
export class UsersController {}
|
||||
```
|
||||
Exception filter example:
|
||||
|
||||
```
|
||||
export class CustomException {}
|
||||
|
||||
@Catch(CustomException)
|
||||
export class CustomExceptionFilter implements ExceptionFilter {
|
||||
public catch(exception, response) {
|
||||
response.status(500).json({
|
||||
message: 'Custom exception message.',
|
||||
});
|
||||
}
|
||||
}
|
||||
```
|
||||
- Module injection support:
|
||||
|
||||
```
|
||||
export class UsersController {
|
||||
constructor(private module: UsersModule) {}
|
||||
}
|
||||
```
|
||||
|
||||
- `ModuleRef` support
|
||||
|
||||
## 1.0.0-RC7 (08.04.2017)
|
||||
|
||||
- MiddlewareBuilder: `use()` deprecated, use `apply()` instead
|
||||
- MiddlewareBuilder: new `apply()` method
|
||||
|
||||
## 1.0.0-RC4 (08.04.2017)
|
||||
|
||||
- Support for `@Post`, `@Get`, `@Delete`, `@Put`, `@All` decorators
|
||||
- Added ability to pass data to middleware metatypes
|
||||
|
||||
## 1.0.0-BETA-1 (23.03.2017)
|
||||
|
||||
- `@Inject` -> `@Dependencies`
|
||||
- `@Inject` decorator for custom constructor parameters
|
||||
- Custom providers support (useClass, useValue, useFactory)
|
||||
|
||||
## 1.0.0-ALPHA-23 (19.03.2017)
|
||||
|
||||
- Microservices support (TCP & Redis transports)
|
||||
- NestRunner -> NestFactory
|
||||
- Simplify application initialization & configuration
|
||||
- Added abillity to pass custom express instance
|
||||
- `@Inject` decorator for ES6+
|
||||
- SocketGateway -> WebSocketGateway
|
||||
- GatewayServer -> WebSocketServer
|
||||
@@ -183,10 +183,10 @@ Footer should contain a [closing reference to an issue](https://help.github.com/
|
||||
Samples: (even more [samples](https://github.com/nestjs/nest/commits/master))
|
||||
|
||||
```
|
||||
docs(changelog): update change log to beta.5
|
||||
docs(changelog) update change log to beta.5
|
||||
```
|
||||
```
|
||||
fix(release): need to depend on latest rxjs and zone.js
|
||||
bugfix(@nestjs/core) need to depend on latest rxjs and zone.js
|
||||
|
||||
The version in our package.json gets copied to the one we publish, and users need the latest of these.
|
||||
```
|
||||
@@ -200,8 +200,8 @@ Must be one of the following:
|
||||
* **build**: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
|
||||
* **ci**: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
|
||||
* **docs**: Documentation only changes
|
||||
* **feat**: A new feature
|
||||
* **fix**: A bug fix
|
||||
* **feature**: A new feature
|
||||
* **bugfix**: A bug fix
|
||||
* **perf**: A code change that improves performance
|
||||
* **refactor**: A code change that neither fixes a bug nor adds a feature
|
||||
* **style**: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
|
||||
@@ -214,7 +214,7 @@ The following is the list of supported scopes:
|
||||
|
||||
* **common**
|
||||
* **core**
|
||||
* **examples**
|
||||
* **sample**
|
||||
* **microservices**
|
||||
* **testing**
|
||||
* **websockets**
|
||||
@@ -223,7 +223,7 @@ There are currently a few exceptions to the "use package name" rule:
|
||||
|
||||
* **packaging**: used for changes that change the npm package layout in all of our packages, e.g. public path changes, package.json changes done to all packages, d.ts file/format changes, changes to bundles, etc.
|
||||
* **changelog**: used for updating the release notes in CHANGELOG.md
|
||||
* **examples/#**: for the example apps directory, replacing # with the example app number
|
||||
* **sample/#**: for the example apps directory, replacing # with the example app number
|
||||
<!-- * **aio**: used for docs-app (angular.io) related changes within the /aio directory of the repo -->
|
||||
* none/empty string: useful for `style`, `test` and `refactor` changes that are done across all packages (e.g. `style: add missing semicolons`)
|
||||
|
||||
|
||||
64
Readme.md
64
Readme.md
@@ -14,7 +14,7 @@
|
||||
<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#7" 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>
|
||||
@@ -37,7 +37,8 @@
|
||||
|
||||
## Getting started
|
||||
|
||||
To check out the [guide](https://docs.nestjs.com), visit [docs.nestjs.com](https://docs.nestjs.com). :books:
|
||||
* To check out the [guide](https://docs.nestjs.com), visit [docs.nestjs.com](https://docs.nestjs.com). :books:
|
||||
* 要查看中文 [指南](readme_zh.md), 请访问 [docs.nestjs.cn](https://docs.nestjs.cn). :books:
|
||||
|
||||
## Support
|
||||
|
||||
@@ -45,58 +46,23 @@ Nest is an MIT-licensed open source project. It can grow thanks to the sponsors
|
||||
|
||||
#### Principal Sponsor
|
||||
|
||||
<a href="https://valor-software.com/"><img src="https://docs.nestjs.com/assets/sponsors/valor-software.png" width="300" /></a>
|
||||
<a href="https://valor-software.com/"><img src="https://docs.nestjs.com/assets/sponsors/valor-software.png" width="320" /></a>
|
||||
|
||||
#### Gold Sponsors
|
||||
|
||||
<a href="http://xtremis.com/"><img src="https://nestjs.com/img/logo-xtremis.svg" width="220" /></a>
|
||||
|
||||
#### Silver Sponsors
|
||||
|
||||
<a href="https://neoteric.eu/"><img src="https://nestjs.com/img/neoteric-cut.png" width="120" /></a> <a href="https://www.swingdev.io"><img src="https://nestjs.com/img/swingdev-logo.svg#1" width="150" /></a>
|
||||
|
||||
#### Sponsors
|
||||
|
||||
<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>
|
||||
<a href="https://scal.io"><img src="https://nestjs.com/img/scalio-logo.svg" width="110" /></a> <a href="http://angularity.io"><img src="http://angularity.io/media/logo.svg" height="30" /></a> <a href="http://gojob.com"><img src="https://gojob.com/w/wp-content/uploads/2017/02/cropped-Logo-web-home.png" height="40" /> <!--<a href="https://keycdn.com"><img src="https://nestjs.com/img/keycdn.svg" height="30" /></a> --> <a href="https://hostpresto.com"><img src="https://nestjs.com/img/hostpresto.png" height="30" /></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>
|
||||
<a href="https://opencollective.com/nest/backer/2/website" target="_blank"><img src="https://opencollective.com/nest/backer/2/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/3/website" target="_blank"><img src="https://opencollective.com/nest/backer/3/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/4/website" target="_blank"><img src="https://opencollective.com/nest/backer/4/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/5/website" target="_blank"><img src="https://opencollective.com/nest/backer/5/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/6/website" target="_blank"><img src="https://opencollective.com/nest/backer/6/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/7/website" target="_blank"><img src="https://opencollective.com/nest/backer/7/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/8/website" target="_blank"><img src="https://opencollective.com/nest/backer/8/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/9/website" target="_blank"><img src="https://opencollective.com/nest/backer/9/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/10/website" target="_blank"><img src="https://opencollective.com/nest/backer/10/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/11/website" target="_blank"><img src="https://opencollective.com/nest/backer/11/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/12/website" target="_blank"><img src="https://opencollective.com/nest/backer/12/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/13/website" target="_blank"><img src="https://opencollective.com/nest/backer/13/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/14/website" target="_blank"><img src="https://opencollective.com/nest/backer/14/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/15/website" target="_blank"><img src="https://opencollective.com/nest/backer/15/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/16/website" target="_blank"><img src="https://opencollective.com/nest/backer/16/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/17/website" target="_blank"><img src="https://opencollective.com/nest/backer/17/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/18/website" target="_blank"><img src="https://opencollective.com/nest/backer/18/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/19/website" target="_blank"><img src="https://opencollective.com/nest/backer/19/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/20/website" target="_blank"><img src="https://opencollective.com/nest/backer/20/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/21/website" target="_blank"><img src="https://opencollective.com/nest/backer/21/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/22/website" target="_blank"><img src="https://opencollective.com/nest/backer/22/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/23/website" target="_blank"><img src="https://opencollective.com/nest/backer/23/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/24/website" target="_blank"><img src="https://opencollective.com/nest/backer/24/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/25/website" target="_blank"><img src="https://opencollective.com/nest/backer/25/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/26/website" target="_blank"><img src="https://opencollective.com/nest/backer/26/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/27/website" target="_blank"><img src="https://opencollective.com/nest/backer/27/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/28/website" target="_blank"><img src="https://opencollective.com/nest/backer/28/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/29/website" target="_blank"><img src="https://opencollective.com/nest/backer/29/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/30/website" target="_blank"><img src="https://opencollective.com/nest/backer/30/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/31/website" target="_blank"><img src="https://opencollective.com/nest/backer/31/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/32/website" target="_blank"><img src="https://opencollective.com/nest/backer/32/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/33/website" target="_blank"><img src="https://opencollective.com/nest/backer/33/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/34/website" target="_blank"><img src="https://opencollective.com/nest/backer/34/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/35/website" target="_blank"><img src="https://opencollective.com/nest/backer/35/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/36/website" target="_blank"><img src="https://opencollective.com/nest/backer/36/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/37/website" target="_blank"><img src="https://opencollective.com/nest/backer/37/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/38/website" target="_blank"><img src="https://opencollective.com/nest/backer/38/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/39/website" target="_blank"><img src="https://opencollective.com/nest/backer/39/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/40/website" target="_blank"><img src="https://opencollective.com/nest/backer/40/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/41/website" target="_blank"><img src="https://opencollective.com/nest/backer/41/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/42/website" target="_blank"><img src="https://opencollective.com/nest/backer/42/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/43/website" target="_blank"><img src="https://opencollective.com/nest/backer/43/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest"><img src="https://opencollective.com/nest/backers.svg?width=890"></a>
|
||||
|
||||
## Stay in touch
|
||||
|
||||
@@ -107,5 +73,3 @@ Nest is an MIT-licensed open source project. It can grow thanks to the sponsors
|
||||
## License
|
||||
|
||||
Nest is [MIT licensed](LICENSE).
|
||||
|
||||
<h4 align="center"> <a href="readme_zh.md">中文说明</a></h4>
|
||||
|
||||
BIN
bundle/.DS_Store
vendored
BIN
bundle/.DS_Store
vendored
Binary file not shown.
@@ -14,7 +14,7 @@
|
||||
<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#7" 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>
|
||||
@@ -37,7 +37,8 @@
|
||||
|
||||
## Getting started
|
||||
|
||||
To check out the [guide](https://docs.nestjs.com), visit [docs.nestjs.com](https://docs.nestjs.com). :books:
|
||||
* To check out the [guide](https://docs.nestjs.com), visit [docs.nestjs.com](https://docs.nestjs.com). :books:
|
||||
* 要查看中文 [指南](readme_zh.md), 请访问 [docs.nestjs.cn](https://docs.nestjs.cn). :books:
|
||||
|
||||
## Support
|
||||
|
||||
@@ -45,58 +46,23 @@ Nest is an MIT-licensed open source project. It can grow thanks to the sponsors
|
||||
|
||||
#### Principal Sponsor
|
||||
|
||||
<a href="https://valor-software.com/"><img src="https://docs.nestjs.com/assets/sponsors/valor-software.png" width="300" /></a>
|
||||
<a href="https://valor-software.com/"><img src="https://docs.nestjs.com/assets/sponsors/valor-software.png" width="320" /></a>
|
||||
|
||||
#### Gold Sponsors
|
||||
|
||||
<a href="http://xtremis.com/"><img src="https://nestjs.com/img/logo-xtremis.svg" width="220" /></a>
|
||||
|
||||
#### Silver Sponsors
|
||||
|
||||
<a href="https://neoteric.eu/"><img src="https://nestjs.com/img/neoteric-cut.png" width="120" /></a> <a href="https://www.swingdev.io"><img src="https://nestjs.com/img/swingdev-logo.svg#1" width="150" /></a>
|
||||
|
||||
#### Sponsors
|
||||
|
||||
<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>
|
||||
<a href="https://scal.io"><img src="https://nestjs.com/img/scalio-logo.svg" width="110" /></a> <a href="http://angularity.io"><img src="http://angularity.io/media/logo.svg" height="30" /></a> <a href="http://gojob.com"><img src="https://gojob.com/w/wp-content/uploads/2017/02/cropped-Logo-web-home.png" height="40" /> <!--<a href="https://keycdn.com"><img src="https://nestjs.com/img/keycdn.svg" height="30" /></a> --> <a href="https://hostpresto.com"><img src="https://nestjs.com/img/hostpresto.png" height="30" /></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>
|
||||
<a href="https://opencollective.com/nest/backer/2/website" target="_blank"><img src="https://opencollective.com/nest/backer/2/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/3/website" target="_blank"><img src="https://opencollective.com/nest/backer/3/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/4/website" target="_blank"><img src="https://opencollective.com/nest/backer/4/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/5/website" target="_blank"><img src="https://opencollective.com/nest/backer/5/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/6/website" target="_blank"><img src="https://opencollective.com/nest/backer/6/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/7/website" target="_blank"><img src="https://opencollective.com/nest/backer/7/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/8/website" target="_blank"><img src="https://opencollective.com/nest/backer/8/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/9/website" target="_blank"><img src="https://opencollective.com/nest/backer/9/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/10/website" target="_blank"><img src="https://opencollective.com/nest/backer/10/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/11/website" target="_blank"><img src="https://opencollective.com/nest/backer/11/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/12/website" target="_blank"><img src="https://opencollective.com/nest/backer/12/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/13/website" target="_blank"><img src="https://opencollective.com/nest/backer/13/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/14/website" target="_blank"><img src="https://opencollective.com/nest/backer/14/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/15/website" target="_blank"><img src="https://opencollective.com/nest/backer/15/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/16/website" target="_blank"><img src="https://opencollective.com/nest/backer/16/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/17/website" target="_blank"><img src="https://opencollective.com/nest/backer/17/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/18/website" target="_blank"><img src="https://opencollective.com/nest/backer/18/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/19/website" target="_blank"><img src="https://opencollective.com/nest/backer/19/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/20/website" target="_blank"><img src="https://opencollective.com/nest/backer/20/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/21/website" target="_blank"><img src="https://opencollective.com/nest/backer/21/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/22/website" target="_blank"><img src="https://opencollective.com/nest/backer/22/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/23/website" target="_blank"><img src="https://opencollective.com/nest/backer/23/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/24/website" target="_blank"><img src="https://opencollective.com/nest/backer/24/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/25/website" target="_blank"><img src="https://opencollective.com/nest/backer/25/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/26/website" target="_blank"><img src="https://opencollective.com/nest/backer/26/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/27/website" target="_blank"><img src="https://opencollective.com/nest/backer/27/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/28/website" target="_blank"><img src="https://opencollective.com/nest/backer/28/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/29/website" target="_blank"><img src="https://opencollective.com/nest/backer/29/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/30/website" target="_blank"><img src="https://opencollective.com/nest/backer/30/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/31/website" target="_blank"><img src="https://opencollective.com/nest/backer/31/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/32/website" target="_blank"><img src="https://opencollective.com/nest/backer/32/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/33/website" target="_blank"><img src="https://opencollective.com/nest/backer/33/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/34/website" target="_blank"><img src="https://opencollective.com/nest/backer/34/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/35/website" target="_blank"><img src="https://opencollective.com/nest/backer/35/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/36/website" target="_blank"><img src="https://opencollective.com/nest/backer/36/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/37/website" target="_blank"><img src="https://opencollective.com/nest/backer/37/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/38/website" target="_blank"><img src="https://opencollective.com/nest/backer/38/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/39/website" target="_blank"><img src="https://opencollective.com/nest/backer/39/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/40/website" target="_blank"><img src="https://opencollective.com/nest/backer/40/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/41/website" target="_blank"><img src="https://opencollective.com/nest/backer/41/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/42/website" target="_blank"><img src="https://opencollective.com/nest/backer/42/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest/backer/43/website" target="_blank"><img src="https://opencollective.com/nest/backer/43/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/nest"><img src="https://opencollective.com/nest/backers.svg?width=890"></a>
|
||||
|
||||
## Stay in touch
|
||||
|
||||
@@ -107,5 +73,3 @@ Nest is an MIT-licensed open source project. It can grow thanks to the sponsors
|
||||
## License
|
||||
|
||||
Nest is [MIT licensed](LICENSE).
|
||||
|
||||
<h4 align="center"> <a href="readme_zh.md">中文说明</a></h4>
|
||||
|
||||
49
bundle/common/constants.d.ts
vendored
49
bundle/common/constants.d.ts
vendored
@@ -1,25 +1,28 @@
|
||||
export declare const metadata: {
|
||||
MODULES: string;
|
||||
IMPORTS: string;
|
||||
COMPONENTS: string;
|
||||
PROVIDERS: string;
|
||||
CONTROLLERS: string;
|
||||
EXPORTS: string;
|
||||
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 = '__gatewayMiddlewares';
|
||||
export declare const MODULE_PATH = '__module_path__';
|
||||
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 OPTIONAL_DEPS_METADATA = "optional: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__";
|
||||
|
||||
@@ -13,6 +13,7 @@ exports.GLOBAL_MODULE_METADATA = '__globalModule__';
|
||||
exports.PATH_METADATA = 'path';
|
||||
exports.PARAMTYPES_METADATA = 'design:paramtypes';
|
||||
exports.SELF_DECLARED_DEPS_METADATA = 'self:paramtypes';
|
||||
exports.OPTIONAL_DEPS_METADATA = 'optional:paramtypes';
|
||||
exports.METHOD_METADATA = 'method';
|
||||
exports.ROUTE_ARGS_METADATA = '__routeArguments__';
|
||||
exports.CUSTOM_ROUTE_AGRS_METADATA = '__customRouteArgs__';
|
||||
@@ -23,5 +24,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__';
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'reflect-metadata';
|
||||
import { Type } from '../../interfaces';
|
||||
/**
|
||||
* 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;
|
||||
export declare function Catch(...exceptions: Type<any>[]): ClassDecorator;
|
||||
|
||||
@@ -4,23 +4,28 @@
|
||||
*/
|
||||
export declare function Injectable(): ClassDecorator;
|
||||
/**
|
||||
* @deprecated
|
||||
* Defines the Component. The component can inject dependencies through constructor.
|
||||
* Those dependencies have to belong to the same module.
|
||||
*/
|
||||
export declare function Component(): ClassDecorator;
|
||||
/**
|
||||
* @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;
|
||||
|
||||
@@ -10,6 +10,7 @@ function Injectable() {
|
||||
}
|
||||
exports.Injectable = Injectable;
|
||||
/**
|
||||
* @deprecated
|
||||
* Defines the Component. The component can inject dependencies through constructor.
|
||||
* Those dependencies have to belong to the same module.
|
||||
*/
|
||||
@@ -19,13 +20,16 @@ function Component() {
|
||||
}
|
||||
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() {
|
||||
@@ -34,6 +38,7 @@ function Guard() {
|
||||
}
|
||||
exports.Guard = Guard;
|
||||
/**
|
||||
* @deprecated
|
||||
* Defines the Middleware. The Middleware should implement the `NestMiddleware` interface.
|
||||
*/
|
||||
function Middleware() {
|
||||
@@ -42,6 +47,7 @@ function Middleware() {
|
||||
}
|
||||
exports.Middleware = Middleware;
|
||||
/**
|
||||
* @deprecated
|
||||
* Defines the Interceptor. The Interceptor should implement `HttpInterceptor`, `RpcInterceptor` or `WsInterceptor` interface.
|
||||
*/
|
||||
function Interceptor() {
|
||||
@@ -49,12 +55,12 @@ function Interceptor() {
|
||||
return (target) => { };
|
||||
}
|
||||
exports.Interceptor = Interceptor;
|
||||
let offset = Math.random() * 100;
|
||||
function mixin(mixinClass) {
|
||||
this.offset = this.offset ? ++this.offset : Math.random() * 100;
|
||||
Object.defineProperty(mixinClass, 'name', {
|
||||
value: JSON.stringify(this.offset),
|
||||
value: JSON.stringify(offset++),
|
||||
});
|
||||
Component()(mixinClass);
|
||||
Injectable()(mixinClass);
|
||||
return mixinClass;
|
||||
}
|
||||
exports.mixin = mixin;
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
import 'reflect-metadata';
|
||||
export declare function flatten(arr: any): any;
|
||||
export declare function flatten(arr: any[]): any;
|
||||
export declare const Dependencies: (...dependencies: any[]) => ClassDecorator;
|
||||
|
||||
@@ -7,7 +7,6 @@ function flatten(arr) {
|
||||
return flat.some(Array.isArray) ? flatten(flat) : flat;
|
||||
}
|
||||
exports.flatten = flatten;
|
||||
;
|
||||
exports.Dependencies = (...dependencies) => {
|
||||
const flattenDeps = flatten(dependencies);
|
||||
return (target) => {
|
||||
|
||||
@@ -8,6 +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;
|
||||
|
||||
@@ -2,13 +2,19 @@
|
||||
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) {
|
||||
Reflect.defineMetadata(constants_1.EXCEPTION_FILTERS_METADATA, filters, descriptor.value);
|
||||
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;
|
||||
}
|
||||
Reflect.defineMetadata(constants_1.EXCEPTION_FILTERS_METADATA, filters, target);
|
||||
validate_each_util_1.validateEach(target, filters, isFilterValid, '@UseFilters', 'filter');
|
||||
extend_metadata_util_1.extendArrayMetadata(constants_1.EXCEPTION_FILTERS_METADATA, filters, target);
|
||||
return target;
|
||||
};
|
||||
};
|
||||
@@ -20,6 +26,6 @@ const defineFiltersMetadata = (...filters) => {
|
||||
* 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
|
||||
*/
|
||||
exports.UseFilters = (...filters) => defineFiltersMetadata(...filters);
|
||||
|
||||
21
bundle/common/decorators/core/index.d.ts
vendored
21
bundle/common/decorators/core/index.d.ts
vendored
@@ -1,11 +1,12 @@
|
||||
export * from './controller.decorator';
|
||||
export * from './component.decorator';
|
||||
export * from './dependencies.decorator';
|
||||
export * from './inject.decorator';
|
||||
export * from './catch.decorator';
|
||||
export * from './exception-filters.decorator';
|
||||
export * from './use-pipes.decorator';
|
||||
export * from './use-guards.decorator';
|
||||
export * from './reflect-metadata.decorator';
|
||||
export * from './use-interceptors.decorator';
|
||||
export * from './bind.decorator';
|
||||
export * from './catch.decorator';
|
||||
export * from './component.decorator';
|
||||
export * from './controller.decorator';
|
||||
export * from './dependencies.decorator';
|
||||
export * from './exception-filters.decorator';
|
||||
export * from './inject.decorator';
|
||||
export * from './optional.decorator';
|
||||
export * from './reflect-metadata.decorator';
|
||||
export * from './use-guards.decorator';
|
||||
export * from './use-interceptors.decorator';
|
||||
export * from './use-pipes.decorator';
|
||||
|
||||
@@ -3,14 +3,15 @@ function __export(m) {
|
||||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
||||
}
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
__export(require("./controller.decorator"));
|
||||
__export(require("./component.decorator"));
|
||||
__export(require("./dependencies.decorator"));
|
||||
__export(require("./inject.decorator"));
|
||||
__export(require("./catch.decorator"));
|
||||
__export(require("./exception-filters.decorator"));
|
||||
__export(require("./use-pipes.decorator"));
|
||||
__export(require("./use-guards.decorator"));
|
||||
__export(require("./reflect-metadata.decorator"));
|
||||
__export(require("./use-interceptors.decorator"));
|
||||
__export(require("./bind.decorator"));
|
||||
__export(require("./catch.decorator"));
|
||||
__export(require("./component.decorator"));
|
||||
__export(require("./controller.decorator"));
|
||||
__export(require("./dependencies.decorator"));
|
||||
__export(require("./exception-filters.decorator"));
|
||||
__export(require("./inject.decorator"));
|
||||
__export(require("./optional.decorator"));
|
||||
__export(require("./reflect-metadata.decorator"));
|
||||
__export(require("./use-guards.decorator"));
|
||||
__export(require("./use-interceptors.decorator"));
|
||||
__export(require("./use-pipes.decorator"));
|
||||
|
||||
@@ -3,4 +3,4 @@ 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;
|
||||
export declare function Inject<T = any>(token: T): ParameterDecorator;
|
||||
|
||||
5
bundle/common/decorators/core/optional.decorator.d.ts
vendored
Normal file
5
bundle/common/decorators/core/optional.decorator.d.ts
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import 'reflect-metadata';
|
||||
/**
|
||||
* Sets dependency as an optional one.
|
||||
*/
|
||||
export declare function Optional(): ParameterDecorator;
|
||||
14
bundle/common/decorators/core/optional.decorator.js
Normal file
14
bundle/common/decorators/core/optional.decorator.js
Normal file
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
require("reflect-metadata");
|
||||
const constants_1 = require("../../constants");
|
||||
/**
|
||||
* Sets dependency as an optional one.
|
||||
*/
|
||||
function Optional() {
|
||||
return (target, key, index) => {
|
||||
const args = Reflect.getMetadata(constants_1.OPTIONAL_DEPS_METADATA, target) || [];
|
||||
Reflect.defineMetadata(constants_1.OPTIONAL_DEPS_METADATA, [...args, index], target);
|
||||
};
|
||||
}
|
||||
exports.Optional = Optional;
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Assigns the metadata to the class / function under specified `key`.
|
||||
* 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;
|
||||
export declare const ReflectMetadata: <K = any, V = any>(metadataKey: K, metadataValue: V) => (target: object, key?: any, descriptor?: any) => any;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
/**
|
||||
* Assigns the metadata to the class / function under specified `key`.
|
||||
* Assigns the metadata to the class/function under specified `key`.
|
||||
* This metadata can be reflected using `Reflector` class.
|
||||
*/
|
||||
exports.ReflectMetadata = (metadataKey, metadataValue) => (target, key, descriptor) => {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { CanActivate } from '../../interfaces';
|
||||
/**
|
||||
* Binds guards to the particular context.
|
||||
* When the `@UseGuards()` is used on the controller level:
|
||||
@@ -6,6 +7,6 @@
|
||||
* When the `@UseGuards()` is used on the handler level:
|
||||
* - Guard will be registered only to specified method
|
||||
*
|
||||
* @param {} ...guards (types)
|
||||
* @param {} ...guards
|
||||
*/
|
||||
export declare function UseGuards(...guards: any[]): (target: object, key?: any, descriptor?: any) => any;
|
||||
export declare function UseGuards(...guards: (CanActivate | Function)[]): (target: any, key?: any, descriptor?: any) => any;
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
"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:
|
||||
@@ -9,15 +12,18 @@ const constants_1 = require("../../constants");
|
||||
* When the `@UseGuards()` is used on the handler level:
|
||||
* - Guard will be registered only to specified method
|
||||
*
|
||||
* @param {} ...guards (types)
|
||||
* @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) {
|
||||
Reflect.defineMetadata(constants_1.GUARDS_METADATA, guards, descriptor.value);
|
||||
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;
|
||||
}
|
||||
Reflect.defineMetadata(constants_1.GUARDS_METADATA, guards, target);
|
||||
validate_each_util_1.validateEach(target, guards, isValidGuard, '@UseGuards', 'guard');
|
||||
extend_metadata_util_1.extendArrayMetadata(constants_1.GUARDS_METADATA, guards, target);
|
||||
return target;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { NestInterceptor } from '../../interfaces';
|
||||
/**
|
||||
* Binds interceptors to the particular context.
|
||||
* When the `@UseInterceptors()` is used on the controller level:
|
||||
@@ -6,6 +7,6 @@
|
||||
* When the `@UseInterceptors()` is used on the handle level:
|
||||
* - Interceptor will be registered only to specified method
|
||||
*
|
||||
* @param {} ...interceptors (types)
|
||||
* @param {} ...interceptors
|
||||
*/
|
||||
export declare function UseInterceptors(...interceptors: any[]): (target: object, key?: any, descriptor?: any) => any;
|
||||
export declare function UseInterceptors(...interceptors: (NestInterceptor | Function)[]): (target: any, key?: any, descriptor?: any) => any;
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
"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:
|
||||
@@ -9,15 +12,19 @@ const constants_1 = require("../../constants");
|
||||
* When the `@UseInterceptors()` is used on the handle level:
|
||||
* - Interceptor will be registered only to specified method
|
||||
*
|
||||
* @param {} ...interceptors (types)
|
||||
* @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) {
|
||||
Reflect.defineMetadata(constants_1.INTERCEPTORS_METADATA, interceptors, descriptor.value);
|
||||
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;
|
||||
}
|
||||
Reflect.defineMetadata(constants_1.INTERCEPTORS_METADATA, interceptors, target);
|
||||
validate_each_util_1.validateEach(target, interceptors, isValidInterceptor, '@UseInterceptors', 'interceptor');
|
||||
extend_metadata_util_1.extendArrayMetadata(constants_1.INTERCEPTORS_METADATA, interceptors, target);
|
||||
return target;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -7,6 +7,6 @@ import { PipeTransform } from '../../interfaces/index';
|
||||
* When the `@UsePipes()` is used on the handle level:
|
||||
* - Pipe will be registered only to specified method
|
||||
*
|
||||
* @param {PipeTransform[]} ...pipes (instances)
|
||||
* @param {PipeTransform[]} ...pipes
|
||||
*/
|
||||
export declare function UsePipes(...pipes: PipeTransform<any>[]): (target: object, key?: any, descriptor?: any) => any;
|
||||
export declare function UsePipes(...pipes: (PipeTransform | Function)[]): (target: any, key?: any, descriptor?: any) => any;
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
"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:
|
||||
@@ -9,15 +12,17 @@ const constants_1 = require("../../constants");
|
||||
* When the `@UsePipes()` is used on the handle level:
|
||||
* - Pipe will be registered only to specified method
|
||||
*
|
||||
* @param {PipeTransform[]} ...pipes (instances)
|
||||
* @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) {
|
||||
Reflect.defineMetadata(constants_1.PIPES_METADATA, pipes, descriptor.value);
|
||||
extend_metadata_util_1.extendArrayMetadata(constants_1.PIPES_METADATA, pipes, descriptor.value);
|
||||
return descriptor;
|
||||
}
|
||||
Reflect.defineMetadata(constants_1.PIPES_METADATA, pipes, target);
|
||||
validate_each_util_1.validateEach(target, pipes, isPipeValid, '@UsePipes', 'pipe');
|
||||
extend_metadata_util_1.extendArrayMetadata(constants_1.PIPES_METADATA, pipes, target);
|
||||
return target;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
import { CustomParamFactory } from '../../interfaces/features/custom-route-param-factory.interface';
|
||||
import { PipeTransform } from '../../index';
|
||||
import { Type } from '../../interfaces';
|
||||
import { CustomParamFactory } from '../../interfaces/features/custom-route-param-factory.interface';
|
||||
export declare type ParamDecoratorEnhancer = ParameterDecorator;
|
||||
/**
|
||||
* Creates HTTP route param decorator
|
||||
* Defines HTTP route param decorator
|
||||
* @param factory
|
||||
*/
|
||||
export declare function createParamDecorator(factory: CustomParamFactory): (data?: any, ...pipes: PipeTransform<any>[]) => ParameterDecorator;
|
||||
export declare function createParamDecorator(factory: CustomParamFactory, enhancers?: ParamDecoratorEnhancer[]): (...dataOrPipes: (Type<PipeTransform> | PipeTransform | string)[]) => ParameterDecorator;
|
||||
/**
|
||||
* Creates route params custom decorator
|
||||
* Defines HTTP route param decorator
|
||||
* @deprecated
|
||||
* @param factory
|
||||
*/
|
||||
export declare function createRouteParamDecorator(factory: CustomParamFactory): (data?: any, ...pipes: PipeTransform<any>[]) => ParameterDecorator;
|
||||
export declare function createRouteParamDecorator(factory: CustomParamFactory): (data?: any, ...pipes: (Type<PipeTransform> | PipeTransform)[]) => ParameterDecorator;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const deprecate = require("deprecate");
|
||||
const constants_1 = require("../../constants");
|
||||
const shared_utils_1 = require("../../utils/shared.utils");
|
||||
const assignCustomMetadata = (args, paramtype, index, factory, data, ...pipes) => (Object.assign({}, args, { [`${paramtype}${constants_1.CUSTOM_ROUTE_AGRS_METADATA}:${index}`]: {
|
||||
index,
|
||||
factory,
|
||||
@@ -12,19 +13,23 @@ const randomString = () => Math.random()
|
||||
.toString(36)
|
||||
.substring(2, 15);
|
||||
/**
|
||||
* Creates HTTP route param decorator
|
||||
* Defines HTTP route param decorator
|
||||
* @param factory
|
||||
*/
|
||||
function createParamDecorator(factory) {
|
||||
function createParamDecorator(factory, enhancers = []) {
|
||||
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);
|
||||
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, assignCustomMetadata(args, paramtype, index, factory, paramData, ...paramPipes), target.constructor, key);
|
||||
enhancers.forEach(fn => fn(target, key, index));
|
||||
};
|
||||
}
|
||||
exports.createParamDecorator = createParamDecorator;
|
||||
/**
|
||||
* Creates route params custom decorator
|
||||
* Defines HTTP route param decorator
|
||||
* @deprecated
|
||||
* @param factory
|
||||
*/
|
||||
|
||||
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
bundle/common/decorators/http/index.d.ts
vendored
1
bundle/common/decorators/http/index.d.ts
vendored
@@ -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"));
|
||||
|
||||
5
bundle/common/decorators/http/redirect.decorator.d.ts
vendored
Normal file
5
bundle/common/decorators/http/redirect.decorator.d.ts
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
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,6 @@
|
||||
import 'reflect-metadata';
|
||||
import { PipeTransform } from '../../index';
|
||||
import { Type } from '../../interfaces';
|
||||
export declare type ParamData = object | string | number;
|
||||
export interface RouteParamsMetadata {
|
||||
[prop: number]: {
|
||||
@@ -11,17 +12,17 @@ export declare const Request: () => ParameterDecorator;
|
||||
export declare const Response: () => ParameterDecorator;
|
||||
export declare const Next: () => ParameterDecorator;
|
||||
export declare const Session: () => ParameterDecorator;
|
||||
export declare const UploadedFile: () => ParameterDecorator;
|
||||
export declare const UploadedFile: (fileKey?: string) => 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);
|
||||
|
||||
@@ -6,8 +6,7 @@ import { ModuleMetadata } from '../../interfaces/modules/module-metadata.interfa
|
||||
* - `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
|
||||
* - `modules` - @deprecated the set of the 'imported' modules
|
||||
* - `components` - @deprecated the list of components that belong to this module. They can be injected between themselves.
|
||||
* @param obj {ModuleMetadata} Module metadata
|
||||
* @param options {ModuleMetadata} Module metadata
|
||||
*/
|
||||
export declare function Module(obj: ModuleMetadata): ClassDecorator;
|
||||
export declare function Module(metadata: ModuleMetadata): ClassDecorator;
|
||||
|
||||
@@ -28,35 +28,34 @@ const validateKeys = (keys) => {
|
||||
* - `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
|
||||
* - `modules` - @deprecated the set of the 'imported' modules
|
||||
* - `components` - @deprecated the list of components that belong to this module. They can be injected between themselves.
|
||||
* @param obj {ModuleMetadata} Module metadata
|
||||
* @param options {ModuleMetadata} Module metadata
|
||||
*/
|
||||
function Module(obj) {
|
||||
const propsKeys = Object.keys(obj);
|
||||
function Module(metadata) {
|
||||
const propsKeys = Object.keys(metadata);
|
||||
validateKeys(propsKeys);
|
||||
showDeprecatedWarnings(obj);
|
||||
overrideModuleMetadata(obj);
|
||||
showDeprecatedWarnings(metadata);
|
||||
overrideModuleMetadata(metadata);
|
||||
return (target) => {
|
||||
for (const property in obj) {
|
||||
if (obj.hasOwnProperty(property)) {
|
||||
Reflect.defineMetadata(property, obj[property], target);
|
||||
for (const property in metadata) {
|
||||
if (metadata.hasOwnProperty(property)) {
|
||||
Reflect.defineMetadata(property, metadata[property], target);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
exports.Module = Module;
|
||||
function overrideModuleMetadata(metadata) {
|
||||
metadata.modules = metadata.imports
|
||||
? metadata.imports
|
||||
: metadata.modules;
|
||||
metadata.components = metadata.providers
|
||||
? metadata.providers
|
||||
: metadata.components;
|
||||
function overrideModuleMetadata(moduleMetadata) {
|
||||
moduleMetadata.modules = moduleMetadata.imports
|
||||
? moduleMetadata.imports
|
||||
: moduleMetadata.modules;
|
||||
moduleMetadata.components = moduleMetadata.providers
|
||||
? moduleMetadata.providers
|
||||
: moduleMetadata.components;
|
||||
}
|
||||
function showDeprecatedWarnings(metadata) {
|
||||
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.';
|
||||
metadata.modules && deprecate(modulesDeprecatedWarning);
|
||||
metadata.components && deprecate(componentsDeprecatetWarning);
|
||||
moduleMetadata.modules && deprecate(modulesDeprecatedWarning);
|
||||
moduleMetadata.components && deprecate(componentsDeprecatetWarning);
|
||||
}
|
||||
|
||||
3
bundle/common/enums/transport.enum.d.ts
vendored
3
bundle/common/enums/transport.enum.d.ts
vendored
@@ -1,4 +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 = {}));
|
||||
|
||||
7
bundle/common/exceptions/http.exception.d.ts
vendored
7
bundle/common/exceptions/http.exception.d.ts
vendored
@@ -3,13 +3,8 @@ export declare class HttpException extends Error {
|
||||
private readonly status;
|
||||
readonly message: any;
|
||||
/**
|
||||
<<<<<<< HEAD
|
||||
* 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.
|
||||
=======
|
||||
* 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.
|
||||
>>>>>>> master
|
||||
* 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,
|
||||
|
||||
@@ -2,13 +2,8 @@
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
class HttpException extends Error {
|
||||
/**
|
||||
<<<<<<< HEAD
|
||||
* 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.
|
||||
=======
|
||||
* 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.
|
||||
>>>>>>> master
|
||||
* 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
bundle/common/http/http.constants.d.ts
vendored
Normal file
1
bundle/common/http/http.constants.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export declare const AXIOS_INSTANCE_TOKEN = "AXIOS_INSTANCE_TOKEN";
|
||||
3
bundle/common/http/http.constants.js
Normal file
3
bundle/common/http/http.constants.js
Normal file
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.AXIOS_INSTANCE_TOKEN = 'AXIOS_INSTANCE_TOKEN';
|
||||
3
bundle/common/http/http.module.d.ts
vendored
3
bundle/common/http/http.module.d.ts
vendored
@@ -1,2 +1,5 @@
|
||||
import { AxiosRequestConfig } from 'axios';
|
||||
import { DynamicModule } from '../interfaces';
|
||||
export declare class HttpModule {
|
||||
static register(config: AxiosRequestConfig): DynamicModule;
|
||||
}
|
||||
|
||||
@@ -6,14 +6,29 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const axios_1 = require("axios");
|
||||
const module_decorator_1 = require("../decorators/modules/module.decorator");
|
||||
const http_constants_1 = require("./http.constants");
|
||||
const http_service_1 = require("./http.service");
|
||||
let HttpModule = class HttpModule {
|
||||
let HttpModule = HttpModule_1 = class HttpModule {
|
||||
static register(config) {
|
||||
return {
|
||||
module: HttpModule_1,
|
||||
providers: [{
|
||||
provide: http_constants_1.AXIOS_INSTANCE_TOKEN,
|
||||
useValue: axios_1.default.create(config),
|
||||
}],
|
||||
};
|
||||
}
|
||||
};
|
||||
HttpModule = __decorate([
|
||||
HttpModule = HttpModule_1 = __decorate([
|
||||
module_decorator_1.Module({
|
||||
components: [http_service_1.HttpService],
|
||||
providers: [http_service_1.HttpService, {
|
||||
provide: http_constants_1.AXIOS_INSTANCE_TOKEN,
|
||||
useValue: axios_1.default,
|
||||
}],
|
||||
exports: [http_service_1.HttpService],
|
||||
})
|
||||
], HttpModule);
|
||||
exports.HttpModule = HttpModule;
|
||||
var HttpModule_1;
|
||||
|
||||
7
bundle/common/http/http.service.d.ts
vendored
7
bundle/common/http/http.service.d.ts
vendored
@@ -1,6 +1,8 @@
|
||||
import { AxiosRequestConfig, AxiosResponse } from 'axios';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios';
|
||||
import { Observable } from 'rxjs';
|
||||
export declare class HttpService {
|
||||
private readonly instance;
|
||||
constructor(instance?: AxiosInstance);
|
||||
request<T = any>(config: AxiosRequestConfig): Observable<AxiosResponse<T>>;
|
||||
get<T = any>(url: string, config?: AxiosRequestConfig): Observable<AxiosResponse<T>>;
|
||||
delete<T = any>(url: string, config?: AxiosRequestConfig): Observable<AxiosResponse<T>>;
|
||||
@@ -8,4 +10,5 @@ export declare class HttpService {
|
||||
post<T = any>(url: string, data?: any, config?: AxiosRequestConfig): Observable<AxiosResponse<T>>;
|
||||
put<T = any>(url: string, data?: any, config?: AxiosRequestConfig): Observable<AxiosResponse<T>>;
|
||||
patch<T = any>(url: string, data?: any, config?: AxiosRequestConfig): Observable<AxiosResponse<T>>;
|
||||
readonly axiosRef: AxiosInstance;
|
||||
}
|
||||
|
||||
@@ -1,28 +1,52 @@
|
||||
"use strict";
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
var __metadata = (this && this.__metadata) || function (k, v) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
||||
};
|
||||
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
||||
return function (target, key) { decorator(target, key, paramIndex); }
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const axios_1 = require("axios");
|
||||
const fromPromise_1 = require("rxjs/observable/fromPromise");
|
||||
class HttpService {
|
||||
const rxjs_1 = require("rxjs");
|
||||
const decorators_1 = require("../decorators");
|
||||
const http_constants_1 = require("./http.constants");
|
||||
let HttpService = class HttpService {
|
||||
constructor(instance = axios_1.default) {
|
||||
this.instance = instance;
|
||||
}
|
||||
request(config) {
|
||||
return fromPromise_1.fromPromise(axios_1.default.request(config));
|
||||
return rxjs_1.defer(() => this.instance.request(config));
|
||||
}
|
||||
get(url, config) {
|
||||
return fromPromise_1.fromPromise(axios_1.default.get(url, config));
|
||||
return rxjs_1.defer(() => this.instance.get(url, config));
|
||||
}
|
||||
delete(url, config) {
|
||||
return fromPromise_1.fromPromise(axios_1.default.delete(url, config));
|
||||
return rxjs_1.defer(() => this.instance.delete(url, config));
|
||||
}
|
||||
head(url, config) {
|
||||
return fromPromise_1.fromPromise(axios_1.default.head(url, config));
|
||||
return rxjs_1.defer(() => this.instance.head(url, config));
|
||||
}
|
||||
post(url, data, config) {
|
||||
return fromPromise_1.fromPromise(axios_1.default.post(url, data, config));
|
||||
return rxjs_1.defer(() => this.instance.post(url, data, config));
|
||||
}
|
||||
put(url, data, config) {
|
||||
return fromPromise_1.fromPromise(axios_1.default.post(url, data, config));
|
||||
return rxjs_1.defer(() => this.instance.put(url, data, config));
|
||||
}
|
||||
patch(url, data, config) {
|
||||
return fromPromise_1.fromPromise(axios_1.default.post(url, data, config));
|
||||
return rxjs_1.defer(() => this.instance.patch(url, data, config));
|
||||
}
|
||||
}
|
||||
get axiosRef() {
|
||||
return this.instance;
|
||||
}
|
||||
};
|
||||
HttpService = __decorate([
|
||||
__param(0, decorators_1.Inject(http_constants_1.AXIOS_INSTANCE_TOKEN)),
|
||||
__metadata("design:paramtypes", [Object])
|
||||
], HttpService);
|
||||
exports.HttpService = HttpService;
|
||||
|
||||
34
bundle/common/index.d.ts
vendored
34
bundle/common/index.d.ts
vendored
@@ -1,31 +1,9 @@
|
||||
export * from './decorators';
|
||||
export * from './enums';
|
||||
export {
|
||||
NestModule,
|
||||
INestApplication,
|
||||
INestMicroservice,
|
||||
NestMiddleware,
|
||||
FunctionMiddleware,
|
||||
MiddlewaresConsumer,
|
||||
OnModuleInit,
|
||||
ExceptionFilter,
|
||||
WebSocketAdapter,
|
||||
PipeTransform,
|
||||
Paramtype,
|
||||
ArgumentMetadata,
|
||||
OnModuleDestroy,
|
||||
ExecutionContext,
|
||||
CanActivate,
|
||||
RpcExceptionFilter,
|
||||
WsExceptionFilter,
|
||||
NestInterceptor,
|
||||
DynamicModule,
|
||||
INestApplicationContext,
|
||||
HttpServer,
|
||||
HttpServerFactory,
|
||||
} from './interfaces';
|
||||
export * from './interceptors';
|
||||
export * from './services/logger.service';
|
||||
export * from './pipes';
|
||||
export * from './utils';
|
||||
export * from './exceptions';
|
||||
export * from './http';
|
||||
export * from './interceptors';
|
||||
export { ArgumentMetadata, ArgumentsHost, CanActivate, DynamicModule, ExceptionFilter, ExecutionContext, ForwardReference, HttpServer, HttpServerFactory, INestApplication, INestApplicationContext, INestExpressApplication, INestFastifyApplication, INestMicroservice, MiddlewareConsumer, MiddlewareFunction, NestInterceptor, NestMiddleware, NestModule, OnModuleDestroy, OnModuleInit, Paramtype, PipeTransform, Provider, RpcExceptionFilter, Type, WebSocketAdapter, WsExceptionFilter } from './interfaces';
|
||||
export * from './pipes';
|
||||
export * from './services/logger.service';
|
||||
export * from './utils';
|
||||
|
||||
@@ -11,8 +11,9 @@ function __export(m) {
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
__export(require("./decorators"));
|
||||
__export(require("./enums"));
|
||||
__export(require("./interceptors"));
|
||||
__export(require("./services/logger.service"));
|
||||
__export(require("./pipes"));
|
||||
__export(require("./utils"));
|
||||
__export(require("./exceptions"));
|
||||
__export(require("./http"));
|
||||
__export(require("./interceptors"));
|
||||
__export(require("./pipes"));
|
||||
__export(require("./services/logger.service"));
|
||||
__export(require("./utils"));
|
||||
|
||||
2
bundle/common/interceptors/file-fields.interceptor.d.ts
vendored
Normal file
2
bundle/common/interceptors/file-fields.interceptor.d.ts
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import { MulterField, MulterOptions } from '../interfaces/external/multer-options.interface';
|
||||
export declare function FileFieldsInterceptor(uploadFields: MulterField[], options?: MulterOptions): any;
|
||||
25
bundle/common/interceptors/file-fields.interceptor.js
Normal file
25
bundle/common/interceptors/file-fields.interceptor.js
Normal file
@@ -0,0 +1,25 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const multer = require("multer");
|
||||
const component_decorator_1 = require("../decorators/core/component.decorator");
|
||||
const multer_utils_1 = require("./multer/multer.utils");
|
||||
function FileFieldsInterceptor(uploadFields, options) {
|
||||
const Interceptor = component_decorator_1.mixin(class {
|
||||
constructor() {
|
||||
this.upload = multer(options);
|
||||
}
|
||||
async intercept(context, call$) {
|
||||
const ctx = context.switchToHttp();
|
||||
await new Promise((resolve, reject) => this.upload.fields(uploadFields)(ctx.getRequest(), ctx.getResponse(), err => {
|
||||
if (err) {
|
||||
const error = multer_utils_1.transformException(err);
|
||||
return reject(error);
|
||||
}
|
||||
resolve();
|
||||
}));
|
||||
return call$;
|
||||
}
|
||||
});
|
||||
return Interceptor;
|
||||
}
|
||||
exports.FileFieldsInterceptor = FileFieldsInterceptor;
|
||||
@@ -1,12 +1,4 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const multer = require("multer");
|
||||
const component_decorator_1 = require("../decorators/core/component.decorator");
|
||||
@@ -16,17 +8,16 @@ function FileInterceptor(fieldName, options) {
|
||||
constructor() {
|
||||
this.upload = multer(options);
|
||||
}
|
||||
intercept(request, context, stream$) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
yield new Promise((resolve, reject) => this.upload.single(fieldName)(request, request.res, err => {
|
||||
if (err) {
|
||||
const error = multer_utils_1.transformException(err);
|
||||
return reject(error);
|
||||
}
|
||||
resolve();
|
||||
}));
|
||||
return stream$;
|
||||
});
|
||||
async intercept(context, call$) {
|
||||
const ctx = context.switchToHttp();
|
||||
await new Promise((resolve, reject) => this.upload.single(fieldName)(ctx.getRequest(), ctx.getResponse(), err => {
|
||||
if (err) {
|
||||
const error = multer_utils_1.transformException(err);
|
||||
return reject(error);
|
||||
}
|
||||
resolve();
|
||||
}));
|
||||
return call$;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,8 +1,2 @@
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { MulterOptions } from '../interfaces/external/multer-options.interface';
|
||||
export declare function FilesInterceptor(fieldName: string, maxCount?: number, options?: MulterOptions): {
|
||||
new (): {
|
||||
readonly upload: any;
|
||||
intercept(request: any, context: any, stream$: Observable<any>): Promise<Observable<any>>;
|
||||
};
|
||||
};
|
||||
export declare function FilesInterceptor(fieldName: string, maxCount?: number, options?: MulterOptions): any;
|
||||
|
||||
@@ -1,33 +1,25 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const multer = require("multer");
|
||||
const component_decorator_1 = require("../decorators/core/component.decorator");
|
||||
const multer_utils_1 = require("./multer/multer.utils");
|
||||
function FilesInterceptor(fieldName, maxCount, options) {
|
||||
const Interceptor = class {
|
||||
const Interceptor = component_decorator_1.mixin(class {
|
||||
constructor() {
|
||||
this.upload = multer(options);
|
||||
}
|
||||
intercept(request, context, stream$) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
yield new Promise((resolve, reject) => this.upload.array(fieldName, maxCount)(request, request.res, err => {
|
||||
if (err) {
|
||||
const error = multer_utils_1.transformException(err);
|
||||
return reject(error);
|
||||
}
|
||||
resolve();
|
||||
}));
|
||||
return stream$;
|
||||
});
|
||||
async intercept(context, call$) {
|
||||
const ctx = context.switchToHttp();
|
||||
await new Promise((resolve, reject) => this.upload.array(fieldName, maxCount)(ctx.getRequest(), ctx.getResponse(), err => {
|
||||
if (err) {
|
||||
const error = multer_utils_1.transformException(err);
|
||||
return reject(error);
|
||||
}
|
||||
resolve();
|
||||
}));
|
||||
return call$;
|
||||
}
|
||||
};
|
||||
});
|
||||
return Interceptor;
|
||||
}
|
||||
exports.FilesInterceptor = FilesInterceptor;
|
||||
|
||||
1
bundle/common/interceptors/index.d.ts
vendored
1
bundle/common/interceptors/index.d.ts
vendored
@@ -1,2 +1,3 @@
|
||||
export * from './file-fields.interceptor';
|
||||
export * from './file.interceptor';
|
||||
export * from './files.interceptor';
|
||||
|
||||
@@ -3,5 +3,6 @@ function __export(m) {
|
||||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
||||
}
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
__export(require("./file-fields.interceptor"));
|
||||
__export(require("./file.interceptor"));
|
||||
__export(require("./files.interceptor"));
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
import { PayloadTooLargeException, BadRequestException } from './../../exceptions';
|
||||
import { BadRequestException, PayloadTooLargeException } from './../../exceptions';
|
||||
export declare function transformException(error: Error | undefined): Error | BadRequestException | PayloadTooLargeException;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
export interface ExceptionFilter {
|
||||
catch(exception: any, response: any): any;
|
||||
import { ArgumentsHost } from './../features/arguments-host.interface';
|
||||
export interface ExceptionFilter<T = any> {
|
||||
catch(exception: T, host: ArgumentsHost): any;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
export interface RpcExceptionFilter {
|
||||
catch(exception: any): Observable<any>;
|
||||
import { Observable } from 'rxjs';
|
||||
import { ArgumentsHost } from './../features/arguments-host.interface';
|
||||
export interface RpcExceptionFilter<T = any, R = any> {
|
||||
catch(exception: T, host: ArgumentsHost): Observable<R>;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
export interface WsExceptionFilter {
|
||||
catch(exception: any, client: any): any;
|
||||
import { ArgumentsHost } from './../features/arguments-host.interface';
|
||||
export interface WsExceptionFilter<T = any> {
|
||||
catch(exception: T, host: ArgumentsHost): any;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
/**
|
||||
* @see https://github.com/expressjs/cors
|
||||
*/
|
||||
export declare type CustomOrigin = (requestOrigin: string, callback: (err: Error | null, allow?: boolean) => void) => void;
|
||||
export interface CorsOptions {
|
||||
origin?: boolean | string | RegExp | (string | RegExp)[] | CustomOrigin;
|
||||
|
||||
136
bundle/common/interfaces/external/mqtt-options.interface.d.ts
vendored
Normal file
136
bundle/common/interfaces/external/mqtt-options.interface.d.ts
vendored
Normal file
@@ -0,0 +1,136 @@
|
||||
/// <reference types="node" />
|
||||
/**
|
||||
* @see https://github.com/mqttjs/MQTT.js/
|
||||
*/
|
||||
export declare type QoS = 0 | 1 | 2;
|
||||
export interface MqttClientOptions extends ISecureClientOptions {
|
||||
port?: number;
|
||||
host?: string;
|
||||
hostname?: string;
|
||||
path?: string;
|
||||
protocol?: 'wss' | 'ws' | 'mqtt' | 'mqtts' | 'tcp' | 'ssl' | 'wx' | 'wxs';
|
||||
wsOptions?: {
|
||||
[x: string]: any;
|
||||
};
|
||||
/**
|
||||
* 10 seconds, set to 0 to disable
|
||||
*/
|
||||
keepalive?: number;
|
||||
/**
|
||||
* 'mqttjs_' + Math.random().toString(16).substr(2, 8)
|
||||
*/
|
||||
clientId?: string;
|
||||
/**
|
||||
* 'MQTT'
|
||||
*/
|
||||
protocolId?: string;
|
||||
/**
|
||||
* 4
|
||||
*/
|
||||
protocolVersion?: number;
|
||||
/**
|
||||
* true, set to false to receive QoS 1 and 2 messages while offline
|
||||
*/
|
||||
clean?: boolean;
|
||||
/**
|
||||
* 1000 milliseconds, interval between two reconnections
|
||||
*/
|
||||
reconnectPeriod?: number;
|
||||
/**
|
||||
* 30 * 1000 milliseconds, time to wait before a CONNACK is received
|
||||
*/
|
||||
connectTimeout?: number;
|
||||
/**
|
||||
* the username required by your broker, if any
|
||||
*/
|
||||
username?: string;
|
||||
/**
|
||||
* the password required by your broker, if any
|
||||
*/
|
||||
password?: string;
|
||||
/**
|
||||
* a any for the incoming packets
|
||||
*/
|
||||
incomingStore?: any;
|
||||
/**
|
||||
* a any for the outgoing packets
|
||||
*/
|
||||
outgoingStore?: any;
|
||||
queueQoSZero?: boolean;
|
||||
reschedulePings?: boolean;
|
||||
servers?: Array<{
|
||||
host: string;
|
||||
port: number;
|
||||
}>;
|
||||
/**
|
||||
* true, set to false to disable re-subscribe functionality
|
||||
*/
|
||||
resubscribe?: boolean;
|
||||
/**
|
||||
* a message that will sent by the broker automatically when the client disconnect badly.
|
||||
*/
|
||||
will?: {
|
||||
/**
|
||||
* the topic to publish
|
||||
*/
|
||||
topic: string;
|
||||
/**
|
||||
* the message to publish
|
||||
*/
|
||||
payload: string;
|
||||
/**
|
||||
* the QoS
|
||||
*/
|
||||
qos: QoS;
|
||||
/**
|
||||
* the retain flag
|
||||
*/
|
||||
retain: boolean;
|
||||
};
|
||||
transformWsUrl?: (url: string, options: any, client: any) => string;
|
||||
}
|
||||
export interface ISecureClientOptions {
|
||||
/**
|
||||
* optional private keys in PEM format
|
||||
*/
|
||||
key?: string | string[] | Buffer | Buffer[] | Object[];
|
||||
/**
|
||||
* optional cert chains in PEM format
|
||||
*/
|
||||
cert?: string | string[] | Buffer | Buffer[];
|
||||
/**
|
||||
* Optionally override the trusted CA certificates in PEM format
|
||||
*/
|
||||
ca?: string | string[] | Buffer | Buffer[];
|
||||
rejectUnauthorized?: boolean;
|
||||
}
|
||||
export interface IClientPublishOptions {
|
||||
/**
|
||||
* the QoS
|
||||
*/
|
||||
qos: QoS;
|
||||
/**
|
||||
* the retain flag
|
||||
*/
|
||||
retain?: boolean;
|
||||
/**
|
||||
* whether or not mark a message as duplicate
|
||||
*/
|
||||
dup?: boolean;
|
||||
}
|
||||
export interface IClientSubscribeOptions {
|
||||
/**
|
||||
* the QoS
|
||||
*/
|
||||
qos: QoS;
|
||||
}
|
||||
export interface IClientReconnectOptions {
|
||||
/**
|
||||
* a any for the incoming packets
|
||||
*/
|
||||
incomingStore?: any;
|
||||
/**
|
||||
* a any for the outgoing packets
|
||||
*/
|
||||
outgoingStore?: any;
|
||||
}
|
||||
2
bundle/common/interfaces/external/mqtt-options.interface.js
vendored
Normal file
2
bundle/common/interfaces/external/mqtt-options.interface.js
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
@@ -1,4 +1,7 @@
|
||||
/// <reference types="node" />
|
||||
/**
|
||||
* @see https://github.com/expressjs/multer
|
||||
*/
|
||||
export interface MulterOptions {
|
||||
dest?: string;
|
||||
/** The storage engine to use for uploaded files. */
|
||||
@@ -46,3 +49,9 @@ export interface MulterOptions {
|
||||
buffer: Buffer;
|
||||
}, callback: (error: Error | null, acceptFile: boolean) => void): void;
|
||||
}
|
||||
export interface MulterField {
|
||||
/** The field name. */
|
||||
name: string;
|
||||
/** Optional maximum number of files per field to accept. */
|
||||
maxCount?: number;
|
||||
}
|
||||
|
||||
60
bundle/common/interfaces/external/serve-static-options.interface.d.ts
vendored
Normal file
60
bundle/common/interfaces/external/serve-static-options.interface.d.ts
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
/**
|
||||
* @see https://www.npmjs.com/package/@types/serve-static
|
||||
*/
|
||||
export interface ServeStaticOptions {
|
||||
/**
|
||||
* Set how "dotfiles" are treated when encountered. A dotfile is a file or directory that begins with a dot (".").
|
||||
* Note this check is done on the path itself without checking if the path actually exists on the disk.
|
||||
* If root is specified, only the dotfiles above the root are checked (i.e. the root itself can be within a dotfile when when set to "deny").
|
||||
* The default value is 'ignore'.
|
||||
* 'allow' No special treatment for dotfiles
|
||||
* 'deny' Send a 403 for any request for a dotfile
|
||||
* 'ignore' Pretend like the dotfile does not exist and call next()
|
||||
*/
|
||||
dotfiles?: string;
|
||||
/**
|
||||
* Enable or disable etag generation, defaults to true.
|
||||
*/
|
||||
etag?: boolean;
|
||||
/**
|
||||
* Set file extension fallbacks. When set, if a file is not found, the given extensions will be added to the file name and search for.
|
||||
* The first that exists will be served. Example: ['html', 'htm'].
|
||||
* The default value is false.
|
||||
*/
|
||||
extensions?: string[];
|
||||
/**
|
||||
* Let client errors fall-through as unhandled requests, otherwise forward a client error.
|
||||
* The default value is false.
|
||||
*/
|
||||
fallthrough?: boolean;
|
||||
/**
|
||||
* Enable or disable the immutable directive in the Cache-Control response header.
|
||||
* If enabled, the maxAge option should also be specified to enable caching. The immutable directive will prevent supported clients from making conditional requests during the life of the maxAge option to check if the file has changed.
|
||||
*/
|
||||
immutable?: boolean;
|
||||
/**
|
||||
* By default this module will send "index.html" files in response to a request on a directory.
|
||||
* To disable this set false or to supply a new index pass a string or an array in preferred order.
|
||||
*/
|
||||
index?: boolean | string | string[];
|
||||
/**
|
||||
* Enable or disable Last-Modified header, defaults to true. Uses the file system's last modified value.
|
||||
*/
|
||||
lastModified?: boolean;
|
||||
/**
|
||||
* Provide a max-age in milliseconds for http caching, defaults to 0. This can also be a string accepted by the ms module.
|
||||
*/
|
||||
maxAge?: number | string;
|
||||
/**
|
||||
* Redirect to trailing "/" when the pathname is a dir. Defaults to true.
|
||||
*/
|
||||
redirect?: boolean;
|
||||
/**
|
||||
* Function to set custom headers on response. Alterations to the headers need to occur synchronously.
|
||||
* The function is called as fn(res, path, stat), where the arguments are:
|
||||
* res the response object
|
||||
* path the file path that is being sent
|
||||
* stat the stat object of the file that is being sent
|
||||
*/
|
||||
setHeaders?: (res, path: string, stat: any) => any;
|
||||
}
|
||||
2
bundle/common/interfaces/external/serve-static-options.interface.js
vendored
Normal file
2
bundle/common/interfaces/external/serve-static-options.interface.js
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
46
bundle/common/interfaces/external/validator-options.interface.d.ts
vendored
Normal file
46
bundle/common/interfaces/external/validator-options.interface.d.ts
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
/**
|
||||
* Options passed to validator during validation.
|
||||
* @see https://github.com/typestack/class-validator
|
||||
*/
|
||||
export interface ValidatorOptions {
|
||||
/**
|
||||
* If set to true than validator will skip validation of all properties that are missing in the validating object.
|
||||
*/
|
||||
skipMissingProperties?: boolean;
|
||||
/**
|
||||
* If set to true validator will strip validated object of any properties that do not have any decorators.
|
||||
*
|
||||
* Tip: if no other decorator is suitable for your property use @Allow decorator.
|
||||
*/
|
||||
whitelist?: boolean;
|
||||
/**
|
||||
* If set to true, instead of stripping non-whitelisted properties validator will throw an error
|
||||
*/
|
||||
forbidNonWhitelisted?: boolean;
|
||||
/**
|
||||
* Groups to be used during validation of the object.
|
||||
*/
|
||||
groups?: string[];
|
||||
/**
|
||||
* If set to true, the validation will not use default messages.
|
||||
* Error message always will be undefined if its not explicitly set.
|
||||
*/
|
||||
dismissDefaultMessages?: boolean;
|
||||
/**
|
||||
* ValidationError special options.
|
||||
*/
|
||||
validationError?: {
|
||||
/**
|
||||
* Indicates if target should be exposed in ValidationError.
|
||||
*/
|
||||
target?: boolean;
|
||||
/**
|
||||
* Indicates if validated value should be exposed in ValidationError.
|
||||
*/
|
||||
value?: boolean;
|
||||
};
|
||||
/**
|
||||
* Setting true will cause fail validation of unknown objects.
|
||||
*/
|
||||
forbidUnknownValues?: boolean;
|
||||
}
|
||||
2
bundle/common/interfaces/external/validator-options.interface.js
vendored
Normal file
2
bundle/common/interfaces/external/validator-options.interface.js
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
18
bundle/common/interfaces/features/arguments-host.interface.d.ts
vendored
Normal file
18
bundle/common/interfaces/features/arguments-host.interface.d.ts
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
export interface HttpArgumentsHost {
|
||||
getRequest<T = any>(): T;
|
||||
getResponse<T = any>(): T;
|
||||
}
|
||||
export interface WsArgumentsHost {
|
||||
getData<T = any>(): T;
|
||||
getClient<T = any>(): T;
|
||||
}
|
||||
export interface RpcArgumentsHost {
|
||||
getData<T = any>(): T;
|
||||
}
|
||||
export interface ArgumentsHost {
|
||||
getArgs<T extends Array<any> = any[]>(): T;
|
||||
getArgByIndex<T = any>(index: number): T;
|
||||
switchToRpc(): RpcArgumentsHost;
|
||||
switchToHttp(): HttpArgumentsHost;
|
||||
switchToWs(): WsArgumentsHost;
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { Observable } from 'rxjs';
|
||||
import { ExecutionContext } from './execution-context.interface';
|
||||
export interface CanActivate {
|
||||
canActivate(request: any, context: ExecutionContext): boolean | Promise<boolean> | Observable<boolean>;
|
||||
canActivate(context: ExecutionContext): boolean | Promise<boolean> | Observable<boolean>;
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
export declare type CustomParamFactory = (data, req) => any;
|
||||
export declare type CustomParamFactory<TData = any, TRequest = any, TResult = any> = (data: TData, req: TRequest) => TResult;
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
export interface ExecutionContext {
|
||||
parent: Function;
|
||||
handler: (...args) => any;
|
||||
import { Type } from './../index';
|
||||
import { ArgumentsHost } from './arguments-host.interface';
|
||||
export interface ExecutionContext extends ArgumentsHost {
|
||||
getClass<T = any>(): Type<T>;
|
||||
getHandler(): Function;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { Observable } from 'rxjs';
|
||||
import { ExecutionContext } from './execution-context.interface';
|
||||
export interface NestInterceptor {
|
||||
intercept(dataOrRequest: any, context: ExecutionContext, stream$: Observable<any>): Observable<any> | Promise<Observable<any>>;
|
||||
export interface NestInterceptor<T = any, R = any> {
|
||||
intercept(context: ExecutionContext, call$: Observable<T>): Observable<R> | Promise<Observable<R>>;
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { Paramtype } from './paramtype.interface';
|
||||
export declare type Transform<T> = (value: T, metadata: ArgumentMetadata) => any;
|
||||
export declare type Transform<T = any> = (value: T, metadata: ArgumentMetadata) => any;
|
||||
export interface ArgumentMetadata {
|
||||
type: Paramtype;
|
||||
metatype?: new (...args) => any;
|
||||
data?: string;
|
||||
readonly type: Paramtype;
|
||||
readonly metatype?: new (...args) => any | undefined;
|
||||
readonly data?: string | undefined;
|
||||
}
|
||||
export interface PipeTransform<T> {
|
||||
transform(value: T, metadata: ArgumentMetadata): any;
|
||||
export interface PipeTransform<T = any, R = any> {
|
||||
transform(value: T, metadata: ArgumentMetadata): R;
|
||||
}
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
/// <reference types="node" />
|
||||
import { IncomingMessage, ServerResponse } from 'http';
|
||||
export interface ErrorHandler {
|
||||
(error: any, req: Partial<IncomingMessage>, res: ServerResponse | any, next?: Function): any;
|
||||
}
|
||||
export interface RequestHandler {
|
||||
(req: Partial<IncomingMessage>, res: ServerResponse | any, next?: Function): any;
|
||||
}
|
||||
import { RequestMethod } from '../../enums';
|
||||
export declare type ErrorHandler = (error: any, req: Partial<IncomingMessage>, res: ServerResponse | any, next?: Function) => any;
|
||||
export declare type RequestHandler = (req: Partial<IncomingMessage>, res: ServerResponse | any, next?: Function) => any;
|
||||
export interface HttpServer {
|
||||
use(handler: RequestHandler | ErrorHandler): any;
|
||||
use(path: any, handler: RequestHandler | ErrorHandler): any;
|
||||
@@ -27,8 +24,16 @@ export interface HttpServer {
|
||||
listen(port: number | string, hostname: string, callback?: () => void): any;
|
||||
reply(response: any, body: any, statusCode: number): any;
|
||||
render(response: any, view: string, options: any): any;
|
||||
setHeader(response: any, name: string, value: string): any;
|
||||
setErrorHandler?(handler: Function): any;
|
||||
setNotFoundHandler?(handler: Function): any;
|
||||
useStaticAssets?(...args: any[]): this;
|
||||
setBaseViewsDir?(path: string): this;
|
||||
setViewEngine?(engineOrOptions: any): this;
|
||||
createMiddlewareFactory(method: RequestMethod): (path: string, callback: Function) => any;
|
||||
getRequestMethod?(request: any): string;
|
||||
getRequestUrl?(request: any): string;
|
||||
getInstance(): any;
|
||||
getHttpServer(): any;
|
||||
close(): any;
|
||||
}
|
||||
|
||||
8
bundle/common/interfaces/index.d.ts
vendored
8
bundle/common/interfaces/index.d.ts
vendored
@@ -12,7 +12,7 @@ export * from './nest-application-context.interface';
|
||||
export * from './modules/on-init.interface';
|
||||
export * from './modules/on-destroy.interface';
|
||||
export * from './exceptions/exception-filter.interface';
|
||||
export * from './middlewares';
|
||||
export * from './middleware';
|
||||
export * from './websockets/web-socket-adapter.interface';
|
||||
export * from './features/pipe-transform.interface';
|
||||
export * from './features/paramtype.interface';
|
||||
@@ -25,3 +25,9 @@ export * from './features/custom-route-param-factory.interface';
|
||||
export * from './modules/dynamic-module.interface';
|
||||
export * from './http/http-server.interface';
|
||||
export * from './http/http-server-factory.interface';
|
||||
export * from './features/arguments-host.interface';
|
||||
export * from './nest-express-application.interface';
|
||||
export * from './nest-fastify-application.interface';
|
||||
export * from './modules/provider.interface';
|
||||
export * from './type.interface';
|
||||
export * from './modules/forward-reference.interface';
|
||||
|
||||
10
bundle/common/interfaces/microservices/client-metadata.interface.d.ts
vendored
Normal file
10
bundle/common/interfaces/microservices/client-metadata.interface.d.ts
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
import { Transport } from './../../enums/transport.enum';
|
||||
import { RedisOptions, NatsOptions, MqttOptions, GrpcOptions } from './microservice-configuration.interface';
|
||||
export interface ClientOptions {
|
||||
transport?: Transport;
|
||||
options?: TcpClientOptions | RedisOptions | NatsOptions | MqttOptions | GrpcOptions;
|
||||
}
|
||||
export interface TcpClientOptions {
|
||||
host?: string;
|
||||
port?: number;
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
@@ -1,11 +1,67 @@
|
||||
import { Transport } from '../../enums/transport.enum';
|
||||
import { MqttClientOptions } from '../external/mqtt-options.interface';
|
||||
import { CustomTransportStrategy } from './custom-transport-strategy.interface';
|
||||
import { Transport } from './../../enums/transport.enum';
|
||||
export interface MicroserviceConfiguration {
|
||||
transport?: Transport;
|
||||
url?: string;
|
||||
port?: number;
|
||||
host?: string;
|
||||
retryAttempts?: number;
|
||||
retryDelay?: number;
|
||||
export declare type MicroserviceOptions = GrpcOptions | TcpOptions | RedisOptions | NatsOptions | MqttOptions | CustomStrategy;
|
||||
export interface CustomStrategy {
|
||||
strategy?: CustomTransportStrategy;
|
||||
options?: {};
|
||||
}
|
||||
export interface GrpcOptions {
|
||||
transport?: Transport.GRPC;
|
||||
options: {
|
||||
url?: string;
|
||||
credentials?: any;
|
||||
protoPath: string;
|
||||
package: string;
|
||||
/** @deprecated */
|
||||
root?: string;
|
||||
loader?: {
|
||||
keepCase?: boolean;
|
||||
alternateCommentMode?: boolean;
|
||||
longs?: Function;
|
||||
enums?: Function;
|
||||
bytes?: Function;
|
||||
defaults?: boolean;
|
||||
arrays?: boolean;
|
||||
objects?: boolean;
|
||||
oneofs?: boolean;
|
||||
json?: boolean;
|
||||
includeDirs?: string[];
|
||||
};
|
||||
};
|
||||
}
|
||||
export interface TcpOptions {
|
||||
transport?: Transport.TCP;
|
||||
options?: {
|
||||
host?: string;
|
||||
port?: number;
|
||||
retryAttempts?: number;
|
||||
retryDelay?: number;
|
||||
};
|
||||
}
|
||||
export interface RedisOptions {
|
||||
transport?: Transport.REDIS;
|
||||
options?: {
|
||||
url?: string;
|
||||
retryAttempts?: number;
|
||||
retryDelay?: number;
|
||||
};
|
||||
}
|
||||
export interface MqttOptions {
|
||||
transport?: Transport.MQTT;
|
||||
options?: MqttClientOptions & {
|
||||
url?: string;
|
||||
};
|
||||
}
|
||||
export interface NatsOptions {
|
||||
transport?: Transport.NATS;
|
||||
options?: {
|
||||
url?: string;
|
||||
name?: string;
|
||||
pass?: string;
|
||||
maxReconnectAttempts?: number;
|
||||
reconnectTimeWait?: number;
|
||||
servers?: string[];
|
||||
tls?: any;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { MicroserviceConfiguration } from './microservice-configuration.interface';
|
||||
import { NestApplicationContextOptions } from '../nest-application-context-options.interface';
|
||||
export interface NestMicroserviceOptions extends MicroserviceConfiguration, NestApplicationContextOptions {
|
||||
export interface NestMicroserviceOptions extends NestApplicationContextOptions {
|
||||
}
|
||||
|
||||
5
bundle/common/interfaces/middleware/index.d.ts
vendored
Normal file
5
bundle/common/interfaces/middleware/index.d.ts
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
export * from './middleware-config-proxy.interface';
|
||||
export * from './middleware-consumer.interface';
|
||||
export * from './middleware-configuration.interface';
|
||||
export * from './nest-middleware.interface';
|
||||
export * from './middleware.interface';
|
||||
2
bundle/common/interfaces/middleware/index.js
Normal file
2
bundle/common/interfaces/middleware/index.js
Normal file
@@ -0,0 +1,2 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
28
bundle/common/interfaces/middleware/middleware-config-proxy.interface.d.ts
vendored
Normal file
28
bundle/common/interfaces/middleware/middleware-config-proxy.interface.d.ts
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
import { Type } from '../type.interface';
|
||||
import { RouteInfo } from './middleware-configuration.interface';
|
||||
import { MiddlewareConsumer } from './middleware-consumer.interface';
|
||||
export interface MiddlewareConfigProxy {
|
||||
/**
|
||||
* Delegates custom arguments to the `resolve()` method of the middleware.
|
||||
*
|
||||
* @param {} ...data
|
||||
* @returns {MiddlewareConfigProxy}
|
||||
*/
|
||||
with(...data: any[]): MiddlewareConfigProxy;
|
||||
/**
|
||||
* Excludes routes from the currently processed middleware.
|
||||
* This excluded route has to use an exact same route path.
|
||||
*
|
||||
* @param {} ...routes
|
||||
* @returns {MiddlewareConfigProxy}
|
||||
*/
|
||||
exclude(...routes: (string | RouteInfo)[]): MiddlewareConfigProxy;
|
||||
/**
|
||||
* Attaches passed either routes or controllers to the currently configured middleware.
|
||||
* If you pass a class, Nest would attach middleware to every path defined within this controller.
|
||||
*
|
||||
* @param {} ...routes
|
||||
* @returns {MiddlewareConsumer}
|
||||
*/
|
||||
forRoutes(...routes: (string | Type<any> | RouteInfo)[]): MiddlewareConsumer;
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
10
bundle/common/interfaces/middleware/middleware-configuration.interface.d.ts
vendored
Normal file
10
bundle/common/interfaces/middleware/middleware-configuration.interface.d.ts
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
import { RequestMethod } from '../../enums';
|
||||
import { Type } from '../type.interface';
|
||||
export interface RouteInfo {
|
||||
path: string;
|
||||
method: RequestMethod;
|
||||
}
|
||||
export interface MiddlewareConfiguration<T = any> {
|
||||
middleware: T;
|
||||
forRoutes: (Type<any> | string | RouteInfo)[];
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
12
bundle/common/interfaces/middleware/middleware-consumer.interface.d.ts
vendored
Normal file
12
bundle/common/interfaces/middleware/middleware-consumer.interface.d.ts
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
import { Type } from '../type.interface';
|
||||
import { MiddlewareConfigProxy } from './middleware-config-proxy.interface';
|
||||
export interface MiddlewareConsumer {
|
||||
/**
|
||||
* Takes either middleware class/function or array of classes/functions
|
||||
* that subsequently shall be attached to the passed routes.
|
||||
*
|
||||
* @param {any|any[]} middleware
|
||||
* @returns {MiddlewareConfigProxy}
|
||||
*/
|
||||
apply(...middleware: (Type<any> | Function)[]): MiddlewareConfigProxy;
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
1
bundle/common/interfaces/middleware/middleware.interface.d.ts
vendored
Normal file
1
bundle/common/interfaces/middleware/middleware.interface.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export declare type MiddlewareFunction<TRequest = any, TResponse = any, TResult = any> = (req?: TRequest, res?: TResponse, next?: Function) => TResult;
|
||||
@@ -0,0 +1,2 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
4
bundle/common/interfaces/middleware/nest-middleware.interface.d.ts
vendored
Normal file
4
bundle/common/interfaces/middleware/nest-middleware.interface.d.ts
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
import { MiddlewareFunction } from './middleware.interface';
|
||||
export interface NestMiddleware {
|
||||
resolve(...args: any[]): MiddlewareFunction | Promise<MiddlewareFunction>;
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
@@ -1,24 +1,19 @@
|
||||
import { MiddlewaresConsumer } from './middlewares-consumer.interface';
|
||||
import { Type } from '../type.interface';
|
||||
export interface MiddlewareConfigProxy {
|
||||
/**
|
||||
* Passes custom arguments to `resolve()` method of the middleware
|
||||
* Passes custom arguments to `resolve()` method of the middleware.
|
||||
*
|
||||
* @param {} ...data
|
||||
* @returns MiddlewareConfigProxy
|
||||
* @returns {MiddlewareConfigProxy}
|
||||
*/
|
||||
with(...data: any[]): MiddlewareConfigProxy;
|
||||
/**
|
||||
* Attaches passed routes / controllers to the processed middleware(s).
|
||||
* Single route can be defined as a literal object:
|
||||
* ```
|
||||
* path: string;
|
||||
* method: RequestMethod;
|
||||
* ```
|
||||
*
|
||||
* When you passe Controller class, Nest will attach middleware to every HTTP route handler inside this controller.
|
||||
* Attaches passed either routes (strings) or controllers to the processed middleware(s).
|
||||
* When you pass Controller class Nest will attach middleware to every path defined within this controller.
|
||||
*
|
||||
* @param {} ...routes
|
||||
* @returns MiddlewaresConsumer
|
||||
* @returns {MiddlewaresConsumer}
|
||||
*/
|
||||
forRoutes(...routes: any[]): MiddlewaresConsumer;
|
||||
forRoutes(...routes: (string | Type<any>)[]): MiddlewaresConsumer;
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user