mirror of
https://github.com/nestjs/nest.git
synced 2026-02-22 07:21:39 +00:00
Compare commits
485 Commits
elsangedy-
...
v7.4.4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9c468e3eb4 | ||
|
|
ba61c790e6 | ||
|
|
ce606e768d | ||
|
|
4d1c1279ae | ||
|
|
1f8a953f31 | ||
|
|
2d9d912c61 | ||
|
|
0eacce32ea | ||
|
|
97efd2b9f7 | ||
|
|
7eee395044 | ||
|
|
23008d5b5c | ||
|
|
eab0cccd4b | ||
|
|
9a2f1e9492 | ||
|
|
9bc184cd23 | ||
|
|
4257f04550 | ||
|
|
76bf2030d3 | ||
|
|
e70196b8c2 | ||
|
|
b0094dfb69 | ||
|
|
9fbd535e90 | ||
|
|
5a6de920a2 | ||
|
|
11890547bb | ||
|
|
ac413cd045 | ||
|
|
869446a65e | ||
|
|
917b09ba52 | ||
|
|
9c86cb4086 | ||
|
|
351e810d69 | ||
|
|
509c380962 | ||
|
|
6a51e73746 | ||
|
|
163b410144 | ||
|
|
a555fdab0c | ||
|
|
65a7c3c29c | ||
|
|
48926107d4 | ||
|
|
7ee2b34ae8 | ||
|
|
17a9ba9486 | ||
|
|
cd33e4bcba | ||
|
|
725f5c0b9b | ||
|
|
8b7472ac6d | ||
|
|
11e0f33052 | ||
|
|
24463c9daa | ||
|
|
f30061c03c | ||
|
|
69e05d288f | ||
|
|
2bd3382a72 | ||
|
|
84a1ed1e7a | ||
|
|
24aaf88052 | ||
|
|
c03390094c | ||
|
|
4cdddfcad4 | ||
|
|
b003c3fc6a | ||
|
|
b0e7f26698 | ||
|
|
5c4a84a294 | ||
|
|
5e933bd00d | ||
|
|
87be70393c | ||
|
|
2b84ed43c6 | ||
|
|
4bb4831166 | ||
|
|
6769e66c20 | ||
|
|
258c90af5b | ||
|
|
e3983ccc12 | ||
|
|
dc60e13f00 | ||
|
|
4344e3a7f6 | ||
|
|
8bb1d94f65 | ||
|
|
bf2446759e | ||
|
|
6fafaf7241 | ||
|
|
5d340d743e | ||
|
|
b5d4b2b7c2 | ||
|
|
973788db8a | ||
|
|
d3e2c6f487 | ||
|
|
8cb59a6a49 | ||
|
|
e8226fa13a | ||
|
|
7d1fd33563 | ||
|
|
0690dd8bf0 | ||
|
|
5220531702 | ||
|
|
89a3cbafa0 | ||
|
|
a0591f9eab | ||
|
|
3f05bf472d | ||
|
|
0669f371ae | ||
|
|
b2f2852fdf | ||
|
|
d468e05d40 | ||
|
|
1296dffeb9 | ||
|
|
6e2638291e | ||
|
|
b9f7234ed7 | ||
|
|
b2d1d46446 | ||
|
|
7dc62436dc | ||
|
|
2434dc299b | ||
|
|
0732ecca0b | ||
|
|
ed8cd61cca | ||
|
|
cf042c08ad | ||
|
|
84c934361d | ||
|
|
b7b1075c25 | ||
|
|
18af5289e0 | ||
|
|
f1b6c864a1 | ||
|
|
f680471a48 | ||
|
|
97d9ccb0d5 | ||
|
|
29fb923608 | ||
|
|
dfb8eeeaf1 | ||
|
|
d11fdc4ad7 | ||
|
|
87679c3394 | ||
|
|
621984b555 | ||
|
|
22969a7089 | ||
|
|
c827e1ee17 | ||
|
|
563aa9b290 | ||
|
|
b9d7a6e98a | ||
|
|
9bafe7ee3e | ||
|
|
e587f53503 | ||
|
|
a1dc03f067 | ||
|
|
a361df48c4 | ||
|
|
8ea697bdc1 | ||
|
|
b0f817c1a5 | ||
|
|
5aeebd3218 | ||
|
|
1979db4e32 | ||
|
|
a9e7ad8812 | ||
|
|
dac26b5003 | ||
|
|
317273e5c5 | ||
|
|
27314f2efc | ||
|
|
4486abe26b | ||
|
|
540d8bb40f | ||
|
|
8d4429949c | ||
|
|
7c16462059 | ||
|
|
f509871249 | ||
|
|
e5e23e19e6 | ||
|
|
8962c5931c | ||
|
|
1433910a85 | ||
|
|
46c71fda41 | ||
|
|
f4487c5fd1 | ||
|
|
d199c9c895 | ||
|
|
06cd72a847 | ||
|
|
3333469cdb | ||
|
|
a0b5e243ae | ||
|
|
da321fcb51 | ||
|
|
cea43d323a | ||
|
|
a830d47e77 | ||
|
|
e0aa10012e | ||
|
|
8551406dd0 | ||
|
|
06e1b433e8 | ||
|
|
d553fb1a82 | ||
|
|
bbcb7ae6cd | ||
|
|
18039adc5a | ||
|
|
b4dd52be45 | ||
|
|
53db786a3b | ||
|
|
3d10c328c5 | ||
|
|
546fca4eda | ||
|
|
ca589d6ad1 | ||
|
|
f74b55e629 | ||
|
|
0edff9bab7 | ||
|
|
8025ddbeb8 | ||
|
|
f0ca20aaba | ||
|
|
631e0da3a6 | ||
|
|
6e0581d31d | ||
|
|
be562b90a0 | ||
|
|
dda30809dd | ||
|
|
d4790bea22 | ||
|
|
c044b388f3 | ||
|
|
4b2d0b8cc7 | ||
|
|
b27287fda7 | ||
|
|
2d8e56f646 | ||
|
|
57cf2ac7bf | ||
|
|
34cdf675d7 | ||
|
|
84a6af1542 | ||
|
|
3edc0efa97 | ||
|
|
40061ea60a | ||
|
|
e52e48da18 | ||
|
|
60bcd23d67 | ||
|
|
0d834c6f1d | ||
|
|
1d1ab44545 | ||
|
|
f8a01d6a28 | ||
|
|
9fb0204f75 | ||
|
|
6e4ebd8b68 | ||
|
|
c82b871689 | ||
|
|
00f74fc9d4 | ||
|
|
6c884011a0 | ||
|
|
28a56a6987 | ||
|
|
b7a618dae9 | ||
|
|
ab2c8f5271 | ||
|
|
f2b7d2ba62 | ||
|
|
8b2401cc4b | ||
|
|
4464d62e8b | ||
|
|
1ae1f8a5ed | ||
|
|
e1c9409207 | ||
|
|
4b8f6770be | ||
|
|
cd2a162bfb | ||
|
|
39702b4dde | ||
|
|
9a9a555571 | ||
|
|
cdee982963 | ||
|
|
145d1fefaf | ||
|
|
86e147c857 | ||
|
|
7316280d12 | ||
|
|
2bfeba4ed9 | ||
|
|
8931d58064 | ||
|
|
ac751c630d | ||
|
|
db0b2026f2 | ||
|
|
eb0025da5d | ||
|
|
087e2cbfa5 | ||
|
|
eea77b720a | ||
|
|
1ade11ede4 | ||
|
|
b93812978c | ||
|
|
306adfb751 | ||
|
|
0241aa0a68 | ||
|
|
9bbe4f11a1 | ||
|
|
7ecc6c7807 | ||
|
|
5dd7abb9fc | ||
|
|
ffb36a9309 | ||
|
|
44bbff494c | ||
|
|
04d76ff4b2 | ||
|
|
ea70f0348c | ||
|
|
3f52b32a75 | ||
|
|
54434e75c5 | ||
|
|
26f1ffa265 | ||
|
|
08d29be41d | ||
|
|
5cbe2404dc | ||
|
|
c4f94df2e7 | ||
|
|
b10b60a9b3 | ||
|
|
b9007dd93f | ||
|
|
9d5bc076ff | ||
|
|
50c709c4d5 | ||
|
|
2166af0eeb | ||
|
|
c91317e91c | ||
|
|
5ec7246c18 | ||
|
|
6df9595b35 | ||
|
|
7b5e05e082 | ||
|
|
c09028c60d | ||
|
|
b013847b42 | ||
|
|
fc37771375 | ||
|
|
a749e0c53e | ||
|
|
2625b8829d | ||
|
|
6eda39b8f4 | ||
|
|
4c816a7efd | ||
|
|
9ac0cf1457 | ||
|
|
645075750e | ||
|
|
f0e7597635 | ||
|
|
77e2f395e7 | ||
|
|
7a749add7c | ||
|
|
c420898cfa | ||
|
|
0006d31ffe | ||
|
|
752033edac | ||
|
|
63d0693360 | ||
|
|
443da3993b | ||
|
|
1e3b5f5f51 | ||
|
|
74f89a737f | ||
|
|
33912c8613 | ||
|
|
f6982aa2a3 | ||
|
|
c56b1ae778 | ||
|
|
c516135c9a | ||
|
|
aa93a69158 | ||
|
|
0a3a36377b | ||
|
|
1901a623ac | ||
|
|
046ff4ccb4 | ||
|
|
a794f27dd1 | ||
|
|
1796109481 | ||
|
|
936aae57e0 | ||
|
|
e4c7628e6b | ||
|
|
3c235176ed | ||
|
|
288b01a774 | ||
|
|
0fc2270092 | ||
|
|
61ab2053de | ||
|
|
9023429dce | ||
|
|
402b916d84 | ||
|
|
cbd3971c7d | ||
|
|
1b43bac548 | ||
|
|
5f2027dc1e | ||
|
|
a93d7d5d18 | ||
|
|
c23afcd643 | ||
|
|
91d5c6ec53 | ||
|
|
646fd79d67 | ||
|
|
c120503e46 | ||
|
|
ff86d1bd22 | ||
|
|
89d8592388 | ||
|
|
e277b3bc3a | ||
|
|
535755c925 | ||
|
|
fdd3da241a | ||
|
|
c3d2add2de | ||
|
|
85b0dc8495 | ||
|
|
f21ebbc346 | ||
|
|
b39cf9f210 | ||
|
|
be50e6d834 | ||
|
|
c2fec010dc | ||
|
|
a792e88989 | ||
|
|
9cc3b149f4 | ||
|
|
6f49c76f04 | ||
|
|
0f7f413931 | ||
|
|
c5b4e78a34 | ||
|
|
75545d132e | ||
|
|
e79941fae2 | ||
|
|
50a7d35f4c | ||
|
|
b9242f7283 | ||
|
|
4307da2f92 | ||
|
|
833f0f5532 | ||
|
|
c970b50291 | ||
|
|
9f80222fdc | ||
|
|
cbf2c3cf42 | ||
|
|
6cf9db941b | ||
|
|
5a8b7bc3a0 | ||
|
|
ee01e60a95 | ||
|
|
79ea8d2a79 | ||
|
|
9b54ccb229 | ||
|
|
ebe8255379 | ||
|
|
46db75dd79 | ||
|
|
070df5a52b | ||
|
|
445b296b76 | ||
|
|
408aa39c2e | ||
|
|
3a2ee4296a | ||
|
|
42a84cda48 | ||
|
|
6e84e2f425 | ||
|
|
58ca5771a1 | ||
|
|
4da3b5812a | ||
|
|
44c8555402 | ||
|
|
7e9fcc231d | ||
|
|
0fb9778dad | ||
|
|
c1467c5c16 | ||
|
|
77d9a9b9c4 | ||
|
|
0b91ce9da8 | ||
|
|
2af96b578e | ||
|
|
7fa5082fa6 | ||
|
|
75216f4794 | ||
|
|
614ed4ff2f | ||
|
|
71cc3c0f8f | ||
|
|
92eef778e6 | ||
|
|
8c59111764 | ||
|
|
668e7bc80f | ||
|
|
a839a07713 | ||
|
|
82021d876b | ||
|
|
02baf5eac9 | ||
|
|
42683d5008 | ||
|
|
7fbe1f2c3f | ||
|
|
d355bc8464 | ||
|
|
f11455d9c9 | ||
|
|
d233c2fb35 | ||
|
|
ac2827b090 | ||
|
|
f81d65af58 | ||
|
|
285b14e127 | ||
|
|
cc85f59869 | ||
|
|
3bc77d2c50 | ||
|
|
e158fbed4b | ||
|
|
0d2870aeb6 | ||
|
|
54863260c8 | ||
|
|
80b11f1cd8 | ||
|
|
e3adee8249 | ||
|
|
be20f8f1bc | ||
|
|
39e0024a96 | ||
|
|
a3cdf2ad05 | ||
|
|
52acdc5ae3 | ||
|
|
d071c99a9c | ||
|
|
b85844c316 | ||
|
|
daeb99f858 | ||
|
|
3dca681a08 | ||
|
|
442e2f66a1 | ||
|
|
659c52f8bc | ||
|
|
835e4ed94d | ||
|
|
5642ca7f5f | ||
|
|
d9cfdd0846 | ||
|
|
83251e3a45 | ||
|
|
eef373c93f | ||
|
|
83b3b6d9d5 | ||
|
|
0ac56fd62a | ||
|
|
8b97f94c38 | ||
|
|
b5a7a6cda4 | ||
|
|
2ce40138b9 | ||
|
|
53070f07f3 | ||
|
|
60c92fe5a8 | ||
|
|
c51984e440 | ||
|
|
05cc5b83f8 | ||
|
|
28fcfe6647 | ||
|
|
2fc29847f3 | ||
|
|
1c846e46f9 | ||
|
|
42fedbb81b | ||
|
|
7f2c35174d | ||
|
|
1931283e75 | ||
|
|
dcabde2fb5 | ||
|
|
b4f3cdc73b | ||
|
|
32ed43b390 | ||
|
|
9d781cde22 | ||
|
|
aed62cc7bd | ||
|
|
a4252b4285 | ||
|
|
171cc9d392 | ||
|
|
64b7237c23 | ||
|
|
c97e495c11 | ||
|
|
1534cf5d0a | ||
|
|
8436c27a65 | ||
|
|
ab0b29b627 | ||
|
|
6d034f5c1f | ||
|
|
1ddab1b2bb | ||
|
|
364a963426 | ||
|
|
72ff7ae40e | ||
|
|
184fffe043 | ||
|
|
d92e85f297 | ||
|
|
acce5e953d | ||
|
|
dfd7846779 | ||
|
|
d895c367fe | ||
|
|
b9cf26708e | ||
|
|
18979b3b46 | ||
|
|
877cc3e4d6 | ||
|
|
feeed43c56 | ||
|
|
a10bb787b8 | ||
|
|
ca7e348478 | ||
|
|
67e15afbf3 | ||
|
|
d59c7b87bd | ||
|
|
cf5e5bceca | ||
|
|
b5e8197500 | ||
|
|
17969748e9 | ||
|
|
8836251c88 | ||
|
|
d74e173e59 | ||
|
|
9511984f2c | ||
|
|
eb7decd35c | ||
|
|
cd6555edd3 | ||
|
|
5b15dbfbaa | ||
|
|
8dcced7256 | ||
|
|
cf10752f40 | ||
|
|
1789753248 | ||
|
|
fb62ffe48c | ||
|
|
f38223ade4 | ||
|
|
f95b219a3c | ||
|
|
b4adc2c771 | ||
|
|
d56267fb99 | ||
|
|
2971ba6a3c | ||
|
|
f7e4885c2d | ||
|
|
cce0bc6407 | ||
|
|
ed4becbe99 | ||
|
|
3cac1ca2b2 | ||
|
|
9059c3d5ac | ||
|
|
3433ab06f4 | ||
|
|
55bd8ab1c7 | ||
|
|
2e5eb4b8e9 | ||
|
|
59ad650c8f | ||
|
|
764d26b28e | ||
|
|
2f29d7790b | ||
|
|
6a53d1e131 | ||
|
|
d37f68d05e | ||
|
|
72c16ccd9a | ||
|
|
3f9be96815 | ||
|
|
7bcf90cb8c | ||
|
|
f4f85f254c | ||
|
|
fc625f2957 | ||
|
|
61b6c7df25 | ||
|
|
79caf671ea | ||
|
|
e24f23d030 | ||
|
|
d184f906ff | ||
|
|
7efc27c186 | ||
|
|
27de22fdfb | ||
|
|
2342c65efc | ||
|
|
7d03b2d78d | ||
|
|
c0e6139419 | ||
|
|
f574663414 | ||
|
|
7f3a9955be | ||
|
|
cc828d493a | ||
|
|
dda9d52c4c | ||
|
|
1194fbae9f | ||
|
|
b3542806d8 | ||
|
|
3991fb9525 | ||
|
|
91cf3190b3 | ||
|
|
1ddeaa2aad | ||
|
|
2bdcdb5814 | ||
|
|
bb4ed69b0e | ||
|
|
b69f3be0aa | ||
|
|
96136f72e7 | ||
|
|
724403067b | ||
|
|
12b807f149 | ||
|
|
07237a07c7 | ||
|
|
0e7197c828 | ||
|
|
7c64c77031 | ||
|
|
6e2033ba7e | ||
|
|
ba2bdea524 | ||
|
|
12b9940b65 | ||
|
|
8a02e39001 | ||
|
|
b82f6f6b5b | ||
|
|
6a754515a1 | ||
|
|
517cad59e9 | ||
|
|
2714f57fcf | ||
|
|
e91d1b1ced | ||
|
|
6e49223e4c | ||
|
|
0b33f8fe31 | ||
|
|
b315162269 | ||
|
|
cd21b2ff93 | ||
|
|
4a1eed1e44 | ||
|
|
09a3ad2950 | ||
|
|
5e9d5c57ed | ||
|
|
d7c69707f6 | ||
|
|
f6114abea9 | ||
|
|
33d6c393e0 | ||
|
|
97edbe0c2a | ||
|
|
2e9fcb1a42 | ||
|
|
2581903818 | ||
|
|
ab4295ed02 | ||
|
|
f05786d8c1 | ||
|
|
772e589327 | ||
|
|
82d0171bcf | ||
|
|
7d209e3d8f | ||
|
|
a718809f30 | ||
|
|
25ba42cca2 | ||
|
|
d03830e998 |
@@ -70,10 +70,10 @@ jobs:
|
||||
docker:
|
||||
- image: circleci/node:10
|
||||
|
||||
test_node_8:
|
||||
test_node_14:
|
||||
<<: *unit-tests-template
|
||||
docker:
|
||||
- image: circleci/node:8
|
||||
- image: circleci/node:14
|
||||
|
||||
lint:
|
||||
working_directory: ~/nest
|
||||
@@ -160,15 +160,15 @@ workflows:
|
||||
build-and-test:
|
||||
jobs:
|
||||
- build
|
||||
- test_node_14:
|
||||
requires:
|
||||
- build
|
||||
- test_node_12:
|
||||
requires:
|
||||
- build
|
||||
- test_node_10:
|
||||
requires:
|
||||
- build
|
||||
- test_node_8:
|
||||
requires:
|
||||
- build
|
||||
- lint:
|
||||
requires:
|
||||
- build
|
||||
|
||||
54
.github/workflows/codeql-analysis.yml
vendored
Normal file
54
.github/workflows/codeql-analysis.yml
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
name: "CodeQL"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [master, ]
|
||||
pull_request:
|
||||
# The branches below must be a subset of the branches above
|
||||
branches: [master]
|
||||
schedule:
|
||||
- cron: '0 17 * * 4'
|
||||
|
||||
jobs:
|
||||
analyse:
|
||||
name: Analyse
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
# We must fetch at least the immediate parents so that if this is
|
||||
# a pull request then we can checkout the head.
|
||||
fetch-depth: 2
|
||||
|
||||
# If this run was triggered by a pull request event, then checkout
|
||||
# the head of the pull request instead of the merge commit.
|
||||
- run: git checkout HEAD^2
|
||||
if: ${{ github.event_name == 'pull_request' }}
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v1
|
||||
# Override language selection by uncommenting this and choosing your languages
|
||||
# with:
|
||||
# languages: go, javascript, csharp, python, cpp, java
|
||||
|
||||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||
# If this step fails, then you should remove it and run the build manually (see below)
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@v1
|
||||
|
||||
# ℹ️ Command-line programs to run using the OS shell.
|
||||
# 📚 https://git.io/JvXDl
|
||||
|
||||
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
|
||||
# and modify them (or add more) to build your code if your project
|
||||
# uses a compiled language
|
||||
|
||||
#- run: |
|
||||
# make bootstrap
|
||||
# make release
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v1
|
||||
14
Readme.md
14
Readme.md
@@ -54,9 +54,11 @@ With official support, you can get expert help straight from Nest core team. We
|
||||
|
||||
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support).
|
||||
|
||||
#### Principal Sponsor
|
||||
|
||||
<a href="https://valor-software.com/" target="_blank"><img src="https://docs.nestjs.com/assets/sponsors/valor-software.png" width="220" /></a>
|
||||
#### Principal Sponsors
|
||||
<table style="text-align:center;"><tr><td>
|
||||
<a href="https://github.com/Sanofi-IADC" target="_blank"><img src="https://docs.nestjs.com/assets/sponsors/sanofi.png" width="180" valign="middle" /></a></td><td>
|
||||
<a href="https://valor-software.com/" target="_blank"><img src="https://docs.nestjs.com/assets/sponsors/valor-software.png" width="180" valign="middle" /></a></td>
|
||||
</tr></table>
|
||||
|
||||
#### Silver Sponsors
|
||||
|
||||
@@ -84,7 +86,11 @@ Nest is an MIT-licensed open source project. It can grow thanks to the sponsors
|
||||
<a href="https://www.codeguesser.co.uk" target="_blank"><img src="https://nestjs.com/img/codeguesser-logo.svg" width="120" valign="middle" /></a> </td><td align="center" valign="middle">
|
||||
<a href="https://tekhattan.com" target="_blank"><img src="https://nestjs.com/img/tekhattan-logo.png" width="110" valign="middle" /></a> </td><td align="center" valign="middle">
|
||||
<a href="https://f-a.nz/" target="_blank"><img src="https://nestjs.com/img/franz.svg" width="80" valign="middle" /></a> </td><td align="center" valign="middle">
|
||||
<a href="https://sparkfabrik.com/" target="_blank"><img src="https://nestjs.com/img/sparkfabrik-logo.png" width="120" valign="middle" /></a></td><td align="center" valign="middle"><a href="https://www.thebigphonestore.co.uk/" target="_blank"><img src="https://nestjs.com/img/the-big-phone-store-logo.png" width="65" valign="middle" /></a></td></tr></table>
|
||||
<a href="https://sparkfabrik.com/" target="_blank"><img src="https://nestjs.com/img/sparkfabrik-logo.png" width="120" valign="middle" /></a></td><td align="center" valign="middle"><a href="https://www.thebigphonestore.co.uk/" target="_blank"><img src="https://nestjs.com/img/the-big-phone-store-logo.png" width="65" valign="middle" /></a></td>
|
||||
<td align="center" valign="middle">
|
||||
<a href="https://genuinebee.com/" target="_blank"><img src="https://nestjs.com/img/genuinebee.svg" width="97" valign="middle" /></a> </td></tr>
|
||||
<tr><td align="center" valign="middle"><a href="https://sanyodigital.com/" target="_blank"><img src="https://nestjs.com/img/sanyo-digital.png" width="130" valign="middle" /></a></td><td align="center" valign="middle"><a href="https://vpn-review.com/vpn-for-torrenting" target="_blank"><img src="https://nestjs.com/img/vpn-review-logo.png" width="85" valign="middle" /></a></td>
|
||||
</tr></table>
|
||||
|
||||
## Backers
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ services:
|
||||
- "9001:9001"
|
||||
restart: always
|
||||
mysql:
|
||||
image: mysql:5.7.30
|
||||
image: mysql:5.7.31
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: root
|
||||
MYSQL_DATABASE: test
|
||||
@@ -57,7 +57,7 @@ services:
|
||||
kafka:
|
||||
container_name: test-kafka
|
||||
hostname: kafka
|
||||
image: confluentinc/cp-kafka:5.3.2
|
||||
image: confluentinc/cp-kafka:5.5.1
|
||||
depends_on:
|
||||
- zookeeper
|
||||
ports:
|
||||
|
||||
@@ -3,7 +3,6 @@ import {
|
||||
NestFastifyApplication,
|
||||
} from '@nestjs/platform-fastify';
|
||||
import { Test } from '@nestjs/testing';
|
||||
import { fail } from 'assert';
|
||||
import { expect } from 'chai';
|
||||
import { ApplicationModule } from '../src/app.module';
|
||||
|
||||
@@ -54,19 +53,14 @@ describe('Hello world (fastify adapter)', () => {
|
||||
method: 'GET',
|
||||
url: '/host',
|
||||
})
|
||||
.then(
|
||||
({ payload }) => {
|
||||
fail(`Unexpected success: ${payload}`);
|
||||
},
|
||||
err => {
|
||||
expect(err.getResponse()).to.be.eql({
|
||||
error: 'Internal Server Error',
|
||||
message:
|
||||
'HTTP adapter does not support filtering on host: ":tenant.example.com"',
|
||||
statusCode: 500,
|
||||
});
|
||||
},
|
||||
);
|
||||
.then(({ payload }) => {
|
||||
expect(JSON.parse(payload)).to.be.eql({
|
||||
error: 'Internal Server Error',
|
||||
message:
|
||||
'HTTP adapter does not support filtering on host: ":tenant.example.com"',
|
||||
statusCode: 500,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
|
||||
34
integration/injector/e2e/introspection.spec.ts
Normal file
34
integration/injector/e2e/introspection.spec.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
import { Scope } from '@nestjs/common';
|
||||
import { ModuleRef } from '@nestjs/core';
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { expect } from 'chai';
|
||||
import { ScopedModule, STATIC_FACTORY } from '../src/scoped/scoped.module';
|
||||
import { ScopedService } from '../src/scoped/scoped.service';
|
||||
import { TransientService } from '../src/scoped/transient.service';
|
||||
|
||||
describe('Providers introspection', () => {
|
||||
let testingModule: TestingModule;
|
||||
let moduleRef: ModuleRef;
|
||||
|
||||
beforeEach(async () => {
|
||||
testingModule = await Test.createTestingModule({
|
||||
imports: [ScopedModule],
|
||||
}).compile();
|
||||
moduleRef = testingModule.get(ModuleRef);
|
||||
});
|
||||
|
||||
it('should properly introspect a transient provider', async () => {
|
||||
const introspectionResult = moduleRef.introspect(TransientService);
|
||||
expect(introspectionResult.scope).to.be.equal(Scope.TRANSIENT);
|
||||
});
|
||||
|
||||
it('should properly introspect a singleton provider', async () => {
|
||||
const introspectionResult = moduleRef.introspect(STATIC_FACTORY);
|
||||
expect(introspectionResult.scope).to.be.equal(Scope.DEFAULT);
|
||||
});
|
||||
|
||||
it('should properly introspect a request-scoped provider', async () => {
|
||||
const introspectionResult = moduleRef.introspect(ScopedService);
|
||||
expect(introspectionResult.scope).to.be.equal(Scope.REQUEST);
|
||||
});
|
||||
});
|
||||
@@ -54,13 +54,19 @@ describe('Scoped Instances', () => {
|
||||
it('should dynamically resolve request-scoped provider', async () => {
|
||||
const request1 = await testingModule.resolve(ScopedService);
|
||||
const request2 = await testingModule.resolve(ScopedService);
|
||||
const request3 = await testingModule.resolve(ScopedService, { id: 1 });
|
||||
|
||||
const ctxId = { id: 1 };
|
||||
const requestProvider = { host: 'localhost' };
|
||||
testingModule.registerRequestByContextId(requestProvider, ctxId);
|
||||
|
||||
const request3 = await testingModule.resolve(ScopedService, ctxId);
|
||||
const requestFactory = await testingModule.resolve(REQUEST_SCOPED_FACTORY);
|
||||
|
||||
expect(request1).to.be.instanceOf(ScopedService);
|
||||
expect(request2).to.be.instanceOf(ScopedService);
|
||||
expect(request3).to.not.be.equal(request2);
|
||||
expect(requestFactory).to.be.true;
|
||||
expect(request3.request).to.be.equal(requestProvider);
|
||||
});
|
||||
|
||||
it('should dynamically resolve request-scoped controller', async () => {
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
import { Injectable, Scope } from '@nestjs/common';
|
||||
import { Inject, Injectable, Scope } from '@nestjs/common';
|
||||
import { REQUEST } from '@nestjs/core';
|
||||
|
||||
@Injectable({ scope: Scope.REQUEST })
|
||||
export class ScopedService {}
|
||||
export class ScopedService {
|
||||
constructor(@Inject(REQUEST) public readonly request) {}
|
||||
}
|
||||
|
||||
@@ -50,6 +50,20 @@ describe('RPC transport', () => {
|
||||
.expect(200, '15');
|
||||
});
|
||||
|
||||
it(`/POST (useFactory client)`, () => {
|
||||
return request(server)
|
||||
.post('/useFactory?command=sum')
|
||||
.send([1, 2, 3, 4, 5])
|
||||
.expect(200, '15');
|
||||
});
|
||||
|
||||
it(`/POST (useClass client)`, () => {
|
||||
return request(server)
|
||||
.post('/useClass?command=sum')
|
||||
.send([1, 2, 3, 4, 5])
|
||||
.expect(200, '15');
|
||||
});
|
||||
|
||||
it(`/POST (concurrent)`, () => {
|
||||
return request(server)
|
||||
.post('/concurrent')
|
||||
|
||||
@@ -1,4 +1,11 @@
|
||||
import { Body, Controller, HttpCode, Post, Query } from '@nestjs/common';
|
||||
import {
|
||||
Body,
|
||||
Controller,
|
||||
HttpCode,
|
||||
Inject,
|
||||
Post,
|
||||
Query,
|
||||
} from '@nestjs/common';
|
||||
import {
|
||||
Client,
|
||||
ClientProxy,
|
||||
@@ -11,6 +18,10 @@ import { scan } from 'rxjs/operators';
|
||||
|
||||
@Controller()
|
||||
export class AppController {
|
||||
constructor(
|
||||
@Inject('USE_CLASS_CLIENT') private useClassClient: ClientProxy,
|
||||
@Inject('USE_FACTORY_CLIENT') private useFactoryClient: ClientProxy,
|
||||
) {}
|
||||
static IS_NOTIFIED = false;
|
||||
|
||||
@Client({ transport: Transport.TCP })
|
||||
@@ -22,6 +33,24 @@ export class AppController {
|
||||
return this.client.send<number>({ cmd }, data);
|
||||
}
|
||||
|
||||
@Post('useFactory')
|
||||
@HttpCode(200)
|
||||
callWithClientUseFactory(
|
||||
@Query('command') cmd,
|
||||
@Body() data: number[],
|
||||
): Observable<number> {
|
||||
return this.useFactoryClient.send<number>({ cmd }, data);
|
||||
}
|
||||
|
||||
@Post('useClass')
|
||||
@HttpCode(200)
|
||||
callWithClientUseClass(
|
||||
@Query('command') cmd,
|
||||
@Body() data: number[],
|
||||
): Observable<number> {
|
||||
return this.useClassClient.send<number>({ cmd }, data);
|
||||
}
|
||||
|
||||
@Post('stream')
|
||||
@HttpCode(200)
|
||||
stream(@Body() data: number[]): Observable<number> {
|
||||
|
||||
@@ -1,7 +1,59 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import { Module, Injectable } from '@nestjs/common';
|
||||
import { AppController } from './app.controller';
|
||||
import {
|
||||
ClientsModule,
|
||||
Transport,
|
||||
ClientsModuleOptionsFactory,
|
||||
ClientOptions,
|
||||
} from '@nestjs/microservices';
|
||||
|
||||
@Injectable()
|
||||
class ConfigService {
|
||||
private readonly config = {
|
||||
transport: Transport.TCP,
|
||||
};
|
||||
get(key: string) {
|
||||
return this.config[key];
|
||||
}
|
||||
}
|
||||
|
||||
@Module({
|
||||
providers: [ConfigService],
|
||||
exports: [ConfigService],
|
||||
})
|
||||
class ConfigModule {}
|
||||
|
||||
@Injectable()
|
||||
class ClientOptionService implements ClientsModuleOptionsFactory {
|
||||
constructor(private readonly configService: ConfigService) {}
|
||||
createClientOptions(): Promise<ClientOptions> | ClientOptions {
|
||||
return {
|
||||
transport: this.configService.get('transport'),
|
||||
options: {},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
ClientsModule.registerAsync([
|
||||
{
|
||||
imports: [ConfigModule],
|
||||
name: 'USE_FACTORY_CLIENT',
|
||||
useFactory: (configService: ConfigService) => ({
|
||||
transport: configService.get('transport'),
|
||||
options: {},
|
||||
}),
|
||||
inject: [ConfigService],
|
||||
},
|
||||
{
|
||||
imports: [ConfigModule],
|
||||
name: 'USE_CLASS_CLIENT',
|
||||
useClass: ClientOptionService,
|
||||
inject: [ConfigService],
|
||||
},
|
||||
]),
|
||||
],
|
||||
controllers: [AppController],
|
||||
})
|
||||
export class ApplicationModule {}
|
||||
|
||||
@@ -3,5 +3,5 @@
|
||||
"packages": [
|
||||
"packages/*"
|
||||
],
|
||||
"version": "7.2.0"
|
||||
"version": "7.4.4"
|
||||
}
|
||||
|
||||
6803
package-lock.json
generated
6803
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
112
package.json
112
package.json
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nestjs/core",
|
||||
"version": "7.0.11",
|
||||
"version": "7.4.0",
|
||||
"description": "Modern, fast, powerful node.js web framework",
|
||||
"homepage": "https://nestjs.com",
|
||||
"repository": {
|
||||
@@ -52,54 +52,53 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@nuxtjs/opencollective": "0.2.2",
|
||||
"axios": "0.19.2",
|
||||
"class-transformer": "0.2.3",
|
||||
"axios": "0.20.0",
|
||||
"class-transformer": "0.3.1",
|
||||
"class-validator": "0.12.2",
|
||||
"cli-color": "2.0.0",
|
||||
"cors": "2.8.5",
|
||||
"express": "4.17.1",
|
||||
"fast-json-stringify": "2.1.0",
|
||||
"fast-json-stringify": "2.2.3",
|
||||
"fast-safe-stringify": "2.0.7",
|
||||
"iterare": "1.2.1",
|
||||
"object-hash": "2.0.3",
|
||||
"path-to-regexp": "3.2.0",
|
||||
"reflect-metadata": "0.1.13",
|
||||
"rxjs": "6.5.5",
|
||||
"rxjs": "6.6.2",
|
||||
"socket.io": "2.3.0",
|
||||
"uuid": "8.1.0",
|
||||
"tslib": "2.0.0"
|
||||
"uuid": "8.3.0",
|
||||
"tslib": "2.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@codechecks/client": "0.1.10",
|
||||
"@commitlint/cli": "8.3.5",
|
||||
"@commitlint/config-angular": "8.3.4",
|
||||
"@grpc/proto-loader": "0.5.4",
|
||||
"@nestjs/graphql": "7.4.1",
|
||||
"@nestjs/mongoose": "7.0.1",
|
||||
"@nestjs/typeorm": "7.1.0",
|
||||
"@commitlint/cli": "9.1.2",
|
||||
"@commitlint/config-angular": "9.1.2",
|
||||
"@grpc/proto-loader": "0.5.5",
|
||||
"@nestjs/graphql": "7.6.0",
|
||||
"@nestjs/mongoose": "7.0.2",
|
||||
"@nestjs/typeorm": "7.1.1",
|
||||
"@types/amqplib": "0.5.13",
|
||||
"@types/bytes": "3.1.0",
|
||||
"@types/cache-manager": "2.10.3",
|
||||
"@types/chai": "4.2.11",
|
||||
"@types/chai-as-promised": "7.1.2",
|
||||
"@types/cors": "2.8.6",
|
||||
"@types/express": "4.17.6",
|
||||
"@types/fastify-cors": "2.1.0",
|
||||
"@types/chai": "4.2.12",
|
||||
"@types/chai-as-promised": "7.1.3",
|
||||
"@types/cors": "2.8.7",
|
||||
"@types/express": "4.17.7",
|
||||
"@types/gulp": "4.0.6",
|
||||
"@types/mocha": "7.0.2",
|
||||
"@types/mongoose": "5.7.26",
|
||||
"@types/mocha": "8.0.3",
|
||||
"@types/mongoose": "5.7.36",
|
||||
"@types/node": "10.17.3",
|
||||
"@types/redis": "2.8.22",
|
||||
"@types/redis": "2.8.26",
|
||||
"@types/reflect-metadata": "0.0.5",
|
||||
"@types/sinon": "9.0.4",
|
||||
"@types/socket.io": "2.1.8",
|
||||
"@types/ws": "7.2.5",
|
||||
"@typescript-eslint/eslint-plugin": "3.3.0",
|
||||
"@typescript-eslint/parser": "3.3.0",
|
||||
"@types/sinon": "9.0.5",
|
||||
"@types/socket.io": "2.1.11",
|
||||
"@types/ws": "7.2.6",
|
||||
"@typescript-eslint/eslint-plugin": "3.10.1",
|
||||
"@typescript-eslint/parser": "3.10.1",
|
||||
"amqp-connection-manager": "3.2.0",
|
||||
"amqplib": "0.5.6",
|
||||
"apollo-server-express": "2.15.0",
|
||||
"artillery": "1.6.0",
|
||||
"amqplib": "0.6.0",
|
||||
"apollo-server-express": "2.17.0",
|
||||
"artillery": "1.6.1",
|
||||
"awesome-typescript-loader": "5.2.1",
|
||||
"body-parser": "1.19.0",
|
||||
"bytes": "3.1.0",
|
||||
@@ -108,23 +107,23 @@
|
||||
"chai-as-promised": "7.1.1",
|
||||
"clang-format": "1.4.0",
|
||||
"commitlint-circle": "1.0.0",
|
||||
"concurrently": "5.2.0",
|
||||
"conventional-changelog": "3.1.21",
|
||||
"concurrently": "5.3.0",
|
||||
"conventional-changelog": "3.1.23",
|
||||
"core-js": "3.6.5",
|
||||
"coveralls": "3.1.0",
|
||||
"delete-empty": "3.0.0",
|
||||
"engine.io-client": "3.4.3",
|
||||
"eslint": "7.2.0",
|
||||
"eslint": "7.7.0",
|
||||
"eslint-config-prettier": "6.11.0",
|
||||
"eslint-plugin-import": "2.21.2",
|
||||
"eslint-plugin-import": "2.22.0",
|
||||
"fancy-log": "1.3.3",
|
||||
"fastify": "2.14.1",
|
||||
"fastify-cors": "3.0.3",
|
||||
"fastify-formbody": "3.2.0",
|
||||
"fastify-multipart": "1.0.6",
|
||||
"fastify-static": "2.7.0",
|
||||
"graphql": "15.1.0",
|
||||
"graphql-tools": "6.0.10",
|
||||
"fastify": "3.3.0",
|
||||
"fastify-cors": "4.1.0",
|
||||
"fastify-formbody": "5.0.0",
|
||||
"fastify-multipart": "3.1.0",
|
||||
"fastify-static": "3.2.0",
|
||||
"graphql": "15.3.0",
|
||||
"graphql-tools": "6.1.0",
|
||||
"grpc": "1.24.3",
|
||||
"gulp": "4.0.2",
|
||||
"gulp-clang-format": "1.0.27",
|
||||
@@ -133,35 +132,38 @@
|
||||
"gulp-typescript": "5.0.1",
|
||||
"gulp-watch": "5.0.1",
|
||||
"husky": "4.2.5",
|
||||
"imports-loader": "1.0.0",
|
||||
"imports-loader": "1.1.0",
|
||||
"json-loader": "0.5.7",
|
||||
"kafkajs": "1.12.0",
|
||||
"lerna": "2.11.0",
|
||||
"lint-staged": "10.2.11",
|
||||
"light-my-request": "4.0.2",
|
||||
"lint-staged": "10.2.13",
|
||||
"markdown-table": "2.0.0",
|
||||
"merge-graphql-schemas": "1.7.8",
|
||||
"mocha": "7.1.2",
|
||||
"mongoose": "5.9.19",
|
||||
"mqtt": "4.1.0",
|
||||
"middie": "5.1.0",
|
||||
"mocha": "8.1.3",
|
||||
"mongoose": "5.10.2",
|
||||
"mqtt": "4.2.1",
|
||||
"multer": "1.4.2",
|
||||
"mysql": "2.18.1",
|
||||
"nats": "1.4.9",
|
||||
"nats": "1.4.12",
|
||||
"nodemon": "2.0.4",
|
||||
"nyc": "15.1.0",
|
||||
"prettier": "2.0.5",
|
||||
"point-of-view": "4.4.0",
|
||||
"prettier": "2.1.1",
|
||||
"redis": "3.0.2",
|
||||
"rxjs-compat": "6.5.5",
|
||||
"sinon": "9.0.2",
|
||||
"rxjs-compat": "6.6.2",
|
||||
"sinon": "9.0.3",
|
||||
"sinon-chai": "3.5.0",
|
||||
"socket.io-client": "2.3.0",
|
||||
"subscriptions-transport-ws": "0.9.16",
|
||||
"subscriptions-transport-ws": "0.9.18",
|
||||
"supertest": "4.0.2",
|
||||
"ts-morph": "7.1.1",
|
||||
"ts-node": "8.10.2",
|
||||
"ts-morph": "8.1.0",
|
||||
"ts-node": "9.0.0",
|
||||
"typeorm": "0.2.25",
|
||||
"typescript": "3.9.5",
|
||||
"typescript": "4.0.2",
|
||||
"wrk": "1.2.0",
|
||||
"ws": "7.3.0"
|
||||
"ws": "7.3.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 10.13.0"
|
||||
@@ -192,7 +194,7 @@
|
||||
"packages/microservices/microservices-module.ts",
|
||||
"packages/core/middleware/middleware-module.ts",
|
||||
"packages/core/injector/module-ref.ts",
|
||||
"packages/core/injector/container-scanner.ts",
|
||||
"packages/core/injector/instance-links-host.ts",
|
||||
"packages/common/cache/**/*",
|
||||
"packages/common/serializer/**/*",
|
||||
"packages/common/services/logger.service.ts"
|
||||
|
||||
@@ -54,9 +54,11 @@ With official support, you can get expert help straight from Nest core team. We
|
||||
|
||||
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support).
|
||||
|
||||
#### Principal Sponsor
|
||||
|
||||
<a href="https://valor-software.com/" target="_blank"><img src="https://docs.nestjs.com/assets/sponsors/valor-software.png" width="220" /></a>
|
||||
#### Principal Sponsors
|
||||
<table style="text-align:center;"><tr><td>
|
||||
<a href="https://github.com/Sanofi-IADC" target="_blank"><img src="https://docs.nestjs.com/assets/sponsors/sanofi.png" width="180" valign="middle" /></a></td><td>
|
||||
<a href="https://valor-software.com/" target="_blank"><img src="https://docs.nestjs.com/assets/sponsors/valor-software.png" width="180" valign="middle" /></a></td>
|
||||
</tr></table>
|
||||
|
||||
#### Silver Sponsors
|
||||
|
||||
@@ -84,7 +86,11 @@ Nest is an MIT-licensed open source project. It can grow thanks to the sponsors
|
||||
<a href="https://www.codeguesser.co.uk" target="_blank"><img src="https://nestjs.com/img/codeguesser-logo.svg" width="120" valign="middle" /></a> </td><td align="center" valign="middle">
|
||||
<a href="https://tekhattan.com" target="_blank"><img src="https://nestjs.com/img/tekhattan-logo.png" width="110" valign="middle" /></a> </td><td align="center" valign="middle">
|
||||
<a href="https://f-a.nz/" target="_blank"><img src="https://nestjs.com/img/franz.svg" width="80" valign="middle" /></a> </td><td align="center" valign="middle">
|
||||
<a href="https://sparkfabrik.com/" target="_blank"><img src="https://nestjs.com/img/sparkfabrik-logo.png" width="120" valign="middle" /></a></td><td align="center" valign="middle"><a href="https://www.thebigphonestore.co.uk/" target="_blank"><img src="https://nestjs.com/img/the-big-phone-store-logo.png" width="65" valign="middle" /></a></td></tr></table>
|
||||
<a href="https://sparkfabrik.com/" target="_blank"><img src="https://nestjs.com/img/sparkfabrik-logo.png" width="120" valign="middle" /></a></td><td align="center" valign="middle"><a href="https://www.thebigphonestore.co.uk/" target="_blank"><img src="https://nestjs.com/img/the-big-phone-store-logo.png" width="65" valign="middle" /></a></td>
|
||||
<td align="center" valign="middle">
|
||||
<a href="https://genuinebee.com/" target="_blank"><img src="https://nestjs.com/img/genuinebee.svg" width="97" valign="middle" /></a> </td></tr>
|
||||
<tr><td align="center" valign="middle"><a href="https://sanyodigital.com/" target="_blank"><img src="https://nestjs.com/img/sanyo-digital.png" width="130" valign="middle" /></a></td><td align="center" valign="middle"><a href="https://vpn-review.com/vpn-for-torrenting" target="_blank"><img src="https://nestjs.com/img/vpn-review-logo.png" width="85" valign="middle" /></a></td>
|
||||
</tr></table>
|
||||
|
||||
## Backers
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ export class CacheInterceptor implements NestInterceptor {
|
||||
}
|
||||
try {
|
||||
const value = await this.cacheManager.get(key);
|
||||
if (value) {
|
||||
if (!isNil(value)) {
|
||||
return of(value);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,9 @@ export * from './unsupported-media-type.exception';
|
||||
export * from './unprocessable-entity.exception';
|
||||
export * from './internal-server-error.exception';
|
||||
export * from './not-implemented.exception';
|
||||
export * from './http-version-not-supported.exception';
|
||||
export * from './bad-gateway.exception';
|
||||
export * from './service-unavailable.exception';
|
||||
export * from './gateway-timeout.exception';
|
||||
export * from './im-a-teapot.exception';
|
||||
export * from './precondition-failed.exception';
|
||||
|
||||
49
packages/common/exceptions/precondition-failed.exception.ts
Normal file
49
packages/common/exceptions/precondition-failed.exception.ts
Normal file
@@ -0,0 +1,49 @@
|
||||
import { HttpStatus } from '../enums/http-status.enum';
|
||||
import { HttpException } from './http.exception';
|
||||
|
||||
/**
|
||||
* Defines an HTTP exception for *Precondition Failed* type errors.
|
||||
*
|
||||
* @see [Base Exceptions](https://docs.nestjs.com/exception-filters#base-exceptions)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export class PreconditionFailedException extends HttpException {
|
||||
/**
|
||||
* Instantiate a `PreconditionFailedException` Exception.
|
||||
*
|
||||
* @example
|
||||
* `throw new PreconditionFailedException()`
|
||||
*
|
||||
* @usageNotes
|
||||
* The HTTP response status code will be 412.
|
||||
* - The `objectOrError` argument defines the JSON response body or the message string.
|
||||
* - The `description` argument contains a short description of the HTTP error.
|
||||
*
|
||||
* By default, the JSON response body contains two properties:
|
||||
* - `statusCode`: this will be the value 412.
|
||||
* - `message`: the string `'Precondition Failed'` by default; override this by supplying
|
||||
* a string in the `objectOrError` parameter.
|
||||
*
|
||||
* If the parameter `objectOrError` is a string, the response body will contain an
|
||||
* additional property, `error`, with a short description of the HTTP error. To override the
|
||||
* entire JSON response body, pass an object instead. Nest will serialize the object
|
||||
* and return it as the JSON response body.
|
||||
*
|
||||
* @param objectOrError string or object describing the error condition.
|
||||
* @param description a short description of the HTTP error.
|
||||
*/
|
||||
constructor(
|
||||
objectOrError?: string | object | any,
|
||||
description = 'Precondition Failed',
|
||||
) {
|
||||
super(
|
||||
HttpException.createBody(
|
||||
objectOrError,
|
||||
description,
|
||||
HttpStatus.PRECONDITION_FAILED,
|
||||
),
|
||||
HttpStatus.PRECONDITION_FAILED,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -30,12 +30,14 @@ export {
|
||||
INestApplication,
|
||||
INestApplicationContext,
|
||||
INestMicroservice,
|
||||
IntrospectionResult,
|
||||
MiddlewareConsumer,
|
||||
ModuleMetadata,
|
||||
NestApplicationOptions,
|
||||
NestHybridApplicationOptions,
|
||||
NestInterceptor,
|
||||
NestMiddleware,
|
||||
NestModule,
|
||||
NestHybridApplicationOptions,
|
||||
OnApplicationBootstrap,
|
||||
OnApplicationShutdown,
|
||||
OnModuleDestroy,
|
||||
|
||||
@@ -54,7 +54,9 @@ export interface HttpServer<TRequest = any, TResponse = any> {
|
||||
setViewEngine?(engineOrOptions: any): this;
|
||||
createMiddlewareFactory(
|
||||
method: RequestMethod,
|
||||
): (path: string, callback: Function) => any;
|
||||
):
|
||||
| ((path: string, callback: Function) => any)
|
||||
| Promise<(path: string, callback: Function) => any>;
|
||||
getRequestHostname?(request: TRequest): string;
|
||||
getRequestMethod?(request: TRequest): string;
|
||||
getRequestUrl?(request: TResponse): string;
|
||||
@@ -65,4 +67,5 @@ export interface HttpServer<TRequest = any, TResponse = any> {
|
||||
initHttpServer(options: NestApplicationOptions): void;
|
||||
close(): any;
|
||||
getType(): string;
|
||||
init?(): Promise<void>;
|
||||
}
|
||||
|
||||
@@ -15,12 +15,9 @@ export * from './features/pipe-transform.interface';
|
||||
export * from './hooks';
|
||||
export * from './http/http-server.interface';
|
||||
export * from './injectable.interface';
|
||||
export * from './microservices/nest-hybrid-application-options.interface';
|
||||
export * from './middleware';
|
||||
export * from './modules/dynamic-module.interface';
|
||||
export * from './modules/forward-reference.interface';
|
||||
export * from './modules/module-metadata.interface';
|
||||
export * from './modules/nest-module.interface';
|
||||
export * from './modules/provider.interface';
|
||||
export * from './modules';
|
||||
export * from './nest-application-context.interface';
|
||||
export * from './nest-application-options.interface';
|
||||
export * from './nest-application.interface';
|
||||
@@ -28,4 +25,3 @@ export * from './nest-microservice.interface';
|
||||
export * from './scope-options.interface';
|
||||
export * from './type.interface';
|
||||
export * from './websockets/web-socket-adapter.interface';
|
||||
export * from './microservices/nest-hybrid-application-options.interface';
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
export * from './dynamic-module.interface';
|
||||
export * from './forward-reference.interface';
|
||||
export * from './introspection-result.interface';
|
||||
export * from './module-metadata.interface';
|
||||
export * from './nest-module.interface';
|
||||
export * from './provider.interface';
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
import { Scope } from '../scope-options.interface';
|
||||
|
||||
/**
|
||||
* @publicApi
|
||||
*/
|
||||
export interface IntrospectionResult {
|
||||
/**
|
||||
* Enum defining lifetime of host class or factory.
|
||||
*/
|
||||
scope: Scope;
|
||||
}
|
||||
@@ -34,6 +34,15 @@ export interface INestApplicationContext {
|
||||
options?: { strict: boolean },
|
||||
): Promise<TResult>;
|
||||
|
||||
/**
|
||||
* Registers the request/context object for a given context ID (DI container sub-tree).
|
||||
* @returns {void}
|
||||
*/
|
||||
registerRequestByContextId<T = any>(
|
||||
request: T,
|
||||
contextId: { id: number },
|
||||
): void;
|
||||
|
||||
/**
|
||||
* Terminates the application
|
||||
* @returns {Promise<void>}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nestjs/common",
|
||||
"version": "7.2.0",
|
||||
"version": "7.4.4",
|
||||
"description": "Nest - modern, fast, powerful node.js web framework (@common)",
|
||||
"author": "Kamil Mysliwiec",
|
||||
"homepage": "https://nestjs.com",
|
||||
@@ -17,11 +17,11 @@
|
||||
},
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"axios": "0.19.2",
|
||||
"axios": "0.20.0",
|
||||
"cli-color": "2.0.0",
|
||||
"iterare": "1.2.1",
|
||||
"tslib": "2.0.0",
|
||||
"uuid": "8.1.0"
|
||||
"tslib": "2.0.1",
|
||||
"uuid": "8.3.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"reflect-metadata": "^0.1.12",
|
||||
|
||||
@@ -14,7 +14,10 @@ export class DefaultValuePipe<T = any, R = any>
|
||||
constructor(private readonly defaultValue: R) {}
|
||||
|
||||
transform(value?: T, _metadata?: ArgumentMetadata): T | R {
|
||||
if (isNil(value)) {
|
||||
if (
|
||||
isNil(value) ||
|
||||
(typeof value === 'number' && isNaN((value as unknown) as number))
|
||||
) {
|
||||
return this.defaultValue;
|
||||
}
|
||||
return value;
|
||||
|
||||
@@ -6,6 +6,7 @@ import { ArgumentMetadata, ValidationError } from '../index';
|
||||
import { ClassTransformOptions } from '../interfaces/external/class-transform-options.interface';
|
||||
import { ValidatorOptions } from '../interfaces/external/validator-options.interface';
|
||||
import { PipeTransform } from '../interfaces/features/pipe-transform.interface';
|
||||
import { Type } from '../interfaces/type.interface';
|
||||
import {
|
||||
ErrorHttpStatusCode,
|
||||
HttpErrorByCode,
|
||||
@@ -20,6 +21,7 @@ export interface ValidationPipeOptions extends ValidatorOptions {
|
||||
errorHttpStatusCode?: ErrorHttpStatusCode;
|
||||
exceptionFactory?: (errors: ValidationError[]) => any;
|
||||
validateCustomDecorators?: boolean;
|
||||
expectedType?: Type<any>;
|
||||
}
|
||||
|
||||
let classValidator: any = {};
|
||||
@@ -32,6 +34,7 @@ export class ValidationPipe implements PipeTransform<any> {
|
||||
protected validatorOptions: ValidatorOptions;
|
||||
protected transformOptions: ClassTransformOptions;
|
||||
protected errorHttpStatusCode: ErrorHttpStatusCode;
|
||||
protected expectedType: Type<any>;
|
||||
protected exceptionFactory: (errors: ValidationError[]) => any;
|
||||
protected validateCustomDecorators: boolean;
|
||||
|
||||
@@ -41,6 +44,7 @@ export class ValidationPipe implements PipeTransform<any> {
|
||||
transform,
|
||||
disableErrorMessages,
|
||||
errorHttpStatusCode,
|
||||
expectedType,
|
||||
transformOptions,
|
||||
validateCustomDecorators,
|
||||
...validatorOptions
|
||||
@@ -52,6 +56,7 @@ export class ValidationPipe implements PipeTransform<any> {
|
||||
this.isDetailedOutputDisabled = disableErrorMessages;
|
||||
this.validateCustomDecorators = validateCustomDecorators || false;
|
||||
this.errorHttpStatusCode = errorHttpStatusCode || HttpStatus.BAD_REQUEST;
|
||||
this.expectedType = expectedType;
|
||||
this.exceptionFactory =
|
||||
options.exceptionFactory || this.createExceptionFactory();
|
||||
|
||||
@@ -64,7 +69,7 @@ export class ValidationPipe implements PipeTransform<any> {
|
||||
}
|
||||
|
||||
public async transform(value: any, metadata: ArgumentMetadata) {
|
||||
const { metatype } = metadata;
|
||||
const metatype = this.expectedType || metadata.metatype;
|
||||
if (!metatype || !this.toValidate(metadata)) {
|
||||
return this.isTransformEnabled
|
||||
? this.transformPrimitive(value, metadata)
|
||||
|
||||
@@ -396,4 +396,31 @@ describe('ValidationPipe', () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('option: "expectedType"', () => {
|
||||
class TestModel2 {
|
||||
@IsString()
|
||||
public prop1: string;
|
||||
|
||||
@IsBoolean()
|
||||
public prop2: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
public optionalProp: string;
|
||||
}
|
||||
|
||||
it('should validate against the expected type if presented', async () => {
|
||||
const m: ArgumentMetadata = {
|
||||
type: 'body',
|
||||
metatype: TestModel2,
|
||||
data: '',
|
||||
};
|
||||
|
||||
target = new ValidationPipe({ expectedType: TestModel });
|
||||
const testObj = { prop1: 'value1', prop2: 'value2' };
|
||||
|
||||
expect(await target.transform(testObj, m)).to.equal(testObj);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -13,6 +13,7 @@ import {
|
||||
NotFoundException,
|
||||
NotImplementedException,
|
||||
PayloadTooLargeException,
|
||||
PreconditionFailedException,
|
||||
RequestTimeoutException,
|
||||
ServiceUnavailableException,
|
||||
UnauthorizedException,
|
||||
@@ -35,6 +36,7 @@ export type ErrorHttpStatusCode =
|
||||
| HttpStatus.NOT_FOUND
|
||||
| HttpStatus.NOT_IMPLEMENTED
|
||||
| HttpStatus.PAYLOAD_TOO_LARGE
|
||||
| HttpStatus.PRECONDITION_FAILED
|
||||
| HttpStatus.REQUEST_TIMEOUT
|
||||
| HttpStatus.SERVICE_UNAVAILABLE
|
||||
| HttpStatus.UNAUTHORIZED
|
||||
@@ -55,6 +57,7 @@ export const HttpErrorByCode: Record<ErrorHttpStatusCode, Type<unknown>> = {
|
||||
[HttpStatus.NOT_FOUND]: NotFoundException,
|
||||
[HttpStatus.NOT_IMPLEMENTED]: NotImplementedException,
|
||||
[HttpStatus.PAYLOAD_TOO_LARGE]: PayloadTooLargeException,
|
||||
[HttpStatus.PRECONDITION_FAILED]: PreconditionFailedException,
|
||||
[HttpStatus.REQUEST_TIMEOUT]: RequestTimeoutException,
|
||||
[HttpStatus.SERVICE_UNAVAILABLE]: ServiceUnavailableException,
|
||||
[HttpStatus.UNAUTHORIZED]: UnauthorizedException,
|
||||
|
||||
@@ -54,9 +54,11 @@ With official support, you can get expert help straight from Nest core team. We
|
||||
|
||||
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support).
|
||||
|
||||
#### Principal Sponsor
|
||||
|
||||
<a href="https://valor-software.com/" target="_blank"><img src="https://docs.nestjs.com/assets/sponsors/valor-software.png" width="220" /></a>
|
||||
#### Principal Sponsors
|
||||
<table style="text-align:center;"><tr><td>
|
||||
<a href="https://github.com/Sanofi-IADC" target="_blank"><img src="https://docs.nestjs.com/assets/sponsors/sanofi.png" width="180" valign="middle" /></a></td><td>
|
||||
<a href="https://valor-software.com/" target="_blank"><img src="https://docs.nestjs.com/assets/sponsors/valor-software.png" width="180" valign="middle" /></a></td>
|
||||
</tr></table>
|
||||
|
||||
#### Silver Sponsors
|
||||
|
||||
@@ -84,7 +86,11 @@ Nest is an MIT-licensed open source project. It can grow thanks to the sponsors
|
||||
<a href="https://www.codeguesser.co.uk" target="_blank"><img src="https://nestjs.com/img/codeguesser-logo.svg" width="120" valign="middle" /></a> </td><td align="center" valign="middle">
|
||||
<a href="https://tekhattan.com" target="_blank"><img src="https://nestjs.com/img/tekhattan-logo.png" width="110" valign="middle" /></a> </td><td align="center" valign="middle">
|
||||
<a href="https://f-a.nz/" target="_blank"><img src="https://nestjs.com/img/franz.svg" width="80" valign="middle" /></a> </td><td align="center" valign="middle">
|
||||
<a href="https://sparkfabrik.com/" target="_blank"><img src="https://nestjs.com/img/sparkfabrik-logo.png" width="120" valign="middle" /></a></td><td align="center" valign="middle"><a href="https://www.thebigphonestore.co.uk/" target="_blank"><img src="https://nestjs.com/img/the-big-phone-store-logo.png" width="65" valign="middle" /></a></td></tr></table>
|
||||
<a href="https://sparkfabrik.com/" target="_blank"><img src="https://nestjs.com/img/sparkfabrik-logo.png" width="120" valign="middle" /></a></td><td align="center" valign="middle"><a href="https://www.thebigphonestore.co.uk/" target="_blank"><img src="https://nestjs.com/img/the-big-phone-store-logo.png" width="65" valign="middle" /></a></td>
|
||||
<td align="center" valign="middle">
|
||||
<a href="https://genuinebee.com/" target="_blank"><img src="https://nestjs.com/img/genuinebee.svg" width="97" valign="middle" /></a> </td></tr>
|
||||
<tr><td align="center" valign="middle"><a href="https://sanyodigital.com/" target="_blank"><img src="https://nestjs.com/img/sanyo-digital.png" width="130" valign="middle" /></a></td><td align="center" valign="middle"><a href="https://vpn-review.com/vpn-for-torrenting" target="_blank"><img src="https://nestjs.com/img/vpn-review-logo.png" width="85" valign="middle" /></a></td>
|
||||
</tr></table>
|
||||
|
||||
## Backers
|
||||
|
||||
|
||||
@@ -15,6 +15,9 @@ export abstract class AbstractHttpAdapter<
|
||||
|
||||
constructor(protected readonly instance: any) {}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
||||
public async init() {}
|
||||
|
||||
public use(...args: any[]) {
|
||||
return this.instance.use(...args);
|
||||
}
|
||||
@@ -97,6 +100,8 @@ export abstract class AbstractHttpAdapter<
|
||||
abstract enableCors(options: CorsOptions, prefix?: string);
|
||||
abstract createMiddlewareFactory(
|
||||
requestMethod: RequestMethod,
|
||||
): (path: string, callback: Function) => any;
|
||||
):
|
||||
| ((path: string, callback: Function) => any)
|
||||
| Promise<(path: string, callback: Function) => any>;
|
||||
abstract getType(): string;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { RuntimeException } from './runtime.exception';
|
||||
|
||||
export class UnknownElementException extends RuntimeException {
|
||||
constructor(name?: string) {
|
||||
constructor(name?: string | symbol) {
|
||||
name = name && name.toString();
|
||||
super(
|
||||
`Nest could not find ${
|
||||
name || 'given'
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { BeforeApplicationShutdown } from '@nestjs/common';
|
||||
import { isNil } from '@nestjs/common/utils/shared.utils';
|
||||
import { iterate } from 'iterare';
|
||||
import { InstanceWrapper } from '../injector/instance-wrapper';
|
||||
import { Module } from '../injector/module';
|
||||
import {
|
||||
getNonTransientInstances,
|
||||
getTransientInstances,
|
||||
} from '../injector/transient-instances';
|
||||
} from '../injector/helpers/transient-instances';
|
||||
import { InstanceWrapper } from '../injector/instance-wrapper';
|
||||
import { Module } from '../injector/module';
|
||||
|
||||
/**
|
||||
* Checks if the given instance has the `beforeApplicationShutdown` function
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { OnApplicationBootstrap } from '@nestjs/common';
|
||||
import { isNil } from '@nestjs/common/utils/shared.utils';
|
||||
import { iterate } from 'iterare';
|
||||
import { InstanceWrapper } from '../injector/instance-wrapper';
|
||||
import { Module } from '../injector/module';
|
||||
import {
|
||||
getNonTransientInstances,
|
||||
getTransientInstances,
|
||||
} from '../injector/transient-instances';
|
||||
} from '../injector/helpers/transient-instances';
|
||||
import { InstanceWrapper } from '../injector/instance-wrapper';
|
||||
import { Module } from '../injector/module';
|
||||
|
||||
/**
|
||||
* Checks if the given instance has the `onApplicationBootstrap` function
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { OnApplicationShutdown } from '@nestjs/common';
|
||||
import { isNil } from '@nestjs/common/utils/shared.utils';
|
||||
import { iterate } from 'iterare';
|
||||
import { InstanceWrapper } from '../injector/instance-wrapper';
|
||||
import { Module } from '../injector/module';
|
||||
import {
|
||||
getNonTransientInstances,
|
||||
getTransientInstances,
|
||||
} from '../injector/transient-instances';
|
||||
} from '../injector/helpers/transient-instances';
|
||||
import { InstanceWrapper } from '../injector/instance-wrapper';
|
||||
import { Module } from '../injector/module';
|
||||
|
||||
/**
|
||||
* Checks if the given instance has the `onApplicationShutdown` function
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { OnModuleDestroy } from '@nestjs/common';
|
||||
import { isNil } from '@nestjs/common/utils/shared.utils';
|
||||
import { iterate } from 'iterare';
|
||||
import { InstanceWrapper } from '../injector/instance-wrapper';
|
||||
import { Module } from '../injector/module';
|
||||
import {
|
||||
getNonTransientInstances,
|
||||
getTransientInstances,
|
||||
} from '../injector/transient-instances';
|
||||
} from '../injector/helpers/transient-instances';
|
||||
import { InstanceWrapper } from '../injector/instance-wrapper';
|
||||
import { Module } from '../injector/module';
|
||||
|
||||
/**
|
||||
* Returns true or false if the given instance has a `onModuleDestroy` function
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { OnModuleInit } from '@nestjs/common';
|
||||
import { isNil } from '@nestjs/common/utils/shared.utils';
|
||||
import { iterate } from 'iterare';
|
||||
import { InstanceWrapper } from '../injector/instance-wrapper';
|
||||
import { Module } from '../injector/module';
|
||||
import {
|
||||
getNonTransientInstances,
|
||||
getTransientInstances,
|
||||
} from '../injector/transient-instances';
|
||||
} from '../injector/helpers/transient-instances';
|
||||
import { InstanceWrapper } from '../injector/instance-wrapper';
|
||||
import { Module } from '../injector/module';
|
||||
|
||||
/**
|
||||
* Returns true or false if the given instance has a `onModuleInit` function
|
||||
|
||||
@@ -1,118 +0,0 @@
|
||||
import { Type } from '@nestjs/common';
|
||||
import { Abstract, Scope } from '@nestjs/common/interfaces';
|
||||
import { isFunction } from '@nestjs/common/utils/shared.utils';
|
||||
import { InvalidClassScopeException } from '../errors/exceptions/invalid-class-scope.exception';
|
||||
import { UnknownElementException } from '../errors/exceptions/unknown-element.exception';
|
||||
import { NestContainer } from './container';
|
||||
import { InstanceWrapper } from './instance-wrapper';
|
||||
import { Module } from './module';
|
||||
|
||||
type HostCollection = 'providers' | 'controllers' | 'injectables';
|
||||
|
||||
export class ContainerScanner {
|
||||
private flatContainer: Partial<Module>;
|
||||
|
||||
constructor(private readonly container: NestContainer) {}
|
||||
|
||||
public find<TInput = any, TResult = TInput>(
|
||||
typeOrToken: Type<TInput> | Abstract<TInput> | string | symbol,
|
||||
): TResult {
|
||||
this.initFlatContainer();
|
||||
return this.findInstanceByToken<TInput, TResult>(
|
||||
typeOrToken,
|
||||
this.flatContainer,
|
||||
);
|
||||
}
|
||||
|
||||
public getWrapperCollectionPair<TInput = any, TResult = TInput>(
|
||||
typeOrToken: Type<TInput> | Abstract<TInput> | string | symbol,
|
||||
): [InstanceWrapper<TResult>, Map<string, InstanceWrapper>] {
|
||||
this.initFlatContainer();
|
||||
return this.getWrapperCollectionPairByHost<TInput, TResult>(
|
||||
typeOrToken,
|
||||
this.flatContainer,
|
||||
);
|
||||
}
|
||||
|
||||
public findInstanceByToken<TInput = any, TResult = TInput>(
|
||||
metatypeOrToken: Type<TInput> | Abstract<TInput> | string | symbol,
|
||||
contextModule: Partial<Module>,
|
||||
): TResult {
|
||||
const [instanceWrapper] = this.getWrapperCollectionPairByHost(
|
||||
metatypeOrToken,
|
||||
contextModule,
|
||||
);
|
||||
if (
|
||||
instanceWrapper.scope === Scope.REQUEST ||
|
||||
instanceWrapper.scope === Scope.TRANSIENT
|
||||
) {
|
||||
throw new InvalidClassScopeException(metatypeOrToken);
|
||||
}
|
||||
return (instanceWrapper.instance as unknown) as TResult;
|
||||
}
|
||||
|
||||
public getWrapperCollectionPairByHost<TInput = any, TResult = TInput>(
|
||||
metatypeOrToken: Type<TInput> | Abstract<TInput> | string | symbol,
|
||||
contextModule: Partial<Module>,
|
||||
): [InstanceWrapper<TResult>, Map<string, InstanceWrapper>] {
|
||||
const name = isFunction(metatypeOrToken)
|
||||
? (metatypeOrToken as Function).name
|
||||
: metatypeOrToken;
|
||||
const collectionName = this.getHostCollection(
|
||||
name as string,
|
||||
contextModule,
|
||||
);
|
||||
const instanceWrapper = contextModule[collectionName].get(name as string);
|
||||
if (!instanceWrapper) {
|
||||
throw new UnknownElementException(name && name.toString());
|
||||
}
|
||||
return [
|
||||
instanceWrapper as InstanceWrapper<TResult>,
|
||||
contextModule[collectionName],
|
||||
];
|
||||
}
|
||||
|
||||
private initFlatContainer() {
|
||||
if (this.flatContainer) {
|
||||
return;
|
||||
}
|
||||
const modules = this.container.getModules();
|
||||
const initialValue: Record<string, any[]> = {
|
||||
providers: [],
|
||||
controllers: [],
|
||||
injectables: [],
|
||||
};
|
||||
const merge = <T = unknown>(
|
||||
initial: Map<string, T> | T[],
|
||||
arr: Map<string, T>,
|
||||
) => [...initial, ...arr];
|
||||
|
||||
const partialModule = ([...modules.values()].reduce(
|
||||
(current, next) => ({
|
||||
providers: merge(current.providers, next.providers),
|
||||
controllers: merge(current.controllers, next.controllers),
|
||||
injectables: merge(current.injectables, next.injectables),
|
||||
}),
|
||||
initialValue,
|
||||
) as any) as Partial<Module>;
|
||||
|
||||
this.flatContainer = {
|
||||
providers: new Map(partialModule.providers),
|
||||
controllers: new Map(partialModule.controllers),
|
||||
injectables: new Map(partialModule.injectables),
|
||||
};
|
||||
}
|
||||
|
||||
private getHostCollection(
|
||||
token: string,
|
||||
{ providers, controllers }: Partial<Module>,
|
||||
): HostCollection {
|
||||
if (providers.has(token)) {
|
||||
return 'providers';
|
||||
}
|
||||
if (controllers.has(token)) {
|
||||
return 'controllers';
|
||||
}
|
||||
return 'injectables';
|
||||
}
|
||||
}
|
||||
@@ -68,7 +68,12 @@ export class NestContainer {
|
||||
}
|
||||
const moduleRef = new Module(type, this);
|
||||
this.modules.set(token, moduleRef);
|
||||
this.addDynamicMetadata(token, dynamicMetadata, [].concat(scope, type));
|
||||
|
||||
await this.addDynamicMetadata(
|
||||
token,
|
||||
dynamicMetadata,
|
||||
[].concat(scope, type),
|
||||
);
|
||||
|
||||
if (this.isGlobalModule(type, dynamicMetadata)) {
|
||||
this.addGlobalModule(moduleRef);
|
||||
@@ -76,7 +81,7 @@ export class NestContainer {
|
||||
return moduleRef;
|
||||
}
|
||||
|
||||
public addDynamicMetadata(
|
||||
public async addDynamicMetadata(
|
||||
token: string,
|
||||
dynamicModuleMetadata: Partial<DynamicModule>,
|
||||
scope: Type<any>[],
|
||||
@@ -87,14 +92,14 @@ export class NestContainer {
|
||||
this.dynamicModulesMetadata.set(token, dynamicModuleMetadata);
|
||||
|
||||
const { imports } = dynamicModuleMetadata;
|
||||
this.addDynamicModules(imports, scope);
|
||||
await this.addDynamicModules(imports, scope);
|
||||
}
|
||||
|
||||
public addDynamicModules(modules: any[], scope: Type<any>[]) {
|
||||
public async addDynamicModules(modules: any[], scope: Type<any>[]) {
|
||||
if (!modules) {
|
||||
return;
|
||||
}
|
||||
modules.forEach(module => this.addModule(module, scope));
|
||||
await Promise.all(modules.map(module => this.addModule(module, scope)));
|
||||
}
|
||||
|
||||
public isGlobalModule(
|
||||
@@ -196,7 +201,7 @@ export class NestContainer {
|
||||
}
|
||||
|
||||
public bindGlobalModuleToModule(target: Module, globalModule: Module) {
|
||||
if (target === globalModule) {
|
||||
if (target === globalModule || target === this.internalCoreModule) {
|
||||
return;
|
||||
}
|
||||
target.addRelatedModule(globalModule);
|
||||
@@ -205,7 +210,7 @@ export class NestContainer {
|
||||
public getDynamicMetadataByToken(
|
||||
token: string,
|
||||
metadataKey: keyof DynamicModule,
|
||||
): any[] {
|
||||
) {
|
||||
const metadata = this.dynamicModulesMetadata.get(token);
|
||||
if (metadata && metadata[metadataKey]) {
|
||||
return metadata[metadataKey] as any[];
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { iterate } from 'iterare';
|
||||
|
||||
import { InstanceWrapper } from './instance-wrapper';
|
||||
import { InstanceWrapper } from '../instance-wrapper';
|
||||
|
||||
/**
|
||||
* Returns the instances which are transient
|
||||
79
packages/core/injector/instance-links-host.ts
Normal file
79
packages/core/injector/instance-links-host.ts
Normal file
@@ -0,0 +1,79 @@
|
||||
import { Abstract, Type } from '@nestjs/common';
|
||||
import { isFunction } from '@nestjs/common/utils/shared.utils';
|
||||
import { UnknownElementException } from '../errors/exceptions/unknown-element.exception';
|
||||
import { NestContainer } from './container';
|
||||
import { InstanceWrapper } from './instance-wrapper';
|
||||
import { Module } from './module';
|
||||
|
||||
type InstanceToken = string | symbol | Type<any> | Abstract<any> | Function;
|
||||
type HostCollection = 'providers' | 'controllers' | 'injectables';
|
||||
|
||||
export interface InstanceLink<T = any> {
|
||||
token: InstanceToken;
|
||||
wrapperRef: InstanceWrapper<T>;
|
||||
collection: Map<any, InstanceWrapper>;
|
||||
moduleId: string;
|
||||
}
|
||||
|
||||
export class InstanceLinksHost {
|
||||
private readonly instanceLinks = new Map<InstanceToken, InstanceLink[]>();
|
||||
|
||||
constructor(private readonly container: NestContainer) {
|
||||
this.initialize();
|
||||
}
|
||||
|
||||
get<T = any>(token: InstanceToken, moduleId?: string): InstanceLink<T> {
|
||||
const name = isFunction(token)
|
||||
? (token as Function).name
|
||||
: (token as string | symbol);
|
||||
const modulesMap = this.instanceLinks.get(name);
|
||||
|
||||
if (!modulesMap) {
|
||||
throw new UnknownElementException(name);
|
||||
}
|
||||
const instanceLink = moduleId
|
||||
? modulesMap.find(item => item.moduleId === moduleId)
|
||||
: modulesMap[modulesMap.length - 1];
|
||||
|
||||
if (!instanceLink) {
|
||||
throw new UnknownElementException(name);
|
||||
}
|
||||
return instanceLink;
|
||||
}
|
||||
|
||||
private initialize() {
|
||||
const modules = this.container.getModules();
|
||||
modules.forEach(moduleRef => {
|
||||
const { providers, injectables, controllers } = moduleRef;
|
||||
providers.forEach((wrapper, token) =>
|
||||
this.addLink(wrapper, token, moduleRef, 'providers'),
|
||||
);
|
||||
injectables.forEach((wrapper, token) =>
|
||||
this.addLink(wrapper, token, moduleRef, 'injectables'),
|
||||
);
|
||||
controllers.forEach((wrapper, token) =>
|
||||
this.addLink(wrapper, token, moduleRef, 'controllers'),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
private addLink(
|
||||
wrapper: InstanceWrapper,
|
||||
token: InstanceToken,
|
||||
moduleRef: Module,
|
||||
collectionName: HostCollection,
|
||||
) {
|
||||
const instanceLink: InstanceLink = {
|
||||
moduleId: moduleRef.id,
|
||||
wrapperRef: wrapper,
|
||||
collection: moduleRef[collectionName],
|
||||
token,
|
||||
};
|
||||
const existingLinks = this.instanceLinks.get(token);
|
||||
if (!existingLinks) {
|
||||
this.instanceLinks.set(token, [instanceLink]);
|
||||
} else {
|
||||
existingLinks.push(instanceLink);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,20 +1,26 @@
|
||||
import { Type } from '@nestjs/common';
|
||||
import { IntrospectionResult, Scope, Type } from '@nestjs/common';
|
||||
import { InvalidClassScopeException } from '../errors/exceptions/invalid-class-scope.exception';
|
||||
import { UnknownElementException } from '../errors/exceptions/unknown-element.exception';
|
||||
import { getClassScope } from '../helpers/get-class-scope';
|
||||
import { NestContainer } from './container';
|
||||
import { ContainerScanner } from './container-scanner';
|
||||
import { Injector } from './injector';
|
||||
import { InstanceLinksHost } from './instance-links-host';
|
||||
import { ContextId, InstanceWrapper } from './instance-wrapper';
|
||||
import { Module } from './module';
|
||||
|
||||
export abstract class ModuleRef {
|
||||
private readonly injector = new Injector();
|
||||
private readonly containerScanner: ContainerScanner;
|
||||
private _instanceLinksHost: InstanceLinksHost;
|
||||
|
||||
constructor(protected readonly container: NestContainer) {
|
||||
this.containerScanner = new ContainerScanner(container);
|
||||
private get instanceLinksHost() {
|
||||
if (!this._instanceLinksHost) {
|
||||
this._instanceLinksHost = new InstanceLinksHost(this.container);
|
||||
}
|
||||
return this._instanceLinksHost;
|
||||
}
|
||||
|
||||
constructor(protected readonly container: NestContainer) {}
|
||||
|
||||
public abstract get<TInput = any, TResult = TInput>(
|
||||
typeOrToken: Type<TInput> | string | symbol,
|
||||
options?: { strict: boolean },
|
||||
@@ -26,10 +32,70 @@ export abstract class ModuleRef {
|
||||
): Promise<TResult>;
|
||||
public abstract create<T = any>(type: Type<T>): Promise<T>;
|
||||
|
||||
public introspect<T = any>(
|
||||
token: Type<T> | string | symbol,
|
||||
): IntrospectionResult {
|
||||
const { wrapperRef } = this.instanceLinksHost.get(token);
|
||||
|
||||
let scope = Scope.DEFAULT;
|
||||
if (!wrapperRef.isDependencyTreeStatic()) {
|
||||
scope = Scope.REQUEST;
|
||||
} else if (wrapperRef.isTransient) {
|
||||
scope = Scope.TRANSIENT;
|
||||
}
|
||||
return { scope };
|
||||
}
|
||||
|
||||
public registerRequestByContextId<T = any>(request: T, contextId: ContextId) {
|
||||
this.container.registerRequestProvider(request, contextId);
|
||||
}
|
||||
|
||||
protected find<TInput = any, TResult = TInput>(
|
||||
typeOrToken: Type<TInput> | string | symbol,
|
||||
contextModule?: Module,
|
||||
): TResult {
|
||||
return this.containerScanner.find<TInput, TResult>(typeOrToken);
|
||||
const moduleId = contextModule && contextModule.id;
|
||||
const { wrapperRef } = this.instanceLinksHost.get<TResult>(
|
||||
typeOrToken,
|
||||
moduleId,
|
||||
);
|
||||
if (
|
||||
wrapperRef.scope === Scope.REQUEST ||
|
||||
wrapperRef.scope === Scope.TRANSIENT
|
||||
) {
|
||||
throw new InvalidClassScopeException(typeOrToken);
|
||||
}
|
||||
return wrapperRef.instance;
|
||||
}
|
||||
|
||||
protected async resolvePerContext<TInput = any, TResult = TInput>(
|
||||
typeOrToken: Type<TInput> | string | symbol,
|
||||
contextModule: Module,
|
||||
contextId: ContextId,
|
||||
options?: { strict: boolean },
|
||||
): Promise<TResult> {
|
||||
const isStrictModeEnabled = options && options.strict;
|
||||
const instanceLink = isStrictModeEnabled
|
||||
? this.instanceLinksHost.get(typeOrToken, contextModule.id)
|
||||
: this.instanceLinksHost.get(typeOrToken);
|
||||
|
||||
const { wrapperRef, collection } = instanceLink;
|
||||
if (wrapperRef.isDependencyTreeStatic() && !wrapperRef.isTransient) {
|
||||
return this.get(typeOrToken);
|
||||
}
|
||||
|
||||
const ctorHost = wrapperRef.instance || { constructor: typeOrToken };
|
||||
const instance = await this.injector.loadPerContext(
|
||||
ctorHost,
|
||||
wrapperRef.host,
|
||||
collection,
|
||||
contextId,
|
||||
wrapperRef,
|
||||
);
|
||||
if (!instance) {
|
||||
throw new UnknownElementException();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
protected async instantiateClass<T = any>(
|
||||
@@ -65,54 +131,4 @@ export abstract class ModuleRef {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected findInstanceByToken<TInput = any, TResult = TInput>(
|
||||
metatypeOrToken: Type<TInput> | string | symbol,
|
||||
contextModule: Module,
|
||||
): TResult {
|
||||
return this.containerScanner.findInstanceByToken<TInput, TResult>(
|
||||
metatypeOrToken,
|
||||
contextModule,
|
||||
);
|
||||
}
|
||||
|
||||
protected async resolvePerContext<TInput = any, TResult = TInput>(
|
||||
typeOrToken: Type<TInput> | string | symbol,
|
||||
contextModule: Module,
|
||||
contextId: ContextId,
|
||||
options?: { strict: boolean },
|
||||
): Promise<TResult> {
|
||||
let wrapper: InstanceWrapper, collection: Map<string, InstanceWrapper>;
|
||||
|
||||
const isStrictModeEnabled = options && options.strict;
|
||||
if (!isStrictModeEnabled) {
|
||||
[wrapper, collection] = this.containerScanner.getWrapperCollectionPair(
|
||||
typeOrToken,
|
||||
);
|
||||
} else {
|
||||
[
|
||||
wrapper,
|
||||
collection,
|
||||
] = this.containerScanner.getWrapperCollectionPairByHost(
|
||||
typeOrToken,
|
||||
contextModule,
|
||||
);
|
||||
}
|
||||
if (wrapper.isDependencyTreeStatic() && !wrapper.isTransient) {
|
||||
return this.get(typeOrToken);
|
||||
}
|
||||
|
||||
const ctorHost = wrapper.instance || { constructor: typeOrToken };
|
||||
const instance = await this.injector.loadPerContext(
|
||||
ctorHost,
|
||||
wrapper.host,
|
||||
collection,
|
||||
contextId,
|
||||
wrapper,
|
||||
);
|
||||
if (!instance) {
|
||||
throw new UnknownElementException();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -479,7 +479,7 @@ export class Module {
|
||||
return [...this._providers].filter(([_, wrapper]) => !wrapper.isAlias);
|
||||
}
|
||||
|
||||
public createModuleReferenceType(): any {
|
||||
public createModuleReferenceType(): Type<ModuleRef> {
|
||||
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
||||
const self = this;
|
||||
return class extends ModuleRef {
|
||||
@@ -491,10 +491,9 @@ export class Module {
|
||||
typeOrToken: Type<TInput> | string | symbol,
|
||||
options: { strict: boolean } = { strict: true },
|
||||
): TResult {
|
||||
if (!(options && options.strict)) {
|
||||
return this.find<TInput, TResult>(typeOrToken);
|
||||
}
|
||||
return this.findInstanceByToken<TInput, TResult>(typeOrToken, self);
|
||||
return !(options && options.strict)
|
||||
? this.find<TInput, TResult>(typeOrToken)
|
||||
: this.find<TInput, TResult>(typeOrToken, self);
|
||||
}
|
||||
|
||||
public resolve<TInput = any, TResult = TInput>(
|
||||
|
||||
@@ -196,7 +196,7 @@ export class MiddlewareModule {
|
||||
if (isUndefined(instance.use)) {
|
||||
throw new InvalidMiddlewareException(metatype.name);
|
||||
}
|
||||
const router = applicationRef.createMiddlewareFactory(method);
|
||||
const router = await applicationRef.createMiddlewareFactory(method);
|
||||
const isStatic = wrapper.isDependencyTreeStatic();
|
||||
if (isStatic) {
|
||||
const proxy = await this.createProxy(instance);
|
||||
|
||||
@@ -4,11 +4,12 @@ import {
|
||||
LoggerService,
|
||||
ShutdownSignal,
|
||||
} from '@nestjs/common';
|
||||
import { Abstract } from '@nestjs/common/interfaces';
|
||||
import { Abstract, Scope } from '@nestjs/common/interfaces';
|
||||
import { Type } from '@nestjs/common/interfaces/type.interface';
|
||||
import { isEmpty } from '@nestjs/common/utils/shared.utils';
|
||||
import { iterate } from 'iterare';
|
||||
import { MESSAGES } from './constants';
|
||||
import { InvalidClassScopeException } from './errors/exceptions/invalid-class-scope.exception';
|
||||
import { UnknownElementException } from './errors/exceptions/unknown-element.exception';
|
||||
import { UnknownModuleException } from './errors/exceptions/unknown-module.exception';
|
||||
import { createContextId } from './helpers';
|
||||
@@ -21,9 +22,8 @@ import {
|
||||
} from './hooks';
|
||||
import { ContextId } from './injector';
|
||||
import { NestContainer } from './injector/container';
|
||||
import { ContainerScanner } from './injector/container-scanner';
|
||||
import { Injector } from './injector/injector';
|
||||
import { InstanceWrapper } from './injector/instance-wrapper';
|
||||
import { InstanceLinksHost } from './injector/instance-links-host';
|
||||
import { Module } from './injector/module';
|
||||
|
||||
/**
|
||||
@@ -34,15 +34,20 @@ export class NestApplicationContext implements INestApplicationContext {
|
||||
protected readonly injector = new Injector();
|
||||
private shutdownCleanupRef?: (...args: unknown[]) => unknown;
|
||||
private readonly activeShutdownSignals = new Array<string>();
|
||||
private readonly containerScanner: ContainerScanner;
|
||||
private _instanceLinksHost: InstanceLinksHost;
|
||||
|
||||
private get instanceLinksHost() {
|
||||
if (!this._instanceLinksHost) {
|
||||
this._instanceLinksHost = new InstanceLinksHost(this.container);
|
||||
}
|
||||
return this._instanceLinksHost;
|
||||
}
|
||||
|
||||
constructor(
|
||||
protected readonly container: NestContainer,
|
||||
private readonly scope = new Array<Type<any>>(),
|
||||
private contextModule: Module = null,
|
||||
) {
|
||||
this.containerScanner = new ContainerScanner(container);
|
||||
}
|
||||
) {}
|
||||
|
||||
public selectContextModule() {
|
||||
const modules = this.container.getModules().values();
|
||||
@@ -67,13 +72,9 @@ export class NestApplicationContext implements INestApplicationContext {
|
||||
typeOrToken: Type<TInput> | Abstract<TInput> | string | symbol,
|
||||
options: { strict: boolean } = { strict: false },
|
||||
): TResult {
|
||||
if (!(options && options.strict)) {
|
||||
return this.find<TInput, TResult>(typeOrToken);
|
||||
}
|
||||
return this.findInstanceByToken<TInput, TResult>(
|
||||
typeOrToken,
|
||||
this.contextModule,
|
||||
);
|
||||
return !(options && options.strict)
|
||||
? this.find<TInput, TResult>(typeOrToken)
|
||||
: this.find<TInput, TResult>(typeOrToken, this.contextModule);
|
||||
}
|
||||
|
||||
public resolve<TInput = any, TResult = TInput>(
|
||||
@@ -89,6 +90,10 @@ export class NestApplicationContext implements INestApplicationContext {
|
||||
);
|
||||
}
|
||||
|
||||
public registerRequestByContextId<T = any>(request: T, contextId: ContextId) {
|
||||
this.container.registerRequestProvider(request, contextId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initalizes the Nest application.
|
||||
* Calls the Nest lifecycle events.
|
||||
@@ -111,7 +116,7 @@ export class NestApplicationContext implements INestApplicationContext {
|
||||
await this.callBeforeShutdownHook();
|
||||
await this.dispose();
|
||||
await this.callShutdownHook();
|
||||
await this.unsubscribeFromProcessSignals();
|
||||
this.unsubscribeFromProcessSignals();
|
||||
}
|
||||
|
||||
public useLogger(logger: LoggerService) {
|
||||
@@ -255,18 +260,20 @@ export class NestApplicationContext implements INestApplicationContext {
|
||||
|
||||
protected find<TInput = any, TResult = TInput>(
|
||||
typeOrToken: Type<TInput> | Abstract<TInput> | string | symbol,
|
||||
contextModule?: Module,
|
||||
): TResult {
|
||||
return this.containerScanner.find<TInput, TResult>(typeOrToken);
|
||||
}
|
||||
|
||||
protected findInstanceByToken<TInput = any, TResult = TInput>(
|
||||
metatypeOrToken: Type<TInput> | Abstract<TInput> | string | symbol,
|
||||
contextModule: Partial<Module>,
|
||||
): TResult {
|
||||
return this.containerScanner.findInstanceByToken<TInput, TResult>(
|
||||
metatypeOrToken,
|
||||
contextModule,
|
||||
const moduleId = contextModule && contextModule.id;
|
||||
const { wrapperRef } = this.instanceLinksHost.get<TResult>(
|
||||
typeOrToken,
|
||||
moduleId,
|
||||
);
|
||||
if (
|
||||
wrapperRef.scope === Scope.REQUEST ||
|
||||
wrapperRef.scope === Scope.TRANSIENT
|
||||
) {
|
||||
throw new InvalidClassScopeException(typeOrToken);
|
||||
}
|
||||
return wrapperRef.instance;
|
||||
}
|
||||
|
||||
protected async resolvePerContext<TInput = any, TResult = TInput>(
|
||||
@@ -275,30 +282,20 @@ export class NestApplicationContext implements INestApplicationContext {
|
||||
contextId: ContextId,
|
||||
options?: { strict: boolean },
|
||||
): Promise<TResult> {
|
||||
let wrapper: InstanceWrapper, collection: Map<string, InstanceWrapper>;
|
||||
|
||||
const isStrictModeEnabled = options && options.strict;
|
||||
if (!isStrictModeEnabled) {
|
||||
[wrapper, collection] = this.containerScanner.getWrapperCollectionPair(
|
||||
typeOrToken,
|
||||
);
|
||||
} else {
|
||||
[
|
||||
wrapper,
|
||||
collection,
|
||||
] = this.containerScanner.getWrapperCollectionPairByHost(
|
||||
typeOrToken,
|
||||
contextModule,
|
||||
);
|
||||
}
|
||||
if (wrapper.isDependencyTreeStatic() && !wrapper.isTransient) {
|
||||
const instanceLink = isStrictModeEnabled
|
||||
? this.instanceLinksHost.get(typeOrToken, contextModule.id)
|
||||
: this.instanceLinksHost.get(typeOrToken);
|
||||
|
||||
const { wrapperRef, collection } = instanceLink;
|
||||
if (wrapperRef.isDependencyTreeStatic() && !wrapperRef.isTransient) {
|
||||
return this.get(typeOrToken);
|
||||
}
|
||||
|
||||
const ctorHost = wrapper.instance || { constructor: typeOrToken };
|
||||
const ctorHost = wrapperRef.instance || { constructor: typeOrToken };
|
||||
const instance = await this.injector.loadPerContext(
|
||||
ctorHost,
|
||||
wrapper.host,
|
||||
wrapperRef.host,
|
||||
collection,
|
||||
contextId,
|
||||
);
|
||||
|
||||
@@ -138,6 +138,7 @@ export class NestApplication extends NestApplicationContext
|
||||
|
||||
public async init(): Promise<this> {
|
||||
this.applyOptions();
|
||||
await this.httpAdapter?.init();
|
||||
|
||||
const useBodyParser =
|
||||
this.appOptions && this.appOptions.bodyParser !== false;
|
||||
|
||||
@@ -147,12 +147,15 @@ export class NestFactoryStatic {
|
||||
httpServer: HttpServer = null,
|
||||
) {
|
||||
const instanceLoader = new InstanceLoader(container);
|
||||
const metadataScanner = new MetadataScanner();
|
||||
const dependenciesScanner = new DependenciesScanner(
|
||||
container,
|
||||
new MetadataScanner(),
|
||||
metadataScanner,
|
||||
config,
|
||||
);
|
||||
container.setHttpAdapter(httpServer);
|
||||
|
||||
await httpServer?.init();
|
||||
try {
|
||||
this.logger.log(MESSAGES.APPLICATION_START);
|
||||
await ExceptionsZone.asyncRun(async () => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nestjs/core",
|
||||
"version": "7.2.0",
|
||||
"version": "7.4.4",
|
||||
"description": "Nest - modern, fast, powerful node.js web framework (@core)",
|
||||
"author": "Kamil Mysliwiec",
|
||||
"license": "MIT",
|
||||
@@ -32,11 +32,11 @@
|
||||
"iterare": "1.2.1",
|
||||
"object-hash": "2.0.3",
|
||||
"path-to-regexp": "3.2.0",
|
||||
"tslib": "2.0.0",
|
||||
"uuid": "8.1.0"
|
||||
"tslib": "2.0.1",
|
||||
"uuid": "8.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@nestjs/common": "7.2.0"
|
||||
"@nestjs/common": "7.4.4"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@nestjs/common": "^7.0.0",
|
||||
|
||||
@@ -28,7 +28,7 @@ export class RouteParamsFactory implements IRouteParamsFactory {
|
||||
case RouteParamtypes.QUERY:
|
||||
return data ? req.query[data] : req.query;
|
||||
case RouteParamtypes.HEADERS:
|
||||
return data ? req.headers[data] : req.headers;
|
||||
return data ? req.headers[data.toLowerCase()] : req.headers;
|
||||
case RouteParamtypes.SESSION:
|
||||
return req.session;
|
||||
case RouteParamtypes.FILE:
|
||||
|
||||
@@ -54,9 +54,11 @@ With official support, you can get expert help straight from Nest core team. We
|
||||
|
||||
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support).
|
||||
|
||||
#### Principal Sponsor
|
||||
|
||||
<a href="https://valor-software.com/" target="_blank"><img src="https://docs.nestjs.com/assets/sponsors/valor-software.png" width="220" /></a>
|
||||
#### Principal Sponsors
|
||||
<table style="text-align:center;"><tr><td>
|
||||
<a href="https://github.com/Sanofi-IADC" target="_blank"><img src="https://docs.nestjs.com/assets/sponsors/sanofi.png" width="180" valign="middle" /></a></td><td>
|
||||
<a href="https://valor-software.com/" target="_blank"><img src="https://docs.nestjs.com/assets/sponsors/valor-software.png" width="180" valign="middle" /></a></td>
|
||||
</tr></table>
|
||||
|
||||
#### Silver Sponsors
|
||||
|
||||
@@ -84,7 +86,11 @@ Nest is an MIT-licensed open source project. It can grow thanks to the sponsors
|
||||
<a href="https://www.codeguesser.co.uk" target="_blank"><img src="https://nestjs.com/img/codeguesser-logo.svg" width="120" valign="middle" /></a> </td><td align="center" valign="middle">
|
||||
<a href="https://tekhattan.com" target="_blank"><img src="https://nestjs.com/img/tekhattan-logo.png" width="110" valign="middle" /></a> </td><td align="center" valign="middle">
|
||||
<a href="https://f-a.nz/" target="_blank"><img src="https://nestjs.com/img/franz.svg" width="80" valign="middle" /></a> </td><td align="center" valign="middle">
|
||||
<a href="https://sparkfabrik.com/" target="_blank"><img src="https://nestjs.com/img/sparkfabrik-logo.png" width="120" valign="middle" /></a></td><td align="center" valign="middle"><a href="https://www.thebigphonestore.co.uk/" target="_blank"><img src="https://nestjs.com/img/the-big-phone-store-logo.png" width="65" valign="middle" /></a></td></tr></table>
|
||||
<a href="https://sparkfabrik.com/" target="_blank"><img src="https://nestjs.com/img/sparkfabrik-logo.png" width="120" valign="middle" /></a></td><td align="center" valign="middle"><a href="https://www.thebigphonestore.co.uk/" target="_blank"><img src="https://nestjs.com/img/the-big-phone-store-logo.png" width="65" valign="middle" /></a></td>
|
||||
<td align="center" valign="middle">
|
||||
<a href="https://genuinebee.com/" target="_blank"><img src="https://nestjs.com/img/genuinebee.svg" width="97" valign="middle" /></a> </td></tr>
|
||||
<tr><td align="center" valign="middle"><a href="https://sanyodigital.com/" target="_blank"><img src="https://nestjs.com/img/sanyo-digital.png" width="130" valign="middle" /></a></td><td align="center" valign="middle"><a href="https://vpn-review.com/vpn-for-torrenting" target="_blank"><img src="https://nestjs.com/img/vpn-review-logo.png" width="85" valign="middle" /></a></td>
|
||||
</tr></table>
|
||||
|
||||
## Backers
|
||||
|
||||
|
||||
@@ -43,13 +43,13 @@ export class ClientKafka extends ClientProxy {
|
||||
protected client: Kafka = null;
|
||||
protected consumer: Consumer = null;
|
||||
protected producer: Producer = null;
|
||||
protected readonly logger = new Logger(ClientKafka.name);
|
||||
protected readonly responsePatterns: string[] = [];
|
||||
protected logger = new Logger(ClientKafka.name);
|
||||
protected responsePatterns: string[] = [];
|
||||
protected consumerAssignments: { [key: string]: number[] } = {};
|
||||
|
||||
private readonly brokers: string[];
|
||||
private readonly clientId: string;
|
||||
private readonly groupId: string;
|
||||
protected brokers: string[];
|
||||
protected clientId: string;
|
||||
protected groupId: string;
|
||||
|
||||
constructor(protected readonly options: KafkaOptions['options']) {
|
||||
super();
|
||||
|
||||
@@ -31,6 +31,7 @@ export class ClientRMQ extends ClientProxy {
|
||||
protected queue: string;
|
||||
protected queueOptions: any;
|
||||
protected responseEmitter: EventEmitter;
|
||||
protected replyQueue: string;
|
||||
|
||||
constructor(protected readonly options: RmqOptions['options']) {
|
||||
super();
|
||||
@@ -40,7 +41,8 @@ export class ClientRMQ extends ClientProxy {
|
||||
this.queueOptions =
|
||||
this.getOptionsProp(this.options, 'queueOptions') ||
|
||||
RQM_DEFAULT_QUEUE_OPTIONS;
|
||||
|
||||
this.replyQueue =
|
||||
this.getOptionsProp(this.options, 'replyQueue') || REPLY_QUEUE;
|
||||
loadPackage('amqplib', ClientRMQ.name, () => require('amqplib'));
|
||||
rqmPackage = loadPackage('amqp-connection-manager', ClientRMQ.name, () =>
|
||||
require('amqp-connection-manager'),
|
||||
@@ -61,7 +63,7 @@ export class ClientRMQ extends ClientProxy {
|
||||
const noAck = this.getOptionsProp(this.options, 'noAck', RQM_DEFAULT_NOACK);
|
||||
this.channel.addSetup((channel: any) =>
|
||||
channel.consume(
|
||||
REPLY_QUEUE,
|
||||
this.replyQueue,
|
||||
(msg: any) =>
|
||||
this.responseEmitter.emit(msg.properties.correlationId, msg),
|
||||
{
|
||||
@@ -183,7 +185,7 @@ export class ClientRMQ extends ClientProxy {
|
||||
this.queue,
|
||||
Buffer.from(JSON.stringify(serializedPacket)),
|
||||
{
|
||||
replyTo: REPLY_QUEUE,
|
||||
replyTo: this.replyQueue,
|
||||
correlationId,
|
||||
},
|
||||
);
|
||||
|
||||
@@ -3,7 +3,7 @@ import { RuntimeException } from '@nestjs/core/errors/exceptions/runtime.excepti
|
||||
export class InvalidKafkaClientTopicPartitionException extends RuntimeException {
|
||||
constructor(topic?: string) {
|
||||
super(
|
||||
`The client consumer subscribed to the topic (${topic}) whcih is not assigned to any partitions.`,
|
||||
`The client consumer subscribed to the topic (${topic}) which is not assigned to any partitions.`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,6 +128,7 @@ export interface RmqOptions {
|
||||
noAck?: boolean;
|
||||
serializer?: Serializer;
|
||||
deserializer?: Deserializer;
|
||||
replyQueue?: string;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
import { DynamicModule, Module } from '@nestjs/common';
|
||||
import { DynamicModule, Module, Provider } from '@nestjs/common';
|
||||
import { ClientProxyFactory } from '../client';
|
||||
import { ClientsModuleOptions } from './interfaces/clients-module.interface';
|
||||
import {
|
||||
ClientsModuleAsyncOptions,
|
||||
ClientsModuleOptions,
|
||||
ClientsModuleOptionsFactory,
|
||||
ClientsProviderAsyncOptions,
|
||||
} from './interfaces';
|
||||
|
||||
@Module({})
|
||||
export class ClientsModule {
|
||||
@@ -15,4 +20,71 @@ export class ClientsModule {
|
||||
exports: clients,
|
||||
};
|
||||
}
|
||||
|
||||
static registerAsync(options: ClientsModuleAsyncOptions): DynamicModule {
|
||||
const providers: Provider[] = options.reduce(
|
||||
(accProviders: Provider[], item) =>
|
||||
accProviders
|
||||
.concat(this.createAsyncProviders(item))
|
||||
.concat(item.extraProviders || []),
|
||||
[],
|
||||
);
|
||||
const imports = options.reduce(
|
||||
(accImports, option) =>
|
||||
option.imports && !accImports.includes(option.imports)
|
||||
? accImports.concat(option.imports)
|
||||
: accImports,
|
||||
[],
|
||||
);
|
||||
return {
|
||||
module: ClientsModule,
|
||||
imports,
|
||||
providers: providers,
|
||||
exports: providers,
|
||||
};
|
||||
}
|
||||
|
||||
private static createAsyncProviders(
|
||||
options: ClientsProviderAsyncOptions,
|
||||
): Provider[] {
|
||||
if (options.useExisting || options.useFactory) {
|
||||
return [this.createAsyncOptionsProvider(options)];
|
||||
}
|
||||
return [
|
||||
this.createAsyncOptionsProvider(options),
|
||||
{
|
||||
provide: options.useClass,
|
||||
useClass: options.useClass,
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
private static createAsyncOptionsProvider(
|
||||
options: ClientsProviderAsyncOptions,
|
||||
): Provider {
|
||||
if (options.useFactory) {
|
||||
return {
|
||||
provide: options.name,
|
||||
useFactory: this.createFactoryWrapper(options.useFactory),
|
||||
inject: options.inject || [],
|
||||
};
|
||||
}
|
||||
return {
|
||||
provide: options.name,
|
||||
useFactory: this.createFactoryWrapper(
|
||||
(optionsFactory: ClientsModuleOptionsFactory) =>
|
||||
optionsFactory.createClientOptions(),
|
||||
),
|
||||
inject: [options.useExisting || options.useClass],
|
||||
};
|
||||
}
|
||||
|
||||
private static createFactoryWrapper(
|
||||
useFactory: ClientsProviderAsyncOptions['useFactory'],
|
||||
) {
|
||||
return async (...args: any[]) => {
|
||||
const clientOptions = await useFactory(...args);
|
||||
return ClientProxyFactory.create(clientOptions);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
export * from './clients.module';
|
||||
export * from './interfaces';
|
||||
|
||||
@@ -1,7 +1,24 @@
|
||||
import { ClientOptions } from '../../interfaces';
|
||||
import { Type, Provider, ModuleMetadata } from '@nestjs/common/interfaces';
|
||||
|
||||
export type ClientProviderOptions = ClientOptions & {
|
||||
name: string;
|
||||
name: string | symbol;
|
||||
};
|
||||
|
||||
export type ClientsModuleOptions = Array<ClientProviderOptions>;
|
||||
|
||||
export interface ClientsModuleOptionsFactory {
|
||||
createClientOptions(): Promise<ClientOptions> | ClientOptions;
|
||||
}
|
||||
|
||||
export interface ClientsProviderAsyncOptions
|
||||
extends Pick<ModuleMetadata, 'imports'> {
|
||||
useExisting?: Type<ClientsModuleOptionsFactory>;
|
||||
useClass?: Type<ClientsModuleOptionsFactory>;
|
||||
useFactory?: (...args: any[]) => Promise<ClientOptions> | ClientOptions;
|
||||
inject?: any[];
|
||||
extraProviders?: Provider[];
|
||||
name: string | symbol;
|
||||
}
|
||||
|
||||
export type ClientsModuleAsyncOptions = Array<ClientsProviderAsyncOptions>;
|
||||
|
||||
1
packages/microservices/module/interfaces/index.ts
Normal file
1
packages/microservices/module/interfaces/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from './clients-module.interface';
|
||||
@@ -115,14 +115,14 @@ export class NestMicroservice extends NestApplicationContext
|
||||
}
|
||||
|
||||
public listen(callback: () => void) {
|
||||
!this.isInitialized && this.registerModules();
|
||||
|
||||
this.logger.log(MESSAGES.MICROSERVICE_READY);
|
||||
this.server.listen(callback);
|
||||
this.listenAsync().then(callback);
|
||||
}
|
||||
|
||||
public async listenAsync(): Promise<any> {
|
||||
return new Promise(resolve => this.listen(resolve));
|
||||
!this.isInitialized && (await this.registerModules());
|
||||
|
||||
this.logger.log(MESSAGES.MICROSERVICE_READY);
|
||||
return new Promise(resolve => this.server.listen(resolve));
|
||||
}
|
||||
|
||||
public async close(): Promise<any> {
|
||||
@@ -151,4 +151,12 @@ export class NestMicroservice extends NestApplicationContext
|
||||
await super.close();
|
||||
this.setIsTerminated(true);
|
||||
}
|
||||
|
||||
protected async dispose(): Promise<void> {
|
||||
await this.server.close();
|
||||
if (this.isTerminated) {
|
||||
return;
|
||||
}
|
||||
this.socketModule && (await this.socketModule.close());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nestjs/microservices",
|
||||
"version": "7.2.0",
|
||||
"version": "7.4.4",
|
||||
"description": "Nest - modern, fast, powerful node.js web framework (@microservices)",
|
||||
"author": "Kamil Mysliwiec",
|
||||
"license": "MIT",
|
||||
@@ -19,11 +19,11 @@
|
||||
"dependencies": {
|
||||
"iterare": "1.2.1",
|
||||
"json-socket": "0.3.0",
|
||||
"tslib": "2.0.0"
|
||||
"tslib": "2.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@nestjs/common": "7.2.0",
|
||||
"@nestjs/core": "7.2.0"
|
||||
"@nestjs/common": "7.4.4",
|
||||
"@nestjs/core": "7.4.4"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@nestjs/common": "^7.0.0",
|
||||
|
||||
@@ -33,13 +33,14 @@ let kafkaPackage: any = {};
|
||||
export class ServerKafka extends Server implements CustomTransportStrategy {
|
||||
public readonly transportId = Transport.KAFKA;
|
||||
|
||||
protected readonly logger = new Logger(ServerKafka.name);
|
||||
protected logger = new Logger(ServerKafka.name);
|
||||
protected client: Kafka = null;
|
||||
protected consumer: Consumer = null;
|
||||
protected producer: Producer = null;
|
||||
private readonly brokers: string[];
|
||||
private readonly clientId: string;
|
||||
private readonly groupId: string;
|
||||
|
||||
protected brokers: string[];
|
||||
protected clientId: string;
|
||||
protected groupId: string;
|
||||
|
||||
constructor(private readonly options: KafkaOptions['options']) {
|
||||
super();
|
||||
|
||||
@@ -1,27 +1,118 @@
|
||||
import { DynamicModule } from '@nestjs/common';
|
||||
import { DynamicModule, FactoryProvider, Injectable } from '@nestjs/common';
|
||||
import { expect } from 'chai';
|
||||
import * as sinon from 'sinon';
|
||||
import { ClientProxyFactory } from '../../client';
|
||||
import { ClientsModule } from '../../module';
|
||||
import { ClientsModule, ClientsModuleOptionsFactory } from '../../module';
|
||||
import { ClientOptions } from '../../interfaces';
|
||||
import { Transport } from '../../enums';
|
||||
|
||||
describe('ClientsModule', () => {
|
||||
let dynamicModule: DynamicModule;
|
||||
beforeEach(() => {
|
||||
dynamicModule = ClientsModule.register([
|
||||
{
|
||||
name: 'test',
|
||||
options: {},
|
||||
},
|
||||
]);
|
||||
describe('register', () => {
|
||||
beforeEach(() => {
|
||||
dynamicModule = ClientsModule.register([
|
||||
{
|
||||
name: 'test',
|
||||
options: {},
|
||||
},
|
||||
]);
|
||||
});
|
||||
it('should return an expected module ref', () => {
|
||||
expect(dynamicModule.module).to.be.eql(ClientsModule);
|
||||
});
|
||||
it('should return an expected providers array', () => {
|
||||
expect(dynamicModule.providers).to.be.deep.eq([
|
||||
{
|
||||
provide: 'test',
|
||||
useValue: ClientProxyFactory.create({}),
|
||||
},
|
||||
]);
|
||||
});
|
||||
});
|
||||
it('should return an expected module ref', () => {
|
||||
expect(dynamicModule.module).to.be.eql(ClientsModule);
|
||||
});
|
||||
it('should return an expected providers array', () => {
|
||||
expect(dynamicModule.providers).to.be.deep.eq([
|
||||
{
|
||||
provide: 'test',
|
||||
useValue: ClientProxyFactory.create({}),
|
||||
},
|
||||
]);
|
||||
describe('registerAsync', () => {
|
||||
const useFactory = () => ({
|
||||
options: {},
|
||||
});
|
||||
const registerOption = {
|
||||
name: 'test',
|
||||
useFactory,
|
||||
};
|
||||
|
||||
it('should return an expected module ref', () => {
|
||||
dynamicModule = ClientsModule.registerAsync([registerOption]);
|
||||
expect(dynamicModule.module).to.be.eql(ClientsModule);
|
||||
});
|
||||
|
||||
describe('when useFactory', () => {
|
||||
it('should return an expected providers array with useFactory', () => {
|
||||
dynamicModule = ClientsModule.registerAsync([registerOption]);
|
||||
expect(dynamicModule.imports).to.be.deep.eq([]);
|
||||
expect(dynamicModule.exports).to.be.eq(dynamicModule.providers);
|
||||
expect(dynamicModule.providers).to.be.have.length(1);
|
||||
|
||||
const provider = dynamicModule.providers[0] as FactoryProvider;
|
||||
expect(provider.provide).to.be.eql('test');
|
||||
expect(provider.inject).to.be.deep.eq([]);
|
||||
expect(provider.useFactory).to.be.an.instanceOf(Function);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when useClass', () => {
|
||||
it('should return an expected providers array with useClass', () => {
|
||||
@Injectable()
|
||||
class ClientOptionService implements ClientsModuleOptionsFactory {
|
||||
createClientOptions(): Promise<ClientOptions> | ClientOptions {
|
||||
return {
|
||||
transport: Transport.TCP,
|
||||
options: {},
|
||||
};
|
||||
}
|
||||
}
|
||||
const useClassOption = {
|
||||
name: 'classTest',
|
||||
useClass: ClientOptionService,
|
||||
};
|
||||
dynamicModule = ClientsModule.registerAsync([useClassOption]);
|
||||
expect(dynamicModule.imports).to.be.deep.eq([]);
|
||||
expect(dynamicModule.providers).to.be.have.length(2);
|
||||
|
||||
const classTestProvider = dynamicModule.providers[0] as FactoryProvider;
|
||||
expect(classTestProvider.provide).to.be.eql('classTest');
|
||||
expect(classTestProvider.inject).to.be.deep.eq([ClientOptionService]);
|
||||
expect(classTestProvider.useFactory).to.be.an.instanceOf(Function);
|
||||
});
|
||||
it('provider should call "createClientOptions"', async () => {
|
||||
const asyncOptions = {
|
||||
useClass: Object,
|
||||
};
|
||||
const dynamicModule = ClientsModule.registerAsync([
|
||||
asyncOptions as any,
|
||||
]);
|
||||
const optionsFactory = {
|
||||
createClientOptions: sinon.spy(),
|
||||
};
|
||||
try {
|
||||
await ((dynamicModule.providers[0] as any).useFactory as any)(
|
||||
optionsFactory,
|
||||
);
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
expect(optionsFactory.createClientOptions.called).to.be.true;
|
||||
});
|
||||
});
|
||||
|
||||
describe('when useExisting', () => {
|
||||
it('should provide an options', () => {
|
||||
const asyncOptions = {
|
||||
useExisting: Object,
|
||||
};
|
||||
dynamicModule = ClientsModule.registerAsync([asyncOptions as any]);
|
||||
expect(dynamicModule.providers).to.have.length(1);
|
||||
expect(dynamicModule.imports).to.be.deep.eq([]);
|
||||
const classTestProvider = dynamicModule.providers[0] as FactoryProvider;
|
||||
expect(classTestProvider.useFactory).to.be.an.instanceOf(Function);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -54,9 +54,11 @@ With official support, you can get expert help straight from Nest core team. We
|
||||
|
||||
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support).
|
||||
|
||||
#### Principal Sponsor
|
||||
|
||||
<a href="https://valor-software.com/" target="_blank"><img src="https://docs.nestjs.com/assets/sponsors/valor-software.png" width="220" /></a>
|
||||
#### Principal Sponsors
|
||||
<table style="text-align:center;"><tr><td>
|
||||
<a href="https://github.com/Sanofi-IADC" target="_blank"><img src="https://docs.nestjs.com/assets/sponsors/sanofi.png" width="180" valign="middle" /></a></td><td>
|
||||
<a href="https://valor-software.com/" target="_blank"><img src="https://docs.nestjs.com/assets/sponsors/valor-software.png" width="180" valign="middle" /></a></td>
|
||||
</tr></table>
|
||||
|
||||
#### Silver Sponsors
|
||||
|
||||
@@ -84,7 +86,11 @@ Nest is an MIT-licensed open source project. It can grow thanks to the sponsors
|
||||
<a href="https://www.codeguesser.co.uk" target="_blank"><img src="https://nestjs.com/img/codeguesser-logo.svg" width="120" valign="middle" /></a> </td><td align="center" valign="middle">
|
||||
<a href="https://tekhattan.com" target="_blank"><img src="https://nestjs.com/img/tekhattan-logo.png" width="110" valign="middle" /></a> </td><td align="center" valign="middle">
|
||||
<a href="https://f-a.nz/" target="_blank"><img src="https://nestjs.com/img/franz.svg" width="80" valign="middle" /></a> </td><td align="center" valign="middle">
|
||||
<a href="https://sparkfabrik.com/" target="_blank"><img src="https://nestjs.com/img/sparkfabrik-logo.png" width="120" valign="middle" /></a></td><td align="center" valign="middle"><a href="https://www.thebigphonestore.co.uk/" target="_blank"><img src="https://nestjs.com/img/the-big-phone-store-logo.png" width="65" valign="middle" /></a></td></tr></table>
|
||||
<a href="https://sparkfabrik.com/" target="_blank"><img src="https://nestjs.com/img/sparkfabrik-logo.png" width="120" valign="middle" /></a></td><td align="center" valign="middle"><a href="https://www.thebigphonestore.co.uk/" target="_blank"><img src="https://nestjs.com/img/the-big-phone-store-logo.png" width="65" valign="middle" /></a></td>
|
||||
<td align="center" valign="middle">
|
||||
<a href="https://genuinebee.com/" target="_blank"><img src="https://nestjs.com/img/genuinebee.svg" width="97" valign="middle" /></a> </td></tr>
|
||||
<tr><td align="center" valign="middle"><a href="https://sanyodigital.com/" target="_blank"><img src="https://nestjs.com/img/sanyo-digital.png" width="130" valign="middle" /></a></td><td align="center" valign="middle"><a href="https://vpn-review.com/vpn-for-torrenting" target="_blank"><img src="https://nestjs.com/img/vpn-review-logo.png" width="85" valign="middle" /></a></td>
|
||||
</tr></table>
|
||||
|
||||
## Backers
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nestjs/platform-express",
|
||||
"version": "7.2.0",
|
||||
"version": "7.4.4",
|
||||
"description": "Nest - modern, fast, powerful node.js web framework (@platform-express)",
|
||||
"author": "Kamil Mysliwiec",
|
||||
"license": "MIT",
|
||||
@@ -21,11 +21,11 @@
|
||||
"cors": "2.8.5",
|
||||
"express": "4.17.1",
|
||||
"multer": "1.4.2",
|
||||
"tslib": "2.0.0"
|
||||
"tslib": "2.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@nestjs/common": "7.2.0",
|
||||
"@nestjs/core": "7.2.0"
|
||||
"@nestjs/common": "7.4.4",
|
||||
"@nestjs/core": "7.4.4"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@nestjs/common": "^7.0.0",
|
||||
|
||||
@@ -54,9 +54,11 @@ With official support, you can get expert help straight from Nest core team. We
|
||||
|
||||
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support).
|
||||
|
||||
#### Principal Sponsor
|
||||
|
||||
<a href="https://valor-software.com/" target="_blank"><img src="https://docs.nestjs.com/assets/sponsors/valor-software.png" width="220" /></a>
|
||||
#### Principal Sponsors
|
||||
<table style="text-align:center;"><tr><td>
|
||||
<a href="https://github.com/Sanofi-IADC" target="_blank"><img src="https://docs.nestjs.com/assets/sponsors/sanofi.png" width="180" valign="middle" /></a></td><td>
|
||||
<a href="https://valor-software.com/" target="_blank"><img src="https://docs.nestjs.com/assets/sponsors/valor-software.png" width="180" valign="middle" /></a></td>
|
||||
</tr></table>
|
||||
|
||||
#### Silver Sponsors
|
||||
|
||||
@@ -84,7 +86,11 @@ Nest is an MIT-licensed open source project. It can grow thanks to the sponsors
|
||||
<a href="https://www.codeguesser.co.uk" target="_blank"><img src="https://nestjs.com/img/codeguesser-logo.svg" width="120" valign="middle" /></a> </td><td align="center" valign="middle">
|
||||
<a href="https://tekhattan.com" target="_blank"><img src="https://nestjs.com/img/tekhattan-logo.png" width="110" valign="middle" /></a> </td><td align="center" valign="middle">
|
||||
<a href="https://f-a.nz/" target="_blank"><img src="https://nestjs.com/img/franz.svg" width="80" valign="middle" /></a> </td><td align="center" valign="middle">
|
||||
<a href="https://sparkfabrik.com/" target="_blank"><img src="https://nestjs.com/img/sparkfabrik-logo.png" width="120" valign="middle" /></a></td><td align="center" valign="middle"><a href="https://www.thebigphonestore.co.uk/" target="_blank"><img src="https://nestjs.com/img/the-big-phone-store-logo.png" width="65" valign="middle" /></a></td></tr></table>
|
||||
<a href="https://sparkfabrik.com/" target="_blank"><img src="https://nestjs.com/img/sparkfabrik-logo.png" width="120" valign="middle" /></a></td><td align="center" valign="middle"><a href="https://www.thebigphonestore.co.uk/" target="_blank"><img src="https://nestjs.com/img/the-big-phone-store-logo.png" width="65" valign="middle" /></a></td>
|
||||
<td align="center" valign="middle">
|
||||
<a href="https://genuinebee.com/" target="_blank"><img src="https://nestjs.com/img/genuinebee.svg" width="97" valign="middle" /></a> </td></tr>
|
||||
<tr><td align="center" valign="middle"><a href="https://sanyodigital.com/" target="_blank"><img src="https://nestjs.com/img/sanyo-digital.png" width="130" valign="middle" /></a></td><td align="center" valign="middle"><a href="https://vpn-review.com/vpn-for-torrenting" target="_blank"><img src="https://nestjs.com/img/vpn-review-logo.png" width="85" valign="middle" /></a></td>
|
||||
</tr></table>
|
||||
|
||||
## Backers
|
||||
|
||||
|
||||
@@ -1,163 +1,265 @@
|
||||
import { HttpStatus, RequestMethod } from '@nestjs/common';
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
import { HttpStatus, Logger, RequestMethod } from '@nestjs/common';
|
||||
import { CorsOptions } from '@nestjs/common/interfaces/external/cors-options.interface';
|
||||
import { NestApplicationOptions } from '@nestjs/common/interfaces/nest-application-options.interface';
|
||||
import { loadPackage } from '@nestjs/common/utils/load-package.util';
|
||||
import { AbstractHttpAdapter } from '@nestjs/core/adapters/http-adapter';
|
||||
import * as fastify from 'fastify';
|
||||
import * as cors from 'fastify-cors';
|
||||
import * as formBody from 'fastify-formbody';
|
||||
import {
|
||||
fastify,
|
||||
FastifyInstance,
|
||||
FastifyLoggerInstance,
|
||||
FastifyPlugin,
|
||||
FastifyPluginOptions,
|
||||
FastifyRegisterOptions,
|
||||
FastifyReply,
|
||||
FastifyRequest,
|
||||
FastifyServerOptions,
|
||||
RawReplyDefaultExpression,
|
||||
RawRequestDefaultExpression,
|
||||
RawServerBase,
|
||||
RawServerDefault,
|
||||
RequestGenericInterface,
|
||||
} from 'fastify';
|
||||
import * as Reply from 'fastify/lib/reply';
|
||||
import * as http2 from 'http2';
|
||||
import * as https from 'https';
|
||||
import { InjectOptions } from 'light-my-request';
|
||||
import * as pathToRegexp from 'path-to-regexp';
|
||||
import {
|
||||
FastifyStaticOptions,
|
||||
PointOfViewOptions,
|
||||
} from '../interfaces/external';
|
||||
|
||||
type FastifyHttp2SecureOptions<
|
||||
Server extends http2.Http2SecureServer,
|
||||
Logger extends FastifyLoggerInstance = FastifyLoggerInstance
|
||||
> = FastifyServerOptions<Server, Logger> & {
|
||||
http2: true;
|
||||
https: http2.SecureServerOptions;
|
||||
};
|
||||
|
||||
type FastifyHttp2Options<
|
||||
Server extends http2.Http2Server,
|
||||
Logger extends FastifyLoggerInstance = FastifyLoggerInstance
|
||||
> = FastifyServerOptions<Server, Logger> & {
|
||||
http2: true;
|
||||
http2SessionTimeout?: number;
|
||||
};
|
||||
|
||||
type FastifyHttpsOptions<
|
||||
Server extends https.Server,
|
||||
Logger extends FastifyLoggerInstance = FastifyLoggerInstance
|
||||
> = FastifyServerOptions<Server, Logger> & {
|
||||
https: https.ServerOptions;
|
||||
};
|
||||
|
||||
export class FastifyAdapter<
|
||||
TServer extends RawServerBase = RawServerDefault,
|
||||
TRawRequest extends RawRequestDefaultExpression<
|
||||
TServer
|
||||
> = RawRequestDefaultExpression<TServer>,
|
||||
TRawResponse extends RawReplyDefaultExpression<
|
||||
TServer
|
||||
> = RawReplyDefaultExpression<TServer>
|
||||
> extends AbstractHttpAdapter<
|
||||
TServer,
|
||||
FastifyRequest<RequestGenericInterface, TServer, TRawRequest>,
|
||||
FastifyReply<TServer, TRawRequest, TRawResponse>
|
||||
> {
|
||||
protected readonly instance: FastifyInstance<
|
||||
TServer,
|
||||
TRawRequest,
|
||||
TRawResponse
|
||||
>;
|
||||
private isMiddieRegistered: boolean;
|
||||
|
||||
export class FastifyAdapter<TInstance = any> extends AbstractHttpAdapter {
|
||||
constructor(
|
||||
instanceOrOptions:
|
||||
| TInstance
|
||||
| fastify.ServerOptions
|
||||
| fastify.ServerOptionsAsHttp
|
||||
| fastify.ServerOptionsAsHttp2
|
||||
| fastify.ServerOptionsAsSecure
|
||||
| fastify.ServerOptionsAsSecureHttp
|
||||
| fastify.ServerOptionsAsSecureHttp2 = fastify() as any,
|
||||
| FastifyInstance<TServer>
|
||||
| FastifyHttp2Options<TServer>
|
||||
| FastifyHttp2SecureOptions<any>
|
||||
| FastifyHttpsOptions<any>
|
||||
| FastifyServerOptions<TServer> = fastify() as any,
|
||||
) {
|
||||
const instance =
|
||||
instanceOrOptions &&
|
||||
(instanceOrOptions as fastify.FastifyInstance<any, any, any>).server
|
||||
(instanceOrOptions as FastifyInstance<TServer>).server
|
||||
? instanceOrOptions
|
||||
: fastify((instanceOrOptions as any) as fastify.ServerOptions);
|
||||
: fastify(instanceOrOptions as FastifyServerOptions);
|
||||
|
||||
super(instance);
|
||||
}
|
||||
|
||||
public listen(port: string | number, callback?: () => void);
|
||||
public listen(port: string | number, hostname: string, callback?: () => void);
|
||||
public listen(port: any, ...args: any[]) {
|
||||
public async init() {
|
||||
if (this.isMiddieRegistered) {
|
||||
return;
|
||||
}
|
||||
await this.registerMiddie();
|
||||
}
|
||||
|
||||
public listen(port: string | number, callback?: () => void): void;
|
||||
public listen(
|
||||
port: string | number,
|
||||
hostname: string,
|
||||
callback?: () => void,
|
||||
): void;
|
||||
public listen(port: string | number, ...args: any[]): Promise<string> {
|
||||
if (typeof port === 'string') {
|
||||
port = parseInt(port);
|
||||
}
|
||||
return this.instance.listen(port, ...args);
|
||||
}
|
||||
|
||||
public reply(response: any, body: any, statusCode?: number) {
|
||||
const isNativeResponse = typeof response.status !== 'function';
|
||||
if (isNativeResponse) {
|
||||
const fastifyContext = {
|
||||
preSerialization: null,
|
||||
preValidation: [],
|
||||
preHandler: [],
|
||||
onSend: [],
|
||||
onError: [],
|
||||
};
|
||||
response = new Reply(response, fastifyContext, {});
|
||||
}
|
||||
public reply(
|
||||
response: TRawResponse | FastifyReply,
|
||||
body: any,
|
||||
statusCode?: number,
|
||||
) {
|
||||
const fastifyReply: FastifyReply = this.isNativeResponse(response)
|
||||
? new Reply(
|
||||
response,
|
||||
{
|
||||
context: {
|
||||
preSerialization: null,
|
||||
preValidation: [],
|
||||
preHandler: [],
|
||||
onSend: [],
|
||||
onError: [],
|
||||
},
|
||||
},
|
||||
{},
|
||||
)
|
||||
: response;
|
||||
|
||||
if (statusCode) {
|
||||
response.status(statusCode);
|
||||
fastifyReply.status(statusCode);
|
||||
}
|
||||
return response.send(body);
|
||||
return fastifyReply.send(body);
|
||||
}
|
||||
|
||||
public status(response: any, statusCode: number) {
|
||||
const isNativeResponse = typeof response.code !== 'function';
|
||||
if (isNativeResponse) {
|
||||
public status(response: TRawResponse | FastifyReply, statusCode: number) {
|
||||
if (this.isNativeResponse(response)) {
|
||||
response.statusCode = statusCode;
|
||||
return response;
|
||||
}
|
||||
return response.code(statusCode);
|
||||
}
|
||||
|
||||
public render(response: any, view: string, options: any) {
|
||||
return response.view(view, options);
|
||||
public render(
|
||||
response: FastifyReply & { view: Function },
|
||||
view: string,
|
||||
options: any,
|
||||
) {
|
||||
return response && response.view(view, options);
|
||||
}
|
||||
|
||||
public redirect(response: any, statusCode: number, url: string) {
|
||||
const code = statusCode ? statusCode : HttpStatus.FOUND;
|
||||
public redirect(response: FastifyReply, statusCode: number, url: string) {
|
||||
const code = statusCode ?? HttpStatus.FOUND;
|
||||
return response.status(code).redirect(url);
|
||||
}
|
||||
|
||||
public setErrorHandler(
|
||||
handler: Parameters<fastify.FastifyInstance['setErrorHandler']>[0],
|
||||
prefix?: string,
|
||||
handler: Parameters<
|
||||
FastifyInstance<TServer, TRawRequest, TRawResponse>['setErrorHandler']
|
||||
>[0],
|
||||
) {
|
||||
return this.instance.setErrorHandler(handler);
|
||||
}
|
||||
|
||||
public setNotFoundHandler(
|
||||
handler: Parameters<fastify.FastifyInstance['setNotFoundHandler']>[0],
|
||||
prefix?: string,
|
||||
handler: Parameters<
|
||||
FastifyInstance<TServer, TRawRequest, TRawResponse>['setNotFoundHandler']
|
||||
>[0],
|
||||
) {
|
||||
return this.instance.setNotFoundHandler(handler);
|
||||
}
|
||||
|
||||
public getHttpServer<TServer = any>(): TServer {
|
||||
return this.instance.server as TServer;
|
||||
public getHttpServer<T = TServer>(): T {
|
||||
return (this.instance.server as unknown) as T;
|
||||
}
|
||||
|
||||
public getInstance<TServer = any>(): TServer {
|
||||
return this.instance as TServer;
|
||||
public getInstance<
|
||||
T = FastifyInstance<TServer, TRawRequest, TRawResponse>
|
||||
>(): T {
|
||||
return (this.instance as unknown) as T;
|
||||
}
|
||||
|
||||
public register(...args: any[]) {
|
||||
return this.instance.register(...args);
|
||||
public register<Options extends FastifyPluginOptions>(
|
||||
plugin: FastifyPlugin<Options>,
|
||||
opts?: FastifyRegisterOptions<Options>,
|
||||
) {
|
||||
return this.instance.register(plugin, opts);
|
||||
}
|
||||
|
||||
public inject(...args: any[]) {
|
||||
return this.instance.inject(...args);
|
||||
public async inject(opts: InjectOptions | string) {
|
||||
return await this.instance.inject(opts);
|
||||
}
|
||||
|
||||
public close() {
|
||||
return this.instance.close();
|
||||
public async close() {
|
||||
try {
|
||||
return await this.instance.close();
|
||||
} catch (err) {
|
||||
// Check if server is still running
|
||||
if (err.code !== 'ERR_SERVER_NOT_RUNNING') {
|
||||
throw err;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public initHttpServer(options: NestApplicationOptions) {
|
||||
public initHttpServer() {
|
||||
this.httpServer = this.instance.server;
|
||||
}
|
||||
|
||||
public useStaticAssets(options: {
|
||||
root: string;
|
||||
prefix?: string;
|
||||
setHeaders?: Function;
|
||||
send?: any;
|
||||
}) {
|
||||
public useStaticAssets(options: FastifyStaticOptions) {
|
||||
return this.register(
|
||||
loadPackage('fastify-static', 'FastifyAdapter.useStaticAssets()', () =>
|
||||
require('fastify-static'),
|
||||
),
|
||||
loadPackage('fastify-static', 'FastifyAdapter.useStaticAssets()'),
|
||||
options,
|
||||
);
|
||||
}
|
||||
|
||||
public setViewEngine(options: any) {
|
||||
public setViewEngine(options: PointOfViewOptions | string) {
|
||||
if (typeof options === 'string') {
|
||||
new Logger('FastifyAdapter').error(
|
||||
"setViewEngine() doesn't support a string argument.",
|
||||
);
|
||||
process.exit(1);
|
||||
}
|
||||
return this.register(
|
||||
loadPackage('point-of-view', 'FastifyAdapter.setViewEngine()'),
|
||||
options,
|
||||
() => require('point-of-view'),
|
||||
);
|
||||
}
|
||||
|
||||
public setHeader(response: any, name: string, value: string) {
|
||||
public setHeader(response: FastifyReply, name: string, value: string) {
|
||||
return response.header(name, value);
|
||||
}
|
||||
|
||||
public getRequestHostname(request: any): string {
|
||||
public getRequestHostname(request: FastifyRequest): string {
|
||||
return request.hostname;
|
||||
}
|
||||
|
||||
public getRequestMethod(request: any): string {
|
||||
public getRequestMethod(request: FastifyRequest): string {
|
||||
return request.raw ? request.raw.method : request.method;
|
||||
}
|
||||
|
||||
public getRequestUrl(request: any): string {
|
||||
public getRequestUrl(request: FastifyRequest): string {
|
||||
return request.raw ? request.raw.url : request.url;
|
||||
}
|
||||
|
||||
public enableCors(options: CorsOptions) {
|
||||
this.register(cors, options);
|
||||
this.register(require('fastify-cors'), options);
|
||||
}
|
||||
|
||||
public registerParserMiddleware() {
|
||||
this.register(formBody);
|
||||
this.register(require('fastify-formbody'));
|
||||
}
|
||||
|
||||
public createMiddlewareFactory(
|
||||
public async createMiddlewareFactory(
|
||||
requestMethod: RequestMethod,
|
||||
): (path: string, callback: Function) => any {
|
||||
): Promise<(path: string, callback: Function) => any> {
|
||||
if (!this.isMiddieRegistered) {
|
||||
await this.registerMiddie();
|
||||
}
|
||||
return (path: string, callback: Function) => {
|
||||
const re = pathToRegexp(path);
|
||||
const normalizedPath = path === '/*' ? '' : path;
|
||||
@@ -190,10 +292,18 @@ export class FastifyAdapter<TInstance = any> extends AbstractHttpAdapter {
|
||||
return 'fastify';
|
||||
}
|
||||
|
||||
protected registerWithPrefix<T extends fastify.Plugin<any, any, any, any>>(
|
||||
factory: T,
|
||||
prefix = '/',
|
||||
): ReturnType<fastify.FastifyInstance['register']> {
|
||||
protected registerWithPrefix(factory: FastifyPlugin, prefix = '/') {
|
||||
return this.instance.register(factory, { prefix });
|
||||
}
|
||||
|
||||
private isNativeResponse(
|
||||
response: TRawResponse | FastifyReply,
|
||||
): response is TRawResponse {
|
||||
return !('status' in response);
|
||||
}
|
||||
|
||||
private async registerMiddie() {
|
||||
this.isMiddieRegistered = true;
|
||||
await this.register(require('middie'));
|
||||
}
|
||||
}
|
||||
|
||||
48
packages/platform-fastify/interfaces/external/fastify-static-options.interface.ts
vendored
Normal file
48
packages/platform-fastify/interfaces/external/fastify-static-options.interface.ts
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
/**
|
||||
* "fastify-static" interfaces
|
||||
* @see https://github.com/fastify/fastify-static/blob/master/index.d.ts
|
||||
*/
|
||||
|
||||
interface ListDir {
|
||||
href: string;
|
||||
name: string;
|
||||
}
|
||||
|
||||
interface ListFile {
|
||||
href: string;
|
||||
name: string;
|
||||
}
|
||||
|
||||
interface ListRender {
|
||||
(dirs: ListDir[], files: ListFile[]): string;
|
||||
}
|
||||
|
||||
interface ListOptions {
|
||||
format: 'json' | 'html';
|
||||
names: string[];
|
||||
render: ListRender;
|
||||
}
|
||||
|
||||
export interface FastifyStaticOptions {
|
||||
root: string;
|
||||
prefix?: string;
|
||||
prefixAvoidTrailingSlash?: boolean;
|
||||
serve?: boolean;
|
||||
decorateReply?: boolean;
|
||||
schemaHide?: boolean;
|
||||
setHeaders?: (...args: any[]) => void;
|
||||
redirect?: boolean;
|
||||
wildcard?: boolean | string;
|
||||
list?: boolean | ListOptions;
|
||||
|
||||
// Passed on to `send`
|
||||
acceptRanges?: boolean;
|
||||
cacheControl?: boolean;
|
||||
dotfiles?: boolean;
|
||||
etag?: boolean;
|
||||
extensions?: string[];
|
||||
immutable?: boolean;
|
||||
index?: string[];
|
||||
lastModified?: boolean;
|
||||
maxAge?: string | number;
|
||||
}
|
||||
2
packages/platform-fastify/interfaces/external/index.ts
vendored
Normal file
2
packages/platform-fastify/interfaces/external/index.ts
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export * from './fastify-static-options.interface';
|
||||
export * from './point-of-view-options.interface';
|
||||
26
packages/platform-fastify/interfaces/external/point-of-view-options.interface.ts
vendored
Normal file
26
packages/platform-fastify/interfaces/external/point-of-view-options.interface.ts
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* @see https://github.com/fastify/point-of-view/blob/master/index.d.ts
|
||||
*/
|
||||
|
||||
export interface PointOfViewOptions {
|
||||
engine: {
|
||||
ejs?: any;
|
||||
nunjucks?: any;
|
||||
pug?: any;
|
||||
handlebars?: any;
|
||||
marko?: any;
|
||||
mustache?: any;
|
||||
'art-template'?: any;
|
||||
twig?: any;
|
||||
};
|
||||
templates?: string;
|
||||
includeViewExtension?: boolean;
|
||||
options?: object;
|
||||
charset?: string;
|
||||
maxCache?: number;
|
||||
production?: boolean;
|
||||
defaultContext?: object;
|
||||
layout?: string;
|
||||
root?: string;
|
||||
viewExt?: string;
|
||||
}
|
||||
@@ -1,5 +1,14 @@
|
||||
import { INestApplication } from '@nestjs/common';
|
||||
import { HTTPInjectOptions, HTTPInjectResponse } from 'fastify';
|
||||
import {
|
||||
FastifyPlugin,
|
||||
FastifyPluginOptions,
|
||||
FastifyRegisterOptions,
|
||||
} from 'fastify';
|
||||
import {
|
||||
InjectOptions,
|
||||
Response as LightMyRequestResponse,
|
||||
} from 'light-my-request';
|
||||
import { FastifyStaticOptions, PointOfViewOptions } from './external';
|
||||
|
||||
export interface NestFastifyApplication extends INestApplication {
|
||||
/**
|
||||
@@ -8,7 +17,10 @@ export interface NestFastifyApplication extends INestApplication {
|
||||
*
|
||||
* @returns {this}
|
||||
*/
|
||||
register(...args: any[]): this;
|
||||
register<Options extends FastifyPluginOptions>(
|
||||
plugin: FastifyPlugin<Options>,
|
||||
opts?: FastifyRegisterOptions<Options>,
|
||||
): this;
|
||||
|
||||
/**
|
||||
* Sets a base directory for public assets.
|
||||
@@ -16,25 +28,21 @@ export interface NestFastifyApplication extends INestApplication {
|
||||
*
|
||||
* @returns {this}
|
||||
*/
|
||||
useStaticAssets(options: {
|
||||
root: string;
|
||||
prefix?: string;
|
||||
setHeaders?: Function;
|
||||
send?: any;
|
||||
}): this;
|
||||
useStaticAssets(options: FastifyStaticOptions): this;
|
||||
|
||||
/**
|
||||
* Sets a view engine for templates (views), for example: `pug`, `handlebars`, or `ejs`.
|
||||
*
|
||||
* Don't pass in a string. The string type in the argument is for compatibilility reason and will cause an exception.
|
||||
* @returns {this}
|
||||
*/
|
||||
setViewEngine(options: any): this;
|
||||
setViewEngine(options: PointOfViewOptions | string): this;
|
||||
|
||||
/**
|
||||
* A wrapper function around native `fastify.inject()` method.
|
||||
* @returns {void}
|
||||
*/
|
||||
inject(opts: HTTPInjectOptions | string): Promise<HTTPInjectResponse>;
|
||||
inject(opts: InjectOptions | string): Promise<LightMyRequestResponse>;
|
||||
|
||||
/**
|
||||
* Starts the application.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nestjs/platform-fastify",
|
||||
"version": "7.2.0",
|
||||
"version": "7.4.4",
|
||||
"description": "Nest - modern, fast, powerful node.js web framework (@platform-fastify)",
|
||||
"author": "Kamil Mysliwiec",
|
||||
"license": "MIT",
|
||||
@@ -17,11 +17,13 @@
|
||||
"access": "public"
|
||||
},
|
||||
"dependencies": {
|
||||
"fastify": "2.14.1",
|
||||
"fastify-cors": "3.0.3",
|
||||
"fastify-formbody": "3.2.0",
|
||||
"fastify": "3.3.0",
|
||||
"fastify-cors": "4.1.0",
|
||||
"fastify-formbody": "5.0.0",
|
||||
"light-my-request": "4.0.2",
|
||||
"middie": "5.1.0",
|
||||
"path-to-regexp": "3.2.0",
|
||||
"tslib": "2.0.0"
|
||||
"tslib": "2.0.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@nestjs/common": "^7.0.0",
|
||||
|
||||
@@ -54,9 +54,11 @@ With official support, you can get expert help straight from Nest core team. We
|
||||
|
||||
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support).
|
||||
|
||||
#### Principal Sponsor
|
||||
|
||||
<a href="https://valor-software.com/" target="_blank"><img src="https://docs.nestjs.com/assets/sponsors/valor-software.png" width="220" /></a>
|
||||
#### Principal Sponsors
|
||||
<table style="text-align:center;"><tr><td>
|
||||
<a href="https://github.com/Sanofi-IADC" target="_blank"><img src="https://docs.nestjs.com/assets/sponsors/sanofi.png" width="180" valign="middle" /></a></td><td>
|
||||
<a href="https://valor-software.com/" target="_blank"><img src="https://docs.nestjs.com/assets/sponsors/valor-software.png" width="180" valign="middle" /></a></td>
|
||||
</tr></table>
|
||||
|
||||
#### Silver Sponsors
|
||||
|
||||
@@ -84,7 +86,11 @@ Nest is an MIT-licensed open source project. It can grow thanks to the sponsors
|
||||
<a href="https://www.codeguesser.co.uk" target="_blank"><img src="https://nestjs.com/img/codeguesser-logo.svg" width="120" valign="middle" /></a> </td><td align="center" valign="middle">
|
||||
<a href="https://tekhattan.com" target="_blank"><img src="https://nestjs.com/img/tekhattan-logo.png" width="110" valign="middle" /></a> </td><td align="center" valign="middle">
|
||||
<a href="https://f-a.nz/" target="_blank"><img src="https://nestjs.com/img/franz.svg" width="80" valign="middle" /></a> </td><td align="center" valign="middle">
|
||||
<a href="https://sparkfabrik.com/" target="_blank"><img src="https://nestjs.com/img/sparkfabrik-logo.png" width="120" valign="middle" /></a></td><td align="center" valign="middle"><a href="https://www.thebigphonestore.co.uk/" target="_blank"><img src="https://nestjs.com/img/the-big-phone-store-logo.png" width="65" valign="middle" /></a></td></tr></table>
|
||||
<a href="https://sparkfabrik.com/" target="_blank"><img src="https://nestjs.com/img/sparkfabrik-logo.png" width="120" valign="middle" /></a></td><td align="center" valign="middle"><a href="https://www.thebigphonestore.co.uk/" target="_blank"><img src="https://nestjs.com/img/the-big-phone-store-logo.png" width="65" valign="middle" /></a></td>
|
||||
<td align="center" valign="middle">
|
||||
<a href="https://genuinebee.com/" target="_blank"><img src="https://nestjs.com/img/genuinebee.svg" width="97" valign="middle" /></a> </td></tr>
|
||||
<tr><td align="center" valign="middle"><a href="https://sanyodigital.com/" target="_blank"><img src="https://nestjs.com/img/sanyo-digital.png" width="130" valign="middle" /></a></td><td align="center" valign="middle"><a href="https://vpn-review.com/vpn-for-torrenting" target="_blank"><img src="https://nestjs.com/img/vpn-review-logo.png" width="85" valign="middle" /></a></td>
|
||||
</tr></table>
|
||||
|
||||
## Backers
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nestjs/platform-socket.io",
|
||||
"version": "7.2.0",
|
||||
"version": "7.4.4",
|
||||
"description": "Nest - modern, fast, powerful node.js web framework (@platform-socket.io)",
|
||||
"author": "Kamil Mysliwiec",
|
||||
"license": "MIT",
|
||||
@@ -18,7 +18,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"socket.io": "2.3.0",
|
||||
"tslib": "2.0.0"
|
||||
"tslib": "2.0.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@nestjs/common": "^7.0.0",
|
||||
|
||||
@@ -54,9 +54,11 @@ With official support, you can get expert help straight from Nest core team. We
|
||||
|
||||
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support).
|
||||
|
||||
#### Principal Sponsor
|
||||
|
||||
<a href="https://valor-software.com/" target="_blank"><img src="https://docs.nestjs.com/assets/sponsors/valor-software.png" width="220" /></a>
|
||||
#### Principal Sponsors
|
||||
<table style="text-align:center;"><tr><td>
|
||||
<a href="https://github.com/Sanofi-IADC" target="_blank"><img src="https://docs.nestjs.com/assets/sponsors/sanofi.png" width="180" valign="middle" /></a></td><td>
|
||||
<a href="https://valor-software.com/" target="_blank"><img src="https://docs.nestjs.com/assets/sponsors/valor-software.png" width="180" valign="middle" /></a></td>
|
||||
</tr></table>
|
||||
|
||||
#### Silver Sponsors
|
||||
|
||||
@@ -84,7 +86,11 @@ Nest is an MIT-licensed open source project. It can grow thanks to the sponsors
|
||||
<a href="https://www.codeguesser.co.uk" target="_blank"><img src="https://nestjs.com/img/codeguesser-logo.svg" width="120" valign="middle" /></a> </td><td align="center" valign="middle">
|
||||
<a href="https://tekhattan.com" target="_blank"><img src="https://nestjs.com/img/tekhattan-logo.png" width="110" valign="middle" /></a> </td><td align="center" valign="middle">
|
||||
<a href="https://f-a.nz/" target="_blank"><img src="https://nestjs.com/img/franz.svg" width="80" valign="middle" /></a> </td><td align="center" valign="middle">
|
||||
<a href="https://sparkfabrik.com/" target="_blank"><img src="https://nestjs.com/img/sparkfabrik-logo.png" width="120" valign="middle" /></a></td><td align="center" valign="middle"><a href="https://www.thebigphonestore.co.uk/" target="_blank"><img src="https://nestjs.com/img/the-big-phone-store-logo.png" width="65" valign="middle" /></a></td></tr></table>
|
||||
<a href="https://sparkfabrik.com/" target="_blank"><img src="https://nestjs.com/img/sparkfabrik-logo.png" width="120" valign="middle" /></a></td><td align="center" valign="middle"><a href="https://www.thebigphonestore.co.uk/" target="_blank"><img src="https://nestjs.com/img/the-big-phone-store-logo.png" width="65" valign="middle" /></a></td>
|
||||
<td align="center" valign="middle">
|
||||
<a href="https://genuinebee.com/" target="_blank"><img src="https://nestjs.com/img/genuinebee.svg" width="97" valign="middle" /></a> </td></tr>
|
||||
<tr><td align="center" valign="middle"><a href="https://sanyodigital.com/" target="_blank"><img src="https://nestjs.com/img/sanyo-digital.png" width="130" valign="middle" /></a></td><td align="center" valign="middle"><a href="https://vpn-review.com/vpn-for-torrenting" target="_blank"><img src="https://nestjs.com/img/vpn-review-logo.png" width="85" valign="middle" /></a></td>
|
||||
</tr></table>
|
||||
|
||||
## Backers
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nestjs/platform-ws",
|
||||
"version": "7.2.0",
|
||||
"version": "7.4.4",
|
||||
"description": "Nest - modern, fast, powerful node.js web framework (@platform-ws)",
|
||||
"author": "Kamil Mysliwiec",
|
||||
"license": "MIT",
|
||||
@@ -17,8 +17,8 @@
|
||||
"access": "public"
|
||||
},
|
||||
"dependencies": {
|
||||
"tslib": "2.0.0",
|
||||
"ws": "7.3.0"
|
||||
"tslib": "2.0.1",
|
||||
"ws": "7.3.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@nestjs/common": "^7.0.0",
|
||||
|
||||
@@ -54,9 +54,11 @@ With official support, you can get expert help straight from Nest core team. We
|
||||
|
||||
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support).
|
||||
|
||||
#### Principal Sponsor
|
||||
|
||||
<a href="https://valor-software.com/" target="_blank"><img src="https://docs.nestjs.com/assets/sponsors/valor-software.png" width="220" /></a>
|
||||
#### Principal Sponsors
|
||||
<table style="text-align:center;"><tr><td>
|
||||
<a href="https://github.com/Sanofi-IADC" target="_blank"><img src="https://docs.nestjs.com/assets/sponsors/sanofi.png" width="180" valign="middle" /></a></td><td>
|
||||
<a href="https://valor-software.com/" target="_blank"><img src="https://docs.nestjs.com/assets/sponsors/valor-software.png" width="180" valign="middle" /></a></td>
|
||||
</tr></table>
|
||||
|
||||
#### Silver Sponsors
|
||||
|
||||
@@ -84,7 +86,11 @@ Nest is an MIT-licensed open source project. It can grow thanks to the sponsors
|
||||
<a href="https://www.codeguesser.co.uk" target="_blank"><img src="https://nestjs.com/img/codeguesser-logo.svg" width="120" valign="middle" /></a> </td><td align="center" valign="middle">
|
||||
<a href="https://tekhattan.com" target="_blank"><img src="https://nestjs.com/img/tekhattan-logo.png" width="110" valign="middle" /></a> </td><td align="center" valign="middle">
|
||||
<a href="https://f-a.nz/" target="_blank"><img src="https://nestjs.com/img/franz.svg" width="80" valign="middle" /></a> </td><td align="center" valign="middle">
|
||||
<a href="https://sparkfabrik.com/" target="_blank"><img src="https://nestjs.com/img/sparkfabrik-logo.png" width="120" valign="middle" /></a></td><td align="center" valign="middle"><a href="https://www.thebigphonestore.co.uk/" target="_blank"><img src="https://nestjs.com/img/the-big-phone-store-logo.png" width="65" valign="middle" /></a></td></tr></table>
|
||||
<a href="https://sparkfabrik.com/" target="_blank"><img src="https://nestjs.com/img/sparkfabrik-logo.png" width="120" valign="middle" /></a></td><td align="center" valign="middle"><a href="https://www.thebigphonestore.co.uk/" target="_blank"><img src="https://nestjs.com/img/the-big-phone-store-logo.png" width="65" valign="middle" /></a></td>
|
||||
<td align="center" valign="middle">
|
||||
<a href="https://genuinebee.com/" target="_blank"><img src="https://nestjs.com/img/genuinebee.svg" width="97" valign="middle" /></a> </td></tr>
|
||||
<tr><td align="center" valign="middle"><a href="https://sanyodigital.com/" target="_blank"><img src="https://nestjs.com/img/sanyo-digital.png" width="130" valign="middle" /></a></td><td align="center" valign="middle"><a href="https://vpn-review.com/vpn-for-torrenting" target="_blank"><img src="https://nestjs.com/img/vpn-review-logo.png" width="85" valign="middle" /></a></td>
|
||||
</tr></table>
|
||||
|
||||
## Backers
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nestjs/testing",
|
||||
"version": "7.2.0",
|
||||
"version": "7.4.4",
|
||||
"description": "Nest - modern, fast, powerful node.js web framework (@testing)",
|
||||
"author": "Kamil Mysliwiec",
|
||||
"license": "MIT",
|
||||
@@ -18,7 +18,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"optional": "0.1.4",
|
||||
"tslib": "2.0.0"
|
||||
"tslib": "2.0.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@nestjs/common": "^7.0.0",
|
||||
|
||||
@@ -3,13 +3,17 @@ import {
|
||||
INestApplication,
|
||||
INestMicroservice,
|
||||
Logger,
|
||||
NestApplicationOptions,
|
||||
Type,
|
||||
} from '@nestjs/common';
|
||||
import { NestMicroserviceOptions } from '@nestjs/common/interfaces/microservices/nest-microservice-options.interface';
|
||||
import { NestApplicationContextOptions } from '@nestjs/common/interfaces/nest-application-context-options.interface';
|
||||
import { NestApplicationOptions } from '@nestjs/common/interfaces/nest-application-options.interface';
|
||||
import { Type } from '@nestjs/common/interfaces/type.interface';
|
||||
import { loadPackage } from '@nestjs/common/utils/load-package.util';
|
||||
import { NestApplication, NestApplicationContext } from '@nestjs/core';
|
||||
import {
|
||||
AbstractHttpAdapter,
|
||||
NestApplication,
|
||||
NestApplicationContext,
|
||||
} from '@nestjs/core';
|
||||
import { ApplicationConfig } from '@nestjs/core/application-config';
|
||||
import { NestContainer } from '@nestjs/core/injector/container';
|
||||
import { Module } from '@nestjs/core/injector/module';
|
||||
@@ -25,7 +29,7 @@ export class TestingModule extends NestApplicationContext {
|
||||
}
|
||||
|
||||
public createNestApplication<T extends INestApplication = INestApplication>(
|
||||
httpAdapter?: HttpServer,
|
||||
httpAdapter?: HttpServer | AbstractHttpAdapter,
|
||||
options?: NestApplicationOptions,
|
||||
): T {
|
||||
httpAdapter = httpAdapter || this.createHttpAdapter();
|
||||
@@ -58,7 +62,7 @@ export class TestingModule extends NestApplicationContext {
|
||||
);
|
||||
}
|
||||
|
||||
private createHttpAdapter<T = any>(httpServer?: T): HttpServer {
|
||||
private createHttpAdapter<T = any>(httpServer?: T): AbstractHttpAdapter {
|
||||
const { ExpressAdapter } = loadPackage(
|
||||
'@nestjs/platform-express',
|
||||
'NestFactory',
|
||||
|
||||
@@ -54,9 +54,11 @@ With official support, you can get expert help straight from Nest core team. We
|
||||
|
||||
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support).
|
||||
|
||||
#### Principal Sponsor
|
||||
|
||||
<a href="https://valor-software.com/" target="_blank"><img src="https://docs.nestjs.com/assets/sponsors/valor-software.png" width="220" /></a>
|
||||
#### Principal Sponsors
|
||||
<table style="text-align:center;"><tr><td>
|
||||
<a href="https://github.com/Sanofi-IADC" target="_blank"><img src="https://docs.nestjs.com/assets/sponsors/sanofi.png" width="180" valign="middle" /></a></td><td>
|
||||
<a href="https://valor-software.com/" target="_blank"><img src="https://docs.nestjs.com/assets/sponsors/valor-software.png" width="180" valign="middle" /></a></td>
|
||||
</tr></table>
|
||||
|
||||
#### Silver Sponsors
|
||||
|
||||
@@ -84,7 +86,11 @@ Nest is an MIT-licensed open source project. It can grow thanks to the sponsors
|
||||
<a href="https://www.codeguesser.co.uk" target="_blank"><img src="https://nestjs.com/img/codeguesser-logo.svg" width="120" valign="middle" /></a> </td><td align="center" valign="middle">
|
||||
<a href="https://tekhattan.com" target="_blank"><img src="https://nestjs.com/img/tekhattan-logo.png" width="110" valign="middle" /></a> </td><td align="center" valign="middle">
|
||||
<a href="https://f-a.nz/" target="_blank"><img src="https://nestjs.com/img/franz.svg" width="80" valign="middle" /></a> </td><td align="center" valign="middle">
|
||||
<a href="https://sparkfabrik.com/" target="_blank"><img src="https://nestjs.com/img/sparkfabrik-logo.png" width="120" valign="middle" /></a></td><td align="center" valign="middle"><a href="https://www.thebigphonestore.co.uk/" target="_blank"><img src="https://nestjs.com/img/the-big-phone-store-logo.png" width="65" valign="middle" /></a></td></tr></table>
|
||||
<a href="https://sparkfabrik.com/" target="_blank"><img src="https://nestjs.com/img/sparkfabrik-logo.png" width="120" valign="middle" /></a></td><td align="center" valign="middle"><a href="https://www.thebigphonestore.co.uk/" target="_blank"><img src="https://nestjs.com/img/the-big-phone-store-logo.png" width="65" valign="middle" /></a></td>
|
||||
<td align="center" valign="middle">
|
||||
<a href="https://genuinebee.com/" target="_blank"><img src="https://nestjs.com/img/genuinebee.svg" width="97" valign="middle" /></a> </td></tr>
|
||||
<tr><td align="center" valign="middle"><a href="https://sanyodigital.com/" target="_blank"><img src="https://nestjs.com/img/sanyo-digital.png" width="130" valign="middle" /></a></td><td align="center" valign="middle"><a href="https://vpn-review.com/vpn-for-torrenting" target="_blank"><img src="https://nestjs.com/img/vpn-review-logo.png" width="85" valign="middle" /></a></td>
|
||||
</tr></table>
|
||||
|
||||
## Backers
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nestjs/websockets",
|
||||
"version": "7.2.0",
|
||||
"version": "7.4.4",
|
||||
"description": "Nest - modern, fast, powerful node.js web framework (@websockets)",
|
||||
"author": "Kamil Mysliwiec",
|
||||
"license": "MIT",
|
||||
@@ -13,11 +13,11 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"iterare": "1.2.1",
|
||||
"tslib": "2.0.0"
|
||||
"tslib": "2.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@nestjs/common": "7.2.0",
|
||||
"@nestjs/core": "7.2.0"
|
||||
"@nestjs/common": "7.4.4",
|
||||
"@nestjs/core": "7.4.4"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@nestjs/common": "^7.0.0",
|
||||
|
||||
3588
sample/01-cats-app/package-lock.json
generated
3588
sample/01-cats-app/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -19,36 +19,36 @@
|
||||
"test:e2e": "jest --config ./e2e/jest-e2e.json"
|
||||
},
|
||||
"dependencies": {
|
||||
"@nestjs/common": "7.1.3",
|
||||
"@nestjs/core": "7.1.3",
|
||||
"@nestjs/platform-express": "7.1.3",
|
||||
"class-transformer": "0.2.3",
|
||||
"@nestjs/common": "7.4.3",
|
||||
"@nestjs/core": "7.4.3",
|
||||
"@nestjs/platform-express": "7.4.3",
|
||||
"class-transformer": "0.3.1",
|
||||
"class-validator": "0.12.2",
|
||||
"reflect-metadata": "0.1.13",
|
||||
"rimraf": "3.0.2",
|
||||
"rxjs": "6.5.5"
|
||||
"rxjs": "6.6.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@nestjs/cli": "7.2.0",
|
||||
"@nestjs/schematics": "7.0.1",
|
||||
"@nestjs/testing": "7.1.3",
|
||||
"@types/express": "4.17.6",
|
||||
"@types/jest": "25.2.1",
|
||||
"@nestjs/cli": "7.5.1",
|
||||
"@nestjs/schematics": "7.1.1",
|
||||
"@nestjs/testing": "7.4.3",
|
||||
"@types/express": "4.17.7",
|
||||
"@types/jest": "26.0.10",
|
||||
"@types/node": "10.17.3",
|
||||
"@types/supertest": "2.0.9",
|
||||
"jest": "26.0.1",
|
||||
"prettier": "2.0.5",
|
||||
"@types/supertest": "2.0.10",
|
||||
"jest": "26.4.2",
|
||||
"prettier": "2.1.1",
|
||||
"supertest": "4.0.2",
|
||||
"ts-jest": "26.1.0",
|
||||
"ts-loader": "7.0.5",
|
||||
"ts-node": "8.10.2",
|
||||
"ts-jest": "26.3.0",
|
||||
"ts-loader": "8.0.3",
|
||||
"ts-node": "9.0.0",
|
||||
"tsconfig-paths": "3.9.0",
|
||||
"@typescript-eslint/eslint-plugin": "3.3.0",
|
||||
"@typescript-eslint/parser": "3.3.0",
|
||||
"eslint": "7.2.0",
|
||||
"@typescript-eslint/eslint-plugin": "3.10.1",
|
||||
"@typescript-eslint/parser": "3.10.1",
|
||||
"eslint": "7.7.0",
|
||||
"eslint-config-prettier": "6.11.0",
|
||||
"eslint-plugin-import": "2.21.2",
|
||||
"typescript": "3.9.5"
|
||||
"eslint-plugin-import": "2.22.0",
|
||||
"typescript": "4.0.2"
|
||||
},
|
||||
"jest": {
|
||||
"moduleFileExtensions": [
|
||||
|
||||
4573
sample/02-gateways/package-lock.json
generated
4573
sample/02-gateways/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -19,40 +19,40 @@
|
||||
"test:e2e": "echo 'No e2e tests implemented yet.'"
|
||||
},
|
||||
"dependencies": {
|
||||
"@nestjs/common": "7.1.3",
|
||||
"@nestjs/core": "7.1.3",
|
||||
"@nestjs/platform-express": "7.1.3",
|
||||
"@nestjs/platform-socket.io": "7.1.3",
|
||||
"@nestjs/websockets": "7.1.3",
|
||||
"class-transformer": "0.2.3",
|
||||
"@nestjs/common": "7.4.3",
|
||||
"@nestjs/core": "7.4.3",
|
||||
"@nestjs/platform-express": "7.4.3",
|
||||
"@nestjs/platform-socket.io": "7.4.3",
|
||||
"@nestjs/websockets": "7.4.3",
|
||||
"class-transformer": "0.3.1",
|
||||
"class-validator": "0.12.2",
|
||||
"reflect-metadata": "0.1.13",
|
||||
"rimraf": "3.0.2",
|
||||
"rxjs": "6.5.5",
|
||||
"rxjs": "6.6.2",
|
||||
"socket.io-redis": "5.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/socket.io": "2.1.8",
|
||||
"@types/socket.io": "2.1.11",
|
||||
"@types/socket.io-redis": "1.0.26",
|
||||
"@types/ws": "7.2.5",
|
||||
"@nestjs/cli": "7.2.0",
|
||||
"@nestjs/schematics": "7.0.1",
|
||||
"@nestjs/testing": "7.1.3",
|
||||
"@types/express": "4.17.6",
|
||||
"@types/ws": "7.2.6",
|
||||
"@nestjs/cli": "7.5.1",
|
||||
"@nestjs/schematics": "7.1.1",
|
||||
"@nestjs/testing": "7.4.3",
|
||||
"@types/express": "4.17.7",
|
||||
"@types/node": "7.10.9",
|
||||
"@types/supertest": "2.0.9",
|
||||
"jest": "26.0.1",
|
||||
"prettier": "2.0.5",
|
||||
"@types/supertest": "2.0.10",
|
||||
"jest": "26.4.2",
|
||||
"prettier": "2.1.1",
|
||||
"supertest": "4.0.2",
|
||||
"ts-jest": "26.1.0",
|
||||
"ts-loader": "7.0.5",
|
||||
"ts-node": "8.10.2",
|
||||
"ts-jest": "26.3.0",
|
||||
"ts-loader": "8.0.3",
|
||||
"ts-node": "9.0.0",
|
||||
"tsconfig-paths": "3.9.0",
|
||||
"@typescript-eslint/eslint-plugin": "3.3.0",
|
||||
"@typescript-eslint/parser": "3.3.0",
|
||||
"eslint": "7.2.0",
|
||||
"@typescript-eslint/eslint-plugin": "3.10.1",
|
||||
"@typescript-eslint/parser": "3.10.1",
|
||||
"eslint": "7.7.0",
|
||||
"eslint-config-prettier": "6.11.0",
|
||||
"eslint-plugin-import": "2.21.2",
|
||||
"typescript": "3.9.5"
|
||||
"eslint-plugin-import": "2.22.0",
|
||||
"typescript": "4.0.2"
|
||||
}
|
||||
}
|
||||
|
||||
4555
sample/03-microservices/package-lock.json
generated
4555
sample/03-microservices/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -19,36 +19,36 @@
|
||||
"test:e2e": "echo 'No e2e tests implemented yet.'"
|
||||
},
|
||||
"dependencies": {
|
||||
"@nestjs/common": "7.1.3",
|
||||
"@nestjs/core": "7.1.3",
|
||||
"@nestjs/microservices": "7.1.3",
|
||||
"@nestjs/platform-express": "7.1.3",
|
||||
"class-transformer": "0.2.3",
|
||||
"@nestjs/common": "7.4.3",
|
||||
"@nestjs/core": "7.4.3",
|
||||
"@nestjs/microservices": "7.4.3",
|
||||
"@nestjs/platform-express": "7.4.3",
|
||||
"class-transformer": "0.3.1",
|
||||
"class-validator": "0.12.2",
|
||||
"reflect-metadata": "0.1.13",
|
||||
"rimraf": "3.0.2",
|
||||
"rxjs": "6.5.5"
|
||||
"rxjs": "6.6.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@nestjs/cli": "7.2.0",
|
||||
"@nestjs/schematics": "7.0.1",
|
||||
"@nestjs/testing": "7.1.3",
|
||||
"@nestjs/cli": "7.5.1",
|
||||
"@nestjs/schematics": "7.1.1",
|
||||
"@nestjs/testing": "7.4.3",
|
||||
"@types/amqplib": "0.5.13",
|
||||
"@types/express": "4.17.6",
|
||||
"@types/express": "4.17.7",
|
||||
"@types/node": "12.12.31",
|
||||
"@types/supertest": "2.0.9",
|
||||
"jest": "26.0.1",
|
||||
"prettier": "2.0.5",
|
||||
"@types/supertest": "2.0.10",
|
||||
"jest": "26.4.2",
|
||||
"prettier": "2.1.1",
|
||||
"supertest": "4.0.2",
|
||||
"ts-jest": "26.1.0",
|
||||
"ts-loader": "7.0.5",
|
||||
"ts-node": "8.10.2",
|
||||
"ts-jest": "26.3.0",
|
||||
"ts-loader": "8.0.3",
|
||||
"ts-node": "9.0.0",
|
||||
"tsconfig-paths": "3.9.0",
|
||||
"@typescript-eslint/eslint-plugin": "3.3.0",
|
||||
"@typescript-eslint/parser": "3.3.0",
|
||||
"eslint": "7.2.0",
|
||||
"@typescript-eslint/eslint-plugin": "3.10.1",
|
||||
"@typescript-eslint/parser": "3.10.1",
|
||||
"eslint": "7.7.0",
|
||||
"eslint-config-prettier": "6.11.0",
|
||||
"eslint-plugin-import": "2.21.2",
|
||||
"typescript": "3.9.5"
|
||||
"eslint-plugin-import": "2.22.0",
|
||||
"typescript": "4.0.2"
|
||||
}
|
||||
}
|
||||
|
||||
4586
sample/04-grpc/package-lock.json
generated
4586
sample/04-grpc/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -19,37 +19,37 @@
|
||||
"test:e2e": "echo 'No e2e tests implemented yet.'"
|
||||
},
|
||||
"dependencies": {
|
||||
"@grpc/proto-loader": "0.5.4",
|
||||
"@nestjs/common": "7.1.3",
|
||||
"@nestjs/core": "7.1.3",
|
||||
"@nestjs/microservices": "7.1.3",
|
||||
"class-transformer": "0.2.3",
|
||||
"@grpc/proto-loader": "0.5.5",
|
||||
"@nestjs/common": "7.4.3",
|
||||
"@nestjs/core": "7.4.3",
|
||||
"@nestjs/microservices": "7.4.3",
|
||||
"class-transformer": "0.3.1",
|
||||
"class-validator": "0.12.2",
|
||||
"grpc": "1.24.3",
|
||||
"reflect-metadata": "0.1.13",
|
||||
"rimraf": "3.0.2",
|
||||
"rxjs": "6.5.5"
|
||||
"rxjs": "6.6.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@nestjs/cli": "7.2.0",
|
||||
"@nestjs/schematics": "7.0.1",
|
||||
"@nestjs/testing": "7.1.3",
|
||||
"@types/express": "4.17.6",
|
||||
"@nestjs/cli": "7.5.1",
|
||||
"@nestjs/schematics": "7.1.1",
|
||||
"@nestjs/testing": "7.4.3",
|
||||
"@types/express": "4.17.7",
|
||||
"@types/node": "10.17.3",
|
||||
"@types/supertest": "2.0.9",
|
||||
"@types/ws": "7.2.5",
|
||||
"jest": "26.0.1",
|
||||
"prettier": "2.0.5",
|
||||
"@types/supertest": "2.0.10",
|
||||
"@types/ws": "7.2.6",
|
||||
"jest": "26.4.2",
|
||||
"prettier": "2.1.1",
|
||||
"supertest": "4.0.2",
|
||||
"ts-jest": "26.1.0",
|
||||
"ts-loader": "7.0.5",
|
||||
"ts-node": "8.10.2",
|
||||
"ts-jest": "26.3.0",
|
||||
"ts-loader": "8.0.3",
|
||||
"ts-node": "9.0.0",
|
||||
"tsconfig-paths": "3.9.0",
|
||||
"@typescript-eslint/eslint-plugin": "3.3.0",
|
||||
"@typescript-eslint/parser": "3.3.0",
|
||||
"eslint": "7.2.0",
|
||||
"@typescript-eslint/eslint-plugin": "3.10.1",
|
||||
"@typescript-eslint/parser": "3.10.1",
|
||||
"eslint": "7.7.0",
|
||||
"eslint-config-prettier": "6.11.0",
|
||||
"eslint-plugin-import": "2.21.2",
|
||||
"typescript": "3.9.5"
|
||||
"eslint-plugin-import": "2.22.0",
|
||||
"typescript": "4.0.2"
|
||||
}
|
||||
}
|
||||
|
||||
4850
sample/05-sql-typeorm/package-lock.json
generated
4850
sample/05-sql-typeorm/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -19,36 +19,36 @@
|
||||
"test:e2e": "echo 'No e2e tests implemented yet.'"
|
||||
},
|
||||
"dependencies": {
|
||||
"@nestjs/common": "7.1.3",
|
||||
"@nestjs/core": "7.1.3",
|
||||
"@nestjs/platform-express": "7.1.3",
|
||||
"@nestjs/typeorm": "7.1.0",
|
||||
"@nestjs/common": "7.4.3",
|
||||
"@nestjs/core": "7.4.3",
|
||||
"@nestjs/platform-express": "7.4.3",
|
||||
"@nestjs/typeorm": "7.1.1",
|
||||
"mysql": "2.18.1",
|
||||
"reflect-metadata": "0.1.13",
|
||||
"rimraf": "3.0.2",
|
||||
"rxjs": "6.5.5",
|
||||
"rxjs": "6.6.2",
|
||||
"typeorm": "0.2.25"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@nestjs/cli": "7.2.0",
|
||||
"@nestjs/schematics": "7.0.1",
|
||||
"@nestjs/testing": "7.1.3",
|
||||
"@types/express": "4.17.6",
|
||||
"@nestjs/cli": "7.5.1",
|
||||
"@nestjs/schematics": "7.1.1",
|
||||
"@nestjs/testing": "7.4.3",
|
||||
"@types/express": "4.17.7",
|
||||
"@types/node": "7.10.9",
|
||||
"@types/supertest": "2.0.9",
|
||||
"@types/ws": "7.2.5",
|
||||
"jest": "26.0.1",
|
||||
"prettier": "2.0.5",
|
||||
"@types/supertest": "2.0.10",
|
||||
"@types/ws": "7.2.6",
|
||||
"jest": "26.4.2",
|
||||
"prettier": "2.1.1",
|
||||
"supertest": "4.0.2",
|
||||
"ts-jest": "26.1.0",
|
||||
"ts-loader": "7.0.5",
|
||||
"ts-node": "8.10.2",
|
||||
"ts-jest": "26.3.0",
|
||||
"ts-loader": "8.0.3",
|
||||
"ts-node": "9.0.0",
|
||||
"tsconfig-paths": "3.9.0",
|
||||
"@typescript-eslint/eslint-plugin": "3.3.0",
|
||||
"@typescript-eslint/parser": "3.3.0",
|
||||
"eslint": "7.2.0",
|
||||
"@typescript-eslint/eslint-plugin": "3.10.1",
|
||||
"@typescript-eslint/parser": "3.10.1",
|
||||
"eslint": "7.7.0",
|
||||
"eslint-config-prettier": "6.11.0",
|
||||
"eslint-plugin-import": "2.21.2",
|
||||
"typescript": "3.9.5"
|
||||
"eslint-plugin-import": "2.22.0",
|
||||
"typescript": "4.0.2"
|
||||
}
|
||||
}
|
||||
|
||||
4589
sample/06-mongoose/package-lock.json
generated
4589
sample/06-mongoose/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -19,36 +19,36 @@
|
||||
"test:e2e": "echo 'No e2e tests implemented yet.'"
|
||||
},
|
||||
"dependencies": {
|
||||
"@nestjs/common": "7.1.3",
|
||||
"@nestjs/core": "7.1.3",
|
||||
"@nestjs/mongoose": "7.0.1",
|
||||
"@nestjs/platform-express": "7.1.3",
|
||||
"mongoose": "5.9.19",
|
||||
"@nestjs/common": "7.4.3",
|
||||
"@nestjs/core": "7.4.3",
|
||||
"@nestjs/mongoose": "7.0.2",
|
||||
"@nestjs/platform-express": "7.4.3",
|
||||
"mongoose": "5.10.2",
|
||||
"reflect-metadata": "0.1.13",
|
||||
"rimraf": "3.0.2",
|
||||
"rxjs": "6.5.5"
|
||||
"rxjs": "6.6.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/mongoose": "5.7.26",
|
||||
"@nestjs/cli": "7.2.0",
|
||||
"@nestjs/schematics": "7.0.1",
|
||||
"@nestjs/testing": "7.1.3",
|
||||
"@types/express": "4.17.6",
|
||||
"@types/mongoose": "5.7.36",
|
||||
"@nestjs/cli": "7.5.1",
|
||||
"@nestjs/schematics": "7.1.1",
|
||||
"@nestjs/testing": "7.4.3",
|
||||
"@types/express": "4.17.7",
|
||||
"@types/node": "12.12.31",
|
||||
"@types/supertest": "2.0.9",
|
||||
"@types/ws": "7.2.5",
|
||||
"jest": "26.0.1",
|
||||
"prettier": "2.0.5",
|
||||
"@types/supertest": "2.0.10",
|
||||
"@types/ws": "7.2.6",
|
||||
"jest": "26.4.2",
|
||||
"prettier": "2.1.1",
|
||||
"supertest": "4.0.2",
|
||||
"ts-jest": "26.1.0",
|
||||
"ts-loader": "7.0.5",
|
||||
"ts-node": "8.10.2",
|
||||
"ts-jest": "26.3.0",
|
||||
"ts-loader": "8.0.3",
|
||||
"ts-node": "9.0.0",
|
||||
"tsconfig-paths": "3.9.0",
|
||||
"@typescript-eslint/eslint-plugin": "3.3.0",
|
||||
"@typescript-eslint/parser": "3.3.0",
|
||||
"eslint": "7.2.0",
|
||||
"@typescript-eslint/eslint-plugin": "3.10.1",
|
||||
"@typescript-eslint/parser": "3.10.1",
|
||||
"eslint": "7.7.0",
|
||||
"eslint-config-prettier": "6.11.0",
|
||||
"eslint-plugin-import": "2.21.2",
|
||||
"typescript": "3.9.5"
|
||||
"eslint-plugin-import": "2.22.0",
|
||||
"typescript": "4.0.2"
|
||||
}
|
||||
}
|
||||
|
||||
4537
sample/07-sequelize/package-lock.json
generated
4537
sample/07-sequelize/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -19,39 +19,39 @@
|
||||
"test:e2e": "echo 'No e2e tests implemented yet.'"
|
||||
},
|
||||
"dependencies": {
|
||||
"@nestjs/common": "7.1.3",
|
||||
"@nestjs/core": "7.1.3",
|
||||
"@nestjs/platform-express": "7.1.3",
|
||||
"@nestjs/sequelize": "0.1.0",
|
||||
"@nestjs/common": "7.4.3",
|
||||
"@nestjs/core": "7.4.3",
|
||||
"@nestjs/platform-express": "7.4.3",
|
||||
"@nestjs/sequelize": "0.1.1",
|
||||
"mysql2": "2.1.0",
|
||||
"reflect-metadata": "0.1.13",
|
||||
"rimraf": "3.0.2",
|
||||
"rxjs": "6.5.5",
|
||||
"sequelize": "5.21.13",
|
||||
"rxjs": "6.6.2",
|
||||
"sequelize": "5.22.3",
|
||||
"sequelize-typescript": "1.1.0",
|
||||
"typescript": "3.9.5"
|
||||
"typescript": "4.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/sequelize": "4.28.9",
|
||||
"@nestjs/cli": "7.2.0",
|
||||
"@nestjs/schematics": "7.0.1",
|
||||
"@nestjs/testing": "7.1.3",
|
||||
"@types/express": "4.17.6",
|
||||
"@nestjs/cli": "7.5.1",
|
||||
"@nestjs/schematics": "7.1.1",
|
||||
"@nestjs/testing": "7.4.3",
|
||||
"@types/express": "4.17.7",
|
||||
"@types/node": "12.12.31",
|
||||
"@types/supertest": "2.0.9",
|
||||
"@types/ws": "7.2.5",
|
||||
"jest": "26.0.1",
|
||||
"prettier": "2.0.5",
|
||||
"@types/supertest": "2.0.10",
|
||||
"@types/ws": "7.2.6",
|
||||
"jest": "26.4.2",
|
||||
"prettier": "2.1.1",
|
||||
"supertest": "4.0.2",
|
||||
"ts-jest": "26.1.0",
|
||||
"ts-loader": "7.0.5",
|
||||
"ts-node": "8.10.2",
|
||||
"ts-jest": "26.3.0",
|
||||
"ts-loader": "8.0.3",
|
||||
"ts-node": "9.0.0",
|
||||
"tsconfig-paths": "3.9.0",
|
||||
"@typescript-eslint/eslint-plugin": "3.3.0",
|
||||
"@typescript-eslint/parser": "3.3.0",
|
||||
"eslint": "7.2.0",
|
||||
"@typescript-eslint/eslint-plugin": "3.10.1",
|
||||
"@typescript-eslint/parser": "3.10.1",
|
||||
"eslint": "7.7.0",
|
||||
"eslint-config-prettier": "6.11.0",
|
||||
"eslint-plugin-import": "2.21.2",
|
||||
"typescript": "3.9.5"
|
||||
"eslint-plugin-import": "2.22.0",
|
||||
"typescript": "4.0.2"
|
||||
}
|
||||
}
|
||||
|
||||
2079
sample/08-webpack/package-lock.json
generated
2079
sample/08-webpack/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -11,25 +11,25 @@
|
||||
"test:e2e": "echo 'No e2e tests implemented yet.'"
|
||||
},
|
||||
"dependencies": {
|
||||
"@nestjs/common": "7.1.3",
|
||||
"@nestjs/core": "7.1.3",
|
||||
"@nestjs/platform-express": "7.1.3",
|
||||
"@nestjs/common": "7.4.3",
|
||||
"@nestjs/core": "7.4.3",
|
||||
"@nestjs/platform-express": "7.4.3",
|
||||
"reflect-metadata": "0.1.13",
|
||||
"rxjs": "6.5.5",
|
||||
"typescript": "3.9.5"
|
||||
"rxjs": "6.6.2",
|
||||
"typescript": "4.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "12.12.31",
|
||||
"@typescript-eslint/eslint-plugin": "3.3.0",
|
||||
"@typescript-eslint/parser": "3.3.0",
|
||||
"eslint": "7.2.0",
|
||||
"@typescript-eslint/eslint-plugin": "3.10.1",
|
||||
"@typescript-eslint/parser": "3.10.1",
|
||||
"eslint": "7.7.0",
|
||||
"eslint-config-prettier": "6.11.0",
|
||||
"eslint-plugin-import": "2.21.2",
|
||||
"eslint-plugin-import": "2.22.0",
|
||||
"start-server-webpack-plugin": "2.2.5",
|
||||
"ts-loader": "7.0.5",
|
||||
"ts-node": "8.10.2",
|
||||
"webpack": "4.43.0",
|
||||
"webpack-cli": "3.3.11",
|
||||
"ts-loader": "8.0.3",
|
||||
"ts-node": "9.0.0",
|
||||
"webpack": "4.44.1",
|
||||
"webpack-cli": "3.3.12",
|
||||
"webpack-node-externals": "1.7.2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ module.exports = function(options) {
|
||||
watch: true,
|
||||
externals: [
|
||||
nodeExternals({
|
||||
whitelist: ['webpack/hot/poll?100'],
|
||||
allowlist: ['webpack/hot/poll?100'],
|
||||
}),
|
||||
],
|
||||
plugins: [
|
||||
|
||||
4409
sample/09-babel-example/package-lock.json
generated
4409
sample/09-babel-example/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -13,27 +13,27 @@
|
||||
"test:e2e": "echo 'No e2e tests implemented yet.'"
|
||||
},
|
||||
"dependencies": {
|
||||
"@nestjs/common": "7.1.3",
|
||||
"@nestjs/core": "7.1.3",
|
||||
"@nestjs/platform-express": "7.1.3",
|
||||
"@nestjs/microservices": "7.1.3",
|
||||
"@nestjs/websockets": "7.1.3",
|
||||
"@nestjs/common": "7.4.3",
|
||||
"@nestjs/core": "7.4.3",
|
||||
"@nestjs/platform-express": "7.4.3",
|
||||
"@nestjs/microservices": "7.4.3",
|
||||
"@nestjs/websockets": "7.4.3",
|
||||
"reflect-metadata": "0.1.13",
|
||||
"rxjs": "6.5.5"
|
||||
"rxjs": "6.6.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "7.10.1",
|
||||
"@babel/core": "7.10.2",
|
||||
"@babel/node": "7.10.1",
|
||||
"@babel/plugin-proposal-decorators": "7.10.1",
|
||||
"@babel/plugin-transform-runtime": "7.10.1",
|
||||
"@babel/preset-env": "7.10.2",
|
||||
"@babel/register": "7.10.1",
|
||||
"@babel/runtime": "7.10.2",
|
||||
"@nestjs/testing": "7.1.3",
|
||||
"jest": "26.0.1",
|
||||
"@babel/cli": "7.10.5",
|
||||
"@babel/core": "7.11.4",
|
||||
"@babel/node": "7.10.5",
|
||||
"@babel/plugin-proposal-decorators": "7.10.5",
|
||||
"@babel/plugin-transform-runtime": "7.11.0",
|
||||
"@babel/preset-env": "7.11.0",
|
||||
"@babel/register": "7.10.5",
|
||||
"@babel/runtime": "7.11.2",
|
||||
"@nestjs/testing": "7.4.3",
|
||||
"jest": "26.4.2",
|
||||
"nodemon": "2.0.4",
|
||||
"prettier": "2.0.5",
|
||||
"prettier": "2.1.1",
|
||||
"supertest": "4.0.2"
|
||||
},
|
||||
"jest": {
|
||||
|
||||
4734
sample/10-fastify/package-lock.json
generated
4734
sample/10-fastify/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user