Compare commits

...

510 Commits

Author SHA1 Message Date
Kamil Myśliwiec
eb1828431d chore(@nestjs) publish v7.2.0 release 2020-06-18 15:50:29 +02:00
Kamil Myśliwiec
038beb0c54 fix(core): fix resolve() method (fallback to get() for static) 2020-06-18 15:34:03 +02:00
Kamil Myśliwiec
2a7bf6a357 fix(core): revert resolve method regression 2020-06-18 15:21:34 +02:00
Kamil Mysliwiec
dc35501e74 Merge pull request #4793 from nestjs/renovate/all-minor-patch
chore(deps): update all non-major dependencies
2020-06-18 15:11:38 +02:00
Kamil Myśliwiec
570dc303c9 fix(): fix update deps issues 2020-06-18 14:24:28 +02:00
Kamil Mysliwiec
300f0e39a5 Merge pull request #4897 from mattleff/graphql-lint-fixes
sample(graphql): Fix lint errors
2020-06-18 13:34:09 +02:00
Kamil Mysliwiec
c76e12eb17 Merge pull request #4907 from Larinel/patch-1
refactor(microservices): rmq connection errors are now being logged
2020-06-18 13:33:27 +02:00
Kamil Myśliwiec
5ca6a1e794 feat(microservices): add client opts to redis options 2020-06-18 12:50:36 +02:00
Kamil Myśliwiec
eb8f58a624 Merge branch 'master' of https://github.com/nestjs/nest 2020-06-18 12:50:17 +02:00
Kamil Myśliwiec
9e7c610ebe docs(): update readme file 2020-06-18 12:50:11 +02:00
Kamil Mysliwiec
f17d29bf99 Merge pull request #4920 from nestjs/renovate/imports-loader-1.x
chore(deps): update dependency imports-loader to v1
2020-06-18 12:31:26 +02:00
Renovate Bot
59c6cebb22 chore(deps): update all non-major dependencies 2020-06-18 10:12:03 +00:00
Renovate Bot
75e1e71e10 chore(deps): update dependency imports-loader to v1 2020-06-17 17:24:52 +00:00
Larinel
d4f93cd909 refactor(microservices): rmq connection errors are now being logged 2020-06-15 14:19:19 +03:00
Matthew Leffler
b5d553604d sample(graphql): Fix lint errors 2020-06-10 13:59:07 -06:00
Kamil Mysliwiec
41764370eb Merge pull request #4884 from nestjs/renovate/npm-apollo-server-express-vulnerability
fix(deps): update dependency apollo-server-express to v2.14.2 [security]
2020-06-08 16:04:41 +02:00
Renovate Bot
e14670ee16 fix(deps): update dependency apollo-server-express to v2.14.2 [security] 2020-06-05 21:33:18 +00:00
Kamil Myśliwiec
5126ff4abc chore(@nestjs) publish v7.1.3 release 2020-06-03 14:16:39 +02:00
Kamil Myśliwiec
54570aa0c8 Merge branch 'master' of https://github.com/nestjs/nest 2020-06-03 14:15:42 +02:00
Kamil Myśliwiec
0b02176c2b fix(core): fix get all and merge (reduce on empty array) 2020-06-03 14:15:34 +02:00
Kamil Mysliwiec
9f14b14b9e Update set-metadata.decorator.ts 2020-06-03 08:55:08 +02:00
Kamil Mysliwiec
9c60cc82e3 Update Readme.md 2020-06-01 15:35:52 +02:00
Kamil Mysliwiec
471335a336 Update Readme.md 2020-06-01 15:35:33 +02:00
Kamil Myśliwiec
6ebe9bf1e0 sample(): remove exclude option from tsconfig 2020-06-01 11:41:42 +02:00
Kamil Myśliwiec
d8715eb7ff sample(): add allow synthetic default imports by default 2020-06-01 11:14:07 +02:00
Kamil Myśliwiec
84bc3581cd chore(@nestjs) publish v7.1.2 release 2020-06-01 11:11:25 +02:00
Kamil Myśliwiec
439736f051 fix(core): add more descriptive messages for invalid usage of resolve() 2020-06-01 11:10:24 +02:00
Kamil Myśliwiec
410fe85081 fix(platform-fastify): wrap response object when @all decorator is used 2020-06-01 11:10:06 +02:00
Kamil Myśliwiec
7ea7fd1f85 sample(graphql): lock packages to specific versions 2020-05-31 18:00:16 +02:00
Kamil Myśliwiec
e3a2c74558 sample(graphql): fix package json 2020-05-31 17:59:55 +02:00
Kamil Myśliwiec
7a8696365c Merge branch 'master' of https://github.com/nestjs/nest 2020-05-31 16:27:54 +02:00
Kamil Myśliwiec
1d15dc650e sample(graphql): add complexity plugin sample 2020-05-31 16:25:26 +02:00
Kamil Mysliwiec
ff75c1297c Merge pull request #4857 from nestjs/renovate/pin-dependencies
fix(deps): pin dependency @nestjs/mongoose to 7.0.1
2020-05-29 10:35:31 +02:00
Renovate Bot
033ac9cab2 fix(deps): pin dependency @nestjs/mongoose to 7.0.1 2020-05-29 08:21:15 +00:00
Kamil Myśliwiec
4f6d658467 sample(mongoose): lock nestjs mongoose package version 2020-05-29 10:19:22 +02:00
Kamil Myśliwiec
5435fab03b sample(): update nestjs mongoose package 2020-05-29 10:18:47 +02:00
Kamil Myśliwiec
c573fb3b89 sample(webpack): add nest cli config file 2020-05-29 09:44:51 +02:00
Kamil Myśliwiec
ae08b12119 fix(core): improve typings for unknown export exception 2020-05-29 08:49:34 +02:00
Kamil Myśliwiec
75e110f4c0 fix(core): use stringified symbol in unknown exported message #4856 2020-05-29 08:45:12 +02:00
Kamil Myśliwiec
230b84f163 chore(@nestjs) publish v7.1.1 release 2020-05-28 10:58:25 +02:00
Kamil Myśliwiec
60b2615d25 Merge branch 'master' of https://github.com/nestjs/nest 2020-05-28 10:57:07 +02:00
Kamil Myśliwiec
b8ce4121ed fix(core): filter out undefined values in get all and merge 2020-05-28 10:56:56 +02:00
Kamil Myśliwiec
486a40b852 fix(common): change first redirect arg to optional 2020-05-28 10:56:31 +02:00
Kamil Mysliwiec
6337793a84 Merge pull request #4843 from nestjs/renovate/pug-3.x
fix(deps): update dependency pug to v3
2020-05-27 08:58:21 +02:00
Renovate Bot
e5f0f54946 fix(deps): update dependency pug to v3 2020-05-25 12:40:05 +00:00
Kamil Myśliwiec
eee8faf433 chore(@nestjs) publish v7.1.0 release 2020-05-24 14:40:37 +02:00
Kamil Myśliwiec
07cb5a83e1 style(): minor style improvements 2020-05-24 14:37:30 +02:00
Kamil Myśliwiec
fa10ab7f7c Merge branch 'sjkummer-bugfix/grpc-options' 2020-05-24 13:54:38 +02:00
Kamil Myśliwiec
f315ca2b90 fix(): remove duplicated options, apply formatting rules 2020-05-24 13:54:25 +02:00
Kamil Myśliwiec
b397cec0fd Merge branch 'bugfix/grpc-options' of https://github.com/sjkummer/nest into sjkummer-bugfix/grpc-options 2020-05-24 13:51:51 +02:00
Kamil Myśliwiec
0d6ae6fe88 Merge branch '2Kable-fix/hybrid-configuration' 2020-05-24 13:50:51 +02:00
Kamil Myśliwiec
34f74561de test(): add tests for lifecycle hooks, remove scope from module 2020-05-24 13:50:26 +02:00
Kamil Myśliwiec
28b1784966 Merge branch 'fix/hybrid-configuration' of https://github.com/2Kable/nest into 2Kable-fix/hybrid-configuration 2020-05-24 13:20:53 +02:00
Kamil Myśliwiec
a683a545af Merge branch 'barbarosh-feature/message-pattern-bind-to-transport' 2020-05-24 13:19:36 +02:00
Kamil Myśliwiec
d1816a3199 refactor(): adjust style to the rest of codebase 2020-05-24 13:19:24 +02:00
Kamil Myśliwiec
3e4f8bcbf1 Merge branch 'feature/message-pattern-bind-to-transport' of https://github.com/barbarosh/nest into barbarosh-feature/message-pattern-bind-to-transport 2020-05-24 13:14:14 +02:00
Kamil Mysliwiec
a09e77a50a Merge pull request #4831 from nestjs/renovate/graphql-tools-6.x
fix(deps): update dependency graphql-tools to v6
2020-05-24 12:23:48 +02:00
Kamil Mysliwiec
7970c29f16 Merge pull request #4834 from nestjs/renovate/major-typescript-eslint-monorepo
chore(deps): update typescript-eslint monorepo to v3 (major)
2020-05-23 12:57:50 +02:00
Kamil Myśliwiec
09fea2b45c sample(): style tests change, module to module ref 2020-05-23 12:41:56 +02:00
Renovate Bot
3f68b08bfc fix(deps): update dependency graphql-tools to v6 2020-05-23 10:14:03 +00:00
Renovate Bot
5ba0164f35 chore(deps): update typescript-eslint monorepo to v3 2020-05-23 10:09:05 +00:00
Kamil Myśliwiec
d768b5df32 sample(): fix prisma bindings file 2020-05-23 11:50:36 +02:00
Kamil Myśliwiec
5388ffb09b feat(): update to the latest typescript eslint packages 2020-05-23 11:46:45 +02:00
Kamil Mysliwiec
3fae1c2503 Merge pull request #4802 from nestjs/renovate/tslib-2.x
fix(deps): update dependency tslib to v2
2020-05-23 11:38:10 +02:00
Kamil Mysliwiec
2aa0881b46 Merge pull request #4827 from soyuka/fix/axios-config-mutation
fix(http): remove axios config mutation #4803
2020-05-23 11:35:37 +02:00
Kamil Mysliwiec
55032c15f4 Merge pull request #4817 from Jekiwijaya/fix/grpc-client/option-value
fix(microservices): enable grpc option value to accept 0
2020-05-23 11:34:54 +02:00
Kamil Mysliwiec
de54172f6b Merge pull request #4808 from nestjs/renovate/ts-jest-26.x
chore(deps): update dependency ts-jest to v26
2020-05-23 11:34:31 +02:00
Sebastian Schmid
2dcff086b3 make channelOptions optional 2020-05-20 16:42:16 +02:00
soyuka
edadbb1af9 fix(http): remove axios config mutation 2020-05-20 16:03:40 +02:00
Jacky Wijaya
d562bc0225 fix(microservices): enable grpc option value to accept 0 2020-05-17 22:06:57 +07:00
alex
07237f5aed test(microservices): add tests for new feature 2020-05-17 01:22:32 +03:00
alex
0432284865 feat(sample): add hybrid app microservices sample 2020-05-16 15:56:33 +03:00
alex
e2c8f74f19 feat(microservices): move getTransportId functions to public variable transportId and make it optional 2020-05-16 15:22:15 +03:00
Renovate Bot
19b4083936 chore(deps): update dependency ts-jest to v26 2020-05-15 19:34:09 +00:00
Kamil Myśliwiec
baadb3f925 chore(@nestjs) publish v7.0.13 release 2020-05-15 11:53:15 +02:00
Kamil Myśliwiec
f9ce824eaf chore(@nestjs) publish v7.0.12 release 2020-05-15 10:33:54 +02:00
Kamil Myśliwiec
43a4ea4d39 Merge branch 'soyuka-fix/axios-config-mutation' 2020-05-15 10:32:28 +02:00
Kamil Myśliwiec
138e2c41f0 refactor(): switch to an inline condition 2020-05-15 10:32:07 +02:00
Kamil Myśliwiec
53d3574a43 Merge branch 'fix/axios-config-mutation' of https://github.com/soyuka/nest into soyuka-fix/axios-config-mutation 2020-05-15 10:30:13 +02:00
Kamil Myśliwiec
f3a8f7f174 Merge branch 'master' of https://github.com/nestjs/nest 2020-05-15 10:28:41 +02:00
Kamil Myśliwiec
47cd27e0cc fix(core): enforce default scope if override provider (use value) #4800 2020-05-15 10:28:30 +02:00
soyuka
91d7564d92 fix(http): remove axios config mutation 2020-05-14 16:51:16 +02:00
Renovate Bot
b236e30231 fix(deps): update dependency tslib to v2 2020-05-13 23:37:49 +00:00
Kamil Mysliwiec
dc1bd46c03 Update renovate.json 2020-05-13 09:00:19 +02:00
Kamil Mysliwiec
8c146fe341 Merge pull request #4783 from nestjs/renovate/nest-monorepo
fix(deps): update nest monorepo to v7.0.11
2020-05-12 15:04:31 +02:00
Renovate Bot
c49c271c22 fix(deps): update nest monorepo to v7.0.11 2020-05-12 12:18:23 +00:00
Kamil Mysliwiec
b59965ba76 Update LICENSE 2020-05-12 14:11:30 +02:00
Kamil Myśliwiec
b1ed6db4fb chore(): update readme file 2020-05-12 14:10:31 +02:00
Kamil Myśliwiec
661664d8be chore(@nestjs) publish v7.0.11 release 2020-05-12 14:06:57 +02:00
Kamil Myśliwiec
64df4a96c9 Merge branch 'master' of https://github.com/nestjs/nest 2020-05-12 14:05:14 +02:00
Kamil Myśliwiec
7775081159 fix(core): dont instantiate transient classes when inquirer is transient 2020-05-12 14:05:05 +02:00
Kamil Mysliwiec
dcf3ca0d4c Merge pull request #4587 from BrunnerLivio/fix/improve-invalid-module-exception
fix(core): improve error message when imported module is nil
2020-05-12 14:00:04 +02:00
Kamil Myśliwiec
9ee7c3ffa3 chore(@nestjs) publish v7.0.10 release 2020-05-12 12:24:32 +02:00
Kamil Myśliwiec
1f8b45bf9b sample(mongoose): use decorators to create a schema definition 2020-05-12 12:19:41 +02:00
Kamil Myśliwiec
97061348f5 Merge branch 'master' of https://github.com/nestjs/nest 2020-05-12 12:19:06 +02:00
Kamil Mysliwiec
a8da4f74da Merge pull request #4759 from nestjs/renovate/eslint-7.x
chore(deps): update dependency eslint to v7
2020-05-12 12:19:01 +02:00
Kamil Mysliwiec
1bc9939000 Update packages/core/errors/exceptions/undefined-forwardref.exception.ts 2020-05-12 12:08:10 +02:00
Kamil Mysliwiec
e4184145cb Update packages/core/injector/container.ts 2020-05-12 12:08:02 +02:00
Kamil Mysliwiec
3e0fb387a0 Update packages/core/injector/container.ts 2020-05-12 12:07:47 +02:00
Kamil Myśliwiec
630c3be032 Merge branch 'master' of https://github.com/nestjs/nest 2020-05-12 12:06:33 +02:00
Kamil Mysliwiec
1f880c7e8b Merge pull request #4629 from apatryda/4590-default-value-pipe
feat(common): add a default-value pipe
2020-05-12 12:06:27 +02:00
Kamil Mysliwiec
47184d4ddb Merge pull request #4699 from digital-value-apps/http_service_with_cancel_token
fix(common): Allow users to provide a cancellation token to http service
2020-05-12 12:05:54 +02:00
Kamil Mysliwiec
822bbba826 Merge pull request #4764 from nestjs/renovate/fastify-formbody-3.x
fix(deps): update dependency fastify-formbody to v3.2.0
2020-05-12 12:05:31 +02:00
Kamil Mysliwiec
91f44a0978 Merge pull request #4707 from nestjs/renovate/uuid-8.x
fix(deps): update dependency uuid to v8
2020-05-12 12:05:18 +02:00
Kamil Mysliwiec
53965ec396 Merge pull request #4774 from Durairaj/master
fix(deps): removed kafka-node, since that types is not used
2020-05-12 12:03:40 +02:00
Kamil Mysliwiec
e394f73a39 Merge pull request #4763 from nestjs/renovate/ts-jest-25.x
chore(deps): update dependency ts-jest to v25.5.1
2020-05-12 12:02:55 +02:00
Kamil Mysliwiec
f76ea42d4d Merge pull request #4782 from nestjs/renovate/nestjs-serve-static-2.x
fix(deps): update dependency @nestjs/serve-static to v2.1.1
2020-05-12 12:01:45 +02:00
Kamil Myśliwiec
bfcd6f25d6 Merge branch 'master' of https://github.com/nestjs/nest 2020-05-12 12:00:25 +02:00
Kamil Myśliwiec
d08c7c742b fix(core): resolve nested transient providers #4756 2020-05-12 11:59:59 +02:00
Renovate Bot
0fa229529e chore(deps): update dependency eslint to v7 2020-05-12 08:52:33 +00:00
Renovate Bot
47fcaaf855 fix(deps): update dependency fastify-formbody to v3.2.0 2020-05-12 08:42:09 +00:00
Renovate Bot
a4ea40dacc fix(deps): update dependency @nestjs/serve-static to v2.1.1 2020-05-12 08:40:23 +00:00
Renovate Bot
48ab7359e4 chore(deps): update dependency ts-jest to v25.5.1 2020-05-12 08:39:43 +00:00
Kamil Mysliwiec
cb65d90249 Merge pull request #4757 from nestjs/renovate/bull-3.x
fix(deps): update dependency bull to v3.14.0
2020-05-12 10:21:28 +02:00
Kamil Mysliwiec
341746313a Merge pull request #4758 from nestjs/renovate/fastify-2.x
fix(deps): update dependency fastify to v2.14.1
2020-05-12 10:21:20 +02:00
Kamil Mysliwiec
d1d583af07 Merge pull request #4760 from nestjs/renovate/conventional-changelog-3.x
chore(deps): update dependency conventional-changelog to v3.1.21
2020-05-12 10:20:55 +02:00
Kamil Mysliwiec
60e77e92e2 Merge pull request #4761 from nestjs/renovate/mongoose-5.x
fix(deps): update dependency mongoose to v5.9.13
2020-05-12 10:20:47 +02:00
Kamil Mysliwiec
306adf0b3f Merge pull request #4765 from nestjs/renovate/fastify-multipart-1.x
chore(deps): update dependency fastify-multipart to v1.0.6
2020-05-12 10:20:27 +02:00
Kamil Mysliwiec
092a6af52c Merge pull request #4770 from nestjs/renovate/ws-7.x
fix(deps): update dependency ws to v7.3.0
2020-05-12 10:19:56 +02:00
Kamil Mysliwiec
5462d1d152 Merge pull request #4771 from nestjs/renovate/sequelize-5.x
fix(deps): update dependency sequelize to v5.21.8
2020-05-12 10:19:36 +02:00
Kamil Mysliwiec
9179b43f94 Merge pull request #4777 from nestjs/renovate/ts-loader-7.x
chore(deps): update dependency ts-loader to v7.0.4
2020-05-12 10:19:28 +02:00
Kamil Mysliwiec
824b543a94 Merge pull request #4779 from nestjs/renovate/typescript-eslint-monorepo
chore(deps): update typescript-eslint monorepo to v2.32.0
2020-05-12 10:19:18 +02:00
Kamil Mysliwiec
25d9e138c1 Merge pull request #4780 from nestjs/renovate/apollo-graphql-packages
fix(deps): update apollo graphql packages to v2.13.1
2020-05-12 10:14:04 +02:00
Renovate Bot
e32270c202 fix(deps): update apollo graphql packages to v2.13.1 2020-05-11 20:25:17 +00:00
Renovate Bot
643d74df46 chore(deps): update typescript-eslint monorepo to v2.32.0 2020-05-11 17:41:35 +00:00
Renovate Bot
2bda4fca88 chore(deps): update dependency ts-loader to v7.0.4 2020-05-11 15:58:59 +00:00
Renovate Bot
d5807f160b fix(deps): update dependency bull to v3.14.0 2020-05-11 13:35:42 +00:00
Durairaj Subramaniam
fe9afa34ee fix(deps): removed kafka-node, since that types is not used 2020-05-10 20:51:01 +01:00
Renovate Bot
79c5014d82 fix(deps): update dependency sequelize to v5.21.8 2020-05-10 11:15:36 +00:00
Renovate Bot
3208409654 fix(deps): update dependency ws to v7.3.0 2020-05-10 06:37:58 +00:00
alex
0845dab3a3 feat(microservices): Add ability for pass transport to MessagePattern 2020-05-10 02:30:16 +03:00
Renovate Bot
56a24622b6 chore(deps): update dependency fastify-multipart to v1.0.6 2020-05-09 16:42:11 +00:00
Renovate Bot
62b0330a1c fix(deps): update dependency mongoose to v5.9.13 2020-05-09 10:10:35 +00:00
Renovate Bot
c0acada6a8 chore(deps): update dependency conventional-changelog to v3.1.21 2020-05-08 22:21:33 +00:00
Renovate Bot
75830c9eaf fix(deps): update dependency fastify to v2.14.1 2020-05-08 18:55:59 +00:00
Kamil Mysliwiec
bb71ceaf3d Merge pull request #4754 from nestjs/renovate/mqtt-4.x
chore(deps): update dependency mqtt to v4.0.1
2020-05-08 08:41:27 +02:00
Renovate Bot
34a6704b12 chore(deps): update dependency mqtt to v4.0.1 2020-05-07 17:33:06 +00:00
Kamil Mysliwiec
cbda11b4fb Merge pull request #4749 from nestjs/renovate/nestjs-swagger-4.x
fix(deps): update dependency @nestjs/swagger to v4.5.5
2020-05-07 10:02:49 +02:00
Renovate Bot
b4c06f2242 fix(deps): update dependency @nestjs/swagger to v4.5.5 2020-05-07 07:24:34 +00:00
Kamil Mysliwiec
1cb1c76f03 Merge pull request #4747 from nestjs/renovate/ts-loader-7.x
chore(deps): update dependency ts-loader to v7.0.3
2020-05-07 09:23:39 +02:00
Kamil Mysliwiec
ff6365225d Merge pull request #4748 from nestjs/renovate/nestjs-mongoose-7.x
fix(deps): update dependency @nestjs/mongoose to v7
2020-05-07 09:22:35 +02:00
Renovate Bot
902e6cd322 chore(deps): update dependency ts-loader to v7.0.3 2020-05-07 06:56:18 +00:00
Kamil Mysliwiec
ca065578f8 Merge pull request #4741 from nestjs/renovate/ts-jest-25.x
chore(deps): update dependency ts-jest to v25.5.0
2020-05-07 08:45:06 +02:00
Renovate Bot
221c2c839f fix(deps): update dependency @nestjs/mongoose to v7 2020-05-07 06:42:03 +00:00
Renovate Bot
a0b84ffd1e chore(deps): update dependency ts-jest to v25.5.0 2020-05-06 09:31:23 +00:00
Renovate Bot
e6233cbd5b fix(deps): update dependency uuid to v8 2020-05-06 07:40:30 +00:00
Kamil Mysliwiec
a2e1cfcd62 Merge pull request #4740 from nestjs/renovate/tslib-1.x
fix(deps): update dependency tslib to v1.11.2
2020-05-06 08:21:10 +02:00
Renovate Bot
8d2c79fa83 fix(deps): update dependency tslib to v1.11.2 2020-05-06 00:28:53 +00:00
Kamil Mysliwiec
8a2c6063b7 Merge pull request #4735 from nestjs/renovate/jest-monorepo
chore(deps): update dependency jest to v26.0.1
2020-05-05 20:48:45 +02:00
Kamil Mysliwiec
a4f8419698 Merge pull request #4738 from nestjs/renovate/redis-2.x
chore(deps): update dependency @types/redis to v2.8.20
2020-05-05 20:41:01 +02:00
Renovate Bot
4044d60583 chore(deps): update dependency @types/redis to v2.8.20 2020-05-05 17:00:54 +00:00
Renovate Bot
16ba70cba2 chore(deps): update dependency jest to v26.0.1 2020-05-05 12:05:39 +00:00
Kamil Mysliwiec
c31f2f6c5f Merge pull request #4730 from nestjs/renovate/major-jest-monorepo
chore(deps): update dependency jest to v26
2020-05-05 09:52:27 +02:00
Renovate Bot
b463a8e93b chore(deps): update dependency jest to v26 2020-05-05 07:17:46 +00:00
Kamil Mysliwiec
4e736b925c Merge pull request #4732 from nestjs/renovate/mongoose-5.x
fix(deps): update dependency mongoose to v5.9.12
2020-05-05 08:49:24 +02:00
Kamil Mysliwiec
ec29c7e19c Merge pull request #4729 from nestjs/renovate/typescript-eslint-monorepo
chore(deps): update typescript-eslint monorepo to v2.31.0
2020-05-05 08:49:12 +02:00
Kamil Mysliwiec
36c2ed1b9e Merge pull request #4728 from nestjs/renovate/nestjs-swagger-4.x
fix(deps): update dependency @nestjs/swagger to v4.5.4
2020-05-05 08:49:02 +02:00
Kamil Mysliwiec
8dac4d0f1c Merge pull request #4727 from nestjs/renovate/nestjs-graphql-7.x
fix(deps): update dependency @nestjs/graphql to v7.3.7
2020-05-05 08:48:53 +02:00
Kamil Mysliwiec
289e04dc86 Merge pull request #4726 from nestjs/renovate/apollo-graphql-packages
fix(deps): update apollo graphql packages to v2.13.0
2020-05-05 08:48:42 +02:00
Kamil Mysliwiec
90bfda4311 Merge pull request #4733 from nestjs/renovate/redis-2.x
chore(deps): update dependency @types/redis to v2.8.19
2020-05-05 08:46:45 +02:00
Renovate Bot
dd9086d612 chore(deps): update dependency @types/redis to v2.8.19 2020-05-05 00:55:56 +00:00
Renovate Bot
c8e678682a fix(deps): update dependency mongoose to v5.9.12 2020-05-04 22:48:37 +00:00
Renovate Bot
7b03a6c361 chore(deps): update typescript-eslint monorepo to v2.31.0 2020-05-04 18:02:41 +00:00
Renovate Bot
6634898334 fix(deps): update dependency @nestjs/swagger to v4.5.4 2020-05-04 17:01:42 +00:00
Renovate Bot
c7d890e604 fix(deps): update dependency @nestjs/graphql to v7.3.7 2020-05-04 15:31:23 +00:00
Renovate Bot
1d938fd911 fix(deps): update apollo graphql packages to v2.13.0 2020-05-04 15:28:26 +00:00
Kamil Mysliwiec
995e2870d5 Merge pull request #4725 from vferdiansyah/patch-1
Update README.md
2020-05-04 13:51:13 +02:00
Veri Ferdiansyah
6bb1d88d36 Update README.md 2020-05-04 18:49:01 +07:00
Kamil Mysliwiec
ea8fe39e43 Merge pull request #4714 from nestjs/renovate/supertest-2.x
chore(deps): update dependency @types/supertest to v2.0.9
2020-05-04 12:07:39 +02:00
Kamil Mysliwiec
3b189faa67 Merge pull request #4711 from nestjs/renovate/mongoose-5.x
fix(deps): update dependency mongoose to v5.9.11
2020-05-04 12:06:35 +02:00
Kamil Mysliwiec
535dff89c0 Merge pull request #4712 from nestjs/renovate/cache-manager-3.x
chore(deps): update dependency cache-manager to v3.3.0
2020-05-04 11:23:24 +02:00
Renovate Bot
7aed631783 fix(deps): update dependency mongoose to v5.9.11 2020-05-04 08:28:59 +00:00
Renovate Bot
06f68651ec chore(deps): update dependency cache-manager to v3.3.0 2020-05-04 08:26:24 +00:00
Renovate Bot
447e1e3ed6 chore(deps): update dependency @types/supertest to v2.0.9 2020-05-04 08:22:29 +00:00
Kamil Mysliwiec
c8f5fc483d Merge pull request #4709 from nestjs/renovate/nestjs-graphql-7.x
fix(deps): update dependency @nestjs/graphql to v7.3.5
2020-05-04 10:12:42 +02:00
Kamil Mysliwiec
2379f9775e Merge pull request #4702 from nestjs/renovate/jest-monorepo
chore(deps): update dependency jest to v25.5.4
2020-05-04 10:12:32 +02:00
Kamil Mysliwiec
d4943751fa Merge pull request #4710 from nestjs/renovate/lint-staged-10.x
chore(deps): update dependency lint-staged to v10.2.2
2020-05-04 10:12:11 +02:00
Kamil Mysliwiec
86e98dc74f Merge pull request #4720 from nestjs/renovate/ts-node-8.x
chore(deps): update dependency ts-node to v8.10.1
2020-05-04 10:11:53 +02:00
Kamil Mysliwiec
6f658624fd Merge pull request #4724 from nestjs/renovate/nest-monorepo
chore(deps): update dependency @nestjs/cli to v7.1.5
2020-05-04 10:11:31 +02:00
Renovate Bot
aad7ec2862 chore(deps): update dependency @nestjs/cli to v7.1.5 2020-05-04 07:56:10 +00:00
Renovate Bot
1ee4bc56b0 chore(deps): update dependency ts-node to v8.10.1 2020-05-03 07:13:50 +00:00
Renovate Bot
bacdc8676b chore(deps): update dependency jest to v25.5.4 2020-05-02 08:45:47 +00:00
Livio
36ba59553c fix(core): improve error message when imported module is nil
fixes #4586
2020-05-02 00:14:42 +02:00
Renovate Bot
9e9c649e6b chore(deps): update dependency lint-staged to v10.2.2 2020-05-01 04:31:51 +00:00
Renovate Bot
0bb5f91a67 fix(deps): update dependency @nestjs/graphql to v7.3.5 2020-04-30 08:05:00 +00:00
Kamil Mysliwiec
011ae85143 Merge pull request #4703 from nestjs/renovate/mongodb-3.x
fix(deps): update dependency mongodb to v3.5.7
2020-04-30 09:02:03 +02:00
Kamil Mysliwiec
b6433fc7ee Merge pull request #4705 from nestjs/renovate/babel-monorepo
chore(deps): update babel monorepo to v7.9.6
2020-04-30 09:01:58 +02:00
Kamil Mysliwiec
12a92d98c4 Merge pull request #4706 from nestjs/renovate/nats-1.x
chore(deps): update dependency nats to v1.4.9
2020-04-30 09:01:40 +02:00
Kamil Mysliwiec
142005573e Merge pull request #4708 from nestjs/renovate/ts-loader-7.x
chore(deps): update dependency ts-loader to v7.0.2
2020-04-30 09:01:24 +02:00
Renovate Bot
9349189a1a chore(deps): update dependency ts-loader to v7.0.2 2020-04-30 05:53:58 +00:00
Renovate Bot
8fff239f1b chore(deps): update dependency nats to v1.4.9 2020-04-29 20:43:36 +00:00
Renovate Bot
c7fee93706 chore(deps): update babel monorepo to v7.9.6 2020-04-29 18:46:12 +00:00
Renovate Bot
c70bbb1923 fix(deps): update dependency mongodb to v3.5.7 2020-04-29 12:13:38 +00:00
Kamil Mysliwiec
1e98a8e790 Merge pull request #4697 from nestjs/renovate/lint-staged-10.x
chore(deps): update dependency lint-staged to v10.2.0
2020-04-29 09:04:54 +02:00
Kamil Mysliwiec
2d33f52b63 Merge pull request #4700 from nestjs/renovate/jest-monorepo
chore(deps): update dependency jest to v25.5.0
2020-04-29 09:03:26 +02:00
Renovate Bot
1280dd6188 chore(deps): update dependency jest to v25.5.0 2020-04-28 20:13:10 +00:00
Nicolas Lenepveu
2b7725bef5 fix(common): Allow users to provide a cancellation token to http service 2020-04-28 20:51:50 +02:00
Renovate Bot
a39a6e9ca5 chore(deps): update dependency lint-staged to v10.2.0 2020-04-28 13:24:21 +00:00
Kamil Mysliwiec
29ad228655 Merge pull request #4695 from nestjs/renovate/docker-mysql-5.x
chore(deps): update mysql docker tag to v5.7.30
2020-04-28 13:52:07 +02:00
Kamil Mysliwiec
f9e39c1b20 Merge pull request #4696 from nestjs/renovate/fastify-2.x
fix(deps): update dependency fastify to v2.14.0
2020-04-28 13:51:56 +02:00
Renovate Bot
b6374e8b0d fix(deps): update dependency fastify to v2.14.0 2020-04-28 10:26:30 +00:00
Fabien Robert
a11da77144 feat(microservice): hybrid microservice can inherit config 2020-04-28 11:05:51 +02:00
Fabien Robert
10bd87cb7f feat(microservice): hybrid microservice can inherit config 2020-04-28 10:40:43 +02:00
Kamil Mysliwiec
b2d37b8de6 Merge pull request #4690 from nestjs/renovate/mqtt-4.x
chore(deps): update dependency mqtt to v4
2020-04-28 09:12:39 +02:00
Renovate Bot
ab2c58d573 chore(deps): update mysql docker tag to v5.7.30 2020-04-28 07:11:30 +00:00
Kamil Mysliwiec
de577292e3 Merge pull request #4689 from nestjs/renovate/typescript-eslint-monorepo
chore(deps): update typescript-eslint monorepo to v2.30.0
2020-04-28 09:09:49 +02:00
Kamil Mysliwiec
04cb13aa4d Merge pull request #4687 from nestjs/renovate/nest-monorepo
chore(deps): update dependency @nestjs/cli to v7.1.4
2020-04-28 09:09:36 +02:00
Renovate Bot
380a68d3be chore(deps): update typescript-eslint monorepo to v2.30.0 2020-04-27 17:43:40 +00:00
Renovate Bot
abdeee69b4 chore(deps): update dependency mqtt to v4 2020-04-27 17:30:06 +00:00
Renovate Bot
47e25265f6 chore(deps): update dependency @nestjs/cli to v7.1.4 2020-04-27 13:36:39 +00:00
Kamil Mysliwiec
e95d527ed9 Merge pull request #4679 from nestjs/renovate/ts-node-8.x
chore(deps): update dependency ts-node to v8.9.1
2020-04-27 09:36:57 +02:00
Renovate Bot
694704c27b chore(deps): update dependency ts-node to v8.9.1 2020-04-27 07:20:03 +00:00
Kamil Mysliwiec
a92f1262e4 Merge pull request #4675 from nestjs/renovate/ws-7.x
fix(deps): update dependency ws to v7.2.5
2020-04-27 09:07:55 +02:00
Kamil Mysliwiec
f2b382538b Merge pull request #4680 from nestjs/renovate/mocha-7.x
chore(deps): update dependency mocha to v7.1.2
2020-04-27 09:07:26 +02:00
Kamil Mysliwiec
87bdf87d2f Merge pull request #4681 from nestjs/renovate/mongoose-5.x
chore(deps): update dependency @types/mongoose to v5.7.14
2020-04-27 09:06:29 +02:00
Kamil Mysliwiec
afc19bdd5d Merge pull request #4685 from nestjs/renovate/ts-morph-7.x
chore(deps): update dependency ts-morph to v7.0.3
2020-04-27 09:05:57 +02:00
Renovate Bot
649033ddbc chore(deps): update dependency ts-morph to v7.0.3 2020-04-26 22:52:00 +00:00
Renovate Bot
a215322ace chore(deps): update dependency @types/mongoose to v5.7.14 2020-04-26 18:04:44 +00:00
Renovate Bot
0c2e73c78e chore(deps): update dependency mocha to v7.1.2 2020-04-26 06:31:20 +00:00
Renovate Bot
74d7a2f4ca fix(deps): update dependency ws to v7.2.5 2020-04-25 10:58:46 +00:00
Kamil Mysliwiec
fb44f21e96 Merge pull request #4665 from nestjs/renovate/coveralls-3.x
chore(deps): update dependency coveralls to v3.1.0
2020-04-25 12:54:21 +02:00
Kamil Mysliwiec
b271d89146 Merge pull request #4667 from nestjs/renovate/nest-monorepo
fix(deps): update nest monorepo to v7.0.9
2020-04-25 12:54:12 +02:00
Kamil Mysliwiec
1f6deb0c11 Merge pull request #4663 from nestjs/renovate/class-validator-0.x
fix(deps): update dependency class-validator to v0.12.2
2020-04-25 12:09:27 +02:00
Kamil Mysliwiec
392a13f758 Merge pull request #4672 from nestjs/renovate/mongoose-5.x
chore(deps): update dependency @types/mongoose to v5.7.13
2020-04-25 12:09:08 +02:00
Kamil Mysliwiec
e0a2eb7398 Merge pull request #4673 from nestjs/renovate/concurrently-5.x
chore(deps): update dependency concurrently to v5.2.0
2020-04-25 12:08:54 +02:00
Renovate Bot
426a3b04f2 chore(deps): update dependency concurrently to v5.2.0 2020-04-25 04:13:27 +00:00
Renovate Bot
f0973d607f chore(deps): update dependency @types/mongoose to v5.7.13 2020-04-24 23:51:43 +00:00
Renovate Bot
55a828a901 chore(deps): update dependency coveralls to v3.1.0 2020-04-24 22:44:52 +00:00
Renovate Bot
23181cb819 fix(deps): update nest monorepo to v7.0.9 2020-04-24 07:14:35 +00:00
Kamil Myśliwiec
a5a8712668 chore(@nestjs) publish v7.0.9 release 2020-04-24 09:02:26 +02:00
Kamil Myśliwiec
77fc5da848 Merge branch 'master' of https://github.com/nestjs/nest 2020-04-24 09:00:10 +02:00
Kamil Myśliwiec
b2bd950cc9 fix(core): fix nullable constructor host when factory provided 2020-04-24 08:59:38 +02:00
Kamil Myśliwiec
e5db8e414e sample(grpc): fix hero proto file 2020-04-24 08:59:05 +02:00
Renovate Bot
678986aa7e fix(deps): update dependency class-validator to v0.12.2 2020-04-23 20:26:22 +00:00
Kamil Mysliwiec
f4d8fad2d4 Merge pull request #4633 from apatryda/4632-tests-should-run-ootb
test: fix tests to make them run ootb
2020-04-23 09:09:08 +02:00
Kamil Mysliwiec
aaf4cb591e Merge pull request #4650 from nestjs/renovate/lint-staged-10.x
chore(deps): update dependency lint-staged to v10.1.7
2020-04-23 09:08:36 +02:00
Kamil Mysliwiec
41f59daa58 Merge pull request #4651 from nestjs/renovate/webpack-4.x
chore(deps): update dependency webpack to v4.43.0
2020-04-23 09:08:28 +02:00
Kamil Mysliwiec
8a253c5f76 Merge pull request #4652 from nestjs/renovate/prettier-2.x
chore(deps): update dependency prettier to v2.0.5
2020-04-23 09:08:06 +02:00
Kamil Mysliwiec
1117b246c6 Merge pull request #4653 from nestjs/renovate/coveralls-3.x
chore(deps): update dependency coveralls to v3.0.13
2020-04-23 09:07:54 +02:00
Kamil Mysliwiec
661424f389 Merge pull request #4654 from nestjs/renovate/eslint-config-prettier-6.x
chore(deps): update dependency eslint-config-prettier to v6.11.0
2020-04-23 09:07:49 +02:00
Kamil Mysliwiec
d8ab987130 Merge pull request #4661 from nestjs/renovate/sequelize-5.x
fix(deps): update dependency sequelize to v5.21.7
2020-04-23 09:07:42 +02:00
Renovate Bot
92908c8f0f fix(deps): update dependency sequelize to v5.21.7 2020-04-23 03:56:46 +00:00
Renovate Bot
5e820cc788 chore(deps): update dependency coveralls to v3.0.13 2020-04-21 20:44:09 +00:00
Renovate Bot
8edb035a87 chore(deps): update dependency eslint-config-prettier to v6.11.0 2020-04-21 19:45:37 +00:00
Renovate Bot
4022347860 chore(deps): update dependency prettier to v2.0.5 2020-04-21 17:50:59 +00:00
Renovate Bot
6ee10bef9d chore(deps): update dependency webpack to v4.43.0 2020-04-21 16:32:15 +00:00
Renovate Bot
cf2c279be2 chore(deps): update dependency lint-staged to v10.1.7 2020-04-21 14:43:20 +00:00
Kamil Mysliwiec
4c9d1de10e Merge pull request #4647 from nestjs/renovate/nestjs-graphql-7.x
fix(deps): update dependency @nestjs/graphql to v7.3.4
2020-04-21 10:02:07 +02:00
Renovate Bot
1a0b213d97 fix(deps): update dependency @nestjs/graphql to v7.3.4 2020-04-21 07:47:54 +00:00
Kamil Mysliwiec
8a7fc27513 Merge pull request #4642 from nestjs/renovate/ts-node-8.x
chore(deps): update dependency ts-node to v8.9.0
2020-04-21 09:07:31 +02:00
Kamil Mysliwiec
17edde1a22 Merge pull request #4643 from nestjs/renovate/fastify-static-2.x
chore(deps): update dependency fastify-static to v2.7.0
2020-04-21 09:06:46 +02:00
Kamil Mysliwiec
387f918973 Merge pull request #4645 from nestjs/renovate/mongoose-5.x
fix(deps): update dependency mongoose to v5.9.10
2020-04-21 09:04:45 +02:00
Renovate Bot
11794b99c0 fix(deps): update dependency mongoose to v5.9.10 2020-04-20 22:02:07 +00:00
Renovate Bot
4a14444088 chore(deps): update dependency fastify-static to v2.7.0 2020-04-20 21:11:46 +00:00
Renovate Bot
44a23593aa chore(deps): update dependency ts-node to v8.9.0 2020-04-20 20:55:30 +00:00
Kamil Mysliwiec
e84d90ae86 Merge pull request #4638 from nestjs/renovate/nestjs-swagger-4.x
fix(deps): update dependency @nestjs/swagger to v4.5.3
2020-04-20 20:42:03 +02:00
Kamil Mysliwiec
e7ee336b8c Merge pull request #4637 from nestjs/renovate/nestjs-graphql-7.x
fix(deps): update dependency @nestjs/graphql to v7.3.3
2020-04-20 20:41:55 +02:00
Kamil Mysliwiec
7b241818a5 Merge pull request #4641 from nestjs/renovate/typescript-eslint-monorepo
chore(deps): update typescript-eslint monorepo to v2.29.0
2020-04-20 20:40:54 +02:00
Renovate Bot
6d68283c4b chore(deps): update typescript-eslint monorepo to v2.29.0 2020-04-20 17:22:14 +00:00
Artur Nerkowski
f2726c19cb test: fix tests to make them run ootb 2020-04-20 17:04:59 +02:00
Renovate Bot
87c06eef42 fix(deps): update dependency @nestjs/swagger to v4.5.3 2020-04-20 14:54:54 +00:00
Artur Nerkowski
810bb029be feat(common): add a default-value pipe 2020-04-20 16:52:16 +02:00
Renovate Bot
e5dc2c29a5 fix(deps): update dependency @nestjs/graphql to v7.3.3 2020-04-20 14:46:34 +00:00
Kamil Mysliwiec
94a21eb683 Merge pull request #4636 from nestjs/renovate/nestjs-graphql-7.x
fix(deps): update dependency @nestjs/graphql to v7.3.2
2020-04-20 16:32:46 +02:00
Renovate Bot
ddb75ae335 fix(deps): update dependency @nestjs/graphql to v7.3.2 2020-04-20 11:40:13 +00:00
Kamil Mysliwiec
90506e09a6 Merge pull request #4626 from nestjs/renovate/class-validator-0.x
fix(deps): update dependency class-validator to v0.12.1
2020-04-20 11:21:44 +02:00
Kamil Mysliwiec
fc704b7cb9 Merge pull request #4635 from nestjs/renovate/nestjs-schedule-0.x
fix(deps): update dependency @nestjs/schedule to v0.3.1
2020-04-20 10:00:23 +02:00
Renovate Bot
307fbbf9df fix(deps): update dependency @nestjs/schedule to v0.3.1 2020-04-20 07:48:52 +00:00
Kamil Mysliwiec
bf09428376 Merge pull request #4620 from nestjs/renovate/lint-staged-10.x
chore(deps): update dependency lint-staged to v10.1.6
2020-04-20 09:33:01 +02:00
Kamil Mysliwiec
99de33c79e Merge pull request #4625 from nestjs/renovate/redis-2.x
chore(deps): update dependency @types/redis to v2.8.18
2020-04-20 09:32:54 +02:00
Kamil Mysliwiec
017791186d Merge pull request #4624 from nestjs/renovate/mongoose-5.x
chore(deps): update dependency @types/mongoose to v5.7.12
2020-04-20 09:32:48 +02:00
Kamil Mysliwiec
f5a3269561 Merge pull request #4631 from nestjs/renovate/jest-monorepo
chore(deps): update dependency jest to v25.4.0
2020-04-20 09:32:33 +02:00
Kamil Mysliwiec
002878e091 Merge pull request #4634 from nestjs/renovate/ts-loader-7.x
chore(deps): update dependency ts-loader to v7.0.1
2020-04-20 09:23:57 +02:00
Renovate Bot
d439758319 chore(deps): update dependency ts-loader to v7.0.1 2020-04-20 05:27:29 +00:00
Renovate Bot
95f7eadd8d chore(deps): update dependency jest to v25.4.0 2020-04-19 22:26:24 +00:00
Renovate Bot
1bade34fe1 chore(deps): update dependency lint-staged to v10.1.6 2020-04-19 08:46:13 +00:00
Renovate Bot
c591059904 fix(deps): update dependency class-validator to v0.12.1 2020-04-18 12:30:33 +00:00
Renovate Bot
cf65f16ff3 chore(deps): update dependency @types/redis to v2.8.18 2020-04-17 23:21:12 +00:00
Renovate Bot
3a4b17271b chore(deps): update dependency @types/mongoose to v5.7.12 2020-04-17 23:19:38 +00:00
Kamil Mysliwiec
799ccc24d5 Merge pull request #4619 from nestjs/renovate/nestjs-swagger-4.x
fix(deps): update dependency @nestjs/swagger to v4.5.2
2020-04-17 14:18:04 +02:00
Renovate Bot
67bdae06e9 fix(deps): update dependency @nestjs/swagger to v4.5.2 2020-04-17 12:09:49 +00:00
Kamil Mysliwiec
33b40ff44f Merge pull request #4617 from nestjs/renovate/engine.io-client-3.x
chore(deps): update dependency engine.io-client to v3.4.1
2020-04-17 12:05:37 +02:00
Kamil Mysliwiec
fb3040f866 Merge pull request #4618 from nestjs/renovate/nestjs-graphql-7.x
fix(deps): update dependency @nestjs/graphql to v7.3.1
2020-04-17 12:05:27 +02:00
Renovate Bot
6c986e8c8d fix(deps): update dependency @nestjs/graphql to v7.3.1 2020-04-17 09:51:24 +00:00
Renovate Bot
f54f864b94 chore(deps): update dependency engine.io-client to v3.4.1 2020-04-17 08:52:13 +00:00
Kamil Myśliwiec
e834ec7f5f Merge branch 'master' of https://github.com/nestjs/nest 2020-04-17 10:02:38 +02:00
Kamil Myśliwiec
12de529a48 refactor(core): add missing type to the root module 2020-04-17 10:02:16 +02:00
Kamil Mysliwiec
c604ad18a9 Merge pull request #4611 from nestjs/renovate/merge-graphql-schemas-1.x
chore(deps): update dependency merge-graphql-schemas to v1.7.8
2020-04-17 09:22:55 +02:00
Kamil Mysliwiec
3ce5a028c7 Merge pull request #4616 from nestjs/renovate/ts-jest-25.x
chore(deps): update dependency ts-jest to v25.4.0
2020-04-17 08:55:43 +02:00
Renovate Bot
a2bf742111 chore(deps): update dependency ts-jest to v25.4.0 2020-04-17 06:14:32 +00:00
Sebastian Schmid
b0dc39e589 introduced GRPC channelOptions 2020-04-16 19:44:47 +02:00
Sebastian Schmid
653cc9a787 Merge branch 'master' into bugfix/grpc-options
# Conflicts:
#	packages/microservices/client/client-grpc.ts
2020-04-16 19:35:57 +02:00
Renovate Bot
18547a3879 chore(deps): update dependency merge-graphql-schemas to v1.7.8 2020-04-16 15:30:40 +00:00
Kamil Mysliwiec
50f91e798b Merge pull request #4610 from nestjs/renovate/nestjs-graphql-7.x
fix(deps): update dependency @nestjs/graphql to v7.3.0
2020-04-16 14:45:02 +02:00
Renovate Bot
95269309f8 fix(deps): update dependency @nestjs/graphql to v7.3.0 2020-04-16 12:28:07 +00:00
Kamil Mysliwiec
ac37717cc3 Merge pull request #4608 from nestjs/renovate/nest-monorepo
fix(deps): update nest monorepo to v7.0.8
2020-04-16 11:14:15 +02:00
Renovate Bot
352e643c1a fix(deps): update nest monorepo to v7.0.8 2020-04-16 08:19:55 +00:00
Kamil Myśliwiec
83c2ebfcba chore(): update readme file in packages 2020-04-16 10:08:45 +02:00
Kamil Myśliwiec
edbac299c8 chore(@nestjs) publish v7.0.8 release 2020-04-16 10:07:49 +02:00
Kamil Myśliwiec
9a694cb853 fix(grpc): fix credentials options 2020-04-16 10:00:53 +02:00
Kamil Mysliwiec
2376aa43a5 Merge pull request #4604 from nestjs/renovate/apollo-graphql-packages
fix(deps): update dependency graphql-tools to v4.0.8
2020-04-16 09:27:24 +02:00
Kamil Mysliwiec
9ae9aa3059 Merge pull request #4606 from nestjs/renovate/mongoose-5.x
chore(deps): update dependency @types/mongoose to v5.7.11
2020-04-16 09:26:00 +02:00
Renovate Bot
014824121b chore(deps): update dependency @types/mongoose to v5.7.11 2020-04-15 23:51:45 +00:00
Sebastian Schmid
09ab0087af GRPC: Fix credentials and introduce arguments 2020-04-15 23:56:56 +02:00
Renovate Bot
647235f1ac fix(deps): update dependency graphql-tools to v4.0.8 2020-04-15 14:49:03 +00:00
Kamil Mysliwiec
b14b0f4376 Merge pull request #4594 from nestjs/renovate/nestjs-graphql-7.x
fix(deps): update dependency @nestjs/graphql to v7.2.4
2020-04-15 14:10:53 +02:00
Kamil Mysliwiec
7f5750660a Merge pull request #4600 from nestjs/renovate/ts-loader-7.x
chore(deps): update dependency ts-loader to v7
2020-04-15 14:10:42 +02:00
Renovate Bot
ac87ed8448 chore(deps): update dependency ts-loader to v7 2020-04-15 05:14:51 +00:00
Renovate Bot
2cd6cb9460 fix(deps): update dependency @nestjs/graphql to v7.2.4 2020-04-14 14:25:42 +00:00
Kamil Mysliwiec
e4682d537d Merge pull request #4591 from nestjs/renovate/nestjs-graphql-7.x
fix(deps): update dependency @nestjs/graphql to v7.2.3
2020-04-14 14:18:31 +02:00
Kamil Mysliwiec
e4b8e5d08e Merge pull request #4592 from nestjs/renovate/mongodb-3.x
fix(deps): update dependency mongodb to v3.5.6
2020-04-14 14:18:18 +02:00
Renovate Bot
88f7bd5583 fix(deps): update dependency @nestjs/graphql to v7.2.3 2020-04-14 12:03:17 +00:00
Renovate Bot
8b8156981a fix(deps): update dependency mongodb to v3.5.6 2020-04-14 11:53:57 +00:00
Kamil Mysliwiec
2b15735a33 Update Readme.md 2020-04-14 11:59:13 +02:00
Kamil Mysliwiec
ec0190eeaa Update Readme.md 2020-04-14 11:51:30 +02:00
Kamil Mysliwiec
571eff638d Merge pull request #4589 from nestjs/renovate/nestjs-bull-0.x
fix(deps): update dependency @nestjs/bull to v0.1.1
2020-04-14 11:31:01 +02:00
Renovate Bot
f23eba1f08 fix(deps): update dependency @nestjs/bull to v0.1.1 2020-04-14 09:19:45 +00:00
Kamil Mysliwiec
765a3191ae Merge pull request #4583 from nestjs/renovate/typescript-eslint-monorepo
chore(deps): update typescript-eslint monorepo to v2.28.0
2020-04-14 10:21:35 +02:00
Renovate Bot
915d346855 chore(deps): update typescript-eslint monorepo to v2.28.0 2020-04-14 08:21:05 +00:00
Kamil Mysliwiec
d6e4af4b30 Merge pull request #4580 from nestjs/renovate/mongoose-5.x
fix(deps): update dependency mongoose to v5.9.9
2020-04-14 10:09:21 +02:00
Kamil Mysliwiec
f729b2edd1 Merge pull request #4585 from nestjs/renovate/ws-7.x
chore(deps): update dependency @types/ws to v7.2.4
2020-04-14 10:09:06 +02:00
Renovate Bot
55c5ec8f46 chore(deps): update dependency @types/ws to v7.2.4 2020-04-13 18:59:17 +00:00
Renovate Bot
aa17f033ab fix(deps): update dependency mongoose to v5.9.9 2020-04-13 14:36:57 +00:00
Kamil Mysliwiec
cc6cfef4f0 Merge pull request #4569 from nestjs/renovate/fastify-2.x
fix(deps): update dependency fastify to v2.13.1
2020-04-13 15:24:23 +02:00
Renovate Bot
9edc6b8fe7 fix(deps): update dependency fastify to v2.13.1 2020-04-12 10:22:57 +00:00
Kamil Mysliwiec
016116a71c Update Readme.md 2020-04-10 15:43:46 +02:00
Kamil Mysliwiec
2c1407ad77 Update Readme.md 2020-04-10 15:42:40 +02:00
Kamil Mysliwiec
57435c2135 Update Readme.md 2020-04-10 14:41:31 +02:00
Kamil Mysliwiec
761d5d458a Update Readme.md 2020-04-10 14:40:52 +02:00
Kamil Mysliwiec
c0d3152492 Merge pull request #4506 from Emily-RoseSteyn/fix/#4447/non-expiring-cache
fix(common): change cache ttl decorator to set 0 value ttl
2020-04-10 13:36:36 +02:00
Kamil Mysliwiec
c007ef4025 Merge pull request #4554 from zivbar/my-fix-branch
fix(samples):  catsProvider's useFactory param type
2020-04-10 13:18:15 +02:00
Kamil Mysliwiec
e4598e484d Merge pull request #4556 from nestjs/renovate/lint-staged-10.x
chore(deps): update dependency lint-staged to v10.1.3
2020-04-10 10:11:17 +02:00
Kamil Mysliwiec
2e928ca46f Merge pull request #4557 from nestjs/renovate/husky-4.x
chore(deps): update dependency husky to v4.2.5
2020-04-10 09:14:03 +02:00
Kamil Mysliwiec
0262e9fac1 Merge pull request #4558 from nestjs/renovate/core-js-3.x
chore(deps): update dependency core-js to v3.6.5
2020-04-10 09:13:56 +02:00
Kamil Mysliwiec
7dfb6ce9d7 Merge pull request #4559 from nestjs/renovate/bull-3.x
chore(deps): update dependency @types/bull to v3.12.2
2020-04-10 09:10:14 +02:00
Kamil Mysliwiec
3e7fd83e61 Merge pull request #4560 from nestjs/renovate/mongoose-5.x
chore(deps): update dependency @types/mongoose to v5.7.10
2020-04-10 09:10:09 +02:00
Kamil Mysliwiec
f12ad1bc3a Merge pull request #4561 from nestjs/renovate/express-4.x
chore(deps): update dependency @types/express to v4.17.6
2020-04-10 09:09:59 +02:00
Renovate Bot
10c8dd40d5 chore(deps): update dependency husky to v4.2.5 2020-04-09 21:43:07 +00:00
Renovate Bot
995aba763c chore(deps): update dependency @types/express to v4.17.6 2020-04-09 21:10:24 +00:00
Renovate Bot
c4e87f51f9 chore(deps): update dependency @types/mongoose to v5.7.10 2020-04-09 20:35:57 +00:00
Renovate Bot
e2674c6326 chore(deps): update dependency @types/bull to v3.12.2 2020-04-09 20:33:56 +00:00
Renovate Bot
c34e6901ae chore(deps): update dependency core-js to v3.6.5 2020-04-09 16:58:36 +00:00
Renovate Bot
d0dd846fcf chore(deps): update dependency lint-staged to v10.1.3 2020-04-09 14:19:00 +00:00
Kamil Mysliwiec
b70a5ebff9 Merge pull request #4545 from nestjs/renovate/jest-monorepo
chore(deps): update dependency jest to v25.3.0
2020-04-09 10:18:31 +02:00
Ziv Bar
005c2c4360 fixed catsProvider's useFactory param type 2020-04-09 10:57:37 +03:00
Renovate Bot
edffcc5463 chore(deps): update dependency jest to v25.3.0 2020-04-09 07:30:51 +00:00
Kamil Mysliwiec
d9e4bf47db Merge pull request #4544 from nestjs/renovate/sinon-9.x
chore(deps): update dependency sinon to v9.0.2
2020-04-09 09:04:31 +02:00
Kamil Mysliwiec
4fb7177f3b Merge pull request #4547 from nestjs/renovate/express-4.x
chore(deps): update dependency @types/express to v4.17.5
2020-04-09 09:04:19 +02:00
Kamil Mysliwiec
88aa0cef8b Merge pull request #4548 from nestjs/renovate/ts-morph-7.x
chore(deps): update dependency ts-morph to v7.0.2
2020-04-09 09:04:13 +02:00
Kamil Mysliwiec
9b11c86175 Merge pull request #4549 from nestjs/renovate/nodemon-2.x
chore(deps): update dependency nodemon to v2.0.3
2020-04-09 09:03:46 +02:00
Kamil Mysliwiec
8fde3283ac Merge pull request #4550 from nestjs/renovate/mongoose-5.x
chore(deps): update dependency @types/mongoose to v5.7.9
2020-04-09 09:03:38 +02:00
Renovate Bot
8832d15ba0 chore(deps): update dependency @types/mongoose to v5.7.9 2020-04-08 20:30:39 +00:00
Renovate Bot
515dbdb2c4 chore(deps): update dependency nodemon to v2.0.3 2020-04-08 19:00:12 +00:00
Renovate Bot
3870e1d98e chore(deps): update dependency ts-morph to v7.0.2 2020-04-08 17:33:21 +00:00
Renovate Bot
a835bf29f4 chore(deps): update dependency @types/express to v4.17.5 2020-04-08 16:53:38 +00:00
Renovate Bot
f3fc345cf2 chore(deps): update dependency sinon to v9.0.2 2020-04-08 11:46:59 +00:00
Kamil Mysliwiec
2d99ddc0a1 Merge pull request #4542 from nestjs/renovate/babel-monorepo
chore(deps): update dependency @babel/preset-env to v7.9.5
2020-04-08 08:50:27 +02:00
Kamil Mysliwiec
eebbb26de3 Merge pull request #4541 from nestjs/renovate/apollo-graphql-packages
fix(deps): update apollo graphql packages to v2.12.0
2020-04-08 08:50:09 +02:00
Renovate Bot
4dc5c7514c chore(deps): update dependency @babel/preset-env to v7.9.5 2020-04-07 19:30:34 +00:00
Renovate Bot
364085771e fix(deps): update apollo graphql packages to v2.12.0 2020-04-07 18:42:35 +00:00
Kamil Mysliwiec
9d829f5753 Merge pull request #4538 from nestjs/renovate/fast-json-stringify-2.x
fix(deps): update dependency fast-json-stringify to v2
2020-04-07 19:40:05 +02:00
Renovate Bot
8484c0c922 fix(deps): update dependency fast-json-stringify to v2 2020-04-07 10:46:44 +00:00
Kamil Mysliwiec
2ab3629a8a Merge pull request #4535 from webberwang/fix-invalid-docker-command
build(): fix invalid docker down command
2020-04-07 08:57:29 +02:00
Webber Wang
4c4242f37d build(): fix invalid docker down command
`-d` is not valid flag for `docker-compose down`
2020-04-06 15:37:53 -07:00
Emily
25a478a5a6 Changed to use isNil util 2020-04-06 22:01:22 +02:00
Kamil Mysliwiec
d4c6cfeed0 Merge pull request #4531 from FagundesFurtado/patch-1
Update nest-interceptor.interface.ts
2020-04-06 19:41:52 +02:00
Kamil Mysliwiec
4bb193f64d Merge pull request #4532 from nestjs/renovate/typescript-eslint-monorepo
chore(deps): update typescript-eslint monorepo to v2.27.0
2020-04-06 19:39:49 +02:00
Renovate Bot
dce8d9c5e8 chore(deps): update typescript-eslint monorepo to v2.27.0 2020-04-06 17:21:06 +00:00
Cristiano Fagundes
7a7a71d911 Update nest-interceptor.interface.ts 2020-04-06 11:40:22 -03:00
Kamil Mysliwiec
956baed7cc Merge pull request #4530 from nestjs/renovate/prettier-2.x
chore(deps): update dependency prettier to v2.0.4
2020-04-06 14:29:31 +02:00
Renovate Bot
5d484c53ae chore(deps): update dependency prettier to v2.0.4 2020-04-06 12:18:37 +00:00
Kamil Mysliwiec
da4b1a3cce Merge pull request #4525 from nestjs/renovate/nestjs-graphql-7.x
fix(deps): update dependency @nestjs/graphql to v7.2.1
2020-04-06 10:26:12 +02:00
Kamil Mysliwiec
abb465d4dc Merge pull request #4528 from nestjs/renovate/prettier-2.x
chore(deps): update dependency prettier to v2.0.3
2020-04-06 10:11:27 +02:00
Renovate Bot
789f8a4b30 chore(deps): update dependency prettier to v2.0.3 2020-04-05 21:18:45 +00:00
Renovate Bot
549bb979de fix(deps): update dependency @nestjs/graphql to v7.2.1 2020-04-05 15:01:34 +00:00
Kamil Myśliwiec
1ef5fb8572 Merge branch 'master' of https://github.com/nestjs/nest 2020-04-05 16:28:45 +02:00
Kamil Myśliwiec
1a0d47a22d refactor(): small style improvements 2020-04-05 16:27:14 +02:00
Kamil Mysliwiec
fc0d73e971 Merge pull request #4519 from nestjs/renovate/fast-json-stringify-1.x
fix(deps): update dependency fast-json-stringify to v1.20.0
2020-04-05 11:51:40 +02:00
Kamil Mysliwiec
eb4e40873d Merge pull request #4520 from nestjs/renovate/ts-node-8.x
chore(deps): update dependency ts-node to v8.8.2
2020-04-05 11:51:22 +02:00
Kamil Mysliwiec
0609d6e647 Merge pull request #4522 from nestjs/renovate/lint-staged-10.x
chore(deps): update dependency lint-staged to v10.1.2
2020-04-05 11:42:46 +02:00
Renovate Bot
cb944970ac chore(deps): update dependency lint-staged to v10.1.2 2020-04-05 09:22:05 +00:00
Renovate Bot
417d312692 chore(deps): update dependency ts-node to v8.8.2 2020-04-05 01:51:19 +00:00
Renovate Bot
c48b2efbfa fix(deps): update dependency fast-json-stringify to v1.20.0 2020-04-04 22:36:07 +00:00
Kamil Mysliwiec
fad533ba4d Merge pull request #4515 from nestjs/renovate/pin-dependencies
chore(deps): pin dependencies
2020-04-04 12:40:04 +02:00
Renovate Bot
430e9cf8b3 chore(deps): pin dependencies 2020-04-04 10:38:54 +00:00
Kamil Myśliwiec
f77d1df06b feat(): update to the latest version of graphql 2020-04-04 12:35:28 +02:00
Kamil Mysliwiec
814b3b58e6 Merge pull request #4514 from nestjs/renovate/nestjs-graphql-7.x
fix(deps): update dependency @nestjs/graphql to v7.2.0
2020-04-04 11:54:51 +02:00
Kamil Mysliwiec
a998251239 Merge pull request #4513 from nestjs/renovate/fast-json-stringify-1.x
fix(deps): update dependency fast-json-stringify to v1.19.0
2020-04-04 11:54:04 +02:00
Renovate Bot
9f19643924 fix(deps): update dependency @nestjs/graphql to v7.2.0 2020-04-04 09:27:08 +00:00
Kamil Mysliwiec
6cba88126a Merge pull request #4503 from nestjs/renovate/nyc-15.x
chore(deps): update dependency nyc to v15.0.1
2020-04-04 11:19:22 +02:00
Renovate Bot
f400673401 fix(deps): update dependency fast-json-stringify to v1.19.0 2020-04-04 09:02:57 +00:00
Kamil Mysliwiec
fbcb1c44a4 Merge pull request #4504 from nestjs/renovate/handlebars-4.x
fix(deps): update dependency handlebars to v4.7.6
2020-04-04 10:55:04 +02:00
Kamil Mysliwiec
e21a71568a Merge pull request #4512 from nestjs/renovate/sequelize-5.x
fix(deps): update dependency sequelize to v5.21.6
2020-04-04 10:54:58 +02:00
Kamil Mysliwiec
4396820aab Merge pull request #4507 from nestjs/renovate/jest-25.x
chore(deps): update dependency @types/jest to v25.2.1
2020-04-04 10:48:39 +02:00
Kamil Mysliwiec
5a507d4293 Merge pull request #4510 from nestjs/renovate/hbs-4.x
fix(deps): update dependency hbs to v4.1.1
2020-04-04 10:48:28 +02:00
Renovate Bot
82c9ce272c fix(deps): update dependency sequelize to v5.21.6 2020-04-04 08:45:07 +00:00
Renovate Bot
3b0e266084 fix(deps): update dependency hbs to v4.1.1 2020-04-04 03:50:43 +00:00
Renovate Bot
65f6c5fe51 chore(deps): update dependency @types/jest to v25.2.1 2020-04-03 21:26:40 +00:00
Emily
d68bb4a9db fix(common): change cache ttl decorator to set 0 value ttl
When used, @CacheTTL(0) will set no TTL on endpoint

Closes #4447
2020-04-03 22:05:58 +02:00
Renovate Bot
ada8808742 fix(deps): update dependency handlebars to v4.7.6 2020-04-03 18:09:49 +00:00
Renovate Bot
269b01d449 chore(deps): update dependency nyc to v15.0.1 2020-04-03 16:51:19 +00:00
Kamil Mysliwiec
e06915f148 Merge pull request #4502 from nestjs/renovate/ts-jest-25.x
chore(deps): update dependency ts-jest to v25.3.1
2020-04-03 18:08:50 +02:00
Renovate Bot
c0ecc34881 chore(deps): update dependency ts-jest to v25.3.1 2020-04-03 15:31:57 +00:00
Kamil Mysliwiec
94f52fc741 Merge pull request #4500 from nestjs/renovate/jest-monorepo
chore(deps): update dependency jest to v25.2.7
2020-04-03 10:37:45 +02:00
Renovate Bot
c6039a326f chore(deps): update dependency jest to v25.2.7 2020-04-03 08:24:41 +00:00
Kamil Mysliwiec
7f58fc6d85 Merge pull request #4498 from nestjs/renovate/rxjs-compat-6.x
chore(deps): update dependency rxjs-compat to v6.5.5
2020-04-03 09:09:12 +02:00
Kamil Mysliwiec
19d459aded Merge pull request #4494 from nestjs/renovate/handlebars-4.x
fix(deps): update dependency handlebars to v4.7.5
2020-04-03 09:08:35 +02:00
Kamil Mysliwiec
f153d5f6bb Merge pull request #4499 from nestjs/renovate/rxjs-6.x
fix(deps): update dependency rxjs to v6.5.5
2020-04-03 09:06:50 +02:00
Renovate Bot
89321242cc fix(deps): update dependency rxjs to v6.5.5 2020-04-03 01:51:25 +00:00
Renovate Bot
46318a7514 chore(deps): update dependency rxjs-compat to v6.5.5 2020-04-03 01:42:09 +00:00
Renovate Bot
6757530709 fix(deps): update dependency handlebars to v4.7.5 2020-04-02 19:16:05 +00:00
Kamil Mysliwiec
640bf671ff Merge pull request #4492 from nestjs/renovate/merge-graphql-schemas-1.x
chore(deps): update dependency merge-graphql-schemas to v1.7.7
2020-04-02 20:15:13 +02:00
Kamil Mysliwiec
4945764719 Merge pull request #4493 from nestjs/renovate/jest-25.x
chore(deps): update dependency @types/jest to v25.1.5
2020-04-02 20:15:01 +02:00
Renovate Bot
fed0f75565 chore(deps): update dependency @types/jest to v25.1.5 2020-04-02 17:08:57 +00:00
Renovate Bot
5fcbd1a59b chore(deps): update dependency merge-graphql-schemas to v1.7.7 2020-04-02 15:53:04 +00:00
Kamil Mysliwiec
150a763c05 Merge pull request #4488 from nestjs/renovate/jest-monorepo
chore(deps): update dependency jest to v25.2.6
2020-04-02 13:29:14 +02:00
Renovate Bot
4870a55adb chore(deps): update dependency jest to v25.2.6 2020-04-02 10:59:28 +00:00
Kamil Mysliwiec
e35016ce7c Merge pull request #4482 from nestjs/renovate/handlebars-4.x
fix(deps): update dependency handlebars to v4.7.4
2020-04-02 09:14:28 +02:00
Kamil Mysliwiec
52da4bb224 Merge pull request #4483 from nestjs/renovate/grpc-proto-loader-0.x
fix(deps): update dependency @grpc/proto-loader to v0.5.4
2020-04-02 09:06:00 +02:00
Renovate Bot
173dffe37c fix(deps): update dependency @grpc/proto-loader to v0.5.4 2020-04-01 18:50:08 +00:00
Renovate Bot
55c737e305 fix(deps): update dependency handlebars to v4.7.4 2020-04-01 17:26:11 +00:00
Kamil Mysliwiec
76ff1016da Merge pull request #4474 from nestjs/renovate/express-4.x
chore(deps): update dependency @types/express to v4.17.4
2020-04-01 08:40:20 +02:00
Kamil Mysliwiec
7c7125ac7f Merge pull request #4475 from nestjs/renovate/sinon-9.x
chore(deps): update dependency @types/sinon to v9
2020-04-01 08:40:12 +02:00
Kamil Mysliwiec
58eb602c09 Merge pull request #4473 from nestjs/renovate/uuid-7.x
fix(deps): update dependency uuid to v7.0.3
2020-04-01 08:39:58 +02:00
Renovate Bot
e936dd0da0 chore(deps): update dependency @types/sinon to v9 2020-03-31 23:45:14 +00:00
Renovate Bot
3f456f09b1 chore(deps): update dependency @types/express to v4.17.4 2020-03-31 23:32:55 +00:00
Renovate Bot
09f87ac0d4 fix(deps): update dependency uuid to v7.0.3 2020-03-31 19:48:01 +00:00
Kamil Mysliwiec
37aca3d3c6 Merge pull request #4470 from nestjs/renovate/nest-monorepo
chore(deps): update dependency @nestjs/cli to v7.1.2
2020-03-31 17:43:43 +02:00
Kamil Mysliwiec
7d5ff96957 Merge pull request #4472 from nestjs/renovate/lint-staged-10.x
chore(deps): update dependency lint-staged to v10.1.1
2020-03-31 17:43:28 +02:00
Kamil Mysliwiec
4f91f18f3c Merge pull request #4471 from nestjs/renovate/nestjs-graphql-7.x
fix(deps): update dependency @nestjs/graphql to v7.1.5
2020-03-31 17:42:39 +02:00
Renovate Bot
3fe047ca55 chore(deps): update dependency lint-staged to v10.1.1 2020-03-31 14:16:33 +00:00
Renovate Bot
6cf3f468c3 fix(deps): update dependency @nestjs/graphql to v7.1.5 2020-03-31 13:29:52 +00:00
Renovate Bot
8dff04260c chore(deps): update dependency @nestjs/cli to v7.1.2 2020-03-31 13:25:09 +00:00
Kamil Myśliwiec
661370e3e8 sample(): update grpc sample (missing interface) 2020-03-31 09:48:41 +02:00
Kamil Mysliwiec
e57f4a6b28 Merge pull request #4463 from nestjs/renovate/typescript-eslint-monorepo
chore(deps): update typescript-eslint monorepo to v2.26.0
2020-03-31 09:23:47 +02:00
Kamil Mysliwiec
1d852b2ebf Merge pull request #4460 from nestjs/renovate/lint-staged-10.x
chore(deps): update dependency lint-staged to v10.1.0
2020-03-31 09:23:40 +02:00
Kamil Mysliwiec
fc5d61b357 Merge pull request #4462 from nestjs/renovate/mongoose-5.x
fix(deps): update dependency mongoose to v5.9.7
2020-03-31 09:22:52 +02:00
Renovate Bot
e58a1efe3d chore(deps): update typescript-eslint monorepo to v2.26.0 2020-03-30 17:21:55 +00:00
Renovate Bot
616cb19832 fix(deps): update dependency mongoose to v5.9.7 2020-03-30 16:23:22 +00:00
Renovate Bot
3510629672 chore(deps): update dependency lint-staged to v10.1.0 2020-03-30 13:44:55 +00:00
Kamil Mysliwiec
0a84b2e59b Merge pull request #4449 from nestjs/renovate/nest-monorepo
fix(deps): update nest monorepo to v7.0.7
2020-03-30 09:36:33 +02:00
Renovate Bot
def30207ae fix(deps): update nest monorepo to v7.0.7 2020-03-30 06:57:58 +00:00
Kamil Mysliwiec
c377a19f15 Merge pull request #4455 from nestjs/renovate/ts-jest-25.x
chore(deps): update dependency ts-jest to v25.3.0
2020-03-30 08:39:56 +02:00
Kamil Mysliwiec
4eb449dd3d Merge pull request #4450 from nestjs/renovate/nestjs-graphql-7.x
fix(deps): update dependency @nestjs/graphql to v7.1.4
2020-03-30 08:34:16 +02:00
Kamil Mysliwiec
41b7f58bb3 Merge pull request #4451 from nestjs/renovate/jest-monorepo
chore(deps): update dependency jest to v25.2.4
2020-03-30 08:34:06 +02:00
Kamil Mysliwiec
0d13d2ef32 Merge pull request #4452 from nestjs/renovate/point-of-view-3.x
fix(deps): update dependency point-of-view to v3.8.0
2020-03-30 08:33:59 +02:00
Renovate Bot
f3d2b0c2f5 chore(deps): update dependency ts-jest to v25.3.0 2020-03-30 06:32:47 +00:00
Renovate Bot
3bc1c93bee fix(deps): update dependency point-of-view to v3.8.0 2020-03-29 20:13:34 +00:00
Renovate Bot
c62d9817c7 chore(deps): update dependency jest to v25.2.4 2020-03-29 19:59:30 +00:00
Renovate Bot
c19acf05ec fix(deps): update dependency @nestjs/graphql to v7.1.4 2020-03-29 18:14:29 +00:00
Kamil Myśliwiec
72ed4b595e chore(@nestjs) publish v7.0.7 release 2020-03-29 19:39:23 +02:00
Kamil Mysliwiec
f74375baa8 Merge pull request #4445 from danielscw/fix/multi-package-client-new
fix(microservices): multi package client getService error
2020-03-29 19:35:48 +02:00
Kamil Mysliwiec
7ac6624a3c Merge pull request #4446 from nestjs/renovate/lint-staged-10.x
chore(deps): update dependency lint-staged to v10.0.10
2020-03-29 18:41:52 +02:00
Renovate Bot
26b266048e chore(deps): update dependency lint-staged to v10.0.10 2020-03-29 13:26:01 +00:00
Kamil Mysliwiec
e5a4bb66f4 Merge pull request #4438 from nestjs/renovate/mongoose-5.x
chore(deps): update dependency @types/mongoose to v5.7.8
2020-03-29 14:12:58 +02:00
Kamil Mysliwiec
793b991621 Merge pull request #4441 from virkt25/patch-1
chore(common): add missing iterare dependency
2020-03-29 13:50:09 +02:00
Kamil Mysliwiec
1fc4833c06 Merge pull request #4434 from nestjs/renovate/nestjs-graphql-7.x
fix(deps): update dependency @nestjs/graphql to v7.1.3
2020-03-29 13:43:50 +02:00
Kamil Mysliwiec
f92ccae9d4 Merge pull request #4437 from nestjs/renovate/redis-2.x
chore(deps): update dependency @types/redis to v2.8.17
2020-03-29 13:43:43 +02:00
Renovate Bot
73094c3b43 chore(deps): update dependency @types/mongoose to v5.7.8 2020-03-29 11:41:07 +00:00
Kamil Mysliwiec
51b18db412 Merge pull request #4440 from nestjs/renovate/fastify-cors-3.x
fix(deps): update dependency fastify-cors to v3.0.3
2020-03-29 13:37:58 +02:00
Kamil Mysliwiec
f53cc505f1 Merge pull request #4442 from nestjs/renovate/ts-morph-7.x
chore(deps): update dependency ts-morph to v7.0.1
2020-03-29 13:37:22 +02:00
Renovate Bot
5ed98e220c chore(deps): update dependency ts-morph to v7.0.1 2020-03-29 11:17:50 +00:00
Kamil Mysliwiec
142a2e9113 Merge pull request #4443 from nestjs/renovate/eslint-plugin-import-2.x
chore(deps): update dependency eslint-plugin-import to v2.20.2
2020-03-29 13:14:30 +02:00
danielscw
a5bcb21388 test(microservice): update integration test for multi-package grpc 2020-03-29 15:46:11 +08:00
danielscw
0b38029830 fix(microservices): fix get service from multi package grpc client error
Calling getService of grpc clients with multiple packages shows error
'Channel third argument (options) must be an object with string keys
and integer or string values'. Which is caused by passing options with
GrpcOptions['options'] format to grpc client's constructor.
As the options are transformed and kept in 'maxMessageLengthOptions' and
'keepaliveOptions', we can remove and skip passing ClientGrpcProxy's
options to node grpc Client's constructor.
2020-03-29 15:43:32 +08:00
Renovate Bot
0a94d65490 chore(deps): update dependency eslint-plugin-import to v2.20.2 2020-03-29 04:43:58 +00:00
Taranveer Virk
691383c0a2 chore(common): add missing iterare dependency 2020-03-28 20:37:59 -04:00
Renovate Bot
8e6b6fa969 fix(deps): update dependency fastify-cors to v3.0.3 2020-03-28 14:55:02 +00:00
Kamil Mysliwiec
6135b623a0 Merge pull request #4439 from nestjs/renovate/nest-monorepo
chore(deps): update dependency @nestjs/cli to v7.1.1
2020-03-27 20:30:26 +01:00
Renovate Bot
e743162482 chore(deps): update dependency @nestjs/cli to v7.1.1 2020-03-27 18:01:58 +00:00
Renovate Bot
522ae200b5 chore(deps): update dependency @types/redis to v2.8.17 2020-03-27 16:00:19 +00:00
Renovate Bot
296e1aecf7 fix(deps): update dependency @nestjs/graphql to v7.1.3 2020-03-27 11:02:44 +00:00
Kamil Mysliwiec
7076aa46ee Merge pull request #4430 from nestjs/renovate/nest-monorepo
chore(deps): update nest monorepo
2020-03-27 09:12:41 +01:00
Renovate Bot
38a0610d38 chore(deps): update nest monorepo 2020-03-27 08:07:19 +00:00
Kamil Mysliwiec
e060888d37 Merge pull request #4431 from nestjs/renovate/jest-monorepo
chore(deps): update dependency jest to v25.2.3
2020-03-27 08:29:18 +01:00
Renovate Bot
6562f9faab chore(deps): update dependency jest to v25.2.3 2020-03-26 21:05:56 +00:00
Kamil Myśliwiec
abb4471d64 chore(): publish 7.0.5 version 2020-03-26 18:14:09 +01:00
Kamil Myśliwiec
134ef15093 chore(@nestjs) publish v7.0.6 release 2020-03-26 17:56:43 +01:00
Kamil Myśliwiec
4ebe4504b9 Merge branch 'master' of https://github.com/nestjs/nest 2020-03-26 17:53:02 +01:00
Kamil Myśliwiec
95b904efee Merge branch 'seclace-feat/nested_validation' 2020-03-26 17:52:57 +01:00
Kamil Myśliwiec
b039ac9f6d test(common): add test for flattening children errors (validation) 2020-03-26 17:52:39 +01:00
Kamil Mysliwiec
605e5baf58 Merge pull request #4429 from nestjs/renovate/jest-monorepo
chore(deps): update dependency jest to v25.2.2
2020-03-26 17:30:09 +01:00
Renovate Bot
263b38e302 chore(deps): update dependency jest to v25.2.2 2020-03-26 16:15:52 +00:00
Kamil Mysliwiec
9cba17d040 Merge pull request #4334 from cojack/feat/iterate-over-everything
Feat/iterate over everything
2020-03-26 17:01:47 +01:00
Kamil Mysliwiec
16b593765b Merge branch 'master' into feat/iterate-over-everything 2020-03-26 16:05:43 +01:00
Kamil Mysliwiec
15f3ee9ad6 Merge pull request #4427 from nestjs/renovate/nestjs-graphql-7.x
fix(deps): update dependency @nestjs/graphql to v7.1.1
2020-03-26 15:51:28 +01:00
Kamil Myśliwiec
e4a8cfbfa9 Merge branch 'Dominic-Preap-master' 2020-03-26 15:50:40 +01:00
Kamil Mysliwiec
749ab49153 Merge pull request #4404 from Dominic-Preap/master
feat(common): add exception code option in validation pipe
2020-03-26 14:22:36 +01:00
Renovate Bot
8fad078b5c fix(deps): update dependency @nestjs/graphql to v7.1.1 2020-03-26 13:18:14 +00:00
Kamil Mysliwiec
9d87d17ae3 Merge pull request #4230 from dot-i/add-grpc-max-metadata-option
feat(microservices): implement server grpc max metadata size option
2020-03-26 14:11:09 +01:00
Kamil Mysliwiec
b417928177 Merge pull request #4424 from nestjs/renovate/jest-monorepo
chore(deps): update dependency jest to v25.2.1
2020-03-26 14:10:12 +01:00
Kamil Mysliwiec
75799a31dc Merge pull request #4425 from nestjs/renovate/nestjs-graphql-7.x
fix(deps): update dependency @nestjs/graphql to v7.1.0
2020-03-26 14:10:06 +01:00
Kamil Mysliwiec
fb194199ad Merge pull request #4426 from nestjs/renovate/nestjs-swagger-4.x
fix(deps): update dependency @nestjs/swagger to v4.5.1
2020-03-26 14:10:01 +01:00
Renovate Bot
e9dcd8fc84 fix(deps): update dependency @nestjs/swagger to v4.5.1 2020-03-26 12:21:11 +00:00
Renovate Bot
93313f505a fix(deps): update dependency @nestjs/graphql to v7.1.0 2020-03-26 09:59:26 +00:00
Renovate Bot
05b3dee522 chore(deps): update dependency jest to v25.2.1 2020-03-26 09:48:15 +00:00
Nico Francois
4b3d476571 feat(microservices): implement server grpc max metadata size option 2020-03-24 16:35:32 +01:00
cojack
0168673d45 refactor(microservices): Revert contact scoped filters to external step 2020-03-23 15:40:39 +01:00
cojack
333677f009 refactor(core): Revert contact scoped filters to external step 2020-03-23 15:40:15 +01:00
Vadim Goldenko
70b7813915 feat(common): prepend nested validation errors with parent prop 2020-03-20 16:41:55 +03:00
Vadim Goldenko
41381dcd42 feat(common): add nested validation errors parse 2020-03-20 15:58:36 +03:00
cojack
d6bc71ddd4 chore(core): Refactor filterMiddleware to use iterare 2020-03-18 12:22:25 +01:00
cojack
47fd693e15 chore(core): refactor middleware builder to use iterare 2020-03-18 12:21:07 +01:00
cojack
6f1675f594 fix(websockets): Switch order to concat globalFilter at the end 2020-03-18 11:55:19 +01:00
cojack
8d809c56ea chore(websockets): change default import of iterate from iterare 2020-03-17 12:23:56 +01:00
cojack
e0dc092745 chore(core): change default import of iterate from iterare to explicit 2020-03-17 12:21:20 +01:00
cojack
cf44f1ab2c feat(websockets): use iterate to reduce number of loops 2020-03-17 10:57:07 +01:00
cojack
08559a1bbc feat(common): use iterate to reduce number of loops 2020-03-17 10:56:51 +01:00
cojack
182792ef24 feat(microservices): use iterate to reduce number of loops 2020-03-17 10:53:57 +01:00
cojack
4b7dcd6b2c feat(core): use iterate to reduce number of loops 2020-03-17 10:43:58 +01:00
237 changed files with 72849 additions and 64502 deletions

View File

@@ -19,6 +19,8 @@ module.exports = {
'@typescript-eslint/interface-name-prefix': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/ban-types': 'off',
},
};

View File

@@ -1,6 +1,6 @@
(The MIT License)
Copyright (c) 2017-2019 Kamil Myśliwiec <http://kamilmysliwiec.com>
Copyright (c) 2017-2020 Kamil Mysliwiec <https://kamilmysliwiec.com>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the

View File

@@ -38,6 +38,14 @@ Nest is a framework for building efficient, scalable <a href="http://nodejs.org"
* 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:
## Questions
For questions and support please use the official [Discord channel](https://discord.gg/G7Qnnhy). The issue list of this repo is **exclusively** for bug reports and feature requests.
## Issues
Please make sure to read the [Issue Reporting Checklist](https://github.com/nestjs/nest/blob/master/CONTRIBUTING.md#-submitting-an-issue) before opening an issue. Issues not conforming to the guidelines may be closed immediately.
## Consulting
With official support, you can get expert help straight from Nest core team. We provide dedicated technical support, migration strategies, advice on best practices (and design decisions), PR reviews, and team augmentation. Read more about [support here](https://enterprise.nestjs.com).
@@ -48,30 +56,35 @@ Nest is an MIT-licensed open source project. It can grow thanks to the sponsors
#### Principal Sponsor
<a href="https://valor-software.com/" target="_blank"><img src="https://docs.nestjs.com/assets/sponsors/valor-software.png" width="320" /></a>
<a href="https://valor-software.com/" target="_blank"><img src="https://docs.nestjs.com/assets/sponsors/valor-software.png" width="220" /></a>
#### Silver Sponsors
<a href="https://neoteric.eu/" target="_blank"><img src="https://nestjs.com/img/neoteric-cut.png" width="120" valign="middle" /></a> &nbsp;
<a href="http://gojob.com" target="_blank"><img src="http://nestjs.com/img/gojob-logo.png" valign="middle" height="95" /></a> &nbsp;
<a href="https://trilon.io" target="_blank"><img src="https://nestjs.com/img/trilon.svg" width="150" valign="middle" /></a> &nbsp;
<a href="http://www.leogistics.com" target="_blank"><img src="https://nestjs.com/img/leogistics-logo.jpeg" width="150" valign="middle" /></a>
<table style="text-align:center;"><tr><td>
<a href="https://neoteric.eu/" target="_blank"><img src="https://nestjs.com/img/neoteric-cut.png" width="120" valign="middle" /></a> </td><td>
<a href="http://gojob.com" target="_blank"><img src="http://nestjs.com/img/gojob-logo.png" valign="middle" width="100" /></a> </td><td>
<a href="https://trilon.io" target="_blank"><img src="https://nestjs.com/img/trilon.svg" width="170" valign="middle" /></a> </td><td>
<a href="http://www.leogistics.com" target="_blank"><img src="https://nestjs.com/img/leogistics-logo.jpeg" width="150" valign="middle" /></td></tr></table>
#### Sponsors
<a href="https://www.swingdev.io" target="_blank"><img src="https://nestjs.com/img/swingdev-logo.svg#1" width="110" valign="middle" /> </a> &nbsp; <a href="https://blueanchor.io/" target="_blank"><img src="https://nestjs.com/img/blueanchor.png" width="150" valign="middle" /></a> &nbsp;
<a href="https://www.novologic.com/" target="_blank"><img src="https://nestjs.com/img/novologic.png" width="110" valign="middle" /></a> &nbsp; <a href="https://hostpresto.com" target="_blank"><img src="https://nestjs.com/img/hostpresto.png" height="24" valign="middle" /></a>
<a href="https://ever.co/" target="_blank"><img src="https://nestjs.com/img/ever-logo.png" height="14" valign="middle" /></a> &nbsp;
<a href="https://buddy.works/" target="_blank"><img src="https://nestjs.com/img/buddy-logo.svg" height="25" valign="middle" /></a> &nbsp;
<a href="https://blokt.com" target="_blank"><img src="https://nestjs.com/img/blokt-logo.png" height="25" valign="middle" /></a> &nbsp; <a href="https://genuinebee.com/" target="_blank"><img src="https://nestjs.com/img/genuinebee.svg" height="27" valign="middle" /></a> &nbsp; <a href="http://architectnow.net/" target="_blank"><img src="https://nestjs.com/img/architectnow.png" height="20" valign="middle" /></a> &nbsp; <a href="https://quander.io/" target="_blank"><img src="https://nestjs.com/img/quander.png" height="22" valign="middle" /></a> &nbsp; <a href="https://mantro.net/" target="_blank"><img src="https://nestjs.com/img/mantro-logo.svg" height="19" valign="middle" /></a> &nbsp; <a href="https://triplebyte.com/" target="_blank"><img src="https://nestjs.com/img/triplebyte.png" height="20" valign="middle" /></a> &nbsp;
<a href="https://reposit.co.uk/" target="_blank"><img src="https://nestjs.com/img/reposit-logo.png" height="18" valign="middle" /></a> &nbsp; &nbsp;
<a href="https://nearpod.com/" target="_blank"><img src="https://nestjs.com/img/nearpod-logo.svg" width="100" valign="middle" /></a> &nbsp;
<a href="https://clay.global/" target="_blank"><img src="https://nestjs.com/img/clay-logo.svg" width="75" valign="middle" /></a> &nbsp;
<a href="https://firesticktricks.com" target="_blank"><img src="https://nestjs.com/img/firesticktricks-logo.png" width="120" valign="middle" /></a> &nbsp;
<a href="https://www.codeguesser.co.uk" target="_blank"><img src="https://nestjs.com/img/codeguesser-logo.svg" width="120" valign="middle" /></a> &nbsp;
<a href="https://tekhattan.com" target="_blank"><img src="https://nestjs.com/img/tekhattan-logo.png" width="110" valign="middle" /></a> &nbsp;
<a href="https://f-a.nz/" target="_blank"><img src="https://nestjs.com/img/franz.svg" width="80" valign="middle" /></a> &nbsp;
<a href="https://sparkfabrik.com/" target="_blank"><img src="https://nestjs.com/img/sparkfabrik-logo.png" width="120" valign="middle" /></a>
<table><tr><td align="center" valign="middle">
<a href="https://www.swingdev.io" target="_blank"><img src="https://nestjs.com/img/swingdev-logo.svg#1" width="110" valign="middle" /> </a></td><td align="center" valign="middle">
<a href="https://www.novologic.com/" target="_blank"><img src="https://nestjs.com/img/novologic.png" width="110" valign="middle" /></a> </td><td align="center" valign="middle">
<a href="https://ever.co/" target="_blank"><img src="https://nestjs.com/img/ever-logo.png" width="72" valign="middle" /></a> </td><td align="center" valign="middle">
<a href="https://blokt.com" target="_blank"><img src="https://nestjs.com/img/blokt-logo.png" width="120" valign="middle" /></a> </td><td align="center" valign="middle">
<a href="http://architectnow.net/" target="_blank"><img src="https://nestjs.com/img/architectnow.png" width="125" valign="middle" /></a> </td><td align="center" valign="middle">
<a href="https://quander.io/" target="_blank"><img src="https://nestjs.com/img/quander.png" width="100" valign="middle" /></a> </td></tr><tr><td align="center" valign="middle">
<a href="https://mantro.net/" target="_blank"><img src="https://nestjs.com/img/mantro-logo.svg" width="95" valign="middle" /></a> </td><td align="center" valign="middle">
<a href="https://triplebyte.com/" target="_blank"><img src="https://nestjs.com/img/triplebyte.png" width="107" valign="middle" /></a> </td><td align="center" valign="middle">
<a href="https://reposit.co.uk/" target="_blank"><img src="https://nestjs.com/img/reposit-logo.png" width="71" valign="middle" /></a></td><td align="center" valign="middle">
<a href="https://nearpod.com/" target="_blank"><img src="https://nestjs.com/img/nearpod-logo.svg" width="100" valign="middle" /></a> </td><td align="center" valign="middle">
<a href="https://clay.global/" target="_blank"><img src="https://nestjs.com/img/clay-logo.svg" width="75" valign="middle" /></a> </td><td align="center" valign="middle">
<a href="https://firesticktricks.com" target="_blank"><img src="https://nestjs.com/img/firesticktricks-logo.png" width="120" valign="middle" /></a></td></tr><tr><td align="center" valign="middle">
<a href="https://www.codeguesser.co.uk" target="_blank"><img src="https://nestjs.com/img/codeguesser-logo.svg" width="120" valign="middle" /></a> </td><td align="center" valign="middle">
<a href="https://tekhattan.com" target="_blank"><img src="https://nestjs.com/img/tekhattan-logo.png" width="110" valign="middle" /></a> </td><td align="center" valign="middle">
<a href="https://f-a.nz/" target="_blank"><img src="https://nestjs.com/img/franz.svg" width="80" valign="middle" /></a> </td><td align="center" valign="middle">
<a href="https://sparkfabrik.com/" target="_blank"><img src="https://nestjs.com/img/sparkfabrik-logo.png" width="120" valign="middle" /></a></td><td align="center" valign="middle"><a href="https://www.thebigphonestore.co.uk/" target="_blank"><img src="https://nestjs.com/img/the-big-phone-store-logo.png" width="65" valign="middle" /></a></td></tr></table>
## Backers

View File

@@ -23,7 +23,7 @@ services:
- "9001:9001"
restart: always
mysql:
image: mysql:5.7.29
image: mysql:5.7.30
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: test

View File

@@ -2,9 +2,22 @@
# THIS FILE WAS AUTOMATICALLY GENERATED (DO NOT MODIFY)
# ------------------------------------------------------
type Recipe {
id: ID!
title: String!
description: String
creationDate: Date!
ingredients: [String!]!
}
"""Date custom scalar type"""
scalar Date
type Query {
recipe(id: String!): Recipe!
recipes(skip: Int = 0, take: Int = 25): [Recipe!]!
}
type Mutation {
addRecipe(newRecipeData: NewRecipeInput!): Recipe!
removeRecipe(id: String!): Boolean!
@@ -16,19 +29,6 @@ input NewRecipeInput {
ingredients: [String!]!
}
type Query {
recipe(id: String!): Recipe!
recipes(skip: Int = 0, take: Int = 25): [Recipe!]!
}
type Recipe {
id: ID!
title: String!
description: String
creationDate: Date!
ingredients: [String!]!
}
type Subscription {
recipeAdded: Recipe!
}

View File

@@ -19,7 +19,6 @@ class TestController {
}
@Get('tests/wildcard_nested')
// eslint-disable-next-line @typescript-eslint/camelcase
wildcard_nested() {
return RETURN_VALUE;
}

View File

@@ -21,7 +21,6 @@ class TestController {
}
@Get('tests/wildcard_nested')
// eslint-disable-next-line @typescript-eslint/camelcase
wildcard_nested() {
return RETURN_VALUE;
}

View File

@@ -3,9 +3,15 @@ import { InvalidClassScopeException } from '@nestjs/core/errors/exceptions/inval
import { Test, TestingModule } from '@nestjs/testing';
import { expect } from 'chai';
import { ScopedController } from '../src/scoped/scoped.controller';
import { ScopedModule } from '../src/scoped/scoped.module';
import {
REQUEST_SCOPED_FACTORY,
ScopedModule,
STATIC_FACTORY,
TRANSIENT_SCOPED_FACTORY,
} from '../src/scoped/scoped.module';
import { ScopedService } from '../src/scoped/scoped.service';
import { TransientService } from '../src/scoped/transient.service';
import { Transient3Service } from '../src/scoped/transient3.service';
describe('Scoped Instances', () => {
let testingModule: TestingModule;
@@ -20,20 +26,41 @@ describe('Scoped Instances', () => {
const contextId = createContextId();
const transient1 = await testingModule.resolve(TransientService, contextId);
const transient2 = await testingModule.resolve(TransientService, contextId);
const transientFactory = await testingModule.resolve(
TRANSIENT_SCOPED_FACTORY,
);
expect(transient1).to.be.instanceOf(TransientService);
expect(transient2).to.be.instanceOf(TransientService);
expect(transient1).to.be.equal(transient2);
expect(transientFactory).to.be.true;
});
it('should dynamically resolve nested transient provider', async () => {
const contextId = createContextId();
const transientTwoDepthLevel = await testingModule.resolve(
TransientService,
contextId,
);
const transientThreeDepthLevel = await testingModule.resolve(
Transient3Service,
contextId,
);
expect(transientTwoDepthLevel.svc.logger).to.not.be.undefined;
expect(transientThreeDepthLevel.svc.svc.logger).to.not.be.undefined;
});
it('should dynamically resolve request-scoped provider', async () => {
const request1 = await testingModule.resolve(ScopedService);
const request2 = await testingModule.resolve(ScopedService);
const request3 = await testingModule.resolve(ScopedService, { id: 1 });
const requestFactory = await testingModule.resolve(REQUEST_SCOPED_FACTORY);
expect(request1).to.be.instanceOf(ScopedService);
expect(request2).to.be.instanceOf(ScopedService);
expect(request3).to.not.be.equal(request2);
expect(requestFactory).to.be.true;
});
it('should dynamically resolve request-scoped controller', async () => {
@@ -46,11 +73,19 @@ describe('Scoped Instances', () => {
expect(request3).to.not.be.equal(request2);
});
it('should throw an exception when "get()" method is used', async () => {
it('should throw an exception when "get()" method is used for scoped providers', () => {
try {
testingModule.get(ScopedController);
} catch (err) {
expect(err).to.be.instanceOf(InvalidClassScopeException);
}
});
it('should throw an exception when "resolve()" method is used for static providers', async () => {
try {
await testingModule.resolve(STATIC_FACTORY);
} catch (err) {
expect(err).to.be.instanceOf(InvalidClassScopeException);
}
});
});

View File

@@ -1,11 +1,35 @@
import { Module } from '@nestjs/common';
import { Module, Scope } from '@nestjs/common';
import { ScopedController } from './scoped.controller';
import { ScopedService } from './scoped.service';
import { TransientService } from './transient.service';
import { Transient2Service } from './transient2.service';
import { Transient3Service } from './transient3.service';
export const STATIC_FACTORY = 'STATIC_FACTORY';
export const REQUEST_SCOPED_FACTORY = 'REQUEST_SCOPED_FACTORY';
export const TRANSIENT_SCOPED_FACTORY = 'TRANSIENT_SCOPED_FACTORY';
@Module({
controllers: [ScopedController],
providers: [ScopedService, TransientService, Transient2Service],
providers: [
ScopedService,
TransientService,
Transient2Service,
Transient3Service,
{
provide: STATIC_FACTORY,
useFactory: () => true,
},
{
provide: REQUEST_SCOPED_FACTORY,
useFactory: () => true,
scope: Scope.REQUEST,
},
{
provide: TRANSIENT_SCOPED_FACTORY,
useFactory: () => true,
scope: Scope.TRANSIENT,
},
],
})
export class ScopedModule {}

View File

@@ -3,5 +3,5 @@ import { Transient2Service } from './transient2.service';
@Injectable({ scope: Scope.TRANSIENT })
export class TransientService {
constructor(private readonly svc: Transient2Service) {}
constructor(public readonly svc: Transient2Service) {}
}

View File

@@ -1,4 +1,6 @@
import { Injectable, Scope } from '@nestjs/common';
import { Injectable, Logger, Scope } from '@nestjs/common';
@Injectable({ scope: Scope.TRANSIENT })
export class Transient2Service {}
export class Transient2Service {
logger = new Logger();
}

View File

@@ -0,0 +1,7 @@
import { Injectable, Scope } from '@nestjs/common';
import { TransientService } from './transient.service';
@Injectable({ scope: Scope.TRANSIENT })
export class Transient3Service {
constructor(public readonly svc: TransientService) {}
}

View File

@@ -25,8 +25,11 @@ describe('GRPC transport', () => {
app.connectMicroservice({
transport: Transport.GRPC,
options: {
package: 'math',
protoPath: join(__dirname, '../src/grpc/math.proto'),
package: ['math', 'math2'],
protoPath: [
join(__dirname, '../src/grpc/math.proto'),
join(__dirname, '../src/grpc/math2.proto'),
],
},
});
// Start gRPC microservice
@@ -47,7 +50,19 @@ describe('GRPC transport', () => {
it(`GRPC Sending and Receiving HTTP POST`, () => {
return request(server)
.post('/')
.post('/sum')
.send([1, 2, 3, 4, 5])
.expect(200, { result: 15 });
});
it(`GRPC Sending and Receiving HTTP POST (multiple proto)`, async () => {
await request(server)
.post('/multi/sum')
.send([1, 2, 3, 4, 5])
.expect(200, { result: 15 });
await request(server)
.post('/multi/sum2')
.send([1, 2, 3, 4, 5])
.expect(200, { result: 15 });
});

View File

@@ -31,9 +31,9 @@ export class GrpcController {
],
},
})
client2: ClientGrpc;
clientMulti: ClientGrpc;
@Post()
@Post('sum')
@HttpCode(200)
call(@Body() data: number[]): Observable<number> {
const svc = this.client.getService<any>('Math');
@@ -77,10 +77,17 @@ export class GrpcController {
});
}
@Post()
@Post('multi/sum')
@HttpCode(200)
call2(@Body() data: number[]): Observable<number> {
const svc = this.client2.getService<any>('Math2');
callMultiSum(@Body() data: number[]): Observable<number> {
const svc = this.clientMulti.getService<any>('Math');
return svc.sum({ data });
}
@Post('multi/sum2')
@HttpCode(200)
callMultiSum2(@Body() data: number[]): Observable<number> {
const svc = this.clientMulti.getService<any>('Math2');
return svc.sum2({ data });
}
}

View File

@@ -3,5 +3,5 @@
"packages": [
"packages/*"
],
"version": "7.0.5"
"version": "7.2.0"
}

8374
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{
"name": "@nestjs/core",
"version": "7.0.3",
"version": "7.0.11",
"description": "Modern, fast, powerful node.js web framework",
"homepage": "https://nestjs.com",
"repository": {
@@ -27,7 +27,7 @@
"test": "nyc --require ts-node/register mocha packages/**/*.spec.ts --reporter spec --retries 3 --require 'node_modules/reflect-metadata/Reflect.js' --exit",
"test:integration": "mocha \"integration/*/{,!(node_modules)/**/}/*.spec.ts\" --reporter spec --require ts-node/register --require 'node_modules/reflect-metadata/Reflect.js' --exit",
"test:docker:up": "docker-compose -f integration/docker-compose.yml up -d",
"test:docker:down": "docker-compose -f integration/docker-compose.yml down -d",
"test:docker:down": "docker-compose -f integration/docker-compose.yml down",
"lint": "concurrently 'npm run lint:packages' 'npm run lint:integration' 'npm run lint:spec'",
"lint:integration": "eslint 'integration/*/{,!(node_modules)/**/}/*.ts' -c '.eslintrc.spec.js' --fix",
"lint:packages": "eslint 'packages/**/**.ts' --fix --ignore-pattern 'packages/**/*.spec.ts'",
@@ -54,115 +54,114 @@
"@nuxtjs/opencollective": "0.2.2",
"axios": "0.19.2",
"class-transformer": "0.2.3",
"class-validator": "0.11.1",
"class-validator": "0.12.2",
"cli-color": "2.0.0",
"cors": "2.8.5",
"express": "4.17.1",
"fast-json-stringify": "1.18.0",
"fast-json-stringify": "2.1.0",
"fast-safe-stringify": "2.0.7",
"iterare": "1.2.0",
"iterare": "1.2.1",
"object-hash": "2.0.3",
"path-to-regexp": "3.2.0",
"reflect-metadata": "0.1.13",
"rxjs": "6.5.4",
"rxjs": "6.5.5",
"socket.io": "2.3.0",
"uuid": "7.0.2",
"tslib": "1.11.1"
"uuid": "8.1.0",
"tslib": "2.0.0"
},
"devDependencies": {
"@codechecks/client": "0.1.10",
"@commitlint/cli": "8.3.5",
"@commitlint/config-angular": "8.3.4",
"@grpc/proto-loader": "0.5.3",
"@nestjs/graphql": "7.0.15",
"@nestjs/mongoose": "6.4.0",
"@nestjs/typeorm": "7.0.0",
"@grpc/proto-loader": "0.5.4",
"@nestjs/graphql": "7.4.1",
"@nestjs/mongoose": "7.0.1",
"@nestjs/typeorm": "7.1.0",
"@types/amqplib": "0.5.13",
"@types/bytes": "3.1.0",
"@types/cache-manager": "2.10.2",
"@types/chai": "4.2.10",
"@types/cache-manager": "2.10.3",
"@types/chai": "4.2.11",
"@types/chai-as-promised": "7.1.2",
"@types/cors": "2.8.6",
"@types/express": "4.17.3",
"@types/express": "4.17.6",
"@types/fastify-cors": "2.1.0",
"@types/gulp": "4.0.6",
"@types/kafka-node": "2.0.9",
"@types/mocha": "7.0.2",
"@types/mongoose": "5.7.7",
"@types/mongoose": "5.7.26",
"@types/node": "10.17.3",
"@types/redis": "2.8.16",
"@types/redis": "2.8.22",
"@types/reflect-metadata": "0.0.5",
"@types/sinon": "7.5.2",
"@types/socket.io": "2.1.4",
"@types/ws": "7.2.3",
"@typescript-eslint/eslint-plugin": "2.25.0",
"@typescript-eslint/parser": "2.25.0",
"@types/sinon": "9.0.4",
"@types/socket.io": "2.1.8",
"@types/ws": "7.2.5",
"@typescript-eslint/eslint-plugin": "3.3.0",
"@typescript-eslint/parser": "3.3.0",
"amqp-connection-manager": "3.2.0",
"amqplib": "0.5.5",
"apollo-server-express": "2.11.0",
"amqplib": "0.5.6",
"apollo-server-express": "2.15.0",
"artillery": "1.6.0",
"awesome-typescript-loader": "5.2.1",
"body-parser": "1.19.0",
"bytes": "3.1.0",
"cache-manager": "3.2.1",
"cache-manager": "3.3.0",
"chai": "4.2.0",
"chai-as-promised": "7.1.1",
"clang-format": "1.4.0",
"commitlint-circle": "1.0.0",
"concurrently": "5.1.0",
"conventional-changelog": "3.1.18",
"core-js": "3.6.4",
"coveralls": "3.0.11",
"concurrently": "5.2.0",
"conventional-changelog": "3.1.21",
"core-js": "3.6.5",
"coveralls": "3.1.0",
"delete-empty": "3.0.0",
"engine.io-client": "3.4.0",
"eslint": "6.8.0",
"eslint-config-prettier": "6.10.1",
"eslint-plugin-import": "2.20.1",
"engine.io-client": "3.4.3",
"eslint": "7.2.0",
"eslint-config-prettier": "6.11.0",
"eslint-plugin-import": "2.21.2",
"fancy-log": "1.3.3",
"fastify": "2.13.0",
"fastify-cors": "3.0.2",
"fastify-formbody": "3.1.0",
"fastify-multipart": "1.0.5",
"fastify-static": "2.6.0",
"graphql": "14.6.0",
"graphql-tools": "4.0.7",
"grpc": "1.24.2",
"fastify": "2.14.1",
"fastify-cors": "3.0.3",
"fastify-formbody": "3.2.0",
"fastify-multipart": "1.0.6",
"fastify-static": "2.7.0",
"graphql": "15.1.0",
"graphql-tools": "6.0.10",
"grpc": "1.24.3",
"gulp": "4.0.2",
"gulp-clang-format": "1.0.27",
"gulp-clean": "0.4.0",
"gulp-sourcemaps": "2.6.5",
"gulp-typescript": "5.0.1",
"gulp-watch": "5.0.1",
"husky": "4.2.3",
"imports-loader": "0.8.0",
"husky": "4.2.5",
"imports-loader": "1.0.0",
"json-loader": "0.5.7",
"kafkajs": "1.12.0",
"lerna": "2.11.0",
"lint-staged": "10.0.9",
"lint-staged": "10.2.11",
"markdown-table": "2.0.0",
"merge-graphql-schemas": "1.7.6",
"mocha": "7.1.1",
"mongoose": "5.9.6",
"mqtt": "3.0.0",
"merge-graphql-schemas": "1.7.8",
"mocha": "7.1.2",
"mongoose": "5.9.19",
"mqtt": "4.1.0",
"multer": "1.4.2",
"mysql": "2.18.1",
"nats": "1.4.8",
"nodemon": "2.0.2",
"nyc": "15.0.0",
"prettier": "2.0.2",
"nats": "1.4.9",
"nodemon": "2.0.4",
"nyc": "15.1.0",
"prettier": "2.0.5",
"redis": "3.0.2",
"rxjs-compat": "6.5.4",
"sinon": "9.0.1",
"rxjs-compat": "6.5.5",
"sinon": "9.0.2",
"sinon-chai": "3.5.0",
"socket.io-client": "2.3.0",
"subscriptions-transport-ws": "0.9.16",
"supertest": "4.0.2",
"ts-morph": "7.0.0",
"ts-node": "8.8.1",
"typeorm": "0.2.24",
"typescript": "3.7.2",
"ts-morph": "7.1.1",
"ts-node": "8.10.2",
"typeorm": "0.2.25",
"typescript": "3.9.5",
"wrk": "1.2.0",
"ws": "7.2.3"
"ws": "7.3.0"
},
"engines": {
"node": ">= 10.13.0"

View File

@@ -38,6 +38,14 @@ Nest is a framework for building efficient, scalable <a href="http://nodejs.org"
* 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:
## Questions
For questions and support please use the official [Discord channel](https://discord.gg/G7Qnnhy). The issue list of this repo is **exclusively** for bug reports and feature requests.
## Issues
Please make sure to read the [Issue Reporting Checklist](https://github.com/nestjs/nest/blob/master/CONTRIBUTING.md#-submitting-an-issue) before opening an issue. Issues not conforming to the guidelines may be closed immediately.
## Consulting
With official support, you can get expert help straight from Nest core team. We provide dedicated technical support, migration strategies, advice on best practices (and design decisions), PR reviews, and team augmentation. Read more about [support here](https://enterprise.nestjs.com).
@@ -48,30 +56,35 @@ Nest is an MIT-licensed open source project. It can grow thanks to the sponsors
#### Principal Sponsor
<a href="https://valor-software.com/" target="_blank"><img src="https://docs.nestjs.com/assets/sponsors/valor-software.png" width="320" /></a>
<a href="https://valor-software.com/" target="_blank"><img src="https://docs.nestjs.com/assets/sponsors/valor-software.png" width="220" /></a>
#### Silver Sponsors
<a href="https://neoteric.eu/" target="_blank"><img src="https://nestjs.com/img/neoteric-cut.png" width="120" valign="middle" /></a> &nbsp;
<a href="http://gojob.com" target="_blank"><img src="http://nestjs.com/img/gojob-logo.png" valign="middle" height="95" /></a> &nbsp;
<a href="https://trilon.io" target="_blank"><img src="https://nestjs.com/img/trilon.svg" width="150" valign="middle" /></a> &nbsp;
<a href="http://www.leogistics.com" target="_blank"><img src="https://nestjs.com/img/leogistics-logo.jpeg" width="150" valign="middle" /></a>
<table style="text-align:center;"><tr><td>
<a href="https://neoteric.eu/" target="_blank"><img src="https://nestjs.com/img/neoteric-cut.png" width="120" valign="middle" /></a> </td><td>
<a href="http://gojob.com" target="_blank"><img src="http://nestjs.com/img/gojob-logo.png" valign="middle" width="100" /></a> </td><td>
<a href="https://trilon.io" target="_blank"><img src="https://nestjs.com/img/trilon.svg" width="170" valign="middle" /></a> </td><td>
<a href="http://www.leogistics.com" target="_blank"><img src="https://nestjs.com/img/leogistics-logo.jpeg" width="150" valign="middle" /></td></tr></table>
#### Sponsors
<a href="https://www.swingdev.io" target="_blank"><img src="https://nestjs.com/img/swingdev-logo.svg#1" width="110" valign="middle" /> </a> &nbsp; <a href="https://blueanchor.io/" target="_blank"><img src="https://nestjs.com/img/blueanchor.png" width="150" valign="middle" /></a> &nbsp;
<a href="https://www.novologic.com/" target="_blank"><img src="https://nestjs.com/img/novologic.png" width="110" valign="middle" /></a> &nbsp; <a href="https://hostpresto.com" target="_blank"><img src="https://nestjs.com/img/hostpresto.png" height="24" valign="middle" /></a>
<a href="https://ever.co/" target="_blank"><img src="https://nestjs.com/img/ever-logo.png" height="14" valign="middle" /></a> &nbsp;
<a href="https://buddy.works/" target="_blank"><img src="https://nestjs.com/img/buddy-logo.svg" height="25" valign="middle" /></a> &nbsp;
<a href="https://blokt.com" target="_blank"><img src="https://nestjs.com/img/blokt-logo.png" height="25" valign="middle" /></a> &nbsp; <a href="https://genuinebee.com/" target="_blank"><img src="https://nestjs.com/img/genuinebee.svg" height="27" valign="middle" /></a> &nbsp; <a href="http://architectnow.net/" target="_blank"><img src="https://nestjs.com/img/architectnow.png" height="20" valign="middle" /></a> &nbsp; <a href="https://quander.io/" target="_blank"><img src="https://nestjs.com/img/quander.png" height="22" valign="middle" /></a> &nbsp; <a href="https://mantro.net/" target="_blank"><img src="https://nestjs.com/img/mantro-logo.svg" height="19" valign="middle" /></a> &nbsp; <a href="https://triplebyte.com/" target="_blank"><img src="https://nestjs.com/img/triplebyte.png" height="20" valign="middle" /></a> &nbsp;
<a href="https://reposit.co.uk/" target="_blank"><img src="https://nestjs.com/img/reposit-logo.png" height="18" valign="middle" /></a> &nbsp; &nbsp;
<a href="https://nearpod.com/" target="_blank"><img src="https://nestjs.com/img/nearpod-logo.svg" width="100" valign="middle" /></a> &nbsp;
<a href="https://clay.global/" target="_blank"><img src="https://nestjs.com/img/clay-logo.svg" width="75" valign="middle" /></a> &nbsp;
<a href="https://firesticktricks.com" target="_blank"><img src="https://nestjs.com/img/firesticktricks-logo.png" width="120" valign="middle" /></a> &nbsp;
<a href="https://www.codeguesser.co.uk" target="_blank"><img src="https://nestjs.com/img/codeguesser-logo.svg" width="120" valign="middle" /></a> &nbsp;
<a href="https://tekhattan.com" target="_blank"><img src="https://nestjs.com/img/tekhattan-logo.png" width="110" valign="middle" /></a> &nbsp;
<a href="https://f-a.nz/" target="_blank"><img src="https://nestjs.com/img/franz.svg" width="80" valign="middle" /></a> &nbsp;
<a href="https://sparkfabrik.com/" target="_blank"><img src="https://nestjs.com/img/sparkfabrik-logo.png" width="120" valign="middle" /></a>
<table><tr><td align="center" valign="middle">
<a href="https://www.swingdev.io" target="_blank"><img src="https://nestjs.com/img/swingdev-logo.svg#1" width="110" valign="middle" /> </a></td><td align="center" valign="middle">
<a href="https://www.novologic.com/" target="_blank"><img src="https://nestjs.com/img/novologic.png" width="110" valign="middle" /></a> </td><td align="center" valign="middle">
<a href="https://ever.co/" target="_blank"><img src="https://nestjs.com/img/ever-logo.png" width="72" valign="middle" /></a> </td><td align="center" valign="middle">
<a href="https://blokt.com" target="_blank"><img src="https://nestjs.com/img/blokt-logo.png" width="120" valign="middle" /></a> </td><td align="center" valign="middle">
<a href="http://architectnow.net/" target="_blank"><img src="https://nestjs.com/img/architectnow.png" width="125" valign="middle" /></a> </td><td align="center" valign="middle">
<a href="https://quander.io/" target="_blank"><img src="https://nestjs.com/img/quander.png" width="100" valign="middle" /></a> </td></tr><tr><td align="center" valign="middle">
<a href="https://mantro.net/" target="_blank"><img src="https://nestjs.com/img/mantro-logo.svg" width="95" valign="middle" /></a> </td><td align="center" valign="middle">
<a href="https://triplebyte.com/" target="_blank"><img src="https://nestjs.com/img/triplebyte.png" width="107" valign="middle" /></a> </td><td align="center" valign="middle">
<a href="https://reposit.co.uk/" target="_blank"><img src="https://nestjs.com/img/reposit-logo.png" width="71" valign="middle" /></a></td><td align="center" valign="middle">
<a href="https://nearpod.com/" target="_blank"><img src="https://nestjs.com/img/nearpod-logo.svg" width="100" valign="middle" /></a> </td><td align="center" valign="middle">
<a href="https://clay.global/" target="_blank"><img src="https://nestjs.com/img/clay-logo.svg" width="75" valign="middle" /></a> </td><td align="center" valign="middle">
<a href="https://firesticktricks.com" target="_blank"><img src="https://nestjs.com/img/firesticktricks-logo.png" width="120" valign="middle" /></a></td></tr><tr><td align="center" valign="middle">
<a href="https://www.codeguesser.co.uk" target="_blank"><img src="https://nestjs.com/img/codeguesser-logo.svg" width="120" valign="middle" /></a> </td><td align="center" valign="middle">
<a href="https://tekhattan.com" target="_blank"><img src="https://nestjs.com/img/tekhattan-logo.png" width="110" valign="middle" /></a> </td><td align="center" valign="middle">
<a href="https://f-a.nz/" target="_blank"><img src="https://nestjs.com/img/franz.svg" width="80" valign="middle" /></a> </td><td align="center" valign="middle">
<a href="https://sparkfabrik.com/" target="_blank"><img src="https://nestjs.com/img/sparkfabrik-logo.png" width="120" valign="middle" /></a></td><td align="center" valign="middle"><a href="https://www.thebigphonestore.co.uk/" target="_blank"><img src="https://nestjs.com/img/the-big-phone-store-logo.png" width="65" valign="middle" /></a></td></tr></table>
## Backers

View File

@@ -7,6 +7,7 @@ import {
HttpServer,
NestInterceptor,
} from '../../interfaces';
import { isNil } from '../../utils/shared.utils';
import {
CACHE_KEY_METADATA,
CACHE_MANAGER,
@@ -50,7 +51,7 @@ export class CacheInterceptor implements NestInterceptor {
return next.handle().pipe(
tap(response => {
const args = ttl ? [key, response, { ttl }] : [key, response];
const args = isNil(ttl) ? [key, response] : [key, response, { ttl }];
this.cacheManager.set(...args);
}),
);

View File

@@ -9,7 +9,7 @@ export type CustomDecorator<TKey = string> = MethodDecorator &
*
* Requires two parameters:
* - `key` - a value defining the key under which the metadata is stored
* - `value[]` - array of metadata values to be associated with `key`
* - `value` - metadata to be associated with `key`
*
* This metadata can be reflected using the `Reflector` class.
*

View File

@@ -5,7 +5,7 @@ import { REDIRECT_METADATA } from '../../constants';
*
* @publicApi
*/
export function Redirect(url: string, statusCode?: number): MethodDecorator {
export function Redirect(url = '', statusCode?: number): MethodDecorator {
return (
target: object,
key: string | symbol,

View File

@@ -1,8 +1,9 @@
import Axios, {
AxiosInstance,
AxiosPromise,
AxiosRequestConfig,
AxiosResponse,
AxiosPromise,
CancelTokenSource,
} from 'axios';
import { Observable } from 'rxjs';
import { Inject } from '../decorators';
@@ -72,13 +73,14 @@ export class HttpService {
...args: any[]
) {
return new Observable<AxiosResponse<T>>(subscriber => {
let config = args[args.length - 1];
if (!config) {
config = {};
args[args.length - 1] = config;
const config: AxiosRequestConfig = { ...(args[args.length - 1] || {}) };
let cancelSource: CancelTokenSource;
if (!config.cancelToken) {
cancelSource = Axios.CancelToken.source();
config.cancelToken = cancelSource.token;
}
const cancelSource = Axios.CancelToken.source();
config.cancelToken = cancelSource.token;
axios(...args)
.then(res => {
subscriber.next(res);
@@ -88,7 +90,11 @@ export class HttpService {
subscriber.error(err);
});
return () => {
if (config.responseType !== 'stream') {
if (config.responseType === 'stream') {
return;
}
if (cancelSource) {
cancelSource.cancel();
}
};

View File

@@ -35,6 +35,7 @@ export {
NestInterceptor,
NestMiddleware,
NestModule,
NestHybridApplicationOptions,
OnApplicationBootstrap,
OnApplicationShutdown,
OnModuleDestroy,

View File

@@ -10,7 +10,7 @@ import { ExecutionContext } from './execution-context.interface';
*/
export interface CallHandler<T = any> {
/**
* Returns an `Observable` reprsenting the response stream from the route
* Returns an `Observable` representing the response stream from the route
* handler.
*/
handle(): Observable<T>;

View File

@@ -28,3 +28,4 @@ export * from './nest-microservice.interface';
export * from './scope-options.interface';
export * from './type.interface';
export * from './websockets/web-socket-adapter.interface';
export * from './microservices/nest-hybrid-application-options.interface';

View File

@@ -0,0 +1,3 @@
export interface NestHybridApplicationOptions {
inheritAppConfig?: boolean;
}

View File

@@ -2,7 +2,12 @@ import { CorsOptions } from './external/cors-options.interface';
import { CanActivate } from './features/can-activate.interface';
import { NestInterceptor } from './features/nest-interceptor.interface';
import { HttpServer } from './http/http-server.interface';
import { ExceptionFilter, INestMicroservice, PipeTransform } from './index';
import {
ExceptionFilter,
INestMicroservice,
NestHybridApplicationOptions,
PipeTransform,
} from './index';
import { INestApplicationContext } from './nest-application-context.interface';
import { WebSocketAdapter } from './websockets/web-socket-adapter.interface';
@@ -80,9 +85,13 @@ export interface INestApplication extends INestApplicationContext {
* to a hybrid instance.
*
* @param {T} options Microservice options object
* @param {NestHybridApplicationOptions} hybridOptions Hybrid options object
* @returns {INestMicroservice}
*/
connectMicroservice<T extends object = any>(options: T): INestMicroservice;
connectMicroservice<T extends object = any>(
options: T,
hybridOptions?: NestHybridApplicationOptions,
): INestMicroservice;
/**
* Returns array of the microservices connected to the NestApplication.

View File

@@ -1,6 +1,6 @@
{
"name": "@nestjs/common",
"version": "7.0.5",
"version": "7.2.0",
"description": "Nest - modern, fast, powerful node.js web framework (@common)",
"author": "Kamil Mysliwiec",
"homepage": "https://nestjs.com",
@@ -19,8 +19,9 @@
"dependencies": {
"axios": "0.19.2",
"cli-color": "2.0.0",
"tslib": "1.11.1",
"uuid": "7.0.2"
"iterare": "1.2.1",
"tslib": "2.0.0",
"uuid": "8.1.0"
},
"peerDependencies": {
"reflect-metadata": "^0.1.12",

View File

@@ -0,0 +1,22 @@
import { ArgumentMetadata, Injectable, PipeTransform } from '../index';
import { isNil } from '../utils/shared.utils';
/**
* Defines the built-in DefaultValue Pipe
*
* @see [Built-in Pipes](https://docs.nestjs.com/pipes#built-in-pipes)
*
* @publicApi
*/
@Injectable()
export class DefaultValuePipe<T = any, R = any>
implements PipeTransform<T, T | R> {
constructor(private readonly defaultValue: R) {}
transform(value?: T, _metadata?: ArgumentMetadata): T | R {
if (isNil(value)) {
return this.defaultValue;
}
return value;
}
}

View File

@@ -1,3 +1,4 @@
export * from './default-value.pipe';
export * from './parse-array.pipe';
export * from './parse-bool.pipe';
export * from './parse-int.pipe';

View File

@@ -1,4 +1,4 @@
import iterate from 'iterare';
import { iterate } from 'iterare';
import { Optional } from '../decorators';
import { Injectable } from '../decorators/core';
import { HttpStatus } from '../enums/http-status.enum';
@@ -120,12 +120,7 @@ export class ValidationPipe implements PipeTransform<any> {
if (this.isDetailedOutputDisabled) {
return new HttpErrorByCode[this.errorHttpStatusCode]();
}
const errors = iterate(validationErrors)
.filter(item => !!item.constraints)
.map(item => Object.values(item.constraints))
.flatten()
.toArray();
const errors = this.flattenValidationErrors(validationErrors);
return new HttpErrorByCode[this.errorHttpStatusCode](errors);
};
}
@@ -164,7 +159,7 @@ export class ValidationPipe implements PipeTransform<any> {
private stripProtoKeys(value: Record<string, any>) {
delete value.__proto__;
const keys = Object.keys(value);
keys
iterate(keys)
.filter(key => typeof value[key] === 'object' && value[key])
.forEach(key => this.stripProtoKeys(value[key]));
}
@@ -172,4 +167,46 @@ export class ValidationPipe implements PipeTransform<any> {
private isPrimitive(value: unknown): boolean {
return ['number', 'boolean', 'string'].includes(typeof value);
}
private flattenValidationErrors(
validationErrors: ValidationError[],
): string[] {
return iterate(validationErrors)
.map(error => this.mapChildrenToValidationErrors(error))
.flatten()
.filter(item => !!item.constraints)
.map(item => Object.values(item.constraints))
.flatten()
.toArray();
}
private mapChildrenToValidationErrors(
error: ValidationError,
): ValidationError[] {
if (!(error.children && error.children.length)) {
return [error];
}
const validationErrors = [];
for (const item of error.children) {
if (item.children && item.children.length) {
validationErrors.push(...this.mapChildrenToValidationErrors(item));
}
validationErrors.push(this.prependConstraintsWithParentProp(error, item));
}
return validationErrors;
}
private prependConstraintsWithParentProp(
parentError: ValidationError,
error: ValidationError,
): ValidationError {
const constraints = {};
for (const key in error.constraints) {
constraints[key] = `${parentError.property}.${error.constraints[key]}`;
}
return {
...error,
constraints,
};
}
}

View File

@@ -1,6 +1,6 @@
import { expect } from 'chai';
import { ROUTE_ARGS_METADATA } from '../../constants';
import { Bind } from '../../decorators/core/bind.decorator';
import { ROUTE_ARGS_METADATA } from '@nestjs/common/constants';
import { Req } from '../../decorators/http/route-params.decorator';
describe('@Bind', () => {

View File

@@ -1,7 +1,7 @@
import { ParseIntPipe } from '@nestjs/common';
import { ROUTE_ARGS_METADATA } from '@nestjs/common/constants';
import { expect } from 'chai';
import { ROUTE_ARGS_METADATA } from '../../constants';
import { createParamDecorator } from '../../decorators/http/create-route-param-metadata.decorator';
import { ParseIntPipe } from '../../index';
describe('createParamDecorator', () => {
let result;

View File

@@ -1,7 +1,7 @@
import { expect } from 'chai';
import { Redirect } from '../../decorators/http/redirect.decorator';
import { REDIRECT_METADATA } from '../../constants';
import { HttpStatus } from '@nestjs/common';
import { Redirect } from '../../decorators/http/redirect.decorator';
import { HttpStatus } from '../../index';
describe('@Redirect', () => {
const url = 'http://test.com';

View File

@@ -8,17 +8,17 @@ class Guard {}
describe('@UseGuards', () => {
const guards = [Guard, Guard];
@UseGuards(...(guards as any))
@UseGuards(...guards)
class Test {}
class TestWithMethod {
@UseGuards(...(guards as any))
@UseGuards(...guards)
public static test() {}
}
class Test2 {
@UseGuards(...(guards as any))
@UseGuards(...(guards as any))
@UseGuards(...guards)
@UseGuards(...guards)
public static test() {}
}

View File

@@ -8,11 +8,11 @@ class Interceptor {}
describe('@UseInterceptors', () => {
const interceptors = [Interceptor, Interceptor];
@UseInterceptors(...(interceptors as any))
@UseInterceptors(...interceptors)
class Test {}
class TestWithMethod {
@UseInterceptors(...(interceptors as any))
@UseInterceptors(...interceptors)
public static test() {}
}

View File

@@ -10,11 +10,11 @@ class Pipe {
describe('@UsePipes', () => {
const pipes = [new Pipe(), new Pipe()];
@UsePipes(...(pipes as any))
@UsePipes(...pipes)
class Test {}
class TestWithMethod {
@UsePipes(...(pipes as any))
@UsePipes(...pipes)
public static test() {}
}

View File

@@ -0,0 +1,18 @@
import { expect } from 'chai';
import { HttpService } from '../../http/http.service';
import { AxiosRequestConfig, AxiosInstance } from 'axios';
describe('HttpService', () => {
it('should not mutate user-given axios options object', done => {
const http = new HttpService({ get: () => Promise.resolve() } as any);
const options: AxiosRequestConfig = {};
http
.get('/', options)
.toPromise()
.then(() => {
expect(options.cancelToken).to.be.undefined;
done();
});
});
});

View File

@@ -0,0 +1,20 @@
import { expect } from 'chai';
import { DefaultValuePipe } from '../../pipes/default-value.pipe';
describe('DefaultValuePipe', () => {
const defaultValue = 'default';
const target = new DefaultValuePipe(defaultValue);
describe('transform', () => {
it('should return original value if one was provided', () => {
const value = 'value';
const result = target.transform(value);
expect(result).to.equal(value);
});
it('should return default value if no value was provided', () => {
const result = target.transform(undefined);
expect(result).to.equal(defaultValue);
});
});
});

View File

@@ -1,8 +1,14 @@
import * as chai from 'chai';
import { expect } from 'chai';
import * as chaiAsPromised from 'chai-as-promised';
import { Exclude, Expose } from 'class-transformer';
import { IsOptional, IsString } from 'class-validator';
import { Exclude, Expose, Type } from 'class-transformer';
import {
IsBoolean,
IsDefined,
IsOptional,
IsString,
ValidateNested,
} from 'class-validator';
import { HttpStatus } from '../../enums';
import { UnprocessableEntityException } from '../../exceptions';
import { ArgumentMetadata } from '../../interfaces';
@@ -27,10 +33,11 @@ class TestModelInternal {
}
class TestModel {
constructor() {}
@IsString() public prop1: string;
@IsString()
public prop1: string;
@IsString() public prop2: string;
@IsString()
public prop2: string;
@IsOptional()
@IsString()
@@ -112,6 +119,43 @@ describe('ValidationPipe', () => {
const testObj = { prop1: 'value1' };
return expect(target.transform(testObj, metadata)).to.be.rejected;
});
class TestModel2 {
@IsString()
public prop1: string;
@IsBoolean()
public prop2: string;
@IsOptional()
@IsString()
public optionalProp: string;
}
class TestModelWithNested {
@IsString()
prop: string;
@IsDefined()
@Type(() => TestModel2)
@ValidateNested()
test: TestModel2;
}
it('should flatten nested errors', async () => {
try {
const model = new TestModelWithNested();
model.test = new TestModel2();
await target.transform(model, {
type: 'body',
metatype: TestModelWithNested,
});
} catch (err) {
expect(err.getResponse().message).to.be.eql([
'prop must be a string',
'test.prop1 must be a string',
'test.prop2 must be a boolean value',
]);
}
});
});
describe('when validation transforms', () => {
it('should return a TestModel instance', async () => {

View File

@@ -38,6 +38,14 @@ Nest is a framework for building efficient, scalable <a href="http://nodejs.org"
* 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:
## Questions
For questions and support please use the official [Discord channel](https://discord.gg/G7Qnnhy). The issue list of this repo is **exclusively** for bug reports and feature requests.
## Issues
Please make sure to read the [Issue Reporting Checklist](https://github.com/nestjs/nest/blob/master/CONTRIBUTING.md#-submitting-an-issue) before opening an issue. Issues not conforming to the guidelines may be closed immediately.
## Consulting
With official support, you can get expert help straight from Nest core team. We provide dedicated technical support, migration strategies, advice on best practices (and design decisions), PR reviews, and team augmentation. Read more about [support here](https://enterprise.nestjs.com).
@@ -48,30 +56,35 @@ Nest is an MIT-licensed open source project. It can grow thanks to the sponsors
#### Principal Sponsor
<a href="https://valor-software.com/" target="_blank"><img src="https://docs.nestjs.com/assets/sponsors/valor-software.png" width="320" /></a>
<a href="https://valor-software.com/" target="_blank"><img src="https://docs.nestjs.com/assets/sponsors/valor-software.png" width="220" /></a>
#### Silver Sponsors
<a href="https://neoteric.eu/" target="_blank"><img src="https://nestjs.com/img/neoteric-cut.png" width="120" valign="middle" /></a> &nbsp;
<a href="http://gojob.com" target="_blank"><img src="http://nestjs.com/img/gojob-logo.png" valign="middle" height="95" /></a> &nbsp;
<a href="https://trilon.io" target="_blank"><img src="https://nestjs.com/img/trilon.svg" width="150" valign="middle" /></a> &nbsp;
<a href="http://www.leogistics.com" target="_blank"><img src="https://nestjs.com/img/leogistics-logo.jpeg" width="150" valign="middle" /></a>
<table style="text-align:center;"><tr><td>
<a href="https://neoteric.eu/" target="_blank"><img src="https://nestjs.com/img/neoteric-cut.png" width="120" valign="middle" /></a> </td><td>
<a href="http://gojob.com" target="_blank"><img src="http://nestjs.com/img/gojob-logo.png" valign="middle" width="100" /></a> </td><td>
<a href="https://trilon.io" target="_blank"><img src="https://nestjs.com/img/trilon.svg" width="170" valign="middle" /></a> </td><td>
<a href="http://www.leogistics.com" target="_blank"><img src="https://nestjs.com/img/leogistics-logo.jpeg" width="150" valign="middle" /></td></tr></table>
#### Sponsors
<a href="https://www.swingdev.io" target="_blank"><img src="https://nestjs.com/img/swingdev-logo.svg#1" width="110" valign="middle" /> </a> &nbsp; <a href="https://blueanchor.io/" target="_blank"><img src="https://nestjs.com/img/blueanchor.png" width="150" valign="middle" /></a> &nbsp;
<a href="https://www.novologic.com/" target="_blank"><img src="https://nestjs.com/img/novologic.png" width="110" valign="middle" /></a> &nbsp; <a href="https://hostpresto.com" target="_blank"><img src="https://nestjs.com/img/hostpresto.png" height="24" valign="middle" /></a>
<a href="https://ever.co/" target="_blank"><img src="https://nestjs.com/img/ever-logo.png" height="14" valign="middle" /></a> &nbsp;
<a href="https://buddy.works/" target="_blank"><img src="https://nestjs.com/img/buddy-logo.svg" height="25" valign="middle" /></a> &nbsp;
<a href="https://blokt.com" target="_blank"><img src="https://nestjs.com/img/blokt-logo.png" height="25" valign="middle" /></a> &nbsp; <a href="https://genuinebee.com/" target="_blank"><img src="https://nestjs.com/img/genuinebee.svg" height="27" valign="middle" /></a> &nbsp; <a href="http://architectnow.net/" target="_blank"><img src="https://nestjs.com/img/architectnow.png" height="20" valign="middle" /></a> &nbsp; <a href="https://quander.io/" target="_blank"><img src="https://nestjs.com/img/quander.png" height="22" valign="middle" /></a> &nbsp; <a href="https://mantro.net/" target="_blank"><img src="https://nestjs.com/img/mantro-logo.svg" height="19" valign="middle" /></a> &nbsp; <a href="https://triplebyte.com/" target="_blank"><img src="https://nestjs.com/img/triplebyte.png" height="20" valign="middle" /></a> &nbsp;
<a href="https://reposit.co.uk/" target="_blank"><img src="https://nestjs.com/img/reposit-logo.png" height="18" valign="middle" /></a> &nbsp; &nbsp;
<a href="https://nearpod.com/" target="_blank"><img src="https://nestjs.com/img/nearpod-logo.svg" width="100" valign="middle" /></a> &nbsp;
<a href="https://clay.global/" target="_blank"><img src="https://nestjs.com/img/clay-logo.svg" width="75" valign="middle" /></a> &nbsp;
<a href="https://firesticktricks.com" target="_blank"><img src="https://nestjs.com/img/firesticktricks-logo.png" width="120" valign="middle" /></a> &nbsp;
<a href="https://www.codeguesser.co.uk" target="_blank"><img src="https://nestjs.com/img/codeguesser-logo.svg" width="120" valign="middle" /></a> &nbsp;
<a href="https://tekhattan.com" target="_blank"><img src="https://nestjs.com/img/tekhattan-logo.png" width="110" valign="middle" /></a> &nbsp;
<a href="https://f-a.nz/" target="_blank"><img src="https://nestjs.com/img/franz.svg" width="80" valign="middle" /></a> &nbsp;
<a href="https://sparkfabrik.com/" target="_blank"><img src="https://nestjs.com/img/sparkfabrik-logo.png" width="120" valign="middle" /></a>
<table><tr><td align="center" valign="middle">
<a href="https://www.swingdev.io" target="_blank"><img src="https://nestjs.com/img/swingdev-logo.svg#1" width="110" valign="middle" /> </a></td><td align="center" valign="middle">
<a href="https://www.novologic.com/" target="_blank"><img src="https://nestjs.com/img/novologic.png" width="110" valign="middle" /></a> </td><td align="center" valign="middle">
<a href="https://ever.co/" target="_blank"><img src="https://nestjs.com/img/ever-logo.png" width="72" valign="middle" /></a> </td><td align="center" valign="middle">
<a href="https://blokt.com" target="_blank"><img src="https://nestjs.com/img/blokt-logo.png" width="120" valign="middle" /></a> </td><td align="center" valign="middle">
<a href="http://architectnow.net/" target="_blank"><img src="https://nestjs.com/img/architectnow.png" width="125" valign="middle" /></a> </td><td align="center" valign="middle">
<a href="https://quander.io/" target="_blank"><img src="https://nestjs.com/img/quander.png" width="100" valign="middle" /></a> </td></tr><tr><td align="center" valign="middle">
<a href="https://mantro.net/" target="_blank"><img src="https://nestjs.com/img/mantro-logo.svg" width="95" valign="middle" /></a> </td><td align="center" valign="middle">
<a href="https://triplebyte.com/" target="_blank"><img src="https://nestjs.com/img/triplebyte.png" width="107" valign="middle" /></a> </td><td align="center" valign="middle">
<a href="https://reposit.co.uk/" target="_blank"><img src="https://nestjs.com/img/reposit-logo.png" width="71" valign="middle" /></a></td><td align="center" valign="middle">
<a href="https://nearpod.com/" target="_blank"><img src="https://nestjs.com/img/nearpod-logo.svg" width="100" valign="middle" /></a> </td><td align="center" valign="middle">
<a href="https://clay.global/" target="_blank"><img src="https://nestjs.com/img/clay-logo.svg" width="75" valign="middle" /></a> </td><td align="center" valign="middle">
<a href="https://firesticktricks.com" target="_blank"><img src="https://nestjs.com/img/firesticktricks-logo.png" width="120" valign="middle" /></a></td></tr><tr><td align="center" valign="middle">
<a href="https://www.codeguesser.co.uk" target="_blank"><img src="https://nestjs.com/img/codeguesser-logo.svg" width="120" valign="middle" /></a> </td><td align="center" valign="middle">
<a href="https://tekhattan.com" target="_blank"><img src="https://nestjs.com/img/tekhattan-logo.png" width="110" valign="middle" /></a> </td><td align="center" valign="middle">
<a href="https://f-a.nz/" target="_blank"><img src="https://nestjs.com/img/franz.svg" width="80" valign="middle" /></a> </td><td align="center" valign="middle">
<a href="https://sparkfabrik.com/" target="_blank"><img src="https://nestjs.com/img/sparkfabrik-logo.png" width="120" valign="middle" /></a></td><td align="center" valign="middle"><a href="https://www.thebigphonestore.co.uk/" target="_blank"><img src="https://nestjs.com/img/the-big-phone-store-logo.png" width="65" valign="middle" /></a></td></tr></table>
## Backers

View File

@@ -2,8 +2,7 @@ import { INVALID_MODULE_MESSAGE } from '../messages';
import { RuntimeException } from './runtime.exception';
export class InvalidModuleException extends RuntimeException {
constructor(trace: any[]) {
const scope = (trace || []).map(module => module.name).join(' -> ');
super(INVALID_MODULE_MESSAGE`${scope}`);
constructor(parentModule: any, index: number, scope: any[]) {
super(INVALID_MODULE_MESSAGE(parentModule, index, scope));
}
}

View File

@@ -0,0 +1,9 @@
import { UNDEFINED_FORWARDREF_MESSAGE } from '../messages';
import { RuntimeException } from './runtime.exception';
import { Type } from '@nestjs/common';
export class UndefinedForwardRefException extends RuntimeException {
constructor(scope: Type<any>[]) {
super(UNDEFINED_FORWARDREF_MESSAGE(scope));
}
}

View File

@@ -0,0 +1,8 @@
import { RuntimeException } from './runtime.exception';
import { UNDEFINED_MODULE_MESSAGE } from '../messages';
export class UndefinedModuleException extends RuntimeException {
constructor(parentModule: any, index: number, scope: any[]) {
super(UNDEFINED_MODULE_MESSAGE(parentModule, index, scope));
}
}

View File

@@ -2,7 +2,7 @@ import { UNKNOWN_EXPORT_MESSAGE } from '../messages';
import { RuntimeException } from './runtime.exception';
export class UnknownExportException extends RuntimeException {
constructor(token: string, module: string) {
super(UNKNOWN_EXPORT_MESSAGE(token, module));
constructor(token: string | symbol, moduleName: string) {
super(UNKNOWN_EXPORT_MESSAGE(token, moduleName));
}
}

View File

@@ -37,6 +37,9 @@ const getDependencyName = (dependency: InjectorDependency): string =>
const getModuleName = (module: Module) =>
(module && getInstanceName(module.metatype)) || 'current';
const stringifyScope = (scope: any[]): string =>
(scope || []).map(getInstanceName).join(' -> ');
export const UNKNOWN_DEPENDENCIES_MESSAGE = (
type: string | symbol,
unknownDependencyContext: InjectorDependencyContext,
@@ -84,17 +87,50 @@ export const INVALID_MIDDLEWARE_MESSAGE = (
name: string,
) => `The middleware doesn't provide the 'use' method (${name})`;
export const INVALID_MODULE_MESSAGE = (
text: TemplateStringsArray,
scope: string,
) =>
`Nest cannot create the module instance. Often, this is because of a circular dependency between modules. Use forwardRef() to avoid it.
export const UNDEFINED_FORWARDREF_MESSAGE = (
scope: Type<any>[],
) => `Nest cannot create the module instance. Often, this is because of a circular dependency between modules. Use forwardRef() to avoid it.
(Read more: https://docs.nestjs.com/fundamentals/circular-dependency)
Scope [${scope}]
`;
Scope [${stringifyScope(scope)}]
`;
export const INVALID_MODULE_MESSAGE = (
parentModule: any,
index: number,
scope: any[],
) => {
const parentModuleName = parentModule?.name || 'module';
return `Nest cannot create the ${parentModuleName} instance.
Received an unexpected value at index [${index}] of the ${parentModuleName} "imports" array.
Scope [${stringifyScope(scope)}]`;
};
export const UNDEFINED_MODULE_MESSAGE = (
parentModule: any,
index: number,
scope: any[],
) => {
const parentModuleName = parentModule?.name || 'module';
return `Nest cannot create the ${parentModuleName} instance.
The module at index [${index}] of the ${parentModuleName} "imports" array is undefined.
Potential causes:
- A circular dependency between modules. Use forwardRef() to avoid it. Read more: https://docs.nestjs.com/fundamentals/circular-dependency
- The module at index [${index}] is of type "undefined". Check your import statements and the type of the module.
Scope [${stringifyScope(scope)}]`;
};
export const UNKNOWN_EXPORT_MESSAGE = (
token: string | symbol = 'item',
module: string,
) => {
token = isSymbol(token) ? token.toString() : token;
export const UNKNOWN_EXPORT_MESSAGE = (token = 'item', module: string) => {
return `Nest cannot export a provider/module that is not a part of the currently processed module (${module}). Please verify whether the exported ${token} is available in this particular context.
Possible Solutions:

View File

@@ -2,7 +2,7 @@ import { FILTER_CATCH_EXCEPTIONS } from '@nestjs/common/constants';
import { Type } from '@nestjs/common/interfaces';
import { ExceptionFilter } from '@nestjs/common/interfaces/exceptions/exception-filter.interface';
import { isEmpty, isFunction } from '@nestjs/common/utils/shared.utils';
import iterate from 'iterare';
import { iterate } from 'iterare';
import { ContextCreator } from '../helpers/context-creator';
import { STATIC_CONTEXT } from '../injector/constants';
import { NestContainer } from '../injector/container';

View File

@@ -1,4 +1,4 @@
import { HttpException } from '@nestjs/common';
import { HttpException, Type } from '@nestjs/common';
import { ExceptionFilterMetadata } from '@nestjs/common/interfaces/exceptions/exception-filter-metadata.interface';
import { ArgumentsHost } from '@nestjs/common/interfaces/features/arguments-host.interface';
import { isEmpty } from '@nestjs/common/utils/shared.utils';
@@ -26,14 +26,15 @@ export class ExceptionsHandler extends BaseExceptionFilter {
exception: T,
ctx: ArgumentsHost,
): boolean {
if (isEmpty(this.filters)) return false;
if (isEmpty(this.filters)) {
return false;
}
const isInstanceOf = (metatype: Type<unknown>) =>
exception instanceof metatype;
const filter = this.filters.find(({ exceptionMetatypes }) => {
const typeExists =
!exceptionMetatypes.length ||
exceptionMetatypes.some(
ExceptionMetatype => exception instanceof ExceptionMetatype,
);
!exceptionMetatypes.length || exceptionMetatypes.some(isInstanceOf);
return typeExists;
});
filter && filter.func(exception, ctx);

View File

@@ -9,6 +9,7 @@ import { InstanceWrapper } from '../injector/instance-wrapper';
import { RouterProxyCallback } from '../router/router-proxy';
import { BaseExceptionFilterContext } from './base-exception-filter-context';
import { ExternalExceptionsHandler } from './external-exceptions-handler';
import { iterate } from 'iterare';
export class ExternalExceptionFilterContext extends BaseExceptionFilterContext {
constructor(
@@ -54,10 +55,11 @@ export class ExternalExceptionFilterContext extends BaseExceptionFilterContext {
return globalFilters;
}
const scopedFilterWrappers = this.config.getGlobalRequestFilters() as InstanceWrapper[];
const scopedFilters = scopedFilterWrappers
const scopedFilters = iterate(scopedFilterWrappers)
.map(wrapper => wrapper.getInstanceByContextId(contextId, inquirerId))
.filter(host => host)
.map(host => host.instance);
.filter(host => !!host)
.map(host => host.instance)
.toArray();
return globalFilters.concat(scopedFilters) as T;
}

View File

@@ -1,3 +1,4 @@
import { Type } from '@nestjs/common';
import { ExceptionFilterMetadata } from '@nestjs/common/interfaces/exceptions';
import { ArgumentsHost } from '@nestjs/common/interfaces/features/arguments-host.interface';
import { isEmpty } from '@nestjs/common/utils/shared.utils';
@@ -29,11 +30,13 @@ export class ExternalExceptionsHandler extends ExternalExceptionFilter {
if (isEmpty(this.filters)) {
return null;
}
const isInstanceOf = metatype => exception instanceof metatype;
const filter = this.filters.find(({ exceptionMetatypes, func }) => {
const hasMetatype =
const isInstanceOf = (metatype: Type<unknown>) =>
exception instanceof metatype;
const filter = this.filters.find(({ exceptionMetatypes }) => {
const typeExists =
!exceptionMetatypes.length || exceptionMetatypes.some(isInstanceOf);
return hasMetatype;
return typeExists;
});
return filter ? filter.func(exception, host) : null;
}

View File

@@ -2,7 +2,7 @@ import { CanActivate } from '@nestjs/common';
import { GUARDS_METADATA } from '@nestjs/common/constants';
import { Controller } from '@nestjs/common/interfaces';
import { isEmpty, isFunction } from '@nestjs/common/utils/shared.utils';
import iterate from 'iterare';
import { iterate } from 'iterare';
import { ApplicationConfig } from '../application-config';
import { ContextCreator } from '../helpers/context-creator';
import { STATIC_CONTEXT } from '../injector/constants';
@@ -100,10 +100,11 @@ export class GuardsContextCreator extends ContextCreator {
return globalGuards;
}
const scopedGuardWrappers = this.config.getGlobalRequestGuards() as InstanceWrapper[];
const scopedGuards = scopedGuardWrappers
const scopedGuards = iterate(scopedGuardWrappers)
.map(wrapper => wrapper.getInstanceByContextId(contextId, inquirerId))
.filter(host => host)
.map(host => host.instance);
.filter(host => !!host)
.map(host => host.instance)
.toArray();
return globalGuards.concat(scopedGuards) as T;
}

View File

@@ -1,6 +1,6 @@
import { BeforeApplicationShutdown } from '@nestjs/common';
import { isNil } from '@nestjs/common/utils/shared.utils';
import iterate from 'iterare';
import { iterate } from 'iterare';
import { InstanceWrapper } from '../injector/instance-wrapper';
import { Module } from '../injector/module';
import {

View File

@@ -1,6 +1,6 @@
import { OnApplicationBootstrap } from '@nestjs/common';
import { isNil } from '@nestjs/common/utils/shared.utils';
import iterate from 'iterare';
import { iterate } from 'iterare';
import { InstanceWrapper } from '../injector/instance-wrapper';
import { Module } from '../injector/module';
import {

View File

@@ -1,6 +1,6 @@
import { OnApplicationShutdown } from '@nestjs/common';
import { isNil } from '@nestjs/common/utils/shared.utils';
import iterate from 'iterare';
import { iterate } from 'iterare';
import { InstanceWrapper } from '../injector/instance-wrapper';
import { Module } from '../injector/module';
import {

View File

@@ -1,6 +1,6 @@
import { OnModuleDestroy } from '@nestjs/common';
import { isNil } from '@nestjs/common/utils/shared.utils';
import iterate from 'iterare';
import { iterate } from 'iterare';
import { InstanceWrapper } from '../injector/instance-wrapper';
import { Module } from '../injector/module';
import {

View File

@@ -1,6 +1,6 @@
import { OnModuleInit } from '@nestjs/common';
import { isNil } from '@nestjs/common/utils/shared.utils';
import iterate from 'iterare';
import { iterate } from 'iterare';
import { InstanceWrapper } from '../injector/instance-wrapper';
import { Module } from '../injector/module';
import {

View File

@@ -4,7 +4,7 @@ import { Injectable } from '@nestjs/common/interfaces/injectable.interface';
import { Type } from '@nestjs/common/interfaces/type.interface';
import { ApplicationConfig } from '../application-config';
import { CircularDependencyException } from '../errors/exceptions/circular-dependency.exception';
import { InvalidModuleException } from '../errors/exceptions/invalid-module.exception';
import { UndefinedForwardRefException } from '../errors/exceptions/undefined-forwardref.exception';
import { UnknownModuleException } from '../errors/exceptions/unknown-module.exception';
import { ExternalContextCreator } from '../helpers/external-context-creator';
import { HttpAdapterHost } from '../helpers/http-adapter-host';
@@ -55,8 +55,10 @@ export class NestContainer {
metatype: Type<any> | DynamicModule | Promise<DynamicModule>,
scope: Type<any>[],
): Promise<Module> {
// In DependenciesScanner#scanForModules we already check for undefined or invalid modules
// We sill need to catch the edge-case of `forwardRef(() => undefined)`
if (!metatype) {
throw new InvalidModuleException(scope);
throw new UndefinedForwardRefException(scope);
}
const { type, dynamicMetadata, token } = await this.moduleCompiler.compile(
metatype,
@@ -64,7 +66,7 @@ export class NestContainer {
if (this.modules.has(token)) {
return;
}
const moduleRef = new Module(type, scope, this);
const moduleRef = new Module(type, this);
this.modules.set(token, moduleRef);
this.addDynamicMetadata(token, dynamicMetadata, [].concat(scope, type));
@@ -180,11 +182,11 @@ export class NestContainer {
}
public replace(toReplace: any, options: any & { scope: any[] | null }) {
this.modules.forEach(module => module.replace(toReplace, options));
this.modules.forEach(moduleRef => moduleRef.replace(toReplace, options));
}
public bindGlobalScope() {
this.modules.forEach(module => this.bindGlobalsToImports(module));
this.modules.forEach(moduleRef => this.bindGlobalsToImports(moduleRef));
}
public bindGlobalsToImports(moduleRef: Module) {

View File

@@ -15,6 +15,7 @@ import {
isString,
isUndefined,
} from '@nestjs/common/utils/shared.utils';
import { iterate } from 'iterare';
import { RuntimeException } from '../errors/exceptions/runtime.exception';
import { UndefinedDependencyException } from '../errors/exceptions/undefined-dependency.exception';
import { UnknownDependenciesException } from '../errors/exceptions/unknown-dependencies.exception';
@@ -612,7 +613,7 @@ export class Injector {
if (!isObject(instance)) {
return undefined;
}
properties
iterate(properties)
.filter(item => !isNil(item.instance))
.forEach(item => (instance[item.key] = item.instance));
}
@@ -665,8 +666,11 @@ export class Injector {
wrapper?: InstanceWrapper,
): Promise<T> {
if (!wrapper) {
const ctor = instance.constructor;
wrapper = collection.get(ctor && ctor.name);
const providerCtor = instance.constructor;
const injectionToken =
(providerCtor && providerCtor.name) ||
((providerCtor as unknown) as string);
wrapper = collection.get(injectionToken);
}
await this.loadInstance(wrapper, collection, moduleRef, ctx, wrapper);
await this.loadEnhancersPerContext(wrapper, ctx, wrapper);

View File

@@ -6,6 +6,7 @@ import {
} from '@nestjs/common/interfaces';
import { randomStringGenerator } from '@nestjs/common/utils/random-string-generator.util';
import { isNil, isUndefined } from '@nestjs/common/utils/shared.utils';
import { iterate } from 'iterare';
import { STATIC_CONTEXT } from './constants';
import { Module } from './module';
@@ -37,9 +38,9 @@ export class InstanceWrapper<T = any> {
public readonly name: any;
public readonly async?: boolean;
public readonly host?: Module;
public readonly scope?: Scope = Scope.DEFAULT;
public readonly isAlias: boolean = false;
public scope?: Scope = Scope.DEFAULT;
public metatype: Type<T> | Function;
public inject?: (string | symbol | Function | Type<any>)[];
public forwardRef?: boolean;
@@ -255,9 +256,11 @@ export class InstanceWrapper<T = any> {
): boolean {
const isDependencyTreeStatic = this.isDependencyTreeStatic();
return ((!isDependencyTreeStatic &&
return (
!isDependencyTreeStatic &&
contextId !== STATIC_CONTEXT &&
(!this.isTransient || (this.isTransient && inquirer))) as any) as boolean;
(!this.isTransient || (this.isTransient && !!inquirer))
);
}
public isLazyTransient(
@@ -279,10 +282,11 @@ export class InstanceWrapper<T = any> {
contextId: ContextId,
inquirer?: InstanceWrapper,
): boolean {
const isSelfRequested = inquirer === this;
return (
this.isDependencyTreeStatic() &&
contextId !== STATIC_CONTEXT &&
inquirer === this
(isSelfRequested || (inquirer && inquirer.scope === Scope.TRANSIENT))
);
}
@@ -297,7 +301,8 @@ export class InstanceWrapper<T = any> {
return (
this.isDependencyTreeStatic() &&
contextId === STATIC_CONTEXT &&
(!this.isTransient || (isStaticTransient && !!inquirer))
(!this.isTransient ||
(isStaticTransient && !!inquirer && !inquirer.isTransient))
);
}
@@ -306,15 +311,17 @@ export class InstanceWrapper<T = any> {
return [];
}
const instances = [...this.transientMap.values()];
return instances
return iterate(instances)
.map(item => item.get(STATIC_CONTEXT))
.filter(item => !!item);
.filter(item => !!item)
.toArray();
}
public mergeWith(provider: Provider) {
if ((provider as ValueProvider).useValue) {
this.metatype = null;
this.inject = null;
this.scope = Scope.DEFAULT;
this.setInstanceByContextId(STATIC_CONTEXT, {
instance: (provider as ValueProvider).useValue,

View File

@@ -1,5 +1,6 @@
import { Type } from '@nestjs/common';
import { UnknownElementException } from '../errors/exceptions/unknown-element.exception';
import { getClassScope } from '../helpers/get-class-scope';
import { NestContainer } from './container';
import { ContainerScanner } from './container-scanner';
import { Injector } from './injector';
@@ -38,8 +39,8 @@ export abstract class ModuleRef {
const wrapper = new InstanceWrapper({
name: type && type.name,
metatype: type,
instance: undefined,
isResolved: false,
scope: getClassScope(type),
host: moduleRef,
});
return new Promise<T>(async (resolve, reject) => {
@@ -82,7 +83,9 @@ export abstract class ModuleRef {
options?: { strict: boolean },
): Promise<TResult> {
let wrapper: InstanceWrapper, collection: Map<string, InstanceWrapper>;
if (!(options && options.strict)) {
const isStrictModeEnabled = options && options.strict;
if (!isStrictModeEnabled) {
[wrapper, collection] = this.containerScanner.getWrapperCollectionPair(
typeOrToken,
);
@@ -95,8 +98,13 @@ export abstract class ModuleRef {
contextModule,
);
}
if (wrapper.isDependencyTreeStatic() && !wrapper.isTransient) {
return this.get(typeOrToken);
}
const ctorHost = wrapper.instance || { constructor: typeOrToken };
const instance = await this.injector.loadPerContext(
wrapper.instance,
ctorHost,
wrapper.host,
collection,
contextId,

View File

@@ -19,6 +19,7 @@ import {
isSymbol,
isUndefined,
} from '@nestjs/common/utils/shared.utils';
import { iterate } from 'iterare';
import { ApplicationConfig } from '../application-config';
import { InvalidClassException } from '../errors/exceptions/invalid-class.exception';
import { RuntimeException } from '../errors/exceptions/runtime.exception';
@@ -49,7 +50,6 @@ export class Module {
constructor(
private readonly _metatype: Type<any>,
private readonly _scope: Type<any>[],
private readonly container: NestContainer,
) {
this.addCoreProviders();
@@ -60,10 +60,6 @@ export class Module {
return this._id;
}
get scope(): Type<any>[] {
return this._scope;
}
get providers(): Map<any, InstanceWrapper<Injectable>> {
return this._providers;
}
@@ -397,15 +393,16 @@ export class Module {
return token;
}
const importsArray = [...this._imports.values()];
const importsNames = importsArray
.filter(item => item)
const importsNames = iterate(importsArray)
.filter(item => !!item)
.map(({ metatype }) => metatype)
.filter(metatype => metatype)
.map(({ name }) => name);
.filter(metatype => !!metatype)
.map(({ name }) => name)
.toArray();
if (!importsNames.includes(token as any)) {
if (!importsNames.includes(token as string)) {
const { name } = this.metatype;
throw new UnknownExportException(token as any, name);
throw new UnknownExportException(token, name);
}
return token;
}

View File

@@ -1,4 +1,4 @@
import iterate from 'iterare';
import { iterate } from 'iterare';
import { InstanceWrapper } from './instance-wrapper';

View File

@@ -1,7 +1,7 @@
import { INTERCEPTORS_METADATA } from '@nestjs/common/constants';
import { Controller, NestInterceptor } from '@nestjs/common/interfaces';
import { isEmpty, isFunction } from '@nestjs/common/utils/shared.utils';
import iterate from 'iterare';
import { iterate } from 'iterare';
import { ApplicationConfig } from '../application-config';
import { ContextCreator } from '../helpers/context-creator';
import { STATIC_CONTEXT } from '../injector/constants';
@@ -104,10 +104,11 @@ export class InterceptorsContextCreator extends ContextCreator {
return globalInterceptors;
}
const scopedInterceptorWrappers = this.config.getGlobalRequestInterceptors() as InstanceWrapper[];
const scopedInterceptors = scopedInterceptorWrappers
const scopedInterceptors = iterate(scopedInterceptorWrappers)
.map(wrapper => wrapper.getInstanceByContextId(contextId, inquirerId))
.filter(host => host)
.map(host => host.instance);
.filter(host => !!host)
.map(host => host.instance)
.toArray();
return globalInterceptors.concat(scopedInterceptors) as T;
}

View File

@@ -4,7 +4,7 @@ import {
isFunction,
isNil,
} from '@nestjs/common/utils/shared.utils';
import iterate from 'iterare';
import { iterate } from 'iterare';
export class MetadataScanner {
public scanFromPrototype<T extends Injectable, R = any>(

View File

@@ -11,6 +11,7 @@ import {
import { MiddlewareConfiguration } from '@nestjs/common/interfaces/middleware/middleware-configuration.interface';
import { RoutesMapper } from './routes-mapper';
import { filterMiddleware } from './utils';
import { iterate } from 'iterare';
export class MiddlewareBuilder implements MiddlewareConsumer {
private readonly middlewareCollection = new Set<MiddlewareConfiguration>();
@@ -49,21 +50,16 @@ export class MiddlewareBuilder implements MiddlewareConsumer {
public exclude(
...routes: Array<string | RouteInfo>
): MiddlewareConfigProxy {
const { routesMapper } = this.builder;
this.excludedRoutes = this.mapRoutesToFlatList(
routes.map(route => routesMapper.mapRouteToRouteInfo(route)),
);
this.excludedRoutes = this.getRoutesFlatList(routes);
return this;
}
public forRoutes(
...routes: Array<string | Type<any> | RouteInfo>
): MiddlewareConsumer {
const { middlewareCollection, routesMapper } = this.builder;
const { middlewareCollection } = this.builder;
const forRoutes = this.mapRoutesToFlatList(
routes.map(route => routesMapper.mapRouteToRouteInfo(route)),
);
const forRoutes = this.getRoutesFlatList(routes);
const configuration = {
middleware: filterMiddleware(
this.middleware,
@@ -76,8 +72,15 @@ export class MiddlewareBuilder implements MiddlewareConsumer {
return this.builder;
}
private mapRoutesToFlatList(forRoutes: RouteInfo[][]): RouteInfo[] {
return forRoutes.reduce((a, b) => a.concat(b));
private getRoutesFlatList(
routes: Array<string | Type<any> | RouteInfo>,
): RouteInfo[] {
const { routesMapper } = this.builder;
return iterate(routes)
.map(route => routesMapper.mapRouteToRouteInfo(route))
.flatten()
.toArray();
}
};
}

View File

@@ -4,6 +4,7 @@ import { HttpServer, RouteInfo, Type } from '@nestjs/common/interfaces';
import { isFunction } from '@nestjs/common/utils/shared.utils';
import * as pathToRegexp from 'path-to-regexp';
import { v4 as uuid } from 'uuid';
import { iterate } from 'iterare';
type RouteInfoRegex = RouteInfo & { regex: RegExp };
@@ -16,10 +17,11 @@ export const filterMiddleware = <T extends Function | Type<any> = any>(
...route,
regex: pathToRegexp(route.path),
}));
return []
return iterate([])
.concat(middleware)
.filter(isFunction)
.map((item: T) => mapToClass(item, excluded, httpAdapter));
.map((item: T) => mapToClass(item, excluded, httpAdapter))
.toArray();
};
export const mapToClass = <T extends Function | Type<any>>(

View File

@@ -7,6 +7,7 @@ import {
import { Abstract } from '@nestjs/common/interfaces';
import { Type } from '@nestjs/common/interfaces/type.interface';
import { isEmpty } from '@nestjs/common/utils/shared.utils';
import { iterate } from 'iterare';
import { MESSAGES } from './constants';
import { UnknownElementException } from './errors/exceptions/unknown-element.exception';
import { UnknownModuleException } from './errors/exceptions/unknown-module.exception';
@@ -137,10 +138,11 @@ export class NestApplicationContext implements INestApplicationContext {
signals = Array.from(new Set(signals));
}
signals = signals
signals = iterate(signals)
.map((signal: string) => signal.toString().toUpperCase().trim())
// filter out the signals which is already listening to
.filter(signal => !this.activeShutdownSignals.includes(signal));
.filter(signal => !this.activeShutdownSignals.includes(signal))
.toArray();
this.listenToShutdownSignals(signals);
return this;
@@ -274,7 +276,9 @@ export class NestApplicationContext implements INestApplicationContext {
options?: { strict: boolean },
): Promise<TResult> {
let wrapper: InstanceWrapper, collection: Map<string, InstanceWrapper>;
if (!(options && options.strict)) {
const isStrictModeEnabled = options && options.strict;
if (!isStrictModeEnabled) {
[wrapper, collection] = this.containerScanner.getWrapperCollectionPair(
typeOrToken,
);
@@ -287,8 +291,13 @@ export class NestApplicationContext implements INestApplicationContext {
contextModule,
);
}
if (wrapper.isDependencyTreeStatic() && !wrapper.isTransient) {
return this.get(typeOrToken);
}
const ctorHost = wrapper.instance || { constructor: typeOrToken };
const instance = await this.injector.loadPerContext(
wrapper.instance,
ctorHost,
wrapper.host,
collection,
contextId,

View File

@@ -4,6 +4,7 @@ import {
HttpServer,
INestApplication,
INestMicroservice,
NestHybridApplicationOptions,
NestInterceptor,
PipeTransform,
WebSocketAdapter,
@@ -13,7 +14,7 @@ import { NestApplicationOptions } from '@nestjs/common/interfaces/nest-applicati
import { Logger } from '@nestjs/common/services/logger.service';
import { loadPackage } from '@nestjs/common/utils/load-package.util';
import { isObject, validatePath } from '@nestjs/common/utils/shared.utils';
import iterate from 'iterare';
import { iterate } from 'iterare';
import { platform } from 'os';
import { AbstractHttpAdapter } from './adapters';
import { ApplicationConfig } from './application-config';
@@ -170,17 +171,23 @@ export class NestApplication extends NestApplicationContext
this.routesResolver.registerExceptionHandler();
}
public connectMicroservice<T extends object>(options: T): INestMicroservice {
public connectMicroservice<T extends object>(
microserviceOptions: T,
hybridAppOptions: NestHybridApplicationOptions = {},
): INestMicroservice {
const { NestMicroservice } = loadPackage(
'@nestjs/microservices',
'NestFactory',
() => require('@nestjs/microservices'),
);
const { inheritAppConfig } = hybridAppOptions;
const applicationConfig = inheritAppConfig
? this.config
: new ApplicationConfig();
const applicationConfig = new ApplicationConfig();
const instance = new NestMicroservice(
this.container,
options,
microserviceOptions,
applicationConfig,
);
instance.registerListeners();

View File

@@ -190,7 +190,7 @@ export class NestFactoryStatic {
prop: string,
): Function {
return (...args: unknown[]) => {
let result;
let result: unknown;
ExceptionsZone.run(() => {
result = receiver[prop](...args);
});

View File

@@ -1,6 +1,6 @@
{
"name": "@nestjs/core",
"version": "7.0.5",
"version": "7.2.0",
"description": "Nest - modern, fast, powerful node.js web framework (@core)",
"author": "Kamil Mysliwiec",
"license": "MIT",
@@ -29,11 +29,14 @@
"dependencies": {
"@nuxtjs/opencollective": "0.2.2",
"fast-safe-stringify": "2.0.7",
"iterare": "1.2.0",
"iterare": "1.2.1",
"object-hash": "2.0.3",
"path-to-regexp": "3.2.0",
"tslib": "1.11.1",
"uuid": "7.0.2"
"tslib": "2.0.0",
"uuid": "8.1.0"
},
"devDependencies": {
"@nestjs/common": "7.2.0"
},
"peerDependencies": {
"@nestjs/common": "^7.0.0",

View File

@@ -1,7 +1,7 @@
import { PIPES_METADATA } from '@nestjs/common/constants';
import { Controller, PipeTransform } from '@nestjs/common/interfaces';
import { isEmpty, isFunction } from '@nestjs/common/utils/shared.utils';
import iterate from 'iterare';
import { iterate } from 'iterare';
import { ApplicationConfig } from '../application-config';
import { ContextCreator } from '../helpers/context-creator';
import { STATIC_CONTEXT } from '../injector/constants';
@@ -96,10 +96,11 @@ export class PipesContextCreator extends ContextCreator {
return globalPipes;
}
const scopedPipeWrappers = this.config.getGlobalRequestPipes() as InstanceWrapper[];
const scopedPipes = scopedPipeWrappers
const scopedPipes = iterate(scopedPipeWrappers)
.map(wrapper => wrapper.getInstanceByContextId(contextId, inquirerId))
.filter(host => host)
.map(host => host.instance);
.filter(host => !!host)
.map(host => host.instance)
.toArray();
return globalPipes.concat(scopedPipes) as T;
}

View File

@@ -9,6 +9,7 @@ import { STATIC_CONTEXT } from '../injector/constants';
import { NestContainer } from '../injector/container';
import { InstanceWrapper } from '../injector/instance-wrapper';
import { RouterProxyCallback } from './router-proxy';
import { iterate } from 'iterare';
export class RouterExceptionFilters extends BaseExceptionFilterContext {
constructor(
@@ -52,10 +53,11 @@ export class RouterExceptionFilters extends BaseExceptionFilterContext {
return globalFilters;
}
const scopedFilterWrappers = this.config.getGlobalRequestFilters() as InstanceWrapper[];
const scopedFilters = scopedFilterWrappers
const scopedFilters = iterate(scopedFilterWrappers)
.map(wrapper => wrapper.getInstanceByContextId(contextId, inquirerId))
.filter(host => host)
.map(host => host.instance);
.filter(host => !!host)
.map(host => host.instance)
.toArray();
return globalFilters.concat(scopedFilters) as T;
}

View File

@@ -33,6 +33,7 @@ import {
isNil,
isUndefined,
} from '@nestjs/common/utils/shared.utils';
import { iterate } from 'iterare';
import { ApplicationConfig } from './application-config';
import { APP_FILTER, APP_GUARD, APP_INTERCEPTOR, APP_PIPE } from './constants';
import { CircularDependencyException } from './errors/exceptions/circular-dependency.exception';
@@ -42,6 +43,8 @@ import { NestContainer } from './injector/container';
import { InstanceWrapper } from './injector/instance-wrapper';
import { Module } from './injector/module';
import { MetadataScanner } from './metadata-scanner';
import { InvalidModuleException } from './errors/exceptions/invalid-module.exception';
import { UndefinedModuleException } from './errors/exceptions/undefined-module.exception';
interface ApplicationProviderWrapper {
moduleKey: string;
@@ -89,7 +92,14 @@ export class DependenciesScanner {
...((module as DynamicModule).imports || []),
];
for (const innerModule of modules) {
for (const [index, innerModule] of modules.entries()) {
// In case of a circular dependency (ES module system), JavaScript will resolve the type to `undefined`.
if (innerModule === undefined) {
throw new UndefinedModuleException(module, index, scope);
}
if (!innerModule) {
throw new InvalidModuleException(module, index, scope);
}
if (ctxRegistry.includes(innerModule)) {
continue;
}
@@ -259,7 +269,7 @@ export class DependenciesScanner {
public async calculateModulesDistance(modules: ModulesContainer) {
const modulesGenerator = modules.values();
const rootModule = modulesGenerator.next().value;
const rootModule = modulesGenerator.next().value as Module;
const modulesStack = [rootModule];
const calculateDistance = (moduleRef: Module, distance = 1) => {
@@ -378,24 +388,20 @@ export class DependenciesScanner {
* to all controllers metadata storage
*/
public addScopedEnhancersMetadata() {
const scopedGlobalProviders = this.applicationProvidersApplyMap.filter(
wrapper => this.isRequestOrTransient(wrapper.scope),
);
iterate(this.applicationProvidersApplyMap)
.filter(wrapper => this.isRequestOrTransient(wrapper.scope))
.forEach(({ moduleKey, providerKey }) => {
const modulesContainer = this.container.getModules();
const { injectables } = modulesContainer.get(moduleKey);
const instanceWrapper = injectables.get(providerKey);
scopedGlobalProviders.forEach(({ moduleKey, providerKey }) => {
const modulesContainer = this.container.getModules();
const { injectables } = modulesContainer.get(moduleKey);
const instanceWrapper = injectables.get(providerKey);
const modules = [...modulesContainer.values()];
const controllersArray = modules.map(module => [
...module.controllers.values(),
]);
const controllers = this.flatten(controllersArray);
controllers.forEach(controller =>
controller.addEnhancerMetadata(instanceWrapper),
);
});
iterate(modulesContainer.values())
.map(module => module.controllers.values())
.flatten()
.forEach(controller =>
controller.addEnhancerMetadata(instanceWrapper),
);
});
}
public applyApplicationProviders() {

View File

@@ -1,5 +1,5 @@
import { Type } from '@nestjs/common';
import { isObject } from '@nestjs/common/utils/shared.utils';
import { isEmpty, isObject } from '@nestjs/common/utils/shared.utils';
/**
* Helper class providing Nest reflection capabilities.
@@ -53,7 +53,14 @@ export class Reflector {
metadataKey: TKey,
targets: (Type<any> | Function)[],
): TResult {
const metadataCollection = this.getAll(metadataKey, targets);
const metadataCollection = this.getAll<TResult, TKey>(
metadataKey,
targets,
).filter(item => item !== undefined);
if (isEmpty(metadataCollection)) {
return metadataCollection as TResult;
}
return metadataCollection.reduce((a, b) => {
if (Array.isArray(a)) {
return a.concat(b);

View File

@@ -2,161 +2,204 @@ import { expect } from 'chai';
import { UnknownDependenciesException } from '../../../errors/exceptions/unknown-dependencies.exception';
import { Module } from '../../../injector/module';
import { stringCleaner } from '../../utils/string.cleaner';
import {
UNDEFINED_MODULE_MESSAGE,
INVALID_MODULE_MESSAGE,
} from '../../../errors/messages';
describe('UnknownDependenciesMessage', () => {
const index = 0;
it('should display class', () => {
const expectedResult = stringCleaner(`Nest can't resolve dependencies of the CatService (?, CatService). Please make sure that the argument dependency at index [0] is available in the current context.
describe('Error Messages', () => {
const CatsModule = { name: 'CatsModule' };
const AppModule = { name: 'AppModule' };
Potential solutions:
- If dependency is a provider, is it part of the current current?
- If dependency is exported from a separate @Module, is that module imported within current?
@Module({
describe('UNKNOWN_DEPENDENCIES_MESSAGE', () => {
const index = 0;
it('should display class', () => {
const expectedResult = stringCleaner(`Nest can't resolve dependencies of the CatService (?, CatService). Please make sure that the argument dependency at index [0] is available in the current context.
Potential solutions:
- If dependency is a provider, is it part of the current current?
- If dependency is exported from a separate @Module, is that module imported within current?
@Module({
imports: [ /* the Module containing dependency */ ]
})
`);
class CatService {}
const actualMessage = stringCleaner(
new UnknownDependenciesException('CatService', {
index,
dependencies: ['', CatService],
}).message,
);
expect(actualMessage).to.equal(expectedResult);
});
it('should display the provide token', () => {
const expectedResult = stringCleaner(`Nest can't resolve dependencies of the CatService (?, MY_TOKEN). Please make sure that the argument dependency at index [0] is available in the current context.
Potential solutions:
- If dependency is a provider, is it part of the current current?
- If dependency is exported from a separate @Module, is that module imported within current?
@Module({
imports: [ /* the Module containing dependency */ ]
})
`);
})
`);
class CatService {}
const actualMessage = stringCleaner(
new UnknownDependenciesException('CatService', {
index,
dependencies: ['', 'MY_TOKEN'],
}).message,
);
const actualMessage = stringCleaner(
new UnknownDependenciesException('CatService', {
index,
dependencies: ['', CatService],
}).message,
);
expect(actualMessage).to.equal(expectedResult);
});
it('should display the provide token', () => {
const expectedResult = stringCleaner(`Nest can't resolve dependencies of the CatService (?, MY_TOKEN). Please make sure that the argument dependency at index [0] is available in the current context.
Potential solutions:
- If dependency is a provider, is it part of the current current?
- If dependency is exported from a separate @Module, is that module imported within current?
@Module({
imports: [ /* the Module containing dependency */ ]
})
`);
const actualMessage = stringCleaner(
new UnknownDependenciesException('CatService', {
index,
dependencies: ['', 'MY_TOKEN'],
}).message,
);
expect(actualMessage).to.equal(expectedResult);
});
it('should display the function name', () => {
const expectedResult = stringCleaner(`Nest can't resolve dependencies of the CatService (?, CatFunction). Please make sure that the argument dependency at index [0] is available in the current context.
Potential solutions:
- If dependency is a provider, is it part of the current current?
- If dependency is exported from a separate @Module, is that module imported within current?
@Module({
imports: [ /* the Module containing dependency */ ]
})
`);
function CatFunction() {}
const actualMessage = stringCleaner(
new UnknownDependenciesException('CatService', {
index,
dependencies: ['', CatFunction],
}).message,
);
expect(actualMessage).to.equal(expectedResult);
});
it('should use "+" if unknown dependency name', () => {
const expectedResult = stringCleaner(`Nest can't resolve dependencies of the CatService (?, +). Please make sure that the argument dependency at index [0] is available in the current context.
Potential solutions:
- If dependency is a provider, is it part of the current current?
- If dependency is exported from a separate @Module, is that module imported within current?
expect(actualMessage).to.equal(expectedResult);
});
it('should display the function name', () => {
const expectedResult = stringCleaner(`Nest can't resolve dependencies of the CatService (?, CatFunction). Please make sure that the argument dependency at index [0] is available in the current context.
Potential solutions:
- If dependency is a provider, is it part of the current current?
- If dependency is exported from a separate @Module, is that module imported within current?
@Module({
imports: [ /* the Module containing dependency */ ]
})
`);
`);
const actualMessage = stringCleaner(
new UnknownDependenciesException('CatService', {
index,
dependencies: ['', undefined],
}).message,
);
function CatFunction() {}
const actualMessage = stringCleaner(
new UnknownDependenciesException('CatService', {
index,
dependencies: ['', CatFunction],
}).message,
);
expect(actualMessage).to.equal(expectedResult);
});
it('should use "+" if unknown dependency name', () => {
const expectedResult = stringCleaner(`Nest can't resolve dependencies of the CatService (?, +). Please make sure that the argument dependency at index [0] is available in the current context.
Potential solutions:
- If dependency is a provider, is it part of the current current?
- If dependency is exported from a separate @Module, is that module imported within current?
@Module({
imports: [ /* the Module containing dependency */ ]
})
`);
expect(actualMessage).to.equal(expectedResult);
const actualMessage = stringCleaner(
new UnknownDependenciesException('CatService', {
index,
dependencies: ['', undefined],
}).message,
);
expect(actualMessage).to.equal(expectedResult);
});
it('should display the module name', () => {
const expectedResult = stringCleaner(`Nest can't resolve dependencies of the CatService (?, MY_TOKEN). Please make sure that the argument dependency at index [0] is available in the TestModule context.
Potential solutions:
- If dependency is a provider, is it part of the current TestModule?
- If dependency is exported from a separate @Module, is that module imported within TestModule?
@Module({
imports: [ /* the Module containing dependency */ ]
})
`);
class MetaType {
name: string;
}
class TestModule {
metatype: MetaType;
}
const myModule = new TestModule();
const myMetaType = new MetaType();
myMetaType.name = 'TestModule';
myModule.metatype = myMetaType;
const actualMessage = stringCleaner(
new UnknownDependenciesException(
'CatService',
{ index, dependencies: ['', 'MY_TOKEN'] },
myModule as Module,
).message,
);
expect(actualMessage).to.equal(expectedResult);
});
it('should display the symbol name of the provider', () => {
const expectedResult = stringCleaner(`Nest can't resolve dependencies of the Symbol(CatProvider) (?). Please make sure that the argument dependency at index [0] is available in the current context.
Potential solutions:
- If dependency is a provider, is it part of the current current?
- If dependency is exported from a separate @Module, is that module imported within current?
@Module({
imports: [ /* the Module containing dependency */ ]
})
`);
const actualMessage = stringCleaner(
new UnknownDependenciesException(Symbol('CatProvider'), {
index,
dependencies: [''],
}).message,
);
expect(actualMessage).to.equal(expectedResult);
});
it('should display the symbol dependency of the provider', () => {
const expectedResult = stringCleaner(`Nest can't resolve dependencies of the CatProvider (?, Symbol(DogProvider)). Please make sure that the argument dependency at index [0] is available in the current context.
Potential solutions:
- If dependency is a provider, is it part of the current current?
- If dependency is exported from a separate @Module, is that module imported within current?
@Module({
imports: [ /* the Module containing dependency */ ]
})
`);
const actualMessage = stringCleaner(
new UnknownDependenciesException('CatProvider', {
index,
dependencies: ['', Symbol('DogProvider')],
}).message,
);
expect(actualMessage).to.equal(expectedResult);
});
});
it('should display the module name', () => {
const expectedResult = stringCleaner(`Nest can't resolve dependencies of the CatService (?, MY_TOKEN). Please make sure that the argument dependency at index [0] is available in the TestModule context.
Potential solutions:
- If dependency is a provider, is it part of the current TestModule?
- If dependency is exported from a separate @Module, is that module imported within TestModule?
@Module({
imports: [ /* the Module containing dependency */ ]
})
`);
describe('UNDEFINED_MODULE_EXCEPTION', () => {
it('should display the module name with the undefined index and scope', () => {
const expectedMessage = stringCleaner(`Nest cannot create the CatsModule instance.
The module at index [0] of the CatsModule "imports" array is undefined.
class MetaType {
name: string;
}
class TestModule {
metatype: MetaType;
}
const myModule = new TestModule();
const myMetaType = new MetaType();
myMetaType.name = 'TestModule';
myModule.metatype = myMetaType;
Potential causes:
- A circular dependency between modules. Use forwardRef() to avoid it. Read more: https://docs.nestjs.com/fundamentals/circular-dependency
- The module at index [0] is of type "undefined". Check your import statements and the type of the module.
const actualMessage = stringCleaner(
new UnknownDependenciesException(
'CatService',
{ index, dependencies: ['', 'MY_TOKEN'] },
myModule as Module,
).message,
);
Scope [AppModule -> CatsModule]`);
expect(actualMessage).to.equal(expectedResult);
const actualMessage = stringCleaner(
UNDEFINED_MODULE_MESSAGE(CatsModule, 0, [AppModule, CatsModule]),
);
expect(actualMessage).to.be.eq(expectedMessage);
});
});
it('should display the symbol name of the provider', () => {
const expectedResult = stringCleaner(`Nest can't resolve dependencies of the Symbol(CatProvider) (?). Please make sure that the argument dependency at index [0] is available in the current context.
Potential solutions:
- If dependency is a provider, is it part of the current current?
- If dependency is exported from a separate @Module, is that module imported within current?
@Module({
imports: [ /* the Module containing dependency */ ]
})
`);
describe('INVALID_MODULE_MESSAGE', () => {
it('should display the module name with the invalid index and scope', () => {
const expectedMessage = stringCleaner(`Nest cannot create the CatsModule instance.
Received an unexpected value at index [0] of the CatsModule "imports" array.
const actualMessage = stringCleaner(
new UnknownDependenciesException(Symbol('CatProvider'), {
index,
dependencies: [''],
}).message,
);
Scope [AppModule -> CatsModule]`);
expect(actualMessage).to.equal(expectedResult);
});
it('should display the symbol dependency of the provider', () => {
const expectedResult = stringCleaner(`Nest can't resolve dependencies of the CatProvider (?, Symbol(DogProvider)). Please make sure that the argument dependency at index [0] is available in the current context.
const actualMessage = stringCleaner(
INVALID_MODULE_MESSAGE(CatsModule, 0, [AppModule, CatsModule]),
);
Potential solutions:
- If dependency is a provider, is it part of the current current?
- If dependency is exported from a separate @Module, is that module imported within current?
@Module({
imports: [ /* the Module containing dependency */ ]
})
`);
const actualMessage = stringCleaner(
new UnknownDependenciesException('CatProvider', {
index,
dependencies: ['', Symbol('DogProvider')],
}).message,
);
expect(actualMessage).to.equal(expectedResult);
expect(actualMessage).to.be.eq(expectedMessage);
});
});
});

View File

@@ -0,0 +1,49 @@
import { BeforeApplicationShutdown } from '@nestjs/common';
import { expect } from 'chai';
import * as sinon from 'sinon';
import { callBeforeAppShutdownHook } from '../../hooks/before-app-shutdown.hook';
import { NestContainer } from '../../injector/container';
import { Module } from '../../injector/module';
class SampleProvider implements BeforeApplicationShutdown {
beforeApplicationShutdown(signal?: string) {}
}
class SampleModule implements BeforeApplicationShutdown {
beforeApplicationShutdown(signal?: string) {}
}
class WithoutHookProvider {}
describe('BeforeAppShutdown', () => {
let moduleRef: Module;
let sampleProvider: SampleProvider;
beforeEach(() => {
sampleProvider = new SampleProvider();
moduleRef = new Module(SampleModule, new NestContainer());
const moduleWrapperRef = moduleRef.getProviderByKey(SampleModule.name);
moduleWrapperRef.instance = new SampleModule();
moduleRef.addProvider({
provide: SampleProvider,
useValue: sampleProvider,
});
moduleRef.addProvider({
provide: WithoutHookProvider,
useValue: new WithoutHookProvider(),
});
});
describe('callBeforeAppShutdownHook', () => {
it('should call "beforeApplicationShutdown" hook for the entire module', async () => {
const signal = 'SIGTERM';
const hookSpy = sinon.spy(sampleProvider, 'beforeApplicationShutdown');
await callBeforeAppShutdownHook(moduleRef, signal);
expect(hookSpy.calledWith(signal)).to.be.true;
});
});
});

View File

@@ -0,0 +1,47 @@
import { OnApplicationBootstrap } from '@nestjs/common';
import { expect } from 'chai';
import * as sinon from 'sinon';
import { callModuleBootstrapHook } from '../../hooks/on-app-bootstrap.hook';
import { NestContainer } from '../../injector/container';
import { Module } from '../../injector/module';
class SampleProvider implements OnApplicationBootstrap {
onApplicationBootstrap() {}
}
class SampleModule implements OnApplicationBootstrap {
onApplicationBootstrap() {}
}
class WithoutHookProvider {}
describe('OnApplicationBootstrap', () => {
let moduleRef: Module;
let sampleProvider: SampleProvider;
beforeEach(() => {
sampleProvider = new SampleProvider();
moduleRef = new Module(SampleModule, new NestContainer());
const moduleWrapperRef = moduleRef.getProviderByKey(SampleModule.name);
moduleWrapperRef.instance = new SampleModule();
moduleRef.addProvider({
provide: SampleProvider,
useValue: sampleProvider,
});
moduleRef.addProvider({
provide: WithoutHookProvider,
useValue: new WithoutHookProvider(),
});
});
describe('callModuleBootstrapHook', () => {
it('should call "onApplicationBootstrap" hook for the entire module', async () => {
const hookSpy = sinon.spy(sampleProvider, 'onApplicationBootstrap');
await callModuleBootstrapHook(moduleRef);
expect(hookSpy.called).to.be.true;
});
});
});

View File

@@ -0,0 +1,47 @@
import { OnApplicationShutdown } from '@nestjs/common';
import { expect } from 'chai';
import * as sinon from 'sinon';
import { callAppShutdownHook } from '../../hooks/on-app-shutdown.hook';
import { NestContainer } from '../../injector/container';
import { Module } from '../../injector/module';
class SampleProvider implements OnApplicationShutdown {
onApplicationShutdown() {}
}
class SampleModule implements OnApplicationShutdown {
onApplicationShutdown() {}
}
class WithoutHookProvider {}
describe('OnApplicationShutdown', () => {
let moduleRef: Module;
let sampleProvider: SampleProvider;
beforeEach(() => {
sampleProvider = new SampleProvider();
moduleRef = new Module(SampleModule, new NestContainer());
const moduleWrapperRef = moduleRef.getProviderByKey(SampleModule.name);
moduleWrapperRef.instance = new SampleModule();
moduleRef.addProvider({
provide: SampleProvider,
useValue: sampleProvider,
});
moduleRef.addProvider({
provide: WithoutHookProvider,
useValue: new WithoutHookProvider(),
});
});
describe('callAppShutdownHook', () => {
it('should call "onApplicationShutdown" hook for the entire module', async () => {
const hookSpy = sinon.spy(sampleProvider, 'onApplicationShutdown');
await callAppShutdownHook(moduleRef);
expect(hookSpy.called).to.be.true;
});
});
});

View File

@@ -0,0 +1,47 @@
import { OnModuleDestroy } from '@nestjs/common';
import { expect } from 'chai';
import * as sinon from 'sinon';
import { callModuleDestroyHook } from '../../hooks/on-module-destroy.hook';
import { NestContainer } from '../../injector/container';
import { Module } from '../../injector/module';
class SampleProvider implements OnModuleDestroy {
onModuleDestroy() {}
}
class SampleModule implements OnModuleDestroy {
onModuleDestroy() {}
}
class WithoutHookProvider {}
describe('OnModuleDestroy', () => {
let moduleRef: Module;
let sampleProvider: SampleProvider;
beforeEach(() => {
sampleProvider = new SampleProvider();
moduleRef = new Module(SampleModule, new NestContainer());
const moduleWrapperRef = moduleRef.getProviderByKey(SampleModule.name);
moduleWrapperRef.instance = new SampleModule();
moduleRef.addProvider({
provide: SampleProvider,
useValue: sampleProvider,
});
moduleRef.addProvider({
provide: WithoutHookProvider,
useValue: new WithoutHookProvider(),
});
});
describe('callModuleDestroyHook', () => {
it('should call "onModuleDestroy" hook for the entire module', async () => {
const hookSpy = sinon.spy(sampleProvider, 'onModuleDestroy');
await callModuleDestroyHook(moduleRef);
expect(hookSpy.called).to.be.true;
});
});
});

View File

@@ -0,0 +1,47 @@
import { OnModuleInit } from '@nestjs/common';
import { expect } from 'chai';
import * as sinon from 'sinon';
import { callModuleInitHook } from '../../hooks/on-module-init.hook';
import { NestContainer } from '../../injector/container';
import { Module } from '../../injector/module';
class SampleProvider implements OnModuleInit {
onModuleInit() {}
}
class SampleModule implements OnModuleInit {
onModuleInit() {}
}
class WithoutHookProvider {}
describe('OnModuleInit', () => {
let moduleRef: Module;
let sampleProvider: SampleProvider;
beforeEach(() => {
sampleProvider = new SampleProvider();
moduleRef = new Module(SampleModule, new NestContainer());
const moduleWrapperRef = moduleRef.getProviderByKey(SampleModule.name);
moduleWrapperRef.instance = new SampleModule();
moduleRef.addProvider({
provide: SampleProvider,
useValue: sampleProvider,
});
moduleRef.addProvider({
provide: WithoutHookProvider,
useValue: new WithoutHookProvider(),
});
});
describe('callModuleInitHook', () => {
it('should call "onModuleInit" hook for the entire module', async () => {
const hookSpy = sinon.spy(sampleProvider, 'onModuleInit');
await callModuleInitHook(moduleRef);
expect(hookSpy.called).to.be.true;
});
});
});

View File

@@ -36,7 +36,7 @@ describe('Injector', () => {
let mainTest, depOne, depTwo;
beforeEach(() => {
moduleDeps = new Module(DependencyTwo as any, [], new NestContainer());
moduleDeps = new Module(DependencyTwo, new NestContainer());
mainTest = new InstanceWrapper({
name: 'MainTest',
metatype: MainTest,
@@ -133,7 +133,7 @@ describe('Injector', () => {
let test;
beforeEach(() => {
moduleDeps = new Module(Test as any, [], new NestContainer());
moduleDeps = new Module(Test, new NestContainer());
test = new InstanceWrapper({
name: 'Test',
metatype: Test,
@@ -712,12 +712,12 @@ describe('Injector', () => {
const wrapper = new InstanceWrapper();
wrapper.addEnhancerMetadata(
new InstanceWrapper({
host: new Module(class {}, [], new NestContainer()),
host: new Module(class {}, new NestContainer()),
}),
);
wrapper.addEnhancerMetadata(
new InstanceWrapper({
host: new Module(class {}, [], new NestContainer()),
host: new Module(class {}, new NestContainer()),
}),
);

View File

@@ -22,7 +22,7 @@ describe('Module', () => {
beforeEach(() => {
container = new NestContainer();
module = new Module(TestModule as any, [], container);
module = new Module(TestModule, container);
});
it('should add controller', () => {
@@ -418,7 +418,7 @@ describe('Module', () => {
it('should behave as identity', () => {
const metatype = { name: token };
(module as any)._imports = new Set([
new Module(metatype as any, [], new NestContainer()),
new Module(metatype as any, new NestContainer()),
]);
expect(module.validateExportedProvider(token)).to.be.eql(token);
});

View File

@@ -33,8 +33,8 @@ describe('MiddlewareContainer', () => {
const nestContainer = new NestContainer();
const modules = nestContainer.getModules();
modules.set('Module', new Module(ExampleModule, [], nestContainer));
modules.set('Test', new Module(ExampleModule, [], nestContainer));
modules.set('Module', new Module(ExampleModule, nestContainer));
modules.set('Test', new Module(ExampleModule, nestContainer));
container = new MiddlewareContainer(nestContainer);
});

View File

@@ -58,7 +58,7 @@ describe('MiddlewareModule', () => {
const stubContainer = new NestContainer();
stubContainer
.getModules()
.set('Test', new Module(class {}, [], stubContainer));
.set('Test', new Module(class {}, stubContainer));
await middlewareModule.loadConfiguration(
new MiddlewareContainer(stubContainer),
@@ -87,7 +87,7 @@ describe('MiddlewareModule', () => {
nestContainer = new NestContainer();
nestContainer
.getModules()
.set('Test', new Module(TestModule, [], nestContainer));
.set('Test', new Module(TestModule, nestContainer));
});
it('should throw "RuntimeException" exception when middleware is not stored in container', () => {
const route = { path: 'Test' };
@@ -162,7 +162,7 @@ describe('MiddlewareModule', () => {
const stubContainer = new NestContainer();
stubContainer
.getModules()
.set('Test', new Module(TestModule, [], stubContainer));
.set('Test', new Module(TestModule, stubContainer));
const container = new MiddlewareContainer(stubContainer);
const moduleKey = 'Test';
@@ -178,7 +178,7 @@ describe('MiddlewareModule', () => {
);
sinon
.stub(stubContainer, 'getModuleByKey')
.callsFake(() => new Module(class {}, [], stubContainer));
.callsFake(() => new Module(class {}, stubContainer));
middlewareModule['container'] = stubContainer;
await middlewareModule.registerRouteMiddleware(

View File

@@ -0,0 +1,54 @@
import { expect } from 'chai';
import { NestApplication } from '../nest-application';
import { ApplicationConfig } from '../application-config';
import { NestContainer } from '../injector';
import { NoopHttpAdapter } from './utils/noop-adapter.spec';
describe('NestApplication', () => {
describe('Hybrid Application', () => {
class Interceptor {
public intercept(context, next) {
return next();
}
}
it('default should use new ApplicationConfig', () => {
const applicationConfig = new ApplicationConfig();
const container = new NestContainer(applicationConfig);
const instance = new NestApplication(
container,
new NoopHttpAdapter({}),
applicationConfig,
{},
);
instance.useGlobalInterceptors(new Interceptor());
const microservice = instance.connectMicroservice({});
expect((instance as any).config.getGlobalInterceptors().length).to.equal(
1,
);
expect(
(microservice as any).applicationConfig.getGlobalInterceptors().length,
).to.equal(0);
});
it('should inherit existing ApplicationConfig', () => {
const applicationConfig = new ApplicationConfig();
const container = new NestContainer(applicationConfig);
const instance = new NestApplication(
container,
new NoopHttpAdapter({}),
applicationConfig,
{},
);
instance.useGlobalInterceptors(new Interceptor());
const microservice = instance.connectMicroservice(
{},
{ inheritAppConfig: true },
);
expect((instance as any).config.getGlobalInterceptors().length).to.equal(
1,
);
expect(
(microservice as any).applicationConfig.getGlobalInterceptors().length,
).to.equal(1);
});
});
});

View File

@@ -12,6 +12,8 @@ import { NestContainer } from '../injector/container';
import { InstanceWrapper } from '../injector/instance-wrapper';
import { MetadataScanner } from '../metadata-scanner';
import { DependenciesScanner } from '../scanner';
import { UndefinedModuleException } from '../errors/exceptions/undefined-module.exception';
import { InvalidModuleException } from '../errors/exceptions/invalid-module.exception';
describe('DependenciesScanner', () => {
class Guard {}
@@ -36,6 +38,16 @@ describe('DependenciesScanner', () => {
})
class TestModule {}
@Module({
imports: [undefined],
})
class UndefinedModule {}
@Module({
imports: [null],
})
class InvalidModule {}
let scanner: DependenciesScanner;
let mockContainer: sinon.SinonMock;
let container: NestContainer;
@@ -432,4 +444,20 @@ describe('DependenciesScanner', () => {
});
});
});
describe('scanForModules', () => {
it('should throw an exception when the imports array includes undefined', () => {
try {
scanner.scanForModules(UndefinedModule, [UndefinedModule]);
} catch (exception) {
expect(exception instanceof UndefinedModuleException).to.be.true;
}
});
it('should throw an exception when the imports array includes an invalid value', () => {
try {
scanner.scanForModules(InvalidModule, [InvalidModule]);
} catch (exception) {
expect(exception instanceof InvalidModuleException).to.be.true;
}
});
});
});

View File

@@ -38,6 +38,14 @@ Nest is a framework for building efficient, scalable <a href="http://nodejs.org"
* 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:
## Questions
For questions and support please use the official [Discord channel](https://discord.gg/G7Qnnhy). The issue list of this repo is **exclusively** for bug reports and feature requests.
## Issues
Please make sure to read the [Issue Reporting Checklist](https://github.com/nestjs/nest/blob/master/CONTRIBUTING.md#-submitting-an-issue) before opening an issue. Issues not conforming to the guidelines may be closed immediately.
## Consulting
With official support, you can get expert help straight from Nest core team. We provide dedicated technical support, migration strategies, advice on best practices (and design decisions), PR reviews, and team augmentation. Read more about [support here](https://enterprise.nestjs.com).
@@ -48,30 +56,35 @@ Nest is an MIT-licensed open source project. It can grow thanks to the sponsors
#### Principal Sponsor
<a href="https://valor-software.com/" target="_blank"><img src="https://docs.nestjs.com/assets/sponsors/valor-software.png" width="320" /></a>
<a href="https://valor-software.com/" target="_blank"><img src="https://docs.nestjs.com/assets/sponsors/valor-software.png" width="220" /></a>
#### Silver Sponsors
<a href="https://neoteric.eu/" target="_blank"><img src="https://nestjs.com/img/neoteric-cut.png" width="120" valign="middle" /></a> &nbsp;
<a href="http://gojob.com" target="_blank"><img src="http://nestjs.com/img/gojob-logo.png" valign="middle" height="95" /></a> &nbsp;
<a href="https://trilon.io" target="_blank"><img src="https://nestjs.com/img/trilon.svg" width="150" valign="middle" /></a> &nbsp;
<a href="http://www.leogistics.com" target="_blank"><img src="https://nestjs.com/img/leogistics-logo.jpeg" width="150" valign="middle" /></a>
<table style="text-align:center;"><tr><td>
<a href="https://neoteric.eu/" target="_blank"><img src="https://nestjs.com/img/neoteric-cut.png" width="120" valign="middle" /></a> </td><td>
<a href="http://gojob.com" target="_blank"><img src="http://nestjs.com/img/gojob-logo.png" valign="middle" width="100" /></a> </td><td>
<a href="https://trilon.io" target="_blank"><img src="https://nestjs.com/img/trilon.svg" width="170" valign="middle" /></a> </td><td>
<a href="http://www.leogistics.com" target="_blank"><img src="https://nestjs.com/img/leogistics-logo.jpeg" width="150" valign="middle" /></td></tr></table>
#### Sponsors
<a href="https://www.swingdev.io" target="_blank"><img src="https://nestjs.com/img/swingdev-logo.svg#1" width="110" valign="middle" /> </a> &nbsp; <a href="https://blueanchor.io/" target="_blank"><img src="https://nestjs.com/img/blueanchor.png" width="150" valign="middle" /></a> &nbsp;
<a href="https://www.novologic.com/" target="_blank"><img src="https://nestjs.com/img/novologic.png" width="110" valign="middle" /></a> &nbsp; <a href="https://hostpresto.com" target="_blank"><img src="https://nestjs.com/img/hostpresto.png" height="24" valign="middle" /></a>
<a href="https://ever.co/" target="_blank"><img src="https://nestjs.com/img/ever-logo.png" height="14" valign="middle" /></a> &nbsp;
<a href="https://buddy.works/" target="_blank"><img src="https://nestjs.com/img/buddy-logo.svg" height="25" valign="middle" /></a> &nbsp;
<a href="https://blokt.com" target="_blank"><img src="https://nestjs.com/img/blokt-logo.png" height="25" valign="middle" /></a> &nbsp; <a href="https://genuinebee.com/" target="_blank"><img src="https://nestjs.com/img/genuinebee.svg" height="27" valign="middle" /></a> &nbsp; <a href="http://architectnow.net/" target="_blank"><img src="https://nestjs.com/img/architectnow.png" height="20" valign="middle" /></a> &nbsp; <a href="https://quander.io/" target="_blank"><img src="https://nestjs.com/img/quander.png" height="22" valign="middle" /></a> &nbsp; <a href="https://mantro.net/" target="_blank"><img src="https://nestjs.com/img/mantro-logo.svg" height="19" valign="middle" /></a> &nbsp; <a href="https://triplebyte.com/" target="_blank"><img src="https://nestjs.com/img/triplebyte.png" height="20" valign="middle" /></a> &nbsp;
<a href="https://reposit.co.uk/" target="_blank"><img src="https://nestjs.com/img/reposit-logo.png" height="18" valign="middle" /></a> &nbsp; &nbsp;
<a href="https://nearpod.com/" target="_blank"><img src="https://nestjs.com/img/nearpod-logo.svg" width="100" valign="middle" /></a> &nbsp;
<a href="https://clay.global/" target="_blank"><img src="https://nestjs.com/img/clay-logo.svg" width="75" valign="middle" /></a> &nbsp;
<a href="https://firesticktricks.com" target="_blank"><img src="https://nestjs.com/img/firesticktricks-logo.png" width="120" valign="middle" /></a> &nbsp;
<a href="https://www.codeguesser.co.uk" target="_blank"><img src="https://nestjs.com/img/codeguesser-logo.svg" width="120" valign="middle" /></a> &nbsp;
<a href="https://tekhattan.com" target="_blank"><img src="https://nestjs.com/img/tekhattan-logo.png" width="110" valign="middle" /></a> &nbsp;
<a href="https://f-a.nz/" target="_blank"><img src="https://nestjs.com/img/franz.svg" width="80" valign="middle" /></a> &nbsp;
<a href="https://sparkfabrik.com/" target="_blank"><img src="https://nestjs.com/img/sparkfabrik-logo.png" width="120" valign="middle" /></a>
<table><tr><td align="center" valign="middle">
<a href="https://www.swingdev.io" target="_blank"><img src="https://nestjs.com/img/swingdev-logo.svg#1" width="110" valign="middle" /> </a></td><td align="center" valign="middle">
<a href="https://www.novologic.com/" target="_blank"><img src="https://nestjs.com/img/novologic.png" width="110" valign="middle" /></a> </td><td align="center" valign="middle">
<a href="https://ever.co/" target="_blank"><img src="https://nestjs.com/img/ever-logo.png" width="72" valign="middle" /></a> </td><td align="center" valign="middle">
<a href="https://blokt.com" target="_blank"><img src="https://nestjs.com/img/blokt-logo.png" width="120" valign="middle" /></a> </td><td align="center" valign="middle">
<a href="http://architectnow.net/" target="_blank"><img src="https://nestjs.com/img/architectnow.png" width="125" valign="middle" /></a> </td><td align="center" valign="middle">
<a href="https://quander.io/" target="_blank"><img src="https://nestjs.com/img/quander.png" width="100" valign="middle" /></a> </td></tr><tr><td align="center" valign="middle">
<a href="https://mantro.net/" target="_blank"><img src="https://nestjs.com/img/mantro-logo.svg" width="95" valign="middle" /></a> </td><td align="center" valign="middle">
<a href="https://triplebyte.com/" target="_blank"><img src="https://nestjs.com/img/triplebyte.png" width="107" valign="middle" /></a> </td><td align="center" valign="middle">
<a href="https://reposit.co.uk/" target="_blank"><img src="https://nestjs.com/img/reposit-logo.png" width="71" valign="middle" /></a></td><td align="center" valign="middle">
<a href="https://nearpod.com/" target="_blank"><img src="https://nestjs.com/img/nearpod-logo.svg" width="100" valign="middle" /></a> </td><td align="center" valign="middle">
<a href="https://clay.global/" target="_blank"><img src="https://nestjs.com/img/clay-logo.svg" width="75" valign="middle" /></a> </td><td align="center" valign="middle">
<a href="https://firesticktricks.com" target="_blank"><img src="https://nestjs.com/img/firesticktricks-logo.png" width="120" valign="middle" /></a></td></tr><tr><td align="center" valign="middle">
<a href="https://www.codeguesser.co.uk" target="_blank"><img src="https://nestjs.com/img/codeguesser-logo.svg" width="120" valign="middle" /></a> </td><td align="center" valign="middle">
<a href="https://tekhattan.com" target="_blank"><img src="https://nestjs.com/img/tekhattan-logo.png" width="110" valign="middle" /></a> </td><td align="center" valign="middle">
<a href="https://f-a.nz/" target="_blank"><img src="https://nestjs.com/img/franz.svg" width="80" valign="middle" /></a> </td><td align="center" valign="middle">
<a href="https://sparkfabrik.com/" target="_blank"><img src="https://nestjs.com/img/sparkfabrik-logo.png" width="120" valign="middle" /></a></td><td align="center" valign="middle"><a href="https://www.thebigphonestore.co.uk/" target="_blank"><img src="https://nestjs.com/img/the-big-phone-store-logo.png" width="65" valign="middle" /></a></td></tr></table>
## Backers

View File

@@ -64,6 +64,7 @@ export class ClientGrpcProxy extends ClientProxy implements ClientGrpc {
if (!clientRef) {
throw new InvalidGrpcServiceException();
}
const maxSendMessageLengthKey = 'grpc.max_send_message_length';
const maxReceiveMessageLengthKey = 'grpc.max_receive_message_length';
const maxMessageLengthOptions = {
@@ -78,24 +79,24 @@ export class ClientGrpcProxy extends ClientProxy implements ClientGrpc {
GRPC_DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH,
),
};
const maxMetadataSize = this.getOptionsProp(
this.options,
'maxMetadataSize',
-1,
);
if (maxMetadataSize > 0) {
maxMessageLengthOptions['grpc.max_metadata_size'] = maxMetadataSize;
}
const keepaliveOptions = this.getKeepaliveOptions();
const options: Record<string, unknown> = isObject(this.options)
? {
...this.options,
...maxMessageLengthOptions,
...keepaliveOptions,
loader: '',
}
: {
...maxMessageLengthOptions,
};
const options: Record<string, string | number> = {
...(this.options.channelOptions || {}),
...maxMessageLengthOptions,
...keepaliveOptions,
};
const credentials =
options.credentials || grpcPackage.credentials.createInsecure();
delete options.credentials;
delete options.keepalive;
this.options.credentials || grpcPackage.credentials.createInsecure();
const grpcClient = new clientRef[name](this.url, credentials, options);
this.clients.set(name, grpcClient);
@@ -125,7 +126,7 @@ export class ClientGrpcProxy extends ClientProxy implements ClientGrpc {
this.options.keepalive,
)) {
const key = keepaliveKeys[optionKey];
if (!key) {
if (key === undefined) {
continue;
}
keepaliveOptions[key] = optionValue;

View File

@@ -93,11 +93,18 @@ export class ClientKafka extends ClientProxy {
return this.producer;
}
this.client = this.createClient();
const partitionAssigners = [
(
config: ConstructorParameters<
typeof KafkaRoundRobinPartitionAssigner
>[0],
) => new KafkaRoundRobinPartitionAssigner(config),
] as any[];
const consumerOptions = Object.assign(
{
partitionAssigners: [
(config: any) => new KafkaRoundRobinPartitionAssigner(config),
],
partitionAssigners,
},
this.options.consumer || {},
{

View File

@@ -93,11 +93,11 @@ export class ClientRedis extends ClientProxy {
}
public getClientOptions(error$: Subject<Error>): Partial<ClientOpts> {
// eslint-disable-next-line @typescript-eslint/camelcase
const retry_strategy = (options: RetryStrategyOptions) =>
this.createRetryStrategy(options, error$);
return {
// eslint-disable-next-line @typescript-eslint/camelcase
...(this.options || {}),
retry_strategy,
};
}

View File

@@ -19,6 +19,7 @@ export const SUBSCRIBE = 'subscribe';
export const CANCEL_EVENT = 'cancelled';
export const PATTERN_METADATA = 'microservices:pattern';
export const TRANSPORT_METADATA = 'microservices:transport';
export const CLIENT_CONFIGURATION_METADATA = 'microservices:client';
export const PATTERN_HANDLER_METADATA = 'microservices:handler_type';
export const CLIENT_METADATA = 'microservices:is_client_instance';

View File

@@ -8,6 +8,7 @@ import { NestContainer } from '@nestjs/core/injector/container';
import { InstanceWrapper } from '@nestjs/core/injector/instance-wrapper';
import { Observable } from 'rxjs';
import { RpcExceptionsHandler } from '../exceptions/rpc-exceptions-handler';
import { iterate } from 'iterare';
export class ExceptionFiltersContext extends BaseExceptionFilterContext {
constructor(
@@ -50,10 +51,11 @@ export class ExceptionFiltersContext extends BaseExceptionFilterContext {
return globalFilters;
}
const scopedFilterWrappers = this.config.getGlobalRequestFilters() as InstanceWrapper[];
const scopedFilters = scopedFilterWrappers
const scopedFilters = iterate(scopedFilterWrappers)
.map(wrapper => wrapper.getInstanceByContextId(contextId, inquirerId))
.filter(host => host)
.map(host => host.instance);
.filter(host => !!host)
.map(host => host.instance)
.toArray();
return globalFilters.concat(scopedFilters) as T;
}

View File

@@ -1,10 +1,18 @@
import { PATTERN_HANDLER_METADATA, PATTERN_METADATA } from '../constants';
import {
PATTERN_HANDLER_METADATA,
PATTERN_METADATA,
TRANSPORT_METADATA,
} from '../constants';
import { PatternHandler } from '../enums/pattern-handler.enum';
import { Transport } from '../enums';
/**
* Subscribes to incoming events which fulfils chosen pattern.
*/
export const EventPattern = <T = string>(metadata?: T): MethodDecorator => {
export const EventPattern = <T = string>(
metadata?: T,
transport?: Transport,
): MethodDecorator => {
return (
target: object,
key: string | symbol,
@@ -16,6 +24,7 @@ export const EventPattern = <T = string>(metadata?: T): MethodDecorator => {
PatternHandler.EVENT,
descriptor.value,
);
Reflect.defineMetadata(TRANSPORT_METADATA, transport, descriptor.value);
return descriptor;
};
};

View File

@@ -1,7 +1,12 @@
/* eslint-disable @typescript-eslint/no-use-before-define */
import { PATTERN_HANDLER_METADATA, PATTERN_METADATA } from '../constants';
import {
PATTERN_HANDLER_METADATA,
PATTERN_METADATA,
TRANSPORT_METADATA,
} from '../constants';
import { PatternHandler } from '../enums/pattern-handler.enum';
import { PatternMetadata } from '../interfaces/pattern-metadata.interface';
import { Transport } from '../enums';
export enum GrpcMethodStreamingType {
NO_STREAMING = 'no_stream',
@@ -14,6 +19,7 @@ export enum GrpcMethodStreamingType {
*/
export const MessagePattern = <T = PatternMetadata | string>(
metadata?: T,
transport?: Transport,
): MethodDecorator => {
return (
target: object,
@@ -26,6 +32,7 @@ export const MessagePattern = <T = PatternMetadata | string>(
PatternHandler.MESSAGE,
descriptor.value,
);
Reflect.defineMetadata(TRANSPORT_METADATA, transport, descriptor.value);
return descriptor;
};
};
@@ -42,7 +49,7 @@ export function GrpcMethod(service: string, method?: string): MethodDecorator {
descriptor: PropertyDescriptor,
) => {
const metadata = createGrpcMethodMetadata(target, key, service, method);
return MessagePattern(metadata)(target, key, descriptor);
return MessagePattern(metadata, Transport.GRPC)(target, key, descriptor);
};
}
@@ -76,7 +83,7 @@ export function GrpcStreamMethod(
method,
GrpcMethodStreamingType.RX_STREAMING,
);
return MessagePattern(metadata)(target, key, descriptor);
return MessagePattern(metadata, Transport.GRPC)(target, key, descriptor);
};
}
@@ -110,7 +117,7 @@ export function GrpcStreamCall(
method,
GrpcMethodStreamingType.PT_STREAMING,
);
return MessagePattern(metadata)(target, key, descriptor);
return MessagePattern(metadata, Transport.GRPC)(target, key, descriptor);
};
}

View File

@@ -0,0 +1,16 @@
/**
* An interface that contains options used when initializing a Channel instance.
* This listing is incomplete. Full reference: https://grpc.github.io/grpc/core/group__grpc__arg__keys.html
*/
export interface ChannelOptions {
'grpc.ssl_target_name_override'?: string;
'grpc.primary_user_agent'?: string;
'grpc.secondary_user_agent'?: string;
'grpc.default_authority'?: string;
'grpc.service_config'?: string;
'grpc.max_concurrent_streams'?: number;
'grpc.initial_reconnect_backoff_ms'?: number;
'grpc.max_reconnect_backoff_ms'?: number;
'grpc.use_local_subchannel_pool'?: number;
[key: string]: string | number | undefined;
}

View File

@@ -1,5 +1,4 @@
/* eslint-disable @typescript-eslint/adjacent-overload-signatures */
/* eslint-disable @typescript-eslint/camelcase */
export interface RetryStrategyOptions {
error: Error;

View File

@@ -1,4 +1,7 @@
import { Transport } from '../enums';
export interface CustomTransportStrategy {
readonly transportId?: Transport;
listen(callback: () => void): any;
close(): any;
}

View File

@@ -1,4 +1,5 @@
import { Transport } from '../enums/transport.enum';
import { ChannelOptions } from '../external/grpc-options.interface';
import {
CompressionTypes,
ConsumerConfig,
@@ -6,6 +7,7 @@ import {
ProducerConfig,
} from '../external/kafka-options.interface';
import { MqttClientOptions } from '../external/mqtt-options.interface';
import { ClientOpts } from '../external/redis.interface';
import { Server } from '../server/server';
import { CustomTransportStrategy } from './custom-transport-strategy.interface';
import { Deserializer } from './deserializer.interface';
@@ -32,6 +34,7 @@ export interface GrpcOptions {
url?: string;
maxSendMessageLength?: number;
maxReceiveMessageLength?: number;
maxMetadataSize?: number;
keepalive?: {
keepaliveTimeMs?: number;
keepaliveTimeoutMs?: number;
@@ -41,6 +44,7 @@ export interface GrpcOptions {
http2MinPingIntervalWithoutDataMs?: number;
http2MaxPingStrikes?: number;
};
channelOptions?: ChannelOptions;
credentials?: any;
protoPath: string | string[];
package: string | string[];
@@ -81,7 +85,7 @@ export interface RedisOptions {
retryDelay?: number;
serializer?: Serializer;
deserializer?: Deserializer;
};
} & ClientOpts;
}
export interface MqttOptions {

View File

@@ -6,7 +6,9 @@ import {
CLIENT_METADATA,
PATTERN_HANDLER_METADATA,
PATTERN_METADATA,
TRANSPORT_METADATA,
} from './constants';
import { Transport } from './enums';
import { PatternHandler } from './enums/pattern-handler.enum';
import { ClientOptions } from './interfaces/client-metadata.interface';
import { PatternMetadata } from './interfaces/pattern-metadata.interface';
@@ -21,6 +23,7 @@ export interface PatternProperties {
methodKey: string;
isEventHandler: boolean;
targetCallback: (...args: any[]) => any;
transport?: Transport;
}
export interface MessageRequestProperties {
@@ -54,10 +57,12 @@ export class ListenerMetadataExplorer {
return;
}
const pattern = Reflect.getMetadata(PATTERN_METADATA, targetCallback);
const transport = Reflect.getMetadata(TRANSPORT_METADATA, targetCallback);
return {
methodKey,
targetCallback,
pattern,
transport,
isEventHandler: handlerType === PatternHandler.EVENT,
};
}

View File

@@ -1,5 +1,6 @@
import { Injectable } from '@nestjs/common/interfaces';
import { Controller } from '@nestjs/common/interfaces/controllers/controller.interface';
import { isUndefined } from '@nestjs/common/utils/shared.utils';
import { ContextIdFactory } from '@nestjs/core/helpers/context-id-factory';
import { ExecutionContextHost } from '@nestjs/core/helpers/execution-context-host';
import { STATIC_CONTEXT } from '@nestjs/core/injector/constants';
@@ -61,31 +62,38 @@ export class ListenersController {
? DEFAULT_GRPC_CALLBACK_METADATA
: DEFAULT_CALLBACK_METADATA;
patternHandlers.forEach(
({ pattern, targetCallback, methodKey, isEventHandler }) => {
if (isStatic) {
const proxy = this.contextCreator.create(
instance as object,
targetCallback,
patternHandlers
.filter(
({ transport }) =>
isUndefined(transport) ||
isUndefined(server.transportId) ||
transport === server.transportId,
)
.forEach(
({ pattern, targetCallback, methodKey, transport, isEventHandler }) => {
if (isStatic) {
const proxy = this.contextCreator.create(
instance as object,
targetCallback,
moduleKey,
methodKey,
STATIC_CONTEXT,
undefined,
defaultCallMetadata,
);
return server.addHandler(pattern, proxy, isEventHandler);
}
const asyncHandler = this.createRequestScopedHandler(
instanceWrapper,
pattern,
moduleRef,
moduleKey,
methodKey,
STATIC_CONTEXT,
undefined,
defaultCallMetadata,
);
return server.addHandler(pattern, proxy, isEventHandler);
}
const asyncHandler = this.createRequestScopedHandler(
instanceWrapper,
pattern,
moduleRef,
moduleKey,
methodKey,
defaultCallMetadata,
);
server.addHandler(pattern, asyncHandler, isEventHandler);
},
);
server.addHandler(pattern, asyncHandler, isEventHandler);
},
);
}
public assignClientsToProperties(instance: Controller | Injectable) {

Some files were not shown because too many files have changed in this diff Show More