Compare commits

...

242 Commits

Author SHA1 Message Date
Kamil Myśliwiec
cd30d7a4a5 chore(@nestjs) publish v5.2.2 release 2018-08-24 12:42:29 +02:00
Kamil Myśliwiec
a6d837e64a bugfix(@nestjs/common) fix custom decorators (data isnt always string) 2018-08-24 12:13:48 +02:00
Kamil Myśliwiec
0904b0ba56 Merge branch 'master' of https://github.com/nestjs/nest 2018-08-24 10:38:12 +02:00
Kamil Myśliwiec
150c81e397 feature(@nestjs/core) add prefix property to ServeStaticOptions 2018-08-24 10:35:04 +02:00
Kamil Myśliwiec
1717f35717 Merge pull request #997 from alerosa/fix-auth-sample-missing-dependency
example(@nestjs) add @nestjs/jwt to auth sample dependencies
2018-08-23 08:53:01 +02:00
alerosa
61b6b346da add @nestjs/jwt to auth sample dependencies 2018-08-23 00:55:19 +01:00
Kamil Myśliwiec
b02fb57d8f chore(@nestjs) publish 2.3.1 patch release 2018-08-22 22:00:42 +02:00
Kamil Myśliwiec
cb302e6719 chore(@nestjs) publish v5.2.1 release 2018-08-22 21:59:35 +02:00
Kamil Myśliwiec
1f9030c504 Merge branch 'master' of https://github.com/nestjs/nest 2018-08-22 21:58:18 +02:00
Kamil Myśliwiec
af5a4af675 chore(@nestjs) publish v5.2.1 release 2018-08-22 21:57:52 +02:00
Kamil Myśliwiec
664321465c Update Readme.md 2018-08-22 21:16:43 +02:00
Kamil Myśliwiec
f6d4b5e82a test(@nestjs/common) exclude load package 2018-08-22 20:21:55 +02:00
Kamil Myśliwiec
09c9f704e5 Merge pull request #909 from nestjs/5.2.0
chore(@nestjs) publish 5.2.0 minor release
2018-08-22 15:47:53 +02:00
Kamil Myśliwiec
8a8b780273 chore(@nestjs) publish 5.2.0 minor release 2018-08-22 15:44:30 +02:00
Kamil Myśliwiec
1f0de4923e chore(@nestjs) publish v5.2.0 release 2018-08-22 15:37:56 +02:00
Kamil Myśliwiec
d5833e3e4b feature(@nestjs/core) extract helpers to context utils class 2018-08-22 14:37:07 +02:00
Kamil Myśliwiec
deffcdcd84 example(@nestjs) update examples - auth, graphql 2018-08-22 14:36:43 +02:00
Kamil Myśliwiec
36b94b37d0 feature: add enhancers to custom decorator factory, fixes 2018-08-17 14:55:27 +02:00
Kamil Myśliwiec
85b93260e2 refactor(@nestjs) resolve merge conflicts 2018-08-16 16:30:33 +02:00
Kamil Myśliwiec
94f74a485b packages(@nestjs/core) add path-to-regexp to dependencies 2018-08-16 16:29:53 +02:00
Kamil Myśliwiec
b4253525fe Merge pull request #977 from nestjs/feature/938-hierarchical-lifecycle
feature(@nestjs/core) add hierarchical lifecycle hooks #938
2018-08-16 16:23:25 +02:00
Kamil Myśliwiec
c38c91217c feature(@nestjs/core) add hierarchical lifecycle hooks #938 2018-08-16 16:11:18 +02:00
Kamil Myśliwiec
f024af4912 Merge pull request #975 from nestjs/bugfix/fastify-wildcard
bugfix(@nestjs/core) middleware wildcard is not working with fastify
2018-08-16 15:11:43 +02:00
Kamil Myśliwiec
6976ffe079 bugfix(@nestjs/core) middleware wildcard is not working with fastify 2018-08-16 15:08:50 +02:00
Kamil Myśliwiec
2812c3863d Merge pull request #895 from jbpionnier/feature/grpc-loader
feature(@nestjs/microservices) load proto with proto-loader
2018-08-16 14:13:52 +02:00
Kamil Myśliwiec
9ad7927c4c Merge pull request #974 from nestjs/bugfix/948-nats-wildcards
bugfix(@nestjs/microservices) fix nats wildcards
2018-08-16 14:13:32 +02:00
Kamil Myśliwiec
afae462b6e Merge pull request #955 from jbpionnier/refactor/use_some_method
refactor(@nestjs) use some() method (arrays)
2018-08-16 14:08:36 +02:00
Kamil Myśliwiec
62e733c018 test(@nestjs/microservices) fix failing unit tests 2018-08-16 14:07:37 +02:00
Kamil Myśliwiec
d446a56381 bugfix(@nestjs/microservices) fix nats wildcards 2018-08-16 13:50:56 +02:00
Jean-Baptiste Pionnier
2bdf47a572 refactor: use some method 2018-08-09 08:27:39 +02:00
Jean-Baptiste Pionnier
caf99c6cf8 bugfix(@nestjs/microservice) fix invalid proto 2018-08-09 07:45:33 +02:00
Jean-Baptiste Pionnier
5415659fb9 feature(@nestjs/microservices) use grpc/proto-loader 2018-08-08 16:58:09 +02:00
Kamil Myśliwiec
e967ba15cf Merge pull request #936 from nestjs/bugfix/935-file-interceptor
bugfix(@nestjs/common) fix multiple file interceptors issue
2018-08-02 09:33:10 +02:00
Kamil Myśliwiec
0b191fbd17 bugfix(@nestjs/common) fix multiple file interceptors issue 2018-08-02 09:32:12 +02:00
Kamil Myśliwiec
2ea58acc70 sample(@nestjs) fix paths join usage 2018-08-01 22:38:47 +02:00
Kamil Myśliwiec
1f59a81c28 Merge branch 'master' into 5.2.0 2018-08-01 22:38:23 +02:00
Kamil Myśliwiec
fbcb18c978 Merge pull request #934 from nestjs/feature/926-use-logger
feature(@nestjs/core) add useLogger() to Nest context #926
2018-08-01 22:34:48 +02:00
Kamil Myśliwiec
dd7bb313f4 Merge pull request #933 from nestjs/feature/847-optional-decorator
feature(@nestjs/core) add @Optional() decorator #847
2018-08-01 22:34:16 +02:00
Kamil Myśliwiec
946ed2e339 feature(@nestjs/core) add useLogger() to Nest context #926 2018-08-01 22:33:02 +02:00
Kamil Myśliwiec
96da5bd9c5 feature(@nestjs/core) add @Optional() decorator #847 2018-08-01 22:31:39 +02:00
Kamil Myśliwiec
9f77d5f550 bugfix(@nestjs/common) revert @Catch() validation 2018-08-01 21:09:12 +02:00
Kamil Myśliwiec
9e6cf1f1aa Merge pull request #911 from Patrick-Remy/patch-1
sample(@nestjs) fix path.join arguments seperation
2018-08-01 20:34:32 +02:00
Kamil Myśliwiec
d92fa0dee1 Merge branch 'master' into 5.2.0 2018-08-01 20:10:53 +02:00
Kamil Myśliwiec
63109f5717 bugfix(@nestjs/common) fix pipes typing issue 2018-08-01 20:09:19 +02:00
Kamil Myśliwiec
dc33ea57ef Merge pull request #903 from nestjs/feature/module-ref
feature(@nestjs/core) expose container to ModuleRef, add close()
2018-08-01 20:08:49 +02:00
Kamil Myśliwiec
780bd9c0f9 Merge pull request #904 from nestjs/feature/846-axios
feature(@nestjs/common) add configurable dynamic module (HttpModule)
2018-08-01 20:08:06 +02:00
Kamil Myśliwiec
a79041d211 Merge pull request #908 from nestjs/feature/860-default-filter
feature(@nestjs) expose default exception filters #860
2018-08-01 19:55:16 +02:00
Kamil Myśliwiec
eda8e293c3 chore(@nestjs) add package-lock.json 2018-08-01 19:52:25 +02:00
Kamil Myśliwiec
fd797b1a69 chore(@nestjs) fix gulpfile 2018-08-01 19:47:33 +02:00
Kamil Myśliwiec
fd098fc3f7 chore(@nestjs) fix gulp scripts 2018-08-01 19:40:18 +02:00
Kamil Myśliwiec
1be2ccdb0b Update Readme.md 2018-07-31 13:43:07 +02:00
Kamil Myśliwiec
cb46174bae Merge pull request #906 from nestjs/bugfix/892-custom-decorators
bugfix(@nestjs/common) data parameter is not required (custom decorators)
2018-07-26 15:04:14 +02:00
Kamil Myśliwiec
ac1578793f Merge pull request #902 from nestjs/feature/720-decorators-validation
enhancement(@nestjs/common) add validation to @catch() decorator
2018-07-26 14:55:11 +02:00
Kamil Myśliwiec
525922ee69 Merge pull request #907 from nestjs/bugfix/879-injectable-inheritance
bugfix(@nestjs/core) inherited metadata is not applied #879
2018-07-26 14:54:32 +02:00
Patrick-Remy
5327979745 Fix path.join arguments seperation 2018-07-26 10:40:50 +02:00
Kamil Myśliwiec
3a0e404832 Merge pull request #901 from nestjs/bugfix/854-mixing-testing
bugfix(@nestjs/common) fix mixin testing issue #854
2018-07-25 20:08:24 +02:00
Kamil Myśliwiec
55b1f1e08e Merge pull request #900 from nestjs/bugfix/671-dynamic-modules
bugfix(@nestjs/core) enable dynamic modules recursive imports #671
2018-07-25 20:03:40 +02:00
Kamil Myśliwiec
a05383c635 Merge pull request #644 from DanielRuf/chore/add-nodejs-10
chore(@nestjs): add Node.js 10 (travis)
2018-07-25 19:57:09 +02:00
Kamil Myśliwiec
86abc0001c Merge branch '5.2.0' into chore/add-nodejs-10 2018-07-25 19:56:49 +02:00
Kamil Myśliwiec
c4ff2e736a Merge pull request #642 from DanielRuf/chore/cache-node-modules
chore(@nestjs): cache node_modules
2018-07-25 19:54:42 +02:00
Kamil Myśliwiec
d00d5f2996 Merge branch '5.2.0' into chore/cache-node-modules 2018-07-25 19:54:28 +02:00
Kamil Myśliwiec
5f0f6e5b61 Merge pull request #878 from wbhob/npm6-scripts
chore(): rename prepublish commands to prepare
2018-07-25 19:53:40 +02:00
Kamil Myśliwiec
f39573007c Merge pull request #877 from wbhob/master
refactor(): reduce complexity of NestFactory.create signature
2018-07-25 19:49:50 +02:00
Kamil Myśliwiec
f7a367e895 Merge pull request #814 from BrunnerLivio/master
feature(@nestjs/core) display known dependency names in unknown dependency exception
2018-07-25 19:43:21 +02:00
Kamil Myśliwiec
dcba92190f feature(@nestjs) add barrel files 2018-07-25 18:49:24 +02:00
Kamil Myśliwiec
614d57f130 feature(@nestjs) expose default exception filters 2018-07-25 18:47:40 +02:00
Kamil Myśliwiec
9e170c4ae4 bugfix(@nestjs/core) inherited metadata is not applied #879 2018-07-25 13:57:45 +02:00
Kamil Myśliwiec
85070a5c9c refactor: cleanup 2018-07-25 13:17:29 +02:00
Kamil Myśliwiec
f86fc35fa7 refactor: cleanup 2018-07-25 13:16:58 +02:00
Kamil Myśliwiec
53184b8df0 bugfix(@nestjs/common) data parameter is not required (custom decorators) #892 2018-07-25 13:16:05 +02:00
Kamil Myśliwiec
f385d5c47d feature(@nestjs/common) add configurable dynamic module (HttpModule) 2018-07-24 22:32:10 +02:00
Kamil Myśliwiec
1527e12013 feature(@nestjs/core) expose container to ModuleRef, add close() to NestContext 2018-07-24 22:07:14 +02:00
Kamil Myśliwiec
58800f69b1 enhancement(@nestjs/common) add validation to @Catch() decorator 2018-07-24 20:18:10 +02:00
Kamil Myśliwiec
049da42d4a enhancement(@nestjs/common) add validation to @Catch() decorator 2018-07-24 20:17:54 +02:00
Kamil Myśliwiec
21f2e8a9f7 bugfix(@nestjs/common) fix mixin testing issue #854 2018-07-24 19:55:09 +02:00
Kamil Myśliwiec
432b777f2c bugfix(@nestjs/core) enable dynamic modules recursive imports #671 2018-07-24 16:47:53 +02:00
Kamil Myśliwiec
e39c9d920d bugfix(@nestjs/core) add circular dependency (related modules) check 2018-07-24 16:23:53 +02:00
Kamil Myśliwiec
b84c2b0884 bugfix(@nestjs/core) add circular dependency (related modules) check 2018-07-24 16:10:10 +02:00
Livio Brunner
e4d0118e9d refactor(@nestjs/core) change any[] types to a custom interface 2018-07-16 10:45:33 +02:00
Wilson Hobbs
0bf98c46cb chore(): rename prepublish commands to prepare, to comply with https://docs.npmjs.com/misc/scripts#deprecation-note 2018-07-15 12:43:12 -04:00
Wilson Hobbs
442b08fdb9 refactor(): reduce complexity of NestFactory.create signature 2018-07-15 12:30:55 -04:00
Livio Brunner
9c2a9d76d2 refactor(@nestjs/core) rename args parameter to dependencies 2018-07-15 13:25:17 +02:00
Livio Brunner
a354741c31 fix(@nestjs/core) show token name in unk. dep. exception message 2018-07-09 17:49:32 +02:00
Kamil Myśliwiec
8d62307987 sample(@nestjs) update packages 2018-07-05 17:37:44 +02:00
Kamil Myśliwiec
e2de979081 build(@nestjs) fix README copy&move 2018-07-05 14:38:30 +02:00
Kamil Myśliwiec
0f62bcd41f chore(@nestjs) publish 5.1.0 release 2018-07-05 14:31:21 +02:00
Kamil Myśliwiec
d4c9644368 chore(@nestjs) publish v5.1.0 release 2018-07-05 14:28:27 +02:00
Kamil Myśliwiec
0c4fe26c21 sample(@nestjs) move public and views dirs outside of the src 2018-07-05 09:10:10 +02:00
Kamil Myśliwiec
3cf8607b20 enhancement(@nestjs/microservices) disable internal gRPC errors swallow 2018-07-04 23:17:02 +02:00
Kamil Myśliwiec
3d2d838bd1 bugfix(@nestjs/core) multi global providers issue #812 2018-07-04 19:36:29 +02:00
Kamil Myśliwiec
a9204cb399 bugfix(@nestjs/testing) await scan() operation 2018-07-04 18:30:08 +02:00
Kamil Myśliwiec
bd3b102c2f Merge branch 'master' of https://github.com/nestjs/nest 2018-07-04 17:46:44 +02:00
Kamil Myśliwiec
9cf27a35dd feature(@nestjs/core) add axiosRef to the HttpService #842 2018-07-04 17:46:14 +02:00
Kamil Myśliwiec
c1c5b15859 Merge pull request #839 from Y0hy0h/patch-1
refactor(@nestjs/core) rephrase error messages
2018-07-04 16:33:58 +02:00
Y0hy0h
3e55de545f refactor(core) rephrase error messages
Fixes typo, clarifies what actions are expected.
2018-07-03 17:11:33 +02:00
Kamil Myśliwiec
ced6729157 Update Readme.md 2018-06-29 20:44:34 +02:00
Kamil Myśliwiec
a57eb17640 Update Readme.md 2018-06-29 20:44:13 +02:00
Kamil Myśliwiec
6c2863d709 Merge pull request #823 from ZQun/patch-2
Update Chinese guide format
2018-06-29 18:39:26 +02:00
Kamil Myśliwiec
fc05b244a8 Merge pull request #822 from ZQun/patch-1
Update Chinese guide format
2018-06-29 18:38:58 +02:00
ZQun
c80fd77416 Update Chinese guide format
Update Chinese guide format
2018-06-28 11:10:02 +08:00
ZQun
e2d15db3f4 Update Chinese guide format
Update Chinese guide format
2018-06-28 11:02:39 +08:00
Livio Brunner
8057a5cf19 feature(@nestjs/core) display dependency names in unknown dependency ex
This feature displays the found dependency names when any unknown
dependency is getting injected. Before this feature the error message
gets displayed like (?, +). After this implementation, like this e.g.
(?, CatsService).
2018-06-26 10:49:16 +02:00
Kamil Myśliwiec
a6ab849df2 Merge pull request #808 from autaut03/autaut03-fix/forbiddenNotHttpException
bugfix(@nestjs/core): use ForbiddenException instead of HttpException
2018-06-25 13:41:09 +02:00
Alex_Wells
7143d3b8ac bugfix(@nestjs/core): use ForbiddenException instead of HttpException
Two modified files are the only places in the whole framework where HttpException specifically is used
and used to be used wrong. It's easier to handle and catch ForbiddenException (and other HttpException
child) rather than having to compare HttpStatus to catch it. As ForbiddenException extends HttpException
and provides same HttpStatus, old code catching HttpException still works.
2018-06-24 20:50:30 +03:00
Kamil Myśliwiec
be6d90ace2 feature(@nestjs/core) enable deffered dynamic modules 2018-06-24 13:26:55 +02:00
Kamil Myśliwiec
7023905b53 feature(@nestjs/core) FastifyAdapter matches URL and request method 2018-06-22 10:41:52 +02:00
Kamil Myśliwiec
f4817ee4eb feature(@nestjs/common) add error messages disabled mode (ValidationPipe) 2018-06-21 23:00:33 +02:00
Kamil Myśliwiec
a87eee0849 example(@nestjs) fix HttpExceptionFilter example (missing status) 2018-06-21 22:43:50 +02:00
Kamil Myśliwiec
a8803fd166 Merge branch 'master' of https://github.com/nestjs/nest 2018-06-21 22:19:43 +02:00
Kamil Myśliwiec
18f68d96b7 Merge branch 'thg303-feature/add-FileFieldsInterceptor' 2018-06-21 22:19:18 +02:00
Kamil Myśliwiec
ecd61e3777 feature(@nestjs/common) add field name to the @UploadedFile() decorator 2018-06-21 22:18:55 +02:00
Kamil Myśliwiec
10eeac9ae7 Merge branch 'feature/add-FileFieldsInterceptor' of https://github.com/thg303/nest into thg303-feature/add-FileFieldsInterceptor 2018-06-21 22:02:46 +02:00
Kamil Myśliwiec
59e6a3d262 Merge pull request #802 from nestjs/790-feature-middleware
feature(@nestjs/core) superior MiddlewareConsumer, add exclude
2018-06-21 21:59:08 +02:00
Kamil Myśliwiec
292fe2136c Merge branch 'micmro-feature/grpc-cancellation' 2018-06-21 21:53:43 +02:00
Kamil Myśliwiec
f80cd9edd1 refactor(@nestjs/microservices) extract magic strings into constants 2018-06-21 21:51:48 +02:00
Kamil Myśliwiec
adbfae2b71 Merge branch 'feature/grpc-cancellation' of https://github.com/micmro/nest into micmro-feature/grpc-cancellation 2018-06-21 21:23:40 +02:00
Kamil Myśliwiec
4cfda07b2a tests(@nestjs/core) fix failing unit tests 2018-06-21 21:22:14 +02:00
Kamil Myśliwiec
3ac7802315 Merge branch 'master' of https://github.com/nestjs/nest 2018-06-21 20:51:04 +02:00
Kamil Myśliwiec
1813e5a09c build(@nestjs) add copy README gulp script 2018-06-21 20:50:50 +02:00
Kamil Myśliwiec
c9184acee1 feature(@nestjs/core) superior MiddlewareConsumer, add exclude 2018-06-21 15:48:31 +02:00
Kamil Myśliwiec
1c98d6b18c Merge pull request #795 from nestjs/734-bugfix-validation
bugfix(@nestjs/common) ValidationPipe throws 500 error
2018-06-20 17:51:18 +02:00
Kamil
7172671dcc Merge branch 'master' of https://github.com/nestjs/nest 2018-06-20 17:49:14 +02:00
Kamil
294e269ede Merge branch 'RivaCode-message_pattern_string-key' 2018-06-20 17:48:54 +02:00
Kamil
00c98501ff enhancement(@nestjs/microservices) use isString helper instead 2018-06-20 17:47:17 +02:00
Kamil Myśliwiec
51d5be4e9d Merge pull request #794 from nestjs/772-bugfix-testing
bugfix(@nestjs/core) issue #772 testing - too restrictive typings
2018-06-20 17:37:59 +02:00
Kamil
f86c0e33c4 Merge branch 'message_pattern_string-key' of https://github.com/RivaCode/nest into RivaCode-message_pattern_string-key 2018-06-20 17:36:58 +02:00
Kamil
3888d8ee8b bugfix(@nestjs/common) ValidationPipe throws 500 error 2018-06-20 17:34:00 +02:00
Kamil
8029796193 bugfix(@nestjs/core) testing utilities typings are too restrictive 2018-06-20 17:33:13 +02:00
Kamil
f3c28f57ac refactor(@nestjs/common) reorganize imports in create route param 2018-06-20 17:21:56 +02:00
Kamil
03db0d357a improvement(@nestjs/common) add missing typings to custom param factory 2018-06-20 17:15:55 +02:00
Kamil
7ad6095e16 Merge branch 'master' of https://github.com/nestjs/nest 2018-06-20 17:13:10 +02:00
Kamil Myśliwiec
617bc70944 Merge pull request #788 from Defenderbass/bugfix/types_in_createParamDecorator
bugfix(@nestjs/common) changes the types of arguments in createParamD…
2018-06-20 17:12:49 +02:00
Kamil
f2d2d56111 bundle(@nestjs/core) remove needless middlewares directory 2018-06-20 17:11:08 +02:00
Kamil Myśliwiec
84d31f9449 Update Readme.md 2018-06-19 09:54:59 +02:00
Igor Katsuba
da3745f386 bugfix(@nestjs/common) changes the types of arguments in createParamDecorator 2018-06-18 10:39:27 +03:00
Stas Rivkin
7e47100d3e bugfix(@nestjs/microservices): messagePattern string key
stringify on a string key added an extra parentheses to the pattern
2018-06-17 14:32:15 +03:00
Michael
0c8e8fb4f7 chore(@nestjs/microservices) add tests to grpc clients disconnection 2018-06-10 23:38:21 +02:00
Michael Mrowetz
f337206785 chore(microservice) tests for grpc cancelling - server side 2018-06-09 17:25:58 +02:00
Michael Mrowetz
3984bc92f2 fix(tests) fix the grpc tests 2018-06-08 17:51:31 +02:00
Michael
89fe60a213 chore(@nestjs/microservices) improve ClientGrpcProxy.getService typing 2018-06-08 15:24:24 +02:00
Michael
3ebec419fe feature(@nestjs/microservices) allow grpc clients to disconnect
- when client cancels the server stream gets completed too
- client introduced disconnection does not throw errors on the client side
- release client's event listener on 'end'
2018-06-08 15:21:37 +02:00
Kamil Myśliwiec
fed2459677 Merge pull request #750 from ltciro/fix_typo_01catsapp_guard
sample(@nestjs) fix hasRole is not a function (01-cats-app)
2018-06-04 22:34:18 +02:00
Kamil Myśliwiec
33c7049d71 Merge pull request #760 from yingye/master
Update readme_zh.md
2018-06-04 21:43:14 +02:00
yingye
e44f51d647 update readme_zh.md 2018-06-04 18:52:04 +08:00
Laura Ciro
31aa2f09c5 sample(@nestjs) fix hasRole is not a function (01-cats-app) 2018-05-30 23:37:36 -05:00
Ali Ghanavatian
3fffc01890 feature(@nestjs/common) add file-fields interceptor
usage will be like:
```import {FileFieldsInterceptor} from '@nest/common';

@UseInterceptors(FileFieldsInterceptor([{name: 'avatar', maxCount: 1},
{name: 'passport', maxCount: 1}]))
```
2018-05-30 19:32:05 +04:30
Kamil Myśliwiec
e1abf80569 Update Readme.md 2018-05-28 09:44:41 +02:00
Kamil Myśliwiec
a7fde9b6cc Update Readme.md 2018-05-26 20:44:02 +02:00
Kamil Myśliwiec
92d3ed48db integration(@nestjs) add mongoose integration test 2018-05-26 14:51:10 +02:00
Kamil Myśliwiec
c5455de9d1 chore(@nestjs) publish v5.0.1 release 2018-05-25 13:26:37 +02:00
Kamil Myśliwiec
7b5b054818 integration(@nestjs) add typeorm integration test 2018-05-25 12:48:38 +02:00
Kamil Myśliwiec
17a609cd9c feature(@nestjs/microservices) grpc improvements (add root), cleanup 2018-05-25 12:44:18 +02:00
Kamil Myśliwiec
ae128f6e91 feature(@nestjs/testing) add error logs in the testing mode (#709, #713) 2018-05-20 15:06:03 +02:00
Kamil Myśliwiec
cb24ca9ee5 bugfix(@nestjs/websockets) handle invalid payloads (#683) 2018-05-20 15:04:04 +02:00
Kamil Myśliwiec
e37b9f7d81 bugfix(@nestjs/core) support circular deps in dynamic modules (#678) 2018-05-20 15:02:32 +02:00
Kamil Myśliwiec
55600edb2d docs(@nestjs) add PULL_REQUEST_TEMPLATE 2018-05-19 10:32:27 +02:00
Kamil Myśliwiec
033068b5d7 Update CONTRIBUTING.md 2018-05-19 10:30:09 +02:00
Kamil Myśliwiec
9ea7db9160 Merge branch 'master' of https://github.com/nestjs/nest 2018-05-19 10:25:54 +02:00
Kamil Myśliwiec
1801bf86b6 Update readme_zh.md 2018-05-19 10:25:32 +02:00
Kamil Myśliwiec
ba5c59bc34 Merge pull request #700 from zuohuadong/patch-1
chore(readme) upgrade chinese
2018-05-19 10:23:51 +02:00
Kamil Myśliwiec
bf30a304d8 Merge pull request #702 from alQlagin/patch-1
bugfix(@nestjs/common) incorrect aixos methods in HttpService
2018-05-19 10:23:25 +02:00
Alex Kulagin
310d530308 Fix: incorrect aixos methods in HttpService
HttpService.put and HttpService.patch use axios.post 
Changed to axios.put and axios.patch
2018-05-17 14:36:38 +05:00
huadong zuo
75775d6ea1 chore(readme) upgrade chinese
update 5.0
2018-05-17 13:16:06 +08:00
Kamil Myśliwiec
f9e02b60fa feature(@nestjs/core) add getInstance() to HTTP adapters 2018-05-16 15:17:30 +02:00
Kamil Myśliwiec
c5a3385156 ci(@nestjs) add package-lock.json 2018-05-13 14:01:23 +02:00
Kamil Myśliwiec
403a137847 ci: remove package-lock.json 2018-05-13 13:42:55 +02:00
Kamil Myśliwiec
c7bd1afc39 sample(@nestjs) update samples package.json 2018-05-13 13:30:10 +02:00
Kamil Myśliwiec
fcf24d32c9 chore(@nestjs) update README in bundle directory 2018-05-13 11:05:26 +02:00
Kamil Myśliwiec
53bcbefb63 chore(@nestjs) publish v5.0.0 release 2018-05-13 11:03:01 +02:00
Kamil Myśliwiec
e010ebd09e Merge branch 'master' of https://github.com/nestjs/nest 2018-05-13 10:24:42 +02:00
Kamil Myśliwiec
663ca6981e feature(@nestjs/microservices) more descriptive gRPC errors 2018-05-13 10:24:33 +02:00
Kamil Myśliwiec
e41c4d806f Update Readme.md 2018-05-13 10:23:49 +02:00
Kamil Myśliwiec
6ad5ae6a67 chore(release) publish v5.0.0-rc.4 2018-05-09 20:36:38 +02:00
Kamil Myśliwiec
0da348045f tests(@nestjs) fix broken stubs, flush out exceptions 2018-05-09 18:18:52 +02:00
Kamil Myśliwiec
64629cfb4d tests(@nestjs/common) fix broken promise rejection in ValidationPipe 2018-05-09 18:04:43 +02:00
Kamil Myśliwiec
4a589d52d5 tests(@nestjs/microservices) fix broken mqtt and redis client tests 2018-05-09 17:51:05 +02:00
Kamil Myśliwiec
8f30e6769b Merge branch 'master' of https://github.com/nestjs/nest 2018-05-09 17:21:34 +02:00
Kamil Myśliwiec
6016f8d175 feature(@nestjs/microservices) expose connect method, improvements & fixes 2018-05-09 17:21:21 +02:00
Kamil Myśliwiec
7b950ffa6e feature(@nestjs/common) make ValidationPipe properties protected 2018-05-09 17:19:38 +02:00
Kamil Myśliwiec
f037edad14 integration(@nestjs) add circular dependency integration test 2018-05-09 17:19:12 +02:00
Kamil Myśliwiec
9c404cddea bugfix: remove invalid MiddlewareConsumer typings 2018-05-09 17:18:06 +02:00
Kamil Myśliwiec
3900cadbd9 Update Readme.md 2018-05-07 13:31:39 +02:00
Kamil Myśliwiec
8b04584ca9 chore(release) publish v5.0.0-rc.3 2018-05-07 13:23:08 +02:00
Kamil Myśliwiec
c5e560d1cf samples(@nestjs) fix grpc client options, remove slash (swagger) 2018-05-07 13:18:48 +02:00
Kamil Myśliwiec
bae969c601 Merge branch 'master' of https://github.com/nestjs/nest 2018-05-07 13:18:07 +02:00
Kamil Myśliwiec
0fcdf4ee2c bugfix(@nestjs/common) add missing forward reference typing 2018-05-07 11:14:19 +02:00
Kamil Myśliwiec
4a744d1c1b Merge pull request #640 from DanielRuf/style/reformat-travis-ci-config
style: reformat Travis CI config
2018-05-07 11:08:48 +02:00
Daniel Ruf
c9daccda3a style: reformat Travis CI config 2018-05-06 23:59:01 +02:00
Kamil Myśliwiec
72aad1d90e bugfix(@nestjs/core) export FastifyAdapter at the root level #622 2018-05-06 22:41:06 +02:00
Kamil Myśliwiec
cb9896ed7f Merge branch 'master' of https://github.com/nestjs/nest 2018-05-06 22:34:24 +02:00
Kamil Myśliwiec
f81f14364a sample(@nestjs) fix invalid message property (16-gateways-ws) #635 2018-05-06 22:34:02 +02:00
Kamil Myśliwiec
8a77bfab55 Merge pull request #645 from DanielRuf/chore/upgrade-grpc
chore: upgrade grpc
2018-05-06 22:19:55 +02:00
Kamil Myśliwiec
04cd077426 Merge pull request #641 from DanielRuf/chore/clone-only-the-last-5-commits
ci: clone only the last 5 commits
2018-05-06 22:19:25 +02:00
Kamil Myśliwiec
e84979d04a Merge pull request #639 from DanielRuf/chore/use-npm-ci
chore: use npm ci instead of npm install (travis)
2018-05-06 22:17:36 +02:00
Daniel Ruf
f9cdb6168d chore: update lockfile 2018-05-06 18:43:30 +02:00
Daniel Ruf
bc1eab1b3d chore: upgrade grpc 2018-05-06 18:10:44 +02:00
Daniel Ruf
aba394f742 chore: migrate to gulp 4 2018-05-06 17:58:31 +02:00
Daniel Ruf
6a49b833ca chore: trigger new build 2018-05-06 16:51:48 +02:00
Daniel Ruf
2c9a07b64a chore: clone only the last 5 commits 2018-05-06 16:26:55 +02:00
Daniel Ruf
7e022be24a chore: cache node_modules 2018-05-06 16:23:14 +02:00
Daniel Ruf
8bf9cecd10 chore: use npm ci 2018-05-06 16:21:36 +02:00
Daniel Ruf
fb860c70e3 chore: add Node.js 10 2018-05-06 16:17:49 +02:00
Kamil Myśliwiec
eb639de347 chore(release) publish v5.0.0-rc.2 2018-05-02 23:30:42 +02:00
Kamil Myśliwiec
5bd3a83cb2 ci(@nestjs) remove platform (node 10) 2018-05-02 23:15:27 +02:00
Kamil Myśliwiec
382d99986b bugfix(@nestjs/websockets) lifecycle hooks multi execution 2018-05-02 23:07:53 +02:00
Kamil Myśliwiec
154b865d7b Merge pull request #621 from patrickhousley/bugfix/express-engine
fix(core): Fix express adapter
2018-05-02 15:21:10 +02:00
Patrick Housley
d001a2f34a fix(core): Fix express adapter 2018-05-01 18:33:48 -05:00
Kamil Myśliwiec
4cfdbe2220 chore(release) publish v5.0.0-rc.1 2018-04-30 23:40:59 +02:00
Kamil Myśliwiec
0266ffdb97 chore(release) publish v5.0.0-rc.1 2018-04-30 23:38:37 +02:00
Kamil Myśliwiec
1f7ae5ef3a chore(release) publish v5.0.0-beta.8 2018-04-30 13:05:50 +02:00
Kamil Myśliwiec
aeda614c5c test(@nestjs/common) fix broken unit tests 2018-04-30 13:04:36 +02:00
Kamil Myśliwiec
181d8c6585 feature(@nestjs/common) add package loader utility 2018-04-30 13:01:37 +02:00
Kamil Myśliwiec
195ae2726d chore(release) publish v5.0.0-beta.7 2018-04-29 16:13:44 +02:00
Kamil Myśliwiec
484a2eb4ec sample(@nestjs) update authentication example (passport) 2018-04-29 16:03:25 +02:00
Kamil Myśliwiec
6630313ece improvement(@nestjs/common) move class-validator and class-transformer 2018-04-29 15:58:44 +02:00
Kamil Myśliwiec
c7a8caacef Merge remote-tracking branch 'origin/master' 2018-04-28 18:10:33 +02:00
Kamil Myśliwiec
021b96eaa0 chore(release) publish v5.0.0-beta.6 2018-04-28 18:05:23 +02:00
Kamil Myśliwiec
fb53ba2b1a chore(release) publish v5.0.0-beta.6 2018-04-28 18:03:49 +02:00
Kamil Myśliwiec
bf2fcb7aa1 Update CHANGELOG.md 2018-04-28 15:27:00 +02:00
Kamil Myśliwiec
518ea8d33f chore(release) publish v5.0.0-beta.4 2018-04-28 15:24:39 +02:00
Kamil Myśliwiec
3ad570e62e bugfix(@nestjs/microservices) extract external typings #594 2018-04-28 15:23:03 +02:00
Kamil Myśliwiec
5cfb0bfc85 refactor(@nestjs) fix typos, extract module compiler, fix broken guards 2018-04-28 12:42:35 +02:00
Kamil Myśliwiec
59fb9c71e2 Merge branch 'master' of https://github.com/nestjs/nest 2018-04-27 13:52:24 +02:00
Kamil Myśliwiec
8e2c957833 sample(@nestjs) bump packages versions 2018-04-27 13:42:09 +02:00
Kamil Myśliwiec
944921f2e9 external(@nestjs) update to rxjs@6.0.0 2018-04-27 13:13:02 +02:00
Kamil Myśliwiec
59f5d68df5 feature(@nestjs/common) add @Header() decorator 2018-04-23 22:44:57 +02:00
Kamil Myśliwiec
91c879d922 Update CHANGELOG.md 2018-04-22 12:12:20 +02:00
Kamil Myśliwiec
f918e2b774 Update CHANGELOG.md 2018-04-22 12:08:13 +02:00
Kamil Myśliwiec
6cac4b7e1e chore(release) publish v5.0.0-beta.3 2018-04-22 11:45:33 +02:00
Kamil Myśliwiec
8117cfb10b chore(release) publish v5.0.0-beta.3 2018-04-22 11:42:26 +02:00
Kamil Myśliwiec
4b926da0d6 format(@nestjs) revert lint precommit hook 2018-04-21 16:03:16 +02:00
Kamil Myśliwiec
77d4ea7513 ci(@nestjs) fix unit tests, falling linux build 2018-04-21 16:01:59 +02:00
Kamil Myśliwiec
3160245145 refactor(@nestjs) fix tslint issues, format code 2018-04-21 14:22:24 +02:00
Kamil Myśliwiec
6e19f3554a Merge branch 'update/version-5' 2018-04-21 13:57:28 +02:00
Kamil Myśliwiec
ae6eb8fa7d format(@nestjs) add tslint precommit hook 2018-04-21 13:56:55 +02:00
Kamil Myśliwiec
5d28b98a8c feature(@nestjs/core) add async lifecycle hooks support 2018-04-21 13:55:58 +02:00
Kamil Myśliwiec
52acfe4ea2 tests(@nestjs) add dynamic modules & express instance integration tests 2018-04-21 00:04:18 +02:00
Kamil Myśliwiec
01a4f64a2e Merge pull request #577 from afurculita/patch-1
Update http.exception.ts
2018-04-20 15:54:17 +02:00
Alexandru Furculita ♻
b47a384621 Update http.exception.ts 2018-04-19 14:21:02 +03:00
Alexandru Furculita ♻
e842768bb1 Update http.exception.ts
Some remains from a git merge/rebase conflict
2018-04-19 14:20:22 +03:00
Kamil Myśliwiec
998a24d62f Update Readme.md 2018-04-18 23:25:03 +02:00
Kamil Myśliwiec
64d072d8bb Merge pull request #489 from nestjs/update/version-5
Update: release v5.0.0-beta
2018-04-18 12:50:06 +02:00
821 changed files with 73347 additions and 23434 deletions

41
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View 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
View File

@@ -1,6 +1,5 @@
# dependencies
node_modules/
package-lock.json
# IDE
/.idea

1
.prettierignore Normal file
View File

@@ -0,0 +1 @@
/bundle

View File

@@ -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

View File

@@ -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

View File

@@ -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`)

View File

@@ -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> &nbsp; <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> &nbsp; <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> &nbsp; <a href="http://angularity.io"><img src="http://angularity.io/media/logo.svg" height="30" /></a> &nbsp; <a href="http://gojob.com"><img src="https://gojob.com/w/wp-content/uploads/2017/02/cropped-Logo-web-home.png" height="40" /> &nbsp; <!--<a href="https://keycdn.com"><img src="https://nestjs.com/img/keycdn.svg" height="30" /></a> &nbsp;--> <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

Binary file not shown.

View File

@@ -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> &nbsp; <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> &nbsp; <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> &nbsp; <a href="http://angularity.io"><img src="http://angularity.io/media/logo.svg" height="30" /></a> &nbsp; <a href="http://gojob.com"><img src="https://gojob.com/w/wp-content/uploads/2017/02/cropped-Logo-web-home.png" height="40" /> &nbsp; <!--<a href="https://keycdn.com"><img src="https://nestjs.com/img/keycdn.svg" height="30" /></a> &nbsp;--> <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>

View File

@@ -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__";

View File

@@ -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__';

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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) => {

View File

@@ -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;

View File

@@ -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);

View File

@@ -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';

View File

@@ -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"));

View File

@@ -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;

View File

@@ -0,0 +1,5 @@
import 'reflect-metadata';
/**
* Sets dependency as an optional one.
*/
export declare function Optional(): ParameterDecorator;

View 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;

View File

@@ -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;

View File

@@ -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) => {

View File

@@ -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;

View File

@@ -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;
};
}

View File

@@ -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;

View File

@@ -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;
};
}

View File

@@ -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;

View File

@@ -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;
};
}

View File

@@ -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;

View File

@@ -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
*/

View File

@@ -0,0 +1,5 @@
import 'reflect-metadata';
/**
* Sets a response header.
*/
export declare function Header(name: string, value: string): MethodDecorator;

View 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;

View File

@@ -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';

View File

@@ -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"));

View File

@@ -0,0 +1,5 @@
import 'reflect-metadata';
/**
* Redirects request.
*/
export declare function Redirect(url: string): MethodDecorator;

View 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;

View File

@@ -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;

View File

@@ -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);

View File

@@ -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;

View File

@@ -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);
}

View File

@@ -1,4 +1,7 @@
export declare enum Transport {
TCP = 0,
REDIS = 1,
NATS = 2,
MQTT = 3,
GRPC = 4,
}

View File

@@ -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 = {}));

View File

@@ -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,

View File

@@ -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,

View File

@@ -0,0 +1 @@
export declare const AXIOS_INSTANCE_TOKEN = "AXIOS_INSTANCE_TOKEN";

View File

@@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.AXIOS_INSTANCE_TOKEN = 'AXIOS_INSTANCE_TOKEN';

View File

@@ -1,2 +1,5 @@
import { AxiosRequestConfig } from 'axios';
import { DynamicModule } from '../interfaces';
export declare class HttpModule {
static register(config: AxiosRequestConfig): DynamicModule;
}

View File

@@ -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;

View File

@@ -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;
}

View File

@@ -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;

View File

@@ -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';

View File

@@ -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"));

View File

@@ -0,0 +1,2 @@
import { MulterField, MulterOptions } from '../interfaces/external/multer-options.interface';
export declare function FileFieldsInterceptor(uploadFields: MulterField[], options?: MulterOptions): any;

View 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;

View File

@@ -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$;
}
});
}

View File

@@ -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;

View File

@@ -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;

View File

@@ -1,2 +1,3 @@
export * from './file-fields.interceptor';
export * from './file.interceptor';
export * from './files.interceptor';

View File

@@ -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"));

View File

@@ -1,2 +1,2 @@
import { PayloadTooLargeException, BadRequestException } from './../../exceptions';
import { BadRequestException, PayloadTooLargeException } from './../../exceptions';
export declare function transformException(error: Error | undefined): Error | BadRequestException | PayloadTooLargeException;

View File

@@ -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;
}

View File

@@ -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>;
}

View File

@@ -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;
}

View File

@@ -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;

View 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;
}

View File

@@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

View File

@@ -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;
}

View 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;
}

View File

@@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

View 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;
}

View File

@@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

View 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;
}

View File

@@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

View File

@@ -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>;
}

View File

@@ -1 +1 @@
export declare type CustomParamFactory = (data, req) => any;
export declare type CustomParamFactory<TData = any, TRequest = any, TResult = any> = (data: TData, req: TRequest) => TResult;

View File

@@ -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;
}

View File

@@ -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>>;
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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';

View 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;
}

View File

@@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

View File

@@ -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;
};
}

View File

@@ -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 {
}

View 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';

View File

@@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

View 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;
}

View File

@@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

View 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)[];
}

View File

@@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

View 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;
}

View File

@@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

View File

@@ -0,0 +1 @@
export declare type MiddlewareFunction<TRequest = any, TResponse = any, TResult = any> = (req?: TRequest, res?: TResponse, next?: Function) => TResult;

View File

@@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

View File

@@ -0,0 +1,4 @@
import { MiddlewareFunction } from './middleware.interface';
export interface NestMiddleware {
resolve(...args: any[]): MiddlewareFunction | Promise<MiddlewareFunction>;
}

View File

@@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

View File

@@ -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