Compare commits

...

195 Commits

Author SHA1 Message Date
Kamil Myśliwiec
432dc3bad5 chore(@nestjs) publish v6.6.7 release 2019-09-03 15:16:52 +02:00
Kamil Myśliwiec
d4bb43009b fix(common) add additional security check to validation pipe 2019-09-03 15:14:10 +02:00
Kamil Mysliwiec
fbe80927b3 Merge pull request #2872 from nestjs/renovate/sequelize-5.x
fix(deps): update dependency sequelize to v5.18.1
2019-09-03 13:10:28 +02:00
Kamil Mysliwiec
3086df5a50 Merge pull request #2870 from nestjs/renovate/nest-monorepo
fix(deps): update nest monorepo to v6.6.6
2019-09-03 13:10:21 +02:00
Renovate Bot
8a6476a008 fix(deps): update dependency sequelize to v5.18.1 2019-09-03 10:16:31 +00:00
Renovate Bot
8cac746b2c fix(deps): update nest monorepo to v6.6.6 2019-09-03 08:18:26 +00:00
Kamil Myśliwiec
f8088a0119 chore(@nestjs) publish v6.6.6 release 2019-09-03 10:11:30 +02:00
Kamil Myśliwiec
d36d2f5e2d hotfix(core) add root module to the modules stack 2019-09-03 10:04:02 +02:00
Kamil Myśliwiec
6b7e5c2918 chore(@nestjs) publish v6.6.5 release 2019-09-03 09:56:07 +02:00
Kamil Myśliwiec
a8160cfa38 chore() publish 6.6.5 version 2019-09-03 09:54:28 +02:00
Kamil Myśliwiec
3bd6d4de9b Merge branch 'master' of https://github.com/nestjs/nest 2019-09-03 09:54:05 +02:00
Kamil Myśliwiec
77fb3bae6b fix(core) improve topological sorting performance 2019-09-03 09:53:56 +02:00
Kamil Mysliwiec
d77cdef120 Merge pull request #2868 from nestjs/revert-2837-renovate/typescript-3.x
Revert "fix(deps): update dependency typescript to v3.6.2"
2019-09-03 09:21:27 +02:00
Kamil Mysliwiec
9af2f6eb0f Revert "fix(deps): update dependency typescript to v3.6.2" 2019-09-03 09:20:51 +02:00
Kamil Mysliwiec
c575f9dfd7 Merge pull request #2837 from nestjs/renovate/typescript-3.x
fix(deps): update dependency typescript to v3.6.2
2019-09-03 09:06:03 +02:00
Kamil Mysliwiec
af0d322fcf Merge pull request #2866 from nestjs/renovate/pin-dependencies
chore(deps): pin dependency typescript to 3.6.2
2019-09-03 08:59:49 +02:00
Renovate Bot
935399f146 fix(deps): update dependency typescript to v3.6.2 2019-09-03 06:52:48 +00:00
Renovate Bot
d469f1823b chore(deps): pin dependency typescript to 3.6.2 2019-09-03 06:50:41 +00:00
Kamil Myśliwiec
12368ffca7 chore() resolve conflicts 2019-09-03 08:46:50 +02:00
Kamil Myśliwiec
ce912dac83 deps() upgrade to the latest typescript version 2019-09-03 08:44:43 +02:00
Kamil Mysliwiec
0094b29283 Merge pull request #2864 from nestjs/renovate/ts-morph-4.x
fix(deps): update dependency ts-morph to v4
2019-09-03 08:39:30 +02:00
Renovate Bot
580eaab106 fix(deps): update dependency ts-morph to v4 2019-09-03 00:10:04 +00:00
Kamil Mysliwiec
b9d6508ead Merge pull request #2863 from nestjs/renovate/nestjs-graphql-6.x
fix(deps): update dependency @nestjs/graphql to v6.5.0
2019-09-02 15:16:28 +02:00
Renovate Bot
efeb072797 fix(deps): update dependency @nestjs/graphql to v6.5.0 2019-09-02 13:16:00 +00:00
Kamil Mysliwiec
64907e5879 Merge pull request #2862 from nestjs/renovate/sinon-7.x
chore(deps): update dependency sinon to v7.4.2
2019-09-02 15:14:16 +02:00
Kamil Mysliwiec
915fa708f0 Merge pull request #2860 from nestjs/renovate/nest-monorepo
fix(deps): update nest monorepo to v6.6.4
2019-09-02 15:13:46 +02:00
Renovate Bot
565a5a8a11 chore(deps): update dependency sinon to v7.4.2 2019-09-02 11:53:54 +00:00
Renovate Bot
d357f1edfe fix(deps): update nest monorepo to v6.6.4 2019-09-02 09:42:44 +00:00
Kamil Myśliwiec
3148e0f866 chore(@nestjs) publish v6.6.4 release 2019-09-02 11:36:53 +02:00
Kamil Myśliwiec
5f3eeff77a Merge branch 'master' of https://github.com/nestjs/nest 2019-09-02 11:34:30 +02:00
Kamil Myśliwiec
17d29a952c chore() release 6.6.4 version 2019-09-02 11:34:16 +02:00
Kamil Myśliwiec
2bbff5432e fix(core) lookup enhancers on providers 2019-09-02 11:33:38 +02:00
Kamil Mysliwiec
d77936b7bd Merge pull request #2846 from nestjs/renovate/nestjs-graphql-6.x
fix(deps): update dependency @nestjs/graphql to v6.4.3
2019-09-02 09:19:35 +02:00
Kamil Mysliwiec
f48d4d422d Merge pull request #2847 from nestjs/renovate/graphql-14.x
fix(deps): update dependency graphql to v14.5.4
2019-09-02 09:19:26 +02:00
Kamil Mysliwiec
9874b55b27 Merge pull request #2849 from nestjs/renovate/mongoose-5.x
chore(deps): update dependency @types/mongoose to v5.5.16
2019-09-02 09:09:57 +02:00
Renovate Bot
74fb7917ce fix(deps): update dependency graphql to v14.5.4 2019-09-02 07:02:56 +00:00
Renovate Bot
f9ec473f64 fix(deps): update dependency @nestjs/graphql to v6.4.3 2019-09-02 07:00:40 +00:00
Renovate Bot
ad2fecfef8 chore(deps): update dependency @types/mongoose to v5.5.16 2019-09-02 06:59:40 +00:00
Kamil Mysliwiec
1e9930aa6c Merge pull request #2850 from nestjs/renovate/sequelize-5.x
fix(deps): update dependency sequelize to v5.18.0
2019-09-02 08:53:18 +02:00
Kamil Mysliwiec
7c13c100e2 Merge pull request #2851 from nestjs/renovate/node-10.x
chore(deps): update dependency @types/node to v10.14.17
2019-09-02 08:53:11 +02:00
Kamil Mysliwiec
63ac6c098f Merge pull request #2852 from nestjs/renovate/node-12.x
chore(deps): update dependency @types/node to v12.7.3
2019-09-02 08:53:04 +02:00
Kamil Mysliwiec
a7c24a168e Merge pull request #2853 from nestjs/renovate/node-8.x
chore(deps): update dependency @types/node to v8.10.53
2019-09-02 08:52:51 +02:00
Kamil Mysliwiec
f690baf387 Merge pull request #2854 from nestjs/renovate/apollo-graphql-packages
fix(deps): update dependency apollo-server-express to v2.9.3
2019-09-02 08:52:43 +02:00
Kamil Mysliwiec
908438c98f Merge pull request #2857 from nestjs/renovate/fastify-2.x
fix(deps): update dependency fastify to v2.8.0
2019-09-02 08:52:36 +02:00
Kamil Mysliwiec
4cf0e7bfab Merge pull request #2858 from nestjs/renovate/path-to-regexp-3.x
fix(deps): update dependency path-to-regexp to v3.1.0
2019-09-02 08:52:26 +02:00
Renovate Bot
707ff6e512 fix(deps): update dependency apollo-server-express to v2.9.3 2019-09-01 21:53:40 +00:00
Renovate Bot
37488d4d1e fix(deps): update dependency sequelize to v5.18.0 2019-08-31 11:39:32 +00:00
Renovate Bot
db61bc1729 fix(deps): update dependency path-to-regexp to v3.1.0 2019-08-31 04:05:12 +00:00
Renovate Bot
c0fc683b7c fix(deps): update dependency fastify to v2.8.0 2019-08-30 22:00:04 +00:00
Renovate Bot
84acc114cf chore(deps): update dependency @types/node to v8.10.53 2019-08-30 06:32:10 +00:00
Renovate Bot
69dcf81f54 chore(deps): update dependency @types/node to v12.7.3 2019-08-30 05:29:23 +00:00
Renovate Bot
de4a990aae chore(deps): update dependency @types/node to v10.14.17 2019-08-30 05:29:05 +00:00
Kamil Mysliwiec
af54516b99 Merge pull request #2833 from nestjs/renovate/nest-monorepo
fix(deps): update nest monorepo to v6.6.3
2019-08-29 11:59:43 +02:00
Renovate Bot
3c59864847 fix(deps): update nest monorepo to v6.6.3 2019-08-29 09:59:06 +00:00
Kamil Mysliwiec
741f55046f Merge pull request #2836 from nestjs/renovate/mongodb-3.x
fix(deps): update dependency mongodb to v3.3.2
2019-08-29 11:47:34 +02:00
Kamil Mysliwiec
1cf7610e9b Merge pull request #2841 from nestjs/renovate/apollo-graphql-packages
fix(deps): update dependency apollo-server-express to v2.9.1
2019-08-29 11:47:18 +02:00
Kamil Mysliwiec
bbb8000831 Merge pull request #2842 from nestjs/renovate/sequelize-5.x
fix(deps): update dependency sequelize to v5.17.1
2019-08-29 11:46:44 +02:00
Kamil Myśliwiec
f0d0ded2d7 chore(@nestjs) publish v6.6.3 release 2019-08-29 09:12:44 +02:00
Kamil Myśliwiec
02c8b5b2b9 fix(core) invert middleware execution order 2019-08-29 09:11:18 +02:00
Renovate Bot
f1ab1f1ab0 fix(deps): update dependency sequelize to v5.17.1 2019-08-29 04:25:12 +00:00
Renovate Bot
a023c5871e fix(deps): update dependency apollo-server-express to v2.9.1 2019-08-28 20:38:41 +00:00
Renovate Bot
4cea99e16f fix(deps): update dependency mongodb to v3.3.2 2019-08-28 17:43:44 +00:00
Kamil Myśliwiec
f791b3e6b1 fix(platform-fastify) fix invalid import statement for reply object 2019-08-28 15:56:09 +02:00
Kamil Myśliwiec
1a0102b007 chore() publish 6.6.2 release 2019-08-28 15:10:05 +02:00
Kamil Myśliwiec
7516de13a8 chore(@nestjs) publish v6.6.2 release 2019-08-28 15:09:14 +02:00
Kamil Myśliwiec
2cdebc888d fix(core) circular dependency when calculating distance of modules 2019-08-28 15:07:56 +02:00
Kamil Myśliwiec
557f585a00 fix(platform-fastify) wrap native response object for exception filter 2019-08-28 15:07:34 +02:00
Kamil Myśliwiec
892df6c433 chore() release 6.6.1 patch release 2019-08-28 12:51:48 +02:00
Kamil Myśliwiec
83e846633b chore(@nestjs) publish v6.6.1 release 2019-08-28 12:51:09 +02:00
Kamil Myśliwiec
709625e273 Merge branch 'master' of https://github.com/nestjs/nest 2019-08-28 12:50:09 +02:00
Kamil Myśliwiec
cb4eb3d7ad fix(common) fix logger levels default value #2832 2019-08-28 12:49:58 +02:00
Kamil Mysliwiec
1490a8a8b3 Merge pull request #2830 from nestjs/renovate/nest-monorepo
fix(deps): update nest monorepo to v6.6.0
2019-08-28 10:06:13 +02:00
Kamil Myśliwiec
1b166131d7 Merge branch 'master' of https://github.com/nestjs/nest 2019-08-28 10:05:22 +02:00
Kamil Myśliwiec
37e41d7afe test() mqtt concurrent integration test comment out 2019-08-28 10:05:11 +02:00
Renovate Bot
40234488d6 fix(deps): update nest monorepo to v6.6.0 2019-08-28 07:42:18 +00:00
Kamil Mysliwiec
781bf4d283 Merge pull request #2829 from nestjs/renovate/mysql2-1.x
fix(deps): update dependency mysql2 to v1.7.0
2019-08-28 09:34:10 +02:00
Kamil Myśliwiec
c80834894a chore() release 6.6.0 version 2019-08-28 09:33:03 +02:00
Kamil Myśliwiec
16ae1407e1 chore(@nestjs) publish v6.6.0 release 2019-08-28 09:32:20 +02:00
Renovate Bot
2e05368b2e fix(deps): update dependency mysql2 to v1.7.0 2019-08-28 07:18:29 +00:00
Kamil Mysliwiec
a68ae579d4 Merge pull request #2816 from nestjs/6.6.0
chore() minor release [6.6.0]
2019-08-28 09:14:09 +02:00
Kamil Mysliwiec
aa9dfbb7ba Merge pull request #2827 from nestjs/renovate/mongoose-5.x
chore(deps): update dependency @types/mongoose to v5.5.15
2019-08-28 08:11:41 +02:00
Kamil Mysliwiec
8278746279 Merge pull request #2828 from nestjs/renovate/sequelize-5.x
fix(deps): update dependency sequelize to v5.17.0
2019-08-28 08:11:32 +02:00
Renovate Bot
60eae53f98 fix(deps): update dependency sequelize to v5.17.0 2019-08-28 04:24:59 +00:00
Renovate Bot
77298e804a chore(deps): update dependency @types/mongoose to v5.5.15 2019-08-27 23:28:24 +00:00
Kamil Mysliwiec
9a53587afa Merge pull request #2825 from nestjs/renovate/mongoose-5.x
chore(deps): update dependency @types/mongoose to v5.5.14
2019-08-27 20:42:00 +02:00
Renovate Bot
7cfffb9a95 chore(deps): update dependency @types/mongoose to v5.5.14 2019-08-27 18:40:00 +00:00
Kamil Mysliwiec
0e2a4e7e84 Merge pull request #2820 from nestjs/renovate/webpack-4.x
chore(deps): update dependency webpack to v4.39.3
2019-08-27 18:56:53 +02:00
Renovate Bot
25174cbef4 chore(deps): update dependency webpack to v4.39.3 2019-08-27 12:24:02 +00:00
Kamil Mysliwiec
8d9b996b2f Merge pull request #2818 from nestjs/renovate/lint-staged-9.x
chore(deps): update dependency lint-staged to v9.2.5
2019-08-27 10:20:17 +02:00
Renovate Bot
27c1c0881e chore(deps): update dependency lint-staged to v9.2.5 2019-08-27 06:50:58 +00:00
Kamil Myśliwiec
d01a798d7b lint() fix linter issues 2019-08-26 22:50:58 +02:00
Kamil Myśliwiec
b8fbda24bd docs() add comments for overloaded signatures 2019-08-26 22:49:50 +02:00
Kamil Mysliwiec
464c2bbef0 Merge pull request #2688 from BrunnerLivio/feature/api-docs
docs() add API documentation
2019-08-26 22:45:41 +02:00
Kamil Myśliwiec
a9aaf86099 Merge branch '6.6.0' of https://github.com/nestjs/nest into 6.6.0 2019-08-26 22:24:21 +02:00
John Biundo
85f3897ae1 feat(platform-express): Add documentation for public API 2019-08-26 22:18:04 +02:00
John Biundo
bed7ef1593 feat(core): Add documentation for public API 2019-08-26 22:18:04 +02:00
John Biundo
10c9d66cc4 feat(common): Add documentation for public API 2019-08-26 22:18:04 +02:00
Livio
6c035060a1 feat(): Add package description files 2019-08-26 22:18:00 +02:00
Kamil Myśliwiec
5ab5ed8736 tests() update middleware execution order e2e test 2019-08-26 22:09:46 +02:00
Livio
1682181b78 feat(): Add ScopeOptions to public API 2019-08-26 22:02:58 +02:00
Kamil Mysliwiec
16fdcd3a4f Update Readme.md 2019-08-26 21:37:10 +02:00
Kamil Myśliwiec
47ee1d68d5 ci() remove travis.yml file 2019-08-26 21:33:16 +02:00
Kamil Myśliwiec
acff437542 ci() prepare nvm task (integration) 2019-08-26 21:23:46 +02:00
Kamil Myśliwiec
48fc6473bd ci() add npm install before integration tests and samples
ci() add npm install before integration tests and sampels

ci() add machine option to integraiton tests

ci() setup remote docker for integration tests

ci() add unit tests mixin function

ci() add unit tests mixin function

ci() fix working directory for integration tests

ci() rename unit tests function

ci() use reusable run-unit-tests config

ci() update naming, add coveralls

ci() add alias for unit tests

ci() add aliases (circleci)

ci() remove run command from aliases

ci() fix aliases

ci(): fix restore cache alias

ci() add list containers step to integration tests

integration() bind urls and hosts to 0.0.0.0

ci() add waiting for mysql task

ci() hotfix, move tasks order (integration)

ci() wait for mysql - change hostname, increase sleep time

ci() add sleep after docker-compose up (integration)

ci() add sleep after docker-compose up fix (seconds)

ci() switch to machine mode (integration tests)

ci() use nvm to switch default node version

ci() hotfix, wrong indentation (integration tests)

ci() add ls-remove (nvm) and node version check

ci() fix install npm task

ci() wip use nvm to run integration tests

ci() remove NPM upgrade task
2019-08-26 21:23:53 +02:00
Kamil Myśliwiec
09c84e2086 ci() fix typo in samples job 2019-08-26 21:23:46 +02:00
Kamil Myśliwiec
0a7f37d90b feat(): add incoming request & response serializers 2019-08-26 21:23:46 +02:00
Kamil Myśliwiec
7f8aa92c0a feat(): add rpc serializer and deserializer, improve performance 2019-08-26 21:23:46 +02:00
Kamil Myśliwiec
9885309cd5 ci() add samples and integration tests 2019-08-26 14:53:11 +02:00
Kamil Myśliwiec
51bde528c0 resolve conflicts 2019-08-26 14:32:21 +02:00
Kamil Myśliwiec
3c340b8a41 refactor() adjust coding style 2019-08-26 14:30:48 +02:00
Kamil Myśliwiec
64bc85ac28 Merge branch 'middleware-order' of https://github.com/underfin/nest into underfin-middleware-order 2019-08-26 14:23:40 +02:00
Kamil Mysliwiec
e974283ec8 Merge pull request #2813 from nestjs/feat/log-levels
feat(common) add log levels (error, info, etc union)
2019-08-26 14:11:37 +02:00
Kamil Myśliwiec
84d7178a59 fix(websockets) fix broken unit tests 2019-08-26 14:09:19 +02:00
Kamil Myśliwiec
844a69ee6a fix(core) request scoped middleware fix #2748 2019-08-26 13:46:46 +02:00
Kamil Myśliwiec
b4c190b912 refactor() add missing whitespace to gulp config 2019-08-26 13:26:40 +02:00
Kamil Myśliwiec
13cdc6d23b refactor() improve naming, remove inconsistency 2019-08-26 13:25:32 +02:00
Kamil Myśliwiec
e0fd3b8f3a refactor() add extra whiteline to gulp config file 2019-08-26 12:38:59 +02:00
Kamil Mysliwiec
ef264f1496 Merge pull request #2682 from nestjs/feat/resolve-scoped-classes
feat(core) add resolve method to load scoped classes
2019-08-26 12:38:41 +02:00
Kamil Mysliwiec
9d4d2abf46 Merge branch '6.6.0' into feat/resolve-scoped-classes 2019-08-26 12:38:15 +02:00
Kamil Mysliwiec
036bc562ea Merge pull request #2814 from nestjs/feat/hot-emit-microservices
feat(microservices) emit() should use hot observables
2019-08-26 12:35:21 +02:00
Kamil Myśliwiec
43db50c500 feat(common) add log levels to context options 2019-08-26 12:33:11 +02:00
Kamil Myśliwiec
5445997734 feat(common) add log levels (error, info, etc) 2019-08-26 12:30:38 +02:00
Kamil Myśliwiec
8b89187515 feat(microservices) emit() should use hot observables #2651 2019-08-26 12:19:15 +02:00
Kamil Myśliwiec
7af66c56fb ci() update ci build scripts 2019-08-26 12:08:58 +02:00
Kamil Myśliwiec
8da95030fe scripts() clarify names of build tasks 2019-08-26 11:58:15 +02:00
Kamil Myśliwiec
63644df773 feat(core) add error message to improve DX (get vs resolve) 2019-08-26 11:29:16 +02:00
Kamil Myśliwiec
12753dafb4 Merge branch 'renovate/sequelize-typescript-1.x' 2019-08-26 10:51:45 +02:00
Kamil Myśliwiec
de26bd490b sample(sequelize) fix sequelize options 2019-08-26 10:51:32 +02:00
Kamil Myśliwiec
b84246c641 Merge branch 'johnbiundo-feature-add-redirect-decorator' into 6.6.0 2019-08-26 10:42:19 +02:00
Kamil Myśliwiec
458e2ccd04 refactor(core) improve performance by moving reflection part (redirect) 2019-08-26 10:41:59 +02:00
Kamil Myśliwiec
a814974d6d Merge branch 'feature-add-redirect-decorator' of https://github.com/johnbiundo/nest into johnbiundo-feature-add-redirect-decorator 2019-08-26 10:27:12 +02:00
Kamil Myśliwiec
e7a049823d Merge branch '6.6.0' of https://github.com/nestjs/nest into 6.6.0 2019-08-26 10:18:48 +02:00
Kamil Myśliwiec
a651429697 Merge branch 'zailic-IonutZailic-IssueNo1384' into 6.6.0 2019-08-26 10:18:37 +02:00
Kamil Myśliwiec
6b56bdf216 resolve conflicts 2019-08-26 10:17:40 +02:00
Kamil Mysliwiec
47a1434b8a Merge pull request #2807 from nestjs/renovate/lint-staged-9.x
chore(deps): update dependency lint-staged to v9.2.4
2019-08-26 10:14:28 +02:00
Kamil Mysliwiec
ab43b862cc Merge pull request #2808 from nestjs/renovate/mongoose-5.x
fix(deps): update dependency mongoose to v5.6.11
2019-08-26 10:14:19 +02:00
Kamil Myśliwiec
4f16736351 ci() remove artifacts 2019-08-26 09:15:17 +02:00
Kamil Myśliwiec
0ef817b9af ci() update scripts 2019-08-26 09:11:12 +02:00
Kamil Myśliwiec
b2135b43fb ci() add working directory 2019-08-26 08:59:13 +02:00
Kamil Myśliwiec
901191a9dd ci() use cached node_modules dir 2019-08-26 08:55:44 +02:00
Kamil Myśliwiec
781d43d8ec ci() hotfix build command 2019-08-26 08:50:28 +02:00
Kamil Myśliwiec
a6940be500 ci() add install deps script 2019-08-26 08:48:04 +02:00
Kamil Myśliwiec
44e62b3e7a ci() add missing require condition 2019-08-26 08:41:23 +02:00
Kamil Myśliwiec
8c9f6d75cf ci() fix scripts (wip) 2019-08-26 08:39:33 +02:00
Kamil Myśliwiec
8d58d70e1a ci() remove typos hotfix (wip) 2019-08-26 08:37:23 +02:00
Kamil Myśliwiec
6a8ffcabfa ci() add workflow (wip) 2019-08-26 08:36:56 +02:00
Kamil Myśliwiec
ce7eecb745 ci() set working directory (wip) 2019-08-26 08:35:58 +02:00
Kamil Myśliwiec
aebf29e657 ci() set working directory (wip) 2019-08-26 08:34:30 +02:00
Kamil Myśliwiec
69e689ac7a ci() moving to circleci (wip) 2019-08-26 08:34:01 +02:00
Kamil Myśliwiec
6652b55b20 ci() moving to circleci (wip) 2019-08-26 08:30:07 +02:00
Renovate Bot
5ed092a526 fix(deps): update dependency mongoose to v5.6.11 2019-08-25 20:35:30 +00:00
Renovate Bot
945a3d7a8b chore(deps): update dependency lint-staged to v9.2.4 2019-08-25 20:35:03 +00:00
Kamil Mysliwiec
34f4a84534 Merge pull request #2805 from Reasno/proxy-fix
bugfix(microservices) pass all arguments to request-scoped proxies
2019-08-24 19:40:59 +02:00
Kamil Mysliwiec
311265fe81 Merge pull request #2770 from l2ubin/master
feat(common) added seconds to logger timestamp
2019-08-24 19:37:12 +02:00
vivi
3f496afc6a Merge branch 'IonutZailic-IssueNo1384' of https://github.com/zailic/nest into IonutZailic-IssueNo1384 2019-08-24 19:19:48 +03:00
vivi
e913ccf6de [#1384] Allow async NestModule.configure method 2019-08-24 19:06:30 +03:00
vivi
7d34529ece work in progress 2019-08-24 18:50:42 +03:00
Renovate Bot
e38999e6a9 fix(deps): update dependency sequelize-typescript to v1 2019-08-24 15:40:43 +00:00
Kamil Mysliwiec
a3c47d6280 Merge pull request #2567 from BrunnerLivio/feature/before-appplication-shutdown-hook
feat(core): Add beforeApplicationShutdown hook
2019-08-24 17:19:20 +02:00
Kamil Mysliwiec
6e686bc64b Merge pull request #2796 from iveselin/feature/createResponseBodyExport
feature(common) move createResponseBody to HttpException
2019-08-24 17:18:47 +02:00
vivi
1711527d4f forgotten semicolon 2019-08-24 18:16:44 +03:00
Kamil Mysliwiec
1b96a8de7f Merge pull request #2725 from andreimc/feature/better-error-message
refactor(core): more descriptive unknown element exception
2019-08-24 17:15:04 +02:00
Kamil Mysliwiec
648faecbcd Merge pull request #2778 from nestjs/renovate/apollo-graphql-packages
fix(deps): update dependency apollo-server-express to v2.9.0
2019-08-24 17:13:15 +02:00
vivi
86fd379ebb Kamil's CR recommendation 2019-08-24 17:50:10 +03:00
vivi
e23138a83e merging latest changes 2019-08-24 17:46:04 +03:00
Kamil Mysliwiec
9803e4e20e Merge pull request #2708 from bigzoo/fix-terminate-app-after-close
bugfix(microservices) update isTerminated during close
2019-08-24 11:16:14 +02:00
Kamil Mysliwiec
36db11c989 Merge pull request #2790 from BrunnerLivio/fix/null-hooks-bug
fix(core) do not call onModuleInit if is null
2019-08-24 11:15:49 +02:00
Kamil Mysliwiec
8bccfcab4e Merge pull request #2800 from Leth01/multer-interface-fix
bugfix(platform) updated the location of the PreservePath boolean
2019-08-24 11:12:40 +02:00
Kamil Mysliwiec
d521792c34 Merge pull request #2775 from nestjs/renovate/jest-24.x
chore(deps): update dependency @types/jest to v24.0.18
2019-08-24 11:10:40 +02:00
Renovate Bot
98a3630819 fix(deps): update dependency apollo-server-express to v2.9.0 2019-08-24 08:45:01 +00:00
Renovate Bot
e9d293f43d chore(deps): update dependency @types/jest to v24.0.18 2019-08-24 08:42:26 +00:00
Kamil Mysliwiec
e25d97412f Merge pull request #2804 from nestjs/renovate/graphql-14.x
fix(deps): update dependency graphql to v14.5.3
2019-08-24 10:41:07 +02:00
Reasno
67a9b2830f bugfix(microservices): pass all arguments to request-scoped proxies
Some microservices, such as gRPC, have more than one arguments in their
handler. Previously only the first argument, namely data itself, was passed
to the request-scoped proxies, stopping other arguments from propagating.

Related to #2802
2019-08-24 12:32:31 +08:00
Renovate Bot
5fdfd79eb3 fix(deps): update dependency graphql to v14.5.3 2019-08-24 00:53:18 +00:00
Kamil Mysliwiec
4a73b92bec Merge pull request #2801 from nestjs/renovate/graphql-14.x
fix(deps): update dependency graphql to v14.5.1
2019-08-23 23:00:29 +02:00
Kamil Mysliwiec
6c8a034784 Merge pull request #2741 from nestjs/renovate/mongodb-3.x
fix(deps): update dependency mongodb to v3.3.1
2019-08-23 23:00:18 +02:00
Renovate Bot
58f93edcb4 fix(deps): update dependency mongodb to v3.3.1 2019-08-23 19:36:50 +00:00
Renovate Bot
cffe8f919f fix(deps): update dependency graphql to v14.5.1 2019-08-23 19:31:16 +00:00
Jonathan Letham
6b683eefbb bugfix: Updated the location of the 'PreservePath' boolean within the MulterOptions interface 2019-08-23 16:02:33 +01:00
Ivan Veselin
e91b711456 feature(common) move createResponseBody to HttpException
renamed and moved createResponseBody function to be exported as a part
of HttpException

Closes #2727
2019-08-22 15:35:47 +02:00
Livio
106cdccefd test(core): Add e2e test for beforeAppShutdown hook 2019-08-22 08:55:30 +02:00
Livio
9c83b26486 feat(core): Add beforeApplicationShutdown hook 2019-08-22 08:53:59 +02:00
Livio Brunnner
a165ddbccf fix(core): Do not call onModuleInit if is null
Fixes #1252
2019-08-22 08:48:52 +02:00
John Biundo
f4d3c03d6b feature(redirect decorator) add redirect decorator 2019-08-20 12:45:40 -07:00
Rubin Bhandari
9d394f5668 Added seconds to logger timestamp
At the moment only hours and minutes are logged in the default Logger implementation.

This pull request add seconds to default logger format.

Note that I don't want to override the whole logger service. It's pretty nice, I just want another timestamp format
2019-08-19 12:52:14 +05:45
vivi
63e5d6b806 [#1384] Allow async NestModule.configure method 2019-08-18 20:54:03 +03:00
vivi
59bdc2e4d8 Merge branch 'master' into IonutZailic-IssueNo1384 2019-08-17 15:49:02 +03:00
Andrei Miulescu
1493c011ae Update packages/core/injector/container-scanner.ts
Co-Authored-By: Livio Brunner <livio.brunner.lb1@gmail.com>
2019-08-16 07:44:51 +10:00
Andrei Miulescu
f1271b6f1e Update packages/core/errors/exceptions/unknown-element.exception.ts
Co-Authored-By: Livio Brunner <livio.brunner.lb1@gmail.com>
2019-08-12 12:29:53 +10:00
Andrei Miulescu
7d9c0a1c0d Update packages/core/injector/container-scanner.ts
Co-Authored-By: Livio Brunner <livio.brunner.lb1@gmail.com>
2019-08-12 12:29:45 +10:00
Andrei Miulescu
abb3549f28 refactor(core): more descriptive unknown element exception
providing the element name would help you pin-point your missing provider quicker
2019-08-09 08:37:36 +10:00
Chris Nyaga
b9ce9b8d5f bugfix(microservices): update isTerminated during close
update isTerminated during close

Fixes #1364
2019-08-06 12:37:21 +03:00
Kamil Myśliwiec
bdb0ede50d feat(core): add resolve method to load scoped classes 2019-07-31 11:37:22 +02:00
vivi
2b5f0e2ba2 work in progress 2019-07-21 11:20:23 +03:00
likui
fcf5042d32 feat(@nestjs/core): execute middleware of dependent modules first. #1451 2019-07-05 19:14:56 +08:00
291 changed files with 7384 additions and 2951 deletions

160
.circleci/config.yml Normal file
View File

@@ -0,0 +1,160 @@
version: 2
aliases:
- &restore-cache
restore_cache:
key: dependency-cache-{{ checksum "package.json" }}
- &install-deps
run:
name: Install dependencies
command: npm ci
- &build-packages
run:
name: Build
command: npm run build
- &run-unit-tests
run:
name: Test
command: npm run test
unit-tests-template: &unit-tests-template
working_directory: ~/nest
steps:
- checkout
- *restore-cache
- *install-deps
- *build-packages
- *run-unit-tests
jobs:
build:
working_directory: ~/nest
docker:
- image: circleci/node:12
steps:
- checkout
- run:
name: Update NPM version
command: 'sudo npm install -g npm@latest'
- restore_cache:
key: dependency-cache-{{ checksum "package.json" }}
- run:
name: Install dependencies
command: npm ci
- save_cache:
key: dependency-cache-{{ checksum "package.json" }}
paths:
- ./node_modules
- run:
name: Build
command: npm run build
test_node_12:
working_directory: ~/nest
docker:
- image: circleci/node:12
steps:
- checkout
- *restore-cache
- *install-deps
- *build-packages
- *run-unit-tests
- run:
name: Collect coverage
command: npm run coverage
- store_artifacts:
path: coverage
test_node_10:
<<: *unit-tests-template
docker:
- image: circleci/node:10
test_node_8:
<<: *unit-tests-template
docker:
- image: circleci/node:8
lint:
working_directory: ~/nest
docker:
- image: circleci/node:12
steps:
- checkout
- *restore-cache
- *install-deps
- run:
name: Lint
command: npm run lint
integration_tests:
working_directory: ~/nest
machine: true
steps:
- checkout
- run:
name: Prepare nvm
command: |
echo 'export NVM_DIR="/opt/circleci/.nvm"' >> $BASH_ENV
echo ' [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"' >> $BASH_ENV
- run:
name: Upgrade Node.js
command: |
nvm install v12
node -v
nvm alias default v12
- run:
name: Install Docker Compose
command: |
curl -L https://github.com/docker/compose/releases/download/1.19.0/docker-compose-`uname -s`-`uname -m` > ~/docker-compose
chmod +x ~/docker-compose
sudo mv ~/docker-compose /usr/local/bin/docker-compose
- *install-deps
- run:
name: Prepare tests
command: |
bash ./scripts/prepare.sh
sleep 10
- run:
name: List containers
command: docker ps
- run:
name: Integration tests
command: npm run integration-test
samples:
working_directory: ~/nest
docker:
- image: circleci/node:12
steps:
- checkout
- *restore-cache
- *install-deps
- run:
name: Build all samples
command: npm run build:samples
workflows:
version: 2
build-and-test:
jobs:
- build
- test_node_12:
requires:
- build
- test_node_10:
requires:
- build
- test_node_8:
requires:
- build
- lint:
requires:
- build
- integration_tests:
requires:
- build
- samples:
requires:
- build

View File

@@ -1,56 +0,0 @@
language: node_js
cache:
directories:
- "node_modules"
git:
depth: 5
before_install:
- npm i -g npm@latest
install:
- npm ci
- npm run build:dev
jobs:
include:
- state: "Test"
name: "Unit Test Node v12"
script: npm test
node_js: 12
after_success: npm run coverage
- state: "Test"
name: "Unit Test Node v10"
script: npm test
node_js: 10
- state: "Test"
name: "Unit Test Node v8"
script: npm test
node_js: 8
- state: "Test"
name: "Integration Test"
install: skip
before_install: skip
before_script: skip
addons: skip
script:
sudo service mysql stop &&
bash ./scripts/prepare.sh &&
npm run integration-test
node_js: 12
- stage: "Test"
name: "Lint"
script: npm run lint
node_js: 12
- stage: "Test"
name: "Build samples"
script: npm run build:samples
node_js: 12

View File

@@ -4,13 +4,14 @@ We would love for you to contribute to Nest and help make it even better than it
today! As a contributor, here are the guidelines we would like you to follow:
<!--* [Code of Conduct](#coc)-->
* [Question or Problem?](#question)
* [Issues and Bugs](#issue)
* [Feature Requests](#feature)
* [Submission Guidelines](#submit)
* [Development Setup](#development)
* [Coding Rules](#rules)
* [Commit Message Guidelines](#commit)
- [Question or Problem?](#question)
- [Issues and Bugs](#issue)
- [Feature Requests](#feature)
- [Submission Guidelines](#submit)
- [Development Setup](#development)
- [Coding Rules](#rules)
- [Commit Message Guidelines](#commit)
<!-- - [Signing the CLA](#cla) -->
<!-- ## <a name="coc"></a> Code of Conduct
@@ -24,8 +25,8 @@ Stack Overflow is a much better place to ask questions since:
<!-- - there are thousands of people willing to help on Stack Overflow [maybe one day] -->
* questions and answers stay available for public viewing so your question / answer might help someone else
* Stack Overflow's voting system assures that the best answers are prominently visible.
- questions and answers stay available for public viewing so your question / answer might help someone else
- Stack Overflow's voting system assures that the best answers are prominently visible.
To save your and our time, we will systematically close all issues that are requests for general support and redirect people to Stack Overflow.
@@ -44,10 +45,10 @@ Repository. If you would like to _implement_ a new feature, please submit an iss
a proposal for your work first, to be sure that we can use it.
Please consider what kind of change it is:
* For a **Major Feature**, first open an issue and outline your proposal so that it can be
- For a **Major Feature**, first open an issue and outline your proposal so that it can be
discussed. This will also allow us to better coordinate our efforts, prevent duplication of work,
and help you to craft the change so that it is successfully accepted into the project. For your issue name, please prefix your proposal with `[discussion]`, for example "[discussion]: your feature idea".
* **Small Features** can be crafted and directly [submitted as a Pull Request](#submit-pr).
- **Small Features** can be crafted and directly [submitted as a Pull Request](#submit-pr).
## <a name="submit"></a> Submission Guidelines
@@ -57,9 +58,9 @@ Before you submit an issue, please search the issue tracker, maybe an issue for
We want to fix all the issues as soon as possible, but before fixing a bug we need to reproduce and confirm it. In order to reproduce bugs we will systematically ask you to provide a minimal reproduction scenario using a repository or [Gist](https://gist.github.com/). Having a live, reproducible scenario gives us wealth of important information without going back & forth to you with additional questions like:
* version of NestJS used
* 3rd-party libraries and their versions
* and most importantly - a use-case that fails
- version of NestJS used
- 3rd-party libraries and their versions
- and most importantly - a use-case that fails
<!--
// TODO we need to create a playground, similar to plunkr
@@ -114,11 +115,11 @@ We cannot accept code without this.
1. In GitHub, send a pull request to `nestjs:master`.
* If we suggest changes then:
- If we suggest changes then:
* Make the required updates.
* Re-run the Nest test suites to ensure tests are still passing.
* Rebase your branch and force push to your GitHub repository (this will update your Pull Request):
- Make the required updates.
- Re-run the Nest test suites to ensure tests are still passing.
- Rebase your branch and force push to your GitHub repository (this will update your Pull Request):
```shell
git rebase master -i
@@ -132,25 +133,25 @@ That's it! Thank you for your contribution!
After your pull request is merged, you can safely delete your branch and pull the changes
from the main (upstream) repository:
* Delete the remote branch on GitHub either through the GitHub web UI or your local shell as follows:
- Delete the remote branch on GitHub either through the GitHub web UI or your local shell as follows:
```shell
git push origin --delete my-fix-branch
```
* Check out the master branch:
- Check out the master branch:
```shell
git checkout master -f
```
* Delete the local branch:
- Delete the local branch:
```shell
git branch -D my-fix-branch
```
* Update your master with the latest upstream version:
- Update your master with the latest upstream version:
```shell
git pull --ff upstream master
@@ -177,13 +178,8 @@ That will compile fresh packages and afterward, move them to all `sample` direct
### <a name="common-scripts"></a>Commonly used NPM scripts
```bash
# build all packages and put them near to their source .ts files
$ npm run build
# build all packages and move to "sample" and "integration" directories
# if cross-packages breaking changes were performed you may face irrelevant errors
# in order to verify the build, you can run this command again then
$ npm run build:dev
$ npm run build
# run the full unit tests suite
$ npm run test
@@ -194,6 +190,9 @@ $ sh scripts/run-integration.sh
# run linter
$ npm run lint
# build all packages and put them near to their source .ts files
$ npm run build:prod
```
## <a name="rules"></a> Coding Rules
@@ -204,8 +203,8 @@ To ensure consistency throughout the source code, keep these rules in mind as yo
// We're working on auto-documentation.
* All public API methods **must be documented**. (Details TBC). -->
* All features or bug fixes **must be tested** by one or more specs (unit-tests).
* We follow [Google's JavaScript Style Guide][js-style-guide], but wrap all code at
- All features or bug fixes **must be tested** by one or more specs (unit-tests).
- We follow [Google's JavaScript Style Guide][js-style-guide], but wrap all code at
**100 characters**. An automated formatter is available (`npm run format`).
## <a name="commit"></a> Commit Message Guidelines
@@ -249,15 +248,15 @@ If the commit reverts a previous commit, it should begin with `revert:`, followe
Must be one of the following:
* **build**: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
* **ci**: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
* **docs**: Documentation only changes
* **feature**: A new feature
* **bugfix**: A bug fix
* **perf**: A code change that improves performance
* **refactor**: A code change that neither fixes a bug nor adds a feature
* **style**: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
* **test**: Adding missing tests or correcting existing tests
- **build**: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
- **ci**: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
- **docs**: Documentation only changes
- **feature**: A new feature
- **bugfix**: A bug fix
- **perf**: A code change that improves performance
- **refactor**: A code change that neither fixes a bug nor adds a feature
- **style**: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
- **test**: Adding missing tests or correcting existing tests
### Scope
@@ -265,28 +264,28 @@ The scope should be the name of the npm package affected (as perceived by person
The following is the list of supported scopes:
* **common**
* **core**
* **sample**
* **microservices**
* **testing**
* **websockets**
- **common**
- **core**
- **sample**
- **microservices**
- **testing**
- **websockets**
There are currently a few exceptions to the "use package name" rule:
* **packaging**: used for changes that change the npm package layout in all of our packages, e.g. public path changes, package.json changes done to all packages, d.ts file/format changes, changes to bundles, etc.
* **changelog**: used for updating the release notes in CHANGELOG.md
* **sample/#**: for the example apps directory, replacing # with the example app number
* none/empty string: useful for `style`, `test` and `refactor` changes that are done across all packages (e.g. `style: add missing semicolons`)
<!-- * **aio**: used for docs-app (angular.io) related changes within the /aio directory of the repo -->
- **packaging**: used for changes that change the npm package layout in all of our packages, e.g. public path changes, package.json changes done to all packages, d.ts file/format changes, changes to bundles, etc.
- **changelog**: used for updating the release notes in CHANGELOG.md
- **sample/#**: for the example apps directory, replacing # with the example app number
- none/empty string: useful for `style`, `test` and `refactor` changes that are done across all packages (e.g. `style: add missing semicolons`)
<!-- * **aio**: used for docs-app (angular.io) related changes within the /aio directory of the repo -->
### Subject
The subject contains succinct description of the change:
* use the imperative, present tense: "change" not "changed" nor "changes"
* don't capitalize first letter
* no dot (.) at the end
- use the imperative, present tense: "change" not "changed" nor "changes"
- don't capitalize first letter
- no dot (.) at the end
### Body

View File

@@ -2,18 +2,15 @@
<a href="http://nestjs.com/" target="blank"><img src="https://nestjs.com/img/logo_text.svg" width="320" alt="Nest Logo" /></a>
</p>
[travis-image]: https://api.travis-ci.org/nestjs/nest.svg?branch=master
[travis-url]: https://travis-ci.org/nestjs/nest
[linux-image]: https://img.shields.io/travis/nestjs/nest/master.svg?label=linux
[linux-url]: https://travis-ci.org/nestjs/nest
[circleci-image]: https://img.shields.io/circleci/build/github/nestjs/nest/master?token=abc123def456
[circleci-url]: https://circleci.com/gh/nestjs/nest
<p align="center">A progressive <a href="http://nodejs.org" target="_blank">Node.js</a> framework for building efficient and scalable server-side applications.</p>
<p align="center">
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/v/@nestjs/core.svg" alt="NPM Version" /></a>
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/l/@nestjs/core.svg" alt="Package License" /></a>
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/dm/@nestjs/core.svg" alt="NPM Downloads" /></a>
<a href="https://travis-ci.org/nestjs/nest" target="_blank"><img src="https://api.travis-ci.org/nestjs/nest.svg?branch=master" alt="Travis" /></a>
<a href="https://travis-ci.org/nestjs/nest" target="_blank"><img src="https://img.shields.io/travis/nestjs/nest/master.svg?label=linux" alt="Linux" /></a>
<a href="https://circleci.com/gh/nestjs/nest" target="_blank"><img src="https://img.shields.io/circleci/build/github/nestjs/nest/master" alt="CircleCI" /></a>
<a href="https://coveralls.io/github/nestjs/nest?branch=master" target="_blank"><img src="https://coveralls.io/repos/github/nestjs/nest/badge.svg?branch=master#9" alt="Coverage" /></a>
<a href="https://discord.gg/G7Qnnhy" target="_blank"><img src="https://img.shields.io/badge/discord-online-brightgreen.svg" alt="Discord"/></a>
<a href="https://opencollective.com/nest#backer" target="_blank"><img src="https://opencollective.com/nest/backers/badge.svg" alt="Backers on Open Collective" /></a>

File diff suppressed because it is too large Load Diff

View File

@@ -9,11 +9,11 @@
"start:prod": "node dist/main.js"
},
"dependencies": {
"@nestjs/common": "6.5.3",
"@nestjs/core": "6.5.3",
"@nestjs/graphql": "6.4.2",
"apollo-server-express": "2.8.1",
"graphql": "14.5.0",
"@nestjs/common": "6.6.6",
"@nestjs/core": "6.6.6",
"@nestjs/graphql": "6.5.0",
"apollo-server-express": "2.9.3",
"graphql": "14.5.4",
"graphql-tools": "4.0.5",
"reflect-metadata": "0.1.13",
"rxjs": "6.5.2",

View File

@@ -0,0 +1,59 @@
import { INestApplication, MiddlewareConsumer, Module } from '@nestjs/common';
import { Test } from '@nestjs/testing';
import * as request from 'supertest';
const RETURN_VALUE_A = 'test_A';
const RETURN_VALUE_B = 'test_B';
@Module({
imports: [],
})
class ModuleA {
configure(consumer: MiddlewareConsumer) {
consumer
.apply((req, res, next) => {
res.send(RETURN_VALUE_A);
})
.forRoutes('hello');
}
}
@Module({
imports: [ModuleA],
})
class ModuleB {
configure(consumer: MiddlewareConsumer) {
consumer
.apply((req, res, next) => {
res.send(RETURN_VALUE_B);
})
.forRoutes('hello');
}
}
@Module({
imports: [ModuleB],
})
class TestModule {}
describe('Middleware (execution order)', () => {
let app: INestApplication;
beforeEach(async () => {
app = (await Test.createTestingModule({
imports: [TestModule],
}).compile()).createNestApplication();
await app.init();
});
it(`should execute middleware in topological order`, () => {
return request(app.getHttpServer())
.get('/hello')
.expect(200, RETURN_VALUE_B);
});
afterEach(async () => {
await app.close();
});
});

View File

@@ -5,32 +5,32 @@
"requires": true,
"dependencies": {
"@nestjs/common": {
"version": "6.5.3",
"resolved": "https://registry.npmjs.org/@nestjs/common/-/common-6.5.3.tgz",
"integrity": "sha512-8d39grIMrUYGKM46BFWxB6csQFCu1S2aK7azPivg7gTRVSbvR84cVd6tgRVM0LwFpqQrtn3Q6G6Pa8FSk7Kh1w==",
"version": "6.6.6",
"resolved": "https://registry.npmjs.org/@nestjs/common/-/common-6.6.6.tgz",
"integrity": "sha512-JeeMkyHUHCVBWKts8rIfVuDwoYH8mZTnFPnQxlhZpDIJIfAHtsWr+zgQf5QaWMriE58v7mPAxC5I6upKFG8Njw==",
"requires": {
"axios": "0.19.0",
"cli-color": "1.4.0",
"uuid": "3.3.2"
"uuid": "3.3.3"
}
},
"@nestjs/core": {
"version": "6.5.3",
"resolved": "https://registry.npmjs.org/@nestjs/core/-/core-6.5.3.tgz",
"integrity": "sha512-ZhYfH49sVmUUw02qsaGozCFOOehlEABakYzRShyDDq30/2+ek3KpE0DfvA9tXlzX2KVrac2qDTBxMOPoJ+zY+g==",
"version": "6.6.6",
"resolved": "https://registry.npmjs.org/@nestjs/core/-/core-6.6.6.tgz",
"integrity": "sha512-Ay5B9JA5LLnxQXOk+rp8wYB/vsDJvKHqZ36eBuavJ3MLw30TAl0Bys/w78QxIqNjPGUmuEtwKNvluZtw5g9ciA==",
"requires": {
"@nuxtjs/opencollective": "0.2.2",
"fast-safe-stringify": "2.0.6",
"iterare": "1.2.0",
"object-hash": "1.3.1",
"optional": "0.1.4",
"uuid": "3.3.2"
"uuid": "3.3.3"
}
},
"@nestjs/microservices": {
"version": "6.5.3",
"resolved": "https://registry.npmjs.org/@nestjs/microservices/-/microservices-6.5.3.tgz",
"integrity": "sha512-T9zZf61myahenI4c0qhcYnhnx49L+zL9+8W6fc+LPTarbt1HJDu6iyj6fh2BzewakwNLJRyGMJ9YCYlXhFuvlA==",
"version": "6.6.6",
"resolved": "https://registry.npmjs.org/@nestjs/microservices/-/microservices-6.6.6.tgz",
"integrity": "sha512-2/l4QdLjXwH5uW9ZSWLKp99y/EbyoMmrBR0HZ7IH7Zc9DMb9ktGxHCTRrA+OrPT14jSqaIe3nD5M8tIAS8UsXg==",
"requires": {
"iterare": "1.2.0",
"json-socket": "0.3.0",
@@ -38,17 +38,17 @@
}
},
"@nestjs/testing": {
"version": "6.5.3",
"resolved": "https://registry.npmjs.org/@nestjs/testing/-/testing-6.5.3.tgz",
"integrity": "sha512-W8tPhkNVhmX+jaDu4R7WUOtIl0PK3ZDso434rEm/b1+S6ZRgAKwNVHWM/rwIuTi5+erPTEULtTsZgrXFrzC1sA==",
"version": "6.6.6",
"resolved": "https://registry.npmjs.org/@nestjs/testing/-/testing-6.6.6.tgz",
"integrity": "sha512-fByjujD8og97DlK2WoksGcjEULf3F/5Iwlk7CNixm2vNzmFtBNAYTh0C86cSVaHRuiF3EHBDwJxSotaPXeIcqw==",
"requires": {
"optional": "0.1.4"
}
},
"@nestjs/websockets": {
"version": "6.5.3",
"resolved": "https://registry.npmjs.org/@nestjs/websockets/-/websockets-6.5.3.tgz",
"integrity": "sha512-YrCvmLHTW0OBusTiUOPrG0PNrw/3Gatty/bh3ro5cEoiovcaJxGSMsTC+JSVXqPwRJjEtoHMCr5Qje2rAepIzQ==",
"version": "6.6.6",
"resolved": "https://registry.npmjs.org/@nestjs/websockets/-/websockets-6.6.6.tgz",
"integrity": "sha512-gpEz0unDj5g8SCngpJMURM+eaGRH8YAaPOuVGn/4RWSFvcMDSl9rSr1zg79JkFODqD1zRryAiff1xU1HNxHHJA==",
"requires": {
"iterare": "1.2.0"
}
@@ -121,9 +121,9 @@
"dev": true
},
"avvio": {
"version": "6.2.1",
"resolved": "https://registry.npmjs.org/avvio/-/avvio-6.2.1.tgz",
"integrity": "sha512-k+gTocL3yShwN1PtKEsSj7eFiApcZ4JZLAu/ecyzEb8jyx+Kmxb+7SXUsodB47g7fqhs/zkfsCdqq72a1ok5Ew==",
"version": "6.2.2",
"resolved": "https://registry.npmjs.org/avvio/-/avvio-6.2.2.tgz",
"integrity": "sha512-7+yznbJOMoHQ8Z8VH+1meyRjtxUW8za6gqnHBl8DqlX5qPtaclNIgWrKrTLuIbfn2+1/EGkcr+rQXI8DYVU4RA==",
"requires": {
"archy": "^1.0.0",
"debug": "^4.0.0",
@@ -227,9 +227,9 @@
"dev": true
},
"consola": {
"version": "2.9.0",
"resolved": "https://registry.npmjs.org/consola/-/consola-2.9.0.tgz",
"integrity": "sha512-34Iue+LRcWbndFIfZc5boNizWlsrRjqIBJZTe591vImgbnq7nx2EzlrLtANj9TH2Fxm7puFJBJAOk5BhvZOddQ=="
"version": "2.10.1",
"resolved": "https://registry.npmjs.org/consola/-/consola-2.10.1.tgz",
"integrity": "sha512-4sxpH6SGFYLADfUip4vuY65f/gEogrzJoniVhNUYkJHtng0l8ZjnDCqxxrSVRHOHwKxsy8Vm5ONZh1wOR3/l/w=="
},
"cookiejar": {
"version": "2.1.2",
@@ -278,9 +278,9 @@
"dev": true
},
"es5-ext": {
"version": "0.10.50",
"resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.50.tgz",
"integrity": "sha512-KMzZTPBkeQV/JcSQhI5/z6d9VWJ3EnQ194USTUwIYZ2ZbpN8+SGXQKt1h68EX44+qt+Fzr8DO17vnxrw7c3agw==",
"version": "0.10.51",
"resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.51.tgz",
"integrity": "sha512-oRpWzM2WcLHVKpnrcyB7OW8j/s67Ba04JCm0WnNv3RiABSvs7mrQlutB8DBv793gKcp0XENR8Il8WxGTlZ73gQ==",
"requires": {
"es6-iterator": "~2.0.3",
"es6-symbol": "~3.1.1",
@@ -372,19 +372,19 @@
"integrity": "sha512-q8BZ89jjc+mz08rSxROs8VsrBBcn1SIw1kq9NjolL509tkABRk9io01RAjSaEv1Xb2uFLt8VtRiZbGp5H8iDtg=="
},
"fastify": {
"version": "2.7.1",
"resolved": "https://registry.npmjs.org/fastify/-/fastify-2.7.1.tgz",
"integrity": "sha512-ScKPXD84lkdCgz7q0zjyBr1aLxKbXRt9HYL3XIt/L8ZD2f3fAcsLEyQ2/rHxLUzLGjPlEjIvprWUL3RZvlLRLw==",
"version": "2.8.0",
"resolved": "https://registry.npmjs.org/fastify/-/fastify-2.8.0.tgz",
"integrity": "sha512-+HXe9xZzbj79680hlehEs0B1Z3e5RQT6CtPthseqgRJy2i7Wlro8EEdM7u7ewwL9XREjLWssCPlJiZ3G+t4qsw==",
"requires": {
"abstract-logging": "^1.0.0",
"ajv": "^6.10.2",
"avvio": "^6.1.1",
"fast-json-stringify": "^1.15.0",
"avvio": "^6.2.2",
"fast-json-stringify": "^1.15.4",
"find-my-way": "^2.0.0",
"flatstr": "^1.0.12",
"light-my-request": "^3.4.1",
"middie": "^4.0.1",
"pino": "^5.13.1",
"pino": "^5.13.2",
"proxy-addr": "^2.0.4",
"readable-stream": "^3.1.1",
"rfdc": "^1.1.2",
@@ -401,9 +401,9 @@
}
},
"find-my-way": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/find-my-way/-/find-my-way-2.1.0.tgz",
"integrity": "sha512-Hdx6ctcrzkZH5y9EREHtXryXAgc5Bc8z5Cvoa61y9kaoYj2KU4yXD6h8b6u0NUkYPVmQQeRdf0AtG1kQxQ+ukQ==",
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/find-my-way/-/find-my-way-2.1.1.tgz",
"integrity": "sha512-yznKDx1xELFkTrV2Ke9x3IOr9zn5isdFA2Af/NKjU8kmQQhtn3TmqrVZ6OiLO5pj1dAScxe4dAo92ieG4nGcoA==",
"requires": {
"fast-decode-uri-component": "^1.0.0",
"safe-regex2": "^2.0.0",
@@ -595,9 +595,9 @@
"integrity": "sha512-ZOtfhPttCrqp2M1PBBH4X13XlvnfhIwD7yCLx+GoGoXRPQyxGOTdQMpIzPSPKXAJT/JQrdfFrgdJOyAzvgpQ9A=="
},
"pino": {
"version": "5.13.1",
"resolved": "https://registry.npmjs.org/pino/-/pino-5.13.1.tgz",
"integrity": "sha512-IxusG28L0g50uuf21kZELypdFOeNrJ/kRhktdi7LtdZQWCxLliMxG5iOrGUQ/ng7MiJ4XqXi/hfyXwZeKc1MxA==",
"version": "5.13.2",
"resolved": "https://registry.npmjs.org/pino/-/pino-5.13.2.tgz",
"integrity": "sha512-WwOSCy36/gWhinsqWqAnuwIi2WtcH+jvoyeLm3bjUALIrzWIst0AovQjK4jVvSN2l64KFPfi3gd2fjsTovjdLQ==",
"requires": {
"fast-redact": "^1.4.4",
"fast-safe-stringify": "^2.0.6",
@@ -684,7 +684,8 @@
"safe-buffer": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
"dev": true
},
"safe-regex2": {
"version": "2.0.0",
@@ -729,11 +730,18 @@
}
},
"string_decoder": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.2.0.tgz",
"integrity": "sha512-6YqyX6ZWEYguAxgZzHGL7SsCeGx3V2TtOTqZz1xSTSWnqsbWwbptafNyvf/ACquZUXV3DANr5BDIwNYe1mN42w==",
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",
"integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==",
"requires": {
"safe-buffer": "~5.1.0"
"safe-buffer": "~5.2.0"
},
"dependencies": {
"safe-buffer": {
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.0.tgz",
"integrity": "sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg=="
}
}
},
"superagent": {
@@ -837,9 +845,9 @@
"integrity": "sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ=="
},
"type": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/type/-/type-1.0.1.tgz",
"integrity": "sha512-MAM5dBMJCJNKs9E7JXo4CXRAansRfG0nlJxW7Wf6GZzSOvH31zClSaHdIMWLehe/EGMBkqeC55rrkaOr5Oo7Nw=="
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/type/-/type-1.0.3.tgz",
"integrity": "sha512-51IMtNfVcee8+9GJvj0spSuFcZHe9vSib6Xtgsny1Km9ugyz2mbS08I3rsUIRYgJohFRFU1160sgRodYz378Hg=="
},
"typescript": {
"version": "3.5.3",
@@ -860,9 +868,9 @@
"integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8="
},
"uuid": {
"version": "3.3.2",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz",
"integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA=="
"version": "3.3.3",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.3.tgz",
"integrity": "sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ=="
},
"validator": {
"version": "11.1.0",

View File

@@ -7,14 +7,14 @@
"start": "ts-node src/main"
},
"dependencies": {
"@nestjs/common": "6.5.3",
"@nestjs/core": "6.5.3",
"@nestjs/microservices": "6.5.3",
"@nestjs/testing": "6.5.3",
"@nestjs/websockets": "6.5.3",
"@nestjs/common": "6.6.6",
"@nestjs/core": "6.6.6",
"@nestjs/microservices": "6.6.6",
"@nestjs/testing": "6.6.6",
"@nestjs/websockets": "6.6.6",
"class-transformer": "0.2.3",
"class-validator": "0.10.0",
"fastify": "2.7.1",
"fastify": "2.8.0",
"reflect-metadata": "0.1.13",
"rxjs": "6.5.2",
"typescript": "3.5.3"

View File

@@ -0,0 +1,55 @@
import { Injectable, BeforeApplicationShutdown } from '@nestjs/common';
import { Test } from '@nestjs/testing';
import { expect } from 'chai';
import * as Sinon from 'sinon';
@Injectable()
class TestInjectable implements BeforeApplicationShutdown {
beforeApplicationShutdown = Sinon.spy();
}
describe('BeforeApplicationShutdown', () => {
it('should call `beforeApplicationShutdown` when application closes', async () => {
const module = await Test.createTestingModule({
providers: [TestInjectable],
}).compile();
const app = module.createNestApplication();
await app.close();
const instance = module.get(TestInjectable);
expect(instance.beforeApplicationShutdown.called).to.be.true;
});
it('should not stop the server once beforeApplicationShutdown has been called', async () => {
let resolve;
const promise = new Promise(r => (resolve = r));
const module = await Test.createTestingModule({
providers: [
{
provide: 'Test',
useValue: {
beforeApplicationShutdown: () => promise,
},
},
],
}).compile();
Sinon.stub(module, 'dispose' as any);
const app = module.createNestApplication();
app.close();
expect(((module as any).dispose as Sinon.SinonSpy).called, 'dispose')
.to.be.false;
resolve();
setTimeout(
() =>
expect(
((module as any).dispose as Sinon.SinonSpy).called,
'dispose',
).to.be.true,
0,
);
});
});

View File

@@ -0,0 +1,54 @@
import { expect } from 'chai';
import { spawnSync } from 'child_process';
import { join } from 'path';
describe('enableShutdownHooks', () => {
it('should call the correct hooks if any shutdown signal gets invoked', done => {
const result = spawnSync('ts-node', [
join(__dirname, '../src/enable-shutdown-hooks-main.ts'),
'SIGHUP',
]);
const calls = result.stdout
.toString()
.split('\n')
.map((call: string) => call.trim());
expect(calls[0]).to.equal('beforeApplicationShutdown SIGHUP');
expect(calls[1]).to.equal('onApplicationShutdown SIGHUP');
done();
}).timeout(5000);
it('should call the correct hooks if a specific shutdown signal gets invoked', done => {
const result = spawnSync('ts-node', [
join(__dirname, '../src/enable-shutdown-hooks-main.ts'),
'SIGINT',
'SIGINT',
]);
const calls = result.stdout
.toString()
.split('\n')
.map((call: string) => call.trim());
expect(calls[0]).to.equal('beforeApplicationShutdown SIGINT');
expect(calls[1]).to.equal('onApplicationShutdown SIGINT');
done();
}).timeout(5000);
it('should ignore system signals which are not specified', done => {
const result = spawnSync('ts-node', [
join(__dirname, '../src/enable-shutdown-hooks-main.ts'),
'SIGINT',
'SIGHUP',
]);
expect(result.stdout.toString().trim()).to.be.eq('');
done();
}).timeout(5000);
it('should ignore system signals if "enableShutdownHooks" was not called', done => {
const result = spawnSync('ts-node', [
join(__dirname, '../src/enable-shutdown-hooks-main.ts'),
'SIGINT',
'NONE',
]);
expect(result.stdout.toString().trim()).to.be.eq('');
done();
}).timeout(5000);
});

View File

@@ -1,5 +1,4 @@
import { Test } from '@nestjs/testing';
import { expect } from 'chai';
import * as Sinon from 'sinon';
import {
Injectable,
@@ -7,6 +6,7 @@ import {
OnApplicationShutdown,
OnModuleDestroy,
OnModuleInit,
BeforeApplicationShutdown,
} from '@nestjs/common';
@Injectable()
@@ -15,8 +15,10 @@ class TestInjectable
OnApplicationBootstrap,
OnModuleInit,
OnModuleDestroy,
OnApplicationShutdown {
OnApplicationShutdown,
BeforeApplicationShutdown {
onApplicationBootstrap = Sinon.spy();
beforeApplicationShutdown = Sinon.spy();
onApplicationShutdown = Sinon.spy();
onModuleDestroy = Sinon.spy();
onModuleInit = Sinon.spy();
@@ -37,6 +39,7 @@ describe('Lifecycle Hook Order', () => {
instance.onModuleInit,
instance.onApplicationBootstrap,
instance.onModuleDestroy,
instance.beforeApplicationShutdown,
instance.onApplicationShutdown,
);
});

View File

@@ -19,4 +19,26 @@ describe('OnApplicationBootstrap', () => {
const instance = module.get(TestInjectable);
expect(instance.onApplicationBootstrap.called).to.be.true;
});
it('should not throw an error when onApplicationBootstrap is null', async () => {
const module = await Test.createTestingModule({
providers: [
{ provide: 'TEST', useValue: { onApplicationBootstrap: null } }
],
}).compile();
const app = module.createNestApplication();
await app.init().then((obj) => expect(obj).to.not.be.undefined);
});
it('should not throw an error when onApplicationBootstrap is undefined', async () => {
const module = await Test.createTestingModule({
providers: [
{ provide: 'TEST', useValue: { onApplicationBootstrap: undefined } }
],
}).compile();
const app = module.createNestApplication();
await app.init().then((obj) => expect(obj).to.not.be.undefined);
});
});

View File

@@ -1,8 +1,6 @@
import { Injectable, OnApplicationShutdown } from '@nestjs/common';
import { Test } from '@nestjs/testing';
import { expect } from 'chai';
import { spawnSync } from 'child_process';
import { join } from 'path';
import * as Sinon from 'sinon';
@Injectable()
@@ -21,43 +19,4 @@ describe('OnApplicationShutdown', () => {
const instance = module.get(TestInjectable);
expect(instance.onApplicationShutdown.called).to.be.true;
});
it('should call onApplicationShutdown if any shutdown signal gets invoked', done => {
const result = spawnSync('ts-node', [
join(__dirname, '../src/main.ts'),
'SIGHUP',
]);
expect(result.stdout.toString().trim() === 'Signal SIGHUP').to.be.true;
done();
}).timeout(5000);
it('should call onApplicationShutdown if a specific shutdown signal gets invoked', done => {
const result = spawnSync('ts-node', [
join(__dirname, '../src/main.ts'),
'SIGINT',
'SIGINT',
]);
expect(result.stdout.toString().trim()).to.be.eq('Signal SIGINT');
done();
}).timeout(5000);
it('should ignore system signals which are not specified', done => {
const result = spawnSync('ts-node', [
join(__dirname, '../src/main.ts'),
'SIGINT',
'SIGHUP',
]);
expect(result.stdout.toString().trim()).to.be.eq('');
done();
}).timeout(5000);
it('should ignore system signals if "enableShutdownHooks" was not called', done => {
const result = spawnSync('ts-node', [
join(__dirname, '../src/main.ts'),
'SIGINT',
'NONE',
]);
expect(result.stdout.toString().trim()).to.be.eq('');
done();
}).timeout(5000);
});

View File

@@ -19,4 +19,26 @@ describe('OnModuleDestroy', () => {
const instance = module.get(TestInjectable);
expect(instance.onModuleDestroy.called).to.be.true;
});
it('should not throw an error when onModuleDestroy is null', async () => {
const module = await Test.createTestingModule({
providers: [
{ provide: 'TEST', useValue: { onModuleDestroy: null } }
],
}).compile();
const app = module.createNestApplication();
await app.init().then((obj) => expect(obj).to.not.be.undefined);
});
it('should not throw an error when onModuleDestroy is undefined', async () => {
const module = await Test.createTestingModule({
providers: [
{ provide: 'TEST', useValue: { onModuleDestroy: undefined } }
],
}).compile();
const app = module.createNestApplication();
await app.init().then((obj) => expect(obj).to.not.be.undefined);
});
});

View File

@@ -19,4 +19,26 @@ describe('OnModuleInit', () => {
const instance = module.get(TestInjectable);
expect(instance.onModuleInit.called).to.be.true;
});
it('should not throw an error when onModuleInit is null', async () => {
const module = await Test.createTestingModule({
providers: [
{ provide: 'TEST', useValue: { onModuleInit: null } }
],
}).compile();
const app = module.createNestApplication();
await app.init().then((obj) => expect(obj).to.not.be.undefined);
});
it('should not throw an error when onModuleInit is undefined', async () => {
const module = await Test.createTestingModule({
providers: [
{ provide: 'TEST', useValue: { onModuleInit: undefined } }
],
}).compile();
const app = module.createNestApplication();
await app.init().then((obj) => expect(obj).to.not.be.undefined);
});
});

View File

@@ -5,26 +5,26 @@
"requires": true,
"dependencies": {
"@nestjs/common": {
"version": "6.5.3",
"resolved": "https://registry.npmjs.org/@nestjs/common/-/common-6.5.3.tgz",
"integrity": "sha512-8d39grIMrUYGKM46BFWxB6csQFCu1S2aK7azPivg7gTRVSbvR84cVd6tgRVM0LwFpqQrtn3Q6G6Pa8FSk7Kh1w==",
"version": "6.6.6",
"resolved": "https://registry.npmjs.org/@nestjs/common/-/common-6.6.6.tgz",
"integrity": "sha512-JeeMkyHUHCVBWKts8rIfVuDwoYH8mZTnFPnQxlhZpDIJIfAHtsWr+zgQf5QaWMriE58v7mPAxC5I6upKFG8Njw==",
"requires": {
"axios": "0.19.0",
"cli-color": "1.4.0",
"uuid": "3.3.2"
"uuid": "3.3.3"
}
},
"@nestjs/core": {
"version": "6.5.3",
"resolved": "https://registry.npmjs.org/@nestjs/core/-/core-6.5.3.tgz",
"integrity": "sha512-ZhYfH49sVmUUw02qsaGozCFOOehlEABakYzRShyDDq30/2+ek3KpE0DfvA9tXlzX2KVrac2qDTBxMOPoJ+zY+g==",
"version": "6.6.6",
"resolved": "https://registry.npmjs.org/@nestjs/core/-/core-6.6.6.tgz",
"integrity": "sha512-Ay5B9JA5LLnxQXOk+rp8wYB/vsDJvKHqZ36eBuavJ3MLw30TAl0Bys/w78QxIqNjPGUmuEtwKNvluZtw5g9ciA==",
"requires": {
"@nuxtjs/opencollective": "0.2.2",
"fast-safe-stringify": "2.0.6",
"iterare": "1.2.0",
"object-hash": "1.3.1",
"optional": "0.1.4",
"uuid": "3.3.2"
"uuid": "3.3.3"
}
},
"@nuxtjs/opencollective": {
@@ -155,9 +155,9 @@
"dev": true
},
"consola": {
"version": "2.9.0",
"resolved": "https://registry.npmjs.org/consola/-/consola-2.9.0.tgz",
"integrity": "sha512-34Iue+LRcWbndFIfZc5boNizWlsrRjqIBJZTe591vImgbnq7nx2EzlrLtANj9TH2Fxm7puFJBJAOk5BhvZOddQ=="
"version": "2.10.1",
"resolved": "https://registry.npmjs.org/consola/-/consola-2.10.1.tgz",
"integrity": "sha512-4sxpH6SGFYLADfUip4vuY65f/gEogrzJoniVhNUYkJHtng0l8ZjnDCqxxrSVRHOHwKxsy8Vm5ONZh1wOR3/l/w=="
},
"cookiejar": {
"version": "2.1.2",
@@ -202,9 +202,9 @@
"dev": true
},
"es5-ext": {
"version": "0.10.50",
"resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.50.tgz",
"integrity": "sha512-KMzZTPBkeQV/JcSQhI5/z6d9VWJ3EnQ194USTUwIYZ2ZbpN8+SGXQKt1h68EX44+qt+Fzr8DO17vnxrw7c3agw==",
"version": "0.10.51",
"resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.51.tgz",
"integrity": "sha512-oRpWzM2WcLHVKpnrcyB7OW8j/s67Ba04JCm0WnNv3RiABSvs7mrQlutB8DBv793gKcp0XENR8Il8WxGTlZ73gQ==",
"requires": {
"es6-iterator": "~2.0.3",
"es6-symbol": "~3.1.1",
@@ -562,9 +562,9 @@
"integrity": "sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ=="
},
"type": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/type/-/type-1.0.1.tgz",
"integrity": "sha512-MAM5dBMJCJNKs9E7JXo4CXRAansRfG0nlJxW7Wf6GZzSOvH31zClSaHdIMWLehe/EGMBkqeC55rrkaOr5Oo7Nw=="
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/type/-/type-1.0.3.tgz",
"integrity": "sha512-51IMtNfVcee8+9GJvj0spSuFcZHe9vSib6Xtgsny1Km9ugyz2mbS08I3rsUIRYgJohFRFU1160sgRodYz378Hg=="
},
"typescript": {
"version": "3.5.3",
@@ -578,9 +578,9 @@
"dev": true
},
"uuid": {
"version": "3.3.2",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz",
"integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA=="
"version": "3.3.3",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.3.tgz",
"integrity": "sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ=="
},
"validator": {
"version": "11.1.0",

View File

@@ -7,8 +7,8 @@
"start": "ts-node src/main"
},
"dependencies": {
"@nestjs/common": "6.5.3",
"@nestjs/core": "6.5.3",
"@nestjs/common": "6.6.6",
"@nestjs/core": "6.6.6",
"class-transformer": "0.2.3",
"class-validator": "0.10.0",
"reflect-metadata": "0.1.13",

View File

@@ -1,12 +1,16 @@
import { Injectable, OnApplicationShutdown, Module } from '@nestjs/common';
import { Injectable, OnApplicationShutdown, BeforeApplicationShutdown, Module } from '@nestjs/common';
import { NestFactory } from '@nestjs/core';
const SIGNAL = process.argv[2];
const SIGNAL_TO_LISTEN = process.argv[3];
@Injectable()
class TestInjectable implements OnApplicationShutdown {
class TestInjectable implements OnApplicationShutdown, BeforeApplicationShutdown {
beforeApplicationShutdown(signal: string) {
console.log('beforeApplicationShutdown ' + signal);
}
onApplicationShutdown(signal: string) {
console.log('Signal ' + signal);
console.log('onApplicationShutdown ' + signal);
}
}

View File

@@ -0,0 +1,54 @@
import { InvalidClassScopeException } from '@nestjs/core/errors/exceptions/invalid-class-scope.exception';
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 { ScopedService } from '../src/scoped/scoped.service';
import { TransientService } from '../src/scoped/transient.service';
describe('Scoped Instances', () => {
let testingModule: TestingModule;
beforeEach(async () => {
testingModule = await Test.createTestingModule({
imports: [ScopedModule],
}).compile();
});
it('should dynamically resolve transient provider', async () => {
const transient1 = await testingModule.resolve(TransientService);
const transient2 = await testingModule.resolve(TransientService);
expect(transient1).to.be.instanceOf(TransientService);
expect(transient2).to.be.instanceOf(TransientService);
expect(transient1).to.be.equal(transient2);
});
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 });
expect(request1).to.be.instanceOf(ScopedService);
expect(request2).to.be.instanceOf(ScopedService);
expect(request3).to.not.be.equal(request2);
});
it('should dynamically resolve request-scoped controller', async () => {
const request1 = await testingModule.resolve(ScopedController);
const request2 = await testingModule.resolve(ScopedController);
const request3 = await testingModule.resolve(ScopedController, { id: 1 });
expect(request1).to.be.instanceOf(ScopedController);
expect(request2).to.be.instanceOf(ScopedController);
expect(request3).to.not.be.equal(request2);
});
it('should throw an exception when "get()" method is used', async () => {
try {
testingModule.get(ScopedController);
} catch (err) {
expect(err).to.be.instanceOf(InvalidClassScopeException);
}
});
});

View File

@@ -5,32 +5,32 @@
"requires": true,
"dependencies": {
"@nestjs/common": {
"version": "6.5.3",
"resolved": "https://registry.npmjs.org/@nestjs/common/-/common-6.5.3.tgz",
"integrity": "sha512-8d39grIMrUYGKM46BFWxB6csQFCu1S2aK7azPivg7gTRVSbvR84cVd6tgRVM0LwFpqQrtn3Q6G6Pa8FSk7Kh1w==",
"version": "6.6.6",
"resolved": "https://registry.npmjs.org/@nestjs/common/-/common-6.6.6.tgz",
"integrity": "sha512-JeeMkyHUHCVBWKts8rIfVuDwoYH8mZTnFPnQxlhZpDIJIfAHtsWr+zgQf5QaWMriE58v7mPAxC5I6upKFG8Njw==",
"requires": {
"axios": "0.19.0",
"cli-color": "1.4.0",
"uuid": "3.3.2"
"uuid": "3.3.3"
}
},
"@nestjs/core": {
"version": "6.5.3",
"resolved": "https://registry.npmjs.org/@nestjs/core/-/core-6.5.3.tgz",
"integrity": "sha512-ZhYfH49sVmUUw02qsaGozCFOOehlEABakYzRShyDDq30/2+ek3KpE0DfvA9tXlzX2KVrac2qDTBxMOPoJ+zY+g==",
"version": "6.6.6",
"resolved": "https://registry.npmjs.org/@nestjs/core/-/core-6.6.6.tgz",
"integrity": "sha512-Ay5B9JA5LLnxQXOk+rp8wYB/vsDJvKHqZ36eBuavJ3MLw30TAl0Bys/w78QxIqNjPGUmuEtwKNvluZtw5g9ciA==",
"requires": {
"@nuxtjs/opencollective": "0.2.2",
"fast-safe-stringify": "2.0.6",
"iterare": "1.2.0",
"object-hash": "1.3.1",
"optional": "0.1.4",
"uuid": "3.3.2"
"uuid": "3.3.3"
}
},
"@nestjs/microservices": {
"version": "6.5.3",
"resolved": "https://registry.npmjs.org/@nestjs/microservices/-/microservices-6.5.3.tgz",
"integrity": "sha512-T9zZf61myahenI4c0qhcYnhnx49L+zL9+8W6fc+LPTarbt1HJDu6iyj6fh2BzewakwNLJRyGMJ9YCYlXhFuvlA==",
"version": "6.6.6",
"resolved": "https://registry.npmjs.org/@nestjs/microservices/-/microservices-6.6.6.tgz",
"integrity": "sha512-2/l4QdLjXwH5uW9ZSWLKp99y/EbyoMmrBR0HZ7IH7Zc9DMb9ktGxHCTRrA+OrPT14jSqaIe3nD5M8tIAS8UsXg==",
"requires": {
"iterare": "1.2.0",
"json-socket": "0.3.0",
@@ -38,17 +38,17 @@
}
},
"@nestjs/testing": {
"version": "6.5.3",
"resolved": "https://registry.npmjs.org/@nestjs/testing/-/testing-6.5.3.tgz",
"integrity": "sha512-W8tPhkNVhmX+jaDu4R7WUOtIl0PK3ZDso434rEm/b1+S6ZRgAKwNVHWM/rwIuTi5+erPTEULtTsZgrXFrzC1sA==",
"version": "6.6.6",
"resolved": "https://registry.npmjs.org/@nestjs/testing/-/testing-6.6.6.tgz",
"integrity": "sha512-fByjujD8og97DlK2WoksGcjEULf3F/5Iwlk7CNixm2vNzmFtBNAYTh0C86cSVaHRuiF3EHBDwJxSotaPXeIcqw==",
"requires": {
"optional": "0.1.4"
}
},
"@nestjs/websockets": {
"version": "6.5.3",
"resolved": "https://registry.npmjs.org/@nestjs/websockets/-/websockets-6.5.3.tgz",
"integrity": "sha512-YrCvmLHTW0OBusTiUOPrG0PNrw/3Gatty/bh3ro5cEoiovcaJxGSMsTC+JSVXqPwRJjEtoHMCr5Qje2rAepIzQ==",
"version": "6.6.6",
"resolved": "https://registry.npmjs.org/@nestjs/websockets/-/websockets-6.6.6.tgz",
"integrity": "sha512-gpEz0unDj5g8SCngpJMURM+eaGRH8YAaPOuVGn/4RWSFvcMDSl9rSr1zg79JkFODqD1zRryAiff1xU1HNxHHJA==",
"requires": {
"iterare": "1.2.0"
}
@@ -181,9 +181,9 @@
"dev": true
},
"consola": {
"version": "2.9.0",
"resolved": "https://registry.npmjs.org/consola/-/consola-2.9.0.tgz",
"integrity": "sha512-34Iue+LRcWbndFIfZc5boNizWlsrRjqIBJZTe591vImgbnq7nx2EzlrLtANj9TH2Fxm7puFJBJAOk5BhvZOddQ=="
"version": "2.10.1",
"resolved": "https://registry.npmjs.org/consola/-/consola-2.10.1.tgz",
"integrity": "sha512-4sxpH6SGFYLADfUip4vuY65f/gEogrzJoniVhNUYkJHtng0l8ZjnDCqxxrSVRHOHwKxsy8Vm5ONZh1wOR3/l/w=="
},
"cookiejar": {
"version": "2.1.2",
@@ -228,9 +228,9 @@
"dev": true
},
"es5-ext": {
"version": "0.10.50",
"resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.50.tgz",
"integrity": "sha512-KMzZTPBkeQV/JcSQhI5/z6d9VWJ3EnQ194USTUwIYZ2ZbpN8+SGXQKt1h68EX44+qt+Fzr8DO17vnxrw7c3agw==",
"version": "0.10.51",
"resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.51.tgz",
"integrity": "sha512-oRpWzM2WcLHVKpnrcyB7OW8j/s67Ba04JCm0WnNv3RiABSvs7mrQlutB8DBv793gKcp0XENR8Il8WxGTlZ73gQ==",
"requires": {
"es6-iterator": "~2.0.3",
"es6-symbol": "~3.1.1",
@@ -593,9 +593,9 @@
"integrity": "sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ=="
},
"type": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/type/-/type-1.0.1.tgz",
"integrity": "sha512-MAM5dBMJCJNKs9E7JXo4CXRAansRfG0nlJxW7Wf6GZzSOvH31zClSaHdIMWLehe/EGMBkqeC55rrkaOr5Oo7Nw=="
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/type/-/type-1.0.3.tgz",
"integrity": "sha512-51IMtNfVcee8+9GJvj0spSuFcZHe9vSib6Xtgsny1Km9ugyz2mbS08I3rsUIRYgJohFRFU1160sgRodYz378Hg=="
},
"typescript": {
"version": "3.5.3",
@@ -609,9 +609,9 @@
"dev": true
},
"uuid": {
"version": "3.3.2",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz",
"integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA=="
"version": "3.3.3",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.3.tgz",
"integrity": "sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ=="
},
"validator": {
"version": "11.1.0",

View File

@@ -7,11 +7,11 @@
"start": "ts-node src/main"
},
"dependencies": {
"@nestjs/common": "6.5.3",
"@nestjs/core": "6.5.3",
"@nestjs/microservices": "6.5.3",
"@nestjs/testing": "6.5.3",
"@nestjs/websockets": "6.5.3",
"@nestjs/common": "6.6.6",
"@nestjs/core": "6.6.6",
"@nestjs/microservices": "6.6.6",
"@nestjs/testing": "6.6.6",
"@nestjs/websockets": "6.6.6",
"class-transformer": "0.2.3",
"class-validator": "0.10.0",
"reflect-metadata": "0.1.13",

View File

@@ -0,0 +1,7 @@
import { Controller, Scope } from '@nestjs/common';
@Controller({
path: 'test',
scope: Scope.REQUEST,
})
export class ScopedController {}

View File

@@ -0,0 +1,10 @@
import { Module } from '@nestjs/common';
import { ScopedController } from './scoped.controller';
import { ScopedService } from './scoped.service';
import { TransientService } from './transient.service';
@Module({
controllers: [ScopedController],
providers: [ScopedService, TransientService],
})
export class ScopedModule {}

View File

@@ -0,0 +1,4 @@
import { Injectable, Scope } from '@nestjs/common';
@Injectable({ scope: Scope.REQUEST })
export class ScopedService {}

View File

@@ -0,0 +1,4 @@
import { Injectable, Scope } from '@nestjs/common';
@Injectable({ scope: Scope.TRANSIENT })
export class TransientService {}

View File

@@ -18,9 +18,15 @@ describe('MQTT transport', () => {
app.connectMicroservice({
transport: Transport.MQTT,
options: {
host: '0.0.0.0',
},
});
app.connectMicroservice({
transport: Transport.MQTT,
options: {
host: '0.0.0.0',
},
});
await app.startAllMicroservicesAsync();
await app.init();

View File

@@ -18,9 +18,15 @@ describe('NATS transport', () => {
app.connectMicroservice({
transport: Transport.NATS,
options: {
url: 'nats://0.0.0.0:4222',
},
});
app.connectMicroservice({
transport: Transport.NATS,
options: {
url: 'nats://0.0.0.0:4222',
},
});
await app.startAllMicroservicesAsync();
await app.init();

View File

@@ -18,9 +18,15 @@ describe('REDIS transport', () => {
app.connectMicroservice({
transport: Transport.REDIS,
options: {
url: 'redis://0.0.0.0:6379',
},
});
app.connectMicroservice({
transport: Transport.REDIS,
options: {
url: 'redis://0.0.0.0:6379',
},
});
await app.startAllMicroservicesAsync();
await app.init();

View File

@@ -19,6 +19,9 @@ describe('MQTT transport', () => {
app.connectMicroservice({
transport: Transport.MQTT,
options: {
url: 'mqtt://0.0.0.0:1883',
},
});
await app.startAllMicroservicesAsync();
await app.init();
@@ -46,6 +49,8 @@ describe('MQTT transport', () => {
.expect(200, '15');
});
/**
* Figure out race conditions here (flaky tests)
it(`/POST (concurrent)`, function() {
this.retries(10);
return request(server)
@@ -63,7 +68,7 @@ describe('MQTT transport', () => {
Array.from({ length: 10 }, (v, k) => k + 91),
])
.expect(200, 'true');
}).timeout(5000);
}).timeout(5000); */
it(`/POST (streaming)`, () => {
return request(server)

View File

@@ -20,7 +20,7 @@ describe('NATS transport', () => {
app.connectMicroservice({
transport: Transport.NATS,
options: {
url: 'nats://localhost:4222',
url: 'nats://0.0.0.0:4222',
},
});
await app.startAllMicroservicesAsync();

View File

@@ -19,6 +19,9 @@ describe('REDIS transport', () => {
app.connectMicroservice({
transport: Transport.REDIS,
options: {
url: 'redis://0.0.0.0:6379',
},
});
await app.startAllMicroservicesAsync();
await app.init();

View File

@@ -20,7 +20,7 @@ describe('RabbitMQ transport', () => {
app.connectMicroservice({
transport: Transport.RMQ,
options: {
urls: [`amqp://localhost:5672`],
urls: [`amqp://0.0.0.0:5672`],
queue: 'test',
queueOptions: { durable: false },
socketOptions: { noDelay: true },

View File

@@ -20,6 +20,9 @@ describe('RPC transport', () => {
app.connectMicroservice({
transport: Transport.TCP,
options: {
host: '0.0.0.0',
},
});
await app.startAllMicroservicesAsync();
await app.init();

View File

@@ -5,32 +5,32 @@
"requires": true,
"dependencies": {
"@nestjs/common": {
"version": "6.5.3",
"resolved": "https://registry.npmjs.org/@nestjs/common/-/common-6.5.3.tgz",
"integrity": "sha512-8d39grIMrUYGKM46BFWxB6csQFCu1S2aK7azPivg7gTRVSbvR84cVd6tgRVM0LwFpqQrtn3Q6G6Pa8FSk7Kh1w==",
"version": "6.6.6",
"resolved": "https://registry.npmjs.org/@nestjs/common/-/common-6.6.6.tgz",
"integrity": "sha512-JeeMkyHUHCVBWKts8rIfVuDwoYH8mZTnFPnQxlhZpDIJIfAHtsWr+zgQf5QaWMriE58v7mPAxC5I6upKFG8Njw==",
"requires": {
"axios": "0.19.0",
"cli-color": "1.4.0",
"uuid": "3.3.2"
"uuid": "3.3.3"
}
},
"@nestjs/core": {
"version": "6.5.3",
"resolved": "https://registry.npmjs.org/@nestjs/core/-/core-6.5.3.tgz",
"integrity": "sha512-ZhYfH49sVmUUw02qsaGozCFOOehlEABakYzRShyDDq30/2+ek3KpE0DfvA9tXlzX2KVrac2qDTBxMOPoJ+zY+g==",
"version": "6.6.6",
"resolved": "https://registry.npmjs.org/@nestjs/core/-/core-6.6.6.tgz",
"integrity": "sha512-Ay5B9JA5LLnxQXOk+rp8wYB/vsDJvKHqZ36eBuavJ3MLw30TAl0Bys/w78QxIqNjPGUmuEtwKNvluZtw5g9ciA==",
"requires": {
"@nuxtjs/opencollective": "0.2.2",
"fast-safe-stringify": "2.0.6",
"iterare": "1.2.0",
"object-hash": "1.3.1",
"optional": "0.1.4",
"uuid": "3.3.2"
"uuid": "3.3.3"
}
},
"@nestjs/microservices": {
"version": "6.5.3",
"resolved": "https://registry.npmjs.org/@nestjs/microservices/-/microservices-6.5.3.tgz",
"integrity": "sha512-T9zZf61myahenI4c0qhcYnhnx49L+zL9+8W6fc+LPTarbt1HJDu6iyj6fh2BzewakwNLJRyGMJ9YCYlXhFuvlA==",
"version": "6.6.6",
"resolved": "https://registry.npmjs.org/@nestjs/microservices/-/microservices-6.6.6.tgz",
"integrity": "sha512-2/l4QdLjXwH5uW9ZSWLKp99y/EbyoMmrBR0HZ7IH7Zc9DMb9ktGxHCTRrA+OrPT14jSqaIe3nD5M8tIAS8UsXg==",
"requires": {
"iterare": "1.2.0",
"json-socket": "0.3.0",
@@ -38,9 +38,9 @@
}
},
"@nestjs/platform-express": {
"version": "6.5.3",
"resolved": "https://registry.npmjs.org/@nestjs/platform-express/-/platform-express-6.5.3.tgz",
"integrity": "sha512-c5n4XUbDDmF6MfBGYWM1jtsIDpVsOfOQtf3S0w3IeJNqm7dnmVAvO2Jk+RsYpt50tN4NAXntM3YTuTDqMb9uiA==",
"version": "6.6.6",
"resolved": "https://registry.npmjs.org/@nestjs/platform-express/-/platform-express-6.6.6.tgz",
"integrity": "sha512-hOxFCZb4jSv6QO3Y+fY0clxdOC9LYwyD66gSI0wx77LS2R5VM38QIClexfTB6mi12HmYfopIiM7kaj9Fkb2xtQ==",
"requires": {
"body-parser": "1.19.0",
"cors": "2.8.5",
@@ -49,17 +49,17 @@
}
},
"@nestjs/testing": {
"version": "6.5.3",
"resolved": "https://registry.npmjs.org/@nestjs/testing/-/testing-6.5.3.tgz",
"integrity": "sha512-W8tPhkNVhmX+jaDu4R7WUOtIl0PK3ZDso434rEm/b1+S6ZRgAKwNVHWM/rwIuTi5+erPTEULtTsZgrXFrzC1sA==",
"version": "6.6.6",
"resolved": "https://registry.npmjs.org/@nestjs/testing/-/testing-6.6.6.tgz",
"integrity": "sha512-fByjujD8og97DlK2WoksGcjEULf3F/5Iwlk7CNixm2vNzmFtBNAYTh0C86cSVaHRuiF3EHBDwJxSotaPXeIcqw==",
"requires": {
"optional": "0.1.4"
}
},
"@nestjs/websockets": {
"version": "6.5.3",
"resolved": "https://registry.npmjs.org/@nestjs/websockets/-/websockets-6.5.3.tgz",
"integrity": "sha512-YrCvmLHTW0OBusTiUOPrG0PNrw/3Gatty/bh3ro5cEoiovcaJxGSMsTC+JSVXqPwRJjEtoHMCr5Qje2rAepIzQ==",
"version": "6.6.6",
"resolved": "https://registry.npmjs.org/@nestjs/websockets/-/websockets-6.6.6.tgz",
"integrity": "sha512-gpEz0unDj5g8SCngpJMURM+eaGRH8YAaPOuVGn/4RWSFvcMDSl9rSr1zg79JkFODqD1zRryAiff1xU1HNxHHJA==",
"requires": {
"iterare": "1.2.0"
}
@@ -324,9 +324,9 @@
}
},
"consola": {
"version": "2.9.0",
"resolved": "https://registry.npmjs.org/consola/-/consola-2.9.0.tgz",
"integrity": "sha512-34Iue+LRcWbndFIfZc5boNizWlsrRjqIBJZTe591vImgbnq7nx2EzlrLtANj9TH2Fxm7puFJBJAOk5BhvZOddQ=="
"version": "2.10.1",
"resolved": "https://registry.npmjs.org/consola/-/consola-2.10.1.tgz",
"integrity": "sha512-4sxpH6SGFYLADfUip4vuY65f/gEogrzJoniVhNUYkJHtng0l8ZjnDCqxxrSVRHOHwKxsy8Vm5ONZh1wOR3/l/w=="
},
"content-disposition": {
"version": "0.5.3",
@@ -431,9 +431,9 @@
"integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k="
},
"es5-ext": {
"version": "0.10.50",
"resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.50.tgz",
"integrity": "sha512-KMzZTPBkeQV/JcSQhI5/z6d9VWJ3EnQ194USTUwIYZ2ZbpN8+SGXQKt1h68EX44+qt+Fzr8DO17vnxrw7c3agw==",
"version": "0.10.51",
"resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.51.tgz",
"integrity": "sha512-oRpWzM2WcLHVKpnrcyB7OW8j/s67Ba04JCm0WnNv3RiABSvs7mrQlutB8DBv793gKcp0XENR8Il8WxGTlZ73gQ==",
"requires": {
"es6-iterator": "~2.0.3",
"es6-symbol": "~3.1.1",
@@ -1117,9 +1117,9 @@
"integrity": "sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ=="
},
"type": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/type/-/type-1.0.1.tgz",
"integrity": "sha512-MAM5dBMJCJNKs9E7JXo4CXRAansRfG0nlJxW7Wf6GZzSOvH31zClSaHdIMWLehe/EGMBkqeC55rrkaOr5Oo7Nw=="
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/type/-/type-1.0.3.tgz",
"integrity": "sha512-51IMtNfVcee8+9GJvj0spSuFcZHe9vSib6Xtgsny1Km9ugyz2mbS08I3rsUIRYgJohFRFU1160sgRodYz378Hg=="
},
"type-is": {
"version": "1.6.18",
@@ -1171,9 +1171,9 @@
"integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM="
},
"uuid": {
"version": "3.3.2",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz",
"integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA=="
"version": "3.3.3",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.3.tgz",
"integrity": "sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ=="
},
"validator": {
"version": "11.1.0",

View File

@@ -7,12 +7,12 @@
"start": "ts-node src/main"
},
"dependencies": {
"@nestjs/common": "6.5.3",
"@nestjs/core": "6.5.3",
"@nestjs/microservices": "6.5.3",
"@nestjs/platform-express": "6.5.3",
"@nestjs/testing": "6.5.3",
"@nestjs/websockets": "6.5.3",
"@nestjs/common": "6.6.6",
"@nestjs/core": "6.6.6",
"@nestjs/microservices": "6.6.6",
"@nestjs/platform-express": "6.6.6",
"@nestjs/testing": "6.6.6",
"@nestjs/websockets": "6.6.6",
"amqp-connection-manager": "3.0.0",
"class-transformer": "0.2.3",
"class-validator": "0.10.0",

View File

@@ -25,26 +25,26 @@
}
},
"@nestjs/common": {
"version": "6.5.3",
"resolved": "https://registry.npmjs.org/@nestjs/common/-/common-6.5.3.tgz",
"integrity": "sha512-8d39grIMrUYGKM46BFWxB6csQFCu1S2aK7azPivg7gTRVSbvR84cVd6tgRVM0LwFpqQrtn3Q6G6Pa8FSk7Kh1w==",
"version": "6.6.6",
"resolved": "https://registry.npmjs.org/@nestjs/common/-/common-6.6.6.tgz",
"integrity": "sha512-JeeMkyHUHCVBWKts8rIfVuDwoYH8mZTnFPnQxlhZpDIJIfAHtsWr+zgQf5QaWMriE58v7mPAxC5I6upKFG8Njw==",
"requires": {
"axios": "0.19.0",
"cli-color": "1.4.0",
"uuid": "3.3.2"
"uuid": "3.3.3"
}
},
"@nestjs/core": {
"version": "6.5.3",
"resolved": "https://registry.npmjs.org/@nestjs/core/-/core-6.5.3.tgz",
"integrity": "sha512-ZhYfH49sVmUUw02qsaGozCFOOehlEABakYzRShyDDq30/2+ek3KpE0DfvA9tXlzX2KVrac2qDTBxMOPoJ+zY+g==",
"version": "6.6.6",
"resolved": "https://registry.npmjs.org/@nestjs/core/-/core-6.6.6.tgz",
"integrity": "sha512-Ay5B9JA5LLnxQXOk+rp8wYB/vsDJvKHqZ36eBuavJ3MLw30TAl0Bys/w78QxIqNjPGUmuEtwKNvluZtw5g9ciA==",
"requires": {
"@nuxtjs/opencollective": "0.2.2",
"fast-safe-stringify": "2.0.6",
"iterare": "1.2.0",
"object-hash": "1.3.1",
"optional": "0.1.4",
"uuid": "3.3.2"
"uuid": "3.3.3"
}
},
"@nestjs/mongoose": {
@@ -72,9 +72,9 @@
}
},
"@types/mongodb": {
"version": "3.3.0",
"resolved": "https://registry.npmjs.org/@types/mongodb/-/mongodb-3.3.0.tgz",
"integrity": "sha512-YMrve0uBOqFDEiezQk3AfWV73g871/rQTAEb8Y2CSlbySnV/2OyerI1DAOUUJQaIqGEWWaYF6GMPO6wTErLUuw==",
"version": "3.3.1",
"resolved": "https://registry.npmjs.org/@types/mongodb/-/mongodb-3.3.1.tgz",
"integrity": "sha512-Va7o1fN3zeabmIJSQ6yuAWkqPvrT38HSTIi4YbVOb2UL7FJ4diXrWt+OUuuEFWAVPtF9VZV5h+7LDYdzgXWgQA==",
"dev": true,
"requires": {
"@types/bson": "*",
@@ -82,9 +82,9 @@
}
},
"@types/mongoose": {
"version": "5.5.13",
"resolved": "https://registry.npmjs.org/@types/mongoose/-/mongoose-5.5.13.tgz",
"integrity": "sha512-k7Kxk5gugsZhkl7euWH1p6lmIdh9W8AsQgX0cO7kaihBie/P3ywU8LFMqo9ey6frdHBlGVaNICTeFZ/pZ6s5Lg==",
"version": "5.5.16",
"resolved": "https://registry.npmjs.org/@types/mongoose/-/mongoose-5.5.16.tgz",
"integrity": "sha512-He7VRmleSucCi63v2Hihy+ii1IqG4nTuXWsNrYXeCk7cBZ4J7jufbNcUNjswsDlSr9Ir1Eai/AQC9qDtecsXtA==",
"dev": true,
"requires": {
"@types/mongodb": "*",
@@ -229,9 +229,9 @@
"dev": true
},
"consola": {
"version": "2.9.0",
"resolved": "https://registry.npmjs.org/consola/-/consola-2.9.0.tgz",
"integrity": "sha512-34Iue+LRcWbndFIfZc5boNizWlsrRjqIBJZTe591vImgbnq7nx2EzlrLtANj9TH2Fxm7puFJBJAOk5BhvZOddQ=="
"version": "2.10.1",
"resolved": "https://registry.npmjs.org/consola/-/consola-2.10.1.tgz",
"integrity": "sha512-4sxpH6SGFYLADfUip4vuY65f/gEogrzJoniVhNUYkJHtng0l8ZjnDCqxxrSVRHOHwKxsy8Vm5ONZh1wOR3/l/w=="
},
"d": {
"version": "1.0.1",
@@ -264,9 +264,9 @@
"dev": true
},
"es5-ext": {
"version": "0.10.50",
"resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.50.tgz",
"integrity": "sha512-KMzZTPBkeQV/JcSQhI5/z6d9VWJ3EnQ194USTUwIYZ2ZbpN8+SGXQKt1h68EX44+qt+Fzr8DO17vnxrw7c3agw==",
"version": "0.10.51",
"resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.51.tgz",
"integrity": "sha512-oRpWzM2WcLHVKpnrcyB7OW8j/s67Ba04JCm0WnNv3RiABSvs7mrQlutB8DBv793gKcp0XENR8Il8WxGTlZ73gQ==",
"requires": {
"es6-iterator": "~2.0.3",
"es6-symbol": "~3.1.1",
@@ -415,9 +415,9 @@
}
},
"kareem": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/kareem/-/kareem-2.3.0.tgz",
"integrity": "sha512-6hHxsp9e6zQU8nXsP+02HGWXwTkOEw6IROhF2ZA28cYbUk4eJ6QbtZvdqZOdD9YPKghG3apk5eOCvs+tLl3lRg=="
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/kareem/-/kareem-2.3.1.tgz",
"integrity": "sha512-l3hLhffs9zqoDe8zjmb/mAN4B8VT3L56EUvKNqLFVs9YlFA+zx7ke1DO8STAdDyYNkeSo1nKmjuvQeI12So8Xw=="
},
"lodash": {
"version": "4.17.15",
@@ -504,13 +504,13 @@
}
},
"mongoose": {
"version": "5.6.10",
"resolved": "https://registry.npmjs.org/mongoose/-/mongoose-5.6.10.tgz",
"integrity": "sha512-lxWvF4Vl2118K2nZTj+QAEEmNBCbmUAcmF/roe8d+68Np4RXKEQvmpqm1c3aIlE9AVMp//eKB8IfXr38ZHe0Zw==",
"version": "5.6.11",
"resolved": "https://registry.npmjs.org/mongoose/-/mongoose-5.6.11.tgz",
"integrity": "sha512-+Mxfmu2Jcspmdqk1111BLUj5mzSLHWKVovImkjzO9GMymTwkHshsuSFmUN7ou4dWy2WR8DPSJcwU52HhnnNk8Q==",
"requires": {
"async": "2.6.2",
"bson": "~1.1.1",
"kareem": "2.3.0",
"kareem": "2.3.1",
"mongodb": "3.2.7",
"mongodb-core": "3.2.7",
"mongoose-legacy-pluralize": "1.0.2",
@@ -766,9 +766,9 @@
}
},
"type": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/type/-/type-1.0.1.tgz",
"integrity": "sha512-MAM5dBMJCJNKs9E7JXo4CXRAansRfG0nlJxW7Wf6GZzSOvH31zClSaHdIMWLehe/EGMBkqeC55rrkaOr5Oo7Nw=="
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/type/-/type-1.0.3.tgz",
"integrity": "sha512-51IMtNfVcee8+9GJvj0spSuFcZHe9vSib6Xtgsny1Km9ugyz2mbS08I3rsUIRYgJohFRFU1160sgRodYz378Hg=="
},
"typescript": {
"version": "3.5.3",
@@ -776,9 +776,9 @@
"integrity": "sha512-ACzBtm/PhXBDId6a6sDJfroT2pOWt/oOnk4/dElG5G33ZL776N3Y6/6bKZJBFpd+b05F3Ct9qDjMeJmRWtE2/g=="
},
"uuid": {
"version": "3.3.2",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz",
"integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA=="
"version": "3.3.3",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.3.tgz",
"integrity": "sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ=="
},
"wrappy": {
"version": "1.0.2",

View File

@@ -9,16 +9,16 @@
"start:prod": "node dist/main.js"
},
"dependencies": {
"@nestjs/common": "6.5.3",
"@nestjs/core": "6.5.3",
"@nestjs/common": "6.6.6",
"@nestjs/core": "6.6.6",
"@nestjs/mongoose": "6.1.2",
"mongoose": "5.6.10",
"mongoose": "5.6.11",
"reflect-metadata": "0.1.13",
"rxjs": "6.5.2",
"typescript": "3.5.3"
},
"devDependencies": {
"@types/mongoose": "5.5.13",
"@types/mongoose": "5.5.16",
"@types/node": "7.10.7",
"ts-node": "8.3.0",
"tslint": "5.19.0"

View File

@@ -5,32 +5,32 @@
"requires": true,
"dependencies": {
"@nestjs/common": {
"version": "6.5.3",
"resolved": "https://registry.npmjs.org/@nestjs/common/-/common-6.5.3.tgz",
"integrity": "sha512-8d39grIMrUYGKM46BFWxB6csQFCu1S2aK7azPivg7gTRVSbvR84cVd6tgRVM0LwFpqQrtn3Q6G6Pa8FSk7Kh1w==",
"version": "6.6.6",
"resolved": "https://registry.npmjs.org/@nestjs/common/-/common-6.6.6.tgz",
"integrity": "sha512-JeeMkyHUHCVBWKts8rIfVuDwoYH8mZTnFPnQxlhZpDIJIfAHtsWr+zgQf5QaWMriE58v7mPAxC5I6upKFG8Njw==",
"requires": {
"axios": "0.19.0",
"cli-color": "1.4.0",
"uuid": "3.3.2"
"uuid": "3.3.3"
}
},
"@nestjs/core": {
"version": "6.5.3",
"resolved": "https://registry.npmjs.org/@nestjs/core/-/core-6.5.3.tgz",
"integrity": "sha512-ZhYfH49sVmUUw02qsaGozCFOOehlEABakYzRShyDDq30/2+ek3KpE0DfvA9tXlzX2KVrac2qDTBxMOPoJ+zY+g==",
"version": "6.6.6",
"resolved": "https://registry.npmjs.org/@nestjs/core/-/core-6.6.6.tgz",
"integrity": "sha512-Ay5B9JA5LLnxQXOk+rp8wYB/vsDJvKHqZ36eBuavJ3MLw30TAl0Bys/w78QxIqNjPGUmuEtwKNvluZtw5g9ciA==",
"requires": {
"@nuxtjs/opencollective": "0.2.2",
"fast-safe-stringify": "2.0.6",
"iterare": "1.2.0",
"object-hash": "1.3.1",
"optional": "0.1.4",
"uuid": "3.3.2"
"uuid": "3.3.3"
}
},
"@nestjs/microservices": {
"version": "6.5.3",
"resolved": "https://registry.npmjs.org/@nestjs/microservices/-/microservices-6.5.3.tgz",
"integrity": "sha512-T9zZf61myahenI4c0qhcYnhnx49L+zL9+8W6fc+LPTarbt1HJDu6iyj6fh2BzewakwNLJRyGMJ9YCYlXhFuvlA==",
"version": "6.6.6",
"resolved": "https://registry.npmjs.org/@nestjs/microservices/-/microservices-6.6.6.tgz",
"integrity": "sha512-2/l4QdLjXwH5uW9ZSWLKp99y/EbyoMmrBR0HZ7IH7Zc9DMb9ktGxHCTRrA+OrPT14jSqaIe3nD5M8tIAS8UsXg==",
"requires": {
"iterare": "1.2.0",
"json-socket": "0.3.0",
@@ -38,17 +38,17 @@
}
},
"@nestjs/testing": {
"version": "6.5.3",
"resolved": "https://registry.npmjs.org/@nestjs/testing/-/testing-6.5.3.tgz",
"integrity": "sha512-W8tPhkNVhmX+jaDu4R7WUOtIl0PK3ZDso434rEm/b1+S6ZRgAKwNVHWM/rwIuTi5+erPTEULtTsZgrXFrzC1sA==",
"version": "6.6.6",
"resolved": "https://registry.npmjs.org/@nestjs/testing/-/testing-6.6.6.tgz",
"integrity": "sha512-fByjujD8og97DlK2WoksGcjEULf3F/5Iwlk7CNixm2vNzmFtBNAYTh0C86cSVaHRuiF3EHBDwJxSotaPXeIcqw==",
"requires": {
"optional": "0.1.4"
}
},
"@nestjs/websockets": {
"version": "6.5.3",
"resolved": "https://registry.npmjs.org/@nestjs/websockets/-/websockets-6.5.3.tgz",
"integrity": "sha512-YrCvmLHTW0OBusTiUOPrG0PNrw/3Gatty/bh3ro5cEoiovcaJxGSMsTC+JSVXqPwRJjEtoHMCr5Qje2rAepIzQ==",
"version": "6.6.6",
"resolved": "https://registry.npmjs.org/@nestjs/websockets/-/websockets-6.6.6.tgz",
"integrity": "sha512-gpEz0unDj5g8SCngpJMURM+eaGRH8YAaPOuVGn/4RWSFvcMDSl9rSr1zg79JkFODqD1zRryAiff1xU1HNxHHJA==",
"requires": {
"iterare": "1.2.0"
}
@@ -121,9 +121,9 @@
"dev": true
},
"avvio": {
"version": "6.2.1",
"resolved": "https://registry.npmjs.org/avvio/-/avvio-6.2.1.tgz",
"integrity": "sha512-k+gTocL3yShwN1PtKEsSj7eFiApcZ4JZLAu/ecyzEb8jyx+Kmxb+7SXUsodB47g7fqhs/zkfsCdqq72a1ok5Ew==",
"version": "6.2.2",
"resolved": "https://registry.npmjs.org/avvio/-/avvio-6.2.2.tgz",
"integrity": "sha512-7+yznbJOMoHQ8Z8VH+1meyRjtxUW8za6gqnHBl8DqlX5qPtaclNIgWrKrTLuIbfn2+1/EGkcr+rQXI8DYVU4RA==",
"requires": {
"archy": "^1.0.0",
"debug": "^4.0.0",
@@ -227,9 +227,9 @@
"dev": true
},
"consola": {
"version": "2.9.0",
"resolved": "https://registry.npmjs.org/consola/-/consola-2.9.0.tgz",
"integrity": "sha512-34Iue+LRcWbndFIfZc5boNizWlsrRjqIBJZTe591vImgbnq7nx2EzlrLtANj9TH2Fxm7puFJBJAOk5BhvZOddQ=="
"version": "2.10.1",
"resolved": "https://registry.npmjs.org/consola/-/consola-2.10.1.tgz",
"integrity": "sha512-4sxpH6SGFYLADfUip4vuY65f/gEogrzJoniVhNUYkJHtng0l8ZjnDCqxxrSVRHOHwKxsy8Vm5ONZh1wOR3/l/w=="
},
"cookiejar": {
"version": "2.1.2",
@@ -278,9 +278,9 @@
"dev": true
},
"es5-ext": {
"version": "0.10.50",
"resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.50.tgz",
"integrity": "sha512-KMzZTPBkeQV/JcSQhI5/z6d9VWJ3EnQ194USTUwIYZ2ZbpN8+SGXQKt1h68EX44+qt+Fzr8DO17vnxrw7c3agw==",
"version": "0.10.51",
"resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.51.tgz",
"integrity": "sha512-oRpWzM2WcLHVKpnrcyB7OW8j/s67Ba04JCm0WnNv3RiABSvs7mrQlutB8DBv793gKcp0XENR8Il8WxGTlZ73gQ==",
"requires": {
"es6-iterator": "~2.0.3",
"es6-symbol": "~3.1.1",
@@ -372,19 +372,19 @@
"integrity": "sha512-q8BZ89jjc+mz08rSxROs8VsrBBcn1SIw1kq9NjolL509tkABRk9io01RAjSaEv1Xb2uFLt8VtRiZbGp5H8iDtg=="
},
"fastify": {
"version": "2.7.1",
"resolved": "https://registry.npmjs.org/fastify/-/fastify-2.7.1.tgz",
"integrity": "sha512-ScKPXD84lkdCgz7q0zjyBr1aLxKbXRt9HYL3XIt/L8ZD2f3fAcsLEyQ2/rHxLUzLGjPlEjIvprWUL3RZvlLRLw==",
"version": "2.8.0",
"resolved": "https://registry.npmjs.org/fastify/-/fastify-2.8.0.tgz",
"integrity": "sha512-+HXe9xZzbj79680hlehEs0B1Z3e5RQT6CtPthseqgRJy2i7Wlro8EEdM7u7ewwL9XREjLWssCPlJiZ3G+t4qsw==",
"requires": {
"abstract-logging": "^1.0.0",
"ajv": "^6.10.2",
"avvio": "^6.1.1",
"fast-json-stringify": "^1.15.0",
"avvio": "^6.2.2",
"fast-json-stringify": "^1.15.4",
"find-my-way": "^2.0.0",
"flatstr": "^1.0.12",
"light-my-request": "^3.4.1",
"middie": "^4.0.1",
"pino": "^5.13.1",
"pino": "^5.13.2",
"proxy-addr": "^2.0.4",
"readable-stream": "^3.1.1",
"rfdc": "^1.1.2",
@@ -401,9 +401,9 @@
}
},
"find-my-way": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/find-my-way/-/find-my-way-2.1.0.tgz",
"integrity": "sha512-Hdx6ctcrzkZH5y9EREHtXryXAgc5Bc8z5Cvoa61y9kaoYj2KU4yXD6h8b6u0NUkYPVmQQeRdf0AtG1kQxQ+ukQ==",
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/find-my-way/-/find-my-way-2.1.1.tgz",
"integrity": "sha512-yznKDx1xELFkTrV2Ke9x3IOr9zn5isdFA2Af/NKjU8kmQQhtn3TmqrVZ6OiLO5pj1dAScxe4dAo92ieG4nGcoA==",
"requires": {
"fast-decode-uri-component": "^1.0.0",
"safe-regex2": "^2.0.0",
@@ -595,9 +595,9 @@
"integrity": "sha512-ZOtfhPttCrqp2M1PBBH4X13XlvnfhIwD7yCLx+GoGoXRPQyxGOTdQMpIzPSPKXAJT/JQrdfFrgdJOyAzvgpQ9A=="
},
"pino": {
"version": "5.13.1",
"resolved": "https://registry.npmjs.org/pino/-/pino-5.13.1.tgz",
"integrity": "sha512-IxusG28L0g50uuf21kZELypdFOeNrJ/kRhktdi7LtdZQWCxLliMxG5iOrGUQ/ng7MiJ4XqXi/hfyXwZeKc1MxA==",
"version": "5.13.2",
"resolved": "https://registry.npmjs.org/pino/-/pino-5.13.2.tgz",
"integrity": "sha512-WwOSCy36/gWhinsqWqAnuwIi2WtcH+jvoyeLm3bjUALIrzWIst0AovQjK4jVvSN2l64KFPfi3gd2fjsTovjdLQ==",
"requires": {
"fast-redact": "^1.4.4",
"fast-safe-stringify": "^2.0.6",
@@ -684,7 +684,8 @@
"safe-buffer": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
"dev": true
},
"safe-regex2": {
"version": "2.0.0",
@@ -729,11 +730,18 @@
}
},
"string_decoder": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.2.0.tgz",
"integrity": "sha512-6YqyX6ZWEYguAxgZzHGL7SsCeGx3V2TtOTqZz1xSTSWnqsbWwbptafNyvf/ACquZUXV3DANr5BDIwNYe1mN42w==",
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",
"integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==",
"requires": {
"safe-buffer": "~5.1.0"
"safe-buffer": "~5.2.0"
},
"dependencies": {
"safe-buffer": {
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.0.tgz",
"integrity": "sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg=="
}
}
},
"superagent": {
@@ -837,9 +845,9 @@
"integrity": "sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ=="
},
"type": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/type/-/type-1.0.1.tgz",
"integrity": "sha512-MAM5dBMJCJNKs9E7JXo4CXRAansRfG0nlJxW7Wf6GZzSOvH31zClSaHdIMWLehe/EGMBkqeC55rrkaOr5Oo7Nw=="
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/type/-/type-1.0.3.tgz",
"integrity": "sha512-51IMtNfVcee8+9GJvj0spSuFcZHe9vSib6Xtgsny1Km9ugyz2mbS08I3rsUIRYgJohFRFU1160sgRodYz378Hg=="
},
"typescript": {
"version": "3.5.3",
@@ -860,9 +868,9 @@
"integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8="
},
"uuid": {
"version": "3.3.2",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz",
"integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA=="
"version": "3.3.3",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.3.tgz",
"integrity": "sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ=="
},
"validator": {
"version": "11.1.0",

View File

@@ -7,14 +7,14 @@
"start": "ts-node src/main"
},
"dependencies": {
"@nestjs/common": "6.5.3",
"@nestjs/core": "6.5.3",
"@nestjs/microservices": "6.5.3",
"@nestjs/testing": "6.5.3",
"@nestjs/websockets": "6.5.3",
"@nestjs/common": "6.6.6",
"@nestjs/core": "6.6.6",
"@nestjs/microservices": "6.6.6",
"@nestjs/testing": "6.6.6",
"@nestjs/websockets": "6.6.6",
"class-transformer": "0.2.3",
"class-validator": "0.10.0",
"fastify": "2.7.1",
"fastify": "2.8.0",
"reflect-metadata": "0.1.13",
"rxjs": "6.5.2",
"typescript": "3.5.3"

File diff suppressed because it is too large Load Diff

View File

@@ -9,13 +9,13 @@
"start:prod": "node dist/main.js"
},
"dependencies": {
"@nestjs/common": "6.5.3",
"@nestjs/core": "6.5.3",
"@nestjs/graphql": "6.4.2",
"apollo-server-express": "2.8.1",
"@nestjs/common": "6.6.6",
"@nestjs/core": "6.6.6",
"@nestjs/graphql": "6.5.0",
"apollo-server-express": "2.9.3",
"class-transformer": "0.2.3",
"class-validator": "0.10.0",
"graphql": "14.5.0",
"graphql": "14.5.4",
"graphql-tools": "4.0.5",
"reflect-metadata": "0.1.13",
"rxjs": "6.5.2",

View File

@@ -25,26 +25,40 @@
}
},
"@nestjs/common": {
"version": "6.5.3",
"resolved": "https://registry.npmjs.org/@nestjs/common/-/common-6.5.3.tgz",
"integrity": "sha512-8d39grIMrUYGKM46BFWxB6csQFCu1S2aK7azPivg7gTRVSbvR84cVd6tgRVM0LwFpqQrtn3Q6G6Pa8FSk7Kh1w==",
"version": "6.6.6",
"resolved": "https://registry.npmjs.org/@nestjs/common/-/common-6.6.6.tgz",
"integrity": "sha512-JeeMkyHUHCVBWKts8rIfVuDwoYH8mZTnFPnQxlhZpDIJIfAHtsWr+zgQf5QaWMriE58v7mPAxC5I6upKFG8Njw==",
"requires": {
"axios": "0.19.0",
"cli-color": "1.4.0",
"uuid": "3.3.2"
"uuid": "3.3.3"
},
"dependencies": {
"uuid": {
"version": "3.3.3",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.3.tgz",
"integrity": "sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ=="
}
}
},
"@nestjs/core": {
"version": "6.5.3",
"resolved": "https://registry.npmjs.org/@nestjs/core/-/core-6.5.3.tgz",
"integrity": "sha512-ZhYfH49sVmUUw02qsaGozCFOOehlEABakYzRShyDDq30/2+ek3KpE0DfvA9tXlzX2KVrac2qDTBxMOPoJ+zY+g==",
"version": "6.6.6",
"resolved": "https://registry.npmjs.org/@nestjs/core/-/core-6.6.6.tgz",
"integrity": "sha512-Ay5B9JA5LLnxQXOk+rp8wYB/vsDJvKHqZ36eBuavJ3MLw30TAl0Bys/w78QxIqNjPGUmuEtwKNvluZtw5g9ciA==",
"requires": {
"@nuxtjs/opencollective": "0.2.2",
"fast-safe-stringify": "2.0.6",
"iterare": "1.2.0",
"object-hash": "1.3.1",
"optional": "0.1.4",
"uuid": "3.3.2"
"uuid": "3.3.3"
},
"dependencies": {
"uuid": {
"version": "3.3.3",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.3.tgz",
"integrity": "sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ=="
}
}
},
"@nestjs/typeorm": {
@@ -256,9 +270,9 @@
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s="
},
"consola": {
"version": "2.9.0",
"resolved": "https://registry.npmjs.org/consola/-/consola-2.9.0.tgz",
"integrity": "sha512-34Iue+LRcWbndFIfZc5boNizWlsrRjqIBJZTe591vImgbnq7nx2EzlrLtANj9TH2Fxm7puFJBJAOk5BhvZOddQ=="
"version": "2.10.1",
"resolved": "https://registry.npmjs.org/consola/-/consola-2.10.1.tgz",
"integrity": "sha512-4sxpH6SGFYLADfUip4vuY65f/gEogrzJoniVhNUYkJHtng0l8ZjnDCqxxrSVRHOHwKxsy8Vm5ONZh1wOR3/l/w=="
},
"core-util-is": {
"version": "1.0.2",
@@ -324,9 +338,9 @@
}
},
"es5-ext": {
"version": "0.10.50",
"resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.50.tgz",
"integrity": "sha512-KMzZTPBkeQV/JcSQhI5/z6d9VWJ3EnQ194USTUwIYZ2ZbpN8+SGXQKt1h68EX44+qt+Fzr8DO17vnxrw7c3agw==",
"version": "0.10.51",
"resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.51.tgz",
"integrity": "sha512-oRpWzM2WcLHVKpnrcyB7OW8j/s67Ba04JCm0WnNv3RiABSvs7mrQlutB8DBv793gKcp0XENR8Il8WxGTlZ73gQ==",
"requires": {
"es6-iterator": "~2.0.3",
"es6-symbol": "~3.1.1",
@@ -1057,9 +1071,9 @@
}
},
"type": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/type/-/type-1.0.1.tgz",
"integrity": "sha512-MAM5dBMJCJNKs9E7JXo4CXRAansRfG0nlJxW7Wf6GZzSOvH31zClSaHdIMWLehe/EGMBkqeC55rrkaOr5Oo7Nw=="
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/type/-/type-1.0.3.tgz",
"integrity": "sha512-51IMtNfVcee8+9GJvj0spSuFcZHe9vSib6Xtgsny1Km9ugyz2mbS08I3rsUIRYgJohFRFU1160sgRodYz378Hg=="
},
"typeorm": {
"version": "0.2.18",

View File

@@ -9,8 +9,8 @@
"start:prod": "node dist/main.js"
},
"dependencies": {
"@nestjs/common": "6.5.3",
"@nestjs/core": "6.5.3",
"@nestjs/common": "6.6.6",
"@nestjs/core": "6.6.6",
"@nestjs/typeorm": "6.1.3",
"mysql": "2.17.1",
"reflect-metadata": "0.1.13",

View File

@@ -5,32 +5,32 @@
"requires": true,
"dependencies": {
"@nestjs/common": {
"version": "6.5.3",
"resolved": "https://registry.npmjs.org/@nestjs/common/-/common-6.5.3.tgz",
"integrity": "sha512-8d39grIMrUYGKM46BFWxB6csQFCu1S2aK7azPivg7gTRVSbvR84cVd6tgRVM0LwFpqQrtn3Q6G6Pa8FSk7Kh1w==",
"version": "6.6.6",
"resolved": "https://registry.npmjs.org/@nestjs/common/-/common-6.6.6.tgz",
"integrity": "sha512-JeeMkyHUHCVBWKts8rIfVuDwoYH8mZTnFPnQxlhZpDIJIfAHtsWr+zgQf5QaWMriE58v7mPAxC5I6upKFG8Njw==",
"requires": {
"axios": "0.19.0",
"cli-color": "1.4.0",
"uuid": "3.3.2"
"uuid": "3.3.3"
}
},
"@nestjs/core": {
"version": "6.5.3",
"resolved": "https://registry.npmjs.org/@nestjs/core/-/core-6.5.3.tgz",
"integrity": "sha512-ZhYfH49sVmUUw02qsaGozCFOOehlEABakYzRShyDDq30/2+ek3KpE0DfvA9tXlzX2KVrac2qDTBxMOPoJ+zY+g==",
"version": "6.6.6",
"resolved": "https://registry.npmjs.org/@nestjs/core/-/core-6.6.6.tgz",
"integrity": "sha512-Ay5B9JA5LLnxQXOk+rp8wYB/vsDJvKHqZ36eBuavJ3MLw30TAl0Bys/w78QxIqNjPGUmuEtwKNvluZtw5g9ciA==",
"requires": {
"@nuxtjs/opencollective": "0.2.2",
"fast-safe-stringify": "2.0.6",
"iterare": "1.2.0",
"object-hash": "1.3.1",
"optional": "0.1.4",
"uuid": "3.3.2"
"uuid": "3.3.3"
}
},
"@nestjs/microservices": {
"version": "6.5.3",
"resolved": "https://registry.npmjs.org/@nestjs/microservices/-/microservices-6.5.3.tgz",
"integrity": "sha512-T9zZf61myahenI4c0qhcYnhnx49L+zL9+8W6fc+LPTarbt1HJDu6iyj6fh2BzewakwNLJRyGMJ9YCYlXhFuvlA==",
"version": "6.6.6",
"resolved": "https://registry.npmjs.org/@nestjs/microservices/-/microservices-6.6.6.tgz",
"integrity": "sha512-2/l4QdLjXwH5uW9ZSWLKp99y/EbyoMmrBR0HZ7IH7Zc9DMb9ktGxHCTRrA+OrPT14jSqaIe3nD5M8tIAS8UsXg==",
"requires": {
"iterare": "1.2.0",
"json-socket": "0.3.0",
@@ -38,17 +38,17 @@
}
},
"@nestjs/testing": {
"version": "6.5.3",
"resolved": "https://registry.npmjs.org/@nestjs/testing/-/testing-6.5.3.tgz",
"integrity": "sha512-W8tPhkNVhmX+jaDu4R7WUOtIl0PK3ZDso434rEm/b1+S6ZRgAKwNVHWM/rwIuTi5+erPTEULtTsZgrXFrzC1sA==",
"version": "6.6.6",
"resolved": "https://registry.npmjs.org/@nestjs/testing/-/testing-6.6.6.tgz",
"integrity": "sha512-fByjujD8og97DlK2WoksGcjEULf3F/5Iwlk7CNixm2vNzmFtBNAYTh0C86cSVaHRuiF3EHBDwJxSotaPXeIcqw==",
"requires": {
"optional": "0.1.4"
}
},
"@nestjs/websockets": {
"version": "6.5.3",
"resolved": "https://registry.npmjs.org/@nestjs/websockets/-/websockets-6.5.3.tgz",
"integrity": "sha512-YrCvmLHTW0OBusTiUOPrG0PNrw/3Gatty/bh3ro5cEoiovcaJxGSMsTC+JSVXqPwRJjEtoHMCr5Qje2rAepIzQ==",
"version": "6.6.6",
"resolved": "https://registry.npmjs.org/@nestjs/websockets/-/websockets-6.6.6.tgz",
"integrity": "sha512-gpEz0unDj5g8SCngpJMURM+eaGRH8YAaPOuVGn/4RWSFvcMDSl9rSr1zg79JkFODqD1zRryAiff1xU1HNxHHJA==",
"requires": {
"iterare": "1.2.0"
}
@@ -181,9 +181,9 @@
"dev": true
},
"consola": {
"version": "2.9.0",
"resolved": "https://registry.npmjs.org/consola/-/consola-2.9.0.tgz",
"integrity": "sha512-34Iue+LRcWbndFIfZc5boNizWlsrRjqIBJZTe591vImgbnq7nx2EzlrLtANj9TH2Fxm7puFJBJAOk5BhvZOddQ=="
"version": "2.10.1",
"resolved": "https://registry.npmjs.org/consola/-/consola-2.10.1.tgz",
"integrity": "sha512-4sxpH6SGFYLADfUip4vuY65f/gEogrzJoniVhNUYkJHtng0l8ZjnDCqxxrSVRHOHwKxsy8Vm5ONZh1wOR3/l/w=="
},
"cookiejar": {
"version": "2.1.2",
@@ -228,9 +228,9 @@
"dev": true
},
"es5-ext": {
"version": "0.10.50",
"resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.50.tgz",
"integrity": "sha512-KMzZTPBkeQV/JcSQhI5/z6d9VWJ3EnQ194USTUwIYZ2ZbpN8+SGXQKt1h68EX44+qt+Fzr8DO17vnxrw7c3agw==",
"version": "0.10.51",
"resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.51.tgz",
"integrity": "sha512-oRpWzM2WcLHVKpnrcyB7OW8j/s67Ba04JCm0WnNv3RiABSvs7mrQlutB8DBv793gKcp0XENR8Il8WxGTlZ73gQ==",
"requires": {
"es6-iterator": "~2.0.3",
"es6-symbol": "~3.1.1",
@@ -593,9 +593,9 @@
"integrity": "sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ=="
},
"type": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/type/-/type-1.0.1.tgz",
"integrity": "sha512-MAM5dBMJCJNKs9E7JXo4CXRAansRfG0nlJxW7Wf6GZzSOvH31zClSaHdIMWLehe/EGMBkqeC55rrkaOr5Oo7Nw=="
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/type/-/type-1.0.3.tgz",
"integrity": "sha512-51IMtNfVcee8+9GJvj0spSuFcZHe9vSib6Xtgsny1Km9ugyz2mbS08I3rsUIRYgJohFRFU1160sgRodYz378Hg=="
},
"typescript": {
"version": "3.5.3",
@@ -609,9 +609,9 @@
"dev": true
},
"uuid": {
"version": "3.3.2",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz",
"integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA=="
"version": "3.3.3",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.3.tgz",
"integrity": "sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ=="
},
"validator": {
"version": "11.1.0",

View File

@@ -7,11 +7,11 @@
"start": "ts-node src/main"
},
"dependencies": {
"@nestjs/common": "6.5.3",
"@nestjs/core": "6.5.3",
"@nestjs/microservices": "6.5.3",
"@nestjs/testing": "6.5.3",
"@nestjs/websockets": "6.5.3",
"@nestjs/common": "6.6.6",
"@nestjs/core": "6.6.6",
"@nestjs/microservices": "6.6.6",
"@nestjs/testing": "6.6.6",
"@nestjs/websockets": "6.6.6",
"class-transformer": "0.2.3",
"class-validator": "0.10.0",
"reflect-metadata": "0.1.13",

View File

@@ -3,5 +3,5 @@
"packages": [
"packages/*"
],
"version": "6.5.3"
"version": "6.6.7"
}

599
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{
"name": "@nestjs/core",
"version": "6.5.3",
"version": "6.6.5",
"description": "Modern, fast, powerful node.js web framework",
"scripts": {
"coverage": "nyc report --reporter=text-lcov | coveralls",
@@ -9,17 +9,19 @@
"lint": "tslint -p tsconfig.json -c tslint.json \"packages/**/*.ts\" -e \"*.spec.ts\"",
"format": "prettier **/**/*.ts --ignore-path ./.prettierignore --write && git status",
"clean": "gulp clean:bundle",
"build": "npm run clean && gulp build",
"prebuild:dev": "rm -rf node_modules/@nestjs",
"build:dev": "gulp build --dist node_modules/@nestjs && gulp move",
"build:samples": "gulp install:samples && npm run build:dev && gulp build:samples",
"prebuild": "rm -rf node_modules/@nestjs",
"build": "gulp build --dist node_modules/@nestjs",
"postbuild": "gulp move",
"prebuild:prod": "npm run clean",
"build:prod": "gulp build",
"build:samples": "gulp install:samples && npm run build && gulp build:samples",
"postinstall": "opencollective",
"prerelease": "gulp copy-misc && gulp build --dist node_modules/@nestjs",
"publish": "npm run prerelease && npm run build && ./node_modules/.bin/lerna publish --force-publish --access public --exact -m \"chore(@nestjs) publish %s release\"",
"publish:rc": "npm run prerelease && npm run build && ./node_modules/.bin/lerna publish --npm-tag=rc --access public -m \"chore(@nestjs) publish %s release\"",
"publish:next": "npm run prerelease && npm run build && ./node_modules/.bin/lerna publish --npm-tag=next --access public --skip-git -m \"chore(@nestjs) publish %s release\"",
"publish:beta": "npm run prerelease && npm run build && ./node_modules/.bin/lerna publish --npm-tag=beta --access public -m \"chore(@nestjs) publish %s release\"",
"publish:test": "npm run prerelease && npm run build && ./node_modules/.bin/lerna publish --force-publish --access public --npm-tag=test --skip-git -m \"chore(@nestjs) publish %s release\""
"publish": "npm run prerelease && npm run build:prod && ./node_modules/.bin/lerna publish --force-publish --access public --exact -m \"chore(@nestjs) publish %s release\"",
"publish:rc": "npm run prerelease && npm run build:prod && ./node_modules/.bin/lerna publish --npm-tag=rc --access public -m \"chore(@nestjs) publish %s release\"",
"publish:next": "npm run prerelease && npm run build:prod && ./node_modules/.bin/lerna publish --npm-tag=next --access public --skip-git -m \"chore(@nestjs) publish %s release\"",
"publish:beta": "npm run prerelease && npm run build:prod && ./node_modules/.bin/lerna publish --npm-tag=beta --access public -m \"chore(@nestjs) publish %s release\"",
"publish:test": "npm run prerelease && npm run build:prod && ./node_modules/.bin/lerna publish --force-publish --access public --npm-tag=test --skip-git -m \"chore(@nestjs) publish %s release\""
},
"engines": {
"node": ">= 8.9.0"
@@ -40,7 +42,7 @@
"@nuxtjs/opencollective": "0.2.2",
"amqp-connection-manager": "3.0.0",
"amqplib": "0.5.5",
"apollo-server-express": "2.8.1",
"apollo-server-express": "2.9.3",
"axios": "0.19.0",
"cache-manager": "2.10.0",
"class-transformer": "0.2.3",
@@ -52,11 +54,11 @@
"express": "4.17.1",
"fast-json-stringify": "1.15.4",
"fast-safe-stringify": "2.0.6",
"fastify": "2.7.1",
"fastify": "2.8.0",
"fastify-cors": "2.1.3",
"fastify-formbody": "3.1.0",
"fastify-multipart": "1.0.2",
"graphql": "14.5.0",
"graphql": "14.5.4",
"grpc": "1.23.3",
"http2": "3.3.7",
"iterare": "1.2.0",
@@ -66,14 +68,14 @@
"nats": "1.3.0",
"object-hash": "1.3.1",
"optional": "0.1.4",
"path-to-regexp": "3.0.0",
"path-to-regexp": "3.1.0",
"pump": "3.0.0",
"redis": "2.8.0",
"reflect-metadata": "0.1.13",
"rxjs": "6.5.2",
"rxjs-compat": "6.5.2",
"socket.io": "2.2.0",
"ts-morph": "3.1.3",
"ts-morph": "4.0.0",
"uuid": "3.3.3"
},
"devDependencies": {
@@ -87,7 +89,7 @@
"@types/gulp": "4.0.6",
"@types/kafka-node": "2.0.8",
"@types/mocha": "5.2.7",
"@types/node": "10.14.16",
"@types/node": "10.14.17",
"@types/redis": "2.8.13",
"@types/reflect-metadata": "0.0.5",
"@types/sinon": "7.0.13",
@@ -117,18 +119,18 @@
"imports-loader": "0.8.0",
"json-loader": "0.5.7",
"lerna": "2.11.0",
"lint-staged": "9.2.3",
"lint-staged": "9.2.5",
"mocha": "3.5.3",
"nodemon": "1.19.1",
"nyc": "14.1.1",
"prettier": "1.18.2",
"sinon": "7.4.1",
"sinon": "7.4.2",
"sinon-chai": "3.3.0",
"socket.io-client": "2.2.0",
"supertest": "4.0.2",
"ts-node": "8.3.0",
"tslint": "5.19.0",
"typescript": "3.5.3"
"typescript": "3.6.2"
},
"collective": {
"type": "opencollective",

View File

@@ -0,0 +1 @@
The common package comes with decorators such as `@Controller()`, `@Injectable()` and so on.

View File

@@ -2,18 +2,15 @@
<a href="http://nestjs.com/" target="blank"><img src="https://nestjs.com/img/logo_text.svg" width="320" alt="Nest Logo" /></a>
</p>
[travis-image]: https://api.travis-ci.org/nestjs/nest.svg?branch=master
[travis-url]: https://travis-ci.org/nestjs/nest
[linux-image]: https://img.shields.io/travis/nestjs/nest/master.svg?label=linux
[linux-url]: https://travis-ci.org/nestjs/nest
[circleci-image]: https://img.shields.io/circleci/build/github/nestjs/nest/master?token=abc123def456
[circleci-url]: https://circleci.com/gh/nestjs/nest
<p align="center">A progressive <a href="http://nodejs.org" target="_blank">Node.js</a> framework for building efficient and scalable server-side applications, heavily inspired by <a href="https://angular.io" target="blank">Angular</a>.</p>
<p align="center">A progressive <a href="http://nodejs.org" target="_blank">Node.js</a> framework for building efficient and scalable server-side applications.</p>
<p align="center">
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/v/@nestjs/core.svg" alt="NPM Version" /></a>
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/l/@nestjs/core.svg" alt="Package License" /></a>
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/dm/@nestjs/core.svg" alt="NPM Downloads" /></a>
<a href="https://travis-ci.org/nestjs/nest" target="_blank"><img src="https://api.travis-ci.org/nestjs/nest.svg?branch=master" alt="Travis" /></a>
<a href="https://travis-ci.org/nestjs/nest" target="_blank"><img src="https://img.shields.io/travis/nestjs/nest/master.svg?label=linux" alt="Linux" /></a>
<a href="https://circleci.com/gh/nestjs/nest" target="_blank"><img src="https://img.shields.io/circleci/build/github/nestjs/nest/master" alt="CircleCI" /></a>
<a href="https://coveralls.io/github/nestjs/nest?branch=master" target="_blank"><img src="https://coveralls.io/repos/github/nestjs/nest/badge.svg?branch=master#9" alt="Coverage" /></a>
<a href="https://discord.gg/G7Qnnhy" target="_blank"><img src="https://img.shields.io/badge/discord-online-brightgreen.svg" alt="Discord"/></a>
<a href="https://opencollective.com/nest#backer" target="_blank"><img src="https://opencollective.com/nest/backers/badge.svg" alt="Backers on Open Collective" /></a>
@@ -60,25 +57,23 @@ Nest is an MIT-licensed open source project. It can grow thanks to the sponsors
#### Sponsors
<a href="https://www.swingdev.io" target="_blank"><img src="https://nestjs.com/img/swingdev-logo.svg#1" width="125" valign="middle" /> </a> &nbsp; <a href="https://blueanchor.io/" target="_blank"><img src="https://nestjs.com/img/blueanchor.png" width="180" valign="middle" /></a> &nbsp;
<a href="https://www.novologic.com/" target="_blank"><img src="https://nestjs.com/img/novologic.png" width="130" valign="middle" /></a> &nbsp;
<a href="https://scal.io" target="_blank"><img src="https://nestjs.com/img/scalio-logo.svg" width="100" valign="middle" /></a> &nbsp; <a href="http://angularity.io" target="_blank"><img src="http://angularity.io/media/logo.svg" height="26" valign="middle" /></a> &nbsp; <!--<a href="https://keycdn.com"><img src="https://nestjs.com/img/keycdn.svg" height="30" /></a> &nbsp;--> <a href="https://hostpresto.com" target="_blank"><img src="https://nestjs.com/img/hostpresto.png" height="30" valign="middle" /></a>
&nbsp; <a href="https://genuinebee.com/" target="_blank"><img src="https://nestjs.com/img/genuinebee.svg" height="36" valign="middle" /></a> &nbsp; <a href="http://architectnow.net/" target="_blank"><img src="https://nestjs.com/img/architectnow.png" height="24" valign="middle" /></a> &nbsp; <a href="https://quander.io/" target="_blank"><img src="https://nestjs.com/img/quander.png" height="28" valign="middle" /></a> &nbsp; <a href="https://mantro.net/" target="_blank"><img src="https://nestjs.com/img/mantro-logo.svg" height="20" valign="middle" /></a> &nbsp; <a href="https://triplebyte.com/" target="_blank"><img src="https://nestjs.com/img/triplebyte.png" height="30" valign="middle" /></a> &nbsp;
<a href="https://ever.co/" target="_blank"><img src="https://nestjs.com/img/ever-logo.png" height="20" valign="middle" /></a> &nbsp;
<a href="https://buddy.works/" target="_blank"><img src="https://nestjs.com/img/buddy-logo.svg" height="35" valign="middle" /></a> &nbsp;
<a href="https://blokt.com" target="_blank"><img src="https://nestjs.com/img/blokt-logo.png" height="31" valign="middle" /></a> &nbsp;
<a href="https://reposit.co.uk/" target="_blank"><img src="https://nestjs.com/img/reposit-logo.png" height="28" valign="middle" /></a> &nbsp; &nbsp; <a href="https://yakaz.com/" target="_blank"><img src="https://nestjs.com/img/yakaz.png" width="80" valign="middle" /></a> &nbsp;
<a href="https://nearpod.com/" target="_blank"><img src="https://nestjs.com/img/nearpod-logo.svg" width="120" valign="middle" /></a> &nbsp;
<a href="https://clay.global/" target="_blank"><img src="https://nestjs.com/img/clay-logo.svg" width="90" valign="middle" /></a> &nbsp;
<a href="https://firesticktricks.com" target="_blank"><img src="https://nestjs.com/img/firesticktricks-logo.png" width="145" valign="middle" /></a> &nbsp;
<a href="http://xtremis.com/" target="_blank"><img src="https://nestjs.com/img/logo-xtremis.svg" width="145" valign="middle" /></a>
<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://scal.io" target="_blank"><img src="https://nestjs.com/img/scalio-logo.svg" width="80" valign="middle" /></a> &nbsp; <a href="http://angularity.io" target="_blank"><img src="http://angularity.io/media/logo.svg" height="22" valign="middle" /></a> &nbsp; <!--<a href="https://keycdn.com"><img src="https://nestjs.com/img/keycdn.svg" height="30" /></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="24" 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://yakaz.com/" target="_blank"><img src="https://nestjs.com/img/yakaz.png" width="70" valign="middle" /></a> &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>
## Backers
<a href="https://opencollective.com/nest" target="_blank"><img src="https://opencollective.com/nest/backers.svg?width=1600"></a>
<a href="https://opencollective.com/nest" target="_blank"><img src="https://opencollective.com/nest/backers.svg?width=1000"></a>
## Stay in touch

View File

@@ -8,11 +8,25 @@ import {
CacheOptionsFactory,
} from './interfaces/cache-module.interface';
/**
* Module that provides Nest cache-manager.
*
* @see [Caching](https://docs.nestjs.com/techniques/caching)
*
* @publicApi
*/
@Module({
providers: [createCacheManager()],
exports: [CACHE_MANAGER],
})
export class CacheModule {
/**
* Configure the cache manager statically.
*
* @param options options to configure the cache manager
*
* @see [Customize caching](https://docs.nestjs.com/techniques/caching#customize-caching)
*/
static register(options: CacheModuleOptions = {}): DynamicModule {
return {
module: CacheModule,
@@ -20,6 +34,14 @@ export class CacheModule {
};
}
/**
* Configure the cache manager dynamically.
*
* @param options method for dynamically supplying cache manager configuration
* options
*
* @see [Async configuration](https://docs.nestjs.com/techniques/caching#async-configuration)
*/
static registerAsync(options: CacheModuleAsyncOptions): DynamicModule {
return {
module: CacheModule,

View File

@@ -4,6 +4,11 @@ import { CACHE_MANAGER, CACHE_MODULE_OPTIONS } from './cache.constants';
import { defaultCacheOptions } from './default-options';
import { CacheManagerOptions } from './interfaces/cache-manager.interface';
/**
* Creates a CacheManager Provider.
*
* @publicApi
*/
export function createCacheManager(): Provider {
return {
provide: CACHE_MANAGER,

View File

@@ -1,4 +1,17 @@
import { SetMetadata } from '../../decorators';
import { CACHE_KEY_METADATA } from '../cache.constants';
/**
* Decorator that sets the caching key used to store/retrieve cached items for
* Web sockets or Microservice based apps.
*
* For example:
* `@CacheKey('events')`
*
* @param key string naming the field to be used as a cache key
*
* @see [Caching](https://docs.nestjs.com/techniques/caching)
*
* @publicApi
*/
export const CacheKey = (key: string) => SetMetadata(CACHE_KEY_METADATA, key);

View File

@@ -2,19 +2,70 @@ export interface LiteralObject {
[key: string]: any;
}
/**
* Interface defining a cache store. Implement this interface to create a custom
* cache store.
*
* @publicApi
*/
export interface CacheStore {
/**
* Create a key/value pair in the cache.
*
* @param key cache key
* @param value cache value
*/
set<T>(key: string, value: T): Promise<void> | void;
/**
* Retrieve a key/value pair from the cache.
*
* @param key cache key
*/
get<T>(key: string): Promise<void> | void;
/**
* Destroy a key/value pair from the cache.
*
* @param key cache key
*/
del(key: string): void | Promise<void>;
}
/**
* Interface defining a factory to create a cache store.
*
* @publicApi
*/
export interface CacheStoreFactory {
/**
* Return a configured cache store.
*
* @param args Cache manager options received from `CacheModule.register()`
* or `CacheModule.registerAcync()`
*/
create(args: LiteralObject): CacheStore;
}
/**
* Interface defining Cache Manager configuration options.
*
* @publicApi
*/
export interface CacheManagerOptions {
/**
* Cache storage manager. Default is `'memory'` (in-memory store). See
* [Different stores](https://docs.nestjs.com/techniques/caching#different-stores)
* for more info.
*/
store?: string | CacheStoreFactory;
/**
* Time to live - amount of time in seconds that a response is cached before it
* is deleted. Subsequent request will call through the route handler and refresh
* the cache. Defaults to 5 seconds.
*/
ttl?: number;
/**
* Maximum number of responses to store in the cache. Defaults to 100.
*/
max?: number;
isCacheableValue?: (value: any) => boolean;
}

View File

@@ -5,17 +5,47 @@ export interface CacheModuleOptions extends CacheManagerOptions {
[key: string]: any;
}
/**
* Interface describing a `CacheOptionsFactory`. Providers supplying configuration
* options for the Cache module must implement this interface.
*
* @see [Async configuration](https://docs.nestjs.com/techniques/caching#async-configuration)
*
* @publicApi
*/
export interface CacheOptionsFactory {
createCacheOptions(): Promise<CacheModuleOptions> | CacheModuleOptions;
}
/**
* Options for dynamically configuring the Cache module.
*
* @see [Async configuration](https://docs.nestjs.com/techniques/caching#async-configuration)
*
* @publicApi
*/
export interface CacheModuleAsyncOptions
extends Pick<ModuleMetadata, 'imports'> {
/**
* Injection token resolving to an existing provider. The provider must implement
* the `CacheOptionsFactory` interface.
*/
useExisting?: Type<CacheOptionsFactory>;
/**
* Injection token resolving to a class that will be instantiated as a provider.
* The class must implement the `CacheOptionsFactory` interface.
*/
useClass?: Type<CacheOptionsFactory>;
/**
* Function returning options (or a Promise resolving to options) to configure the
* cache module.
*/
useFactory?: (
...args: any[]
) => Promise<CacheModuleOptions> | CacheModuleOptions;
/**
* Dependencies that a Factory may inject.
*/
inject?: any[];
extraProviders?: Provider[];
}

View File

@@ -1,7 +1,12 @@
/**
* Binds parameter decorators to the method
* Useful when the language doesn't provide a 'Parameter Decorators' feature (vanilla JavaScript)
* @param {} ...decorators
* Decorator that binds *parameter decorators* to the method that follows.
*
* Useful when the language doesn't provide a 'Parameter Decorator' feature
* (i.e., vanilla JavaScript).
*
* @param decorators one or more parameter decorators (e.g., `Req()`)
*
* @publicApi
*/
export function Bind(...decorators: any[]): MethodDecorator {
return <T>(

View File

@@ -2,8 +2,21 @@ import { FILTER_CATCH_EXCEPTIONS } from '../../constants';
import { Type } from '../../interfaces';
/**
* Defines an exception filter. Takes set of exception types as arguments which have to be caught by this filter.
* The class should implement the `ExceptionFilter` interface.
* Decorator that marks a class as a Nest exception filter. An exception filter
* handles exceptions thrown by or not handled by your application code.
*
* The decorated class must implement the `ExceptionFilter` interface.
*
* @param exceptions one or more exception *types* specifying
* the exceptions to be caught and handled by this filter.
*
* @see [Exception Filters](https://docs.nestjs.com/exception-filters)
*
* @usageNotes
* Exception filters are applied using the `@UseFilters()` decorator, or (globally)
* with `app.useGlobalFilters()`.
*
* @publicApi
*/
export function Catch(...exceptions: Type<any>[]): ClassDecorator {
return (target: object) => {

View File

@@ -2,17 +2,127 @@ import { PATH_METADATA, SCOPE_OPTIONS_METADATA } from '../../constants';
import { isString, isUndefined } from '../../utils/shared.utils';
import { ScopeOptions } from './../../interfaces/scope-options.interface';
/**
* Interface defining options that can be passed to `@Controller()` decorator
*
* @publicApi
*/
export interface ControllerOptions extends ScopeOptions {
/**
* Specifies an optional `route path prefix`. The prefix is pre-pended to the
* path specified in any request decorator in the class.
*
* @see [Routing](https://docs.nestjs.com/controllers#routing)
*/
path?: string;
}
/**
* Defines the controller. Controller can inject dependencies through constructor.
* Those dependencies have to belong to the same module.
* Decorator that marks a class as a Nest controller that can receive inbound
* requests and produce responses.
*
* An HTTP Controller responds to inbound HTTP Requests and produces HTTP Responses.
* It defines a class that provides the context for one or more related route
* handlers that correspond to HTTP request methods and associated routes
* for example `GET /api/profile`, `POST /user/resume`.
*
* A Microservice Controller responds to requests as well as events, running over
* a variety of transports [(read more here)](https://docs.nestjs.com/microservices/basics).
* It defines a class that provides a context for one or more message or event
* handlers.
*
* @see [Controllers](https://docs.nestjs.com/controllers)
* @see [Microservices](https://docs.nestjs.com/microservices/basics#request-response)
*
* @publicApi
*/
export function Controller();
/**
* Decorator that marks a class as a Nest controller that can receive inbound
* requests and produce responses.
*
* An HTTP Controller responds to inbound HTTP Requests and produces HTTP Responses.
* It defines a class that provides the context for one or more related route
* handlers that correspond to HTTP request methods and associated routes
* for example `GET /api/profile`, `POST /user/resume`.
*
* A Microservice Controller responds to requests as well as events, running over
* a variety of transports [(read more here)](https://docs.nestjs.com/microservices/basics).
* It defines a class that provides a context for one or more message or event
* handlers.
*
* @param {string} prefix string that defines a `route path prefix`. The prefix
* is pre-pended to the path specified in any request decorator in the class.
*
* @see [Routing](https://docs.nestjs.com/controllers#routing)
* @see [Controllers](https://docs.nestjs.com/controllers)
* @see [Microservices](https://docs.nestjs.com/microservices/basics#request-response)
*
* @publicApi
*/
export function Controller(prefix: string);
/**
* Decorator that marks a class as a Nest controller that can receive inbound
* requests and produce responses.
*
* An HTTP Controller responds to inbound HTTP Requests and produces HTTP Responses.
* It defines a class that provides the context for one or more related route
* handlers that correspond to HTTP request methods and associated routes
* for example `GET /api/profile`, `POST /user/resume`.
*
* A Microservice Controller responds to requests as well as events, running over
* a variety of transports [(read more here)](https://docs.nestjs.com/microservices/basics).
* It defines a class that provides a context for one or more message or event
* handlers.
*
* @param {object} options configuration object specifying:
*
* - `scope` - symbol that determines the lifetime of a Controller instance.
* [See Scope](https://docs.nestjs.com/fundamentals/injection-scopes#usage) for
* more details.
* - `prefix` - string that defines a `route path prefix`. The prefix
* is pre-pended to the path specified in any request decorator in the class.
*
* @see [Routing](https://docs.nestjs.com/controllers#routing)
* @see [Controllers](https://docs.nestjs.com/controllers)
* @see [Microservices](https://docs.nestjs.com/microservices/basics#request-response)
*
* @publicApi
*/
export function Controller(options: ControllerOptions);
/**
* Decorator that marks a class as a Nest controller that can receive inbound
* requests and produce responses.
*
* An HTTP Controller responds to inbound HTTP Requests and produces HTTP Responses.
* It defines a class that provides the context for one or more related route
* handlers that correspond to HTTP request methods and associated routes
* for example `GET /api/profile`, `POST /user/resume`
*
* A Microservice Controller responds to requests as well as events, running over
* a variety of transports [(read more here)](https://docs.nestjs.com/microservices/basics).
* It defines a class that provides a context for one or more message or event
* handlers.
*
* @param prefixOrOptions a `route path prefix` or a `ControllerOptions` object.
* A `route path prefix` is pre-pended to the path specified in any request decorator
* in the class. `ControllerOptions` is an options configuration object specifying:
* - `scope` - symbol that determines the lifetime of a Controller instance.
* [See Scope](https://docs.nestjs.com/fundamentals/injection-scopes#usage) for
* more details.
* - `prefix` - string that defines a `route path prefix`. The prefix
* is pre-pended to the path specified in any request decorator in the class.
*
* @see [Routing](https://docs.nestjs.com/controllers#routing)
* @see [Controllers](https://docs.nestjs.com/controllers)
* @see [Microservices](https://docs.nestjs.com/microservices/basics#request-response)
* @see [Scope](https://docs.nestjs.com/fundamentals/injection-scopes#usage)
*
* @publicApi
*/
export function Controller(): ClassDecorator;
export function Controller(prefix: string): ClassDecorator;
export function Controller(options: ControllerOptions): ClassDecorator;
export function Controller(
prefixOrOptions?: string | ControllerOptions,
): ClassDecorator {
@@ -20,8 +130,8 @@ export function Controller(
const [path, scopeOptions] = isUndefined(prefixOrOptions)
? [defaultPath, undefined]
: isString(prefixOrOptions)
? [prefixOrOptions, undefined]
: [prefixOrOptions.path || defaultPath, { scope: prefixOrOptions.scope }];
? [prefixOrOptions, undefined]
: [prefixOrOptions.path || defaultPath, { scope: prefixOrOptions.scope }];
return (target: object) => {
Reflect.defineMetadata(PATH_METADATA, path, target);

View File

@@ -34,14 +34,26 @@ const defineFiltersMetadata = (...filters: (Function | ExceptionFilter)[]) => {
};
/**
* Bounds exception filters to the chosen context.
* When the `@UseFilters()` is used on the controller level:
* - Exception Filter will be set up to every handler (every method)
* Decorator that binds exception filters to the scope of the controller or
* method, depending on its context.
*
* When the `@UseFilters()` is used on the handle level:
* - Exception Filter will be set up only to the specified method
* When `@UseFilters` is used at the controller level, the filter will be
* applied to every handler (method) in the controller.
*
* @param {ExceptionFilter[]} ...filters
* When `@UseFilters` is used at the individual handler level, the filter
* will apply only to that specific method.
*
* @param filters exception filter instance or class, or a list of exception
* filter instances or classes.
*
* @see [Exception filters](https://docs.nestjs.com/exception-filters)
*
* @usageNotes
* Exception filters can also be set up globally for all controllers and routes
* using `app.useGlobalFilters()`. [See here for details](https://docs.nestjs.com/exception-filters#binding-filters)
*
* @publicApi
*/
export const UseFilters = (...filters: (ExceptionFilter | Function)[]) =>
defineFiltersMetadata(...filters);

View File

@@ -5,8 +5,33 @@ import {
import { isFunction, isUndefined } from '../../utils/shared.utils';
/**
* Injects provider which has to be available in the current injector (module) scope.
* Providers are recognized by either types or tokens.
* Decorator that marks a constructor parameter as a target for
* [Dependency Injection (DI)](https://docs.nestjs.com/providers#dependency-injection).
*
* Any injected provider must be visible within the module scope (loosely
* speaking, the containing module) of the class it is being injected into. This
* can be done by:
*
* - defining the provider in the same module scope
* - exporting the provider from one module scope and importing that module into the
* module scope of the class being injected into
* - exporting the provider from a module that is marked as global using the
* `@Global()` decorator
*
* #### Injection tokens
* Can be *types* (class names), *strings* or *symbols*. This depends on how the
* provider with which it is associated was defined. Providers defined with the
* `@Injectable()` decorator use the class name. Custom Providers may use strings
* or symbols as the injection token.
*
* @param token lookup key for the provider to be injected (assigned to the constructor
* parameter).
*
* @see [Providers](https://docs.nestjs.com/providers)
* @see [Custom Providers](https://docs.nestjs.com/fundamentals/custom-providers)
* @see [Injection Scopes](https://docs.nestjs.com/fundamentals/injection-scopes)
*
* @publicApi
*/
export function Inject<T = any>(token?: T) {
return (target: Object, key: string | symbol, index?: number) => {

View File

@@ -3,11 +3,42 @@ import { ScopeOptions } from '../../interfaces/scope-options.interface';
import { SCOPE_OPTIONS_METADATA } from './../../constants';
import { Type } from './../../interfaces/type.interface';
/**
* Defines the injection scope.
*
* @see [Injection Scopes](https://docs.nestjs.com/fundamentals/injection-scopes)
*
* @publicApi
*/
export interface InjectableOptions extends ScopeOptions {}
/**
* Defines the injectable class. This class can inject dependencies through constructor.
* Those dependencies have to belong to the same module.
* Decorator that marks a class as a [provider](https://docs.nestjs.com/providers).
* Providers can be injected into other classes via constructor parameter injection
* using Nest's built-in [Dependency Injection (DI)](https://docs.nestjs.com/providers#dependency-injection)
* system.
*
* When injecting a provider, it must be visible within the module scope (loosely
* speaking, the containing module) of the class it is being injected into. This
* can be done by:
*
* - defining the provider in the same module scope
* - exporting the provider from one module scope and importing that module into the
* module scope of the class being injected into
* - exporting the provider from a module that is marked as global using the
* `@Global()` decorator
*
* Providers can also be defined in a more explicit and imperative form using
* various [custom provider](https://docs.nestjs.com/fundamentals/custom-providers) techniques that expose
* more capabilities of the DI system.
*
* @param options options specifying scope of injectable
*
* @see [Providers](https://docs.nestjs.com/providers)
* @see [Custom Providers](https://docs.nestjs.com/fundamentals/custom-providers)
* @see [Injection Scopes](https://docs.nestjs.com/fundamentals/injection-scopes)
*
* @publicApi
*/
export function Injectable(options?: InjectableOptions): ClassDecorator {
return (target: object) => {

View File

@@ -5,7 +5,17 @@ import {
import { isUndefined } from '../../utils/shared.utils';
/**
* Sets dependency as an optional one.
* Parameter decorator for an injected dependency marking the
* dependency as optional.
*
* For example:
* ```typescript
* constructor(@Optional() @Inject('HTTP_OPTIONS')private readonly httpClient: T) {}
* ```
*
* @see [Optional providers](https://docs.nestjs.com/providers#optional-providers)
*
* @publicApi
*/
export function Optional() {
return (target: Object, key: string | symbol, index?: number) => {

View File

@@ -1,8 +1,20 @@
import { Logger } from './../../services/logger.service';
/**
* Assigns the metadata to the class/function under specified `key`.
* This metadata can be reflected using `Reflector` class.
* Decorator that assigns metadata to the class/function using the
* specified `key`.
*
* 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`
*
* This metadata can be reflected using the `Reflector` class.
*
* Example: `@SetMetadata('roles', ['admin'])`
*
* @see [Reflection](https://docs.nestjs.com/guards#reflection)
*
* @publicApi
*/
export const SetMetadata = <K = any, V = any>(
metadataKey: K,

View File

@@ -5,14 +5,25 @@ import { isFunction } from '../../utils/shared.utils';
import { validateEach } from '../../utils/validate-each.util';
/**
* Binds guards to the particular context.
* When the `@UseGuards()` is used on the controller level:
* - Guard will be register to each handler (every method)
* Decorator that binds guards to the scope of the controller or method,
* depending on its context.
*
* When the `@UseGuards()` is used on the handler level:
* - Guard will be registered only to the specified method
* When `@UseGuards` is used at the controller level, the guard will be
* applied to every handler (method) in the controller.
*
* @param {} ...guards
* When `@UseGuards` is used at the individual handler level, the guard
* will apply only to that specific method.
*
* @param guards a single guard instance or class, or a list of guard instances
* or classes.
*
* @see [Guards](https://docs.nestjs.com/guards)
*
* @usageNotes
* Guards can also be set up globally for all controllers and routes
* using `app.useGlobalGuards()`. [See here for details](https://docs.nestjs.com/guards#binding-guards)
*
* @publicApi
*/
export function UseGuards(...guards: (CanActivate | Function)[]) {
return (target: any, key?: string, descriptor?: any) => {

View File

@@ -5,14 +5,25 @@ import { isFunction } from '../../utils/shared.utils';
import { validateEach } from '../../utils/validate-each.util';
/**
* Binds interceptors to the particular context.
* When the `@UseInterceptors()` is used on the controller level:
* - Interceptor will be register to each handler (every method)
* Decorator that binds interceptors to the scope of the controller or method,
* depending on its context.
*
* When the `@UseInterceptors()` is used on the handle level:
* - Interceptor will be registered only to the specified method
* When `@UseInterceptors` is used at the controller level, the interceptor will
* be applied to every handler (method) in the controller.
*
* @param {} ...interceptors
* When `@UseInterceptors` is used at the individual handler level, the interceptor
* will apply only to that specific method.
*
* @param interceptors a single interceptor instance or class, or a list of
* interceptor instances or classes.
*
* @see [Interceptors](https://docs.nestjs.com/interceptors)
*
* @usageNotes
* Interceptors can also be set up globally for all controllers and routes
* using `app.useGlobalInterceptors()`. [See here for details](https://docs.nestjs.com/interceptors#binding-interceptors)
*
* @publicApi
*/
export function UseInterceptors(
...interceptors: (NestInterceptor | Function)[]

View File

@@ -5,15 +5,27 @@ import { isFunction } from '../../utils/shared.utils';
import { validateEach } from '../../utils/validate-each.util';
/**
* Binds pipes to the particular context.
* When the `@UsePipes()` is used on the controller level:
* - Pipe will be register to each handler (every method)
* Decorator that binds pipes to the scope of the controller or method,
* depending on its context.
*
* When the `@UsePipes()` is used on the handle level:
* - Pipe will be registered only to the specified method
* When `@UsePipes` is used at the controller level, the pipe will be
* applied to every handler (method) in the controller.
*
* @param {PipeTransform[]} ...pipes
* When `@UsePipes` is used at the individual handler level, the pipe
* will apply only to that specific method.
*
* @param pipes a single pipe instance or class, or a list of pipe instances or
* classes.
*
* @see [Pipes](https://docs.nestjs.com/pipes)
*
* @usageNotes
* Pipes can also be set up globally for all controllers and routes
* using `app.useGlobalPipes()`. [See here for details](https://docs.nestjs.com/pipes#class-validator)
*
* @publicApi
*/
export function UsePipes(...pipes: (PipeTransform | Function)[]) {
return (target: any, key?: string, descriptor?: any) => {
const isPipeValid = <T extends Function | Record<string, any>>(pipe: T) =>

View File

@@ -30,6 +30,7 @@ export type ParamDecoratorEnhancer = ParameterDecorator;
/**
* Defines HTTP route param decorator
*
* @param factory
*/
export function createParamDecorator(
@@ -48,7 +49,9 @@ export function createParamDecorator(
const isPipe = (pipe: any) =>
pipe &&
((isFunction(pipe) && pipe.prototype && isFunction(pipe.prototype.transform)) ||
((isFunction(pipe) &&
pipe.prototype &&
isFunction(pipe.prototype.transform)) ||
isFunction(pipe.transform));
const hasParamData = isNil(data) || !isPipe(data);

View File

@@ -2,7 +2,17 @@ import { HEADERS_METADATA } from '../../constants';
import { extendArrayMetadata } from '../../utils/extend-metadata.util';
/**
* Sets a response header.
* Request method Decorator. Sets a response header.
*
* For example:
* `@Header('Cache-Control', 'none')`
*
* @param name string to be used for header name
* @param value string to be used for header value
*
* @see [Headers](https://docs.nestjs.com/controllers#headers)
*
* @publicApi
*/
export function Header(name: string, value: string): MethodDecorator {
return (target: object, key, descriptor) => {

View File

@@ -1,10 +1,14 @@
import { HTTP_CODE_METADATA } from '../../constants';
/**
* Defines the HTTP response status code.
* It overrides default status code for the given request method.
* Request method Decorator. Defines the HTTP response status code. Overrides
* default status code for the decorated request method.
*
* @param {number} statusCode
* @param statusCode HTTP response code to be returned by route handler.
*
* @see [Http Status Codes](https://docs.nestjs.com/controllers#status-code)
*
* @publicApi
*/
export function HttpCode(statusCode: number): MethodDecorator {
return (target: object, key, descriptor) => {

View File

@@ -3,4 +3,5 @@ export * from './route-params.decorator';
export * from './http-code.decorator';
export * from './create-route-param-metadata.decorator';
export * from './render.decorator';
export * from './header.decorator';
export * from './header.decorator';
export * from './redirect.decorator';

View File

@@ -1,11 +1,17 @@
import { REDIRECT_METADATA } from '../../constants';
/**
* Redirects request.
* Redirects request to the specified URL.
*
* @publicApi
*/
export function Redirect(url: string): MethodDecorator {
export function Redirect(url: string, statusCode?: number): MethodDecorator {
return (target: object, key, descriptor) => {
Reflect.defineMetadata(REDIRECT_METADATA, url, descriptor.value);
Reflect.defineMetadata(
REDIRECT_METADATA,
{ statusCode, url },
descriptor.value,
);
return descriptor;
};
}

View File

@@ -1,7 +1,15 @@
import { RENDER_METADATA } from '../../constants';
/**
* Defines a template to be rendered by the controller.
* Route handler method Decorator. Defines a template to be rendered by the controller.
*
* For example: `@Render('index')`
*
* @param template name of the render engine template file
*
* @see [Model-View-Controller](https://docs.nestjs.com/techniques.mvc)
*
* @publicApi
*/
export function Render(template: string): MethodDecorator {
return (target: object, key, descriptor) => {

View File

@@ -31,41 +31,73 @@ const createMappingDecorator = (method: RequestMethod) => (
};
/**
* Routes HTTP POST requests to the specified path.
* Route handler (method) Decorator. Routes HTTP POST requests to the specified path.
*
* @see [Routing](https://docs.nestjs.com/controllers#routing)
*
* @publicApi
*/
export const Post = createMappingDecorator(RequestMethod.POST);
/**
* Routes HTTP GET requests to the specified path.
* Route handler (method) Decorator. Routes HTTP GET requests to the specified path.
*
* @see [Routing](https://docs.nestjs.com/controllers#routing)
*
* @publicApi
*/
export const Get = createMappingDecorator(RequestMethod.GET);
/**
* Routes HTTP DELETE requests to the specified path.
* Route handler (method) Decorator. Routes HTTP DELETE requests to the specified path.
*
* @see [Routing](https://docs.nestjs.com/controllers#routing)
*
* @publicApi
*/
export const Delete = createMappingDecorator(RequestMethod.DELETE);
/**
* Routes HTTP PUT requests to the specified path.
* Route handler (method) Decorator. Routes HTTP PUT requests to the specified path.
*
* @see [Routing](https://docs.nestjs.com/controllers#routing)
*
* @publicApi
*/
export const Put = createMappingDecorator(RequestMethod.PUT);
/**
* Routes HTTP PATCH requests to the specified path.
* Route handler (method) Decorator. Routes HTTP PATCH requests to the specified path.
*
* @see [Routing](https://docs.nestjs.com/controllers#routing)
*
* @publicApi
*/
export const Patch = createMappingDecorator(RequestMethod.PATCH);
/**
* Routes HTTP OPTIONS requests to the specified path.
* Route handler (method) Decorator. Routes HTTP OPTIONS requests to the specified path.
*
* @see [Routing](https://docs.nestjs.com/controllers#routing)
*
* @publicApi
*/
export const Options = createMappingDecorator(RequestMethod.OPTIONS);
/**
* Routes HTTP HEAD requests to the specified path.
* Route handler (method) Decorator. Routes HTTP HEAD requests to the specified path.
*
* @see [Routing](https://docs.nestjs.com/controllers#routing)
*
* @publicApi
*/
export const Head = createMappingDecorator(RequestMethod.HEAD);
/**
* Routes all HTTP requests to the specified path.
* Route handler (method) Decorator. Routes all HTTP requests to the specified path.
*
* @see [Routing](https://docs.nestjs.com/controllers#routing)
*
* @publicApi
*/
export const All = createMappingDecorator(RequestMethod.ALL);

View File

@@ -58,36 +58,198 @@ const createPipesRouteParamDecorator = (paramtype: RouteParamtypes) => (
);
};
/**
* Route handler parameter decorator. Extracts the `Request`
* object from the underlying platform and populates the decorated
* parameter with the value of `Request`.
*
* Example: `logout(@Request() req)`
*
* @see [Request object](https://docs.nestjs.com/controllers#request-object)
*
* @publicApi
*/
export const Request: () => ParameterDecorator = createRouteParamDecorator(
RouteParamtypes.REQUEST,
);
/**
* Route handler parameter decorator. Extracts the `Response`
* object from the underlying platform and populates the decorated
* parameter with the value of `Response`.
*
* Example: `logout(@Response() res)`
*
* @see [Request object](https://docs.nestjs.com/controllers#request-object)
*
* @publicApi
*/
export const Response: () => ParameterDecorator = createRouteParamDecorator(
RouteParamtypes.RESPONSE,
);
/**
* Route handler parameter decorator. Extracts reference to the `Next` function
* from the underlying platform and populates the decorated
* parameter with the value of `Next`.
*
* @see [Request object](https://docs.nestjs.com/controllers#request-object)
*
* @publicApi
*/
export const Next: () => ParameterDecorator = createRouteParamDecorator(
RouteParamtypes.NEXT,
);
/**
* Route handler parameter decorator. Extracts the `Session` object
* from the underlying platform and populates the decorated
* parameter with the value of `Session`.
*
* @see [Request object](https://docs.nestjs.com/controllers#request-object)
*
* @publicApi
*/
export const Session: () => ParameterDecorator = createRouteParamDecorator(
RouteParamtypes.SESSION,
);
/**
* Route handler parameter decorator. Extracts the `file` object
* and populates the decorated parameter with the value of `file`.
* Used in conjunction with
* [multer middleware](https://github.com/expressjs/multer).
*
* For example:
* ```typescript
* uploadFile(@UploadedFile() file) {
* console.log(file);
* }
* ```
* @see [Request object](https://docs.nestjs.com/techniques/file-upload)
*
* @publicApi
*/
export const UploadedFile: (
fileKey?: string,
) => ParameterDecorator = createRouteParamDecorator(RouteParamtypes.FILE);
/**
* Route handler parameter decorator. Extracts the `files` object
* and populates the decorated parameter with the value of `files`.
* Used in conjunction with
* [multer middleware](https://github.com/expressjs/multer).
*
* For example:
* ```typescript
* uploadFile(@UploadedFiles() files) {
* console.log(files);
* }
* ```
* @see [Request object](https://docs.nestjs.com/techniques/file-upload)
*
* @publicApi
*/
export const UploadedFiles: () => ParameterDecorator = createRouteParamDecorator(
RouteParamtypes.FILES,
);
/**
* Route handler parameter decorator. Extracts the `headers`
* property from the `req` object and populates the decorated
* parameter with the value of `headers`.
*
* For example: `async update(@Headers('Cache-Control') cacheControl: string)`
*
* @param property name of single header property to extract.
*
* @see [Request object](https://docs.nestjs.com/controllers#request-object)
*
* @publicApi
*/
export const Headers: (
property?: string,
) => ParameterDecorator = createRouteParamDecorator(RouteParamtypes.HEADERS);
/**
* Route handler parameter decorator. Extracts the `query`
* property from the `req` object and populates the decorated
* parameter with the value of `query`. May also apply pipes to the bound
* query parameter.
*
* For example:
* ```typescript
* async find(@Query('user') user: string)
* ```
*
* @param property name of single property to extract from the `query` object
* @param pipes one or more pipes to apply to the bound query parameter
*
* @see [Request object](https://docs.nestjs.com/controllers#request-object)
*
* @publicApi
*/
export function Query(): ParameterDecorator;
/**
* Route handler parameter decorator. Extracts the `query`
* property from the `req` object and populates the decorated
* parameter with the value of `query`. May also apply pipes to the bound
* query parameter.
*
* For example:
* ```typescript
* async find(@Query('user') user: string)
* ```
*
* @param property name of single property to extract from the `query` object
* @param pipes one or more pipes to apply to the bound query parameter
*
* @see [Request object](https://docs.nestjs.com/controllers#request-object)
*
* @publicApi
*/
export function Query(
...pipes: (Type<PipeTransform> | PipeTransform)[]
): ParameterDecorator;
/**
* Route handler parameter decorator. Extracts the `query`
* property from the `req` object and populates the decorated
* parameter with the value of `query`. May also apply pipes to the bound
* query parameter.
*
* For example:
* ```typescript
* async find(@Query('user') user: string)
* ```
*
* @param property name of single property to extract from the `query` object
* @param pipes one or more pipes to apply to the bound query parameter
*
* @see [Request object](https://docs.nestjs.com/controllers#request-object)
*
* @publicApi
*/
export function Query(
property: string,
...pipes: (Type<PipeTransform> | PipeTransform)[]
): ParameterDecorator;
/**
* Route handler parameter decorator. Extracts the `query`
* property from the `req` object and populates the decorated
* parameter with the value of `query`. May also apply pipes to the bound
* query parameter.
*
* For example:
* ```typescript
* async find(@Query('user') user: string)
* ```
*
* @param property name of single property to extract from the `query` object
* @param pipes one or more pipes to apply to the bound query parameter
*
* @see [Request object](https://docs.nestjs.com/controllers#request-object)
*
* @publicApi
*/
export function Query(
property?: string | (Type<PipeTransform> | PipeTransform),
...pipes: (Type<PipeTransform> | PipeTransform)[]
@@ -98,14 +260,90 @@ export function Query(
);
}
/**
* Route handler parameter decorator. Extracts the entire `body`
* object from the `req` object and populates the decorated
* parameter with the value of `body`.
*
* For example:
* ```typescript
* async create(@Body() cat: CreateCatDto)
* ```
*
* @see [Request object](https://docs.nestjs.com/controllers#request-object)
*
* @publicApi
*/
export function Body(): ParameterDecorator;
/**
* Route handler parameter decorator. Extracts the entire `body`
* object from the `req` object and populates the decorated
* parameter with the value of `body`. Also applies the specified
* pipes to that parameter.
*
* For example:
* ```typescript
* async create(@Body(new ValidationPipe()) cat: CreateCatDto)
* ```
*
* @param pipes one or more pipes - either instances or classes - to apply to
* the bound body parameter.
*
* @see [Request object](https://docs.nestjs.com/controllers#request-object)
* @see [Working with pipes](https://docs.nestjs.com/custom-decorators#working-with-pipes)
*
* @publicApi
*/
export function Body(
...pipes: (Type<PipeTransform> | PipeTransform)[]
): ParameterDecorator;
/**
* Route handler parameter decorator. Extracts a single property from
* the `body` object property of the `req` object and populates the decorated
* parameter with the value of that property. Also applies pipes to the bound
* body parameter.
*
* For example:
* ```typescript
* async create(@Body('role', new ValidationPipe()) role: string)
* ```
*
* @param property name of single property to extract from the `body` object
* @param pipes one or more pipes - either instances or classes - to apply to
* the bound body parameter.
*
* @see [Request object](https://docs.nestjs.com/controllers#request-object)
* @see [Working with pipes](https://docs.nestjs.com/custom-decorators#working-with-pipes)
*
* @publicApi
*/
export function Body(
property: string,
...pipes: (Type<PipeTransform> | PipeTransform)[]
): ParameterDecorator;
/**
* Route handler parameter decorator. Extracts the entire `body` object
* property, or optionally a named property of the `body` object, from
* the `req` object and populates the decorated parameter with that value.
* Also applies pipes to the bound body parameter.
*
* For example:
* ```typescript
* async create(@Body('role', new ValidationPipe()) role: string)
* ```
*
* @param property name of single property to extract from the `body` object
* @param pipes one or more pipes - either instances or classes - to apply to
* the bound body parameter.
*
* @see [Request object](https://docs.nestjs.com/controllers#request-object)
* @see [Working with pipes](https://docs.nestjs.com/custom-decorators#working-with-pipes)
*
* @publicApi
*/
export function Body(
property?: string | (Type<PipeTransform> | PipeTransform),
...pipes: (Type<PipeTransform> | PipeTransform)[]
@@ -116,14 +354,110 @@ export function Body(
);
}
/**
* Route handler parameter decorator. Extracts the `params`
* property from the `req` object and populates the decorated
* parameter with the value of `params`. May also apply pipes to the bound
* parameter.
*
* For example, extracting all params:
* ```typescript
* findOne(@Param() params: string[])
* ```
*
* For example, extracting a single param:
* ```typescript
* findOne(@Param('id') id: string)
* ```
* @param property name of single property to extract from the `req` object
* @param pipes one or more pipes - either instances or classes - to apply to
* the bound parameter.
*
* @see [Request object](https://docs.nestjs.com/controllers#request-object)
* @see [Working with pipes](https://docs.nestjs.com/custom-decorators#working-with-pipes)
*
* @publicApi
*/
export function Param(): ParameterDecorator;
/**
* Route handler parameter decorator. Extracts the `params`
* property from the `req` object and populates the decorated
* parameter with the value of `params`. May also apply pipes to the bound
* parameter.
*
* For example, extracting all params:
* ```typescript
* findOne(@Param() params: string[])
* ```
*
* For example, extracting a single param:
* ```typescript
* findOne(@Param('id') id: string)
* ```
* @param property name of single property to extract from the `req` object
* @param pipes one or more pipes - either instances or classes - to apply to
* the bound parameter.
*
* @see [Request object](https://docs.nestjs.com/controllers#request-object)
* @see [Working with pipes](https://docs.nestjs.com/custom-decorators#working-with-pipes)
*
* @publicApi
*/
export function Param(
...pipes: (Type<PipeTransform> | PipeTransform)[]
): ParameterDecorator;
/**
* Route handler parameter decorator. Extracts the `params`
* property from the `req` object and populates the decorated
* parameter with the value of `params`. May also apply pipes to the bound
* parameter.
*
* For example, extracting all params:
* ```typescript
* findOne(@Param() params: string[])
* ```
*
* For example, extracting a single param:
* ```typescript
* findOne(@Param('id') id: string)
* ```
* @param property name of single property to extract from the `req` object
* @param pipes one or more pipes - either instances or classes - to apply to
* the bound parameter.
*
* @see [Request object](https://docs.nestjs.com/controllers#request-object)
* @see [Working with pipes](https://docs.nestjs.com/custom-decorators#working-with-pipes)
*
* @publicApi
*/
export function Param(
property: string,
...pipes: (Type<PipeTransform> | PipeTransform)[]
): ParameterDecorator;
/**
* Route handler parameter decorator. Extracts the `params`
* property from the `req` object and populates the decorated
* parameter with the value of `params`. May also apply pipes to the bound
* parameter.
*
* For example, extracting all params:
* ```typescript
* findOne(@Param() params: string[])
* ```
*
* For example, extracting a single param:
* ```typescript
* findOne(@Param('id') id: string)
* ```
* @param property name of single property to extract from the `req` object
* @param pipes one or more pipes - either instances or classes - to apply to
* the bound parameter.
*
* @see [Request object](https://docs.nestjs.com/controllers#request-object)
* @see [Working with pipes](https://docs.nestjs.com/custom-decorators#working-with-pipes)
*
* @publicApi
*/
export function Param(
property?: string | (Type<PipeTransform> | PipeTransform),
...pipes: (Type<PipeTransform> | PipeTransform)[]

View File

@@ -1,8 +1,15 @@
import { GLOBAL_MODULE_METADATA } from '../../constants';
/**
* Makes the module global-scoped.
* Once imported will be available for all existing modules.
* Decorator that makes a module global-scoped.
*
* Once imported into any module, a global-scoped module will be visible
* in all modules. Thereafter, modules that wish to inject a service exported
* from a global module do not need to import the provider module.
*
* @see [Global modules](https://docs.nestjs.com/modules#global-modules)
*
* @publicApi
*/
export function Global(): ClassDecorator {
return (target: any) => {

View File

@@ -21,12 +21,18 @@ const validateKeys = (keys: string[]) => {
};
/**
* Defines the module
* - `imports` - the set of the 'imported' modules
* - `controllers` - the list of controllers (e.g. HTTP controllers)
* - `providers` - the list of providers that belong to this module. They can be injected between themselves.
* - `exports` - the set of components, which should be available for modules, which imports this module
* @param metadata {ModuleMetadata} Module metadata
* Decorator that marks a class as a [module](https://docs.nestjs.com/modules).
*
* Modules are used by Nest to organize the application structure into scopes. Controllers
* and Providers are scoped by the module they are declared in. Modules and their
* classes (Controllers and Providers) form a graph that determines how Nest
* performs [Dependency Injection (DI)](https://docs.nestjs.com/providers#dependency-injection).
*
* @param metadata module configuration metadata
*
* @see [Modules](https://docs.nestjs.com/modules)
*
* @publicApi
*/
export function Module(metadata: ModuleMetadata): ClassDecorator {
const propsKeys = Object.keys(metadata);

View File

@@ -1,11 +1,42 @@
import { HttpException } from './http.exception';
import { HttpStatus } from '../enums/http-status.enum';
import { createHttpExceptionBody } from '../utils/http-exception-body.util';
/**
* Defines an HTTP exception for *Bad Gateway* type errors.
*
* @see [Base Exceptions](https://docs.nestjs.com/exception-filters#base-exceptions)
*
* @publicApi
*/
export class BadGatewayException extends HttpException {
/**
* Instantiate a `BadGatewayException` Exception.
*
* @example
* `throw new BadGatewayException()`
*
* @usageNotes
* The constructor arguments define the HTTP response.
* - The `message` argument defines the JSON response body.
* - The `error` argument defines the HTTP Status Code.
*
* By default, the JSON response body contains two properties:
* - `statusCode`: defaults to the Http Status Code provided in the `error` argument
* - `message`: the string `'Bad Gateway'` by default; override this by supplying
* a string in the `message` parameter.
*
* To override the entire JSON response body, pass an object. Nest will serialize
* the object and return it as the JSON response body.
*
* The `error` argument is required, and should be a valid HTTP status code.
* Best practice is to use the `HttpStatus` enum imported from `nestjs/common`.
*
* @param message string or object describing the error condition.
* @param error HTTP response status code
*/
constructor(message?: string | object | any, error = 'Bad Gateway') {
super(
createHttpExceptionBody(message, error, HttpStatus.BAD_GATEWAY),
HttpException.createBody(message, error, HttpStatus.BAD_GATEWAY),
HttpStatus.BAD_GATEWAY,
);
}

View File

@@ -1,11 +1,42 @@
import { HttpException } from './http.exception';
import { HttpStatus } from '../enums/http-status.enum';
import { createHttpExceptionBody } from '../utils/http-exception-body.util';
/**
* Defines an HTTP exception for *Bad Request* type errors.
*
* @see [Base Exceptions](https://docs.nestjs.com/exception-filters#base-exceptions)
*
* @publicApi
*/
export class BadRequestException extends HttpException {
/**
* Instantiate a `BadRequestException` Exception.
*
* @example
* `throw new BadRequestException()`
*
* @usageNotes
* The constructor arguments define the HTTP response.
* - The `message` argument defines the JSON response body.
* - The `error` argument defines the HTTP Status Code.
*
* By default, the JSON response body contains two properties:
* - `statusCode`: defaults to the Http Status Code provided in the `error` argument
* - `message`: the string `'Bad Request'` by default; override this by supplying
* a string in the `message` parameter.
*
* To override the entire JSON response body, pass an object. Nest will serialize
* the object and return it as the JSON response body.
*
* The `error` argument is required, and should be a valid HTTP status code.
* Best practice is to use the `HttpStatus` enum imported from `nestjs/common`.
*
* @param message string or object describing the error condition.
* @param error HTTP response status code
*/
constructor(message?: string | object | any, error = 'Bad Request') {
super(
createHttpExceptionBody(message, error, HttpStatus.BAD_REQUEST),
HttpException.createBody(message, error, HttpStatus.BAD_REQUEST),
HttpStatus.BAD_REQUEST,
);
}

View File

@@ -1,11 +1,41 @@
import { HttpException } from './http.exception';
import { HttpStatus } from '../enums/http-status.enum';
import { createHttpExceptionBody } from '../utils/http-exception-body.util';
/**
* Defines an HTTP exception for *Conflict* type errors.
*
* @see [Base Exceptions](https://docs.nestjs.com/exception-filters#base-exceptions)
*
* @publicApi
*/
export class ConflictException extends HttpException {
constructor(message?: string | object | any, error = 'Conflict') {
/**
* Instantiate a `ConflictException` Exception.
*
* @example
* `throw new ConflictException()`
*
* @usageNotes
* The constructor arguments define the HTTP response.
* - The `message` argument defines the JSON response body.
* - The `error` argument defines the HTTP Status Code.
*
* By default, the JSON response body contains two properties:
* - `statusCode`: defaults to the Http Status Code provided in the `error` argument
* - `message`: the string `'Conflict'` by default; override this by supplying
* a string in the `message` parameter.
*
* To override the entire JSON response body, pass an object. Nest will serialize
* the object and return it as the JSON response body.
*
* The `error` argument is required, and should be a valid HTTP status code.
* Best practice is to use the `HttpStatus` enum imported from `nestjs/common`.
*
* @param message string or object describing the error condition.
* @param error HTTP response status code
*/ constructor(message?: string | object | any, error = 'Conflict') {
super(
createHttpExceptionBody(message, error, HttpStatus.CONFLICT),
HttpException.createBody(message, error, HttpStatus.CONFLICT),
HttpStatus.CONFLICT,
);
}

View File

@@ -1,11 +1,42 @@
import { HttpException } from './http.exception';
import { HttpStatus } from '../enums/http-status.enum';
import { createHttpExceptionBody } from '../utils/http-exception-body.util';
/**
* Defines an HTTP exception for *Forbidden* type errors.
*
* @see [Base Exceptions](https://docs.nestjs.com/exception-filters#base-exceptions)
*
* @publicApi
*/
export class ForbiddenException extends HttpException {
/**
* Instantiate a `ForbiddenException` Exception.
*
* @example
* `throw new ForbiddenException()`
*
* @usageNotes
* The constructor arguments define the HTTP response.
* - The `message` argument defines the JSON response body.
* - The `error` argument defines the HTTP Status Code.
*
* By default, the JSON response body contains two properties:
* - `statusCode`: defaults to the Http Status Code provided in the `error` argument
* - `message`: the string `'Forbidden'` by default; override this by supplying
* a string in the `message` parameter.
*
* To override the entire JSON response body, pass an object. Nest will serialize
* the object and return it as the JSON response body.
*
* The `error` argument is required, and should be a valid HTTP status code.
* Best practice is to use the `HttpStatus` enum imported from `nestjs/common`.
*
* @param message string or object describing the error condition.
* @param error HTTP response status code
*/
constructor(message?: string | object | any, error = 'Forbidden') {
super(
createHttpExceptionBody(message, error, HttpStatus.FORBIDDEN),
HttpException.createBody(message, error, HttpStatus.FORBIDDEN),
HttpStatus.FORBIDDEN,
);
}

View File

@@ -1,11 +1,42 @@
import { HttpException } from './http.exception';
import { HttpStatus } from '../enums/http-status.enum';
import { createHttpExceptionBody } from '../utils/http-exception-body.util';
/**
* Defines an HTTP exception for *Gatway Timeout* type errors.
*
* @see [Base Exceptions](https://docs.nestjs.com/exception-filters#base-exceptions)
*
* @publicApi
*/
export class GatewayTimeoutException extends HttpException {
/**
* Instantiate a `GatewayTimeoutException` Exception.
*
* @example
* `throw new GatewayTimeoutException()`
*
* @usageNotes
* The constructor arguments define the HTTP response.
* - The `message` argument defines the JSON response body.
* - The `error` argument defines the HTTP Status Code.
*
* By default, the JSON response body contains two properties:
* - `statusCode`: defaults to the Http Status Code provided in the `error` argument
* - `message`: the string `'Gateway Timeout'` by default; override this by supplying
* a string in the `message` parameter.
*
* To override the entire JSON response body, pass an object. Nest will serialize
* the object and return it as the JSON response body.
*
* The `error` argument is required, and should be a valid HTTP status code.
* Best practice is to use the `HttpStatus` enum imported from `nestjs/common`.
*
* @param message string or object describing the error condition.
* @param error HTTP response status code
*/
constructor(message?: string | object | any, error = 'Gateway Timeout') {
super(
createHttpExceptionBody(message, error, HttpStatus.GATEWAY_TIMEOUT),
HttpException.createBody(message, error, HttpStatus.GATEWAY_TIMEOUT),
HttpStatus.GATEWAY_TIMEOUT,
);
}

View File

@@ -1,11 +1,42 @@
import { HttpException } from './http.exception';
import { HttpStatus } from '../enums/http-status.enum';
import { createHttpExceptionBody } from '../utils/http-exception-body.util';
/**
* Defines an HTTP exception for *Gone* type errors.
*
* @see [Base Exceptions](https://docs.nestjs.com/exception-filters#base-exceptions)
*
* @publicApi
*/
export class GoneException extends HttpException {
/**
* Instantiate a `GoneException` Exception.
*
* @example
* `throw new GoneException()`
*
* @usageNotes
* The constructor arguments define the HTTP response.
* - The `message` argument defines the JSON response body.
* - The `error` argument defines the HTTP Status Code.
*
* By default, the JSON response body contains two properties:
* - `statusCode`: defaults to the Http Status Code provided in the `error` argument
* - `message`: the string `'Gone'` by default; override this by supplying
* a string in the `message` parameter.
*
* To override the entire JSON response body, pass an object. Nest will serialize
* the object and return it as the JSON response body.
*
* The `error` argument is required, and should be a valid HTTP status code.
* Best practice is to use the `HttpStatus` enum imported from `nestjs/common`.
*
* @param message string or object describing the error condition.
* @param error HTTP response status code
*/
constructor(message?: string | object | any, error = 'Gone') {
super(
createHttpExceptionBody(message, error, HttpStatus.GONE),
HttpException.createBody(message, error, HttpStatus.GONE),
HttpStatus.GONE,
);
}

View File

@@ -1,21 +1,39 @@
import { isString } from '../utils/shared.utils';
import { isString, isObject } from '../utils/shared.utils';
/**
* Defines the base Nest HTTP exception, which is handled by the default
* Exceptions Handler.
*
* @see [Base Exceptions](https://docs.nestjs.com/exception-filters#base-exceptions)
*
* @publicApi
*/
export class HttpException extends Error {
public readonly message: any;
/**
* Base Nest application exception, which is handled by the default Exceptions Handler.
* If you throw an exception from your HTTP route handlers, Nest will map them to the appropriate HTTP response and send to the client.
* Instantiate a plain HTTP Exception.
*
* When `response` is an object:
* - object will be stringified and returned to the user as a JSON response,
* @example
* `throw new HttpException()`
*
* When `response` is a string:
* - Nest will create a response with two properties:
* ```
* message: response,
* statusCode: X
* ```
* @usageNotes
* The constructor arguments define the HTTP response.
* - The `response` argument (required) defines the JSON response body.
* - The `status` argument (required) defines the HTTP Status Code.
*
* By default, the JSON response body contains two properties:
* - `statusCode`: defaults to the Http Status Code provided in the `error` argument
* - `message`: a short description of the HTTP error by default; override this
* by supplying a string in the `response` parameter.
*
* To override the entire JSON response body, pass an object. Nest will serialize
* the object and return it as the JSON response body.
*
* The `status` argument is required, and should be a valid HTTP status code.
* Best practice is to use the `HttpStatus` enum imported from `nestjs/common`.
*
* @param response string or object describing the error condition.
* @param status HTTP response status code
*/
constructor(
private readonly response: string | object,
@@ -41,4 +59,17 @@ export class HttpException extends Error {
private getErrorString(target: string | object): string {
return isString(target) ? target : JSON.stringify(target);
}
public static createBody = (
message: object | string,
error?: string,
statusCode?: number,
) => {
if (!message) {
return { statusCode, error };
}
return isObject(message) && !Array.isArray(message)
? message
: { statusCode, error, message };
}
}

View File

@@ -1,17 +1,45 @@
import { HttpException } from './http.exception';
import { HttpStatus } from '../enums/http-status.enum';
import { createHttpExceptionBody } from '../utils/http-exception-body.util';
import { HttpException } from './http.exception';
/**
* Any attempt to brew coffee with a teapot should result in the error code "418 I'm a teapot".
* The resulting entity body MAY be short and stout.
* Defines an HTTP exception for *ImATeapotException* type errors.
*
* http://save418.com/
* Any attempt to brew coffee with a teapot should result in the error code
* "418 I'm a teapot". The resulting entity body MAY be short and stout.
*
* @see [Base Exceptions](https://docs.nestjs.com/exception-filters#base-exceptions)
*
* @publicApi
*/
export class ImATeapotException extends HttpException {
/**
* Instantiate an `ImATeapotException` Exception.
*
* @example
* `throw new BadGatewayException()`
*
* @usageNotes
* The constructor arguments define the HTTP response.
* - The `message` argument defines the JSON response body.
* - The `error` argument defines the HTTP Status Code.
*
* By default, the JSON response body contains two properties:
* - `statusCode`: defaults to the Http Status Code provided in the `error` argument
* - `message`: the string `"I'm a Teapot"` by default; override this by supplying
* a string in the `message` parameter.
*
* To override the entire JSON response body, pass an object. Nest will serialize
* the object and return it as the JSON response body.
*
* The `error` argument is required, and should be a valid HTTP status code.
* Best practice is to use the `HttpStatus` enum imported from `nestjs/common`.
*
* @param message string or object describing the error condition.
* @param error HTTP response status code
*/
constructor(message?: string | object | any, error = 'I\'m a teapot') {
super(
createHttpExceptionBody(message, error, HttpStatus.I_AM_A_TEAPOT),
HttpException.createBody(message, error, HttpStatus.I_AM_A_TEAPOT),
HttpStatus.I_AM_A_TEAPOT,
);
}

View File

@@ -1,14 +1,45 @@
import { HttpException } from './http.exception';
import { HttpStatus } from '../enums/http-status.enum';
import { createHttpExceptionBody } from '../utils/http-exception-body.util';
/**
* Defines an HTTP exception for *Internal Server Error* type errors.
*
* @see [Base Exceptions](https://docs.nestjs.com/exception-filters#base-exceptions)
*
* @publicApi
*/
export class InternalServerErrorException extends HttpException {
/**
* Instantiate an `InternalServerErrorException` Exception.
*
* @example
* `throw new InternalServerErrorException()`
*
* @usageNotes
* The constructor arguments define the HTTP response.
* - The `message` argument defines the JSON response body.
* - The `error` argument defines the HTTP Status Code.
*
* By default, the JSON response body contains two properties:
* - `statusCode`: defaults to the Http Status Code provided in the `error` argument
* - `message`: the string `'Internal Server Error'` by default; override this by supplying
* a string in the `message` parameter.
*
* To override the entire JSON response body, pass an object. Nest will serialize
* the object and return it as the JSON response body.
*
* The `error` argument is required, and should be a valid HTTP status code.
* Best practice is to use the `HttpStatus` enum imported from `nestjs/common`.
*
* @param message string or object describing the error condition.
* @param error HTTP response status code
*/
constructor(
message?: string | object | any,
error = 'Internal Server Error',
) {
super(
createHttpExceptionBody(message, error, HttpStatus.INTERNAL_SERVER_ERROR),
HttpException.createBody(message, error, HttpStatus.INTERNAL_SERVER_ERROR),
HttpStatus.INTERNAL_SERVER_ERROR,
);
}

View File

@@ -1,11 +1,42 @@
import { HttpException } from './http.exception';
import { HttpStatus } from '../enums/http-status.enum';
import { createHttpExceptionBody } from '../utils/http-exception-body.util';
/**
* Defines an HTTP exception for *Method Not Allowed* type errors.
*
* @see [Base Exceptions](https://docs.nestjs.com/exception-filters#base-exceptions)
*
* @publicApi
*/
export class MethodNotAllowedException extends HttpException {
/**
* Instantiate a `MethodNotAllowedException` Exception.
*
* @example
* `throw new MethodNotAllowedException()`
*
* @usageNotes
* The constructor arguments define the HTTP response.
* - The `message` argument defines the JSON response body.
* - The `error` argument defines the HTTP Status Code.
*
* By default, the JSON response body contains two properties:
* - `statusCode`: defaults to the Http Status Code provided in the `error` argument
* - `message`: the string `'Method Not Allowed'` by default; override this by supplying
* a string in the `message` parameter.
*
* To override the entire JSON response body, pass an object. Nest will serialize
* the object and return it as the JSON response body.
*
* The `error` argument is required, and should be a valid HTTP status code.
* Best practice is to use the `HttpStatus` enum imported from `nestjs/common`.
*
* @param message string or object describing the error condition.
* @param error HTTP response status code
*/
constructor(message?: string | object | any, error = 'Method Not Allowed') {
super(
createHttpExceptionBody(message, error, HttpStatus.METHOD_NOT_ALLOWED),
HttpException.createBody(message, error, HttpStatus.METHOD_NOT_ALLOWED),
HttpStatus.METHOD_NOT_ALLOWED,
);
}

View File

@@ -1,11 +1,42 @@
import { HttpException } from './http.exception';
import { HttpStatus } from '../enums/http-status.enum';
import { createHttpExceptionBody } from '../utils/http-exception-body.util';
/**
* Defines an HTTP exception for *Not Acceptable* type errors.
*
* @see [Base Exceptions](https://docs.nestjs.com/exception-filters#base-exceptions)
*
* @publicApi
*/
export class NotAcceptableException extends HttpException {
/**
* Instantiate a `NotAcceptableException` Exception.
*
* @example
* `throw new NotAcceptableException()`
*
* @usageNotes
* The constructor arguments define the HTTP response.
* - The `message` argument defines the JSON response body.
* - The `error` argument defines the HTTP Status Code.
*
* By default, the JSON response body contains two properties:
* - `statusCode`: defaults to the Http Status Code provided in the `error` argument
* - `message`: the string `'Not Acceptable'` by default; override this by supplying
* a string in the `message` parameter.
*
* To override the entire JSON response body, pass an object. Nest will serialize
* the object and return it as the JSON response body.
*
* The `error` argument is required, and should be a valid HTTP status code.
* Best practice is to use the `HttpStatus` enum imported from `nestjs/common`.
*
* @param message string or object describing the error condition.
* @param error HTTP response status code
*/
constructor(message?: string | object | any, error = 'Not Acceptable') {
super(
createHttpExceptionBody(message, error, HttpStatus.NOT_ACCEPTABLE),
HttpException.createBody(message, error, HttpStatus.NOT_ACCEPTABLE),
HttpStatus.NOT_ACCEPTABLE,
);
}

View File

@@ -1,11 +1,42 @@
import { HttpException } from './http.exception';
import { HttpStatus } from '../enums/http-status.enum';
import { createHttpExceptionBody } from '../utils/http-exception-body.util';
/**
* Defines an HTTP exception for *Not Found* type errors.
*
* @see [Base Exceptions](https://docs.nestjs.com/exception-filters#base-exceptions)
*
* @publicApi
*/
export class NotFoundException extends HttpException {
/**
* Instantiate a `NotFoundException` Exception.
*
* @example
* `throw new NotFoundException()`
*
* @usageNotes
* The constructor arguments define the HTTP response.
* - The `message` argument defines the JSON response body.
* - The `error` argument defines the HTTP Status Code.
*
* By default, the JSON response body contains two properties:
* - `statusCode`: defaults to the Http Status Code provided in the `error` argument
* - `message`: the string `'Not Found'` by default; override this by supplying
* a string in the `message` parameter.
*
* To override the entire JSON response body, pass an object. Nest will serialize
* the object and return it as the JSON response body.
*
* The `error` argument is required, and should be a valid HTTP status code.
* Best practice is to use the `HttpStatus` enum imported from `nestjs/common`.
*
* @param message string or object describing the error condition.
* @param error HTTP response status code
*/
constructor(message?: string | object | any, error = 'Not Found') {
super(
createHttpExceptionBody(message, error, HttpStatus.NOT_FOUND),
HttpException.createBody(message, error, HttpStatus.NOT_FOUND),
HttpStatus.NOT_FOUND,
);
}

View File

@@ -1,11 +1,42 @@
import { HttpException } from './http.exception';
import { HttpStatus } from '../enums/http-status.enum';
import { createHttpExceptionBody } from '../utils/http-exception-body.util';
/**
* Defines an HTTP exception for *Not Implemented* type errors.
*
* @see [Base Exceptions](https://docs.nestjs.com/exception-filters#base-exceptions)
*
* @publicApi
*/
export class NotImplementedException extends HttpException {
/**
* Instantiate a `NotImplementedException` Exception.
*
* @example
* `throw new NotImplementedException()`
*
* @usageNotes
* The constructor arguments define the HTTP response.
* - The `message` argument defines the JSON response body.
* - The `error` argument defines the HTTP Status Code.
*
* By default, the JSON response body contains two properties:
* - `statusCode`: defaults to the Http Status Code provided in the `error` argument
* - `message`: the string `'Not Implemented'` by default; override this by supplying
* a string in the `message` parameter.
*
* To override the entire JSON response body, pass an object. Nest will serialize
* the object and return it as the JSON response body.
*
* The `error` argument is required, and should be a valid HTTP status code.
* Best practice is to use the `HttpStatus` enum imported from `nestjs/common`.
*
* @param message string or object describing the error condition.
* @param error HTTP response status code
*/
constructor(message?: string | object | any, error = 'Not Implemented') {
super(
createHttpExceptionBody(message, error, HttpStatus.NOT_IMPLEMENTED),
HttpException.createBody(message, error, HttpStatus.NOT_IMPLEMENTED),
HttpStatus.NOT_IMPLEMENTED,
);
}

View File

@@ -1,11 +1,42 @@
import { HttpException } from './http.exception';
import { HttpStatus } from '../enums/http-status.enum';
import { createHttpExceptionBody } from '../utils/http-exception-body.util';
/**
* Defines an HTTP exception for *Payload Too Large* type errors.
*
* @see [Base Exceptions](https://docs.nestjs.com/exception-filters#base-exceptions)
*
* @publicApi
*/
export class PayloadTooLargeException extends HttpException {
/**
* Instantiate a `PayloadTooLargeException` Exception.
*
* @example
* `throw new PayloadTooLargeException()`
*
* @usageNotes
* The constructor arguments define the HTTP response.
* - The `message` argument defines the JSON response body.
* - The `error` argument defines the HTTP Status Code.
*
* By default, the JSON response body contains two properties:
* - `statusCode`: defaults to the Http Status Code provided in the `error` argument
* - `message`: the string `'Payload Too Large'` by default; override this by supplying
* a string in the `message` parameter.
*
* To override the entire JSON response body, pass an object. Nest will serialize
* the object and return it as the JSON response body.
*
* The `error` argument is required, and should be a valid HTTP status code.
* Best practice is to use the `HttpStatus` enum imported from `nestjs/common`.
*
* @param message string or object describing the error condition.
* @param error HTTP response status code
*/
constructor(message?: string | object | any, error = 'Payload Too Large') {
super(
createHttpExceptionBody(message, error, HttpStatus.PAYLOAD_TOO_LARGE),
HttpException.createBody(message, error, HttpStatus.PAYLOAD_TOO_LARGE),
HttpStatus.PAYLOAD_TOO_LARGE,
);
}

View File

@@ -1,11 +1,42 @@
import { HttpException } from './http.exception';
import { HttpStatus } from '../enums/http-status.enum';
import { createHttpExceptionBody } from '../utils/http-exception-body.util';
/**
* Defines an HTTP exception for *Request Timeout* type errors.
*
* @see [Base Exceptions](https://docs.nestjs.com/exception-filters#base-exceptions)
*
* @publicApi
*/
export class RequestTimeoutException extends HttpException {
/**
* Instantiate a `RequestTimeoutException` Exception.
*
* @example
* `throw new RequestTimeoutException()`
*
* @usageNotes
* The constructor arguments define the HTTP response.
* - The `message` argument defines the JSON response body.
* - The `error` argument defines the HTTP Status Code.
*
* By default, the JSON response body contains two properties:
* - `statusCode`: defaults to the Http Status Code provided in the `error` argument
* - `message`: the string `'Request Timeout'` by default; override this by supplying
* a string in the `message` parameter.
*
* To override the entire JSON response body, pass an object. Nest will serialize
* the object and return it as the JSON response body.
*
* The `error` argument is required, and should be a valid HTTP status code.
* Best practice is to use the `HttpStatus` enum imported from `nestjs/common`.
*
* @param message string or object describing the error condition.
* @param error HTTP response status code
*/
constructor(message?: string | object | any, error = 'Request Timeout') {
super(
createHttpExceptionBody(message, error, HttpStatus.REQUEST_TIMEOUT),
HttpException.createBody(message, error, HttpStatus.REQUEST_TIMEOUT),
HttpStatus.REQUEST_TIMEOUT,
);
}

View File

@@ -1,11 +1,42 @@
import { HttpException } from './http.exception';
import { HttpStatus } from '../enums/http-status.enum';
import { createHttpExceptionBody } from '../utils/http-exception-body.util';
/**
* Defines an HTTP exception for *Service Unavailable* type errors.
*
* @see [Base Exceptions](https://docs.nestjs.com/exception-filters#base-exceptions)
*
* @publicApi
*/
export class ServiceUnavailableException extends HttpException {
/**
* Instnatiate a `ServiceUnavailableException` Exception.
*
* @example
* `throw new ServiceUnavailableException()`
*
* @usageNotes
* The constructor arguments define the HTTP response.
* - The `message` argument defines the JSON response body.
* - The `error` argument defines the HTTP Status Code.
*
* By default, the JSON response body contains two properties:
* - `statusCode`: defaults to the Http Status Code provided in the `error` argument
* - `message`: the string `'Service Unavailable'` by default; override this by supplying
* a string in the `message` parameter.
*
* To override the entire JSON response body, pass an object. Nest will serialize
* the object and return it as the JSON response body.
*
* The `error` argument is required, and should be a valid HTTP status code.
* Best practice is to use the `HttpStatus` enum imported from `nestjs/common`.
*
* @param message string or object describing the error condition.
* @param error HTTP response status code
*/
constructor(message?: string | object | any, error = 'Service Unavailable') {
super(
createHttpExceptionBody(message, error, HttpStatus.SERVICE_UNAVAILABLE),
HttpException.createBody(message, error, HttpStatus.SERVICE_UNAVAILABLE),
HttpStatus.SERVICE_UNAVAILABLE,
);
}

View File

@@ -1,11 +1,42 @@
import { HttpException } from './http.exception';
import { HttpStatus } from '../enums/http-status.enum';
import { createHttpExceptionBody } from '../utils/http-exception-body.util';
/**
* Defines an HTTP exception for *Unauthorized* type errors.
*
* @see [Base Exceptions](https://docs.nestjs.com/exception-filters#base-exceptions)
*
* @publicApi
*/
export class UnauthorizedException extends HttpException {
/**
* Instantiate an `UnauthorizedException` Exception.
*
* @example
* `throw new UnauthorizedException()`
*
* @usageNotes
* The constructor arguments define the HTTP response.
* - The `message` argument defines the JSON response body.
* - The `error` argument defines the HTTP Status Code.
*
* By default, the JSON response body contains two properties:
* - `statusCode`: defaults to the Http Status Code provided in the `error` argument
* - `message`: the string `'Unauthorized'` by default; override this by supplying
* a string in the `message` parameter.
*
* To override the entire JSON response body, pass an object. Nest will serialize
* the object and return it as the JSON response body.
*
* The `error` argument is required, and should be a valid HTTP status code.
* Best practice is to use the `HttpStatus` enum imported from `nestjs/common`.
*
* @param message string or object describing the error condition.
* @param error HTTP response status code
*/
constructor(message?: string | object | any, error = 'Unauthorized') {
super(
createHttpExceptionBody(message, error, HttpStatus.UNAUTHORIZED),
HttpException.createBody(message, error, HttpStatus.UNAUTHORIZED),
HttpStatus.UNAUTHORIZED,
);
}

View File

@@ -1,11 +1,42 @@
import { HttpException } from './http.exception';
import { HttpStatus } from '../enums/http-status.enum';
import { createHttpExceptionBody } from '../utils/http-exception-body.util';
/**
* Defines an HTTP exception for *Unprocessable Entity* type errors.
*
* @see [Base Exceptions](https://docs.nestjs.com/exception-filters#base-exceptions)
*
* @publicApi
*/
export class UnprocessableEntityException extends HttpException {
/**
* Instantiate an `UnprocessableEntityException` Exception.
*
* @example
* `throw new UnprocessableEntityException()`
*
* @usageNotes
* The constructor arguments define the HTTP response.
* - The `message` argument defines the JSON response body.
* - The `error` argument defines the HTTP Status Code.
*
* By default, the JSON response body contains two properties:
* - `statusCode`: defaults to the Http Status Code provided in the `error` argument
* - `message`: the string `'Unprocessable Entity'` by default; override this by supplying
* a string in the `message` parameter.
*
* To override the entire JSON response body, pass an object. Nest will serialize
* the object and return it as the JSON response body.
*
* The `error` argument is required, and should be a valid HTTP status code.
* Best practice is to use the `HttpStatus` enum imported from `nestjs/common`.
*
* @param message string or object describing the error condition.
* @param error HTTP response status code
*/
constructor(message?: string | object | any, error = 'Unprocessable Entity') {
super(
createHttpExceptionBody(message, error, HttpStatus.UNPROCESSABLE_ENTITY),
HttpException.createBody(message, error, HttpStatus.UNPROCESSABLE_ENTITY),
HttpStatus.UNPROCESSABLE_ENTITY,
);
}

View File

@@ -1,14 +1,45 @@
import { HttpException } from './http.exception';
import { HttpStatus } from '../enums/http-status.enum';
import { createHttpExceptionBody } from '../utils/http-exception-body.util';
/**
* Defines an HTTP exception for *Unsupported Media Type* type errors.
*
* @see [Base Exceptions](https://docs.nestjs.com/exception-filters#base-exceptions)
*
* @publicApi
*/
export class UnsupportedMediaTypeException extends HttpException {
/**
* Instantiate an `UnsupportedMediaTypeException` Exception.
*
* @example
* `throw new UnsupportedMediaTypeException()`
*
* @usageNotes
* The constructor arguments define the HTTP response.
* - The `message` argument defines the JSON response body.
* - The `error` argument defines the HTTP Status Code.
*
* By default, the JSON response body contains two properties:
* - `statusCode`: defaults to the Http Status Code provided in the `error` argument
* - `message`: the string `'Unsupported Media Type'` by default; override this by supplying
* a string in the `message` parameter.
*
* To override the entire JSON response body, pass an object. Nest will serialize
* the object and return it as the JSON response body.
*
* The `error` argument is required, and should be a valid HTTP status code.
* Best practice is to use the `HttpStatus` enum imported from `nestjs/common`.
*
* @param message string or object describing the error condition.
* @param error HTTP response status code
*/
constructor(
message?: string | object | any,
error = 'Unsupported Media Type',
) {
super(
createHttpExceptionBody(
HttpException.createBody(
message,
error,
HttpStatus.UNSUPPORTED_MEDIA_TYPE,

View File

@@ -15,6 +15,7 @@ export {
Abstract,
ArgumentMetadata,
ArgumentsHost,
BeforeApplicationShutdown,
CallHandler,
CanActivate,
DynamicModule,
@@ -43,6 +44,7 @@ export {
WebSocketAdapter,
WsExceptionFilter,
WsMessageHandler,
ScopeOptions,
} from './interfaces';
export * from './pipes';
export * from './serializer';

View File

@@ -0,0 +1,3 @@
export interface BeforeApplicationShutdown {
beforeApplicationShutdown(signal?: string): any;
}

View File

@@ -1,5 +1,19 @@
import { ArgumentsHost } from '../features/arguments-host.interface';
/**
* Interface describing implementation of an exception filter.
*
* @see [Exception Filters](https://docs.nestjs.com/exception-filters)
*
* @publicApi
*/
export interface ExceptionFilter<T = any> {
/**
* Method to implement a custom exception filter.
*
* @param exception the class of the exception being handled
* @param host used to access an array of arguments for
* the in-flight request
*/
catch(exception: T, host: ArgumentsHost): any;
}

View File

@@ -1,6 +1,20 @@
import { Observable } from 'rxjs';
import { ArgumentsHost } from '../features/arguments-host.interface';
/**
* Interface describing implementation of an RPC exception filter.
*
* @see [Exception Filters](https://docs.nestjs.com/microservices/exception-filters)
*
* @publicApi
*/
export interface RpcExceptionFilter<T = any, R = any> {
/**
* Method to implement a custom (microservice) exception filter.
*
* @param exception the type (class) of the exception being handled
* @param host used to access an array of arguments for
* the in-flight message
*/
catch(exception: T, host: ArgumentsHost): Observable<R>;
}

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